diff --git a/.github/labeler-pull-request-triage.yml b/.github/labeler-pull-request-triage.yml index 481e0862d485..bd61780931db 100644 --- a/.github/labeler-pull-request-triage.yml +++ b/.github/labeler-pull-request-triage.yml @@ -138,6 +138,9 @@ service/hpc-cache: service/hsm: - internal/services/hsm/**/* +service/hybrid-compute: + - internal/services/hybridcompute/**/* + service/iot-central: - internal/services/iotcentral/**/* @@ -198,6 +201,9 @@ service/media: service/mixed-reality: - internal/services/mixedreality/**/* +service/mobile-network: + - internal/services/mobilenetwork/**/* + service/monitor: - internal/services/monitor/**/* diff --git a/.github/workflows/golint.yaml b/.github/workflows/golint.yaml index c1d3db31308a..5ffbd815e9d8 100644 --- a/.github/workflows/golint.yaml +++ b/.github/workflows/golint.yaml @@ -26,5 +26,5 @@ jobs: go-version-file: ./.go-version - uses: golangci/golangci-lint-action@v3 with: - version: 'v1.50.1' + version: 'v1.51.1' args: -v diff --git a/.github/workflows/gradually-deprecated.yaml b/.github/workflows/gradually-deprecated.yaml index 9a97cdf1934e..9c7c8cf9e043 100644 --- a/.github/workflows/gradually-deprecated.yaml +++ b/.github/workflows/gradually-deprecated.yaml @@ -11,6 +11,7 @@ on: paths: - '.github/workflows/gradually-deprecated.yaml' - '**.go' + - './scripts/run-gradually-deprecated.sh' jobs: test: @@ -22,7 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: ./.go-version - - run: ./scripts/run-gradually-deprecated.sh + - run: bash ./scripts/run-gradually-deprecated.sh - name: Add waiting-response on fail if: failure() uses: actions-ecosystem/action-add-labels@v1 diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml index d3a3ba7be8f6..aadb50ee1c7e 100644 --- a/.github/workflows/mkdocs.yml +++ b/.github/workflows/mkdocs.yml @@ -3,6 +3,8 @@ on: push: branches: - main + paths: + - 'contributing/**' workflow_dispatch: permissions: diff --git a/.teamcity/components/generated/services.kt b/.teamcity/components/generated/services.kt index 45ba5a29313d..97d56fdc3d54 100644 --- a/.teamcity/components/generated/services.kt +++ b/.teamcity/components/generated/services.kt @@ -23,6 +23,7 @@ var services = mapOf( "confidentialledger" to "Confidential Ledger", "connections" to "Connections", "consumption" to "Consumption", + "containerapps" to "Container Apps", "containers" to "Container Services", "cosmos" to "CosmosDB", "costmanagement" to "Cost Management", @@ -51,6 +52,7 @@ var services = mapOf( "hpccache" to "HPC Cache", "hsm" to "Hardware Security Module", "healthcare" to "Health Care", + "hybridcompute" to "Hybrid Compute", "iotcentral" to "IoT Central", "iothub" to "IoT Hub", "keyvault" to "KeyVault", @@ -73,6 +75,7 @@ var services = mapOf( "media" to "Media", "mssql" to "Microsoft SQL Server / Azure SQL", "mixedreality" to "Mixed Reality", + "mobilenetwork" to "Mobile Network", "monitor" to "Monitor", "mysql" to "MySQL", "netapp" to "NetApp", diff --git a/.teamcity/components/settings.kt b/.teamcity/components/settings.kt index f7bec51fa917..92182fec962b 100644 --- a/.teamcity/components/settings.kt +++ b/.teamcity/components/settings.kt @@ -53,13 +53,19 @@ var serviceTestConfigurationOverrides = mapOf( //Confidential Ledger "confidentialledger" to testConfiguration(locationOverride = LocationConfiguration("eastus","southcentralus","westeurope", false)), + // Container App Managed Environments are limited to 20 per location, using 10 as they can take some time to clear + "containerapps" to testConfiguration(parallelism = 10, locationOverride = LocationConfiguration("westeurope","eastus","canadacentral", false)), + // The AKS API has a low rate limit "containers" to testConfiguration(parallelism = 5, locationOverride = LocationConfiguration("eastus","westeurope","eastus2", false), useDevTestSubscription = true), // Custom Providers is only available in certain locations "customproviders" to testConfiguration(locationOverride = LocationConfiguration("eastus", "westus2", "westeurope", true)), - // Datadog is available only in WestUS2 region + // Dashboard is only available in certain locations + "dashboard" to testConfiguration(locationOverride = LocationConfiguration("westeurope", "westus2", "eastus2", false)), + + // Datadog is available only in WestUS2 region "datadog" to testConfiguration(locationOverride = LocationConfiguration("westus2", "westus2", "centraluseuap", false)), // data factory uses NC class VMs which are not available in eastus2 @@ -104,8 +110,8 @@ var serviceTestConfigurationOverrides = mapOf( // MySQL has quota available in certain locations "mysql" to testConfiguration(locationOverride = LocationConfiguration("westeurope", "francecentral", "eastus2", false), useDevTestSubscription = true), - // netapp has a max of 10 accounts per subscription so lets limit it to 3 to account for broken ones, run Monday, Wednesday, Friday - "netapp" to testConfiguration(parallelism = 3, daysOfWeek = "2,4,6", useDevTestSubscription = true), + // netapp has a max of 10 accounts and the max capacity of pool is 25 TiB per subscription so lets limit it to 1 to account for broken ones, run Monday, Wednesday, Friday + "netapp" to testConfiguration(parallelism = 1, daysOfWeek = "2,4,6", locationOverride = LocationConfiguration("westeurope", "eastus2", "westus2", false), useDevTestSubscription = true), // Orbital is only available in certain locations "orbital" to testConfiguration(locationOverride = LocationConfiguration("eastus", "southcentralus", "westus2", false)), diff --git a/CHANGELOG-v2.md b/CHANGELOG-v2.md index d7ac2ab21c1b..fc43e9c74731 100644 --- a/CHANGELOG-v2.md +++ b/CHANGELOG-v2.md @@ -1099,7 +1099,7 @@ FEATURES: ENHANCEMENTS: * `azurerm_api_management_named_value` - support for system managed identities ([#12938](https://github.com/hashicorp/terraform-provider-azurerm/issues/12938)) -* `azurerm_application_insights_smart_detection_rule` - support all currenly availible rules in the SDK ([#12857](https://github.com/hashicorp/terraform-provider-azurerm/issues/12857)) +* `azurerm_application_insights_smart_detection_rule` - support all currently available rules in the SDK ([#12857](https://github.com/hashicorp/terraform-provider-azurerm/issues/12857)) * `azurerm_function_app` - add support for `dotnet_framework_version` in ([#12883](https://github.com/hashicorp/terraform-provider-azurerm/issues/12883)) * `azurerm_resource_group` - conditionally (based on the `prevent_deletion_if_contains_resources` features flag - see the 'Upgrade Notes' section) checking for nested Resources during deletion of the Resource Group and raising an error if Resources are found ([#12657](https://github.com/hashicorp/terraform-provider-azurerm/issues/12657)) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e7c6cd6a007..055b5798611c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,16 +1,265 @@ -## 3.40.0 (Unreleased) +## 3.44.1 (February 17, 2023) + +ENHANCEMENTS + +* dependencies: updating to `v0.20230217.1150808` of `github.com/hashicorp/go-azure-sdk` ([#20539](https://github.com/hashicorp/terraform-provider-azurerm/issues/20539)) + +BUG FIXES + +* authentication: fixing an issue when obtaining the auth token for Resource Manager in Azure Government ([#20523](https://github.com/hashicorp/terraform-provider-azurerm/issues/20523)) +* authentication: fixing an issue where the default subscription ID was not detected when authenticating using Azure CLI ([#20526](https://github.com/hashicorp/terraform-provider-azurerm/issues/20526)) +* authentication: fixing an issue where Managed Identity authentication would fail ([#20523](https://github.com/hashicorp/terraform-provider-azurerm/issues/20523)) +* Data Source: `azurerm_app_configuration_key` - fixing an issue where the App Configuration was misleadingly marked as gone when the data plane client couldn't be build ([#20533](https://github.com/hashicorp/terraform-provider-azurerm/issues/20533)) +* Data Source: `azurerm_app_configuration_key` - surfacing the error when a data plane client can't be built ([#20533](https://github.com/hashicorp/terraform-provider-azurerm/issues/20533)) +* Data Source: `azurerm_app_configuration_keys` - fixing an issue where the App Configuration was misleadingly marked as gone when the data plane client couldn't be build ([#20533](https://github.com/hashicorp/terraform-provider-azurerm/issues/20533)) +* Data Source: `azurerm_app_configuration_keys` - surfacing the error when a data plane client can't be built ([#20533](https://github.com/hashicorp/terraform-provider-azurerm/issues/20533)) +* `azurerm_app_configuration_feature` - fixing an issue where the App Configuration was misleadingly marked as gone when the data plane client couldn't be build ([#20533](https://github.com/hashicorp/terraform-provider-azurerm/issues/20533)) +* `azurerm_app_configuration_feature` - surfacing the error when a data plane client can't be built ([#20533](https://github.com/hashicorp/terraform-provider-azurerm/issues/20533)) +* `azurerm_app_configuration_key` - fixing an issue where the App Configuration was misleadingly marked as gone when the data plane client couldn't be build ([#20533](https://github.com/hashicorp/terraform-provider-azurerm/issues/20533)) +* `azurerm_app_configuration_key` - surfacing the error when a data plane client can't be built ([#20533](https://github.com/hashicorp/terraform-provider-azurerm/issues/20533)) +* `azurerm_kubernetes_cluster` - fix a crash when `securityProfile` is nil in the API Response ([#20517](https://github.com/hashicorp/terraform-provider-azurerm/issues/20517)) +* `azurerm_logic_app_standard` - fixing an issue where the `storage endpoint suffix` couldn't be found ([#20536](https://github.com/hashicorp/terraform-provider-azurerm/issues/20536)) +* `azurerm_synapse_role_assignment` - fixing an issue where the `Synapse domain suffix` couldn't be found ([#20536](https://github.com/hashicorp/terraform-provider-azurerm/issues/20536)) + +## 3.44.0 (February 16, 2023) + +FEATURES: + +* **New Data Source:** `azurerm_hybrid_compute_machine` ([#20211](https://github.com/hashicorp/terraform-provider-azurerm/issues/20211)) +* **New Data Source:** `azurerm_policy_definition_built_in` ([#19933](https://github.com/hashicorp/terraform-provider-azurerm/issues/19933)) +* **New Data Source:** `azurerm_mobile_network_service` ([#20337](https://github.com/hashicorp/terraform-provider-azurerm/issues/20337)) +* **New Data Source:** `azurerm_mobile_network_site` ([#20334](https://github.com/hashicorp/terraform-provider-azurerm/issues/20334)) +* **New Data Source:** `azurerm_mobile_network_slice` ([#20336](https://github.com/hashicorp/terraform-provider-azurerm/issues/20336)) +* **New Data Source:** `azurerm_mobile_network_sim_group` ([#20339](https://github.com/hashicorp/terraform-provider-azurerm/issues/20339)) +* **New Data Source:** `azurerm_virtual_desktop_host_pool` ([#20505](https://github.com/hashicorp/terraform-provider-azurerm/issues/20505)) +* **New Resource:** `azurerm_network_manager_security_admin_configuration` ([#20233](https://github.com/hashicorp/terraform-provider-azurerm/issues/20233)) +* **New Resource:** `azurerm_network_manager_admin_rule_collection` ([#20233](https://github.com/hashicorp/terraform-provider-azurerm/issues/20233)) +* **New Resource:** `azurerm_network_manager_admin_rule` ([#20233](https://github.com/hashicorp/terraform-provider-azurerm/issues/20233)) +* **New Resource:** `azurerm_mobile_network_service` ([#20337](https://github.com/hashicorp/terraform-provider-azurerm/issues/20337)) +* **New Resource:** `azurerm_mobile_network_site` ([#20334](https://github.com/hashicorp/terraform-provider-azurerm/issues/20334)) +* **New Resource:** `azurerm_mobile_network_slice` ([#20336](https://github.com/hashicorp/terraform-provider-azurerm/issues/20336)) +* **New Resource:** `azurerm_mobile_network_sim_group` [GH-20339 +* **New Resource:** `azurerm_site_recovery_services_vault_hyperv_site` [GH-204309 + +ENHANCEMENTS: + +* dependencies: updating to `v0.20230216.1112535` of `github.com/hashicorp/go-azure-sdk` ([#20465](https://github.com/hashicorp/terraform-provider-azurerm/issues/20465)) +* dependencies: no longer utilizing `github.com/manicminer/hamilton` ([#20320](https://github.com/hashicorp/terraform-provider-azurerm/issues/20320)) +* provider: support for the `client_certificate` provider property ([#20320](https://github.com/hashicorp/terraform-provider-azurerm/issues/20320)) +* provider: support for the `use_cli` provider property ([#20320](https://github.com/hashicorp/terraform-provider-azurerm/issues/20320)) +* provider: authentication now uses the `github.com/hashicorp/go-azure-sdk/sdk/auth` package ([#20320](https://github.com/hashicorp/terraform-provider-azurerm/issues/20320)) +* provider: cloud configuration now uses the `github.com/hashicorp/go-azure-sdk/sdk/environments` package ([#20320](https://github.com/hashicorp/terraform-provider-azurerm/issues/20320)) +* `datashare`: refactoring to use `github.com/hashicorp/go-azure-sdk` ([#20501](https://github.com/hashicorp/terraform-provider-azurerm/issues/20501)) +* `managementlocks`: refactoring to use `github.com/hashicorp/go-azure-sdk` ([#20387](https://github.com/hashicorp/terraform-provider-azurerm/issues/20387)) +* `media`: refactoring `StreamingEndpoints` to use API Version `2022-08-01` ([#20457](https://github.com/hashicorp/terraform-provider-azurerm/issues/20457)) +* `postgres` - updating API to `2022-12-01` ([#20370](https://github.com/hashicorp/terraform-provider-azurerm/issues/20370)) +* Data Source: `azurerm_policy_definition` - support for the `mode` property ([#20420](https://github.com/hashicorp/terraform-provider-azurerm/issues/20420)) +* Data Source: `azurerm_key_vault_certificates` - now exports the `certificates` block ([#20498](https://github.com/hashicorp/terraform-provider-azurerm/issues/20498)) +* Data Source: `azurerm_key_vault_secrets` - now exports the `secrets` block ([#20498](https://github.com/hashicorp/terraform-provider-azurerm/issues/20498)) +* `azurerm_api_management` - support for the `delegation` block ([#20399](https://github.com/hashicorp/terraform-provider-azurerm/issues/20399)) +* `azurerm_container_app` - now supports multiple `container` blocks ([#20423](https://github.com/hashicorp/terraform-provider-azurerm/issues/20423)) +* `azurerm_cognitive_account` - the field `sku_name` can now be set to `DC0` ([#20426](https://github.com/hashicorp/terraform-provider-azurerm/issues/20426)) +* `azurerm_container_app` - support for the `registry.identity` property ([#20466](https://github.com/hashicorp/terraform-provider-azurerm/issues/20466)) +* `azurerm_data_factory_linked_service_azure_blob_storage` - Add support for `connection_string_insecure` [Gh-20494] +* `azurerm_express_route_port` - support for the `billing_type` property ([#20361](https://github.com/hashicorp/terraform-provider-azurerm/issues/20361)) +* `azurerm_kubernetes_cluster` - the `web_app_routing.dns_zone_id` property now accepts an empty string for BYO DNS ([#20341](https://github.com/hashicorp/terraform-provider-azurerm/issues/20341)) +* `azurerm_linux_virtual_machine` - validating that the value for the `admin_username` property isn't a disallowed username ([#20424](https://github.com/hashicorp/terraform-provider-azurerm/issues/20424)) +* `azurerm_windows_virtual_machine` - validating that the value for the `admin_username` property isn't a disallowed username ([#20424](https://github.com/hashicorp/terraform-provider-azurerm/issues/20424)) + +BUG FIXES: + +* Data Source: `azurerm_aadb2c_directory` - fixing a bug where the Data Source didn't return an error when the AAD B2C was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_app_service_environment_v3` - fixing a bug where the Data Source didn't return an error when the App Service Environment was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_consumption_budget_resource_group` - using the correct timeout value ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_consumption_budget_resource_group` - fixing a bug where the Data Source didn't return an error when the Consumption Budget Resource Group was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_data_protection_backup_vault` - fixing a bug where the Data Source didn't return an error when the Data Protection Backup Vault was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_databox_edge_device` - fixing a bug where the Data Source didn't return an error when the DataBox Edge Device was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_healthcare_dicom` - fixing a bug where the Data Source didn't return an error when the HealthCare DICOM was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_healthcare_fhir` - fixing a bug where the Data Source didn't return an error when the HealthCare FHIR was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_healthcare_medtech_service` - fixing a bug where the Data Source didn't return an error when the HealthCare MedTech Service was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_key_vault_certificate_data` - fixing a bug where the Data Source didn't return an error when the KeyVault Certificate was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_key_vault_certificate` - fixing a bug where the Data Source didn't return an error when the KeyVault Certificate was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_lb_outbound_rule` - fixing a bug where the Data Source didn't return an error when the Load Balancer Outbound Rule was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_lb_rule` - fixing a bug where the Data Source didn't return an error when the Load Balancer Rule was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_local_network_gateway` - fixing a bug where the Data Source didn't return an error when the Local Network Gateway was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_mobile_network` - fixing a bug where the Data Source didn't return an error when the Mobile Network was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_monitor_data_collection_endpoint` - fixing a bug where the Data Source didn't return an error when the Monitor Data Collection Endpoint was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_mssql_managed_instance` - fixing a bug where the Data Source didn't return an error when the MSSQL Managed Instance was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_policy_assignment` - fixing a bug where the Data Source didn't return an error when the Policy Assignment was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_redis_enterprise_database` - fixing a bug where the Data Source didn't return an error when the Redis Enterprise Database was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_servicebus_namespace_disaster_recovery_config` - fixing a bug where the Data Source didn't return an error when the ServiceBus Namespace Disaster Recovery Config was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_site_recovery_replication_recovery_plan` - fixing a bug where the Data Source didn't return an error when the Site Recovery Replication Recovery Plan was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_storage_blob` - fixing a bug where the Data Source didn't return an error when the Blob was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_storage_table_entity` - fixing a bug where the Data Source didn't return an error when the Table Entity was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_vpn_gateway` - fixing a bug where the Data Source didn't return an error when the VPN Gateway was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* Data Source: `azurerm_web_pubsub` - fixing a bug where the Data Source didn't return an error when the Web PubSub was not found ([#20479](https://github.com/hashicorp/terraform-provider-azurerm/issues/20479)) +* `azurerm_backup_protected_vm` - will now correctly delete ([#20469](https://github.com/hashicorp/terraform-provider-azurerm/issues/20469)) +* `azurerm_eventhub` - changing the `partition_count` property now works by creating a new resource ([#20480](https://github.com/hashicorp/terraform-provider-azurerm/issues/20480)) +* `azurerm_eventgrid_domain_topic` - the `name` property can now be up to 128 characters ([#20407](https://github.com/hashicorp/terraform-provider-azurerm/issues/20407)) +* `azurerm_kubernetes_cluster` - parsing the API response for the `log_analytics_workspace_id` field case-insensitively ([#20484](https://github.com/hashicorp/terraform-provider-azurerm/issues/20484)) +* `azurerm_private_endpoint` - normalizing the `private_connection_resource_id` propety for a redis cache ([#20418](https://github.com/hashicorp/terraform-provider-azurerm/issues/20418)) +* `azurerm_private_endpoint` - consistently normalizing the value returned from the API for `private_connection_resource_id` ([#20452](https://github.com/hashicorp/terraform-provider-azurerm/issues/20452)) +* `azurerm_recovery_services_vault` - updating `cross_region_restore_enabled` to `false` recreates the resource since this operation isn't supported by the API ([#20406](https://github.com/hashicorp/terraform-provider-azurerm/issues/20406)) +* `azurerm_storage_management_policy` - the `rule.filters` property is now Required since storage management policies fail if it's unspecified ([#20448](https://github.com/hashicorp/terraform-provider-azurerm/issues/20448)) + +## 3.43.0 (February 09, 2023) + +FEATURES + +* **New Data Source:** `azurerm_container_app_environment` ([#18008](https://github.com/hashicorp/terraform-provider-azurerm/issues/18008)) +* **New Data Source:** `azurerm_container_app_environment_certificate` ([#18008](https://github.com/hashicorp/terraform-provider-azurerm/issues/18008)) +* **New Data Source:** `azurerm_mobile_network` ([#20128](https://github.com/hashicorp/terraform-provider-azurerm/issues/20128)) +* **New Resource:** `azurerm_container_app_environment` ([#18008](https://github.com/hashicorp/terraform-provider-azurerm/issues/18008)) +* **New Resource:** `azurerm_container_app_environment_storage` ([#18008](https://github.com/hashicorp/terraform-provider-azurerm/issues/18008)) +* **New Resource:** `azurerm_container_app_environment_dapr_component` ([#18008](https://github.com/hashicorp/terraform-provider-azurerm/issues/18008)) +* **New Resource:** `azurerm_container_app_environment_certificate` ([#18008](https://github.com/hashicorp/terraform-provider-azurerm/issues/18008)) +* **New Resource:** `azurerm_container_app` ([#18008](https://github.com/hashicorp/terraform-provider-azurerm/issues/18008)) +* **New Resource:** `azurerm_machine_learning_datastore_fileshare` ([#19934](https://github.com/hashicorp/terraform-provider-azurerm/issues/19934)) +* **New Resource:** `azurerm_machine_learning_datastore_datalake_gen2` ([#20045](https://github.com/hashicorp/terraform-provider-azurerm/issues/20045)) +* **New Resource:** `azurerm_mobile_network` ([#20128](https://github.com/hashicorp/terraform-provider-azurerm/issues/20128)) +* **New Resource:** `azurerm_sentinel_data_connector_microsoft_threat_intelligence` ([#20273](https://github.com/hashicorp/terraform-provider-azurerm/issues/20273)) + +ENHANCEMENTS: + +* dependencies: updating to `v0.11.28` of `github.com/Azure/go-autorest/autorest` ([#20272](https://github.com/hashicorp/terraform-provider-azurerm/issues/20272)) +* dependencies: updating to `v0.50.0` of `github.com/hashicorp/go-azure-helpers` ([#20272](https://github.com/hashicorp/terraform-provider-azurerm/issues/20272)) +* dependencies: updating to `v0.20230208.1165725` of `github.com/hashicorp/go-azure-sdk` ([#20381](https://github.com/hashicorp/terraform-provider-azurerm/issues/20381)) +* dependencies: updating to `v0.55.0` of `github.com/manicminer/hamilton` ([#20272](https://github.com/hashicorp/terraform-provider-azurerm/issues/20272)) +* dependencies: updating to `v0.20230208.1135849` of `github.com/tombuildsstuff/kermit` ([#20381](https://github.com/hashicorp/terraform-provider-azurerm/issues/20381)) +* dependences: updating `postgresql/2021-06-01/databases` to 2022-12-01 ([#20369](https://github.com/hashicorp/terraform-provider-azurerm/issues/20369)) +* `appservice`: updating to API Version `2021-03-01` ([#20349](https://github.com/hashicorp/terraform-provider-azurerm/issues/20349)) +* `azurestackhci`: refactoring to use `github.com/hashicorp/go-azure-sdk` ([#20318](https://github.com/hashicorp/terraform-provider-azurerm/issues/20318)) +* `batch`: refactoring to use `github.com/hashicorp/go-azure-sdk` ([#20375](https://github.com/hashicorp/terraform-provider-azurerm/issues/20375)) +* `databricks`: refactoring to use `github.com/hashicorp/go-azure-sdk` ([#20309](https://github.com/hashicorp/terraform-provider-azurerm/issues/20309)) +* `datadog`: refactoring to use `github.com/hashicorp/go-azure-sdk` ([#20311](https://github.com/hashicorp/terraform-provider-azurerm/issues/20311)) +* `databoxedge`: refactoring to use `github.com/hashicorp/go-azure-sdk` ([#20236](https://github.com/hashicorp/terraform-provider-azurerm/issues/20236)) +* `digitaltwins`: refactoring to use `github.com/hashicorp/go-azure-sdk` ([#20318](https://github.com/hashicorp/terraform-provider-azurerm/issues/20318)) +* `postgresql`: updating to API Version `2022-12-01` ([#20367](https://github.com/hashicorp/terraform-provider-azurerm/issues/20367)) +* `redis`: refactoring to use `github.com/hashicorp/go-azure-sdk` ([#20313](https://github.com/hashicorp/terraform-provider-azurerm/issues/20313)) +* `azurerm_media_streaming_locator` - support for the `filter_names` property ([#20274](https://github.com/hashicorp/terraform-provider-azurerm/issues/20274)) +* `azurerm_media_live_event_output` - support for the `rewind_window_duration` property ([#20271](https://github.com/hashicorp/terraform-provider-azurerm/issues/20271)) +* `azurerm_media_streaming_live_event` - support for the `stream_options` property ([#20254](https://github.com/hashicorp/terraform-provider-azurerm/issues/20254)) +* `azurerm_storage_blob_inventory_policy` - support for the `exclude_prefixes` property ([#20281](https://github.com/hashicorp/terraform-provider-azurerm/issues/20281)) +* `azurerm_sentinel_alert_rule_nrt` - support for the `dynamic_property` block ([#20212](https://github.com/hashicorp/terraform-provider-azurerm/issues/20212)) +* `azurerm_sentinel_alert_rule_nrt` - support for the `sentinel_entity_mapping` block ([#20230](https://github.com/hashicorp/terraform-provider-azurerm/issues/20230)) +* `azurerm_sentinel_alert_rule_nrt` - support for the `event_grouping` block ([#20231](https://github.com/hashicorp/terraform-provider-azurerm/issues/20231)) +* `azurerm_sentinel_alert_rule_scheduled` - support for the `dynamic_property` block ([#20212](https://github.com/hashicorp/terraform-provider-azurerm/issues/20212)) +* `azurerm_sentinel_alert_rule_scheduled` - support for the `sentinel_entity_mapping` block ([#20230](https://github.com/hashicorp/terraform-provider-azurerm/issues/20230)) +* `azurerm_shared_image` - support for the `confidential_vm_supported` and `confidential_vm_enabled` properties ([#20249](https://github.com/hashicorp/terraform-provider-azurerm/issues/20249)) +* `azurerm_postgresql_flexible_server` - support for `replication_role` and new enum value `Replica` for `create_mode` ([#20364](https://github.com/hashicorp/terraform-provider-azurerm/issues/20364)) + +BUG FIXES: + +* `azurerm_custom_provider` - switching a spurious usage of `Azure/azure-sdk-for-go` to `hashicorp/go-azure-sdk` ([#20315](https://github.com/hashicorp/terraform-provider-azurerm/issues/20315)) +* `azurerm_function_app_function` - prevent a bug with multiple file blocks resulting in last file being used for all entries ([#20198](https://github.com/hashicorp/terraform-provider-azurerm/issues/20198)) +* `azurerm_monitor_diagnostic_setting` - changing the `storage_account_id`, `eventhub_authorization_rule_id`, and `eventhub_name` properties no longer creates a new resource ([#20307](https://github.com/hashicorp/terraform-provider-azurerm/issues/20307)) +* `azurerm_redis_enterprise_cluster` - switching a spurious usage of `Azure/azure-sdk-for-go` to `hashicorp/go-azure-sdk` ([#20314](https://github.com/hashicorp/terraform-provider-azurerm/issues/20314)) +* `azurerm_service_fabric_managed_cluster` - Fix potential panic when setting `node_type` ([#20345](https://github.com/hashicorp/terraform-provider-azurerm/issues/20345)) +* `azurerm_web_application_firewall_policy` - prevent a failure caused by changing the order of the `disabled_rules` properties ([#20285](https://github.com/hashicorp/terraform-provider-azurerm/issues/20285)) +* `azurerm_databricks_access_connector` - `name` can now be up to 64 character in length ([#20353](https://github.com/hashicorp/terraform-provider-azurerm/issues/20353)) + +## 3.42.0 (February 02, 2023) + +FEATURES + +* **New Resource:** `azurerm_ip_group_cidr` ([#20225](https://github.com/hashicorp/terraform-provider-azurerm/issues/20225)) +* **New Resource:** `azurerm_network_manager_connectivity_configuration` ([#20133](https://github.com/hashicorp/terraform-provider-azurerm/issues/20133)) + +ENHANCEMENTS: + +* dependencies: updating to `v0.20230130.1140358 ` of `github.com/hashicorp/go-azure-sdk` ([#20293](https://github.com/hashicorp/terraform-provider-azurerm/issues/20293)) +* `databasemigration`: refactoring to use `github.com/hashicorp/go-azure-sdk` ([#20214](https://github.com/hashicorp/terraform-provider-azurerm/issues/20214)) +* `servicefabric`: refactoring to use github.com/hashicorp/go-azure-sdk ([#20202](https://github.com/hashicorp/terraform-provider-azurerm/issues/20202)) +* `azurerm_kubernetes_cluster` - add support for the `confidential_computing` add-on ([#20194](https://github.com/hashicorp/terraform-provider-azurerm/issues/20194)) +* `azurerm_kubernetes_cluster` - export the identity for the `aci_connector_linux` add-on ([#20194](https://github.com/hashicorp/terraform-provider-azurerm/issues/20194)) +* `azurerm_lb_backend_address_pool` - support for the `virtual_network_id` property ([#20205](https://github.com/hashicorp/terraform-provider-azurerm/issues/20205)) +* `azurerm_postgresql_flexible_server`: add default value for `authentication.active_directory_auth_enabled` and `authentication.password_auth_enabled` ([#20054](https://github.com/hashicorp/terraform-provider-azurerm/issues/20054)) +* `azurerm_site_recovery_protection_container_mapping` - support for the `automatic_update` block ([#19710](https://github.com/hashicorp/terraform-provider-azurerm/issues/19710)) +* `azurerm_site_recovery_replicated_vm` - support for the `unmanaged_disk`, `target_proximity_placement_group_id`, `target_boot_diag_storage_account_id`, `target_capacity_reservation_group_id`, `target_virtual_machine_scale_set_id`, `multi_vm_group_name`, `target_edge_zone`, and `test_network_id` properties ([#19939](https://github.com/hashicorp/terraform-provider-azurerm/issues/19939)) + +BUG FIXES: + +* `data.azurerm_monitor_data_collection_rule` - raises an error when the specified data collection rule can't be found ([#20282](https://github.com/hashicorp/terraform-provider-azurerm/issues/20282)) +* `azurerm_federated_identity_credential` - prevent a perpetual diff ([#20219](https://github.com/hashicorp/terraform-provider-azurerm/issues/20219)) +* `azurerm_linux_function_app` - fix `linuxFxVersion` for docker `registry_url` processing ([#18194](https://github.com/hashicorp/terraform-provider-azurerm/issues/18194)) +* `azurerm_monitor_aad_diagnostic_setting` - the field `log_analytics_workspace_id` is now parsed case-insensitively from the API Response ([#20206](https://github.com/hashicorp/terraform-provider-azurerm/issues/20206)) + +## 3.41.0 (January 26, 2023) + +FEATURES + +* **New Data Source:** `azurerm_key_vault_certificates` ([#19498](https://github.com/hashicorp/terraform-provider-azurerm/issues/19498)) +* **New Data Source:** `azurerm_site_recovery_replication_recovery_plan` ([#19940](https://github.com/hashicorp/terraform-provider-azurerm/issues/19940)) +* **New Resource:** `azurerm_orbital_contact` ([#19036](https://github.com/hashicorp/terraform-provider-azurerm/issues/19036)) +* **New Resource:** `azurerm_site_recovery_replication_recovery_plan` ([#19940](https://github.com/hashicorp/terraform-provider-azurerm/issues/19940)) + +ENHANCEMENTS: + +* dependencies: updating to `v0.20230124.1111819` of `github.com/hashicorp/go-azure-sdk` ([#20160](https://github.com/hashicorp/terraform-provider-azurerm/issues/20160)) +* resourceproviders: no longer registering `Microsoft.ServiceFabricMesh` by default ([#20165](https://github.com/hashicorp/terraform-provider-azurerm/issues/20165)) +* testing: refactoring to use `hashicorp/terraform-plugin-testing` ([#20114](https://github.com/hashicorp/terraform-provider-azurerm/issues/20114)) +* `devtestlabs`: refactoring to use `github.com/hashicorp/go-azure-sdk` ([#20139](https://github.com/hashicorp/terraform-provider-azurerm/issues/20139)) +* `logic`: refactoring to use `github.com/hashicorp/go-azure-sdk` ([#20144](https://github.com/hashicorp/terraform-provider-azurerm/issues/20144)) +* `network`: updating to API version `2022-07-01` ([#20097](https://github.com/hashicorp/terraform-provider-azurerm/issues/20097)) +* `postgresql`: updating to API version `2022-03-08-preview` ([#20073](https://github.com/hashicorp/terraform-provider-azurerm/issues/20073)) +* `streamanalytics`: updating to API Version `2021-10-01-preview` ([#20145](https://github.com/hashicorp/terraform-provider-azurerm/issues/20145)) +* `azurerm_*_app_slot` - support for slots to be placed in different service plans ([#20184](https://github.com/hashicorp/terraform-provider-azurerm/issues/20184)) +* `azurerm_databricks_workspace` - support for customer managed keys for managed disks attached to the workspace ([#19992](https://github.com/hashicorp/terraform-provider-azurerm/issues/19992)) +* `azurerm_databricks_workspace` - support for updating the properties `public_network_access_enabled`, `network_security_group_rules_required` and ` managed_services_cmk_key_vault_key_id` ([#19992](https://github.com/hashicorp/terraform-provider-azurerm/issues/19992)) +* `azurerm_kubernetes_cluster` - support for `node_public_ip_tags` ([#19731](https://github.com/hashicorp/terraform-provider-azurerm/issues/19731)) +* `azurerm_kubernetes_cluster_node_pool` - support for `node_public_ip_tags` ([#19731](https://github.com/hashicorp/terraform-provider-azurerm/issues/19731)) +* `azurerm_log_analytics_workspace` - support for the `local_authentication_disabled` property ([#20092](https://github.com/hashicorp/terraform-provider-azurerm/issues/20092)) +* `azurerm_postgresql_flexible_server` - support for customer managed keys ([#20086](https://github.com/hashicorp/terraform-provider-azurerm/issues/20086)) +* `azurerm_storage_account` - support for `AADKERB` to `azure_files_authentication.0.directory_type` ([#20168](https://github.com/hashicorp/terraform-provider-azurerm/issues/20168)) + +BUG FIXES: + +* `azurerm_stream_analytics_output_servicebus_queue` - shared access policy name and key are now optional for MSI authentication ([#19712](https://github.com/hashicorp/terraform-provider-azurerm/issues/19712)) +* `azurerm_stream_analytics_output_servicebus_topic` - shared access policy name and key are now optional for MSI authentication ([#19708](https://github.com/hashicorp/terraform-provider-azurerm/issues/19708)) + +## 3.40.0 (January 19, 2023) + +FEATURES + +* **New Data Source:** `azurerm_bastion_host` ([#20062](https://github.com/hashicorp/terraform-provider-azurerm/issues/20062)) +* **New Resource:** `azurerm_lab_service_schedule` ([#19977](https://github.com/hashicorp/terraform-provider-azurerm/issues/19977)) +* **New Resource:** `azurerm_machine_learning_datastore_blobstorage` ([#19909](https://github.com/hashicorp/terraform-provider-azurerm/issues/19909)) +* **New Resource:** `azurerm_network_manager_scope_connection` ([#19610](https://github.com/hashicorp/terraform-provider-azurerm/issues/19610)) +* **New Resource:** `azurerm_network_manager_static_member` ([#20077](https://github.com/hashicorp/terraform-provider-azurerm/issues/20077)) +* **New Resource:** `azurerm_sentinel_log_analytics_workspace_onboarding` ([#19692](https://github.com/hashicorp/terraform-provider-azurerm/issues/19692)) ENHANCEMENTS: -* `azurerm_application_gateway` - add TLS 1.3 and CustomV2 support [GH-20029] -* `azurerm_kubernetes_cluster` - support for the `kube_proxy` block [GH-19567] -* `azurerm_linux_web_app` - Add Python 3.11 support [GH-20001] -* `azurerm_linux_web_app_slot` - Add Python 3.11 support [GH-20001] -* `azurerm_synapse_sql_pool` - add support for `geo_backup_policy_enabled` and fix `recovery_database_id` [[GH-20010] +* dependencies: updating to `v0.20230117.1125206` of `github.com/hashicorp/go-azure-sdk` ([#20081](https://github.com/hashicorp/terraform-provider-azurerm/issues/20081)) +* `azurerm_application_gateway` - support for TLS 1.3 and CustomV2 ([#20029](https://github.com/hashicorp/terraform-provider-azurerm/issues/20029)) +* `azurerm_kubernetes_cluster` - support for the `key_management_service` block ([#19893](https://github.com/hashicorp/terraform-provider-azurerm/issues/19893)) +* `azurerm_linux_web_app` - support for Python 3.11 ([#20001](https://github.com/hashicorp/terraform-provider-azurerm/issues/20001)) +* `azurerm_linux_web_app_slot` - support for Python 3.11 ([#20001](https://github.com/hashicorp/terraform-provider-azurerm/issues/20001)) +* `azurerm_ip_group` - support for the `firewall_ids` and `firewall_policy_ids` properties ([#19845](https://github.com/hashicorp/terraform-provider-azurerm/issues/19845)) +* `azurerm_recovery_services_vault` - support for the `immutability`, user assigned `identity` and `use_system_assigned_identity` properties ([#20109](https://github.com/hashicorp/terraform-provider-azurerm/issues/20109)) +* `azurerm_synapse_sql_pool` - support for `geo_backup_policy_enabled` and fix `recovery_database_id` [([#20010](https://github.com/hashicorp/terraform-provider-azurerm/issues/20010)) BUG FIXES: -* `azurerm_container_group` - Fix dynamic setting `dns_config` crash issue [GH-20002] +* Data Source: `azurerm_batch_pool` - the field `password` is now correctly marked as a sensitive value ([#20061](https://github.com/hashicorp/terraform-provider-azurerm/issues/20061)) +* Data Source: `azurerm_batch_pool` - the field `ssh_private_key ` is now correctly marked as a sensitive value ([#20061](https://github.com/hashicorp/terraform-provider-azurerm/issues/20061)) +* `azurerm_api_management_identity_provider_twitter` - the field `api_key` is now correctly marked as a sensitive value ([#20061](https://github.com/hashicorp/terraform-provider-azurerm/issues/20061)) +* `azurerm_cdn_frontdoor_origin_group` - shim SDK to allow `health_probe` to be passed as `null` ([#20015](https://github.com/hashicorp/terraform-provider-azurerm/issues/20015)) +* `azurerm_container_group` - Fix dynamic setting `dns_config` crash issue ([#20002](https://github.com/hashicorp/terraform-provider-azurerm/issues/20002)) +* `azurerm_container_registry_task` - the field `password` is now correctly marked as a sensitive value ([#20061](https://github.com/hashicorp/terraform-provider-azurerm/issues/20061)) +* `azurerm_dev_test_windows_virtual_machine` - the `password` field is now correctly marked as a sensitive value ([#20061](https://github.com/hashicorp/terraform-provider-azurerm/issues/20061)) +* `azurerm_federated_identity_credential` - preent concurrent write to parent resource ([#20003](https://github.com/hashicorp/terraform-provider-azurerm/issues/20003)) +* `azurerm_linux_web_app_slot` - fix a bug where `use_32_bit_worker` would not be set correctly ([#20051](https://github.com/hashicorp/terraform-provider-azurerm/issues/20051)) +* `azurerm_postgresql_flexible_server_configuration` - restart server when required ([#20044](https://github.com/hashicorp/terraform-provider-azurerm/issues/20044)) +* `azurerm_kubernetes_cluster` - prevent a possible panic while importing ([#20107](https://github.com/hashicorp/terraform-provider-azurerm/issues/20107)) +* `azurerm_service_fabric_managed_cluster` - the `password` field is now correctly marked as a sensitive value ([#20061](https://github.com/hashicorp/terraform-provider-azurerm/issues/20061)) +* `azurerm_service_fabric_managed_cluster` - the `resource_group_name` field is now correctly marked as ForceNew ([#20061](https://github.com/hashicorp/terraform-provider-azurerm/issues/20061)) +* `azurerm_spring_cloud_configuration_service ` - the field `password` is now correctly marked as a sensitive value ([#20061](https://github.com/hashicorp/terraform-provider-azurerm/issues/20061)) +* `azurerm_spring_cloud_configuration_service ` - the field `private_key` is now correctly marked as a sensitive value ([#20061](https://github.com/hashicorp/terraform-provider-azurerm/issues/20061)) +* `azurerm_static_site` - the field `api_key` is now correctly marked as a sensitive value ([#20061](https://github.com/hashicorp/terraform-provider-azurerm/issues/20061)) +* `azurerm_storage_account` - will no longer silently ignore `404` error while reading service properties ([#19062](https://github.com/hashicorp/terraform-provider-azurerm/issues/19062)) +* `azurerm_storage_account` - the `infrastructure_encryption_enabled` is now supportted for premium accounts ([#20028](https://github.com/hashicorp/terraform-provider-azurerm/issues/20028)) +* `azurerm_windows_web_app_slot` - fix a bug where `use_32_bit_worker` would not be set correctly ([#20051](https://github.com/hashicorp/terraform-provider-azurerm/issues/20051)) ## 3.39.1 (January 13, 2023) diff --git a/DEVELOPER.md b/DEVELOPER.md index 2809df0638f8..241d6dda992d 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -26,6 +26,10 @@ refreshenv You must run `Developing the Provider` commands in `bash` because `sh` scrips are invoked as part of these. +You may hit issues with `make build` telling you every file needs to be formatted as a result of line endings. To avoid this issue set your git config using `git config --global core.autocrlf false`. This will tell git to use the source `LF` rather than the Windows default of `CRLF`. + +You may get errors when cloning the repository on Windows that end with `Filename too long`. To avoid this issue set your git config using `git config --system core.longpaths true`. This will tell git to allow file names longer than 260 characters which is the default on Windows. + ## Developing the Provider If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine. You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`. diff --git a/GNUmakefile b/GNUmakefile index 3532cb1423a2..1f8b1955cd5c 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -16,7 +16,7 @@ tools: go install github.com/katbyte/terrafmt@latest go install golang.org/x/tools/cmd/goimports@latest go install mvdan.cc/gofumpt@latest - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH || $$GOPATH)/bin v1.50.1 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH || $$GOPATH)/bin v1.51.1 build: fmtcheck generate go install diff --git a/go.mod b/go.mod index c1087c899f5c..b65d111ea842 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/hashicorp/terraform-provider-azurerm require ( github.com/Azure/azure-sdk-for-go v66.0.0+incompatible - github.com/Azure/go-autorest/autorest v0.11.27 + github.com/Azure/go-autorest/autorest v0.11.28 github.com/Azure/go-autorest/autorest/date v0.3.0 github.com/Azure/go-autorest/autorest/to v0.4.0 github.com/Azure/go-autorest/autorest/validation v0.3.1 @@ -13,56 +13,56 @@ require ( github.com/gofrs/uuid v4.0.0+incompatible github.com/google/go-cmp v0.5.9 github.com/google/uuid v1.1.2 - github.com/hashicorp/go-azure-helpers v0.47.0 - github.com/hashicorp/go-azure-sdk v0.20230105.1121404 + github.com/hashicorp/go-azure-helpers v0.51.0 + github.com/hashicorp/go-azure-sdk v0.20230217.1150808 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/go-version v1.6.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1 + github.com/hashicorp/terraform-plugin-testing v1.0.0 github.com/magodo/terraform-provider-azurerm-example-gen v0.0.0-20220407025246-3a3ee0ab24a8 - github.com/manicminer/hamilton v0.50.0 github.com/mitchellh/mapstructure v1.5.0 github.com/rickb777/date v1.12.5-0.20200422084442-6300e543c4d9 github.com/sergi/go-diff v1.2.0 github.com/tombuildsstuff/giovanni v0.20.0 - github.com/tombuildsstuff/kermit v0.20221207.1110610 - golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 - golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 + github.com/tombuildsstuff/kermit v0.20230208.1135849 + golang.org/x/crypto v0.5.0 + golang.org/x/net v0.5.0 gopkg.in/yaml.v3 v3.0.1 ) require ( github.com/Azure/go-autorest v14.2.0+incompatible // indirect - github.com/Azure/go-autorest/autorest/adal v0.9.18 // indirect - github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect + github.com/Azure/go-autorest/autorest/adal v0.9.22 // indirect + github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 // indirect github.com/Azure/go-autorest/logger v0.2.1 // indirect github.com/agext/levenshtein v1.2.3 // indirect - github.com/apparentlymart/go-cidr v1.1.0 // indirect github.com/apparentlymart/go-textseg v1.0.0 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/dimchansky/utfbom v1.1.1 // indirect github.com/fatih/color v1.13.0 // indirect - github.com/golang-jwt/jwt/v4 v4.4.1 // indirect + github.com/golang-jwt/jwt/v4 v4.4.3 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect - github.com/hashicorp/go-hclog v1.2.1 // indirect - github.com/hashicorp/go-plugin v1.4.6 // indirect - github.com/hashicorp/go-retryablehttp v0.7.0 // indirect + github.com/hashicorp/go-hclog v1.4.0 // indirect + github.com/hashicorp/go-plugin v1.4.8 // indirect + github.com/hashicorp/go-retryablehttp v0.7.2 // indirect github.com/hashicorp/hc-install v0.4.0 // indirect github.com/hashicorp/hcl/v2 v2.15.0 // indirect github.com/hashicorp/hcl2 v0.0.0-20191002203319-fb75b3253c80 // indirect github.com/hashicorp/logutils v1.0.0 // indirect github.com/hashicorp/terraform-exec v0.17.3 // indirect github.com/hashicorp/terraform-json v0.14.0 // indirect - github.com/hashicorp/terraform-plugin-go v0.14.1 // indirect + github.com/hashicorp/terraform-plugin-go v0.14.3 // indirect github.com/hashicorp/terraform-plugin-log v0.7.0 // indirect - github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c // indirect + github.com/hashicorp/terraform-registry-address v0.1.0 // indirect github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect github.com/hashicorp/yamux v0.0.0-20210316155119-a95892c5f864 // indirect - github.com/manicminer/hamilton-autorest v0.2.0 // indirect + github.com/manicminer/hamilton v0.55.0 // indirect + github.com/manicminer/hamilton-autorest v0.3.0 // indirect github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect @@ -76,15 +76,14 @@ require ( github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect github.com/vmihailenco/tagparser v0.1.1 // indirect github.com/zclconf/go-cty v1.12.1 // indirect - golang.org/x/mod v0.5.1 // indirect - golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 // indirect - golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e // indirect - golang.org/x/text v0.3.7 // indirect - golang.org/x/tools v0.1.8 // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect + golang.org/x/oauth2 v0.4.0 // indirect + golang.org/x/sys v0.4.0 // indirect + golang.org/x/text v0.6.0 // indirect + golang.org/x/tools v0.1.12 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 // indirect - google.golang.org/grpc v1.50.1 // indirect + google.golang.org/grpc v1.51.0 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/go.sum b/go.sum index ba948e7cc947..2c10b05f2fb2 100644 --- a/go.sum +++ b/go.sum @@ -40,18 +40,19 @@ github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSW github.com/Azure/go-autorest/autorest v0.11.3/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= github.com/Azure/go-autorest/autorest v0.11.19/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= github.com/Azure/go-autorest/autorest v0.11.24/go.mod h1:G6kyRlFnTuSbEYkQGawPfsCswgme4iYf6rfSKUDzbCc= -github.com/Azure/go-autorest/autorest v0.11.27 h1:F3R3q42aWytozkV8ihzcgMO4OA4cuqr3bNlsEuF6//A= -github.com/Azure/go-autorest/autorest v0.11.27/go.mod h1:7l8ybrIdUmGqZMTD0sRtAr8NvbHjfofbf8RSP2q7w7U= +github.com/Azure/go-autorest/autorest v0.11.28 h1:ndAExarwr5Y+GaHE6VCaY1kyS/HwwGGyuimVhWsHOEM= +github.com/Azure/go-autorest/autorest v0.11.28/go.mod h1:MrkzG3Y3AH668QyF9KRk5neJnGgmhQ6krbhR8Q5eMvA= github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= github.com/Azure/go-autorest/autorest/adal v0.9.14/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= -github.com/Azure/go-autorest/autorest/adal v0.9.18 h1:kLnPsRjzZZUF3K5REu/Kc+qMQrvuza2bwSnNdhmzLfQ= github.com/Azure/go-autorest/autorest/adal v0.9.18/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ= +github.com/Azure/go-autorest/autorest/adal v0.9.22 h1:/GblQdIudfEM3AWWZ0mrYJQSd7JS4S/Mbzh6F0ov0Xc= +github.com/Azure/go-autorest/autorest/adal v0.9.22/go.mod h1:XuAbAEUv2Tta//+voMI038TrJBqjKam0me7qR+L8Cmk= github.com/Azure/go-autorest/autorest/azure/cli v0.4.0/go.mod h1:JljT387FplPzBA31vUcvsetLKF3pec5bdAxjVU4kI2s= github.com/Azure/go-autorest/autorest/azure/cli v0.4.2/go.mod h1:7qkJkT+j6b+hIpzMOwPChJhTqS8VbsqqgULzMNRugoM= -github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 h1:0W/yGmFdTIT77fvdlGZ0LMISoLHFJ7Tx4U0yeB+uFs4= -github.com/Azure/go-autorest/autorest/azure/cli v0.4.5/go.mod h1:ADQAXrkgm7acgWVUNamOgh8YNrv4p27l3Wc55oVfpzg= +github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 h1:w77/uPk80ZET2F+AfQExZyEWtn+0Rk/uw17m9fv5Ajc= +github.com/Azure/go-autorest/autorest/azure/cli v0.4.6/go.mod h1:piCfgPho7BiIDdEQ1+g4VmKyD5y+p/XtSNqE6Hc4QD0= github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw= github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= @@ -82,7 +83,6 @@ github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7l github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/apparentlymart/go-cidr v1.1.0 h1:2mAhrMoF+nhXqxTzSZMUzDHkLjmIHC+Zzn4tdgBZjnU= -github.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I= github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= @@ -142,8 +142,8 @@ github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPh github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= -github.com/golang-jwt/jwt/v4 v4.4.1 h1:pC5DB52sCeK48Wlb9oPcdhnjkz1TKt1D/P7WKJ0kUcQ= -github.com/golang-jwt/jwt/v4 v4.4.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v4 v4.4.3 h1:Hxl6lhQFj4AnOX6MLrsCb/+7tCj7DxP7VA+2rDIq5AU= +github.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -205,10 +205,10 @@ github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= -github.com/hashicorp/go-azure-helpers v0.47.0 h1:E90ZN2hqMtzI+tfGWCnNtyLZYG4csoKSs+hWZZ8ywSM= -github.com/hashicorp/go-azure-helpers v0.47.0/go.mod h1:WiJNl0fD6PoM/MYuGTZ8yuzIaXQR3m2H2g6+EJ8nSwc= -github.com/hashicorp/go-azure-sdk v0.20230105.1121404 h1:Tvzo98JY2y+cQxvjS+9S0MqyKZedQOhR1grM4PYSwzY= -github.com/hashicorp/go-azure-sdk v0.20230105.1121404/go.mod h1:BEjoURzcFwd+K3MqkbOt9jArIIrsqpBQ2Gz6DdemFIs= +github.com/hashicorp/go-azure-helpers v0.51.0 h1:8KSDGkGnWH6zOT60R3KUqsi0fk1vA7AMunaOUJZMM6k= +github.com/hashicorp/go-azure-helpers v0.51.0/go.mod h1:lsykLR4KjTUO7MiRmNWiTiX8QQtw3ILjyOvT0f5h3rw= +github.com/hashicorp/go-azure-sdk v0.20230217.1150808 h1:dX3hZONIGafInISSMFO8gevwPYSrqxJ9ZTfNhO7ROX0= +github.com/hashicorp/go-azure-sdk v0.20230217.1150808/go.mod h1:aHinadEuBi04I1i+yvpPMZUxvxRxl5JgBOwlzIIxozU= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= @@ -218,16 +218,17 @@ github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/S github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI= github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-hclog v1.2.1 h1:YQsLlGDJgwhXFpucSPyVbCBviQtjlHv3jLTlp8YmtEw= -github.com/hashicorp/go-hclog v1.2.1/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.4.0 h1:ctuWFGrhFha8BnnzxqeRGidlEcQkDyL5u8J8t5eA11I= +github.com/hashicorp/go-hclog v1.4.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-multierror v0.0.0-20180717150148-3d5d8f294aa0/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.4.6 h1:MDV3UrKQBM3du3G7MApDGvOsMYy3JQJ4exhSoKBAeVA= -github.com/hashicorp/go-plugin v1.4.6/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= -github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4= +github.com/hashicorp/go-plugin v1.4.8 h1:CHGwpxYDOttQOY7HOWgETU9dyVjOXzniXDqJcYJE1zM= +github.com/hashicorp/go-plugin v1.4.8/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-retryablehttp v0.7.2 h1:AcYqCvkpalPnPF2pn0KamgwamS42TqUDDYFRKq/RAd0= +github.com/hashicorp/go-retryablehttp v0.7.2/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= @@ -251,14 +252,16 @@ github.com/hashicorp/terraform-exec v0.17.3 h1:MX14Kvnka/oWGmIkyuyvL6POx25ZmKrjl github.com/hashicorp/terraform-exec v0.17.3/go.mod h1:+NELG0EqQekJzhvikkeQsOAZpsw0cv/03rbeQJqscAI= github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s= github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM= -github.com/hashicorp/terraform-plugin-go v0.14.1 h1:cwZzPYla82XwAqpLhSzdVsOMU+6H29tczAwrB0z9Zek= -github.com/hashicorp/terraform-plugin-go v0.14.1/go.mod h1:Bc/K6K26BQ2FHqIELPbpKtt2CzzbQou+0UQF3/0NsCQ= +github.com/hashicorp/terraform-plugin-go v0.14.3 h1:nlnJ1GXKdMwsC8g1Nh05tK2wsC3+3BL/DBBxFEki+j0= +github.com/hashicorp/terraform-plugin-go v0.14.3/go.mod h1:7ees7DMZ263q8wQ6E4RdIdR6nHHJtrdt4ogX5lPkX1A= github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs= github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4= github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1 h1:zHcMbxY0+rFO9gY99elV/XC/UnQVg7FhRCbj1i5b7vM= github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1/go.mod h1:+tNlb0wkfdsDJ7JEiERLz4HzM19HyiuIoGzTsM7rPpw= -github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c h1:D8aRO6+mTqHfLsK/BC3j5OAoogv1WLRWzY1AaTo3rBg= -github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c/go.mod h1:Wn3Na71knbXc1G8Lh+yu/dQWWJeFQEpDeJMtWMtlmNI= +github.com/hashicorp/terraform-plugin-testing v1.0.0 h1:3dJV+etJxfiRQ4ENe5fZ38ZQPN5aJ8PwqUAOE2NzDnw= +github.com/hashicorp/terraform-plugin-testing v1.0.0/go.mod h1:sv9NoAabKrcjYzvYYwnJCJU+EfF0QnZbaodl+SgWUM8= +github.com/hashicorp/terraform-registry-address v0.1.0 h1:W6JkV9wbum+m516rCl5/NjKxCyTVaaUBbzYcMzBDO3U= +github.com/hashicorp/terraform-registry-address v0.1.0/go.mod h1:EnyO2jYO6j29DTHbJcm00E5nQTFeTtyZH3H5ycydQ5A= github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0= github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= github.com/hashicorp/yamux v0.0.0-20210316155119-a95892c5f864 h1:Y4V+SFe7d3iH+9pJCoeWIOS5/xBJIFsltS7E+KJSsJY= @@ -290,10 +293,10 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/magodo/terraform-provider-azurerm-example-gen v0.0.0-20220407025246-3a3ee0ab24a8 h1:HHSqLmPZaa8U66U7N2Gtx3gYptSHrUB/rB5t+6fZTkQ= github.com/magodo/terraform-provider-azurerm-example-gen v0.0.0-20220407025246-3a3ee0ab24a8/go.mod h1:iMzpAzVr2v/NUVie/apAYtZlFZYFndPcp6/E0VLxgAM= github.com/manicminer/hamilton v0.43.0/go.mod h1:lbVyngC+/nCWuDp8UhC6Bw+bh7jcP/E+YwqzHTmzemk= -github.com/manicminer/hamilton v0.50.0 h1:EPne7iH6zbXUPPjP/XZvqXzmqkt1WyF5X1A21uosPM4= -github.com/manicminer/hamilton v0.50.0/go.mod h1:lbVyngC+/nCWuDp8UhC6Bw+bh7jcP/E+YwqzHTmzemk= -github.com/manicminer/hamilton-autorest v0.2.0 h1:dDL+t2DrQza0EfNYINYCvXISeNwVqzgVAQh+CH/19ZU= -github.com/manicminer/hamilton-autorest v0.2.0/go.mod h1:NselDpNTImEmOc/fa41kPg6YhDt/6S95ejWbTGZ6tlg= +github.com/manicminer/hamilton v0.55.0 h1:o8kLLmtVnwuS09V1iv0ZIfBNiVjPbLBJYeLORHHM/Bg= +github.com/manicminer/hamilton v0.55.0/go.mod h1:lbVyngC+/nCWuDp8UhC6Bw+bh7jcP/E+YwqzHTmzemk= +github.com/manicminer/hamilton-autorest v0.3.0 h1:dCj5Sy3xipwqhkhJxZRftM0a56SKkWnTZv7uliGjECo= +github.com/manicminer/hamilton-autorest v0.3.0/go.mod h1:NselDpNTImEmOc/fa41kPg6YhDt/6S95ejWbTGZ6tlg= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= @@ -316,7 +319,6 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k+Mg7cowZ8yv4Trqw9UsJby758= github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -350,8 +352,8 @@ github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8 github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/tombuildsstuff/giovanni v0.20.0 h1:IM/I/iNWMXnPYwcSq8uxV7TKDlv7Nejq0bRK9i6O/C0= github.com/tombuildsstuff/giovanni v0.20.0/go.mod h1:66KVLYma2whJhEdxPSPL3GQHkulhK+C5CluKfHGfPF4= -github.com/tombuildsstuff/kermit v0.20221207.1110610 h1:WzvCKNwvnbCGTEu+YtTDgrOZ6r6Lb6G6CEEziFIPUms= -github.com/tombuildsstuff/kermit v0.20221207.1110610/go.mod h1:rLa19LUGz+w1EbdCcj+X4tK/goaTp1hQtdCHK7sbFz4= +github.com/tombuildsstuff/kermit v0.20230208.1135849 h1:GgoBJqearx3fEtmlqkPVcq1tzgHqQAHVN5L/5X2q+Bc= +github.com/tombuildsstuff/kermit v0.20230208.1135849/go.mod h1:rLa19LUGz+w1EbdCcj+X4tK/goaTp1hQtdCHK7sbFz4= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -392,8 +394,9 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 h1:O8uGbHCqlTp2P6QJSLmCojM4mN6UemYv8K+dCnmHmu0= -golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= +golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -426,8 +429,8 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38= -golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -463,16 +466,17 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 h1:3B43BWw0xEBsLZ/NO1VALz6fppU3481pik+2Ksv45z8= -golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.4.0 h1:NF0gk8LVPg1Ml7SSbGyySuoxdsXitj7TvgvuRxIMc/M= +golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -524,10 +528,10 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e h1:w36l2Uw3dRan1K3TyXriXvY+6T56GNmlKGcqiQUJDfM= -golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= +golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -535,8 +539,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -582,12 +586,11 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= -golang.org/x/tools v0.1.8 h1:P1HhGGuLW4aAclzjtmJdf0mJOjVUZUzOTqkAkWL+l6w= -golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -657,8 +660,8 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/internal/acceptance/check/that.go b/internal/acceptance/check/that.go index 60a9d7d38fc1..429fd453e2bd 100644 --- a/internal/acceptance/check/that.go +++ b/internal/acceptance/check/that.go @@ -5,8 +5,8 @@ import ( "fmt" "regexp" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/helpers" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/testclient" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/types" diff --git a/internal/acceptance/helpers/check_destroyed.go b/internal/acceptance/helpers/check_destroyed.go index 8486176ad180..eda30f3276fd 100644 --- a/internal/acceptance/helpers/check_destroyed.go +++ b/internal/acceptance/helpers/check_destroyed.go @@ -3,7 +3,7 @@ package helpers import ( "fmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/types" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" ) diff --git a/internal/acceptance/helpers/delete.go b/internal/acceptance/helpers/delete.go index ceef34db0a54..21e42ad1c71b 100644 --- a/internal/acceptance/helpers/delete.go +++ b/internal/acceptance/helpers/delete.go @@ -3,7 +3,7 @@ package helpers import ( "fmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/types" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" ) diff --git a/internal/acceptance/helpers/exists.go b/internal/acceptance/helpers/exists.go index e504ede13b95..436a03d92b62 100644 --- a/internal/acceptance/helpers/exists.go +++ b/internal/acceptance/helpers/exists.go @@ -3,7 +3,7 @@ package helpers import ( "fmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/types" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" diff --git a/internal/acceptance/plugin_sdk_aliases.go b/internal/acceptance/plugin_sdk_aliases.go index ba7af9a59557..5513dc63989b 100644 --- a/internal/acceptance/plugin_sdk_aliases.go +++ b/internal/acceptance/plugin_sdk_aliases.go @@ -3,8 +3,8 @@ package acceptance import ( "regexp" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/acceptance/random.go b/internal/acceptance/random.go index 06a08d2db69e..e6b3c545e7a3 100644 --- a/internal/acceptance/random.go +++ b/internal/acceptance/random.go @@ -5,7 +5,7 @@ import ( "strings" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-testing/helper/acctest" ) func RandTimeInt() int { diff --git a/internal/acceptance/required_test.go b/internal/acceptance/required_test.go index 09045f659f5b..b081da245b4f 100644 --- a/internal/acceptance/required_test.go +++ b/internal/acceptance/required_test.go @@ -2,6 +2,7 @@ package acceptance import ( "context" + "os" "testing" "github.com/davecgh/go-spew/spew" @@ -22,11 +23,12 @@ func TestAccEnsureRequiredResourceProvidersAreRegistered(t *testing.T) { builder := clients.ClientBuilder{ AuthConfig: config, TerraformVersion: "0.0.0", - PartnerId: "", + PartnerID: "", DisableCorrelationRequestID: true, DisableTerraformPartnerID: false, // this test intentionally checks all the RP's are registered - so this is intentional SkipProviderRegistration: true, + SubscriptionID: os.Getenv("ARM_SUBSCRIPTION_ID"), } armClient, err := clients.Build(context.Background(), builder) if err != nil { diff --git a/internal/acceptance/ssh/run.go b/internal/acceptance/ssh/run.go index b6cc1fa4ee9e..ab920707787b 100644 --- a/internal/acceptance/ssh/run.go +++ b/internal/acceptance/ssh/run.go @@ -7,7 +7,7 @@ import ( "log" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" "golang.org/x/crypto/ssh" ) diff --git a/internal/acceptance/steps.go b/internal/acceptance/steps.go index 64973548766e..12a024887014 100644 --- a/internal/acceptance/steps.go +++ b/internal/acceptance/steps.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/helpers" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/testclient" diff --git a/internal/acceptance/testcase.go b/internal/acceptance/testcase.go index d973915979c5..e6c5c3ddb11e 100644 --- a/internal/acceptance/testcase.go +++ b/internal/acceptance/testcase.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/helpers" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/testclient" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/types" diff --git a/internal/acceptance/testclient/client.go b/internal/acceptance/testclient/client.go index 87fc974ecede..43d40073e472 100644 --- a/internal/acceptance/testclient/client.go +++ b/internal/acceptance/testclient/client.go @@ -6,7 +6,8 @@ import ( "os" "sync" - "github.com/hashicorp/go-azure-helpers/authentication" + "github.com/hashicorp/go-azure-sdk/sdk/auth" + "github.com/hashicorp/go-azure-sdk/sdk/environments" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/features" ) @@ -21,38 +22,59 @@ func Build() (*clients.Client, error) { defer clientLock.Unlock() if _client == nil { - environment, exists := os.LookupEnv("ARM_ENVIRONMENT") + var ( + ctx = context.TODO() + + env *environments.Environment + err error + + metadataHost = os.Getenv("ARM_METADATA_HOSTNAME") + ) + + envName, exists := os.LookupEnv("ARM_ENVIRONMENT") if !exists { - environment = "public" + envName = "public" } - builder := authentication.Builder{ - SubscriptionID: os.Getenv("ARM_SUBSCRIPTION_ID"), - ClientID: os.Getenv("ARM_CLIENT_ID"), - TenantID: os.Getenv("ARM_TENANT_ID"), - ClientSecret: os.Getenv("ARM_CLIENT_SECRET"), - Environment: environment, - MetadataHost: os.Getenv("ARM_METADATA_HOSTNAME"), - - // we intentionally only support Client Secret auth for tests (since those variables are used all over) - SupportsClientSecretAuth: true, + if metadataHost != "" { + if env, err = environments.FromEndpoint(ctx, fmt.Sprintf("https://%s", metadataHost), envName); err != nil { + return nil, fmt.Errorf("building test client: %+v", err) + } + } else if env, err = environments.FromName(envName); err != nil { + return nil, fmt.Errorf("building test client: %+v", err) } - config, err := builder.Build() - if err != nil { - return nil, fmt.Errorf("building ARM Client: %+v", err) + + authConfig := auth.Credentials{ + Environment: *env, + ClientID: os.Getenv("ARM_CLIENT_ID"), + TenantID: os.Getenv("ARM_TENANT_ID"), + + ClientCertificatePath: os.Getenv("ARM_CLIENT_CERTIFICATE_PATH"), + ClientCertificatePassword: os.Getenv("ARM_CLIENT_CERTIFICATE_PASSWORD"), + ClientSecret: os.Getenv("ARM_CLIENT_SECRET"), + + EnableAuthenticatingUsingClientCertificate: true, + EnableAuthenticatingUsingClientSecret: true, + EnableAuthenticatingUsingAzureCLI: false, + EnableAuthenticatingUsingManagedIdentity: false, + EnableAuthenticationUsingOIDC: false, + EnableAuthenticationUsingGitHubOIDC: false, } clientBuilder := clients.ClientBuilder{ - AuthConfig: config, + AuthConfig: &authConfig, SkipProviderRegistration: true, TerraformVersion: os.Getenv("TERRAFORM_CORE_VERSION"), Features: features.Default(), StorageUseAzureAD: false, + SubscriptionID: os.Getenv("ARM_SUBSCRIPTION_ID"), } - client, err := clients.Build(context.TODO(), clientBuilder) + + client, err := clients.Build(ctx, clientBuilder) if err != nil { - return nil, err + return nil, fmt.Errorf("building test client: %+v", err) } + _client = client } diff --git a/internal/acceptance/testing.go b/internal/acceptance/testing.go index 3f25cb7011e8..64134d7f8183 100644 --- a/internal/acceptance/testing.go +++ b/internal/acceptance/testing.go @@ -9,7 +9,9 @@ import ( "github.com/Azure/go-autorest/autorest/azure" "github.com/hashicorp/go-azure-helpers/authentication" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/go-azure-sdk/sdk/auth" + "github.com/hashicorp/go-azure-sdk/sdk/environments" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func PreCheck(t *testing.T) { @@ -46,32 +48,48 @@ func Environment() (*azure.Environment, error) { return authentication.AzureEnvironmentByNameFromEndpoint(context.TODO(), metadataURL, envName) } -func GetAuthConfig(t *testing.T) *authentication.Config { +func GetAuthConfig(t *testing.T) *auth.Credentials { if os.Getenv(resource.EnvTfAcc) == "" { - t.Skipf("Integration test skipped unless env '%s' set", resource.EnvTfAcc) + t.Skipf("Acceptance test skipped unless env '%s' set", resource.EnvTfAcc) return nil } - environment := EnvironmentName() + var ( + ctx = context.TODO() - builder := authentication.Builder{ - SubscriptionID: os.Getenv("ARM_SUBSCRIPTION_ID"), - ClientID: os.Getenv("ARM_CLIENT_ID"), - TenantID: os.Getenv("ARM_TENANT_ID"), - ClientSecret: os.Getenv("ARM_CLIENT_SECRET"), - Environment: environment, - MetadataHost: os.Getenv("ARM_METADATA_HOSTNAME"), + env *environments.Environment + err error - // we intentionally only support Client Secret auth for tests (since those variables are used all over) - SupportsClientSecretAuth: true, - } - config, err := builder.Build() - if err != nil { - t.Fatalf("Error building ARM Client: %+v", err) + envName = EnvironmentName() + metadataHost = os.Getenv("ARM_METADATA_HOSTNAME") + ) + + if metadataHost != "" { + if env, err = environments.FromEndpoint(ctx, fmt.Sprintf("https://%s", metadataHost), envName); err != nil { + t.Fatalf("building test client: %+v", err) + return nil + } + } else if env, err = environments.FromName(envName); err != nil { + t.Fatalf("building test client: %+v", err) return nil } - return config + return &auth.Credentials{ + Environment: *env, + ClientID: os.Getenv("ARM_CLIENT_ID"), + TenantID: os.Getenv("ARM_TENANT_ID"), + + ClientCertificatePath: os.Getenv("ARM_CLIENT_CERTIFICATE_PATH"), + ClientCertificatePassword: os.Getenv("ARM_CLIENT_CERTIFICATE_PASSWORD"), + ClientSecret: os.Getenv("ARM_CLIENT_SECRET"), + + EnableAuthenticatingUsingClientCertificate: true, + EnableAuthenticatingUsingClientSecret: true, + EnableAuthenticatingUsingAzureCLI: false, + EnableAuthenticatingUsingManagedIdentity: false, + EnableAuthenticationUsingOIDC: false, + EnableAuthenticationUsingGitHubOIDC: false, + } } func RequiresImportError(resourceName string) *regexp.Regexp { diff --git a/internal/clients/auth.go b/internal/clients/auth.go index d6315b009d28..d643cfad3303 100644 --- a/internal/clients/auth.go +++ b/internal/clients/auth.go @@ -3,41 +3,140 @@ package clients import ( "context" "fmt" + "log" + "net/http" + "strings" "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/authentication" + "github.com/hashicorp/go-azure-sdk/sdk/auth" + "github.com/hashicorp/go-azure-sdk/sdk/claims" + "github.com/hashicorp/go-azure-sdk/sdk/environments" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients/graph" ) type ResourceManagerAccount struct { + Environment environments.Environment + + ClientId string + ObjectId string + SubscriptionId string + TenantId string + AuthenticatedAsAServicePrincipal bool - ClientId string - Environment azure.Environment - ObjectId string SkipResourceProviderRegistration bool - SubscriptionId string - TenantId string + + // TODO: delete these when no longer needed by older clients + AzureEnvironment azure.Environment } -func NewResourceManagerAccount(ctx context.Context, config authentication.Config, env azure.Environment, skipResourceProviderRegistration bool) (*ResourceManagerAccount, error) { - objectId := "" +func NewResourceManagerAccount(ctx context.Context, config auth.Credentials, subscriptionId string, skipResourceProviderRegistration bool, azureEnvironment azure.Environment) (*ResourceManagerAccount, error) { + authorizer, err := auth.NewAuthorizerFromCredentials(ctx, config, config.Environment.MicrosoftGraph) + if err != nil { + return nil, fmt.Errorf("unable to build authorizer for Microsoft Graph API: %+v", err) + } + + // Acquire an access token so we can inspect the claims + token, err := authorizer.Token(ctx, &http.Request{}) + if err != nil { + return nil, fmt.Errorf("could not acquire access token to parse claims: %+v", err) + } + + claims, err := claims.ParseClaims(token) + if err != nil { + return nil, fmt.Errorf("parsing claims from access token: %+v", err) + } + + authenticatedAsServicePrincipal := true + if strings.Contains(strings.ToLower(claims.Scopes), "openid") { + authenticatedAsServicePrincipal = false + } + + clientId := claims.AppId + if clientId == "" { + log.Printf("[DEBUG] Using user-supplied ClientID because the `appid` claim was missing from the access token") + clientId = config.ClientID + } + + objectId := claims.ObjectId + if objectId == "" { + if authenticatedAsServicePrincipal { + log.Printf("[DEBUG] Querying Microsoft Graph to discover authenticated service principal object ID because the `oid` claim was missing from the access token") + id, err := graph.ServicePrincipalObjectID(ctx, authorizer, config.Environment, config.ClientID) + if err != nil { + return nil, fmt.Errorf("attempting to discover object ID for authenticated service principal with client ID %q: %+v", config.ClientID, err) + } + + objectId = *id + } else { + log.Printf("[DEBUG] Querying Microsoft Graph to discover authenticated user principal object ID because the `oid` claim was missing from the access token") + id, err := graph.UserPrincipalObjectID(ctx, authorizer, config.Environment) + if err != nil { + return nil, fmt.Errorf("attempting to discover object ID for authenticated user principal: %+v", err) + } + + objectId = *id + } + } + + tenantId := claims.TenantId + if tenantId == "" { + log.Printf("[DEBUG] Using user-supplied TenantID because the `tid` claim was missing from the access token") + tenantId = config.TenantID + } + + // Finally, defer to Azure CLI to obtain tenant ID, subscription ID and client ID when not specified and missing from claims + realAuthorizer := authorizer + if cache, ok := authorizer.(*auth.CachedAuthorizer); ok { + realAuthorizer = cache.Source + } + if cli, ok := realAuthorizer.(*auth.AzureCliAuthorizer); ok { + // Use the tenant ID from Azure CLI when otherwise unknown + if tenantId == "" { + if cli.TenantID == "" { + return nil, fmt.Errorf("azure-cli could not determine tenant ID to use") + } + tenantId = cli.TenantID + log.Printf("[DEBUG] Using tenant ID from Azure CLI: %q", tenantId) + } + + // Use the subscription ID from Azure CLI when otherwise unknown + if subscriptionId == "" { + if cli.DefaultSubscriptionID == "" { + return nil, fmt.Errorf("azure-cli could not determine subscription ID to use and no subscription was specified") + } + + subscriptionId = cli.DefaultSubscriptionID + log.Printf("[DEBUG] Using default subscription ID from Azure CLI: %q", subscriptionId) + } - // TODO remove this when we confirm that MSI no longer returns nil with getAuthenticatedObjectID - if getAuthenticatedObjectID := config.GetAuthenticatedObjectID; getAuthenticatedObjectID != nil { - v, err := getAuthenticatedObjectID(ctx) - if err != nil { - return nil, fmt.Errorf("getting authenticated object ID: %v", err) + // Use the Azure CLI client ID + if id, ok := config.Environment.MicrosoftAzureCli.AppId(); ok { + clientId = *id + log.Printf("[DEBUG] Using client ID from Azure CLI: %q", clientId) } - objectId = *v + } + + if tenantId == "" { + return nil, fmt.Errorf("unable to configure ResourceManagerAccount: tenant ID could not be determined and was not specified") + } + if subscriptionId == "" { + return nil, fmt.Errorf("unable to configure ResourceManagerAccount: subscription ID could not be determined and was not specified") } account := ResourceManagerAccount{ - AuthenticatedAsAServicePrincipal: config.AuthenticatedAsAServicePrincipal, - ClientId: config.ClientID, - Environment: env, - ObjectId: objectId, - TenantId: config.TenantID, + Environment: config.Environment, + + ClientId: clientId, + ObjectId: objectId, + SubscriptionId: subscriptionId, + TenantId: tenantId, + + AuthenticatedAsAServicePrincipal: authenticatedAsServicePrincipal, SkipResourceProviderRegistration: skipResourceProviderRegistration, - SubscriptionId: config.SubscriptionID, + + // TODO: delete these when no longer needed by older clients + AzureEnvironment: azureEnvironment, } + return &account, nil } diff --git a/internal/clients/builder.go b/internal/clients/builder.go index 190c1dbc79b4..b8b02e95c498 100644 --- a/internal/clients/builder.go +++ b/internal/clients/builder.go @@ -6,26 +6,30 @@ import ( "log" "strings" - "github.com/Azure/go-autorest/autorest" "github.com/hashicorp/go-azure-helpers/authentication" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/go-azure-helpers/sender" + "github.com/hashicorp/go-azure-sdk/sdk/auth" + authWrapper "github.com/hashicorp/go-azure-sdk/sdk/auth/autorest" + "github.com/hashicorp/go-azure-sdk/sdk/environments" "github.com/hashicorp/terraform-provider-azurerm/internal/common" "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/resourceproviders" - "github.com/manicminer/hamilton/environments" ) type ClientBuilder struct { - AuthConfig *authentication.Config + AuthConfig *auth.Credentials + Features features.UserFeatures + DisableCorrelationRequestID bool - CustomCorrelationRequestID string DisableTerraformPartnerID bool - PartnerId string SkipProviderRegistration bool StorageUseAzureAD bool - TerraformVersion string - Features features.UserFeatures + + CustomCorrelationRequestID string + MetadataHost string + PartnerID string + SubscriptionID string + TerraformVersion string } const azureStackEnvironmentError = ` @@ -38,112 +42,114 @@ and APIs available in Azure Stack via Azure Stack Profiles. ` func Build(ctx context.Context, builder ClientBuilder) (*Client, error) { + var err error + // point folks towards the separate Azure Stack Provider when using Azure Stack - if strings.EqualFold(builder.AuthConfig.Environment, "AZURESTACKCLOUD") { + isAzureStack := false + if strings.EqualFold(builder.AuthConfig.Environment.Name, "AZURESTACKCLOUD") { return nil, fmt.Errorf(azureStackEnvironmentError) - } - - isAzureStack, err := authentication.IsEnvironmentAzureStack(ctx, builder.AuthConfig.MetadataHost, builder.AuthConfig.Environment) - if err != nil { + } else if isAzureStack, err = authentication.IsEnvironmentAzureStack(ctx, builder.MetadataHost, builder.AuthConfig.Environment.Name); err != nil { // TODO: consider updating this helper func return nil, fmt.Errorf("unable to determine if environment is Azure Stack: %+v", err) } + if isAzureStack { return nil, fmt.Errorf(azureStackEnvironmentError) } - // Autorest environment configuration - env, err := authentication.AzureEnvironmentByNameFromEndpoint(ctx, builder.AuthConfig.MetadataHost, builder.AuthConfig.Environment) - if err != nil { - return nil, fmt.Errorf("unable to find environment %q from endpoint %q: %+v", builder.AuthConfig.Environment, builder.AuthConfig.MetadataHost, err) - } + var resourceManagerAuth, storageAuth, synapseAuth, batchManagementAuth, keyVaultAuth auth.Authorizer - // Hamilton environment configuration - environment, err := environments.EnvironmentFromString(builder.AuthConfig.Environment) + resourceManagerAuth, err = auth.NewAuthorizerFromCredentials(ctx, *builder.AuthConfig, builder.AuthConfig.Environment.ResourceManager) if err != nil { - return nil, fmt.Errorf("unable to find environment %q from endpoint %q: %+v", builder.AuthConfig.Environment, builder.AuthConfig.MetadataHost, err) + return nil, fmt.Errorf("unable to build authorizer for Resource Manager API: %+v", err) } - // client declarations: - account, err := NewResourceManagerAccount(ctx, *builder.AuthConfig, *env, builder.SkipProviderRegistration) - if err != nil { - return nil, fmt.Errorf("building account: %+v", err) - } - - client := Client{ - Account: account, - } - - oauthConfig, err := builder.AuthConfig.BuildOAuthConfig(env.ActiveDirectoryEndpoint) - if err != nil { - return nil, fmt.Errorf("building OAuth Config: %+v", err) - } - - // OAuthConfigForTenant returns a pointer, which can be nil. - if oauthConfig == nil { - return nil, fmt.Errorf("unable to configure OAuthConfig for tenant %s", builder.AuthConfig.TenantID) - } - - sender := sender.BuildSender("AzureRM") - - var auth, storageAuth, synapseAuth, batchManagementAuth autorest.Authorizer - var keyVaultAuth *autorest.BearerAuthorizerCallback - var tokenFunc common.EndpointTokenFunc - - auth, err = builder.AuthConfig.GetMSALToken(ctx, environment.ResourceManager, sender, oauthConfig, string(environment.ResourceManager.Endpoint)) + storageAuth, err = auth.NewAuthorizerFromCredentials(ctx, *builder.AuthConfig, builder.AuthConfig.Environment.Storage) if err != nil { - return nil, fmt.Errorf("unable to get MSAL authorization token for resource manager API: %+v", err) + return nil, fmt.Errorf("unable to build authorizer for Storage API: %+v", err) } - storageAuth, err = builder.AuthConfig.GetMSALToken(ctx, environment.Storage, sender, oauthConfig, string(environment.Storage.Endpoint)) + keyVaultAuth, err = auth.NewAuthorizerFromCredentials(ctx, *builder.AuthConfig, builder.AuthConfig.Environment.KeyVault) if err != nil { - return nil, fmt.Errorf("unable to get MSAL authorization token for storage API: %+v", err) + return nil, fmt.Errorf("unable to build authorizer for Key Vault API: %+v", err) } - if environment.Synapse.IsAvailable() { - synapseAuth, err = builder.AuthConfig.GetMSALToken(ctx, environment.Synapse, sender, oauthConfig, string(environment.Synapse.Endpoint)) + if _, ok := builder.AuthConfig.Environment.Synapse.ResourceIdentifier(); ok { + synapseAuth, err = auth.NewAuthorizerFromCredentials(ctx, *builder.AuthConfig, builder.AuthConfig.Environment.Synapse) if err != nil { - return nil, fmt.Errorf("unable to get MSAL authorization token for synapse API: %+v", err) + return nil, fmt.Errorf("unable to build authorizer for Synapse API: %+v", err) } } else { - log.Printf("[DEBUG] Skipping building the Synapse MSAL Authorizer since this is not supported in the current Azure Environment") + log.Printf("[DEBUG] Skipping building the Synapse Authorizer since this is not supported in the current Azure Environment") } - batchManagementAuth, err = builder.AuthConfig.GetMSALToken(ctx, environment.BatchManagement, sender, oauthConfig, string(environment.BatchManagement.Endpoint)) - if err != nil { - return nil, fmt.Errorf("unable to get MSAL authorization token for batch management API: %+v", err) + if _, ok := builder.AuthConfig.Environment.Batch.ResourceIdentifier(); ok { + batchManagementAuth, err = auth.NewAuthorizerFromCredentials(ctx, *builder.AuthConfig, builder.AuthConfig.Environment.Batch) + if err != nil { + return nil, fmt.Errorf("unable to build authorizer for Batch Management API: %+v", err) + } + } else { + log.Printf("[DEBUG] Skipping building the Batch Management Authorizer since this is not supported in the current Azure Environment") } - keyVaultAuth = builder.AuthConfig.MSALBearerAuthorizerCallback(ctx, environment.KeyVault, sender, oauthConfig, string(environment.KeyVault.Endpoint)) - // Helper for obtaining endpoint-specific tokens - tokenFunc = func(endpoint string) (autorest.Authorizer, error) { - api := environments.Api{Endpoint: environments.ApiEndpoint(endpoint)} - authorizer, err := builder.AuthConfig.GetMSALToken(ctx, api, sender, oauthConfig, endpoint) + authorizerFunc := common.ApiAuthorizerFunc(func(api environments.Api) (auth.Authorizer, error) { + authorizer, err := auth.NewAuthorizerFromCredentials(ctx, *builder.AuthConfig, api) if err != nil { - return nil, fmt.Errorf("getting MSAL authorization token for endpoint %s: %+v", endpoint, err) + return nil, fmt.Errorf("building custom authorizer for API %q: %+v", api.Name(), err) } + return authorizer, nil + }) + + // TODO: remove these when autorest clients are no longer used + azureEnvironment, err := authentication.AzureEnvironmentByNameFromEndpoint(ctx, builder.MetadataHost, builder.AuthConfig.Environment.Name) + if err != nil { + return nil, fmt.Errorf("unable to find environment %q from endpoint %q: %+v", builder.AuthConfig.Environment.Name, builder.MetadataHost, err) + } + resourceManagerEndpoint, _ := builder.AuthConfig.Environment.ResourceManager.Endpoint() + + account, err := NewResourceManagerAccount(ctx, *builder.AuthConfig, builder.SubscriptionID, builder.SkipProviderRegistration, *azureEnvironment) + if err != nil { + return nil, fmt.Errorf("building account: %+v", err) + } + + client := Client{ + Account: account, } o := &common.ClientOptions{ - SubscriptionId: builder.AuthConfig.SubscriptionID, - TenantID: builder.AuthConfig.TenantID, - PartnerId: builder.PartnerId, - TerraformVersion: builder.TerraformVersion, - KeyVaultAuthorizer: keyVaultAuth, - ResourceManagerAuthorizer: auth, - ResourceManagerEndpoint: env.ResourceManagerEndpoint, - StorageAuthorizer: storageAuth, - SynapseAuthorizer: synapseAuth, - BatchManagementAuthorizer: batchManagementAuth, - SkipProviderReg: builder.SkipProviderRegistration, - DisableCorrelationRequestID: builder.DisableCorrelationRequestID, + Authorizers: &common.Authorizers{ + BatchManagement: batchManagementAuth, + KeyVault: keyVaultAuth, + ResourceManager: resourceManagerAuth, + Storage: storageAuth, + Synapse: synapseAuth, + AuthorizerFunc: authorizerFunc, + }, + + Environment: builder.AuthConfig.Environment, + Features: builder.Features, + + SubscriptionId: account.SubscriptionId, + TenantId: account.TenantId, + PartnerId: builder.PartnerID, + TerraformVersion: builder.TerraformVersion, + + BatchManagementAuthorizer: authWrapper.AutorestAuthorizer(batchManagementAuth), + KeyVaultAuthorizer: authWrapper.AutorestAuthorizer(keyVaultAuth).BearerAuthorizerCallback(), + ResourceManagerAuthorizer: authWrapper.AutorestAuthorizer(resourceManagerAuth), + StorageAuthorizer: authWrapper.AutorestAuthorizer(storageAuth), + SynapseAuthorizer: authWrapper.AutorestAuthorizer(synapseAuth), + CustomCorrelationRequestID: builder.CustomCorrelationRequestID, + DisableCorrelationRequestID: builder.DisableCorrelationRequestID, DisableTerraformPartnerID: builder.DisableTerraformPartnerID, - Environment: *env, - Features: builder.Features, + SkipProviderReg: builder.SkipProviderRegistration, StorageUseAzureAD: builder.StorageUseAzureAD, - TokenFunc: tokenFunc, + + // TODO: remove when `Azure/go-autorest` is no longer used + AzureEnvironment: *azureEnvironment, + ResourceManagerEndpoint: *resourceManagerEndpoint, } if err := client.Build(ctx, o); err != nil { @@ -151,7 +157,7 @@ func Build(ctx context.Context, builder ClientBuilder) (*Client, error) { } if features.EnhancedValidationEnabled() { - location.CacheSupportedLocations(ctx, env.ResourceManagerEndpoint) + location.CacheSupportedLocations(ctx, *resourceManagerEndpoint) resourceproviders.CacheSupportedProviders(ctx, client.Resource.ProvidersClient) } diff --git a/internal/clients/client.go b/internal/clients/client.go index 645c0dfd431c..556206651477 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -7,9 +7,12 @@ import ( "github.com/Azure/go-autorest/autorest/validation" aadb2c_v2021_04_01_preview "github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview" analysisservices_v2017_08_01 "github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01" + azurestackhci_v2022_12_01 "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01" + datadog_v2021_03_01 "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01" dns_v2018_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01" fluidrelay_2022_05_26 "github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26" nginx2 "github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01" + redis_v2021_06_01 "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01" "github.com/hashicorp/terraform-provider-azurerm/internal/common" "github.com/hashicorp/terraform-provider-azurerm/internal/features" aadb2c "github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/client" @@ -33,6 +36,7 @@ import ( confidentialledger "github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/client" connections "github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/client" consumption "github.com/hashicorp/terraform-provider-azurerm/internal/services/consumption/client" + containerapps "github.com/hashicorp/terraform-provider-azurerm/internal/services/containerapps/client" containerServices "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/client" cosmosdb "github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/client" costmanagement "github.com/hashicorp/terraform-provider-azurerm/internal/services/costmanagement/client" @@ -61,6 +65,7 @@ import ( healthcare "github.com/hashicorp/terraform-provider-azurerm/internal/services/healthcare/client" hpccache "github.com/hashicorp/terraform-provider-azurerm/internal/services/hpccache/client" hsm "github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/client" + hybridcompute "github.com/hashicorp/terraform-provider-azurerm/internal/services/hybridcompute/client" iotcentral "github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/client" iothub "github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/client" timeseriesinsights "github.com/hashicorp/terraform-provider-azurerm/internal/services/iottimeseriesinsights/client" @@ -81,6 +86,7 @@ import ( mariadb "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/client" media "github.com/hashicorp/terraform-provider-azurerm/internal/services/media/client" mixedreality "github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/client" + mobilenetwork "github.com/hashicorp/terraform-provider-azurerm/internal/services/mobilenetwork/client" monitor "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/client" mssql "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/client" mysql "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/client" @@ -141,7 +147,7 @@ type Client struct { Attestation *attestation.Client Authorization *authorization.Client Automation *automation.Client - AzureStackHCI *azureStackHCI.Client + AzureStackHCI *azurestackhci_v2022_12_01.Client Batch *batch.Client Blueprints *blueprints.Client Bot *bot.Client @@ -152,6 +158,7 @@ type Client struct { ConfidentialLedger *confidentialledger.Client Connections *connections.Client Consumption *consumption.Client + ContainerApps *containerapps.Client Containers *containerServices.Client Cosmos *cosmosdb.Client CostManagement *costmanagement.Client @@ -160,7 +167,7 @@ type Client struct { DatabaseMigration *datamigration.Client DataBricks *databricks.Client DataboxEdge *databoxedge.Client - Datadog *datadog.Client + Datadog *datadog_v2021_03_01.Client DataFactory *datafactory.Client DataProtection *dataprotection.Client DataShare *datashare.Client @@ -179,6 +186,7 @@ type Client struct { HPCCache *hpccache.Client HSM *hsm.Client HDInsight *hdinsight.Client + HybridCompute *hybridcompute.Client HealthCare *healthcare.Client IoTCentral *iotcentral.Client IoTHub *iothub.Client @@ -201,6 +209,7 @@ type Client struct { Media *media.Client MixedReality *mixedreality.Client Monitor *monitor.Client + MobileNetwork *mobilenetwork.Client MSSQL *mssql.Client MySQL *mysql.Client NetApp *netapp.Client @@ -216,7 +225,7 @@ type Client struct { PrivateDnsResolver *dnsresolver.Client Purview *purview.Client RecoveryServices *recoveryServices.Client - Redis *redis.Client + Redis *redis_v2021_06_01.Client RedisEnterprise *redisenterprise.Client Relay *relay.Client Resource *resource.Client @@ -274,6 +283,7 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error client.Connections = connections.NewClient(o) client.Consumption = consumption.NewClient(o) client.Containers = containerServices.NewContainersClient(o) + client.ContainerApps = containerapps.NewClient(o) client.Cosmos = cosmosdb.NewClient(o) client.CostManagement = costmanagement.NewClient(o) client.CustomProviders = customproviders.NewClient(o) @@ -301,6 +311,7 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error client.HSM = hsm.NewClient(o) client.HDInsight = hdinsight.NewClient(o) client.HealthCare = healthcare.NewClient(o) + client.HybridCompute = hybridcompute.NewClient(o) client.IoTCentral = iotcentral.NewClient(o) client.IoTHub = iothub.NewClient(o) client.IoTTimeSeriesInsights = timeseriesinsights.NewClient(o) @@ -322,6 +333,7 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error client.Media = media.NewClient(o) client.MixedReality = mixedreality.NewClient(o) client.Monitor = monitor.NewClient(o) + client.MobileNetwork = mobilenetwork.NewClient(o) client.MSSQL = mssql.NewClient(o) client.MySQL = mysql.NewClient(o) client.NetApp = netapp.NewClient(o) diff --git a/internal/clients/graph/client.go b/internal/clients/graph/client.go new file mode 100644 index 000000000000..1125ad40aa3a --- /dev/null +++ b/internal/clients/graph/client.go @@ -0,0 +1,148 @@ +package graph + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/hashicorp/go-azure-sdk/sdk/auth" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/msgraph" + "github.com/hashicorp/go-azure-sdk/sdk/environments" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +type options struct { + query odata.Query +} + +func (o options) ToHeaders() *client.Headers { + h := client.Headers{} + h.AppendHeader(o.query.Headers()) + return &h +} + +func (o options) ToOData() *odata.Query { + return &o.query +} + +func (o options) ToQuery() *client.QueryParams { + q := client.QueryParams{} + q.AppendValues(o.query.Values()) + return &q +} + +type directoryObjectModel struct { + ID *string `json:"id"` +} + +func graphClient(authorizer auth.Authorizer, environment environments.Environment) (*msgraph.Client, error) { + client, err := msgraph.NewMsGraphClient(environment.MicrosoftGraph, msgraph.VersionOnePointZero) + if err != nil { + return nil, fmt.Errorf("building client: %+v", err) + } + + client.Authorizer = authorizer + + return client, nil +} + +func ServicePrincipalObjectID(ctx context.Context, authorizer auth.Authorizer, environment environments.Environment, clientId string) (*string, error) { + if _, ok := ctx.Deadline(); !ok { + var cancel context.CancelFunc + ctx, cancel = context.WithDeadline(ctx, time.Now().Add(5*time.Minute)) + defer cancel() + } + + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options{ + query: odata.Query{ + Filter: fmt.Sprintf("appId eq '%s'", clientId), + }, + }, + Path: "/servicePrincipals", + } + + client, err := graphClient(authorizer, environment) + if err != nil { + return nil, err + } + + req, err := client.NewRequest(ctx, opts) + if err != nil { + return nil, fmt.Errorf("building new request: %+v", err) + } + + resp, err := req.Execute(ctx) + if err != nil { + return nil, fmt.Errorf("executing request: %+v", err) + } + + model := struct { + ServicePrincipals []directoryObjectModel `json:"value"` + }{} + if err := resp.Unmarshal(&model); err != nil { + return nil, fmt.Errorf("unmarshaling response: %+v", err) + } + + if len(model.ServicePrincipals) != 1 { + return nil, fmt.Errorf("unexpected number of results, expected 1, received %d", len(model.ServicePrincipals)) + } + + id := model.ServicePrincipals[0].ID + if id == nil { + return nil, fmt.Errorf("returned object ID was nil") + } + + return id, nil +} + +func UserPrincipalObjectID(ctx context.Context, authorizer auth.Authorizer, environment environments.Environment) (*string, error) { + if _, ok := ctx.Deadline(); !ok { + var cancel context.CancelFunc + ctx, cancel = context.WithDeadline(ctx, time.Now().Add(5*time.Minute)) + defer cancel() + } + + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: nil, + Path: "/me", + } + + client, err := graphClient(authorizer, environment) + if err != nil { + return nil, err + } + + req, err := client.NewRequest(ctx, opts) + if err != nil { + return nil, fmt.Errorf("building new request: %+v", err) + } + + resp, err := req.Execute(ctx) + if err != nil { + return nil, fmt.Errorf("executing request: %+v", err) + } + + model := directoryObjectModel{} + if err := resp.Unmarshal(&model); err != nil { + return nil, fmt.Errorf("unmarshaling response: %+v", err) + } + + if model.ID == nil { + return nil, fmt.Errorf("returned object ID was nil") + } + + return model.ID, nil +} diff --git a/internal/common/client_options.go b/internal/common/client_options.go index 7fb708fdc141..4ee171402ccd 100644 --- a/internal/common/client_options.go +++ b/internal/common/client_options.go @@ -8,44 +8,65 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/hashicorp/go-azure-helpers/sender" + "github.com/hashicorp/go-azure-sdk/sdk/auth" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/environments" "github.com/hashicorp/terraform-plugin-sdk/v2/meta" "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/version" ) -type EndpointTokenFunc func(endpoint string) (autorest.Authorizer, error) +type Authorizers struct { + BatchManagement auth.Authorizer + KeyVault auth.Authorizer + ResourceManager auth.Authorizer + Storage auth.Authorizer + Synapse auth.Authorizer + + // Some data-plane APIs require a token scoped for a specific endpoint + AuthorizerFunc ApiAuthorizerFunc +} + +type ApiAuthorizerFunc func(api environments.Api) (auth.Authorizer, error) type ClientOptions struct { + Authorizers *Authorizers + Environment environments.Environment + Features features.UserFeatures + SubscriptionId string - TenantID string + TenantId string PartnerId string TerraformVersion string + CustomCorrelationRequestID string + DisableCorrelationRequestID bool + + DisableTerraformPartnerID bool + SkipProviderReg bool + StorageUseAzureAD bool + + // Keep these around for convenience with Autorest based clients, remove when we are no longer using autorest + AzureEnvironment azure.Environment + ResourceManagerEndpoint string + + // Legacy authorizers for go-autorest + BatchManagementAuthorizer autorest.Authorizer KeyVaultAuthorizer autorest.Authorizer ResourceManagerAuthorizer autorest.Authorizer - ResourceManagerEndpoint string StorageAuthorizer autorest.Authorizer SynapseAuthorizer autorest.Authorizer - BatchManagementAuthorizer autorest.Authorizer - - SkipProviderReg bool - CustomCorrelationRequestID string - DisableCorrelationRequestID bool - DisableTerraformPartnerID bool - Environment azure.Environment - Features features.UserFeatures - StorageUseAzureAD bool - - // Some Dataplane APIs require a token scoped for a specific endpoint - TokenFunc EndpointTokenFunc +} - // TODO: remove graph configuration in v3.0 - GraphAuthorizer autorest.Authorizer - GraphEndpoint string +// Configure set up a resourcemanager.Client using an auth.Authorizer from hashicorp/go-azure-sdk +func (o ClientOptions) Configure(c *resourcemanager.Client, authorizer auth.Authorizer) { + c.Authorizer = authorizer + c.UserAgent = userAgent(c.UserAgent, o.TerraformVersion, o.PartnerId, o.DisableTerraformPartnerID) } +// ConfigureClient sets up an autorest.Client using an autorest.Authorizer func (o ClientOptions) ConfigureClient(c *autorest.Client, authorizer autorest.Authorizer) { - setUserAgent(c, o.TerraformVersion, o.PartnerId, o.DisableTerraformPartnerID) + c.UserAgent = userAgent(c.UserAgent, o.TerraformVersion, o.PartnerId, o.DisableTerraformPartnerID) c.Authorizer = authorizer c.Sender = sender.BuildSender("AzureRM") @@ -59,18 +80,18 @@ func (o ClientOptions) ConfigureClient(c *autorest.Client, authorizer autorest.A } } -func setUserAgent(client *autorest.Client, tfVersion, partnerID string, disableTerraformPartnerID bool) { +func userAgent(userAgent, tfVersion, partnerID string, disableTerraformPartnerID bool) string { tfUserAgent := fmt.Sprintf("HashiCorp Terraform/%s (+https://www.terraform.io) Terraform Plugin SDK/%s", tfVersion, meta.SDKVersionString()) providerUserAgent := fmt.Sprintf("%s terraform-provider-azurerm/%s", tfUserAgent, version.ProviderVersion) if features.FourPointOhBeta() { providerUserAgent = fmt.Sprintf("%s terraform-provider-azurerm/%s+4.0-beta", tfUserAgent, version.ProviderVersion) } - client.UserAgent = strings.TrimSpace(fmt.Sprintf("%s %s", client.UserAgent, providerUserAgent)) + userAgent = strings.TrimSpace(fmt.Sprintf("%s %s", userAgent, providerUserAgent)) // append the CloudShell version to the user agent if it exists if azureAgent := os.Getenv("AZURE_HTTP_USER_AGENT"); azureAgent != "" { - client.UserAgent = fmt.Sprintf("%s %s", client.UserAgent, azureAgent) + userAgent = fmt.Sprintf("%s %s", userAgent, azureAgent) } // only one pid can be interpreted currently @@ -83,6 +104,8 @@ func setUserAgent(client *autorest.Client, tfVersion, partnerID string, disableT if partnerID != "" { // Tolerate partnerID UUIDs without the "pid-" prefix - client.UserAgent = fmt.Sprintf("%s pid-%s", client.UserAgent, strings.TrimPrefix(partnerID, "pid-")) + userAgent = fmt.Sprintf("%s pid-%s", userAgent, strings.TrimPrefix(partnerID, "pid-")) } + + return userAgent } diff --git a/internal/common/correlation_id.go b/internal/common/correlation_id.go index 8db29bf90948..85ab15e2d008 100644 --- a/internal/common/correlation_id.go +++ b/internal/common/correlation_id.go @@ -32,7 +32,7 @@ func correlationRequestID() string { if err != nil { log.Printf("[WARN] Failed to generate uuid for msCorrelationRequestID: %+v", err) } - log.Printf("[DEBUG] Genereated Provider Correlation Request Id: %s", msCorrelationRequestID) + log.Printf("[DEBUG] Generated Provider Correlation Request Id: %s", msCorrelationRequestID) }) return msCorrelationRequestID diff --git a/internal/provider/provider.go b/internal/provider/provider.go index cf135673f96f..555003bf4b5a 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -2,12 +2,14 @@ package provider import ( "context" + "encoding/base64" "fmt" "log" "os" "strings" - "github.com/hashicorp/go-azure-helpers/authentication" + "github.com/hashicorp/go-azure-sdk/sdk/auth" + "github.com/hashicorp/go-azure-sdk/sdk/environments" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" @@ -205,6 +207,13 @@ func azureProvider(supportLegacyTestSuite bool) *schema.Provider { }, // Client Certificate specific fields + "client_certificate": { + Type: schema.TypeString, + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("ARM_CLIENT_CERTIFICATE", ""), + Description: "Base64 encoded PKCS#12 certificate bundle to use when authenticating as a Service Principal using a Client Certificate", + }, + "client_certificate_path": { Type: schema.TypeString, Optional: true, @@ -267,7 +276,7 @@ func azureProvider(supportLegacyTestSuite bool) *schema.Provider { Type: schema.TypeBool, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_USE_MSI", false), - Description: "Allowed Managed Service Identity be used for Authentication.", + Description: "Allow Managed Service Identity to be used for Authentication.", }, "msi_endpoint": { Type: schema.TypeString, @@ -276,6 +285,15 @@ func azureProvider(supportLegacyTestSuite bool) *schema.Provider { Description: "The path to a custom endpoint for Managed Service Identity - in most circumstances this should be detected automatically. ", }, + // Azure CLI specific fields + "use_cli": { + Type: schema.TypeBool, + Optional: true, + Default: true, + DefaultFunc: schema.EnvDefaultFunc("ARM_USE_CLI", true), + Description: "Allow Azure CLI to be used for Authentication.", + }, + // Managed Tracking GUID for User-agent "partner_id": { Type: schema.TypeString, @@ -336,64 +354,78 @@ func providerConfigure(p *schema.Provider) schema.ConfigureContextFunc { } if len(auxTenants) > 3 { - return nil, diag.Errorf("The provider only supports 3 auxiliary tenant IDs") + return nil, diag.Errorf("the provider only supports 3 auxiliary tenant IDs") } - metadataHost := d.Get("metadata_host").(string) - - builder := &authentication.Builder{ - SubscriptionID: d.Get("subscription_id").(string), - ClientID: d.Get("client_id").(string), - ClientSecret: d.Get("client_secret").(string), - TenantID: d.Get("tenant_id").(string), - AuxiliaryTenantIDs: auxTenants, - Environment: d.Get("environment").(string), - MetadataHost: metadataHost, - MsiEndpoint: d.Get("msi_endpoint").(string), - ClientCertPassword: d.Get("client_certificate_password").(string), - ClientCertPath: d.Get("client_certificate_path").(string), - IDTokenRequestToken: d.Get("oidc_request_token").(string), - IDTokenRequestURL: d.Get("oidc_request_url").(string), - IDToken: d.Get("oidc_token").(string), - IDTokenFilePath: d.Get("oidc_token_file_path").(string), - - // Feature Toggles - SupportsClientCertAuth: true, - SupportsClientSecretAuth: true, - SupportsOIDCAuth: d.Get("use_oidc").(bool), - SupportsManagedServiceIdentity: d.Get("use_msi").(bool), - SupportsAzureCliToken: true, - SupportsAuxiliaryTenants: len(auxTenants) > 0, - - // Doc Links - ClientSecretDocsLink: "https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_client_secret", - - // Use MSAL - UseMicrosoftGraph: true, + var clientCertificateData []byte + if encodedCert := d.Get("client_certificate").(string); encodedCert != "" { + var err error + clientCertificateData, err = decodeCertificate(encodedCert) + if err != nil { + return nil, diag.FromErr(err) + } } - config, err := builder.Build() - if err != nil { - return nil, diag.Errorf("building AzureRM Client: %s", err) + var ( + env *environments.Environment + err error + + envName = d.Get("environment").(string) + metadataHost = d.Get("metadata_host").(string) + ) + + if metadataHost != "" { + if env, err = environments.FromEndpoint(ctx, fmt.Sprintf("https://%s", metadataHost), envName); err != nil { + return nil, diag.FromErr(err) + } + } else if env, err = environments.FromName(envName); err != nil { + return nil, diag.FromErr(err) } - terraformVersion := p.TerraformVersion - if terraformVersion == "" { - // Terraform 0.12 introduced this field to the protocol - // We can therefore assume that if it's missing it's 0.10 or 0.11 - terraformVersion = "0.11+compatible" + var ( + enableAzureCli = d.Get("use_cli").(bool) + enableManagedIdentity = d.Get("use_msi").(bool) + enableOidc = d.Get("use_oidc").(bool) + ) + + authConfig := auth.Credentials{ + Environment: *env, + ClientID: d.Get("client_id").(string), + TenantID: d.Get("tenant_id").(string), + AuxiliaryTenantIDs: auxTenants, + + ClientCertificateData: clientCertificateData, + ClientCertificatePath: d.Get("client_certificate_path").(string), + ClientCertificatePassword: d.Get("client_certificate_password").(string), + ClientSecret: d.Get("client_secret").(string), + + OIDCAssertionToken: d.Get("oidc_token").(string), + GitHubOIDCTokenRequestURL: d.Get("oidc_request_url").(string), + GitHubOIDCTokenRequestToken: d.Get("oidc_request_token").(string), + + CustomManagedIdentityEndpoint: d.Get("msi_endpoint").(string), + + EnableAuthenticatingUsingClientCertificate: true, + EnableAuthenticatingUsingClientSecret: true, + EnableAuthenticatingUsingAzureCLI: enableAzureCli, + EnableAuthenticatingUsingManagedIdentity: enableManagedIdentity, + EnableAuthenticationUsingOIDC: enableOidc, + EnableAuthenticationUsingGitHubOIDC: enableOidc, } skipProviderRegistration := d.Get("skip_provider_registration").(bool) + clientBuilder := clients.ClientBuilder{ - AuthConfig: config, - SkipProviderRegistration: skipProviderRegistration, - TerraformVersion: terraformVersion, - PartnerId: d.Get("partner_id").(string), + AuthConfig: &authConfig, DisableCorrelationRequestID: d.Get("disable_correlation_request_id").(bool), DisableTerraformPartnerID: d.Get("disable_terraform_partner_id").(bool), Features: expandFeatures(d.Get("features").([]interface{})), + MetadataHost: metadataHost, + PartnerID: d.Get("partner_id").(string), + SkipProviderRegistration: skipProviderRegistration, StorageUseAzureAD: d.Get("storage_use_azuread").(bool), + SubscriptionID: d.Get("subscription_id").(string), + TerraformVersion: p.TerraformVersion, // this field is intentionally not exposed in the provider block, since it's only used for // platform level tracing @@ -435,6 +467,19 @@ func providerConfigure(p *schema.Provider) schema.ConfigureContextFunc { } } +func decodeCertificate(clientCertificate string) ([]byte, error) { + var pfx []byte + if clientCertificate != "" { + out := make([]byte, base64.StdEncoding.DecodedLen(len(clientCertificate))) + n, err := base64.StdEncoding.Decode(out, []byte(clientCertificate)) + if err != nil { + return pfx, fmt.Errorf("could not decode client certificate data: %v", err) + } + pfx = out[:n] + } + return pfx, nil +} + const resourceProviderRegistrationErrorFmt = `Error ensuring Resource Providers are registered. Terraform automatically attempts to register the Resource Providers it supports to diff --git a/internal/provider/provider_schema_test.go b/internal/provider/provider_schema_test.go new file mode 100644 index 000000000000..7d061047055a --- /dev/null +++ b/internal/provider/provider_schema_test.go @@ -0,0 +1,529 @@ +package provider + +import ( + "fmt" + "sort" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +func TestDataSourcesHaveSensitiveFieldsMarkedAsSensitive(t *testing.T) { + provider := TestAzureProvider() + + // intentionally sorting these so the output is consistent + dataSourceNames := make([]string, 0) + for dataSourceName := range provider.DataSourcesMap { + dataSourceNames = append(dataSourceNames, dataSourceName) + } + sort.Strings(dataSourceNames) + + for _, dataSourceName := range dataSourceNames { + dataSource := provider.DataSourcesMap[dataSourceName] + if err := schemaContainsSensitiveFieldsNotMarkedAsSensitive(dataSource.Schema); err != nil { + t.Fatalf("the Data Source %q contains a sensitive field which isn't marked as sensitive: %+v", dataSourceName, err) + } + } +} + +func TestResourcesHaveSensitiveFieldsMarkedAsSensitive(t *testing.T) { + provider := TestAzureProvider() + + // intentionally sorting these so the output is consistent + resourceNames := make([]string, 0) + for resourceName := range provider.ResourcesMap { + resourceNames = append(resourceNames, resourceName) + } + sort.Strings(resourceNames) + + for _, resourceName := range resourceNames { + resource := provider.ResourcesMap[resourceName] + if err := schemaContainsSensitiveFieldsNotMarkedAsSensitive(resource.Schema); err != nil { + t.Fatalf("the Resource %q contains a sensitive field which isn't marked as sensitive: %+v", resourceName, err) + } + } +} + +func schemaContainsSensitiveFieldsNotMarkedAsSensitive(input map[string]*pluginsdk.Schema) error { + exactMatchFieldNames := []string{ + "api_key", + "api_secret_key", + "password", + "private_key", + "ssh_private_key", + } + + // intentionally sorting these so the output is consistent + fieldNames := make([]string, 0) + for fieldName := range input { + fieldNames = append(fieldNames, fieldName) + } + sort.Strings(fieldNames) + + for _, fieldName := range fieldNames { + key := strings.ToLower(fieldName) + field := input[fieldName] + + for _, val := range exactMatchFieldNames { + if strings.EqualFold(key, val) && !field.Sensitive { + return fmt.Errorf("field %q is a sensitive value and should be marked as Sensitive", fieldName) + } + } + + if strings.HasSuffix(key, "_api_key") && field.Type == pluginsdk.TypeString && !field.Sensitive { + return fmt.Errorf("field %q is a sensitive value and should be marked as Sensitive", fieldName) + } + + if field.Type == pluginsdk.TypeList && field.Elem != nil { + if val, ok := field.Elem.(*pluginsdk.Resource); ok && val.Schema != nil { + if err := schemaContainsSensitiveFieldsNotMarkedAsSensitive(val.Schema); err != nil { + return fmt.Errorf("the field %q is a List: %+v", fieldName, err) + } + } + } + + if field.Type == pluginsdk.TypeSet && field.Elem != nil { + if val, ok := field.Elem.(*pluginsdk.Resource); ok && val.Schema != nil { + if err := schemaContainsSensitiveFieldsNotMarkedAsSensitive(val.Schema); err != nil { + return fmt.Errorf("the field %q is a Set: %+v", fieldName, err) + } + } + } + } + + return nil +} + +func TestDataSourcesHaveEnabledFieldsMarkedAsBooleans(t *testing.T) { + // This test validates that Data Sources do not contain a field suffixed with `_enabled` that isn't a Boolean. + // + // If this test is failing due to a new Data Source/new field within an existing Data Source, it'd be worth validating + // the schema, since fields matching `{some_name}_enabled` should be Booleans. Should a Tri-State Boolean exist, + // this field likely wants the `_enabled` suffix removing, to make the example `{some_name}` instead (with + // validation for the possible values). + provider := TestAzureProvider() + + // intentionally sorting these so the output is consistent + dataSourceNames := make([]string, 0) + for dataSourceName := range provider.DataSourcesMap { + dataSourceNames = append(dataSourceNames, dataSourceName) + } + sort.Strings(dataSourceNames) + + for _, dataSourceName := range dataSourceNames { + dataSource := provider.DataSourcesMap[dataSourceName] + if err := schemaContainsEnabledFieldsNotDefinedAsABoolean(dataSource.Schema, map[string]struct{}{}); err != nil { + t.Fatalf("the Data Source %q contains an `_enabled` field which isn't defined as a boolean: %+v", dataSourceName, err) + } + } +} + +func TestResourcesHaveEnabledFieldsMarkedAsBooleans(t *testing.T) { + // This test validates that Resources do not contain a field suffixed with `_enabled` that isn't a Boolean. + // + // If this test is failing due to a new Resource/new field within an existing Resource, it'd be worth validating + // the schema, since fields matching `{some_name}_enabled` should be Booleans. Should a Tri-State Boolean exist, + // this field likely wants the `_enabled` suffix removing, to make the example `{some_name}` instead (with + // validation for the possible values). + provider := TestAzureProvider() + + // intentionally sorting these so the output is consistent + resourceNames := make([]string, 0) + for resourceName := range provider.ResourcesMap { + resourceNames = append(resourceNames, resourceName) + } + sort.Strings(resourceNames) + + // TODO: 4.0 - work through this list + resourceFieldsWhichNeedToBeAddressed := map[string]map[string]struct{}{ + // 1: Fields which require renaming etc + "azurerm_datadog_monitor_sso_configuration": { + // should be fixed in 4.0, presumably ditching `_enabled` and adding Enum validation + "single_sign_on_enabled": {}, + }, + "azurerm_netapp_volume": { + // should be fixed in 4.0, presumably ditching `_enabled` and making this `protocols_to_use` or something? + "protocols_enabled": {}, + }, + "azurerm_kubernetes_cluster": { + // this either wants `enabled` removing, or to be marked as a false-positive + "transparent_huge_page_enabled": {}, + }, + "azurerm_kubernetes_cluster_node_pool": { + // this either wants `enabled` removing, or to be marked as a false-positive + "transparent_huge_page_enabled": {}, + }, + + // 2: False Positives + "azurerm_iot_security_solution": { + // this is a list of recommendations + "recommendations_enabled": {}, + }, + } + if features.FourPointOhBeta() { + resourceFieldsWhichNeedToBeAddressed = map[string]map[string]struct{}{} + } + + for _, resourceName := range resourceNames { + resource := provider.ResourcesMap[resourceName] + fieldsToBeAddressed := resourceFieldsWhichNeedToBeAddressed[resourceName] + + if err := schemaContainsEnabledFieldsNotDefinedAsABoolean(resource.Schema, fieldsToBeAddressed); err != nil { + t.Fatalf("the Resource %q contains an `_enabled` field which isn't defined as a boolean: %+v", resourceName, err) + } + } +} + +func schemaContainsEnabledFieldsNotDefinedAsABoolean(input map[string]*schema.Schema, fieldsToBeAddressed map[string]struct{}) error { + // intentionally sorting these so the output is consistent + fieldNames := make([]string, 0) + for fieldName := range input { + fieldNames = append(fieldNames, fieldName) + } + sort.Strings(fieldNames) + + for _, fieldName := range fieldNames { + key := strings.ToLower(fieldName) + field := input[fieldName] + + if strings.HasSuffix(key, "_enabled") { + // @tombuildsstuff: we have some Resources which will need to be addressed in the next major version (v4.0) + // if this field name matches one we're intentionally ignoring, let's ignore it for now + if _, shouldIgnore := fieldsToBeAddressed[key]; shouldIgnore { + continue + } + if field.Type != pluginsdk.TypeBool { + return fmt.Errorf("field %q is an `_enabled` field so should be defined as a Boolean but got %+v", fieldName, field.Type) + } + } + + if field.Type == pluginsdk.TypeList && field.Elem != nil { + if val, ok := field.Elem.(*pluginsdk.Resource); ok && val.Schema != nil { + if err := schemaContainsEnabledFieldsNotDefinedAsABoolean(val.Schema, fieldsToBeAddressed); err != nil { + return fmt.Errorf("the field %q is a List: %+v", fieldName, err) + } + } + } + + if field.Type == pluginsdk.TypeSet && field.Elem != nil { + if val, ok := field.Elem.(*pluginsdk.Resource); ok && val.Schema != nil { + if err := schemaContainsEnabledFieldsNotDefinedAsABoolean(val.Schema, fieldsToBeAddressed); err != nil { + return fmt.Errorf("the field %q is a Set: %+v", fieldName, err) + } + } + } + } + + return nil +} + +func TestDataSourcesDoNotContainANameFieldWithADefaultOfDefault(t *testing.T) { + // This test validates that Data Sources do not contain a field `name` with a default value of `default`, which + // would signify that only a single instance of this resource can be created and is related to the parent resource. + // + // If a new Data Sources is failing because of this test, rather than adding a new Data Sources, you likely want to + // embed the relevant structure (for example `sso_configuration {}`) within the parent Data Sources this is related to. + provider := TestAzureProvider() + + // intentionally sorting these so the output is consistent + dataSourceNames := make([]string, 0) + for dataSourceName := range provider.DataSourcesMap { + dataSourceNames = append(dataSourceNames, dataSourceName) + } + sort.Strings(dataSourceNames) + + for _, dataSourceName := range dataSourceNames { + dataSource := provider.DataSourcesMap[dataSourceName] + if err := schemaContainsANameFieldWithADefaultValueOfDefault(dataSource.Schema, map[string]struct{}{}); err != nil { + t.Fatalf("the Data Source %q contains a `name` field with a default value of `default` - this Data Source should be exposed as part of the parent Data Source it's located within: %+v", dataSourceName, err) + } + } +} + +func TestResourcesDoNotContainANameFieldWithADefaultOfDefault(t *testing.T) { + // This test validates that Resources do not contain a field `name` with a default value of `default`, which + // would signify that only a single instance of this resource can be created and is related to the parent resource. + // + // If a new Resource is failing because of this test, rather than adding a new Resource, you likely want to + // embed the relevant structure (for example `sso_configuration {}`) within the parent Resource this is related to. + provider := TestAzureProvider() + + // intentionally sorting these so the output is consistent + resourceNames := make([]string, 0) + for resourceName := range provider.ResourcesMap { + resourceNames = append(resourceNames, resourceName) + } + sort.Strings(resourceNames) + + // TODO: 4.0 - work through this list + resourceFieldsWhichNeedToBeAddressed := map[string]map[string]struct{}{ + // 1: to be addressed in 4.0 + "azurerm_datadog_monitor_sso_configuration": { + // TODO: in 4.0 this resource probably wants embedding within `azurerm_datadog_monitor` + // which'll also need the Monitor resource to have Create call Update + "name": {}, + }, + "azurerm_datadog_monitor_tag_rule": { + // TODO: in 4.0 this resource probably wants embedding within `azurerm_datadog_monitor` + // which'll also need the Monitor resource to have Create call Update + "name": {}, + }, + "azurerm_spring_cloud_accelerator": { + // TODO: in 4.0 this resource probably wants embedding within `azurerm_spring_cloud_service` + "name": {}, + }, + "azurerm_spring_cloud_api_portal": { + // TODO: in 4.0 this resource probably wants embedding within `azurerm_spring_cloud_service` + "name": {}, + }, + "azurerm_spring_cloud_application_live_view": { + // TODO: in 4.0 this resource probably wants embedding within `azurerm_spring_cloud_service` + "name": {}, + }, + "azurerm_spring_cloud_configuration_service": { + // TODO: in 4.0 this resource probably wants embedding within `azurerm_spring_cloud_service` + "name": {}, + }, + "azurerm_spring_cloud_dev_tool_portal": { + // TODO: in 4.0 this resource probably wants embedding within `azurerm_spring_cloud_service` + "name": {}, + }, + "azurerm_spring_cloud_gateway": { + // TODO: in 4.0 this resource probably wants embedding within `azurerm_spring_cloud_service` + "name": {}, + }, + + // 2: False Positives? + "azurerm_redis_enterprise_database": { + "name": {}, + }, + + // 3: Deprecated / to be removed in 4.0 + "azurerm_cosmosdb_notebook_workspace": { + "name": {}, + }, + } + if features.FourPointOhBeta() { + resourceFieldsWhichNeedToBeAddressed = map[string]map[string]struct{}{} + } + + for _, resourceName := range resourceNames { + resource := provider.ResourcesMap[resourceName] + fieldsToBeAddressed := resourceFieldsWhichNeedToBeAddressed[resourceName] + + if err := schemaContainsANameFieldWithADefaultValueOfDefault(resource.Schema, fieldsToBeAddressed); err != nil { + t.Fatalf("the Resource %q contains a `name` field with a default value of `default` - this Resource should be exposed as part of the parent Resource it's located within: %+v", resourceName, err) + } + } +} + +func schemaContainsANameFieldWithADefaultValueOfDefault(input map[string]*schema.Schema, fieldsToBeAddressed map[string]struct{}) error { + // intentionally sorting these so the output is consistent + fieldNames := make([]string, 0) + for fieldName := range input { + fieldNames = append(fieldNames, fieldName) + } + sort.Strings(fieldNames) + + for _, fieldName := range fieldNames { + key := strings.ToLower(fieldName) + field := input[fieldName] + + // @tombuildsstuff: we have some Resources which will need to be addressed in the next major version (v4.0) + // if this field name matches one we're intentionally ignoring, let's ignore it for now + if _, shouldIgnore := fieldsToBeAddressed[key]; shouldIgnore { + continue + } + + if strings.EqualFold(key, "name") { + defaultValue, err := field.DefaultValue() + if err != nil { + return fmt.Errorf("obtaining default value for %q: %+v", fieldName, err) + } + + if v, ok := defaultValue.(string); ok { + if strings.EqualFold(v, "default") { + return fmt.Errorf("field %q is a `name` field which contains a default value of `default`", fieldName) + } + } + + // should the ValidateFunc allow `default`, we can assume this too + if field.ValidateFunc != nil { + allowsEmptyString := runInputForValidateFunction(field.ValidateFunc, "") + allowsWhitespaceString := runInputForValidateFunction(field.ValidateFunc, " ") + allowsPlaceholderValue := runInputForValidateFunction(field.ValidateFunc, "placeholder") + allowsDefaultValue := runInputForValidateFunction(field.ValidateFunc, "default") + if allowsDefaultValue && !allowsPlaceholderValue && !allowsWhitespaceString && !allowsEmptyString { + return fmt.Errorf("field %q is a `name` field where the ValidateFunc explicitly allows a default value of `default`", fieldName) + } + } + } + + if field.Type == pluginsdk.TypeList && field.Elem != nil { + if val, ok := field.Elem.(*pluginsdk.Resource); ok && val.Schema != nil { + if err := schemaContainsANameFieldWithADefaultValueOfDefault(val.Schema, fieldsToBeAddressed); err != nil { + return fmt.Errorf("the field %q is a List: %+v", fieldName, err) + } + } + } + + if field.Type == pluginsdk.TypeSet && field.Elem != nil { + if val, ok := field.Elem.(*pluginsdk.Resource); ok && val.Schema != nil { + if err := schemaContainsANameFieldWithADefaultValueOfDefault(val.Schema, fieldsToBeAddressed); err != nil { + return fmt.Errorf("the field %q is a Set: %+v", fieldName, err) + } + } + } + } + + return nil +} + +func runInputForValidateFunction(validateFunc pluginsdk.SchemaValidateFunc, input string) bool { + if validateFunc == nil { + return false + } + + warnings, errs := validateFunc(input, input) + return len(warnings) == 0 && len(errs) == 0 +} + +func TestDataSourcesWithAnEncryptionBlockBehaveConsistently(t *testing.T) { + // This test validates that Data Sources do not contain an `encryption` block which is marked as Computed: true + // or a field named `enabled` or `key_source`. + // + // This hides the fact that encryption is enabled on this resource - and (rather than exposing an `encryption` + // block as Computed) should instead be exposed as a non-Computed block. + // + // In cases where the block contains `key_source`, this field should be removed and instead inferred based on + // the presence of the block, using a custom encryption key (and thus a `key_source` of {likely} `Microsoft.KeyVault`) + // when the block is specified - and the default value (generally the RP name) when the block is omitted. + provider := TestAzureProvider() + + // intentionally sorting these so the output is consistent + dataSourceNames := make([]string, 0) + for dataSourceName := range provider.DataSourcesMap { + dataSourceNames = append(dataSourceNames, dataSourceName) + } + sort.Strings(dataSourceNames) + + // TODO: 4.0 - work through this list + dataSourcesWhichNeedToBeAddressed := map[string]struct{}{ + "azurerm_app_configuration": {}, + "azurerm_batch_pool": {}, + "azurerm_managed_disk": {}, + "azurerm_snapshot": {}, + } + if features.FourPointOhBeta() { + dataSourcesWhichNeedToBeAddressed = map[string]struct{}{} + } + + for _, dataSourceName := range dataSourceNames { + dataSource := provider.DataSourcesMap[dataSourceName] + if err := schemaContainsAnEncryptionBlock(dataSource.Schema); err != nil { + if _, ok := dataSourcesWhichNeedToBeAddressed[dataSourceName]; ok { + continue + } + + t.Fatalf("the Data Source %q contains an `encryption` block marked as Computed - this should be marked as non-Computed (and the key source automatically inferred): %+v", dataSourceName, err) + } + } +} + +func TestResourcesWithAnEncryptionBlockBehaveConsistently(t *testing.T) { + // This test validates that Resources do not contain an `encryption` block which is marked as Computed: true + // or a field named `enabled` or `key_source`. + // + // This hides the fact that encryption is enabled on this resource - and (rather than exposing an `encryption` + // block as Computed) should instead be exposed as a non-Computed block. + // + // In cases where the block contains `key_source`, this field should be removed and instead inferred based on + // the presence of the block, using a custom encryption key (and thus a `key_source` of {likely} `Microsoft.KeyVault`) + // when the block is specified - and the default value (generally the RP name) when the block is omitted. + provider := TestAzureProvider() + + // intentionally sorting these so the output is consistent + resourceNames := make([]string, 0) + for resourceName := range provider.ResourcesMap { + resourceNames = append(resourceNames, resourceName) + } + sort.Strings(resourceNames) + + // TODO: 4.0 - work through this list + resourcesWhichNeedToBeAddressed := map[string]struct{}{ + "azurerm_automation_account": {}, + "azurerm_container_registry": {}, + "azurerm_managed_disk": {}, + "azurerm_media_services_account": {}, + "azurerm_snapshot": {}, + } + if features.FourPointOhBeta() { + resourcesWhichNeedToBeAddressed = map[string]struct{}{} + } + + for _, resourceName := range resourceNames { + resource := provider.ResourcesMap[resourceName] + + if err := schemaContainsAnEncryptionBlock(resource.Schema); err != nil { + if _, ok := resourcesWhichNeedToBeAddressed[resourceName]; ok { + continue + } + t.Fatalf("the Resource %q contains an `encryption` block marked as Computed - this should be marked as non-Computed (and the key source automatically inferred): %+v", resourceName, err) + } + } +} + +func schemaContainsAnEncryptionBlock(input map[string]*schema.Schema) error { + // intentionally sorting these so the output is consistent + fieldNames := make([]string, 0) + for fieldName := range input { + fieldNames = append(fieldNames, fieldName) + } + sort.Strings(fieldNames) + + for _, fieldName := range fieldNames { + key := strings.ToLower(fieldName) + field := input[fieldName] + + if field.Type == pluginsdk.TypeList && field.Elem != nil { + if strings.Contains(key, "encryption") { + if field.Computed { + return fmt.Errorf("the block %q is marked as Computed when it shouldn't be", fieldName) + } + + if val, ok := field.Elem.(*pluginsdk.Resource); ok && val.Schema != nil { + for nestedKey, nestedField := range val.Schema { + lowered := strings.ToLower(nestedKey) + // check that no nested fields contain `_source` + if strings.Contains(lowered, "_source") { + return fmt.Errorf("field %q within the block %q appears to be a Key Source - this can instead be defaulted based on the presence of the containing block", nestedKey, fieldName) + } + + // check if there's an `enabled` field when there shouldn't be + if strings.EqualFold(lowered, "enabled") { + return fmt.Errorf("field %q within the block %q controls whether the block is enabled/disabled - this field can be removed and implied based on the presence of the containing block", nestedKey, fieldName) + } + + // check that none of the nested fields allow `Microsoft.KeyVault` as a value + if supportsKeyVaultAsAValue := runInputForValidateFunction(nestedField.ValidateFunc, "Microsoft.KeyVault"); supportsKeyVaultAsAValue { + return fmt.Errorf("field %q within the block %q appears to be a Key Source (supports `Microsoft.KeyVault` as a value) - this field can be removed and defaulted based on the presence of the containing block", nestedKey, fieldName) + } + } + } + + continue + } + + if val, ok := field.Elem.(*pluginsdk.Resource); ok && val.Schema != nil { + if err := schemaContainsAnEncryptionBlock(val.Schema); err != nil { + return fmt.Errorf("field %q: %+v", fieldName, err) + } + } + } + } + + return nil +} diff --git a/internal/provider/services.go b/internal/provider/services.go index f254347aef0b..719df7d4d1f8 100644 --- a/internal/provider/services.go +++ b/internal/provider/services.go @@ -24,6 +24,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger" "github.com/hashicorp/terraform-provider-azurerm/internal/services/connections" "github.com/hashicorp/terraform-provider-azurerm/internal/services/consumption" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/containerapps" "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos" "github.com/hashicorp/terraform-provider-azurerm/internal/services/costmanagement" @@ -52,6 +53,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/healthcare" "github.com/hashicorp/terraform-provider-azurerm/internal/services/hpccache" "github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/hybridcompute" "github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral" "github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub" "github.com/hashicorp/terraform-provider-azurerm/internal/services/iottimeseriesinsights" @@ -73,6 +75,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb" "github.com/hashicorp/terraform-provider-azurerm/internal/services/media" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/mobilenetwork" "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql" @@ -129,6 +132,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { compute.Registration{}, consumption.Registration{}, cosmos.Registration{}, + containerapps.Registration{}, costmanagement.Registration{}, dashboard.Registration{}, databoxedge.Registration{}, @@ -138,6 +142,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { domainservices.Registration{}, eventhub.Registration{}, fluidrelay.Registration{}, + hybridcompute.Registration{}, iothub.Registration{}, iotcentral.Registration{}, keyvault.Registration{}, @@ -145,7 +150,9 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { loadbalancer.Registration{}, loganalytics.Registration{}, media.Registration{}, + machinelearning.Registration{}, monitor.Registration{}, + mobilenetwork.Registration{}, mssql.Registration{}, network.Registration{}, nginx.Registration{}, diff --git a/internal/resourceproviders/required.go b/internal/resourceproviders/required.go index 510987ff96c9..eef1a28b0c5b 100644 --- a/internal/resourceproviders/required.go +++ b/internal/resourceproviders/required.go @@ -68,7 +68,6 @@ func Required() map[string]struct{} { "Microsoft.SecurityInsights": {}, "Microsoft.ServiceBus": {}, "Microsoft.ServiceFabric": {}, - "Microsoft.ServiceFabricMesh": {}, "Microsoft.Sql": {}, "Microsoft.Storage": {}, "Microsoft.StreamAnalytics": {}, diff --git a/internal/sdk/plugin_sdk_test.go b/internal/sdk/plugin_sdk_test.go index 22d2a611e3e0..a02fba1db46e 100644 --- a/internal/sdk/plugin_sdk_test.go +++ b/internal/sdk/plugin_sdk_test.go @@ -6,9 +6,9 @@ import ( "reflect" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccPluginSDKAndDecoder(t *testing.T) { diff --git a/internal/services/aadb2c/aadb2c_directory_data_source.go b/internal/services/aadb2c/aadb2c_directory_data_source.go index de2fcd22bfed..376c68098462 100644 --- a/internal/services/aadb2c/aadb2c_directory_data_source.go +++ b/internal/services/aadb2c/aadb2c_directory_data_source.go @@ -3,9 +3,9 @@ package aadb2c import ( "context" "fmt" - "net/http" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" @@ -104,11 +104,10 @@ func (r AadB2cDirectoryDataSource) Read() sdk.ResourceFunc { id := tenants.NewB2CDirectoryID(subscriptionId, state.ResourceGroup, state.DomainName) - metadata.Logger.Infof("Reading %s", id) resp, err := client.Get(ctx, id) if err != nil { - if resp.HttpResponse.StatusCode == http.StatusNotFound { - return metadata.MarkAsGone(id) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %v", id, err) } diff --git a/internal/services/apimanagement/api_management_custom_domain_resource.go b/internal/services/apimanagement/api_management_custom_domain_resource.go index f583847eda6c..96ba8ea1d7b4 100644 --- a/internal/services/apimanagement/api_management_custom_domain_resource.go +++ b/internal/services/apimanagement/api_management_custom_domain_resource.go @@ -32,10 +32,10 @@ func resourceApiManagementCustomDomain() *pluginsdk.Resource { }), Timeouts: &pluginsdk.ResourceTimeout{ - Create: pluginsdk.DefaultTimeout(45 * time.Minute), + Create: pluginsdk.DefaultTimeout(60 * time.Minute), Read: pluginsdk.DefaultTimeout(5 * time.Minute), - Update: pluginsdk.DefaultTimeout(45 * time.Minute), - Delete: pluginsdk.DefaultTimeout(45 * time.Minute), + Update: pluginsdk.DefaultTimeout(60 * time.Minute), + Delete: pluginsdk.DefaultTimeout(60 * time.Minute), }, Schema: map[string]*pluginsdk.Schema{ @@ -169,6 +169,11 @@ func apiManagementCustomDomainRead(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() + apimHostNameSuffix, ok := environment.ApiManagement.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine API Management domain suffix for environment %q", environment.Name) + } + id, err := parse.CustomDomainID(d.Id()) if err != nil { return err @@ -190,8 +195,7 @@ func apiManagementCustomDomainRead(d *pluginsdk.ResourceData, meta interface{}) d.Set("api_management_id", apiMgmtId.ID()) if resp.ServiceProperties != nil && resp.ServiceProperties.HostnameConfigurations != nil { - apimHostNameSuffix := environment.APIManagementHostNameSuffix - configs := flattenApiManagementHostnameConfiguration(resp.ServiceProperties.HostnameConfigurations, d, *resp.Name, apimHostNameSuffix) + configs := flattenApiManagementHostnameConfiguration(resp.ServiceProperties.HostnameConfigurations, d, *resp.Name, *apimHostNameSuffix) for _, config := range configs { for key, v := range config.(map[string]interface{}) { // lintignore:R001 diff --git a/internal/services/apimanagement/api_management_identity_provider_twitter_resource.go b/internal/services/apimanagement/api_management_identity_provider_twitter_resource.go index 7d4e3ac047ec..c51526513247 100644 --- a/internal/services/apimanagement/api_management_identity_provider_twitter_resource.go +++ b/internal/services/apimanagement/api_management_identity_provider_twitter_resource.go @@ -41,6 +41,7 @@ func resourceApiManagementIdentityProviderTwitter() *pluginsdk.Resource { "api_key": { Type: pluginsdk.TypeString, Required: true, + Sensitive: true, ValidateFunc: validation.StringIsNotEmpty, }, diff --git a/internal/services/apimanagement/api_management_redis_cache_resource.go b/internal/services/apimanagement/api_management_redis_cache_resource.go index c8bbbf5762da..8d2c9cf717df 100644 --- a/internal/services/apimanagement/api_management_redis_cache_resource.go +++ b/internal/services/apimanagement/api_management_redis_cache_resource.go @@ -89,6 +89,11 @@ func resourceApiManagementRedisCacheCreateUpdate(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() + resourceManagerEndpoint, ok := meta.(*clients.Client).Account.Environment.ResourceManager.Endpoint() + if !ok { + return fmt.Errorf("could not determine Resource Manager endpoint suffix for environment %q", meta.(*clients.Client).Account.Environment.Name) + } + name := d.Get("name").(string) apimId, err := parse.ApiManagementID(d.Get("api_management_id").(string)) if err != nil { @@ -119,11 +124,8 @@ func resourceApiManagementRedisCacheCreateUpdate(d *pluginsdk.ResourceData, meta parameters.CacheContractProperties.Description = utils.String(v.(string)) } - // Remove the extra / in the ResourceID so the redis cache can be associated to the api mgmt service as expected, - // otherwise, the resourceId behave like - // "https://management.azure.com//subscriptions/xx/resourceGroups/xx/providers/Microsoft.Cache/Redis/xx" if v, ok := d.GetOk("redis_cache_id"); ok && v.(string) != "" { - parameters.CacheContractProperties.ResourceID = utils.String(strings.TrimSuffix(meta.(*clients.Client).Account.Environment.ResourceManagerEndpoint, "/") + v.(string)) + parameters.CacheContractProperties.ResourceID = utils.String(*resourceManagerEndpoint + v.(string)) } // here we use "PUT" for updating, because `description` is not allowed to be empty string, Then we could not update to remove `description` by `PATCH` @@ -141,6 +143,11 @@ func resourceApiManagementRedisCacheRead(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() + resourceManagerEndpoint, ok := meta.(*clients.Client).Account.Environment.ResourceManager.Endpoint() + if !ok { + return fmt.Errorf("could not determine Resource Manager endpoint suffix for environment %q", meta.(*clients.Client).Account.Environment.Name) + } + id, err := parse.RedisCacheID(d.Id()) if err != nil { return err @@ -163,7 +170,7 @@ func resourceApiManagementRedisCacheRead(d *pluginsdk.ResourceData, meta interfa cacheId := "" if props.ResourceID != nil { // correct the resourceID issue: "https://management.azure.com//subscriptions/xx/resourceGroups/xx/providers/Microsoft.Cache/Redis/xx" - cacheId = strings.TrimPrefix(*props.ResourceID, strings.TrimSuffix(meta.(*clients.Client).Account.Environment.ResourceManagerEndpoint, "/")) + cacheId = strings.TrimPrefix(*props.ResourceID, *resourceManagerEndpoint) } d.Set("redis_cache_id", cacheId) d.Set("cache_location", props.UseFromLocation) diff --git a/internal/services/apimanagement/api_management_resource.go b/internal/services/apimanagement/api_management_resource.go index ab7e6130e726..cb5548318267 100644 --- a/internal/services/apimanagement/api_management_resource.go +++ b/internal/services/apimanagement/api_management_resource.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz" @@ -493,6 +494,38 @@ func resourceApiManagementSchema() map[string]*pluginsdk.Schema { }, }, + "delegation": { + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "subscriptions_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + "user_registration_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + "url": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.IsURLWithHTTPorHTTPS, + }, + "validation_key": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validate.Base64EncodedString, + Sensitive: true, + }, + }, + }, + }, + "sign_up": { Type: pluginsdk.TypeList, Optional: true, @@ -908,6 +941,18 @@ func resourceApiManagementServiceCreateUpdate(d *pluginsdk.ResourceData, meta in } } + delegationSettingsRaw := d.Get("delegation").([]interface{}) + if sku.Name == apimanagement.SkuTypeConsumption && len(delegationSettingsRaw) > 0 { + return fmt.Errorf("`delegation` is not support for sku tier `Consumption`") + } + if sku.Name != apimanagement.SkuTypeConsumption && len(delegationSettingsRaw) > 0 { + delegationSettings := expandApiManagementDelegationSettings(delegationSettingsRaw) + delegationClient := meta.(*clients.Client).ApiManagement.DelegationSettingsClient + if _, err := delegationClient.CreateOrUpdate(ctx, id.ResourceGroup, id.ServiceName, delegationSettings, ""); err != nil { + return fmt.Errorf(" setting Delegation settings for %s: %+v", id, err) + } + } + policyClient := meta.(*clients.Client).ApiManagement.PolicyClient policiesRaw := d.Get("policy").([]interface{}) policy, err := expandApiManagementPolicies(policiesRaw) @@ -951,6 +996,7 @@ func resourceApiManagementServiceRead(d *pluginsdk.ResourceData, meta interface{ client := meta.(*clients.Client).ApiManagement.ServiceClient signInClient := meta.(*clients.Client).ApiManagement.SignInClient signUpClient := meta.(*clients.Client).ApiManagement.SignUpClient + delegationClient := meta.(*clients.Client).ApiManagement.DelegationSettingsClient tenantAccessClient := meta.(*clients.Client).ApiManagement.TenantAccessClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -1078,9 +1124,24 @@ func resourceApiManagementServiceRead(d *pluginsdk.ResourceData, meta interface{ if err := d.Set("sign_up", flattenApiManagementSignUpSettings(signUpSettings)); err != nil { return fmt.Errorf("setting `sign_up`: %+v", err) } + + delegationSettings, err := delegationClient.Get(ctx, id.ResourceGroup, id.ServiceName) + if err != nil { + return fmt.Errorf("retrieving Delegation Settings for %s: %+v", *id, err) + } + + delegationValidationKeyContract, err := delegationClient.ListSecrets(ctx, id.ResourceGroup, id.ServiceName) + if err != nil { + return fmt.Errorf("retrieving Delegation Validation Key for %s: %+v", *id, err) + } + + if err := d.Set("delegation", flattenApiManagementDelegationSettings(delegationSettings, delegationValidationKeyContract)); err != nil { + return fmt.Errorf("setting `delegation`: %+v", err) + } } else { d.Set("sign_in", []interface{}{}) d.Set("sign_up", []interface{}{}) + d.Set("delegation", []interface{}{}) } if resp.Sku.Name != apimanagement.SkuTypeConsumption { @@ -1808,6 +1869,78 @@ func flattenApiManagementSignInSettings(input apimanagement.PortalSigninSettings } } +func expandApiManagementDelegationSettings(input []interface{}) apimanagement.PortalDelegationSettings { + if len(input) == 0 { + return apimanagement.PortalDelegationSettings{} + } + + vs := input[0].(map[string]interface{}) + + props := apimanagement.PortalDelegationSettingsProperties{ + UserRegistration: &apimanagement.RegistrationDelegationSettingsProperties{ + Enabled: utils.Bool(vs["user_registration_enabled"].(bool)), + }, + Subscriptions: &apimanagement.SubscriptionsDelegationSettingsProperties{ + Enabled: utils.Bool(vs["subscriptions_enabled"].(bool)), + }, + } + + validationKey := vs["validation_key"].(string) + if !vs["user_registration_enabled"].(bool) && !vs["subscriptions_enabled"].(bool) && validationKey == "" { + // for some reason we cannot leave this empty + props.ValidationKey = utils.String("cGxhY2Vob2xkZXIxCg==") + } + if validationKey != "" { + props.ValidationKey = utils.String(validationKey) + } + + url := vs["url"].(string) + if !vs["user_registration_enabled"].(bool) && !vs["subscriptions_enabled"].(bool) && url == "" { + // for some reason we cannot leave this empty + props.URL = utils.String("https://www.placeholder.com") + } + if url != "" { + props.URL = utils.String(url) + } + + return apimanagement.PortalDelegationSettings{ + PortalDelegationSettingsProperties: &props, + } +} + +func flattenApiManagementDelegationSettings(input apimanagement.PortalDelegationSettings, keyContract apimanagement.PortalSettingValidationKeyContract) []interface{} { + url := "" + subscriptionsEnabled := false + userRegistrationEnabled := false + + if props := input.PortalDelegationSettingsProperties; props != nil { + if props.URL != nil { + url = *props.URL + } + + if props.Subscriptions != nil && props.Subscriptions.Enabled != nil { + subscriptionsEnabled = *props.Subscriptions.Enabled + } + + if props.UserRegistration != nil && props.UserRegistration.Enabled != nil { + userRegistrationEnabled = *props.UserRegistration.Enabled + } + } + validationKey := "" + if keyContract.ValidationKey != nil { + validationKey = *keyContract.ValidationKey + } + + return []interface{}{ + map[string]interface{}{ + "url": url, + "subscriptions_enabled": subscriptionsEnabled, + "user_registration_enabled": userRegistrationEnabled, + "validation_key": validationKey, + }, + } +} + func expandApiManagementSignUpSettings(input []interface{}) apimanagement.PortalSignupSettings { if len(input) == 0 { return apimanagement.PortalSignupSettings{ diff --git a/internal/services/apimanagement/api_management_resource_test.go b/internal/services/apimanagement/api_management_resource_test.go index 98fc763ceb1a..57455e56c3f8 100644 --- a/internal/services/apimanagement/api_management_resource_test.go +++ b/internal/services/apimanagement/api_management_resource_test.go @@ -6,7 +6,6 @@ import ( "regexp" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/testclient" @@ -201,6 +200,49 @@ func TestAccApiManagement_signInSignUpSettings(t *testing.T) { }) } +func TestAccApiManagement_delegationSettings(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_api_management", "test") + r := ApiManagementResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.delegationSettings(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.delegationSettingsDisabled(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.delegationSettings(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func TestAccApiManagement_policy(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_api_management", "test") r := ApiManagementResource{} @@ -571,7 +613,7 @@ func (ApiManagementResource) Exists(ctx context.Context, clients *clients.Client } func (ApiManagementResource) testCheckHasNoProductsOrApis(resourceName string) pluginsdk.TestCheckFunc { - return func(state *terraform.State) error { + return func(state *pluginsdk.State) error { client, err := testclient.Build() if err != nil { return fmt.Errorf("building client: %+v", err) @@ -1118,6 +1160,64 @@ resource "azurerm_api_management" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } +func (ApiManagementResource) delegationSettings(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_api_management" "test" { + name = "acctestAM-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + publisher_name = "pub1" + publisher_email = "pub1@email.com" + + sku_name = "Developer_1" + + delegation { + url = "https://google.com" + subscriptions_enabled = true + validation_key = "aW50ZWdyYXRpb24mMjAyMzAzMTAxODMwJkxRaUxzcUVsaUpEaHJRK01YZkJYV3paUi9qdzZDSWMrazhjUXB0bVdyTGxKcVYrd0R4OXRqMGRzTWZXU3hmeGQ0a2V0WjcrcE44U0dJdDNsYUQ3Rk5BPT0=" + user_registration_enabled = true + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +} + +func (ApiManagementResource) delegationSettingsDisabled(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_api_management" "test" { + name = "acctestAM-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + publisher_name = "pub1" + publisher_email = "pub1@email.com" + + sku_name = "Developer_1" + + delegation { + subscriptions_enabled = false + user_registration_enabled = false + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +} + func (ApiManagementResource) complete(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/apimanagement/api_management_subscription_resource.go b/internal/services/apimanagement/api_management_subscription_resource.go index 47d2da8086b2..aefee807ac1b 100644 --- a/internal/services/apimanagement/api_management_subscription_resource.go +++ b/internal/services/apimanagement/api_management_subscription_resource.go @@ -247,7 +247,7 @@ func resourceApiManagementSubscriptionRead(d *pluginsdk.ResourceData, meta inter if err == nil { productId = parseId.ID() } else { - parsedApiId, err := parse.ApiID(*props.Scope) + parsedApiId, err := parse.ApiIDInsensitively(*props.Scope) if err != nil { return fmt.Errorf("parsing scope into product/ api id %q: %+v", *props.Scope, err) } diff --git a/internal/services/apimanagement/client/client.go b/internal/services/apimanagement/client/client.go index dfa91a58207a..9389252d9597 100644 --- a/internal/services/apimanagement/client/client.go +++ b/internal/services/apimanagement/client/client.go @@ -20,6 +20,7 @@ type Client struct { BackendClient *apimanagement.BackendClient CacheClient *apimanagement.CacheClient CertificatesClient *apimanagement.CertificateClient + DelegationSettingsClient *apimanagement.DelegationSettingsClient DeletedServicesClient *apimanagement.DeletedServicesClient DiagnosticClient *apimanagement.DiagnosticClient EmailTemplateClient *apimanagement.EmailTemplateClient @@ -93,6 +94,9 @@ func NewClient(o *common.ClientOptions) *Client { diagnosticClient := apimanagement.NewDiagnosticClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&diagnosticClient.Client, o.ResourceManagerAuthorizer) + delegationSettingsClient := apimanagement.NewDelegationSettingsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&delegationSettingsClient.Client, o.ResourceManagerAuthorizer) + deletedServicesClient := apimanagement.NewDeletedServicesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&deletedServicesClient.Client, o.ResourceManagerAuthorizer) @@ -188,6 +192,7 @@ func NewClient(o *common.ClientOptions) *Client { BackendClient: &backendClient, CacheClient: &cacheClient, CertificatesClient: &certificatesClient, + DelegationSettingsClient: &delegationSettingsClient, DeletedServicesClient: &deletedServicesClient, DiagnosticClient: &diagnosticClient, EmailTemplateClient: &emailTemplateClient, diff --git a/internal/services/appconfiguration/app_configuration_feature_resource.go b/internal/services/appconfiguration/app_configuration_feature_resource.go index 975b2f778bda..056d9ab57102 100644 --- a/internal/services/appconfiguration/app_configuration_feature_resource.go +++ b/internal/services/appconfiguration/app_configuration_feature_resource.go @@ -7,8 +7,8 @@ import ( "time" "github.com/Azure/go-autorest/autorest" + "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/parse" @@ -48,7 +48,7 @@ func (k FeatureResource) Arguments() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: azure.ValidateResourceID, + ValidateFunc: configurationstores.ValidateConfigurationStoreID, }, "description": { Type: pluginsdk.TypeString, @@ -166,12 +166,12 @@ func (k FeatureResource) Create() sdk.ResourceFunc { } client, err := metadata.Client.AppConfiguration.DataPlaneClient(ctx, model.ConfigurationStoreId) - if client == nil { - return fmt.Errorf("app configuration %q was not found", model.ConfigurationStoreId) - } if err != nil { return err } + if client == nil { + return fmt.Errorf("app configuration %q was not found", model.ConfigurationStoreId) + } appCfgFeatureResourceID := parse.AppConfigurationFeatureId{ ConfigurationStoreId: model.ConfigurationStoreId, @@ -225,13 +225,13 @@ func (k FeatureResource) Read() sdk.ResourceFunc { } client, err := metadata.Client.AppConfiguration.DataPlaneClient(ctx, resourceID.ConfigurationStoreId) + if err != nil { + return err + } if client == nil { // if the AppConfiguration is gone then all the data inside it is too return metadata.MarkAsGone(resourceID) } - if err != nil { - return err - } kv, err := client.GetKeyValue(ctx, featureKey, resourceID.Label, "", "", "", []string{}) if err != nil { @@ -297,12 +297,12 @@ func (k FeatureResource) Update() sdk.ResourceFunc { featureKey := fmt.Sprintf("%s/%s", FeatureKeyPrefix, resourceID.Name) client, err := metadata.Client.AppConfiguration.DataPlaneClient(ctx, resourceID.ConfigurationStoreId) - if client == nil { - return fmt.Errorf("app configuration %q was not found", resourceID.ConfigurationStoreId) - } if err != nil { return err } + if client == nil { + return fmt.Errorf("app configuration %q was not found", resourceID.ConfigurationStoreId) + } var model FeatureResourceModel if err := metadata.Decode(&model); err != nil { diff --git a/internal/services/appconfiguration/app_configuration_feature_resource_test.go b/internal/services/appconfiguration/app_configuration_feature_resource_test.go index 501e2f5f4076..7bfe56f780c1 100644 --- a/internal/services/appconfiguration/app_configuration_feature_resource_test.go +++ b/internal/services/appconfiguration/app_configuration_feature_resource_test.go @@ -172,13 +172,13 @@ func (t AppConfigurationFeatureResource) Exists(ctx context.Context, clients *cl } client, err := clients.AppConfiguration.DataPlaneClient(ctx, resourceID.ConfigurationStoreId) + if err != nil { + return nil, err + } if client == nil { // if the AppConfiguration is gone all the data is too return utils.Bool(false), nil } - if err != nil { - return nil, err - } res, err := client.GetKeyValues(ctx, resourceID.Name, resourceID.Label, "", "", []string{}) if err != nil { diff --git a/internal/services/appconfiguration/app_configuration_key_data_source.go b/internal/services/appconfiguration/app_configuration_key_data_source.go index 4c35cd4cf366..0d7850b9d138 100644 --- a/internal/services/appconfiguration/app_configuration_key_data_source.go +++ b/internal/services/appconfiguration/app_configuration_key_data_source.go @@ -8,7 +8,7 @@ import ( "time" "github.com/Azure/go-autorest/autorest" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -26,7 +26,7 @@ func (k KeyDataSource) Arguments() map[string]*pluginsdk.Schema { "configuration_store_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: azure.ValidateResourceID, + ValidateFunc: configurationstores.ValidateConfigurationStoreID, }, "key": { Type: pluginsdk.TypeString, @@ -100,12 +100,12 @@ func (k KeyDataSource) Read() sdk.ResourceFunc { } client, err := metadata.Client.AppConfiguration.DataPlaneClient(ctx, model.ConfigurationStoreId) - if client == nil { - return fmt.Errorf("building data plane client: app configuration %q was not found", model.ConfigurationStoreId) - } if err != nil { return err } + if client == nil { + return fmt.Errorf("building data plane client: app configuration %q was not found", model.ConfigurationStoreId) + } kv, err := client.GetKeyValue(ctx, decodedKey, model.Label, "", "", "", []string{}) if err != nil { diff --git a/internal/services/appconfiguration/app_configuration_key_resource.go b/internal/services/appconfiguration/app_configuration_key_resource.go index a5786cbf49a1..605dc6ca099d 100644 --- a/internal/services/appconfiguration/app_configuration_key_resource.go +++ b/internal/services/appconfiguration/app_configuration_key_resource.go @@ -8,7 +8,7 @@ import ( "time" "github.com/Azure/go-autorest/autorest" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/migration" @@ -56,7 +56,7 @@ func (k KeyResource) Arguments() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: azure.ValidateResourceID, + ValidateFunc: configurationstores.ValidateConfigurationStoreID, }, "key": { Type: pluginsdk.TypeString, @@ -125,12 +125,12 @@ func (k KeyResource) Create() sdk.ResourceFunc { } client, err := metadata.Client.AppConfiguration.DataPlaneClient(ctx, model.ConfigurationStoreId) - if client == nil { - return fmt.Errorf("app configuration %q was not found", model.ConfigurationStoreId) - } if err != nil { return err } + if client == nil { + return fmt.Errorf("app configuration %q was not found", model.ConfigurationStoreId) + } appCfgKeyResourceID := parse.AppConfigurationKeyId{ ConfigurationStoreId: model.ConfigurationStoreId, @@ -208,13 +208,13 @@ func (k KeyResource) Read() sdk.ResourceFunc { } client, err := metadata.Client.AppConfiguration.DataPlaneClient(ctx, resourceID.ConfigurationStoreId) + if err != nil { + return err + } if client == nil { // if the parent AppConfiguration is gone, all the data will be too return metadata.MarkAsGone(resourceID) } - if err != nil { - return err - } kv, err := client.GetKeyValue(ctx, resourceID.Key, resourceID.Label, "", "", "", []string{}) if err != nil { @@ -272,12 +272,12 @@ func (k KeyResource) Update() sdk.ResourceFunc { } client, err := metadata.Client.AppConfiguration.DataPlaneClient(ctx, resourceID.ConfigurationStoreId) - if client == nil { - return fmt.Errorf("app configuration %q was not found", resourceID.ConfigurationStoreId) - } if err != nil { return err } + if client == nil { + return fmt.Errorf("app configuration %q was not found", resourceID.ConfigurationStoreId) + } var model KeyResourceModel if err := metadata.Decode(&model); err != nil { @@ -334,11 +334,12 @@ func (k KeyResource) Delete() sdk.ResourceFunc { } client, err := metadata.Client.AppConfiguration.DataPlaneClient(ctx, resourceID.ConfigurationStoreId) - if client == nil { - return fmt.Errorf("app configuration %q was not found", resourceID.ConfigurationStoreId) - } if err != nil { return err + + } + if client == nil { + return fmt.Errorf("app configuration %q was not found", resourceID.ConfigurationStoreId) } decodedKey, err := url.QueryUnescape(resourceID.Key) diff --git a/internal/services/appconfiguration/app_configuration_key_resource_test.go b/internal/services/appconfiguration/app_configuration_key_resource_test.go index c8a1dff7452e..25814963a9fb 100644 --- a/internal/services/appconfiguration/app_configuration_key_resource_test.go +++ b/internal/services/appconfiguration/app_configuration_key_resource_test.go @@ -150,13 +150,13 @@ func (t AppConfigurationKeyResource) Exists(ctx context.Context, clients *client } client, err := clients.AppConfiguration.DataPlaneClient(ctx, resourceID.ConfigurationStoreId) + if err != nil { + return nil, err + } if client == nil { // if the AppConfiguration is gone all the data will be too return utils.Bool(false), nil } - if err != nil { - return nil, err - } res, err := client.GetKeyValues(ctx, resourceID.Key, resourceID.Label, "", "", []string{}) if err != nil { diff --git a/internal/services/appconfiguration/app_configuration_keys_data_source.go b/internal/services/appconfiguration/app_configuration_keys_data_source.go index 7f78625aa36b..5d44d66fab35 100644 --- a/internal/services/appconfiguration/app_configuration_keys_data_source.go +++ b/internal/services/appconfiguration/app_configuration_keys_data_source.go @@ -8,7 +8,7 @@ import ( "time" "github.com/Azure/go-autorest/autorest" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -44,7 +44,7 @@ func (k KeysDataSource) Arguments() map[string]*pluginsdk.Schema { "configuration_store_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: azure.ValidateResourceID, + ValidateFunc: configurationstores.ValidateConfigurationStoreID, }, "key": { Type: pluginsdk.TypeString, @@ -137,12 +137,12 @@ func (k KeysDataSource) Read() sdk.ResourceFunc { // whereas the client expects a complete URI to be present and therefore fails to fetch all results if // store contains more than 100 entries client, err := metadata.Client.AppConfiguration.LinkWorkaroundDataPlaneClient(ctx, model.ConfigurationStoreId) - if client == nil { - return fmt.Errorf("building data plane client: app configuration %q was not found", model.ConfigurationStoreId) - } if err != nil { return err } + if client == nil { + return fmt.Errorf("building data plane client: app configuration %q was not found", model.ConfigurationStoreId) + } iter, err := client.GetKeyValuesComplete(ctx, decodedKey, model.Label, "", "", []string{}) if err != nil { diff --git a/internal/services/appconfiguration/app_configuration_resource.go b/internal/services/appconfiguration/app_configuration_resource.go index 485cb02fe4dd..062fb35563a3 100644 --- a/internal/services/appconfiguration/app_configuration_resource.go +++ b/internal/services/appconfiguration/app_configuration_resource.go @@ -438,7 +438,7 @@ func resourceAppConfigurationRead(d *pluginsdk.ResourceData, meta interface{}) e return fmt.Errorf("retrieving access keys for %s: %+v", *id, err) } - d.Set("name", id.ConfigStoreName) + d.Set("name", id.ConfigurationStoreName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { @@ -531,7 +531,7 @@ func resourceAppConfigurationDelete(d *pluginsdk.ResourceData, meta interface{}) } if meta.(*clients.Client).Features.AppConfiguration.PurgeSoftDeleteOnDestroy && softDeleteEnabled { - deletedId := deletedconfigurationstores.NewDeletedConfigurationStoreID(subscriptionId, existing.Model.Location, id.ConfigStoreName) + deletedId := deletedconfigurationstores.NewDeletedConfigurationStoreID(subscriptionId, existing.Model.Location, id.ConfigurationStoreName) // AppConfiguration with Purge Protection Enabled cannot be deleted unless done by Azure if purgeProtectionEnabled { @@ -542,20 +542,20 @@ func resourceAppConfigurationDelete(d *pluginsdk.ResourceData, meta interface{}) if deletedInfo.Model != nil && deletedInfo.Model.Properties != nil && deletedInfo.Model.Properties.DeletionDate != nil && deletedInfo.Model.Properties.ScheduledPurgeDate != nil { log.Printf("[DEBUG] The App Configuration %q has Purge Protection Enabled and was deleted on %q. Azure will purge this on %q", - id.ConfigStoreName, *deletedInfo.Model.Properties.DeletionDate, *deletedInfo.Model.Properties.ScheduledPurgeDate) + id.ConfigurationStoreName, *deletedInfo.Model.Properties.DeletionDate, *deletedInfo.Model.Properties.ScheduledPurgeDate) } else { - log.Printf("[DEBUG] The App Configuration %q has Purge Protection Enabled and will be purged automatically by Azure", id.ConfigStoreName) + log.Printf("[DEBUG] The App Configuration %q has Purge Protection Enabled and will be purged automatically by Azure", id.ConfigurationStoreName) } return nil } - log.Printf("[DEBUG] %q marked for purge - executing purge", id.ConfigStoreName) + log.Printf("[DEBUG] %q marked for purge - executing purge", id.ConfigurationStoreName) if err := deletedConfigurationStoresClient.ConfigurationStoresPurgeDeletedThenPoll(ctx, deletedId); err != nil { return fmt.Errorf("purging %s: %+v", *id, err) } // TODO: retry checkNameAvailability after deletion when SDK is ready, see https://github.com/Azure/AppConfiguration/issues/677 - log.Printf("[DEBUG] Purged AppConfiguration %q.", id.ConfigStoreName) + log.Printf("[DEBUG] Purged AppConfiguration %q.", id.ConfigurationStoreName) } return nil diff --git a/internal/services/appconfiguration/client/client.go b/internal/services/appconfiguration/client/client.go index e7fc0c42d39b..97d2b54869fb 100644 --- a/internal/services/appconfiguration/client/client.go +++ b/internal/services/appconfiguration/client/client.go @@ -8,6 +8,8 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores" "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/deletedconfigurationstores" + authWrapper "github.com/hashicorp/go-azure-sdk/sdk/auth/autorest" + "github.com/hashicorp/go-azure-sdk/sdk/environments" "github.com/hashicorp/terraform-provider-azurerm/internal/common" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/azuresdkhacks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/1.0/appconfiguration" @@ -16,7 +18,7 @@ import ( type Client struct { ConfigurationStoresClient *configurationstores.ConfigurationStoresClient DeletedConfigurationStoresClient *deletedconfigurationstores.DeletedConfigurationStoresClient - tokenFunc func(endpoint string) (autorest.Authorizer, error) + authorizerFunc common.ApiAuthorizerFunc configureClientFunc func(c *autorest.Client, authorizer autorest.Authorizer) } @@ -41,13 +43,16 @@ func (c Client) DataPlaneClient(ctx context.Context, configurationStoreId string } endpoint := *appConfig.Model.Properties.Endpoint - appConfigAuth, err := c.tokenFunc(endpoint) + + api := environments.NewApiEndpoint("AppConfiguration", endpoint, nil) + appConfigAuth, err := c.authorizerFunc(api) if err != nil { return nil, fmt.Errorf("obtaining auth token for %q: %+v", endpoint, err) } client := appconfiguration.NewWithoutDefaults("", endpoint) - c.configureClientFunc(&client.Client, appConfigAuth) + c.configureClientFunc(&client.Client, authWrapper.AutorestAuthorizer(appConfigAuth)) + return &client, nil } @@ -71,15 +76,16 @@ func (c Client) LinkWorkaroundDataPlaneClient(ctx context.Context, configuration return nil, fmt.Errorf("endpoint was nil") } - endpoint := *appConfig.Model.Properties.Endpoint - appConfigAuth, err := c.tokenFunc(endpoint) + api := environments.NewApiEndpoint("AppConfiguration", *appConfig.Model.Properties.Endpoint, nil) + appConfigAuth, err := c.authorizerFunc(api) if err != nil { - return nil, fmt.Errorf("obtaining auth token for %q: %+v", endpoint, err) + return nil, fmt.Errorf("obtaining auth token for %q: %+v", *appConfig.Model.Properties.Endpoint, err) } - client := appconfiguration.NewWithoutDefaults("", endpoint) - c.configureClientFunc(&client.Client, appConfigAuth) + client := appconfiguration.NewWithoutDefaults("", *appConfig.Model.Properties.Endpoint) + c.configureClientFunc(&client.Client, authWrapper.AutorestAuthorizer(appConfigAuth)) workaroundClient := azuresdkhacks.NewDataPlaneClient(client) + return &workaroundClient, nil } @@ -93,7 +99,7 @@ func NewClient(o *common.ClientOptions) *Client { return &Client{ ConfigurationStoresClient: &configurationStores, DeletedConfigurationStoresClient: &deletedConfigurationStores, - tokenFunc: o.TokenFunc, + authorizerFunc: o.Authorizers.AuthorizerFunc, configureClientFunc: o.ConfigureClient, } } diff --git a/internal/services/applicationinsights/application_insights_standard_webtests_resource.go b/internal/services/applicationinsights/application_insights_standard_webtests_resource.go index 931219b889e9..c224d9fc1cd2 100644 --- a/internal/services/applicationinsights/application_insights_standard_webtests_resource.go +++ b/internal/services/applicationinsights/application_insights_standard_webtests_resource.go @@ -10,11 +10,10 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" webtests "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-06-15/webtestsapis" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -152,8 +151,9 @@ func (ApplicationInsightsStandardWebTestResource) Arguments() map[string]*plugin // }, "ssl_cert_remaining_lifetime": { - Type: pluginsdk.TypeInt, - Optional: true, + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 365), }, "ssl_check_enabled": { @@ -624,14 +624,14 @@ func expandApplicationInsightsStandardWebTestValidations(input []interface{}, is // rules.IgnoreHTTPSStatusCode = utils.Bool(v) // } - // if URL https, sslCheck cannot be enabled + // if URL http, sslCheck cannot be enabled sslCheckEnabled := false if v, ok := validationsInput["ssl_check_enabled"].(bool); ok && isHttps { rules.SSLCheck = utils.Bool(v) sslCheckEnabled = true } // if sslCheck not enabled, SSLCertRemainingLifetimeCheck cannot be enabled - if v, ok := validationsInput["ssl_cert_remaining_lifetime"].(int); ok && sslCheckEnabled { + if v, ok := validationsInput["ssl_cert_remaining_lifetime"].(int); ok && v != 0 && sslCheckEnabled { rules.SSLCertRemainingLifetimeCheck = utils.Int64(int64(v)) } if contentValidation, ok := validationsInput["content"].([]interface{}); ok { @@ -644,7 +644,7 @@ func expandApplicationInsightsStandardWebTestValidations(input []interface{}, is func expandApplicationInsightsStandardWebTestContentValidations(input []interface{}) *webtests.WebTestPropertiesValidationRulesContentValidation { content := webtests.WebTestPropertiesValidationRulesContentValidation{} if len(input) == 0 { - return &content + return nil } contentInput := input[0].(map[string]interface{}) diff --git a/internal/services/applicationinsights/application_insights_standard_webtests_resource_test.go b/internal/services/applicationinsights/application_insights_standard_webtests_resource_test.go index 6e54a2240d23..0759bf6fc159 100644 --- a/internal/services/applicationinsights/application_insights_standard_webtests_resource_test.go +++ b/internal/services/applicationinsights/application_insights_standard_webtests_resource_test.go @@ -23,6 +23,15 @@ func TestAccApplicationInsightsStandardWebTest_basic(t *testing.T) { }) } +func TestAccApplicationInsightsStandardWebTest_sslCheck(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_application_insights_standard_web_test", "test") + testResource := ApplicationInsightsStandardWebTestResource{} + data.ResourceTest(t, testResource, []acceptance.TestStep{ + data.ApplyStep(testResource.sslCheckConfig, testResource), + data.ImportStep(), + }) +} + func TestAccApplicationInsightsStandardWebTest_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_application_insights_standard_web_test", "test") testResource := ApplicationInsightsStandardWebTestResource{} @@ -59,6 +68,45 @@ func (ApplicationInsightsStandardWebTestResource) Exists(ctx context.Context, cl return utils.Bool(resp.Model != nil && resp.Model.Properties != nil), nil } +func (ApplicationInsightsStandardWebTestResource) sslCheckConfig(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-appinsights-%d" + location = "%s" +} + +resource "azurerm_application_insights" "test" { + name = "acctestappinsights-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + application_type = "web" +} + +resource "azurerm_application_insights_standard_web_test" "test" { + name = "acctestappinsightswebtests-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + application_insights_id = azurerm_application_insights.test.id + geo_locations = ["us-tx-sn1-azr"] + + request { + url = "https://microsoft.com" + } + validation_rules { + ssl_check_enabled = true + } + + lifecycle { + ignore_changes = ["tags"] + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +} + func (ApplicationInsightsStandardWebTestResource) basicConfig(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/applicationinsights/application_insights_workbook_resource.go b/internal/services/applicationinsights/application_insights_workbook_resource.go index bcea33fdfe48..824c04379ed0 100644 --- a/internal/services/applicationinsights/application_insights_workbook_resource.go +++ b/internal/services/applicationinsights/application_insights_workbook_resource.go @@ -262,7 +262,7 @@ func (r ApplicationInsightsWorkbookResource) Read() sdk.ResourceFunc { } state := ApplicationInsightsWorkbookModel{ - Name: id.ResourceName, + Name: id.WorkbookName, ResourceGroupName: id.ResourceGroupName, Location: location.NormalizeNilable(model.Location), } diff --git a/internal/services/applicationinsights/application_insights_workbook_template_resource.go b/internal/services/applicationinsights/application_insights_workbook_template_resource.go index 520f4b8482fb..0bd28d1c0ce7 100644 --- a/internal/services/applicationinsights/application_insights_workbook_template_resource.go +++ b/internal/services/applicationinsights/application_insights_workbook_template_resource.go @@ -303,7 +303,7 @@ func (r ApplicationInsightsWorkbookTemplateResource) Read() sdk.ResourceFunc { } state := ApplicationInsightsWorkbookTemplateModel{ - Name: id.ResourceName, + Name: id.WorkbookTemplateName, ResourceGroupName: id.ResourceGroupName, Location: location.Normalize(model.Location), } diff --git a/internal/services/appservice/client/client.go b/internal/services/appservice/client/client.go index 042cae861682..8989bdfcd767 100644 --- a/internal/services/appservice/client/client.go +++ b/internal/services/appservice/client/client.go @@ -1,7 +1,7 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) diff --git a/internal/services/appservice/function_app_active_slot_resource.go b/internal/services/appservice/function_app_active_slot_resource.go index 5fb41759689c..71bc4824a28b 100644 --- a/internal/services/appservice/function_app_active_slot_resource.go +++ b/internal/services/appservice/function_app_active_slot_resource.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" diff --git a/internal/services/appservice/function_app_active_slot_resource_test.go b/internal/services/appservice/function_app_active_slot_resource_test.go index a9e59e1e47d6..3e0de1d52eab 100644 --- a/internal/services/appservice/function_app_active_slot_resource_test.go +++ b/internal/services/appservice/function_app_active_slot_resource_test.go @@ -162,7 +162,7 @@ resource "azurerm_windows_function_app_slot" "update" { site_config { application_stack { - dotnet_version = "6" + dotnet_version = "v6.0" } cors { @@ -368,7 +368,7 @@ resource "azurerm_windows_function_app" "test" { site_config { application_stack { - dotnet_version = "6" + dotnet_version = "v6.0" } cors { @@ -400,7 +400,7 @@ resource "azurerm_windows_function_app_slot" "test" { site_config { application_stack { - dotnet_version = "6" + dotnet_version = "v6.0" } cors { diff --git a/internal/services/appservice/function_app_function_resource.go b/internal/services/appservice/function_app_function_resource.go index 448912d93d77..4890b3cab51b 100644 --- a/internal/services/appservice/function_app_function_resource.go +++ b/internal/services/appservice/function_app_function_resource.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" @@ -479,7 +479,8 @@ func expandFunctionFiles(input []FunctionFiles) map[string]*string { } result := make(map[string]*string) for _, v := range input { - result[v.Name] = &v.Content + content := v.Content + result[v.Name] = &content } return result diff --git a/internal/services/appservice/function_app_function_resource_test.go b/internal/services/appservice/function_app_function_resource_test.go index d71d96e8deb0..25a12d32ef4b 100644 --- a/internal/services/appservice/function_app_function_resource_test.go +++ b/internal/services/appservice/function_app_function_resource_test.go @@ -311,7 +311,7 @@ resource "azurerm_windows_function_app" "test" { site_config { application_stack { - dotnet_version = "6" + dotnet_version = "v6.0" } } } diff --git a/internal/services/appservice/function_app_hybrid_connection_resource.go b/internal/services/appservice/function_app_hybrid_connection_resource.go index e7b4c957e830..a06a7ff5b03f 100644 --- a/internal/services/appservice/function_app_hybrid_connection_resource.go +++ b/internal/services/appservice/function_app_hybrid_connection_resource.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections" "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces" @@ -220,7 +220,7 @@ func (r FunctionAppHybridConnectionResource) Read() sdk.ResourceFunc { if appHybridConn.ServiceBusNamespace != "" && appHybridConn.SendKeyName != "" { relayNamespaceClient := metadata.Client.Relay.NamespacesClient - relayId, err := hybridconnections.ParseHybridConnectionID(appHybridConn.RelayId) + relayId, err := hybridconnections.ParseHybridConnectionIDInsensitively(appHybridConn.RelayId) if err != nil { return err } @@ -231,12 +231,7 @@ func (r FunctionAppHybridConnectionResource) Read() sdk.ResourceFunc { } hybridConnectionsClient := metadata.Client.Relay.HybridConnectionsClient - hybridConnectionID, err := hybridconnections.ParseHybridConnectionID(appHybridConn.RelayId) - if err != nil { - return err - } - - ruleID := hybridconnections.NewHybridConnectionAuthorizationRuleID(id.SubscriptionId, hybridConnectionID.ResourceGroupName, appHybridConn.ServiceBusNamespace, *existing.Name, appHybridConn.SendKeyName) + ruleID := hybridconnections.NewHybridConnectionAuthorizationRuleID(id.SubscriptionId, relayId.ResourceGroupName, appHybridConn.ServiceBusNamespace, *existing.Name, appHybridConn.SendKeyName) keys, err := hybridConnectionsClient.ListKeys(ctx, ruleID) if err != nil && keys.Model != nil { appHybridConn.SendKeyValue = utils.NormalizeNilableString(keys.Model.PrimaryKey) diff --git a/internal/services/appservice/helpers/auto_heal.go b/internal/services/appservice/helpers/auto_heal.go index e9ba58e5fc64..14aeb326d340 100644 --- a/internal/services/appservice/helpers/auto_heal.go +++ b/internal/services/appservice/helpers/auto_heal.go @@ -4,7 +4,7 @@ import ( "strconv" "strings" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" diff --git a/internal/services/appservice/helpers/common_web_app_schema.go b/internal/services/appservice/helpers/common_web_app_schema.go index f9768de89dcc..33f6094a8620 100644 --- a/internal/services/appservice/helpers/common_web_app_schema.go +++ b/internal/services/appservice/helpers/common_web_app_schema.go @@ -5,7 +5,7 @@ import ( "strconv" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/Azure/go-autorest/autorest/date" "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" diff --git a/internal/services/appservice/helpers/function_app_schema.go b/internal/services/appservice/helpers/function_app_schema.go index bb2839f57bef..04e80ba1febb 100644 --- a/internal/services/appservice/helpers/function_app_schema.go +++ b/internal/services/appservice/helpers/function_app_schema.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" @@ -1593,7 +1593,14 @@ func ExpandSiteConfigLinuxFunctionApp(siteConfig []SiteConfigLinuxFunctionApp, e appSettings = updateOrAppendAppSettings(appSettings, "DOCKER_REGISTRY_SERVER_URL", dockerConfig.RegistryURL, false) appSettings = updateOrAppendAppSettings(appSettings, "DOCKER_REGISTRY_SERVER_USERNAME", dockerConfig.RegistryUsername, false) appSettings = updateOrAppendAppSettings(appSettings, "DOCKER_REGISTRY_SERVER_PASSWORD", dockerConfig.RegistryPassword, false) - expanded.LinuxFxVersion = utils.String(fmt.Sprintf("DOCKER|%s/%s:%s", dockerConfig.RegistryURL, dockerConfig.ImageName, dockerConfig.ImageTag)) + var dockerUrl string + for _, prefix := range urlSchemes { + if strings.HasPrefix(dockerConfig.RegistryURL, prefix) { + dockerUrl = strings.TrimPrefix(dockerConfig.RegistryURL, prefix) + continue + } + } + expanded.LinuxFxVersion = utils.String(fmt.Sprintf("DOCKER|%s/%s:%s", dockerUrl, dockerConfig.ImageName, dockerConfig.ImageTag)) } } else { appSettings = updateOrAppendAppSettings(appSettings, "FUNCTIONS_WORKER_RUNTIME", "", true) diff --git a/internal/services/appservice/helpers/function_app_schema_test.go b/internal/services/appservice/helpers/function_app_schema_test.go index bfdbd8e3b4cb..3b55ec3dc57f 100644 --- a/internal/services/appservice/helpers/function_app_schema_test.go +++ b/internal/services/appservice/helpers/function_app_schema_test.go @@ -5,7 +5,7 @@ import ( "sort" "testing" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers" "github.com/hashicorp/terraform-provider-azurerm/utils" ) diff --git a/internal/services/appservice/helpers/function_app_slot_schema.go b/internal/services/appservice/helpers/function_app_slot_schema.go index 25995745a9b7..7527df565415 100644 --- a/internal/services/appservice/helpers/function_app_slot_schema.go +++ b/internal/services/appservice/helpers/function_app_slot_schema.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" apimValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" diff --git a/internal/services/appservice/helpers/fx_strings.go b/internal/services/appservice/helpers/fx_strings.go index b5a8180da6f8..b9e50a0c1d52 100644 --- a/internal/services/appservice/helpers/fx_strings.go +++ b/internal/services/appservice/helpers/fx_strings.go @@ -8,6 +8,13 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/utils" ) +var urlSchemes = []string{ + "https://", + "HTTPS://", + "http://", + "HTTP://", +} + func decodeApplicationStackLinux(fxString string) ApplicationStackLinux { parts := strings.Split(fxString, "|") result := ApplicationStackLinux{} @@ -114,7 +121,12 @@ func EncodeFunctionAppLinuxFxVersion(input []ApplicationStackLinuxFunctionApp) * appType = "DOCKER" dockerCfg := appStack.Docker[0] if dockerCfg.RegistryURL != "" { - appString = fmt.Sprintf("%s/%s:%s", strings.Trim(dockerCfg.RegistryURL, "/"), dockerCfg.ImageName, dockerCfg.ImageTag) + dockerUrl := dockerCfg.RegistryURL + httpPrefixes := []string{"https://", "http://"} + for _, prefix := range httpPrefixes { + dockerUrl = strings.TrimPrefix(dockerUrl, prefix) + } + appString = fmt.Sprintf("%s/%s:%s", dockerUrl, dockerCfg.ImageName, dockerCfg.ImageTag) } else { appString = fmt.Sprintf("%s:%s", dockerCfg.ImageName, dockerCfg.ImageTag) } @@ -183,7 +195,14 @@ func DecodeFunctionAppDockerFxString(input string, partial ApplicationStackDocke return nil, fmt.Errorf("expected a docker FX version, got %q", parts[0]) } - dockerParts := strings.Split(strings.TrimPrefix(parts[1], partial.RegistryURL), ":") + dockerUrl := partial.RegistryURL + for _, prefix := range urlSchemes { + if strings.HasPrefix(dockerUrl, prefix) { + dockerUrl = strings.TrimPrefix(dockerUrl, prefix) + continue + } + } + dockerParts := strings.Split(strings.TrimPrefix(parts[1], dockerUrl), ":") if len(dockerParts) != 2 { return nil, fmt.Errorf("invalid docker image reference %q", parts[1]) } diff --git a/internal/services/appservice/helpers/linux_web_app_schema.go b/internal/services/appservice/helpers/linux_web_app_schema.go index 56af60e5a14f..f7680e0d5cfd 100644 --- a/internal/services/appservice/helpers/linux_web_app_schema.go +++ b/internal/services/appservice/helpers/linux_web_app_schema.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" diff --git a/internal/services/appservice/helpers/publish_app.go b/internal/services/appservice/helpers/publish_app.go index 9f2e4ecd7e72..d82d2a1368b5 100644 --- a/internal/services/appservice/helpers/publish_app.go +++ b/internal/services/appservice/helpers/publish_app.go @@ -9,7 +9,7 @@ import ( "os" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/appservice/helpers/shared_schema.go b/internal/services/appservice/helpers/shared_schema.go index 9e2e0c7f54a3..a7551e549e75 100644 --- a/internal/services/appservice/helpers/shared_schema.go +++ b/internal/services/appservice/helpers/shared_schema.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" diff --git a/internal/services/appservice/helpers/web_app_slot_schema.go b/internal/services/appservice/helpers/web_app_slot_schema.go index ea4b9c39df1a..06b5a86bf054 100644 --- a/internal/services/appservice/helpers/web_app_slot_schema.go +++ b/internal/services/appservice/helpers/web_app_slot_schema.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" apimValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" @@ -660,9 +660,7 @@ func ExpandSiteConfigLinuxWebAppSlot(siteConfig []SiteConfigLinuxWebAppSlot, exi expanded.RemoteDebuggingVersion = pointer.To(linuxSlotSiteConfig.RemoteDebuggingVersion) } - if metadata.ResourceData.HasChange("site_config.0.use_32_bit_worker") { - expanded.Use32BitWorkerProcess = pointer.To(linuxSlotSiteConfig.Use32BitWorker) - } + expanded.Use32BitWorkerProcess = pointer.To(linuxSlotSiteConfig.Use32BitWorker) if metadata.ResourceData.HasChange("site_config.0.websockets_enabled") { expanded.WebSocketsEnabled = pointer.To(linuxSlotSiteConfig.WebSockets) @@ -968,9 +966,7 @@ func ExpandSiteConfigWindowsWebAppSlot(siteConfig []SiteConfigWindowsWebAppSlot, expanded.RemoteDebuggingVersion = pointer.To(winSlotSiteConfig.RemoteDebuggingVersion) } - if metadata.ResourceData.HasChange("site_config.0.use_32_bit_worker") { - expanded.Use32BitWorkerProcess = pointer.To(winSlotSiteConfig.Use32BitWorker) - } + expanded.Use32BitWorkerProcess = pointer.To(winSlotSiteConfig.Use32BitWorker) if metadata.ResourceData.HasChange("site_config.0.websockets_enabled") { expanded.WebSocketsEnabled = pointer.To(winSlotSiteConfig.WebSockets) diff --git a/internal/services/appservice/helpers/windows_web_app_schema.go b/internal/services/appservice/helpers/windows_web_app_schema.go index 48b0d423e5a3..54434657c160 100644 --- a/internal/services/appservice/helpers/windows_web_app_schema.go +++ b/internal/services/appservice/helpers/windows_web_app_schema.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse" diff --git a/internal/services/appservice/identity.go b/internal/services/appservice/identity.go index f1bbadb8ca11..87066434f8c0 100644 --- a/internal/services/appservice/identity.go +++ b/internal/services/appservice/identity.go @@ -1,7 +1,7 @@ package appservice import ( - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" ) diff --git a/internal/services/appservice/linux_function_app_data_source.go b/internal/services/appservice/linux_function_app_data_source.go index 8cc9f41b731c..b191d54b57a0 100644 --- a/internal/services/appservice/linux_function_app_data_source.go +++ b/internal/services/appservice/linux_function_app_data_source.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" diff --git a/internal/services/appservice/linux_function_app_resource.go b/internal/services/appservice/linux_function_app_resource.go index 972a9e5e3b95..45fb03e4dfc4 100644 --- a/internal/services/appservice/linux_function_app_resource.go +++ b/internal/services/appservice/linux_function_app_resource.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/google/uuid" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" @@ -315,6 +315,11 @@ func (r LinuxFunctionAppResource) Create() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + storageDomainSuffix, ok := metadata.Client.Account.Environment.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Storage domain suffix for environment %q", metadata.Client.Account.Environment.Name) + } + var functionApp LinuxFunctionAppModel if err := metadata.Decode(&functionApp); err != nil { @@ -396,7 +401,7 @@ func (r LinuxFunctionAppResource) Create() sdk.ResourceFunc { if functionApp.StorageKeyVaultSecretID != "" { storageString = fmt.Sprintf(helpers.StorageStringFmtKV, functionApp.StorageKeyVaultSecretID) } else { - storageString = fmt.Sprintf(helpers.StorageStringFmt, functionApp.StorageAccountName, functionApp.StorageAccountKey, metadata.Client.Account.Environment.StorageEndpointSuffix) + storageString = fmt.Sprintf(helpers.StorageStringFmt, functionApp.StorageAccountName, functionApp.StorageAccountKey, *storageDomainSuffix) } } @@ -719,6 +724,11 @@ func (r LinuxFunctionAppResource) Update() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + storageDomainSuffix, ok := metadata.Client.Account.Environment.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Storage domain suffix for environment %q", metadata.Client.Account.Environment.Name) + } + client := metadata.Client.AppService.WebAppsClient id, err := parse.FunctionAppID(metadata.ResourceData.Id()) @@ -810,7 +820,7 @@ func (r LinuxFunctionAppResource) Update() sdk.ResourceFunc { if state.StorageKeyVaultSecretID != "" { storageString = fmt.Sprintf(helpers.StorageStringFmtKV, state.StorageKeyVaultSecretID) } else { - storageString = fmt.Sprintf(helpers.StorageStringFmt, state.StorageAccountName, state.StorageAccountKey, metadata.Client.Account.Environment.StorageEndpointSuffix) + storageString = fmt.Sprintf(helpers.StorageStringFmt, state.StorageAccountName, state.StorageAccountKey, *storageDomainSuffix) } } diff --git a/internal/services/appservice/linux_function_app_resource_test.go b/internal/services/appservice/linux_function_app_resource_test.go index e080932ea600..f1c44af75057 100644 --- a/internal/services/appservice/linux_function_app_resource_test.go +++ b/internal/services/appservice/linux_function_app_resource_test.go @@ -2334,11 +2334,13 @@ resource "azurerm_linux_function_app" "test" { storage_account_access_key = azurerm_storage_account.test.primary_access_key site_config { + always_on = true + application_stack { docker { registry_url = "https://mcr.microsoft.com" - image_name = "azure-app-service/samples/aspnethelloworld" - image_tag = "latest" + image_name = "azure-functions/dotnet" + image_tag = "3.0-appservice-quickstart" } } } diff --git a/internal/services/appservice/linux_function_app_slot_resource.go b/internal/services/appservice/linux_function_app_slot_resource.go index def7d62d0075..3f16a353c36d 100644 --- a/internal/services/appservice/linux_function_app_slot_resource.go +++ b/internal/services/appservice/linux_function_app_slot_resource.go @@ -7,10 +7,12 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/google/uuid" + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" @@ -29,6 +31,7 @@ type LinuxFunctionAppSlotResource struct{} type LinuxFunctionAppSlotModel struct { Name string `tfschema:"name"` FunctionAppID string `tfschema:"function_app_id"` + ServicePlanID string `tfschema:"service_plan_id"` StorageAccountName string `tfschema:"storage_account_name"` StorageAccountKey string `tfschema:"storage_account_access_key"` StorageUsesMSI bool `tfschema:"storage_uses_managed_identity"` // Storage uses MSI not account key @@ -93,6 +96,12 @@ func (r LinuxFunctionAppSlotResource) Arguments() map[string]*pluginsdk.Schema { Description: "The ID of the Linux Function App this Slot is a member of.", }, + "service_plan_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validate.ServicePlanID, + }, + "storage_account_name": { Type: pluginsdk.TypeString, Optional: true, @@ -297,6 +306,11 @@ func (r LinuxFunctionAppSlotResource) Create() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + storageDomainSuffix, ok := metadata.Client.Account.Environment.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Storage domain suffix for environment %q", metadata.Client.Account.Environment.Name) + } + var functionAppSlot LinuxFunctionAppSlotModel if err := metadata.Decode(&functionAppSlot); err != nil { @@ -314,6 +328,7 @@ func (r LinuxFunctionAppSlotResource) Create() sdk.ResourceFunc { subscriptionId := metadata.Client.Account.SubscriptionId id := parse.NewFunctionAppSlotID(subscriptionId, functionAppId.ResourceGroup, functionAppId.SiteName, functionAppSlot.Name) + functionApp, err := client.Get(ctx, functionAppId.ResourceGroup, functionAppId.SiteName) if err != nil { return fmt.Errorf("retrieving parent Linux %s: %+v", *functionAppId, err) @@ -321,13 +336,22 @@ func (r LinuxFunctionAppSlotResource) Create() sdk.ResourceFunc { if functionApp.Location == nil { return fmt.Errorf("could not determine location for %s: %+v", id, err) } - props := functionApp.SiteProperties - if props == nil || props.ServerFarmID == nil { - return fmt.Errorf("could not determine Service Plan ID for %s: %+v", id, err) - } - servicePlanId, err := parse.ServicePlanID(*props.ServerFarmID) - if err != nil { - return err + + var servicePlanId *parse.ServicePlanId + if functionAppSlot.ServicePlanID != "" { + servicePlanId, err = parse.ServicePlanID(functionAppSlot.ServicePlanID) + if err != nil { + return err + } + } else { + if props := functionApp.SiteProperties; props == nil || props.ServerFarmID == nil { + return fmt.Errorf("could not determine Service Plan ID for %s: %+v", id, err) + } else { + servicePlanId, err = parse.ServicePlanID(*props.ServerFarmID) + if err != nil { + return err + } + } } servicePlan, err := servicePlanClient.Get(ctx, servicePlanId.ResourceGroup, servicePlanId.ServerfarmName) @@ -352,7 +376,7 @@ func (r LinuxFunctionAppSlotResource) Create() sdk.ResourceFunc { } availabilityRequest := web.ResourceNameAvailabilityRequest{ - Name: utils.String(fmt.Sprintf("%s-%s", id.SiteName, id.SlotName)), + Name: pointer.To(fmt.Sprintf("%s-%s", id.SiteName, id.SlotName)), Type: web.CheckNameResourceTypesMicrosoftWebsites, } @@ -376,8 +400,8 @@ func (r LinuxFunctionAppSlotResource) Create() sdk.ResourceFunc { } } - availabilityRequest.Name = utils.String(fmt.Sprintf("%s.%s", functionAppSlot.Name, nameSuffix)) - availabilityRequest.IsFqdn = utils.Bool(true) + availabilityRequest.Name = pointer.To(fmt.Sprintf("%s.%s", functionAppSlot.Name, nameSuffix)) + availabilityRequest.IsFqdn = pointer.To(true) } checkName, err := client.CheckNameAvailability(ctx, availabilityRequest) @@ -393,7 +417,7 @@ func (r LinuxFunctionAppSlotResource) Create() sdk.ResourceFunc { if functionAppSlot.StorageKeyVaultSecretID != "" { storageString = fmt.Sprintf(helpers.StorageStringFmtKV, functionAppSlot.StorageKeyVaultSecretID) } else { - storageString = fmt.Sprintf(helpers.StorageStringFmt, functionAppSlot.StorageAccountName, functionAppSlot.StorageAccountKey, metadata.Client.Account.Environment.StorageEndpointSuffix) + storageString = fmt.Sprintf(helpers.StorageStringFmt, functionAppSlot.StorageAccountName, functionAppSlot.StorageAccountKey, *storageDomainSuffix) } } siteConfig, err := helpers.ExpandSiteConfigLinuxFunctionAppSlot(functionAppSlot.SiteConfig, nil, metadata, functionAppSlot.FunctionExtensionsVersion, storageString, functionAppSlot.StorageUsesMSI) @@ -442,29 +466,29 @@ func (r LinuxFunctionAppSlotResource) Create() sdk.ResourceFunc { siteEnvelope := web.Site{ Location: functionApp.Location, Tags: tags.FromTypedObject(functionAppSlot.Tags), - Kind: utils.String("functionapp,linux"), + Kind: pointer.To("functionapp,linux"), Identity: expandedIdentity, SiteProperties: &web.SiteProperties{ - ServerFarmID: utils.String(servicePlanId.ID()), - Enabled: utils.Bool(functionAppSlot.Enabled), - HTTPSOnly: utils.Bool(functionAppSlot.HttpsOnly), + ServerFarmID: pointer.To(servicePlanId.ID()), + Enabled: pointer.To(functionAppSlot.Enabled), + HTTPSOnly: pointer.To(functionAppSlot.HttpsOnly), SiteConfig: siteConfig, - ClientCertEnabled: utils.Bool(functionAppSlot.ClientCertEnabled), + ClientCertEnabled: pointer.To(functionAppSlot.ClientCertEnabled), ClientCertMode: web.ClientCertMode(functionAppSlot.ClientCertMode), - DailyMemoryTimeQuota: utils.Int32(int32(functionAppSlot.DailyMemoryTimeQuota)), // TODO - Investigate, setting appears silently ignored on Linux Function Apps? + DailyMemoryTimeQuota: pointer.To(int32(functionAppSlot.DailyMemoryTimeQuota)), }, } if functionAppSlot.KeyVaultReferenceIdentityID != "" { - siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = utils.String(functionAppSlot.KeyVaultReferenceIdentityID) + siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = pointer.To(functionAppSlot.KeyVaultReferenceIdentityID) } if functionAppSlot.VirtualNetworkSubnetID != "" { - siteEnvelope.SiteProperties.VirtualNetworkSubnetID = utils.String(functionAppSlot.VirtualNetworkSubnetID) + siteEnvelope.SiteProperties.VirtualNetworkSubnetID = pointer.To(functionAppSlot.VirtualNetworkSubnetID) } if functionAppSlot.ClientCertExclusionPaths != "" { - siteEnvelope.ClientCertExclusionPaths = utils.String(functionAppSlot.ClientCertExclusionPaths) + siteEnvelope.ClientCertExclusionPaths = pointer.To(functionAppSlot.ClientCertExclusionPaths) } future, err := client.CreateOrUpdateSlot(ctx, id.ResourceGroup, id.SiteName, siteEnvelope, id.SlotName) @@ -601,15 +625,31 @@ func (r LinuxFunctionAppSlotResource) Read() sdk.ResourceFunc { state := LinuxFunctionAppSlotModel{ Name: id.SlotName, FunctionAppID: parse.NewFunctionAppID(id.SubscriptionId, id.ResourceGroup, id.SiteName).ID(), - Enabled: utils.NormaliseNilableBool(functionAppSlot.Enabled), + Enabled: pointer.From(functionAppSlot.Enabled), ClientCertMode: string(functionAppSlot.ClientCertMode), - ClientCertExclusionPaths: utils.NormalizeNilableString(functionAppSlot.ClientCertExclusionPaths), - DailyMemoryTimeQuota: int(utils.NormaliseNilableInt32(props.DailyMemoryTimeQuota)), + ClientCertExclusionPaths: pointer.From(functionAppSlot.ClientCertExclusionPaths), + DailyMemoryTimeQuota: int(pointer.From(props.DailyMemoryTimeQuota)), Tags: tags.ToTypedObject(functionAppSlot.Tags), - Kind: utils.NormalizeNilableString(functionAppSlot.Kind), - KeyVaultReferenceIdentityID: utils.NormalizeNilableString(props.KeyVaultReferenceIdentity), - CustomDomainVerificationId: utils.NormalizeNilableString(props.CustomDomainVerificationID), - DefaultHostname: utils.NormalizeNilableString(props.DefaultHostName), + Kind: pointer.From(functionAppSlot.Kind), + KeyVaultReferenceIdentityID: pointer.From(props.KeyVaultReferenceIdentity), + CustomDomainVerificationId: pointer.From(props.CustomDomainVerificationID), + DefaultHostname: pointer.From(props.DefaultHostName), + } + + functionApp, err := client.Get(ctx, id.ResourceGroup, id.SiteName) + if err != nil { + return fmt.Errorf("reading parent Function App for Linux %s: %+v", *id, err) + } + if functionApp.SiteProperties == nil || functionApp.SiteProperties.ServerFarmID == nil { + return fmt.Errorf("reading parent Function App Service Plan information for Linux %s: %+v", *id, err) + } + parentAppFarmId, err := parse.ServicePlanID(*functionApp.SiteProperties.ServerFarmID) + if err != nil { + return err + } + + if slotPlanId := props.ServerFarmID; slotPlanId != nil && parentAppFarmId.ID() != *slotPlanId { + state.ServicePlanID = *slotPlanId } configResp, err := client.GetConfigurationSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) @@ -637,10 +677,11 @@ func (r LinuxFunctionAppSlotResource) Read() sdk.ResourceFunc { state.StorageAccounts = helpers.FlattenStorageAccounts(storageAccounts) - state.HttpsOnly = utils.NormaliseNilableBool(functionAppSlot.HTTPSOnly) - state.ClientCertEnabled = utils.NormaliseNilableBool(functionAppSlot.ClientCertEnabled) + state.HttpsOnly = pointer.From(functionAppSlot.HTTPSOnly) - if subnetId := utils.NormalizeNilableString(props.VirtualNetworkSubnetID); subnetId != "" { + state.ClientCertEnabled = pointer.From(functionAppSlot.ClientCertEnabled) + + if subnetId := pointer.From(props.VirtualNetworkSubnetID); subnetId != "" { state.VirtualNetworkSubnetID = subnetId } @@ -687,6 +728,11 @@ func (r LinuxFunctionAppSlotResource) Update() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + storageDomainSuffix, ok := metadata.Client.Account.Environment.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Storage domain suffix for environment %q", metadata.Client.Account.Environment.Name) + } + client := metadata.Client.AppService.WebAppsClient id, err := parse.FunctionAppSlotID(metadata.ResourceData.Id()) @@ -709,18 +755,39 @@ func (r LinuxFunctionAppSlotResource) Update() sdk.ResourceFunc { return err } + if metadata.ResourceData.HasChange("service_plan_id") { + o, n := metadata.ResourceData.GetChange("service_plan_id") + oldPlan, err := parse.ServicePlanID(o.(string)) + if err != nil { + return err + } + + newPlan, err := parse.ServicePlanID(n.(string)) + if err != nil { + return err + } + locks.ByID(oldPlan.ID()) + defer locks.UnlockByID(oldPlan.ID()) + locks.ByID(newPlan.ID()) + defer locks.UnlockByID(newPlan.ID()) + if existing.SiteProperties == nil { + return fmt.Errorf("updating Service Plan for Linux %s: Slot SiteProperties was nil", *id) + } + existing.SiteProperties.ServerFarmID = pointer.To(newPlan.ID()) + } + sendContentSettings := helpers.PlanIsElastic(planSKU) && !state.ForceDisableContentShare if metadata.ResourceData.HasChange("enabled") { - existing.SiteProperties.Enabled = utils.Bool(state.Enabled) + existing.SiteProperties.Enabled = pointer.To(state.Enabled) } if metadata.ResourceData.HasChange("https_only") { - existing.SiteProperties.HTTPSOnly = utils.Bool(state.HttpsOnly) + existing.SiteProperties.HTTPSOnly = pointer.To(state.HttpsOnly) } if metadata.ResourceData.HasChange("client_certificate_enabled") { - existing.SiteProperties.ClientCertEnabled = utils.Bool(state.ClientCertEnabled) + existing.SiteProperties.ClientCertEnabled = pointer.To(state.ClientCertEnabled) } if metadata.ResourceData.HasChange("client_certificate_mode") { @@ -728,7 +795,7 @@ func (r LinuxFunctionAppSlotResource) Update() sdk.ResourceFunc { } if metadata.ResourceData.HasChange("client_certificate_exclusion_paths") { - existing.SiteProperties.ClientCertExclusionPaths = utils.String(state.ClientCertExclusionPaths) + existing.SiteProperties.ClientCertExclusionPaths = pointer.To(state.ClientCertExclusionPaths) } if metadata.ResourceData.HasChange("identity") { @@ -740,7 +807,7 @@ func (r LinuxFunctionAppSlotResource) Update() sdk.ResourceFunc { } if metadata.ResourceData.HasChange("key_vault_reference_identity_id") { - existing.KeyVaultReferenceIdentity = utils.String(state.KeyVaultReferenceIdentityID) + existing.KeyVaultReferenceIdentity = pointer.To(state.KeyVaultReferenceIdentityID) } if metadata.ResourceData.HasChange("tags") { @@ -756,7 +823,7 @@ func (r LinuxFunctionAppSlotResource) Update() sdk.ResourceFunc { var empty *string existing.SiteProperties.VirtualNetworkSubnetID = empty } else { - existing.SiteProperties.VirtualNetworkSubnetID = utils.String(subnetId) + existing.SiteProperties.VirtualNetworkSubnetID = pointer.To(subnetId) } } @@ -765,7 +832,7 @@ func (r LinuxFunctionAppSlotResource) Update() sdk.ResourceFunc { if state.StorageKeyVaultSecretID != "" { storageString = fmt.Sprintf(helpers.StorageStringFmtKV, state.StorageKeyVaultSecretID) } else { - storageString = fmt.Sprintf(helpers.StorageStringFmt, state.StorageAccountName, state.StorageAccountKey, metadata.Client.Account.Environment.StorageEndpointSuffix) + storageString = fmt.Sprintf(helpers.StorageStringFmt, state.StorageAccountName, state.StorageAccountKey, *storageDomainSuffix) } } @@ -882,17 +949,17 @@ func (m *LinuxFunctionAppSlotModel) unpackLinuxFunctionAppSettings(input web.Str for k, v := range input.Properties { switch k { case "FUNCTIONS_EXTENSION_VERSION": - m.FunctionExtensionsVersion = utils.NormalizeNilableString(v) + m.FunctionExtensionsVersion = pointer.From(v) case "WEBSITE_NODE_DEFAULT_VERSION": // Note - This is only set if it's not the default of 12, but we collect it from LinuxFxVersion so can discard it here case "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": if _, ok := metadata.ResourceData.GetOk("app_settings.WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"); ok { - appSettings[k] = utils.NormalizeNilableString(v) + appSettings[k] = pointer.From(v) } case "WEBSITE_CONTENTSHARE": if _, ok := metadata.ResourceData.GetOk("app_settings.WEBSITE_CONTENTSHARE"); ok { - appSettings[k] = utils.NormalizeNilableString(v) + appSettings[k] = pointer.From(v) } case "WEBSITE_HTTPLOGGING_RETENTION_DAYS": @@ -903,25 +970,25 @@ func (m *LinuxFunctionAppSlotModel) unpackLinuxFunctionAppSettings(input web.Str } } if _, ok := metadata.ResourceData.GetOk("app_settings.FUNCTIONS_WORKER_RUNTIME"); ok { - appSettings[k] = utils.NormalizeNilableString(v) + appSettings[k] = pointer.From(v) } case "DOCKER_REGISTRY_SERVER_URL": - dockerSettings.RegistryURL = utils.NormalizeNilableString(v) + dockerSettings.RegistryURL = pointer.From(v) case "DOCKER_REGISTRY_SERVER_USERNAME": - dockerSettings.RegistryUsername = utils.NormalizeNilableString(v) + dockerSettings.RegistryUsername = pointer.From(v) case "DOCKER_REGISTRY_SERVER_PASSWORD": - dockerSettings.RegistryPassword = utils.NormalizeNilableString(v) + dockerSettings.RegistryPassword = pointer.From(v) // case "WEBSITES_ENABLE_APP_SERVICE_STORAGE": // TODO - Support this as a configurable bool, default `false` - Ref: https://docs.microsoft.com/en-us/azure/app-service/faq-app-service-linux#i-m-using-my-own-custom-container--i-want-the-platform-to-mount-an-smb-share-to-the---home---directory- case "APPINSIGHTS_INSTRUMENTATIONKEY": - m.SiteConfig[0].AppInsightsInstrumentationKey = utils.NormalizeNilableString(v) + m.SiteConfig[0].AppInsightsInstrumentationKey = pointer.From(v) case "APPLICATIONINSIGHTS_CONNECTION_STRING": - m.SiteConfig[0].AppInsightsConnectionString = utils.NormalizeNilableString(v) + m.SiteConfig[0].AppInsightsConnectionString = pointer.From(v) case "AzureWebJobsStorage": if v != nil && strings.HasPrefix(*v, "@Microsoft.KeyVault") { @@ -935,26 +1002,26 @@ func (m *LinuxFunctionAppSlotModel) unpackLinuxFunctionAppSettings(input web.Str m.BuiltinLogging = true case "WEBSITE_HEALTHCHECK_MAXPINGFAILURES": - i, _ := strconv.Atoi(utils.NormalizeNilableString(v)) - m.SiteConfig[0].HealthCheckEvictionTime = utils.NormaliseNilableInt(&i) + i, _ := strconv.Atoi(pointer.From(v)) + m.SiteConfig[0].HealthCheckEvictionTime = pointer.From(&i) case "AzureWebJobsStorage__accountName": m.StorageUsesMSI = true - m.StorageAccountName = utils.NormalizeNilableString(v) + m.StorageAccountName = pointer.From(v) case "AzureWebJobsDashboard__accountName": m.BuiltinLogging = true case "WEBSITE_RUN_FROM_PACKAGE": if _, ok := metadata.ResourceData.GetOk("app_settings.WEBSITE_RUN_FROM_PACKAGE"); ok { - appSettings[k] = utils.NormalizeNilableString(v) + appSettings[k] = pointer.From(v) } case "WEBSITE_VNET_ROUTE_ALL": // Filter out - handled by site_config setting `vnet_route_all_enabled` default: - appSettings[k] = utils.NormalizeNilableString(v) + appSettings[k] = pointer.From(v) } } diff --git a/internal/services/appservice/linux_function_app_slot_resource_test.go b/internal/services/appservice/linux_function_app_slot_resource_test.go index 64c97c9858aa..00b4ce212a54 100644 --- a/internal/services/appservice/linux_function_app_slot_resource_test.go +++ b/internal/services/appservice/linux_function_app_slot_resource_test.go @@ -170,6 +170,46 @@ func TestAccLinuxFunctionAppSlot_withAppSettingsStandardPlan(t *testing.T) { }) } +func TestAccLinuxFunctionAppSlot_separateStandardPlan(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_linux_function_app_slot", "test") + r := LinuxFunctionAppSlotResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.separatePlan(data, SkuStandardPlan), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("kind").HasValue("functionapp,linux"), + ), + }, + data.ImportStep(), + }) +} + +func TestAccLinuxFunctionAppSlot_separateStandardPlanUpdate(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_linux_function_app_slot", "test") + r := LinuxFunctionAppSlotResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.separatePlan(data, SkuStandardPlan), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("kind").HasValue("functionapp,linux"), + ), + }, + data.ImportStep(), + { + Config: r.separatePlanUpdate(data, SkuStandardPlan), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("kind").HasValue("functionapp,linux"), + ), + }, + data.ImportStep(), + }) +} + func TestAccLinuxFunctionAppSlot_withAppSettingsUserSettingUpdate(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_linux_function_app_slot", "test") r := LinuxFunctionAppSlotResource{} @@ -2660,6 +2700,73 @@ resource "azurerm_linux_function_app_slot" "test" { `, r.identityTemplate(data, planSku), data.RandomString, data.RandomInteger) } +func (r LinuxFunctionAppSlotResource) separatePlan(data acceptance.TestData, planSku string) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_service_plan" "test2" { + name = "acctestASP2-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + os_type = "Linux" + sku_name = "%[3]s" +} + + +resource "azurerm_linux_function_app_slot" "test" { + name = "acctest-LFAS-%[2]d" + function_app_id = azurerm_linux_function_app.test.id + storage_account_name = azurerm_storage_account.test.name + storage_account_access_key = azurerm_storage_account.test.primary_access_key + + service_plan_id = azurerm_service_plan.test2.id + + site_config {} +} +`, r.template(data, planSku), data.RandomInteger, SkuStandardPlan) +} + +func (r LinuxFunctionAppSlotResource) separatePlanUpdate(data acceptance.TestData, planSku string) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_service_plan" "test2" { + name = "acctestASP2-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + os_type = "Linux" + sku_name = "%[3]s" +} + +resource "azurerm_service_plan" "test3" { + name = "acctestASP3-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + os_type = "Linux" + sku_name = "%[4]s" +} + +resource "azurerm_linux_function_app_slot" "test" { + name = "acctest-LFAS-%[2]d" + function_app_id = azurerm_linux_function_app.test.id + storage_account_name = azurerm_storage_account.test.name + storage_account_access_key = azurerm_storage_account.test.primary_access_key + + service_plan_id = azurerm_service_plan.test3.id + + site_config {} +} +`, r.template(data, planSku), data.RandomInteger, SkuStandardPlan, SkuPremiumPlan) +} + func (LinuxFunctionAppSlotResource) template(data acceptance.TestData, planSku string) string { var additionalConfig string if strings.EqualFold(planSku, "EP1") { diff --git a/internal/services/appservice/linux_web_app_resource.go b/internal/services/appservice/linux_web_app_resource.go index 167a858cd5ba..87dd481ab9e2 100644 --- a/internal/services/appservice/linux_web_app_resource.go +++ b/internal/services/appservice/linux_web_app_resource.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" diff --git a/internal/services/appservice/linux_web_app_slot_resource.go b/internal/services/appservice/linux_web_app_slot_resource.go index 3a6f8c6dd629..c952189e6bd8 100644 --- a/internal/services/appservice/linux_web_app_slot_resource.go +++ b/internal/services/appservice/linux_web_app_slot_resource.go @@ -7,9 +7,11 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" @@ -26,6 +28,7 @@ type LinuxWebAppSlotResource struct{} type LinuxWebAppSlotModel struct { Name string `tfschema:"name"` AppServiceId string `tfschema:"app_service_id"` + ServicePlanID string `tfschema:"service_plan_id"` AppSettings map[string]string `tfschema:"app_settings"` AuthSettings []helpers.AuthSettings `tfschema:"auth_settings"` Backup []helpers.Backup `tfschema:"backup"` @@ -85,6 +88,12 @@ func (r LinuxWebAppSlotResource) Arguments() map[string]*pluginsdk.Schema { // Optional + "service_plan_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validate.ServicePlanID, + }, + "app_settings": { Type: pluginsdk.TypeMap, Optional: true, @@ -250,12 +259,26 @@ func (r LinuxWebAppSlotResource) Create() sdk.ResourceFunc { if err != nil { return fmt.Errorf("reading parent Linux Web App for %s: %+v", id, err) } + if webApp.Location == nil { return fmt.Errorf("could not determine location for %s: %+v", id, err) } - siteProps := webApp.SiteProperties - if siteProps == nil || siteProps.ServerFarmID == nil { - return fmt.Errorf("could not determine Service Plan ID for %s: %+v", id, err) + + var servicePlanId *parse.ServicePlanId + if webAppSlot.ServicePlanID != "" { + servicePlanId, err = parse.ServicePlanID(webAppSlot.ServicePlanID) + if err != nil { + return err + } + } else { + if props := webApp.SiteProperties; props == nil || props.ServerFarmID == nil { + return fmt.Errorf("could not determine Service Plan ID for %s: %+v", id, err) + } else { + servicePlanId, err = parse.ServicePlanID(*props.ServerFarmID) + if err != nil { + return err + } + } } existing, err := client.GetSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) @@ -284,26 +307,26 @@ func (r LinuxWebAppSlotResource) Create() sdk.ResourceFunc { Identity: expandedIdentity, Tags: tags.FromTypedObject(webAppSlot.Tags), SiteProperties: &web.SiteProperties{ - ServerFarmID: siteProps.ServerFarmID, - Enabled: utils.Bool(webAppSlot.Enabled), - HTTPSOnly: utils.Bool(webAppSlot.HttpsOnly), + ServerFarmID: pointer.To(servicePlanId.ID()), + Enabled: pointer.To(webAppSlot.Enabled), + HTTPSOnly: pointer.To(webAppSlot.HttpsOnly), SiteConfig: siteConfig, - ClientAffinityEnabled: utils.Bool(webAppSlot.ClientAffinityEnabled), - ClientCertEnabled: utils.Bool(webAppSlot.ClientCertEnabled), + ClientAffinityEnabled: pointer.To(webAppSlot.ClientAffinityEnabled), + ClientCertEnabled: pointer.To(webAppSlot.ClientCertEnabled), ClientCertMode: web.ClientCertMode(webAppSlot.ClientCertMode), }, } if webAppSlot.VirtualNetworkSubnetID != "" { - siteEnvelope.SiteProperties.VirtualNetworkSubnetID = utils.String(webAppSlot.VirtualNetworkSubnetID) + siteEnvelope.SiteProperties.VirtualNetworkSubnetID = pointer.To(webAppSlot.VirtualNetworkSubnetID) } if webAppSlot.KeyVaultReferenceIdentityID != "" { - siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = utils.String(webAppSlot.KeyVaultReferenceIdentityID) + siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = pointer.To(webAppSlot.KeyVaultReferenceIdentityID) } if webAppSlot.ClientCertExclusionPaths != "" { - siteEnvelope.ClientCertExclusionPaths = utils.String(webAppSlot.ClientCertExclusionPaths) + siteEnvelope.ClientCertExclusionPaths = pointer.To(webAppSlot.ClientCertExclusionPaths) } future, err := client.CreateOrUpdateSlot(ctx, id.ResourceGroup, id.SiteName, siteEnvelope, id.SlotName) @@ -319,7 +342,7 @@ func (r LinuxWebAppSlotResource) Create() sdk.ResourceFunc { appSettings := helpers.ExpandAppSettingsForUpdate(webAppSlot.AppSettings) if metadata.ResourceData.HasChange("site_config.0.health_check_eviction_time_in_min") { - appSettings.Properties["WEBSITE_HEALTHCHECK_MAXPINGFAILURES"] = utils.String(strconv.Itoa(webAppSlot.SiteConfig[0].HealthCheckEvictionTime)) + appSettings.Properties["WEBSITE_HEALTHCHECK_MAXPINGFAILURES"] = pointer.To(strconv.Itoa(webAppSlot.SiteConfig[0].HealthCheckEvictionTime)) } if appSettings.Properties != nil { @@ -390,15 +413,16 @@ func (r LinuxWebAppSlotResource) Read() sdk.ResourceFunc { if err != nil { return err } - webApp, err := client.GetSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) + + webAppSlot, err := client.GetSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) if err != nil { - if utils.ResponseWasNotFound(webApp.Response) { + if utils.ResponseWasNotFound(webAppSlot.Response) { return metadata.MarkAsGone(id) } return fmt.Errorf("reading Linux %s: %+v", id, err) } - props := webApp.SiteProperties + props := webAppSlot.SiteProperties if props == nil { return fmt.Errorf("reading properties of Linux %s", id) } @@ -457,20 +481,36 @@ func (r LinuxWebAppSlotResource) Read() sdk.ResourceFunc { state := LinuxWebAppSlotModel{ Name: id.SlotName, AppServiceId: parse.NewWebAppID(id.SubscriptionId, id.ResourceGroup, id.SiteName).ID(), - ClientAffinityEnabled: utils.NormaliseNilableBool(props.ClientAffinityEnabled), - ClientCertEnabled: utils.NormaliseNilableBool(props.ClientCertEnabled), + ClientAffinityEnabled: pointer.From(props.ClientAffinityEnabled), + ClientCertEnabled: pointer.From(props.ClientCertEnabled), ClientCertMode: string(props.ClientCertMode), - ClientCertExclusionPaths: utils.NormalizeNilableString(props.ClientCertExclusionPaths), - CustomDomainVerificationId: utils.NormalizeNilableString(props.CustomDomainVerificationID), - DefaultHostname: utils.NormalizeNilableString(props.DefaultHostName), - Kind: utils.NormalizeNilableString(webApp.Kind), - KeyVaultReferenceIdentityID: utils.NormalizeNilableString(props.KeyVaultReferenceIdentity), - Enabled: utils.NormaliseNilableBool(props.Enabled), - HttpsOnly: utils.NormaliseNilableBool(props.HTTPSOnly), - Tags: tags.ToTypedObject(webApp.Tags), + ClientCertExclusionPaths: pointer.From(props.ClientCertExclusionPaths), + CustomDomainVerificationId: pointer.From(props.CustomDomainVerificationID), + DefaultHostname: pointer.From(props.DefaultHostName), + Kind: pointer.From(webAppSlot.Kind), + KeyVaultReferenceIdentityID: pointer.From(props.KeyVaultReferenceIdentity), + Enabled: pointer.From(props.Enabled), + HttpsOnly: pointer.From(props.HTTPSOnly), + Tags: tags.ToTypedObject(webAppSlot.Tags), + } + + webApp, err := client.Get(ctx, id.ResourceGroup, id.SiteName) + if err != nil { + return fmt.Errorf("reading parent Web App for Linux %s: %+v", *id, err) + } + if webApp.SiteProperties == nil || webApp.SiteProperties.ServerFarmID == nil { + return fmt.Errorf("reading parent Function App Service Plan information for Linux %s: %+v", *id, err) + } + parentAppFarmId, err := parse.ServicePlanID(*webApp.SiteProperties.ServerFarmID) + if err != nil { + return err } - if subnetId := utils.NormalizeNilableString(props.VirtualNetworkSubnetID); subnetId != "" { + if slotPlanId := props.ServerFarmID; slotPlanId != nil && parentAppFarmId.ID() != *slotPlanId { + state.ServicePlanID = *slotPlanId + } + + if subnetId := pointer.From(props.VirtualNetworkSubnetID); subnetId != "" { state.VirtualNetworkSubnetID = subnetId } @@ -513,7 +553,7 @@ func (r LinuxWebAppSlotResource) Read() sdk.ResourceFunc { return fmt.Errorf("encoding: %+v", err) } - flattenedIdentity, err := flattenIdentity(webApp.Identity) + flattenedIdentity, err := flattenIdentity(webAppSlot.Identity) if err != nil { return fmt.Errorf("flattening `identity`: %+v", err) } @@ -559,8 +599,6 @@ func (r LinuxWebAppSlotResource) Update() sdk.ResourceFunc { return err } - // TODO - Need locking here for source control meta resource? - var state LinuxWebAppSlotModel if err := metadata.Decode(&state); err != nil { return fmt.Errorf("decoding: %+v", err) @@ -571,23 +609,44 @@ func (r LinuxWebAppSlotResource) Update() sdk.ResourceFunc { return fmt.Errorf("reading Linux %s: %v", id, err) } + if metadata.ResourceData.HasChange("service_plan_id") { + o, n := metadata.ResourceData.GetChange("service_plan_id") + oldPlan, err := parse.ServicePlanID(o.(string)) + if err != nil { + return err + } + + newPlan, err := parse.ServicePlanID(n.(string)) + if err != nil { + return err + } + locks.ByID(oldPlan.ID()) + defer locks.UnlockByID(oldPlan.ID()) + locks.ByID(newPlan.ID()) + defer locks.UnlockByID(newPlan.ID()) + if existing.SiteProperties == nil { + return fmt.Errorf("updating Service Plan for Linux %s: Slot SiteProperties was nil", *id) + } + existing.SiteProperties.ServerFarmID = pointer.To(newPlan.ID()) + } + if metadata.ResourceData.HasChange("enabled") { - existing.SiteProperties.Enabled = utils.Bool(state.Enabled) + existing.SiteProperties.Enabled = pointer.To(state.Enabled) } if metadata.ResourceData.HasChange("https_only") { - existing.SiteProperties.HTTPSOnly = utils.Bool(state.HttpsOnly) + existing.SiteProperties.HTTPSOnly = pointer.To(state.HttpsOnly) } if metadata.ResourceData.HasChange("client_affinity_enabled") { - existing.SiteProperties.ClientAffinityEnabled = utils.Bool(state.ClientAffinityEnabled) + existing.SiteProperties.ClientAffinityEnabled = pointer.To(state.ClientAffinityEnabled) } if metadata.ResourceData.HasChange("client_certificate_enabled") { - existing.SiteProperties.ClientCertEnabled = utils.Bool(state.ClientCertEnabled) + existing.SiteProperties.ClientCertEnabled = pointer.To(state.ClientCertEnabled) } if metadata.ResourceData.HasChange("client_certificate_mode") { existing.SiteProperties.ClientCertMode = web.ClientCertMode(state.ClientCertMode) } if metadata.ResourceData.HasChange("client_certificate_exclusion_paths") { - existing.SiteProperties.ClientCertExclusionPaths = utils.String(state.ClientCertExclusionPaths) + existing.SiteProperties.ClientCertExclusionPaths = pointer.To(state.ClientCertExclusionPaths) } if metadata.ResourceData.HasChange("identity") { @@ -599,7 +658,7 @@ func (r LinuxWebAppSlotResource) Update() sdk.ResourceFunc { } if metadata.ResourceData.HasChange("key_vault_reference_identity_id") { - existing.KeyVaultReferenceIdentity = utils.String(state.KeyVaultReferenceIdentityID) + existing.KeyVaultReferenceIdentity = pointer.To(state.KeyVaultReferenceIdentityID) } if metadata.ResourceData.HasChange("tags") { @@ -623,7 +682,7 @@ func (r LinuxWebAppSlotResource) Update() sdk.ResourceFunc { var empty *string existing.SiteProperties.VirtualNetworkSubnetID = empty } else { - existing.SiteProperties.VirtualNetworkSubnetID = utils.String(subnetId) + existing.SiteProperties.VirtualNetworkSubnetID = pointer.To(subnetId) } } @@ -638,7 +697,7 @@ func (r LinuxWebAppSlotResource) Update() sdk.ResourceFunc { // (@jackofallops) - App Settings can clobber logs configuration so must be updated before we send any Log updates if metadata.ResourceData.HasChange("app_settings") || metadata.ResourceData.HasChange("site_config.0.health_check_eviction_time_in_min") { appSettingsUpdate := helpers.ExpandAppSettingsForUpdate(state.AppSettings) - appSettingsUpdate.Properties["WEBSITE_HEALTHCHECK_MAXPINGFAILURES"] = utils.String(strconv.Itoa(state.SiteConfig[0].HealthCheckEvictionTime)) + appSettingsUpdate.Properties["WEBSITE_HEALTHCHECK_MAXPINGFAILURES"] = pointer.To(strconv.Itoa(state.SiteConfig[0].HealthCheckEvictionTime)) if _, err := client.UpdateApplicationSettingsSlot(ctx, id.ResourceGroup, id.SiteName, *appSettingsUpdate, id.SlotName); err != nil { return fmt.Errorf("updating App Settings for Linux %s: %+v", id, err) diff --git a/internal/services/appservice/linux_web_app_slot_resource_test.go b/internal/services/appservice/linux_web_app_slot_resource_test.go index a8d06dbffaa1..07f7e979c1eb 100644 --- a/internal/services/appservice/linux_web_app_slot_resource_test.go +++ b/internal/services/appservice/linux_web_app_slot_resource_test.go @@ -60,6 +60,43 @@ func TestAccLinuxWebAppSlot_autoSwap(t *testing.T) { }) } +func TestAccLinuxWebAppSlot_separateStandardPlan(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_linux_web_app_slot", "test") + r := LinuxWebAppSlotResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.separatePlan(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccLinuxWebAppSlot_separateStandardPlanUpdate(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_linux_web_app_slot", "test") + r := LinuxWebAppSlotResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.separatePlan(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.separatePlanUpdate(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + // Complete func TestAccLinuxWebAppSlot_complete(t *testing.T) { @@ -2155,6 +2192,68 @@ resource "azurerm_linux_web_app_slot" "test" { `, r.baseTemplate(data), data.RandomInteger) } +func (r LinuxWebAppSlotResource) separatePlan(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_service_plan" "test2" { + name = "acctestASP2-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + os_type = "Linux" + sku_name = "%[3]s" +} + +resource "azurerm_linux_web_app_slot" "test" { + name = "acctestWAS-%[2]d" + app_service_id = azurerm_linux_web_app.test.id + + service_plan_id = azurerm_service_plan.test2.id + + site_config {} +} +`, r.baseTemplate(data), data.RandomInteger, SkuStandardPlan) +} + +func (r LinuxWebAppSlotResource) separatePlanUpdate(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_service_plan" "test2" { + name = "acctestASP2-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + os_type = "Linux" + sku_name = "%[3]s" +} + +resource "azurerm_service_plan" "test3" { + name = "acctestASP3-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + os_type = "Linux" + sku_name = "%[4]s" +} + +resource "azurerm_linux_web_app_slot" "test" { + name = "acctestWAS-%[2]d" + app_service_id = azurerm_linux_web_app.test3.id + + service_plan_id = azurerm_service_plan.test3.id + + site_config {} +} +`, r.baseTemplate(data), data.RandomInteger, SkuStandardPlan, SkuPremiumPlan) +} + // Templates func (LinuxWebAppSlotResource) baseTemplate(data acceptance.TestData) string { diff --git a/internal/services/appservice/resourceids.go b/internal/services/appservice/resourceids.go index 4973204ae2f0..59bc9661d039 100644 --- a/internal/services/appservice/resourceids.go +++ b/internal/services/appservice/resourceids.go @@ -4,7 +4,9 @@ package appservice //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=WebAppSlot -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1/slots/slot1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FunctionApp -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FunctionAppSlot -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1/slots/slot1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ServicePlan -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/serverfarms/farm1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AppServiceEnvironment -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/hostingEnvironments/hostingEnvironment1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FunctionAppFunction -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1/functions/function1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AppHybridConnection -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1/hybridConnectionNamespaces/hybridConnectionNamespace1/relays/relay1 + +// @tombuildsstuff: this Resource is going to need a State Migration `serverfarms` -> `serverFarms` +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ServicePlan -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/serverfarms/farm1 diff --git a/internal/services/appservice/service_plan_resource.go b/internal/services/appservice/service_plan_resource.go index d2a722f837d0..ea1ac70e0af5 100644 --- a/internal/services/appservice/service_plan_resource.go +++ b/internal/services/appservice/service_plan_resource.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" diff --git a/internal/services/appservice/source_control_resource.go b/internal/services/appservice/source_control_resource.go index ab8b2bc00b47..e58006c13379 100644 --- a/internal/services/appservice/source_control_resource.go +++ b/internal/services/appservice/source_control_resource.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate" diff --git a/internal/services/appservice/source_control_schema.go b/internal/services/appservice/source_control_schema.go index 20c5c9649943..43c59adafacc 100644 --- a/internal/services/appservice/source_control_schema.go +++ b/internal/services/appservice/source_control_schema.go @@ -1,7 +1,7 @@ package appservice import ( - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" diff --git a/internal/services/appservice/source_control_slot_resource.go b/internal/services/appservice/source_control_slot_resource.go index d4dc84e0248e..81e636e3315d 100644 --- a/internal/services/appservice/source_control_slot_resource.go +++ b/internal/services/appservice/source_control_slot_resource.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" diff --git a/internal/services/appservice/source_control_token_resource.go b/internal/services/appservice/source_control_token_resource.go index b74ddd96d98b..8f11e7c3b0c9 100644 --- a/internal/services/appservice/source_control_token_resource.go +++ b/internal/services/appservice/source_control_token_resource.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate" diff --git a/internal/services/appservice/web_app_active_slot_resource.go b/internal/services/appservice/web_app_active_slot_resource.go index 65a6d4a29f88..f6dd190f4a9f 100644 --- a/internal/services/appservice/web_app_active_slot_resource.go +++ b/internal/services/appservice/web_app_active_slot_resource.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" diff --git a/internal/services/appservice/web_app_hybrid_connection_resource.go b/internal/services/appservice/web_app_hybrid_connection_resource.go index f01b63fdea29..dfdc69a97e88 100644 --- a/internal/services/appservice/web_app_hybrid_connection_resource.go +++ b/internal/services/appservice/web_app_hybrid_connection_resource.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections" "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces" diff --git a/internal/services/appservice/windows_function_app_data_source.go b/internal/services/appservice/windows_function_app_data_source.go index 5cf2e0c42cac..1baeac03dfe6 100644 --- a/internal/services/appservice/windows_function_app_data_source.go +++ b/internal/services/appservice/windows_function_app_data_source.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" diff --git a/internal/services/appservice/windows_function_app_resource.go b/internal/services/appservice/windows_function_app_resource.go index 0e34b0a44650..25be0ec45e06 100644 --- a/internal/services/appservice/windows_function_app_resource.go +++ b/internal/services/appservice/windows_function_app_resource.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/google/uuid" "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" @@ -316,6 +316,11 @@ func (r WindowsFunctionAppResource) Create() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + storageDomainSuffix, ok := metadata.Client.Account.Environment.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Storage domain suffix for environment %q", metadata.Client.Account.Environment.Name) + } + var functionApp WindowsFunctionAppModel if err := metadata.Decode(&functionApp); err != nil { @@ -397,7 +402,7 @@ func (r WindowsFunctionAppResource) Create() sdk.ResourceFunc { if functionApp.StorageKeyVaultSecretID != "" { storageString = fmt.Sprintf(helpers.StorageStringFmtKV, functionApp.StorageKeyVaultSecretID) } else { - storageString = fmt.Sprintf(helpers.StorageStringFmt, functionApp.StorageAccountName, functionApp.StorageAccountKey, metadata.Client.Account.Environment.StorageEndpointSuffix) + storageString = fmt.Sprintf(helpers.StorageStringFmt, functionApp.StorageAccountName, functionApp.StorageAccountKey, *storageDomainSuffix) } } @@ -720,6 +725,11 @@ func (r WindowsFunctionAppResource) Update() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + storageDomainSuffix, ok := metadata.Client.Account.Environment.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Storage domain suffix for environment %q", metadata.Client.Account.Environment.Name) + } + client := metadata.Client.AppService.WebAppsClient id, err := parse.FunctionAppID(metadata.ResourceData.Id()) @@ -811,7 +821,7 @@ func (r WindowsFunctionAppResource) Update() sdk.ResourceFunc { if state.StorageKeyVaultSecretID != "" { storageString = fmt.Sprintf(helpers.StorageStringFmtKV, state.StorageKeyVaultSecretID) } else { - storageString = fmt.Sprintf(helpers.StorageStringFmt, state.StorageAccountName, state.StorageAccountKey, metadata.Client.Account.Environment.StorageEndpointSuffix) + storageString = fmt.Sprintf(helpers.StorageStringFmt, state.StorageAccountName, state.StorageAccountKey, *storageDomainSuffix) } } diff --git a/internal/services/appservice/windows_function_app_slot_resource.go b/internal/services/appservice/windows_function_app_slot_resource.go index 7576bf042e9e..c736a24c04cb 100644 --- a/internal/services/appservice/windows_function_app_slot_resource.go +++ b/internal/services/appservice/windows_function_app_slot_resource.go @@ -7,11 +7,12 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/google/uuid" "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" @@ -30,6 +31,7 @@ type WindowsFunctionAppSlotResource struct{} type WindowsFunctionAppSlotModel struct { Name string `tfschema:"name"` FunctionAppID string `tfschema:"function_app_id"` + ServicePlanID string `tfschema:"service_plan_id"` StorageAccountName string `tfschema:"storage_account_name"` StorageAccountKey string `tfschema:"storage_account_access_key"` StorageUsesMSI bool `tfschema:"storage_uses_managed_identity"` // Storage uses MSI not account key @@ -94,6 +96,12 @@ func (r WindowsFunctionAppSlotResource) Arguments() map[string]*pluginsdk.Schema Description: "The ID of the Windows Function App this Slot is a member of.", }, + "service_plan_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validate.ServicePlanID, + }, + "storage_account_name": { Type: pluginsdk.TypeString, Optional: true, @@ -305,6 +313,11 @@ func (r WindowsFunctionAppSlotResource) Create() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + storageDomainSuffix, ok := metadata.Client.Account.Environment.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Storage domain suffix for environment %q", metadata.Client.Account.Environment.Name) + } + var functionAppSlot WindowsFunctionAppSlotModel if err := metadata.Decode(&functionAppSlot); err != nil { @@ -322,6 +335,7 @@ func (r WindowsFunctionAppSlotResource) Create() sdk.ResourceFunc { subscriptionId := metadata.Client.Account.SubscriptionId id := parse.NewFunctionAppSlotID(subscriptionId, functionAppId.ResourceGroup, functionAppId.SiteName, functionAppSlot.Name) + functionApp, err := client.Get(ctx, functionAppId.ResourceGroup, functionAppId.SiteName) if err != nil { return fmt.Errorf("retrieving parent Windows %s: %+v", *functionAppId, err) @@ -329,15 +343,23 @@ func (r WindowsFunctionAppSlotResource) Create() sdk.ResourceFunc { if functionApp.Location == nil { return fmt.Errorf("could not determine location for %s: %+v", id, err) } - props := functionApp.SiteProperties - if props == nil || props.ServerFarmID == nil { - return fmt.Errorf("could not determine Service Plan ID for %s: %+v", id, err) - } - servicePlanId, err := parse.ServicePlanID(*props.ServerFarmID) - if err != nil { - return err - } + var servicePlanId *parse.ServicePlanId + if functionAppSlot.ServicePlanID != "" { + servicePlanId, err = parse.ServicePlanID(functionAppSlot.ServicePlanID) + if err != nil { + return err + } + } else { + if props := functionApp.SiteProperties; props == nil || props.ServerFarmID == nil { + return fmt.Errorf("could not determine Service Plan ID for %s: %+v", id, err) + } else { + servicePlanId, err = parse.ServicePlanID(*props.ServerFarmID) + if err != nil { + return err + } + } + } servicePlan, err := servicePlanClient.Get(ctx, servicePlanId.ResourceGroup, servicePlanId.ServerfarmName) if err != nil { return fmt.Errorf("reading %s: %+v", servicePlanId, err) @@ -362,7 +384,7 @@ func (r WindowsFunctionAppSlotResource) Create() sdk.ResourceFunc { } availabilityRequest := web.ResourceNameAvailabilityRequest{ - Name: utils.String(fmt.Sprintf("%s-%s", id.SiteName, id.SlotName)), + Name: pointer.To(fmt.Sprintf("%s-%s", id.SiteName, id.SlotName)), Type: web.CheckNameResourceTypesMicrosoftWebsites, } @@ -386,8 +408,8 @@ func (r WindowsFunctionAppSlotResource) Create() sdk.ResourceFunc { } } - availabilityRequest.Name = utils.String(fmt.Sprintf("%s.%s", functionAppSlot.Name, nameSuffix)) - availabilityRequest.IsFqdn = utils.Bool(true) + availabilityRequest.Name = pointer.To(fmt.Sprintf("%s.%s", functionAppSlot.Name, nameSuffix)) + availabilityRequest.IsFqdn = pointer.To(true) } checkName, err := client.CheckNameAvailability(ctx, availabilityRequest) @@ -403,7 +425,7 @@ func (r WindowsFunctionAppSlotResource) Create() sdk.ResourceFunc { if functionAppSlot.StorageKeyVaultSecretID != "" { storageString = fmt.Sprintf(helpers.StorageStringFmtKV, functionAppSlot.StorageKeyVaultSecretID) } else { - storageString = fmt.Sprintf(helpers.StorageStringFmt, functionAppSlot.StorageAccountName, functionAppSlot.StorageAccountKey, metadata.Client.Account.Environment.StorageEndpointSuffix) + storageString = fmt.Sprintf(helpers.StorageStringFmt, functionAppSlot.StorageAccountName, functionAppSlot.StorageAccountKey, *storageDomainSuffix) } } siteConfig, err := helpers.ExpandSiteConfigWindowsFunctionAppSlot(functionAppSlot.SiteConfig, nil, metadata, functionAppSlot.FunctionExtensionsVersion, storageString, functionAppSlot.StorageUsesMSI) @@ -451,29 +473,29 @@ func (r WindowsFunctionAppSlotResource) Create() sdk.ResourceFunc { siteEnvelope := web.Site{ Location: functionApp.Location, Tags: tags.FromTypedObject(functionAppSlot.Tags), - Kind: utils.String("functionapp"), + Kind: pointer.To("functionapp"), Identity: expandedIdentity, SiteProperties: &web.SiteProperties{ - ServerFarmID: utils.String(servicePlanId.ID()), - Enabled: utils.Bool(functionAppSlot.Enabled), - HTTPSOnly: utils.Bool(functionAppSlot.HttpsOnly), + ServerFarmID: pointer.To(servicePlanId.ID()), + Enabled: pointer.To(functionAppSlot.Enabled), + HTTPSOnly: pointer.To(functionAppSlot.HttpsOnly), SiteConfig: siteConfig, - ClientCertEnabled: utils.Bool(functionAppSlot.ClientCertEnabled), + ClientCertEnabled: pointer.To(functionAppSlot.ClientCertEnabled), ClientCertMode: web.ClientCertMode(functionAppSlot.ClientCertMode), - DailyMemoryTimeQuota: utils.Int32(int32(functionAppSlot.DailyMemoryTimeQuota)), + DailyMemoryTimeQuota: pointer.To(int32(functionAppSlot.DailyMemoryTimeQuota)), }, } if functionAppSlot.VirtualNetworkSubnetID != "" { - siteEnvelope.SiteProperties.VirtualNetworkSubnetID = utils.String(functionAppSlot.VirtualNetworkSubnetID) + siteEnvelope.SiteProperties.VirtualNetworkSubnetID = pointer.To(functionAppSlot.VirtualNetworkSubnetID) } if functionAppSlot.KeyVaultReferenceIdentityID != "" { - siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = utils.String(functionAppSlot.KeyVaultReferenceIdentityID) + siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = pointer.To(functionAppSlot.KeyVaultReferenceIdentityID) } if functionAppSlot.ClientCertExclusionPaths != "" { - siteEnvelope.ClientCertExclusionPaths = utils.String(functionAppSlot.ClientCertExclusionPaths) + siteEnvelope.ClientCertExclusionPaths = pointer.To(functionAppSlot.ClientCertExclusionPaths) } future, err := client.CreateOrUpdateSlot(ctx, id.ResourceGroup, id.SiteName, siteEnvelope, id.SlotName) @@ -549,18 +571,19 @@ func (r WindowsFunctionAppSlotResource) Read() sdk.ResourceFunc { if err != nil { return err } - functionApp, err := client.GetSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) + + functionAppSlot, err := client.GetSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) if err != nil { - if utils.ResponseWasNotFound(functionApp.Response) { + if utils.ResponseWasNotFound(functionAppSlot.Response) { return metadata.MarkAsGone(id) } return fmt.Errorf("reading Windows %s: %+v", id, err) } - if functionApp.SiteProperties == nil { + if functionAppSlot.SiteProperties == nil { return fmt.Errorf("reading properties of Windows %s", id) } - props := *functionApp.SiteProperties + props := *functionAppSlot.SiteProperties appSettingsResp, err := client.ListApplicationSettingsSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) if err != nil { @@ -610,15 +633,31 @@ func (r WindowsFunctionAppSlotResource) Read() sdk.ResourceFunc { state := WindowsFunctionAppSlotModel{ Name: id.SlotName, FunctionAppID: parse.NewFunctionAppID(id.SubscriptionId, id.ResourceGroup, id.SiteName).ID(), - Enabled: utils.NormaliseNilableBool(functionApp.Enabled), - ClientCertMode: string(functionApp.ClientCertMode), - ClientCertExclusionPaths: utils.NormalizeNilableString(functionApp.ClientCertExclusionPaths), - DailyMemoryTimeQuota: int(utils.NormaliseNilableInt32(props.DailyMemoryTimeQuota)), - Tags: tags.ToTypedObject(functionApp.Tags), - Kind: utils.NormalizeNilableString(functionApp.Kind), - KeyVaultReferenceIdentityID: utils.NormalizeNilableString(props.KeyVaultReferenceIdentity), - CustomDomainVerificationId: utils.NormalizeNilableString(props.CustomDomainVerificationID), - DefaultHostname: utils.NormalizeNilableString(props.DefaultHostName), + Enabled: pointer.From(functionAppSlot.Enabled), + ClientCertMode: string(functionAppSlot.ClientCertMode), + ClientCertExclusionPaths: pointer.From(functionAppSlot.ClientCertExclusionPaths), + DailyMemoryTimeQuota: int(pointer.From(props.DailyMemoryTimeQuota)), + Tags: tags.ToTypedObject(functionAppSlot.Tags), + Kind: pointer.From(functionAppSlot.Kind), + KeyVaultReferenceIdentityID: pointer.From(props.KeyVaultReferenceIdentity), + CustomDomainVerificationId: pointer.From(props.CustomDomainVerificationID), + DefaultHostname: pointer.From(props.DefaultHostName), + } + + functionApp, err := client.Get(ctx, id.ResourceGroup, id.SiteName) + if err != nil { + return fmt.Errorf("reading parent Function App for Linux %s: %+v", *id, err) + } + if functionApp.SiteProperties == nil || functionApp.SiteProperties.ServerFarmID == nil { + return fmt.Errorf("reading parent Function App Service Plan information for Linux %s: %+v", *id, err) + } + parentAppFarmId, err := parse.ServicePlanID(*functionApp.SiteProperties.ServerFarmID) + if err != nil { + return err + } + + if slotPlanId := props.ServerFarmID; slotPlanId != nil && parentAppFarmId.ID() != *slotPlanId { + state.ServicePlanID = *slotPlanId } configResp, err := client.GetConfigurationSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) @@ -646,10 +685,10 @@ func (r WindowsFunctionAppSlotResource) Read() sdk.ResourceFunc { state.StorageAccounts = helpers.FlattenStorageAccounts(storageAccounts) - state.HttpsOnly = utils.NormaliseNilableBool(functionApp.HTTPSOnly) - state.ClientCertEnabled = utils.NormaliseNilableBool(functionApp.ClientCertEnabled) + state.HttpsOnly = pointer.From(functionAppSlot.HTTPSOnly) + state.ClientCertEnabled = pointer.From(functionAppSlot.ClientCertEnabled) - if subnetId := utils.NormalizeNilableString(props.VirtualNetworkSubnetID); subnetId != "" { + if subnetId := pointer.From(props.VirtualNetworkSubnetID); subnetId != "" { state.VirtualNetworkSubnetID = subnetId } @@ -657,7 +696,7 @@ func (r WindowsFunctionAppSlotResource) Read() sdk.ResourceFunc { return fmt.Errorf("encoding: %+v", err) } - flattenedIdentity, err := flattenIdentity(functionApp.Identity) + flattenedIdentity, err := flattenIdentity(functionAppSlot.Identity) if err != nil { return fmt.Errorf("flattening `identity`: %+v", err) } @@ -698,6 +737,11 @@ func (r WindowsFunctionAppSlotResource) Update() sdk.ResourceFunc { Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.AppService.WebAppsClient + storageDomainSuffix, ok := metadata.Client.Account.Environment.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Storage domain suffix for environment %q", metadata.Client.Account.Environment.Name) + } + id, err := parse.FunctionAppSlotID(metadata.ResourceData.Id()) if err != nil { return err @@ -718,20 +762,41 @@ func (r WindowsFunctionAppSlotResource) Update() sdk.ResourceFunc { return err } + if metadata.ResourceData.HasChange("service_plan_id") { + o, n := metadata.ResourceData.GetChange("service_plan_id") + oldPlan, err := parse.ServicePlanID(o.(string)) + if err != nil { + return err + } + + newPlan, err := parse.ServicePlanID(n.(string)) + if err != nil { + return err + } + locks.ByID(oldPlan.ID()) + defer locks.UnlockByID(oldPlan.ID()) + locks.ByID(newPlan.ID()) + defer locks.UnlockByID(newPlan.ID()) + if existing.SiteProperties == nil { + return fmt.Errorf("updating Service Plan for Linux %s: Slot SiteProperties was nil", *id) + } + existing.SiteProperties.ServerFarmID = pointer.To(newPlan.ID()) + } + // Only send for Dynamic and ElasticPremium sendContentSettings := (helpers.PlanIsConsumption(planSKU) || helpers.PlanIsElastic(planSKU)) && !state.ForceDisableContentShare // Some service plan updates are allowed - see customiseDiff for exceptions if metadata.ResourceData.HasChange("enabled") { - existing.SiteProperties.Enabled = utils.Bool(state.Enabled) + existing.SiteProperties.Enabled = pointer.To(state.Enabled) } if metadata.ResourceData.HasChange("https_only") { - existing.SiteProperties.HTTPSOnly = utils.Bool(state.HttpsOnly) + existing.SiteProperties.HTTPSOnly = pointer.To(state.HttpsOnly) } if metadata.ResourceData.HasChange("client_certificate_enabled") { - existing.SiteProperties.ClientCertEnabled = utils.Bool(state.ClientCertEnabled) + existing.SiteProperties.ClientCertEnabled = pointer.To(state.ClientCertEnabled) } if metadata.ResourceData.HasChange("client_certificate_mode") { @@ -739,7 +804,7 @@ func (r WindowsFunctionAppSlotResource) Update() sdk.ResourceFunc { } if metadata.ResourceData.HasChange("client_certificate_exclusion_paths") { - existing.SiteProperties.ClientCertExclusionPaths = utils.String(state.ClientCertExclusionPaths) + existing.SiteProperties.ClientCertExclusionPaths = pointer.To(state.ClientCertExclusionPaths) } if metadata.ResourceData.HasChange("identity") { @@ -751,7 +816,7 @@ func (r WindowsFunctionAppSlotResource) Update() sdk.ResourceFunc { } if metadata.ResourceData.HasChange("key_vault_reference_identity_id") { - existing.KeyVaultReferenceIdentity = utils.String(state.KeyVaultReferenceIdentityID) + existing.KeyVaultReferenceIdentity = pointer.To(state.KeyVaultReferenceIdentityID) } if metadata.ResourceData.HasChange("tags") { @@ -767,7 +832,7 @@ func (r WindowsFunctionAppSlotResource) Update() sdk.ResourceFunc { var empty *string existing.SiteProperties.VirtualNetworkSubnetID = empty } else { - existing.SiteProperties.VirtualNetworkSubnetID = utils.String(subnetId) + existing.SiteProperties.VirtualNetworkSubnetID = pointer.To(subnetId) } } @@ -783,7 +848,7 @@ func (r WindowsFunctionAppSlotResource) Update() sdk.ResourceFunc { if state.StorageKeyVaultSecretID != "" { storageString = fmt.Sprintf(helpers.StorageStringFmtKV, state.StorageKeyVaultSecretID) } else { - storageString = fmt.Sprintf(helpers.StorageStringFmt, state.StorageAccountName, state.StorageAccountKey, metadata.Client.Account.Environment.StorageEndpointSuffix) + storageString = fmt.Sprintf(helpers.StorageStringFmt, state.StorageAccountName, state.StorageAccountKey, *storageDomainSuffix) } } @@ -890,7 +955,7 @@ func (m *WindowsFunctionAppSlotModel) unpackWindowsFunctionAppSettings(input web for k, v := range input.Properties { switch k { case "FUNCTIONS_EXTENSION_VERSION": - m.FunctionExtensionsVersion = utils.NormalizeNilableString(v) + m.FunctionExtensionsVersion = pointer.From(v) case "WEBSITE_NODE_DEFAULT_VERSION": if len(m.SiteConfig[0].ApplicationStack) == 0 { @@ -900,18 +965,18 @@ func (m *WindowsFunctionAppSlotModel) unpackWindowsFunctionAppSettings(input web case "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": if _, ok := metadata.ResourceData.GetOk("app_settings.WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"); ok { - appSettings[k] = utils.NormalizeNilableString(v) + appSettings[k] = pointer.From(v) } case "WEBSITE_CONTENTSHARE": if _, ok := metadata.ResourceData.GetOk("app_settings.WEBSITE_CONTENTSHARE"); ok { - appSettings[k] = utils.NormalizeNilableString(v) + appSettings[k] = pointer.From(v) } case "WEBSITE_HTTPLOGGING_RETENTION_DAYS": case "FUNCTIONS_WORKER_RUNTIME": if _, ok := metadata.ResourceData.GetOk("app_settings.FUNCTIONS_WORKER_RUNTIME"); ok { - appSettings[k] = utils.NormalizeNilableString(v) + appSettings[k] = pointer.From(v) } switch *v { case "dotnet-isolated": @@ -920,19 +985,19 @@ func (m *WindowsFunctionAppSlotModel) unpackWindowsFunctionAppSettings(input web m.SiteConfig[0].ApplicationStack[0].CustomHandler = true } case "DOCKER_REGISTRY_SERVER_URL": - dockerSettings.RegistryURL = utils.NormalizeNilableString(v) + dockerSettings.RegistryURL = pointer.From(v) case "DOCKER_REGISTRY_SERVER_USERNAME": - dockerSettings.RegistryUsername = utils.NormalizeNilableString(v) + dockerSettings.RegistryUsername = pointer.From(v) case "DOCKER_REGISTRY_SERVER_PASSWORD": - dockerSettings.RegistryPassword = utils.NormalizeNilableString(v) + dockerSettings.RegistryPassword = pointer.From(v) case "APPINSIGHTS_INSTRUMENTATIONKEY": - m.SiteConfig[0].AppInsightsInstrumentationKey = utils.NormalizeNilableString(v) + m.SiteConfig[0].AppInsightsInstrumentationKey = pointer.From(v) case "APPLICATIONINSIGHTS_CONNECTION_STRING": - m.SiteConfig[0].AppInsightsConnectionString = utils.NormalizeNilableString(v) + m.SiteConfig[0].AppInsightsConnectionString = pointer.From(v) case "AzureWebJobsStorage": if v != nil && strings.HasPrefix(*v, "@Microsoft.KeyVault") { @@ -945,12 +1010,12 @@ func (m *WindowsFunctionAppSlotModel) unpackWindowsFunctionAppSettings(input web m.BuiltinLogging = true case "WEBSITE_HEALTHCHECK_MAXPINGFAILURES": - i, _ := strconv.Atoi(utils.NormalizeNilableString(v)) - m.SiteConfig[0].HealthCheckEvictionTime = utils.NormaliseNilableInt(&i) + i, _ := strconv.Atoi(pointer.From(v)) + m.SiteConfig[0].HealthCheckEvictionTime = pointer.From(&i) case "AzureWebJobsStorage__accountName": m.StorageUsesMSI = true - m.StorageAccountName = utils.NormalizeNilableString(v) + m.StorageAccountName = pointer.From(v) case "AzureWebJobsDashboard__accountName": m.BuiltinLogging = true @@ -959,7 +1024,7 @@ func (m *WindowsFunctionAppSlotModel) unpackWindowsFunctionAppSettings(input web // Filter out - handled by site_config setting `vnet_route_all_enabled` default: - appSettings[k] = utils.NormalizeNilableString(v) + appSettings[k] = pointer.From(v) } } diff --git a/internal/services/appservice/windows_function_app_slot_resource_test.go b/internal/services/appservice/windows_function_app_slot_resource_test.go index 894c49c7e158..8b47c82fa189 100644 --- a/internal/services/appservice/windows_function_app_slot_resource_test.go +++ b/internal/services/appservice/windows_function_app_slot_resource_test.go @@ -186,6 +186,46 @@ func TestAccWindowsFunctionAppSlot_withCustomContentShareElasticPremiumPlan(t *t }) } +func TestAccWindowsFunctionAppSlot_separateStandardPlan(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_windows_function_app_slot", "test") + r := WindowsFunctionAppSlotResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.separatePlan(data, SkuStandardPlan), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("kind").HasValue("functionapp"), + ), + }, + data.ImportStep(), + }) +} + +func TestAccWindowsFunctionAppSlot_separateStandardPlanUpdate(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_windows_function_app_slot", "test") + r := WindowsFunctionAppSlotResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.separatePlan(data, SkuStandardPlan), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("kind").HasValue("functionapp"), + ), + }, + data.ImportStep(), + { + Config: r.separatePlanUpdate(data, SkuStandardPlan), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("kind").HasValue("functionapp"), + ), + }, + data.ImportStep(), + }) +} + func TestAccWindowsFunctionAppSlot_withAppSettingsUserSettingUpdate(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_windows_function_app_slot", "test") r := WindowsFunctionAppSlotResource{} @@ -2442,6 +2482,73 @@ resource "azurerm_windows_function_app_slot" "test" { `, r.identityTemplate(data, planSku), data.RandomString, data.RandomInteger) } +func (r WindowsFunctionAppSlotResource) separatePlan(data acceptance.TestData, planSku string) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_service_plan" "test2" { + name = "acctestASP2-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + os_type = "Windows" + sku_name = "%[3]s" +} + + +resource "azurerm_windows_function_app_slot" "test" { + name = "acctest-WFAS-%[2]d" + function_app_id = azurerm_windows_function_app.test.id + storage_account_name = azurerm_storage_account.test.name + storage_account_access_key = azurerm_storage_account.test.primary_access_key + + service_plan_id = azurerm_service_plan.test2.id + + site_config {} +} +`, r.template(data, planSku), data.RandomInteger, SkuStandardPlan) +} + +func (r WindowsFunctionAppSlotResource) separatePlanUpdate(data acceptance.TestData, planSku string) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_service_plan" "test2" { + name = "acctestASP2-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + os_type = "Windows" + sku_name = "%[3]s" +} + +resource "azurerm_service_plan" "test3" { + name = "acctestASP3-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + os_type = "Windows" + sku_name = "%[4]s" +} + +resource "azurerm_windows_function_app_slot" "test" { + name = "acctest-LFAS-%[2]d" + function_app_id = azurerm_windows_function_app.test.id + storage_account_name = azurerm_storage_account.test.name + storage_account_access_key = azurerm_storage_account.test.primary_access_key + + service_plan_id = azurerm_service_plan.test3.id + + site_config {} +} +`, r.template(data, planSku), data.RandomInteger, SkuStandardPlan, SkuPremiumPlan) +} + // Config Templates func (WindowsFunctionAppSlotResource) template(data acceptance.TestData, planSku string) string { diff --git a/internal/services/appservice/windows_web_app_resource.go b/internal/services/appservice/windows_web_app_resource.go index cf2de3f4ebab..9a4b8bb71ce5 100644 --- a/internal/services/appservice/windows_web_app_resource.go +++ b/internal/services/appservice/windows_web_app_resource.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" diff --git a/internal/services/appservice/windows_web_app_slot_resource.go b/internal/services/appservice/windows_web_app_slot_resource.go index 1201d412a800..127d34d59c7d 100644 --- a/internal/services/appservice/windows_web_app_slot_resource.go +++ b/internal/services/appservice/windows_web_app_slot_resource.go @@ -7,10 +7,11 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" @@ -27,6 +28,7 @@ type WindowsWebAppSlotResource struct{} type WindowsWebAppSlotModel struct { Name string `tfschema:"name"` AppServiceId string `tfschema:"app_service_id"` + ServicePlanID string `tfschema:"service_plan_id"` AppSettings map[string]string `tfschema:"app_settings"` AuthSettings []helpers.AuthSettings `tfschema:"auth_settings"` Backup []helpers.Backup `tfschema:"backup"` @@ -86,6 +88,12 @@ func (r WindowsWebAppSlotResource) Arguments() map[string]*pluginsdk.Schema { // Optional + "service_plan_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validate.ServicePlanID, + }, + "app_settings": { Type: pluginsdk.TypeMap, Optional: true, @@ -239,15 +247,29 @@ func (r WindowsWebAppSlotResource) Create() sdk.ResourceFunc { id := parse.NewWebAppSlotID(appId.SubscriptionId, appId.ResourceGroup, appId.SiteName, webAppSlot.Name) webApp, err := client.Get(ctx, appId.ResourceGroup, appId.SiteName) + if err != nil { return fmt.Errorf("reading parent Windows Web App for %s: %+v", id, err) } if webApp.Location == nil { return fmt.Errorf("could not determine location for %s: %+v", id, err) } - siteProps := webApp.SiteProperties - if siteProps == nil || siteProps.ServerFarmID == nil { - return fmt.Errorf("could not determine Service Plan ID for %s: %+v", id, err) + + var servicePlanId *parse.ServicePlanId + if webAppSlot.ServicePlanID != "" { + servicePlanId, err = parse.ServicePlanID(webAppSlot.ServicePlanID) + if err != nil { + return err + } + } else { + if props := webApp.SiteProperties; props == nil || props.ServerFarmID == nil { + return fmt.Errorf("could not determine Service Plan ID for %s: %+v", id, err) + } else { + servicePlanId, err = parse.ServicePlanID(*props.ServerFarmID) + if err != nil { + return err + } + } } existing, err := client.GetSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) @@ -282,23 +304,23 @@ func (r WindowsWebAppSlotResource) Create() sdk.ResourceFunc { Tags: tags.FromTypedObject(webAppSlot.Tags), Identity: expandedIdentity, SiteProperties: &web.SiteProperties{ - ServerFarmID: siteProps.ServerFarmID, - Enabled: utils.Bool(webAppSlot.Enabled), - HTTPSOnly: utils.Bool(webAppSlot.HttpsOnly), + ServerFarmID: pointer.To(servicePlanId.ID()), + Enabled: pointer.To(webAppSlot.Enabled), + HTTPSOnly: pointer.To(webAppSlot.HttpsOnly), SiteConfig: siteConfig, - ClientAffinityEnabled: utils.Bool(webAppSlot.ClientAffinityEnabled), - ClientCertEnabled: utils.Bool(webAppSlot.ClientCertEnabled), + ClientAffinityEnabled: pointer.To(webAppSlot.ClientAffinityEnabled), + ClientCertEnabled: pointer.To(webAppSlot.ClientCertEnabled), ClientCertMode: web.ClientCertMode(webAppSlot.ClientCertMode), - ClientCertExclusionPaths: utils.String(webAppSlot.ClientCertExclusionPaths), + ClientCertExclusionPaths: pointer.To(webAppSlot.ClientCertExclusionPaths), }, } if webAppSlot.KeyVaultReferenceIdentityID != "" { - siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = utils.String(webAppSlot.KeyVaultReferenceIdentityID) + siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = pointer.To(webAppSlot.KeyVaultReferenceIdentityID) } if webAppSlot.VirtualNetworkSubnetID != "" { - siteEnvelope.SiteProperties.VirtualNetworkSubnetID = utils.String(webAppSlot.VirtualNetworkSubnetID) + siteEnvelope.SiteProperties.VirtualNetworkSubnetID = pointer.To(webAppSlot.VirtualNetworkSubnetID) } future, err := client.CreateOrUpdateSlot(ctx, id.ResourceGroup, id.SiteName, siteEnvelope, id.SlotName) @@ -322,7 +344,7 @@ func (r WindowsWebAppSlotResource) Create() sdk.ResourceFunc { appSettings := helpers.ExpandAppSettingsForUpdate(webAppSlot.AppSettings) if metadata.ResourceData.HasChange("site_config.0.health_check_eviction_time_in_min") { - appSettings.Properties["WEBSITE_HEALTHCHECK_MAXPINGFAILURES"] = utils.String(strconv.Itoa(webAppSlot.SiteConfig[0].HealthCheckEvictionTime)) + appSettings.Properties["WEBSITE_HEALTHCHECK_MAXPINGFAILURES"] = pointer.To(strconv.Itoa(webAppSlot.SiteConfig[0].HealthCheckEvictionTime)) } if len(appSettings.Properties) > 0 { if _, err := client.UpdateApplicationSettingsSlot(ctx, id.ResourceGroup, id.SiteName, *appSettings, id.SlotName); err != nil { @@ -470,24 +492,40 @@ func (r WindowsWebAppSlotResource) Read() sdk.ResourceFunc { AppServiceId: parse.NewWebAppID(id.SubscriptionId, id.ResourceGroup, id.SiteName).ID(), AuthSettings: helpers.FlattenAuthSettings(auth), Backup: helpers.FlattenBackupConfig(backup), - ClientAffinityEnabled: utils.NormaliseNilableBool(props.ClientAffinityEnabled), - ClientCertEnabled: utils.NormaliseNilableBool(props.ClientCertEnabled), + ClientAffinityEnabled: pointer.From(props.ClientAffinityEnabled), + ClientCertEnabled: pointer.From(props.ClientCertEnabled), ClientCertMode: string(props.ClientCertMode), - ClientCertExclusionPaths: utils.NormalizeNilableString(props.ClientCertExclusionPaths), + ClientCertExclusionPaths: pointer.From(props.ClientCertExclusionPaths), ConnectionStrings: helpers.FlattenConnectionStrings(connectionStrings), - CustomDomainVerificationId: utils.NormalizeNilableString(props.CustomDomainVerificationID), - DefaultHostname: utils.NormalizeNilableString(props.DefaultHostName), - Enabled: utils.NormaliseNilableBool(props.Enabled), - HttpsOnly: utils.NormaliseNilableBool(props.HTTPSOnly), - KeyVaultReferenceIdentityID: utils.NormalizeNilableString(props.KeyVaultReferenceIdentity), - Kind: utils.NormalizeNilableString(webAppSlot.Kind), + CustomDomainVerificationId: pointer.From(props.CustomDomainVerificationID), + DefaultHostname: pointer.From(props.DefaultHostName), + Enabled: pointer.From(props.Enabled), + HttpsOnly: pointer.From(props.HTTPSOnly), + KeyVaultReferenceIdentityID: pointer.From(props.KeyVaultReferenceIdentity), + Kind: pointer.From(webAppSlot.Kind), LogsConfig: helpers.FlattenLogsConfig(logsConfig), SiteCredentials: helpers.FlattenSiteCredentials(siteCredentials), StorageAccounts: helpers.FlattenStorageAccounts(storageAccounts), Tags: tags.ToTypedObject(webAppSlot.Tags), } - if subnetId := utils.NormalizeNilableString(props.VirtualNetworkSubnetID); subnetId != "" { + webApp, err := client.Get(ctx, id.ResourceGroup, id.SiteName) + if err != nil { + return fmt.Errorf("reading parent Web App for Linux %s: %+v", *id, err) + } + if webApp.SiteProperties == nil || webApp.SiteProperties.ServerFarmID == nil { + return fmt.Errorf("reading parent Function App Service Plan information for Linux %s: %+v", *id, err) + } + parentAppFarmId, err := parse.ServicePlanID(*webApp.SiteProperties.ServerFarmID) + if err != nil { + return err + } + + if slotPlanId := props.ServerFarmID; slotPlanId != nil && parentAppFarmId.ID() != *slotPlanId { + state.ServicePlanID = *slotPlanId + } + + if subnetId := pointer.From(props.VirtualNetworkSubnetID); subnetId != "" { state.VirtualNetworkSubnetID = subnetId } @@ -516,10 +554,12 @@ func (r WindowsWebAppSlotResource) Read() sdk.ResourceFunc { state.SiteConfig = helpers.FlattenSiteConfigWindowsAppSlot(webAppSiteConfig.SiteConfig, currentStack, healthCheckCount) if nodeVer, ok := state.AppSettings["WEBSITE_NODE_DEFAULT_VERSION"]; ok { - if state.SiteConfig[0].ApplicationStack == nil { - state.SiteConfig[0].ApplicationStack = make([]helpers.ApplicationStackWindows, 0) + if nodeVer != "6.9.1" { + if state.SiteConfig[0].ApplicationStack == nil { + state.SiteConfig[0].ApplicationStack = make([]helpers.ApplicationStackWindows, 0) + } + state.SiteConfig[0].ApplicationStack[0].NodeVersion = nodeVer } - state.SiteConfig[0].ApplicationStack[0].NodeVersion = nodeVer delete(state.AppSettings, "WEBSITE_NODE_DEFAULT_VERSION") } @@ -578,8 +618,6 @@ func (r WindowsWebAppSlotResource) Update() sdk.ResourceFunc { return err } - // TODO - Need locking here for the source control meta resource? - var state WindowsWebAppSlotModel if err := metadata.Decode(&state); err != nil { return fmt.Errorf("decoding: %+v", err) @@ -590,23 +628,44 @@ func (r WindowsWebAppSlotResource) Update() sdk.ResourceFunc { return fmt.Errorf("reading Windows %s: %v", id, err) } + if metadata.ResourceData.HasChange("service_plan_id") { + o, n := metadata.ResourceData.GetChange("service_plan_id") + oldPlan, err := parse.ServicePlanID(o.(string)) + if err != nil { + return err + } + + newPlan, err := parse.ServicePlanID(n.(string)) + if err != nil { + return err + } + locks.ByID(oldPlan.ID()) + defer locks.UnlockByID(oldPlan.ID()) + locks.ByID(newPlan.ID()) + defer locks.UnlockByID(newPlan.ID()) + if existing.SiteProperties == nil { + return fmt.Errorf("updating Service Plan for Linux %s: Slot SiteProperties was nil", *id) + } + existing.SiteProperties.ServerFarmID = pointer.To(newPlan.ID()) + } + if metadata.ResourceData.HasChange("enabled") { - existing.SiteProperties.Enabled = utils.Bool(state.Enabled) + existing.SiteProperties.Enabled = pointer.To(state.Enabled) } if metadata.ResourceData.HasChange("https_only") { - existing.SiteProperties.HTTPSOnly = utils.Bool(state.HttpsOnly) + existing.SiteProperties.HTTPSOnly = pointer.To(state.HttpsOnly) } if metadata.ResourceData.HasChange("client_affinity_enabled") { - existing.SiteProperties.ClientAffinityEnabled = utils.Bool(state.ClientAffinityEnabled) + existing.SiteProperties.ClientAffinityEnabled = pointer.To(state.ClientAffinityEnabled) } if metadata.ResourceData.HasChange("client_certificate_enabled") { - existing.SiteProperties.ClientCertEnabled = utils.Bool(state.ClientCertEnabled) + existing.SiteProperties.ClientCertEnabled = pointer.To(state.ClientCertEnabled) } if metadata.ResourceData.HasChange("client_certificate_mode") { existing.SiteProperties.ClientCertMode = web.ClientCertMode(state.ClientCertMode) } if metadata.ResourceData.HasChange("client_certificate_exclusion_paths") { - existing.SiteProperties.ClientCertExclusionPaths = utils.String(state.ClientCertExclusionPaths) + existing.SiteProperties.ClientCertExclusionPaths = pointer.To(state.ClientCertExclusionPaths) } if metadata.ResourceData.HasChange("identity") { @@ -618,7 +677,7 @@ func (r WindowsWebAppSlotResource) Update() sdk.ResourceFunc { } if metadata.ResourceData.HasChange("key_vault_reference_identity_id") { - existing.KeyVaultReferenceIdentity = utils.String(state.KeyVaultReferenceIdentityID) + existing.KeyVaultReferenceIdentity = pointer.To(state.KeyVaultReferenceIdentityID) } if metadata.ResourceData.HasChange("tags") { @@ -649,7 +708,7 @@ func (r WindowsWebAppSlotResource) Update() sdk.ResourceFunc { var empty *string existing.SiteProperties.VirtualNetworkSubnetID = empty } else { - existing.SiteProperties.VirtualNetworkSubnetID = utils.String(subnetId) + existing.SiteProperties.VirtualNetworkSubnetID = pointer.To(subnetId) } } @@ -662,7 +721,7 @@ func (r WindowsWebAppSlotResource) Update() sdk.ResourceFunc { } siteMetadata := web.StringDictionary{Properties: map[string]*string{}} - siteMetadata.Properties["CURRENT_STACK"] = utils.String(currentStack) + siteMetadata.Properties["CURRENT_STACK"] = pointer.To(currentStack) if _, err := client.UpdateMetadataSlot(ctx, id.ResourceGroup, id.SiteName, siteMetadata, id.SlotName); err != nil { return fmt.Errorf("setting Site Metadata for Current Stack on Windows %s: %+v", id, err) } @@ -670,7 +729,7 @@ func (r WindowsWebAppSlotResource) Update() sdk.ResourceFunc { // (@jackofallops) - App Settings can clobber logs configuration so must be updated before we send any Log updates if metadata.ResourceData.HasChange("app_settings") || metadata.ResourceData.HasChange("site_config.0.health_check_eviction_time_in_min") || metadata.ResourceData.HasChange("site_config.0.application_stack.0.node_version") { appSettingsUpdate := helpers.ExpandAppSettingsForUpdate(state.AppSettings) - appSettingsUpdate.Properties["WEBSITE_HEALTHCHECK_MAXPINGFAILURES"] = utils.String(strconv.Itoa(state.SiteConfig[0].HealthCheckEvictionTime)) + appSettingsUpdate.Properties["WEBSITE_HEALTHCHECK_MAXPINGFAILURES"] = pointer.To(strconv.Itoa(state.SiteConfig[0].HealthCheckEvictionTime)) appSettingsUpdate.Properties["WEBSITE_NODE_DEFAULT_VERSION"] = pointer.To(state.SiteConfig[0].ApplicationStack[0].NodeVersion) if _, err := client.UpdateApplicationSettingsSlot(ctx, id.ResourceGroup, id.SiteName, *appSettingsUpdate, id.SlotName); err != nil { return fmt.Errorf("updating App Settings for Windows %s: %+v", id, err) diff --git a/internal/services/appservice/windows_web_app_slot_resource_test.go b/internal/services/appservice/windows_web_app_slot_resource_test.go index aa8fc580e88e..4b8fcdec9cf7 100644 --- a/internal/services/appservice/windows_web_app_slot_resource_test.go +++ b/internal/services/appservice/windows_web_app_slot_resource_test.go @@ -60,6 +60,43 @@ func TestAccWindowsWebAppSlot_autoSwap(t *testing.T) { }) } +func TestAccWidowsWebAppSlot_separateStandardPlan(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_windows_web_app_slot", "test") + r := WindowsWebAppSlotResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.separatePlan(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccWindowsWebAppSlot_separateStandardPlanUpdate(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_windows_web_app_slot", "test") + r := WindowsWebAppSlotResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.separatePlan(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.separatePlanUpdate(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + // Complete func TestAccWindowsWebAppSlot_complete(t *testing.T) { @@ -1888,6 +1925,66 @@ resource "azurerm_windows_web_app_slot" "test" { `, r.baseTemplate(data), data.RandomInteger) } +func (r WindowsWebAppSlotResource) separatePlan(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_service_plan" "test2" { + name = "acctestASP2-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + os_type = "Windows" + sku_name = "%[3]s" +} + +resource "azurerm_windows_web_app_slot" "test" { + name = "acctestWAS-%[2]d" + app_service_id = azurerm_windows_web_app.test2.id + + site_config {} +} +`, r.baseTemplate(data), data.RandomInteger, SkuStandardPlan) +} + +func (r WindowsWebAppSlotResource) separatePlanUpdate(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_service_plan" "test2" { + name = "acctestASP2-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + os_type = "Windows" + sku_name = "%[3]s" +} + +resource "azurerm_service_plan" "test3" { + name = "acctestASP3-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + os_type = "Windows" + sku_name = "%[4]s" +} + +resource "azurerm_windows_web_app_slot" "test" { + name = "acctestWAS-%[2]d" + app_service_id = azurerm_windows_web_app.test3.id + + service_plan_id = azurerm_service_plan.test3.id + + site_config {} +} +`, r.baseTemplate(data), data.RandomInteger, SkuStandardPlan, SkuPremiumPlan) +} + // Templates func (WindowsWebAppSlotResource) baseTemplate(data acceptance.TestData) string { diff --git a/internal/services/attestation/attestation_provider_resource.go b/internal/services/attestation/attestation_provider_resource.go index 9e30cc505ccc..ac26741d0dc4 100644 --- a/internal/services/attestation/attestation_provider_resource.go +++ b/internal/services/attestation/attestation_provider_resource.go @@ -143,7 +143,7 @@ func resourceAttestationProviderRead(d *pluginsdk.ResourceData, meta interface{} return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.ProviderName) + d.Set("name", id.AttestationProviderName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/authorization/role_definition_resource.go b/internal/services/authorization/role_definition_resource.go index 07a5b6b4c2f9..039b6405997c 100644 --- a/internal/services/authorization/role_definition_resource.go +++ b/internal/services/authorization/role_definition_resource.go @@ -466,7 +466,9 @@ func expandRoleDefinitionAssignableScopes(d *pluginsdk.ResourceData) []string { scopes = append(scopes, assignedScope) } else { for _, scope := range assignableScopes { - scopes = append(scopes, scope.(string)) + if s, ok := scope.(string); ok { + scopes = append(scopes, s) + } } } diff --git a/internal/services/azurestackhci/client/client.go b/internal/services/azurestackhci/client/client.go index 17436f96508e..4624a038c9d8 100644 --- a/internal/services/azurestackhci/client/client.go +++ b/internal/services/azurestackhci/client/client.go @@ -1,19 +1,15 @@ package client import ( - "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters" + "github.com/Azure/go-autorest/autorest" + azurestackhci_v2022_12_01 "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) -type Client struct { - ClusterClient *clusters.ClustersClient -} - -func NewClient(o *common.ClientOptions) *Client { - clusterClient := clusters.NewClustersClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&clusterClient.Client, o.ResourceManagerAuthorizer) +func NewClient(o *common.ClientOptions) *azurestackhci_v2022_12_01.Client { + client := azurestackhci_v2022_12_01.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) { + c.Authorizer = o.ResourceManagerAuthorizer + }) - return &Client{ - ClusterClient: &clusterClient, - } + return &client } diff --git a/internal/services/azurestackhci/stack_hci_cluster_resource.go b/internal/services/azurestackhci/stack_hci_cluster_resource.go index 0ccdb9a7d5e4..eceb32bb40e4 100644 --- a/internal/services/azurestackhci/stack_hci_cluster_resource.go +++ b/internal/services/azurestackhci/stack_hci_cluster_resource.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/validate" @@ -71,7 +71,7 @@ func resourceArmStackHCICluster() *pluginsdk.Resource { } func resourceArmStackHCIClusterCreate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).AzureStackHCI.ClusterClient + client := meta.(*clients.Client).AzureStackHCI.Clusters subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -113,7 +113,7 @@ func resourceArmStackHCIClusterCreate(d *pluginsdk.ResourceData, meta interface{ } func resourceArmStackHCIClusterRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).AzureStackHCI.ClusterClient + client := meta.(*clients.Client).AzureStackHCI.Clusters ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -153,7 +153,7 @@ func resourceArmStackHCIClusterRead(d *pluginsdk.ResourceData, meta interface{}) } func resourceArmStackHCIClusterUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).AzureStackHCI.ClusterClient + client := meta.(*clients.Client).AzureStackHCI.Clusters ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -176,7 +176,7 @@ func resourceArmStackHCIClusterUpdate(d *pluginsdk.ResourceData, meta interface{ } func resourceArmStackHCIClusterDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).AzureStackHCI.ClusterClient + client := meta.(*clients.Client).AzureStackHCI.Clusters ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() diff --git a/internal/services/azurestackhci/stack_hci_cluster_resource_test.go b/internal/services/azurestackhci/stack_hci_cluster_resource_test.go index 27fc03dcc84c..c7ba0a2d70ef 100644 --- a/internal/services/azurestackhci/stack_hci_cluster_resource_test.go +++ b/internal/services/azurestackhci/stack_hci_cluster_resource_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -84,7 +84,7 @@ func TestAccStackHCICluster_update(t *testing.T) { } func (r StackHCIClusterResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - clusterClient := client.AzureStackHCI.ClusterClient + clusterClient := client.AzureStackHCI.Clusters id, err := clusters.ParseClusterID(state.ID) if err != nil { return nil, err diff --git a/internal/services/batch/batch_account.go b/internal/services/batch/batch_account.go index 9d0e9ec394c9..cfdbe764564b 100644 --- a/internal/services/batch/batch_account.go +++ b/internal/services/batch/batch_account.go @@ -3,42 +3,39 @@ package batch import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" ) // expandBatchAccountKeyVaultReference expands Batch account KeyVault reference -func expandBatchAccountKeyVaultReference(list []interface{}) (*batch.KeyVaultReference, error) { +func expandBatchAccountKeyVaultReference(list []interface{}) (*batchaccount.KeyVaultReference, error) { if len(list) == 0 || list[0] == nil { - return nil, fmt.Errorf("Error: key vault reference should be defined") + return nil, fmt.Errorf("key vault reference should be defined") } keyVaultRef := list[0].(map[string]interface{}) - keyVaultRefID := keyVaultRef["id"].(string) - keyVaultRefURL := keyVaultRef["url"].(string) - - ref := &batch.KeyVaultReference{ - ID: &keyVaultRefID, - URL: &keyVaultRefURL, + ref := &batchaccount.KeyVaultReference{ + Id: keyVaultRef["id"].(string), + Url: keyVaultRef["url"].(string), } return ref, nil } // flattenBatchAccountKeyvaultReference flattens a Batch account keyvault reference -func flattenBatchAccountKeyvaultReference(keyVaultReference *batch.KeyVaultReference) interface{} { +func flattenBatchAccountKeyvaultReference(keyVaultReference *batchaccount.KeyVaultReference) interface{} { result := make(map[string]interface{}) if keyVaultReference == nil { return []interface{}{} } - if keyVaultReference.ID != nil { - result["id"] = *keyVaultReference.ID + if keyVaultReference.Id != "" { + result["id"] = keyVaultReference.Id } - if keyVaultReference.URL != nil { - result["url"] = *keyVaultReference.URL + if keyVaultReference.Url != "" { + result["url"] = keyVaultReference.Url } return []interface{}{result} diff --git a/internal/services/batch/batch_account_data_source.go b/internal/services/batch/batch_account_data_source.go index aa1a7e8da469..735ccc22da1b 100644 --- a/internal/services/batch/batch_account_data_source.go +++ b/internal/services/batch/batch_account_data_source.go @@ -4,17 +4,16 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceBatchAccount() *pluginsdk.Resource { @@ -87,7 +86,7 @@ func dataSourceBatchAccount() *pluginsdk.Resource { }, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -98,52 +97,57 @@ func dataSourceBatchAccountRead(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := batchaccount.NewBatchAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } - return fmt.Errorf("making Read request on %s: %+v", id, err) + return fmt.Errorf("reading %s: %+v", id, err) } d.SetId(id.ID()) d.Set("name", id.BatchAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - d.Set("account_endpoint", resp.AccountEndpoint) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) - if props := resp.AccountProperties; props != nil { - if autoStorage := props.AutoStorage; autoStorage != nil { - d.Set("storage_account_id", autoStorage.StorageAccountID) - } - d.Set("pool_allocation_mode", props.PoolAllocationMode) - poolAllocationMode := d.Get("pool_allocation_mode").(string) - - if encryption := props.Encryption; encryption != nil { - d.Set("encryption", flattenEncryption(encryption)) - } + if props := model.Properties; props != nil { + d.Set("account_endpoint", props.AccountEndpoint) - if poolAllocationMode == string(batch.PoolAllocationModeBatchService) { - keys, err := client.GetKeys(ctx, id.ResourceGroup, id.BatchAccountName) - if err != nil { - return fmt.Errorf("cannot read keys for %s: %v", id, err) + if autoStorage := props.AutoStorage; autoStorage != nil { + d.Set("storage_account_id", autoStorage.StorageAccountId) } + d.Set("pool_allocation_mode", props.PoolAllocationMode) + poolAllocationMode := d.Get("pool_allocation_mode").(string) - d.Set("primary_access_key", keys.Primary) - d.Set("secondary_access_key", keys.Secondary) + if encryption := props.Encryption; encryption != nil { + d.Set("encryption", flattenEncryption(encryption)) + } - // set empty keyvault reference which is not needed in Batch Service allocation mode. - d.Set("key_vault_reference", []interface{}{}) - } else if poolAllocationMode == string(batch.PoolAllocationModeUserSubscription) { - if err := d.Set("key_vault_reference", flattenBatchAccountKeyvaultReference(props.KeyVaultReference)); err != nil { - return fmt.Errorf("flattening `key_vault_reference`: %+v", err) + if poolAllocationMode == string(batchaccount.PoolAllocationModeBatchService) { + keys, err := client.GetKeys(ctx, id) + if err != nil { + return fmt.Errorf("cannot read keys for %s: %v", id, err) + } + + if keysModel := keys.Model; keysModel != nil { + d.Set("primary_access_key", keysModel.Primary) + d.Set("secondary_access_key", keysModel.Secondary) + } + + // set empty keyvault reference which is not needed in Batch Service allocation mode. + d.Set("key_vault_reference", []interface{}{}) + } else if poolAllocationMode == string(batchaccount.PoolAllocationModeUserSubscription) { + if err := d.Set("key_vault_reference", flattenBatchAccountKeyvaultReference(props.KeyVaultReference)); err != nil { + return fmt.Errorf("flattening `key_vault_reference`: %+v", err) + } } } + return tags.FlattenAndSet(d, model.Tags) } - - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/internal/services/batch/batch_account_resource.go b/internal/services/batch/batch_account_resource.go index 4a034f7010ca..1186e5c5d293 100644 --- a/internal/services/batch/batch_account_resource.go +++ b/internal/services/batch/batch_account_resource.go @@ -6,19 +6,18 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -40,7 +39,7 @@ func resourceBatchAccount() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.AccountID(id) + _, err := batchaccount.ParseBatchAccountID(id) return err }), @@ -67,8 +66,8 @@ func resourceBatchAccount() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.AutoStorageAuthenticationModeStorageKeys), - string(batch.AutoStorageAuthenticationModeBatchAccountManagedIdentity), + string(batchaccount.AutoStorageAuthenticationModeStorageKeys), + string(batchaccount.AutoStorageAuthenticationModeBatchAccountManagedIdentity), }, false), RequiredWith: []string{"storage_account_id"}, }, @@ -87,9 +86,9 @@ func resourceBatchAccount() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(batch.AuthenticationModeSharedKey), - string(batch.AuthenticationModeAAD), - string(batch.AuthenticationModeTaskAuthenticationToken), + string(batchaccount.AuthenticationModeSharedKey), + string(batchaccount.AuthenticationModeAAD), + string(batchaccount.AuthenticationModeTaskAuthenticationToken), }, false), }, }, @@ -97,10 +96,10 @@ func resourceBatchAccount() *pluginsdk.Resource { "pool_allocation_mode": { Type: pluginsdk.TypeString, Optional: true, - Default: string(batch.PoolAllocationModeBatchService), + Default: string(batchaccount.PoolAllocationModeBatchService), ValidateFunc: validation.StringInSlice([]string{ - string(batch.PoolAllocationModeBatchService), - string(batch.PoolAllocationModeUserSubscription), + string(batchaccount.PoolAllocationModeBatchService), + string(batchaccount.PoolAllocationModeUserSubscription), }, false), }, @@ -165,7 +164,7 @@ func resourceBatchAccount() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -178,26 +177,24 @@ func resourceBatchAccountCreate(d *pluginsdk.ResourceData, meta interface{}) err log.Printf("[INFO] preparing arguments for Azure Batch account creation.") - id := parse.NewAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := batchaccount.NewBatchAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) location := azure.NormalizeLocation(d.Get("location").(string)) storageAccountId := d.Get("storage_account_id").(string) - poolAllocationMode := d.Get("pool_allocation_mode").(string) - t := d.Get("tags").(map[string]interface{}) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_batch_account", id.ID()) } } - identity, err := expandBatchAccountIdentity(d.Get("identity").([]interface{})) + identity, err := identity.ExpandSystemOrUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf(`expanding "identity": %v`, err) } @@ -205,24 +202,25 @@ func resourceBatchAccountCreate(d *pluginsdk.ResourceData, meta interface{}) err encryptionRaw := d.Get("encryption").([]interface{}) encryption := expandEncryption(encryptionRaw) - parameters := batch.AccountCreateParameters{ - Location: &location, - AccountCreateProperties: &batch.AccountCreateProperties{ - PoolAllocationMode: batch.PoolAllocationMode(poolAllocationMode), - PublicNetworkAccess: batch.PublicNetworkAccessTypeEnabled, + poolAllocationMode := batchaccount.PoolAllocationMode(d.Get("pool_allocation_mode").(string)) + parameters := batchaccount.BatchAccountCreateParameters{ + Location: location, + Properties: &batchaccount.BatchAccountCreateProperties{ + PoolAllocationMode: &poolAllocationMode, + PublicNetworkAccess: utils.ToPtr(batchaccount.PublicNetworkAccessTypeEnabled), Encryption: encryption, AllowedAuthenticationModes: expandAllowedAuthenticationModes(d.Get("allowed_authentication_modes").(*pluginsdk.Set).List()), }, Identity: identity, - Tags: tags.Expand(t), + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } if enabled := d.Get("public_network_access_enabled").(bool); !enabled { - parameters.AccountCreateProperties.PublicNetworkAccess = batch.PublicNetworkAccessTypeDisabled + parameters.Properties.PublicNetworkAccess = utils.ToPtr(batchaccount.PublicNetworkAccessTypeDisabled) } // if pool allocation mode is UserSubscription, a key vault reference needs to be set - if poolAllocationMode == string(batch.PoolAllocationModeUserSubscription) { + if poolAllocationMode == batchaccount.PoolAllocationModeUserSubscription { keyVaultReferenceSet := d.Get("key_vault_reference").([]interface{}) keyVaultReference, err := expandBatchAccountKeyVaultReference(keyVaultReferenceSet) if err != nil { @@ -233,12 +231,12 @@ func resourceBatchAccountCreate(d *pluginsdk.ResourceData, meta interface{}) err return fmt.Errorf("creating %s: When setting pool allocation mode to UserSubscription, a Key Vault reference needs to be set", id) } - parameters.KeyVaultReference = keyVaultReference + parameters.Properties.KeyVaultReference = keyVaultReference if v, ok := d.GetOk("allowed_authentication_modes"); ok { authModes := v.(*pluginsdk.Set).List() for _, mode := range authModes { - if batch.AuthenticationMode(mode.(string)) == batch.AuthenticationModeSharedKey { + if batchaccount.AuthenticationMode(mode.(string)) == batchaccount.AuthenticationModeSharedKey { return fmt.Errorf("creating %s: When setting pool allocation mode to UserSubscription, `allowed_authentication_modes=[StorageKeys]` is not allowed. ", id) } } @@ -246,8 +244,7 @@ func resourceBatchAccountCreate(d *pluginsdk.ResourceData, meta interface{}) err } authMode := d.Get("storage_account_authentication_mode").(string) - if batch.AutoStorageAuthenticationMode(authMode) == batch.AutoStorageAuthenticationModeBatchAccountManagedIdentity && - identity.Type == batch.ResourceIdentityTypeNone { + if batchaccount.AutoStorageAuthenticationMode(authMode) == batchaccount.AutoStorageAuthenticationModeBatchAccountManagedIdentity && identity.Type == "None" { return fmt.Errorf(" storage_account_authentication_mode=`BatchAccountManagedIdentity` can only be set when identity.type is `SystemAssigned` or `UserAssigned`") } @@ -255,28 +252,23 @@ func resourceBatchAccountCreate(d *pluginsdk.ResourceData, meta interface{}) err if authMode == "" { return fmt.Errorf("`storage_account_authentication_mode` is required when `storage_account_id` ") } - parameters.AccountCreateProperties.AutoStorage = &batch.AutoStorageBaseProperties{ - StorageAccountID: &storageAccountId, - AuthenticationMode: batch.AutoStorageAuthenticationMode(authMode), + parameters.Properties.AutoStorage = &batchaccount.AutoStorageBaseProperties{ + StorageAccountId: &storageAccountId, + AuthenticationMode: utils.ToPtr(batchaccount.AutoStorageAuthenticationMode(authMode)), } } nodeIdentity := d.Get("storage_account_node_identity").(string) if nodeIdentity != "" { - parameters.AccountCreateProperties.AutoStorage.NodeIdentityReference = &batch.ComputeNodeIdentityReference{ - ResourceID: utils.String(nodeIdentity), + parameters.Properties.AutoStorage.NodeIdentityReference = &batchaccount.ComputeNodeIdentityReference{ + ResourceId: utils.String(nodeIdentity), } } - future, err := client.Create(ctx, id.ResourceGroup, id.BatchAccountName, parameters) - if err != nil { + if err := client.CreateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceBatchAccountRead(d, meta) @@ -287,77 +279,83 @@ func resourceBatchAccountRead(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AccountID(d.Id()) + id, err := batchaccount.ParseBatchAccountID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") - log.Printf("[DEBUG] Batch Account %q was not found in Resource Group %q - removing from state!", id.BatchAccountName, id.ResourceGroup) + log.Printf("[DEBUG] Batch Account %s - removing from state!", *id) return nil } - return fmt.Errorf("reading the state of Batch account %q: %+v", id.BatchAccountName, err) + return fmt.Errorf("reading %s: %+v", *id, err) } d.Set("name", id.BatchAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + if model := resp.Model; model != nil { + if location := model.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) + } - identity, err := flattenBatchAccountIdentity(resp.Identity) - if err != nil { - return fmt.Errorf("flattening `identity`: %+v", err) - } - if err := d.Set("identity", identity); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) - } + identity, err := identity.FlattenSystemOrUserAssignedMap(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + + if err := d.Set("identity", identity); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } - if props := resp.AccountProperties; props != nil { - d.Set("account_endpoint", props.AccountEndpoint) - if autoStorage := props.AutoStorage; autoStorage != nil { - d.Set("storage_account_id", *autoStorage.StorageAccountID) - d.Set("storage_account_authentication_mode", autoStorage.AuthenticationMode) + if props := model.Properties; props != nil { - if autoStorage.NodeIdentityReference != nil { - d.Set("storage_account_node_identity", autoStorage.NodeIdentityReference.ResourceID) + d.Set("account_endpoint", props.AccountEndpoint) + if autoStorage := props.AutoStorage; autoStorage != nil { + d.Set("storage_account_id", autoStorage.StorageAccountId) + d.Set("storage_account_authentication_mode", autoStorage.AuthenticationMode) + + if autoStorage.NodeIdentityReference != nil { + d.Set("storage_account_node_identity", autoStorage.NodeIdentityReference.ResourceId) + } + } else { + d.Set("storage_account_authentication_mode", "") + d.Set("storage_account_id", "") } - } else { - d.Set("storage_account_authentication_mode", "") - d.Set("storage_account_id", "") - } - if props.PublicNetworkAccess != "" { - d.Set("public_network_access_enabled", props.PublicNetworkAccess == batch.PublicNetworkAccessTypeEnabled) - } + if v := props.PublicNetworkAccess; v != nil { + d.Set("public_network_access_enabled", *v == batchaccount.PublicNetworkAccessTypeEnabled) + } - d.Set("pool_allocation_mode", props.PoolAllocationMode) + d.Set("pool_allocation_mode", props.PoolAllocationMode) - if err := d.Set("encryption", flattenEncryption(props.Encryption)); err != nil { - return fmt.Errorf("setting `encryption`: %+v", err) - } + if err := d.Set("encryption", flattenEncryption(props.Encryption)); err != nil { + return fmt.Errorf("setting `encryption`: %+v", err) + } - if err := d.Set("allowed_authentication_modes", flattenAllowedAuthenticationModes(props.AllowedAuthenticationModes)); err != nil { - return fmt.Errorf("setting `allowed_authentication_modes`: %+v", err) - } - } + if err := d.Set("allowed_authentication_modes", flattenAllowedAuthenticationModes(props.AllowedAuthenticationModes)); err != nil { + return fmt.Errorf("setting `allowed_authentication_modes`: %+v", err) + } - if d.Get("pool_allocation_mode").(string) == string(batch.PoolAllocationModeBatchService) && - isShardKeyAllowed(d.Get("allowed_authentication_modes").(*pluginsdk.Set).List()) { - keys, err := client.GetKeys(ctx, id.ResourceGroup, id.BatchAccountName) - if err != nil { - return fmt.Errorf("Cannot read keys for Batch account %q (resource group %q): %v", id.BatchAccountName, id.ResourceGroup, err) - } + if d.Get("pool_allocation_mode").(string) == string(batchaccount.PoolAllocationModeBatchService) && + isShardKeyAllowed(d.Get("allowed_authentication_modes").(*pluginsdk.Set).List()) { + keys, err := client.GetKeys(ctx, *id) + if err != nil { + return fmt.Errorf("cannot read keys for Batch account %s: %v", *id, err) + } - d.Set("primary_access_key", keys.Primary) - d.Set("secondary_access_key", keys.Secondary) + if keysModel := keys.Model; keysModel != nil { + d.Set("primary_access_key", keysModel.Primary) + d.Set("secondary_access_key", keysModel.Secondary) + } + } + return tags.FlattenAndSet(d, model.Tags) + } } - - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceBatchAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) error { @@ -367,14 +365,14 @@ func resourceBatchAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) err log.Printf("[INFO] preparing arguments for Azure Batch account update.") - id, err := parse.AccountID(d.Id()) + id, err := batchaccount.ParseBatchAccountID(d.Id()) if err != nil { return err } t := d.Get("tags").(map[string]interface{}) - identity, err := expandBatchAccountIdentity(d.Get("identity").([]interface{})) + identity, err := identity.ExpandSystemOrUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf(`expanding "identity": %v`, err) } @@ -382,8 +380,8 @@ func resourceBatchAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) err encryptionRaw := d.Get("encryption").([]interface{}) encryption := expandEncryption(encryptionRaw) - parameters := batch.AccountUpdateParameters{ - AccountUpdateProperties: &batch.AccountUpdateProperties{ + parameters := batchaccount.BatchAccountUpdateParameters{ + Properties: &batchaccount.BatchAccountUpdateProperties{ Encryption: encryption, }, Identity: identity, @@ -393,48 +391,46 @@ func resourceBatchAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) err if d.HasChange("allowed_authentication_modes") { allowedAuthModes := d.Get("allowed_authentication_modes").(*pluginsdk.Set).List() if len(allowedAuthModes) == 0 { - parameters.AllowedAuthenticationModes = &[]batch.AuthenticationMode{} // remove all modes need explicit set it to empty array not nil + parameters.Properties.AllowedAuthenticationModes = &[]batchaccount.AuthenticationMode{} // remove all modes need explicit set it to empty array not nil } else { - parameters.AllowedAuthenticationModes = expandAllowedAuthenticationModes(d.Get("allowed_authentication_modes").(*pluginsdk.Set).List()) + parameters.Properties.AllowedAuthenticationModes = expandAllowedAuthenticationModes(d.Get("allowed_authentication_modes").(*pluginsdk.Set).List()) } } if d.HasChange("storage_account_id") { if v, ok := d.GetOk("storage_account_id"); ok { - parameters.AccountUpdateProperties.AutoStorage = &batch.AutoStorageBaseProperties{ - StorageAccountID: utils.String(v.(string)), + parameters.Properties.AutoStorage = &batchaccount.AutoStorageBaseProperties{ + StorageAccountId: utils.String(v.(string)), } } else { - // remove the storage account from the batch account - parameters.AccountUpdateProperties.AutoStorage = &batch.AutoStorageBaseProperties{ - StorageAccountID: nil, + parameters.Properties.AutoStorage = &batchaccount.AutoStorageBaseProperties{ + StorageAccountId: nil, } } } authMode := d.Get("storage_account_authentication_mode").(string) - if batch.AutoStorageAuthenticationMode(authMode) == batch.AutoStorageAuthenticationModeBatchAccountManagedIdentity && - identity.Type == batch.ResourceIdentityTypeNone { + if batchaccount.AutoStorageAuthenticationMode(authMode) == batchaccount.AutoStorageAuthenticationModeBatchAccountManagedIdentity && identity.Type == "None" { return fmt.Errorf(" storage_account_authentication_mode=`BatchAccountManagedIdentity` can only be set when identity.type is `SystemAssigned` or `UserAssigned`") } storageAccountId := d.Get("storage_account_id").(string) if storageAccountId != "" { - parameters.AutoStorage = &batch.AutoStorageBaseProperties{ - StorageAccountID: &storageAccountId, - AuthenticationMode: batch.AutoStorageAuthenticationMode(authMode), + parameters.Properties.AutoStorage = &batchaccount.AutoStorageBaseProperties{ + StorageAccountId: &storageAccountId, + AuthenticationMode: utils.ToPtr(batchaccount.AutoStorageAuthenticationMode(authMode)), } } nodeIdentity := d.Get("storage_account_node_identity").(string) if nodeIdentity != "" { - parameters.AutoStorage.NodeIdentityReference = &batch.ComputeNodeIdentityReference{ - ResourceID: utils.String(nodeIdentity), + parameters.Properties.AutoStorage.NodeIdentityReference = &batchaccount.ComputeNodeIdentityReference{ + ResourceId: utils.String(nodeIdentity), } } - if _, err = client.Update(ctx, id.ResourceGroup, id.BatchAccountName, parameters); err != nil { - return fmt.Errorf("updating Batch account %q (Resource Group %q): %+v", id.BatchAccountName, id.ResourceGroup, err) + if _, err = client.Update(ctx, *id, parameters); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } d.SetId(id.ID()) @@ -447,73 +443,21 @@ func resourceBatchAccountDelete(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AccountID(d.Id()) + id, err := batchaccount.ParseBatchAccountID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.BatchAccountName) - if err != nil { - return fmt.Errorf("deleting Batch account %q (Resource Group %q): %+v", id.BatchAccountName, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for deletion of Batch account %q (Resource Group %q): %+v", id.BatchAccountName, id.ResourceGroup, err) - } + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } -func expandBatchAccountIdentity(input []interface{}) (*batch.AccountIdentity, error) { - expanded, err := identity.ExpandSystemAndUserAssignedMap(input) - if err != nil { - return nil, err - } - - out := batch.AccountIdentity{ - Type: batch.ResourceIdentityType(string(expanded.Type)), - } - if expanded.Type == identity.TypeUserAssigned || expanded.Type == identity.TypeSystemAssignedUserAssigned { - out.UserAssignedIdentities = make(map[string]*batch.UserAssignedIdentities) - for k := range expanded.IdentityIds { - out.UserAssignedIdentities[k] = &batch.UserAssignedIdentities{ - // intentionally empty - } - } - } - return &out, nil -} - -func flattenBatchAccountIdentity(input *batch.AccountIdentity) (*[]interface{}, error) { - var transform *identity.SystemAndUserAssignedMap - - if input != nil { - transform = &identity.SystemAndUserAssignedMap{ - Type: identity.Type(string(input.Type)), - IdentityIds: make(map[string]identity.UserAssignedIdentityDetails), - } - if input.PrincipalID != nil { - transform.PrincipalId = *input.PrincipalID - } - if input.TenantID != nil { - transform.TenantId = *input.TenantID - } - for k, v := range input.UserAssignedIdentities { - transform.IdentityIds[k] = identity.UserAssignedIdentityDetails{ - ClientId: v.ClientID, - PrincipalId: v.PrincipalID, - } - } - } - - return identity.FlattenSystemAndUserAssignedMap(transform) -} - -func expandEncryption(e []interface{}) *batch.EncryptionProperties { - defaultEnc := batch.EncryptionProperties{ - KeySource: batch.KeySourceMicrosoftBatch, +func expandEncryption(e []interface{}) *batchaccount.EncryptionProperties { + defaultEnc := batchaccount.EncryptionProperties{ + KeySource: utils.ToPtr(batchaccount.KeySourceMicrosoftPointBatch), } if len(e) == 0 || e[0] == nil { @@ -522,9 +466,9 @@ func expandEncryption(e []interface{}) *batch.EncryptionProperties { v := e[0].(map[string]interface{}) keyId := v["key_vault_key_id"].(string) - encryptionProperty := batch.EncryptionProperties{ - KeySource: batch.KeySourceMicrosoftKeyVault, - KeyVaultProperties: &batch.KeyVaultProperties{ + encryptionProperty := batchaccount.EncryptionProperties{ + KeySource: utils.ToPtr(batchaccount.KeySourceMicrosoftPointKeyVault), + KeyVaultProperties: &batchaccount.KeyVaultProperties{ KeyIdentifier: &keyId, }, } @@ -532,19 +476,19 @@ func expandEncryption(e []interface{}) *batch.EncryptionProperties { return &encryptionProperty } -func expandAllowedAuthenticationModes(input []interface{}) *[]batch.AuthenticationMode { +func expandAllowedAuthenticationModes(input []interface{}) *[]batchaccount.AuthenticationMode { if len(input) == 0 { return nil } - allowedAuthModes := make([]batch.AuthenticationMode, 0) + allowedAuthModes := make([]batchaccount.AuthenticationMode, 0) for _, mode := range input { - allowedAuthModes = append(allowedAuthModes, batch.AuthenticationMode(mode.(string))) + allowedAuthModes = append(allowedAuthModes, batchaccount.AuthenticationMode(mode.(string))) } return &allowedAuthModes } -func flattenAllowedAuthenticationModes(input *[]batch.AuthenticationMode) []string { +func flattenAllowedAuthenticationModes(input *[]batchaccount.AuthenticationMode) []string { if input == nil || len(*input) == 0 { return []string{} } @@ -556,8 +500,8 @@ func flattenAllowedAuthenticationModes(input *[]batch.AuthenticationMode) []stri return allowedAuthModes } -func flattenEncryption(encryptionProperties *batch.EncryptionProperties) []interface{} { - if encryptionProperties == nil || encryptionProperties.KeySource == batch.KeySourceMicrosoftBatch { +func flattenEncryption(encryptionProperties *batchaccount.EncryptionProperties) []interface{} { + if encryptionProperties == nil || *encryptionProperties.KeySource == batchaccount.KeySourceMicrosoftPointBatch { return []interface{}{} } @@ -573,7 +517,7 @@ func isShardKeyAllowed(input []interface{}) bool { return false } for _, authMod := range input { - if strings.EqualFold(authMod.(string), string(batch.AuthenticationModeSharedKey)) { + if strings.EqualFold(authMod.(string), string(batchaccount.AuthenticationModeSharedKey)) { return true } } diff --git a/internal/services/batch/batch_account_resource_test.go b/internal/services/batch/batch_account_resource_test.go index bb9637f1acd0..7d32b1c7bc74 100644 --- a/internal/services/batch/batch_account_resource_test.go +++ b/internal/services/batch/batch_account_resource_test.go @@ -6,10 +6,10 @@ import ( "os" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -279,17 +279,17 @@ func TestAccBatchAccount_removeStorageAccount(t *testing.T) { } func (t BatchAccountResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.AccountID(state.ID) + id, err := batchaccount.ParseBatchAccountID(state.ID) if err != nil { return nil, err } - resp, err := clients.Batch.AccountClient.Get(ctx, id.ResourceGroup, id.BatchAccountName) + resp, err := clients.Batch.AccountClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Batch Application %q (Resource Group %q) does not exist", id.BatchAccountName, id.ResourceGroup) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.AccountProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (BatchAccountResource) basic(data acceptance.TestData) string { diff --git a/internal/services/batch/batch_application_data_source.go b/internal/services/batch/batch_application_data_source.go index 77758c9938c8..d4e886e12cec 100644 --- a/internal/services/batch/batch_application_data_source.go +++ b/internal/services/batch/batch_application_data_source.go @@ -4,13 +4,13 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceBatchApplication() *pluginsdk.Resource { @@ -60,11 +60,11 @@ func dataSourceBatchApplicationRead(d *pluginsdk.ResourceData, meta interface{}) defer cancel() subscriptionId := meta.(*clients.Client).Account.SubscriptionId - id := parse.NewApplicationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + id := application.NewApplicationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("reading %s: %+v", id, err) @@ -72,14 +72,16 @@ func dataSourceBatchApplicationRead(d *pluginsdk.ResourceData, meta interface{}) d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.ApplicationName) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("account_name", id.BatchAccountName) - if applicationProperties := resp.ApplicationProperties; applicationProperties != nil { - d.Set("allow_updates", applicationProperties.AllowUpdates) - d.Set("default_version", applicationProperties.DefaultVersion) - d.Set("display_name", applicationProperties.DisplayName) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("allow_updates", props.AllowUpdates) + d.Set("default_version", props.DefaultVersion) + d.Set("display_name", props.DisplayName) + } } return nil diff --git a/internal/services/batch/batch_application_resource.go b/internal/services/batch/batch_application_resource.go index 20d67d7a446d..6fa35b2aa5ce 100644 --- a/internal/services/batch/batch_application_resource.go +++ b/internal/services/batch/batch_application_resource.go @@ -5,11 +5,11 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -31,7 +31,7 @@ func resourceBatchApplication() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApplicationID(id) + _, err := application.ParseApplicationID(id) return err }), @@ -79,31 +79,31 @@ func resourceBatchApplicationCreate(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewApplicationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + id := application.NewApplicationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(resp.Response) { - return tf.ImportAsExistsError("azurerm_batch_application", *resp.ID) + if !response.WasNotFound(resp.HttpResponse) { + return tf.ImportAsExistsError("azurerm_batch_application", id.ID()) } allowUpdates := d.Get("allow_updates").(bool) defaultVersion := d.Get("default_version").(string) displayName := d.Get("display_name").(string) - parameters := batch.Application{ - ApplicationProperties: &batch.ApplicationProperties{ + parameters := application.Application{ + Properties: &application.ApplicationProperties{ AllowUpdates: utils.Bool(allowUpdates), DefaultVersion: utils.String(defaultVersion), DisplayName: utils.String(displayName), }, } - if _, err := client.Create(ctx, id.ResourceGroup, id.BatchAccountName, id.Name, ¶meters); err != nil { + if _, err := client.Create(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -117,28 +117,31 @@ func resourceBatchApplicationRead(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApplicationID(d.Id()) + id, err := application.ParseApplicationID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] Batch Application %q does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("reading Batch Application %q (Account Name %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.ApplicationName) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("account_name", id.BatchAccountName) - if applicationProperties := resp.ApplicationProperties; applicationProperties != nil { - d.Set("allow_updates", applicationProperties.AllowUpdates) - d.Set("default_version", applicationProperties.DefaultVersion) - d.Set("display_name", applicationProperties.DisplayName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("allow_updates", props.AllowUpdates) + d.Set("default_version", props.DefaultVersion) + d.Set("display_name", props.DisplayName) + } } return nil @@ -149,7 +152,7 @@ func resourceBatchApplicationUpdate(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApplicationID(d.Id()) + id, err := application.ParseApplicationID(d.Id()) if err != nil { return err } @@ -158,16 +161,16 @@ func resourceBatchApplicationUpdate(d *pluginsdk.ResourceData, meta interface{}) defaultVersion := d.Get("default_version").(string) displayName := d.Get("display_name").(string) - parameters := batch.Application{ - ApplicationProperties: &batch.ApplicationProperties{ + parameters := application.Application{ + Properties: &application.ApplicationProperties{ AllowUpdates: utils.Bool(allowUpdates), DefaultVersion: utils.String(defaultVersion), DisplayName: utils.String(displayName), }, } - if _, err := client.Update(ctx, id.ResourceGroup, id.BatchAccountName, id.Name, parameters); err != nil { - return fmt.Errorf("updating Batch Application %q (Account Name %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) + if _, err := client.Update(ctx, *id, parameters); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } return resourceBatchApplicationRead(d, meta) @@ -178,13 +181,13 @@ func resourceBatchApplicationDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApplicationID(d.Id()) + id, err := application.ParseApplicationID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.BatchAccountName, id.Name); err != nil { - return fmt.Errorf("deleting Batch Application %q (Account Name %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/internal/services/batch/batch_application_resource_test.go b/internal/services/batch/batch_application_resource_test.go index 883d03c6eac3..0e55a6bec808 100644 --- a/internal/services/batch/batch_application_resource_test.go +++ b/internal/services/batch/batch_application_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -68,17 +68,17 @@ func TestAccBatchApplication_complete(t *testing.T) { } func (t BatchApplicationResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApplicationID(state.ID) + id, err := application.ParseApplicationID(state.ID) if err != nil { return nil, err } - resp, err := clients.Batch.ApplicationClient.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := clients.Batch.ApplicationClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Batch Application %q (Account Name %q / Resource Group %q) does not exist", id.Name, id.BatchAccountName, id.ResourceGroup) + return nil, fmt.Errorf("retrieving %s", *id) } - return utils.Bool(resp.ApplicationProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (BatchApplicationResource) template(data acceptance.TestData, displayName string) string { diff --git a/internal/services/batch/batch_certificate_data_source.go b/internal/services/batch/batch_certificate_data_source.go index 8a88a7cc977d..b046b1198abc 100644 --- a/internal/services/batch/batch_certificate_data_source.go +++ b/internal/services/batch/batch_certificate_data_source.go @@ -4,13 +4,13 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceBatchCertificate() *pluginsdk.Resource { @@ -62,11 +62,11 @@ func dataSourceBatchCertificateRead(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewCertificateID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + id := certificate.NewCertificateID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("making Read request on %s: %+v", id, err) @@ -74,15 +74,38 @@ func dataSourceBatchCertificateRead(d *pluginsdk.ResourceData, meta interface{}) d.SetId(id.ID()) - d.Set("name", resp.Name) + if model := resp.Model; model != nil { + d.Set("name", model.Name) + } d.Set("account_name", id.BatchAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + format := "" + if v := props.Format; v != nil { + format = string(*v) + } + d.Set("format", format) + + publicData := "" + if v := props.PublicData; v != nil { + publicData = *v + } + d.Set("public_data", publicData) - if props := resp.CertificateProperties; props != nil { - d.Set("format", props.Format) - d.Set("public_data", props.PublicData) - d.Set("thumbprint", props.Thumbprint) - d.Set("thumbprint_algorithm", props.ThumbprintAlgorithm) + thumbprint := "" + if v := props.Thumbprint; v != nil { + thumbprint = *v + } + d.Set("thumbprint", thumbprint) + + thumbprintAlgorithm := "" + if v := props.ThumbprintAlgorithm; v != nil { + thumbprintAlgorithm = *v + } + d.Set("thumbprint_algorithm", thumbprintAlgorithm) + } } return nil diff --git a/internal/services/batch/batch_certificate_resource.go b/internal/services/batch/batch_certificate_resource.go index 6fe8fb35f495..ab5b3839f2a7 100644 --- a/internal/services/batch/batch_certificate_resource.go +++ b/internal/services/batch/batch_certificate_resource.go @@ -5,18 +5,17 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceBatchCertificate() *pluginsdk.Resource { @@ -34,7 +33,7 @@ func resourceBatchCertificate() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.CertificateID(id) + _, err := certificate.ParseCertificateID(id) return err }), @@ -66,8 +65,8 @@ func resourceBatchCertificate() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.CertificateFormatCer), - string(batch.CertificateFormatPfx), + string(certificate.CertificateFormatCer), + string(certificate.CertificateFormatPfx), }, false), }, @@ -108,45 +107,45 @@ func resourceBatchCertificateCreate(d *pluginsdk.ResourceData, meta interface{}) log.Printf("[INFO] preparing arguments for Azure Batch certificate creation.") - certificate := d.Get("certificate").(string) + cert := d.Get("certificate").(string) format := d.Get("format").(string) password := d.Get("password").(string) thumbprint := d.Get("thumbprint").(string) thumbprintAlgorithm := d.Get("thumbprint_algorithm").(string) name := thumbprintAlgorithm + "-" + thumbprint - id := parse.NewCertificateID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), name) + id := certificate.NewCertificateID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), name) if err := validateBatchCertificateFormatAndPassword(format, password); err != nil { return err } if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_batch_certificate", id.ID()) } } - certificateProperties := batch.CertificateCreateOrUpdateProperties{ - Data: &certificate, - Format: batch.CertificateFormat(format), + certificateProperties := certificate.CertificateCreateOrUpdateProperties{ + Data: cert, + Format: pointer.To(certificate.CertificateFormat(format)), Thumbprint: &thumbprint, ThumbprintAlgorithm: &thumbprintAlgorithm, } if password != "" { certificateProperties.Password = &password } - parameters := batch.CertificateCreateOrUpdateParameters{ - Name: &name, - CertificateCreateOrUpdateProperties: &certificateProperties, + parameters := certificate.CertificateCreateOrUpdateParameters{ + Name: &name, + Properties: &certificateProperties, } - _, err := client.Create(ctx, id.ResourceGroup, id.BatchAccountName, id.Name, parameters, "", "") + _, err := client.Create(ctx, id, parameters, certificate.CreateOperationOptions{}) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -160,30 +159,51 @@ func resourceBatchCertificateRead(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CertificateID(d.Id()) + id, err := certificate.ParseCertificateID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") - log.Printf("[DEBUG] Batch certificate %q was not found in Account %q / Resource Group %q - removing from state!", id.Name, id.BatchAccountName, id.ResourceGroup) + log.Printf("%s was not found - removing from state!", *id) return nil } - return fmt.Errorf("retrieving Batch Certificate %q (Account %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) + d.Set("name", id.CertificateName) d.Set("account_name", id.BatchAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.CertificateProperties; props != nil { - d.Set("format", props.Format) - d.Set("public_data", props.PublicData) - d.Set("thumbprint", props.Thumbprint) - d.Set("thumbprint_algorithm", props.ThumbprintAlgorithm) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + format := "" + if v := props.Format; v != nil { + format = string(*v) + } + d.Set("format", format) + + publicData := "" + if v := props.PublicData; v != nil { + publicData = *v + } + d.Set("public_data", publicData) + + thumbprint := "" + if v := props.Thumbprint; v != nil { + thumbprint = *v + } + d.Set("thumbprint", thumbprint) + + thumbprintAlgorithm := "" + if v := props.ThumbprintAlgorithm; v != nil { + thumbprintAlgorithm = *v + } + d.Set("thumbprint_algorithm", thumbprintAlgorithm) + } } return nil @@ -196,12 +216,12 @@ func resourceBatchCertificateUpdate(d *pluginsdk.ResourceData, meta interface{}) log.Printf("[INFO] preparing arguments for Azure Batch certificate update.") - id, err := parse.CertificateID(d.Id()) + id, err := certificate.ParseCertificateID(d.Id()) if err != nil { return err } - certificate := d.Get("certificate").(string) + cert := d.Get("certificate").(string) format := d.Get("format").(string) password := d.Get("password").(string) thumbprint := d.Get("thumbprint").(string) @@ -211,28 +231,24 @@ func resourceBatchCertificateUpdate(d *pluginsdk.ResourceData, meta interface{}) return err } - parameters := batch.CertificateCreateOrUpdateParameters{ - Name: &id.Name, - CertificateCreateOrUpdateProperties: &batch.CertificateCreateOrUpdateProperties{ - Data: &certificate, - Format: batch.CertificateFormat(format), + parameters := certificate.CertificateCreateOrUpdateParameters{ + Name: &id.CertificateName, + Properties: &certificate.CertificateCreateOrUpdateProperties{ + Data: cert, + Format: pointer.To(certificate.CertificateFormat(format)), Password: &password, Thumbprint: &thumbprint, ThumbprintAlgorithm: &thumbprintAlgorithm, }, } - if _, err = client.Update(ctx, id.ResourceGroup, id.BatchAccountName, id.Name, parameters, ""); err != nil { - return fmt.Errorf("updating Batch certificate %q (Account %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) + if _, err = client.Update(ctx, *id, parameters, certificate.UpdateOperationOptions{}); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } - read, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + _, err = client.Get(ctx, *id) if err != nil { - return fmt.Errorf("retrieving Batch Certificate %q (Account %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) - } - - if read.ID == nil { - return fmt.Errorf("Cannot read ID for Batch certificate %q (Account: %q, Resource Group %q) ID", id.Name, id.BatchAccountName, id.ResourceGroup) + return fmt.Errorf("retrieving %s: %+v", *id, err) } return resourceBatchCertificateRead(d, meta) @@ -243,20 +259,13 @@ func resourceBatchCertificateDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CertificateID(d.Id()) + id, err := certificate.ParseCertificateID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) - if err != nil { - return fmt.Errorf("deleting Batch Certificate %q (Account %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for deletion of Batch Certificate %q (Account %q / Resource Group %q): %+v", id.Name, id.BatchAccountName, id.ResourceGroup, err) - } + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/internal/services/batch/batch_certificate_resource_test.go b/internal/services/batch/batch_certificate_resource_test.go index d891a02d0e18..5cd09e59f562 100644 --- a/internal/services/batch/batch_certificate_resource_test.go +++ b/internal/services/batch/batch_certificate_resource_test.go @@ -6,10 +6,10 @@ import ( "regexp" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -83,17 +83,17 @@ func TestAccBatchCertificate_CerWithPassword(t *testing.T) { } func (t BatchCertificateResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.CertificateID(state.ID) + id, err := certificate.ParseCertificateID(state.ID) if err != nil { return nil, err } - resp, err := clients.Batch.CertificateClient.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := clients.Batch.CertificateClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Batch Certificate %q (Account Name %q / Resource Group %q) does not exist", id.Name, id.BatchAccountName, id.ResourceGroup) + return nil, fmt.Errorf("retrieving %s", *id) } - return utils.Bool(resp.CertificateProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (BatchCertificateResource) pfxWithPassword(data acceptance.TestData) string { diff --git a/internal/services/batch/batch_job_resource.go b/internal/services/batch/batch_job_resource.go index e99be46aa630..e9fbda4728f1 100644 --- a/internal/services/batch/batch_job_resource.go +++ b/internal/services/batch/batch_job_resource.go @@ -7,6 +7,8 @@ import ( batchDataplane "github.com/Azure/azure-sdk-for-go/services/batch/2020-03-01.11.0/batch" "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" @@ -40,7 +42,7 @@ func (r BatchJobResource) Arguments() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.PoolID, + ValidateFunc: pool.ValidatePoolID, }, "display_name": { Type: pluginsdk.TypeString, @@ -95,18 +97,18 @@ func (r BatchJobResource) Create() sdk.ResourceFunc { return fmt.Errorf("decoding %+v", err) } - poolId, err := parse.PoolID(model.BatchPoolId) + poolId, err := pool.ParsePoolID(model.BatchPoolId) if err != nil { return err } - accountId := parse.NewAccountID(poolId.SubscriptionId, poolId.ResourceGroup, poolId.BatchAccountName) + accountId := batchaccount.NewBatchAccountID(poolId.SubscriptionId, poolId.ResourceGroupName, poolId.BatchAccountName) client, err := metadata.Client.Batch.JobClient(ctx, accountId) if err != nil { return err } - id := parse.NewJobID(poolId.SubscriptionId, poolId.ResourceGroup, poolId.BatchAccountName, poolId.Name, model.Name) + id := parse.NewJobID(poolId.SubscriptionId, poolId.ResourceGroupName, poolId.BatchAccountName, poolId.PoolName, model.Name) existing, err := r.getJob(ctx, client, id) if err != nil { @@ -127,7 +129,7 @@ func (r BatchJobResource) Create() sdk.ResourceFunc { }, CommonEnvironmentSettings: r.expandEnvironmentSettings(model.CommonEnvironmentProperties), PoolInfo: &batchDataplane.PoolInformation{ - PoolID: &poolId.Name, + PoolID: &poolId.PoolName, }, } @@ -149,7 +151,7 @@ func (r BatchJobResource) Read() sdk.ResourceFunc { if err != nil { return err } - accountId := parse.NewAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName) + accountId := batchaccount.NewBatchAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName) client, err := metadata.Client.Batch.JobClient(ctx, accountId) if err != nil { return err @@ -165,7 +167,7 @@ func (r BatchJobResource) Read() sdk.ResourceFunc { model := BatchJobModel{ Name: id.Name, - BatchPoolId: parse.NewPoolID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName, id.PoolName).ID(), + BatchPoolId: pool.NewPoolID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName, id.PoolName).ID(), TaskRetryMaximum: 0, } @@ -216,7 +218,7 @@ func (r BatchJobResource) Update() sdk.ResourceFunc { if err != nil { return err } - accountId := parse.NewAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName) + accountId := batchaccount.NewBatchAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName) client, err := metadata.Client.Batch.JobClient(ctx, accountId) if err != nil { return err @@ -238,7 +240,7 @@ func (r BatchJobResource) Delete() sdk.ResourceFunc { if err != nil { return err } - accountId := parse.NewAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName) + accountId := batchaccount.NewBatchAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName) client, err := metadata.Client.Batch.JobClient(ctx, accountId) if err != nil { return err diff --git a/internal/services/batch/batch_job_resource_test.go b/internal/services/batch/batch_job_resource_test.go index 7e1b11a934ae..42cb37aa9960 100644 --- a/internal/services/batch/batch_job_resource_test.go +++ b/internal/services/batch/batch_job_resource_test.go @@ -5,12 +5,12 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,10 +20,10 @@ func TestAccBatchJob_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_batch_job", "test") r := BatchJobResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -35,10 +35,10 @@ func TestAccBatchJob_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_batch_job", "test") r := BatchJobResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -50,24 +50,24 @@ func TestAccBatchJob_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_batch_job", "test") r := BatchJobResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.update(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -79,10 +79,10 @@ func TestAccBatchJob_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_batch_job", "test") r := BatchJobResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -90,13 +90,13 @@ func TestAccBatchJob_requiresImport(t *testing.T) { }) } -func (r BatchJobResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r BatchJobResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.JobID(state.ID) if err != nil { return nil, err } - client, err := clients.Batch.JobClient(ctx, parse.NewAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName)) + client, err := clients.Batch.JobClient(ctx, batchaccount.NewBatchAccountID(id.SubscriptionId, id.ResourceGroup, id.BatchAccountName)) if err != nil { return nil, err } diff --git a/internal/services/batch/batch_pool.go b/internal/services/batch/batch_pool.go index 7eb2a6874970..0f8a80f436fc 100644 --- a/internal/services/batch/batch_pool.go +++ b/internal/services/batch/batch_pool.go @@ -6,14 +6,14 @@ import ( "strconv" "strings" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) // flattenBatchPoolAutoScaleSettings flattens the auto scale settings for a Batch pool -func flattenBatchPoolAutoScaleSettings(settings *batch.AutoScaleSettings) []interface{} { +func flattenBatchPoolAutoScaleSettings(settings *pool.AutoScaleSettings) []interface{} { results := make([]interface{}, 0) if settings == nil { @@ -27,15 +27,13 @@ func flattenBatchPoolAutoScaleSettings(settings *batch.AutoScaleSettings) []inte result["evaluation_interval"] = *settings.EvaluationInterval } - if settings.Formula != nil { - result["formula"] = *settings.Formula - } + result["formula"] = settings.Formula return append(results, result) } // flattenBatchPoolFixedScaleSettings flattens the fixed scale settings for a Batch pool -func flattenBatchPoolFixedScaleSettings(d *pluginsdk.ResourceData, settings *batch.FixedScaleSettings) []interface{} { +func flattenBatchPoolFixedScaleSettings(d *pluginsdk.ResourceData, settings *pool.FixedScaleSettings) []interface{} { results := make([]interface{}, 0) if settings == nil { @@ -66,7 +64,7 @@ func flattenBatchPoolFixedScaleSettings(d *pluginsdk.ResourceData, settings *bat } // flattenBatchPoolImageReference flattens the Batch pool image reference -func flattenBatchPoolImageReference(image *batch.ImageReference) []interface{} { +func flattenBatchPoolImageReference(image *pool.ImageReference) []interface{} { results := make([]interface{}, 0) if image == nil { log.Printf("[DEBUG] image is nil") @@ -86,15 +84,15 @@ func flattenBatchPoolImageReference(image *batch.ImageReference) []interface{} { if image.Version != nil { result["version"] = *image.Version } - if image.ID != nil { - result["id"] = *image.ID + if image.Id != nil { + result["id"] = *image.Id } return append(results, result) } // flattenBatchPoolStartTask flattens a Batch pool start task -func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *batch.StartTask) []interface{} { +func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *pool.StartTask) []interface{} { results := make([]interface{}, 0) if startTask == nil { @@ -111,8 +109,10 @@ func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *bat if startTask.ContainerSettings != nil { containerSettings := make(map[string]interface{}) - containerSettings["image_name"] = *startTask.ContainerSettings.ImageName - containerSettings["working_directory"] = string(startTask.ContainerSettings.WorkingDirectory) + containerSettings["image_name"] = startTask.ContainerSettings.ImageName + if startTask.ContainerSettings.WorkingDirectory != nil { + containerSettings["working_directory"] = string(*startTask.ContainerSettings.WorkingDirectory) + } if startTask.ContainerSettings.ContainerRunOptions != nil { containerSettings["run_options"] = *startTask.ContainerSettings.ContainerRunOptions } @@ -134,7 +134,7 @@ func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *bat } result["wait_for_success"] = waitForSuccess - maxTaskRetryCount := int32(0) + maxTaskRetryCount := int64(0) if startTask.MaxTaskRetryCount != nil { maxTaskRetryCount = *startTask.MaxTaskRetryCount } @@ -146,12 +146,13 @@ func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *bat if startTask.UserIdentity.AutoUser != nil { autoUser := make(map[string]interface{}) - elevationLevel := string(startTask.UserIdentity.AutoUser.ElevationLevel) - scope := string(startTask.UserIdentity.AutoUser.Scope) - - autoUser["elevation_level"] = elevationLevel - autoUser["scope"] = scope + if startTask.UserIdentity.AutoUser.ElevationLevel != nil { + autoUser["elevation_level"] = string(*startTask.UserIdentity.AutoUser.ElevationLevel) + } + if startTask.UserIdentity.AutoUser.Scope != nil { + autoUser["scope"] = string(*startTask.UserIdentity.AutoUser.Scope) + } userIdentity["auto_user"] = []interface{}{autoUser} } else { userIdentity["user_name"] = *startTask.UserIdentity.UserName @@ -167,11 +168,11 @@ func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *bat if armResourceFile.AutoStorageContainerName != nil { resourceFile["auto_storage_container_name"] = *armResourceFile.AutoStorageContainerName } - if armResourceFile.StorageContainerURL != nil { - resourceFile["storage_container_url"] = *armResourceFile.StorageContainerURL + if armResourceFile.StorageContainerUrl != nil { + resourceFile["storage_container_url"] = *armResourceFile.StorageContainerUrl } - if armResourceFile.HTTPURL != nil { - resourceFile["http_url"] = *armResourceFile.HTTPURL + if armResourceFile.HTTPUrl != nil { + resourceFile["http_url"] = *armResourceFile.HTTPUrl } if armResourceFile.BlobPrefix != nil { resourceFile["blob_prefix"] = *armResourceFile.BlobPrefix @@ -183,7 +184,7 @@ func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *bat resourceFile["file_mode"] = *armResourceFile.FileMode } if armResourceFile.IdentityReference != nil { - resourceFile["user_assigned_identity_id"] = *armResourceFile.IdentityReference.ResourceID + resourceFile["user_assigned_identity_id"] = *armResourceFile.IdentityReference.ResourceId } resourceFiles = append(resourceFiles, resourceFile) } @@ -192,7 +193,7 @@ func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *bat environment := make(map[string]interface{}) if startTask.EnvironmentSettings != nil { for _, envSetting := range *startTask.EnvironmentSettings { - environment[*envSetting.Name] = *envSetting.Value + environment[envSetting.Name] = *envSetting.Value } } @@ -204,7 +205,7 @@ func flattenBatchPoolStartTask(oldConfig *pluginsdk.ResourceData, startTask *bat } // flattenBatchPoolCertificateReferences flattens a Batch pool certificate reference -func flattenBatchPoolCertificateReferences(armCertificates *[]batch.CertificateReference) []interface{} { +func flattenBatchPoolCertificateReferences(armCertificates *[]pool.CertificateReference) []interface{} { if armCertificates == nil { return []interface{}{} } @@ -212,10 +213,11 @@ func flattenBatchPoolCertificateReferences(armCertificates *[]batch.CertificateR for _, armCertificate := range *armCertificates { certificate := map[string]interface{}{} - if armCertificate.ID != nil { - certificate["id"] = *armCertificate.ID + + certificate["id"] = armCertificate.Id + if armCertificate.StoreLocation != nil { + certificate["store_location"] = string(*armCertificate.StoreLocation) } - certificate["store_location"] = string(armCertificate.StoreLocation) if armCertificate.StoreName != nil { certificate["store_name"] = *armCertificate.StoreName } @@ -232,16 +234,14 @@ func flattenBatchPoolCertificateReferences(armCertificates *[]batch.CertificateR } // flattenBatchPoolContainerConfiguration flattens a Batch pool container configuration -func flattenBatchPoolContainerConfiguration(d *pluginsdk.ResourceData, armContainerConfiguration *batch.ContainerConfiguration) interface{} { +func flattenBatchPoolContainerConfiguration(d *pluginsdk.ResourceData, armContainerConfiguration *pool.ContainerConfiguration) interface{} { result := make(map[string]interface{}) if armContainerConfiguration == nil { return nil } - if armContainerConfiguration.Type != nil { - result["type"] = *armContainerConfiguration.Type - } + result["type"] = armContainerConfiguration.Type names := &pluginsdk.Set{F: pluginsdk.HashString} if armContainerConfiguration.ContainerImageNames != nil { @@ -256,7 +256,7 @@ func flattenBatchPoolContainerConfiguration(d *pluginsdk.ResourceData, armContai return []interface{}{result} } -func flattenBatchPoolContainerRegistries(d *pluginsdk.ResourceData, armContainerRegistries *[]batch.ContainerRegistry) []interface{} { +func flattenBatchPoolContainerRegistries(d *pluginsdk.ResourceData, armContainerRegistries *[]pool.ContainerRegistry) []interface{} { results := make([]interface{}, 0) if armContainerRegistries == nil { @@ -271,7 +271,7 @@ func flattenBatchPoolContainerRegistries(d *pluginsdk.ResourceData, armContainer return results } -func flattenBatchPoolContainerRegistry(d *pluginsdk.ResourceData, armContainerRegistry *batch.ContainerRegistry) map[string]interface{} { +func flattenBatchPoolContainerRegistry(d *pluginsdk.ResourceData, armContainerRegistry *pool.ContainerRegistry) map[string]interface{} { result := make(map[string]interface{}) if armContainerRegistry == nil { @@ -282,14 +282,16 @@ func flattenBatchPoolContainerRegistry(d *pluginsdk.ResourceData, armContainerRe result["registry_server"] = *registryServer } - if userName := armContainerRegistry.UserName; userName != nil { + if userName := armContainerRegistry.Username; userName != nil { result["user_name"] = *userName // Locate the password only if user_name is defined result["password"] = findBatchPoolContainerRegistryPassword(d, result["registry_server"].(string), result["user_name"].(string)) } if identity := armContainerRegistry.IdentityReference; identity != nil { - result["user_assigned_identity_id"] = identity.ResourceID + if identity.ResourceId != nil { + result["user_assigned_identity_id"] = *identity.ResourceId + } } return result @@ -328,18 +330,18 @@ func findSensitiveInfoForMountConfig(targetType string, sourceType string, sourc return "" } -func flattenBatchPoolMountConfig(d *pluginsdk.ResourceData, config *batch.MountConfiguration) map[string]interface{} { +func flattenBatchPoolMountConfig(d *pluginsdk.ResourceData, config *pool.MountConfiguration) map[string]interface{} { mountConfig := make(map[string]interface{}) switch { case config.AzureBlobFileSystemConfiguration != nil: azureBlobFileSysConfigList := make([]interface{}, 0) azureBlobFileSysConfig := make(map[string]interface{}) - azureBlobFileSysConfig["account_name"] = *config.AzureBlobFileSystemConfiguration.AccountName - azureBlobFileSysConfig["container_name"] = *config.AzureBlobFileSystemConfiguration.ContainerName - azureBlobFileSysConfig["relative_mount_path"] = *config.AzureBlobFileSystemConfiguration.RelativeMountPath - azureBlobFileSysConfig["account_key"] = findSensitiveInfoForMountConfig("account_key", "account_name", *config.AzureBlobFileSystemConfiguration.AccountName, "azure_blob_file_system", d) - azureBlobFileSysConfig["sas_key"] = findSensitiveInfoForMountConfig("sas_key", "account_name", *config.AzureBlobFileSystemConfiguration.AccountName, "azure_blob_file_system", d) + azureBlobFileSysConfig["account_name"] = config.AzureBlobFileSystemConfiguration.AccountName + azureBlobFileSysConfig["container_name"] = config.AzureBlobFileSystemConfiguration.ContainerName + azureBlobFileSysConfig["relative_mount_path"] = config.AzureBlobFileSystemConfiguration.RelativeMountPath + azureBlobFileSysConfig["account_key"] = findSensitiveInfoForMountConfig("account_key", "account_name", config.AzureBlobFileSystemConfiguration.AccountName, "azure_blob_file_system", d) + azureBlobFileSysConfig["sas_key"] = findSensitiveInfoForMountConfig("sas_key", "account_name", config.AzureBlobFileSystemConfiguration.AccountName, "azure_blob_file_system", d) if config.AzureBlobFileSystemConfiguration.IdentityReference != nil { azureBlobFileSysConfig["identity_id"] = flattenBatchPoolIdentityReferenceToIdentityID(config.AzureBlobFileSystemConfiguration.IdentityReference) } @@ -351,10 +353,10 @@ func flattenBatchPoolMountConfig(d *pluginsdk.ResourceData, config *batch.MountC case config.AzureFileShareConfiguration != nil: azureFileShareConfigList := make([]interface{}, 0) azureFileShareConfig := make(map[string]interface{}) - azureFileShareConfig["account_name"] = *config.AzureFileShareConfiguration.AccountName - azureFileShareConfig["azure_file_url"] = *config.AzureFileShareConfiguration.AzureFileURL - azureFileShareConfig["account_key"] = findSensitiveInfoForMountConfig("account_key", "account_name", *config.AzureFileShareConfiguration.AccountName, "azure_file_share", d) - azureFileShareConfig["relative_mount_path"] = *config.AzureFileShareConfiguration.RelativeMountPath + azureFileShareConfig["account_name"] = config.AzureFileShareConfiguration.AccountName + azureFileShareConfig["azure_file_url"] = config.AzureFileShareConfiguration.AzureFileUrl + azureFileShareConfig["account_key"] = findSensitiveInfoForMountConfig("account_key", "account_name", config.AzureFileShareConfiguration.AccountName, "azure_file_share", d) + azureFileShareConfig["relative_mount_path"] = config.AzureFileShareConfiguration.RelativeMountPath if config.AzureFileShareConfiguration.MountOptions != nil { azureFileShareConfig["mount_options"] = *config.AzureFileShareConfiguration.MountOptions @@ -367,10 +369,10 @@ func flattenBatchPoolMountConfig(d *pluginsdk.ResourceData, config *batch.MountC cifsMountConfigList := make([]interface{}, 0) cifsMountConfig := make(map[string]interface{}) - cifsMountConfig["user_name"] = *config.CifsMountConfiguration.Username - cifsMountConfig["password"] = findSensitiveInfoForMountConfig("password", "user_name", *config.CifsMountConfiguration.Username, "cifs_mount", d) - cifsMountConfig["source"] = *config.CifsMountConfiguration.Source - cifsMountConfig["relative_mount_path"] = *config.CifsMountConfiguration.RelativeMountPath + cifsMountConfig["user_name"] = config.CifsMountConfiguration.Username + cifsMountConfig["password"] = findSensitiveInfoForMountConfig("password", "user_name", config.CifsMountConfiguration.Username, "cifs_mount", d) + cifsMountConfig["source"] = config.CifsMountConfiguration.Source + cifsMountConfig["relative_mount_path"] = config.CifsMountConfiguration.RelativeMountPath if config.CifsMountConfiguration.MountOptions != nil { cifsMountConfig["mount_options"] = *config.CifsMountConfiguration.MountOptions @@ -382,8 +384,8 @@ func flattenBatchPoolMountConfig(d *pluginsdk.ResourceData, config *batch.MountC nfsMountConfigList := make([]interface{}, 0) nfsMountConfig := make(map[string]interface{}) - nfsMountConfig["source"] = *config.NfsMountConfiguration.Source - nfsMountConfig["relative_mount_path"] = *config.NfsMountConfiguration.RelativeMountPath + nfsMountConfig["source"] = config.NfsMountConfiguration.Source + nfsMountConfig["relative_mount_path"] = config.NfsMountConfiguration.RelativeMountPath if config.NfsMountConfiguration.MountOptions != nil { nfsMountConfig["mount_options"] = *config.NfsMountConfiguration.MountOptions @@ -398,23 +400,25 @@ func flattenBatchPoolMountConfig(d *pluginsdk.ResourceData, config *batch.MountC return mountConfig } -func flattenBatchPoolIdentityReferenceToIdentityID(ref *batch.ComputeNodeIdentityReference) string { - if ref != nil && ref.ResourceID != nil { - return *ref.ResourceID +func flattenBatchPoolIdentityReferenceToIdentityID(ref *pool.ComputeNodeIdentityReference) string { + if ref != nil && ref.ResourceId != nil { + return *ref.ResourceId } return "" } -func flattenBatchPoolUserAccount(d *pluginsdk.ResourceData, account *batch.UserAccount) map[string]interface{} { +func flattenBatchPoolUserAccount(d *pluginsdk.ResourceData, account *pool.UserAccount) map[string]interface{} { userAccount := make(map[string]interface{}) - userAccount["name"] = *account.Name - userAccount["elevation_level"] = string(account.ElevationLevel) + userAccount["name"] = account.Name + if account.ElevationLevel != nil { + userAccount["elevation_level"] = string(*account.ElevationLevel) + } userAccountIndex := -1 if num, ok := d.GetOk("user_accounts.#"); ok { n := num.(int) for i := 0; i < n; i++ { - if src, nameOk := d.GetOk(fmt.Sprintf("user_accounts.%d.name", i)); nameOk && src == *account.Name { + if src, nameOk := d.GetOk(fmt.Sprintf("user_accounts.%d.name", i)); nameOk && src == account.Name { userAccount["password"] = d.Get(fmt.Sprintf("user_accounts.%d.password", i)).(string) userAccountIndex = i break @@ -425,8 +429,8 @@ func flattenBatchPoolUserAccount(d *pluginsdk.ResourceData, account *batch.UserA if account.LinuxUserConfiguration != nil { linuxUserConfig := make(map[string]interface{}) - if account.LinuxUserConfiguration.UID != nil { - linuxUserConfig["uid"] = *account.LinuxUserConfiguration.UID + if account.LinuxUserConfiguration.Uid != nil { + linuxUserConfig["uid"] = *account.LinuxUserConfiguration.Uid linuxUserConfig["gid"] = *account.LinuxUserConfiguration.Gid } @@ -443,7 +447,9 @@ func flattenBatchPoolUserAccount(d *pluginsdk.ResourceData, account *batch.UserA if account.WindowsUserConfiguration != nil { loginMode := make(map[string]interface{}) - loginMode["login_mode"] = string(account.WindowsUserConfiguration.LoginMode) + if account.WindowsUserConfiguration.LoginMode != nil { + loginMode["login_mode"] = string(*account.WindowsUserConfiguration.LoginMode) + } userAccount["windows_user_configuration"] = []interface{}{ loginMode, } @@ -452,17 +458,17 @@ func flattenBatchPoolUserAccount(d *pluginsdk.ResourceData, account *batch.UserA } // ExpandBatchPoolImageReference expands Batch pool image reference -func ExpandBatchPoolImageReference(list []interface{}) (*batch.ImageReference, error) { +func ExpandBatchPoolImageReference(list []interface{}) (*pool.ImageReference, error) { if len(list) == 0 || list[0] == nil { - return nil, fmt.Errorf("Error: storage image reference should be defined") + return nil, fmt.Errorf("storage image reference should be defined") } storageImageRef := list[0].(map[string]interface{}) - imageRef := &batch.ImageReference{} + imageRef := &pool.ImageReference{} if storageImageRef["id"] != nil && storageImageRef["id"] != "" { storageImageRefID := storageImageRef["id"].(string) - imageRef.ID = &storageImageRefID + imageRef.Id = &storageImageRefID } if storageImageRef["offer"] != nil && storageImageRef["offer"] != "" { @@ -489,7 +495,7 @@ func ExpandBatchPoolImageReference(list []interface{}) (*batch.ImageReference, e } // ExpandBatchPoolContainerConfiguration expands the Batch pool container configuration -func ExpandBatchPoolContainerConfiguration(list []interface{}) (*batch.ContainerConfiguration, error) { +func ExpandBatchPoolContainerConfiguration(list []interface{}) (*pool.ContainerConfiguration, error) { if len(list) == 0 || list[0] == nil { return nil, nil } @@ -501,8 +507,8 @@ func ExpandBatchPoolContainerConfiguration(list []interface{}) (*batch.Container return nil, err } - obj := &batch.ContainerConfiguration{ - Type: utils.String(block["type"].(string)), + obj := &pool.ContainerConfiguration{ + Type: pool.ContainerType(block["type"].(string)), ContainerRegistries: containerRegistries, ContainerImageNames: utils.ExpandStringSlice(block["container_image_names"].(*pluginsdk.Set).List()), } @@ -510,8 +516,8 @@ func ExpandBatchPoolContainerConfiguration(list []interface{}) (*batch.Container return obj, nil } -func expandBatchPoolContainerRegistries(list []interface{}) (*[]batch.ContainerRegistry, error) { - result := []batch.ContainerRegistry{} +func expandBatchPoolContainerRegistries(list []interface{}) (*[]pool.ContainerRegistry, error) { + result := []pool.ContainerRegistry{} for _, tempItem := range list { item := tempItem.(map[string]interface{}) @@ -524,25 +530,25 @@ func expandBatchPoolContainerRegistries(list []interface{}) (*[]batch.ContainerR return &result, nil } -func expandBatchPoolContainerRegistry(ref map[string]interface{}) (*batch.ContainerRegistry, error) { +func expandBatchPoolContainerRegistry(ref map[string]interface{}) (*pool.ContainerRegistry, error) { if len(ref) == 0 { - return nil, fmt.Errorf("Error: container registry reference should be defined") + return nil, fmt.Errorf("container registry reference should be defined") } - containerRegistry := batch.ContainerRegistry{} + containerRegistry := pool.ContainerRegistry{} if v := ref["registry_server"]; v != nil && v != "" { containerRegistry.RegistryServer = pointer.FromString(v.(string)) } if v := ref["user_name"]; v != nil && v != "" { - containerRegistry.UserName = pointer.FromString(v.(string)) + containerRegistry.Username = pointer.FromString(v.(string)) } if v := ref["password"]; v != nil && v != "" { containerRegistry.Password = pointer.FromString(v.(string)) } if v := ref["user_assigned_identity_id"]; v != nil && v != "" { - containerRegistry.IdentityReference = &batch.ComputeNodeIdentityReference{ - ResourceID: pointer.FromString(v.(string)), + containerRegistry.IdentityReference = &pool.ComputeNodeIdentityReference{ + ResourceId: pointer.FromString(v.(string)), } } @@ -550,8 +556,8 @@ func expandBatchPoolContainerRegistry(ref map[string]interface{}) (*batch.Contai } // ExpandBatchPoolCertificateReferences expands Batch pool certificate references -func ExpandBatchPoolCertificateReferences(list []interface{}) (*[]batch.CertificateReference, error) { - var result []batch.CertificateReference +func ExpandBatchPoolCertificateReferences(list []interface{}) (*[]pool.CertificateReference, error) { + var result []pool.CertificateReference for _, tempItem := range list { item := tempItem.(map[string]interface{}) @@ -564,7 +570,7 @@ func ExpandBatchPoolCertificateReferences(list []interface{}) (*[]batch.Certific return &result, nil } -func expandBatchPoolCertificateReference(ref map[string]interface{}) (*batch.CertificateReference, error) { +func expandBatchPoolCertificateReference(ref map[string]interface{}) (*pool.CertificateReference, error) { if len(ref) == 0 { return nil, fmt.Errorf("Error: storage image reference should be defined") } @@ -573,16 +579,16 @@ func expandBatchPoolCertificateReference(ref map[string]interface{}) (*batch.Cer storeLocation := ref["store_location"].(string) storeName := ref["store_name"].(string) visibilityRefs := ref["visibility"].(*pluginsdk.Set) - var visibility []batch.CertificateVisibility + var visibility []pool.CertificateVisibility if visibilityRefs != nil { for _, visibilityRef := range visibilityRefs.List() { - visibility = append(visibility, batch.CertificateVisibility(visibilityRef.(string))) + visibility = append(visibility, pool.CertificateVisibility(visibilityRef.(string))) } } - certificateReference := &batch.CertificateReference{ - ID: &id, - StoreLocation: batch.CertificateStoreLocation(storeLocation), + certificateReference := &pool.CertificateReference{ + Id: id, + StoreLocation: pointer.To(pool.CertificateStoreLocation(storeLocation)), StoreName: &storeName, Visibility: &visibility, } @@ -590,7 +596,7 @@ func expandBatchPoolCertificateReference(ref map[string]interface{}) (*batch.Cer } // ExpandBatchPoolStartTask expands Batch pool start task -func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { +func ExpandBatchPoolStartTask(list []interface{}) (*pool.StartTask, error) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("batch pool start task should be defined") } @@ -599,10 +605,10 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { startTaskCmdLine := startTaskValue["command_line"].(string) - maxTaskRetryCount := int32(1) + maxTaskRetryCount := int64(1) if v := startTaskValue["task_retry_maximum"].(int); v > 0 { - maxTaskRetryCount = int32(v) + maxTaskRetryCount = int64(v) } waitForSuccess := startTaskValue["wait_for_success"].(bool) @@ -613,15 +619,15 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { } userIdentityValue := userIdentityList[0].(map[string]interface{}) - userIdentity := batch.UserIdentity{} + userIdentity := pool.UserIdentity{} if autoUserValue, ok := userIdentityValue["auto_user"]; ok { autoUser := autoUserValue.([]interface{}) if len(autoUser) != 0 { autoUserMap := autoUser[0].(map[string]interface{}) - userIdentity.AutoUser = &batch.AutoUserSpecification{ - ElevationLevel: batch.ElevationLevel(autoUserMap["elevation_level"].(string)), - Scope: batch.AutoUserScope(autoUserMap["scope"].(string)), + userIdentity.AutoUser = &pool.AutoUserSpecification{ + ElevationLevel: pointer.To(pool.ElevationLevel(autoUserMap["elevation_level"].(string))), + Scope: pointer.To(pool.AutoUserScope(autoUserMap["scope"].(string))), } } } @@ -633,13 +639,13 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { } resourceFileList := startTaskValue["resource_file"].([]interface{}) - resourceFiles := make([]batch.ResourceFile, 0) + resourceFiles := make([]pool.ResourceFile, 0) for _, resourceFileValueTemp := range resourceFileList { if resourceFileValueTemp == nil { continue } resourceFileValue := resourceFileValueTemp.(map[string]interface{}) - resourceFile := batch.ResourceFile{} + resourceFile := pool.ResourceFile{} if v, ok := resourceFileValue["auto_storage_container_name"]; ok { autoStorageContainerName := v.(string) if autoStorageContainerName != "" { @@ -649,13 +655,13 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { if v, ok := resourceFileValue["storage_container_url"]; ok { storageContainerURL := v.(string) if storageContainerURL != "" { - resourceFile.StorageContainerURL = &storageContainerURL + resourceFile.StorageContainerUrl = &storageContainerURL } } if v, ok := resourceFileValue["http_url"]; ok { httpURL := v.(string) if httpURL != "" { - resourceFile.HTTPURL = &httpURL + resourceFile.HTTPUrl = &httpURL } } if v, ok := resourceFileValue["blob_prefix"]; ok { @@ -679,8 +685,8 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { if v, ok := resourceFileValue["user_assigned_identity_id"]; ok { resourceId := v.(string) if resourceId != "" { - identityReference := batch.ComputeNodeIdentityReference{ - ResourceID: utils.String(resourceId), + identityReference := pool.ComputeNodeIdentityReference{ + ResourceId: utils.String(resourceId), } resourceFile.IdentityReference = &identityReference } @@ -688,7 +694,7 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { resourceFiles = append(resourceFiles, resourceFile) } - startTask := &batch.StartTask{ + startTask := &pool.StartTask{ CommandLine: &startTaskCmdLine, MaxTaskRetryCount: &maxTaskRetryCount, WaitForSuccess: &waitForSuccess, @@ -701,23 +707,23 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { } if startTaskValue["container"] != nil && len(startTaskValue["container"].([]interface{})) > 0 { - var containerSettings batch.TaskContainerSettings + var containerSettings pool.TaskContainerSettings containerSettingsList := startTaskValue["container"].([]interface{}) if len(containerSettingsList) > 0 && containerSettingsList[0] != nil { settingMap := containerSettingsList[0].(map[string]interface{}) - containerSettings.ImageName = utils.String(settingMap["image_name"].(string)) + containerSettings.ImageName = settingMap["image_name"].(string) if containerRunOptions, ok := settingMap["run_options"]; ok { containerSettings.ContainerRunOptions = utils.String(containerRunOptions.(string)) } - if settingMap["registry"].([]interface{})[0] != nil { - containerRegMap := settingMap["registry"].([]interface{})[0].(map[string]interface{}) + if registries, ok := settingMap["registry"].([]interface{}); ok && len(registries) > 0 && registries[0] != nil { + containerRegMap := registries[0].(map[string]interface{}) if containerRegistryRef, err := expandBatchPoolContainerRegistry(containerRegMap); err == nil { containerSettings.Registry = containerRegistryRef } } if workingDir, ok := settingMap["working_directory"]; ok { - containerSettings.WorkingDirectory = batch.ContainerWorkingDirectory(workingDir.(string)) + containerSettings.WorkingDirectory = pointer.To(pool.ContainerWorkingDirectory(workingDir.(string))) } } startTask.ContainerSettings = &containerSettings @@ -726,21 +732,21 @@ func ExpandBatchPoolStartTask(list []interface{}) (*batch.StartTask, error) { return startTask, nil } -func expandBatchPoolVirtualMachineConfig(d *pluginsdk.ResourceData) (*batch.VirtualMachineConfiguration, error) { - var result batch.VirtualMachineConfiguration +func expandBatchPoolVirtualMachineConfig(d *pluginsdk.ResourceData) (*pool.VirtualMachineConfiguration, error) { + var result pool.VirtualMachineConfiguration - result.NodeAgentSkuID = utils.String(d.Get("node_agent_sku_id").(string)) + result.NodeAgentSkuId = d.Get("node_agent_sku_id").(string) storageImageReferenceSet := d.Get("storage_image_reference").([]interface{}) if imageReference, err := ExpandBatchPoolImageReference(storageImageReferenceSet); err == nil { if imageReference != nil { // if an image reference ID is specified, the user wants use a custom image. This property is mutually exclusive with other properties. - if imageReference.ID != nil && (imageReference.Offer != nil || imageReference.Publisher != nil || imageReference.Sku != nil || imageReference.Version != nil) { + if imageReference.Id != nil && (imageReference.Offer != nil || imageReference.Publisher != nil || imageReference.Sku != nil || imageReference.Version != nil) { return nil, fmt.Errorf("properties version, offer, publish cannot be defined when using a custom image id") - } else if imageReference.ID == nil && (imageReference.Offer == nil || imageReference.Publisher == nil || imageReference.Sku == nil || imageReference.Version == nil) { + } else if imageReference.Id == nil && (imageReference.Offer == nil || imageReference.Publisher == nil || imageReference.Sku == nil || imageReference.Version == nil) { return nil, fmt.Errorf("properties version, offer, publish and sku are mandatory when not using a custom image") } - result.ImageReference = imageReference + result.ImageReference = *imageReference } } else { return nil, fmt.Errorf("storage_image_reference either is empty or contains parsing errors") @@ -783,45 +789,45 @@ func expandBatchPoolVirtualMachineConfig(d *pluginsdk.ResourceData) (*batch.Virt return &result, nil } -func expandBatchPoolOSDisk(ref interface{}) (*batch.OSDisk, error) { +func expandBatchPoolOSDisk(ref interface{}) (*pool.OSDisk, error) { if ref == nil { return nil, fmt.Errorf("os_disk_placement is empty") } - return &batch.OSDisk{ - EphemeralOSDiskSettings: &batch.DiffDiskSettings{ - Placement: batch.DiffDiskPlacement(ref.(string)), + return &pool.OSDisk{ + EphemeralOSDiskSettings: &pool.DiffDiskSettings{ + Placement: pointer.To(pool.DiffDiskPlacement(ref.(string))), }, }, nil } -func expandBatchPoolNodeReplacementConfig(list []interface{}) (*batch.NodePlacementConfiguration, error) { +func expandBatchPoolNodeReplacementConfig(list []interface{}) (*pool.NodePlacementConfiguration, error) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("node_placement is empty") } item := list[0].(map[string]interface{})["policy"].(string) - return &batch.NodePlacementConfiguration{ - Policy: batch.NodePlacementPolicyType(item), + return &pool.NodePlacementConfiguration{ + Policy: pointer.To(pool.NodePlacementPolicyType(item)), }, nil } -func expandBatchPoolWindowsConfiguration(list []interface{}) (*batch.WindowsConfiguration, error) { +func expandBatchPoolWindowsConfiguration(list []interface{}) (*pool.WindowsConfiguration, error) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("windows is empty") } item := list[0].(map[string]interface{})["enable_automatic_updates"].(bool) - return &batch.WindowsConfiguration{ + return &pool.WindowsConfiguration{ EnableAutomaticUpdates: utils.Bool(item), }, nil } -func expandBatchPoolExtensions(list []interface{}) (*[]batch.VMExtension, error) { +func expandBatchPoolExtensions(list []interface{}) (*[]pool.VmExtension, error) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("extensions is empty") } - var result []batch.VMExtension + var result []pool.VmExtension for _, tempItem := range list { item := tempItem.(map[string]interface{}) @@ -835,15 +841,15 @@ func expandBatchPoolExtensions(list []interface{}) (*[]batch.VMExtension, error) return &result, nil } -func expandBatchPoolExtension(ref map[string]interface{}) (*batch.VMExtension, error) { +func expandBatchPoolExtension(ref map[string]interface{}) (*pool.VmExtension, error) { if len(ref) == 0 { return nil, fmt.Errorf("extension is empty") } - result := batch.VMExtension{ - Name: utils.String(ref["name"].(string)), - Publisher: utils.String(ref["publisher"].(string)), - Type: utils.String(ref["type"].(string)), + result := pool.VmExtension{ + Name: ref["name"].(string), + Publisher: ref["publisher"].(string), + Type: ref["type"].(string), } if autoUpgradeMinorVersion, ok := ref["auto_upgrade_minor_version"]; ok { @@ -855,11 +861,11 @@ func expandBatchPoolExtension(ref map[string]interface{}) (*batch.VMExtension, e } if settings, ok := ref["settings_json"]; ok { - result.Settings = utils.String(settings.(string)) + result.Settings = pointer.To(settings) } if protectedSettings, ok := ref["protected_settings"]; ok { - result.ProtectedSettings = utils.String(protectedSettings.(string)) + result.ProtectedSettings = pointer.To(protectedSettings) } if tmpItem, ok := ref["provision_after_extensions"]; ok { @@ -869,18 +875,18 @@ func expandBatchPoolExtension(ref map[string]interface{}) (*batch.VMExtension, e return &result, nil } -func expandBatchPoolDiskEncryptionConfiguration(list []interface{}) (*batch.DiskEncryptionConfiguration, error) { +func expandBatchPoolDiskEncryptionConfiguration(list []interface{}) (*pool.DiskEncryptionConfiguration, error) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("disk_encryption is empty") } - var result batch.DiskEncryptionConfiguration + var result pool.DiskEncryptionConfiguration - var targetList []batch.DiskEncryptionTarget + var targetList []pool.DiskEncryptionTarget for _, tempItem := range list { item := tempItem.(map[string]interface{}) if dataDiskEncryptionTarget, ok := item["disk_encryption_target"]; ok { - targetList = append(targetList, batch.DiskEncryptionTarget(dataDiskEncryptionTarget.(string))) + targetList = append(targetList, pool.DiskEncryptionTarget(dataDiskEncryptionTarget.(string))) } else { return nil, fmt.Errorf("disk_encryption_target either is empty or contains parsing errors") } @@ -890,11 +896,11 @@ func expandBatchPoolDiskEncryptionConfiguration(list []interface{}) (*batch.Disk return &result, nil } -func expandBatchPoolDataDisks(list []interface{}) (*[]batch.DataDisk, error) { +func expandBatchPoolDataDisks(list []interface{}) (*[]pool.DataDisk, error) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("data_disk is empty") } - var result []batch.DataDisk + var result []pool.DataDisk for _, tempItem := range list { item := tempItem.(map[string]interface{}) @@ -904,23 +910,23 @@ func expandBatchPoolDataDisks(list []interface{}) (*[]batch.DataDisk, error) { return &result, nil } -func expandBatchPoolDataDisk(ref map[string]interface{}) batch.DataDisk { - return batch.DataDisk{ - Lun: utils.Int32(int32(ref["lun"].(int))), - Caching: batch.CachingType(ref["caching"].(string)), - DiskSizeGB: utils.Int32(int32(ref["disk_size_gb"].(int))), - StorageAccountType: batch.StorageAccountType(ref["storage_account_type"].(string)), +func expandBatchPoolDataDisk(ref map[string]interface{}) pool.DataDisk { + return pool.DataDisk{ + Lun: int64(ref["lun"].(int)), + Caching: pointer.To(pool.CachingType(ref["caching"].(string))), + DiskSizeGB: int64(ref["disk_size_gb"].(int)), + StorageAccountType: pointer.To(pool.StorageAccountType(ref["storage_account_type"].(string))), } } -func expandCommonEnvironmentProperties(env map[string]interface{}) *[]batch.EnvironmentSetting { - envSettings := make([]batch.EnvironmentSetting, 0) +func expandCommonEnvironmentProperties(env map[string]interface{}) *[]pool.EnvironmentSetting { + envSettings := make([]pool.EnvironmentSetting, 0) for k, v := range env { theValue := v.(string) theKey := k - envSetting := batch.EnvironmentSetting{ - Name: &theKey, + envSetting := pool.EnvironmentSetting{ + Name: theKey, Value: &theValue, } @@ -930,15 +936,15 @@ func expandCommonEnvironmentProperties(env map[string]interface{}) *[]batch.Envi } // ExpandBatchMetaData expands Batch pool metadata -func ExpandBatchMetaData(input map[string]interface{}) *[]batch.MetadataItem { - output := []batch.MetadataItem{} +func ExpandBatchMetaData(input map[string]interface{}) *[]pool.MetadataItem { + output := []pool.MetadataItem{} for k, v := range input { name := k value := v.(string) - output = append(output, batch.MetadataItem{ - Name: &name, - Value: &value, + output = append(output, pool.MetadataItem{ + Name: name, + Value: value, }) } @@ -946,7 +952,7 @@ func ExpandBatchMetaData(input map[string]interface{}) *[]batch.MetadataItem { } // FlattenBatchMetaData flattens a Batch pool metadata -func FlattenBatchMetaData(metadatas *[]batch.MetadataItem) map[string]interface{} { +func FlattenBatchMetaData(metadatas *[]pool.MetadataItem) map[string]interface{} { output := make(map[string]interface{}) if metadatas == nil { @@ -954,18 +960,14 @@ func FlattenBatchMetaData(metadatas *[]batch.MetadataItem) map[string]interface{ } for _, metadata := range *metadatas { - if metadata.Name == nil || metadata.Value == nil { - continue - } - - output[*metadata.Name] = *metadata.Value + output[metadata.Name] = metadata.Value } return output } -func ExpandBatchPoolMountConfigurations(d *pluginsdk.ResourceData) (*[]batch.MountConfiguration, error) { - var result []batch.MountConfiguration +func ExpandBatchPoolMountConfigurations(d *pluginsdk.ResourceData) (*[]pool.MountConfiguration, error) { + var result []pool.MountConfiguration if mountConfigs, ok := d.GetOk("mount"); ok { mountConfigList := mountConfigs.([]interface{}) @@ -979,8 +981,8 @@ func ExpandBatchPoolMountConfigurations(d *pluginsdk.ResourceData) (*[]batch.Mou return nil, fmt.Errorf("mount either is empty or contains parsing errors") } -func expandBatchPoolMountConfiguration(ref map[string]interface{}) batch.MountConfiguration { - var result batch.MountConfiguration +func expandBatchPoolMountConfiguration(ref map[string]interface{}) pool.MountConfiguration { + var result pool.MountConfiguration if azureBlobFileSystemConfiguration, err := expandBatchPoolAzureBlobFileSystemConfiguration(ref["azure_blob_file_system"].([]interface{})); err == nil { result.AzureBlobFileSystemConfiguration = azureBlobFileSystemConfiguration } @@ -1000,16 +1002,16 @@ func expandBatchPoolMountConfiguration(ref map[string]interface{}) batch.MountCo return result } -func expandBatchPoolAzureBlobFileSystemConfiguration(list []interface{}) (*batch.AzureBlobFileSystemConfiguration, interface{}) { +func expandBatchPoolAzureBlobFileSystemConfiguration(list []interface{}) (*pool.AzureBlobFileSystemConfiguration, interface{}) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("azure_blob_file_system is empty") } configMap := list[0].(map[string]interface{}) - result := batch.AzureBlobFileSystemConfiguration{ - AccountName: utils.String(configMap["account_name"].(string)), - ContainerName: utils.String(configMap["container_name"].(string)), - RelativeMountPath: utils.String(configMap["relative_mount_path"].(string)), + result := pool.AzureBlobFileSystemConfiguration{ + AccountName: configMap["account_name"].(string), + ContainerName: configMap["container_name"].(string), + RelativeMountPath: configMap["relative_mount_path"].(string), } if accountKey, ok := configMap["account_key"]; ok { @@ -1026,17 +1028,17 @@ func expandBatchPoolAzureBlobFileSystemConfiguration(list []interface{}) (*batch return &result, nil } -func expandBatchPoolAzureFileShareConfiguration(list []interface{}) (*batch.AzureFileShareConfiguration, interface{}) { +func expandBatchPoolAzureFileShareConfiguration(list []interface{}) (*pool.AzureFileShareConfiguration, interface{}) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("azure_file_share is empty") } configMap := list[0].(map[string]interface{}) - result := batch.AzureFileShareConfiguration{ - AccountName: utils.String(configMap["account_name"].(string)), - AccountKey: utils.String(configMap["account_key"].(string)), - AzureFileURL: utils.String(configMap["azure_file_url"].(string)), - RelativeMountPath: utils.String(configMap["relative_mount_path"].(string)), + result := pool.AzureFileShareConfiguration{ + AccountName: configMap["account_name"].(string), + AccountKey: configMap["account_key"].(string), + AzureFileUrl: configMap["azure_file_url"].(string), + RelativeMountPath: configMap["relative_mount_path"].(string), } if mountOptions, ok := configMap["mount_options"]; ok { @@ -1046,17 +1048,17 @@ func expandBatchPoolAzureFileShareConfiguration(list []interface{}) (*batch.Azur return &result, nil } -func expandBatchPoolCIFSMountConfiguration(list []interface{}) (*batch.CIFSMountConfiguration, interface{}) { +func expandBatchPoolCIFSMountConfiguration(list []interface{}) (*pool.CIFSMountConfiguration, interface{}) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("cifs_mount is empty") } configMap := list[0].(map[string]interface{}) - result := batch.CIFSMountConfiguration{ - Username: utils.String(configMap["user_name"].(string)), - Source: utils.String(configMap["source"].(string)), - Password: utils.String(configMap["password"].(string)), - RelativeMountPath: utils.String(configMap["relative_mount_path"].(string)), + result := pool.CIFSMountConfiguration{ + Username: configMap["user_name"].(string), + Source: configMap["source"].(string), + Password: configMap["password"].(string), + RelativeMountPath: configMap["relative_mount_path"].(string), } if mountOptions, ok := configMap["mount_options"]; ok { @@ -1066,15 +1068,15 @@ func expandBatchPoolCIFSMountConfiguration(list []interface{}) (*batch.CIFSMount return &result, nil } -func expandBatchPoolNFSMountConfiguration(list []interface{}) (*batch.NFSMountConfiguration, interface{}) { +func expandBatchPoolNFSMountConfiguration(list []interface{}) (*pool.NFSMountConfiguration, interface{}) { if len(list) == 0 || list[0] == nil { return nil, fmt.Errorf("nfs_mount is empty") } configMap := list[0].(map[string]interface{}) - result := batch.NFSMountConfiguration{ - Source: utils.String(configMap["source"].(string)), - RelativeMountPath: utils.String(configMap["relative_mount_path"].(string)), + result := pool.NFSMountConfiguration{ + Source: configMap["source"].(string), + RelativeMountPath: configMap["relative_mount_path"].(string), } if mountOptions, ok := configMap["mount_options"]; ok { @@ -1083,37 +1085,37 @@ func expandBatchPoolNFSMountConfiguration(list []interface{}) (*batch.NFSMountCo return &result, nil } -func expandBatchPoolIdentityReference(ref map[string]interface{}) (*batch.ComputeNodeIdentityReference, error) { - var result batch.ComputeNodeIdentityReference +func expandBatchPoolIdentityReference(ref map[string]interface{}) (*pool.ComputeNodeIdentityReference, error) { + var result pool.ComputeNodeIdentityReference if iid, ok := ref["identity_id"]; ok && iid != "" { - result.ResourceID = utils.String(iid.(string)) + result.ResourceId = utils.String(iid.(string)) return &result, nil } return nil, fmt.Errorf("identity_id is empty") } // ExpandBatchPoolNetworkConfiguration expands Batch pool network configuration -func ExpandBatchPoolNetworkConfiguration(list []interface{}) (*batch.NetworkConfiguration, error) { +func ExpandBatchPoolNetworkConfiguration(list []interface{}) (*pool.NetworkConfiguration, error) { if len(list) == 0 || list[0] == nil { return nil, nil } networkConfigValue := list[0].(map[string]interface{}) - networkConfiguration := &batch.NetworkConfiguration{} + networkConfiguration := &pool.NetworkConfiguration{} if v, ok := networkConfigValue["dynamic_vnet_assignment_scope"]; ok { - networkConfiguration.DynamicVNetAssignmentScope = batch.DynamicVNetAssignmentScope(v.(string)) + networkConfiguration.DynamicVNetAssignmentScope = pointer.To(pool.DynamicVNetAssignmentScope(v.(string))) } if v, ok := networkConfigValue["subnet_id"]; ok { if value := v.(string); value != "" { - networkConfiguration.SubnetID = &value + networkConfiguration.SubnetId = &value } } if v, ok := networkConfigValue["public_ips"]; ok { if networkConfiguration.PublicIPAddressConfiguration == nil { - networkConfiguration.PublicIPAddressConfiguration = &batch.PublicIPAddressConfiguration{} + networkConfiguration.PublicIPAddressConfiguration = &pool.PublicIPAddressConfiguration{} } publicIPsRaw := v.(*pluginsdk.Set).List() @@ -1130,43 +1132,43 @@ func ExpandBatchPoolNetworkConfiguration(list []interface{}) (*batch.NetworkConf if v, ok := networkConfigValue["public_address_provisioning_type"]; ok { if networkConfiguration.PublicIPAddressConfiguration == nil { - networkConfiguration.PublicIPAddressConfiguration = &batch.PublicIPAddressConfiguration{} + networkConfiguration.PublicIPAddressConfiguration = &pool.PublicIPAddressConfiguration{} } if value := v.(string); value != "" { - networkConfiguration.PublicIPAddressConfiguration.Provision = batch.IPAddressProvisioningType(value) + networkConfiguration.PublicIPAddressConfiguration.Provision = pointer.To(pool.IPAddressProvisioningType(value)) } } return networkConfiguration, nil } -func ExpandBatchPoolTaskSchedulingPolicy(d *pluginsdk.ResourceData) (*batch.TaskSchedulingPolicy, error) { - var result batch.TaskSchedulingPolicy +func ExpandBatchPoolTaskSchedulingPolicy(d *pluginsdk.ResourceData) (*pool.TaskSchedulingPolicy, error) { + var result pool.TaskSchedulingPolicy if taskSchedulingPolicyString, ok := d.GetOk("task_scheduling_policy"); ok { taskSchedulingPolicy := taskSchedulingPolicyString.([]interface{}) if len(taskSchedulingPolicy) > 0 { item := taskSchedulingPolicy[0].(map[string]interface{}) - result.NodeFillType = batch.ComputeNodeFillType(item["node_fill_type"].(string)) + result.NodeFillType = pool.ComputeNodeFillType(item["node_fill_type"].(string)) } return &result, nil } return nil, fmt.Errorf("task_scheduling_policy either is empty or contains parsing errors") } -func expandPoolEndpointConfiguration(list []interface{}) (*batch.PoolEndpointConfiguration, error) { +func expandPoolEndpointConfiguration(list []interface{}) (*pool.PoolEndpointConfiguration, error) { if len(list) == 0 || list[0] == nil { return nil, nil } - inboundNatPools := make([]batch.InboundNatPool, len(list)) + inboundNatPools := make([]pool.InboundNatPool, len(list)) for i, inboundNatPoolsValue := range list { inboundNatPool := inboundNatPoolsValue.(map[string]interface{}) name := inboundNatPool["name"].(string) - protocol := batch.InboundEndpointProtocol(inboundNatPool["protocol"].(string)) + protocol := pool.InboundEndpointProtocol(inboundNatPool["protocol"].(string)) backendPort := int32(inboundNatPool["backend_port"].(int)) frontendPortRange := inboundNatPool["frontend_port_range"].(string) parts := strings.Split(frontendPortRange, "-") @@ -1181,37 +1183,37 @@ func expandPoolEndpointConfiguration(list []interface{}) (*batch.PoolEndpointCon networkSecurityGroupRules := expandPoolNetworkSecurityGroupRule(inboundNatPool["network_security_group_rules"].([]interface{})) - inboundNatPools[i] = batch.InboundNatPool{ - Name: &name, + inboundNatPools[i] = pool.InboundNatPool{ + Name: name, Protocol: protocol, - BackendPort: &backendPort, - FrontendPortRangeStart: utils.Int32(int32(frontendPortRangeStart)), - FrontendPortRangeEnd: utils.Int32(int32(frontendPortRangeEnd)), + BackendPort: int64(backendPort), + FrontendPortRangeStart: int64(frontendPortRangeStart), + FrontendPortRangeEnd: int64(frontendPortRangeEnd), NetworkSecurityGroupRules: &networkSecurityGroupRules, } } - return &batch.PoolEndpointConfiguration{ - InboundNatPools: &inboundNatPools, + return &pool.PoolEndpointConfiguration{ + InboundNatPools: inboundNatPools, }, nil } -func expandPoolNetworkSecurityGroupRule(list []interface{}) []batch.NetworkSecurityGroupRule { +func expandPoolNetworkSecurityGroupRule(list []interface{}) []pool.NetworkSecurityGroupRule { if len(list) == 0 || list[0] == nil { - return []batch.NetworkSecurityGroupRule{} + return []pool.NetworkSecurityGroupRule{} } - networkSecurityGroupRule := make([]batch.NetworkSecurityGroupRule, 0) + networkSecurityGroupRule := make([]pool.NetworkSecurityGroupRule, 0) for _, groupRule := range list { groupRuleMap := groupRule.(map[string]interface{}) priority := int32(groupRuleMap["priority"].(int)) sourceAddressPrefix := groupRuleMap["source_address_prefix"].(string) - access := batch.NetworkSecurityGroupRuleAccess(groupRuleMap["access"].(string)) + access := pool.NetworkSecurityGroupRuleAccess(groupRuleMap["access"].(string)) - networkSecurityGroupRuleObject := batch.NetworkSecurityGroupRule{ - Priority: &priority, - SourceAddressPrefix: &sourceAddressPrefix, + networkSecurityGroupRuleObject := pool.NetworkSecurityGroupRule{ + Priority: int64(priority), + SourceAddressPrefix: sourceAddressPrefix, Access: access, } @@ -1224,9 +1226,9 @@ func expandPoolNetworkSecurityGroupRule(list []interface{}) []batch.NetworkSecur networkSecurityGroupRuleObject.SourcePortRanges = &portRangesResult } - networkSecurityGroupRule = append(networkSecurityGroupRule, batch.NetworkSecurityGroupRule{ - Priority: &priority, - SourceAddressPrefix: &sourceAddressPrefix, + networkSecurityGroupRule = append(networkSecurityGroupRule, pool.NetworkSecurityGroupRule{ + Priority: int64(priority), + SourceAddressPrefix: sourceAddressPrefix, Access: access, }) } @@ -1234,52 +1236,41 @@ func expandPoolNetworkSecurityGroupRule(list []interface{}) []batch.NetworkSecur return networkSecurityGroupRule } -func flattenBatchPoolNetworkConfiguration(input *batch.NetworkConfiguration) []interface{} { +func flattenBatchPoolNetworkConfiguration(input *pool.NetworkConfiguration) []interface{} { if input == nil { return []interface{}{} } subnetId := "" - if input.SubnetID != nil { - subnetId = *input.SubnetID + if input.SubnetId != nil { + subnetId = *input.SubnetId } publicIPAddressIds := make([]interface{}, 0) publicAddressProvisioningType := "" if config := input.PublicIPAddressConfiguration; config != nil { publicIPAddressIds = utils.FlattenStringSlice(config.IPAddressIds) - publicAddressProvisioningType = string(config.Provision) + if config.Provision != nil { + publicAddressProvisioningType = string(*config.Provision) + } } endpointConfigs := make([]interface{}, 0) if config := input.EndpointConfiguration; config != nil && config.InboundNatPools != nil { - for _, inboundNatPool := range *config.InboundNatPools { - name := "" - if inboundNatPool.Name != nil { - name = *inboundNatPool.Name - } + for _, inboundNatPool := range config.InboundNatPools { + name := inboundNatPool.Name - backendPort := 0 - if inboundNatPool.BackendPort != nil { - backendPort = int(*inboundNatPool.BackendPort) - } + backendPort := inboundNatPool.BackendPort - frontendPortRange := "" - if inboundNatPool.FrontendPortRangeStart != nil && inboundNatPool.FrontendPortRangeEnd != nil { - frontendPortRange = fmt.Sprintf("%d-%d", *inboundNatPool.FrontendPortRangeStart, *inboundNatPool.FrontendPortRangeEnd) - } + frontendPortRange := fmt.Sprintf("%d-%d", inboundNatPool.FrontendPortRangeStart, inboundNatPool.FrontendPortRangeEnd) networkSecurities := make([]interface{}, 0) if sgRules := inboundNatPool.NetworkSecurityGroupRules; sgRules != nil { for _, networkSecurity := range *sgRules { - priority := 0 - if networkSecurity.Priority != nil { - priority = int(*networkSecurity.Priority) - } - sourceAddressPrefix := "" - if networkSecurity.SourceAddressPrefix != nil { - sourceAddressPrefix = *networkSecurity.SourceAddressPrefix - } + priority := networkSecurity.Priority + + sourceAddressPrefix := networkSecurity.SourceAddressPrefix + sourcePortRanges := make([]interface{}, 0) if networkSecurity.SourcePortRanges != nil { for _, sourcePortRange := range *networkSecurity.SourcePortRanges { @@ -1305,9 +1296,14 @@ func flattenBatchPoolNetworkConfiguration(input *batch.NetworkConfiguration) []i } } + dynamicVNetAssignmentScope := "" + if input.DynamicVNetAssignmentScope != nil { + dynamicVNetAssignmentScope = string(*input.DynamicVNetAssignmentScope) + } + return []interface{}{ map[string]interface{}{ - "dynamic_vnet_assignment_scope": string(input.DynamicVNetAssignmentScope), + "dynamic_vnet_assignment_scope": dynamicVNetAssignmentScope, "endpoint_configuration": endpointConfigs, "public_address_provisioning_type": publicAddressProvisioningType, "public_ips": pluginsdk.NewSet(pluginsdk.HashString, publicIPAddressIds), @@ -1316,8 +1312,8 @@ func flattenBatchPoolNetworkConfiguration(input *batch.NetworkConfiguration) []i } } -func ExpandBatchPoolUserAccounts(d *pluginsdk.ResourceData) (*[]batch.UserAccount, error) { - var result []batch.UserAccount +func ExpandBatchPoolUserAccounts(d *pluginsdk.ResourceData) (*[]pool.UserAccount, error) { + var result []pool.UserAccount if userAccountList, ok := d.GetOk("user_accounts"); ok { userAccounts := userAccountList.([]interface{}) @@ -1333,25 +1329,25 @@ func ExpandBatchPoolUserAccounts(d *pluginsdk.ResourceData) (*[]batch.UserAccoun return nil, fmt.Errorf("user_accounts either is empty or contains parsing errors") } -func expandBatchPoolUserAccount(ref map[string]interface{}) batch.UserAccount { - result := batch.UserAccount{ - Name: utils.String(ref["name"].(string)), - Password: utils.String(ref["password"].(string)), - ElevationLevel: batch.ElevationLevel(ref["elevation_level"].(string)), +func expandBatchPoolUserAccount(ref map[string]interface{}) pool.UserAccount { + result := pool.UserAccount{ + Name: ref["name"].(string), + Password: ref["password"].(string), + ElevationLevel: pointer.To(pool.ElevationLevel(ref["elevation_level"].(string))), } if linuxUserConfig, ok := ref["linux_user_configuration"]; ok { if linuxUserConfig != nil && len(linuxUserConfig.([]interface{})) > 0 { linuxUserConfigMap := linuxUserConfig.([]interface{})[0].(map[string]interface{}) - var linuxUserConfig batch.LinuxUserConfiguration + var linuxUserConfig pool.LinuxUserConfiguration if uid, ok := linuxUserConfigMap["uid"]; ok { - linuxUserConfig = batch.LinuxUserConfiguration{ - UID: utils.Int32(int32(uid.(int))), - Gid: utils.Int32(int32(linuxUserConfigMap["gid"].(int))), + linuxUserConfig = pool.LinuxUserConfiguration{ + Uid: utils.Int64(int64(uid.(int))), + Gid: utils.Int64(int64(linuxUserConfigMap["gid"].(int))), } } if sshPrivateKey, ok := linuxUserConfigMap["ssh_private_key"]; ok { - linuxUserConfig.SSHPrivateKey = utils.String(sshPrivateKey.(string)) + linuxUserConfig.SshPrivateKey = utils.String(sshPrivateKey.(string)) } result.LinuxUserConfiguration = &linuxUserConfig } @@ -1360,8 +1356,8 @@ func expandBatchPoolUserAccount(ref map[string]interface{}) batch.UserAccount { if winUserConfig, ok := ref["windows_user_configuration"]; ok { if winUserConfig != nil && len(winUserConfig.([]interface{})) > 0 { winUserConfigMap := winUserConfig.([]interface{})[0].(map[string]interface{}) - result.WindowsUserConfiguration = &batch.WindowsUserConfiguration{ - LoginMode: batch.LoginMode(winUserConfigMap["login_mode"].(string)), + result.WindowsUserConfiguration = &pool.WindowsUserConfiguration{ + LoginMode: pointer.To(pool.LoginMode(winUserConfigMap["login_mode"].(string))), } } } diff --git a/internal/services/batch/batch_pool_data_source.go b/internal/services/batch/batch_pool_data_source.go index 0568b4c02445..ec7827bf3d17 100644 --- a/internal/services/batch/batch_pool_data_source.go +++ b/internal/services/batch/batch_pool_data_source.go @@ -4,14 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceBatchPool() *pluginsdk.Resource { @@ -293,8 +293,9 @@ func dataSourceBatchPool() *pluginsdk.Resource { Computed: true, }, "password": { - Type: pluginsdk.TypeString, - Computed: true, + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, }, "elevation_level": { Type: pluginsdk.TypeString, @@ -314,8 +315,9 @@ func dataSourceBatchPool() *pluginsdk.Resource { Computed: true, }, "ssh_private_key": { - Type: pluginsdk.TypeString, - Computed: true, + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, }, }, }, @@ -433,8 +435,9 @@ func dataSourceBatchPool() *pluginsdk.Resource { Computed: true, }, "password": { - Type: pluginsdk.TypeString, - Computed: true, + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, }, }, }, @@ -719,11 +722,11 @@ func dataSourceBatchPoolRead(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + id := pool.NewPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) @@ -731,142 +734,157 @@ func dataSourceBatchPoolRead(d *pluginsdk.ResourceData, meta interface{}) error d.SetId(id.ID()) - d.Set("name", id.Name) + d.Set("name", id.PoolName) d.Set("account_name", id.BatchAccountName) - d.Set("resource_group_name", id.ResourceGroup) - - if props := resp.PoolProperties; props != nil { - d.Set("vm_size", props.VMSize) - d.Set("max_tasks_per_node", props.TaskSlotsPerNode) - d.Set("inter_node_communication", string(props.InterNodeCommunication)) - - if scaleSettings := props.ScaleSettings; scaleSettings != nil { - if err := d.Set("auto_scale", flattenBatchPoolAutoScaleSettings(scaleSettings.AutoScale)); err != nil { - return fmt.Errorf("flattening `auto_scale`: %+v", err) - } - if err := d.Set("fixed_scale", flattenBatchPoolFixedScaleSettings(d, scaleSettings.FixedScale)); err != nil { - return fmt.Errorf("flattening `fixed_scale `: %+v", err) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("display_name", props.DisplayName) + d.Set("vm_size", props.VMSize) + d.Set("inter_node_communication", props.InterNodeCommunication) + d.Set("max_tasks_per_node", props.TaskSlotsPerNode) + + if scaleSettings := props.ScaleSettings; scaleSettings != nil { + if err := d.Set("auto_scale", flattenBatchPoolAutoScaleSettings(scaleSettings.AutoScale)); err != nil { + return fmt.Errorf("flattening `auto_scale`: %+v", err) + } + if err := d.Set("fixed_scale", flattenBatchPoolFixedScaleSettings(d, scaleSettings.FixedScale)); err != nil { + return fmt.Errorf("flattening `fixed_scale `: %+v", err) + } } - } - if props.UserAccounts != nil { - userAccounts := make([]interface{}, 0) - for _, userAccount := range *props.UserAccounts { - userAccounts = append(userAccounts, flattenBatchPoolUserAccount(d, &userAccount)) + if props.UserAccounts != nil { + userAccounts := make([]interface{}, 0) + for _, userAccount := range *props.UserAccounts { + userAccounts = append(userAccounts, flattenBatchPoolUserAccount(d, &userAccount)) + } + d.Set("user_accounts", userAccounts) } - d.Set("user_accounts", userAccounts) - } - if props.MountConfiguration != nil { - mountConfigs := make([]interface{}, 0) - for _, mountConfig := range *props.MountConfiguration { - mountConfigs = append(mountConfigs, flattenBatchPoolMountConfig(d, &mountConfig)) + if props.MountConfiguration != nil { + mountConfigs := make([]interface{}, 0) + for _, mountConfig := range *props.MountConfiguration { + mountConfigs = append(mountConfigs, flattenBatchPoolMountConfig(d, &mountConfig)) + } + d.Set("mount_configuration", mountConfigs) } - d.Set("mount_configuration", mountConfigs) - } - if props.DeploymentConfiguration != nil { - if props.DeploymentConfiguration.VirtualMachineConfiguration != nil { - config := props.DeploymentConfiguration.VirtualMachineConfiguration - if config.ContainerConfiguration != nil { - d.Set("container_configuration", flattenBatchPoolContainerConfiguration(d, config.ContainerConfiguration)) - } - if config.DataDisks != nil { - dataDisks := make([]interface{}, 0) - for _, item := range *config.DataDisks { - dataDisk := make(map[string]interface{}) - dataDisk["lun"] = *item.Lun - dataDisk["disk_size_gb"] = *item.DiskSizeGB - dataDisk["caching"] = string(item.Caching) - dataDisk["storage_account_type"] = string(item.StorageAccountType) - dataDisks = append(dataDisks, dataDisk) + if props.DeploymentConfiguration != nil { + if props.DeploymentConfiguration.VirtualMachineConfiguration != nil { + config := props.DeploymentConfiguration.VirtualMachineConfiguration + if config.ContainerConfiguration != nil { + d.Set("container_configuration", flattenBatchPoolContainerConfiguration(d, config.ContainerConfiguration)) } - d.Set("data_disks", dataDisks) - } - if config.DiskEncryptionConfiguration != nil { - diskEncryptionConfiguration := make([]interface{}, 0) - if config.DiskEncryptionConfiguration.Targets != nil { - for _, item := range *config.DiskEncryptionConfiguration.Targets { - target := make(map[string]interface{}) - target["disk_encryption_target"] = string(item) - diskEncryptionConfiguration = append(diskEncryptionConfiguration, target) + if config.DataDisks != nil { + dataDisks := make([]interface{}, 0) + for _, item := range *config.DataDisks { + dataDisk := make(map[string]interface{}) + dataDisk["lun"] = item.Lun + dataDisk["disk_size_gb"] = item.DiskSizeGB + + caching := "" + if item.Caching != nil { + caching = string(*item.Caching) + } + dataDisk["caching"] = caching + + storageAccountType := "" + if item.StorageAccountType != nil { + storageAccountType = string(*item.StorageAccountType) + } + dataDisk["storage_account_type"] = storageAccountType + + dataDisks = append(dataDisks, dataDisk) } + d.Set("data_disks", dataDisks) } - d.Set("disk_encryption", diskEncryptionConfiguration) - } - if config.Extensions != nil { - extensions := make([]interface{}, 0) - n := len(*config.Extensions) - for _, item := range *config.Extensions { - extension := make(map[string]interface{}) - extension["name"] = *item.Name - extension["publisher"] = *item.Publisher - extension["type"] = *item.Type - if item.TypeHandlerVersion != nil { - extension["type_handler_version"] = *item.TypeHandlerVersion - } - if item.AutoUpgradeMinorVersion != nil { - extension["auto_upgrade_minor_version"] = *item.AutoUpgradeMinorVersion - } - if item.Settings != nil { - extension["settings_json"] = item.Settings + if config.DiskEncryptionConfiguration != nil { + diskEncryptionConfiguration := make([]interface{}, 0) + if config.DiskEncryptionConfiguration.Targets != nil { + for _, item := range *config.DiskEncryptionConfiguration.Targets { + target := make(map[string]interface{}) + target["disk_encryption_target"] = string(item) + diskEncryptionConfiguration = append(diskEncryptionConfiguration, target) + } } + d.Set("disk_encryption", diskEncryptionConfiguration) + } + if config.Extensions != nil { + extensions := make([]interface{}, 0) + n := len(*config.Extensions) + for _, item := range *config.Extensions { + extension := make(map[string]interface{}) + extension["name"] = item.Name + extension["publisher"] = item.Publisher + extension["type"] = item.Type + if item.TypeHandlerVersion != nil { + extension["type_handler_version"] = *item.TypeHandlerVersion + } + if item.AutoUpgradeMinorVersion != nil { + extension["auto_upgrade_minor_version"] = *item.AutoUpgradeMinorVersion + } + if item.Settings != nil { + extension["settings_json"] = item.Settings + } - for i := 0; i < n; i++ { - if v, ok := d.GetOk(fmt.Sprintf("extensions.%d.name", i)); ok && v == *item.Name { - extension["protected_settings"] = d.Get(fmt.Sprintf("extensions.%d.protected_settings", i)) - break + for i := 0; i < n; i++ { + if v, ok := d.GetOk(fmt.Sprintf("extensions.%d.name", i)); ok && v == item.Name { + extension["protected_settings"] = d.Get(fmt.Sprintf("extensions.%d.protected_settings", i)) + break + } } - } - if item.ProvisionAfterExtensions != nil { - extension["provision_after_extensions"] = *item.ProvisionAfterExtensions + if item.ProvisionAfterExtensions != nil { + extension["provision_after_extensions"] = *item.ProvisionAfterExtensions + } + extensions = append(extensions, extension) } - extensions = append(extensions, extension) + d.Set("extensions", extensions) } - d.Set("extensions", extensions) - } - if config.ImageReference != nil { - d.Set("storage_image_reference", flattenBatchPoolImageReference(config.ImageReference)) - } - if config.LicenseType != nil { - d.Set("license_type", *config.LicenseType) - } - if config.NodeAgentSkuID != nil { - d.Set("node_agent_sku_id", *config.NodeAgentSkuID) - } - if config.NodePlacementConfiguration != nil { - nodePlacementConfiguration := make([]interface{}, 0) - nodePlacementConfig := make(map[string]interface{}) - nodePlacementConfig["policy"] = string(config.NodePlacementConfiguration.Policy) - nodePlacementConfiguration = append(nodePlacementConfiguration, nodePlacementConfig) - d.Set("node_placement", nodePlacementConfiguration) - } - if config.OsDisk != nil && config.OsDisk.EphemeralOSDiskSettings != nil { - d.Set("os_disk_placement", string(config.OsDisk.EphemeralOSDiskSettings.Placement)) - } - if config.WindowsConfiguration != nil { - windowsConfig := []interface{}{ - map[string]interface{}{ - "enable_automatic_updates": *config.WindowsConfiguration.EnableAutomaticUpdates, - }, + + d.Set("storage_image_reference", flattenBatchPoolImageReference(&config.ImageReference)) + + if config.LicenseType != nil { + d.Set("license_type", *config.LicenseType) + } + + d.Set("node_agent_sku_id", config.NodeAgentSkuId) + + if config.NodePlacementConfiguration != nil { + nodePlacementConfiguration := make([]interface{}, 0) + nodePlacementConfig := make(map[string]interface{}) + nodePlacementConfig["policy"] = string(*config.NodePlacementConfiguration.Policy) + nodePlacementConfiguration = append(nodePlacementConfiguration, nodePlacementConfig) + d.Set("node_placement", nodePlacementConfiguration) + } + osDiskPlacement := "" + if config.OsDisk != nil && config.OsDisk.EphemeralOSDiskSettings != nil && config.OsDisk.EphemeralOSDiskSettings.Placement != nil { + osDiskPlacement = string(*config.OsDisk.EphemeralOSDiskSettings.Placement) + } + d.Set("os_disk_placement", osDiskPlacement) + if config.WindowsConfiguration != nil { + windowsConfig := []interface{}{ + map[string]interface{}{ + "enable_automatic_updates": *config.WindowsConfiguration.EnableAutomaticUpdates, + }, + } + d.Set("windows", windowsConfig) } - d.Set("windows", windowsConfig) } } - } - if err := d.Set("certificate", flattenBatchPoolCertificateReferences(props.Certificates)); err != nil { - return fmt.Errorf("setting `certificate`: %v", err) - } + if err := d.Set("certificate", flattenBatchPoolCertificateReferences(props.Certificates)); err != nil { + return fmt.Errorf("setting `certificate`: %v", err) + } - d.Set("start_task", flattenBatchPoolStartTask(d, props.StartTask)) - d.Set("metadata", FlattenBatchMetaData(props.Metadata)) + d.Set("start_task", flattenBatchPoolStartTask(d, props.StartTask)) + d.Set("metadata", FlattenBatchMetaData(props.Metadata)) - if err := d.Set("network_configuration", flattenBatchPoolNetworkConfiguration(props.NetworkConfiguration)); err != nil { - return fmt.Errorf("setting `network_configuration`: %v", err) + if err := d.Set("network_configuration", flattenBatchPoolNetworkConfiguration(props.NetworkConfiguration)); err != nil { + return fmt.Errorf("setting `network_configuration`: %v", err) + } } } - return nil } diff --git a/internal/services/batch/batch_pool_resource.go b/internal/services/batch/batch_pool_resource.go index 68c75a01919e..21137ccedb77 100644 --- a/internal/services/batch/batch_pool_resource.go +++ b/internal/services/batch/batch_pool_resource.go @@ -8,16 +8,16 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -41,7 +41,7 @@ func resourceBatchPool() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.PoolID(id) + _, err := pool.ParsePoolID(id) return err }), Schema: map[string]*pluginsdk.Schema{ @@ -92,10 +92,10 @@ func resourceBatchPool() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.ComputeNodeDeallocationOptionRequeue), - string(batch.ComputeNodeDeallocationOptionRetainedData), - string(batch.ComputeNodeDeallocationOptionTaskCompletion), - string(batch.ComputeNodeDeallocationOptionTerminate), + string(pool.ComputeNodeDeallocationOptionRequeue), + string(pool.ComputeNodeDeallocationOptionRetainedData), + string(pool.ComputeNodeDeallocationOptionTaskCompletion), + string(pool.ComputeNodeDeallocationOptionTerminate), }, false), }, "target_dedicated_nodes": { @@ -453,11 +453,11 @@ func resourceBatchPool() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ForceNew: true, - Default: string(batch.DynamicVNetAssignmentScopeNone), + Default: string(pool.DynamicVNetAssignmentScopeNone), DiffSuppressFunc: suppress.CaseDifference, ValidateFunc: validation.StringInSlice([]string{ - string(batch.DynamicVNetAssignmentScopeNone), - string(batch.DynamicVNetAssignmentScopeJob), + string(pool.DynamicVNetAssignmentScopeNone), + string(pool.DynamicVNetAssignmentScopeJob), }, false), }, "subnet_id": { @@ -479,9 +479,9 @@ func resourceBatchPool() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.IPAddressProvisioningTypeBatchManaged), - string(batch.IPAddressProvisioningTypeUserManaged), - string(batch.IPAddressProvisioningTypeNoPublicIPAddresses), + string(pool.IPAddressProvisioningTypeBatchManaged), + string(pool.IPAddressProvisioningTypeUserManaged), + string(pool.IPAddressProvisioningTypeNoPublicIPAddresses), }, false), }, "endpoint_configuration": { @@ -501,8 +501,8 @@ func resourceBatchPool() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.InboundEndpointProtocolTCP), - string(batch.InboundEndpointProtocolUDP), + string(pool.InboundEndpointProtocolTCP), + string(pool.InboundEndpointProtocolUDP), }, false), }, "backend_port": { @@ -537,8 +537,8 @@ func resourceBatchPool() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.NetworkSecurityGroupRuleAccessAllow), - string(batch.NetworkSecurityGroupRuleAccessDeny), + string(pool.NetworkSecurityGroupRuleAccessAllow), + string(pool.NetworkSecurityGroupRuleAccessDeny), }, false), }, "source_address_prefix": { @@ -580,11 +580,11 @@ func resourceBatchPool() *pluginsdk.Resource { "caching": { Type: pluginsdk.TypeString, Optional: true, - Default: string(batch.CachingTypeReadOnly), + Default: string(pool.CachingTypeReadOnly), ValidateFunc: validation.StringInSlice([]string{ - string(batch.CachingTypeNone), - string(batch.CachingTypeReadOnly), - string(batch.CachingTypeReadWrite), + string(pool.CachingTypeNone), + string(pool.CachingTypeReadOnly), + string(pool.CachingTypeReadWrite), }, false), }, "disk_size_gb": { @@ -595,10 +595,10 @@ func resourceBatchPool() *pluginsdk.Resource { "storage_account_type": { Type: pluginsdk.TypeString, Optional: true, - Default: batch.StorageAccountTypeStandardLRS, + Default: pool.StorageAccountTypeStandardLRS, ValidateFunc: validation.StringInSlice([]string{ - string(batch.StorageAccountTypeStandardLRS), - string(batch.StorageAccountTypePremiumLRS), + string(pool.StorageAccountTypeStandardLRS), + string(pool.StorageAccountTypePremiumLRS), }, false), }, }, @@ -613,8 +613,8 @@ func resourceBatchPool() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.DiskEncryptionTargetTemporaryDisk), - string(batch.DiskEncryptionTargetOsDisk), + string(pool.DiskEncryptionTargetTemporaryDisk), + string(pool.DiskEncryptionTargetOsDisk), }, false), }, }, @@ -678,10 +678,10 @@ func resourceBatchPool() *pluginsdk.Resource { "policy": { Type: pluginsdk.TypeString, Optional: true, - Default: string(batch.NodePlacementPolicyTypeRegional), + Default: string(pool.NodePlacementPolicyTypeRegional), ValidateFunc: validation.StringInSlice([]string{ - string(batch.NodePlacementPolicyTypeZonal), - string(batch.NodePlacementPolicyTypeRegional), + string(pool.NodePlacementPolicyTypeZonal), + string(pool.NodePlacementPolicyTypeRegional), }, false), }, }, @@ -697,16 +697,16 @@ func resourceBatchPool() *pluginsdk.Resource { Optional: true, ValidateFunc: validation.StringInSlice( []string{ - string(batch.DiffDiskPlacementCacheDisk), + string(pool.DiffDiskPlacementCacheDisk), }, false), }, "inter_node_communication": { Type: pluginsdk.TypeString, Optional: true, - Default: string(batch.InterNodeCommunicationStateEnabled), + Default: string(pool.InterNodeCommunicationStateEnabled), ValidateFunc: validation.StringInSlice([]string{ - string(batch.InterNodeCommunicationStateEnabled), - string(batch.InterNodeCommunicationStateDisabled), + string(pool.InterNodeCommunicationStateEnabled), + string(pool.InterNodeCommunicationStateDisabled), }, false), }, "task_scheduling_policy": { @@ -720,8 +720,8 @@ func resourceBatchPool() *pluginsdk.Resource { Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.ComputeNodeFillTypeSpread), - string(batch.ComputeNodeFillTypePack), + string(pool.ComputeNodeFillTypeSpread), + string(pool.ComputeNodeFillTypePack), }, false), }, }, @@ -747,8 +747,8 @@ func resourceBatchPool() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.ElevationLevelNonAdmin), - string(batch.ElevationLevelAdmin), + string(pool.ElevationLevelNonAdmin), + string(pool.ElevationLevelAdmin), }, false), }, "linux_user_configuration": { @@ -781,8 +781,8 @@ func resourceBatchPool() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.LoginModeBatch), - string(batch.LoginModeInteractive), + string(pool.LoginModeBatch), + string(pool.LoginModeInteractive), }, false), }, }, @@ -814,27 +814,27 @@ func resourceBatchPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + id := pool.NewPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_batch_pool", id.ID()) } } - parameters := batch.Pool{ - PoolProperties: &batch.PoolProperties{ + parameters := pool.Pool{ + Properties: &pool.PoolProperties{ VMSize: utils.String(d.Get("vm_size").(string)), DisplayName: utils.String(d.Get("display_name").(string)), - InterNodeCommunication: batch.InterNodeCommunicationState(d.Get("inter_node_communication").(string)), - TaskSlotsPerNode: utils.Int32(int32(d.Get("max_tasks_per_node").(int))), + InterNodeCommunication: pointer.To(pool.InterNodeCommunicationState(d.Get("inter_node_communication").(string))), + TaskSlotsPerNode: utils.Int64(int64(d.Get("max_tasks_per_node").(int))), }, } @@ -842,15 +842,15 @@ func resourceBatchPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error if err != nil { log.Printf(`[DEBUG] expanding "user_accounts": %v`, err) } - parameters.PoolProperties.UserAccounts = userAccounts + parameters.Properties.UserAccounts = userAccounts taskSchedulingPolicy, err := ExpandBatchPoolTaskSchedulingPolicy(d) if err != nil { log.Printf(`[DEBUG] expanding "task_scheduling_policy": %v`, err) } - parameters.PoolProperties.TaskSchedulingPolicy = taskSchedulingPolicy + parameters.Properties.TaskSchedulingPolicy = taskSchedulingPolicy - identity, err := expandBatchPoolIdentity(d.Get("identity").([]interface{})) + identity, err := identity.ExpandUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf(`expanding "identity": %v`, err) } @@ -861,7 +861,7 @@ func resourceBatchPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error return fmt.Errorf("expanding scale settings: %+v", err) } - parameters.PoolProperties.ScaleSettings = scaleSettings + parameters.Properties.ScaleSettings = scaleSettings if startTaskValue, startTaskOk := d.GetOk("start_task"); startTaskOk { startTaskList := startTaskValue.([]interface{}) @@ -877,11 +877,11 @@ func resourceBatchPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error return fmt.Errorf("creating %s: %+v", id, userIdentityError) } - parameters.PoolProperties.StartTask = startTask + parameters.Properties.StartTask = startTask } if vmDeploymentConfiguration, deploymentErr := expandBatchPoolVirtualMachineConfig(d); deploymentErr == nil { - parameters.PoolProperties.DeploymentConfiguration = &batch.DeploymentConfiguration{ + parameters.Properties.DeploymentConfiguration = &pool.DeploymentConfiguration{ VirtualMachineConfiguration: vmDeploymentConfiguration, } } @@ -891,33 +891,33 @@ func resourceBatchPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error if err != nil { return fmt.Errorf("expanding `certificate`: %+v", err) } - parameters.PoolProperties.Certificates = certificateReferences + parameters.Properties.Certificates = certificateReferences - if err := validateBatchPoolCrossFieldRules(¶meters); err != nil { + if err := validateBatchPoolCrossFieldRules(parameters.Properties); err != nil { return err } metaDataRaw := d.Get("metadata").(map[string]interface{}) - parameters.PoolProperties.Metadata = ExpandBatchMetaData(metaDataRaw) + parameters.Properties.Metadata = ExpandBatchMetaData(metaDataRaw) mountConfiguration, err := ExpandBatchPoolMountConfigurations(d) if err != nil { log.Printf(`[DEBUG] expanding "mount": %v`, err) } - parameters.PoolProperties.MountConfiguration = mountConfiguration + parameters.Properties.MountConfiguration = mountConfiguration networkConfiguration := d.Get("network_configuration").([]interface{}) - parameters.PoolProperties.NetworkConfiguration, err = ExpandBatchPoolNetworkConfiguration(networkConfiguration) + parameters.Properties.NetworkConfiguration, err = ExpandBatchPoolNetworkConfiguration(networkConfiguration) if err != nil { return fmt.Errorf("expanding `network_configuration`: %+v", err) } - _, err = client.Create(ctx, id.ResourceGroup, id.BatchAccountName, id.Name, parameters, "", "") + _, err = client.Create(ctx, id, parameters, pool.CreateOperationOptions{}) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - read, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + read, err := client.Get(ctx, id) if err != nil { return fmt.Errorf("retrieving %s: %+v", id, err) } @@ -925,9 +925,11 @@ func resourceBatchPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error d.SetId(id.ID()) // if the pool is not Steady after the create operation, wait for it to be Steady - if props := read.PoolProperties; props != nil && props.AllocationState != batch.AllocationStateSteady { - if err = waitForBatchPoolPendingResizeOperation(ctx, client, id.ResourceGroup, id.BatchAccountName, id.Name); err != nil { - return fmt.Errorf("waiting for %s", id) + if model := read.Model; model != nil { + if props := model.Properties; props != nil && props.AllocationState != nil && *props.AllocationState != pool.AllocationStateSteady { + if err = waitForBatchPoolPendingResizeOperation(ctx, client, id); err != nil { + return fmt.Errorf("waiting for %s", id) + } } } @@ -939,39 +941,41 @@ func resourceBatchPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.PoolID(d.Id()) + id, err := pool.ParsePoolID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { return fmt.Errorf("retrieving %s: %+v", *id, err) } - if resp.PoolProperties.AllocationState != batch.AllocationStateSteady { - log.Printf("[INFO] there is a pending resize operation on this pool...") - stopPendingResizeOperation := d.Get("stop_pending_resize_operation").(bool) - if !stopPendingResizeOperation { - return fmt.Errorf("updating %s because of pending resize operation. Set flag `stop_pending_resize_operation` to true to force update", *id) - } + if model := resp.Model; model != nil { + if props := model.Properties; props != nil && props.AllocationState != nil && *props.AllocationState != pool.AllocationStateSteady { + log.Printf("[INFO] there is a pending resize operation on this pool...") + stopPendingResizeOperation := d.Get("stop_pending_resize_operation").(bool) + if !stopPendingResizeOperation { + return fmt.Errorf("updating %s because of pending resize operation. Set flag `stop_pending_resize_operation` to true to force update", *id) + } - log.Printf("[INFO] stopping the pending resize operation on this pool...") - if _, err = client.StopResize(ctx, id.ResourceGroup, id.BatchAccountName, id.Name); err != nil { - return fmt.Errorf("stopping resize operation for %s: %+v", *id, err) - } + log.Printf("[INFO] stopping the pending resize operation on this pool...") + if _, err = client.StopResize(ctx, *id); err != nil { + return fmt.Errorf("stopping resize operation for %s: %+v", *id, err) + } - // waiting for the pool to be in steady state - if err = waitForBatchPoolPendingResizeOperation(ctx, client, id.ResourceGroup, id.BatchAccountName, id.Name); err != nil { - return fmt.Errorf("waiting for %s", *id) + // waiting for the pool to be in steady state + if err = waitForBatchPoolPendingResizeOperation(ctx, client, *id); err != nil { + return fmt.Errorf("waiting for %s", *id) + } } } - parameters := batch.Pool{ - PoolProperties: &batch.PoolProperties{}, + parameters := pool.Pool{ + Properties: &pool.PoolProperties{}, } - identity, err := expandBatchPoolIdentity(d.Get("identity").([]interface{})) + identity, err := identity.ExpandUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf(`expanding "identity": %v`, err) } @@ -982,19 +986,19 @@ func resourceBatchPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error return fmt.Errorf("expanding scale settings: %+v", err) } - parameters.PoolProperties.ScaleSettings = scaleSettings + parameters.Properties.ScaleSettings = scaleSettings taskSchedulingPolicy, err := ExpandBatchPoolTaskSchedulingPolicy(d) if err != nil { log.Printf(`[DEBUG] expanding "task_scheduling_policy": %v`, err) } - parameters.PoolProperties.TaskSchedulingPolicy = taskSchedulingPolicy + parameters.Properties.TaskSchedulingPolicy = taskSchedulingPolicy userAccounts, err := ExpandBatchPoolUserAccounts(d) if err != nil { log.Printf(`[DEBUG] expanding "user_accounts": %v`, err) } - parameters.PoolProperties.UserAccounts = userAccounts + parameters.Properties.UserAccounts = userAccounts if startTaskValue, startTaskOk := d.GetOk("start_task"); startTaskOk { startTaskList := startTaskValue.([]interface{}) @@ -1010,16 +1014,16 @@ func resourceBatchPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error return fmt.Errorf("creating %s: %+v", *id, userIdentityError) } - parameters.PoolProperties.StartTask = startTask + parameters.Properties.StartTask = startTask } certificates := d.Get("certificate").([]interface{}) certificateReferences, err := ExpandBatchPoolCertificateReferences(certificates) if err != nil { return fmt.Errorf("expanding `certificate`: %+v", err) } - parameters.PoolProperties.Certificates = certificateReferences + parameters.Properties.Certificates = certificateReferences - if err := validateBatchPoolCrossFieldRules(¶meters); err != nil { + if err := validateBatchPoolCrossFieldRules(parameters.Properties); err != nil { return err } @@ -1027,24 +1031,26 @@ func resourceBatchPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error log.Printf("[DEBUG] Updating the MetaData for %s", *id) metaDataRaw := d.Get("metadata").(map[string]interface{}) - parameters.PoolProperties.Metadata = ExpandBatchMetaData(metaDataRaw) + parameters.Properties.Metadata = ExpandBatchMetaData(metaDataRaw) } mountConfiguration, err := ExpandBatchPoolMountConfigurations(d) if err != nil { log.Printf(`[DEBUG] expanding "mount": %v`, err) } - parameters.PoolProperties.MountConfiguration = mountConfiguration + parameters.Properties.MountConfiguration = mountConfiguration - result, err := client.Update(ctx, id.ResourceGroup, id.BatchAccountName, id.Name, parameters, "") + result, err := client.Update(ctx, *id, parameters, pool.UpdateOperationOptions{}) if err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } // if the pool is not Steady after the update, wait for it to be Steady - if props := result.PoolProperties; props != nil && props.AllocationState != batch.AllocationStateSteady { - if err := waitForBatchPoolPendingResizeOperation(ctx, client, id.ResourceGroup, id.BatchAccountName, id.Name); err != nil { - return fmt.Errorf("waiting for %s", *id) + if model := result.Model; model != nil { + if props := model.Properties; props != nil && props.AllocationState != nil && *props.AllocationState != pool.AllocationStateSteady { + if err := waitForBatchPoolPendingResizeOperation(ctx, client, *id); err != nil { + return fmt.Errorf("waiting for %s", *id) + } } } @@ -1056,14 +1062,14 @@ func resourceBatchPoolRead(d *pluginsdk.ResourceData, meta interface{}) error { ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.PoolID(d.Id()) + id, err := pool.ParsePoolID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s was not found - removing from state", *id) d.SetId("") return nil @@ -1071,158 +1077,173 @@ func resourceBatchPoolRead(d *pluginsdk.ResourceData, meta interface{}) error { return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) + d.Set("name", id.PoolName) d.Set("account_name", id.BatchAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - identity, err := flattenBatchPoolIdentity(resp.Identity) - if err != nil { - return fmt.Errorf("flattening `identity`: %+v", err) - } - if err := d.Set("identity", identity); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) - } + if model := resp.Model; model != nil { + identity, err := identity.FlattenUserAssignedMap(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + if err := d.Set("identity", identity); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } - if props := resp.PoolProperties; props != nil { - d.Set("display_name", props.DisplayName) - d.Set("vm_size", props.VMSize) - d.Set("inter_node_communication", string(props.InterNodeCommunication)) + if props := model.Properties; props != nil { + d.Set("display_name", props.DisplayName) + d.Set("vm_size", props.VMSize) + d.Set("inter_node_communication", props.InterNodeCommunication) - if scaleSettings := props.ScaleSettings; scaleSettings != nil { - if err := d.Set("auto_scale", flattenBatchPoolAutoScaleSettings(scaleSettings.AutoScale)); err != nil { - return fmt.Errorf("flattening `auto_scale`: %+v", err) - } - if err := d.Set("fixed_scale", flattenBatchPoolFixedScaleSettings(d, scaleSettings.FixedScale)); err != nil { - return fmt.Errorf("flattening `fixed_scale `: %+v", err) + if scaleSettings := props.ScaleSettings; scaleSettings != nil { + if err := d.Set("auto_scale", flattenBatchPoolAutoScaleSettings(scaleSettings.AutoScale)); err != nil { + return fmt.Errorf("flattening `auto_scale`: %+v", err) + } + if err := d.Set("fixed_scale", flattenBatchPoolFixedScaleSettings(d, scaleSettings.FixedScale)); err != nil { + return fmt.Errorf("flattening `fixed_scale `: %+v", err) + } } - } - if props.TaskSchedulingPolicy != nil && props.TaskSchedulingPolicy.NodeFillType != "" { - taskSchedulingPolicy := make([]interface{}, 0) - nodeFillType := make(map[string]interface{}) - nodeFillType["node_fill_type"] = string(props.TaskSchedulingPolicy.NodeFillType) - taskSchedulingPolicy = append(taskSchedulingPolicy, nodeFillType) - d.Set("task_scheduling_policy", taskSchedulingPolicy) - } + if props.TaskSchedulingPolicy != nil && props.TaskSchedulingPolicy.NodeFillType != "" { + taskSchedulingPolicy := make([]interface{}, 0) + nodeFillType := make(map[string]interface{}) + nodeFillType["node_fill_type"] = string(props.TaskSchedulingPolicy.NodeFillType) + taskSchedulingPolicy = append(taskSchedulingPolicy, nodeFillType) + d.Set("task_scheduling_policy", taskSchedulingPolicy) + } - if props.UserAccounts != nil { - userAccounts := make([]interface{}, 0) - for _, userAccount := range *props.UserAccounts { - userAccounts = append(userAccounts, flattenBatchPoolUserAccount(d, &userAccount)) + if props.UserAccounts != nil { + userAccounts := make([]interface{}, 0) + for _, userAccount := range *props.UserAccounts { + userAccounts = append(userAccounts, flattenBatchPoolUserAccount(d, &userAccount)) + } + d.Set("user_accounts", userAccounts) } - d.Set("user_accounts", userAccounts) - } - d.Set("max_tasks_per_node", props.TaskSlotsPerNode) + d.Set("max_tasks_per_node", props.TaskSlotsPerNode) - if props.DeploymentConfiguration != nil { - if props.DeploymentConfiguration.VirtualMachineConfiguration != nil { - config := props.DeploymentConfiguration.VirtualMachineConfiguration - if config.ContainerConfiguration != nil { - d.Set("container_configuration", flattenBatchPoolContainerConfiguration(d, config.ContainerConfiguration)) - } - if config.DataDisks != nil { - dataDisks := make([]interface{}, 0) - for _, item := range *config.DataDisks { - dataDisk := make(map[string]interface{}) - dataDisk["lun"] = *item.Lun - dataDisk["disk_size_gb"] = *item.DiskSizeGB - dataDisk["caching"] = string(item.Caching) - dataDisk["storage_account_type"] = string(item.StorageAccountType) - dataDisks = append(dataDisks, dataDisk) + if props.DeploymentConfiguration != nil { + if props.DeploymentConfiguration.VirtualMachineConfiguration != nil { + config := props.DeploymentConfiguration.VirtualMachineConfiguration + if config.ContainerConfiguration != nil { + d.Set("container_configuration", flattenBatchPoolContainerConfiguration(d, config.ContainerConfiguration)) } - d.Set("data_disks", dataDisks) - } - if config.DiskEncryptionConfiguration != nil { - diskEncryptionConfiguration := make([]interface{}, 0) - if config.DiskEncryptionConfiguration.Targets != nil { - for _, item := range *config.DiskEncryptionConfiguration.Targets { - target := make(map[string]interface{}) - target["disk_encryption_target"] = string(item) - diskEncryptionConfiguration = append(diskEncryptionConfiguration, target) + if config.DataDisks != nil { + dataDisks := make([]interface{}, 0) + for _, item := range *config.DataDisks { + dataDisk := make(map[string]interface{}) + dataDisk["lun"] = item.Lun + dataDisk["disk_size_gb"] = item.DiskSizeGB + + caching := "" + if item.Caching != nil { + caching = string(*item.Caching) + } + dataDisk["caching"] = caching + + storageAccountType := "" + if item.StorageAccountType != nil { + storageAccountType = string(*item.StorageAccountType) + } + dataDisk["storage_account_type"] = storageAccountType + + dataDisks = append(dataDisks, dataDisk) } + d.Set("data_disks", dataDisks) } - d.Set("disk_encryption", diskEncryptionConfiguration) - } - if config.Extensions != nil { - extensions := make([]interface{}, 0) - n := len(*config.Extensions) - for _, item := range *config.Extensions { - extension := make(map[string]interface{}) - extension["name"] = *item.Name - extension["publisher"] = *item.Publisher - extension["type"] = *item.Type - if item.TypeHandlerVersion != nil { - extension["type_handler_version"] = *item.TypeHandlerVersion - } - if item.AutoUpgradeMinorVersion != nil { - extension["auto_upgrade_minor_version"] = *item.AutoUpgradeMinorVersion - } - if item.Settings != nil { - extension["settings_json"] = item.Settings + if config.DiskEncryptionConfiguration != nil { + diskEncryptionConfiguration := make([]interface{}, 0) + if config.DiskEncryptionConfiguration.Targets != nil { + for _, item := range *config.DiskEncryptionConfiguration.Targets { + target := make(map[string]interface{}) + target["disk_encryption_target"] = string(item) + diskEncryptionConfiguration = append(diskEncryptionConfiguration, target) + } } + d.Set("disk_encryption", diskEncryptionConfiguration) + } + if config.Extensions != nil { + extensions := make([]interface{}, 0) + n := len(*config.Extensions) + for _, item := range *config.Extensions { + extension := make(map[string]interface{}) + extension["name"] = item.Name + extension["publisher"] = item.Publisher + extension["type"] = item.Type + if item.TypeHandlerVersion != nil { + extension["type_handler_version"] = *item.TypeHandlerVersion + } + if item.AutoUpgradeMinorVersion != nil { + extension["auto_upgrade_minor_version"] = *item.AutoUpgradeMinorVersion + } + if item.Settings != nil { + extension["settings_json"] = item.Settings + } - for i := 0; i < n; i++ { - if v, ok := d.GetOk(fmt.Sprintf("extensions.%d.name", i)); ok && v == *item.Name { - extension["protected_settings"] = d.Get(fmt.Sprintf("extensions.%d.protected_settings", i)) - break + for i := 0; i < n; i++ { + if v, ok := d.GetOk(fmt.Sprintf("extensions.%d.name", i)); ok && v == item.Name { + extension["protected_settings"] = d.Get(fmt.Sprintf("extensions.%d.protected_settings", i)) + break + } } - } - if item.ProvisionAfterExtensions != nil { - extension["provision_after_extensions"] = *item.ProvisionAfterExtensions + if item.ProvisionAfterExtensions != nil { + extension["provision_after_extensions"] = *item.ProvisionAfterExtensions + } + extensions = append(extensions, extension) } - extensions = append(extensions, extension) + d.Set("extensions", extensions) } - d.Set("extensions", extensions) - } - if config.ImageReference != nil { - d.Set("storage_image_reference", flattenBatchPoolImageReference(config.ImageReference)) - } - if config.LicenseType != nil { - d.Set("license_type", *config.LicenseType) - } - if config.NodeAgentSkuID != nil { - d.Set("node_agent_sku_id", *config.NodeAgentSkuID) - } - if config.NodePlacementConfiguration != nil { - nodePlacementConfiguration := make([]interface{}, 0) - nodePlacementConfig := make(map[string]interface{}) - nodePlacementConfig["policy"] = string(config.NodePlacementConfiguration.Policy) - nodePlacementConfiguration = append(nodePlacementConfiguration, nodePlacementConfig) - d.Set("node_placement", nodePlacementConfiguration) - } - if config.OsDisk != nil && config.OsDisk.EphemeralOSDiskSettings != nil { - d.Set("os_disk_placement", string(config.OsDisk.EphemeralOSDiskSettings.Placement)) - } - if config.WindowsConfiguration != nil { - windowsConfig := []interface{}{ - map[string]interface{}{ - "enable_automatic_updates": *config.WindowsConfiguration.EnableAutomaticUpdates, - }, + + d.Set("storage_image_reference", flattenBatchPoolImageReference(&config.ImageReference)) + + if config.LicenseType != nil { + d.Set("license_type", *config.LicenseType) + } + + d.Set("node_agent_sku_id", config.NodeAgentSkuId) + + if config.NodePlacementConfiguration != nil { + nodePlacementConfiguration := make([]interface{}, 0) + nodePlacementConfig := make(map[string]interface{}) + nodePlacementConfig["policy"] = string(*config.NodePlacementConfiguration.Policy) + nodePlacementConfiguration = append(nodePlacementConfiguration, nodePlacementConfig) + d.Set("node_placement", nodePlacementConfiguration) + } + osDiskPlacement := "" + if config.OsDisk != nil && config.OsDisk.EphemeralOSDiskSettings != nil && config.OsDisk.EphemeralOSDiskSettings.Placement != nil { + osDiskPlacement = string(*config.OsDisk.EphemeralOSDiskSettings.Placement) + } + d.Set("os_disk_placement", osDiskPlacement) + if config.WindowsConfiguration != nil { + windowsConfig := []interface{}{ + map[string]interface{}{ + "enable_automatic_updates": *config.WindowsConfiguration.EnableAutomaticUpdates, + }, + } + d.Set("windows", windowsConfig) } - d.Set("windows", windowsConfig) } } - } - if err := d.Set("certificate", flattenBatchPoolCertificateReferences(props.Certificates)); err != nil { - return fmt.Errorf("flattening `certificate`: %+v", err) - } + if err := d.Set("certificate", flattenBatchPoolCertificateReferences(props.Certificates)); err != nil { + return fmt.Errorf("flattening `certificate`: %+v", err) + } - d.Set("start_task", flattenBatchPoolStartTask(d, props.StartTask)) - d.Set("metadata", FlattenBatchMetaData(props.Metadata)) + d.Set("start_task", flattenBatchPoolStartTask(d, props.StartTask)) + d.Set("metadata", FlattenBatchMetaData(props.Metadata)) - if props.MountConfiguration != nil { - mountConfigs := make([]interface{}, 0) - for _, mountConfig := range *props.MountConfiguration { - mountConfigs = append(mountConfigs, flattenBatchPoolMountConfig(d, &mountConfig)) + if props.MountConfiguration != nil { + mountConfigs := make([]interface{}, 0) + for _, mountConfig := range *props.MountConfiguration { + mountConfigs = append(mountConfigs, flattenBatchPoolMountConfig(d, &mountConfig)) + } + d.Set("mount", mountConfigs) } - d.Set("mount", mountConfigs) - } - if err := d.Set("network_configuration", flattenBatchPoolNetworkConfiguration(props.NetworkConfiguration)); err != nil { - return fmt.Errorf("setting `network_configuration`: %v", err) + if err := d.Set("network_configuration", flattenBatchPoolNetworkConfiguration(props.NetworkConfiguration)); err != nil { + return fmt.Errorf("setting `network_configuration`: %v", err) + } } } @@ -1234,26 +1255,20 @@ func resourceBatchPoolDelete(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.PoolID(d.Id()) + id, err := pool.ParsePoolID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) - if err != nil { + if err := client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - } return nil } -func expandBatchPoolScaleSettings(d *pluginsdk.ResourceData) (*batch.ScaleSettings, error) { - scaleSettings := &batch.ScaleSettings{} +func expandBatchPoolScaleSettings(d *pluginsdk.ResourceData) (*pool.ScaleSettings, error) { + scaleSettings := &pool.ScaleSettings{} autoScaleValue, autoScaleOk := d.GetOk("auto_scale") fixedScaleValue, fixedScaleOk := d.GetOk("fixed_scale") @@ -1277,9 +1292,9 @@ func expandBatchPoolScaleSettings(d *pluginsdk.ResourceData) (*batch.ScaleSettin autoScaleEvaluationInterval := autoScaleSettings["evaluation_interval"].(string) autoScaleFormula := autoScaleSettings["formula"].(string) - scaleSettings.AutoScale = &batch.AutoScaleSettings{ + scaleSettings.AutoScale = &pool.AutoScaleSettings{ EvaluationInterval: &autoScaleEvaluationInterval, - Formula: &autoScaleFormula, + Formula: autoScaleFormula, } } else if fixedScaleOk { fixedScale := fixedScaleValue.([]interface{}) @@ -1288,43 +1303,47 @@ func expandBatchPoolScaleSettings(d *pluginsdk.ResourceData) (*batch.ScaleSettin } fixedScaleSettings := fixedScale[0].(map[string]interface{}) - nodeDeallocationOption := batch.ComputeNodeDeallocationOption(fixedScaleSettings["node_deallocation_method"].(string)) + nodeDeallocationOption := pool.ComputeNodeDeallocationOption(fixedScaleSettings["node_deallocation_method"].(string)) targetDedicatedNodes := int32(fixedScaleSettings["target_dedicated_nodes"].(int)) targetLowPriorityNodes := int32(fixedScaleSettings["target_low_priority_nodes"].(int)) resizeTimeout := fixedScaleSettings["resize_timeout"].(string) - scaleSettings.FixedScale = &batch.FixedScaleSettings{ - NodeDeallocationOption: nodeDeallocationOption, + scaleSettings.FixedScale = &pool.FixedScaleSettings{ + NodeDeallocationOption: &nodeDeallocationOption, ResizeTimeout: &resizeTimeout, - TargetDedicatedNodes: &targetDedicatedNodes, - TargetLowPriorityNodes: &targetLowPriorityNodes, + TargetDedicatedNodes: utils.Int64(int64(targetDedicatedNodes)), + TargetLowPriorityNodes: utils.Int64(int64(targetLowPriorityNodes)), } } return scaleSettings, nil } -func waitForBatchPoolPendingResizeOperation(ctx context.Context, client *batch.PoolClient, resourceGroup string, accountName string, poolName string) error { +func waitForBatchPoolPendingResizeOperation(ctx context.Context, client *pool.PoolClient, id pool.PoolId) error { // waiting for the pool to be in steady state log.Printf("[INFO] waiting for the pending resize operation on this pool to be stopped...") isSteady := false for !isSteady { - resp, err := client.Get(ctx, resourceGroup, accountName, poolName) + resp, err := client.Get(ctx, id) if err != nil { - return fmt.Errorf("retrieving the Batch pool %q (Resource Group %q): %+v", poolName, resourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - isSteady = resp.PoolProperties.AllocationState == batch.AllocationStateSteady + if resp.Model != nil && resp.Model.Properties != nil && resp.Model.Properties.AllocationState != nil { + isSteady = *resp.Model.Properties.AllocationState == pool.AllocationStateSteady + if isSteady { + break + } + } time.Sleep(time.Second * 30) log.Printf("[INFO] waiting for the pending resize operation on this pool to be stopped... New try in 30 seconds...") } - return nil } // validateUserIdentity validates that the user identity for a start task has been well specified // it should have a auto_user block or a user_name defined, but not both at the same time. -func validateUserIdentity(userIdentity *batch.UserIdentity) error { +func validateUserIdentity(userIdentity *pool.UserIdentity) error { if userIdentity == nil { return errors.New("user_identity block needs to be specified") } @@ -1340,7 +1359,7 @@ func validateUserIdentity(userIdentity *batch.UserIdentity) error { return nil } -func validateBatchPoolCrossFieldRules(pool *batch.Pool) error { +func validateBatchPoolCrossFieldRules(pool *pool.PoolProperties) error { // Perform validation across multiple fields as per https://docs.microsoft.com/en-us/rest/api/batchmanagement/pool/create#resourcefile if pool.StartTask != nil { @@ -1352,10 +1371,10 @@ func validateBatchPoolCrossFieldRules(pool *batch.Pool) error { if referenceFile.AutoStorageContainerName != nil { sourceCount++ } - if referenceFile.StorageContainerURL != nil { + if referenceFile.StorageContainerUrl != nil { sourceCount++ } - if referenceFile.HTTPURL != nil { + if referenceFile.HTTPUrl != nil { sourceCount++ } if sourceCount != 1 { @@ -1363,12 +1382,12 @@ func validateBatchPoolCrossFieldRules(pool *batch.Pool) error { } if referenceFile.BlobPrefix != nil { - if referenceFile.AutoStorageContainerName == nil && referenceFile.StorageContainerURL == nil { + if referenceFile.AutoStorageContainerName == nil && referenceFile.StorageContainerUrl == nil { return fmt.Errorf("auto_storage_container_name or storage_container_url must be specified when using blob_prefix") } } - if referenceFile.HTTPURL != nil { + if referenceFile.HTTPUrl != nil { if referenceFile.FilePath == nil { return fmt.Errorf("file_path must be specified when using http_url") } @@ -1380,46 +1399,6 @@ func validateBatchPoolCrossFieldRules(pool *batch.Pool) error { return nil } -func expandBatchPoolIdentity(input []interface{}) (*batch.PoolIdentity, error) { - expanded, err := identity.ExpandUserAssignedMap(input) - if err != nil { - return nil, err - } - - out := batch.PoolIdentity{ - Type: batch.PoolIdentityType(string(expanded.Type)), - } - if expanded.Type == identity.TypeUserAssigned || expanded.Type == identity.TypeSystemAssignedUserAssigned { - out.UserAssignedIdentities = make(map[string]*batch.UserAssignedIdentities) - for k := range expanded.IdentityIds { - out.UserAssignedIdentities[k] = &batch.UserAssignedIdentities{ - // intentionally empty - } - } - } - - return &out, nil -} - -func flattenBatchPoolIdentity(input *batch.PoolIdentity) (*[]interface{}, error) { - var transform *identity.UserAssignedMap - - if input != nil { - transform = &identity.UserAssignedMap{ - Type: identity.Type(string(input.Type)), - IdentityIds: make(map[string]identity.UserAssignedIdentityDetails), - } - for k, v := range input.UserAssignedIdentities { - transform.IdentityIds[k] = identity.UserAssignedIdentityDetails{ - ClientId: v.ClientID, - PrincipalId: v.PrincipalID, - } - } - } - - return identity.FlattenUserAssignedMap(transform) -} - func startTaskSchema() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ "command_line": { @@ -1454,8 +1433,8 @@ func startTaskSchema() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(batch.ContainerWorkingDirectoryTaskWorkingDirectory), - string(batch.ContainerWorkingDirectoryContainerImageDefault), + string(pool.ContainerWorkingDirectoryTaskWorkingDirectory), + string(pool.ContainerWorkingDirectoryContainerImageDefault), }, false), }, }, @@ -1501,19 +1480,19 @@ func startTaskSchema() map[string]*pluginsdk.Schema { "elevation_level": { Type: pluginsdk.TypeString, Optional: true, - Default: string(batch.ElevationLevelNonAdmin), + Default: string(pool.ElevationLevelNonAdmin), ValidateFunc: validation.StringInSlice([]string{ - string(batch.ElevationLevelNonAdmin), - string(batch.ElevationLevelAdmin), + string(pool.ElevationLevelNonAdmin), + string(pool.ElevationLevelAdmin), }, false), }, "scope": { Type: pluginsdk.TypeString, Optional: true, - Default: string(batch.AutoUserScopeTask), + Default: string(pool.AutoUserScopeTask), ValidateFunc: validation.StringInSlice([]string{ - string(batch.AutoUserScopeTask), - string(batch.AutoUserScopePool), + string(pool.AutoUserScopeTask), + string(pool.AutoUserScopePool), }, false), }, }, diff --git a/internal/services/batch/batch_pool_resource_test.go b/internal/services/batch/batch_pool_resource_test.go index 675c6e7264a8..37269a3e887c 100644 --- a/internal/services/batch/batch_pool_resource_test.go +++ b/internal/services/batch/batch_pool_resource_test.go @@ -7,10 +7,10 @@ import ( "regexp" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -712,17 +712,17 @@ func TestAccBatchPool_windowsUserAccountsWithAdditionalConfig(t *testing.T) { } func (t BatchPoolResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.PoolID(state.ID) + id, err := pool.ParsePoolID(state.ID) if err != nil { return nil, err } - resp, err := clients.Batch.PoolClient.Get(ctx, id.ResourceGroup, id.BatchAccountName, id.Name) + resp, err := clients.Batch.PoolClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving %s", *id) } - return utils.Bool(resp.PoolProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (BatchPoolResource) fixedScale_complete(data acceptance.TestData) string { diff --git a/internal/services/batch/client/client.go b/internal/services/batch/client/client.go index 224a0ebac2b9..6bfa1b936541 100644 --- a/internal/services/batch/client/client.go +++ b/internal/services/batch/client/client.go @@ -5,32 +5,34 @@ import ( "fmt" batchDataplane "github.com/Azure/azure-sdk-for-go/services/batch/2020-03-01.11.0/batch" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" // nolint: staticcheck "github.com/Azure/go-autorest/autorest" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate" + "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" ) type Client struct { - AccountClient *batch.AccountClient - ApplicationClient *batch.ApplicationClient - CertificateClient *batch.CertificateClient - PoolClient *batch.PoolClient + AccountClient *batchaccount.BatchAccountClient + ApplicationClient *application.ApplicationClient + CertificateClient *certificate.CertificateClient + PoolClient *pool.PoolClient BatchManagementAuthorizer autorest.Authorizer } func NewClient(o *common.ClientOptions) *Client { - accountClient := batch.NewAccountClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + accountClient := batchaccount.NewBatchAccountClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&accountClient.Client, o.ResourceManagerAuthorizer) - applicationClient := batch.NewApplicationClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + applicationClient := application.NewApplicationClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&applicationClient.Client, o.ResourceManagerAuthorizer) - certificateClient := batch.NewCertificateClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + certificateClient := certificate.NewCertificateClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&certificateClient.Client, o.ResourceManagerAuthorizer) - poolClient := batch.NewPoolClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + poolClient := pool.NewPoolClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&poolClient.Client, o.ResourceManagerAuthorizer) return &Client{ @@ -42,22 +44,24 @@ func NewClient(o *common.ClientOptions) *Client { } } -func (r *Client) JobClient(ctx context.Context, accountId parse.AccountId) (*batchDataplane.JobClient, error) { +func (r *Client) JobClient(ctx context.Context, accountId batchaccount.BatchAccountId) (*batchDataplane.JobClient, error) { // Retrieve the batch account to find the batch account endpoint accountClient := r.AccountClient - account, err := accountClient.Get(ctx, accountId.ResourceGroup, accountId.BatchAccountName) + account, err := accountClient.Get(ctx, accountId) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", accountId, err) } - if account.AccountProperties == nil { - return nil, fmt.Errorf(`unexpected nil of "AccountProperties" of %s`, accountId) - } - if account.AccountProperties.AccountEndpoint == nil { - return nil, fmt.Errorf(`unexpected nil of "AccountProperties.AccountEndpoint" of %s`, accountId) + if model := account.Model; model != nil { + if model.Properties == nil { + return nil, fmt.Errorf(`unexpected nil of "AccountProperties" of %s`, accountId) + } + if model.Properties.AccountEndpoint == nil { + return nil, fmt.Errorf(`unexpected nil of "AccountProperties.AccountEndpoint" of %s`, accountId) + } } // Copy the client since we'll manipulate its BatchURL - endpoint := "https://" + *account.AccountProperties.AccountEndpoint + endpoint := "https://" + *account.Model.Properties.AccountEndpoint c := batchDataplane.NewJobClient(endpoint) c.BaseClient.Client.Authorizer = r.BatchManagementAuthorizer return &c, nil diff --git a/internal/services/batch/parse/account.go b/internal/services/batch/parse/account.go deleted file mode 100644 index b6ea8f222f6b..000000000000 --- a/internal/services/batch/parse/account.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type AccountId struct { - SubscriptionId string - ResourceGroup string - BatchAccountName string -} - -func NewAccountID(subscriptionId, resourceGroup, batchAccountName string) AccountId { - return AccountId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - BatchAccountName: batchAccountName, - } -} - -func (id AccountId) String() string { - segments := []string{ - fmt.Sprintf("Batch Account Name %q", id.BatchAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Account", segmentsStr) -} - -func (id AccountId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.BatchAccountName) -} - -// AccountID parses a Account ID into an AccountId struct -func AccountID(input string) (*AccountId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := AccountId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.BatchAccountName, err = id.PopSegment("batchAccounts"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/batch/parse/account_test.go b/internal/services/batch/parse/account_test.go deleted file mode 100644 index 2b4223305f4e..000000000000 --- a/internal/services/batch/parse/account_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = AccountId{} - -func TestAccountIDFormatter(t *testing.T) { - actual := NewAccountID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *AccountId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Error: true, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1", - Expected: &AccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - BatchAccountName: "account1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := AccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.BatchAccountName != v.Expected.BatchAccountName { - t.Fatalf("Expected %q but got %q for BatchAccountName", v.Expected.BatchAccountName, actual.BatchAccountName) - } - } -} diff --git a/internal/services/batch/parse/application.go b/internal/services/batch/parse/application.go deleted file mode 100644 index c314ec9d3788..000000000000 --- a/internal/services/batch/parse/application.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ApplicationId struct { - SubscriptionId string - ResourceGroup string - BatchAccountName string - Name string -} - -func NewApplicationID(subscriptionId, resourceGroup, batchAccountName, name string) ApplicationId { - return ApplicationId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - BatchAccountName: batchAccountName, - Name: name, - } -} - -func (id ApplicationId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Batch Account Name %q", id.BatchAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Application", segmentsStr) -} - -func (id ApplicationId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s/applications/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.BatchAccountName, id.Name) -} - -// ApplicationID parses a Application ID into an ApplicationId struct -func ApplicationID(input string) (*ApplicationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ApplicationId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.BatchAccountName, err = id.PopSegment("batchAccounts"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("applications"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/batch/parse/application_test.go b/internal/services/batch/parse/application_test.go deleted file mode 100644 index f86a807332b0..000000000000 --- a/internal/services/batch/parse/application_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = ApplicationId{} - -func TestApplicationIDFormatter(t *testing.T) { - actual := NewApplicationID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1", "application1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/applications/application1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestApplicationID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ApplicationId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Error: true, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/applications/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/applications/application1", - Expected: &ApplicationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - BatchAccountName: "account1", - Name: "application1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1/APPLICATIONS/APPLICATION1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ApplicationID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.BatchAccountName != v.Expected.BatchAccountName { - t.Fatalf("Expected %q but got %q for BatchAccountName", v.Expected.BatchAccountName, actual.BatchAccountName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/batch/parse/certificate.go b/internal/services/batch/parse/certificate.go deleted file mode 100644 index 9b289956ea3d..000000000000 --- a/internal/services/batch/parse/certificate.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type CertificateId struct { - SubscriptionId string - ResourceGroup string - BatchAccountName string - Name string -} - -func NewCertificateID(subscriptionId, resourceGroup, batchAccountName, name string) CertificateId { - return CertificateId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - BatchAccountName: batchAccountName, - Name: name, - } -} - -func (id CertificateId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Batch Account Name %q", id.BatchAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Certificate", segmentsStr) -} - -func (id CertificateId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s/certificates/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.BatchAccountName, id.Name) -} - -// CertificateID parses a Certificate ID into an CertificateId struct -func CertificateID(input string) (*CertificateId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := CertificateId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.BatchAccountName, err = id.PopSegment("batchAccounts"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("certificates"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/batch/parse/certificate_test.go b/internal/services/batch/parse/certificate_test.go deleted file mode 100644 index 4f04320ab973..000000000000 --- a/internal/services/batch/parse/certificate_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = CertificateId{} - -func TestCertificateIDFormatter(t *testing.T) { - actual := NewCertificateID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1", "certificate1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/certificates/certificate1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestCertificateID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CertificateId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Error: true, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/certificates/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/certificates/certificate1", - Expected: &CertificateId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - BatchAccountName: "account1", - Name: "certificate1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1/CERTIFICATES/CERTIFICATE1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := CertificateID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.BatchAccountName != v.Expected.BatchAccountName { - t.Fatalf("Expected %q but got %q for BatchAccountName", v.Expected.BatchAccountName, actual.BatchAccountName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/batch/parse/pool.go b/internal/services/batch/parse/pool.go deleted file mode 100644 index 91a7fb7bf7db..000000000000 --- a/internal/services/batch/parse/pool.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type PoolId struct { - SubscriptionId string - ResourceGroup string - BatchAccountName string - Name string -} - -func NewPoolID(subscriptionId, resourceGroup, batchAccountName, name string) PoolId { - return PoolId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - BatchAccountName: batchAccountName, - Name: name, - } -} - -func (id PoolId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Batch Account Name %q", id.BatchAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Pool", segmentsStr) -} - -func (id PoolId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s/pools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.BatchAccountName, id.Name) -} - -// PoolID parses a Pool ID into an PoolId struct -func PoolID(input string) (*PoolId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := PoolId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.BatchAccountName, err = id.PopSegment("batchAccounts"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("pools"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/batch/parse/pool_test.go b/internal/services/batch/parse/pool_test.go deleted file mode 100644 index d12ed0e7601f..000000000000 --- a/internal/services/batch/parse/pool_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = PoolId{} - -func TestPoolIDFormatter(t *testing.T) { - actual := NewPoolID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1", "pool1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/pool1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestPoolID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *PoolId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Error: true, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/pool1", - Expected: &PoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - BatchAccountName: "account1", - Name: "pool1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1/POOLS/POOL1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := PoolID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.BatchAccountName != v.Expected.BatchAccountName { - t.Fatalf("Expected %q but got %q for BatchAccountName", v.Expected.BatchAccountName, actual.BatchAccountName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/batch/resourceids.go b/internal/services/batch/resourceids.go index b669fefe80c3..84b05b211509 100644 --- a/internal/services/batch/resourceids.go +++ b/internal/services/batch/resourceids.go @@ -1,7 +1,3 @@ package batch -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Account -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Application -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/applications/application1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Certificate -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/certificates/certificate1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Pool -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/pool1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Job -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/pool1/jobs/job1 diff --git a/internal/services/batch/validate/account_id.go b/internal/services/batch/validate/account_id.go deleted file mode 100644 index 5f170e22167c..000000000000 --- a/internal/services/batch/validate/account_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" -) - -func AccountID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.AccountID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/batch/validate/account_id_test.go b/internal/services/batch/validate/account_id_test.go deleted file mode 100644 index 315c4c0c2825..000000000000 --- a/internal/services/batch/validate/account_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestAccountID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Valid: false, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := AccountID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/batch/validate/application_id.go b/internal/services/batch/validate/application_id.go deleted file mode 100644 index c050f8a8ade6..000000000000 --- a/internal/services/batch/validate/application_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" -) - -func ApplicationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ApplicationID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/batch/validate/application_id_test.go b/internal/services/batch/validate/application_id_test.go deleted file mode 100644 index 0f1c9f716c3c..000000000000 --- a/internal/services/batch/validate/application_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestApplicationID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Valid: false, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/applications/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/applications/application1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1/APPLICATIONS/APPLICATION1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ApplicationID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/batch/validate/certificate_id.go b/internal/services/batch/validate/certificate_id.go deleted file mode 100644 index b0691b76ad58..000000000000 --- a/internal/services/batch/validate/certificate_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" -) - -func CertificateID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.CertificateID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/batch/validate/certificate_id_test.go b/internal/services/batch/validate/certificate_id_test.go deleted file mode 100644 index b96194787fcd..000000000000 --- a/internal/services/batch/validate/certificate_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestCertificateID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Valid: false, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/certificates/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/certificates/certificate1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1/CERTIFICATES/CERTIFICATE1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := CertificateID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/batch/validate/pool_id.go b/internal/services/batch/validate/pool_id.go deleted file mode 100644 index b5a96fbe41e5..000000000000 --- a/internal/services/batch/validate/pool_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" -) - -func PoolID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.PoolID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/batch/validate/pool_id_test.go b/internal/services/batch/validate/pool_id_test.go deleted file mode 100644 index bcdb1865436b..000000000000 --- a/internal/services/batch/validate/pool_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestPoolID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/", - Valid: false, - }, - - { - // missing value for BatchAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/pool1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.BATCH/BATCHACCOUNTS/ACCOUNT1/POOLS/POOL1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := PoolID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/bot/bot_channel_alexa_resource.go b/internal/services/bot/bot_channel_alexa_resource.go index 64951acb44a2..001bfc98f335 100644 --- a/internal/services/bot/bot_channel_alexa_resource.go +++ b/internal/services/bot/bot_channel_alexa_resource.go @@ -7,7 +7,6 @@ import ( "strconv" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -20,6 +19,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) func resourceBotChannelAlexa() *pluginsdk.Resource { diff --git a/internal/services/bot/bot_channel_alexa_resource_test.go b/internal/services/bot/bot_channel_alexa_resource_test.go index 26c0a1378471..7ca70129b19a 100644 --- a/internal/services/bot/bot_channel_alexa_resource_test.go +++ b/internal/services/bot/bot_channel_alexa_resource_test.go @@ -5,7 +5,6 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/google/uuid" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" @@ -13,6 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) type BotChannelAlexaResource struct{} diff --git a/internal/services/bot/bot_channel_direct_line_speech_resource.go b/internal/services/bot/bot_channel_direct_line_speech_resource.go index 38def3fbcafc..4230a62a956b 100644 --- a/internal/services/bot/bot_channel_direct_line_speech_resource.go +++ b/internal/services/bot/bot_channel_direct_line_speech_resource.go @@ -5,7 +5,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -19,6 +18,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) func resourceBotChannelDirectLineSpeech() *pluginsdk.Resource { diff --git a/internal/services/bot/bot_channel_direct_line_speech_resource_test.go b/internal/services/bot/bot_channel_direct_line_speech_resource_test.go index 08977d00ad3e..d1a3f60c1009 100644 --- a/internal/services/bot/bot_channel_direct_line_speech_resource_test.go +++ b/internal/services/bot/bot_channel_direct_line_speech_resource_test.go @@ -5,13 +5,13 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) type BotChannelDirectLineSpeechResource struct{} diff --git a/internal/services/bot/bot_channel_directline_resource.go b/internal/services/bot/bot_channel_directline_resource.go index 93d16d47a78b..87b552f56323 100644 --- a/internal/services/bot/bot_channel_directline_resource.go +++ b/internal/services/bot/bot_channel_directline_resource.go @@ -5,7 +5,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -17,6 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) func resourceBotChannelDirectline() *pluginsdk.Resource { diff --git a/internal/services/bot/bot_channel_directline_resource_test.go b/internal/services/bot/bot_channel_directline_resource_test.go index 45fad65b9965..f035b59076f0 100644 --- a/internal/services/bot/bot_channel_directline_resource_test.go +++ b/internal/services/bot/bot_channel_directline_resource_test.go @@ -5,13 +5,13 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) type BotChannelDirectlineResource struct{} diff --git a/internal/services/bot/bot_channel_email_resource.go b/internal/services/bot/bot_channel_email_resource.go index 84d853a999e8..90aeba44c014 100644 --- a/internal/services/bot/bot_channel_email_resource.go +++ b/internal/services/bot/bot_channel_email_resource.go @@ -5,7 +5,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -17,6 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) func resourceBotChannelEmail() *pluginsdk.Resource { diff --git a/internal/services/bot/bot_channel_email_resource_test.go b/internal/services/bot/bot_channel_email_resource_test.go index ffe6b9491ee7..0d21ecff4f5e 100644 --- a/internal/services/bot/bot_channel_email_resource_test.go +++ b/internal/services/bot/bot_channel_email_resource_test.go @@ -6,13 +6,13 @@ import ( "os" "testing" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) type BotChannelEmailResource struct{} diff --git a/internal/services/bot/bot_channel_facebook_resource.go b/internal/services/bot/bot_channel_facebook_resource.go index b9f41605b399..61c4ed0340a2 100644 --- a/internal/services/bot/bot_channel_facebook_resource.go +++ b/internal/services/bot/bot_channel_facebook_resource.go @@ -5,7 +5,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -18,6 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) func resourceBotChannelFacebook() *pluginsdk.Resource { diff --git a/internal/services/bot/bot_channel_facebook_resource_test.go b/internal/services/bot/bot_channel_facebook_resource_test.go index eaee63ecbc9c..694b0c523d91 100644 --- a/internal/services/bot/bot_channel_facebook_resource_test.go +++ b/internal/services/bot/bot_channel_facebook_resource_test.go @@ -6,13 +6,13 @@ import ( "os" "testing" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) type BotChannelFacebookResource struct{} diff --git a/internal/services/bot/bot_channel_line_resource.go b/internal/services/bot/bot_channel_line_resource.go index 345cb3957d0c..c169f754d8b9 100644 --- a/internal/services/bot/bot_channel_line_resource.go +++ b/internal/services/bot/bot_channel_line_resource.go @@ -5,7 +5,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -18,6 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) func resourceBotChannelLine() *pluginsdk.Resource { diff --git a/internal/services/bot/bot_channel_line_resource_test.go b/internal/services/bot/bot_channel_line_resource_test.go index 93045f724111..1dcb260a3468 100644 --- a/internal/services/bot/bot_channel_line_resource_test.go +++ b/internal/services/bot/bot_channel_line_resource_test.go @@ -6,13 +6,13 @@ import ( "os" "testing" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) type BotChannelLineResource struct{} diff --git a/internal/services/bot/bot_channel_ms_teams_resource.go b/internal/services/bot/bot_channel_ms_teams_resource.go index 8529ca3d27ac..464b875c8170 100644 --- a/internal/services/bot/bot_channel_ms_teams_resource.go +++ b/internal/services/bot/bot_channel_ms_teams_resource.go @@ -5,7 +5,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -18,6 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) func resourceBotChannelMsTeams() *pluginsdk.Resource { @@ -103,7 +103,7 @@ func resourceBotChannelMsTeamsCreate(d *pluginsdk.ResourceData, meta interface{} if v, ok := d.GetOk("calling_web_hook"); ok { channel, _ := channel.Properties.AsMsTeamsChannel() - channel.Properties.CallingWebHook = utils.String(v.(string)) + channel.Properties.CallingWebhook = utils.String(v.(string)) } if _, err := client.Create(ctx, resourceId.ResourceGroup, resourceId.BotServiceName, botservice.ChannelNameMsTeamsChannel, channel); err != nil { @@ -142,7 +142,7 @@ func resourceBotChannelMsTeamsRead(d *pluginsdk.ResourceData, meta interface{}) if props := resp.Properties; props != nil { if channel, ok := props.AsMsTeamsChannel(); ok { if channelProps := channel.Properties; channelProps != nil { - d.Set("calling_web_hook", channelProps.CallingWebHook) + d.Set("calling_web_hook", channelProps.CallingWebhook) d.Set("enable_calling", channelProps.EnableCalling) } } @@ -165,7 +165,7 @@ func resourceBotChannelMsTeamsUpdate(d *pluginsdk.ResourceData, meta interface{} Properties: botservice.MsTeamsChannel{ Properties: &botservice.MsTeamsChannelProperties{ EnableCalling: utils.Bool(d.Get("enable_calling").(bool)), - CallingWebHook: utils.String(d.Get("calling_web_hook").(string)), + CallingWebhook: utils.String(d.Get("calling_web_hook").(string)), IsEnabled: utils.Bool(true), }, ChannelName: botservice.ChannelNameBasicChannelChannelNameMsTeamsChannel, diff --git a/internal/services/bot/bot_channel_ms_teams_resource_test.go b/internal/services/bot/bot_channel_ms_teams_resource_test.go index 3071eabe3845..a757194d0f65 100644 --- a/internal/services/bot/bot_channel_ms_teams_resource_test.go +++ b/internal/services/bot/bot_channel_ms_teams_resource_test.go @@ -5,13 +5,13 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) type BotChannelMsTeamsResource struct{} diff --git a/internal/services/bot/bot_channel_slack_resource.go b/internal/services/bot/bot_channel_slack_resource.go index 7394dc69ff11..ab3a1d547b73 100644 --- a/internal/services/bot/bot_channel_slack_resource.go +++ b/internal/services/bot/bot_channel_slack_resource.go @@ -5,7 +5,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -17,6 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) func resourceBotChannelSlack() *pluginsdk.Resource { diff --git a/internal/services/bot/bot_channel_slack_resource_test.go b/internal/services/bot/bot_channel_slack_resource_test.go index 516dd563b624..22f75f129c2e 100644 --- a/internal/services/bot/bot_channel_slack_resource_test.go +++ b/internal/services/bot/bot_channel_slack_resource_test.go @@ -6,13 +6,13 @@ import ( "os" "testing" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) type BotChannelSlackResource struct{} diff --git a/internal/services/bot/bot_channel_sms_resource.go b/internal/services/bot/bot_channel_sms_resource.go index 211094bb6b9a..ae175461ab76 100644 --- a/internal/services/bot/bot_channel_sms_resource.go +++ b/internal/services/bot/bot_channel_sms_resource.go @@ -5,7 +5,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -18,6 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) func resourceBotChannelSMS() *pluginsdk.Resource { diff --git a/internal/services/bot/bot_channel_sms_resource_test.go b/internal/services/bot/bot_channel_sms_resource_test.go index e9b8604df7d3..d6c21adbcf7c 100644 --- a/internal/services/bot/bot_channel_sms_resource_test.go +++ b/internal/services/bot/bot_channel_sms_resource_test.go @@ -6,13 +6,13 @@ import ( "os" "testing" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) type BotChannelSMSResource struct{} diff --git a/internal/services/bot/bot_channel_web_chat_resource.go b/internal/services/bot/bot_channel_web_chat_resource.go index 4bd23a7a332b..1569f8c5f8bc 100644 --- a/internal/services/bot/bot_channel_web_chat_resource.go +++ b/internal/services/bot/bot_channel_web_chat_resource.go @@ -5,7 +5,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" @@ -17,6 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) func resourceBotChannelWebChat() *pluginsdk.Resource { diff --git a/internal/services/bot/bot_channel_web_chat_resource_test.go b/internal/services/bot/bot_channel_web_chat_resource_test.go index 7f07655d460f..9fbeb14b36db 100644 --- a/internal/services/bot/bot_channel_web_chat_resource_test.go +++ b/internal/services/bot/bot_channel_web_chat_resource_test.go @@ -5,13 +5,13 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) type BotChannelWebChatResource struct{} diff --git a/internal/services/bot/bot_channels_registration_resource.go b/internal/services/bot/bot_channels_registration_resource.go index 32258ee39a94..bc658bc0a705 100644 --- a/internal/services/bot/bot_channels_registration_resource.go +++ b/internal/services/bot/bot_channels_registration_resource.go @@ -6,7 +6,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -21,6 +20,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) func resourceBotChannelsRegistration() *pluginsdk.Resource { diff --git a/internal/services/bot/bot_connection_resource.go b/internal/services/bot/bot_connection_resource.go index 59a813eabfbd..b3b08f0c1103 100644 --- a/internal/services/bot/bot_connection_resource.go +++ b/internal/services/bot/bot_connection_resource.go @@ -6,7 +6,6 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -18,6 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) func resourceArmBotConnection() *pluginsdk.Resource { diff --git a/internal/services/bot/bot_healthbot_resource.go b/internal/services/bot/bot_healthbot_resource.go index 7a22670a7c4e..0b6f7f255c1b 100644 --- a/internal/services/bot/bot_healthbot_resource.go +++ b/internal/services/bot/bot_healthbot_resource.go @@ -122,7 +122,7 @@ func resourceHealthbotServiceRead(d *pluginsdk.ResourceData, meta interface{}) e return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.BotName) + d.Set("name", id.HealthBotName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/bot/bot_service_azure_bot_resource.go b/internal/services/bot/bot_service_azure_bot_resource.go index 3a95937cc9a5..c11ccbc12b65 100644 --- a/internal/services/bot/bot_service_azure_bot_resource.go +++ b/internal/services/bot/bot_service_azure_bot_resource.go @@ -1,11 +1,11 @@ package bot import ( - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) type AzureBotServiceResource struct { diff --git a/internal/services/bot/bot_service_base_resource.go b/internal/services/bot/bot_service_base_resource.go deleted file mode 100644 index a6475245252e..000000000000 --- a/internal/services/bot/bot_service_base_resource.go +++ /dev/null @@ -1,408 +0,0 @@ -package bot - -import ( - "context" - "fmt" - "time" - - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" - "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" - "github.com/hashicorp/terraform-provider-azurerm/utils" -) - -type botBaseResource struct{} - -func (br botBaseResource) arguments(fields map[string]*pluginsdk.Schema) map[string]*pluginsdk.Schema { - output := map[string]*pluginsdk.Schema{ - "resource_group_name": commonschema.ResourceGroupName(), - - "location": commonschema.Location(), - - "sku": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - string(botservice.SkuNameF0), - string(botservice.SkuNameS1), - }, false), - }, - - "microsoft_app_id": { - Type: pluginsdk.TypeString, - ForceNew: true, - Required: true, - ValidateFunc: validation.IsUUID, - }, - - "display_name": { - Type: pluginsdk.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "endpoint": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "developer_app_insights_key": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.IsUUID, - }, - - "developer_app_insights_api_key": { - Type: pluginsdk.TypeString, - Optional: true, - Sensitive: true, - ValidateFunc: validation.StringIsNotEmpty, - DiffSuppressFunc: func(k, old, new string, d *pluginsdk.ResourceData) bool { - // This field for the api key isn't returned at all from Azure - return (new == d.Get(k).(string)) && (old == "") - }, - }, - - "developer_app_insights_application_id": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.IsUUID, - }, - - "microsoft_app_msi_id": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: commonids.ValidateUserAssignedIdentityID, - }, - - "microsoft_app_tenant_id": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IsUUID, - }, - - "microsoft_app_type": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - string(botservice.MsaAppTypeMultiTenant), - string(botservice.MsaAppTypeSingleTenant), - string(botservice.MsaAppTypeUserAssignedMSI), - }, false), - }, - - "luis_app_ids": { - Type: pluginsdk.TypeList, - Optional: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - ValidateFunc: validation.IsUUID, - }, - }, - - "luis_key": { - Type: pluginsdk.TypeString, - Optional: true, - Sensitive: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "streaming_endpoint_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Default: false, - }, - - "tags": tags.Schema(), - } - - for k, v := range fields { - output[k] = v - } - - return output -} - -func (br botBaseResource) attributes() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{} -} - -func (br botBaseResource) createFunc(resourceName, botKind string) sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.Bot.BotClient - subscriptionId := metadata.Client.Account.SubscriptionId - - id := parse.NewBotServiceID(subscriptionId, metadata.ResourceData.Get("resource_group_name").(string), metadata.ResourceData.Get("name").(string)) - - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) - if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing %s: %+v", id, err) - } - } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError(resourceName, id.ID()) - } - - displayName := metadata.ResourceData.Get("display_name").(string) - if displayName == "" { - displayName = id.Name - } - - props := botservice.Bot{ - Location: utils.String(metadata.ResourceData.Get("location").(string)), - Sku: &botservice.Sku{ - Name: botservice.SkuName(metadata.ResourceData.Get("sku").(string)), - }, - Kind: botservice.Kind(botKind), - Properties: &botservice.BotProperties{ - DisplayName: utils.String(displayName), - Endpoint: utils.String(metadata.ResourceData.Get("endpoint").(string)), - MsaAppID: utils.String(metadata.ResourceData.Get("microsoft_app_id").(string)), - DeveloperAppInsightKey: utils.String(metadata.ResourceData.Get("developer_app_insights_key").(string)), - DeveloperAppInsightsAPIKey: utils.String(metadata.ResourceData.Get("developer_app_insights_api_key").(string)), - DeveloperAppInsightsApplicationID: utils.String(metadata.ResourceData.Get("developer_app_insights_application_id").(string)), - LuisAppIds: utils.ExpandStringSlice(metadata.ResourceData.Get("luis_app_ids").([]interface{})), - LuisKey: utils.String(metadata.ResourceData.Get("luis_key").(string)), - IsStreamingSupported: utils.Bool(metadata.ResourceData.Get("streaming_endpoint_enabled").(bool)), - }, - Tags: tags.Expand(metadata.ResourceData.Get("tags").(map[string]interface{})), - } - - if v, ok := metadata.ResourceData.GetOk("microsoft_app_type"); ok { - props.Properties.MsaAppType = botservice.MsaAppType(v.(string)) - } - - if v, ok := metadata.ResourceData.GetOk("microsoft_app_tenant_id"); ok { - props.Properties.MsaAppTenantID = utils.String(v.(string)) - } - - if v, ok := metadata.ResourceData.GetOk("microsoft_app_msi_id"); ok { - props.Properties.MsaAppMSIResourceID = utils.String(v.(string)) - } - - if _, err := client.Create(ctx, id.ResourceGroup, id.Name, props); err != nil { - return fmt.Errorf("creating %s: %+v", id, err) - } - - metadata.SetID(id) - return nil - }, - } -} - -func (br botBaseResource) readFunc() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 5 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.Bot.BotClient - - id, err := parse.BotServiceID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) - if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return metadata.MarkAsGone(id) - } - return fmt.Errorf("retrieving %s: %+v", *id, err) - } - - metadata.ResourceData.Set("name", id.Name) - metadata.ResourceData.Set("resource_group_name", id.ResourceGroup) - metadata.ResourceData.Set("location", location.NormalizeNilable(resp.Location)) - - sku := "" - if v := resp.Sku; v != nil { - sku = string(v.Name) - } - metadata.ResourceData.Set("sku", sku) - - metadata.ResourceData.Set("tags", tags.FlattenAndSet(metadata.ResourceData, resp.Tags)) - - if props := resp.Properties; props != nil { - msAppId := "" - if v := props.MsaAppID; v != nil { - msAppId = *v - } - metadata.ResourceData.Set("microsoft_app_id", msAppId) - - displayName := "" - if v := props.DisplayName; v != nil { - displayName = *v - } - metadata.ResourceData.Set("display_name", displayName) - - endpoint := "" - if v := props.Endpoint; v != nil { - endpoint = *v - } - metadata.ResourceData.Set("endpoint", endpoint) - - key := "" - if v := props.DeveloperAppInsightKey; v != nil { - key = *v - } - metadata.ResourceData.Set("developer_app_insights_key", key) - - apiKey := "" - if v := props.DeveloperAppInsightsAPIKey; v != nil { - apiKey = *v - } - metadata.ResourceData.Set("developer_app_insights_api_key", apiKey) - - appInsightsId := "" - if v := props.DeveloperAppInsightsApplicationID; v != nil { - appInsightsId = *v - } - metadata.ResourceData.Set("developer_app_insights_application_id", appInsightsId) - - msaAppType := "" - if v := props.MsaAppType; v != "" { - msaAppType = string(v) - } - metadata.ResourceData.Set("microsoft_app_type", msaAppType) - - msaAppTenantId := "" - if v := props.MsaAppTenantID; v != nil { - msaAppTenantId = *v - } - metadata.ResourceData.Set("microsoft_app_tenant_id", msaAppTenantId) - - msaAppMSIId := "" - if v := props.MsaAppMSIResourceID; v != nil { - msaAppMSIId = *v - } - metadata.ResourceData.Set("microsoft_app_msi_id", msaAppMSIId) - - var luisAppIds []string - if v := props.LuisAppIds; v != nil { - luisAppIds = *v - } - metadata.ResourceData.Set("luis_app_ids", utils.FlattenStringSlice(&luisAppIds)) - - streamingEndpointEnabled := false - if v := props.IsStreamingSupported; v != nil { - streamingEndpointEnabled = *v - } - metadata.ResourceData.Set("streaming_endpoint_enabled", streamingEndpointEnabled) - } - - return nil - }, - } -} - -func (br botBaseResource) deleteFunc() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.Bot.BotClient - id, err := parse.BotServiceID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - if _, err = client.Delete(ctx, id.ResourceGroup, id.Name); err != nil { - return fmt.Errorf("deleting %s: %+v", *id, err) - } - - return nil - }, - } -} - -func (br botBaseResource) updateFunc() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.Bot.BotClient - id, err := parse.BotServiceID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) - if err != nil { - return fmt.Errorf("retrieving %s: %+v", *id, err) - } - - if metadata.ResourceData.HasChange("display_name") { - existing.Properties.DisplayName = utils.String(metadata.ResourceData.Get("display_name").(string)) - } - - if metadata.ResourceData.HasChange("endpoint") { - existing.Properties.Endpoint = utils.String(metadata.ResourceData.Get("endpoint").(string)) - } - - if metadata.ResourceData.HasChange("developer_app_insights_key") { - existing.Properties.DeveloperAppInsightKey = utils.String(metadata.ResourceData.Get("developer_app_insights_key").(string)) - } - - if metadata.ResourceData.HasChange("developer_app_insights_api_key") { - existing.Properties.DeveloperAppInsightsAPIKey = utils.String(metadata.ResourceData.Get("developer_app_insights_api_key").(string)) - } - - if metadata.ResourceData.HasChange("developer_app_insights_application_id") { - existing.Properties.DeveloperAppInsightsApplicationID = utils.String(metadata.ResourceData.Get("developer_app_insights_application_id").(string)) - } - - if metadata.ResourceData.HasChange("luis_app_ids") { - existing.Properties.LuisAppIds = utils.ExpandStringSlice(metadata.ResourceData.Get("luis_app_ids").([]interface{})) - } - - if metadata.ResourceData.HasChange("luis_key") { - existing.Properties.LuisKey = utils.String(metadata.ResourceData.Get("luis_key").(string)) - } - - if metadata.ResourceData.HasChange("streaming_endpoint_enabled") { - existing.Properties.IsStreamingSupported = utils.Bool(metadata.ResourceData.Get("streaming_endpoint_enabled").(bool)) - } - - if _, err := client.Update(ctx, id.ResourceGroup, id.Name, existing); err != nil { - return fmt.Errorf("updating %s: %+v", *id, err) - } - - return nil - }, - } -} - -func (br botBaseResource) importerFunc(expectKind string) sdk.ResourceRunFunc { - return func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.Bot.BotClient - - id, err := parse.BotServiceID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) - if err != nil { - return fmt.Errorf("retrieving %s: %+v", *id, err) - } - - if actualKind := string(resp.Kind); actualKind != expectKind { - return fmt.Errorf("bot has mismatched type, expected: %q, got %q", expectKind, actualKind) - } - - return nil - } -} diff --git a/internal/services/bot/bot_service_resource_base.go b/internal/services/bot/bot_service_resource_base.go new file mode 100644 index 000000000000..46b624a75f8f --- /dev/null +++ b/internal/services/bot/bot_service_resource_base.go @@ -0,0 +1,408 @@ +package bot + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tags" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" +) + +type botBaseResource struct{} + +func (br botBaseResource) arguments(fields map[string]*pluginsdk.Schema) map[string]*pluginsdk.Schema { + output := map[string]*pluginsdk.Schema{ + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "sku": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(botservice.SkuNameF0), + string(botservice.SkuNameS1), + }, false), + }, + + "microsoft_app_id": { + Type: pluginsdk.TypeString, + ForceNew: true, + Required: true, + ValidateFunc: validation.IsUUID, + }, + + "display_name": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "endpoint": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "developer_app_insights_key": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.IsUUID, + }, + + "developer_app_insights_api_key": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + DiffSuppressFunc: func(k, old, new string, d *pluginsdk.ResourceData) bool { + // This field for the api key isn't returned at all from Azure + return (new == d.Get(k).(string)) && (old == "") + }, + }, + + "developer_app_insights_application_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.IsUUID, + }, + + "microsoft_app_msi_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, + }, + + "microsoft_app_tenant_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IsUUID, + }, + + "microsoft_app_type": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(botservice.MsaAppTypeMultiTenant), + string(botservice.MsaAppTypeSingleTenant), + string(botservice.MsaAppTypeUserAssignedMSI), + }, false), + }, + + "luis_app_ids": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.IsUUID, + }, + }, + + "luis_key": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "streaming_endpoint_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "tags": tags.Schema(), + } + + for k, v := range fields { + output[k] = v + } + + return output +} + +func (br botBaseResource) attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (br botBaseResource) createFunc(resourceName, botKind string) sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Bot.BotClient + subscriptionId := metadata.Client.Account.SubscriptionId + + id := parse.NewBotServiceID(subscriptionId, metadata.ResourceData.Get("resource_group_name").(string), metadata.ResourceData.Get("name").(string)) + + existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + if !utils.ResponseWasNotFound(existing.Response) { + return tf.ImportAsExistsError(resourceName, id.ID()) + } + + displayName := metadata.ResourceData.Get("display_name").(string) + if displayName == "" { + displayName = id.Name + } + + props := botservice.Bot{ + Location: utils.String(metadata.ResourceData.Get("location").(string)), + Sku: &botservice.Sku{ + Name: botservice.SkuName(metadata.ResourceData.Get("sku").(string)), + }, + Kind: botservice.Kind(botKind), + Properties: &botservice.BotProperties{ + DisplayName: utils.String(displayName), + Endpoint: utils.String(metadata.ResourceData.Get("endpoint").(string)), + MsaAppID: utils.String(metadata.ResourceData.Get("microsoft_app_id").(string)), + DeveloperAppInsightKey: utils.String(metadata.ResourceData.Get("developer_app_insights_key").(string)), + DeveloperAppInsightsAPIKey: utils.String(metadata.ResourceData.Get("developer_app_insights_api_key").(string)), + DeveloperAppInsightsApplicationID: utils.String(metadata.ResourceData.Get("developer_app_insights_application_id").(string)), + LuisAppIds: utils.ExpandStringSlice(metadata.ResourceData.Get("luis_app_ids").([]interface{})), + LuisKey: utils.String(metadata.ResourceData.Get("luis_key").(string)), + IsStreamingSupported: utils.Bool(metadata.ResourceData.Get("streaming_endpoint_enabled").(bool)), + }, + Tags: tags.Expand(metadata.ResourceData.Get("tags").(map[string]interface{})), + } + + if v, ok := metadata.ResourceData.GetOk("microsoft_app_type"); ok { + props.Properties.MsaAppType = botservice.MsaAppType(v.(string)) + } + + if v, ok := metadata.ResourceData.GetOk("microsoft_app_tenant_id"); ok { + props.Properties.MsaAppTenantID = utils.String(v.(string)) + } + + if v, ok := metadata.ResourceData.GetOk("microsoft_app_msi_id"); ok { + props.Properties.MsaAppMSIResourceID = utils.String(v.(string)) + } + + if _, err := client.Create(ctx, id.ResourceGroup, id.Name, props); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (br botBaseResource) readFunc() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Bot.BotClient + + id, err := parse.BotServiceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + metadata.ResourceData.Set("name", id.Name) + metadata.ResourceData.Set("resource_group_name", id.ResourceGroup) + metadata.ResourceData.Set("location", location.NormalizeNilable(resp.Location)) + + sku := "" + if v := resp.Sku; v != nil { + sku = string(v.Name) + } + metadata.ResourceData.Set("sku", sku) + + metadata.ResourceData.Set("tags", tags.FlattenAndSet(metadata.ResourceData, resp.Tags)) + + if props := resp.Properties; props != nil { + msAppId := "" + if v := props.MsaAppID; v != nil { + msAppId = *v + } + metadata.ResourceData.Set("microsoft_app_id", msAppId) + + displayName := "" + if v := props.DisplayName; v != nil { + displayName = *v + } + metadata.ResourceData.Set("display_name", displayName) + + endpoint := "" + if v := props.Endpoint; v != nil { + endpoint = *v + } + metadata.ResourceData.Set("endpoint", endpoint) + + key := "" + if v := props.DeveloperAppInsightKey; v != nil { + key = *v + } + metadata.ResourceData.Set("developer_app_insights_key", key) + + apiKey := "" + if v := props.DeveloperAppInsightsAPIKey; v != nil { + apiKey = *v + } + metadata.ResourceData.Set("developer_app_insights_api_key", apiKey) + + appInsightsId := "" + if v := props.DeveloperAppInsightsApplicationID; v != nil { + appInsightsId = *v + } + metadata.ResourceData.Set("developer_app_insights_application_id", appInsightsId) + + msaAppType := "" + if v := props.MsaAppType; v != "" { + msaAppType = string(v) + } + metadata.ResourceData.Set("microsoft_app_type", msaAppType) + + msaAppTenantId := "" + if v := props.MsaAppTenantID; v != nil { + msaAppTenantId = *v + } + metadata.ResourceData.Set("microsoft_app_tenant_id", msaAppTenantId) + + msaAppMSIId := "" + if v := props.MsaAppMSIResourceID; v != nil { + msaAppMSIId = *v + } + metadata.ResourceData.Set("microsoft_app_msi_id", msaAppMSIId) + + var luisAppIds []string + if v := props.LuisAppIds; v != nil { + luisAppIds = *v + } + metadata.ResourceData.Set("luis_app_ids", utils.FlattenStringSlice(&luisAppIds)) + + streamingEndpointEnabled := false + if v := props.IsStreamingSupported; v != nil { + streamingEndpointEnabled = *v + } + metadata.ResourceData.Set("streaming_endpoint_enabled", streamingEndpointEnabled) + } + + return nil + }, + } +} + +func (br botBaseResource) deleteFunc() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Bot.BotClient + id, err := parse.BotServiceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err = client.Delete(ctx, id.ResourceGroup, id.Name); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (br botBaseResource) updateFunc() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Bot.BotClient + id, err := parse.BotServiceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + if metadata.ResourceData.HasChange("display_name") { + existing.Properties.DisplayName = utils.String(metadata.ResourceData.Get("display_name").(string)) + } + + if metadata.ResourceData.HasChange("endpoint") { + existing.Properties.Endpoint = utils.String(metadata.ResourceData.Get("endpoint").(string)) + } + + if metadata.ResourceData.HasChange("developer_app_insights_key") { + existing.Properties.DeveloperAppInsightKey = utils.String(metadata.ResourceData.Get("developer_app_insights_key").(string)) + } + + if metadata.ResourceData.HasChange("developer_app_insights_api_key") { + existing.Properties.DeveloperAppInsightsAPIKey = utils.String(metadata.ResourceData.Get("developer_app_insights_api_key").(string)) + } + + if metadata.ResourceData.HasChange("developer_app_insights_application_id") { + existing.Properties.DeveloperAppInsightsApplicationID = utils.String(metadata.ResourceData.Get("developer_app_insights_application_id").(string)) + } + + if metadata.ResourceData.HasChange("luis_app_ids") { + existing.Properties.LuisAppIds = utils.ExpandStringSlice(metadata.ResourceData.Get("luis_app_ids").([]interface{})) + } + + if metadata.ResourceData.HasChange("luis_key") { + existing.Properties.LuisKey = utils.String(metadata.ResourceData.Get("luis_key").(string)) + } + + if metadata.ResourceData.HasChange("streaming_endpoint_enabled") { + existing.Properties.IsStreamingSupported = utils.Bool(metadata.ResourceData.Get("streaming_endpoint_enabled").(bool)) + } + + if _, err := client.Update(ctx, id.ResourceGroup, id.Name, existing); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (br botBaseResource) importerFunc(expectKind string) sdk.ResourceRunFunc { + return func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Bot.BotClient + + id, err := parse.BotServiceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + if actualKind := string(resp.Kind); actualKind != expectKind { + return fmt.Errorf("bot has mismatched type, expected: %q, got %q", expectKind, actualKind) + } + + return nil + } +} diff --git a/internal/services/bot/bot_web_app_resource.go b/internal/services/bot/bot_web_app_resource.go index ea56435a2cba..225a29ebfc57 100644 --- a/internal/services/bot/bot_web_app_resource.go +++ b/internal/services/bot/bot_web_app_resource.go @@ -6,7 +6,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -18,6 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) func resourceBotWebApp() *pluginsdk.Resource { diff --git a/internal/services/bot/client/client.go b/internal/services/bot/client/client.go index 4782645ffbcf..0afa5b43c857 100644 --- a/internal/services/bot/client/client.go +++ b/internal/services/bot/client/client.go @@ -1,11 +1,11 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/healthbot/mgmt/2020-12-08/healthbot" // nolint: staticcheck - "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/healthbot/mgmt/2020-12-08/healthbot" // nolint: staticcheck "github.com/Azure/go-autorest/autorest" healthbot_2020_12_08 "github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2020-12-08" "github.com/hashicorp/terraform-provider-azurerm/internal/common" + "github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice" ) type Client struct { diff --git a/internal/services/cdn/azuresdkhacks/cdn_frontdoor_origin_group.go b/internal/services/cdn/azuresdkhacks/cdn_frontdoor_origin_group.go new file mode 100644 index 000000000000..252bb31a3dc5 --- /dev/null +++ b/internal/services/cdn/azuresdkhacks/cdn_frontdoor_origin_group.go @@ -0,0 +1,132 @@ +package azuresdkhacks + +import ( + "context" + "encoding/json" + "net/http" + + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck + "github.com/Azure/go-autorest/autorest" +) + +// NOTE: this workaround client exists to allow the removal of 'healthProbes' during update + +type CdnFrontDoorOriginGroupsWorkaroundClient struct { + sdkClient *cdn.AFDOriginGroupsClient +} + +func NewCdnFrontDoorOriginGroupsWorkaroundClient(client *cdn.AFDOriginGroupsClient) CdnFrontDoorOriginGroupsWorkaroundClient { + return CdnFrontDoorOriginGroupsWorkaroundClient{ + sdkClient: client, + } +} + +func (c *CdnFrontDoorOriginGroupsWorkaroundClient) Update(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, afdOriginGroupUpdateProperties AFDOriginGroupUpdateParameters) (result cdn.AFDOriginGroupsUpdateFuture, err error) { + req, err := c.UpdatePreparer(ctx, resourceGroupName, profileName, originGroupName, afdOriginGroupUpdateProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.sdkClient.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginGroupsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client CdnFrontDoorOriginGroupsWorkaroundClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, originGroupName string, afdOriginGroupUpdateProperties AFDOriginGroupUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "originGroupName": autorest.Encode("path", originGroupName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.sdkClient.SubscriptionID), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.sdkClient.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}", pathParameters), + autorest.WithJSON(afdOriginGroupUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// OriginGroupUpdateParameters origin group properties needed for origin group creation or update. +type AFDOriginGroupUpdateParameters struct { + *AFDOriginGroupUpdatePropertiesParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for OriginGroupUpdateParameters. +func (ogup AFDOriginGroupUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ogup.AFDOriginGroupUpdatePropertiesParameters != nil { + objectMap["properties"] = ogup.AFDOriginGroupUpdatePropertiesParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AFDOriginGroupUpdateParameters struct. +func (ogup *AFDOriginGroupUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { // nolint gocritic + case "properties": + if v != nil { + var afdOriginGroupUpdatePropertiesParameters AFDOriginGroupUpdatePropertiesParameters + err = json.Unmarshal(*v, &afdOriginGroupUpdatePropertiesParameters) + if err != nil { + return err + } + ogup.AFDOriginGroupUpdatePropertiesParameters = &afdOriginGroupUpdatePropertiesParameters + } + } + } + + return nil +} + +// AFDOriginGroupUpdatePropertiesParameters the JSON object that contains the properties of the origin group. +type AFDOriginGroupUpdatePropertiesParameters struct { + // ProfileName - READ-ONLY; The name of the profile which holds the origin group. + ProfileName *string `json:"profileName,omitempty"` + // LoadBalancingSettings - Load balancing settings for a backend pool + LoadBalancingSettings *cdn.LoadBalancingSettingsParameters `json:"loadBalancingSettings,omitempty"` + // HealthProbeSettings - Health probe settings to the origin that is used to determine the health of the origin. + HealthProbeSettings *cdn.HealthProbeParameters `json:"healthProbeSettings,omitempty"` + // TrafficRestorationTimeToHealedOrNewEndpointsInMinutes - Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes *int32 `json:"trafficRestorationTimeToHealedOrNewEndpointsInMinutes,omitempty"` + // SessionAffinityState - Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'. Possible values include: 'EnabledStateEnabled', 'EnabledStateDisabled' + SessionAffinityState cdn.EnabledState `json:"sessionAffinityState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AFDOriginGroupUpdatePropertiesParameters. +func (ogupp AFDOriginGroupUpdatePropertiesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ogupp.LoadBalancingSettings != nil { + objectMap["loadBalancingSettings"] = ogupp.LoadBalancingSettings + } + + objectMap["healthProbeSettings"] = ogupp.HealthProbeSettings + + if ogupp.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes != nil { + objectMap["trafficRestorationTimeToHealedOrNewEndpointsInMinutes"] = ogupp.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes + } + if ogupp.SessionAffinityState != "" { + objectMap["sessionAffinityState"] = ogupp.SessionAffinityState + } + return json.Marshal(objectMap) +} diff --git a/internal/services/cdn/cdn_endpoint_custom_domain_resource_test.go b/internal/services/cdn/cdn_endpoint_custom_domain_resource_test.go index 1cb01b6bad8c..e672d4c0b411 100644 --- a/internal/services/cdn/cdn_endpoint_custom_domain_resource_test.go +++ b/internal/services/cdn/cdn_endpoint_custom_domain_resource_test.go @@ -6,7 +6,6 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -97,7 +96,7 @@ func TestAccCdnEndpointCustomDomain_httpsUserManagedCertificate(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.httpsUserManagedCertificate(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -122,7 +121,7 @@ func TestAccCdnEndpointCustomDomain_httpsUserManagedCertificateDeprecated(t *tes data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.httpsUserManagedCertificateDeprecated(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -141,7 +140,7 @@ func TestAccCdnEndpointCustomDomain_httpsUserManagedSecret(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.httpsUserManagedSecret(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, diff --git a/internal/services/cdn/cdn_frontdoor_origin_group_resource.go b/internal/services/cdn/cdn_frontdoor_origin_group_resource.go index 15f2c65077cc..7a082ca2572f 100644 --- a/internal/services/cdn/cdn_frontdoor_origin_group_resource.go +++ b/internal/services/cdn/cdn_frontdoor_origin_group_resource.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/azuresdkhacks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -223,6 +224,7 @@ func resourceCdnFrontDoorOriginGroupRead(d *pluginsdk.ResourceData, meta interfa func resourceCdnFrontDoorOriginGroupUpdate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Cdn.FrontDoorOriginGroupsClient + workaroundClient := azuresdkhacks.NewCdnFrontDoorOriginGroupsWorkaroundClient(client) ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -231,8 +233,10 @@ func resourceCdnFrontDoorOriginGroupUpdate(d *pluginsdk.ResourceData, meta inter return err } - params := &cdn.AFDOriginGroupUpdatePropertiesParameters{} + params := &azuresdkhacks.AFDOriginGroupUpdatePropertiesParameters{} + // The API requires that an explicit null be passed as the 'health_probe' value to disable the health probe + // e.g. {"properties":{"healthProbeSettings":null}} if d.HasChange("health_probe") { params.HealthProbeSettings = expandCdnFrontDoorOriginGroupHealthProbeParameters(d.Get("health_probe").([]interface{})) } @@ -249,11 +253,11 @@ func resourceCdnFrontDoorOriginGroupUpdate(d *pluginsdk.ResourceData, meta inter params.SessionAffinityState = expandEnabledBool(d.Get("session_affinity_enabled").(bool)) } - payload := cdn.AFDOriginGroupUpdateParameters{ + payload := &azuresdkhacks.AFDOriginGroupUpdateParameters{ AFDOriginGroupUpdatePropertiesParameters: params, } - future, err := client.Update(ctx, id.ResourceGroup, id.ProfileName, id.OriginGroupName, payload) + future, err := workaroundClient.Update(ctx, id.ResourceGroup, id.ProfileName, id.OriginGroupName, *payload) if err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } diff --git a/internal/services/cdn/cdn_frontdoor_origin_group_resource_test.go b/internal/services/cdn/cdn_frontdoor_origin_group_resource_test.go index 3952cb60f74a..2ddecc54c386 100644 --- a/internal/services/cdn/cdn_frontdoor_origin_group_resource_test.go +++ b/internal/services/cdn/cdn_frontdoor_origin_group_resource_test.go @@ -78,6 +78,30 @@ func TestAccCdnFrontDoorOriginGroup_update(t *testing.T) { }) } +func TestAccCdnFrontDoorOriginGroup_disableHealthProbe(t *testing.T) { + // NOTE: Regression test case for issue #19585 + data := acceptance.BuildTestData(t, "azurerm_cdn_frontdoor_origin_group", "test") + r := CdnFrontDoorOriginGroupResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("health_probe.0.interval_in_seconds").Exists(), + ), + }, + data.ImportStep(), + { + Config: r.disableHealthProbe(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("health_probe.0.interval_in_seconds").DoesNotExist(), + ), + }, + data.ImportStep(), + }) +} + func (r CdnFrontDoorOriginGroupResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.FrontDoorOriginGroupID(state.ID) if err != nil { @@ -196,6 +220,31 @@ resource "azurerm_cdn_frontdoor_origin_group" "test" { `, template, data.RandomInteger) } +func (r CdnFrontDoorOriginGroupResource) disableHealthProbe(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_cdn_frontdoor_origin_group" "test" { + name = "acctest-origingroup-%d" + cdn_frontdoor_profile_id = azurerm_cdn_frontdoor_profile.test.id + session_affinity_enabled = true + + restore_traffic_time_to_healed_or_new_endpoint_in_minutes = 10 + + load_balancing { + additional_latency_in_milliseconds = 0 + sample_size = 16 + successful_samples_required = 3 + } +} +`, template, data.RandomInteger) +} + func (r CdnFrontDoorOriginGroupResource) template(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { diff --git a/internal/services/cognitive/cognitive_account_resource.go b/internal/services/cognitive/cognitive_account_resource.go index 96c052b75aef..b2f67e9ac095 100644 --- a/internal/services/cognitive/cognitive_account_resource.go +++ b/internal/services/cognitive/cognitive_account_resource.go @@ -108,7 +108,7 @@ func resourceCognitiveAccount() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - "F0", "F1", "S0", "S", "S1", "S2", "S3", "S4", "S5", "S6", "P0", "P1", "P2", "E0", + "F0", "F1", "S0", "S", "S1", "S2", "S3", "S4", "S5", "S6", "P0", "P1", "P2", "E0", "DC0", }, false), }, diff --git a/internal/services/compute/capacity_reservation_group_resource_test.go b/internal/services/compute/capacity_reservation_group_resource_test.go index 9fdcb6a57aef..3a3b961dbc9a 100644 --- a/internal/services/compute/capacity_reservation_group_resource_test.go +++ b/internal/services/compute/capacity_reservation_group_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -19,10 +18,10 @@ type CapacityReservationGroupResource struct{} func TestAccCapacityReservationGroup_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_capacity_reservation_group", "test") r := CapacityReservationGroupResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -33,10 +32,10 @@ func TestAccCapacityReservationGroup_basic(t *testing.T) { func TestAccCapacityReservationGroup_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_capacity_reservation_group", "test") r := CapacityReservationGroupResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -47,10 +46,10 @@ func TestAccCapacityReservationGroup_requiresImport(t *testing.T) { func TestAccCapacityReservationGroup_zones(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_capacity_reservation_group", "test") r := CapacityReservationGroupResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.zones(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -61,17 +60,17 @@ func TestAccCapacityReservationGroup_zones(t *testing.T) { func TestAccCapacityReservationGroup_tags(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_capacity_reservation_group", "test") r := CapacityReservationGroupResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.tags(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.tagsUpdated(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -79,7 +78,7 @@ func TestAccCapacityReservationGroup_tags(t *testing.T) { }) } -func (r CapacityReservationGroupResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r CapacityReservationGroupResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.CapacityReservationGroupID(state.ID) if err != nil { return nil, err diff --git a/internal/services/compute/capacity_reservation_resource_test.go b/internal/services/compute/capacity_reservation_resource_test.go index f19e76373e71..a68c5ed071df 100644 --- a/internal/services/compute/capacity_reservation_resource_test.go +++ b/internal/services/compute/capacity_reservation_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" "github.com/tombuildsstuff/kermit/sdk/compute/2022-08-01/compute" ) @@ -20,10 +19,10 @@ type CapacityReservationResource struct{} func TestAccCapacityReservation_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_capacity_reservation", "test") r := CapacityReservationResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -34,10 +33,10 @@ func TestAccCapacityReservation_basic(t *testing.T) { func TestAccCapacityReservation_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_capacity_reservation", "test") r := CapacityReservationResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -48,10 +47,10 @@ func TestAccCapacityReservation_requiresImport(t *testing.T) { func TestAccCapacityReservation_zone(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_capacity_reservation", "test") r := CapacityReservationResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.zone(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -62,17 +61,17 @@ func TestAccCapacityReservation_zone(t *testing.T) { func TestAccCapacityReservation_skuCapacity(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_capacity_reservation", "test") r := CapacityReservationResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.skuCapacity(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.skuCapacityUpdated(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -83,17 +82,17 @@ func TestAccCapacityReservation_skuCapacity(t *testing.T) { func TestAccCapacityReservation_tags(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_capacity_reservation", "test") r := CapacityReservationResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.tags(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.tagsUpdated(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -101,7 +100,7 @@ func TestAccCapacityReservation_tags(t *testing.T) { }) } -func (r CapacityReservationResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r CapacityReservationResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.CapacityReservationID(state.ID) if err != nil { return nil, err diff --git a/internal/services/compute/disk_encryption_set_resource.go b/internal/services/compute/disk_encryption_set_resource.go index ee142912abdc..78af991a93a6 100644 --- a/internal/services/compute/disk_encryption_set_resource.go +++ b/internal/services/compute/disk_encryption_set_resource.go @@ -123,9 +123,6 @@ func resourceDiskEncryptionSetCreate(d *pluginsdk.ResourceData, meta interface{} if !keyVaultDetails.softDeleteEnabled { return fmt.Errorf("validating Key Vault %q (Resource Group %q) for Disk Encryption Set: Soft Delete must be enabled but it isn't!", keyVaultDetails.keyVaultName, keyVaultDetails.resourceGroupName) } - if !keyVaultDetails.purgeProtectionEnabled { - return fmt.Errorf("validating Key Vault %q (Resource Group %q) for Disk Encryption Set: Purge Protection must be enabled but it isn't!", keyVaultDetails.keyVaultName, keyVaultDetails.resourceGroupName) - } } rotationToLatestKeyVersionEnabled := d.Get("auto_key_rotation_enabled").(bool) diff --git a/internal/services/compute/disk_encryption_set_resource_test.go b/internal/services/compute/disk_encryption_set_resource_test.go index 6ecaf75b4e51..b5f6d4c5cbb2 100644 --- a/internal/services/compute/disk_encryption_set_resource_test.go +++ b/internal/services/compute/disk_encryption_set_resource_test.go @@ -171,6 +171,22 @@ func TestAccDiskEncryptionSet_withFederatedClientId(t *testing.T) { }) } +func TestAccDiskEncryptionSet_disablePurgeProtection(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_disk_encryption_set", "test") + r := DiskEncryptionSetResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.disablePurgeProtection(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("encryption_type").HasValue("EncryptionAtRestWithCustomerKey"), + ), + }, + data.ImportStep(), + }) +} + func (DiskEncryptionSetResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := diskencryptionsets.ParseDiskEncryptionSetID(state.ID) if err != nil { @@ -190,7 +206,7 @@ func (DiskEncryptionSetResource) Exists(ctx context.Context, clients *clients.Cl return utils.Bool(model.Id != nil), nil } -func (DiskEncryptionSetResource) dependencies(data acceptance.TestData) string { +func (DiskEncryptionSetResource) dependencies(data acceptance.TestData, purgeProtectionEnabled bool) string { return fmt.Sprintf(` provider "azurerm" { features { @@ -215,7 +231,7 @@ resource "azurerm_key_vault" "test" { resource_group_name = azurerm_resource_group.test.name tenant_id = data.azurerm_client_config.current.tenant_id sku_name = "standard" - purge_protection_enabled = true + purge_protection_enabled = %t enabled_for_disk_encryption = true } @@ -258,7 +274,7 @@ resource "azurerm_key_vault_key" "test" { depends_on = ["azurerm_key_vault_access_policy.service-principal"] } -`, data.RandomInteger, data.Locations.Primary, data.RandomString) +`, data.RandomInteger, data.Locations.Primary, data.RandomString, purgeProtectionEnabled) } func (r DiskEncryptionSetResource) systemAssignedDependencies(data acceptance.TestData) string { @@ -276,7 +292,7 @@ resource "azurerm_key_vault_access_policy" "disk-encryption" { tenant_id = azurerm_disk_encryption_set.test.identity.0.tenant_id object_id = azurerm_disk_encryption_set.test.identity.0.principal_id -}`, r.dependencies(data)) +}`, r.dependencies(data, true)) } func (r DiskEncryptionSetResource) basic(data acceptance.TestData) string { @@ -428,7 +444,7 @@ resource "azurerm_disk_encryption_set" "test" { depends_on = ["azurerm_key_vault_access_policy.user-assigned"] } - `, r.dependencies(data), data.RandomInteger) + `, r.dependencies(data, true), data.RandomInteger) } func (r DiskEncryptionSetResource) systemAssignedUserAssignedIdentity(data acceptance.TestData) string { @@ -518,5 +534,35 @@ resource "azurerm_disk_encryption_set" "test" { depends_on = ["azurerm_key_vault_access_policy.user-assigned"] } - `, r.dependencies(data), data.RandomInteger, federatedClientId) + `, r.dependencies(data, true), data.RandomInteger, federatedClientId) +} + +func (r DiskEncryptionSetResource) disablePurgeProtection(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_key_vault_access_policy" "disk-encryption" { + key_vault_id = azurerm_key_vault.test.id + + key_permissions = [ + "Get", + "WrapKey", + "UnwrapKey", + ] + + tenant_id = azurerm_disk_encryption_set.test.identity.0.tenant_id + object_id = azurerm_disk_encryption_set.test.identity.0.principal_id +} + +resource "azurerm_disk_encryption_set" "test" { + name = "acctestDES-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + key_vault_key_id = azurerm_key_vault_key.test.id + + identity { + type = "SystemAssigned" + } +} +`, r.dependencies(data, false), data.RandomInteger) } diff --git a/internal/services/compute/gallery_application_resource_test.go b/internal/services/compute/gallery_application_resource_test.go index 9e5e2abed532..1167a75122bf 100644 --- a/internal/services/compute/gallery_application_resource_test.go +++ b/internal/services/compute/gallery_application_resource_test.go @@ -6,7 +6,6 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -20,10 +19,10 @@ type GalleryApplicationResource struct{} func TestAccGalleryApplication_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application", "test") r := GalleryApplicationResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -34,10 +33,10 @@ func TestAccGalleryApplication_basic(t *testing.T) { func TestAccGalleryApplication_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application", "test") r := GalleryApplicationResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -48,10 +47,10 @@ func TestAccGalleryApplication_requiresImport(t *testing.T) { func TestAccGalleryApplication_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application", "test") r := GalleryApplicationResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -62,17 +61,17 @@ func TestAccGalleryApplication_complete(t *testing.T) { func TestAccGalleryApplication_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application", "test") r := GalleryApplicationResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -83,31 +82,31 @@ func TestAccGalleryApplication_update(t *testing.T) { func TestAccGalleryApplication_description(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application", "test") r := GalleryApplicationResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.description(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.descriptionUpdated(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.description(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -122,17 +121,17 @@ func TestAccGalleryApplication_endOfLifeDate(t *testing.T) { endOfLifeDate := time.Now().Add(time.Hour * 10).Format(time.RFC3339) endOfLifeDateUpdated := time.Now().Add(time.Hour * 20).Format(time.RFC3339) - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.endOfLifeDate(data, endOfLifeDate), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.endOfLifeDate(data, endOfLifeDateUpdated), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -143,31 +142,31 @@ func TestAccGalleryApplication_endOfLifeDate(t *testing.T) { func TestAccGalleryApplication_eula(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application", "test") r := GalleryApplicationResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.eula(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.eulaUpdated(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.eula(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -178,17 +177,17 @@ func TestAccGalleryApplication_eula(t *testing.T) { func TestAccGalleryApplication_privacyStatementURI(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application", "test") r := GalleryApplicationResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.privacyStatementURI(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.privacyStatementURIUpdated(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -199,17 +198,17 @@ func TestAccGalleryApplication_privacyStatementURI(t *testing.T) { func TestAccGalleryApplication_releaseNoteURI(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application", "test") r := GalleryApplicationResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.releaseNoteURI(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.releaseNoteURIUpdated(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -220,31 +219,31 @@ func TestAccGalleryApplication_releaseNoteURI(t *testing.T) { func TestAccGalleryApplication_tags(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application", "test") r := GalleryApplicationResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.tags(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.tagsUpdated(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.tags(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, diff --git a/internal/services/compute/gallery_application_version_resource_test.go b/internal/services/compute/gallery_application_version_resource_test.go index 444b3da4bea7..38e1c52ca9c4 100644 --- a/internal/services/compute/gallery_application_version_resource_test.go +++ b/internal/services/compute/gallery_application_version_resource_test.go @@ -6,7 +6,6 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -20,10 +19,10 @@ type GalleryApplicationVersionResource struct{} func TestAccGalleryApplicationVersion_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application_version", "test") r := GalleryApplicationVersionResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("enable_health_check").HasValue("false"), check.That(data.ResourceName).Key("exclude_from_latest").HasValue("false"), @@ -37,10 +36,10 @@ func TestAccGalleryApplicationVersion_basic(t *testing.T) { func TestAccGalleryApplicationVersion_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application_version", "test") r := GalleryApplicationVersionResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -51,10 +50,10 @@ func TestAccGalleryApplicationVersion_requiresImport(t *testing.T) { func TestAccGalleryApplicationVersion_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application_version", "test") r := GalleryApplicationVersionResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -65,17 +64,17 @@ func TestAccGalleryApplicationVersion_complete(t *testing.T) { func TestAccGalleryApplicationVersion_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application_version", "test") r := GalleryApplicationVersionResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -86,31 +85,31 @@ func TestAccGalleryApplicationVersion_update(t *testing.T) { func TestAccGalleryApplicationVersion_enableHealthCheck(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application_version", "test") r := GalleryApplicationVersionResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.enableHealthCheck(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.enableHealthCheckUpdated(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.enableHealthCheck(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -125,17 +124,17 @@ func TestAccGalleryApplicationVersion_endOfLifeDate(t *testing.T) { endOfLifeDate := time.Now().Add(time.Hour * 10).Format(time.RFC3339) endOfLifeDateUpdated := time.Now().Add(time.Hour * 20).Format(time.RFC3339) - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.endOfLifeDate(data, endOfLifeDate), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.endOfLifeDate(data, endOfLifeDateUpdated), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -146,31 +145,31 @@ func TestAccGalleryApplicationVersion_endOfLifeDate(t *testing.T) { func TestAccGalleryApplicationVersion_excludeFromLatest(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application_version", "test") r := GalleryApplicationVersionResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.excludeFromLatest(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.excludeFromLatestUpdated(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.excludeFromLatest(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -181,31 +180,31 @@ func TestAccGalleryApplicationVersion_excludeFromLatest(t *testing.T) { func TestAccGalleryApplicationVersion_targetRegion(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application_version", "test") r := GalleryApplicationVersionResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.targetRegion(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.targetRegionUpdated(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.targetRegion(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -216,31 +215,31 @@ func TestAccGalleryApplicationVersion_targetRegion(t *testing.T) { func TestAccGalleryApplicationVersion_tags(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_gallery_application_version", "test") r := GalleryApplicationVersionResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.tags(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.tagsUpdated(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.tags(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, diff --git a/internal/services/compute/linux_virtual_machine_resource.go b/internal/services/compute/linux_virtual_machine_resource.go index 227a7fb22f0a..c83f97862796 100644 --- a/internal/services/compute/linux_virtual_machine_resource.go +++ b/internal/services/compute/linux_virtual_machine_resource.go @@ -68,7 +68,7 @@ func resourceLinuxVirtualMachine() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, + ValidateFunc: computeValidate.LinuxAdminUsername, }, "network_interface_ids": { diff --git a/internal/services/compute/managed_disk_resource.go b/internal/services/compute/managed_disk_resource.go index 9fddf6e1839c..51c1a2221c7f 100644 --- a/internal/services/compute/managed_disk_resource.go +++ b/internal/services/compute/managed_disk_resource.go @@ -87,6 +87,7 @@ func resourceManagedDisk() *pluginsdk.Resource { string(disks.DiskCreateOptionEmpty), string(disks.DiskCreateOptionFromImage), string(disks.DiskCreateOptionImport), + string(disks.DiskCreateOptionImportSecure), string(disks.DiskCreateOptionRestore), string(disks.DiskCreateOptionUpload), }, false), @@ -387,15 +388,15 @@ func resourceManagedDiskCreate(d *pluginsdk.ResourceData, meta interface{}) erro return fmt.Errorf("[ERROR] disk_iops_read_write, disk_mbps_read_write, disk_iops_read_only, disk_mbps_read_only and logical_sector_size are only available for UltraSSD disks and PremiumV2 disks") } - if createOption == disks.DiskCreateOptionImport { + if createOption == disks.DiskCreateOptionImport || createOption == disks.DiskCreateOptionImportSecure { sourceUri := d.Get("source_uri").(string) if sourceUri == "" { - return fmt.Errorf("`source_uri` must be specified when `create_option` is set to `Import`") + return fmt.Errorf("`source_uri` must be specified when `create_option` is set to `Import` or `ImportSecure`") } storageAccountId := d.Get("storage_account_id").(string) if storageAccountId == "" { - return fmt.Errorf("`storage_account_id` must be specified when `create_option` is set to `Import`") + return fmt.Errorf("`storage_account_id` must be specified when `create_option` is set to `Import` or `ImportSecure`") } props.CreationData.StorageAccountId = utils.String(storageAccountId) @@ -490,8 +491,9 @@ func resourceManagedDiskCreate(d *pluginsdk.ResourceData, meta interface{}) erro switch createOption { case disks.DiskCreateOptionFromImage: case disks.DiskCreateOptionImport: + case disks.DiskCreateOptionImportSecure: default: - return fmt.Errorf("trusted_launch_enabled cannot be set to true with create_option %q. Supported Create Options when Trusted Launch is enabled are FromImage, Import", createOption) + return fmt.Errorf("trusted_launch_enabled cannot be set to true with create_option %q. Supported Create Options when Trusted Launch is enabled are `FromImage`, `Import`, `ImportSecure`", createOption) } } @@ -505,8 +507,9 @@ func resourceManagedDiskCreate(d *pluginsdk.ResourceData, meta interface{}) erro switch createOption { case disks.DiskCreateOptionFromImage: case disks.DiskCreateOptionImport: + case disks.DiskCreateOptionImportSecure: default: - return fmt.Errorf("`security_type` can only be specified when `create_option` is set to `FromImage` or `Import`") + return fmt.Errorf("`security_type` can only be specified when `create_option` is set to `FromImage`, `Import` or `ImportSecure`") } if disks.DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey == disks.DiskSecurityTypes(securityType) && secureVMDiskEncryptionId == "" { diff --git a/internal/services/compute/managed_disk_resource_test.go b/internal/services/compute/managed_disk_resource_test.go index 2576147a5af6..c17bf298cfb9 100644 --- a/internal/services/compute/managed_disk_resource_test.go +++ b/internal/services/compute/managed_disk_resource_test.go @@ -8,8 +8,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-02/disks" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -514,14 +512,14 @@ func TestAccManagedDisk_update_withMaxShares(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.create_withMaxShares(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.update_withMaxShares(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -535,7 +533,7 @@ func TestAccManagedDisk_create_withLogicalSectorSize(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.create_withLogicalSectorSize(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -550,7 +548,7 @@ func TestAccManagedDisk_create_withTrustedLaunchEnabled(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.create_withTrustedLaunchEnabled(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -565,7 +563,7 @@ func TestAccManagedDisk_create_withSecurityType(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.create_withSecurityType(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -580,7 +578,7 @@ func TestAccManagedDisk_create_withSecureVMDiskEncryptionSetId(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.create_withSecureVMDiskEncryptionSetId(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -595,14 +593,14 @@ func TestAccManagedDisk_update_withIOpsReadOnlyAndMBpsReadOnly(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.create_withIOpsReadOnlyAndMBpsReadOnly(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.update_withIOpsReadOnlyAndMBpsReadOnly(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -616,7 +614,7 @@ func TestAccManagedDisk_create_withOnDemandBurstingEnabled(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.create_withOnDemandBurstingEnabled(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -631,14 +629,14 @@ func TestAccManagedDisk_update_withOnDemandBurstingEnabled(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.empty(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.update_withOnDemandBurstingEnabled(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -653,7 +651,7 @@ func TestAccManagedDisk_create_withHyperVGeneration(t *testing.T) { data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.create_withHyperVGeneration(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -2481,7 +2479,7 @@ resource "azurerm_virtual_machine_data_disk_attachment" "test" { `, data.RandomInteger, data.Locations.Primary, diskSizeGB) } -func (ManagedDiskResource) checkLinuxVirtualMachineWasNotRestarted(ctx context.Context, client *clients.Client, state *terraform.InstanceState) error { +func (ManagedDiskResource) checkLinuxVirtualMachineWasNotRestarted(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) error { activityLogsClient := client.Monitor.ActivityLogsClient filter := fmt.Sprintf("eventTimestamp ge '%s' and resourceUri eq '%s'", time.Now().Add(-1*time.Hour).Format(time.RFC3339), state.ID) logs, err := activityLogsClient.ListComplete(ctx, filter, "") diff --git a/internal/services/compute/marketplace_agreement_data_source_test.go b/internal/services/compute/marketplace_agreement_data_source_test.go index 5604954876ff..2357a475967f 100644 --- a/internal/services/compute/marketplace_agreement_data_source_test.go +++ b/internal/services/compute/marketplace_agreement_data_source_test.go @@ -13,10 +13,17 @@ type MarketplaceAgreementDataSource struct{} func TestAccDataSourceMarketplaceAgreement_basic(t *testing.T) { data := acceptance.BuildTestData(t, "data.azurerm_marketplace_agreement", "test") r := MarketplaceAgreementDataSource{} + offer := "barracuda-email-security-gateway" data.DataSourceTest(t, []acceptance.TestStep{ { - Config: r.basic(), + Config: MarketplaceAgreementResource{}.empty(), + Check: acceptance.ComposeTestCheckFunc( + data.CheckWithClientWithoutResource(MarketplaceAgreementResource{}.cancelExistingAgreement(offer)), + ), + }, + { + Config: r.basic(offer), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).Key("license_text_link").Exists(), check.That(data.ResourceName).Key("privacy_policy_link").Exists(), @@ -25,14 +32,14 @@ func TestAccDataSourceMarketplaceAgreement_basic(t *testing.T) { }) } -func (MarketplaceAgreementDataSource) basic() string { +func (MarketplaceAgreementDataSource) basic(offer string) string { return fmt.Sprintf(` %s data "azurerm_marketplace_agreement" "test" { publisher = "barracudanetworks" - offer = "waf" + offer = "%s" plan = "hourly" } -`, MarketplaceAgreementResource{}.basic("waf")) +`, MarketplaceAgreementResource{}.basic(offer), offer) } diff --git a/internal/services/compute/network_interface.go b/internal/services/compute/network_interface.go index b062c99257cb..15f9b43c8666 100644 --- a/internal/services/compute/network_interface.go +++ b/internal/services/compute/network_interface.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/tombuildsstuff/kermit/sdk/compute/2022-08-01/compute" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) // nolint: deadcode unused diff --git a/internal/services/compute/shared_image_resource.go b/internal/services/compute/shared_image_resource.go index d297aae1a0f3..fa3d4032e548 100644 --- a/internal/services/compute/shared_image_resource.go +++ b/internal/services/compute/shared_image_resource.go @@ -221,9 +221,24 @@ func resourceSharedImage() *pluginsdk.Resource { }, "trusted_launch_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - ForceNew: true, + Type: pluginsdk.TypeBool, + Optional: true, + ForceNew: true, + ConflictsWith: []string{"confidential_vm_supported", "confidential_vm_enabled"}, + }, + + "confidential_vm_supported": { + Type: pluginsdk.TypeBool, + Optional: true, + ForceNew: true, + ConflictsWith: []string{"trusted_launch_enabled", "confidential_vm_enabled"}, + }, + + "confidential_vm_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + ForceNew: true, + ConflictsWith: []string{"trusted_launch_enabled", "confidential_vm_supported"}, }, "accelerated_network_support_enabled": { @@ -265,20 +280,6 @@ func resourceSharedImageCreateUpdate(d *pluginsdk.ResourceData, meta interface{} } } - var features []compute.GalleryImageFeature - if d.Get("trusted_launch_enabled").(bool) { - features = append(features, compute.GalleryImageFeature{ - Name: utils.String("SecurityType"), - Value: utils.String("TrustedLaunch"), - }) - } - if d.Get("accelerated_network_support_enabled").(bool) { - features = append(features, compute.GalleryImageFeature{ - Name: utils.String("IsAcceleratedNetworkSupported"), - Value: utils.String("true"), - }) - } - recommended, err := expandGalleryImageRecommended(d) if err != nil { return err @@ -296,7 +297,7 @@ func resourceSharedImageCreateUpdate(d *pluginsdk.ResourceData, meta interface{} OsType: compute.OperatingSystemTypes(d.Get("os_type").(string)), HyperVGeneration: compute.HyperVGeneration(d.Get("hyper_v_generation").(string)), PurchasePlan: expandGalleryImagePurchasePlan(d.Get("purchase_plan").([]interface{})), - Features: &features, + Features: expandSharedImageFeatures(d), Recommended: recommended, }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), @@ -427,6 +428,8 @@ func resourceSharedImageRead(d *pluginsdk.ResourceData, meta interface{}) error } trustedLaunchEnabled := false + cvmEnabled := false + cvmSupported := false acceleratedNetworkSupportEnabled := false if features := props.Features; features != nil { for _, feature := range *features { @@ -436,6 +439,8 @@ func resourceSharedImageRead(d *pluginsdk.ResourceData, meta interface{}) error if strings.EqualFold(*feature.Name, "SecurityType") { trustedLaunchEnabled = strings.EqualFold(*feature.Value, "TrustedLaunch") + cvmSupported = strings.EqualFold(*feature.Value, "ConfidentialVmSupported") + cvmEnabled = strings.EqualFold(*feature.Value, "ConfidentialVm") } if strings.EqualFold(*feature.Name, "IsAcceleratedNetworkSupported") { @@ -443,6 +448,8 @@ func resourceSharedImageRead(d *pluginsdk.ResourceData, meta interface{}) error } } } + d.Set("confidential_vm_supported", cvmSupported) + d.Set("confidential_vm_enabled", cvmEnabled) d.Set("trusted_launch_enabled", trustedLaunchEnabled) d.Set("accelerated_network_support_enabled", acceleratedNetworkSupportEnabled) } @@ -644,3 +651,36 @@ func expandGalleryImageRecommended(d *pluginsdk.ResourceData) (*compute.Recommen return result, nil } + +func expandSharedImageFeatures(d *pluginsdk.ResourceData) *[]compute.GalleryImageFeature { + var features []compute.GalleryImageFeature + if d.Get("accelerated_network_support_enabled").(bool) { + features = append(features, compute.GalleryImageFeature{ + Name: utils.String("IsAcceleratedNetworkSupported"), + Value: utils.String("true"), + }) + } + + if tvmEnabled := d.Get("trusted_launch_enabled").(bool); tvmEnabled { + features = append(features, compute.GalleryImageFeature{ + Name: utils.String("SecurityType"), + Value: utils.String("TrustedLaunch"), + }) + } + + if cvmSupported := d.Get("confidential_vm_supported").(bool); cvmSupported { + features = append(features, compute.GalleryImageFeature{ + Name: utils.String("SecurityType"), + Value: utils.String("ConfidentialVmSupported"), + }) + } + + if cvmEnabled := d.Get("confidential_vm_enabled").(bool); cvmEnabled { + features = append(features, compute.GalleryImageFeature{ + Name: utils.String("SecurityType"), + Value: utils.String("ConfidentialVM"), + }) + } + + return &features +} diff --git a/internal/services/compute/shared_image_resource_test.go b/internal/services/compute/shared_image_resource_test.go index 28c4cc910c11..b03babccddef 100644 --- a/internal/services/compute/shared_image_resource_test.go +++ b/internal/services/compute/shared_image_resource_test.go @@ -127,6 +127,34 @@ func TestAccSharedImage_withTrustedLaunchEnabled(t *testing.T) { }) } +func TestAccSharedImage_withConfidentialVM(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_shared_image", "test") + r := SharedImageResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withConfidentialVM(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSharedImage_withConfidentialVMSupported(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_shared_image", "test") + r := SharedImageResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withConfidentialVmSupported(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func TestAccSharedImage_withAcceleratedNetworkSupportEnabled(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_shared_image", "test") r := SharedImageResource{} @@ -501,6 +529,76 @@ resource "azurerm_shared_image" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, hyperVGen, data.RandomInteger, data.RandomInteger, data.RandomInteger) } +func (SharedImageResource) withConfidentialVmSupported(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +resource "azurerm_shared_image_gallery" "test" { + name = "acctestsig%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} + +resource "azurerm_shared_image" "test" { + name = "acctestimg%[1]d" + gallery_name = azurerm_shared_image_gallery.test.name + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + os_type = "Linux" + hyper_v_generation = "V2" + confidential_vm_supported = true + + identifier { + publisher = "AccTesPublisher%[1]d" + offer = "AccTesOffer%[1]d" + sku = "AccTesSku%[1]d" + } +} +`, data.RandomInteger, data.Locations.Primary) +} + +func (SharedImageResource) withConfidentialVM(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +resource "azurerm_shared_image_gallery" "test" { + name = "acctestsig%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} + +resource "azurerm_shared_image" "test" { + name = "acctestimg%[1]d" + gallery_name = azurerm_shared_image_gallery.test.name + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + os_type = "Linux" + hyper_v_generation = "V2" + confidential_vm_enabled = true + + identifier { + publisher = "AccTesPublisher%[1]d" + offer = "AccTesOffer%[1]d" + sku = "AccTesSku%[1]d" + } +} +`, data.RandomInteger, data.Locations.Primary) +} + func (SharedImageResource) withTrustedLaunchEnabled(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/compute/validate/linux_admin_username.go b/internal/services/compute/validate/linux_admin_username.go new file mode 100644 index 000000000000..8ea7e8b7b071 --- /dev/null +++ b/internal/services/compute/validate/linux_admin_username.go @@ -0,0 +1,36 @@ +package validate + +import ( + "fmt" + "strings" +) + +// LinuxAdminUsername validates that admin_username meets the Azure API requirements for Linux Virtual Machines. +func LinuxAdminUsername(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string but it wasn't", k)) + return + } + + // adminUsername must not be empty. + if strings.TrimSpace(v) == "" { + errors = append(errors, fmt.Errorf("%q must not be empty", k)) + return + } + + // adminUsername Max-length 64 characters. + if len(v) > 64 { + errors = append(errors, fmt.Errorf("%q most be between 1 and %d characters, got %d", k, 64, len(v))) + } + + // adminUsername cannot match the following disallowed names. + disallowedNames := []string{"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"} + for _, value := range disallowedNames { + if value == v { + errors = append(errors, fmt.Errorf("%q specified is not allowed, got %q, cannot match: %q", k, v, strings.Join(disallowedNames, ", "))) + } + } + + return +} diff --git a/internal/services/compute/validate/linux_admin_username_test.go b/internal/services/compute/validate/linux_admin_username_test.go new file mode 100644 index 000000000000..58324a126baf --- /dev/null +++ b/internal/services/compute/validate/linux_admin_username_test.go @@ -0,0 +1,51 @@ +package validate + +import "testing" + +func TestLinuxAdminUsername(t *testing.T) { + testData := []struct { + input string + expected bool + }{ + { + // empty + input: "", + expected: false, + }, + { + // basic example + input: "juanjo", + expected: true, + }, + { + // basic example with caps + input: "JuanJo", + expected: true, + }, + { + // can't use reserved words + input: "administrator", + expected: false, + }, + { + // can't be longer than 64 characters + input: "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkjl", + expected: false, + }, + { + // 64 characters its fine + input: "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkj", + expected: true, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q..", v.input) + + _, errors := LinuxAdminUsername(v.input, "admin_username") + actual := len(errors) == 0 + if v.expected != actual { + t.Fatalf("Expected %t but got %t", v.expected, actual) + } + } +} diff --git a/internal/services/compute/validate/windows_admin_username.go b/internal/services/compute/validate/windows_admin_username.go new file mode 100644 index 000000000000..b432f5f501a4 --- /dev/null +++ b/internal/services/compute/validate/windows_admin_username.go @@ -0,0 +1,42 @@ +package validate + +import ( + "fmt" + "regexp" + "strings" +) + +// WindowsAdminUsername validates that admin_username meets the Azure API requirements for Windows Virtual Machines. +func WindowsAdminUsername(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string but it wasn't", k)) + return + } + + // adminUsername must not be empty. + if strings.TrimSpace(v) == "" { + errors = append(errors, fmt.Errorf("%q must not be empty", k)) + return + } + + // adminUsername Max-length 20 characters. + if len(v) > 20 { + errors = append(errors, fmt.Errorf("%q most be between 1 and %d characters, got %d", k, 20, len(v))) + } + + // adminUsername cannot end with a dot + if match := regexp.MustCompile(`.*\.$`).Match([]byte(v)); match { + errors = append(errors, fmt.Errorf("%q cannot end with a dot", k)) + } + + // adminUsername cannot match the following disallowed names. + disallowedNames := []string{"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"} + for _, value := range disallowedNames { + if value == v { + errors = append(errors, fmt.Errorf("%q specified is not allowed, got %q, cannot match: %q", k, v, strings.Join(disallowedNames, ", "))) + } + } + + return +} diff --git a/internal/services/compute/validate/windows_admin_username_test.go b/internal/services/compute/validate/windows_admin_username_test.go new file mode 100644 index 000000000000..c28bcfda4ee2 --- /dev/null +++ b/internal/services/compute/validate/windows_admin_username_test.go @@ -0,0 +1,56 @@ +package validate + +import "testing" + +func TestWindowsAdminUsername(t *testing.T) { + testData := []struct { + input string + expected bool + }{ + { + // empty + input: "", + expected: false, + }, + { + // basic example + input: "juanjo", + expected: true, + }, + { + // basic example with caps + input: "JuanJo", + expected: true, + }, + { + // can't use reserved words + input: "administrator", + expected: false, + }, + { + // can't be longer than 20 characters + input: "abcdefghijklmnopqrstuvwxyz", + expected: false, + }, + { + // 20 characters its fine + input: "abcdefghijklmnopqrst", + expected: true, + }, + { + // cannot end in a dot + input: "juanjo.", + expected: false, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q..", v.input) + + _, errors := WindowsAdminUsername(v.input, "admin_username") + actual := len(errors) == 0 + if v.expected != actual { + t.Fatalf("Expected %t but got %t", v.expected, actual) + } + } +} diff --git a/internal/services/compute/virtual_machine_scale_set_data_source.go b/internal/services/compute/virtual_machine_scale_set_data_source.go index a11a47ea95c8..b155e2e1e743 100644 --- a/internal/services/compute/virtual_machine_scale_set_data_source.go +++ b/internal/services/compute/virtual_machine_scale_set_data_source.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" "github.com/tombuildsstuff/kermit/sdk/compute/2022-08-01/compute" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourceVirtualMachineScaleSet() *pluginsdk.Resource { diff --git a/internal/services/compute/windows_virtual_machine_resource.go b/internal/services/compute/windows_virtual_machine_resource.go index c76b49bae7dc..007b8b8cc91d 100644 --- a/internal/services/compute/windows_virtual_machine_resource.go +++ b/internal/services/compute/windows_virtual_machine_resource.go @@ -77,7 +77,7 @@ func resourceWindowsVirtualMachine() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, + ValidateFunc: computeValidate.WindowsAdminUsername, }, "network_interface_ids": { diff --git a/internal/services/connections/api_connection_resource.go b/internal/services/connections/api_connection_resource.go index 8913198f27de..8a37bb6b436b 100644 --- a/internal/services/connections/api_connection_resource.go +++ b/internal/services/connections/api_connection_resource.go @@ -110,7 +110,7 @@ func resourceConnectionCreate(d *schema.ResourceData, meta interface{}) error { if err != nil { return fmt.Errorf("parsing `managed_app_id`: %+v", err) } - location := location.Normalize(managedAppId.Location) + location := location.Normalize(managedAppId.LocationName) parameterValues := expandConnectionParameterValues(d.Get("parameter_values").(map[string]interface{})) model := connections.ApiConnectionDefinition{ Location: utils.String(location), diff --git a/internal/services/consumption/consumption_budget_resource_group_data_source.go b/internal/services/consumption/consumption_budget_resource_group_data_source.go index b01c5f7f3b11..04d24098d0b0 100644 --- a/internal/services/consumption/consumption_budget_resource_group_data_source.go +++ b/internal/services/consumption/consumption_budget_resource_group_data_source.go @@ -220,21 +220,19 @@ func resourceArmConsumptionBudgetResourceGroupDataSource() *pluginsdk.Resource { func resourceArmConsumptionBudgetResourceGroupDataSourceRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Consumption.BudgetsClient - ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() id := budgets.NewScopedBudgetID(d.Get("resource_group_id").(string), d.Get("name").(string)) - d.SetId(id.ID()) - resp, err := client.Get(ctx, id) if err != nil { if response.WasNotFound(resp.HttpResponse) { - d.SetId("") - return nil + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("making read request on %s: %+v", id, err) } + d.SetId(id.ID()) d.Set("name", id.BudgetName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/containerapps/client/client.go b/internal/services/containerapps/client/client.go new file mode 100644 index 000000000000..5e7c846eef51 --- /dev/null +++ b/internal/services/containerapps/client/client.go @@ -0,0 +1,49 @@ +package client + +import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +type Client struct { + CertificatesClient *certificates.CertificatesClient + ContainerAppClient *containerapps.ContainerAppsClient + ContainerAppRevisionClient *containerappsrevisions.ContainerAppsRevisionsClient + DaprComponentsClient *daprcomponents.DaprComponentsClient + ManagedEnvironmentClient *managedenvironments.ManagedEnvironmentsClient + StorageClient *managedenvironmentsstorages.ManagedEnvironmentsStoragesClient +} + +func NewClient(o *common.ClientOptions) *Client { + certificatesClient := certificates.NewCertificatesClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&certificatesClient.Client, o.ResourceManagerAuthorizer) + + containerAppsClient := containerapps.NewContainerAppsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&containerAppsClient.Client, o.ResourceManagerAuthorizer) + + containerAppsRevisionsClient := containerappsrevisions.NewContainerAppsRevisionsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&containerAppsRevisionsClient.Client, o.ResourceManagerAuthorizer) + + managedEnvironmentClient := managedenvironments.NewManagedEnvironmentsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&managedEnvironmentClient.Client, o.ResourceManagerAuthorizer) + + managedEnvironmentStoragesClient := managedenvironmentsstorages.NewManagedEnvironmentsStoragesClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&managedEnvironmentStoragesClient.Client, o.ResourceManagerAuthorizer) + + daprComponentClient := daprcomponents.NewDaprComponentsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&daprComponentClient.Client, o.ResourceManagerAuthorizer) + + return &Client{ + CertificatesClient: &certificatesClient, + ContainerAppClient: &containerAppsClient, + ContainerAppRevisionClient: &containerAppsRevisionsClient, + DaprComponentsClient: &daprComponentClient, + ManagedEnvironmentClient: &managedEnvironmentClient, + StorageClient: &managedEnvironmentStoragesClient, + } +} diff --git a/internal/services/containerapps/container_app_environment_certificate_data_source.go b/internal/services/containerapps/container_app_environment_certificate_data_source.go new file mode 100644 index 000000000000..f9ed9588bfb8 --- /dev/null +++ b/internal/services/containerapps/container_app_environment_certificate_data_source.go @@ -0,0 +1,145 @@ +package containerapps + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/containerapps/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type ContainerAppEnvironmentCertificateDataSource struct{} + +type ContainerAppEnvironmentCertificateDataSourceModel struct { + Name string `tfschema:"name"` + ManagedEnvironmentId string `tfschema:"container_app_environment_id"` + + // Read Only + SubjectName string `tfschema:"subject_name"` + Issuer string `tfschema:"issuer"` + IssueDate string `tfschema:"issue_date"` + ExpirationDate string `tfschema:"expiration_date"` + Thumbprint string `tfschema:"thumbprint"` + Tags map[string]interface{} `tfschema:"tags"` +} + +var _ sdk.DataSource = ContainerAppEnvironmentCertificateDataSource{} + +func (r ContainerAppEnvironmentCertificateDataSource) ModelObject() interface{} { + return &ContainerAppEnvironmentCertificateDataSourceModel{} +} + +func (r ContainerAppEnvironmentCertificateDataSource) ResourceType() string { + return "azurerm_container_app_environment_certificate" +} + +func (r ContainerAppEnvironmentCertificateDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.CertificateName, + Description: "The name of the Container Apps Certificate.", + }, + + "container_app_environment_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: certificates.ValidateManagedEnvironmentID, + Description: "The Container App Managed Environment ID to configure this Certificate on.", + }, + } +} + +func (r ContainerAppEnvironmentCertificateDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "subject_name": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The Subject Name for the Certificate.", + }, + + "issuer": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The Certificate Issuer.", + }, + + "issue_date": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The date of issue for the Certificate.", + }, + + "expiration_date": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The expiration date for the Certificate.", + }, + + "thumbprint": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The Thumbprint of the Certificate.", + }, + + "tags": commonschema.TagsDataSource(), + } +} + +func (r ContainerAppEnvironmentCertificateDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.CertificatesClient + + var cert ContainerAppEnvironmentCertificateDataSourceModel + if err := metadata.Decode(&cert); err != nil { + return err + } + + envId, err := certificates.ParseManagedEnvironmentID(cert.ManagedEnvironmentId) + if err != nil { + return err + } + + id := certificates.NewCertificateID(envId.SubscriptionId, envId.ResourceGroupName, envId.ManagedEnvironmentName, cert.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + cert.Name = id.CertificateName + cert.ManagedEnvironmentId = envId.ID() + + if model := existing.Model; model != nil { + cert.Tags = tags.Flatten(model.Tags) + + if props := model.Properties; props != nil { + cert.Issuer = pointer.From(props.Issuer) + cert.IssueDate = pointer.From(props.IssueDate) + cert.ExpirationDate = pointer.From(props.ExpirationDate) + cert.Thumbprint = pointer.From(props.Thumbprint) + cert.SubjectName = pointer.From(props.SubjectName) + } + } + + metadata.SetID(id) + + return metadata.Encode(&cert) + }, + } +} diff --git a/internal/services/containerapps/container_app_environment_certificate_data_source_test.go b/internal/services/containerapps/container_app_environment_certificate_data_source_test.go new file mode 100644 index 000000000000..60a130d487a9 --- /dev/null +++ b/internal/services/containerapps/container_app_environment_certificate_data_source_test.go @@ -0,0 +1,42 @@ +package containerapps_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type ContainerAppEnvironmentCertificateDataSource struct{} + +func TestAccContainerAppEnvironmentCertificateDataSource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_container_app_environment_certificate", "test") + r := ContainerAppEnvironmentCertificateDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("subject_name").IsSet(), + check.That(data.ResourceName).Key("thumbprint").IsSet(), + check.That(data.ResourceName).Key("issue_date").IsSet(), + check.That(data.ResourceName).Key("expiration_date").IsSet(), + check.That(data.ResourceName).Key("issuer").IsSet(), + ), + }, + }) +} + +func (d ContainerAppEnvironmentCertificateDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +data "azurerm_container_app_environment_certificate" "test" { + name = azurerm_container_app_environment_certificate.test.name + container_app_environment_id = azurerm_container_app_environment_certificate.test.container_app_environment_id +} + + +`, ContainerAppEnvironmentCertificateResource{}.basic(data)) +} diff --git a/internal/services/containerapps/container_app_environment_certificate_resource.go b/internal/services/containerapps/container_app_environment_certificate_resource.go new file mode 100644 index 000000000000..e144323c94c5 --- /dev/null +++ b/internal/services/containerapps/container_app_environment_certificate_resource.go @@ -0,0 +1,269 @@ +package containerapps + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/containerapps/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type ContainerAppEnvironmentCertificateResource struct{} + +type ContainerAppCertificateModel struct { + Name string `tfschema:"name"` + ManagedEnvironmentId string `tfschema:"container_app_environment_id"` + Tags map[string]interface{} `tfschema:"tags"` + + // Write only? + CertificatePassword string `tfschema:"certificate_password"` + CertificateBlob string `tfschema:"certificate_blob_base64"` + + // Read Only + SubjectName string `tfschema:"subject_name"` + Issuer string `tfschema:"issuer"` + IssueDate string `tfschema:"issue_date"` + ExpirationDate string `tfschema:"expiration_date"` + Thumbprint string `tfschema:"thumbprint"` +} + +var _ sdk.ResourceWithUpdate = ContainerAppEnvironmentCertificateResource{} + +func (r ContainerAppEnvironmentCertificateResource) ModelObject() interface{} { + return &ContainerAppCertificateModel{} +} + +func (r ContainerAppEnvironmentCertificateResource) ResourceType() string { + return "azurerm_container_app_environment_certificate" +} + +func (r ContainerAppEnvironmentCertificateResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return certificates.ValidateCertificateID +} + +func (r ContainerAppEnvironmentCertificateResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.CertificateName, + Description: "The name of the Container Apps Environment Certificate.", + }, + + "container_app_environment_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: certificates.ValidateManagedEnvironmentID, + Description: "The Container App Managed Environment ID to configure this Certificate on.", + }, + + "certificate_blob_base64": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsBase64, + Description: "The Certificate Private Key as a base64 encoded PFX or PEM.", + }, + + "certificate_password": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + Sensitive: true, + Description: "The password for the Certificate.", + }, + + "tags": commonschema.Tags(), + } +} + +func (r ContainerAppEnvironmentCertificateResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "subject_name": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The Subject Name for the Certificate.", + }, + + "issuer": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The Certificate Issuer.", + }, + + "issue_date": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The date of issue for the Certificate.", + }, + + "expiration_date": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The expiration date for the Certificate.", + }, + + "thumbprint": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The Thumbprint of the Certificate.", + }, + } +} + +func (r ContainerAppEnvironmentCertificateResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.CertificatesClient + environmentsClient := metadata.Client.ContainerApps.ManagedEnvironmentClient + + var cert ContainerAppCertificateModel + + if err := metadata.Decode(&cert); err != nil { + return err + } + + envId, err := managedenvironments.ParseManagedEnvironmentID(cert.ManagedEnvironmentId) + if err != nil { + return err + } + + id := certificates.NewCertificateID(metadata.Client.Account.SubscriptionId, envId.ResourceGroupName, envId.ManagedEnvironmentName, cert.Name) + env, err := environmentsClient.Get(ctx, *envId) + if err != nil { + return fmt.Errorf("reading %s for %s: %+v", *envId, id, err) + } + + model := certificates.Certificate{ + Location: env.Model.Location, + Name: pointer.To(id.CertificateName), + Properties: &certificates.CertificateProperties{ + Password: pointer.To(cert.CertificatePassword), + Value: pointer.To(cert.CertificateBlob), + }, + Tags: tags.Expand(cert.Tags), + } + + if _, err := client.CreateOrUpdate(ctx, id, model); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + + return nil + }, + } +} + +func (r ContainerAppEnvironmentCertificateResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.CertificatesClient + + id, err := certificates.ParseCertificateID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + existing, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(existing.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("reading %s: %+v", *id, err) + } + + var state ContainerAppCertificateModel + + state.Name = id.CertificateName + state.ManagedEnvironmentId = certificates.NewManagedEnvironmentID(id.SubscriptionId, id.ResourceGroupName, id.ManagedEnvironmentName).ID() + + if model := existing.Model; model != nil { + state.Tags = tags.Flatten(model.Tags) + + // The Certificate Blob and Password are not retrievable in any way, so grab them back from config if we can. Imports will need `ignore_changes`. + if certBlob, ok := metadata.ResourceData.GetOk("certificate_blob_base64"); ok { + state.CertificateBlob = certBlob.(string) + } + + if certPassword, ok := metadata.ResourceData.GetOk("certificate_password"); ok { + state.CertificatePassword = certPassword.(string) + } + + if props := model.Properties; props != nil { + state.Issuer = pointer.From(props.Issuer) + state.IssueDate = pointer.From(props.IssueDate) + state.ExpirationDate = pointer.From(props.ExpirationDate) + state.Thumbprint = pointer.From(props.Thumbprint) + } + } + + return metadata.Encode(&state) + }, + } +} + +func (r ContainerAppEnvironmentCertificateResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.CertificatesClient + + id, err := certificates.ParseCertificateID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r ContainerAppEnvironmentCertificateResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.CertificatesClient + + var cert ContainerAppCertificateModel + + if err := metadata.Decode(&cert); err != nil { + return err + } + + id, err := certificates.ParseCertificateID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if metadata.ResourceData.HasChange("tags") { + patch := certificates.CertificatePatch{ + Tags: tags.Expand(cert.Tags), + } + + if _, err = client.Update(ctx, *id, patch); err != nil { + return fmt.Errorf("updating tags for %s: %+v", *id, err) + } + } + + return nil + }, + } +} diff --git a/internal/services/containerapps/container_app_environment_certificate_resource_test.go b/internal/services/containerapps/container_app_environment_certificate_resource_test.go new file mode 100644 index 000000000000..6aec4e492435 --- /dev/null +++ b/internal/services/containerapps/container_app_environment_certificate_resource_test.go @@ -0,0 +1,131 @@ +package containerapps_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type ContainerAppEnvironmentCertificateResource struct{} + +func TestAccContainerAppEnvironmentCertificate_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app_environment_certificate", "test") + r := ContainerAppEnvironmentCertificateResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("certificate_blob_base64", "certificate_password"), + }) +} +func TestAccContainerAppEnvironmentCertificate_basicUpdateTags(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app_environment_certificate", "test") + r := ContainerAppEnvironmentCertificateResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("certificate_blob_base64", "certificate_password"), + { + Config: r.basicAddTags(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("certificate_blob_base64", "certificate_password"), + }) +} + +func (r ContainerAppEnvironmentCertificateResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := certificates.ParseCertificateID(state.ID) + if err != nil { + return nil, err + } + resp, err := client.ContainerApps.CertificatesClient.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return pointer.To(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) + } + + return pointer.To(resp.Model != nil), nil +} + +func (r ContainerAppEnvironmentCertificateResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%[1]s + +resource "azurerm_container_app_environment_certificate" "test" { + name = "acctest-cacert%[2]d" + container_app_environment_id = azurerm_container_app_environment.test.id + certificate_blob_base64 = filebase64("testdata/testacc.pfx") + certificate_password = "TestAcc" +} +`, r.template(data), data.RandomInteger) +} + +func (r ContainerAppEnvironmentCertificateResource) basicAddTags(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%[1]s + +resource "azurerm_container_app_environment_certificate" "test" { + name = "acctest-cacert%[2]d" + container_app_environment_id = azurerm_container_app_environment.test.id + certificate_blob_base64 = filebase64("testdata/testacc.pfx") + certificate_password = "TestAcc" + + tags = { + env = "testAcc" + } +} +`, r.template(data), data.RandomInteger) +} + +func (r ContainerAppEnvironmentCertificateResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-CAEnv-%[1]d" + location = "%[2]s" +} + +resource "azurerm_log_analytics_workspace" "test" { + name = "acctestCAEnv-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "PerGB2018" + retention_in_days = 30 +} + +resource "azurerm_container_app_environment" "test" { + name = "accTest-CAEnv%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id +} +`, data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/containerapps/container_app_environment_dapr_component_resource.go b/internal/services/containerapps/container_app_environment_dapr_component_resource.go new file mode 100644 index 000000000000..6c79d6b1d4bf --- /dev/null +++ b/internal/services/containerapps/container_app_environment_dapr_component_resource.go @@ -0,0 +1,335 @@ +package containerapps + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/containerapps/helpers" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/containerapps/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type ContainerAppEnvironmentDaprComponentResource struct{} + +type ContainerAppEnvironmentDaprComponentModel struct { + Name string `tfschema:"name"` + ManagedEnvironmentId string `tfschema:"container_app_environment_id"` + ComponentType string `tfschema:"component_type"` + Version string `tfschema:"version"` + IgnoreErrors bool `tfschema:"ignore_errors"` + InitTimeout string `tfschema:"init_timeout"` + Secrets []helpers.Secret `tfschema:"secret"` + Scopes []string `tfschema:"scopes"` + Metadata []helpers.DaprMetadata `tfschema:"metadata"` +} + +var _ sdk.ResourceWithUpdate = ContainerAppEnvironmentDaprComponentResource{} + +func (r ContainerAppEnvironmentDaprComponentResource) ModelObject() interface{} { + return &ContainerAppEnvironmentDaprComponentModel{} +} + +func (r ContainerAppEnvironmentDaprComponentResource) ResourceType() string { + return "azurerm_container_app_environment_dapr_component" +} + +func (r ContainerAppEnvironmentDaprComponentResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return daprcomponents.ValidateDaprComponentID +} + +func (r ContainerAppEnvironmentDaprComponentResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.DaprComponentName, + Description: "The name for this Dapr Component.", + }, + + "container_app_environment_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: daprcomponents.ValidateManagedEnvironmentID, + Description: "The Container App Managed Environment ID to configure this Dapr component on.", + }, + + "component_type": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The Dapr Component Type. For example `state.azure.blobstorage`.", + }, + + "version": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The version of the component.", + }, + + "init_timeout": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "5s", + ValidateFunc: validate.InitTimeout, + Description: "The component initialisation timeout in ISO8601 format. e.g. `5s`, `2h`, `1m`. Defaults to `5s`.", + }, + + "ignore_errors": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + Description: "Should the Dapr sidecar to continue initialisation if the component fails to load. Defaults to `false`", + }, + + "secret": helpers.SecretsSchema(), + + "metadata": helpers.ContainerAppEnvironmentDaprMetadataSchema(), + + "scopes": { + Type: pluginsdk.TypeList, + Optional: true, + MinItems: 1, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + Description: "A list of scopes to which this component applies. e.g. a Container App's `dapr.app_id` value.", + }, + } +} + +func (r ContainerAppEnvironmentDaprComponentResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r ContainerAppEnvironmentDaprComponentResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.DaprComponentsClient + subscriptionId := metadata.Client.Account.SubscriptionId + + var daprComponent ContainerAppEnvironmentDaprComponentModel + + if err := metadata.Decode(&daprComponent); err != nil { + return err + } + + managedEnvironmentId, err := daprcomponents.ParseManagedEnvironmentID(daprComponent.ManagedEnvironmentId) + if err != nil { + return err + } + + id := daprcomponents.NewDaprComponentID(subscriptionId, managedEnvironmentId.ResourceGroupName, managedEnvironmentId.ManagedEnvironmentName, daprComponent.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + daprComponentRequest := daprcomponents.DaprComponent{ + Properties: &daprcomponents.DaprComponentProperties{ + ComponentType: pointer.To(daprComponent.ComponentType), + IgnoreErrors: pointer.To(daprComponent.IgnoreErrors), + InitTimeout: pointer.To(daprComponent.InitTimeout), + Metadata: expandDaprComponentPropertiesMetadata(daprComponent.Metadata), + Secrets: helpers.ExpandDaprSecrets(daprComponent.Secrets), + Scopes: pointer.To(daprComponent.Scopes), + Version: pointer.To(daprComponent.Version), + }, + } + + if len(daprComponent.Scopes) > 0 { + daprComponentRequest.Properties.Scopes = &daprComponent.Scopes + } + + if _, err := client.CreateOrUpdate(ctx, id, daprComponentRequest); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r ContainerAppEnvironmentDaprComponentResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.DaprComponentsClient + id, err := daprcomponents.ParseDaprComponentID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + daprComponentResp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(daprComponentResp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + var state ContainerAppEnvironmentDaprComponentModel + + state.Name = id.DaprComponentName + state.ManagedEnvironmentId = daprcomponents.NewManagedEnvironmentID(id.SubscriptionId, id.ResourceGroupName, id.ManagedEnvironmentName).ID() + + if model := daprComponentResp.Model; model != nil { + if props := model.Properties; props != nil { + state.Version = pointer.From(props.Version) + state.ComponentType = pointer.From(props.ComponentType) + state.Scopes = pointer.From(props.Scopes) + state.InitTimeout = pointer.From(props.InitTimeout) + state.IgnoreErrors = pointer.From(props.IgnoreErrors) + state.Metadata = flattenDaprComponentPropertiesMetadata(props.Metadata) + } + } + + secretsResp, err := client.ListSecrets(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving secrets for %s: %+v", *id, err) + } + + state.Secrets = helpers.FlattenContainerAppDaprSecrets(secretsResp.Model) + + return metadata.Encode(&state) + }, + } +} + +func (r ContainerAppEnvironmentDaprComponentResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.DaprComponentsClient + id, err := daprcomponents.ParseDaprComponentID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r ContainerAppEnvironmentDaprComponentResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.DaprComponentsClient + id, err := daprcomponents.ParseDaprComponentID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var state ContainerAppEnvironmentDaprComponentModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + existing, err := client.Get(ctx, *id) + if err != nil || existing.Model == nil || existing.Model.Properties == nil { + return fmt.Errorf("retrieving %s for update: %+v", *id, err) + } + + // Populate the secrets from the List API to prevent accidental removal. + secretsResp, err := client.ListSecrets(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving secrets for %s: %+v", *id, err) + } + + existing.Model.Properties.Secrets = helpers.UnpackContainerDaprSecretsCollection(secretsResp.Model) + + if metadata.ResourceData.HasChange("version") { + existing.Model.Properties.Version = pointer.To(state.Version) + } + + if metadata.ResourceData.HasChange("init_timeout") { + existing.Model.Properties.InitTimeout = pointer.To(state.InitTimeout) + } + + if metadata.ResourceData.HasChange("ignore_errors") { + existing.Model.Properties.IgnoreErrors = pointer.To(state.IgnoreErrors) + } + + if metadata.ResourceData.HasChange("secret") { + existing.Model.Properties.Secrets = helpers.ExpandDaprSecrets(state.Secrets) + } + + if metadata.ResourceData.HasChange("metadata") { + existing.Model.Properties.Metadata = expandDaprComponentPropertiesMetadata(state.Metadata) + } + + if metadata.ResourceData.HasChange("scopes") { + existing.Model.Properties.Scopes = pointer.To(state.Scopes) + } + + if _, err := client.CreateOrUpdate(ctx, *id, *existing.Model); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func expandDaprComponentPropertiesMetadata(input []helpers.DaprMetadata) *[]daprcomponents.DaprMetadata { + if len(input) == 0 { + return nil + } + + result := make([]daprcomponents.DaprMetadata, 0) + + for _, v := range input { + d := daprcomponents.DaprMetadata{ + Name: pointer.To(v.Name), + } + if v.Value != "" { + d.Value = pointer.To(v.Value) + } + if v.SecretName != "" { + d.SecretRef = pointer.To(v.SecretName) + } + result = append(result, d) + } + + return &result +} + +func flattenDaprComponentPropertiesMetadata(input *[]daprcomponents.DaprMetadata) []helpers.DaprMetadata { + if input == nil { + return []helpers.DaprMetadata{} + } + + result := make([]helpers.DaprMetadata, 0) + for _, v := range *input { + result = append(result, helpers.DaprMetadata{ + Name: pointer.From(v.Name), + SecretName: pointer.From(v.SecretRef), + Value: pointer.From(v.Value), + }) + } + + return result +} diff --git a/internal/services/containerapps/container_app_environment_dapr_component_resource_test.go b/internal/services/containerapps/container_app_environment_dapr_component_resource_test.go new file mode 100644 index 000000000000..aa2156f8594e --- /dev/null +++ b/internal/services/containerapps/container_app_environment_dapr_component_resource_test.go @@ -0,0 +1,287 @@ +package containerapps_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type ContainerAppEnvironmentDaprComponentResource struct{} + +func TestAccContainerAppEnvironmentDaprComponent_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app_environment_dapr_component", "test") + r := ContainerAppEnvironmentDaprComponentResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccContainerAppEnvironmentDaprComponent_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app_environment_dapr_component", "test") + r := ContainerAppEnvironmentDaprComponentResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccContainerAppEnvironmentDaprComponent_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app_environment_dapr_component", "test") + r := ContainerAppEnvironmentDaprComponentResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccContainerAppEnvironmentDaprComponent_completeUpdate(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app_environment_dapr_component", "test") + r := ContainerAppEnvironmentDaprComponentResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.completeUpdate(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r ContainerAppEnvironmentDaprComponentResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := daprcomponents.ParseDaprComponentID(state.ID) + if err != nil { + return nil, err + } + + resp, err := client.ContainerApps.DaprComponentsClient.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return pointer.To(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) + } + + return pointer.To(resp.Model != nil), nil +} + +func (r ContainerAppEnvironmentDaprComponentResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%[1]s + +resource "azurerm_container_app_environment_dapr_component" "test" { + name = "acctest-dapr-%[2]d" + container_app_environment_id = azurerm_container_app_environment.test.id + component_type = "state.azure.blobstorage" + version = "v1" +} + +`, r.template(data), data.RandomInteger) +} + +func (r ContainerAppEnvironmentDaprComponentResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` + +%[1]s + +resource "azurerm_container_app_environment_dapr_component" "import" { + name = azurerm_container_app_environment_dapr_component.test.name + container_app_environment_id = azurerm_container_app_environment_dapr_component.test.container_app_environment_id + component_type = azurerm_container_app_environment_dapr_component.test.component_type + version = azurerm_container_app_environment_dapr_component.test.version +} + +`, r.basic(data), data.RandomInteger) +} + +func (r ContainerAppEnvironmentDaprComponentResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%[1]s + +resource "azurerm_storage_account" "test" { + name = "unlikely23exst2acct%[3]s" + resource_group_name = azurerm_resource_group.test.name + + location = azurerm_resource_group.test.location + account_tier = "Standard" + account_replication_type = "LRS" + + tags = { + environment = "production" + } +} + +resource "azurerm_storage_container" "test" { + name = "container-app-storage" + storage_account_name = azurerm_storage_account.test.name + container_access_type = "private" +} + +resource "azurerm_container_app_environment_dapr_component" "test" { + name = "acctest-dapr-%[2]d" + container_app_environment_id = azurerm_container_app_environment.test.id + component_type = "state.azure.blobstorage" + version = "v1" + + init_timeout = "10s" + ignore_errors = true + + secret { + name = "secret" + value = "sauce" + } + + secret { + name = "storage-account-access-key" + value = azurerm_storage_account.test.primary_access_key + } + + metadata { + name = "storage-account-key" + secret_name = "storage-account-access-key" + } + + metadata { + name = "storage-container-name" + value = azurerm_storage_container.test.name + } + + metadata { + name = "SOME_APP_SETTING" + value = "scwiffy" + } + + scopes = ["testapp"] +} + + +`, r.template(data), data.RandomInteger, data.RandomString) +} + +func (r ContainerAppEnvironmentDaprComponentResource) completeUpdate(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%[1]s + +resource "azurerm_storage_account" "test" { + name = "unlikely23exst2acct%[3]s" + resource_group_name = azurerm_resource_group.test.name + + location = azurerm_resource_group.test.location + account_tier = "Standard" + account_replication_type = "LRS" + + tags = { + environment = "production" + } +} + +resource "azurerm_storage_container" "test" { + name = "container-app-storage" + storage_account_name = azurerm_storage_account.test.name + container_access_type = "private" +} + +resource "azurerm_container_app_environment_dapr_component" "test" { + name = "acctest-dapr-%[2]d" + container_app_environment_id = azurerm_container_app_environment.test.id + component_type = "state.azure.blobstorage" + version = "v2" + + init_timeout = "5s" + ignore_errors = false + + secret { + name = "storage-account-access-key" + value = azurerm_storage_account.test.secondary_access_key + } + + metadata { + name = "storage-account-key" + secret_name = "storage-account-access-key" + } + + metadata { + name = "storage-container-name" + value = azurerm_storage_container.test.name + } + + metadata { + name = "SOME_APP_SETTING" + value = "plumbus" + } + + scopes = ["testapp", "updatedapp"] +} +`, r.template(data), data.RandomInteger, data.RandomString) +} + +func (r ContainerAppEnvironmentDaprComponentResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-CAEnv-%[1]d" + location = "%[2]s" +} + +resource "azurerm_log_analytics_workspace" "test" { + name = "acctestCAEnv-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "PerGB2018" + retention_in_days = 30 +} + +resource "azurerm_container_app_environment" "test" { + name = "accTest-CAEnv%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id +} +`, data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/containerapps/container_app_environment_data_source.go b/internal/services/containerapps/container_app_environment_data_source.go new file mode 100644 index 000000000000..60d117a3dcb1 --- /dev/null +++ b/internal/services/containerapps/container_app_environment_data_source.go @@ -0,0 +1,168 @@ +package containerapps + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type ContainerAppEnvironmentDataSource struct{} + +type ContainerAppEnvironmentDataSourceModel struct { + Name string `tfschema:"name"` + ResourceGroup string `tfschema:"resource_group_name"` + + Location string `tfschema:"location"` + LogAnalyticsWorkspaceName string `tfschema:"log_analytics_workspace_name"` + InfrastructureSubnetId string `tfschema:"infrastructure_subnet_id"` + InternalLoadBalancerEnabled bool `tfschema:"internal_load_balancer_enabled"` + Tags map[string]interface{} `tfschema:"tags"` + + DefaultDomain string `tfschema:"default_domain"` + DockerBridgeCidr string `tfschema:"docker_bridge_cidr"` + PlatformReservedCidr string `tfschema:"platform_reserved_cidr"` + PlatformReservedDnsIP string `tfschema:"platform_reserved_dns_ip_address"` + StaticIP string `tfschema:"static_ip_address"` +} + +var _ sdk.DataSource = ContainerAppEnvironmentDataSource{} + +func (r ContainerAppEnvironmentDataSource) ModelObject() interface{} { + return &ContainerAppEnvironmentDataSourceModel{} +} + +func (r ContainerAppEnvironmentDataSource) ResourceType() string { + return "azurerm_container_app_environment" +} + +func (r ContainerAppEnvironmentDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, // There are no meaningful indicators for validation here, seems any non-empty string is valid at the Portal? + Description: "The name of the Container Apps Managed Environment.", + }, + + "resource_group_name": commonschema.ResourceGroupName(), + } +} + +func (r ContainerAppEnvironmentDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "location": commonschema.LocationComputed(), + + "log_analytics_workspace_name": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The name of the Log Analytics Workspace this Container Apps Managed Environment is linked to.", + }, + + "infrastructure_subnet_id": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The existing Subnet in use by the Container Apps Control Plane.", + }, + + "internal_load_balancer_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + Description: "Does the Container Environment operate in Internal Load Balancing Mode?", + }, + + "tags": commonschema.TagsDataSource(), + + "default_domain": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The default publicly resolvable name of this Container App Environment", + }, + + "docker_bridge_cidr": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The network addressing in which the Container Apps in this Container App Environment will reside in CIDR notation.", + }, + + "platform_reserved_cidr": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The IP range, in CIDR notation, that is reserved for environment infrastructure IP addresses.", + }, + + "platform_reserved_dns_ip_address": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The IP address from the IP range defined by `platform_reserved_cidr` that is reserved for the internal DNS server.", + }, + + "static_ip_address": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The Static IP Address of the Environment.", + }, + } +} + +func (r ContainerAppEnvironmentDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.ManagedEnvironmentClient + subscriptionId := metadata.Client.Account.SubscriptionId + + var environment ContainerAppEnvironmentDataSourceModel + if err := metadata.Decode(&environment); err != nil { + return err + } + + id := managedenvironments.NewManagedEnvironmentID(subscriptionId, environment.ResourceGroup, environment.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + if model := existing.Model; model != nil { + environment.Name = id.ManagedEnvironmentName + environment.ResourceGroup = id.ResourceGroupName + environment.Location = location.Normalize(model.Location) + environment.Tags = tags.Flatten(model.Tags) + + if props := model.Properties; props != nil { + if vnet := props.VnetConfiguration; vnet != nil { + environment.InfrastructureSubnetId = pointer.From(vnet.InfrastructureSubnetId) + environment.InternalLoadBalancerEnabled = pointer.From(vnet.Internal) + environment.DockerBridgeCidr = pointer.From(vnet.DockerBridgeCidr) + environment.PlatformReservedCidr = pointer.From(vnet.PlatformReservedCidr) + environment.PlatformReservedDnsIP = pointer.From(vnet.PlatformReservedDnsIP) + } + + if appsLogs := props.AppLogsConfiguration; appsLogs != nil && appsLogs.LogAnalyticsConfiguration != nil { + environment.LogAnalyticsWorkspaceName = pointer.From(appsLogs.LogAnalyticsConfiguration.CustomerId) + } + + environment.StaticIP = pointer.From(props.StaticIP) + environment.DefaultDomain = pointer.From(props.DefaultDomain) + } + } + + metadata.SetID(id) + + return metadata.Encode(&environment) + }, + } +} diff --git a/internal/services/containerapps/container_app_environment_data_source_test.go b/internal/services/containerapps/container_app_environment_data_source_test.go new file mode 100644 index 000000000000..f3ed1ed5dd72 --- /dev/null +++ b/internal/services/containerapps/container_app_environment_data_source_test.go @@ -0,0 +1,39 @@ +package containerapps_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type ContainerAppEnvironmentDataSource struct{} + +func TestAccContainerAppEnvironmentDataSource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_container_app_environment", "test") + r := ContainerAppEnvironmentDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("log_analytics_workspace_name").IsSet(), + check.That(data.ResourceName).Key("location").IsSet(), + check.That(data.ResourceName).Key("internal_load_balancer_enabled").HasValue("true"), + ), + }, + }) +} + +func (d ContainerAppEnvironmentDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +data "azurerm_container_app_environment" "test" { + name = azurerm_container_app_environment.test.name + resource_group_name = azurerm_container_app_environment.test.resource_group_name +} + +`, ContainerAppEnvironmentResource{}.complete(data)) +} diff --git a/internal/services/containerapps/container_app_environment_resource.go b/internal/services/containerapps/container_app_environment_resource.go new file mode 100644 index 000000000000..7d09e33c3a09 --- /dev/null +++ b/internal/services/containerapps/container_app_environment_resource.go @@ -0,0 +1,322 @@ +package containerapps + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments" + "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/containerapps/validate" + networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type ContainerAppEnvironmentResource struct{} + +type ContainerAppEnvironmentModel struct { + Name string `tfschema:"name"` + ResourceGroup string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + LogAnalyticsWorkspaceId string `tfschema:"log_analytics_workspace_id"` + InfrastructureSubnetId string `tfschema:"infrastructure_subnet_id"` + InternalLoadBalancerEnabled bool `tfschema:"internal_load_balancer_enabled"` + Tags map[string]interface{} `tfschema:"tags"` + + DefaultDomain string `tfschema:"default_domain"` + DockerBridgeCidr string `tfschema:"docker_bridge_cidr"` + PlatformReservedCidr string `tfschema:"platform_reserved_cidr"` + PlatformReservedDnsIP string `tfschema:"platform_reserved_dns_ip_address"` + StaticIP string `tfschema:"static_ip_address"` +} + +var _ sdk.ResourceWithUpdate = ContainerAppEnvironmentResource{} + +func (r ContainerAppEnvironmentResource) ModelObject() interface{} { + return &ContainerAppEnvironmentModel{} +} + +func (r ContainerAppEnvironmentResource) ResourceType() string { + return "azurerm_container_app_environment" +} + +func (r ContainerAppEnvironmentResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return managedenvironments.ValidateManagedEnvironmentID +} + +func (r ContainerAppEnvironmentResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.ManagedEnvironmentName, + Description: "The name of the Container Apps Managed Environment.", + }, + + "location": commonschema.Location(), + + "resource_group_name": commonschema.ResourceGroupName(), + + "log_analytics_workspace_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: workspaces.ValidateWorkspaceID, + Description: "The ID for the Log Analytics Workspace to link this Container Apps Managed Environment to.", + }, + + "infrastructure_subnet_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: networkValidate.SubnetID, + Description: "The existing Subnet to use for the Container Apps Control Plane. **NOTE:** The Subnet must have a `/21` or larger address space.", + }, + + "internal_load_balancer_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + ForceNew: true, + Default: false, + Description: "Should the Container Environment operate in Internal Load Balancing Mode? Defaults to `false`. **Note:** can only be set to `true` if `infrastructure_subnet_id` is specified.", + }, + + "tags": commonschema.Tags(), + } +} + +func (r ContainerAppEnvironmentResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "default_domain": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The default publicly resolvable name of this Container App Environment", + }, + + "docker_bridge_cidr": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The network addressing in which the Container Apps in this Container App Environment will reside in CIDR notation.", + }, + + "platform_reserved_cidr": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The IP range, in CIDR notation, that is reserved for environment infrastructure IP addresses.", + }, + + "platform_reserved_dns_ip_address": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The IP address from the IP range defined by `platform_reserved_cidr` that is reserved for the internal DNS server.", + }, + + "static_ip_address": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The Static IP Address of the Environment.", + }, + } +} + +func (r ContainerAppEnvironmentResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.ManagedEnvironmentClient + logAnalyticsClient := metadata.Client.LogAnalytics.SharedKeyWorkspacesClient + subscriptionId := metadata.Client.Account.SubscriptionId + + var containerAppEnvironment ContainerAppEnvironmentModel + + if err := metadata.Decode(&containerAppEnvironment); err != nil { + return err + } + + id := managedenvironments.NewManagedEnvironmentID(subscriptionId, containerAppEnvironment.ResourceGroup, containerAppEnvironment.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + logAnalyticsId, err := workspaces.ParseWorkspaceID(containerAppEnvironment.LogAnalyticsWorkspaceId) + if err != nil { + return err + } + + workspace, err := logAnalyticsClient.Get(ctx, *logAnalyticsId) + if err != nil { + return fmt.Errorf("retrieving %s for %s: %+v", logAnalyticsId, id, err) + } + + if workspace.Model == nil || workspace.Model.Properties == nil { + return fmt.Errorf("reading customer ID from %s", logAnalyticsId) + } + + if workspace.Model.Properties.CustomerId == nil { + return fmt.Errorf("reading customer ID from %s, `customer_id` is nil", logAnalyticsId) + } + + keys, err := logAnalyticsClient.SharedKeysGetSharedKeys(ctx, *logAnalyticsId) + if err != nil { + return fmt.Errorf("retrieving access keys to %s for %s: %+v", logAnalyticsId, id, err) + } + + if keys.Model.PrimarySharedKey == nil { + return fmt.Errorf("reading shared key for %s in %s", logAnalyticsId, id) + } + + managedEnvironment := managedenvironments.ManagedEnvironment{ + Location: containerAppEnvironment.Location, + Name: pointer.To(containerAppEnvironment.Name), + Properties: &managedenvironments.ManagedEnvironmentProperties{ + AppLogsConfiguration: &managedenvironments.AppLogsConfiguration{ + Destination: pointer.To("log-analytics"), + LogAnalyticsConfiguration: &managedenvironments.LogAnalyticsConfiguration{ + CustomerId: workspace.Model.Properties.CustomerId, + SharedKey: keys.Model.PrimarySharedKey, + }, + }, + VnetConfiguration: &managedenvironments.VnetConfiguration{}, + }, + Tags: tags.Expand(containerAppEnvironment.Tags), + } + + if containerAppEnvironment.InfrastructureSubnetId != "" { + managedEnvironment.Properties.VnetConfiguration.InfrastructureSubnetId = pointer.To(containerAppEnvironment.InfrastructureSubnetId) + managedEnvironment.Properties.VnetConfiguration.Internal = pointer.To(containerAppEnvironment.InternalLoadBalancerEnabled) + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, managedEnvironment); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r ContainerAppEnvironmentResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.ManagedEnvironmentClient + id, err := managedenvironments.ParseManagedEnvironmentID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + existing, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(existing.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("reading %s: %+v", *id, err) + } + + var state ContainerAppEnvironmentModel + + if model := existing.Model; model != nil { + state.Name = id.ManagedEnvironmentName + state.ResourceGroup = id.ResourceGroupName + state.Location = location.Normalize(model.Location) + state.Tags = tags.Flatten(model.Tags) + + if props := model.Properties; props != nil { + if vnet := props.VnetConfiguration; vnet != nil { + state.InfrastructureSubnetId = pointer.From(vnet.InfrastructureSubnetId) + state.InternalLoadBalancerEnabled = pointer.From(vnet.Internal) + state.DockerBridgeCidr = pointer.From(vnet.DockerBridgeCidr) + state.PlatformReservedCidr = pointer.From(vnet.PlatformReservedCidr) + state.PlatformReservedDnsIP = pointer.From(vnet.PlatformReservedDnsIP) + } + + state.StaticIP = pointer.From(props.StaticIP) + state.DefaultDomain = pointer.From(props.DefaultDomain) + } + } + + // Reading in log_analytics_workspace_id is not possible, so reading from config. Import will need to ignore_changes unfortunately + if v := metadata.ResourceData.Get("log_analytics_workspace_id").(string); v != "" { + state.LogAnalyticsWorkspaceId = v + } + + if err := metadata.Encode(&state); err != nil { + return fmt.Errorf("encoding: %+v", err) + } + + return nil + }, + } +} + +func (r ContainerAppEnvironmentResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.ManagedEnvironmentClient + id, err := managedenvironments.ParseManagedEnvironmentID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err = client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r ContainerAppEnvironmentResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.ManagedEnvironmentClient + id, err := managedenvironments.ParseManagedEnvironmentID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var state ContainerAppEnvironmentModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + existing, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("reading %s: %+v", *id, err) + } + + if metadata.ResourceData.HasChange("tags") { + existing.Model.Tags = tags.Expand(state.Tags) + } + + // (@jackofallops) This is not updatable and needs to be removed since the read does not return the sensitive Key field. + // Whilst not ideal, this means we don't need to try and retrieve it again just to send a no-op. + existing.Model.Properties.AppLogsConfiguration = nil + + if err := client.CreateOrUpdateThenPoll(ctx, *id, *existing.Model); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + return nil + }, + } +} diff --git a/internal/services/containerapps/container_app_environment_resource_test.go b/internal/services/containerapps/container_app_environment_resource_test.go new file mode 100644 index 000000000000..33b400b7e68e --- /dev/null +++ b/internal/services/containerapps/container_app_environment_resource_test.go @@ -0,0 +1,222 @@ +package containerapps_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type ContainerAppEnvironmentResource struct{} + +func TestAccContainerAppEnvironment_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app_environment", "test") + r := ContainerAppEnvironmentResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("log_analytics_workspace_id"), + }) +} + +func TestAccContainerAppEnvironment_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app_environment", "test") + r := ContainerAppEnvironmentResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccContainerAppEnvironment_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app_environment", "test") + r := ContainerAppEnvironmentResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("log_analytics_workspace_id"), + }) +} + +func TestAccContainerAppEnvironment_completeUpdate(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app_environment", "test") + r := ContainerAppEnvironmentResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("log_analytics_workspace_id"), + { + Config: r.completeUpdate(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("log_analytics_workspace_id"), + }) +} + +func (r ContainerAppEnvironmentResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := managedenvironments.ParseManagedEnvironmentID(state.ID) + if err != nil { + return nil, err + } + + resp, err := client.ContainerApps.ManagedEnvironmentClient.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return pointer.To(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) + } + + return pointer.To(resp.Model != nil), nil +} + +func (r ContainerAppEnvironmentResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%[1]s + +resource "azurerm_container_app_environment" "test" { + name = "accTest-CAEnv%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id +} +`, r.template(data), data.RandomInteger) +} + +func (r ContainerAppEnvironmentResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` + +%[1]s + +resource "azurerm_container_app_environment" "import" { + name = azurerm_container_app_environment.test.name + resource_group_name = azurerm_container_app_environment.test.resource_group_name + location = azurerm_container_app_environment.test.location + log_analytics_workspace_id = azurerm_container_app_environment.test.log_analytics_workspace_id +} +`, r.basic(data), data.RandomInteger) +} + +func (r ContainerAppEnvironmentResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%[1]s + +resource "azurerm_container_app_environment" "test" { + name = "accTest-CAEnv%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id + + infrastructure_subnet_id = azurerm_subnet.control.id + + internal_load_balancer_enabled = true + + tags = { + Foo = "Bar" + secret = "sauce" + } +} +`, r.templateVNet(data), data.RandomInteger) +} + +func (r ContainerAppEnvironmentResource) completeUpdate(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%[1]s + +resource "azurerm_container_app_environment" "test" { + name = "accTest-CAEnv%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id + + infrastructure_subnet_id = azurerm_subnet.control.id + + internal_load_balancer_enabled = true + + tags = { + Foo = "test" + } +} +`, r.templateVNet(data), data.RandomInteger) +} + +func (r ContainerAppEnvironmentResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-CAE-%[1]d" + location = "%[2]s" +} + +resource "azurerm_log_analytics_workspace" "test" { + name = "acctestLAW-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "PerGB2018" + retention_in_days = 30 +} +`, data.RandomInteger, data.Locations.Primary) +} + +func (r ContainerAppEnvironmentResource) templateVNet(data acceptance.TestData) string { + return fmt.Sprintf(` + +%[1]s + +resource "azurerm_virtual_network" "test" { + name = "acctestvirtnet%[2]d" + address_space = ["10.0.0.0/16"] + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_subnet" "control" { + name = "control-plane" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test.name + address_prefixes = ["10.0.0.0/23"] +} + +`, r.template(data), data.RandomInteger) +} diff --git a/internal/services/containerapps/container_app_environment_storage_resource.go b/internal/services/containerapps/container_app_environment_storage_resource.go new file mode 100644 index 000000000000..311832a5f3a5 --- /dev/null +++ b/internal/services/containerapps/container_app_environment_storage_resource.go @@ -0,0 +1,254 @@ +package containerapps + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/containerapps/validate" + storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type ContainerAppEnvironmentStorageResource struct{} + +type ContainerAppEnvironmentStorageModel struct { + Name string `tfschema:"name"` + ContainerAppEnvironmentId string `tfschema:"container_app_environment_id"` + AccountName string `tfschema:"account_name"` + AccessKey string `tfschema:"access_key"` + ShareName string `tfschema:"share_name"` + AccessMode string `tfschema:"access_mode"` +} + +var _ sdk.ResourceWithUpdate = ContainerAppEnvironmentStorageResource{} + +func (r ContainerAppEnvironmentStorageResource) ModelObject() interface{} { + return &ContainerAppEnvironmentStorageModel{} +} + +func (r ContainerAppEnvironmentStorageResource) ResourceType() string { + return "azurerm_container_app_environment_storage" +} + +func (r ContainerAppEnvironmentStorageResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return managedenvironmentsstorages.ValidateStorageID +} + +func (r ContainerAppEnvironmentStorageResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.ManagedEnvironmentStorageName, + Description: "The name for this Storage.", + }, + + "container_app_environment_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: managedenvironmentsstorages.ValidateManagedEnvironmentID, + Description: "The ID of the Container App Environment to which this storage belongs.", + }, + + "account_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: storageValidate.StorageAccountName, + Description: "The Azure Storage Account in which the Share to be used is located.", + }, + + "access_key": { + Type: pluginsdk.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The Storage Account Access Key.", + }, + + "share_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: storageValidate.StorageShareName, + Description: "The name of the Azure Storage Share to use.", + }, + + "access_mode": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(managedenvironmentsstorages.AccessModeReadOnly), + string(managedenvironmentsstorages.AccessModeReadWrite), + }, false), + Description: "The access mode to connect this storage to the Container App. Possible values include `ReadOnly` and `ReadWrite`.", + }, + } +} + +func (r ContainerAppEnvironmentStorageResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r ContainerAppEnvironmentStorageResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.StorageClient + + var storage ContainerAppEnvironmentStorageModel + + if err := metadata.Decode(&storage); err != nil { + return err + } + + containerAppEnvironmentId, err := managedenvironmentsstorages.ParseManagedEnvironmentID(storage.ContainerAppEnvironmentId) + if err != nil { + return err + } + + id := managedenvironmentsstorages.NewStorageID(metadata.Client.Account.SubscriptionId, containerAppEnvironmentId.ResourceGroupName, containerAppEnvironmentId.ManagedEnvironmentName, storage.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + accessMode := managedenvironmentsstorages.AccessMode(storage.AccessMode) + + managedEnvironmentStorage := managedenvironmentsstorages.ManagedEnvironmentStorage{ + Properties: &managedenvironmentsstorages.ManagedEnvironmentStorageProperties{ + AzureFile: &managedenvironmentsstorages.AzureFileProperties{ + AccessMode: &accessMode, + AccountKey: pointer.To(storage.AccessKey), + AccountName: pointer.To(storage.AccountName), + ShareName: pointer.To(storage.ShareName), + }, + }, + } + + if _, err := client.CreateOrUpdate(ctx, id, managedEnvironmentStorage); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + + return nil + }, + } +} + +func (r ContainerAppEnvironmentStorageResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.StorageClient + + id, err := managedenvironmentsstorages.ParseStorageID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + existing, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(existing.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("reading %s: %+v", *id, err) + } + + var state ContainerAppEnvironmentStorageModel + + state.Name = id.StorageName + state.ContainerAppEnvironmentId = managedenvironmentsstorages.NewManagedEnvironmentID(id.SubscriptionId, id.ResourceGroupName, id.ManagedEnvironmentName).ID() + + if model := existing.Model; model != nil { + if props := model.Properties; props != nil { + if azureFile := props.AzureFile; azureFile != nil { + state.AccountName = pointer.From(azureFile.AccountName) + if azureFile.AccessMode != nil { + state.AccessMode = string(*azureFile.AccessMode) + } + state.ShareName = pointer.From(azureFile.ShareName) + } + } + } + if keyFromConfig, ok := metadata.ResourceData.GetOk("access_key"); ok { + state.AccessKey = keyFromConfig.(string) + } + + return metadata.Encode(&state) + }, + } +} + +func (r ContainerAppEnvironmentStorageResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.StorageClient + + id, err := managedenvironmentsstorages.ParseStorageID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r ContainerAppEnvironmentStorageResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.StorageClient + + id, err := managedenvironmentsstorages.ParseStorageID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var storage ContainerAppEnvironmentStorageModel + if err := metadata.Decode(&storage); err != nil { + return err + } + + existing, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("reading %s for update: %+v", *id, err) + } + + if existing.Model.Properties == nil || existing.Model.Properties.AzureFile == nil { + return fmt.Errorf("could not update %s: existing resource is missing `AzureFile` properties", *id) + } + + // This *must* be sent, and is currently the only updatable property on the resource. + existing.Model.Properties.AzureFile.AccountKey = pointer.To(metadata.ResourceData.Get("access_key").(string)) + + if _, err := client.CreateOrUpdate(ctx, *id, *existing.Model); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + return nil + }, + } +} diff --git a/internal/services/containerapps/container_app_environment_storage_resource_test.go b/internal/services/containerapps/container_app_environment_storage_resource_test.go new file mode 100644 index 000000000000..0a55f2f57baa --- /dev/null +++ b/internal/services/containerapps/container_app_environment_storage_resource_test.go @@ -0,0 +1,187 @@ +package containerapps_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type ContainerAppEnvironmentStorageResource struct{} + +func TestAccContainerAppEnvironmentStorage_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app_environment_storage", "test") + r := ContainerAppEnvironmentStorageResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("access_key"), + }) +} + +func TestAccContainerAppEnvironmentStorage_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app_environment_storage", "test") + r := ContainerAppEnvironmentStorageResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("access_key"), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("access_key"), + }) +} + +func TestAccContainerAppEnvironmentStorage_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app_environment_storage", "test") + r := ContainerAppEnvironmentStorageResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func (r ContainerAppEnvironmentStorageResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := managedenvironmentsstorages.ParseStorageID(state.ID) + if err != nil { + return nil, err + } + + resp, err := client.ContainerApps.StorageClient.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return pointer.To(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) + } + if response.WasNotFound(resp.HttpResponse) { + return pointer.To(false), nil + } + + return pointer.To(true), nil + +} + +func (r ContainerAppEnvironmentStorageResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_container_app_environment_storage" "test" { + name = "testacc-caes-%[2]d" + container_app_environment_id = azurerm_container_app_environment.test.id + account_name = azurerm_storage_account.test.name + access_key = azurerm_storage_account.test.primary_access_key + share_name = azurerm_storage_share.test.name + access_mode = "ReadWrite" +} +`, r.template(data), data.RandomInteger) +} + +func (r ContainerAppEnvironmentStorageResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_container_app_environment_storage" "test" { + name = "testacc-caes-%[2]d" + container_app_environment_id = azurerm_container_app_environment.test.id + account_name = azurerm_storage_account.test.name + access_key = azurerm_storage_account.test.secondary_access_key + share_name = azurerm_storage_share.test.name + access_mode = "ReadOnly" +} +`, r.template(data), data.RandomInteger) +} + +func (r ContainerAppEnvironmentStorageResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_container_app_environment_storage" "import" { + name = azurerm_container_app_environment_storage.test.name + container_app_environment_id = azurerm_container_app_environment_storage.test.container_app_environment_id + account_name = azurerm_container_app_environment_storage.test.account_name + access_key = azurerm_container_app_environment_storage.test.access_key + share_name = azurerm_container_app_environment_storage.test.share_name + access_mode = azurerm_container_app_environment_storage.test.access_mode +} +`, r.basic(data)) +} + +func (r ContainerAppEnvironmentStorageResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-CAE-%[1]d" + location = "%[2]s" +} + +resource "azurerm_log_analytics_workspace" "test" { + name = "acctestLAW-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "PerGB2018" + retention_in_days = 30 +} + +resource "azurerm_storage_account" "test" { + name = "unlikely23exst2acct%[3]s" + resource_group_name = azurerm_resource_group.test.name + + location = azurerm_resource_group.test.location + account_tier = "Standard" + account_replication_type = "LRS" + + tags = { + environment = "accTest" + } +} + +resource "azurerm_storage_share" "test" { + name = "testshare%[3]s" + storage_account_name = azurerm_storage_account.test.name + quota = 1 +} + +resource "azurerm_container_app_environment" "test" { + name = "accTest-CAEnv%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id +} + +`, data.RandomInteger, data.Locations.Primary, data.RandomString) +} diff --git a/internal/services/containerapps/container_app_resource.go b/internal/services/containerapps/container_app_resource.go new file mode 100644 index 000000000000..7a74a66e78f4 --- /dev/null +++ b/internal/services/containerapps/container_app_resource.go @@ -0,0 +1,436 @@ +package containerapps + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/containerapps/helpers" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/containerapps/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type ContainerAppResource struct{} + +type ContainerAppModel struct { + Name string `tfschema:"name"` + ResourceGroup string `tfschema:"resource_group_name"` + ManagedEnvironmentId string `tfschema:"container_app_environment_id"` + Location string `tfschema:"location"` + + RevisionMode string `tfschema:"revision_mode"` + Ingress []helpers.Ingress `tfschema:"ingress"` + Registries []helpers.Registry `tfschema:"registry"` + Secrets []helpers.Secret `tfschema:"secret"` + Dapr []helpers.Dapr `tfschema:"dapr"` + Template []helpers.ContainerTemplate `tfschema:"template"` + + Identity []identity.ModelSystemAssignedUserAssigned `tfschema:"identity"` + + Tags map[string]interface{} `tfschema:"tags"` + + OutboundIpAddresses []string `tfschema:"outbound_ip_addresses"` + LatestRevisionName string `tfschema:"latest_revision_name"` + LatestRevisionFqdn string `tfschema:"latest_revision_fqdn"` + CustomDomainVerificationId string `tfschema:"custom_domain_verification_id"` +} + +var _ sdk.ResourceWithUpdate = ContainerAppResource{} + +var _ sdk.ResourceWithCustomizeDiff = ContainerAppResource{} + +func (r ContainerAppResource) ModelObject() interface{} { + return &ContainerAppModel{} +} + +func (r ContainerAppResource) ResourceType() string { + return "azurerm_container_app" +} + +func (r ContainerAppResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return containerapps.ValidateContainerAppID +} + +func (r ContainerAppResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.ContainerAppName, + Description: "The name for this Container App.", + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "container_app_environment_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: managedenvironments.ValidateManagedEnvironmentID, + Description: "The ID of the Container App Environment to host this Container App.", + }, + + "template": helpers.ContainerTemplateSchema(), + + "revision_mode": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(containerapps.ActiveRevisionsModeSingle), + string(containerapps.ActiveRevisionsModeMultiple), + }, false), + }, + + "ingress": helpers.ContainerAppIngressSchema(), + + "registry": helpers.ContainerAppRegistrySchema(), + + "secret": helpers.SecretsSchema(), + + "dapr": helpers.ContainerDaprSchema(), + + "identity": commonschema.SystemOrUserAssignedIdentityOptional(), + + "tags": commonschema.Tags(), + } +} + +func (r ContainerAppResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "location": commonschema.LocationComputed(), + + "outbound_ip_addresses": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "latest_revision_name": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The name of the latest Container Revision.", + }, + + "latest_revision_fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The FQDN of the Latest Revision of the Container App.", + }, + + "custom_domain_verification_id": { + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, + Description: "The ID of the Custom Domain Verification for this Container App.", + }, + } +} + +func (r ContainerAppResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.ContainerAppClient + environmentClient := metadata.Client.ContainerApps.ManagedEnvironmentClient + subscriptionId := metadata.Client.Account.SubscriptionId + + var app ContainerAppModel + + if err := metadata.Decode(&app); err != nil { + return err + } + + id := containerapps.NewContainerAppID(subscriptionId, app.ResourceGroup, app.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + envId, err := managedenvironments.ParseManagedEnvironmentID(app.ManagedEnvironmentId) + if err != nil { + return fmt.Errorf("parsing Container App Environment ID for %s: %+v", id, err) + } + + env, err := environmentClient.Get(ctx, *envId) + if err != nil { + return fmt.Errorf("reading %s for %s: %+v", *envId, id, err) + } + + registries, err := helpers.ExpandContainerAppRegistries(app.Registries) + if err != nil { + return fmt.Errorf("invalid registry config for %s: %+v", id, err) + } + + containerApp := containerapps.ContainerApp{ + Location: location.Normalize(env.Model.Location), + Properties: &containerapps.ContainerAppProperties{ + Configuration: &containerapps.Configuration{ + Ingress: helpers.ExpandContainerAppIngress(app.Ingress, id.ContainerAppName), + Dapr: helpers.ExpandContainerAppDapr(app.Dapr), + Secrets: helpers.ExpandContainerSecrets(app.Secrets), + Registries: registries, + }, + ManagedEnvironmentId: pointer.To(app.ManagedEnvironmentId), + Template: helpers.ExpandContainerAppTemplate(app.Template, metadata), + }, + Tags: tags.Expand(app.Tags), + } + + ident, err := identity.ExpandSystemAndUserAssignedMapFromModel(app.Identity) + if err != nil { + return err + } + containerApp.Identity = pointer.To(identity.LegacySystemAndUserAssignedMap(*ident)) + + containerApp.Properties.Configuration.ActiveRevisionsMode = pointer.To(containerapps.ActiveRevisionsMode(app.RevisionMode)) + + if err := client.CreateOrUpdateThenPoll(ctx, id, containerApp); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + + return nil + }, + } +} + +func (r ContainerAppResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.ContainerAppClient + + id, err := containerapps.ParseContainerAppID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + existing, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(existing.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("reading %s: %+v", *id, err) + } + + var state ContainerAppModel + + state.Name = id.ContainerAppName + state.ResourceGroup = id.ResourceGroupName + + if model := existing.Model; model != nil { + state.Location = location.Normalize(model.Location) + state.Tags = tags.Flatten(model.Tags) + ident, err := identity.FlattenSystemAndUserAssignedMapToModel(pointer.To(identity.SystemAndUserAssignedMap(*model.Identity))) + if err != nil { + return err + } + state.Identity = pointer.From(ident) + + if props := model.Properties; props != nil { + envId, err := managedenvironments.ParseManagedEnvironmentIDInsensitively(pointer.From(props.ManagedEnvironmentId)) + if err != nil { + return err + } + state.ManagedEnvironmentId = envId.ID() + state.Template = helpers.FlattenContainerAppTemplate(props.Template) + if config := props.Configuration; config != nil { + if config.ActiveRevisionsMode != nil { + state.RevisionMode = string(pointer.From(config.ActiveRevisionsMode)) + } + state.Ingress = helpers.FlattenContainerAppIngress(config.Ingress, id.ContainerAppName) + state.Registries = helpers.FlattenContainerAppRegistries(config.Registries) + state.Dapr = helpers.FlattenContainerAppDapr(config.Dapr) + } + state.LatestRevisionName = pointer.From(props.LatestRevisionName) + state.LatestRevisionFqdn = pointer.From(props.LatestRevisionFqdn) + state.CustomDomainVerificationId = pointer.From(props.CustomDomainVerificationId) + state.OutboundIpAddresses = pointer.From(props.OutboundIPAddresses) + } + } + + secretsResp, err := client.ListSecrets(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving secrets for %s: %+v", *id, err) + } + + state.Secrets = helpers.FlattenContainerAppSecrets(secretsResp.Model) + + return metadata.Encode(&state) + }, + } +} + +func (r ContainerAppResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.ContainerAppClient + + id, err := containerapps.ParseContainerAppID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err = client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r ContainerAppResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerApps.ContainerAppClient + + id, err := containerapps.ParseContainerAppID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var state ContainerAppModel + if err := metadata.Decode(&state); err != nil { + return err + } + + existing, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("reading %s: %+v", *id, err) + } + + model := existing.Model + + if model.Properties == nil { + return fmt.Errorf("retreiving properties for %s for update: %+v", *id, err) + } + + if model.Properties.Configuration == nil { + model.Properties.Configuration = &containerapps.Configuration{} + } + + // Delta-updates need the secrets back from the list API, or we'll end up removing them or erroring out. + secretsResp, err := client.ListSecrets(ctx, *id) + if err != nil || secretsResp.Model == nil { + if secretsResp.HttpResponse == nil || secretsResp.HttpResponse.StatusCode != http.StatusNoContent { + return fmt.Errorf("retrieving secrets for update for %s: %+v", *id, err) + } + } + model.Properties.Configuration.Secrets = helpers.UnpackContainerSecretsCollection(secretsResp.Model) + + if metadata.ResourceData.HasChange("revision_mode") { + model.Properties.Configuration.ActiveRevisionsMode = pointer.To(containerapps.ActiveRevisionsMode(state.RevisionMode)) + } + + if metadata.ResourceData.HasChange("ingress") { + model.Properties.Configuration.Ingress = helpers.ExpandContainerAppIngress(state.Ingress, id.ContainerAppName) + } + + if metadata.ResourceData.HasChange("registry") { + model.Properties.Configuration.Registries, err = helpers.ExpandContainerAppRegistries(state.Registries) + if err != nil { + return fmt.Errorf("invalid registry config for %s: %+v", id, err) + } + } + + if metadata.ResourceData.HasChange("dapr") { + model.Properties.Configuration.Dapr = helpers.ExpandContainerAppDapr(state.Dapr) + + } + + if metadata.ResourceData.HasChange("template") { + if model.Properties.Template == nil { + model.Properties.Template = &containerapps.Template{} + } + allProbesRemoved := helpers.ContainerAppProbesRemoved(metadata) + if allProbesRemoved { + containers := *model.Properties.Template.Containers + containers[0].Probes = pointer.To(make([]containerapps.ContainerAppProbe, 0)) + model.Properties.Template.Containers = &containers + } + } + + if metadata.ResourceData.HasChange("secret") { + model.Properties.Configuration.Secrets = helpers.ExpandContainerSecrets(state.Secrets) + } + + if metadata.ResourceData.HasChange("identity") { + ident, err := identity.ExpandSystemAndUserAssignedMapFromModel(state.Identity) + if err != nil { + return err + } + model.Identity = pointer.To(identity.LegacySystemAndUserAssignedMap(*ident)) + + } + + if metadata.ResourceData.HasChange("tags") { + model.Tags = tags.Expand(state.Tags) + } + + model.Properties.Template = helpers.ExpandContainerAppTemplate(state.Template, metadata) + + if err := client.CreateOrUpdateThenPoll(ctx, *id, *model); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r ContainerAppResource) CustomizeDiff() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + if metadata.ResourceDiff != nil && metadata.ResourceDiff.HasChange("secret") { + stateSecretsRaw, configSecretsRaw := metadata.ResourceDiff.GetChange("secret") + stateSecrets := stateSecretsRaw.(*schema.Set).List() + configSecrets := configSecretsRaw.(*schema.Set).List() + // Check there's not less + if len(configSecrets) < len(stateSecrets) { + return fmt.Errorf("cannot remove secrets from Container Apps at this time due to a limitation in the Container Apps Service. Please see `https://github.com/microsoft/azure-container-apps/issues/395` for more details") + } + // Check secrets names in state are all present in config, the values don't matter + if len(stateSecrets) > 0 { + for _, s := range stateSecrets { + found := false + for _, c := range configSecrets { + if s.(map[string]interface{})["name"] == c.(map[string]interface{})["name"] { + found = true + break + } + } + if !found { + return fmt.Errorf("previously configured secret %q was removed. Removing secrets is not supported by the Container Apps Service at this time, see `https://github.com/microsoft/azure-container-apps/issues/395` for more details", s.(map[string]interface{})["name"]) + } + } + } + } + return nil + }, + } +} diff --git a/internal/services/containerapps/container_app_resource_test.go b/internal/services/containerapps/container_app_resource_test.go new file mode 100644 index 000000000000..546cdd3e3bc8 --- /dev/null +++ b/internal/services/containerapps/container_app_resource_test.go @@ -0,0 +1,993 @@ +package containerapps_test + +import ( + "context" + "fmt" + "regexp" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type ContainerAppResource struct{} + +func TestAccContainerAppResource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app", "test") + r := ContainerAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccContainerAppResource_withSystemAssignedIdentity(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app", "test") + r := ContainerAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withSystemIdentity(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccContainerAppResource_withUserAssignedIdentity(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app", "test") + r := ContainerAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withUserIdentity(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccContainerAppResource_withIdentityUpdate(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app", "test") + r := ContainerAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withSystemIdentity(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.withUserIdentity(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.withSystemIdentity(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccContainerAppResource_basicUpdate(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app", "test") + r := ContainerAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.basicUpdate(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccContainerAppResource_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app", "test") + r := ContainerAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccContainerAppResource_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app", "test") + r := ContainerAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data, "rev1"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccContainerAppResource_completeWithVNet(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app", "test") + r := ContainerAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.completeWithVnet(data, "rev1"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccContainerAppResource_completeWithSidecar(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app", "test") + r := ContainerAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.completeWithSidecar(data, "rev1"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccContainerAppResource_completeUpdate(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app", "test") + r := ContainerAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data, "rev1"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.completeUpdate(data, "rev2"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccContainerAppResource_secretRemoveShouldFail(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app", "test") + r := ContainerAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.completeUpdate(data, "rev1"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.complete(data, "rev2"), + ExpectError: regexp.MustCompile("cannot remove secrets from Container Apps at this time"), + }, + }) +} + +func TestAccContainerAppResource_secretRemoveWithAddShouldFail(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_app", "test") + r := ContainerAppResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.completeUpdate(data, "rev1"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.completeChangedSecret(data, "rev2"), + ExpectError: regexp.MustCompile("previously configured secret"), + }, + }) +} + +func (r ContainerAppResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := containerapps.ParseContainerAppID(state.ID) + if err != nil { + return nil, err + } + + resp, err := client.ContainerApps.ContainerAppClient.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return pointer.To(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) + } + + return pointer.To(resp.Model != nil), nil +} + +func (r ContainerAppResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_container_app" "test" { + name = "acctest-capp-%[2]d" + resource_group_name = azurerm_resource_group.test.name + container_app_environment_id = azurerm_container_app_environment.test.id + revision_mode = "Single" + + template { + container { + name = "acctest-cont-%[2]d" + image = "jackofallops/azure-containerapps-python-acctest:v0.0.1" + cpu = 0.25 + memory = "0.5Gi" + } + } +} +`, r.template(data), data.RandomInteger) +} + +func (r ContainerAppResource) withSystemIdentity(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_container_app" "test" { + name = "acctest-capp-%[2]d" + resource_group_name = azurerm_resource_group.test.name + container_app_environment_id = azurerm_container_app_environment.test.id + revision_mode = "Single" + + identity { + type = "SystemAssigned" + } + + template { + container { + name = "acctest-cont-%[2]d" + image = "jackofallops/azure-containerapps-python-acctest:v0.0.1" + cpu = 0.25 + memory = "0.5Gi" + } + } +} +`, r.template(data), data.RandomInteger) +} + +func (r ContainerAppResource) withUserIdentity(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_user_assigned_identity" "test" { + name = "acct-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} + +resource "azurerm_container_app" "test" { + name = "acctest-capp-%[2]d" + resource_group_name = azurerm_resource_group.test.name + container_app_environment_id = azurerm_container_app_environment.test.id + revision_mode = "Single" + + identity { + type = "UserAssigned" + identity_ids = [azurerm_user_assigned_identity.test.id] + } + + template { + container { + name = "acctest-cont-%[2]d" + image = "jackofallops/azure-containerapps-python-acctest:v0.0.1" + cpu = 0.25 + memory = "0.5Gi" + } + } +} +`, r.template(data), data.RandomInteger) +} + +func (r ContainerAppResource) basicUpdate(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_container_app" "test" { + name = "acctest-capp-%[2]d" + resource_group_name = azurerm_resource_group.test.name + container_app_environment_id = azurerm_container_app_environment.test.id + revision_mode = "Single" + + template { + container { + name = "acctest-cont-%[2]d" + image = "jackofallops/azure-containerapps-python-acctest:v0.0.1" + cpu = 0.5 + memory = "1Gi" + } + } +} +`, r.template(data), data.RandomInteger) +} + +func (r ContainerAppResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_container_app" "import" { + name = azurerm_container_app.test.name + resource_group_name = azurerm_container_app.test.resource_group_name + container_app_environment_id = azurerm_container_app.test.container_app_environment_id + revision_mode = azurerm_container_app.test.revision_mode + + template { + container { + name = azurerm_container_app.test.template.0.container.0.name + image = azurerm_container_app.test.template.0.container.0.image + cpu = azurerm_container_app.test.template.0.container.0.cpu + memory = azurerm_container_app.test.template.0.container.0.memory + } + } +} +`, r.basic(data)) +} + +func (r ContainerAppResource) complete(data acceptance.TestData, revisionSuffix string) string { + return fmt.Sprintf(` +%s + +resource "azurerm_container_app" "test" { + name = "acctest-capp-%[2]d" + resource_group_name = azurerm_resource_group.test.name + container_app_environment_id = azurerm_container_app_environment.test.id + revision_mode = "Single" + + template { + container { + name = "acctest-cont-%[2]d" + image = "jackofallops/azure-containerapps-python-acctest:v0.0.1" + cpu = 0.25 + memory = "0.5Gi" + + readiness_probe { + transport = "HTTP" + port = 5000 + } + + liveness_probe { + transport = "HTTP" + port = 5000 + path = "/health" + + header { + name = "Cache-Control" + value = "no-cache" + } + + initial_delay = 5 + interval_seconds = 20 + timeout = 2 + failure_count_threshold = 1 + } + + startup_probe { + transport = "TCP" + port = 5000 + } + + volume_mounts { + name = azurerm_container_app_environment_storage.test.name + path = "/tmp/testdata" + } + } + + volume { + name = azurerm_container_app_environment_storage.test.name + storage_type = "AzureFile" + storage_name = azurerm_container_app_environment_storage.test.name + } + + min_replicas = 2 + max_replicas = 3 + + revision_suffix = "%[3]s" + } + + ingress { + allow_insecure_connections = true + external_enabled = true + target_port = 5000 + transport = "http" + traffic_weight { + latest_revision = true + percentage = 100 + } + } + + registry { + server = azurerm_container_registry.test.login_server + username = azurerm_container_registry.test.admin_username + password_secret_name = "registry-password" + } + + secret { + name = "registry-password" + value = azurerm_container_registry.test.admin_password + } + + dapr { + app_id = "acctest-cont-%[2]d" + app_port = 5000 + app_protocol = "http" + } + + tags = { + foo = "Bar" + accTest = "1" + } +} +`, r.templatePlusExtras(data), data.RandomInteger, revisionSuffix) +} + +func (r ContainerAppResource) completeWithVnet(data acceptance.TestData, revisionSuffix string) string { + return fmt.Sprintf(` +%s + +resource "azurerm_container_app" "test" { + name = "acctest-capp-%[2]d" + resource_group_name = azurerm_resource_group.test.name + container_app_environment_id = azurerm_container_app_environment.test.id + revision_mode = "Single" + + template { + container { + name = "acctest-cont-%[2]d" + image = "jackofallops/azure-containerapps-python-acctest:v0.0.1" + cpu = 0.25 + memory = "0.5Gi" + + readiness_probe { + transport = "HTTP" + port = 5000 + } + + liveness_probe { + transport = "HTTP" + port = 5000 + path = "/health" + + header { + name = "Cache-Control" + value = "no-cache" + } + + initial_delay = 5 + timeout = 2 + failure_count_threshold = 1 + } + + startup_probe { + transport = "TCP" + port = 5000 + } + + volume_mounts { + name = azurerm_container_app_environment_storage.test.name + path = "/tmp/testdata" + } + } + + volume { + name = azurerm_container_app_environment_storage.test.name + storage_type = "AzureFile" + storage_name = azurerm_container_app_environment_storage.test.name + } + + min_replicas = 2 + max_replicas = 3 + + revision_suffix = "%[3]s" + } + + ingress { + allow_insecure_connections = true + target_port = 5000 + transport = "http" + traffic_weight { + latest_revision = true + percentage = 100 + } + } + + registry { + server = azurerm_container_registry.test.login_server + username = azurerm_container_registry.test.admin_username + password_secret_name = "registry-password" + } + + secret { + name = "registry-password" + value = azurerm_container_registry.test.admin_password + } + + tags = { + foo = "Bar" + accTest = "1" + } +} +`, r.templateWithVnet(data), data.RandomInteger, revisionSuffix) +} + +func (r ContainerAppResource) completeWithSidecar(data acceptance.TestData, revisionSuffix string) string { + return fmt.Sprintf(` +%s + +resource "azurerm_container_app" "test" { + name = "acctest-capp-%[2]d" + resource_group_name = azurerm_resource_group.test.name + container_app_environment_id = azurerm_container_app_environment.test.id + revision_mode = "Single" + + template { + container { + name = "acctest-cont-sidecar-%[2]d" + image = "jackofallops/azure-containerapps-python-acctest:v0.0.1" + cpu = 0.25 + memory = "0.5Gi" + + readiness_probe { + transport = "HTTP" + port = 5000 + } + + liveness_probe { + transport = "HTTP" + port = 5000 + path = "/health" + + header { + name = "Cache-Control" + value = "no-cache" + } + + initial_delay = 5 + timeout = 2 + failure_count_threshold = 1 + } + + startup_probe { + transport = "TCP" + port = 5000 + } + + volume_mounts { + name = azurerm_container_app_environment_storage.test.name + path = "/tmp/testdata" + } + } + + container { + name = "acctest-cont-%[2]d" + image = "jackofallops/azure-containerapps-python-acctest:v0.0.1" + cpu = 0.25 + memory = "0.5Gi" + + readiness_probe { + transport = "HTTP" + port = 5000 + } + + liveness_probe { + transport = "HTTP" + port = 5000 + path = "/health" + + header { + name = "Cache-Control" + value = "no-cache" + } + + initial_delay = 5 + timeout = 2 + failure_count_threshold = 1 + } + + startup_probe { + transport = "TCP" + port = 5000 + } + + volume_mounts { + name = azurerm_container_app_environment_storage.test.name + path = "/tmp/testdata" + } + } + + volume { + name = azurerm_container_app_environment_storage.test.name + storage_type = "AzureFile" + storage_name = azurerm_container_app_environment_storage.test.name + } + + min_replicas = 2 + max_replicas = 3 + + revision_suffix = "%[3]s" + } + + ingress { + allow_insecure_connections = true + target_port = 5000 + transport = "http" + traffic_weight { + latest_revision = true + percentage = 100 + } + } + + registry { + server = azurerm_container_registry.test.login_server + username = azurerm_container_registry.test.admin_username + password_secret_name = "registry-password" + } + + secret { + name = "registry-password" + value = azurerm_container_registry.test.admin_password + } + + tags = { + foo = "Bar" + accTest = "1" + } +} +`, r.templatePlusExtras(data), data.RandomInteger, revisionSuffix) +} + +func (r ContainerAppResource) completeChangedSecret(data acceptance.TestData, revisionSuffix string) string { + return fmt.Sprintf(` +%s + +resource "azurerm_container_app" "test" { + name = "acctest-capp-%[2]d" + resource_group_name = azurerm_resource_group.test.name + container_app_environment_id = azurerm_container_app_environment.test.id + revision_mode = "Multiple" + + template { + container { + name = "acctest-cont-%[2]d" + image = "jackofallops/azure-containerapps-python-acctest:v0.0.1" + + cpu = 0.5 + memory = "1Gi" + + readiness_probe { + transport = "HTTP" + port = 5000 + path = "/uptime" + timeout = 2 + failure_count_threshold = 1 + success_count_threshold = 1 + + header { + name = "Cache-Control" + value = "no-cache" + } + } + + liveness_probe { + transport = "HTTP" + port = 5000 + path = "/health" + + header { + name = "Cache-Control" + value = "no-cache" + } + + initial_delay = 5 + timeout = 2 + failure_count_threshold = 3 + } + + startup_probe { + transport = "TCP" + port = 5000 + timeout = 5 + failure_count_threshold = 1 + } + } + + min_replicas = 1 + max_replicas = 4 + + revision_suffix = "%[3]s" + } + + ingress { + allow_insecure_connections = true + external_enabled = true + target_port = 5000 + transport = "auto" + + traffic_weight { + latest_revision = true + percentage = 20 + } + + traffic_weight { + revision_suffix = "rev1" + percentage = 80 + } + } + + registry { + server = azurerm_container_registry.test.login_server + username = azurerm_container_registry.test.admin_username + password_secret_name = "registry-password" + } + + secret { + name = "registry-password" + value = azurerm_container_registry.test.admin_password + } + + secret { + name = "pickle" + value = "morty" + } + + dapr { + app_id = "acctest-cont-%[2]d" + app_port = 5000 + app_protocol = "http" + } + + tags = { + foo = "Bar" + accTest = "1" + } +} +`, r.templatePlusExtras(data), data.RandomInteger, revisionSuffix) +} + +func (r ContainerAppResource) completeUpdate(data acceptance.TestData, revisionSuffix string) string { + return fmt.Sprintf(` +%s + +resource "azurerm_container_app" "test" { + name = "acctest-capp-%[2]d" + resource_group_name = azurerm_resource_group.test.name + container_app_environment_id = azurerm_container_app_environment.test.id + revision_mode = "Multiple" + + template { + container { + name = "acctest-cont-%[2]d" + image = "jackofallops/azure-containerapps-python-acctest:v0.0.1" + + cpu = 0.5 + memory = "1Gi" + + readiness_probe { + transport = "HTTP" + port = 5000 + path = "/uptime" + timeout = 2 + failure_count_threshold = 1 + success_count_threshold = 1 + + header { + name = "Cache-Control" + value = "no-cache" + } + } + + liveness_probe { + transport = "HTTP" + port = 5000 + path = "/health" + + header { + name = "Cache-Control" + value = "no-cache" + } + + initial_delay = 5 + timeout = 2 + failure_count_threshold = 3 + } + + startup_probe { + transport = "TCP" + port = 5000 + timeout = 5 + failure_count_threshold = 1 + } + + volume_mounts { + name = azurerm_container_app_environment_storage.test.name + path = "/tmp/testdata" + } + } + + volume { + name = azurerm_container_app_environment_storage.test.name + storage_type = "AzureFile" + storage_name = azurerm_container_app_environment_storage.test.name + } + + min_replicas = 1 + max_replicas = 4 + + revision_suffix = "%[3]s" + } + + ingress { + allow_insecure_connections = true + external_enabled = true + target_port = 5000 + transport = "auto" + + traffic_weight { + latest_revision = true + percentage = 20 + } + + traffic_weight { + revision_suffix = "rev1" + percentage = 80 + } + } + + registry { + server = azurerm_container_registry.test.login_server + username = azurerm_container_registry.test.admin_username + password_secret_name = "registry-password" + } + + secret { + name = "registry-password" + value = azurerm_container_registry.test.admin_password + } + + secret { + name = "rick" + value = "morty" + } + + dapr { + app_id = "acctest-cont-%[2]d" + app_port = 5000 + app_protocol = "http" + } + + tags = { + foo = "Bar" + accTest = "1" + } +} +`, r.templatePlusExtras(data), data.RandomInteger, revisionSuffix) +} + +func (ContainerAppResource) template(data acceptance.TestData) string { + return ContainerAppEnvironmentResource{}.basic(data) +} + +func (ContainerAppResource) templateWithVnet(data acceptance.TestData) string { + return fmt.Sprintf(` +%s +resource "azurerm_container_registry" "test" { + name = "testacccr%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku = "Basic" + admin_enabled = true + + network_rule_set = [] +} + +resource "azurerm_storage_account" "test" { + name = "unlikely23exst2acct%[3]s" + resource_group_name = azurerm_resource_group.test.name + + location = azurerm_resource_group.test.location + account_tier = "Standard" + account_replication_type = "LRS" + + tags = { + environment = "production" + } +} + +resource "azurerm_storage_share" "test" { + name = "testshare%[3]s" + storage_account_name = azurerm_storage_account.test.name + quota = 1 +} + +resource "azurerm_container_app_environment_storage" "test" { + name = "testacc-caes-%[2]d" + container_app_environment_id = azurerm_container_app_environment.test.id + account_name = azurerm_storage_account.test.name + access_key = azurerm_storage_account.test.primary_access_key + share_name = azurerm_storage_share.test.name + access_mode = "ReadWrite" +} +`, ContainerAppEnvironmentResource{}.complete(data), data.RandomInteger, data.RandomString) +} + +func (ContainerAppResource) templatePlusExtras(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_container_registry" "test" { + name = "testacccr%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku = "Basic" + admin_enabled = true + + network_rule_set = [] +} + +resource "azurerm_storage_share" "test" { + name = "testshare%[3]s" + storage_account_name = azurerm_storage_account.test.name + quota = 1 +} + +resource "azurerm_container_app_environment_storage" "test" { + name = "testacc-caes-%[2]d" + container_app_environment_id = azurerm_container_app_environment.test.id + account_name = azurerm_storage_account.test.name + access_key = azurerm_storage_account.test.primary_access_key + share_name = azurerm_storage_share.test.name + access_mode = "ReadWrite" +} +`, ContainerAppEnvironmentDaprComponentResource{}.complete(data), data.RandomInteger, data.RandomString) +} diff --git a/internal/services/containerapps/helpers/container_apps.go b/internal/services/containerapps/helpers/container_apps.go new file mode 100644 index 000000000000..b103c43a6c38 --- /dev/null +++ b/internal/services/containerapps/helpers/container_apps.go @@ -0,0 +1,1815 @@ +package helpers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/containerapps/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type Registry struct { + PasswordSecretRef string `tfschema:"password_secret_name"` + Server string `tfschema:"server"` + UserName string `tfschema:"username"` + Identity string `tfschema:"identity"` +} + +func ContainerAppRegistrySchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + MinItems: 1, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "server": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The hostname for the Container Registry.", + }, + + "username": { + Type: pluginsdk.TypeString, + Optional: true, + Description: "The username to use for this Container Registry.", + }, + + "password_secret_name": { + Type: pluginsdk.TypeString, + Optional: true, + Description: "The name of the Secret Reference containing the password value for this user on the Container Registry.", + }, + + "identity": { + Type: pluginsdk.TypeString, + Optional: true, + Description: "ID of the System or User Managed Identity used to pull images from the Container Registry", + }, + }, + }, + } +} + +func ValidateContainerAppRegistry(r Registry) error { + if r.Identity != "" && (r.UserName != "" || r.PasswordSecretRef != "") { + return fmt.Errorf("identity and username/password_secret_name are mutually exclusive") + } + if r.Identity == "" && r.UserName == "" && r.PasswordSecretRef == "" { + return fmt.Errorf("must supply either identity or username/password_secret_name") + } + if (r.UserName != "" && r.PasswordSecretRef == "") || (r.UserName == "" && r.PasswordSecretRef != "") { + return fmt.Errorf("must supply both username and password_secret_name") + } + return nil +} + +func ExpandContainerAppRegistries(input []Registry) (*[]containerapps.RegistryCredentials, error) { + if input == nil { + return nil, nil + } + + registries := make([]containerapps.RegistryCredentials, 0) + for _, v := range input { + if err := ValidateContainerAppRegistry(v); err != nil { + return nil, err + } + registries = append(registries, containerapps.RegistryCredentials{ + Server: pointer.To(v.Server), + Username: pointer.To(v.UserName), + PasswordSecretRef: pointer.To(v.PasswordSecretRef), + Identity: pointer.To(v.Identity), + }) + } + + return ®istries, nil +} + +func FlattenContainerAppRegistries(input *[]containerapps.RegistryCredentials) []Registry { + if input == nil || len(*input) == 0 { + return []Registry{} + } + + result := make([]Registry, 0) + for _, v := range *input { + result = append(result, Registry{ + PasswordSecretRef: pointer.From(v.PasswordSecretRef), + Server: pointer.From(v.Server), + UserName: pointer.From(v.Username), + Identity: pointer.From(v.Identity), + }) + } + + return result +} + +type Ingress struct { + AllowInsecure bool `tfschema:"allow_insecure_connections"` + CustomDomains []CustomDomain `tfschema:"custom_domain"` + IsExternal bool `tfschema:"external_enabled"` + FQDN string `tfschema:"fqdn"` + TargetPort int `tfschema:"target_port"` + TrafficWeights []TrafficWeight `tfschema:"traffic_weight"` + Transport string `tfschema:"transport"` +} + +func ContainerAppIngressSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "allow_insecure_connections": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + Description: "Should this ingress allow insecure connections?", + }, + + "custom_domain": ContainerAppIngressCustomDomainSchema(), + + "external_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + Description: "Is this an external Ingress.", + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The FQDN of the ingress.", + }, + + "target_port": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1, 65535), + Description: "The target port on the container for the Ingress traffic.", + }, + + "traffic_weight": ContainerAppIngressTrafficWeight(), + + "transport": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(containerapps.IngressTransportMethodAuto), + ValidateFunc: validation.StringInSlice(containerapps.PossibleValuesForIngressTransportMethod(), false), + Description: "The transport method for the Ingress. Possible values include `auto`, `http`, and `http2`. Defaults to `auto`", + }, + }, + }, + } +} + +func ExpandContainerAppIngress(input []Ingress, appName string) *containerapps.Ingress { + if len(input) == 0 { + return nil + } + + ingress := input[0] + result := &containerapps.Ingress{ + AllowInsecure: pointer.To(ingress.AllowInsecure), + CustomDomains: expandContainerAppIngressCustomDomain(ingress.CustomDomains), + External: pointer.To(ingress.IsExternal), + Fqdn: pointer.To(ingress.FQDN), + TargetPort: pointer.To(int64(ingress.TargetPort)), + Traffic: expandContainerAppIngressTraffic(ingress.TrafficWeights, appName), + } + transport := containerapps.IngressTransportMethod(ingress.Transport) + result.Transport = &transport + + return result +} + +func FlattenContainerAppIngress(input *containerapps.Ingress, appName string) []Ingress { + if input == nil { + return []Ingress{} + } + + ingress := *input + result := Ingress{ + AllowInsecure: pointer.From(ingress.AllowInsecure), + CustomDomains: flattenContainerAppIngressCustomDomain(ingress.CustomDomains), + IsExternal: pointer.From(ingress.External), + FQDN: pointer.From(ingress.Fqdn), + TargetPort: int(pointer.From(ingress.TargetPort)), + TrafficWeights: flattenContainerAppIngressTraffic(ingress.Traffic, appName), + } + + if ingress.Transport != nil { + result.Transport = strings.ToLower(string(*ingress.Transport)) + } + + return []Ingress{result} +} + +type CustomDomain struct { + CertBinding string `tfschema:"certificate_binding_type"` + CertificateId string `tfschema:"certificate_id"` + Name string `tfschema:"name"` +} + +func ContainerAppIngressCustomDomainSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "certificate_binding_type": { + Type: pluginsdk.TypeString, + Optional: true, + Default: containerapps.BindingTypeDisabled, + ValidateFunc: validation.StringInSlice(containerapps.PossibleValuesForBindingType(), false), + Description: "The Binding type. Possible values include `Disabled` and `SniEnabled`. Defaults to `Disabled`", + }, + + "certificate_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: managedenvironments.ValidateCertificateID, + }, + + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The hostname of the Certificate. Must be the CN or a named SAN in the certificate.", + }, + }, + }, + } +} + +func expandContainerAppIngressCustomDomain(input []CustomDomain) *[]containerapps.CustomDomain { + if len(input) == 0 { + return nil + } + + result := make([]containerapps.CustomDomain, 0) + for _, v := range input { + customDomain := containerapps.CustomDomain{ + Name: v.Name, + CertificateId: pointer.To(v.CertificateId), + } + bindingType := containerapps.BindingType(v.CertBinding) + customDomain.BindingType = &bindingType + + result = append(result, customDomain) + } + + return &result +} + +func flattenContainerAppIngressCustomDomain(input *[]containerapps.CustomDomain) []CustomDomain { + if input == nil { + return []CustomDomain{} + } + + result := make([]CustomDomain, 0) + + for _, v := range *input { + customDomain := CustomDomain{ + Name: v.Name, + } + if v.BindingType != nil { + customDomain.CertBinding = string(*v.BindingType) + } + if v.CertificateId != nil { + customDomain.CertificateId = *v.CertificateId + } + result = append(result, customDomain) + } + + return result +} + +type TrafficWeight struct { + Label string `tfschema:"label"` + LatestRevision bool `tfschema:"latest_revision"` + RevisionSuffix string `tfschema:"revision_suffix"` + Weight int `tfschema:"percentage"` +} + +func ContainerAppIngressTrafficWeight() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Required: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "label": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The label to apply to the revision as a name prefix for routing traffic.", + }, + + "revision_suffix": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The suffix string to append to the revision. This must be unique for the Container App's lifetime. A default hash created by the service will be used if this value is omitted.", + }, + + "latest_revision": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + Description: "This traffic Weight relates to the latest stable Container Revision.", + }, + + "percentage": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(0, 100), + Description: "The percentage of traffic to send to this revision.", + }, + }, + }, + } +} + +func expandContainerAppIngressTraffic(input []TrafficWeight, appName string) *[]containerapps.TrafficWeight { + if len(input) == 0 { + return nil + } + + result := make([]containerapps.TrafficWeight, 0) + + for _, v := range input { + traffic := containerapps.TrafficWeight{ + LatestRevision: pointer.To(v.LatestRevision), + Weight: pointer.To(int64(v.Weight)), + } + + if !v.LatestRevision { + traffic.RevisionName = pointer.To(fmt.Sprintf("%s--%s", appName, v.RevisionSuffix)) + } + + if v.Label != "" { + traffic.Label = pointer.To(v.Label) + } + + result = append(result, traffic) + } + + return &result +} + +func flattenContainerAppIngressTraffic(input *[]containerapps.TrafficWeight, appName string) []TrafficWeight { + if input == nil { + return []TrafficWeight{} + } + + result := make([]TrafficWeight, 0) + for _, v := range *input { + prefix := fmt.Sprintf("%s--", appName) + result = append(result, TrafficWeight{ + Label: pointer.From(v.Label), + LatestRevision: pointer.From(v.LatestRevision), + RevisionSuffix: strings.TrimPrefix(pointer.From(v.RevisionName), prefix), + Weight: int(pointer.From(v.Weight)), + }) + } + + return result +} + +type Dapr struct { + AppId string `tfschema:"app_id"` + AppPort int `tfschema:"app_port"` + AppProtocol string `tfschema:"app_protocol"` +} + +func ContainerDaprSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + MaxItems: 1, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "app_id": { + Type: pluginsdk.TypeString, + Required: true, + Description: "The Dapr Application Identifier.", + }, + + "app_port": { + Type: pluginsdk.TypeInt, + Required: true, + Description: "The port which the application is listening on. This is the same as the `ingress` port.", + }, + + "app_protocol": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(containerapps.AppProtocolHTTP), + ValidateFunc: validation.StringInSlice([]string{ + string(containerapps.AppProtocolHTTP), + string(containerapps.AppProtocolGrpc), + }, false), + Description: "The protocol for the app. Possible values include `http` and `grpc`. Defaults to `http`.", + }, + }, + }, + } +} + +func ExpandContainerAppDapr(input []Dapr) *containerapps.Dapr { + if len(input) == 0 { + return nil + } + + dapr := input[0] + if dapr.AppId == "" { + return &containerapps.Dapr{ + Enabled: pointer.To(false), + } + } + + appProtocol := containerapps.AppProtocol(dapr.AppProtocol) + + return &containerapps.Dapr{ + AppId: pointer.To(dapr.AppId), + AppPort: pointer.To(int64(dapr.AppPort)), + AppProtocol: &appProtocol, + Enabled: pointer.To(true), + } +} + +func FlattenContainerAppDapr(input *containerapps.Dapr) []Dapr { + if input == nil { + return []Dapr{} + } + + result := Dapr{ + AppId: pointer.From(input.AppId), + AppPort: int(pointer.From(input.AppPort)), + } + if appProtocol := input.AppProtocol; appProtocol != nil { + result.AppProtocol = string(*appProtocol) + } + + return []Dapr{result} +} + +type DaprMetadata struct { + Name string `tfschema:"name"` + Value string `tfschema:"value"` + SecretName string `tfschema:"secret_name"` +} + +func ContainerAppEnvironmentDaprMetadataSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + MinItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The name of the Metadata configuration item.", + }, + + "value": { + Type: pluginsdk.TypeString, + Optional: true, + Description: "The value for this metadata configuration item.", + }, + + "secret_name": { + Type: pluginsdk.TypeString, + Optional: true, + Description: "The name of a secret specified in the `secrets` block that contains the value for this metadata configuration item.", + }, + }, + }, + } +} + +func ContainerAppEnvironmentDaprMetadataDataSourceSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The name of the Metadata configuration item.", + }, + + "value": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The value for this metadata configuration item.", + }, + + "secret_name": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The name of a secret specified in the `secrets` block that contains the value for this metadata configuration item.", + }, + }, + }, + } +} + +type ContainerTemplate struct { + Containers []Container `tfschema:"container"` + Suffix string `tfschema:"revision_suffix"` + MinReplicas int `tfschema:"min_replicas"` + MaxReplicas int `tfschema:"max_replicas"` + Volumes []ContainerVolume `tfschema:"volume"` +} + +func ContainerTemplateSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + MaxItems: 1, + Required: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "container": ContainerAppContainerSchema(), + + "min_replicas": { + Type: pluginsdk.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(0, 30), + Description: "The minimum number of replicas for this container.", + }, + + "max_replicas": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 10, + ValidateFunc: validation.IntBetween(1, 30), + Description: "The maximum number of replicas for this container.", + }, + + "volume": ContainerVolumeSchema(), + + "revision_suffix": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + Description: "The suffix for the revision. This value must be unique for the lifetime of the Resource. If omitted the service will use a hash function to create one.", + }, + }, + }, + } +} + +func ExpandContainerAppTemplate(input []ContainerTemplate, metadata sdk.ResourceMetaData) *containerapps.Template { + if len(input) != 1 { + return nil + } + + config := input[0] + template := &containerapps.Template{ + Containers: expandContainerAppContainers(config.Containers), + Volumes: expandContainerAppVolumes(config.Volumes), + } + + if config.MaxReplicas != 0 { + if template.Scale == nil { + template.Scale = &containerapps.Scale{} + } + template.Scale.MaxReplicas = pointer.To(int64(config.MaxReplicas)) + } + + if config.MinReplicas != 0 { + if template.Scale == nil { + template.Scale = &containerapps.Scale{} + } + template.Scale.MinReplicas = pointer.To(int64(config.MinReplicas)) + } + + if config.Suffix != "" { + if metadata.ResourceData.HasChange("template.0.revision_suffix") { + template.RevisionSuffix = pointer.To(config.Suffix) + } + } + + return template +} + +func FlattenContainerAppTemplate(input *containerapps.Template) []ContainerTemplate { + if input == nil { + return []ContainerTemplate{} + } + result := ContainerTemplate{ + Containers: flattenContainerAppContainers(input.Containers), + Suffix: pointer.From(input.RevisionSuffix), + Volumes: flattenContainerAppVolumes(input.Volumes), + } + + if scale := input.Scale; scale != nil { + result.MaxReplicas = int(pointer.From(scale.MaxReplicas)) + result.MinReplicas = int(pointer.From(scale.MinReplicas)) + } + + return []ContainerTemplate{result} +} + +type Container struct { + Name string `tfschema:"name"` + Image string `tfschema:"image"` + CPU float64 `tfschema:"cpu"` + Memory string `tfschema:"memory"` + EphemeralStorage string `tfschema:"ephemeral_storage"` + Env []ContainerEnvVar `tfschema:"env"` + Args []string `tfschema:"args"` + Command []string `tfschema:"command"` + LivenessProbe []ContainerAppLivenessProbe `tfschema:"liveness_probe"` + ReadinessProbe []ContainerAppReadinessProbe `tfschema:"readiness_probe"` + StartupProbe []ContainerAppStartupProbe `tfschema:"startup_probe"` + VolumeMounts []ContainerVolumeMount `tfschema:"volume_mounts"` +} + +func ContainerAppContainerSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Required: true, + MinItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.ContainerAppContainerName, + Description: "The name of the container.", + }, + + "image": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The image to use to create the container.", + }, + + "cpu": { + Type: pluginsdk.TypeFloat, + Required: true, + ValidateFunc: validate.ContainerCpu, + Description: "The amount of vCPU to allocate to the container. Possible values include `0.25`, `0.5`, `0.75`, `1.0`, `1.25`, `1.5`, `1.75`, and `2.0`. **NOTE:** `cpu` and `memory` must be specified in `0.25'/'0.5Gi` combination increments. e.g. `1.0` / `2.0` or `0.5` / `1.0`", + }, + + "memory": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + "0.5Gi", + "1Gi", + "1.5Gi", + "2Gi", + "2.5Gi", + "3Gi", + "3.5Gi", + "4Gi", + }, false), + Description: "The amount of memory to allocate to the container. Possible values include `0.5Gi`, `1.0Gi`, `1.5Gi`, `2.0Gi`, `2.5Gi`, `3.0Gi`, `3.5Gi`, and `4.0Gi`. **NOTE:** `cpu` and `memory` must be specified in `0.25'/'0.5Gi` combination increments. e.g. `1.25` / `2.5Gi` or `0.75` / `1.5Gi`", + }, + + "ephemeral_storage": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The amount of ephemeral storage available to the Container App.", + }, + + "env": ContainerEnvVarSchema(), + + "args": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + Description: "A list of args to pass to the container.", + }, + + "command": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + Description: "A command to pass to the container to override the default. This is provided as a list of command line elements without spaces.", + }, + + "liveness_probe": ContainerAppLivenessProbeSchema(), + + "readiness_probe": ContainerAppReadinessProbeSchema(), + + "startup_probe": ContainerAppStartupProbeSchema(), + + "volume_mounts": ContainerVolumeMountSchema(), + }, + }, + } +} + +func expandContainerAppContainers(input []Container) *[]containerapps.Container { + if input == nil { + return nil + } + + result := make([]containerapps.Container, 0) + for _, v := range input { + container := containerapps.Container{ + Env: expandContainerEnvVar(v), + Image: pointer.To(v.Image), + Name: pointer.To(v.Name), + Probes: expandContainerProbes(v), + Resources: &containerapps.ContainerResources{ + Cpu: pointer.To(v.CPU), + EphemeralStorage: pointer.To(v.EphemeralStorage), + Memory: pointer.To(v.Memory), + }, + VolumeMounts: expandContainerVolumeMounts(v.VolumeMounts), + } + if len(v.Args) != 0 { + container.Args = &v.Args + } + if len(v.Command) != 0 { + container.Command = &v.Command + } + + result = append(result, container) + } + + return &result +} + +func flattenContainerAppContainers(input *[]containerapps.Container) []Container { + if input == nil || len(*input) == 0 { + return []Container{} + } + result := make([]Container, 0) + for _, v := range *input { + container := Container{ + Name: pointer.From(v.Name), + Image: pointer.From(v.Image), + Args: pointer.From(v.Args), + Command: pointer.From(v.Command), + Env: flattenContainerEnvVar(v.Env), + VolumeMounts: flattenContainerVolumeMounts(v.VolumeMounts), + } + if v.Probes != nil { + for _, p := range *v.Probes { + switch *p.Type { + case containerapps.TypeLiveness: + container.LivenessProbe = flattenContainerAppLivenessProbe(p) + case containerapps.TypeReadiness: + container.ReadinessProbe = flattenContainerAppReadinessProbe(p) + case containerapps.TypeStartup: + container.StartupProbe = flattenContainerAppStartupProbe(p) + } + } + } + + if resources := v.Resources; resources != nil { + container.CPU = pointer.From(resources.Cpu) + container.Memory = pointer.From(resources.Memory) + container.EphemeralStorage = pointer.From(resources.EphemeralStorage) + } + + result = append(result, container) + } + return result +} + +type ContainerVolume struct { + Name string `tfschema:"name"` + StorageName string `tfschema:"storage_name"` + StorageType string `tfschema:"storage_type"` +} + +func ContainerVolumeSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + MinItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The name of the volume.", + }, + + "storage_type": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "EmptyDir", + ValidateFunc: validation.StringInSlice([]string{ + "EmptyDir", + "AzureFile", + }, false), + Description: "The type of storage volume. Possible values include `AzureFile` and `EmptyDir`. Defaults to `EmptyDir`.", + }, + + "storage_name": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validate.ManagedEnvironmentStorageName, + Description: "The name of the `AzureFile` storage. Required when `storage_type` is `AzureFile`", + }, + }, + }, + } +} + +func expandContainerAppVolumes(input []ContainerVolume) *[]containerapps.Volume { + if input == nil { + return nil + } + + volumes := make([]containerapps.Volume, 0) + + for _, v := range input { + volume := containerapps.Volume{ + Name: pointer.To(v.Name), + StorageName: pointer.To(v.StorageName), + } + if v.StorageType != "" { + storageType := containerapps.StorageType(v.StorageType) + volume.StorageType = &storageType + } + volumes = append(volumes, volume) + } + + return &volumes +} + +func flattenContainerAppVolumes(input *[]containerapps.Volume) []ContainerVolume { + if input == nil || len(*input) == 0 { + return []ContainerVolume{} + } + + result := make([]ContainerVolume, 0) + for _, v := range *input { + containerVolume := ContainerVolume{ + Name: pointer.From(v.Name), + StorageName: pointer.From(v.StorageName), + } + if v.StorageType != nil { + containerVolume.StorageType = string(*v.StorageType) + } + + result = append(result, containerVolume) + } + + return result +} + +type ContainerVolumeMount struct { + Name string `tfschema:"name"` + Path string `tfschema:"path"` +} + +func ContainerVolumeMountSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The name of the Volume to be mounted in the container.", + }, + + "path": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The path in the container at which to mount this volume.", + }, + }, + }, + } +} + +func expandContainerVolumeMounts(input []ContainerVolumeMount) *[]containerapps.VolumeMount { + if input == nil { + return nil + } + + volumeMounts := make([]containerapps.VolumeMount, 0) + for _, v := range input { + volumeMounts = append(volumeMounts, containerapps.VolumeMount{ + MountPath: pointer.To(v.Path), + VolumeName: pointer.To(v.Name), + }) + } + + return &volumeMounts +} + +func flattenContainerVolumeMounts(input *[]containerapps.VolumeMount) []ContainerVolumeMount { + if input == nil || len(*input) == 0 { + return []ContainerVolumeMount{} + } + + result := make([]ContainerVolumeMount, 0) + for _, v := range *input { + result = append(result, ContainerVolumeMount{ + Name: pointer.From(v.VolumeName), + Path: pointer.From(v.MountPath), + }) + } + + return result +} + +type ContainerEnvVar struct { + Name string `tfschema:"name"` + Value string `tfschema:"value"` + SecretReference string `tfschema:"secret_name"` +} + +func ContainerEnvVarSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + MinItems: 1, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The name of the environment variable for the container.", + }, + + "value": { + Type: pluginsdk.TypeString, + Optional: true, + Description: "The value for this environment variable. **NOTE:** This value is ignored if `secret_name` is used", + }, + + "secret_name": { + Type: pluginsdk.TypeString, + Optional: true, + Description: "The name of the secret that contains the value for this environment variable.", + }, + }, + }, + } +} + +func expandContainerEnvVar(input Container) *[]containerapps.EnvironmentVar { + envs := make([]containerapps.EnvironmentVar, 0) + if input.Env == nil || len(input.Env) == 0 { + return &envs + } + + for _, v := range input.Env { + env := containerapps.EnvironmentVar{ + Name: pointer.To(v.Name), + } + if v.SecretReference != "" { + env.SecretRef = pointer.To(v.SecretReference) + } else { + env.Value = pointer.To(v.Value) + } + + envs = append(envs, env) + } + + return &envs +} + +func flattenContainerEnvVar(input *[]containerapps.EnvironmentVar) []ContainerEnvVar { + if input == nil || len(*input) == 0 { + return []ContainerEnvVar{} + } + + result := make([]ContainerEnvVar, 0) + + for _, v := range *input { + result = append(result, ContainerEnvVar{ + Name: pointer.From(v.Name), + SecretReference: pointer.From(v.SecretRef), + Value: pointer.From(v.Value), + }) + } + + return result +} + +type ContainerAppReadinessProbe struct { + Transport string `tfschema:"transport"` + Host string `tfschema:"host"` + Port int `tfschema:"port"` + Path string `tfschema:"path"` + Headers []HttpHeader `tfschema:"header"` + Interval int `tfschema:"interval_seconds"` + Timeout int `tfschema:"timeout"` + FailureThreshold int `tfschema:"failure_count_threshold"` + SuccessThreshold int `tfschema:"success_count_threshold"` +} + +func ContainerAppReadinessProbeSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + MinItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "transport": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + "TCP", + string(containerapps.SchemeHTTP), + string(containerapps.SchemeHTTPS), + }, true), + Description: "Type of probe. Possible values are `TCP`, `HTTP`, and `HTTPS`.", + }, + + "port": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1, 65535), + Description: "The port number on which to connect. Possible values are between `1` and `65535`.", + }, + + "host": { + Type: pluginsdk.TypeString, + Optional: true, + Description: "The probe hostname. Defaults to the pod IP address. Setting a value for `Host` in `headers` can be used to override this for `http` and `https` type probes.", + }, + + "path": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + Description: "The URI to use for http type probes. Not valid for `TCP` type probes. Defaults to `/`.", + }, + + "header": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The HTTP Header Name.", + }, + + "value": { + Type: pluginsdk.TypeString, + Required: true, + Description: "The HTTP Header value.", + }, + }, + }, + }, + + "interval_seconds": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 10, + ValidateFunc: validation.IntBetween(1, 240), + Description: "How often, in seconds, the probe should run. Possible values are between `1` and `240`. Defaults to `10`", + }, + + "timeout": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 1, + ValidateFunc: validation.IntBetween(1, 240), + Description: "Time in seconds after which the probe times out. Possible values are between `1` an `240`. Defaults to `1`.", + }, + + "failure_count_threshold": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 3, + ValidateFunc: validation.IntBetween(1, 10), + Description: "The number of consecutive failures required to consider this probe as failed. Possible values are between `1` and `10`. Defaults to `3`.", + }, + + "success_count_threshold": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 3, + ValidateFunc: validation.IntBetween(1, 10), + Description: "The number of consecutive successful responses required to consider this probe as successful. Possible values are between `1` and `10`. Defaults to `3`.", + }, + }, + }, + } +} + +func expandContainerAppReadinessProbe(input ContainerAppReadinessProbe) containerapps.ContainerAppProbe { + probeType := containerapps.TypeReadiness + result := containerapps.ContainerAppProbe{ + Type: &probeType, + PeriodSeconds: pointer.To(int64(input.Interval)), + TimeoutSeconds: pointer.To(int64(input.Timeout)), + FailureThreshold: pointer.To(int64(input.FailureThreshold)), + SuccessThreshold: pointer.To(int64(input.SuccessThreshold)), + } + + switch p := strings.ToUpper(input.Transport); p { + case "HTTP", "HTTPS": + scheme := containerapps.Scheme(p) + result.HTTPGet = &containerapps.ContainerAppProbeHTTPGet{ + Host: pointer.To(input.Host), + Path: pointer.To(input.Path), + Port: int64(input.Port), + Scheme: &scheme, + } + if input.Headers != nil { + headers := make([]containerapps.ContainerAppProbeHTTPGetHTTPHeadersInlined, 0) + + for _, h := range input.Headers { + headers = append(headers, containerapps.ContainerAppProbeHTTPGetHTTPHeadersInlined{ + Name: h.Name, + Value: h.Value, + }) + } + result.HTTPGet.HTTPHeaders = &headers + } + + default: + result.TcpSocket = &containerapps.ContainerAppProbeTcpSocket{ + Host: pointer.To(input.Host), + Port: int64(input.Port), + } + } + + return result +} + +func flattenContainerAppReadinessProbe(input containerapps.ContainerAppProbe) []ContainerAppReadinessProbe { + result := make([]ContainerAppReadinessProbe, 0) + probe := ContainerAppReadinessProbe{ + Interval: int(pointer.From(input.PeriodSeconds)), + Timeout: int(pointer.From(input.TimeoutSeconds)), + FailureThreshold: int(pointer.From(input.FailureThreshold)), + SuccessThreshold: int(pointer.From(input.SuccessThreshold)), + } + + if httpGet := input.HTTPGet; httpGet != nil { + if httpGet.Scheme != nil { + probe.Transport = string(*httpGet.Scheme) + } + probe.Host = pointer.From(httpGet.Host) + probe.Port = int(httpGet.Port) + probe.Path = pointer.From(httpGet.Path) + + if httpGet.HTTPHeaders != nil { + headers := make([]HttpHeader, 0) + for _, h := range *httpGet.HTTPHeaders { + headers = append(headers, HttpHeader{ + Name: h.Name, + Value: h.Value, + }) + } + probe.Headers = headers + } + } + + if tcpSocket := input.TcpSocket; tcpSocket != nil { + probe.Transport = "TCP" + probe.Host = pointer.From(tcpSocket.Host) + probe.Port = int(tcpSocket.Port) + } + + result = append(result, probe) + + return result +} + +type ContainerAppLivenessProbe struct { + Transport string `tfschema:"transport"` + Host string `tfschema:"host"` + Port int `tfschema:"port"` + Path string `tfschema:"path"` + Headers []HttpHeader `tfschema:"header"` + InitialDelay int `tfschema:"initial_delay"` + Interval int `tfschema:"interval_seconds"` + Timeout int `tfschema:"timeout"` + FailureThreshold int `tfschema:"failure_count_threshold"` + TerminationGracePeriod int `tfschema:"termination_grace_period_seconds"` +} + +func ContainerAppLivenessProbeSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + MinItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "transport": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + "TCP", + string(containerapps.SchemeHTTP), + string(containerapps.SchemeHTTPS), + }, false), + Description: "Type of probe. Possible values are `TCP`, `HTTP`, and `HTTPS`.", + }, + + "port": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1, 65535), + Description: "The port number on which to connect. Possible values are between `1` and `65535`.", + }, + + "host": { + Type: pluginsdk.TypeString, + Optional: true, + Description: "The probe hostname. Defaults to the pod IP address. Setting a value for `Host` in `headers` can be used to override this for `http` and `https` type probes.", + }, + + "path": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + Description: "The URI to use with the `host` for http type probes. Not valid for `TCP` type probes. Defaults to `/`.", + }, + + "header": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The HTTP Header Name.", + }, + + "value": { + Type: pluginsdk.TypeString, + Required: true, + Description: "The HTTP Header value.", + }, + }, + }, + }, + + "initial_delay": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 1, + ValidateFunc: validation.IntBetween(1, 60), + Description: "The time in seconds to wait after the container has started before the probe is started.", + }, + + "interval_seconds": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 10, + ValidateFunc: validation.IntBetween(1, 240), + Description: "How often, in seconds, the probe should run. Possible values are between `1` and `240`. Defaults to `10`", + }, + + "timeout": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 1, + ValidateFunc: validation.IntBetween(1, 240), + Description: "Time in seconds after which the probe times out. Possible values are between `1` an `240`. Defaults to `1`.", + }, + + "failure_count_threshold": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 3, + ValidateFunc: validation.IntBetween(1, 10), + Description: "The number of consecutive failures required to consider this probe as failed. Possible values are between `1` and `10`. Defaults to `3`.", + }, + + "termination_grace_period_seconds": { + Type: pluginsdk.TypeInt, + Computed: true, + Description: "The time in seconds after the container is sent the termination signal before the process if forcibly killed.", + }, + }, + }, + } +} + +func expandContainerAppLivenessProbe(input ContainerAppLivenessProbe) containerapps.ContainerAppProbe { + probeType := containerapps.TypeLiveness + result := containerapps.ContainerAppProbe{ + Type: &probeType, + InitialDelaySeconds: pointer.To(int64(input.InitialDelay)), + PeriodSeconds: pointer.To(int64(input.Interval)), + TimeoutSeconds: pointer.To(int64(input.Timeout)), + FailureThreshold: pointer.To(int64(input.FailureThreshold)), + } + + switch p := strings.ToUpper(input.Transport); p { + case "HTTP", "HTTPS": + scheme := containerapps.Scheme(p) + result.HTTPGet = &containerapps.ContainerAppProbeHTTPGet{ + Host: pointer.To(input.Host), + Path: pointer.To(input.Path), + Port: int64(input.Port), + Scheme: &scheme, + } + if input.Headers != nil { + headers := make([]containerapps.ContainerAppProbeHTTPGetHTTPHeadersInlined, 0) + + for _, h := range input.Headers { + headers = append(headers, containerapps.ContainerAppProbeHTTPGetHTTPHeadersInlined{ + Name: h.Name, + Value: h.Value, + }) + } + result.HTTPGet.HTTPHeaders = &headers + } + + default: + result.TcpSocket = &containerapps.ContainerAppProbeTcpSocket{ + Host: pointer.To(input.Host), + Port: int64(input.Port), + } + } + + return result +} + +func flattenContainerAppLivenessProbe(input containerapps.ContainerAppProbe) []ContainerAppLivenessProbe { + result := make([]ContainerAppLivenessProbe, 0) + probe := ContainerAppLivenessProbe{ + InitialDelay: int(pointer.From(input.InitialDelaySeconds)), + Interval: int(pointer.From(input.PeriodSeconds)), + Timeout: int(pointer.From(input.TimeoutSeconds)), + FailureThreshold: int(pointer.From(input.FailureThreshold)), + TerminationGracePeriod: int(pointer.From(input.TerminationGracePeriodSeconds)), + } + if httpGet := input.HTTPGet; httpGet != nil { + if httpGet.Scheme != nil { + probe.Transport = string(*httpGet.Scheme) + } + probe.Host = pointer.From(httpGet.Host) + probe.Port = int(httpGet.Port) + probe.Path = pointer.From(httpGet.Path) + + if httpGet.HTTPHeaders != nil { + headers := make([]HttpHeader, 0) + for _, h := range *httpGet.HTTPHeaders { + headers = append(headers, HttpHeader{ + Name: h.Name, + Value: h.Value, + }) + } + probe.Headers = headers + } + } + + if tcpSocket := input.TcpSocket; tcpSocket != nil { + probe.Transport = "TCP" + probe.Host = pointer.From(tcpSocket.Host) + probe.Port = int(tcpSocket.Port) + } + + result = append(result, probe) + + return result +} + +type ContainerAppStartupProbe struct { + Transport string `tfschema:"transport"` + Host string `tfschema:"host"` + Port int `tfschema:"port"` + Path string `tfschema:"path"` + Headers []HttpHeader `tfschema:"header"` + Interval int `tfschema:"interval_seconds"` + Timeout int `tfschema:"timeout"` + FailureThreshold int `tfschema:"failure_count_threshold"` + TerminationGracePeriod int `tfschema:"termination_grace_period_seconds"` +} + +func ContainerAppStartupProbeSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + MinItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "transport": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + "TCP", + string(containerapps.SchemeHTTP), + string(containerapps.SchemeHTTPS), + }, false), + Description: "Type of probe. Possible values are `TCP`, `HTTP`, and `HTTPS`.", + }, + + "port": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1, 65535), + Description: "The port number on which to connect. Possible values are between `1` and `65535`.", + }, + + "host": { + Type: pluginsdk.TypeString, + Optional: true, + Description: "The probe hostname. Defaults to the pod IP address. Setting a value for `Host` in `headers` can be used to override this for `http` and `https` type probes.", + }, + + "path": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + Description: "The URI to use with the `host` for http type probes. Not valid for `TCP` type probes. Defaults to `/`.", + }, + + "header": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The HTTP Header Name.", + }, + + "value": { + Type: pluginsdk.TypeString, + Required: true, + Description: "The HTTP Header value.", + }, + }, + }, + }, + + "interval_seconds": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 10, + ValidateFunc: validation.IntBetween(1, 240), + Description: "How often, in seconds, the probe should run. Possible values are between `1` and `240`. Defaults to `10`", + }, + + "timeout": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 1, + ValidateFunc: validation.IntBetween(1, 240), + Description: "Time in seconds after which the probe times out. Possible values are between `1` an `240`. Defaults to `1`.", + }, + + "failure_count_threshold": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 3, + ValidateFunc: validation.IntBetween(1, 10), + Description: "The number of consecutive failures required to consider this probe as failed. Possible values are between `1` and `10`. Defaults to `3`.", + }, + + "termination_grace_period_seconds": { + Type: pluginsdk.TypeInt, + Computed: true, + Description: "The time in seconds after the container is sent the termination signal before the process if forcibly killed.", + }, + }, + }, + } +} + +func expandContainerAppStartupProbe(input ContainerAppStartupProbe) containerapps.ContainerAppProbe { + probeType := containerapps.TypeStartup + result := containerapps.ContainerAppProbe{ + Type: &probeType, + PeriodSeconds: pointer.To(int64(input.Interval)), + TimeoutSeconds: pointer.To(int64(input.Timeout)), + FailureThreshold: pointer.To(int64(input.FailureThreshold)), + } + + switch p := strings.ToUpper(input.Transport); p { + case "HTTP", "HTTPS": + scheme := containerapps.Scheme(p) + result.HTTPGet = &containerapps.ContainerAppProbeHTTPGet{ + Host: pointer.To(input.Host), + Path: pointer.To(input.Path), + Port: int64(input.Port), + Scheme: &scheme, + } + if input.Headers != nil { + headers := make([]containerapps.ContainerAppProbeHTTPGetHTTPHeadersInlined, 0) + + for _, h := range input.Headers { + headers = append(headers, containerapps.ContainerAppProbeHTTPGetHTTPHeadersInlined{ + Name: h.Name, + Value: h.Value, + }) + } + result.HTTPGet.HTTPHeaders = &headers + } + + default: + result.TcpSocket = &containerapps.ContainerAppProbeTcpSocket{ + Host: pointer.To(input.Host), + Port: int64(input.Port), + } + } + + return result +} + +func flattenContainerAppStartupProbe(input containerapps.ContainerAppProbe) []ContainerAppStartupProbe { + result := make([]ContainerAppStartupProbe, 0) + probe := ContainerAppStartupProbe{ + Interval: int(pointer.From(input.PeriodSeconds)), + Timeout: int(pointer.From(input.TimeoutSeconds)), + FailureThreshold: int(pointer.From(input.FailureThreshold)), + TerminationGracePeriod: int(pointer.From(input.TerminationGracePeriodSeconds)), + } + + if httpGet := input.HTTPGet; httpGet != nil { + if httpGet.Scheme != nil { + probe.Transport = string(*httpGet.Scheme) + } + probe.Host = pointer.From(httpGet.Host) + probe.Port = int(httpGet.Port) + probe.Path = pointer.From(httpGet.Path) + + if httpGet.HTTPHeaders != nil { + headers := make([]HttpHeader, 0) + for _, h := range *httpGet.HTTPHeaders { + headers = append(headers, HttpHeader{ + Name: h.Name, + Value: h.Value, + }) + } + probe.Headers = headers + } + } + + if tcpSocket := input.TcpSocket; tcpSocket != nil { + probe.Transport = "TCP" + probe.Host = pointer.From(tcpSocket.Host) + probe.Port = int(tcpSocket.Port) + } + + result = append(result, probe) + + return result +} + +type HttpHeader struct { + Name string `tfschema:"name"` + Value string `tfschema:"value"` +} + +func expandContainerProbes(input Container) *[]containerapps.ContainerAppProbe { + probes := make([]containerapps.ContainerAppProbe, 0) + + if len(input.LivenessProbe) == 1 { + probes = append(probes, expandContainerAppLivenessProbe(input.LivenessProbe[0])) + } + + if len(input.ReadinessProbe) == 1 { + probes = append(probes, expandContainerAppReadinessProbe(input.ReadinessProbe[0])) + } + + if len(input.StartupProbe) == 1 { + probes = append(probes, expandContainerAppStartupProbe(input.StartupProbe[0])) + } + + return &probes +} + +type Secret struct { + Name string `tfschema:"name"` + Value string `tfschema:"value"` +} + +func SecretsSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeSet, + Optional: true, + Sensitive: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.SecretName, + Sensitive: true, + Description: "The Secret name.", + }, + + "value": { + Type: pluginsdk.TypeString, + Required: true, + Sensitive: true, + Description: "The value for this secret.", + }, + }, + }, + } +} + +func SecretsDataSourceSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Computed: true, + Sensitive: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Computed: true, + Description: "The Secret name.", + }, + + "value": { + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, + Description: "The value for this secret.", + }, + }, + }, + } +} + +func ExpandContainerSecrets(input []Secret) *[]containerapps.Secret { + if len(input) == 0 { + return nil + } + + result := make([]containerapps.Secret, 0) + + for _, v := range input { + result = append(result, containerapps.Secret{ + Name: pointer.To(v.Name), + Value: pointer.To(v.Value), + }) + } + + return &result +} + +func ExpandFormerContainerSecrets(metadata sdk.ResourceMetaData) *[]containerapps.Secret { + secretsRaw, _ := metadata.ResourceData.GetChange("secret") + result := make([]containerapps.Secret, 0) + if secrets, ok := secretsRaw.([]interface{}); ok { + + for _, secret := range secrets { + if v, ok := secret.(map[string]interface{}); ok { + result = append(result, containerapps.Secret{ + Name: pointer.To(v["name"].(string)), + Value: pointer.To(v["value"].(string)), + }) + } + } + } + + return &result +} + +func UnpackContainerSecretsCollection(input *containerapps.SecretsCollection) *[]containerapps.Secret { + if input == nil || len(input.Value) == 0 { + return nil + } + + result := make([]containerapps.Secret, 0) + for _, v := range input.Value { + result = append(result, containerapps.Secret(v)) + } + + return &result +} + +func UnpackContainerDaprSecretsCollection(input *daprcomponents.DaprSecretsCollection) *[]daprcomponents.Secret { + if input == nil || len(input.Value) == 0 { + return nil + } + + result := make([]daprcomponents.Secret, 0) + for _, v := range input.Value { + result = append(result, daprcomponents.Secret(v)) + } + + return &result +} + +func ExpandDaprSecrets(input []Secret) *[]daprcomponents.Secret { + if len(input) == 0 { + return nil + } + + result := make([]daprcomponents.Secret, 0) + + for _, v := range input { + result = append(result, daprcomponents.Secret{ + Name: pointer.To(v.Name), + Value: pointer.To(v.Value), + }) + } + + return &result +} + +func FlattenSecrets(input []interface{}) []Secret { + secrets := make([]Secret, 0) + for _, s := range input { + secret := s.(map[string]interface{}) + name, ok := secret["name"].(string) + if !ok { + continue + } + value := "" + if val, ok := secret["value"].(string); ok { + value = val + } + secrets = append(secrets, Secret{ + Name: name, + Value: value, + }) + } + + return secrets +} + +func FlattenContainerAppSecrets(input *containerapps.SecretsCollection) []Secret { + if input == nil || input.Value == nil { + return []Secret{} + } + result := make([]Secret, 0) + for _, v := range input.Value { + result = append(result, Secret{ + Name: pointer.From(v.Name), + Value: pointer.From(v.Value), + }) + } + + return result +} + +func FlattenContainerAppDaprSecrets(input *daprcomponents.DaprSecretsCollection) []Secret { + if input == nil || input.Value == nil { + return []Secret{} + } + result := make([]Secret, 0) + for _, v := range input.Value { + result = append(result, Secret{ + Name: pointer.From(v.Name), + Value: pointer.From(v.Value), + }) + } + + return result +} + +func ContainerAppProbesRemoved(metadata sdk.ResourceMetaData) bool { + var hasLiveness, hasReadiness, hasStartup bool + + if metadata.ResourceData.HasChange("template.0.container.0.liveness_probe") { + _, newLivenessRaw := metadata.ResourceData.GetChange("template.0.container.0.liveness_probe") + if newLiveness, ok := newLivenessRaw.([]interface{}); ok && len(newLiveness) > 0 { + hasLiveness = true + } + } + + if metadata.ResourceData.HasChange("template.0.container.0.readiness_probe") { + _, newReadinessRaw := metadata.ResourceData.GetChange("template.0.container.0.readiness_probe") + if newReadiness, ok := newReadinessRaw.([]interface{}); ok && len(newReadiness) > 0 { + hasReadiness = true + } + } + + if metadata.ResourceData.HasChange("template.0.container.0.startup_probe") { + _, newStartupRaw := metadata.ResourceData.GetChange("template.0.container.0.startup_probe") + if newStartup, ok := newStartupRaw.([]interface{}); ok && len(newStartup) > 0 { + hasStartup = true + } + } + + return !(hasLiveness || hasReadiness || hasStartup) +} diff --git a/internal/services/containerapps/helpers/container_apps_test.go b/internal/services/containerapps/helpers/container_apps_test.go new file mode 100644 index 000000000000..787ca1958a97 --- /dev/null +++ b/internal/services/containerapps/helpers/container_apps_test.go @@ -0,0 +1,66 @@ +package helpers + +import ( + "testing" +) + +func TestValidateContainerAppRegistry(t *testing.T) { + cases := []struct { + Input Registry + Valid bool + }{ + { + Input: Registry{ + Server: "registry.example.com", + UserName: "user", + PasswordSecretRef: "secretref", + }, + Valid: true, + }, + { + Input: Registry{ + Server: "registry.example.com", + Identity: "identity", + }, + Valid: true, + }, + { + Input: Registry{ + Server: "registry.example.com", + }, + Valid: false, + }, + { + Input: Registry{ + Server: "registry.example.com", + UserName: "user", + PasswordSecretRef: "secretref", + Identity: "identity", + }, + Valid: false, + }, + { + Input: Registry{ + Server: "registry.example.com", + PasswordSecretRef: "secretref", + }, + Valid: false, + }, + { + Input: Registry{ + Server: "registry.example.com", + UserName: "user", + }, + Valid: false, + }, + } + + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + err := ValidateContainerAppRegistry(tc.Input) + valid := err == nil + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t for %s", tc.Valid, valid, tc.Input) + } + } +} diff --git a/internal/services/containerapps/registration.go b/internal/services/containerapps/registration.go new file mode 100644 index 000000000000..5a0ddc02f7ac --- /dev/null +++ b/internal/services/containerapps/registration.go @@ -0,0 +1,36 @@ +package containerapps + +import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" +) + +var _ sdk.TypedServiceRegistration = Registration{} + +type Registration struct{} + +func (r Registration) WebsiteCategories() []string { + return []string{ + "Container Apps", + } +} + +func (r Registration) Name() string { + return "Container Apps" +} + +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{ + ContainerAppEnvironmentDataSource{}, + ContainerAppEnvironmentCertificateDataSource{}, + } +} + +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + ContainerAppEnvironmentCertificateResource{}, + ContainerAppEnvironmentDaprComponentResource{}, + ContainerAppEnvironmentResource{}, + ContainerAppEnvironmentStorageResource{}, + ContainerAppResource{}, + } +} diff --git a/internal/services/containerapps/testdata/testacc.pfx b/internal/services/containerapps/testdata/testacc.pfx new file mode 100644 index 000000000000..af32f85f6b3a Binary files /dev/null and b/internal/services/containerapps/testdata/testacc.pfx differ diff --git a/internal/services/containerapps/validate/validate.go b/internal/services/containerapps/validate/validate.go new file mode 100644 index 000000000000..b0a0c08b76bf --- /dev/null +++ b/internal/services/containerapps/validate/validate.go @@ -0,0 +1,137 @@ +package validate + +import ( + "fmt" + "regexp" + "strings" +) + +func InitTimeout(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + + if matched := regexp.MustCompile(`^[0-9]+[smh]$`).Match([]byte(v)); !matched { + errors = append(errors, fmt.Errorf("%q should be a duration in whole intervals of seconds, minutes, or hours. e.g. 5s, 10m, 1h", k)) + } + + return +} + +func DaprComponentName(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + + if matched := regexp.MustCompile(`^([a-z])[a-z0-9-]{0,58}[a-z]?$`).Match([]byte(v)); !matched || strings.HasSuffix(v, "-") || strings.Contains(v, "--") { + errors = append(errors, fmt.Errorf("%q must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character and cannot have '--'. The length must not be more than 60 characters", k)) + return + } + + return +} + +func SecretName(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + + if matched := regexp.MustCompile(`^[a-z0-9][a-z0-9-]*[a-z0-9]?$`).Match([]byte(v)); !matched || strings.HasSuffix(v, "-") || strings.HasSuffix(v, ".") { + errors = append(errors, fmt.Errorf("%q must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character", k)) + } + return +} + +func CertificateName(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + + if matched := regexp.MustCompile(`^([a-z0-9])[a-z0-9-.]*[a-z0-9]$`).Match([]byte(v)); !matched || strings.HasSuffix(v, "-") || strings.Contains(v, "--") { + errors = append(errors, fmt.Errorf("%q must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character", k)) + return + } + + return +} + +func ContainerAppName(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + + if matched := regexp.MustCompile(`^([a-z])[a-z0-9-]{0,58}[a-z]?$`).Match([]byte(v)); !matched || strings.HasSuffix(v, "-") || strings.Contains(v, "--") { + errors = append(errors, fmt.Errorf("%q must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character and cannot have '--'. The length must not be more than 60 characters", k)) + return + } + + return +} + +func ContainerCpu(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(float64) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be float", k)) + return + } + switch v { + case 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0: + default: + errors = append(errors, fmt.Errorf("%s must be one of `0.25`, `0.5`, `0.75`, `1.0`, `1.25`, `1.5`, `1.75`, or `2.0`", k)) + } + + return +} + +func ManagedEnvironmentStorageName(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + + if matched := regexp.MustCompile(`^([a-z])[a-z0-9-]{0,30}[a-z]?$`).Match([]byte(v)); !matched || strings.HasSuffix(v, "-") || strings.Contains(v, "--") { + errors = append(errors, fmt.Errorf("%q must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character and cannot have '--'. The length must not be more than 32 characters", k)) + return + } + + return +} + +func ManagedEnvironmentName(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + + if matched := regexp.MustCompile(`^([a-zA-Z])[a-zA-Z0-9-]{0,58}[a-z]?$`).Match([]byte(v)); !matched || strings.HasSuffix(v, "-") { + errors = append(errors, fmt.Errorf("%q must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character. The length must not be more than 60 characters", k)) + return + } + return +} + +func ContainerAppContainerName(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + + if matched := regexp.MustCompile(`^([a-zA-Z0-9])[a-zA-Z0-9-.]{0,254}[a-z]?$`).Match([]byte(v)); !matched || strings.HasSuffix(v, "-") { + errors = append(errors, fmt.Errorf("%q must consist of lower case alphanumeric characters, '-', or '.', start with an alphabetic character, and end with an alphanumeric character. The length must not be more than 60 characters", k)) + return + } + return +} diff --git a/internal/services/containerapps/validate/validate_test.go b/internal/services/containerapps/validate/validate_test.go new file mode 100644 index 000000000000..408e27718ccf --- /dev/null +++ b/internal/services/containerapps/validate/validate_test.go @@ -0,0 +1,273 @@ +package validate + +import ( + "testing" +) + +func TestValidateDaprComponentName(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + { + Input: "", + Valid: false, + }, + { + Input: "-", + Valid: false, + }, + { + Input: "9", + Valid: false, + }, + { + Input: "a-", + Valid: false, + }, + { + Input: "a--a", + Valid: false, + }, + { + Input: "Cannothavecapitals", + Valid: false, + }, + { + Input: "a", + Valid: true, + }, + { + Input: "valid", + Valid: true, + }, + { + Input: "valid12345678901234567890123456789012345678901234butverylong", + Valid: true, + }, + { + Input: "invalid12345678901234567890123456789012345678901234567toolong", + Valid: false, + }, + } + + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := DaprComponentName(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t for %s", tc.Valid, valid, tc.Input) + } + } +} + +func TestValidateSecretNames(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + { + Input: "", + Valid: false, + }, + { + Input: "-", + Valid: false, + }, + { + Input: "9", + Valid: true, + }, + { + Input: "a-", + Valid: false, + }, + { + Input: "a.", + Valid: false, + }, + { + Input: "a--a", + Valid: true, + }, + { + Input: "Cannothavecapitals", + Valid: false, + }, + { + Input: "a", + Valid: true, + }, + { + Input: "valid", + Valid: true, + }, + { + Input: "valid12345678901234567890123456789012345678901234butverylong", + Valid: true, + }, + } + + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := SecretName(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t for %s: %+v", tc.Valid, valid, tc.Input, errors) + } + } +} + +func TestValidateManagedEnvironmentStorageName(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + { + Input: "", + }, + { + Input: "-", + }, + { + Input: "9", + }, + { + Input: "a-", + }, + { + Input: "a.", + }, + { + Input: "a--a", + }, + { + Input: "Cannothavecapitals", + }, + { + Input: "a-a", + Valid: true, + }, + { + Input: "valid", + Valid: true, + }, + { + Input: "invalid12345678901234567890123456", + }, + } + + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := ManagedEnvironmentStorageName(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t for %s: %+v", tc.Valid, valid, tc.Input, errors) + } + } +} + +func TestValidateManagedEnvironmentName(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + { + Input: "", + }, + { + Input: "-", + }, + { + Input: "9", + }, + { + Input: "a-", + }, + { + Input: "a.", + }, + { + Input: "TooLonghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghija", + }, + { + Input: "a--a", + Valid: true, + }, + { + Input: "Canhavecapitals", + Valid: true, + }, + { + Input: "a-a", + Valid: true, + }, + { + Input: "valid", + Valid: true, + }, + { + Input: "MaxLengthjabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij", + Valid: true, + }, + } + + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := ManagedEnvironmentName(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t for %s: %+v", tc.Valid, valid, tc.Input, errors) + } + } +} + +func TestValidateInitTimeout(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + { + Input: "5", + Valid: false, + }, + { + Input: "m", + Valid: false, + }, + { + Input: "6d", + Valid: false, + }, + { + Input: "10s", + Valid: true, + }, + { + Input: "1h", + Valid: true, + }, + { + Input: "1200s", + Valid: true, + }, + { + Input: "134m", + Valid: true, + }, + } + + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := InitTimeout(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t for %s", tc.Valid, valid, tc.Input) + } + } +} diff --git a/internal/services/containers/client/client.go b/internal/services/containers/client/client.go index b051c60ece3a..c9ee00d17391 100644 --- a/internal/services/containers/client/client.go +++ b/internal/services/containers/client/client.go @@ -1,10 +1,10 @@ package client import ( - legacy "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice" // nolint: staticcheck "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-08-01-preview/containerregistry" // nolint: staticcheck "github.com/Azure/go-autorest/autorest/azure" "github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-10-01/containerinstance" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations" "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters" @@ -19,7 +19,7 @@ type Client struct { MaintenanceConfigurationsClient *maintenanceconfigurations.MaintenanceConfigurationsClient RegistriesClient *containerregistry.RegistriesClient ReplicationsClient *containerregistry.ReplicationsClient - ServicesClient *legacy.ContainerServicesClient + ServicesClient *containerservices.ContainerServicesClient WebhooksClient *containerregistry.WebhooksClient TokensClient *containerregistry.TokensClient ScopeMapsClient *containerregistry.ScopeMapsClient @@ -68,7 +68,7 @@ func NewContainersClient(o *common.ClientOptions) *Client { maintenanceConfigurationsClient := maintenanceconfigurations.NewMaintenanceConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&maintenanceConfigurationsClient.Client, o.ResourceManagerAuthorizer) - servicesClient := legacy.NewContainerServicesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + servicesClient := containerservices.NewContainerServicesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&servicesClient.Client, o.ResourceManagerAuthorizer) connectedRegistriesClient := containerregistry.NewConnectedRegistriesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) @@ -84,7 +84,7 @@ func NewContainersClient(o *common.ClientOptions) *Client { WebhooksClient: &webhooksClient, ReplicationsClient: &replicationsClient, ServicesClient: &servicesClient, - Environment: o.Environment, + Environment: o.AzureEnvironment, TokensClient: &tokensClient, ScopeMapsClient: &scopeMapsClient, TasksClient: &tasksClient, diff --git a/internal/services/containers/container_connected_registry_resource_test.go b/internal/services/containers/container_connected_registry_resource_test.go index 36898dec8452..391881737203 100644 --- a/internal/services/containers/container_connected_registry_resource_test.go +++ b/internal/services/containers/container_connected_registry_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,10 +19,10 @@ func TestAccContainerConnectedRegistry_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_container_connected_registry", "test") r := ContainerConnectedRegistryResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -35,10 +34,10 @@ func TestAccContainerConnectedRegistry_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_container_connected_registry", "test") r := ContainerConnectedRegistryResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -50,24 +49,24 @@ func TestAccContainerConnectedRegistry_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_container_connected_registry", "test") r := ContainerConnectedRegistryResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -79,10 +78,10 @@ func TestAccContainerConnectedRegistry_mirror(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_container_connected_registry", "test") r := ContainerConnectedRegistryResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.mirror(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -94,10 +93,10 @@ func TestAccContainerConnectedRegistry_registry(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_container_connected_registry", "test") r := ContainerConnectedRegistryResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.registry(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -109,10 +108,10 @@ func TestAccContainerConnectedRegistry_cascaded(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_container_connected_registry", "test") r := ContainerConnectedRegistryResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.cascaded(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -124,10 +123,10 @@ func TestAccContainerConnectedRegistry_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_container_connected_registry", "test") r := ContainerConnectedRegistryResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -135,7 +134,7 @@ func TestAccContainerConnectedRegistry_requiresImport(t *testing.T) { }) } -func (r ContainerConnectedRegistryResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r ContainerConnectedRegistryResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { client := clients.Containers.ConnectedRegistriesClient id, err := parse.ContainerConnectedRegistryID(state.ID) diff --git a/internal/services/containers/container_group_resource.go b/internal/services/containers/container_group_resource.go index 96233e87d296..c655d02e4b8b 100644 --- a/internal/services/containers/container_group_resource.go +++ b/internal/services/containers/container_group_resource.go @@ -2009,7 +2009,7 @@ func flattenContainerGroupSubnets(input *[]containerinstance.ContainerGroupSubne continue } - id, err := networkParse.SubnetID(resourceRef.Id) + id, err := networkParse.SubnetIDInsensitively(resourceRef.Id) if err != nil { return nil, fmt.Errorf(`parsing subnet id %q: %v`, resourceRef.Id, err) } diff --git a/internal/services/containers/container_registry_resource.go b/internal/services/containers/container_registry_resource.go index 9648f6ec8bf2..c5e638d11426 100644 --- a/internal/services/containers/container_registry_resource.go +++ b/internal/services/containers/container_registry_resource.go @@ -251,7 +251,7 @@ func resourceContainerRegistryCreate(d *pluginsdk.ResourceData, meta interface{} newGeoReplicationLocations = expandReplications(geoReplications) // geo replications have been specified if len(newGeoReplicationLocations) > 0 { - err = applyGeoReplicationLocations(ctx, d, meta, id.ResourceGroup, id.Name, oldGeoReplicationLocations, newGeoReplicationLocations) + err = applyGeoReplicationLocations(ctx, meta, id.ResourceGroup, id.Name, oldGeoReplicationLocations, newGeoReplicationLocations) if err != nil { return fmt.Errorf("applying geo replications for %s: %+v", id, err) } @@ -349,12 +349,12 @@ func resourceContainerRegistryUpdate(d *pluginsdk.ResourceData, meta interface{} } if hasGeoReplicationsChanges { - err := applyGeoReplicationLocations(ctx, d, meta, id.ResourceGroup, id.Name, expandReplications(oldReplications), expandReplications(newReplications)) + err := applyGeoReplicationLocations(ctx, meta, id.ResourceGroup, id.Name, expandReplications(oldReplications), expandReplications(newReplications)) if err != nil { return fmt.Errorf("applying geo replications for %s: %+v", id, err) } } else if hasGeoReplicationLocationsChanges { - err := applyGeoReplicationLocations(ctx, d, meta, id.ResourceGroup, id.Name, expandReplicationsFromLocations(oldGeoReplicationLocations), expandReplicationsFromLocations(newGeoReplicationLocations)) + err := applyGeoReplicationLocations(ctx, meta, id.ResourceGroup, id.Name, expandReplicationsFromLocations(oldGeoReplicationLocations), expandReplicationsFromLocations(newGeoReplicationLocations)) if err != nil { return fmt.Errorf("applying geo replications for %s: %+v", id, err) } @@ -405,10 +405,8 @@ func applyContainerRegistrySku(d *pluginsdk.ResourceData, meta interface{}, sku return nil } -func applyGeoReplicationLocations(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}, resourceGroup string, name string, oldGeoReplications []containerregistry.Replication, newGeoReplications []containerregistry.Replication) error { +func applyGeoReplicationLocations(ctx context.Context, meta interface{}, resourceGroup string, name string, oldGeoReplications []containerregistry.Replication, newGeoReplications []containerregistry.Replication) error { replicationClient := meta.(*clients.Client).Containers.ReplicationsClient - ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) - defer cancel() log.Printf("[INFO] preparing to apply geo-replications for Container Registry.") oldReplications := map[string]containerregistry.Replication{} diff --git a/internal/services/containers/container_registry_task_resource.go b/internal/services/containers/container_registry_task_resource.go index 56c8df47a71c..cebf9c856038 100644 --- a/internal/services/containers/container_registry_task_resource.go +++ b/internal/services/containers/container_registry_task_resource.go @@ -548,6 +548,7 @@ func (r ContainerRegistryTaskResource) Arguments() map[string]*pluginsdk.Schema "password": { Type: pluginsdk.TypeString, Optional: true, + Sensitive: true, ValidateFunc: validation.StringIsNotEmpty, }, "identity": { diff --git a/internal/services/containers/container_registry_task_resource_test.go b/internal/services/containers/container_registry_task_resource_test.go index 7d97538febf0..cdd99424e7b9 100644 --- a/internal/services/containers/container_registry_task_resource_test.go +++ b/internal/services/containers/container_registry_task_resource_test.go @@ -6,12 +6,11 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -53,24 +52,24 @@ func TestAccContainerRegistryTask_dockerStep(t *testing.T) { }, } - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.dockerStepBasic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("docker_step.0.context_access_token"), { Config: r.dockerStepUpdate(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("docker_step.0.context_access_token", "docker_step.0.secret_arguments"), { Config: r.dockerStepBasic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -90,24 +89,24 @@ func TestAccContainerRegistryTask_fileTaskStep(t *testing.T) { }, } - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.fileTaskStepBasic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("file_step.0.context_access_token"), { Config: r.fileTaskStepUpdate(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("file_step.0.context_access_token", "file_step.0.secret_values"), { Config: r.fileTaskStepBasic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -127,24 +126,24 @@ func TestAccContainerRegistryTask_encodedTaskStep(t *testing.T) { }, } - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.encodedTaskStepBasic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("encoded_step.0.context_access_token"), { Config: r.encodedTaskStepUpdate(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("encoded_step.0.context_access_token", "encoded_step.0.secret_values"), { Config: r.encodedTaskStepBasic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -164,24 +163,24 @@ func TestAccContainerRegistryTask_dockerStepBaseImageTrigger(t *testing.T) { }, } - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.dockerStepBaseImageTrigger(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("docker_step.0.context_access_token"), { Config: r.dockerStepBaseImageTriggerUpdate(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("docker_step.0.context_access_token", "base_image_trigger.0.update_trigger_endpoint"), { Config: r.dockerStepBaseImageTrigger(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -201,10 +200,10 @@ func TestAccContainerRegistryTask_dockerStepSourceTrigger(t *testing.T) { }, } - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.dockerStepSourceTrigger(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -219,7 +218,7 @@ func TestAccContainerRegistryTask_dockerStepSourceTrigger(t *testing.T) { ), { Config: r.dockerStepSourceTriggerUpdateDockerStep(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -234,7 +233,7 @@ func TestAccContainerRegistryTask_dockerStepSourceTrigger(t *testing.T) { ), { Config: r.dockerStepSourceTriggerUpdate(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -249,7 +248,7 @@ func TestAccContainerRegistryTask_dockerStepSourceTrigger(t *testing.T) { ), { Config: r.dockerStepSourceTrigger(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -277,24 +276,24 @@ func TestAccContainerRegistryTask_dockerStepTimerTrigger(t *testing.T) { }, } - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.dockerStepTimerTrigger(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("docker_step.0.context_access_token"), { Config: r.dockerStepTimerTriggerUpdate(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("docker_step.0.context_access_token"), { Config: r.dockerStepTimerTrigger(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -314,10 +313,10 @@ func TestAccContainerRegistryTask_identity(t *testing.T) { }, } - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.dockerStepBasic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -326,7 +325,7 @@ func TestAccContainerRegistryTask_identity(t *testing.T) { ), { Config: r.dockerStepSystemIdentity(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -335,7 +334,7 @@ func TestAccContainerRegistryTask_identity(t *testing.T) { ), { Config: r.dockerStepUserAssignedIdentity(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -344,7 +343,7 @@ func TestAccContainerRegistryTask_identity(t *testing.T) { ), { Config: r.dockerStepSystemUserAssignedIdentity(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -366,17 +365,17 @@ func TestAccContainerRegistryTask_fileTaskStepRegistryCredential(t *testing.T) { }, } - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.fileTaskStepBasic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("file_step.0.context_access_token"), { Config: r.fileTaskStepRegistryCredentialPassword(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -391,7 +390,7 @@ func TestAccContainerRegistryTask_fileTaskStepRegistryCredential(t *testing.T) { ), { Config: r.fileTaskStepRegistryCredentialIdentity(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -406,7 +405,7 @@ func TestAccContainerRegistryTask_fileTaskStepRegistryCredential(t *testing.T) { ), { Config: r.fileTaskStepBasic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -418,10 +417,10 @@ func TestAccContainerRegistryTask_systemTask(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_container_registry_task", "test") r := ContainerRegistryTaskResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.systemTask(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -441,10 +440,10 @@ func TestAccContainerRegistryTask_requiresImport(t *testing.T) { }, } - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.dockerStepBasic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -452,7 +451,7 @@ func TestAccContainerRegistryTask_requiresImport(t *testing.T) { }) } -func (r ContainerRegistryTaskResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r ContainerRegistryTaskResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { client := clients.Containers.TasksClient id, err := parse.ContainerRegistryTaskID(state.ID) diff --git a/internal/services/containers/container_registry_task_schedule_run_now_resource_test.go b/internal/services/containers/container_registry_task_schedule_run_now_resource_test.go index 317c5bcc8232..99ac3a72940a 100644 --- a/internal/services/containers/container_registry_task_schedule_run_now_resource_test.go +++ b/internal/services/containers/container_registry_task_schedule_run_now_resource_test.go @@ -6,7 +6,6 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -28,7 +27,7 @@ func TestAccContainerRegistryTaskSchedule_basic(t *testing.T) { }, } - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data, r.dockerTaskStep), }, diff --git a/internal/services/containers/container_registry_token_password_resource_test.go b/internal/services/containers/container_registry_token_password_resource_test.go index 485723bc4f95..c3b28f46622b 100644 --- a/internal/services/containers/container_registry_token_password_resource_test.go +++ b/internal/services/containers/container_registry_token_password_resource_test.go @@ -6,12 +6,11 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -23,10 +22,10 @@ func TestAccContainerRegistryTokenPassword_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_container_registry_token_password", "test") r := ContainerRegistryTokenPasswordResource{Expiry: time.Now().Add(time.Hour)} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -38,10 +37,10 @@ func TestAccContainerRegistryTokenPassword_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_container_registry_token_password", "test") r := ContainerRegistryTokenPasswordResource{Expiry: time.Now().Add(time.Hour)} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -53,24 +52,24 @@ func TestAccContainerRegistryTokenPassword_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_container_registry_token_password", "test") r := ContainerRegistryTokenPasswordResource{Expiry: time.Now().Add(time.Hour)} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("password1.0.value"), { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("password1.0.value", "password2.0.value"), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -83,17 +82,17 @@ func TestAccContainerRegistryTokenPassword_updateExpiryReflectNewValue(t *testin data := acceptance.BuildTestData(t, "azurerm_container_registry_token_password", "test") r := ContainerRegistryTokenPasswordResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.expiryReflectValue(data, time.Now().Add(time.Hour).Format(time.RFC3339), "password1"), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("password1.0.value"), { Config: r.expiryReflectValue(data, time.Now().Add(2*time.Hour).Format(time.RFC3339), "password2"), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -105,10 +104,10 @@ func TestAccContainerRegistryTokenPassword_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_container_registry_token_password", "test") r := ContainerRegistryTokenPasswordResource{Expiry: time.Now().Add(time.Hour)} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -116,7 +115,7 @@ func TestAccContainerRegistryTokenPassword_requiresImport(t *testing.T) { }) } -func (r ContainerRegistryTokenPasswordResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r ContainerRegistryTokenPasswordResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { client := clients.Containers.TokensClient id, err := parse.ContainerRegistryTokenPasswordID(state.ID) diff --git a/internal/services/containers/kubernetes_addons.go b/internal/services/containers/kubernetes_addons.go index 6cd10fdd2653..7281cb9ec22d 100644 --- a/internal/services/containers/kubernetes_addons.go +++ b/internal/services/containers/kubernetes_addons.go @@ -19,12 +19,13 @@ import ( const ( // note: the casing on these keys is important aciConnectorKey = "aciConnectorLinux" + azureKeyvaultSecretsProviderKey = "azureKeyvaultSecretsProvider" azurePolicyKey = "azurepolicy" + confidentialComputingKey = "ACCSGXDevicePlugin" httpApplicationRoutingKey = "httpApplicationRouting" - omsAgentKey = "omsagent" ingressApplicationGatewayKey = "ingressApplicationGateway" + omsAgentKey = "omsagent" openServiceMeshKey = "openServiceMesh" - azureKeyvaultSecretsProviderKey = "azureKeyvaultSecretsProvider" ) // The AKS API hard-codes which add-ons are supported in which environment @@ -55,6 +56,26 @@ func schemaKubernetesAddOns() map[string]*pluginsdk.Schema { Required: true, ValidateFunc: validation.StringIsNotEmpty, }, + "connector_identity": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "client_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "object_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "user_assigned_identity_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, }, }, }, @@ -62,6 +83,19 @@ func schemaKubernetesAddOns() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeBool, Optional: true, }, + "confidential_computing": { + Type: pluginsdk.TypeList, + MaxItems: 1, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "sgx_quote_helper_enabled": { + Type: pluginsdk.TypeBool, + Required: true, + }, + }, + }, + }, "http_application_routing_enabled": { Type: pluginsdk.TypeBool, Optional: true, @@ -247,6 +281,24 @@ func expandKubernetesAddOns(d *pluginsdk.ResourceData, input map[string]interfac } addonProfiles := map[string]managedclusters.ManagedClusterAddonProfile{} + + confidentialComputing := input["confidential_computing"].([]interface{}) + if len(confidentialComputing) > 0 && confidentialComputing[0] != nil { + value := confidentialComputing[0].(map[string]interface{}) + config := make(map[string]string) + quoteHelperEnabled := "false" + if value["sgx_quote_helper_enabled"].(bool) { + quoteHelperEnabled = "true" + } + config["ACCSGXQuoteHelperEnabled"] = quoteHelperEnabled + addonProfiles[confidentialComputingKey] = managedclusters.ManagedClusterAddonProfile{ + Enabled: true, + Config: &config, + } + } else if len(confidentialComputing) == 0 && d.HasChange("confidential_computing") { + addonProfiles[confidentialComputingKey] = disabled + } + if d.HasChange("http_application_routing_enabled") { addonProfiles[httpApplicationRoutingKey] = managedclusters.ManagedClusterAddonProfile{ Enabled: input["http_application_routing_enabled"].(bool), @@ -259,7 +311,7 @@ func expandKubernetesAddOns(d *pluginsdk.ResourceData, input map[string]interfac config := make(map[string]string) if workspaceID, ok := value["log_analytics_workspace_id"]; ok && workspaceID != "" { - lawid, err := workspaces.ParseWorkspaceID(workspaceID.(string)) + lawid, err := workspaces.ParseWorkspaceIDInsensitively(workspaceID.(string)) if err != nil { return nil, fmt.Errorf("parsing Log Analytics Workspace ID: %+v", err) } @@ -396,8 +448,11 @@ func flattenKubernetesAddOns(profile map[string]managedclusters.ManagedClusterAd subnetName = (*v)["SubnetName"] } + identity := flattenKubernetesClusterAddOnIdentityProfile(aciConnector.Identity) + aciConnectors = append(aciConnectors, map[string]interface{}{ - "subnet_name": subnetName, + "subnet_name": subnetName, + "connector_identity": identity, }) } @@ -407,6 +462,18 @@ func flattenKubernetesAddOns(profile map[string]managedclusters.ManagedClusterAd azurePolicyEnabled = enabledVal } + confidentialComputings := make([]interface{}, 0) + confidentialComputing := kubernetesAddonProfileLocate(profile, confidentialComputingKey) + if enabled := confidentialComputing.Enabled; enabled { + quoteHelperEnabled := false + if v := kubernetesAddonProfilelocateInConfig(confidentialComputing.Config, "ACCSGXQuoteHelperEnabled"); v != "" && v != "false" { + quoteHelperEnabled = true + } + confidentialComputings = append(confidentialComputings, map[string]interface{}{ + "sgx_quote_helper_enabled": quoteHelperEnabled, + }) + } + httpApplicationRoutingEnabled := false httpApplicationRoutingZone := "" httpApplicationRouting := kubernetesAddonProfileLocate(profile, httpApplicationRoutingKey) @@ -509,12 +576,13 @@ func flattenKubernetesAddOns(profile map[string]managedclusters.ManagedClusterAd return map[string]interface{}{ "aci_connector_linux": aciConnectors, "azure_policy_enabled": azurePolicyEnabled, + "confidential_computing": confidentialComputings, "http_application_routing_enabled": httpApplicationRoutingEnabled, "http_application_routing_zone_name": httpApplicationRoutingZone, - "oms_agent": omsAgents, "ingress_application_gateway": ingressApplicationGateways, - "open_service_mesh_enabled": openServiceMeshEnabled, "key_vault_secrets_provider": azureKeyVaultSecretsProviders, + "oms_agent": omsAgents, + "open_service_mesh_enabled": openServiceMeshEnabled, } } @@ -552,6 +620,7 @@ func collectKubernetesAddons(d *pluginsdk.ResourceData) map[string]interface{} { return map[string]interface{}{ "aci_connector_linux": d.Get("aci_connector_linux").([]interface{}), "azure_policy_enabled": d.Get("azure_policy_enabled").(bool), + "confidential_computing": d.Get("confidential_computing").([]interface{}), "http_application_routing_enabled": d.Get("http_application_routing_enabled").(bool), "oms_agent": d.Get("oms_agent").([]interface{}), "ingress_application_gateway": d.Get("ingress_application_gateway").([]interface{}), diff --git a/internal/services/containers/kubernetes_cluster_addons_resource_test.go b/internal/services/containers/kubernetes_cluster_addons_resource_test.go index d471114735ad..6356739d12a8 100644 --- a/internal/services/containers/kubernetes_cluster_addons_resource_test.go +++ b/internal/services/containers/kubernetes_cluster_addons_resource_test.go @@ -238,6 +238,42 @@ func TestAccKubernetesCluster_addonProfileAzureKeyVaultSecretsProvider(t *testin }) } +func TestAccKubernetesCluster_addonProfileConfidentialComputing(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster", "test") + r := KubernetesClusterResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.addonProfileConfidentialComputingConfig(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.addonProfileConfidentialComputingConfig(data, false), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.addonProfileConfidentialComputingConfig(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.addonProfileDisableThroughOmission(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func (KubernetesClusterResource) addonProfileAciConnectorLinuxConfig(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { @@ -902,3 +938,83 @@ resource "azurerm_kubernetes_cluster" "test" { } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, secretRotation, rotationInterval) } + +func (KubernetesClusterResource) addonProfileConfidentialComputingConfig(data acceptance.TestData, enabled bool) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-aks-%d" + location = "%s" +} + +resource "azurerm_kubernetes_cluster" "test" { + name = "acctestaks%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + dns_prefix = "acctestaks%d" + + linux_profile { + admin_username = "acctestuser%d" + + ssh_key { + key_data = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqaZoyiz1qbdOQ8xEf6uEu1cCwYowo5FHtsBhqLoDnnp7KUTEBN+L2NxRIfQ781rxV6Iq5jSav6b2Q8z5KiseOlvKA/RF2wqU0UPYqQviQhLmW6THTpmrv/YkUCuzxDpsH7DUDhZcwySLKVVe0Qm3+5N2Ta6UYH3lsDf9R9wTP2K/+vAnflKebuypNlmocIvakFWoZda18FOmsOoIVXQ8HWFNCuw9ZCunMSN62QGamCe3dL5cXlkgHYv7ekJE15IA9aOJcM7e90oeTqo+7HTcWfdu0qQqPWY5ujyMw/llas8tsXY85LFqRnr3gJ02bAscjc477+X+j/gkpFoN1QEmt terraform@demo.tld" + } + } + + default_node_pool { + name = "default" + node_count = 1 + vm_size = "Standard_DS2_v2" + } + + confidential_computing { + sgx_quote_helper_enabled = %t + } + + identity { + type = "SystemAssigned" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, enabled) +} + +func (KubernetesClusterResource) addonProfileDisableThroughOmission(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-aks-%d" + location = "%s" +} + +resource "azurerm_kubernetes_cluster" "test" { + name = "acctestaks%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + dns_prefix = "acctestaks%d" + + linux_profile { + admin_username = "acctestuser%d" + + ssh_key { + key_data = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqaZoyiz1qbdOQ8xEf6uEu1cCwYowo5FHtsBhqLoDnnp7KUTEBN+L2NxRIfQ781rxV6Iq5jSav6b2Q8z5KiseOlvKA/RF2wqU0UPYqQviQhLmW6THTpmrv/YkUCuzxDpsH7DUDhZcwySLKVVe0Qm3+5N2Ta6UYH3lsDf9R9wTP2K/+vAnflKebuypNlmocIvakFWoZda18FOmsOoIVXQ8HWFNCuw9ZCunMSN62QGamCe3dL5cXlkgHYv7ekJE15IA9aOJcM7e90oeTqo+7HTcWfdu0qQqPWY5ujyMw/llas8tsXY85LFqRnr3gJ02bAscjc477+X+j/gkpFoN1QEmt terraform@demo.tld" + } + } + + default_node_pool { + name = "default" + node_count = 1 + vm_size = "Standard_DS2_v2" + } + + identity { + type = "SystemAssigned" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) +} diff --git a/internal/services/containers/kubernetes_cluster_auth_resource_test.go b/internal/services/containers/kubernetes_cluster_auth_resource_test.go index a417e901a027..0741ac10b888 100644 --- a/internal/services/containers/kubernetes_cluster_auth_resource_test.go +++ b/internal/services/containers/kubernetes_cluster_auth_resource_test.go @@ -812,7 +812,7 @@ resource "azurerm_kubernetes_cluster" "test" { `, tenantId, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) } -func (KubernetesClusterResource) roleBasedAccessControlAADManagedConfigVOneDotTwoFourDotThree(data acceptance.TestData, tenantId string) string { +func (KubernetesClusterResource) roleBasedAccessControlAADManagedConfigVOneDotTwoFourDotNine(data acceptance.TestData, tenantId string) string { return fmt.Sprintf(` variable "tenant_id" { default = "%s" @@ -828,7 +828,7 @@ resource "azurerm_kubernetes_cluster" "test" { location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" dns_prefix = "acctestaks%d" - kubernetes_version = "1.24.3" + kubernetes_version = "1.24.9" linux_profile { admin_username = "acctestuser%d" diff --git a/internal/services/containers/kubernetes_cluster_data_source.go b/internal/services/containers/kubernetes_cluster_data_source.go index 88487f654159..fca1c846ba5a 100644 --- a/internal/services/containers/kubernetes_cluster_data_source.go +++ b/internal/services/containers/kubernetes_cluster_data_source.go @@ -380,6 +380,23 @@ func dataSourceKubernetesCluster() *pluginsdk.Resource { "identity": commonschema.SystemOrUserAssignedIdentityComputed(), + "key_management_service": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "key_vault_key_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "key_vault_network_access": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + "kubernetes_version": { Type: pluginsdk.TypeString, Computed: true, @@ -718,6 +735,11 @@ func dataSourceKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{} return fmt.Errorf("setting `agent_pool_profile`: %+v", err) } + azureKeyVaultKms := flattenKubernetesClusterDataSourceKeyVaultKms(props.SecurityProfile.AzureKeyVaultKms) + if err := d.Set("key_management_service", azureKeyVaultKms); err != nil { + return fmt.Errorf("setting `key_management_service`: %+v", err) + } + kubeletIdentity, err := flattenKubernetesClusterDataSourceIdentityProfile(props.IdentityProfile) if err != nil { return err @@ -787,7 +809,7 @@ func dataSourceKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{} // adminProfile is only available for RBAC enabled clusters with AAD and without local accounts disabled if props.AadProfile != nil && (props.DisableLocalAccounts == nil || !*props.DisableLocalAccounts) { - profileId := managedclusters.NewAccessProfileID(subscriptionId, id.ResourceGroupName, id.ResourceName, "clusterAdmin") + profileId := managedclusters.NewAccessProfileID(subscriptionId, id.ResourceGroupName, id.ManagedClusterName, "clusterAdmin") adminProfile, err := client.GetAccessProfile(ctx, profileId) if err != nil { return fmt.Errorf("retrieving Admin Access Profile for %s: %+v", id, err) @@ -827,6 +849,29 @@ func dataSourceKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{} return nil } +func flattenKubernetesClusterDataSourceKeyVaultKms(input *managedclusters.AzureKeyVaultKms) []interface{} { + azureKeyVaultKms := make([]interface{}, 0) + + if input != nil && input.Enabled != nil && *input.Enabled { + keyId := "" + if v := input.KeyId; v != nil { + keyId = *v + } + + networkAccess := "" + if v := input.KeyVaultNetworkAccess; v != nil { + networkAccess = string(*v) + } + + azureKeyVaultKms = append(azureKeyVaultKms, map[string]interface{}{ + "key_vault_key_id": keyId, + "key_vault_network_access": networkAccess, + }) + } + + return azureKeyVaultKms +} + func flattenKubernetesClusterDataSourceStorageProfile(input *managedclusters.ManagedClusterStorageProfile) []interface{} { storageProfile := make([]interface{}, 0) diff --git a/internal/services/containers/kubernetes_cluster_data_source_test.go b/internal/services/containers/kubernetes_cluster_data_source_test.go index f1f3ad765f03..21beeb32748a 100644 --- a/internal/services/containers/kubernetes_cluster_data_source_test.go +++ b/internal/services/containers/kubernetes_cluster_data_source_test.go @@ -70,13 +70,13 @@ func TestAccDataSourceKubernetesCluster_roleBasedAccessControl(t *testing.T) { }) } -func TestAccDataSourceKubernetesCluster_roleBasedAccessControlAAD_VOneDotTwoFourDotThree(t *testing.T) { +func TestAccDataSourceKubernetesCluster_roleBasedAccessControlAAD_VOneDotTwoFourDotNine(t *testing.T) { data := acceptance.BuildTestData(t, "data.azurerm_kubernetes_cluster", "test") r := KubernetesClusterDataSource{} data.DataSourceTest(t, []acceptance.TestStep{ { - Config: r.roleBasedAccessControlAADManagedConfigVOneDotTwoFourDotThree(data), + Config: r.roleBasedAccessControlAADManagedConfigVOneDotTwoFourDotNine(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).Key("kube_config.#").HasValue("1"), check.That(data.ResourceName).Key("kube_config.0.host").IsSet(), @@ -583,7 +583,7 @@ data "azurerm_kubernetes_cluster" "test" { `, KubernetesClusterResource{}.roleBasedAccessControlConfig(data)) } -func (KubernetesClusterDataSource) roleBasedAccessControlAADManagedConfigVOneDotTwoFourDotThree(data acceptance.TestData) string { +func (KubernetesClusterDataSource) roleBasedAccessControlAADManagedConfigVOneDotTwoFourDotNine(data acceptance.TestData) string { return fmt.Sprintf(` %s @@ -591,7 +591,7 @@ data "azurerm_kubernetes_cluster" "test" { name = azurerm_kubernetes_cluster.test.name resource_group_name = azurerm_kubernetes_cluster.test.resource_group_name } -`, KubernetesClusterResource{}.roleBasedAccessControlAADManagedConfigVOneDotTwoFourDotThree(data, "")) +`, KubernetesClusterResource{}.roleBasedAccessControlAADManagedConfigVOneDotTwoFourDotNine(data, "")) } func (KubernetesClusterDataSource) localAccountDisabled(data acceptance.TestData, tenantId string) string { diff --git a/internal/services/containers/kubernetes_cluster_network_resource_test.go b/internal/services/containers/kubernetes_cluster_network_resource_test.go index 89f11704a81a..b2e8b9e924cc 100644 --- a/internal/services/containers/kubernetes_cluster_network_resource_test.go +++ b/internal/services/containers/kubernetes_cluster_network_resource_test.go @@ -794,20 +794,13 @@ func TestAccKubernetesCluster_apiServerInBYOSubnet(t *testing.T) { }) } -func TestAccKubernetesCluster_kubeProxy(t *testing.T) { +func TestAccKubernetesCluster_clusterPoolNodePublicIPTags(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster", "test") r := KubernetesClusterResource{} data.ResourceTest(t, r, []acceptance.TestStep{ { - Config: r.kubeProxy(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - { - Config: r.kubeProxyDisabled(data), + Config: r.clusterPoolNodePublicIPTags(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), @@ -3410,71 +3403,36 @@ resource "azurerm_kubernetes_cluster" "test" { `, "westcentralus", data.RandomInteger) } -func (KubernetesClusterResource) kubeProxy(data acceptance.TestData) string { +func (KubernetesClusterResource) clusterPoolNodePublicIPTags(data acceptance.TestData) string { return fmt.Sprintf(` - provider "azurerm" { - features {} - } - resource "azurerm_resource_group" "test" { - name = "acctestRG-aks-%d" - location = "%s" - } - resource "azurerm_kubernetes_cluster" "test" { - name = "acctestaks%d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - dns_prefix = "acctestaks%d" - default_node_pool { - name = "default" - node_count = 1 - vm_size = "Standard_D2s_v3" - } - identity { - type = "SystemAssigned" - } - - network_profile { - network_plugin = "none" - kube_proxy { - mode = "IPVS" - ipvs { - scheduler = "LeastConnection" - tcp_fin_timeout_in_seconds = 1000 - tcp_timeout_in_seconds = 1000 - udp_timeout_in_seconds = 1000 - } - } - } - } - `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) -} - -func (KubernetesClusterResource) kubeProxyDisabled(data acceptance.TestData) string { - return fmt.Sprintf(` - provider "azurerm" { - features {} - } - resource "azurerm_resource_group" "test" { - name = "acctestRG-aks-%d" - location = "%s" - } - resource "azurerm_kubernetes_cluster" "test" { - name = "acctestaks%d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - dns_prefix = "acctestaks%d" - default_node_pool { - name = "default" - node_count = 1 - vm_size = "Standard_D2s_v3" - } - identity { - type = "SystemAssigned" - } - - network_profile { - network_plugin = "none" - } - } - `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-aks-%[2]d" + location = "%[1]s" +} + +resource "azurerm_kubernetes_cluster" "test" { + name = "acctestaks%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + dns_prefix = "acctestaks%[2]d" + default_node_pool { + name = "default" + node_count = 1 + vm_size = "Standard_DS2_v2" + enable_node_public_ip = true + node_network_profile { + node_public_ip_tags = { + RoutingPreference = "Internet" + } + } + } + identity { + type = "SystemAssigned" + } +} + `, data.Locations.Primary, data.RandomInteger) } diff --git a/internal/services/containers/kubernetes_cluster_node_pool_data_source.go b/internal/services/containers/kubernetes_cluster_node_pool_data_source.go index 2e1a245b5e2a..111bce5a6b03 100644 --- a/internal/services/containers/kubernetes_cluster_node_pool_data_source.go +++ b/internal/services/containers/kubernetes_cluster_node_pool_data_source.go @@ -177,7 +177,7 @@ func dataSourceKubernetesClusterNodePoolRead(d *pluginsdk.ResourceData, meta int return fmt.Errorf("retrieving %s: %+v", clusterId, err) } - id := agentpools.NewAgentPoolID(clusterId.SubscriptionId, clusterId.ResourceGroupName, clusterId.ResourceName, d.Get("name").(string)) + id := agentpools.NewAgentPoolID(clusterId.SubscriptionId, clusterId.ResourceGroupName, clusterId.ManagedClusterName, d.Get("name").(string)) resp, err := poolsClient.Get(ctx, id) if err != nil { if response.WasNotFound(resp.HttpResponse) { @@ -189,7 +189,7 @@ func dataSourceKubernetesClusterNodePoolRead(d *pluginsdk.ResourceData, meta int d.SetId(id.ID()) d.Set("name", id.AgentPoolName) - d.Set("kubernetes_cluster_name", id.ResourceName) + d.Set("kubernetes_cluster_name", id.ManagedClusterName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil && model.Properties != nil { diff --git a/internal/services/containers/kubernetes_cluster_node_pool_resource.go b/internal/services/containers/kubernetes_cluster_node_pool_resource.go index 8fee07ea5fb9..f7d7d05874bb 100644 --- a/internal/services/containers/kubernetes_cluster_node_pool_resource.go +++ b/internal/services/containers/kubernetes_cluster_node_pool_resource.go @@ -189,6 +189,8 @@ func resourceKubernetesClusterNodePool() *pluginsdk.Resource { ValidateFunc: validation.IntBetween(0, 1000), }, + "node_network_profile": schemaNodePoolNetworkProfile(), + "node_labels": { Type: pluginsdk.TypeMap, Optional: true, @@ -368,7 +370,7 @@ func resourceKubernetesClusterNodePoolCreate(d *pluginsdk.ResourceData, meta int return err } - id := agentpools.NewAgentPoolID(clusterId.SubscriptionId, clusterId.ResourceGroupName, clusterId.ResourceName, d.Get("name").(string)) + id := agentpools.NewAgentPoolID(clusterId.SubscriptionId, clusterId.ResourceGroupName, clusterId.ManagedClusterName, d.Get("name").(string)) log.Printf("[DEBUG] Retrieving %s...", *clusterId) cluster, err := clustersClient.Get(ctx, *clusterId) @@ -575,6 +577,10 @@ func resourceKubernetesClusterNodePoolCreate(d *pluginsdk.ResourceData, meta int profile.LinuxOSConfig = linuxOSConfig } + if networkProfile := d.Get("node_network_profile").([]interface{}); len(networkProfile) > 0 { + profile.NetworkProfile = expandAgentPoolNetworkProfile(networkProfile) + } + parameters := agentpools.AgentPool{ Name: utils.String(id.AgentPoolName), Properties: &profile, @@ -765,7 +771,7 @@ func resourceKubernetesClusterNodePoolRead(d *pluginsdk.ResourceData, meta inter } // if the parent cluster doesn't exist then the node pool won't - clusterId := managedclusters.NewManagedClusterID(id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + clusterId := managedclusters.NewManagedClusterID(id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName) cluster, err := clustersClient.Get(ctx, clusterId) if err != nil { if response.WasNotFound(cluster.HttpResponse) { @@ -933,9 +939,14 @@ func resourceKubernetesClusterNodePoolRead(d *pluginsdk.ResourceData, meta inter if err := d.Set("upgrade_settings", flattenAgentPoolUpgradeSettings(props.UpgradeSettings)); err != nil { return fmt.Errorf("setting `upgrade_settings`: %+v", err) } + if err := d.Set("windows_profile", flattenAgentPoolWindowsProfile(props.WindowsProfile)); err != nil { return fmt.Errorf("setting `windows_profile`: %+v", err) } + + if err := d.Set("node_network_profile", flattenAgentPoolNetworkProfile(props.NetworkProfile)); err != nil { + return fmt.Errorf("setting `node_network_profile`: %+v", err) + } } return tags.FlattenAndSet(d, resp.Model.Properties.Tags) @@ -1424,3 +1435,56 @@ func flattenAgentPoolWindowsProfile(input *agentpools.AgentPoolWindowsProfile) [ }, } } + +func expandAgentPoolNetworkProfile(input []interface{}) *agentpools.AgentPoolNetworkProfile { + if len(input) == 0 || input[0] == nil { + return nil + } + v := input[0].(map[string]interface{}) + return &agentpools.AgentPoolNetworkProfile{ + NodePublicIPTags: expandAgentPoolNetworkProfileNodePublicIPTags(v["node_public_ip_tags"].(map[string]interface{})), + } +} + +func expandAgentPoolNetworkProfileNodePublicIPTags(input map[string]interface{}) *[]agentpools.IPTag { + if len(input) == 0 { + return nil + } + out := make([]agentpools.IPTag, 0) + + for key, val := range input { + ipTag := agentpools.IPTag{ + IPTagType: utils.String(key), + Tag: utils.String(val.(string)), + } + out = append(out, ipTag) + } + return &out +} + +func flattenAgentPoolNetworkProfile(input *agentpools.AgentPoolNetworkProfile) []interface{} { + if input == nil || input.NodePublicIPTags == nil { + return []interface{}{} + } + + return []interface{}{ + map[string]interface{}{ + "node_public_ip_tags": flattenAgentPoolNetworkProfileNodePublicIPTags(input.NodePublicIPTags), + }, + } +} + +func flattenAgentPoolNetworkProfileNodePublicIPTags(input *[]agentpools.IPTag) map[string]interface{} { + if input == nil { + return map[string]interface{}{} + } + out := make(map[string]interface{}) + + for _, tag := range *input { + if tag.IPTagType != nil { + out[*tag.IPTagType] = tag.Tag + } + } + + return out +} diff --git a/internal/services/containers/kubernetes_cluster_node_pool_resource_test.go b/internal/services/containers/kubernetes_cluster_node_pool_resource_test.go index ec05b692628c..6dbe5ec4b291 100644 --- a/internal/services/containers/kubernetes_cluster_node_pool_resource_test.go +++ b/internal/services/containers/kubernetes_cluster_node_pool_resource_test.go @@ -600,6 +600,21 @@ func TestAccKubernetesClusterNodePool_virtualNetworkManual(t *testing.T) { }) } +func TestAccKubernetesClusterNodePool_virtualNetworkMultipleSubnet(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster_node_pool", "test") + r := KubernetesClusterNodePoolResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.virtualNetworkMultipleSubnet(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func TestAccKubernetesClusterNodePool_windows(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster_node_pool", "test") r := KubernetesClusterNodePoolResource{} @@ -918,6 +933,21 @@ func TestAccKubernetesClusterNodePool_windowsProfileOutboundNatEnabled(t *testin }) } +func TestAccKubernetesClusterNodePool_nodeIPTags(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster_node_pool", "test") + r := KubernetesClusterNodePoolResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.nodeIPTags(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func (t KubernetesClusterNodePoolResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := agentpools.ParseAgentPoolID(state.ID) if err != nil { @@ -940,9 +970,9 @@ func (KubernetesClusterNodePoolResource) scaleNodePool(nodeCount int) acceptance if err != nil { return fmt.Errorf("parsing kubernetes cluster id: %+v", err) } - parsedAgentPoolId := agentpools.NewAgentPoolID(parsedK8sId.SubscriptionId, parsedK8sId.ResourceGroupName, parsedK8sId.ResourceName, nodePoolName) + parsedAgentPoolId := agentpools.NewAgentPoolID(parsedK8sId.SubscriptionId, parsedK8sId.ResourceGroupName, parsedK8sId.ManagedClusterName, nodePoolName) - clusterName := parsedK8sId.ResourceName + clusterName := parsedK8sId.ManagedClusterName resourceGroup := parsedK8sId.ResourceGroupName nodePool, err := clients.Containers.AgentPoolsClient.Get(ctx, parsedAgentPoolId) @@ -1851,6 +1881,31 @@ resource "azurerm_kubernetes_cluster_node_pool" "test" { `, r.templateVirtualNetworkConfig(data)) } +func (r KubernetesClusterNodePoolResource) virtualNetworkMultipleSubnet(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_subnet" "test2" { + name = "acctestsubnet2%d" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test.name + address_prefixes = ["10.1.1.0/24"] +} + +resource "azurerm_kubernetes_cluster_node_pool" "test" { + name = "internal" + kubernetes_cluster_id = azurerm_kubernetes_cluster.test.id + vm_size = "Standard_DS2_v2" + node_count = 1 + vnet_subnet_id = azurerm_subnet.test2.id +} +`, r.templateVirtualNetworkConfig(data), data.RandomInteger) +} + func (r KubernetesClusterNodePoolResource) windowsConfig(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { @@ -2442,3 +2497,43 @@ resource "azurerm_kubernetes_cluster_node_pool" "test" { } `, data.Locations.Primary, data.RandomInteger) } + +func (KubernetesClusterNodePoolResource) nodeIPTags(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-aks-%[2]d" + location = "%[1]s" +} + +resource "azurerm_kubernetes_cluster" "test" { + name = "acctestaks%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + dns_prefix = "acctestaks%[2]d" + default_node_pool { + name = "default" + node_count = 1 + vm_size = "Standard_D2s_v3" + } + identity { + type = "SystemAssigned" + } +} + +resource "azurerm_kubernetes_cluster_node_pool" "test" { + name = "internal" + kubernetes_cluster_id = azurerm_kubernetes_cluster.test.id + vm_size = "Standard_D2s_v3" + enable_node_public_ip = true + node_network_profile { + node_public_ip_tags = { + RoutingPreference = "Internet" + } + } +} + `, data.Locations.Primary, data.RandomInteger) +} diff --git a/internal/services/containers/kubernetes_cluster_other_resource_test.go b/internal/services/containers/kubernetes_cluster_other_resource_test.go index 07a34efff890..dd293612b143 100644 --- a/internal/services/containers/kubernetes_cluster_other_resource_test.go +++ b/internal/services/containers/kubernetes_cluster_other_resource_test.go @@ -747,6 +747,13 @@ func TestAccKubernetesCluster_webAppRouting(t *testing.T) { ), }, data.ImportStep(), + { + Config: r.webAppRoutingWithDnsZone(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), }) } @@ -2256,7 +2263,7 @@ resource "azurerm_kubernetes_cluster" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) } -func (KubernetesClusterResource) webAppRouting(data acceptance.TestData) string { +func (KubernetesClusterResource) webAppRoutingWithDnsZone(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { features {} @@ -2295,6 +2302,45 @@ resource "azurerm_kubernetes_cluster" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) } +func (KubernetesClusterResource) webAppRouting(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-aks-%d" + location = "%s" +} + +resource "azurerm_dns_zone" "test" { + name = "acctestzone%d.com" + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_kubernetes_cluster" "test" { + name = "acctestaks%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + dns_prefix = "acctestaks%d" + + default_node_pool { + name = "default" + node_count = 1 + vm_size = "Standard_DS2_v2" + } + + identity { + type = "SystemAssigned" + } + + web_app_routing { + dns_zone_id = "" + } +} + `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) +} + func (KubernetesClusterResource) webAppRoutingDisabled(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/containers/kubernetes_cluster_resource.go b/internal/services/containers/kubernetes_cluster_resource.go index efb60c022b4a..b892859233cd 100644 --- a/internal/services/containers/kubernetes_cluster_resource.go +++ b/internal/services/containers/kubernetes_cluster_resource.go @@ -31,7 +31,11 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes" "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/migration" containerValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/validate" + keyVaultClient "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/client" + keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" + keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + resourcesClient "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/client" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -454,9 +458,12 @@ func resourceKubernetesCluster() *pluginsdk.Resource { Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "dns_zone_id": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: dnsValidate.ValidateDnsZoneID, + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.Any( + dnsValidate.ValidateDnsZoneID, + validation.StringIsEmpty, + ), }, }, }, @@ -709,6 +716,28 @@ func resourceKubernetesCluster() *pluginsdk.Resource { }, }, + "key_management_service": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: false, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "key_vault_key_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: keyVaultValidate.NestedItemId, + }, + "key_vault_network_access": { + Type: pluginsdk.TypeString, + Default: string(managedclusters.KeyVaultNetworkAccessTypesPublic), + Optional: true, + ValidateFunc: validation.StringInSlice(managedclusters.PossibleValuesForKeyVaultNetworkAccessTypes(), false), + }, + }, + }, + }, + "microsoft_defender": { Type: pluginsdk.TypeList, Optional: true, @@ -864,60 +893,6 @@ func resourceKubernetesCluster() *pluginsdk.Resource { }, false), }, - "kube_proxy": { - Type: pluginsdk.TypeList, - MaxItems: 1, - Optional: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "mode": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(managedclusters.ModeIPVS), - string(managedclusters.ModeIPTABLES), - }, false), - }, - - "ipvs": { - Type: pluginsdk.TypeList, - MaxItems: 1, - Optional: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "scheduler": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - string(managedclusters.IPvsSchedulerLeastConnection), - string(managedclusters.IPvsSchedulerRoundRobin), - }, false), - }, - - "tcp_fin_timeout_in_seconds": { - Type: pluginsdk.TypeInt, - Optional: true, - ValidateFunc: validation.IntAtLeast(0), - }, - - "tcp_timeout_in_seconds": { - Type: pluginsdk.TypeInt, - Optional: true, - ValidateFunc: validation.IntAtLeast(0), - }, - - "udp_timeout_in_seconds": { - Type: pluginsdk.TypeInt, - Optional: true, - ValidateFunc: validation.IntAtLeast(0), - }, - }, - }, - }, - }, - }, - }, - "load_balancer_profile": { Type: pluginsdk.TypeList, MaxItems: 1, @@ -1279,6 +1254,8 @@ func resourceKubernetesClusterCreate(d *pluginsdk.ResourceData, meta interface{} subscriptionId := meta.(*clients.Client).Account.SubscriptionId tenantId := meta.(*clients.Client).Account.TenantId client := meta.(*clients.Client).Containers.KubernetesClustersClient + keyVaultsClient := meta.(*clients.Client).KeyVault + resourcesClient := meta.(*clients.Client).Resource env := meta.(*clients.Client).Containers.Environment ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -1297,7 +1274,7 @@ func resourceKubernetesClusterCreate(d *pluginsdk.ResourceData, meta interface{} return tf.ImportAsExistsError("azurerm_kubernetes_cluster", id.ID()) } - if err := validateKubernetesCluster(d, nil, id.ResourceGroupName, id.ResourceName); err != nil { + if err := validateKubernetesCluster(d, nil, id.ResourceGroupName, id.ManagedClusterName); err != nil { return err } @@ -1386,12 +1363,15 @@ func resourceKubernetesClusterCreate(d *pluginsdk.ResourceData, meta interface{} publicNetworkAccess = managedclusters.PublicNetworkAccessDisabled } - microsoftDefenderRaw := d.Get("microsoft_defender").([]interface{}) - securityProfile := expandKubernetesClusterMicrosoftDefender(d, microsoftDefenderRaw) - storageProfileRaw := d.Get("storage_profile").([]interface{}) storageProfile := expandStorageProfile(storageProfileRaw) + // assemble securityProfile (Defender, WorkloadIdentity, ImageCleaner, AzureKeyVaultKms) + securityProfile := &managedclusters.ManagedClusterSecurityProfile{} + + microsoftDefenderRaw := d.Get("microsoft_defender").([]interface{}) + securityProfile.Defender = expandKubernetesClusterMicrosoftDefender(d, microsoftDefenderRaw) + workloadIdentity := false if v, ok := d.GetOk("workload_identity_enabled"); ok { workloadIdentity = v.(bool) @@ -1400,25 +1380,23 @@ func resourceKubernetesClusterCreate(d *pluginsdk.ResourceData, meta interface{} return fmt.Errorf("`oidc_issuer_enabled` must be set to `true` to enable Azure AD Workload Identity") } - if securityProfile == nil { - securityProfile = &managedclusters.ManagedClusterSecurityProfile{} - } - securityProfile.WorkloadIdentity = &managedclusters.ManagedClusterSecurityProfileWorkloadIdentity{ Enabled: &workloadIdentity, } } - if securityProfile == nil { - securityProfile = &managedclusters.ManagedClusterSecurityProfile{} - } securityProfile.ImageCleaner = &managedclusters.ManagedClusterSecurityProfileImageCleaner{ Enabled: utils.Bool(d.Get("image_cleaner_enabled").(bool)), IntervalHours: utils.Int64(int64(d.Get("image_cleaner_interval_hours").(int))), } + azureKeyVaultKmsRaw := d.Get("key_management_service").([]interface{}) + securityProfile.AzureKeyVaultKms, err = expandKubernetesClusterAzureKeyVaultKms(ctx, keyVaultsClient, resourcesClient, d, azureKeyVaultKmsRaw) + if err != nil { + return err + } + parameters := managedclusters.ManagedCluster{ - Name: utils.String(id.ResourceName), ExtendedLocation: expandEdgeZone(d.Get("edge_zone").(string)), Location: location, Sku: &managedclusters.ManagedClusterSKU{ @@ -1528,7 +1506,7 @@ func resourceKubernetesClusterCreate(d *pluginsdk.ResourceData, meta interface{} parameters := maintenanceconfigurations.MaintenanceConfiguration{ Properties: expandKubernetesClusterMaintenanceConfiguration(maintenanceConfigRaw.([]interface{})), } - maintenanceId := maintenanceconfigurations.NewMaintenanceConfigurationID(id.SubscriptionId, id.ResourceGroupName, id.ResourceName, "default") + maintenanceId := maintenanceconfigurations.NewMaintenanceConfigurationID(id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, "default") if _, err := client.CreateOrUpdate(ctx, maintenanceId, parameters); err != nil { return fmt.Errorf("creating/updating maintenance config for %s: %+v", id, err) } @@ -1542,6 +1520,8 @@ func resourceKubernetesClusterUpdate(d *pluginsdk.ResourceData, meta interface{} containersClient := meta.(*clients.Client).Containers nodePoolsClient := containersClient.AgentPoolsClient clusterClient := containersClient.KubernetesClustersClient + keyVaultsClient := meta.(*clients.Client).KeyVault + resourcesClient := meta.(*clients.Client).Resource env := containersClient.Environment ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -1563,7 +1543,7 @@ func resourceKubernetesClusterUpdate(d *pluginsdk.ResourceData, meta interface{} } props := existing.Model.Properties - if err := validateKubernetesCluster(d, existing.Model, id.ResourceGroupName, id.ResourceName); err != nil { + if err := validateKubernetesCluster(d, existing.Model, id.ResourceGroupName, id.ManagedClusterName); err != nil { return err } @@ -1653,7 +1633,7 @@ func resourceKubernetesClusterUpdate(d *pluginsdk.ResourceData, meta interface{} } } - if d.HasChange("aci_connector_linux") || d.HasChange("azure_policy_enabled") || d.HasChange("http_application_routing_enabled") || d.HasChange("oms_agent") || d.HasChange("ingress_application_gateway") || d.HasChange("open_service_mesh_enabled") || d.HasChange("key_vault_secrets_provider") { + if d.HasChange("aci_connector_linux") || d.HasChange("azure_policy_enabled") || d.HasChange("confidential_computing") || d.HasChange("http_application_routing_enabled") || d.HasChange("oms_agent") || d.HasChange("ingress_application_gateway") || d.HasChange("open_service_mesh_enabled") || d.HasChange("key_vault_secrets_provider") { updateCluster = true addOns := collectKubernetesAddons(d) addonProfiles, err := expandKubernetesAddOns(d, addOns, env) @@ -1818,10 +1798,6 @@ func resourceKubernetesClusterUpdate(d *pluginsdk.ResourceData, meta interface{} existing.Model.Properties.NetworkProfile.NatGatewayProfile = &natGatewayProfile } - - if key := "network_profile.0.kube_proxy"; d.HasChange(key) { - existing.Model.Properties.NetworkProfile.KubeProxyConfig = expandKubernetesClusterKubeProxyConfig(d.Get(key).([]interface{})) - } } if d.HasChange("tags") { @@ -1892,11 +1868,18 @@ func resourceKubernetesClusterUpdate(d *pluginsdk.ResourceData, meta interface{} existing.Model.Properties.OidcIssuerProfile = oidcIssuerProfile } + if d.HasChanges("key_management_service") { + updateCluster = true + azureKeyVaultKmsRaw := d.Get("key_management_service").([]interface{}) + azureKeyVaultKms, _ := expandKubernetesClusterAzureKeyVaultKms(ctx, keyVaultsClient, resourcesClient, d, azureKeyVaultKmsRaw) + existing.Model.Properties.SecurityProfile.AzureKeyVaultKms = azureKeyVaultKms + } + if d.HasChanges("microsoft_defender") { updateCluster = true microsoftDefenderRaw := d.Get("microsoft_defender").([]interface{}) microsoftDefender := expandKubernetesClusterMicrosoftDefender(d, microsoftDefenderRaw) - existing.Model.Properties.SecurityProfile = microsoftDefender + existing.Model.Properties.SecurityProfile.Defender = microsoftDefender } if d.HasChanges("storage_profile") { @@ -2006,7 +1989,7 @@ func resourceKubernetesClusterUpdate(d *pluginsdk.ResourceData, meta interface{} } agentProfile := ConvertDefaultNodePoolToAgentPool(agentProfiles) - defaultNodePoolId := agentpools.NewAgentPoolID(id.SubscriptionId, id.ResourceGroupName, id.ResourceName, *agentProfile.Name) + defaultNodePoolId := agentpools.NewAgentPoolID(id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, *agentProfile.Name) // if a users specified a version - confirm that version is supported on the cluster if nodePoolVersion := agentProfile.Properties.CurrentOrchestratorVersion; nodePoolVersion != nil { @@ -2040,7 +2023,7 @@ func resourceKubernetesClusterUpdate(d *pluginsdk.ResourceData, meta interface{} parameters := maintenanceconfigurations.MaintenanceConfiguration{ Properties: expandKubernetesClusterMaintenanceConfiguration(d.Get("maintenance_window").([]interface{})), } - maintenanceId := maintenanceconfigurations.NewMaintenanceConfigurationID(id.SubscriptionId, id.ResourceGroupName, id.ResourceName, "default") + maintenanceId := maintenanceconfigurations.NewMaintenanceConfigurationID(id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, "default") if _, err := client.CreateOrUpdate(ctx, maintenanceId, parameters); err != nil { return fmt.Errorf("creating/updating Maintenance Configuration for Managed Kubernetes Cluster (%q): %+v", id, err) } @@ -2077,13 +2060,13 @@ func resourceKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("retrieving %s: no payload delivered", *id) } - accessProfileId := managedclusters.NewAccessProfileID(id.SubscriptionId, id.ResourceGroupName, id.ResourceName, "clusterUser") + accessProfileId := managedclusters.NewAccessProfileID(id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, "clusterUser") profile, err := client.GetAccessProfile(ctx, accessProfileId) if err != nil { return fmt.Errorf("retrieving Access Profile for %s: %+v", *id, err) } - d.Set("name", id.ResourceName) + d.Set("name", id.ManagedClusterName) d.Set("resource_group_name", id.ResourceGroupName) d.Set("edge_zone", flattenEdgeZone(respModel.ExtendedLocation)) if location := respModel.Location; location != "" { @@ -2115,7 +2098,7 @@ func resourceKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{}) d.Set("public_network_access_enabled", publicNetworkAccess != managedclusters.PublicNetworkAccessDisabled) upgradeChannel := "" - if profile := props.AutoUpgradeProfile; profile != nil && *profile.UpgradeChannel != managedclusters.UpgradeChannelNone { + if profile := props.AutoUpgradeProfile; profile != nil && profile.UpgradeChannel != nil && *profile.UpgradeChannel != managedclusters.UpgradeChannelNone { upgradeChannel = string(*profile.UpgradeChannel) } d.Set("automatic_channel_upgrade", upgradeChannel) @@ -2161,6 +2144,7 @@ func resourceKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{}) addOns := flattenKubernetesAddOns(*props.AddonProfiles) d.Set("aci_connector_linux", addOns["aci_connector_linux"]) d.Set("azure_policy_enabled", addOns["azure_policy_enabled"].(bool)) + d.Set("confidential_computing", addOns["confidential_computing"]) d.Set("http_application_routing_enabled", addOns["http_application_routing_enabled"].(bool)) d.Set("http_application_routing_zone_name", addOns["http_application_routing_zone_name"]) d.Set("oms_agent", addOns["oms_agent"]) @@ -2281,16 +2265,21 @@ func resourceKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{}) } d.Set("workload_identity_enabled", workloadIdentity) + azureKeyVaultKms := flattenKubernetesClusterDataSourceKeyVaultKms(props.SecurityProfile.AzureKeyVaultKms) + if err := d.Set("key_management_service", azureKeyVaultKms); err != nil { + return fmt.Errorf("setting `key_management_service`: %+v", err) + } + // adminProfile is only available for RBAC enabled clusters with AAD and local account is not disabled if props.AadProfile != nil && (props.DisableLocalAccounts == nil || !*props.DisableLocalAccounts) { - accessProfileId := managedclusters.NewAccessProfileID(id.SubscriptionId, id.ResourceGroupName, id.ResourceName, "clusterAdmin") + accessProfileId := managedclusters.NewAccessProfileID(id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, "clusterAdmin") adminProfile, err := client.GetAccessProfile(ctx, accessProfileId) if err != nil { - return fmt.Errorf("retrieving Admin Access Profile for Managed Kubernetes Cluster %q (Resource Group %q): %+v", id.ResourceName, id.ResourceGroupName, err) + return fmt.Errorf("retrieving Admin Access Profile for Managed Kubernetes Cluster %q (Resource Group %q): %+v", id.ManagedClusterName, id.ResourceGroupName, err) } if adminProfile.Model == nil { - return fmt.Errorf("retrieving Admin Access Profile for Managed Kubernetes Cluster %q (Resource Group %q): no payload found", id.ResourceName, id.ResourceGroupName) + return fmt.Errorf("retrieving Admin Access Profile for Managed Kubernetes Cluster %q (Resource Group %q): no payload found", id.ManagedClusterName, id.ResourceGroupName) } adminKubeConfigRaw, adminKubeConfig := flattenKubernetesClusterAccessProfile(*adminProfile.Model) d.Set("kube_admin_config_raw", adminKubeConfigRaw) @@ -2319,7 +2308,7 @@ func resourceKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{}) } maintenanceConfigurationsClient := meta.(*clients.Client).Containers.MaintenanceConfigurationsClient - maintenanceId := maintenanceconfigurations.NewMaintenanceConfigurationID(id.SubscriptionId, id.ResourceGroupName, id.ResourceName, "default") + maintenanceId := maintenanceconfigurations.NewMaintenanceConfigurationID(id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, "default") configResp, _ := maintenanceConfigurationsClient.Get(ctx, maintenanceId) if configurationBody := configResp.Model; configurationBody != nil && configurationBody.Properties != nil { d.Set("maintenance_window", flattenKubernetesClusterMaintenanceConfiguration(configurationBody.Properties)) @@ -2340,7 +2329,7 @@ func resourceKubernetesClusterDelete(d *pluginsdk.ResourceData, meta interface{} if _, ok := d.GetOk("maintenance_window"); ok { client := meta.(*clients.Client).Containers.MaintenanceConfigurationsClient - maintenanceId := maintenanceconfigurations.NewMaintenanceConfigurationID(id.SubscriptionId, id.ResourceGroupName, id.ResourceName, "default") + maintenanceId := maintenanceconfigurations.NewMaintenanceConfigurationID(id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, "default") if _, err := client.Delete(ctx, maintenanceId); err != nil { return fmt.Errorf("deleting Maintenance Configuration for %s: %+v", *id, err) } @@ -2729,10 +2718,6 @@ func expandKubernetesClusterNetworkProfile(input []interface{}) (*managedcluster IPFamilies: ipVersions, } - if kubeProxyRaw := config["kube_proxy"].([]interface{}); len(kubeProxyRaw) != 0 { - networkProfile.KubeProxyConfig = expandKubernetesClusterKubeProxyConfig(kubeProxyRaw) - } - if ebpfDataPlane := config["ebpf_data_plane"].(string); ebpfDataPlane != "" { networkProfile.EbpfDataplane = utils.ToPtr(managedclusters.EbpfDataplane(ebpfDataPlane)) } @@ -3026,8 +3011,6 @@ func flattenKubernetesClusterNetworkProfile(profile *managedclusters.ContainerSe } } - kubeProxy := flattenKubernetesClusterKubeProxyConfig(profile.KubeProxyConfig) - networkPluginMode := "" if profile.NetworkPluginMode != nil { // The returned value has inconsistent casing @@ -3047,7 +3030,6 @@ func flattenKubernetesClusterNetworkProfile(profile *managedclusters.ContainerSe "dns_service_ip": dnsServiceIP, "docker_bridge_cidr": dockerBridgeCidr, "ebpf_data_plane": ebpfDataPlane, - "kube_proxy": kubeProxy, "load_balancer_sku": string(*sku), "load_balancer_profile": lbProfiles, "nat_gateway_profile": ngwProfiles, @@ -3441,6 +3423,41 @@ func expandKubernetesClusterAutoScalerProfile(input []interface{}) *managedclust } } +func expandKubernetesClusterAzureKeyVaultKms(ctx context.Context, keyVaultsClient *keyVaultClient.Client, resourcesClient *resourcesClient.Client, d *pluginsdk.ResourceData, input []interface{}) (*managedclusters.AzureKeyVaultKms, error) { + if ((input == nil) || len(input) == 0) && d.HasChanges("key_management_service") { + return &managedclusters.AzureKeyVaultKms{ + Enabled: utils.Bool(false), + }, nil + } else if (input == nil) || len(input) == 0 { + return nil, nil + } + + raw := input[0].(map[string]interface{}) + kvAccess := managedclusters.KeyVaultNetworkAccessTypes(raw["key_vault_network_access"].(string)) + + azureKeyVaultKms := &managedclusters.AzureKeyVaultKms{ + Enabled: utils.Bool(true), + KeyId: utils.String(raw["key_vault_key_id"].(string)), + KeyVaultNetworkAccess: &kvAccess, + } + + // Set Key vault Resource ID in case public access is disabled + if kvAccess == managedclusters.KeyVaultNetworkAccessTypesPrivate { + keyVaultKeyId, err := keyVaultParse.ParseNestedItemID(*azureKeyVaultKms.KeyId) + if err != nil { + return nil, err + } + keyVaultID, err := keyVaultsClient.KeyVaultIDFromBaseUrl(ctx, resourcesClient, keyVaultKeyId.KeyVaultBaseUrl) + if err != nil { + return nil, fmt.Errorf("retrieving the Resource ID the Key Vault at URL %q: %s", keyVaultKeyId.KeyVaultBaseUrl, err) + } + + azureKeyVaultKms.KeyVaultResourceId = keyVaultID + } + + return azureKeyVaultKms, nil +} + func expandKubernetesClusterMaintenanceConfiguration(input []interface{}) *maintenanceconfigurations.MaintenanceConfigurationProperties { if len(input) == 0 { return nil @@ -3595,13 +3612,11 @@ func flattenKubernetesClusterHttpProxyConfig(props *managedclusters.ManagedClust }) } -func expandKubernetesClusterMicrosoftDefender(d *pluginsdk.ResourceData, input []interface{}) *managedclusters.ManagedClusterSecurityProfile { +func expandKubernetesClusterMicrosoftDefender(d *pluginsdk.ResourceData, input []interface{}) *managedclusters.ManagedClusterSecurityProfileDefender { if (len(input) == 0 || input[0] == nil) && d.HasChange("microsoft_defender") { - return &managedclusters.ManagedClusterSecurityProfile{ - Defender: &managedclusters.ManagedClusterSecurityProfileDefender{ - SecurityMonitoring: &managedclusters.ManagedClusterSecurityProfileDefenderSecurityMonitoring{ - Enabled: utils.Bool(false), - }, + return &managedclusters.ManagedClusterSecurityProfileDefender{ + SecurityMonitoring: &managedclusters.ManagedClusterSecurityProfileDefenderSecurityMonitoring{ + Enabled: utils.Bool(false), }, } } else if len(input) == 0 || input[0] == nil { @@ -3609,18 +3624,16 @@ func expandKubernetesClusterMicrosoftDefender(d *pluginsdk.ResourceData, input [ } config := input[0].(map[string]interface{}) - return &managedclusters.ManagedClusterSecurityProfile{ - Defender: &managedclusters.ManagedClusterSecurityProfileDefender{ - SecurityMonitoring: &managedclusters.ManagedClusterSecurityProfileDefenderSecurityMonitoring{ - Enabled: utils.Bool(true), - }, - LogAnalyticsWorkspaceResourceId: utils.String(config["log_analytics_workspace_id"].(string)), + return &managedclusters.ManagedClusterSecurityProfileDefender{ + SecurityMonitoring: &managedclusters.ManagedClusterSecurityProfileDefenderSecurityMonitoring{ + Enabled: utils.Bool(true), }, + LogAnalyticsWorkspaceResourceId: utils.String(config["log_analytics_workspace_id"].(string)), } } func flattenKubernetesClusterMicrosoftDefender(input *managedclusters.ManagedClusterSecurityProfile) []interface{} { - if input == nil || input.Defender == nil || (input.Defender.SecurityMonitoring != nil && input.Defender.SecurityMonitoring.Enabled != nil && !*input.Defender.SecurityMonitoring.Enabled) { + if input == nil || input.Defender == nil || input.Defender.SecurityMonitoring == nil || input.Defender.SecurityMonitoring.Enabled == nil || !*input.Defender.SecurityMonitoring.Enabled { return []interface{}{} } @@ -3695,23 +3708,29 @@ func base64IsEncoded(data string) bool { } func expandKubernetesClusterIngressProfile(d *pluginsdk.ResourceData, input []interface{}) *managedclusters.ManagedClusterIngressProfile { - if (len(input) == 0 || input[0] == nil) && d.HasChange("web_app_routing") { + if len(input) == 0 && d.HasChange("web_app_routing") { return &managedclusters.ManagedClusterIngressProfile{ WebAppRouting: &managedclusters.ManagedClusterIngressProfileWebAppRouting{ Enabled: utils.Bool(false), }, } - } else if len(input) == 0 || input[0] == nil { + } else if len(input) == 0 { return nil } - config := input[0].(map[string]interface{}) - return &managedclusters.ManagedClusterIngressProfile{ + out := managedclusters.ManagedClusterIngressProfile{ WebAppRouting: &managedclusters.ManagedClusterIngressProfileWebAppRouting{ - Enabled: utils.Bool(true), - DnsZoneResourceId: utils.String(config["dns_zone_id"].(string)), + Enabled: utils.Bool(true), }, } + if input[0] != nil { + config := input[0].(map[string]interface{}) + dnsZoneResourceId := config["dns_zone_id"].(string) + if dnsZoneResourceId != "" { + out.WebAppRouting.DnsZoneResourceId = utils.String(dnsZoneResourceId) + } + } + return &out } func flattenKubernetesClusterIngressProfile(input *managedclusters.ManagedClusterIngressProfile) []interface{} { @@ -3731,49 +3750,6 @@ func flattenKubernetesClusterIngressProfile(input *managedclusters.ManagedCluste } } -func expandKubernetesClusterKubeProxyConfig(input []interface{}) *managedclusters.ContainerServiceNetworkProfileKubeProxyConfig { - if len(input) == 0 { - return &managedclusters.ContainerServiceNetworkProfileKubeProxyConfig{ - Enabled: utils.Bool(false), - } - } - config := input[0].(map[string]interface{}) - return &managedclusters.ContainerServiceNetworkProfileKubeProxyConfig{ - Enabled: utils.Bool(true), - IPvsConfig: expandKubernetesClusterKubeProxyIPvsConfig(config["ipvs"].([]interface{})), - Mode: utils.ToPtr(managedclusters.Mode(config["mode"].(string))), - } -} - -func expandKubernetesClusterKubeProxyIPvsConfig(input []interface{}) *managedclusters.ContainerServiceNetworkProfileKubeProxyConfigIPvsConfig { - if len(input) == 0 || input[0] == nil { - return nil - } - config := input[0].(map[string]interface{}) - return &managedclusters.ContainerServiceNetworkProfileKubeProxyConfigIPvsConfig{ - Scheduler: utils.ToPtr(managedclusters.IPvsScheduler(config["scheduler"].(string))), - TcpFinTimeoutSeconds: utils.Int64(int64(config["tcp_fin_timeout_in_seconds"].(int))), - TcpTimeoutSeconds: utils.Int64(int64(config["tcp_timeout_in_seconds"].(int))), - UdpTimeoutSeconds: utils.Int64(int64(config["udp_timeout_in_seconds"].(int))), - } -} - -func flattenKubernetesClusterKubeProxyConfig(input *managedclusters.ContainerServiceNetworkProfileKubeProxyConfig) []interface{} { - if input == nil || input.Enabled == nil || !*input.Enabled { - return []interface{}{} - } - mode := "" - if input.Mode != nil { - mode = string(*input.Mode) - } - return []interface{}{ - map[string]interface{}{ - "mode": mode, - "ipvs": flattenKubernetesClusterKubeProxyIPvsConfig(input.IPvsConfig), - }, - } -} - func expandKubernetesClusterAzureMonitorProfile(input []interface{}) *managedclusters.ManagedClusterAzureMonitorProfile { if len(input) == 0 { return &managedclusters.ManagedClusterAzureMonitorProfile{ @@ -3801,34 +3777,6 @@ func expandKubernetesClusterAzureMonitorProfile(input []interface{}) *managedclu } } -func flattenKubernetesClusterKubeProxyIPvsConfig(input *managedclusters.ContainerServiceNetworkProfileKubeProxyConfigIPvsConfig) []interface{} { - if input == nil { - return []interface{}{} - } - scheduler := "" - if input.Scheduler != nil { - scheduler = string(*input.Scheduler) - } - var tcpFinTimeout, tcpTimeout, udpTimeout int64 - if input.TcpFinTimeoutSeconds != nil { - tcpFinTimeout = *input.TcpFinTimeoutSeconds - } - if input.TcpTimeoutSeconds != nil { - tcpTimeout = *input.TcpTimeoutSeconds - } - if input.UdpTimeoutSeconds != nil { - udpTimeout = *input.UdpTimeoutSeconds - } - return []interface{}{ - map[string]interface{}{ - "scheduler": scheduler, - "tcp_fin_timeout_in_seconds": tcpFinTimeout, - "tcp_timeout_in_seconds": tcpTimeout, - "udp_timeout_in_seconds": udpTimeout, - }, - } -} - func flattenKubernetesClusterAzureMonitorProfile(input *managedclusters.ManagedClusterAzureMonitorProfile) []interface{} { if input == nil || input.Metrics == nil || !input.Metrics.Enabled { return nil diff --git a/internal/services/containers/kubernetes_cluster_resource_test.go b/internal/services/containers/kubernetes_cluster_resource_test.go index 527894cb4d76..1041bd086522 100644 --- a/internal/services/containers/kubernetes_cluster_resource_test.go +++ b/internal/services/containers/kubernetes_cluster_resource_test.go @@ -18,10 +18,10 @@ import ( type KubernetesClusterResource struct{} var ( - olderKubernetesVersion = "1.23.12" - currentKubernetesVersion = "1.24.3" - olderKubernetesVersionAlias = "1.23" - currentKubernetesVersionAlias = "1.24" + olderKubernetesVersion = "1.24.9" + currentKubernetesVersion = "1.25.5" + olderKubernetesVersionAlias = "1.24" + currentKubernetesVersionAlias = "1.25" ) func TestAccKubernetesCluster_hostEncryption(t *testing.T) { @@ -75,6 +75,26 @@ func TestAccKubernetesCluster_runCommand(t *testing.T) { }) } +func TestAccKubernetesCluster_keyVaultKms(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster", "test") + r := KubernetesClusterResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.azureKeyVaultKms(data, currentKubernetesVersion, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + { + Config: r.azureKeyVaultKms(data, currentKubernetesVersion, false), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + }) +} + func TestAccKubernetesCluster_storageProfile(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster", "test") r := KubernetesClusterResource{} @@ -460,13 +480,13 @@ resource "azurerm_kubernetes_cluster" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, maxSurge) } -func TestAccResourceKubernetesCluster_roleBasedAccessControlAAD_VOneDotTwoFourDotThree(t *testing.T) { +func TestAccResourceKubernetesCluster_roleBasedAccessControlAAD_VOneDotTwoFourDotNine(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster", "test") r := KubernetesClusterResource{} data.ResourceTest(t, r, []acceptance.TestStep{ { - Config: r.roleBasedAccessControlAADManagedConfigVOneDotTwoFourDotThree(data, ""), + Config: r.roleBasedAccessControlAADManagedConfigVOneDotTwoFourDotNine(data, ""), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).Key("kube_config.#").HasValue("1"), check.That(data.ResourceName).Key("kube_config.0.host").IsSet(), @@ -513,6 +533,87 @@ resource "azurerm_kubernetes_cluster" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, controlPlaneVersion, tag) } +func (KubernetesClusterResource) azureKeyVaultKms(data acceptance.TestData, controlPlaneVersion string, enabled bool) string { + kmsBlock := "" + if enabled { + kmsBlock = ` + key_management_service { + key_vault_key_id = azurerm_key_vault_key.test.id + }` + } + + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-aks-%[1]d" + location = "%[2]s" +} + +resource "azurerm_key_vault" "test" { + name = substr("acctest%[1]d", 0, 24) + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + tenant_id = data.azurerm_client_config.current.tenant_id + enable_rbac_authorization = true + sku_name = "standard" +} + +resource "azurerm_role_assignment" "test_admin" { + scope = azurerm_key_vault.test.id + role_definition_name = "Key Vault Administrator" + principal_id = data.azurerm_client_config.current.object_id +} + +resource "azurerm_role_assignment" "test" { + scope = azurerm_key_vault.test.id + role_definition_name = "Key Vault Crypto User" + principal_id = azurerm_user_assigned_identity.test.principal_id +} + +resource "azurerm_key_vault_key" "test" { + name = "etcd-encryption" + key_vault_id = azurerm_key_vault.test.id + key_type = "RSA" + key_size = 2048 + key_opts = ["decrypt", "encrypt", "sign", "unwrapKey", "verify", "wrapKey"] + + depends_on = [azurerm_role_assignment.test_admin] +} + +resource "azurerm_user_assigned_identity" "test" { + name = "acctest%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} + +resource "azurerm_kubernetes_cluster" "test" { + name = "acctestaks%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + node_resource_group = "${azurerm_resource_group.test.name}-infra" + dns_prefix = "acctestaks%[1]d" + kubernetes_version = %[3]q + + default_node_pool { + name = "default" + node_count = 1 + vm_size = "Standard_DS2_v2" + } + + identity { + type = "UserAssigned" + identity_ids = [azurerm_user_assigned_identity.test.id] + } + %[4]s +} +`, data.RandomInteger, data.Locations.Primary, controlPlaneVersion, kmsBlock) +} + func (KubernetesClusterResource) storageProfile(data acceptance.TestData, controlPlaneVersion string) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/containers/kubernetes_cluster_validate.go b/internal/services/containers/kubernetes_cluster_validate.go index de46b3056ac0..439dad75f8ce 100644 --- a/internal/services/containers/kubernetes_cluster_validate.go +++ b/internal/services/containers/kubernetes_cluster_validate.go @@ -266,7 +266,7 @@ details can be found at https://aka.ms/version-skew-policy. func validateNodePoolSupportsVersion(ctx context.Context, client *client.Client, currentNodePoolVersion string, defaultNodePoolId agentpools.AgentPoolId, desiredNodePoolVersion string) error { // confirm the version being used is >= the version of the control plane - clusterId := agentpools.NewManagedClusterID(defaultNodePoolId.SubscriptionId, defaultNodePoolId.ResourceGroupName, defaultNodePoolId.ResourceName) + clusterId := agentpools.NewManagedClusterID(defaultNodePoolId.SubscriptionId, defaultNodePoolId.ResourceGroupName, defaultNodePoolId.ManagedClusterName) resp, err := client.AgentPoolsClient.GetAvailableAgentPoolVersions(ctx, clusterId) if err != nil { return fmt.Errorf("retrieving Available Agent Pool Versions for %s: %+v", defaultNodePoolId, err) @@ -296,7 +296,7 @@ func validateNodePoolSupportsVersion(ctx context.Context, client *client.Client, } if !versionExists { - clusterId := managedclusters.NewManagedClusterID(defaultNodePoolId.SubscriptionId, defaultNodePoolId.ResourceGroupName, defaultNodePoolId.ResourceName) + clusterId := managedclusters.NewManagedClusterID(defaultNodePoolId.SubscriptionId, defaultNodePoolId.ResourceGroupName, defaultNodePoolId.ManagedClusterName) cluster, err := client.KubernetesClustersClient.Get(ctx, clusterId) if err != nil { if !response.WasStatusCode(cluster.HttpResponse, http.StatusUnauthorized) { @@ -310,7 +310,7 @@ func validateNodePoolSupportsVersion(ctx context.Context, client *client.Client, clusterVersion = clusterModel.Properties.CurrentKubernetesVersion } - return clusterControlPlaneMustBeUpgradedError(defaultNodePoolId.ResourceGroupName, defaultNodePoolId.ResourceName, defaultNodePoolId.AgentPoolName, clusterVersion, desiredNodePoolVersion, supportedVersions) + return clusterControlPlaneMustBeUpgradedError(defaultNodePoolId.ResourceGroupName, defaultNodePoolId.ManagedClusterName, defaultNodePoolId.AgentPoolName, clusterVersion, desiredNodePoolVersion, supportedVersions) } return nil diff --git a/internal/services/containers/kubernetes_nodepool.go b/internal/services/containers/kubernetes_nodepool.go index 01aa18ee0ce6..09e3387ab043 100644 --- a/internal/services/containers/kubernetes_nodepool.go +++ b/internal/services/containers/kubernetes_nodepool.go @@ -137,6 +137,8 @@ func SchemaDefaultNodePool() *pluginsdk.Schema { ValidateFunc: validation.IntBetween(1, 1000), }, + "node_network_profile": schemaNodePoolNetworkProfile(), + "node_count": { Type: pluginsdk.TypeInt, Optional: true, @@ -350,6 +352,7 @@ func schemaNodePoolKubeletConfig() *pluginsdk.Schema { ForceNew: true, }, + // TODO 4.0: change this to `container_log_max_files` "container_log_max_line": { Type: pluginsdk.TypeInt, Optional: true, @@ -625,6 +628,26 @@ func schemaNodePoolSysctlConfig() *pluginsdk.Schema { } } +func schemaNodePoolNetworkProfile() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "node_public_ip_tags": { + Type: pluginsdk.TypeMap, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + }, + }, + } +} + func ConvertDefaultNodePoolToAgentPool(input *[]managedclusters.ManagedClusterAgentPoolProfile) agentpools.AgentPool { defaultCluster := (*input)[0] @@ -685,6 +708,20 @@ func ConvertDefaultNodePoolToAgentPool(input *[]managedclusters.ManagedClusterAg } agentpool.Properties.LinuxOSConfig = &linuxOsConfig } + if networkProfileRaw := defaultCluster.NetworkProfile; networkProfileRaw != nil { + networkProfile := agentpools.AgentPoolNetworkProfile{} + if nodePublicIPTagsRaw := networkProfileRaw.NodePublicIPTags; nodePublicIPTagsRaw != nil { + ipTags := make([]agentpools.IPTag, 0) + for _, ipTagRaw := range *nodePublicIPTagsRaw { + ipTags = append(ipTags, agentpools.IPTag{ + IPTagType: ipTagRaw.IPTagType, + Tag: ipTagRaw.Tag, + }) + } + networkProfile.NodePublicIPTags = &ipTags + } + agentpool.Properties.NetworkProfile = &networkProfile + } if osTypeNodePool := defaultCluster.OsType; osTypeNodePool != nil { agentpool.Properties.OsType = utils.ToPtr(agentpools.OSType(string(*osTypeNodePool))) } @@ -897,6 +934,10 @@ func ExpandDefaultNodePool(d *pluginsdk.ResourceData) (*[]managedclusters.Manage profile.LinuxOSConfig = linuxOSConfig } + if networkProfile := raw["node_network_profile"].([]interface{}); len(networkProfile) > 0 { + profile.NetworkProfile = expandClusterPoolNetworkProfile(networkProfile) + } + return &[]managedclusters.ManagedClusterAgentPoolProfile{ profile, }, nil @@ -1239,6 +1280,8 @@ func FlattenDefaultNodePool(input *[]managedclusters.ManagedClusterAgentPoolProf return nil, err } + networkProfile := flattenClusterPoolNetworkProfile(agentPool.NetworkProfile) + out := map[string]interface{}{ "enable_auto_scaling": enableAutoScaling, "enable_node_public_ip": enableNodePublicIP, @@ -1254,6 +1297,7 @@ func FlattenDefaultNodePool(input *[]managedclusters.ManagedClusterAgentPoolProf "name": name, "node_count": count, "node_labels": nodeLabels, + "node_network_profile": networkProfile, "node_public_ip_prefix_id": nodePublicIPPrefixID, "node_taints": []string{}, "os_disk_size_gb": osDiskSizeGB, @@ -1654,3 +1698,56 @@ func expandClusterNodePoolUpgradeSettings(input []interface{}) *managedclusters. } return setting } + +func expandClusterPoolNetworkProfile(input []interface{}) *managedclusters.AgentPoolNetworkProfile { + if len(input) == 0 || input[0] == nil { + return nil + } + v := input[0].(map[string]interface{}) + return &managedclusters.AgentPoolNetworkProfile{ + NodePublicIPTags: expandClusterPoolNetworkProfileNodePublicIPTags(v["node_public_ip_tags"].(map[string]interface{})), + } +} + +func expandClusterPoolNetworkProfileNodePublicIPTags(input map[string]interface{}) *[]managedclusters.IPTag { + if len(input) == 0 { + return nil + } + out := make([]managedclusters.IPTag, 0) + + for key, val := range input { + ipTag := managedclusters.IPTag{ + IPTagType: utils.String(key), + Tag: utils.String(val.(string)), + } + out = append(out, ipTag) + } + return &out +} + +func flattenClusterPoolNetworkProfile(input *managedclusters.AgentPoolNetworkProfile) []interface{} { + if input == nil || input.NodePublicIPTags == nil { + return []interface{}{} + } + + return []interface{}{ + map[string]interface{}{ + "node_public_ip_tags": flattenClusterPoolNetworkProfileNodePublicIPTags(input.NodePublicIPTags), + }, + } +} + +func flattenClusterPoolNetworkProfileNodePublicIPTags(input *[]managedclusters.IPTag) map[string]interface{} { + if input == nil { + return map[string]interface{}{} + } + out := make(map[string]interface{}) + + for _, tag := range *input { + if tag.IPTagType != nil { + out[*tag.IPTagType] = tag.Tag + } + } + + return out +} diff --git a/internal/services/containers/kubernetes_service_version_data_source.go b/internal/services/containers/kubernetes_service_version_data_source.go index af5374037a84..8931a2cc7039 100644 --- a/internal/services/containers/kubernetes_service_version_data_source.go +++ b/internal/services/containers/kubernetes_service_version_data_source.go @@ -6,14 +6,15 @@ import ( "strings" "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices" "github.com/hashicorp/go-version" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceKubernetesServiceVersions() *pluginsdk.Resource { @@ -58,11 +59,12 @@ func dataSourceKubernetesServiceVersionsRead(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewServiceVersionID(subscriptionId, azure.NormalizeLocation(d.Get("location").(string))) - - listResp, err := client.ListOrchestrators(ctx, id.LocationName, "managedClusters") + id := containerservices.NewLocationID(subscriptionId, location.Normalize(d.Get("location").(string))) + options := containerservices.DefaultListOrchestratorsOperationOptions() + options.ResourceType = pointer.To("managedClusters") + listResp, err := client.ListOrchestrators(ctx, id, options) if err != nil { - if utils.ResponseWasNotFound(listResp.Response) { + if response.WasNotFound(listResp.HttpResponse) { return fmt.Errorf("Error: No Kubernetes Service versions found for location %q", id.LocationName) } return fmt.Errorf("retrieving Kubernetes Versions in %q: %+v", id.LocationName, err) @@ -77,49 +79,43 @@ func dataSourceKubernetesServiceVersionsRead(d *pluginsdk.ResourceData, meta int versionPrefix := d.Get("version_prefix").(string) includePreview := d.Get("include_preview").(bool) - if props := listResp.OrchestratorVersionProfileProperties; props != nil { - if orchestrators := props.Orchestrators; orchestrators != nil { - for _, rawV := range *orchestrators { - if rawV.OrchestratorType == nil || rawV.OrchestratorVersion == nil { - continue - } - - isPreview := false - orchestratorType := *rawV.OrchestratorType - kubeVersion := *rawV.OrchestratorVersion - - if rawV.IsPreview == nil { - log.Printf("[DEBUG] IsPreview is nil") - } else { - isPreview = *rawV.IsPreview - log.Printf("[DEBUG] IsPreview is %t", isPreview) - } - - if !strings.EqualFold(orchestratorType, "Kubernetes") { - log.Printf("[DEBUG] Orchestrator %q was not Kubernetes", orchestratorType) - continue - } - - if versionPrefix != "" && !strings.HasPrefix(kubeVersion, versionPrefix) { - log.Printf("[DEBUG] Version %q doesn't match the prefix %q", kubeVersion, versionPrefix) - continue - } - - if isPreview && !includePreview { - log.Printf("[DEBUG] Orchestrator %q is a preview release, ignoring", kubeVersion) - continue - } - - versions = append(versions, kubeVersion) - v, err := version.NewVersion(kubeVersion) - if err != nil { - log.Printf("[WARN] Cannot parse orchestrator version %q - skipping: %s", kubeVersion, err) - continue - } - - if v.GreaterThan(lv) { - lv = v - } + if model := listResp.Model; model != nil { + for _, rawV := range model.Properties.Orchestrators { + isPreview := false + orchestratorType := rawV.OrchestratorType + kubeVersion := rawV.OrchestratorVersion + + if rawV.IsPreview == nil { + log.Printf("[DEBUG] IsPreview is nil") + } else { + isPreview = *rawV.IsPreview + log.Printf("[DEBUG] IsPreview is %t", isPreview) + } + + if !strings.EqualFold(orchestratorType, "Kubernetes") { + log.Printf("[DEBUG] Orchestrator %q was not Kubernetes", orchestratorType) + continue + } + + if versionPrefix != "" && !strings.HasPrefix(kubeVersion, versionPrefix) { + log.Printf("[DEBUG] Version %q doesn't match the prefix %q", kubeVersion, versionPrefix) + continue + } + + if isPreview && !includePreview { + log.Printf("[DEBUG] Orchestrator %q is a preview release, ignoring", kubeVersion) + continue + } + + versions = append(versions, kubeVersion) + v, err := version.NewVersion(kubeVersion) + if err != nil { + log.Printf("[WARN] Cannot parse orchestrator version %q - skipping: %s", kubeVersion, err) + continue + } + + if v.GreaterThan(lv) { + lv = v } } } diff --git a/internal/services/containers/migration/kubernetes_cluster_node_pool.go b/internal/services/containers/migration/kubernetes_cluster_node_pool.go index b44bf2ba2755..c0961a4c5a23 100644 --- a/internal/services/containers/migration/kubernetes_cluster_node_pool.go +++ b/internal/services/containers/migration/kubernetes_cluster_node_pool.go @@ -141,6 +141,7 @@ func (k KubernetesClusterNodePoolV0ToV1) Schema() map[string]*pluginsdk.Schema { Optional: true, }, + // TODO 4.0: change this to `container_log_max_files` "container_log_max_line": { Type: pluginsdk.TypeInt, Optional: true, diff --git a/internal/services/cosmos/cosmosdb_account_resource.go b/internal/services/cosmos/cosmosdb_account_resource.go index 4515f701cc4a..87306661d0f2 100644 --- a/internal/services/cosmos/cosmosdb_account_resource.go +++ b/internal/services/cosmos/cosmosdb_account_resource.go @@ -45,36 +45,45 @@ var connStringPropertyMap = map[string]string{ type databaseAccountCapabilities string const ( - databaseAccountCapabilitiesEnableAggregationPipeline databaseAccountCapabilities = "EnableAggregationPipeline" - databaseAccountCapabilitiesEnableCassandra databaseAccountCapabilities = "EnableCassandra" - databaseAccountCapabilitiesEnableGremlin databaseAccountCapabilities = "EnableGremlin" - databaseAccountCapabilitiesEnableTable databaseAccountCapabilities = "EnableTable" - databaseAccountCapabilitiesEnableServerless databaseAccountCapabilities = "EnableServerless" - databaseAccountCapabilitiesEnableMongo databaseAccountCapabilities = "EnableMongo" - databaseAccountCapabilitiesEnableMongo16MBDocumentSupport databaseAccountCapabilities = "EnableMongo16MBDocumentSupport" - databaseAccountCapabilitiesMongoDBv34 databaseAccountCapabilities = "MongoDBv3.4" - databaseAccountCapabilitiesMongoEnableDocLevelTTL databaseAccountCapabilities = "mongoEnableDocLevelTTL" - databaseAccountCapabilitiesDisableRateLimitingResponses databaseAccountCapabilities = "DisableRateLimitingResponses" - databaseAccountCapabilitiesAllowSelfServeUpgradeToMongo36 databaseAccountCapabilities = "AllowSelfServeUpgradeToMongo36" + databaseAccountCapabilitiesEnableAggregationPipeline databaseAccountCapabilities = "EnableAggregationPipeline" + databaseAccountCapabilitiesEnableCassandra databaseAccountCapabilities = "EnableCassandra" + databaseAccountCapabilitiesEnableGremlin databaseAccountCapabilities = "EnableGremlin" + databaseAccountCapabilitiesEnableTable databaseAccountCapabilities = "EnableTable" + databaseAccountCapabilitiesEnableServerless databaseAccountCapabilities = "EnableServerless" + databaseAccountCapabilitiesEnableMongo databaseAccountCapabilities = "EnableMongo" + databaseAccountCapabilitiesEnableMongo16MBDocumentSupport databaseAccountCapabilities = "EnableMongo16MBDocumentSupport" + databaseAccountCapabilitiesMongoDBv34 databaseAccountCapabilities = "MongoDBv3.4" + databaseAccountCapabilitiesMongoEnableDocLevelTTL databaseAccountCapabilities = "mongoEnableDocLevelTTL" + databaseAccountCapabilitiesDisableRateLimitingResponses databaseAccountCapabilities = "DisableRateLimitingResponses" + databaseAccountCapabilitiesAllowSelfServeUpgradeToMongo36 databaseAccountCapabilities = "AllowSelfServeUpgradeToMongo36" + databaseAccountCapabilitiesEnableMongoRetryableWrites databaseAccountCapabilities = "EnableMongoRetryableWrites" + databaseAccountCapabilitiesEnableMongoRoleBasedAccessControl databaseAccountCapabilities = "EnableMongoRoleBasedAccessControl" + databaseAccountCapabilitiesEnableUniqueCompoundNestedDocs databaseAccountCapabilities = "EnableUniqueCompoundNestedDocs" ) /* The mapping of capabilities and kinds of cosmosdb account confirmed by service team is as follows: -EnableMongo : MongoDB -EnableCassandra : GlobalDocumentDB, Parse -EnableGremlin : GlobalDocumentDB, Parse -EnableTable : GlobalDocumentDB, Parse -EnableAggregationPipeline : GlobalDocumentDB, MongoDB, Parse -EnableServerless : GlobalDocumentDB, MongoDB, Parse -MongoDBv3.4 : GlobalDocumentDB, MongoDB, Parse -mongoEnableDocLevelTTL : GlobalDocumentDB, MongoDB, Parse -DisableRateLimitingResponses : GlobalDocumentDB, MongoDB, Parse -AllowSelfServeUpgradeToMongo36 : GlobalDocumentDB, MongoDB, Parse +EnableMongo : MongoDB +EnableCassandra : GlobalDocumentDB, Parse +EnableGremlin : GlobalDocumentDB, Parse +EnableTable : GlobalDocumentDB, Parse +EnableAggregationPipeline : GlobalDocumentDB, MongoDB, Parse +EnableServerless : GlobalDocumentDB, MongoDB, Parse +MongoDBv3.4 : GlobalDocumentDB, MongoDB, Parse +mongoEnableDocLevelTTL : GlobalDocumentDB, MongoDB, Parse +DisableRateLimitingResponses : GlobalDocumentDB, MongoDB, Parse +AllowSelfServeUpgradeToMongo36 : GlobalDocumentDB, MongoDB, Parse +EnableMongoRetryableWrites : MongoDB +EnableMongoRoleBasedAccessControl : MongoDB +EnableUniqueCompoundNestedDocs : MongoDB */ var capabilitiesToKindMap = map[string]interface{}{ strings.ToLower(string(databaseAccountCapabilitiesEnableMongo)): []string{strings.ToLower(string(documentdb.DatabaseAccountKindMongoDB))}, strings.ToLower(string(databaseAccountCapabilitiesEnableMongo16MBDocumentSupport)): []string{strings.ToLower(string(documentdb.DatabaseAccountKindMongoDB))}, + strings.ToLower(string(databaseAccountCapabilitiesEnableMongoRetryableWrites)): []string{strings.ToLower(string(documentdb.DatabaseAccountKindMongoDB))}, + strings.ToLower(string(databaseAccountCapabilitiesEnableMongoRetryableWrites)): []string{strings.ToLower(string(documentdb.DatabaseAccountKindMongoDB))}, + strings.ToLower(string(databaseAccountCapabilitiesEnableUniqueCompoundNestedDocs)): []string{strings.ToLower(string(documentdb.DatabaseAccountKindMongoDB))}, strings.ToLower(string(databaseAccountCapabilitiesEnableCassandra)): []string{strings.ToLower(string(documentdb.DatabaseAccountKindGlobalDocumentDB)), strings.ToLower(string(documentdb.DatabaseAccountKindParse))}, strings.ToLower(string(databaseAccountCapabilitiesEnableGremlin)): []string{strings.ToLower(string(documentdb.DatabaseAccountKindGlobalDocumentDB)), strings.ToLower(string(documentdb.DatabaseAccountKindParse))}, strings.ToLower(string(databaseAccountCapabilitiesEnableTable)): []string{strings.ToLower(string(documentdb.DatabaseAccountKindGlobalDocumentDB)), strings.ToLower(string(documentdb.DatabaseAccountKindParse))}, @@ -396,6 +405,9 @@ func resourceCosmosDbAccount() *pluginsdk.Resource { string(databaseAccountCapabilitiesMongoEnableDocLevelTTL), string(databaseAccountCapabilitiesDisableRateLimitingResponses), string(databaseAccountCapabilitiesAllowSelfServeUpgradeToMongo36), + string(databaseAccountCapabilitiesEnableMongoRetryableWrites), + string(databaseAccountCapabilitiesEnableMongoRoleBasedAccessControl), + string(databaseAccountCapabilitiesEnableUniqueCompoundNestedDocs), }, false), }, }, @@ -1854,18 +1866,22 @@ func flattenCosmosdbAccountDatabasesToRestore(input *[]documentdb.DatabaseRestor } func checkCapabilitiesCanBeUpdated(kind string, oldCapabilities *[]documentdb.Capability, newCapabilities *[]documentdb.Capability) bool { - // The feedback from service team : "DisableRateLimitingResponses", "AllowSelfServeUpgradeToMongo36","EnableAggregationPipeline","MongoDBv3.4" - // , "mongoEnableDocLevelTTL" and "EnableMongo16MBDocumentSupport" of capabilities can be added to an existing account, others can not. + // The feedback from service team : capabilities that can be added to an existing account canBeAddedCaps := []string{ strings.ToLower(string(databaseAccountCapabilitiesDisableRateLimitingResponses)), strings.ToLower(string(databaseAccountCapabilitiesAllowSelfServeUpgradeToMongo36)), strings.ToLower(string(databaseAccountCapabilitiesEnableAggregationPipeline)), strings.ToLower(string(databaseAccountCapabilitiesMongoDBv34)), strings.ToLower(string(databaseAccountCapabilitiesMongoEnableDocLevelTTL)), - strings.ToLower(string(databaseAccountCapabilitiesEnableMongo16MBDocumentSupport))} + strings.ToLower(string(databaseAccountCapabilitiesEnableMongo16MBDocumentSupport)), + strings.ToLower(string(databaseAccountCapabilitiesEnableMongoRetryableWrites)), + strings.ToLower(string(databaseAccountCapabilitiesEnableMongoRoleBasedAccessControl)), + strings.ToLower(string(databaseAccountCapabilitiesEnableUniqueCompoundNestedDocs)), + } - // The feedback from service team : only "DisableRateLimitingResponses" of capabilities can be removed to an existing account. + // The feedback from service team: capabilities that can be removed from an existing account canBeRemovedCaps := []string{ + strings.ToLower(string(databaseAccountCapabilitiesEnableMongoRetryableWrites)), strings.ToLower(string(databaseAccountCapabilitiesDisableRateLimitingResponses)), } diff --git a/internal/services/cosmos/cosmosdb_account_resource_test.go b/internal/services/cosmos/cosmosdb_account_resource_test.go index ed8320860d9a..b7c917ab9c70 100644 --- a/internal/services/cosmos/cosmosdb_account_resource_test.go +++ b/internal/services/cosmos/cosmosdb_account_resource_test.go @@ -2891,6 +2891,18 @@ resource "azurerm_cosmosdb_account" "test" { name = "EnableMongo16MBDocumentSupport" } + capabilities { + name = "EnableMongoRetryableWrites" + } + + capabilities { + name = "EnableMongoRoleBasedAccessControl" + } + + capabilities { + name = "EnableUniqueCompoundNestedDocs" + } + consistency_policy { consistency_level = "%s" } diff --git a/internal/services/cosmos/cosmosdb_cassandra_cluster_resource.go b/internal/services/cosmos/cosmosdb_cassandra_cluster_resource.go index f626bb5bc70b..e9cf0d0e1a9d 100644 --- a/internal/services/cosmos/cosmosdb_cassandra_cluster_resource.go +++ b/internal/services/cosmos/cosmosdb_cassandra_cluster_resource.go @@ -222,7 +222,7 @@ func resourceCassandraClusterRead(d *pluginsdk.ResourceData, meta interface{}) e } d.Set("resource_group_name", id.ResourceGroupName) - d.Set("name", id.ClusterName) + d.Set("name", id.CassandraClusterName) if model := resp.Model; model != nil { d.Set("location", location.NormalizeNilable(model.Location)) diff --git a/internal/services/cosmos/cosmosdb_sql_dedicated_gateway_resource.go b/internal/services/cosmos/cosmosdb_sql_dedicated_gateway_resource.go index 865c1d443f08..a575a0bd9ad0 100644 --- a/internal/services/cosmos/cosmosdb_sql_dedicated_gateway_resource.go +++ b/internal/services/cosmos/cosmosdb_sql_dedicated_gateway_resource.go @@ -82,7 +82,7 @@ func (r CosmosDbSqlDedicatedGatewayResource) Create() sdk.ResourceFunc { return err } - id := sqldedicatedgateway.NewServiceID(cosmosdbAccountId.SubscriptionId, cosmosdbAccountId.ResourceGroupName, cosmosdbAccountId.AccountName, string(sqldedicatedgateway.ServiceTypeSqlDedicatedGateway)) + id := sqldedicatedgateway.NewServiceID(cosmosdbAccountId.SubscriptionId, cosmosdbAccountId.ResourceGroupName, cosmosdbAccountId.DatabaseAccountName, string(sqldedicatedgateway.ServiceTypeSqlDedicatedGateway)) existing, err := client.ServiceGet(ctx, id) if err != nil && !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing %s: %+v", id, err) @@ -183,7 +183,7 @@ func (r CosmosDbSqlDedicatedGatewayResource) Read() sdk.ResourceFunc { } state := CosmosDbSqlDedicatedGatewayModel{ - CosmosDbAccountId: cosmosdb.NewDatabaseAccountID(id.SubscriptionId, id.ResourceGroupName, id.AccountName).ID(), + CosmosDbAccountId: cosmosdb.NewDatabaseAccountID(id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName).ID(), } if props := model.Properties; props != nil { diff --git a/internal/services/costmanagement/export_base_resource.go b/internal/services/costmanagement/export_base_resource.go deleted file mode 100644 index 094d2f2d94aa..000000000000 --- a/internal/services/costmanagement/export_base_resource.go +++ /dev/null @@ -1,377 +0,0 @@ -package costmanagement - -import ( - "context" - "fmt" - "time" - - "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports" - "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" - "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - storageParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" - storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" - "github.com/hashicorp/terraform-provider-azurerm/utils" -) - -type costManagementExportBaseResource struct{} - -func (br costManagementExportBaseResource) arguments(fields map[string]*pluginsdk.Schema) map[string]*pluginsdk.Schema { - output := map[string]*pluginsdk.Schema{ - "active": { - Type: pluginsdk.TypeBool, - Optional: true, - Default: true, - }, - - "recurrence_type": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(exports.RecurrenceTypeDaily), - string(exports.RecurrenceTypeWeekly), - string(exports.RecurrenceTypeMonthly), - string(exports.RecurrenceTypeAnnually), - }, false), - }, - - "recurrence_period_start_date": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.IsRFC3339Time, - }, - - "recurrence_period_end_date": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.IsRFC3339Time, - }, - - "export_data_storage_location": { - Type: pluginsdk.TypeList, - MaxItems: 1, - Required: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "container_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: storageValidate.StorageContainerResourceManagerID, - }, - "root_folder_path": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - }, - }, - }, - - "export_data_options": { - Type: pluginsdk.TypeList, - MaxItems: 1, - Required: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "type": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(exports.ExportTypeActualCost), - string(exports.ExportTypeAmortizedCost), - string(exports.ExportTypeUsage), - }, false), - }, - - "time_frame": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(exports.TimeframeTypeCustom), - string(exports.TimeframeTypeBillingMonthToDate), - string(exports.TimeframeTypeTheLastBillingMonth), - string(exports.TimeframeTypeTheLastMonth), - string(exports.TimeframeTypeWeekToDate), - string(exports.TimeframeTypeMonthToDate), - }, false), - }, - }, - }, - }, - } - - for k, v := range fields { - output[k] = v - } - - return output -} - -func (br costManagementExportBaseResource) attributes() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{} -} - -func (br costManagementExportBaseResource) createFunc(resourceName, scopeFieldName string) sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.CostManagement.ExportClient - id := exports.NewScopedExportID(metadata.ResourceData.Get(scopeFieldName).(string), metadata.ResourceData.Get("name").(string)) - var opts exports.GetOperationOptions - existing, err := client.Get(ctx, id, opts) - if err != nil { - if !response.WasNotFound(existing.HttpResponse) { - return fmt.Errorf("checking for presence of existing %s: %+v", id, err) - } - } - - if !response.WasNotFound(existing.HttpResponse) { - return tf.ImportAsExistsError(resourceName, id.ID()) - } - - if err := createOrUpdateCostManagementExport(ctx, client, metadata, id, nil); err != nil { - return fmt.Errorf("creating %s: %+v", id, err) - } - - metadata.SetID(id) - return nil - }, - } -} - -func (br costManagementExportBaseResource) readFunc(scopeFieldName string) sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 5 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.CostManagement.ExportClient - - id, err := exports.ParseScopedExportID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - var opts exports.GetOperationOptions - resp, err := client.Get(ctx, *id, opts) - if err != nil { - if response.WasNotFound(resp.HttpResponse) { - return metadata.MarkAsGone(id) - } - return fmt.Errorf("reading %s: %+v", *id, err) - } - - metadata.ResourceData.Set("name", id.ExportName) - //lintignore:R001 - metadata.ResourceData.Set(scopeFieldName, id.Scope) - - if model := resp.Model; model != nil { - if props := model.Properties; props != nil { - if schedule := props.Schedule; schedule != nil { - if recurrencePeriod := schedule.RecurrencePeriod; recurrencePeriod != nil { - metadata.ResourceData.Set("recurrence_period_start_date", recurrencePeriod.From) - metadata.ResourceData.Set("recurrence_period_end_date", recurrencePeriod.To) - } - status := *schedule.Status == exports.StatusTypeActive - - metadata.ResourceData.Set("active", status) - metadata.ResourceData.Set("recurrence_type", schedule.Recurrence) - } - - exportDeliveryInfo, err := flattenExportDataStorageLocation(&props.DeliveryInfo) - if err != nil { - return fmt.Errorf("flattening `export_data_storage_location`: %+v", err) - } - if err := metadata.ResourceData.Set("export_data_storage_location", exportDeliveryInfo); err != nil { - return fmt.Errorf("setting `export_data_storage_location`: %+v", err) - } - if err := metadata.ResourceData.Set("export_data_options", flattenExportDefinition(&props.Definition)); err != nil { - return fmt.Errorf("setting `export_data_options`: %+v", err) - } - } - } - - return nil - }, - } -} - -func (br costManagementExportBaseResource) deleteFunc() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.CostManagement.ExportClient - - id, err := exports.ParseScopedExportID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - if _, err = client.Delete(ctx, *id); err != nil { - return fmt.Errorf("deleting %s: %+v", *id, err) - } - - return nil - }, - } -} - -func (br costManagementExportBaseResource) updateFunc() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.CostManagement.ExportClient - - id, err := exports.ParseScopedExportID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - // Update operation requires latest eTag to be set in the request. - var opts exports.GetOperationOptions - resp, err := client.Get(ctx, *id, opts) - if err != nil { - return fmt.Errorf("reading %s: %+v", *id, err) - } - - if model := resp.Model; model != nil { - if model.ETag == nil { - return fmt.Errorf("add %s: etag was nil", *id) - } - } - - if err := createOrUpdateCostManagementExport(ctx, client, metadata, *id, resp.Model.ETag); err != nil { - return fmt.Errorf("updating %s: %+v", *id, err) - } - - return nil - }, - } -} - -func createOrUpdateCostManagementExport(ctx context.Context, client *exports.ExportsClient, metadata sdk.ResourceMetaData, id exports.ScopedExportId, etag *string) error { - status := exports.StatusTypeActive - if v := metadata.ResourceData.Get("active"); !v.(bool) { - status = exports.StatusTypeInactive - } - - deliveryInfo, err := expandExportDataStorageLocation(metadata.ResourceData.Get("export_data_storage_location").([]interface{})) - if err != nil { - return fmt.Errorf("expanding `export_data_storage_location`: %+v", err) - } - - format := exports.FormatTypeCsv - recurrenceType := exports.RecurrenceType(metadata.ResourceData.Get("recurrence_type").(string)) - props := exports.Export{ - ETag: etag, - Properties: &exports.ExportProperties{ - Schedule: &exports.ExportSchedule{ - Recurrence: &recurrenceType, - RecurrencePeriod: &exports.ExportRecurrencePeriod{ - From: metadata.ResourceData.Get("recurrence_period_start_date").(string), - To: utils.String(metadata.ResourceData.Get("recurrence_period_end_date").(string)), - }, - Status: &status, - }, - DeliveryInfo: *deliveryInfo, - Format: &format, - Definition: *expandExportDefinition(metadata.ResourceData.Get("export_data_options").([]interface{})), - }, - } - - _, err = client.CreateOrUpdate(ctx, id, props) - - return err -} - -func expandExportDataStorageLocation(input []interface{}) (*exports.ExportDeliveryInfo, error) { - if len(input) == 0 || input[0] == nil { - return nil, nil - } - attrs := input[0].(map[string]interface{}) - - containerId, err := storageParse.StorageContainerResourceManagerID(attrs["container_id"].(string)) - if err != nil { - return nil, err - } - - storageId := storageParse.NewStorageAccountID(containerId.SubscriptionId, containerId.ResourceGroup, containerId.StorageAccountName) - - deliveryInfo := &exports.ExportDeliveryInfo{ - Destination: exports.ExportDeliveryDestination{ - ResourceId: utils.String(storageId.ID()), - Container: containerId.ContainerName, - RootFolderPath: utils.String(attrs["root_folder_path"].(string)), - }, - } - - return deliveryInfo, nil -} - -func expandExportDefinition(input []interface{}) *exports.ExportDefinition { - if len(input) == 0 || input[0] == nil { - return nil - } - - attrs := input[0].(map[string]interface{}) - definitionInfo := &exports.ExportDefinition{ - Type: exports.ExportType(attrs["type"].(string)), - Timeframe: exports.TimeframeType(attrs["time_frame"].(string)), - } - - return definitionInfo -} - -func flattenExportDataStorageLocation(input *exports.ExportDeliveryInfo) ([]interface{}, error) { - if input == nil { - return []interface{}{}, nil - } - - destination := input.Destination - var err error - var storageAccountId *storageParse.StorageAccountId - - if v := destination.ResourceId; v != nil { - storageAccountId, err = storageParse.StorageAccountID(*v) - if err != nil { - return nil, err - } - } - - containerId := "" - if v := destination.Container; v != "" && storageAccountId != nil { - containerId = storageParse.NewStorageContainerResourceManagerID(storageAccountId.SubscriptionId, storageAccountId.ResourceGroup, storageAccountId.Name, "default", v).ID() - } - - rootFolderPath := "" - if v := destination.RootFolderPath; v != nil { - rootFolderPath = *v - } - - return []interface{}{ - map[string]interface{}{ - "container_id": containerId, - "root_folder_path": rootFolderPath, - }, - }, nil -} - -func flattenExportDefinition(input *exports.ExportDefinition) []interface{} { - if input == nil { - return []interface{}{} - } - - queryType := "" - if v := input.Type; v != "" { - queryType = string(input.Type) - } - - return []interface{}{ - map[string]interface{}{ - "time_frame": string(input.Timeframe), - "type": queryType, - }, - } -} diff --git a/internal/services/costmanagement/export_resource_base.go b/internal/services/costmanagement/export_resource_base.go new file mode 100644 index 000000000000..cfa491759af9 --- /dev/null +++ b/internal/services/costmanagement/export_resource_base.go @@ -0,0 +1,376 @@ +package costmanagement + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports" + "github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobcontainers" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type costManagementExportBaseResource struct{} + +func (br costManagementExportBaseResource) arguments(fields map[string]*pluginsdk.Schema) map[string]*pluginsdk.Schema { + output := map[string]*pluginsdk.Schema{ + "active": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "recurrence_type": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(exports.RecurrenceTypeDaily), + string(exports.RecurrenceTypeWeekly), + string(exports.RecurrenceTypeMonthly), + string(exports.RecurrenceTypeAnnually), + }, false), + }, + + "recurrence_period_start_date": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.IsRFC3339Time, + }, + + "recurrence_period_end_date": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.IsRFC3339Time, + }, + + "export_data_storage_location": { + Type: pluginsdk.TypeList, + MaxItems: 1, + Required: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "container_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: blobcontainers.ValidateContainerID, + }, + "root_folder_path": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "export_data_options": { + Type: pluginsdk.TypeList, + MaxItems: 1, + Required: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "type": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(exports.ExportTypeActualCost), + string(exports.ExportTypeAmortizedCost), + string(exports.ExportTypeUsage), + }, false), + }, + + "time_frame": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(exports.TimeframeTypeCustom), + string(exports.TimeframeTypeBillingMonthToDate), + string(exports.TimeframeTypeTheLastBillingMonth), + string(exports.TimeframeTypeTheLastMonth), + string(exports.TimeframeTypeWeekToDate), + string(exports.TimeframeTypeMonthToDate), + }, false), + }, + }, + }, + }, + } + + for k, v := range fields { + output[k] = v + } + + return output +} + +func (br costManagementExportBaseResource) attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (br costManagementExportBaseResource) createFunc(resourceName, scopeFieldName string) sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.CostManagement.ExportClient + id := exports.NewScopedExportID(metadata.ResourceData.Get(scopeFieldName).(string), metadata.ResourceData.Get("name").(string)) + var opts exports.GetOperationOptions + existing, err := client.Get(ctx, id, opts) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError(resourceName, id.ID()) + } + + if err := createOrUpdateCostManagementExport(ctx, client, metadata, id, nil); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (br costManagementExportBaseResource) readFunc(scopeFieldName string) sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.CostManagement.ExportClient + + id, err := exports.ParseScopedExportID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var opts exports.GetOperationOptions + resp, err := client.Get(ctx, *id, opts) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("reading %s: %+v", *id, err) + } + + metadata.ResourceData.Set("name", id.ExportName) + //lintignore:R001 + metadata.ResourceData.Set(scopeFieldName, id.Scope) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + if schedule := props.Schedule; schedule != nil { + if recurrencePeriod := schedule.RecurrencePeriod; recurrencePeriod != nil { + metadata.ResourceData.Set("recurrence_period_start_date", recurrencePeriod.From) + metadata.ResourceData.Set("recurrence_period_end_date", recurrencePeriod.To) + } + status := *schedule.Status == exports.StatusTypeActive + + metadata.ResourceData.Set("active", status) + metadata.ResourceData.Set("recurrence_type", schedule.Recurrence) + } + + exportDeliveryInfo, err := flattenExportDataStorageLocation(&props.DeliveryInfo) + if err != nil { + return fmt.Errorf("flattening `export_data_storage_location`: %+v", err) + } + if err := metadata.ResourceData.Set("export_data_storage_location", exportDeliveryInfo); err != nil { + return fmt.Errorf("setting `export_data_storage_location`: %+v", err) + } + if err := metadata.ResourceData.Set("export_data_options", flattenExportDefinition(&props.Definition)); err != nil { + return fmt.Errorf("setting `export_data_options`: %+v", err) + } + } + } + + return nil + }, + } +} + +func (br costManagementExportBaseResource) deleteFunc() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.CostManagement.ExportClient + + id, err := exports.ParseScopedExportID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err = client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (br costManagementExportBaseResource) updateFunc() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.CostManagement.ExportClient + + id, err := exports.ParseScopedExportID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + // Update operation requires latest eTag to be set in the request. + var opts exports.GetOperationOptions + resp, err := client.Get(ctx, *id, opts) + if err != nil { + return fmt.Errorf("reading %s: %+v", *id, err) + } + + if model := resp.Model; model != nil { + if model.ETag == nil { + return fmt.Errorf("add %s: etag was nil", *id) + } + } + + if err := createOrUpdateCostManagementExport(ctx, client, metadata, *id, resp.Model.ETag); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func createOrUpdateCostManagementExport(ctx context.Context, client *exports.ExportsClient, metadata sdk.ResourceMetaData, id exports.ScopedExportId, etag *string) error { + status := exports.StatusTypeActive + if v := metadata.ResourceData.Get("active"); !v.(bool) { + status = exports.StatusTypeInactive + } + + deliveryInfo, err := expandExportDataStorageLocation(metadata.ResourceData.Get("export_data_storage_location").([]interface{})) + if err != nil { + return fmt.Errorf("expanding `export_data_storage_location`: %+v", err) + } + + format := exports.FormatTypeCsv + recurrenceType := exports.RecurrenceType(metadata.ResourceData.Get("recurrence_type").(string)) + props := exports.Export{ + ETag: etag, + Properties: &exports.ExportProperties{ + Schedule: &exports.ExportSchedule{ + Recurrence: &recurrenceType, + RecurrencePeriod: &exports.ExportRecurrencePeriod{ + From: metadata.ResourceData.Get("recurrence_period_start_date").(string), + To: utils.String(metadata.ResourceData.Get("recurrence_period_end_date").(string)), + }, + Status: &status, + }, + DeliveryInfo: *deliveryInfo, + Format: &format, + Definition: *expandExportDefinition(metadata.ResourceData.Get("export_data_options").([]interface{})), + }, + } + + _, err = client.CreateOrUpdate(ctx, id, props) + + return err +} + +func expandExportDataStorageLocation(input []interface{}) (*exports.ExportDeliveryInfo, error) { + if len(input) == 0 || input[0] == nil { + return nil, nil + } + attrs := input[0].(map[string]interface{}) + + containerId, err := blobcontainers.ParseContainerID(attrs["container_id"].(string)) + if err != nil { + return nil, err + } + + storageId := blobcontainers.NewStorageAccountID(containerId.SubscriptionId, containerId.ResourceGroupName, containerId.StorageAccountName) + + deliveryInfo := &exports.ExportDeliveryInfo{ + Destination: exports.ExportDeliveryDestination{ + ResourceId: utils.String(storageId.ID()), + Container: containerId.ContainerName, + RootFolderPath: utils.String(attrs["root_folder_path"].(string)), + }, + } + + return deliveryInfo, nil +} + +func expandExportDefinition(input []interface{}) *exports.ExportDefinition { + if len(input) == 0 || input[0] == nil { + return nil + } + + attrs := input[0].(map[string]interface{}) + definitionInfo := &exports.ExportDefinition{ + Type: exports.ExportType(attrs["type"].(string)), + Timeframe: exports.TimeframeType(attrs["time_frame"].(string)), + } + + return definitionInfo +} + +func flattenExportDataStorageLocation(input *exports.ExportDeliveryInfo) ([]interface{}, error) { + if input == nil { + return []interface{}{}, nil + } + + destination := input.Destination + var err error + var storageAccountId *blobcontainers.StorageAccountId + + if v := destination.ResourceId; v != nil { + storageAccountId, err = blobcontainers.ParseStorageAccountIDInsensitively(*v) + if err != nil { + return nil, err + } + } + + containerId := "" + if v := destination.Container; v != "" && storageAccountId != nil { + containerId = blobcontainers.NewContainerID(storageAccountId.SubscriptionId, storageAccountId.ResourceGroupName, storageAccountId.StorageAccountName, v).ID() + } + + rootFolderPath := "" + if v := destination.RootFolderPath; v != nil { + rootFolderPath = *v + } + + return []interface{}{ + map[string]interface{}{ + "container_id": containerId, + "root_folder_path": rootFolderPath, + }, + }, nil +} + +func flattenExportDefinition(input *exports.ExportDefinition) []interface{} { + if input == nil { + return []interface{}{} + } + + queryType := "" + if v := input.Type; v != "" { + queryType = string(input.Type) + } + + return []interface{}{ + map[string]interface{}{ + "time_frame": string(input.Timeframe), + "type": queryType, + }, + } +} diff --git a/internal/services/customproviders/custom_provider_resource.go b/internal/services/customproviders/custom_provider_resource.go index 2406fd8900f3..226b433ac63e 100644 --- a/internal/services/customproviders/custom_provider_resource.go +++ b/internal/services/customproviders/custom_provider_resource.go @@ -4,7 +4,6 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" @@ -68,10 +67,10 @@ func resourceCustomProvider() *pluginsdk.Resource { "routing_type": { Type: pluginsdk.TypeString, Optional: true, - Default: string(customproviders.ResourceTypeRoutingProxy), + Default: string(customresourceprovider.ResourceTypeRoutingProxy), ValidateFunc: validation.StringInSlice([]string{ - string(customproviders.ResourceTypeRoutingProxy), - string(customproviders.ResourceTypeRoutingProxyCache), + string(customresourceprovider.ResourceTypeRoutingProxy), + string(customresourceprovider.ResourceTypeRoutingProxyCache), }, false), }, }, diff --git a/internal/services/dashboard/dashboard_grafana_resource.go b/internal/services/dashboard/dashboard_grafana_resource.go index 592acceab246..6b858fc983d9 100644 --- a/internal/services/dashboard/dashboard_grafana_resource.go +++ b/internal/services/dashboard/dashboard_grafana_resource.go @@ -23,6 +23,7 @@ type DashboardGrafanaModel struct { ApiKeyEnabled bool `tfschema:"api_key_enabled"` AutoGeneratedDomainNameLabelScope grafanaresource.AutoGeneratedDomainNameLabelScope `tfschema:"auto_generated_domain_name_label_scope"` DeterministicOutboundIPEnabled bool `tfschema:"deterministic_outbound_ip_enabled"` + AzureMonitorWorkspaceIntegrations []AzureMonitorWorkspaceIntegrationModel `tfschema:"azure_monitor_workspace_integrations"` Location string `tfschema:"location"` PublicNetworkAccessEnabled bool `tfschema:"public_network_access_enabled"` Sku string `tfschema:"sku"` @@ -33,6 +34,10 @@ type DashboardGrafanaModel struct { OutboundIPs []string `tfschema:"outbound_ip"` } +type AzureMonitorWorkspaceIntegrationModel struct { + ResourceId string `tfschema:"resource_id"` +} + type DashboardGrafanaResource struct{} var _ sdk.ResourceWithUpdate = DashboardGrafanaResource{} @@ -86,6 +91,20 @@ func (r DashboardGrafanaResource) Arguments() map[string]*pluginsdk.Schema { Default: false, }, + "azure_monitor_workspace_integrations": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "resource_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + "identity": commonschema.SystemAssignedIdentityOptionalForceNew(), "public_network_access_enabled": { @@ -187,6 +206,7 @@ func (r DashboardGrafanaResource) Create() sdk.ResourceFunc { ApiKey: &apiKey, AutoGeneratedDomainNameLabelScope: &model.AutoGeneratedDomainNameLabelScope, DeterministicOutboundIP: &deterministicOutboundIP, + GrafanaIntegrations: expandGrafanaIntegrationsModel(model.AzureMonitorWorkspaceIntegrations), PublicNetworkAccess: &publicNetworkAccess, ZoneRedundancy: &zoneRedundancy, }, @@ -254,6 +274,10 @@ func (r DashboardGrafanaResource) Update() sdk.ResourceFunc { properties.Properties.DeterministicOutboundIP = &deterministicOutboundIP } + if metadata.ResourceData.HasChange("azure_monitor_workspace_integrations") { + properties.Properties.GrafanaIntegrations = expandGrafanaIntegrationsModel(model.AzureMonitorWorkspaceIntegrations) + } + if metadata.ResourceData.HasChange("public_network_access_enabled") { publicNetworkAccess := grafanaresource.PublicNetworkAccessDisabled if model.PublicNetworkAccessEnabled { @@ -304,7 +328,7 @@ func (r DashboardGrafanaResource) Read() sdk.ResourceFunc { } state := DashboardGrafanaModel{ - Name: id.WorkspaceName, + Name: id.GrafanaName, ResourceGroupName: id.ResourceGroupName, Location: location.NormalizeNilable(model.Location), } @@ -340,6 +364,10 @@ func (r DashboardGrafanaResource) Read() sdk.ResourceFunc { state.Endpoint = *properties.Endpoint } + if properties.GrafanaIntegrations != nil { + state.AzureMonitorWorkspaceIntegrations = flattenAzureMonitorWorkspaceIntegrationModelArray(properties.GrafanaIntegrations.AzureMonitorWorkspaceIntegrations) + } + if properties.GrafanaVersion != nil { state.GrafanaVersion = *properties.GrafanaVersion } @@ -398,6 +426,30 @@ func (r DashboardGrafanaResource) Delete() sdk.ResourceFunc { } } +func expandGrafanaIntegrationsModel(inputList []AzureMonitorWorkspaceIntegrationModel) *grafanaresource.GrafanaIntegrations { + if len(inputList) == 0 { + return nil + } + + return &grafanaresource.GrafanaIntegrations{ + AzureMonitorWorkspaceIntegrations: expandAzureMonitorWorkspaceIntegrationModelArray(inputList), + } +} + +func expandAzureMonitorWorkspaceIntegrationModelArray(inputList []AzureMonitorWorkspaceIntegrationModel) *[]grafanaresource.AzureMonitorWorkspaceIntegration { + var outputList []grafanaresource.AzureMonitorWorkspaceIntegration + for _, v := range inputList { + input := v + output := grafanaresource.AzureMonitorWorkspaceIntegration{ + AzureMonitorWorkspaceResourceId: &input.ResourceId, + } + + outputList = append(outputList, output) + } + + return &outputList +} + func expandLegacySystemAndUserAssignedMap(input []interface{}) *identity.LegacySystemAndUserAssignedMap { identityValue, err := identity.ExpandSystemAssigned(input) if err != nil { @@ -409,6 +461,25 @@ func expandLegacySystemAndUserAssignedMap(input []interface{}) *identity.LegacyS } } +func flattenAzureMonitorWorkspaceIntegrationModelArray(inputList *[]grafanaresource.AzureMonitorWorkspaceIntegration) []AzureMonitorWorkspaceIntegrationModel { + var outputList []AzureMonitorWorkspaceIntegrationModel + if inputList == nil { + return outputList + } + + for _, input := range *inputList { + output := AzureMonitorWorkspaceIntegrationModel{} + + if input.AzureMonitorWorkspaceResourceId != nil { + output.ResourceId = *input.AzureMonitorWorkspaceResourceId + } + + outputList = append(outputList, output) + } + + return outputList +} + func flattenLegacySystemAndUserAssignedMap(input *identity.LegacySystemAndUserAssignedMap) *[]interface{} { if input == nil { return &[]interface{}{} diff --git a/internal/services/dashboard/dashboard_grafana_resource_test.go b/internal/services/dashboard/dashboard_grafana_resource_test.go index f9aa694a56b3..c0f8d164c050 100644 --- a/internal/services/dashboard/dashboard_grafana_resource_test.go +++ b/internal/services/dashboard/dashboard_grafana_resource_test.go @@ -138,10 +138,10 @@ resource "azurerm_dashboard_grafana" "import" { func (r DashboardGrafanaResource) complete(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` - %s + %[1]s resource "azurerm_dashboard_grafana" "test" { - name = "a-dg-%d" + name = "a-dg-%[2]d" resource_group_name = azurerm_resource_group.test.name location = azurerm_resource_group.test.location api_key_enabled = true @@ -152,6 +152,10 @@ resource "azurerm_dashboard_grafana" "test" { type = "SystemAssigned" } + azure_monitor_workspace_integrations { + resource_id = "${azurerm_resource_group.test.id}/providers/microsoft.monitor/accounts/a-mwr-%[2]d" + } + tags = { key = "value" } @@ -173,6 +177,14 @@ resource "azurerm_dashboard_grafana" "test" { type = "SystemAssigned" } + azure_monitor_workspace_integrations { + resource_id = "${azurerm_resource_group.test.id}/providers/microsoft.monitor/accounts/a-mwr-%[2]d" + } + + azure_monitor_workspace_integrations { + resource_id = "${azurerm_resource_group.test.id}/providers/microsoft.monitor/accounts/a-mwr-%[2]d-2" + } + tags = { key2 = "value2" } diff --git a/internal/services/databasemigration/client/client.go b/internal/services/databasemigration/client/client.go index c6cc84cc4c2b..cb64976073cb 100644 --- a/internal/services/databasemigration/client/client.go +++ b/internal/services/databasemigration/client/client.go @@ -1,20 +1,21 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource" + "github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - ServicesClient *datamigration.ServicesClient - ProjectsClient *datamigration.ProjectsClient + ServicesClient *serviceresource.ServiceResourceClient + ProjectsClient *projectresource.ProjectResourceClient } func NewClient(o *common.ClientOptions) *Client { - servicesClient := datamigration.NewServicesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + servicesClient := serviceresource.NewServiceResourceClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&servicesClient.Client, o.ResourceManagerAuthorizer) - projectsClient := datamigration.NewProjectsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + projectsClient := projectresource.NewProjectResourceClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&projectsClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/internal/services/databasemigration/database_migration_project_data_source.go b/internal/services/databasemigration/database_migration_project_data_source.go index e9c4139d5ccb..45f77c130228 100644 --- a/internal/services/databasemigration/database_migration_project_data_source.go +++ b/internal/services/databasemigration/database_migration_project_data_source.go @@ -4,15 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databasemigration/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/databasemigration/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceDatabaseMigrationProject() *pluginsdk.Resource { @@ -50,7 +50,7 @@ func dataSourceDatabaseMigrationProject() *pluginsdk.Resource { Computed: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -61,10 +61,10 @@ func dataSourceDatabaseMigrationProjectRead(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewProjectID(subscriptionId, d.Get("resource_group_name").(string), d.Get("service_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + id := projectresource.NewProjectID(subscriptionId, d.Get("resource_group_name").(string), d.Get("service_name").(string), d.Get("name").(string)) + resp, err := client.ProjectsGet(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) @@ -72,11 +72,17 @@ func dataSourceDatabaseMigrationProjectRead(d *pluginsdk.ResourceData, meta inte d.SetId(id.ID()) - d.Set("location", location.NormalizeNilable(resp.Location)) - if prop := resp.ProjectProperties; prop != nil { - d.Set("source_platform", string(prop.SourcePlatform)) - d.Set("target_platform", string(prop.TargetPlatform)) - } + d.Set("name", id.ProjectName) + d.Set("service_name", id.ServiceName) + d.Set("resource_group_name", id.ResourceGroupName) - return tags.FlattenAndSet(d, resp.Tags) + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + if props := model.Properties; props != nil { + d.Set("source_platform", string(props.SourcePlatform)) + d.Set("target_platform", string(props.TargetPlatform)) + } + return tags.FlattenAndSet(d, model.Tags) + } + return nil } diff --git a/internal/services/databasemigration/database_migration_project_resource.go b/internal/services/databasemigration/database_migration_project_resource.go index 5c867b78243f..e498118d9d1d 100644 --- a/internal/services/databasemigration/database_migration_project_resource.go +++ b/internal/services/databasemigration/database_migration_project_resource.go @@ -5,15 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databasemigration/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/databasemigration/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -28,7 +28,7 @@ func resourceDatabaseMigrationProject() *pluginsdk.Resource { Delete: resourceDatabaseMigrationProjectDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ProjectID(id) + _, err := projectresource.ParseProjectID(id) return err }), @@ -64,7 +64,7 @@ func resourceDatabaseMigrationProject() *pluginsdk.Resource { ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ // Now that go sdk only export SQL as source platform type, we only allow it here. - string(datamigration.ProjectSourcePlatformSQL), + string(projectresource.ProjectSourcePlatformSQL), }, false), }, @@ -74,11 +74,11 @@ func resourceDatabaseMigrationProject() *pluginsdk.Resource { ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ // Now that go sdk only export SQL as source platform type, we only allow it here. - string(datamigration.ProjectTargetPlatformSQLDB), + string(projectresource.ProjectTargetPlatformSQLDB), }, false), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -89,15 +89,15 @@ func resourceDatabaseMigrationProjectCreateUpdate(d *pluginsdk.ResourceData, met ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewProjectID(subscriptionId, d.Get("resource_group_name").(string), d.Get("service_name").(string), d.Get("name").(string)) + id := projectresource.NewProjectID(subscriptionId, d.Get("resource_group_name").(string), d.Get("service_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + existing, err := client.ProjectsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_database_migration_project", id.ID()) } } @@ -107,16 +107,16 @@ func resourceDatabaseMigrationProjectCreateUpdate(d *pluginsdk.ResourceData, met targetPlatform := d.Get("target_platform").(string) t := d.Get("tags").(map[string]interface{}) - parameters := datamigration.Project{ - Location: utils.String(location), - ProjectProperties: &datamigration.ProjectProperties{ - SourcePlatform: datamigration.ProjectSourcePlatform(sourcePlatform), - TargetPlatform: datamigration.ProjectTargetPlatform(targetPlatform), + parameters := projectresource.Project{ + Location: location, + Properties: &projectresource.ProjectProperties{ + SourcePlatform: projectresource.ProjectSourcePlatform(sourcePlatform), + TargetPlatform: projectresource.ProjectTargetPlatform(targetPlatform), }, Tags: tags.Expand(t), } - if _, err := client.CreateOrUpdate(ctx, parameters, id.ResourceGroup, id.ServiceName, id.Name); err != nil { + if _, err := client.ProjectsCreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -129,14 +129,14 @@ func resourceDatabaseMigrationProjectRead(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ProjectID(d.Id()) + id, err := projectresource.ParseProjectID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := client.ProjectsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil @@ -144,17 +144,19 @@ func resourceDatabaseMigrationProjectRead(d *pluginsdk.ResourceData, meta interf return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) + d.Set("name", id.ProjectName) d.Set("service_name", id.ServiceName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("resource_group_name", id.ResourceGroupName) - if prop := resp.ProjectProperties; prop != nil { - d.Set("source_platform", string(prop.SourcePlatform)) - d.Set("target_platform", string(prop.TargetPlatform)) + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + if props := model.Properties; props != nil { + d.Set("source_platform", string(props.SourcePlatform)) + d.Set("target_platform", string(props.TargetPlatform)) + } + return tags.FlattenAndSet(d, model.Tags) } - - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceDatabaseMigrationProjectDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -162,13 +164,15 @@ func resourceDatabaseMigrationProjectDelete(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ProjectID(d.Id()) + id, err := projectresource.ParseProjectID(d.Id()) if err != nil { return err } - deleteRunningTasks := false - if _, err := client.Delete(ctx, id.ResourceGroup, id.ServiceName, id.Name, &deleteRunningTasks); err != nil { + opts := projectresource.ProjectsDeleteOperationOptions{ + DeleteRunningTasks: utils.Bool(false), + } + if _, err := client.ProjectsDelete(ctx, *id, opts); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } diff --git a/internal/services/databasemigration/database_migration_project_resource_test.go b/internal/services/databasemigration/database_migration_project_resource_test.go index 656e53244020..9ae04c5b4c37 100644 --- a/internal/services/databasemigration/database_migration_project_resource_test.go +++ b/internal/services/databasemigration/database_migration_project_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databasemigration/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -92,17 +92,17 @@ func TestAccDatabaseMigrationProject_update(t *testing.T) { } func (t DatabaseMigrationProjectResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ProjectID(state.ID) + id, err := projectresource.ParseProjectID(state.ID) if err != nil { return nil, err } - resp, err := clients.DatabaseMigration.ProjectsClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.Name) + resp, err := clients.DatabaseMigration.ProjectsClient.ProjectsGet(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Database Migration Project (Project Name %q / Service Name %q / Group Name %q) does not exist", id.Name, id.ServiceName, id.ResourceGroup) + return nil, fmt.Errorf("retrieving %s", *id) } - return utils.Bool(resp.ProjectProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (DatabaseMigrationProjectResource) basic(data acceptance.TestData) string { diff --git a/internal/services/databasemigration/database_migration_service_data_source.go b/internal/services/databasemigration/database_migration_service_data_source.go index 84b686cd95f8..8779dc7fec98 100644 --- a/internal/services/databasemigration/database_migration_service_data_source.go +++ b/internal/services/databasemigration/database_migration_service_data_source.go @@ -4,15 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databasemigration/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/databasemigration/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceDatabaseMigrationService() *pluginsdk.Resource { @@ -44,7 +44,7 @@ func dataSourceDatabaseMigrationService() *pluginsdk.Resource { Computed: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -55,10 +55,10 @@ func dataSourceDatabaseMigrationServiceRead(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewServiceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := serviceresource.NewServiceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.ServicesGet(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) @@ -66,13 +66,17 @@ func dataSourceDatabaseMigrationServiceRead(d *pluginsdk.ResourceData, meta inte d.SetId(id.ID()) - d.Set("location", location.NormalizeNilable(resp.Location)) - if serviceProperties := resp.ServiceProperties; serviceProperties != nil { - d.Set("subnet_id", serviceProperties.VirtualSubnetID) - } - if resp.Sku != nil { - d.Set("sku_name", resp.Sku.Name) + d.Set("name", id.ServiceName) + d.Set("resource_group_name", id.ResourceGroupName) + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + if props := model.Properties; props != nil { + d.Set("subnet_id", props.VirtualSubnetId) + } + d.Set("sku_name", model.Sku.Name) + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/internal/services/databasemigration/database_migration_service_resource.go b/internal/services/databasemigration/database_migration_service_resource.go index dbcdcdc71ae7..0a2233d48a59 100644 --- a/internal/services/databasemigration/database_migration_service_resource.go +++ b/internal/services/databasemigration/database_migration_service_resource.go @@ -5,16 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databasemigration/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/databasemigration/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -29,7 +28,7 @@ func resourceDatabaseMigrationService() *pluginsdk.Resource { Delete: resourceDatabaseMigrationServiceDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ServiceID(id) + _, err := serviceresource.ParseServiceID(id) return err }), @@ -73,7 +72,7 @@ func resourceDatabaseMigrationService() *pluginsdk.Resource { }, false), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -84,30 +83,26 @@ func resourceDatabaseMigrationServiceCreate(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewServiceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := serviceresource.NewServiceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.ServicesGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_database_migration_service", id.ID()) } } - skuName := d.Get("sku_name").(string) - subnetID := d.Get("subnet_id").(string) - location := azure.NormalizeLocation(d.Get("location").(string)) - - parameters := datamigration.Service{ - Location: utils.String(location), - ServiceProperties: &datamigration.ServiceProperties{ - VirtualSubnetID: utils.String(subnetID), + parameters := serviceresource.DataMigrationService{ + Location: azure.NormalizeLocation(d.Get("location").(string)), + Properties: &serviceresource.DataMigrationServiceProperties{ + VirtualSubnetId: d.Get("subnet_id").(string), }, - Sku: &datamigration.ServiceSku{ - Name: utils.String(skuName), + Sku: &serviceresource.ServiceSku{ + Name: utils.String(d.Get("sku_name").(string)), }, Kind: utils.String("Cloud"), // currently only "Cloud" is supported, hence hardcode here } @@ -115,13 +110,9 @@ func resourceDatabaseMigrationServiceCreate(d *pluginsdk.ResourceData, meta inte parameters.Tags = tags.Expand(t.(map[string]interface{})) } - future, err := client.CreateOrUpdate(ctx, parameters, id.ResourceGroup, id.Name) - if err != nil { + if err := client.ServicesCreateOrUpdateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } d.SetId(id.ID()) return resourceDatabaseMigrationServiceRead(d, meta) @@ -132,14 +123,14 @@ func resourceDatabaseMigrationServiceRead(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ServiceID(d.Id()) + id, err := serviceresource.ParseServiceID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.ServicesGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil @@ -147,17 +138,19 @@ func resourceDatabaseMigrationServiceRead(d *pluginsdk.ResourceData, meta interf return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - if serviceProperties := resp.ServiceProperties; serviceProperties != nil { - d.Set("subnet_id", serviceProperties.VirtualSubnetID) - } - if resp.Sku != nil { - d.Set("sku_name", resp.Sku.Name) - } + d.Set("name", id.ServiceName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + if props := model.Properties; props != nil { + d.Set("subnet_id", props.VirtualSubnetId) + } + d.Set("sku_name", model.Sku.Name) - return tags.FlattenAndSet(d, resp.Tags) + return tags.FlattenAndSet(d, model.Tags) + } + return nil } func resourceDatabaseMigrationServiceUpdate(d *pluginsdk.ResourceData, meta interface{}) error { @@ -165,22 +158,20 @@ func resourceDatabaseMigrationServiceUpdate(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ServiceID(d.Id()) + id, err := serviceresource.ParseServiceID(d.Id()) if err != nil { return err } - parameters := datamigration.Service{ - Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + parameters := serviceresource.DataMigrationService{ + // location isn't update-able but if we don't supply the current value the SDK sends an empty string instead which errors on the API side + Location: azure.NormalizeLocation(d.Get("location").(string)), + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.Update(ctx, parameters, id.ResourceGroup, id.Name) - if err != nil { + if err := client.ServicesUpdateThenPoll(ctx, *id, parameters); err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of %s: %+v", *id, err) - } return resourceDatabaseMigrationServiceRead(d, meta) } @@ -190,20 +181,16 @@ func resourceDatabaseMigrationServiceDelete(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ServiceID(d.Id()) + id, err := serviceresource.ParseServiceID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name, utils.Bool(true)) - if err != nil { - return fmt.Errorf("deleting %s: %+v", *id, err) + opts := serviceresource.ServicesDeleteOperationOptions{ + DeleteRunningTasks: utils.Bool(false), } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) - } + if err := client.ServicesDeleteThenPoll(ctx, *id, opts); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/internal/services/databasemigration/database_migration_service_resource_test.go b/internal/services/databasemigration/database_migration_service_resource_test.go index ecfc9ed0ca09..9cbba639c75a 100644 --- a/internal/services/databasemigration/database_migration_service_resource_test.go +++ b/internal/services/databasemigration/database_migration_service_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databasemigration/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -93,17 +93,17 @@ func TestAccDatabaseMigrationService_update(t *testing.T) { } func (t DatabaseMigrationServiceResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ServiceID(state.ID) + id, err := serviceresource.ParseServiceID(state.ID) if err != nil { return nil, err } - resp, err := clients.DatabaseMigration.ServicesClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := clients.DatabaseMigration.ServicesClient.ServicesGet(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Database Migration Service (Service Name %q / Group Name %q) does not exist", id.Name, id.ResourceGroup) + return nil, fmt.Errorf("retrieving %s", *id) } - return utils.Bool(resp.ServiceProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (DatabaseMigrationServiceResource) base(data acceptance.TestData) string { diff --git a/internal/services/databasemigration/parse/project.go b/internal/services/databasemigration/parse/project.go deleted file mode 100644 index 1c53efc23773..000000000000 --- a/internal/services/databasemigration/parse/project.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ProjectId struct { - SubscriptionId string - ResourceGroup string - ServiceName string - Name string -} - -func NewProjectID(subscriptionId, resourceGroup, serviceName, name string) ProjectId { - return ProjectId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ServiceName: serviceName, - Name: name, - } -} - -func (id ProjectId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Service Name %q", id.ServiceName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Project", segmentsStr) -} - -func (id ProjectId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataMigration/services/%s/projects/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServiceName, id.Name) -} - -// ProjectID parses a Project ID into an ProjectId struct -func ProjectID(input string) (*ProjectId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ProjectId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ServiceName, err = id.PopSegment("services"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("projects"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/databasemigration/parse/project_test.go b/internal/services/databasemigration/parse/project_test.go deleted file mode 100644 index 6305bcfd0939..000000000000 --- a/internal/services/databasemigration/parse/project_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = ProjectId{} - -func TestProjectIDFormatter(t *testing.T) { - actual := NewProjectID("12345678-1234-9876-4563-123456789012", "resGroup1", "service1", "project1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/service1/projects/project1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestProjectID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ProjectId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing ServiceName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/", - Error: true, - }, - - { - // missing value for ServiceName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/service1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/service1/projects/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/service1/projects/project1", - Expected: &ProjectId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - ServiceName: "service1", - Name: "project1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DATAMIGRATION/SERVICES/SERVICE1/PROJECTS/PROJECT1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ProjectID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.ServiceName != v.Expected.ServiceName { - t.Fatalf("Expected %q but got %q for ServiceName", v.Expected.ServiceName, actual.ServiceName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/databasemigration/parse/service.go b/internal/services/databasemigration/parse/service.go deleted file mode 100644 index 23673a179720..000000000000 --- a/internal/services/databasemigration/parse/service.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ServiceId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewServiceID(subscriptionId, resourceGroup, name string) ServiceId { - return ServiceId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ServiceId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Service", segmentsStr) -} - -func (id ServiceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataMigration/services/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ServiceID parses a Service ID into an ServiceId struct -func ServiceID(input string) (*ServiceId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ServiceId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("services"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/databasemigration/parse/service_test.go b/internal/services/databasemigration/parse/service_test.go deleted file mode 100644 index 85d6553f9c4c..000000000000 --- a/internal/services/databasemigration/parse/service_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = ServiceId{} - -func TestServiceIDFormatter(t *testing.T) { - actual := NewServiceID("12345678-1234-9876-4563-123456789012", "resGroup1", "service1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/service1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestServiceID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ServiceId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/service1", - Expected: &ServiceId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "service1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DATAMIGRATION/SERVICES/SERVICE1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ServiceID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/databasemigration/resourceids.go b/internal/services/databasemigration/resourceids.go deleted file mode 100644 index 0aa7280c161c..000000000000 --- a/internal/services/databasemigration/resourceids.go +++ /dev/null @@ -1,4 +0,0 @@ -package databasemigration - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Project -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/service1/projects/project1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Service -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/service1 diff --git a/internal/services/databasemigration/validate/project_id.go b/internal/services/databasemigration/validate/project_id.go deleted file mode 100644 index 2f5a3be16c86..000000000000 --- a/internal/services/databasemigration/validate/project_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databasemigration/parse" -) - -func ProjectID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ProjectID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/databasemigration/validate/project_id_test.go b/internal/services/databasemigration/validate/project_id_test.go deleted file mode 100644 index ac706153baec..000000000000 --- a/internal/services/databasemigration/validate/project_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestProjectID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing ServiceName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/", - Valid: false, - }, - - { - // missing value for ServiceName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/service1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/service1/projects/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/service1/projects/project1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DATAMIGRATION/SERVICES/SERVICE1/PROJECTS/PROJECT1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ProjectID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/databasemigration/validate/service_id.go b/internal/services/databasemigration/validate/service_id.go deleted file mode 100644 index 07b38a32e80c..000000000000 --- a/internal/services/databasemigration/validate/service_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databasemigration/parse" -) - -func ServiceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ServiceID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/databasemigration/validate/service_id_test.go b/internal/services/databasemigration/validate/service_id_test.go deleted file mode 100644 index b3a6be9e3a90..000000000000 --- a/internal/services/databasemigration/validate/service_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestServiceID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataMigration/services/service1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DATAMIGRATION/SERVICES/SERVICE1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ServiceID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/databoxedge/client/client.go b/internal/services/databoxedge/client/client.go index a4c5018a2b5b..2f606d8f10ca 100644 --- a/internal/services/databoxedge/client/client.go +++ b/internal/services/databoxedge/client/client.go @@ -2,16 +2,17 @@ package client import ( "github.com/Azure/azure-sdk-for-go/services/databoxedge/mgmt/2020-12-01/databoxedge" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - DeviceClient *databoxedge.DevicesClient + DeviceClient *devices.DevicesClient OrderClient *databoxedge.OrdersClient } func NewClient(o *common.ClientOptions) *Client { - deviceClient := databoxedge.NewDevicesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + deviceClient := devices.NewDevicesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&deviceClient.Client, o.ResourceManagerAuthorizer) orderClient := databoxedge.NewOrdersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) diff --git a/internal/services/databoxedge/databox_edge_device_data_source.go b/internal/services/databoxedge/databox_edge_device_data_source.go index da696e3787f7..15bebe91bd3e 100644 --- a/internal/services/databoxedge/databox_edge_device_data_source.go +++ b/internal/services/databoxedge/databox_edge_device_data_source.go @@ -3,18 +3,16 @@ package databoxedge import ( "context" "fmt" - "log" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type EdgeDeviceDataSource struct{} @@ -134,27 +132,28 @@ func (d EdgeDeviceDataSource) Read() sdk.ResourceFunc { return fmt.Errorf("decoding: %+v", err) } - id := parse.NewDeviceID(subscriptionId, metaModel.ResourceGroupName, metaModel.Name) + id := devices.NewDataBoxEdgeDeviceID(subscriptionId, metaModel.ResourceGroupName, metaModel.Name) - resp, err := client.Get(ctx, id.DataBoxEdgeDeviceName, id.ResourceGroup) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] %s was not found - removing from state", id) - return metadata.MarkAsGone(id) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } state := EdgeDeviceModel{ Name: id.DataBoxEdgeDeviceName, - ResourceGroupName: id.ResourceGroup, - Location: location.NormalizeNilable(resp.Location), + ResourceGroupName: id.ResourceGroupName, } - if props := resp.DeviceProperties; props != nil { - state.DeviceProperties = flattenDeviceProperties(props) - state.SkuName = flattenDeviceSku(resp.Sku) - state.Tags = tags.ToTypedObject(resp.Tags) + if model := resp.Model; model != nil { + state.Location = location.Normalize(model.Location) + if props := model.Properties; props != nil { + state.DeviceProperties = flattenDeviceProperties(props) + } + state.SkuName = flattenDeviceSku(model.Sku) + state.Tags = *model.Tags } metadata.SetID(id) diff --git a/internal/services/databoxedge/databox_edge_device_resource.go b/internal/services/databoxedge/databox_edge_device_resource.go index b9dd0b3ea28a..35443c47ba7c 100644 --- a/internal/services/databoxedge/databox_edge_device_resource.go +++ b/internal/services/databoxedge/databox_edge_device_resource.go @@ -6,15 +6,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/databoxedge/mgmt/2020-12-01/databoxedge" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -54,7 +54,7 @@ func (r EdgeDeviceResource) ResourceType() string { } func (r EdgeDeviceResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return validate.DeviceID + return devices.ValidateDataBoxEdgeDeviceID } func (r EdgeDeviceResource) Arguments() map[string]*schema.Schema { @@ -77,7 +77,7 @@ func (r EdgeDeviceResource) Arguments() map[string]*schema.Schema { ValidateFunc: validate.DataboxEdgeDeviceSkuName, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), } } @@ -163,34 +163,30 @@ func (r EdgeDeviceResource) Create() sdk.ResourceFunc { return fmt.Errorf("decoding %+v", err) } - id := parse.NewDeviceID(subscriptionId, metaModel.ResourceGroupName, metaModel.Name) + id := devices.NewDataBoxEdgeDeviceID(subscriptionId, metaModel.ResourceGroupName, metaModel.Name) // sdk method is Get(ctx context.Context, deviceName string, resourceGroupName string) - existing, err := client.Get(ctx, id.DataBoxEdgeDeviceName, id.ResourceGroup) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_databox_edge_device", id.ID()) } - dataBoxEdgeDevice := databoxedge.Device{ - Location: utils.String(location.Normalize(metaModel.Location)), + dataBoxEdgeDevice := devices.DataBoxEdgeDevice{ + Location: location.Normalize(metaModel.Location), Sku: expandDeviceSku(metaModel.SkuName), - Tags: tags.FromTypedObject(metaModel.Tags), + Tags: &metaModel.Tags, } - future, err := client.CreateOrUpdate(ctx, id.DataBoxEdgeDeviceName, dataBoxEdgeDevice, id.ResourceGroup) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, dataBoxEdgeDevice); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - metadata.SetID(id) + return nil }, } @@ -202,14 +198,14 @@ func (r EdgeDeviceResource) Read() sdk.ResourceFunc { Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.DataboxEdge.DeviceClient - id, err := parse.DeviceID(metadata.ResourceData.Id()) + id, err := devices.ParseDataBoxEdgeDeviceID(metadata.ResourceData.Id()) if err != nil { return fmt.Errorf("parse: %+v", err) } - resp, err := client.Get(ctx, id.DataBoxEdgeDeviceName, id.ResourceGroup) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s was not found - removing from state", id) return metadata.MarkAsGone(id) } @@ -218,14 +214,16 @@ func (r EdgeDeviceResource) Read() sdk.ResourceFunc { state := EdgeDeviceModel{ Name: id.DataBoxEdgeDeviceName, - ResourceGroupName: id.ResourceGroup, - Location: location.NormalizeNilable(resp.Location), + ResourceGroupName: id.ResourceGroupName, } - if props := resp.DeviceProperties; props != nil { - state.DeviceProperties = flattenDeviceProperties(props) - state.SkuName = flattenDeviceSku(resp.Sku) - state.Tags = tags.ToTypedObject(resp.Tags) + if model := resp.Model; model != nil { + state.Location = location.Normalize(model.Location) + if props := model.Properties; props != nil { + state.DeviceProperties = flattenDeviceProperties(props) + } + state.SkuName = flattenDeviceSku(model.Sku) + state.Tags = *model.Tags } metadata.SetID(id) @@ -241,7 +239,7 @@ func (r EdgeDeviceResource) Update() sdk.ResourceFunc { Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.DataboxEdge.DeviceClient - id, err := parse.DeviceID(metadata.ResourceData.Id()) + id, err := devices.ParseDataBoxEdgeDeviceID(metadata.ResourceData.Id()) if err != nil { return err } @@ -251,12 +249,12 @@ func (r EdgeDeviceResource) Update() sdk.ResourceFunc { return fmt.Errorf("decoding: %+v", err) } - parameters := databoxedge.DevicePatch{} + parameters := devices.DataBoxEdgeDevicePatch{} if metadata.ResourceData.HasChange("tags") { - parameters.Tags = tags.FromTypedObject(metaModel.Tags) + parameters.Tags = &metaModel.Tags } - if _, err := client.Update(ctx, id.DataBoxEdgeDeviceName, parameters, id.ResourceGroup); err != nil { + if _, err := client.Update(ctx, *id, parameters); err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } @@ -271,7 +269,7 @@ func (r EdgeDeviceResource) Delete() sdk.ResourceFunc { Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.DataboxEdge.DeviceClient - id, err := parse.DeviceID(metadata.ResourceData.Id()) + id, err := devices.ParseDataBoxEdgeDeviceID(metadata.ResourceData.Id()) if err != nil { return err } @@ -280,20 +278,16 @@ func (r EdgeDeviceResource) Delete() sdk.ResourceFunc { if err := metadata.Decode(&metaModel); err != nil { return fmt.Errorf("decoding: %+v", err) } - future, err := client.Delete(ctx, id.DataBoxEdgeDeviceName, id.ResourceGroup) - if err != nil { + if err := client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } return nil }, } } -func expandDeviceSku(input string) *databoxedge.Sku { +func expandDeviceSku(input string) *devices.Sku { if len(input) == 0 { return nil } @@ -303,13 +297,13 @@ func expandDeviceSku(input string) *databoxedge.Sku { return nil } - return &databoxedge.Sku{ - Name: databoxedge.SkuName(v.Name), - Tier: databoxedge.SkuTier(v.Tier), + return &devices.Sku{ + Name: utils.ToPtr(devices.SkuName(v.Name)), + Tier: utils.ToPtr(devices.SkuTier(v.Tier)), } } -func flattenDeviceProperties(input *databoxedge.DeviceProperties) []DevicePropertiesModel { +func flattenDeviceProperties(input *devices.DataBoxEdgeDeviceProperties) []DevicePropertiesModel { output := make([]DevicePropertiesModel, 0) configuredRoleTypes := make([]string, 0) @@ -333,8 +327,8 @@ func flattenDeviceProperties(input *databoxedge.DeviceProperties) []DeviceProper o.ConfiguredRoleTypes = configuredRoleTypes } - if input.DataBoxEdgeDeviceStatus != "" { - status = string(input.DataBoxEdgeDeviceStatus) + if v := input.DataBoxEdgeDeviceStatus; v != nil && *v != "" { + status = string(*v) o.Status = status } @@ -363,13 +357,13 @@ func flattenDeviceProperties(input *databoxedge.DeviceProperties) []DeviceProper o.SoftwareVersion = softwareVersion } - if input.DeviceType != "" { - deviceType = string(input.DeviceType) + if v := input.DeviceType; v != nil && *v != "" { + deviceType = string(*v) o.Type = deviceType } if input.NodeCount != nil { - nodeCount = *input.NodeCount + nodeCount = int32(*input.NodeCount) o.NodeCount = nodeCount } @@ -389,22 +383,22 @@ func flattenDeviceProperties(input *databoxedge.DeviceProperties) []DeviceProper return output } -func flattenDeviceSku(input *databoxedge.Sku) string { +func flattenDeviceSku(input *devices.Sku) string { if input == nil { return "" } - var name databoxedge.SkuName - var tier databoxedge.SkuTier + var name devices.SkuName + var tier devices.SkuTier - if input.Name != "" { - name = input.Name + if v := input.Name; v != nil && *v != "" { + name = *v } - if input.Tier != "" { - tier = input.Tier + if v := input.Tier; v != nil && *v != "" { + tier = *v } else { - tier = databoxedge.Standard + tier = devices.SkuTierStandard } skuName := fmt.Sprintf("%s-%s", name, tier) diff --git a/internal/services/databoxedge/databox_edge_device_resource_test.go b/internal/services/databoxedge/databox_edge_device_resource_test.go index 929eb2b17943..73fe8fb28763 100644 --- a/internal/services/databoxedge/databox_edge_device_resource_test.go +++ b/internal/services/databoxedge/databox_edge_device_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -97,17 +97,17 @@ func TestAccDataboxEdgeDevice_update(t *testing.T) { } func (DataboxEdgeDeviceResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DeviceID(state.ID) + id, err := devices.ParseDataBoxEdgeDeviceID(state.ID) if err != nil { return nil, err } - resp, err := clients.DataboxEdge.DeviceClient.Get(ctx, id.DataBoxEdgeDeviceName, id.ResourceGroup) + resp, err := clients.DataboxEdge.DeviceClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.DeviceProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } // Location has to be hard coded due to limited support of locations for this resource diff --git a/internal/services/databoxedge/databox_edge_order_resource.go b/internal/services/databoxedge/databox_edge_order_resource.go index c76c5dd4413f..12063fad5586 100644 --- a/internal/services/databoxedge/databox_edge_order_resource.go +++ b/internal/services/databoxedge/databox_edge_order_resource.go @@ -23,6 +23,8 @@ func resourceOrder() *pluginsdk.Resource { Update: resourceOrderCreateUpdate, Delete: resourceOrderDelete, + DeprecationMessage: `Creating DataBox Edge Orders are not supported via the Azure API - as such the 'azurerm_databox_edge_order' resource is deprecated and will be removed in v4.0 of the AzureRM Provider`, + Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), Read: pluginsdk.DefaultTimeout(5 * time.Minute), diff --git a/internal/services/databoxedge/databox_edge_order_resource_test.go b/internal/services/databoxedge/databox_edge_order_resource_test.go index 95405323f445..554c0ec9babe 100644 --- a/internal/services/databoxedge/databox_edge_order_resource_test.go +++ b/internal/services/databoxedge/databox_edge_order_resource_test.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -19,6 +20,10 @@ func TestAccDataboxEdgeOrder_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_databox_edge_order", "test") r := DataboxEdgeOrderResource{} + if features.FourPointOhBeta() { + t.Skipf("Skipping since `azurerm_databox_edge_order` is deprecated and will be removed in 4.0") + } + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), @@ -35,6 +40,10 @@ func TestAccDataboxEdgeOrder_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_databox_edge_order", "test") r := DataboxEdgeOrderResource{} + if features.FourPointOhBeta() { + t.Skipf("Skipping since `azurerm_databox_edge_order` is deprecated and will be removed in 4.0") + } + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), @@ -53,6 +62,10 @@ func TestAccDataboxEdgeOrder_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_databox_edge_order", "test") r := DataboxEdgeOrderResource{} + if features.FourPointOhBeta() { + t.Skipf("Skipping since `azurerm_databox_edge_order` is deprecated and will be removed in 4.0") + } + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), diff --git a/internal/services/databoxedge/parse/device.go b/internal/services/databoxedge/parse/device.go deleted file mode 100644 index c9cbeccb0c3d..000000000000 --- a/internal/services/databoxedge/parse/device.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DeviceId struct { - SubscriptionId string - ResourceGroup string - DataBoxEdgeDeviceName string -} - -func NewDeviceID(subscriptionId, resourceGroup, dataBoxEdgeDeviceName string) DeviceId { - return DeviceId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - DataBoxEdgeDeviceName: dataBoxEdgeDeviceName, - } -} - -func (id DeviceId) String() string { - segments := []string{ - fmt.Sprintf("Data Box Edge Device Name %q", id.DataBoxEdgeDeviceName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Device", segmentsStr) -} - -func (id DeviceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.DataBoxEdgeDeviceName) -} - -// DeviceID parses a Device ID into an DeviceId struct -func DeviceID(input string) (*DeviceId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DeviceId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.DataBoxEdgeDeviceName, err = id.PopSegment("dataBoxEdgeDevices"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/databoxedge/parse/device_test.go b/internal/services/databoxedge/parse/device_test.go deleted file mode 100644 index 27357aa8665d..000000000000 --- a/internal/services/databoxedge/parse/device_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = DeviceId{} - -func TestDeviceIDFormatter(t *testing.T) { - actual := NewDeviceID("12345678-1234-9876-4563-123456789012", "resGroup1", "device1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/device1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestDeviceID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DeviceId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing DataBoxEdgeDeviceName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataBoxEdge/", - Error: true, - }, - - { - // missing value for DataBoxEdgeDeviceName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/device1", - Expected: &DeviceId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - DataBoxEdgeDeviceName: "device1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DATABOXEDGE/DATABOXEDGEDEVICES/DEVICE1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DeviceID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.DataBoxEdgeDeviceName != v.Expected.DataBoxEdgeDeviceName { - t.Fatalf("Expected %q but got %q for DataBoxEdgeDeviceName", v.Expected.DataBoxEdgeDeviceName, actual.DataBoxEdgeDeviceName) - } - } -} diff --git a/internal/services/databoxedge/registration.go b/internal/services/databoxedge/registration.go index 94e2d3347510..51ddc4db4e85 100644 --- a/internal/services/databoxedge/registration.go +++ b/internal/services/databoxedge/registration.go @@ -1,6 +1,7 @@ package databoxedge import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -47,7 +48,10 @@ func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { // SupportedResources returns the supported Resources supported by this Service func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { - return map[string]*pluginsdk.Resource{ - "azurerm_databox_edge_order": resourceOrder(), + if !features.FourPointOhBeta() { + return map[string]*pluginsdk.Resource{ + "azurerm_databox_edge_order": resourceOrder(), + } } + return map[string]*pluginsdk.Resource{} } diff --git a/internal/services/databoxedge/resourceids.go b/internal/services/databoxedge/resourceids.go index a5583e75e9ba..61380c4cde4f 100644 --- a/internal/services/databoxedge/resourceids.go +++ b/internal/services/databoxedge/resourceids.go @@ -1,4 +1,3 @@ package databoxedge -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Device -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/device1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Order -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/device1/orders/default diff --git a/internal/services/databoxedge/validate/device_id.go b/internal/services/databoxedge/validate/device_id.go deleted file mode 100644 index 6b61d2cf4c6d..000000000000 --- a/internal/services/databoxedge/validate/device_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/parse" -) - -func DeviceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DeviceID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/databoxedge/validate/device_id_test.go b/internal/services/databoxedge/validate/device_id_test.go deleted file mode 100644 index 9bba5e8b2e6e..000000000000 --- a/internal/services/databoxedge/validate/device_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestDeviceID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing DataBoxEdgeDeviceName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataBoxEdge/", - Valid: false, - }, - - { - // missing value for DataBoxEdgeDeviceName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/device1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DATABOXEDGE/DATABOXEDGEDEVICES/DEVICE1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := DeviceID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/databricks/client/client.go b/internal/services/databricks/client/client.go index 88036ed562c8..9333d0ff5307 100644 --- a/internal/services/databricks/client/client.go +++ b/internal/services/databricks/client/client.go @@ -2,7 +2,7 @@ package client import ( "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/accessconnector" - "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/workspaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) diff --git a/internal/services/databricks/databricks_access_connector_resource.go b/internal/services/databricks/databricks_access_connector_resource.go index c6062e0f90cc..61f3f2a84542 100644 --- a/internal/services/databricks/databricks_access_connector_resource.go +++ b/internal/services/databricks/databricks_access_connector_resource.go @@ -42,7 +42,7 @@ func (r AccessConnectorResource) Arguments() map[string]*pluginsdk.Schema { "resource_group_name": commonschema.ResourceGroupName(), - "identity": commonschema.SystemAssignedIdentityRequired(), + "identity": commonschema.SystemAssignedIdentityOptional(), "tags": commonschema.Tags(), } @@ -160,7 +160,7 @@ func (r AccessConnectorResource) Read() sdk.ResourceFunc { } state := AccessConnectorResourceModel{ - Name: id.ConnectorName, + Name: id.AccessConnectorName, Location: location.NormalizeNilable(utils.String(resp.Model.Location)), ResourceGroup: id.ResourceGroupName, } diff --git a/internal/services/databricks/databricks_access_connector_resource_test.go b/internal/services/databricks/databricks_access_connector_resource_test.go index 3cc85c685d1c..b70091a337d9 100644 --- a/internal/services/databricks/databricks_access_connector_resource_test.go +++ b/internal/services/databricks/databricks_access_connector_resource_test.go @@ -30,6 +30,21 @@ func TestAccDatabricksAccessConnector_basic(t *testing.T) { }) } +func TestAccDatabricksAccessConnector_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_databricks_access_connector", "test") + r := DatabricksAccessConnectorResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func TestAccDatabricksAccessConnector_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_databricks_access_connector", "test") r := DatabricksAccessConnectorResource{} @@ -53,13 +68,13 @@ func (DatabricksAccessConnectorResource) Exists(ctx context.Context, clients *cl resp, err := clients.DataBricks.AccessConnectorClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Databricks Access Connector %q (resource group: %q): %+v", id.ConnectorName, id.ResourceGroupName, err) + return nil, fmt.Errorf("retrieving %s: %+v", id.ID(), err) } return utils.Bool(resp.Model != nil), nil } -func (DatabricksAccessConnectorResource) basic(data acceptance.TestData) string { +func (DatabricksAccessConnectorResource) complete(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { features {} @@ -81,6 +96,25 @@ resource "azurerm_databricks_access_connector" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } +func (DatabricksAccessConnectorResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-databricks-%d" + location = "%s" +} + +resource "azurerm_databricks_access_connector" "test" { + name = "acctestDBAC%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +} + func (DatabricksAccessConnectorResource) requiresImport(data acceptance.TestData) string { template := DatabricksAccessConnectorResource{}.basic(data) return fmt.Sprintf(` @@ -90,9 +124,6 @@ resource "azurerm_databricks_access_connector" "import" { name = azurerm_databricks_access_connector.test.name resource_group_name = azurerm_databricks_access_connector.test.resource_group_name location = azurerm_databricks_access_connector.test.location - identity { - type = "SystemAssigned" - } } `, template) } diff --git a/internal/services/databricks/databricks_customer_managed_key_resource.go b/internal/services/databricks/databricks_customer_managed_key_resource.go index 418900dd99a7..1cc9b927c885 100644 --- a/internal/services/databricks/databricks_customer_managed_key_resource.go +++ b/internal/services/databricks/databricks_customer_managed_key_resource.go @@ -8,7 +8,7 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/workspaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" diff --git a/internal/services/databricks/databricks_customer_managed_key_resource_test.go b/internal/services/databricks/databricks_customer_managed_key_resource_test.go index 2885f8972b99..dc3a65d8834e 100644 --- a/internal/services/databricks/databricks_customer_managed_key_resource_test.go +++ b/internal/services/databricks/databricks_customer_managed_key_resource_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/workspaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/databricks/databricks_workspace_data_source.go b/internal/services/databricks/databricks_workspace_data_source.go index 64d2ab07624e..d62fc1968074 100644 --- a/internal/services/databricks/databricks_workspace_data_source.go +++ b/internal/services/databricks/databricks_workspace_data_source.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/workspaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -46,6 +46,31 @@ func dataSourceDatabricksWorkspace() *pluginsdk.Resource { Computed: true, }, + "managed_disk_identity": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "principal_id": { + Type: pluginsdk.TypeString, + Sensitive: true, + Computed: true, + }, + + "tenant_id": { + Type: pluginsdk.TypeString, + Sensitive: true, + Computed: true, + }, + + "type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + "storage_account_identity": { Type: pluginsdk.TypeList, Computed: true, @@ -102,9 +127,12 @@ func dataSourceDatabricksWorkspaceRead(d *pluginsdk.ResourceData, meta interface d.Set("sku", sku.Name) } d.Set("workspace_id", model.Properties.WorkspaceId) - if err := d.Set("storage_account_identity", flattenWorkspaceStorageAccountIdentity(model.Properties.StorageAccountIdentity)); err != nil { + if err := d.Set("storage_account_identity", flattenWorkspaceManagedIdentity(model.Properties.StorageAccountIdentity)); err != nil { return fmt.Errorf("setting `storage_account_identity`: %+v", err) } + if err := d.Set("managed_disk_identity", flattenWorkspaceManagedIdentity(model.Properties.StorageAccountIdentity)); err != nil { + return fmt.Errorf("setting `managed_disk_identity`: %+v", err) + } d.Set("workspace_url", model.Properties.WorkspaceUrl) d.Set("location", model.Location) diff --git a/internal/services/databricks/databricks_workspace_private_endpoint_connection_data_source.go b/internal/services/databricks/databricks_workspace_private_endpoint_connection_data_source.go index 3526fc9d1c8a..17079a307f55 100644 --- a/internal/services/databricks/databricks_workspace_private_endpoint_connection_data_source.go +++ b/internal/services/databricks/databricks_workspace_private_endpoint_connection_data_source.go @@ -5,7 +5,7 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/workspaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" diff --git a/internal/services/databricks/databricks_workspace_resource.go b/internal/services/databricks/databricks_workspace_resource.go index bf95672c4fe3..392581543742 100644 --- a/internal/services/databricks/databricks_workspace_resource.go +++ b/internal/services/databricks/databricks_workspace_resource.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/workspaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -79,7 +79,6 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource { "customer_managed_key_enabled": { Type: pluginsdk.TypeBool, - ForceNew: true, Optional: true, Default: false, }, @@ -87,10 +86,46 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource { "managed_services_cmk_key_vault_key_id": { Type: pluginsdk.TypeString, Optional: true, - ForceNew: true, ValidateFunc: keyVaultValidate.KeyVaultChildID, }, + "managed_disk_cmk_key_vault_key_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: keyVaultValidate.KeyVaultChildID, + }, + + "managed_disk_identity": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "principal_id": { + Type: pluginsdk.TypeString, + Sensitive: true, + Computed: true, + }, + + "tenant_id": { + Type: pluginsdk.TypeString, + Sensitive: true, + Computed: true, + }, + + "type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "managed_disk_cmk_rotation_to_latest_version_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + RequiredWith: []string{"managed_disk_cmk_key_vault_key_id"}, + }, + "infrastructure_encryption_enabled": { Type: pluginsdk.TypeBool, ForceNew: true, @@ -100,7 +135,6 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource { "public_network_access_enabled": { Type: pluginsdk.TypeBool, - ForceNew: true, Optional: true, Default: true, }, @@ -108,7 +142,6 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource { "network_security_group_rules_required": { Type: pluginsdk.TypeString, Optional: true, - ForceNew: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{ string(workspaces.RequiredNsgRulesAllRules), @@ -149,7 +182,6 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource { "no_public_ip": { Type: pluginsdk.TypeBool, - ForceNew: true, Optional: true, Computed: true, AtLeastOneOf: workspaceCustomParametersString(), @@ -242,6 +274,11 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource { Computed: true, }, + "disk_encryption_set_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "storage_account_identity": { Type: pluginsdk.TypeList, Computed: true, @@ -277,6 +314,7 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource { _, requireNsgRules := d.GetChange("network_security_group_rules_required") _, backendPool := d.GetChange("load_balancer_backend_address_pool_id") _, managedServicesCMK := d.GetChange("managed_services_cmk_key_vault_key_id") + _, managedDiskCMK := d.GetChange("managed_disk_cmk_key_vault_key_id") oldSku, newSku := d.GetChange("sku") @@ -302,8 +340,8 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource { } } - if (customerEncryptionEnabled.(bool) || infrastructureEncryptionEnabled.(bool) || managedServicesCMK.(string) != "") && !strings.EqualFold("premium", newSku.(string)) { - return fmt.Errorf("'customer_managed_key_enabled', 'infrastructure_encryption_enabled' and 'managed_services_cmk_key_vault_key_id' are only available with a 'premium' workspace 'sku', got %q", newSku) + if (customerEncryptionEnabled.(bool) || infrastructureEncryptionEnabled.(bool) || managedServicesCMK.(string) != "" || managedDiskCMK.(string) != "") && !strings.EqualFold("premium", newSku.(string)) { + return fmt.Errorf("'customer_managed_key_enabled', 'infrastructure_encryption_enabled', 'managed_disk_cmk_key_vault_key_id' and 'managed_services_cmk_key_vault_key_id' are only available with a 'premium' workspace 'sku', got %q", newSku) } return nil @@ -408,30 +446,59 @@ func resourceDatabricksWorkspaceCreateUpdate(d *pluginsdk.ResourceData, meta int // Set up customer-managed keys for managed services encryption (e.g. notebook) setEncrypt := false encrypt := &workspaces.WorkspacePropertiesEncryption{} - keyIdRaw := d.Get("managed_services_cmk_key_vault_key_id").(string) - if keyIdRaw != "" { + encrypt.Entities = workspaces.EncryptionEntitiesDefinition{} + servicesKeyIdRaw := d.Get("managed_services_cmk_key_vault_key_id").(string) + if servicesKeyIdRaw != "" { setEncrypt = true - key, err := keyVaultParse.ParseNestedItemID(keyIdRaw) + key, err := keyVaultParse.ParseNestedItemID(servicesKeyIdRaw) if err != nil { return err } - encrypt.Entities = workspaces.EncryptionEntitiesDefinition{ - ManagedServices: &workspaces.EncryptionV2{ - // There is only one valid source for this field at this point in time so I have hardcoded the value - KeySource: workspaces.EncryptionKeySourceMicrosoftPointKeyvault, - KeyVaultProperties: &workspaces.EncryptionV2KeyVaultProperties{ - KeyName: key.Name, - KeyVersion: key.Version, - KeyVaultUri: key.KeyVaultBaseUrl, - }, + // make sure the key vault exists + keyVaultIdRaw, err := keyVaultsClient.KeyVaultIDFromBaseUrl(ctx, meta.(*clients.Client).Resource, key.KeyVaultBaseUrl) + if err != nil || keyVaultIdRaw == nil { + return fmt.Errorf("retrieving the Resource ID for the customer-managed keys for managed services Key Vault at URL %q: %+v", key.KeyVaultBaseUrl, err) + } + + encrypt.Entities.ManagedServices = &workspaces.EncryptionV2{ + // There is only one valid source for this field at this point in time so I have hardcoded the value + KeySource: workspaces.EncryptionKeySourceMicrosoftPointKeyvault, + KeyVaultProperties: &workspaces.EncryptionV2KeyVaultProperties{ + KeyName: key.Name, + KeyVersion: key.Version, + KeyVaultUri: key.KeyVaultBaseUrl, }, } + } + + diskKeyIdRaw := d.Get("managed_disk_cmk_key_vault_key_id").(string) + if diskKeyIdRaw != "" { + setEncrypt = true + key, err := keyVaultParse.ParseNestedItemID(diskKeyIdRaw) + if err != nil { + return err + } // make sure the key vault exists keyVaultIdRaw, err := keyVaultsClient.KeyVaultIDFromBaseUrl(ctx, meta.(*clients.Client).Resource, key.KeyVaultBaseUrl) if err != nil || keyVaultIdRaw == nil { - return fmt.Errorf("retrieving the Resource ID for the customer-managed keys for managed services Key Vault at URL %q: %+v", key.KeyVaultBaseUrl, err) + return fmt.Errorf("retrieving the Resource ID for the customer-managed keys for managed disk Key Vault at URL %q: %+v", key.KeyVaultBaseUrl, err) + } + + encrypt.Entities.ManagedDisk = &workspaces.ManagedDiskEncryption{ + // There is only one valid source for this field at this point in time so I have hardcoded the value + KeySource: workspaces.EncryptionKeySourceMicrosoftPointKeyvault, + KeyVaultProperties: workspaces.ManagedDiskEncryptionKeyVaultProperties{ + KeyName: key.Name, + KeyVersion: key.Version, + KeyVaultUri: key.KeyVaultBaseUrl, + }, + } + + rotationEnabled := d.Get("managed_disk_cmk_rotation_to_latest_version_enabled").(bool) + if rotationEnabled { + encrypt.Entities.ManagedDisk.RotationToLatestKeyVersionEnabled = utils.Bool(rotationEnabled) } } @@ -490,8 +557,12 @@ func resourceDatabricksWorkspaceCreateUpdate(d *pluginsdk.ResourceData, meta int return fmt.Errorf("setting `custom_parameters`: %+v", err) } - if encrypt != nil && keyIdRaw != "" { - d.Set("managed_services_cmk_key_vault_key_id", keyIdRaw) + if encrypt != nil && servicesKeyIdRaw != "" { + d.Set("managed_services_cmk_key_vault_key_id", servicesKeyIdRaw) + } + + if encrypt != nil && diskKeyIdRaw != "" { + d.Set("managed_disk_cmk_key_vault_key_id", diskKeyIdRaw) } return resourceDatabricksWorkspaceRead(d, meta) @@ -570,10 +641,14 @@ func resourceDatabricksWorkspaceRead(d *pluginsdk.ResourceData, meta interface{} d.Set("load_balancer_backend_address_pool_id", backendPoolReadId) } - if err := d.Set("storage_account_identity", flattenWorkspaceStorageAccountIdentity(model.Properties.StorageAccountIdentity)); err != nil { + if err := d.Set("storage_account_identity", flattenWorkspaceManagedIdentity(model.Properties.StorageAccountIdentity)); err != nil { return fmt.Errorf("setting `storage_account_identity`: %+v", err) } + if err := d.Set("managed_disk_identity", flattenWorkspaceManagedIdentity(model.Properties.ManagedDiskIdentity)); err != nil { + return fmt.Errorf("setting `managed_disk_identity`: %+v", err) + } + if model.Properties.WorkspaceUrl != nil { d.Set("workspace_url", model.Properties.WorkspaceUrl) } @@ -601,6 +676,31 @@ func resourceDatabricksWorkspaceRead(d *pluginsdk.ResourceData, meta interface{} d.Set("managed_services_cmk_key_vault_key_id", key.ID()) } } + // customer managed key for managed disk + encryptDiskKeyName := "" + encryptDiskKeyVersion := "" + encryptDiskKeyVaultURI := "" + encryptDiskRotationEnabled := false + + if encryption := model.Properties.Encryption; encryption != nil { + if encryptionProps := encryption.Entities.ManagedDisk; encryptionProps != nil { + encryptDiskKeyName = encryptionProps.KeyVaultProperties.KeyName + encryptDiskKeyVersion = encryptionProps.KeyVaultProperties.KeyVersion + encryptDiskKeyVaultURI = encryptionProps.KeyVaultProperties.KeyVaultUri + encryptDiskRotationEnabled = *encryptionProps.RotationToLatestKeyVersionEnabled + } + + } + + if encryptDiskKeyVaultURI != "" { + key, err := keyVaultParse.NewNestedItemID(encryptDiskKeyVaultURI, "keys", encryptDiskKeyName, encryptDiskKeyVersion) + if err == nil { + d.Set("managed_disk_cmk_key_vault_key_id", key.ID()) + } + d.Set("managed_disk_cmk_rotation_to_latest_version_enabled", encryptDiskRotationEnabled) + d.Set("disk_encryption_set_id", model.Properties.DiskEncryptionSetId) + } + return tags.FlattenAndSet(d, model.Tags) } @@ -624,7 +724,7 @@ func resourceDatabricksWorkspaceDelete(d *pluginsdk.ResourceData, meta interface return nil } -func flattenWorkspaceStorageAccountIdentity(input *workspaces.ManagedIdentityConfiguration) []interface{} { +func flattenWorkspaceManagedIdentity(input *workspaces.ManagedIdentityConfiguration) []interface{} { if input == nil { return nil } diff --git a/internal/services/databricks/databricks_workspace_resource_test.go b/internal/services/databricks/databricks_workspace_resource_test.go index b6a42c118a2c..5c4b62530861 100644 --- a/internal/services/databricks/databricks_workspace_resource_test.go +++ b/internal/services/databricks/databricks_workspace_resource_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/workspaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -173,6 +173,28 @@ func TestAccDatabricksWorkspace_update(t *testing.T) { }) } +func TestAccDatabricksWorkspace_extendedUpdate(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_databricks_workspace", "test") + r := DatabricksWorkspaceResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.extendedUpdateCreate(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("custom_parameters.0.public_subnet_network_security_group_association_id", "custom_parameters.0.private_subnet_network_security_group_association_id"), + { + Config: r.extendedUpdateUpdate(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("custom_parameters.0.public_subnet_network_security_group_association_id", "custom_parameters.0.private_subnet_network_security_group_association_id"), + }) +} + func TestAccDatabricksWorkspace_updateSKU(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_databricks_workspace", "test") r := DatabricksWorkspaceResource{} @@ -234,6 +256,22 @@ func TestAccDatabricksWorkspace_managedServicesAndDbfsCMK(t *testing.T) { }) } +func TestAccDatabricksWorkspace_managedDiskCMK(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_databricks_workspace", "test") + databricksPrincipalID := getDatabricksPrincipalId(data.Client().SubscriptionID) + r := DatabricksWorkspaceResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.managedDiskCMK(data, databricksPrincipalID), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("custom_parameters.0.public_subnet_network_security_group_association_id", "custom_parameters.0.private_subnet_network_security_group_association_id"), + }) +} + func TestAccDatabricksWorkspace_managedServicesDbfsCMKAndPrivateLink(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_databricks_workspace", "test") databricksPrincipalID := getDatabricksPrincipalId(data.Client().SubscriptionID) @@ -412,6 +450,213 @@ resource "azurerm_databricks_workspace" "test" { sku = "standard" managed_resource_group_name = "acctestRG-DBW-%[1]d-managed" + custom_parameters { + no_public_ip = false + public_subnet_name = azurerm_subnet.public.name + private_subnet_name = azurerm_subnet.private.name + virtual_network_id = azurerm_virtual_network.test.id + + public_subnet_network_security_group_association_id = azurerm_subnet_network_security_group_association.public.id + private_subnet_network_security_group_association_id = azurerm_subnet_network_security_group_association.private.id + } + + tags = { + Environment = "Production" + Pricing = "Standard" + } +} +`, data.RandomInteger, data.Locations.Primary) +} + +func (DatabricksWorkspaceResource) extendedUpdateCreate(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-databricks-%[1]d" + location = "%[2]s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctest-vnet-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + address_space = ["10.0.0.0/16"] +} + +resource "azurerm_subnet" "public" { + name = "acctest-sn-public-%[1]d" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test.name + address_prefixes = ["10.0.1.0/24"] + + delegation { + name = "acctest" + + service_delegation { + name = "Microsoft.Databricks/workspaces" + + actions = [ + "Microsoft.Network/virtualNetworks/subnets/join/action", + "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action", + "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action", + ] + } + } +} + +resource "azurerm_subnet" "private" { + name = "acctest-sn-private-%[1]d" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test.name + address_prefixes = ["10.0.2.0/24"] + + delegation { + name = "acctest" + + service_delegation { + name = "Microsoft.Databricks/workspaces" + + actions = [ + "Microsoft.Network/virtualNetworks/subnets/join/action", + "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action", + "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action", + ] + } + } +} + +resource "azurerm_network_security_group" "nsg" { + name = "acctest-nsg-private-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_subnet_network_security_group_association" "public" { + subnet_id = azurerm_subnet.public.id + network_security_group_id = azurerm_network_security_group.nsg.id +} + +resource "azurerm_subnet_network_security_group_association" "private" { + subnet_id = azurerm_subnet.private.id + network_security_group_id = azurerm_network_security_group.nsg.id +} + +resource "azurerm_databricks_workspace" "test" { + name = "acctestDBW-%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku = "premium" + managed_resource_group_name = "acctestRG-DBW-%[1]d-managed" + public_network_access_enabled = true + customer_managed_key_enabled = true + + custom_parameters { + no_public_ip = true + public_subnet_name = azurerm_subnet.public.name + private_subnet_name = azurerm_subnet.private.name + virtual_network_id = azurerm_virtual_network.test.id + + public_subnet_network_security_group_association_id = azurerm_subnet_network_security_group_association.public.id + private_subnet_network_security_group_association_id = azurerm_subnet_network_security_group_association.private.id + } + + tags = { + Environment = "Production" + Pricing = "Standard" + } +} +`, data.RandomInteger, data.Locations.Primary) +} + +func (DatabricksWorkspaceResource) extendedUpdateUpdate(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-databricks-%[1]d" + location = "%[2]s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctest-vnet-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + address_space = ["10.0.0.0/16"] +} + +resource "azurerm_subnet" "public" { + name = "acctest-sn-public-%[1]d" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test.name + address_prefixes = ["10.0.1.0/24"] + + delegation { + name = "acctest" + + service_delegation { + name = "Microsoft.Databricks/workspaces" + + actions = [ + "Microsoft.Network/virtualNetworks/subnets/join/action", + "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action", + "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action", + ] + } + } +} + +resource "azurerm_subnet" "private" { + name = "acctest-sn-private-%[1]d" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test.name + address_prefixes = ["10.0.2.0/24"] + + delegation { + name = "acctest" + + service_delegation { + name = "Microsoft.Databricks/workspaces" + + actions = [ + "Microsoft.Network/virtualNetworks/subnets/join/action", + "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action", + "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action", + ] + } + } +} + +resource "azurerm_network_security_group" "nsg" { + name = "acctest-nsg-private-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_subnet_network_security_group_association" "public" { + subnet_id = azurerm_subnet.public.id + network_security_group_id = azurerm_network_security_group.nsg.id +} + +resource "azurerm_subnet_network_security_group_association" "private" { + subnet_id = azurerm_subnet.private.id + network_security_group_id = azurerm_network_security_group.nsg.id +} + +resource "azurerm_databricks_workspace" "test" { + name = "acctestDBW-%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku = "premium" + managed_resource_group_name = "acctestRG-DBW-%[1]d-managed" + public_network_access_enabled = false + network_security_group_rules_required = "NoAzureDatabricksRules" + customer_managed_key_enabled = false + custom_parameters { no_public_ip = true public_subnet_name = azurerm_subnet.public.name @@ -1228,6 +1473,119 @@ resource "azurerm_key_vault_access_policy" "databricks" { `, data.RandomInteger, data.Locations.Primary, data.RandomString, databricksPrincipalID) } +func (DatabricksWorkspaceResource) managedDiskCMK(data acceptance.TestData, databricksPrincipalID string) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-databricks-%[1]d" + location = "%[2]s" +} + +resource "azurerm_databricks_workspace" "test" { + depends_on = [azurerm_key_vault_access_policy.managed] + + name = "acctestDBW-%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku = "premium" + managed_resource_group_name = "acctestRG-DBW-%[1]d-managed" + + customer_managed_key_enabled = true + managed_disk_cmk_key_vault_key_id = azurerm_key_vault_key.test.id + + tags = { + Environment = "Production" + Pricing = "Premium" + } +} + +resource "azurerm_key_vault" "test" { + name = "acctest-kv-%[3]s" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + tenant_id = data.azurerm_client_config.current.tenant_id + sku_name = "premium" + + soft_delete_retention_days = 7 +} + +resource "azurerm_key_vault_key" "test" { + depends_on = [azurerm_key_vault_access_policy.terraform] + + name = "acctest-certificate" + key_vault_id = azurerm_key_vault.test.id + key_type = "RSA" + key_size = 2048 + + key_opts = [ + "decrypt", + "encrypt", + "sign", + "unwrapKey", + "verify", + "wrapKey", + ] +} + +resource "azurerm_key_vault_access_policy" "terraform" { + key_vault_id = azurerm_key_vault.test.id + tenant_id = azurerm_key_vault.test.tenant_id + object_id = data.azurerm_client_config.current.object_id + + key_permissions = [ + "Get", + "List", + "Create", + "Decrypt", + "Encrypt", + "Sign", + "UnwrapKey", + "Verify", + "WrapKey", + "Delete", + "Restore", + "Recover", + "Update", + "Purge", + ] +} + +resource "azurerm_key_vault_access_policy" "managed" { + key_vault_id = azurerm_key_vault.test.id + tenant_id = azurerm_key_vault.test.tenant_id + object_id = "%[4]s" + + key_permissions = [ + "Get", + "List", + "Encrypt", + "Decrypt", + "UnwrapKey", + "WrapKey", + ] +} + +resource "azurerm_key_vault_access_policy" "databricks" { + depends_on = [azurerm_databricks_workspace.test] + + key_vault_id = azurerm_key_vault.test.id + tenant_id = azurerm_databricks_workspace.test.managed_disk_identity.0.tenant_id + object_id = azurerm_databricks_workspace.test.managed_disk_identity.0.principal_id + + key_permissions = [ + "Get", + "UnwrapKey", + "WrapKey", + ] +} +`, data.RandomInteger, data.Locations.Primary, data.RandomString, databricksPrincipalID) +} + func (DatabricksWorkspaceResource) managedServicesDbfsCMKAndPrivateLink(data acceptance.TestData, databricksPrincipalID string) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/databricks/migration/customer_managed_key.go b/internal/services/databricks/migration/customer_managed_key.go index 8c16f3a0a91f..6b21c3db870f 100644 --- a/internal/services/databricks/migration/customer_managed_key.go +++ b/internal/services/databricks/migration/customer_managed_key.go @@ -7,7 +7,7 @@ import ( "strings" "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" - "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/workspaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/databricks/validate/access_connector_name.go b/internal/services/databricks/validate/access_connector_name.go index 99c6c331cbf7..f22e01bb1d3e 100644 --- a/internal/services/databricks/validate/access_connector_name.go +++ b/internal/services/databricks/validate/access_connector_name.go @@ -26,9 +26,9 @@ func AccessConnectorName(i interface{}, k string) (warnings []string, errors []e errors = append(errors, fmt.Errorf("%q must be at least 1 character: %q", k, v)) } - // 3) The value must have a length of at most 30 - if len(v) > 30 { - errors = append(errors, fmt.Errorf("%q must be no more than 30 characters: %q", k, v)) + // 3) The value must have a length of at most 64 + if len(v) > 64 { + errors = append(errors, fmt.Errorf("%q must be no more than 64 characters: %q", k, v)) } // 4) Only alphanumeric characters, underscores, and hyphens are allowed. diff --git a/internal/services/databricks/validate/access_connector_name_test.go b/internal/services/databricks/validate/access_connector_name_test.go index f9397b704305..0e81bc2d3b23 100644 --- a/internal/services/databricks/validate/access_connector_name_test.go +++ b/internal/services/databricks/validate/access_connector_name_test.go @@ -7,7 +7,7 @@ import ( func TestAccessConnectorName(t *testing.T) { const errEmpty = "cannot be an empty string" - const errMaxLen = "must be no more than 30 characters" + const errMaxLen = "must be no more than 64 characters" const errAllowList = "can contain only alphanumeric characters, underscores, and hyphens" cases := []struct { @@ -26,7 +26,7 @@ func TestAccessConnectorName(t *testing.T) { }, { Name: "Maximum character length", - Input: "012345678901234567890123456789", // 30 chars + Input: "0123456789012345678901234567890123456789012345678901234567890123", // 64 chars }, // Simple negative cases: @@ -37,7 +37,7 @@ func TestAccessConnectorName(t *testing.T) { }, { Name: "Above maximum character length", - Input: "01234567890123456789012345678901", // 31 chars + Input: "01234567890123456789012345678901234567890123456789012345678901234", // 65 chars ExpectedErrors: []string{errMaxLen}, }, { diff --git a/internal/services/datadog/azurerm_datadog_monitor_sso_configuration.go b/internal/services/datadog/azurerm_datadog_monitor_sso_configuration.go index 1d9beb4c959a..212e35bd1091 100644 --- a/internal/services/datadog/azurerm_datadog_monitor_sso_configuration.go +++ b/internal/services/datadog/azurerm_datadog_monitor_sso_configuration.go @@ -5,20 +5,27 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" ) +// @tombuildsstuff: in 4.0 consider inlining this within the `azurerm_datadog_monitors` resource +// since this appears to be a 1:1 with it (given the name defaults to `default`) + func resourceDatadogSingleSignOnConfigurations() *pluginsdk.Resource { return &pluginsdk.Resource{ - Create: resourceDatadogSingleSignOnConfigurationsCreateorUpdate, + Create: resourceDatadogSingleSignOnConfigurationsCreate, Read: resourceDatadogSingleSignOnConfigurationsRead, - Update: resourceDatadogSingleSignOnConfigurationsCreateorUpdate, + Update: resourceDatadogSingleSignOnConfigurationsUpdate, Delete: resourceDatadogSingleSignOnConfigurationsDelete, Timeouts: &pluginsdk.ResourceTimeout{ @@ -29,7 +36,7 @@ func resourceDatadogSingleSignOnConfigurations() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DatadogSingleSignOnConfigurationsID(id) + _, err := singlesignon.ParseSingleSignOnConfigurationID(id) return err }), @@ -38,7 +45,7 @@ func resourceDatadogSingleSignOnConfigurations() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.DatadogMonitorID, + ValidateFunc: monitorsresource.ValidateMonitorID, }, "name": { @@ -56,6 +63,12 @@ func resourceDatadogSingleSignOnConfigurations() *pluginsdk.Resource { "single_sign_on_enabled": { Type: pluginsdk.TypeString, Required: true, + ValidateFunc: validation.StringInSlice([]string{ + // @tombuildsstuff: other options are available, but the Create handles this as a boolean for now + // should the field be a boolean? one to consider for 4.0 when this resource is inlined + string(singlesignon.SingleSignOnStatesEnable), + string(singlesignon.SingleSignOnStatesDisable), + }, false), }, "login_url": { @@ -66,120 +79,121 @@ func resourceDatadogSingleSignOnConfigurations() *pluginsdk.Resource { } } -func resourceDatadogSingleSignOnConfigurationsCreateorUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Datadog.SingleSignOnConfigurationsClient +func resourceDatadogSingleSignOnConfigurationsCreate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Datadog.SingleSignOn ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - datadogMonitorId := d.Get("datadog_monitor_id").(string) - configurationName := d.Get("name").(string) - enterpriseAppID := d.Get("enterprise_application_id").(string) - id, err := parse.DatadogMonitorID(datadogMonitorId) + monitorId, err := monitorsresource.ParseMonitorID(d.Get("datadog_monitor_id").(string)) if err != nil { return err } - ssoId := parse.NewDatadogSingleSignOnConfigurationsID(id.SubscriptionId, id.ResourceGroup, id.MonitorName, configurationName).ID() - - existing, err := client.Get(ctx, id.ResourceGroup, id.MonitorName, configurationName) + id := singlesignon.NewSingleSignOnConfigurationID(monitorId.SubscriptionId, monitorId.ResourceGroupName, monitorId.MonitorName, d.Get("name").(string)) + existing, err := client.ConfigurationsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for existing Datadog Monitor %q (Resource Group %q): %+v", id.ResourceGroup, id.MonitorName, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) } } - - singleSignOnState := datadog.SingleSignOnStatesEnable - if d.Get("single_sign_on_enabled").(string) == "Disable" { - singleSignOnState = datadog.SingleSignOnStatesDisable + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_datadog_monitor_sso_configuration", id.ID()) } - body := datadog.SingleSignOnResource{ - Properties: &datadog.SingleSignOnProperties{ - SingleSignOnState: singleSignOnState, - EnterpriseAppID: utils.String(enterpriseAppID), + payload := singlesignon.DatadogSingleSignOnResource{ + Properties: &singlesignon.DatadogSingleSignOnProperties{ + SingleSignOnState: pointer.To(singlesignon.SingleSignOnStates(d.Get("single_sign_on_enabled").(string))), + EnterpriseAppId: utils.String(d.Get("enterprise_application_id").(string)), }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.MonitorName, configurationName, &body) - if err != nil { - return fmt.Errorf("configuring SingleSignOn on Datadog Monitor %q (Resource Group %q): %+v", id.MonitorName, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting on configuring SingleSignOn on Datadog Monitor %s: %+v", id, err) + if err := client.ConfigurationsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } - d.SetId(ssoId) + d.SetId(id.ID()) return resourceDatadogSingleSignOnConfigurationsRead(d, meta) } func resourceDatadogSingleSignOnConfigurationsRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Datadog.SingleSignOnConfigurationsClient + client := meta.(*clients.Client).Datadog.SingleSignOn ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DatadogSingleSignOnConfigurationsID(d.Id()) + id, err := singlesignon.ParseSingleSignOnConfigurationID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.MonitorName, id.SingleSignOnConfigurationName) + resp, err := client.ConfigurationsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] Datadog monitor %q does not exist - removing from state", d.Id()) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil } } - monitorId := parse.NewDatadogMonitorID(id.SubscriptionId, id.ResourceGroup, id.MonitorName) - d.Set("datadog_monitor_id", monitorId.ID()) - d.Set("name", id.SingleSignOnConfigurationName) - if props := resp.Properties; props != nil { - d.Set("single_sign_on_enabled", props.SingleSignOnState) - d.Set("login_url", props.SingleSignOnURL) - d.Set("enterprise_application_id", props.EnterpriseAppID) + d.Set("name", id.SingleSignOnConfigurationName) + d.Set("datadog_monitor_id", monitorsresource.NewMonitorID(id.SubscriptionId, id.ResourceGroupName, id.MonitorName).ID()) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + // per the create func + singleSignOnEnabled := props.SingleSignOnState != nil && *props.SingleSignOnState == singlesignon.SingleSignOnStatesEnable + d.Set("single_sign_on_enabled", singleSignOnEnabled) + d.Set("login_url", props.SingleSignOnUrl) + d.Set("enterprise_application_id", props.EnterpriseAppId) + } } return nil } -func resourceDatadogSingleSignOnConfigurationsDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Datadog.SingleSignOnConfigurationsClient - ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) +func resourceDatadogSingleSignOnConfigurationsUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Datadog.SingleSignOn + ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DatadogSingleSignOnConfigurationsID(d.Id()) + id, err := singlesignon.ParseSingleSignOnConfigurationID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.MonitorName, id.SingleSignOnConfigurationName) - if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] Datadog monitor %q does not exist - removing from state", d.Id()) - d.SetId("") - return nil - } + payload := singlesignon.DatadogSingleSignOnResource{ + Properties: &singlesignon.DatadogSingleSignOnProperties{ + SingleSignOnState: pointer.To(singlesignon.SingleSignOnStates(d.Get("single_sign_on_enabled").(string))), + EnterpriseAppId: utils.String(d.Get("enterprise_application_id").(string)), + }, } - d.Set("enterprise_application_id", nil) - enterpriseAppID := d.Get("enterprise_application_id").(string) - - body := datadog.SingleSignOnResource{ - Properties: &datadog.SingleSignOnProperties{ - SingleSignOnState: datadog.SingleSignOnStatesDisable, - EnterpriseAppID: utils.String(enterpriseAppID), - }, + if err := client.ConfigurationsCreateOrUpdateThenPoll(ctx, *id, payload); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.MonitorName, id.SingleSignOnConfigurationName, &body) + return resourceDatadogSingleSignOnConfigurationsRead(d, meta) +} + +func resourceDatadogSingleSignOnConfigurationsDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Datadog.SingleSignOn + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := singlesignon.ParseSingleSignOnConfigurationID(d.Id()) if err != nil { - return fmt.Errorf("removing SingleSignOnConfiguration on Datadog Monitor %q (Resource Group %q): %+v", id.MonitorName, id.ResourceGroup, err) + return err + } + + // SingleSignOnConfigurations can't be removed, but can be disabled/reset, which is what we do here + payload := singlesignon.DatadogSingleSignOnResource{ + Properties: &singlesignon.DatadogSingleSignOnProperties{ + SingleSignOnState: pointer.To(singlesignon.SingleSignOnStatesDisable), + EnterpriseAppId: utils.String(""), + }, } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting on removing SingleSignOnConfiguration on Datadog Monitor %s: %+v", id, err) + if err := client.ConfigurationsCreateOrUpdateThenPoll(ctx, *id, payload); err != nil { + return fmt.Errorf("removing %s: %+v", id, err) } return nil diff --git a/internal/services/datadog/azurerm_datadog_monitor_sso_configuration_test.go b/internal/services/datadog/azurerm_datadog_monitor_sso_configuration_test.go index 8b284543bb63..f76ac3df435d 100644 --- a/internal/services/datadog/azurerm_datadog_monitor_sso_configuration_test.go +++ b/internal/services/datadog/azurerm_datadog_monitor_sso_configuration_test.go @@ -6,27 +6,40 @@ import ( "os" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) -type SSODatadogMonitorResource struct{} +type SSODatadogMonitorResource struct { + datadogApiKey string + datadogApplicationKey string + enterpriseAppId string +} -func TestAccDatadogMonitorSSO_basic(t *testing.T) { - if os.Getenv("ARM_TEST_DATADOG_API_KEY") == "" || os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY") == "" { - t.Skip("Skipping as ARM_TEST_DATADOG_API_KEY and/or ARM_TEST_DATADOG_APPLICATION_KEY are not specified") - return +func (r *SSODatadogMonitorResource) populateValuesFromEnvironment(t *testing.T) { + if os.Getenv("ARM_TEST_DATADOG_API_KEY") == "" { + t.Skip("Skipping as ARM_TEST_DATADOG_API_KEY is not specified") + } + if os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY") == "" { + t.Skip("Skipping as ARM_TEST_DATADOG_APPLICATION_KEY is not specified") } if os.Getenv("ARM_TEST_ENTERPRISE_APP_ID") == "" { - t.Skip("Skipping as Enterprise App Id for SAML is not specified") - return + t.Skip("Skipping as ARM_TEST_ENTERPRISE_APP_ID is not specified") } + + r.datadogApiKey = os.Getenv("ARM_TEST_DATADOG_API_KEY") + r.datadogApplicationKey = os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY") + r.enterpriseAppId = os.Getenv("ARM_TEST_ENTERPRISE_APP_ID") +} + +func TestAccDatadogMonitorSSO_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_datadog_monitor_sso_configuration", "test") r := SSODatadogMonitorResource{} + r.populateValuesFromEnvironment(t) data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), @@ -39,17 +52,26 @@ func TestAccDatadogMonitorSSO_basic(t *testing.T) { }) } +func TestAccDatadogMonitorSSO_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_datadog_monitor_sso_configuration", "test") + r := SSODatadogMonitorResource{} + r.populateValuesFromEnvironment(t) + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("single_sign_on_enabled").HasValue("Enable"), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + func TestAccDatadogMonitorSSO_update(t *testing.T) { - if os.Getenv("ARM_TEST_DATADOG_API_KEY") == "" || os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY") == "" { - t.Skip("Skipping as ARM_TEST_DATADOG_API_KEY and/or ARM_TEST_DATADOG_APPLICATION_KEY are not specified") - return - } - if os.Getenv("ARM_TEST_ENTERPRISE_APP_ID") == "" { - t.Skip("Skipping as Enterprise App Id for SAML is not specified") - return - } data := acceptance.BuildTestData(t, "azurerm_datadog_monitor_sso_configuration", "test") r := SSODatadogMonitorResource{} + r.populateValuesFromEnvironment(t) data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), @@ -79,40 +101,33 @@ func TestAccDatadogMonitorSSO_update(t *testing.T) { } func (r SSODatadogMonitorResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DatadogSingleSignOnConfigurationsID(state.ID) + id, err := singlesignon.ParseSingleSignOnConfigurationID(state.ID) if err != nil { return nil, err } - resp, err := client.Datadog.SingleSignOnConfigurationsClient.Get(ctx, id.ResourceGroup, id.MonitorName, id.SingleSignOnConfigurationName) + resp, err := client.Datadog.SingleSignOn.ConfigurationsGet(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Datadog Monitor %q (Resource Group %q): %+v", id.MonitorName, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - if *resp.Properties.EnterpriseAppID == "" { - return utils.Bool(false), nil - } - - return utils.Bool(true), nil + return utils.Bool(resp.Model != nil), nil } func (r SSODatadogMonitorResource) template(data acceptance.TestData) string { return fmt.Sprintf(` -provider "azurerm" { - features {} -} resource "azurerm_resource_group" "test" { - name = "acctest-datadog-%d" - location = "%s" + name = "acctest-datadogrg-%[1]d" + location = %[2]q } resource "azurerm_datadog_monitor" "test" { - name = "acctest-datadog-%d" + name = "acctest-datadog-%[3]s" resource_group_name = azurerm_resource_group.test.name - location = "WEST US 2" + location = azurerm_resource_group.test.location datadog_organization { - api_key = %q - application_key = %q + api_key = %[4]q + application_key = %[5]q } user { name = "Test Datadog" @@ -123,29 +138,49 @@ resource "azurerm_datadog_monitor" "test" { type = "SystemAssigned" } } -`, data.RandomInteger, data.Locations.Primary, data.RandomInteger%100, os.Getenv("ARM_TEST_DATADOG_API_KEY"), os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY")) +`, data.RandomInteger, data.Locations.Primary, data.RandomString, r.datadogApiKey, r.datadogApplicationKey) } func (r SSODatadogMonitorResource) basic(data acceptance.TestData) string { return fmt.Sprintf(` - %s +provider "azurerm" { + features {} +} + +%s resource "azurerm_datadog_monitor_sso_configuration" "test" { datadog_monitor_id = azurerm_datadog_monitor.test.id single_sign_on_enabled = "Enable" enterprise_application_id = %q } -`, r.template(data), os.Getenv("ARM_TEST_ENTERPRISE_APP_ID")) +`, r.template(data), r.enterpriseAppId) +} + +func (r SSODatadogMonitorResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_datadog_monitor_sso_configuration" "import" { + datadog_monitor_id = azurerm_datadog_monitor_sso_configuration.test.datadog_monitor_id + single_sign_on_enabled = azurerm_datadog_monitor_sso_configuration.test.single_sign_on_enabled + enterprise_application_id = azurerm_datadog_monitor_sso_configuration.test.enterprise_application_id +} +`, r.basic(data)) } func (r SSODatadogMonitorResource) update(data acceptance.TestData) string { return fmt.Sprintf(` - %s +provider "azurerm" { + features {} +} + +%s resource "azurerm_datadog_monitor_sso_configuration" "test" { datadog_monitor_id = azurerm_datadog_monitor.test.id single_sign_on_enabled = "Disable" enterprise_application_id = %q } -`, r.template(data), os.Getenv("ARM_TEST_ENTERPRISE_APP_ID")) +`, r.template(data), r.enterpriseAppId) } diff --git a/internal/services/datadog/client/client.go b/internal/services/datadog/client/client.go index 9e804afd17a7..690824c7f282 100644 --- a/internal/services/datadog/client/client.go +++ b/internal/services/datadog/client/client.go @@ -1,29 +1,14 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog" // nolint: staticcheck + "github.com/Azure/go-autorest/autorest" + datadog_v2021_03_01 "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) -type Client struct { - MonitorsClient *datadog.MonitorsClient - TagRulesClient *datadog.TagRulesClient - SingleSignOnConfigurationsClient *datadog.SingleSignOnConfigurationsClient -} - -func NewClient(o *common.ClientOptions) *Client { - monitorsClient := datadog.NewMonitorsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&monitorsClient.Client, o.ResourceManagerAuthorizer) - - tagRulesClient := datadog.NewTagRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&tagRulesClient.Client, o.ResourceManagerAuthorizer) - - singleSignOnConfigurationsClient := datadog.NewSingleSignOnConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&singleSignOnConfigurationsClient.Client, o.ResourceManagerAuthorizer) - - return &Client{ - MonitorsClient: &monitorsClient, - TagRulesClient: &tagRulesClient, - SingleSignOnConfigurationsClient: &singleSignOnConfigurationsClient, - } +func NewClient(o *common.ClientOptions) *datadog_v2021_03_01.Client { + client := datadog_v2021_03_01.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) { + c.Authorizer = o.ResourceManagerAuthorizer + }) + return &client } diff --git a/internal/services/datadog/datadog_monitor_tag_rule_resource.go b/internal/services/datadog/datadog_monitor_tag_rule_resource.go index 4473f58a7ab0..1678f5cb5515 100644 --- a/internal/services/datadog/datadog_monitor_tag_rule_resource.go +++ b/internal/services/datadog/datadog_monitor_tag_rule_resource.go @@ -5,21 +5,26 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" ) +// @tombuildsstuff: in 4.0 consider inlining this within the `azurerm_datadog_monitors` resource +// since this appears to be a 1:1 with it (given the name defaults to `default`) + func resourceDatadogTagRules() *pluginsdk.Resource { return &pluginsdk.Resource{ - Create: resourceDatadogTagRulesCreateorUpdate, + Create: resourceDatadogTagRulesCreate, Read: resourceDatadogTagRulesRead, - Update: resourceDatadogTagRulesCreateorUpdate, + Update: resourceDatadogTagRulesUpdate, Delete: resourceDatadogTagRulesDelete, Timeouts: &pluginsdk.ResourceTimeout{ @@ -30,7 +35,7 @@ func resourceDatadogTagRules() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DatadogTagRulesID(id) + _, err := rules.ParseTagRuleID(id) return err }), @@ -39,7 +44,7 @@ func resourceDatadogTagRules() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.DatadogMonitorID, + ValidateFunc: monitorsresource.ValidateMonitorID, }, "name": { @@ -82,12 +87,9 @@ func resourceDatadogTagRules() *pluginsdk.Resource { Required: true, }, "action": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - "Include", - "Exclude", - }, false), + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForTagAction(), false), }, }, }, @@ -115,12 +117,9 @@ func resourceDatadogTagRules() *pluginsdk.Resource { Required: true, }, "action": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - "Include", - "Exclude", - }, false), + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(rules.PossibleValuesForTagAction(), false), }, }, }, @@ -132,120 +131,133 @@ func resourceDatadogTagRules() *pluginsdk.Resource { } } -func resourceDatadogTagRulesCreateorUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Datadog.TagRulesClient +func resourceDatadogTagRulesCreate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Datadog.Rules ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - datadogMonitorId := d.Get("datadog_monitor_id").(string) - ruleSetName := d.Get("name").(string) - id, err := parse.DatadogMonitorID(datadogMonitorId) + monitorId, err := monitorsresource.ParseMonitorID(d.Get("datadog_monitor_id").(string)) if err != nil { return err } - tagRulesid := parse.NewDatadogTagRulesID(id.SubscriptionId, id.ResourceGroup, id.MonitorName, ruleSetName).ID() - - existing, err := client.Get(ctx, id.ResourceGroup, id.MonitorName, ruleSetName) + id := rules.NewTagRuleID(monitorId.SubscriptionId, monitorId.ResourceGroupName, monitorId.MonitorName, d.Get("name").(string)) + existing, err := client.TagRulesGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for existing Datadog Monitor %q (Resource Group %q): %+v", id.ResourceGroup, id.MonitorName, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for an existing %s: %+v", id, err) } } + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_datadog_monitor_tag_rule", id.ID()) + } - body := datadog.MonitoringTagRules{ - Properties: &datadog.MonitoringTagRulesProperties{ + payload := rules.MonitoringTagRules{ + Properties: &rules.MonitoringTagRulesProperties{ LogRules: expandLogRules(d.Get("log").([]interface{})), MetricRules: expandMetricRules(d.Get("metric").([]interface{})), }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.MonitorName, ruleSetName, &body); err != nil { - return fmt.Errorf("configuring Tag Rules on Datadog Monitor %q (Resource Group %q): %+v", id.MonitorName, id.ResourceGroup, err) + if _, err := client.TagRulesCreateOrUpdate(ctx, id, payload); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } - d.SetId(tagRulesid) + d.SetId(id.ID()) return resourceDatadogTagRulesRead(d, meta) } func resourceDatadogTagRulesRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Datadog.TagRulesClient + client := meta.(*clients.Client).Datadog.Rules ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DatadogTagRulesID(d.Id()) + id, err := rules.ParseTagRuleID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.MonitorName, id.TagRuleName) + resp, err := client.TagRulesGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] Datadog monitor %q does not exist - removing from state", d.Id()) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil } } - monitorId := parse.NewDatadogMonitorID(id.SubscriptionId, id.ResourceGroup, id.MonitorName) + monitorId := monitorsresource.NewMonitorID(id.SubscriptionId, id.ResourceGroupName, id.MonitorName) d.Set("datadog_monitor_id", monitorId.ID()) d.Set("name", id.TagRuleName) - if props := resp.Properties; props != nil { - if err := d.Set("log", flattenLogRules(props.LogRules)); err != nil { - return fmt.Errorf("setting `log`: %+v", err) - } - if err := d.Set("metric", flattenMetricRules(props.MetricRules)); err != nil { - return fmt.Errorf("setting `metric`: %+v", err) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + if err := d.Set("log", flattenLogRules(props.LogRules)); err != nil { + return fmt.Errorf("setting `log`: %+v", err) + } + if err := d.Set("metric", flattenMetricRules(props.MetricRules)); err != nil { + return fmt.Errorf("setting `metric`: %+v", err) + } } } return nil } -func resourceDatadogTagRulesDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Datadog.TagRulesClient - ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) +func resourceDatadogTagRulesUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Datadog.Rules + ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DatadogTagRulesID(d.Id()) + id, err := rules.ParseTagRuleID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.MonitorName, id.TagRuleName) - if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] datadog %q does not exist - removing from state", d.Id()) - d.SetId("") - return nil - } + payload := rules.MonitoringTagRules{ + Properties: &rules.MonitoringTagRulesProperties{ + LogRules: expandLogRules(d.Get("log").([]interface{})), + MetricRules: expandMetricRules(d.Get("metric").([]interface{})), + }, + } + if _, err := client.TagRulesCreateOrUpdate(ctx, *id, payload); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) } - d.Set("log", nil) - d.Set("metric", nil) + return resourceDatadogTagRulesRead(d, meta) +} + +func resourceDatadogTagRulesDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Datadog.Rules + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := rules.ParseTagRuleID(d.Id()) + if err != nil { + return err + } - body := datadog.MonitoringTagRules{ - Properties: &datadog.MonitoringTagRulesProperties{ + // Tag Rules can't be removed on their own, they can only be nil'd out + payload := rules.MonitoringTagRules{ + Properties: &rules.MonitoringTagRulesProperties{ LogRules: expandLogRules(d.Get("log").([]interface{})), MetricRules: expandMetricRules(d.Get("metric").([]interface{})), }, } - - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.MonitorName, id.TagRuleName, &body); err != nil { - return fmt.Errorf("removing Tag Rules configuration from Datadog Monitor %q (Resource Group %q): %+v", id.MonitorName, id.ResourceGroup, err) + if _, err := client.TagRulesCreateOrUpdate(ctx, *id, payload); err != nil { + return fmt.Errorf("removing %s: %+v", *id, err) } return nil } -func expandLogRules(input []interface{}) *datadog.LogRules { +func expandLogRules(input []interface{}) *rules.LogRules { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) filteringTag := v["filter"].([]interface{}) - return &datadog.LogRules{ + return &rules.LogRules{ SendAadLogs: utils.Bool(v["aad_log_enabled"].(bool)), SendSubscriptionLogs: utils.Bool(v["subscription_log_enabled"].(bool)), SendResourceLogs: utils.Bool(v["resource_log_enabled"].(bool)), @@ -253,97 +265,98 @@ func expandLogRules(input []interface{}) *datadog.LogRules { } } -func expandMetricRules(input []interface{}) *datadog.MetricRules { +func expandMetricRules(input []interface{}) *rules.MetricRules { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) filteringTag := v["filter"].([]interface{}) - return &datadog.MetricRules{ + return &rules.MetricRules{ FilteringTags: expandFilteringTag(filteringTag), } } -func expandFilteringTag(input []interface{}) *[]datadog.FilteringTag { - filteringTags := make([]datadog.FilteringTag, 0) +func expandFilteringTag(input []interface{}) *[]rules.FilteringTag { + filteringTags := make([]rules.FilteringTag, 0) for _, v := range input { config := v.(map[string]interface{}) - name := config["name"].(string) - value := config["value"].(string) - action := config["action"].(string) - - filteringTag := datadog.FilteringTag{ - Name: utils.String(name), - Value: utils.String(value), - Action: datadog.TagAction(action), - } - filteringTags = append(filteringTags, filteringTag) + filteringTags = append(filteringTags, rules.FilteringTag{ + Name: utils.String(config["name"].(string)), + Value: utils.String(config["value"].(string)), + Action: pointer.To(rules.TagAction(config["action"].(string))), + }) } return &filteringTags } -func flattenLogRules(input *datadog.LogRules) []interface{} { +func flattenLogRules(input *rules.LogRules) []interface{} { results := make([]interface{}, 0) - if input == nil { - return make([]interface{}, 0) - } - result := make(map[string]interface{}) + if input != nil { + aadLogEnabled := false + if input.SendAadLogs != nil { + aadLogEnabled = *input.SendAadLogs + } - if input.SendAadLogs != nil { - result["aad_log_enabled"] = *input.SendAadLogs - } + subscriptionLogEnabled := false + if input.SendSubscriptionLogs != nil { + subscriptionLogEnabled = *input.SendSubscriptionLogs + } - if input.SendSubscriptionLogs != nil { - result["subscription_log_enabled"] = *input.SendSubscriptionLogs - } + resourceLogEnabled := false + if input.SendResourceLogs != nil { + resourceLogEnabled = *input.SendResourceLogs + } - if input.SendResourceLogs != nil { - result["resource_log_enabled"] = *input.SendResourceLogs + results = append(results, map[string]interface{}{ + "aad_log_enabled": aadLogEnabled, + "filter": flattenFilteringTags(input.FilteringTags), + "resource_log_enabled": resourceLogEnabled, + "subscription_log_enabled": subscriptionLogEnabled, + }) } - result["filter"] = flattenFilteringTags(input.FilteringTags) - return append(results, result) + return results } -func flattenMetricRules(input *datadog.MetricRules) []interface{} { - results := make([]interface{}, 0) - +func flattenMetricRules(input *rules.MetricRules) []interface{} { if input == nil { return make([]interface{}, 0) } - result := make(map[string]interface{}) - result["filter"] = flattenFilteringTags(input.FilteringTags) - return append(results, result) + return []interface{}{ + map[string]interface{}{ + "filter": flattenFilteringTags(input.FilteringTags), + }, + } } -func flattenFilteringTags(input *[]datadog.FilteringTag) []interface{} { +func flattenFilteringTags(input *[]rules.FilteringTag) []interface{} { results := make([]interface{}, 0) - if input == nil { - return results - } - - var t datadog.TagAction - - for _, filteringTagRules := range *input { - result := make(map[string]interface{}) - - if filteringTagRules.Name != nil { - result["name"] = *filteringTagRules.Name - } - if filteringTagRules.Value != nil { - result["value"] = *filteringTagRules.Value - } - if filteringTagRules.Action != "" { - t = filteringTagRules.Action - result["action"] = t + if input != nil { + for _, filteringTagRules := range *input { + action := "" + if filteringTagRules.Action != nil { + action = string(*filteringTagRules.Action) + } + name := "" + if filteringTagRules.Name != nil { + name = *filteringTagRules.Name + } + value := "" + if filteringTagRules.Value != nil { + value = *filteringTagRules.Value + } + results = append(results, map[string]interface{}{ + "action": action, + "name": name, + "value": value, + }) } - results = append(results, result) } return results } diff --git a/internal/services/datadog/datadog_monitor_tag_rule_resource_test.go b/internal/services/datadog/datadog_monitor_tag_rule_resource_test.go index 7858b95fe7a6..c3d4471d2ac4 100644 --- a/internal/services/datadog/datadog_monitor_tag_rule_resource_test.go +++ b/internal/services/datadog/datadog_monitor_tag_rule_resource_test.go @@ -6,23 +6,34 @@ import ( "os" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) -type TagRulesDatadogMonitorResource struct{} +type TagRulesDatadogMonitorResource struct { + datadogApiKey string + datadogApplicationKey string +} -func TestAccDatadogMonitorTagRules_basic(t *testing.T) { - if os.Getenv("ARM_TEST_DATADOG_API_KEY") == "" || os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY") == "" { - t.Skip("Skipping as ARM_TEST_DATADOG_API_KEY and/or ARM_TEST_DATADOG_APPLICATION_KEY are not specified") - return +func (r *TagRulesDatadogMonitorResource) populateFromEnvironment(t *testing.T) { + if os.Getenv("ARM_TEST_DATADOG_API_KEY") == "" { + t.Skip("Skipping as ARM_TEST_DATADOG_API_KEY is not specified") + } + if os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY") == "" { + t.Skip("Skipping as ARM_TEST_DATADOG_APPLICATION_KEY is not specified") } + r.datadogApiKey = os.Getenv("ARM_TEST_DATADOG_API_KEY") + r.datadogApplicationKey = os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY") +} + +func TestAccDatadogMonitorTagRules_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_datadog_monitor_tag_rule", "test") r := TagRulesDatadogMonitorResource{} + r.populateFromEnvironment(t) data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), @@ -34,13 +45,25 @@ func TestAccDatadogMonitorTagRules_basic(t *testing.T) { }) } +func TestAccDatadogMonitorTagRules_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_datadog_monitor_tag_rule", "test") + r := TagRulesDatadogMonitorResource{} + r.populateFromEnvironment(t) + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + func TestAccDatadogMonitorTagRules_update(t *testing.T) { - if os.Getenv("ARM_TEST_DATADOG_API_KEY") == "" || os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY") == "" { - t.Skip("Skipping as ARM_TEST_DATADOG_API_KEY and/or ARM_TEST_DATADOG_APPLICATION_KEY are not specified") - return - } data := acceptance.BuildTestData(t, "azurerm_datadog_monitor_tag_rule", "test") r := TagRulesDatadogMonitorResource{} + r.populateFromEnvironment(t) data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), @@ -67,21 +90,17 @@ func TestAccDatadogMonitorTagRules_update(t *testing.T) { } func (r TagRulesDatadogMonitorResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DatadogTagRulesID(state.ID) + id, err := rules.ParseTagRuleID(state.ID) if err != nil { return nil, err } - resp, err := client.Datadog.TagRulesClient.Get(ctx, id.ResourceGroup, id.MonitorName, id.TagRuleName) + resp, err := client.Datadog.Rules.TagRulesGet(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Datadog Monitor %q (Resource Group %q): %+v", id.MonitorName, id.ResourceGroup, err) - } - - if (!*resp.Properties.LogRules.SendResourceLogs && !*resp.Properties.LogRules.SendSubscriptionLogs) || *resp.Properties.MetricRules.FilteringTags == nil { - return utils.Bool(false), nil + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(true), nil + return utils.Bool(resp.Model != nil), nil } func (r TagRulesDatadogMonitorResource) template(data acceptance.TestData) string { @@ -89,18 +108,19 @@ func (r TagRulesDatadogMonitorResource) template(data acceptance.TestData) strin provider "azurerm" { features {} } + resource "azurerm_resource_group" "test" { - name = "acctest-datadog-%d" - location = "%s" + name = "acctest-datadogrg-%[1]d" + location = %[2]q } resource "azurerm_datadog_monitor" "test" { - name = "acctest-datadog-%d" + name = "acctest-datadog-%[3]s" resource_group_name = azurerm_resource_group.test.name - location = "WEST US 2" + location = azurerm_resource_group.test.location datadog_organization { - api_key = %q - application_key = %q + api_key = %[4]q + application_key = %[5]q } user { name = "Test Datadog" @@ -111,16 +131,18 @@ resource "azurerm_datadog_monitor" "test" { type = "SystemAssigned" } } -`, data.RandomInteger, data.Locations.Primary, data.RandomInteger%100, os.Getenv("ARM_TEST_DATADOG_API_KEY"), os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY")) +`, data.RandomInteger, data.Locations.Primary, data.RandomString, r.datadogApiKey, r.datadogApplicationKey) } func (r TagRulesDatadogMonitorResource) basic(data acceptance.TestData) string { return fmt.Sprintf(` +provider "azurerm" { + features {} +} +%s - %s - -resource "azurerm_datadog_monitor_tag_rule" "testbasic" { +resource "azurerm_datadog_monitor_tag_rule" "test" { datadog_monitor_id = azurerm_datadog_monitor.test.id log { subscription_log_enabled = true @@ -136,11 +158,36 @@ resource "azurerm_datadog_monitor_tag_rule" "testbasic" { `, r.template(data)) } +func (r TagRulesDatadogMonitorResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_datadog_monitor_tag_rule" "import" { + datadog_monitor_id = azurerm_datadog_monitor_tag_rule.test.datadog_monitor_id + name = azurerm_datadog_monitor_tag_rule.test.name + log { + subscription_log_enabled = true + } + metric { + filter { + name = "Test" + value = "Testing-Logs" + action = "Include" + } + } +} +`, r.basic(data)) +} + func (r TagRulesDatadogMonitorResource) update(data acceptance.TestData) string { return fmt.Sprintf(` - %s +provider "azurerm" { + features {} +} + +%s -resource "azurerm_datadog_monitor_tag_rule" "testupdate" { +resource "azurerm_datadog_monitor_tag_rule" "test" { datadog_monitor_id = azurerm_datadog_monitor.test.id log { subscription_log_enabled = false diff --git a/internal/services/datadog/datadog_monitors_resource.go b/internal/services/datadog/datadog_monitors_resource.go index 954cd750d7ec..315877682d17 100644 --- a/internal/services/datadog/datadog_monitors_resource.go +++ b/internal/services/datadog/datadog_monitors_resource.go @@ -5,14 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -33,7 +34,7 @@ func resourceDatadogMonitor() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DatadogMonitorID(id) + _, err := monitorsresource.ParseMonitorID(id) return err }), @@ -157,57 +158,50 @@ func resourceDatadogMonitor() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } func resourceDatadogMonitorCreate(d *pluginsdk.ResourceData, meta interface{}) error { subscriptionId := meta.(*clients.Client).Account.SubscriptionId - client := meta.(*clients.Client).Datadog.MonitorsClient + client := meta.(*clients.Client).Datadog.MonitorsResource ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - resourceGroup := d.Get("resource_group_name").(string) + id := monitorsresource.NewMonitorID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - id := parse.NewDatadogMonitorID(subscriptionId, resourceGroup, name) - - existing, err := client.Get(ctx, resourceGroup, name) + existing, err := client.MonitorsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_datadog_monitor", id.ID()) } - monitoringStatus := datadog.MonitoringStatusDisabled + monitoringStatus := monitorsresource.MonitoringStatusDisabled if d.Get("monitoring_enabled").(bool) { - monitoringStatus = datadog.MonitoringStatusEnabled + monitoringStatus = monitorsresource.MonitoringStatusEnabled } - body := datadog.MonitorResource{ - Location: utils.String(location.Normalize(d.Get("location").(string))), + payload := monitorsresource.DatadogMonitorResource{ + Location: location.Normalize(d.Get("location").(string)), Identity: expandMonitorIdentityProperties(d.Get("identity").([]interface{})), - Sku: &datadog.ResourceSku{ - Name: utils.String(d.Get("sku_name").(string)), + Sku: &monitorsresource.ResourceSku{ + Name: d.Get("sku_name").(string), }, - Properties: &datadog.MonitorProperties{ + Properties: &monitorsresource.MonitorProperties{ DatadogOrganizationProperties: expandMonitorOrganizationProperties(d.Get("datadog_organization").([]interface{})), UserInfo: expandMonitorUserInfo(d.Get("user").([]interface{})), - MonitoringStatus: monitoringStatus, + MonitoringStatus: pointer.To(monitoringStatus), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.Create(ctx, resourceGroup, name, &body) - if err != nil { - return fmt.Errorf("creating %s: %+v", id, err) - } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) + if err := client.MonitorsCreateThenPoll(ctx, id, payload); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } d.SetId(id.ID()) @@ -215,100 +209,111 @@ func resourceDatadogMonitorCreate(d *pluginsdk.ResourceData, meta interface{}) e } func resourceDatadogMonitorRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Datadog.MonitorsClient + client := meta.(*clients.Client).Datadog.MonitorsResource ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DatadogMonitorID(d.Id()) + id, err := monitorsresource.ParseMonitorID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.MonitorName) + resp, err := client.MonitorsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] Datadog monitor %q does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("retrieving %s: %+v", id, err) + + return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("name", id.MonitorName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - if err := d.Set("identity", flattenMonitorIdentityProperties(resp.Identity)); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) - } - if props := resp.Properties; props != nil { - if err := d.Set("datadog_organization", flattenMonitorOrganizationProperties(props.DatadogOrganizationProperties, d)); err != nil { - return fmt.Errorf("setting `datadog_organization`: %+v", err) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + if err := d.Set("identity", flattenMonitorIdentityProperties(model.Identity)); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } + if props := model.Properties; props != nil { + if err := d.Set("datadog_organization", flattenMonitorOrganizationProperties(props.DatadogOrganizationProperties, d)); err != nil { + return fmt.Errorf("setting `datadog_organization`: %+v", err) + } + + monitoringEnabled := false + if props.MonitoringStatus != nil && *props.MonitoringStatus == monitorsresource.MonitoringStatusEnabled { + monitoringEnabled = true + } + + d.Set("monitoring_enabled", monitoringEnabled) + d.Set("marketplace_subscription_status", props.MarketplaceSubscriptionStatus) + } + + skuName := "" + if model.Sku != nil { + skuName = model.Sku.Name + } + d.Set("sku_name", skuName) + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return fmt.Errorf("setting `tags`: %+v", err) } - d.Set("monitoring_enabled", props.MonitoringStatus == datadog.MonitoringStatusEnabled) - d.Set("marketplace_subscription_status", props.MarketplaceSubscriptionStatus) - } - if resp.Sku != nil { - d.Set("sku_name", *resp.Sku.Name) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceDatadogMonitorUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Datadog.MonitorsClient + client := meta.(*clients.Client).Datadog.MonitorsResource ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DatadogMonitorID(d.Id()) + id, err := monitorsresource.ParseMonitorID(d.Id()) if err != nil { return err } - body := datadog.MonitorResourceUpdateParameters{ - Properties: &datadog.MonitorUpdateProperties{}, + payload := monitorsresource.DatadogMonitorResourceUpdateParameters{ + Properties: &monitorsresource.MonitorUpdateProperties{}, } if d.HasChange("sku_name") { - body.Sku = &datadog.ResourceSku{Name: utils.String(d.Get("sku_name").(string))} + payload.Sku = &monitorsresource.ResourceSku{ + Name: d.Get("sku_name").(string), + } } if d.HasChange("monitoring_enabled") { - monitoringStatus := datadog.MonitoringStatusDisabled + monitoringStatus := monitorsresource.MonitoringStatusDisabled if d.Get("monitoring_enabled").(bool) { - monitoringStatus = datadog.MonitoringStatusEnabled + monitoringStatus = monitorsresource.MonitoringStatusEnabled } - body.Properties.MonitoringStatus = monitoringStatus + payload.Properties.MonitoringStatus = pointer.To(monitoringStatus) } if d.HasChange("tags") { - body.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) + payload.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) } - future, err := client.Update(ctx, id.ResourceGroup, id.MonitorName, &body) - if err != nil { + if err := client.MonitorsUpdateThenPoll(ctx, *id, payload); err != nil { return fmt.Errorf("updating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for updating of %s: %+v", id, err) - } return resourceDatadogMonitorRead(d, meta) } func resourceDatadogMonitorDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Datadog.MonitorsClient + client := meta.(*clients.Client).Datadog.MonitorsResource ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DatadogMonitorID(d.Id()) + id, err := monitorsresource.ParseMonitorID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.MonitorName) - if err != nil { - return fmt.Errorf("deleting of %s: %+v", id, err) + if err := client.MonitorsDeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting of %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", id, err) - } return nil } @@ -326,59 +331,60 @@ func SkuNameDiffSuppress(_, old, new string, _ *pluginsdk.ResourceData) bool { return old == new } -func expandMonitorIdentityProperties(input []interface{}) *datadog.IdentityProperties { +func expandMonitorIdentityProperties(input []interface{}) *monitorsresource.IdentityProperties { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - return &datadog.IdentityProperties{ - Type: datadog.ManagedIdentityTypes(v["type"].(string)), + return &monitorsresource.IdentityProperties{ + // @tombuildsstuff: this should be normalized in Pandora to a common identity type? is this a Swagger bag with SA & UA omitted? + Type: pointer.To(monitorsresource.ManagedIdentityTypes(v["type"].(string))), } } -func expandMonitorOrganizationProperties(input []interface{}) *datadog.OrganizationProperties { +func expandMonitorOrganizationProperties(input []interface{}) *monitorsresource.DatadogOrganizationProperties { if len(input) == 0 || input[0] == nil { return nil } v := input[0].(map[string]interface{}) - return &datadog.OrganizationProperties{ + return &monitorsresource.DatadogOrganizationProperties{ LinkingAuthCode: utils.String(v["linking_auth_code"].(string)), - LinkingClientID: utils.String(v["linking_client_id"].(string)), - RedirectURI: utils.String(v["redirect_uri"].(string)), - APIKey: utils.String(v["api_key"].(string)), + LinkingClientId: utils.String(v["linking_client_id"].(string)), + RedirectUri: utils.String(v["redirect_uri"].(string)), + ApiKey: utils.String(v["api_key"].(string)), ApplicationKey: utils.String(v["application_key"].(string)), - EnterpriseAppID: utils.String(v["enterprise_app_id"].(string)), + EnterpriseAppId: utils.String(v["enterprise_app_id"].(string)), } } -func expandMonitorUserInfo(input []interface{}) *datadog.UserInfo { +func expandMonitorUserInfo(input []interface{}) *monitorsresource.UserInfo { if len(input) == 0 || input[0] == nil { return nil } v := input[0].(map[string]interface{}) - return &datadog.UserInfo{ + return &monitorsresource.UserInfo{ Name: utils.String(v["name"].(string)), EmailAddress: utils.String(v["email"].(string)), PhoneNumber: utils.String(v["phone_number"].(string)), } } -func flattenMonitorIdentityProperties(input *datadog.IdentityProperties) []interface{} { - if input == nil { +func flattenMonitorIdentityProperties(input *monitorsresource.IdentityProperties) []interface{} { + if input == nil || input.Type == nil { return make([]interface{}, 0) } - var t datadog.ManagedIdentityTypes - if input.Type != "" { - t = input.Type + var t string + if *input.Type != "" { + t = string(*input.Type) } var principalId string - if input.PrincipalID != nil { - principalId = *input.PrincipalID + if input.PrincipalId != nil { + principalId = *input.PrincipalId } var tenantId string - if input.TenantID != nil { - tenantId = *input.TenantID + if input.TenantId != nil { + tenantId = *input.TenantId } return []interface{}{ map[string]interface{}{ @@ -389,7 +395,7 @@ func flattenMonitorIdentityProperties(input *datadog.IdentityProperties) []inter } } -func flattenMonitorOrganizationProperties(input *datadog.OrganizationProperties, d *pluginsdk.ResourceData) []interface{} { +func flattenMonitorOrganizationProperties(input *monitorsresource.DatadogOrganizationProperties, d *pluginsdk.ResourceData) []interface{} { organisationProperties := d.Get("datadog_organization").([]interface{}) if len(organisationProperties) == 0 { return make([]interface{}, 0) @@ -401,23 +407,23 @@ func flattenMonitorOrganizationProperties(input *datadog.OrganizationProperties, name = *input.Name } var id string - if input.ID != nil { - id = *input.ID + if input.Id != nil { + id = *input.Id } var redirectUri string - if input.RedirectURI != nil { - redirectUri = *input.RedirectURI + if input.RedirectUri != nil { + redirectUri = *input.RedirectUri } - var enterpriseAppID string - if input.EnterpriseAppID != nil { - enterpriseAppID = *input.EnterpriseAppID + var enterpriseAppId string + if input.EnterpriseAppId != nil { + enterpriseAppId = *input.EnterpriseAppId } return []interface{}{ map[string]interface{}{ "name": name, "api_key": utils.String(v["api_key"].(string)), "application_key": utils.String(v["application_key"].(string)), - "enterprise_app_id": enterpriseAppID, + "enterprise_app_id": enterpriseAppId, "linking_auth_code": utils.String(v["linking_auth_code"].(string)), "linking_client_id": utils.String(v["linking_client_id"].(string)), "redirect_uri": redirectUri, diff --git a/internal/services/datadog/datadog_monitors_resource_test.go b/internal/services/datadog/datadog_monitors_resource_test.go index f46bd1405be0..d2ffa4ab0a97 100644 --- a/internal/services/datadog/datadog_monitors_resource_test.go +++ b/internal/services/datadog/datadog_monitors_resource_test.go @@ -6,23 +6,35 @@ import ( "os" "testing" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) -type DatadogMonitorResource struct{} +type DatadogMonitorResource struct { + datadogApiKey string + datadogApplicationKey string +} -func TestAccDatadogMonitor_basic(t *testing.T) { - if os.Getenv("ARM_TEST_DATADOG_API_KEY") == "" || os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY") == "" { - t.Skip("Skipping as ARM_TEST_DATADOG_API_KEY and/or ARM_TEST_DATADOG_APPLICATION_KEY are not specified") - return +func (r *DatadogMonitorResource) populateFromEnvironment(t *testing.T) { + if os.Getenv("ARM_TEST_DATADOG_API_KEY") == "" { + t.Skip("Skipping as ARM_TEST_DATADOG_API_KEY is not specified") + } + if os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY") == "" { + t.Skip("Skipping as ARM_TEST_DATADOG_APPLICATION_KEY is not specified") } + r.datadogApiKey = os.Getenv("ARM_TEST_DATADOG_API_KEY") + r.datadogApplicationKey = os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY") +} + +func TestAccDatadogMonitor_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_datadog_monitor", "test") r := DatadogMonitorResource{} + r.populateFromEnvironment(t) data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), @@ -47,12 +59,9 @@ func TestAccDatadogMonitor_basic(t *testing.T) { } func TestAccDatadogMonitor_requiresImport(t *testing.T) { - if os.Getenv("ARM_TEST_DATADOG_API_KEY") == "" || os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY") == "" { - t.Skip("Skipping as ARM_TEST_DATADOG_API_KEY and/or ARM_TEST_DATADOG_APPLICATION_KEY are not specified") - return - } data := acceptance.BuildTestData(t, "azurerm_datadog_monitor", "test") r := DatadogMonitorResource{} + r.populateFromEnvironment(t) data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), @@ -65,12 +74,9 @@ func TestAccDatadogMonitor_requiresImport(t *testing.T) { } func TestAccDatadogMonitor_complete(t *testing.T) { - if os.Getenv("ARM_TEST_DATADOG_API_KEY") == "" || os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY") == "" { - t.Skip("Skipping as ARM_TEST_DATADOG_API_KEY and/or ARM_TEST_DATADOG_APPLICATION_KEY are not specified") - return - } data := acceptance.BuildTestData(t, "azurerm_datadog_monitor", "test") r := DatadogMonitorResource{} + r.populateFromEnvironment(t) data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), @@ -95,12 +101,9 @@ func TestAccDatadogMonitor_complete(t *testing.T) { } func TestAccDatadogMonitor_update(t *testing.T) { - if os.Getenv("ARM_TEST_DATADOG_API_KEY") == "" || os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY") == "" { - t.Skip("Skipping as ARM_TEST_DATADOG_API_KEY and/or ARM_TEST_DATADOG_APPLICATION_KEY are not specified") - return - } data := acceptance.BuildTestData(t, "azurerm_datadog_monitor", "test") r := DatadogMonitorResource{} + r.populateFromEnvironment(t) data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), @@ -163,27 +166,24 @@ func TestAccDatadogMonitor_update(t *testing.T) { } func (r DatadogMonitorResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DatadogMonitorID(state.ID) + id, err := monitorsresource.ParseMonitorID(state.ID) if err != nil { return nil, err } - resp, err := client.Datadog.MonitorsClient.Get(ctx, id.ResourceGroup, id.MonitorName) + resp, err := client.Datadog.MonitorsResource.MonitorsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } - return nil, fmt.Errorf("retrieving Datadog Monitor %q (Resource Group %q): %+v", id.MonitorName, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } return utils.Bool(true), nil } func (r DatadogMonitorResource) template(data acceptance.TestData) string { return fmt.Sprintf(` -provider "azurerm" { - features {} -} resource "azurerm_resource_group" "test" { - name = "acctest-datadog-%d" + name = "acctest-datadogrg-%d" location = "%s" } `, data.RandomInteger, data.Locations.Primary) @@ -191,12 +191,16 @@ resource "azurerm_resource_group" "test" { func (r DatadogMonitorResource) basic(data acceptance.TestData) string { return fmt.Sprintf(` - %s +provider "azurerm" { + features {} +} + +%s resource "azurerm_datadog_monitor" "test" { - name = "acctest-datadog-%d" + name = "acctest-datadog-%s" resource_group_name = azurerm_resource_group.test.name - location = "WEST US 2" + location = azurerm_resource_group.test.location datadog_organization { api_key = %q application_key = %q @@ -210,7 +214,7 @@ resource "azurerm_datadog_monitor" "test" { type = "SystemAssigned" } } -`, r.template(data), data.RandomInteger%100, os.Getenv("ARM_TEST_DATADOG_API_KEY"), os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY")) +`, r.template(data), data.RandomString, os.Getenv("ARM_TEST_DATADOG_API_KEY"), os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY")) } func (r DatadogMonitorResource) update(data acceptance.TestData) string { @@ -219,14 +223,12 @@ provider "azurerm" { features {} } -resource "azurerm_resource_group" "test" { - name = "acctest-datadog-%d" - location = "%s" -} +%s + resource "azurerm_datadog_monitor" "test" { - name = "acctest-datadog-%d" + name = "acctest-datadog-%s" resource_group_name = azurerm_resource_group.test.name - location = "WEST US 2" + location = azurerm_resource_group.test.location datadog_organization { api_key = %q application_key = %q @@ -244,7 +246,7 @@ resource "azurerm_datadog_monitor" "test" { ENV = "Test" } } -`, data.RandomInteger, data.Locations.Primary, data.RandomInteger%100, os.Getenv("ARM_TEST_DATADOG_API_KEY"), os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY")) +`, r.template(data), data.RandomString, r.datadogApiKey, r.datadogApplicationKey) } func (r DatadogMonitorResource) requiresImport(data acceptance.TestData) string { @@ -252,7 +254,7 @@ func (r DatadogMonitorResource) requiresImport(data acceptance.TestData) string %s resource "azurerm_datadog_monitor" "import" { name = azurerm_datadog_monitor.test.name - resource_group_name = azurerm_resource_group.test.name + resource_group_name = azurerm_datadog_monitor.test.resource_group_name location = azurerm_datadog_monitor.test.location datadog_organization { api_key = %q @@ -267,14 +269,14 @@ resource "azurerm_datadog_monitor" "import" { type = "SystemAssigned" } } -`, r.basic(data), os.Getenv("ARM_TEST_DATADOG_API_KEY"), os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY")) +`, r.basic(data), r.datadogApiKey, r.datadogApplicationKey) } func (r DatadogMonitorResource) complete(data acceptance.TestData) string { return fmt.Sprintf(` %s resource "azurerm_datadog_monitor" "test" { - name = "acctest-datadog-%d" + name = "acctest-datadog-%s" resource_group_name = azurerm_resource_group.test.name location = azurerm_resource_group.test.location datadog_organization { @@ -299,5 +301,5 @@ resource "azurerm_datadog_monitor" "test" { ENV = "Test" } } -`, r.template(data), data.RandomInteger%100, os.Getenv("ARM_TEST_DATADOG_API_KEY"), os.Getenv("ARM_TEST_DATADOG_APPLICATION_KEY")) +`, r.template(data), data.RandomString, r.datadogApiKey, r.datadogApplicationKey) } diff --git a/internal/services/datadog/parse/datadog_monitor.go b/internal/services/datadog/parse/datadog_monitor.go deleted file mode 100644 index 9f0a8418058e..000000000000 --- a/internal/services/datadog/parse/datadog_monitor.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DatadogMonitorId struct { - SubscriptionId string - ResourceGroup string - MonitorName string -} - -func NewDatadogMonitorID(subscriptionId, resourceGroup, monitorName string) DatadogMonitorId { - return DatadogMonitorId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - MonitorName: monitorName, - } -} - -func (id DatadogMonitorId) String() string { - segments := []string{ - fmt.Sprintf("Monitor Name %q", id.MonitorName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Datadog Monitor", segmentsStr) -} - -func (id DatadogMonitorId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Datadog/monitors/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.MonitorName) -} - -// DatadogMonitorID parses a DatadogMonitor ID into an DatadogMonitorId struct -func DatadogMonitorID(input string) (*DatadogMonitorId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DatadogMonitorId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.MonitorName, err = id.PopSegment("monitors"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/datadog/parse/datadog_monitor_test.go b/internal/services/datadog/parse/datadog_monitor_test.go deleted file mode 100644 index 8371889301a1..000000000000 --- a/internal/services/datadog/parse/datadog_monitor_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = DatadogMonitorId{} - -func TestDatadogMonitorIDFormatter(t *testing.T) { - actual := NewDatadogMonitorID("12345678-1234-9876-4563-123456789012", "resourceGroup1", "monitor1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestDatadogMonitorID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DatadogMonitorId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing MonitorName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/", - Error: true, - }, - - { - // missing value for MonitorName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1", - Expected: &DatadogMonitorId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resourceGroup1", - MonitorName: "monitor1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESOURCEGROUP1/PROVIDERS/MICROSOFT.DATADOG/MONITORS/MONITOR1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DatadogMonitorID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.MonitorName != v.Expected.MonitorName { - t.Fatalf("Expected %q but got %q for MonitorName", v.Expected.MonitorName, actual.MonitorName) - } - } -} diff --git a/internal/services/datadog/parse/datadog_single_sign_on_configurations.go b/internal/services/datadog/parse/datadog_single_sign_on_configurations.go deleted file mode 100644 index ae1f667407d8..000000000000 --- a/internal/services/datadog/parse/datadog_single_sign_on_configurations.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DatadogSingleSignOnConfigurationsId struct { - SubscriptionId string - ResourceGroup string - MonitorName string - SingleSignOnConfigurationName string -} - -func NewDatadogSingleSignOnConfigurationsID(subscriptionId, resourceGroup, monitorName, singleSignOnConfigurationName string) DatadogSingleSignOnConfigurationsId { - return DatadogSingleSignOnConfigurationsId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - MonitorName: monitorName, - SingleSignOnConfigurationName: singleSignOnConfigurationName, - } -} - -func (id DatadogSingleSignOnConfigurationsId) String() string { - segments := []string{ - fmt.Sprintf("Single Sign On Configuration Name %q", id.SingleSignOnConfigurationName), - fmt.Sprintf("Monitor Name %q", id.MonitorName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Datadog Single Sign On Configurations", segmentsStr) -} - -func (id DatadogSingleSignOnConfigurationsId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Datadog/monitors/%s/singleSignOnConfigurations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.MonitorName, id.SingleSignOnConfigurationName) -} - -// DatadogSingleSignOnConfigurationsID parses a DatadogSingleSignOnConfigurations ID into an DatadogSingleSignOnConfigurationsId struct -func DatadogSingleSignOnConfigurationsID(input string) (*DatadogSingleSignOnConfigurationsId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DatadogSingleSignOnConfigurationsId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.MonitorName, err = id.PopSegment("monitors"); err != nil { - return nil, err - } - if resourceId.SingleSignOnConfigurationName, err = id.PopSegment("singleSignOnConfigurations"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/datadog/parse/datadog_single_sign_on_configurations_test.go b/internal/services/datadog/parse/datadog_single_sign_on_configurations_test.go deleted file mode 100644 index edf5c0fe8c52..000000000000 --- a/internal/services/datadog/parse/datadog_single_sign_on_configurations_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = DatadogSingleSignOnConfigurationsId{} - -func TestDatadogSingleSignOnConfigurationsIDFormatter(t *testing.T) { - actual := NewDatadogSingleSignOnConfigurationsID("12345678-1234-9876-4563-123456789012", "resourceGroup1", "monitor1", "default").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/singleSignOnConfigurations/default" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestDatadogSingleSignOnConfigurationsID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DatadogSingleSignOnConfigurationsId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing MonitorName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/", - Error: true, - }, - - { - // missing value for MonitorName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/", - Error: true, - }, - - { - // missing SingleSignOnConfigurationName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/", - Error: true, - }, - - { - // missing value for SingleSignOnConfigurationName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/singleSignOnConfigurations/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/singleSignOnConfigurations/default", - Expected: &DatadogSingleSignOnConfigurationsId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resourceGroup1", - MonitorName: "monitor1", - SingleSignOnConfigurationName: "default", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESOURCEGROUP1/PROVIDERS/MICROSOFT.DATADOG/MONITORS/MONITOR1/SINGLESIGNONCONFIGURATIONS/DEFAULT", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DatadogSingleSignOnConfigurationsID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.MonitorName != v.Expected.MonitorName { - t.Fatalf("Expected %q but got %q for MonitorName", v.Expected.MonitorName, actual.MonitorName) - } - if actual.SingleSignOnConfigurationName != v.Expected.SingleSignOnConfigurationName { - t.Fatalf("Expected %q but got %q for SingleSignOnConfigurationName", v.Expected.SingleSignOnConfigurationName, actual.SingleSignOnConfigurationName) - } - } -} diff --git a/internal/services/datadog/parse/datadog_tag_rules.go b/internal/services/datadog/parse/datadog_tag_rules.go deleted file mode 100644 index 424bf46efa00..000000000000 --- a/internal/services/datadog/parse/datadog_tag_rules.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DatadogTagRulesId struct { - SubscriptionId string - ResourceGroup string - MonitorName string - TagRuleName string -} - -func NewDatadogTagRulesID(subscriptionId, resourceGroup, monitorName, tagRuleName string) DatadogTagRulesId { - return DatadogTagRulesId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - MonitorName: monitorName, - TagRuleName: tagRuleName, - } -} - -func (id DatadogTagRulesId) String() string { - segments := []string{ - fmt.Sprintf("Tag Rule Name %q", id.TagRuleName), - fmt.Sprintf("Monitor Name %q", id.MonitorName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Datadog Tag Rules", segmentsStr) -} - -func (id DatadogTagRulesId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Datadog/monitors/%s/tagRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.MonitorName, id.TagRuleName) -} - -// DatadogTagRulesID parses a DatadogTagRules ID into an DatadogTagRulesId struct -func DatadogTagRulesID(input string) (*DatadogTagRulesId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DatadogTagRulesId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.MonitorName, err = id.PopSegment("monitors"); err != nil { - return nil, err - } - if resourceId.TagRuleName, err = id.PopSegment("tagRules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/datadog/parse/datadog_tag_rules_test.go b/internal/services/datadog/parse/datadog_tag_rules_test.go deleted file mode 100644 index c252cde2c069..000000000000 --- a/internal/services/datadog/parse/datadog_tag_rules_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = DatadogTagRulesId{} - -func TestDatadogTagRulesIDFormatter(t *testing.T) { - actual := NewDatadogTagRulesID("12345678-1234-9876-4563-123456789012", "resourceGroup1", "monitor1", "default").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/tagRules/default" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestDatadogTagRulesID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DatadogTagRulesId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing MonitorName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/", - Error: true, - }, - - { - // missing value for MonitorName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/", - Error: true, - }, - - { - // missing TagRuleName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/", - Error: true, - }, - - { - // missing value for TagRuleName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/tagRules/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/tagRules/default", - Expected: &DatadogTagRulesId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resourceGroup1", - MonitorName: "monitor1", - TagRuleName: "default", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESOURCEGROUP1/PROVIDERS/MICROSOFT.DATADOG/MONITORS/MONITOR1/TAGRULES/DEFAULT", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DatadogTagRulesID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.MonitorName != v.Expected.MonitorName { - t.Fatalf("Expected %q but got %q for MonitorName", v.Expected.MonitorName, actual.MonitorName) - } - if actual.TagRuleName != v.Expected.TagRuleName { - t.Fatalf("Expected %q but got %q for TagRuleName", v.Expected.TagRuleName, actual.TagRuleName) - } - } -} diff --git a/internal/services/datadog/resourceids.go b/internal/services/datadog/resourceids.go deleted file mode 100644 index 95a333b2abdd..000000000000 --- a/internal/services/datadog/resourceids.go +++ /dev/null @@ -1,5 +0,0 @@ -package datadog - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DatadogMonitor -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DatadogTagRules -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/tagRules/default -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DatadogSingleSignOnConfigurations -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/singleSignOnConfigurations/default diff --git a/internal/services/datadog/validate/datadog_monitor_id.go b/internal/services/datadog/validate/datadog_monitor_id.go deleted file mode 100644 index 7626bf021d70..000000000000 --- a/internal/services/datadog/validate/datadog_monitor_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/parse" -) - -func DatadogMonitorID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DatadogMonitorID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/datadog/validate/datadog_monitor_id_test.go b/internal/services/datadog/validate/datadog_monitor_id_test.go deleted file mode 100644 index c4c4b0415347..000000000000 --- a/internal/services/datadog/validate/datadog_monitor_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestDatadogMonitorID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing MonitorName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/", - Valid: false, - }, - - { - // missing value for MonitorName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESOURCEGROUP1/PROVIDERS/MICROSOFT.DATADOG/MONITORS/MONITOR1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := DatadogMonitorID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/datadog/validate/datadog_single_sign_on_configurations_id.go b/internal/services/datadog/validate/datadog_single_sign_on_configurations_id.go deleted file mode 100644 index 36000d62a091..000000000000 --- a/internal/services/datadog/validate/datadog_single_sign_on_configurations_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/parse" -) - -func DatadogSingleSignOnConfigurationsID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DatadogSingleSignOnConfigurationsID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/datadog/validate/datadog_single_sign_on_configurations_id_test.go b/internal/services/datadog/validate/datadog_single_sign_on_configurations_id_test.go deleted file mode 100644 index 0e4a0da43761..000000000000 --- a/internal/services/datadog/validate/datadog_single_sign_on_configurations_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestDatadogSingleSignOnConfigurationsID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing MonitorName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/", - Valid: false, - }, - - { - // missing value for MonitorName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/", - Valid: false, - }, - - { - // missing SingleSignOnConfigurationName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/", - Valid: false, - }, - - { - // missing value for SingleSignOnConfigurationName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/singleSignOnConfigurations/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/singleSignOnConfigurations/default", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESOURCEGROUP1/PROVIDERS/MICROSOFT.DATADOG/MONITORS/MONITOR1/SINGLESIGNONCONFIGURATIONS/DEFAULT", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := DatadogSingleSignOnConfigurationsID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/datadog/validate/datadog_tag_rules_id.go b/internal/services/datadog/validate/datadog_tag_rules_id.go deleted file mode 100644 index 6535bfcba5a0..000000000000 --- a/internal/services/datadog/validate/datadog_tag_rules_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/parse" -) - -func DatadogTagRulesID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DatadogTagRulesID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/datadog/validate/datadog_tag_rules_id_test.go b/internal/services/datadog/validate/datadog_tag_rules_id_test.go deleted file mode 100644 index 184a30909dfa..000000000000 --- a/internal/services/datadog/validate/datadog_tag_rules_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestDatadogTagRulesID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing MonitorName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/", - Valid: false, - }, - - { - // missing value for MonitorName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/", - Valid: false, - }, - - { - // missing TagRuleName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/", - Valid: false, - }, - - { - // missing value for TagRuleName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/tagRules/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1/tagRules/default", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESOURCEGROUP1/PROVIDERS/MICROSOFT.DATADOG/MONITORS/MONITOR1/TAGRULES/DEFAULT", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := DatadogTagRulesID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/datafactory/data_factory_integration_runtime_self_hosted_resource_test.go b/internal/services/datafactory/data_factory_integration_runtime_self_hosted_resource_test.go index 8ff0c9a00422..572bb49725d9 100644 --- a/internal/services/datafactory/data_factory_integration_runtime_self_hosted_resource_test.go +++ b/internal/services/datafactory/data_factory_integration_runtime_self_hosted_resource_test.go @@ -116,11 +116,12 @@ resource "azurerm_network_interface" "test" { } resource "azurerm_virtual_machine" "test" { - name = "acctvm%s" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - network_interface_ids = [azurerm_network_interface.test.id] - vm_size = "Standard_F4" + name = "acctvm%s" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + network_interface_ids = [azurerm_network_interface.test.id] + vm_size = "Standard_F4" + delete_os_disk_on_termination = true storage_image_reference { publisher = "MicrosoftWindowsServer" @@ -155,7 +156,7 @@ resource "azurerm_virtual_machine_extension" "test" { type = "CustomScriptExtension" type_handler_version = "1.10" settings = jsonencode({ - "fileUris" = ["https://raw.githubusercontent.com/Azure/azure-quickstart-templates/00b79d2102c88b56502a63041936ef4dd62cf725/101-vms-with-selfhost-integration-runtime/gatewayInstall.ps1"], + "fileUris" = ["https://raw.githubusercontent.com/Azure/azure-quickstart-templates/5661e3290f1d072195d26a5fc9d52bb372a55f48/quickstarts/microsoft.compute/vms-with-selfhost-integration-runtime/gatewayInstall.ps1"], "commandToExecute" = "powershell -ExecutionPolicy Unrestricted -File gatewayInstall.ps1 ${azurerm_data_factory_integration_runtime_self_hosted.host.primary_authorization_key} && timeout /t 120" }) } diff --git a/internal/services/datafactory/data_factory_linked_service_azure_blob_storage_resource.go b/internal/services/datafactory/data_factory_linked_service_azure_blob_storage_resource.go index b3d7423bb15e..24d10696d2bc 100644 --- a/internal/services/datafactory/data_factory_linked_service_azure_blob_storage_resource.go +++ b/internal/services/datafactory/data_factory_linked_service_azure_blob_storage_resource.go @@ -2,6 +2,7 @@ package datafactory import ( "fmt" + "regexp" "time" "github.com/Azure/azure-sdk-for-go/services/datafactory/mgmt/2018-06-01/datafactory" // nolint: staticcheck @@ -54,7 +55,20 @@ func resourceDataFactoryLinkedServiceAzureBlobStorage() *pluginsdk.Resource { Optional: true, Sensitive: true, ValidateFunc: validation.StringIsNotEmpty, - ExactlyOneOf: []string{"connection_string", "sas_uri", "service_endpoint"}, + ExactlyOneOf: []string{"connection_string", "connection_string_insecure", "sas_uri", "service_endpoint"}, + }, + + "connection_string_insecure": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + ExactlyOneOf: []string{"connection_string", "connection_string_insecure", "sas_uri", "service_endpoint"}, + DiffSuppressFunc: func(k, old, new string, d *pluginsdk.ResourceData) bool { + accountKeyRegex := regexp.MustCompile("AccountKey=[^;]+") + + maskedNew := accountKeyRegex.ReplaceAllString(new, "") + return (new == d.Get(k).(string)) && (maskedNew == old) + }, }, "storage_kind": { @@ -73,7 +87,7 @@ func resourceDataFactoryLinkedServiceAzureBlobStorage() *pluginsdk.Resource { Optional: true, Sensitive: true, ValidateFunc: validation.StringIsNotEmpty, - ExactlyOneOf: []string{"connection_string", "sas_uri", "service_endpoint"}, + ExactlyOneOf: []string{"connection_string", "connection_string_insecure", "sas_uri", "service_endpoint"}, }, // TODO for @favoretti: rename this to 'sas_token_linked_key_vault_key' for 3.4.0 @@ -145,7 +159,7 @@ func resourceDataFactoryLinkedServiceAzureBlobStorage() *pluginsdk.Resource { Optional: true, Sensitive: true, ValidateFunc: validation.StringIsNotEmpty, - ExactlyOneOf: []string{"connection_string", "sas_uri", "service_endpoint"}, + ExactlyOneOf: []string{"connection_string", "connection_string_insecure", "sas_uri", "service_endpoint"}, }, "service_principal_id": { @@ -231,6 +245,10 @@ func resourceDataFactoryLinkedServiceBlobStorageCreateUpdate(d *pluginsdk.Resour } } + if v, ok := d.GetOk("connection_string_insecure"); ok { + blobStorageProperties.ConnectionString = v.(string) + } + if v, ok := d.GetOk("sas_uri"); ok { if sasToken, ok := d.GetOk("key_vault_sas_token"); ok { blobStorageProperties.SasURI = utils.String(v.(string)) @@ -347,6 +365,11 @@ func resourceDataFactoryLinkedServiceBlobStorageRead(d *pluginsdk.ResourceData, d.Set("service_endpoint", blobStorage.ServiceEndpoint) d.Set("use_managed_identity", true) } + + // blobStorage.ConnectionString is returned as a String when using `connection_string_insecure` and SecureString when using `connection_string` + if insecureConnectionString, ok := blobStorage.ConnectionString.(string); ok { + d.Set("connection_string_insecure", insecureConnectionString) + } } if properties := blobStorage.AzureBlobStorageLinkedServiceTypeProperties; properties != nil { diff --git a/internal/services/datafactory/data_factory_linked_service_azure_blob_storage_resource_test.go b/internal/services/datafactory/data_factory_linked_service_azure_blob_storage_resource_test.go index 001c5cfe0882..9f9412f953a6 100644 --- a/internal/services/datafactory/data_factory_linked_service_azure_blob_storage_resource_test.go +++ b/internal/services/datafactory/data_factory_linked_service_azure_blob_storage_resource_test.go @@ -130,6 +130,21 @@ func TestAccDataFactoryLinkedServiceAzureBlobStorage_update(t *testing.T) { }) } +func TestAccDataFactoryLinkedServiceAzureBlobStorage_connectionStringInsecure(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_data_factory_linked_service_azure_blob_storage", "test") + r := LinkedServiceAzureBlobStorageResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.connectionStringInsecure(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("connection_string_insecure"), + }) +} + func (t LinkedServiceAzureBlobStorageResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.LinkedServiceID(state.ID) if err != nil { @@ -423,3 +438,28 @@ resource "azurerm_data_factory_linked_service_azure_blob_storage" "test" { } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, tenantID) } + +func (LinkedServiceAzureBlobStorageResource) connectionStringInsecure(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-df-%d" + location = "%s" +} + +resource "azurerm_data_factory" "test" { + name = "acctestdf%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_data_factory_linked_service_azure_blob_storage" "test" { + name = "acctestlsblob%d" + data_factory_id = azurerm_data_factory.test.id + connection_string_insecure = "DefaultEndpointsProtocol=https;AccountName=foo;AccountKey=bar" +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) +} diff --git a/internal/services/dataprotection/data_protection_backup_instance_blob_storage_resource.go b/internal/services/dataprotection/data_protection_backup_instance_blob_storage_resource.go index 809acc69cb80..619f7b73380a 100644 --- a/internal/services/dataprotection/data_protection_backup_instance_blob_storage_resource.go +++ b/internal/services/dataprotection/data_protection_backup_instance_blob_storage_resource.go @@ -80,7 +80,7 @@ func resourceDataProtectionBackupInstanceBlobStorageCreateUpdate(d *schema.Resou name := d.Get("name").(string) vaultId, _ := backupinstances.ParseBackupVaultID(d.Get("vault_id").(string)) - id := backupinstances.NewBackupInstanceID(subscriptionId, vaultId.ResourceGroupName, vaultId.VaultName, name) + id := backupinstances.NewBackupInstanceID(subscriptionId, vaultId.ResourceGroupName, vaultId.BackupVaultName, name) if d.IsNewResource() { existing, err := client.Get(ctx, id) @@ -160,7 +160,7 @@ func resourceDataProtectionBackupInstanceBlobStorageRead(d *schema.ResourceData, } return fmt.Errorf("retrieving DataProtection BackupInstance (%q): %+v", id, err) } - vaultId := backupinstances.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.VaultName) + vaultId := backupinstances.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.BackupVaultName) d.Set("name", id.BackupInstanceName) d.Set("vault_id", vaultId.ID()) if model := resp.Model; model != nil { diff --git a/internal/services/dataprotection/data_protection_backup_instance_blob_storage_resource_test.go b/internal/services/dataprotection/data_protection_backup_instance_blob_storage_resource_test.go index 8f1f6a9512f7..0392b37e6d4f 100644 --- a/internal/services/dataprotection/data_protection_backup_instance_blob_storage_resource_test.go +++ b/internal/services/dataprotection/data_protection_backup_instance_blob_storage_resource_test.go @@ -7,11 +7,10 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,10 +19,10 @@ type DataProtectionBackupInstanceBlobStorageResource struct{} func TestAccDataProtectionBackupInstanceBlobStorage_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_instance_blob_storage", "test") r := DataProtectionBackupInstanceBlobStorageResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -34,10 +33,10 @@ func TestAccDataProtectionBackupInstanceBlobStorage_basic(t *testing.T) { func TestAccDataProtectionBackupInstanceBlobStorage_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_instance_blob_storage", "test") r := DataProtectionBackupInstanceBlobStorageResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -48,10 +47,10 @@ func TestAccDataProtectionBackupInstanceBlobStorage_requiresImport(t *testing.T) func TestAccDataProtectionBackupInstanceBlobStorage_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_instance_blob_storage", "test") r := DataProtectionBackupInstanceBlobStorageResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -62,24 +61,24 @@ func TestAccDataProtectionBackupInstanceBlobStorage_complete(t *testing.T) { func TestAccDataProtectionBackupInstanceBlobStorage_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_instance_blob_storage", "test") r := DataProtectionBackupInstanceBlobStorageResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -87,7 +86,7 @@ func TestAccDataProtectionBackupInstanceBlobStorage_update(t *testing.T) { }) } -func (r DataProtectionBackupInstanceBlobStorageResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r DataProtectionBackupInstanceBlobStorageResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := backupinstances.ParseBackupInstanceID(state.ID) if err != nil { return nil, err diff --git a/internal/services/dataprotection/data_protection_backup_instance_disk_resource.go b/internal/services/dataprotection/data_protection_backup_instance_disk_resource.go index 467f3dcee1b7..46e185d9687f 100644 --- a/internal/services/dataprotection/data_protection_backup_instance_disk_resource.go +++ b/internal/services/dataprotection/data_protection_backup_instance_disk_resource.go @@ -82,7 +82,7 @@ func resourceDataProtectionBackupInstanceDiskCreateUpdate(d *schema.ResourceData name := d.Get("name").(string) vaultId, _ := backupinstances.ParseBackupVaultID(d.Get("vault_id").(string)) - id := backupinstances.NewBackupInstanceID(subscriptionId, vaultId.ResourceGroupName, vaultId.VaultName, name) + id := backupinstances.NewBackupInstanceID(subscriptionId, vaultId.ResourceGroupName, vaultId.BackupVaultName, name) if d.IsNewResource() { existing, err := client.Get(ctx, id) @@ -171,7 +171,7 @@ func resourceDataProtectionBackupInstanceDiskRead(d *schema.ResourceData, meta i } return fmt.Errorf("retrieving DataProtection BackupInstance (%q): %+v", id, err) } - vaultId := backupinstances.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.VaultName) + vaultId := backupinstances.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.BackupVaultName) d.Set("name", id.BackupInstanceName) d.Set("vault_id", vaultId.ID()) diff --git a/internal/services/dataprotection/data_protection_backup_instance_disk_resource_test.go b/internal/services/dataprotection/data_protection_backup_instance_disk_resource_test.go index 9038dfbf6a65..f3764623f11c 100644 --- a/internal/services/dataprotection/data_protection_backup_instance_disk_resource_test.go +++ b/internal/services/dataprotection/data_protection_backup_instance_disk_resource_test.go @@ -7,11 +7,10 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,10 +19,10 @@ type DataProtectionBackupInstanceDiskResource struct{} func TestAccDataProtectionBackupInstanceDisk_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_instance_disk", "test") r := DataProtectionBackupInstanceDiskResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -34,10 +33,10 @@ func TestAccDataProtectionBackupInstanceDisk_basic(t *testing.T) { func TestAccDataProtectionBackupInstanceDisk_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_instance_disk", "test") r := DataProtectionBackupInstanceDiskResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -48,10 +47,10 @@ func TestAccDataProtectionBackupInstanceDisk_requiresImport(t *testing.T) { func TestAccDataProtectionBackupInstanceDisk_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_instance_disk", "test") r := DataProtectionBackupInstanceDiskResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -62,24 +61,24 @@ func TestAccDataProtectionBackupInstanceDisk_complete(t *testing.T) { func TestAccDataProtectionBackupInstanceDisk_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_instance_disk", "test") r := DataProtectionBackupInstanceDiskResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -87,7 +86,7 @@ func TestAccDataProtectionBackupInstanceDisk_update(t *testing.T) { }) } -func (r DataProtectionBackupInstanceDiskResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r DataProtectionBackupInstanceDiskResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := backupinstances.ParseBackupInstanceID(state.ID) if err != nil { return nil, err diff --git a/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource.go b/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource.go index f8829d22c4dd..6dbf93ac6667 100644 --- a/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource.go +++ b/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource.go @@ -89,7 +89,7 @@ func resourceDataProtectionBackupInstancePostgreSQLCreateUpdate(d *schema.Resour name := d.Get("name").(string) vaultId, _ := backupinstances.ParseBackupVaultID(d.Get("vault_id").(string)) - id := backupinstances.NewBackupInstanceID(subscriptionId, vaultId.ResourceGroupName, vaultId.VaultName, name) + id := backupinstances.NewBackupInstanceID(subscriptionId, vaultId.ResourceGroupName, vaultId.BackupVaultName, name) if d.IsNewResource() { existing, err := client.Get(ctx, id) @@ -188,7 +188,7 @@ func resourceDataProtectionBackupInstancePostgreSQLRead(d *schema.ResourceData, } return fmt.Errorf("retrieving DataProtection BackupInstance (%q): %+v", id, err) } - vaultId := backupinstances.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.VaultName) + vaultId := backupinstances.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.BackupVaultName) d.Set("name", id.BackupInstanceName) d.Set("vault_id", vaultId.ID()) diff --git a/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource_test.go b/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource_test.go index 0f2f6f689b4d..d4ffaa0e70b0 100644 --- a/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource_test.go +++ b/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource_test.go @@ -7,11 +7,10 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -48,10 +47,10 @@ func TestAccDataProtectionBackupInstancePostgreSQL_requiresImport(t *testing.T) func TestAccDataProtectionBackupInstancePostgreSQL_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_instance_postgresql", "test") r := DataProtectionBackupInstancePostgreSQLResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -62,10 +61,10 @@ func TestAccDataProtectionBackupInstancePostgreSQL_complete(t *testing.T) { func TestAccDataProtectionBackupInstancePostgreSQL_keyVaultAuth(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_instance_postgresql", "test") r := DataProtectionBackupInstancePostgreSQLResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.keyVaultAuth(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -76,24 +75,24 @@ func TestAccDataProtectionBackupInstancePostgreSQL_keyVaultAuth(t *testing.T) { func TestAccDataProtectionBackupInstancePostgreSQL_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_instance_postgresql", "test") r := DataProtectionBackupInstancePostgreSQLResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -101,7 +100,7 @@ func TestAccDataProtectionBackupInstancePostgreSQL_update(t *testing.T) { }) } -func (r DataProtectionBackupInstancePostgreSQLResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r DataProtectionBackupInstancePostgreSQLResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := backupinstances.ParseBackupInstanceID(state.ID) if err != nil { return nil, err diff --git a/internal/services/dataprotection/data_protection_backup_policy_blob_storage_resource.go b/internal/services/dataprotection/data_protection_backup_policy_blob_storage_resource.go index 2570e943ca0f..e1a59fe5d097 100644 --- a/internal/services/dataprotection/data_protection_backup_policy_blob_storage_resource.go +++ b/internal/services/dataprotection/data_protection_backup_policy_blob_storage_resource.go @@ -72,7 +72,7 @@ func resourceDataProtectionBackupPolicyBlobStorageCreate(d *schema.ResourceData, name := d.Get("name").(string) vaultId, _ := backuppolicies.ParseBackupVaultID(d.Get("vault_id").(string)) - id := backuppolicies.NewBackupPolicyID(subscriptionId, vaultId.ResourceGroupName, vaultId.VaultName, name) + id := backuppolicies.NewBackupPolicyID(subscriptionId, vaultId.ResourceGroupName, vaultId.BackupVaultName, name) existing, err := client.Get(ctx, id) if err != nil { @@ -135,7 +135,7 @@ func resourceDataProtectionBackupPolicyBlobStorageRead(d *schema.ResourceData, m } return fmt.Errorf("retrieving DataProtection BackupPolicy (%q): %+v", id, err) } - vaultId := backuppolicies.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.VaultName) + vaultId := backuppolicies.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.BackupVaultName) d.Set("name", id.BackupPolicyName) d.Set("vault_id", vaultId.ID()) if resp.Model != nil { diff --git a/internal/services/dataprotection/data_protection_backup_policy_blob_storage_resource_test.go b/internal/services/dataprotection/data_protection_backup_policy_blob_storage_resource_test.go index d236353db3d7..27f07276d5ef 100644 --- a/internal/services/dataprotection/data_protection_backup_policy_blob_storage_resource_test.go +++ b/internal/services/dataprotection/data_protection_backup_policy_blob_storage_resource_test.go @@ -7,11 +7,10 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,10 +19,10 @@ type DataProtectionBackupPolicyBlobStorageResource struct{} func TestAccDataProtectionBackupPolicyBlobStorage_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_policy_blob_storage", "test") r := DataProtectionBackupPolicyBlobStorageResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -34,10 +33,10 @@ func TestAccDataProtectionBackupPolicyBlobStorage_basic(t *testing.T) { func TestAccDataProtectionBackupPolicyBlobStorage_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_policy_blob_storage", "test") r := DataProtectionBackupPolicyBlobStorageResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -45,7 +44,7 @@ func TestAccDataProtectionBackupPolicyBlobStorage_requiresImport(t *testing.T) { }) } -func (r DataProtectionBackupPolicyBlobStorageResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r DataProtectionBackupPolicyBlobStorageResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := backuppolicies.ParseBackupPolicyID(state.ID) if err != nil { return nil, err diff --git a/internal/services/dataprotection/data_protection_backup_policy_disk_resource.go b/internal/services/dataprotection/data_protection_backup_policy_disk_resource.go index 295e79a7c644..230268ee6244 100644 --- a/internal/services/dataprotection/data_protection_backup_policy_disk_resource.go +++ b/internal/services/dataprotection/data_protection_backup_policy_disk_resource.go @@ -131,7 +131,7 @@ func resourceDataProtectionBackupPolicyDiskCreate(d *schema.ResourceData, meta i name := d.Get("name").(string) vaultId, _ := backuppolicies.ParseBackupVaultID(d.Get("vault_id").(string)) - id := backuppolicies.NewBackupPolicyID(subscriptionId, vaultId.ResourceGroupName, vaultId.VaultName, name) + id := backuppolicies.NewBackupPolicyID(subscriptionId, vaultId.ResourceGroupName, vaultId.BackupVaultName, name) existing, err := client.Get(ctx, id) if err != nil { @@ -182,7 +182,7 @@ func resourceDataProtectionBackupPolicyDiskRead(d *schema.ResourceData, meta int } return fmt.Errorf("retrieving DataProtection BackupPolicy (%q): %+v", id, err) } - vaultId := backuppolicies.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.VaultName) + vaultId := backuppolicies.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.BackupVaultName) d.Set("name", id.BackupPolicyName) d.Set("vault_id", vaultId.ID()) if resp.Model != nil { diff --git a/internal/services/dataprotection/data_protection_backup_policy_disk_resource_test.go b/internal/services/dataprotection/data_protection_backup_policy_disk_resource_test.go index 2ef9bba129b0..715379bfc4c5 100644 --- a/internal/services/dataprotection/data_protection_backup_policy_disk_resource_test.go +++ b/internal/services/dataprotection/data_protection_backup_policy_disk_resource_test.go @@ -7,11 +7,10 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,10 +19,10 @@ type DataProtectionBackupPolicyDiskResource struct{} func TestAccDataProtectionBackupPolicyDisk_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_policy_disk", "test") r := DataProtectionBackupPolicyDiskResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -34,10 +33,10 @@ func TestAccDataProtectionBackupPolicyDisk_basic(t *testing.T) { func TestAccDataProtectionBackupPolicyDisk_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_policy_disk", "test") r := DataProtectionBackupPolicyDiskResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -48,10 +47,10 @@ func TestAccDataProtectionBackupPolicyDisk_requiresImport(t *testing.T) { func TestAccDataProtectionBackupPolicyDisk_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_policy_disk", "test") r := DataProtectionBackupPolicyDiskResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -62,24 +61,24 @@ func TestAccDataProtectionBackupPolicyDisk_complete(t *testing.T) { func TestAccDataProtectionBackupPolicyDisk_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_backup_policy_disk", "test") r := DataProtectionBackupPolicyDiskResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -87,7 +86,7 @@ func TestAccDataProtectionBackupPolicyDisk_update(t *testing.T) { }) } -func (r DataProtectionBackupPolicyDiskResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r DataProtectionBackupPolicyDiskResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := backuppolicies.ParseBackupPolicyID(state.ID) if err != nil { return nil, err diff --git a/internal/services/dataprotection/data_protection_backup_policy_postgresql_resource.go b/internal/services/dataprotection/data_protection_backup_policy_postgresql_resource.go index 1c4ae5003f36..db7e3ca12887 100644 --- a/internal/services/dataprotection/data_protection_backup_policy_postgresql_resource.go +++ b/internal/services/dataprotection/data_protection_backup_policy_postgresql_resource.go @@ -244,7 +244,7 @@ func resourceDataProtectionBackupPolicyPostgreSQLRead(d *pluginsdk.ResourceData, } d.Set("name", id.BackupPolicyName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("vault_name", id.VaultName) + d.Set("vault_name", id.BackupVaultName) if resp.Model != nil { if resp.Model.Properties != nil { diff --git a/internal/services/dataprotection/data_protection_backup_vault_data_source.go b/internal/services/dataprotection/data_protection_backup_vault_data_source.go index e64b9b9d848f..bdc3b52f4623 100644 --- a/internal/services/dataprotection/data_protection_backup_vault_data_source.go +++ b/internal/services/dataprotection/data_protection_backup_vault_data_source.go @@ -2,7 +2,6 @@ package dataprotection import ( "fmt" - "log" "regexp" "time" @@ -76,15 +75,13 @@ func dataSourceDataProtectionBackupVaultRead(d *pluginsdk.ResourceData, meta int resp, err := client.Get(ctx, id) if err != nil { if response.WasNotFound(resp.HttpResponse) { - log.Printf("[INFO] DataProtection BackupVault %q does not exist - removing from state", d.Id()) - d.SetId("") - return nil + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving DataProtection BackupVault (%q): %+v", id, err) } d.SetId(id.ID()) - d.Set("name", id.VaultName) + d.Set("name", id.BackupVaultName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/dataprotection/data_protection_backup_vault_resource.go b/internal/services/dataprotection/data_protection_backup_vault_resource.go index 2216d6ddf018..de8c20bb9061 100644 --- a/internal/services/dataprotection/data_protection_backup_vault_resource.go +++ b/internal/services/dataprotection/data_protection_backup_vault_resource.go @@ -154,7 +154,7 @@ func resourceDataProtectionBackupVaultRead(d *pluginsdk.ResourceData, meta inter } return fmt.Errorf("retrieving DataProtection BackupVault (%q): %+v", id, err) } - d.Set("name", id.VaultName) + d.Set("name", id.BackupVaultName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/dataprotection/data_protection_resource_guard_resource.go b/internal/services/dataprotection/data_protection_resource_guard_resource.go index 95c310d7a96a..fdc3ac401587 100644 --- a/internal/services/dataprotection/data_protection_resource_guard_resource.go +++ b/internal/services/dataprotection/data_protection_resource_guard_resource.go @@ -123,7 +123,7 @@ func resourceDataProtectionResourceGuardRead(d *pluginsdk.ResourceData, meta int return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.ResourceGuardsName) + d.Set("name", id.ResourceGuardName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/dataprotection/data_protection_resource_guard_resource_test.go b/internal/services/dataprotection/data_protection_resource_guard_resource_test.go index 9bee0319bf80..f51b70d2547b 100644 --- a/internal/services/dataprotection/data_protection_resource_guard_resource_test.go +++ b/internal/services/dataprotection/data_protection_resource_guard_resource_test.go @@ -6,11 +6,10 @@ import ( "testing" "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,10 +19,10 @@ func TestAccDataProtectionResourceGuard_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_resource_guard", "test") r := DataProtectionResourceGuardResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -35,10 +34,10 @@ func TestAccDataProtectionResourceGuard_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_resource_guard", "test") r := DataProtectionResourceGuardResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -50,10 +49,10 @@ func TestAccDataProtectionResourceGuard_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_resource_guard", "test") r := DataProtectionResourceGuardResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -65,31 +64,31 @@ func TestAccDataProtectionResourceGuard_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_data_protection_resource_guard", "test") r := DataProtectionResourceGuardResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.update(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -97,7 +96,7 @@ func TestAccDataProtectionResourceGuard_update(t *testing.T) { }) } -func (r DataProtectionResourceGuardResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r DataProtectionResourceGuardResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := resourceguards.ParseResourceGuardID(state.ID) if err != nil { return nil, err diff --git a/internal/services/datashare/client/client.go b/internal/services/datashare/client/client.go index d26ff118d02c..a5a3ae09c383 100644 --- a/internal/services/datashare/client/client.go +++ b/internal/services/datashare/client/client.go @@ -1,28 +1,31 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - AccountClient *datashare.AccountsClient - DataSetClient *datashare.DataSetsClient - SharesClient *datashare.SharesClient - SynchronizationClient *datashare.SynchronizationSettingsClient + AccountClient *account.AccountClient + DataSetClient *dataset.DataSetClient + SharesClient *share.ShareClient + SynchronizationClient *synchronizationsetting.SynchronizationSettingClient } func NewClient(o *common.ClientOptions) *Client { - accountClient := datashare.NewAccountsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + accountClient := account.NewAccountClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&accountClient.Client, o.ResourceManagerAuthorizer) - dataSetClient := datashare.NewDataSetsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + dataSetClient := dataset.NewDataSetClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&dataSetClient.Client, o.ResourceManagerAuthorizer) - sharesClient := datashare.NewSharesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + sharesClient := share.NewShareClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&sharesClient.Client, o.ResourceManagerAuthorizer) - synchronizationSettingsClient := datashare.NewSynchronizationSettingsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + synchronizationSettingsClient := synchronizationsetting.NewSynchronizationSettingClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&synchronizationSettingsClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/internal/services/datashare/data_share_account_data_source.go b/internal/services/datashare/data_share_account_data_source.go index 737bf54c4bab..26919ff451e6 100644 --- a/internal/services/datashare/data_share_account_data_source.go +++ b/internal/services/datashare/data_share_account_data_source.go @@ -4,14 +4,16 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + helperTags "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceDataShareAccount() *pluginsdk.Resource { @@ -44,23 +46,26 @@ func dataSourceDataShareAccountRead(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := account.NewAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s does not exist", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.AccountName) + d.Set("resource_group_name", id.ResourceGroupName) - if err := d.Set("identity", flattenAccountIdentity(resp.Identity)); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) + if model := resp.Model; model != nil { + if err := d.Set("identity", identity.FlattenSystemAssigned(&model.Identity)); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } + return helperTags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/internal/services/datashare/data_share_account_resource.go b/internal/services/datashare/data_share_account_resource.go index 1949b5e83d91..13eefb6510d0 100644 --- a/internal/services/datashare/data_share_account_resource.go +++ b/internal/services/datashare/data_share_account_resource.go @@ -5,13 +5,14 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + helperTags "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -34,7 +35,7 @@ func resourceDataShareAccount() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.AccountID(id) + _, err := account.ParseAccountID(id) return err }), @@ -65,39 +66,34 @@ func resourceDataShareAccountCreate(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := account.NewAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for present of existing %s: %+v", id, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_data_share_account", id.ID()) } - expandedIdentity, err := expandAzureRmDataShareAccountIdentity(d.Get("identity").([]interface{})) + expandedIdentity, err := identity.ExpandSystemAssigned(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } - account := datashare.Account{ - Name: utils.String(id.Name), + account := account.Account{ + Name: utils.String(id.AccountName), Location: utils.String(location.Normalize(d.Get("location").(string))), - Identity: expandedIdentity, - Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + Identity: *expandedIdentity, + Tags: helperTags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.Create(ctx, id.ResourceGroup, id.Name, account) - if err != nil { + if err := client.CreateThenPoll(ctx, id, account); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting on creating future for %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceDataShareAccountRead(d, meta) @@ -108,29 +104,31 @@ func resourceDataShareAccountRead(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AccountID(d.Id()) + id, err := account.ParseAccountID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] DataShare %q does not exist - removing from state", d.Id()) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("retrieving DataShare Account %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.AccountName) + d.Set("resource_group_name", id.ResourceGroupName) - if err := d.Set("identity", flattenAccountIdentity(resp.Identity)); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + if err := d.Set("identity", identity.FlattenSystemAssigned(&model.Identity)); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } + return helperTags.FlattenAndSet(d, model.Tags) } - - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceDataShareAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) error { @@ -138,19 +136,19 @@ func resourceDataShareAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AccountID(d.Id()) + id, err := account.ParseAccountID(d.Id()) if err != nil { return err } - props := datashare.AccountUpdateParameters{} + props := account.AccountUpdateParameters{} if d.HasChange("tags") { - props.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) + props.Tags = helperTags.Expand(d.Get("tags").(map[string]interface{})) } - if _, err = client.Update(ctx, id.ResourceGroup, id.Name, props); err != nil { - return fmt.Errorf("updating DataShare Account %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if _, err = client.Update(ctx, *id, props); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } return resourceDataShareAccountRead(d, meta) @@ -161,52 +159,14 @@ func resourceDataShareAccountDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AccountID(d.Id()) + id, err := account.ParseAccountID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { - return fmt.Errorf("deleting DataShare Account %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for DataShare Account %q (Resource Group %q) to be deleted: %+v", id.Name, id.ResourceGroup, err) - } return nil } - -func expandAzureRmDataShareAccountIdentity(input []interface{}) (*datashare.Identity, error) { - expanded, err := identity.ExpandSystemAssigned(input) - if err != nil { - return nil, err - } - - if expanded.Type == identity.TypeNone { - return nil, nil - } - - return &datashare.Identity{ - Type: datashare.Type(string(expanded.Type)), - }, nil -} - -func flattenAccountIdentity(input *datashare.Identity) []interface{} { - var transform *identity.SystemAssigned - - if input != nil { - transform = &identity.SystemAssigned{ - Type: identity.Type(string(input.Type)), - } - - if input.PrincipalID != nil { - transform.PrincipalId = *input.PrincipalID - } - if input.TenantID != nil { - transform.TenantId = *input.TenantID - } - } - - return identity.FlattenSystemAssigned(transform) -} diff --git a/internal/services/datashare/data_share_account_resource_test.go b/internal/services/datashare/data_share_account_resource_test.go index 67bb21e54825..c9cb4f3b43e7 100644 --- a/internal/services/datashare/data_share_account_resource_test.go +++ b/internal/services/datashare/data_share_account_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -108,17 +108,17 @@ func TestAccDataShareAccount_update(t *testing.T) { } func (t DataShareAccountResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.AccountID(state.ID) + id, err := account.ParseAccountID(state.ID) if err != nil { return nil, err } - resp, err := clients.DataShare.AccountClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := clients.DataShare.AccountClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Data Share Account %q (resource group: %q): %+v", id.Name, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.AccountProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (DataShareAccountResource) template(data acceptance.TestData) string { diff --git a/internal/services/datashare/data_share_data_source.go b/internal/services/datashare/data_share_data_source.go index 7fda3102c6c3..515f313b75de 100644 --- a/internal/services/datashare/data_share_data_source.go +++ b/internal/services/datashare/data_share_data_source.go @@ -4,13 +4,14 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceDataShare() *pluginsdk.Resource { @@ -31,7 +32,7 @@ func dataSourceDataShare() *pluginsdk.Resource { "account_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validate.AccountID, + ValidateFunc: account.ValidateAccountID, }, "kind": { @@ -83,44 +84,42 @@ func dataSourceDataShareRead(d *pluginsdk.ResourceData, meta interface{}) error defer cancel() name := d.Get("name").(string) - accountId, err := parse.AccountID(d.Get("account_id").(string)) + accountId, err := account.ParseAccountID(d.Get("account_id").(string)) if err != nil { return err } - resp, err := client.Get(ctx, accountId.ResourceGroup, accountId.Name, name) + id := share.NewShareID(subscriptionId, accountId.ResourceGroupName, accountId.AccountName, name) + + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf("DataShare %q (Account %q / Resource Group %q) was not found", name, accountId.Name, accountId.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) } - return fmt.Errorf("retrieving DataShare %q (Account %q / Resource Group %q): %+v", name, accountId.Name, accountId.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - dataShareId := parse.NewShareID(subscriptionId, accountId.ResourceGroup, accountId.Name, name).ID() - d.SetId(dataShareId) + d.SetId(id.ID()) d.Set("name", name) d.Set("account_id", accountId.ID()) - if props := resp.ShareProperties; props != nil { - d.Set("description", props.Description) - d.Set("kind", string(props.ShareKind)) - d.Set("terms", props.Terms) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("kind", props.ShareKind) + d.Set("description", props.Description) + d.Set("terms", props.Terms) + } } - settings := make([]datashare.ScheduledSynchronizationSetting, 0) - syncIterator, err := syncClient.ListByShareComplete(ctx, accountId.ResourceGroup, accountId.Name, name, "") + settings := make([]synchronizationsetting.ScheduledSynchronizationSetting, 0) + snapshotSchedules, err := syncClient.ListByShareComplete(ctx, synchronizationsetting.NewShareID(id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName)) if err != nil { - return fmt.Errorf("listing Snapshot Schedules for Data Share %q (Account %q / Resource Group %q): %+v", name, accountId.Name, accountId.ResourceGroup, err) + return fmt.Errorf("listing snapshot schedules for %s: %+v", id, err) } - for syncIterator.NotDone() { - item, ok := syncIterator.Value().AsScheduledSynchronizationSetting() - if ok && item != nil { - settings = append(settings, *item) - } - - if err := syncIterator.NextWithContext(ctx); err != nil { - return fmt.Errorf("retrieving next Snapshot Schedule: %+v", err) + for _, item := range snapshotSchedules.Items { + if s, ok := item.(synchronizationsetting.ScheduledSynchronizationSetting); ok { + settings = append(settings, s) } } @@ -131,24 +130,20 @@ func dataSourceDataShareRead(d *pluginsdk.ResourceData, meta interface{}) error return nil } -func flattenDataShareDataSourceSnapshotSchedule(input []datashare.ScheduledSynchronizationSetting) []interface{} { +func flattenDataShareDataSourceSnapshotSchedule(input []synchronizationsetting.ScheduledSynchronizationSetting) []interface{} { output := make([]interface{}, 0) - for _, sync := range input { + for _, setting := range input { + props := setting.Properties name := "" - if sync.Name != nil { - name = *sync.Name - } - - startTime := "" - if sync.SynchronizationTime != nil && !sync.SynchronizationTime.IsZero() { - startTime = sync.SynchronizationTime.Format(time.RFC3339) + if props.UserName != nil { + name = *props.UserName } output = append(output, map[string]interface{}{ "name": name, - "recurrence": string(sync.RecurrenceInterval), - "start_time": startTime, + "recurrence": string(props.RecurrenceInterval), + "start_time": props.SynchronizationTime, }) } diff --git a/internal/services/datashare/data_share_dataset_blob_storage_data_source.go b/internal/services/datashare/data_share_dataset_blob_storage_data_source.go index 317c89a56bbe..e84147068db8 100644 --- a/internal/services/datashare/data_share_dataset_blob_storage_data_source.go +++ b/internal/services/datashare/data_share_dataset_blob_storage_data_source.go @@ -4,10 +4,9 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/helper" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -31,7 +30,7 @@ func dataSourceDataShareDatasetBlobStorage() *pluginsdk.Resource { "data_share_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validate.ShareID, + ValidateFunc: share.ValidateShareID, }, "container_name": { @@ -85,58 +84,50 @@ func dataSourceDataShareDatasetBlobStorageRead(d *pluginsdk.ResourceData, meta i ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - shareId, err := parse.ShareID(d.Get("data_share_id").(string)) + shareId, err := share.ParseShareID(d.Get("data_share_id").(string)) if err != nil { return err } - id := parse.NewDataSetID(shareId.SubscriptionId, shareId.ResourceGroup, shareId.AccountName, shareId.Name, d.Get("name").(string)) + id := dataset.NewDataSetID(shareId.SubscriptionId, shareId.ResourceGroupName, shareId.AccountName, shareId.ShareName, d.Get("name").(string)) - respModel, err := client.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { return fmt.Errorf("retrieving %s: %+v", id, err) } - respId := helper.GetAzurermDataShareDataSetId(respModel.Value) - if respId == nil || *respId == "" { - return fmt.Errorf("empty or nil ID returned for reading %s", id) - } - d.SetId(id.ID()) - d.Set("name", id.Name) + d.Set("name", id.DataSetName) d.Set("data_share_id", shareId.ID()) - switch resp := respModel.Value.(type) { - case datashare.BlobDataSet: - if props := resp.BlobProperties; props != nil { + if model := resp.Model; model != nil { + m := *model + if ds, ok := m.(dataset.BlobDataSet); ok { + props := ds.Properties d.Set("container_name", props.ContainerName) - if err := d.Set("storage_account", flattenAzureRmDataShareDataSetBlobStorageAccount(props.StorageAccountName, props.ResourceGroup, props.SubscriptionID)); err != nil { + if err := d.Set("storage_account", flattenAzureRmDataShareDataSetBlobStorageAccount(props.StorageAccountName, props.ResourceGroup, props.SubscriptionId)); err != nil { return fmt.Errorf("setting `storage_account`: %+v", err) } d.Set("file_path", props.FilePath) - d.Set("display_name", props.DataSetID) - } + d.Set("display_name", props.DataSetId) - case datashare.BlobFolderDataSet: - if props := resp.BlobFolderProperties; props != nil { + } else if ds, ok := m.(dataset.BlobFolderDataSet); ok { + props := ds.Properties d.Set("container_name", props.ContainerName) - if err := d.Set("storage_account", flattenAzureRmDataShareDataSetBlobStorageAccount(props.StorageAccountName, props.ResourceGroup, props.SubscriptionID)); err != nil { + if err := d.Set("storage_account", flattenAzureRmDataShareDataSetBlobStorageAccount(props.StorageAccountName, props.ResourceGroup, props.SubscriptionId)); err != nil { return fmt.Errorf("setting `storage_account`: %+v", err) } d.Set("folder_path", props.Prefix) - d.Set("display_name", props.DataSetID) - } - - case datashare.BlobContainerDataSet: - if props := resp.BlobContainerProperties; props != nil { + d.Set("display_name", props.DataSetId) + } else if ds, ok := m.(dataset.BlobContainerDataSet); ok { + props := ds.Properties d.Set("container_name", props.ContainerName) - if err := d.Set("storage_account", flattenAzureRmDataShareDataSetBlobStorageAccount(props.StorageAccountName, props.ResourceGroup, props.SubscriptionID)); err != nil { + if err := d.Set("storage_account", flattenAzureRmDataShareDataSetBlobStorageAccount(props.StorageAccountName, props.ResourceGroup, props.SubscriptionId)); err != nil { return fmt.Errorf("setting `storage_account`: %+v", err) } - d.Set("display_name", props.DataSetID) + d.Set("display_name", props.DataSetId) + } else { + return fmt.Errorf("%s is not a blob storage dataset", id) } - - default: - return fmt.Errorf("%s is not a blob storage dataset", id) } return nil diff --git a/internal/services/datashare/data_share_dataset_blob_storage_resource.go b/internal/services/datashare/data_share_dataset_blob_storage_resource.go index 6865229baee8..6602c30e2143 100644 --- a/internal/services/datashare/data_share_dataset_blob_storage_resource.go +++ b/internal/services/datashare/data_share_dataset_blob_storage_resource.go @@ -5,18 +5,17 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/helper" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/validate" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceDataShareDataSetBlobStorage() *pluginsdk.Resource { @@ -32,7 +31,7 @@ func resourceDataShareDataSetBlobStorage() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DataSetID(id) + _, err := dataset.ParseDataSetID(id) return err }), @@ -48,7 +47,7 @@ func resourceDataShareDataSetBlobStorage() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ShareID, + ValidateFunc: share.ValidateShareID, }, "container_name": { @@ -114,59 +113,55 @@ func resourceDataShareDataSetBlobStorageCreate(d *pluginsdk.ResourceData, meta i ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - shareId, err := parse.ShareID(d.Get("data_share_id").(string)) + shareId, err := share.ParseShareID(d.Get("data_share_id").(string)) if err != nil { return err } - id := parse.NewDataSetID(shareId.SubscriptionId, shareId.ResourceGroup, shareId.AccountName, shareId.Name, d.Get("name").(string)) + id := dataset.NewDataSetID(shareId.SubscriptionId, shareId.ResourceGroupName, shareId.AccountName, shareId.ShareName, d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of %s: %+v", id, err) } } - existingId := helper.GetAzurermDataShareDataSetId(existing.Value) - if existingId != nil && *existingId != "" { - return tf.ImportAsExistsError("azurerm_data_share_dataset_blob_storage", *existingId) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_data_share_dataset_blob_storage", id.ID()) } - var dataSet datashare.BasicDataSet + var dataSet dataset.DataSet if filePath, ok := d.GetOk("file_path"); ok { - dataSet = datashare.BlobDataSet{ - Kind: datashare.KindBlob, - BlobProperties: &datashare.BlobProperties{ - ContainerName: utils.String(d.Get("container_name").(string)), - StorageAccountName: utils.String(d.Get("storage_account.0.name").(string)), - ResourceGroup: utils.String(d.Get("storage_account.0.resource_group_name").(string)), - SubscriptionID: utils.String(d.Get("storage_account.0.subscription_id").(string)), - FilePath: utils.String(filePath.(string)), + dataSet = dataset.BlobDataSet{ + Properties: dataset.BlobProperties{ + ContainerName: d.Get("container_name").(string), + StorageAccountName: d.Get("storage_account.0.name").(string), + ResourceGroup: d.Get("storage_account.0.resource_group_name").(string), + SubscriptionId: d.Get("storage_account.0.subscription_id").(string), + FilePath: filePath.(string), }, } } else if folderPath, ok := d.GetOk("folder_path"); ok { - dataSet = datashare.BlobFolderDataSet{ - Kind: datashare.KindBlobFolder, - BlobFolderProperties: &datashare.BlobFolderProperties{ - ContainerName: utils.String(d.Get("container_name").(string)), - StorageAccountName: utils.String(d.Get("storage_account.0.name").(string)), - ResourceGroup: utils.String(d.Get("storage_account.0.resource_group_name").(string)), - SubscriptionID: utils.String(d.Get("storage_account.0.subscription_id").(string)), - Prefix: utils.String(folderPath.(string)), + dataSet = dataset.BlobFolderDataSet{ + Properties: dataset.BlobFolderProperties{ + ContainerName: d.Get("container_name").(string), + StorageAccountName: d.Get("storage_account.0.name").(string), + ResourceGroup: d.Get("storage_account.0.resource_group_name").(string), + SubscriptionId: d.Get("storage_account.0.subscription_id").(string), + Prefix: folderPath.(string), }, } } else { - dataSet = datashare.BlobContainerDataSet{ - Kind: datashare.KindContainer, - BlobContainerProperties: &datashare.BlobContainerProperties{ - ContainerName: utils.String(d.Get("container_name").(string)), - StorageAccountName: utils.String(d.Get("storage_account.0.name").(string)), - ResourceGroup: utils.String(d.Get("storage_account.0.resource_group_name").(string)), - SubscriptionID: utils.String(d.Get("storage_account.0.subscription_id").(string)), + dataSet = dataset.BlobContainerDataSet{ + Properties: dataset.BlobContainerProperties{ + ContainerName: d.Get("container_name").(string), + StorageAccountName: d.Get("storage_account.0.name").(string), + ResourceGroup: d.Get("storage_account.0.resource_group_name").(string), + SubscriptionId: d.Get("storage_account.0.subscription_id").(string), }, } } - if _, err := client.Create(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name, dataSet); err != nil { + if _, err := client.Create(ctx, id, dataSet); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -176,68 +171,58 @@ func resourceDataShareDataSetBlobStorageCreate(d *pluginsdk.ResourceData, meta i func resourceDataShareDataSetBlobStorageRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).DataShare.DataSetClient - shareClient := meta.(*clients.Client).DataShare.SharesClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DataSetID(d.Id()) + id, err := dataset.ParseDataSetID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] DataShare %q does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("retrieving DataShare Blob Storage DataSet %q (Resource Group %q / accountName %q / shareName %q): %+v", id.Name, id.ResourceGroup, id.AccountName, id.ShareName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - shareResp, err := shareClient.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName) - if err != nil { - return fmt.Errorf("retrieving DataShare %q (Resource Group %q / accountName %q): %+v", id.ShareName, id.ResourceGroup, id.AccountName, err) - } - if shareResp.ID == nil || *shareResp.ID == "" { - return fmt.Errorf("empty or nil ID returned for DataShare %q (Resource Group %q / accountName %q)", id.ShareName, id.ResourceGroup, id.AccountName) - } + d.Set("name", id.DataSetName) - d.Set("data_share_id", shareResp.ID) + shareId := share.NewShareID(id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName) + d.Set("data_share_id", shareId.ID()) - switch resp := resp.Value.(type) { - case datashare.BlobDataSet: - if props := resp.BlobProperties; props != nil { + if model := resp.Model; model != nil { + m := *model + if ds, ok := m.(dataset.BlobDataSet); ok { + props := ds.Properties d.Set("container_name", props.ContainerName) - if err := d.Set("storage_account", flattenAzureRmDataShareDataSetBlobStorageAccount(props.StorageAccountName, props.ResourceGroup, props.SubscriptionID)); err != nil { + if err := d.Set("storage_account", flattenAzureRmDataShareDataSetBlobStorageAccount(props.StorageAccountName, props.ResourceGroup, props.SubscriptionId)); err != nil { return fmt.Errorf("setting `storage_account`: %+v", err) } d.Set("file_path", props.FilePath) - d.Set("display_name", props.DataSetID) - } + d.Set("display_name", props.DataSetId) - case datashare.BlobFolderDataSet: - if props := resp.BlobFolderProperties; props != nil { + } else if ds, ok := m.(dataset.BlobFolderDataSet); ok { + props := ds.Properties d.Set("container_name", props.ContainerName) - if err := d.Set("storage_account", flattenAzureRmDataShareDataSetBlobStorageAccount(props.StorageAccountName, props.ResourceGroup, props.SubscriptionID)); err != nil { + if err := d.Set("storage_account", flattenAzureRmDataShareDataSetBlobStorageAccount(props.StorageAccountName, props.ResourceGroup, props.SubscriptionId)); err != nil { return fmt.Errorf("setting `storage_account`: %+v", err) } d.Set("folder_path", props.Prefix) - d.Set("display_name", props.DataSetID) - } - - case datashare.BlobContainerDataSet: - if props := resp.BlobContainerProperties; props != nil { + d.Set("display_name", props.DataSetId) + } else if ds, ok := m.(dataset.BlobContainerDataSet); ok { + props := ds.Properties d.Set("container_name", props.ContainerName) - if err := d.Set("storage_account", flattenAzureRmDataShareDataSetBlobStorageAccount(props.StorageAccountName, props.ResourceGroup, props.SubscriptionID)); err != nil { + if err := d.Set("storage_account", flattenAzureRmDataShareDataSetBlobStorageAccount(props.StorageAccountName, props.ResourceGroup, props.SubscriptionId)); err != nil { return fmt.Errorf("setting `storage_account`: %+v", err) } - d.Set("display_name", props.DataSetID) + d.Set("display_name", props.DataSetId) + } else { + return fmt.Errorf("%s is not a blob storage dataset", *id) } - - default: - return fmt.Errorf("data share dataset %q (Resource Group %q / accountName %q / shareName %q) is not a blob storage dataset", id.Name, id.ResourceGroup, id.AccountName, id.ShareName) } return nil @@ -248,36 +233,19 @@ func resourceDataShareDataSetBlobStorageDelete(d *pluginsdk.ResourceData, meta i ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DataSetID(d.Id()) + id, err := dataset.ParseDataSetID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) - if err != nil { - return fmt.Errorf("deleting DataShare Blob Storage DataSet %q (Resource Group %q / accountName %q / shareName %q): %+v", id.Name, id.ResourceGroup, id.AccountName, id.ShareName, err) + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of DataShare Blob Storage DataSet %q (Resource Group %q / accountName %q / shareName %q): %+v", id.Name, id.ResourceGroup, id.AccountName, id.ShareName, err) - } return nil } -func flattenAzureRmDataShareDataSetBlobStorageAccount(strName, strRG, strSubs *string) []interface{} { - var name, rg, subs string - if strName != nil { - name = *strName - } - - if strRG != nil { - rg = *strRG - } - - if strSubs != nil { - subs = *strSubs - } - +func flattenAzureRmDataShareDataSetBlobStorageAccount(name, rg, subs string) []interface{} { return []interface{}{ map[string]interface{}{ "name": name, diff --git a/internal/services/datashare/data_share_dataset_blob_storage_resource_test.go b/internal/services/datashare/data_share_dataset_blob_storage_resource_test.go index 5931a0c8a952..da2bc45867e8 100644 --- a/internal/services/datashare/data_share_dataset_blob_storage_resource_test.go +++ b/internal/services/datashare/data_share_dataset_blob_storage_resource_test.go @@ -6,11 +6,10 @@ import ( "os" "testing" - "github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -81,28 +80,30 @@ func TestAccDataShareDataSetBlobStorage_requiresImport(t *testing.T) { } func (t DataShareDataSetBlobStorageResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DataSetID(state.ID) + id, err := dataset.ParseDataSetID(state.ID) if err != nil { return nil, err } - resp, err := clients.DataShare.DataSetClient.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + resp, err := clients.DataShare.DataSetClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Data Share Data Set %q (resource group: %q): %+v", id.Name, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - switch resp := resp.Value.(type) { - case datashare.BlobDataSet: - return utils.Bool(resp.BlobProperties != nil), nil - - case datashare.BlobFolderDataSet: - return utils.Bool(resp.BlobFolderProperties != nil), nil - - case datashare.BlobContainerDataSet: - return utils.Bool(resp.BlobContainerProperties != nil), nil + if model := resp.Model; model != nil { + ds := *model + if _, ok := ds.(dataset.BlobDataSet); ok { + return utils.Bool(true), nil + } + if _, ok := ds.(dataset.BlobFolderDataSet); ok { + return utils.Bool(true), nil + } + if _, ok := ds.(dataset.BlobContainerDataSet); ok { + return utils.Bool(true), nil + } } - return nil, fmt.Errorf("Data Share Data %q (Resource Group %q / accountName %q / shareName %q) is not a datalake store gen2 dataset", id.Name, id.ResourceGroup, id.AccountName, id.ShareName) + return nil, fmt.Errorf("%s is not a blob storage dataset", *id) } func (DataShareDataSetBlobStorageResource) template(data acceptance.TestData) string { diff --git a/internal/services/datashare/data_share_dataset_data_lake_gen2_data_source.go b/internal/services/datashare/data_share_dataset_data_lake_gen2_data_source.go index 914433647b69..981a08ed94a3 100644 --- a/internal/services/datashare/data_share_dataset_data_lake_gen2_data_source.go +++ b/internal/services/datashare/data_share_dataset_data_lake_gen2_data_source.go @@ -4,11 +4,11 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/helper" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/validate" + storageParsers "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" ) @@ -31,7 +31,7 @@ func dataSourceDataShareDatasetDataLakeGen2() *pluginsdk.Resource { "share_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validate.ShareID, + ValidateFunc: share.ValidateShareID, }, "storage_account_id": { @@ -67,52 +67,43 @@ func dataSourceDataShareDatasetDataLakeGen2Read(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - shareId, err := parse.ShareID(d.Get("share_id").(string)) + shareId, err := share.ParseShareID(d.Get("share_id").(string)) if err != nil { return err } - id := parse.NewDataSetID(shareId.SubscriptionId, shareId.ResourceGroup, shareId.AccountName, shareId.Name, d.Get("name").(string)) + id := dataset.NewDataSetID(shareId.SubscriptionId, shareId.ResourceGroupName, shareId.AccountName, shareId.ShareName, d.Get("name").(string)) - respModel, err := client.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { return fmt.Errorf("retrieving %s: %+v", id, err) } - respId := helper.GetAzurermDataShareDataSetId(respModel.Value) - if respId == nil || *respId == "" { - return fmt.Errorf("empty or nil ID returned for %s", id) - } - d.SetId(id.ID()) - d.Set("name", id.Name) + d.Set("name", id.DataSetName) d.Set("share_id", shareId.ID()) - switch resp := respModel.Value.(type) { - case datashare.ADLSGen2FileDataSet: - if props := resp.ADLSGen2FileProperties; props != nil { - d.Set("storage_account_id", fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s", *props.SubscriptionID, *props.ResourceGroup, *props.StorageAccountName)) + if model := resp.Model; model != nil { + m := *model + if ds, ok := m.(dataset.ADLSGen2FileDataSet); ok { + props := ds.Properties + d.Set("storage_account_id", storageParsers.NewStorageAccountID(props.SubscriptionId, props.ResourceGroup, props.StorageAccountName).ID()) d.Set("file_system_name", props.FileSystem) d.Set("file_path", props.FilePath) - d.Set("display_name", props.DataSetID) - } - - case datashare.ADLSGen2FolderDataSet: - if props := resp.ADLSGen2FolderProperties; props != nil { - d.Set("storage_account_id", fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s", *props.SubscriptionID, *props.ResourceGroup, *props.StorageAccountName)) + d.Set("display_name", props.DataSetId) + } else if ds, ok := m.(dataset.ADLSGen2FolderDataSet); ok { + props := ds.Properties + d.Set("storage_account_id", storageParsers.NewStorageAccountID(props.SubscriptionId, props.ResourceGroup, props.StorageAccountName).ID()) d.Set("file_system_name", props.FileSystem) d.Set("folder_path", props.FolderPath) - d.Set("display_name", props.DataSetID) - } - - case datashare.ADLSGen2FileSystemDataSet: - if props := resp.ADLSGen2FileSystemProperties; props != nil { - d.Set("storage_account_id", fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s", *props.SubscriptionID, *props.ResourceGroup, *props.StorageAccountName)) + d.Set("display_name", props.DataSetId) + } else if ds, ok := m.(dataset.ADLSGen2FileSystemDataSet); ok { + props := ds.Properties + d.Set("storage_account_id", storageParsers.NewStorageAccountID(props.SubscriptionId, props.ResourceGroup, props.StorageAccountName).ID()) d.Set("file_system_name", props.FileSystem) - d.Set("display_name", props.DataSetID) + d.Set("display_name", props.DataSetId) + } else { + return fmt.Errorf("%s is not a datalake store gen2 dataset", id) } - - default: - return fmt.Errorf("%s is not a datalake store gen2 dataset", id) } return nil diff --git a/internal/services/datashare/data_share_dataset_data_lake_gen2_data_source_test.go b/internal/services/datashare/data_share_dataset_data_lake_gen2_data_source_test.go index 5fbcddd15527..5ee98e61a4dd 100644 --- a/internal/services/datashare/data_share_dataset_data_lake_gen2_data_source_test.go +++ b/internal/services/datashare/data_share_dataset_data_lake_gen2_data_source_test.go @@ -32,8 +32,8 @@ func (DataShareDatasetDataLakeGen2DataSource) basic(data acceptance.TestData) st %s data "azurerm_data_share_dataset_data_lake_gen2" "test" { - name = azurerm_data_share_dataset_data_lake_gen2.test.name - share_id = azurerm_data_share_dataset_data_lake_gen2.test.share_id + name = azurerm_data_share_dataset_data_lake_gen2.test.name + share_id = azurerm_data_share_dataset_data_lake_gen2.test.share_id } `, DataShareDataSetDataLakeGen2Resource{}.basicFile(data)) } diff --git a/internal/services/datashare/data_share_dataset_data_lake_gen2_resource.go b/internal/services/datashare/data_share_dataset_data_lake_gen2_resource.go index eac49b3929b4..26ad95e85fb4 100644 --- a/internal/services/datashare/data_share_dataset_data_lake_gen2_resource.go +++ b/internal/services/datashare/data_share_dataset_data_lake_gen2_resource.go @@ -5,18 +5,17 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/helper" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/validate" storageParsers "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceDataShareDataSetDataLakeGen2() *pluginsdk.Resource { @@ -32,7 +31,7 @@ func resourceDataShareDataSetDataLakeGen2() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DataSetID(id) + _, err := dataset.ParseDataSetID(id) return err }), @@ -48,7 +47,7 @@ func resourceDataShareDataSetDataLakeGen2() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ShareID, + ValidateFunc: share.ValidateShareID, }, "storage_account_id": { @@ -94,21 +93,20 @@ func resourceDataShareDataSetDataLakeGen2Create(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - shareId, err := parse.ShareID(d.Get("share_id").(string)) + shareId, err := share.ParseShareID(d.Get("share_id").(string)) if err != nil { return err } - id := parse.NewDataSetID(shareId.SubscriptionId, shareId.ResourceGroup, shareId.AccountName, shareId.Name, d.Get("name").(string)) + id := dataset.NewDataSetID(shareId.SubscriptionId, shareId.ResourceGroupName, shareId.AccountName, shareId.ShareName, d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of %s: %+v", id, err) } } - existingId := helper.GetAzurermDataShareDataSetId(existing.Value) - if existingId != nil && *existingId != "" { - return tf.ImportAsExistsError("azurerm_data_share_dataset_data_lake_gen2", *existingId) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_data_share_dataset_data_lake_gen2", id.ID()) } strId, err := storageParsers.StorageAccountID(d.Get("storage_account_id").(string)) @@ -116,43 +114,40 @@ func resourceDataShareDataSetDataLakeGen2Create(d *pluginsdk.ResourceData, meta return err } - var dataSet datashare.BasicDataSet + var dataSet dataset.DataSet if filePath, ok := d.GetOk("file_path"); ok { - dataSet = datashare.ADLSGen2FileDataSet{ - Kind: datashare.KindAdlsGen2File, - ADLSGen2FileProperties: &datashare.ADLSGen2FileProperties{ - StorageAccountName: utils.String(strId.Name), - ResourceGroup: utils.String(strId.ResourceGroup), - SubscriptionID: utils.String(strId.SubscriptionId), - FileSystem: utils.String(d.Get("file_system_name").(string)), - FilePath: utils.String(filePath.(string)), + dataSet = dataset.ADLSGen2FileDataSet{ + Properties: dataset.ADLSGen2FileProperties{ + StorageAccountName: strId.Name, + ResourceGroup: strId.ResourceGroup, + SubscriptionId: strId.SubscriptionId, + FileSystem: d.Get("file_system_name").(string), + FilePath: filePath.(string), }, } } else if folderPath, ok := d.GetOk("folder_path"); ok { - dataSet = datashare.ADLSGen2FolderDataSet{ - Kind: datashare.KindAdlsGen2Folder, - ADLSGen2FolderProperties: &datashare.ADLSGen2FolderProperties{ - StorageAccountName: utils.String(strId.Name), - ResourceGroup: utils.String(strId.ResourceGroup), - SubscriptionID: utils.String(strId.SubscriptionId), - FileSystem: utils.String(d.Get("file_system_name").(string)), - FolderPath: utils.String(folderPath.(string)), + dataSet = dataset.ADLSGen2FolderDataSet{ + Properties: dataset.ADLSGen2FolderProperties{ + StorageAccountName: strId.Name, + ResourceGroup: strId.ResourceGroup, + SubscriptionId: strId.SubscriptionId, + FileSystem: d.Get("file_system_name").(string), + FolderPath: folderPath.(string), }, } } else { - dataSet = datashare.ADLSGen2FileSystemDataSet{ - Kind: datashare.KindAdlsGen2FileSystem, - ADLSGen2FileSystemProperties: &datashare.ADLSGen2FileSystemProperties{ - StorageAccountName: utils.String(strId.Name), - ResourceGroup: utils.String(strId.ResourceGroup), - SubscriptionID: utils.String(strId.SubscriptionId), - FileSystem: utils.String(d.Get("file_system_name").(string)), + dataSet = dataset.ADLSGen2FileSystemDataSet{ + Properties: dataset.ADLSGen2FileSystemProperties{ + StorageAccountName: strId.Name, + ResourceGroup: strId.ResourceGroup, + SubscriptionId: strId.SubscriptionId, + FileSystem: d.Get("file_system_name").(string), }, } } - if _, err := client.Create(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name, dataSet); err != nil { + if _, err := client.Create(ctx, id, dataSet); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -162,62 +157,51 @@ func resourceDataShareDataSetDataLakeGen2Create(d *pluginsdk.ResourceData, meta func resourceDataShareDataSetDataLakeGen2Read(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).DataShare.DataSetClient - shareClient := meta.(*clients.Client).DataShare.SharesClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DataSetID(d.Id()) + id, err := dataset.ParseDataSetID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] DataShare %q does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("retrieving DataShare DataSet %q (Resource Group %q / accountName %q / shareName %q): %+v", id.Name, id.ResourceGroup, id.AccountName, id.ShareName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - shareResp, err := shareClient.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName) - if err != nil { - return fmt.Errorf("retrieving DataShare %q (Resource Group %q / accountName %q): %+v", id.ShareName, id.ResourceGroup, id.AccountName, err) - } - if shareResp.ID == nil || *shareResp.ID == "" { - return fmt.Errorf("empty or nil ID returned for DataShare %q (Resource Group %q / accountName %q)", id.ShareName, id.ResourceGroup, id.AccountName) - } - d.Set("share_id", shareResp.ID) + d.Set("name", id.DataSetName) + + shareId := share.NewShareID(id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName) + d.Set("share_id", shareId.ID()) - switch resp := resp.Value.(type) { - case datashare.ADLSGen2FileDataSet: - if props := resp.ADLSGen2FileProperties; props != nil { - d.Set("storage_account_id", fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s", *props.SubscriptionID, *props.ResourceGroup, *props.StorageAccountName)) + if model := resp.Model; model != nil { + m := *model + if ds, ok := m.(dataset.ADLSGen2FileDataSet); ok { + props := ds.Properties + d.Set("storage_account_id", storageParsers.NewStorageAccountID(props.SubscriptionId, props.ResourceGroup, props.StorageAccountName).ID()) d.Set("file_system_name", props.FileSystem) d.Set("file_path", props.FilePath) - d.Set("display_name", props.DataSetID) - } - - case datashare.ADLSGen2FolderDataSet: - if props := resp.ADLSGen2FolderProperties; props != nil { - d.Set("storage_account_id", fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s", *props.SubscriptionID, *props.ResourceGroup, *props.StorageAccountName)) + d.Set("display_name", props.DataSetId) + } else if ds, ok := m.(dataset.ADLSGen2FolderDataSet); ok { + props := ds.Properties + d.Set("storage_account_id", storageParsers.NewStorageAccountID(props.SubscriptionId, props.ResourceGroup, props.StorageAccountName).ID()) d.Set("file_system_name", props.FileSystem) d.Set("folder_path", props.FolderPath) - d.Set("display_name", props.DataSetID) - } - - case datashare.ADLSGen2FileSystemDataSet: - if props := resp.ADLSGen2FileSystemProperties; props != nil { - d.Set("storage_account_id", fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s", *props.SubscriptionID, *props.ResourceGroup, *props.StorageAccountName)) + d.Set("display_name", props.DataSetId) + } else if ds, ok := m.(dataset.ADLSGen2FileSystemDataSet); ok { + props := ds.Properties + d.Set("storage_account_id", storageParsers.NewStorageAccountID(props.SubscriptionId, props.ResourceGroup, props.StorageAccountName).ID()) d.Set("file_system_name", props.FileSystem) - d.Set("display_name", props.DataSetID) + d.Set("display_name", props.DataSetId) + } else { + return fmt.Errorf("%s is not a datalake store gen2 dataset", *id) } - - default: - return fmt.Errorf("data share dataset %q (Resource Group %q / accountName %q / shareName %q) is not a datalake store gen2 dataset", id.Name, id.ResourceGroup, id.AccountName, id.ShareName) } - return nil } @@ -226,18 +210,13 @@ func resourceDataShareDataSetDataLakeGen2Delete(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DataSetID(d.Id()) + id, err := dataset.ParseDataSetID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) - if err != nil { - return fmt.Errorf("deleting DataShare DataSet %q (Resource Group %q / accountName %q / shareName %q): %+v", id.Name, id.ResourceGroup, id.AccountName, id.ShareName, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of DataShare Data Lake Gen2 DataSet %q (Resource Group %q / accountName %q / shareName %q): %+v", id.Name, id.ResourceGroup, id.AccountName, id.ShareName, err) + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/internal/services/datashare/data_share_dataset_data_lake_gen2_resource_test.go b/internal/services/datashare/data_share_dataset_data_lake_gen2_resource_test.go index 14db893afb43..1a32788f2da7 100644 --- a/internal/services/datashare/data_share_dataset_data_lake_gen2_resource_test.go +++ b/internal/services/datashare/data_share_dataset_data_lake_gen2_resource_test.go @@ -5,11 +5,10 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -80,81 +79,83 @@ func TestAccDataShareDataLakeGen2DataSet_requiresImport(t *testing.T) { } func (t DataShareDataSetDataLakeGen2Resource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DataSetID(state.ID) + id, err := dataset.ParseDataSetID(state.ID) if err != nil { return nil, err } - resp, err := clients.DataShare.DataSetClient.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + resp, err := clients.DataShare.DataSetClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Data Share Data Set %q (resource group: %q): %+v", id.Name, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - switch resp := resp.Value.(type) { - case datashare.ADLSGen2FileDataSet: - return utils.Bool(resp.ADLSGen2FileProperties != nil), nil - - case datashare.ADLSGen2FolderDataSet: - return utils.Bool(resp.ADLSGen2FolderProperties != nil), nil - - case datashare.ADLSGen2FileSystemDataSet: - return utils.Bool(resp.ADLSGen2FileSystemProperties != nil), nil + if model := resp.Model; model != nil { + ds := *model + if _, ok := ds.(dataset.ADLSGen2FileDataSet); ok { + return utils.Bool(true), nil + } + if _, ok := ds.(dataset.ADLSGen2FolderDataSet); ok { + return utils.Bool(true), nil + } + if _, ok := ds.(dataset.ADLSGen2FileSystemDataSet); ok { + return utils.Bool(true), nil + } } - return nil, fmt.Errorf("Data Share Data %q (Resource Group %q / accountName %q / shareName %q) is not a datalake store gen2 dataset", id.Name, id.ResourceGroup, id.AccountName, id.ShareName) + return nil, fmt.Errorf("%s is not a datalake store gen2 dataset", *id) } func (DataShareDataSetDataLakeGen2Resource) template(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { - features {} + features {} } provider "azuread" { } resource "azurerm_resource_group" "test" { - name = "acctestRG-datashare-%[1]d" - location = "%[2]s" + name = "acctestRG-datashare-%[1]d" + location = "%[2]s" } resource "azurerm_data_share_account" "test" { - name = "acctest-dsa-%[1]d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - identity { - type = "SystemAssigned" - } + name = "acctest-dsa-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + identity { + type = "SystemAssigned" + } } resource "azurerm_data_share" "test" { - name = "acctest_ds_%[1]d" - account_id = azurerm_data_share_account.test.id - kind = "CopyBased" + name = "acctest_ds_%[1]d" + account_id = azurerm_data_share_account.test.id + kind = "CopyBased" } resource "azurerm_storage_account" "test" { - name = "accteststr%[3]s" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - account_kind = "BlobStorage" - account_tier = "Standard" - account_replication_type = "LRS" + name = "accteststr%[3]s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_kind = "BlobStorage" + account_tier = "Standard" + account_replication_type = "LRS" } resource "azurerm_storage_data_lake_gen2_filesystem" "test" { - name = "acctest-%[1]d" - storage_account_id = azurerm_storage_account.test.id + name = "acctest-%[1]d" + storage_account_id = azurerm_storage_account.test.id } data "azuread_service_principal" "test" { - display_name = azurerm_data_share_account.test.name + display_name = azurerm_data_share_account.test.name } resource "azurerm_role_assignment" "test" { - scope = azurerm_storage_account.test.id - role_definition_name = "Storage Blob Data Reader" - principal_id = data.azuread_service_principal.test.object_id + scope = azurerm_storage_account.test.id + role_definition_name = "Storage Blob Data Reader" + principal_id = data.azuread_service_principal.test.object_id } `, data.RandomInteger, data.Locations.Primary, data.RandomString) } @@ -164,14 +165,14 @@ func (r DataShareDataSetDataLakeGen2Resource) basicFile(data acceptance.TestData %s resource "azurerm_data_share_dataset_data_lake_gen2" "test" { - name = "acctest-dlds-%d" - share_id = azurerm_data_share.test.id - storage_account_id = azurerm_storage_account.test.id - file_system_name = azurerm_storage_data_lake_gen2_filesystem.test.name - file_path = "myfile.txt" - depends_on = [ - azurerm_role_assignment.test, - ] + name = "acctest-dlds-%d" + share_id = azurerm_data_share.test.id + storage_account_id = azurerm_storage_account.test.id + file_system_name = azurerm_storage_data_lake_gen2_filesystem.test.name + file_path = "myfile.txt" + depends_on = [ + azurerm_role_assignment.test, + ] } `, r.template(data), data.RandomInteger) } @@ -181,14 +182,14 @@ func (r DataShareDataSetDataLakeGen2Resource) basicFolder(data acceptance.TestDa %s resource "azurerm_data_share_dataset_data_lake_gen2" "test" { - name = "acctest-dlds-%d" - share_id = azurerm_data_share.test.id - storage_account_id = azurerm_storage_account.test.id - file_system_name = azurerm_storage_data_lake_gen2_filesystem.test.name - folder_path = "test" - depends_on = [ - azurerm_role_assignment.test, - ] + name = "acctest-dlds-%d" + share_id = azurerm_data_share.test.id + storage_account_id = azurerm_storage_account.test.id + file_system_name = azurerm_storage_data_lake_gen2_filesystem.test.name + folder_path = "test" + depends_on = [ + azurerm_role_assignment.test, + ] } `, r.template(data), data.RandomInteger) } @@ -198,13 +199,13 @@ func (r DataShareDataSetDataLakeGen2Resource) basicSystem(data acceptance.TestDa %s resource "azurerm_data_share_dataset_data_lake_gen2" "test" { - name = "acctest-dlds-%d" - share_id = azurerm_data_share.test.id - storage_account_id = azurerm_storage_account.test.id - file_system_name = azurerm_storage_data_lake_gen2_filesystem.test.name - depends_on = [ - azurerm_role_assignment.test, - ] + name = "acctest-dlds-%d" + share_id = azurerm_data_share.test.id + storage_account_id = azurerm_storage_account.test.id + file_system_name = azurerm_storage_data_lake_gen2_filesystem.test.name + depends_on = [ + azurerm_role_assignment.test, + ] } `, r.template(data), data.RandomInteger) } @@ -214,11 +215,11 @@ func (r DataShareDataSetDataLakeGen2Resource) requiresImport(data acceptance.Tes %s resource "azurerm_data_share_dataset_data_lake_gen2" "import" { - name = azurerm_data_share_dataset_data_lake_gen2.test.name - share_id = azurerm_data_share.test.id - storage_account_id = azurerm_data_share_dataset_data_lake_gen2.test.storage_account_id - file_system_name = azurerm_data_share_dataset_data_lake_gen2.test.file_system_name - file_path = azurerm_data_share_dataset_data_lake_gen2.test.file_path + name = azurerm_data_share_dataset_data_lake_gen2.test.name + share_id = azurerm_data_share.test.id + storage_account_id = azurerm_data_share_dataset_data_lake_gen2.test.storage_account_id + file_system_name = azurerm_data_share_dataset_data_lake_gen2.test.file_system_name + file_path = azurerm_data_share_dataset_data_lake_gen2.test.file_path } `, r.basicFile(data)) } diff --git a/internal/services/datashare/data_share_dataset_kusto_cluster_data_source.go b/internal/services/datashare/data_share_dataset_kusto_cluster_data_source.go index 788e40b05e0f..e3966821f2c5 100644 --- a/internal/services/datashare/data_share_dataset_kusto_cluster_data_source.go +++ b/internal/services/datashare/data_share_dataset_kusto_cluster_data_source.go @@ -4,9 +4,9 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/helper" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -30,7 +30,7 @@ func dataSourceDataShareDatasetKustoCluster() *pluginsdk.Resource { "share_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validate.ShareID, + ValidateFunc: share.ValidateShareID, }, "kusto_cluster_id": { @@ -56,34 +56,32 @@ func dataSourceDataShareDatasetKustoClusterRead(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - shareId, err := parse.ShareID(d.Get("share_id").(string)) + shareId, err := share.ParseShareID(d.Get("share_id").(string)) if err != nil { return err } - id := parse.NewDataSetID(shareId.SubscriptionId, shareId.ResourceGroup, shareId.AccountName, shareId.Name, d.Get("name").(string)) + id := dataset.NewDataSetID(shareId.SubscriptionId, shareId.ResourceGroupName, shareId.AccountName, shareId.ShareName, d.Get("name").(string)) - respModel, err := client.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { return fmt.Errorf("retrieving %s: %+v", id, err) } - respId := helper.GetAzurermDataShareDataSetId(respModel.Value) - if respId == nil || *respId == "" { - return fmt.Errorf("empty or nil ID returned for %s", id) - } - d.SetId(id.ID()) - d.Set("name", id.Name) + d.Set("name", id.DataSetName) d.Set("share_id", shareId.ID()) - resp, ok := respModel.Value.AsKustoClusterDataSet() - if !ok { - return fmt.Errorf("%s is not kusto cluster dataset", id) - } - if props := resp.KustoClusterDataSetProperties; props != nil { - d.Set("kusto_cluster_id", props.KustoClusterResourceID) - d.Set("display_name", props.DataSetID) - d.Set("kusto_cluster_location", props.Location) + if model := resp.Model; model != nil { + m := *model + if ds, ok := m.(dataset.KustoClusterDataSet); ok { + props := ds.Properties + // TODO parse kusto id + d.Set("kusto_cluster_id", props.KustoClusterResourceId) + d.Set("display_name", props.DataSetId) + d.Set("kusto_cluster_location", props.Location) + } else { + return fmt.Errorf("%s is not kusto cluster dataset", id) + } } return nil diff --git a/internal/services/datashare/data_share_dataset_kusto_cluster_data_source_test.go b/internal/services/datashare/data_share_dataset_kusto_cluster_data_source_test.go index a6512fa9c974..8d239c6c0eae 100644 --- a/internal/services/datashare/data_share_dataset_kusto_cluster_data_source_test.go +++ b/internal/services/datashare/data_share_dataset_kusto_cluster_data_source_test.go @@ -31,8 +31,8 @@ func (DataShareKustoClusterDatasetDataSource) basic(data acceptance.TestData) st %s data "azurerm_data_share_dataset_kusto_cluster" "test" { - name = azurerm_data_share_dataset_kusto_cluster.test.name - share_id = azurerm_data_share_dataset_kusto_cluster.test.share_id + name = azurerm_data_share_dataset_kusto_cluster.test.name + share_id = azurerm_data_share_dataset_kusto_cluster.test.share_id } `, ShareKustoClusterDataSetResource{}.basic(data)) } diff --git a/internal/services/datashare/data_share_dataset_kusto_cluster_resource.go b/internal/services/datashare/data_share_dataset_kusto_cluster_resource.go index dec41556b965..628917225eb9 100644 --- a/internal/services/datashare/data_share_dataset_kusto_cluster_resource.go +++ b/internal/services/datashare/data_share_dataset_kusto_cluster_resource.go @@ -5,16 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/helper" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceDataShareDataSetKustoCluster() *pluginsdk.Resource { @@ -30,7 +29,7 @@ func resourceDataShareDataSetKustoCluster() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DataSetID(id) + _, err := dataset.ParseDataSetID(id) return err }), @@ -46,7 +45,7 @@ func resourceDataShareDataSetKustoCluster() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ShareID, + ValidateFunc: share.ValidateShareID, }, "kusto_cluster_id": { @@ -74,31 +73,29 @@ func resourceDataShareDataSetKustoClusterCreate(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - shareId, err := parse.ShareID(d.Get("share_id").(string)) + shareId, err := share.ParseShareID(d.Get("share_id").(string)) if err != nil { return err } - id := parse.NewDataSetID(shareId.SubscriptionId, shareId.ResourceGroup, shareId.AccountName, shareId.Name, d.Get("name").(string)) + id := dataset.NewDataSetID(shareId.SubscriptionId, shareId.ResourceGroupName, shareId.AccountName, shareId.ShareName, d.Get("name").(string)) - existingModel, err := client.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existingModel.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - existingId := helper.GetAzurermDataShareDataSetId(existingModel.Value) - if existingId != nil && *existingId != "" { - return tf.ImportAsExistsError("azurerm_data_share_dataset_kusto_cluster", *existingId) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_data_share_dataset_kusto_cluster", id.ID()) } - dataSet := datashare.KustoClusterDataSet{ - Kind: datashare.KindKustoCluster, - KustoClusterDataSetProperties: &datashare.KustoClusterDataSetProperties{ - KustoClusterResourceID: utils.String(d.Get("kusto_cluster_id").(string)), + dataSet := dataset.KustoClusterDataSet{ + Properties: dataset.KustoClusterDataSetProperties{ + KustoClusterResourceId: d.Get("kusto_cluster_id").(string), }, } - if _, err := client.Create(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name, dataSet); err != nil { + if _, err := client.Create(ctx, id, dataSet); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -108,46 +105,42 @@ func resourceDataShareDataSetKustoClusterCreate(d *pluginsdk.ResourceData, meta func resourceDataShareDataSetKustoClusterRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).DataShare.DataSetClient - shareClient := meta.(*clients.Client).DataShare.SharesClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DataSetID(d.Id()) + id, err := dataset.ParseDataSetID(d.Id()) if err != nil { return err } - respModel, err := client.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(respModel.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] DataShare %q does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("retrieving DataShare Kusto Cluster DataSet %q (Resource Group %q / accountName %q / shareName %q): %+v", id.Name, id.ResourceGroup, id.AccountName, id.ShareName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - shareResp, err := shareClient.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName) - if err != nil { - return fmt.Errorf("retrieving DataShare %q (Resource Group %q / accountName %q): %+v", id.ShareName, id.ResourceGroup, id.AccountName, err) - } - if shareResp.ID == nil || *shareResp.ID == "" { - return fmt.Errorf("empty or nil ID returned for DataShare %q (Resource Group %q / accountName %q)", id.ShareName, id.ResourceGroup, id.AccountName) - } + d.Set("name", id.DataSetName) - d.Set("share_id", shareResp.ID) + shareId := share.NewShareID(id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName) - resp, ok := respModel.Value.AsKustoClusterDataSet() - if !ok { - return fmt.Errorf("dataShare dataset %q (Resource Group %q / accountName %q / shareName %q) is not kusto cluster dataset", id.Name, id.ResourceGroup, id.AccountName, id.ShareName) - } - if props := resp.KustoClusterDataSetProperties; props != nil { - d.Set("kusto_cluster_id", props.KustoClusterResourceID) - d.Set("display_name", props.DataSetID) - d.Set("kusto_cluster_location", props.Location) - } + d.Set("share_id", shareId.ID()) + if model := resp.Model; model != nil { + m := *model + if ds, ok := m.(dataset.KustoClusterDataSet); ok { + props := ds.Properties + // TODO parse kusto id + d.Set("kusto_cluster_id", props.KustoClusterResourceId) + d.Set("display_name", props.DataSetId) + d.Set("kusto_cluster_location", props.Location) + } else { + return fmt.Errorf("%s is not kusto cluster dataset", *id) + } + } return nil } @@ -156,18 +149,13 @@ func resourceDataShareDataSetKustoClusterDelete(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DataSetID(d.Id()) + id, err := dataset.ParseDataSetID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) - if err != nil { - return fmt.Errorf("deleting DataShare Kusto Cluster DataSet %q (Resource Group %q / accountName %q / shareName %q): %+v", id.Name, id.ResourceGroup, id.AccountName, id.ShareName, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of DataShare Kusto Cluster DataSet %q (Resource Group %q / accountName %q / shareName %q): %+v", id.Name, id.ResourceGroup, id.AccountName, id.ShareName, err) + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/internal/services/datashare/data_share_dataset_kusto_cluster_resource_test.go b/internal/services/datashare/data_share_dataset_kusto_cluster_resource_test.go index dcc1925ebae0..0b5c22caed61 100644 --- a/internal/services/datashare/data_share_dataset_kusto_cluster_resource_test.go +++ b/internal/services/datashare/data_share_dataset_kusto_cluster_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -49,65 +49,67 @@ func TestAccDataShareKustoClusterDataSet_requiresImport(t *testing.T) { } func (t ShareKustoClusterDataSetResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DataSetID(state.ID) + id, err := dataset.ParseDataSetID(state.ID) if err != nil { return nil, err } - respRaw, err := clients.DataShare.DataSetClient.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + resp, err := clients.DataShare.DataSetClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Data Share Data Set %q (resource group: %q): %+v", id.Name, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - resp, ok := respRaw.Value.AsKustoClusterDataSet() - if !ok { - return nil, fmt.Errorf("Data Share Data Set %q (Resource Group %q / accountName %q) is not Kusto Database DataSet", id.ShareName, id.ResourceGroup, id.AccountName) + if model := resp.Model; model != nil { + ds := *model + if _, ok := ds.(dataset.KustoClusterDataSet); ok { + return utils.Bool(true), nil + } } - return utils.Bool(resp.KustoClusterDataSetProperties != nil), nil + return nil, fmt.Errorf("%s is not a kusto cluster dataset", *id) } func (ShareKustoClusterDataSetResource) template(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { - features {} + features {} } resource "azurerm_resource_group" "test" { - name = "acctestRG-datashare-%[1]d" - location = "%[2]s" + name = "acctestRG-datashare-%[1]d" + location = "%[2]s" } resource "azurerm_data_share_account" "test" { - name = "acctest-DSA-%[1]d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - identity { - type = "SystemAssigned" - } + name = "acctest-DSA-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + identity { + type = "SystemAssigned" + } } resource "azurerm_data_share" "test" { - name = "acctest_DS_%[1]d" - account_id = azurerm_data_share_account.test.id - kind = "InPlace" + name = "acctest_DS_%[1]d" + account_id = azurerm_data_share_account.test.id + kind = "InPlace" } resource "azurerm_kusto_cluster" "test" { - name = "acctestkc%[3]s" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - - sku { - name = "Dev(No SLA)_Standard_D11_v2" - capacity = 1 - } + name = "acctestkc%[3]s" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + sku { + name = "Dev(No SLA)_Standard_D11_v2" + capacity = 1 + } } resource "azurerm_role_assignment" "test" { - scope = azurerm_kusto_cluster.test.id - role_definition_name = "Contributor" - principal_id = azurerm_data_share_account.test.identity.0.principal_id + scope = azurerm_kusto_cluster.test.id + role_definition_name = "Contributor" + principal_id = azurerm_data_share_account.test.identity.0.principal_id } `, data.RandomInteger, data.Locations.Primary, data.RandomString) } @@ -117,12 +119,12 @@ func (r ShareKustoClusterDataSetResource) basic(data acceptance.TestData) string %s resource "azurerm_data_share_dataset_kusto_cluster" "test" { - name = "acctest-DSKC-%d" - share_id = azurerm_data_share.test.id - kusto_cluster_id = azurerm_kusto_cluster.test.id - depends_on = [ - azurerm_role_assignment.test, - ] + name = "acctest-DSKC-%d" + share_id = azurerm_data_share.test.id + kusto_cluster_id = azurerm_kusto_cluster.test.id + depends_on = [ + azurerm_role_assignment.test, + ] } `, r.template(data), data.RandomInteger) } @@ -132,9 +134,9 @@ func (r ShareKustoClusterDataSetResource) requiresImport(data acceptance.TestDat %s resource "azurerm_data_share_dataset_kusto_cluster" "import" { - name = azurerm_data_share_dataset_kusto_cluster.test.name - share_id = azurerm_data_share.test.id - kusto_cluster_id = azurerm_kusto_cluster.test.id + name = azurerm_data_share_dataset_kusto_cluster.test.name + share_id = azurerm_data_share.test.id + kusto_cluster_id = azurerm_kusto_cluster.test.id } `, r.basic(data)) } diff --git a/internal/services/datashare/data_share_dataset_kusto_database_data_source.go b/internal/services/datashare/data_share_dataset_kusto_database_data_source.go index af17117cf47c..30c4f1d00776 100644 --- a/internal/services/datashare/data_share_dataset_kusto_database_data_source.go +++ b/internal/services/datashare/data_share_dataset_kusto_database_data_source.go @@ -4,9 +4,9 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/helper" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -30,7 +30,7 @@ func dataSourceDataShareDatasetKustoDatabase() *pluginsdk.Resource { "share_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validate.ShareID, + ValidateFunc: share.ValidateShareID, }, "kusto_database_id": { @@ -57,34 +57,31 @@ func dataSourceDataShareDatasetKustoDatabaseRead(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - shareId, err := parse.ShareID(d.Get("share_id").(string)) + shareId, err := share.ParseShareID(d.Get("share_id").(string)) if err != nil { return err } - id := parse.NewDataSetID(subscriptionId, shareId.ResourceGroup, shareId.AccountName, shareId.Name, d.Get("name").(string)) + id := dataset.NewDataSetID(subscriptionId, shareId.ResourceGroupName, shareId.AccountName, shareId.ShareName, d.Get("name").(string)) - respModel, err := client.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { return fmt.Errorf("retrieving %s: %+v", id, err) } - respId := helper.GetAzurermDataShareDataSetId(respModel.Value) - if respId == nil || *respId == "" { - return fmt.Errorf("empty or nil ID returned for %s", id) - } - d.SetId(id.ID()) - d.Set("name", id.Name) + d.Set("name", id.DataSetName) d.Set("share_id", shareId.ID()) - resp, ok := respModel.Value.AsKustoDatabaseDataSet() - if !ok { - return fmt.Errorf("%s is not kusto database dataset", id) - } - if props := resp.KustoDatabaseDataSetProperties; props != nil { - d.Set("kusto_database_id", props.KustoDatabaseResourceID) - d.Set("display_name", props.DataSetID) - d.Set("kusto_cluster_location", props.Location) + if model := resp.Model; model != nil { + m := *model + if ds, ok := m.(dataset.KustoDatabaseDataSet); ok { + props := ds.Properties + d.Set("kusto_database_id", props.KustoDatabaseResourceId) + d.Set("display_name", props.DataSetId) + d.Set("kusto_cluster_location", props.Location) + } else { + return fmt.Errorf("%s is not kusto database dataset", id) + } } return nil diff --git a/internal/services/datashare/data_share_dataset_kusto_database_data_source_test.go b/internal/services/datashare/data_share_dataset_kusto_database_data_source_test.go index 4dc18b36d7e8..34f6c457ed13 100644 --- a/internal/services/datashare/data_share_dataset_kusto_database_data_source_test.go +++ b/internal/services/datashare/data_share_dataset_kusto_database_data_source_test.go @@ -31,8 +31,8 @@ func (DataShareDatasetKustoDatabaseDataSource) basic(data acceptance.TestData) s %s data "azurerm_data_share_dataset_kusto_database" "test" { - name = azurerm_data_share_dataset_kusto_database.test.name - share_id = azurerm_data_share_dataset_kusto_database.test.share_id + name = azurerm_data_share_dataset_kusto_database.test.name + share_id = azurerm_data_share_dataset_kusto_database.test.share_id } `, DataShareDataSetKustoDatabaseResource{}.basic(data)) } diff --git a/internal/services/datashare/data_share_dataset_kusto_database_resource.go b/internal/services/datashare/data_share_dataset_kusto_database_resource.go index 5083e0e214dd..c8face0bacf7 100644 --- a/internal/services/datashare/data_share_dataset_kusto_database_resource.go +++ b/internal/services/datashare/data_share_dataset_kusto_database_resource.go @@ -5,16 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/helper" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceDataShareDataSetKustoDatabase() *pluginsdk.Resource { @@ -30,7 +29,7 @@ func resourceDataShareDataSetKustoDatabase() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DataSetID(id) + _, err := dataset.ParseDataSetID(id) return err }), @@ -46,7 +45,7 @@ func resourceDataShareDataSetKustoDatabase() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ShareID, + ValidateFunc: share.ValidateShareID, }, "kusto_database_id": { @@ -74,31 +73,29 @@ func resourceDataShareDataSetKustoDatabaseCreate(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - shareId, err := parse.ShareID(d.Get("share_id").(string)) + shareId, err := share.ParseShareID(d.Get("share_id").(string)) if err != nil { return err } - id := parse.NewDataSetID(shareId.SubscriptionId, shareId.ResourceGroup, shareId.AccountName, shareId.Name, d.Get("name").(string)) + id := dataset.NewDataSetID(shareId.SubscriptionId, shareId.ResourceGroupName, shareId.AccountName, shareId.ShareName, d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for present of existing %s: %+v", id, err) } } - existingId := helper.GetAzurermDataShareDataSetId(existing.Value) - if existingId != nil && *existingId != "" { - return tf.ImportAsExistsError("azurerm_data_share_dataset_kusto_database", *existingId) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_data_share_dataset_kusto_database", id.ID()) } - dataSet := datashare.KustoDatabaseDataSet{ - Kind: datashare.KindKustoDatabase, - KustoDatabaseDataSetProperties: &datashare.KustoDatabaseDataSetProperties{ - KustoDatabaseResourceID: utils.String(d.Get("kusto_database_id").(string)), + dataSet := dataset.KustoDatabaseDataSet{ + Properties: dataset.KustoDatabaseDataSetProperties{ + KustoDatabaseResourceId: d.Get("kusto_database_id").(string), }, } - if _, err := client.Create(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name, dataSet); err != nil { + if _, err := client.Create(ctx, id, dataSet); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -112,34 +109,36 @@ func resourceDataShareDataSetKustoDatabaseRead(d *pluginsdk.ResourceData, meta i ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DataSetID(d.Id()) + id, err := dataset.ParseDataSetID(d.Id()) if err != nil { return err } - respModel, err := client.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(respModel.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] DataShare %q does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("retrieving DataShare Kusto Database DataSet %q (Resource Group %q / accountName %q / shareName %q): %+v", id.Name, id.ResourceGroup, id.AccountName, id.ShareName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) + d.Set("name", id.DataSetName) - shareId := parse.NewShareID(id.SubscriptionId, id.ResourceGroup, id.AccountName, id.ShareName) + shareId := share.NewShareID(id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName) d.Set("share_id", shareId.ID()) - resp, ok := respModel.Value.AsKustoDatabaseDataSet() - if !ok { - return fmt.Errorf("dataShare %q (Resource Group %q / accountName %q) is not Kusto Database DataSet", id.ShareName, id.ResourceGroup, id.AccountName) - } - if props := resp.KustoDatabaseDataSetProperties; props != nil { - d.Set("kusto_database_id", props.KustoDatabaseResourceID) - d.Set("display_name", props.DataSetID) - d.Set("kusto_cluster_location", props.Location) + if model := resp.Model; model != nil { + m := *model + if ds, ok := m.(dataset.KustoDatabaseDataSet); ok { + props := ds.Properties + d.Set("kusto_database_id", props.KustoDatabaseResourceId) + d.Set("display_name", props.DataSetId) + d.Set("kusto_cluster_location", props.Location) + } else { + return fmt.Errorf("%s is not kusto database dataset", *id) + } } return nil @@ -150,18 +149,13 @@ func resourceDataShareDataSetKustoDatabaseDelete(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DataSetID(d.Id()) + id, err := dataset.ParseDataSetID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) - if err != nil { - return fmt.Errorf("deleting DataShare Kusto Database DataSet %q (Resource Group %q / accountName %q / shareName %q): %+v", id.Name, id.ResourceGroup, id.AccountName, id.ShareName, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of DataShare Kusto Database DataSet %q (Resource Group %q / accountName %q / shareName %q): %+v", id.Name, id.ResourceGroup, id.AccountName, id.ShareName, err) + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/internal/services/datashare/data_share_dataset_kusto_database_resource_test.go b/internal/services/datashare/data_share_dataset_kusto_database_resource_test.go index 3da781d11291..398dd708926a 100644 --- a/internal/services/datashare/data_share_dataset_kusto_database_resource_test.go +++ b/internal/services/datashare/data_share_dataset_kusto_database_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -48,72 +48,74 @@ func TestAccDataShareDataSetKustoDatabase_requiresImport(t *testing.T) { } func (t DataShareDataSetKustoDatabaseResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DataSetID(state.ID) + id, err := dataset.ParseDataSetID(state.ID) if err != nil { return nil, err } - respRaw, err := clients.DataShare.DataSetClient.Get(ctx, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) + resp, err := clients.DataShare.DataSetClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Data Share Data Set %q (resource group: %q): %+v", id.Name, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - resp, ok := respRaw.Value.AsKustoDatabaseDataSet() - if !ok { - return nil, fmt.Errorf("Data Share Data Set %q (Resource Group %q / accountName %q) is not Kusto Database DataSet", id.ShareName, id.ResourceGroup, id.AccountName) + if model := resp.Model; model != nil { + ds := *model + if _, ok := ds.(dataset.KustoDatabaseDataSet); ok { + return utils.Bool(true), nil + } } - return utils.Bool(resp.KustoDatabaseDataSetProperties != nil), nil + return nil, fmt.Errorf("%s is not a kusto database dataset", *id) } func (DataShareDataSetKustoDatabaseResource) template(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { - features {} + features {} } resource "azurerm_resource_group" "test" { - name = "acctestRG-datashare-%[1]d" - location = "%[2]s" + name = "acctestRG-datashare-%[1]d" + location = "%[2]s" } resource "azurerm_data_share_account" "test" { - name = "acctest-DSA-%[1]d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - identity { - type = "SystemAssigned" - } + name = "acctest-DSA-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + identity { + type = "SystemAssigned" + } } resource "azurerm_data_share" "test" { - name = "acctest_DS_%[1]d" - account_id = azurerm_data_share_account.test.id - kind = "InPlace" + name = "acctest_DS_%[1]d" + account_id = azurerm_data_share_account.test.id + kind = "InPlace" } resource "azurerm_kusto_cluster" "test" { - name = "acctestkc%[3]s" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - - sku { - name = "Dev(No SLA)_Standard_D11_v2" - capacity = 1 - } + name = "acctestkc%[3]s" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + sku { + name = "Dev(No SLA)_Standard_D11_v2" + capacity = 1 + } } resource "azurerm_kusto_database" "test" { - name = "acctestKD-%[1]d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - cluster_name = azurerm_kusto_cluster.test.name + name = "acctestKD-%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + cluster_name = azurerm_kusto_cluster.test.name } resource "azurerm_role_assignment" "test" { - scope = azurerm_kusto_cluster.test.id - role_definition_name = "Contributor" - principal_id = azurerm_data_share_account.test.identity.0.principal_id + scope = azurerm_kusto_cluster.test.id + role_definition_name = "Contributor" + principal_id = azurerm_data_share_account.test.identity.0.principal_id } `, data.RandomInteger, data.Locations.Primary, data.RandomString) } @@ -123,12 +125,12 @@ func (r DataShareDataSetKustoDatabaseResource) basic(data acceptance.TestData) s %s resource "azurerm_data_share_dataset_kusto_database" "test" { - name = "acctest-DSKD-%d" - share_id = azurerm_data_share.test.id - kusto_database_id = azurerm_kusto_database.test.id - depends_on = [ - azurerm_role_assignment.test, - ] + name = "acctest-DSKD-%d" + share_id = azurerm_data_share.test.id + kusto_database_id = azurerm_kusto_database.test.id + depends_on = [ + azurerm_role_assignment.test, + ] } `, r.template(data), data.RandomInteger) } @@ -138,9 +140,9 @@ func (r DataShareDataSetKustoDatabaseResource) requiresImport(data acceptance.Te %s resource "azurerm_data_share_dataset_kusto_database" "import" { - name = azurerm_data_share_dataset_kusto_database.test.name - share_id = azurerm_data_share.test.id - kusto_database_id = azurerm_kusto_database.test.id + name = azurerm_data_share_dataset_kusto_database.test.name + share_id = azurerm_data_share.test.id + kusto_database_id = azurerm_kusto_database.test.id } `, r.basic(data)) } diff --git a/internal/services/datashare/data_share_resource.go b/internal/services/datashare/data_share_resource.go index cd0899d8ef37..e704ea4aa5e5 100644 --- a/internal/services/datashare/data_share_resource.go +++ b/internal/services/datashare/data_share_resource.go @@ -5,11 +5,14 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare" // nolint: staticcheck "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -33,7 +36,7 @@ func resourceDataShare() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ShareID(id) + _, err := share.ParseShareID(id) return err }), @@ -49,7 +52,7 @@ func resourceDataShare() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.AccountID, + ValidateFunc: account.ValidateAccountID, }, "kind": { @@ -57,8 +60,8 @@ func resourceDataShare() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(datashare.CopyBased), - string(datashare.InPlace), + string(share.ShareKindCopyBased), + string(share.ShareKindInPlace), }, false), }, @@ -83,8 +86,8 @@ func resourceDataShare() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(datashare.Day), - string(datashare.Hour), + string(synchronizationsetting.RecurrenceIntervalDay), + string(synchronizationsetting.RecurrenceIntervalHour), }, false), }, @@ -114,37 +117,37 @@ func resourceDataShareCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) defer cancel() name := d.Get("name").(string) - accountId, err := parse.AccountID(d.Get("account_id").(string)) + accountId, err := account.ParseAccountID(d.Get("account_id").(string)) if err != nil { return err } - resourceId := parse.NewShareID(subscriptionId, accountId.ResourceGroup, accountId.Name, name) + id := share.NewShareID(subscriptionId, accountId.ResourceGroupName, accountId.AccountName, name) if d.IsNewResource() { - existing, err := client.Get(ctx, accountId.ResourceGroup, accountId.Name, name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for present of existing DataShare %q (Resource Group %q / accountName %q): %+v", name, accountId.ResourceGroup, accountId.Name, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_data_share", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_data_share", id.ID()) } } - share := datashare.Share{ - ShareProperties: &datashare.ShareProperties{ - ShareKind: datashare.ShareKind(d.Get("kind").(string)), + share := share.Share{ + Properties: &share.ShareProperties{ + ShareKind: pointer.To(share.ShareKind(d.Get("kind").(string))), Description: utils.String(d.Get("description").(string)), Terms: utils.String(d.Get("terms").(string)), }, } - if _, err := client.Create(ctx, accountId.ResourceGroup, accountId.Name, name, share); err != nil { - return fmt.Errorf("creating Data Share %q (Account %q / Resource Group %q): %+v", name, accountId.Name, accountId.ResourceGroup, err) + if _, err := client.Create(ctx, id, share); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) if d.HasChange("snapshot_schedule") { // only one dependent sync setting is allowed in one data share @@ -152,20 +155,18 @@ func resourceDataShareCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) if origins := o.([]interface{}); len(origins) > 0 { origin := origins[0].(map[string]interface{}) if originName, ok := origin["name"].(string); ok && originName != "" { - future, err := syncClient.Delete(ctx, accountId.ResourceGroup, accountId.Name, name, originName) - if err != nil { - return fmt.Errorf("deleting DataShare %q snapshot schedule (Resource Group %q / accountName %q): %+v", name, accountId.ResourceGroup, accountId.Name, err) - } - if err = future.WaitForCompletionRef(ctx, syncClient.Client); err != nil { - return fmt.Errorf("waiting for DataShare %q snapshot schedule (Resource Group %q / accountName %q) to be deleted: %+v", name, accountId.ResourceGroup, accountId.Name, err) + syncId := synchronizationsetting.NewSynchronizationSettingID(id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName, originName) + if err := syncClient.DeleteThenPoll(ctx, syncId); err != nil { + return fmt.Errorf("deleting datashare snapshot schedule %s: %+v", syncId, err) } } } } if snapshotSchedule := expandAzureRmDataShareSnapshotSchedule(d.Get("snapshot_schedule").([]interface{})); snapshotSchedule != nil { - if _, err := syncClient.Create(ctx, accountId.ResourceGroup, accountId.Name, name, d.Get("snapshot_schedule.0.name").(string), snapshotSchedule); err != nil { - return fmt.Errorf("creating DataShare %q snapshot schedule (Resource Group %q / accountName %q): %+v", name, accountId.ResourceGroup, accountId.Name, err) + syncId := synchronizationsetting.NewSynchronizationSettingID(id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName, d.Get("snapshot_schedule.0.name").(string)) + if _, err := syncClient.Create(ctx, syncId, snapshotSchedule); err != nil { + return fmt.Errorf("creating datashare snapshot schedule %s: %+v", syncId, err) } } @@ -179,45 +180,42 @@ func resourceDataShareRead(d *pluginsdk.ResourceData, meta interface{}) error { ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ShareID(d.Id()) + id, err := share.ParseShareID(d.Id()) if err != nil { return err } - dataShare, err := client.Get(ctx, id.ResourceGroup, id.AccountName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(dataShare.Response) { - log.Printf("[INFO] DataShare %q does not exist - removing from state", d.Id()) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("retrieving DataShare %q (Resource Group %q / accountName %q): %+v", id.Name, id.ResourceGroup, id.AccountName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - accountId := parse.NewAccountID(subscriptionId, id.ResourceGroup, id.AccountName) + accountId := account.NewAccountID(subscriptionId, id.ResourceGroupName, id.AccountName) - d.Set("name", id.Name) + d.Set("name", id.ShareName) d.Set("account_id", accountId.ID()) - if props := dataShare.ShareProperties; props != nil { - d.Set("kind", props.ShareKind) - d.Set("description", props.Description) - d.Set("terms", props.Terms) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("kind", props.ShareKind) + d.Set("description", props.Description) + d.Set("terms", props.Terms) + } } - settings := make([]datashare.ScheduledSynchronizationSetting, 0) - syncIterator, err := syncClient.ListByShareComplete(ctx, id.ResourceGroup, id.AccountName, id.Name, "") + settings := make([]synchronizationsetting.ScheduledSynchronizationSetting, 0) + snapshotSchedules, err := syncClient.ListByShareComplete(ctx, synchronizationsetting.NewShareID(id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName)) if err != nil { - return fmt.Errorf("listing Snapshot Schedules for Data Share %q (Account %q / Resource Group %q): %+v", id.Name, id.AccountName, id.ResourceGroup, err) + return fmt.Errorf("listing snapshot schedules for %s: %+v", *id, err) } - for syncIterator.NotDone() { - item, ok := syncIterator.Value().AsScheduledSynchronizationSetting() - if ok && item != nil { - settings = append(settings, *item) - } - - if err := syncIterator.NextWithContext(ctx); err != nil { - return fmt.Errorf("retrieving next Snapshot Schedule: %+v", err) + for _, item := range snapshotSchedules.Items { + if s, ok := item.(synchronizationsetting.ScheduledSynchronizationSetting); ok { + settings = append(settings, s) } } if err := d.Set("snapshot_schedule", flattenAzureRmDataShareSnapshotSchedule(settings)); err != nil { @@ -233,35 +231,27 @@ func resourceDataShareDelete(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ShareID(d.Id()) + id, err := share.ParseShareID(d.Id()) if err != nil { return err } // sync setting will not automatically be deleted after the data share is deleted if _, ok := d.GetOk("snapshot_schedule"); ok { - syncFuture, err := syncClient.Delete(ctx, id.ResourceGroup, id.AccountName, id.Name, d.Get("snapshot_schedule.0.name").(string)) - if err != nil { - return fmt.Errorf("deleting DataShare %q snapshot schedule (Resource Group %q / accountName %q): %+v", id.Name, id.ResourceGroup, id.AccountName, err) - } - if err = syncFuture.WaitForCompletionRef(ctx, syncClient.Client); err != nil { - return fmt.Errorf("waiting for DataShare %q snapshot schedule (Resource Group %q / accountName %q) to be deleted: %+v", id.Name, id.ResourceGroup, id.AccountName, err) + syncId := synchronizationsetting.NewSynchronizationSettingID(id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName, d.Get("snapshot_schedule.0.name").(string)) + if err := syncClient.DeleteThenPoll(ctx, syncId); err != nil { + return fmt.Errorf("deleting datashare snapshot schedule %s: %+v", syncId, err) } } - future, err := client.Delete(ctx, id.ResourceGroup, id.AccountName, id.Name) - if err != nil { - return fmt.Errorf("deleting DataShare %q (Resource Group %q / accountName %q): %+v", id.Name, id.ResourceGroup, id.AccountName, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for DataShare %q (Resource Group %q / accountName %q) to be deleted: %+v", id.Name, id.ResourceGroup, id.AccountName, err) + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } -func expandAzureRmDataShareSnapshotSchedule(input []interface{}) *datashare.ScheduledSynchronizationSetting { +func expandAzureRmDataShareSnapshotSchedule(input []interface{}) *synchronizationsetting.ScheduledSynchronizationSetting { if len(input) == 0 { return nil } @@ -270,33 +260,30 @@ func expandAzureRmDataShareSnapshotSchedule(input []interface{}) *datashare.Sche startTime, _ := time.Parse(time.RFC3339, snapshotSchedule["start_time"].(string)) - return &datashare.ScheduledSynchronizationSetting{ - Kind: datashare.KindBasicSynchronizationSettingKindScheduleBased, - ScheduledSynchronizationSettingProperties: &datashare.ScheduledSynchronizationSettingProperties{ - RecurrenceInterval: datashare.RecurrenceInterval(snapshotSchedule["recurrence"].(string)), - SynchronizationTime: &date.Time{Time: startTime}, + syncTime := date.Time{Time: startTime}.String() + + return &synchronizationsetting.ScheduledSynchronizationSetting{ + Properties: synchronizationsetting.ScheduledSynchronizationSettingProperties{ + RecurrenceInterval: synchronizationsetting.RecurrenceInterval(snapshotSchedule["recurrence"].(string)), + SynchronizationTime: syncTime, }, } } -func flattenAzureRmDataShareSnapshotSchedule(input []datashare.ScheduledSynchronizationSetting) []interface{} { +func flattenAzureRmDataShareSnapshotSchedule(input []synchronizationsetting.ScheduledSynchronizationSetting) []interface{} { output := make([]interface{}, 0) for _, setting := range input { + props := setting.Properties name := "" if setting.Name != nil { name = *setting.Name } - startTime := "" - if setting.SynchronizationTime != nil && !setting.SynchronizationTime.IsZero() { - startTime = setting.SynchronizationTime.Format(time.RFC3339) - } - output = append(output, map[string]interface{}{ "name": name, - "recurrence": string(setting.RecurrenceInterval), - "start_time": startTime, + "recurrence": string(props.RecurrenceInterval), + "start_time": props.SynchronizationTime, }) } diff --git a/internal/services/datashare/data_share_resource_test.go b/internal/services/datashare/data_share_resource_test.go index da7dd97f5dfa..e4f040a385ae 100644 --- a/internal/services/datashare/data_share_resource_test.go +++ b/internal/services/datashare/data_share_resource_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" + "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -128,17 +128,17 @@ func TestAccDataShare_snapshotSchedule(t *testing.T) { } func (t DataShareResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ShareID(state.ID) + id, err := share.ParseShareID(state.ID) if err != nil { return nil, err } - resp, err := clients.DataShare.SharesClient.Get(ctx, id.ResourceGroup, id.AccountName, id.Name) + resp, err := clients.DataShare.SharesClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Data Share %q (resource group: %q): %+v", id.Name, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ShareProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (DataShareResource) template(data acceptance.TestData) string { diff --git a/internal/services/datashare/helper/data_share.go b/internal/services/datashare/helper/data_share.go deleted file mode 100644 index 944944ef24e5..000000000000 --- a/internal/services/datashare/helper/data_share.go +++ /dev/null @@ -1,39 +0,0 @@ -package helper - -import ( - "github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare" // nolint: staticcheck -) - -func GetAzurermDataShareDataSetId(dataset datashare.BasicDataSet) *string { - if dataset == nil { - return nil - } - switch t := dataset.(type) { - case datashare.BlobDataSet: - return t.ID - case datashare.BlobFolderDataSet: - return t.ID - case datashare.BlobContainerDataSet: - return t.ID - case datashare.ADLSGen2FileDataSet: - return t.ID - case datashare.ADLSGen2FolderDataSet: - return t.ID - case datashare.ADLSGen2FileSystemDataSet: - return t.ID - case datashare.ADLSGen1FolderDataSet: - return t.ID - case datashare.ADLSGen1FileDataSet: - return t.ID - case datashare.KustoClusterDataSet: - return t.ID - case datashare.KustoDatabaseDataSet: - return t.ID - case datashare.SQLDWTableDataSet: - return t.ID - case datashare.SQLDBTableDataSet: - return t.ID - default: - return nil - } -} diff --git a/internal/services/datashare/parse/account.go b/internal/services/datashare/parse/account.go deleted file mode 100644 index 4b2bc4cf6623..000000000000 --- a/internal/services/datashare/parse/account.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type AccountId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewAccountID(subscriptionId, resourceGroup, name string) AccountId { - return AccountId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id AccountId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Account", segmentsStr) -} - -func (id AccountId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataShare/accounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// AccountID parses a Account ID into an AccountId struct -func AccountID(input string) (*AccountId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := AccountId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("accounts"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/datashare/parse/account_test.go b/internal/services/datashare/parse/account_test.go deleted file mode 100644 index 09534ec276b0..000000000000 --- a/internal/services/datashare/parse/account_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = AccountId{} - -func TestAccountIDFormatter(t *testing.T) { - actual := NewAccountID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *AccountId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1", - Expected: &AccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "account1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DATASHARE/ACCOUNTS/ACCOUNT1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := AccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/datashare/parse/data_set.go b/internal/services/datashare/parse/data_set.go deleted file mode 100644 index 396e72d6e6e1..000000000000 --- a/internal/services/datashare/parse/data_set.go +++ /dev/null @@ -1,81 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DataSetId struct { - SubscriptionId string - ResourceGroup string - AccountName string - ShareName string - Name string -} - -func NewDataSetID(subscriptionId, resourceGroup, accountName, shareName, name string) DataSetId { - return DataSetId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - AccountName: accountName, - ShareName: shareName, - Name: name, - } -} - -func (id DataSetId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Share Name %q", id.ShareName), - fmt.Sprintf("Account Name %q", id.AccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Data Set", segmentsStr) -} - -func (id DataSetId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataShare/accounts/%s/shares/%s/dataSets/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.AccountName, id.ShareName, id.Name) -} - -// DataSetID parses a DataSet ID into an DataSetId struct -func DataSetID(input string) (*DataSetId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DataSetId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.AccountName, err = id.PopSegment("accounts"); err != nil { - return nil, err - } - if resourceId.ShareName, err = id.PopSegment("shares"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("dataSets"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/datashare/parse/data_set_test.go b/internal/services/datashare/parse/data_set_test.go deleted file mode 100644 index 3c0f7298afe8..000000000000 --- a/internal/services/datashare/parse/data_set_test.go +++ /dev/null @@ -1,144 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = DataSetId{} - -func TestDataSetIDFormatter(t *testing.T) { - actual := NewDataSetID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1", "share1", "dataSet1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/share1/dataSets/dataSet1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestDataSetID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DataSetId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing AccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/", - Error: true, - }, - - { - // missing value for AccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/", - Error: true, - }, - - { - // missing ShareName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/", - Error: true, - }, - - { - // missing value for ShareName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/share1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/share1/dataSets/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/share1/dataSets/dataSet1", - Expected: &DataSetId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - AccountName: "account1", - ShareName: "share1", - Name: "dataSet1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DATASHARE/ACCOUNTS/ACCOUNT1/SHARES/SHARE1/DATASETS/DATASET1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DataSetID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.AccountName != v.Expected.AccountName { - t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) - } - if actual.ShareName != v.Expected.ShareName { - t.Fatalf("Expected %q but got %q for ShareName", v.Expected.ShareName, actual.ShareName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/datashare/parse/share.go b/internal/services/datashare/parse/share.go deleted file mode 100644 index 63301bd00047..000000000000 --- a/internal/services/datashare/parse/share.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ShareId struct { - SubscriptionId string - ResourceGroup string - AccountName string - Name string -} - -func NewShareID(subscriptionId, resourceGroup, accountName, name string) ShareId { - return ShareId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - AccountName: accountName, - Name: name, - } -} - -func (id ShareId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Account Name %q", id.AccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Share", segmentsStr) -} - -func (id ShareId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataShare/accounts/%s/shares/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.AccountName, id.Name) -} - -// ShareID parses a Share ID into an ShareId struct -func ShareID(input string) (*ShareId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ShareId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.AccountName, err = id.PopSegment("accounts"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("shares"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/datashare/parse/share_test.go b/internal/services/datashare/parse/share_test.go deleted file mode 100644 index 2c41011c7bb3..000000000000 --- a/internal/services/datashare/parse/share_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = ShareId{} - -func TestShareIDFormatter(t *testing.T) { - actual := NewShareID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1", "share1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/share1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestShareID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ShareId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing AccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/", - Error: true, - }, - - { - // missing value for AccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/share1", - Expected: &ShareId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - AccountName: "account1", - Name: "share1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DATASHARE/ACCOUNTS/ACCOUNT1/SHARES/SHARE1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ShareID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.AccountName != v.Expected.AccountName { - t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/datashare/resourceids.go b/internal/services/datashare/resourceids.go deleted file mode 100644 index b2f4275f4b08..000000000000 --- a/internal/services/datashare/resourceids.go +++ /dev/null @@ -1,5 +0,0 @@ -package datashare - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Account -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DataSet -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/share1/dataSets/dataSet1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Share -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/share1 diff --git a/internal/services/datashare/validate/account_id.go b/internal/services/datashare/validate/account_id.go deleted file mode 100644 index 1efdb3536788..000000000000 --- a/internal/services/datashare/validate/account_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" -) - -func AccountID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.AccountID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/datashare/validate/account_id_test.go b/internal/services/datashare/validate/account_id_test.go deleted file mode 100644 index f02bf1dd7da2..000000000000 --- a/internal/services/datashare/validate/account_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestAccountID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DATASHARE/ACCOUNTS/ACCOUNT1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := AccountID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/datashare/validate/data_set_id.go b/internal/services/datashare/validate/data_set_id.go deleted file mode 100644 index 677bf39f79f9..000000000000 --- a/internal/services/datashare/validate/data_set_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" -) - -func DataSetID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DataSetID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/datashare/validate/data_set_id_test.go b/internal/services/datashare/validate/data_set_id_test.go deleted file mode 100644 index e752aa940385..000000000000 --- a/internal/services/datashare/validate/data_set_id_test.go +++ /dev/null @@ -1,100 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestDataSetID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing AccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/", - Valid: false, - }, - - { - // missing value for AccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/", - Valid: false, - }, - - { - // missing ShareName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/", - Valid: false, - }, - - { - // missing value for ShareName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/share1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/share1/dataSets/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/share1/dataSets/dataSet1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DATASHARE/ACCOUNTS/ACCOUNT1/SHARES/SHARE1/DATASETS/DATASET1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := DataSetID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/datashare/validate/share_id.go b/internal/services/datashare/validate/share_id.go deleted file mode 100644 index f5b12d217cf8..000000000000 --- a/internal/services/datashare/validate/share_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" -) - -func ShareID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ShareID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/datashare/validate/share_id_test.go b/internal/services/datashare/validate/share_id_test.go deleted file mode 100644 index 5e777f0a6be5..000000000000 --- a/internal/services/datashare/validate/share_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestShareID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing AccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/", - Valid: false, - }, - - { - // missing value for AccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DataShare/accounts/account1/shares/share1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.DATASHARE/ACCOUNTS/ACCOUNT1/SHARES/SHARE1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ShareID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/desktopvirtualization/registration.go b/internal/services/desktopvirtualization/registration.go index 8537dddf80c4..f20050d8f316 100644 --- a/internal/services/desktopvirtualization/registration.go +++ b/internal/services/desktopvirtualization/registration.go @@ -26,7 +26,9 @@ func (r Registration) WebsiteCategories() []string { // SupportedDataSources returns the supported Data Sources supported by this Service func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { - return map[string]*pluginsdk.Resource{} + return map[string]*pluginsdk.Resource{ + "azurerm_virtual_desktop_host_pool": dataSourceVirtualDesktopHostPool(), + } } // SupportedResources returns the supported Resources supported by this Service diff --git a/internal/services/desktopvirtualization/virtual_desktop_host_pool_data_source.go b/internal/services/desktopvirtualization/virtual_desktop_host_pool_data_source.go new file mode 100644 index 000000000000..ba341a15b589 --- /dev/null +++ b/internal/services/desktopvirtualization/virtual_desktop_host_pool_data_source.go @@ -0,0 +1,185 @@ +package desktopvirtualization + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2022-02-10-preview/hostpool" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourceVirtualDesktopHostPool() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceVirtualDesktopHostPoolRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "location": commonschema.LocationComputed(), + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "load_balancer_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "friendly_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "description": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "validate_environment": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "custom_rdp_properties": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "personal_desktop_assignment_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "maximum_sessions_allowed": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "start_vm_on_connect": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "preferred_app_group_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "scheduled_agent_updates": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "timezone": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "use_session_host_timezone": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "schedule": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "day_of_week": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "hour_of_day": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourceVirtualDesktopHostPoolRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).DesktopVirtualization.HostPoolsClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id := hostpool.NewHostPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + d.SetId(id.ID()) + d.Set("name", id.HostPoolName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } + + props := model.Properties + maxSessionLimit := 0 + if props.MaxSessionLimit != nil { + maxSessionLimit = int(*props.MaxSessionLimit) + } + + d.Set("custom_rdp_properties", props.CustomRdpProperty) + d.Set("description", props.Description) + d.Set("friendly_name", props.FriendlyName) + d.Set("maximum_sessions_allowed", maxSessionLimit) + d.Set("load_balancer_type", string(props.LoadBalancerType)) + personalDesktopAssignmentType := "" + if props.PersonalDesktopAssignmentType != nil { + personalDesktopAssignmentType = string(*props.PersonalDesktopAssignmentType) + } + d.Set("personal_desktop_assignment_type", personalDesktopAssignmentType) + d.Set("preferred_app_group_type", string(props.PreferredAppGroupType)) + d.Set("start_vm_on_connect", props.StartVMOnConnect) + d.Set("type", string(props.HostPoolType)) + d.Set("validate_environment", props.ValidationEnvironment) + d.Set("scheduled_agent_updates", flattenAgentUpdate(props.AgentUpdate)) + } + + return nil +} diff --git a/internal/services/desktopvirtualization/virtual_desktop_host_pool_data_source_test.go b/internal/services/desktopvirtualization/virtual_desktop_host_pool_data_source_test.go new file mode 100644 index 000000000000..efb45df34297 --- /dev/null +++ b/internal/services/desktopvirtualization/virtual_desktop_host_pool_data_source_test.go @@ -0,0 +1,40 @@ +package desktopvirtualization_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type VirtualDesktopHostPoolDataSource struct{} + +func TestAccDataShareAccountDataSource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_virtual_desktop_host_pool", "test") + r := VirtualDesktopHostPoolDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("tags.%").HasValue("1"), + check.That(data.ResourceName).Key("friendly_name").HasValue("A Friendly Name!"), + check.That(data.ResourceName).Key("validate_environment").HasValue("true"), + check.That(data.ResourceName).Key("load_balancer_type").HasValue("BreadthFirst"), + check.That(data.ResourceName).Key("maximum_sessions_allowed").HasValue("100"), + ), + }, + }) +} + +func (VirtualDesktopHostPoolDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +data "azurerm_virtual_desktop_host_pool" "test" { + name = azurerm_virtual_desktop_host_pool.test.name + resource_group_name = azurerm_resource_group.test.name +} +`, VirtualDesktopHostPoolResource{}.complete(data)) +} diff --git a/internal/services/devtestlabs/client/client.go b/internal/services/devtestlabs/client/client.go index e4e1398592f8..7a3a20e9685c 100644 --- a/internal/services/devtestlabs/client/client.go +++ b/internal/services/devtestlabs/client/client.go @@ -1,36 +1,41 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - GlobalLabSchedulesClient *dtl.GlobalSchedulesClient - LabsClient *dtl.LabsClient - LabSchedulesClient *dtl.SchedulesClient - PoliciesClient *dtl.PoliciesClient - VirtualMachinesClient *dtl.VirtualMachinesClient - VirtualNetworksClient *dtl.VirtualNetworksClient + GlobalLabSchedulesClient *globalschedules.GlobalSchedulesClient + LabsClient *labs.LabsClient + LabSchedulesClient *schedules.SchedulesClient + PoliciesClient *policies.PoliciesClient + VirtualMachinesClient *virtualmachines.VirtualMachinesClient + VirtualNetworksClient *virtualnetworks.VirtualNetworksClient } func NewClient(o *common.ClientOptions) *Client { - LabsClient := dtl.NewLabsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + LabsClient := labs.NewLabsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&LabsClient.Client, o.ResourceManagerAuthorizer) - PoliciesClient := dtl.NewPoliciesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + PoliciesClient := policies.NewPoliciesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&PoliciesClient.Client, o.ResourceManagerAuthorizer) - VirtualMachinesClient := dtl.NewVirtualMachinesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + VirtualMachinesClient := virtualmachines.NewVirtualMachinesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&VirtualMachinesClient.Client, o.ResourceManagerAuthorizer) - VirtualNetworksClient := dtl.NewVirtualNetworksClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + VirtualNetworksClient := virtualnetworks.NewVirtualNetworksClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&VirtualNetworksClient.Client, o.ResourceManagerAuthorizer) - LabSchedulesClient := dtl.NewSchedulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + LabSchedulesClient := schedules.NewSchedulesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&LabSchedulesClient.Client, o.ResourceManagerAuthorizer) - GlobalLabSchedulesClient := dtl.NewGlobalSchedulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + GlobalLabSchedulesClient := globalschedules.NewGlobalSchedulesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&GlobalLabSchedulesClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/internal/services/devtestlabs/dev_test_global_vm_shutdown_schedule_resource.go b/internal/services/devtestlabs/dev_test_global_vm_shutdown_schedule_resource.go index 58ab7b0bac15..cedf4d0bf18e 100644 --- a/internal/services/devtestlabs/dev_test_global_vm_shutdown_schedule_resource.go +++ b/internal/services/devtestlabs/dev_test_global_vm_shutdown_schedule_resource.go @@ -5,19 +5,18 @@ import ( "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" computeParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" computeValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceDevTestGlobalVMShutdownSchedule() *pluginsdk.Resource { @@ -27,7 +26,7 @@ func resourceDevTestGlobalVMShutdownSchedule() *pluginsdk.Resource { Update: resourceDevTestGlobalVMShutdownScheduleCreateUpdate, Delete: resourceDevTestGlobalVMShutdownScheduleDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ScheduleID(id) + _, err := globalschedules.ParseScheduleID(id) return err }), @@ -116,17 +115,17 @@ func resourceDevTestGlobalVMShutdownScheduleCreateUpdate(d *pluginsdk.ResourceDa // Can't find any official documentation on this, but the API returns a 400 for any other name. // The best example I could find is here: https://social.msdn.microsoft.com/Forums/en-US/25a02403-dba9-4bcb-bdcc-1f4afcba5b65/powershell-script-to-autoshutdown-azure-virtual-machine?forum=WAVirtualMachinesforWindows name := "shutdown-computevm-" + vmId.Name - id := parse.NewScheduleID(vmId.SubscriptionId, vmId.ResourceGroup, name) + id := globalschedules.NewScheduleID(vmId.SubscriptionId, vmId.ResourceGroup, name) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name, "") + existing, err := client.Get(ctx, id, globalschedules.GetOperationOptions{}) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_dev_test_global_vm_shutdown_schedule", id.ID()) } } @@ -134,36 +133,36 @@ func resourceDevTestGlobalVMShutdownScheduleCreateUpdate(d *pluginsdk.ResourceDa location := azure.NormalizeLocation(d.Get("location").(string)) taskType := "ComputeVmShutdownTask" - schedule := dtl.Schedule{ + schedule := globalschedules.Schedule{ Location: &location, - ScheduleProperties: &dtl.ScheduleProperties{ - TargetResourceID: &vmID, + Properties: globalschedules.ScheduleProperties{ + TargetResourceId: &vmID, TaskType: &taskType, }, - Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + Tags: expandTags(d.Get("tags").(map[string]interface{})), } + statusEnabled := globalschedules.EnableStatusDisabled if d.Get("enabled").(bool) { - schedule.ScheduleProperties.Status = dtl.EnableStatusEnabled - } else { - schedule.ScheduleProperties.Status = dtl.EnableStatusDisabled + statusEnabled = globalschedules.EnableStatusEnabled } + schedule.Properties.Status = &statusEnabled if timeZoneId := d.Get("timezone").(string); timeZoneId != "" { - schedule.ScheduleProperties.TimeZoneID = &timeZoneId + schedule.Properties.TimeZoneId = &timeZoneId } if v, ok := d.GetOk("daily_recurrence_time"); ok { dailyRecurrence := expandDevTestGlobalVMShutdownScheduleRecurrenceDaily(v) - schedule.DailyRecurrence = dailyRecurrence + schedule.Properties.DailyRecurrence = dailyRecurrence } if _, ok := d.GetOk("notification_settings"); ok { notificationSettings := expandDevTestGlobalVMShutdownScheduleNotificationSettings(d) - schedule.NotificationSettings = notificationSettings + schedule.Properties.NotificationSettings = notificationSettings } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, name, schedule); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, schedule); err != nil { return err } @@ -177,28 +176,29 @@ func resourceDevTestGlobalVMShutdownScheduleRead(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ScheduleID(d.Id()) + id, err := globalschedules.ParseScheduleID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name, "") + resp, err := client.Get(ctx, *id, globalschedules.GetOperationOptions{}) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("making Read request on Dev Test Global Schedule %s: %s", id.Name, err) + return fmt.Errorf("making Read request on %s: %s", *id, err) } - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + if model := resp.Model; model != nil { + if location := resp.Model.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) + } - if props := resp.ScheduleProperties; props != nil { - d.Set("virtual_machine_id", props.TargetResourceID) - d.Set("timezone", props.TimeZoneID) - d.Set("enabled", props.Status == dtl.EnableStatusEnabled) + props := resp.Model.Properties + d.Set("virtual_machine_id", props.TargetResourceId) + d.Set("timezone", props.TimeZoneId) + d.Set("enabled", *props.Status == globalschedules.EnableStatusEnabled) if err := d.Set("daily_recurrence_time", flattenDevTestGlobalVMShutdownScheduleRecurrenceDaily(props.DailyRecurrence)); err != nil { return fmt.Errorf("setting `dailyRecurrence`: %#v", err) @@ -207,9 +207,11 @@ func resourceDevTestGlobalVMShutdownScheduleRead(d *pluginsdk.ResourceData, meta if err := d.Set("notification_settings", flattenDevTestGlobalVMShutdownScheduleNotificationSettings(props.NotificationSettings)); err != nil { return fmt.Errorf("setting `notificationSettings`: %#v", err) } + if err = tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + return err + } } - - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceDevTestGlobalVMShutdownScheduleDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -217,26 +219,26 @@ func resourceDevTestGlobalVMShutdownScheduleDelete(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ScheduleID(d.Id()) + id, err := globalschedules.ParseScheduleID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.Name); err != nil { + if _, err := client.Delete(ctx, *id); err != nil { return err } return nil } -func expandDevTestGlobalVMShutdownScheduleRecurrenceDaily(dailyTime interface{}) *dtl.DayDetails { +func expandDevTestGlobalVMShutdownScheduleRecurrenceDaily(dailyTime interface{}) *globalschedules.DayDetails { time := dailyTime.(string) - return &dtl.DayDetails{ + return &globalschedules.DayDetails{ Time: &time, } } -func flattenDevTestGlobalVMShutdownScheduleRecurrenceDaily(dailyRecurrence *dtl.DayDetails) interface{} { +func flattenDevTestGlobalVMShutdownScheduleRecurrenceDaily(dailyRecurrence *globalschedules.DayDetails) interface{} { if dailyRecurrence == nil { return nil } @@ -249,44 +251,44 @@ func flattenDevTestGlobalVMShutdownScheduleRecurrenceDaily(dailyRecurrence *dtl. return result } -func expandDevTestGlobalVMShutdownScheduleNotificationSettings(d *pluginsdk.ResourceData) *dtl.NotificationSettings { +func expandDevTestGlobalVMShutdownScheduleNotificationSettings(d *pluginsdk.ResourceData) *globalschedules.NotificationSettings { notificationSettingsConfigs := d.Get("notification_settings").([]interface{}) notificationSettingsConfig := notificationSettingsConfigs[0].(map[string]interface{}) webhookUrl := notificationSettingsConfig["webhook_url"].(string) - timeInMinutes := int32(notificationSettingsConfig["time_in_minutes"].(int)) + timeInMinutes := int64(notificationSettingsConfig["time_in_minutes"].(int)) email := notificationSettingsConfig["email"].(string) - var notificationStatus dtl.EnableStatus + var notificationStatus globalschedules.EnableStatus if notificationSettingsConfig["enabled"].(bool) { - notificationStatus = dtl.EnableStatusEnabled + notificationStatus = globalschedules.EnableStatusEnabled } else { - notificationStatus = dtl.EnableStatusDisabled + notificationStatus = globalschedules.EnableStatusDisabled } - return &dtl.NotificationSettings{ - WebhookURL: &webhookUrl, + return &globalschedules.NotificationSettings{ + WebhookUrl: &webhookUrl, TimeInMinutes: &timeInMinutes, - Status: notificationStatus, + Status: ¬ificationStatus, EmailRecipient: &email, } } -func flattenDevTestGlobalVMShutdownScheduleNotificationSettings(notificationSettings *dtl.NotificationSettings) []interface{} { +func flattenDevTestGlobalVMShutdownScheduleNotificationSettings(notificationSettings *globalschedules.NotificationSettings) []interface{} { if notificationSettings == nil { return []interface{}{} } result := make(map[string]interface{}) - if notificationSettings.WebhookURL != nil { - result["webhook_url"] = *notificationSettings.WebhookURL + if notificationSettings.WebhookUrl != nil { + result["webhook_url"] = *notificationSettings.WebhookUrl } if notificationSettings.TimeInMinutes != nil { result["time_in_minutes"] = *notificationSettings.TimeInMinutes } - result["enabled"] = notificationSettings.Status == dtl.EnableStatusEnabled + result["enabled"] = *notificationSettings.Status == globalschedules.EnableStatusEnabled result["email"] = notificationSettings.EmailRecipient return []interface{}{result} diff --git a/internal/services/devtestlabs/dev_test_global_vm_shutdown_schedule_resource_test.go b/internal/services/devtestlabs/dev_test_global_vm_shutdown_schedule_resource_test.go index 78fc349515ad..2b47964d8c97 100644 --- a/internal/services/devtestlabs/dev_test_global_vm_shutdown_schedule_resource_test.go +++ b/internal/services/devtestlabs/dev_test_global_vm_shutdown_schedule_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -104,17 +104,17 @@ func TestAccDevTestGlobalVMShutdownSchedule_autoShutdownUpdate(t *testing.T) { } func (DevTestGlobalVMShutdownScheduleResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ScheduleID(state.ID) + id, err := globalschedules.ParseScheduleID(state.ID) if err != nil { return nil, err } - resp, err := clients.DevTestLabs.GlobalLabSchedulesClient.Get(ctx, id.ResourceGroup, id.Name, "") + resp, err := clients.DevTestLabs.GlobalLabSchedulesClient.Get(ctx, *id, globalschedules.GetOperationOptions{}) if err != nil { - return nil, fmt.Errorf("retrieving Dev Test Lab Global Schedule %q (resource group: %q): %+v", id.Name, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ScheduleProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (DevTestGlobalVMShutdownScheduleResource) template(data acceptance.TestData) string { diff --git a/internal/services/devtestlabs/dev_test_lab_data_source.go b/internal/services/devtestlabs/dev_test_lab_data_source.go index 71aedc9958bc..552f7af44513 100644 --- a/internal/services/devtestlabs/dev_test_lab_data_source.go +++ b/internal/services/devtestlabs/dev_test_lab_data_source.go @@ -4,15 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceDevTestLab() *pluginsdk.Resource { @@ -80,11 +80,11 @@ func dataSourceDevTestLabRead(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewDevTestLabID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := labs.NewLabID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.LabName, "") + resp, err := client.Get(ctx, id, labs.GetOperationOptions{}) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } @@ -93,21 +93,27 @@ func dataSourceDevTestLabRead(d *pluginsdk.ResourceData, meta interface{}) error d.SetId(id.ID()) - d.Set("name", resp.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.LabName) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.LabProperties; props != nil { - d.Set("storage_type", string(props.LabStorageType)) + if model := resp.Model; model != nil { - // Computed fields - d.Set("artifacts_storage_account_id", props.ArtifactsStorageAccount) - d.Set("default_storage_account_id", props.DefaultStorageAccount) - d.Set("default_premium_storage_account_id", props.DefaultPremiumStorageAccount) - d.Set("key_vault_id", props.VaultName) - d.Set("premium_data_disk_storage_account_id", props.PremiumDataDiskStorageAccount) - d.Set("unique_identifier", props.UniqueIdentifier) - } + d.Set("location", location.NormalizeNilable(model.Location)) + + if props := model.Properties; props != nil { + d.Set("storage_type", props.LabStorageType) - return tags.FlattenAndSet(d, resp.Tags) + // Computed fields + d.Set("artifacts_storage_account_id", props.ArtifactsStorageAccount) + d.Set("default_storage_account_id", props.DefaultStorageAccount) + d.Set("default_premium_storage_account_id", props.DefaultPremiumStorageAccount) + d.Set("key_vault_id", props.VaultName) + d.Set("premium_data_disk_storage_account_id", props.PremiumDataDiskStorageAccount) + d.Set("unique_identifier", props.UniqueIdentifier) + } + if err = tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + return err + } + } + return nil } diff --git a/internal/services/devtestlabs/dev_test_lab_resource.go b/internal/services/devtestlabs/dev_test_lab_resource.go index e8fd8d2d65d7..3b62721ed3d9 100644 --- a/internal/services/devtestlabs/dev_test_lab_resource.go +++ b/internal/services/devtestlabs/dev_test_lab_resource.go @@ -5,14 +5,14 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/validate" keyvaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -29,7 +29,7 @@ func resourceDevTestLab() *pluginsdk.Resource { Update: resourceDevTestLabCreateUpdate, Delete: resourceDevTestLabDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DevTestLabID(id) + _, err := labs.ParseLabID(id) return err }), @@ -62,10 +62,10 @@ func resourceDevTestLab() *pluginsdk.Resource { "storage_type": { Type: pluginsdk.TypeString, Optional: true, - Default: string(dtl.Premium), + Default: string(labs.StorageTypePremium), ValidateFunc: validation.StringInSlice([]string{ - string(dtl.Standard), - string(dtl.Premium), + string(labs.StorageTypeStandard), + string(labs.StorageTypePremium), }, false), }, @@ -107,10 +107,10 @@ func resourceDevTestLab() *pluginsdk.Resource { resource.Schema["storage_type"] = &pluginsdk.Schema{ Type: pluginsdk.TypeString, Optional: true, - Default: string(dtl.Premium), + Default: string(labs.StorageTypePremium), ValidateFunc: validation.StringInSlice([]string{ - string(dtl.Standard), - string(dtl.Premium), + string(labs.StorageTypeStandard), + string(labs.StorageTypePremium), }, false), Deprecated: "`storage_type` is deprecated in version 3.0 of the AzureRM provider and will be removed in version 4.0.", } @@ -127,45 +127,40 @@ func resourceDevTestLabCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) log.Printf("[INFO] preparing arguments for DevTest Lab creation") - id := parse.NewDevTestLabID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := labs.NewLabID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.LabName, "") + existing, err := client.Get(ctx, id, labs.GetOperationOptions{}) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_dev_test_lab", id.ID()) } } location := azure.NormalizeLocation(d.Get("location").(string)) - t := d.Get("tags").(map[string]interface{}) - parameters := dtl.Lab{ + parameters := labs.Lab{ Location: utils.String(location), - Tags: tags.Expand(t), + Tags: expandTags(d.Get("tags").(map[string]interface{})), } if !features.FourPointOhBeta() { - storageType := d.Get("storage_type").(string) - parameters.LabProperties = &dtl.LabProperties{ - LabStorageType: dtl.StorageType(storageType), + storageType := labs.StorageType(d.Get("storage_type").(string)) + parameters.Properties = &labs.LabProperties{ + LabStorageType: &storageType, } } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.LabName, parameters) + err := client.CreateOrUpdateThenPoll(ctx, id, parameters) if err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceDevTestLabRead(d, meta) @@ -176,14 +171,14 @@ func resourceDevTestLabRead(d *pluginsdk.ResourceData, meta interface{}) error { ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DevTestLabID(d.Id()) + id, err := labs.ParseLabID(d.Id()) if err != nil { return err } - read, err := client.Get(ctx, id.ResourceGroup, id.LabName, "") + read, err := client.Get(ctx, *id, labs.GetOperationOptions{}) if err != nil { - if utils.ResponseWasNotFound(read.Response) { + if response.WasNotFound(read.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -193,34 +188,39 @@ func resourceDevTestLabRead(d *pluginsdk.ResourceData, meta interface{}) error { } d.Set("name", id.LabName) - d.Set("resource_group_name", id.ResourceGroup) - if location := read.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + d.Set("resource_group_name", id.ResourceGroupName) - if props := read.LabProperties; props != nil { - if !features.FourPointOhBeta() { - d.Set("storage_type", string(props.LabStorageType)) + if model := read.Model; model != nil { + if location := model.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) } - // Computed fields - d.Set("artifacts_storage_account_id", props.ArtifactsStorageAccount) - d.Set("default_storage_account_id", props.DefaultStorageAccount) - d.Set("default_premium_storage_account_id", props.DefaultPremiumStorageAccount) - - kvId := "" - if props.VaultName != nil { - id, err := keyvaultParse.VaultID(*props.VaultName) - if err != nil { - return fmt.Errorf("parsing %q: %+v", *props.VaultName, err) + + if props := model.Properties; props != nil { + if !features.FourPointOhBeta() { + d.Set("storage_type", props.LabStorageType) + } + // Computed fields + d.Set("artifacts_storage_account_id", props.ArtifactsStorageAccount) + d.Set("default_storage_account_id", props.DefaultStorageAccount) + d.Set("default_premium_storage_account_id", props.DefaultPremiumStorageAccount) + + kvId := "" + if props.VaultName != nil { + id, err := keyvaultParse.VaultID(*props.VaultName) + if err != nil { + return fmt.Errorf("parsing %q: %+v", *props.VaultName, err) + } + kvId = id.ID() } - kvId = id.ID() + d.Set("key_vault_id", kvId) + d.Set("premium_data_disk_storage_account_id", props.PremiumDataDiskStorageAccount) + d.Set("unique_identifier", props.UniqueIdentifier) + } + if err = tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + return err } - d.Set("key_vault_id", kvId) - d.Set("premium_data_disk_storage_account_id", props.PremiumDataDiskStorageAccount) - d.Set("unique_identifier", props.UniqueIdentifier) } - - return tags.FlattenAndSet(d, read.Tags) + return nil } func resourceDevTestLabDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -228,14 +228,14 @@ func resourceDevTestLabDelete(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DevTestLabID(d.Id()) + id, err := labs.ParseLabID(d.Id()) if err != nil { return err } - read, err := client.Get(ctx, id.ResourceGroup, id.LabName, "") + read, err := client.Get(ctx, *id, labs.GetOperationOptions{}) if err != nil { - if utils.ResponseWasNotFound(read.Response) { + if response.WasNotFound(read.HttpResponse) { // deleted outside of TF log.Printf("[DEBUG] %s was not found - assuming removed!", *id) return nil @@ -244,14 +244,10 @@ func resourceDevTestLabDelete(d *pluginsdk.ResourceData, meta interface{}) error return fmt.Errorf("retrieving %s: %+v", *id, err) } - future, err := client.Delete(ctx, id.ResourceGroup, id.LabName) + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) - } - return err } diff --git a/internal/services/devtestlabs/dev_test_lab_resource_test.go b/internal/services/devtestlabs/dev_test_lab_resource_test.go index 5ac6ade73275..f0c09c8489c7 100644 --- a/internal/services/devtestlabs/dev_test_lab_resource_test.go +++ b/internal/services/devtestlabs/dev_test_lab_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -69,17 +69,17 @@ func TestAccDevTestLab_complete(t *testing.T) { } func (DevTestLabResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DevTestLabID(state.ID) + id, err := labs.ParseLabID(state.ID) if err != nil { return nil, err } - resp, err := clients.DevTestLabs.LabsClient.Get(ctx, id.ResourceGroup, id.LabName, "") + resp, err := clients.DevTestLabs.LabsClient.Get(ctx, *id, labs.GetOperationOptions{}) if err != nil { return nil, fmt.Errorf("retrievisng %s: %+v", *id, err) } - return utils.Bool(resp.LabProperties != nil), nil + return utils.Bool(resp.Model != nil && resp.Model.Properties != nil), nil } func (DevTestLabResource) basic(data acceptance.TestData) string { diff --git a/internal/services/devtestlabs/dev_test_lab_schedule_resource.go b/internal/services/devtestlabs/dev_test_lab_schedule_resource.go index 8f08d13ec11b..3385cd0aabb0 100644 --- a/internal/services/devtestlabs/dev_test_lab_schedule_resource.go +++ b/internal/services/devtestlabs/dev_test_lab_schedule_resource.go @@ -5,20 +5,19 @@ import ( "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" computeValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" devTestValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceDevTestLabSchedules() *pluginsdk.Resource { @@ -28,7 +27,7 @@ func resourceDevTestLabSchedules() *pluginsdk.Resource { Update: resourceDevTestLabSchedulesCreateUpdate, Delete: resourceDevTestLabSchedulesDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DevTestLabScheduleID(id) + _, err := schedules.ParseLabScheduleID(id) return err }), @@ -68,10 +67,10 @@ func resourceDevTestLabSchedules() *pluginsdk.Resource { "status": { Type: pluginsdk.TypeString, Optional: true, - Default: dtl.EnableStatusDisabled, + Default: schedules.EnableStatusDisabled, ValidateFunc: validation.StringInSlice([]string{ - string(dtl.EnableStatusEnabled), - string(dtl.EnableStatusDisabled), + string(schedules.EnableStatusEnabled), + string(schedules.EnableStatusDisabled), }, false), }, @@ -163,10 +162,10 @@ func resourceDevTestLabSchedules() *pluginsdk.Resource { "status": { Type: pluginsdk.TypeString, Optional: true, - Default: dtl.EnableStatusDisabled, + Default: schedules.EnableStatusDisabled, ValidateFunc: validation.StringInSlice([]string{ - string(dtl.EnableStatusEnabled), - string(dtl.EnableStatusDisabled), + string(schedules.EnableStatusEnabled), + string(schedules.EnableStatusDisabled), }, false), }, "time_in_minutes": { @@ -193,69 +192,66 @@ func resourceDevTestLabSchedulesCreateUpdate(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewDevTestLabScheduleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("lab_name").(string), d.Get("name").(string)) + id := schedules.NewLabScheduleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("lab_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.LabName, id.ScheduleName, "") + existing, err := client.Get(ctx, id, schedules.GetOperationOptions{}) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_dev_test_schedule", id.ID()) } } location := azure.NormalizeLocation(d.Get("location").(string)) - t := d.Get("tags").(map[string]interface{}) - schedule := dtl.Schedule{ - Location: &location, - ScheduleProperties: &dtl.ScheduleProperties{}, - Tags: tags.Expand(t), + schedule := schedules.Schedule{ + Location: &location, + Properties: schedules.ScheduleProperties{}, + Tags: expandTags(d.Get("tags").(map[string]interface{})), } - switch status := d.Get("status"); status { - case string(dtl.EnableStatusEnabled): - schedule.ScheduleProperties.Status = dtl.EnableStatusEnabled - case string(dtl.EnableStatusDisabled): - schedule.ScheduleProperties.Status = dtl.EnableStatusDisabled - default: + status := schedules.EnableStatusDisabled + if d.Get("status").(string) == string(schedules.EnableStatusEnabled) { + status = schedules.EnableStatusEnabled } + schedule.Properties.Status = &status if taskType := d.Get("task_type").(string); taskType != "" { - schedule.ScheduleProperties.TaskType = &taskType + schedule.Properties.TaskType = &taskType } if timeZoneId := d.Get("time_zone_id").(string); timeZoneId != "" { - schedule.ScheduleProperties.TimeZoneID = &timeZoneId + schedule.Properties.TimeZoneId = &timeZoneId } if v, ok := d.GetOk("weekly_recurrence"); ok { weekRecurrence := expandDevTestScheduleRecurrenceWeekly(v) - schedule.WeeklyRecurrence = weekRecurrence + schedule.Properties.WeeklyRecurrence = weekRecurrence } if v, ok := d.GetOk("daily_recurrence"); ok { dailyRecurrence := expandDevTestScheduleRecurrenceDaily(v) - schedule.DailyRecurrence = dailyRecurrence + schedule.Properties.DailyRecurrence = dailyRecurrence } if v, ok := d.GetOk("hourly_recurrence"); ok { hourlyRecurrence := expandDevTestScheduleRecurrenceHourly(v) - schedule.HourlyRecurrence = hourlyRecurrence + schedule.Properties.HourlyRecurrence = hourlyRecurrence } if _, ok := d.GetOk("notification_settings"); ok { notificationSettings := expandDevTestScheduleNotificationSettings(d) - schedule.NotificationSettings = notificationSettings + schedule.Properties.NotificationSettings = notificationSettings } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.LabName, id.ScheduleName, schedule); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, schedule); err != nil { return err } @@ -269,14 +265,14 @@ func resourceDevTestLabSchedulesRead(d *pluginsdk.ResourceData, meta interface{} ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DevTestLabScheduleID(d.Id()) + id, err := schedules.ParseLabScheduleID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.LabName, id.ScheduleName, "") + resp, err := client.Get(ctx, *id, schedules.GetOperationOptions{}) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -284,17 +280,18 @@ func resourceDevTestLabSchedulesRead(d *pluginsdk.ResourceData, meta interface{} } d.Set("name", id.ScheduleName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } d.Set("lab_name", id.LabName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("task_type", resp.TaskType) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.ScheduleProperties; props != nil { - d.Set("time_zone_id", props.TimeZoneID) + if model := resp.Model; model != nil { + if location := model.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) + } - d.Set("status", string(props.Status)) + props := model.Properties + d.Set("time_zone_id", props.TimeZoneId) + d.Set("task_type", props.TaskType) + d.Set("status", props.Status) if err := d.Set("weekly_recurrence", flattenAzureRmDevTestLabScheduleRecurrenceWeekly(props.WeeklyRecurrence)); err != nil { return fmt.Errorf("setting `weeklyRecurrence`: %#v", err) @@ -311,9 +308,11 @@ func resourceDevTestLabSchedulesRead(d *pluginsdk.ResourceData, meta interface{} if err := d.Set("notification_settings", flattenAzureRmDevTestLabScheduleNotificationSettings(props.NotificationSettings)); err != nil { return fmt.Errorf("setting `notificationSettings`: %#v", err) } + if err = tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + return err + } } - - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceDevTestLabSchedulesDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -321,28 +320,28 @@ func resourceDevTestLabSchedulesDelete(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DevTestLabScheduleID(d.Id()) + id, err := schedules.ParseLabScheduleID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.LabName, id.ScheduleName); err != nil { + if _, err := client.Delete(ctx, *id); err != nil { return err } return nil } -func expandDevTestScheduleRecurrenceDaily(recurrence interface{}) *dtl.DayDetails { +func expandDevTestScheduleRecurrenceDaily(recurrence interface{}) *schedules.DayDetails { dailyRecurrenceConfigs := recurrence.([]interface{}) dailyRecurrenceConfig := dailyRecurrenceConfigs[0].(map[string]interface{}) dailyTime := dailyRecurrenceConfig["time"].(string) - return &dtl.DayDetails{ + return &schedules.DayDetails{ Time: &dailyTime, } } -func flattenAzureRmDevTestLabScheduleRecurrenceDaily(dailyRecurrence *dtl.DayDetails) []interface{} { +func flattenAzureRmDevTestLabScheduleRecurrenceDaily(dailyRecurrence *schedules.DayDetails) []interface{} { if dailyRecurrence == nil { return []interface{}{} } @@ -356,7 +355,7 @@ func flattenAzureRmDevTestLabScheduleRecurrenceDaily(dailyRecurrence *dtl.DayDet return []interface{}{result} } -func expandDevTestScheduleRecurrenceWeekly(recurrence interface{}) *dtl.WeekDetails { +func expandDevTestScheduleRecurrenceWeekly(recurrence interface{}) *schedules.WeekDetails { weeklyRecurrenceConfigs := recurrence.([]interface{}) weeklyRecurrenceConfig := weeklyRecurrenceConfigs[0].(map[string]interface{}) weeklyTime := weeklyRecurrenceConfig["time"].(string) @@ -366,13 +365,13 @@ func expandDevTestScheduleRecurrenceWeekly(recurrence interface{}) *dtl.WeekDeta weekDays = append(weekDays, dayItem.(string)) } - return &dtl.WeekDetails{ + return &schedules.WeekDetails{ Time: &weeklyTime, Weekdays: &weekDays, } } -func flattenAzureRmDevTestLabScheduleRecurrenceWeekly(weeklyRecurrence *dtl.WeekDetails) []interface{} { +func flattenAzureRmDevTestLabScheduleRecurrenceWeekly(weeklyRecurrence *schedules.WeekDetails) []interface{} { if weeklyRecurrence == nil { return []interface{}{} } @@ -392,17 +391,17 @@ func flattenAzureRmDevTestLabScheduleRecurrenceWeekly(weeklyRecurrence *dtl.Week return []interface{}{result} } -func expandDevTestScheduleRecurrenceHourly(recurrence interface{}) *dtl.HourDetails { +func expandDevTestScheduleRecurrenceHourly(recurrence interface{}) *schedules.HourDetails { hourlyRecurrenceConfigs := recurrence.([]interface{}) hourlyRecurrenceConfig := hourlyRecurrenceConfigs[0].(map[string]interface{}) - hourlyMinute := int32(hourlyRecurrenceConfig["minute"].(int)) + hourlyMinute := int64(hourlyRecurrenceConfig["minute"].(int)) - return &dtl.HourDetails{ + return &schedules.HourDetails{ Minute: &hourlyMinute, } } -func flattenAzureRmDevTestLabScheduleRecurrenceHourly(hourlyRecurrence *dtl.HourDetails) []interface{} { +func flattenAzureRmDevTestLabScheduleRecurrenceHourly(hourlyRecurrence *schedules.HourDetails) []interface{} { if hourlyRecurrence == nil { return []interface{}{} } @@ -416,38 +415,38 @@ func flattenAzureRmDevTestLabScheduleRecurrenceHourly(hourlyRecurrence *dtl.Hour return []interface{}{result} } -func expandDevTestScheduleNotificationSettings(d *pluginsdk.ResourceData) *dtl.NotificationSettings { +func expandDevTestScheduleNotificationSettings(d *pluginsdk.ResourceData) *schedules.NotificationSettings { notificationSettingsConfigs := d.Get("notification_settings").([]interface{}) notificationSettingsConfig := notificationSettingsConfigs[0].(map[string]interface{}) webhookUrl := notificationSettingsConfig["webhook_url"].(string) - timeInMinutes := int32(notificationSettingsConfig["time_in_minutes"].(int)) + timeInMinutes := int64(notificationSettingsConfig["time_in_minutes"].(int)) - notificationStatus := dtl.EnableStatus(notificationSettingsConfig["status"].(string)) + notificationStatus := schedules.EnableStatus(notificationSettingsConfig["status"].(string)) - return &dtl.NotificationSettings{ - WebhookURL: &webhookUrl, + return &schedules.NotificationSettings{ + WebhookUrl: &webhookUrl, TimeInMinutes: &timeInMinutes, - Status: notificationStatus, + Status: ¬ificationStatus, } } -func flattenAzureRmDevTestLabScheduleNotificationSettings(notificationSettings *dtl.NotificationSettings) []interface{} { +func flattenAzureRmDevTestLabScheduleNotificationSettings(notificationSettings *schedules.NotificationSettings) []interface{} { if notificationSettings == nil { return []interface{}{} } result := make(map[string]interface{}) - if notificationSettings.WebhookURL != nil { - result["webhook_url"] = *notificationSettings.WebhookURL + if notificationSettings.WebhookUrl != nil { + result["webhook_url"] = *notificationSettings.WebhookUrl } if notificationSettings.TimeInMinutes != nil { result["time_in_minutes"] = *notificationSettings.TimeInMinutes } - if string(notificationSettings.Status) != "" { - result["status"] = string(notificationSettings.Status) + if notificationSettings.Status != nil { + result["status"] = *notificationSettings.Status } return []interface{}{result} diff --git a/internal/services/devtestlabs/dev_test_lab_schedule_resource_test.go b/internal/services/devtestlabs/dev_test_lab_schedule_resource_test.go index b6f096082e5f..69a0f42a9672 100644 --- a/internal/services/devtestlabs/dev_test_lab_schedule_resource_test.go +++ b/internal/services/devtestlabs/dev_test_lab_schedule_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -96,17 +96,17 @@ func TestAccDevTestLabSchedule_concurrent(t *testing.T) { } func (DevTestLabScheduleResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DevTestLabScheduleID(state.ID) + id, err := schedules.ParseLabScheduleID(state.ID) if err != nil { return nil, err } - resp, err := clients.DevTestLabs.LabSchedulesClient.Get(ctx, id.ResourceGroup, id.LabName, id.ScheduleName, "") + resp, err := clients.DevTestLabs.LabSchedulesClient.Get(ctx, *id, schedules.GetOperationOptions{}) if err != nil { return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.ScheduleProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (DevTestLabScheduleResource) autoShutdownBasic(data acceptance.TestData) string { diff --git a/internal/services/devtestlabs/dev_test_linux_virtual_machine_resource.go b/internal/services/devtestlabs/dev_test_linux_virtual_machine_resource.go index d42d5ee3d40a..03b88fb671cd 100644 --- a/internal/services/devtestlabs/dev_test_linux_virtual_machine_resource.go +++ b/internal/services/devtestlabs/dev_test_linux_virtual_machine_resource.go @@ -5,13 +5,13 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -27,7 +27,7 @@ func resourceArmDevTestLinuxVirtualMachine() *pluginsdk.Resource { Update: resourceArmDevTestLinuxVirtualMachineCreateUpdate, Delete: resourceArmDevTestLinuxVirtualMachineDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DevTestVirtualMachineID(id) + _, err := virtualmachines.ParseVirtualMachineID(id) return err }), @@ -159,23 +159,21 @@ func resourceArmDevTestLinuxVirtualMachineCreateUpdate(d *pluginsdk.ResourceData log.Printf("[INFO] preparing arguments for DevTest Linux Virtual Machine creation") - id := parse.NewDevTestVirtualMachineID(subscriptionId, d.Get("resource_group_name").(string), d.Get("lab_name").(string), d.Get("name").(string)) + id := virtualmachines.NewVirtualMachineID(subscriptionId, d.Get("resource_group_name").(string), d.Get("lab_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.LabName, id.VirtualMachineName, "") + existing, err := client.Get(ctx, id, virtualmachines.GetOperationOptions{}) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_dev_test_linux_virtual_machine", id.ID()) } } - t := d.Get("tags").(map[string]interface{}) - allowClaim := d.Get("allow_claim").(bool) disallowPublicIPAddress := d.Get("disallow_public_ip_address").(bool) labSubnetName := d.Get("lab_subnet_name").(string) @@ -195,47 +193,43 @@ func resourceArmDevTestLinuxVirtualMachineCreateUpdate(d *pluginsdk.ResourceData natRules := expandDevTestLabVirtualMachineNatRules(natRulesRaw) if len(natRules) > 0 && !disallowPublicIPAddress { - return fmt.Errorf("If `inbound_nat_rule` is specified then `disallow_public_ip_address` must be set to true.") + return fmt.Errorf("if `inbound_nat_rule` is specified then `disallow_public_ip_address` must be set to true") } - nic := dtl.NetworkInterfaceProperties{} + nic := virtualmachines.NetworkInterfaceProperties{} if disallowPublicIPAddress { - nic.SharedPublicIPAddressConfiguration = &dtl.SharedPublicIPAddressConfiguration{ + nic.SharedPublicIPAddressConfiguration = &virtualmachines.SharedPublicIPAddressConfiguration{ InboundNatRules: &natRules, } } authenticateViaSsh := sshKey != "" - parameters := dtl.LabVirtualMachine{ + parameters := virtualmachines.LabVirtualMachine{ Location: utils.String(location), - LabVirtualMachineProperties: &dtl.LabVirtualMachineProperties{ + Properties: virtualmachines.LabVirtualMachineProperties{ AllowClaim: utils.Bool(allowClaim), - IsAuthenticationWithSSHKey: utils.Bool(authenticateViaSsh), + IsAuthenticationWithSshKey: utils.Bool(authenticateViaSsh), DisallowPublicIPAddress: utils.Bool(disallowPublicIPAddress), GalleryImageReference: galleryImageReference, LabSubnetName: utils.String(labSubnetName), - LabVirtualNetworkID: utils.String(labVirtualNetworkId), + LabVirtualNetworkId: utils.String(labVirtualNetworkId), NetworkInterface: &nic, OsType: utils.String("Linux"), Notes: utils.String(notes), Password: utils.String(password), Size: utils.String(size), - SSHKey: utils.String(sshKey), + SshKey: utils.String(sshKey), StorageType: utils.String(storageType), UserName: utils.String(username), }, - Tags: tags.Expand(t), + Tags: expandTags(d.Get("tags").(map[string]interface{})), } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.LabName, id.VirtualMachineName, parameters) + err := client.CreateOrUpdateThenPoll(ctx, id, parameters) if err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceArmDevTestLinuxVirtualMachineRead(d, meta) @@ -246,14 +240,14 @@ func resourceArmDevTestLinuxVirtualMachineRead(d *pluginsdk.ResourceData, meta i ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DevTestVirtualMachineID(d.Id()) + id, err := virtualmachines.ParseVirtualMachineID(d.Id()) if err != nil { return err } - read, err := client.Get(ctx, id.ResourceGroup, id.LabName, id.VirtualMachineName, "") + read, err := client.Get(ctx, *id, virtualmachines.GetOperationOptions{}) if err != nil { - if utils.ResponseWasNotFound(read.Response) { + if response.WasNotFound(read.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -264,12 +258,14 @@ func resourceArmDevTestLinuxVirtualMachineRead(d *pluginsdk.ResourceData, meta i d.Set("name", id.VirtualMachineName) d.Set("lab_name", id.LabName) - d.Set("resource_group_name", id.ResourceGroup) - if location := read.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + d.Set("resource_group_name", id.ResourceGroupName) + + if model := read.Model; model != nil { + if location := model.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) + } - if props := read.LabVirtualMachineProperties; props != nil { + props := model.Properties d.Set("allow_claim", props.AllowClaim) d.Set("disallow_public_ip_address", props.DisallowPublicIPAddress) d.Set("notes", props.Notes) @@ -285,9 +281,12 @@ func resourceArmDevTestLinuxVirtualMachineRead(d *pluginsdk.ResourceData, meta i // Computed fields d.Set("fqdn", props.Fqdn) d.Set("unique_identifier", props.UniqueIdentifier) - } - return tags.FlattenAndSet(d, read.Tags) + if err = tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + return err + } + } + return nil } func resourceArmDevTestLinuxVirtualMachineDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -295,14 +294,14 @@ func resourceArmDevTestLinuxVirtualMachineDelete(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DevTestVirtualMachineID(d.Id()) + id, err := virtualmachines.ParseVirtualMachineID(d.Id()) if err != nil { return err } - read, err := client.Get(ctx, id.ResourceGroup, id.LabName, id.VirtualMachineName, "") + read, err := client.Get(ctx, *id, virtualmachines.GetOperationOptions{}) if err != nil { - if utils.ResponseWasNotFound(read.Response) { + if response.WasNotFound(read.HttpResponse) { // deleted outside of TF log.Printf("[DEBUG] %s was not found - assuming removed!", *id) return nil @@ -311,14 +310,10 @@ func resourceArmDevTestLinuxVirtualMachineDelete(d *pluginsdk.ResourceData, meta return fmt.Errorf("retrieving %s: %+v", *id, err) } - future, err := client.Delete(ctx, id.ResourceGroup, id.LabName, id.VirtualMachineName) + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) - } - return err } diff --git a/internal/services/devtestlabs/dev_test_linux_virtual_machine_resource_test.go b/internal/services/devtestlabs/dev_test_linux_virtual_machine_resource_test.go index a8a8922b7095..5940cb26d067 100644 --- a/internal/services/devtestlabs/dev_test_linux_virtual_machine_resource_test.go +++ b/internal/services/devtestlabs/dev_test_linux_virtual_machine_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -50,7 +50,7 @@ func TestAccDevTestLinuxVirtualMachine_requiresImport(t *testing.T) { }, { Config: r.requiresImport(data), - ExpectError: acceptance.RequiresImportError("azurerm_dev_test_lab_linux_virtual_machine"), + ExpectError: acceptance.RequiresImportError("azurerm_dev_test_linux_virtual_machine"), }, }) } @@ -130,17 +130,17 @@ func TestAccDevTestLinuxVirtualMachine_updateStorage(t *testing.T) { } func (DevTestLinuxVirtualMachineResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DevTestVirtualMachineID(state.ID) + id, err := virtualmachines.ParseVirtualMachineID(state.ID) if err != nil { return nil, err } - resp, err := clients.DevTestLabs.VirtualMachinesClient.Get(ctx, id.ResourceGroup, id.LabName, id.VirtualMachineName, "") + resp, err := clients.DevTestLabs.VirtualMachinesClient.Get(ctx, *id, virtualmachines.GetOperationOptions{}) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", *id, err) } - return utils.Bool(resp.LabVirtualMachineProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (DevTestLinuxVirtualMachineResource) basic(data acceptance.TestData) string { diff --git a/internal/services/devtestlabs/dev_test_policy_resource.go b/internal/services/devtestlabs/dev_test_policy_resource.go index 000788c6151d..90ad915fa1d3 100644 --- a/internal/services/devtestlabs/dev_test_policy_resource.go +++ b/internal/services/devtestlabs/dev_test_policy_resource.go @@ -5,12 +5,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -26,7 +26,7 @@ func resourceArmDevTestPolicy() *pluginsdk.Resource { Update: resourceArmDevTestPolicyCreateUpdate, Delete: resourceArmDevTestPolicyDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DevTestLabPolicyID(id) + _, err := policies.ParsePolicyID(id) return err }), @@ -48,14 +48,14 @@ func resourceArmDevTestPolicy() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(dtl.PolicyFactNameGalleryImage), - string(dtl.PolicyFactNameLabPremiumVMCount), - string(dtl.PolicyFactNameLabTargetCost), - string(dtl.PolicyFactNameLabVMCount), - string(dtl.PolicyFactNameLabVMSize), - string(dtl.PolicyFactNameUserOwnedLabPremiumVMCount), - string(dtl.PolicyFactNameUserOwnedLabVMCount), - string(dtl.PolicyFactNameUserOwnedLabVMCountInSubnet), + string(policies.PolicyFactNameGalleryImage), + string(policies.PolicyFactNameLabPremiumVMCount), + string(policies.PolicyFactNameLabTargetCost), + string(policies.PolicyFactNameLabVMCount), + string(policies.PolicyFactNameLabVMSize), + string(policies.PolicyFactNameUserOwnedLabPremiumVMCount), + string(policies.PolicyFactNameUserOwnedLabVMCount), + string(policies.PolicyFactNameUserOwnedLabVMCountInSubnet), }, false), }, @@ -87,8 +87,8 @@ func resourceArmDevTestPolicy() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(dtl.AllowedValuesPolicy), - string(dtl.MaxValuePolicy), + string(policies.PolicyEvaluatorTypeAllowedValuesPolicy), + string(policies.PolicyEvaluatorTypeMaxValuePolicy), }, false), }, @@ -115,40 +115,40 @@ func resourceArmDevTestPolicyCreateUpdate(d *pluginsdk.ResourceData, meta interf log.Printf("[INFO] preparing arguments for DevTest Policy creation") - id := parse.NewDevTestLabPolicyID(subscriptionId, d.Get("resource_group_name").(string), d.Get("lab_name").(string), d.Get("policy_set_name").(string), d.Get("name").(string)) + id := policies.NewPolicyID(subscriptionId, d.Get("resource_group_name").(string), d.Get("lab_name").(string), d.Get("policy_set_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.LabName, id.PolicySetName, id.PolicyName, "") + existing, err := client.Get(ctx, id, policies.GetOperationOptions{}) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_dev_test_policy", id.ID()) } } factData := d.Get("fact_data").(string) threshold := d.Get("threshold").(string) - evaluatorType := d.Get("evaluator_type").(string) + evaluatorType := policies.PolicyEvaluatorType(d.Get("evaluator_type").(string)) description := d.Get("description").(string) - t := d.Get("tags").(map[string]interface{}) + factName := policies.PolicyFactName(id.PolicyName) - parameters := dtl.Policy{ - Tags: tags.Expand(t), - PolicyProperties: &dtl.PolicyProperties{ - FactName: dtl.PolicyFactName(id.PolicyName), + parameters := policies.Policy{ + Tags: expandTags(d.Get("tags").(map[string]interface{})), + Properties: policies.PolicyProperties{ + FactName: &factName, FactData: utils.String(factData), Description: utils.String(description), - EvaluatorType: dtl.PolicyEvaluatorType(evaluatorType), + EvaluatorType: &evaluatorType, Threshold: utils.String(threshold), }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.LabName, id.PolicySetName, id.PolicyName, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -162,14 +162,14 @@ func resourceArmDevTestPolicyRead(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DevTestLabPolicyID(d.Id()) + id, err := policies.ParsePolicyID(d.Id()) if err != nil { return err } - read, err := client.Get(ctx, id.ResourceGroup, id.LabName, id.PolicySetName, id.PolicyName, "") + read, err := client.Get(ctx, *id, policies.GetOperationOptions{}) if err != nil { - if utils.ResponseWasNotFound(read.Response) { + if response.WasNotFound(read.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -181,16 +181,20 @@ func resourceArmDevTestPolicyRead(d *pluginsdk.ResourceData, meta interface{}) e d.Set("name", id.PolicyName) d.Set("policy_set_name", id.PolicySetName) d.Set("lab_name", id.LabName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - if props := read.PolicyProperties; props != nil { + if model := read.Model; model != nil { + props := model.Properties d.Set("description", props.Description) d.Set("fact_data", props.FactData) - d.Set("evaluator_type", string(props.EvaluatorType)) + d.Set("evaluator_type", props.EvaluatorType) d.Set("threshold", props.Threshold) - } - return tags.FlattenAndSet(d, read.Tags) + if err = tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + return err + } + } + return nil } func resourceArmDevTestPolicyDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -198,14 +202,14 @@ func resourceArmDevTestPolicyDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DevTestLabPolicyID(d.Id()) + id, err := policies.ParsePolicyID(d.Id()) if err != nil { return err } - read, err := client.Get(ctx, id.ResourceGroup, id.LabName, id.PolicySetName, id.PolicyName, "") + read, err := client.Get(ctx, *id, policies.GetOperationOptions{}) if err != nil { - if utils.ResponseWasNotFound(read.Response) { + if response.WasNotFound(read.HttpResponse) { // deleted outside of TF log.Printf("[DEBUG] %s was not found - assuming removed!", *id) return nil @@ -214,7 +218,7 @@ func resourceArmDevTestPolicyDelete(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("retrieving %s: %+v", *id, err) } - if _, err = client.Delete(ctx, id.ResourceGroup, id.LabName, id.PolicySetName, id.PolicyName); err != nil { + if _, err = client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } diff --git a/internal/services/devtestlabs/dev_test_policy_resource_test.go b/internal/services/devtestlabs/dev_test_policy_resource_test.go index f2ff84152439..1ed356cbbecb 100644 --- a/internal/services/devtestlabs/dev_test_policy_resource_test.go +++ b/internal/services/devtestlabs/dev_test_policy_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -68,17 +68,17 @@ func TestAccDevTestPolicy_complete(t *testing.T) { } func (DevTestPolicyResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DevTestLabPolicyID(state.ID) + id, err := policies.ParsePolicyID(state.ID) if err != nil { return nil, err } - resp, err := clients.DevTestLabs.PoliciesClient.Get(ctx, id.ResourceGroup, id.LabName, id.PolicySetName, id.PolicyName, "") + resp, err := clients.DevTestLabs.PoliciesClient.Get(ctx, *id, policies.GetOperationOptions{}) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", *id, err) } - return utils.Bool(resp.PolicyProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (DevTestPolicyResource) basic(data acceptance.TestData) string { @@ -115,7 +115,7 @@ func (r DevTestPolicyResource) requiresImport(data acceptance.TestData) string { resource "azurerm_dev_test_policy" "import" { name = azurerm_dev_test_policy.test.name - policy_set_name = "$[azurerm_dev_test_policy.test.policy_set_name}" + policy_set_name = azurerm_dev_test_policy.test.policy_set_name lab_name = azurerm_dev_test_policy.test.lab_name resource_group_name = azurerm_dev_test_policy.test.resource_group_name threshold = "999" diff --git a/internal/services/devtestlabs/dev_test_virtual_network_data_source.go b/internal/services/devtestlabs/dev_test_virtual_network_data_source.go index e7cd6d36a661..fc3b2a72099a 100644 --- a/internal/services/devtestlabs/dev_test_virtual_network_data_source.go +++ b/internal/services/devtestlabs/dev_test_virtual_network_data_source.go @@ -4,15 +4,14 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceArmDevTestVirtualNetwork() *pluginsdk.Resource { @@ -102,39 +101,41 @@ func dataSourceArmDevTestVnetRead(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewDevTestVirtualNetworkID(subscriptionId, d.Get("resource_group_name").(string), d.Get("lab_name").(string), d.Get("name").(string)) + id := virtualnetworks.NewVirtualNetworkID(subscriptionId, d.Get("resource_group_name").(string), d.Get("lab_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.LabName, id.VirtualNetworkName, "") + resp, err := client.Get(ctx, id, virtualnetworks.GetOperationOptions{}) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("making Read request on %s: %+v", id, err) } - if resp.ID == nil || *resp.ID == "" { - return fmt.Errorf("API returns a nil/empty id on %s: %+v", id, err) - } - d.SetId(id.ID()) + if model := resp.Model; model != nil { + if resp.Model.Id == nil && *resp.Model.Id == "" { + return fmt.Errorf("API returns a nil/empty id on %s: %+v", id, err) + } + d.SetId(id.ID()) - if props := resp.VirtualNetworkProperties; props != nil { - if as := props.AllowedSubnets; as != nil { - if err := d.Set("allowed_subnets", flattenDevTestVirtualNetworkAllowedSubnets(as)); err != nil { - return fmt.Errorf("setting `allowed_subnets`: %v", err) + if props := model.Properties; props != nil { + if as := props.AllowedSubnets; as != nil { + if err := d.Set("allowed_subnets", flattenDevTestVirtualNetworkAllowedSubnets(as)); err != nil { + return fmt.Errorf("setting `allowed_subnets`: %v", err) + } } - } - if so := props.SubnetOverrides; so != nil { - if err := d.Set("subnet_overrides", flattenDevTestVirtualNetworkSubnetOverrides(so)); err != nil { - return fmt.Errorf("setting `subnet_overrides`: %v", err) + if so := props.SubnetOverrides; so != nil { + if err := d.Set("subnet_overrides", flattenDevTestVirtualNetworkSubnetOverrides(so)); err != nil { + return fmt.Errorf("setting `subnet_overrides`: %v", err) + } } + d.Set("unique_identifier", props.UniqueIdentifier) } - d.Set("unique_identifier", props.UniqueIdentifier) } return nil } -func flattenDevTestVirtualNetworkAllowedSubnets(input *[]dtl.Subnet) []interface{} { +func flattenDevTestVirtualNetworkAllowedSubnets(input *[]virtualnetworks.Subnet) []interface{} { result := make([]interface{}, 0) if input == nil { @@ -144,9 +145,9 @@ func flattenDevTestVirtualNetworkAllowedSubnets(input *[]dtl.Subnet) []interface for _, v := range *input { allowedSubnet := make(map[string]interface{}) - allowedSubnet["allow_public_ip"] = string(v.AllowPublicIP) + allowedSubnet["allow_public_ip"] = v.AllowPublicIP - if resourceID := v.ResourceID; resourceID != nil { + if resourceID := v.ResourceId; resourceID != nil { allowedSubnet["resource_id"] = *resourceID } @@ -160,7 +161,7 @@ func flattenDevTestVirtualNetworkAllowedSubnets(input *[]dtl.Subnet) []interface return result } -func flattenDevTestVirtualNetworkSubnetOverrides(input *[]dtl.SubnetOverride) []interface{} { +func flattenDevTestVirtualNetworkSubnetOverrides(input *[]virtualnetworks.SubnetOverride) []interface{} { result := make([]interface{}, 0) if input == nil { @@ -172,12 +173,12 @@ func flattenDevTestVirtualNetworkSubnetOverrides(input *[]dtl.SubnetOverride) [] if v.LabSubnetName != nil { subnetOverride["lab_subnet_name"] = *v.LabSubnetName } - if v.ResourceID != nil { - subnetOverride["resource_id"] = *v.ResourceID + if v.ResourceId != nil { + subnetOverride["resource_id"] = *v.ResourceId } - subnetOverride["use_public_ip_address_permission"] = string(v.UsePublicIPAddressPermission) - subnetOverride["use_in_vm_creation_permission"] = string(v.UseInVMCreationPermission) + subnetOverride["use_public_ip_address_permission"] = v.UsePublicIPAddressPermission + subnetOverride["use_in_vm_creation_permission"] = v.UseInVMCreationPermission if v.VirtualNetworkPoolName != nil { subnetOverride["virtual_network_pool_name"] = *v.VirtualNetworkPoolName diff --git a/internal/services/devtestlabs/dev_test_virtual_network_resource.go b/internal/services/devtestlabs/dev_test_virtual_network_resource.go index 044064594beb..723d5960635b 100644 --- a/internal/services/devtestlabs/dev_test_virtual_network_resource.go +++ b/internal/services/devtestlabs/dev_test_virtual_network_resource.go @@ -6,12 +6,12 @@ import ( "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -27,7 +27,7 @@ func resourceArmDevTestVirtualNetwork() *pluginsdk.Resource { Update: resourceArmDevTestVirtualNetworkUpdate, Delete: resourceArmDevTestVirtualNetworkDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DevTestVirtualNetworkID(id) + _, err := virtualnetworks.ParseVirtualNetworkID(id) return err }), @@ -83,14 +83,14 @@ func resourceArmDevTestVirtualNetwork() *pluginsdk.Resource { "use_in_virtual_machine_creation": { Type: pluginsdk.TypeString, Optional: true, - Default: string(dtl.Allow), + Default: string(virtualnetworks.UsagePermissionTypeAllow), ValidateFunc: validate.DevTestVirtualNetworkUsagePermissionType(), }, "use_public_ip_address": { Type: pluginsdk.TypeString, Optional: true, - Default: string(dtl.Allow), + Default: string(virtualnetworks.UsagePermissionTypeAllow), ValidateFunc: validate.DevTestVirtualNetworkUsagePermissionType(), }, }, @@ -115,44 +115,38 @@ func resourceArmDevTestVirtualNetworkCreate(d *pluginsdk.ResourceData, meta inte log.Printf("[INFO] preparing arguments for DevTest Virtual Network creation") - id := parse.NewDevTestVirtualNetworkID(subscriptionId, d.Get("resource_group_name").(string), d.Get("lab_name").(string), d.Get("name").(string)) + id := virtualnetworks.NewVirtualNetworkID(subscriptionId, d.Get("resource_group_name").(string), d.Get("lab_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.LabName, id.VirtualNetworkName, "") + existing, err := client.Get(ctx, id, virtualnetworks.GetOperationOptions{}) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_dev_test_virtual_network", id.ID()) } } description := d.Get("description").(string) - t := d.Get("tags").(map[string]interface{}) - subnetsRaw := d.Get("subnet").([]interface{}) - subnets := expandDevTestVirtualNetworkSubnets(subnetsRaw, subscriptionId, id.ResourceGroup, id.VirtualNetworkName) + subnets := expandDevTestVirtualNetworkSubnets(subnetsRaw, subscriptionId, id.ResourceGroupName, id.VirtualNetworkName) - parameters := dtl.VirtualNetwork{ - Tags: tags.Expand(t), - VirtualNetworkProperties: &dtl.VirtualNetworkProperties{ + parameters := virtualnetworks.VirtualNetwork{ + Tags: expandTags(d.Get("tags").(map[string]interface{})), + Properties: &virtualnetworks.VirtualNetworkProperties{ Description: utils.String(description), SubnetOverrides: subnets, }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.LabName, id.VirtualNetworkName, parameters) + err := client.CreateOrUpdateThenPoll(ctx, id, parameters) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceArmDevTestVirtualNetworkUpdate(d, meta) @@ -163,14 +157,14 @@ func resourceArmDevTestVirtualNetworkRead(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DevTestVirtualNetworkID(d.Id()) + id, err := virtualnetworks.ParseVirtualNetworkID(d.Id()) if err != nil { return err } - read, err := client.Get(ctx, id.ResourceGroup, id.LabName, id.VirtualNetworkName, "") + read, err := client.Get(ctx, *id, virtualnetworks.GetOperationOptions{}) if err != nil { - if utils.ResponseWasNotFound(read.Response) { + if response.WasNotFound(read.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -181,21 +175,26 @@ func resourceArmDevTestVirtualNetworkRead(d *pluginsdk.ResourceData, meta interf d.Set("name", id.VirtualNetworkName) d.Set("lab_name", id.LabName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - if props := read.VirtualNetworkProperties; props != nil { - d.Set("description", props.Description) + if model := read.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("description", props.Description) + + flattenedSubnets := flattenDevTestVirtualNetworkSubnets(props.SubnetOverrides) + if err := d.Set("subnet", flattenedSubnets); err != nil { + return fmt.Errorf("setting `subnet`: %+v", err) + } - flattenedSubnets := flattenDevTestVirtualNetworkSubnets(props.SubnetOverrides) - if err := d.Set("subnet", flattenedSubnets); err != nil { - return fmt.Errorf("setting `subnet`: %+v", err) + // Computed fields + d.Set("unique_identifier", props.UniqueIdentifier) } - // Computed fields - d.Set("unique_identifier", props.UniqueIdentifier) + if err = tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + return err + } } - - return tags.FlattenAndSet(d, read.Tags) + return nil } func resourceArmDevTestVirtualNetworkUpdate(d *pluginsdk.ResourceData, meta interface{}) error { @@ -205,32 +204,28 @@ func resourceArmDevTestVirtualNetworkUpdate(d *pluginsdk.ResourceData, meta inte defer cancel() log.Printf("[INFO] preparing arguments for DevTest Virtual Network creation") - - id := parse.NewDevTestVirtualNetworkID(subscriptionId, d.Get("resource_group_name").(string), d.Get("lab_name").(string), d.Get("name").(string)) + id, err := virtualnetworks.ParseVirtualNetworkID(d.Id()) + if err != nil { + return err + } description := d.Get("description").(string) - t := d.Get("tags").(map[string]interface{}) - subnetsRaw := d.Get("subnet").([]interface{}) - subnets := expandDevTestVirtualNetworkSubnets(subnetsRaw, subscriptionId, id.ResourceGroup, id.VirtualNetworkName) + subnets := expandDevTestVirtualNetworkSubnets(subnetsRaw, subscriptionId, id.ResourceGroupName, id.VirtualNetworkName) - parameters := dtl.VirtualNetwork{ - Tags: tags.Expand(t), - VirtualNetworkProperties: &dtl.VirtualNetworkProperties{ + parameters := virtualnetworks.VirtualNetwork{ + Tags: expandTags(d.Get("tags").(map[string]interface{})), + Properties: &virtualnetworks.VirtualNetworkProperties{ Description: utils.String(description), SubnetOverrides: subnets, }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.LabName, id.VirtualNetworkName, parameters) + err = client.CreateOrUpdateThenPoll(ctx, *id, parameters) if err != nil { return fmt.Errorf("updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceArmDevTestVirtualNetworkRead(d, meta) @@ -241,14 +236,14 @@ func resourceArmDevTestVirtualNetworkDelete(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DevTestVirtualNetworkID(d.Id()) + id, err := virtualnetworks.ParseVirtualNetworkID(d.Id()) if err != nil { return err } - read, err := client.Get(ctx, id.ResourceGroup, id.LabName, id.VirtualNetworkName, "") + read, err := client.Get(ctx, *id, virtualnetworks.GetOperationOptions{}) if err != nil { - if utils.ResponseWasNotFound(read.Response) { + if response.WasNotFound(read.HttpResponse) { // deleted outside of TF log.Printf("[DEBUG] %s was not found - assuming removed!", *id) return nil @@ -257,15 +252,11 @@ func resourceArmDevTestVirtualNetworkDelete(d *pluginsdk.ResourceData, meta inte return fmt.Errorf("retrieving %s: %+v", *id, err) } - future, err := client.Delete(ctx, id.ResourceGroup, id.LabName, id.VirtualNetworkName) + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) - } - return err } @@ -275,18 +266,20 @@ func ValidateDevTestVirtualNetworkName() pluginsdk.SchemaValidateFunc { "Virtual Network Name can only include alphanumeric characters, underscores, hyphens.") } -func expandDevTestVirtualNetworkSubnets(input []interface{}, subscriptionId, resourceGroupName, virtualNetworkName string) *[]dtl.SubnetOverride { - results := make([]dtl.SubnetOverride, 0) +func expandDevTestVirtualNetworkSubnets(input []interface{}, subscriptionId, resourceGroupName, virtualNetworkName string) *[]virtualnetworks.SubnetOverride { + results := make([]virtualnetworks.SubnetOverride, 0) // default found from the Portal name := fmt.Sprintf("%sSubnet", virtualNetworkName) idFmt := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/virtualNetworks/%s/subnets/%s" subnetId := fmt.Sprintf(idFmt, subscriptionId, resourceGroupName, virtualNetworkName, name) + allow := virtualnetworks.UsagePermissionTypeAllow + if len(input) == 0 { - result := dtl.SubnetOverride{ - ResourceID: utils.String(subnetId), + result := virtualnetworks.SubnetOverride{ + ResourceId: utils.String(subnetId), LabSubnetName: utils.String(name), - UsePublicIPAddressPermission: dtl.Allow, - UseInVMCreationPermission: dtl.Allow, + UsePublicIPAddressPermission: &allow, + UseInVMCreationPermission: &allow, } results = append(results, result) return &results @@ -294,14 +287,14 @@ func expandDevTestVirtualNetworkSubnets(input []interface{}, subscriptionId, res for _, val := range input { v := val.(map[string]interface{}) - usePublicIPAddress := v["use_public_ip_address"].(string) - useInVirtualMachineCreation := v["use_in_virtual_machine_creation"].(string) + usePublicIPAddress := virtualnetworks.UsagePermissionType(v["use_public_ip_address"].(string)) + useInVirtualMachineCreation := virtualnetworks.UsagePermissionType(v["use_in_virtual_machine_creation"].(string)) - subnet := dtl.SubnetOverride{ - ResourceID: utils.String(subnetId), + subnet := virtualnetworks.SubnetOverride{ + ResourceId: utils.String(subnetId), LabSubnetName: utils.String(name), - UsePublicIPAddressPermission: dtl.UsagePermissionType(usePublicIPAddress), - UseInVMCreationPermission: dtl.UsagePermissionType(useInVirtualMachineCreation), + UsePublicIPAddressPermission: &usePublicIPAddress, + UseInVMCreationPermission: &useInVirtualMachineCreation, } results = append(results, subnet) } @@ -309,7 +302,7 @@ func expandDevTestVirtualNetworkSubnets(input []interface{}, subscriptionId, res return &results } -func flattenDevTestVirtualNetworkSubnets(input *[]dtl.SubnetOverride) []interface{} { +func flattenDevTestVirtualNetworkSubnets(input *[]virtualnetworks.SubnetOverride) []interface{} { outputs := make([]interface{}, 0) if input == nil { return outputs @@ -320,8 +313,8 @@ func flattenDevTestVirtualNetworkSubnets(input *[]dtl.SubnetOverride) []interfac if v.LabSubnetName != nil { output["name"] = *v.LabSubnetName } - output["use_public_ip_address"] = string(v.UsePublicIPAddressPermission) - output["use_in_virtual_machine_creation"] = string(v.UseInVMCreationPermission) + output["use_public_ip_address"] = v.UsePublicIPAddressPermission + output["use_in_virtual_machine_creation"] = v.UseInVMCreationPermission outputs = append(outputs, output) } diff --git a/internal/services/devtestlabs/dev_test_virtual_network_resource_test.go b/internal/services/devtestlabs/dev_test_virtual_network_resource_test.go index a08d7167432c..8833c132d658 100644 --- a/internal/services/devtestlabs/dev_test_virtual_network_resource_test.go +++ b/internal/services/devtestlabs/dev_test_virtual_network_resource_test.go @@ -5,11 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -98,18 +98,44 @@ func TestAccDevTestVirtualNetwork_subnet(t *testing.T) { }) } +func TestAccDevTestVirtualNetwork_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_dev_test_virtual_network", "test") + r := DevTestVirtualNetworkResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("tags.%").HasValue("0"), + ), + }, + { + Config: r.subnets(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("subnet.#").HasValue("1"), + check.That(data.ResourceName).Key("subnet.0.use_public_ip_address").HasValue("Deny"), + check.That(data.ResourceName).Key("subnet.0.use_in_virtual_machine_creation").HasValue("Allow"), + check.That(data.ResourceName).Key("tags.%").HasValue("0"), + ), + }, + data.ImportStep(), + }) +} + func (DevTestVirtualNetworkResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DevTestVirtualNetworkID(state.ID) + id, err := virtualnetworks.ParseVirtualNetworkID(state.ID) if err != nil { return nil, err } - resp, err := clients.DevTestLabs.VirtualNetworksClient.Get(ctx, id.ResourceGroup, id.LabName, id.VirtualNetworkName, "") + resp, err := clients.DevTestLabs.VirtualNetworksClient.Get(ctx, *id, virtualnetworks.GetOperationOptions{}) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", *id, err) } - return utils.Bool(resp.VirtualNetworkProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (DevTestVirtualNetworkResource) basic(data acceptance.TestData) string { diff --git a/internal/services/devtestlabs/dev_test_windows_virtual_machine_resource.go b/internal/services/devtestlabs/dev_test_windows_virtual_machine_resource.go index d334b6a2e645..69c090f1fae4 100644 --- a/internal/services/devtestlabs/dev_test_windows_virtual_machine_resource.go +++ b/internal/services/devtestlabs/dev_test_windows_virtual_machine_resource.go @@ -5,13 +5,13 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -27,7 +27,7 @@ func resourceArmDevTestWindowsVirtualMachine() *pluginsdk.Resource { Update: resourceArmDevTestWindowsVirtualMachineCreateUpdate, Delete: resourceArmDevTestWindowsVirtualMachineDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DevTestVirtualMachineID(id) + _, err := virtualmachines.ParseVirtualMachineID(id) return err }), @@ -81,7 +81,8 @@ func resourceArmDevTestWindowsVirtualMachine() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, // since this isn't returned from the API - ForceNew: true, + ForceNew: true, + Sensitive: true, }, "storage_type": { @@ -151,23 +152,21 @@ func resourceArmDevTestWindowsVirtualMachineCreateUpdate(d *pluginsdk.ResourceDa log.Printf("[INFO] preparing arguments for DevTest Windows Virtual Machine creation") - id := parse.NewDevTestVirtualMachineID(subscriptionId, d.Get("resource_group_name").(string), d.Get("lab_name").(string), d.Get("name").(string)) + id := virtualmachines.NewVirtualMachineID(subscriptionId, d.Get("resource_group_name").(string), d.Get("lab_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.LabName, id.VirtualMachineName, "") + existing, err := client.Get(ctx, id, virtualmachines.GetOperationOptions{}) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_dev_test_windows_virtual_machine", id.ID()) } } - t := d.Get("tags").(map[string]interface{}) - allowClaim := d.Get("allow_claim").(bool) disallowPublicIPAddress := d.Get("disallow_public_ip_address").(bool) labSubnetName := d.Get("lab_subnet_name").(string) @@ -186,25 +185,25 @@ func resourceArmDevTestWindowsVirtualMachineCreateUpdate(d *pluginsdk.ResourceDa natRules := expandDevTestLabVirtualMachineNatRules(natRulesRaw) if len(natRules) > 0 && !disallowPublicIPAddress { - return fmt.Errorf("If `inbound_nat_rule` is specified then `disallow_public_ip_address` must be set to true.") + return fmt.Errorf("if `inbound_nat_rule` is specified then `disallow_public_ip_address` must be set to true") } - nic := dtl.NetworkInterfaceProperties{} + nic := virtualmachines.NetworkInterfaceProperties{} if disallowPublicIPAddress { - nic.SharedPublicIPAddressConfiguration = &dtl.SharedPublicIPAddressConfiguration{ + nic.SharedPublicIPAddressConfiguration = &virtualmachines.SharedPublicIPAddressConfiguration{ InboundNatRules: &natRules, } } - parameters := dtl.LabVirtualMachine{ + parameters := virtualmachines.LabVirtualMachine{ Location: utils.String(location), - LabVirtualMachineProperties: &dtl.LabVirtualMachineProperties{ + Properties: virtualmachines.LabVirtualMachineProperties{ AllowClaim: utils.Bool(allowClaim), - IsAuthenticationWithSSHKey: utils.Bool(false), + IsAuthenticationWithSshKey: utils.Bool(false), DisallowPublicIPAddress: utils.Bool(disallowPublicIPAddress), GalleryImageReference: galleryImageReference, LabSubnetName: utils.String(labSubnetName), - LabVirtualNetworkID: utils.String(labVirtualNetworkId), + LabVirtualNetworkId: utils.String(labVirtualNetworkId), NetworkInterface: &nic, OsType: utils.String("Windows"), Notes: utils.String(notes), @@ -213,18 +212,14 @@ func resourceArmDevTestWindowsVirtualMachineCreateUpdate(d *pluginsdk.ResourceDa StorageType: utils.String(storageType), UserName: utils.String(username), }, - Tags: tags.Expand(t), + Tags: expandTags(d.Get("tags").(map[string]interface{})), } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.LabName, id.VirtualMachineName, parameters) + err := client.CreateOrUpdateThenPoll(ctx, id, parameters) if err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceArmDevTestWindowsVirtualMachineRead(d, meta) @@ -235,14 +230,14 @@ func resourceArmDevTestWindowsVirtualMachineRead(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DevTestVirtualMachineID(d.Id()) + id, err := virtualmachines.ParseVirtualMachineID(d.Id()) if err != nil { return err } - read, err := client.Get(ctx, id.ResourceGroup, id.LabName, id.VirtualMachineName, "") + read, err := client.Get(ctx, *id, virtualmachines.GetOperationOptions{}) if err != nil { - if utils.ResponseWasNotFound(read.Response) { + if response.WasNotFound(read.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -253,12 +248,14 @@ func resourceArmDevTestWindowsVirtualMachineRead(d *pluginsdk.ResourceData, meta d.Set("name", id.VirtualMachineName) d.Set("lab_name", id.LabName) - d.Set("resource_group_name", id.ResourceGroup) - if location := read.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + d.Set("resource_group_name", id.ResourceGroupName) + + if model := read.Model; model != nil { + if location := model.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) + } - if props := read.LabVirtualMachineProperties; props != nil { + props := model.Properties d.Set("allow_claim", props.AllowClaim) d.Set("disallow_public_ip_address", props.DisallowPublicIPAddress) d.Set("notes", props.Notes) @@ -274,9 +271,12 @@ func resourceArmDevTestWindowsVirtualMachineRead(d *pluginsdk.ResourceData, meta // Computed fields d.Set("fqdn", props.Fqdn) d.Set("unique_identifier", props.UniqueIdentifier) - } - return tags.FlattenAndSet(d, read.Tags) + if err = tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + return err + } + } + return nil } func resourceArmDevTestWindowsVirtualMachineDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -284,14 +284,14 @@ func resourceArmDevTestWindowsVirtualMachineDelete(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DevTestVirtualMachineID(d.Id()) + id, err := virtualmachines.ParseVirtualMachineID(d.Id()) if err != nil { return err } - read, err := client.Get(ctx, id.ResourceGroup, id.LabName, id.VirtualMachineName, "") + read, err := client.Get(ctx, *id, virtualmachines.GetOperationOptions{}) if err != nil { - if utils.ResponseWasNotFound(read.Response) { + if response.WasNotFound(read.HttpResponse) { // deleted outside of TF log.Printf("[DEBUG] %s was not found - assuming removed!", *id) return nil @@ -300,14 +300,10 @@ func resourceArmDevTestWindowsVirtualMachineDelete(d *pluginsdk.ResourceData, me return fmt.Errorf("retrieving %s: %+v", *id, err) } - future, err := client.Delete(ctx, id.ResourceGroup, id.LabName, id.VirtualMachineName) + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) - } - return err } diff --git a/internal/services/devtestlabs/dev_test_windows_virtual_machine_resource_test.go b/internal/services/devtestlabs/dev_test_windows_virtual_machine_resource_test.go index 63a0eb127224..6d70ccf22aa9 100644 --- a/internal/services/devtestlabs/dev_test_windows_virtual_machine_resource_test.go +++ b/internal/services/devtestlabs/dev_test_windows_virtual_machine_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -107,17 +107,17 @@ func TestAccDevTestWindowsVirtualMachine_updateStorage(t *testing.T) { } func (DevTestVirtualMachineResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DevTestVirtualMachineID(state.ID) + id, err := virtualmachines.ParseVirtualMachineID(state.ID) if err != nil { return nil, err } - resp, err := clients.DevTestLabs.VirtualMachinesClient.Get(ctx, id.ResourceGroup, id.LabName, id.VirtualMachineName, "") + resp, err := clients.DevTestLabs.VirtualMachinesClient.Get(ctx, *id, virtualmachines.GetOperationOptions{}) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", *id, err) } - return utils.Bool(resp.LabVirtualMachineProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (r DevTestVirtualMachineResource) basic(data acceptance.TestData) string { @@ -169,7 +169,7 @@ resource "azurerm_dev_test_windows_virtual_machine" "import" { version = "latest" } } -`, r.template(data)) +`, r.basic(data)) } func (r DevTestVirtualMachineResource) inboundNatRules(data acceptance.TestData) string { diff --git a/internal/services/devtestlabs/helpers.go b/internal/services/devtestlabs/helpers.go index bfaf762a50bd..8647a40c9484 100644 --- a/internal/services/devtestlabs/helpers.go +++ b/internal/services/devtestlabs/helpers.go @@ -1,7 +1,7 @@ package devtestlabs import ( - "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -20,8 +20,8 @@ func schemaDevTestVirtualMachineInboundNatRule() *pluginsdk.Schema { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(dtl.TCP), - string(dtl.UDP), + string(virtualmachines.TransportProtocolTcp), + string(virtualmachines.TransportProtocolUdp), }, false), }, @@ -41,8 +41,8 @@ func schemaDevTestVirtualMachineInboundNatRule() *pluginsdk.Schema { } } -func expandDevTestLabVirtualMachineNatRules(input *pluginsdk.Set) []dtl.InboundNatRule { - rules := make([]dtl.InboundNatRule, 0) +func expandDevTestLabVirtualMachineNatRules(input *pluginsdk.Set) []virtualmachines.InboundNatRule { + rules := make([]virtualmachines.InboundNatRule, 0) if input == nil { return rules } @@ -50,11 +50,11 @@ func expandDevTestLabVirtualMachineNatRules(input *pluginsdk.Set) []dtl.InboundN for _, val := range input.List() { v := val.(map[string]interface{}) backendPort := v["backend_port"].(int) - protocol := v["protocol"].(string) + protocol := virtualmachines.TransportProtocol(v["protocol"].(string)) - rule := dtl.InboundNatRule{ - TransportProtocol: dtl.TransportProtocol(protocol), - BackendPort: utils.Int32(int32(backendPort)), + rule := virtualmachines.InboundNatRule{ + TransportProtocol: &protocol, + BackendPort: utils.Int64(int64(backendPort)), } rules = append(rules, rule) @@ -63,7 +63,7 @@ func expandDevTestLabVirtualMachineNatRules(input *pluginsdk.Set) []dtl.InboundN return rules } -func expandDevTestLabVirtualMachineGalleryImageReference(input []interface{}, osType string) *dtl.GalleryImageReference { +func expandDevTestLabVirtualMachineGalleryImageReference(input []interface{}, osType string) *virtualmachines.GalleryImageReference { if len(input) == 0 { return nil } @@ -74,7 +74,7 @@ func expandDevTestLabVirtualMachineGalleryImageReference(input []interface{}, os sku := v["sku"].(string) version := v["version"].(string) - return &dtl.GalleryImageReference{ + return &virtualmachines.GalleryImageReference{ Offer: utils.String(offer), OsType: utils.String(osType), Publisher: utils.String(publisher), @@ -115,7 +115,7 @@ func schemaDevTestVirtualMachineGalleryImageReference() *pluginsdk.Schema { } } -func flattenDevTestVirtualMachineGalleryImage(input *dtl.GalleryImageReference) []interface{} { +func flattenDevTestVirtualMachineGalleryImage(input *virtualmachines.GalleryImageReference) []interface{} { results := make([]interface{}, 0) if input != nil { diff --git a/internal/services/devtestlabs/migration/dev_test_lab.go b/internal/services/devtestlabs/migration/dev_test_lab.go index 06cef1054aa7..7e705d8571b2 100644 --- a/internal/services/devtestlabs/migration/dev_test_lab.go +++ b/internal/services/devtestlabs/migration/dev_test_lab.go @@ -5,8 +5,8 @@ import ( "log" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -26,7 +26,7 @@ func (DevTestLabUpgradeV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { // new: // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName} oldId := rawState["id"].(string) - id, err := parse.DevTestLabIDInsensitively(oldId) + id, err := labs.ParseLabIDInsensitively(oldId) if err != nil { return rawState, err } diff --git a/internal/services/devtestlabs/migration/dev_test_lab_schedule.go b/internal/services/devtestlabs/migration/dev_test_lab_schedule.go index 9887c9b93191..ce5d328ce18e 100644 --- a/internal/services/devtestlabs/migration/dev_test_lab_schedule.go +++ b/internal/services/devtestlabs/migration/dev_test_lab_schedule.go @@ -5,8 +5,8 @@ import ( "log" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -26,7 +26,7 @@ func (DevTestLabScheduleUpgradeV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc // new: // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{scheduleName} oldId := rawState["id"].(string) - id, err := parse.DevTestLabScheduleIDInsensitively(oldId) + id, err := schedules.ParseLabScheduleIDInsensitively(oldId) if err != nil { return rawState, err } diff --git a/internal/services/devtestlabs/migration/dev_test_linux_virtual_machine.go b/internal/services/devtestlabs/migration/dev_test_linux_virtual_machine.go index 80a798aa3029..161168472c84 100644 --- a/internal/services/devtestlabs/migration/dev_test_linux_virtual_machine.go +++ b/internal/services/devtestlabs/migration/dev_test_linux_virtual_machine.go @@ -5,8 +5,8 @@ import ( "log" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -27,7 +27,7 @@ func (DevTestLinuxVirtualMachineUpgradeV0ToV1) UpgradeFunc() pluginsdk.StateUpgr // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualMachines/{virtualMachineName} oldId := rawState["id"].(string) - id, err := parse.DevTestVirtualMachineIDInsensitively(oldId) + id, err := virtualmachines.ParseVirtualMachineIDInsensitively(oldId) if err != nil { return rawState, err } diff --git a/internal/services/devtestlabs/migration/dev_test_policy.go b/internal/services/devtestlabs/migration/dev_test_policy.go index 6c63b0f9be9b..12c08656f9e9 100644 --- a/internal/services/devtestlabs/migration/dev_test_policy.go +++ b/internal/services/devtestlabs/migration/dev_test_policy.go @@ -4,8 +4,8 @@ import ( "context" "log" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -25,7 +25,7 @@ func (DevTestLabPolicyUpgradeV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { // new: // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policySets/{policySetName}/policies/{policyName} oldId := rawState["id"].(string) - id, err := parse.DevTestLabPolicyIDInsensitively(oldId) + id, err := policies.ParsePolicyIDInsensitively(oldId) if err != nil { return rawState, err } diff --git a/internal/services/devtestlabs/migration/dev_test_virtual_network.go b/internal/services/devtestlabs/migration/dev_test_virtual_network.go index 698de33d6afa..0cc22299d6fd 100644 --- a/internal/services/devtestlabs/migration/dev_test_virtual_network.go +++ b/internal/services/devtestlabs/migration/dev_test_virtual_network.go @@ -4,8 +4,8 @@ import ( "context" "log" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -25,7 +25,7 @@ func (DevTestVirtualNetworkUpgradeV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderF // new: // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualNetworks/{virtualNetworkName} oldId := rawState["id"].(string) - id, err := parse.DevTestVirtualNetworkIDInsensitively(oldId) + id, err := virtualnetworks.ParseVirtualNetworkIDInsensitively(oldId) if err != nil { return rawState, err } diff --git a/internal/services/devtestlabs/migration/dev_test_windows_virtual_machine.go b/internal/services/devtestlabs/migration/dev_test_windows_virtual_machine.go index 36f71906321a..ac5a564a8422 100644 --- a/internal/services/devtestlabs/migration/dev_test_windows_virtual_machine.go +++ b/internal/services/devtestlabs/migration/dev_test_windows_virtual_machine.go @@ -5,8 +5,8 @@ import ( "log" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -26,7 +26,7 @@ func (DevTestWindowsVirtualMachineUpgradeV0ToV1) UpgradeFunc() pluginsdk.StateUp // new: // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualMachines/{virtualMachineName} oldId := rawState["id"].(string) - id, err := parse.DevTestVirtualMachineIDInsensitively(oldId) + id, err := virtualmachines.ParseVirtualMachineIDInsensitively(oldId) if err != nil { return rawState, err } diff --git a/internal/services/devtestlabs/parse/dev_test_lab.go b/internal/services/devtestlabs/parse/dev_test_lab.go deleted file mode 100644 index 44b3094c86fd..000000000000 --- a/internal/services/devtestlabs/parse/dev_test_lab.go +++ /dev/null @@ -1,113 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DevTestLabId struct { - SubscriptionId string - ResourceGroup string - LabName string -} - -func NewDevTestLabID(subscriptionId, resourceGroup, labName string) DevTestLabId { - return DevTestLabId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - LabName: labName, - } -} - -func (id DevTestLabId) String() string { - segments := []string{ - fmt.Sprintf("Lab Name %q", id.LabName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Dev Test Lab", segmentsStr) -} - -func (id DevTestLabId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.LabName) -} - -// DevTestLabID parses a DevTestLab ID into an DevTestLabId struct -func DevTestLabID(input string) (*DevTestLabId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DevTestLabId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.LabName, err = id.PopSegment("labs"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// DevTestLabIDInsensitively parses an DevTestLab ID into an DevTestLabId struct, insensitively -// This should only be used to parse an ID for rewriting, the DevTestLabID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func DevTestLabIDInsensitively(input string) (*DevTestLabId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DevTestLabId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'labs' segment - labsKey := "labs" - for key := range id.Path { - if strings.EqualFold(key, labsKey) { - labsKey = key - break - } - } - if resourceId.LabName, err = id.PopSegment(labsKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/devtestlabs/parse/dev_test_lab_policy.go b/internal/services/devtestlabs/parse/dev_test_lab_policy.go deleted file mode 100644 index e6249a81e4b1..000000000000 --- a/internal/services/devtestlabs/parse/dev_test_lab_policy.go +++ /dev/null @@ -1,149 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DevTestLabPolicyId struct { - SubscriptionId string - ResourceGroup string - LabName string - PolicySetName string - PolicyName string -} - -func NewDevTestLabPolicyID(subscriptionId, resourceGroup, labName, policySetName, policyName string) DevTestLabPolicyId { - return DevTestLabPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - LabName: labName, - PolicySetName: policySetName, - PolicyName: policyName, - } -} - -func (id DevTestLabPolicyId) String() string { - segments := []string{ - fmt.Sprintf("Policy Name %q", id.PolicyName), - fmt.Sprintf("Policy Set Name %q", id.PolicySetName), - fmt.Sprintf("Lab Name %q", id.LabName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Dev Test Lab Policy", segmentsStr) -} - -func (id DevTestLabPolicyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s/policySets/%s/policies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.LabName, id.PolicySetName, id.PolicyName) -} - -// DevTestLabPolicyID parses a DevTestLabPolicy ID into an DevTestLabPolicyId struct -func DevTestLabPolicyID(input string) (*DevTestLabPolicyId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DevTestLabPolicyId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.LabName, err = id.PopSegment("labs"); err != nil { - return nil, err - } - if resourceId.PolicySetName, err = id.PopSegment("policySets"); err != nil { - return nil, err - } - if resourceId.PolicyName, err = id.PopSegment("policies"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// DevTestLabPolicyIDInsensitively parses an DevTestLabPolicy ID into an DevTestLabPolicyId struct, insensitively -// This should only be used to parse an ID for rewriting, the DevTestLabPolicyID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func DevTestLabPolicyIDInsensitively(input string) (*DevTestLabPolicyId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DevTestLabPolicyId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'labs' segment - labsKey := "labs" - for key := range id.Path { - if strings.EqualFold(key, labsKey) { - labsKey = key - break - } - } - if resourceId.LabName, err = id.PopSegment(labsKey); err != nil { - return nil, err - } - - // find the correct casing for the 'policySets' segment - policySetsKey := "policySets" - for key := range id.Path { - if strings.EqualFold(key, policySetsKey) { - policySetsKey = key - break - } - } - if resourceId.PolicySetName, err = id.PopSegment(policySetsKey); err != nil { - return nil, err - } - - // find the correct casing for the 'policies' segment - policiesKey := "policies" - for key := range id.Path { - if strings.EqualFold(key, policiesKey) { - policiesKey = key - break - } - } - if resourceId.PolicyName, err = id.PopSegment(policiesKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/devtestlabs/parse/dev_test_lab_policy_test.go b/internal/services/devtestlabs/parse/dev_test_lab_policy_test.go deleted file mode 100644 index 0e40d4eef1e5..000000000000 --- a/internal/services/devtestlabs/parse/dev_test_lab_policy_test.go +++ /dev/null @@ -1,299 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = DevTestLabPolicyId{} - -func TestDevTestLabPolicyIDFormatter(t *testing.T) { - actual := NewDevTestLabPolicyID("12345678-1234-9876-4563-123456789012", "group1", "lab1", "policyset1", "policy1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/policyset1/policies/policy1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestDevTestLabPolicyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DevTestLabPolicyId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Error: true, - }, - - { - // missing value for LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/", - Error: true, - }, - - { - // missing PolicySetName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/", - Error: true, - }, - - { - // missing value for PolicySetName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/", - Error: true, - }, - - { - // missing PolicyName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/policyset1/", - Error: true, - }, - - { - // missing value for PolicyName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/policyset1/policies/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/policyset1/policies/policy1", - Expected: &DevTestLabPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - PolicySetName: "policyset1", - PolicyName: "policy1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DEVTESTLAB/LABS/LAB1/POLICYSETS/POLICYSET1/POLICIES/POLICY1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DevTestLabPolicyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.LabName != v.Expected.LabName { - t.Fatalf("Expected %q but got %q for LabName", v.Expected.LabName, actual.LabName) - } - if actual.PolicySetName != v.Expected.PolicySetName { - t.Fatalf("Expected %q but got %q for PolicySetName", v.Expected.PolicySetName, actual.PolicySetName) - } - if actual.PolicyName != v.Expected.PolicyName { - t.Fatalf("Expected %q but got %q for PolicyName", v.Expected.PolicyName, actual.PolicyName) - } - } -} - -func TestDevTestLabPolicyIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DevTestLabPolicyId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Error: true, - }, - - { - // missing value for LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/", - Error: true, - }, - - { - // missing PolicySetName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/", - Error: true, - }, - - { - // missing value for PolicySetName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/", - Error: true, - }, - - { - // missing PolicyName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/policyset1/", - Error: true, - }, - - { - // missing value for PolicyName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/policyset1/policies/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/policyset1/policies/policy1", - Expected: &DevTestLabPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - PolicySetName: "policyset1", - PolicyName: "policy1", - }, - }, - - { - // lower-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policysets/policyset1/policies/policy1", - Expected: &DevTestLabPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - PolicySetName: "policyset1", - PolicyName: "policy1", - }, - }, - - { - // upper-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/LABS/lab1/POLICYSETS/policyset1/POLICIES/policy1", - Expected: &DevTestLabPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - PolicySetName: "policyset1", - PolicyName: "policy1", - }, - }, - - { - // mixed-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/LaBs/lab1/PoLiCySeTs/policyset1/PoLiCiEs/policy1", - Expected: &DevTestLabPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - PolicySetName: "policyset1", - PolicyName: "policy1", - }, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DevTestLabPolicyIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.LabName != v.Expected.LabName { - t.Fatalf("Expected %q but got %q for LabName", v.Expected.LabName, actual.LabName) - } - if actual.PolicySetName != v.Expected.PolicySetName { - t.Fatalf("Expected %q but got %q for PolicySetName", v.Expected.PolicySetName, actual.PolicySetName) - } - if actual.PolicyName != v.Expected.PolicyName { - t.Fatalf("Expected %q but got %q for PolicyName", v.Expected.PolicyName, actual.PolicyName) - } - } -} diff --git a/internal/services/devtestlabs/parse/dev_test_lab_schedule.go b/internal/services/devtestlabs/parse/dev_test_lab_schedule.go deleted file mode 100644 index ec174fd39201..000000000000 --- a/internal/services/devtestlabs/parse/dev_test_lab_schedule.go +++ /dev/null @@ -1,131 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DevTestLabScheduleId struct { - SubscriptionId string - ResourceGroup string - LabName string - ScheduleName string -} - -func NewDevTestLabScheduleID(subscriptionId, resourceGroup, labName, scheduleName string) DevTestLabScheduleId { - return DevTestLabScheduleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - LabName: labName, - ScheduleName: scheduleName, - } -} - -func (id DevTestLabScheduleId) String() string { - segments := []string{ - fmt.Sprintf("Schedule Name %q", id.ScheduleName), - fmt.Sprintf("Lab Name %q", id.LabName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Dev Test Lab Schedule", segmentsStr) -} - -func (id DevTestLabScheduleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s/schedules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.LabName, id.ScheduleName) -} - -// DevTestLabScheduleID parses a DevTestLabSchedule ID into an DevTestLabScheduleId struct -func DevTestLabScheduleID(input string) (*DevTestLabScheduleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DevTestLabScheduleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.LabName, err = id.PopSegment("labs"); err != nil { - return nil, err - } - if resourceId.ScheduleName, err = id.PopSegment("schedules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// DevTestLabScheduleIDInsensitively parses an DevTestLabSchedule ID into an DevTestLabScheduleId struct, insensitively -// This should only be used to parse an ID for rewriting, the DevTestLabScheduleID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func DevTestLabScheduleIDInsensitively(input string) (*DevTestLabScheduleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DevTestLabScheduleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'labs' segment - labsKey := "labs" - for key := range id.Path { - if strings.EqualFold(key, labsKey) { - labsKey = key - break - } - } - if resourceId.LabName, err = id.PopSegment(labsKey); err != nil { - return nil, err - } - - // find the correct casing for the 'schedules' segment - schedulesKey := "schedules" - for key := range id.Path { - if strings.EqualFold(key, schedulesKey) { - schedulesKey = key - break - } - } - if resourceId.ScheduleName, err = id.PopSegment(schedulesKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/devtestlabs/parse/dev_test_lab_schedule_test.go b/internal/services/devtestlabs/parse/dev_test_lab_schedule_test.go deleted file mode 100644 index babf988f1f29..000000000000 --- a/internal/services/devtestlabs/parse/dev_test_lab_schedule_test.go +++ /dev/null @@ -1,264 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = DevTestLabScheduleId{} - -func TestDevTestLabScheduleIDFormatter(t *testing.T) { - actual := NewDevTestLabScheduleID("12345678-1234-9876-4563-123456789012", "group1", "lab1", "schedule1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/schedules/schedule1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestDevTestLabScheduleID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DevTestLabScheduleId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Error: true, - }, - - { - // missing value for LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/", - Error: true, - }, - - { - // missing ScheduleName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/", - Error: true, - }, - - { - // missing value for ScheduleName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/schedules/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/schedules/schedule1", - Expected: &DevTestLabScheduleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - ScheduleName: "schedule1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DEVTESTLAB/LABS/LAB1/SCHEDULES/SCHEDULE1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DevTestLabScheduleID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.LabName != v.Expected.LabName { - t.Fatalf("Expected %q but got %q for LabName", v.Expected.LabName, actual.LabName) - } - if actual.ScheduleName != v.Expected.ScheduleName { - t.Fatalf("Expected %q but got %q for ScheduleName", v.Expected.ScheduleName, actual.ScheduleName) - } - } -} - -func TestDevTestLabScheduleIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DevTestLabScheduleId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Error: true, - }, - - { - // missing value for LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/", - Error: true, - }, - - { - // missing ScheduleName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/", - Error: true, - }, - - { - // missing value for ScheduleName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/schedules/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/schedules/schedule1", - Expected: &DevTestLabScheduleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - ScheduleName: "schedule1", - }, - }, - - { - // lower-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/schedules/schedule1", - Expected: &DevTestLabScheduleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - ScheduleName: "schedule1", - }, - }, - - { - // upper-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/LABS/lab1/SCHEDULES/schedule1", - Expected: &DevTestLabScheduleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - ScheduleName: "schedule1", - }, - }, - - { - // mixed-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/LaBs/lab1/ScHeDuLeS/schedule1", - Expected: &DevTestLabScheduleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - ScheduleName: "schedule1", - }, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DevTestLabScheduleIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.LabName != v.Expected.LabName { - t.Fatalf("Expected %q but got %q for LabName", v.Expected.LabName, actual.LabName) - } - if actual.ScheduleName != v.Expected.ScheduleName { - t.Fatalf("Expected %q but got %q for ScheduleName", v.Expected.ScheduleName, actual.ScheduleName) - } - } -} diff --git a/internal/services/devtestlabs/parse/dev_test_lab_test.go b/internal/services/devtestlabs/parse/dev_test_lab_test.go deleted file mode 100644 index 61dad02993de..000000000000 --- a/internal/services/devtestlabs/parse/dev_test_lab_test.go +++ /dev/null @@ -1,229 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = DevTestLabId{} - -func TestDevTestLabIDFormatter(t *testing.T) { - actual := NewDevTestLabID("12345678-1234-9876-4563-123456789012", "group1", "lab1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestDevTestLabID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DevTestLabId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Error: true, - }, - - { - // missing value for LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1", - Expected: &DevTestLabId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DEVTESTLAB/LABS/LAB1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DevTestLabID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.LabName != v.Expected.LabName { - t.Fatalf("Expected %q but got %q for LabName", v.Expected.LabName, actual.LabName) - } - } -} - -func TestDevTestLabIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DevTestLabId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Error: true, - }, - - { - // missing value for LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1", - Expected: &DevTestLabId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - }, - }, - - { - // lower-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1", - Expected: &DevTestLabId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - }, - }, - - { - // upper-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/LABS/lab1", - Expected: &DevTestLabId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - }, - }, - - { - // mixed-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/LaBs/lab1", - Expected: &DevTestLabId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - }, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DevTestLabIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.LabName != v.Expected.LabName { - t.Fatalf("Expected %q but got %q for LabName", v.Expected.LabName, actual.LabName) - } - } -} diff --git a/internal/services/devtestlabs/parse/dev_test_virtual_machine.go b/internal/services/devtestlabs/parse/dev_test_virtual_machine.go deleted file mode 100644 index fe04726b0d98..000000000000 --- a/internal/services/devtestlabs/parse/dev_test_virtual_machine.go +++ /dev/null @@ -1,131 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DevTestVirtualMachineId struct { - SubscriptionId string - ResourceGroup string - LabName string - VirtualMachineName string -} - -func NewDevTestVirtualMachineID(subscriptionId, resourceGroup, labName, virtualMachineName string) DevTestVirtualMachineId { - return DevTestVirtualMachineId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - LabName: labName, - VirtualMachineName: virtualMachineName, - } -} - -func (id DevTestVirtualMachineId) String() string { - segments := []string{ - fmt.Sprintf("Virtual Machine Name %q", id.VirtualMachineName), - fmt.Sprintf("Lab Name %q", id.LabName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Dev Test Virtual Machine", segmentsStr) -} - -func (id DevTestVirtualMachineId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s/virtualMachines/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.LabName, id.VirtualMachineName) -} - -// DevTestVirtualMachineID parses a DevTestVirtualMachine ID into an DevTestVirtualMachineId struct -func DevTestVirtualMachineID(input string) (*DevTestVirtualMachineId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DevTestVirtualMachineId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.LabName, err = id.PopSegment("labs"); err != nil { - return nil, err - } - if resourceId.VirtualMachineName, err = id.PopSegment("virtualMachines"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// DevTestVirtualMachineIDInsensitively parses an DevTestVirtualMachine ID into an DevTestVirtualMachineId struct, insensitively -// This should only be used to parse an ID for rewriting, the DevTestVirtualMachineID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func DevTestVirtualMachineIDInsensitively(input string) (*DevTestVirtualMachineId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DevTestVirtualMachineId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'labs' segment - labsKey := "labs" - for key := range id.Path { - if strings.EqualFold(key, labsKey) { - labsKey = key - break - } - } - if resourceId.LabName, err = id.PopSegment(labsKey); err != nil { - return nil, err - } - - // find the correct casing for the 'virtualMachines' segment - virtualMachinesKey := "virtualMachines" - for key := range id.Path { - if strings.EqualFold(key, virtualMachinesKey) { - virtualMachinesKey = key - break - } - } - if resourceId.VirtualMachineName, err = id.PopSegment(virtualMachinesKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/devtestlabs/parse/dev_test_virtual_machine_test.go b/internal/services/devtestlabs/parse/dev_test_virtual_machine_test.go deleted file mode 100644 index 15844ef0bf35..000000000000 --- a/internal/services/devtestlabs/parse/dev_test_virtual_machine_test.go +++ /dev/null @@ -1,264 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = DevTestVirtualMachineId{} - -func TestDevTestVirtualMachineIDFormatter(t *testing.T) { - actual := NewDevTestVirtualMachineID("12345678-1234-9876-4563-123456789012", "group1", "lab1", "vm1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualMachines/vm1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestDevTestVirtualMachineID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DevTestVirtualMachineId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Error: true, - }, - - { - // missing value for LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/", - Error: true, - }, - - { - // missing VirtualMachineName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/", - Error: true, - }, - - { - // missing value for VirtualMachineName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualMachines/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualMachines/vm1", - Expected: &DevTestVirtualMachineId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - VirtualMachineName: "vm1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DEVTESTLAB/LABS/LAB1/VIRTUALMACHINES/VM1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DevTestVirtualMachineID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.LabName != v.Expected.LabName { - t.Fatalf("Expected %q but got %q for LabName", v.Expected.LabName, actual.LabName) - } - if actual.VirtualMachineName != v.Expected.VirtualMachineName { - t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) - } - } -} - -func TestDevTestVirtualMachineIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DevTestVirtualMachineId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Error: true, - }, - - { - // missing value for LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/", - Error: true, - }, - - { - // missing VirtualMachineName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/", - Error: true, - }, - - { - // missing value for VirtualMachineName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualMachines/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualMachines/vm1", - Expected: &DevTestVirtualMachineId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - VirtualMachineName: "vm1", - }, - }, - - { - // lower-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualmachines/vm1", - Expected: &DevTestVirtualMachineId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - VirtualMachineName: "vm1", - }, - }, - - { - // upper-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/LABS/lab1/VIRTUALMACHINES/vm1", - Expected: &DevTestVirtualMachineId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - VirtualMachineName: "vm1", - }, - }, - - { - // mixed-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/LaBs/lab1/ViRtUaLmAcHiNeS/vm1", - Expected: &DevTestVirtualMachineId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - VirtualMachineName: "vm1", - }, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DevTestVirtualMachineIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.LabName != v.Expected.LabName { - t.Fatalf("Expected %q but got %q for LabName", v.Expected.LabName, actual.LabName) - } - if actual.VirtualMachineName != v.Expected.VirtualMachineName { - t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) - } - } -} diff --git a/internal/services/devtestlabs/parse/dev_test_virtual_network.go b/internal/services/devtestlabs/parse/dev_test_virtual_network.go deleted file mode 100644 index 4ba729474cb3..000000000000 --- a/internal/services/devtestlabs/parse/dev_test_virtual_network.go +++ /dev/null @@ -1,131 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DevTestVirtualNetworkId struct { - SubscriptionId string - ResourceGroup string - LabName string - VirtualNetworkName string -} - -func NewDevTestVirtualNetworkID(subscriptionId, resourceGroup, labName, virtualNetworkName string) DevTestVirtualNetworkId { - return DevTestVirtualNetworkId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - LabName: labName, - VirtualNetworkName: virtualNetworkName, - } -} - -func (id DevTestVirtualNetworkId) String() string { - segments := []string{ - fmt.Sprintf("Virtual Network Name %q", id.VirtualNetworkName), - fmt.Sprintf("Lab Name %q", id.LabName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Dev Test Virtual Network", segmentsStr) -} - -func (id DevTestVirtualNetworkId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s/virtualNetworks/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.LabName, id.VirtualNetworkName) -} - -// DevTestVirtualNetworkID parses a DevTestVirtualNetwork ID into an DevTestVirtualNetworkId struct -func DevTestVirtualNetworkID(input string) (*DevTestVirtualNetworkId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DevTestVirtualNetworkId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.LabName, err = id.PopSegment("labs"); err != nil { - return nil, err - } - if resourceId.VirtualNetworkName, err = id.PopSegment("virtualNetworks"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// DevTestVirtualNetworkIDInsensitively parses an DevTestVirtualNetwork ID into an DevTestVirtualNetworkId struct, insensitively -// This should only be used to parse an ID for rewriting, the DevTestVirtualNetworkID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func DevTestVirtualNetworkIDInsensitively(input string) (*DevTestVirtualNetworkId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DevTestVirtualNetworkId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'labs' segment - labsKey := "labs" - for key := range id.Path { - if strings.EqualFold(key, labsKey) { - labsKey = key - break - } - } - if resourceId.LabName, err = id.PopSegment(labsKey); err != nil { - return nil, err - } - - // find the correct casing for the 'virtualNetworks' segment - virtualNetworksKey := "virtualNetworks" - for key := range id.Path { - if strings.EqualFold(key, virtualNetworksKey) { - virtualNetworksKey = key - break - } - } - if resourceId.VirtualNetworkName, err = id.PopSegment(virtualNetworksKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/devtestlabs/parse/dev_test_virtual_network_test.go b/internal/services/devtestlabs/parse/dev_test_virtual_network_test.go deleted file mode 100644 index 11edbf318efa..000000000000 --- a/internal/services/devtestlabs/parse/dev_test_virtual_network_test.go +++ /dev/null @@ -1,264 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = DevTestVirtualNetworkId{} - -func TestDevTestVirtualNetworkIDFormatter(t *testing.T) { - actual := NewDevTestVirtualNetworkID("12345678-1234-9876-4563-123456789012", "group1", "lab1", "vnet1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualNetworks/vnet1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestDevTestVirtualNetworkID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DevTestVirtualNetworkId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Error: true, - }, - - { - // missing value for LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/", - Error: true, - }, - - { - // missing VirtualNetworkName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/", - Error: true, - }, - - { - // missing value for VirtualNetworkName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualNetworks/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualNetworks/vnet1", - Expected: &DevTestVirtualNetworkId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - VirtualNetworkName: "vnet1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DEVTESTLAB/LABS/LAB1/VIRTUALNETWORKS/VNET1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DevTestVirtualNetworkID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.LabName != v.Expected.LabName { - t.Fatalf("Expected %q but got %q for LabName", v.Expected.LabName, actual.LabName) - } - if actual.VirtualNetworkName != v.Expected.VirtualNetworkName { - t.Fatalf("Expected %q but got %q for VirtualNetworkName", v.Expected.VirtualNetworkName, actual.VirtualNetworkName) - } - } -} - -func TestDevTestVirtualNetworkIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DevTestVirtualNetworkId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Error: true, - }, - - { - // missing value for LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/", - Error: true, - }, - - { - // missing VirtualNetworkName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/", - Error: true, - }, - - { - // missing value for VirtualNetworkName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualNetworks/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualNetworks/vnet1", - Expected: &DevTestVirtualNetworkId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - VirtualNetworkName: "vnet1", - }, - }, - - { - // lower-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualnetworks/vnet1", - Expected: &DevTestVirtualNetworkId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - VirtualNetworkName: "vnet1", - }, - }, - - { - // upper-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/LABS/lab1/VIRTUALNETWORKS/vnet1", - Expected: &DevTestVirtualNetworkId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - VirtualNetworkName: "vnet1", - }, - }, - - { - // mixed-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/LaBs/lab1/ViRtUaLnEtWoRkS/vnet1", - Expected: &DevTestVirtualNetworkId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - LabName: "lab1", - VirtualNetworkName: "vnet1", - }, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DevTestVirtualNetworkIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.LabName != v.Expected.LabName { - t.Fatalf("Expected %q but got %q for LabName", v.Expected.LabName, actual.LabName) - } - if actual.VirtualNetworkName != v.Expected.VirtualNetworkName { - t.Fatalf("Expected %q but got %q for VirtualNetworkName", v.Expected.VirtualNetworkName, actual.VirtualNetworkName) - } - } -} diff --git a/internal/services/devtestlabs/parse/schedule.go b/internal/services/devtestlabs/parse/schedule.go deleted file mode 100644 index 773d21b5d8e2..000000000000 --- a/internal/services/devtestlabs/parse/schedule.go +++ /dev/null @@ -1,113 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ScheduleId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewScheduleID(subscriptionId, resourceGroup, name string) ScheduleId { - return ScheduleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ScheduleId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Schedule", segmentsStr) -} - -func (id ScheduleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/schedules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ScheduleID parses a Schedule ID into an ScheduleId struct -func ScheduleID(input string) (*ScheduleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ScheduleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("schedules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// ScheduleIDInsensitively parses an Schedule ID into an ScheduleId struct, insensitively -// This should only be used to parse an ID for rewriting, the ScheduleID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func ScheduleIDInsensitively(input string) (*ScheduleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ScheduleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'schedules' segment - schedulesKey := "schedules" - for key := range id.Path { - if strings.EqualFold(key, schedulesKey) { - schedulesKey = key - break - } - } - if resourceId.Name, err = id.PopSegment(schedulesKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/devtestlabs/parse/schedule_test.go b/internal/services/devtestlabs/parse/schedule_test.go deleted file mode 100644 index 43beef9bf756..000000000000 --- a/internal/services/devtestlabs/parse/schedule_test.go +++ /dev/null @@ -1,229 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = ScheduleId{} - -func TestScheduleIDFormatter(t *testing.T) { - actual := NewScheduleID("12345678-1234-9876-4563-123456789012", "group1", "schedule1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/schedules/schedule1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestScheduleID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ScheduleId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/schedules/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/schedules/schedule1", - Expected: &ScheduleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "schedule1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DEVTESTLAB/SCHEDULES/SCHEDULE1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ScheduleID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} - -func TestScheduleIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ScheduleId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/schedules/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/schedules/schedule1", - Expected: &ScheduleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "schedule1", - }, - }, - - { - // lower-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/schedules/schedule1", - Expected: &ScheduleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "schedule1", - }, - }, - - { - // upper-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/SCHEDULES/schedule1", - Expected: &ScheduleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "schedule1", - }, - }, - - { - // mixed-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/ScHeDuLeS/schedule1", - Expected: &ScheduleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "schedule1", - }, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ScheduleIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/devtestlabs/resourceids.go b/internal/services/devtestlabs/resourceids.go deleted file mode 100644 index e5406f815b35..000000000000 --- a/internal/services/devtestlabs/resourceids.go +++ /dev/null @@ -1,8 +0,0 @@ -package devtestlabs - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Schedule -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/schedules/schedule1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DevTestLab -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DevTestLabPolicy -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/policyset1/policies/policy1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DevTestVirtualMachine -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualMachines/vm1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DevTestVirtualNetwork -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualNetworks/vnet1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DevTestLabSchedule -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/schedules/schedule1 diff --git a/internal/services/devtestlabs/transition.go b/internal/services/devtestlabs/transition.go new file mode 100644 index 000000000000..89b6e7b0ff3e --- /dev/null +++ b/internal/services/devtestlabs/transition.go @@ -0,0 +1,23 @@ +package devtestlabs + +import "github.com/hashicorp/terraform-provider-azurerm/utils" + +func expandTags(input map[string]interface{}) *map[string]string { + output := make(map[string]string) + for k, v := range input { + output[k] = v.(string) + } + return &output +} + +func flattenTags(input *map[string]string) map[string]*string { + output := make(map[string]*string) + + if input != nil { + for k, v := range *input { + output[k] = utils.String(v) + } + } + + return output +} diff --git a/internal/services/devtestlabs/validate/dev_test_lab_id.go b/internal/services/devtestlabs/validate/dev_test_lab_id.go deleted file mode 100644 index 97d0ec14f9f6..000000000000 --- a/internal/services/devtestlabs/validate/dev_test_lab_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" -) - -func DevTestLabID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DevTestLabID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/devtestlabs/validate/dev_test_lab_id_test.go b/internal/services/devtestlabs/validate/dev_test_lab_id_test.go deleted file mode 100644 index 89da7ac93f50..000000000000 --- a/internal/services/devtestlabs/validate/dev_test_lab_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestDevTestLabID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Valid: false, - }, - - { - // missing value for LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DEVTESTLAB/LABS/LAB1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := DevTestLabID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/devtestlabs/validate/dev_test_lab_policy_id.go b/internal/services/devtestlabs/validate/dev_test_lab_policy_id.go deleted file mode 100644 index a60480aed486..000000000000 --- a/internal/services/devtestlabs/validate/dev_test_lab_policy_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" -) - -func DevTestLabPolicyID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DevTestLabPolicyID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/devtestlabs/validate/dev_test_lab_policy_id_test.go b/internal/services/devtestlabs/validate/dev_test_lab_policy_id_test.go deleted file mode 100644 index 6043b94bd11e..000000000000 --- a/internal/services/devtestlabs/validate/dev_test_lab_policy_id_test.go +++ /dev/null @@ -1,100 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestDevTestLabPolicyID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Valid: false, - }, - - { - // missing value for LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/", - Valid: false, - }, - - { - // missing PolicySetName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/", - Valid: false, - }, - - { - // missing value for PolicySetName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/", - Valid: false, - }, - - { - // missing PolicyName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/policyset1/", - Valid: false, - }, - - { - // missing value for PolicyName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/policyset1/policies/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/policyset1/policies/policy1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DEVTESTLAB/LABS/LAB1/POLICYSETS/POLICYSET1/POLICIES/POLICY1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := DevTestLabPolicyID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/devtestlabs/validate/dev_test_lab_schedule_id.go b/internal/services/devtestlabs/validate/dev_test_lab_schedule_id.go deleted file mode 100644 index 975fdcbef9f0..000000000000 --- a/internal/services/devtestlabs/validate/dev_test_lab_schedule_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" -) - -func DevTestLabScheduleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DevTestLabScheduleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/devtestlabs/validate/dev_test_lab_schedule_id_test.go b/internal/services/devtestlabs/validate/dev_test_lab_schedule_id_test.go deleted file mode 100644 index 5b99f6254ee4..000000000000 --- a/internal/services/devtestlabs/validate/dev_test_lab_schedule_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestDevTestLabScheduleID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Valid: false, - }, - - { - // missing value for LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/", - Valid: false, - }, - - { - // missing ScheduleName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/", - Valid: false, - }, - - { - // missing value for ScheduleName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/schedules/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/schedules/schedule1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DEVTESTLAB/LABS/LAB1/SCHEDULES/SCHEDULE1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := DevTestLabScheduleID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/devtestlabs/validate/dev_test_virtual_machine_id.go b/internal/services/devtestlabs/validate/dev_test_virtual_machine_id.go deleted file mode 100644 index c3baa41b990d..000000000000 --- a/internal/services/devtestlabs/validate/dev_test_virtual_machine_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" -) - -func DevTestVirtualMachineID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DevTestVirtualMachineID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/devtestlabs/validate/dev_test_virtual_machine_id_test.go b/internal/services/devtestlabs/validate/dev_test_virtual_machine_id_test.go deleted file mode 100644 index f1aa142fad82..000000000000 --- a/internal/services/devtestlabs/validate/dev_test_virtual_machine_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestDevTestVirtualMachineID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Valid: false, - }, - - { - // missing value for LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/", - Valid: false, - }, - - { - // missing VirtualMachineName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/", - Valid: false, - }, - - { - // missing value for VirtualMachineName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualMachines/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualMachines/vm1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DEVTESTLAB/LABS/LAB1/VIRTUALMACHINES/VM1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := DevTestVirtualMachineID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/devtestlabs/validate/dev_test_virtual_network_id.go b/internal/services/devtestlabs/validate/dev_test_virtual_network_id.go deleted file mode 100644 index 18882089a660..000000000000 --- a/internal/services/devtestlabs/validate/dev_test_virtual_network_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" -) - -func DevTestVirtualNetworkID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DevTestVirtualNetworkID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/devtestlabs/validate/dev_test_virtual_network_id_test.go b/internal/services/devtestlabs/validate/dev_test_virtual_network_id_test.go deleted file mode 100644 index b9ca0bcf2a6c..000000000000 --- a/internal/services/devtestlabs/validate/dev_test_virtual_network_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestDevTestVirtualNetworkID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Valid: false, - }, - - { - // missing value for LabName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/", - Valid: false, - }, - - { - // missing VirtualNetworkName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/", - Valid: false, - }, - - { - // missing value for VirtualNetworkName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualNetworks/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/virtualNetworks/vnet1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DEVTESTLAB/LABS/LAB1/VIRTUALNETWORKS/VNET1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := DevTestVirtualNetworkID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/devtestlabs/validate/devtest.go b/internal/services/devtestlabs/validate/devtest.go index bdbe07574532..43f51be5fe97 100644 --- a/internal/services/devtestlabs/validate/devtest.go +++ b/internal/services/devtestlabs/validate/devtest.go @@ -4,7 +4,7 @@ import ( "fmt" "regexp" - "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" ) @@ -51,8 +51,8 @@ func DevTestVirtualMachineName(maxLength int) pluginsdk.SchemaValidateFunc { func DevTestVirtualNetworkUsagePermissionType() pluginsdk.SchemaValidateFunc { return validation.StringInSlice([]string{ - string(dtl.Allow), - string(dtl.Default), - string(dtl.Deny), + string(virtualnetworks.UsagePermissionTypeAllow), + string(virtualnetworks.UsagePermissionTypeDefault), + string(virtualnetworks.UsagePermissionTypeDeny), }, false) } diff --git a/internal/services/devtestlabs/validate/schedule_id.go b/internal/services/devtestlabs/validate/schedule_id.go deleted file mode 100644 index bbf243531cee..000000000000 --- a/internal/services/devtestlabs/validate/schedule_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/parse" -) - -func ScheduleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ScheduleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/devtestlabs/validate/schedule_id_test.go b/internal/services/devtestlabs/validate/schedule_id_test.go deleted file mode 100644 index 177ed8a83c2e..000000000000 --- a/internal/services/devtestlabs/validate/schedule_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestScheduleID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/schedules/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DevTestLab/schedules/schedule1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DEVTESTLAB/SCHEDULES/SCHEDULE1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ScheduleID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/digitaltwins/client/client.go b/internal/services/digitaltwins/client/client.go index 2d16220c2a09..4cc775c894b7 100644 --- a/internal/services/digitaltwins/client/client.go +++ b/internal/services/digitaltwins/client/client.go @@ -1,22 +1,23 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance" + "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints" "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - EndpointClient *digitaltwins.EndpointClient - InstanceClient *digitaltwins.Client + EndpointClient *endpoints.EndpointsClient + InstanceClient *digitaltwinsinstance.DigitalTwinsInstanceClient TimeSeriesDatabaseConnectionsClient *timeseriesdatabaseconnections.TimeSeriesDatabaseConnectionsClient } func NewClient(o *common.ClientOptions) *Client { - endpointClient := digitaltwins.NewEndpointClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + endpointClient := endpoints.NewEndpointsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&endpointClient.Client, o.ResourceManagerAuthorizer) - InstanceClient := digitaltwins.NewClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + InstanceClient := digitaltwinsinstance.NewDigitalTwinsInstanceClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&InstanceClient.Client, o.ResourceManagerAuthorizer) TimeSeriesDatabaseConnectionsClient := timeseriesdatabaseconnections.NewTimeSeriesDatabaseConnectionsClientWithBaseURI(o.ResourceManagerEndpoint) diff --git a/internal/services/digitaltwins/digital_twins_endpoint_eventgrid_resource.go b/internal/services/digitaltwins/digital_twins_endpoint_eventgrid_resource.go index c605f85a158a..918e461040e4 100644 --- a/internal/services/digitaltwins/digital_twins_endpoint_eventgrid_resource.go +++ b/internal/services/digitaltwins/digital_twins_endpoint_eventgrid_resource.go @@ -5,10 +5,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance" + "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -30,10 +32,15 @@ func resourceDigitalTwinsEndpointEventGrid() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, - Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DigitalTwinsEndpointID(id) + Importer: pluginsdk.ImporterValidatingResourceIdThen(func(id string) error { + _, err := endpoints.ParseEndpointID(id) return err - }), + }, validateEndpointType(func(input endpoints.DigitalTwinsEndpointResourceProperties) error { + if _, ok := input.(endpoints.EventGrid); !ok { + return fmt.Errorf("expected an EventGrid type but got: %+v", input) + } + return nil + })), Schema: map[string]*pluginsdk.Schema{ "name": { @@ -47,7 +54,7 @@ func resourceDigitalTwinsEndpointEventGrid() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.DigitalTwinsInstanceID, + ValidateFunc: digitaltwinsinstance.ValidateDigitalTwinsInstanceID, }, "eventgrid_topic_endpoint": { @@ -83,30 +90,27 @@ func resourceDigitalTwinsEndpointEventGridCreateUpdate(d *pluginsdk.ResourceData ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - digitalTwinsId, err := parse.DigitalTwinsInstanceID(d.Get("digital_twins_id").(string)) + digitalTwinsId, err := digitaltwinsinstance.ParseDigitalTwinsInstanceID(d.Get("digital_twins_id").(string)) if err != nil { return err } - id := parse.NewDigitalTwinsEndpointID(subscriptionId, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, name).ID() - + id := endpoints.NewEndpointID(subscriptionId, digitalTwinsId.ResourceGroupName, digitalTwinsId.DigitalTwinsInstanceName, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, name) + existing, err := client.DigitalTwinsEndpointGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for present of existing Digital Twins Endpoint %q (Resource Group %q / Instance %q): %+v", name, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of an existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_digital_twins_endpoint_eventgrid", id) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_digital_twins_endpoint_eventgrid", id.ID()) } } - properties := digitaltwins.EndpointResource{ - Properties: &digitaltwins.EventGrid{ - EndpointType: digitaltwins.EndpointTypeEventGrid, - AuthenticationType: digitaltwins.KeyBased, + payload := endpoints.DigitalTwinsEndpointResource{ + Properties: &endpoints.EventGrid{ + AuthenticationType: pointer.To(endpoints.AuthenticationTypeKeyBased), TopicEndpoint: utils.String(d.Get("eventgrid_topic_endpoint").(string)), AccessKey1: utils.String(d.Get("eventgrid_topic_primary_access_key").(string)), AccessKey2: utils.String(d.Get("eventgrid_topic_secondary_access_key").(string)), @@ -114,21 +118,11 @@ func resourceDigitalTwinsEndpointEventGridCreateUpdate(d *pluginsdk.ResourceData }, } - future, err := client.CreateOrUpdate(ctx, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, name, properties) - if err != nil { - return fmt.Errorf("creating/updating Digital Twins EventGrid Endpoint %q (Resource Group %q / Instance %q): %+v", name, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, err) + if err := client.DigitalTwinsEndpointCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of the Digital Twins EventGrid Endpoint %q (Resource Group %q / Instance %q): %+v", name, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, err) - } - - if _, err := client.Get(ctx, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, name); err != nil { - return fmt.Errorf("retrieving Digital Twins EventGrid Endpoint %q (Resource Group %q / Instance %q): %+v", name, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, err) - } - - d.SetId(id) - + d.SetId(id.ID()) return resourceDigitalTwinsEndpointEventGridRead(d, meta) } @@ -138,26 +132,30 @@ func resourceDigitalTwinsEndpointEventGridRead(d *pluginsdk.ResourceData, meta i ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DigitalTwinsEndpointID(d.Id()) + id, err := endpoints.ParseEndpointID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.DigitalTwinsInstanceName, id.EndpointName) + resp, err := client.DigitalTwinsEndpointGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] Digital Twins EventGrid Endpoint %q does not exist - removing from state", d.Id()) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Digital Twins EventGrid Endpoint %q (Resource Group %q / Instance %q): %+v", id.EndpointName, id.ResourceGroup, id.DigitalTwinsInstanceName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("name", id.EndpointName) - d.Set("digital_twins_id", parse.NewDigitalTwinsInstanceID(subscriptionId, id.ResourceGroup, id.DigitalTwinsInstanceName).ID()) - if resp.Properties != nil { - if _, ok := resp.Properties.AsEventGrid(); !ok { - return fmt.Errorf("retrieving Digital Twins Endpoint %q (Resource Group %q / Instance %q) is not type Event Grid", id.EndpointName, id.ResourceGroup, id.DigitalTwinsInstanceName) + d.Set("digital_twins_id", digitaltwinsinstance.NewDigitalTwinsInstanceID(subscriptionId, id.ResourceGroupName, id.DigitalTwinsInstanceName).ID()) + + if model := resp.Model; model != nil { + props, ok := model.Properties.(endpoints.EventGrid) + if !ok { + return fmt.Errorf("retrieving %s: expected an EventGrid type but got: %+v", *id, model.Properties) } + + d.Set("eventgrid_topic_endpoint", props.TopicEndpoint) } return nil @@ -168,18 +166,14 @@ func resourceDigitalTwinsEndpointEventGridDelete(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DigitalTwinsEndpointID(d.Id()) + id, err := endpoints.ParseEndpointID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.DigitalTwinsInstanceName, id.EndpointName) - if err != nil { - return fmt.Errorf("deleting Digital Twins EventGrid Endpoint %q (Resource Group %q / Instance %q): %+v", id.EndpointName, id.ResourceGroup, id.DigitalTwinsInstanceName, err) + if err := client.DigitalTwinsEndpointDeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of the Digital Twins EventGrid Endpoint %q (Resource Group %q / Instance %q): %+v", id.EndpointName, id.ResourceGroup, id.DigitalTwinsInstanceName, err) - } return nil } diff --git a/internal/services/digitaltwins/digital_twins_endpoint_eventgrid_resource_test.go b/internal/services/digitaltwins/digital_twins_endpoint_eventgrid_resource_test.go index e131ceca19c9..f01c6d3015ef 100644 --- a/internal/services/digitaltwins/digital_twins_endpoint_eventgrid_resource_test.go +++ b/internal/services/digitaltwins/digital_twins_endpoint_eventgrid_resource_test.go @@ -5,10 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -104,16 +105,16 @@ func TestAccDigitalTwinsEndpointEventGrid_updateDeadLetter(t *testing.T) { } func (r DigitalTwinsEndpointEventGridResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DigitalTwinsEndpointID(state.ID) + id, err := endpoints.ParseEndpointID(state.ID) if err != nil { return nil, err } - resp, err := client.DigitalTwins.EndpointClient.Get(ctx, id.ResourceGroup, id.DigitalTwinsInstanceName, id.EndpointName) + resp, err := client.DigitalTwins.EndpointClient.DigitalTwinsEndpointGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } - return nil, fmt.Errorf("retrieving Digital Twins EventGrid Endpoint %q (Resource Group %q / Digital Twins Instance Name %q): %+v", id.EndpointName, id.ResourceGroup, id.DigitalTwinsInstanceName, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } return utils.Bool(true), nil diff --git a/internal/services/digitaltwins/digital_twins_endpoint_eventhub_resource.go b/internal/services/digitaltwins/digital_twins_endpoint_eventhub_resource.go index 07442696a000..099e00d3db56 100644 --- a/internal/services/digitaltwins/digital_twins_endpoint_eventhub_resource.go +++ b/internal/services/digitaltwins/digital_twins_endpoint_eventhub_resource.go @@ -5,10 +5,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance" + "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -30,10 +32,15 @@ func resourceDigitalTwinsEndpointEventHub() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, - Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DigitalTwinsEndpointID(id) + Importer: pluginsdk.ImporterValidatingResourceIdThen(func(id string) error { + _, err := endpoints.ParseEndpointID(id) return err - }), + }, validateEndpointType(func(input endpoints.DigitalTwinsEndpointResourceProperties) error { + if _, ok := input.(endpoints.EventHub); !ok { + return fmt.Errorf("expected an EventHub type but got: %+v", input) + } + return nil + })), Schema: map[string]*pluginsdk.Schema{ "name": { @@ -47,7 +54,7 @@ func resourceDigitalTwinsEndpointEventHub() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.DigitalTwinsInstanceID, + ValidateFunc: digitaltwinsinstance.ValidateDigitalTwinsInstanceID, }, "eventhub_primary_connection_string": { @@ -80,51 +87,38 @@ func resourceDigitalTwinsEndpointEventHubCreateUpdate(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - digitalTwinsId, err := parse.DigitalTwinsInstanceID(d.Get("digital_twins_id").(string)) + digitalTwinsId, err := digitaltwinsinstance.ParseDigitalTwinsInstanceID(d.Get("digital_twins_id").(string)) if err != nil { return err } - id := parse.NewDigitalTwinsEndpointID(subscriptionId, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, name).ID() - + id := endpoints.NewEndpointID(subscriptionId, digitalTwinsId.ResourceGroupName, digitalTwinsId.DigitalTwinsInstanceName, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, name) + existing, err := client.DigitalTwinsEndpointGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for present of existing Digital Twins Endpoint %q (Resource Group %q / Instance %q): %+v", name, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of an existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_digital_twins_endpoint_eventhub", id) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_digital_twins_endpoint_eventhub", id.ID()) } } - properties := digitaltwins.EndpointResource{ - Properties: &digitaltwins.EventHub{ - EndpointType: digitaltwins.EndpointTypeEventHub, - AuthenticationType: digitaltwins.KeyBased, + payload := endpoints.DigitalTwinsEndpointResource{ + Properties: &endpoints.EventHub{ + AuthenticationType: pointer.To(endpoints.AuthenticationTypeKeyBased), ConnectionStringPrimaryKey: utils.String(d.Get("eventhub_primary_connection_string").(string)), ConnectionStringSecondaryKey: utils.String(d.Get("eventhub_secondary_connection_string").(string)), DeadLetterSecret: utils.String(d.Get("dead_letter_storage_secret").(string)), }, } - future, err := client.CreateOrUpdate(ctx, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, name, properties) - if err != nil { - return fmt.Errorf("creating/updating Digital Twins Endpoint EventHub %q (Resource Group %q / Instance %q): %+v", name, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, err) + if err := client.DigitalTwinsEndpointCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of the Digital Twins Endpoint EventHub %q (Resource Group %q / Instance %q): %+v", name, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, err) - } - - if _, err := client.Get(ctx, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, name); err != nil { - return fmt.Errorf("retrieving Digital Twins Endpoint EventHub %q (Resource Group %q / Instance %q): %+v", name, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, err) - } - - d.SetId(id) - + d.SetId(id.ID()) return resourceDigitalTwinsEndpointEventHubRead(d, meta) } @@ -134,27 +128,29 @@ func resourceDigitalTwinsEndpointEventHubRead(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DigitalTwinsEndpointID(d.Id()) + id, err := endpoints.ParseEndpointID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.DigitalTwinsInstanceName, id.EndpointName) + resp, err := client.DigitalTwinsEndpointGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] Digital Twins Event Hub Endpoint %q does not exist - removing from state", d.Id()) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Digital Twins Endpoint EventHub %q (Resource Group %q / Instance %q): %+v", id.EndpointName, id.ResourceGroup, id.DigitalTwinsInstanceName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("name", id.EndpointName) - d.Set("digital_twins_id", parse.NewDigitalTwinsInstanceID(subscriptionId, id.ResourceGroup, id.DigitalTwinsInstanceName).ID()) - if resp.Properties != nil { - if _, ok := resp.Properties.AsEventHub(); !ok { - return fmt.Errorf("retrieving Digital Twins Endpoint %q (Resource Group %q / Instance %q) is not type EventHub", id.EndpointName, id.ResourceGroup, id.DigitalTwinsInstanceName) + d.Set("digital_twins_id", digitaltwinsinstance.NewDigitalTwinsInstanceID(subscriptionId, id.ResourceGroupName, id.DigitalTwinsInstanceName).ID()) + + if model := resp.Model; model != nil { + if _, ok := model.Properties.(endpoints.EventHub); !ok { + return fmt.Errorf("retrieving %s: expected an EventHub type but got: %+v", *id, model.Properties) } } + return nil } @@ -163,18 +159,14 @@ func resourceDigitalTwinsEndpointEventHubDelete(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DigitalTwinsEndpointID(d.Id()) + id, err := endpoints.ParseEndpointID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.DigitalTwinsInstanceName, id.EndpointName) - if err != nil { - return fmt.Errorf("deleting Digital Twins Endpoint EventHub %q (Resource Group %q / Instance %q): %+v", id.EndpointName, id.ResourceGroup, id.DigitalTwinsInstanceName, err) + if err := client.DigitalTwinsEndpointDeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of the Digital Twins Endpoint EventHub %q (Resource Group %q / Instance %q): %+v", id.EndpointName, id.ResourceGroup, id.DigitalTwinsInstanceName, err) - } return nil } diff --git a/internal/services/digitaltwins/digital_twins_endpoint_eventhub_resource_test.go b/internal/services/digitaltwins/digital_twins_endpoint_eventhub_resource_test.go index ac7698329844..2976a863fa0e 100644 --- a/internal/services/digitaltwins/digital_twins_endpoint_eventhub_resource_test.go +++ b/internal/services/digitaltwins/digital_twins_endpoint_eventhub_resource_test.go @@ -5,10 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -104,19 +105,19 @@ func TestAccDigitalTwinsEndpointEventHub_updateDeadLetter(t *testing.T) { } func (r DigitalTwinsEndpointEventHubResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DigitalTwinsEndpointID(state.ID) + id, err := endpoints.ParseEndpointID(state.ID) if err != nil { return nil, err } - resp, err := client.DigitalTwins.EndpointClient.Get(ctx, id.ResourceGroup, id.DigitalTwinsInstanceName, id.EndpointName) + resp, err := client.DigitalTwins.EndpointClient.DigitalTwinsEndpointGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } - return nil, fmt.Errorf("retrieving Digital Twins EventGrid Endpoint %q (Resource Group %q / Digital Twins Instance Name %q): %+v", id.EndpointName, id.ResourceGroup, id.DigitalTwinsInstanceName, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(true), nil + return utils.Bool(resp.Model != nil), nil } func (r DigitalTwinsEndpointEventHubResource) template(data acceptance.TestData) string { diff --git a/internal/services/digitaltwins/digital_twins_endpoint_servicebus_resource.go b/internal/services/digitaltwins/digital_twins_endpoint_servicebus_resource.go index a870e169a3e7..64906fab3743 100644 --- a/internal/services/digitaltwins/digital_twins_endpoint_servicebus_resource.go +++ b/internal/services/digitaltwins/digital_twins_endpoint_servicebus_resource.go @@ -5,10 +5,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance" + "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -30,10 +32,15 @@ func resourceDigitalTwinsEndpointServiceBus() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, - Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DigitalTwinsEndpointID(id) + Importer: pluginsdk.ImporterValidatingResourceIdThen(func(id string) error { + _, err := endpoints.ParseEndpointID(id) return err - }), + }, validateEndpointType(func(input endpoints.DigitalTwinsEndpointResourceProperties) error { + if _, ok := input.(endpoints.ServiceBus); !ok { + return fmt.Errorf("expected an ServiceBus type but got: %+v", input) + } + return nil + })), Schema: map[string]*pluginsdk.Schema{ "name": { @@ -47,7 +54,7 @@ func resourceDigitalTwinsEndpointServiceBus() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.DigitalTwinsInstanceID, + ValidateFunc: digitaltwinsinstance.ValidateDigitalTwinsInstanceID, }, "servicebus_primary_connection_string": { @@ -80,51 +87,38 @@ func resourceDigitalTwinsEndpointServiceBusCreateUpdate(d *pluginsdk.ResourceDat ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - digitalTwinsId, err := parse.DigitalTwinsInstanceID(d.Get("digital_twins_id").(string)) + digitalTwinsId, err := digitaltwinsinstance.ParseDigitalTwinsInstanceID(d.Get("digital_twins_id").(string)) if err != nil { return err } - id := parse.NewDigitalTwinsEndpointID(subscriptionId, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, name).ID() - + id := endpoints.NewEndpointID(subscriptionId, digitalTwinsId.ResourceGroupName, digitalTwinsId.DigitalTwinsInstanceName, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, name) + existing, err := client.DigitalTwinsEndpointGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for present of existing Digital Twins Endpoint %q (Resource Group %q / Instance %q): %+v", name, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_digital_twins_endpoint_servicebus", id) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_digital_twins_endpoint_servicebus", id.ID()) } } - properties := digitaltwins.EndpointResource{ - Properties: &digitaltwins.ServiceBus{ - EndpointType: digitaltwins.EndpointTypeServiceBus, - AuthenticationType: digitaltwins.KeyBased, + payload := endpoints.DigitalTwinsEndpointResource{ + Properties: &endpoints.ServiceBus{ + AuthenticationType: pointer.To(endpoints.AuthenticationTypeKeyBased), PrimaryConnectionString: utils.String(d.Get("servicebus_primary_connection_string").(string)), SecondaryConnectionString: utils.String(d.Get("servicebus_secondary_connection_string").(string)), DeadLetterSecret: utils.String(d.Get("dead_letter_storage_secret").(string)), }, } - future, err := client.CreateOrUpdate(ctx, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, name, properties) - if err != nil { - return fmt.Errorf("creating/updating Digital Twins Endpoint ServiceBus %q (Resource Group %q / Instance %q): %+v", name, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, err) + if err := client.DigitalTwinsEndpointCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of the Digital Twins Endpoint ServiceBus %q (Resource Group %q / Instance %q): %+v", name, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, err) - } - - if _, err := client.Get(ctx, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, name); err != nil { - return fmt.Errorf("retrieving Digital Twins Endpoint ServiceBus %q (Resource Group %q / Instance %q): %+v", name, digitalTwinsId.ResourceGroup, digitalTwinsId.Name, err) - } - - d.SetId(id) - + d.SetId(id.ID()) return resourceDigitalTwinsEndpointServiceBusRead(d, meta) } @@ -134,27 +128,29 @@ func resourceDigitalTwinsEndpointServiceBusRead(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DigitalTwinsEndpointID(d.Id()) + id, err := endpoints.ParseEndpointID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.DigitalTwinsInstanceName, id.EndpointName) + resp, err := client.DigitalTwinsEndpointGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] Digital Twins ServiceBus Endpoint %q does not exist - removing from state", d.Id()) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Digital Twins Endpoint ServiceBus %q (Resource Group %q / Instance %q): %+v", id.EndpointName, id.ResourceGroup, id.DigitalTwinsInstanceName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("name", id.EndpointName) - d.Set("digital_twins_id", parse.NewDigitalTwinsInstanceID(subscriptionId, id.ResourceGroup, id.DigitalTwinsInstanceName).ID()) - if resp.Properties != nil { - if _, ok := resp.Properties.AsServiceBus(); !ok { - return fmt.Errorf("retrieving Digital Twins Endpoint %q (Resource Group %q / Instance %q) is not type ServiceBus", id.EndpointName, id.ResourceGroup, id.DigitalTwinsInstanceName) + d.Set("digital_twins_id", digitaltwinsinstance.NewDigitalTwinsInstanceID(subscriptionId, id.ResourceGroupName, id.DigitalTwinsInstanceName).ID()) + + if model := resp.Model; model != nil { + if _, ok := model.Properties.(endpoints.ServiceBus); !ok { + return fmt.Errorf("retrieving %s: expected an ServiceBus type but got: %+v", *id, model.Properties) } } + return nil } @@ -163,18 +159,14 @@ func resourceDigitalTwinsEndpointServiceBusDelete(d *pluginsdk.ResourceData, met ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DigitalTwinsEndpointID(d.Id()) + id, err := endpoints.ParseEndpointID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.DigitalTwinsInstanceName, id.EndpointName) - if err != nil { - return fmt.Errorf("deleting Digital Twins Endpoint ServiceBus %q (Resource Group %q / Instance %q): %+v", id.EndpointName, id.ResourceGroup, id.DigitalTwinsInstanceName, err) + if err := client.DigitalTwinsEndpointDeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of the Digital Twins Endpoint ServiceBus %q (Resource Group %q / Instance %q): %+v", id.EndpointName, id.ResourceGroup, id.DigitalTwinsInstanceName, err) - } return nil } diff --git a/internal/services/digitaltwins/digital_twins_endpoint_servicebus_resource_test.go b/internal/services/digitaltwins/digital_twins_endpoint_servicebus_resource_test.go index 277c4788256b..51cdb3ad9109 100644 --- a/internal/services/digitaltwins/digital_twins_endpoint_servicebus_resource_test.go +++ b/internal/services/digitaltwins/digital_twins_endpoint_servicebus_resource_test.go @@ -5,10 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -104,19 +105,19 @@ func TestAccDigitalTwinsEndpointServicebus_updateDeadLetter(t *testing.T) { } func (r DigitalTwinsEndpointServiceBusResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DigitalTwinsEndpointID(state.ID) + id, err := endpoints.ParseEndpointID(state.ID) if err != nil { return nil, err } - resp, err := client.DigitalTwins.EndpointClient.Get(ctx, id.ResourceGroup, id.DigitalTwinsInstanceName, id.EndpointName) + resp, err := client.DigitalTwins.EndpointClient.DigitalTwinsEndpointGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } - return nil, fmt.Errorf("retrieving Digital Twins Service Bus Endpoint %q (Resource Group %q / Digital Twins Instance Name %q): %+v", id.EndpointName, id.ResourceGroup, id.DigitalTwinsInstanceName, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(true), nil + return utils.Bool(resp.Model != nil), nil } func (r DigitalTwinsEndpointServiceBusResource) template(data acceptance.TestData) string { diff --git a/internal/services/digitaltwins/digital_twins_instance_data_source.go b/internal/services/digitaltwins/digital_twins_instance_data_source.go index 2367d0bbbc26..5ac47946e6b7 100644 --- a/internal/services/digitaltwins/digital_twins_instance_data_source.go +++ b/internal/services/digitaltwins/digital_twins_instance_data_source.go @@ -4,15 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceDigitalTwinsInstance() *pluginsdk.Resource { @@ -39,7 +39,7 @@ func dataSourceDigitalTwinsInstance() *pluginsdk.Resource { Computed: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -50,27 +50,29 @@ func dataSourceDigitalTwinsInstanceRead(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - resourceGroup := d.Get("resource_group_name").(string) - - id := parse.NewDigitalTwinsInstanceID(subscriptionId, resourceGroup, name).ID() - - resp, err := client.Get(ctx, resourceGroup, name) + id := digitaltwinsinstance.NewDigitalTwinsInstanceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.DigitalTwinsGet(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf("Digital Twins Instance %q (Resource Group %q) does not exist", name, resourceGroup) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s does not exist", id) } - return fmt.Errorf("retrieving Digital Twins Instance %q (Resource Group %q): %+v", name, resourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", name) - d.Set("resource_group_name", resourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - if props := resp.Properties; props != nil { - d.Set("host_name", props.HostName) - } + d.Set("name", id.DigitalTwinsInstanceName) + d.Set("resource_group_name", id.ResourceGroupName) - d.SetId(id) + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + if props := model.Properties; props != nil { + d.Set("host_name", props.HostName) + } + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return fmt.Errorf("setting `tags`: %+v", err) + } + } - return tags.FlattenAndSet(d, resp.Tags) + d.SetId(id.ID()) + return nil } diff --git a/internal/services/digitaltwins/digital_twins_instance_resource.go b/internal/services/digitaltwins/digital_twins_instance_resource.go index 0a215f3753ba..11447dd79e7d 100644 --- a/internal/services/digitaltwins/digital_twins_instance_resource.go +++ b/internal/services/digitaltwins/digital_twins_instance_resource.go @@ -5,18 +5,17 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceDigitalTwinsInstance() *pluginsdk.Resource { @@ -34,7 +33,7 @@ func resourceDigitalTwinsInstance() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DigitalTwinsInstanceID(id) + _, err := digitaltwinsinstance.ParseDigitalTwinsInstanceID(id) return err }), @@ -57,7 +56,7 @@ func resourceDigitalTwinsInstance() *pluginsdk.Resource { "identity": commonschema.SystemAssignedIdentityOptional(), - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -68,47 +67,33 @@ func resourceDigitalTwinsInstanceCreate(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - resourceGroup := d.Get("resource_group_name").(string) - - id := parse.NewDigitalTwinsInstanceID(subscriptionId, resourceGroup, name).ID() - - existing, err := client.Get(ctx, resourceGroup, name) + id := digitaltwinsinstance.NewDigitalTwinsInstanceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + existing, err := client.DigitalTwinsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for existing Digital Twins Instance %q (Resource Group %q): %+v", name, resourceGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for an existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_digital_twins_instance", id) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_digital_twins_instance", id.ID()) } - expandedIdentity, err := expandDigitalTwinsInstanceIdentity(d.Get("identity").([]interface{})) + expandedIdentity, err := identity.ExpandSystemAssigned(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } - properties := digitaltwins.Description{ - Location: utils.String(location.Normalize(d.Get("location").(string))), + payload := digitaltwinsinstance.DigitalTwinsDescription{ + Location: location.Normalize(d.Get("location").(string)), Identity: expandedIdentity, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.CreateOrUpdate(ctx, resourceGroup, name, properties) - if err != nil { - return fmt.Errorf("creating Digital Twins Instance %q (Resource Group %q): %+v", name, resourceGroup, err) - } - - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of the Digital Twins Instance %q (Resource Group %q): %+v", name, resourceGroup, err) + if err := client.DigitalTwinsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } - if _, err = client.Get(ctx, resourceGroup, name); err != nil { - return fmt.Errorf("retrieving Digital Twins Instance %q (Resource Group %q): %+v", name, resourceGroup, err) - } - - d.SetId(id) - + d.SetId(id.ID()) return resourceDigitalTwinsInstanceRead(d, meta) } @@ -117,33 +102,41 @@ func resourceDigitalTwinsInstanceRead(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DigitalTwinsInstanceID(d.Id()) + id, err := digitaltwinsinstance.ParseDigitalTwinsInstanceID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.DigitalTwinsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] Digital Twins Instance %q does not exist - removing from state", d.Id()) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Digital Twins Instance %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - if props := resp.Properties; props != nil { - d.Set("host_name", props.HostName) - } + d.Set("name", id.DigitalTwinsInstanceName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) - if err := d.Set("identity", flattenDigitalTwinsInstanceIdentity(resp.Identity)); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) + if props := model.Properties; props != nil { + d.Set("host_name", props.HostName) + } + + if err := d.Set("identity", identity.FlattenSystemAssigned(model.Identity)); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return fmt.Errorf("setting `tags`: %+v", err) + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceDigitalTwinsInstanceUpdate(d *pluginsdk.ResourceData, meta interface{}) error { @@ -151,15 +144,15 @@ func resourceDigitalTwinsInstanceUpdate(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DigitalTwinsInstanceID(d.Id()) + id, err := digitaltwinsinstance.ParseDigitalTwinsInstanceID(d.Id()) if err != nil { return err } - props := digitaltwins.PatchDescription{} + props := digitaltwinsinstance.DigitalTwinsPatchDescription{} if d.HasChange("identity") { - expandedIdentity, err := expandDigitalTwinsInstanceIdentity(d.Get("identity").([]interface{})) + expandedIdentity, err := identity.ExpandSystemAssigned(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } @@ -170,15 +163,10 @@ func resourceDigitalTwinsInstanceUpdate(d *pluginsdk.ResourceData, meta interfac props.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) } - future, err := client.Update(ctx, id.ResourceGroup, id.Name, props) - if err != nil { + if err := client.DigitalTwinsUpdateThenPoll(ctx, *id, props); err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of %s: %+v", *id, err) - } - return resourceDigitalTwinsInstanceRead(d, meta) } @@ -187,50 +175,14 @@ func resourceDigitalTwinsInstanceDelete(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DigitalTwinsInstanceID(d.Id()) + id, err := digitaltwinsinstance.ParseDigitalTwinsInstanceID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { - return fmt.Errorf("deleting Digital Twins Instance %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of the Digital Twins Instance %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err := client.DigitalTwinsDeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } - -func expandDigitalTwinsInstanceIdentity(input []interface{}) (*digitaltwins.Identity, error) { - expanded, err := identity.ExpandSystemAssigned(input) - if err != nil { - return nil, err - } - - result := digitaltwins.Identity{ - Type: digitaltwins.IdentityType(expanded.Type), - } - - return &result, nil -} - -func flattenDigitalTwinsInstanceIdentity(input *digitaltwins.Identity) []interface{} { - var transform *identity.SystemAssigned - - if input != nil { - transform = &identity.SystemAssigned{ - Type: identity.Type(string(input.Type)), - } - if input.PrincipalID != nil { - transform.PrincipalId = *input.PrincipalID - } - if input.TenantID != nil { - transform.TenantId = *input.TenantID - } - } - - return identity.FlattenSystemAssigned(transform) -} diff --git a/internal/services/digitaltwins/digital_twins_instance_resource_test.go b/internal/services/digitaltwins/digital_twins_instance_resource_test.go index 88a0319412fd..c1f4dcda8be4 100644 --- a/internal/services/digitaltwins/digital_twins_instance_resource_test.go +++ b/internal/services/digitaltwins/digital_twins_instance_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -134,17 +134,17 @@ func TestAccDigitalTwinsInstance_identity(t *testing.T) { } func (DigitalTwinsInstanceResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DigitalTwinsInstanceID(state.ID) + id, err := digitaltwinsinstance.ParseDigitalTwinsInstanceID(state.ID) if err != nil { return nil, err } - resp, err := clients.DigitalTwins.InstanceClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := clients.DigitalTwins.InstanceClient.DigitalTwinsGet(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Digital Twins Instance %q (resource group: %q): %+v", id.Name, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.Properties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (DigitalTwinsInstanceResource) template(data acceptance.TestData) string { diff --git a/internal/services/digitaltwins/digital_twins_time_series_database_connection_resource.go b/internal/services/digitaltwins/digital_twins_time_series_database_connection_resource.go index ea4075e0285b..9c8cb769a69c 100644 --- a/internal/services/digitaltwins/digital_twins_time_series_database_connection_resource.go +++ b/internal/services/digitaltwins/digital_twins_time_series_database_connection_resource.go @@ -141,7 +141,7 @@ func (m TimeSeriesDatabaseConnectionResource) Create() sdk.ResourceFunc { return err } - id := timeseriesdatabaseconnections.NewTimeSeriesDatabaseConnectionID(digitalTwinsId.SubscriptionId, digitalTwinsId.ResourceGroupName, digitalTwinsId.ResourceName, model.Name) + id := timeseriesdatabaseconnections.NewTimeSeriesDatabaseConnectionID(digitalTwinsId.SubscriptionId, digitalTwinsId.ResourceGroupName, digitalTwinsId.DigitalTwinsInstanceName, model.Name) existing, err := client.Get(ctx, id) if !response.WasNotFound(existing.HttpResponse) { @@ -203,7 +203,7 @@ func (m TimeSeriesDatabaseConnectionResource) Read() sdk.ResourceFunc { var output TimeSeriesDatabaseConnectionModel output.Name = id.TimeSeriesDatabaseConnectionName - output.DigitalTwinsId = timeseriesdatabaseconnections.NewDigitalTwinsInstanceID(id.SubscriptionId, id.ResourceGroupName, id.ResourceName).ID() + output.DigitalTwinsId = timeseriesdatabaseconnections.NewDigitalTwinsInstanceID(id.SubscriptionId, id.ResourceGroupName, id.DigitalTwinsInstanceName).ID() if properties, ok := result.Model.Properties.(timeseriesdatabaseconnections.AzureDataExplorerConnectionProperties); ok { output.EventhubName = properties.EventHubEntityPath diff --git a/internal/services/digitaltwins/endpoints.go b/internal/services/digitaltwins/endpoints.go new file mode 100644 index 000000000000..d1498c3b1e78 --- /dev/null +++ b/internal/services/digitaltwins/endpoints.go @@ -0,0 +1,38 @@ +package digitaltwins + +import ( + "context" + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +func validateEndpointType(validate func(input endpoints.DigitalTwinsEndpointResourceProperties) error) pluginsdk.ImporterFunc { + return func(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) ([]*pluginsdk.ResourceData, error) { + id, err := endpoints.ParseEndpointID(d.Id()) + if err != nil { + return nil, err + } + + client := meta.(*clients.Client).DigitalTwins.EndpointClient + resp, err := client.DigitalTwinsEndpointGet(ctx, *id) + if err != nil { + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) + } + if resp.Model == nil { + return nil, fmt.Errorf("retrieving %s: model was nil", *id) + } + if resp.Model.Properties == nil { + return nil, fmt.Errorf("retrieving %s: model.Properties was nil", *id) + } + if resp.Model.Properties == nil { + return nil, fmt.Errorf("retrieving %s: model.Properties was nil", *id) + } + if err := validate(resp.Model.Properties); err != nil { + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) + } + return []*pluginsdk.ResourceData{d}, nil + } +} diff --git a/internal/services/digitaltwins/parse/digital_twins_endpoint.go b/internal/services/digitaltwins/parse/digital_twins_endpoint.go deleted file mode 100644 index 3e8aa1965c16..000000000000 --- a/internal/services/digitaltwins/parse/digital_twins_endpoint.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DigitalTwinsEndpointId struct { - SubscriptionId string - ResourceGroup string - DigitalTwinsInstanceName string - EndpointName string -} - -func NewDigitalTwinsEndpointID(subscriptionId, resourceGroup, digitalTwinsInstanceName, endpointName string) DigitalTwinsEndpointId { - return DigitalTwinsEndpointId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - DigitalTwinsInstanceName: digitalTwinsInstanceName, - EndpointName: endpointName, - } -} - -func (id DigitalTwinsEndpointId) String() string { - segments := []string{ - fmt.Sprintf("Endpoint Name %q", id.EndpointName), - fmt.Sprintf("Digital Twins Instance Name %q", id.DigitalTwinsInstanceName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Digital Twins Endpoint", segmentsStr) -} - -func (id DigitalTwinsEndpointId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DigitalTwins/digitalTwinsInstances/%s/endpoints/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.DigitalTwinsInstanceName, id.EndpointName) -} - -// DigitalTwinsEndpointID parses a DigitalTwinsEndpoint ID into an DigitalTwinsEndpointId struct -func DigitalTwinsEndpointID(input string) (*DigitalTwinsEndpointId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DigitalTwinsEndpointId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.DigitalTwinsInstanceName, err = id.PopSegment("digitalTwinsInstances"); err != nil { - return nil, err - } - if resourceId.EndpointName, err = id.PopSegment("endpoints"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/digitaltwins/parse/digital_twins_endpoint_test.go b/internal/services/digitaltwins/parse/digital_twins_endpoint_test.go deleted file mode 100644 index 3ad4bcf2f9bc..000000000000 --- a/internal/services/digitaltwins/parse/digital_twins_endpoint_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = DigitalTwinsEndpointId{} - -func TestDigitalTwinsEndpointIDFormatter(t *testing.T) { - actual := NewDigitalTwinsEndpointID("12345678-1234-9876-4563-123456789012", "group1", "instance1", "endpoint1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/instance1/endpoints/endpoint1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestDigitalTwinsEndpointID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DigitalTwinsEndpointId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing DigitalTwinsInstanceName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/", - Error: true, - }, - - { - // missing value for DigitalTwinsInstanceName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/", - Error: true, - }, - - { - // missing EndpointName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/instance1/", - Error: true, - }, - - { - // missing value for EndpointName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/instance1/endpoints/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/instance1/endpoints/endpoint1", - Expected: &DigitalTwinsEndpointId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - DigitalTwinsInstanceName: "instance1", - EndpointName: "endpoint1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DIGITALTWINS/DIGITALTWINSINSTANCES/INSTANCE1/ENDPOINTS/ENDPOINT1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DigitalTwinsEndpointID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.DigitalTwinsInstanceName != v.Expected.DigitalTwinsInstanceName { - t.Fatalf("Expected %q but got %q for DigitalTwinsInstanceName", v.Expected.DigitalTwinsInstanceName, actual.DigitalTwinsInstanceName) - } - if actual.EndpointName != v.Expected.EndpointName { - t.Fatalf("Expected %q but got %q for EndpointName", v.Expected.EndpointName, actual.EndpointName) - } - } -} diff --git a/internal/services/digitaltwins/parse/digital_twins_instance.go b/internal/services/digitaltwins/parse/digital_twins_instance.go deleted file mode 100644 index be3a84faa4ad..000000000000 --- a/internal/services/digitaltwins/parse/digital_twins_instance.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DigitalTwinsInstanceId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewDigitalTwinsInstanceID(subscriptionId, resourceGroup, name string) DigitalTwinsInstanceId { - return DigitalTwinsInstanceId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id DigitalTwinsInstanceId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Digital Twins Instance", segmentsStr) -} - -func (id DigitalTwinsInstanceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DigitalTwins/digitalTwinsInstances/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// DigitalTwinsInstanceID parses a DigitalTwinsInstance ID into an DigitalTwinsInstanceId struct -func DigitalTwinsInstanceID(input string) (*DigitalTwinsInstanceId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DigitalTwinsInstanceId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("digitalTwinsInstances"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/digitaltwins/parse/digital_twins_instance_test.go b/internal/services/digitaltwins/parse/digital_twins_instance_test.go deleted file mode 100644 index 92435cd77eda..000000000000 --- a/internal/services/digitaltwins/parse/digital_twins_instance_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = DigitalTwinsInstanceId{} - -func TestDigitalTwinsInstanceIDFormatter(t *testing.T) { - actual := NewDigitalTwinsInstanceID("12345678-1234-9876-4563-123456789012", "group1", "instance1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/instance1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestDigitalTwinsInstanceID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *DigitalTwinsInstanceId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/instance1", - Expected: &DigitalTwinsInstanceId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "instance1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DIGITALTWINS/DIGITALTWINSINSTANCES/INSTANCE1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := DigitalTwinsInstanceID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/digitaltwins/resourceids.go b/internal/services/digitaltwins/resourceids.go deleted file mode 100644 index 84e431bd1eb5..000000000000 --- a/internal/services/digitaltwins/resourceids.go +++ /dev/null @@ -1,5 +0,0 @@ -package digitaltwins - -// leaving the DigitalTwins prefix here to avoid stuttering the property name for now -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DigitalTwinsInstance -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/instance1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DigitalTwinsEndpoint -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/instance1/endpoints/endpoint1 diff --git a/internal/services/digitaltwins/validate/digital_twins_endpoint_id.go b/internal/services/digitaltwins/validate/digital_twins_endpoint_id.go deleted file mode 100644 index d841120e543f..000000000000 --- a/internal/services/digitaltwins/validate/digital_twins_endpoint_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/parse" -) - -func DigitalTwinsEndpointID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DigitalTwinsEndpointID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/digitaltwins/validate/digital_twins_endpoint_id_test.go b/internal/services/digitaltwins/validate/digital_twins_endpoint_id_test.go deleted file mode 100644 index 4c6299e842b8..000000000000 --- a/internal/services/digitaltwins/validate/digital_twins_endpoint_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestDigitalTwinsEndpointID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing DigitalTwinsInstanceName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/", - Valid: false, - }, - - { - // missing value for DigitalTwinsInstanceName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/", - Valid: false, - }, - - { - // missing EndpointName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/instance1/", - Valid: false, - }, - - { - // missing value for EndpointName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/instance1/endpoints/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/instance1/endpoints/endpoint1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DIGITALTWINS/DIGITALTWINSINSTANCES/INSTANCE1/ENDPOINTS/ENDPOINT1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := DigitalTwinsEndpointID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/digitaltwins/validate/digital_twins_instance_id.go b/internal/services/digitaltwins/validate/digital_twins_instance_id.go deleted file mode 100644 index 3e0ca63c22b1..000000000000 --- a/internal/services/digitaltwins/validate/digital_twins_instance_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/parse" -) - -func DigitalTwinsInstanceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DigitalTwinsInstanceID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/digitaltwins/validate/digital_twins_instance_id_test.go b/internal/services/digitaltwins/validate/digital_twins_instance_id_test.go deleted file mode 100644 index 2d836b0c073f..000000000000 --- a/internal/services/digitaltwins/validate/digital_twins_instance_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestDigitalTwinsInstanceID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.DigitalTwins/digitalTwinsInstances/instance1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.DIGITALTWINS/DIGITALTWINSINSTANCES/INSTANCE1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := DigitalTwinsInstanceID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/disks/disk_pool_iscsi_target_lun_resource.go b/internal/services/disks/disk_pool_iscsi_target_lun_resource.go index 621ac3480941..c4a472129b4b 100644 --- a/internal/services/disks/disk_pool_iscsi_target_lun_resource.go +++ b/internal/services/disks/disk_pool_iscsi_target_lun_resource.go @@ -12,7 +12,6 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-02/disks" "github.com/hashicorp/go-azure-sdk/resource-manager/storagepool/2021-08-01/diskpools" "github.com/hashicorp/go-azure-sdk/resource-manager/storagepool/2021-08-01/iscsitargets" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" @@ -176,7 +175,7 @@ func (d DiskPoolIscsiTargetLunModel) Read() sdk.ResourceFunc { for _, lun := range *resp.Model.Properties.Luns { if lun.ManagedDiskAzureResourceId == id.ManagedDiskId.ID() { diskPoolId := diskpools.NewDiskPoolID(iscsiTargetId.SubscriptionId, iscsiTargetId.ResourceGroupName, iscsiTargetId.DiskPoolName) - diskId, err := disks.ParseDiskID(lun.ManagedDiskAzureResourceId) + diskId, err := disks.ParseDiskIDInsensitively(lun.ManagedDiskAzureResourceId) if err != nil { return fmt.Errorf("invalid managed disk id in iscsi target response %q : %q", iscsiTargetId.ID(), lun.ManagedDiskAzureResourceId) } @@ -266,7 +265,7 @@ func (d DiskPoolIscsiTargetLunModel) IDValidationFunc() pluginsdk.SchemaValidate } func (DiskPoolIscsiTargetLunModel) RetryError(timeout time.Duration, action string, id string, retryFunc func() error) error { - return pluginsdk.Retry(timeout, func() *resource.RetryError { + return pluginsdk.Retry(timeout, func() *pluginsdk.RetryError { err := retryFunc() if err == nil { return nil diff --git a/internal/services/disks/disk_pool_iscsi_target_resource.go b/internal/services/disks/disk_pool_iscsi_target_resource.go index 1a8a66e865d8..2f4ac704113f 100644 --- a/internal/services/disks/disk_pool_iscsi_target_resource.go +++ b/internal/services/disks/disk_pool_iscsi_target_resource.go @@ -9,7 +9,6 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/storagepool/2021-08-01/iscsitargets" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" @@ -148,7 +147,7 @@ func (d DisksPoolIscsiTargetResource) Create() sdk.ResourceFunc { return fmt.Errorf("could not retrieve context deadline for %s", id.ID()) } //lintignore:R006 - return pluginsdk.Retry(time.Until(deadline), func() *resource.RetryError { + return pluginsdk.Retry(time.Until(deadline), func() *pluginsdk.RetryError { //lintignore:R006 if err := d.retryError("waiting for creation DisksPool iscsi target", id.ID(), future.Poller.PollUntilDone()); err != nil { return err @@ -219,7 +218,7 @@ func (d DisksPoolIscsiTargetResource) Delete() sdk.ResourceFunc { return fmt.Errorf("could not retrieve context deadline for %s", id) } //lintignore:R006 - return pluginsdk.Retry(time.Until(deadline), func() *resource.RetryError { + return pluginsdk.Retry(time.Until(deadline), func() *pluginsdk.RetryError { return d.retryError("waiting for deletion of DisksPool iscsi target", id.ID(), future.Poller.PollUntilDone()) }) }, @@ -230,7 +229,7 @@ func (d DisksPoolIscsiTargetResource) IDValidationFunc() pluginsdk.SchemaValidat return iscsitargets.ValidateIscsiTargetID } -func (DisksPoolIscsiTargetResource) retryError(action string, id string, err error) *resource.RetryError { +func (DisksPoolIscsiTargetResource) retryError(action string, id string, err error) *pluginsdk.RetryError { if err == nil { return nil } diff --git a/internal/services/disks/disk_pool_resource.go b/internal/services/disks/disk_pool_resource.go index b5f303fa446b..7301d03a0d30 100644 --- a/internal/services/disks/disk_pool_resource.go +++ b/internal/services/disks/disk_pool_resource.go @@ -12,7 +12,6 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" "github.com/hashicorp/go-azure-sdk/resource-manager/storagepool/2021-08-01/diskpools" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" @@ -126,7 +125,7 @@ func (r DiskPoolResource) Create() sdk.ResourceFunc { } //lintignore:R006 - return pluginsdk.Retry(time.Until(deadline), func() *resource.RetryError { + return pluginsdk.Retry(time.Until(deadline), func() *pluginsdk.RetryError { if err := r.retryError("waiting for creation", id.ID(), future.Poller.PollUntilDone()); err != nil { return err } @@ -198,7 +197,7 @@ func (r DiskPoolResource) Delete() sdk.ResourceFunc { } //lintignore:R006 - return pluginsdk.Retry(time.Until(deadline), func() *resource.RetryError { + return pluginsdk.Retry(time.Until(deadline), func() *pluginsdk.RetryError { return r.retryError("waiting for deletion", id.ID(), future.Poller.PollUntilDone()) }) }, @@ -247,14 +246,14 @@ func (r DiskPoolResource) Update() sdk.ResourceFunc { } //lintignore:R006 - return pluginsdk.Retry(time.Until(deadline), func() *resource.RetryError { + return pluginsdk.Retry(time.Until(deadline), func() *pluginsdk.RetryError { return r.retryError("waiting for update", id.ID(), future.Poller.PollUntilDone()) }) }, } } -func (DiskPoolResource) retryError(action string, id string, err error) *resource.RetryError { +func (DiskPoolResource) retryError(action string, id string, err error) *pluginsdk.RetryError { if err == nil { return nil } diff --git a/internal/services/dns/dns_a_record_data_source.go b/internal/services/dns/dns_a_record_data_source.go index 097da3483707..0b57b65c43c6 100644 --- a/internal/services/dns/dns_a_record_data_source.go +++ b/internal/services/dns/dns_a_record_data_source.go @@ -81,7 +81,7 @@ func dataSourceDnsARecordRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_a_record_resource.go b/internal/services/dns/dns_a_record_resource.go index 72ddfd9330bd..43b5216a9523 100644 --- a/internal/services/dns/dns_a_record_resource.go +++ b/internal/services/dns/dns_a_record_resource.go @@ -171,7 +171,7 @@ func resourceDnsARecordRead(d *pluginsdk.ResourceData, meta interface{}) error { d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_aaaa_record_data_source.go b/internal/services/dns/dns_aaaa_record_data_source.go index ea1bc66b4c80..9cbf1dae97cc 100644 --- a/internal/services/dns/dns_aaaa_record_data_source.go +++ b/internal/services/dns/dns_aaaa_record_data_source.go @@ -82,7 +82,7 @@ func dataSourceDnsAAAARecordRead(d *pluginsdk.ResourceData, meta interface{}) er d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_aaaa_record_resource.go b/internal/services/dns/dns_aaaa_record_resource.go index 7602500b32b4..57dd632e28ed 100644 --- a/internal/services/dns/dns_aaaa_record_resource.go +++ b/internal/services/dns/dns_aaaa_record_resource.go @@ -174,7 +174,7 @@ func resourceDnsAaaaRecordRead(d *pluginsdk.ResourceData, meta interface{}) erro d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_caa_record_data_source.go b/internal/services/dns/dns_caa_record_data_source.go index a8eea460c0e9..0ee83a94fbbf 100644 --- a/internal/services/dns/dns_caa_record_data_source.go +++ b/internal/services/dns/dns_caa_record_data_source.go @@ -93,7 +93,7 @@ func dataSourceDnsCaaRecordRead(d *pluginsdk.ResourceData, meta interface{}) err d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_caa_record_resource.go b/internal/services/dns/dns_caa_record_resource.go index 8268b55cc4a5..428f2977610c 100644 --- a/internal/services/dns/dns_caa_record_resource.go +++ b/internal/services/dns/dns_caa_record_resource.go @@ -172,7 +172,7 @@ func resourceDnsCaaRecordRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_cname_record_data_source.go b/internal/services/dns/dns_cname_record_data_source.go index dbcbd6c16658..8f811b1bc465 100644 --- a/internal/services/dns/dns_cname_record_data_source.go +++ b/internal/services/dns/dns_cname_record_data_source.go @@ -79,7 +79,7 @@ func dataSourceDnsCNameRecordRead(d *pluginsdk.ResourceData, meta interface{}) e d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_cname_record_resource.go b/internal/services/dns/dns_cname_record_resource.go index bc342dcd0a67..e176941c627a 100644 --- a/internal/services/dns/dns_cname_record_resource.go +++ b/internal/services/dns/dns_cname_record_resource.go @@ -172,7 +172,7 @@ func resourceDnsCNameRecordRead(d *pluginsdk.ResourceData, meta interface{}) err d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_mx_record_data_source.go b/internal/services/dns/dns_mx_record_data_source.go index 7905f5d600cb..368bd06fa7e9 100644 --- a/internal/services/dns/dns_mx_record_data_source.go +++ b/internal/services/dns/dns_mx_record_data_source.go @@ -89,7 +89,7 @@ func dataSourceDnsMxRecordRead(d *pluginsdk.ResourceData, meta interface{}) erro d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_mx_record_resource.go b/internal/services/dns/dns_mx_record_resource.go index b1efe43398d8..0fa5a5ffe36e 100644 --- a/internal/services/dns/dns_mx_record_resource.go +++ b/internal/services/dns/dns_mx_record_resource.go @@ -163,7 +163,7 @@ func resourceDnsMxRecordRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_ns_record_data_source.go b/internal/services/dns/dns_ns_record_data_source.go index e2a2cfc6fe85..e8c147146a3a 100644 --- a/internal/services/dns/dns_ns_record_data_source.go +++ b/internal/services/dns/dns_ns_record_data_source.go @@ -77,7 +77,7 @@ func dataSourceDnsNsRecordRead(d *pluginsdk.ResourceData, meta interface{}) erro d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_ns_record_resource.go b/internal/services/dns/dns_ns_record_resource.go index f191123af58b..23c3b0fe2085 100644 --- a/internal/services/dns/dns_ns_record_resource.go +++ b/internal/services/dns/dns_ns_record_resource.go @@ -192,7 +192,7 @@ func resourceDnsNsRecordRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_ptr_record_data_source.go b/internal/services/dns/dns_ptr_record_data_source.go index b323c1a19069..316d71067efc 100644 --- a/internal/services/dns/dns_ptr_record_data_source.go +++ b/internal/services/dns/dns_ptr_record_data_source.go @@ -76,7 +76,7 @@ func dataSourceDnsPtrRecordRead(d *pluginsdk.ResourceData, meta interface{}) err d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_ptr_record_resource.go b/internal/services/dns/dns_ptr_record_resource.go index 9e0b825f84dc..8ae0aba3d6f2 100644 --- a/internal/services/dns/dns_ptr_record_resource.go +++ b/internal/services/dns/dns_ptr_record_resource.go @@ -147,7 +147,7 @@ func resourceDnsPtrRecordRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_soa_record_data_source.go b/internal/services/dns/dns_soa_record_data_source.go index 01b02ad9e4e3..ecd69be19988 100644 --- a/internal/services/dns/dns_soa_record_data_source.go +++ b/internal/services/dns/dns_soa_record_data_source.go @@ -103,7 +103,7 @@ func dataSourceDnsSoaRecordRead(d *pluginsdk.ResourceData, meta interface{}) err d.SetId(id.ID()) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_srv_record_data_source.go b/internal/services/dns/dns_srv_record_data_source.go index 504f8597c610..20e6afe719ff 100644 --- a/internal/services/dns/dns_srv_record_data_source.go +++ b/internal/services/dns/dns_srv_record_data_source.go @@ -97,7 +97,7 @@ func dataSourceDnsSrvRecordRead(d *pluginsdk.ResourceData, meta interface{}) err d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_srv_record_resource.go b/internal/services/dns/dns_srv_record_resource.go index 0ab7a0a327fd..fe553c43af40 100644 --- a/internal/services/dns/dns_srv_record_resource.go +++ b/internal/services/dns/dns_srv_record_resource.go @@ -172,7 +172,7 @@ func resourceDnsSrvRecordRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_txt_record_data_source.go b/internal/services/dns/dns_txt_record_data_source.go index bd86d84c040a..7ebbf6836dbc 100644 --- a/internal/services/dns/dns_txt_record_data_source.go +++ b/internal/services/dns/dns_txt_record_data_source.go @@ -82,7 +82,7 @@ func dataSourceDnsTxtRecordRead(d *pluginsdk.ResourceData, meta interface{}) err d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_txt_record_resource.go b/internal/services/dns/dns_txt_record_resource.go index 2e7ca34437dc..176e06487e4d 100644 --- a/internal/services/dns/dns_txt_record_resource.go +++ b/internal/services/dns/dns_txt_record_resource.go @@ -157,7 +157,7 @@ func resourceDnsTxtRecordRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.ZoneName) + d.Set("zone_name", id.DnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/dns/dns_zone_data_source.go b/internal/services/dns/dns_zone_data_source.go index bdd483ad11d5..542da208c4bd 100644 --- a/internal/services/dns/dns_zone_data_source.go +++ b/internal/services/dns/dns_zone_data_source.go @@ -77,13 +77,13 @@ func dataSourceDnsZoneRead(d *pluginsdk.ResourceData, meta interface{}) error { zone = resp.Model } else { - result, resourceGroupName, err := findZone(ctx, client, id.SubscriptionId, id.ZoneName) + result, resourceGroupName, err := findZone(ctx, client, id.SubscriptionId, id.DnsZoneName) if err != nil { return err } if resourceGroupName == nil { - return fmt.Errorf("unable to locate the Resource Group for DNS Zone %q in Subscription %q", id.ResourceGroupName, subscriptionId) + return fmt.Errorf("unable to locate the Resource Group for DNS Zone %q in Subscription %q", id.DnsZoneName, subscriptionId) } zone = result @@ -96,7 +96,7 @@ func dataSourceDnsZoneRead(d *pluginsdk.ResourceData, meta interface{}) error { d.SetId(id.ID()) - d.Set("name", id.ZoneName) + d.Set("name", id.DnsZoneName) d.Set("resource_group_name", id.ResourceGroupName) if props := zone.Properties; props != nil { diff --git a/internal/services/dns/dns_zone_resource.go b/internal/services/dns/dns_zone_resource.go index 57317aa9eebc..d56130798c0c 100644 --- a/internal/services/dns/dns_zone_resource.go +++ b/internal/services/dns/dns_zone_resource.go @@ -190,11 +190,11 @@ func resourceDnsZoneCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) er }, } - if len(id.ZoneName+strings.TrimSuffix(*rsParameters.Properties.SOARecord.Email, ".")) > 253 { + if len(id.DnsZoneName+strings.TrimSuffix(*rsParameters.Properties.SOARecord.Email, ".")) > 253 { return fmt.Errorf("`email` which is concatenated with DNS Zone `name` cannot exceed 253 characters excluding a trailing period") } - soaRecordId := recordsets.NewRecordTypeID(id.SubscriptionId, id.ResourceGroupName, id.ZoneName, recordsets.RecordTypeSOA, "@") + soaRecordId := recordsets.NewRecordTypeID(id.SubscriptionId, id.ResourceGroupName, id.DnsZoneName, recordsets.RecordTypeSOA, "@") if _, err := recordSetsClient.CreateOrUpdate(ctx, soaRecordId, rsParameters, recordsets.DefaultCreateOrUpdateOperationOptions()); err != nil { return fmt.Errorf("creating/updating %s: %+v", soaRecordId, err) } @@ -225,7 +225,7 @@ func resourceDnsZoneRead(d *pluginsdk.ResourceData, meta interface{}) error { return fmt.Errorf("retrieving %s: %+v", *id, err) } - soaRecord := recordsets.NewRecordTypeID(id.SubscriptionId, id.ResourceGroupName, id.ZoneName, recordsets.RecordTypeSOA, "@") + soaRecord := recordsets.NewRecordTypeID(id.SubscriptionId, id.ResourceGroupName, id.DnsZoneName, recordsets.RecordTypeSOA, "@") soaRecordResp, err := recordSetsClient.Get(ctx, soaRecord) if err != nil { return fmt.Errorf("retrieving %s: %+v", id, err) @@ -235,7 +235,7 @@ func resourceDnsZoneRead(d *pluginsdk.ResourceData, meta interface{}) error { return fmt.Errorf("setting `soa_record`: %+v", err) } - d.Set("name", id.ZoneName) + d.Set("name", id.DnsZoneName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/domainservices/active_directory_domain_service_resource.go b/internal/services/domainservices/active_directory_domain_service_resource.go index 4ec2291c078e..0381102e269f 100644 --- a/internal/services/domainservices/active_directory_domain_service_resource.go +++ b/internal/services/domainservices/active_directory_domain_service_resource.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "log" - "regexp" "strings" "time" @@ -18,6 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/validate" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -59,13 +59,10 @@ func resourceActiveDirectoryDomainService() *pluginsdk.Resource { "resource_group_name": commonschema.ResourceGroupName(), "domain_name": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringMatch( - regexp.MustCompile("^[0-9a-zA-Z][0-9a-zA-Z-]{1,13}[0-9a-zA-Z](.[0-9a-zA-Z-]+)+$"), - "domain_name must be a valid FQDN and the first element must be 15 or fewer characters", - ), + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.DomainServiceName, }, "initial_replica_set": { diff --git a/internal/services/domainservices/active_directory_domain_service_trust_resource_test.go b/internal/services/domainservices/active_directory_domain_service_trust_resource_test.go index b4c7533e7bc0..de30ff15fb3b 100644 --- a/internal/services/domainservices/active_directory_domain_service_trust_resource_test.go +++ b/internal/services/domainservices/active_directory_domain_service_trust_resource_test.go @@ -8,12 +8,11 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -80,10 +79,10 @@ func TestAccDomainServiceTrust_basic(t *testing.T) { t.Skipf("Skipping: %v", err) } - data.ResourceSequentialTest(t, r, []resource.TestStep{ + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -98,10 +97,10 @@ func TestAccDomainServiceTrust_requiresImport(t *testing.T) { t.Skipf("Skipping: %v", err) } - data.ResourceSequentialTest(t, r, []resource.TestStep{ + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -109,7 +108,7 @@ func TestAccDomainServiceTrust_requiresImport(t *testing.T) { }) } -func (r DomainServiceTrustResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r DomainServiceTrustResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { client := clients.DomainServices.DomainServicesClient id, err := parse.DomainServiceTrustID(state.ID) diff --git a/internal/services/domainservices/validate/domain_service_name.go b/internal/services/domainservices/validate/domain_service_name.go new file mode 100644 index 000000000000..db8a2261c200 --- /dev/null +++ b/internal/services/domainservices/validate/domain_service_name.go @@ -0,0 +1,21 @@ +package validate + +import ( + "fmt" + "regexp" +) + +func DomainServiceName(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + p := regexp.MustCompile(`^(([0-9a-zA-Z])|(([0-9a-zA-Z][0-9a-zA-Z-]{0,13}[0-9a-zA-Z])))(\.[0-9a-zA-Z-]+)+$`) + if !p.MatchString(v) { + errors = append(errors, fmt.Errorf("domain_name must be a valid FQDN and the first element must be 15 or fewer characters")) + } + + return +} diff --git a/internal/services/domainservices/validate/domain_service_name_test.go b/internal/services/domainservices/validate/domain_service_name_test.go new file mode 100644 index 000000000000..580406d2e887 --- /dev/null +++ b/internal/services/domainservices/validate/domain_service_name_test.go @@ -0,0 +1,101 @@ +package validate + +import ( + "strings" + "testing" +) + +func TestDomainServiceName(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + + { + // empty + Input: "", + Valid: false, + }, + + { + // one length subdomain of invalid char + Input: "-.com", + Valid: false, + }, + + { + // two length subdomain of invalid char (prefix) + Input: "-a.com", + Valid: false, + }, + + { + // two length subdomain of invalid char (suffix) + Input: "a-.com", + Valid: false, + }, + + { + // subdomain longer than 15 + Input: strings.Repeat("a", 16) + ".com", + Valid: false, + }, + + { + // three length subdomain + Input: "aaa.com", + Valid: true, + }, + + { + // three length subdomain with dash + Input: "a-a.com", + Valid: true, + }, + + { + // wide length subdomain + Input: strings.Repeat("a", 15) + ".com", + Valid: true, + }, + + { + // one length subdomain + Input: "a.com", + Valid: true, + }, + + { + // two length subdomain + Input: "aa.com", + Valid: true, + }, + + { + // three length subdomain + Input: "aaa.com", + Valid: true, + }, + + { + // three length subdomain with dash + Input: "a-a.com", + Valid: true, + }, + + { + // wide length subdomain + Input: strings.Repeat("a", 14) + ".com", + Valid: true, + }, + } + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := DomainServiceName(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} diff --git a/internal/services/eventgrid/eventgrid_domain_resource_test.go b/internal/services/eventgrid/eventgrid_domain_resource_test.go index e954b0b6624b..9bbb1ed5878c 100644 --- a/internal/services/eventgrid/eventgrid_domain_resource_test.go +++ b/internal/services/eventgrid/eventgrid_domain_resource_test.go @@ -5,11 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -181,7 +181,7 @@ func TestAccEventGridDomain_basicWithUserAssignedManagedIdentity(t *testing.T) { }) } -func (EventGridDomainResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (EventGridDomainResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.DomainID(state.ID) if err != nil { return nil, err diff --git a/internal/services/eventgrid/eventgrid_domain_topic_resource.go b/internal/services/eventgrid/eventgrid_domain_topic_resource.go index 9590b71e2de1..89fa562cc1fc 100644 --- a/internal/services/eventgrid/eventgrid_domain_topic_resource.go +++ b/internal/services/eventgrid/eventgrid_domain_topic_resource.go @@ -41,8 +41,8 @@ func resourceEventGridDomainTopic() *pluginsdk.Resource { ValidateFunc: validation.All( validation.StringIsNotEmpty, validation.StringMatch( - regexp.MustCompile("^[-a-zA-Z0-9]{3,50}$"), - "EventGrid domain name must be 3 - 50 characters long, contain only letters, numbers and hyphens.", + regexp.MustCompile("^[-a-zA-Z0-9]{3,128}$"), + "EventGrid domain topic name must be 3 - 128 characters long, contain only letters, numbers and hyphens.", ), ), }, diff --git a/internal/services/eventgrid/eventgrid_event_subscription_resource_test.go b/internal/services/eventgrid/eventgrid_event_subscription_resource_test.go index 684a45e889cf..c766abbf2087 100644 --- a/internal/services/eventgrid/eventgrid_event_subscription_resource_test.go +++ b/internal/services/eventgrid/eventgrid_event_subscription_resource_test.go @@ -5,11 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -421,7 +421,7 @@ func TestAccEventGridEventSubscription_userIdentity(t *testing.T) { }) } -func (EventGridEventSubscriptionResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (EventGridEventSubscriptionResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.EventSubscriptionID(state.ID) if err != nil { return nil, err diff --git a/internal/services/eventgrid/eventgrid_system_topic_event_subscription_resource_test.go b/internal/services/eventgrid/eventgrid_system_topic_event_subscription_resource_test.go index 9ad600cc98e5..1cfc9a9e94f0 100644 --- a/internal/services/eventgrid/eventgrid_system_topic_event_subscription_resource_test.go +++ b/internal/services/eventgrid/eventgrid_system_topic_event_subscription_resource_test.go @@ -5,11 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -421,7 +421,7 @@ func TestAccEventGridSystemTopicEventSubscription_deliveryPropertiesHybridRelay( }) } -func (EventGridSystemTopicEventSubscriptionResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (EventGridSystemTopicEventSubscriptionResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.SystemTopicEventSubscriptionID(state.ID) if err != nil { return nil, err diff --git a/internal/services/eventgrid/eventgrid_topic_resource_test.go b/internal/services/eventgrid/eventgrid_topic_resource_test.go index cf36a10d83bf..82e6a035d93a 100644 --- a/internal/services/eventgrid/eventgrid_topic_resource_test.go +++ b/internal/services/eventgrid/eventgrid_topic_resource_test.go @@ -5,11 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -185,7 +185,7 @@ func TestAccEventGridTopic_basicWithUserAssignedManagedIdentity(t *testing.T) { }) } -func (EventGridTopicResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (EventGridTopicResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.TopicID(state.ID) if err != nil { return nil, err diff --git a/internal/services/eventhub/eventhub_authorization_rule_data_source.go b/internal/services/eventhub/eventhub_authorization_rule_data_source.go index 64682d9972af..afa2c797de3e 100644 --- a/internal/services/eventhub/eventhub_authorization_rule_data_source.go +++ b/internal/services/eventhub/eventhub_authorization_rule_data_source.go @@ -93,11 +93,11 @@ func EventHubAuthorizationRuleDataSourceRead(d *pluginsdk.ResourceData, meta int d.SetId(id.ID()) d.Set("name", id.AuthorizationRuleName) - d.Set("eventhub_name", id.EventHubName) + d.Set("eventhub_name", id.EventhubName) d.Set("namespace_name", id.NamespaceName) d.Set("resource_group_name", id.ResourceGroupName) - localId := authorizationruleseventhubs.NewEventhubAuthorizationRuleID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventHubName, id.AuthorizationRuleName) + localId := authorizationruleseventhubs.NewEventhubAuthorizationRuleID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventhubName, id.AuthorizationRuleName) keysResp, err := rulesClient.EventHubsListKeys(ctx, localId) if err != nil { return fmt.Errorf("listing keys for %s: %+v", id, err) diff --git a/internal/services/eventhub/eventhub_authorization_rule_resource.go b/internal/services/eventhub/eventhub_authorization_rule_resource.go index 2a299e45ca5b..95bf4a1723e5 100644 --- a/internal/services/eventhub/eventhub_authorization_rule_resource.go +++ b/internal/services/eventhub/eventhub_authorization_rule_resource.go @@ -94,8 +94,8 @@ func resourceEventHubAuthorizationRuleCreateUpdate(d *pluginsdk.ResourceData, me } } - locks.ByName(id.EventHubName, eventHubResourceName) - defer locks.UnlockByName(id.EventHubName, eventHubResourceName) + locks.ByName(id.EventhubName, eventHubResourceName) + defer locks.UnlockByName(id.EventhubName, eventHubResourceName) locks.ByName(id.NamespaceName, eventHubNamespaceResourceName) defer locks.UnlockByName(id.NamespaceName, eventHubNamespaceResourceName) @@ -108,7 +108,7 @@ func resourceEventHubAuthorizationRuleCreateUpdate(d *pluginsdk.ResourceData, me } return pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { - localId := authorizationruleseventhubs.NewEventhubAuthorizationRuleID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventHubName, id.AuthorizationRuleName) + localId := authorizationruleseventhubs.NewEventhubAuthorizationRuleID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventhubName, id.AuthorizationRuleName) if _, err := authorizationRulesClient.EventHubsCreateOrUpdateAuthorizationRule(ctx, localId, parameters); err != nil { return pluginsdk.NonRetryableError(fmt.Errorf("creating %s: %+v", id, err)) } @@ -152,7 +152,7 @@ func resourceEventHubAuthorizationRuleRead(d *pluginsdk.ResourceData, meta inter } d.Set("name", id.AuthorizationRuleName) - d.Set("eventhub_name", id.EventHubName) + d.Set("eventhub_name", id.EventhubName) d.Set("namespace_name", id.NamespaceName) d.Set("resource_group_name", id.ResourceGroupName) @@ -165,7 +165,7 @@ func resourceEventHubAuthorizationRuleRead(d *pluginsdk.ResourceData, meta inter } } - localId := authorizationruleseventhubs.NewEventhubAuthorizationRuleID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventHubName, id.AuthorizationRuleName) + localId := authorizationruleseventhubs.NewEventhubAuthorizationRuleID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventhubName, id.AuthorizationRuleName) keysResp, err := authorizationRulesClient.EventHubsListKeys(ctx, localId) if err != nil { return fmt.Errorf("listing keys for %s: %+v", *id, err) @@ -193,8 +193,8 @@ func resourceEventHubAuthorizationRuleDelete(d *pluginsdk.ResourceData, meta int return err } - locks.ByName(id.EventHubName, eventHubResourceName) - defer locks.UnlockByName(id.EventHubName, eventHubResourceName) + locks.ByName(id.EventhubName, eventHubResourceName) + defer locks.UnlockByName(id.EventhubName, eventHubResourceName) locks.ByName(id.NamespaceName, eventHubNamespaceResourceName) defer locks.UnlockByName(id.NamespaceName, eventHubNamespaceResourceName) diff --git a/internal/services/eventhub/eventhub_consumer_group_data_source.go b/internal/services/eventhub/eventhub_consumer_group_data_source.go index 815cdb33ca98..9c9d61f18c6e 100644 --- a/internal/services/eventhub/eventhub_consumer_group_data_source.go +++ b/internal/services/eventhub/eventhub_consumer_group_data_source.go @@ -73,7 +73,7 @@ func EventHubConsumerGroupDataSourceRead(d *pluginsdk.ResourceData, meta interfa d.SetId(id.ID()) d.Set("name", id.ConsumerGroupName) - d.Set("eventhub_name", id.EventHubName) + d.Set("eventhub_name", id.EventhubName) d.Set("namespace_name", id.NamespaceName) d.Set("resource_group_name", id.ResourceGroupName) diff --git a/internal/services/eventhub/eventhub_consumer_group_resource.go b/internal/services/eventhub/eventhub_consumer_group_resource.go index 00e763e0b96e..b4a3b0b2e67d 100644 --- a/internal/services/eventhub/eventhub_consumer_group_resource.go +++ b/internal/services/eventhub/eventhub_consumer_group_resource.go @@ -168,7 +168,7 @@ func (r ConsumerGroupResource) Read() sdk.ResourceFunc { state := ConsumerGroupObject{ Name: id.ConsumerGroupName, NamespaceName: id.NamespaceName, - EventHubName: id.EventHubName, + EventHubName: id.EventhubName, ResourceGroupName: id.ResourceGroupName, } diff --git a/internal/services/eventhub/eventhub_data_source.go b/internal/services/eventhub/eventhub_data_source.go index 1dfc20e99d57..5dd392a36fb7 100644 --- a/internal/services/eventhub/eventhub_data_source.go +++ b/internal/services/eventhub/eventhub_data_source.go @@ -65,7 +65,7 @@ func dataSourceEventHubRead(d *pluginsdk.ResourceData, meta interface{}) error { d.SetId(id.ID()) - d.Set("name", id.EventHubName) + d.Set("name", id.EventhubName) d.Set("namespace_name", id.NamespaceName) d.Set("resource_group_name", id.ResourceGroupName) diff --git a/internal/services/eventhub/eventhub_namespace_disaster_recovery_config_resource.go b/internal/services/eventhub/eventhub_namespace_disaster_recovery_config_resource.go index 5a7c07f3b0ba..7da885daa6e2 100644 --- a/internal/services/eventhub/eventhub_namespace_disaster_recovery_config_resource.go +++ b/internal/services/eventhub/eventhub_namespace_disaster_recovery_config_resource.go @@ -185,7 +185,7 @@ func resourceEventHubNamespaceDisasterRecoveryConfigRead(d *pluginsdk.ResourceDa return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Alias) + d.Set("name", id.DisasterRecoveryConfigName) d.Set("namespace_name", id.NamespaceName) d.Set("resource_group_name", id.ResourceGroupName) @@ -276,7 +276,7 @@ func resourceEventHubNamespaceDisasterRecoveryConfigDelete(d *pluginsdk.Resource Timeout: d.Timeout(pluginsdk.TimeoutDelete), Refresh: func() (interface{}, string, error) { input := checknameavailabilitydisasterrecoveryconfigs.CheckNameAvailabilityParameter{ - Name: id.Alias, + Name: id.DisasterRecoveryConfigName, } resp, err := availabilityClient.DisasterRecoveryConfigsCheckNameAvailability(ctx, parentNamespaceId, input) if err != nil { diff --git a/internal/services/eventhub/eventhub_namespace_resource.go b/internal/services/eventhub/eventhub_namespace_resource.go index f4927a6a624a..46f6ae421073 100644 --- a/internal/services/eventhub/eventhub_namespace_resource.go +++ b/internal/services/eventhub/eventhub_namespace_resource.go @@ -106,7 +106,7 @@ func resourceEventHubNamespace() *pluginsdk.Resource { ValidateFunc: eventhubsclusters.ValidateClusterID, }, - "identity": commonschema.SystemOrUserAssignedIdentityOptional(), + "identity": commonschema.SystemAssignedUserAssignedIdentityOptional(), "maximum_throughput_units": { Type: pluginsdk.TypeInt, diff --git a/internal/services/eventhub/eventhub_resource.go b/internal/services/eventhub/eventhub_resource.go index eda0944bb973..701b61180c5f 100644 --- a/internal/services/eventhub/eventhub_resource.go +++ b/internal/services/eventhub/eventhub_resource.go @@ -60,6 +60,7 @@ func resourceEventHub() *pluginsdk.Resource { "partition_count": { Type: pluginsdk.TypeInt, Required: true, + ForceNew: true, ValidateFunc: validate.ValidateEventHubPartitionCount, }, @@ -273,7 +274,7 @@ func resourceEventHubRead(d *pluginsdk.ResourceData, meta interface{}) error { return fmt.Errorf("making Read request on %s: %+v", id, err) } - d.Set("name", id.EventHubName) + d.Set("name", id.EventhubName) d.Set("namespace_name", id.NamespaceName) d.Set("resource_group_name", id.ResourceGroupName) diff --git a/internal/services/firewall/azuresdkhacks/firewall.go b/internal/services/firewall/azuresdkhacks/firewall.go index 3ba8d88bb02b..a0271aa623f7 100644 --- a/internal/services/firewall/azuresdkhacks/firewall.go +++ b/internal/services/firewall/azuresdkhacks/firewall.go @@ -5,7 +5,7 @@ import ( "net/http" "github.com/Azure/go-autorest/autorest" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func DeleteFirewall(ctx context.Context, client *network.AzureFirewallsClient, resourceGroupName string, azureFirewallName string) (result network.AzureFirewallsDeleteFuture, err error) { diff --git a/internal/services/firewall/client/client.go b/internal/services/firewall/client/client.go index c028d2fc7a1f..7d5bf06316be 100644 --- a/internal/services/firewall/client/client.go +++ b/internal/services/firewall/client/client.go @@ -2,7 +2,7 @@ package client import ( "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type Client struct { diff --git a/internal/services/firewall/firewall_application_rule_collection_resource.go b/internal/services/firewall/firewall_application_rule_collection_resource.go index 2af03ce92a08..55d5d86c9c5b 100644 --- a/internal/services/firewall/firewall_application_rule_collection_resource.go +++ b/internal/services/firewall/firewall_application_rule_collection_resource.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceFirewallApplicationRuleCollection() *pluginsdk.Resource { @@ -147,8 +147,8 @@ func resourceFirewallApplicationRuleCollectionCreateUpdate(d *pluginsdk.Resource return fmt.Errorf("expanding Firewall Application Rules: %+v", err) } - locks.ByName(firewallName, azureFirewallResourceName) - defer locks.UnlockByName(firewallName, azureFirewallResourceName) + locks.ByName(firewallName, AzureFirewallResourceName) + defer locks.UnlockByName(firewallName, AzureFirewallResourceName) firewall, err := client.Get(ctx, resourceGroup, firewallName) if err != nil { @@ -324,8 +324,8 @@ func resourceFirewallApplicationRuleCollectionDelete(d *pluginsdk.ResourceData, return err } - locks.ByName(id.AzureFirewallName, azureFirewallResourceName) - defer locks.UnlockByName(id.AzureFirewallName, azureFirewallResourceName) + locks.ByName(id.AzureFirewallName, AzureFirewallResourceName) + defer locks.UnlockByName(id.AzureFirewallName, AzureFirewallResourceName) firewall, err := client.Get(ctx, id.ResourceGroup, id.AzureFirewallName) if err != nil { diff --git a/internal/services/firewall/firewall_application_rule_collection_resource_test.go b/internal/services/firewall/firewall_application_rule_collection_resource_test.go index acf6f171aec5..ac3cd83fd802 100644 --- a/internal/services/firewall/firewall_application_rule_collection_resource_test.go +++ b/internal/services/firewall/firewall_application_rule_collection_resource_test.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type FirewallApplicationRuleCollectionResource struct{} diff --git a/internal/services/firewall/firewall_data_source.go b/internal/services/firewall/firewall_data_source.go index 0b065288b91b..d8d25eada442 100644 --- a/internal/services/firewall/firewall_data_source.go +++ b/internal/services/firewall/firewall_data_source.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func firewallDataSource() *pluginsdk.Resource { diff --git a/internal/services/firewall/firewall_nat_rule_collection_resource.go b/internal/services/firewall/firewall_nat_rule_collection_resource.go index 0ab2e017a55e..30f03057e1a3 100644 --- a/internal/services/firewall/firewall_nat_rule_collection_resource.go +++ b/internal/services/firewall/firewall_nat_rule_collection_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceFirewallNatRuleCollection() *pluginsdk.Resource { @@ -140,8 +140,8 @@ func resourceFirewallNatRuleCollectionCreateUpdate(d *pluginsdk.ResourceData, me firewallName := d.Get("azure_firewall_name").(string) resourceGroup := d.Get("resource_group_name").(string) - locks.ByName(firewallName, azureFirewallResourceName) - defer locks.UnlockByName(firewallName, azureFirewallResourceName) + locks.ByName(firewallName, AzureFirewallResourceName) + defer locks.UnlockByName(firewallName, AzureFirewallResourceName) firewall, err := client.Get(ctx, resourceGroup, firewallName) if err != nil { @@ -322,8 +322,8 @@ func resourceFirewallNatRuleCollectionDelete(d *pluginsdk.ResourceData, meta int return err } - locks.ByName(id.AzureFirewallName, azureFirewallResourceName) - defer locks.UnlockByName(id.AzureFirewallName, azureFirewallResourceName) + locks.ByName(id.AzureFirewallName, AzureFirewallResourceName) + defer locks.UnlockByName(id.AzureFirewallName, AzureFirewallResourceName) firewall, err := client.Get(ctx, id.ResourceGroup, id.AzureFirewallName) if err != nil { diff --git a/internal/services/firewall/firewall_nat_rule_collection_resource_test.go b/internal/services/firewall/firewall_nat_rule_collection_resource_test.go index 04f8e3dc9aca..f98b70325c6a 100644 --- a/internal/services/firewall/firewall_nat_rule_collection_resource_test.go +++ b/internal/services/firewall/firewall_nat_rule_collection_resource_test.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type FirewallNatRuleCollectionResource struct{} diff --git a/internal/services/firewall/firewall_network_rule_collection_resource.go b/internal/services/firewall/firewall_network_rule_collection_resource.go index 2150ce91a724..aef68edeba51 100644 --- a/internal/services/firewall/firewall_network_rule_collection_resource.go +++ b/internal/services/firewall/firewall_network_rule_collection_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceFirewallNetworkRuleCollection() *pluginsdk.Resource { @@ -142,8 +142,8 @@ func resourceFirewallNetworkRuleCollectionCreateUpdate(d *pluginsdk.ResourceData firewallName := d.Get("azure_firewall_name").(string) resourceGroup := d.Get("resource_group_name").(string) - locks.ByName(firewallName, azureFirewallResourceName) - defer locks.UnlockByName(firewallName, azureFirewallResourceName) + locks.ByName(firewallName, AzureFirewallResourceName) + defer locks.UnlockByName(firewallName, AzureFirewallResourceName) firewall, err := client.Get(ctx, resourceGroup, firewallName) if err != nil { @@ -325,8 +325,8 @@ func resourceFirewallNetworkRuleCollectionDelete(d *pluginsdk.ResourceData, meta return err } - locks.ByName(id.AzureFirewallName, azureFirewallResourceName) - defer locks.UnlockByName(id.AzureFirewallName, azureFirewallResourceName) + locks.ByName(id.AzureFirewallName, AzureFirewallResourceName) + defer locks.UnlockByName(id.AzureFirewallName, AzureFirewallResourceName) firewall, err := client.Get(ctx, id.ResourceGroup, id.AzureFirewallName) if err != nil { diff --git a/internal/services/firewall/firewall_network_rule_collection_resource_test.go b/internal/services/firewall/firewall_network_rule_collection_resource_test.go index 1a32bfc91d69..f9967945c23c 100644 --- a/internal/services/firewall/firewall_network_rule_collection_resource_test.go +++ b/internal/services/firewall/firewall_network_rule_collection_resource_test.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type FirewallNetworkRuleCollectionResource struct{} diff --git a/internal/services/firewall/firewall_policy_data_source_test.go b/internal/services/firewall/firewall_policy_data_source_test.go index 1722a57a1c37..fc021ad11ba9 100644 --- a/internal/services/firewall/firewall_policy_data_source_test.go +++ b/internal/services/firewall/firewall_policy_data_source_test.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type FirewallPolicyDataSource struct{} diff --git a/internal/services/firewall/firewall_policy_resource.go b/internal/services/firewall/firewall_policy_resource.go index 675808375104..807cef29ac9b 100644 --- a/internal/services/firewall/firewall_policy_resource.go +++ b/internal/services/firewall/firewall_policy_resource.go @@ -22,10 +22,10 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) -const azureFirewallPolicyResourceName = "azurerm_firewall_policy" +const AzureFirewallPolicyResourceName = "azurerm_firewall_policy" func resourceFirewallPolicy() *pluginsdk.Resource { return &pluginsdk.Resource{ @@ -121,8 +121,8 @@ func resourceFirewallPolicyCreateUpdate(d *pluginsdk.ResourceData, meta interfac } } - locks.ByName(id.Name, azureFirewallPolicyResourceName) - defer locks.UnlockByName(id.Name, azureFirewallPolicyResourceName) + locks.ByName(id.Name, AzureFirewallPolicyResourceName) + defer locks.UnlockByName(id.Name, AzureFirewallPolicyResourceName) future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, props) if err != nil { @@ -254,8 +254,8 @@ func resourceFirewallPolicyDelete(d *pluginsdk.ResourceData, meta interface{}) e return err } - locks.ByName(id.Name, azureFirewallPolicyResourceName) - defer locks.UnlockByName(id.Name, azureFirewallPolicyResourceName) + locks.ByName(id.Name, AzureFirewallPolicyResourceName) + defer locks.UnlockByName(id.Name, AzureFirewallPolicyResourceName) future, err := client.Delete(ctx, id.ResourceGroup, id.Name) if err != nil { diff --git a/internal/services/firewall/firewall_policy_rule_collection_group_resource.go b/internal/services/firewall/firewall_policy_rule_collection_group_resource.go index 88b383cf0a16..c38b4c5fc9cb 100644 --- a/internal/services/firewall/firewall_policy_rule_collection_group_resource.go +++ b/internal/services/firewall/firewall_policy_rule_collection_group_resource.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceFirewallPolicyRuleCollectionGroup() *pluginsdk.Resource { @@ -442,8 +442,8 @@ func resourceFirewallPolicyRuleCollectionGroupCreateUpdate(d *pluginsdk.Resource } } - locks.ByName(policyId.Name, azureFirewallPolicyResourceName) - defer locks.UnlockByName(policyId.Name, azureFirewallPolicyResourceName) + locks.ByName(policyId.Name, AzureFirewallPolicyResourceName) + defer locks.UnlockByName(policyId.Name, AzureFirewallPolicyResourceName) param := network.FirewallPolicyRuleCollectionGroup{ FirewallPolicyRuleCollectionGroupProperties: &network.FirewallPolicyRuleCollectionGroupProperties{ @@ -540,8 +540,8 @@ func resourceFirewallPolicyRuleCollectionGroupDelete(d *pluginsdk.ResourceData, return err } - locks.ByName(id.FirewallPolicyName, azureFirewallPolicyResourceName) - defer locks.UnlockByName(id.FirewallPolicyName, azureFirewallPolicyResourceName) + locks.ByName(id.FirewallPolicyName, AzureFirewallPolicyResourceName) + defer locks.UnlockByName(id.FirewallPolicyName, AzureFirewallPolicyResourceName) future, err := client.Delete(ctx, id.ResourceGroup, id.FirewallPolicyName, id.RuleCollectionGroupName) if err != nil { diff --git a/internal/services/firewall/firewall_resource.go b/internal/services/firewall/firewall_resource.go index ad399dfc7568..e018ef5d3415 100644 --- a/internal/services/firewall/firewall_resource.go +++ b/internal/services/firewall/firewall_resource.go @@ -24,10 +24,10 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) -var azureFirewallResourceName = "azurerm_firewall" +var AzureFirewallResourceName = "azurerm_firewall" func resourceFirewall() *pluginsdk.Resource { resource := pluginsdk.Resource{ @@ -327,8 +327,14 @@ func resourceFirewallCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) e } } - locks.ByName(id.AzureFirewallName, azureFirewallResourceName) - defer locks.UnlockByName(id.AzureFirewallName, azureFirewallResourceName) + if policyId, ok := d.GetOk("firewall_policy_id"); ok { + id, _ := parse.FirewallPolicyID(policyId.(string)) + locks.ByName(id.Name, AzureFirewallPolicyResourceName) + defer locks.UnlockByName(id.Name, AzureFirewallPolicyResourceName) + } + + locks.ByName(id.AzureFirewallName, AzureFirewallResourceName) + defer locks.UnlockByName(id.AzureFirewallName, AzureFirewallResourceName) locks.MultipleByName(vnetToLock, VirtualNetworkResourceName) defer locks.UnlockMultipleByName(vnetToLock, VirtualNetworkResourceName) @@ -497,8 +503,14 @@ func resourceFirewallDelete(d *pluginsdk.ResourceData, meta interface{}) error { } } - locks.ByName(id.AzureFirewallName, azureFirewallResourceName) - defer locks.UnlockByName(id.AzureFirewallName, azureFirewallResourceName) + if read.FirewallPolicy != nil && read.FirewallPolicy.ID != nil { + id, _ := parse.FirewallPolicyID(*read.FirewallPolicy.ID) + locks.ByName(id.Name, AzureFirewallPolicyResourceName) + defer locks.UnlockByName(id.Name, AzureFirewallPolicyResourceName) + } + + locks.ByName(id.AzureFirewallName, AzureFirewallResourceName) + defer locks.UnlockByName(id.AzureFirewallName, AzureFirewallResourceName) locks.MultipleByName(&virtualNetworkNamesToLock, VirtualNetworkResourceName) defer locks.UnlockMultipleByName(&virtualNetworkNamesToLock, VirtualNetworkResourceName) diff --git a/internal/services/firewall/subresource.go b/internal/services/firewall/subresource.go index 7c2054d31f7f..abe468c1e527 100644 --- a/internal/services/firewall/subresource.go +++ b/internal/services/firewall/subresource.go @@ -1,7 +1,7 @@ package firewall import ( - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func flattenNetworkSubResourceID(input *[]network.SubResource) []interface{} { diff --git a/internal/services/fluidrelay/fluid_relay_servers_resource_test.go b/internal/services/fluidrelay/fluid_relay_servers_resource_test.go index 9c148ab65ee7..836781e2c174 100644 --- a/internal/services/fluidrelay/fluid_relay_servers_resource_test.go +++ b/internal/services/fluidrelay/fluid_relay_servers_resource_test.go @@ -27,7 +27,6 @@ func TestAccFluidRelay_basic(t *testing.T) { check.That(data.ResourceName).ExistsInAzure(f), check.That(data.ResourceName).Key("frs_tenant_id").IsUUID(), check.That(data.ResourceName).Key("primary_key").Exists(), - check.That(data.ResourceName).Key("orderer_endpoints.0").Exists(), check.That(data.ResourceName).Key("service_endpoints.#").Exists(), ), }, @@ -45,7 +44,6 @@ func TestAccFluidRelay_storageBasic(t *testing.T) { Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(f), check.That(data.ResourceName).Key("frs_tenant_id").IsUUID(), - check.That(data.ResourceName).Key("orderer_endpoints.0").Exists(), ), }, data.ImportStep("storage_sku"), diff --git a/internal/services/frontdoor/client/client.go b/internal/services/frontdoor/client/client.go index aae011feaeed..2afd53ce8ec9 100644 --- a/internal/services/frontdoor/client/client.go +++ b/internal/services/frontdoor/client/client.go @@ -1,9 +1,9 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies" + "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/sdk/2020-05-01/frontdoors" ) // NOTE: @tombuildsstuff: we cannot upgrade the "old" FrontDoor resources past 2020-11-01 diff --git a/internal/services/frontdoor/customizediff.go b/internal/services/frontdoor/customizediff.go index fbcf6242745b..754a0fb0ab5a 100644 --- a/internal/services/frontdoor/customizediff.go +++ b/internal/services/frontdoor/customizediff.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" + "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors" "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/sdk/2020-05-01/frontdoors" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/frontdoor/frontdoor_custom_https_configuration.go b/internal/services/frontdoor/frontdoor_custom_https_configuration.go index 555e3718a17e..d2a06005d624 100644 --- a/internal/services/frontdoor/frontdoor_custom_https_configuration.go +++ b/internal/services/frontdoor/frontdoor_custom_https_configuration.go @@ -1,7 +1,7 @@ package frontdoor import ( - "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/sdk/2020-05-01/frontdoors" + "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" ) @@ -61,7 +61,7 @@ func flattenCustomHttpsConfiguration(properties *frontdoors.FrontendEndpointProp return result } - if config := properties.CustomHttpsConfiguration; config != nil { + if config := properties.CustomHTTPSConfiguration; config != nil { certificateSource := string(frontdoors.FrontDoorCertificateSourceFrontDoor) keyVaultCertificateVaultId := "" keyVaultCertificateSecretName := "" @@ -87,13 +87,13 @@ func flattenCustomHttpsConfiguration(properties *frontdoors.FrontendEndpointProp } } - if properties.CustomHttpsProvisioningState != nil && *properties.CustomHttpsProvisioningState != "" { - provisioningState = string(*properties.CustomHttpsProvisioningState) - if properties.CustomHttpsProvisioningState != nil && *properties.CustomHttpsProvisioningState == frontdoors.CustomHttpsProvisioningStateEnabled || *properties.CustomHttpsProvisioningState == frontdoors.CustomHttpsProvisioningStateEnabling { + if properties.CustomHTTPSProvisioningState != nil && *properties.CustomHTTPSProvisioningState != "" { + provisioningState = string(*properties.CustomHTTPSProvisioningState) + if properties.CustomHTTPSProvisioningState != nil && *properties.CustomHTTPSProvisioningState == frontdoors.CustomHTTPSProvisioningStateEnabled || *properties.CustomHTTPSProvisioningState == frontdoors.CustomHTTPSProvisioningStateEnabling { result.CustomHTTPSProvisioningEnabled = true - if properties.CustomHttpsProvisioningSubstate != nil && *properties.CustomHttpsProvisioningSubstate != "" { - provisioningSubstate = string(*properties.CustomHttpsProvisioningSubstate) + if properties.CustomHTTPSProvisioningSubstate != nil && *properties.CustomHTTPSProvisioningSubstate != "" { + provisioningSubstate = string(*properties.CustomHTTPSProvisioningSubstate) } } diff --git a/internal/services/frontdoor/frontdoor_custom_https_configuration_resource.go b/internal/services/frontdoor/frontdoor_custom_https_configuration_resource.go index 47f0853fb487..1ed1637e6cd0 100644 --- a/internal/services/frontdoor/frontdoor_custom_https_configuration_resource.go +++ b/internal/services/frontdoor/frontdoor_custom_https_configuration_resource.go @@ -7,23 +7,23 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/sdk/2020-05-01/frontdoors" "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" ) -func resourceFrontDoorCustomHttpsConfiguration() *pluginsdk.Resource { +func resourceFrontDoorCustomHTTPSConfiguration() *pluginsdk.Resource { return &pluginsdk.Resource{ - Create: resourceFrontDoorCustomHttpsConfigurationCreateUpdate, - Read: resourceFrontDoorCustomHttpsConfigurationRead, - Update: resourceFrontDoorCustomHttpsConfigurationCreateUpdate, - Delete: resourceFrontDoorCustomHttpsConfigurationDelete, + Create: resourceFrontDoorCustomHTTPSConfigurationCreateUpdate, + Read: resourceFrontDoorCustomHTTPSConfigurationRead, + Update: resourceFrontDoorCustomHTTPSConfigurationCreateUpdate, + Delete: resourceFrontDoorCustomHTTPSConfigurationDelete, Importer: pluginsdk.ImporterValidatingResourceIdThen(func(id string) error { _, err := parse.CustomHttpsConfigurationID(id) @@ -91,7 +91,7 @@ func resourceFrontDoorCustomHttpsConfiguration() *pluginsdk.Resource { } } -func resourceFrontDoorCustomHttpsConfigurationCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { +func resourceFrontDoorCustomHTTPSConfigurationCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Frontdoor.FrontDoorsClient ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -114,17 +114,17 @@ func resourceFrontDoorCustomHttpsConfigurationCreateUpdate(d *pluginsdk.Resource props := *resp.Model.Properties input := customHttpsConfigurationUpdateInput{ - customHttpsConfigurationCurrent: props.CustomHttpsConfiguration, + customHttpsConfigurationCurrent: props.CustomHTTPSConfiguration, customHttpsConfigurationNew: d.Get("custom_https_configuration").([]interface{}), customHttpsProvisioningEnabled: d.Get("custom_https_provisioning_enabled").(bool), frontendEndpointId: *id, } - if props.CustomHttpsProvisioningState != nil { - input.provisioningState = *props.CustomHttpsProvisioningState + if props.CustomHTTPSProvisioningState != nil { + input.provisioningState = *props.CustomHTTPSProvisioningState } - if err := updateCustomHttpsConfiguration(ctx, client, input); err != nil { + if err := updateCustomHTTPSConfiguration(ctx, client, input); err != nil { return fmt.Errorf("updating Custom HTTPS configuration for %s: %+v", id, err) } @@ -132,10 +132,10 @@ func resourceFrontDoorCustomHttpsConfigurationCreateUpdate(d *pluginsdk.Resource d.SetId(customHttpsConfigurationId.ID()) } - return resourceFrontDoorCustomHttpsConfigurationRead(d, meta) + return resourceFrontDoorCustomHTTPSConfigurationRead(d, meta) } -func resourceFrontDoorCustomHttpsConfigurationRead(d *pluginsdk.ResourceData, meta interface{}) error { +func resourceFrontDoorCustomHTTPSConfigurationRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Frontdoor.FrontDoorsClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -171,7 +171,7 @@ func resourceFrontDoorCustomHttpsConfigurationRead(d *pluginsdk.ResourceData, me return nil } -func resourceFrontDoorCustomHttpsConfigurationDelete(d *pluginsdk.ResourceData, meta interface{}) error { +func resourceFrontDoorCustomHTTPSConfigurationDelete(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Frontdoor.FrontDoorsClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() @@ -196,16 +196,16 @@ func resourceFrontDoorCustomHttpsConfigurationDelete(d *pluginsdk.ResourceData, props := *model.Properties input := customHttpsConfigurationUpdateInput{ - customHttpsConfigurationCurrent: props.CustomHttpsConfiguration, + customHttpsConfigurationCurrent: props.CustomHTTPSConfiguration, customHttpsConfigurationNew: make([]interface{}, 0), customHttpsProvisioningEnabled: false, frontendEndpointId: *id, } - if props.CustomHttpsProvisioningState != nil { - input.provisioningState = *props.CustomHttpsProvisioningState + if props.CustomHTTPSProvisioningState != nil { + input.provisioningState = *props.CustomHTTPSProvisioningState } - if err := updateCustomHttpsConfiguration(ctx, client, input); err != nil { + if err := updateCustomHTTPSConfiguration(ctx, client, input); err != nil { return fmt.Errorf("disabling Custom HTTPS configuration for Frontend Endpoint %q (Front Door %q / Resource Group %q): %+v", id.FrontendEndpointName, id.FrontDoorName, id.ResourceGroupName, err) } } @@ -214,14 +214,14 @@ func resourceFrontDoorCustomHttpsConfigurationDelete(d *pluginsdk.ResourceData, } type customHttpsConfigurationUpdateInput struct { - customHttpsConfigurationCurrent *frontdoors.CustomHttpsConfiguration + customHttpsConfigurationCurrent *frontdoors.CustomHTTPSConfiguration customHttpsConfigurationNew []interface{} customHttpsProvisioningEnabled bool frontendEndpointId frontdoors.FrontendEndpointId - provisioningState frontdoors.CustomHttpsProvisioningState + provisioningState frontdoors.CustomHTTPSProvisioningState } -func updateCustomHttpsConfiguration(ctx context.Context, client *frontdoors.FrontDoorsClient, input customHttpsConfigurationUpdateInput) error { +func updateCustomHTTPSConfiguration(ctx context.Context, client *frontdoors.FrontDoorsClient, input customHttpsConfigurationUpdateInput) error { // Locking to prevent parallel changes causing issues frontendEndpointResourceId := input.frontendEndpointId.ID() locks.ByID(frontendEndpointResourceId) @@ -246,17 +246,17 @@ func updateCustomHttpsConfiguration(ctx context.Context, client *frontdoors.Fron if httpsConfig := input.customHttpsConfigurationCurrent; httpsConfig != nil { minTLSVersion = httpsConfig.MinimumTlsVersion } - customHTTPSConfigurationUpdate := makeCustomHttpsConfiguration(customHTTPSConfiguration, minTLSVersion) - if input.provisioningState == frontdoors.CustomHttpsProvisioningStateDisabled || customHTTPSConfigurationUpdate != *input.customHttpsConfigurationCurrent { + customHTTPSConfigurationUpdate := makeCustomHTTPSConfiguration(customHTTPSConfiguration, minTLSVersion) + if input.provisioningState == frontdoors.CustomHTTPSProvisioningStateDisabled || customHTTPSConfigurationUpdate != *input.customHttpsConfigurationCurrent { // Enable Custom Domain HTTPS for the Frontend Endpoint if err := resourceFrontDoorFrontendEndpointEnableHttpsProvisioning(ctx, client, input.frontendEndpointId, true, customHTTPSConfigurationUpdate); err != nil { return fmt.Errorf("unable to enable/update Custom Domain HTTPS for Frontend Endpoint %q (Resource Group %q): %+v", input.frontendEndpointId.FrontendEndpointName, input.frontendEndpointId.ResourceGroupName, err) } } } - } else if !input.customHttpsProvisioningEnabled && input.provisioningState == frontdoors.CustomHttpsProvisioningStateEnabled { + } else if !input.customHttpsProvisioningEnabled && input.provisioningState == frontdoors.CustomHTTPSProvisioningStateEnabled { // Disable Custom Domain HTTPS for the Frontend Endpoint - if err := resourceFrontDoorFrontendEndpointEnableHttpsProvisioning(ctx, client, input.frontendEndpointId, false, frontdoors.CustomHttpsConfiguration{}); err != nil { + if err := resourceFrontDoorFrontendEndpointEnableHttpsProvisioning(ctx, client, input.frontendEndpointId, false, frontdoors.CustomHTTPSConfiguration{}); err != nil { return fmt.Errorf("unable to disable Custom Domain HTTPS for Frontend Endpoint %q (Resource Group %q): %+v", input.frontendEndpointId.FrontendEndpointName, input.frontendEndpointId.ResourceGroupName, err) } } @@ -264,25 +264,25 @@ func updateCustomHttpsConfiguration(ctx context.Context, client *frontdoors.Fron return nil } -func resourceFrontDoorFrontendEndpointEnableHttpsProvisioning(ctx context.Context, client *frontdoors.FrontDoorsClient, id frontdoors.FrontendEndpointId, enableCustomHttpsProvisioning bool, customHTTPSConfiguration frontdoors.CustomHttpsConfiguration) error { - if enableCustomHttpsProvisioning { - if err := client.FrontendEndpointsEnableHttpsThenPoll(ctx, id, customHTTPSConfiguration); err != nil { +func resourceFrontDoorFrontendEndpointEnableHttpsProvisioning(ctx context.Context, client *frontdoors.FrontDoorsClient, id frontdoors.FrontendEndpointId, enableCustomHTTPSProvisioning bool, customHTTPSConfiguration frontdoors.CustomHTTPSConfiguration) error { + if enableCustomHTTPSProvisioning { + if err := client.FrontendEndpointsEnableHTTPSThenPoll(ctx, id, customHTTPSConfiguration); err != nil { return fmt.Errorf("enabling Custom Domain HTTPS for Frontend Endpoint: %+v", err) } return nil } - if err := client.FrontendEndpointsDisableHttpsThenPoll(ctx, id); err != nil { + if err := client.FrontendEndpointsDisableHTTPSThenPoll(ctx, id); err != nil { return fmt.Errorf("disabling Custom Domain HTTPS for Frontend Endpoint: %+v", err) } return nil } -func makeCustomHttpsConfiguration(customHttpsConfiguration map[string]interface{}, minTLSVersion frontdoors.MinimumTLSVersion) frontdoors.CustomHttpsConfiguration { +func makeCustomHTTPSConfiguration(customHttpsConfiguration map[string]interface{}, minTLSVersion frontdoors.MinimumTLSVersion) frontdoors.CustomHTTPSConfiguration { // https://github.com/Azure/azure-sdk-for-go/issues/6882 - customHTTPSConfigurationUpdate := frontdoors.CustomHttpsConfiguration{ + customHTTPSConfigurationUpdate := frontdoors.CustomHTTPSConfiguration{ ProtocolType: frontdoors.FrontDoorTlsProtocolType("ServerNameIndication"), MinimumTlsVersion: minTLSVersion, } diff --git a/internal/services/frontdoor/frontdoor_custom_https_configuration_resource_test.go b/internal/services/frontdoor/frontdoor_custom_https_configuration_resource_test.go index 2ac92b40c9ef..fd19f0238a70 100644 --- a/internal/services/frontdoor/frontdoor_custom_https_configuration_resource_test.go +++ b/internal/services/frontdoor/frontdoor_custom_https_configuration_resource_test.go @@ -6,11 +6,11 @@ import ( "regexp" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/sdk/2020-05-01/frontdoors" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) diff --git a/internal/services/frontdoor/frontdoor_firewall_policy_resource.go b/internal/services/frontdoor/frontdoor_firewall_policy_resource.go index f8d7bcf6d365..5c0468aa3300 100644 --- a/internal/services/frontdoor/frontdoor_firewall_policy_resource.go +++ b/internal/services/frontdoor/frontdoor_firewall_policy_resource.go @@ -8,12 +8,12 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies" "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -438,7 +438,7 @@ func resourceFrontDoorFirewallPolicyCreateUpdate(d *pluginsdk.ResourceData, meta name := d.Get("name").(string) resourceGroup := d.Get("resource_group_name").(string) - id := webapplicationfirewallpolicies.NewFrontDoorWebApplicationFirewallPoliciesID(subscriptionId, resourceGroup, name) + id := webapplicationfirewallpolicies.NewFrontDoorWebApplicationFirewallPolicyID(subscriptionId, resourceGroup, name) if d.IsNewResource() { existing, err := client.PoliciesGet(ctx, id) @@ -503,7 +503,7 @@ func resourceFrontDoorFirewallPolicyRead(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := webapplicationfirewallpolicies.ParseFrontDoorWebApplicationFirewallPoliciesIDInsensitively(d.Id()) + id, err := webapplicationfirewallpolicies.ParseFrontDoorWebApplicationFirewallPolicyIDInsensitively(d.Id()) if err != nil { return err } @@ -518,7 +518,7 @@ func resourceFrontDoorFirewallPolicyRead(d *pluginsdk.ResourceData, meta interfa return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.PolicyName) + d.Set("name", id.FrontDoorWebApplicationFirewallPolicyName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { @@ -561,7 +561,7 @@ func resourceFrontDoorFirewallPolicyDelete(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := webapplicationfirewallpolicies.ParseFrontDoorWebApplicationFirewallPoliciesIDInsensitively(d.Id()) + id, err := webapplicationfirewallpolicies.ParseFrontDoorWebApplicationFirewallPolicyIDInsensitively(d.Id()) if err != nil { return err } diff --git a/internal/services/frontdoor/frontdoor_firewall_policy_resource_test.go b/internal/services/frontdoor/frontdoor_firewall_policy_resource_test.go index ac36b4be5abf..751d6b579127 100644 --- a/internal/services/frontdoor/frontdoor_firewall_policy_resource_test.go +++ b/internal/services/frontdoor/frontdoor_firewall_policy_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -107,7 +107,7 @@ func TestAccFrontDoorFirewallPolicy_complete(t *testing.T) { } func (FrontDoorFirewallPolicyResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := webapplicationfirewallpolicies.ParseFrontDoorWebApplicationFirewallPoliciesIDInsensitively(state.ID) + id, err := webapplicationfirewallpolicies.ParseFrontDoorWebApplicationFirewallPolicyIDInsensitively(state.ID) if err != nil { return nil, err } diff --git a/internal/services/frontdoor/frontdoor_resource.go b/internal/services/frontdoor/frontdoor_resource.go index 1ee9f4991416..ee58b93bb81c 100644 --- a/internal/services/frontdoor/frontdoor_resource.go +++ b/internal/services/frontdoor/frontdoor_resource.go @@ -10,13 +10,13 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/sdk/2020-05-01/frontdoors" azValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -487,8 +487,8 @@ func expandFrontDoorBackend(input []interface{}) *[]frontdoors.Backend { Address: utils.String(address), BackendHostHeader: utils.String(hostHeader), EnabledState: &enabled, - HttpPort: utils.Int64(httpPort), - HttpsPort: utils.Int64(httpsPort), + HTTPPort: utils.Int64(httpPort), + HTTPSPort: utils.Int64(httpsPort), Priority: utils.Int64(priority), Weight: utils.Int64(weight), } @@ -695,9 +695,9 @@ func expandFrontDoorAcceptedProtocols(input []interface{}) *[]frontdoors.FrontDo output := make([]frontdoors.FrontDoorProtocol, 0) for _, ap := range input { - result := frontdoors.FrontDoorProtocolHttps - if ap.(string) == string(frontdoors.FrontDoorProtocolHttp) { - result = frontdoors.FrontDoorProtocolHttp + result := frontdoors.FrontDoorProtocolHTTPS + if ap.(string) == string(frontdoors.FrontDoorProtocolHTTP) { + result = frontdoors.FrontDoorProtocolHTTP } output = append(output, result) } @@ -1065,10 +1065,10 @@ func flattenFrontDoorBackend(input *[]frontdoors.Backend) []interface{} { if v.EnabledState != nil { result["enabled"] = *v.EnabledState == frontdoors.BackendEnabledStateEnabled } - if httpPort := v.HttpPort; httpPort != nil { + if httpPort := v.HTTPPort; httpPort != nil { result["http_port"] = int(*httpPort) } - if httpsPort := v.HttpsPort; httpsPort != nil { + if httpsPort := v.HTTPSPort; httpsPort != nil { result["https_port"] = int(*httpsPort) } if priority := v.Priority; priority != nil { @@ -1778,8 +1778,8 @@ func resourceFrontDoorSchema() map[string]*pluginsdk.Schema { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoors.FrontDoorProtocolHttp), - string(frontdoors.FrontDoorProtocolHttps), + string(frontdoors.FrontDoorProtocolHTTP), + string(frontdoors.FrontDoorProtocolHTTPS), }, false), }, }, @@ -1827,8 +1827,8 @@ func resourceFrontDoorSchema() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(frontdoors.FrontDoorRedirectProtocolHttpOnly), - string(frontdoors.FrontDoorRedirectProtocolHttpsOnly), + string(frontdoors.FrontDoorRedirectProtocolHTTPOnly), + string(frontdoors.FrontDoorRedirectProtocolHTTPSOnly), string(frontdoors.FrontDoorRedirectProtocolMatchRequest), }, false), }, @@ -1898,10 +1898,10 @@ func resourceFrontDoorSchema() map[string]*pluginsdk.Schema { "forwarding_protocol": { Type: pluginsdk.TypeString, Optional: true, - Default: string(frontdoors.FrontDoorForwardingProtocolHttpsOnly), + Default: string(frontdoors.FrontDoorForwardingProtocolHTTPSOnly), ValidateFunc: validation.StringInSlice([]string{ - string(frontdoors.FrontDoorForwardingProtocolHttpOnly), - string(frontdoors.FrontDoorForwardingProtocolHttpsOnly), + string(frontdoors.FrontDoorForwardingProtocolHTTPOnly), + string(frontdoors.FrontDoorForwardingProtocolHTTPSOnly), string(frontdoors.FrontDoorForwardingProtocolMatchRequest), }, false), }, @@ -1974,10 +1974,10 @@ func resourceFrontDoorSchema() map[string]*pluginsdk.Schema { "protocol": { Type: pluginsdk.TypeString, Optional: true, - Default: string(frontdoors.FrontDoorProtocolHttp), + Default: string(frontdoors.FrontDoorProtocolHTTP), ValidateFunc: validation.StringInSlice([]string{ - string(frontdoors.FrontDoorProtocolHttp), - string(frontdoors.FrontDoorProtocolHttps), + string(frontdoors.FrontDoorProtocolHTTP), + string(frontdoors.FrontDoorProtocolHTTPS), }, false), }, "probe_method": { diff --git a/internal/services/frontdoor/frontdoor_resource_test.go b/internal/services/frontdoor/frontdoor_resource_test.go index bd6d6f4e6530..be743761fd6c 100644 --- a/internal/services/frontdoor/frontdoor_resource_test.go +++ b/internal/services/frontdoor/frontdoor_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/sdk/2020-05-01/frontdoors" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) diff --git a/internal/services/frontdoor/frontdoor_rules_engine_rule.go b/internal/services/frontdoor/frontdoor_rules_engine_rule.go index cd2a08854adf..1486ef1c9bff 100644 --- a/internal/services/frontdoor/frontdoor_rules_engine_rule.go +++ b/internal/services/frontdoor/frontdoor_rules_engine_rule.go @@ -7,10 +7,10 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/sdk/2020-05-01/frontdoors" azValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/internal/services/frontdoor/helper.go b/internal/services/frontdoor/helper.go index db43fca46ae3..4c0fa2d77482 100644 --- a/internal/services/frontdoor/helper.go +++ b/internal/services/frontdoor/helper.go @@ -3,26 +3,26 @@ package frontdoor import ( "fmt" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/sdk/2020-05-01/frontdoors" + "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies" + "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors" ) -func isFrontDoorFrontendEndpointConfigurable(currentState frontdoors.CustomHttpsProvisioningState, customHttpsProvisioningEnabled bool, frontendEndpointId frontdoors.FrontendEndpointId) error { +func isFrontDoorFrontendEndpointConfigurable(currentState frontdoors.CustomHTTPSProvisioningState, customHttpsProvisioningEnabled bool, frontendEndpointId frontdoors.FrontendEndpointId) error { action := "disable" if customHttpsProvisioningEnabled { action = "enable" } switch currentState { - case frontdoors.CustomHttpsProvisioningStateDisabling, frontdoors.CustomHttpsProvisioningStateEnabling, frontdoors.CustomHttpsProvisioningStateFailed: + case frontdoors.CustomHTTPSProvisioningStateDisabling, frontdoors.CustomHTTPSProvisioningStateEnabling, frontdoors.CustomHTTPSProvisioningStateFailed: return fmt.Errorf("unable to %s %s Custom Domain HTTPS state because the Frontend Endpoint is currently in the %q state", action, frontendEndpointId, currentState) default: return nil } } -func NormalizeCustomHTTPSProvisioningStateToBool(provisioningState frontdoors.CustomHttpsProvisioningState) bool { - return provisioningState == frontdoors.CustomHttpsProvisioningStateEnabled || provisioningState == frontdoors.CustomHttpsProvisioningStateEnabling +func NormalizeCustomHTTPSProvisioningStateToBool(provisioningState frontdoors.CustomHTTPSProvisioningState) bool { + return provisioningState == frontdoors.CustomHTTPSProvisioningStateEnabled || provisioningState == frontdoors.CustomHTTPSProvisioningStateEnabling } func FlattenTransformSlice(input *[]webapplicationfirewallpolicies.TransformType) []interface{} { diff --git a/internal/services/frontdoor/registration.go b/internal/services/frontdoor/registration.go index 692f94c67b2f..36c395dab5b8 100644 --- a/internal/services/frontdoor/registration.go +++ b/internal/services/frontdoor/registration.go @@ -35,7 +35,7 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ "azurerm_frontdoor": resourceFrontDoor(), "azurerm_frontdoor_firewall_policy": resourceFrontDoorFirewallPolicy(), - "azurerm_frontdoor_custom_https_configuration": resourceFrontDoorCustomHttpsConfiguration(), + "azurerm_frontdoor_custom_https_configuration": resourceFrontDoorCustomHTTPSConfiguration(), "azurerm_frontdoor_rules_engine": resourceFrontDoorRulesEngine(), } } diff --git a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/client.go b/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/client.go deleted file mode 100644 index 95b02a18f167..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package checkfrontdoornameavailability - -import "github.com/Azure/go-autorest/autorest" - -type CheckFrontDoorNameAvailabilityClient struct { - Client autorest.Client - baseUri string -} - -func NewCheckFrontDoorNameAvailabilityClientWithBaseURI(endpoint string) CheckFrontDoorNameAvailabilityClient { - return CheckFrontDoorNameAvailabilityClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/constants.go b/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/constants.go deleted file mode 100644 index f4c99b983a8f..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/constants.go +++ /dev/null @@ -1,59 +0,0 @@ -package checkfrontdoornameavailability - -import "strings" - -type Availability string - -const ( - AvailabilityAvailable Availability = "Available" - AvailabilityUnavailable Availability = "Unavailable" -) - -func PossibleValuesForAvailability() []string { - return []string{ - string(AvailabilityAvailable), - string(AvailabilityUnavailable), - } -} - -func parseAvailability(input string) (*Availability, error) { - vals := map[string]Availability{ - "available": AvailabilityAvailable, - "unavailable": AvailabilityUnavailable, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Availability(input) - return &out, nil -} - -type ResourceType string - -const ( - ResourceTypeMicrosoftPointNetworkFrontDoors ResourceType = "Microsoft.Network/frontDoors" - ResourceTypeMicrosoftPointNetworkFrontDoorsFrontendEndpoints ResourceType = "Microsoft.Network/frontDoors/frontendEndpoints" -) - -func PossibleValuesForResourceType() []string { - return []string{ - string(ResourceTypeMicrosoftPointNetworkFrontDoors), - string(ResourceTypeMicrosoftPointNetworkFrontDoorsFrontendEndpoints), - } -} - -func parseResourceType(input string) (*ResourceType, error) { - vals := map[string]ResourceType{ - "microsoft.network/frontdoors": ResourceTypeMicrosoftPointNetworkFrontDoors, - "microsoft.network/frontdoors/frontendendpoints": ResourceTypeMicrosoftPointNetworkFrontDoorsFrontendEndpoints, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ResourceType(input) - return &out, nil -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/method_checkfrontdoornameavailability_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/method_checkfrontdoornameavailability_autorest.go deleted file mode 100644 index 0f9d81a1bb48..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/method_checkfrontdoornameavailability_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package checkfrontdoornameavailability - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CheckFrontDoorNameAvailabilityResponse struct { - HttpResponse *http.Response - Model *CheckNameAvailabilityOutput -} - -// CheckFrontDoorNameAvailability ... -func (c CheckFrontDoorNameAvailabilityClient) CheckFrontDoorNameAvailability(ctx context.Context, input CheckNameAvailabilityInput) (result CheckFrontDoorNameAvailabilityResponse, err error) { - req, err := c.preparerForCheckFrontDoorNameAvailability(ctx, input) - if err != nil { - err = autorest.NewErrorWithError(err, "checkfrontdoornameavailability.CheckFrontDoorNameAvailabilityClient", "CheckFrontDoorNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "checkfrontdoornameavailability.CheckFrontDoorNameAvailabilityClient", "CheckFrontDoorNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckFrontDoorNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "checkfrontdoornameavailability.CheckFrontDoorNameAvailabilityClient", "CheckFrontDoorNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckFrontDoorNameAvailability prepares the CheckFrontDoorNameAvailability request. -func (c CheckFrontDoorNameAvailabilityClient) preparerForCheckFrontDoorNameAvailability(ctx context.Context, input CheckNameAvailabilityInput) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath("/providers/Microsoft.Network/checkFrontDoorNameAvailability"), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckFrontDoorNameAvailability handles the response to the CheckFrontDoorNameAvailability request. The method always -// closes the http.Response Body. -func (c CheckFrontDoorNameAvailabilityClient) responderForCheckFrontDoorNameAvailability(resp *http.Response) (result CheckFrontDoorNameAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/model_checknameavailabilityinput.go b/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/model_checknameavailabilityinput.go deleted file mode 100644 index de48eb19e8a5..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/model_checknameavailabilityinput.go +++ /dev/null @@ -1,6 +0,0 @@ -package checkfrontdoornameavailability - -type CheckNameAvailabilityInput struct { - Name string `json:"name"` - Type ResourceType `json:"type"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/model_checknameavailabilityoutput.go b/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/model_checknameavailabilityoutput.go deleted file mode 100644 index 0ee315119f9b..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/model_checknameavailabilityoutput.go +++ /dev/null @@ -1,7 +0,0 @@ -package checkfrontdoornameavailability - -type CheckNameAvailabilityOutput struct { - Message *string `json:"message,omitempty"` - NameAvailability *Availability `json:"nameAvailability,omitempty"` - Reason *string `json:"reason,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/version.go b/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/version.go deleted file mode 100644 index e3586c5a303e..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailability/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package checkfrontdoornameavailability - -import "fmt" - -const defaultApiVersion = "2020-04-01" - -func userAgent() string { - return fmt.Sprintf("pandora/checkfrontdoornameavailability/%s", defaultApiVersion) -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/client.go b/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/client.go deleted file mode 100644 index 3ae59d9f6fd8..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -import "github.com/Azure/go-autorest/autorest" - -type CheckFrontDoorNameAvailabilityWithSubscriptionClient struct { - Client autorest.Client - baseUri string -} - -func NewCheckFrontDoorNameAvailabilityWithSubscriptionClientWithBaseURI(endpoint string) CheckFrontDoorNameAvailabilityWithSubscriptionClient { - return CheckFrontDoorNameAvailabilityWithSubscriptionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/constants.go b/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/constants.go deleted file mode 100644 index 469d32e40633..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/constants.go +++ /dev/null @@ -1,59 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -import "strings" - -type Availability string - -const ( - AvailabilityAvailable Availability = "Available" - AvailabilityUnavailable Availability = "Unavailable" -) - -func PossibleValuesForAvailability() []string { - return []string{ - string(AvailabilityAvailable), - string(AvailabilityUnavailable), - } -} - -func parseAvailability(input string) (*Availability, error) { - vals := map[string]Availability{ - "available": AvailabilityAvailable, - "unavailable": AvailabilityUnavailable, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Availability(input) - return &out, nil -} - -type ResourceType string - -const ( - ResourceTypeMicrosoftPointNetworkFrontDoors ResourceType = "Microsoft.Network/frontDoors" - ResourceTypeMicrosoftPointNetworkFrontDoorsFrontendEndpoints ResourceType = "Microsoft.Network/frontDoors/frontendEndpoints" -) - -func PossibleValuesForResourceType() []string { - return []string{ - string(ResourceTypeMicrosoftPointNetworkFrontDoors), - string(ResourceTypeMicrosoftPointNetworkFrontDoorsFrontendEndpoints), - } -} - -func parseResourceType(input string) (*ResourceType, error) { - vals := map[string]ResourceType{ - "microsoft.network/frontdoors": ResourceTypeMicrosoftPointNetworkFrontDoors, - "microsoft.network/frontdoors/frontendendpoints": ResourceTypeMicrosoftPointNetworkFrontDoorsFrontendEndpoints, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ResourceType(input) - return &out, nil -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/id_subscription.go b/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/id_subscription.go deleted file mode 100644 index 42dcc9dc68f1..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/id_subscription_test.go b/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/id_subscription_test.go deleted file mode 100644 index 46c40b46981e..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/id_subscription_test.go +++ /dev/null @@ -1,157 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -func TestNewSubscriptionID(t *testing.T) { - id := NewSubscriptionID("12345678-1234-9876-4563-123456789012") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } -} - -func TestFormatSubscriptionID(t *testing.T) { - actual := NewSubscriptionID("12345678-1234-9876-4563-123456789012").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSubscriptionID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubscriptionId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Expected: &SubscriptionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubscriptionID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - } -} - -func TestParseSubscriptionIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubscriptionId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Expected: &SubscriptionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Expected: &SubscriptionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubscriptionIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - } -} - -func TestSegmentsForSubscriptionId(t *testing.T) { - segments := SubscriptionId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SubscriptionId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/method_checkfrontdoornameavailabilitywithsubscription_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/method_checkfrontdoornameavailabilitywithsubscription_autorest.go deleted file mode 100644 index 7b41fd493505..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/method_checkfrontdoornameavailabilitywithsubscription_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CheckFrontDoorNameAvailabilityWithSubscriptionResponse struct { - HttpResponse *http.Response - Model *CheckNameAvailabilityOutput -} - -// CheckFrontDoorNameAvailabilityWithSubscription ... -func (c CheckFrontDoorNameAvailabilityWithSubscriptionClient) CheckFrontDoorNameAvailabilityWithSubscription(ctx context.Context, id SubscriptionId, input CheckNameAvailabilityInput) (result CheckFrontDoorNameAvailabilityWithSubscriptionResponse, err error) { - req, err := c.preparerForCheckFrontDoorNameAvailabilityWithSubscription(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "checkfrontdoornameavailabilitywithsubscription.CheckFrontDoorNameAvailabilityWithSubscriptionClient", "CheckFrontDoorNameAvailabilityWithSubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "checkfrontdoornameavailabilitywithsubscription.CheckFrontDoorNameAvailabilityWithSubscriptionClient", "CheckFrontDoorNameAvailabilityWithSubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckFrontDoorNameAvailabilityWithSubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "checkfrontdoornameavailabilitywithsubscription.CheckFrontDoorNameAvailabilityWithSubscriptionClient", "CheckFrontDoorNameAvailabilityWithSubscription", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckFrontDoorNameAvailabilityWithSubscription prepares the CheckFrontDoorNameAvailabilityWithSubscription request. -func (c CheckFrontDoorNameAvailabilityWithSubscriptionClient) preparerForCheckFrontDoorNameAvailabilityWithSubscription(ctx context.Context, id SubscriptionId, input CheckNameAvailabilityInput) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/checkFrontDoorNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckFrontDoorNameAvailabilityWithSubscription handles the response to the CheckFrontDoorNameAvailabilityWithSubscription request. The method always -// closes the http.Response Body. -func (c CheckFrontDoorNameAvailabilityWithSubscriptionClient) responderForCheckFrontDoorNameAvailabilityWithSubscription(resp *http.Response) (result CheckFrontDoorNameAvailabilityWithSubscriptionResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/model_checknameavailabilityinput.go b/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/model_checknameavailabilityinput.go deleted file mode 100644 index 1fa4f886526c..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/model_checknameavailabilityinput.go +++ /dev/null @@ -1,6 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -type CheckNameAvailabilityInput struct { - Name string `json:"name"` - Type ResourceType `json:"type"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/model_checknameavailabilityoutput.go b/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/model_checknameavailabilityoutput.go deleted file mode 100644 index 9455862d3db3..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/model_checknameavailabilityoutput.go +++ /dev/null @@ -1,7 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -type CheckNameAvailabilityOutput struct { - Message *string `json:"message,omitempty"` - NameAvailability *Availability `json:"nameAvailability,omitempty"` - Reason *string `json:"reason,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/version.go b/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/version.go deleted file mode 100644 index 8ee4d163a9bc..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/checkfrontdoornameavailabilitywithsubscription/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -import "fmt" - -const defaultApiVersion = "2020-04-01" - -func userAgent() string { - return fmt.Sprintf("pandora/checkfrontdoornameavailabilitywithsubscription/%s", defaultApiVersion) -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/client.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/client.go deleted file mode 100644 index 1978104f9ee7..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package frontdoors - -import "github.com/Azure/go-autorest/autorest" - -type FrontDoorsClient struct { - Client autorest.Client - baseUri string -} - -func NewFrontDoorsClientWithBaseURI(endpoint string) FrontDoorsClient { - return FrontDoorsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/constants.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/constants.go deleted file mode 100644 index 3a3320e6731c..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/constants.go +++ /dev/null @@ -1,869 +0,0 @@ -package frontdoors - -import "strings" - -type BackendEnabledState string - -const ( - BackendEnabledStateDisabled BackendEnabledState = "Disabled" - BackendEnabledStateEnabled BackendEnabledState = "Enabled" -) - -func PossibleValuesForBackendEnabledState() []string { - return []string{ - string(BackendEnabledStateDisabled), - string(BackendEnabledStateEnabled), - } -} - -func parseBackendEnabledState(input string) (*BackendEnabledState, error) { - vals := map[string]BackendEnabledState{ - "disabled": BackendEnabledStateDisabled, - "enabled": BackendEnabledStateEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := BackendEnabledState(input) - return &out, nil -} - -type CustomHttpsProvisioningState string - -const ( - CustomHttpsProvisioningStateDisabled CustomHttpsProvisioningState = "Disabled" - CustomHttpsProvisioningStateDisabling CustomHttpsProvisioningState = "Disabling" - CustomHttpsProvisioningStateEnabled CustomHttpsProvisioningState = "Enabled" - CustomHttpsProvisioningStateEnabling CustomHttpsProvisioningState = "Enabling" - CustomHttpsProvisioningStateFailed CustomHttpsProvisioningState = "Failed" -) - -func PossibleValuesForCustomHttpsProvisioningState() []string { - return []string{ - string(CustomHttpsProvisioningStateDisabled), - string(CustomHttpsProvisioningStateDisabling), - string(CustomHttpsProvisioningStateEnabled), - string(CustomHttpsProvisioningStateEnabling), - string(CustomHttpsProvisioningStateFailed), - } -} - -func parseCustomHttpsProvisioningState(input string) (*CustomHttpsProvisioningState, error) { - vals := map[string]CustomHttpsProvisioningState{ - "disabled": CustomHttpsProvisioningStateDisabled, - "disabling": CustomHttpsProvisioningStateDisabling, - "enabled": CustomHttpsProvisioningStateEnabled, - "enabling": CustomHttpsProvisioningStateEnabling, - "failed": CustomHttpsProvisioningStateFailed, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CustomHttpsProvisioningState(input) - return &out, nil -} - -type CustomHttpsProvisioningSubstate string - -const ( - CustomHttpsProvisioningSubstateCertificateDeleted CustomHttpsProvisioningSubstate = "CertificateDeleted" - CustomHttpsProvisioningSubstateCertificateDeployed CustomHttpsProvisioningSubstate = "CertificateDeployed" - CustomHttpsProvisioningSubstateDeletingCertificate CustomHttpsProvisioningSubstate = "DeletingCertificate" - CustomHttpsProvisioningSubstateDeployingCertificate CustomHttpsProvisioningSubstate = "DeployingCertificate" - CustomHttpsProvisioningSubstateDomainControlValidationRequestApproved CustomHttpsProvisioningSubstate = "DomainControlValidationRequestApproved" - CustomHttpsProvisioningSubstateDomainControlValidationRequestRejected CustomHttpsProvisioningSubstate = "DomainControlValidationRequestRejected" - CustomHttpsProvisioningSubstateDomainControlValidationRequestTimedOut CustomHttpsProvisioningSubstate = "DomainControlValidationRequestTimedOut" - CustomHttpsProvisioningSubstateIssuingCertificate CustomHttpsProvisioningSubstate = "IssuingCertificate" - CustomHttpsProvisioningSubstatePendingDomainControlValidationREquestApproval CustomHttpsProvisioningSubstate = "PendingDomainControlValidationREquestApproval" - CustomHttpsProvisioningSubstateSubmittingDomainControlValidationRequest CustomHttpsProvisioningSubstate = "SubmittingDomainControlValidationRequest" -) - -func PossibleValuesForCustomHttpsProvisioningSubstate() []string { - return []string{ - string(CustomHttpsProvisioningSubstateCertificateDeleted), - string(CustomHttpsProvisioningSubstateCertificateDeployed), - string(CustomHttpsProvisioningSubstateDeletingCertificate), - string(CustomHttpsProvisioningSubstateDeployingCertificate), - string(CustomHttpsProvisioningSubstateDomainControlValidationRequestApproved), - string(CustomHttpsProvisioningSubstateDomainControlValidationRequestRejected), - string(CustomHttpsProvisioningSubstateDomainControlValidationRequestTimedOut), - string(CustomHttpsProvisioningSubstateIssuingCertificate), - string(CustomHttpsProvisioningSubstatePendingDomainControlValidationREquestApproval), - string(CustomHttpsProvisioningSubstateSubmittingDomainControlValidationRequest), - } -} - -func parseCustomHttpsProvisioningSubstate(input string) (*CustomHttpsProvisioningSubstate, error) { - vals := map[string]CustomHttpsProvisioningSubstate{ - "certificatedeleted": CustomHttpsProvisioningSubstateCertificateDeleted, - "certificatedeployed": CustomHttpsProvisioningSubstateCertificateDeployed, - "deletingcertificate": CustomHttpsProvisioningSubstateDeletingCertificate, - "deployingcertificate": CustomHttpsProvisioningSubstateDeployingCertificate, - "domaincontrolvalidationrequestapproved": CustomHttpsProvisioningSubstateDomainControlValidationRequestApproved, - "domaincontrolvalidationrequestrejected": CustomHttpsProvisioningSubstateDomainControlValidationRequestRejected, - "domaincontrolvalidationrequesttimedout": CustomHttpsProvisioningSubstateDomainControlValidationRequestTimedOut, - "issuingcertificate": CustomHttpsProvisioningSubstateIssuingCertificate, - "pendingdomaincontrolvalidationrequestapproval": CustomHttpsProvisioningSubstatePendingDomainControlValidationREquestApproval, - "submittingdomaincontrolvalidationrequest": CustomHttpsProvisioningSubstateSubmittingDomainControlValidationRequest, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CustomHttpsProvisioningSubstate(input) - return &out, nil -} - -type DynamicCompressionEnabled string - -const ( - DynamicCompressionEnabledDisabled DynamicCompressionEnabled = "Disabled" - DynamicCompressionEnabledEnabled DynamicCompressionEnabled = "Enabled" -) - -func PossibleValuesForDynamicCompressionEnabled() []string { - return []string{ - string(DynamicCompressionEnabledDisabled), - string(DynamicCompressionEnabledEnabled), - } -} - -func parseDynamicCompressionEnabled(input string) (*DynamicCompressionEnabled, error) { - vals := map[string]DynamicCompressionEnabled{ - "disabled": DynamicCompressionEnabledDisabled, - "enabled": DynamicCompressionEnabledEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DynamicCompressionEnabled(input) - return &out, nil -} - -type EnforceCertificateNameCheckEnabledState string - -const ( - EnforceCertificateNameCheckEnabledStateDisabled EnforceCertificateNameCheckEnabledState = "Disabled" - EnforceCertificateNameCheckEnabledStateEnabled EnforceCertificateNameCheckEnabledState = "Enabled" -) - -func PossibleValuesForEnforceCertificateNameCheckEnabledState() []string { - return []string{ - string(EnforceCertificateNameCheckEnabledStateDisabled), - string(EnforceCertificateNameCheckEnabledStateEnabled), - } -} - -func parseEnforceCertificateNameCheckEnabledState(input string) (*EnforceCertificateNameCheckEnabledState, error) { - vals := map[string]EnforceCertificateNameCheckEnabledState{ - "disabled": EnforceCertificateNameCheckEnabledStateDisabled, - "enabled": EnforceCertificateNameCheckEnabledStateEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EnforceCertificateNameCheckEnabledState(input) - return &out, nil -} - -type FrontDoorCertificateSource string - -const ( - FrontDoorCertificateSourceAzureKeyVault FrontDoorCertificateSource = "AzureKeyVault" - FrontDoorCertificateSourceFrontDoor FrontDoorCertificateSource = "FrontDoor" -) - -func PossibleValuesForFrontDoorCertificateSource() []string { - return []string{ - string(FrontDoorCertificateSourceAzureKeyVault), - string(FrontDoorCertificateSourceFrontDoor), - } -} - -func parseFrontDoorCertificateSource(input string) (*FrontDoorCertificateSource, error) { - vals := map[string]FrontDoorCertificateSource{ - "azurekeyvault": FrontDoorCertificateSourceAzureKeyVault, - "frontdoor": FrontDoorCertificateSourceFrontDoor, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorCertificateSource(input) - return &out, nil -} - -type FrontDoorCertificateType string - -const ( - FrontDoorCertificateTypeDedicated FrontDoorCertificateType = "Dedicated" -) - -func PossibleValuesForFrontDoorCertificateType() []string { - return []string{ - string(FrontDoorCertificateTypeDedicated), - } -} - -func parseFrontDoorCertificateType(input string) (*FrontDoorCertificateType, error) { - vals := map[string]FrontDoorCertificateType{ - "dedicated": FrontDoorCertificateTypeDedicated, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorCertificateType(input) - return &out, nil -} - -type FrontDoorEnabledState string - -const ( - FrontDoorEnabledStateDisabled FrontDoorEnabledState = "Disabled" - FrontDoorEnabledStateEnabled FrontDoorEnabledState = "Enabled" -) - -func PossibleValuesForFrontDoorEnabledState() []string { - return []string{ - string(FrontDoorEnabledStateDisabled), - string(FrontDoorEnabledStateEnabled), - } -} - -func parseFrontDoorEnabledState(input string) (*FrontDoorEnabledState, error) { - vals := map[string]FrontDoorEnabledState{ - "disabled": FrontDoorEnabledStateDisabled, - "enabled": FrontDoorEnabledStateEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorEnabledState(input) - return &out, nil -} - -type FrontDoorForwardingProtocol string - -const ( - FrontDoorForwardingProtocolHttpOnly FrontDoorForwardingProtocol = "HttpOnly" - FrontDoorForwardingProtocolHttpsOnly FrontDoorForwardingProtocol = "HttpsOnly" - FrontDoorForwardingProtocolMatchRequest FrontDoorForwardingProtocol = "MatchRequest" -) - -func PossibleValuesForFrontDoorForwardingProtocol() []string { - return []string{ - string(FrontDoorForwardingProtocolHttpOnly), - string(FrontDoorForwardingProtocolHttpsOnly), - string(FrontDoorForwardingProtocolMatchRequest), - } -} - -func parseFrontDoorForwardingProtocol(input string) (*FrontDoorForwardingProtocol, error) { - vals := map[string]FrontDoorForwardingProtocol{ - "httponly": FrontDoorForwardingProtocolHttpOnly, - "httpsonly": FrontDoorForwardingProtocolHttpsOnly, - "matchrequest": FrontDoorForwardingProtocolMatchRequest, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorForwardingProtocol(input) - return &out, nil -} - -type FrontDoorHealthProbeMethod string - -const ( - FrontDoorHealthProbeMethodGET FrontDoorHealthProbeMethod = "GET" - FrontDoorHealthProbeMethodHEAD FrontDoorHealthProbeMethod = "HEAD" -) - -func PossibleValuesForFrontDoorHealthProbeMethod() []string { - return []string{ - string(FrontDoorHealthProbeMethodGET), - string(FrontDoorHealthProbeMethodHEAD), - } -} - -func parseFrontDoorHealthProbeMethod(input string) (*FrontDoorHealthProbeMethod, error) { - vals := map[string]FrontDoorHealthProbeMethod{ - "get": FrontDoorHealthProbeMethodGET, - "head": FrontDoorHealthProbeMethodHEAD, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorHealthProbeMethod(input) - return &out, nil -} - -type FrontDoorProtocol string - -const ( - FrontDoorProtocolHttp FrontDoorProtocol = "Http" - FrontDoorProtocolHttps FrontDoorProtocol = "Https" -) - -func PossibleValuesForFrontDoorProtocol() []string { - return []string{ - string(FrontDoorProtocolHttp), - string(FrontDoorProtocolHttps), - } -} - -func parseFrontDoorProtocol(input string) (*FrontDoorProtocol, error) { - vals := map[string]FrontDoorProtocol{ - "http": FrontDoorProtocolHttp, - "https": FrontDoorProtocolHttps, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorProtocol(input) - return &out, nil -} - -type FrontDoorQuery string - -const ( - FrontDoorQueryStripAll FrontDoorQuery = "StripAll" - FrontDoorQueryStripAllExcept FrontDoorQuery = "StripAllExcept" - FrontDoorQueryStripNone FrontDoorQuery = "StripNone" - FrontDoorQueryStripOnly FrontDoorQuery = "StripOnly" -) - -func PossibleValuesForFrontDoorQuery() []string { - return []string{ - string(FrontDoorQueryStripAll), - string(FrontDoorQueryStripAllExcept), - string(FrontDoorQueryStripNone), - string(FrontDoorQueryStripOnly), - } -} - -func parseFrontDoorQuery(input string) (*FrontDoorQuery, error) { - vals := map[string]FrontDoorQuery{ - "stripall": FrontDoorQueryStripAll, - "stripallexcept": FrontDoorQueryStripAllExcept, - "stripnone": FrontDoorQueryStripNone, - "striponly": FrontDoorQueryStripOnly, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorQuery(input) - return &out, nil -} - -type FrontDoorRedirectProtocol string - -const ( - FrontDoorRedirectProtocolHttpOnly FrontDoorRedirectProtocol = "HttpOnly" - FrontDoorRedirectProtocolHttpsOnly FrontDoorRedirectProtocol = "HttpsOnly" - FrontDoorRedirectProtocolMatchRequest FrontDoorRedirectProtocol = "MatchRequest" -) - -func PossibleValuesForFrontDoorRedirectProtocol() []string { - return []string{ - string(FrontDoorRedirectProtocolHttpOnly), - string(FrontDoorRedirectProtocolHttpsOnly), - string(FrontDoorRedirectProtocolMatchRequest), - } -} - -func parseFrontDoorRedirectProtocol(input string) (*FrontDoorRedirectProtocol, error) { - vals := map[string]FrontDoorRedirectProtocol{ - "httponly": FrontDoorRedirectProtocolHttpOnly, - "httpsonly": FrontDoorRedirectProtocolHttpsOnly, - "matchrequest": FrontDoorRedirectProtocolMatchRequest, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorRedirectProtocol(input) - return &out, nil -} - -type FrontDoorRedirectType string - -const ( - FrontDoorRedirectTypeFound FrontDoorRedirectType = "Found" - FrontDoorRedirectTypeMoved FrontDoorRedirectType = "Moved" - FrontDoorRedirectTypePermanentRedirect FrontDoorRedirectType = "PermanentRedirect" - FrontDoorRedirectTypeTemporaryRedirect FrontDoorRedirectType = "TemporaryRedirect" -) - -func PossibleValuesForFrontDoorRedirectType() []string { - return []string{ - string(FrontDoorRedirectTypeFound), - string(FrontDoorRedirectTypeMoved), - string(FrontDoorRedirectTypePermanentRedirect), - string(FrontDoorRedirectTypeTemporaryRedirect), - } -} - -func parseFrontDoorRedirectType(input string) (*FrontDoorRedirectType, error) { - vals := map[string]FrontDoorRedirectType{ - "found": FrontDoorRedirectTypeFound, - "moved": FrontDoorRedirectTypeMoved, - "permanentredirect": FrontDoorRedirectTypePermanentRedirect, - "temporaryredirect": FrontDoorRedirectTypeTemporaryRedirect, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorRedirectType(input) - return &out, nil -} - -type FrontDoorResourceState string - -const ( - FrontDoorResourceStateCreating FrontDoorResourceState = "Creating" - FrontDoorResourceStateDeleting FrontDoorResourceState = "Deleting" - FrontDoorResourceStateDisabled FrontDoorResourceState = "Disabled" - FrontDoorResourceStateDisabling FrontDoorResourceState = "Disabling" - FrontDoorResourceStateEnabled FrontDoorResourceState = "Enabled" - FrontDoorResourceStateEnabling FrontDoorResourceState = "Enabling" -) - -func PossibleValuesForFrontDoorResourceState() []string { - return []string{ - string(FrontDoorResourceStateCreating), - string(FrontDoorResourceStateDeleting), - string(FrontDoorResourceStateDisabled), - string(FrontDoorResourceStateDisabling), - string(FrontDoorResourceStateEnabled), - string(FrontDoorResourceStateEnabling), - } -} - -func parseFrontDoorResourceState(input string) (*FrontDoorResourceState, error) { - vals := map[string]FrontDoorResourceState{ - "creating": FrontDoorResourceStateCreating, - "deleting": FrontDoorResourceStateDeleting, - "disabled": FrontDoorResourceStateDisabled, - "disabling": FrontDoorResourceStateDisabling, - "enabled": FrontDoorResourceStateEnabled, - "enabling": FrontDoorResourceStateEnabling, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorResourceState(input) - return &out, nil -} - -type FrontDoorTlsProtocolType string - -const ( - FrontDoorTlsProtocolTypeServerNameIndication FrontDoorTlsProtocolType = "ServerNameIndication" -) - -func PossibleValuesForFrontDoorTlsProtocolType() []string { - return []string{ - string(FrontDoorTlsProtocolTypeServerNameIndication), - } -} - -func parseFrontDoorTlsProtocolType(input string) (*FrontDoorTlsProtocolType, error) { - vals := map[string]FrontDoorTlsProtocolType{ - "servernameindication": FrontDoorTlsProtocolTypeServerNameIndication, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorTlsProtocolType(input) - return &out, nil -} - -type HeaderActionType string - -const ( - HeaderActionTypeAppend HeaderActionType = "Append" - HeaderActionTypeDelete HeaderActionType = "Delete" - HeaderActionTypeOverwrite HeaderActionType = "Overwrite" -) - -func PossibleValuesForHeaderActionType() []string { - return []string{ - string(HeaderActionTypeAppend), - string(HeaderActionTypeDelete), - string(HeaderActionTypeOverwrite), - } -} - -func parseHeaderActionType(input string) (*HeaderActionType, error) { - vals := map[string]HeaderActionType{ - "append": HeaderActionTypeAppend, - "delete": HeaderActionTypeDelete, - "overwrite": HeaderActionTypeOverwrite, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := HeaderActionType(input) - return &out, nil -} - -type HealthProbeEnabled string - -const ( - HealthProbeEnabledDisabled HealthProbeEnabled = "Disabled" - HealthProbeEnabledEnabled HealthProbeEnabled = "Enabled" -) - -func PossibleValuesForHealthProbeEnabled() []string { - return []string{ - string(HealthProbeEnabledDisabled), - string(HealthProbeEnabledEnabled), - } -} - -func parseHealthProbeEnabled(input string) (*HealthProbeEnabled, error) { - vals := map[string]HealthProbeEnabled{ - "disabled": HealthProbeEnabledDisabled, - "enabled": HealthProbeEnabledEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := HealthProbeEnabled(input) - return &out, nil -} - -type MatchProcessingBehavior string - -const ( - MatchProcessingBehaviorContinue MatchProcessingBehavior = "Continue" - MatchProcessingBehaviorStop MatchProcessingBehavior = "Stop" -) - -func PossibleValuesForMatchProcessingBehavior() []string { - return []string{ - string(MatchProcessingBehaviorContinue), - string(MatchProcessingBehaviorStop), - } -} - -func parseMatchProcessingBehavior(input string) (*MatchProcessingBehavior, error) { - vals := map[string]MatchProcessingBehavior{ - "continue": MatchProcessingBehaviorContinue, - "stop": MatchProcessingBehaviorStop, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := MatchProcessingBehavior(input) - return &out, nil -} - -type MinimumTLSVersion string - -const ( - MinimumTLSVersionOnePointTwo MinimumTLSVersion = "1.2" - MinimumTLSVersionOnePointZero MinimumTLSVersion = "1.0" -) - -func PossibleValuesForMinimumTLSVersion() []string { - return []string{ - string(MinimumTLSVersionOnePointTwo), - string(MinimumTLSVersionOnePointZero), - } -} - -func parseMinimumTLSVersion(input string) (*MinimumTLSVersion, error) { - vals := map[string]MinimumTLSVersion{ - "1.2": MinimumTLSVersionOnePointTwo, - "1.0": MinimumTLSVersionOnePointZero, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := MinimumTLSVersion(input) - return &out, nil -} - -type PrivateEndpointStatus string - -const ( - PrivateEndpointStatusApproved PrivateEndpointStatus = "Approved" - PrivateEndpointStatusDisconnected PrivateEndpointStatus = "Disconnected" - PrivateEndpointStatusPending PrivateEndpointStatus = "Pending" - PrivateEndpointStatusRejected PrivateEndpointStatus = "Rejected" - PrivateEndpointStatusTimeout PrivateEndpointStatus = "Timeout" -) - -func PossibleValuesForPrivateEndpointStatus() []string { - return []string{ - string(PrivateEndpointStatusApproved), - string(PrivateEndpointStatusDisconnected), - string(PrivateEndpointStatusPending), - string(PrivateEndpointStatusRejected), - string(PrivateEndpointStatusTimeout), - } -} - -func parsePrivateEndpointStatus(input string) (*PrivateEndpointStatus, error) { - vals := map[string]PrivateEndpointStatus{ - "approved": PrivateEndpointStatusApproved, - "disconnected": PrivateEndpointStatusDisconnected, - "pending": PrivateEndpointStatusPending, - "rejected": PrivateEndpointStatusRejected, - "timeout": PrivateEndpointStatusTimeout, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PrivateEndpointStatus(input) - return &out, nil -} - -type RoutingRuleEnabledState string - -const ( - RoutingRuleEnabledStateDisabled RoutingRuleEnabledState = "Disabled" - RoutingRuleEnabledStateEnabled RoutingRuleEnabledState = "Enabled" -) - -func PossibleValuesForRoutingRuleEnabledState() []string { - return []string{ - string(RoutingRuleEnabledStateDisabled), - string(RoutingRuleEnabledStateEnabled), - } -} - -func parseRoutingRuleEnabledState(input string) (*RoutingRuleEnabledState, error) { - vals := map[string]RoutingRuleEnabledState{ - "disabled": RoutingRuleEnabledStateDisabled, - "enabled": RoutingRuleEnabledStateEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RoutingRuleEnabledState(input) - return &out, nil -} - -type RulesEngineMatchVariable string - -const ( - RulesEngineMatchVariableIsMobile RulesEngineMatchVariable = "IsMobile" - RulesEngineMatchVariablePostArgs RulesEngineMatchVariable = "PostArgs" - RulesEngineMatchVariableQueryString RulesEngineMatchVariable = "QueryString" - RulesEngineMatchVariableRemoteAddr RulesEngineMatchVariable = "RemoteAddr" - RulesEngineMatchVariableRequestBody RulesEngineMatchVariable = "RequestBody" - RulesEngineMatchVariableRequestFilename RulesEngineMatchVariable = "RequestFilename" - RulesEngineMatchVariableRequestFilenameExtension RulesEngineMatchVariable = "RequestFilenameExtension" - RulesEngineMatchVariableRequestHeader RulesEngineMatchVariable = "RequestHeader" - RulesEngineMatchVariableRequestMethod RulesEngineMatchVariable = "RequestMethod" - RulesEngineMatchVariableRequestPath RulesEngineMatchVariable = "RequestPath" - RulesEngineMatchVariableRequestScheme RulesEngineMatchVariable = "RequestScheme" - RulesEngineMatchVariableRequestUri RulesEngineMatchVariable = "RequestUri" -) - -func PossibleValuesForRulesEngineMatchVariable() []string { - return []string{ - string(RulesEngineMatchVariableIsMobile), - string(RulesEngineMatchVariablePostArgs), - string(RulesEngineMatchVariableQueryString), - string(RulesEngineMatchVariableRemoteAddr), - string(RulesEngineMatchVariableRequestBody), - string(RulesEngineMatchVariableRequestFilename), - string(RulesEngineMatchVariableRequestFilenameExtension), - string(RulesEngineMatchVariableRequestHeader), - string(RulesEngineMatchVariableRequestMethod), - string(RulesEngineMatchVariableRequestPath), - string(RulesEngineMatchVariableRequestScheme), - string(RulesEngineMatchVariableRequestUri), - } -} - -func parseRulesEngineMatchVariable(input string) (*RulesEngineMatchVariable, error) { - vals := map[string]RulesEngineMatchVariable{ - "ismobile": RulesEngineMatchVariableIsMobile, - "postargs": RulesEngineMatchVariablePostArgs, - "querystring": RulesEngineMatchVariableQueryString, - "remoteaddr": RulesEngineMatchVariableRemoteAddr, - "requestbody": RulesEngineMatchVariableRequestBody, - "requestfilename": RulesEngineMatchVariableRequestFilename, - "requestfilenameextension": RulesEngineMatchVariableRequestFilenameExtension, - "requestheader": RulesEngineMatchVariableRequestHeader, - "requestmethod": RulesEngineMatchVariableRequestMethod, - "requestpath": RulesEngineMatchVariableRequestPath, - "requestscheme": RulesEngineMatchVariableRequestScheme, - "requesturi": RulesEngineMatchVariableRequestUri, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RulesEngineMatchVariable(input) - return &out, nil -} - -type RulesEngineOperator string - -const ( - RulesEngineOperatorAny RulesEngineOperator = "Any" - RulesEngineOperatorBeginsWith RulesEngineOperator = "BeginsWith" - RulesEngineOperatorContains RulesEngineOperator = "Contains" - RulesEngineOperatorEndsWith RulesEngineOperator = "EndsWith" - RulesEngineOperatorEqual RulesEngineOperator = "Equal" - RulesEngineOperatorGeoMatch RulesEngineOperator = "GeoMatch" - RulesEngineOperatorGreaterThan RulesEngineOperator = "GreaterThan" - RulesEngineOperatorGreaterThanOrEqual RulesEngineOperator = "GreaterThanOrEqual" - RulesEngineOperatorIPMatch RulesEngineOperator = "IPMatch" - RulesEngineOperatorLessThan RulesEngineOperator = "LessThan" - RulesEngineOperatorLessThanOrEqual RulesEngineOperator = "LessThanOrEqual" -) - -func PossibleValuesForRulesEngineOperator() []string { - return []string{ - string(RulesEngineOperatorAny), - string(RulesEngineOperatorBeginsWith), - string(RulesEngineOperatorContains), - string(RulesEngineOperatorEndsWith), - string(RulesEngineOperatorEqual), - string(RulesEngineOperatorGeoMatch), - string(RulesEngineOperatorGreaterThan), - string(RulesEngineOperatorGreaterThanOrEqual), - string(RulesEngineOperatorIPMatch), - string(RulesEngineOperatorLessThan), - string(RulesEngineOperatorLessThanOrEqual), - } -} - -func parseRulesEngineOperator(input string) (*RulesEngineOperator, error) { - vals := map[string]RulesEngineOperator{ - "any": RulesEngineOperatorAny, - "beginswith": RulesEngineOperatorBeginsWith, - "contains": RulesEngineOperatorContains, - "endswith": RulesEngineOperatorEndsWith, - "equal": RulesEngineOperatorEqual, - "geomatch": RulesEngineOperatorGeoMatch, - "greaterthan": RulesEngineOperatorGreaterThan, - "greaterthanorequal": RulesEngineOperatorGreaterThanOrEqual, - "ipmatch": RulesEngineOperatorIPMatch, - "lessthan": RulesEngineOperatorLessThan, - "lessthanorequal": RulesEngineOperatorLessThanOrEqual, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RulesEngineOperator(input) - return &out, nil -} - -type SessionAffinityEnabledState string - -const ( - SessionAffinityEnabledStateDisabled SessionAffinityEnabledState = "Disabled" - SessionAffinityEnabledStateEnabled SessionAffinityEnabledState = "Enabled" -) - -func PossibleValuesForSessionAffinityEnabledState() []string { - return []string{ - string(SessionAffinityEnabledStateDisabled), - string(SessionAffinityEnabledStateEnabled), - } -} - -func parseSessionAffinityEnabledState(input string) (*SessionAffinityEnabledState, error) { - vals := map[string]SessionAffinityEnabledState{ - "disabled": SessionAffinityEnabledStateDisabled, - "enabled": SessionAffinityEnabledStateEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SessionAffinityEnabledState(input) - return &out, nil -} - -type Transform string - -const ( - TransformLowercase Transform = "Lowercase" - TransformRemoveNulls Transform = "RemoveNulls" - TransformTrim Transform = "Trim" - TransformUppercase Transform = "Uppercase" - TransformUrlDecode Transform = "UrlDecode" - TransformUrlEncode Transform = "UrlEncode" -) - -func PossibleValuesForTransform() []string { - return []string{ - string(TransformLowercase), - string(TransformRemoveNulls), - string(TransformTrim), - string(TransformUppercase), - string(TransformUrlDecode), - string(TransformUrlEncode), - } -} - -func parseTransform(input string) (*Transform, error) { - vals := map[string]Transform{ - "lowercase": TransformLowercase, - "removenulls": TransformRemoveNulls, - "trim": TransformTrim, - "uppercase": TransformUppercase, - "urldecode": TransformUrlDecode, - "urlencode": TransformUrlEncode, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Transform(input) - return &out, nil -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_frontdoor_test.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_frontdoor_test.go deleted file mode 100644 index 7bdc4e966d6b..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_frontdoor_test.go +++ /dev/null @@ -1,277 +0,0 @@ -package frontdoors - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = FrontDoorId{} - -func TestNewFrontDoorID(t *testing.T) { - id := NewFrontDoorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.FrontDoorName != "frontDoorValue" { - t.Fatalf("Expected %q but got %q for Segment 'FrontDoorName'", id.FrontDoorName, "frontDoorValue") - } -} - -func TestFormatFrontDoorID(t *testing.T) { - actual := NewFrontDoorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseFrontDoorID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *FrontDoorId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue", - Expected: &FrontDoorId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - FrontDoorName: "frontDoorValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseFrontDoorID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.FrontDoorName != v.Expected.FrontDoorName { - t.Fatalf("Expected %q but got %q for FrontDoorName", v.Expected.FrontDoorName, actual.FrontDoorName) - } - } -} - -func TestParseFrontDoorIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *FrontDoorId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue", - Expected: &FrontDoorId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - FrontDoorName: "frontDoorValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE", - Expected: &FrontDoorId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - FrontDoorName: "fRoNtDoOrVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseFrontDoorIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.FrontDoorName != v.Expected.FrontDoorName { - t.Fatalf("Expected %q but got %q for FrontDoorName", v.Expected.FrontDoorName, actual.FrontDoorName) - } - } -} - -func TestSegmentsForFrontDoorId(t *testing.T) { - segments := FrontDoorId{}.Segments() - if len(segments) == 0 { - t.Fatalf("FrontDoorId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_frontendendpoint_test.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_frontendendpoint_test.go deleted file mode 100644 index ffd46a567834..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_frontendendpoint_test.go +++ /dev/null @@ -1,322 +0,0 @@ -package frontdoors - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = FrontendEndpointId{} - -func TestNewFrontendEndpointID(t *testing.T) { - id := NewFrontendEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue", "frontendEndpointValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.FrontDoorName != "frontDoorValue" { - t.Fatalf("Expected %q but got %q for Segment 'FrontDoorName'", id.FrontDoorName, "frontDoorValue") - } - - if id.FrontendEndpointName != "frontendEndpointValue" { - t.Fatalf("Expected %q but got %q for Segment 'FrontendEndpointName'", id.FrontendEndpointName, "frontendEndpointValue") - } -} - -func TestFormatFrontendEndpointID(t *testing.T) { - actual := NewFrontendEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue", "frontendEndpointValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/frontendEndpoints/frontendEndpointValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseFrontendEndpointID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *FrontendEndpointId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/frontendEndpoints", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/frontendEndpoints/frontendEndpointValue", - Expected: &FrontendEndpointId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - FrontDoorName: "frontDoorValue", - FrontendEndpointName: "frontendEndpointValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/frontendEndpoints/frontendEndpointValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseFrontendEndpointID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.FrontDoorName != v.Expected.FrontDoorName { - t.Fatalf("Expected %q but got %q for FrontDoorName", v.Expected.FrontDoorName, actual.FrontDoorName) - } - - if actual.FrontendEndpointName != v.Expected.FrontendEndpointName { - t.Fatalf("Expected %q but got %q for FrontendEndpointName", v.Expected.FrontendEndpointName, actual.FrontendEndpointName) - } - } -} - -func TestParseFrontendEndpointIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *FrontendEndpointId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/frontendEndpoints", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE/fRoNtEnDeNdPoInTs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/frontendEndpoints/frontendEndpointValue", - Expected: &FrontendEndpointId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - FrontDoorName: "frontDoorValue", - FrontendEndpointName: "frontendEndpointValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/frontendEndpoints/frontendEndpointValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE/fRoNtEnDeNdPoInTs/fRoNtEnDeNdPoInTvAlUe", - Expected: &FrontendEndpointId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - FrontDoorName: "fRoNtDoOrVaLuE", - FrontendEndpointName: "fRoNtEnDeNdPoInTvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE/fRoNtEnDeNdPoInTs/fRoNtEnDeNdPoInTvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseFrontendEndpointIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.FrontDoorName != v.Expected.FrontDoorName { - t.Fatalf("Expected %q but got %q for FrontDoorName", v.Expected.FrontDoorName, actual.FrontDoorName) - } - - if actual.FrontendEndpointName != v.Expected.FrontendEndpointName { - t.Fatalf("Expected %q but got %q for FrontendEndpointName", v.Expected.FrontendEndpointName, actual.FrontendEndpointName) - } - } -} - -func TestSegmentsForFrontendEndpointId(t *testing.T) { - segments := FrontendEndpointId{}.Segments() - if len(segments) == 0 { - t.Fatalf("FrontendEndpointId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_resourcegroup.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_resourcegroup.go deleted file mode 100644 index 7e9fd1e8d3de..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package frontdoors - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_resourcegroup_test.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_resourcegroup_test.go deleted file mode 100644 index dea5316aa02f..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_resourcegroup_test.go +++ /dev/null @@ -1,202 +0,0 @@ -package frontdoors - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -func TestNewResourceGroupID(t *testing.T) { - id := NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } -} - -func TestFormatResourceGroupID(t *testing.T) { - actual := NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseResourceGroupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ResourceGroupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Expected: &ResourceGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseResourceGroupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - } -} - -func TestParseResourceGroupIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ResourceGroupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Expected: &ResourceGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Expected: &ResourceGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseResourceGroupIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - } -} - -func TestSegmentsForResourceGroupId(t *testing.T) { - segments := ResourceGroupId{}.Segments() - if len(segments) == 0 { - t.Fatalf("ResourceGroupId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_rulesengine_test.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_rulesengine_test.go deleted file mode 100644 index 4728bb7f6846..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_rulesengine_test.go +++ /dev/null @@ -1,322 +0,0 @@ -package frontdoors - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = RulesEngineId{} - -func TestNewRulesEngineID(t *testing.T) { - id := NewRulesEngineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue", "rulesEngineValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.FrontDoorName != "frontDoorValue" { - t.Fatalf("Expected %q but got %q for Segment 'FrontDoorName'", id.FrontDoorName, "frontDoorValue") - } - - if id.RulesEngineName != "rulesEngineValue" { - t.Fatalf("Expected %q but got %q for Segment 'RulesEngineName'", id.RulesEngineName, "rulesEngineValue") - } -} - -func TestFormatRulesEngineID(t *testing.T) { - actual := NewRulesEngineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue", "rulesEngineValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/rulesEngines/rulesEngineValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseRulesEngineID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *RulesEngineId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/rulesEngines", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/rulesEngines/rulesEngineValue", - Expected: &RulesEngineId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - FrontDoorName: "frontDoorValue", - RulesEngineName: "rulesEngineValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/rulesEngines/rulesEngineValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseRulesEngineID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.FrontDoorName != v.Expected.FrontDoorName { - t.Fatalf("Expected %q but got %q for FrontDoorName", v.Expected.FrontDoorName, actual.FrontDoorName) - } - - if actual.RulesEngineName != v.Expected.RulesEngineName { - t.Fatalf("Expected %q but got %q for RulesEngineName", v.Expected.RulesEngineName, actual.RulesEngineName) - } - } -} - -func TestParseRulesEngineIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *RulesEngineId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/rulesEngines", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE/rUlEsEnGiNeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/rulesEngines/rulesEngineValue", - Expected: &RulesEngineId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - FrontDoorName: "frontDoorValue", - RulesEngineName: "rulesEngineValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/rulesEngines/rulesEngineValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE/rUlEsEnGiNeS/rUlEsEnGiNeVaLuE", - Expected: &RulesEngineId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - FrontDoorName: "fRoNtDoOrVaLuE", - RulesEngineName: "rUlEsEnGiNeVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE/rUlEsEnGiNeS/rUlEsEnGiNeVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseRulesEngineIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.FrontDoorName != v.Expected.FrontDoorName { - t.Fatalf("Expected %q but got %q for FrontDoorName", v.Expected.FrontDoorName, actual.FrontDoorName) - } - - if actual.RulesEngineName != v.Expected.RulesEngineName { - t.Fatalf("Expected %q but got %q for RulesEngineName", v.Expected.RulesEngineName, actual.RulesEngineName) - } - } -} - -func TestSegmentsForRulesEngineId(t *testing.T) { - segments := RulesEngineId{}.Segments() - if len(segments) == 0 { - t.Fatalf("RulesEngineId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_subscription.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_subscription.go deleted file mode 100644 index c13922257cad..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package frontdoors - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_subscription_test.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_subscription_test.go deleted file mode 100644 index 51bd8ec3cb1c..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_subscription_test.go +++ /dev/null @@ -1,157 +0,0 @@ -package frontdoors - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -func TestNewSubscriptionID(t *testing.T) { - id := NewSubscriptionID("12345678-1234-9876-4563-123456789012") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } -} - -func TestFormatSubscriptionID(t *testing.T) { - actual := NewSubscriptionID("12345678-1234-9876-4563-123456789012").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSubscriptionID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubscriptionId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Expected: &SubscriptionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubscriptionID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - } -} - -func TestParseSubscriptionIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubscriptionId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Expected: &SubscriptionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Expected: &SubscriptionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubscriptionIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - } -} - -func TestSegmentsForSubscriptionId(t *testing.T) { - segments := SubscriptionId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SubscriptionId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_createorupdate_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_createorupdate_autorest.go deleted file mode 100644 index acc9e18ea84d..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_createorupdate_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateOrUpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c FrontDoorsClient) CreateOrUpdate(ctx context.Context, id FrontDoorId, input FrontDoor) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c FrontDoorsClient) CreateOrUpdateThenPoll(ctx context.Context, id FrontDoorId, input FrontDoor) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c FrontDoorsClient) preparerForCreateOrUpdate(ctx context.Context, id FrontDoorId, input FrontDoor) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c FrontDoorsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_delete_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_delete_autorest.go deleted file mode 100644 index 2a7aeafb599b..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_delete_autorest.go +++ /dev/null @@ -1,74 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c FrontDoorsClient) Delete(ctx context.Context, id FrontDoorId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c FrontDoorsClient) DeleteThenPoll(ctx context.Context, id FrontDoorId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c FrontDoorsClient) preparerForDelete(ctx context.Context, id FrontDoorId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c FrontDoorsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_endpointspurgecontent_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_endpointspurgecontent_autorest.go deleted file mode 100644 index fe12e0c3d505..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_endpointspurgecontent_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type EndpointsPurgeContentResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// EndpointsPurgeContent ... -func (c FrontDoorsClient) EndpointsPurgeContent(ctx context.Context, id FrontDoorId, input PurgeParameters) (result EndpointsPurgeContentResponse, err error) { - req, err := c.preparerForEndpointsPurgeContent(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "EndpointsPurgeContent", nil, "Failure preparing request") - return - } - - result, err = c.senderForEndpointsPurgeContent(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "EndpointsPurgeContent", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// EndpointsPurgeContentThenPoll performs EndpointsPurgeContent then polls until it's completed -func (c FrontDoorsClient) EndpointsPurgeContentThenPoll(ctx context.Context, id FrontDoorId, input PurgeParameters) error { - result, err := c.EndpointsPurgeContent(ctx, id, input) - if err != nil { - return fmt.Errorf("performing EndpointsPurgeContent: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after EndpointsPurgeContent: %+v", err) - } - - return nil -} - -// preparerForEndpointsPurgeContent prepares the EndpointsPurgeContent request. -func (c FrontDoorsClient) preparerForEndpointsPurgeContent(ctx context.Context, id FrontDoorId, input PurgeParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/purge", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForEndpointsPurgeContent sends the EndpointsPurgeContent request. The method will close the -// http.Response Body if it receives an error. -func (c FrontDoorsClient) senderForEndpointsPurgeContent(ctx context.Context, req *http.Request) (future EndpointsPurgeContentResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_frontendendpointsdisablehttps_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_frontendendpointsdisablehttps_autorest.go deleted file mode 100644 index 010425bf9722..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_frontendendpointsdisablehttps_autorest.go +++ /dev/null @@ -1,74 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type FrontendEndpointsDisableHttpsResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// FrontendEndpointsDisableHttps ... -func (c FrontDoorsClient) FrontendEndpointsDisableHttps(ctx context.Context, id FrontendEndpointId) (result FrontendEndpointsDisableHttpsResponse, err error) { - req, err := c.preparerForFrontendEndpointsDisableHttps(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsDisableHttps", nil, "Failure preparing request") - return - } - - result, err = c.senderForFrontendEndpointsDisableHttps(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsDisableHttps", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// FrontendEndpointsDisableHttpsThenPoll performs FrontendEndpointsDisableHttps then polls until it's completed -func (c FrontDoorsClient) FrontendEndpointsDisableHttpsThenPoll(ctx context.Context, id FrontendEndpointId) error { - result, err := c.FrontendEndpointsDisableHttps(ctx, id) - if err != nil { - return fmt.Errorf("performing FrontendEndpointsDisableHttps: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after FrontendEndpointsDisableHttps: %+v", err) - } - - return nil -} - -// preparerForFrontendEndpointsDisableHttps prepares the FrontendEndpointsDisableHttps request. -func (c FrontDoorsClient) preparerForFrontendEndpointsDisableHttps(ctx context.Context, id FrontendEndpointId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/disableHttps", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForFrontendEndpointsDisableHttps sends the FrontendEndpointsDisableHttps request. The method will close the -// http.Response Body if it receives an error. -func (c FrontDoorsClient) senderForFrontendEndpointsDisableHttps(ctx context.Context, req *http.Request) (future FrontendEndpointsDisableHttpsResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_frontendendpointsenablehttps_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_frontendendpointsenablehttps_autorest.go deleted file mode 100644 index 53f915771d7f..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_frontendendpointsenablehttps_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type FrontendEndpointsEnableHttpsResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// FrontendEndpointsEnableHttps ... -func (c FrontDoorsClient) FrontendEndpointsEnableHttps(ctx context.Context, id FrontendEndpointId, input CustomHttpsConfiguration) (result FrontendEndpointsEnableHttpsResponse, err error) { - req, err := c.preparerForFrontendEndpointsEnableHttps(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsEnableHttps", nil, "Failure preparing request") - return - } - - result, err = c.senderForFrontendEndpointsEnableHttps(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsEnableHttps", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// FrontendEndpointsEnableHttpsThenPoll performs FrontendEndpointsEnableHttps then polls until it's completed -func (c FrontDoorsClient) FrontendEndpointsEnableHttpsThenPoll(ctx context.Context, id FrontendEndpointId, input CustomHttpsConfiguration) error { - result, err := c.FrontendEndpointsEnableHttps(ctx, id, input) - if err != nil { - return fmt.Errorf("performing FrontendEndpointsEnableHttps: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after FrontendEndpointsEnableHttps: %+v", err) - } - - return nil -} - -// preparerForFrontendEndpointsEnableHttps prepares the FrontendEndpointsEnableHttps request. -func (c FrontDoorsClient) preparerForFrontendEndpointsEnableHttps(ctx context.Context, id FrontendEndpointId, input CustomHttpsConfiguration) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/enableHttps", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForFrontendEndpointsEnableHttps sends the FrontendEndpointsEnableHttps request. The method will close the -// http.Response Body if it receives an error. -func (c FrontDoorsClient) senderForFrontendEndpointsEnableHttps(ctx context.Context, req *http.Request) (future FrontendEndpointsEnableHttpsResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_frontendendpointsget_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_frontendendpointsget_autorest.go deleted file mode 100644 index 66a6d78a284d..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_frontendendpointsget_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package frontdoors - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type FrontendEndpointsGetResponse struct { - HttpResponse *http.Response - Model *FrontendEndpoint -} - -// FrontendEndpointsGet ... -func (c FrontDoorsClient) FrontendEndpointsGet(ctx context.Context, id FrontendEndpointId) (result FrontendEndpointsGetResponse, err error) { - req, err := c.preparerForFrontendEndpointsGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForFrontendEndpointsGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForFrontendEndpointsGet prepares the FrontendEndpointsGet request. -func (c FrontDoorsClient) preparerForFrontendEndpointsGet(ctx context.Context, id FrontendEndpointId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForFrontendEndpointsGet handles the response to the FrontendEndpointsGet request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForFrontendEndpointsGet(resp *http.Response) (result FrontendEndpointsGetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_frontendendpointslistbyfrontdoor_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_frontendendpointslistbyfrontdoor_autorest.go deleted file mode 100644 index 688d8051b5ca..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_frontendendpointslistbyfrontdoor_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type FrontendEndpointsListByFrontDoorResponse struct { - HttpResponse *http.Response - Model *[]FrontendEndpoint - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (FrontendEndpointsListByFrontDoorResponse, error) -} - -type FrontendEndpointsListByFrontDoorCompleteResult struct { - Items []FrontendEndpoint -} - -func (r FrontendEndpointsListByFrontDoorResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r FrontendEndpointsListByFrontDoorResponse) LoadMore(ctx context.Context) (resp FrontendEndpointsListByFrontDoorResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// FrontendEndpointsListByFrontDoor ... -func (c FrontDoorsClient) FrontendEndpointsListByFrontDoor(ctx context.Context, id FrontDoorId) (resp FrontendEndpointsListByFrontDoorResponse, err error) { - req, err := c.preparerForFrontendEndpointsListByFrontDoor(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForFrontendEndpointsListByFrontDoor(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// FrontendEndpointsListByFrontDoorComplete retrieves all of the results into a single object -func (c FrontDoorsClient) FrontendEndpointsListByFrontDoorComplete(ctx context.Context, id FrontDoorId) (FrontendEndpointsListByFrontDoorCompleteResult, error) { - return c.FrontendEndpointsListByFrontDoorCompleteMatchingPredicate(ctx, id, FrontendEndpointPredicate{}) -} - -// FrontendEndpointsListByFrontDoorCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c FrontDoorsClient) FrontendEndpointsListByFrontDoorCompleteMatchingPredicate(ctx context.Context, id FrontDoorId, predicate FrontendEndpointPredicate) (resp FrontendEndpointsListByFrontDoorCompleteResult, err error) { - items := make([]FrontendEndpoint, 0) - - page, err := c.FrontendEndpointsListByFrontDoor(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := FrontendEndpointsListByFrontDoorCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForFrontendEndpointsListByFrontDoor prepares the FrontendEndpointsListByFrontDoor request. -func (c FrontDoorsClient) preparerForFrontendEndpointsListByFrontDoor(ctx context.Context, id FrontDoorId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/frontendEndpoints", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForFrontendEndpointsListByFrontDoorWithNextLink prepares the FrontendEndpointsListByFrontDoor request with the given nextLink token. -func (c FrontDoorsClient) preparerForFrontendEndpointsListByFrontDoorWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForFrontendEndpointsListByFrontDoor handles the response to the FrontendEndpointsListByFrontDoor request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForFrontendEndpointsListByFrontDoor(resp *http.Response) (result FrontendEndpointsListByFrontDoorResponse, err error) { - type page struct { - Values []FrontendEndpoint `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result FrontendEndpointsListByFrontDoorResponse, err error) { - req, err := c.preparerForFrontendEndpointsListByFrontDoorWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForFrontendEndpointsListByFrontDoor(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_get_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_get_autorest.go deleted file mode 100644 index 0c40ccaed13d..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package frontdoors - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *FrontDoor -} - -// Get ... -func (c FrontDoorsClient) Get(ctx context.Context, id FrontDoorId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c FrontDoorsClient) preparerForGet(ctx context.Context, id FrontDoorId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_list_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_list_autorest.go deleted file mode 100644 index ffce15be86c5..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_list_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListResponse struct { - HttpResponse *http.Response - Model *[]FrontDoor - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListResponse, error) -} - -type ListCompleteResult struct { - Items []FrontDoor -} - -func (r ListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListResponse) LoadMore(ctx context.Context) (resp ListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c FrontDoorsClient) List(ctx context.Context, id SubscriptionId) (resp ListResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c FrontDoorsClient) ListComplete(ctx context.Context, id SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, FrontDoorPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c FrontDoorsClient) ListCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate FrontDoorPredicate) (resp ListCompleteResult, err error) { - items := make([]FrontDoor, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForList prepares the List request. -func (c FrontDoorsClient) preparerForList(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/frontDoors", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c FrontDoorsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForList(resp *http.Response) (result ListResponse, err error) { - type page struct { - Values []FrontDoor `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_listbyresourcegroup_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 8c27ef5b2139..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *[]FrontDoor - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []FrontDoor -} - -func (r ListByResourceGroupResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c FrontDoorsClient) ListByResourceGroup(ctx context.Context, id ResourceGroupId) (resp ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c FrontDoorsClient) ListByResourceGroupComplete(ctx context.Context, id ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, FrontDoorPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c FrontDoorsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate FrontDoorPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]FrontDoor, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c FrontDoorsClient) preparerForListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/frontDoors", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c FrontDoorsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - type page struct { - Values []FrontDoor `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_rulesenginescreateorupdate_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_rulesenginescreateorupdate_autorest.go deleted file mode 100644 index 755e6bf17d17..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_rulesenginescreateorupdate_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type RulesEnginesCreateOrUpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// RulesEnginesCreateOrUpdate ... -func (c FrontDoorsClient) RulesEnginesCreateOrUpdate(ctx context.Context, id RulesEngineId, input RulesEngine) (result RulesEnginesCreateOrUpdateResponse, err error) { - req, err := c.preparerForRulesEnginesCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesCreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForRulesEnginesCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RulesEnginesCreateOrUpdateThenPoll performs RulesEnginesCreateOrUpdate then polls until it's completed -func (c FrontDoorsClient) RulesEnginesCreateOrUpdateThenPoll(ctx context.Context, id RulesEngineId, input RulesEngine) error { - result, err := c.RulesEnginesCreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing RulesEnginesCreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RulesEnginesCreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForRulesEnginesCreateOrUpdate prepares the RulesEnginesCreateOrUpdate request. -func (c FrontDoorsClient) preparerForRulesEnginesCreateOrUpdate(ctx context.Context, id RulesEngineId, input RulesEngine) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRulesEnginesCreateOrUpdate sends the RulesEnginesCreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c FrontDoorsClient) senderForRulesEnginesCreateOrUpdate(ctx context.Context, req *http.Request) (future RulesEnginesCreateOrUpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_rulesenginesdelete_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_rulesenginesdelete_autorest.go deleted file mode 100644 index 78a9c2612d5b..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_rulesenginesdelete_autorest.go +++ /dev/null @@ -1,74 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type RulesEnginesDeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// RulesEnginesDelete ... -func (c FrontDoorsClient) RulesEnginesDelete(ctx context.Context, id RulesEngineId) (result RulesEnginesDeleteResponse, err error) { - req, err := c.preparerForRulesEnginesDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesDelete", nil, "Failure preparing request") - return - } - - result, err = c.senderForRulesEnginesDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesDelete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RulesEnginesDeleteThenPoll performs RulesEnginesDelete then polls until it's completed -func (c FrontDoorsClient) RulesEnginesDeleteThenPoll(ctx context.Context, id RulesEngineId) error { - result, err := c.RulesEnginesDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing RulesEnginesDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RulesEnginesDelete: %+v", err) - } - - return nil -} - -// preparerForRulesEnginesDelete prepares the RulesEnginesDelete request. -func (c FrontDoorsClient) preparerForRulesEnginesDelete(ctx context.Context, id RulesEngineId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRulesEnginesDelete sends the RulesEnginesDelete request. The method will close the -// http.Response Body if it receives an error. -func (c FrontDoorsClient) senderForRulesEnginesDelete(ctx context.Context, req *http.Request) (future RulesEnginesDeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_rulesenginesget_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_rulesenginesget_autorest.go deleted file mode 100644 index 8d0e8b263d7b..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_rulesenginesget_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package frontdoors - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type RulesEnginesGetResponse struct { - HttpResponse *http.Response - Model *RulesEngine -} - -// RulesEnginesGet ... -func (c FrontDoorsClient) RulesEnginesGet(ctx context.Context, id RulesEngineId) (result RulesEnginesGetResponse, err error) { - req, err := c.preparerForRulesEnginesGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRulesEnginesGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRulesEnginesGet prepares the RulesEnginesGet request. -func (c FrontDoorsClient) preparerForRulesEnginesGet(ctx context.Context, id RulesEngineId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRulesEnginesGet handles the response to the RulesEnginesGet request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForRulesEnginesGet(resp *http.Response) (result RulesEnginesGetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_rulesengineslistbyfrontdoor_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_rulesengineslistbyfrontdoor_autorest.go deleted file mode 100644 index ab5882fa1573..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_rulesengineslistbyfrontdoor_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type RulesEnginesListByFrontDoorResponse struct { - HttpResponse *http.Response - Model *[]RulesEngine - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (RulesEnginesListByFrontDoorResponse, error) -} - -type RulesEnginesListByFrontDoorCompleteResult struct { - Items []RulesEngine -} - -func (r RulesEnginesListByFrontDoorResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r RulesEnginesListByFrontDoorResponse) LoadMore(ctx context.Context) (resp RulesEnginesListByFrontDoorResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// RulesEnginesListByFrontDoor ... -func (c FrontDoorsClient) RulesEnginesListByFrontDoor(ctx context.Context, id FrontDoorId) (resp RulesEnginesListByFrontDoorResponse, err error) { - req, err := c.preparerForRulesEnginesListByFrontDoor(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForRulesEnginesListByFrontDoor(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// RulesEnginesListByFrontDoorComplete retrieves all of the results into a single object -func (c FrontDoorsClient) RulesEnginesListByFrontDoorComplete(ctx context.Context, id FrontDoorId) (RulesEnginesListByFrontDoorCompleteResult, error) { - return c.RulesEnginesListByFrontDoorCompleteMatchingPredicate(ctx, id, RulesEnginePredicate{}) -} - -// RulesEnginesListByFrontDoorCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c FrontDoorsClient) RulesEnginesListByFrontDoorCompleteMatchingPredicate(ctx context.Context, id FrontDoorId, predicate RulesEnginePredicate) (resp RulesEnginesListByFrontDoorCompleteResult, err error) { - items := make([]RulesEngine, 0) - - page, err := c.RulesEnginesListByFrontDoor(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := RulesEnginesListByFrontDoorCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForRulesEnginesListByFrontDoor prepares the RulesEnginesListByFrontDoor request. -func (c FrontDoorsClient) preparerForRulesEnginesListByFrontDoor(ctx context.Context, id FrontDoorId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/rulesEngines", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForRulesEnginesListByFrontDoorWithNextLink prepares the RulesEnginesListByFrontDoor request with the given nextLink token. -func (c FrontDoorsClient) preparerForRulesEnginesListByFrontDoorWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRulesEnginesListByFrontDoor handles the response to the RulesEnginesListByFrontDoor request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForRulesEnginesListByFrontDoor(resp *http.Response) (result RulesEnginesListByFrontDoorResponse, err error) { - type page struct { - Values []RulesEngine `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result RulesEnginesListByFrontDoorResponse, err error) { - req, err := c.preparerForRulesEnginesListByFrontDoorWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRulesEnginesListByFrontDoor(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_validatecustomdomain_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_validatecustomdomain_autorest.go deleted file mode 100644 index 2a585da0274e..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/method_validatecustomdomain_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ValidateCustomDomainResponse struct { - HttpResponse *http.Response - Model *ValidateCustomDomainOutput -} - -// ValidateCustomDomain ... -func (c FrontDoorsClient) ValidateCustomDomain(ctx context.Context, id FrontDoorId, input ValidateCustomDomainInput) (result ValidateCustomDomainResponse, err error) { - req, err := c.preparerForValidateCustomDomain(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ValidateCustomDomain", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ValidateCustomDomain", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForValidateCustomDomain(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ValidateCustomDomain", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForValidateCustomDomain prepares the ValidateCustomDomain request. -func (c FrontDoorsClient) preparerForValidateCustomDomain(ctx context.Context, id FrontDoorId, input ValidateCustomDomainInput) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/validateCustomDomain", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForValidateCustomDomain handles the response to the ValidateCustomDomain request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForValidateCustomDomain(resp *http.Response) (result ValidateCustomDomainResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_backend.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_backend.go deleted file mode 100644 index 3032f6ff83b1..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_backend.go +++ /dev/null @@ -1,14 +0,0 @@ -package frontdoors - -type Backend struct { - Address *string `json:"address,omitempty"` - BackendHostHeader *string `json:"backendHostHeader,omitempty"` - EnabledState *BackendEnabledState `json:"enabledState,omitempty"` - HttpPort *int64 `json:"httpPort,omitempty"` - HttpsPort *int64 `json:"httpsPort,omitempty"` - Priority *int64 `json:"priority,omitempty"` - PrivateEndpointStatus *PrivateEndpointStatus `json:"privateEndpointStatus,omitempty"` - PrivateLinkAlias *string `json:"privateLinkAlias,omitempty"` - PrivateLinkApprovalMessage *string `json:"privateLinkApprovalMessage,omitempty"` - Weight *int64 `json:"weight,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_backendpool.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_backendpool.go deleted file mode 100644 index a0009b30e2c2..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_backendpool.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type BackendPool struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *BackendPoolProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_backendpoolproperties.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_backendpoolproperties.go deleted file mode 100644 index 3d89bc4bf128..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_backendpoolproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type BackendPoolProperties struct { - Backends *[]Backend `json:"backends,omitempty"` - HealthProbeSettings *SubResource `json:"healthProbeSettings,omitempty"` - LoadBalancingSettings *SubResource `json:"loadBalancingSettings,omitempty"` - ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_backendpoolssettings.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_backendpoolssettings.go deleted file mode 100644 index b89237176e4f..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_backendpoolssettings.go +++ /dev/null @@ -1,6 +0,0 @@ -package frontdoors - -type BackendPoolsSettings struct { - EnforceCertificateNameCheck *EnforceCertificateNameCheckEnabledState `json:"enforceCertificateNameCheck,omitempty"` - SendRecvTimeoutSeconds *int64 `json:"sendRecvTimeoutSeconds,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_cacheconfiguration.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_cacheconfiguration.go deleted file mode 100644 index c525f7cf5595..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_cacheconfiguration.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type CacheConfiguration struct { - CacheDuration *string `json:"cacheDuration,omitempty"` - DynamicCompression *DynamicCompressionEnabled `json:"dynamicCompression,omitempty"` - QueryParameterStripDirective *FrontDoorQuery `json:"queryParameterStripDirective,omitempty"` - QueryParameters *string `json:"queryParameters,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_customhttpsconfiguration.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_customhttpsconfiguration.go deleted file mode 100644 index 35b9c7067687..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_customhttpsconfiguration.go +++ /dev/null @@ -1,9 +0,0 @@ -package frontdoors - -type CustomHttpsConfiguration struct { - CertificateSource FrontDoorCertificateSource `json:"certificateSource"` - FrontDoorCertificateSourceParameters *FrontDoorCertificateSourceParameters `json:"frontDoorCertificateSourceParameters,omitempty"` - KeyVaultCertificateSourceParameters *KeyVaultCertificateSourceParameters `json:"keyVaultCertificateSourceParameters,omitempty"` - MinimumTlsVersion MinimumTLSVersion `json:"minimumTlsVersion"` - ProtocolType FrontDoorTlsProtocolType `json:"protocolType"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_forwardingconfiguration.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_forwardingconfiguration.go deleted file mode 100644 index 8eb665b2d148..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_forwardingconfiguration.go +++ /dev/null @@ -1,41 +0,0 @@ -package frontdoors - -import ( - "encoding/json" - "fmt" -) - -var _ RouteConfiguration = ForwardingConfiguration{} - -type ForwardingConfiguration struct { - BackendPool *SubResource `json:"backendPool,omitempty"` - CacheConfiguration *CacheConfiguration `json:"cacheConfiguration,omitempty"` - CustomForwardingPath *string `json:"customForwardingPath,omitempty"` - ForwardingProtocol *FrontDoorForwardingProtocol `json:"forwardingProtocol,omitempty"` - - // Fields inherited from RouteConfiguration -} - -var _ json.Marshaler = ForwardingConfiguration{} - -func (s ForwardingConfiguration) MarshalJSON() ([]byte, error) { - type wrapper ForwardingConfiguration - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ForwardingConfiguration: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ForwardingConfiguration: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ForwardingConfiguration: %+v", err) - } - - return encoded, nil -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontdoor.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontdoor.go deleted file mode 100644 index 3aec7c87ca30..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontdoor.go +++ /dev/null @@ -1,10 +0,0 @@ -package frontdoors - -type FrontDoor struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *FrontDoorProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontdoorcertificatesourceparameters.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontdoorcertificatesourceparameters.go deleted file mode 100644 index e4a4923aaab6..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontdoorcertificatesourceparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package frontdoors - -type FrontDoorCertificateSourceParameters struct { - CertificateType *FrontDoorCertificateType `json:"certificateType,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontdoorproperties.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontdoorproperties.go deleted file mode 100644 index e31d4b95fa92..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontdoorproperties.go +++ /dev/null @@ -1,17 +0,0 @@ -package frontdoors - -type FrontDoorProperties struct { - BackendPools *[]BackendPool `json:"backendPools,omitempty"` - BackendPoolsSettings *BackendPoolsSettings `json:"backendPoolsSettings,omitempty"` - Cname *string `json:"cname,omitempty"` - EnabledState *FrontDoorEnabledState `json:"enabledState,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` - FrontdoorId *string `json:"frontdoorId,omitempty"` - FrontendEndpoints *[]FrontendEndpoint `json:"frontendEndpoints,omitempty"` - HealthProbeSettings *[]HealthProbeSettingsModel `json:"healthProbeSettings,omitempty"` - LoadBalancingSettings *[]LoadBalancingSettingsModel `json:"loadBalancingSettings,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` - RoutingRules *[]RoutingRule `json:"routingRules,omitempty"` - RulesEngines *[]RulesEngine `json:"rulesEngines,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontendendpoint.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontendendpoint.go deleted file mode 100644 index 1bd72711b4c0..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontendendpoint.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type FrontendEndpoint struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *FrontendEndpointProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontendendpointproperties.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontendendpointproperties.go deleted file mode 100644 index dd80e827035e..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontendendpointproperties.go +++ /dev/null @@ -1,12 +0,0 @@ -package frontdoors - -type FrontendEndpointProperties struct { - CustomHttpsConfiguration *CustomHttpsConfiguration `json:"customHttpsConfiguration,omitempty"` - CustomHttpsProvisioningState *CustomHttpsProvisioningState `json:"customHttpsProvisioningState,omitempty"` - CustomHttpsProvisioningSubstate *CustomHttpsProvisioningSubstate `json:"customHttpsProvisioningSubstate,omitempty"` - HostName *string `json:"hostName,omitempty"` - ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` - SessionAffinityEnabledState *SessionAffinityEnabledState `json:"sessionAffinityEnabledState,omitempty"` - SessionAffinityTtlSeconds *int64 `json:"sessionAffinityTtlSeconds,omitempty"` - WebApplicationFirewallPolicyLink *FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontendendpointupdateparameterswebapplicationfirewallpolicylink.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontendendpointupdateparameterswebapplicationfirewallpolicylink.go deleted file mode 100644 index d959233aff41..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_frontendendpointupdateparameterswebapplicationfirewallpolicylink.go +++ /dev/null @@ -1,5 +0,0 @@ -package frontdoors - -type FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink struct { - Id *string `json:"id,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_headeraction.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_headeraction.go deleted file mode 100644 index 93070b0bcd87..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_headeraction.go +++ /dev/null @@ -1,7 +0,0 @@ -package frontdoors - -type HeaderAction struct { - HeaderActionType HeaderActionType `json:"headerActionType"` - HeaderName string `json:"headerName"` - Value *string `json:"value,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_healthprobesettingsmodel.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_healthprobesettingsmodel.go deleted file mode 100644 index d248a95c709c..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_healthprobesettingsmodel.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type HealthProbeSettingsModel struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *HealthProbeSettingsProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_healthprobesettingsproperties.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_healthprobesettingsproperties.go deleted file mode 100644 index 75f843fa294f..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_healthprobesettingsproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package frontdoors - -type HealthProbeSettingsProperties struct { - EnabledState *HealthProbeEnabled `json:"enabledState,omitempty"` - HealthProbeMethod *FrontDoorHealthProbeMethod `json:"healthProbeMethod,omitempty"` - IntervalInSeconds *int64 `json:"intervalInSeconds,omitempty"` - Path *string `json:"path,omitempty"` - Protocol *FrontDoorProtocol `json:"protocol,omitempty"` - ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_keyvaultcertificatesourceparameters.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_keyvaultcertificatesourceparameters.go deleted file mode 100644 index 8944798ab6e3..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_keyvaultcertificatesourceparameters.go +++ /dev/null @@ -1,7 +0,0 @@ -package frontdoors - -type KeyVaultCertificateSourceParameters struct { - SecretName *string `json:"secretName,omitempty"` - SecretVersion *string `json:"secretVersion,omitempty"` - Vault *KeyVaultCertificateSourceParametersVault `json:"vault,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_keyvaultcertificatesourceparametersvault.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_keyvaultcertificatesourceparametersvault.go deleted file mode 100644 index 5ee791625775..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_keyvaultcertificatesourceparametersvault.go +++ /dev/null @@ -1,5 +0,0 @@ -package frontdoors - -type KeyVaultCertificateSourceParametersVault struct { - Id *string `json:"id,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_loadbalancingsettingsmodel.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_loadbalancingsettingsmodel.go deleted file mode 100644 index 55678911ed9c..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_loadbalancingsettingsmodel.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type LoadBalancingSettingsModel struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *LoadBalancingSettingsProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_loadbalancingsettingsproperties.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_loadbalancingsettingsproperties.go deleted file mode 100644 index c9b3ea3ceeb7..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_loadbalancingsettingsproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type LoadBalancingSettingsProperties struct { - AdditionalLatencyMilliseconds *int64 `json:"additionalLatencyMilliseconds,omitempty"` - ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` - SampleSize *int64 `json:"sampleSize,omitempty"` - SuccessfulSamplesRequired *int64 `json:"successfulSamplesRequired,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_purgeparameters.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_purgeparameters.go deleted file mode 100644 index d44a093cd7c3..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_purgeparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package frontdoors - -type PurgeParameters struct { - ContentPaths []string `json:"contentPaths"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_redirectconfiguration.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_redirectconfiguration.go deleted file mode 100644 index 914ddd8f80ce..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_redirectconfiguration.go +++ /dev/null @@ -1,43 +0,0 @@ -package frontdoors - -import ( - "encoding/json" - "fmt" -) - -var _ RouteConfiguration = RedirectConfiguration{} - -type RedirectConfiguration struct { - CustomFragment *string `json:"customFragment,omitempty"` - CustomHost *string `json:"customHost,omitempty"` - CustomPath *string `json:"customPath,omitempty"` - CustomQueryString *string `json:"customQueryString,omitempty"` - RedirectProtocol *FrontDoorRedirectProtocol `json:"redirectProtocol,omitempty"` - RedirectType *FrontDoorRedirectType `json:"redirectType,omitempty"` - - // Fields inherited from RouteConfiguration -} - -var _ json.Marshaler = RedirectConfiguration{} - -func (s RedirectConfiguration) MarshalJSON() ([]byte, error) { - type wrapper RedirectConfiguration - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling RedirectConfiguration: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling RedirectConfiguration: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Azure.FrontDoor.Models.FrontdoorRedirectConfiguration" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling RedirectConfiguration: %+v", err) - } - - return encoded, nil -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_routeconfiguration.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_routeconfiguration.go deleted file mode 100644 index 5f5c22c71e6a..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_routeconfiguration.go +++ /dev/null @@ -1,52 +0,0 @@ -package frontdoors - -import ( - "encoding/json" - "fmt" - "strings" -) - -type RouteConfiguration interface { -} - -func unmarshalRouteConfigurationImplementation(input []byte) (RouteConfiguration, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling RouteConfiguration into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration") { - var out ForwardingConfiguration - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ForwardingConfiguration: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Azure.FrontDoor.Models.FrontdoorRedirectConfiguration") { - var out RedirectConfiguration - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into RedirectConfiguration: %+v", err) - } - return out, nil - } - - type RawRouteConfigurationImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawRouteConfigurationImpl{ - Type: value, - Values: temp, - } - return out, nil -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_routingrule.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_routingrule.go deleted file mode 100644 index 003a1d5aa215..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_routingrule.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type RoutingRule struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *RoutingRuleProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_routingruleproperties.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_routingruleproperties.go deleted file mode 100644 index 262f246f0928..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_routingruleproperties.go +++ /dev/null @@ -1,49 +0,0 @@ -package frontdoors - -import ( - "encoding/json" - "fmt" -) - -type RoutingRuleProperties struct { - AcceptedProtocols *[]FrontDoorProtocol `json:"acceptedProtocols,omitempty"` - EnabledState *RoutingRuleEnabledState `json:"enabledState,omitempty"` - FrontendEndpoints *[]SubResource `json:"frontendEndpoints,omitempty"` - PatternsToMatch *[]string `json:"patternsToMatch,omitempty"` - ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` - RouteConfiguration RouteConfiguration `json:"routeConfiguration"` - RulesEngine *SubResource `json:"rulesEngine,omitempty"` - WebApplicationFirewallPolicyLink *RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` -} - -var _ json.Unmarshaler = &RoutingRuleProperties{} - -func (s *RoutingRuleProperties) UnmarshalJSON(bytes []byte) error { - type alias RoutingRuleProperties - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into RoutingRuleProperties: %+v", err) - } - - s.AcceptedProtocols = decoded.AcceptedProtocols - s.EnabledState = decoded.EnabledState - s.FrontendEndpoints = decoded.FrontendEndpoints - s.PatternsToMatch = decoded.PatternsToMatch - s.ResourceState = decoded.ResourceState - s.RulesEngine = decoded.RulesEngine - s.WebApplicationFirewallPolicyLink = decoded.WebApplicationFirewallPolicyLink - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling RoutingRuleProperties into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["routeConfiguration"]; ok { - impl, err := unmarshalRouteConfigurationImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'RouteConfiguration' for 'RoutingRuleProperties': %+v", err) - } - s.RouteConfiguration = impl - } - return nil -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_routingruleupdateparameterswebapplicationfirewallpolicylink.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_routingruleupdateparameterswebapplicationfirewallpolicylink.go deleted file mode 100644 index 1c708e8ffd93..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_routingruleupdateparameterswebapplicationfirewallpolicylink.go +++ /dev/null @@ -1,5 +0,0 @@ -package frontdoors - -type RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink struct { - Id *string `json:"id,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_rulesengine.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_rulesengine.go deleted file mode 100644 index 4015317dcc5b..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_rulesengine.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type RulesEngine struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *RulesEngineProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_rulesengineaction.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_rulesengineaction.go deleted file mode 100644 index 2ec3f73b0b5e..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_rulesengineaction.go +++ /dev/null @@ -1,39 +0,0 @@ -package frontdoors - -import ( - "encoding/json" - "fmt" -) - -type RulesEngineAction struct { - RequestHeaderActions *[]HeaderAction `json:"requestHeaderActions,omitempty"` - ResponseHeaderActions *[]HeaderAction `json:"responseHeaderActions,omitempty"` - RouteConfigurationOverride RouteConfiguration `json:"routeConfigurationOverride"` -} - -var _ json.Unmarshaler = &RulesEngineAction{} - -func (s *RulesEngineAction) UnmarshalJSON(bytes []byte) error { - type alias RulesEngineAction - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into RulesEngineAction: %+v", err) - } - - s.RequestHeaderActions = decoded.RequestHeaderActions - s.ResponseHeaderActions = decoded.ResponseHeaderActions - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling RulesEngineAction into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["routeConfigurationOverride"]; ok { - impl, err := unmarshalRouteConfigurationImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'RouteConfigurationOverride' for 'RulesEngineAction': %+v", err) - } - s.RouteConfigurationOverride = impl - } - return nil -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_rulesenginematchcondition.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_rulesenginematchcondition.go deleted file mode 100644 index 82c552bb7ecc..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_rulesenginematchcondition.go +++ /dev/null @@ -1,10 +0,0 @@ -package frontdoors - -type RulesEngineMatchCondition struct { - NegateCondition *bool `json:"negateCondition,omitempty"` - RulesEngineMatchValue []string `json:"rulesEngineMatchValue"` - RulesEngineMatchVariable RulesEngineMatchVariable `json:"rulesEngineMatchVariable"` - RulesEngineOperator RulesEngineOperator `json:"rulesEngineOperator"` - Selector *string `json:"selector,omitempty"` - Transforms *[]Transform `json:"transforms,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_rulesengineproperties.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_rulesengineproperties.go deleted file mode 100644 index 60350faa6f71..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_rulesengineproperties.go +++ /dev/null @@ -1,6 +0,0 @@ -package frontdoors - -type RulesEngineProperties struct { - ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` - Rules *[]RulesEngineRule `json:"rules,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_rulesenginerule.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_rulesenginerule.go deleted file mode 100644 index 99fe4ddcfee4..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_rulesenginerule.go +++ /dev/null @@ -1,9 +0,0 @@ -package frontdoors - -type RulesEngineRule struct { - Action RulesEngineAction `json:"action"` - MatchConditions *[]RulesEngineMatchCondition `json:"matchConditions,omitempty"` - MatchProcessingBehavior *MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` - Name string `json:"name"` - Priority int64 `json:"priority"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_subresource.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_subresource.go deleted file mode 100644 index bc3007a051ae..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_subresource.go +++ /dev/null @@ -1,5 +0,0 @@ -package frontdoors - -type SubResource struct { - Id *string `json:"id,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_validatecustomdomaininput.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_validatecustomdomaininput.go deleted file mode 100644 index 38c49b705bb4..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_validatecustomdomaininput.go +++ /dev/null @@ -1,5 +0,0 @@ -package frontdoors - -type ValidateCustomDomainInput struct { - HostName string `json:"hostName"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_validatecustomdomainoutput.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_validatecustomdomainoutput.go deleted file mode 100644 index bcbdeb33419a..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/model_validatecustomdomainoutput.go +++ /dev/null @@ -1,7 +0,0 @@ -package frontdoors - -type ValidateCustomDomainOutput struct { - CustomDomainValidated *bool `json:"customDomainValidated,omitempty"` - Message *string `json:"message,omitempty"` - Reason *string `json:"reason,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/predicates.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/predicates.go deleted file mode 100644 index c9ce234a8430..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/predicates.go +++ /dev/null @@ -1,72 +0,0 @@ -package frontdoors - -type FrontDoorPredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p FrontDoorPredicate) Matches(input FrontDoor) bool { - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} - -type FrontendEndpointPredicate struct { - Id *string - Name *string - Type *string -} - -func (p FrontendEndpointPredicate) Matches(input FrontendEndpoint) bool { - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} - -type RulesEnginePredicate struct { - Id *string - Name *string - Type *string -} - -func (p RulesEnginePredicate) Matches(input RulesEngine) bool { - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/version.go b/internal/services/frontdoor/sdk/2020-04-01/frontdoors/version.go deleted file mode 100644 index eec3c6f75986..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package frontdoors - -import "fmt" - -const defaultApiVersion = "2020-04-01" - -func userAgent() string { - return fmt.Sprintf("pandora/frontdoors/%s", defaultApiVersion) -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/client.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/client.go deleted file mode 100644 index b643273b716e..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package webapplicationfirewallmanagedrulesets - -import "github.com/Azure/go-autorest/autorest" - -type WebApplicationFirewallManagedRuleSetsClient struct { - Client autorest.Client - baseUri string -} - -func NewWebApplicationFirewallManagedRuleSetsClientWithBaseURI(endpoint string) WebApplicationFirewallManagedRuleSetsClient { - return WebApplicationFirewallManagedRuleSetsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/constants.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/constants.go deleted file mode 100644 index 161e4e8c8ee1..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/constants.go +++ /dev/null @@ -1,65 +0,0 @@ -package webapplicationfirewallmanagedrulesets - -import "strings" - -type ActionType string - -const ( - ActionTypeAllow ActionType = "Allow" - ActionTypeBlock ActionType = "Block" - ActionTypeLog ActionType = "Log" - ActionTypeRedirect ActionType = "Redirect" -) - -func PossibleValuesForActionType() []string { - return []string{ - string(ActionTypeAllow), - string(ActionTypeBlock), - string(ActionTypeLog), - string(ActionTypeRedirect), - } -} - -func parseActionType(input string) (*ActionType, error) { - vals := map[string]ActionType{ - "allow": ActionTypeAllow, - "block": ActionTypeBlock, - "log": ActionTypeLog, - "redirect": ActionTypeRedirect, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ActionType(input) - return &out, nil -} - -type ManagedRuleEnabledState string - -const ( - ManagedRuleEnabledStateDisabled ManagedRuleEnabledState = "Disabled" - ManagedRuleEnabledStateEnabled ManagedRuleEnabledState = "Enabled" -) - -func PossibleValuesForManagedRuleEnabledState() []string { - return []string{ - string(ManagedRuleEnabledStateDisabled), - string(ManagedRuleEnabledStateEnabled), - } -} - -func parseManagedRuleEnabledState(input string) (*ManagedRuleEnabledState, error) { - vals := map[string]ManagedRuleEnabledState{ - "disabled": ManagedRuleEnabledStateDisabled, - "enabled": ManagedRuleEnabledStateEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ManagedRuleEnabledState(input) - return &out, nil -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/id_subscription.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/id_subscription.go deleted file mode 100644 index 89cf8f57daed..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package webapplicationfirewallmanagedrulesets - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/id_subscription_test.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/id_subscription_test.go deleted file mode 100644 index 5bd3ef97b92e..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/id_subscription_test.go +++ /dev/null @@ -1,157 +0,0 @@ -package webapplicationfirewallmanagedrulesets - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -func TestNewSubscriptionID(t *testing.T) { - id := NewSubscriptionID("12345678-1234-9876-4563-123456789012") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } -} - -func TestFormatSubscriptionID(t *testing.T) { - actual := NewSubscriptionID("12345678-1234-9876-4563-123456789012").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSubscriptionID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubscriptionId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Expected: &SubscriptionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubscriptionID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - } -} - -func TestParseSubscriptionIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubscriptionId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Expected: &SubscriptionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Expected: &SubscriptionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubscriptionIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - } -} - -func TestSegmentsForSubscriptionId(t *testing.T) { - segments := SubscriptionId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SubscriptionId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/method_managedrulesetslist_autorest.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/method_managedrulesetslist_autorest.go deleted file mode 100644 index 67e84c9e09a4..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/method_managedrulesetslist_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package webapplicationfirewallmanagedrulesets - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ManagedRuleSetsListResponse struct { - HttpResponse *http.Response - Model *[]ManagedRuleSetDefinition - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ManagedRuleSetsListResponse, error) -} - -type ManagedRuleSetsListCompleteResult struct { - Items []ManagedRuleSetDefinition -} - -func (r ManagedRuleSetsListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ManagedRuleSetsListResponse) LoadMore(ctx context.Context) (resp ManagedRuleSetsListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ManagedRuleSetsList ... -func (c WebApplicationFirewallManagedRuleSetsClient) ManagedRuleSetsList(ctx context.Context, id SubscriptionId) (resp ManagedRuleSetsListResponse, err error) { - req, err := c.preparerForManagedRuleSetsList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "webapplicationfirewallmanagedrulesets.WebApplicationFirewallManagedRuleSetsClient", "ManagedRuleSetsList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "webapplicationfirewallmanagedrulesets.WebApplicationFirewallManagedRuleSetsClient", "ManagedRuleSetsList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForManagedRuleSetsList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "webapplicationfirewallmanagedrulesets.WebApplicationFirewallManagedRuleSetsClient", "ManagedRuleSetsList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ManagedRuleSetsListComplete retrieves all of the results into a single object -func (c WebApplicationFirewallManagedRuleSetsClient) ManagedRuleSetsListComplete(ctx context.Context, id SubscriptionId) (ManagedRuleSetsListCompleteResult, error) { - return c.ManagedRuleSetsListCompleteMatchingPredicate(ctx, id, ManagedRuleSetDefinitionPredicate{}) -} - -// ManagedRuleSetsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c WebApplicationFirewallManagedRuleSetsClient) ManagedRuleSetsListCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate ManagedRuleSetDefinitionPredicate) (resp ManagedRuleSetsListCompleteResult, err error) { - items := make([]ManagedRuleSetDefinition, 0) - - page, err := c.ManagedRuleSetsList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ManagedRuleSetsListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForManagedRuleSetsList prepares the ManagedRuleSetsList request. -func (c WebApplicationFirewallManagedRuleSetsClient) preparerForManagedRuleSetsList(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/frontDoorWebApplicationFirewallManagedRuleSets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForManagedRuleSetsListWithNextLink prepares the ManagedRuleSetsList request with the given nextLink token. -func (c WebApplicationFirewallManagedRuleSetsClient) preparerForManagedRuleSetsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForManagedRuleSetsList handles the response to the ManagedRuleSetsList request. The method always -// closes the http.Response Body. -func (c WebApplicationFirewallManagedRuleSetsClient) responderForManagedRuleSetsList(resp *http.Response) (result ManagedRuleSetsListResponse, err error) { - type page struct { - Values []ManagedRuleSetDefinition `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ManagedRuleSetsListResponse, err error) { - req, err := c.preparerForManagedRuleSetsListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "webapplicationfirewallmanagedrulesets.WebApplicationFirewallManagedRuleSetsClient", "ManagedRuleSetsList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "webapplicationfirewallmanagedrulesets.WebApplicationFirewallManagedRuleSetsClient", "ManagedRuleSetsList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForManagedRuleSetsList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "webapplicationfirewallmanagedrulesets.WebApplicationFirewallManagedRuleSetsClient", "ManagedRuleSetsList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/model_managedruledefinition.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/model_managedruledefinition.go deleted file mode 100644 index 19a9a87acfce..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/model_managedruledefinition.go +++ /dev/null @@ -1,8 +0,0 @@ -package webapplicationfirewallmanagedrulesets - -type ManagedRuleDefinition struct { - DefaultAction *ActionType `json:"defaultAction,omitempty"` - DefaultState *ManagedRuleEnabledState `json:"defaultState,omitempty"` - Description *string `json:"description,omitempty"` - RuleId *string `json:"ruleId,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/model_managedrulegroupdefinition.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/model_managedrulegroupdefinition.go deleted file mode 100644 index 753a131a79a3..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/model_managedrulegroupdefinition.go +++ /dev/null @@ -1,7 +0,0 @@ -package webapplicationfirewallmanagedrulesets - -type ManagedRuleGroupDefinition struct { - Description *string `json:"description,omitempty"` - RuleGroupName *string `json:"ruleGroupName,omitempty"` - Rules *[]ManagedRuleDefinition `json:"rules,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/model_managedrulesetdefinition.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/model_managedrulesetdefinition.go deleted file mode 100644 index 2af1b31a1e7e..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/model_managedrulesetdefinition.go +++ /dev/null @@ -1,10 +0,0 @@ -package webapplicationfirewallmanagedrulesets - -type ManagedRuleSetDefinition struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *ManagedRuleSetDefinitionProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/model_managedrulesetdefinitionproperties.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/model_managedrulesetdefinitionproperties.go deleted file mode 100644 index 3dbb0b251c19..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/model_managedrulesetdefinitionproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -package webapplicationfirewallmanagedrulesets - -type ManagedRuleSetDefinitionProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - RuleGroups *[]ManagedRuleGroupDefinition `json:"ruleGroups,omitempty"` - RuleSetId *string `json:"ruleSetId,omitempty"` - RuleSetType *string `json:"ruleSetType,omitempty"` - RuleSetVersion *string `json:"ruleSetVersion,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/predicates.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/predicates.go deleted file mode 100644 index 878d1d2cf6f5..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/predicates.go +++ /dev/null @@ -1,28 +0,0 @@ -package webapplicationfirewallmanagedrulesets - -type ManagedRuleSetDefinitionPredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p ManagedRuleSetDefinitionPredicate) Matches(input ManagedRuleSetDefinition) bool { - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/version.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/version.go deleted file mode 100644 index 49467620f4a0..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallmanagedrulesets/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package webapplicationfirewallmanagedrulesets - -import "fmt" - -const defaultApiVersion = "2020-04-01" - -func userAgent() string { - return fmt.Sprintf("pandora/webapplicationfirewallmanagedrulesets/%s", defaultApiVersion) -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/client.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/client.go deleted file mode 100644 index 2472e343e047..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package webapplicationfirewallpolicies - -import "github.com/Azure/go-autorest/autorest" - -type WebApplicationFirewallPoliciesClient struct { - Client autorest.Client - baseUri string -} - -func NewWebApplicationFirewallPoliciesClientWithBaseURI(endpoint string) WebApplicationFirewallPoliciesClient { - return WebApplicationFirewallPoliciesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/constants.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/constants.go deleted file mode 100644 index 645b45df22dd..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/constants.go +++ /dev/null @@ -1,435 +0,0 @@ -package webapplicationfirewallpolicies - -import "strings" - -type ActionType string - -const ( - ActionTypeAllow ActionType = "Allow" - ActionTypeBlock ActionType = "Block" - ActionTypeLog ActionType = "Log" - ActionTypeRedirect ActionType = "Redirect" -) - -func PossibleValuesForActionType() []string { - return []string{ - string(ActionTypeAllow), - string(ActionTypeBlock), - string(ActionTypeLog), - string(ActionTypeRedirect), - } -} - -func parseActionType(input string) (*ActionType, error) { - vals := map[string]ActionType{ - "allow": ActionTypeAllow, - "block": ActionTypeBlock, - "log": ActionTypeLog, - "redirect": ActionTypeRedirect, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ActionType(input) - return &out, nil -} - -type CustomRuleEnabledState string - -const ( - CustomRuleEnabledStateDisabled CustomRuleEnabledState = "Disabled" - CustomRuleEnabledStateEnabled CustomRuleEnabledState = "Enabled" -) - -func PossibleValuesForCustomRuleEnabledState() []string { - return []string{ - string(CustomRuleEnabledStateDisabled), - string(CustomRuleEnabledStateEnabled), - } -} - -func parseCustomRuleEnabledState(input string) (*CustomRuleEnabledState, error) { - vals := map[string]CustomRuleEnabledState{ - "disabled": CustomRuleEnabledStateDisabled, - "enabled": CustomRuleEnabledStateEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CustomRuleEnabledState(input) - return &out, nil -} - -type ManagedRuleEnabledState string - -const ( - ManagedRuleEnabledStateDisabled ManagedRuleEnabledState = "Disabled" - ManagedRuleEnabledStateEnabled ManagedRuleEnabledState = "Enabled" -) - -func PossibleValuesForManagedRuleEnabledState() []string { - return []string{ - string(ManagedRuleEnabledStateDisabled), - string(ManagedRuleEnabledStateEnabled), - } -} - -func parseManagedRuleEnabledState(input string) (*ManagedRuleEnabledState, error) { - vals := map[string]ManagedRuleEnabledState{ - "disabled": ManagedRuleEnabledStateDisabled, - "enabled": ManagedRuleEnabledStateEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ManagedRuleEnabledState(input) - return &out, nil -} - -type ManagedRuleExclusionMatchVariable string - -const ( - ManagedRuleExclusionMatchVariableQueryStringArgNames ManagedRuleExclusionMatchVariable = "QueryStringArgNames" - ManagedRuleExclusionMatchVariableRequestBodyPostArgNames ManagedRuleExclusionMatchVariable = "RequestBodyPostArgNames" - ManagedRuleExclusionMatchVariableRequestCookieNames ManagedRuleExclusionMatchVariable = "RequestCookieNames" - ManagedRuleExclusionMatchVariableRequestHeaderNames ManagedRuleExclusionMatchVariable = "RequestHeaderNames" -) - -func PossibleValuesForManagedRuleExclusionMatchVariable() []string { - return []string{ - string(ManagedRuleExclusionMatchVariableQueryStringArgNames), - string(ManagedRuleExclusionMatchVariableRequestBodyPostArgNames), - string(ManagedRuleExclusionMatchVariableRequestCookieNames), - string(ManagedRuleExclusionMatchVariableRequestHeaderNames), - } -} - -func parseManagedRuleExclusionMatchVariable(input string) (*ManagedRuleExclusionMatchVariable, error) { - vals := map[string]ManagedRuleExclusionMatchVariable{ - "querystringargnames": ManagedRuleExclusionMatchVariableQueryStringArgNames, - "requestbodypostargnames": ManagedRuleExclusionMatchVariableRequestBodyPostArgNames, - "requestcookienames": ManagedRuleExclusionMatchVariableRequestCookieNames, - "requestheadernames": ManagedRuleExclusionMatchVariableRequestHeaderNames, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ManagedRuleExclusionMatchVariable(input) - return &out, nil -} - -type ManagedRuleExclusionSelectorMatchOperator string - -const ( - ManagedRuleExclusionSelectorMatchOperatorContains ManagedRuleExclusionSelectorMatchOperator = "Contains" - ManagedRuleExclusionSelectorMatchOperatorEndsWith ManagedRuleExclusionSelectorMatchOperator = "EndsWith" - ManagedRuleExclusionSelectorMatchOperatorEquals ManagedRuleExclusionSelectorMatchOperator = "Equals" - ManagedRuleExclusionSelectorMatchOperatorEqualsAny ManagedRuleExclusionSelectorMatchOperator = "EqualsAny" - ManagedRuleExclusionSelectorMatchOperatorStartsWith ManagedRuleExclusionSelectorMatchOperator = "StartsWith" -) - -func PossibleValuesForManagedRuleExclusionSelectorMatchOperator() []string { - return []string{ - string(ManagedRuleExclusionSelectorMatchOperatorContains), - string(ManagedRuleExclusionSelectorMatchOperatorEndsWith), - string(ManagedRuleExclusionSelectorMatchOperatorEquals), - string(ManagedRuleExclusionSelectorMatchOperatorEqualsAny), - string(ManagedRuleExclusionSelectorMatchOperatorStartsWith), - } -} - -func parseManagedRuleExclusionSelectorMatchOperator(input string) (*ManagedRuleExclusionSelectorMatchOperator, error) { - vals := map[string]ManagedRuleExclusionSelectorMatchOperator{ - "contains": ManagedRuleExclusionSelectorMatchOperatorContains, - "endswith": ManagedRuleExclusionSelectorMatchOperatorEndsWith, - "equals": ManagedRuleExclusionSelectorMatchOperatorEquals, - "equalsany": ManagedRuleExclusionSelectorMatchOperatorEqualsAny, - "startswith": ManagedRuleExclusionSelectorMatchOperatorStartsWith, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ManagedRuleExclusionSelectorMatchOperator(input) - return &out, nil -} - -type MatchVariable string - -const ( - MatchVariableCookies MatchVariable = "Cookies" - MatchVariablePostArgs MatchVariable = "PostArgs" - MatchVariableQueryString MatchVariable = "QueryString" - MatchVariableRemoteAddr MatchVariable = "RemoteAddr" - MatchVariableRequestBody MatchVariable = "RequestBody" - MatchVariableRequestHeader MatchVariable = "RequestHeader" - MatchVariableRequestMethod MatchVariable = "RequestMethod" - MatchVariableRequestUri MatchVariable = "RequestUri" - MatchVariableSocketAddr MatchVariable = "SocketAddr" -) - -func PossibleValuesForMatchVariable() []string { - return []string{ - string(MatchVariableCookies), - string(MatchVariablePostArgs), - string(MatchVariableQueryString), - string(MatchVariableRemoteAddr), - string(MatchVariableRequestBody), - string(MatchVariableRequestHeader), - string(MatchVariableRequestMethod), - string(MatchVariableRequestUri), - string(MatchVariableSocketAddr), - } -} - -func parseMatchVariable(input string) (*MatchVariable, error) { - vals := map[string]MatchVariable{ - "cookies": MatchVariableCookies, - "postargs": MatchVariablePostArgs, - "querystring": MatchVariableQueryString, - "remoteaddr": MatchVariableRemoteAddr, - "requestbody": MatchVariableRequestBody, - "requestheader": MatchVariableRequestHeader, - "requestmethod": MatchVariableRequestMethod, - "requesturi": MatchVariableRequestUri, - "socketaddr": MatchVariableSocketAddr, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := MatchVariable(input) - return &out, nil -} - -type Operator string - -const ( - OperatorAny Operator = "Any" - OperatorBeginsWith Operator = "BeginsWith" - OperatorContains Operator = "Contains" - OperatorEndsWith Operator = "EndsWith" - OperatorEqual Operator = "Equal" - OperatorGeoMatch Operator = "GeoMatch" - OperatorGreaterThan Operator = "GreaterThan" - OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" - OperatorIPMatch Operator = "IPMatch" - OperatorLessThan Operator = "LessThan" - OperatorLessThanOrEqual Operator = "LessThanOrEqual" - OperatorRegEx Operator = "RegEx" -) - -func PossibleValuesForOperator() []string { - return []string{ - string(OperatorAny), - string(OperatorBeginsWith), - string(OperatorContains), - string(OperatorEndsWith), - string(OperatorEqual), - string(OperatorGeoMatch), - string(OperatorGreaterThan), - string(OperatorGreaterThanOrEqual), - string(OperatorIPMatch), - string(OperatorLessThan), - string(OperatorLessThanOrEqual), - string(OperatorRegEx), - } -} - -func parseOperator(input string) (*Operator, error) { - vals := map[string]Operator{ - "any": OperatorAny, - "beginswith": OperatorBeginsWith, - "contains": OperatorContains, - "endswith": OperatorEndsWith, - "equal": OperatorEqual, - "geomatch": OperatorGeoMatch, - "greaterthan": OperatorGreaterThan, - "greaterthanorequal": OperatorGreaterThanOrEqual, - "ipmatch": OperatorIPMatch, - "lessthan": OperatorLessThan, - "lessthanorequal": OperatorLessThanOrEqual, - "regex": OperatorRegEx, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Operator(input) - return &out, nil -} - -type PolicyEnabledState string - -const ( - PolicyEnabledStateDisabled PolicyEnabledState = "Disabled" - PolicyEnabledStateEnabled PolicyEnabledState = "Enabled" -) - -func PossibleValuesForPolicyEnabledState() []string { - return []string{ - string(PolicyEnabledStateDisabled), - string(PolicyEnabledStateEnabled), - } -} - -func parsePolicyEnabledState(input string) (*PolicyEnabledState, error) { - vals := map[string]PolicyEnabledState{ - "disabled": PolicyEnabledStateDisabled, - "enabled": PolicyEnabledStateEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PolicyEnabledState(input) - return &out, nil -} - -type PolicyMode string - -const ( - PolicyModeDetection PolicyMode = "Detection" - PolicyModePrevention PolicyMode = "Prevention" -) - -func PossibleValuesForPolicyMode() []string { - return []string{ - string(PolicyModeDetection), - string(PolicyModePrevention), - } -} - -func parsePolicyMode(input string) (*PolicyMode, error) { - vals := map[string]PolicyMode{ - "detection": PolicyModeDetection, - "prevention": PolicyModePrevention, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PolicyMode(input) - return &out, nil -} - -type PolicyResourceState string - -const ( - PolicyResourceStateCreating PolicyResourceState = "Creating" - PolicyResourceStateDeleting PolicyResourceState = "Deleting" - PolicyResourceStateDisabled PolicyResourceState = "Disabled" - PolicyResourceStateDisabling PolicyResourceState = "Disabling" - PolicyResourceStateEnabled PolicyResourceState = "Enabled" - PolicyResourceStateEnabling PolicyResourceState = "Enabling" -) - -func PossibleValuesForPolicyResourceState() []string { - return []string{ - string(PolicyResourceStateCreating), - string(PolicyResourceStateDeleting), - string(PolicyResourceStateDisabled), - string(PolicyResourceStateDisabling), - string(PolicyResourceStateEnabled), - string(PolicyResourceStateEnabling), - } -} - -func parsePolicyResourceState(input string) (*PolicyResourceState, error) { - vals := map[string]PolicyResourceState{ - "creating": PolicyResourceStateCreating, - "deleting": PolicyResourceStateDeleting, - "disabled": PolicyResourceStateDisabled, - "disabling": PolicyResourceStateDisabling, - "enabled": PolicyResourceStateEnabled, - "enabling": PolicyResourceStateEnabling, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PolicyResourceState(input) - return &out, nil -} - -type RuleType string - -const ( - RuleTypeMatchRule RuleType = "MatchRule" - RuleTypeRateLimitRule RuleType = "RateLimitRule" -) - -func PossibleValuesForRuleType() []string { - return []string{ - string(RuleTypeMatchRule), - string(RuleTypeRateLimitRule), - } -} - -func parseRuleType(input string) (*RuleType, error) { - vals := map[string]RuleType{ - "matchrule": RuleTypeMatchRule, - "ratelimitrule": RuleTypeRateLimitRule, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RuleType(input) - return &out, nil -} - -type TransformType string - -const ( - TransformTypeLowercase TransformType = "Lowercase" - TransformTypeRemoveNulls TransformType = "RemoveNulls" - TransformTypeTrim TransformType = "Trim" - TransformTypeUppercase TransformType = "Uppercase" - TransformTypeUrlDecode TransformType = "UrlDecode" - TransformTypeUrlEncode TransformType = "UrlEncode" -) - -func PossibleValuesForTransformType() []string { - return []string{ - string(TransformTypeLowercase), - string(TransformTypeRemoveNulls), - string(TransformTypeTrim), - string(TransformTypeUppercase), - string(TransformTypeUrlDecode), - string(TransformTypeUrlEncode), - } -} - -func parseTransformType(input string) (*TransformType, error) { - vals := map[string]TransformType{ - "lowercase": TransformTypeLowercase, - "removenulls": TransformTypeRemoveNulls, - "trim": TransformTypeTrim, - "uppercase": TransformTypeUppercase, - "urldecode": TransformTypeUrlDecode, - "urlencode": TransformTypeUrlEncode, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := TransformType(input) - return &out, nil -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicies.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicies.go deleted file mode 100644 index 25f30b268737..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicies.go +++ /dev/null @@ -1,124 +0,0 @@ -package webapplicationfirewallpolicies - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = FrontDoorWebApplicationFirewallPoliciesId{} - -// FrontDoorWebApplicationFirewallPoliciesId is a struct representing the Resource ID for a Front Door Web Application Firewall Policies -type FrontDoorWebApplicationFirewallPoliciesId struct { - SubscriptionId string - ResourceGroupName string - PolicyName string -} - -// NewFrontDoorWebApplicationFirewallPoliciesID returns a new FrontDoorWebApplicationFirewallPoliciesId struct -func NewFrontDoorWebApplicationFirewallPoliciesID(subscriptionId string, resourceGroupName string, policyName string) FrontDoorWebApplicationFirewallPoliciesId { - return FrontDoorWebApplicationFirewallPoliciesId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - PolicyName: policyName, - } -} - -// ParseFrontDoorWebApplicationFirewallPoliciesID parses 'input' into a FrontDoorWebApplicationFirewallPoliciesId -func ParseFrontDoorWebApplicationFirewallPoliciesID(input string) (*FrontDoorWebApplicationFirewallPoliciesId, error) { - parser := resourceids.NewParserFromResourceIdType(FrontDoorWebApplicationFirewallPoliciesId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FrontDoorWebApplicationFirewallPoliciesId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.PolicyName, ok = parsed.Parsed["policyName"]; !ok { - return nil, fmt.Errorf("the segment 'policyName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseFrontDoorWebApplicationFirewallPoliciesIDInsensitively parses 'input' case-insensitively into a FrontDoorWebApplicationFirewallPoliciesId -// note: this method should only be used for API response data and not user input -func ParseFrontDoorWebApplicationFirewallPoliciesIDInsensitively(input string) (*FrontDoorWebApplicationFirewallPoliciesId, error) { - parser := resourceids.NewParserFromResourceIdType(FrontDoorWebApplicationFirewallPoliciesId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FrontDoorWebApplicationFirewallPoliciesId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.PolicyName, ok = parsed.Parsed["policyName"]; !ok { - return nil, fmt.Errorf("the segment 'policyName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateFrontDoorWebApplicationFirewallPoliciesID checks that 'input' can be parsed as a Front Door Web Application Firewall Policies ID -func ValidateFrontDoorWebApplicationFirewallPoliciesID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseFrontDoorWebApplicationFirewallPoliciesID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Front Door Web Application Firewall Policies ID -func (id FrontDoorWebApplicationFirewallPoliciesId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PolicyName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Front Door Web Application Firewall Policies ID -func (id FrontDoorWebApplicationFirewallPoliciesId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), - resourceids.StaticSegment("staticFrontDoorWebApplicationFirewallPolicies", "frontDoorWebApplicationFirewallPolicies", "frontDoorWebApplicationFirewallPolicies"), - resourceids.UserSpecifiedSegment("policyName", "policyValue"), - } -} - -// String returns a human-readable description of this Front Door Web Application Firewall Policies ID -func (id FrontDoorWebApplicationFirewallPoliciesId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Policy Name: %q", id.PolicyName), - } - return fmt.Sprintf("Front Door Web Application Firewall Policies (%s)", strings.Join(components, "\n")) -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicies_test.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicies_test.go deleted file mode 100644 index 6681c3577716..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicies_test.go +++ /dev/null @@ -1,277 +0,0 @@ -package webapplicationfirewallpolicies - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = FrontDoorWebApplicationFirewallPoliciesId{} - -func TestNewFrontDoorWebApplicationFirewallPoliciesID(t *testing.T) { - id := NewFrontDoorWebApplicationFirewallPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "policyValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.PolicyName != "policyValue" { - t.Fatalf("Expected %q but got %q for Segment 'PolicyName'", id.PolicyName, "policyValue") - } -} - -func TestFormatFrontDoorWebApplicationFirewallPoliciesID(t *testing.T) { - actual := NewFrontDoorWebApplicationFirewallPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "policyValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/policyValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseFrontDoorWebApplicationFirewallPoliciesID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *FrontDoorWebApplicationFirewallPoliciesId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/policyValue", - Expected: &FrontDoorWebApplicationFirewallPoliciesId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - PolicyName: "policyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/policyValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseFrontDoorWebApplicationFirewallPoliciesID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.PolicyName != v.Expected.PolicyName { - t.Fatalf("Expected %q but got %q for PolicyName", v.Expected.PolicyName, actual.PolicyName) - } - } -} - -func TestParseFrontDoorWebApplicationFirewallPoliciesIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *FrontDoorWebApplicationFirewallPoliciesId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrWeBaPpLiCaTiOnFiReWaLlPoLiCiEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/policyValue", - Expected: &FrontDoorWebApplicationFirewallPoliciesId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - PolicyName: "policyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/policyValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrWeBaPpLiCaTiOnFiReWaLlPoLiCiEs/pOlIcYvAlUe", - Expected: &FrontDoorWebApplicationFirewallPoliciesId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - PolicyName: "pOlIcYvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrWeBaPpLiCaTiOnFiReWaLlPoLiCiEs/pOlIcYvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseFrontDoorWebApplicationFirewallPoliciesIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.PolicyName != v.Expected.PolicyName { - t.Fatalf("Expected %q but got %q for PolicyName", v.Expected.PolicyName, actual.PolicyName) - } - } -} - -func TestSegmentsForFrontDoorWebApplicationFirewallPoliciesId(t *testing.T) { - segments := FrontDoorWebApplicationFirewallPoliciesId{}.Segments() - if len(segments) == 0 { - t.Fatalf("FrontDoorWebApplicationFirewallPoliciesId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/id_resourcegroup.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/id_resourcegroup.go deleted file mode 100644 index d817d6e4f3d8..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package webapplicationfirewallpolicies - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/id_resourcegroup_test.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/id_resourcegroup_test.go deleted file mode 100644 index 04e4eb117d11..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/id_resourcegroup_test.go +++ /dev/null @@ -1,202 +0,0 @@ -package webapplicationfirewallpolicies - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -func TestNewResourceGroupID(t *testing.T) { - id := NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } -} - -func TestFormatResourceGroupID(t *testing.T) { - actual := NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseResourceGroupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ResourceGroupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Expected: &ResourceGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseResourceGroupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - } -} - -func TestParseResourceGroupIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ResourceGroupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Expected: &ResourceGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Expected: &ResourceGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseResourceGroupIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - } -} - -func TestSegmentsForResourceGroupId(t *testing.T) { - segments := ResourceGroupId{}.Segments() - if len(segments) == 0 { - t.Fatalf("ResourceGroupId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_customrulelist.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_customrulelist.go deleted file mode 100644 index 3a76ad7a2f6c..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_customrulelist.go +++ /dev/null @@ -1,5 +0,0 @@ -package webapplicationfirewallpolicies - -type CustomRuleList struct { - Rules *[]CustomRule `json:"rules,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_frontendendpointlink.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_frontendendpointlink.go deleted file mode 100644 index fe0c4d6a4f43..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_frontendendpointlink.go +++ /dev/null @@ -1,5 +0,0 @@ -package webapplicationfirewallpolicies - -type FrontendEndpointLink struct { - Id *string `json:"id,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_managedruleexclusion.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_managedruleexclusion.go deleted file mode 100644 index 962d6e5be2b6..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_managedruleexclusion.go +++ /dev/null @@ -1,7 +0,0 @@ -package webapplicationfirewallpolicies - -type ManagedRuleExclusion struct { - MatchVariable ManagedRuleExclusionMatchVariable `json:"matchVariable"` - Selector string `json:"selector"` - SelectorMatchOperator ManagedRuleExclusionSelectorMatchOperator `json:"selectorMatchOperator"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_managedrulegroupoverride.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_managedrulegroupoverride.go deleted file mode 100644 index de9ee01d22ef..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_managedrulegroupoverride.go +++ /dev/null @@ -1,7 +0,0 @@ -package webapplicationfirewallpolicies - -type ManagedRuleGroupOverride struct { - Exclusions *[]ManagedRuleExclusion `json:"exclusions,omitempty"` - RuleGroupName string `json:"ruleGroupName"` - Rules *[]ManagedRuleOverride `json:"rules,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_managedruleoverride.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_managedruleoverride.go deleted file mode 100644 index 13c802967f7c..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_managedruleoverride.go +++ /dev/null @@ -1,8 +0,0 @@ -package webapplicationfirewallpolicies - -type ManagedRuleOverride struct { - Action *ActionType `json:"action,omitempty"` - EnabledState *ManagedRuleEnabledState `json:"enabledState,omitempty"` - Exclusions *[]ManagedRuleExclusion `json:"exclusions,omitempty"` - RuleId string `json:"ruleId"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_managedruleset.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_managedruleset.go deleted file mode 100644 index 5c189e1682cf..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_managedruleset.go +++ /dev/null @@ -1,8 +0,0 @@ -package webapplicationfirewallpolicies - -type ManagedRuleSet struct { - Exclusions *[]ManagedRuleExclusion `json:"exclusions,omitempty"` - RuleGroupOverrides *[]ManagedRuleGroupOverride `json:"ruleGroupOverrides,omitempty"` - RuleSetType string `json:"ruleSetType"` - RuleSetVersion string `json:"ruleSetVersion"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_managedrulesetlist.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_managedrulesetlist.go deleted file mode 100644 index 3854af47f477..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_managedrulesetlist.go +++ /dev/null @@ -1,5 +0,0 @@ -package webapplicationfirewallpolicies - -type ManagedRuleSetList struct { - ManagedRuleSets *[]ManagedRuleSet `json:"managedRuleSets,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_matchcondition.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_matchcondition.go deleted file mode 100644 index 8367cdfbd1e0..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_matchcondition.go +++ /dev/null @@ -1,10 +0,0 @@ -package webapplicationfirewallpolicies - -type MatchCondition struct { - MatchValue []string `json:"matchValue"` - MatchVariable MatchVariable `json:"matchVariable"` - NegateCondition *bool `json:"negateCondition,omitempty"` - Operator Operator `json:"operator"` - Selector *string `json:"selector,omitempty"` - Transforms *[]TransformType `json:"transforms,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_routingrulelink.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_routingrulelink.go deleted file mode 100644 index 489f483582f3..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_routingrulelink.go +++ /dev/null @@ -1,5 +0,0 @@ -package webapplicationfirewallpolicies - -type RoutingRuleLink struct { - Id *string `json:"id,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/predicates.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/predicates.go deleted file mode 100644 index 77305e20e7e8..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/predicates.go +++ /dev/null @@ -1,33 +0,0 @@ -package webapplicationfirewallpolicies - -type WebApplicationFirewallPolicyPredicate struct { - Etag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p WebApplicationFirewallPolicyPredicate) Matches(input WebApplicationFirewallPolicy) bool { - if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { - return false - } - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/version.go b/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/version.go deleted file mode 100644 index 9e091fd03b7f..000000000000 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package webapplicationfirewallpolicies - -import "fmt" - -const defaultApiVersion = "2020-04-01" - -func userAgent() string { - return fmt.Sprintf("pandora/webapplicationfirewallpolicies/%s", defaultApiVersion) -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/client.go b/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/client.go deleted file mode 100644 index 95b02a18f167..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package checkfrontdoornameavailability - -import "github.com/Azure/go-autorest/autorest" - -type CheckFrontDoorNameAvailabilityClient struct { - Client autorest.Client - baseUri string -} - -func NewCheckFrontDoorNameAvailabilityClientWithBaseURI(endpoint string) CheckFrontDoorNameAvailabilityClient { - return CheckFrontDoorNameAvailabilityClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/constants.go b/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/constants.go deleted file mode 100644 index f4c99b983a8f..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/constants.go +++ /dev/null @@ -1,59 +0,0 @@ -package checkfrontdoornameavailability - -import "strings" - -type Availability string - -const ( - AvailabilityAvailable Availability = "Available" - AvailabilityUnavailable Availability = "Unavailable" -) - -func PossibleValuesForAvailability() []string { - return []string{ - string(AvailabilityAvailable), - string(AvailabilityUnavailable), - } -} - -func parseAvailability(input string) (*Availability, error) { - vals := map[string]Availability{ - "available": AvailabilityAvailable, - "unavailable": AvailabilityUnavailable, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Availability(input) - return &out, nil -} - -type ResourceType string - -const ( - ResourceTypeMicrosoftPointNetworkFrontDoors ResourceType = "Microsoft.Network/frontDoors" - ResourceTypeMicrosoftPointNetworkFrontDoorsFrontendEndpoints ResourceType = "Microsoft.Network/frontDoors/frontendEndpoints" -) - -func PossibleValuesForResourceType() []string { - return []string{ - string(ResourceTypeMicrosoftPointNetworkFrontDoors), - string(ResourceTypeMicrosoftPointNetworkFrontDoorsFrontendEndpoints), - } -} - -func parseResourceType(input string) (*ResourceType, error) { - vals := map[string]ResourceType{ - "microsoft.network/frontdoors": ResourceTypeMicrosoftPointNetworkFrontDoors, - "microsoft.network/frontdoors/frontendendpoints": ResourceTypeMicrosoftPointNetworkFrontDoorsFrontendEndpoints, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ResourceType(input) - return &out, nil -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/method_frontdoornameavailabilitycheck_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/method_frontdoornameavailabilitycheck_autorest.go deleted file mode 100644 index 2ec1ddb98fa6..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/method_frontdoornameavailabilitycheck_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package checkfrontdoornameavailability - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type FrontDoorNameAvailabilityCheckResponse struct { - HttpResponse *http.Response - Model *CheckNameAvailabilityOutput -} - -// FrontDoorNameAvailabilityCheck ... -func (c CheckFrontDoorNameAvailabilityClient) FrontDoorNameAvailabilityCheck(ctx context.Context, input CheckNameAvailabilityInput) (result FrontDoorNameAvailabilityCheckResponse, err error) { - req, err := c.preparerForFrontDoorNameAvailabilityCheck(ctx, input) - if err != nil { - err = autorest.NewErrorWithError(err, "checkfrontdoornameavailability.CheckFrontDoorNameAvailabilityClient", "FrontDoorNameAvailabilityCheck", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "checkfrontdoornameavailability.CheckFrontDoorNameAvailabilityClient", "FrontDoorNameAvailabilityCheck", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForFrontDoorNameAvailabilityCheck(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "checkfrontdoornameavailability.CheckFrontDoorNameAvailabilityClient", "FrontDoorNameAvailabilityCheck", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForFrontDoorNameAvailabilityCheck prepares the FrontDoorNameAvailabilityCheck request. -func (c CheckFrontDoorNameAvailabilityClient) preparerForFrontDoorNameAvailabilityCheck(ctx context.Context, input CheckNameAvailabilityInput) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath("/providers/Microsoft.Network/checkFrontDoorNameAvailability"), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForFrontDoorNameAvailabilityCheck handles the response to the FrontDoorNameAvailabilityCheck request. The method always -// closes the http.Response Body. -func (c CheckFrontDoorNameAvailabilityClient) responderForFrontDoorNameAvailabilityCheck(resp *http.Response) (result FrontDoorNameAvailabilityCheckResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/model_checknameavailabilityinput.go b/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/model_checknameavailabilityinput.go deleted file mode 100644 index de48eb19e8a5..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/model_checknameavailabilityinput.go +++ /dev/null @@ -1,6 +0,0 @@ -package checkfrontdoornameavailability - -type CheckNameAvailabilityInput struct { - Name string `json:"name"` - Type ResourceType `json:"type"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/model_checknameavailabilityoutput.go b/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/model_checknameavailabilityoutput.go deleted file mode 100644 index 0ee315119f9b..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/model_checknameavailabilityoutput.go +++ /dev/null @@ -1,7 +0,0 @@ -package checkfrontdoornameavailability - -type CheckNameAvailabilityOutput struct { - Message *string `json:"message,omitempty"` - NameAvailability *Availability `json:"nameAvailability,omitempty"` - Reason *string `json:"reason,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/version.go b/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/version.go deleted file mode 100644 index 9c8a85c8a203..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailability/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package checkfrontdoornameavailability - -import "fmt" - -const defaultApiVersion = "2020-05-01" - -func userAgent() string { - return fmt.Sprintf("pandora/checkfrontdoornameavailability/%s", defaultApiVersion) -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/client.go b/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/client.go deleted file mode 100644 index 3ae59d9f6fd8..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -import "github.com/Azure/go-autorest/autorest" - -type CheckFrontDoorNameAvailabilityWithSubscriptionClient struct { - Client autorest.Client - baseUri string -} - -func NewCheckFrontDoorNameAvailabilityWithSubscriptionClientWithBaseURI(endpoint string) CheckFrontDoorNameAvailabilityWithSubscriptionClient { - return CheckFrontDoorNameAvailabilityWithSubscriptionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/constants.go b/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/constants.go deleted file mode 100644 index 469d32e40633..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/constants.go +++ /dev/null @@ -1,59 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -import "strings" - -type Availability string - -const ( - AvailabilityAvailable Availability = "Available" - AvailabilityUnavailable Availability = "Unavailable" -) - -func PossibleValuesForAvailability() []string { - return []string{ - string(AvailabilityAvailable), - string(AvailabilityUnavailable), - } -} - -func parseAvailability(input string) (*Availability, error) { - vals := map[string]Availability{ - "available": AvailabilityAvailable, - "unavailable": AvailabilityUnavailable, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Availability(input) - return &out, nil -} - -type ResourceType string - -const ( - ResourceTypeMicrosoftPointNetworkFrontDoors ResourceType = "Microsoft.Network/frontDoors" - ResourceTypeMicrosoftPointNetworkFrontDoorsFrontendEndpoints ResourceType = "Microsoft.Network/frontDoors/frontendEndpoints" -) - -func PossibleValuesForResourceType() []string { - return []string{ - string(ResourceTypeMicrosoftPointNetworkFrontDoors), - string(ResourceTypeMicrosoftPointNetworkFrontDoorsFrontendEndpoints), - } -} - -func parseResourceType(input string) (*ResourceType, error) { - vals := map[string]ResourceType{ - "microsoft.network/frontdoors": ResourceTypeMicrosoftPointNetworkFrontDoors, - "microsoft.network/frontdoors/frontendendpoints": ResourceTypeMicrosoftPointNetworkFrontDoorsFrontendEndpoints, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ResourceType(input) - return &out, nil -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/id_subscription.go b/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/id_subscription.go deleted file mode 100644 index 42dcc9dc68f1..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/id_subscription_test.go b/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/id_subscription_test.go deleted file mode 100644 index 46c40b46981e..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/id_subscription_test.go +++ /dev/null @@ -1,157 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -func TestNewSubscriptionID(t *testing.T) { - id := NewSubscriptionID("12345678-1234-9876-4563-123456789012") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } -} - -func TestFormatSubscriptionID(t *testing.T) { - actual := NewSubscriptionID("12345678-1234-9876-4563-123456789012").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSubscriptionID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubscriptionId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Expected: &SubscriptionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubscriptionID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - } -} - -func TestParseSubscriptionIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubscriptionId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Expected: &SubscriptionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Expected: &SubscriptionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubscriptionIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - } -} - -func TestSegmentsForSubscriptionId(t *testing.T) { - segments := SubscriptionId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SubscriptionId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/method_frontdoornameavailabilitywithsubscriptioncheck_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/method_frontdoornameavailabilitywithsubscriptioncheck_autorest.go deleted file mode 100644 index cffcf10b665a..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/method_frontdoornameavailabilitywithsubscriptioncheck_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type FrontDoorNameAvailabilityWithSubscriptionCheckResponse struct { - HttpResponse *http.Response - Model *CheckNameAvailabilityOutput -} - -// FrontDoorNameAvailabilityWithSubscriptionCheck ... -func (c CheckFrontDoorNameAvailabilityWithSubscriptionClient) FrontDoorNameAvailabilityWithSubscriptionCheck(ctx context.Context, id SubscriptionId, input CheckNameAvailabilityInput) (result FrontDoorNameAvailabilityWithSubscriptionCheckResponse, err error) { - req, err := c.preparerForFrontDoorNameAvailabilityWithSubscriptionCheck(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "checkfrontdoornameavailabilitywithsubscription.CheckFrontDoorNameAvailabilityWithSubscriptionClient", "FrontDoorNameAvailabilityWithSubscriptionCheck", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "checkfrontdoornameavailabilitywithsubscription.CheckFrontDoorNameAvailabilityWithSubscriptionClient", "FrontDoorNameAvailabilityWithSubscriptionCheck", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForFrontDoorNameAvailabilityWithSubscriptionCheck(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "checkfrontdoornameavailabilitywithsubscription.CheckFrontDoorNameAvailabilityWithSubscriptionClient", "FrontDoorNameAvailabilityWithSubscriptionCheck", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForFrontDoorNameAvailabilityWithSubscriptionCheck prepares the FrontDoorNameAvailabilityWithSubscriptionCheck request. -func (c CheckFrontDoorNameAvailabilityWithSubscriptionClient) preparerForFrontDoorNameAvailabilityWithSubscriptionCheck(ctx context.Context, id SubscriptionId, input CheckNameAvailabilityInput) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/checkFrontDoorNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForFrontDoorNameAvailabilityWithSubscriptionCheck handles the response to the FrontDoorNameAvailabilityWithSubscriptionCheck request. The method always -// closes the http.Response Body. -func (c CheckFrontDoorNameAvailabilityWithSubscriptionClient) responderForFrontDoorNameAvailabilityWithSubscriptionCheck(resp *http.Response) (result FrontDoorNameAvailabilityWithSubscriptionCheckResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/model_checknameavailabilityinput.go b/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/model_checknameavailabilityinput.go deleted file mode 100644 index 1fa4f886526c..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/model_checknameavailabilityinput.go +++ /dev/null @@ -1,6 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -type CheckNameAvailabilityInput struct { - Name string `json:"name"` - Type ResourceType `json:"type"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/model_checknameavailabilityoutput.go b/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/model_checknameavailabilityoutput.go deleted file mode 100644 index 9455862d3db3..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/model_checknameavailabilityoutput.go +++ /dev/null @@ -1,7 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -type CheckNameAvailabilityOutput struct { - Message *string `json:"message,omitempty"` - NameAvailability *Availability `json:"nameAvailability,omitempty"` - Reason *string `json:"reason,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/version.go b/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/version.go deleted file mode 100644 index 850f42d8776e..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/checkfrontdoornameavailabilitywithsubscription/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package checkfrontdoornameavailabilitywithsubscription - -import "fmt" - -const defaultApiVersion = "2020-05-01" - -func userAgent() string { - return fmt.Sprintf("pandora/checkfrontdoornameavailabilitywithsubscription/%s", defaultApiVersion) -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/client.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/client.go deleted file mode 100644 index 1978104f9ee7..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package frontdoors - -import "github.com/Azure/go-autorest/autorest" - -type FrontDoorsClient struct { - Client autorest.Client - baseUri string -} - -func NewFrontDoorsClientWithBaseURI(endpoint string) FrontDoorsClient { - return FrontDoorsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/constants.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/constants.go deleted file mode 100644 index 3a3320e6731c..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/constants.go +++ /dev/null @@ -1,869 +0,0 @@ -package frontdoors - -import "strings" - -type BackendEnabledState string - -const ( - BackendEnabledStateDisabled BackendEnabledState = "Disabled" - BackendEnabledStateEnabled BackendEnabledState = "Enabled" -) - -func PossibleValuesForBackendEnabledState() []string { - return []string{ - string(BackendEnabledStateDisabled), - string(BackendEnabledStateEnabled), - } -} - -func parseBackendEnabledState(input string) (*BackendEnabledState, error) { - vals := map[string]BackendEnabledState{ - "disabled": BackendEnabledStateDisabled, - "enabled": BackendEnabledStateEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := BackendEnabledState(input) - return &out, nil -} - -type CustomHttpsProvisioningState string - -const ( - CustomHttpsProvisioningStateDisabled CustomHttpsProvisioningState = "Disabled" - CustomHttpsProvisioningStateDisabling CustomHttpsProvisioningState = "Disabling" - CustomHttpsProvisioningStateEnabled CustomHttpsProvisioningState = "Enabled" - CustomHttpsProvisioningStateEnabling CustomHttpsProvisioningState = "Enabling" - CustomHttpsProvisioningStateFailed CustomHttpsProvisioningState = "Failed" -) - -func PossibleValuesForCustomHttpsProvisioningState() []string { - return []string{ - string(CustomHttpsProvisioningStateDisabled), - string(CustomHttpsProvisioningStateDisabling), - string(CustomHttpsProvisioningStateEnabled), - string(CustomHttpsProvisioningStateEnabling), - string(CustomHttpsProvisioningStateFailed), - } -} - -func parseCustomHttpsProvisioningState(input string) (*CustomHttpsProvisioningState, error) { - vals := map[string]CustomHttpsProvisioningState{ - "disabled": CustomHttpsProvisioningStateDisabled, - "disabling": CustomHttpsProvisioningStateDisabling, - "enabled": CustomHttpsProvisioningStateEnabled, - "enabling": CustomHttpsProvisioningStateEnabling, - "failed": CustomHttpsProvisioningStateFailed, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CustomHttpsProvisioningState(input) - return &out, nil -} - -type CustomHttpsProvisioningSubstate string - -const ( - CustomHttpsProvisioningSubstateCertificateDeleted CustomHttpsProvisioningSubstate = "CertificateDeleted" - CustomHttpsProvisioningSubstateCertificateDeployed CustomHttpsProvisioningSubstate = "CertificateDeployed" - CustomHttpsProvisioningSubstateDeletingCertificate CustomHttpsProvisioningSubstate = "DeletingCertificate" - CustomHttpsProvisioningSubstateDeployingCertificate CustomHttpsProvisioningSubstate = "DeployingCertificate" - CustomHttpsProvisioningSubstateDomainControlValidationRequestApproved CustomHttpsProvisioningSubstate = "DomainControlValidationRequestApproved" - CustomHttpsProvisioningSubstateDomainControlValidationRequestRejected CustomHttpsProvisioningSubstate = "DomainControlValidationRequestRejected" - CustomHttpsProvisioningSubstateDomainControlValidationRequestTimedOut CustomHttpsProvisioningSubstate = "DomainControlValidationRequestTimedOut" - CustomHttpsProvisioningSubstateIssuingCertificate CustomHttpsProvisioningSubstate = "IssuingCertificate" - CustomHttpsProvisioningSubstatePendingDomainControlValidationREquestApproval CustomHttpsProvisioningSubstate = "PendingDomainControlValidationREquestApproval" - CustomHttpsProvisioningSubstateSubmittingDomainControlValidationRequest CustomHttpsProvisioningSubstate = "SubmittingDomainControlValidationRequest" -) - -func PossibleValuesForCustomHttpsProvisioningSubstate() []string { - return []string{ - string(CustomHttpsProvisioningSubstateCertificateDeleted), - string(CustomHttpsProvisioningSubstateCertificateDeployed), - string(CustomHttpsProvisioningSubstateDeletingCertificate), - string(CustomHttpsProvisioningSubstateDeployingCertificate), - string(CustomHttpsProvisioningSubstateDomainControlValidationRequestApproved), - string(CustomHttpsProvisioningSubstateDomainControlValidationRequestRejected), - string(CustomHttpsProvisioningSubstateDomainControlValidationRequestTimedOut), - string(CustomHttpsProvisioningSubstateIssuingCertificate), - string(CustomHttpsProvisioningSubstatePendingDomainControlValidationREquestApproval), - string(CustomHttpsProvisioningSubstateSubmittingDomainControlValidationRequest), - } -} - -func parseCustomHttpsProvisioningSubstate(input string) (*CustomHttpsProvisioningSubstate, error) { - vals := map[string]CustomHttpsProvisioningSubstate{ - "certificatedeleted": CustomHttpsProvisioningSubstateCertificateDeleted, - "certificatedeployed": CustomHttpsProvisioningSubstateCertificateDeployed, - "deletingcertificate": CustomHttpsProvisioningSubstateDeletingCertificate, - "deployingcertificate": CustomHttpsProvisioningSubstateDeployingCertificate, - "domaincontrolvalidationrequestapproved": CustomHttpsProvisioningSubstateDomainControlValidationRequestApproved, - "domaincontrolvalidationrequestrejected": CustomHttpsProvisioningSubstateDomainControlValidationRequestRejected, - "domaincontrolvalidationrequesttimedout": CustomHttpsProvisioningSubstateDomainControlValidationRequestTimedOut, - "issuingcertificate": CustomHttpsProvisioningSubstateIssuingCertificate, - "pendingdomaincontrolvalidationrequestapproval": CustomHttpsProvisioningSubstatePendingDomainControlValidationREquestApproval, - "submittingdomaincontrolvalidationrequest": CustomHttpsProvisioningSubstateSubmittingDomainControlValidationRequest, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CustomHttpsProvisioningSubstate(input) - return &out, nil -} - -type DynamicCompressionEnabled string - -const ( - DynamicCompressionEnabledDisabled DynamicCompressionEnabled = "Disabled" - DynamicCompressionEnabledEnabled DynamicCompressionEnabled = "Enabled" -) - -func PossibleValuesForDynamicCompressionEnabled() []string { - return []string{ - string(DynamicCompressionEnabledDisabled), - string(DynamicCompressionEnabledEnabled), - } -} - -func parseDynamicCompressionEnabled(input string) (*DynamicCompressionEnabled, error) { - vals := map[string]DynamicCompressionEnabled{ - "disabled": DynamicCompressionEnabledDisabled, - "enabled": DynamicCompressionEnabledEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DynamicCompressionEnabled(input) - return &out, nil -} - -type EnforceCertificateNameCheckEnabledState string - -const ( - EnforceCertificateNameCheckEnabledStateDisabled EnforceCertificateNameCheckEnabledState = "Disabled" - EnforceCertificateNameCheckEnabledStateEnabled EnforceCertificateNameCheckEnabledState = "Enabled" -) - -func PossibleValuesForEnforceCertificateNameCheckEnabledState() []string { - return []string{ - string(EnforceCertificateNameCheckEnabledStateDisabled), - string(EnforceCertificateNameCheckEnabledStateEnabled), - } -} - -func parseEnforceCertificateNameCheckEnabledState(input string) (*EnforceCertificateNameCheckEnabledState, error) { - vals := map[string]EnforceCertificateNameCheckEnabledState{ - "disabled": EnforceCertificateNameCheckEnabledStateDisabled, - "enabled": EnforceCertificateNameCheckEnabledStateEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EnforceCertificateNameCheckEnabledState(input) - return &out, nil -} - -type FrontDoorCertificateSource string - -const ( - FrontDoorCertificateSourceAzureKeyVault FrontDoorCertificateSource = "AzureKeyVault" - FrontDoorCertificateSourceFrontDoor FrontDoorCertificateSource = "FrontDoor" -) - -func PossibleValuesForFrontDoorCertificateSource() []string { - return []string{ - string(FrontDoorCertificateSourceAzureKeyVault), - string(FrontDoorCertificateSourceFrontDoor), - } -} - -func parseFrontDoorCertificateSource(input string) (*FrontDoorCertificateSource, error) { - vals := map[string]FrontDoorCertificateSource{ - "azurekeyvault": FrontDoorCertificateSourceAzureKeyVault, - "frontdoor": FrontDoorCertificateSourceFrontDoor, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorCertificateSource(input) - return &out, nil -} - -type FrontDoorCertificateType string - -const ( - FrontDoorCertificateTypeDedicated FrontDoorCertificateType = "Dedicated" -) - -func PossibleValuesForFrontDoorCertificateType() []string { - return []string{ - string(FrontDoorCertificateTypeDedicated), - } -} - -func parseFrontDoorCertificateType(input string) (*FrontDoorCertificateType, error) { - vals := map[string]FrontDoorCertificateType{ - "dedicated": FrontDoorCertificateTypeDedicated, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorCertificateType(input) - return &out, nil -} - -type FrontDoorEnabledState string - -const ( - FrontDoorEnabledStateDisabled FrontDoorEnabledState = "Disabled" - FrontDoorEnabledStateEnabled FrontDoorEnabledState = "Enabled" -) - -func PossibleValuesForFrontDoorEnabledState() []string { - return []string{ - string(FrontDoorEnabledStateDisabled), - string(FrontDoorEnabledStateEnabled), - } -} - -func parseFrontDoorEnabledState(input string) (*FrontDoorEnabledState, error) { - vals := map[string]FrontDoorEnabledState{ - "disabled": FrontDoorEnabledStateDisabled, - "enabled": FrontDoorEnabledStateEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorEnabledState(input) - return &out, nil -} - -type FrontDoorForwardingProtocol string - -const ( - FrontDoorForwardingProtocolHttpOnly FrontDoorForwardingProtocol = "HttpOnly" - FrontDoorForwardingProtocolHttpsOnly FrontDoorForwardingProtocol = "HttpsOnly" - FrontDoorForwardingProtocolMatchRequest FrontDoorForwardingProtocol = "MatchRequest" -) - -func PossibleValuesForFrontDoorForwardingProtocol() []string { - return []string{ - string(FrontDoorForwardingProtocolHttpOnly), - string(FrontDoorForwardingProtocolHttpsOnly), - string(FrontDoorForwardingProtocolMatchRequest), - } -} - -func parseFrontDoorForwardingProtocol(input string) (*FrontDoorForwardingProtocol, error) { - vals := map[string]FrontDoorForwardingProtocol{ - "httponly": FrontDoorForwardingProtocolHttpOnly, - "httpsonly": FrontDoorForwardingProtocolHttpsOnly, - "matchrequest": FrontDoorForwardingProtocolMatchRequest, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorForwardingProtocol(input) - return &out, nil -} - -type FrontDoorHealthProbeMethod string - -const ( - FrontDoorHealthProbeMethodGET FrontDoorHealthProbeMethod = "GET" - FrontDoorHealthProbeMethodHEAD FrontDoorHealthProbeMethod = "HEAD" -) - -func PossibleValuesForFrontDoorHealthProbeMethod() []string { - return []string{ - string(FrontDoorHealthProbeMethodGET), - string(FrontDoorHealthProbeMethodHEAD), - } -} - -func parseFrontDoorHealthProbeMethod(input string) (*FrontDoorHealthProbeMethod, error) { - vals := map[string]FrontDoorHealthProbeMethod{ - "get": FrontDoorHealthProbeMethodGET, - "head": FrontDoorHealthProbeMethodHEAD, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorHealthProbeMethod(input) - return &out, nil -} - -type FrontDoorProtocol string - -const ( - FrontDoorProtocolHttp FrontDoorProtocol = "Http" - FrontDoorProtocolHttps FrontDoorProtocol = "Https" -) - -func PossibleValuesForFrontDoorProtocol() []string { - return []string{ - string(FrontDoorProtocolHttp), - string(FrontDoorProtocolHttps), - } -} - -func parseFrontDoorProtocol(input string) (*FrontDoorProtocol, error) { - vals := map[string]FrontDoorProtocol{ - "http": FrontDoorProtocolHttp, - "https": FrontDoorProtocolHttps, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorProtocol(input) - return &out, nil -} - -type FrontDoorQuery string - -const ( - FrontDoorQueryStripAll FrontDoorQuery = "StripAll" - FrontDoorQueryStripAllExcept FrontDoorQuery = "StripAllExcept" - FrontDoorQueryStripNone FrontDoorQuery = "StripNone" - FrontDoorQueryStripOnly FrontDoorQuery = "StripOnly" -) - -func PossibleValuesForFrontDoorQuery() []string { - return []string{ - string(FrontDoorQueryStripAll), - string(FrontDoorQueryStripAllExcept), - string(FrontDoorQueryStripNone), - string(FrontDoorQueryStripOnly), - } -} - -func parseFrontDoorQuery(input string) (*FrontDoorQuery, error) { - vals := map[string]FrontDoorQuery{ - "stripall": FrontDoorQueryStripAll, - "stripallexcept": FrontDoorQueryStripAllExcept, - "stripnone": FrontDoorQueryStripNone, - "striponly": FrontDoorQueryStripOnly, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorQuery(input) - return &out, nil -} - -type FrontDoorRedirectProtocol string - -const ( - FrontDoorRedirectProtocolHttpOnly FrontDoorRedirectProtocol = "HttpOnly" - FrontDoorRedirectProtocolHttpsOnly FrontDoorRedirectProtocol = "HttpsOnly" - FrontDoorRedirectProtocolMatchRequest FrontDoorRedirectProtocol = "MatchRequest" -) - -func PossibleValuesForFrontDoorRedirectProtocol() []string { - return []string{ - string(FrontDoorRedirectProtocolHttpOnly), - string(FrontDoorRedirectProtocolHttpsOnly), - string(FrontDoorRedirectProtocolMatchRequest), - } -} - -func parseFrontDoorRedirectProtocol(input string) (*FrontDoorRedirectProtocol, error) { - vals := map[string]FrontDoorRedirectProtocol{ - "httponly": FrontDoorRedirectProtocolHttpOnly, - "httpsonly": FrontDoorRedirectProtocolHttpsOnly, - "matchrequest": FrontDoorRedirectProtocolMatchRequest, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorRedirectProtocol(input) - return &out, nil -} - -type FrontDoorRedirectType string - -const ( - FrontDoorRedirectTypeFound FrontDoorRedirectType = "Found" - FrontDoorRedirectTypeMoved FrontDoorRedirectType = "Moved" - FrontDoorRedirectTypePermanentRedirect FrontDoorRedirectType = "PermanentRedirect" - FrontDoorRedirectTypeTemporaryRedirect FrontDoorRedirectType = "TemporaryRedirect" -) - -func PossibleValuesForFrontDoorRedirectType() []string { - return []string{ - string(FrontDoorRedirectTypeFound), - string(FrontDoorRedirectTypeMoved), - string(FrontDoorRedirectTypePermanentRedirect), - string(FrontDoorRedirectTypeTemporaryRedirect), - } -} - -func parseFrontDoorRedirectType(input string) (*FrontDoorRedirectType, error) { - vals := map[string]FrontDoorRedirectType{ - "found": FrontDoorRedirectTypeFound, - "moved": FrontDoorRedirectTypeMoved, - "permanentredirect": FrontDoorRedirectTypePermanentRedirect, - "temporaryredirect": FrontDoorRedirectTypeTemporaryRedirect, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorRedirectType(input) - return &out, nil -} - -type FrontDoorResourceState string - -const ( - FrontDoorResourceStateCreating FrontDoorResourceState = "Creating" - FrontDoorResourceStateDeleting FrontDoorResourceState = "Deleting" - FrontDoorResourceStateDisabled FrontDoorResourceState = "Disabled" - FrontDoorResourceStateDisabling FrontDoorResourceState = "Disabling" - FrontDoorResourceStateEnabled FrontDoorResourceState = "Enabled" - FrontDoorResourceStateEnabling FrontDoorResourceState = "Enabling" -) - -func PossibleValuesForFrontDoorResourceState() []string { - return []string{ - string(FrontDoorResourceStateCreating), - string(FrontDoorResourceStateDeleting), - string(FrontDoorResourceStateDisabled), - string(FrontDoorResourceStateDisabling), - string(FrontDoorResourceStateEnabled), - string(FrontDoorResourceStateEnabling), - } -} - -func parseFrontDoorResourceState(input string) (*FrontDoorResourceState, error) { - vals := map[string]FrontDoorResourceState{ - "creating": FrontDoorResourceStateCreating, - "deleting": FrontDoorResourceStateDeleting, - "disabled": FrontDoorResourceStateDisabled, - "disabling": FrontDoorResourceStateDisabling, - "enabled": FrontDoorResourceStateEnabled, - "enabling": FrontDoorResourceStateEnabling, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorResourceState(input) - return &out, nil -} - -type FrontDoorTlsProtocolType string - -const ( - FrontDoorTlsProtocolTypeServerNameIndication FrontDoorTlsProtocolType = "ServerNameIndication" -) - -func PossibleValuesForFrontDoorTlsProtocolType() []string { - return []string{ - string(FrontDoorTlsProtocolTypeServerNameIndication), - } -} - -func parseFrontDoorTlsProtocolType(input string) (*FrontDoorTlsProtocolType, error) { - vals := map[string]FrontDoorTlsProtocolType{ - "servernameindication": FrontDoorTlsProtocolTypeServerNameIndication, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FrontDoorTlsProtocolType(input) - return &out, nil -} - -type HeaderActionType string - -const ( - HeaderActionTypeAppend HeaderActionType = "Append" - HeaderActionTypeDelete HeaderActionType = "Delete" - HeaderActionTypeOverwrite HeaderActionType = "Overwrite" -) - -func PossibleValuesForHeaderActionType() []string { - return []string{ - string(HeaderActionTypeAppend), - string(HeaderActionTypeDelete), - string(HeaderActionTypeOverwrite), - } -} - -func parseHeaderActionType(input string) (*HeaderActionType, error) { - vals := map[string]HeaderActionType{ - "append": HeaderActionTypeAppend, - "delete": HeaderActionTypeDelete, - "overwrite": HeaderActionTypeOverwrite, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := HeaderActionType(input) - return &out, nil -} - -type HealthProbeEnabled string - -const ( - HealthProbeEnabledDisabled HealthProbeEnabled = "Disabled" - HealthProbeEnabledEnabled HealthProbeEnabled = "Enabled" -) - -func PossibleValuesForHealthProbeEnabled() []string { - return []string{ - string(HealthProbeEnabledDisabled), - string(HealthProbeEnabledEnabled), - } -} - -func parseHealthProbeEnabled(input string) (*HealthProbeEnabled, error) { - vals := map[string]HealthProbeEnabled{ - "disabled": HealthProbeEnabledDisabled, - "enabled": HealthProbeEnabledEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := HealthProbeEnabled(input) - return &out, nil -} - -type MatchProcessingBehavior string - -const ( - MatchProcessingBehaviorContinue MatchProcessingBehavior = "Continue" - MatchProcessingBehaviorStop MatchProcessingBehavior = "Stop" -) - -func PossibleValuesForMatchProcessingBehavior() []string { - return []string{ - string(MatchProcessingBehaviorContinue), - string(MatchProcessingBehaviorStop), - } -} - -func parseMatchProcessingBehavior(input string) (*MatchProcessingBehavior, error) { - vals := map[string]MatchProcessingBehavior{ - "continue": MatchProcessingBehaviorContinue, - "stop": MatchProcessingBehaviorStop, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := MatchProcessingBehavior(input) - return &out, nil -} - -type MinimumTLSVersion string - -const ( - MinimumTLSVersionOnePointTwo MinimumTLSVersion = "1.2" - MinimumTLSVersionOnePointZero MinimumTLSVersion = "1.0" -) - -func PossibleValuesForMinimumTLSVersion() []string { - return []string{ - string(MinimumTLSVersionOnePointTwo), - string(MinimumTLSVersionOnePointZero), - } -} - -func parseMinimumTLSVersion(input string) (*MinimumTLSVersion, error) { - vals := map[string]MinimumTLSVersion{ - "1.2": MinimumTLSVersionOnePointTwo, - "1.0": MinimumTLSVersionOnePointZero, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := MinimumTLSVersion(input) - return &out, nil -} - -type PrivateEndpointStatus string - -const ( - PrivateEndpointStatusApproved PrivateEndpointStatus = "Approved" - PrivateEndpointStatusDisconnected PrivateEndpointStatus = "Disconnected" - PrivateEndpointStatusPending PrivateEndpointStatus = "Pending" - PrivateEndpointStatusRejected PrivateEndpointStatus = "Rejected" - PrivateEndpointStatusTimeout PrivateEndpointStatus = "Timeout" -) - -func PossibleValuesForPrivateEndpointStatus() []string { - return []string{ - string(PrivateEndpointStatusApproved), - string(PrivateEndpointStatusDisconnected), - string(PrivateEndpointStatusPending), - string(PrivateEndpointStatusRejected), - string(PrivateEndpointStatusTimeout), - } -} - -func parsePrivateEndpointStatus(input string) (*PrivateEndpointStatus, error) { - vals := map[string]PrivateEndpointStatus{ - "approved": PrivateEndpointStatusApproved, - "disconnected": PrivateEndpointStatusDisconnected, - "pending": PrivateEndpointStatusPending, - "rejected": PrivateEndpointStatusRejected, - "timeout": PrivateEndpointStatusTimeout, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PrivateEndpointStatus(input) - return &out, nil -} - -type RoutingRuleEnabledState string - -const ( - RoutingRuleEnabledStateDisabled RoutingRuleEnabledState = "Disabled" - RoutingRuleEnabledStateEnabled RoutingRuleEnabledState = "Enabled" -) - -func PossibleValuesForRoutingRuleEnabledState() []string { - return []string{ - string(RoutingRuleEnabledStateDisabled), - string(RoutingRuleEnabledStateEnabled), - } -} - -func parseRoutingRuleEnabledState(input string) (*RoutingRuleEnabledState, error) { - vals := map[string]RoutingRuleEnabledState{ - "disabled": RoutingRuleEnabledStateDisabled, - "enabled": RoutingRuleEnabledStateEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RoutingRuleEnabledState(input) - return &out, nil -} - -type RulesEngineMatchVariable string - -const ( - RulesEngineMatchVariableIsMobile RulesEngineMatchVariable = "IsMobile" - RulesEngineMatchVariablePostArgs RulesEngineMatchVariable = "PostArgs" - RulesEngineMatchVariableQueryString RulesEngineMatchVariable = "QueryString" - RulesEngineMatchVariableRemoteAddr RulesEngineMatchVariable = "RemoteAddr" - RulesEngineMatchVariableRequestBody RulesEngineMatchVariable = "RequestBody" - RulesEngineMatchVariableRequestFilename RulesEngineMatchVariable = "RequestFilename" - RulesEngineMatchVariableRequestFilenameExtension RulesEngineMatchVariable = "RequestFilenameExtension" - RulesEngineMatchVariableRequestHeader RulesEngineMatchVariable = "RequestHeader" - RulesEngineMatchVariableRequestMethod RulesEngineMatchVariable = "RequestMethod" - RulesEngineMatchVariableRequestPath RulesEngineMatchVariable = "RequestPath" - RulesEngineMatchVariableRequestScheme RulesEngineMatchVariable = "RequestScheme" - RulesEngineMatchVariableRequestUri RulesEngineMatchVariable = "RequestUri" -) - -func PossibleValuesForRulesEngineMatchVariable() []string { - return []string{ - string(RulesEngineMatchVariableIsMobile), - string(RulesEngineMatchVariablePostArgs), - string(RulesEngineMatchVariableQueryString), - string(RulesEngineMatchVariableRemoteAddr), - string(RulesEngineMatchVariableRequestBody), - string(RulesEngineMatchVariableRequestFilename), - string(RulesEngineMatchVariableRequestFilenameExtension), - string(RulesEngineMatchVariableRequestHeader), - string(RulesEngineMatchVariableRequestMethod), - string(RulesEngineMatchVariableRequestPath), - string(RulesEngineMatchVariableRequestScheme), - string(RulesEngineMatchVariableRequestUri), - } -} - -func parseRulesEngineMatchVariable(input string) (*RulesEngineMatchVariable, error) { - vals := map[string]RulesEngineMatchVariable{ - "ismobile": RulesEngineMatchVariableIsMobile, - "postargs": RulesEngineMatchVariablePostArgs, - "querystring": RulesEngineMatchVariableQueryString, - "remoteaddr": RulesEngineMatchVariableRemoteAddr, - "requestbody": RulesEngineMatchVariableRequestBody, - "requestfilename": RulesEngineMatchVariableRequestFilename, - "requestfilenameextension": RulesEngineMatchVariableRequestFilenameExtension, - "requestheader": RulesEngineMatchVariableRequestHeader, - "requestmethod": RulesEngineMatchVariableRequestMethod, - "requestpath": RulesEngineMatchVariableRequestPath, - "requestscheme": RulesEngineMatchVariableRequestScheme, - "requesturi": RulesEngineMatchVariableRequestUri, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RulesEngineMatchVariable(input) - return &out, nil -} - -type RulesEngineOperator string - -const ( - RulesEngineOperatorAny RulesEngineOperator = "Any" - RulesEngineOperatorBeginsWith RulesEngineOperator = "BeginsWith" - RulesEngineOperatorContains RulesEngineOperator = "Contains" - RulesEngineOperatorEndsWith RulesEngineOperator = "EndsWith" - RulesEngineOperatorEqual RulesEngineOperator = "Equal" - RulesEngineOperatorGeoMatch RulesEngineOperator = "GeoMatch" - RulesEngineOperatorGreaterThan RulesEngineOperator = "GreaterThan" - RulesEngineOperatorGreaterThanOrEqual RulesEngineOperator = "GreaterThanOrEqual" - RulesEngineOperatorIPMatch RulesEngineOperator = "IPMatch" - RulesEngineOperatorLessThan RulesEngineOperator = "LessThan" - RulesEngineOperatorLessThanOrEqual RulesEngineOperator = "LessThanOrEqual" -) - -func PossibleValuesForRulesEngineOperator() []string { - return []string{ - string(RulesEngineOperatorAny), - string(RulesEngineOperatorBeginsWith), - string(RulesEngineOperatorContains), - string(RulesEngineOperatorEndsWith), - string(RulesEngineOperatorEqual), - string(RulesEngineOperatorGeoMatch), - string(RulesEngineOperatorGreaterThan), - string(RulesEngineOperatorGreaterThanOrEqual), - string(RulesEngineOperatorIPMatch), - string(RulesEngineOperatorLessThan), - string(RulesEngineOperatorLessThanOrEqual), - } -} - -func parseRulesEngineOperator(input string) (*RulesEngineOperator, error) { - vals := map[string]RulesEngineOperator{ - "any": RulesEngineOperatorAny, - "beginswith": RulesEngineOperatorBeginsWith, - "contains": RulesEngineOperatorContains, - "endswith": RulesEngineOperatorEndsWith, - "equal": RulesEngineOperatorEqual, - "geomatch": RulesEngineOperatorGeoMatch, - "greaterthan": RulesEngineOperatorGreaterThan, - "greaterthanorequal": RulesEngineOperatorGreaterThanOrEqual, - "ipmatch": RulesEngineOperatorIPMatch, - "lessthan": RulesEngineOperatorLessThan, - "lessthanorequal": RulesEngineOperatorLessThanOrEqual, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RulesEngineOperator(input) - return &out, nil -} - -type SessionAffinityEnabledState string - -const ( - SessionAffinityEnabledStateDisabled SessionAffinityEnabledState = "Disabled" - SessionAffinityEnabledStateEnabled SessionAffinityEnabledState = "Enabled" -) - -func PossibleValuesForSessionAffinityEnabledState() []string { - return []string{ - string(SessionAffinityEnabledStateDisabled), - string(SessionAffinityEnabledStateEnabled), - } -} - -func parseSessionAffinityEnabledState(input string) (*SessionAffinityEnabledState, error) { - vals := map[string]SessionAffinityEnabledState{ - "disabled": SessionAffinityEnabledStateDisabled, - "enabled": SessionAffinityEnabledStateEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SessionAffinityEnabledState(input) - return &out, nil -} - -type Transform string - -const ( - TransformLowercase Transform = "Lowercase" - TransformRemoveNulls Transform = "RemoveNulls" - TransformTrim Transform = "Trim" - TransformUppercase Transform = "Uppercase" - TransformUrlDecode Transform = "UrlDecode" - TransformUrlEncode Transform = "UrlEncode" -) - -func PossibleValuesForTransform() []string { - return []string{ - string(TransformLowercase), - string(TransformRemoveNulls), - string(TransformTrim), - string(TransformUppercase), - string(TransformUrlDecode), - string(TransformUrlEncode), - } -} - -func parseTransform(input string) (*Transform, error) { - vals := map[string]Transform{ - "lowercase": TransformLowercase, - "removenulls": TransformRemoveNulls, - "trim": TransformTrim, - "uppercase": TransformUppercase, - "urldecode": TransformUrlDecode, - "urlencode": TransformUrlEncode, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Transform(input) - return &out, nil -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_frontdoor.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_frontdoor.go deleted file mode 100644 index 2c9f313c32a2..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_frontdoor.go +++ /dev/null @@ -1,124 +0,0 @@ -package frontdoors - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = FrontDoorId{} - -// FrontDoorId is a struct representing the Resource ID for a Front Door -type FrontDoorId struct { - SubscriptionId string - ResourceGroupName string - FrontDoorName string -} - -// NewFrontDoorID returns a new FrontDoorId struct -func NewFrontDoorID(subscriptionId string, resourceGroupName string, frontDoorName string) FrontDoorId { - return FrontDoorId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - FrontDoorName: frontDoorName, - } -} - -// ParseFrontDoorID parses 'input' into a FrontDoorId -func ParseFrontDoorID(input string) (*FrontDoorId, error) { - parser := resourceids.NewParserFromResourceIdType(FrontDoorId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FrontDoorId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, fmt.Errorf("the segment 'frontDoorName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseFrontDoorIDInsensitively parses 'input' case-insensitively into a FrontDoorId -// note: this method should only be used for API response data and not user input -func ParseFrontDoorIDInsensitively(input string) (*FrontDoorId, error) { - parser := resourceids.NewParserFromResourceIdType(FrontDoorId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FrontDoorId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, fmt.Errorf("the segment 'frontDoorName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateFrontDoorID checks that 'input' can be parsed as a Front Door ID -func ValidateFrontDoorID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseFrontDoorID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Front Door ID -func (id FrontDoorId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/frontDoors/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FrontDoorName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Front Door ID -func (id FrontDoorId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), - resourceids.StaticSegment("staticFrontDoors", "frontDoors", "frontDoors"), - resourceids.UserSpecifiedSegment("frontDoorName", "frontDoorValue"), - } -} - -// String returns a human-readable description of this Front Door ID -func (id FrontDoorId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Front Door Name: %q", id.FrontDoorName), - } - return fmt.Sprintf("Front Door (%s)", strings.Join(components, "\n")) -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_frontdoor_test.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_frontdoor_test.go deleted file mode 100644 index 7bdc4e966d6b..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_frontdoor_test.go +++ /dev/null @@ -1,277 +0,0 @@ -package frontdoors - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = FrontDoorId{} - -func TestNewFrontDoorID(t *testing.T) { - id := NewFrontDoorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.FrontDoorName != "frontDoorValue" { - t.Fatalf("Expected %q but got %q for Segment 'FrontDoorName'", id.FrontDoorName, "frontDoorValue") - } -} - -func TestFormatFrontDoorID(t *testing.T) { - actual := NewFrontDoorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseFrontDoorID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *FrontDoorId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue", - Expected: &FrontDoorId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - FrontDoorName: "frontDoorValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseFrontDoorID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.FrontDoorName != v.Expected.FrontDoorName { - t.Fatalf("Expected %q but got %q for FrontDoorName", v.Expected.FrontDoorName, actual.FrontDoorName) - } - } -} - -func TestParseFrontDoorIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *FrontDoorId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue", - Expected: &FrontDoorId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - FrontDoorName: "frontDoorValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE", - Expected: &FrontDoorId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - FrontDoorName: "fRoNtDoOrVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseFrontDoorIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.FrontDoorName != v.Expected.FrontDoorName { - t.Fatalf("Expected %q but got %q for FrontDoorName", v.Expected.FrontDoorName, actual.FrontDoorName) - } - } -} - -func TestSegmentsForFrontDoorId(t *testing.T) { - segments := FrontDoorId{}.Segments() - if len(segments) == 0 { - t.Fatalf("FrontDoorId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_frontendendpoint.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_frontendendpoint.go deleted file mode 100644 index 08871184a2f4..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_frontendendpoint.go +++ /dev/null @@ -1,137 +0,0 @@ -package frontdoors - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = FrontendEndpointId{} - -// FrontendEndpointId is a struct representing the Resource ID for a Frontend Endpoint -type FrontendEndpointId struct { - SubscriptionId string - ResourceGroupName string - FrontDoorName string - FrontendEndpointName string -} - -// NewFrontendEndpointID returns a new FrontendEndpointId struct -func NewFrontendEndpointID(subscriptionId string, resourceGroupName string, frontDoorName string, frontendEndpointName string) FrontendEndpointId { - return FrontendEndpointId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - FrontDoorName: frontDoorName, - FrontendEndpointName: frontendEndpointName, - } -} - -// ParseFrontendEndpointID parses 'input' into a FrontendEndpointId -func ParseFrontendEndpointID(input string) (*FrontendEndpointId, error) { - parser := resourceids.NewParserFromResourceIdType(FrontendEndpointId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FrontendEndpointId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, fmt.Errorf("the segment 'frontDoorName' was not found in the resource id %q", input) - } - - if id.FrontendEndpointName, ok = parsed.Parsed["frontendEndpointName"]; !ok { - return nil, fmt.Errorf("the segment 'frontendEndpointName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseFrontendEndpointIDInsensitively parses 'input' case-insensitively into a FrontendEndpointId -// note: this method should only be used for API response data and not user input -func ParseFrontendEndpointIDInsensitively(input string) (*FrontendEndpointId, error) { - parser := resourceids.NewParserFromResourceIdType(FrontendEndpointId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FrontendEndpointId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, fmt.Errorf("the segment 'frontDoorName' was not found in the resource id %q", input) - } - - if id.FrontendEndpointName, ok = parsed.Parsed["frontendEndpointName"]; !ok { - return nil, fmt.Errorf("the segment 'frontendEndpointName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateFrontendEndpointID checks that 'input' can be parsed as a Frontend Endpoint ID -func ValidateFrontendEndpointID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseFrontendEndpointID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Frontend Endpoint ID -func (id FrontendEndpointId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/frontDoors/%s/frontendEndpoints/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FrontDoorName, id.FrontendEndpointName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Frontend Endpoint ID -func (id FrontendEndpointId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), - resourceids.StaticSegment("staticFrontDoors", "frontDoors", "frontDoors"), - resourceids.UserSpecifiedSegment("frontDoorName", "frontDoorValue"), - resourceids.StaticSegment("staticFrontendEndpoints", "frontendEndpoints", "frontendEndpoints"), - resourceids.UserSpecifiedSegment("frontendEndpointName", "frontendEndpointValue"), - } -} - -// String returns a human-readable description of this Frontend Endpoint ID -func (id FrontendEndpointId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Front Door Name: %q", id.FrontDoorName), - fmt.Sprintf("Frontend Endpoint Name: %q", id.FrontendEndpointName), - } - return fmt.Sprintf("Frontend Endpoint (%s)", strings.Join(components, "\n")) -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_frontendendpoint_test.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_frontendendpoint_test.go deleted file mode 100644 index ffd46a567834..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_frontendendpoint_test.go +++ /dev/null @@ -1,322 +0,0 @@ -package frontdoors - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = FrontendEndpointId{} - -func TestNewFrontendEndpointID(t *testing.T) { - id := NewFrontendEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue", "frontendEndpointValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.FrontDoorName != "frontDoorValue" { - t.Fatalf("Expected %q but got %q for Segment 'FrontDoorName'", id.FrontDoorName, "frontDoorValue") - } - - if id.FrontendEndpointName != "frontendEndpointValue" { - t.Fatalf("Expected %q but got %q for Segment 'FrontendEndpointName'", id.FrontendEndpointName, "frontendEndpointValue") - } -} - -func TestFormatFrontendEndpointID(t *testing.T) { - actual := NewFrontendEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue", "frontendEndpointValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/frontendEndpoints/frontendEndpointValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseFrontendEndpointID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *FrontendEndpointId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/frontendEndpoints", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/frontendEndpoints/frontendEndpointValue", - Expected: &FrontendEndpointId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - FrontDoorName: "frontDoorValue", - FrontendEndpointName: "frontendEndpointValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/frontendEndpoints/frontendEndpointValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseFrontendEndpointID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.FrontDoorName != v.Expected.FrontDoorName { - t.Fatalf("Expected %q but got %q for FrontDoorName", v.Expected.FrontDoorName, actual.FrontDoorName) - } - - if actual.FrontendEndpointName != v.Expected.FrontendEndpointName { - t.Fatalf("Expected %q but got %q for FrontendEndpointName", v.Expected.FrontendEndpointName, actual.FrontendEndpointName) - } - } -} - -func TestParseFrontendEndpointIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *FrontendEndpointId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/frontendEndpoints", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE/fRoNtEnDeNdPoInTs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/frontendEndpoints/frontendEndpointValue", - Expected: &FrontendEndpointId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - FrontDoorName: "frontDoorValue", - FrontendEndpointName: "frontendEndpointValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/frontendEndpoints/frontendEndpointValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE/fRoNtEnDeNdPoInTs/fRoNtEnDeNdPoInTvAlUe", - Expected: &FrontendEndpointId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - FrontDoorName: "fRoNtDoOrVaLuE", - FrontendEndpointName: "fRoNtEnDeNdPoInTvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE/fRoNtEnDeNdPoInTs/fRoNtEnDeNdPoInTvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseFrontendEndpointIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.FrontDoorName != v.Expected.FrontDoorName { - t.Fatalf("Expected %q but got %q for FrontDoorName", v.Expected.FrontDoorName, actual.FrontDoorName) - } - - if actual.FrontendEndpointName != v.Expected.FrontendEndpointName { - t.Fatalf("Expected %q but got %q for FrontendEndpointName", v.Expected.FrontendEndpointName, actual.FrontendEndpointName) - } - } -} - -func TestSegmentsForFrontendEndpointId(t *testing.T) { - segments := FrontendEndpointId{}.Segments() - if len(segments) == 0 { - t.Fatalf("FrontendEndpointId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_resourcegroup.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_resourcegroup.go deleted file mode 100644 index 7e9fd1e8d3de..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package frontdoors - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_resourcegroup_test.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_resourcegroup_test.go deleted file mode 100644 index dea5316aa02f..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_resourcegroup_test.go +++ /dev/null @@ -1,202 +0,0 @@ -package frontdoors - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -func TestNewResourceGroupID(t *testing.T) { - id := NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } -} - -func TestFormatResourceGroupID(t *testing.T) { - actual := NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseResourceGroupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ResourceGroupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Expected: &ResourceGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseResourceGroupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - } -} - -func TestParseResourceGroupIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ResourceGroupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Expected: &ResourceGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Expected: &ResourceGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseResourceGroupIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - } -} - -func TestSegmentsForResourceGroupId(t *testing.T) { - segments := ResourceGroupId{}.Segments() - if len(segments) == 0 { - t.Fatalf("ResourceGroupId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_rulesengine.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_rulesengine.go deleted file mode 100644 index e528cb4fb50d..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_rulesengine.go +++ /dev/null @@ -1,137 +0,0 @@ -package frontdoors - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = RulesEngineId{} - -// RulesEngineId is a struct representing the Resource ID for a Rules Engine -type RulesEngineId struct { - SubscriptionId string - ResourceGroupName string - FrontDoorName string - RulesEngineName string -} - -// NewRulesEngineID returns a new RulesEngineId struct -func NewRulesEngineID(subscriptionId string, resourceGroupName string, frontDoorName string, rulesEngineName string) RulesEngineId { - return RulesEngineId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - FrontDoorName: frontDoorName, - RulesEngineName: rulesEngineName, - } -} - -// ParseRulesEngineID parses 'input' into a RulesEngineId -func ParseRulesEngineID(input string) (*RulesEngineId, error) { - parser := resourceids.NewParserFromResourceIdType(RulesEngineId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := RulesEngineId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, fmt.Errorf("the segment 'frontDoorName' was not found in the resource id %q", input) - } - - if id.RulesEngineName, ok = parsed.Parsed["rulesEngineName"]; !ok { - return nil, fmt.Errorf("the segment 'rulesEngineName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseRulesEngineIDInsensitively parses 'input' case-insensitively into a RulesEngineId -// note: this method should only be used for API response data and not user input -func ParseRulesEngineIDInsensitively(input string) (*RulesEngineId, error) { - parser := resourceids.NewParserFromResourceIdType(RulesEngineId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := RulesEngineId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, fmt.Errorf("the segment 'frontDoorName' was not found in the resource id %q", input) - } - - if id.RulesEngineName, ok = parsed.Parsed["rulesEngineName"]; !ok { - return nil, fmt.Errorf("the segment 'rulesEngineName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateRulesEngineID checks that 'input' can be parsed as a Rules Engine ID -func ValidateRulesEngineID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseRulesEngineID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Rules Engine ID -func (id RulesEngineId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/frontDoors/%s/rulesEngines/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FrontDoorName, id.RulesEngineName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Rules Engine ID -func (id RulesEngineId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), - resourceids.StaticSegment("staticFrontDoors", "frontDoors", "frontDoors"), - resourceids.UserSpecifiedSegment("frontDoorName", "frontDoorValue"), - resourceids.StaticSegment("staticRulesEngines", "rulesEngines", "rulesEngines"), - resourceids.UserSpecifiedSegment("rulesEngineName", "rulesEngineValue"), - } -} - -// String returns a human-readable description of this Rules Engine ID -func (id RulesEngineId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Front Door Name: %q", id.FrontDoorName), - fmt.Sprintf("Rules Engine Name: %q", id.RulesEngineName), - } - return fmt.Sprintf("Rules Engine (%s)", strings.Join(components, "\n")) -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_rulesengine_test.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_rulesengine_test.go deleted file mode 100644 index 4728bb7f6846..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_rulesengine_test.go +++ /dev/null @@ -1,322 +0,0 @@ -package frontdoors - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = RulesEngineId{} - -func TestNewRulesEngineID(t *testing.T) { - id := NewRulesEngineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue", "rulesEngineValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.FrontDoorName != "frontDoorValue" { - t.Fatalf("Expected %q but got %q for Segment 'FrontDoorName'", id.FrontDoorName, "frontDoorValue") - } - - if id.RulesEngineName != "rulesEngineValue" { - t.Fatalf("Expected %q but got %q for Segment 'RulesEngineName'", id.RulesEngineName, "rulesEngineValue") - } -} - -func TestFormatRulesEngineID(t *testing.T) { - actual := NewRulesEngineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue", "rulesEngineValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/rulesEngines/rulesEngineValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseRulesEngineID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *RulesEngineId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/rulesEngines", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/rulesEngines/rulesEngineValue", - Expected: &RulesEngineId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - FrontDoorName: "frontDoorValue", - RulesEngineName: "rulesEngineValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/rulesEngines/rulesEngineValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseRulesEngineID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.FrontDoorName != v.Expected.FrontDoorName { - t.Fatalf("Expected %q but got %q for FrontDoorName", v.Expected.FrontDoorName, actual.FrontDoorName) - } - - if actual.RulesEngineName != v.Expected.RulesEngineName { - t.Fatalf("Expected %q but got %q for RulesEngineName", v.Expected.RulesEngineName, actual.RulesEngineName) - } - } -} - -func TestParseRulesEngineIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *RulesEngineId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/rulesEngines", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE/rUlEsEnGiNeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/rulesEngines/rulesEngineValue", - Expected: &RulesEngineId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - FrontDoorName: "frontDoorValue", - RulesEngineName: "rulesEngineValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Network/frontDoors/frontDoorValue/rulesEngines/rulesEngineValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE/rUlEsEnGiNeS/rUlEsEnGiNeVaLuE", - Expected: &RulesEngineId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - FrontDoorName: "fRoNtDoOrVaLuE", - RulesEngineName: "rUlEsEnGiNeVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtWoRk/fRoNtDoOrS/fRoNtDoOrVaLuE/rUlEsEnGiNeS/rUlEsEnGiNeVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseRulesEngineIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.FrontDoorName != v.Expected.FrontDoorName { - t.Fatalf("Expected %q but got %q for FrontDoorName", v.Expected.FrontDoorName, actual.FrontDoorName) - } - - if actual.RulesEngineName != v.Expected.RulesEngineName { - t.Fatalf("Expected %q but got %q for RulesEngineName", v.Expected.RulesEngineName, actual.RulesEngineName) - } - } -} - -func TestSegmentsForRulesEngineId(t *testing.T) { - segments := RulesEngineId{}.Segments() - if len(segments) == 0 { - t.Fatalf("RulesEngineId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_subscription.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_subscription.go deleted file mode 100644 index c13922257cad..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package frontdoors - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_subscription_test.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_subscription_test.go deleted file mode 100644 index 51bd8ec3cb1c..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/id_subscription_test.go +++ /dev/null @@ -1,157 +0,0 @@ -package frontdoors - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -func TestNewSubscriptionID(t *testing.T) { - id := NewSubscriptionID("12345678-1234-9876-4563-123456789012") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } -} - -func TestFormatSubscriptionID(t *testing.T) { - actual := NewSubscriptionID("12345678-1234-9876-4563-123456789012").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSubscriptionID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubscriptionId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Expected: &SubscriptionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubscriptionID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - } -} - -func TestParseSubscriptionIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubscriptionId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Expected: &SubscriptionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Expected: &SubscriptionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubscriptionIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - } -} - -func TestSegmentsForSubscriptionId(t *testing.T) { - segments := SubscriptionId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SubscriptionId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_createorupdate_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_createorupdate_autorest.go deleted file mode 100644 index acc9e18ea84d..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_createorupdate_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateOrUpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c FrontDoorsClient) CreateOrUpdate(ctx context.Context, id FrontDoorId, input FrontDoor) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c FrontDoorsClient) CreateOrUpdateThenPoll(ctx context.Context, id FrontDoorId, input FrontDoor) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c FrontDoorsClient) preparerForCreateOrUpdate(ctx context.Context, id FrontDoorId, input FrontDoor) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c FrontDoorsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_delete_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_delete_autorest.go deleted file mode 100644 index 2a7aeafb599b..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_delete_autorest.go +++ /dev/null @@ -1,74 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c FrontDoorsClient) Delete(ctx context.Context, id FrontDoorId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c FrontDoorsClient) DeleteThenPoll(ctx context.Context, id FrontDoorId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c FrontDoorsClient) preparerForDelete(ctx context.Context, id FrontDoorId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c FrontDoorsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_endpointspurgecontent_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_endpointspurgecontent_autorest.go deleted file mode 100644 index fe12e0c3d505..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_endpointspurgecontent_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type EndpointsPurgeContentResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// EndpointsPurgeContent ... -func (c FrontDoorsClient) EndpointsPurgeContent(ctx context.Context, id FrontDoorId, input PurgeParameters) (result EndpointsPurgeContentResponse, err error) { - req, err := c.preparerForEndpointsPurgeContent(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "EndpointsPurgeContent", nil, "Failure preparing request") - return - } - - result, err = c.senderForEndpointsPurgeContent(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "EndpointsPurgeContent", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// EndpointsPurgeContentThenPoll performs EndpointsPurgeContent then polls until it's completed -func (c FrontDoorsClient) EndpointsPurgeContentThenPoll(ctx context.Context, id FrontDoorId, input PurgeParameters) error { - result, err := c.EndpointsPurgeContent(ctx, id, input) - if err != nil { - return fmt.Errorf("performing EndpointsPurgeContent: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after EndpointsPurgeContent: %+v", err) - } - - return nil -} - -// preparerForEndpointsPurgeContent prepares the EndpointsPurgeContent request. -func (c FrontDoorsClient) preparerForEndpointsPurgeContent(ctx context.Context, id FrontDoorId, input PurgeParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/purge", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForEndpointsPurgeContent sends the EndpointsPurgeContent request. The method will close the -// http.Response Body if it receives an error. -func (c FrontDoorsClient) senderForEndpointsPurgeContent(ctx context.Context, req *http.Request) (future EndpointsPurgeContentResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_frontendendpointsdisablehttps_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_frontendendpointsdisablehttps_autorest.go deleted file mode 100644 index 010425bf9722..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_frontendendpointsdisablehttps_autorest.go +++ /dev/null @@ -1,74 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type FrontendEndpointsDisableHttpsResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// FrontendEndpointsDisableHttps ... -func (c FrontDoorsClient) FrontendEndpointsDisableHttps(ctx context.Context, id FrontendEndpointId) (result FrontendEndpointsDisableHttpsResponse, err error) { - req, err := c.preparerForFrontendEndpointsDisableHttps(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsDisableHttps", nil, "Failure preparing request") - return - } - - result, err = c.senderForFrontendEndpointsDisableHttps(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsDisableHttps", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// FrontendEndpointsDisableHttpsThenPoll performs FrontendEndpointsDisableHttps then polls until it's completed -func (c FrontDoorsClient) FrontendEndpointsDisableHttpsThenPoll(ctx context.Context, id FrontendEndpointId) error { - result, err := c.FrontendEndpointsDisableHttps(ctx, id) - if err != nil { - return fmt.Errorf("performing FrontendEndpointsDisableHttps: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after FrontendEndpointsDisableHttps: %+v", err) - } - - return nil -} - -// preparerForFrontendEndpointsDisableHttps prepares the FrontendEndpointsDisableHttps request. -func (c FrontDoorsClient) preparerForFrontendEndpointsDisableHttps(ctx context.Context, id FrontendEndpointId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/disableHttps", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForFrontendEndpointsDisableHttps sends the FrontendEndpointsDisableHttps request. The method will close the -// http.Response Body if it receives an error. -func (c FrontDoorsClient) senderForFrontendEndpointsDisableHttps(ctx context.Context, req *http.Request) (future FrontendEndpointsDisableHttpsResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_frontendendpointsenablehttps_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_frontendendpointsenablehttps_autorest.go deleted file mode 100644 index 53f915771d7f..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_frontendendpointsenablehttps_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type FrontendEndpointsEnableHttpsResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// FrontendEndpointsEnableHttps ... -func (c FrontDoorsClient) FrontendEndpointsEnableHttps(ctx context.Context, id FrontendEndpointId, input CustomHttpsConfiguration) (result FrontendEndpointsEnableHttpsResponse, err error) { - req, err := c.preparerForFrontendEndpointsEnableHttps(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsEnableHttps", nil, "Failure preparing request") - return - } - - result, err = c.senderForFrontendEndpointsEnableHttps(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsEnableHttps", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// FrontendEndpointsEnableHttpsThenPoll performs FrontendEndpointsEnableHttps then polls until it's completed -func (c FrontDoorsClient) FrontendEndpointsEnableHttpsThenPoll(ctx context.Context, id FrontendEndpointId, input CustomHttpsConfiguration) error { - result, err := c.FrontendEndpointsEnableHttps(ctx, id, input) - if err != nil { - return fmt.Errorf("performing FrontendEndpointsEnableHttps: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after FrontendEndpointsEnableHttps: %+v", err) - } - - return nil -} - -// preparerForFrontendEndpointsEnableHttps prepares the FrontendEndpointsEnableHttps request. -func (c FrontDoorsClient) preparerForFrontendEndpointsEnableHttps(ctx context.Context, id FrontendEndpointId, input CustomHttpsConfiguration) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/enableHttps", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForFrontendEndpointsEnableHttps sends the FrontendEndpointsEnableHttps request. The method will close the -// http.Response Body if it receives an error. -func (c FrontDoorsClient) senderForFrontendEndpointsEnableHttps(ctx context.Context, req *http.Request) (future FrontendEndpointsEnableHttpsResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_frontendendpointsget_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_frontendendpointsget_autorest.go deleted file mode 100644 index 66a6d78a284d..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_frontendendpointsget_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package frontdoors - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type FrontendEndpointsGetResponse struct { - HttpResponse *http.Response - Model *FrontendEndpoint -} - -// FrontendEndpointsGet ... -func (c FrontDoorsClient) FrontendEndpointsGet(ctx context.Context, id FrontendEndpointId) (result FrontendEndpointsGetResponse, err error) { - req, err := c.preparerForFrontendEndpointsGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForFrontendEndpointsGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForFrontendEndpointsGet prepares the FrontendEndpointsGet request. -func (c FrontDoorsClient) preparerForFrontendEndpointsGet(ctx context.Context, id FrontendEndpointId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForFrontendEndpointsGet handles the response to the FrontendEndpointsGet request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForFrontendEndpointsGet(resp *http.Response) (result FrontendEndpointsGetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_frontendendpointslistbyfrontdoor_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_frontendendpointslistbyfrontdoor_autorest.go deleted file mode 100644 index 688d8051b5ca..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_frontendendpointslistbyfrontdoor_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type FrontendEndpointsListByFrontDoorResponse struct { - HttpResponse *http.Response - Model *[]FrontendEndpoint - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (FrontendEndpointsListByFrontDoorResponse, error) -} - -type FrontendEndpointsListByFrontDoorCompleteResult struct { - Items []FrontendEndpoint -} - -func (r FrontendEndpointsListByFrontDoorResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r FrontendEndpointsListByFrontDoorResponse) LoadMore(ctx context.Context) (resp FrontendEndpointsListByFrontDoorResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// FrontendEndpointsListByFrontDoor ... -func (c FrontDoorsClient) FrontendEndpointsListByFrontDoor(ctx context.Context, id FrontDoorId) (resp FrontendEndpointsListByFrontDoorResponse, err error) { - req, err := c.preparerForFrontendEndpointsListByFrontDoor(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForFrontendEndpointsListByFrontDoor(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// FrontendEndpointsListByFrontDoorComplete retrieves all of the results into a single object -func (c FrontDoorsClient) FrontendEndpointsListByFrontDoorComplete(ctx context.Context, id FrontDoorId) (FrontendEndpointsListByFrontDoorCompleteResult, error) { - return c.FrontendEndpointsListByFrontDoorCompleteMatchingPredicate(ctx, id, FrontendEndpointPredicate{}) -} - -// FrontendEndpointsListByFrontDoorCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c FrontDoorsClient) FrontendEndpointsListByFrontDoorCompleteMatchingPredicate(ctx context.Context, id FrontDoorId, predicate FrontendEndpointPredicate) (resp FrontendEndpointsListByFrontDoorCompleteResult, err error) { - items := make([]FrontendEndpoint, 0) - - page, err := c.FrontendEndpointsListByFrontDoor(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := FrontendEndpointsListByFrontDoorCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForFrontendEndpointsListByFrontDoor prepares the FrontendEndpointsListByFrontDoor request. -func (c FrontDoorsClient) preparerForFrontendEndpointsListByFrontDoor(ctx context.Context, id FrontDoorId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/frontendEndpoints", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForFrontendEndpointsListByFrontDoorWithNextLink prepares the FrontendEndpointsListByFrontDoor request with the given nextLink token. -func (c FrontDoorsClient) preparerForFrontendEndpointsListByFrontDoorWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForFrontendEndpointsListByFrontDoor handles the response to the FrontendEndpointsListByFrontDoor request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForFrontendEndpointsListByFrontDoor(resp *http.Response) (result FrontendEndpointsListByFrontDoorResponse, err error) { - type page struct { - Values []FrontendEndpoint `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result FrontendEndpointsListByFrontDoorResponse, err error) { - req, err := c.preparerForFrontendEndpointsListByFrontDoorWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForFrontendEndpointsListByFrontDoor(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_get_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_get_autorest.go deleted file mode 100644 index 0c40ccaed13d..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package frontdoors - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *FrontDoor -} - -// Get ... -func (c FrontDoorsClient) Get(ctx context.Context, id FrontDoorId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c FrontDoorsClient) preparerForGet(ctx context.Context, id FrontDoorId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_list_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_list_autorest.go deleted file mode 100644 index ffce15be86c5..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_list_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListResponse struct { - HttpResponse *http.Response - Model *[]FrontDoor - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListResponse, error) -} - -type ListCompleteResult struct { - Items []FrontDoor -} - -func (r ListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListResponse) LoadMore(ctx context.Context) (resp ListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c FrontDoorsClient) List(ctx context.Context, id SubscriptionId) (resp ListResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c FrontDoorsClient) ListComplete(ctx context.Context, id SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, FrontDoorPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c FrontDoorsClient) ListCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate FrontDoorPredicate) (resp ListCompleteResult, err error) { - items := make([]FrontDoor, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForList prepares the List request. -func (c FrontDoorsClient) preparerForList(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/frontDoors", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c FrontDoorsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForList(resp *http.Response) (result ListResponse, err error) { - type page struct { - Values []FrontDoor `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_listbyresourcegroup_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 8c27ef5b2139..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *[]FrontDoor - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []FrontDoor -} - -func (r ListByResourceGroupResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c FrontDoorsClient) ListByResourceGroup(ctx context.Context, id ResourceGroupId) (resp ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c FrontDoorsClient) ListByResourceGroupComplete(ctx context.Context, id ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, FrontDoorPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c FrontDoorsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate FrontDoorPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]FrontDoor, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c FrontDoorsClient) preparerForListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/frontDoors", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c FrontDoorsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - type page struct { - Values []FrontDoor `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_rulesenginescreateorupdate_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_rulesenginescreateorupdate_autorest.go deleted file mode 100644 index 755e6bf17d17..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_rulesenginescreateorupdate_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type RulesEnginesCreateOrUpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// RulesEnginesCreateOrUpdate ... -func (c FrontDoorsClient) RulesEnginesCreateOrUpdate(ctx context.Context, id RulesEngineId, input RulesEngine) (result RulesEnginesCreateOrUpdateResponse, err error) { - req, err := c.preparerForRulesEnginesCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesCreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForRulesEnginesCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RulesEnginesCreateOrUpdateThenPoll performs RulesEnginesCreateOrUpdate then polls until it's completed -func (c FrontDoorsClient) RulesEnginesCreateOrUpdateThenPoll(ctx context.Context, id RulesEngineId, input RulesEngine) error { - result, err := c.RulesEnginesCreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing RulesEnginesCreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RulesEnginesCreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForRulesEnginesCreateOrUpdate prepares the RulesEnginesCreateOrUpdate request. -func (c FrontDoorsClient) preparerForRulesEnginesCreateOrUpdate(ctx context.Context, id RulesEngineId, input RulesEngine) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRulesEnginesCreateOrUpdate sends the RulesEnginesCreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c FrontDoorsClient) senderForRulesEnginesCreateOrUpdate(ctx context.Context, req *http.Request) (future RulesEnginesCreateOrUpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_rulesenginesdelete_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_rulesenginesdelete_autorest.go deleted file mode 100644 index 78a9c2612d5b..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_rulesenginesdelete_autorest.go +++ /dev/null @@ -1,74 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type RulesEnginesDeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// RulesEnginesDelete ... -func (c FrontDoorsClient) RulesEnginesDelete(ctx context.Context, id RulesEngineId) (result RulesEnginesDeleteResponse, err error) { - req, err := c.preparerForRulesEnginesDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesDelete", nil, "Failure preparing request") - return - } - - result, err = c.senderForRulesEnginesDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesDelete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RulesEnginesDeleteThenPoll performs RulesEnginesDelete then polls until it's completed -func (c FrontDoorsClient) RulesEnginesDeleteThenPoll(ctx context.Context, id RulesEngineId) error { - result, err := c.RulesEnginesDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing RulesEnginesDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RulesEnginesDelete: %+v", err) - } - - return nil -} - -// preparerForRulesEnginesDelete prepares the RulesEnginesDelete request. -func (c FrontDoorsClient) preparerForRulesEnginesDelete(ctx context.Context, id RulesEngineId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRulesEnginesDelete sends the RulesEnginesDelete request. The method will close the -// http.Response Body if it receives an error. -func (c FrontDoorsClient) senderForRulesEnginesDelete(ctx context.Context, req *http.Request) (future RulesEnginesDeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_rulesenginesget_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_rulesenginesget_autorest.go deleted file mode 100644 index 8d0e8b263d7b..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_rulesenginesget_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package frontdoors - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type RulesEnginesGetResponse struct { - HttpResponse *http.Response - Model *RulesEngine -} - -// RulesEnginesGet ... -func (c FrontDoorsClient) RulesEnginesGet(ctx context.Context, id RulesEngineId) (result RulesEnginesGetResponse, err error) { - req, err := c.preparerForRulesEnginesGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRulesEnginesGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRulesEnginesGet prepares the RulesEnginesGet request. -func (c FrontDoorsClient) preparerForRulesEnginesGet(ctx context.Context, id RulesEngineId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRulesEnginesGet handles the response to the RulesEnginesGet request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForRulesEnginesGet(resp *http.Response) (result RulesEnginesGetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_rulesengineslistbyfrontdoor_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_rulesengineslistbyfrontdoor_autorest.go deleted file mode 100644 index ab5882fa1573..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_rulesengineslistbyfrontdoor_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type RulesEnginesListByFrontDoorResponse struct { - HttpResponse *http.Response - Model *[]RulesEngine - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (RulesEnginesListByFrontDoorResponse, error) -} - -type RulesEnginesListByFrontDoorCompleteResult struct { - Items []RulesEngine -} - -func (r RulesEnginesListByFrontDoorResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r RulesEnginesListByFrontDoorResponse) LoadMore(ctx context.Context) (resp RulesEnginesListByFrontDoorResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// RulesEnginesListByFrontDoor ... -func (c FrontDoorsClient) RulesEnginesListByFrontDoor(ctx context.Context, id FrontDoorId) (resp RulesEnginesListByFrontDoorResponse, err error) { - req, err := c.preparerForRulesEnginesListByFrontDoor(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForRulesEnginesListByFrontDoor(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// RulesEnginesListByFrontDoorComplete retrieves all of the results into a single object -func (c FrontDoorsClient) RulesEnginesListByFrontDoorComplete(ctx context.Context, id FrontDoorId) (RulesEnginesListByFrontDoorCompleteResult, error) { - return c.RulesEnginesListByFrontDoorCompleteMatchingPredicate(ctx, id, RulesEnginePredicate{}) -} - -// RulesEnginesListByFrontDoorCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c FrontDoorsClient) RulesEnginesListByFrontDoorCompleteMatchingPredicate(ctx context.Context, id FrontDoorId, predicate RulesEnginePredicate) (resp RulesEnginesListByFrontDoorCompleteResult, err error) { - items := make([]RulesEngine, 0) - - page, err := c.RulesEnginesListByFrontDoor(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := RulesEnginesListByFrontDoorCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForRulesEnginesListByFrontDoor prepares the RulesEnginesListByFrontDoor request. -func (c FrontDoorsClient) preparerForRulesEnginesListByFrontDoor(ctx context.Context, id FrontDoorId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/rulesEngines", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForRulesEnginesListByFrontDoorWithNextLink prepares the RulesEnginesListByFrontDoor request with the given nextLink token. -func (c FrontDoorsClient) preparerForRulesEnginesListByFrontDoorWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRulesEnginesListByFrontDoor handles the response to the RulesEnginesListByFrontDoor request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForRulesEnginesListByFrontDoor(resp *http.Response) (result RulesEnginesListByFrontDoorResponse, err error) { - type page struct { - Values []RulesEngine `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result RulesEnginesListByFrontDoorResponse, err error) { - req, err := c.preparerForRulesEnginesListByFrontDoorWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRulesEnginesListByFrontDoor(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_validatecustomdomain_autorest.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_validatecustomdomain_autorest.go deleted file mode 100644 index 2a585da0274e..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/method_validatecustomdomain_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package frontdoors - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ValidateCustomDomainResponse struct { - HttpResponse *http.Response - Model *ValidateCustomDomainOutput -} - -// ValidateCustomDomain ... -func (c FrontDoorsClient) ValidateCustomDomain(ctx context.Context, id FrontDoorId, input ValidateCustomDomainInput) (result ValidateCustomDomainResponse, err error) { - req, err := c.preparerForValidateCustomDomain(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ValidateCustomDomain", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ValidateCustomDomain", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForValidateCustomDomain(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ValidateCustomDomain", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForValidateCustomDomain prepares the ValidateCustomDomain request. -func (c FrontDoorsClient) preparerForValidateCustomDomain(ctx context.Context, id FrontDoorId, input ValidateCustomDomainInput) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/validateCustomDomain", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForValidateCustomDomain handles the response to the ValidateCustomDomain request. The method always -// closes the http.Response Body. -func (c FrontDoorsClient) responderForValidateCustomDomain(resp *http.Response) (result ValidateCustomDomainResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_backend.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_backend.go deleted file mode 100644 index 647bdf8b4064..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_backend.go +++ /dev/null @@ -1,16 +0,0 @@ -package frontdoors - -type Backend struct { - Address *string `json:"address,omitempty"` - BackendHostHeader *string `json:"backendHostHeader,omitempty"` - EnabledState *BackendEnabledState `json:"enabledState,omitempty"` - HttpPort *int64 `json:"httpPort,omitempty"` - HttpsPort *int64 `json:"httpsPort,omitempty"` - Priority *int64 `json:"priority,omitempty"` - PrivateEndpointStatus *PrivateEndpointStatus `json:"privateEndpointStatus,omitempty"` - PrivateLinkAlias *string `json:"privateLinkAlias,omitempty"` - PrivateLinkApprovalMessage *string `json:"privateLinkApprovalMessage,omitempty"` - PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"` - PrivateLinkResourceId *string `json:"privateLinkResourceId,omitempty"` - Weight *int64 `json:"weight,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_backendpool.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_backendpool.go deleted file mode 100644 index a0009b30e2c2..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_backendpool.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type BackendPool struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *BackendPoolProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_backendpoolproperties.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_backendpoolproperties.go deleted file mode 100644 index 3d89bc4bf128..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_backendpoolproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type BackendPoolProperties struct { - Backends *[]Backend `json:"backends,omitempty"` - HealthProbeSettings *SubResource `json:"healthProbeSettings,omitempty"` - LoadBalancingSettings *SubResource `json:"loadBalancingSettings,omitempty"` - ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_backendpoolssettings.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_backendpoolssettings.go deleted file mode 100644 index b89237176e4f..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_backendpoolssettings.go +++ /dev/null @@ -1,6 +0,0 @@ -package frontdoors - -type BackendPoolsSettings struct { - EnforceCertificateNameCheck *EnforceCertificateNameCheckEnabledState `json:"enforceCertificateNameCheck,omitempty"` - SendRecvTimeoutSeconds *int64 `json:"sendRecvTimeoutSeconds,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_cacheconfiguration.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_cacheconfiguration.go deleted file mode 100644 index c525f7cf5595..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_cacheconfiguration.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type CacheConfiguration struct { - CacheDuration *string `json:"cacheDuration,omitempty"` - DynamicCompression *DynamicCompressionEnabled `json:"dynamicCompression,omitempty"` - QueryParameterStripDirective *FrontDoorQuery `json:"queryParameterStripDirective,omitempty"` - QueryParameters *string `json:"queryParameters,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_customhttpsconfiguration.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_customhttpsconfiguration.go deleted file mode 100644 index 35b9c7067687..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_customhttpsconfiguration.go +++ /dev/null @@ -1,9 +0,0 @@ -package frontdoors - -type CustomHttpsConfiguration struct { - CertificateSource FrontDoorCertificateSource `json:"certificateSource"` - FrontDoorCertificateSourceParameters *FrontDoorCertificateSourceParameters `json:"frontDoorCertificateSourceParameters,omitempty"` - KeyVaultCertificateSourceParameters *KeyVaultCertificateSourceParameters `json:"keyVaultCertificateSourceParameters,omitempty"` - MinimumTlsVersion MinimumTLSVersion `json:"minimumTlsVersion"` - ProtocolType FrontDoorTlsProtocolType `json:"protocolType"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_forwardingconfiguration.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_forwardingconfiguration.go deleted file mode 100644 index 8eb665b2d148..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_forwardingconfiguration.go +++ /dev/null @@ -1,41 +0,0 @@ -package frontdoors - -import ( - "encoding/json" - "fmt" -) - -var _ RouteConfiguration = ForwardingConfiguration{} - -type ForwardingConfiguration struct { - BackendPool *SubResource `json:"backendPool,omitempty"` - CacheConfiguration *CacheConfiguration `json:"cacheConfiguration,omitempty"` - CustomForwardingPath *string `json:"customForwardingPath,omitempty"` - ForwardingProtocol *FrontDoorForwardingProtocol `json:"forwardingProtocol,omitempty"` - - // Fields inherited from RouteConfiguration -} - -var _ json.Marshaler = ForwardingConfiguration{} - -func (s ForwardingConfiguration) MarshalJSON() ([]byte, error) { - type wrapper ForwardingConfiguration - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ForwardingConfiguration: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ForwardingConfiguration: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ForwardingConfiguration: %+v", err) - } - - return encoded, nil -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontdoor.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontdoor.go deleted file mode 100644 index 3aec7c87ca30..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontdoor.go +++ /dev/null @@ -1,10 +0,0 @@ -package frontdoors - -type FrontDoor struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *FrontDoorProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontdoorcertificatesourceparameters.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontdoorcertificatesourceparameters.go deleted file mode 100644 index e4a4923aaab6..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontdoorcertificatesourceparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package frontdoors - -type FrontDoorCertificateSourceParameters struct { - CertificateType *FrontDoorCertificateType `json:"certificateType,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontdoorproperties.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontdoorproperties.go deleted file mode 100644 index e31d4b95fa92..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontdoorproperties.go +++ /dev/null @@ -1,17 +0,0 @@ -package frontdoors - -type FrontDoorProperties struct { - BackendPools *[]BackendPool `json:"backendPools,omitempty"` - BackendPoolsSettings *BackendPoolsSettings `json:"backendPoolsSettings,omitempty"` - Cname *string `json:"cname,omitempty"` - EnabledState *FrontDoorEnabledState `json:"enabledState,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` - FrontdoorId *string `json:"frontdoorId,omitempty"` - FrontendEndpoints *[]FrontendEndpoint `json:"frontendEndpoints,omitempty"` - HealthProbeSettings *[]HealthProbeSettingsModel `json:"healthProbeSettings,omitempty"` - LoadBalancingSettings *[]LoadBalancingSettingsModel `json:"loadBalancingSettings,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` - RoutingRules *[]RoutingRule `json:"routingRules,omitempty"` - RulesEngines *[]RulesEngine `json:"rulesEngines,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontendendpoint.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontendendpoint.go deleted file mode 100644 index 1bd72711b4c0..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontendendpoint.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type FrontendEndpoint struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *FrontendEndpointProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontendendpointproperties.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontendendpointproperties.go deleted file mode 100644 index dd80e827035e..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontendendpointproperties.go +++ /dev/null @@ -1,12 +0,0 @@ -package frontdoors - -type FrontendEndpointProperties struct { - CustomHttpsConfiguration *CustomHttpsConfiguration `json:"customHttpsConfiguration,omitempty"` - CustomHttpsProvisioningState *CustomHttpsProvisioningState `json:"customHttpsProvisioningState,omitempty"` - CustomHttpsProvisioningSubstate *CustomHttpsProvisioningSubstate `json:"customHttpsProvisioningSubstate,omitempty"` - HostName *string `json:"hostName,omitempty"` - ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` - SessionAffinityEnabledState *SessionAffinityEnabledState `json:"sessionAffinityEnabledState,omitempty"` - SessionAffinityTtlSeconds *int64 `json:"sessionAffinityTtlSeconds,omitempty"` - WebApplicationFirewallPolicyLink *FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontendendpointupdateparameterswebapplicationfirewallpolicylink.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontendendpointupdateparameterswebapplicationfirewallpolicylink.go deleted file mode 100644 index d959233aff41..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_frontendendpointupdateparameterswebapplicationfirewallpolicylink.go +++ /dev/null @@ -1,5 +0,0 @@ -package frontdoors - -type FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink struct { - Id *string `json:"id,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_headeraction.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_headeraction.go deleted file mode 100644 index 93070b0bcd87..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_headeraction.go +++ /dev/null @@ -1,7 +0,0 @@ -package frontdoors - -type HeaderAction struct { - HeaderActionType HeaderActionType `json:"headerActionType"` - HeaderName string `json:"headerName"` - Value *string `json:"value,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_healthprobesettingsmodel.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_healthprobesettingsmodel.go deleted file mode 100644 index d248a95c709c..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_healthprobesettingsmodel.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type HealthProbeSettingsModel struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *HealthProbeSettingsProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_healthprobesettingsproperties.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_healthprobesettingsproperties.go deleted file mode 100644 index 75f843fa294f..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_healthprobesettingsproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package frontdoors - -type HealthProbeSettingsProperties struct { - EnabledState *HealthProbeEnabled `json:"enabledState,omitempty"` - HealthProbeMethod *FrontDoorHealthProbeMethod `json:"healthProbeMethod,omitempty"` - IntervalInSeconds *int64 `json:"intervalInSeconds,omitempty"` - Path *string `json:"path,omitempty"` - Protocol *FrontDoorProtocol `json:"protocol,omitempty"` - ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_keyvaultcertificatesourceparameters.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_keyvaultcertificatesourceparameters.go deleted file mode 100644 index 8944798ab6e3..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_keyvaultcertificatesourceparameters.go +++ /dev/null @@ -1,7 +0,0 @@ -package frontdoors - -type KeyVaultCertificateSourceParameters struct { - SecretName *string `json:"secretName,omitempty"` - SecretVersion *string `json:"secretVersion,omitempty"` - Vault *KeyVaultCertificateSourceParametersVault `json:"vault,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_keyvaultcertificatesourceparametersvault.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_keyvaultcertificatesourceparametersvault.go deleted file mode 100644 index 5ee791625775..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_keyvaultcertificatesourceparametersvault.go +++ /dev/null @@ -1,5 +0,0 @@ -package frontdoors - -type KeyVaultCertificateSourceParametersVault struct { - Id *string `json:"id,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_loadbalancingsettingsmodel.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_loadbalancingsettingsmodel.go deleted file mode 100644 index 55678911ed9c..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_loadbalancingsettingsmodel.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type LoadBalancingSettingsModel struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *LoadBalancingSettingsProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_loadbalancingsettingsproperties.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_loadbalancingsettingsproperties.go deleted file mode 100644 index c9b3ea3ceeb7..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_loadbalancingsettingsproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type LoadBalancingSettingsProperties struct { - AdditionalLatencyMilliseconds *int64 `json:"additionalLatencyMilliseconds,omitempty"` - ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` - SampleSize *int64 `json:"sampleSize,omitempty"` - SuccessfulSamplesRequired *int64 `json:"successfulSamplesRequired,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_purgeparameters.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_purgeparameters.go deleted file mode 100644 index d44a093cd7c3..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_purgeparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package frontdoors - -type PurgeParameters struct { - ContentPaths []string `json:"contentPaths"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_redirectconfiguration.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_redirectconfiguration.go deleted file mode 100644 index 914ddd8f80ce..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_redirectconfiguration.go +++ /dev/null @@ -1,43 +0,0 @@ -package frontdoors - -import ( - "encoding/json" - "fmt" -) - -var _ RouteConfiguration = RedirectConfiguration{} - -type RedirectConfiguration struct { - CustomFragment *string `json:"customFragment,omitempty"` - CustomHost *string `json:"customHost,omitempty"` - CustomPath *string `json:"customPath,omitempty"` - CustomQueryString *string `json:"customQueryString,omitempty"` - RedirectProtocol *FrontDoorRedirectProtocol `json:"redirectProtocol,omitempty"` - RedirectType *FrontDoorRedirectType `json:"redirectType,omitempty"` - - // Fields inherited from RouteConfiguration -} - -var _ json.Marshaler = RedirectConfiguration{} - -func (s RedirectConfiguration) MarshalJSON() ([]byte, error) { - type wrapper RedirectConfiguration - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling RedirectConfiguration: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling RedirectConfiguration: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Azure.FrontDoor.Models.FrontdoorRedirectConfiguration" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling RedirectConfiguration: %+v", err) - } - - return encoded, nil -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_routeconfiguration.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_routeconfiguration.go deleted file mode 100644 index 5f5c22c71e6a..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_routeconfiguration.go +++ /dev/null @@ -1,52 +0,0 @@ -package frontdoors - -import ( - "encoding/json" - "fmt" - "strings" -) - -type RouteConfiguration interface { -} - -func unmarshalRouteConfigurationImplementation(input []byte) (RouteConfiguration, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling RouteConfiguration into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration") { - var out ForwardingConfiguration - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ForwardingConfiguration: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Azure.FrontDoor.Models.FrontdoorRedirectConfiguration") { - var out RedirectConfiguration - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into RedirectConfiguration: %+v", err) - } - return out, nil - } - - type RawRouteConfigurationImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawRouteConfigurationImpl{ - Type: value, - Values: temp, - } - return out, nil -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_routingrule.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_routingrule.go deleted file mode 100644 index 003a1d5aa215..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_routingrule.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type RoutingRule struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *RoutingRuleProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_routingruleproperties.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_routingruleproperties.go deleted file mode 100644 index 262f246f0928..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_routingruleproperties.go +++ /dev/null @@ -1,49 +0,0 @@ -package frontdoors - -import ( - "encoding/json" - "fmt" -) - -type RoutingRuleProperties struct { - AcceptedProtocols *[]FrontDoorProtocol `json:"acceptedProtocols,omitempty"` - EnabledState *RoutingRuleEnabledState `json:"enabledState,omitempty"` - FrontendEndpoints *[]SubResource `json:"frontendEndpoints,omitempty"` - PatternsToMatch *[]string `json:"patternsToMatch,omitempty"` - ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` - RouteConfiguration RouteConfiguration `json:"routeConfiguration"` - RulesEngine *SubResource `json:"rulesEngine,omitempty"` - WebApplicationFirewallPolicyLink *RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` -} - -var _ json.Unmarshaler = &RoutingRuleProperties{} - -func (s *RoutingRuleProperties) UnmarshalJSON(bytes []byte) error { - type alias RoutingRuleProperties - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into RoutingRuleProperties: %+v", err) - } - - s.AcceptedProtocols = decoded.AcceptedProtocols - s.EnabledState = decoded.EnabledState - s.FrontendEndpoints = decoded.FrontendEndpoints - s.PatternsToMatch = decoded.PatternsToMatch - s.ResourceState = decoded.ResourceState - s.RulesEngine = decoded.RulesEngine - s.WebApplicationFirewallPolicyLink = decoded.WebApplicationFirewallPolicyLink - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling RoutingRuleProperties into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["routeConfiguration"]; ok { - impl, err := unmarshalRouteConfigurationImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'RouteConfiguration' for 'RoutingRuleProperties': %+v", err) - } - s.RouteConfiguration = impl - } - return nil -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_routingruleupdateparameterswebapplicationfirewallpolicylink.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_routingruleupdateparameterswebapplicationfirewallpolicylink.go deleted file mode 100644 index 1c708e8ffd93..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_routingruleupdateparameterswebapplicationfirewallpolicylink.go +++ /dev/null @@ -1,5 +0,0 @@ -package frontdoors - -type RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink struct { - Id *string `json:"id,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_rulesengine.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_rulesengine.go deleted file mode 100644 index 4015317dcc5b..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_rulesengine.go +++ /dev/null @@ -1,8 +0,0 @@ -package frontdoors - -type RulesEngine struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *RulesEngineProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_rulesengineaction.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_rulesengineaction.go deleted file mode 100644 index 2ec3f73b0b5e..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_rulesengineaction.go +++ /dev/null @@ -1,39 +0,0 @@ -package frontdoors - -import ( - "encoding/json" - "fmt" -) - -type RulesEngineAction struct { - RequestHeaderActions *[]HeaderAction `json:"requestHeaderActions,omitempty"` - ResponseHeaderActions *[]HeaderAction `json:"responseHeaderActions,omitempty"` - RouteConfigurationOverride RouteConfiguration `json:"routeConfigurationOverride"` -} - -var _ json.Unmarshaler = &RulesEngineAction{} - -func (s *RulesEngineAction) UnmarshalJSON(bytes []byte) error { - type alias RulesEngineAction - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into RulesEngineAction: %+v", err) - } - - s.RequestHeaderActions = decoded.RequestHeaderActions - s.ResponseHeaderActions = decoded.ResponseHeaderActions - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling RulesEngineAction into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["routeConfigurationOverride"]; ok { - impl, err := unmarshalRouteConfigurationImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'RouteConfigurationOverride' for 'RulesEngineAction': %+v", err) - } - s.RouteConfigurationOverride = impl - } - return nil -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_rulesenginematchcondition.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_rulesenginematchcondition.go deleted file mode 100644 index 82c552bb7ecc..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_rulesenginematchcondition.go +++ /dev/null @@ -1,10 +0,0 @@ -package frontdoors - -type RulesEngineMatchCondition struct { - NegateCondition *bool `json:"negateCondition,omitempty"` - RulesEngineMatchValue []string `json:"rulesEngineMatchValue"` - RulesEngineMatchVariable RulesEngineMatchVariable `json:"rulesEngineMatchVariable"` - RulesEngineOperator RulesEngineOperator `json:"rulesEngineOperator"` - Selector *string `json:"selector,omitempty"` - Transforms *[]Transform `json:"transforms,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_rulesengineproperties.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_rulesengineproperties.go deleted file mode 100644 index 60350faa6f71..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_rulesengineproperties.go +++ /dev/null @@ -1,6 +0,0 @@ -package frontdoors - -type RulesEngineProperties struct { - ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` - Rules *[]RulesEngineRule `json:"rules,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_rulesenginerule.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_rulesenginerule.go deleted file mode 100644 index 99fe4ddcfee4..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_rulesenginerule.go +++ /dev/null @@ -1,9 +0,0 @@ -package frontdoors - -type RulesEngineRule struct { - Action RulesEngineAction `json:"action"` - MatchConditions *[]RulesEngineMatchCondition `json:"matchConditions,omitempty"` - MatchProcessingBehavior *MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` - Name string `json:"name"` - Priority int64 `json:"priority"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_subresource.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_subresource.go deleted file mode 100644 index bc3007a051ae..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_subresource.go +++ /dev/null @@ -1,5 +0,0 @@ -package frontdoors - -type SubResource struct { - Id *string `json:"id,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_validatecustomdomaininput.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_validatecustomdomaininput.go deleted file mode 100644 index 38c49b705bb4..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_validatecustomdomaininput.go +++ /dev/null @@ -1,5 +0,0 @@ -package frontdoors - -type ValidateCustomDomainInput struct { - HostName string `json:"hostName"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_validatecustomdomainoutput.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_validatecustomdomainoutput.go deleted file mode 100644 index bcbdeb33419a..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/model_validatecustomdomainoutput.go +++ /dev/null @@ -1,7 +0,0 @@ -package frontdoors - -type ValidateCustomDomainOutput struct { - CustomDomainValidated *bool `json:"customDomainValidated,omitempty"` - Message *string `json:"message,omitempty"` - Reason *string `json:"reason,omitempty"` -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/predicates.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/predicates.go deleted file mode 100644 index c9ce234a8430..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/predicates.go +++ /dev/null @@ -1,72 +0,0 @@ -package frontdoors - -type FrontDoorPredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p FrontDoorPredicate) Matches(input FrontDoor) bool { - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} - -type FrontendEndpointPredicate struct { - Id *string - Name *string - Type *string -} - -func (p FrontendEndpointPredicate) Matches(input FrontendEndpoint) bool { - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} - -type RulesEnginePredicate struct { - Id *string - Name *string - Type *string -} - -func (p RulesEnginePredicate) Matches(input RulesEngine) bool { - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/version.go b/internal/services/frontdoor/sdk/2020-05-01/frontdoors/version.go deleted file mode 100644 index 3d51262b9fdb..000000000000 --- a/internal/services/frontdoor/sdk/2020-05-01/frontdoors/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package frontdoors - -import "fmt" - -const defaultApiVersion = "2020-05-01" - -func userAgent() string { - return fmt.Sprintf("pandora/frontdoors/%s", defaultApiVersion) -} diff --git a/internal/services/healthcare/healthcare_dicom_data_source.go b/internal/services/healthcare/healthcare_dicom_data_source.go index 2d082935892f..99116d564791 100644 --- a/internal/services/healthcare/healthcare_dicom_data_source.go +++ b/internal/services/healthcare/healthcare_dicom_data_source.go @@ -101,8 +101,7 @@ func dataSourceHealthcareApisDicomServiceRead(d *pluginsdk.ResourceData, meta in resp, err := client.Get(ctx, id.ResourceGroup, id.WorkspaceName, id.Name) if err != nil { if utils.ResponseWasNotFound(resp.Response) { - d.SetId("") - return nil + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } diff --git a/internal/services/healthcare/healthcare_fhir_data_source.go b/internal/services/healthcare/healthcare_fhir_data_source.go index 1f321d3a0acf..58aef75f809b 100644 --- a/internal/services/healthcare/healthcare_fhir_data_source.go +++ b/internal/services/healthcare/healthcare_fhir_data_source.go @@ -151,8 +151,7 @@ func dataSourceHealthcareApisFhirServiceRead(d *pluginsdk.ResourceData, meta int resp, err := client.Get(ctx, id.ResourceGroup, id.WorkspaceName, id.Name) if err != nil { if utils.ResponseWasNotFound(resp.Response) { - d.SetId("") - return nil + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } diff --git a/internal/services/healthcare/healthcare_medtech_service_data_source.go b/internal/services/healthcare/healthcare_medtech_service_data_source.go index 348b325ee3bb..02149fdbb166 100644 --- a/internal/services/healthcare/healthcare_medtech_service_data_source.go +++ b/internal/services/healthcare/healthcare_medtech_service_data_source.go @@ -78,8 +78,7 @@ func dataSourceHealthcareIotConnectorRead(d *pluginsdk.ResourceData, meta interf resp, err := client.Get(ctx, id.ResourceGroup, id.WorkspaceName, id.IotConnectorName) if err != nil { if utils.ResponseWasNotFound(resp.Response) { - d.SetId("") - return nil + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } diff --git a/internal/services/hpccache/hpc_cache_resource.go b/internal/services/hpccache/hpc_cache_resource.go index 63cd62a94e8a..ac60175df60a 100644 --- a/internal/services/hpccache/hpc_cache_resource.go +++ b/internal/services/hpccache/hpc_cache_resource.go @@ -593,7 +593,7 @@ func expandStorageCacheDirectorySettings(d *pluginsdk.ResourceData) *storagecach } func flattenStorageCacheDirectorySettings(d *pluginsdk.ResourceData, input *storagecache.CacheDirectorySettings) (ad, flatFile, ldap []interface{}, err error) { - if input == nil || input.UsernameDownload == nil { + if input == nil || input.UsernameDownload == nil || input.UsernameDownload.UsernameSource == storagecache.UsernameSourceNone { return nil, nil, nil, nil } diff --git a/internal/services/hsm/dedicated_hardware_security_module_resource.go b/internal/services/hsm/dedicated_hardware_security_module_resource.go index 7f050b53ee29..6b29493c5759 100644 --- a/internal/services/hsm/dedicated_hardware_security_module_resource.go +++ b/internal/services/hsm/dedicated_hardware_security_module_resource.go @@ -213,7 +213,7 @@ func resourceDedicatedHardwareSecurityModuleRead(d *pluginsdk.ResourceData, meta return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) + d.Set("name", id.DedicatedHSMName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/hybridcompute/client/client.go b/internal/services/hybridcompute/client/client.go new file mode 100644 index 000000000000..5c8f3cf336f6 --- /dev/null +++ b/internal/services/hybridcompute/client/client.go @@ -0,0 +1,32 @@ +package client + +import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions" + "github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines" + "github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +type Client struct { + MachineExtensionsClient *machineextensions.MachineExtensionsClient + MachinesClient *machines.MachinesClient + PrivateEndpointConnectionsClient *privateendpointconnections.PrivateEndpointConnectionsClient +} + +func NewClient(o *common.ClientOptions) *Client { + + machineExtensionsClient := machineextensions.NewMachineExtensionsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&machineExtensionsClient.Client, o.ResourceManagerAuthorizer) + + machinesClient := machines.NewMachinesClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&machinesClient.Client, o.ResourceManagerAuthorizer) + + privateEndpointConnectionsClient := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&privateEndpointConnectionsClient.Client, o.ResourceManagerAuthorizer) + + return &Client{ + MachineExtensionsClient: &machineExtensionsClient, + MachinesClient: &machinesClient, + PrivateEndpointConnectionsClient: &privateEndpointConnectionsClient, + } +} diff --git a/internal/services/hybridcompute/hybrid_compute_machine_data_source.go b/internal/services/hybridcompute/hybrid_compute_machine_data_source.go new file mode 100644 index 000000000000..bf7879d43335 --- /dev/null +++ b/internal/services/hybridcompute/hybrid_compute_machine_data_source.go @@ -0,0 +1,962 @@ +package hybridcompute + +import ( + "context" + "encoding/json" + "fmt" + "strconv" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type HybridComputeMachineModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + AgentConfiguration []AgentConfigurationModel `tfschema:"agent_configuration"` + ClientPublicKey string `tfschema:"client_public_key"` + CloudMetadata []CloudMetadataModel `tfschema:"cloud_metadata"` + DetectedProperties map[string]string `tfschema:"detected_properties"` + Location string `tfschema:"location"` + LocationData []LocationDataModel `tfschema:"location_data"` + MssqlDiscovered bool `tfschema:"mssql_discovered"` + OsProfile []OSProfileModel `tfschema:"os_profile"` + OsType string `tfschema:"os_type"` + ParentClusterResourceId string `tfschema:"parent_cluster_resource_id"` + PrivateLinkScopeResourceId string `tfschema:"private_link_scope_resource_id"` + ServiceStatuses []ServiceStatusesModel `tfschema:"service_status"` + Tags map[string]string `tfschema:"tags"` + VmId string `tfschema:"vm_id"` + AdFqdn string `tfschema:"ad_fqdn"` + AgentVersion string `tfschema:"agent_version"` + DisplayName string `tfschema:"display_name"` + DnsFqdn string `tfschema:"dns_fqdn"` + DomainName string `tfschema:"domain_name"` + ErrorDetails []ErrorDetailModel `tfschema:"error_details"` + LastStatusChange string `tfschema:"last_status_change"` + MachineFqdn string `tfschema:"machine_fqdn"` + OsName string `tfschema:"os_name"` + OsSku string `tfschema:"os_sku"` + OsVersion string `tfschema:"os_version"` + Status machines.StatusTypes `tfschema:"status"` + VmUuid string `tfschema:"vm_uuid"` +} + +type AgentConfigurationModel struct { + ExtensionsAllowList []ConfigurationExtensionModel `tfschema:"extensions_allow_list"` + ExtensionsBlockList []ConfigurationExtensionModel `tfschema:"extensions_block_list"` + ExtensionsEnabled bool `tfschema:"extensions_enabled"` + GuestConfigurationEnabled bool `tfschema:"guest_configuration_enabled"` + IncomingConnectionsPorts []string `tfschema:"incoming_connections_ports"` + ProxyBypass []string `tfschema:"proxy_bypass"` + ProxyUrl string `tfschema:"proxy_url"` +} + +type ConfigurationExtensionModel struct { + Publisher string `tfschema:"publisher"` + Type string `tfschema:"type"` +} + +type CloudMetadataModel struct { + Provider string `tfschema:"provider"` +} + +type LocationDataModel struct { + City string `tfschema:"city"` + CountryOrRegion string `tfschema:"country_or_region"` + District string `tfschema:"district"` + Name string `tfschema:"name"` +} + +type OSProfileModel struct { + ComputerName string `tfschema:"computer_name"` + LinuxConfiguration []OSProfileLinuxConfigurationModel `tfschema:"linux_configuration"` + WindowsConfiguration []OSProfileWindowsConfigurationModel `tfschema:"windows_configuration"` +} + +type OSProfileLinuxConfigurationModel struct { + PatchSettings []PatchSettingsModel `tfschema:"patch_settings"` +} + +type PatchSettingsModel struct { + AssessmentMode machines.AssessmentModeTypes `tfschema:"assessment_mode"` + PatchMode machines.PatchModeTypes `tfschema:"patch_mode"` +} + +type OSProfileWindowsConfigurationModel struct { + PatchSettings []PatchSettingsModel `tfschema:"patch_settings"` +} + +type ServiceStatusesModel struct { + ExtensionService []ServiceStatusModel `tfschema:"extension_service"` + GuestConfigurationService []ServiceStatusModel `tfschema:"guest_configuration_service"` +} + +type ServiceStatusModel struct { + StartupType string `tfschema:"startup_type"` + Status string `tfschema:"status"` +} + +type ErrorDetailModel struct { + AdditionalInfo []ErrorAdditionalInfoModel `tfschema:"additional_info"` + Code string `tfschema:"code"` + Message string `tfschema:"message"` + Target string `tfschema:"target"` +} + +type ErrorAdditionalInfoModel struct { + Info string `tfschema:"info"` + Type string `tfschema:"type"` +} + +type HybridComputeMachineDataSource struct{} + +var _ sdk.DataSource = HybridComputeMachineDataSource{} + +func (r HybridComputeMachineDataSource) ResourceType() string { + return "azurerm_hybrid_compute_machine" +} + +func (r HybridComputeMachineDataSource) ModelObject() interface{} { + return &HybridComputeMachineModel{} +} + +func (r HybridComputeMachineDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return machines.ValidateMachineID +} + +func (r HybridComputeMachineDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + } +} + +func (r HybridComputeMachineDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "agent_configuration": { + Type: pluginsdk.TypeList, + Computed: true, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "extensions_allow_list": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "publisher": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "extensions_block_list": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "publisher": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "extensions_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "guest_configuration_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "incoming_connections_ports": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "proxy_bypass": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "proxy_url": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "ad_fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "agent_version": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "client_public_key": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "cloud_metadata": { + Type: pluginsdk.TypeList, + Computed: true, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "provider": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "detected_properties": { + Type: pluginsdk.TypeMap, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "display_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "dns_fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "domain_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "error_details": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "additional_info": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "info": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "code": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "message": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "target": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "identity": commonschema.SystemAssignedIdentityComputed(), + + "last_status_change": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "location": commonschema.LocationComputed(), + + "location_data": { + Type: pluginsdk.TypeList, + Computed: true, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "city": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "country_or_region": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "district": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "machine_fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "mssql_discovered": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "os_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "os_profile": { + Type: pluginsdk.TypeList, + Computed: true, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "computer_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "linux_configuration": { + Type: pluginsdk.TypeList, + Computed: true, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "patch_settings": { + Type: pluginsdk.TypeList, + Computed: true, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "assessment_mode": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "patch_mode": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + + "windows_configuration": { + Type: pluginsdk.TypeList, + Computed: true, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "patch_settings": { + Type: pluginsdk.TypeList, + Computed: true, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "assessment_mode": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "patch_mode": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + + "os_sku": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "os_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "os_version": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "parent_cluster_resource_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "private_link_scope_resource_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "service_status": { + Type: pluginsdk.TypeList, + Computed: true, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "extension_service": { + Type: pluginsdk.TypeList, + Computed: true, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "startup_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "status": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "guest_configuration_service": { + Type: pluginsdk.TypeList, + Computed: true, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "startup_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "status": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + + "status": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "vm_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "vm_uuid": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + } +} + +func (r HybridComputeMachineDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.HybridCompute.MachinesClient + subscriptionId := metadata.Client.Account.SubscriptionId + + var hybridComputeMachineModel HybridComputeMachineModel + if err := metadata.Decode(&hybridComputeMachineModel); err != nil { + return err + } + + id := machines.NewMachineID(subscriptionId, hybridComputeMachineModel.ResourceGroupName, hybridComputeMachineModel.Name) + + resp, err := client.Get(ctx, id, machines.GetOperationOptions{}) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + state := HybridComputeMachineModel{ + Name: id.MachineName, + ResourceGroupName: id.ResourceGroupName, + Location: location.Normalize(model.Location), + } + + identityValue := identity.FlattenSystemAssigned(model.Identity) + + if err := metadata.ResourceData.Set("identity", identityValue); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } + + if properties := model.Properties; properties != nil { + if properties.AdFqdn != nil { + state.AdFqdn = *properties.AdFqdn + } + + agentConfigurationValue, err := flattenAgentConfigurationModel(properties.AgentConfiguration) + if err != nil { + return err + } + + state.AgentConfiguration = agentConfigurationValue + + if properties.AgentVersion != nil { + state.AgentVersion = *properties.AgentVersion + } + + if properties.ClientPublicKey != nil { + state.ClientPublicKey = *properties.ClientPublicKey + } + + cloudMetadataValue := flattenCloudMetadataModel(properties.CloudMetadata) + + state.CloudMetadata = cloudMetadataValue + + if properties.DetectedProperties != nil { + state.DetectedProperties = *properties.DetectedProperties + } + + if properties.DisplayName != nil { + state.DisplayName = *properties.DisplayName + } + + if properties.DnsFqdn != nil { + state.DnsFqdn = *properties.DnsFqdn + } + + if properties.DomainName != nil { + state.DomainName = *properties.DomainName + } + + errorDetailsValue := flattenErrorDetailModel(properties.ErrorDetails) + + state.ErrorDetails = errorDetailsValue + + if properties.LastStatusChange != nil { + state.LastStatusChange = *properties.LastStatusChange + } + + locationDataValue := flattenLocationDataModel(properties.LocationData) + + state.LocationData = locationDataValue + + if properties.MachineFqdn != nil { + state.MachineFqdn = *properties.MachineFqdn + } + + if properties.MssqlDiscovered != nil { + state.MssqlDiscovered, err = strconv.ParseBool(*properties.MssqlDiscovered) + if err != nil { + return err + } + } + + if properties.OsName != nil { + state.OsName = *properties.OsName + } + + osProfileValue := flattenOSProfileModel(properties.OsProfile) + + state.OsProfile = osProfileValue + + if properties.OsSku != nil { + state.OsSku = *properties.OsSku + } + + if properties.OsType != nil { + state.OsType = *properties.OsType + } + + if properties.OsVersion != nil { + state.OsVersion = *properties.OsVersion + } + + if properties.ParentClusterResourceId != nil { + state.ParentClusterResourceId = *properties.ParentClusterResourceId + } + + if properties.PrivateLinkScopeResourceId != nil { + state.PrivateLinkScopeResourceId = *properties.PrivateLinkScopeResourceId + } + + serviceStatusesValue := flattenServiceStatusesModel(properties.ServiceStatuses) + + state.ServiceStatuses = serviceStatusesValue + + if properties.Status != nil { + state.Status = *properties.Status + } + + if properties.VMId != nil { + state.VmId = *properties.VMId + } + + if properties.VMUuid != nil { + state.VmUuid = *properties.VMUuid + } + } + if model.Tags != nil { + state.Tags = *model.Tags + } + + metadata.SetID(id) + return metadata.Encode(&state) + }, + } +} + +func flattenAgentConfigurationModel(input *machines.AgentConfiguration) ([]AgentConfigurationModel, error) { + var outputList []AgentConfigurationModel + if input == nil { + return outputList, nil + } + + output := AgentConfigurationModel{} + + extensionsAllowListValue := flattenConfigurationExtensionModel(input.ExtensionsAllowList) + + output.ExtensionsAllowList = extensionsAllowListValue + + extensionsBlockListValue := flattenConfigurationExtensionModel(input.ExtensionsBlockList) + + output.ExtensionsBlockList = extensionsBlockListValue + + if input.ExtensionsEnabled != nil { + parsedBool, err := strconv.ParseBool(*input.ExtensionsEnabled) + if err != nil { + return nil, err + } + output.ExtensionsEnabled = parsedBool + } + + if input.GuestConfigurationEnabled != nil { + parsedBool, err := strconv.ParseBool(*input.GuestConfigurationEnabled) + if err != nil { + return nil, err + } + output.GuestConfigurationEnabled = parsedBool + } + + if input.IncomingConnectionsPorts != nil { + output.IncomingConnectionsPorts = *input.IncomingConnectionsPorts + } + + if input.ProxyBypass != nil { + output.ProxyBypass = *input.ProxyBypass + } + + if input.ProxyUrl != nil { + output.ProxyUrl = *input.ProxyUrl + } + + return append(outputList, output), nil +} + +func flattenConfigurationExtensionModel(inputList *[]machines.ConfigurationExtension) []ConfigurationExtensionModel { + var outputList []ConfigurationExtensionModel + if inputList == nil { + return outputList + } + + for _, input := range *inputList { + output := ConfigurationExtensionModel{} + + if input.Publisher != nil { + output.Publisher = *input.Publisher + } + + if input.Type != nil { + output.Type = *input.Type + } + + outputList = append(outputList, output) + } + + return outputList +} + +func flattenCloudMetadataModel(input *machines.CloudMetadata) []CloudMetadataModel { + var outputList []CloudMetadataModel + if input == nil { + return outputList + } + + output := CloudMetadataModel{} + + if input.Provider != nil { + output.Provider = *input.Provider + } + + return append(outputList, output) +} + +func flattenErrorDetailModel(inputList *[]machines.ErrorDetail) []ErrorDetailModel { + var outputList []ErrorDetailModel + if inputList == nil { + return outputList + } + + for _, input := range *inputList { + output := ErrorDetailModel{} + + additionalInfoValue := flattenErrorAdditionalInfoModel(input.AdditionalInfo) + + output.AdditionalInfo = additionalInfoValue + + if input.Code != nil { + output.Code = *input.Code + } + + if input.Message != nil { + output.Message = *input.Message + } + + if input.Target != nil { + output.Target = *input.Target + } + + outputList = append(outputList, output) + } + + return outputList +} + +func flattenErrorAdditionalInfoModel(inputList *[]machines.ErrorAdditionalInfo) []ErrorAdditionalInfoModel { + var outputList []ErrorAdditionalInfoModel + if inputList == nil { + return outputList + } + + for _, input := range *inputList { + output := ErrorAdditionalInfoModel{} + + if input.Info != nil && *input.Info != nil { + + infoValue, err := json.Marshal(*input.Info) + if err != nil { + return nil + } + + output.Info = string(infoValue) + } + + if input.Type != nil { + output.Type = *input.Type + } + + outputList = append(outputList, output) + } + + return outputList +} + +func flattenLocationDataModel(input *machines.LocationData) []LocationDataModel { + var outputList []LocationDataModel + if input == nil { + return outputList + } + + output := LocationDataModel{ + Name: input.Name, + } + + if input.City != nil { + output.City = *input.City + } + + if input.CountryOrRegion != nil { + output.CountryOrRegion = *input.CountryOrRegion + } + + if input.District != nil { + output.District = *input.District + } + + return append(outputList, output) +} + +func flattenOSProfileModel(input *machines.OSProfile) []OSProfileModel { + var outputList []OSProfileModel + if input == nil { + return outputList + } + + output := OSProfileModel{} + + if input.ComputerName != nil { + output.ComputerName = *input.ComputerName + } + + linuxConfigurationValue := flattenOSProfileLinuxConfigurationModel(input.LinuxConfiguration) + + output.LinuxConfiguration = linuxConfigurationValue + + windowsConfigurationValue := flattenOSProfileWindowsConfigurationModel(input.WindowsConfiguration) + output.WindowsConfiguration = windowsConfigurationValue + + return append(outputList, output) +} + +func flattenOSProfileLinuxConfigurationModel(input *machines.OSProfileLinuxConfiguration) []OSProfileLinuxConfigurationModel { + var outputList []OSProfileLinuxConfigurationModel + if input == nil { + return outputList + } + + output := OSProfileLinuxConfigurationModel{} + + patchSettingsValue := flattenPatchSettingsModel(input.PatchSettings) + + output.PatchSettings = patchSettingsValue + + return append(outputList, output) +} + +func flattenPatchSettingsModel(input *machines.PatchSettings) []PatchSettingsModel { + var outputList []PatchSettingsModel + if input == nil { + return outputList + } + + output := PatchSettingsModel{} + + if input.AssessmentMode != nil { + output.AssessmentMode = *input.AssessmentMode + } + + if input.PatchMode != nil { + output.PatchMode = *input.PatchMode + } + + return append(outputList, output) +} + +func flattenOSProfileWindowsConfigurationModel(input *machines.OSProfileWindowsConfiguration) []OSProfileWindowsConfigurationModel { + var outputList []OSProfileWindowsConfigurationModel + if input == nil { + return outputList + } + + output := OSProfileWindowsConfigurationModel{} + patchSettingsValue := flattenPatchSettingsModel(input.PatchSettings) + output.PatchSettings = patchSettingsValue + + return append(outputList, output) +} + +func flattenServiceStatusesModel(input *machines.ServiceStatuses) []ServiceStatusesModel { + var outputList []ServiceStatusesModel + if input == nil { + return outputList + } + + output := ServiceStatusesModel{} + + extensionServiceValue := flattenServiceStatusModel(input.ExtensionService) + output.ExtensionService = extensionServiceValue + + guestConfigurationServiceValue := flattenServiceStatusModel(input.GuestConfigurationService) + output.GuestConfigurationService = guestConfigurationServiceValue + + return append(outputList, output) +} + +func flattenServiceStatusModel(input *machines.ServiceStatus) []ServiceStatusModel { + var outputList []ServiceStatusModel + if input == nil { + return outputList + } + + output := ServiceStatusModel{} + + if input.StartupType != nil { + output.StartupType = *input.StartupType + } + + if input.Status != nil { + output.Status = *input.Status + } + + return append(outputList, output) +} diff --git a/internal/services/hybridcompute/hybrid_compute_machine_data_source_test.go b/internal/services/hybridcompute/hybrid_compute_machine_data_source_test.go new file mode 100644 index 000000000000..9a85e30bc46f --- /dev/null +++ b/internal/services/hybridcompute/hybrid_compute_machine_data_source_test.go @@ -0,0 +1,205 @@ +package hybridcompute_test + +import ( + "fmt" + "math/rand" + "os" + "testing" + + "github.com/hashicorp/go-uuid" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type HybridComputeMachineDataSource struct{} + +const LetterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +const NumberBytes = "1234567890" +const SpecialBytes = "!@#$%^()" + +func generateRandomPassword(n int) string { + b := make([]byte, n) + for i := range b { + r := rand.Int() + switch r % 3 { + case 0: + b[i] = LetterBytes[rand.Intn(len(LetterBytes))] + case 1: + b[i] = SpecialBytes[rand.Intn(len(SpecialBytes))] + case 2: + b[i] = NumberBytes[rand.Intn(len(NumberBytes))] + } + } + return string(b) +} + +func TestAccHybridComputeMachine_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_hybrid_compute_machine", "test") + d := HybridComputeMachineDataSource{} + clientSecret := os.Getenv("ARM_CLIENT_SECRET") + randomUUID, _ := uuid.GenerateUUID() + password := generateRandomPassword(10) + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: d.basic(data, clientSecret, randomUUID, password), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("agent_configuration.#").HasValue("1"), + check.That(data.ResourceName).Key("mssql_discovered").HasValue("false"), + check.That(data.ResourceName).Key("os_name").HasValue("linux"), + check.That(data.ResourceName).Key("os_profile.#").HasValue("1"), + ), + }, + }) +} + +func (r HybridComputeMachineDataSource) template(data acceptance.TestData, secret string, randomUUID string, password string) string { + return fmt.Sprintf(` +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } +} + +data "azurerm_client_config" "current" {} + +# note: real-life usage prefer random_uuid resource in registry.terraform.io/hashicorp/random +locals { + random_uuid = "%s" +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "acctestnw-%d" + address_space = ["10.0.0.0/16"] + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_subnet" "test" { + name = "internal" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test.name + address_prefixes = ["10.0.2.0/24"] +} + +resource "azurerm_network_interface" "test" { + name = "acctestnic-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + ip_configuration { + name = "internal" + subnet_id = azurerm_subnet.test.id + private_ip_address_allocation = "Dynamic" + public_ip_address_id = azurerm_public_ip.test.id + } +} + +resource "azurerm_network_security_group" "my_terraform_nsg" { + name = "myNetworkSecurityGroup" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + security_rule { + name = "SSH" + priority = 1001 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "22" + source_address_prefix = "*" + destination_address_prefix = "*" + } +} + +resource "azurerm_network_interface_security_group_association" "example" { + network_interface_id = azurerm_network_interface.test.id + network_security_group_id = azurerm_network_security_group.my_terraform_nsg.id +} + +resource "azurerm_public_ip" "test" { + name = "acctestpip-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + allocation_method = "Static" +} + +resource "azurerm_linux_virtual_machine" "test" { + name = "acctestVM-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + size = "Standard_F2" + admin_username = "adminuser" + admin_password = "%s" + provision_vm_agent = false + allow_extension_operations = false + disable_password_authentication = false + network_interface_ids = [ + azurerm_network_interface.test.id, + ] + + os_disk { + caching = "ReadWrite" + storage_account_type = "Standard_LRS" + } + + source_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "18.04-LTS" + version = "latest" + } + + connection { + type = "ssh" + host = azurerm_public_ip.test.ip_address + user = "adminuser" + password = "%s" + } + + provisioner "file" { + content = templatefile("scripts/install_arc.sh.tftpl", { + resource_group_name = azurerm_resource_group.test.name + uuid = local.random_uuid + location = azurerm_resource_group.test.location + tenant_id = data.azurerm_client_config.current.tenant_id + client_id = data.azurerm_client_config.current.client_id + client_secret = "%s" + subscription_id = data.azurerm_client_config.current.subscription_id + }) + destination = "/home/adminuser/install_arc_agent.sh" + } + + provisioner "remote-exec" { + inline = [ + "sudo apt-get install -y python-ctypes", + "sudo sed -i 's/\r$//' /home/adminuser/install_arc_agent.sh", + "sudo chmod +x /home/adminuser/install_arc_agent.sh", + "bash /home/adminuser/install_arc_agent.sh", + ] + } +} +`, randomUUID, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger, password, password, secret) +} + +func (r HybridComputeMachineDataSource) basic(data acceptance.TestData, secret string, randomUUID string, password string) string { + template := r.template(data, secret, randomUUID, password) + return fmt.Sprintf(` + %s + +data "azurerm_hybrid_compute_machine" "test" { + name = azurerm_linux_virtual_machine.test.name + resource_group_name = azurerm_resource_group.test.name + depends_on = [ + azurerm_linux_virtual_machine.test + ] +} +`, template) +} diff --git a/internal/services/hybridcompute/registration.go b/internal/services/hybridcompute/registration.go new file mode 100644 index 000000000000..77400764426d --- /dev/null +++ b/internal/services/hybridcompute/registration.go @@ -0,0 +1,49 @@ +package hybridcompute + +import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type Registration struct{} + +var ( + _ sdk.TypedServiceRegistrationWithAGitHubLabel = Registration{} + _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +) + +func (r Registration) AssociatedGitHubLabel() string { + return "service/hybrid-compute" +} + +// Name is the name of this Service +func (r Registration) Name() string { + return "Hybrid Compute" +} + +// WebsiteCategories returns a list of categories which can be used for the sidebar +func (r Registration) WebsiteCategories() []string { + return []string{ + "Hybrid Compute", + } +} + +// SupportedDataSources returns the supported Data Sources supported by this Service +func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { + return map[string]*pluginsdk.Resource{} +} + +// SupportedResources returns the supported Resources supported by this Service +func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { + return map[string]*pluginsdk.Resource{} +} + +// DataSources returns a list of Data Sources supported by this Service +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{HybridComputeMachineDataSource{}} +} + +// Resources returns a list of Resources supported by this Service +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{} +} diff --git a/internal/services/hybridcompute/scripts/install_arc.sh.tftpl b/internal/services/hybridcompute/scripts/install_arc.sh.tftpl new file mode 100644 index 000000000000..a44495683a45 --- /dev/null +++ b/internal/services/hybridcompute/scripts/install_arc.sh.tftpl @@ -0,0 +1,54 @@ +#!/bin/bash + +# Disable the Azure VM Guest Agent. +current_hostname=$(hostname) +sudo service walinuxagent stop +sudo waagent -deprovision -force +sudo rm -rf /var/lib/waagent +sudo hostnamectl set-hostname $current_hostname + +# Block access to the Azure IMDS endpoint. +sudo ufw --force enable +sudo ufw deny out from any to 169.254.169.254 +sudo ufw default allow incoming + +# Add the service principal application ID and secret here +servicePrincipalClientId="${client_id}" +servicePrincipalSecret="${client_secret}" +cloud="AzureCloud" +tenantId="${tenant_id}" +subscriptionId="${subscription_id}" +resourceGroup="${resource_group_name}" +location="${location}" +authType="principal" +correlationId="${uuid}" +output="$(wget https://aka.ms/azcmagent -O ~/install_linux_azcmagent.sh 2>&1)" +if [ $? != 0 ]; then + read -d '' bodyData < /dev/null || true +fi +echo "$output" +sudo chmod +x ~/install_linux_azcmagent.sh +cd ~ +./install_linux_azcmagent.sh +sudo azcmagent connect \ + --service-principal-id "$servicePrincipalClientId" \ + --service-principal-secret "$servicePrincipalSecret" \ + --cloud "$cloud" \ + --tenant-id "$tenantId" \ + --subscription-id "$subscriptionId" \ + --resource-group "$resourceGroup" \ + --location "$location" \ + --correlation-id "$correlationId" \ No newline at end of file diff --git a/internal/services/iotcentral/iotcentral_application_resource.go b/internal/services/iotcentral/iotcentral_application_resource.go index 5865b4c14c70..a8cdfe6591e2 100644 --- a/internal/services/iotcentral/iotcentral_application_resource.go +++ b/internal/services/iotcentral/iotcentral_application_resource.go @@ -121,22 +121,22 @@ func resourceIotCentralAppCreate(d *pluginsdk.ResourceData, meta interface{}) er } inputs := apps.OperationInputs{ - Name: id.ResourceName, + Name: id.IotAppName, } resp, err := client.CheckNameAvailability(ctx, commonids.NewSubscriptionID(id.SubscriptionId), inputs) if err != nil { - return fmt.Errorf("checking if the name %q was globally available: %+v", id.ResourceName, err) + return fmt.Errorf("checking if the name %q was globally available: %+v", id.IotAppName, err) } if model := resp.Model; model != nil { if !*model.NameAvailable { - return fmt.Errorf("the name %q cannot be used. Reason: %q Message: %q", id.ResourceName, *model.Reason, *model.Message) + return fmt.Errorf("the name %q cannot be used. Reason: %q Message: %q", id.IotAppName, *model.Reason, *model.Message) } } displayName := d.Get("display_name").(string) if displayName == "" { - displayName = id.ResourceName + displayName = id.IotAppName if !features.FourPointOhBeta() { displayName = id.ResourceGroupName } @@ -265,7 +265,7 @@ func resourceIotCentralAppRead(d *pluginsdk.ResourceData, meta interface{}) erro return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.ResourceName) + d.Set("name", id.IotAppName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/keyvault/key_vault_certificate_data_data_source.go b/internal/services/keyvault/key_vault_certificate_data_data_source.go index 731fba540c60..d0ae223bb44b 100644 --- a/internal/services/keyvault/key_vault_certificate_data_data_source.go +++ b/internal/services/keyvault/key_vault_certificate_data_data_source.go @@ -109,9 +109,7 @@ func dataSourceArmKeyVaultCertificateDataRead(d *pluginsdk.ResourceData, meta in cert, err := client.GetCertificate(ctx, *keyVaultBaseUri, name, version) if err != nil { if utils.ResponseWasNotFound(cert.Response) { - log.Printf("[DEBUG] Certificate %q was not found in Key Vault at URI %q - removing from state", name, *keyVaultBaseUri) - d.SetId("") - return nil + return fmt.Errorf("the Certificate %q was not found in Key Vault at URI %q", name, *keyVaultBaseUri) } return fmt.Errorf("reading Key Vault Certificate: %+v", err) @@ -121,12 +119,11 @@ func dataSourceArmKeyVaultCertificateDataRead(d *pluginsdk.ResourceData, meta in return fmt.Errorf("failure reading Key Vault Certificate ID for %q", name) } - d.SetId(*cert.ID) - - id, err := parse.ParseNestedItemID(d.Id()) + id, err := parse.ParseNestedItemID(*cert.ID) if err != nil { return err } + d.SetId(id.ID()) d.Set("name", id.Name) diff --git a/internal/services/keyvault/key_vault_certificate_data_source.go b/internal/services/keyvault/key_vault_certificate_data_source.go index ba50254e5774..610fc349dac8 100644 --- a/internal/services/keyvault/key_vault_certificate_data_source.go +++ b/internal/services/keyvault/key_vault_certificate_data_source.go @@ -4,7 +4,6 @@ import ( "encoding/base64" "encoding/hex" "fmt" - "log" "strings" "time" @@ -272,9 +271,7 @@ func dataSourceKeyVaultCertificateRead(d *pluginsdk.ResourceData, meta interface cert, err := client.GetCertificate(ctx, *keyVaultBaseUri, name, version) if err != nil { if utils.ResponseWasNotFound(cert.Response) { - log.Printf("[DEBUG] Certificate %q was not found in Key Vault at URI %q - removing from state", name, *keyVaultBaseUri) - d.SetId("") - return nil + return fmt.Errorf("a Certificate named %q was not found in Key Vault at URI %q", name, *keyVaultBaseUri) } return fmt.Errorf("reading Key Vault Certificate: %+v", err) @@ -284,12 +281,11 @@ func dataSourceKeyVaultCertificateRead(d *pluginsdk.ResourceData, meta interface return fmt.Errorf("failure reading Key Vault Certificate ID for %q", name) } - d.SetId(*cert.ID) - id, err := parse.ParseNestedItemID(*cert.ID) if err != nil { return err } + d.SetId(id.ID()) d.Set("name", id.Name) diff --git a/internal/services/keyvault/key_vault_certificate_resource_test.go b/internal/services/keyvault/key_vault_certificate_resource_test.go index d63b6cd37ae4..7b016022dac9 100644 --- a/internal/services/keyvault/key_vault_certificate_resource_test.go +++ b/internal/services/keyvault/key_vault_certificate_resource_test.go @@ -1320,6 +1320,7 @@ resource "azurerm_key_vault" "test" { "Purge", "Recover", "Update", + "List", ] key_permissions = [ diff --git a/internal/services/keyvault/key_vault_certificates_data_source.go b/internal/services/keyvault/key_vault_certificates_data_source.go new file mode 100644 index 000000000000..d010a8c56c3e --- /dev/null +++ b/internal/services/keyvault/key_vault_certificates_data_source.go @@ -0,0 +1,132 @@ +package keyvault + +import ( + "fmt" + "time" + + "github.com/Azure/azure-sdk-for-go/services/keyvault/v7.1/keyvault" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" + keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func dataSourceKeyVaultCertificates() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceKeyVaultCertificatesRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "key_vault_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: keyVaultValidate.VaultID, + }, + + "names": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "include_pending": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "certificates": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceKeyVaultCertificatesRead(d *pluginsdk.ResourceData, meta interface{}) error { + keyVaultsClient := meta.(*clients.Client).KeyVault + client := meta.(*clients.Client).KeyVault.ManagementClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + keyVaultId, err := parse.VaultID(d.Get("key_vault_id").(string)) + if err != nil { + return err + } + + includePending := d.Get("include_pending").(bool) + + keyVaultBaseUri, err := keyVaultsClient.BaseUriForKeyVault(ctx, *keyVaultId) + if err != nil { + return fmt.Errorf("fetching base vault url from id %q: %+v", *keyVaultId, err) + } + + certificateList, err := client.GetCertificatesComplete(ctx, *keyVaultBaseUri, utils.Int32(25), &includePending) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *keyVaultId, err) + } + + d.SetId(keyVaultId.ID()) + + var names []string + var certs []map[string]interface{} + if certificateList.Response().Value != nil { + for certificateList.NotDone() { + for _, v := range *certificateList.Response().Value { + nestedItem, err := parse.ParseOptionallyVersionedNestedItemID(*v.ID) + if err != nil { + return err + } + names = append(names, nestedItem.Name) + certs = append(certs, expandCertificate(nestedItem.Name, v)) + err = certificateList.NextWithContext(ctx) + if err != nil { + return fmt.Errorf("retrieving next page of Certificates from %s: %+v", *keyVaultId, err) + } + } + } + } + + d.Set("names", names) + d.Set("certificates", certs) + d.Set("key_vault_id", keyVaultId.ID()) + + return nil +} + +func expandCertificate(name string, item keyvault.CertificateItem) map[string]interface{} { + var cert = map[string]interface{}{ + "name": name, + "id": *item.ID, + } + if item.Attributes != nil && item.Attributes.Enabled != nil { + cert["enabled"] = *item.Attributes.Enabled + } + return cert +} diff --git a/internal/services/keyvault/key_vault_certificates_data_source_test.go b/internal/services/keyvault/key_vault_certificates_data_source_test.go new file mode 100644 index 000000000000..ea5ab65eff1e --- /dev/null +++ b/internal/services/keyvault/key_vault_certificates_data_source_test.go @@ -0,0 +1,84 @@ +package keyvault_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type KeyVaultCertificatesDataSource struct{} + +func TestAccDataSourceKeyVaultCertificates_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_key_vault_certificates", "test") + r := KeyVaultCertificatesDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("names.#").HasValue("31"), + check.That(data.ResourceName).Key("certificates.#").HasValue("31"), + ), + }, + }) +} + +func (KeyVaultCertificatesDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_key_vault_certificate" "test2" { + count = 30 + name = "certificate-${count.index}" + certificate_policy { + issuer_parameters { + name = "Self" + } + + key_properties { + exportable = true + key_size = 2048 + key_type = "RSA" + reuse_key = true + } + + lifetime_action { + action { + action_type = "AutoRenew" + } + + trigger { + days_before_expiry = 30 + } + } + + secret_properties { + content_type = "application/x-pkcs12" + } + + x509_certificate_properties { + key_usage = [ + "cRLSign", + "dataEncipherment", + "digitalSignature", + "keyAgreement", + "keyEncipherment", + "keyCertSign", + ] + + subject = "CN=hello-world" + validity_in_months = 12 + } + } + key_vault_id = azurerm_key_vault.test.id +} + +data "azurerm_key_vault_certificates" "test" { + key_vault_id = azurerm_key_vault.test.id + + depends_on = [azurerm_key_vault_certificate.test, azurerm_key_vault_certificate.test2] +} +`, KeyVaultCertificateResource{}.basicGenerate(data)) +} diff --git a/internal/services/keyvault/key_vault_secret_resource_test.go b/internal/services/keyvault/key_vault_secret_resource_test.go index 1dc25f52471c..65ef16c12efa 100644 --- a/internal/services/keyvault/key_vault_secret_resource_test.go +++ b/internal/services/keyvault/key_vault_secret_resource_test.go @@ -556,6 +556,7 @@ resource "azurerm_key_vault" "test" { "Recover", "Set", ] + } tags = { diff --git a/internal/services/keyvault/key_vault_secrets_data_source.go b/internal/services/keyvault/key_vault_secrets_data_source.go index a70def53b3a1..92a6d8648306 100644 --- a/internal/services/keyvault/key_vault_secrets_data_source.go +++ b/internal/services/keyvault/key_vault_secrets_data_source.go @@ -6,6 +6,8 @@ import ( "strings" "time" + "github.com/Azure/azure-sdk-for-go/services/keyvault/v7.1/keyvault" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" @@ -36,6 +38,29 @@ func dataSourceKeyVaultSecrets() *pluginsdk.Resource { Type: pluginsdk.TypeString, }, }, + + "secrets": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + }, + }, + }, }, } } @@ -64,6 +89,7 @@ func dataSourceKeyVaultSecretsRead(d *pluginsdk.ResourceData, meta interface{}) d.SetId(keyVaultId.ID()) var names []string + var secrets []map[string]interface{} if secretList.Response().Value != nil { for secretList.NotDone() { @@ -73,6 +99,7 @@ func dataSourceKeyVaultSecretsRead(d *pluginsdk.ResourceData, meta interface{}) return err } names = append(names, *name) + secrets = append(secrets, expandSecrets(*name, v)) err = secretList.NextWithContext(ctx) if err != nil { return fmt.Errorf("listing secrets on Azure KeyVault %q: %+v", *keyVaultId, err) @@ -82,6 +109,7 @@ func dataSourceKeyVaultSecretsRead(d *pluginsdk.ResourceData, meta interface{}) } d.Set("names", names) + d.Set("secrets", secrets) d.Set("key_vault_id", keyVaultId.ID()) return nil @@ -99,3 +127,14 @@ func parseNameFromSecretUrl(input string) (*string, error) { } return &segments[2], nil } + +func expandSecrets(name string, item keyvault.SecretItem) map[string]interface{} { + res := map[string]interface{}{ + "id": *item.ID, + "name": name, + } + if item.Attributes != nil && item.Attributes.Enabled != nil { + res["enabled"] = *item.Attributes.Enabled + } + return res +} diff --git a/internal/services/keyvault/key_vault_secrets_data_source_test.go b/internal/services/keyvault/key_vault_secrets_data_source_test.go index 856c4dc151bd..19bd264f1296 100644 --- a/internal/services/keyvault/key_vault_secrets_data_source_test.go +++ b/internal/services/keyvault/key_vault_secrets_data_source_test.go @@ -19,6 +19,7 @@ func TestAccDataSourceKeyVaultSecrets_basic(t *testing.T) { Config: r.basic(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).Key("names.#").HasValue("31"), + check.That(data.ResourceName).Key("secrets.#").HasValue("31"), ), }, }) diff --git a/internal/services/keyvault/registration.go b/internal/services/keyvault/registration.go index b34b43cb9b8c..e906a4212fe7 100644 --- a/internal/services/keyvault/registration.go +++ b/internal/services/keyvault/registration.go @@ -38,6 +38,7 @@ func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { "azurerm_key_vault_secret": dataSourceKeyVaultSecret(), "azurerm_key_vault_secrets": dataSourceKeyVaultSecrets(), "azurerm_key_vault": dataSourceKeyVault(), + "azurerm_key_vault_certificates": dataSourceKeyVaultCertificates(), } } diff --git a/internal/services/kusto/kusto_database_script_resource_test.go b/internal/services/kusto/kusto_database_script_resource_test.go index 723be94a96e1..00d58c25d7e1 100644 --- a/internal/services/kusto/kusto_database_script_resource_test.go +++ b/internal/services/kusto/kusto_database_script_resource_test.go @@ -5,11 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -116,7 +116,7 @@ func TestAccKustoScript_scriptContent(t *testing.T) { }) } -func (r KustoScriptResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r KustoScriptResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.ScriptID(state.ID) if err != nil { return nil, err diff --git a/internal/services/kusto/resourceids.go b/internal/services/kusto/resourceids.go index dce359cd216d..4e8c98299aff 100644 --- a/internal/services/kusto/resourceids.go +++ b/internal/services/kusto/resourceids.go @@ -4,8 +4,10 @@ package kusto //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Cluster -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Kusto/clusters/cluster1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ClusterPrincipalAssignment -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Kusto/clusters/cluster1/principalAssignments/assignment1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Database -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Kusto/clusters/cluster1/databases/database1 -rewrite=true -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DatabasePrincipal -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Kusto/Clusters/cluster1/Databases/database1/Role/Viewer/FQN/aaduser=11111111-1111-1111-1111-111111111111;22222222-2222-2222-2222-222222222222 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DatabasePrincipalAssignment -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Kusto/clusters/cluster1/databases/database1/principalAssignments/assignment1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DataConnection -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Kusto/clusters/cluster1/databases/database1/dataConnections/connection1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Script -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Kusto/clusters/cluster1/databases/database1/scripts/script1 -rewrite=true + +// @tombuildsstuff: these resources are going to need state migrations prior to switching to `hashicorp/go-azure-sdk` +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DatabasePrincipal -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Kusto/Clusters/cluster1/Databases/database1/Role/Viewer/FQN/aaduser=11111111-1111-1111-1111-111111111111;22222222-2222-2222-2222-222222222222 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ManagedPrivateEndpoints -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Kusto/Clusters/cluster1/ManagedPrivateEndpoints/endpoint1 -rewrite=true diff --git a/internal/services/labservice/client/client.go b/internal/services/labservice/client/client.go index 22dd76aa8a63..814421c5736e 100644 --- a/internal/services/labservice/client/client.go +++ b/internal/services/labservice/client/client.go @@ -3,14 +3,16 @@ package client import ( "github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/lab" "github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/labplan" + "github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule" "github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/user" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - LabClient *lab.LabClient - LabPlanClient *labplan.LabPlanClient - UserClient *user.UserClient + LabClient *lab.LabClient + LabPlanClient *labplan.LabPlanClient + ScheduleClient *schedule.ScheduleClient + UserClient *user.UserClient } func NewClient(o *common.ClientOptions) *Client { @@ -20,12 +22,16 @@ func NewClient(o *common.ClientOptions) *Client { LabPlanClient := labplan.NewLabPlanClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&LabPlanClient.Client, o.ResourceManagerAuthorizer) + ScheduleClient := schedule.NewScheduleClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&ScheduleClient.Client, o.ResourceManagerAuthorizer) + UserClient := user.NewUserClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&UserClient.Client, o.ResourceManagerAuthorizer) return &Client{ - LabClient: &LabClient, - LabPlanClient: &LabPlanClient, - UserClient: &UserClient, + LabClient: &LabClient, + LabPlanClient: &LabPlanClient, + ScheduleClient: &ScheduleClient, + UserClient: &UserClient, } } diff --git a/internal/services/labservice/lab_service_lab_resource.go b/internal/services/labservice/lab_service_lab_resource.go index dcb946fcd246..ff7f5c55ef22 100644 --- a/internal/services/labservice/lab_service_lab_resource.go +++ b/internal/services/labservice/lab_service_lab_resource.go @@ -757,7 +757,7 @@ func flattenAutoShutdownProfile(input lab.AutoShutdownProfile) []AutoShutdown { shutdownWhenNotConnectedEnabled := input.ShutdownWhenNotConnected != nil && *input.ShutdownWhenNotConnected != lab.EnableStateDisabled shutdownOnIdleModeConfigured := input.ShutdownOnIdle != nil && *input.ShutdownOnIdle != lab.ShutdownOnIdleModeNone idleDelayConfigured := input.IdleDelay != nil - if !shutdownOnDisconnectEnabled && !shutdownWhenNotConnectedEnabled && shutdownOnIdleModeConfigured && !idleDelayConfigured { + if !shutdownOnDisconnectEnabled && !shutdownWhenNotConnectedEnabled && !shutdownOnIdleModeConfigured && !idleDelayConfigured { return []AutoShutdown{} } diff --git a/internal/services/labservice/lab_service_schedule_resource.go b/internal/services/labservice/lab_service_schedule_resource.go new file mode 100644 index 000000000000..e7184cf9ac8b --- /dev/null +++ b/internal/services/labservice/lab_service_schedule_resource.go @@ -0,0 +1,392 @@ +package labservice + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/lab" + "github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule" + azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/labservice/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type LabServiceScheduleModel struct { + Name string `tfschema:"name"` + LabId string `tfschema:"lab_id"` + Notes string `tfschema:"notes"` + Recurrence []Recurrence `tfschema:"recurrence"` + StartTime string `tfschema:"start_time"` + StopTime string `tfschema:"stop_time"` + TimeZone string `tfschema:"time_zone"` +} + +type Recurrence struct { + ExpirationDate string `tfschema:"expiration_date"` + Frequency schedule.RecurrenceFrequency `tfschema:"frequency"` + Interval int64 `tfschema:"interval"` + WeekDays []string `tfschema:"week_days"` +} + +type LabServiceScheduleResource struct{} + +var _ sdk.ResourceWithUpdate = LabServiceScheduleResource{} + +func (r LabServiceScheduleResource) ResourceType() string { + return "azurerm_lab_service_schedule" +} + +func (r LabServiceScheduleResource) ModelObject() interface{} { + return &LabServiceScheduleModel{} +} + +func (r LabServiceScheduleResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return schedule.ValidateScheduleID +} + +func (r LabServiceScheduleResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "lab_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: lab.ValidateLabID, + }, + + "stop_time": { + Type: pluginsdk.TypeString, + Required: true, + DiffSuppressFunc: suppress.RFC3339MinuteTime, + ValidateFunc: validation.IsRFC3339Time, + }, + + "time_zone": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: azValidate.AzureTimeZoneString(), + }, + + "notes": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validate.ScheduleNotes, + }, + + "recurrence": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "expiration_date": { + Type: pluginsdk.TypeString, + Required: true, + DiffSuppressFunc: suppress.RFC3339MinuteTime, + ValidateFunc: validation.IsRFC3339Time, + }, + + "frequency": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(schedule.RecurrenceFrequencyDaily), + string(schedule.RecurrenceFrequencyWeekly), + }, false), + }, + + "interval": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 365), + }, + + "week_days": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + string(schedule.WeekDaySunday), + string(schedule.WeekDayMonday), + string(schedule.WeekDayTuesday), + string(schedule.WeekDayWednesday), + string(schedule.WeekDayThursday), + string(schedule.WeekDayFriday), + string(schedule.WeekDaySaturday), + }, false), + }, + }, + }, + }, + }, + + "start_time": { + Type: pluginsdk.TypeString, + Optional: true, + DiffSuppressFunc: suppress.RFC3339MinuteTime, + ValidateFunc: validation.IsRFC3339Time, + }, + } +} + +func (r LabServiceScheduleResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r LabServiceScheduleResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model LabServiceScheduleModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.LabService.ScheduleClient + labId, err := lab.ParseLabID(model.LabId) + if err != nil { + return err + } + + id := schedule.NewScheduleID(labId.SubscriptionId, labId.ResourceGroupName, labId.LabName, model.Name) + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + properties := &schedule.Schedule{ + Properties: schedule.ScheduleProperties{ + StopAt: model.StopTime, + TimeZoneId: model.TimeZone, + RecurrencePattern: expandRecurrencePattern(model.Recurrence), + }, + } + + if model.Notes != "" { + properties.Properties.Notes = &model.Notes + } + + if model.StartTime != "" { + properties.Properties.StartAt = &model.StartTime + } + + if _, err := client.CreateOrUpdate(ctx, id, *properties); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r LabServiceScheduleResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.LabService.ScheduleClient + + id, err := schedule.ParseScheduleID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model LabServiceScheduleModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + resp, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := resp.Model + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + if metadata.ResourceData.HasChange("notes") { + if model.Notes != "" { + properties.Properties.Notes = &model.Notes + } else { + properties.Properties.Notes = nil + } + } + + if metadata.ResourceData.HasChange("recurrence") { + properties.Properties.RecurrencePattern = expandRecurrencePattern(model.Recurrence) + } + + if metadata.ResourceData.HasChange("start_time") { + properties.Properties.StartAt = &model.StartTime + } + + if metadata.ResourceData.HasChange("stop_time") { + properties.Properties.StopAt = model.StopTime + } + + if metadata.ResourceData.HasChange("time_zone") { + properties.Properties.TimeZoneId = model.TimeZone + } + + if _, err := client.CreateOrUpdate(ctx, *id, *properties); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r LabServiceScheduleResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.LabService.ScheduleClient + + id, err := schedule.ParseScheduleID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + state := LabServiceScheduleModel{ + Name: id.ScheduleName, + LabId: lab.NewLabID(id.SubscriptionId, id.ResourceGroupName, id.LabName).ID(), + } + + properties := &model.Properties + + state.StopTime = properties.StopAt + state.TimeZone = properties.TimeZoneId + state.Recurrence = flattenRecurrencePattern(properties.RecurrencePattern) + + if properties.Notes != nil { + state.Notes = *properties.Notes + } + + if properties.StartAt != nil { + state.StartTime = *properties.StartAt + } + + return metadata.Encode(&state) + }, + } +} + +func (r LabServiceScheduleResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.LabService.ScheduleClient + + id, err := schedule.ParseScheduleID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} + +func expandRecurrencePattern(input []Recurrence) *schedule.RecurrencePattern { + if len(input) == 0 { + return nil + } + + recurrencePattern := input[0] + result := schedule.RecurrencePattern{ + ExpirationDate: recurrencePattern.ExpirationDate, + Frequency: recurrencePattern.Frequency, + WeekDays: expandWeekDays(recurrencePattern.WeekDays), + } + + if recurrencePattern.Interval != 0 { + result.Interval = utils.Int64(recurrencePattern.Interval) + } + + return &result +} + +func flattenRecurrencePattern(input *schedule.RecurrencePattern) []Recurrence { + var recurrencePatterns []Recurrence + if input == nil { + return recurrencePatterns + } + + recurrencePattern := Recurrence{ + ExpirationDate: input.ExpirationDate, + Frequency: input.Frequency, + WeekDays: flattenWeekDays(input.WeekDays), + } + + if input.Interval != nil { + recurrencePattern.Interval = *input.Interval + } + + return append(recurrencePatterns, recurrencePattern) +} + +func expandWeekDays(input []string) *[]schedule.WeekDay { + if len(input) == 0 { + return nil + } + + result := make([]schedule.WeekDay, 0) + + for _, item := range input { + result = append(result, schedule.WeekDay(item)) + } + + return &result +} + +func flattenWeekDays(input *[]schedule.WeekDay) []string { + if input == nil { + return nil + } + + result := make([]string, 0) + + for _, item := range *input { + result = append(result, string(item)) + } + + return result +} diff --git a/internal/services/labservice/lab_service_schedule_resource_test.go b/internal/services/labservice/lab_service_schedule_resource_test.go new file mode 100644 index 000000000000..0cab1382fa57 --- /dev/null +++ b/internal/services/labservice/lab_service_schedule_resource_test.go @@ -0,0 +1,231 @@ +package labservice_test + +import ( + "context" + "fmt" + "testing" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type LabServiceScheduleResource struct{} + +func TestAccLabServiceSchedule_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_lab_service_schedule", "test") + r := LabServiceScheduleResource{} + stopTime := time.Now().Add(time.Hour * 1).Format(time.RFC3339) + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data, stopTime), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccLabServiceSchedule_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_lab_service_schedule", "test") + r := LabServiceScheduleResource{} + stopTime := time.Now().Add(time.Hour * 1).Format(time.RFC3339) + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data, stopTime), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + { + Config: r.requiresImport(data, stopTime), + ExpectError: acceptance.RequiresImportError(data.ResourceType), + }, + }) +} + +func TestAccLabServiceSchedule_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_lab_service_schedule", "test") + r := LabServiceScheduleResource{} + + startTime := time.Now().Format(time.RFC3339) + stopTime := time.Now().Add(time.Hour * 1).Format(time.RFC3339) + expirationDate := time.Now().Add(time.Hour * 1).Format(time.RFC3339) + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data, startTime, stopTime, expirationDate), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccLabServiceSchedule_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_lab_service_schedule", "test") + r := LabServiceScheduleResource{} + + startTime := time.Now().Format(time.RFC3339) + stopTime := time.Now().Add(time.Hour * 1).Format(time.RFC3339) + expirationDate := time.Now().Add(time.Hour * 1).Format(time.RFC3339) + + updatedStartTime := time.Now().Add(time.Hour * 1).Format(time.RFC3339) + updatedStopTime := time.Now().Add(time.Hour * 2).Format(time.RFC3339) + updatedExpirationDate := time.Now().Add(time.Hour * 2).Format(time.RFC3339) + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data, startTime, stopTime, expirationDate), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data, updatedStartTime, updatedStopTime, updatedExpirationDate), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r LabServiceScheduleResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := schedule.ParseScheduleID(state.ID) + if err != nil { + return nil, err + } + + client := clients.LabService.ScheduleClient + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (r LabServiceScheduleResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-labschedule-%d" + location = "%s" +} + +resource "azurerm_lab_service_lab" "test" { + name = "acctest-lab-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + title = "Test Title" + + security { + open_access_enabled = false + } + + virtual_machine { + admin_user { + username = "testadmin" + password = "Password1234!" + } + + image_reference { + offer = "0001-com-ubuntu-server-focal" + publisher = "canonical" + sku = "20_04-lts" + version = "latest" + } + + sku { + name = "Classic_Fsv2_2_4GB_128_S_SSD" + capacity = 1 + } + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomIntOfLength(17)) +} + +func (r LabServiceScheduleResource) basic(data acceptance.TestData, stopTime string) string { + return fmt.Sprintf(` +%s + +resource "azurerm_lab_service_schedule" "test" { + name = "acctest-labschedule-%d" + lab_id = azurerm_lab_service_lab.test.id + stop_time = "%s" + time_zone = "America/Los_Angeles" +} +`, r.template(data), data.RandomInteger, stopTime) +} + +func (r LabServiceScheduleResource) requiresImport(data acceptance.TestData, stopTime string) string { + return fmt.Sprintf(` +%s + +resource "azurerm_lab_service_schedule" "import" { + name = azurerm_lab_service_schedule.test.name + lab_id = azurerm_lab_service_schedule.test.lab_id + stop_time = azurerm_lab_service_schedule.test.stop_time + time_zone = azurerm_lab_service_schedule.test.time_zone +} +`, r.basic(data, stopTime)) +} + +func (r LabServiceScheduleResource) complete(data acceptance.TestData, startTime, stopTime, expirationDate string) string { + return fmt.Sprintf(` +%s + +resource "azurerm_lab_service_schedule" "test" { + name = "acctest-labschedule-%d" + lab_id = azurerm_lab_service_lab.test.id + notes = "Testing" + start_time = "%s" + stop_time = "%s" + time_zone = "America/Los_Angeles" + + recurrence { + expiration_date = "%s" + frequency = "Weekly" + interval = 1 + week_days = ["Friday", "Thursday"] + } +} +`, r.template(data), data.RandomInteger, startTime, stopTime, expirationDate) +} + +func (r LabServiceScheduleResource) update(data acceptance.TestData, startTime, stopTime, expirationDate string) string { + return fmt.Sprintf(` +%s + +resource "azurerm_lab_service_schedule" "test" { + name = "acctest-labschedule-%d" + lab_id = azurerm_lab_service_lab.test.id + notes = "Testing2" + start_time = "%s" + stop_time = "%s" + time_zone = "America/Grenada" + + recurrence { + expiration_date = "%s" + frequency = "Daily" + interval = 2 + } +} +`, r.template(data), data.RandomInteger, startTime, stopTime, expirationDate) +} diff --git a/internal/services/labservice/lab_service_user_resource_test.go b/internal/services/labservice/lab_service_user_resource_test.go index 25277f872ef4..14f3665c77a3 100644 --- a/internal/services/labservice/lab_service_user_resource_test.go +++ b/internal/services/labservice/lab_service_user_resource_test.go @@ -140,7 +140,7 @@ resource "azurerm_lab_service_lab" "test" { } } } -`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +`, data.RandomInteger, data.Locations.Primary, data.RandomIntOfLength(17)) } func (r LabServiceUserResource) basic(data acceptance.TestData) string { diff --git a/internal/services/labservice/registration.go b/internal/services/labservice/registration.go index 736a6f511ea9..13f2cebae469 100644 --- a/internal/services/labservice/registration.go +++ b/internal/services/labservice/registration.go @@ -24,6 +24,7 @@ func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ LabServiceLabResource{}, LabServicePlanResource{}, + LabServiceScheduleResource{}, LabServiceUserResource{}, } } diff --git a/internal/services/labservice/validate/schedule_notes.go b/internal/services/labservice/validate/schedule_notes.go new file mode 100644 index 000000000000..22e5407b2d68 --- /dev/null +++ b/internal/services/labservice/validate/schedule_notes.go @@ -0,0 +1,15 @@ +package validate + +import ( + "fmt" + "regexp" +) + +func ScheduleNotes(v interface{}, k string) (warnings []string, errors []error) { + value := v.(string) + if matched := regexp.MustCompile(`^.{1,1000}$`).Match([]byte(value)); !matched { + errors = append(errors, fmt.Errorf("%q may only be up to 1000 characters in length", k)) + } + + return warnings, errors +} diff --git a/internal/services/labservice/validate/schedule_notes_test.go b/internal/services/labservice/validate/schedule_notes_test.go new file mode 100644 index 000000000000..2ef0926e64b8 --- /dev/null +++ b/internal/services/labservice/validate/schedule_notes_test.go @@ -0,0 +1,43 @@ +package validate + +import ( + "strings" + "testing" +) + +func TestValidateScheduleNotes(t *testing.T) { + cases := []struct { + Input string + ExpectError bool + }{ + { + Input: "", + ExpectError: true, + }, + { + Input: "hello", + ExpectError: false, + }, + { + Input: strings.Repeat("s", 999), + ExpectError: false, + }, + { + Input: strings.Repeat("s", 1000), + ExpectError: false, + }, + { + Input: strings.Repeat("s", 1001), + ExpectError: true, + }, + } + + for _, tc := range cases { + _, errors := ScheduleNotes(tc.Input, "notes") + + hasError := len(errors) > 0 + if tc.ExpectError && !hasError { + t.Fatalf("Expected the Lab Plan Name to trigger a validation error for '%s'", tc.Input) + } + } +} diff --git a/internal/services/legacy/virtual_machine_resource.go b/internal/services/legacy/virtual_machine_resource.go index ff02accfcd9f..2e32b5c99b22 100644 --- a/internal/services/legacy/virtual_machine_resource.go +++ b/internal/services/legacy/virtual_machine_resource.go @@ -29,7 +29,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/utils" "github.com/tombuildsstuff/giovanni/storage/2019-12-12/blob/blobs" "github.com/tombuildsstuff/kermit/sdk/compute/2022-08-01/compute" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" "golang.org/x/net/context" ) diff --git a/internal/services/loadbalancer/backend_address_pool_address_resource.go b/internal/services/loadbalancer/backend_address_pool_address_resource.go index 5c29e5a1c3ec..8815dc6bd21d 100644 --- a/internal/services/loadbalancer/backend_address_pool_address_resource.go +++ b/internal/services/loadbalancer/backend_address_pool_address_resource.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) var ( diff --git a/internal/services/loadbalancer/backend_address_pool_address_resource_test.go b/internal/services/loadbalancer/backend_address_pool_address_resource_test.go index b040e5351a57..6a3e1c8abeca 100644 --- a/internal/services/loadbalancer/backend_address_pool_address_resource_test.go +++ b/internal/services/loadbalancer/backend_address_pool_address_resource_test.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) var _ types.TestResourceVerifyingRemoved = BackendAddressPoolAddressResourceTests{} diff --git a/internal/services/loadbalancer/backend_address_pool_data_source.go b/internal/services/loadbalancer/backend_address_pool_data_source.go index 0dfb2b646b1c..3bfe50e3c832 100644 --- a/internal/services/loadbalancer/backend_address_pool_data_source.go +++ b/internal/services/loadbalancer/backend_address_pool_data_source.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourceArmLoadBalancerBackendAddressPool() *pluginsdk.Resource { diff --git a/internal/services/loadbalancer/backend_address_pool_resource.go b/internal/services/loadbalancer/backend_address_pool_resource.go index b30ce110131d..9039bfcf68a7 100644 --- a/internal/services/loadbalancer/backend_address_pool_resource.go +++ b/internal/services/loadbalancer/backend_address_pool_resource.go @@ -10,11 +10,12 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/validate" + networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) var backendAddressPoolResourceName = "azurerm_lb_backend_address_pool" @@ -101,6 +102,12 @@ func resourceArmLoadBalancerBackendAddressPool() *pluginsdk.Resource { }, }, + "virtual_network_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: networkValidate.VirtualNetworkID, + }, + "backend_ip_configurations": { Type: pluginsdk.TypeList, Computed: true, @@ -200,8 +207,19 @@ func resourceArmLoadBalancerBackendAddressPoolCreateUpdate(d *pluginsdk.Resource return fmt.Errorf("`tunnel_interface` is required for %q when sku is set to %s", id, sku.Name) } + if v, ok := d.GetOk("virtual_network_id"); ok { + param.BackendAddressPoolPropertiesFormat = &network.BackendAddressPoolPropertiesFormat{ + VirtualNetwork: &network.SubResource{ + ID: utils.String(v.(string)), + }} + } + switch sku.Name { case network.LoadBalancerSkuNameBasic: + if !d.IsNewResource() && d.HasChange("virtual_network_id") { + return fmt.Errorf("updating the virtual_network_id of Backend Address Pool %q is not allowed for basic (sku) Load Balancer", id) + } + // Insert this BAP and update the LB since the dedicated BAP endpoint doesn't work for the Basic sku. backendAddressPools := append(*lb.LoadBalancerPropertiesFormat.BackendAddressPools, param) _, existingPoolIndex, exists := FindLoadBalancerBackEndAddressPoolByName(&lb, id.BackendAddressPoolName) @@ -221,8 +239,10 @@ func resourceArmLoadBalancerBackendAddressPoolCreateUpdate(d *pluginsdk.Resource return fmt.Errorf("waiting for update of Load Balancer %q for Backend Address Pool %q: %+v", loadBalancerId, id, err) } case network.LoadBalancerSkuNameStandard: - param.BackendAddressPoolPropertiesFormat = &network.BackendAddressPoolPropertiesFormat{ - // NOTE: Backend Addresses are managed using `azurerm_lb_backend_pool_address` + if param.BackendAddressPoolPropertiesFormat == nil { + param.BackendAddressPoolPropertiesFormat = &network.BackendAddressPoolPropertiesFormat{ + // NOTE: Backend Addresses are managed using `azurerm_lb_backend_pool_address` + } } future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.LoadBalancerName, id.BackendAddressPoolName, param) @@ -234,9 +254,11 @@ func resourceArmLoadBalancerBackendAddressPoolCreateUpdate(d *pluginsdk.Resource return fmt.Errorf("waiting for Creating/Updating of Load Balancer Backend Address Pool %q: %+v", id, err) } case network.LoadBalancerSkuNameGateway: - param.BackendAddressPoolPropertiesFormat = &network.BackendAddressPoolPropertiesFormat{ - TunnelInterfaces: expandGatewayLoadBalancerTunnelInterfaces(d.Get("tunnel_interface").([]interface{})), + if param.BackendAddressPoolPropertiesFormat == nil { + param.BackendAddressPoolPropertiesFormat = &network.BackendAddressPoolPropertiesFormat{} } + param.BackendAddressPoolPropertiesFormat.TunnelInterfaces = expandGatewayLoadBalancerTunnelInterfaces(d.Get("tunnel_interface").([]interface{})) + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.LoadBalancerName, id.BackendAddressPoolName, param) if err != nil { return fmt.Errorf("creating/updating %q: %+v", id, err) @@ -295,6 +317,12 @@ func resourceArmLoadBalancerBackendAddressPoolRead(d *pluginsdk.ResourceData, me return fmt.Errorf("setting `backend_ip_configurations`: %v", err) } + network := "" + if vnet := props.VirtualNetwork; vnet != nil && vnet.ID != nil { + network = *vnet.ID + } + d.Set("virtual_network_id", network) + var loadBalancingRules []string if rules := props.LoadBalancingRules; rules != nil { for _, rule := range *rules { diff --git a/internal/services/loadbalancer/backend_address_pool_resource_test.go b/internal/services/loadbalancer/backend_address_pool_resource_test.go index c01da5f8d342..7d06b897a161 100644 --- a/internal/services/loadbalancer/backend_address_pool_resource_test.go +++ b/internal/services/loadbalancer/backend_address_pool_resource_test.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type LoadBalancerBackendAddressPool struct{} @@ -72,6 +72,20 @@ func TestAccBackendAddressPoolStandardSkuBasic(t *testing.T) { ), }, data.ImportStep(), + { + Config: r.standardSkuBasicUpdate(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.standardSkuBasic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), }) } @@ -259,6 +273,23 @@ resource "azurerm_lb_backend_address_pool" "test" { `, template) } +func (r LoadBalancerBackendAddressPool) standardSkuBasicUpdate(data acceptance.TestData) string { + template := r.template(data, "Standard") + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +%s + +resource "azurerm_lb_backend_address_pool" "test" { + name = "pool" + loadbalancer_id = azurerm_lb.test.id + virtual_network_id = azurerm_virtual_network.test.id +} +`, template) +} + func (r LoadBalancerBackendAddressPool) standardSkuRequiresImport(data acceptance.TestData) string { template := r.standardSkuBasic(data) return fmt.Sprintf(` @@ -349,6 +380,7 @@ resource "azurerm_lb_backend_address_pool" "test" { protocol = "VXLAN" port = 15001 } + virtual_network_id = azurerm_virtual_network.test.id } `, r.templateGateway(data)) } diff --git a/internal/services/loadbalancer/client/client.go b/internal/services/loadbalancer/client/client.go index a4e1e38a05e6..7f9ce5d09834 100644 --- a/internal/services/loadbalancer/client/client.go +++ b/internal/services/loadbalancer/client/client.go @@ -2,7 +2,7 @@ package client import ( "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type Client struct { diff --git a/internal/services/loadbalancer/loadbalancer.go b/internal/services/loadbalancer/loadbalancer.go index 3d54be8a062a..a476a475d2ba 100644 --- a/internal/services/loadbalancer/loadbalancer.go +++ b/internal/services/loadbalancer/loadbalancer.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) // TODO: refactor this diff --git a/internal/services/loadbalancer/loadbalancer_data_source.go b/internal/services/loadbalancer/loadbalancer_data_source.go index 82f64715d1e4..7ed80a7db70f 100644 --- a/internal/services/loadbalancer/loadbalancer_data_source.go +++ b/internal/services/loadbalancer/loadbalancer_data_source.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourceArmLoadBalancer() *pluginsdk.Resource { diff --git a/internal/services/loadbalancer/loadbalancer_nat_pool_resource_test.go b/internal/services/loadbalancer/loadbalancer_nat_pool_resource_test.go index be16bdf2a96b..f4ed9b3308e5 100644 --- a/internal/services/loadbalancer/loadbalancer_nat_pool_resource_test.go +++ b/internal/services/loadbalancer/loadbalancer_nat_pool_resource_test.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type LoadBalancerNatPool struct{} diff --git a/internal/services/loadbalancer/loadbalancer_nat_rule_resource_test.go b/internal/services/loadbalancer/loadbalancer_nat_rule_resource_test.go index 1fe524f8ad65..f1a38711d7f3 100644 --- a/internal/services/loadbalancer/loadbalancer_nat_rule_resource_test.go +++ b/internal/services/loadbalancer/loadbalancer_nat_rule_resource_test.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type LoadBalancerNatRule struct{} diff --git a/internal/services/loadbalancer/loadbalancer_outbound_rule_resource_test.go b/internal/services/loadbalancer/loadbalancer_outbound_rule_resource_test.go index c99b930f8302..ac3c23db1d75 100644 --- a/internal/services/loadbalancer/loadbalancer_outbound_rule_resource_test.go +++ b/internal/services/loadbalancer/loadbalancer_outbound_rule_resource_test.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type LoadBalancerOutboundRule struct{} diff --git a/internal/services/loadbalancer/loadbalancer_probe_resource_test.go b/internal/services/loadbalancer/loadbalancer_probe_resource_test.go index 2056ce5aa8b9..3d2abc0be02b 100644 --- a/internal/services/loadbalancer/loadbalancer_probe_resource_test.go +++ b/internal/services/loadbalancer/loadbalancer_probe_resource_test.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type LoadBalancerProbe struct{} diff --git a/internal/services/loadbalancer/loadbalancer_resource.go b/internal/services/loadbalancer/loadbalancer_resource.go index 5b845f0ba9ce..00cfa54566a4 100644 --- a/internal/services/loadbalancer/loadbalancer_resource.go +++ b/internal/services/loadbalancer/loadbalancer_resource.go @@ -26,7 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceArmLoadBalancer() *pluginsdk.Resource { diff --git a/internal/services/loadbalancer/loadbalancer_rule_resource_test.go b/internal/services/loadbalancer/loadbalancer_rule_resource_test.go index eabac8c2813c..f09bcc2ef154 100644 --- a/internal/services/loadbalancer/loadbalancer_rule_resource_test.go +++ b/internal/services/loadbalancer/loadbalancer_rule_resource_test.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type LoadBalancerRule struct{} diff --git a/internal/services/loadbalancer/nat_pool_resource.go b/internal/services/loadbalancer/nat_pool_resource.go index 6b4cacd7d0a3..8f8190f8fb7d 100644 --- a/internal/services/loadbalancer/nat_pool_resource.go +++ b/internal/services/loadbalancer/nat_pool_resource.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceArmLoadBalancerNatPool() *pluginsdk.Resource { diff --git a/internal/services/loadbalancer/nat_rule_resource.go b/internal/services/loadbalancer/nat_rule_resource.go index 558223e03069..4458de23ae68 100644 --- a/internal/services/loadbalancer/nat_rule_resource.go +++ b/internal/services/loadbalancer/nat_rule_resource.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceArmLoadBalancerNatRule() *pluginsdk.Resource { diff --git a/internal/services/loadbalancer/outbound_rule_data_source.go b/internal/services/loadbalancer/outbound_rule_data_source.go index 8bc706fe5127..e3e062e2610d 100644 --- a/internal/services/loadbalancer/outbound_rule_data_source.go +++ b/internal/services/loadbalancer/outbound_rule_data_source.go @@ -2,7 +2,6 @@ package loadbalancer import ( "fmt" - "log" "time" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -95,18 +94,14 @@ func dataSourceArmLoadBalancerOutboundRuleRead(d *pluginsdk.ResourceData, meta i loadBalancer, err := client.Get(ctx, loadBalancerId.ResourceGroup, loadBalancerId.Name, "") if err != nil { if utils.ResponseWasNotFound(loadBalancer.Response) { - d.SetId("") - log.Printf("[INFO] Load Balancer %q not found. Removing from state", loadBalancerId.Name) - return nil + return fmt.Errorf("parent %s was not found", *loadBalancerId) } - return fmt.Errorf("failed to retrieve Load Balancer %q (resource group %q) for Outbound Rule %q: %+v", loadBalancerId.Name, loadBalancerId.ResourceGroup, name, err) + return fmt.Errorf("retrieving parent %s: %+v", *loadBalancerId, err) } id := parse.NewLoadBalancerOutboundRuleID(loadBalancerId.SubscriptionId, loadBalancerId.ResourceGroup, loadBalancerId.Name, name) config, _, exists := FindLoadBalancerOutboundRuleByName(&loadBalancer, id.OutboundRuleName) if !exists { - d.SetId("") - log.Printf("[INFO] Load Balancer Outbound Rule %q not found. Removing from state", name) return fmt.Errorf("%s was not found", id) } diff --git a/internal/services/loadbalancer/outbound_rule_resource.go b/internal/services/loadbalancer/outbound_rule_resource.go index f945e3b7dd1c..dd6d7d7a31bb 100644 --- a/internal/services/loadbalancer/outbound_rule_resource.go +++ b/internal/services/loadbalancer/outbound_rule_resource.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceArmLoadBalancerOutboundRule() *pluginsdk.Resource { diff --git a/internal/services/loadbalancer/probe_resource.go b/internal/services/loadbalancer/probe_resource.go index a8be12b874dd..47de87848e27 100644 --- a/internal/services/loadbalancer/probe_resource.go +++ b/internal/services/loadbalancer/probe_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceArmLoadBalancerProbe() *pluginsdk.Resource { diff --git a/internal/services/loadbalancer/rule_data_source.go b/internal/services/loadbalancer/rule_data_source.go index 53d6eec0190b..ffa15b35e669 100644 --- a/internal/services/loadbalancer/rule_data_source.go +++ b/internal/services/loadbalancer/rule_data_source.go @@ -2,7 +2,6 @@ package loadbalancer import ( "fmt" - "log" "time" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -21,12 +20,82 @@ func dataSourceArmLoadBalancerRule() *pluginsdk.Resource { Read: pluginsdk.DefaultTimeout(5 * time.Minute), }, - Schema: dataSourceArmLoadBalancerSchema(), + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.RuleName, + }, + + "loadbalancer_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.LoadBalancerID, + }, + + "frontend_ip_configuration_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "protocol": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "frontend_port": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "backend_port": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "backend_address_pool_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "probe_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + // TODO 4.0: change this from enable_* to *_enabled + "enable_floating_ip": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + // TODO 4.0: change this from enable_* to *_enabled + "enable_tcp_reset": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "disable_outbound_snat": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "idle_timeout_in_minutes": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "load_distribution": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, } } func dataSourceArmLoadBalancerRuleRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).LoadBalancers.LoadBalancersClient + lbRuleClient := meta.(*clients.Client).LoadBalancers.LoadBalancingRulesClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -39,17 +108,11 @@ func dataSourceArmLoadBalancerRuleRead(d *pluginsdk.ResourceData, meta interface loadBalancer, err := client.Get(ctx, loadBalancerId.ResourceGroup, loadBalancerId.Name, "") if err != nil { if utils.ResponseWasNotFound(loadBalancer.Response) { - d.SetId("") - log.Printf("[INFO] Load Balancer %q not found. Removing from state", loadBalancerId.Name) - return nil + return fmt.Errorf("parent %s was not found", *loadBalancerId) } - return fmt.Errorf("failed to retrieve Load Balancer %q (resource group %q) for Rule %q: %+v", loadBalancerId.Name, loadBalancerId.ResourceGroup, name, err) + return fmt.Errorf("retrieving parent %s: %+v", *loadBalancerId, err) } - lbRuleClient := meta.(*clients.Client).LoadBalancers.LoadBalancingRulesClient - ctx, cancel = timeouts.ForRead(meta.(*clients.Client).StopContext, d) - defer cancel() - id := parse.NewLoadBalancingRuleID(loadBalancerId.SubscriptionId, loadBalancerId.ResourceGroup, loadBalancerId.Name, name) resp, err := lbRuleClient.Get(ctx, id.ResourceGroup, *loadBalancer.Name, name) if err != nil { @@ -107,76 +170,3 @@ func dataSourceArmLoadBalancerRuleRead(d *pluginsdk.ResourceData, meta interface return nil } - -func dataSourceArmLoadBalancerSchema() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "name": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validate.RuleName, - }, - - "loadbalancer_id": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validate.LoadBalancerID, - }, - - "frontend_ip_configuration_name": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "protocol": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "frontend_port": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "backend_port": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "backend_address_pool_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "probe_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - // TODO 4.0: change this from enable_* to *_enabled - "enable_floating_ip": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - - // TODO 4.0: change this from enable_* to *_enabled - "enable_tcp_reset": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - - "disable_outbound_snat": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - - "idle_timeout_in_minutes": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "load_distribution": { - Type: pluginsdk.TypeString, - Computed: true, - }, - } -} diff --git a/internal/services/loadbalancer/rule_resource.go b/internal/services/loadbalancer/rule_resource.go index 8df0464ff98a..a4c23da8f51a 100644 --- a/internal/services/loadbalancer/rule_resource.go +++ b/internal/services/loadbalancer/rule_resource.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceArmLoadBalancerRule() *pluginsdk.Resource { diff --git a/internal/services/loganalytics/log_analytics_data_export_resource.go b/internal/services/loganalytics/log_analytics_data_export_resource.go index a57c933a5d36..dbcc339ad913 100644 --- a/internal/services/loganalytics/log_analytics_data_export_resource.go +++ b/internal/services/loganalytics/log_analytics_data_export_resource.go @@ -152,7 +152,7 @@ func resourceOperationalinsightsDataExportCreateUpdate(d *pluginsdk.ResourceData destinationId = namespaces.NewNamespaceID(eventhubId.SubscriptionId, eventhubId.ResourceGroupName, eventhubId.NamespaceName).ID() parameters.Properties.Destination.ResourceId = destinationId parameters.Properties.Destination.MetaData = &dataexport.DestinationMetaData{ - EventHubName: utils.String(eventhubId.EventHubName), + EventHubName: utils.String(eventhubId.EventhubName), } } } @@ -240,7 +240,7 @@ func flattenDataExportDestination(input *dataexport.Destination) (string, error) if *input.Type == dataexport.TypeEventHub { if input.MetaData != nil && input.MetaData.EventHubName != nil { eventhubName := *input.MetaData.EventHubName - eventhubNamespaceId, err := eventhubs.ParseNamespaceID(resourceID) + eventhubNamespaceId, err := eventhubs.ParseNamespaceIDInsensitively(resourceID) eventhubId := eventhubs.NewEventhubID(eventhubNamespaceId.SubscriptionId, eventhubNamespaceId.ResourceGroupName, eventhubNamespaceId.NamespaceName, eventhubName) if err != nil { return "", fmt.Errorf("parsing destination eventhub namespace ID error") diff --git a/internal/services/loganalytics/log_analytics_query_pack_query_resource.go b/internal/services/loganalytics/log_analytics_query_pack_query_resource.go index 37cb02ee3cca..257f6c083f9b 100644 --- a/internal/services/loganalytics/log_analytics_query_pack_query_resource.go +++ b/internal/services/loganalytics/log_analytics_query_pack_query_resource.go @@ -505,7 +505,7 @@ func (r LogAnalyticsQueryPackQueryResource) Read() sdk.ResourceFunc { } state := LogAnalyticsQueryPackQueryModel{ - Name: id.Id, + Name: id.QueryName, QueryPackId: querypackqueries.NewQueryPackID(id.SubscriptionId, id.ResourceGroupName, id.QueryPackName).ID(), Body: props.Body, DisplayName: props.DisplayName, diff --git a/internal/services/loganalytics/log_analytics_storage_insights_resource.go b/internal/services/loganalytics/log_analytics_storage_insights_resource.go index 9b9753d5037a..50f10e8af4f2 100644 --- a/internal/services/loganalytics/log_analytics_storage_insights_resource.go +++ b/internal/services/loganalytics/log_analytics_storage_insights_resource.go @@ -9,12 +9,11 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/storageinsights" + "github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/storageaccounts" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/validate" - storageParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" - storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -121,7 +120,7 @@ func resourceLogAnalyticsStorageInsightsRead(d *pluginsdk.ResourceData, meta int return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.StorageInsightName) + d.Set("name", id.StorageInsightConfigName) d.Set("resource_group_name", id.ResourceGroupName) d.Set("workspace_id", storageinsights.NewWorkspaceID(id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName).ID()) @@ -131,7 +130,7 @@ func resourceLogAnalyticsStorageInsightsRead(d *pluginsdk.ResourceData, meta int storageAccountIdStr := "" if props.StorageAccount.Id != "" { - storageAccountId, err := storageParse.StorageAccountID(props.StorageAccount.Id) + storageAccountId, err := storageaccounts.ParseStorageAccountIDInsensitively(props.StorageAccount.Id) if err != nil { return err } @@ -190,7 +189,7 @@ func resourceLogAnalyticsStorageInsightsSchema() map[string]*pluginsdk.Schema { "storage_account_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: storageValidate.StorageAccountID, + ValidateFunc: storageaccounts.ValidateStorageAccountID, }, "storage_account_key": { diff --git a/internal/services/loganalytics/log_analytics_workspace_resource.go b/internal/services/loganalytics/log_analytics_workspace_resource.go index a08b2db7fa88..0a5a505809f0 100644 --- a/internal/services/loganalytics/log_analytics_workspace_resource.go +++ b/internal/services/loganalytics/log_analytics_workspace_resource.go @@ -38,10 +38,11 @@ func resourceLogAnalyticsWorkspace() *pluginsdk.Resource { return err }), - SchemaVersion: 2, + SchemaVersion: 3, StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ 0: migration.WorkspaceV0ToV1{}, 1: migration.WorkspaceV1ToV2{}, + 2: migration.WorkspaceV2ToV3{}, }), Timeouts: &pluginsdk.ResourceTimeout{ @@ -69,6 +70,12 @@ func resourceLogAnalyticsWorkspace() *pluginsdk.Resource { Default: true, }, + "local_authentication_disabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + "cmk_for_query_forced": { Type: pluginsdk.TypeBool, Optional: true, @@ -245,6 +252,7 @@ func resourceLogAnalyticsWorkspaceCreateUpdate(d *pluginsdk.ResourceData, meta i } allowResourceOnlyPermission := d.Get("allow_resource_only_permissions").(bool) + disableLocalAuth := d.Get("local_authentication_disabled").(bool) parameters := workspaces.Workspace{ Name: &name, @@ -257,6 +265,7 @@ func resourceLogAnalyticsWorkspaceCreateUpdate(d *pluginsdk.ResourceData, meta i RetentionInDays: &retentionInDays, Features: &workspaces.WorkspaceFeatures{ EnableLogAccessUsingOnlyResourcePermissions: utils.Bool(allowResourceOnlyPermission), + DisableLocalAuth: utils.Bool(disableLocalAuth), }, }, } @@ -408,13 +417,19 @@ func resourceLogAnalyticsWorkspaceRead(d *pluginsdk.ResourceData, meta interface } allowResourceOnlyPermissions := true + disableLocalAuth := false if features := props.Features; features != nil { v := features.EnableLogAccessUsingOnlyResourcePermissions if v != nil { allowResourceOnlyPermissions = *v } + d := features.DisableLocalAuth + if d != nil { + disableLocalAuth = *d + } } d.Set("allow_resource_only_permissions", allowResourceOnlyPermissions) + d.Set("local_authentication_disabled", disableLocalAuth) sharedKeyId := sharedKeyWorkspaces.WorkspaceId{ SubscriptionId: id.SubscriptionId, diff --git a/internal/services/loganalytics/log_analytics_workspace_resource_test.go b/internal/services/loganalytics/log_analytics_workspace_resource_test.go index 0e298e45abeb..f0c7b5a8a606 100644 --- a/internal/services/loganalytics/log_analytics_workspace_resource_test.go +++ b/internal/services/loganalytics/log_analytics_workspace_resource_test.go @@ -302,6 +302,32 @@ func TestAccLogAnalyticsWorkspace_ToggleAllowOnlyResourcePermission(t *testing.T }) } +func TestAccLogAnalyticsWorkspace_ToggleDisableLocalAuth(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_log_analytics_workspace", "test") + r := LogAnalyticsWorkspaceResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withDisableLocalAuth(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + { + Config: r.withDisableLocalAuth(data, false), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + { + Config: r.withDisableLocalAuth(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + }) +} + func (t LogAnalyticsWorkspaceResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := workspaces.ParseWorkspaceID(state.ID) if err != nil { @@ -642,3 +668,25 @@ resource "azurerm_log_analytics_workspace" "test" { } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, useResourceOnlyPermission) } + +func (LogAnalyticsWorkspaceResource) withDisableLocalAuth(data acceptance.TestData, disableLocalAuth bool) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_log_analytics_workspace" "test" { + name = "acctestLAW-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "PerGB2018" + retention_in_days = 30 + local_authentication_disabled = %[4]t +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, disableLocalAuth) +} diff --git a/internal/services/loganalytics/migration/workspace_v2_to_v3.go b/internal/services/loganalytics/migration/workspace_v2_to_v3.go new file mode 100644 index 000000000000..18984d3655a6 --- /dev/null +++ b/internal/services/loganalytics/migration/workspace_v2_to_v3.go @@ -0,0 +1,119 @@ +package migration + +import ( + "context" + "log" + + "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ pluginsdk.StateUpgrade = WorkspaceV2ToV3{} + +type WorkspaceV2ToV3 struct{} + +func (WorkspaceV2ToV3) Schema() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "allow_resource_only_permissions": { + Optional: true, + Type: pluginsdk.TypeBool, + }, + + "cmk_for_query_forced": { + Optional: true, + Type: pluginsdk.TypeBool, + }, + + "daily_quota_gb": { + Optional: true, + Type: pluginsdk.TypeFloat, + }, + + "internet_ingestion_enabled": { + Optional: true, + Type: pluginsdk.TypeBool, + }, + + "internet_query_enabled": { + Optional: true, + Type: pluginsdk.TypeBool, + }, + + "local_authentication_disabled": { + Optional: true, + Type: pluginsdk.TypeBool, + }, + + "location": { + ForceNew: true, + Required: true, + Type: pluginsdk.TypeString, + }, + + "name": { + ForceNew: true, + Required: true, + Type: pluginsdk.TypeString, + }, + + "primary_shared_key": { + Computed: true, + Type: pluginsdk.TypeString, + }, + + "reservation_capacity_in_gb_per_day": { + Computed: true, + Optional: true, + Type: pluginsdk.TypeInt, + }, + + "resource_group_name": { + ForceNew: true, + Required: true, + Type: pluginsdk.TypeString, + }, + + "retention_in_days": { + Computed: true, + Optional: true, + Type: pluginsdk.TypeInt, + }, + + "secondary_shared_key": { + Computed: true, + Type: pluginsdk.TypeString, + }, + + "sku": { + Computed: true, + Optional: true, + Type: pluginsdk.TypeString, + }, + + "tags": { + Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, + Optional: true, + Type: pluginsdk.TypeMap, + }, + + "workspace_id": { + Computed: true, + Type: pluginsdk.TypeString, + }, + } +} + +func (WorkspaceV2ToV3) UpgradeFunc() pluginsdk.StateUpgraderFunc { + return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + oldId := rawState["id"].(string) + newId, err := workspaces.ParseWorkspaceIDInsensitively(oldId) + if err != nil { + return nil, err + } + + log.Printf("[DEBUG] Updating ID from %q to %q", oldId, newId) + + rawState["id"] = newId.ID() + return rawState, nil + } +} diff --git a/internal/services/logic/client/client.go b/internal/services/logic/client/client.go index a93288b8f94d..a10c1e0bbfcc 100644 --- a/internal/services/logic/client/client.go +++ b/internal/services/logic/client/client.go @@ -1,60 +1,71 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - IntegrationAccountClient *logic.IntegrationAccountsClient - IntegrationAccountAgreementClient *logic.IntegrationAccountAgreementsClient - IntegrationAccountAssemblyClient *logic.IntegrationAccountAssembliesClient - IntegrationAccountBatchConfigurationClient *logic.IntegrationAccountBatchConfigurationsClient - IntegrationAccountCertificateClient *logic.IntegrationAccountCertificatesClient - IntegrationAccountMapClient *logic.IntegrationAccountMapsClient - IntegrationAccountPartnerClient *logic.IntegrationAccountPartnersClient - IntegrationAccountSchemaClient *logic.IntegrationAccountSchemasClient - IntegrationAccountSessionClient *logic.IntegrationAccountSessionsClient - IntegrationServiceEnvironmentClient *logic.IntegrationServiceEnvironmentsClient - WorkflowClient *logic.WorkflowsClient - TriggersClient *logic.WorkflowTriggersClient + IntegrationAccountClient *integrationaccounts.IntegrationAccountsClient + IntegrationAccountAgreementClient *integrationaccountagreements.IntegrationAccountAgreementsClient + IntegrationAccountAssemblyClient *integrationaccountassemblies.IntegrationAccountAssembliesClient + IntegrationAccountBatchConfigurationClient *integrationaccountbatchconfigurations.IntegrationAccountBatchConfigurationsClient + IntegrationAccountCertificateClient *integrationaccountcertificates.IntegrationAccountCertificatesClient + IntegrationAccountMapClient *integrationaccountmaps.IntegrationAccountMapsClient + IntegrationAccountPartnerClient *integrationaccountpartners.IntegrationAccountPartnersClient + IntegrationAccountSchemaClient *integrationaccountschemas.IntegrationAccountSchemasClient + IntegrationAccountSessionClient *integrationaccountsessions.IntegrationAccountSessionsClient + IntegrationServiceEnvironmentClient *integrationserviceenvironments.IntegrationServiceEnvironmentsClient + WorkflowClient *workflows.WorkflowsClient + TriggersClient *workflowtriggers.WorkflowTriggersClient } func NewClient(o *common.ClientOptions) *Client { - integrationAccountClient := logic.NewIntegrationAccountsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + integrationAccountClient := integrationaccounts.NewIntegrationAccountsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&integrationAccountClient.Client, o.ResourceManagerAuthorizer) - integrationAccountAgreementClient := logic.NewIntegrationAccountAgreementsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + integrationAccountAgreementClient := integrationaccountagreements.NewIntegrationAccountAgreementsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&integrationAccountAgreementClient.Client, o.ResourceManagerAuthorizer) - integrationAccountAssemblyClient := logic.NewIntegrationAccountAssembliesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + integrationAccountAssemblyClient := integrationaccountassemblies.NewIntegrationAccountAssembliesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&integrationAccountAssemblyClient.Client, o.ResourceManagerAuthorizer) - integrationAccountBatchConfigurationClient := logic.NewIntegrationAccountBatchConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + integrationAccountBatchConfigurationClient := integrationaccountbatchconfigurations.NewIntegrationAccountBatchConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&integrationAccountBatchConfigurationClient.Client, o.ResourceManagerAuthorizer) - integrationAccountCertificateClient := logic.NewIntegrationAccountCertificatesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + integrationAccountCertificateClient := integrationaccountcertificates.NewIntegrationAccountCertificatesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&integrationAccountCertificateClient.Client, o.ResourceManagerAuthorizer) - integrationAccountMapClient := logic.NewIntegrationAccountMapsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + integrationAccountMapClient := integrationaccountmaps.NewIntegrationAccountMapsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&integrationAccountMapClient.Client, o.ResourceManagerAuthorizer) - integrationAccountPartnerClient := logic.NewIntegrationAccountPartnersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + integrationAccountPartnerClient := integrationaccountpartners.NewIntegrationAccountPartnersClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&integrationAccountPartnerClient.Client, o.ResourceManagerAuthorizer) - integrationAccountSchemaClient := logic.NewIntegrationAccountSchemasClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + integrationAccountSchemaClient := integrationaccountschemas.NewIntegrationAccountSchemasClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&integrationAccountSchemaClient.Client, o.ResourceManagerAuthorizer) - integrationAccountSessionClient := logic.NewIntegrationAccountSessionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + integrationAccountSessionClient := integrationaccountsessions.NewIntegrationAccountSessionsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&integrationAccountSessionClient.Client, o.ResourceManagerAuthorizer) - integrationServiceEnvironmentClient := logic.NewIntegrationServiceEnvironmentsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + integrationServiceEnvironmentClient := integrationserviceenvironments.NewIntegrationServiceEnvironmentsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&integrationServiceEnvironmentClient.Client, o.ResourceManagerAuthorizer) - workflowClient := logic.NewWorkflowsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + workflowClient := workflows.NewWorkflowsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&workflowClient.Client, o.ResourceManagerAuthorizer) - triggersClient := logic.NewWorkflowTriggersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + triggersClient := workflowtriggers.NewWorkflowTriggersClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&triggersClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/internal/services/logic/integration_service_environment.go b/internal/services/logic/integration_service_environment.go index a9269669a26e..106877cb49ec 100644 --- a/internal/services/logic/integration_service_environment.go +++ b/internal/services/logic/integration_service_environment.go @@ -8,22 +8,22 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/validate" networkParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceIntegrationServiceEnvironment() *pluginsdk.Resource { @@ -35,7 +35,7 @@ func resourceIntegrationServiceEnvironment() *pluginsdk.Resource { DeprecationMessage: "The \"azurerm_integrated_service_environment\" resource is deprecated and will be removed in v4.0 of the Azure Provider. The underlying Azure Service is being retired on 2024-08-31 and new instances cannot be provisioned by default after 2022-11-01. More information on the retirement and how to migrate to Logic Apps Standard (\"azurerm_logic_app_standard\") can be found here: https://aka.ms/isedeprecation.", Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.IntegrationServiceEnvironmentID(id) + _, err := integrationserviceenvironments.ParseIntegrationServiceEnvironmentID(id) return err }), @@ -85,8 +85,8 @@ func resourceIntegrationServiceEnvironment() *pluginsdk.Resource { Required: true, ForceNew: true, // The access end point type cannot be changed once the integration service environment is provisioned. ValidateFunc: validation.StringInSlice([]string{ - string(logic.IntegrationServiceEnvironmentAccessEndpointTypeInternal), - string(logic.IntegrationServiceEnvironmentAccessEndpointTypeExternal), + string(integrationserviceenvironments.IntegrationServiceEnvironmentAccessEndpointTypeInternal), + string(integrationserviceenvironments.IntegrationServiceEnvironmentAccessEndpointTypeExternal), }, false), }, @@ -126,7 +126,7 @@ func resourceIntegrationServiceEnvironment() *pluginsdk.Resource { Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, CustomizeDiff: pluginsdk.CustomDiffWithAll( @@ -148,23 +148,23 @@ func resourceIntegrationServiceEnvironmentCreateUpdate(d *pluginsdk.ResourceData log.Printf("[INFO] preparing arguments for Azure ARM Integration Service Environment creation.") - id := parse.NewIntegrationServiceEnvironmentID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := integrationserviceenvironments.NewIntegrationServiceEnvironmentID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_integration_service_environment", id.ID()) } } location := azure.NormalizeLocation(d.Get("location").(string)) - accessEndpointType := d.Get("access_endpoint_type").(string) + accessEndpointType := integrationserviceenvironments.IntegrationServiceEnvironmentAccessEndpointType(d.Get("access_endpoint_type").(string)) virtualNetworkSubnetIds := d.Get("virtual_network_subnet_ids").(*pluginsdk.Set).List() t := d.Get("tags").(map[string]interface{}) @@ -173,13 +173,13 @@ func resourceIntegrationServiceEnvironmentCreateUpdate(d *pluginsdk.ResourceData return fmt.Errorf("expanding `sku_name` for %s: %v", id, err) } - integrationServiceEnvironment := logic.IntegrationServiceEnvironment{ - Name: &id.Name, + integrationServiceEnvironment := integrationserviceenvironments.IntegrationServiceEnvironment{ + Name: &id.IntegrationServiceEnvironmentName, Location: &location, - Properties: &logic.IntegrationServiceEnvironmentProperties{ - NetworkConfiguration: &logic.NetworkConfiguration{ - AccessEndpoint: &logic.IntegrationServiceEnvironmentAccessEndpoint{ - Type: logic.IntegrationServiceEnvironmentAccessEndpointType(accessEndpointType), + Properties: &integrationserviceenvironments.IntegrationServiceEnvironmentProperties{ + NetworkConfiguration: &integrationserviceenvironments.NetworkConfiguration{ + AccessEndpoint: &integrationserviceenvironments.IntegrationServiceEnvironmentAccessEndpoint{ + Type: &accessEndpointType, }, Subnets: expandSubnetResourceID(virtualNetworkSubnetIds), }, @@ -188,15 +188,10 @@ func resourceIntegrationServiceEnvironmentCreateUpdate(d *pluginsdk.ResourceData Tags: tags.Expand(t), } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, integrationServiceEnvironment) - if err != nil { + if err = client.CreateOrUpdateThenPoll(ctx, id, integrationServiceEnvironment); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for completion of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceIntegrationServiceEnvironmentRead(d, meta) @@ -207,58 +202,60 @@ func resourceIntegrationServiceEnvironmentRead(d *pluginsdk.ResourceData, meta i ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationServiceEnvironmentID(d.Id()) + id, err := integrationserviceenvironments.ParseIntegrationServiceEnvironmentID(d.Id()) if err != nil { return err } - name := id.Name - resourceGroup := id.ResourceGroup - - resp, err := client.Get(ctx, resourceGroup, name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("retrieving Integration Service Environment %q (Resource Group %q): %+v", name, resourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id.ID(), err) } - d.Set("name", name) - d.Set("resource_group_name", resourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.IntegrationServiceEnvironmentName) + d.Set("resource_group_name", id.ResourceGroup) - if err := d.Set("sku_name", flattenIntegrationServiceEnvironmentSkuName(resp.Sku)); err != nil { - return fmt.Errorf("setting `sku_name`: %+v", err) - } + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) - if props := resp.Properties; props != nil { - if netCfg := props.NetworkConfiguration; netCfg != nil { - if accessEndpoint := netCfg.AccessEndpoint; accessEndpoint != nil { - d.Set("access_endpoint_type", accessEndpoint.Type) + if err := d.Set("sku_name", flattenIntegrationServiceEnvironmentSkuName(model.Sku)); err != nil { + return fmt.Errorf("setting `sku_name`: %+v", err) + } + + if props := model.Properties; props != nil { + if netCfg := props.NetworkConfiguration; netCfg != nil { + if accessEndpoint := netCfg.AccessEndpoint; accessEndpoint != nil { + d.Set("access_endpoint_type", accessEndpoint.Type) + } + + d.Set("virtual_network_subnet_ids", flattenSubnetResourceID(netCfg.Subnets)) } - d.Set("virtual_network_subnet_ids", flattenSubnetResourceID(netCfg.Subnets)) - } + if props.EndpointsConfiguration == nil || props.EndpointsConfiguration.Connector == nil { + d.Set("connector_endpoint_ip_addresses", []interface{}{}) + d.Set("connector_outbound_ip_addresses", []interface{}{}) + } else { + d.Set("connector_endpoint_ip_addresses", flattenServiceEnvironmentIPAddresses(props.EndpointsConfiguration.Connector.AccessEndpointIPAddresses)) + d.Set("connector_outbound_ip_addresses", flattenServiceEnvironmentIPAddresses(props.EndpointsConfiguration.Connector.OutgoingIPAddresses)) + } - if props.EndpointsConfiguration == nil || props.EndpointsConfiguration.Connector == nil { - d.Set("connector_endpoint_ip_addresses", []interface{}{}) - d.Set("connector_outbound_ip_addresses", []interface{}{}) - } else { - d.Set("connector_endpoint_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Connector.AccessEndpointIPAddresses)) - d.Set("connector_outbound_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Connector.OutgoingIPAddresses)) + if props.EndpointsConfiguration == nil || props.EndpointsConfiguration.Workflow == nil { + d.Set("workflow_endpoint_ip_addresses", []interface{}{}) + d.Set("workflow_outbound_ip_addresses", []interface{}{}) + } else { + d.Set("workflow_endpoint_ip_addresses", flattenServiceEnvironmentIPAddresses(props.EndpointsConfiguration.Workflow.AccessEndpointIPAddresses)) + d.Set("workflow_outbound_ip_addresses", flattenServiceEnvironmentIPAddresses(props.EndpointsConfiguration.Workflow.OutgoingIPAddresses)) + } } - if props.EndpointsConfiguration == nil || props.EndpointsConfiguration.Workflow == nil { - d.Set("workflow_endpoint_ip_addresses", []interface{}{}) - d.Set("workflow_outbound_ip_addresses", []interface{}{}) - } else { - d.Set("workflow_endpoint_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Workflow.AccessEndpointIPAddresses)) - d.Set("workflow_outbound_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Workflow.OutgoingIPAddresses)) - } + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceIntegrationServiceEnvironmentDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -266,24 +263,21 @@ func resourceIntegrationServiceEnvironmentDelete(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationServiceEnvironmentID(d.Id()) + id, err := integrationserviceenvironments.ParseIntegrationServiceEnvironmentID(d.Id()) if err != nil { return fmt.Errorf("parsing Integration Service Environment ID `%q`: %+v", d.Id(), err) } - name := id.Name - resourceGroup := id.ResourceGroup - - resp, err := client.Get(ctx, resourceGroup, name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return nil } - return fmt.Errorf("retrieving Integration Service Environment %q (Resource Group %q): %+v", name, resourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id.ID(), err) } // Get subnet IDs before delete - subnetIDs := getSubnetIDs(&resp) + subnetIDs := getSubnetIDs(resp.Model) // Not optimal behaviour for now // It deletes synchronously and resource is not available anymore after return from delete operation @@ -292,17 +286,17 @@ func resourceIntegrationServiceEnvironmentDelete(d *pluginsdk.ResourceData, meta // If the operation fails we are lost. We do not have original resource and we cannot resume delete operation. // User has to wait for completion of delete operation in the background. // It would be great to have async call with future struct - if resp, err := client.Delete(ctx, resourceGroup, name); err != nil { - if utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id); err != nil { + if response.WasNotFound(resp.HttpResponse) { return nil } - return fmt.Errorf("deleting Integration Service Environment %q (Resource Group %q): %+v", name, resourceGroup, err) + return fmt.Errorf("deleting %s: %+v", id.ID(), err) } stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{string(logic.WorkflowProvisioningStateDeleting)}, - Target: []string{string(logic.WorkflowProvisioningStateDeleted)}, + Pending: []string{string(integrationserviceenvironments.WorkflowProvisioningStateDeleting)}, + Target: []string{string(integrationserviceenvironments.WorkflowProvisioningStateDeleted)}, MinTimeout: 5 * time.Minute, Refresh: integrationServiceEnvironmentDeleteStateRefreshFunc(ctx, meta.(*clients.Client), d.Id(), subnetIDs), Timeout: d.Timeout(pluginsdk.TimeoutDelete), @@ -311,32 +305,37 @@ func resourceIntegrationServiceEnvironmentDelete(d *pluginsdk.ResourceData, meta } if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for deletion of Integration Service Environment %q (Resource Group %q): %+v", name, resourceGroup, err) + return fmt.Errorf("waiting for deletion of %s: %+v", id.ID(), err) } return nil } -func flattenIntegrationServiceEnvironmentSkuName(input *logic.IntegrationServiceEnvironmentSku) string { +func flattenIntegrationServiceEnvironmentSkuName(input *integrationserviceenvironments.IntegrationServiceEnvironmentSku) string { if input == nil { return "" } - return fmt.Sprintf("%s_%d", string(input.Name), *input.Capacity) + name := "" + if input.Name != nil { + name = string(*input.Name) + } + + return fmt.Sprintf("%s_%d", name, *input.Capacity) } -func expandIntegrationServiceEnvironmentSkuName(skuName string) (*logic.IntegrationServiceEnvironmentSku, error) { +func expandIntegrationServiceEnvironmentSkuName(skuName string) (*integrationserviceenvironments.IntegrationServiceEnvironmentSku, error) { parts := strings.Split(skuName, "_") if len(parts) != 2 { return nil, fmt.Errorf("sku_name (%s) has the wrong number of parts (%d) after splitting on _", skuName, len(parts)) } - var sku logic.IntegrationServiceEnvironmentSkuName + var sku integrationserviceenvironments.IntegrationServiceEnvironmentSkuName switch parts[0] { - case string(logic.IntegrationServiceEnvironmentSkuNameDeveloper): - sku = logic.IntegrationServiceEnvironmentSkuNameDeveloper - case string(logic.IntegrationServiceEnvironmentSkuNamePremium): - sku = logic.IntegrationServiceEnvironmentSkuNamePremium + case string(integrationserviceenvironments.IntegrationServiceEnvironmentSkuNameDeveloper): + sku = integrationserviceenvironments.IntegrationServiceEnvironmentSkuNameDeveloper + case string(integrationserviceenvironments.IntegrationServiceEnvironmentSkuNamePremium): + sku = integrationserviceenvironments.IntegrationServiceEnvironmentSkuNamePremium default: return nil, fmt.Errorf("sku_name %s has unknown sku %s", skuName, parts[0]) } @@ -346,44 +345,44 @@ func expandIntegrationServiceEnvironmentSkuName(skuName string) (*logic.Integrat return nil, fmt.Errorf("cannot convert sku_name %s capacity %s to int", skuName, parts[1]) } - if sku != logic.IntegrationServiceEnvironmentSkuNamePremium && capacity > 0 { + if sku != integrationserviceenvironments.IntegrationServiceEnvironmentSkuNamePremium && capacity > 0 { return nil, fmt.Errorf("`capacity` can only be greater than zero for `sku_name` `Premium`") } - return &logic.IntegrationServiceEnvironmentSku{ - Name: sku, - Capacity: utils.Int32(int32(capacity)), + return &integrationserviceenvironments.IntegrationServiceEnvironmentSku{ + Name: &sku, + Capacity: utils.Int64(int64(capacity)), }, nil } -func expandSubnetResourceID(input []interface{}) *[]logic.ResourceReference { - results := make([]logic.ResourceReference, 0) +func expandSubnetResourceID(input []interface{}) *[]integrationserviceenvironments.ResourceReference { + results := make([]integrationserviceenvironments.ResourceReference, 0) for _, item := range input { - results = append(results, logic.ResourceReference{ - ID: utils.String(item.(string)), + results = append(results, integrationserviceenvironments.ResourceReference{ + Id: utils.String(item.(string)), }) } return &results } -func flattenSubnetResourceID(input *[]logic.ResourceReference) []interface{} { +func flattenSubnetResourceID(input *[]integrationserviceenvironments.ResourceReference) []interface{} { subnetIDs := make([]interface{}, 0) if input == nil { return subnetIDs } for _, resourceRef := range *input { - if resourceRef.ID == nil || *resourceRef.ID == "" { + if resourceRef.Id == nil || *resourceRef.Id == "" { continue } - subnetIDs = append(subnetIDs, resourceRef.ID) + subnetIDs = append(subnetIDs, resourceRef.Id) } return subnetIDs } -func getSubnetIDs(input *logic.IntegrationServiceEnvironment) []interface{} { +func getSubnetIDs(input *integrationserviceenvironments.IntegrationServiceEnvironment) []interface{} { results := make([]interface{}, 0) if input == nil { return results @@ -402,14 +401,14 @@ func integrationServiceEnvironmentDeleteStateRefreshFunc(ctx context.Context, cl return func() (interface{}, string, error) { linkExists, err := linkExists(ctx, client, iseID, subnetIDs) if err != nil { - return string(logic.WorkflowProvisioningStateDeleting), string(logic.WorkflowProvisioningStateDeleting), err + return string(integrationserviceenvironments.WorkflowProvisioningStateDeleting), string(integrationserviceenvironments.WorkflowProvisioningStateDeleting), err } if linkExists { - return string(logic.WorkflowProvisioningStateDeleting), string(logic.WorkflowProvisioningStateDeleting), nil + return string(integrationserviceenvironments.WorkflowProvisioningStateDeleting), string(integrationserviceenvironments.WorkflowProvisioningStateDeleting), nil } - return string(logic.WorkflowProvisioningStateDeleted), string(logic.WorkflowProvisioningStateDeleted), nil + return string(integrationserviceenvironments.WorkflowProvisioningStateDeleted), string(integrationserviceenvironments.WorkflowProvisioningStateDeleted), nil } } @@ -495,3 +494,15 @@ func resourceNavigationLinkExists(ctx context.Context, client *network.ResourceN return false, nil } + +func flattenServiceEnvironmentIPAddresses(input *[]integrationserviceenvironments.IPAddress) []interface{} { + if input == nil { + return []interface{}{} + } + + var addresses []interface{} + for _, addr := range *input { + addresses = append(addresses, *addr.Address) + } + return addresses +} diff --git a/internal/services/logic/integration_service_environment_resource_test.go b/internal/services/logic/integration_service_environment_resource_test.go index e65d0779e396..427cc7809cd7 100644 --- a/internal/services/logic/integration_service_environment_resource_test.go +++ b/internal/services/logic/integration_service_environment_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -184,17 +184,17 @@ func TestAccIntegrationServiceEnvironment_requiresImport(t *testing.T) { } func (IntegrationServiceEnvironmentResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.IntegrationServiceEnvironmentID(state.ID) + id, err := integrationserviceenvironments.ParseIntegrationServiceEnvironmentID(state.ID) if err != nil { return nil, err } - resp, err := clients.Logic.IntegrationServiceEnvironmentClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := clients.Logic.IntegrationServiceEnvironmentClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Integration Service Environment %s (resource group: %s): %v", id.Name, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %v", id.ID(), err) } - return utils.Bool(resp.Properties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (IntegrationServiceEnvironmentResource) template(data acceptance.TestData) string { diff --git a/internal/services/logic/logic_app_action_custom_resource.go b/internal/services/logic/logic_app_action_custom_resource.go index 26a9b09dfc4b..0d03a57391af 100644 --- a/internal/services/logic/logic_app_action_custom_resource.go +++ b/internal/services/logic/logic_app_action_custom_resource.go @@ -6,6 +6,7 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -56,12 +57,12 @@ func resourceLogicAppActionCustom() *pluginsdk.Resource { } func resourceLogicAppActionCustomCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - workflowId, err := parse.WorkflowID(d.Get("logic_app_id").(string)) + workflowId, err := workflows.ParseWorkflowID(d.Get("logic_app_id").(string)) if err != nil { return err } - id := parse.NewActionID(workflowId.SubscriptionId, workflowId.ResourceGroup, workflowId.Name, d.Get("name").(string)) + id := parse.NewActionID(workflowId.SubscriptionId, workflowId.ResourceGroupName, workflowId.WorkflowName, d.Get("name").(string)) bodyRaw := d.Get("body").(string) @@ -83,7 +84,9 @@ func resourceLogicAppActionCustomRead(d *pluginsdk.ResourceData, meta interface{ return err } - t, app, err := retrieveLogicAppAction(d, meta, id.ResourceGroup, id.WorkflowName, id.Name) + workflowId := workflows.NewWorkflowID(id.SubscriptionId, id.ResourceGroup, id.WorkflowName) + + t, app, err := retrieveLogicAppAction(d, meta, workflowId, id.Name) if err != nil { return err } @@ -97,7 +100,7 @@ func resourceLogicAppActionCustomRead(d *pluginsdk.ResourceData, meta interface{ action := *t d.Set("name", id.Name) - d.Set("logic_app_id", app.ID) + d.Set("logic_app_id", app.Id) body, err := json.Marshal(action) if err != nil { @@ -117,7 +120,9 @@ func resourceLogicAppActionCustomDelete(d *pluginsdk.ResourceData, meta interfac return err } - err = resourceLogicAppActionRemove(d, meta, id.ResourceGroup, id.WorkflowName, id.Name) + workflowId := workflows.NewWorkflowID(id.SubscriptionId, id.ResourceGroup, id.WorkflowName) + + err = resourceLogicAppActionRemove(d, meta, workflowId, id.Name) if err != nil { return fmt.Errorf("removing Action %s: %+v", id, err) } diff --git a/internal/services/logic/logic_app_action_http_resource.go b/internal/services/logic/logic_app_action_http_resource.go index 25b763b2429e..dafe2426db6d 100644 --- a/internal/services/logic/logic_app_action_http_resource.go +++ b/internal/services/logic/logic_app_action_http_resource.go @@ -8,7 +8,8 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" @@ -108,10 +109,10 @@ func resourceLogicAppActionHTTP() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(logic.WorkflowStatusSucceeded), - string(logic.WorkflowStatusFailed), - string(logic.WorkflowStatusSkipped), - string(logic.WorkflowStatusTimedOut), + string(workflowrunactions.WorkflowStatusSucceeded), + string(workflowrunactions.WorkflowStatusFailed), + string(workflowrunactions.WorkflowStatusSkipped), + string(workflowrunactions.WorkflowStatusTimedOut), }, false), }, }, @@ -122,12 +123,12 @@ func resourceLogicAppActionHTTP() *pluginsdk.Resource { } func resourceLogicAppActionHTTPCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - workflowId, err := parse.WorkflowID(d.Get("logic_app_id").(string)) + workflowId, err := workflows.ParseWorkflowID(d.Get("logic_app_id").(string)) if err != nil { return err } - id := parse.NewActionID(workflowId.SubscriptionId, workflowId.ResourceGroup, workflowId.Name, d.Get("name").(string)) + id := parse.NewActionID(workflowId.SubscriptionId, workflowId.ResourceGroupName, workflowId.WorkflowName, d.Get("name").(string)) headersRaw := d.Get("headers").(map[string]interface{}) headers, err := expandLogicAppActionHttpHeaders(headersRaw) @@ -185,7 +186,9 @@ func resourceLogicAppActionHTTPRead(d *pluginsdk.ResourceData, meta interface{}) return err } - t, app, err := retrieveLogicAppAction(d, meta, id.ResourceGroup, id.WorkflowName, id.Name) + workflowId := workflows.NewWorkflowID(id.SubscriptionId, id.ResourceGroup, id.WorkflowName) + + t, app, err := retrieveLogicAppAction(d, meta, workflowId, id.Name) if err != nil { return err } @@ -199,7 +202,7 @@ func resourceLogicAppActionHTTPRead(d *pluginsdk.ResourceData, meta interface{}) action := *t d.Set("name", id.Name) - d.Set("logic_app_id", app.ID) + d.Set("logic_app_id", app.Id) actionType := action["type"].(string) if !strings.EqualFold(actionType, "http") { @@ -272,7 +275,9 @@ func resourceLogicAppActionHTTPDelete(d *pluginsdk.ResourceData, meta interface{ return err } - err = resourceLogicAppActionRemove(d, meta, id.ResourceGroup, id.WorkflowName, id.Name) + workflowId := workflows.NewWorkflowID(id.SubscriptionId, id.ResourceGroup, id.WorkflowName) + + err = resourceLogicAppActionRemove(d, meta, workflowId, id.Name) if err != nil { return fmt.Errorf("removing Action %s: %+v", id, err) } diff --git a/internal/services/logic/logic_app_integration_account_agreement_resource.go b/internal/services/logic/logic_app_integration_account_agreement_resource.go index 13973e85dbdc..7cf2b1ba4c03 100644 --- a/internal/services/logic/logic_app_integration_account_agreement_resource.go +++ b/internal/services/logic/logic_app_integration_account_agreement_resource.go @@ -6,16 +6,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceLogicAppIntegrationAccountAgreement() *pluginsdk.Resource { @@ -33,7 +32,7 @@ func resourceLogicAppIntegrationAccountAgreement() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.IntegrationAccountAgreementID(id) + _, err := integrationaccountagreements.ParseAgreementID(id) return err }), @@ -58,9 +57,9 @@ func resourceLogicAppIntegrationAccountAgreement() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(logic.AgreementTypeAS2), - string(logic.AgreementTypeX12), - string(logic.AgreementTypeEdifact), + string(integrationaccountagreements.AgreementTypeASTwo), + string(integrationaccountagreements.AgreementTypeXOneTwo), + string(integrationaccountagreements.AgreementTypeEdifact), }, false), }, @@ -143,43 +142,42 @@ func resourceLogicAppIntegrationAccountAgreementCreateUpdate(d *pluginsdk.Resour ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewIntegrationAccountAgreementID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) + id := integrationaccountagreements.NewAgreementID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.AgreementName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_logic_app_integration_account_agreement", id.ID()) } } - agreementContent := logic.AgreementContent{} + agreementContent := integrationaccountagreements.AgreementContent{} content := d.Get("content").(string) if err := json.Unmarshal([]byte(content), &agreementContent); err != nil { return fmt.Errorf("parsing JSON: %+v", err) } - parameters := logic.IntegrationAccountAgreement{ - IntegrationAccountAgreementProperties: &logic.IntegrationAccountAgreementProperties{ - AgreementType: logic.AgreementType(d.Get("agreement_type").(string)), + parameters := integrationaccountagreements.IntegrationAccountAgreement{ + Properties: integrationaccountagreements.IntegrationAccountAgreementProperties{ + AgreementType: integrationaccountagreements.AgreementType(d.Get("agreement_type").(string)), GuestIdentity: expandIntegrationAccountAgreementBusinessIdentity(d.Get("guest_identity").([]interface{})), - GuestPartner: utils.String(d.Get("guest_partner_name").(string)), + GuestPartner: d.Get("guest_partner_name").(string), HostIdentity: expandIntegrationAccountAgreementBusinessIdentity(d.Get("host_identity").([]interface{})), - HostPartner: utils.String(d.Get("host_partner_name").(string)), - Content: &agreementContent, + HostPartner: d.Get("host_partner_name").(string), + Content: agreementContent, }, } if v, ok := d.GetOk("metadata"); ok { - metadata := v.(map[string]interface{}) - parameters.IntegrationAccountAgreementProperties.Metadata = &metadata + parameters.Properties.Metadata = &v } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.IntegrationAccountName, id.AgreementName, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -192,14 +190,14 @@ func resourceLogicAppIntegrationAccountAgreementRead(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountAgreementID(d.Id()) + id, err := integrationaccountagreements.ParseAgreementID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.AgreementName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state", *id) d.SetId("") return nil @@ -208,21 +206,21 @@ func resourceLogicAppIntegrationAccountAgreementRead(d *pluginsdk.ResourceData, } d.Set("name", id.AgreementName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("integration_account_name", id.IntegrationAccountName) - if props := resp.IntegrationAccountAgreementProperties; props != nil { + if model := resp.Model; model != nil { + props := model.Properties + d.Set("agreement_type", props.AgreementType) d.Set("guest_partner_name", props.GuestPartner) d.Set("host_partner_name", props.HostPartner) - if props.Content != nil { - content, err := json.Marshal(props.Content) - if err != nil { - return err - } - d.Set("content", string(content)) + content, err := json.Marshal(props.Content) + if err != nil { + return err } + d.Set("content", string(content)) if err := d.Set("guest_identity", flattenIntegrationAccountAgreementBusinessIdentity(props.GuestIdentity)); err != nil { return fmt.Errorf("setting `guest_identity`: %+v", err) @@ -233,10 +231,11 @@ func resourceLogicAppIntegrationAccountAgreementRead(d *pluginsdk.ResourceData, } if props.Metadata != nil { - metadata := props.Metadata.(map[string]interface{}) - d.Set("metadata", metadata) + d.Set("metadata", props.Metadata) } + } + return nil } @@ -245,49 +244,35 @@ func resourceLogicAppIntegrationAccountAgreementDelete(d *pluginsdk.ResourceData ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountAgreementID(d.Id()) + id, err := integrationaccountagreements.ParseAgreementID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.IntegrationAccountName, id.AgreementName); err != nil { + if _, err := client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } return nil } -func expandIntegrationAccountAgreementBusinessIdentity(input []interface{}) *logic.BusinessIdentity { +func expandIntegrationAccountAgreementBusinessIdentity(input []interface{}) integrationaccountagreements.BusinessIdentity { if len(input) == 0 { - return nil + return integrationaccountagreements.BusinessIdentity{} } v := input[0].(map[string]interface{}) - return &logic.BusinessIdentity{ - Qualifier: utils.String(v["qualifier"].(string)), - Value: utils.String(v["value"].(string)), + return integrationaccountagreements.BusinessIdentity{ + Qualifier: v["qualifier"].(string), + Value: v["value"].(string), } } -func flattenIntegrationAccountAgreementBusinessIdentity(input *logic.BusinessIdentity) []interface{} { - if input == nil { - return make([]interface{}, 0) - } - - var qualifier string - if input.Qualifier != nil { - qualifier = *input.Qualifier - } - - var value string - if input.Value != nil { - value = *input.Value - } - +func flattenIntegrationAccountAgreementBusinessIdentity(input integrationaccountagreements.BusinessIdentity) []interface{} { return []interface{}{ map[string]interface{}{ - "qualifier": qualifier, - "value": value, + "qualifier": input.Qualifier, + "value": input.Value, }, } } diff --git a/internal/services/logic/logic_app_integration_account_agreement_resource_test.go b/internal/services/logic/logic_app_integration_account_agreement_resource_test.go index abac029ed948..f8a93db7fd13 100644 --- a/internal/services/logic/logic_app_integration_account_agreement_resource_test.go +++ b/internal/services/logic/logic_app_integration_account_agreement_resource_test.go @@ -5,10 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -83,18 +84,18 @@ func TestAccLogicAppIntegrationAccountAgreement_update(t *testing.T) { } func (r LogicAppIntegrationAccountAgreementResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.IntegrationAccountAgreementID(state.ID) + id, err := integrationaccountagreements.ParseAgreementID(state.ID) if err != nil { return nil, err } - resp, err := client.Logic.IntegrationAccountAgreementClient.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.AgreementName) + resp, err := client.Logic.IntegrationAccountAgreementClient.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } return nil, fmt.Errorf("retrieving %q %+v", id, err) } - return utils.Bool(resp.IntegrationAccountAgreementProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (r LogicAppIntegrationAccountAgreementResource) template(data acceptance.TestData) string { diff --git a/internal/services/logic/logic_app_integration_account_assembly_resource.go b/internal/services/logic/logic_app_integration_account_assembly_resource.go index 6085ab57cdc4..66e61815c897 100644 --- a/internal/services/logic/logic_app_integration_account_assembly_resource.go +++ b/internal/services/logic/logic_app_integration_account_assembly_resource.go @@ -5,11 +5,11 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -32,7 +32,7 @@ func resourceLogicAppIntegrationAccountAssembly() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.IntegrationAccountAssemblyID(id) + _, err := integrationaccountassemblies.ParseAssemblyID(id) return err }), @@ -98,44 +98,43 @@ func resourceLogicAppIntegrationAccountAssemblyCreateUpdate(d *pluginsdk.Resourc ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewIntegrationAccountAssemblyID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) + id := integrationaccountassemblies.NewAssemblyID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.AssemblyName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_logic_app_integration_account_assembly", id.ID()) } } - parameters := logic.AssemblyDefinition{ - Properties: &logic.AssemblyProperties{ - AssemblyName: utils.String(d.Get("assembly_name").(string)), + parameters := integrationaccountassemblies.AssemblyDefinition{ + Properties: integrationaccountassemblies.AssemblyProperties{ + AssemblyName: d.Get("assembly_name").(string), AssemblyVersion: utils.String(d.Get("assembly_version").(string)), ContentType: utils.String("application/octet-stream"), }, } if v, ok := d.GetOk("content"); ok { - parameters.Properties.Content = utils.String(v.(string)) + parameters.Properties.Content = &v } if v, ok := d.GetOk("content_link_uri"); ok { - parameters.Properties.ContentLink = &logic.ContentLink{ - URI: utils.String(v.(string)), + parameters.Properties.ContentLink = &integrationaccountassemblies.ContentLink{ + Uri: utils.String(v.(string)), } } if v, ok := d.GetOk("metadata"); ok { - metadata := v.(map[string]interface{}) - parameters.Properties.Metadata = &metadata + parameters.Properties.Metadata = &v } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.IntegrationAccountName, id.AssemblyName, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -148,14 +147,14 @@ func resourceLogicAppIntegrationAccountAssemblyRead(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountAssemblyID(d.Id()) + id, err := integrationaccountassemblies.ParseAssemblyID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.AssemblyName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state", *id) d.SetId("") return nil @@ -164,19 +163,20 @@ func resourceLogicAppIntegrationAccountAssemblyRead(d *pluginsdk.ResourceData, m } d.Set("name", id.AssemblyName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("integration_account_name", id.IntegrationAccountName) - if props := resp.Properties; props != nil { + if model := resp.Model; model != nil { + props := model.Properties d.Set("assembly_name", props.AssemblyName) d.Set("assembly_version", props.AssemblyVersion) d.Set("content_link_uri", d.Get("content_link_uri").(string)) d.Set("content", d.Get("content").(string)) if props.Metadata != nil { - metadata := props.Metadata.(map[string]interface{}) - d.Set("metadata", metadata) + d.Set("metadata", props.Metadata) } + } return nil @@ -187,12 +187,12 @@ func resourceLogicAppIntegrationAccountAssemblyDelete(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountAssemblyID(d.Id()) + id, err := integrationaccountassemblies.ParseAssemblyID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.IntegrationAccountName, id.AssemblyName); err != nil { + if _, err := client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } diff --git a/internal/services/logic/logic_app_integration_account_assembly_resource_test.go b/internal/services/logic/logic_app_integration_account_assembly_resource_test.go index a87ca1a75384..c2b1b0b70483 100644 --- a/internal/services/logic/logic_app_integration_account_assembly_resource_test.go +++ b/internal/services/logic/logic_app_integration_account_assembly_resource_test.go @@ -5,10 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -83,18 +84,18 @@ func TestAccLogicAppIntegrationAccountAssembly_update(t *testing.T) { } func (r LogicAppIntegrationAccountAssemblyResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.IntegrationAccountAssemblyID(state.ID) + id, err := integrationaccountassemblies.ParseAssemblyID(state.ID) if err != nil { return nil, err } - resp, err := client.Logic.IntegrationAccountAssemblyClient.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.AssemblyName) + resp, err := client.Logic.IntegrationAccountAssemblyClient.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } return nil, fmt.Errorf("retrieving %q %+v", id, err) } - return utils.Bool(resp.Properties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (r LogicAppIntegrationAccountAssemblyResource) template(data acceptance.TestData) string { diff --git a/internal/services/logic/logic_app_integration_account_batch_configuration_resource.go b/internal/services/logic/logic_app_integration_account_batch_configuration_resource.go index 489116c770c7..0b495e75671e 100644 --- a/internal/services/logic/logic_app_integration_account_batch_configuration_resource.go +++ b/internal/services/logic/logic_app_integration_account_batch_configuration_resource.go @@ -7,11 +7,11 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -35,7 +35,7 @@ func resourceLogicAppIntegrationAccountBatchConfiguration() *pluginsdk.Resource }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.IntegrationAccountBatchConfigurationID(id) + _, err := integrationaccountbatchconfigurations.ParseBatchConfigurationID(id) return err }), @@ -91,17 +91,9 @@ func resourceLogicAppIntegrationAccountBatchConfiguration() *pluginsdk.Resource Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "frequency": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(logic.RecurrenceFrequencySecond), - string(logic.RecurrenceFrequencyMinute), - string(logic.RecurrenceFrequencyHour), - string(logic.RecurrenceFrequencyDay), - string(logic.RecurrenceFrequencyWeek), - string(logic.RecurrenceFrequencyMonth), - string(logic.RecurrenceFrequencyYear), - }, false), + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(integrationaccountbatchconfigurations.PossibleValuesForRecurrenceFrequency(), false), }, "interval": { @@ -160,17 +152,9 @@ func resourceLogicAppIntegrationAccountBatchConfiguration() *pluginsdk.Resource Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "weekday": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(logic.DayOfWeekMonday), - string(logic.DayOfWeekTuesday), - string(logic.DayOfWeekWednesday), - string(logic.DayOfWeekThursday), - string(logic.DayOfWeekFriday), - string(logic.DayOfWeekSaturday), - string(logic.DayOfWeekSunday), - }, false), + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(integrationaccountbatchconfigurations.PossibleValuesForDayOfWeek(), false), }, "week": { @@ -190,16 +174,8 @@ func resourceLogicAppIntegrationAccountBatchConfiguration() *pluginsdk.Resource Type: pluginsdk.TypeSet, Optional: true, Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - ValidateFunc: validation.StringInSlice([]string{ - string(logic.DaysOfWeekMonday), - string(logic.DaysOfWeekTuesday), - string(logic.DaysOfWeekWednesday), - string(logic.DaysOfWeekThursday), - string(logic.DaysOfWeekFriday), - string(logic.DaysOfWeekSaturday), - string(logic.DaysOfWeekSunday), - }, false), + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice(integrationaccountbatchconfigurations.PossibleValuesForDaysOfWeek(), false), }, ConflictsWith: []string{"release_criteria.0.recurrence.0.schedule.0.month_days", "release_criteria.0.recurrence.0.schedule.0.monthly"}, }, @@ -265,33 +241,32 @@ func resourceLogicAppIntegrationAccountBatchConfigurationCreateUpdate(d *plugins ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewIntegrationAccountBatchConfigurationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) + id := integrationaccountbatchconfigurations.NewBatchConfigurationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.BatchConfigurationName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_logic_app_integration_account_batch_configuration", id.ID()) } } - parameters := logic.BatchConfiguration{ - Properties: &logic.BatchConfigurationProperties{ - BatchGroupName: utils.String(d.Get("batch_group_name").(string)), + parameters := integrationaccountbatchconfigurations.BatchConfiguration{ + Properties: integrationaccountbatchconfigurations.BatchConfigurationProperties{ + BatchGroupName: d.Get("batch_group_name").(string), ReleaseCriteria: expandIntegrationAccountBatchConfigurationBatchReleaseCriteria(d.Get("release_criteria").([]interface{})), }, } if v, ok := d.GetOk("metadata"); ok { - metadata := v.(map[string]interface{}) - parameters.Properties.Metadata = &metadata + parameters.Properties.Metadata = &v } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.IntegrationAccountName, id.BatchConfigurationName, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -304,14 +279,14 @@ func resourceLogicAppIntegrationAccountBatchConfigurationRead(d *pluginsdk.Resou ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountBatchConfigurationID(d.Id()) + id, err := integrationaccountbatchconfigurations.ParseBatchConfigurationID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.BatchConfigurationName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state", *id) d.SetId("") return nil @@ -320,10 +295,11 @@ func resourceLogicAppIntegrationAccountBatchConfigurationRead(d *pluginsdk.Resou } d.Set("name", id.BatchConfigurationName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("integration_account_name", id.IntegrationAccountName) - if props := resp.Properties; props != nil { + if model := resp.Model; model != nil { + props := model.Properties d.Set("batch_group_name", props.BatchGroupName) if err := d.Set("release_criteria", flattenIntegrationAccountBatchConfigurationBatchReleaseCriteria(props.ReleaseCriteria)); err != nil { @@ -331,8 +307,7 @@ func resourceLogicAppIntegrationAccountBatchConfigurationRead(d *pluginsdk.Resou } if props.Metadata != nil { - metadata := props.Metadata.(map[string]interface{}) - d.Set("metadata", metadata) + d.Set("metadata", props.Metadata) } } @@ -344,50 +319,50 @@ func resourceLogicAppIntegrationAccountBatchConfigurationDelete(d *pluginsdk.Res ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountBatchConfigurationID(d.Id()) + id, err := integrationaccountbatchconfigurations.ParseBatchConfigurationID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.IntegrationAccountName, id.BatchConfigurationName); err != nil { + if _, err := client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } return nil } -func expandIntegrationAccountBatchConfigurationBatchReleaseCriteria(input []interface{}) *logic.BatchReleaseCriteria { +func expandIntegrationAccountBatchConfigurationBatchReleaseCriteria(input []interface{}) integrationaccountbatchconfigurations.BatchReleaseCriteria { + result := integrationaccountbatchconfigurations.BatchReleaseCriteria{} if len(input) == 0 { - return nil + return result } v := input[0].(map[string]interface{}) - result := logic.BatchReleaseCriteria{} - if batchSize := v["batch_size"].(int); batchSize != 0 { - result.BatchSize = utils.Int32(int32(batchSize)) + result.BatchSize = utils.Int64(int64(batchSize)) } if messageCount := v["message_count"].(int); messageCount != 0 { - result.MessageCount = utils.Int32(int32(messageCount)) + result.MessageCount = utils.Int64(int64(messageCount)) } if recurrence := v["recurrence"].([]interface{}); len(recurrence) != 0 { result.Recurrence = expandIntegrationAccountBatchConfigurationWorkflowTriggerRecurrence(recurrence) } - return &result + return result } -func expandIntegrationAccountBatchConfigurationWorkflowTriggerRecurrence(input []interface{}) *logic.WorkflowTriggerRecurrence { +func expandIntegrationAccountBatchConfigurationWorkflowTriggerRecurrence(input []interface{}) *integrationaccountbatchconfigurations.WorkflowTriggerRecurrence { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - result := logic.WorkflowTriggerRecurrence{ - Frequency: logic.RecurrenceFrequency(v["frequency"].(string)), - Interval: utils.Int32(int32(v["interval"].(int))), + frequency := integrationaccountbatchconfigurations.RecurrenceFrequency(v["frequency"].(string)) + result := integrationaccountbatchconfigurations.WorkflowTriggerRecurrence{ + Frequency: &frequency, + Interval: utils.Int64(int64(v["interval"].(int))), } if startTime := v["start_time"].(string); startTime != "" { @@ -409,32 +384,32 @@ func expandIntegrationAccountBatchConfigurationWorkflowTriggerRecurrence(input [ return &result } -func expandIntegrationAccountBatchConfigurationRecurrenceSchedule(input []interface{}) *logic.RecurrenceSchedule { +func expandIntegrationAccountBatchConfigurationRecurrenceSchedule(input []interface{}) *integrationaccountbatchconfigurations.RecurrenceSchedule { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - result := logic.RecurrenceSchedule{} + result := integrationaccountbatchconfigurations.RecurrenceSchedule{} if hours := v["hours"].(*pluginsdk.Set).List(); len(hours) != 0 { - result.Hours = utils.ExpandInt32Slice(hours) + result.Hours = utils.ExpandInt64Slice(hours) } if minutes := v["minutes"].(*pluginsdk.Set).List(); len(minutes) != 0 { - result.Minutes = utils.ExpandInt32Slice(minutes) + result.Minutes = utils.ExpandInt64Slice(minutes) } if rawWeekDays := v["week_days"].(*pluginsdk.Set).List(); len(rawWeekDays) != 0 { - weekDays := make([]logic.DaysOfWeek, 0) + weekDays := make([]integrationaccountbatchconfigurations.DaysOfWeek, 0) for _, item := range *(utils.ExpandStringSlice(rawWeekDays)) { - weekDays = append(weekDays, (logic.DaysOfWeek)(item)) + weekDays = append(weekDays, (integrationaccountbatchconfigurations.DaysOfWeek)(item)) } result.WeekDays = &weekDays } if monthDays := v["month_days"].(*pluginsdk.Set).List(); len(monthDays) != 0 { - result.MonthDays = utils.ExpandInt32Slice(monthDays) + result.MonthDays = utils.ExpandInt64Slice(monthDays) } if monthlyOccurrence := v["monthly"].(*pluginsdk.Set).List(); len(monthlyOccurrence) != 0 { @@ -444,32 +419,29 @@ func expandIntegrationAccountBatchConfigurationRecurrenceSchedule(input []interf return &result } -func expandIntegrationAccountBatchConfigurationRecurrenceScheduleOccurrences(input []interface{}) *[]logic.RecurrenceScheduleOccurrence { - results := make([]logic.RecurrenceScheduleOccurrence, 0) +func expandIntegrationAccountBatchConfigurationRecurrenceScheduleOccurrences(input []interface{}) *[]integrationaccountbatchconfigurations.RecurrenceScheduleOccurrence { + results := make([]integrationaccountbatchconfigurations.RecurrenceScheduleOccurrence, 0) for _, item := range input { v := item.(map[string]interface{}) - results = append(results, logic.RecurrenceScheduleOccurrence{ - Day: logic.DayOfWeek(v["weekday"].(string)), - Occurrence: utils.Int32(int32(v["week"].(int))), + day := integrationaccountbatchconfigurations.DayOfWeek(v["weekday"].(string)) + results = append(results, integrationaccountbatchconfigurations.RecurrenceScheduleOccurrence{ + Day: &day, + Occurrence: utils.Int64(int64(v["week"].(int))), }) } return &results } -func flattenIntegrationAccountBatchConfigurationBatchReleaseCriteria(input *logic.BatchReleaseCriteria) []interface{} { - if input == nil { - return make([]interface{}, 0) - } - - var batchSize int32 +func flattenIntegrationAccountBatchConfigurationBatchReleaseCriteria(input integrationaccountbatchconfigurations.BatchReleaseCriteria) []interface{} { + var batchSize int64 if input.BatchSize != nil { batchSize = *input.BatchSize } - var messageCount int32 + var messageCount int64 if input.MessageCount != nil { messageCount = *input.MessageCount } @@ -483,7 +455,7 @@ func flattenIntegrationAccountBatchConfigurationBatchReleaseCriteria(input *logi } } -func flattenIntegrationAccountBatchConfigurationWorkflowTriggerRecurrence(input *logic.WorkflowTriggerRecurrence) []interface{} { +func flattenIntegrationAccountBatchConfigurationWorkflowTriggerRecurrence(input *integrationaccountbatchconfigurations.WorkflowTriggerRecurrence) []interface{} { if input == nil { return make([]interface{}, 0) } @@ -493,12 +465,12 @@ func flattenIntegrationAccountBatchConfigurationWorkflowTriggerRecurrence(input endTime = *input.EndTime } - var frequency logic.RecurrenceFrequency - if input.Frequency != "" { - frequency = input.Frequency + var frequency integrationaccountbatchconfigurations.RecurrenceFrequency + if input.Frequency != nil && *input.Frequency != "" { + frequency = *input.Frequency } - var interval int32 + var interval int64 if input.Interval != nil { interval = *input.Interval } @@ -525,7 +497,7 @@ func flattenIntegrationAccountBatchConfigurationWorkflowTriggerRecurrence(input } } -func flattenIntegrationAccountBatchConfigurationRecurrenceSchedule(input *logic.RecurrenceSchedule) []interface{} { +func flattenIntegrationAccountBatchConfigurationRecurrenceSchedule(input *integrationaccountbatchconfigurations.RecurrenceSchedule) []interface{} { if input == nil { return make([]interface{}, 0) } @@ -541,28 +513,28 @@ func flattenIntegrationAccountBatchConfigurationRecurrenceSchedule(input *logic. return []interface{}{ map[string]interface{}{ - "hours": utils.FlattenInt32Slice(input.Hours), - "minutes": utils.FlattenInt32Slice(input.Minutes), - "month_days": utils.FlattenInt32Slice(input.MonthDays), + "hours": utils.FlattenInt64Slice(input.Hours), + "minutes": utils.FlattenInt64Slice(input.Minutes), + "month_days": utils.FlattenInt64Slice(input.MonthDays), "monthly": flattenIntegrationAccountBatchConfigurationRecurrenceScheduleOccurrence(input.MonthlyOccurrences), "week_days": weekDays, }, } } -func flattenIntegrationAccountBatchConfigurationRecurrenceScheduleOccurrence(input *[]logic.RecurrenceScheduleOccurrence) []interface{} { +func flattenIntegrationAccountBatchConfigurationRecurrenceScheduleOccurrence(input *[]integrationaccountbatchconfigurations.RecurrenceScheduleOccurrence) []interface{} { results := make([]interface{}, 0) if input == nil { return results } for _, item := range *input { - var day logic.DayOfWeek - if item.Day != "" { - day = item.Day + var day integrationaccountbatchconfigurations.DayOfWeek + if item.Day != nil && *item.Day != "" { + day = *item.Day } - var occurrence int32 + var occurrence int64 if item.Occurrence != nil { occurrence = *item.Occurrence } diff --git a/internal/services/logic/logic_app_integration_account_batch_configuration_resource_test.go b/internal/services/logic/logic_app_integration_account_batch_configuration_resource_test.go index ce782b713a6a..610698e72645 100644 --- a/internal/services/logic/logic_app_integration_account_batch_configuration_resource_test.go +++ b/internal/services/logic/logic_app_integration_account_batch_configuration_resource_test.go @@ -5,10 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -83,18 +84,18 @@ func TestAccLogicAppIntegrationAccountBatchConfiguration_update(t *testing.T) { } func (r LogicAppIntegrationAccountBatchConfigurationResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.IntegrationAccountBatchConfigurationID(state.ID) + id, err := integrationaccountbatchconfigurations.ParseBatchConfigurationID(state.ID) if err != nil { return nil, err } - resp, err := client.Logic.IntegrationAccountBatchConfigurationClient.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.BatchConfigurationName) + resp, err := client.Logic.IntegrationAccountBatchConfigurationClient.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } return nil, fmt.Errorf("retrieving %q %+v", id, err) } - return utils.Bool(resp.Properties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (r LogicAppIntegrationAccountBatchConfigurationResource) template(data acceptance.TestData) string { diff --git a/internal/services/logic/logic_app_integration_account_certificate_resource.go b/internal/services/logic/logic_app_integration_account_certificate_resource.go index 624173eb75ee..bef6375205cd 100644 --- a/internal/services/logic/logic_app_integration_account_certificate_resource.go +++ b/internal/services/logic/logic_app_integration_account_certificate_resource.go @@ -5,12 +5,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -33,7 +33,7 @@ func resourceLogicAppIntegrationAccountCertificate() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.IntegrationAccountCertificateID(id) + _, err := integrationaccountcertificates.ParseCertificateID(id) return err }), @@ -105,38 +105,37 @@ func resourceLogicAppIntegrationAccountCertificateCreateUpdate(d *pluginsdk.Reso ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewIntegrationAccountCertificateID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) + id := integrationaccountcertificates.NewCertificateID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.CertificateName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_logic_app_integration_account_certificate", id.ID()) } } - parameters := logic.IntegrationAccountCertificate{ - IntegrationAccountCertificateProperties: &logic.IntegrationAccountCertificateProperties{}, + parameters := integrationaccountcertificates.IntegrationAccountCertificate{ + Properties: integrationaccountcertificates.IntegrationAccountCertificateProperties{}, } if v, ok := d.GetOk("key_vault_key"); ok { - parameters.IntegrationAccountCertificateProperties.Key = expandIntegrationAccountCertificateKeyVaultKey(v.([]interface{})) + parameters.Properties.Key = expandIntegrationAccountCertificateKeyVaultKey(v.([]interface{})) } if v, ok := d.GetOk("metadata"); ok { - metadata, _ := pluginsdk.ExpandJsonFromString(v.(string)) - parameters.IntegrationAccountCertificateProperties.Metadata = metadata + parameters.Properties.Metadata = &v } if v, ok := d.GetOk("public_certificate"); ok { - parameters.IntegrationAccountCertificateProperties.PublicCertificate = utils.String(v.(string)) + parameters.Properties.PublicCertificate = utils.String(v.(string)) } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.IntegrationAccountName, id.CertificateName, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -149,14 +148,14 @@ func resourceLogicAppIntegrationAccountCertificateRead(d *pluginsdk.ResourceData ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountCertificateID(d.Id()) + id, err := integrationaccountcertificates.ParseCertificateID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.CertificateName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state", *id) d.SetId("") return nil @@ -165,21 +164,21 @@ func resourceLogicAppIntegrationAccountCertificateRead(d *pluginsdk.ResourceData } d.Set("name", id.CertificateName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("integration_account_name", id.IntegrationAccountName) - if props := resp.IntegrationAccountCertificateProperties; props != nil { + if model := resp.Model; model != nil { + props := model.Properties if err := d.Set("key_vault_key", flattenIntegrationAccountCertificateKeyVaultKey(props.Key)); err != nil { return fmt.Errorf("setting `key_vault_key`: %+v", err) } if props.Metadata != nil { - metadataValue := props.Metadata.(map[string]interface{}) - metadataStr, _ := pluginsdk.FlattenJsonToString(metadataValue) - d.Set("metadata", metadataStr) + d.Set("metadata", props.Metadata) } d.Set("public_certificate", props.PublicCertificate) + } return nil @@ -190,30 +189,30 @@ func resourceLogicAppIntegrationAccountCertificateDelete(d *pluginsdk.ResourceDa ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountCertificateID(d.Id()) + id, err := integrationaccountcertificates.ParseCertificateID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.IntegrationAccountName, id.CertificateName); err != nil { + if _, err := client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } return nil } -func expandIntegrationAccountCertificateKeyVaultKey(input []interface{}) *logic.KeyVaultKeyReference { +func expandIntegrationAccountCertificateKeyVaultKey(input []interface{}) *integrationaccountcertificates.KeyVaultKeyReference { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - result := logic.KeyVaultKeyReference{ - KeyVault: &logic.KeyVaultKeyReferenceKeyVault{ - ID: utils.String(v["key_vault_id"].(string)), + result := integrationaccountcertificates.KeyVaultKeyReference{ + KeyVault: integrationaccountcertificates.KeyVaultKeyReferenceKeyVault{ + Id: utils.String(v["key_vault_id"].(string)), }, - KeyName: utils.String(v["key_name"].(string)), + KeyName: v["key_name"].(string), } if keyVersion := v["key_version"].(string); keyVersion != "" { @@ -223,19 +222,14 @@ func expandIntegrationAccountCertificateKeyVaultKey(input []interface{}) *logic. return &result } -func flattenIntegrationAccountCertificateKeyVaultKey(input *logic.KeyVaultKeyReference) []interface{} { +func flattenIntegrationAccountCertificateKeyVaultKey(input *integrationaccountcertificates.KeyVaultKeyReference) []interface{} { if input == nil { return make([]interface{}, 0) } - var keyName string - if input.KeyName != nil { - keyName = *input.KeyName - } - var keyVaultId string - if input.KeyVault != nil && input.KeyVault.ID != nil { - keyVaultId = *input.KeyVault.ID + if input.KeyVault.Id != nil { + keyVaultId = *input.KeyVault.Id } var keyVersion string @@ -245,7 +239,7 @@ func flattenIntegrationAccountCertificateKeyVaultKey(input *logic.KeyVaultKeyRef return []interface{}{ map[string]interface{}{ - "key_name": keyName, + "key_name": input.KeyName, "key_vault_id": keyVaultId, "key_version": keyVersion, }, diff --git a/internal/services/logic/logic_app_integration_account_certificate_resource_test.go b/internal/services/logic/logic_app_integration_account_certificate_resource_test.go index 45f002c3684e..c0899a1ca119 100644 --- a/internal/services/logic/logic_app_integration_account_certificate_resource_test.go +++ b/internal/services/logic/logic_app_integration_account_certificate_resource_test.go @@ -5,10 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -82,14 +83,14 @@ func TestAccLogicAppIntegrationAccountCertificate_update(t *testing.T) { } func (r LogicAppIntegrationAccountCertificateResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.IntegrationAccountCertificateID(state.ID) + id, err := integrationaccountcertificates.ParseCertificateID(state.ID) if err != nil { return nil, err } - resp, err := client.Logic.IntegrationAccountCertificateClient.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.CertificateName) + resp, err := client.Logic.IntegrationAccountCertificateClient.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } return nil, fmt.Errorf("retrieving %q %+v", id, err) diff --git a/internal/services/logic/logic_app_integration_account_data_source.go b/internal/services/logic/logic_app_integration_account_data_source.go index 65dce8d3cd52..ffc15ce49137 100644 --- a/internal/services/logic/logic_app_integration_account_data_source.go +++ b/internal/services/logic/logic_app_integration_account_data_source.go @@ -4,14 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceLogicAppIntegrationAccount() *pluginsdk.Resource { @@ -37,7 +37,7 @@ func dataSourceLogicAppIntegrationAccount() *pluginsdk.Resource { Computed: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -48,20 +48,28 @@ func dataSourceLogicAppIntegrationAccountRead(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewIntegrationAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := integrationaccounts.NewIntegrationAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - d.Set("sku_name", string(resp.Sku.Name)) - return tags.FlattenAndSet(d, resp.Tags) + d.Set("name", id.IntegrationAccountName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + if model.Sku != nil { + d.Set("sku_name", string(model.Sku.Name)) + } + + return tags.FlattenAndSet(d, model.Tags) + } + + return nil } diff --git a/internal/services/logic/logic_app_integration_account_map_resource.go b/internal/services/logic/logic_app_integration_account_map_resource.go index 36493a6ec96e..2efd1427fcb2 100644 --- a/internal/services/logic/logic_app_integration_account_map_resource.go +++ b/internal/services/logic/logic_app_integration_account_map_resource.go @@ -5,11 +5,11 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -32,7 +32,7 @@ func resourceLogicAppIntegrationAccountMap() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.IntegrationAccountMapID(id) + _, err := integrationaccountmaps.ParseMapID(id) return err }), @@ -60,14 +60,9 @@ func resourceLogicAppIntegrationAccountMap() *pluginsdk.Resource { }, "map_type": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(logic.MapTypeXslt), - string(logic.MapTypeXslt20), - string(logic.MapTypeXslt30), - string(logic.MapTypeLiquid), - }, false), + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(integrationaccountmaps.PossibleValuesForMapType(), false), }, "metadata": { @@ -88,39 +83,38 @@ func resourceLogicAppIntegrationAccountMapCreateUpdate(d *pluginsdk.ResourceData ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewIntegrationAccountMapID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) + id := integrationaccountmaps.NewMapID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.MapName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_logic_app_integration_account_map", id.ID()) } } - parameters := logic.IntegrationAccountMap{ - IntegrationAccountMapProperties: &logic.IntegrationAccountMapProperties{ - MapType: logic.MapType(d.Get("map_type").(string)), + parameters := integrationaccountmaps.IntegrationAccountMap{ + Properties: integrationaccountmaps.IntegrationAccountMapProperties{ + MapType: integrationaccountmaps.MapType(d.Get("map_type").(string)), Content: utils.String(d.Get("content").(string)), }, } - if parameters.IntegrationAccountMapProperties.MapType == logic.MapTypeLiquid { - parameters.IntegrationAccountMapProperties.ContentType = utils.String("text/plain") + if parameters.Properties.MapType == integrationaccountmaps.MapTypeLiquid { + parameters.Properties.ContentType = utils.String("text/plain") } else { - parameters.IntegrationAccountMapProperties.ContentType = utils.String("application/xml") + parameters.Properties.ContentType = utils.String("application/xml") } if v, ok := d.GetOk("metadata"); ok { - metadata := v.(map[string]interface{}) - parameters.IntegrationAccountMapProperties.Metadata = &metadata + parameters.Properties.Metadata = &v } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.IntegrationAccountName, id.MapName, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -133,14 +127,14 @@ func resourceLogicAppIntegrationAccountMapRead(d *pluginsdk.ResourceData, meta i ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountMapID(d.Id()) + id, err := integrationaccountmaps.ParseMapID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.MapName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state", *id) d.SetId("") return nil @@ -149,16 +143,16 @@ func resourceLogicAppIntegrationAccountMapRead(d *pluginsdk.ResourceData, meta i } d.Set("name", id.MapName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("integration_account_name", id.IntegrationAccountName) - if props := resp.IntegrationAccountMapProperties; props != nil { + if model := resp.Model; model != nil { + props := model.Properties d.Set("map_type", props.MapType) d.Set("content", d.Get("content").(string)) if props.Metadata != nil { - metadata := props.Metadata.(map[string]interface{}) - d.Set("metadata", metadata) + d.Set("metadata", props.Metadata) } } @@ -170,12 +164,12 @@ func resourceLogicAppIntegrationAccountMapDelete(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountMapID(d.Id()) + id, err := integrationaccountmaps.ParseMapID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.IntegrationAccountName, id.MapName); err != nil { + if _, err := client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } diff --git a/internal/services/logic/logic_app_integration_account_map_resource_test.go b/internal/services/logic/logic_app_integration_account_map_resource_test.go index 16055675f53b..d43bd534b0dd 100644 --- a/internal/services/logic/logic_app_integration_account_map_resource_test.go +++ b/internal/services/logic/logic_app_integration_account_map_resource_test.go @@ -5,11 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,10 +20,10 @@ func TestAccLogicAppIntegrationAccountMap_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_logic_app_integration_account_map", "test") r := LogicAppIntegrationAccountMapResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -35,10 +35,10 @@ func TestAccLogicAppIntegrationAccountMap_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_logic_app_integration_account_map", "test") r := LogicAppIntegrationAccountMapResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -50,10 +50,10 @@ func TestAccLogicAppIntegrationAccountMap_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_logic_app_integration_account_map", "test") r := LogicAppIntegrationAccountMapResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -65,10 +65,10 @@ func TestAccLogicAppIntegrationAccountMap_liquidContentType(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_logic_app_integration_account_map", "test") r := LogicAppIntegrationAccountMapResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.liquidContentType(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -80,17 +80,17 @@ func TestAccLogicAppIntegrationAccountMap_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_logic_app_integration_account_map", "test") r := LogicAppIntegrationAccountMapResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("content"), // not returned from the API { Config: r.update(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -99,20 +99,20 @@ func TestAccLogicAppIntegrationAccountMap_update(t *testing.T) { } func (r LogicAppIntegrationAccountMapResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.IntegrationAccountMapID(state.ID) + id, err := integrationaccountmaps.ParseMapID(state.ID) if err != nil { return nil, err } - resp, err := client.Logic.IntegrationAccountMapClient.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.MapName) + resp, err := client.Logic.IntegrationAccountMapClient.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } return nil, fmt.Errorf("retrieving %q %+v", id, err) } - return utils.Bool(resp.IntegrationAccountMapProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (r LogicAppIntegrationAccountMapResource) template(data acceptance.TestData) string { diff --git a/internal/services/logic/logic_app_integration_account_partner_resource.go b/internal/services/logic/logic_app_integration_account_partner_resource.go index e1cf617d6cc4..230fd6e8d998 100644 --- a/internal/services/logic/logic_app_integration_account_partner_resource.go +++ b/internal/services/logic/logic_app_integration_account_partner_resource.go @@ -5,16 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceLogicAppIntegrationAccountPartner() *pluginsdk.Resource { @@ -32,7 +31,7 @@ func resourceLogicAppIntegrationAccountPartner() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.IntegrationAccountPartnerID(id) + _, err := integrationaccountpartners.ParsePartnerID(id) return err }), @@ -89,37 +88,36 @@ func resourceLogicAppIntegrationAccountPartnerCreateUpdate(d *pluginsdk.Resource ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewIntegrationAccountPartnerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) + id := integrationaccountpartners.NewPartnerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.PartnerName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_logic_app_integration_account_partner", id.ID()) } } - parameters := logic.IntegrationAccountPartner{ - IntegrationAccountPartnerProperties: &logic.IntegrationAccountPartnerProperties{ - Content: &logic.PartnerContent{ - B2b: &logic.B2BPartnerContent{ + parameters := integrationaccountpartners.IntegrationAccountPartner{ + Properties: integrationaccountpartners.IntegrationAccountPartnerProperties{ + Content: integrationaccountpartners.PartnerContent{ + B2b: &integrationaccountpartners.B2BPartnerContent{ BusinessIdentities: expandIntegrationAccountPartnerBusinessIdentity(d.Get("business_identity").(*pluginsdk.Set).List()), }, }, - PartnerType: logic.PartnerTypeB2B, + PartnerType: integrationaccountpartners.PartnerTypeBTwoB, }, } if v, ok := d.GetOk("metadata"); ok { - metadata, _ := pluginsdk.ExpandJsonFromString(v.(string)) - parameters.IntegrationAccountPartnerProperties.Metadata = metadata + parameters.Properties.Metadata = &v } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.IntegrationAccountName, id.PartnerName, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -132,14 +130,14 @@ func resourceLogicAppIntegrationAccountPartnerRead(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountPartnerID(d.Id()) + id, err := integrationaccountpartners.ParsePartnerID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.PartnerName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state", *id) d.SetId("") return nil @@ -148,20 +146,19 @@ func resourceLogicAppIntegrationAccountPartnerRead(d *pluginsdk.ResourceData, me } d.Set("name", id.PartnerName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("integration_account_name", id.IntegrationAccountName) - if props := resp.IntegrationAccountPartnerProperties; props != nil { - if props.Content != nil && props.Content.B2b != nil && props.Content.B2b.BusinessIdentities != nil { + if model := resp.Model; model != nil { + props := model.Properties + if props.Content.B2b != nil && props.Content.B2b.BusinessIdentities != nil { if err := d.Set("business_identity", flattenIntegrationAccountPartnerBusinessIdentity(props.Content.B2b.BusinessIdentities)); err != nil { return fmt.Errorf("setting `business_identity`: %+v", err) } } if props.Metadata != nil { - metadataValue := props.Metadata.(map[string]interface{}) - metadataStr, _ := pluginsdk.FlattenJsonToString(metadataValue) - d.Set("metadata", metadataStr) + d.Set("metadata", props.Metadata) } } @@ -173,53 +170,43 @@ func resourceLogicAppIntegrationAccountPartnerDelete(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountPartnerID(d.Id()) + id, err := integrationaccountpartners.ParsePartnerID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.IntegrationAccountName, id.PartnerName); err != nil { + if _, err := client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } return nil } -func expandIntegrationAccountPartnerBusinessIdentity(input []interface{}) *[]logic.BusinessIdentity { - results := make([]logic.BusinessIdentity, 0) +func expandIntegrationAccountPartnerBusinessIdentity(input []interface{}) *[]integrationaccountpartners.BusinessIdentity { + results := make([]integrationaccountpartners.BusinessIdentity, 0) for _, item := range input { v := item.(map[string]interface{}) - results = append(results, logic.BusinessIdentity{ - Qualifier: utils.String(v["qualifier"].(string)), - Value: utils.String(v["value"].(string)), + results = append(results, integrationaccountpartners.BusinessIdentity{ + Qualifier: v["qualifier"].(string), + Value: v["value"].(string), }) } return &results } -func flattenIntegrationAccountPartnerBusinessIdentity(input *[]logic.BusinessIdentity) []interface{} { +func flattenIntegrationAccountPartnerBusinessIdentity(input *[]integrationaccountpartners.BusinessIdentity) []interface{} { results := make([]interface{}, 0) if input == nil { return results } for _, item := range *input { - var qualifier string - if item.Qualifier != nil { - qualifier = *item.Qualifier - } - - var value string - if item.Value != nil { - value = *item.Value - } - results = append(results, map[string]interface{}{ - "qualifier": qualifier, - "value": value, + "qualifier": item.Qualifier, + "value": item.Value, }) } diff --git a/internal/services/logic/logic_app_integration_account_partner_resource_test.go b/internal/services/logic/logic_app_integration_account_partner_resource_test.go index 582fd3741f28..f741bc40904f 100644 --- a/internal/services/logic/logic_app_integration_account_partner_resource_test.go +++ b/internal/services/logic/logic_app_integration_account_partner_resource_test.go @@ -5,12 +5,12 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,10 +20,10 @@ func TestAccLogicAppIntegrationAccountPartner_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_logic_app_integration_account_partner", "test") r := LogicAppIntegrationAccountPartnerResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -35,10 +35,10 @@ func TestAccLogicAppIntegrationAccountPartner_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_logic_app_integration_account_partner", "test") r := LogicAppIntegrationAccountPartnerResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -50,10 +50,10 @@ func TestAccLogicAppIntegrationAccountPartner_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_logic_app_integration_account_partner", "test") r := LogicAppIntegrationAccountPartnerResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data, "DUNS", "FabrikamNY", "bar"), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -65,17 +65,17 @@ func TestAccLogicAppIntegrationAccountPartner_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_logic_app_integration_account_partner", "test") r := LogicAppIntegrationAccountPartnerResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data, "DUNS", "FabrikamNY", "bar"), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data, "AS2Identity", "FabrikamDC", "bar2"), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -83,21 +83,21 @@ func TestAccLogicAppIntegrationAccountPartner_update(t *testing.T) { }) } -func (r LogicAppIntegrationAccountPartnerResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { - id, err := parse.IntegrationAccountPartnerID(state.ID) +func (r LogicAppIntegrationAccountPartnerResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := integrationaccountpartners.ParsePartnerID(state.ID) if err != nil { return nil, err } - resp, err := client.Logic.IntegrationAccountPartnerClient.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.PartnerName) + resp, err := client.Logic.IntegrationAccountPartnerClient.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } return nil, fmt.Errorf("retrieving %q %+v", id, err) } - return utils.Bool(resp.IntegrationAccountPartnerProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (r LogicAppIntegrationAccountPartnerResource) template(data acceptance.TestData) string { diff --git a/internal/services/logic/logic_app_integration_account_resource.go b/internal/services/logic/logic_app_integration_account_resource.go index 7c82f549f2fb..108b124062e7 100644 --- a/internal/services/logic/logic_app_integration_account_resource.go +++ b/internal/services/logic/logic_app_integration_account_resource.go @@ -4,14 +4,14 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -33,7 +33,7 @@ func resourceLogicAppIntegrationAccount() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.IntegrationAccountID(id) + _, err := integrationaccounts.ParseIntegrationAccountID(id) return err }), @@ -53,9 +53,9 @@ func resourceLogicAppIntegrationAccount() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(logic.IntegrationAccountSkuNameBasic), - string(logic.IntegrationAccountSkuNameFree), - string(logic.IntegrationAccountSkuNameStandard), + string(integrationaccounts.IntegrationAccountSkuNameBasic), + string(integrationaccounts.IntegrationAccountSkuNameFree), + string(integrationaccounts.IntegrationAccountSkuNameStandard), }, false), }, @@ -63,10 +63,10 @@ func resourceLogicAppIntegrationAccount() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ForceNew: true, - ValidateFunc: validate.IntegrationServiceEnvironmentID, + ValidateFunc: integrationaccounts.ValidateIntegrationAccountID, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -77,36 +77,36 @@ func resourceLogicAppIntegrationAccountCreateUpdate(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewIntegrationAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := integrationaccounts.NewIntegrationAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for present of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_logic_app_integration_account", id.ID()) } } - account := logic.IntegrationAccount{ - IntegrationAccountProperties: &logic.IntegrationAccountProperties{}, - Location: utils.String(location.Normalize(d.Get("location").(string))), - Sku: &logic.IntegrationAccountSku{ - Name: logic.IntegrationAccountSkuName(d.Get("sku_name").(string)), + account := integrationaccounts.IntegrationAccount{ + Properties: &integrationaccounts.IntegrationAccountProperties{}, + Location: utils.String(location.Normalize(d.Get("location").(string))), + Sku: &integrationaccounts.IntegrationAccountSku{ + Name: integrationaccounts.IntegrationAccountSkuName(d.Get("sku_name").(string)), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } if v, ok := d.GetOk("integration_service_environment_id"); ok { - account.IntegrationAccountProperties.IntegrationServiceEnvironment = &logic.ResourceReference{ - ID: utils.String(v.(string)), + account.Properties.IntegrationServiceEnvironment = &integrationaccounts.ResourceReference{ + Id: utils.String(v.(string)), } } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, account); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, account); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -120,29 +120,37 @@ func resourceLogicAppIntegrationAccountRead(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountID(d.Id()) + id, err := integrationaccounts.ParseIntegrationAccountID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - return fmt.Errorf("retrieving Integration Account %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - d.Set("sku_name", string(resp.Sku.Name)) - - if props := resp.IntegrationAccountProperties; props != nil { - iseId := "" - if props.IntegrationServiceEnvironment != nil && props.IntegrationServiceEnvironment.ID != nil { - iseId = *props.IntegrationServiceEnvironment.ID + d.Set("name", id.IntegrationAccountName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + + if model.Sku != nil { + d.Set("sku_name", string(model.Sku.Name)) } - d.Set("integration_service_environment_id", iseId) + + if props := model.Properties; props != nil { + iseId := "" + if props.IntegrationServiceEnvironment != nil && props.IntegrationServiceEnvironment.Id != nil { + iseId = *props.IntegrationServiceEnvironment.Id + } + d.Set("integration_service_environment_id", iseId) + } + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceLogicAppIntegrationAccountDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -150,13 +158,13 @@ func resourceLogicAppIntegrationAccountDelete(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountID(d.Id()) + id, err := integrationaccounts.ParseIntegrationAccountID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.Name); err != nil { - return fmt.Errorf("deleting Integration Account %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } return nil diff --git a/internal/services/logic/logic_app_integration_account_resource_test.go b/internal/services/logic/logic_app_integration_account_resource_test.go index 6a1ffe6cf780..96c1a5ba8250 100644 --- a/internal/services/logic/logic_app_integration_account_resource_test.go +++ b/internal/services/logic/logic_app_integration_account_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -111,17 +111,17 @@ func TestAccLogicAppIntegrationAccount_integrationServiceEnvironment(t *testing. } func (LogicAppIntegrationAccountResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.IntegrationAccountID(state.ID) + id, err := integrationaccounts.ParseIntegrationAccountID(state.ID) if err != nil { return nil, err } - resp, err := clients.Logic.IntegrationAccountClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := clients.Logic.IntegrationAccountClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Logic App Workflow %s (resource group: %s): %v", id.Name, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %v", id, err) } - return utils.Bool(resp.IntegrationAccountProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (r LogicAppIntegrationAccountResource) template(data acceptance.TestData) string { diff --git a/internal/services/logic/logic_app_integration_account_schema_resource.go b/internal/services/logic/logic_app_integration_account_schema_resource.go index dc80710c82bb..b7f92e749852 100644 --- a/internal/services/logic/logic_app_integration_account_schema_resource.go +++ b/internal/services/logic/logic_app_integration_account_schema_resource.go @@ -5,11 +5,11 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -32,7 +32,7 @@ func resourceLogicAppIntegrationAccountSchema() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.IntegrationAccountSchemaID(id) + _, err := integrationaccountschemas.ParseSchemaID(id) return err }), @@ -81,38 +81,37 @@ func resourceLogicAppIntegrationAccountSchemaCreateUpdate(d *pluginsdk.ResourceD ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewIntegrationAccountSchemaID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) + id := integrationaccountschemas.NewSchemaID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.SchemaName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_logic_app_integration_account_schema", id.ID()) } } - parameters := logic.IntegrationAccountSchema{ - IntegrationAccountSchemaProperties: &logic.IntegrationAccountSchemaProperties{ - SchemaType: logic.SchemaTypeXML, + parameters := integrationaccountschemas.IntegrationAccountSchema{ + Properties: integrationaccountschemas.IntegrationAccountSchemaProperties{ + SchemaType: integrationaccountschemas.SchemaTypeXml, Content: utils.String(d.Get("content").(string)), ContentType: utils.String("application/xml"), }, } if v, ok := d.GetOk("file_name"); ok { - parameters.IntegrationAccountSchemaProperties.FileName = utils.String(v.(string)) + parameters.Properties.FileName = utils.String(v.(string)) } if v, ok := d.GetOk("metadata"); ok { - metadata, _ := pluginsdk.ExpandJsonFromString(v.(string)) - parameters.IntegrationAccountSchemaProperties.Metadata = metadata + parameters.Properties.Metadata = &v } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.IntegrationAccountName, id.SchemaName, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -125,14 +124,14 @@ func resourceLogicAppIntegrationAccountSchemaRead(d *pluginsdk.ResourceData, met ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountSchemaID(d.Id()) + id, err := integrationaccountschemas.ParseSchemaID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.SchemaName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state", *id) d.SetId("") return nil @@ -141,17 +140,16 @@ func resourceLogicAppIntegrationAccountSchemaRead(d *pluginsdk.ResourceData, met } d.Set("name", id.SchemaName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("integration_account_name", id.IntegrationAccountName) - if props := resp.IntegrationAccountSchemaProperties; props != nil { + if model := resp.Model; model != nil { + props := model.Properties d.Set("content", d.Get("content").(string)) d.Set("file_name", d.Get("file_name").(string)) if props.Metadata != nil { - metadataValue := props.Metadata.(map[string]interface{}) - metadataStr, _ := pluginsdk.FlattenJsonToString(metadataValue) - d.Set("metadata", metadataStr) + d.Set("metadata", props.Metadata) } } @@ -163,12 +161,12 @@ func resourceLogicAppIntegrationAccountSchemaDelete(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountSchemaID(d.Id()) + id, err := integrationaccountschemas.ParseSchemaID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.IntegrationAccountName, id.SchemaName); err != nil { + if _, err := client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } diff --git a/internal/services/logic/logic_app_integration_account_schema_resource_test.go b/internal/services/logic/logic_app_integration_account_schema_resource_test.go index 8cfd572959e0..cd03e8eec484 100644 --- a/internal/services/logic/logic_app_integration_account_schema_resource_test.go +++ b/internal/services/logic/logic_app_integration_account_schema_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -83,17 +83,17 @@ func TestAccLogicAppIntegrationAccountSchema_update(t *testing.T) { } func (LogicAppIntegrationAccountSchemaResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.IntegrationAccountSchemaID(state.ID) + id, err := integrationaccountschemas.ParseSchemaID(state.ID) if err != nil { return nil, err } - resp, err := clients.Logic.IntegrationAccountSchemaClient.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.SchemaName) + resp, err := clients.Logic.IntegrationAccountSchemaClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("reading %q: %+v", id, err) } - return utils.Bool(resp.IntegrationAccountSchemaProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (r LogicAppIntegrationAccountSchemaResource) template(data acceptance.TestData) string { diff --git a/internal/services/logic/logic_app_integration_account_session_resource.go b/internal/services/logic/logic_app_integration_account_session_resource.go index 7a234eb9f994..79fac07382c1 100644 --- a/internal/services/logic/logic_app_integration_account_session_resource.go +++ b/internal/services/logic/logic_app_integration_account_session_resource.go @@ -5,16 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceLogicAppIntegrationAccountSession() *pluginsdk.Resource { @@ -32,7 +31,7 @@ func resourceLogicAppIntegrationAccountSession() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.IntegrationAccountSessionID(id) + _, err := integrationaccountsessions.ParseSessionID(id) return err }), @@ -68,32 +67,29 @@ func resourceLogicAppIntegrationAccountSessionCreateUpdate(d *pluginsdk.Resource ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewIntegrationAccountSessionID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) + id := integrationaccountsessions.NewSessionID(subscriptionId, d.Get("resource_group_name").(string), d.Get("integration_account_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.SessionName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_logic_app_integration_account_session", id.ID()) } } - content, err := pluginsdk.ExpandJsonFromString(d.Get("content").(string)) - if err != nil { - return fmt.Errorf("expanding JSON for `content`: %+v", err) - } + content := d.Get("content") - parameters := logic.IntegrationAccountSession{ - IntegrationAccountSessionProperties: &logic.IntegrationAccountSessionProperties{ - Content: content, + parameters := integrationaccountsessions.IntegrationAccountSession{ + Properties: integrationaccountsessions.IntegrationAccountSessionProperties{ + Content: &content, }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.IntegrationAccountName, id.SessionName, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -106,14 +102,14 @@ func resourceLogicAppIntegrationAccountSessionRead(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountSessionID(d.Id()) + id, err := integrationaccountsessions.ParseSessionID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.SessionName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil @@ -122,14 +118,13 @@ func resourceLogicAppIntegrationAccountSessionRead(d *pluginsdk.ResourceData, me } d.Set("name", id.SessionName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("integration_account_name", id.IntegrationAccountName) - if props := resp.IntegrationAccountSessionProperties; props != nil { + if model := resp.Model; model != nil { + props := model.Properties if props.Content != nil { - contentValue := props.Content.(map[string]interface{}) - contentStr, _ := pluginsdk.FlattenJsonToString(contentValue) - d.Set("content", contentStr) + d.Set("content", props.Content) } } @@ -141,12 +136,12 @@ func resourceLogicAppIntegrationAccountSessionDelete(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.IntegrationAccountSessionID(d.Id()) + id, err := integrationaccountsessions.ParseSessionID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.IntegrationAccountName, id.SessionName); err != nil { + if _, err := client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } return nil diff --git a/internal/services/logic/logic_app_integration_account_session_resource_test.go b/internal/services/logic/logic_app_integration_account_session_resource_test.go index 58cb9d56bcc7..bc141d764880 100644 --- a/internal/services/logic/logic_app_integration_account_session_resource_test.go +++ b/internal/services/logic/logic_app_integration_account_session_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -71,17 +71,17 @@ func TestAccLogicAppIntegrationAccountSession_update(t *testing.T) { } func (LogicAppIntegrationAccountSessionResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.IntegrationAccountSessionID(state.ID) + id, err := integrationaccountsessions.ParseSessionID(state.ID) if err != nil { return nil, err } - resp, err := clients.Logic.IntegrationAccountSessionClient.Get(ctx, id.ResourceGroup, id.IntegrationAccountName, id.SessionName) + resp, err := clients.Logic.IntegrationAccountSessionClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("reading %q: %+v", id, err) } - return utils.Bool(resp.IntegrationAccountSessionProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (r LogicAppIntegrationAccountSessionResource) template(data acceptance.TestData) string { diff --git a/internal/services/logic/logic_app_standard_resource.go b/internal/services/logic/logic_app_standard_resource.go index 63892c3d5b34..020e55a79d31 100644 --- a/internal/services/logic/logic_app_standard_resource.go +++ b/internal/services/logic/logic_app_standard_resource.go @@ -232,11 +232,16 @@ func resourceLogicAppStandard() *pluginsdk.Resource { func resourceLogicAppStandardCreate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Web.AppServicesClient - endpointSuffix := meta.(*clients.Client).Account.Environment.StorageEndpointSuffix subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() + env := meta.(*clients.Client).Account.Environment + storageAccountDomainSuffix, ok := env.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine the domain suffix for storage accounts in environment %q: %+v", env.Name, env.Storage) + } + log.Printf("[INFO] preparing arguments for AzureRM Logic App Standard creation.") id := parse.NewLogicAppStandardID( @@ -282,7 +287,7 @@ func resourceLogicAppStandardCreate(d *pluginsdk.ResourceData, meta interface{}) VirtualNetworkSubnetID := d.Get("virtual_network_subnet_id").(string) t := d.Get("tags").(map[string]interface{}) - basicAppSettings, err := getBasicLogicAppSettings(d, endpointSuffix) + basicAppSettings, err := getBasicLogicAppSettings(d, *storageAccountDomainSuffix) if err != nil { return err } @@ -349,10 +354,15 @@ func resourceLogicAppStandardCreate(d *pluginsdk.ResourceData, meta interface{}) func resourceLogicAppStandardUpdate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Web.AppServicesClient - endpointSuffix := meta.(*clients.Client).Account.Environment.StorageEndpointSuffix ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() + env := meta.(*clients.Client).Account.Environment + storageAccountDomainSuffix, ok := env.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine the domain suffix for storage accounts in environment %q: %+v", env.Name, env.Storage) + } + id, err := parse.LogicAppStandardID(d.Id()) if err != nil { return err @@ -367,7 +377,7 @@ func resourceLogicAppStandardUpdate(d *pluginsdk.ResourceData, meta interface{}) httpsOnly := d.Get("https_only").(bool) t := d.Get("tags").(map[string]interface{}) - basicAppSettings, err := getBasicLogicAppSettings(d, endpointSuffix) + basicAppSettings, err := getBasicLogicAppSettings(d, *storageAccountDomainSuffix) if err != nil { return err } @@ -385,7 +395,7 @@ func resourceLogicAppStandardUpdate(d *pluginsdk.ResourceData, meta interface{}) siteConfig.AppSettings = &basicAppSettings // WEBSITE_VNET_ROUTE_ALL is superseded by a setting in site_config that defaults to false from 2021-02-01 - appSettings, err := expandLogicAppStandardSettings(d, endpointSuffix) + appSettings, err := expandLogicAppStandardSettings(d, *storageAccountDomainSuffix) if err != nil { return fmt.Errorf("expanding `app_settings`: %+v", err) } diff --git a/internal/services/logic/logic_app_trigger_custom_resource.go b/internal/services/logic/logic_app_trigger_custom_resource.go index bb24ad8048ad..aba8e8f5f046 100644 --- a/internal/services/logic/logic_app_trigger_custom_resource.go +++ b/internal/services/logic/logic_app_trigger_custom_resource.go @@ -6,8 +6,9 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" ) @@ -20,7 +21,7 @@ func resourceLogicAppTriggerCustom() *pluginsdk.Resource { Delete: resourceLogicAppTriggerCustomDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.TriggerID(id) + _, err := workflowtriggers.ParseTriggerID(id) return err }), @@ -56,18 +57,18 @@ func resourceLogicAppTriggerCustom() *pluginsdk.Resource { } func resourceLogicAppTriggerCustomCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - workflowId, err := parse.WorkflowID(d.Get("logic_app_id").(string)) + workflowId, err := workflows.ParseWorkflowID(d.Get("logic_app_id").(string)) if err != nil { return err } - id := parse.NewTriggerID(workflowId.SubscriptionId, workflowId.ResourceGroup, workflowId.Name, d.Get("name").(string)) + id := workflowtriggers.NewTriggerID(workflowId.SubscriptionId, workflowId.ResourceGroupName, workflowId.WorkflowName, d.Get("name").(string)) bodyRaw := d.Get("body").(string) var body map[string]interface{} if err := json.Unmarshal([]byte(bodyRaw), &body); err != nil { - return fmt.Errorf("unmarshalling JSON for Custom Trigger %q: %+v", id.Name, err) + return fmt.Errorf("unmarshalling JSON for %s: %+v", id.ID(), err) } log.Printf("[DEBUG] logic_custom_trigger initial body is: %s", body) @@ -80,26 +81,28 @@ func resourceLogicAppTriggerCustomCreateUpdate(d *pluginsdk.ResourceData, meta i } func resourceLogicAppTriggerCustomRead(d *pluginsdk.ResourceData, meta interface{}) error { - id, err := parse.TriggerID(d.Id()) + id, err := workflowtriggers.ParseTriggerID(d.Id()) if err != nil { return err } - t, app, err := retrieveLogicAppTrigger(d, meta, id.ResourceGroup, id.WorkflowName, id.Name) + workflowId := workflows.NewWorkflowID(id.SubscriptionId, id.ResourceGroupName, id.WorkflowName) + + t, app, err := retrieveLogicAppTrigger(d, meta, workflowId, id.TriggerName) if err != nil { return err } if t == nil { - log.Printf("[DEBUG] Logic App %q (Resource Group %q) does not contain Trigger %q - removing from state", id.WorkflowName, id.ResourceGroup, id.Name) + log.Printf("[DEBUG] Logic App %q (Resource Group %q) does not contain Trigger %q - removing from state", id.WorkflowName, id.ResourceGroupName, id.TriggerName) d.SetId("") return nil } action := *t - d.Set("name", id.Name) - d.Set("logic_app_id", app.ID) + d.Set("name", id.TriggerName) + d.Set("logic_app_id", app.Id) // Azure returns an additional field called evaluatedRecurrence in the trigger body which // is a copy of the recurrence specified in the body property and breaks the diff suppress logic @@ -107,24 +110,26 @@ func resourceLogicAppTriggerCustomRead(d *pluginsdk.ResourceData, meta interface body, err := json.Marshal(action) if err != nil { - return fmt.Errorf("serializing `body` for Trigger %q: %+v", id.Name, err) + return fmt.Errorf("serializing `body` for %s: %+v", id.ID(), err) } log.Printf("[DEBUG] logic_custom_trigger body is: %s", string(body)) if err := d.Set("body", string(body)); err != nil { - return fmt.Errorf("setting `body` for Trigger %q: %+v", id.Name, err) + return fmt.Errorf("setting `body` for %s: %+v", id.ID(), err) } return nil } func resourceLogicAppTriggerCustomDelete(d *pluginsdk.ResourceData, meta interface{}) error { - id, err := parse.TriggerID(d.Id()) + id, err := workflowtriggers.ParseTriggerID(d.Id()) if err != nil { return err } - err = resourceLogicAppTriggerRemove(d, meta, id.ResourceGroup, id.WorkflowName, id.Name) + workflowId := workflows.NewWorkflowID(id.SubscriptionId, id.ResourceGroupName, id.WorkflowName) + + err = resourceLogicAppTriggerRemove(d, meta, workflowId, id.TriggerName) if err != nil { return fmt.Errorf("removing Trigger %s: %+v", id, err) } diff --git a/internal/services/logic/logic_app_trigger_http_request_resource.go b/internal/services/logic/logic_app_trigger_http_request_resource.go index c83abf54b8d2..283585434494 100644 --- a/internal/services/logic/logic_app_trigger_http_request_resource.go +++ b/internal/services/logic/logic_app_trigger_http_request_resource.go @@ -8,8 +8,9 @@ import ( "net/http" "time" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -23,7 +24,7 @@ func resourceLogicAppTriggerHttpRequest() *pluginsdk.Resource { Delete: resourceLogicAppTriggerHttpRequestDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.TriggerID(id) + _, err := workflowtriggers.ParseTriggerID(id) return err }), @@ -118,12 +119,12 @@ func resourceLogicAppTriggerHttpRequestCreateUpdate(d *pluginsdk.ResourceData, m "type": "Request", } - workflowId, err := parse.WorkflowID(d.Get("logic_app_id").(string)) + workflowId, err := workflows.ParseWorkflowID(d.Get("logic_app_id").(string)) if err != nil { return err } - id := parse.NewTriggerID(workflowId.SubscriptionId, workflowId.ResourceGroup, workflowId.Name, d.Get("name").(string)) + id := workflowtriggers.NewTriggerID(workflowId.SubscriptionId, workflowId.ResourceGroupName, workflowId.WorkflowName, d.Get("name").(string)) if err := resourceLogicAppTriggerUpdate(d, meta, *workflowId, id, trigger, "azurerm_logic_app_trigger_http_request"); err != nil { return err @@ -133,26 +134,26 @@ func resourceLogicAppTriggerHttpRequestCreateUpdate(d *pluginsdk.ResourceData, m } func resourceLogicAppTriggerHttpRequestRead(d *pluginsdk.ResourceData, meta interface{}) error { - id, err := parse.TriggerID(d.Id()) + id, err := workflowtriggers.ParseTriggerID(d.Id()) if err != nil { return err } - t, app, url, err := retrieveLogicAppHttpTrigger(d, meta, id.ResourceGroup, id.WorkflowName, id.Name) + t, app, url, err := retrieveLogicAppHttpTrigger(d, meta, *id) if err != nil { return err } if t == nil { - log.Printf("[DEBUG] Logic App %q (Resource Group %q) does not contain Trigger %q - removing from state", id.WorkflowName, id.ResourceGroup, id.Name) + log.Printf("[DEBUG] Logic App %q (Resource Group %q) does not contain %s - removing from state", id.WorkflowName, id.ResourceGroupName, id.ID()) d.SetId("") return nil } trigger := *t - d.Set("name", id.Name) - d.Set("logic_app_id", app.ID) + d.Set("name", id.TriggerName) + d.Set("logic_app_id", app.Id) d.Set("callback_url", url) v := trigger["inputs"] @@ -186,12 +187,14 @@ func resourceLogicAppTriggerHttpRequestRead(d *pluginsdk.ResourceData, meta inte } func resourceLogicAppTriggerHttpRequestDelete(d *pluginsdk.ResourceData, meta interface{}) error { - id, err := parse.TriggerID(d.Id()) + id, err := workflowtriggers.ParseTriggerID(d.Id()) if err != nil { return err } - err = resourceLogicAppTriggerRemove(d, meta, id.ResourceGroup, id.WorkflowName, id.Name) + workflowId := workflows.NewWorkflowID(id.SubscriptionId, id.ResourceGroupName, id.WorkflowName) + + err = resourceLogicAppTriggerRemove(d, meta, workflowId, id.TriggerName) if err != nil { return fmt.Errorf("removing Trigger %s: %+v", id, err) } diff --git a/internal/services/logic/logic_app_trigger_recurrence_resource.go b/internal/services/logic/logic_app_trigger_recurrence_resource.go index 05ef795c1177..27e5dfff4627 100644 --- a/internal/services/logic/logic_app_trigger_recurrence_resource.go +++ b/internal/services/logic/logic_app_trigger_recurrence_resource.go @@ -5,8 +5,9 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -20,7 +21,7 @@ func resourceLogicAppTriggerRecurrence() *pluginsdk.Resource { Delete: resourceLogicAppTriggerRecurrenceDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.TriggerID(id) + _, err := workflowtriggers.ParseTriggerID(id) return err }), @@ -146,12 +147,12 @@ func resourceLogicAppTriggerRecurrenceCreateUpdate(d *pluginsdk.ResourceData, me trigger["recurrence"].(map[string]interface{})["schedule"] = expandLogicAppTriggerRecurrenceSchedule(v.([]interface{})) } - workflowId, err := parse.WorkflowID(d.Get("logic_app_id").(string)) + workflowId, err := workflows.ParseWorkflowID(d.Get("logic_app_id").(string)) if err != nil { return err } - id := parse.NewTriggerID(workflowId.SubscriptionId, workflowId.ResourceGroup, workflowId.Name, d.Get("name").(string)) + id := workflowtriggers.NewTriggerID(workflowId.SubscriptionId, workflowId.ResourceGroupName, workflowId.WorkflowName, d.Get("name").(string)) if err := resourceLogicAppTriggerUpdate(d, meta, *workflowId, id, trigger, "azurerm_logic_app_trigger_recurrence"); err != nil { return err @@ -161,26 +162,28 @@ func resourceLogicAppTriggerRecurrenceCreateUpdate(d *pluginsdk.ResourceData, me } func resourceLogicAppTriggerRecurrenceRead(d *pluginsdk.ResourceData, meta interface{}) error { - id, err := parse.TriggerID(d.Id()) + id, err := workflowtriggers.ParseTriggerID(d.Id()) if err != nil { return err } - t, app, err := retrieveLogicAppTrigger(d, meta, id.ResourceGroup, id.WorkflowName, id.Name) + workflowId := workflows.NewWorkflowID(id.SubscriptionId, id.ResourceGroupName, id.WorkflowName) + + t, app, err := retrieveLogicAppTrigger(d, meta, workflowId, id.TriggerName) if err != nil { return err } if t == nil { - log.Printf("[DEBUG] Logic App %q (Resource Group %q) does not contain Trigger %q - removing from state", id.WorkflowName, id.ResourceGroup, id.Name) + log.Printf("[DEBUG] Logic App %q (Resource Group %q) does not contain %s - removing from state", id.WorkflowName, id.ResourceGroupName, id.ID()) d.SetId("") return nil } trigger := *t - d.Set("name", id.Name) - d.Set("logic_app_id", app.ID) + d.Set("name", id.TriggerName) + d.Set("logic_app_id", app.Id) v := trigger["recurrence"] if v == nil { @@ -216,12 +219,14 @@ func resourceLogicAppTriggerRecurrenceRead(d *pluginsdk.ResourceData, meta inter } func resourceLogicAppTriggerRecurrenceDelete(d *pluginsdk.ResourceData, meta interface{}) error { - id, err := parse.TriggerID(d.Id()) + id, err := workflowtriggers.ParseTriggerID(d.Id()) if err != nil { return err } - err = resourceLogicAppTriggerRemove(d, meta, id.ResourceGroup, id.WorkflowName, id.Name) + workflowId := workflows.NewWorkflowID(id.SubscriptionId, id.ResourceGroupName, id.WorkflowName) + + err = resourceLogicAppTriggerRemove(d, meta, workflowId, id.TriggerName) if err != nil { return fmt.Errorf("removing Trigger %s: %+v", id, err) } diff --git a/internal/services/logic/logic_app_workflow_data_source.go b/internal/services/logic/logic_app_workflow_data_source.go index 33d616c8c746..8ae8d6f6cd05 100644 --- a/internal/services/logic/logic_app_workflow_data_source.go +++ b/internal/services/logic/logic_app_workflow_data_source.go @@ -5,15 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceLogicAppWorkflow() *pluginsdk.Resource { @@ -86,22 +86,22 @@ func dataSourceLogicAppWorkflow() *pluginsdk.Resource { Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } func dataSourceLogicAppWorkflowRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Logic.WorkflowClient - subscriptionId := meta.(*clients.Client).Logic.WorkflowClient.SubscriptionID + subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewWorkflowID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := workflows.NewWorkflowID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("Logic App Workflow %s was not found", id) } @@ -110,60 +110,69 @@ func dataSourceLogicAppWorkflowRead(d *pluginsdk.ResourceData, meta interface{}) d.SetId(id.ID()) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) - identity, err := flattenLogicAppWorkflowIdentity(resp.Identity) - if err != nil { - return err - } - d.Set("identity", identity) - - if props := resp.WorkflowProperties; props != nil { - parameters := flattenLogicAppDataSourceWorkflowParameters(props.Parameters) - if err := d.Set("parameters", parameters); err != nil { - return fmt.Errorf("setting `parameters`: %+v", err) + identity, err := identity.FlattenSystemOrUserAssignedMap(model.Identity) + if err != nil { + return err } + d.Set("identity", identity) - d.Set("access_endpoint", props.AccessEndpoint) + if props := model.Properties; props != nil { + parameters := flattenLogicAppDataSourceWorkflowParameters(props.Parameters) + if err := d.Set("parameters", parameters); err != nil { + return fmt.Errorf("setting `parameters`: %+v", err) + } - if props.EndpointsConfiguration == nil || props.EndpointsConfiguration.Connector == nil { - d.Set("connector_endpoint_ip_addresses", []interface{}{}) - d.Set("connector_outbound_ip_addresses", []interface{}{}) - } else { - d.Set("connector_endpoint_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Connector.AccessEndpointIPAddresses)) - d.Set("connector_outbound_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Connector.OutgoingIPAddresses)) - } + d.Set("access_endpoint", props.AccessEndpoint) - if props.EndpointsConfiguration == nil || props.EndpointsConfiguration.Workflow == nil { - d.Set("workflow_endpoint_ip_addresses", []interface{}{}) - d.Set("workflow_outbound_ip_addresses", []interface{}{}) - } else { - d.Set("workflow_endpoint_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Workflow.AccessEndpointIPAddresses)) - d.Set("workflow_outbound_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Workflow.OutgoingIPAddresses)) - } + if props.EndpointsConfiguration == nil || props.EndpointsConfiguration.Connector == nil { + d.Set("connector_endpoint_ip_addresses", []interface{}{}) + d.Set("connector_outbound_ip_addresses", []interface{}{}) + } else { + d.Set("connector_endpoint_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Connector.AccessEndpointIPAddresses)) + d.Set("connector_outbound_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Connector.OutgoingIPAddresses)) + } - if definition := props.Definition; definition != nil { - if v, ok := definition.(map[string]interface{}); ok { - d.Set("workflow_schema", v["$schema"].(string)) - d.Set("workflow_version", v["contentVersion"].(string)) + if props.EndpointsConfiguration == nil || props.EndpointsConfiguration.Workflow == nil { + d.Set("workflow_endpoint_ip_addresses", []interface{}{}) + d.Set("workflow_outbound_ip_addresses", []interface{}{}) + } else { + d.Set("workflow_endpoint_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Workflow.AccessEndpointIPAddresses)) + d.Set("workflow_outbound_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Workflow.OutgoingIPAddresses)) + } + + if definition := props.Definition; definition != nil { + definitionRaw := *props.Definition + if v, ok := definitionRaw.(map[string]interface{}); ok { + d.Set("workflow_schema", v["$schema"].(string)) + d.Set("workflow_version", v["contentVersion"].(string)) + } } - } - if props.IntegrationAccount != nil && props.IntegrationAccount.ID != nil { - d.Set("logic_app_integration_account_id", props.IntegrationAccount.ID) + if props.IntegrationAccount != nil && props.IntegrationAccount.Id != nil { + d.Set("logic_app_integration_account_id", props.IntegrationAccount.Id) + } } + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } -func flattenLogicAppDataSourceWorkflowParameters(input map[string]*logic.WorkflowParameter) map[string]interface{} { +func flattenLogicAppDataSourceWorkflowParameters(input *map[string]workflows.WorkflowParameter) map[string]interface{} { output := make(map[string]interface{}) + if input == nil { + return output + } - for k, v := range input { - if v != nil { - // we only support string parameters at this time - val, ok := v.Value.(string) + for k, v := range *input { + // we only support string parameters at this time + if v.Value != nil { + rawValue := *v.Value + val, ok := rawValue.(string) if !ok { log.Printf("[DEBUG] Skipping parameter %q since it's not a string", k) } diff --git a/internal/services/logic/logic_app_workflow_resource.go b/internal/services/logic/logic_app_workflow_resource.go index bf20995ef047..d8e5c59c40d6 100644 --- a/internal/services/logic/logic_app_workflow_resource.go +++ b/internal/services/logic/logic_app_workflow_resource.go @@ -8,17 +8,17 @@ import ( "strconv" "time" - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" // nolint: staticcheck - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -35,7 +35,7 @@ func resourceLogicAppWorkflow() *pluginsdk.Resource { Delete: resourceLogicAppWorkflowDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.WorkflowID(id) + _, err := workflows.ParseWorkflowID(id) return err }), @@ -68,7 +68,7 @@ func resourceLogicAppWorkflow() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ForceNew: true, - ValidateFunc: validate.IntegrationServiceEnvironmentID, + ValidateFunc: integrationserviceenvironments.ValidateIntegrationServiceEnvironmentID, }, "access_control": { @@ -203,7 +203,7 @@ func resourceLogicAppWorkflow() *pluginsdk.Resource { "logic_app_integration_account_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: validate.IntegrationAccountID, + ValidateFunc: integrationaccounts.ValidateIntegrationAccountID, }, // TODO: should Parameters be split out into their own object to allow validation on the different sub-types? @@ -269,30 +269,30 @@ func resourceLogicAppWorkflow() *pluginsdk.Resource { Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } func resourceLogicAppWorkflowCreate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Logic.WorkflowClient - subscriptionId := meta.(*clients.Client).Logic.WorkflowClient.SubscriptionID + subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() log.Printf("[INFO] preparing arguments for Logic App Workflow creation.") - id := parse.NewWorkflowID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := workflows.NewWorkflowID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing Logic App Workflow %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_logic_app_workflow", id.ID()) } } @@ -312,50 +312,54 @@ func resourceLogicAppWorkflowCreate(d *pluginsdk.ResourceData, meta interface{}) } t := d.Get("tags").(map[string]interface{}) - isEnabled := logic.WorkflowStateEnabled + isEnabled := workflows.WorkflowStateEnabled if v := d.Get("enabled").(bool); !v { - isEnabled = logic.WorkflowStateDisabled + isEnabled = workflows.WorkflowStateDisabled } - identity, err := expandLogicAppWorkflowIdentity(d.Get("identity").([]interface{})) + identity, err := identity.ExpandSystemOrUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } - properties := logic.Workflow{ + // nolint gosimple + var definition interface{} + definition = map[string]interface{}{ + "$schema": workflowSchema, + "contentVersion": workflowVersion, + "actions": make(map[string]interface{}), + "triggers": make(map[string]interface{}), + "parameters": workflowParameters, + } + + properties := workflows.Workflow{ Identity: identity, Location: utils.String(location), - WorkflowProperties: &logic.WorkflowProperties{ - Definition: &map[string]interface{}{ - "$schema": workflowSchema, - "contentVersion": workflowVersion, - "actions": make(map[string]interface{}), - "triggers": make(map[string]interface{}), - "parameters": workflowParameters, - }, + Properties: &workflows.WorkflowProperties{ + Definition: &definition, Parameters: parameters, - State: isEnabled, + State: &isEnabled, }, Tags: tags.Expand(t), } if v, ok := d.GetOk("access_control"); ok { - properties.WorkflowProperties.AccessControl = expandLogicAppWorkflowAccessControl(v.([]interface{})) + properties.Properties.AccessControl = expandLogicAppWorkflowAccessControl(v.([]interface{})) } if iseID, ok := d.GetOk("integration_service_environment_id"); ok { - properties.WorkflowProperties.IntegrationServiceEnvironment = &logic.ResourceReference{ - ID: utils.String(iseID.(string)), + properties.Properties.IntegrationServiceEnvironment = &workflows.ResourceReference{ + Id: utils.String(iseID.(string)), } } if v, ok := d.GetOk("logic_app_integration_account_id"); ok { - properties.WorkflowProperties.IntegrationAccount = &logic.ResourceReference{ - ID: utils.String(v.(string)), + properties.Properties.IntegrationAccount = &workflows.ResourceReference{ + Id: utils.String(v.(string)), } } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, properties); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, properties); err != nil { return fmt.Errorf("[ERROR] Error creating Logic App Workflow %s: %+v", id, err) } @@ -369,18 +373,18 @@ func resourceLogicAppWorkflowUpdate(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.WorkflowID(d.Id()) + id, err := workflows.ParseWorkflowID(d.Id()) if err != nil { return err } // lock to prevent against Actions, Parameters or Triggers conflicting - locks.ByName(id.Name, logicAppResourceName) - defer locks.UnlockByName(id.Name, logicAppResourceName) + locks.ByName(id.WorkflowName, logicAppResourceName) + defer locks.UnlockByName(id.WorkflowName, logicAppResourceName) - read, err := client.Get(ctx, id.ResourceGroup, id.Name) + read, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(read.Response) { + if response.WasNotFound(read.HttpResponse) { d.SetId("") return nil } @@ -388,7 +392,7 @@ func resourceLogicAppWorkflowUpdate(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("[ERROR] Error making Read request on Logic App Workflow %s: %+v", id, err) } - if read.WorkflowProperties == nil { + if read.Model == nil || read.Model.Properties == nil { return fmt.Errorf("[ERROR] Error parsing Logic App Workflow - `WorkflowProperties` is nil") } @@ -404,47 +408,52 @@ func resourceLogicAppWorkflowUpdate(d *pluginsdk.ResourceData, meta interface{}) t := d.Get("tags").(map[string]interface{}) - definition := read.WorkflowProperties.Definition.(map[string]interface{}) - definition["parameters"] = workflowParameters + var definition interface{} + if read.Model.Properties.Definition != nil { + definitionRaw := *read.Model.Properties.Definition + definitionMap := definitionRaw.(map[string]interface{}) + definitionMap["parameters"] = workflowParameters + definition = definitionMap + } - isEnabled := logic.WorkflowStateEnabled + isEnabled := workflows.WorkflowStateEnabled if v := d.Get("enabled").(bool); !v { - isEnabled = logic.WorkflowStateDisabled + isEnabled = workflows.WorkflowStateDisabled } - identity, err := expandLogicAppWorkflowIdentity(d.Get("identity").([]interface{})) + identity, err := identity.ExpandSystemOrUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } - properties := logic.Workflow{ + properties := workflows.Workflow{ Identity: identity, Location: utils.String(location), - WorkflowProperties: &logic.WorkflowProperties{ - Definition: definition, + Properties: &workflows.WorkflowProperties{ + Definition: &definition, Parameters: parameters, - State: isEnabled, + State: &isEnabled, }, Tags: tags.Expand(t), } if v, ok := d.GetOk("access_control"); ok { - properties.WorkflowProperties.AccessControl = expandLogicAppWorkflowAccessControl(v.([]interface{})) + properties.Properties.AccessControl = expandLogicAppWorkflowAccessControl(v.([]interface{})) } if v, ok := d.GetOk("logic_app_integration_account_id"); ok { - properties.WorkflowProperties.IntegrationAccount = &logic.ResourceReference{ - ID: utils.String(v.(string)), + properties.Properties.IntegrationAccount = &workflows.ResourceReference{ + Id: utils.String(v.(string)), } } if iseID, ok := d.GetOk("integration_service_environment_id"); ok { - properties.WorkflowProperties.IntegrationServiceEnvironment = &logic.ResourceReference{ - ID: utils.String(iseID.(string)), + properties.Properties.IntegrationServiceEnvironment = &workflows.ResourceReference{ + Id: utils.String(iseID.(string)), } } - if _, err = client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, properties); err != nil { + if _, err = client.CreateOrUpdate(ctx, *id, properties); err != nil { return fmt.Errorf("updating Logic App Workflow %s: %+v", id, err) } @@ -456,14 +465,14 @@ func resourceLogicAppWorkflowRead(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.WorkflowID(d.Id()) + id, err := workflows.ParseWorkflowID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] Logic App Workflow %s was not found - removing from state", id) d.SetId("") return nil @@ -471,93 +480,98 @@ func resourceLogicAppWorkflowRead(d *pluginsdk.ResourceData, meta interface{}) e return fmt.Errorf("[ERROR] Error making Read request on Logic App Workflow %s: %+v", id, err) } - d.Set("name", resp.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.WorkflowName) + d.Set("resource_group_name", id.ResourceGroupName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + if model := resp.Model; model != nil { + if location := model.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) + } - identity, err := flattenLogicAppWorkflowIdentity(resp.Identity) - if err != nil { - return err - } - d.Set("identity", identity) + identity, err := identity.FlattenSystemOrUserAssignedMap(model.Identity) + if err != nil { + return err + } + d.Set("identity", identity) - if props := resp.WorkflowProperties; props != nil { - d.Set("access_endpoint", props.AccessEndpoint) + if props := model.Properties; props != nil { + d.Set("access_endpoint", props.AccessEndpoint) - if err := d.Set("access_control", flattenLogicAppWorkflowFlowAccessControl(props.AccessControl)); err != nil { - return fmt.Errorf("setting `access_control`: %+v", err) - } + if err := d.Set("access_control", flattenLogicAppWorkflowFlowAccessControl(props.AccessControl)); err != nil { + return fmt.Errorf("setting `access_control`: %+v", err) + } - if props.State != "" { - d.Set("enabled", props.State == logic.WorkflowStateEnabled) - } + if props.State != nil && *props.State != "" { + d.Set("enabled", *props.State == workflows.WorkflowStateEnabled) + } - if props.EndpointsConfiguration == nil || props.EndpointsConfiguration.Connector == nil { - d.Set("connector_endpoint_ip_addresses", []interface{}{}) - d.Set("connector_outbound_ip_addresses", []interface{}{}) - } else { - d.Set("connector_endpoint_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Connector.AccessEndpointIPAddresses)) - d.Set("connector_outbound_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Connector.OutgoingIPAddresses)) - } + if props.EndpointsConfiguration == nil || props.EndpointsConfiguration.Connector == nil { + d.Set("connector_endpoint_ip_addresses", []interface{}{}) + d.Set("connector_outbound_ip_addresses", []interface{}{}) + } else { + d.Set("connector_endpoint_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Connector.AccessEndpointIPAddresses)) + d.Set("connector_outbound_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Connector.OutgoingIPAddresses)) + } - if props.EndpointsConfiguration == nil || props.EndpointsConfiguration.Workflow == nil { - d.Set("workflow_endpoint_ip_addresses", []interface{}{}) - d.Set("workflow_outbound_ip_addresses", []interface{}{}) - } else { - d.Set("workflow_endpoint_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Workflow.AccessEndpointIPAddresses)) - d.Set("workflow_outbound_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Workflow.OutgoingIPAddresses)) - } - if definition := props.Definition; definition != nil { - if v, ok := definition.(map[string]interface{}); ok { - if v["$schema"] != nil { - d.Set("workflow_schema", v["$schema"].(string)) - } - if v["contentVersion"] != nil { - d.Set("workflow_version", v["contentVersion"].(string)) - } - if p, ok := v["parameters"]; ok { - workflowParameters, err := flattenLogicAppWorkflowWorkflowParameters(p.(map[string]interface{})) - if err != nil { - return fmt.Errorf("flattening `workflow_parameters`: %+v", err) - } - if err := d.Set("workflow_parameters", workflowParameters); err != nil { - return fmt.Errorf("setting `workflow_parameters`: %+v", err) + if props.EndpointsConfiguration == nil || props.EndpointsConfiguration.Workflow == nil { + d.Set("workflow_endpoint_ip_addresses", []interface{}{}) + d.Set("workflow_outbound_ip_addresses", []interface{}{}) + } else { + d.Set("workflow_endpoint_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Workflow.AccessEndpointIPAddresses)) + d.Set("workflow_outbound_ip_addresses", flattenIPAddresses(props.EndpointsConfiguration.Workflow.OutgoingIPAddresses)) + } + if definition := props.Definition; definition != nil { + definitionRaw := *props.Definition + if v, ok := definitionRaw.(map[string]interface{}); ok { + if v["$schema"] != nil { + d.Set("workflow_schema", v["$schema"].(string)) } - - // The props.Parameters (the value of the param) is accompany with the "parameters" (the definition of the param) inside the props.Definition. - // We will need to make use of the definition of the parameters in order to properly flatten the value of the parameters being set (for kinds of types). - parameters, err := flattenLogicAppWorkflowParameters(d, props.Parameters, p.(map[string]interface{})) - if err != nil { - return fmt.Errorf("flattening `parameters`: %v", err) + if v["contentVersion"] != nil { + d.Set("workflow_version", v["contentVersion"].(string)) } - if err := d.Set("parameters", parameters); err != nil { - return fmt.Errorf("setting `parameters`: %+v", err) + if p, ok := v["parameters"]; ok { + workflowParameters, err := flattenLogicAppWorkflowWorkflowParameters(p.(map[string]interface{})) + if err != nil { + return fmt.Errorf("flattening `workflow_parameters`: %+v", err) + } + if err := d.Set("workflow_parameters", workflowParameters); err != nil { + return fmt.Errorf("setting `workflow_parameters`: %+v", err) + } + + // The props.Parameters (the value of the param) is accompany with the "parameters" (the definition of the param) inside the props.Definition. + // We will need to make use of the definition of the parameters in order to properly flatten the value of the parameters being set (for kinds of types). + parameters, err := flattenLogicAppWorkflowParameters(d, props.Parameters, p.(map[string]interface{})) + if err != nil { + return fmt.Errorf("flattening `parameters`: %v", err) + } + if err := d.Set("parameters", parameters); err != nil { + return fmt.Errorf("setting `parameters`: %+v", err) + } } } } - } - integrationServiceEnvironmentId := "" - if props.IntegrationServiceEnvironment != nil && props.IntegrationServiceEnvironment.ID != nil { - integrationServiceEnvironmentId = *props.IntegrationServiceEnvironment.ID - } - d.Set("integration_service_environment_id", integrationServiceEnvironmentId) + integrationServiceEnvironmentId := "" + if props.IntegrationServiceEnvironment != nil && props.IntegrationServiceEnvironment.Id != nil { + integrationServiceEnvironmentId = *props.IntegrationServiceEnvironment.Id + } + d.Set("integration_service_environment_id", integrationServiceEnvironmentId) - if props.IntegrationAccount != nil && props.IntegrationAccount.ID != nil { - d.Set("logic_app_integration_account_id", props.IntegrationAccount.ID) - } + if props.IntegrationAccount != nil && props.IntegrationAccount.Id != nil { + d.Set("logic_app_integration_account_id", props.IntegrationAccount.Id) + } - integrationAccountId := "" - if props.IntegrationAccount != nil && props.IntegrationAccount.ID != nil { - integrationAccountId = *props.IntegrationAccount.ID + integrationAccountId := "" + if props.IntegrationAccount != nil && props.IntegrationAccount.Id != nil { + integrationAccountId = *props.IntegrationAccount.Id + } + d.Set("logic_app_integration_account_id", integrationAccountId) } - d.Set("logic_app_integration_account_id", integrationAccountId) + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceLogicAppWorkflowDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -565,18 +579,18 @@ func resourceLogicAppWorkflowDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.WorkflowID(d.Id()) + id, err := workflows.ParseWorkflowID(d.Id()) if err != nil { return err } // lock to prevent against Actions, Parameters or Triggers conflicting - locks.ByName(id.Name, logicAppResourceName) - defer locks.UnlockByName(id.Name, logicAppResourceName) + locks.ByName(id.WorkflowName, logicAppResourceName) + defer locks.UnlockByName(id.WorkflowName, logicAppResourceName) - resp, err := client.Delete(ctx, id.ResourceGroup, id.Name) + resp, err := client.Delete(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp) { + if response.WasNotFound(resp.HttpResponse) { return nil } @@ -586,8 +600,8 @@ func resourceLogicAppWorkflowDelete(d *pluginsdk.ResourceData, meta interface{}) return nil } -func expandLogicAppWorkflowParameters(input map[string]interface{}, paramDefs map[string]interface{}) (map[string]*logic.WorkflowParameter, error) { - output := make(map[string]*logic.WorkflowParameter) +func expandLogicAppWorkflowParameters(input map[string]interface{}, paramDefs map[string]interface{}) (*map[string]workflows.WorkflowParameter, error) { + output := make(map[string]workflows.WorkflowParameter) for k, v := range input { defRaw, ok := paramDefs[k] @@ -595,59 +609,62 @@ func expandLogicAppWorkflowParameters(input map[string]interface{}, paramDefs ma return nil, fmt.Errorf("no parameter definition for %s", k) } def := defRaw.(map[string]interface{}) - t := logic.ParameterType(def["type"].(string)) + t := workflows.ParameterType(def["type"].(string)) v := v.(string) var value interface{} switch t { - case logic.ParameterTypeBool: + case workflows.ParameterTypeBool: var uv bool if err := json.Unmarshal([]byte(v), &uv); err != nil { return nil, fmt.Errorf("unmarshalling %s to bool: %v", k, err) } value = uv - case logic.ParameterTypeFloat: + case workflows.ParameterTypeFloat: var uv float64 if err := json.Unmarshal([]byte(v), &uv); err != nil { return nil, fmt.Errorf("unmarshalling %s to float64: %v", k, err) } value = uv - case logic.ParameterTypeInt: + case workflows.ParameterTypeInt: var uv int if err := json.Unmarshal([]byte(v), &uv); err != nil { return nil, fmt.Errorf("unmarshalling %s to int: %v", k, err) } value = uv - case logic.ParameterTypeArray: + case workflows.ParameterTypeArray: var uv []interface{} if err := json.Unmarshal([]byte(v), &uv); err != nil { return nil, fmt.Errorf("unmarshalling %s to []interface{}: %v", k, err) } value = uv - case logic.ParameterTypeObject, - logic.ParameterTypeSecureObject: + case workflows.ParameterTypeObject, + workflows.ParameterTypeSecureObject: var uv map[string]interface{} if err := json.Unmarshal([]byte(v), &uv); err != nil { return nil, fmt.Errorf("unmarshalling %s to map[string]interface{}: %v", k, err) } value = uv - case logic.ParameterTypeString, - logic.ParameterTypeSecureString: + case workflows.ParameterTypeString, + workflows.ParameterTypeSecureString: value = v } - output[k] = &logic.WorkflowParameter{ - Type: t, - Value: value, + output[k] = workflows.WorkflowParameter{ + Type: &t, + Value: &value, } } - return output, nil + return &output, nil } -func flattenLogicAppWorkflowParameters(d *pluginsdk.ResourceData, input map[string]*logic.WorkflowParameter, paramDefs map[string]interface{}) (map[string]interface{}, error) { +func flattenLogicAppWorkflowParameters(d *pluginsdk.ResourceData, input *map[string]workflows.WorkflowParameter, paramDefs map[string]interface{}) (map[string]interface{}, error) { output := make(map[string]interface{}) + if input == nil { + return output, nil + } // Read the "parameters" from state, which is used to fill in the "sensitive" properties. paramInState := make(map[string]interface{}) @@ -656,7 +673,7 @@ func flattenLogicAppWorkflowParameters(d *pluginsdk.ResourceData, input map[stri paramInState = params } - for k, v := range input { + for k, v := range *input { defRaw, ok := paramDefs[k] if !ok { // This should never happen. @@ -664,18 +681,17 @@ func flattenLogicAppWorkflowParameters(d *pluginsdk.ResourceData, input map[stri continue } - if v == nil { - log.Printf("[WARN] The value of parameter %s is nil", k) - continue - } - def := defRaw.(map[string]interface{}) - t := logic.ParameterType(def["type"].(string)) + t := workflows.ParameterType(def["type"].(string)) var value string switch t { - case logic.ParameterTypeBool: - tv, ok := v.Value.(bool) + case workflows.ParameterTypeBool: + if v.Value == nil { + return nil, fmt.Errorf("the value of parameter %s is expected to be bool, but got nil", k) + } + valueRaw := *v.Value + tv, ok := valueRaw.(bool) if !ok { return nil, fmt.Errorf("the value of parameter %s is expected to be bool, but got %T", k, v.Value) } @@ -683,23 +699,35 @@ func flattenLogicAppWorkflowParameters(d *pluginsdk.ResourceData, input map[stri if !tv { value = "false" } - case logic.ParameterTypeFloat: + case workflows.ParameterTypeFloat: + if v.Value == nil { + return nil, fmt.Errorf("the value of parameter %s is expected to be bool, but got nil", k) + } + valueRaw := *v.Value // Note that the json unmarshalled response doesn't differ between float and int, as json has only type number. - tv, ok := v.Value.(float64) + tv, ok := valueRaw.(float64) if !ok { return nil, fmt.Errorf("the value of parameter %s is expected to be float64, but got %T", k, v.Value) } value = strconv.FormatFloat(tv, 'f', -1, 64) - case logic.ParameterTypeInt: + case workflows.ParameterTypeInt: + if v.Value == nil { + return nil, fmt.Errorf("the value of parameter %s is expected to be bool, but got nil", k) + } + valueRaw := *v.Value // Note that the json unmarshalled response doesn't differ between float and int, as json has only type number. - tv, ok := v.Value.(float64) + tv, ok := valueRaw.(float64) if !ok { return nil, fmt.Errorf("the value of parameter %s is expected to be float64, but got %T", k, v.Value) } value = strconv.Itoa(int(tv)) - case logic.ParameterTypeArray: - tv, ok := v.Value.([]interface{}) + case workflows.ParameterTypeArray: + if v.Value == nil { + return nil, fmt.Errorf("the value of parameter %s is expected to be bool, but got nil", k) + } + valueRaw := *v.Value + tv, ok := valueRaw.([]interface{}) if !ok { return nil, fmt.Errorf("the value of parameter %s is expected to be []interface{}, but got %T", k, v.Value) } @@ -709,8 +737,12 @@ func flattenLogicAppWorkflowParameters(d *pluginsdk.ResourceData, input map[stri } value = string(obj) - case logic.ParameterTypeObject: - tv, ok := v.Value.(map[string]interface{}) + case workflows.ParameterTypeObject: + if v.Value == nil { + return nil, fmt.Errorf("the value of parameter %s is expected to be bool, but got nil", k) + } + valueRaw := *v.Value + tv, ok := valueRaw.(map[string]interface{}) if !ok { return nil, fmt.Errorf("the value of parameter %s is expected to be map[string]interface{}, but got %T", k, v.Value) } @@ -720,15 +752,19 @@ func flattenLogicAppWorkflowParameters(d *pluginsdk.ResourceData, input map[stri } value = string(obj) - case logic.ParameterTypeString: - tv, ok := v.Value.(string) + case workflows.ParameterTypeString: + if v.Value == nil { + return nil, fmt.Errorf("the value of parameter %s is expected to be bool, but got nil", k) + } + valueRaw := *v.Value + tv, ok := valueRaw.(string) if !ok { return nil, fmt.Errorf("the value of parameter %s is expected to be string, but got %T", k, v.Value) } value = tv - case logic.ParameterTypeSecureString, - logic.ParameterTypeSecureObject: + case workflows.ParameterTypeSecureString, + workflows.ParameterTypeSecureObject: // This is not returned from API, we will try to read them from the state instead. if v, ok := paramInState[k]; ok { value = v.(string) // The value in state here is guaranteed to be a string, so directly cast the type. @@ -757,13 +793,13 @@ func expandLogicAppWorkflowWorkflowParameters(input map[string]interface{}) (map return output, nil } -func expandLogicAppWorkflowAccessControl(input []interface{}) *logic.FlowAccessControlConfiguration { +func expandLogicAppWorkflowAccessControl(input []interface{}) *workflows.FlowAccessControlConfiguration { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - result := logic.FlowAccessControlConfiguration{} + result := workflows.FlowAccessControlConfiguration{} if contents := v["content"].([]interface{}); len(contents) != 0 { result.Contents = expandLogicAppWorkflowAccessControlConfigurationPolicy(contents) @@ -784,31 +820,31 @@ func expandLogicAppWorkflowAccessControl(input []interface{}) *logic.FlowAccessC return &result } -func expandLogicAppWorkflowAccessControlConfigurationPolicy(input []interface{}) *logic.FlowAccessControlConfigurationPolicy { +func expandLogicAppWorkflowAccessControlConfigurationPolicy(input []interface{}) *workflows.FlowAccessControlConfigurationPolicy { if len(input) == 0 || input[0] == nil { return nil } v := input[0].(map[string]interface{}) - return &logic.FlowAccessControlConfigurationPolicy{ + return &workflows.FlowAccessControlConfigurationPolicy{ AllowedCallerIPAddresses: expandLogicAppWorkflowIPAddressRanges(v["allowed_caller_ip_address_range"].(*pluginsdk.Set).List()), } } -func expandLogicAppWorkflowAccessControlTriggerConfigurationPolicy(input []interface{}) *logic.FlowAccessControlConfigurationPolicy { +func expandLogicAppWorkflowAccessControlTriggerConfigurationPolicy(input []interface{}) *workflows.FlowAccessControlConfigurationPolicy { if len(input) == 0 || input[0] == nil { return nil } v := input[0].(map[string]interface{}) - result := logic.FlowAccessControlConfigurationPolicy{ + result := workflows.FlowAccessControlConfigurationPolicy{ AllowedCallerIPAddresses: expandLogicAppWorkflowIPAddressRanges(v["allowed_caller_ip_address_range"].(*pluginsdk.Set).List()), } if openAuthenticationPolicy, ok := v["open_authentication_policy"]; ok { openAuthenticationPolicies := openAuthenticationPolicy.(*pluginsdk.Set).List() if len(openAuthenticationPolicies) != 0 { - result.OpenAuthenticationPolicies = &logic.OpenAuthenticationAccessPolicies{ + result.OpenAuthenticationPolicies = &workflows.OpenAuthenticationAccessPolicies{ Policies: expandLogicAppWorkflowOpenAuthenticationPolicy(openAuthenticationPolicies), } } @@ -817,11 +853,11 @@ func expandLogicAppWorkflowAccessControlTriggerConfigurationPolicy(input []inter return &result } -func expandLogicAppWorkflowIPAddressRanges(input []interface{}) *[]logic.IPAddressRange { - results := make([]logic.IPAddressRange, 0) +func expandLogicAppWorkflowIPAddressRanges(input []interface{}) *[]workflows.IPAddressRange { + results := make([]workflows.IPAddressRange, 0) for _, item := range input { - results = append(results, logic.IPAddressRange{ + results = append(results, workflows.IPAddressRange{ AddressRange: utils.String(item.(string)), }) } @@ -829,32 +865,33 @@ func expandLogicAppWorkflowIPAddressRanges(input []interface{}) *[]logic.IPAddre return &results } -func expandLogicAppWorkflowOpenAuthenticationPolicy(input []interface{}) map[string]*logic.OpenAuthenticationAccessPolicy { +func expandLogicAppWorkflowOpenAuthenticationPolicy(input []interface{}) *map[string]workflows.OpenAuthenticationAccessPolicy { if len(input) == 0 { return nil } - results := make(map[string]*logic.OpenAuthenticationAccessPolicy) + results := make(map[string]workflows.OpenAuthenticationAccessPolicy) for _, item := range input { v := item.(map[string]interface{}) policyName := v["name"].(string) - results[policyName] = &logic.OpenAuthenticationAccessPolicy{ - Type: logic.OpenAuthenticationProviderTypeAAD, + policyType := workflows.OpenAuthenticationProviderTypeAAD + results[policyName] = workflows.OpenAuthenticationAccessPolicy{ + Type: &policyType, Claims: expandLogicAppWorkflowOpenAuthenticationPolicyClaim(v["claim"].(*pluginsdk.Set).List()), } } - return results + return &results } -func expandLogicAppWorkflowOpenAuthenticationPolicyClaim(input []interface{}) *[]logic.OpenAuthenticationPolicyClaim { - results := make([]logic.OpenAuthenticationPolicyClaim, 0) +func expandLogicAppWorkflowOpenAuthenticationPolicyClaim(input []interface{}) *[]workflows.OpenAuthenticationPolicyClaim { + results := make([]workflows.OpenAuthenticationPolicyClaim, 0) for _, item := range input { v := item.(map[string]interface{}) - results = append(results, logic.OpenAuthenticationPolicyClaim{ + results = append(results, workflows.OpenAuthenticationPolicyClaim{ Name: utils.String(v["name"].(string)), Value: utils.String(v["value"].(string)), }) @@ -862,60 +899,6 @@ func expandLogicAppWorkflowOpenAuthenticationPolicyClaim(input []interface{}) *[ return &results } -func expandLogicAppWorkflowIdentity(input []interface{}) (*logic.ManagedServiceIdentity, error) { - config, err := identity.ExpandSystemOrUserAssignedMap(input) - if err != nil { - return nil, err - } - - var identityIds map[string]*logic.UserAssignedIdentity - if len(config.IdentityIds) != 0 { - identityIds = map[string]*logic.UserAssignedIdentity{} - for id := range config.IdentityIds { - identityIds[id] = &logic.UserAssignedIdentity{} - } - } - - return &logic.ManagedServiceIdentity{ - Type: logic.ManagedServiceIdentityType(config.Type), - UserAssignedIdentities: identityIds, - }, nil -} - -func flattenLogicAppWorkflowIdentity(input *logic.ManagedServiceIdentity) (*[]interface{}, error) { - var config *identity.SystemOrUserAssignedMap - if input != nil { - identityIds := map[string]identity.UserAssignedIdentityDetails{} - for id := range input.UserAssignedIdentities { - parsedId, err := commonids.ParseUserAssignedIdentityIDInsensitively(id) - if err != nil { - return nil, err - } - identityIds[parsedId.ID()] = identity.UserAssignedIdentityDetails{ - // intentionally empty - } - } - - principalId := "" - if input.PrincipalID != nil { - principalId = input.PrincipalID.String() - } - - tenantId := "" - if input.TenantID != nil { - tenantId = input.TenantID.String() - } - - config = &identity.SystemOrUserAssignedMap{ - Type: identity.Type(string(input.Type)), - PrincipalId: principalId, - TenantId: tenantId, - IdentityIds: identityIds, - } - } - return identity.FlattenSystemOrUserAssignedMap(config) -} - func flattenLogicAppWorkflowWorkflowParameters(input map[string]interface{}) (map[string]interface{}, error) { if input == nil { return nil, nil @@ -931,7 +914,7 @@ func flattenLogicAppWorkflowWorkflowParameters(input map[string]interface{}) (ma return output, nil } -func flattenIPAddresses(input *[]logic.IPAddress) []interface{} { +func flattenIPAddresses(input *[]workflows.IPAddress) []interface{} { if input == nil { return []interface{}{} } @@ -943,7 +926,7 @@ func flattenIPAddresses(input *[]logic.IPAddress) []interface{} { return addresses } -func flattenLogicAppWorkflowFlowAccessControl(input *logic.FlowAccessControlConfiguration) []interface{} { +func flattenLogicAppWorkflowFlowAccessControl(input *workflows.FlowAccessControlConfiguration) []interface{} { if input == nil { return make([]interface{}, 0) } @@ -958,7 +941,7 @@ func flattenLogicAppWorkflowFlowAccessControl(input *logic.FlowAccessControlConf } } -func flattenLogicAppWorkflowAccessControlConfigurationPolicy(input *logic.FlowAccessControlConfigurationPolicy) []interface{} { +func flattenLogicAppWorkflowAccessControlConfigurationPolicy(input *workflows.FlowAccessControlConfigurationPolicy) []interface{} { if input == nil { return []interface{}{} } @@ -970,7 +953,7 @@ func flattenLogicAppWorkflowAccessControlConfigurationPolicy(input *logic.FlowAc } } -func flattenLogicAppWorkflowAccessControlTriggerConfigurationPolicy(input *logic.FlowAccessControlConfigurationPolicy) []interface{} { +func flattenLogicAppWorkflowAccessControlTriggerConfigurationPolicy(input *workflows.FlowAccessControlConfigurationPolicy) []interface{} { if input == nil { return []interface{}{} } @@ -983,7 +966,7 @@ func flattenLogicAppWorkflowAccessControlTriggerConfigurationPolicy(input *logic } } -func flattenLogicAppWorkflowIPAddressRanges(input *[]logic.IPAddressRange) []interface{} { +func flattenLogicAppWorkflowIPAddressRanges(input *[]workflows.IPAddressRange) []interface{} { results := make([]interface{}, 0) if input == nil { return results @@ -1000,13 +983,13 @@ func flattenLogicAppWorkflowIPAddressRanges(input *[]logic.IPAddressRange) []int return results } -func flattenLogicAppWorkflowOpenAuthenticationPolicy(input *logic.OpenAuthenticationAccessPolicies) []interface{} { +func flattenLogicAppWorkflowOpenAuthenticationPolicy(input *workflows.OpenAuthenticationAccessPolicies) []interface{} { results := make([]interface{}, 0) if input == nil || input.Policies == nil { return results } - for k, v := range input.Policies { + for k, v := range *input.Policies { results = append(results, map[string]interface{}{ "name": k, "claim": flattenLogicAppWorkflowOpenAuthenticationPolicyClaim(v.Claims), @@ -1016,7 +999,7 @@ func flattenLogicAppWorkflowOpenAuthenticationPolicy(input *logic.OpenAuthentica return results } -func flattenLogicAppWorkflowOpenAuthenticationPolicyClaim(input *[]logic.OpenAuthenticationPolicyClaim) []interface{} { +func flattenLogicAppWorkflowOpenAuthenticationPolicyClaim(input *[]workflows.OpenAuthenticationPolicyClaim) []interface{} { results := make([]interface{}, 0) if input == nil { return results diff --git a/internal/services/logic/logic_app_workflow_resource_test.go b/internal/services/logic/logic_app_workflow_resource_test.go index 1704788258c6..3ab8c2bf7929 100644 --- a/internal/services/logic/logic_app_workflow_resource_test.go +++ b/internal/services/logic/logic_app_workflow_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -212,17 +212,17 @@ func TestAccLogicAppWorkflow_identity(t *testing.T) { } func (LogicAppWorkflowResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.WorkflowID(state.ID) + id, err := workflows.ParseWorkflowID(state.ID) if err != nil { return nil, err } - resp, err := clients.Logic.WorkflowClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := clients.Logic.WorkflowClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving Logic App Workflow %s: %+v", id, err) } - return utils.Bool(resp.WorkflowProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (LogicAppWorkflowResource) empty(data acceptance.TestData) string { diff --git a/internal/services/logic/logic_apps.go b/internal/services/logic/logic_apps.go index edc3d41d605e..f90ce008361b 100644 --- a/internal/services/logic/logic_apps.go +++ b/internal/services/logic/logic_apps.go @@ -4,14 +4,16 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) // NOTE: this file is not a recommended way of developing Terraform resources; this exists to work around the fact that this API is dynamic (by its nature) @@ -43,15 +45,15 @@ func expandLogicAppActionRunAfter(input []interface{}) map[string]interface{} { return output } -func resourceLogicAppActionUpdate(d *pluginsdk.ResourceData, meta interface{}, workflowId parse.WorkflowId, actionId parse.ActionId, vals map[string]interface{}, resourceName string) error { +func resourceLogicAppActionUpdate(d *pluginsdk.ResourceData, meta interface{}, workflowId workflows.WorkflowId, actionId parse.ActionId, vals map[string]interface{}, resourceName string) error { return resourceLogicAppComponentUpdate(d, meta, "Action", "actions", workflowId, actionId.ID(), actionId.Name, vals, resourceName) } -func resourceLogicAppTriggerUpdate(d *pluginsdk.ResourceData, meta interface{}, workflowId parse.WorkflowId, triggerId parse.TriggerId, vals map[string]interface{}, resourceName string) error { - return resourceLogicAppComponentUpdate(d, meta, "Trigger", "triggers", workflowId, triggerId.ID(), triggerId.Name, vals, resourceName) +func resourceLogicAppTriggerUpdate(d *pluginsdk.ResourceData, meta interface{}, workflowId workflows.WorkflowId, triggerId workflowtriggers.TriggerId, vals map[string]interface{}, resourceName string) error { + return resourceLogicAppComponentUpdate(d, meta, "Trigger", "triggers", workflowId, triggerId.ID(), triggerId.TriggerName, vals, resourceName) } -func resourceLogicAppComponentUpdate(d *pluginsdk.ResourceData, meta interface{}, kind string, propertyName string, workflowId parse.WorkflowId, resourceId string, name string, vals map[string]interface{}, resourceName string) error { +func resourceLogicAppComponentUpdate(d *pluginsdk.ResourceData, meta interface{}, kind string, propertyName string, workflowId workflows.WorkflowId, resourceId string, name string, vals map[string]interface{}, resourceName string) error { client := meta.(*clients.Client).Logic.WorkflowClient ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -59,28 +61,29 @@ func resourceLogicAppComponentUpdate(d *pluginsdk.ResourceData, meta interface{} log.Printf("[DEBUG] Preparing arguments for Logic App Workspace %s %s %q", workflowId, kind, name) // lock to prevent against Actions or Triggers conflicting - locks.ByName(workflowId.Name, logicAppResourceName) - defer locks.UnlockByName(workflowId.Name, logicAppResourceName) + locks.ByName(workflowId.WorkflowName, logicAppResourceName) + defer locks.UnlockByName(workflowId.WorkflowName, logicAppResourceName) - read, err := client.Get(ctx, workflowId.ResourceGroup, workflowId.Name) + read, err := client.Get(ctx, workflowId) if err != nil { - if utils.ResponseWasNotFound(read.Response) { + if response.WasNotFound(read.HttpResponse) { return fmt.Errorf("[ERROR] Logic App Workflow %s was not found", workflowId) } return fmt.Errorf("[ERROR] Error making Read request on Logic App Workflow %s: %+v", workflowId, err) } - if read.WorkflowProperties == nil { + if read.Model == nil || read.Model.Properties == nil { return fmt.Errorf("[ERROR] Error parsing Logic App Workflow - `WorkflowProperties` is nil") } - if read.WorkflowProperties.Definition == nil { + if read.Model.Properties.Definition == nil { return fmt.Errorf("[ERROR] Error parsing Logic App Workflow - `WorkflowProperties.Definition` is nil") } - definition := read.WorkflowProperties.Definition.(map[string]interface{}) - vs := definition[propertyName].(map[string]interface{}) + rawDefinition := *read.Model.Properties.Definition + definitionMap := rawDefinition.(map[string]interface{}) + vs := definitionMap[propertyName].(map[string]interface{}) if d.IsNewResource() { if _, hasExisting := vs[name]; hasExisting { @@ -89,29 +92,30 @@ func resourceLogicAppComponentUpdate(d *pluginsdk.ResourceData, meta interface{} } vs[name] = vals - definition[propertyName] = vs + definitionMap[propertyName] = vs + rawDefinition = definitionMap - if read.Identity != nil && read.Identity.UserAssignedIdentities != nil { - for k := range read.Identity.UserAssignedIdentities { - read.Identity.UserAssignedIdentities[k] = &logic.UserAssignedIdentity{ + if read.Model.Identity != nil && read.Model.Identity.IdentityIds != nil { + for k := range read.Model.Identity.IdentityIds { + read.Model.Identity.IdentityIds[k] = identity.UserAssignedIdentityDetails{ // this has to be an empty object due to the API design } } } - properties := logic.Workflow{ - Location: read.Location, - WorkflowProperties: &logic.WorkflowProperties{ - Definition: definition, - Parameters: read.WorkflowProperties.Parameters, - AccessControl: read.WorkflowProperties.AccessControl, - IntegrationAccount: read.WorkflowProperties.IntegrationAccount, - IntegrationServiceEnvironment: read.IntegrationServiceEnvironment, + properties := workflows.Workflow{ + Location: read.Model.Location, + Properties: &workflows.WorkflowProperties{ + Definition: &rawDefinition, + Parameters: read.Model.Properties.Parameters, + AccessControl: read.Model.Properties.AccessControl, + IntegrationAccount: read.Model.Properties.IntegrationAccount, + IntegrationServiceEnvironment: read.Model.Properties.IntegrationServiceEnvironment, }, - Identity: read.Identity, - Tags: read.Tags, + Identity: read.Model.Identity, + Tags: read.Model.Tags, } - if _, err = client.CreateOrUpdate(ctx, workflowId.ResourceGroup, workflowId.Name, properties); err != nil { + if _, err = client.CreateOrUpdate(ctx, workflowId, properties); err != nil { return fmt.Errorf("updating Logic App Workflow %s for %s %q: %+v", workflowId, kind, name, err) } @@ -122,141 +126,159 @@ func resourceLogicAppComponentUpdate(d *pluginsdk.ResourceData, meta interface{} return nil } -func resourceLogicAppActionRemove(d *pluginsdk.ResourceData, meta interface{}, resourceGroup, logicAppName, name string) error { - return resourceLogicAppComponentRemove(d, meta, "Action", "actions", resourceGroup, logicAppName, name) +func resourceLogicAppActionRemove(d *pluginsdk.ResourceData, meta interface{}, id workflows.WorkflowId, name string) error { + return resourceLogicAppComponentRemove(d, meta, "Action", "actions", id, name) } -func resourceLogicAppTriggerRemove(d *pluginsdk.ResourceData, meta interface{}, resourceGroup, logicAppName, name string) error { - return resourceLogicAppComponentRemove(d, meta, "Trigger", "triggers", resourceGroup, logicAppName, name) +func resourceLogicAppTriggerRemove(d *pluginsdk.ResourceData, meta interface{}, id workflows.WorkflowId, name string) error { + return resourceLogicAppComponentRemove(d, meta, "Trigger", "triggers", id, name) } -func resourceLogicAppComponentRemove(d *pluginsdk.ResourceData, meta interface{}, kind, propertyName, resourceGroup, logicAppName, name string) error { +func resourceLogicAppComponentRemove(d *pluginsdk.ResourceData, meta interface{}, kind, propertyName string, id workflows.WorkflowId, name string) error { client := meta.(*clients.Client).Logic.WorkflowClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[DEBUG] Preparing arguments for Logic App Workspace %q (Resource Group %q) %s %q Deletion", logicAppName, resourceGroup, kind, name) + log.Printf("[DEBUG] Preparing arguments for Logic App Workspace %q (Resource Group %q) %s %q Deletion", id.WorkflowName, id.ResourceGroupName, kind, name) // lock to prevent against Actions, Parameters or Actions conflicting - locks.ByName(logicAppName, logicAppResourceName) - defer locks.UnlockByName(logicAppName, logicAppResourceName) + locks.ByName(id.WorkflowName, logicAppResourceName) + defer locks.UnlockByName(id.WorkflowName, logicAppResourceName) - read, err := client.Get(ctx, resourceGroup, logicAppName) + read, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(read.Response) { + if response.WasNotFound(read.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("[ERROR] Error making Read request on Logic App Workflow %q (Resource Group %q): %+v", logicAppName, resourceGroup, err) + return fmt.Errorf("[ERROR] Error making Read request on %s: %+v", id.ID(), err) } - if read.WorkflowProperties == nil { - return fmt.Errorf("[ERROR] Error parsing Logic App Workflow - `WorkflowProperties` is nil") + if read.Model == nil { + return fmt.Errorf("[ERROR] Error parsing Logic App Workflow - `Model` is nil") + } + + if read.Model.Properties == nil { + return fmt.Errorf("[ERROR] Error parsing Logic App Workflow - `Properties` is nil") } - if read.WorkflowProperties.Definition == nil { + if read.Model.Properties.Definition == nil { return fmt.Errorf("[ERROR] Error parsing Logic App Workflow - `WorkflowProperties.Definition` is nil") } - definition := read.WorkflowProperties.Definition.(map[string]interface{}) - vs := definition[propertyName].(map[string]interface{}) + var definition interface{} + definitionRaw := *read.Model.Properties.Definition + definitionMap := definitionRaw.(map[string]interface{}) + vs := definitionMap[propertyName].(map[string]interface{}) delete(vs, name) - definition[propertyName] = vs - - properties := logic.Workflow{ - Location: read.Location, - WorkflowProperties: &logic.WorkflowProperties{ - Definition: definition, - Parameters: read.WorkflowProperties.Parameters, - AccessControl: read.WorkflowProperties.AccessControl, - IntegrationAccount: read.WorkflowProperties.IntegrationAccount, - IntegrationServiceEnvironment: read.IntegrationServiceEnvironment, + definitionMap[propertyName] = vs + definition = definitionMap + + properties := workflows.Workflow{ + Location: read.Model.Location, + Properties: &workflows.WorkflowProperties{ + Definition: &definition, + Parameters: read.Model.Properties.Parameters, + AccessControl: read.Model.Properties.AccessControl, + IntegrationAccount: read.Model.Properties.IntegrationAccount, + IntegrationServiceEnvironment: read.Model.Properties.IntegrationServiceEnvironment, }, - Tags: read.Tags, + Tags: read.Model.Tags, } - if _, err = client.CreateOrUpdate(ctx, resourceGroup, logicAppName, properties); err != nil { - return fmt.Errorf("removing %s %q from Logic App Workspace %q (Resource Group %q): %+v", kind, name, logicAppName, resourceGroup, err) + if _, err = client.CreateOrUpdate(ctx, id, properties); err != nil { + return fmt.Errorf("removing %s %q from %s: %+v", kind, name, id.ID(), err) } return nil } -func retrieveLogicAppAction(d *pluginsdk.ResourceData, meta interface{}, resourceGroup, logicAppName, name string) (*map[string]interface{}, *logic.Workflow, error) { - return retrieveLogicAppComponent(d, meta, resourceGroup, "Action", "actions", logicAppName, name) +func retrieveLogicAppAction(d *pluginsdk.ResourceData, meta interface{}, id workflows.WorkflowId, name string) (*map[string]interface{}, *workflows.Workflow, error) { + return retrieveLogicAppComponent(d, meta, "Action", "actions", id, name) } -func retrieveLogicAppHttpTrigger(d *pluginsdk.ResourceData, meta interface{}, resourceGroup, logicAppName, name string) (*map[string]interface{}, *logic.Workflow, *string, error) { - t, app, err := retrieveLogicAppTrigger(d, meta, resourceGroup, logicAppName, name) +func retrieveLogicAppHttpTrigger(d *pluginsdk.ResourceData, meta interface{}, id workflowtriggers.TriggerId) (*map[string]interface{}, *workflows.Workflow, *string, error) { + workflowId := workflows.NewWorkflowID(id.SubscriptionId, id.ResourceGroupName, id.WorkflowName) + + t, app, err := retrieveLogicAppTrigger(d, meta, workflowId, id.TriggerName) if err != nil || t == nil { return nil, nil, nil, err } - url, err := retreiveLogicAppTriggerCallbackUrl(d, meta, resourceGroup, logicAppName, name) + url, err := retreiveLogicAppTriggerCallbackUrl(d, meta, id) if err != nil { return nil, nil, nil, err } return t, app, url, err } -func retrieveLogicAppTrigger(d *pluginsdk.ResourceData, meta interface{}, resourceGroup, logicAppName, name string) (*map[string]interface{}, *logic.Workflow, error) { - return retrieveLogicAppComponent(d, meta, resourceGroup, "Trigger", "triggers", logicAppName, name) +func retrieveLogicAppTrigger(d *pluginsdk.ResourceData, meta interface{}, id workflows.WorkflowId, name string) (*map[string]interface{}, *workflows.Workflow, error) { + return retrieveLogicAppComponent(d, meta, "Trigger", "triggers", id, name) } -func retreiveLogicAppTriggerCallbackUrl(d *pluginsdk.ResourceData, meta interface{}, resourceGroup, logicAppName, name string) (*string, error) { +func retreiveLogicAppTriggerCallbackUrl(d *pluginsdk.ResourceData, meta interface{}, id workflowtriggers.TriggerId) (*string, error) { client := meta.(*clients.Client).Logic ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[DEBUG] Preparing arguments for Logic App Workspace %q (Resource Group %q) %s %q", logicAppName, resourceGroup, "trigger", name) + log.Printf("[DEBUG] Preparing arguments for Logic App Workspace %q (Resource Group %q) %s %q", id.WorkflowName, id.ResourceGroupName, "trigger", id.TriggerName) // lock to prevent against Actions, Parameters or Actions conflicting - locks.ByName(logicAppName, logicAppResourceName) - defer locks.UnlockByName(logicAppName, logicAppResourceName) + locks.ByName(id.WorkflowName, logicAppResourceName) + defer locks.UnlockByName(id.WorkflowName, logicAppResourceName) - result, err := client.TriggersClient.ListCallbackURL(ctx, resourceGroup, logicAppName, name) + result, err := client.TriggersClient.ListCallbackUrl(ctx, id) if err != nil { return nil, fmt.Errorf("[ERROR] Error getting trigger callback URL (%w)", err) } - return result.Value, nil + if result.Model == nil { + return nil, fmt.Errorf("[ERROR] model was nil for %s", id.ID()) + } + + return result.Model.Value, nil } -func retrieveLogicAppComponent(d *pluginsdk.ResourceData, meta interface{}, resourceGroup, kind, propertyName, logicAppName, name string) (*map[string]interface{}, *logic.Workflow, error) { +func retrieveLogicAppComponent(d *pluginsdk.ResourceData, meta interface{}, kind, propertyName string, id workflows.WorkflowId, name string) (*map[string]interface{}, *workflows.Workflow, error) { client := meta.(*clients.Client).Logic.WorkflowClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[DEBUG] Preparing arguments for Logic App Workspace %q (Resource Group %q) %s %q", logicAppName, resourceGroup, kind, name) + log.Printf("[DEBUG] Preparing arguments for %s: %s %q", id.ID(), kind, name) // lock to prevent against Actions, Parameters or Actions conflicting - locks.ByName(logicAppName, logicAppResourceName) - defer locks.UnlockByName(logicAppName, logicAppResourceName) + locks.ByName(id.WorkflowName, logicAppResourceName) + defer locks.UnlockByName(id.WorkflowName, logicAppResourceName) - read, err := client.Get(ctx, resourceGroup, logicAppName) + read, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(read.Response) { + if response.WasNotFound(read.HttpResponse) { return nil, nil, nil } - return nil, nil, fmt.Errorf("[ERROR] Error making Read request on Logic App Workflow %q (Resource Group %q): %+v", logicAppName, resourceGroup, err) + return nil, nil, fmt.Errorf("[ERROR] Error making Read request %s: %+v", id.ID(), err) + } + + if read.Model == nil { + return nil, nil, fmt.Errorf("[ERROR] Error parsing Logic App Workflow - `Model` is nil") } - if read.WorkflowProperties == nil { - return nil, nil, fmt.Errorf("[ERROR] Error parsing Logic App Workflow - `WorkflowProperties` is nil") + if read.Model.Properties == nil { + return nil, nil, fmt.Errorf("[ERROR] Error parsing Logic App Workflow - `Properties` is nil") } - if read.WorkflowProperties.Definition == nil { - return nil, nil, fmt.Errorf("[ERROR] Error parsing Logic App Workflow - `WorkflowProperties.Definition` is nil") + if read.Model.Properties.Definition == nil { + return nil, nil, fmt.Errorf("[ERROR] Error parsing Logic App Workflow - `Properties.Definition` is nil") } - definition := read.WorkflowProperties.Definition.(map[string]interface{}) - vs := definition[propertyName].(map[string]interface{}) + definitionRaw := *read.Model.Properties.Definition + definitionMap := definitionRaw.(map[string]interface{}) + vs := definitionMap[propertyName].(map[string]interface{}) v := vs[name] if v == nil { return nil, nil, nil } result := v.(map[string]interface{}) - return &result, &read, nil + return &result, read.Model, nil } diff --git a/internal/services/logic/logic_apps_test.go b/internal/services/logic/logic_apps_test.go index ce48c0b17feb..895e9eafc06b 100644 --- a/internal/services/logic/logic_apps_test.go +++ b/internal/services/logic/logic_apps_test.go @@ -5,6 +5,8 @@ import ( "fmt" "strings" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows" + "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -33,30 +35,37 @@ func componentExists(ctx context.Context, clients *clients.Client, state *plugin workflowName = id.WorkflowName name = id.Name } else { - id, err := parse.TriggerID(state.ID) + id, err := workflowtriggers.ParseTriggerID(state.ID) if err != nil { return nil, err } - resourceGroup = id.ResourceGroup + resourceGroup = id.ResourceGroupName workflowName = id.WorkflowName - name = id.Name + name = id.TriggerName } - resp, err := clients.Logic.WorkflowClient.Get(ctx, resourceGroup, workflowName) + subscriptionId := clients.Account.SubscriptionId + id := workflows.NewWorkflowID(subscriptionId, resourceGroup, workflowName) + resp, err := clients.Logic.WorkflowClient.Get(ctx, id) if err != nil { return nil, fmt.Errorf("retrieving Logic App Workflow %s %s (resource group: %s): %v", kind, workflowName, resourceGroup, err) } - if resp.WorkflowProperties == nil { + if resp.Model == nil { + return utils.Bool(false), nil + } + + if resp.Model.Properties == nil { return utils.Bool(false), nil } - if resp.WorkflowProperties.Definition == nil { + if resp.Model.Properties.Definition == nil { return nil, fmt.Errorf("Logic App Workflow %s %s (resource group: %s) Definition is nil", kind, workflowName, resourceGroup) } - definition := resp.WorkflowProperties.Definition.(map[string]interface{}) - actions := definition[propertyName].(map[string]interface{}) + definitionRaw := *resp.Model.Properties.Definition + definitionMap := definitionRaw.(map[string]interface{}) + actions := definitionMap[propertyName].(map[string]interface{}) exists := false for k := range actions { diff --git a/internal/services/logic/parse/integration_account.go b/internal/services/logic/parse/integration_account.go deleted file mode 100644 index c5a9a517a52b..000000000000 --- a/internal/services/logic/parse/integration_account.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type IntegrationAccountId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewIntegrationAccountID(subscriptionId, resourceGroup, name string) IntegrationAccountId { - return IntegrationAccountId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id IntegrationAccountId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Integration Account", segmentsStr) -} - -func (id IntegrationAccountId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// IntegrationAccountID parses a IntegrationAccount ID into an IntegrationAccountId struct -func IntegrationAccountID(input string) (*IntegrationAccountId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := IntegrationAccountId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("integrationAccounts"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/logic/parse/integration_account_agreement.go b/internal/services/logic/parse/integration_account_agreement.go deleted file mode 100644 index 0fab4f8adbda..000000000000 --- a/internal/services/logic/parse/integration_account_agreement.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type IntegrationAccountAgreementId struct { - SubscriptionId string - ResourceGroup string - IntegrationAccountName string - AgreementName string -} - -func NewIntegrationAccountAgreementID(subscriptionId, resourceGroup, integrationAccountName, agreementName string) IntegrationAccountAgreementId { - return IntegrationAccountAgreementId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - IntegrationAccountName: integrationAccountName, - AgreementName: agreementName, - } -} - -func (id IntegrationAccountAgreementId) String() string { - segments := []string{ - fmt.Sprintf("Agreement Name %q", id.AgreementName), - fmt.Sprintf("Integration Account Name %q", id.IntegrationAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Integration Account Agreement", segmentsStr) -} - -func (id IntegrationAccountAgreementId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/agreements/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.IntegrationAccountName, id.AgreementName) -} - -// IntegrationAccountAgreementID parses a IntegrationAccountAgreement ID into an IntegrationAccountAgreementId struct -func IntegrationAccountAgreementID(input string) (*IntegrationAccountAgreementId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := IntegrationAccountAgreementId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.IntegrationAccountName, err = id.PopSegment("integrationAccounts"); err != nil { - return nil, err - } - if resourceId.AgreementName, err = id.PopSegment("agreements"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/logic/parse/integration_account_agreement_test.go b/internal/services/logic/parse/integration_account_agreement_test.go deleted file mode 100644 index c7854950808c..000000000000 --- a/internal/services/logic/parse/integration_account_agreement_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = IntegrationAccountAgreementId{} - -func TestIntegrationAccountAgreementIDFormatter(t *testing.T) { - actual := NewIntegrationAccountAgreementID("12345678-1234-9876-4563-123456789012", "group1", "account1", "agreement1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/agreements/agreement1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestIntegrationAccountAgreementID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *IntegrationAccountAgreementId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Error: true, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Error: true, - }, - - { - // missing AgreementName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/", - Error: true, - }, - - { - // missing value for AgreementName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/agreements/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/agreements/agreement1", - Expected: &IntegrationAccountAgreementId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - IntegrationAccountName: "account1", - AgreementName: "agreement1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/ACCOUNT1/AGREEMENTS/AGREEMENT1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := IntegrationAccountAgreementID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.IntegrationAccountName != v.Expected.IntegrationAccountName { - t.Fatalf("Expected %q but got %q for IntegrationAccountName", v.Expected.IntegrationAccountName, actual.IntegrationAccountName) - } - if actual.AgreementName != v.Expected.AgreementName { - t.Fatalf("Expected %q but got %q for AgreementName", v.Expected.AgreementName, actual.AgreementName) - } - } -} diff --git a/internal/services/logic/parse/integration_account_assembly.go b/internal/services/logic/parse/integration_account_assembly.go deleted file mode 100644 index 6f7d3315b5cf..000000000000 --- a/internal/services/logic/parse/integration_account_assembly.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type IntegrationAccountAssemblyId struct { - SubscriptionId string - ResourceGroup string - IntegrationAccountName string - AssemblyName string -} - -func NewIntegrationAccountAssemblyID(subscriptionId, resourceGroup, integrationAccountName, assemblyName string) IntegrationAccountAssemblyId { - return IntegrationAccountAssemblyId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - IntegrationAccountName: integrationAccountName, - AssemblyName: assemblyName, - } -} - -func (id IntegrationAccountAssemblyId) String() string { - segments := []string{ - fmt.Sprintf("Assembly Name %q", id.AssemblyName), - fmt.Sprintf("Integration Account Name %q", id.IntegrationAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Integration Account Assembly", segmentsStr) -} - -func (id IntegrationAccountAssemblyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/assemblies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.IntegrationAccountName, id.AssemblyName) -} - -// IntegrationAccountAssemblyID parses a IntegrationAccountAssembly ID into an IntegrationAccountAssemblyId struct -func IntegrationAccountAssemblyID(input string) (*IntegrationAccountAssemblyId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := IntegrationAccountAssemblyId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.IntegrationAccountName, err = id.PopSegment("integrationAccounts"); err != nil { - return nil, err - } - if resourceId.AssemblyName, err = id.PopSegment("assemblies"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/logic/parse/integration_account_assembly_test.go b/internal/services/logic/parse/integration_account_assembly_test.go deleted file mode 100644 index c6a4ba54ec76..000000000000 --- a/internal/services/logic/parse/integration_account_assembly_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = IntegrationAccountAssemblyId{} - -func TestIntegrationAccountAssemblyIDFormatter(t *testing.T) { - actual := NewIntegrationAccountAssemblyID("12345678-1234-9876-4563-123456789012", "group1", "account1", "assembly1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/assemblies/assembly1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestIntegrationAccountAssemblyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *IntegrationAccountAssemblyId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Error: true, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Error: true, - }, - - { - // missing AssemblyName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/", - Error: true, - }, - - { - // missing value for AssemblyName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/assemblies/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/assemblies/assembly1", - Expected: &IntegrationAccountAssemblyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - IntegrationAccountName: "account1", - AssemblyName: "assembly1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/ACCOUNT1/ASSEMBLIES/ASSEMBLY1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := IntegrationAccountAssemblyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.IntegrationAccountName != v.Expected.IntegrationAccountName { - t.Fatalf("Expected %q but got %q for IntegrationAccountName", v.Expected.IntegrationAccountName, actual.IntegrationAccountName) - } - if actual.AssemblyName != v.Expected.AssemblyName { - t.Fatalf("Expected %q but got %q for AssemblyName", v.Expected.AssemblyName, actual.AssemblyName) - } - } -} diff --git a/internal/services/logic/parse/integration_account_batch_configuration.go b/internal/services/logic/parse/integration_account_batch_configuration.go deleted file mode 100644 index 6e0fa0353936..000000000000 --- a/internal/services/logic/parse/integration_account_batch_configuration.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type IntegrationAccountBatchConfigurationId struct { - SubscriptionId string - ResourceGroup string - IntegrationAccountName string - BatchConfigurationName string -} - -func NewIntegrationAccountBatchConfigurationID(subscriptionId, resourceGroup, integrationAccountName, batchConfigurationName string) IntegrationAccountBatchConfigurationId { - return IntegrationAccountBatchConfigurationId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - IntegrationAccountName: integrationAccountName, - BatchConfigurationName: batchConfigurationName, - } -} - -func (id IntegrationAccountBatchConfigurationId) String() string { - segments := []string{ - fmt.Sprintf("Batch Configuration Name %q", id.BatchConfigurationName), - fmt.Sprintf("Integration Account Name %q", id.IntegrationAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Integration Account Batch Configuration", segmentsStr) -} - -func (id IntegrationAccountBatchConfigurationId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/batchConfigurations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.IntegrationAccountName, id.BatchConfigurationName) -} - -// IntegrationAccountBatchConfigurationID parses a IntegrationAccountBatchConfiguration ID into an IntegrationAccountBatchConfigurationId struct -func IntegrationAccountBatchConfigurationID(input string) (*IntegrationAccountBatchConfigurationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := IntegrationAccountBatchConfigurationId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.IntegrationAccountName, err = id.PopSegment("integrationAccounts"); err != nil { - return nil, err - } - if resourceId.BatchConfigurationName, err = id.PopSegment("batchConfigurations"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/logic/parse/integration_account_batch_configuration_test.go b/internal/services/logic/parse/integration_account_batch_configuration_test.go deleted file mode 100644 index e8086d463715..000000000000 --- a/internal/services/logic/parse/integration_account_batch_configuration_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = IntegrationAccountBatchConfigurationId{} - -func TestIntegrationAccountBatchConfigurationIDFormatter(t *testing.T) { - actual := NewIntegrationAccountBatchConfigurationID("12345678-1234-9876-4563-123456789012", "group1", "account1", "batchConfiguration1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/batchConfigurations/batchConfiguration1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestIntegrationAccountBatchConfigurationID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *IntegrationAccountBatchConfigurationId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Error: true, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Error: true, - }, - - { - // missing BatchConfigurationName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/", - Error: true, - }, - - { - // missing value for BatchConfigurationName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/batchConfigurations/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/batchConfigurations/batchConfiguration1", - Expected: &IntegrationAccountBatchConfigurationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - IntegrationAccountName: "account1", - BatchConfigurationName: "batchConfiguration1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/ACCOUNT1/BATCHCONFIGURATIONS/BATCHCONFIGURATION1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := IntegrationAccountBatchConfigurationID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.IntegrationAccountName != v.Expected.IntegrationAccountName { - t.Fatalf("Expected %q but got %q for IntegrationAccountName", v.Expected.IntegrationAccountName, actual.IntegrationAccountName) - } - if actual.BatchConfigurationName != v.Expected.BatchConfigurationName { - t.Fatalf("Expected %q but got %q for BatchConfigurationName", v.Expected.BatchConfigurationName, actual.BatchConfigurationName) - } - } -} diff --git a/internal/services/logic/parse/integration_account_certificate.go b/internal/services/logic/parse/integration_account_certificate.go deleted file mode 100644 index 20a8f62bbf43..000000000000 --- a/internal/services/logic/parse/integration_account_certificate.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type IntegrationAccountCertificateId struct { - SubscriptionId string - ResourceGroup string - IntegrationAccountName string - CertificateName string -} - -func NewIntegrationAccountCertificateID(subscriptionId, resourceGroup, integrationAccountName, certificateName string) IntegrationAccountCertificateId { - return IntegrationAccountCertificateId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - IntegrationAccountName: integrationAccountName, - CertificateName: certificateName, - } -} - -func (id IntegrationAccountCertificateId) String() string { - segments := []string{ - fmt.Sprintf("Certificate Name %q", id.CertificateName), - fmt.Sprintf("Integration Account Name %q", id.IntegrationAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Integration Account Certificate", segmentsStr) -} - -func (id IntegrationAccountCertificateId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/certificates/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.IntegrationAccountName, id.CertificateName) -} - -// IntegrationAccountCertificateID parses a IntegrationAccountCertificate ID into an IntegrationAccountCertificateId struct -func IntegrationAccountCertificateID(input string) (*IntegrationAccountCertificateId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := IntegrationAccountCertificateId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.IntegrationAccountName, err = id.PopSegment("integrationAccounts"); err != nil { - return nil, err - } - if resourceId.CertificateName, err = id.PopSegment("certificates"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/logic/parse/integration_account_certificate_test.go b/internal/services/logic/parse/integration_account_certificate_test.go deleted file mode 100644 index 689ec613e248..000000000000 --- a/internal/services/logic/parse/integration_account_certificate_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = IntegrationAccountCertificateId{} - -func TestIntegrationAccountCertificateIDFormatter(t *testing.T) { - actual := NewIntegrationAccountCertificateID("12345678-1234-9876-4563-123456789012", "group1", "account1", "certificate1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/certificates/certificate1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestIntegrationAccountCertificateID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *IntegrationAccountCertificateId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Error: true, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Error: true, - }, - - { - // missing CertificateName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/", - Error: true, - }, - - { - // missing value for CertificateName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/certificates/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/certificates/certificate1", - Expected: &IntegrationAccountCertificateId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - IntegrationAccountName: "account1", - CertificateName: "certificate1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/ACCOUNT1/CERTIFICATES/CERTIFICATE1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := IntegrationAccountCertificateID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.IntegrationAccountName != v.Expected.IntegrationAccountName { - t.Fatalf("Expected %q but got %q for IntegrationAccountName", v.Expected.IntegrationAccountName, actual.IntegrationAccountName) - } - if actual.CertificateName != v.Expected.CertificateName { - t.Fatalf("Expected %q but got %q for CertificateName", v.Expected.CertificateName, actual.CertificateName) - } - } -} diff --git a/internal/services/logic/parse/integration_account_map.go b/internal/services/logic/parse/integration_account_map.go deleted file mode 100644 index feeb15f0fde1..000000000000 --- a/internal/services/logic/parse/integration_account_map.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type IntegrationAccountMapId struct { - SubscriptionId string - ResourceGroup string - IntegrationAccountName string - MapName string -} - -func NewIntegrationAccountMapID(subscriptionId, resourceGroup, integrationAccountName, mapName string) IntegrationAccountMapId { - return IntegrationAccountMapId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - IntegrationAccountName: integrationAccountName, - MapName: mapName, - } -} - -func (id IntegrationAccountMapId) String() string { - segments := []string{ - fmt.Sprintf("Map Name %q", id.MapName), - fmt.Sprintf("Integration Account Name %q", id.IntegrationAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Integration Account Map", segmentsStr) -} - -func (id IntegrationAccountMapId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/maps/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.IntegrationAccountName, id.MapName) -} - -// IntegrationAccountMapID parses a IntegrationAccountMap ID into an IntegrationAccountMapId struct -func IntegrationAccountMapID(input string) (*IntegrationAccountMapId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := IntegrationAccountMapId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.IntegrationAccountName, err = id.PopSegment("integrationAccounts"); err != nil { - return nil, err - } - if resourceId.MapName, err = id.PopSegment("maps"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/logic/parse/integration_account_map_test.go b/internal/services/logic/parse/integration_account_map_test.go deleted file mode 100644 index 6c0c350a0f93..000000000000 --- a/internal/services/logic/parse/integration_account_map_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = IntegrationAccountMapId{} - -func TestIntegrationAccountMapIDFormatter(t *testing.T) { - actual := NewIntegrationAccountMapID("12345678-1234-9876-4563-123456789012", "group1", "account1", "map1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/maps/map1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestIntegrationAccountMapID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *IntegrationAccountMapId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Error: true, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Error: true, - }, - - { - // missing MapName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/", - Error: true, - }, - - { - // missing value for MapName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/maps/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/maps/map1", - Expected: &IntegrationAccountMapId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - IntegrationAccountName: "account1", - MapName: "map1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/ACCOUNT1/MAPS/MAP1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := IntegrationAccountMapID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.IntegrationAccountName != v.Expected.IntegrationAccountName { - t.Fatalf("Expected %q but got %q for IntegrationAccountName", v.Expected.IntegrationAccountName, actual.IntegrationAccountName) - } - if actual.MapName != v.Expected.MapName { - t.Fatalf("Expected %q but got %q for MapName", v.Expected.MapName, actual.MapName) - } - } -} diff --git a/internal/services/logic/parse/integration_account_partner.go b/internal/services/logic/parse/integration_account_partner.go deleted file mode 100644 index e3b3142ef13e..000000000000 --- a/internal/services/logic/parse/integration_account_partner.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type IntegrationAccountPartnerId struct { - SubscriptionId string - ResourceGroup string - IntegrationAccountName string - PartnerName string -} - -func NewIntegrationAccountPartnerID(subscriptionId, resourceGroup, integrationAccountName, partnerName string) IntegrationAccountPartnerId { - return IntegrationAccountPartnerId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - IntegrationAccountName: integrationAccountName, - PartnerName: partnerName, - } -} - -func (id IntegrationAccountPartnerId) String() string { - segments := []string{ - fmt.Sprintf("Partner Name %q", id.PartnerName), - fmt.Sprintf("Integration Account Name %q", id.IntegrationAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Integration Account Partner", segmentsStr) -} - -func (id IntegrationAccountPartnerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/partners/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.IntegrationAccountName, id.PartnerName) -} - -// IntegrationAccountPartnerID parses a IntegrationAccountPartner ID into an IntegrationAccountPartnerId struct -func IntegrationAccountPartnerID(input string) (*IntegrationAccountPartnerId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := IntegrationAccountPartnerId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.IntegrationAccountName, err = id.PopSegment("integrationAccounts"); err != nil { - return nil, err - } - if resourceId.PartnerName, err = id.PopSegment("partners"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/logic/parse/integration_account_partner_test.go b/internal/services/logic/parse/integration_account_partner_test.go deleted file mode 100644 index 78f3f191f3f4..000000000000 --- a/internal/services/logic/parse/integration_account_partner_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = IntegrationAccountPartnerId{} - -func TestIntegrationAccountPartnerIDFormatter(t *testing.T) { - actual := NewIntegrationAccountPartnerID("12345678-1234-9876-4563-123456789012", "group1", "account1", "partner1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/partners/partner1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestIntegrationAccountPartnerID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *IntegrationAccountPartnerId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Error: true, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Error: true, - }, - - { - // missing PartnerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/", - Error: true, - }, - - { - // missing value for PartnerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/partners/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/partners/partner1", - Expected: &IntegrationAccountPartnerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - IntegrationAccountName: "account1", - PartnerName: "partner1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/ACCOUNT1/PARTNERS/PARTNER1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := IntegrationAccountPartnerID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.IntegrationAccountName != v.Expected.IntegrationAccountName { - t.Fatalf("Expected %q but got %q for IntegrationAccountName", v.Expected.IntegrationAccountName, actual.IntegrationAccountName) - } - if actual.PartnerName != v.Expected.PartnerName { - t.Fatalf("Expected %q but got %q for PartnerName", v.Expected.PartnerName, actual.PartnerName) - } - } -} diff --git a/internal/services/logic/parse/integration_account_schema.go b/internal/services/logic/parse/integration_account_schema.go deleted file mode 100644 index e7ab8d507433..000000000000 --- a/internal/services/logic/parse/integration_account_schema.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type IntegrationAccountSchemaId struct { - SubscriptionId string - ResourceGroup string - IntegrationAccountName string - SchemaName string -} - -func NewIntegrationAccountSchemaID(subscriptionId, resourceGroup, integrationAccountName, schemaName string) IntegrationAccountSchemaId { - return IntegrationAccountSchemaId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - IntegrationAccountName: integrationAccountName, - SchemaName: schemaName, - } -} - -func (id IntegrationAccountSchemaId) String() string { - segments := []string{ - fmt.Sprintf("Schema Name %q", id.SchemaName), - fmt.Sprintf("Integration Account Name %q", id.IntegrationAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Integration Account Schema", segmentsStr) -} - -func (id IntegrationAccountSchemaId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/schemas/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.IntegrationAccountName, id.SchemaName) -} - -// IntegrationAccountSchemaID parses a IntegrationAccountSchema ID into an IntegrationAccountSchemaId struct -func IntegrationAccountSchemaID(input string) (*IntegrationAccountSchemaId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := IntegrationAccountSchemaId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.IntegrationAccountName, err = id.PopSegment("integrationAccounts"); err != nil { - return nil, err - } - if resourceId.SchemaName, err = id.PopSegment("schemas"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/logic/parse/integration_account_schema_test.go b/internal/services/logic/parse/integration_account_schema_test.go deleted file mode 100644 index 1e7549ec14d9..000000000000 --- a/internal/services/logic/parse/integration_account_schema_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = IntegrationAccountSchemaId{} - -func TestIntegrationAccountSchemaIDFormatter(t *testing.T) { - actual := NewIntegrationAccountSchemaID("12345678-1234-9876-4563-123456789012", "group1", "integrationAccount1", "schema1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/schemas/schema1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestIntegrationAccountSchemaID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *IntegrationAccountSchemaId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Error: true, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Error: true, - }, - - { - // missing SchemaName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/", - Error: true, - }, - - { - // missing value for SchemaName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/schemas/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/schemas/schema1", - Expected: &IntegrationAccountSchemaId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - IntegrationAccountName: "integrationAccount1", - SchemaName: "schema1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/INTEGRATIONACCOUNT1/SCHEMAS/SCHEMA1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := IntegrationAccountSchemaID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.IntegrationAccountName != v.Expected.IntegrationAccountName { - t.Fatalf("Expected %q but got %q for IntegrationAccountName", v.Expected.IntegrationAccountName, actual.IntegrationAccountName) - } - if actual.SchemaName != v.Expected.SchemaName { - t.Fatalf("Expected %q but got %q for SchemaName", v.Expected.SchemaName, actual.SchemaName) - } - } -} diff --git a/internal/services/logic/parse/integration_account_session.go b/internal/services/logic/parse/integration_account_session.go deleted file mode 100644 index 25f76d0a6b44..000000000000 --- a/internal/services/logic/parse/integration_account_session.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type IntegrationAccountSessionId struct { - SubscriptionId string - ResourceGroup string - IntegrationAccountName string - SessionName string -} - -func NewIntegrationAccountSessionID(subscriptionId, resourceGroup, integrationAccountName, sessionName string) IntegrationAccountSessionId { - return IntegrationAccountSessionId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - IntegrationAccountName: integrationAccountName, - SessionName: sessionName, - } -} - -func (id IntegrationAccountSessionId) String() string { - segments := []string{ - fmt.Sprintf("Session Name %q", id.SessionName), - fmt.Sprintf("Integration Account Name %q", id.IntegrationAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Integration Account Session", segmentsStr) -} - -func (id IntegrationAccountSessionId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/sessions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.IntegrationAccountName, id.SessionName) -} - -// IntegrationAccountSessionID parses a IntegrationAccountSession ID into an IntegrationAccountSessionId struct -func IntegrationAccountSessionID(input string) (*IntegrationAccountSessionId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := IntegrationAccountSessionId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.IntegrationAccountName, err = id.PopSegment("integrationAccounts"); err != nil { - return nil, err - } - if resourceId.SessionName, err = id.PopSegment("sessions"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/logic/parse/integration_account_session_test.go b/internal/services/logic/parse/integration_account_session_test.go deleted file mode 100644 index 8564a0e8531a..000000000000 --- a/internal/services/logic/parse/integration_account_session_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = IntegrationAccountSessionId{} - -func TestIntegrationAccountSessionIDFormatter(t *testing.T) { - actual := NewIntegrationAccountSessionID("12345678-1234-9876-4563-123456789012", "group1", "integrationAccount1", "session1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/sessions/session1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestIntegrationAccountSessionID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *IntegrationAccountSessionId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Error: true, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Error: true, - }, - - { - // missing SessionName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/", - Error: true, - }, - - { - // missing value for SessionName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/sessions/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/sessions/session1", - Expected: &IntegrationAccountSessionId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - IntegrationAccountName: "integrationAccount1", - SessionName: "session1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/INTEGRATIONACCOUNT1/SESSIONS/SESSION1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := IntegrationAccountSessionID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.IntegrationAccountName != v.Expected.IntegrationAccountName { - t.Fatalf("Expected %q but got %q for IntegrationAccountName", v.Expected.IntegrationAccountName, actual.IntegrationAccountName) - } - if actual.SessionName != v.Expected.SessionName { - t.Fatalf("Expected %q but got %q for SessionName", v.Expected.SessionName, actual.SessionName) - } - } -} diff --git a/internal/services/logic/parse/integration_account_test.go b/internal/services/logic/parse/integration_account_test.go deleted file mode 100644 index a50557d13092..000000000000 --- a/internal/services/logic/parse/integration_account_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = IntegrationAccountId{} - -func TestIntegrationAccountIDFormatter(t *testing.T) { - actual := NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "group1", "account1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestIntegrationAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *IntegrationAccountId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1", - Expected: &IntegrationAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "account1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/ACCOUNT1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := IntegrationAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/logic/parse/integration_service_environment.go b/internal/services/logic/parse/integration_service_environment.go deleted file mode 100644 index c0b4f74623db..000000000000 --- a/internal/services/logic/parse/integration_service_environment.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type IntegrationServiceEnvironmentId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewIntegrationServiceEnvironmentID(subscriptionId, resourceGroup, name string) IntegrationServiceEnvironmentId { - return IntegrationServiceEnvironmentId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id IntegrationServiceEnvironmentId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Integration Service Environment", segmentsStr) -} - -func (id IntegrationServiceEnvironmentId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationServiceEnvironments/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// IntegrationServiceEnvironmentID parses a IntegrationServiceEnvironment ID into an IntegrationServiceEnvironmentId struct -func IntegrationServiceEnvironmentID(input string) (*IntegrationServiceEnvironmentId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := IntegrationServiceEnvironmentId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("integrationServiceEnvironments"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/logic/parse/integration_service_environment_test.go b/internal/services/logic/parse/integration_service_environment_test.go deleted file mode 100644 index 90c67e0d1b84..000000000000 --- a/internal/services/logic/parse/integration_service_environment_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = IntegrationServiceEnvironmentId{} - -func TestIntegrationServiceEnvironmentIDFormatter(t *testing.T) { - actual := NewIntegrationServiceEnvironmentID("12345678-1234-9876-4563-123456789012", "group1", "ise1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationServiceEnvironments/ise1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestIntegrationServiceEnvironmentID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *IntegrationServiceEnvironmentId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationServiceEnvironments/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationServiceEnvironments/ise1", - Expected: &IntegrationServiceEnvironmentId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "ise1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONSERVICEENVIRONMENTS/ISE1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := IntegrationServiceEnvironmentID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/logic/parse/trigger.go b/internal/services/logic/parse/trigger.go deleted file mode 100644 index 02fa01371aaf..000000000000 --- a/internal/services/logic/parse/trigger.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type TriggerId struct { - SubscriptionId string - ResourceGroup string - WorkflowName string - Name string -} - -func NewTriggerID(subscriptionId, resourceGroup, workflowName, name string) TriggerId { - return TriggerId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - WorkflowName: workflowName, - Name: name, - } -} - -func (id TriggerId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Workflow Name %q", id.WorkflowName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Trigger", segmentsStr) -} - -func (id TriggerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/workflows/%s/triggers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.WorkflowName, id.Name) -} - -// TriggerID parses a Trigger ID into an TriggerId struct -func TriggerID(input string) (*TriggerId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := TriggerId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.WorkflowName, err = id.PopSegment("workflows"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("triggers"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/logic/parse/trigger_test.go b/internal/services/logic/parse/trigger_test.go deleted file mode 100644 index 6d2cff7b8545..000000000000 --- a/internal/services/logic/parse/trigger_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = TriggerId{} - -func TestTriggerIDFormatter(t *testing.T) { - actual := NewTriggerID("12345678-1234-9876-4563-123456789012", "group1", "workflow1", "trigger1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/workflow1/triggers/trigger1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestTriggerID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *TriggerId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing WorkflowName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Error: true, - }, - - { - // missing value for WorkflowName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/workflow1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/workflow1/triggers/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/workflow1/triggers/trigger1", - Expected: &TriggerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - WorkflowName: "workflow1", - Name: "trigger1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/WORKFLOWS/WORKFLOW1/TRIGGERS/TRIGGER1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := TriggerID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.WorkflowName != v.Expected.WorkflowName { - t.Fatalf("Expected %q but got %q for WorkflowName", v.Expected.WorkflowName, actual.WorkflowName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/logic/parse/workflow.go b/internal/services/logic/parse/workflow.go deleted file mode 100644 index 59e1f7fff1d8..000000000000 --- a/internal/services/logic/parse/workflow.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type WorkflowId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewWorkflowID(subscriptionId, resourceGroup, name string) WorkflowId { - return WorkflowId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id WorkflowId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Workflow", segmentsStr) -} - -func (id WorkflowId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/workflows/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// WorkflowID parses a Workflow ID into an WorkflowId struct -func WorkflowID(input string) (*WorkflowId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := WorkflowId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("workflows"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/logic/parse/workflow_test.go b/internal/services/logic/parse/workflow_test.go deleted file mode 100644 index 2998c379e051..000000000000 --- a/internal/services/logic/parse/workflow_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = WorkflowId{} - -func TestWorkflowIDFormatter(t *testing.T) { - actual := NewWorkflowID("12345678-1234-9876-4563-123456789012", "group1", "workflow1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/workflow1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestWorkflowID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *WorkflowId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/workflow1", - Expected: &WorkflowId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "workflow1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/WORKFLOWS/WORKFLOW1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := WorkflowID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/logic/resourceids.go b/internal/services/logic/resourceids.go index ddae19652716..ecc8648be7a5 100644 --- a/internal/services/logic/resourceids.go +++ b/internal/services/logic/resourceids.go @@ -1,16 +1,6 @@ package logic -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=IntegrationAccount -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=IntegrationAccountAgreement -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/agreements/agreement1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=IntegrationAccountAssembly -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/assemblies/assembly1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=IntegrationAccountBatchConfiguration -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/batchConfigurations/batchConfiguration1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=IntegrationAccountCertificate -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/certificates/certificate1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=IntegrationAccountMap -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/maps/map1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=IntegrationAccountPartner -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/partners/partner1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=IntegrationAccountSchema -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/schemas/schema1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=IntegrationAccountSession -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/sessions/session1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=IntegrationServiceEnvironment -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationServiceEnvironments/ise1 +// @tombuildsstuff: @mbfrahry is going to send a PR to remove/clean these up + //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=LogicAppStandard -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Workflow -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/workflow1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Trigger -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/workflow1/triggers/trigger1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Action -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/workflow1/actions/action1 diff --git a/internal/services/logic/validate/integration_account_agreement_id.go b/internal/services/logic/validate/integration_account_agreement_id.go deleted file mode 100644 index c6547bc74b25..000000000000 --- a/internal/services/logic/validate/integration_account_agreement_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" -) - -func IntegrationAccountAgreementID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.IntegrationAccountAgreementID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/logic/validate/integration_account_agreement_id_test.go b/internal/services/logic/validate/integration_account_agreement_id_test.go deleted file mode 100644 index af7446467fcc..000000000000 --- a/internal/services/logic/validate/integration_account_agreement_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestIntegrationAccountAgreementID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Valid: false, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Valid: false, - }, - - { - // missing AgreementName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/", - Valid: false, - }, - - { - // missing value for AgreementName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/agreements/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/agreements/agreement1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/ACCOUNT1/AGREEMENTS/AGREEMENT1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := IntegrationAccountAgreementID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/logic/validate/integration_account_assembly_id.go b/internal/services/logic/validate/integration_account_assembly_id.go deleted file mode 100644 index 669087719a9c..000000000000 --- a/internal/services/logic/validate/integration_account_assembly_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" -) - -func IntegrationAccountAssemblyID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.IntegrationAccountAssemblyID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/logic/validate/integration_account_assembly_id_test.go b/internal/services/logic/validate/integration_account_assembly_id_test.go deleted file mode 100644 index b45587ba8079..000000000000 --- a/internal/services/logic/validate/integration_account_assembly_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestIntegrationAccountAssemblyID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Valid: false, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Valid: false, - }, - - { - // missing AssemblyName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/", - Valid: false, - }, - - { - // missing value for AssemblyName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/assemblies/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/assemblies/assembly1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/ACCOUNT1/ASSEMBLIES/ASSEMBLY1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := IntegrationAccountAssemblyID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/logic/validate/integration_account_batch_configuration_id.go b/internal/services/logic/validate/integration_account_batch_configuration_id.go deleted file mode 100644 index a3021852b348..000000000000 --- a/internal/services/logic/validate/integration_account_batch_configuration_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" -) - -func IntegrationAccountBatchConfigurationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.IntegrationAccountBatchConfigurationID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/logic/validate/integration_account_batch_configuration_id_test.go b/internal/services/logic/validate/integration_account_batch_configuration_id_test.go deleted file mode 100644 index 2ca088b9c2ae..000000000000 --- a/internal/services/logic/validate/integration_account_batch_configuration_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestIntegrationAccountBatchConfigurationID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Valid: false, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Valid: false, - }, - - { - // missing BatchConfigurationName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/", - Valid: false, - }, - - { - // missing value for BatchConfigurationName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/batchConfigurations/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/batchConfigurations/batchConfiguration1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/ACCOUNT1/BATCHCONFIGURATIONS/BATCHCONFIGURATION1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := IntegrationAccountBatchConfigurationID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/logic/validate/integration_account_certificate_id.go b/internal/services/logic/validate/integration_account_certificate_id.go deleted file mode 100644 index 3af5a0c3e90d..000000000000 --- a/internal/services/logic/validate/integration_account_certificate_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" -) - -func IntegrationAccountCertificateID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.IntegrationAccountCertificateID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/logic/validate/integration_account_certificate_id_test.go b/internal/services/logic/validate/integration_account_certificate_id_test.go deleted file mode 100644 index d995068aed16..000000000000 --- a/internal/services/logic/validate/integration_account_certificate_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestIntegrationAccountCertificateID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Valid: false, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Valid: false, - }, - - { - // missing CertificateName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/", - Valid: false, - }, - - { - // missing value for CertificateName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/certificates/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/certificates/certificate1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/ACCOUNT1/CERTIFICATES/CERTIFICATE1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := IntegrationAccountCertificateID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/logic/validate/integration_account_id.go b/internal/services/logic/validate/integration_account_id.go deleted file mode 100644 index c63bd2720370..000000000000 --- a/internal/services/logic/validate/integration_account_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" -) - -func IntegrationAccountID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.IntegrationAccountID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/logic/validate/integration_account_id_test.go b/internal/services/logic/validate/integration_account_id_test.go deleted file mode 100644 index a6763569f709..000000000000 --- a/internal/services/logic/validate/integration_account_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestIntegrationAccountID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/ACCOUNT1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := IntegrationAccountID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/logic/validate/integration_account_map_id.go b/internal/services/logic/validate/integration_account_map_id.go deleted file mode 100644 index 85c457f37e4a..000000000000 --- a/internal/services/logic/validate/integration_account_map_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" -) - -func IntegrationAccountMapID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.IntegrationAccountMapID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/logic/validate/integration_account_map_id_test.go b/internal/services/logic/validate/integration_account_map_id_test.go deleted file mode 100644 index 27f8292620c1..000000000000 --- a/internal/services/logic/validate/integration_account_map_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestIntegrationAccountMapID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Valid: false, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Valid: false, - }, - - { - // missing MapName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/", - Valid: false, - }, - - { - // missing value for MapName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/maps/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/maps/map1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/ACCOUNT1/MAPS/MAP1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := IntegrationAccountMapID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/logic/validate/integration_account_partner_id.go b/internal/services/logic/validate/integration_account_partner_id.go deleted file mode 100644 index e72cd74d86d9..000000000000 --- a/internal/services/logic/validate/integration_account_partner_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" -) - -func IntegrationAccountPartnerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.IntegrationAccountPartnerID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/logic/validate/integration_account_partner_id_test.go b/internal/services/logic/validate/integration_account_partner_id_test.go deleted file mode 100644 index 04c6821e891f..000000000000 --- a/internal/services/logic/validate/integration_account_partner_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestIntegrationAccountPartnerID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Valid: false, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Valid: false, - }, - - { - // missing PartnerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/", - Valid: false, - }, - - { - // missing value for PartnerName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/partners/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/account1/partners/partner1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/ACCOUNT1/PARTNERS/PARTNER1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := IntegrationAccountPartnerID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/logic/validate/integration_account_schema_id.go b/internal/services/logic/validate/integration_account_schema_id.go deleted file mode 100644 index 36d774a054e9..000000000000 --- a/internal/services/logic/validate/integration_account_schema_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" -) - -func IntegrationAccountSchemaID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.IntegrationAccountSchemaID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/logic/validate/integration_account_schema_id_test.go b/internal/services/logic/validate/integration_account_schema_id_test.go deleted file mode 100644 index d7227e37ee80..000000000000 --- a/internal/services/logic/validate/integration_account_schema_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestIntegrationAccountSchemaID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Valid: false, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Valid: false, - }, - - { - // missing SchemaName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/", - Valid: false, - }, - - { - // missing value for SchemaName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/schemas/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/schemas/schema1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/INTEGRATIONACCOUNT1/SCHEMAS/SCHEMA1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := IntegrationAccountSchemaID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/logic/validate/integration_account_session_id.go b/internal/services/logic/validate/integration_account_session_id.go deleted file mode 100644 index 3ab7cdad7b7c..000000000000 --- a/internal/services/logic/validate/integration_account_session_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" -) - -func IntegrationAccountSessionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.IntegrationAccountSessionID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/logic/validate/integration_account_session_id_test.go b/internal/services/logic/validate/integration_account_session_id_test.go deleted file mode 100644 index 98098198574b..000000000000 --- a/internal/services/logic/validate/integration_account_session_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestIntegrationAccountSessionID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Valid: false, - }, - - { - // missing value for IntegrationAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/", - Valid: false, - }, - - { - // missing SessionName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/", - Valid: false, - }, - - { - // missing value for SessionName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/sessions/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationAccounts/integrationAccount1/sessions/session1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONACCOUNTS/INTEGRATIONACCOUNT1/SESSIONS/SESSION1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := IntegrationAccountSessionID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/logic/validate/integration_service_environment_id.go b/internal/services/logic/validate/integration_service_environment_id.go deleted file mode 100644 index 03da4e5e7ca7..000000000000 --- a/internal/services/logic/validate/integration_service_environment_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" -) - -func IntegrationServiceEnvironmentID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.IntegrationServiceEnvironmentID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/logic/validate/integration_service_environment_id_test.go b/internal/services/logic/validate/integration_service_environment_id_test.go deleted file mode 100644 index bc9ba316d50e..000000000000 --- a/internal/services/logic/validate/integration_service_environment_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestIntegrationServiceEnvironmentID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationServiceEnvironments/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/integrationServiceEnvironments/ise1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/INTEGRATIONSERVICEENVIRONMENTS/ISE1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := IntegrationServiceEnvironmentID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/logic/validate/trigger_id.go b/internal/services/logic/validate/trigger_id.go deleted file mode 100644 index 48ab2f12091f..000000000000 --- a/internal/services/logic/validate/trigger_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" -) - -func TriggerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.TriggerID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/logic/validate/trigger_id_test.go b/internal/services/logic/validate/trigger_id_test.go deleted file mode 100644 index b58f0acffeb2..000000000000 --- a/internal/services/logic/validate/trigger_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestTriggerID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing WorkflowName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Valid: false, - }, - - { - // missing value for WorkflowName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/workflow1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/workflow1/triggers/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/workflow1/triggers/trigger1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/WORKFLOWS/WORKFLOW1/TRIGGERS/TRIGGER1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := TriggerID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/logic/validate/workflow_id.go b/internal/services/logic/validate/workflow_id.go deleted file mode 100644 index b1a094e4333b..000000000000 --- a/internal/services/logic/validate/workflow_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" -) - -func WorkflowID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.WorkflowID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/logic/validate/workflow_id_test.go b/internal/services/logic/validate/workflow_id_test.go deleted file mode 100644 index bd765c0cb59c..000000000000 --- a/internal/services/logic/validate/workflow_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestWorkflowID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Logic/workflows/workflow1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.LOGIC/WORKFLOWS/WORKFLOW1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := WorkflowID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/machinelearning/client/client.go b/internal/services/machinelearning/client/client.go index 7669fc0481b8..54ff4f0d97e8 100644 --- a/internal/services/machinelearning/client/client.go +++ b/internal/services/machinelearning/client/client.go @@ -1,6 +1,7 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore" "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes" "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/internal/common" @@ -9,6 +10,7 @@ import ( type Client struct { ComputeClient *machinelearningcomputes.MachineLearningComputesClient WorkspacesClient *workspaces.WorkspacesClient + DatastoreClient *datastore.DatastoreClient } func NewClient(o *common.ClientOptions) *Client { @@ -18,8 +20,12 @@ func NewClient(o *common.ClientOptions) *Client { WorkspacesClient := workspaces.NewWorkspacesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&WorkspacesClient.Client, o.ResourceManagerAuthorizer) + DatastoreClient := datastore.NewDatastoreClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&DatastoreClient.Client, o.ResourceManagerAuthorizer) + return &Client{ ComputeClient: &ComputeClient, WorkspacesClient: &WorkspacesClient, + DatastoreClient: &DatastoreClient, } } diff --git a/internal/services/machinelearning/machine_learning_datastore_blobstorage_resource.go b/internal/services/machinelearning/machine_learning_datastore_blobstorage_resource.go new file mode 100644 index 000000000000..66ff05d04fe2 --- /dev/null +++ b/internal/services/machinelearning/machine_learning_datastore_blobstorage_resource.go @@ -0,0 +1,353 @@ +package machinelearning + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore" + "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/workspaces" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/validate" + storageparse "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type MachineLearningDataStoreBlobStorage struct{} + +type MachineLearningDataStoreBlobStorageModel struct { + Name string `tfschema:"name"` + WorkSpaceID string `tfschema:"workspace_id"` + StorageContainerID string `tfschema:"storage_container_id"` + Description string `tfschema:"description"` + IsDefault bool `tfschema:"is_default"` + ServiceDataAuthIdentity string `tfschema:"service_data_auth_identity"` + AccountKey string `tfschema:"account_key"` + SharedAccessSignature string `tfschema:"shared_access_signature"` + Tags map[string]string `tfschema:"tags"` +} + +func (r MachineLearningDataStoreBlobStorage) Attributes() map[string]*schema.Schema { + return nil +} + +func (r MachineLearningDataStoreBlobStorage) ModelObject() interface{} { + return &MachineLearningDataStoreBlobStorageModel{} +} + +func (r MachineLearningDataStoreBlobStorage) ResourceType() string { + return "azurerm_machine_learning_datastore_blobstorage" +} + +func (r MachineLearningDataStoreBlobStorage) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return datastore.ValidateDataStoreID +} + +var _ sdk.ResourceWithUpdate = MachineLearningDataStoreBlobStorage{} + +func (r MachineLearningDataStoreBlobStorage) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.DataStoreName, + }, + + "workspace_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.WorkspaceID, + }, + + "storage_container_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + }, + + "is_default": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "service_data_auth_identity": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(datastore.ServiceDataAccessAuthIdentityNone), + string(datastore.ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity), + string(datastore.ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity), + }, + false), + Default: string(datastore.ServiceDataAccessAuthIdentityNone), + }, + + "account_key": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + ExactlyOneOf: []string{"account_key", "shared_access_signature"}, + }, + + "shared_access_signature": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + AtLeastOneOf: []string{"account_key", "shared_access_signature"}, + }, + + "tags": commonschema.TagsForceNew(), + } +} + +func (r MachineLearningDataStoreBlobStorage) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MachineLearning.DatastoreClient + subscriptionId := metadata.Client.Account.SubscriptionId + + var model MachineLearningDataStoreBlobStorageModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding %+v", err) + } + + workspaceId, err := workspaces.ParseWorkspaceID(model.WorkSpaceID) + if err != nil { + return err + } + + id := datastore.NewDataStoreID(subscriptionId, workspaceId.ResourceGroupName, workspaceId.WorkspaceName, model.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_machine_learning_datastore_blobstorage", id.ID()) + } + + containerId, err := storageparse.StorageContainerResourceManagerID(model.StorageContainerID) + if err != nil { + return err + } + + datastoreRaw := datastore.DatastoreResource{ + Name: utils.String(model.Name), + Type: utils.ToPtr(string(datastore.DatastoreTypeAzureBlob)), + } + + props := &datastore.AzureBlobDatastore{ + AccountName: utils.String(containerId.StorageAccountName), + ContainerName: utils.String(containerId.ContainerName), + Description: utils.String(model.Description), + ServiceDataAccessAuthIdentity: utils.ToPtr(datastore.ServiceDataAccessAuthIdentity(model.ServiceDataAuthIdentity)), + IsDefault: utils.Bool(model.IsDefault), + Tags: utils.ToPtr(model.Tags), + } + + accountKey := model.AccountKey + if accountKey != "" { + props.Credentials = map[string]interface{}{ + "credentialsType": string(datastore.CredentialsTypeAccountKey), + "secrets": map[string]interface{}{ + "secretsType": "AccountKey", + "key": accountKey, + }, + } + } + + sasToken := model.SharedAccessSignature + if sasToken != "" { + props.Credentials = map[string]interface{}{ + "credentialsType": string(datastore.CredentialsTypeSas), + "secrets": map[string]interface{}{ + "secretsType": "Sas", + "sasToken": sasToken, + }, + } + } + datastoreRaw.Properties = props + + _, err = client.CreateOrUpdate(ctx, id, datastoreRaw, datastore.DefaultCreateOrUpdateOperationOptions()) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r MachineLearningDataStoreBlobStorage) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MachineLearning.DatastoreClient + + id, err := datastore.ParseDataStoreID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var state MachineLearningDataStoreBlobStorageModel + if err := metadata.Decode(&state); err != nil { + return err + } + + containerId, err := storageparse.StorageContainerResourceManagerID(state.StorageContainerID) + if err != nil { + return err + } + + datastoreRaw := datastore.DatastoreResource{ + Name: utils.String(id.DataStoreName), + Type: utils.ToPtr(string(datastore.DatastoreTypeAzureBlob)), + } + + props := &datastore.AzureBlobDatastore{ + AccountName: utils.String(containerId.StorageAccountName), + ContainerName: utils.String(containerId.ContainerName), + Description: utils.String(state.Description), + ServiceDataAccessAuthIdentity: utils.ToPtr(datastore.ServiceDataAccessAuthIdentity(state.ServiceDataAuthIdentity)), + IsDefault: utils.Bool(state.IsDefault), + Tags: utils.ToPtr(state.Tags), + } + + accountKey := state.AccountKey + if accountKey != "" { + props.Credentials = map[string]interface{}{ + "credentialsType": string(datastore.CredentialsTypeAccountKey), + "secrets": map[string]interface{}{ + "secretsType": "AccountKey", + "key": accountKey, + }, + } + } + + sasToken := state.SharedAccessSignature + if sasToken != "" { + props.Credentials = map[string]interface{}{ + "credentialsType": string(datastore.CredentialsTypeSas), + "secrets": map[string]interface{}{ + "secretsType": "Sas", + "sasToken": sasToken, + }, + } + } + datastoreRaw.Properties = props + + _, err = client.CreateOrUpdate(ctx, *id, datastoreRaw, datastore.DefaultCreateOrUpdateOperationOptions()) + if err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + return nil + }, + } +} + +func (r MachineLearningDataStoreBlobStorage) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MachineLearning.DatastoreClient + subscriptionId := metadata.Client.Account.SubscriptionId + + id, err := datastore.ParseDataStoreID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("reading %s: %+v", *id, err) + } + + workspaceId := workspaces.NewWorkspaceID(subscriptionId, id.ResourceGroupName, id.WorkspaceName) + model := MachineLearningDataStoreBlobStorageModel{ + Name: *resp.Model.Name, + WorkSpaceID: workspaceId.ID(), + } + + data := resp.Model.Properties.(datastore.AzureBlobDatastore) + serviceDataAuth := "" + if v := data.ServiceDataAccessAuthIdentity; v != nil { + serviceDataAuth = string(*v) + } + model.ServiceDataAuthIdentity = serviceDataAuth + + containerId := storageparse.NewStorageContainerResourceManagerID(subscriptionId, workspaceId.ResourceGroupName, *data.AccountName, "default", *data.ContainerName) + model.StorageContainerID = containerId.ID() + model.IsDefault = *data.IsDefault + + if v, ok := metadata.ResourceData.GetOk("account_key"); ok { + if v.(string) != "" { + model.AccountKey = v.(string) + } + } + + if v, ok := metadata.ResourceData.GetOk("shared_access_signature"); ok { + if v.(string) != "" { + model.SharedAccessSignature = v.(string) + } + } + + desc := "" + if v := data.Description; v != nil { + desc = *v + } + model.Description = desc + + if data.Tags != nil { + model.Tags = *data.Tags + } + + return metadata.Encode(&model) + }, + } +} + +func (r MachineLearningDataStoreBlobStorage) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MachineLearning.DatastoreClient + + id, err := datastore.ParseDataStoreID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} diff --git a/internal/services/machinelearning/machine_learning_datastore_blobstorage_resource_test.go b/internal/services/machinelearning/machine_learning_datastore_blobstorage_resource_test.go new file mode 100644 index 000000000000..ea37bb12e071 --- /dev/null +++ b/internal/services/machinelearning/machine_learning_datastore_blobstorage_resource_test.go @@ -0,0 +1,265 @@ +package machinelearning_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type MachineLearningDataStoreBlobStorage struct{} + +func TestAccMachineLearningDataStoreBlobStorage_accountKey(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_machine_learning_datastore_blobstorage", "test") + r := MachineLearningDataStoreBlobStorage{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.blobStorageAccountKey(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("account_key"), + }) +} + +func TestAccMachineLearningDataStoreBlobStorage_sasToken(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_machine_learning_datastore_blobstorage", "test") + r := MachineLearningDataStoreBlobStorage{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.blobStorageSas(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("shared_access_signature"), + }) +} + +func TestAccMachineLearningDataStoreBlobStorage_Update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_machine_learning_datastore_blobstorage", "test") + r := MachineLearningDataStoreBlobStorage{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.blobStorageAccountKey(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("account_key"), + { + Config: r.blobStorageSas(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("account_key", "shared_access_signature"), + }) +} + +func TestAccMachineLearningDataStoreBlobStorage_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_machine_learning_datastore_blobstorage", "test") + r := MachineLearningDataStoreBlobStorage{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.blobStorageAccountKey(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func (r MachineLearningDataStoreBlobStorage) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + dataStoreClient := client.MachineLearning.DatastoreClient + id, err := datastore.ParseDataStoreID(state.ID) + if err != nil { + return nil, err + } + + resp, err := dataStoreClient.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving Machine Learning Data Store %q: %+v", state.ID, err) + } + + return utils.Bool(resp.Model.Properties != nil), nil +} + +func (r MachineLearningDataStoreBlobStorage) blobStorageAccountKey(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_storage_container" "test" { + name = "acctestcontainer%[2]d" + storage_account_name = azurerm_storage_account.test.name + container_access_type = "private" +} + +resource "azurerm_machine_learning_datastore_blobstorage" "test" { + name = "accdatastore%[2]d" + workspace_id = azurerm_machine_learning_workspace.test.id + storage_container_id = azurerm_storage_container.test.resource_manager_id + account_key = azurerm_storage_account.test.primary_access_key +} +`, template, data.RandomInteger) +} + +func (r MachineLearningDataStoreBlobStorage) blobStorageSas(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_storage_container" "test" { + name = "acctestcontainer%[2]d" + storage_account_name = azurerm_storage_account.test.name + container_access_type = "private" +} + +data "azurerm_storage_account_sas" "test" { + connection_string = azurerm_storage_account.test.primary_connection_string + https_only = true + signed_version = "2019-10-10" + + resource_types { + service = true + container = true + object = true + } + + services { + blob = true + queue = false + table = false + file = true + } + + start = "2022-01-01T06:17:07Z" + expiry = "2024-12-23T06:17:07Z" + + permissions { + read = true + write = true + delete = false + list = false + add = true + create = true + update = false + process = false + tag = false + filter = false + } +} + +resource "azurerm_machine_learning_datastore_blobstorage" "test" { + name = "accdatastore%[2]d" + workspace_id = azurerm_machine_learning_workspace.test.id + storage_container_id = azurerm_storage_container.test.resource_manager_id + shared_access_signature = data.azurerm_storage_account_sas.test.sas +} +`, template, data.RandomInteger) +} + +func (r MachineLearningDataStoreBlobStorage) requiresImport(data acceptance.TestData) string { + template := r.blobStorageAccountKey(data) + return fmt.Sprintf(` + + +%s + +resource "azurerm_machine_learning_datastore_blobstorage" "import" { + name = azurerm_machine_learning_datastore_blobstorage.test.name + workspace_id = azurerm_machine_learning_datastore_blobstorage.test.workspace_id + storage_container_id = azurerm_machine_learning_datastore_blobstorage.test.storage_container_id + account_key = azurerm_machine_learning_datastore_blobstorage.test.account_key +} +`, template) +} + +func (r MachineLearningDataStoreBlobStorage) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features { + key_vault { + purge_soft_delete_on_destroy = false + purge_soft_deleted_keys_on_destroy = false + } + } +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-ml-%[1]d" + location = "%[2]s" +} + +resource "azurerm_application_insights" "test" { + name = "acctestai-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + application_type = "web" +} + +resource "azurerm_key_vault" "test" { + name = "acctestvault%[3]s" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + tenant_id = data.azurerm_client_config.current.tenant_id + + sku_name = "standard" + + purge_protection_enabled = true +} + +resource "azurerm_key_vault_access_policy" "test" { + key_vault_id = azurerm_key_vault.test.id + tenant_id = data.azurerm_client_config.current.tenant_id + object_id = data.azurerm_client_config.current.object_id + + key_permissions = [ + "Create", + "Get", + "Delete", + "Purge", + ] +} + +resource "azurerm_storage_account" "test" { + name = "acctestsa%[4]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_machine_learning_workspace" "test" { + name = "acctest-MLW-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + application_insights_id = azurerm_application_insights.test.id + key_vault_id = azurerm_key_vault.test.id + storage_account_id = azurerm_storage_account.test.id + + identity { + type = "SystemAssigned" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomIntOfLength(15)) +} diff --git a/internal/services/machinelearning/machine_learning_datastore_datalake_gen2_resource.go b/internal/services/machinelearning/machine_learning_datastore_datalake_gen2_resource.go new file mode 100644 index 000000000000..d90e07917bae --- /dev/null +++ b/internal/services/machinelearning/machine_learning_datastore_datalake_gen2_resource.go @@ -0,0 +1,360 @@ +package machinelearning + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore" + "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/workspaces" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/validate" + storageparse "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type MachineLearningDataStoreDataLakeGen2 struct{} + +type MachineLearningDataStoreDataLakeGen2Model struct { + Name string `tfschema:"name"` + WorkSpaceID string `tfschema:"workspace_id"` + StorageContainerID string `tfschema:"storage_container_id"` + TenantID string `tfschema:"tenant_id"` + ClientID string `tfschema:"client_id"` + ClientSecret string `tfschema:"client_secret"` + AuthorityUrl string `tfschema:"authority_url"` + Description string `tfschema:"description"` + IsDefault bool `tfschema:"is_default"` + ServiceDataIdentity string `tfschema:"service_data_identity"` + Tags map[string]string `tfschema:"tags"` +} + +func (r MachineLearningDataStoreDataLakeGen2) Attributes() map[string]*schema.Schema { + return map[string]*pluginsdk.Schema{ + "is_default": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + } +} + +func (r MachineLearningDataStoreDataLakeGen2) ModelObject() interface{} { + return &MachineLearningDataStoreDataLakeGen2Model{} +} + +func (r MachineLearningDataStoreDataLakeGen2) ResourceType() string { + return "azurerm_machine_learning_datastore_datalake_gen2" +} + +func (r MachineLearningDataStoreDataLakeGen2) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return datastore.ValidateDataStoreID +} + +var _ sdk.ResourceWithUpdate = MachineLearningDataStoreDataLakeGen2{} + +func (r MachineLearningDataStoreDataLakeGen2) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.DataStoreName, + }, + + "workspace_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.WorkspaceID, + }, + + "storage_container_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "tenant_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.IsUUID, + RequiredWith: []string{"client_id", "client_secret"}, + }, + + "client_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.IsUUID, + RequiredWith: []string{"tenant_id", "client_secret"}, + }, + + "client_secret": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + RequiredWith: []string{"tenant_id", "client_id"}, + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + }, + + "service_data_identity": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(datastore.ServiceDataAccessAuthIdentityNone), + string(datastore.ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity), + string(datastore.ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity), + }, + false), + Default: string(datastore.ServiceDataAccessAuthIdentityNone), + }, + + "authority_url": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "tags": commonschema.TagsForceNew(), + } +} + +func (r MachineLearningDataStoreDataLakeGen2) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MachineLearning.DatastoreClient + subscriptionId := metadata.Client.Account.SubscriptionId + + var model MachineLearningDataStoreDataLakeGen2Model + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding %+v", err) + } + + workspaceId, err := workspaces.ParseWorkspaceID(model.WorkSpaceID) + if err != nil { + return err + } + + id := datastore.NewDataStoreID(subscriptionId, workspaceId.ResourceGroupName, workspaceId.WorkspaceName, model.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_machine_learning_datastore_datalake_gen2", id.ID()) + } + + containerId, err := storageparse.StorageContainerResourceManagerID(model.StorageContainerID) + if err != nil { + return err + } + + datastoreRaw := datastore.DatastoreResource{ + Name: utils.String(model.Name), + Type: utils.ToPtr(string(datastore.DatastoreTypeAzureDataLakeGenTwo)), + } + + props := &datastore.AzureDataLakeGen2Datastore{ + AccountName: containerId.StorageAccountName, + Filesystem: containerId.ContainerName, + Description: utils.String(model.Description), + ServiceDataAccessAuthIdentity: utils.ToPtr(datastore.ServiceDataAccessAuthIdentity(model.ServiceDataIdentity)), + Tags: utils.ToPtr(model.Tags), + } + + creds := map[string]interface{}{ + "credentialsType": "None", + } + + if len(model.TenantID) != 0 && len(model.ClientID) != 0 && len(model.ClientSecret) != 0 { + creds = map[string]interface{}{ + "credentialsType": string(datastore.CredentialsTypeServicePrincipal), + "authorityUrl": model.AuthorityUrl, + "resourceUrl": "https://datalake.azure.net/", + "tenantId": model.TenantID, + "clientId": model.ClientID, + "secrets": map[string]interface{}{ + "secretsType": "ServicePrincipal", + "clientSecret": model.ClientSecret, + }, + } + } + props.Credentials = creds + datastoreRaw.Properties = props + + _, err = client.CreateOrUpdate(ctx, id, datastoreRaw, datastore.DefaultCreateOrUpdateOperationOptions()) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r MachineLearningDataStoreDataLakeGen2) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MachineLearning.DatastoreClient + + id, err := datastore.ParseDataStoreID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var state MachineLearningDataStoreDataLakeGen2Model + if err := metadata.Decode(&state); err != nil { + return err + } + containerId, err := storageparse.StorageContainerResourceManagerID(state.StorageContainerID) + if err != nil { + return err + } + + datastoreRaw := datastore.DatastoreResource{ + Name: utils.String(id.DataStoreName), + Type: utils.ToPtr(string(datastore.DatastoreTypeAzureDataLakeGenTwo)), + } + + props := &datastore.AzureDataLakeGen2Datastore{ + AccountName: containerId.StorageAccountName, + Filesystem: containerId.ContainerName, + Description: utils.String(state.Description), + ServiceDataAccessAuthIdentity: utils.ToPtr(datastore.ServiceDataAccessAuthIdentity(state.ServiceDataIdentity)), + Tags: utils.ToPtr(state.Tags), + } + + creds := map[string]interface{}{ + "credentialsType": "None", + } + + if len(state.TenantID) != 0 && len(state.ClientID) != 0 && len(state.ClientSecret) != 0 { + creds = map[string]interface{}{ + "credentialsType": string(datastore.CredentialsTypeServicePrincipal), + "authorityUrl": state.AuthorityUrl, + "resourceUrl": "https://datalake.azure.net/", + "tenantId": state.TenantID, + "clientId": state.ClientID, + "secrets": map[string]interface{}{ + "secretsType": "ServicePrincipal", + "clientSecret": state.ClientSecret, + }, + } + } + props.Credentials = creds + datastoreRaw.Properties = props + + _, err = client.CreateOrUpdate(ctx, *id, datastoreRaw, datastore.DefaultCreateOrUpdateOperationOptions()) + if err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) + } + + return nil + }, + } +} + +func (r MachineLearningDataStoreDataLakeGen2) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MachineLearning.DatastoreClient + subscriptionId := metadata.Client.Account.SubscriptionId + + id, err := datastore.ParseDataStoreID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("reading %s: %+v", *id, err) + } + + workspaceId := workspaces.NewWorkspaceID(subscriptionId, id.ResourceGroupName, id.WorkspaceName) + model := MachineLearningDataStoreDataLakeGen2Model{ + Name: *resp.Model.Name, + WorkSpaceID: workspaceId.ID(), + } + + data := resp.Model.Properties.(datastore.AzureDataLakeGen2Datastore) + serviceDataIdentity := "" + if v := data.ServiceDataAccessAuthIdentity; v != nil { + serviceDataIdentity = string(*v) + } + model.ServiceDataIdentity = serviceDataIdentity + + containerId := storageparse.NewStorageContainerResourceManagerID(subscriptionId, workspaceId.ResourceGroupName, data.AccountName, "default", data.Filesystem) + model.StorageContainerID = containerId.ID() + + model.IsDefault = *data.IsDefault + + if creds, ok := data.Credentials.(datastore.ServicePrincipalDatastoreCredentials); ok { + if !strings.EqualFold(creds.TenantId, "00000000-0000-0000-0000-000000000000") && !strings.EqualFold(creds.ClientId, "00000000-0000-0000-0000-000000000000") { + model.TenantID = creds.TenantId + model.ClientID = creds.ClientId + if v, ok := metadata.ResourceData.GetOk("client_secret"); ok { + if v.(string) != "" { + model.ClientSecret = v.(string) + } + } + } + } + + desc := "" + if v := data.Description; v != nil { + desc = *v + } + model.Description = desc + + if data.Tags != nil { + model.Tags = *data.Tags + } + + return metadata.Encode(&model) + }, + } +} + +func (r MachineLearningDataStoreDataLakeGen2) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MachineLearning.DatastoreClient + + id, err := datastore.ParseDataStoreID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} diff --git a/internal/services/machinelearning/machine_learning_datastore_datalake_gen2_resource_test.go b/internal/services/machinelearning/machine_learning_datastore_datalake_gen2_resource_test.go new file mode 100644 index 000000000000..07883c122fbd --- /dev/null +++ b/internal/services/machinelearning/machine_learning_datastore_datalake_gen2_resource_test.go @@ -0,0 +1,239 @@ +package machinelearning_test + +import ( + "context" + "fmt" + "os" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type MachineLearningDataStoreDataLakeGen2 struct{} + +func TestAccMachineLearningDataStoreDataLakeGen2_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_machine_learning_datastore_datalake_gen2", "test") + r := MachineLearningDataStoreDataLakeGen2{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.dataLakeGen2Basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMachineLearningDataStoreDataLakeGen2_spn(t *testing.T) { + if os.Getenv("ARM_TENANT_ID") == "" || os.Getenv("ARM_CLIENT_ID") == "" || + os.Getenv("ARM_CLIENT_SECRET") == "" { + t.Skip("Skipping as `ARM_TENANT_ID` or `ARM_CLIENT_ID` or `ARM_CLIENT_SECRET` not specified") + } + + data := acceptance.BuildTestData(t, "azurerm_machine_learning_datastore_datalake_gen2", "test") + r := MachineLearningDataStoreDataLakeGen2{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.dataLakeGen2Spn(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("client_secret"), + }) +} + +func TestAccMachineLearningDataStoreDataLakeGen2_Update(t *testing.T) { + if os.Getenv("ARM_TENANT_ID") == "" || os.Getenv("ARM_CLIENT_ID") == "" || + os.Getenv("ARM_CLIENT_SECRET") == "" { + t.Skip("Skipping as `ARM_TENANT_ID` or `ARM_CLIENT_ID` or `ARM_CLIENT_SECRET` not specified") + } + + data := acceptance.BuildTestData(t, "azurerm_machine_learning_datastore_datalake_gen2", "test") + r := MachineLearningDataStoreDataLakeGen2{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.dataLakeGen2Basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("client_secret"), + { + Config: r.dataLakeGen2Spn(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("client_secret"), + }) +} + +func TestAccMachineLearningDataStoreDataLakeGen2_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_machine_learning_datastore_datalake_gen2", "test") + r := MachineLearningDataStoreDataLakeGen2{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.dataLakeGen2Basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func (r MachineLearningDataStoreDataLakeGen2) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + dataStoreClient := client.MachineLearning.DatastoreClient + id, err := datastore.ParseDataStoreID(state.ID) + if err != nil { + return nil, err + } + + resp, err := dataStoreClient.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving Machine Learning Data Store %q: %+v", state.ID, err) + } + + return utils.Bool(resp.Model.Properties != nil), nil +} + +func (r MachineLearningDataStoreDataLakeGen2) dataLakeGen2Basic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_storage_container" "test" { + name = "acctestcontainer%[2]d" + storage_account_name = azurerm_storage_account.test.name + container_access_type = "private" +} + +resource "azurerm_machine_learning_datastore_datalake_gen2" "test" { + name = "accdatastore%[2]d" + workspace_id = azurerm_machine_learning_workspace.test.id + storage_container_id = azurerm_storage_container.test.resource_manager_id +} +`, template, data.RandomInteger) +} + +func (r MachineLearningDataStoreDataLakeGen2) dataLakeGen2Spn(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_storage_container" "test" { + name = "acctestcontainer%[2]d" + storage_account_name = azurerm_storage_account.test.name + container_access_type = "private" +} + +resource "azurerm_machine_learning_datastore_datalake_gen2" "test" { + name = "accdatastore%[2]d" + workspace_id = azurerm_machine_learning_workspace.test.id + storage_container_id = azurerm_storage_container.test.resource_manager_id + tenant_id = "%[3]s" + client_id = "%[4]s" + client_secret = "%[5]s" +} +`, template, data.RandomInteger, os.Getenv("ARM_TENANT_ID"), os.Getenv("ARM_CLIENT_ID"), os.Getenv("ARM_CLIENT_SECRET")) +} + +func (r MachineLearningDataStoreDataLakeGen2) requiresImport(data acceptance.TestData) string { + template := r.dataLakeGen2Basic(data) + return fmt.Sprintf(` +%s + +resource "azurerm_machine_learning_datastore_datalake_gen2" "import" { + name = azurerm_machine_learning_datastore_datalake_gen2.test.name + workspace_id = azurerm_machine_learning_datastore_datalake_gen2.test.workspace_id + storage_container_id = azurerm_machine_learning_datastore_datalake_gen2.test.storage_container_id +} +`, template) +} + +func (r MachineLearningDataStoreDataLakeGen2) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features { + key_vault { + purge_soft_delete_on_destroy = false + purge_soft_deleted_keys_on_destroy = false + } + } +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-ml-%[1]d" + location = "%[2]s" +} + +resource "azurerm_application_insights" "test" { + name = "acctestai-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + application_type = "web" +} + +resource "azurerm_key_vault" "test" { + name = "acctestvault%[3]s" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + tenant_id = data.azurerm_client_config.current.tenant_id + + sku_name = "standard" + + purge_protection_enabled = true +} + +resource "azurerm_key_vault_access_policy" "test" { + key_vault_id = azurerm_key_vault.test.id + tenant_id = data.azurerm_client_config.current.tenant_id + object_id = data.azurerm_client_config.current.object_id + + key_permissions = [ + "Create", + "Get", + "Delete", + "Purge", + ] +} + +resource "azurerm_storage_account" "test" { + name = "acctestsa%[4]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_machine_learning_workspace" "test" { + name = "acctest-MLW-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + application_insights_id = azurerm_application_insights.test.id + key_vault_id = azurerm_key_vault.test.id + storage_account_id = azurerm_storage_account.test.id + + identity { + type = "SystemAssigned" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomIntOfLength(15)) +} diff --git a/internal/services/machinelearning/machine_learning_datastore_fileshare_resource.go b/internal/services/machinelearning/machine_learning_datastore_fileshare_resource.go new file mode 100644 index 000000000000..fcf9586abdec --- /dev/null +++ b/internal/services/machinelearning/machine_learning_datastore_fileshare_resource.go @@ -0,0 +1,350 @@ +package machinelearning + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore" + "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/workspaces" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/validate" + storageparse "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type MachineLearningDataStoreFileShare struct{} + +type MachineLearningDataStoreFileShareModel struct { + Name string `tfschema:"name"` + WorkSpaceID string `tfschema:"workspace_id"` + StorageFileShareID string `tfschema:"storage_fileshare_id"` + Description string `tfschema:"description"` + IsDefault bool `tfschema:"is_default"` + ServiceDataIdentity string `tfschema:"service_data_identity"` + AccountKey string `tfschema:"account_key"` + SharedAccessSignature string `tfschema:"shared_access_signature"` + Tags map[string]string `tfschema:"tags"` +} + +func (r MachineLearningDataStoreFileShare) ModelObject() interface{} { + return &MachineLearningDataStoreFileShareModel{} +} + +func (r MachineLearningDataStoreFileShare) ResourceType() string { + return "azurerm_machine_learning_datastore_fileshare" +} + +func (r MachineLearningDataStoreFileShare) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return datastore.ValidateDataStoreID +} + +var _ sdk.ResourceWithUpdate = MachineLearningDataStoreFileShare{} + +func (r MachineLearningDataStoreFileShare) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.DataStoreName, + }, + + "workspace_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.WorkspaceID, + }, + + "storage_fileshare_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + }, + + "service_data_identity": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(datastore.ServiceDataAccessAuthIdentityNone), + string(datastore.ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity), + string(datastore.ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity), + }, + false), + Default: string(datastore.ServiceDataAccessAuthIdentityNone), + }, + + "account_key": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + ExactlyOneOf: []string{"account_key", "shared_access_signature"}, + }, + + "shared_access_signature": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + AtLeastOneOf: []string{"account_key", "shared_access_signature"}, + }, + + "tags": commonschema.TagsForceNew(), + } +} + +func (r MachineLearningDataStoreFileShare) Attributes() map[string]*schema.Schema { + return map[string]*pluginsdk.Schema{ + "is_default": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + } +} + +func (r MachineLearningDataStoreFileShare) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MachineLearning.DatastoreClient + subscriptionId := metadata.Client.Account.SubscriptionId + + var model MachineLearningDataStoreFileShareModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding %+v", err) + } + + workspaceId, err := workspaces.ParseWorkspaceID(model.WorkSpaceID) + if err != nil { + return err + } + + id := datastore.NewDataStoreID(subscriptionId, workspaceId.ResourceGroupName, workspaceId.WorkspaceName, model.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_machine_learning_datastore_fileshare", id.ID()) + } + + fileShareId, err := storageparse.StorageShareResourceManagerID(model.StorageFileShareID) + if err != nil { + return err + } + + datastoreRaw := datastore.DatastoreResource{ + Name: utils.String(model.Name), + Type: utils.ToPtr(string(datastore.DatastoreTypeAzureFile)), + } + + props := &datastore.AzureFileDatastore{ + AccountName: fileShareId.StorageAccountName, + FileShareName: fileShareId.FileshareName, + Description: utils.String(model.Description), + ServiceDataAccessAuthIdentity: utils.ToPtr(datastore.ServiceDataAccessAuthIdentity(model.ServiceDataIdentity)), + Tags: utils.ToPtr(model.Tags), + } + + accountKey := model.AccountKey + if accountKey != "" { + props.Credentials = map[string]interface{}{ + "credentialsType": string(datastore.CredentialsTypeAccountKey), + "secrets": map[string]interface{}{ + "secretsType": "AccountKey", + "key": accountKey, + }, + } + } + + sasToken := model.SharedAccessSignature + if sasToken != "" { + props.Credentials = map[string]interface{}{ + "credentialsType": string(datastore.CredentialsTypeSas), + "secrets": map[string]interface{}{ + "secretsType": "Sas", + "sasToken": sasToken, + }, + } + } + datastoreRaw.Properties = props + + _, err = client.CreateOrUpdate(ctx, id, datastoreRaw, datastore.DefaultCreateOrUpdateOperationOptions()) + if err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r MachineLearningDataStoreFileShare) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MachineLearning.DatastoreClient + + id, err := datastore.ParseDataStoreID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var state MachineLearningDataStoreFileShareModel + if err := metadata.Decode(&state); err != nil { + return err + } + + fileShareId, err := storageparse.StorageShareResourceManagerID(state.StorageFileShareID) + if err != nil { + return err + } + + datastoreRaw := datastore.DatastoreResource{ + Name: utils.String(id.DataStoreName), + Type: utils.ToPtr(string(datastore.DatastoreTypeAzureFile)), + } + + props := &datastore.AzureFileDatastore{ + AccountName: fileShareId.StorageAccountName, + FileShareName: fileShareId.FileshareName, + Description: utils.String(state.Description), + ServiceDataAccessAuthIdentity: utils.ToPtr(datastore.ServiceDataAccessAuthIdentity(state.ServiceDataIdentity)), + Tags: utils.ToPtr(state.Tags), + } + + accountKey := state.AccountKey + if accountKey != "" { + props.Credentials = map[string]interface{}{ + "credentialsType": string(datastore.CredentialsTypeAccountKey), + "secrets": map[string]interface{}{ + "secretsType": "AccountKey", + "key": accountKey, + }, + } + } + + sasToken := state.SharedAccessSignature + if sasToken != "" { + props.Credentials = map[string]interface{}{ + "credentialsType": string(datastore.CredentialsTypeSas), + "secrets": map[string]interface{}{ + "secretsType": "Sas", + "sasToken": sasToken, + }, + } + } + datastoreRaw.Properties = props + + _, err = client.CreateOrUpdate(ctx, *id, datastoreRaw, datastore.DefaultCreateOrUpdateOperationOptions()) + if err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + return nil + }, + } +} + +func (r MachineLearningDataStoreFileShare) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MachineLearning.DatastoreClient + subscriptionId := metadata.Client.Account.SubscriptionId + + id, err := datastore.ParseDataStoreID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("reading %s: %+v", *id, err) + } + + workspaceId := workspaces.NewWorkspaceID(subscriptionId, id.ResourceGroupName, id.WorkspaceName) + model := MachineLearningDataStoreFileShareModel{ + Name: *resp.Model.Name, + WorkSpaceID: workspaceId.ID(), + } + + data := resp.Model.Properties.(datastore.AzureFileDatastore) + serviceDataIdentity := "" + if v := data.ServiceDataAccessAuthIdentity; v != nil { + serviceDataIdentity = string(*v) + } + model.ServiceDataIdentity = serviceDataIdentity + + fileShareId := storageparse.NewStorageShareResourceManagerID(subscriptionId, workspaceId.ResourceGroupName, data.AccountName, "default", data.FileShareName) + model.StorageFileShareID = fileShareId.ID() + model.IsDefault = *data.IsDefault + + if v, ok := metadata.ResourceData.GetOk("account_key"); ok { + if v.(string) != "" { + model.AccountKey = v.(string) + } + } + + if v, ok := metadata.ResourceData.GetOk("shared_access_signature"); ok { + if v.(string) != "" { + model.SharedAccessSignature = v.(string) + } + } + + desc := "" + if v := data.Description; v != nil { + desc = *v + } + model.Description = desc + + if data.Tags != nil { + model.Tags = *data.Tags + } + + return metadata.Encode(&model) + }, + } +} + +func (r MachineLearningDataStoreFileShare) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MachineLearning.DatastoreClient + + id, err := datastore.ParseDataStoreID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} diff --git a/internal/services/machinelearning/machine_learning_datastore_fileshare_resource_test.go b/internal/services/machinelearning/machine_learning_datastore_fileshare_resource_test.go new file mode 100644 index 000000000000..40b16af69530 --- /dev/null +++ b/internal/services/machinelearning/machine_learning_datastore_fileshare_resource_test.go @@ -0,0 +1,272 @@ +package machinelearning_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type MachineLearningDataStoreFileShare struct{} + +func TestAccMachineLearningDataStoreFileShare_accountKey(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_machine_learning_datastore_fileshare", "test") + r := MachineLearningDataStoreFileShare{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.fileShareAccountKey(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("account_key"), + }) +} + +func TestAccMachineLearningDataStoreFileShare_sasToken(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_machine_learning_datastore_fileshare", "test") + r := MachineLearningDataStoreFileShare{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.fileShareSas(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("shared_access_signature"), + }) +} + +func TestAccMachineLearningDataStoreFileShare_Update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_machine_learning_datastore_fileshare", "test") + r := MachineLearningDataStoreFileShare{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.fileShareAccountKey(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("account_key"), + { + Config: r.fileShareSas(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("account_key", "shared_access_signature"), + }) +} + +func TestAccMachineLearningDataStoreFileShare_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_machine_learning_datastore_fileshare", "test") + r := MachineLearningDataStoreFileShare{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.fileShareAccountKey(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func (r MachineLearningDataStoreFileShare) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + dataStoreClient := client.MachineLearning.DatastoreClient + id, err := datastore.ParseDataStoreID(state.ID) + if err != nil { + return nil, err + } + + resp, err := dataStoreClient.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving Machine Learning Data Store File Share %q: %+v", state.ID, err) + } + + return utils.Bool(resp.Model.Properties != nil), nil +} + +func (r MachineLearningDataStoreFileShare) fileShareAccountKey(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_storage_share" "test" { + name = "accfs%[2]d" + storage_account_name = azurerm_storage_account.test.name + quota = 1 +} + +resource "azurerm_machine_learning_datastore_fileshare" "test" { + name = "accdatastore%[2]d" + workspace_id = azurerm_machine_learning_workspace.test.id + storage_fileshare_id = azurerm_storage_share.test.resource_manager_id + account_key = azurerm_storage_account.test.primary_access_key +} +`, template, data.RandomInteger) +} + +func (r MachineLearningDataStoreFileShare) fileShareSas(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_storage_share" "test" { + name = "accfs%[2]d" + storage_account_name = azurerm_storage_account.test.name + quota = 1 +} + +data "azurerm_storage_account_sas" "test" { + connection_string = azurerm_storage_account.test.primary_connection_string + https_only = true + signed_version = "2019-10-10" + + resource_types { + service = true + container = true + object = true + } + + services { + blob = true + queue = false + table = false + file = true + } + + start = "2022-01-01T06:17:07Z" + expiry = "2024-12-23T06:17:07Z" + + permissions { + read = true + write = true + delete = false + list = false + add = true + create = true + update = false + process = false + tag = false + filter = false + } +} + +resource "azurerm_machine_learning_datastore_fileshare" "test" { + name = "accdatastore%[2]d" + workspace_id = azurerm_machine_learning_workspace.test.id + storage_fileshare_id = azurerm_storage_share.test.resource_manager_id + shared_access_signature = data.azurerm_storage_account_sas.test.sas +} + + + + +`, template, data.RandomInteger) +} + +func (r MachineLearningDataStoreFileShare) requiresImport(data acceptance.TestData) string { + template := r.fileShareAccountKey(data) + return fmt.Sprintf(` +%s + +resource "azurerm_machine_learning_datastore_fileshare" "import" { + name = azurerm_machine_learning_datastore_fileshare.test.name + workspace_id = azurerm_machine_learning_datastore_fileshare.test.workspace_id + storage_fileshare_id = azurerm_machine_learning_datastore_fileshare.test.storage_fileshare_id + account_key = azurerm_machine_learning_datastore_fileshare.test.account_key +} + +`, template) +} + +func (r MachineLearningDataStoreFileShare) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features { + key_vault { + purge_soft_delete_on_destroy = false + purge_soft_deleted_keys_on_destroy = false + } + resource_group { + prevent_deletion_if_contains_resources = false + } + + } +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-ml-%[1]d" + location = "%[2]s" +} + +resource "azurerm_application_insights" "test" { + name = "acctestai-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + application_type = "web" +} + +resource "azurerm_key_vault" "test" { + name = "acctestvault%[3]s" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + tenant_id = data.azurerm_client_config.current.tenant_id + + sku_name = "standard" + + purge_protection_enabled = true +} + +resource "azurerm_key_vault_access_policy" "test" { + key_vault_id = azurerm_key_vault.test.id + tenant_id = data.azurerm_client_config.current.tenant_id + object_id = data.azurerm_client_config.current.object_id + + key_permissions = [ + "Create", + "Get", + "Delete", + "Purge", + ] +} + +resource "azurerm_storage_account" "test" { + name = "acctestsa%[4]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_machine_learning_workspace" "test" { + name = "acctest-MLW-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + application_insights_id = azurerm_application_insights.test.id + key_vault_id = azurerm_key_vault.test.id + storage_account_id = azurerm_storage_account.test.id + + identity { + type = "SystemAssigned" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomIntOfLength(15)) +} diff --git a/internal/services/machinelearning/machine_learning_inference_cluster_resource.go b/internal/services/machinelearning/machine_learning_inference_cluster_resource.go index 6d2e2a2f2e1e..bc3748ea14eb 100644 --- a/internal/services/machinelearning/machine_learning_inference_cluster_resource.go +++ b/internal/services/machinelearning/machine_learning_inference_cluster_resource.go @@ -235,7 +235,7 @@ func resourceAksInferenceClusterRead(d *pluginsdk.ResourceData, meta interface{} aksComputeProperties := computeResource.Model.Properties.(machinelearningcomputes.AKS) // Retrieve AKS Cluster ID - aksId, err := managedclusters.ParseManagedClusterID(*aksComputeProperties.ResourceId) + aksId, err := managedclusters.ParseManagedClusterIDInsensitively(*aksComputeProperties.ResourceId) if err != nil { return err } diff --git a/internal/services/machinelearning/machine_learning_workspace_resource.go b/internal/services/machinelearning/machine_learning_workspace_resource.go index 71426c43e075..f30628689b93 100644 --- a/internal/services/machinelearning/machine_learning_workspace_resource.go +++ b/internal/services/machinelearning/machine_learning_workspace_resource.go @@ -123,7 +123,6 @@ func resourceMachineLearningWorkspace() *pluginsdk.Resource { "image_build_compute_name": { Type: pluginsdk.TypeString, Optional: true, - ForceNew: true, }, "description": { diff --git a/internal/services/machinelearning/machine_learning_workspace_resource_test.go b/internal/services/machinelearning/machine_learning_workspace_resource_test.go index 1ae36e91530a..440973e8f930 100644 --- a/internal/services/machinelearning/machine_learning_workspace_resource_test.go +++ b/internal/services/machinelearning/machine_learning_workspace_resource_test.go @@ -430,7 +430,7 @@ resource "azurerm_machine_learning_workspace" "test" { sku_name = "Basic" high_business_impact = true public_network_access_enabled = true - image_build_compute_name = "terraformCompute" + image_build_compute_name = "terraformComputeUpdate" identity { type = "SystemAssigned" diff --git a/internal/services/machinelearning/registration.go b/internal/services/machinelearning/registration.go index 8167cb77c35d..c7a7f9fa6321 100644 --- a/internal/services/machinelearning/registration.go +++ b/internal/services/machinelearning/registration.go @@ -7,6 +7,7 @@ import ( type Registration struct{} +var _ sdk.TypedServiceRegistration = Registration{} var _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} func (r Registration) AssociatedGitHubLabel() string { @@ -41,3 +42,17 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { "azurerm_machine_learning_workspace": resourceMachineLearningWorkspace(), } } + +// DataSources returns the typed DataSources supported by this service +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{} +} + +// Resources returns the typed Resources supported by this service +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + MachineLearningDataStoreBlobStorage{}, + MachineLearningDataStoreDataLakeGen2{}, + MachineLearningDataStoreFileShare{}, + } +} diff --git a/internal/services/machinelearning/validate/datastore_name.go b/internal/services/machinelearning/validate/datastore_name.go new file mode 100644 index 000000000000..3ae0c87a6b85 --- /dev/null +++ b/internal/services/machinelearning/validate/datastore_name.go @@ -0,0 +1,19 @@ +package validate + +import ( + "fmt" + "regexp" +) + +func DataStoreName(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %q to be string", k)) + return + } + + if matched := regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`).Match([]byte(v)); !matched { + errors = append(errors, fmt.Errorf("%s must be between 1 and 255 characters, and may only include alphanumeric characters and '-'.", k)) + } + return +} diff --git a/internal/services/machinelearning/validate/datastore_name_test.go b/internal/services/machinelearning/validate/datastore_name_test.go new file mode 100644 index 000000000000..853b1fb09f8e --- /dev/null +++ b/internal/services/machinelearning/validate/datastore_name_test.go @@ -0,0 +1,66 @@ +package validate + +import "testing" + +func TestDataStoreName(t *testing.T) { + testData := []struct { + input string + expected bool + }{ + { + // empty + input: "", + expected: false, + }, + { + // basic example + input: "hello", + expected: true, + }, + { + // cannot start with a hyphen + input: "-hello", + expected: false, + }, + { + // can end with a hyphen + input: "hello-", + expected: true, + }, + { + // cannot contain other special symbols other than hyphens + input: "hello.world", + expected: false, + }, + { + // hyphen in the middle + input: "hello-world", + expected: true, + }, + { + // 2 chars + input: "ab", + expected: true, + }, + { + // 255 chars + input: "abcdefghijklmnopqrstuvwxyzabcdefghabcdefghijklmnopqrstuvwxyzabcdefghabcdefghijklmnopqrstuvwxyzabcdefghabcdefghijklmnopqrstuvwxyzabcdefghabcdefghijklmnopqrstuvwxyzabcdefghabcdefghijklmnopqrstuvwxyzabcdefghabcdefghijklmnopqrstuvwxyzabcdefghabcdefghijklmnopa", + expected: true, + }, + { + // 256 chars + input: "abcdefghijklmnopqrstuvwxyzabcdefghabcdefghijklmnopqrstuvwxyzabcdefghabcdefghijklmnopqrstuvwxyzabcdefghabcdefghijklmnopqrstuvwxyzabcdefghabcdefghijklmnopqrstuvwxyzabcdefghabcdefghijklmnopqrstuvwxyzabcdefghabcdefghijklmnopqrstuvwxyzabcdefghabcdefghijklmnopqa", + expected: false, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.input) + + _, errors := DataStoreName(v.input, "name") + actual := len(errors) == 0 + if v.expected != actual { + t.Fatalf("Expected %t but got %t", v.expected, actual) + } + } +} diff --git a/internal/services/maintenance/maintenance_assignment_dedicated_host_resource.go b/internal/services/maintenance/maintenance_assignment_dedicated_host_resource.go index 1a3f3a1079b0..3a707284cd6d 100644 --- a/internal/services/maintenance/maintenance_assignment_dedicated_host_resource.go +++ b/internal/services/maintenance/maintenance_assignment_dedicated_host_resource.go @@ -86,7 +86,7 @@ func resourceArmMaintenanceAssignmentDedicatedHostCreate(d *pluginsdk.ResourceDa } // set assignment name to configuration name - assignmentName := configurationId.ResourceName + assignmentName := configurationId.MaintenanceConfigurationName configurationAssignment := configurationassignments.ConfigurationAssignment{ Name: utils.String(assignmentName), Location: utils.String(location.Normalize(d.Get("location").(string))), diff --git a/internal/services/maintenance/maintenance_assignment_virtual_machine_resource.go b/internal/services/maintenance/maintenance_assignment_virtual_machine_resource.go index 78c5a7f0f8ae..c8fdb7af0741 100644 --- a/internal/services/maintenance/maintenance_assignment_virtual_machine_resource.go +++ b/internal/services/maintenance/maintenance_assignment_virtual_machine_resource.go @@ -88,7 +88,7 @@ func resourceArmMaintenanceAssignmentVirtualMachineCreate(d *pluginsdk.ResourceD } // set assignment name to configuration name - assignmentName := configurationId.ResourceName + assignmentName := configurationId.MaintenanceConfigurationName configurationAssignment := configurationassignments.ConfigurationAssignment{ Name: utils.String(assignmentName), Location: utils.String(location.Normalize(d.Get("location").(string))), diff --git a/internal/services/maintenance/maintenance_assignment_virtual_machine_scale_set_resource.go b/internal/services/maintenance/maintenance_assignment_virtual_machine_scale_set_resource.go index 3632f95ba504..ce0154ecaabe 100644 --- a/internal/services/maintenance/maintenance_assignment_virtual_machine_scale_set_resource.go +++ b/internal/services/maintenance/maintenance_assignment_virtual_machine_scale_set_resource.go @@ -75,7 +75,7 @@ func resourceArmMaintenanceAssignmentVirtualMachineScaleSetCreate(d *pluginsdk.R return err } - configAssignmentId := configurationassignments.NewConfigurationAssignmentID(virtualMachineScaleSetId.SubscriptionId, virtualMachineScaleSetId.ResourceGroup, "Microsoft.Compute", "virtualMachineScaleSets", virtualMachineScaleSetId.Name, maintenanceConfigurationID.ResourceName) + configAssignmentId := configurationassignments.NewConfigurationAssignmentID(virtualMachineScaleSetId.SubscriptionId, virtualMachineScaleSetId.ResourceGroup, "Microsoft.Compute", "virtualMachineScaleSets", virtualMachineScaleSetId.Name, maintenanceConfigurationID.MaintenanceConfigurationName) existingList, err := getMaintenanceAssignmentVirtualMachineScaleSet(ctx, client, virtualMachineScaleSetId) if err != nil { @@ -89,7 +89,7 @@ func resourceArmMaintenanceAssignmentVirtualMachineScaleSetCreate(d *pluginsdk.R } configurationAssignment := configurationassignments.ConfigurationAssignment{ - Name: utils.String(maintenanceConfigurationID.ResourceName), + Name: utils.String(maintenanceConfigurationID.MaintenanceConfigurationName), Location: utils.String(location.Normalize(d.Get("location").(string))), Properties: &configurationassignments.ConfigurationAssignmentProperties{ MaintenanceConfigurationId: utils.String(maintenanceConfigurationID.ID()), diff --git a/internal/services/maintenance/maintenance_configuration_data_source.go b/internal/services/maintenance/maintenance_configuration_data_source.go index 3f3648d9f381..a55981f05802 100644 --- a/internal/services/maintenance/maintenance_configuration_data_source.go +++ b/internal/services/maintenance/maintenance_configuration_data_source.go @@ -180,7 +180,7 @@ func dataSourceArmMaintenanceConfigurationRead(d *pluginsdk.ResourceData, meta i } d.SetId(id.ID()) - d.Set("name", id.ResourceName) + d.Set("name", id.MaintenanceConfigurationName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/maintenance/maintenance_configuration_resource.go b/internal/services/maintenance/maintenance_configuration_resource.go index 6fd3ac4d3dab..20535e60f602 100644 --- a/internal/services/maintenance/maintenance_configuration_resource.go +++ b/internal/services/maintenance/maintenance_configuration_resource.go @@ -274,7 +274,7 @@ func resourceArmMaintenanceConfigurationCreateUpdate(d *pluginsdk.ResourceData, } configuration := maintenanceconfigurations.MaintenanceConfiguration{ - Name: utils.String(id.ResourceName), + Name: utils.String(id.MaintenanceConfigurationName), Location: utils.String(location.Normalize(d.Get("location").(string))), Properties: &maintenanceconfigurations.MaintenanceConfigurationProperties{ MaintenanceScope: &scope, @@ -315,7 +315,7 @@ func resourceArmMaintenanceConfigurationRead(d *pluginsdk.ResourceData, meta int return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.ResourceName) + d.Set("name", id.MaintenanceConfigurationName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { @@ -422,7 +422,10 @@ func expandMaintenanceConfigurationInstallPatches(input []interface{}) *maintena return nil } - v := input[0].(map[string]interface{}) + v, ok := input[0].(map[string]interface{}) + if !ok { + return nil + } rebootSetting := maintenanceconfigurations.RebootOptions(v["reboot"].(string)) installPatches := maintenanceconfigurations.InputPatchConfiguration{ WindowsParameters: expandMaintenanceConfigurationInstallPatchesWindows(v["windows"].([]interface{})), @@ -461,7 +464,10 @@ func expandMaintenanceConfigurationInstallPatchesWindows(input []interface{}) *m return nil } - v := input[0].(map[string]interface{}) + v, ok := input[0].(map[string]interface{}) + if !ok { + return nil + } windowsInput := maintenanceconfigurations.InputWindowsParameters{} if v, ok := v["classifications_to_include"]; ok { windowsInput.ClassificationsToInclude = utils.ExpandStringSlice(v.([]interface{})) @@ -504,7 +510,10 @@ func expandMaintenanceConfigurationInstallPatchesLinux(input []interface{}) *mai return nil } - v := input[0].(map[string]interface{}) + v, ok := input[0].(map[string]interface{}) + if !ok { + return nil + } linuxParameters := maintenanceconfigurations.InputLinuxParameters{} if v, ok := v["classifications_to_include"]; ok { linuxParameters.ClassificationsToInclude = utils.ExpandStringSlice(v.([]interface{})) diff --git a/internal/services/maintenance/maintenance_configuration_resource_test.go b/internal/services/maintenance/maintenance_configuration_resource_test.go index 55cdc76e77ed..c4ef177b91e5 100644 --- a/internal/services/maintenance/maintenance_configuration_resource_test.go +++ b/internal/services/maintenance/maintenance_configuration_resource_test.go @@ -47,6 +47,22 @@ func TestAccMaintenanceConfiguration_basicWithInGuestPatch(t *testing.T) { }) } +func TestAccMaintenanceConfiguration_basicWithOnePatchOnly(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_maintenance_configuration", "test") + r := MaintenanceConfigurationResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic_onePatchOnly(data, true), + }, + data.ImportStep(), + { + Config: r.basic_onePatchOnly(data, false), + }, + data.ImportStep(), + }) +} + func TestAccMaintenanceConfiguration_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_maintenance_configuration", "test") r := MaintenanceConfigurationResource{} @@ -265,3 +281,48 @@ resource "azurerm_maintenance_configuration" "test" { } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } + +func (MaintenanceConfigurationResource) basic_onePatchOnly(data acceptance.TestData, isLinux bool) string { + patch := `linux { + classifications_to_include = ["Critical", "Security"] + }` + if !isLinux { + patch = `windows { + classifications_to_include = ["Critical", "Security"] + }` + } + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-maint-%d" + location = "%s" +} + +resource "azurerm_maintenance_configuration" "test" { + name = "acctest-MC%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + scope = "InGuestPatch" + visibility = "Custom" + + window { + start_date_time = "5555-12-31 00:00" + expiration_date_time = "6666-12-31 00:00" + duration = "02:00" + time_zone = "Pacific Standard Time" + recur_every = "2Days" + } + + install_patches { + reboot = "IfRequired" + %s + } + + in_guest_user_patch_mode = "User" + +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, patch) +} diff --git a/internal/services/managedidentity/federated_identity_credential_resource.go b/internal/services/managedidentity/federated_identity_credential_resource.go index cb43ddeb2b9b..7fcd03fa372a 100644 --- a/internal/services/managedidentity/federated_identity_credential_resource.go +++ b/internal/services/managedidentity/federated_identity_credential_resource.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2022-01-31-preview/managedidentities" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -59,9 +60,11 @@ func (r FederatedIdentityCredentialResource) Arguments() map[string]*pluginsdk.S }, "resource_group_name": commonschema.ResourceGroupName(), "parent_id": { - ForceNew: true, - Required: true, - Type: pluginsdk.TypeString, + // TODO: this wants renaming to `user_assigned_identity_id` (and `resource_group_name` removing in 4.0) + Type: pluginsdk.TypeString, + ForceNew: true, + Required: true, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, "subject": { ForceNew: true, @@ -89,7 +92,11 @@ func (r FederatedIdentityCredentialResource) Create() sdk.ResourceFunc { if err != nil { return fmt.Errorf("parsing parent resource ID: %+v", err) } - id := managedidentities.NewFederatedIdentityCredentialID(subscriptionId, config.ResourceGroupName, parentId.ResourceName, config.Name) + + locks.ByID(parentId.ID()) + defer locks.UnlockByID(parentId.ID()) + + id := managedidentities.NewFederatedIdentityCredentialID(subscriptionId, config.ResourceGroupName, parentId.UserAssignedIdentityName, config.Name) existing, err := client.FederatedIdentityCredentialsGet(ctx, id) if err != nil { @@ -134,9 +141,9 @@ func (r FederatedIdentityCredentialResource) Read() sdk.ResourceFunc { } if model := resp.Model; model != nil { - schema.Name = id.FederatedIdentityCredentialResourceName + schema.Name = id.FederatedIdentityCredentialName schema.ResourceGroupName = id.ResourceGroupName - parentId := commonids.NewUserAssignedIdentityID(id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + parentId := commonids.NewUserAssignedIdentityID(id.SubscriptionId, id.ResourceGroupName, id.UserAssignedIdentityName) schema.ResourceName = parentId.ID() r.mapFederatedIdentityCredentialToFederatedIdentityCredentialResourceSchema(*model, &schema) } @@ -151,6 +158,19 @@ func (r FederatedIdentityCredentialResource) Delete() sdk.ResourceFunc { Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.ManagedIdentity.ManagedIdentities + var config FederatedIdentityCredentialResourceSchema + if err := metadata.Decode(&config); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + parentId, err := commonids.ParseUserAssignedIdentityID(config.ResourceName) + if err != nil { + return fmt.Errorf("parsing parent resource ID: %+v", err) + } + + locks.ByID(parentId.ID()) + defer locks.UnlockByID(parentId.ID()) + id, err := managedidentities.ParseFederatedIdentityCredentialID(metadata.ResourceData.Id()) if err != nil { return err diff --git a/internal/services/managedidentity/user_assigned_identity_resource_gen.go b/internal/services/managedidentity/user_assigned_identity_resource_gen.go index 76e68bf07e62..712d89406962 100644 --- a/internal/services/managedidentity/user_assigned_identity_resource_gen.go +++ b/internal/services/managedidentity/user_assigned_identity_resource_gen.go @@ -131,7 +131,7 @@ func (r UserAssignedIdentityResource) Read() sdk.ResourceFunc { } if model := resp.Model; model != nil { - schema.Name = id.ResourceName + schema.Name = id.UserAssignedIdentityName schema.ResourceGroupName = id.ResourceGroupName if err := r.mapIdentityToUserAssignedIdentityResourceSchema(*model, &schema); err != nil { return fmt.Errorf("flattening model: %+v", err) diff --git a/internal/services/media/client/client.go b/internal/services/media/client/client.go index dff1e03e73f7..625cb560a889 100644 --- a/internal/services/media/client/client.go +++ b/internal/services/media/client/client.go @@ -2,23 +2,17 @@ package client import ( "github.com/Azure/go-autorest/autorest" - mediaV20200501 "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01" mediaV20211101 "github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01" mediaV20220801 "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - V20200501Client *mediaV20200501.Client V20211101Client *mediaV20211101.Client V20220801Client *mediaV20220801.Client } func NewClient(o *common.ClientOptions) *Client { - V20200501Client := mediaV20200501.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) { - c.Authorizer = o.ResourceManagerAuthorizer - }) - V20211101Client := mediaV20211101.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) { c.Authorizer = o.ResourceManagerAuthorizer }) @@ -28,7 +22,6 @@ func NewClient(o *common.ClientOptions) *Client { }) return &Client{ - V20200501Client: &V20200501Client, V20211101Client: &V20211101Client, V20220801Client: &V20220801Client, } diff --git a/internal/services/media/media_asset_filter_resource.go b/internal/services/media/media_asset_filter_resource.go index 3583dba9cc7c..94e468ee9907 100644 --- a/internal/services/media/media_asset_filter_resource.go +++ b/internal/services/media/media_asset_filter_resource.go @@ -191,7 +191,7 @@ func resourceMediaAssetFilterCreateUpdate(d *pluginsdk.ResourceData, meta interf return err } - id := assetsandassetfilters.NewAssetFilterID(assetId.SubscriptionId, assetId.ResourceGroupName, assetId.AccountName, assetId.AssetName, d.Get("name").(string)) + id := assetsandassetfilters.NewAssetFilterID(assetId.SubscriptionId, assetId.ResourceGroupName, assetId.MediaServiceName, assetId.AssetName, d.Get("name").(string)) if d.IsNewResource() { existing, err := client.AssetFiltersGet(ctx, id) if err != nil { @@ -251,8 +251,8 @@ func resourceMediaAssetFilterRead(d *pluginsdk.ResourceData, meta interface{}) e return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.FilterName) - d.Set("asset_id", assetsandassetfilters.NewAssetID(id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.AssetName).ID()) + d.Set("name", id.AssetFilterName) + d.Set("asset_id", assetsandassetfilters.NewAssetID(id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.AssetName).ID()) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/media/media_asset_resource.go b/internal/services/media/media_asset_resource.go index 6be5d9846895..e51bcf0125fa 100644 --- a/internal/services/media/media_asset_resource.go +++ b/internal/services/media/media_asset_resource.go @@ -168,7 +168,7 @@ func resourceMediaAssetRead(d *pluginsdk.ResourceData, meta interface{}) error { } d.Set("name", id.AssetName) - d.Set("media_services_account_name", id.AccountName) + d.Set("media_services_account_name", id.MediaServiceName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/media/media_content_key_policy_resource.go b/internal/services/media/media_content_key_policy_resource.go index d93ef39b3e46..97b0fa9300bb 100644 --- a/internal/services/media/media_content_key_policy_resource.go +++ b/internal/services/media/media_content_key_policy_resource.go @@ -187,7 +187,13 @@ func resourceMediaContentKeyPolicy() *pluginsdk.Resource { "compressed_digital_audio_opl": { Type: pluginsdk.TypeInt, Optional: true, - ValidateFunc: validation.IntInSlice([]int{100, 150, 200}), + ValidateFunc: validation.IntInSlice([]int{100, 150, 200, 250, 300}), + }, + + "compressed_digital_video_opl": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntInSlice([]int{400, 500}), }, "digital_video_only_content_restriction": { @@ -195,6 +201,26 @@ func resourceMediaContentKeyPolicy() *pluginsdk.Resource { Optional: true, }, + "explicit_analog_television_output_restriction": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "best_effort_enforced": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + "control_bits": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(0, 3), + }, + }, + }, + }, + "first_play_expiration": { Type: pluginsdk.TypeString, Optional: true, @@ -220,7 +246,7 @@ func resourceMediaContentKeyPolicy() *pluginsdk.Resource { "uncompressed_digital_audio_opl": { Type: pluginsdk.TypeInt, Optional: true, - ValidateFunc: validation.IntInSlice([]int{100, 150, 250, 300}), + ValidateFunc: validation.IntInSlice([]int{100, 150, 200, 250, 300}), }, "uncompressed_digital_video_opl": { @@ -231,6 +257,7 @@ func resourceMediaContentKeyPolicy() *pluginsdk.Resource { }, }, }, + "relative_begin_date": { Type: pluginsdk.TypeString, Optional: true, @@ -242,9 +269,26 @@ func resourceMediaContentKeyPolicy() *pluginsdk.Resource { Optional: true, ValidateFunc: validation.IsRFC3339Time, }, + + "security_level": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(contentkeypolicies.SecurityLevelSLOneFiveZero), + string(contentkeypolicies.SecurityLevelSLTwoThousand), + string(contentkeypolicies.SecurityLevelSLThreeThousand), + }, false), + }, }, }, }, + + "playready_response_custom_data": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + // lintignore:XS003 "fairplay_configuration": { Type: pluginsdk.TypeList, @@ -315,6 +359,39 @@ func resourceMediaContentKeyPolicy() *pluginsdk.Resource { MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ + // lintignore:XS003 + "alternate_key": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "symmetric_token_key": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsBase64, + Sensitive: true, + }, + "rsa_token_key_exponent": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + Sensitive: true, + }, + "rsa_token_key_modulus": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + Sensitive: true, + }, + "x509_token_key_raw": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + Sensitive: true, + }, + }, + }, + }, "audience": { Type: pluginsdk.TypeString, Optional: true, @@ -384,6 +461,7 @@ func resourceMediaContentKeyPolicy() *pluginsdk.Resource { }, }, }, + "open_restriction_enabled": { Type: pluginsdk.TypeBool, Optional: true, @@ -460,7 +538,7 @@ func resourceMediaContentKeyPolicyRead(d *pluginsdk.ResourceData, meta interface } d.Set("name", id.ContentKeyPolicyName) - d.Set("media_services_account_name", id.AccountName) + d.Set("media_services_account_name", id.MediaServiceName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { @@ -536,6 +614,7 @@ func flattenPolicyOptions(input []contentkeypolicies.ContentKeyPolicyOption) ([] clearKeyConfigurationEnabled := false playReadyLicense := make([]interface{}, 0) + playReadyResponseCustomData := "" widevineTemplate := "" fairplayConfiguration := make([]interface{}, 0) @@ -553,6 +632,9 @@ func flattenPolicyOptions(input []contentkeypolicies.ContentKeyPolicyOption) ([] if v, ok := option.Configuration.(contentkeypolicies.ContentKeyPolicyPlayReadyConfiguration); ok { playReadyLicense = flattenPlayReadyLicenses(v.Licenses) + if v.ResponseCustomData != nil { + playReadyResponseCustomData = *v.ResponseCustomData + } } if v, ok := option.Configuration.(contentkeypolicies.ContentKeyPolicyWidevineConfiguration); ok { @@ -574,6 +656,7 @@ func flattenPolicyOptions(input []contentkeypolicies.ContentKeyPolicyOption) ([] "playready_configuration_license": playReadyLicense, "widevine_configuration_template": widevineTemplate, "fairplay_configuration": fairplayConfiguration, + "playready_response_custom_data": playReadyResponseCustomData, "open_restriction_enabled": openRestrictionEnabled, "token_restriction": tokenRestriction, }) @@ -629,6 +712,11 @@ func expandRestriction(option map[string]interface{}) (contentkeypolicies.Conten } contentKeyPolicyTokenRestriction.PrimaryVerificationKey = primaryVerificationKey + alternateVerificationKeys, err := expandAlternateVerificationKeys(tokenRestriction["alternate_key"].([]interface{})) + if err != nil { + return nil, err + } + contentKeyPolicyTokenRestriction.AlternateVerificationKeys = alternateVerificationKeys return contentKeyPolicyTokenRestriction, nil } @@ -670,6 +758,7 @@ func flattenTokenRestriction(input contentkeypolicies.ContentKeyPolicyTokenRestr return []interface{}{ map[string]interface{}{ + "alternate_key": flattenAlternateVerificationKeys(input.AlternateVerificationKeys), "audience": input.Audience, "issuer": input.Issuer, "token_type": string(input.RestrictionTokenType), @@ -688,6 +777,7 @@ func expandConfiguration(input map[string]interface{}) (contentkeypolicies.Conte fairPlayConfigurations := input["fairplay_configuration"].([]interface{}) playReadyConfigurationLicences := input["playready_configuration_license"].([]interface{}) widevineConfigurationTemplate := input["widevine_configuration_template"].(string) + playReadyResponseCustomData := input["playready_response_custom_data"].(string) configurationCount := 0 if clearKeyConfigurationEnabled { @@ -728,6 +818,9 @@ func expandConfiguration(input map[string]interface{}) (contentkeypolicies.Conte playReadyConfiguration := &contentkeypolicies.ContentKeyPolicyPlayReadyConfiguration{ Licenses: *licenses, } + if playReadyResponseCustomData != "" { + playReadyConfiguration.ResponseCustomData = utils.String(playReadyResponseCustomData) + } return playReadyConfiguration, nil } if widevineConfigurationTemplate != "" { @@ -783,6 +876,90 @@ func expandVerificationKey(input map[string]interface{}) (contentkeypolicies.Con return nil, nil } +func expandAlternateVerificationKeys(input []interface{}) (*[]contentkeypolicies.ContentKeyPolicyRestrictionTokenKey, error) { + if len(input) == 0 || input[0] == nil { + return nil, nil + } + + result := make([]contentkeypolicies.ContentKeyPolicyRestrictionTokenKey, 0) + for _, v := range input { + tokenKeyRaw := v.(map[string]interface{}) + symmetricTokenKey := tokenKeyRaw["symmetric_token_key"].(string) + rsaTokenKeyExponent := tokenKeyRaw["rsa_token_key_exponent"].(string) + rsaTokenKeyModulus := tokenKeyRaw["rsa_token_key_modulus"].(string) + x509TokenKeyRaw := tokenKeyRaw["x509_token_key_raw"].(string) + + verificationKeyCount := 0 + if rsaTokenKeyExponent != "" || rsaTokenKeyModulus != "" { + verificationKeyCount++ + } + if symmetricTokenKey != "" { + verificationKeyCount++ + } + if x509TokenKeyRaw != "" { + verificationKeyCount++ + } + if verificationKeyCount != 1 { + return nil, fmt.Errorf("exactlly one type of token key must be set in the alternate verificaton keys") + } + + if rsaTokenKeyExponent != "" || rsaTokenKeyModulus != "" { + result = append(result, &contentkeypolicies.ContentKeyPolicyRsaTokenKey{ + Exponent: rsaTokenKeyExponent, + Modulus: rsaTokenKeyModulus, + }) + } + if symmetricTokenKey != "" { + result = append(result, &contentkeypolicies.ContentKeyPolicySymmetricTokenKey{ + KeyValue: symmetricTokenKey, + }) + } + if x509TokenKeyRaw != "" { + result = append(result, &contentkeypolicies.ContentKeyPolicyX509CertificateTokenKey{ + RawBody: symmetricTokenKey, + }) + } + } + + return &result, nil +} + +func flattenAlternateVerificationKeys(input *[]contentkeypolicies.ContentKeyPolicyRestrictionTokenKey) []interface{} { + if input == nil { + return make([]interface{}, 0) + } + + result := make([]interface{}, 0) + for _, v := range *input { + symmetricToken := "" + rsaTokenKeyExponent := "" + rsaTokenKeyModulus := "" + x509TokenBodyRaw := "" + symmetricTokenKey, ok := v.(contentkeypolicies.ContentKeyPolicySymmetricTokenKey) + if ok { + symmetricToken = symmetricTokenKey.KeyValue + } + + rsaTokenKey, ok := v.(contentkeypolicies.ContentKeyPolicyRsaTokenKey) + if ok { + rsaTokenKeyExponent = rsaTokenKey.Exponent + rsaTokenKeyModulus = rsaTokenKey.Modulus + } + + x509CertificateTokenKey, ok := v.(contentkeypolicies.ContentKeyPolicyX509CertificateTokenKey) + if ok { + x509TokenBodyRaw = x509CertificateTokenKey.RawBody + } + result = append(result, map[string]interface{}{ + "symmetric_token_key": symmetricToken, + "x509_token_key_raw": x509TokenBodyRaw, + "rsa_token_key_exponent": rsaTokenKeyExponent, + "rsa_token_key_modulus": rsaTokenKeyModulus, + }) + } + return result +} + func expandRequiredClaims(input []interface{}) *[]contentkeypolicies.ContentKeyPolicyTokenClaim { results := make([]contentkeypolicies.ContentKeyPolicyTokenClaim, 0) @@ -996,6 +1173,11 @@ func expandPlayReadyLicenses(input []interface{}) (*[]contentkeypolicies.Content playReadyLicense.RelativeExpirationDate = utils.String(v.(string)) } + if v := license["security_level"]; v != nil && v != "" { + securityLevel := contentkeypolicies.SecurityLevel(v.(string)) + playReadyLicense.SecurityLevel = &securityLevel + } + results = append(results, playReadyLicense) } @@ -1046,6 +1228,11 @@ func flattenPlayReadyLicenses(input []contentkeypolicies.ContentKeyPolicyPlayRea relativeExpirationDate = *v.RelativeExpirationDate } + securityLevel := "" + if v.SecurityLevel != nil { + securityLevel = string(*v.SecurityLevel) + } + results = append(results, map[string]interface{}{ "allow_test_devices": v.AllowTestDevices, "begin_date": beginDate, @@ -1058,6 +1245,7 @@ func flattenPlayReadyLicenses(input []contentkeypolicies.ContentKeyPolicyPlayRea "relative_begin_date": relativeBeginDate, "relative_expiration_date": relativeExpirationDate, "play_right": playRight, + "security_level": securityLevel, }) } @@ -1069,8 +1257,10 @@ func expandPlayRight(input []interface{}) *contentkeypolicies.ContentKeyPolicyPl return nil } - playRight := &contentkeypolicies.ContentKeyPolicyPlayReadyPlayRight{} playRightConfiguration := input[0].(map[string]interface{}) + playRight := &contentkeypolicies.ContentKeyPolicyPlayReadyPlayRight{ + ExplicitAnalogTelevisionOutputRestriction: expandExplicitAnalogTelevisionOutputRestriction(playRightConfiguration["explicit_analog_television_output_restriction"].([]interface{})), + } if v := playRightConfiguration["agc_and_color_stripe_restriction"]; v != nil { playRight.AgcAndColorStripeRestriction = utils.Int64(int64(v.(int))) @@ -1088,6 +1278,10 @@ func expandPlayRight(input []interface{}) *contentkeypolicies.ContentKeyPolicyPl playRight.CompressedDigitalAudioOpl = utils.Int64(int64(v.(int))) } + if v := playRightConfiguration["compressed_digital_video_opl"]; v != nil && v != 0 { + playRight.CompressedDigitalVideoOpl = utils.Int64(int64(v.(int))) + } + if v := playRightConfiguration["digital_video_only_content_restriction"]; v != nil { playRight.DigitalVideoOnlyContentRestriction = v.(bool) } @@ -1130,10 +1324,15 @@ func flattenPlayRight(input *contentkeypolicies.ContentKeyPolicyPlayReadyPlayRig } compressedDigitalAudioOpl := 0 - if input.AnalogVideoOpl != nil { + if input.CompressedDigitalAudioOpl != nil { compressedDigitalAudioOpl = int(*input.CompressedDigitalAudioOpl) } + compressedDigitalVideoOpl := 0 + if input.CompressedDigitalVideoOpl != nil { + compressedDigitalVideoOpl = int(*input.CompressedDigitalVideoOpl) + } + firstPlayExpiration := "" if input.FirstPlayExpiration != nil { firstPlayExpiration = *input.FirstPlayExpiration @@ -1160,7 +1359,9 @@ func flattenPlayRight(input *contentkeypolicies.ContentKeyPolicyPlayReadyPlayRig "allow_passing_video_content_to_unknown_output": string(input.AllowPassingVideoContentToUnknownOutput), "analog_video_opl": analogVideoOpl, "compressed_digital_audio_opl": compressedDigitalAudioOpl, + "compressed_digital_video_opl": compressedDigitalVideoOpl, "digital_video_only_content_restriction": input.DigitalVideoOnlyContentRestriction, + "explicit_analog_television_output_restriction": flattenExplicitAnalogTelevisionOutputRestriction(input.ExplicitAnalogTelevisionOutputRestriction), "first_play_expiration": firstPlayExpiration, "image_constraint_for_analog_component_video_restriction": input.ImageConstraintForAnalogComponentVideoRestriction, "image_constraint_for_analog_computer_monitor_restriction": input.ImageConstraintForAnalogComputerMonitorRestriction, @@ -1170,3 +1371,30 @@ func flattenPlayRight(input *contentkeypolicies.ContentKeyPolicyPlayReadyPlayRig }, } } + +func expandExplicitAnalogTelevisionOutputRestriction(input []interface{}) *contentkeypolicies.ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction { + if len(input) == 0 || input[0] == nil { + return nil + } + + restriction := input[0].(map[string]interface{}) + result := &contentkeypolicies.ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction{ + BestEffort: restriction["best_effort_enforced"].(bool), + ConfigurationData: int64(restriction["control_bits"].(int)), + } + + return result +} + +func flattenExplicitAnalogTelevisionOutputRestriction(input *contentkeypolicies.ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction) []interface{} { + if input == nil { + return make([]interface{}, 0) + } + + return []interface{}{ + map[string]interface{}{ + "best_effort_enforced": input.BestEffort, + "control_bits": input.ConfigurationData, + }, + } +} diff --git a/internal/services/media/media_content_key_policy_resource_test.go b/internal/services/media/media_content_key_policy_resource_test.go index ef55beb60c72..25ddad09c7cd 100644 --- a/internal/services/media/media_content_key_policy_resource_test.go +++ b/internal/services/media/media_content_key_policy_resource_test.go @@ -31,6 +31,35 @@ func TestAccMediaContentKeyPolicy_basic(t *testing.T) { }) } +func TestAccMediaContentKeyPolicy_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_media_content_key_policy", "test") + r := MediaContentKeyPolicyResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeAggregateTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.complete(data), + Check: acceptance.ComposeAggregateTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.basic(data), + Check: acceptance.ComposeAggregateTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func TestAccMediaContentKeyPolicy_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_media_content_key_policy", "test") r := MediaContentKeyPolicyResource{} @@ -146,10 +175,12 @@ resource "azurerm_media_content_key_policy" "test" { open_restriction_enabled = true } policy_option { - name = "playReady" + name = "playReady" + playready_response_custom_data = "test custom data" playready_configuration_license { allow_test_devices = true begin_date = "2017-10-16T18:22:53Z" + security_level = "SL150" play_right { scms_restriction = 2 digital_video_only_content_restriction = false @@ -157,9 +188,14 @@ resource "azurerm_media_content_key_policy" "test" { image_constraint_for_analog_computer_monitor_restriction = false allow_passing_video_content_to_unknown_output = "NotAllowed" uncompressed_digital_video_opl = 100 - uncompressed_digital_audio_opl = 100 + uncompressed_digital_audio_opl = 200 analog_video_opl = 150 - compressed_digital_audio_opl = 150 + compressed_digital_audio_opl = 250 + compressed_digital_video_opl = 400 + explicit_analog_television_output_restriction { + best_effort_enforced = true + control_bits = 3 + } } license_type = "Persistent" content_type = "UltraVioletDownload" @@ -175,6 +211,13 @@ resource "azurerm_media_content_key_policy" "test" { audience = "urn:audience" token_type = "Swt" primary_symmetric_token_key = "AAAAAAAAAAAAAAAAAAAAAA==" + alternate_key { + rsa_token_key_exponent = "AQAB" + rsa_token_key_modulus = "AQAD" + } + alternate_key { + symmetric_token_key = "BBAAAAAAAAAAAAAAAAAAAA==" + } } } policy_option { diff --git a/internal/services/media/media_job_resource.go b/internal/services/media/media_job_resource.go index e6c8f6f35bc3..4cb684a9ea37 100644 --- a/internal/services/media/media_job_resource.go +++ b/internal/services/media/media_job_resource.go @@ -222,7 +222,7 @@ func resourceMediaJobRead(d *pluginsdk.ResourceData, meta interface{}) error { d.Set("name", id.JobName) d.Set("transform_name", id.TransformName) - d.Set("media_services_account_name", id.AccountName) + d.Set("media_services_account_name", id.MediaServiceName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/media/media_live_output_resource.go b/internal/services/media/media_live_output_resource.go index 1e39780aaac6..d15960c59b0e 100644 --- a/internal/services/media/media_live_output_resource.go +++ b/internal/services/media/media_live_output_resource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents" "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/media/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -60,7 +61,7 @@ func resourceMediaLiveOutput() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, + ValidateFunc: validate.ISO8601DurationBetween("PT1M", "PT25H"), }, "asset_name": { @@ -101,6 +102,13 @@ func resourceMediaLiveOutput() *pluginsdk.Resource { ForceNew: true, ValidateFunc: validation.IntAtLeast(0), }, + + "rewind_window_duration": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validate.ISO8601DurationBetween("PT1M", "PT25H"), + }, }, } } @@ -114,7 +122,7 @@ func resourceMediaLiveOutputCreate(d *pluginsdk.ResourceData, meta interface{}) if err != nil { return err } - id := liveoutputs.NewLiveOutputID(eventId.SubscriptionId, eventId.ResourceGroupName, eventId.AccountName, eventId.LiveEventName, d.Get("name").(string)) + id := liveoutputs.NewLiveOutputID(eventId.SubscriptionId, eventId.ResourceGroupName, eventId.MediaServiceName, eventId.LiveEventName, d.Get("name").(string)) if d.IsNewResource() { existing, err := client.Get(ctx, id) if err != nil { @@ -158,6 +166,10 @@ func resourceMediaLiveOutputCreate(d *pluginsdk.ResourceData, meta interface{}) parameters.Properties.OutputSnapTime = utils.Int64(int64(outputSnapTime.(int))) } + if rewindWindowLength, ok := d.GetOk("rewind_window_duration"); ok { + parameters.Properties.RewindWindowLength = utils.String(rewindWindowLength.(string)) + } + if err := client.CreateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -189,7 +201,7 @@ func resourceMediaLiveOutputRead(d *pluginsdk.ResourceData, meta interface{}) er } d.Set("name", id.LiveOutputName) - d.Set("live_event_id", liveevents.NewLiveEventID(id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.LiveEventName).ID()) + d.Set("live_event_id", liveevents.NewLiveEventID(id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.LiveEventName).ID()) if model := resp.Model; model != nil { if props := model.Properties; props != nil { @@ -209,6 +221,7 @@ func resourceMediaLiveOutputRead(d *pluginsdk.ResourceData, meta interface{}) er outputSnapTime = *props.OutputSnapTime } d.Set("output_snap_time_in_seconds", outputSnapTime) + d.Set("rewind_window_duration", props.RewindWindowLength) } } diff --git a/internal/services/media/media_live_output_resource_test.go b/internal/services/media/media_live_output_resource_test.go index 58dd29043a73..0d67c49bc5be 100644 --- a/internal/services/media/media_live_output_resource_test.go +++ b/internal/services/media/media_live_output_resource_test.go @@ -144,6 +144,7 @@ resource "azurerm_media_live_event_output" "test" { manifest_name = "testmanifest" output_snap_time_in_seconds = 0 hls_fragments_per_ts_segment = 5 + rewind_window_duration = "PT5M" } `, r.template(data)) } diff --git a/internal/services/media/media_service_account_filter_resource.go b/internal/services/media/media_service_account_filter_resource.go index e5e673e5050f..742f7aaa7a58 100644 --- a/internal/services/media/media_service_account_filter_resource.go +++ b/internal/services/media/media_service_account_filter_resource.go @@ -269,9 +269,9 @@ func (r AccountFilterResource) Read() sdk.ResourceFunc { } return metadata.Encode(&AccountFilterModel{ - Name: id.FilterName, + Name: id.AccountFilterName, ResourceGroupName: id.ResourceGroupName, - MediaServicesAccountName: id.AccountName, + MediaServicesAccountName: id.MediaServiceName, FirstQualityBitrate: firstQualityBitrate, PresentationTimeRange: flattenAccountFilterPresentationTimeRange(prop.PresentationTimeRange), TrackSelection: flattenAccountFilterTracks(prop.Tracks), diff --git a/internal/services/media/media_services_account_resource.go b/internal/services/media/media_services_account_resource.go index 768457a85e84..00ebeee11179 100644 --- a/internal/services/media/media_services_account_resource.go +++ b/internal/services/media/media_services_account_resource.go @@ -261,7 +261,7 @@ func resourceMediaServicesAccountRead(d *pluginsdk.ResourceData, meta interface{ return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.AccountName) + d.Set("name", id.MediaServiceName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/media/media_streaming_endpoint_resource.go b/internal/services/media/media_streaming_endpoint_resource.go index 59f69ec58bed..17fdee505c98 100644 --- a/internal/services/media/media_streaming_endpoint_resource.go +++ b/internal/services/media/media_streaming_endpoint_resource.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints" + "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/media/migration" @@ -219,7 +219,7 @@ func resourceMediaStreamingEndpoint() *pluginsdk.Resource { func resourceMediaStreamingEndpointCreate(d *pluginsdk.ResourceData, meta interface{}) error { subscriptionId := meta.(*clients.Client).Account.SubscriptionId - client := meta.(*clients.Client).Media.V20200501Client.StreamingEndpoints + client := meta.(*clients.Client).Media.V20220801Client.StreamingEndpoints ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -294,7 +294,7 @@ func resourceMediaStreamingEndpointCreate(d *pluginsdk.ResourceData, meta interf } func resourceMediaStreamingEndpointUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Media.V20200501Client.StreamingEndpoints + client := meta.(*clients.Client).Media.V20220801Client.StreamingEndpoints ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -367,7 +367,7 @@ func resourceMediaStreamingEndpointUpdate(d *pluginsdk.ResourceData, meta interf } func resourceMediaStreamingEndpointRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Media.V20200501Client.StreamingEndpoints + client := meta.(*clients.Client).Media.V20220801Client.StreamingEndpoints ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -388,7 +388,7 @@ func resourceMediaStreamingEndpointRead(d *pluginsdk.ResourceData, meta interfac } d.Set("name", id.StreamingEndpointName) - d.Set("media_services_account_name", id.AccountName) + d.Set("media_services_account_name", id.MediaServiceName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { @@ -429,7 +429,7 @@ func resourceMediaStreamingEndpointRead(d *pluginsdk.ResourceData, meta interfac } func resourceMediaStreamingEndpointDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Media.V20200501Client.StreamingEndpoints + client := meta.(*clients.Client).Media.V20220801Client.StreamingEndpoints ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() diff --git a/internal/services/media/media_streaming_endpoint_resource_test.go b/internal/services/media/media_streaming_endpoint_resource_test.go index e135d8b63df3..295a59311b9e 100644 --- a/internal/services/media/media_streaming_endpoint_resource_test.go +++ b/internal/services/media/media_streaming_endpoint_resource_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints" + "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -97,7 +97,7 @@ func (r MediaStreamingEndpointResource) Start(ctx context.Context, client *clien return err } - if err := client.Media.V20200501Client.StreamingEndpoints.StartThenPoll(ctx, *id); err != nil { + if err := client.Media.V20220801Client.StreamingEndpoints.StartThenPoll(ctx, *id); err != nil { return fmt.Errorf("starting %s: %+v", id, err) } @@ -110,7 +110,7 @@ func (MediaStreamingEndpointResource) Exists(ctx context.Context, clients *clien return nil, err } - resp, err := clients.Media.V20200501Client.StreamingEndpoints.Get(ctx, *id) + resp, err := clients.Media.V20220801Client.StreamingEndpoints.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", id.String(), err) } diff --git a/internal/services/media/media_streaming_live_event_resource.go b/internal/services/media/media_streaming_live_event_resource.go index 0922b6eb4599..2017f709d53b 100644 --- a/internal/services/media/media_streaming_live_event_resource.go +++ b/internal/services/media/media_streaming_live_event_resource.go @@ -23,9 +23,9 @@ import ( func resourceMediaLiveEvent() *pluginsdk.Resource { return &pluginsdk.Resource{ - Create: resourceMediaLiveEventCreateUpdate, + Create: resourceMediaLiveEventCreate, Read: resourceMediaLiveEventRead, - Update: resourceMediaLiveEventCreateUpdate, + Update: resourceMediaLiveEventUpdate, Delete: resourceMediaLiveEventDelete, Timeouts: &pluginsdk.ResourceTimeout{ @@ -203,6 +203,8 @@ func resourceMediaLiveEvent() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ string(liveevents.LiveEventEncodingTypeNone), string(liveevents.LiveEventEncodingTypePremiumOneZeroEightZerop), + string(liveevents.LiveEventEncodingTypePassthroughBasic), + string(liveevents.LiveEventEncodingTypePassthroughStandard), string(liveevents.LiveEventEncodingTypeStandard), }, false), Default: string(liveevents.LiveEventEncodingTypeNone), @@ -332,6 +334,16 @@ func resourceMediaLiveEvent() *pluginsdk.Resource { }, }, + "stream_options": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice(liveevents.PossibleValuesForStreamOptionsFlag(), false), + }, + }, + "transcription_languages": { Type: pluginsdk.TypeList, Optional: true, @@ -352,26 +364,24 @@ func resourceMediaLiveEvent() *pluginsdk.Resource { } } -func resourceMediaLiveEventCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { +func resourceMediaLiveEventCreate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Media.V20220801Client.LiveEvents subscriptionID := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() id := liveevents.NewLiveEventID(subscriptionID, d.Get("resource_group_name").(string), d.Get("media_services_account_name").(string), d.Get("name").(string)) - if d.IsNewResource() { - existing, err := client.Get(ctx, id) - if err != nil { - if !response.WasNotFound(existing.HttpResponse) { - return fmt.Errorf("checking for presence of existing %s: %+v", id, err) - } - } - + existing, err := client.Get(ctx, id) + if err != nil { if !response.WasNotFound(existing.HttpResponse) { - return tf.ImportAsExistsError("azurerm_media_live_event", id.ID()) + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_media_live_event", id.ID()) + } + t := d.Get("tags").(map[string]interface{}) payload := liveevents.LiveEvent{ @@ -409,6 +419,10 @@ func resourceMediaLiveEventCreateUpdate(d *pluginsdk.ResourceData, meta interfac payload.Properties.Preview = expandPreview(preview.([]interface{})) } + if streamOptions, ok := d.GetOk("stream_options"); ok { + payload.Properties.StreamOptions = expandStreamOptions(streamOptions.([]interface{})) + } + if transcriptionLanguages, ok := d.GetOk("transcription_languages"); ok { payload.Properties.Transcriptions = expandTranscriptions(transcriptionLanguages.([]interface{})) } @@ -417,18 +431,11 @@ func resourceMediaLiveEventCreateUpdate(d *pluginsdk.ResourceData, meta interfac payload.Properties.UseStaticHostname = utils.Bool(useStaticHostName.(bool)) } - if d.IsNewResource() { - options := liveevents.CreateOperationOptions{ - AutoStart: autoStart, - } - if err := client.CreateThenPoll(ctx, id, payload, options); err != nil { - return fmt.Errorf("creating %s: %+v", id, err) - } - } else { - // TODO: split this into a separate update method - if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - return fmt.Errorf("updating %s: %+v", id, err) - } + options := liveevents.CreateOperationOptions{ + AutoStart: autoStart, + } + if err := client.CreateThenPoll(ctx, id, payload, options); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } d.SetId(id.ID()) @@ -436,6 +443,65 @@ func resourceMediaLiveEventCreateUpdate(d *pluginsdk.ResourceData, meta interfac return resourceMediaLiveEventRead(d, meta) } +func resourceMediaLiveEventUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Media.V20220801Client.LiveEvents + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := liveevents.ParseLiveEventID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if resp.Model == nil || resp.Model.Properties == nil { + return fmt.Errorf("unexpected null model of %s", id) + } + existing := resp.Model + + if d.HasChange("input") { + existing.Properties.Input = expandLiveEventInput(d.Get("input").([]interface{})) + } + + if d.HasChange("cross_site_access_policy") { + existing.Properties.CrossSiteAccessPolicies = expandLiveEventCrossSiteAccessPolicies(d.Get("cross_site_access_policy").([]interface{})) + } + + if d.HasChange("description") { + existing.Properties.Description = utils.String(d.Get("description").(string)) + } + + if d.HasChange("encoding") { + existing.Properties.Encoding = expandEncoding(d.Get("encoding").([]interface{})) + } + + if d.HasChange("hostname_prefix") { + existing.Properties.HostnamePrefix = utils.String(d.Get("hostname_prefix").(string)) + } + + if d.HasChange("preview") { + existing.Properties.Preview = expandPreview(d.Get("preview").([]interface{})) + } + + if d.HasChange("transcription_languages") { + existing.Properties.Transcriptions = expandTranscriptions(d.Get("transcription_languages").([]interface{})) + } + + if d.HasChange("tags") { + existing.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) + } + + if err := client.UpdateThenPoll(ctx, *id, *existing); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + return resourceMediaLiveEventRead(d, meta) +} + func resourceMediaLiveEventRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Media.V20220801Client.LiveEvents ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) @@ -458,7 +524,7 @@ func resourceMediaLiveEventRead(d *pluginsdk.ResourceData, meta interface{}) err } d.Set("name", id.LiveEventName) - d.Set("media_services_account_name", id.AccountName) + d.Set("media_services_account_name", id.MediaServiceName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { @@ -488,6 +554,11 @@ func resourceMediaLiveEventRead(d *pluginsdk.ResourceData, meta interface{}) err return fmt.Errorf("flattening `preview`: %s", err) } + streamOptions := flattenStreamOptions(props.StreamOptions) + if err := d.Set("stream_options", streamOptions); err != nil { + return fmt.Errorf("flattening `stream_options`: %s", err) + } + transcriptions := flattenTranscriptions(props.Transcriptions) if err := d.Set("transcription_languages", transcriptions); err != nil { return fmt.Errorf("flattening `transcription_languages`: %s", err) @@ -688,6 +759,15 @@ func expandLiveEventCrossSiteAccessPolicies(input []interface{}) *liveevents.Cro CrossDomainPolicy: &crossDomainPolicy, } } + +func expandStreamOptions(input []interface{}) *[]liveevents.StreamOptionsFlag { + streamOptions := make([]liveevents.StreamOptionsFlag, 0) + for _, v := range input { + streamOptions = append(streamOptions, liveevents.StreamOptionsFlag(v.(string))) + } + return &streamOptions +} + func expandTranscriptions(input []interface{}) *[]liveevents.LiveEventTranscription { transcriptions := make([]liveevents.LiveEventTranscription, 0) for _, v := range input { @@ -888,6 +968,19 @@ func flattenLiveEventCrossSiteAccessPolicies(input *liveevents.CrossSiteAccessPo } } +func flattenStreamOptions(input *[]liveevents.StreamOptionsFlag) []interface{} { + if input == nil { + return make([]interface{}, 0) + } + + streamOptions := make([]interface{}, 0) + for _, v := range *input { + streamOptions = append(streamOptions, string(v)) + } + + return streamOptions +} + func flattenTranscriptions(input *[]liveevents.LiveEventTranscription) []string { if input == nil { return make([]string, 0) diff --git a/internal/services/media/media_streaming_live_event_resource_test.go b/internal/services/media/media_streaming_live_event_resource_test.go index eaa357e4a412..acd533c85cf8 100644 --- a/internal/services/media/media_streaming_live_event_resource_test.go +++ b/internal/services/media/media_streaming_live_event_resource_test.go @@ -45,6 +45,27 @@ func TestAccLiveEvent_requiresImport(t *testing.T) { }) } +func TestAccLiveEvent_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_media_live_event", "test") + r := LiveEventResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeAggregateTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeAggregateTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + }) +} + func TestAccLiveEvent_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_media_live_event", "test") r := LiveEventResource{} @@ -121,6 +142,53 @@ resource "azurerm_media_live_event" "import" { `, r.basic(data)) } +func (r LiveEventResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_media_live_event" "test" { + name = "Event-1" + resource_group_name = azurerm_resource_group.test.name + media_services_account_name = azurerm_media_services_account.test.name + location = azurerm_resource_group.test.location + description = "Updated Description" + + input { + streaming_protocol = "RTMP" + ip_access_control_allow { + name = "Test" + address = "0.0.0.0" + subnet_prefix_length = 4 + } + } + + encoding { + type = "Standard" + preset_name = "Default720p" + stretch_mode = "AutoSize" + key_frame_interval = "PT2S" + } + + preview { + ip_access_control_allow { + name = "Allow" + address = "0.0.0.0" + subnet_prefix_length = 4 + } + } + + use_static_hostname = true + hostname_prefix = "special-event-update" + stream_options = ["LowLatency"] + transcription_languages = ["en-GB"] + + tags = { + env = "test" + } +} +`, r.template(data)) +} + func (r LiveEventResource) complete(data acceptance.TestData) string { return fmt.Sprintf(` %s @@ -158,6 +226,7 @@ resource "azurerm_media_live_event" "test" { use_static_hostname = true hostname_prefix = "special-event" + stream_options = ["LowLatency"] transcription_languages = ["en-US"] } `, r.template(data)) diff --git a/internal/services/media/media_streaming_locator_resource.go b/internal/services/media/media_streaming_locator_resource.go index 10d245fb6f9a..c331710a6617 100644 --- a/internal/services/media/media_streaming_locator_resource.go +++ b/internal/services/media/media_streaming_locator_resource.go @@ -151,6 +151,16 @@ func resourceMediaStreamingLocator() *pluginsdk.Resource { ValidateFunc: validation.IsRFC3339Time, }, + "filter_names": { + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + "start_time": { Type: pluginsdk.TypeString, Optional: true, @@ -218,6 +228,10 @@ func resourceMediaStreamingLocatorCreate(d *pluginsdk.ResourceData, meta interfa } } + if filters, ok := d.GetOk("filter_names"); ok { + payload.Properties.Filters = utils.ExpandStringSlice(filters.([]interface{})) + } + if startTimeRaw, ok := d.GetOk("start_time"); ok { if startTimeRaw.(string) != "" { startTime, err := date.ParseTime(time.RFC3339, startTimeRaw.(string)) @@ -263,7 +277,7 @@ func resourceMediaStreamingLocatorRead(d *pluginsdk.ResourceData, meta interface } d.Set("name", id.StreamingLocatorName) - d.Set("media_services_account_name", id.AccountName) + d.Set("media_services_account_name", id.MediaServiceName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { @@ -287,6 +301,7 @@ func resourceMediaStreamingLocatorRead(d *pluginsdk.ResourceData, meta interface endTime = t.Format(time.RFC3339) } d.Set("end_time", endTime) + d.Set("filter_names", utils.FlattenStringSlice(props.Filters)) startTime := "" if props.StartTime != nil { diff --git a/internal/services/media/media_streaming_locator_resource_test.go b/internal/services/media/media_streaming_locator_resource_test.go index d8fce68395e0..bd60b443fa29 100644 --- a/internal/services/media/media_streaming_locator_resource_test.go +++ b/internal/services/media/media_streaming_locator_resource_test.go @@ -141,6 +141,12 @@ func (r StreamingLocatorResource) complete(data acceptance.TestData) string { return fmt.Sprintf(` %s +resource "azurerm_media_services_account_filter" "test" { + name = "Filter-1" + resource_group_name = azurerm_resource_group.test.name + media_services_account_name = azurerm_media_services_account.test.name +} + resource "azurerm_media_streaming_locator" "test" { name = "Job-1" resource_group_name = azurerm_resource_group.test.name @@ -151,6 +157,7 @@ resource "azurerm_media_streaming_locator" "test" { end_time = "2028-12-31T23:59:59Z" streaming_locator_id = "90000000-0000-0000-0000-000000000000" alternative_media_id = "my-Alternate-MediaID" + filter_names = [azurerm_media_services_account_filter.test.name] } `, r.template(data)) } diff --git a/internal/services/media/media_streaming_policy_resource.go b/internal/services/media/media_streaming_policy_resource.go index aa34c685b753..330a0a4e727c 100644 --- a/internal/services/media/media_streaming_policy_resource.go +++ b/internal/services/media/media_streaming_policy_resource.go @@ -230,7 +230,7 @@ func resourceMediaStreamingPolicyRead(d *pluginsdk.ResourceData, meta interface{ } d.Set("name", id.StreamingPolicyName) - d.Set("media_services_account_name", id.AccountName) + d.Set("media_services_account_name", id.MediaServiceName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/media/media_transform_resource.go b/internal/services/media/media_transform_resource.go index a43f0ba474c9..d9598c08a52d 100644 --- a/internal/services/media/media_transform_resource.go +++ b/internal/services/media/media_transform_resource.go @@ -269,7 +269,7 @@ func resourceMediaTransformRead(d *pluginsdk.ResourceData, meta interface{}) err } d.Set("name", id.TransformName) - d.Set("media_services_account_name", id.AccountName) + d.Set("media_services_account_name", id.MediaServiceName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/mixedreality/spatial_anchors_account_data_source.go b/internal/services/mixedreality/spatial_anchors_account_data_source.go index 7d70e175a1b5..0ca75602cf9f 100644 --- a/internal/services/mixedreality/spatial_anchors_account_data_source.go +++ b/internal/services/mixedreality/spatial_anchors_account_data_source.go @@ -71,7 +71,7 @@ func dataSourceSpatialAnchorsAccountRead(d *pluginsdk.ResourceData, meta interfa d.SetId(id.ID()) - d.Set("name", id.AccountName) + d.Set("name", id.SpatialAnchorsAccountName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/mixedreality/spatial_anchors_account_resource.go b/internal/services/mixedreality/spatial_anchors_account_resource.go index 2a39dfb18c54..4f774f659775 100644 --- a/internal/services/mixedreality/spatial_anchors_account_resource.go +++ b/internal/services/mixedreality/spatial_anchors_account_resource.go @@ -116,7 +116,7 @@ func resourceSpatialAnchorsAccountRead(d *pluginsdk.ResourceData, meta interface return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.AccountName) + d.Set("name", id.SpatialAnchorsAccountName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/mobilenetwork/client/client.go b/internal/services/mobilenetwork/client/client.go new file mode 100644 index 000000000000..d6c289cfc34d --- /dev/null +++ b/internal/services/mobilenetwork/client/client.go @@ -0,0 +1,43 @@ +package client + +import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +type Client struct { + MobileNetworkClient *mobilenetwork.MobileNetworkClient + ServiceClient *service.ServiceClient + SIMGroupClient *simgroup.SIMGroupClient + SliceClient *slice.SliceClient + SiteClient *site.SiteClient +} + +func NewClient(o *common.ClientOptions) *Client { + mobileNetworkClient := mobilenetwork.NewMobileNetworkClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&mobileNetworkClient.Client, o.ResourceManagerAuthorizer) + + serviceClient := service.NewServiceClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&serviceClient.Client, o.ResourceManagerAuthorizer) + + simGroupClient := simgroup.NewSIMGroupClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&simGroupClient.Client, o.ResourceManagerAuthorizer) + + siteClient := site.NewSiteClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&siteClient.Client, o.ResourceManagerAuthorizer) + + sliceClient := slice.NewSliceClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&sliceClient.Client, o.ResourceManagerAuthorizer) + + return &Client{ + MobileNetworkClient: &mobileNetworkClient, + ServiceClient: &serviceClient, + SIMGroupClient: &simGroupClient, + SiteClient: &siteClient, + SliceClient: &sliceClient, + } +} diff --git a/internal/services/mobilenetwork/helpers.go b/internal/services/mobilenetwork/helpers.go new file mode 100644 index 000000000000..ac0fd62c6349 --- /dev/null +++ b/internal/services/mobilenetwork/helpers.go @@ -0,0 +1,83 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "net/http" + "strconv" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +// a workaround for that some child resources may still exist for seconds before it fully deleted. +// it will cause the error "Can not delete resource before nested resources are deleted." +func resourceMobileNetworkChildWaitForDeletion(ctx context.Context, id string, getFunction func() (*http.Response, error)) error { + deadline, _ := ctx.Deadline() + stateConf := &pluginsdk.StateChangeConf{ + Pending: []string{"200"}, + Target: []string{"404"}, + Refresh: func() (interface{}, string, error) { + resp, err := getFunction() + if err != nil { + if response.WasNotFound(resp) { + return resp, strconv.Itoa(resp.StatusCode), nil + } + + return nil, strconv.Itoa(resp.StatusCode), fmt.Errorf("polling for %s: %+v", id, err) + } + + return resp, strconv.Itoa(resp.StatusCode), nil + }, + MinTimeout: 10 * time.Second, + PollInterval: 10 * time.Second, + ContinuousTargetOccurence: 6, + Timeout: time.Until(deadline), + } + + if _, err := stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for deletion of %s: %+v", id, err) + } + + return nil +} + +// some resources defined both systemAssigned and userAssigned Identity type in Swagger but only support userAssigned Identity, +// so add a workaround to convert type here. +func expandMobileNetworkLegacyToUserAssignedIdentity(input []identity.ModelUserAssigned) (*identity.LegacySystemAndUserAssignedMap, error) { + if len(input) == 0 { + return nil, nil + } + + identityValue, err := identity.ExpandUserAssignedMapFromModel(input) + if err != nil { + return nil, fmt.Errorf("expanding `identity`: %+v", err) + } + + output := identity.LegacySystemAndUserAssignedMap{ + Type: identityValue.Type, + IdentityIds: identityValue.IdentityIds, + } + + return &output, nil +} + +func flattenMobileNetworkUserAssignedToNetworkLegacyIdentity(input *identity.LegacySystemAndUserAssignedMap) ([]identity.ModelUserAssigned, error) { + if input == nil { + return nil, nil + } + + tmp := identity.UserAssignedMap{ + Type: input.Type, + IdentityIds: input.IdentityIds, + } + + output, err := identity.FlattenUserAssignedMapToModel(&tmp) + if err != nil { + return nil, fmt.Errorf("expanding `identity`: %+v", err) + } + + return *output, nil +} diff --git a/internal/services/mobilenetwork/mobile_network_data_source.go b/internal/services/mobilenetwork/mobile_network_data_source.go new file mode 100644 index 000000000000..77ef31935015 --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_data_source.go @@ -0,0 +1,117 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type MobileNetworkDataSource struct{} + +var _ sdk.DataSource = MobileNetworkDataSource{} + +func (r MobileNetworkDataSource) ResourceType() string { + return "azurerm_mobile_network" +} + +func (r MobileNetworkDataSource) ModelObject() interface{} { + return &MobileNetworkModel{} +} + +func (r MobileNetworkDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return mobilenetwork.ValidateMobileNetworkID +} + +func (r MobileNetworkDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + } +} + +func (r MobileNetworkDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + + "location": commonschema.LocationComputed(), + + "mobile_country_code": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "mobile_network_code": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + + "service_key": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (r MobileNetworkDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var metaModel MobileNetworkModel + if err := metadata.Decode(&metaModel); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.MobileNetwork.MobileNetworkClient + subscriptionId := metadata.Client.Account.SubscriptionId + id := mobilenetwork.NewMobileNetworkID(subscriptionId, metaModel.ResourceGroupName, metaModel.Name) + + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + state := MobileNetworkModel{ + Name: id.MobileNetworkName, + ResourceGroupName: id.ResourceGroupName, + Location: location.Normalize(model.Location), + MobileCountryCode: model.Properties.PublicLandMobileNetworkIdentifier.Mcc, + MobileNetworkCode: model.Properties.PublicLandMobileNetworkIdentifier.Mnc, + } + + if model.Properties.ServiceKey != nil { + state.ServiceKey = *model.Properties.ServiceKey + } + + if model.Tags != nil { + state.Tags = *model.Tags + } + + metadata.SetID(id) + + return metadata.Encode(&state) + }, + } +} diff --git a/internal/services/mobilenetwork/mobile_network_data_source_test.go b/internal/services/mobilenetwork/mobile_network_data_source_test.go new file mode 100644 index 000000000000..bc9d87e1864e --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_data_source_test.go @@ -0,0 +1,42 @@ +package mobilenetwork_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type MobileNetworkDataSource struct{} + +func TestAccMobileNetworkDataSource_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network", "test") + + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + d := MobileNetworkDataSource{} + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: d.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key(`location`).Exists(), + check.That(data.ResourceName).Key(`mobile_country_code`).HasValue("001"), + check.That(data.ResourceName).Key(`mobile_network_code`).HasValue("01"), + ), + }, + data.ImportStep(), + }) +} + +func (r MobileNetworkDataSource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +data "azurerm_mobile_network" "test" { + name = azurerm_mobile_network.test.name + resource_group_name = azurerm_mobile_network.test.resource_group_name +} +`, MobileNetworkResource{}.complete(data)) +} diff --git a/internal/services/mobilenetwork/mobile_network_resource.go b/internal/services/mobilenetwork/mobile_network_resource.go new file mode 100644 index 000000000000..1a4ad2ad169d --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_resource.go @@ -0,0 +1,243 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "regexp" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type MobileNetworkModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + MobileCountryCode string `tfschema:"mobile_country_code"` + MobileNetworkCode string `tfschema:"mobile_network_code"` + Tags map[string]string `tfschema:"tags"` + ServiceKey string `tfschema:"service_key"` +} + +type MobileNetworkResource struct{} + +var _ sdk.ResourceWithUpdate = MobileNetworkResource{} + +func (r MobileNetworkResource) ResourceType() string { + return "azurerm_mobile_network" +} + +func (r MobileNetworkResource) ModelObject() interface{} { + return &MobileNetworkModel{} +} + +func (r MobileNetworkResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return mobilenetwork.ValidateMobileNetworkID +} + +func (r MobileNetworkResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "mobile_country_code": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^\d{3}$`), + "Mobile country code should be three digits.", + )}, + + "mobile_network_code": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^\d{2,3}$`), + "Mobile network code should be two or three digits.", + )}, + + "tags": commonschema.Tags(), + } +} + +func (r MobileNetworkResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "service_key": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (r MobileNetworkResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model MobileNetworkModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.MobileNetwork.MobileNetworkClient + subscriptionId := metadata.Client.Account.SubscriptionId + id := mobilenetwork.NewMobileNetworkID(subscriptionId, model.ResourceGroupName, model.Name) + + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + properties := &mobilenetwork.MobileNetwork{ + Location: location.Normalize(model.Location), + Properties: mobilenetwork.MobileNetworkPropertiesFormat{ + PublicLandMobileNetworkIdentifier: mobilenetwork.PlmnId{ + Mcc: model.MobileCountryCode, + Mnc: model.MobileNetworkCode, + }, + }, + Tags: &model.Tags, + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, *properties); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r MobileNetworkResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.MobileNetworkClient + + id, err := mobilenetwork.ParseMobileNetworkID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model MobileNetworkModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + resp, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := resp.Model + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + if metadata.ResourceData.HasChange("mobile_country_code") || metadata.ResourceData.HasChange("mobile_network_code") { + properties.Properties.PublicLandMobileNetworkIdentifier = mobilenetwork.PlmnId{ + Mcc: model.MobileCountryCode, + Mnc: model.MobileNetworkCode, + } + } + + properties.SystemData = nil + + if metadata.ResourceData.HasChange("tags") { + properties.Tags = &model.Tags + } + + if err := client.CreateOrUpdateThenPoll(ctx, *id, *properties); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r MobileNetworkResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.MobileNetworkClient + + id, err := mobilenetwork.ParseMobileNetworkID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + state := MobileNetworkModel{ + Name: id.MobileNetworkName, + ResourceGroupName: id.ResourceGroupName, + Location: location.Normalize(model.Location), + MobileCountryCode: model.Properties.PublicLandMobileNetworkIdentifier.Mcc, + MobileNetworkCode: model.Properties.PublicLandMobileNetworkIdentifier.Mnc, + } + + if model.Properties.ServiceKey != nil { + state.ServiceKey = *model.Properties.ServiceKey + } + + if model.Tags != nil { + state.Tags = *model.Tags + } + + return metadata.Encode(&state) + }, + } +} + +func (r MobileNetworkResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.MobileNetworkClient + + id, err := mobilenetwork.ParseMobileNetworkID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} diff --git a/internal/services/mobilenetwork/mobile_network_resource_test.go b/internal/services/mobilenetwork/mobile_network_resource_test.go new file mode 100644 index 000000000000..3224b3dd99cf --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_resource_test.go @@ -0,0 +1,191 @@ +package mobilenetwork_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type MobileNetworkResource struct{} + +func TestAccMobileNetwork_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMobileNetwork_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network", "test") + + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccMobileNetwork_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network", "test") + + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMobileNetwork_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r MobileNetworkResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := mobilenetwork.ParseMobileNetworkID(state.ID) + if err != nil { + return nil, err + } + + client := clients.MobileNetwork.MobileNetworkClient + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (r MobileNetworkResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctest-mn-%d" + location = "%s" +} +`, data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network" "test" { + name = "acctest-mn-%d" + resource_group_name = azurerm_resource_group.test.name + location = "%s" + mobile_country_code = "001" + mobile_network_code = "01" +} +`, r.template(data), data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkResource) requiresImport(data acceptance.TestData) string { + config := r.basic(data) + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network" "import" { + name = azurerm_mobile_network.test.name + resource_group_name = azurerm_resource_group.test.name + location = "%s" + mobile_country_code = "001" + mobile_network_code = "01" +} +`, config, data.Locations.Primary) +} + +func (r MobileNetworkResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network" "test" { + name = "acctest-mn-%d" + resource_group_name = azurerm_resource_group.test.name + location = "%s" + mobile_country_code = "001" + mobile_network_code = "01" + + tags = { + key = "value" + } + +} +`, r.template(data), data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network" "test" { + name = "acctest-mn-%d" + resource_group_name = azurerm_resource_group.test.name + location = "%s" + mobile_country_code = "001" + mobile_network_code = "01" + + tags = { + key = "value" + } + +} +`, r.template(data), data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/mobilenetwork/mobile_network_service_data_source.go b/internal/services/mobilenetwork/mobile_network_service_data_source.go new file mode 100644 index 000000000000..543975cccc53 --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_service_data_source.go @@ -0,0 +1,289 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type MobileNetworkServiceDataSource struct{} + +var _ sdk.DataSource = MobileNetworkServiceDataSource{} + +func (r MobileNetworkServiceDataSource) ResourceType() string { + return "azurerm_mobile_network_service" +} + +func (r MobileNetworkServiceDataSource) ModelObject() interface{} { + return &ServiceModel{} +} + +func (r MobileNetworkServiceDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return service.ValidateServiceID +} + +func (r MobileNetworkServiceDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "mobile_network_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: mobilenetwork.ValidateMobileNetworkID, + }, + } +} + +func (r MobileNetworkServiceDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + + "location": commonschema.LocationComputed(), + + "pcc_rule": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "precedence": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "qos_policy": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "allocation_and_retention_priority_level": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "qos_indicator": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "guaranteed_bit_rate": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "downlink": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "uplink": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "maximum_bit_rate": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "downlink": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "uplink": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "preemption_capability": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "preemption_vulnerability": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "service_data_flow_template": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "direction": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "ports": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "protocol": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "remote_ip_list": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "traffic_control_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + }, + }, + }, + + "service_precedence": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "service_qos_policy": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "allocation_and_retention_priority_level": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "qos_indicator": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "maximum_bit_rate": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "downlink": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "uplink": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "preemption_capability": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "preemption_vulnerability": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "tags": commonschema.TagsDataSource(), + } +} + +func (r MobileNetworkServiceDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var metaModel ServiceModel + if err := metadata.Decode(&metaModel); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.MobileNetwork.ServiceClient + mobileNetworkId, err := mobilenetwork.ParseMobileNetworkID(metaModel.MobileNetworkMobileNetworkId) + if err != nil { + return err + } + + id := service.NewServiceID(mobileNetworkId.SubscriptionId, mobileNetworkId.ResourceGroupName, mobileNetworkId.MobileNetworkName, metaModel.Name) + + resp, err := client.Get(ctx, id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if resp.Model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + model := *resp.Model + + state := ServiceModel{ + Name: id.ServiceName, + MobileNetworkMobileNetworkId: mobilenetwork.NewMobileNetworkID(id.SubscriptionId, id.ResourceGroupName, id.MobileNetworkName).ID(), + Location: location.Normalize(model.Location), + } + + properties := model.Properties + + state.PccRules = flattenPccRuleConfigurationModel(properties.PccRules) + + state.ServicePrecedence = properties.ServicePrecedence + + state.ServiceQosPolicy = flattenQosPolicyModel(properties.ServiceQosPolicy) + + if model.Tags != nil { + state.Tags = *model.Tags + } + + metadata.SetID(id) + + return metadata.Encode(&state) + }, + } +} diff --git a/internal/services/mobilenetwork/mobile_network_service_data_source_test.go b/internal/services/mobilenetwork/mobile_network_service_data_source_test.go new file mode 100644 index 000000000000..9c4d632f5bc6 --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_service_data_source_test.go @@ -0,0 +1,61 @@ +package mobilenetwork_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type MobileNetworkServiceDataSource struct{} + +func TestAccMobileNetworkServiceDataSource_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_service", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + d := MobileNetworkServiceDataSource{} + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: d.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key(`location`).Exists(), + check.That(data.ResourceName).Key(`service_precedence`).HasValue("0"), + check.That(data.ResourceName).Key(`pcc_rule.0.name`).HasValue("default-rule"), + check.That(data.ResourceName).Key(`pcc_rule.0.precedence`).HasValue("1"), + check.That(data.ResourceName).Key(`pcc_rule.0.traffic_control_enabled`).HasValue("true"), + check.That(data.ResourceName).Key(`pcc_rule.0.qos_policy.0.allocation_and_retention_priority_level`).HasValue("9"), + check.That(data.ResourceName).Key(`pcc_rule.0.qos_policy.0.qos_indicator`).HasValue("9"), + check.That(data.ResourceName).Key(`pcc_rule.0.qos_policy.0.preemption_capability`).HasValue("NotPreempt"), + check.That(data.ResourceName).Key(`pcc_rule.0.qos_policy.0.preemption_vulnerability`).HasValue("Preemptable"), + check.That(data.ResourceName).Key(`pcc_rule.0.qos_policy.0.guaranteed_bit_rate.0.downlink`).HasValue("100 Mbps"), + check.That(data.ResourceName).Key(`pcc_rule.0.qos_policy.0.guaranteed_bit_rate.0.uplink`).HasValue("10 Mbps"), + check.That(data.ResourceName).Key(`pcc_rule.0.qos_policy.0.maximum_bit_rate.0.downlink`).HasValue("1 Gbps"), + check.That(data.ResourceName).Key(`pcc_rule.0.qos_policy.0.maximum_bit_rate.0.uplink`).HasValue("100 Mbps"), + check.That(data.ResourceName).Key(`pcc_rule.0.service_data_flow_template.0.direction`).HasValue("Uplink"), + check.That(data.ResourceName).Key(`pcc_rule.0.service_data_flow_template.0.name`).HasValue("IP-to-server"), + check.That(data.ResourceName).Key(`pcc_rule.0.service_data_flow_template.0.protocol.0`).HasValue("ip"), + check.That(data.ResourceName).Key(`pcc_rule.0.service_data_flow_template.0.remote_ip_list.0`).HasValue("10.3.4.0/24"), + check.That(data.ResourceName).Key(`service_qos_policy.0.allocation_and_retention_priority_level`).HasValue("9"), + check.That(data.ResourceName).Key(`service_qos_policy.0.qos_indicator`).HasValue("9"), + check.That(data.ResourceName).Key(`service_qos_policy.0.preemption_capability`).HasValue("NotPreempt"), + check.That(data.ResourceName).Key(`service_qos_policy.0.preemption_vulnerability`).HasValue("Preemptable"), + check.That(data.ResourceName).Key(`service_qos_policy.0.maximum_bit_rate.0.downlink`).HasValue("1 Gbps"), + check.That(data.ResourceName).Key(`service_qos_policy.0.maximum_bit_rate.0.uplink`).HasValue("100 Mbps"), + check.That(data.ResourceName).Key("tags.%").HasValue("1"), + ), + }, + }) +} + +func (r MobileNetworkServiceDataSource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +data "azurerm_mobile_network_service" "test" { + name = azurerm_mobile_network_service.test.name + mobile_network_id = azurerm_mobile_network_service.test.mobile_network_id +} +`, MobileNetworkServiceResource{}.complete(data)) +} diff --git a/internal/services/mobilenetwork/mobile_network_service_resource.go b/internal/services/mobilenetwork/mobile_network_service_resource.go new file mode 100644 index 000000000000..9d35c1d1612a --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_service_resource.go @@ -0,0 +1,743 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "net/http" + "regexp" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type ServiceModel struct { + Name string `tfschema:"name"` + MobileNetworkMobileNetworkId string `tfschema:"mobile_network_id"` + Location string `tfschema:"location"` + PccRules []PccRuleConfigurationModel `tfschema:"pcc_rule"` + ServicePrecedence int64 `tfschema:"service_precedence"` + ServiceQosPolicy []QosPolicyModel `tfschema:"service_qos_policy"` + Tags map[string]string `tfschema:"tags"` +} + +type PccRuleConfigurationModel struct { + RuleName string `tfschema:"name"` + RulePrecedence int64 `tfschema:"precedence"` + RuleQosPolicy []PccRuleQosPolicyModel `tfschema:"qos_policy"` + ServiceDataFlowTemplates []ServiceDataFlowTemplateModel `tfschema:"service_data_flow_template"` + TrafficControlEnabled bool `tfschema:"traffic_control_enabled"` +} + +type PccRuleQosPolicyModel struct { + AllocationAndRetentionPriorityLevel int64 `tfschema:"allocation_and_retention_priority_level"` + QosIdentifier int64 `tfschema:"qos_indicator"` + GuaranteedBitRate []BitRateModel `tfschema:"guaranteed_bit_rate"` + MaximumBitRate []BitRateModel `tfschema:"maximum_bit_rate"` + PreemptionCapability string `tfschema:"preemption_capability"` + PreemptionVulnerability string `tfschema:"preemption_vulnerability"` +} + +type BitRateModel struct { + Downlink string `tfschema:"downlink"` + Uplink string `tfschema:"uplink"` +} + +type ServiceDataFlowTemplateModel struct { + Direction string `tfschema:"direction"` + Ports []string `tfschema:"ports"` + Protocol []string `tfschema:"protocol"` + RemoteIPList []string `tfschema:"remote_ip_list"` + TemplateName string `tfschema:"name"` +} + +type QosPolicyModel struct { + AllocationAndRetentionPriorityLevel int64 `tfschema:"allocation_and_retention_priority_level"` + QosIdentifier int64 `tfschema:"qos_indicator"` + MaximumBitRate []BitRateModel `tfschema:"maximum_bit_rate"` + PreemptionCapability string `tfschema:"preemption_capability"` + PreemptionVulnerability string `tfschema:"preemption_vulnerability"` +} + +type MobileNetworkServiceResource struct{} + +var _ sdk.ResourceWithUpdate = MobileNetworkServiceResource{} + +func (r MobileNetworkServiceResource) ResourceType() string { + return "azurerm_mobile_network_service" +} + +func (r MobileNetworkServiceResource) ModelObject() interface{} { + return &ServiceModel{} +} + +func (r MobileNetworkServiceResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return service.ValidateServiceID +} + +func (r MobileNetworkServiceResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "mobile_network_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: mobilenetwork.ValidateMobileNetworkID, + }, + + "location": commonschema.Location(), + + "pcc_rule": { + Type: pluginsdk.TypeList, + Required: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringLenBetween(1, 64), + }, + + "precedence": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(0, 255), + }, + + "qos_policy": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "allocation_and_retention_priority_level": { + Type: pluginsdk.TypeInt, + Optional: true, + }, + + "qos_indicator": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntAtLeast(1), + }, + + "guaranteed_bit_rate": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "downlink": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^([1-9]\d*|0)(\.\d+)?\s(Kbps|Mbps|Gbps|Tbps)$`), + "The value must be a number followed by Kbps, Mbps, Gbps or Tbps.", + )}, + + "uplink": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^([1-9]\d*|0)(\.\d+)?\s(Kbps|Mbps|Gbps|Tbps)$`), + "The value must be a number followed by Kbps, Mbps, Gbps or Tbps.", + )}, + }, + }, + }, + + "maximum_bit_rate": { + Type: pluginsdk.TypeList, + Required: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "downlink": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^([1-9]\d*|0)(\.\d+)?\s(Kbps|Mbps|Gbps|Tbps)$`), + "The value must be a number followed by Kbps, Mbps, Gbps or Tbps.", + )}, + + "uplink": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^([1-9]\d*|0)(\.\d+)?\s(Kbps|Mbps|Gbps|Tbps)$`), + "The value must be a number followed by Kbps, Mbps, Gbps or Tbps.", + )}, + }, + }, + }, + + "preemption_capability": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(service.PreemptionCapabilityNotPreempt), + ValidateFunc: validation.StringInSlice([]string{ + string(service.PreemptionCapabilityNotPreempt), + string(service.PreemptionCapabilityMayPreempt), + }, false), + }, + + "preemption_vulnerability": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(service.PreemptionVulnerabilityPreemptable), + ValidateFunc: validation.StringInSlice([]string{ + string(service.PreemptionVulnerabilityNotPreemptable), + string(service.PreemptionVulnerabilityPreemptable), + }, false), + }, + }, + }, + }, + + "service_data_flow_template": { + Type: pluginsdk.TypeList, + Required: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "direction": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(service.SdfDirectionUplink), + string(service.SdfDirectionDownlink), + string(service.SdfDirectionBidirectional), + }, false), + }, + + "ports": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "protocol": { + Type: pluginsdk.TypeList, + Required: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "remote_ip_list": { + Type: pluginsdk.TypeList, + Required: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "traffic_control_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + }, + }, + }, + + "service_precedence": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(0, 255), + }, + + "service_qos_policy": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "allocation_and_retention_priority_level": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 9, + ValidateFunc: validation.IntBetween(1, 127), + }, + + "qos_indicator": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntAtLeast(1), + }, + + "maximum_bit_rate": { + Type: pluginsdk.TypeList, + Required: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "downlink": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^\d+(\\.\\d+)?\s(bps|Kbps|Mbps|Gbps|Tbps)$`), + "The value must be a number followed by bps, Kbps, Mbps, Gbps or Tbps.", + )}, + + "uplink": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^\d+(\\.\\d+)?\s(bps|Kbps|Mbps|Gbps|Tbps)$`), + "The value must be a number followed by bps, Kbps, Mbps, Gbps or Tbps.", + )}, + }, + }, + }, + + "preemption_capability": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(service.PreemptionCapabilityNotPreempt), + string(service.PreemptionCapabilityMayPreempt), + }, false), + }, + + "preemption_vulnerability": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(service.PreemptionVulnerabilityNotPreemptable), + string(service.PreemptionVulnerabilityPreemptable), + }, false), + }, + }, + }, + }, + + "tags": commonschema.Tags(), + } +} + +func (r MobileNetworkServiceResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r MobileNetworkServiceResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model ServiceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.MobileNetwork.ServiceClient + mobileNetworkId, err := mobilenetwork.ParseMobileNetworkID(model.MobileNetworkMobileNetworkId) + if err != nil { + return err + } + + id := service.NewServiceID(mobileNetworkId.SubscriptionId, mobileNetworkId.ResourceGroupName, mobileNetworkId.MobileNetworkName, model.Name) + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + properties := service.Service{ + Location: location.Normalize(model.Location), + Properties: service.ServicePropertiesFormat{ + ServicePrecedence: model.ServicePrecedence, + PccRules: expandPccRuleConfigurationModel(model.PccRules), + ServiceQosPolicy: expandQosPolicyModel(model.ServiceQosPolicy), + }, + Tags: &model.Tags, + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r MobileNetworkServiceResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.ServiceClient + + id, err := service.ParseServiceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model ServiceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + resp, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + if resp.Model == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + properties := *resp.Model + + if metadata.ResourceData.HasChange("pcc_rule") { + properties.Properties.PccRules = expandPccRuleConfigurationModel(model.PccRules) + } + + if metadata.ResourceData.HasChange("service_precedence") { + properties.Properties.ServicePrecedence = model.ServicePrecedence + } + + if metadata.ResourceData.HasChange("service_qos_policy") { + properties.Properties.ServiceQosPolicy = expandQosPolicyModel(model.ServiceQosPolicy) + } + + properties.SystemData = nil + + if metadata.ResourceData.HasChange("tags") { + properties.Tags = &model.Tags + } + + if err := client.CreateOrUpdateThenPoll(ctx, *id, properties); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r MobileNetworkServiceResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.ServiceClient + + id, err := service.ParseServiceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + if resp.Model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + model := *resp.Model + + state := ServiceModel{ + Name: id.ServiceName, + MobileNetworkMobileNetworkId: mobilenetwork.NewMobileNetworkID(id.SubscriptionId, id.ResourceGroupName, id.MobileNetworkName).ID(), + Location: location.Normalize(model.Location), + } + + properties := model.Properties + + state.PccRules = flattenPccRuleConfigurationModel(properties.PccRules) + + state.ServicePrecedence = properties.ServicePrecedence + + state.ServiceQosPolicy = flattenQosPolicyModel(properties.ServiceQosPolicy) + + if model.Tags != nil { + state.Tags = *model.Tags + } + + return metadata.Encode(&state) + }, + } +} + +func (r MobileNetworkServiceResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.ServiceClient + + id, err := service.ParseServiceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + if err := resourceMobileNetworkChildWaitForDeletion(ctx, id.ID(), func() (*http.Response, error) { + resp, err := client.Get(ctx, *id) + return resp.HttpResponse, err + }); err != nil { + return err + } + + return nil + }, + } +} + +func expandPccRuleConfigurationModel(inputList []PccRuleConfigurationModel) []service.PccRuleConfiguration { + var outputList []service.PccRuleConfiguration + for _, v := range inputList { + input := v + output := service.PccRuleConfiguration{ + RuleName: input.RuleName, + RulePrecedence: input.RulePrecedence, + } + + trafficControlValue := service.TrafficControlPermissionBlocked + if input.TrafficControlEnabled { + trafficControlValue = service.TrafficControlPermissionEnabled + } + output.TrafficControl = &trafficControlValue + + output.RuleQosPolicy = expandPccRuleQosPolicyModel(input.RuleQosPolicy) + + output.ServiceDataFlowTemplates = expandServiceDataFlowTemplateModel(input.ServiceDataFlowTemplates) + + outputList = append(outputList, output) + } + + return outputList +} + +func expandPccRuleQosPolicyModel(inputList []PccRuleQosPolicyModel) *service.PccRuleQosPolicy { + if len(inputList) == 0 { + return nil + } + + input := &inputList[0] + capability := service.PreemptionCapability(input.PreemptionCapability) + vulnerability := service.PreemptionVulnerability(input.PreemptionVulnerability) + output := service.PccRuleQosPolicy{ + AllocationAndRetentionPriorityLevel: &input.AllocationAndRetentionPriorityLevel, + Fiveqi: &input.QosIdentifier, + PreemptionCapability: &capability, + PreemptionVulnerability: &vulnerability, + } + + output.GuaranteedBitRate = expandBitRateModel(input.GuaranteedBitRate) + + if v := expandBitRateModel(input.MaximumBitRate); v != nil { + output.MaximumBitRate = *v + } + + return &output +} + +func expandServiceDataFlowTemplateModel(inputList []ServiceDataFlowTemplateModel) []service.ServiceDataFlowTemplate { + outputList := make([]service.ServiceDataFlowTemplate, 0) + for _, v := range inputList { + input := v + output := service.ServiceDataFlowTemplate{ + Direction: service.SdfDirection(input.Direction), + Ports: &input.Ports, + Protocol: input.Protocol, + RemoteIPList: input.RemoteIPList, + TemplateName: input.TemplateName, + } + + outputList = append(outputList, output) + } + + return outputList +} + +func expandQosPolicyModel(inputList []QosPolicyModel) *service.QosPolicy { + if len(inputList) == 0 { + return nil + } + + input := &inputList[0] + capability := service.PreemptionCapability(input.PreemptionCapability) + vulnerability := service.PreemptionVulnerability(input.PreemptionVulnerability) + output := service.QosPolicy{ + AllocationAndRetentionPriorityLevel: &input.AllocationAndRetentionPriorityLevel, + Fiveqi: &input.QosIdentifier, + PreemptionCapability: &capability, + PreemptionVulnerability: &vulnerability, + } + + if v := expandBitRateModel(input.MaximumBitRate); v != nil { + output.MaximumBitRate = *v + } + + return &output +} + +func flattenPccRuleConfigurationModel(inputList []service.PccRuleConfiguration) []PccRuleConfigurationModel { + var outputList []PccRuleConfigurationModel + + for _, input := range inputList { + output := PccRuleConfigurationModel{ + RuleName: input.RuleName, + RulePrecedence: input.RulePrecedence, + } + + output.RuleQosPolicy = flattenPccRuleQosPolicyModel(input.RuleQosPolicy) + + output.ServiceDataFlowTemplates = flattenServiceDataFlowTemplateModel(&input.ServiceDataFlowTemplates) + + if input.TrafficControl != nil { + output.TrafficControlEnabled = *input.TrafficControl == service.TrafficControlPermissionEnabled + } + + outputList = append(outputList, output) + } + + return outputList +} + +func flattenPccRuleQosPolicyModel(input *service.PccRuleQosPolicy) []PccRuleQosPolicyModel { + var outputList []PccRuleQosPolicyModel + if input == nil { + return outputList + } + + output := PccRuleQosPolicyModel{} + + if input.AllocationAndRetentionPriorityLevel != nil { + output.AllocationAndRetentionPriorityLevel = *input.AllocationAndRetentionPriorityLevel + } + + if input.Fiveqi != nil { + output.QosIdentifier = *input.Fiveqi + } + + output.GuaranteedBitRate = flattenBitRateModel(input.GuaranteedBitRate) + + output.MaximumBitRate = flattenBitRateModel(&input.MaximumBitRate) + + if input.PreemptionCapability != nil { + output.PreemptionCapability = string(*input.PreemptionCapability) + } + + if input.PreemptionVulnerability != nil { + output.PreemptionVulnerability = string(*input.PreemptionVulnerability) + } + + return append(outputList, output) +} + +func flattenServiceDataFlowTemplateModel(inputList *[]service.ServiceDataFlowTemplate) []ServiceDataFlowTemplateModel { + var outputList []ServiceDataFlowTemplateModel + if inputList == nil { + return outputList + } + + for _, input := range *inputList { + output := ServiceDataFlowTemplateModel{ + Direction: string(input.Direction), + Protocol: input.Protocol, + RemoteIPList: input.RemoteIPList, + TemplateName: input.TemplateName, + } + + if input.Ports != nil { + output.Ports = *input.Ports + } + + outputList = append(outputList, output) + } + + return outputList +} + +func flattenQosPolicyModel(input *service.QosPolicy) []QosPolicyModel { + var outputList []QosPolicyModel + if input == nil { + return outputList + } + + output := QosPolicyModel{} + + if input.AllocationAndRetentionPriorityLevel != nil { + output.AllocationAndRetentionPriorityLevel = *input.AllocationAndRetentionPriorityLevel + } + + if input.Fiveqi != nil { + output.QosIdentifier = *input.Fiveqi + } + + output.MaximumBitRate = flattenBitRateModel(&input.MaximumBitRate) + + if input.PreemptionCapability != nil { + output.PreemptionCapability = string(*input.PreemptionCapability) + } + + if input.PreemptionVulnerability != nil { + output.PreemptionVulnerability = string(*input.PreemptionVulnerability) + } + + return append(outputList, output) +} + +// make it return a pointer because some property accept nil value +func expandBitRateModel(inputList []BitRateModel) *service.Ambr { + if len(inputList) == 0 { + return nil + } + + input := &inputList[0] + output := service.Ambr{ + Downlink: input.Downlink, + Uplink: input.Uplink, + } + + return &output +} + +func flattenBitRateModel(input *service.Ambr) []BitRateModel { + var outputList []BitRateModel + if input == nil { + return outputList + } + + output := BitRateModel{ + Downlink: input.Downlink, + Uplink: input.Uplink, + } + + return append(outputList, output) +} diff --git a/internal/services/mobilenetwork/mobile_network_service_resource_test.go b/internal/services/mobilenetwork/mobile_network_service_resource_test.go new file mode 100644 index 000000000000..d5205ebc0b6c --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_service_resource_test.go @@ -0,0 +1,385 @@ +package mobilenetwork_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type MobileNetworkServiceResource struct{} + +func TestAccMobileNetworkService_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_service", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkServiceResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMobileNetworkService_withQosPolicy(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_service", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkServiceResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withQosPolicy(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMobileNetworkService_withServiceQosPolicy(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_service", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkServiceResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withServiceQosPolicy(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMobileNetworkService_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_service", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkServiceResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccMobileNetworkService_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_service", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkServiceResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMobileNetworkService_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_service", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkServiceResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r MobileNetworkServiceResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := service.ParseServiceID(state.ID) + if err != nil { + return nil, err + } + + client := clients.MobileNetwork.ServiceClient + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (r MobileNetworkServiceResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network_service" "test" { + name = "acctest-mns-%d" + mobile_network_id = azurerm_mobile_network.test.id + location = "%s" + service_precedence = 0 + + pcc_rule { + name = "default-rule" + precedence = 1 + traffic_control_enabled = true + + service_data_flow_template { + direction = "Uplink" + name = "IP-to-server" + protocol = ["ip"] + remote_ip_list = ["10.3.4.0/24"] + } + + } +} +`, MobileNetworkResource{}.basic(data), data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkServiceResource) withQosPolicy(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network_service" "test" { + name = "acctest-mns-%d" + mobile_network_id = azurerm_mobile_network.test.id + location = "%s" + service_precedence = 0 + + pcc_rule { + name = "default-rule" + precedence = 1 + traffic_control_enabled = true + + service_data_flow_template { + direction = "Uplink" + name = "IP-to-server" + ports = [] + protocol = ["ip"] + remote_ip_list = ["10.3.4.0/24"] + } + + qos_policy { + allocation_and_retention_priority_level = 9 + qos_indicator = 9 + preemption_capability = "NotPreempt" + preemption_vulnerability = "Preemptable" + + maximum_bit_rate { + downlink = "1 Gbps" + uplink = "500 Mbps" + } + } + } +} +`, MobileNetworkResource{}.basic(data), data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkServiceResource) withServiceQosPolicy(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network_service" "test" { + name = "acctest-mns-%d" + mobile_network_id = azurerm_mobile_network.test.id + location = "%s" + service_precedence = 0 + + pcc_rule { + name = "default-rule" + precedence = 1 + traffic_control_enabled = true + + service_data_flow_template { + direction = "Uplink" + name = "IP-to-server" + ports = [] + protocol = ["ip"] + remote_ip_list = ["10.3.4.0/24"] + } + } + + service_qos_policy { + allocation_and_retention_priority_level = 9 + qos_indicator = 9 + preemption_capability = "NotPreempt" + preemption_vulnerability = "Preemptable" + maximum_bit_rate { + downlink = "1 Gbps" + uplink = "100 Mbps" + } + } + +} +`, MobileNetworkResource{}.basic(data), data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkServiceResource) requiresImport(data acceptance.TestData) string { + config := r.basic(data) + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network_service" "import" { + name = azurerm_mobile_network_service.test.name + mobile_network_id = azurerm_mobile_network.test.id + location = "%s" + service_precedence = 0 + + pcc_rule { + name = "default-rule" + precedence = 1 + traffic_control_enabled = true + + service_data_flow_template { + direction = "Uplink" + name = "IP-to-server" + ports = [] + protocol = ["ip"] + remote_ip_list = ["10.3.4.0/24"] + } + } +} +`, config, data.Locations.Primary) +} + +func (r MobileNetworkServiceResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network_service" "test" { + name = "acctest-mns-%d" + mobile_network_id = azurerm_mobile_network.test.id + location = "%s" + service_precedence = 0 + pcc_rule { + name = "default-rule" + precedence = 1 + traffic_control_enabled = true + qos_policy { + allocation_and_retention_priority_level = 9 + qos_indicator = 9 + preemption_capability = "NotPreempt" + preemption_vulnerability = "Preemptable" + guaranteed_bit_rate { + downlink = "100 Mbps" + uplink = "10 Mbps" + } + maximum_bit_rate { + downlink = "1 Gbps" + uplink = "100 Mbps" + } + } + + service_data_flow_template { + direction = "Uplink" + name = "IP-to-server" + ports = [] + protocol = ["ip"] + remote_ip_list = ["10.3.4.0/24"] + } + } + service_qos_policy { + allocation_and_retention_priority_level = 9 + qos_indicator = 9 + preemption_capability = "NotPreempt" + preemption_vulnerability = "Preemptable" + maximum_bit_rate { + downlink = "1 Gbps" + uplink = "100 Mbps" + } + } + tags = { + key = "value" + } + +} +`, MobileNetworkResource{}.basic(data), data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkServiceResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network_service" "test" { + name = "acctest-mns-%d" + mobile_network_id = azurerm_mobile_network.test.id + location = "%s" + service_precedence = 0 + pcc_rule { + name = "default-rule-2" + precedence = 1 + traffic_control_enabled = false + qos_policy { + allocation_and_retention_priority_level = 9 + qos_indicator = 9 + preemption_capability = "MayPreempt" + preemption_vulnerability = "NotPreemptable" + guaranteed_bit_rate { + downlink = "200 Mbps" + uplink = "20 Mbps" + } + maximum_bit_rate { + downlink = "2 Gbps" + uplink = "200 Mbps" + } + } + + service_data_flow_template { + direction = "Uplink" + name = "IP-to-server" + ports = [] + protocol = ["ip"] + remote_ip_list = ["10.3.4.0/24"] + } + } + + service_qos_policy { + allocation_and_retention_priority_level = 9 + qos_indicator = 9 + preemption_capability = "NotPreempt" + preemption_vulnerability = "Preemptable" + maximum_bit_rate { + downlink = "2 Gbps" + uplink = "200 Mbps" + } + } + tags = { + key = "update" + } + +} +`, MobileNetworkResource{}.basic(data), data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/mobilenetwork/mobile_network_sim_group_data_source.go b/internal/services/mobilenetwork/mobile_network_sim_group_data_source.go new file mode 100644 index 000000000000..4f0c371e4460 --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_sim_group_data_source.go @@ -0,0 +1,132 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type SimGroupDataSource struct{} + +var _ sdk.DataSource = SimGroupDataSource{} + +func (r SimGroupDataSource) ResourceType() string { + return "azurerm_mobile_network_sim_group" +} + +func (r SimGroupDataSource) ModelObject() interface{} { + return &SimGroupModel{} +} + +func (r SimGroupDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return simgroup.ValidateSimGroupID +} + +func (r SimGroupDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "mobile_network_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: mobilenetwork.ValidateMobileNetworkID, + }, + } +} + +func (r SimGroupDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + + "encryption_key_url": { // needs UserAssignedIdentity + Type: pluginsdk.TypeString, + Computed: true, + }, + + "identity": commonschema.SystemOrUserAssignedIdentityComputed(), + + "location": commonschema.LocationComputed(), + + "tags": commonschema.TagsDataSource(), + } +} + +func (r SimGroupDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var metaModel SimGroupModel + if err := metadata.Decode(&metaModel); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.MobileNetwork.SIMGroupClient + parsedMobileNetworkId, err := mobilenetwork.ParseMobileNetworkID(metaModel.MobileNetworkId) + if err != nil { + return fmt.Errorf("parsing `mobile_network_id`: %+v", err) + } + id := simgroup.NewSimGroupID(parsedMobileNetworkId.SubscriptionId, parsedMobileNetworkId.ResourceGroupName, metaModel.Name) + + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if resp.Model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + model := *resp.Model + + state := SimGroupModel{ + Name: id.SimGroupName, + MobileNetworkId: metaModel.MobileNetworkId, + Location: location.Normalize(model.Location), + } + + identityValue, err := identity.FlattenLegacySystemAndUserAssignedMap(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + + if err := metadata.ResourceData.Set("identity", identityValue); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } + + properties := model.Properties + + if properties.EncryptionKey != nil && properties.EncryptionKey.KeyUrl != nil { + state.EncryptionKeyUrl = *properties.EncryptionKey.KeyUrl + } + + if properties.MobileNetwork != nil { + state.MobileNetworkId = properties.MobileNetwork.Id + } + + if model.Tags != nil { + state.Tags = *model.Tags + } + + metadata.SetID(id) + + return metadata.Encode(&state) + }, + } +} diff --git a/internal/services/mobilenetwork/mobile_network_sim_group_data_source_test.go b/internal/services/mobilenetwork/mobile_network_sim_group_data_source_test.go new file mode 100644 index 000000000000..fa41e75fdc31 --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_sim_group_data_source_test.go @@ -0,0 +1,41 @@ +package mobilenetwork_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type MobileNetworkSimGroupDataSource struct{} + +func TestAccMobileNetworkSimGroupDataSource_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_sim_group", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + d := MobileNetworkSimGroupDataSource{} + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: d.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key(`location`).Exists(), + check.That(data.ResourceName).Key(`mobile_network_id`).Exists(), + check.That(data.ResourceName).Key(`encryption_key_url`).Exists(), + check.That(data.ResourceName).Key("tags.%").HasValue("1"), + ), + }, + }) +} + +func (r MobileNetworkSimGroupDataSource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +data "azurerm_mobile_network_sim_group" "test" { + name = azurerm_mobile_network_sim_group.test.name + mobile_network_id = azurerm_mobile_network.test.id +} +`, MobileNetworkSimGroupResource{}.complete(data)) +} diff --git a/internal/services/mobilenetwork/mobile_network_sim_group_resource.go b/internal/services/mobilenetwork/mobile_network_sim_group_resource.go new file mode 100644 index 000000000000..ad3d816943b8 --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_sim_group_resource.go @@ -0,0 +1,281 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type SimGroupModel struct { + Name string `tfschema:"name"` + EncryptionKeyUrl string `tfschema:"encryption_key_url"` + Identity []identity.ModelUserAssigned `tfschema:"identity"` + Location string `tfschema:"location"` + MobileNetworkId string `tfschema:"mobile_network_id"` + Tags map[string]string `tfschema:"tags"` +} + +type SimGroupResource struct{} + +var _ sdk.ResourceWithUpdate = SimGroupResource{} + +func (r SimGroupResource) ResourceType() string { + return "azurerm_mobile_network_sim_group" +} + +func (r SimGroupResource) ModelObject() interface{} { + return &SimGroupModel{} +} + +func (r SimGroupResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return simgroup.ValidateSimGroupID +} + +func (r SimGroupResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "mobile_network_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: mobilenetwork.ValidateMobileNetworkID, + }, + + "encryption_key_url": { // needs UserAssignedIdentity + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.IsURLWithHTTPorHTTPS, + }, + + "identity": commonschema.SystemOrUserAssignedIdentityOptional(), + + "location": commonschema.Location(), + + "tags": commonschema.Tags(), + } +} + +func (r SimGroupResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r SimGroupResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model SimGroupModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.MobileNetwork.SIMGroupClient + + parsedMobileNetworkId, err := mobilenetwork.ParseMobileNetworkID(model.MobileNetworkId) + if err != nil { + return fmt.Errorf("parsing: %+v", err) + } + + id := simgroup.NewSimGroupID(parsedMobileNetworkId.SubscriptionId, parsedMobileNetworkId.ResourceGroupName, model.Name) + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + identityValue, err := expandMobileNetworkLegacyToUserAssignedIdentity(model.Identity) + if err != nil { + return fmt.Errorf("expanding `identity`: %+v", err) + } + + properties := simgroup.SimGroup{ + Identity: identityValue, + Location: location.Normalize(model.Location), + Properties: simgroup.SimGroupPropertiesFormat{ + MobileNetwork: &simgroup.MobileNetworkResourceId{ + Id: model.MobileNetworkId, + }, + }, + Tags: &model.Tags, + } + + if model.EncryptionKeyUrl != "" { + properties.Properties.EncryptionKey = &simgroup.KeyVaultKey{ + KeyUrl: &model.EncryptionKeyUrl, + } + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r SimGroupResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.SIMGroupClient + + id, err := simgroup.ParseSimGroupID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model SimGroupModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + resp, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + if resp.Model == nil { + return fmt.Errorf("retrieving %s: Model was nil", id) + } + + properties := *resp.Model + + if metadata.ResourceData.HasChange("identity") { + identityValue, err := identity.ExpandLegacySystemAndUserAssignedMap(metadata.ResourceData.Get("identity").([]interface{})) + if err != nil { + return fmt.Errorf("expanding `identity`: %+v", err) + } + properties.Identity = identityValue + } + + if metadata.ResourceData.HasChange("encryption_key") { + properties.Properties.EncryptionKey = &simgroup.KeyVaultKey{ + KeyUrl: &model.EncryptionKeyUrl, + } + } + + if metadata.ResourceData.HasChange("mobile_network") { + properties.Properties.MobileNetwork = &simgroup.MobileNetworkResourceId{ + Id: model.MobileNetworkId, + } + } + + properties.SystemData = nil + + if metadata.ResourceData.HasChange("tags") { + properties.Tags = &model.Tags + } + + if err := client.CreateOrUpdateThenPoll(ctx, *id, properties); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r SimGroupResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.SIMGroupClient + + id, err := simgroup.ParseSimGroupID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + if resp.Model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + model := *resp.Model + + state := SimGroupModel{ + Name: id.SimGroupName, + Location: location.Normalize(model.Location), + } + + identityValue, err := flattenMobileNetworkUserAssignedToNetworkLegacyIdentity(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + + state.Identity = identityValue + + properties := &model.Properties + + if properties.EncryptionKey != nil && properties.EncryptionKey.KeyUrl != nil { + state.EncryptionKeyUrl = *properties.EncryptionKey.KeyUrl + } + + if properties.MobileNetwork != nil { + state.MobileNetworkId = properties.MobileNetwork.Id + } + + if model.Tags != nil { + state.Tags = *model.Tags + } + + return metadata.Encode(&state) + }, + } +} + +func (r SimGroupResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.SIMGroupClient + + id, err := simgroup.ParseSimGroupID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + if err := resourceMobileNetworkChildWaitForDeletion(ctx, id.ID(), func() (*http.Response, error) { + resp, err := client.Get(ctx, *id) + return resp.HttpResponse, err + }); err != nil { + return err + } + + return nil + }, + } +} diff --git a/internal/services/mobilenetwork/mobile_network_sim_group_resource_test.go b/internal/services/mobilenetwork/mobile_network_sim_group_resource_test.go new file mode 100644 index 000000000000..e9c2d98a28e9 --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_sim_group_resource_test.go @@ -0,0 +1,335 @@ +package mobilenetwork_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type MobileNetworkSimGroupResource struct{} + +func TestAccMobileNetworkSimGroup_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_sim_group", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkSimGroupResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMobileNetworkSimGroup_withEncryptionKeyUrl(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_sim_group", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkSimGroupResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withEncryptionKeyUrl(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMobileNetworkSimGroup_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_sim_group", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkSimGroupResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccMobileNetworkSimGroup_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_sim_group", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkSimGroupResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMobileNetworkSimGroup_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_sim_group", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkSimGroupResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r MobileNetworkSimGroupResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := simgroup.ParseSimGroupID(state.ID) + if err != nil { + return nil, err + } + + client := clients.MobileNetwork.SIMGroupClient + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (r MobileNetworkSimGroupResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` + %s +resource "azurerm_mobile_network_sim_group" "test" { + name = "acctest-mnsg-%d" + location = azurerm_resource_group.test.location + mobile_network_id = azurerm_mobile_network.test.id +} +`, MobileNetworkResource{}.basic(data), data.RandomInteger) +} + +func (r MobileNetworkSimGroupResource) withEncryptionKeyUrl(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +data "azurerm_client_config" "test" {} + +resource "azurerm_user_assigned_identity" "test" { + name = "acctest-mn-%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} + + +resource "azurerm_key_vault" "test" { + name = "acct-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + tenant_id = data.azurerm_client_config.test.tenant_id + sku_name = "standard" + + access_policy { + tenant_id = data.azurerm_client_config.test.tenant_id + object_id = data.azurerm_client_config.test.object_id + secret_permissions = ["Delete", "Get", "Set"] + key_permissions = ["Create", "Delete", "Get", "Import", "Purge"] + } + + access_policy { + tenant_id = data.azurerm_client_config.test.tenant_id + object_id = azurerm_user_assigned_identity.test.principal_id + secret_permissions = ["Delete", "Get", "Set"] + key_permissions = ["Create", "Delete", "Get", "Import", "Purge", "UnwrapKey", "WrapKey"] + } +} + +resource "azurerm_key_vault_key" "test" { + name = "enckey%[2]d" + key_vault_id = azurerm_key_vault.test.id + key_type = "RSA" + key_size = 2048 + + key_opts = ["decrypt", "encrypt", "sign", "unwrapKey", "verify", "wrapKey"] +} + +resource "azurerm_mobile_network_sim_group" "test" { + name = "acctest-mnsg-%[2]d" + location = "%[3]s" + encryption_key_url = azurerm_key_vault_key.test.versionless_id + mobile_network_id = azurerm_mobile_network.test.id + + identity { + type = "UserAssigned" + identity_ids = [azurerm_user_assigned_identity.test.id] + } +} +`, MobileNetworkResource{}.basic(data), data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkSimGroupResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network_sim_group" "import" { + name = azurerm_mobile_network_sim_group.test.name + location = "%s" + mobile_network_id = azurerm_mobile_network_sim_group.test.mobile_network_id + +} +`, r.basic(data), data.Locations.Primary) +} + +func (r MobileNetworkSimGroupResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` + %[1]s + +data "azurerm_client_config" "test" {} + +resource "azurerm_key_vault" "test" { + name = "acct-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + tenant_id = data.azurerm_client_config.test.tenant_id + sku_name = "standard" + + access_policy { + tenant_id = data.azurerm_client_config.test.tenant_id + object_id = data.azurerm_client_config.test.object_id + secret_permissions = ["Delete", "Get", "Set"] + key_permissions = ["Create", "Delete", "Get", "Import", "Purge"] + } + + access_policy { + tenant_id = data.azurerm_client_config.test.tenant_id + object_id = azurerm_user_assigned_identity.test.principal_id + secret_permissions = ["Delete", "Get", "Set"] + key_permissions = ["Create", "Delete", "Get", "Import", "Purge", "UnwrapKey", "WrapKey"] + } +} + + +resource "azurerm_key_vault_key" "test" { + name = "enckey%[2]d" + key_vault_id = azurerm_key_vault.test.id + key_type = "RSA" + key_size = 2048 + + key_opts = ["decrypt", "encrypt", "sign", "unwrapKey", "verify", "wrapKey"] +} + + +resource "azurerm_user_assigned_identity" "test" { + name = "acctest-mn-%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} + +resource "azurerm_mobile_network_sim_group" "test" { + name = "acctest-mnsg-%[2]d" + location = "%[3]s" + mobile_network_id = azurerm_mobile_network.test.id + encryption_key_url = azurerm_key_vault_key.test.versionless_id + + identity { + type = "UserAssigned" + identity_ids = [azurerm_user_assigned_identity.test.id] + } + + tags = { + key = "value" + } +} +`, MobileNetworkResource{}.basic(data), data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkSimGroupResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +data "azurerm_client_config" "test" {} + +resource "azurerm_user_assigned_identity" "test" { + name = "acctest-mn-%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} + +resource "azurerm_key_vault" "test" { + name = "acct-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + tenant_id = data.azurerm_client_config.test.tenant_id + sku_name = "standard" + + access_policy { + tenant_id = data.azurerm_client_config.test.tenant_id + object_id = data.azurerm_client_config.test.object_id + secret_permissions = ["Delete", "Get", "Set"] + key_permissions = ["Create", "Delete", "Get", "Import", "Purge"] + } + + access_policy { + tenant_id = data.azurerm_client_config.test.tenant_id + object_id = azurerm_user_assigned_identity.test.principal_id + secret_permissions = ["Delete", "Get", "Set"] + key_permissions = ["Create", "Delete", "Get", "Import", "Purge", "UnwrapKey", "WrapKey"] + } +} + + +resource "azurerm_key_vault_key" "test" { + name = "enckey%[2]d" + key_vault_id = "${azurerm_key_vault.test.id}" + key_type = "RSA" + key_size = 2048 + + key_opts = ["decrypt", "encrypt", "sign", "unwrapKey", "verify", "wrapKey"] +} + + +resource "azurerm_mobile_network_sim_group" "test" { + name = "acctest-mnsg-%[2]d" + location = "%[3]s" + mobile_network_id = azurerm_mobile_network.test.id + encryption_key_url = azurerm_key_vault_key.test.versionless_id + + identity { + type = "UserAssigned" + identity_ids = [azurerm_user_assigned_identity.test.id] + } + + tags = { + key = "updated" + } + +} +`, MobileNetworkResource{}.basic(data), data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/mobilenetwork/mobile_network_site_data_source.go b/internal/services/mobilenetwork/mobile_network_site_data_source.go new file mode 100644 index 000000000000..e93d4dd0b1dd --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_site_data_source.go @@ -0,0 +1,115 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type SiteDataSource struct{} + +var _ sdk.DataSource = SiteDataSource{} + +func (r SiteDataSource) ResourceType() string { + return "azurerm_mobile_network_site" +} + +func (r SiteDataSource) ModelObject() interface{} { + return &SiteModel{} +} + +func (r SiteDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return site.ValidateSiteID +} + +func (r SiteDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "mobile_network_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: mobilenetwork.ValidateMobileNetworkID, + }, + } +} + +func (r SiteDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "location": commonschema.LocationComputed(), + + "tags": commonschema.TagsDataSource(), + + "network_function_ids": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + } +} + +func (r SiteDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var metaModel SiteModel + if err := metadata.Decode(&metaModel); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.MobileNetwork.SiteClient + mobileNetworkId, err := mobilenetwork.ParseMobileNetworkID(metaModel.MobileNetworkId) + if err != nil { + return err + } + + id := site.NewSiteID(mobileNetworkId.SubscriptionId, mobileNetworkId.ResourceGroupName, mobileNetworkId.MobileNetworkName, metaModel.Name) + + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + state := SiteModel{ + Name: id.SiteName, + MobileNetworkId: mobileNetworkId.ID(), + Location: location.Normalize(model.Location), + } + + if properties := model.Properties; properties != nil { + state.NetworkFunctions = flattenSubResourceModel(properties.NetworkFunctions) + } + if model.Tags != nil { + state.Tags = *model.Tags + } + + metadata.SetID(id) + + return metadata.Encode(&state) + }, + } +} diff --git a/internal/services/mobilenetwork/mobile_network_site_data_source_test.go b/internal/services/mobilenetwork/mobile_network_site_data_source_test.go new file mode 100644 index 000000000000..267e638bf23c --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_site_data_source_test.go @@ -0,0 +1,40 @@ +package mobilenetwork_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type MobileNetworkSiteDataSource struct{} + +func TestAccMobileNetworkSiteDataSource_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_site", "test") + + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + d := MobileNetworkSiteDataSource{} + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: d.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key(`location`).Exists(), + check.That(data.ResourceName).Key("tags.%").HasValue("1"), + ), + }, + }) +} + +func (r MobileNetworkSiteDataSource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +data "azurerm_mobile_network_site" "test" { + name = azurerm_mobile_network_site.test.name + mobile_network_id = azurerm_mobile_network_site.test.mobile_network_id +} +`, MobileNetworkSiteResource{}.complete(data)) +} diff --git a/internal/services/mobilenetwork/mobile_network_site_resource.go b/internal/services/mobilenetwork/mobile_network_site_resource.go new file mode 100644 index 000000000000..feb41c44d86c --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_site_resource.go @@ -0,0 +1,241 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type SiteModel struct { + Name string `tfschema:"name"` + MobileNetworkId string `tfschema:"mobile_network_id"` + Location string `tfschema:"location"` + NetworkFunctions []string `tfschema:"network_function_ids"` + Tags map[string]string `tfschema:"tags"` +} + +type SiteResource struct{} + +var _ sdk.ResourceWithUpdate = SiteResource{} + +func (r SiteResource) ResourceType() string { + return "azurerm_mobile_network_site" +} + +func (r SiteResource) ModelObject() interface{} { + return &SiteModel{} +} + +func (r SiteResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return site.ValidateSiteID +} + +func (r SiteResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "mobile_network_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: mobilenetwork.ValidateMobileNetworkID, + }, + + "location": commonschema.Location(), + + "tags": commonschema.Tags(), + } +} + +func (r SiteResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "network_function_ids": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + } +} + +func (r SiteResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model SiteModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.MobileNetwork.SiteClient + mobileNetworkId, err := mobilenetwork.ParseMobileNetworkID(model.MobileNetworkId) + if err != nil { + return err + } + + id := site.NewSiteID(mobileNetworkId.SubscriptionId, mobileNetworkId.ResourceGroupName, mobileNetworkId.MobileNetworkName, model.Name) + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + properties := &site.Site{ + Location: location.Normalize(model.Location), + Properties: &site.SitePropertiesFormat{}, + Tags: &model.Tags, + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, *properties); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r SiteResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.SiteClient + + id, err := site.ParseSiteID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model SiteModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + resp, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := resp.Model + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + properties.SystemData = nil + + if metadata.ResourceData.HasChange("tags") { + properties.Tags = &model.Tags + } + + if err := client.CreateOrUpdateThenPoll(ctx, *id, *properties); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r SiteResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.SiteClient + + id, err := site.ParseSiteID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + state := SiteModel{ + Name: id.SiteName, + MobileNetworkId: mobilenetwork.NewMobileNetworkID(id.SubscriptionId, id.ResourceGroupName, id.MobileNetworkName).ID(), + Location: location.Normalize(model.Location), + } + + if properties := model.Properties; properties != nil { + state.NetworkFunctions = flattenSubResourceModel(properties.NetworkFunctions) + } + if model.Tags != nil { + state.Tags = *model.Tags + } + + return metadata.Encode(&state) + }, + } +} + +func (r SiteResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.SiteClient + + id, err := site.ParseSiteID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + if err := resourceMobileNetworkChildWaitForDeletion(ctx, id.ID(), func() (*http.Response, error) { + resp, err := client.Get(ctx, *id) + return resp.HttpResponse, err + }); err != nil { + return err + } + + return nil + }, + } +} + +func flattenSubResourceModel(inputList *[]site.SubResource) []string { + var outputList []string + if inputList == nil { + return outputList + } + + for _, input := range *inputList { + output := input.Id + outputList = append(outputList, output) + } + + return outputList +} diff --git a/internal/services/mobilenetwork/mobile_network_site_resource_test.go b/internal/services/mobilenetwork/mobile_network_site_resource_test.go new file mode 100644 index 000000000000..c89bf29c3de2 --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_site_resource_test.go @@ -0,0 +1,171 @@ +package mobilenetwork_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type MobileNetworkSiteResource struct{} + +func TestAccMobileNetworkSite_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_site", "test") + + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkSiteResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMobileNetworkSite_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_site", "test") + + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkSiteResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccMobileNetworkSite_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_site", "test") + + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkSiteResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMobileNetworkSite_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_site", "test") + + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkSiteResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r MobileNetworkSiteResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := site.ParseSiteID(state.ID) + if err != nil { + return nil, err + } + + client := clients.MobileNetwork.SiteClient + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (r MobileNetworkSiteResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network_site" "test" { + name = "acctest-mns-%d" + mobile_network_id = azurerm_mobile_network.test.id + location = "%s" +} +`, MobileNetworkResource{}.basic(data), data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkSiteResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network_site" "import" { + name = azurerm_mobile_network_site.test.name + mobile_network_id = azurerm_mobile_network.test.id + location = "%s" +} +`, r.basic(data), data.Locations.Primary) +} + +func (r MobileNetworkSiteResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network_site" "test" { + name = "acctest-mns-%d" + mobile_network_id = azurerm_mobile_network.test.id + location = "%s" + + tags = { + key = "value" + } + +} +`, MobileNetworkResource{}.basic(data), data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkSiteResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network_site" "test" { + name = "acctest-mns-%d" + mobile_network_id = azurerm_mobile_network.test.id + location = "%s" + + tags = { + key = "update" + } + +} +`, MobileNetworkResource{}.basic(data), data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/mobilenetwork/mobile_network_slice_data_source.go b/internal/services/mobilenetwork/mobile_network_slice_data_source.go new file mode 100644 index 000000000000..7cded07d9f91 --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_slice_data_source.go @@ -0,0 +1,137 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type SliceDataSource struct{} + +var _ sdk.DataSource = SliceDataSource{} + +func (r SliceDataSource) ResourceType() string { + return "azurerm_mobile_network_slice" +} + +func (r SliceDataSource) ModelObject() interface{} { + return &SliceModel{} +} + +func (r SliceDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return slice.ValidateSliceID +} + +func (r SliceDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "mobile_network_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: mobilenetwork.ValidateMobileNetworkID, + }, + } +} + +func (r SliceDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + + "description": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "location": commonschema.LocationComputed(), + + "single_network_slice_selection_assistance_information": { + Type: pluginsdk.TypeList, + Computed: true, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "slice_differentiator": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "slice_service_type": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + }, + }, + }, + + "tags": commonschema.TagsDataSource(), + } +} + +func (r SliceDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var metaModel SliceModel + if err := metadata.Decode(&metaModel); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.MobileNetwork.SliceClient + mobileNetworkId, err := mobilenetwork.ParseMobileNetworkID(metaModel.MobileNetworkId) + if err != nil { + return err + } + + id := slice.NewSliceID(mobileNetworkId.SubscriptionId, mobileNetworkId.ResourceGroupName, mobileNetworkId.MobileNetworkName, metaModel.Name) + + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if resp.Model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + model := *resp.Model + + state := SliceModel{ + Name: id.SliceName, + MobileNetworkId: mobileNetworkId.ID(), + Location: location.Normalize(model.Location), + } + + properties := model.Properties + if properties.Description != nil { + state.Description = *properties.Description + } + + state.Snssai = flattenSnssaiModel(properties.Snssai) + + if resp.Model.Tags != nil { + state.Tags = *model.Tags + } + + metadata.SetID(id) + + return metadata.Encode(&state) + }, + } +} diff --git a/internal/services/mobilenetwork/mobile_network_slice_data_source_test.go b/internal/services/mobilenetwork/mobile_network_slice_data_source_test.go new file mode 100644 index 000000000000..9ed68f0ff30f --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_slice_data_source_test.go @@ -0,0 +1,42 @@ +package mobilenetwork_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type MobileNetworkSliceDataSource struct{} + +func TestAccMobileNetworkSliceDataSource_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_slice", "test") + + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + d := MobileNetworkSliceDataSource{} + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: d.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key(`location`).Exists(), + check.That(data.ResourceName).Key(`description`).HasValue("my favorite slice"), + check.That(data.ResourceName).Key(`single_network_slice_selection_assistance_information.0.slice_service_type`).HasValue("1"), + check.That(data.ResourceName).Key("tags.%").HasValue("1"), + ), + }, + }) +} + +func (r MobileNetworkSliceDataSource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +data "azurerm_mobile_network_slice" "test" { + name = azurerm_mobile_network_slice.test.name + mobile_network_id = azurerm_mobile_network_slice.test.mobile_network_id +} +`, MobileNetworkSliceResource{}.complete(data)) +} diff --git a/internal/services/mobilenetwork/mobile_network_slice_resource.go b/internal/services/mobilenetwork/mobile_network_slice_resource.go new file mode 100644 index 000000000000..132bfbd4cfa1 --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_slice_resource.go @@ -0,0 +1,309 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "net/http" + "regexp" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type SliceModel struct { + Name string `tfschema:"name"` + MobileNetworkId string `tfschema:"mobile_network_id"` + Description string `tfschema:"description"` + Location string `tfschema:"location"` + Snssai []SnssaiModel `tfschema:"single_network_slice_selection_assistance_information"` + Tags map[string]string `tfschema:"tags"` +} + +type SnssaiModel struct { + Sd string `tfschema:"slice_differentiator"` + Sst int64 `tfschema:"slice_service_type"` +} + +type SliceResource struct{} + +var _ sdk.ResourceWithUpdate = SliceResource{} + +func (r SliceResource) ResourceType() string { + return "azurerm_mobile_network_slice" +} + +func (r SliceResource) ModelObject() interface{} { + return &SliceModel{} +} + +func (r SliceResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return slice.ValidateSliceID +} + +func (r SliceResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "mobile_network_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: mobilenetwork.ValidateMobileNetworkID, + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "location": commonschema.Location(), + + "single_network_slice_selection_assistance_information": { + Type: pluginsdk.TypeList, + Required: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "slice_differentiator": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^[A-Fa-f0-9]{6}$`), + "Slice Differentiator must be a 6 digit hex string", + ), + }, + + "slice_service_type": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(0, 255), + }, + }, + }, + }, + + "tags": commonschema.Tags(), + } +} + +func (r SliceResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r SliceResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model SliceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.MobileNetwork.SliceClient + mobileNetworkId, err := mobilenetwork.ParseMobileNetworkID(model.MobileNetworkId) + if err != nil { + return err + } + + id := slice.NewSliceID(mobileNetworkId.SubscriptionId, mobileNetworkId.ResourceGroupName, mobileNetworkId.MobileNetworkName, model.Name) + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + properties := slice.Slice{ + Location: location.Normalize(model.Location), + Properties: slice.SlicePropertiesFormat{}, + Tags: &model.Tags, + } + + if model.Description != "" { + properties.Properties.Description = &model.Description + } + + properties.Properties.Snssai = expandSnssaiModel(model.Snssai) + + if err := client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r SliceResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.SliceClient + + id, err := slice.ParseSliceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model SliceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + resp, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + if resp.Model == nil { + return fmt.Errorf("retrieving %s: properties were nil", id) + } + + updateModel := resp.Model + + if metadata.ResourceData.HasChange("description") { + if model.Description != "" { + updateModel.Properties.Description = &model.Description + } else { + updateModel.Properties.Description = nil + } + } + + if metadata.ResourceData.HasChange("snssai") { + updateModel.Properties.Snssai = expandSnssaiModel(model.Snssai) + } + + updateModel.SystemData = nil + + if metadata.ResourceData.HasChange("tags") { + updateModel.Tags = &model.Tags + } + + if err := client.CreateOrUpdateThenPoll(ctx, *id, *updateModel); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r SliceResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.SliceClient + + id, err := slice.ParseSliceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + if resp.Model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + model := *resp.Model + + state := SliceModel{ + Name: id.SliceName, + MobileNetworkId: mobilenetwork.NewMobileNetworkID(id.SubscriptionId, id.ResourceGroupName, id.MobileNetworkName).ID(), + Location: location.Normalize(model.Location), + } + + properties := model.Properties + if properties.Description != nil { + state.Description = *properties.Description + } + + state.Snssai = flattenSnssaiModel(properties.Snssai) + if model.Tags != nil { + state.Tags = *model.Tags + } + + return metadata.Encode(&state) + }, + } +} + +func (r SliceResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.SliceClient + + id, err := slice.ParseSliceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + if err := resourceMobileNetworkChildWaitForDeletion(ctx, id.ID(), func() (*http.Response, error) { + resp, err := client.Get(ctx, *id) + return resp.HttpResponse, err + }); err != nil { + return err + } + + return nil + }, + } +} + +func expandSnssaiModel(inputList []SnssaiModel) slice.Snssai { + output := slice.Snssai{} + if len(inputList) == 0 { + return output + } + input := inputList[0] + + output.Sst = input.Sst + + if input.Sd != "" { + output.Sd = &input.Sd + } + + return output +} + +func flattenSnssaiModel(input slice.Snssai) []SnssaiModel { + var outputList []SnssaiModel + + output := SnssaiModel{ + Sst: input.Sst, + } + + if input.Sd != nil { + output.Sd = *input.Sd + } + + return append(outputList, output) +} diff --git a/internal/services/mobilenetwork/mobile_network_slice_resource_test.go b/internal/services/mobilenetwork/mobile_network_slice_resource_test.go new file mode 100644 index 000000000000..ca942c133531 --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_slice_resource_test.go @@ -0,0 +1,181 @@ +package mobilenetwork_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type MobileNetworkSliceResource struct{} + +func TestAccMobileNetworkSlice_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_slice", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkSliceResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMobileNetworkSlice_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_slice", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkSliceResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccMobileNetworkSlice_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_slice", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkSliceResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMobileNetworkSlice_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network_slice", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkSliceResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r MobileNetworkSliceResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := slice.ParseSliceID(state.ID) + if err != nil { + return nil, err + } + + client := clients.MobileNetwork.SliceClient + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (r MobileNetworkSliceResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network_slice" "test" { + name = "acctest-mns-%d" + mobile_network_id = azurerm_mobile_network.test.id + location = "%s" + single_network_slice_selection_assistance_information { + slice_service_type = 1 + } +} +`, MobileNetworkResource{}.basic(data), data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkSliceResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network_slice" "import" { + name = azurerm_mobile_network_slice.test.name + mobile_network_id = azurerm_mobile_network_slice.test.mobile_network_id + + location = "%s" + single_network_slice_selection_assistance_information { + slice_service_type = 1 + } +} +`, r.basic(data), data.Locations.Primary) +} + +func (r MobileNetworkSliceResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network_slice" "test" { + name = "acctest-mns-%d" + mobile_network_id = azurerm_mobile_network.test.id + location = "%s" + description = "my favorite slice" + single_network_slice_selection_assistance_information { + slice_service_type = 1 + } + tags = { + key = "value" + } + +} +`, MobileNetworkResource{}.basic(data), data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkSliceResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_mobile_network_slice" "test" { + name = "acctest-mns-%d" + mobile_network_id = azurerm_mobile_network.test.id + location = "%s" + description = "my favorite slice2" + single_network_slice_selection_assistance_information { + slice_service_type = 1 + } + + tags = { + key = "value" + } + +} +`, MobileNetworkResource{}.basic(data), data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/mobilenetwork/registration.go b/internal/services/mobilenetwork/registration.go new file mode 100644 index 000000000000..ba592742c37e --- /dev/null +++ b/internal/services/mobilenetwork/registration.go @@ -0,0 +1,61 @@ +package mobilenetwork + +import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type Registration struct{} + +var ( + _ sdk.TypedServiceRegistrationWithAGitHubLabel = Registration{} + _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +) + +func (r Registration) AssociatedGitHubLabel() string { + return "service/mobile-network" +} + +// Name is the name of this Service +func (r Registration) Name() string { + return "Mobile Network" +} + +// WebsiteCategories returns a list of categories which can be used for the sidebar +func (r Registration) WebsiteCategories() []string { + return []string{ + "Mobile Network", + } +} + +// SupportedDataSources returns the supported Data Sources supported by this Service +func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { + return map[string]*pluginsdk.Resource{} +} + +// SupportedResources returns the supported Resources supported by this Service +func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { + return map[string]*pluginsdk.Resource{} +} + +// DataSources returns a list of Data Sources supported by this Service +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{ + MobileNetworkDataSource{}, + MobileNetworkServiceDataSource{}, + SiteDataSource{}, + SimGroupDataSource{}, + SliceDataSource{}, + } +} + +// Resources returns a list of Resources supported by this Service +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + MobileNetworkServiceResource{}, + SimGroupResource{}, + SliceResource{}, + MobileNetworkResource{}, + SiteResource{}, + } +} diff --git a/internal/services/mobilenetwork/testdata/rsa_bundle.pfx b/internal/services/mobilenetwork/testdata/rsa_bundle.pfx new file mode 100644 index 000000000000..3b7526983809 Binary files /dev/null and b/internal/services/mobilenetwork/testdata/rsa_bundle.pfx differ diff --git a/internal/services/monitor/common_monitor.go b/internal/services/monitor/common_monitor.go index c51759b3150d..f1aeae91d067 100644 --- a/internal/services/monitor/common_monitor.go +++ b/internal/services/monitor/common_monitor.go @@ -22,15 +22,18 @@ func flattenAzureRmScheduledQueryRulesAlertAction(input *insights.AzNsActionGrou func expandMonitorScheduledQueryRulesCommonSource(d *pluginsdk.ResourceData) *insights.Source { authorizedResourceIDs := d.Get("authorized_resource_ids").(*pluginsdk.Set).List() dataSourceID := d.Get("data_source_id").(string) - query, ok := d.GetOk("query") + source := insights.Source{ AuthorizedResources: utils.ExpandStringSlice(authorizedResourceIDs), DataSourceID: utils.String(dataSourceID), - QueryType: insights.QueryTypeResultCount, } - if ok { + + if query, ok := d.GetOk("query"); ok { source.Query = utils.String(query.(string)) } + if queryType, ok := d.GetOk("query_type"); ok { + source.QueryType = insights.QueryType(queryType.(string)) + } return &source } diff --git a/internal/services/monitor/monitor_aad_diagnostic_setting_resource.go b/internal/services/monitor/monitor_aad_diagnostic_setting_resource.go index 05dc2652c364..6fe0165f961c 100644 --- a/internal/services/monitor/monitor_aad_diagnostic_setting_resource.go +++ b/internal/services/monitor/monitor_aad_diagnostic_setting_resource.go @@ -11,12 +11,11 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" authRuleParse "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces" "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/storageaccounts" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/validate" - storageParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" - storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -79,7 +78,7 @@ func resourceMonitorAADDiagnosticSetting() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ForceNew: true, - ValidateFunc: storageValidate.StorageAccountID, + ValidateFunc: storageaccounts.ValidateStorageAccountID, AtLeastOneOf: []string{"eventhub_authorization_rule_id", "log_analytics_workspace_id", "storage_account_id"}, }, @@ -221,7 +220,7 @@ func resourceMonitorAADDiagnosticSettingRead(d *pluginsdk.ResourceData, meta int d.Set("eventhub_name", resp.EventHubName) eventhubAuthorizationRuleId := "" if resp.EventHubAuthorizationRuleID != nil && *resp.EventHubAuthorizationRuleID != "" { - parsedId, err := authRuleParse.ParseAuthorizationRuleID(*resp.EventHubAuthorizationRuleID) + parsedId, err := authRuleParse.ParseAuthorizationRuleIDInsensitively(*resp.EventHubAuthorizationRuleID) if err != nil { return err } @@ -232,7 +231,7 @@ func resourceMonitorAADDiagnosticSettingRead(d *pluginsdk.ResourceData, meta int workspaceId := "" if resp.WorkspaceID != nil && *resp.WorkspaceID != "" { - parsedId, err := workspaces.ParseWorkspaceID(*resp.WorkspaceID) + parsedId, err := workspaces.ParseWorkspaceIDInsensitively(*resp.WorkspaceID) if err != nil { return err } @@ -243,7 +242,7 @@ func resourceMonitorAADDiagnosticSettingRead(d *pluginsdk.ResourceData, meta int storageAccountId := "" if resp.StorageAccountID != nil && *resp.StorageAccountID != "" { - parsedId, err := storageParse.StorageAccountID(*resp.StorageAccountID) + parsedId, err := storageaccounts.ParseStorageAccountIDInsensitively(*resp.StorageAccountID) if err != nil { return err } diff --git a/internal/services/monitor/monitor_action_group_data_source_test.go b/internal/services/monitor/monitor_action_group_data_source_test.go index 73c541570025..65214a4f3224 100644 --- a/internal/services/monitor/monitor_action_group_data_source_test.go +++ b/internal/services/monitor/monitor_action_group_data_source_test.go @@ -98,9 +98,9 @@ func TestAccDataSourceMonitorActionGroup_complete(t *testing.T) { check.That(data.ResourceName).Key("azure_app_push_receiver.0.email_address").HasValue("admin@contoso.com"), check.That(data.ResourceName).Key("sms_receiver.#").HasValue("2"), check.That(data.ResourceName).Key("sms_receiver.0.country_code").HasValue("1"), - check.That(data.ResourceName).Key("sms_receiver.0.phone_number").HasValue("1231231234"), + check.That(data.ResourceName).Key("sms_receiver.0.phone_number").HasValue("2123456789"), check.That(data.ResourceName).Key("sms_receiver.1.country_code").HasValue("1"), - check.That(data.ResourceName).Key("sms_receiver.1.phone_number").HasValue("5551238888"), + check.That(data.ResourceName).Key("sms_receiver.1.phone_number").HasValue("3123456789"), check.That(data.ResourceName).Key("webhook_receiver.#").HasValue("2"), check.That(data.ResourceName).Key("webhook_receiver.0.service_uri").HasValue("http://example.com/alert"), check.That(data.ResourceName).Key("webhook_receiver.1.service_uri").HasValue("https://backup.example.com/warning"), @@ -114,9 +114,9 @@ func TestAccDataSourceMonitorActionGroup_complete(t *testing.T) { check.That(data.ResourceName).Key("automation_runbook_receiver.0.use_common_alert_schema").HasValue("false"), check.That(data.ResourceName).Key("voice_receiver.#").HasValue("2"), check.That(data.ResourceName).Key("voice_receiver.0.country_code").HasValue("1"), - check.That(data.ResourceName).Key("voice_receiver.0.phone_number").HasValue("1231231234"), + check.That(data.ResourceName).Key("voice_receiver.0.phone_number").HasValue("2123456789"), check.That(data.ResourceName).Key("voice_receiver.1.country_code").HasValue("1"), - check.That(data.ResourceName).Key("voice_receiver.1.phone_number").HasValue("5551238888"), + check.That(data.ResourceName).Key("voice_receiver.1.phone_number").HasValue("3123456789"), check.That(data.ResourceName).Key("logic_app_receiver.#").HasValue("1"), check.That(data.ResourceName).Key("logic_app_receiver.0.resource_id").HasValue(laResourceID), check.That(data.ResourceName).Key("logic_app_receiver.0.callback_url").HasValue("http://test-host:100/workflows/fb9c8d79b15f41ce9b12861862f43546/versions/08587100027316071865/triggers/manualTrigger/paths/invoke?api-version=2015-08-01-preview&sp=%2Fversions%2F08587100027316071865%2Ftriggers%2FmanualTrigger%2Frun&sv=1.0&sig=IxEQ_ygZf6WNEQCbjV0Vs6p6Y4DyNEJVAa86U5B4xhk"), @@ -231,13 +231,13 @@ resource "azurerm_monitor_action_group" "test" { sms_receiver { name = "oncallmsg" country_code = "1" - phone_number = "1231231234" + phone_number = "2123456789" } sms_receiver { name = "remotesupportmsg" country_code = "1" - phone_number = "5551238888" + phone_number = "3123456789" } webhook_receiver { @@ -263,13 +263,13 @@ resource "azurerm_monitor_action_group" "test" { voice_receiver { name = "oncall" country_code = "1" - phone_number = "1231231234" + phone_number = "2123456789" } voice_receiver { name = "remotesupport" country_code = "1" - phone_number = "5551238888" + phone_number = "3123456789" } logic_app_receiver { diff --git a/internal/services/monitor/monitor_action_group_resource.go b/internal/services/monitor/monitor_action_group_resource.go index 18931e02bc57..b01d32e7677c 100644 --- a/internal/services/monitor/monitor_action_group_resource.go +++ b/internal/services/monitor/monitor_action_group_resource.go @@ -829,7 +829,7 @@ func expandMonitorActionGroupEventHubReceiver(tenantId string, subscriptionId st if err != nil { return nil, err } - eventHubNameSpace, eventHubName, subId = eventHubId.NamespaceName, eventHubId.EventHubName, eventHubId.SubscriptionId + eventHubNameSpace, eventHubName, subId = eventHubId.NamespaceName, eventHubId.EventhubName, eventHubId.SubscriptionId } else if val["event_hub_id"].(string) != "" || eventHubNameSpace == "" || eventHubName == "" { return nil, fmt.Errorf("in event_hub_receiver, exactly one of event_hub_id or (event_hub_namespace, event_hub_name) must be set") } diff --git a/internal/services/monitor/monitor_action_group_resource_test.go b/internal/services/monitor/monitor_action_group_resource_test.go index 5ccfded4a984..3fe749a893fb 100644 --- a/internal/services/monitor/monitor_action_group_resource_test.go +++ b/internal/services/monitor/monitor_action_group_resource_test.go @@ -556,7 +556,7 @@ resource "azurerm_monitor_action_group" "test" { sms_receiver { name = "oncallmsg" country_code = "1" - phone_number = "1231231234" + phone_number = "2123456789" } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) @@ -702,7 +702,7 @@ resource "azurerm_monitor_action_group" "test" { voice_receiver { name = "oncallmsg" country_code = "1" - phone_number = "1231231234" + phone_number = "2123456789" } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) @@ -972,13 +972,13 @@ resource "azurerm_monitor_action_group" "test" { sms_receiver { name = "oncallmsg" country_code = "1" - phone_number = "1231231234" + phone_number = "2123456789" } sms_receiver { name = "remotesupport" - country_code = "61" - phone_number = "13888888888" + country_code = "1" + phone_number = "3123456789" } webhook_receiver { @@ -1005,7 +1005,7 @@ resource "azurerm_monitor_action_group" "test" { voice_receiver { name = "oncallvoice" country_code = "1" - phone_number = "1231231234" + phone_number = "2123456789" } logic_app_receiver { diff --git a/internal/services/monitor/monitor_alert_processing_rule_action_group_resource.go b/internal/services/monitor/monitor_alert_processing_rule_action_group_resource.go index e36734bc7dfb..29ed63af60f7 100644 --- a/internal/services/monitor/monitor_alert_processing_rule_action_group_resource.go +++ b/internal/services/monitor/monitor_alert_processing_rule_action_group_resource.go @@ -180,7 +180,7 @@ func (r AlertProcessingRuleActionGroupResource) Read() sdk.ResourceFunc { Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.Monitor.AlertProcessingRulesClient - id, err := alertprocessingrules.ParseActionRuleIDInsensitively(metadata.ResourceData.Id()) + id, err := alertprocessingrules.ParseActionRuleID(metadata.ResourceData.Id()) if err != nil { return err } @@ -194,7 +194,7 @@ func (r AlertProcessingRuleActionGroupResource) Read() sdk.ResourceFunc { } state := AlertProcessingRuleActionGroupModel{ - Name: id.AlertProcessingRuleName, + Name: id.ActionRuleName, ResourceGroupName: id.ResourceGroupName, } diff --git a/internal/services/monitor/monitor_alert_processing_rule_suppression_resource.go b/internal/services/monitor/monitor_alert_processing_rule_suppression_resource.go index 4eda45e4fdd3..cfc26d3ec635 100644 --- a/internal/services/monitor/monitor_alert_processing_rule_suppression_resource.go +++ b/internal/services/monitor/monitor_alert_processing_rule_suppression_resource.go @@ -167,7 +167,7 @@ func (r AlertProcessingRuleSuppressionResource) Read() sdk.ResourceFunc { Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.Monitor.AlertProcessingRulesClient - id, err := alertprocessingrules.ParseActionRuleIDInsensitively(metadata.ResourceData.Id()) + id, err := alertprocessingrules.ParseActionRuleID(metadata.ResourceData.Id()) if err != nil { return err } @@ -181,7 +181,7 @@ func (r AlertProcessingRuleSuppressionResource) Read() sdk.ResourceFunc { } state := AlertProcessingRuleSuppressionModel{ - Name: id.AlertProcessingRuleName, + Name: id.ActionRuleName, ResourceGroupName: id.ResourceGroupName, } @@ -226,7 +226,7 @@ func (r AlertProcessingRuleSuppressionResource) Delete() sdk.ResourceFunc { Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.Monitor.AlertProcessingRulesClient - id, err := alertprocessingrules.ParseActionRuleIDInsensitively(metadata.ResourceData.Id()) + id, err := alertprocessingrules.ParseActionRuleID(metadata.ResourceData.Id()) if err != nil { return err } diff --git a/internal/services/monitor/monitor_data_collection_endpoint_data_source.go b/internal/services/monitor/monitor_data_collection_endpoint_data_source.go index 8dac6f69cc94..2acf93cf6ef9 100644 --- a/internal/services/monitor/monitor_data_collection_endpoint_data_source.go +++ b/internal/services/monitor/monitor_data_collection_endpoint_data_source.go @@ -87,8 +87,7 @@ func (d DataCollectionEndpointDataSource) Read() sdk.ResourceFunc { resp, err := client.Get(ctx, id) if err != nil { if response.WasNotFound(resp.HttpResponse) { - metadata.Logger.Infof("%s was not found - removing from state!", id) - return metadata.MarkAsGone(id) + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } diff --git a/internal/services/monitor/monitor_data_collection_rule_association_resource.go b/internal/services/monitor/monitor_data_collection_rule_association_resource.go index 18f37ea50318..951434d27f91 100644 --- a/internal/services/monitor/monitor_data_collection_rule_association_resource.go +++ b/internal/services/monitor/monitor_data_collection_rule_association_resource.go @@ -158,7 +158,7 @@ func (r DataCollectionRuleAssociationResource) Read() sdk.ResourceFunc { } return metadata.Encode(&DataCollectionRuleAssociationModel{ - Name: id.AssociationName, + Name: id.DataCollectionRuleAssociationName, TargetResourceId: id.ResourceUri, DataCollectionEndpointId: dataCollectionEndpointId, DataCollectionRuleId: dataCollectionRuleId, diff --git a/internal/services/monitor/monitor_data_collection_rule_data_source.go b/internal/services/monitor/monitor_data_collection_rule_data_source.go index 9817692f563c..6d537c068b07 100644 --- a/internal/services/monitor/monitor_data_collection_rule_data_source.go +++ b/internal/services/monitor/monitor_data_collection_rule_data_source.go @@ -267,8 +267,7 @@ func (d DataCollectionRuleDataSource) Read() sdk.ResourceFunc { resp, err := client.Get(ctx, id) if err != nil { if response.WasNotFound(resp.HttpResponse) { - metadata.Logger.Infof("%s was not found - removing from state!", id) - return metadata.MarkAsGone(id) + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } diff --git a/internal/services/monitor/monitor_data_collection_rule_data_source_test.go b/internal/services/monitor/monitor_data_collection_rule_data_source_test.go index a444b863f136..287cf135b38b 100644 --- a/internal/services/monitor/monitor_data_collection_rule_data_source_test.go +++ b/internal/services/monitor/monitor_data_collection_rule_data_source_test.go @@ -32,7 +32,7 @@ func TestAccMonitorDataCollectionRuleDataSource_complete(t *testing.T) { check.That(data.ResourceName).Key("data_sources.0.performance_counter.#").HasValue("2"), check.That(data.ResourceName).Key("data_sources.0.performance_counter.1.sampling_frequency_in_seconds").HasValue("20"), check.That(data.ResourceName).Key("data_sources.0.performance_counter.1.name").HasValue("test-datasource-perfcounter2"), - check.That(data.ResourceName).Key("data_sources.0.windows_event_log.0.x_path_queries.0").HasValue("*[System/Level=1]"), + check.That(data.ResourceName).Key("data_sources.0.windows_event_log.0.x_path_queries.0").HasValue("System!*[System[EventID=4648]]"), check.That(data.ResourceName).Key("data_sources.0.extension.0.extension_json").Exists(), ), }, diff --git a/internal/services/monitor/monitor_data_collection_rule_resource_test.go b/internal/services/monitor/monitor_data_collection_rule_resource_test.go index 3a41750b2384..1f1d84d34ad1 100644 --- a/internal/services/monitor/monitor_data_collection_rule_resource_test.go +++ b/internal/services/monitor/monitor_data_collection_rule_resource_test.go @@ -178,7 +178,7 @@ resource "azurerm_monitor_data_collection_rule" "test" { } performance_counter { streams = ["Microsoft-Perf", "Microsoft-InsightsMetrics"] - sampling_frequency_in_seconds = 10 + sampling_frequency_in_seconds = 60 counter_specifiers = ["Processor(*)\\%% Processor Time"] name = "test-datasource-perfcounter" } @@ -289,7 +289,7 @@ resource "azurerm_monitor_data_collection_rule" "test" { performance_counter { streams = ["Microsoft-Perf", "Microsoft-InsightsMetrics"] - sampling_frequency_in_seconds = 10 + sampling_frequency_in_seconds = 60 counter_specifiers = [ "Processor(*)\\%% Processor Time", "Processor(*)\\%% Idle Time", @@ -321,7 +321,7 @@ resource "azurerm_monitor_data_collection_rule" "test" { windows_event_log { streams = ["Microsoft-WindowsEvent"] - x_path_queries = ["*[System/Level=1]"] + x_path_queries = ["System!*[System[EventID=4648]]"] name = "test-datasource-wineventlog" } @@ -348,10 +348,6 @@ resource "azurerm_monitor_data_collection_rule" "test" { azurerm_log_analytics_solution.test2, ] } - - - - `, r.template(data), data.RandomInteger) } diff --git a/internal/services/monitor/monitor_diagnostic_setting_resource.go b/internal/services/monitor/monitor_diagnostic_setting_resource.go index ed6662dc2e23..0d157dd505af 100644 --- a/internal/services/monitor/monitor_diagnostic_setting_resource.go +++ b/internal/services/monitor/monitor_diagnostic_setting_resource.go @@ -12,14 +12,13 @@ import ( authRuleParse "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces" "github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettings" "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/storageaccounts" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/features" eventhubValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/validate" - storageParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" - storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -63,40 +62,42 @@ func resourceMonitorDiagnosticSetting() *pluginsdk.Resource { "eventhub_name": { Type: pluginsdk.TypeString, Optional: true, - ForceNew: true, ValidateFunc: eventhubValidate.ValidateEventHubName(), }, "eventhub_authorization_rule_id": { Type: pluginsdk.TypeString, Optional: true, - ForceNew: true, ValidateFunc: authRuleParse.ValidateAuthorizationRuleID, + AtLeastOneOf: []string{"eventhub_authorization_rule_id", "log_analytics_workspace_id", "storage_account_id", "partner_solution_id"}, }, "log_analytics_workspace_id": { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: workspaces.ValidateWorkspaceID, + AtLeastOneOf: []string{"eventhub_authorization_rule_id", "log_analytics_workspace_id", "storage_account_id", "partner_solution_id"}, }, "storage_account_id": { Type: pluginsdk.TypeString, Optional: true, - ForceNew: true, - ValidateFunc: storageValidate.StorageAccountID, + ValidateFunc: storageaccounts.ValidateStorageAccountID, + AtLeastOneOf: []string{"eventhub_authorization_rule_id", "log_analytics_workspace_id", "storage_account_id", "partner_solution_id"}, }, "partner_solution_id": { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: azure.ValidateResourceID, + AtLeastOneOf: []string{"eventhub_authorization_rule_id", "log_analytics_workspace_id", "storage_account_id", "partner_solution_id"}, }, "log_analytics_destination_type": { Type: pluginsdk.TypeString, Optional: true, ForceNew: false, + Default: "AzureDiagnostics", ValidateFunc: validation.StringInSlice([]string{ "Dedicated", "AzureDiagnostics", // Not documented in azure API, but some resource has skew. See: https://github.com/Azure/azure-rest-api-specs/issues/9281 @@ -247,12 +248,12 @@ func resourceMonitorDiagnosticSettingCreate(d *pluginsdk.ResourceData, meta inte log.Printf("[INFO] preparing arguments for Azure ARM Diagnostic Settings.") id := diagnosticsettings.NewScopedDiagnosticSettingID(d.Get("target_resource_id").(string), d.Get("name").(string)) - resourceId := fmt.Sprintf("%s|%s", id.ResourceUri, id.Name) + resourceId := fmt.Sprintf("%s|%s", id.ResourceUri, id.DiagnosticSettingName) existing, err := client.Get(ctx, id) if err != nil { if !response.WasNotFound(existing.HttpResponse) { - return fmt.Errorf("checking for presence of existing Monitor Diagnostic Setting %q for Resource %q: %s", id.Name, id.ResourceUri, err) + return fmt.Errorf("checking for presence of existing Monitor Diagnostic Setting %q for Resource %q: %s", id.DiagnosticSettingName, id.ResourceUri, err) } } @@ -286,18 +287,18 @@ func resourceMonitorDiagnosticSettingCreate(d *pluginsdk.ResourceData, meta inte } } - // if no logs/metrics are not enabled the API "creates" but 404's on Read - valid := false + // if no logs/metrics are enabled the API "creates" but 404's on Read + hasEnabledMetrics := false if !hasEnabledLogs { for _, v := range metrics { if v.Enabled { - valid = true + hasEnabledMetrics = true break } } } - if !valid && !hasEnabledLogs { + if !hasEnabledMetrics && !hasEnabledLogs { return fmt.Errorf("at least one type of Log or Metric must be enabled") } @@ -308,43 +309,34 @@ func resourceMonitorDiagnosticSettingCreate(d *pluginsdk.ResourceData, meta inte }, } - valid = false eventHubAuthorizationRuleId := d.Get("eventhub_authorization_rule_id").(string) eventHubName := d.Get("eventhub_name").(string) if eventHubAuthorizationRuleId != "" { parameters.Properties.EventHubAuthorizationRuleId = utils.String(eventHubAuthorizationRuleId) parameters.Properties.EventHubName = utils.String(eventHubName) - valid = true } workspaceId := d.Get("log_analytics_workspace_id").(string) if workspaceId != "" { parameters.Properties.WorkspaceId = utils.String(workspaceId) - valid = true } storageAccountId := d.Get("storage_account_id").(string) if storageAccountId != "" { parameters.Properties.StorageAccountId = utils.String(storageAccountId) - valid = true } partnerSolutionId := d.Get("partner_solution_id").(string) if partnerSolutionId != "" { parameters.Properties.MarketplacePartnerId = utils.String(partnerSolutionId) - valid = true } if v := d.Get("log_analytics_destination_type").(string); v != "" { parameters.Properties.LogAnalyticsDestinationType = &v } - if !valid { - return fmt.Errorf("either a `eventhub_authorization_rule_id`, `log_analytics_workspace_id`, `partner_solution_id` or `storage_account_id` must be set") - } - if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { - return fmt.Errorf("creating Monitor Diagnostics Setting %q for Resource %q: %+v", id.Name, id.ResourceUri, err) + return fmt.Errorf("creating Monitor Diagnostics Setting %q for Resource %q: %+v", id.DiagnosticSettingName, id.ResourceUri, err) } d.SetId(resourceId) @@ -363,13 +355,23 @@ func resourceMonitorDiagnosticSettingUpdate(d *pluginsdk.ResourceData, meta inte return err } + existing, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving Monitor Diagnostics Setting %q for Resource %q: %+v", id.DiagnosticSettingName, id.ResourceUri, err) + } + if existing.Model == nil || existing.Model.Properties == nil { + return fmt.Errorf("unexpected null model of Monitor Diagnostics Setting %q for Resource %q", id.DiagnosticSettingName, id.ResourceUri) + } + metricsRaw := d.Get("metric").(*pluginsdk.Set).List() metrics := expandMonitorDiagnosticsSettingsMetrics(metricsRaw) var logs []diagnosticsettings.LogSettings hasEnabledLogs := false + logChanged := false if !features.FourPointOhBeta() { if d.HasChange("log") { + logChanged = true logsRaw := d.Get("log").(*pluginsdk.Set).List() logs = expandMonitorDiagnosticsSettingsLogs(logsRaw) for _, v := range logs { @@ -383,22 +385,31 @@ func resourceMonitorDiagnosticSettingUpdate(d *pluginsdk.ResourceData, meta inte if d.HasChange("enabled_log") { enabledLogs := d.Get("enabled_log").(*pluginsdk.Set).List() - logs = expandMonitorDiagnosticsSettingsEnabledLogs(enabledLogs) - hasEnabledLogs = true + if len(enabledLogs) > 0 { + logs = expandMonitorDiagnosticsSettingsEnabledLogs(enabledLogs) + hasEnabledLogs = true + } + } else if !logChanged && existing.Model != nil && existing.Model.Properties != nil && existing.Model.Properties.Logs != nil { + logs = *existing.Model.Properties.Logs + for _, v := range logs { + if v.Enabled { + hasEnabledLogs = true + } + } } - // if no logs/metrics are not enabled the API "creates" but 404's on Read - valid := false + // if no logs/metrics are enabled the API "creates" but 404's on Read + hasEnabledMetrics := false if !hasEnabledLogs { for _, v := range metrics { if v.Enabled { - valid = true + hasEnabledMetrics = true break } } } - if !valid && !hasEnabledLogs { + if !hasEnabledMetrics && !hasEnabledLogs { return fmt.Errorf("at least one type of Log or Metric must be enabled") } @@ -455,43 +466,34 @@ func resourceMonitorDiagnosticSettingUpdate(d *pluginsdk.ResourceData, meta inte }, } - valid = false eventHubAuthorizationRuleId := d.Get("eventhub_authorization_rule_id").(string) eventHubName := d.Get("eventhub_name").(string) if eventHubAuthorizationRuleId != "" { parameters.Properties.EventHubAuthorizationRuleId = utils.String(eventHubAuthorizationRuleId) parameters.Properties.EventHubName = utils.String(eventHubName) - valid = true } workspaceId := d.Get("log_analytics_workspace_id").(string) if workspaceId != "" { parameters.Properties.WorkspaceId = utils.String(workspaceId) - valid = true } storageAccountId := d.Get("storage_account_id").(string) if storageAccountId != "" { parameters.Properties.StorageAccountId = utils.String(storageAccountId) - valid = true } partnerSolutionId := d.Get("partner_solution_id").(string) if partnerSolutionId != "" { parameters.Properties.MarketplacePartnerId = utils.String(partnerSolutionId) - valid = true } if v := d.Get("log_analytics_destination_type").(string); v != "" { parameters.Properties.LogAnalyticsDestinationType = &v } - if !valid { - return fmt.Errorf("either a `eventhub_authorization_rule_id`, `log_analytics_workspace_id`, `partner_solution_id` or `storage_account_id` must be set") - } - if _, err := client.CreateOrUpdate(ctx, *id, parameters); err != nil { - return fmt.Errorf("updating Monitor Diagnostics Setting %q for Resource %q: %+v", id.Name, id.ResourceUri, err) + return fmt.Errorf("updating Monitor Diagnostics Setting %q for Resource %q: %+v", id.DiagnosticSettingName, id.ResourceUri, err) } return resourceMonitorDiagnosticSettingRead(d, meta) } @@ -509,15 +511,15 @@ func resourceMonitorDiagnosticSettingRead(d *pluginsdk.ResourceData, meta interf resp, err := client.Get(ctx, *id) if err != nil { if response.WasNotFound(resp.HttpResponse) { - log.Printf("[WARN] Monitor Diagnostics Setting %q was not found for Resource %q - removing from state!", id.Name, id.ResourceUri) + log.Printf("[WARN] Monitor Diagnostics Setting %q was not found for Resource %q - removing from state!", id.DiagnosticSettingName, id.ResourceUri) d.SetId("") return nil } - return fmt.Errorf("retrieving Monitor Diagnostics Setting %q for Resource %q: %+v", id.Name, id.ResourceUri, err) + return fmt.Errorf("retrieving Monitor Diagnostics Setting %q for Resource %q: %+v", id.DiagnosticSettingName, id.ResourceUri, err) } - d.Set("name", id.Name) + d.Set("name", id.DiagnosticSettingName) d.Set("target_resource_id", id.ResourceUri) if model := resp.Model; model != nil { @@ -547,7 +549,7 @@ func resourceMonitorDiagnosticSettingRead(d *pluginsdk.ResourceData, meta interf storageAccountId := "" if props.StorageAccountId != nil && *props.StorageAccountId != "" { - parsedId, err := storageParse.StorageAccountID(*props.StorageAccountId) + parsedId, err := storageaccounts.ParseStorageAccountIDInsensitively(*props.StorageAccountId) if err != nil { return err } @@ -597,12 +599,12 @@ func resourceMonitorDiagnosticSettingDelete(d *pluginsdk.ResourceData, meta inte resp, err := client.Delete(ctx, *id) if err != nil { if !response.WasNotFound(resp.HttpResponse) { - return fmt.Errorf("deleting Monitor Diagnostics Setting %q for Resource %q: %+v", id.Name, id.ResourceUri, err) + return fmt.Errorf("deleting Monitor Diagnostics Setting %q for Resource %q: %+v", id.DiagnosticSettingName, id.ResourceUri, err) } } // API appears to be eventually consistent (identified during tainting this resource) - log.Printf("[DEBUG] Waiting for Monitor Diagnostic Setting %q for Resource %q to disappear", id.Name, id.ResourceUri) + log.Printf("[DEBUG] Waiting for Monitor Diagnostic Setting %q for Resource %q to disappear", id.DiagnosticSettingName, id.ResourceUri) stateConf := &pluginsdk.StateChangeConf{ Pending: []string{"Exists"}, Target: []string{"NotFound"}, @@ -613,7 +615,7 @@ func resourceMonitorDiagnosticSettingDelete(d *pluginsdk.ResourceData, meta inte } if _, err = stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for Monitor Diagnostic Setting %q for Resource %q to become available: %s", id.Name, id.ResourceUri, err) + return fmt.Errorf("waiting for Monitor Diagnostic Setting %q for Resource %q to become available: %s", id.DiagnosticSettingName, id.ResourceUri, err) } return nil @@ -863,8 +865,8 @@ func ParseMonitorDiagnosticId(monitorId string) (*diagnosticsettings.ScopedDiagn } identifier := diagnosticsettings.ScopedDiagnosticSettingId{ - ResourceUri: v[0], - Name: v[1], + ResourceUri: v[0], + DiagnosticSettingName: v[1], } return &identifier, nil } diff --git a/internal/services/monitor/monitor_diagnostic_setting_resource_test.go b/internal/services/monitor/monitor_diagnostic_setting_resource_test.go index d9dffe20c8fe..654cd1d8ed69 100644 --- a/internal/services/monitor/monitor_diagnostic_setting_resource_test.go +++ b/internal/services/monitor/monitor_diagnostic_setting_resource_test.go @@ -153,6 +153,29 @@ func TestAccMonitorDiagnosticSetting_activityLog(t *testing.T) { }) } +func TestAccMonitorDiagnosticSetting_logAnalyticsDestinationType(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_monitor_diagnostic_setting", "test") + r := MonitorDiagnosticSettingResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.logAnalyticsDestinationTypeOmit(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("log_analytics_destination_type").HasValue("AzureDiagnostics"), + ), + }, + data.ImportStep(), + { + Config: r.logAnalyticsDestinationTypeUpdated(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("log_analytics_destination_type").HasValue("Dedicated"), + ), + }, + data.ImportStep(), + }) +} + func TestAccMonitorDiagnosticSetting_enabledLogs(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_monitor_diagnostic_setting", "test") r := MonitorDiagnosticSettingResource{} @@ -248,7 +271,6 @@ resource "azurerm_monitor_diagnostic_setting" "test" { target_resource_id = azurerm_key_vault.test.id eventhub_authorization_rule_id = azurerm_eventhub_namespace_authorization_rule.test.id eventhub_name = azurerm_eventhub.test.name - log_analytics_destination_type = "AzureDiagnostics" log { category = "AuditEvent" @@ -334,7 +356,6 @@ resource "azurerm_monitor_diagnostic_setting" "test" { target_resource_id = azurerm_key_vault.test.id eventhub_authorization_rule_id = azurerm_eventhub_namespace_authorization_rule.test.id eventhub_name = azurerm_eventhub.test.name - log_analytics_destination_type = "AzureDiagnostics" log { category_group = "Audit" @@ -367,6 +388,7 @@ resource "azurerm_monitor_diagnostic_setting" "test" { } `, data.RandomInteger, data.Locations.Primary, data.RandomIntOfLength(17)) } + func (r MonitorDiagnosticSettingResource) requiresImport(data acceptance.TestData) string { return fmt.Sprintf(` %s @@ -632,10 +654,9 @@ resource "azurerm_elastic_cloud_elasticsearch" "test" { } resource "azurerm_monitor_diagnostic_setting" "test" { - name = "acctest-DS-%[1]d" - target_resource_id = azurerm_key_vault.test.id - partner_solution_id = azurerm_elastic_cloud_elasticsearch.test.id - log_analytics_destination_type = "AzureDiagnostics" + name = "acctest-DS-%[1]d" + target_resource_id = azurerm_key_vault.test.id + partner_solution_id = azurerm_elastic_cloud_elasticsearch.test.id log { category = "AuditEvent" @@ -700,10 +721,9 @@ resource "azurerm_key_vault" "test" { } resource "azurerm_monitor_diagnostic_setting" "test" { - name = "acctest-DS-%[1]d" - target_resource_id = azurerm_key_vault.test.id - storage_account_id = azurerm_storage_account.test.id - log_analytics_destination_type = "AzureDiagnostics" + name = "acctest-DS-%[1]d" + target_resource_id = azurerm_key_vault.test.id + storage_account_id = azurerm_storage_account.test.id log { category = "AuditEvent" @@ -766,10 +786,9 @@ resource "azurerm_storage_account" "test" { resource "azurerm_monitor_diagnostic_setting" "test" { - name = "acctest-DS-%[1]d" - target_resource_id = data.azurerm_subscription.current.id - storage_account_id = azurerm_storage_account.test.id - log_analytics_destination_type = "AzureDiagnostics" + name = "acctest-DS-%[1]d" + target_resource_id = data.azurerm_subscription.current.id + storage_account_id = azurerm_storage_account.test.id log { category = "Administrative" @@ -972,3 +991,271 @@ resource "azurerm_monitor_diagnostic_setting" "test" { } `, data.RandomInteger, data.Locations.Primary, data.RandomIntOfLength(17)) } + +func (MonitorDiagnosticSettingResource) logAnalyticsDestinationTypeOmit(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +data "azurerm_client_config" "current" { +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +resource "azurerm_log_analytics_workspace" "test" { + name = "acctest-LAW-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "PerGB2018" + retention_in_days = 30 +} + +resource "azurerm_data_factory" "test" { + name = "acctest-DF-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_monitor_diagnostic_setting" "test" { + name = "acctest-DS-%[1]d" + target_resource_id = azurerm_data_factory.test.id + log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id + + log { + category = "ActivityRuns" + retention_policy { + enabled = false + days = 0 + } + } + + log { + category = "PipelineRuns" + retention_policy { + enabled = false + days = 0 + } + } + + log { + category = "TriggerRuns" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SSISIntegrationRuntimeLogs" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SSISPackageEventMessageContext" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SSISPackageEventMessages" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SSISPackageExecutableStatistics" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SSISPackageExecutionComponentPhases" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SSISPackageExecutionDataStatistics" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SandboxActivityRuns" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SandboxPipelineRuns" + retention_policy { + days = 0 + enabled = false + } + } + + metric { + category = "AllMetrics" + enabled = false + retention_policy { + days = 0 + enabled = false + } + } +} +`, data.RandomInteger, data.Locations.Primary) +} + +func (MonitorDiagnosticSettingResource) logAnalyticsDestinationTypeUpdated(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +data "azurerm_client_config" "current" { +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +resource "azurerm_log_analytics_workspace" "test" { + name = "acctest-LAW-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "PerGB2018" + retention_in_days = 30 +} + +resource "azurerm_data_factory" "test" { + name = "acctest-DF-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_monitor_diagnostic_setting" "test" { + name = "acctest-DS-%[1]d" + target_resource_id = azurerm_data_factory.test.id + log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id + + log_analytics_destination_type = "Dedicated" + + log { + category = "ActivityRuns" + retention_policy { + enabled = false + days = 0 + } + } + + log { + category = "PipelineRuns" + retention_policy { + enabled = false + days = 0 + } + } + + log { + category = "TriggerRuns" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SSISIntegrationRuntimeLogs" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SSISPackageEventMessageContext" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SSISPackageEventMessages" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SSISPackageExecutableStatistics" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SSISPackageExecutionComponentPhases" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SSISPackageExecutionDataStatistics" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SandboxActivityRuns" + retention_policy { + days = 0 + enabled = false + } + } + + log { + category = "SandboxPipelineRuns" + retention_policy { + days = 0 + enabled = false + } + } + + metric { + category = "AllMetrics" + enabled = false + retention_policy { + days = 0 + enabled = false + } + } +} +`, data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/monitor/monitor_scheduled_query_rules_alert_resource_test.go b/internal/services/monitor/monitor_scheduled_query_rules_alert_resource_test.go index 122d4016823a..6fdb762d286a 100644 --- a/internal/services/monitor/monitor_scheduled_query_rules_alert_resource_test.go +++ b/internal/services/monitor/monitor_scheduled_query_rules_alert_resource_test.go @@ -32,6 +32,20 @@ func TestAccMonitorScheduledQueryRules_AlertingActionBasic(t *testing.T) { data.ImportStep(), }) } +func TestAccMonitorScheduledQueryRules_AlertingActionQueryTypeNumber(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_monitor_scheduled_query_rules_alert", "test") + r := MonitorScheduledQueryRulesResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.AlertingActionQueryTypeNumber(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} func TestAccMonitorScheduledQueryRules_AlertingActionUpdate(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_monitor_scheduled_query_rules_alert", "test") @@ -156,6 +170,49 @@ QUERY `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, ts, ts, strconv.FormatBool(autoMitigate)) } +func (MonitorScheduledQueryRulesResource) AlertingActionQueryTypeNumber(data acceptance.TestData) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-monitor-%d" + location = "%s" +} + +resource "azurerm_log_analytics_workspace" "test" { + name = "acctestWorkspace-%[1]d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + sku = "PerGB2018" + retention_in_days = 30 +} + +resource "azurerm_monitor_action_group" "test" { + name = "acctestActionGroup-%[1]d" + resource_group_name = azurerm_resource_group.test.name + short_name = "acctestag" +} + +resource "azurerm_monitor_scheduled_query_rules_alert" "test" { + name = "acctestsqr-%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + data_source_id = azurerm_log_analytics_workspace.test.id + query_type = "Number" + query = <<-QUERY +Heartbeat | summarize AggregatedValue = count() by bin(TimeGenerated, 5m) +QUERY + frequency = 60 + time_window = 60 + auto_mitigation_enabled = true + action { + action_group = [azurerm_monitor_action_group.test.id] + } + trigger { + operator = "GreaterThan" + threshold = 5000 + } +}`, data.RandomInteger, data.Locations.Primary) +} + func (MonitorScheduledQueryRulesResource) AlertingActionConfigBasic(data acceptance.TestData, ts string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { diff --git a/internal/services/monitor/monitor_scheduled_query_rules_alert_v2_resource.go b/internal/services/monitor/monitor_scheduled_query_rules_alert_v2_resource.go index 3ac82034ffb3..23a639a8b509 100644 --- a/internal/services/monitor/monitor_scheduled_query_rules_alert_v2_resource.go +++ b/internal/services/monitor/monitor_scheduled_query_rules_alert_v2_resource.go @@ -621,7 +621,7 @@ func (r ScheduledQueryRulesAlertV2Resource) Read() sdk.ResourceFunc { } state := ScheduledQueryRulesAlertV2Model{ - Name: id.RuleName, + Name: id.ScheduledQueryRuleName, ResourceGroupName: id.ResourceGroupName, Location: location.Normalize(model.Location), } diff --git a/internal/services/mssql/helper/elasticpool.go b/internal/services/mssql/helper/elasticpool.go index 18f1b8b9ca95..7f2c03d1e3f6 100644 --- a/internal/services/mssql/helper/elasticpool.go +++ b/internal/services/mssql/helper/elasticpool.go @@ -339,9 +339,7 @@ func buildErrorString(stub string, m map[int]float64) string { } // copy the values of the map of keys into a slice of ints - for v := range p { - a = append(a, p[v]) - } + a = append(a, p...) // sort the slice to get them in order sort.Ints(a) diff --git a/internal/services/mssql/mssql_database_resource.go b/internal/services/mssql/mssql_database_resource.go index 0a03250617e6..80c14f3d1cd9 100644 --- a/internal/services/mssql/mssql_database_resource.go +++ b/internal/services/mssql/mssql_database_resource.go @@ -10,7 +10,6 @@ import ( "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v5.0/sql" // nolint: staticcheck "github.com/Azure/go-autorest/autorest/date" "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" @@ -378,10 +377,10 @@ func resourceMsSqlDatabaseCreateUpdate(d *pluginsdk.ResourceData, meta interface if err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { c, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) if err != nil { - return resource.NonRetryableError(fmt.Errorf("while polling cluster %s for status: %+v", id.String(), err)) + return pluginsdk.NonRetryableError(fmt.Errorf("while polling cluster %s for status: %+v", id.String(), err)) } if c.DatabaseProperties.Status == sql.DatabaseStatusScaling { - return resource.RetryableError(fmt.Errorf("database %s is still scaling", id.String())) + return pluginsdk.RetryableError(fmt.Errorf("database %s is still scaling", id.String())) } return nil @@ -432,12 +431,12 @@ func resourceMsSqlDatabaseCreateUpdate(d *pluginsdk.ResourceData, meta interface if err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { result, err := securityAlertPoliciesClient.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.Name, expandMsSqlServerSecurityAlertPolicy(d)) - if result.Response.StatusCode == 404 { - return resource.RetryableError(fmt.Errorf("database %s is still creating", id.String())) + if utils.ResponseWasNotFound(result.Response) { + return pluginsdk.RetryableError(fmt.Errorf("database %s is still creating", id.String())) } if err != nil { - return resource.NonRetryableError(fmt.Errorf("setting database threat detection policy for %s: %+v", id, err)) + return pluginsdk.NonRetryableError(fmt.Errorf("setting database threat detection policy for %s: %+v", id, err)) } return nil @@ -556,11 +555,11 @@ func resourceMsSqlDatabaseRead(d *pluginsdk.ResourceData, meta interface{}) erro configurationName := "" if v := props.MaintenanceConfigurationID; v != nil { - maintenanceConfigId, err := publicmaintenanceconfigurations.ParsePublicMaintenanceConfigurationID(*v) + maintenanceConfigId, err := publicmaintenanceconfigurations.ParsePublicMaintenanceConfigurationIDInsensitively(*v) if err != nil { return err } - configurationName = maintenanceConfigId.ResourceName + configurationName = maintenanceConfigId.PublicMaintenanceConfigurationName } d.Set("maintenance_configuration_name", configurationName) diff --git a/internal/services/mssql/mssql_elasticpool_resource.go b/internal/services/mssql/mssql_elasticpool_resource.go index 8f5bdc4c5ec5..b10272c64d7f 100644 --- a/internal/services/mssql/mssql_elasticpool_resource.go +++ b/internal/services/mssql/mssql_elasticpool_resource.go @@ -308,11 +308,11 @@ func resourceMsSqlElasticPoolRead(d *pluginsdk.ResourceData, meta interface{}) e return fmt.Errorf("setting `per_database_settings`: %+v", err) } - maintenanceConfigId, err := publicmaintenanceconfigurations.ParsePublicMaintenanceConfigurationID(*properties.MaintenanceConfigurationID) + maintenanceConfigId, err := publicmaintenanceconfigurations.ParsePublicMaintenanceConfigurationIDInsensitively(*properties.MaintenanceConfigurationID) if err != nil { return err } - d.Set("maintenance_configuration_name", maintenanceConfigId.ResourceName) + d.Set("maintenance_configuration_name", maintenanceConfigId.PublicMaintenanceConfigurationName) } return tags.FlattenAndSet(d, resp.Tags) diff --git a/internal/services/mssql/mssql_managed_instance_active_directory_administrator_resource_test.go b/internal/services/mssql/mssql_managed_instance_active_directory_administrator_resource_test.go index f13e51adc4d5..8d3a33abd0ee 100644 --- a/internal/services/mssql/mssql_managed_instance_active_directory_administrator_resource_test.go +++ b/internal/services/mssql/mssql_managed_instance_active_directory_administrator_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -26,14 +25,14 @@ func TestAccMsSqlManagedInstanceActiveDirectoryAdministrator_basic(t *testing.T) }, { Config: r.basic(data, true), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("administrator_login_password"), { Config: r.basic(data, false), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -41,7 +40,7 @@ func TestAccMsSqlManagedInstanceActiveDirectoryAdministrator_basic(t *testing.T) }) } -func (r MsSqlManagedInstanceActiveDirectoryAdministratorResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r MsSqlManagedInstanceActiveDirectoryAdministratorResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.ManagedInstanceAzureActiveDirectoryAdministratorID(state.ID) if err != nil { return nil, err diff --git a/internal/services/mssql/mssql_managed_instance_data_source.go b/internal/services/mssql/mssql_managed_instance_data_source.go index afbcba361895..a86813b6b08e 100644 --- a/internal/services/mssql/mssql_managed_instance_data_source.go +++ b/internal/services/mssql/mssql_managed_instance_data_source.go @@ -164,13 +164,10 @@ func (d MsSqlManagedInstanceDataSource) Read() sdk.ResourceFunc { } id := parse.NewManagedInstanceID(subscriptionId, state.ResourceGroupName, state.Name) - - metadata.Logger.Infof("Reading %s", id) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name, "") if err != nil { if utils.ResponseWasNotFound(resp.Response) { - return metadata.MarkAsGone(id) + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %v", id, err) } diff --git a/internal/services/mssql/mssql_managed_instance_failover_group_resource_test.go b/internal/services/mssql/mssql_managed_instance_failover_group_resource_test.go index a6327c51ac66..443ee3215285 100644 --- a/internal/services/mssql/mssql_managed_instance_failover_group_resource_test.go +++ b/internal/services/mssql/mssql_managed_instance_failover_group_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -30,14 +29,14 @@ func TestAccMsSqlManagedInstanceFailoverGroup_update(t *testing.T) { }, { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.update(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -49,7 +48,7 @@ func TestAccMsSqlManagedInstanceFailoverGroup_update(t *testing.T) { }) } -func (r MsSqlManagedInstanceFailoverGroupResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r MsSqlManagedInstanceFailoverGroupResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.InstanceFailoverGroupID(state.ID) if err != nil { return nil, err diff --git a/internal/services/mssql/mssql_managed_instance_resource.go b/internal/services/mssql/mssql_managed_instance_resource.go index 4b6991ed7730..32df93c384cd 100644 --- a/internal/services/mssql/mssql_managed_instance_resource.go +++ b/internal/services/mssql/mssql_managed_instance_resource.go @@ -398,7 +398,7 @@ func (r MsSqlManagedInstanceResource) Update() sdk.ResourceFunc { properties.MaintenanceConfigurationID = utils.String(maintenanceConfigId.ID()) } - if metadata.ResourceData.HasChange("administrator_password") { + if metadata.ResourceData.HasChange("administrator_login_password") { properties.AdministratorLoginPassword = utils.String(state.AdministratorLoginPassword) } @@ -475,11 +475,11 @@ func (r MsSqlManagedInstanceResource) Read() sdk.ResourceFunc { model.Fqdn = *props.FullyQualifiedDomainName } if props.MaintenanceConfigurationID != nil { - maintenanceConfigId, err := publicmaintenanceconfigurations.ParsePublicMaintenanceConfigurationID(*props.MaintenanceConfigurationID) + maintenanceConfigId, err := publicmaintenanceconfigurations.ParsePublicMaintenanceConfigurationIDInsensitively(*props.MaintenanceConfigurationID) if err != nil { return err } - model.MaintenanceConfigurationName = maintenanceConfigId.ResourceName + model.MaintenanceConfigurationName = maintenanceConfigId.PublicMaintenanceConfigurationName } if props.MinimalTLSVersion != nil { model.MinimumTlsVersion = *props.MinimalTLSVersion diff --git a/internal/services/mssql/mssql_managed_instance_resource_test.go b/internal/services/mssql/mssql_managed_instance_resource_test.go index 138ff3861902..dead6b7bfe75 100644 --- a/internal/services/mssql/mssql_managed_instance_resource_test.go +++ b/internal/services/mssql/mssql_managed_instance_resource_test.go @@ -5,18 +5,22 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) type MsSqlManagedInstanceResource struct{} const managedInstanceStaticRoutes = ` + route { + name = "Microsoft.Sql-managedInstances_UseOnly_mi-OneDsCollector" + address_prefix = "OneDsCollector" + next_hop_type = "Internet" + } route { name = "mi-13-64-11-nexthop-internet" address_prefix = "13.64.0.0/11" @@ -988,10 +992,10 @@ func TestAccMsSqlManagedInstance_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_mssql_managed_instance", "test") r := MsSqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -1003,24 +1007,24 @@ func TestAccMsSqlManagedInstance_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_mssql_managed_instance", "test") r := MsSqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("administrator_login_password"), { Config: r.update(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("administrator_login_password"), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -1032,10 +1036,10 @@ func TestAccMsSqlManagedInstance_premium(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_mssql_managed_instance", "test") r := MsSqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.premium(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -1047,10 +1051,10 @@ func TestAccMsSqlManagedInstance_backupRedundancyLRS(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_mssql_managed_instance", "test") r := MsSqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.storageType(data, "LRS"), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -1062,10 +1066,10 @@ func TestAccMsSqlManagedInstance_identity(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_mssql_managed_instance", "test") r := MsSqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("identity.#").HasValue("0"), ), @@ -1073,7 +1077,7 @@ func TestAccMsSqlManagedInstance_identity(t *testing.T) { data.ImportStep("administrator_login_password"), { Config: r.identity(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("identity.#").HasValue("1"), check.That(data.ResourceName).Key("identity.0.type").HasValue("SystemAssigned"), @@ -1085,7 +1089,7 @@ func TestAccMsSqlManagedInstance_identity(t *testing.T) { /* { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("identity.#").HasValue("0"), ), @@ -1099,24 +1103,24 @@ func TestAccMsSqlManagedInstance_multiple(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_mssql_managed_instance", "test") r := MsSqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("administrator_login_password"), { Config: r.multiple(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("administrator_login_password"), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -1128,17 +1132,17 @@ func TestAccMsSqlManagedInstance_dnsZonePartner(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_mssql_managed_instance", "test") r := MsSqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.dnsZonePartnerPrep(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("administrator_login_password"), { Config: r.dnsZonePartner(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -1146,7 +1150,7 @@ func TestAccMsSqlManagedInstance_dnsZonePartner(t *testing.T) { { // DNS Zone Partner empty makes delete faster as MI can be destroyed simultaneously Config: r.emptyDnsZonePartner(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -1158,17 +1162,17 @@ func TestAccMsSqlManagedInstance_multipleDnsZonePartners(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_mssql_managed_instance", "test") r := MsSqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.dnsZonePartnersPrep(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("administrator_login_password"), { Config: r.dnsZonePartners(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -1176,7 +1180,7 @@ func TestAccMsSqlManagedInstance_multipleDnsZonePartners(t *testing.T) { { // DNS Zone Partner empty makes delete faster as MI can be destroyed simultaneously Config: r.emptyDnsZonePartners(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -1188,10 +1192,10 @@ func TestAccMsSqlManagedInstance_withMaintenanceConfig(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_mssql_managed_instance", "test") r := MsSqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.withMaintenanceConfig(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -1199,7 +1203,7 @@ func TestAccMsSqlManagedInstance_withMaintenanceConfig(t *testing.T) { }) } -func (r MsSqlManagedInstanceResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r MsSqlManagedInstanceResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.ManagedInstanceID(state.ID) if err != nil { return nil, err @@ -1768,7 +1772,7 @@ resource "azurerm_network_security_rule" "deny_all_inbound_1" { resource "azurerm_network_security_rule" "allow_management_outbound_1" { name = "allow_management_outbound" - priority = 102 + priority = 110 direction = "Outbound" access = "Allow" protocol = "Tcp" @@ -2003,7 +2007,7 @@ resource "azurerm_network_security_rule" "deny_all_inbound_2" { resource "azurerm_network_security_rule" "allow_management_outbound_2" { name = "allow_management_outbound" - priority = 102 + priority = 110 direction = "Outbound" access = "Allow" protocol = "Tcp" @@ -2238,7 +2242,7 @@ resource "azurerm_network_security_rule" "deny_all_inbound_3" { resource "azurerm_network_security_rule" "allow_management_outbound_3" { name = "allow_management_outbound" - priority = 102 + priority = 110 direction = "Outbound" access = "Allow" protocol = "Tcp" diff --git a/internal/services/mssql/mssql_virtual_network_rule_resource.go b/internal/services/mssql/mssql_virtual_network_rule_resource.go index b5afc0be11a4..135102956867 100644 --- a/internal/services/mssql/mssql_virtual_network_rule_resource.go +++ b/internal/services/mssql/mssql_virtual_network_rule_resource.go @@ -151,7 +151,7 @@ func resourceMsSqlVirtualNetworkRuleRead(d *pluginsdk.ResourceData, meta interfa subnetId := "" if sid := props.VirtualNetworkSubnetID; sid != nil { - id, err := networkParse.SubnetID(*props.VirtualNetworkSubnetID) + id, err := networkParse.SubnetIDInsensitively(*props.VirtualNetworkSubnetID) if err != nil { return fmt.Errorf("parsing subnet ID returned by API %q: %+v", *sid, err) } diff --git a/internal/services/mssql/resourceids.go b/internal/services/mssql/resourceids.go index 50d6f8ce6fd5..e6d447997050 100644 --- a/internal/services/mssql/resourceids.go +++ b/internal/services/mssql/resourceids.go @@ -16,7 +16,6 @@ package mssql //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ManagedInstanceEncryptionProtector -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Sql/managedInstances/instance1/encryptionProtector/current //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ManagedInstanceVulnerabilityAssessment -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Sql/managedInstances/instance1/vulnerabilityAssessments/assessment1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=OutboundFirewallRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/outboundFirewallRules/fqdn1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=RecoverableDatabase -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/recoverabledatabases/database1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Server -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Sql/servers/server1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ServerDNSAlias -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/dnsAliases/default //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ServerExtendedAuditingPolicy -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/extendedAuditingSettings/default @@ -26,3 +25,6 @@ package mssql //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SqlVirtualMachine -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/virtualMachine1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=VirtualNetworkRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Sql/servers/server1/virtualNetworkRules/virtualNetworkRule1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ManagedInstancesSecurityAlertPolicy -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Sql/managedInstances/instance1/securityAlertPolicies/Default + +// @tombuildsstuff: this resource id going to need a state migration prior to migrating to `hashicorp/go-azure-sdk` +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=RecoverableDatabase -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/recoverabledatabases/database1 diff --git a/internal/services/mysql/mysql_flexible_server_data_source.go b/internal/services/mysql/mysql_flexible_server_data_source.go index cc73b98a9b43..b18821f13641 100644 --- a/internal/services/mysql/mysql_flexible_server_data_source.go +++ b/internal/services/mysql/mysql_flexible_server_data_source.go @@ -182,7 +182,7 @@ func dataSourceMysqlFlexibleServerRead(d *pluginsdk.ResourceData, meta interface } d.SetId(id.ID()) - d.Set("name", id.ServerName) + d.Set("name", id.FlexibleServerName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/mysql/mysql_flexible_server_resource.go b/internal/services/mysql/mysql_flexible_server_resource.go index 09e6fec81b33..59cb078d4ca4 100644 --- a/internal/services/mysql/mysql_flexible_server_resource.go +++ b/internal/services/mysql/mysql_flexible_server_resource.go @@ -301,7 +301,7 @@ func resourceMysqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta interface existing, err := client.Get(ctx, id) if err != nil { if !response.WasNotFound(existing.HttpResponse) { - return fmt.Errorf("checking for present of existing Mysql Flexible Server %q (Resource Group %q): %+v", id.ServerName, id.ResourceGroupName, err) + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } if !response.WasNotFound(existing.HttpResponse) { @@ -340,7 +340,7 @@ func resourceMysqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta interface sku, err := expandFlexibleServerSku(d.Get("sku_name").(string)) if err != nil { - return fmt.Errorf("expanding `sku_name` for MySql Flexible Server %s (Resource Group %q): %v", id.ServerName, id.ResourceGroupName, err) + return fmt.Errorf("expanding `sku_name` for %s: %+v", id, err) } version := servers.ServerVersion(d.Get("version").(string)) @@ -419,7 +419,7 @@ func resourceMysqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta interface }, } if err := client.UpdateThenPoll(ctx, id, mwParams); err != nil { - return fmt.Errorf("updating Mysql Flexible Server %q maintenance window (Resource Group %q): %+v", id.ServerName, id.ResourceGroupName, err) + return fmt.Errorf("updating Maintenance Window for %s: %+v", id, err) } } @@ -458,10 +458,10 @@ func resourceMysqlFlexibleServerRead(d *pluginsdk.ResourceData, meta interface{} d.SetId("") return nil } - return fmt.Errorf("retrieving Mysql Flexible Server %q (Resource Group %q): %+v", id.ServerName, id.ResourceGroupName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.ServerName) + d.Set("name", id.FlexibleServerName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { @@ -515,7 +515,7 @@ func resourceMysqlFlexibleServerRead(d *pluginsdk.ResourceData, meta interface{} } sku, err := flattenFlexibleServerSku(model.Sku) if err != nil { - return fmt.Errorf("flattening `sku_name` for Mysql Flexible Server %s (Resource Group %q): %v", id.ServerName, id.ResourceGroupName, err) + return fmt.Errorf("flattening `sku_name`: %+v", err) } d.Set("sku_name", sku) @@ -577,7 +577,7 @@ func resourceMysqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta interface } if err := client.UpdateThenPoll(ctx, *id, parameters); err != nil { - return fmt.Errorf("updating Mysql Flexible Server %q (Resource Group %q) to update `replication_role`: %+v", id.ServerName, id.ResourceGroupName, err) + return fmt.Errorf("updating `replication_role` for %s: %+v", *id, err) } } else { return fmt.Errorf("`replication_role` only can be updated from `Replica` to `None`") @@ -594,13 +594,13 @@ func resourceMysqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta interface } if err := client.UpdateThenPoll(ctx, *id, parameters); err != nil { - return fmt.Errorf("updating Mysql Flexible Server %q (Resource Group %q) to enable `auto_grow_enabled`: %+v", id.ServerName, id.ResourceGroupName, err) + return fmt.Errorf("enabling `auto_grow_enabled` for %s: %+v", *id, err) } } if requireFailover { failoverClient := meta.(*clients.Client).MySQL.FlexibleServerFailoverClient - failoverID := serverfailover.NewFlexibleServerID(id.SubscriptionId, id.ResourceGroupName, id.ServerName) + failoverID := serverfailover.NewFlexibleServerID(id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName) if err := failoverClient.ServersFailoverThenPoll(ctx, failoverID); err != nil { return fmt.Errorf("failing over %s: %+v", *id, err) @@ -616,14 +616,14 @@ func resourceMysqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta interface } if err := client.UpdateThenPoll(ctx, *id, parameters); err != nil { - return fmt.Errorf("updating Mysql Flexible Server %q (Resource Group %q) to disable `high_availability`: %+v", id.ServerName, id.ResourceGroupName, err) + return fmt.Errorf("disabling `high_availability` for %s: %+v", *id, err) } parameters.Properties.HighAvailability = expandFlexibleServerHighAvailability(d.Get("high_availability").([]interface{})) if *parameters.Properties.HighAvailability.Mode != servers.HighAvailabilityModeDisabled { if err = client.UpdateThenPoll(ctx, *id, parameters); err != nil { - return fmt.Errorf("updating Mysql Flexible Server %q (Resource Group %q) to update `high_availability`: %+v", id.ServerName, id.ResourceGroupName, err) + return fmt.Errorf("updating `high_availability` for %s: %+v", *id, err) } } } @@ -647,7 +647,7 @@ func resourceMysqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta interface if d.HasChange("identity") { identity, err := expandFlexibleServerIdentity(d.Get("identity").([]interface{})) if err != nil { - return fmt.Errorf("expanding `identity` for Mysql Flexible Server %s (Resource Group %q): %v", id.ServerName, id.ResourceGroupName, err) + return fmt.Errorf("expanding `identity`: %+v", err) } parameters.Identity = identity } @@ -659,7 +659,7 @@ func resourceMysqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta interface if d.HasChange("sku_name") { sku, err := expandFlexibleServerSku(d.Get("sku_name").(string)) if err != nil { - return fmt.Errorf("expanding `sku_name` for Mysql Flexible Server %s (Resource Group %q): %v", id.ServerName, id.ResourceGroupName, err) + return fmt.Errorf("expanding `sku_name`: %+v", err) } parameters.Sku = sku } @@ -669,7 +669,7 @@ func resourceMysqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta interface } if err := client.UpdateThenPoll(ctx, *id, parameters); err != nil { - return fmt.Errorf("updating Mysql Flexible Server %q (Resource Group %q): %+v", id.ServerName, id.ResourceGroupName, err) + return fmt.Errorf("updating %s: %+v", *id, err) } if d.HasChange("storage") && !d.Get("storage.0.auto_grow_enabled").(bool) { @@ -680,7 +680,7 @@ func resourceMysqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta interface } if err := client.UpdateThenPoll(ctx, *id, parameters); err != nil { - return fmt.Errorf("updating Mysql Flexible Server %q (Resource Group %q) to disable `auto_grow_enabled`: %+v", id.ServerName, id.ResourceGroupName, err) + return fmt.Errorf("disabling `auto_grow_enabled` for %s: %+v", *id, err) } } diff --git a/internal/services/mysql/mysql_flexible_server_resource_test.go b/internal/services/mysql/mysql_flexible_server_resource_test.go index 44ec5307124d..25bee123c2bd 100644 --- a/internal/services/mysql/mysql_flexible_server_resource_test.go +++ b/internal/services/mysql/mysql_flexible_server_resource_test.go @@ -471,7 +471,7 @@ func (MySqlFlexibleServerResource) Exists(ctx context.Context, clients *clients. resp, err := clients.MySQL.FlexibleServerClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving MySql Flexible Server %q (resource group: %q): %+v", id.ServerName, id.ResourceGroupName, err) + return nil, fmt.Errorf("retrieving %s: %+v", id.ID(), err) } return utils.Bool(resp.Model != nil && resp.Model.Properties != nil), nil diff --git a/internal/services/mysql/parse/server.go b/internal/services/mysql/parse/server.go index d05075b10ec5..1d1083de8d73 100644 --- a/internal/services/mysql/parse/server.go +++ b/internal/services/mysql/parse/server.go @@ -67,3 +67,47 @@ func ServerID(input string) (*ServerId, error) { return &resourceId, nil } + +// ServerIDInsensitively parses an Server ID into an ServerId struct, insensitively +// This should only be used to parse an ID for rewriting, the ServerID +// method should be used instead for validation etc. +// +// Whilst this may seem strange, this enables Terraform have consistent casing +// which works around issues in Core, whilst handling broken API responses. +func ServerIDInsensitively(input string) (*ServerId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := ServerId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + // find the correct casing for the 'servers' segment + serversKey := "servers" + for key := range id.Path { + if strings.EqualFold(key, serversKey) { + serversKey = key + break + } + } + if resourceId.Name, err = id.PopSegment(serversKey); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/internal/services/mysql/parse/server_test.go b/internal/services/mysql/parse/server_test.go index 5eaeb4609f84..dd32612bb8f2 100644 --- a/internal/services/mysql/parse/server_test.go +++ b/internal/services/mysql/parse/server_test.go @@ -110,3 +110,120 @@ func TestServerID(t *testing.T) { } } } + +func TestServerIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ServerId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/", + Error: true, + }, + + { + // missing value for Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1", + Expected: &ServerId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + Name: "server1", + }, + }, + + { + // lower-cased segment names + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1", + Expected: &ServerId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + Name: "server1", + }, + }, + + { + // upper-cased segment names + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/SERVERS/server1", + Expected: &ServerId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + Name: "server1", + }, + }, + + { + // mixed-cased segment names + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/SeRvErS/server1", + Expected: &ServerId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + Name: "server1", + }, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ServerIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.Name != v.Expected.Name { + t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) + } + } +} diff --git a/internal/services/mysql/resourceids.go b/internal/services/mysql/resourceids.go index 0bd4776667b6..3eadc9988b1e 100644 --- a/internal/services/mysql/resourceids.go +++ b/internal/services/mysql/resourceids.go @@ -9,5 +9,5 @@ package mysql //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FlexibleServerConfiguration -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/flexibleServers/flexibleServer1/configurations/config1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FlexibleServerFirewallRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/flexibleServers/flexibleServer1/firewallRules/firewallRule1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Key -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/keys/key1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Server -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Server -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=VirtualNetworkRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMySQL/servers/server1/virtualNetworkRules/virtualNetworkRule1 diff --git a/internal/services/netapp/netapp_account_data_source.go b/internal/services/netapp/netapp_account_data_source.go index a804fd8ba80a..c66ddecf0247 100644 --- a/internal/services/netapp/netapp_account_data_source.go +++ b/internal/services/netapp/netapp_account_data_source.go @@ -55,7 +55,7 @@ func dataSourceNetAppAccountRead(d *pluginsdk.ResourceData, meta interface{}) er } d.SetId(id.ID()) - d.Set("name", id.AccountName) + d.Set("name", id.NetAppAccountName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/netapp/netapp_account_resource.go b/internal/services/netapp/netapp_account_resource.go index dff3b7e01f4f..2e8a11b5253d 100644 --- a/internal/services/netapp/netapp_account_resource.go +++ b/internal/services/netapp/netapp_account_resource.go @@ -210,7 +210,7 @@ func resourceNetAppAccountRead(d *pluginsdk.ResourceData, meta interface{}) erro return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.AccountName) + d.Set("name", id.NetAppAccountName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/netapp/netapp_pool_data_source.go b/internal/services/netapp/netapp_pool_data_source.go index 4c0a99656dcb..d40fd6d50447 100644 --- a/internal/services/netapp/netapp_pool_data_source.go +++ b/internal/services/netapp/netapp_pool_data_source.go @@ -69,8 +69,8 @@ func dataSourceNetAppPoolRead(d *pluginsdk.ResourceData, meta interface{}) error } d.SetId(id.ID()) - d.Set("name", id.PoolName) - d.Set("account_name", id.AccountName) + d.Set("name", id.CapacityPoolName) + d.Set("account_name", id.NetAppAccountName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/netapp/netapp_pool_resource.go b/internal/services/netapp/netapp_pool_resource.go index 907472cd8554..be97f1ec4935 100644 --- a/internal/services/netapp/netapp_pool_resource.go +++ b/internal/services/netapp/netapp_pool_resource.go @@ -211,9 +211,9 @@ func resourceNetAppPoolRead(d *pluginsdk.ResourceData, meta interface{}) error { return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.PoolName) + d.Set("name", id.CapacityPoolName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("account_name", id.AccountName) + d.Set("account_name", id.NetAppAccountName) if model := resp.Model; model != nil { d.Set("location", azure.NormalizeLocation(model.Location)) diff --git a/internal/services/netapp/netapp_snapshot_data_source.go b/internal/services/netapp/netapp_snapshot_data_source.go index 1ccd8ddcd11a..820ff7aa5db2 100644 --- a/internal/services/netapp/netapp_snapshot_data_source.go +++ b/internal/services/netapp/netapp_snapshot_data_source.go @@ -72,8 +72,8 @@ func dataSourceNetAppSnapshotRead(d *pluginsdk.ResourceData, meta interface{}) e d.SetId(id.ID()) d.Set("name", id.SnapshotName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("account_name", id.AccountName) - d.Set("pool_name", id.PoolName) + d.Set("account_name", id.NetAppAccountName) + d.Set("pool_name", id.CapacityPoolName) d.Set("volume_name", id.VolumeName) if model := resp.Model; model != nil { diff --git a/internal/services/netapp/netapp_snapshot_policy_data_source.go b/internal/services/netapp/netapp_snapshot_policy_data_source.go index df3a2729d724..7ca818c318fe 100644 --- a/internal/services/netapp/netapp_snapshot_policy_data_source.go +++ b/internal/services/netapp/netapp_snapshot_policy_data_source.go @@ -171,7 +171,7 @@ func dataSourceNetAppSnapshotPolicyRead(d *pluginsdk.ResourceData, meta interfac d.SetId(id.ID()) d.Set("name", id.SnapshotPolicyName) - d.Set("account_name", id.AccountName) + d.Set("account_name", id.NetAppAccountName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/netapp/netapp_snapshot_policy_resource.go b/internal/services/netapp/netapp_snapshot_policy_resource.go index d7601c048ab7..c833d164eca6 100644 --- a/internal/services/netapp/netapp_snapshot_policy_resource.go +++ b/internal/services/netapp/netapp_snapshot_policy_resource.go @@ -295,7 +295,7 @@ func resourceNetAppSnapshotPolicyRead(d *pluginsdk.ResourceData, meta interface{ d.Set("name", id.SnapshotPolicyName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("account_name", id.AccountName) + d.Set("account_name", id.NetAppAccountName) if model := resp.Model; model != nil { d.Set("location", azure.NormalizeLocation(model.Location)) diff --git a/internal/services/netapp/netapp_snapshot_resource.go b/internal/services/netapp/netapp_snapshot_resource.go index d5fedc28e8aa..e4fba9b0a830 100644 --- a/internal/services/netapp/netapp_snapshot_resource.go +++ b/internal/services/netapp/netapp_snapshot_resource.go @@ -126,8 +126,8 @@ func resourceNetAppSnapshotRead(d *pluginsdk.ResourceData, meta interface{}) err d.Set("name", id.SnapshotName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("account_name", id.AccountName) - d.Set("pool_name", id.PoolName) + d.Set("account_name", id.NetAppAccountName) + d.Set("pool_name", id.CapacityPoolName) d.Set("volume_name", id.VolumeName) if model := resp.Model; model != nil { diff --git a/internal/services/netapp/netapp_volume_data_source.go b/internal/services/netapp/netapp_volume_data_source.go index d843b7483697..09d7965bbe96 100644 --- a/internal/services/netapp/netapp_volume_data_source.go +++ b/internal/services/netapp/netapp_volume_data_source.go @@ -137,12 +137,12 @@ func dataSourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) err d.SetId(id.ID()) d.Set("name", id.VolumeName) - d.Set("pool_name", id.PoolName) - d.Set("account_name", id.AccountName) + d.Set("pool_name", id.CapacityPoolName) + d.Set("account_name", id.NetAppAccountName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { - d.Set("location", location.NormalizeNilable(&model.Location)) + d.Set("location", location.Normalize(model.Location)) zone := "" if model.Zones != nil { diff --git a/internal/services/netapp/netapp_volume_resource.go b/internal/services/netapp/netapp_volume_resource.go index 323d9b36ee0f..1a5bdc9b4dd7 100644 --- a/internal/services/netapp/netapp_volume_resource.go +++ b/internal/services/netapp/netapp_volume_resource.go @@ -391,7 +391,7 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err snapshotID = *model.Id } - sourceVolumeId := volumes.NewVolumeID(parsedSnapshotResourceID.SubscriptionId, parsedSnapshotResourceID.ResourceGroupName, parsedSnapshotResourceID.AccountName, parsedSnapshotResourceID.PoolName, parsedSnapshotResourceID.VolumeName) + sourceVolumeId := volumes.NewVolumeID(parsedSnapshotResourceID.SubscriptionId, parsedSnapshotResourceID.ResourceGroupName, parsedSnapshotResourceID.NetAppAccountName, parsedSnapshotResourceID.CapacityPoolName, parsedSnapshotResourceID.VolumeName) // Validate if properties that cannot be changed matches (protocols, subnet_id, location, resource group, account_name, pool_name, service_level) sourceVolume, err := client.Get(ctx, sourceVolumeId) if err != nil { @@ -418,10 +418,10 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err if !strings.EqualFold(sourceVolumeId.ResourceGroupName, id.ResourceGroupName) { propertyMismatch = append(propertyMismatch, "resource_group_name") } - if !strings.EqualFold(sourceVolumeId.AccountName, id.AccountName) { + if !strings.EqualFold(sourceVolumeId.NetAppAccountName, id.NetAppAccountName) { propertyMismatch = append(propertyMismatch, "account_name") } - if !strings.EqualFold(sourceVolumeId.PoolName, id.PoolName) { + if !strings.EqualFold(sourceVolumeId.CapacityPoolName, id.CapacityPoolName) { propertyMismatch = append(propertyMismatch, "pool_name") } if len(propertyMismatch) > 0 { @@ -594,8 +594,8 @@ func resourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("name", id.VolumeName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("account_name", id.AccountName) - d.Set("pool_name", id.PoolName) + d.Set("account_name", id.NetAppAccountName) + d.Set("pool_name", id.CapacityPoolName) if model := resp.Model; model != nil { d.Set("location", azure.NormalizeLocation(model.Location)) diff --git a/internal/services/netapp/netapp_volume_resource_test.go b/internal/services/netapp/netapp_volume_resource_test.go index 959b0eda1b4f..da1ce49dd80b 100644 --- a/internal/services/netapp/netapp_volume_resource_test.go +++ b/internal/services/netapp/netapp_volume_resource_test.go @@ -302,6 +302,7 @@ resource "azurerm_netapp_volume" "test" { service_level = "Standard" subnet_id = azurerm_subnet.test.id storage_quota_in_gb = 100 + throughput_in_mibps = 1.562 tags = { "CreatedOnDate" = "2022-07-08T23:50:21Z", @@ -388,6 +389,7 @@ resource "azurerm_netapp_volume" "test" { network_features = "Standard" protocols = ["NFSv3"] storage_quota_in_gb = 100 + throughput_in_mibps = 1.562 tags = { "CreatedOnDate" = "2022-07-08T23:50:21Z", @@ -532,7 +534,7 @@ resource "azurerm_netapp_volume" "test" { export_policy_rule { rule_index = 1 - allowed_clients = ["1.2.3.0/24"] + allowed_clients = ["0.0.0.0/0"] protocols_enabled = ["NFSv3"] unix_read_only = false unix_read_write = true @@ -651,10 +653,11 @@ resource "azurerm_netapp_volume" "test" { subnet_id = azurerm_subnet.test.id protocols = ["NFSv3"] storage_quota_in_gb = 101 + throughput_in_mibps = 1.562 export_policy_rule { rule_index = 1 - allowed_clients = ["1.2.3.0/24"] + allowed_clients = ["0.0.0.0/0"] protocols_enabled = ["NFSv3"] unix_read_only = false unix_read_write = true @@ -662,7 +665,7 @@ resource "azurerm_netapp_volume" "test" { export_policy_rule { rule_index = 2 - allowed_clients = ["1.2.5.0"] + allowed_clients = ["0.0.0.0/0"] protocols_enabled = ["NFSv3"] unix_read_only = true unix_read_write = false @@ -670,7 +673,7 @@ resource "azurerm_netapp_volume" "test" { export_policy_rule { rule_index = 3 - allowed_clients = ["1.2.6.0/24"] + allowed_clients = ["0.0.0.0/0"] protocols_enabled = ["NFSv3"] unix_read_only = true unix_read_write = false @@ -987,6 +990,7 @@ resource "azurerm_netapp_pool" "test" { account_name = azurerm_netapp_account.test.name service_level = "Standard" size_in_tb = 4 + qos_type = "Manual" tags = { "CreatedOnDate" = "2022-07-08T23:50:21Z", diff --git a/internal/services/network/application_gateway_resource.go b/internal/services/network/application_gateway_resource.go index 782671cf9eb8..edcdd0d8248b 100644 --- a/internal/services/network/application_gateway_resource.go +++ b/internal/services/network/application_gateway_resource.go @@ -25,7 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) // See https://github.com/Azure/azure-sdk-for-go/blob/master/services/network/mgmt/2018-04-01/network/models.go diff --git a/internal/services/network/application_gateway_resource_test.go b/internal/services/network/application_gateway_resource_test.go index 0c3b79e10aeb..cc2369914829 100644 --- a/internal/services/network/application_gateway_resource_test.go +++ b/internal/services/network/application_gateway_resource_test.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type ApplicationGatewayResource struct{} diff --git a/internal/services/network/application_security_group_resource.go b/internal/services/network/application_security_group_resource.go index 31edb146a412..8e69efc5d03f 100644 --- a/internal/services/network/application_security_group_resource.go +++ b/internal/services/network/application_security_group_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceApplicationSecurityGroup() *pluginsdk.Resource { diff --git a/internal/services/network/azuresdkhacks/network_interface.go b/internal/services/network/azuresdkhacks/network_interface.go index 022fde143dd8..bb57649bb442 100644 --- a/internal/services/network/azuresdkhacks/network_interface.go +++ b/internal/services/network/azuresdkhacks/network_interface.go @@ -8,7 +8,7 @@ import ( "net/http" "github.com/Azure/go-autorest/autorest" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) // UpdateNetworkInterfaceAllowingRemovalOfNSG patches our way around a design flaw in the Azure diff --git a/internal/services/network/bastion_host_data_source.go b/internal/services/network/bastion_host_data_source.go new file mode 100644 index 000000000000..0949c7b23144 --- /dev/null +++ b/internal/services/network/bastion_host_data_source.go @@ -0,0 +1,150 @@ +package network + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tags" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func dataSourceBastionHost() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceBastionHostRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.BastionHostName, + }, + + "copy_paste_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "file_copy_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "ip_configuration": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "subnet_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "public_ip_address_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "ip_connect_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "scale_units": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "shareable_link_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "sku": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tunneling_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "dns_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "location": commonschema.LocationComputed(), + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourceBastionHostRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Network.BastionHostsClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id := parse.NewBastionHostID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if location := resp.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) + } + + if sku := resp.Sku; sku != nil { + d.Set("sku", sku.Name) + } + + if props := resp.BastionHostPropertiesFormat; props != nil { + d.Set("dns_name", props.DNSName) + d.Set("scale_units", props.ScaleUnits) + d.Set("file_copy_enabled", props.EnableFileCopy) + d.Set("ip_connect_enabled", props.EnableIPConnect) + d.Set("shareable_link_enabled", props.EnableShareableLink) + d.Set("tunneling_enabled", props.EnableTunneling) + + copyPasteEnabled := true + if props.DisableCopyPaste != nil { + copyPasteEnabled = !*props.DisableCopyPaste + } + d.Set("copy_paste_enabled", copyPasteEnabled) + + if ipConfigs := props.IPConfigurations; ipConfigs != nil { + if err := d.Set("ip_configuration", flattenBastionHostIPConfiguration(ipConfigs)); err != nil { + return fmt.Errorf("flattening `ip_configuration`: %+v", err) + } + } + } + + d.SetId(id.ID()) + + return tags.FlattenAndSet(d, resp.Tags) +} diff --git a/internal/services/network/bastion_host_data_source_test.go b/internal/services/network/bastion_host_data_source_test.go new file mode 100644 index 000000000000..7c718e483fc4 --- /dev/null +++ b/internal/services/network/bastion_host_data_source_test.go @@ -0,0 +1,46 @@ +package network_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type BastionHostDataSource struct{} + +func TestAccBastionHostDataSource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_bastion_host", "test") + r := BastionHostDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("id").Exists(), + check.That(data.ResourceName).Key("location").Exists(), + check.That(data.ResourceName).Key("sku").Exists(), + check.That(data.ResourceName).Key("dns_name").Exists(), + check.That(data.ResourceName).Key("scale_units").Exists(), + check.That(data.ResourceName).Key("file_copy_enabled").Exists(), + check.That(data.ResourceName).Key("ip_connect_enabled").Exists(), + check.That(data.ResourceName).Key("shareable_link_enabled").Exists(), + check.That(data.ResourceName).Key("ip_configuration.0.name").Exists(), + check.That(data.ResourceName).Key("ip_configuration.0.subnet_id").Exists(), + check.That(data.ResourceName).Key("ip_configuration.0.public_ip_address_id").Exists(), + ), + }, + }) +} + +func (BastionHostDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +data "azurerm_bastion_host" "test" { + name = azurerm_bastion_host.test.name + resource_group_name = azurerm_bastion_host.test.resource_group_name +} +`, BastionHostResource{}.basic(data)) +} diff --git a/internal/services/network/bastion_host_resource.go b/internal/services/network/bastion_host_resource.go index b2ef33c4849a..540c09b2e750 100644 --- a/internal/services/network/bastion_host_resource.go +++ b/internal/services/network/bastion_host_resource.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceBastionHost() *pluginsdk.Resource { diff --git a/internal/services/network/client/client.go b/internal/services/network/client/client.go index 7d1d8f67be91..7a0c334b3a06 100644 --- a/internal/services/network/client/client.go +++ b/internal/services/network/client/client.go @@ -2,71 +2,77 @@ package client import ( "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type Client struct { - ApplicationGatewaysClient *network.ApplicationGatewaysClient - ApplicationSecurityGroupsClient *network.ApplicationSecurityGroupsClient - BastionHostsClient *network.BastionHostsClient - ConfigurationPolicyGroupClient *network.ConfigurationPolicyGroupsClient - ConnectionMonitorsClient *network.ConnectionMonitorsClient - DDOSProtectionPlansClient *network.DdosProtectionPlansClient - ExpressRouteAuthsClient *network.ExpressRouteCircuitAuthorizationsClient - ExpressRouteCircuitsClient *network.ExpressRouteCircuitsClient - ExpressRouteCircuitConnectionClient *network.ExpressRouteCircuitConnectionsClient - ExpressRouteConnectionsClient *network.ExpressRouteConnectionsClient - ExpressRouteGatewaysClient *network.ExpressRouteGatewaysClient - ExpressRoutePeeringsClient *network.ExpressRouteCircuitPeeringsClient - ExpressRoutePortsClient *network.ExpressRoutePortsClient - FlowLogsClient *network.FlowLogsClient - HubRouteTableClient *network.HubRouteTablesClient - HubVirtualNetworkConnectionClient *network.HubVirtualNetworkConnectionsClient - InterfacesClient *network.InterfacesClient - IPGroupsClient *network.IPGroupsClient - LocalNetworkGatewaysClient *network.LocalNetworkGatewaysClient - ManagersClient *network.ManagersClient - ManagerManagementGroupConnectionsClient *network.ManagementGroupNetworkManagerConnectionsClient - ManagerNetworkGroupsClient *network.GroupsClient - ManagerSubscriptionConnectionsClient *network.SubscriptionNetworkManagerConnectionsClient - NatRuleClient *network.NatRulesClient - PointToSiteVpnGatewaysClient *network.P2sVpnGatewaysClient - ProfileClient *network.ProfilesClient - PacketCapturesClient *network.PacketCapturesClient - PrivateEndpointClient *network.PrivateEndpointsClient - PublicIPsClient *network.PublicIPAddressesClient - PublicIPPrefixesClient *network.PublicIPPrefixesClient - RouteMapsClient *network.RouteMapsClient - RoutesClient *network.RoutesClient - RouteFiltersClient *network.RouteFiltersClient - RouteTablesClient *network.RouteTablesClient - SecurityGroupClient *network.SecurityGroupsClient - SecurityPartnerProviderClient *network.SecurityPartnerProvidersClient - SecurityRuleClient *network.SecurityRulesClient - ServiceEndpointPoliciesClient *network.ServiceEndpointPoliciesClient - ServiceEndpointPolicyDefinitionsClient *network.ServiceEndpointPolicyDefinitionsClient - ServiceTagsClient *network.ServiceTagsClient - SubnetsClient *network.SubnetsClient - NatGatewayClient *network.NatGatewaysClient - VirtualHubBgpConnectionClient *network.VirtualHubBgpConnectionClient - VirtualHubIPClient *network.VirtualHubIPConfigurationClient - VnetGatewayConnectionsClient *network.VirtualNetworkGatewayConnectionsClient - VnetGatewayNatRuleClient *network.VirtualNetworkGatewayNatRulesClient - VnetGatewayClient *network.VirtualNetworkGatewaysClient - VnetClient *network.VirtualNetworksClient - VnetPeeringsClient *network.VirtualNetworkPeeringsClient - VirtualWanClient *network.VirtualWansClient - VirtualHubClient *network.VirtualHubsClient - VpnConnectionsClient *network.VpnConnectionsClient - VpnGatewaysClient *network.VpnGatewaysClient - VpnServerConfigurationsClient *network.VpnServerConfigurationsClient - VpnSitesClient *network.VpnSitesClient - WatcherClient *network.WatchersClient - WebApplicationFirewallPoliciesClient *network.WebApplicationFirewallPoliciesClient - PrivateDnsZoneGroupClient *network.PrivateDNSZoneGroupsClient - PrivateLinkServiceClient *network.PrivateLinkServicesClient - ServiceAssociationLinkClient *network.ServiceAssociationLinksClient - ResourceNavigationLinkClient *network.ResourceNavigationLinksClient + ApplicationGatewaysClient *network.ApplicationGatewaysClient + ApplicationSecurityGroupsClient *network.ApplicationSecurityGroupsClient + BastionHostsClient *network.BastionHostsClient + ConfigurationPolicyGroupClient *network.ConfigurationPolicyGroupsClient + ConnectionMonitorsClient *network.ConnectionMonitorsClient + DDOSProtectionPlansClient *network.DdosProtectionPlansClient + ExpressRouteAuthsClient *network.ExpressRouteCircuitAuthorizationsClient + ExpressRouteCircuitsClient *network.ExpressRouteCircuitsClient + ExpressRouteCircuitConnectionClient *network.ExpressRouteCircuitConnectionsClient + ExpressRouteConnectionsClient *network.ExpressRouteConnectionsClient + ExpressRouteGatewaysClient *network.ExpressRouteGatewaysClient + ExpressRoutePeeringsClient *network.ExpressRouteCircuitPeeringsClient + ExpressRoutePortsClient *network.ExpressRoutePortsClient + FlowLogsClient *network.FlowLogsClient + HubRouteTableClient *network.HubRouteTablesClient + HubVirtualNetworkConnectionClient *network.HubVirtualNetworkConnectionsClient + InterfacesClient *network.InterfacesClient + IPGroupsClient *network.IPGroupsClient + LocalNetworkGatewaysClient *network.LocalNetworkGatewaysClient + ManagersClient *network.ManagersClient + ManagerAdminRulesClient *network.AdminRulesClient + ManagerAdminRuleCollectionsClient *network.AdminRuleCollectionsClient + ManagerConnectivityConfigurationsClient *network.ConnectivityConfigurationsClient + ManagerManagementGroupConnectionsClient *network.ManagementGroupNetworkManagerConnectionsClient + ManagerNetworkGroupsClient *network.GroupsClient + ManagerScopeConnectionsClient *network.ScopeConnectionsClient + ManagerSecurityAdminConfigurationsClient *network.SecurityAdminConfigurationsClient + ManagerStaticMembersClient *network.StaticMembersClient + ManagerSubscriptionConnectionsClient *network.SubscriptionNetworkManagerConnectionsClient + NatRuleClient *network.NatRulesClient + PointToSiteVpnGatewaysClient *network.P2sVpnGatewaysClient + ProfileClient *network.ProfilesClient + PacketCapturesClient *network.PacketCapturesClient + PrivateEndpointClient *network.PrivateEndpointsClient + PublicIPsClient *network.PublicIPAddressesClient + PublicIPPrefixesClient *network.PublicIPPrefixesClient + RouteMapsClient *network.RouteMapsClient + RoutesClient *network.RoutesClient + RouteFiltersClient *network.RouteFiltersClient + RouteTablesClient *network.RouteTablesClient + SecurityGroupClient *network.SecurityGroupsClient + SecurityPartnerProviderClient *network.SecurityPartnerProvidersClient + SecurityRuleClient *network.SecurityRulesClient + ServiceEndpointPoliciesClient *network.ServiceEndpointPoliciesClient + ServiceEndpointPolicyDefinitionsClient *network.ServiceEndpointPolicyDefinitionsClient + ServiceTagsClient *network.ServiceTagsClient + SubnetsClient *network.SubnetsClient + NatGatewayClient *network.NatGatewaysClient + VirtualHubBgpConnectionClient *network.VirtualHubBgpConnectionClient + VirtualHubIPClient *network.VirtualHubIPConfigurationClient + VnetGatewayConnectionsClient *network.VirtualNetworkGatewayConnectionsClient + VnetGatewayNatRuleClient *network.VirtualNetworkGatewayNatRulesClient + VnetGatewayClient *network.VirtualNetworkGatewaysClient + VnetClient *network.VirtualNetworksClient + VnetPeeringsClient *network.VirtualNetworkPeeringsClient + VirtualWanClient *network.VirtualWansClient + VirtualHubClient *network.VirtualHubsClient + VpnConnectionsClient *network.VpnConnectionsClient + VpnGatewaysClient *network.VpnGatewaysClient + VpnServerConfigurationsClient *network.VpnServerConfigurationsClient + VpnSitesClient *network.VpnSitesClient + WatcherClient *network.WatchersClient + WebApplicationFirewallPoliciesClient *network.WebApplicationFirewallPoliciesClient + PrivateDnsZoneGroupClient *network.PrivateDNSZoneGroupsClient + PrivateLinkServiceClient *network.PrivateLinkServicesClient + ServiceAssociationLinkClient *network.ServiceAssociationLinksClient + ResourceNavigationLinkClient *network.ResourceNavigationLinksClient } func NewClient(o *common.ClientOptions) *Client { @@ -130,12 +136,30 @@ func NewClient(o *common.ClientOptions) *Client { ManagersClient := network.NewManagersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&ManagersClient.Client, o.ResourceManagerAuthorizer) + ManagerAdminRulesClient := network.NewAdminRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&ManagerAdminRulesClient.Client, o.ResourceManagerAuthorizer) + + ManagerAdminRuleCollectionsClient := network.NewAdminRuleCollectionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&ManagerAdminRuleCollectionsClient.Client, o.ResourceManagerAuthorizer) + + ManagerConnectivityConfigurationsClient := network.NewConnectivityConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&ManagerConnectivityConfigurationsClient.Client, o.ResourceManagerAuthorizer) + + ManagerScopeConnectionsClient := network.NewScopeConnectionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&ManagerScopeConnectionsClient.Client, o.ResourceManagerAuthorizer) + + ManagerSecurityAdminConfigurationsClient := network.NewSecurityAdminConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&ManagerSecurityAdminConfigurationsClient.Client, o.ResourceManagerAuthorizer) + ManagerManagementGroupConnectionsClient := network.NewManagementGroupNetworkManagerConnectionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&ManagerManagementGroupConnectionsClient.Client, o.ResourceManagerAuthorizer) ManagerNetworkGroupsClient := network.NewGroupsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&ManagerNetworkGroupsClient.Client, o.ResourceManagerAuthorizer) + ManagerStaticMembersClient := network.NewStaticMembersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&ManagerStaticMembersClient.Client, o.ResourceManagerAuthorizer) + ManagerSubscriptionConnectionsClient := network.NewSubscriptionNetworkManagerConnectionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&ManagerSubscriptionConnectionsClient.Client, o.ResourceManagerAuthorizer) @@ -254,66 +278,72 @@ func NewClient(o *common.ClientOptions) *Client { o.ConfigureClient(&ResourceNavigationLinkClient.Client, o.ResourceManagerAuthorizer) return &Client{ - ApplicationGatewaysClient: &ApplicationGatewaysClient, - ApplicationSecurityGroupsClient: &ApplicationSecurityGroupsClient, - BastionHostsClient: &BastionHostsClient, - ConfigurationPolicyGroupClient: &configurationPolicyGroupClient, - ConnectionMonitorsClient: &ConnectionMonitorsClient, - DDOSProtectionPlansClient: &DDOSProtectionPlansClient, - ExpressRouteAuthsClient: &ExpressRouteAuthsClient, - ExpressRouteCircuitsClient: &ExpressRouteCircuitsClient, - ExpressRouteCircuitConnectionClient: &ExpressRouteCircuitConnectionClient, - ExpressRouteConnectionsClient: &ExpressRouteConnectionsClient, - ExpressRouteGatewaysClient: &ExpressRouteGatewaysClient, - ExpressRoutePeeringsClient: &ExpressRoutePeeringsClient, - ExpressRoutePortsClient: &ExpressRoutePortsClient, - FlowLogsClient: &FlowLogsClient, - HubRouteTableClient: &HubRouteTableClient, - HubVirtualNetworkConnectionClient: &HubVirtualNetworkConnectionClient, - InterfacesClient: &InterfacesClient, - IPGroupsClient: &IpGroupsClient, - LocalNetworkGatewaysClient: &LocalNetworkGatewaysClient, - ManagersClient: &ManagersClient, - ManagerManagementGroupConnectionsClient: &ManagerManagementGroupConnectionsClient, - ManagerNetworkGroupsClient: &ManagerNetworkGroupsClient, - ManagerSubscriptionConnectionsClient: &ManagerSubscriptionConnectionsClient, - NatRuleClient: &NatRuleClient, - PointToSiteVpnGatewaysClient: &pointToSiteVpnGatewaysClient, - ProfileClient: &ProfileClient, - PacketCapturesClient: &PacketCapturesClient, - PrivateEndpointClient: &PrivateEndpointClient, - PublicIPsClient: &PublicIPsClient, - PublicIPPrefixesClient: &PublicIPPrefixesClient, - RouteMapsClient: &RouteMapsClient, - RoutesClient: &RoutesClient, - RouteFiltersClient: &RouteFiltersClient, - RouteTablesClient: &RouteTablesClient, - SecurityGroupClient: &SecurityGroupClient, - SecurityPartnerProviderClient: &SecurityPartnerProviderClient, - SecurityRuleClient: &SecurityRuleClient, - ServiceEndpointPoliciesClient: &ServiceEndpointPoliciesClient, - ServiceEndpointPolicyDefinitionsClient: &ServiceEndpointPolicyDefinitionsClient, - ServiceTagsClient: &ServiceTagsClient, - SubnetsClient: &SubnetsClient, - NatGatewayClient: &NatGatewayClient, - VirtualHubBgpConnectionClient: &VirtualHubBgpConnectionClient, - VirtualHubIPClient: &VirtualHubIPClient, - VnetGatewayConnectionsClient: &VnetGatewayConnectionsClient, - VnetGatewayNatRuleClient: &VnetGatewayNatRuleClient, - VnetGatewayClient: &VnetGatewayClient, - VnetClient: &VnetClient, - VnetPeeringsClient: &VnetPeeringsClient, - VirtualWanClient: &VirtualWanClient, - VirtualHubClient: &VirtualHubClient, - VpnConnectionsClient: &vpnConnectionsClient, - VpnGatewaysClient: &vpnGatewaysClient, - VpnServerConfigurationsClient: &vpnServerConfigurationsClient, - VpnSitesClient: &vpnSitesClient, - WatcherClient: &WatcherClient, - WebApplicationFirewallPoliciesClient: &WebApplicationFirewallPoliciesClient, - PrivateDnsZoneGroupClient: &PrivateDnsZoneGroupClient, - PrivateLinkServiceClient: &PrivateLinkServiceClient, - ServiceAssociationLinkClient: &ServiceAssociationLinkClient, - ResourceNavigationLinkClient: &ResourceNavigationLinkClient, + ApplicationGatewaysClient: &ApplicationGatewaysClient, + ApplicationSecurityGroupsClient: &ApplicationSecurityGroupsClient, + BastionHostsClient: &BastionHostsClient, + ConfigurationPolicyGroupClient: &configurationPolicyGroupClient, + ConnectionMonitorsClient: &ConnectionMonitorsClient, + DDOSProtectionPlansClient: &DDOSProtectionPlansClient, + ExpressRouteAuthsClient: &ExpressRouteAuthsClient, + ExpressRouteCircuitsClient: &ExpressRouteCircuitsClient, + ExpressRouteCircuitConnectionClient: &ExpressRouteCircuitConnectionClient, + ExpressRouteConnectionsClient: &ExpressRouteConnectionsClient, + ExpressRouteGatewaysClient: &ExpressRouteGatewaysClient, + ExpressRoutePeeringsClient: &ExpressRoutePeeringsClient, + ExpressRoutePortsClient: &ExpressRoutePortsClient, + FlowLogsClient: &FlowLogsClient, + HubRouteTableClient: &HubRouteTableClient, + HubVirtualNetworkConnectionClient: &HubVirtualNetworkConnectionClient, + InterfacesClient: &InterfacesClient, + IPGroupsClient: &IpGroupsClient, + LocalNetworkGatewaysClient: &LocalNetworkGatewaysClient, + ManagersClient: &ManagersClient, + ManagerAdminRulesClient: &ManagerAdminRulesClient, + ManagerAdminRuleCollectionsClient: &ManagerAdminRuleCollectionsClient, + ManagerConnectivityConfigurationsClient: &ManagerConnectivityConfigurationsClient, + ManagerManagementGroupConnectionsClient: &ManagerManagementGroupConnectionsClient, + ManagerNetworkGroupsClient: &ManagerNetworkGroupsClient, + ManagerScopeConnectionsClient: &ManagerScopeConnectionsClient, + ManagerSecurityAdminConfigurationsClient: &ManagerSecurityAdminConfigurationsClient, + ManagerStaticMembersClient: &ManagerStaticMembersClient, + ManagerSubscriptionConnectionsClient: &ManagerSubscriptionConnectionsClient, + NatRuleClient: &NatRuleClient, + PointToSiteVpnGatewaysClient: &pointToSiteVpnGatewaysClient, + ProfileClient: &ProfileClient, + PacketCapturesClient: &PacketCapturesClient, + PrivateEndpointClient: &PrivateEndpointClient, + PublicIPsClient: &PublicIPsClient, + PublicIPPrefixesClient: &PublicIPPrefixesClient, + RouteMapsClient: &RouteMapsClient, + RoutesClient: &RoutesClient, + RouteFiltersClient: &RouteFiltersClient, + RouteTablesClient: &RouteTablesClient, + SecurityGroupClient: &SecurityGroupClient, + SecurityPartnerProviderClient: &SecurityPartnerProviderClient, + SecurityRuleClient: &SecurityRuleClient, + ServiceEndpointPoliciesClient: &ServiceEndpointPoliciesClient, + ServiceEndpointPolicyDefinitionsClient: &ServiceEndpointPolicyDefinitionsClient, + ServiceTagsClient: &ServiceTagsClient, + SubnetsClient: &SubnetsClient, + NatGatewayClient: &NatGatewayClient, + VirtualHubBgpConnectionClient: &VirtualHubBgpConnectionClient, + VirtualHubIPClient: &VirtualHubIPClient, + VnetGatewayConnectionsClient: &VnetGatewayConnectionsClient, + VnetGatewayNatRuleClient: &VnetGatewayNatRuleClient, + VnetGatewayClient: &VnetGatewayClient, + VnetClient: &VnetClient, + VnetPeeringsClient: &VnetPeeringsClient, + VirtualWanClient: &VirtualWanClient, + VirtualHubClient: &VirtualHubClient, + VpnConnectionsClient: &vpnConnectionsClient, + VpnGatewaysClient: &vpnGatewaysClient, + VpnServerConfigurationsClient: &vpnServerConfigurationsClient, + VpnSitesClient: &vpnSitesClient, + WatcherClient: &WatcherClient, + WebApplicationFirewallPoliciesClient: &WebApplicationFirewallPoliciesClient, + PrivateDnsZoneGroupClient: &PrivateDnsZoneGroupClient, + PrivateLinkServiceClient: &PrivateLinkServiceClient, + ServiceAssociationLinkClient: &ServiceAssociationLinkClient, + ResourceNavigationLinkClient: &ResourceNavigationLinkClient, } } diff --git a/internal/services/network/edge_zone.go b/internal/services/network/edge_zone.go index 7825f55b77ab..9806f7b8df5e 100644 --- a/internal/services/network/edge_zone.go +++ b/internal/services/network/edge_zone.go @@ -3,7 +3,7 @@ package network import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func expandEdgeZone(input string) *network.ExtendedLocation { diff --git a/internal/services/network/express_route_circuit_authorization_resource.go b/internal/services/network/express_route_circuit_authorization_resource.go index bed2bf817e7d..a6c407579fd1 100644 --- a/internal/services/network/express_route_circuit_authorization_resource.go +++ b/internal/services/network/express_route_circuit_authorization_resource.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceExpressRouteCircuitAuthorization() *pluginsdk.Resource { diff --git a/internal/services/network/express_route_circuit_connection_resource.go b/internal/services/network/express_route_circuit_connection_resource.go index 36d9799b9fb4..7f868adf66e0 100644 --- a/internal/services/network/express_route_circuit_connection_resource.go +++ b/internal/services/network/express_route_circuit_connection_resource.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceExpressRouteCircuitConnection() *pluginsdk.Resource { diff --git a/internal/services/network/express_route_circuit_data_source.go b/internal/services/network/express_route_circuit_data_source.go index 15613f747f22..40307056f475 100644 --- a/internal/services/network/express_route_circuit_data_source.go +++ b/internal/services/network/express_route_circuit_data_source.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourceExpressRouteCircuit() *pluginsdk.Resource { diff --git a/internal/services/network/express_route_circuit_peering_resource.go b/internal/services/network/express_route_circuit_peering_resource.go index 0968f416427d..2f71fd3ea0c4 100644 --- a/internal/services/network/express_route_circuit_peering_resource.go +++ b/internal/services/network/express_route_circuit_peering_resource.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceExpressRouteCircuitPeering() *pluginsdk.Resource { diff --git a/internal/services/network/express_route_circuit_resource.go b/internal/services/network/express_route_circuit_resource.go index 3d5b176a3d5c..cecdbbd0b9d6 100644 --- a/internal/services/network/express_route_circuit_resource.go +++ b/internal/services/network/express_route_circuit_resource.go @@ -20,7 +20,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) var expressRouteCircuitResourceName = "azurerm_express_route_circuit" diff --git a/internal/services/network/express_route_connection_resource.go b/internal/services/network/express_route_connection_resource.go index 786711204035..234fea0d57e2 100644 --- a/internal/services/network/express_route_connection_resource.go +++ b/internal/services/network/express_route_connection_resource.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceExpressRouteConnection() *pluginsdk.Resource { diff --git a/internal/services/network/express_route_gateway_resource.go b/internal/services/network/express_route_gateway_resource.go index d3dc801c958b..ac2f8486b628 100644 --- a/internal/services/network/express_route_gateway_resource.go +++ b/internal/services/network/express_route_gateway_resource.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceExpressRouteGateway() *pluginsdk.Resource { diff --git a/internal/services/network/express_route_port_resource.go b/internal/services/network/express_route_port_resource.go index 7830260e1b53..cfdfdcd1c297 100644 --- a/internal/services/network/express_route_port_resource.go +++ b/internal/services/network/express_route_port_resource.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) var expressRoutePortSchema = &pluginsdk.Schema{ @@ -148,6 +148,16 @@ func resourceArmExpressRoutePort() *pluginsdk.Resource { "identity": commonschema.UserAssignedIdentityOptional(), + "billing_type": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + string(network.ExpressRoutePortsBillingTypeMeteredData), + string(network.ExpressRoutePortsBillingTypeUnlimitedData), + }, false), + }, + "link1": expressRoutePortSchema, "link2": expressRoutePortSchema, @@ -213,6 +223,10 @@ func resourceArmExpressRoutePortCreateUpdate(d *pluginsdk.ResourceData, meta int Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } + if v, ok := d.GetOk("billing_type"); ok { + param.ExpressRoutePortPropertiesFormat.BillingType = network.ExpressRoutePortsBillingType(v.(string)) + } + // The link properties can't be specified in first creation. It will result into either error (e.g. setting `adminState`) or being ignored (e.g. setting MACSec) // Hence, if this is a new creation we will do a create-then-update here. if d.IsNewResource() { @@ -277,6 +291,7 @@ func resourceArmExpressRoutePortRead(d *pluginsdk.ResourceData, meta interface{} d.Set("peering_location", prop.PeeringLocation) d.Set("bandwidth_in_gbps", prop.BandwidthInGbps) d.Set("encapsulation", prop.Encapsulation) + d.Set("billing_type", prop.BillingType) link1, link2, err := flattenExpressRoutePortLinks(resp.Links) if err != nil { return fmt.Errorf("flattening links: %v", err) diff --git a/internal/services/network/express_route_port_resource_test.go b/internal/services/network/express_route_port_resource_test.go index 30a8cf753af6..6af128ecd75c 100644 --- a/internal/services/network/express_route_port_resource_test.go +++ b/internal/services/network/express_route_port_resource_test.go @@ -40,6 +40,7 @@ func TestAccAzureRMExpressRoutePort_basic(t *testing.T) { check.That(data.ResourceName).Key("link2.0.rack_id").Exists(), check.That(data.ResourceName).Key("link2.0.connector_type").Exists(), check.That(data.ResourceName).Key("ethertype").Exists(), + check.That(data.ResourceName).Key("billing_type").Exists(), check.That(data.ResourceName).Key("guid").Exists(), check.That(data.ResourceName).Key("mtu").Exists(), ), @@ -141,6 +142,7 @@ resource "azurerm_express_route_port" "test" { peering_location = "Airtel-Chennai2-CLS" bandwidth_in_gbps = 10 encapsulation = "Dot1Q" + billing_type = "MeteredData" tags = { ENV = "Test" } diff --git a/internal/services/network/ip_group_cidr_resource.go b/internal/services/network/ip_group_cidr_resource.go new file mode 100644 index 000000000000..67583f88236a --- /dev/null +++ b/internal/services/network/ip_group_cidr_resource.go @@ -0,0 +1,185 @@ +package network + +import ( + "fmt" + "strings" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" +) + +func resourceIpGroupCidr() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceIpGroupCidrCreateUpdate, + Read: resourceIpGroupCidrRead, + Delete: resourceIpGroupCidrDelete, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.IpGroupCidrID(id) + return err + }), + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "ip_group_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.IpGroupID, + }, + "cidr": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + } +} + +func resourceIpGroupCidrCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Network.IPGroupsClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + cidr := d.Get("cidr").(string) + cidrName := strings.ReplaceAll(cidr, "/", "_") + ipGroupId, err := parse.IpGroupID(d.Get("ip_group_id").(string)) + if err != nil { + return err + } + id := parse.NewIpGroupCidrID(subscriptionId, ipGroupId.ResourceGroup, ipGroupId.Name, cidrName) + + locks.ByID(ipGroupId.ID()) + defer locks.UnlockByID(ipGroupId.ID()) + + existing, err := client.Get(ctx, ipGroupId.ResourceGroup, ipGroupId.Name, "") + if err != nil { + if utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for presence of existing %s: %s", ipGroupId, err) + } + } + + if d.IsNewResource() { + if utils.SliceContainsValue(*existing.IPAddresses, cidr) { + return tf.ImportAsExistsError("azurerm_ip_group_cidr", id.ID()) + } + } + + ipAddresses := make([]string, 0) + if existing.IPAddresses != nil { + ipAddresses = *existing.IPAddresses + } + ipAddresses = append(ipAddresses, cidr) + + params := network.IPGroup{ + Name: &ipGroupId.Name, + Location: existing.Location, + Tags: existing.Tags, + IPGroupPropertiesFormat: &network.IPGroupPropertiesFormat{ + IPAddresses: &ipAddresses, + }, + } + + future, err := client.CreateOrUpdate(ctx, ipGroupId.ResourceGroup, ipGroupId.Name, params) + if err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the completion of %s: %+v", id, err) + } + + d.SetId(id.ID()) + + return resourceIpGroupCidrRead(d, meta) +} + +func resourceIpGroupCidrRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Network.IPGroupsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.IpGroupCidrID(d.Id()) + if err != nil { + return err + } + ipGroupId := parse.NewIpGroupID(id.SubscriptionId, id.ResourceGroup, id.IpGroupName) + cidr := strings.ReplaceAll(id.CidrName, "_", "/") + + resp, err := client.Get(ctx, id.ResourceGroup, id.IpGroupName, "") + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("making Read request on IP Group %q (Resource Group %q): %+v", ipGroupId.Name, ipGroupId.ResourceGroup, err) + } + if !utils.SliceContainsValue(*resp.IPAddresses, cidr) { + d.SetId("") + return nil + } + } + + d.Set("ip_group_id", ipGroupId.ID()) + d.Set("cidr", cidr) + + return nil +} + +func resourceIpGroupCidrDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Network.IPGroupsClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + cidr := d.Get("cidr").(string) + ipGroupId, err := parse.IpGroupID(d.Get("ip_group_id").(string)) + if err != nil { + return err + } + + locks.ByID(ipGroupId.ID()) + defer locks.UnlockByID(ipGroupId.ID()) + + existing, err := client.Get(ctx, ipGroupId.ResourceGroup, ipGroupId.Name, "") + if err != nil { + if utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("reading existing %s: %s", ipGroupId, err) + } + } + + ipAddresses := *existing.IPAddresses + ipAddresses = utils.RemoveFromStringArray(ipAddresses, cidr) + + params := network.IPGroup{ + Name: &ipGroupId.Name, + Location: existing.Location, + Tags: existing.Tags, + IPGroupPropertiesFormat: &network.IPGroupPropertiesFormat{ + IPAddresses: &ipAddresses, + }, + } + + future, err := client.CreateOrUpdate(ctx, ipGroupId.ResourceGroup, ipGroupId.Name, params) + if err != nil { + return fmt.Errorf("creating/updating %s: %+v", ipGroupId.ID(), err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("deleting IP Group CIDR %q (IP Group %q - Resource Group %q): %+v", cidr, ipGroupId.Name, ipGroupId.ResourceGroup, err) + } + + return err +} diff --git a/internal/services/network/ip_group_cidr_resource_test.go b/internal/services/network/ip_group_cidr_resource_test.go new file mode 100644 index 000000000000..053991387640 --- /dev/null +++ b/internal/services/network/ip_group_cidr_resource_test.go @@ -0,0 +1,149 @@ +package network_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type IPGroupCidrResource struct{} + +func TestAccIpGroupCidr_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_ip_group_cidr", "test") + r := IPGroupCidrResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That("azurerm_ip_group_cidr.test").ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccIpGroupCidr_multiple(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_ip_group_cidr", "test") + r := IPGroupCidrResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That("azurerm_ip_group_cidr.test").ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.multiple(data), + Check: acceptance.ComposeTestCheckFunc( + check.That("azurerm_ip_group.test").Key("tags.env").HasValue("prod"), + check.That("azurerm_ip_group_cidr.test").ExistsInAzure(r), + check.That("azurerm_ip_group_cidr.multiple_1").ExistsInAzure(r), + check.That("azurerm_ip_group_cidr.multiple_2").ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccIpGroupCidr_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_ip_group_cidr", "test") + r := IPGroupCidrResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That("azurerm_ip_group_cidr.test").ExistsInAzure(r), + ), + }, + { + Config: r.requiresImport(data), + ExpectError: acceptance.RequiresImportError("azurerm_ip_group_cidr"), + }, + }) +} + +func (t IPGroupCidrResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := parse.IpGroupCidrID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.Network.IPGroupsClient.Get(ctx, id.ResourceGroup, id.IpGroupName, "") + if err != nil { + return nil, fmt.Errorf("reading IP Group (%s): %+v", id, err) + } + + if !utils.SliceContainsValue(*resp.IPAddresses, state.Attributes["cidr"]) { + return utils.Bool(false), nil + } + + return utils.Bool(true), nil +} + +func (IPGroupCidrResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-network-%d" + location = "%s" +} + +resource "azurerm_ip_group" "test" { + name = "acceptanceTestIpGroup1" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + tags = { + env = "prod" + } + + lifecycle { + ignore_changes = ["cidrs"] + } +} + +resource "azurerm_ip_group_cidr" "test" { + ip_group_id = azurerm_ip_group.test.id + cidr = "10.0.0.0/24" +} + + +`, data.RandomInteger, data.Locations.Primary) +} + +func (r IPGroupCidrResource) multiple(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_ip_group_cidr" "multiple_1" { + ip_group_id = azurerm_ip_group.test.id + cidr = "10.10.0.0/24" +} + +resource "azurerm_ip_group_cidr" "multiple_2" { + ip_group_id = azurerm_ip_group.test.id + cidr = "10.20.0.0/24" +} +`, r.basic(data)) +} + +func (r IPGroupCidrResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_ip_group_cidr" "import" { + ip_group_id = azurerm_ip_group_cidr.test.ip_group_id + cidr = azurerm_ip_group_cidr.test.cidr +} +`, r.basic(data)) +} diff --git a/internal/services/network/ip_group_resource.go b/internal/services/network/ip_group_resource.go index 7e507cbf04f7..2af7e0a5b8d6 100644 --- a/internal/services/network/ip_group_resource.go +++ b/internal/services/network/ip_group_resource.go @@ -2,26 +2,30 @@ package network import ( "fmt" + "log" "time" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall" + firewallParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceIpGroup() *pluginsdk.Resource { return &pluginsdk.Resource{ - Create: resourceIpGroupCreateUpdate, + Create: resourceIpGroupCreate, Read: resourceIpGroupRead, - Update: resourceIpGroupCreateUpdate, + Update: resourceIpGroupUpdate, Delete: resourceIpGroupDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { @@ -47,6 +51,22 @@ func resourceIpGroup() *pluginsdk.Resource { "resource_group_name": commonschema.ResourceGroupName(), + "firewall_ids": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "firewall_policy_ids": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "cidrs": { Type: pluginsdk.TypeSet, Optional: true, @@ -62,14 +82,29 @@ func resourceIpGroup() *pluginsdk.Resource { } } -func resourceIpGroupCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { +func resourceIpGroupCreate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Network.IPGroupsClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() + for _, fw := range d.Get("firewall_ids").([]interface{}) { + id, _ := firewallParse.FirewallID(fw.(string)) + locks.ByName(id.AzureFirewallName, firewall.AzureFirewallResourceName) + defer locks.UnlockByName(id.AzureFirewallName, firewall.AzureFirewallResourceName) + } + + for _, fwpol := range d.Get("firewall_policy_ids").([]interface{}) { + id, _ := firewallParse.FirewallPolicyID(fwpol.(string)) + locks.ByName(id.Name, firewall.AzureFirewallPolicyResourceName) + defer locks.UnlockByName(id.Name, firewall.AzureFirewallPolicyResourceName) + } + id := parse.NewIpGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + locks.ByID(id.ID()) + defer locks.UnlockByID(id.ID()) + if d.IsNewResource() { existing, err := client.Get(ctx, id.ResourceGroup, id.Name, "") if err != nil { @@ -144,9 +179,85 @@ func resourceIpGroupRead(d *pluginsdk.ResourceData, meta interface{}) error { } } + d.Set("firewall_ids", getIds(resp.Firewalls)) + d.Set("firewall_policy_ids", getIds(resp.FirewallPolicies)) + return tags.FlattenAndSet(d, resp.Tags) } +func resourceIpGroupUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Network.IPGroupsClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + for _, fw := range d.Get("firewall_ids").([]interface{}) { + id, _ := firewallParse.FirewallID(fw.(string)) + locks.ByName(id.AzureFirewallName, firewall.AzureFirewallResourceName) + defer locks.UnlockByName(id.AzureFirewallName, firewall.AzureFirewallResourceName) + } + + for _, fwpol := range d.Get("firewall_policy_ids").([]interface{}) { + id, _ := firewallParse.FirewallPolicyID(fwpol.(string)) + locks.ByName(id.Name, firewall.AzureFirewallPolicyResourceName) + defer locks.UnlockByName(id.Name, firewall.AzureFirewallPolicyResourceName) + } + + id := parse.NewIpGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + + locks.ByID(id.ID()) + defer locks.UnlockByID(id.ID()) + + exisiting, err := client.Get(ctx, id.ResourceGroup, id.Name, "") + if err != nil { + if utils.ResponseWasNotFound(exisiting.Response) { + d.SetId("") + return nil + } + return fmt.Errorf("making Read request on IP Group %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + } + + if d.HasChange("cidrs") { + if exisiting.IPGroupPropertiesFormat != nil { + exisiting.IPGroupPropertiesFormat.IPAddresses = utils.ExpandStringSlice(d.Get("cidrs").(*pluginsdk.Set).List()) + } + } + + if d.HasChange("tags") { + exisiting.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) + } + + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, exisiting) + if err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the completion of %s: %+v", id, err) + } + + d.SetId(id.ID()) + + return resourceIpGroupRead(d, meta) +} + +func getIds(subResource *[]network.SubResource) []string { + if subResource == nil { + return nil + } + + ids := make([]string, 0) + for _, v := range *subResource { + if v.ID == nil { + continue + } + + ids = append(ids, *v.ID) + } + + return ids +} + func resourceIpGroupDelete(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Network.IPGroupsClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) @@ -157,6 +268,32 @@ func resourceIpGroupDelete(d *pluginsdk.ResourceData, meta interface{}) error { return err } + locks.ByID(id.ID()) + defer locks.UnlockByID(id.ID()) + + read, err := client.Get(ctx, id.ResourceGroup, id.Name, "") + if err != nil { + if utils.ResponseWasNotFound(read.Response) { + // deleted outside of TF + log.Printf("[DEBUG] IP Group %q was not found in Resource Group %q - assuming removed!", id.Name, id.ResourceGroup) + return nil + } + + return fmt.Errorf("retrieving ip group %s : %+v", *id, err) + } + + for _, fw := range *read.Firewalls { + id, _ := firewallParse.FirewallID(*fw.ID) + locks.ByName(id.AzureFirewallName, firewall.AzureFirewallResourceName) + defer locks.UnlockByName(id.AzureFirewallName, firewall.AzureFirewallResourceName) + } + + for _, fwpol := range *read.FirewallPolicies { + id, _ := firewallParse.FirewallPolicyID(*fwpol.ID) + locks.ByName(id.Name, firewall.AzureFirewallPolicyResourceName) + defer locks.UnlockByName(id.Name, firewall.AzureFirewallPolicyResourceName) + } + future, err := client.Delete(ctx, id.ResourceGroup, id.Name) if err != nil { return fmt.Errorf("deleting IP Group %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) diff --git a/internal/services/network/ip_group_resource_test.go b/internal/services/network/ip_group_resource_test.go index d1127d1f7fdd..2981f9932730 100644 --- a/internal/services/network/ip_group_resource_test.go +++ b/internal/services/network/ip_group_resource_test.go @@ -112,6 +112,31 @@ func TestAccIpGroup_update(t *testing.T) { }) } +func TestAccIpGroup_updateWithAttachedPolicy(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_ip_group", "test1") + r := IPGroupResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withAzurePolicy(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("cidrs.#").HasValue("1"), + check.That(data.ResourceName).Key("tags.%").HasValue("2"), + ), + }, + data.ImportStep(), + { + Config: r.withAzurePolicyUpdate(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("cidrs.#").HasValue("2"), + check.That(data.ResourceName).Key("tags.%").HasValue("2"), + ), + }, + data.ImportStep(), + }) +} + func (t IPGroupResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.IpGroupID(state.ID) if err != nil { @@ -208,3 +233,236 @@ resource "azurerm_ip_group" "test" { } `, data.RandomInteger, data.Locations.Primary) } + +func (IPGroupResource) withAzurePolicy(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-network-%d" + location = "%s" +} + +resource "azurerm_ip_group" "test1" { + name = "acceptanceTestIpGroup1" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + cidrs = ["172.16.240.0/20"] + + tags = { + environment = "Production" + cost_center = "MSFT" + } +} + +resource "azurerm_ip_group" "test2" { + name = "acceptanceTestIpGroup2" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + cidrs = ["172.17.240.0/20"] + + tags = { + environment = "Production" + cost_center = "MSFT" + } +} + +resource "azurerm_firewall_policy" "test" { + name = "fwpol-test-policy" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_firewall_policy_rule_collection_group" "test" { + name = "fwpol-test" + firewall_policy_id = azurerm_firewall_policy.test.id + priority = 100 + + network_rule_collection { + name = "network-rule-collection1" + priority = 100 + action = "Allow" + rule { + name = "network-rule-collection1-rule1" + protocols = ["TCP"] + source_ip_groups = [azurerm_ip_group.test1.id] + destination_ip_groups = [azurerm_ip_group.test2.id] + destination_ports = ["443"] + } + } + + network_rule_collection { + name = "network-rule-collection2" + priority = 200 + action = "Allow" + rule { + name = "network-rule-collection1-rule1" + protocols = ["TCP"] + source_ip_groups = [azurerm_ip_group.test2.id] + destination_ip_groups = [azurerm_ip_group.test1.id] + destination_ports = ["443"] + } + } +} + + +resource "azurerm_virtual_network" "test" { + name = "testvnet" + address_space = ["10.0.0.0/16"] + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_subnet" "test" { + name = "AzureFirewallSubnet" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test.name + address_prefixes = ["10.0.1.0/24"] +} + +resource "azurerm_public_ip" "test" { + name = "pip-fw" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + allocation_method = "Static" + sku = "Standard" +} + +resource "azurerm_firewall" "test" { + name = "testfirewall" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku_name = "AZFW_VNet" + sku_tier = "Standard" + + firewall_policy_id = azurerm_firewall_policy.test.id + + ip_configuration { + name = "configuration" + subnet_id = azurerm_subnet.test.id + public_ip_address_id = azurerm_public_ip.test.id + } +} +`, data.RandomInteger, data.Locations.Primary) +} + +func (IPGroupResource) withAzurePolicyUpdate(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-network-%d" + location = "%s" +} + +resource "azurerm_ip_group" "test1" { + name = "acceptanceTestIpGroup1" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + cidrs = ["172.16.240.0/20", "172.18.240.0/20"] + + tags = { + environment = "Production" + cost_center = "MSFT" + } +} + +resource "azurerm_ip_group" "test2" { + name = "acceptanceTestIpGroup2" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + cidrs = ["172.17.240.0/20", "172.19.240.0/20"] + + tags = { + environment = "Production" + cost_center = "MSFT" + } +} + +resource "azurerm_firewall_policy" "test" { + name = "fwpol-test-policy" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_firewall_policy_rule_collection_group" "test" { + name = "fwpol-test" + firewall_policy_id = azurerm_firewall_policy.test.id + priority = 100 + + network_rule_collection { + name = "network-rule-collection1" + priority = 100 + action = "Allow" + rule { + name = "network-rule-collection1-rule1" + protocols = ["TCP"] + source_ip_groups = [azurerm_ip_group.test1.id] + destination_ip_groups = [azurerm_ip_group.test2.id] + destination_ports = ["443"] + } + } + + network_rule_collection { + name = "network-rule-collection2" + priority = 200 + action = "Allow" + rule { + name = "network-rule-collection1-rule1" + protocols = ["TCP"] + source_ip_groups = [azurerm_ip_group.test2.id] + destination_ip_groups = [azurerm_ip_group.test1.id] + destination_ports = ["443"] + } + } +} + +resource "azurerm_virtual_network" "test" { + name = "testvnet" + address_space = ["10.0.0.0/16"] + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_subnet" "test" { + name = "AzureFirewallSubnet" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test.name + address_prefixes = ["10.0.1.0/24"] +} + +resource "azurerm_public_ip" "test" { + name = "pip-fw" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + allocation_method = "Static" + sku = "Standard" +} + +resource "azurerm_firewall" "test" { + name = "testfirewall" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku_name = "AZFW_VNet" + sku_tier = "Standard" + + firewall_policy_id = azurerm_firewall_policy.test.id + + ip_configuration { + name = "configuration" + subnet_id = azurerm_subnet.test.id + public_ip_address_id = azurerm_public_ip.test.id + } +} + + +`, data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/network/local_network_gateway_data_source.go b/internal/services/network/local_network_gateway_data_source.go index 6023733dc58f..40d2be729706 100644 --- a/internal/services/network/local_network_gateway_data_source.go +++ b/internal/services/network/local_network_gateway_data_source.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourceLocalNetworkGateway() *pluginsdk.Resource { @@ -90,11 +90,10 @@ func dataSourceLocalNetworkGatewayRead(d *pluginsdk.ResourceData, meta interface resp, err := client.Get(ctx, id.ResourceGroup, id.Name) if err != nil { if utils.ResponseWasNotFound(resp.Response) { - d.SetId("") - return nil + return fmt.Errorf("%s was not found", id) } - return fmt.Errorf("reading the state of %s: %+v", id, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) diff --git a/internal/services/network/local_network_gateway_resource.go b/internal/services/network/local_network_gateway_resource.go index 9351f45f7c07..02591c2272af 100644 --- a/internal/services/network/local_network_gateway_resource.go +++ b/internal/services/network/local_network_gateway_resource.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceLocalNetworkGateway() *pluginsdk.Resource { diff --git a/internal/services/network/nat_gateway_public_ip_association_resource.go b/internal/services/network/nat_gateway_public_ip_association_resource.go index 03e3a12da231..02de6e872455 100644 --- a/internal/services/network/nat_gateway_public_ip_association_resource.go +++ b/internal/services/network/nat_gateway_public_ip_association_resource.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceNATGatewayPublicIpAssociation() *pluginsdk.Resource { diff --git a/internal/services/network/nat_gateway_public_ip_association_resource_test.go b/internal/services/network/nat_gateway_public_ip_association_resource_test.go index 1f34f39e1f3b..4c133af5827b 100644 --- a/internal/services/network/nat_gateway_public_ip_association_resource_test.go +++ b/internal/services/network/nat_gateway_public_ip_association_resource_test.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type NatGatewayPublicAssociationResource struct{} diff --git a/internal/services/network/nat_gateway_public_ip_prefix_association_resource.go b/internal/services/network/nat_gateway_public_ip_prefix_association_resource.go index 34744655c88b..b13b37361258 100644 --- a/internal/services/network/nat_gateway_public_ip_prefix_association_resource.go +++ b/internal/services/network/nat_gateway_public_ip_prefix_association_resource.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceNATGatewayPublicIpPrefixAssociation() *pluginsdk.Resource { diff --git a/internal/services/network/nat_gateway_public_ip_prefix_association_resource_test.go b/internal/services/network/nat_gateway_public_ip_prefix_association_resource_test.go index 6df5a6d893d1..4c19589ac651 100644 --- a/internal/services/network/nat_gateway_public_ip_prefix_association_resource_test.go +++ b/internal/services/network/nat_gateway_public_ip_prefix_association_resource_test.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type NatGatewayPublicIpPrefixAssociationResource struct{} diff --git a/internal/services/network/nat_gateway_resource.go b/internal/services/network/nat_gateway_resource.go index 513d5cd66368..19da9dc99c47 100644 --- a/internal/services/network/nat_gateway_resource.go +++ b/internal/services/network/nat_gateway_resource.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) var natGatewayResourceName = "azurerm_nat_gateway" diff --git a/internal/services/network/network_connection_monitor_resource.go b/internal/services/network/network_connection_monitor_resource.go index 866b7a7715fd..935ea7a5b9ab 100644 --- a/internal/services/network/network_connection_monitor_resource.go +++ b/internal/services/network/network_connection_monitor_resource.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceNetworkConnectionMonitor() *pluginsdk.Resource { diff --git a/internal/services/network/network_ddos_protection_plan_resource.go b/internal/services/network/network_ddos_protection_plan_resource.go index 2d3658c18918..d17a60ecc271 100644 --- a/internal/services/network/network_ddos_protection_plan_resource.go +++ b/internal/services/network/network_ddos_protection_plan_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) const azureNetworkDDoSProtectionPlanResourceName = "azurerm_network_ddos_protection_plan" diff --git a/internal/services/network/network_interface.go b/internal/services/network/network_interface.go index d4b0e554ce8e..e3790bbd3c36 100644 --- a/internal/services/network/network_interface.go +++ b/internal/services/network/network_interface.go @@ -2,7 +2,7 @@ package network import ( "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type networkInterfaceUpdateInformation struct { diff --git a/internal/services/network/network_interface_application_gateway_association_resource.go b/internal/services/network/network_interface_application_gateway_association_resource.go index dff966a6d364..d7fed8980b89 100644 --- a/internal/services/network/network_interface_application_gateway_association_resource.go +++ b/internal/services/network/network_interface_application_gateway_association_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceNetworkInterfaceApplicationGatewayBackendAddressPoolAssociation() *pluginsdk.Resource { diff --git a/internal/services/network/network_interface_application_gateway_association_resource_test.go b/internal/services/network/network_interface_application_gateway_association_resource_test.go index c2e57e07bbd8..c5e69771037c 100644 --- a/internal/services/network/network_interface_application_gateway_association_resource_test.go +++ b/internal/services/network/network_interface_application_gateway_association_resource_test.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type NetworkInterfaceApplicationGatewayBackendAddressPoolAssociationResource struct{} diff --git a/internal/services/network/network_interface_application_security_group_association_resource_test.go b/internal/services/network/network_interface_application_security_group_association_resource_test.go index 07b1706d041a..2a0fe5b7e246 100644 --- a/internal/services/network/network_interface_application_security_group_association_resource_test.go +++ b/internal/services/network/network_interface_application_security_group_association_resource_test.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type NetworkInterfaceApplicationSecurityGroupAssociationResource struct{} diff --git a/internal/services/network/network_interface_backend_address_pool_association_resource.go b/internal/services/network/network_interface_backend_address_pool_association_resource.go index 6445622ac15e..26418832a38b 100644 --- a/internal/services/network/network_interface_backend_address_pool_association_resource.go +++ b/internal/services/network/network_interface_backend_address_pool_association_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceNetworkInterfaceBackendAddressPoolAssociation() *pluginsdk.Resource { diff --git a/internal/services/network/network_interface_backend_address_pool_association_resource_test.go b/internal/services/network/network_interface_backend_address_pool_association_resource_test.go index 6dc23224cbf7..6cde742e032b 100644 --- a/internal/services/network/network_interface_backend_address_pool_association_resource_test.go +++ b/internal/services/network/network_interface_backend_address_pool_association_resource_test.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type NetworkInterfaceBackendAddressPoolResource struct{} diff --git a/internal/services/network/network_interface_helpers.go b/internal/services/network/network_interface_helpers.go index 44064a02a12b..846f8ca59661 100644 --- a/internal/services/network/network_interface_helpers.go +++ b/internal/services/network/network_interface_helpers.go @@ -1,6 +1,6 @@ package network -import "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" +import "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" func FindNetworkInterfaceIPConfiguration(input *[]network.InterfaceIPConfiguration, name string) *network.InterfaceIPConfiguration { if input == nil { diff --git a/internal/services/network/network_interface_locking.go b/internal/services/network/network_interface_locking.go index a5871ac6e515..320d4d40a6d4 100644 --- a/internal/services/network/network_interface_locking.go +++ b/internal/services/network/network_interface_locking.go @@ -4,7 +4,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type networkInterfaceIPConfigurationLockingDetails struct { diff --git a/internal/services/network/network_interface_nat_rule_association_resource.go b/internal/services/network/network_interface_nat_rule_association_resource.go index 69bbefaae8e4..dfca804b4b8d 100644 --- a/internal/services/network/network_interface_nat_rule_association_resource.go +++ b/internal/services/network/network_interface_nat_rule_association_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceNetworkInterfaceNatRuleAssociation() *pluginsdk.Resource { diff --git a/internal/services/network/network_interface_nat_rule_association_resource_test.go b/internal/services/network/network_interface_nat_rule_association_resource_test.go index 1036fb095676..8330f9c67076 100644 --- a/internal/services/network/network_interface_nat_rule_association_resource_test.go +++ b/internal/services/network/network_interface_nat_rule_association_resource_test.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type NetworkInterfaceNATRuleAssociationResource struct{} diff --git a/internal/services/network/network_interface_network_security_group_association_resource.go b/internal/services/network/network_interface_network_security_group_association_resource.go index 39f90b2f1c42..6bef12b3e0b5 100644 --- a/internal/services/network/network_interface_network_security_group_association_resource.go +++ b/internal/services/network/network_interface_network_security_group_association_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceNetworkInterfaceSecurityGroupAssociation() *pluginsdk.Resource { diff --git a/internal/services/network/network_interface_resource.go b/internal/services/network/network_interface_resource.go index 8c40eaea4c4b..d4bbca198de1 100644 --- a/internal/services/network/network_interface_resource.go +++ b/internal/services/network/network_interface_resource.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) var networkInterfaceResourceName = "azurerm_network_interface" diff --git a/internal/services/network/network_manager_admin_rule_collection_resource.go b/internal/services/network/network_manager_admin_rule_collection_resource.go new file mode 100644 index 000000000000..7dcbff341cea --- /dev/null +++ b/internal/services/network/network_manager_admin_rule_collection_resource.go @@ -0,0 +1,257 @@ +package network + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" +) + +type ManagerAdminRuleCollectionModel struct { + Name string `tfschema:"name"` + SecurityAdminConfigurationId string `tfschema:"security_admin_configuration_id"` + NetworkGroupIds []string `tfschema:"network_group_ids"` + Description string `tfschema:"description"` +} + +type ManagerAdminRuleCollectionResource struct{} + +var _ sdk.ResourceWithUpdate = ManagerAdminRuleCollectionResource{} + +func (r ManagerAdminRuleCollectionResource) ResourceType() string { + return "azurerm_network_manager_admin_rule_collection" +} + +func (r ManagerAdminRuleCollectionResource) ModelObject() interface{} { + return &ManagerAdminRuleCollectionModel{} +} + +func (r ManagerAdminRuleCollectionResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.NetworkManagerAdminRuleCollectionID +} + +func (r ManagerAdminRuleCollectionResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "security_admin_configuration_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.NetworkManagerSecurityAdminConfigurationID, + }, + + "network_group_ids": { + Type: pluginsdk.TypeList, + Required: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validate.NetworkManagerNetworkGroupID, + }, + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + }, + } +} + +func (r ManagerAdminRuleCollectionResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r ManagerAdminRuleCollectionResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model ManagerAdminRuleCollectionModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.Network.ManagerAdminRuleCollectionsClient + configurationId, err := parse.NetworkManagerSecurityAdminConfigurationID(model.SecurityAdminConfigurationId) + if err != nil { + return err + } + + id := parse.NewNetworkManagerAdminRuleCollectionID(configurationId.SubscriptionId, configurationId.ResourceGroup, + configurationId.NetworkManagerName, configurationId.SecurityAdminConfigurationName, model.Name) + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName) + + if err != nil && !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !utils.ResponseWasNotFound(existing.Response) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + adminRuleCollection := &network.AdminRuleCollection{ + AdminRuleCollectionPropertiesFormat: &network.AdminRuleCollectionPropertiesFormat{ + AppliesToGroups: expandNetworkManagerNetworkGroupIds(model.NetworkGroupIds), + }, + } + + if model.Description != "" { + adminRuleCollection.AdminRuleCollectionPropertiesFormat.Description = &model.Description + } + + if _, err := client.CreateOrUpdate(ctx, *adminRuleCollection, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r ManagerAdminRuleCollectionResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerAdminRuleCollectionsClient + + id, err := parse.NetworkManagerAdminRuleCollectionID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model ManagerAdminRuleCollectionModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := existing.AdminRuleCollectionPropertiesFormat + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + if metadata.ResourceData.HasChange("network_group_ids") { + properties.AppliesToGroups = expandNetworkManagerNetworkGroupIds(model.NetworkGroupIds) + } + + if metadata.ResourceData.HasChange("description") { + properties.Description = utils.String(model.Description) + } + + if _, err := client.CreateOrUpdate(ctx, existing, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r ManagerAdminRuleCollectionResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerAdminRuleCollectionsClient + + id, err := parse.NetworkManagerAdminRuleCollectionID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName) + if err != nil { + if utils.ResponseWasNotFound(existing.Response) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := existing.AdminRuleCollectionPropertiesFormat + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + state := ManagerAdminRuleCollectionModel{ + Name: id.RuleCollectionName, + SecurityAdminConfigurationId: parse.NewNetworkManagerSecurityAdminConfigurationID(id.SubscriptionId, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName).ID(), + NetworkGroupIds: flattenNetworkManagerNetworkGroupIds(properties.AppliesToGroups), + } + + if properties.Description != nil { + state.Description = *properties.Description + } + + return metadata.Encode(&state) + }, + } +} + +func (r ManagerAdminRuleCollectionResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerAdminRuleCollectionsClient + + id, err := parse.NetworkManagerAdminRuleCollectionID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName, utils.Bool(true)) + if err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) + } + return nil + }, + } +} + +func expandNetworkManagerNetworkGroupIds(inputList []string) *[]network.ManagerSecurityGroupItem { + var outputList []network.ManagerSecurityGroupItem + for _, v := range inputList { + input := v + output := network.ManagerSecurityGroupItem{ + NetworkGroupID: utils.String(input), + } + + outputList = append(outputList, output) + } + + return &outputList +} + +func flattenNetworkManagerNetworkGroupIds(inputList *[]network.ManagerSecurityGroupItem) []string { + var outputList []string + if inputList == nil { + return outputList + } + + for _, input := range *inputList { + if input.NetworkGroupID != nil { + outputList = append(outputList, *input.NetworkGroupID) + } + } + + return outputList +} diff --git a/internal/services/network/network_manager_admin_rule_collection_resource_test.go b/internal/services/network/network_manager_admin_rule_collection_resource_test.go new file mode 100644 index 000000000000..6d08a77ba3a7 --- /dev/null +++ b/internal/services/network/network_manager_admin_rule_collection_resource_test.go @@ -0,0 +1,190 @@ +package network_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type NetworkAdminRuleCollectionResource struct{} + +func testAccNetworkManagerAdminRuleCollection_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_admin_rule_collection", "test") + r := NetworkAdminRuleCollectionResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccNetworkManagerAdminRuleCollection_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_admin_rule_collection", "test") + r := NetworkAdminRuleCollectionResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func testAccNetworkManagerAdminRuleCollection_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_admin_rule_collection", "test") + r := NetworkAdminRuleCollectionResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccNetworkManagerAdminRuleCollection_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_admin_rule_collection", "test") + r := NetworkAdminRuleCollectionResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r NetworkAdminRuleCollectionResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := parse.NetworkManagerAdminRuleCollectionID(state.ID) + if err != nil { + return nil, err + } + + client := clients.Network.ManagerAdminRuleCollectionsClient + resp, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.AdminRuleCollectionPropertiesFormat != nil), nil +} + +func (r NetworkAdminRuleCollectionResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-network-manager-%d" + location = "%s" +} + +data "azurerm_subscription" "current" { +} + +resource "azurerm_network_manager" "test" { + name = "acctest-nm-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + scope { + subscription_ids = [data.azurerm_subscription.current.id] + } + scope_accesses = ["SecurityAdmin"] +} + +resource "azurerm_network_manager_network_group" "test" { + name = "acctest-nmng-%d" + network_manager_id = azurerm_network_manager.test.id +} + +resource "azurerm_network_manager_security_admin_configuration" "test" { + name = "acctest-nmsac-%d" + network_manager_id = azurerm_network_manager.test.id +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) +} + +func (r NetworkAdminRuleCollectionResource) basic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` + %s + +resource "azurerm_network_manager_admin_rule_collection" "test" { + name = "acctest-nmarc-%d" + security_admin_configuration_id = azurerm_network_manager_security_admin_configuration.test.id + network_group_ids = [azurerm_network_manager_network_group.test.id] +} +`, template, data.RandomInteger) +} + +func (r NetworkAdminRuleCollectionResource) requiresImport(data acceptance.TestData) string { + config := r.basic(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_admin_rule_collection" "import" { + name = azurerm_network_manager_admin_rule_collection.test.name + security_admin_configuration_id = azurerm_network_manager_admin_rule_collection.test.security_admin_configuration_id + network_group_ids = azurerm_network_manager_admin_rule_collection.test.network_group_ids +} +`, config) +} + +func (r NetworkAdminRuleCollectionResource) complete(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_network_group" "test2" { + name = "acctest-nmng2-%d" + network_manager_id = azurerm_network_manager.test.id +} + +resource "azurerm_network_manager_admin_rule_collection" "test" { + name = "acctest-nmarc-%d" + security_admin_configuration_id = azurerm_network_manager_security_admin_configuration.test.id + description = "test admin rule collection" + network_group_ids = [azurerm_network_manager_network_group.test.id, azurerm_network_manager_network_group.test2.id] +} +`, template, data.RandomInteger, data.RandomInteger) +} + +func (r NetworkAdminRuleCollectionResource) update(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_admin_rule_collection" "test" { + name = "acctest-nmarc-%d" + security_admin_configuration_id = azurerm_network_manager_security_admin_configuration.test.id + network_group_ids = [azurerm_network_manager_network_group.test.id] +} +`, template, data.RandomInteger) +} diff --git a/internal/services/network/network_manager_admin_rule_resource.go b/internal/services/network/network_manager_admin_rule_resource.go new file mode 100644 index 000000000000..162d9360f7f3 --- /dev/null +++ b/internal/services/network/network_manager_admin_rule_resource.go @@ -0,0 +1,440 @@ +package network + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" +) + +type ManagerAdminRuleModel struct { + Name string `tfschema:"name"` + NetworkRuleCollectionId string `tfschema:"admin_rule_collection_id"` + Action network.SecurityConfigurationRuleAccess `tfschema:"action"` + Description string `tfschema:"description"` + DestinationPortRanges []string `tfschema:"destination_port_ranges"` + Destinations []AddressPrefixItemModel `tfschema:"destination"` + Direction network.SecurityConfigurationRuleDirection `tfschema:"direction"` + Priority int32 `tfschema:"priority"` + Protocol network.SecurityConfigurationRuleProtocol `tfschema:"protocol"` + SourcePortRanges []string `tfschema:"source_port_ranges"` + Sources []AddressPrefixItemModel `tfschema:"source"` +} + +type AddressPrefixItemModel struct { + AddressPrefix string `tfschema:"address_prefix"` + AddressPrefixType network.AddressPrefixType `tfschema:"address_prefix_type"` +} + +type ManagerAdminRuleResource struct{} + +var _ sdk.ResourceWithUpdate = ManagerAdminRuleResource{} + +func (r ManagerAdminRuleResource) ResourceType() string { + return "azurerm_network_manager_admin_rule" +} + +func (r ManagerAdminRuleResource) ModelObject() interface{} { + return &ManagerAdminRuleModel{} +} + +func (r ManagerAdminRuleResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.NetworkManagerAdminRuleID +} + +func (r ManagerAdminRuleResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "admin_rule_collection_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.NetworkManagerAdminRuleCollectionID, + }, + + "action": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(network.SecurityConfigurationRuleAccessAllow), + string(network.SecurityConfigurationRuleAccessDeny), + string(network.SecurityConfigurationRuleAccessAlwaysAllow), + }, false), + }, + + "direction": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(network.SecurityConfigurationRuleDirectionInbound), + string(network.SecurityConfigurationRuleDirectionOutbound), + }, false), + }, + + "priority": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1, 4096), + }, + + "protocol": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(network.SecurityConfigurationRuleProtocolAh), + string(network.SecurityConfigurationRuleProtocolAny), + string(network.SecurityConfigurationRuleProtocolIcmp), + string(network.SecurityConfigurationRuleProtocolEsp), + string(network.SecurityConfigurationRuleProtocolTCP), + string(network.SecurityConfigurationRuleProtocolUDP), + }, false), + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "destination_port_ranges": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + + "destination": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "address_prefix": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "address_prefix_type": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(network.AddressPrefixTypeIPPrefix), + string(network.AddressPrefixTypeServiceTag), + }, false), + }, + }, + }, + }, + + "source_port_ranges": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + + "source": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "address_prefix": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "address_prefix_type": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(network.AddressPrefixTypeIPPrefix), + string(network.AddressPrefixTypeServiceTag), + }, false), + }, + }, + }, + }, + } +} + +func (r ManagerAdminRuleResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r ManagerAdminRuleResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model ManagerAdminRuleModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.Network.ManagerAdminRulesClient + ruleCollectionId, err := parse.NetworkManagerAdminRuleCollectionID(model.NetworkRuleCollectionId) + if err != nil { + return err + } + + id := parse.NewNetworkManagerAdminRuleID(ruleCollectionId.SubscriptionId, ruleCollectionId.ResourceGroup, + ruleCollectionId.NetworkManagerName, ruleCollectionId.SecurityAdminConfigurationName, ruleCollectionId.RuleCollectionName, model.Name) + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName, id.RuleName) + if err != nil && !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !utils.ResponseWasNotFound(existing.Response) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + rule := &network.AdminRule{ + AdminPropertiesFormat: &network.AdminPropertiesFormat{ + Access: model.Action, + Destinations: expandAddressPrefixItemModel(model.Destinations), + DestinationPortRanges: &model.DestinationPortRanges, + Direction: model.Direction, + Priority: utils.Int32(model.Priority), + Protocol: model.Protocol, + SourcePortRanges: &model.SourcePortRanges, + Sources: expandAddressPrefixItemModel(model.Sources), + }, + } + + if model.Description != "" { + rule.AdminPropertiesFormat.Description = &model.Description + } + + if _, err := client.CreateOrUpdate(ctx, *rule, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName, id.RuleName); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r ManagerAdminRuleResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerAdminRulesClient + + id, err := parse.NetworkManagerAdminRuleID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model ManagerAdminRuleModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName, id.RuleName) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + var rule *network.AdminRule + if adminRule, ok := existing.Value.AsAdminRule(); ok { + rule = adminRule + } + + properties := rule.AdminPropertiesFormat + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + if metadata.ResourceData.HasChange("action") { + properties.Access = model.Action + } + + if metadata.ResourceData.HasChange("description") { + if model.Description != "" { + properties.Description = &model.Description + } else { + properties.Description = nil + } + } + + if metadata.ResourceData.HasChange("destination_port_ranges") { + properties.DestinationPortRanges = &model.DestinationPortRanges + } + + if metadata.ResourceData.HasChange("destination") { + properties.Destinations = expandAddressPrefixItemModel(model.Destinations) + } + + if metadata.ResourceData.HasChange("direction") { + properties.Direction = model.Direction + } + + if metadata.ResourceData.HasChange("priority") { + properties.Priority = utils.Int32(model.Priority) + } + + if metadata.ResourceData.HasChange("protocol") { + properties.Protocol = model.Protocol + } + + if metadata.ResourceData.HasChange("source_port_ranges") { + properties.SourcePortRanges = &model.SourcePortRanges + } + + if metadata.ResourceData.HasChange("source") { + properties.Sources = expandAddressPrefixItemModel(model.Sources) + } + + if _, err := client.CreateOrUpdate(ctx, rule, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName, id.RuleName); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r ManagerAdminRuleResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerAdminRulesClient + + id, err := parse.NetworkManagerAdminRuleID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName, id.RuleName) + if err != nil { + if utils.ResponseWasNotFound(existing.Response) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + var rule *network.AdminRule + if adminRule, ok := existing.Value.AsAdminRule(); ok { + rule = adminRule + } + + properties := rule.AdminPropertiesFormat + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + state := ManagerAdminRuleModel{ + Action: properties.Access, + Name: id.RuleName, + NetworkRuleCollectionId: parse.NewNetworkManagerAdminRuleCollectionID(id.SubscriptionId, id.ResourceGroup, + id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName).ID(), + Destinations: flattenAddressPrefixItemModel(properties.Destinations), + Direction: properties.Direction, + Protocol: properties.Protocol, + Sources: flattenAddressPrefixItemModel(properties.Sources), + } + + if properties.Description != nil { + state.Description = *properties.Description + } + + if properties.DestinationPortRanges != nil { + state.DestinationPortRanges = *properties.DestinationPortRanges + } + + state.Priority = 0 + if properties.Priority != nil { + state.Priority = *properties.Priority + } + + if properties.SourcePortRanges != nil { + state.SourcePortRanges = *properties.SourcePortRanges + } + + return metadata.Encode(&state) + }, + } +} + +func (r ManagerAdminRuleResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerAdminRulesClient + + id, err := parse.NetworkManagerAdminRuleID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName, id.RuleName, utils.Bool(true)) + if err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) + } + + return nil + }, + } +} + +func expandAddressPrefixItemModel(inputList []AddressPrefixItemModel) *[]network.AddressPrefixItem { + var outputList []network.AddressPrefixItem + for _, v := range inputList { + input := v + output := network.AddressPrefixItem{ + AddressPrefixType: input.AddressPrefixType, + } + + if input.AddressPrefix != "" { + output.AddressPrefix = &input.AddressPrefix + } + + outputList = append(outputList, output) + } + + return &outputList +} + +func flattenAddressPrefixItemModel(inputList *[]network.AddressPrefixItem) []AddressPrefixItemModel { + var outputList []AddressPrefixItemModel + if inputList == nil { + return outputList + } + + for _, input := range *inputList { + output := AddressPrefixItemModel{ + AddressPrefixType: input.AddressPrefixType, + } + + if input.AddressPrefix != nil { + output.AddressPrefix = *input.AddressPrefix + } + + outputList = append(outputList, output) + } + + return outputList +} diff --git a/internal/services/network/network_manager_admin_rule_resource_test.go b/internal/services/network/network_manager_admin_rule_resource_test.go new file mode 100644 index 000000000000..dce93f9cc5e7 --- /dev/null +++ b/internal/services/network/network_manager_admin_rule_resource_test.go @@ -0,0 +1,236 @@ +package network_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type ManagerAdminRuleResource struct{} + +func testAccNetworkManagerAdminRule_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_admin_rule", "test") + r := ManagerAdminRuleResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccNetworkManagerAdminRule_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_admin_rule", "test") + r := ManagerAdminRuleResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func testAccNetworkManagerAdminRule_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_admin_rule", "test") + r := ManagerAdminRuleResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccNetworkManagerAdminRule_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_admin_rule", "test") + r := ManagerAdminRuleResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r ManagerAdminRuleResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := parse.NetworkManagerAdminRuleID(state.ID) + if err != nil { + return nil, err + } + + client := clients.Network.ManagerAdminRulesClient + resp, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName, id.RuleName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + _, ok := resp.Value.AsAdminRule() + return utils.Bool(ok), nil +} + +func (r ManagerAdminRuleResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-network-manager-%d" + location = "%s" +} + +data "azurerm_subscription" "current" { +} + +resource "azurerm_network_manager" "test" { + name = "acctest-nm-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + scope { + subscription_ids = [data.azurerm_subscription.current.id] + } + scope_accesses = ["SecurityAdmin"] +} + +resource "azurerm_network_manager_network_group" "test" { + name = "acctest-nmng-%d" + network_manager_id = azurerm_network_manager.test.id +} + +resource "azurerm_network_manager_security_admin_configuration" "test" { + name = "acctest-nmsac-%d" + network_manager_id = azurerm_network_manager.test.id +} + +resource "azurerm_network_manager_admin_rule_collection" "test" { + name = "acctest-nmarc-%d" + security_admin_configuration_id = azurerm_network_manager_security_admin_configuration.test.id + network_group_ids = [azurerm_network_manager_network_group.test.id] +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger) +} + +func (r ManagerAdminRuleResource) basic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` + %s + +resource "azurerm_network_manager_admin_rule" "test" { + name = "acctest-nmar-%d" + admin_rule_collection_id = azurerm_network_manager_admin_rule_collection.test.id + action = "Deny" + direction = "Outbound" + protocol = "Tcp" + priority = 1 +} +`, template, data.RandomInteger) +} + +func (r ManagerAdminRuleResource) requiresImport(data acceptance.TestData) string { + config := r.basic(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_admin_rule" "import" { + name = azurerm_network_manager_admin_rule.test.name + admin_rule_collection_id = azurerm_network_manager_admin_rule.test.admin_rule_collection_id + action = azurerm_network_manager_admin_rule.test.action + direction = azurerm_network_manager_admin_rule.test.direction + priority = azurerm_network_manager_admin_rule.test.priority + protocol = azurerm_network_manager_admin_rule.test.protocol +} +`, config) +} + +func (r ManagerAdminRuleResource) complete(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_admin_rule" "test" { + name = "acctest-nmar-%d" + admin_rule_collection_id = azurerm_network_manager_admin_rule_collection.test.id + action = "Deny" + description = "test admin rule" + direction = "Outbound" + priority = 1 + protocol = "Tcp" + source_port_ranges = ["80", "22", "443"] + destination_port_ranges = ["80", "22"] + source { + address_prefix_type = "ServiceTag" + address_prefix = "Internet" + } + destination { + address_prefix_type = "IPPrefix" + address_prefix = "*" + } +} +`, template, data.RandomInteger) +} + +func (r ManagerAdminRuleResource) update(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_admin_rule" "test" { + name = "acctest-nmar-%d" + admin_rule_collection_id = azurerm_network_manager_admin_rule_collection.test.id + action = "Allow" + description = "test" + direction = "Inbound" + priority = 1234 + protocol = "Ah" + source_port_ranges = ["80", "1024-65535"] + destination_port_ranges = ["80"] + source { + address_prefix_type = "ServiceTag" + address_prefix = "ActionGroup" + } + destination { + address_prefix_type = "IPPrefix" + address_prefix = "10.1.0.1" + } + destination { + address_prefix_type = "IPPrefix" + address_prefix = "10.0.0.0/24" + } +} +`, template, data.RandomInteger) +} diff --git a/internal/services/network/network_manager_connectivity_configuration_resource.go b/internal/services/network/network_manager_connectivity_configuration_resource.go new file mode 100644 index 000000000000..178e47f56fb2 --- /dev/null +++ b/internal/services/network/network_manager_connectivity_configuration_resource.go @@ -0,0 +1,444 @@ +package network + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" +) + +type ManagerConnectivityConfigurationModel struct { + Name string `tfschema:"name"` + NetworkManagerId string `tfschema:"network_manager_id"` + AppliesToGroups []ConnectivityGroupItemModel `tfschema:"applies_to_group"` + ConnectivityTopology network.ConnectivityTopology `tfschema:"connectivity_topology"` + DeleteExistingPeeringEnabled bool `tfschema:"delete_existing_peering_enabled"` + Description string `tfschema:"description"` + Hub []HubModel `tfschema:"hub"` + GlobalMeshEnabled bool `tfschema:"global_mesh_enabled"` +} + +type ConnectivityGroupItemModel struct { + GroupConnectivity network.GroupConnectivity `tfschema:"group_connectivity"` + GlobalMeshEnabled bool `tfschema:"global_mesh_enabled"` + NetworkGroupId string `tfschema:"network_group_id"` + UseHubGateway bool `tfschema:"use_hub_gateway"` +} + +type HubModel struct { + ResourceId string `tfschema:"resource_id"` + ResourceType string `tfschema:"resource_type"` +} + +type ManagerConnectivityConfigurationResource struct{} + +var _ sdk.ResourceWithUpdate = ManagerConnectivityConfigurationResource{} + +func (r ManagerConnectivityConfigurationResource) ResourceType() string { + return "azurerm_network_manager_connectivity_configuration" +} + +func (r ManagerConnectivityConfigurationResource) ModelObject() interface{} { + return &ManagerConnectivityConfigurationModel{} +} + +func (r ManagerConnectivityConfigurationResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.NetworkManagerConnectivityConfigurationID +} + +func (r ManagerConnectivityConfigurationResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "network_manager_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.NetworkManagerID, + }, + + "applies_to_group": { + Type: pluginsdk.TypeList, + Required: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "group_connectivity": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(network.GroupConnectivityNone), + string(network.GroupConnectivityDirectlyConnected), + }, false), + }, + + "global_mesh_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + + "network_group_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "use_hub_gateway": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + }, + }, + }, + + "connectivity_topology": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(network.ConnectivityTopologyHubAndSpoke), + string(network.ConnectivityTopologyMesh), + }, false), + }, + + "delete_existing_peering_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "hub": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "resource_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: azure.ValidateResourceID, + }, + + "resource_type": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "global_mesh_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + } +} + +func (r ManagerConnectivityConfigurationResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r ManagerConnectivityConfigurationResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model ManagerConnectivityConfigurationModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.Network.ManagerConnectivityConfigurationsClient + networkManagerId, err := parse.NetworkManagerID(model.NetworkManagerId) + if err != nil { + return err + } + + id := parse.NewNetworkManagerConnectivityConfigurationID(networkManagerId.SubscriptionId, networkManagerId.ResourceGroup, networkManagerId.Name, model.Name) + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.ConnectivityConfigurationName) + if err != nil && !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !utils.ResponseWasNotFound(existing.Response) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + conf := &network.ConnectivityConfiguration{ + ConnectivityConfigurationProperties: &network.ConnectivityConfigurationProperties{ + AppliesToGroups: expandConnectivityGroupItemModel(model.AppliesToGroups), + ConnectivityTopology: model.ConnectivityTopology, + DeleteExistingPeering: expandDeleteExistingPeering(model.DeleteExistingPeeringEnabled), + IsGlobal: expandConnectivityConfIsGlobal(model.GlobalMeshEnabled), + Hubs: expandHubModel(model.Hub), + }, + } + + if model.Description != "" { + conf.ConnectivityConfigurationProperties.Description = &model.Description + } + + if _, err := client.CreateOrUpdate(ctx, *conf, id.ResourceGroup, id.NetworkManagerName, id.ConnectivityConfigurationName); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r ManagerConnectivityConfigurationResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerConnectivityConfigurationsClient + + id, err := parse.NetworkManagerConnectivityConfigurationID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model ManagerConnectivityConfigurationModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.ConnectivityConfigurationName) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := existing.ConnectivityConfigurationProperties + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + if metadata.ResourceData.HasChange("applies_to_group") { + properties.AppliesToGroups = expandConnectivityGroupItemModel(model.AppliesToGroups) + } + + if metadata.ResourceData.HasChange("connectivity_topology") { + properties.ConnectivityTopology = model.ConnectivityTopology + } + + if metadata.ResourceData.HasChange("delete_existing_peering_enabled") { + properties.DeleteExistingPeering = expandDeleteExistingPeering(model.DeleteExistingPeeringEnabled) + } + + if metadata.ResourceData.HasChange("description") { + properties.Description = utils.String(model.Description) + } + + if metadata.ResourceData.HasChange("hub") { + properties.Hubs = expandHubModel(model.Hub) + } + + if metadata.ResourceData.HasChange("global_mesh_enabled") { + properties.IsGlobal = expandConnectivityConfIsGlobal(model.GlobalMeshEnabled) + } + + if _, err := client.CreateOrUpdate(ctx, existing, id.ResourceGroup, id.NetworkManagerName, id.ConnectivityConfigurationName); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r ManagerConnectivityConfigurationResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerConnectivityConfigurationsClient + + id, err := parse.NetworkManagerConnectivityConfigurationID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.ConnectivityConfigurationName) + if err != nil { + if utils.ResponseWasNotFound(existing.Response) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := existing.ConnectivityConfigurationProperties + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + state := ManagerConnectivityConfigurationModel{ + Name: id.ConnectivityConfigurationName, + NetworkManagerId: parse.NewNetworkManagerID(id.SubscriptionId, id.ResourceGroup, id.NetworkManagerName).ID(), + AppliesToGroups: flattenConnectivityGroupItemModel(properties.AppliesToGroups), + ConnectivityTopology: properties.ConnectivityTopology, + DeleteExistingPeeringEnabled: flattenDeleteExistingPeering(properties.DeleteExistingPeering), + GlobalMeshEnabled: flattenConnectivityConfIsGlobal(properties.IsGlobal), + Hub: flattenHubModel(properties.Hubs), + } + + if properties.Description != nil { + state.Description = *properties.Description + } + + return metadata.Encode(&state) + }, + } +} + +func (r ManagerConnectivityConfigurationResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerConnectivityConfigurationsClient + + id, err := parse.NetworkManagerConnectivityConfigurationID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.NetworkManagerName, id.ConnectivityConfigurationName, utils.Bool(true)) + if err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) + } + + return nil + }, + } +} + +func expandDeleteExistingPeering(input bool) network.DeleteExistingPeering { + if input { + return network.DeleteExistingPeeringTrue + } + return network.DeleteExistingPeeringFalse +} + +func expandConnectivityConfIsGlobal(input bool) network.IsGlobal { + if input { + return network.IsGlobalTrue + } + return network.IsGlobalFalse +} + +func expandConnectivityGroupItemModel(inputList []ConnectivityGroupItemModel) *[]network.ConnectivityGroupItem { + var outputList []network.ConnectivityGroupItem + for _, v := range inputList { + input := v + output := network.ConnectivityGroupItem{ + GroupConnectivity: input.GroupConnectivity, + IsGlobal: expandConnectivityConfIsGlobal(input.GlobalMeshEnabled), + NetworkGroupID: utils.String(input.NetworkGroupId), + UseHubGateway: expandUseHubGateWay(input.UseHubGateway), + } + + outputList = append(outputList, output) + } + + return &outputList +} + +func expandUseHubGateWay(input bool) network.UseHubGateway { + if input { + return network.UseHubGatewayTrue + } + return network.UseHubGatewayFalse +} + +func expandHubModel(inputList []HubModel) *[]network.Hub { + var outputList []network.Hub + for _, v := range inputList { + input := v + output := network.Hub{ + ResourceID: utils.String(input.ResourceId), + ResourceType: utils.String(input.ResourceType), + } + + outputList = append(outputList, output) + } + + return &outputList +} + +func flattenDeleteExistingPeering(input network.DeleteExistingPeering) bool { + return input == network.DeleteExistingPeeringTrue +} + +func flattenConnectivityConfIsGlobal(input network.IsGlobal) bool { + return input == network.IsGlobalTrue +} + +func flattenConnectivityGroupItemModel(inputList *[]network.ConnectivityGroupItem) []ConnectivityGroupItemModel { + var outputList []ConnectivityGroupItemModel + if inputList == nil { + return outputList + } + + for _, input := range *inputList { + output := ConnectivityGroupItemModel{ + GroupConnectivity: input.GroupConnectivity, + UseHubGateway: flattenUseHubGateWay(input.UseHubGateway), + GlobalMeshEnabled: flattenConnectivityConfIsGlobal(input.IsGlobal), + } + + if input.NetworkGroupID != nil { + output.NetworkGroupId = *input.NetworkGroupID + } + + outputList = append(outputList, output) + } + + return outputList +} + +func flattenUseHubGateWay(input network.UseHubGateway) bool { + return input == network.UseHubGatewayTrue +} + +func flattenHubModel(inputList *[]network.Hub) []HubModel { + var outputList []HubModel + if inputList == nil { + return outputList + } + + for _, input := range *inputList { + output := HubModel{} + + if input.ResourceID != nil { + output.ResourceId = *input.ResourceID + } + + if input.ResourceType != nil { + output.ResourceType = *input.ResourceType + } + + outputList = append(outputList, output) + } + + return outputList +} diff --git a/internal/services/network/network_manager_connectivity_configuration_resource_test.go b/internal/services/network/network_manager_connectivity_configuration_resource_test.go new file mode 100644 index 000000000000..4c0e744eb8b2 --- /dev/null +++ b/internal/services/network/network_manager_connectivity_configuration_resource_test.go @@ -0,0 +1,275 @@ +package network_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type ManagerConnectivityConfigurationResource struct{} + +func testAccNetworkManagerConnectivityConfiguration_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_connectivity_configuration", "test") + r := ManagerConnectivityConfigurationResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccNetworkManagerConnectivityConfiguration_basicTopologyMesh(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_connectivity_configuration", "test") + r := ManagerConnectivityConfigurationResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basicTopologyMesh(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccNetworkManagerConnectivityConfiguration_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_connectivity_configuration", "test") + r := ManagerConnectivityConfigurationResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func testAccNetworkManagerConnectivityConfiguration_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_connectivity_configuration", "test") + r := ManagerConnectivityConfigurationResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccNetworkManagerConnectivityConfiguration_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_connectivity_configuration", "test") + r := ManagerConnectivityConfigurationResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r ManagerConnectivityConfigurationResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := parse.NetworkManagerConnectivityConfigurationID(state.ID) + if err != nil { + return nil, err + } + + client := clients.Network.ManagerConnectivityConfigurationsClient + resp, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.ConnectivityConfigurationName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.ConnectivityConfigurationProperties != nil), nil +} + +func (r ManagerConnectivityConfigurationResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-network-manager-%d" + location = "%s" +} + +data "azurerm_subscription" "current" { +} + +resource "azurerm_network_manager" "test" { + name = "acctest-nm-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + scope { + subscription_ids = [data.azurerm_subscription.current.id] + } + scope_accesses = ["Connectivity"] +} + +resource "azurerm_network_manager_network_group" "test" { + name = "acctest-nmng-%d" + network_manager_id = azurerm_network_manager.test.id +} + +resource "azurerm_virtual_network" "test" { + name = "acctest-vnet-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + address_space = ["10.0.0.0/16"] + flow_timeout_in_minutes = 10 +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) +} + +func (r ManagerConnectivityConfigurationResource) basic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_connectivity_configuration" "test" { + name = "acctest-nmcc-%d" + network_manager_id = azurerm_network_manager.test.id + connectivity_topology = "HubAndSpoke" + applies_to_group { + group_connectivity = "None" + network_group_id = azurerm_network_manager_network_group.test.id + } + hub { + resource_id = azurerm_virtual_network.test.id + resource_type = "Microsoft.Network/virtualNetworks" + } +} +`, template, data.RandomInteger) +} + +func (r ManagerConnectivityConfigurationResource) basicTopologyMesh(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_connectivity_configuration" "test" { + name = "acctest-nmcc-%d" + network_manager_id = azurerm_network_manager.test.id + connectivity_topology = "Mesh" + applies_to_group { + group_connectivity = "None" + network_group_id = azurerm_network_manager_network_group.test.id + } +} +`, template, data.RandomInteger) +} + +func (r ManagerConnectivityConfigurationResource) requiresImport(data acceptance.TestData) string { + config := r.basic(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_connectivity_configuration" "import" { + name = azurerm_network_manager_connectivity_configuration.test.name + network_manager_id = azurerm_network_manager_connectivity_configuration.test.network_manager_id + connectivity_topology = azurerm_network_manager_connectivity_configuration.test.connectivity_topology + applies_to_group { + group_connectivity = azurerm_network_manager_connectivity_configuration.test.applies_to_group.0.group_connectivity + network_group_id = azurerm_network_manager_connectivity_configuration.test.applies_to_group.0.network_group_id + } + hub { + resource_id = azurerm_network_manager_connectivity_configuration.test.hub.0.resource_id + resource_type = azurerm_network_manager_connectivity_configuration.test.hub.0.resource_type + } +} +`, config) +} + +func (r ManagerConnectivityConfigurationResource) complete(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_network_group" "test2" { + name = "acctest-nmng2-%d" + network_manager_id = azurerm_network_manager.test.id +} + +resource "azurerm_network_manager_connectivity_configuration" "test" { + name = "acctest-nmcc-%[2]d" + network_manager_id = azurerm_network_manager.test.id + connectivity_topology = "HubAndSpoke" + delete_existing_peering_enabled = false + global_mesh_enabled = false + description = "test connectivity configuration" + applies_to_group { + group_connectivity = "None" + network_group_id = azurerm_network_manager_network_group.test.id + global_mesh_enabled = false + use_hub_gateway = false + } + applies_to_group { + group_connectivity = "DirectlyConnected" + network_group_id = azurerm_network_manager_network_group.test2.id + global_mesh_enabled = true + use_hub_gateway = true + } + hub { + resource_id = azurerm_virtual_network.test.id + resource_type = "Microsoft.Network/virtualNetworks" + } +} +`, template, data.RandomInteger) +} + +func (r ManagerConnectivityConfigurationResource) update(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_connectivity_configuration" "test" { + name = "acctest-nmcc-%d" + network_manager_id = azurerm_network_manager.test.id + connectivity_topology = "HubAndSpoke" + description = "test" + global_mesh_enabled = true + applies_to_group { + group_connectivity = "DirectlyConnected" + network_group_id = azurerm_network_manager_network_group.test.id + } + hub { + resource_id = azurerm_virtual_network.test.id + resource_type = "Microsoft.Network/virtualNetworks" + } +} +`, template, data.RandomInteger) +} diff --git a/internal/services/network/network_manager_management_group_connection_resource.go b/internal/services/network/network_manager_management_group_connection_resource.go index 0288f669e1d9..888ad088c36d 100644 --- a/internal/services/network/network_manager_management_group_connection_resource.go +++ b/internal/services/network/network_manager_management_group_connection_resource.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type ManagerManagementGroupConnectionModel struct { diff --git a/internal/services/network/network_manager_management_group_connection_resource_test.go b/internal/services/network/network_manager_management_group_connection_resource_test.go index a725d774da63..e57944bebc8a 100644 --- a/internal/services/network/network_manager_management_group_connection_resource_test.go +++ b/internal/services/network/network_manager_management_group_connection_resource_test.go @@ -111,7 +111,7 @@ resource "azurerm_management_group_subscription_association" "test" { } resource "azurerm_resource_group" "test" { - name = "acctestRG-nm-%d" + name = "acctestRG-network-manager-%d" location = "%s" } @@ -147,7 +147,7 @@ resource "azurerm_network_manager" "test" { func (r ManagerManagementGroupConnectionResource) basic(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` - %s +%s resource "azurerm_network_manager_management_group_connection" "test" { name = "acctest-nmmgc-%d" @@ -160,7 +160,7 @@ resource "azurerm_network_manager_management_group_connection" "test" { func (r ManagerManagementGroupConnectionResource) requiresImport(data acceptance.TestData) string { config := r.basic(data) return fmt.Sprintf(` - %s +%s resource "azurerm_network_manager_management_group_connection" "import" { name = azurerm_network_manager_management_group_connection.test.name @@ -173,7 +173,7 @@ resource "azurerm_network_manager_management_group_connection" "import" { func (r ManagerManagementGroupConnectionResource) complete(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` - %s +%s resource "azurerm_network_manager_management_group_connection" "test" { name = "acctest-nmmgc-%d" @@ -187,7 +187,7 @@ resource "azurerm_network_manager_management_group_connection" "test" { func (r ManagerManagementGroupConnectionResource) update(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` - %s +%s resource "azurerm_network_manager_management_group_connection" "test" { name = "acctest-nmmgc-%d" diff --git a/internal/services/network/network_manager_network_group_resource.go b/internal/services/network/network_manager_network_group_resource.go index 50807a868e3d..83525d61cbac 100644 --- a/internal/services/network/network_manager_network_group_resource.go +++ b/internal/services/network/network_manager_network_group_resource.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type ManagerNetworkGroupModel struct { diff --git a/internal/services/network/network_manager_network_group_resource_test.go b/internal/services/network/network_manager_network_group_resource_test.go index 118b2cede0a0..5dce4983b672 100644 --- a/internal/services/network/network_manager_network_group_resource_test.go +++ b/internal/services/network/network_manager_network_group_resource_test.go @@ -101,7 +101,7 @@ provider "azurerm" { features {} } resource "azurerm_resource_group" "test" { - name = "acctest-nmng-%d" + name = "acctestRG-network-manager-%d" location = "%s" } data "azurerm_subscription" "current" { diff --git a/internal/services/network/network_manager_resource.go b/internal/services/network/network_manager_resource.go index 3400d784ad3f..d0f721946242 100644 --- a/internal/services/network/network_manager_resource.go +++ b/internal/services/network/network_manager_resource.go @@ -18,7 +18,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type ManagerModel struct { diff --git a/internal/services/network/network_manager_resource_test.go b/internal/services/network/network_manager_resource_test.go index c5bcb0825912..4a412211d6a9 100644 --- a/internal/services/network/network_manager_resource_test.go +++ b/internal/services/network/network_manager_resource_test.go @@ -45,6 +45,41 @@ func TestAccNetworkManager(t *testing.T) { "update": testAccNetworkManagerManagementGroupConnection_update, "requiresImport": testAccNetworkManagerManagementGroupConnection_requiresImport, }, + "ScopeConnection": { + "basic": testAccNetworkManagerScopeConnection_basic, + "complete": testAccNetworkManagerScopeConnection_complete, + "update": testAccNetworkManagerScopeConnection_update, + "requiresImport": testAccNetworkManagerScopeConnection_requiresImport, + }, + "StaticMember": { + "basic": testAccNetworkManagerStaticMember_basic, + "requiresImport": testAccNetworkManagerStaticMember_requiresImport, + }, + "ConnectivityConfiguration": { + "basic": testAccNetworkManagerConnectivityConfiguration_basic, + "basicTopologyMesh": testAccNetworkManagerConnectivityConfiguration_basicTopologyMesh, + "complete": testAccNetworkManagerConnectivityConfiguration_complete, + "update": testAccNetworkManagerConnectivityConfiguration_update, + "requiresImport": testAccNetworkManagerConnectivityConfiguration_requiresImport, + }, + "SecurityAdminConfiguration": { + "basic": testAccNetworkManagerSecurityAdminConfiguration_basic, + "complete": testAccNetworkManagerSecurityAdminConfiguration_complete, + "update": testAccNetworkManagerSecurityAdminConfiguration_update, + "requiresImport": testAccNetworkManagerSecurityAdminConfiguration_requiresImport, + }, + "AdminRuleCollection": { + "basic": testAccNetworkManagerAdminRuleCollection_basic, + "complete": testAccNetworkManagerAdminRuleCollection_complete, + "update": testAccNetworkManagerAdminRuleCollection_update, + "requiresImport": testAccNetworkManagerAdminRuleCollection_requiresImport, + }, + "AdminRule": { + "basic": testAccNetworkManagerAdminRule_basic, + "complete": testAccNetworkManagerAdminRule_complete, + "update": testAccNetworkManagerAdminRule_update, + "requiresImport": testAccNetworkManagerAdminRule_requiresImport, + }, } for group, m := range testCases { diff --git a/internal/services/network/network_manager_scope_connection_resource.go b/internal/services/network/network_manager_scope_connection_resource.go new file mode 100644 index 000000000000..52c3fb6dc81c --- /dev/null +++ b/internal/services/network/network_manager_scope_connection_resource.go @@ -0,0 +1,259 @@ +package network + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" +) + +type ManagerScopeConnectionModel struct { + Name string `tfschema:"name"` + NetworkManagerId string `tfschema:"network_manager_id"` + ConnectionState string `tfschema:"connection_state"` + Description string `tfschema:"description"` + ResourceId string `tfschema:"target_scope_id"` + TenantId string `tfschema:"tenant_id"` +} + +type ManagerScopeConnectionResource struct{} + +var _ sdk.ResourceWithUpdate = ManagerScopeConnectionResource{} + +func (r ManagerScopeConnectionResource) ResourceType() string { + return "azurerm_network_manager_scope_connection" +} + +func (r ManagerScopeConnectionResource) ModelObject() interface{} { + return &ManagerScopeConnectionModel{} +} + +func (r ManagerScopeConnectionResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.NetworkManagerScopeConnectionID +} + +func (r ManagerScopeConnectionResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "network_manager_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.NetworkManagerID, + }, + + "target_scope_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "tenant_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.IsUUID, + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + } +} + +func (r ManagerScopeConnectionResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + + "connection_state": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (r ManagerScopeConnectionResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model ManagerScopeConnectionModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.Network.ManagerScopeConnectionsClient + networkManagerId, err := parse.NetworkManagerID(model.NetworkManagerId) + if err != nil { + return err + } + + id := parse.NewNetworkManagerScopeConnectionID(networkManagerId.SubscriptionId, networkManagerId.ResourceGroup, networkManagerId.Name, model.Name) + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.ScopeConnectionName) + if err != nil && !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !utils.ResponseWasNotFound(existing.Response) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + scopeConnection := &network.ScopeConnection{ + ScopeConnectionProperties: &network.ScopeConnectionProperties{}, + } + + if model.Description != "" { + scopeConnection.ScopeConnectionProperties.Description = &model.Description + } + + if model.ResourceId != "" { + scopeConnection.ScopeConnectionProperties.ResourceID = &model.ResourceId + } + + if model.TenantId != "" { + scopeConnection.ScopeConnectionProperties.TenantID = &model.TenantId + } + + if _, err := client.CreateOrUpdate(ctx, *scopeConnection, id.ResourceGroup, id.NetworkManagerName, id.ScopeConnectionName); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r ManagerScopeConnectionResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerScopeConnectionsClient + + id, err := parse.NetworkManagerScopeConnectionID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model ManagerScopeConnectionModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.ScopeConnectionName) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := existing.ScopeConnectionProperties + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + if metadata.ResourceData.HasChange("description") { + if model.Description != "" { + properties.Description = &model.Description + } + } + + if metadata.ResourceData.HasChange("target_scope_id") { + if model.ResourceId != "" { + properties.ResourceID = &model.ResourceId + } + } + + if metadata.ResourceData.HasChange("tenant_id") { + if model.TenantId != "" { + properties.TenantID = &model.TenantId + } + } + + if _, err := client.CreateOrUpdate(ctx, existing, id.ResourceGroup, id.NetworkManagerName, id.ScopeConnectionName); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r ManagerScopeConnectionResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerScopeConnectionsClient + + id, err := parse.NetworkManagerScopeConnectionID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.ScopeConnectionName) + if err != nil { + if utils.ResponseWasNotFound(existing.Response) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := existing.ScopeConnectionProperties + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + state := ManagerScopeConnectionModel{ + Name: id.ScopeConnectionName, + NetworkManagerId: parse.NewNetworkManagerID(id.SubscriptionId, id.ResourceGroup, id.NetworkManagerName).ID(), + } + + state.ConnectionState = string(properties.ConnectionState) + + if properties.Description != nil { + state.Description = *properties.Description + } + + if properties.ResourceID != nil { + state.ResourceId = *properties.ResourceID + } + + if properties.TenantID != nil { + state.TenantId = *properties.TenantID + } + + return metadata.Encode(&state) + }, + } +} + +func (r ManagerScopeConnectionResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerScopeConnectionsClient + + id, err := parse.NetworkManagerScopeConnectionID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, id.ResourceGroup, id.NetworkManagerName, id.ScopeConnectionName); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} diff --git a/internal/services/network/network_manager_scope_connection_resource_test.go b/internal/services/network/network_manager_scope_connection_resource_test.go new file mode 100644 index 000000000000..6a5746c66162 --- /dev/null +++ b/internal/services/network/network_manager_scope_connection_resource_test.go @@ -0,0 +1,183 @@ +package network_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type ManagerScopeConnectionResource struct{} + +func testAccNetworkManagerScopeConnection_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_scope_connection", "test") + r := ManagerScopeConnectionResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccNetworkManagerScopeConnection_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_scope_connection", "test") + r := ManagerScopeConnectionResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func testAccNetworkManagerScopeConnection_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_scope_connection", "test") + r := ManagerScopeConnectionResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccNetworkManagerScopeConnection_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_scope_connection", "test") + r := ManagerScopeConnectionResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r ManagerScopeConnectionResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := parse.NetworkManagerScopeConnectionID(state.ID) + if err != nil { + return nil, err + } + + client := clients.Network.ManagerScopeConnectionsClient + resp, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.ScopeConnectionName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.ScopeConnectionProperties != nil), nil +} + +func (r ManagerScopeConnectionResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-network-manager-%d" + location = "%s" +} + +data "azurerm_client_config" "current" { +} + +data "azurerm_subscription" "current" { +} + +resource "azurerm_network_manager" "test" { + name = "acctest-networkmanager-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + scope { + subscription_ids = [data.azurerm_subscription.current.id] + } + scope_accesses = ["SecurityAdmin"] +} +`, data.RandomInteger, data.Locations.Primary) +} + +func (r ManagerScopeConnectionResource) basic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_scope_connection" "test" { + name = "acctest-nsc-%d" + network_manager_id = azurerm_network_manager.test.id + tenant_id = data.azurerm_client_config.current.tenant_id + target_scope_id = data.azurerm_subscription.current.id +} +`, template, data.RandomInteger) +} + +func (r ManagerScopeConnectionResource) requiresImport(data acceptance.TestData) string { + config := r.basic(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_scope_connection" "import" { + name = azurerm_network_manager_scope_connection.test.name + network_manager_id = azurerm_network_manager_scope_connection.test.network_manager_id + tenant_id = azurerm_network_manager_scope_connection.test.tenant_id + target_scope_id = azurerm_network_manager_scope_connection.test.target_scope_id +} +`, config) +} + +func (r ManagerScopeConnectionResource) complete(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_scope_connection" "test" { + name = "acctest-nsc-%d" + network_manager_id = azurerm_network_manager.test.id + tenant_id = data.azurerm_client_config.current.tenant_id + target_scope_id = data.azurerm_subscription.current.id + description = "complete" +} +`, template, data.RandomInteger) +} + +func (r ManagerScopeConnectionResource) update(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_scope_connection" "test" { + name = "acctest-nsc-%d" + network_manager_id = azurerm_network_manager.test.id + tenant_id = data.azurerm_client_config.current.tenant_id + target_scope_id = data.azurerm_subscription.current.id + description = "update" +} +`, template, data.RandomInteger) +} diff --git a/internal/services/network/network_manager_security_admin_configuration_resource.go b/internal/services/network/network_manager_security_admin_configuration_resource.go new file mode 100644 index 000000000000..5d50e2592801 --- /dev/null +++ b/internal/services/network/network_manager_security_admin_configuration_resource.go @@ -0,0 +1,261 @@ +package network + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" +) + +type ManagerSecurityAdminConfigurationModel struct { + Name string `tfschema:"name"` + NetworkManagerId string `tfschema:"network_manager_id"` + ApplyOnNetworkIntentPolicyBasedServices []string `tfschema:"apply_on_network_intent_policy_based_services"` + Description string `tfschema:"description"` +} + +type ManagerSecurityAdminConfigurationResource struct{} + +var _ sdk.ResourceWithUpdate = ManagerSecurityAdminConfigurationResource{} + +func (r ManagerSecurityAdminConfigurationResource) ResourceType() string { + return "azurerm_network_manager_security_admin_configuration" +} + +func (r ManagerSecurityAdminConfigurationResource) ModelObject() interface{} { + return &ManagerSecurityAdminConfigurationModel{} +} + +func (r ManagerSecurityAdminConfigurationResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.NetworkManagerSecurityAdminConfigurationID +} + +func (r ManagerSecurityAdminConfigurationResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "network_manager_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.NetworkManagerID, + }, + + "apply_on_network_intent_policy_based_services": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + string(network.IntentPolicyBasedServiceNone), + string(network.IntentPolicyBasedServiceAllowRulesOnly), + string(network.IntentPolicyBasedServiceAll), + }, false), + }, + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + } +} + +func (r ManagerSecurityAdminConfigurationResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r ManagerSecurityAdminConfigurationResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model ManagerSecurityAdminConfigurationModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.Network.ManagerSecurityAdminConfigurationsClient + networkManagerId, err := parse.NetworkManagerID(model.NetworkManagerId) + if err != nil { + return err + } + + id := parse.NewNetworkManagerSecurityAdminConfigurationID(networkManagerId.SubscriptionId, networkManagerId.ResourceGroup, networkManagerId.Name, model.Name) + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName) + if err != nil && !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !utils.ResponseWasNotFound(existing.Response) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + conf := &network.SecurityAdminConfiguration{ + SecurityAdminConfigurationPropertiesFormat: &network.SecurityAdminConfigurationPropertiesFormat{ + ApplyOnNetworkIntentPolicyBasedServices: expandNetworkIntentPolicyBasedServiceModel(model.ApplyOnNetworkIntentPolicyBasedServices), + }, + } + + if model.Description != "" { + conf.SecurityAdminConfigurationPropertiesFormat.Description = &model.Description + } + + if _, err := client.CreateOrUpdate(ctx, *conf, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r ManagerSecurityAdminConfigurationResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerSecurityAdminConfigurationsClient + + id, err := parse.NetworkManagerSecurityAdminConfigurationID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model ManagerSecurityAdminConfigurationModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := existing.SecurityAdminConfigurationPropertiesFormat + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + if metadata.ResourceData.HasChange("apply_on_network_intent_policy_based_services") { + properties.ApplyOnNetworkIntentPolicyBasedServices = expandNetworkIntentPolicyBasedServiceModel(model.ApplyOnNetworkIntentPolicyBasedServices) + } + + if metadata.ResourceData.HasChange("description") { + properties.Description = utils.String(model.Description) + } + + if _, err := client.CreateOrUpdate(ctx, existing, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r ManagerSecurityAdminConfigurationResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerSecurityAdminConfigurationsClient + + id, err := parse.NetworkManagerSecurityAdminConfigurationID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName) + if err != nil { + if utils.ResponseWasNotFound(existing.Response) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := existing.SecurityAdminConfigurationPropertiesFormat + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + state := ManagerSecurityAdminConfigurationModel{ + Name: id.SecurityAdminConfigurationName, + NetworkManagerId: parse.NewNetworkManagerID(id.SubscriptionId, id.ResourceGroup, id.NetworkManagerName).ID(), + ApplyOnNetworkIntentPolicyBasedServices: flattenNetworkIntentPolicyBasedServiceModel(properties.ApplyOnNetworkIntentPolicyBasedServices), + } + + if properties.Description != nil { + state.Description = *properties.Description + } + + return metadata.Encode(&state) + }, + } +} + +func (r ManagerSecurityAdminConfigurationResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerSecurityAdminConfigurationsClient + + id, err := parse.NetworkManagerSecurityAdminConfigurationID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, utils.Bool(true)) + if err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) + } + + return nil + }, + } +} + +func expandNetworkIntentPolicyBasedServiceModel(inputList []string) *[]network.IntentPolicyBasedService { + var outputList []network.IntentPolicyBasedService + for _, input := range inputList { + output := network.IntentPolicyBasedService(input) + + outputList = append(outputList, output) + } + + return &outputList +} + +func flattenNetworkIntentPolicyBasedServiceModel(inputList *[]network.IntentPolicyBasedService) []string { + var outputList []string + if inputList == nil { + return outputList + } + + for _, input := range *inputList { + outputList = append(outputList, string(input)) + } + + return outputList +} diff --git a/internal/services/network/network_manager_security_admin_configuration_resource_test.go b/internal/services/network/network_manager_security_admin_configuration_resource_test.go new file mode 100644 index 000000000000..082687f48b3c --- /dev/null +++ b/internal/services/network/network_manager_security_admin_configuration_resource_test.go @@ -0,0 +1,195 @@ +package network_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type ManagerSecurityAdminConfigurationResource struct{} + +func testAccNetworkManagerSecurityAdminConfiguration_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_security_admin_configuration", "test") + r := ManagerSecurityAdminConfigurationResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccNetworkManagerSecurityAdminConfiguration_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_security_admin_configuration", "test") + r := ManagerSecurityAdminConfigurationResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func testAccNetworkManagerSecurityAdminConfiguration_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_security_admin_configuration", "test") + r := ManagerSecurityAdminConfigurationResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccNetworkManagerSecurityAdminConfiguration_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_security_admin_configuration", "test") + r := ManagerSecurityAdminConfigurationResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r ManagerSecurityAdminConfigurationResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := parse.NetworkManagerSecurityAdminConfigurationID(state.ID) + if err != nil { + return nil, err + } + + client := clients.Network.ManagerSecurityAdminConfigurationsClient + resp, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.SecurityAdminConfigurationPropertiesFormat != nil), nil +} + +func (r ManagerSecurityAdminConfigurationResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-network-manager-%d" + location = "%s" +} + +data "azurerm_subscription" "current" { +} + +resource "azurerm_network_manager" "test" { + name = "acctest-nm-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + scope { + subscription_ids = [data.azurerm_subscription.current.id] + } + scope_accesses = ["SecurityAdmin"] +} + +resource "azurerm_network_manager_network_group" "test" { + name = "acctest-nmng-%d" + network_manager_id = azurerm_network_manager.test.id +} + +resource "azurerm_virtual_network" "test" { + name = "acctest-vnet-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + address_space = ["10.0.0.0/16"] + flow_timeout_in_minutes = 10 +} + +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) +} + +func (r ManagerSecurityAdminConfigurationResource) basic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_security_admin_configuration" "test" { + name = "acctest-nmsac-%d" + network_manager_id = azurerm_network_manager.test.id +} +`, template, data.RandomInteger) +} + +func (r ManagerSecurityAdminConfigurationResource) requiresImport(data acceptance.TestData) string { + config := r.basic(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_security_admin_configuration" "import" { + name = azurerm_network_manager_security_admin_configuration.test.name + network_manager_id = azurerm_network_manager_security_admin_configuration.test.network_manager_id +} +`, config) +} + +func (r ManagerSecurityAdminConfigurationResource) complete(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_security_admin_configuration" "test" { + name = "acctest-nmsac-%d" + network_manager_id = azurerm_network_manager.test.id + description = "test" + apply_on_network_intent_policy_based_services = ["None"] +} +`, template, data.RandomInteger) +} + +func (r ManagerSecurityAdminConfigurationResource) update(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_security_admin_configuration" "test" { + name = "acctest-nmsac-%d" + network_manager_id = azurerm_network_manager.test.id + description = "update" + apply_on_network_intent_policy_based_services = ["AllowRulesOnly"] +} +`, template, data.RandomInteger) +} diff --git a/internal/services/network/network_manager_static_member_resource.go b/internal/services/network/network_manager_static_member_resource.go new file mode 100644 index 000000000000..9c83125e9558 --- /dev/null +++ b/internal/services/network/network_manager_static_member_resource.go @@ -0,0 +1,176 @@ +package network + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" +) + +type ManagerStaticMemberModel struct { + Name string `tfschema:"name"` + NetworkGroupId string `tfschema:"network_group_id"` + TargetVNetId string `tfschema:"target_virtual_network_id"` + Region string `tfschema:"region"` +} + +type ManagerStaticMemberResource struct{} + +var _ sdk.Resource = ManagerStaticMemberResource{} + +func (r ManagerStaticMemberResource) ResourceType() string { + return "azurerm_network_manager_static_member" +} + +func (r ManagerStaticMemberResource) ModelObject() interface{} { + return &ManagerStaticMemberModel{} +} + +func (r ManagerStaticMemberResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.NetworkManagerStaticMemberID +} + +func (r ManagerStaticMemberResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "network_group_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.NetworkManagerNetworkGroupID, + }, + + "target_virtual_network_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.VirtualNetworkID, + }, + } +} + +func (r ManagerStaticMemberResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "region": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (r ManagerStaticMemberResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model ManagerStaticMemberModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.Network.ManagerStaticMembersClient + networkGroupId, err := parse.NetworkManagerNetworkGroupID(model.NetworkGroupId) + if err != nil { + return err + } + + id := parse.NewNetworkManagerStaticMemberID(networkGroupId.SubscriptionId, networkGroupId.ResourceGroup, networkGroupId.NetworkManagerName, networkGroupId.NetworkGroupName, model.Name) + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.NetworkGroupName, id.StaticMemberName) + if err != nil && !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !utils.ResponseWasNotFound(existing.Response) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + staticMember := &network.StaticMember{ + StaticMemberProperties: &network.StaticMemberProperties{ + ResourceID: &model.TargetVNetId, + }, + } + + if _, err := client.CreateOrUpdate(ctx, *staticMember, id.ResourceGroup, id.NetworkManagerName, id.NetworkGroupName, id.StaticMemberName); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r ManagerStaticMemberResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerStaticMembersClient + + id, err := parse.NetworkManagerStaticMemberID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + existing, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.NetworkGroupName, id.StaticMemberName) + if err != nil { + if utils.ResponseWasNotFound(existing.Response) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := existing.StaticMemberProperties + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + state := ManagerStaticMemberModel{ + Name: id.StaticMemberName, + NetworkGroupId: parse.NewNetworkManagerNetworkGroupID(id.SubscriptionId, id.ResourceGroup, id.NetworkManagerName, id.NetworkGroupName).ID(), + } + + if properties.Region != nil { + state.Region = *properties.Region + } + + if properties.ResourceID != nil { + state.TargetVNetId = *properties.ResourceID + } + + return metadata.Encode(&state) + }, + } +} + +func (r ManagerStaticMemberResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Network.ManagerStaticMembersClient + + id, err := parse.NetworkManagerStaticMemberID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, id.ResourceGroup, id.NetworkManagerName, id.NetworkGroupName, id.StaticMemberName); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} diff --git a/internal/services/network/network_manager_static_member_resource_test.go b/internal/services/network/network_manager_static_member_resource_test.go new file mode 100644 index 000000000000..371261313b8c --- /dev/null +++ b/internal/services/network/network_manager_static_member_resource_test.go @@ -0,0 +1,125 @@ +package network_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type ManagerStaticMemberResource struct{} + +func testAccNetworkManagerStaticMember_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_static_member", "test") + r := ManagerStaticMemberResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccNetworkManagerStaticMember_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_network_manager_static_member", "test") + r := ManagerStaticMemberResource{} + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func (r ManagerStaticMemberResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := parse.NetworkManagerStaticMemberID(state.ID) + if err != nil { + return nil, err + } + + client := clients.Network.ManagerStaticMembersClient + resp, err := client.Get(ctx, id.ResourceGroup, id.NetworkManagerName, id.NetworkGroupName, id.StaticMemberName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.StaticMemberProperties != nil), nil +} + +func (r ManagerStaticMemberResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-network-manager-%d" + location = "%s" +} + +data "azurerm_subscription" "current" { +} + +resource "azurerm_network_manager" "test" { + name = "acctest-nm-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + scope { + subscription_ids = [data.azurerm_subscription.current.id] + } + scope_accesses = ["SecurityAdmin"] +} + +resource "azurerm_network_manager_network_group" "test" { + name = "acctest-nmng-%d" + network_manager_id = azurerm_network_manager.test.id +} + +resource "azurerm_virtual_network" "test" { + name = "acctest-vnet-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + address_space = ["10.0.0.0/22"] +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) +} + +func (r ManagerStaticMemberResource) basic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_static_member" "test" { + name = "acctest-nmsm-%d" + network_group_id = azurerm_network_manager_network_group.test.id + target_virtual_network_id = azurerm_virtual_network.test.id +} +`, template, data.RandomInteger) +} + +func (r ManagerStaticMemberResource) requiresImport(data acceptance.TestData) string { + config := r.basic(data) + return fmt.Sprintf(` +%s + +resource "azurerm_network_manager_static_member" "import" { + name = azurerm_network_manager_static_member.test.name + network_group_id = azurerm_network_manager_static_member.test.network_group_id + target_virtual_network_id = azurerm_network_manager_static_member.test.target_virtual_network_id +} +`, config) +} diff --git a/internal/services/network/network_manager_subscription_connection_resource.go b/internal/services/network/network_manager_subscription_connection_resource.go index be2603a288e5..6ec2f947d1ff 100644 --- a/internal/services/network/network_manager_subscription_connection_resource.go +++ b/internal/services/network/network_manager_subscription_connection_resource.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type ManagerSubscriptionConnectionModel struct { diff --git a/internal/services/network/network_manager_subscription_connection_resource_test.go b/internal/services/network/network_manager_subscription_connection_resource_test.go index fc5a6607bc4c..2eedf7da8c9b 100644 --- a/internal/services/network/network_manager_subscription_connection_resource_test.go +++ b/internal/services/network/network_manager_subscription_connection_resource_test.go @@ -102,7 +102,7 @@ provider "azurerm" { } resource "azurerm_resource_group" "test" { - name = "acctestRG-nm-%d" + name = "acctestRG-network-manager-%d" location = "%s" } @@ -124,7 +124,7 @@ resource "azurerm_network_manager" "test" { func (r ManagerSubscriptionConnectionResource) basic(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` - %s +%s resource "azurerm_network_manager_subscription_connection" "test" { name = "acctest-nmsc-%d" @@ -137,7 +137,7 @@ resource "azurerm_network_manager_subscription_connection" "test" { func (r ManagerSubscriptionConnectionResource) requiresImport(data acceptance.TestData) string { config := r.basic(data) return fmt.Sprintf(` - %s +%s resource "azurerm_network_manager_subscription_connection" "import" { name = "acctest-nmsc-%d" @@ -150,7 +150,7 @@ resource "azurerm_network_manager_subscription_connection" "import" { func (r ManagerSubscriptionConnectionResource) complete(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` - %s +%s resource "azurerm_network_manager_subscription_connection" "test" { name = "acctest-nmsc-%d" @@ -164,7 +164,7 @@ resource "azurerm_network_manager_subscription_connection" "test" { func (r ManagerSubscriptionConnectionResource) update(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` - %s +%s resource "azurerm_network_manager_subscription_connection" "test" { name = "acctest-nmsc-%d" diff --git a/internal/services/network/network_packet_capture_resource.go b/internal/services/network/network_packet_capture_resource.go index cf9042ec0440..6ea97f6e7eb5 100644 --- a/internal/services/network/network_packet_capture_resource.go +++ b/internal/services/network/network_packet_capture_resource.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceNetworkPacketCapture() *pluginsdk.Resource { diff --git a/internal/services/network/network_profile_resource.go b/internal/services/network/network_profile_resource.go index 7dee0baf0e2f..02674e9eab03 100644 --- a/internal/services/network/network_profile_resource.go +++ b/internal/services/network/network_profile_resource.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) const azureNetworkProfileResourceName = "azurerm_network_profile" diff --git a/internal/services/network/network_security_group_resource.go b/internal/services/network/network_security_group_resource.go index 7c3446e15b50..2937d427519f 100644 --- a/internal/services/network/network_security_group_resource.go +++ b/internal/services/network/network_security_group_resource.go @@ -18,7 +18,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) var networkSecurityGroupResourceName = "azurerm_network_security_group" diff --git a/internal/services/network/network_security_rule_resource.go b/internal/services/network/network_security_rule_resource.go index 4fe568273d96..de10ee8c7cc8 100644 --- a/internal/services/network/network_security_rule_resource.go +++ b/internal/services/network/network_security_rule_resource.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceNetworkSecurityRule() *pluginsdk.Resource { diff --git a/internal/services/network/network_subresource.go b/internal/services/network/network_subresource.go index d58bf9675a3e..14ab7d7936f3 100644 --- a/internal/services/network/network_subresource.go +++ b/internal/services/network/network_subresource.go @@ -1,7 +1,7 @@ package network import ( - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func flattenNetworkSubResourceID(input *[]network.SubResource) []interface{} { diff --git a/internal/services/network/network_watcher_flow_log_resource.go b/internal/services/network/network_watcher_flow_log_resource.go index ffec836edf5f..1952dfb640c9 100644 --- a/internal/services/network/network_watcher_flow_log_resource.go +++ b/internal/services/network/network_watcher_flow_log_resource.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceNetworkWatcherFlowLog() *pluginsdk.Resource { diff --git a/internal/services/network/network_watcher_resource.go b/internal/services/network/network_watcher_resource.go index 86af3dabd00b..40bf9a76c015 100644 --- a/internal/services/network/network_watcher_resource.go +++ b/internal/services/network/network_watcher_resource.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceNetworkWatcher() *pluginsdk.Resource { diff --git a/internal/services/network/parse/ip_group_cidr.go b/internal/services/network/parse/ip_group_cidr.go new file mode 100644 index 000000000000..d9e2e5d4033d --- /dev/null +++ b/internal/services/network/parse/ip_group_cidr.go @@ -0,0 +1,75 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type IpGroupCidrId struct { + SubscriptionId string + ResourceGroup string + IpGroupName string + CidrName string +} + +func NewIpGroupCidrID(subscriptionId, resourceGroup, ipGroupName, cidrName string) IpGroupCidrId { + return IpGroupCidrId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + IpGroupName: ipGroupName, + CidrName: cidrName, + } +} + +func (id IpGroupCidrId) String() string { + segments := []string{ + fmt.Sprintf("Cidr Name %q", id.CidrName), + fmt.Sprintf("Ip Group Name %q", id.IpGroupName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Ip Group Cidr", segmentsStr) +} + +func (id IpGroupCidrId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/ipGroups/%s/cidrs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.IpGroupName, id.CidrName) +} + +// IpGroupCidrID parses a IpGroupCidr ID into an IpGroupCidrId struct +func IpGroupCidrID(input string) (*IpGroupCidrId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := IpGroupCidrId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.IpGroupName, err = id.PopSegment("ipGroups"); err != nil { + return nil, err + } + if resourceId.CidrName, err = id.PopSegment("cidrs"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/internal/services/network/parse/ip_group_cidr_test.go b/internal/services/network/parse/ip_group_cidr_test.go new file mode 100644 index 000000000000..55237a56640f --- /dev/null +++ b/internal/services/network/parse/ip_group_cidr_test.go @@ -0,0 +1,128 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.Id = IpGroupCidrId{} + +func TestIpGroupCidrIDFormatter(t *testing.T) { + actual := NewIpGroupCidrID("4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3", "rg-core-hub-networking-ip-groups", "my-ips", "127.0.0.1_32").ID() + expected := "/subscriptions/4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3/resourceGroups/rg-core-hub-networking-ip-groups/providers/Microsoft.Network/ipGroups/my-ips/cidrs/127.0.0.1_32" + if actual != expected { + t.Fatalf("Expected %q but got %q", expected, actual) + } +} + +func TestIpGroupCidrID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *IpGroupCidrId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3/resourceGroups/", + Error: true, + }, + + { + // missing IpGroupName + Input: "/subscriptions/4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3/resourceGroups/rg-core-hub-networking-ip-groups/providers/Microsoft.Network/", + Error: true, + }, + + { + // missing value for IpGroupName + Input: "/subscriptions/4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3/resourceGroups/rg-core-hub-networking-ip-groups/providers/Microsoft.Network/ipGroups/", + Error: true, + }, + + { + // missing CidrName + Input: "/subscriptions/4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3/resourceGroups/rg-core-hub-networking-ip-groups/providers/Microsoft.Network/ipGroups/my-ips/", + Error: true, + }, + + { + // missing value for CidrName + Input: "/subscriptions/4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3/resourceGroups/rg-core-hub-networking-ip-groups/providers/Microsoft.Network/ipGroups/my-ips/cidrs/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3/resourceGroups/rg-core-hub-networking-ip-groups/providers/Microsoft.Network/ipGroups/my-ips/cidrs/127.0.0.1_32", + Expected: &IpGroupCidrId{ + SubscriptionId: "4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3", + ResourceGroup: "rg-core-hub-networking-ip-groups", + IpGroupName: "my-ips", + CidrName: "127.0.0.1_32", + }, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/4FE7B06F-0EB5-489A-B053-F2AFBDD8A4F3/RESOURCEGROUPS/RG-CORE-HUB-NETWORKING-IP-GROUPS/PROVIDERS/MICROSOFT.NETWORK/IPGROUPS/MY-IPS/CIDRS/127.0.0.1_32", + Error: true, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := IpGroupCidrID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.IpGroupName != v.Expected.IpGroupName { + t.Fatalf("Expected %q but got %q for IpGroupName", v.Expected.IpGroupName, actual.IpGroupName) + } + if actual.CidrName != v.Expected.CidrName { + t.Fatalf("Expected %q but got %q for CidrName", v.Expected.CidrName, actual.CidrName) + } + } +} diff --git a/internal/services/network/parse/network_manager_admin_rule.go b/internal/services/network/parse/network_manager_admin_rule.go new file mode 100644 index 000000000000..f2ecb27c4ee1 --- /dev/null +++ b/internal/services/network/parse/network_manager_admin_rule.go @@ -0,0 +1,87 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type NetworkManagerAdminRuleId struct { + SubscriptionId string + ResourceGroup string + NetworkManagerName string + SecurityAdminConfigurationName string + RuleCollectionName string + RuleName string +} + +func NewNetworkManagerAdminRuleID(subscriptionId, resourceGroup, networkManagerName, securityAdminConfigurationName, ruleCollectionName, ruleName string) NetworkManagerAdminRuleId { + return NetworkManagerAdminRuleId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + NetworkManagerName: networkManagerName, + SecurityAdminConfigurationName: securityAdminConfigurationName, + RuleCollectionName: ruleCollectionName, + RuleName: ruleName, + } +} + +func (id NetworkManagerAdminRuleId) String() string { + segments := []string{ + fmt.Sprintf("Rule Name %q", id.RuleName), + fmt.Sprintf("Rule Collection Name %q", id.RuleCollectionName), + fmt.Sprintf("Security Admin Configuration Name %q", id.SecurityAdminConfigurationName), + fmt.Sprintf("Network Manager Name %q", id.NetworkManagerName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Network Manager Admin Rule", segmentsStr) +} + +func (id NetworkManagerAdminRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/networkManagers/%s/securityAdminConfigurations/%s/ruleCollections/%s/rules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName, id.RuleName) +} + +// NetworkManagerAdminRuleID parses a NetworkManagerAdminRule ID into an NetworkManagerAdminRuleId struct +func NetworkManagerAdminRuleID(input string) (*NetworkManagerAdminRuleId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := NetworkManagerAdminRuleId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.NetworkManagerName, err = id.PopSegment("networkManagers"); err != nil { + return nil, err + } + if resourceId.SecurityAdminConfigurationName, err = id.PopSegment("securityAdminConfigurations"); err != nil { + return nil, err + } + if resourceId.RuleCollectionName, err = id.PopSegment("ruleCollections"); err != nil { + return nil, err + } + if resourceId.RuleName, err = id.PopSegment("rules"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/internal/services/network/parse/network_manager_admin_rule_collection.go b/internal/services/network/parse/network_manager_admin_rule_collection.go new file mode 100644 index 000000000000..a4836b176340 --- /dev/null +++ b/internal/services/network/parse/network_manager_admin_rule_collection.go @@ -0,0 +1,81 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type NetworkManagerAdminRuleCollectionId struct { + SubscriptionId string + ResourceGroup string + NetworkManagerName string + SecurityAdminConfigurationName string + RuleCollectionName string +} + +func NewNetworkManagerAdminRuleCollectionID(subscriptionId, resourceGroup, networkManagerName, securityAdminConfigurationName, ruleCollectionName string) NetworkManagerAdminRuleCollectionId { + return NetworkManagerAdminRuleCollectionId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + NetworkManagerName: networkManagerName, + SecurityAdminConfigurationName: securityAdminConfigurationName, + RuleCollectionName: ruleCollectionName, + } +} + +func (id NetworkManagerAdminRuleCollectionId) String() string { + segments := []string{ + fmt.Sprintf("Rule Collection Name %q", id.RuleCollectionName), + fmt.Sprintf("Security Admin Configuration Name %q", id.SecurityAdminConfigurationName), + fmt.Sprintf("Network Manager Name %q", id.NetworkManagerName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Network Manager Admin Rule Collection", segmentsStr) +} + +func (id NetworkManagerAdminRuleCollectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/networkManagers/%s/securityAdminConfigurations/%s/ruleCollections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName) +} + +// NetworkManagerAdminRuleCollectionID parses a NetworkManagerAdminRuleCollection ID into an NetworkManagerAdminRuleCollectionId struct +func NetworkManagerAdminRuleCollectionID(input string) (*NetworkManagerAdminRuleCollectionId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := NetworkManagerAdminRuleCollectionId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.NetworkManagerName, err = id.PopSegment("networkManagers"); err != nil { + return nil, err + } + if resourceId.SecurityAdminConfigurationName, err = id.PopSegment("securityAdminConfigurations"); err != nil { + return nil, err + } + if resourceId.RuleCollectionName, err = id.PopSegment("ruleCollections"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/internal/services/network/parse/network_manager_admin_rule_collection_test.go b/internal/services/network/parse/network_manager_admin_rule_collection_test.go new file mode 100644 index 000000000000..6760d30afb7d --- /dev/null +++ b/internal/services/network/parse/network_manager_admin_rule_collection_test.go @@ -0,0 +1,144 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.Id = NetworkManagerAdminRuleCollectionId{} + +func TestNetworkManagerAdminRuleCollectionIDFormatter(t *testing.T) { + actual := NewNetworkManagerAdminRuleCollectionID("12345678-1234-9876-4563-123456789012", "resGroup1", "manager1", "conf1", "collection1").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/collection1" + if actual != expected { + t.Fatalf("Expected %q but got %q", expected, actual) + } +} + +func TestNetworkManagerAdminRuleCollectionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *NetworkManagerAdminRuleCollectionId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", + Error: true, + }, + + { + // missing value for NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/", + Error: true, + }, + + { + // missing SecurityAdminConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/", + Error: true, + }, + + { + // missing value for SecurityAdminConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/", + Error: true, + }, + + { + // missing RuleCollectionName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/", + Error: true, + }, + + { + // missing value for RuleCollectionName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/collection1", + Expected: &NetworkManagerAdminRuleCollectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + NetworkManagerName: "manager1", + SecurityAdminConfigurationName: "conf1", + RuleCollectionName: "collection1", + }, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/NETWORKMANAGERS/MANAGER1/SECURITYADMINCONFIGURATIONS/CONF1/RULECOLLECTIONS/COLLECTION1", + Error: true, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := NetworkManagerAdminRuleCollectionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.NetworkManagerName != v.Expected.NetworkManagerName { + t.Fatalf("Expected %q but got %q for NetworkManagerName", v.Expected.NetworkManagerName, actual.NetworkManagerName) + } + if actual.SecurityAdminConfigurationName != v.Expected.SecurityAdminConfigurationName { + t.Fatalf("Expected %q but got %q for SecurityAdminConfigurationName", v.Expected.SecurityAdminConfigurationName, actual.SecurityAdminConfigurationName) + } + if actual.RuleCollectionName != v.Expected.RuleCollectionName { + t.Fatalf("Expected %q but got %q for RuleCollectionName", v.Expected.RuleCollectionName, actual.RuleCollectionName) + } + } +} diff --git a/internal/services/network/parse/network_manager_admin_rule_test.go b/internal/services/network/parse/network_manager_admin_rule_test.go new file mode 100644 index 000000000000..0c52797d4fc0 --- /dev/null +++ b/internal/services/network/parse/network_manager_admin_rule_test.go @@ -0,0 +1,160 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.Id = NetworkManagerAdminRuleId{} + +func TestNetworkManagerAdminRuleIDFormatter(t *testing.T) { + actual := NewNetworkManagerAdminRuleID("12345678-1234-9876-4563-123456789012", "resGroup1", "manager1", "conf1", "collection1", "rule1").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/collection1/rules/rule1" + if actual != expected { + t.Fatalf("Expected %q but got %q", expected, actual) + } +} + +func TestNetworkManagerAdminRuleID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *NetworkManagerAdminRuleId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", + Error: true, + }, + + { + // missing value for NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/", + Error: true, + }, + + { + // missing SecurityAdminConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/", + Error: true, + }, + + { + // missing value for SecurityAdminConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/", + Error: true, + }, + + { + // missing RuleCollectionName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/", + Error: true, + }, + + { + // missing value for RuleCollectionName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/", + Error: true, + }, + + { + // missing RuleName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/collection1/", + Error: true, + }, + + { + // missing value for RuleName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/collection1/rules/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/collection1/rules/rule1", + Expected: &NetworkManagerAdminRuleId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + NetworkManagerName: "manager1", + SecurityAdminConfigurationName: "conf1", + RuleCollectionName: "collection1", + RuleName: "rule1", + }, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/NETWORKMANAGERS/MANAGER1/SECURITYADMINCONFIGURATIONS/CONF1/RULECOLLECTIONS/COLLECTION1/RULES/RULE1", + Error: true, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := NetworkManagerAdminRuleID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.NetworkManagerName != v.Expected.NetworkManagerName { + t.Fatalf("Expected %q but got %q for NetworkManagerName", v.Expected.NetworkManagerName, actual.NetworkManagerName) + } + if actual.SecurityAdminConfigurationName != v.Expected.SecurityAdminConfigurationName { + t.Fatalf("Expected %q but got %q for SecurityAdminConfigurationName", v.Expected.SecurityAdminConfigurationName, actual.SecurityAdminConfigurationName) + } + if actual.RuleCollectionName != v.Expected.RuleCollectionName { + t.Fatalf("Expected %q but got %q for RuleCollectionName", v.Expected.RuleCollectionName, actual.RuleCollectionName) + } + if actual.RuleName != v.Expected.RuleName { + t.Fatalf("Expected %q but got %q for RuleName", v.Expected.RuleName, actual.RuleName) + } + } +} diff --git a/internal/services/network/parse/network_manager_connectivity_configuration.go b/internal/services/network/parse/network_manager_connectivity_configuration.go new file mode 100644 index 000000000000..301bfb3026ff --- /dev/null +++ b/internal/services/network/parse/network_manager_connectivity_configuration.go @@ -0,0 +1,75 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type NetworkManagerConnectivityConfigurationId struct { + SubscriptionId string + ResourceGroup string + NetworkManagerName string + ConnectivityConfigurationName string +} + +func NewNetworkManagerConnectivityConfigurationID(subscriptionId, resourceGroup, networkManagerName, connectivityConfigurationName string) NetworkManagerConnectivityConfigurationId { + return NetworkManagerConnectivityConfigurationId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + NetworkManagerName: networkManagerName, + ConnectivityConfigurationName: connectivityConfigurationName, + } +} + +func (id NetworkManagerConnectivityConfigurationId) String() string { + segments := []string{ + fmt.Sprintf("Connectivity Configuration Name %q", id.ConnectivityConfigurationName), + fmt.Sprintf("Network Manager Name %q", id.NetworkManagerName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Network Manager Connectivity Configuration", segmentsStr) +} + +func (id NetworkManagerConnectivityConfigurationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/networkManagers/%s/connectivityConfigurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetworkManagerName, id.ConnectivityConfigurationName) +} + +// NetworkManagerConnectivityConfigurationID parses a NetworkManagerConnectivityConfiguration ID into an NetworkManagerConnectivityConfigurationId struct +func NetworkManagerConnectivityConfigurationID(input string) (*NetworkManagerConnectivityConfigurationId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := NetworkManagerConnectivityConfigurationId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.NetworkManagerName, err = id.PopSegment("networkManagers"); err != nil { + return nil, err + } + if resourceId.ConnectivityConfigurationName, err = id.PopSegment("connectivityConfigurations"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/internal/services/network/parse/network_manager_connectivity_configuration_test.go b/internal/services/network/parse/network_manager_connectivity_configuration_test.go new file mode 100644 index 000000000000..56a7b1215e15 --- /dev/null +++ b/internal/services/network/parse/network_manager_connectivity_configuration_test.go @@ -0,0 +1,128 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.Id = NetworkManagerConnectivityConfigurationId{} + +func TestNetworkManagerConnectivityConfigurationIDFormatter(t *testing.T) { + actual := NewNetworkManagerConnectivityConfigurationID("12345678-1234-9876-4563-123456789012", "resGroup1", "manager1", "conf1").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/connectivityConfigurations/conf1" + if actual != expected { + t.Fatalf("Expected %q but got %q", expected, actual) + } +} + +func TestNetworkManagerConnectivityConfigurationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *NetworkManagerConnectivityConfigurationId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", + Error: true, + }, + + { + // missing value for NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/", + Error: true, + }, + + { + // missing ConnectivityConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/", + Error: true, + }, + + { + // missing value for ConnectivityConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/connectivityConfigurations/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/connectivityConfigurations/conf1", + Expected: &NetworkManagerConnectivityConfigurationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + NetworkManagerName: "manager1", + ConnectivityConfigurationName: "conf1", + }, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/NETWORKMANAGERS/MANAGER1/CONNECTIVITYCONFIGURATIONS/CONF1", + Error: true, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := NetworkManagerConnectivityConfigurationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.NetworkManagerName != v.Expected.NetworkManagerName { + t.Fatalf("Expected %q but got %q for NetworkManagerName", v.Expected.NetworkManagerName, actual.NetworkManagerName) + } + if actual.ConnectivityConfigurationName != v.Expected.ConnectivityConfigurationName { + t.Fatalf("Expected %q but got %q for ConnectivityConfigurationName", v.Expected.ConnectivityConfigurationName, actual.ConnectivityConfigurationName) + } + } +} diff --git a/internal/services/network/parse/network_manager_scope_connection.go b/internal/services/network/parse/network_manager_scope_connection.go new file mode 100644 index 000000000000..faacf86ab204 --- /dev/null +++ b/internal/services/network/parse/network_manager_scope_connection.go @@ -0,0 +1,75 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type NetworkManagerScopeConnectionId struct { + SubscriptionId string + ResourceGroup string + NetworkManagerName string + ScopeConnectionName string +} + +func NewNetworkManagerScopeConnectionID(subscriptionId, resourceGroup, networkManagerName, scopeConnectionName string) NetworkManagerScopeConnectionId { + return NetworkManagerScopeConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + NetworkManagerName: networkManagerName, + ScopeConnectionName: scopeConnectionName, + } +} + +func (id NetworkManagerScopeConnectionId) String() string { + segments := []string{ + fmt.Sprintf("Scope Connection Name %q", id.ScopeConnectionName), + fmt.Sprintf("Network Manager Name %q", id.NetworkManagerName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Network Manager Scope Connection", segmentsStr) +} + +func (id NetworkManagerScopeConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/networkManagers/%s/scopeConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetworkManagerName, id.ScopeConnectionName) +} + +// NetworkManagerScopeConnectionID parses a NetworkManagerScopeConnection ID into an NetworkManagerScopeConnectionId struct +func NetworkManagerScopeConnectionID(input string) (*NetworkManagerScopeConnectionId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := NetworkManagerScopeConnectionId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.NetworkManagerName, err = id.PopSegment("networkManagers"); err != nil { + return nil, err + } + if resourceId.ScopeConnectionName, err = id.PopSegment("scopeConnections"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/internal/services/network/parse/network_manager_scope_connection_test.go b/internal/services/network/parse/network_manager_scope_connection_test.go new file mode 100644 index 000000000000..f6bc7915ef43 --- /dev/null +++ b/internal/services/network/parse/network_manager_scope_connection_test.go @@ -0,0 +1,128 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.Id = NetworkManagerScopeConnectionId{} + +func TestNetworkManagerScopeConnectionIDFormatter(t *testing.T) { + actual := NewNetworkManagerScopeConnectionID("12345678-1234-9876-4563-123456789012", "resGroup1", "manager1", "connection1").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/scopeConnections/connection1" + if actual != expected { + t.Fatalf("Expected %q but got %q", expected, actual) + } +} + +func TestNetworkManagerScopeConnectionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *NetworkManagerScopeConnectionId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", + Error: true, + }, + + { + // missing value for NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/", + Error: true, + }, + + { + // missing ScopeConnectionName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/", + Error: true, + }, + + { + // missing value for ScopeConnectionName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/scopeConnections/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/scopeConnections/connection1", + Expected: &NetworkManagerScopeConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + NetworkManagerName: "manager1", + ScopeConnectionName: "connection1", + }, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/NETWORKMANAGERS/MANAGER1/SCOPECONNECTIONS/CONNECTION1", + Error: true, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := NetworkManagerScopeConnectionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.NetworkManagerName != v.Expected.NetworkManagerName { + t.Fatalf("Expected %q but got %q for NetworkManagerName", v.Expected.NetworkManagerName, actual.NetworkManagerName) + } + if actual.ScopeConnectionName != v.Expected.ScopeConnectionName { + t.Fatalf("Expected %q but got %q for ScopeConnectionName", v.Expected.ScopeConnectionName, actual.ScopeConnectionName) + } + } +} diff --git a/internal/services/network/parse/network_manager_security_admin_configuration.go b/internal/services/network/parse/network_manager_security_admin_configuration.go new file mode 100644 index 000000000000..1266f3768e29 --- /dev/null +++ b/internal/services/network/parse/network_manager_security_admin_configuration.go @@ -0,0 +1,75 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type NetworkManagerSecurityAdminConfigurationId struct { + SubscriptionId string + ResourceGroup string + NetworkManagerName string + SecurityAdminConfigurationName string +} + +func NewNetworkManagerSecurityAdminConfigurationID(subscriptionId, resourceGroup, networkManagerName, securityAdminConfigurationName string) NetworkManagerSecurityAdminConfigurationId { + return NetworkManagerSecurityAdminConfigurationId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + NetworkManagerName: networkManagerName, + SecurityAdminConfigurationName: securityAdminConfigurationName, + } +} + +func (id NetworkManagerSecurityAdminConfigurationId) String() string { + segments := []string{ + fmt.Sprintf("Security Admin Configuration Name %q", id.SecurityAdminConfigurationName), + fmt.Sprintf("Network Manager Name %q", id.NetworkManagerName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Network Manager Security Admin Configuration", segmentsStr) +} + +func (id NetworkManagerSecurityAdminConfigurationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/networkManagers/%s/securityAdminConfigurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetworkManagerName, id.SecurityAdminConfigurationName) +} + +// NetworkManagerSecurityAdminConfigurationID parses a NetworkManagerSecurityAdminConfiguration ID into an NetworkManagerSecurityAdminConfigurationId struct +func NetworkManagerSecurityAdminConfigurationID(input string) (*NetworkManagerSecurityAdminConfigurationId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := NetworkManagerSecurityAdminConfigurationId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.NetworkManagerName, err = id.PopSegment("networkManagers"); err != nil { + return nil, err + } + if resourceId.SecurityAdminConfigurationName, err = id.PopSegment("securityAdminConfigurations"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/internal/services/network/parse/network_manager_security_admin_configuration_test.go b/internal/services/network/parse/network_manager_security_admin_configuration_test.go new file mode 100644 index 000000000000..f4185dbeb511 --- /dev/null +++ b/internal/services/network/parse/network_manager_security_admin_configuration_test.go @@ -0,0 +1,128 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.Id = NetworkManagerSecurityAdminConfigurationId{} + +func TestNetworkManagerSecurityAdminConfigurationIDFormatter(t *testing.T) { + actual := NewNetworkManagerSecurityAdminConfigurationID("12345678-1234-9876-4563-123456789012", "resGroup1", "manager1", "conf1").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1" + if actual != expected { + t.Fatalf("Expected %q but got %q", expected, actual) + } +} + +func TestNetworkManagerSecurityAdminConfigurationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *NetworkManagerSecurityAdminConfigurationId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", + Error: true, + }, + + { + // missing value for NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/", + Error: true, + }, + + { + // missing SecurityAdminConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/", + Error: true, + }, + + { + // missing value for SecurityAdminConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1", + Expected: &NetworkManagerSecurityAdminConfigurationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + NetworkManagerName: "manager1", + SecurityAdminConfigurationName: "conf1", + }, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/NETWORKMANAGERS/MANAGER1/SECURITYADMINCONFIGURATIONS/CONF1", + Error: true, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := NetworkManagerSecurityAdminConfigurationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.NetworkManagerName != v.Expected.NetworkManagerName { + t.Fatalf("Expected %q but got %q for NetworkManagerName", v.Expected.NetworkManagerName, actual.NetworkManagerName) + } + if actual.SecurityAdminConfigurationName != v.Expected.SecurityAdminConfigurationName { + t.Fatalf("Expected %q but got %q for SecurityAdminConfigurationName", v.Expected.SecurityAdminConfigurationName, actual.SecurityAdminConfigurationName) + } + } +} diff --git a/internal/services/network/parse/network_manager_static_member.go b/internal/services/network/parse/network_manager_static_member.go new file mode 100644 index 000000000000..71ba884ceecd --- /dev/null +++ b/internal/services/network/parse/network_manager_static_member.go @@ -0,0 +1,81 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type NetworkManagerStaticMemberId struct { + SubscriptionId string + ResourceGroup string + NetworkManagerName string + NetworkGroupName string + StaticMemberName string +} + +func NewNetworkManagerStaticMemberID(subscriptionId, resourceGroup, networkManagerName, networkGroupName, staticMemberName string) NetworkManagerStaticMemberId { + return NetworkManagerStaticMemberId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + NetworkManagerName: networkManagerName, + NetworkGroupName: networkGroupName, + StaticMemberName: staticMemberName, + } +} + +func (id NetworkManagerStaticMemberId) String() string { + segments := []string{ + fmt.Sprintf("Static Member Name %q", id.StaticMemberName), + fmt.Sprintf("Network Group Name %q", id.NetworkGroupName), + fmt.Sprintf("Network Manager Name %q", id.NetworkManagerName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Network Manager Static Member", segmentsStr) +} + +func (id NetworkManagerStaticMemberId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/networkManagers/%s/networkGroups/%s/staticMembers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetworkManagerName, id.NetworkGroupName, id.StaticMemberName) +} + +// NetworkManagerStaticMemberID parses a NetworkManagerStaticMember ID into an NetworkManagerStaticMemberId struct +func NetworkManagerStaticMemberID(input string) (*NetworkManagerStaticMemberId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := NetworkManagerStaticMemberId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.NetworkManagerName, err = id.PopSegment("networkManagers"); err != nil { + return nil, err + } + if resourceId.NetworkGroupName, err = id.PopSegment("networkGroups"); err != nil { + return nil, err + } + if resourceId.StaticMemberName, err = id.PopSegment("staticMembers"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/internal/services/network/parse/network_manager_static_member_test.go b/internal/services/network/parse/network_manager_static_member_test.go new file mode 100644 index 000000000000..df4a005101e0 --- /dev/null +++ b/internal/services/network/parse/network_manager_static_member_test.go @@ -0,0 +1,144 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.Id = NetworkManagerStaticMemberId{} + +func TestNetworkManagerStaticMemberIDFormatter(t *testing.T) { + actual := NewNetworkManagerStaticMemberID("12345678-1234-9876-4563-123456789012", "resGroup1", "manager1", "group1", "member1").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/networkGroups/group1/staticMembers/member1" + if actual != expected { + t.Fatalf("Expected %q but got %q", expected, actual) + } +} + +func TestNetworkManagerStaticMemberID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *NetworkManagerStaticMemberId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", + Error: true, + }, + + { + // missing value for NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/", + Error: true, + }, + + { + // missing NetworkGroupName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/", + Error: true, + }, + + { + // missing value for NetworkGroupName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/networkGroups/", + Error: true, + }, + + { + // missing StaticMemberName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/networkGroups/group1/", + Error: true, + }, + + { + // missing value for StaticMemberName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/networkGroups/group1/staticMembers/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/networkGroups/group1/staticMembers/member1", + Expected: &NetworkManagerStaticMemberId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + NetworkManagerName: "manager1", + NetworkGroupName: "group1", + StaticMemberName: "member1", + }, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/NETWORKMANAGERS/MANAGER1/NETWORKGROUPS/GROUP1/STATICMEMBERS/MEMBER1", + Error: true, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := NetworkManagerStaticMemberID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.NetworkManagerName != v.Expected.NetworkManagerName { + t.Fatalf("Expected %q but got %q for NetworkManagerName", v.Expected.NetworkManagerName, actual.NetworkManagerName) + } + if actual.NetworkGroupName != v.Expected.NetworkGroupName { + t.Fatalf("Expected %q but got %q for NetworkGroupName", v.Expected.NetworkGroupName, actual.NetworkGroupName) + } + if actual.StaticMemberName != v.Expected.StaticMemberName { + t.Fatalf("Expected %q but got %q for StaticMemberName", v.Expected.StaticMemberName, actual.StaticMemberName) + } + } +} diff --git a/internal/services/network/point_to_site_vpn_gateway_resource.go b/internal/services/network/point_to_site_vpn_gateway_resource.go index 9db601f0c697..8f5bec7f76bb 100644 --- a/internal/services/network/point_to_site_vpn_gateway_resource.go +++ b/internal/services/network/point_to_site_vpn_gateway_resource.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourcePointToSiteVPNGateway() *pluginsdk.Resource { diff --git a/internal/services/network/private_endpoint_application_security_group_association.go b/internal/services/network/private_endpoint_application_security_group_association.go index 20390d908a14..719ff19ce958 100644 --- a/internal/services/network/private_endpoint_application_security_group_association.go +++ b/internal/services/network/private_endpoint_application_security_group_association.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type PrivateEndpointApplicationSecurityGroupAssociationResource struct { diff --git a/internal/services/network/private_endpoint_application_security_group_association_test.go b/internal/services/network/private_endpoint_application_security_group_association_test.go index 9637b7a14fd9..50d4c9b66d0d 100644 --- a/internal/services/network/private_endpoint_application_security_group_association_test.go +++ b/internal/services/network/private_endpoint_application_security_group_association_test.go @@ -6,14 +6,13 @@ import ( "strings" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type PrivateEndpointApplicationSecurityGroupAssociationResource struct { @@ -239,7 +238,7 @@ resource "azurerm_private_endpoint_application_security_group_association" "impo `, r.basic(data)) } -func (r PrivateEndpointApplicationSecurityGroupAssociationResource) destroy(ctx context.Context, client *clients.Client, state *terraform.InstanceState) error { +func (r PrivateEndpointApplicationSecurityGroupAssociationResource) destroy(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) error { endpointId, err := parse.PrivateEndpointID(state.Attributes["private_endpoint_id"]) if err != nil { return err diff --git a/internal/services/network/private_endpoint_connection_data_source.go b/internal/services/network/private_endpoint_connection_data_source.go index af57ad0f7eb3..0f13c3537439 100644 --- a/internal/services/network/private_endpoint_connection_data_source.go +++ b/internal/services/network/private_endpoint_connection_data_source.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourcePrivateEndpointConnection() *pluginsdk.Resource { diff --git a/internal/services/network/private_endpoint_resource.go b/internal/services/network/private_endpoint_resource.go index 71bedeadd101..d25b08695c4f 100644 --- a/internal/services/network/private_endpoint_resource.go +++ b/internal/services/network/private_endpoint_resource.go @@ -11,11 +11,11 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - mariaDB "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers" + mariadbServers "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers" + postgresqlServers "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers" "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis" "github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -30,7 +30,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourcePrivateEndpoint() *pluginsdk.Resource { @@ -192,7 +192,7 @@ func resourcePrivateEndpoint() *pluginsdk.Resource { }, "subresource_name": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, ForceNew: true, ValidateFunc: validation.StringIsNotEmpty, }, @@ -349,26 +349,26 @@ func resourcePrivateEndpointCreate(d *pluginsdk.ResourceData, meta interface{}) locks.ByName(subnetId, "azurerm_private_endpoint") defer locks.UnlockByName(subnetId, "azurerm_private_endpoint") - err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *resource.RetryError { + err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, parameters) if err != nil { switch { case strings.EqualFold(err.Error(), "is missing required parameter 'group Id'"): { - return &resource.RetryError{ + return &pluginsdk.RetryError{ Err: fmt.Errorf("creating Private Endpoint %q (Resource Group %q) due to missing 'group Id', ensure that the 'subresource_names' type is populated: %+v", id.Name, id.ResourceGroup, err), Retryable: false, } } case strings.Contains(err.Error(), "PrivateLinkServiceId Invalid private link service id"): { - return &resource.RetryError{ + return &pluginsdk.RetryError{ Err: fmt.Errorf("creating Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err), Retryable: true, } } default: - return &resource.RetryError{ + return &pluginsdk.RetryError{ Err: fmt.Errorf("creating Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err), Retryable: false, } @@ -376,7 +376,7 @@ func resourcePrivateEndpointCreate(d *pluginsdk.ResourceData, meta interface{}) } if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return &resource.RetryError{ + return &pluginsdk.RetryError{ Err: fmt.Errorf("waiting for creation of Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err), Retryable: false, } @@ -494,33 +494,33 @@ func resourcePrivateEndpointUpdate(d *pluginsdk.ResourceData, meta interface{}) locks.ByName(subnetId, "azurerm_private_endpoint") defer locks.UnlockByName(subnetId, "azurerm_private_endpoint") - err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *resource.RetryError { + err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, parameters) if err != nil { switch { case strings.EqualFold(err.Error(), "is missing required parameter 'group Id'"): { - return &resource.RetryError{ + return &pluginsdk.RetryError{ Err: fmt.Errorf("updating Private Endpoint %q (Resource Group %q) due to missing 'group Id', ensure that the 'subresource_names' type is populated: %+v", id.Name, id.ResourceGroup, err), Retryable: false, } } case strings.Contains(err.Error(), "PrivateLinkServiceId Invalid private link service id"): { - return &resource.RetryError{ + return &pluginsdk.RetryError{ Err: fmt.Errorf("creating Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err), Retryable: true, } } default: - return &resource.RetryError{ + return &pluginsdk.RetryError{ Err: fmt.Errorf("updating Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err), } } } if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return &resource.RetryError{ + return &pluginsdk.RetryError{ Err: fmt.Errorf("waiting for update of Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err), Retryable: false, } @@ -857,28 +857,7 @@ func flattenPrivateLinkEndpointServiceConnection(serviceConnections *[]network.P if strings.HasSuffix(privateConnectionId, ".azure.privatelinkservice") { attrs["private_connection_resource_alias"] = privateConnectionId } else { - // There is a bug from service, the PE created from portal could be with the connection id for postgresql server "Microsoft.DBForPostgreSQL" instead of "Microsoft.DBforPostgreSQL" - // and for Mysql and MariaDB - if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.dbforpostgresql") { - if serverId, err := servers.ParseServerID(privateConnectionId); err == nil { - privateConnectionId = serverId.ID() - } - } - if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.dbformysql") { - if serverId, err := mysqlParse.ServerID(privateConnectionId); err == nil { - privateConnectionId = serverId.ID() - } - } - if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.dbformariadb") { - if serverId, err := mariaDB.ParseServerID(privateConnectionId); err == nil { - privateConnectionId = serverId.ID() - } - } - if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.signalrservice") { - if serviceId, err := signalr.ParseSignalRIDInsensitively(privateConnectionId); err == nil { - privateConnectionId = serviceId.ID() - } - } + privateConnectionId = normalizePrivateConnectionId(privateConnectionId) attrs["private_connection_resource_id"] = privateConnectionId } @@ -919,23 +898,7 @@ func flattenPrivateLinkEndpointServiceConnection(serviceConnections *[]network.P if strings.HasSuffix(privateConnectionId, ".azure.privatelinkservice") { attrs["private_connection_resource_alias"] = privateConnectionId } else { - // There is a bug from service, the PE created from portal could be with the connection id for postgresql server "Microsoft.DBForPostgreSQL" instead of "Microsoft.DBforPostgreSQL" - // and for Mysql and MariaDB - if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.dbforpostgresql") { - if serverId, err := servers.ParseServerID(privateConnectionId); err == nil { - privateConnectionId = serverId.ID() - } - } - if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.dbformysql") { - if serverId, err := mysqlParse.ServerID(privateConnectionId); err == nil { - privateConnectionId = serverId.ID() - } - } - if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.dbformariadb") { - if serverId, err := mariaDB.ParseServerID(privateConnectionId); err == nil { - privateConnectionId = serverId.ID() - } - } + privateConnectionId = normalizePrivateConnectionId(privateConnectionId) attrs["private_connection_resource_id"] = privateConnectionId } @@ -964,7 +927,7 @@ func createPrivateDnsZoneGroupForPrivateEndpoint(ctx context.Context, client *ne } privateDnsZoneConfigs = append(privateDnsZoneConfigs, network.PrivateDNSZoneConfig{ - Name: utils.String(privateDnsZone.PrivateZoneName), + Name: utils.String(privateDnsZone.PrivateDnsZoneName), PrivateDNSZonePropertiesFormat: &network.PrivateDNSZonePropertiesFormat{ PrivateDNSZoneID: utils.String(privateDnsZone.ID()), }, @@ -1166,3 +1129,34 @@ func validatePrivateEndpointSettings(d *pluginsdk.ResourceData) error { return nil } + +// normalize the PrivateConnectionId due to the casing change at service side +func normalizePrivateConnectionId(privateConnectionId string) string { + // intentionally including the extra segment to handle Redis vs Redis Enterprise (which is within the same RP) + if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.cache/redis/") { + if cacheId, err := redis.ParseRediIDInsensitively(privateConnectionId); err == nil { + privateConnectionId = cacheId.ID() + } + } + if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.dbforpostgresql") { + if serverId, err := postgresqlServers.ParseServerIDInsensitively(privateConnectionId); err == nil { + privateConnectionId = serverId.ID() + } + } + if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.dbformysql") { + if serverId, err := mysqlParse.ServerIDInsensitively(privateConnectionId); err == nil { + privateConnectionId = serverId.ID() + } + } + if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.dbformariadb") { + if serverId, err := mariadbServers.ParseServerIDInsensitively(privateConnectionId); err == nil { + privateConnectionId = serverId.ID() + } + } + if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.signalrservice") { + if serviceId, err := signalr.ParseSignalRIDInsensitively(privateConnectionId); err == nil { + privateConnectionId = serviceId.ID() + } + } + return privateConnectionId +} diff --git a/internal/services/network/private_endpoint_resource_test.go b/internal/services/network/private_endpoint_resource_test.go index d00d022ea053..bfb41acd04f4 100644 --- a/internal/services/network/private_endpoint_resource_test.go +++ b/internal/services/network/private_endpoint_resource_test.go @@ -204,6 +204,26 @@ func TestAccPrivateEndpoint_privateDnsZoneUpdate(t *testing.T) { }) } +func TestAccPrivateEndpoint_statiIpAddress(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_private_endpoint", "test") + r := PrivateEndpointResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.staticIpAddress(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("subnet_id").Exists(), + check.That(data.ResourceName).Key("network_interface.0.id").Exists(), + check.That(data.ResourceName).Key("network_interface.0.name").Exists(), + check.That(data.ResourceName).Key("private_service_connection.0.private_ip_address").Exists(), + check.That(data.ResourceName).Key("private_service_connection.0.private_ip_address").HasValue("10.5.2.47"), + ), + }, + data.ImportStep(), + }) +} + func TestAccPrivateEndpoint_privateDnsZoneRemove(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_private_endpoint", "test") r := PrivateEndpointResource{} @@ -749,6 +769,30 @@ resource "azurerm_private_endpoint" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger) } +func (r PrivateEndpointResource) staticIpAddress(data acceptance.TestData) string { + return fmt.Sprintf(` +%[1]s + +resource "azurerm_private_endpoint" "test" { + name = "acctest-privatelink-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + subnet_id = azurerm_subnet.endpoint.id + + private_service_connection { + name = azurerm_private_link_service.test.name + is_manual_connection = false + private_connection_resource_id = azurerm_private_link_service.test.id + } + + ip_configuration { + name = "acctest-ip-privatelink-%[2]d" + private_ip_address = "10.5.2.47" + } +} +`, r.template(data, r.serviceAutoApprove(data)), data.RandomInteger) +} + func (PrivateEndpointResource) privateDnsZoneGroupRename(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/network/private_link_service_data_source.go b/internal/services/network/private_link_service_data_source.go index c710c411b135..6fe497bd44ec 100644 --- a/internal/services/network/private_link_service_data_source.go +++ b/internal/services/network/private_link_service_data_source.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourcePrivateLinkService() *pluginsdk.Resource { diff --git a/internal/services/network/private_link_service_endpoint_connections_data_source.go b/internal/services/network/private_link_service_endpoint_connections_data_source.go index c7894e66dbc8..8fdb1370c746 100644 --- a/internal/services/network/private_link_service_endpoint_connections_data_source.go +++ b/internal/services/network/private_link_service_endpoint_connections_data_source.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourcePrivateLinkServiceEndpointConnections() *pluginsdk.Resource { diff --git a/internal/services/network/private_link_service_resource.go b/internal/services/network/private_link_service_resource.go index 6d52c412bb7a..accaa21f3a52 100644 --- a/internal/services/network/private_link_service_resource.go +++ b/internal/services/network/private_link_service_resource.go @@ -18,7 +18,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourcePrivateLinkService() *pluginsdk.Resource { diff --git a/internal/services/network/public_ip_prefix_resource.go b/internal/services/network/public_ip_prefix_resource.go index 134b445a1b4f..8500dbc632fc 100644 --- a/internal/services/network/public_ip_prefix_resource.go +++ b/internal/services/network/public_ip_prefix_resource.go @@ -18,7 +18,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourcePublicIpPrefix() *pluginsdk.Resource { diff --git a/internal/services/network/public_ip_resource.go b/internal/services/network/public_ip_resource.go index 8bbf927af5ce..8f7080090f7f 100644 --- a/internal/services/network/public_ip_resource.go +++ b/internal/services/network/public_ip_resource.go @@ -20,7 +20,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourcePublicIp() *pluginsdk.Resource { diff --git a/internal/services/network/public_ips_data_source.go b/internal/services/network/public_ips_data_source.go index cb15b86b85f5..6a7acbeb4a2f 100644 --- a/internal/services/network/public_ips_data_source.go +++ b/internal/services/network/public_ips_data_source.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourcePublicIPs() *pluginsdk.Resource { diff --git a/internal/services/network/registration.go b/internal/services/network/registration.go index 434d9c45b38a..8e749389dcd7 100644 --- a/internal/services/network/registration.go +++ b/internal/services/network/registration.go @@ -34,9 +34,15 @@ func (r Registration) DataSources() []sdk.DataSource { func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ + ManagerAdminRuleResource{}, + ManagerAdminRuleCollectionResource{}, + ManagerConnectivityConfigurationResource{}, ManagerManagementGroupConnectionResource{}, ManagerNetworkGroupResource{}, ManagerResource{}, + ManagerScopeConnectionResource{}, + ManagerSecurityAdminConfigurationResource{}, + ManagerStaticMemberResource{}, ManagerSubscriptionConnectionResource{}, PrivateEndpointApplicationSecurityGroupAssociationResource{}, RouteMapResource{}, @@ -48,6 +54,7 @@ func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ "azurerm_application_gateway": dataSourceApplicationGateway(), "azurerm_application_security_group": dataSourceApplicationSecurityGroup(), + "azurerm_bastion_host": dataSourceBastionHost(), "azurerm_express_route_circuit": dataSourceExpressRouteCircuit(), "azurerm_ip_group": dataSourceIpGroup(), "azurerm_nat_gateway": dataSourceNatGateway(), @@ -91,6 +98,7 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { "azurerm_express_route_gateway": resourceExpressRouteGateway(), "azurerm_express_route_port": resourceArmExpressRoutePort(), "azurerm_ip_group": resourceIpGroup(), + "azurerm_ip_group_cidr": resourceIpGroupCidr(), "azurerm_local_network_gateway": resourceLocalNetworkGateway(), "azurerm_nat_gateway": resourceNatGateway(), "azurerm_nat_gateway_public_ip_association": resourceNATGatewayPublicIpAssociation(), diff --git a/internal/services/network/resourceids.go b/internal/services/network/resourceids.go index c575a7550f6d..f0ef0dc6b7bf 100644 --- a/internal/services/network/resourceids.go +++ b/internal/services/network/resourceids.go @@ -113,5 +113,11 @@ package network // Network Manager //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NetworkManager -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NetworkManagerAdminRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/collection1/rules/rule1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NetworkManagerAdminRuleCollection -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/collection1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NetworkManagerConnectivityConfiguration -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/connectivityConfigurations/conf1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NetworkManagerNetworkGroup -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/networkGroups/group1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NetworkManagerScopeConnection -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/scopeConnections/connection1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NetworkManagerSecurityAdminConfiguration -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NetworkManagerStaticMember -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/networkGroups/group1/staticMembers/member1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NetworkManagerSubscriptionConnection -id=/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Network/networkManagerConnections/connection1 diff --git a/internal/services/network/route_filter_data_source.go b/internal/services/network/route_filter_data_source.go index 01818ca56d8e..4b2cc39c6e1a 100644 --- a/internal/services/network/route_filter_data_source.go +++ b/internal/services/network/route_filter_data_source.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourceRouteFilter() *pluginsdk.Resource { diff --git a/internal/services/network/route_filter_resource.go b/internal/services/network/route_filter_resource.go index c6f0ba065374..c4f865f02d1e 100644 --- a/internal/services/network/route_filter_resource.go +++ b/internal/services/network/route_filter_resource.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceRouteFilter() *pluginsdk.Resource { diff --git a/internal/services/network/route_map_resource.go b/internal/services/network/route_map_resource.go index 377393ac2451..62c37ebec790 100644 --- a/internal/services/network/route_map_resource.go +++ b/internal/services/network/route_map_resource.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type RouteMapModel struct { diff --git a/internal/services/network/route_resource.go b/internal/services/network/route_resource.go index a59997543efe..a5f4272fd9ad 100644 --- a/internal/services/network/route_resource.go +++ b/internal/services/network/route_resource.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceRoute() *pluginsdk.Resource { diff --git a/internal/services/network/route_server_bgp_connection_resource.go b/internal/services/network/route_server_bgp_connection_resource.go index 49686c7ce85a..5e0da5fac6ca 100644 --- a/internal/services/network/route_server_bgp_connection_resource.go +++ b/internal/services/network/route_server_bgp_connection_resource.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceRouteServerBgpConnection() *pluginsdk.Resource { diff --git a/internal/services/network/route_server_resource.go b/internal/services/network/route_server_resource.go index 9982aebe5d5d..c924e5f90b52 100644 --- a/internal/services/network/route_server_resource.go +++ b/internal/services/network/route_server_resource.go @@ -21,7 +21,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceRouteServer() *pluginsdk.Resource { diff --git a/internal/services/network/route_table_data_source.go b/internal/services/network/route_table_data_source.go index bfed1f954026..524747c4aacc 100644 --- a/internal/services/network/route_table_data_source.go +++ b/internal/services/network/route_table_data_source.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourceRouteTable() *pluginsdk.Resource { diff --git a/internal/services/network/route_table_resource.go b/internal/services/network/route_table_resource.go index dccc2e7df097..325d9356013f 100644 --- a/internal/services/network/route_table_resource.go +++ b/internal/services/network/route_table_resource.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) var routeTableResourceName = "azurerm_route_table" @@ -260,7 +260,7 @@ func flattenRouteTableRoutes(input *[]network.Route) []interface{} { if props := route.RoutePropertiesFormat; props != nil { r["address_prefix"] = *props.AddressPrefix r["next_hop_type"] = string(props.NextHopType) - if ip := props.NextHopIPAddress; ip != nil { + if ip := props.NextHopIPAddress; ip != nil && *ip != "" { r["next_hop_in_ip_address"] = *ip } } diff --git a/internal/services/network/route_table_resource_test.go b/internal/services/network/route_table_resource_test.go index d36466658d2a..0112ba090806 100644 --- a/internal/services/network/route_table_resource_test.go +++ b/internal/services/network/route_table_resource_test.go @@ -32,6 +32,23 @@ func TestAccRouteTable_basic(t *testing.T) { }) } +func TestAccRouteTable_basicNilNextHopIPAddress(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_route_table", "test") + r := RouteTableResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.nilNextHopIPAddess(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("disable_bgp_route_propagation").HasValue("false"), + check.That(data.ResourceName).Key("route.#").HasValue("1"), + ), + }, + data.ImportStep(), + }) +} + func TestAccRouteTable_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_route_table", "test") r := RouteTableResource{} @@ -264,6 +281,32 @@ resource "azurerm_route_table" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } +func (RouteTableResource) nilNextHopIPAddess(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_route_table" "test" { + name = "acctestrt%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + route { + name = "route1" + address_prefix = "101.1.0.0/16" + next_hop_type = "Internet" + next_hop_in_ip_address = null + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +} + func (r RouteTableResource) requiresImport(data acceptance.TestData) string { return fmt.Sprintf(` %s diff --git a/internal/services/network/subnet_nat_gateway_association_resource.go b/internal/services/network/subnet_nat_gateway_association_resource.go index c20809348482..4f6441d313b9 100644 --- a/internal/services/network/subnet_nat_gateway_association_resource.go +++ b/internal/services/network/subnet_nat_gateway_association_resource.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceSubnetNatGatewayAssociation() *pluginsdk.Resource { diff --git a/internal/services/network/subnet_network_security_group_association_resource.go b/internal/services/network/subnet_network_security_group_association_resource.go index 56f08123e3aa..2632b8c4f5e8 100644 --- a/internal/services/network/subnet_network_security_group_association_resource.go +++ b/internal/services/network/subnet_network_security_group_association_resource.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceSubnetNetworkSecurityGroupAssociation() *pluginsdk.Resource { diff --git a/internal/services/network/subnet_resource.go b/internal/services/network/subnet_resource.go index afaae4a7ecc2..aba2477cb034 100644 --- a/internal/services/network/subnet_resource.go +++ b/internal/services/network/subnet_resource.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) var SubnetResourceName = "azurerm_subnet" @@ -58,6 +58,7 @@ var subnetDelegationServiceNames = []string{ "Microsoft.Orbital/orbitalGateways", "NGINX.NGINXPLUS/nginxDeployments", "PaloAltoNetworks.Cloudngfw/firewalls", + "Qumulo.Storage/fileSystems", } func resourceSubnet() *pluginsdk.Resource { diff --git a/internal/services/network/subnet_resource_test.go b/internal/services/network/subnet_resource_test.go index 14e6a773dec1..9a8d64ef64c2 100644 --- a/internal/services/network/subnet_resource_test.go +++ b/internal/services/network/subnet_resource_test.go @@ -538,6 +538,13 @@ func TestAccSubnet_updateServiceDelegation(t *testing.T) { ), }, data.ImportStep(), + { + Config: r.updateServiceDelegation(data, "Qumulo.Storage/fileSystems"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), }) } diff --git a/internal/services/network/subnet_route_table_association_resource.go b/internal/services/network/subnet_route_table_association_resource.go index eed37fc82479..71e29aff3a55 100644 --- a/internal/services/network/subnet_route_table_association_resource.go +++ b/internal/services/network/subnet_route_table_association_resource.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceSubnetRouteTableAssociation() *pluginsdk.Resource { diff --git a/internal/services/network/subnet_service_endpoint_storage_policy_resource.go b/internal/services/network/subnet_service_endpoint_storage_policy_resource.go index c54ac8434d4f..7ad4cdbbf680 100644 --- a/internal/services/network/subnet_service_endpoint_storage_policy_resource.go +++ b/internal/services/network/subnet_service_endpoint_storage_policy_resource.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceSubnetServiceEndpointStoragePolicy() *pluginsdk.Resource { diff --git a/internal/services/network/validate/ip_group_cidr_id.go b/internal/services/network/validate/ip_group_cidr_id.go new file mode 100644 index 000000000000..5a0e8945c04b --- /dev/null +++ b/internal/services/network/validate/ip_group_cidr_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" +) + +func IpGroupCidrID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.IpGroupCidrID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/internal/services/network/validate/ip_group_cidr_id_test.go b/internal/services/network/validate/ip_group_cidr_id_test.go new file mode 100644 index 000000000000..d190ac5fc2aa --- /dev/null +++ b/internal/services/network/validate/ip_group_cidr_id_test.go @@ -0,0 +1,88 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import "testing" + +func TestIpGroupCidrID(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + + { + // empty + Input: "", + Valid: false, + }, + + { + // missing SubscriptionId + Input: "/", + Valid: false, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Valid: false, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3/", + Valid: false, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3/resourceGroups/", + Valid: false, + }, + + { + // missing IpGroupName + Input: "/subscriptions/4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3/resourceGroups/rg-core-hub-networking-ip-groups/providers/Microsoft.Network/", + Valid: false, + }, + + { + // missing value for IpGroupName + Input: "/subscriptions/4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3/resourceGroups/rg-core-hub-networking-ip-groups/providers/Microsoft.Network/ipGroups/", + Valid: false, + }, + + { + // missing CidrName + Input: "/subscriptions/4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3/resourceGroups/rg-core-hub-networking-ip-groups/providers/Microsoft.Network/ipGroups/my-ips/", + Valid: false, + }, + + { + // missing value for CidrName + Input: "/subscriptions/4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3/resourceGroups/rg-core-hub-networking-ip-groups/providers/Microsoft.Network/ipGroups/my-ips/cidrs/", + Valid: false, + }, + + { + // valid + Input: "/subscriptions/4fe7b06f-0eb5-489a-b053-f2afbdd8a4f3/resourceGroups/rg-core-hub-networking-ip-groups/providers/Microsoft.Network/ipGroups/my-ips/cidrs/127.0.0.1_32", + Valid: true, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/4FE7B06F-0EB5-489A-B053-F2AFBDD8A4F3/RESOURCEGROUPS/RG-CORE-HUB-NETWORKING-IP-GROUPS/PROVIDERS/MICROSOFT.NETWORK/IPGROUPS/MY-IPS/CIDRS/127.0.0.1_32", + Valid: false, + }, + } + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := IpGroupCidrID(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} diff --git a/internal/services/network/validate/network_manager_admin_rule_collection_id.go b/internal/services/network/validate/network_manager_admin_rule_collection_id.go new file mode 100644 index 000000000000..1746039b3c1c --- /dev/null +++ b/internal/services/network/validate/network_manager_admin_rule_collection_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" +) + +func NetworkManagerAdminRuleCollectionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.NetworkManagerAdminRuleCollectionID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/internal/services/network/validate/network_manager_admin_rule_collection_id_test.go b/internal/services/network/validate/network_manager_admin_rule_collection_id_test.go new file mode 100644 index 000000000000..4e97570b9539 --- /dev/null +++ b/internal/services/network/validate/network_manager_admin_rule_collection_id_test.go @@ -0,0 +1,100 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import "testing" + +func TestNetworkManagerAdminRuleCollectionID(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + + { + // empty + Input: "", + Valid: false, + }, + + { + // missing SubscriptionId + Input: "/", + Valid: false, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Valid: false, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Valid: false, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Valid: false, + }, + + { + // missing NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", + Valid: false, + }, + + { + // missing value for NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/", + Valid: false, + }, + + { + // missing SecurityAdminConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/", + Valid: false, + }, + + { + // missing value for SecurityAdminConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/", + Valid: false, + }, + + { + // missing RuleCollectionName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/", + Valid: false, + }, + + { + // missing value for RuleCollectionName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/", + Valid: false, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/collection1", + Valid: true, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/NETWORKMANAGERS/MANAGER1/SECURITYADMINCONFIGURATIONS/CONF1/RULECOLLECTIONS/COLLECTION1", + Valid: false, + }, + } + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := NetworkManagerAdminRuleCollectionID(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} diff --git a/internal/services/network/validate/network_manager_admin_rule_id.go b/internal/services/network/validate/network_manager_admin_rule_id.go new file mode 100644 index 000000000000..a799c9c5f16c --- /dev/null +++ b/internal/services/network/validate/network_manager_admin_rule_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" +) + +func NetworkManagerAdminRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.NetworkManagerAdminRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/internal/services/network/validate/network_manager_admin_rule_id_test.go b/internal/services/network/validate/network_manager_admin_rule_id_test.go new file mode 100644 index 000000000000..c9671a6810bd --- /dev/null +++ b/internal/services/network/validate/network_manager_admin_rule_id_test.go @@ -0,0 +1,112 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import "testing" + +func TestNetworkManagerAdminRuleID(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + + { + // empty + Input: "", + Valid: false, + }, + + { + // missing SubscriptionId + Input: "/", + Valid: false, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Valid: false, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Valid: false, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Valid: false, + }, + + { + // missing NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", + Valid: false, + }, + + { + // missing value for NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/", + Valid: false, + }, + + { + // missing SecurityAdminConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/", + Valid: false, + }, + + { + // missing value for SecurityAdminConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/", + Valid: false, + }, + + { + // missing RuleCollectionName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/", + Valid: false, + }, + + { + // missing value for RuleCollectionName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/", + Valid: false, + }, + + { + // missing RuleName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/collection1/", + Valid: false, + }, + + { + // missing value for RuleName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/collection1/rules/", + Valid: false, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1/ruleCollections/collection1/rules/rule1", + Valid: true, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/NETWORKMANAGERS/MANAGER1/SECURITYADMINCONFIGURATIONS/CONF1/RULECOLLECTIONS/COLLECTION1/RULES/RULE1", + Valid: false, + }, + } + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := NetworkManagerAdminRuleID(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} diff --git a/internal/services/network/validate/network_manager_connectivity_configuration_id.go b/internal/services/network/validate/network_manager_connectivity_configuration_id.go new file mode 100644 index 000000000000..643c6b6dfb3d --- /dev/null +++ b/internal/services/network/validate/network_manager_connectivity_configuration_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" +) + +func NetworkManagerConnectivityConfigurationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.NetworkManagerConnectivityConfigurationID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/internal/services/network/validate/network_manager_connectivity_configuration_id_test.go b/internal/services/network/validate/network_manager_connectivity_configuration_id_test.go new file mode 100644 index 000000000000..bdef85e4db4f --- /dev/null +++ b/internal/services/network/validate/network_manager_connectivity_configuration_id_test.go @@ -0,0 +1,88 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import "testing" + +func TestNetworkManagerConnectivityConfigurationID(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + + { + // empty + Input: "", + Valid: false, + }, + + { + // missing SubscriptionId + Input: "/", + Valid: false, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Valid: false, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Valid: false, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Valid: false, + }, + + { + // missing NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", + Valid: false, + }, + + { + // missing value for NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/", + Valid: false, + }, + + { + // missing ConnectivityConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/", + Valid: false, + }, + + { + // missing value for ConnectivityConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/connectivityConfigurations/", + Valid: false, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/connectivityConfigurations/conf1", + Valid: true, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/NETWORKMANAGERS/MANAGER1/CONNECTIVITYCONFIGURATIONS/CONF1", + Valid: false, + }, + } + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := NetworkManagerConnectivityConfigurationID(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} diff --git a/internal/services/network/validate/network_manager_scope_connection_id.go b/internal/services/network/validate/network_manager_scope_connection_id.go new file mode 100644 index 000000000000..de9fcc0e4593 --- /dev/null +++ b/internal/services/network/validate/network_manager_scope_connection_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" +) + +func NetworkManagerScopeConnectionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.NetworkManagerScopeConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/internal/services/network/validate/network_manager_scope_connection_id_test.go b/internal/services/network/validate/network_manager_scope_connection_id_test.go new file mode 100644 index 000000000000..87a97bf0a9f7 --- /dev/null +++ b/internal/services/network/validate/network_manager_scope_connection_id_test.go @@ -0,0 +1,88 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import "testing" + +func TestNetworkManagerScopeConnectionID(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + + { + // empty + Input: "", + Valid: false, + }, + + { + // missing SubscriptionId + Input: "/", + Valid: false, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Valid: false, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Valid: false, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Valid: false, + }, + + { + // missing NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", + Valid: false, + }, + + { + // missing value for NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/", + Valid: false, + }, + + { + // missing ScopeConnectionName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/", + Valid: false, + }, + + { + // missing value for ScopeConnectionName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/scopeConnections/", + Valid: false, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/scopeConnections/connection1", + Valid: true, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/NETWORKMANAGERS/MANAGER1/SCOPECONNECTIONS/CONNECTION1", + Valid: false, + }, + } + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := NetworkManagerScopeConnectionID(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} diff --git a/internal/services/network/validate/network_manager_security_admin_configuration_id.go b/internal/services/network/validate/network_manager_security_admin_configuration_id.go new file mode 100644 index 000000000000..38e333261729 --- /dev/null +++ b/internal/services/network/validate/network_manager_security_admin_configuration_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" +) + +func NetworkManagerSecurityAdminConfigurationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.NetworkManagerSecurityAdminConfigurationID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/internal/services/network/validate/network_manager_security_admin_configuration_id_test.go b/internal/services/network/validate/network_manager_security_admin_configuration_id_test.go new file mode 100644 index 000000000000..fd075b0364a3 --- /dev/null +++ b/internal/services/network/validate/network_manager_security_admin_configuration_id_test.go @@ -0,0 +1,88 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import "testing" + +func TestNetworkManagerSecurityAdminConfigurationID(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + + { + // empty + Input: "", + Valid: false, + }, + + { + // missing SubscriptionId + Input: "/", + Valid: false, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Valid: false, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Valid: false, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Valid: false, + }, + + { + // missing NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", + Valid: false, + }, + + { + // missing value for NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/", + Valid: false, + }, + + { + // missing SecurityAdminConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/", + Valid: false, + }, + + { + // missing value for SecurityAdminConfigurationName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/", + Valid: false, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/securityAdminConfigurations/conf1", + Valid: true, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/NETWORKMANAGERS/MANAGER1/SECURITYADMINCONFIGURATIONS/CONF1", + Valid: false, + }, + } + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := NetworkManagerSecurityAdminConfigurationID(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} diff --git a/internal/services/network/validate/network_manager_static_member_id.go b/internal/services/network/validate/network_manager_static_member_id.go new file mode 100644 index 000000000000..b07e06a4564b --- /dev/null +++ b/internal/services/network/validate/network_manager_static_member_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" +) + +func NetworkManagerStaticMemberID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.NetworkManagerStaticMemberID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/internal/services/network/validate/network_manager_static_member_id_test.go b/internal/services/network/validate/network_manager_static_member_id_test.go new file mode 100644 index 000000000000..386b3d443183 --- /dev/null +++ b/internal/services/network/validate/network_manager_static_member_id_test.go @@ -0,0 +1,100 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import "testing" + +func TestNetworkManagerStaticMemberID(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + + { + // empty + Input: "", + Valid: false, + }, + + { + // missing SubscriptionId + Input: "/", + Valid: false, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Valid: false, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Valid: false, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Valid: false, + }, + + { + // missing NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", + Valid: false, + }, + + { + // missing value for NetworkManagerName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/", + Valid: false, + }, + + { + // missing NetworkGroupName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/", + Valid: false, + }, + + { + // missing value for NetworkGroupName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/networkGroups/", + Valid: false, + }, + + { + // missing StaticMemberName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/networkGroups/group1/", + Valid: false, + }, + + { + // missing value for StaticMemberName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/networkGroups/group1/staticMembers/", + Valid: false, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/networkManagers/manager1/networkGroups/group1/staticMembers/member1", + Valid: true, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/NETWORKMANAGERS/MANAGER1/NETWORKGROUPS/GROUP1/STATICMEMBERS/MEMBER1", + Valid: false, + }, + } + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := NetworkManagerStaticMemberID(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} diff --git a/internal/services/network/validate/web_application_firewall_policy.go b/internal/services/network/validate/web_application_firewall_policy.go index 6606ca2d9623..43551969a8b0 100644 --- a/internal/services/network/validate/web_application_firewall_policy.go +++ b/internal/services/network/validate/web_application_firewall_policy.go @@ -5,6 +5,7 @@ import ( ) var ValidateWebApplicationFirewallPolicyRuleGroupName = validation.StringInSlice([]string{ + "BadBots", "crs_20_protocol_violations", "crs_21_protocol_anomalies", "crs_23_request_limits", @@ -16,6 +17,7 @@ var ValidateWebApplicationFirewallPolicyRuleGroupName = validation.StringInSlice "crs_42_tight_security", "crs_45_trojans", "General", + "GoodBots", "Known-CVEs", "REQUEST-911-METHOD-ENFORCEMENT", "REQUEST-913-SCANNER-DETECTION", @@ -29,6 +31,7 @@ var ValidateWebApplicationFirewallPolicyRuleGroupName = validation.StringInSlice "REQUEST-942-APPLICATION-ATTACK-SQLI", "REQUEST-943-APPLICATION-ATTACK-SESSION-FIXATION", "REQUEST-944-APPLICATION-ATTACK-JAVA", + "UnknownBots", }, false) var ValidateWebApplicationFirewallPolicyRuleSetVersion = validation.StringInSlice([]string{ diff --git a/internal/services/network/virtual_hub_bgp_connection_resource.go b/internal/services/network/virtual_hub_bgp_connection_resource.go index dee1391b2aaf..41e3babfb4a8 100644 --- a/internal/services/network/virtual_hub_bgp_connection_resource.go +++ b/internal/services/network/virtual_hub_bgp_connection_resource.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVirtualHubBgpConnection() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_hub_connection_resource.go b/internal/services/network/virtual_hub_connection_resource.go index 6b842fb856fe..1f1c1a967310 100644 --- a/internal/services/network/virtual_hub_connection_resource.go +++ b/internal/services/network/virtual_hub_connection_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVirtualHubConnection() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_hub_ip_resource.go b/internal/services/network/virtual_hub_ip_resource.go index 7b0ca3316c44..46be8f8a73ac 100644 --- a/internal/services/network/virtual_hub_ip_resource.go +++ b/internal/services/network/virtual_hub_ip_resource.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVirtualHubIP() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_hub_resource.go b/internal/services/network/virtual_hub_resource.go index 024a85d8c340..d232bf8b05b6 100644 --- a/internal/services/network/virtual_hub_resource.go +++ b/internal/services/network/virtual_hub_resource.go @@ -20,7 +20,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) const virtualHubResourceName = "azurerm_virtual_hub" diff --git a/internal/services/network/virtual_hub_route_table_resource.go b/internal/services/network/virtual_hub_route_table_resource.go index d18da827ba72..82765756cdf9 100644 --- a/internal/services/network/virtual_hub_route_table_resource.go +++ b/internal/services/network/virtual_hub_route_table_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVirtualHubRouteTable() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_hub_route_table_route_resource.go b/internal/services/network/virtual_hub_route_table_route_resource.go index e7297ca4fe18..d74216f08769 100644 --- a/internal/services/network/virtual_hub_route_table_route_resource.go +++ b/internal/services/network/virtual_hub_route_table_route_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVirtualHubRouteTableRoute() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_hub_security_partner_provider_resource.go b/internal/services/network/virtual_hub_security_partner_provider_resource.go index 56166be94847..ea051a60bb15 100644 --- a/internal/services/network/virtual_hub_security_partner_provider_resource.go +++ b/internal/services/network/virtual_hub_security_partner_provider_resource.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVirtualHubSecurityPartnerProvider() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_machine_packet_capture_resource.go b/internal/services/network/virtual_machine_packet_capture_resource.go index 22a84ee2a696..489b863efc30 100644 --- a/internal/services/network/virtual_machine_packet_capture_resource.go +++ b/internal/services/network/virtual_machine_packet_capture_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVirtualMachinePacketCapture() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_machine_scale_set_packet_capture_resource.go b/internal/services/network/virtual_machine_scale_set_packet_capture_resource.go index d8ae20f54414..cf15afca757a 100644 --- a/internal/services/network/virtual_machine_scale_set_packet_capture_resource.go +++ b/internal/services/network/virtual_machine_scale_set_packet_capture_resource.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVirtualMachineScaleSetPacketCapture() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_network_data_source.go b/internal/services/network/virtual_network_data_source.go index 2a9d620b8241..f517e805b208 100644 --- a/internal/services/network/virtual_network_data_source.go +++ b/internal/services/network/virtual_network_data_source.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourceVirtualNetwork() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_network_dns_servers_resource.go b/internal/services/network/virtual_network_dns_servers_resource.go index 605c37722b98..a47414a81c87 100644 --- a/internal/services/network/virtual_network_dns_servers_resource.go +++ b/internal/services/network/virtual_network_dns_servers_resource.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVirtualNetworkDnsServers() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_network_gateway_connection_data_source.go b/internal/services/network/virtual_network_gateway_connection_data_source.go index d86d1472edbc..a30b3d8f408e 100644 --- a/internal/services/network/virtual_network_gateway_connection_data_source.go +++ b/internal/services/network/virtual_network_gateway_connection_data_source.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourceVirtualNetworkGatewayConnection() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_network_gateway_connection_data_source_test.go b/internal/services/network/virtual_network_gateway_connection_data_source_test.go index 5a69cdf01084..8b9c61419382 100644 --- a/internal/services/network/virtual_network_gateway_connection_data_source_test.go +++ b/internal/services/network/virtual_network_gateway_connection_data_source_test.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type VirtualNetworkGatewayConnectionDataSource struct{} diff --git a/internal/services/network/virtual_network_gateway_connection_resource.go b/internal/services/network/virtual_network_gateway_connection_resource.go index f7cc885ee7d5..ae6749ae5017 100644 --- a/internal/services/network/virtual_network_gateway_connection_resource.go +++ b/internal/services/network/virtual_network_gateway_connection_resource.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVirtualNetworkGatewayConnection() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_network_gateway_connection_resource_test.go b/internal/services/network/virtual_network_gateway_connection_resource_test.go index 0f7659f03789..46a6dd9f0edb 100644 --- a/internal/services/network/virtual_network_gateway_connection_resource_test.go +++ b/internal/services/network/virtual_network_gateway_connection_resource_test.go @@ -58,7 +58,7 @@ func TestAccVirtualNetworkGatewayConnection_sitetositeWithoutSharedKey(t *testin check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep(), + data.ImportStep("shared_key"), }) } @@ -396,6 +396,9 @@ resource "azurerm_local_network_gateway" "test" { } resource "azurerm_virtual_network_gateway_connection" "test" { + lifecycle { + ignore_changes = ["shared_key"] + } name = "acctest-${var.random}" location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name diff --git a/internal/services/network/virtual_network_gateway_data_source.go b/internal/services/network/virtual_network_gateway_data_source.go index a151fa14ee7e..05945c24dc0e 100644 --- a/internal/services/network/virtual_network_gateway_data_source.go +++ b/internal/services/network/virtual_network_gateway_data_source.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourceVirtualNetworkGateway() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_network_gateway_nat_rule_resource.go b/internal/services/network/virtual_network_gateway_nat_rule_resource.go index 920eca602c3c..086cf321d492 100644 --- a/internal/services/network/virtual_network_gateway_nat_rule_resource.go +++ b/internal/services/network/virtual_network_gateway_nat_rule_resource.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVirtualNetworkGatewayNatRule() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_network_gateway_resource.go b/internal/services/network/virtual_network_gateway_resource.go index d51a7e786e44..95de94b52c90 100644 --- a/internal/services/network/virtual_network_gateway_resource.go +++ b/internal/services/network/virtual_network_gateway_resource.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVirtualNetworkGateway() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_network_peering_resource.go b/internal/services/network/virtual_network_peering_resource.go index 9c05e753dbff..9d0ec0c79aaf 100644 --- a/internal/services/network/virtual_network_peering_resource.go +++ b/internal/services/network/virtual_network_peering_resource.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) // peerMutex is used to prevent multiple Peering resources being created, updated diff --git a/internal/services/network/virtual_network_resource.go b/internal/services/network/virtual_network_resource.go index b7ec3baf1013..568d8c10d4b1 100644 --- a/internal/services/network/virtual_network_resource.go +++ b/internal/services/network/virtual_network_resource.go @@ -21,7 +21,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) var VirtualNetworkResourceName = "azurerm_virtual_network" diff --git a/internal/services/network/virtual_wan_data_source.go b/internal/services/network/virtual_wan_data_source.go index 2d47a2068155..a252cd0bad37 100644 --- a/internal/services/network/virtual_wan_data_source.go +++ b/internal/services/network/virtual_wan_data_source.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourceVirtualWan() *pluginsdk.Resource { diff --git a/internal/services/network/virtual_wan_resource.go b/internal/services/network/virtual_wan_resource.go index ebfc04b68619..fdfe49c46793 100644 --- a/internal/services/network/virtual_wan_resource.go +++ b/internal/services/network/virtual_wan_resource.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVirtualWan() *pluginsdk.Resource { diff --git a/internal/services/network/vpn_gateway_connection_resource.go b/internal/services/network/vpn_gateway_connection_resource.go index e717eb1395a4..f0260860db69 100644 --- a/internal/services/network/vpn_gateway_connection_resource.go +++ b/internal/services/network/vpn_gateway_connection_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVPNGatewayConnection() *pluginsdk.Resource { diff --git a/internal/services/network/vpn_gateway_connection_resource_test.go b/internal/services/network/vpn_gateway_connection_resource_test.go index 57971dfcecd1..58c5d1588bd8 100644 --- a/internal/services/network/vpn_gateway_connection_resource_test.go +++ b/internal/services/network/vpn_gateway_connection_resource_test.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type VPNGatewayConnectionResource struct{} diff --git a/internal/services/network/vpn_gateway_data_source.go b/internal/services/network/vpn_gateway_data_source.go index 0634ad1d179f..cf86b6abb0ea 100644 --- a/internal/services/network/vpn_gateway_data_source.go +++ b/internal/services/network/vpn_gateway_data_source.go @@ -2,7 +2,6 @@ package network import ( "fmt" - "log" "time" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" @@ -13,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func dataSourceVPNGateway() *pluginsdk.Resource { @@ -158,9 +157,7 @@ func dataSourceVPNGatewayRead(d *pluginsdk.ResourceData, meta interface{}) error resp, err := client.Get(ctx, id.ResourceGroup, id.Name) if err != nil { if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] VPN Gateway %q was not found in Resource Group %q - removing from state", id.Name, id.ResourceGroup) - d.SetId("") - return nil + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("Error retrieving VPN Gateway %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) diff --git a/internal/services/network/vpn_gateway_nat_rule_resource.go b/internal/services/network/vpn_gateway_nat_rule_resource.go index 01def6a2332c..b69c1a781ded 100644 --- a/internal/services/network/vpn_gateway_nat_rule_resource.go +++ b/internal/services/network/vpn_gateway_nat_rule_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVPNGatewayNatRule() *pluginsdk.Resource { diff --git a/internal/services/network/vpn_gateway_resource.go b/internal/services/network/vpn_gateway_resource.go index cabe6b3e442b..63f4129bfd82 100644 --- a/internal/services/network/vpn_gateway_resource.go +++ b/internal/services/network/vpn_gateway_resource.go @@ -20,7 +20,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) var VPNGatewayResourceName = "azurerm_vpn_gateway" diff --git a/internal/services/network/vpn_server_configuration_policy_group_resource.go b/internal/services/network/vpn_server_configuration_policy_group_resource.go index e77a51aca62c..1f9d267d594a 100644 --- a/internal/services/network/vpn_server_configuration_policy_group_resource.go +++ b/internal/services/network/vpn_server_configuration_policy_group_resource.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVPNServerConfigurationPolicyGroup() *pluginsdk.Resource { diff --git a/internal/services/network/vpn_server_configuration_policy_group_resource_test.go b/internal/services/network/vpn_server_configuration_policy_group_resource_test.go index 2a915f4dad31..fdc8cbc92b11 100644 --- a/internal/services/network/vpn_server_configuration_policy_group_resource_test.go +++ b/internal/services/network/vpn_server_configuration_policy_group_resource_test.go @@ -5,7 +5,6 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -20,10 +19,10 @@ func TestAccVPNServerConfigurationPolicyGroup_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_vpn_server_configuration_policy_group", "test") r := VPNServerConfigurationPolicyGroupResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -35,10 +34,10 @@ func TestAccVPNServerConfigurationPolicyGroup_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_vpn_server_configuration_policy_group", "test") r := VPNServerConfigurationPolicyGroupResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -50,17 +49,17 @@ func TestAccVPNServerConfigurationPolicyGroup_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_vpn_server_configuration_policy_group", "test") r := VPNServerConfigurationPolicyGroupResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.update(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -72,10 +71,10 @@ func TestAccVPNServerConfigurationPolicyGroup_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_vpn_server_configuration_policy_group", "test") r := VPNServerConfigurationPolicyGroupResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, diff --git a/internal/services/network/vpn_server_configuration_resource.go b/internal/services/network/vpn_server_configuration_resource.go index e3efacc04ef0..06fc997c693a 100644 --- a/internal/services/network/vpn_server_configuration_resource.go +++ b/internal/services/network/vpn_server_configuration_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVPNServerConfiguration() *pluginsdk.Resource { diff --git a/internal/services/network/vpn_site_resource.go b/internal/services/network/vpn_site_resource.go index f375aa0a6803..c4e6e0b2e8d4 100644 --- a/internal/services/network/vpn_site_resource.go +++ b/internal/services/network/vpn_site_resource.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceVpnSite() *pluginsdk.Resource { diff --git a/internal/services/network/web_application_firewall_policy_resource.go b/internal/services/network/web_application_firewall_policy_resource.go index c32fee25ec58..909675fec08d 100644 --- a/internal/services/network/web_application_firewall_policy_resource.go +++ b/internal/services/network/web_application_firewall_policy_resource.go @@ -18,7 +18,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceWebApplicationFirewallPolicy() *pluginsdk.Resource { @@ -438,12 +438,17 @@ func resourceWebApplicationFirewallPolicyCreateUpdate(d *pluginsdk.ResourceData, managedRules := d.Get("managed_rules").([]interface{}) t := d.Get("tags").(map[string]interface{}) + expandedManagedRules, err := expandWebApplicationFirewallPolicyManagedRulesDefinition(managedRules, d) + if err != nil { + return err + } + parameters := network.WebApplicationFirewallPolicy{ Location: utils.String(location), WebApplicationFirewallPolicyPropertiesFormat: &network.WebApplicationFirewallPolicyPropertiesFormat{ CustomRules: expandWebApplicationFirewallPolicyWebApplicationFirewallCustomRule(customRules), PolicySettings: expandWebApplicationFirewallPolicyPolicySettings(policySettings), - ManagedRules: expandWebApplicationFirewallPolicyManagedRulesDefinition(managedRules), + ManagedRules: expandedManagedRules, }, Tags: tags.Expand(t), } @@ -573,19 +578,24 @@ func expandWebApplicationFirewallPolicyPolicySettings(input []interface{}) *netw return &result } -func expandWebApplicationFirewallPolicyManagedRulesDefinition(input []interface{}) *network.ManagedRulesDefinition { +func expandWebApplicationFirewallPolicyManagedRulesDefinition(input []interface{}, d *pluginsdk.ResourceData) (*network.ManagedRulesDefinition, error) { if len(input) == 0 { - return nil + return nil, nil } v := input[0].(map[string]interface{}) exclusions := v["exclusion"].([]interface{}) managedRuleSets := v["managed_rule_set"].([]interface{}) + expandedManagedRuleSets, err := expandWebApplicationFirewallPolicyManagedRuleSet(managedRuleSets, d) + if err != nil { + return nil, err + } + return &network.ManagedRulesDefinition{ Exclusions: expandWebApplicationFirewallPolicyExclusions(exclusions), - ManagedRuleSets: expandWebApplicationFirewallPolicyManagedRuleSet(managedRuleSets), - } + ManagedRuleSets: expandedManagedRuleSets, + }, nil } func expandWebApplicationFirewallPolicyExclusionManagedRules(input []interface{}) *[]network.ExclusionManagedRule { @@ -666,31 +676,37 @@ func expandWebApplicationFirewallPolicyExclusions(input []interface{}) *[]networ return &results } -func expandWebApplicationFirewallPolicyManagedRuleSet(input []interface{}) *[]network.ManagedRuleSet { +func expandWebApplicationFirewallPolicyManagedRuleSet(input []interface{}, d *pluginsdk.ResourceData) (*[]network.ManagedRuleSet, error) { results := make([]network.ManagedRuleSet, 0) - for _, item := range input { - v := item.(map[string]interface{}) + for i, item := range input { + v := item.(map[string]interface{}) ruleSetType := v["type"].(string) ruleSetVersion := v["version"].(string) ruleGroupOverrides := []interface{}{} if value, exists := v["rule_group_override"]; exists { ruleGroupOverrides = value.([]interface{}) } + + expandedRuleGroupOverrides, err := expandWebApplicationFirewallPolicyRuleGroupOverrides(ruleGroupOverrides, d, i) + if err != nil { + return nil, err + } + result := network.ManagedRuleSet{ RuleSetType: utils.String(ruleSetType), RuleSetVersion: utils.String(ruleSetVersion), - RuleGroupOverrides: expandWebApplicationFirewallPolicyRuleGroupOverrides(ruleGroupOverrides), + RuleGroupOverrides: expandedRuleGroupOverrides, } results = append(results, result) } - return &results + return &results, nil } -func expandWebApplicationFirewallPolicyRuleGroupOverrides(input []interface{}) *[]network.ManagedRuleGroupOverride { +func expandWebApplicationFirewallPolicyRuleGroupOverrides(input []interface{}, d *pluginsdk.ResourceData, managedRuleSetIndex int) (*[]network.ManagedRuleGroupOverride, error) { results := make([]network.ManagedRuleGroupOverride, 0) - for _, item := range input { + for i, item := range input { v := item.(map[string]interface{}) ruleGroupName := v["rule_group_name"].(string) @@ -700,19 +716,35 @@ func expandWebApplicationFirewallPolicyRuleGroupOverrides(input []interface{}) * } if !features.FourPointOhBeta() { - if disabledRules := v["disabled_rules"].([]interface{}); len(disabledRules) > 0 { + // `disabled_rules` will be deprecated from 4.0. In 3.x, `rule` and `disabled_rules` point to the same properties of Azure REST API and conflict with each other in the configuration. + // Since both properties will be set in the flatten method, need to use `GetRawConfig` to check which one of these two properties is configured in the configuration file. + managedRuleSetList := d.GetRawConfig().AsValueMap()["managed_rules"].AsValueSlice()[0].AsValueMap()["managed_rule_set"].AsValueSlice() + if managedRuleSetIndex >= len(managedRuleSetList) { + return nil, fmt.Errorf("managed rule set index %d exceeds raw config length %d", managedRuleSetIndex, len(managedRuleSetList)) + } + + ruleGroupOverrideList := managedRuleSetList[managedRuleSetIndex].AsValueMap()["rule_group_override"].AsValueSlice() + if i >= len(ruleGroupOverrideList) { + return nil, fmt.Errorf("rule group override index %d exceeds raw config length %d", i, len(ruleGroupOverrideList)) + } + + if disabledRules := v["disabled_rules"].([]interface{}); !ruleGroupOverrideList[i].AsValueMap()["disabled_rules"].IsNull() { result.Rules = expandWebApplicationFirewallPolicyRules(disabledRules) } - } - if rules := v["rule"].([]interface{}); len(rules) > 0 { - result.Rules = expandWebApplicationFirewallPolicyOverrideRules(rules) + if rules := v["rule"].([]interface{}); !ruleGroupOverrideList[i].AsValueMap()["rule"].IsNull() && len(ruleGroupOverrideList[i].AsValueMap()["rule"].AsValueSlice()) > 0 { + result.Rules = expandWebApplicationFirewallPolicyOverrideRules(rules) + } + } else { + if rules := v["rule"].([]interface{}); len(rules) > 0 { + result.Rules = expandWebApplicationFirewallPolicyOverrideRules(rules) + } } results = append(results, result) } - return &results + return &results, nil } func expandWebApplicationFirewallPolicyRules(input []interface{}) *[]network.ManagedRuleOverride { diff --git a/internal/services/network/web_application_firewall_policy_resource_test.go b/internal/services/network/web_application_firewall_policy_resource_test.go index 91b4138caff0..ec152f7eb28f 100644 --- a/internal/services/network/web_application_firewall_policy_resource_test.go +++ b/internal/services/network/web_application_firewall_policy_resource_test.go @@ -246,6 +246,28 @@ func TestAccWebApplicationFirewallPolicy_excludedRules(t *testing.T) { }) } +func TestAccWebApplicationFirewallPolicy_updateDisabledRules(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_web_application_firewall_policy", "test") + r := WebApplicationFirewallResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.disabledRules(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.updateDisabledRules(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func (t WebApplicationFirewallResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.ApplicationGatewayWebApplicationFirewallPolicyID(state.ID) if err != nil { @@ -489,6 +511,12 @@ resource "azurerm_web_application_firewall_policy" "test" { rule_group_override { rule_group_name = "REQUEST-920-PROTOCOL-ENFORCEMENT" + + rule { + id = "920440" + enabled = true + action = "Block" + } } } } @@ -771,3 +799,157 @@ resource "azurerm_web_application_firewall_policy" "test" { } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } + +func (WebApplicationFirewallResource) disabledRules(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_web_application_firewall_policy" "test" { + name = "acctestwafpolicy-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + + policy_settings { + enabled = true + mode = "Prevention" + request_body_check = true + file_upload_limit_in_mb = 100 + max_request_body_size_in_kb = 2000 + } + + managed_rules { + managed_rule_set { + type = "OWASP" + version = "3.2" + + rule_group_override { + rule_group_name = "REQUEST-931-APPLICATION-ATTACK-RFI" + disabled_rules = ["931130"] + } + + rule_group_override { + rule_group_name = "REQUEST-920-PROTOCOL-ENFORCEMENT" + disabled_rules = [ + "920320", # Missing User Agent Header + "920230" # Multiple URL Encoding Detected + ] + } + + rule_group_override { + rule_group_name = "REQUEST-942-APPLICATION-ATTACK-SQLI" + disabled_rules = [ + "942450", + "942430", + "942440", + "942370", + "942340", + "942260", + "942200", + "942330", + "942120", + "942110", + "942150", + "942410", + "942130", + "942100" + ] + } + + rule_group_override { + rule_group_name = "REQUEST-941-APPLICATION-ATTACK-XSS" + disabled_rules = [ + "941340" + ] + } + } + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +} + +func (WebApplicationFirewallResource) updateDisabledRules(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_web_application_firewall_policy" "test" { + name = "acctestwafpolicy-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + + policy_settings { + enabled = true + mode = "Prevention" + request_body_check = true + file_upload_limit_in_mb = 100 + max_request_body_size_in_kb = 2000 + } + + managed_rules { + managed_rule_set { + type = "OWASP" + version = "3.2" + + rule_group_override { + rule_group_name = "REQUEST-931-APPLICATION-ATTACK-RFI" + disabled_rules = ["931130"] + } + + rule_group_override { + rule_group_name = "REQUEST-920-PROTOCOL-ENFORCEMENT" + disabled_rules = [ + "920320", # Missing User Agent Header + "920230" # Multiple URL Encoding Detected + ] + } + + #NEW BLOCK + rule_group_override { + rule_group_name = "REQUEST-932-APPLICATION-ATTACK-RCE" + disabled_rules = ["932100"] + } + + rule_group_override { + rule_group_name = "REQUEST-942-APPLICATION-ATTACK-SQLI" + disabled_rules = [ + "942450", + "942430", + "942440", + "942370", + "942340", + "942260", + "942200", + "942330", + "942120", + "942110", + "942150", + "942410", + "942130", + "942100" + ] + } + + rule_group_override { + rule_group_name = "REQUEST-941-APPLICATION-ATTACK-XSS" + disabled_rules = [ + "941340" + ] + } + } + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +} diff --git a/internal/services/nginx/nginx_certificate_resource.go b/internal/services/nginx/nginx_certificate_resource.go index 19703fde727c..8276ad99a3b8 100644 --- a/internal/services/nginx/nginx_certificate_resource.go +++ b/internal/services/nginx/nginx_certificate_resource.go @@ -92,7 +92,7 @@ func (m CertificateResource) Create() sdk.ResourceFunc { deployID, _ := nginxdeployment.ParseNginxDeploymentID(model.NginxDeploymentId) subscriptionID := meta.Client.Account.SubscriptionId - id := nginxcertificate.NewCertificateID(subscriptionID, deployID.ResourceGroupName, deployID.DeploymentName, model.Name) + id := nginxcertificate.NewCertificateID(subscriptionID, deployID.ResourceGroupName, deployID.NginxDeploymentName, model.Name) existing, err := client.CertificatesGet(ctx, id) if !response.WasNotFound(existing.HttpResponse) { if err != nil { @@ -141,7 +141,7 @@ func (m CertificateResource) Read() sdk.ResourceFunc { var output CertificateModel output.Name = pointer.ToString(result.Model.Name) - output.NginxDeploymentId = nginxdeployment.NewNginxDeploymentID(id.SubscriptionId, id.ResourceGroupName, id.DeploymentName).ID() + output.NginxDeploymentId = nginxdeployment.NewNginxDeploymentID(id.SubscriptionId, id.ResourceGroupName, id.NginxDeploymentName).ID() prop := result.Model.Properties output.KeyVirtualPath = pointer.ToString(prop.KeyVirtualPath) output.KeyVaultSecretId = pointer.ToString(prop.KeyVaultSecretId) diff --git a/internal/services/nginx/nginx_certificate_resource_test.go b/internal/services/nginx/nginx_certificate_resource_test.go index afa9d168f057..3e655afd377f 100644 --- a/internal/services/nginx/nginx_certificate_resource_test.go +++ b/internal/services/nginx/nginx_certificate_resource_test.go @@ -134,7 +134,7 @@ resource "azurerm_subnet" "test" { resource "azurerm_nginx_deployment" "test" { name = "acctest-%[1]d" resource_group_name = azurerm_resource_group.test.name - sku = "publicpreview_Monthly_gmz7xq9ge3py" + sku = "standard_Monthly" location = azurerm_resource_group.test.location diagnose_support_enabled = true diff --git a/internal/services/nginx/nginx_configuration_resource.go b/internal/services/nginx/nginx_configuration_resource.go index d79582a71b6f..940497429be6 100644 --- a/internal/services/nginx/nginx_configuration_resource.go +++ b/internal/services/nginx/nginx_configuration_resource.go @@ -102,8 +102,9 @@ func (m ConfigurationResource) Arguments() map[string]*pluginsdk.Schema { }, "config_file": { - Type: pluginsdk.TypeSet, - Required: true, + Type: pluginsdk.TypeSet, + Optional: true, + AtLeastOneOf: []string{"config_file", "package_data"}, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "content": { @@ -122,8 +123,9 @@ func (m ConfigurationResource) Arguments() map[string]*pluginsdk.Schema { }, "protected_file": { - Type: pluginsdk.TypeSet, - Optional: true, + Type: pluginsdk.TypeSet, + Optional: true, + RequiredWith: []string{"config_file"}, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "content": { @@ -143,9 +145,11 @@ func (m ConfigurationResource) Arguments() map[string]*pluginsdk.Schema { }, "package_data": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringIsNotEmpty, + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + AtLeastOneOf: []string{"config_file", "package_data"}, + ConflictsWith: []string{"protected_file", "config_file"}, }, "root_file": { @@ -185,7 +189,7 @@ func (m ConfigurationResource) Create() sdk.ResourceFunc { } subscriptionID := meta.Client.Account.SubscriptionId - id := nginxconfiguration.NewConfigurationID(subscriptionID, deployID.ResourceGroupName, deployID.DeploymentName, defaultConfigurationName) + id := nginxconfiguration.NewConfigurationID(subscriptionID, deployID.ResourceGroupName, deployID.NginxDeploymentName, defaultConfigurationName) existing, err := client.ConfigurationsGet(ctx, id) if !response.WasNotFound(existing.HttpResponse) { @@ -231,7 +235,12 @@ func (m ConfigurationResource) Read() sdk.ResourceFunc { } var output ConfigurationModel - deployID := nginxdeployment.NewNginxDeploymentID(id.SubscriptionId, id.ResourceGroupName, id.DeploymentName) + // protected files field not return by API so decode from state + if err := meta.Decode(&output); err != nil { + return err + } + + deployID := nginxdeployment.NewNginxDeploymentID(id.SubscriptionId, id.ResourceGroupName, id.NginxDeploymentName) output.NginxDeploymentId = deployID.ID() if prop := result.Model.Properties; prop != nil { @@ -250,6 +259,7 @@ func (m ConfigurationResource) Read() sdk.ResourceFunc { } } + // GET does not return protected files if files := prop.ProtectedFiles; files != nil { for _, file := range *files { output.ProtectedFile = append(output.ProtectedFile, ProtectedFile{ @@ -280,21 +290,27 @@ func (m ConfigurationResource) Update() sdk.ResourceFunc { return fmt.Errorf("decoding err: %+v", err) } - upd := nginxconfiguration.NginxConfiguration{ - Name: pointer.FromString(defaultConfigurationName), - Properties: &nginxconfiguration.NginxConfigurationProperties{}, + // retrieve from GET + existing, err := client.ConfigurationsGet(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving exists: +%v", *id) + } + if existing.Model == nil && existing.Model.Properties == nil { + return fmt.Errorf("retrieving as nil for %v", *id) } + upd := existing.Model // root file is required in update - upd.Properties.RootFile = pointer.FromString(model.RootFile) + if meta.ResourceData.HasChange("root_file") { + upd.Properties.RootFile = pointer.FromString(model.RootFile) + } if meta.ResourceData.HasChange("config_file") { upd.Properties.Files = model.toSDKFiles() } - if meta.ResourceData.HasChange("protected_file") { - upd.Properties.Files = model.toSDKProtectedFiles() - } + // API does not return protected file field, so always set this field + upd.Properties.ProtectedFiles = model.toSDKProtectedFiles() if meta.ResourceData.HasChange("package_data") { upd.Properties.Package = &nginxconfiguration.NginxConfigurationPackage{ @@ -302,7 +318,7 @@ func (m ConfigurationResource) Update() sdk.ResourceFunc { } } - result, err := client.ConfigurationsCreateOrUpdate(ctx, *id, upd) + result, err := client.ConfigurationsCreateOrUpdate(ctx, *id, *upd) if err != nil { return fmt.Errorf("updating %s: %v", id, err) } diff --git a/internal/services/nginx/nginx_configuration_resource_test.go b/internal/services/nginx/nginx_configuration_resource_test.go index a395ca86aeb7..5ef8f06d2a03 100644 --- a/internal/services/nginx/nginx_configuration_resource_test.go +++ b/internal/services/nginx/nginx_configuration_resource_test.go @@ -38,6 +38,7 @@ func TestAccConfiguration_basic(t *testing.T) { check.That(data.ResourceName).ExistsInAzure(r), ), }, + data.ImportStep("protected_file"), }) } @@ -51,14 +52,14 @@ func TestAccConfiguration_update(t *testing.T) { check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep(), + data.ImportStep("protected_file"), { Config: r.update(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep(), + data.ImportStep("protected_file"), }) } @@ -90,6 +91,11 @@ resource "azurerm_nginx_configuration" "test" { content = local.config_content virtual_path = "/etc/nginx/nginx.conf" } + + protected_file { + content = local.protected_content + virtual_path = "/opt/.htpasswd" + } } `, a.template(data)) } @@ -130,6 +136,11 @@ resource "azurerm_nginx_configuration" "test" { content = local.sub_config_content virtual_path = "/etc/nginx/site/b.conf" } + + protected_file { + content = local.protected_content + virtual_path = "/opt/.htpasswd" + } } `, a.template(data)) } @@ -151,6 +162,8 @@ http { server { listen 80; location / { + auth_basic "Protected Area"; + auth_basic_user_file /opt/.htpasswd; default_type text/html; return 200 '
this one will be updated
@@ -163,6 +176,11 @@ http { EOT ) + protected_content = base64encode(<<-EOT +user:$apr1$VeUA5kt.$IjjRk//8miRxDsZvD4daF1 +EOT + ) + sub_config_content = base64encode(<<-EOT location /bbb { default_type text/html; @@ -214,7 +232,7 @@ resource "azurerm_subnet" "test" { resource "azurerm_nginx_deployment" "test" { name = "acctest-%[1]d" resource_group_name = azurerm_resource_group.test.name - sku = "publicpreview_Monthly_gmz7xq9ge3py" + sku = "standard_Monthly" location = azurerm_resource_group.test.location //message: "Conflict managed resource group name: tenant: -91a, subscription xxx, resource group example." diff --git a/internal/services/nginx/nginx_deployment_resource.go b/internal/services/nginx/nginx_deployment_resource.go index a49b7640fc6b..24f767f5d8f5 100644 --- a/internal/services/nginx/nginx_deployment_resource.go +++ b/internal/services/nginx/nginx_deployment_resource.go @@ -51,59 +51,6 @@ type DeploymentModel struct { Tags map[string]string `tfschema:"tags"` } -func (d *DeploymentModel) LoadSDK(model *nginxdeployment.NginxDeployment) { - d.Name = pointer.ToString(model.Name) - d.Location = pointer.ToString(model.Location) - d.Tags = pointer.ToMapOfStringStrings(model.Tags) - if model.Sku != nil { - d.Sku = model.Sku.Name - } - - prop := model.Properties - d.IpAddress = pointer.ToString(prop.IPAddress) - d.ManagedResourceGroup = pointer.ToString(prop.ManagedResourceGroup) - d.NginxVersion = pointer.ToString(prop.NginxVersion) - d.DiagnoseSupportEnabled = pointer.ToBool(prop.EnableDiagnosticsSupport) - - if prop.Logging != nil && prop.Logging.StorageAccount != nil { - d.LoggingStorageAccount = []LoggingStorageAccount{ - { - Name: pointer.ToString(prop.Logging.StorageAccount.AccountName), - ContainerName: pointer.ToString(prop.Logging.StorageAccount.ContainerName), - }, - } - } - - if prop.NetworkProfile == nil { - return - } - - if frontend := prop.NetworkProfile.FrontEndIPConfiguration; frontend != nil { - if publicIps := frontend.PublicIPAddresses; publicIps != nil && len(*publicIps) > 0 { - d.FrontendPublic = append(d.FrontendPublic, FrontendPublic{}) - for _, ip := range *publicIps { - d.FrontendPublic[0].IpAddress = append(d.FrontendPublic[0].IpAddress, pointer.ToString(ip.Id)) - } - } - - if privateIPs := frontend.PrivateIPAddresses; privateIPs != nil && len(*privateIPs) > 0 { - for _, ip := range *privateIPs { - d.FrontendPrivate = append(d.FrontendPrivate, FrontendPrivate{ - IpAddress: pointer.ToString(ip.PrivateIPAddress), - AllocationMethod: pointer.ToString((*string)(ip.PrivateIPAllocationMethod)), - SubnetId: pointer.ToString(ip.SubnetId), - }) - } - } - } - - if netIf := prop.NetworkProfile.NetworkInterfaceConfiguration; netIf != nil { - d.NetworkInterface = []NetworkInterface{ - {SubnetId: pointer.ToString(netIf.SubnetId)}, - } - } -} - type DeploymentResource struct{} var _ sdk.ResourceWithUpdate = (*DeploymentResource)(nil) @@ -362,23 +309,74 @@ func (m DeploymentResource) Read() sdk.ResourceFunc { client := meta.Client.Nginx.NginxDeployment result, err := client.DeploymentsGet(ctx, *id) if err != nil { - return err + return fmt.Errorf("retrieving %s: %+v", *id, err) } - model := result.Model - if model == nil { - return fmt.Errorf("retrieving %s got nil model", id) + output := DeploymentModel{ + Name: id.NginxDeploymentName, + ResourceGroupName: id.ResourceGroupName, } - var output DeploymentModel - output.LoadSDK(model) - output.ResourceGroupName = id.ResourceGroupName - output.Name = id.DeploymentName + if model := result.Model; model != nil { + output.Location = pointer.ToString(model.Location) + output.Tags = pointer.ToMapOfStringStrings(model.Tags) + if model.Sku != nil { + output.Sku = model.Sku.Name + } - if id, err := identity.FlattenSystemAndUserAssignedMapToModel(model.Identity); err != nil { - return fmt.Errorf("flattening `identity`: %v", err) - } else { - output.Identity = *id + if props := model.Properties; props != nil { + output.IpAddress = pointer.ToString(props.IPAddress) + output.ManagedResourceGroup = pointer.ToString(props.ManagedResourceGroup) + output.NginxVersion = pointer.ToString(props.NginxVersion) + output.DiagnoseSupportEnabled = pointer.ToBool(props.EnableDiagnosticsSupport) + + if props.Logging != nil && props.Logging.StorageAccount != nil { + output.LoggingStorageAccount = []LoggingStorageAccount{ + { + Name: pointer.ToString(props.Logging.StorageAccount.AccountName), + ContainerName: pointer.ToString(props.Logging.StorageAccount.ContainerName), + }, + } + } + + if profile := props.NetworkProfile; profile != nil { + if frontend := profile.FrontEndIPConfiguration; frontend != nil { + if publicIps := frontend.PublicIPAddresses; publicIps != nil && len(*publicIps) > 0 { + output.FrontendPublic = append(output.FrontendPublic, FrontendPublic{}) + for _, ip := range *publicIps { + output.FrontendPublic[0].IpAddress = append(output.FrontendPublic[0].IpAddress, pointer.ToString(ip.Id)) + } + } + + if privateIPs := frontend.PrivateIPAddresses; privateIPs != nil && len(*privateIPs) > 0 { + for _, ip := range *privateIPs { + method := "" + if ip.PrivateIPAllocationMethod != nil { + method = string(*ip.PrivateIPAllocationMethod) + } + + output.FrontendPrivate = append(output.FrontendPrivate, FrontendPrivate{ + IpAddress: pointer.ToString(ip.PrivateIPAddress), + AllocationMethod: method, + SubnetId: pointer.ToString(ip.SubnetId), + }) + } + } + } + + if netIf := profile.NetworkInterfaceConfiguration; netIf != nil { + output.NetworkInterface = []NetworkInterface{ + {SubnetId: pointer.ToString(netIf.SubnetId)}, + } + } + } + + flattenedIdentity, err := identity.FlattenSystemAndUserAssignedMapToModel(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %v", err) + } + output.Identity = *flattenedIdentity + } } return meta.Encode(&output) diff --git a/internal/services/nginx/nginx_deployment_resource_test.go b/internal/services/nginx/nginx_deployment_resource_test.go index 211d69315ac4..1b9a5046c571 100644 --- a/internal/services/nginx/nginx_deployment_resource_test.go +++ b/internal/services/nginx/nginx_deployment_resource_test.go @@ -86,7 +86,7 @@ func (a DeploymentResource) basic(data acceptance.TestData) string { resource "azurerm_nginx_deployment" "test" { name = "acctest-%[2]d" resource_group_name = azurerm_resource_group.test.name - sku = "publicpreview_Monthly_gmz7xq9ge3py" + sku = "standard_Monthly" location = azurerm_resource_group.test.location diagnose_support_enabled = true @@ -113,7 +113,7 @@ func (a DeploymentResource) update(data acceptance.TestData) string { resource "azurerm_nginx_deployment" "test" { name = "acctest-%[2]d" resource_group_name = azurerm_resource_group.test.name - sku = "publicpreview_Monthly_gmz7xq9ge3py" + sku = "standard_Monthly" location = azurerm_resource_group.test.location diagnose_support_enabled = false @@ -147,7 +147,7 @@ resource "azurerm_user_assigned_identity" "test" { resource "azurerm_nginx_deployment" "test" { name = "acctest-%[2]d" resource_group_name = azurerm_resource_group.test.name - sku = "publicpreview_Monthly_gmz7xq9ge3py" + sku = "standard_Monthly" location = azurerm_resource_group.test.location identity { diff --git a/internal/services/orbital/contact_resource.go b/internal/services/orbital/contact_resource.go new file mode 100644 index 000000000000..86170c29299d --- /dev/null +++ b/internal/services/orbital/contact_resource.go @@ -0,0 +1,207 @@ +package orbital + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/contact" + "github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/contactprofile" + "github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/spacecraft" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type ContactResource struct{} + +type ContactResourceModel struct { + Name string `tfschema:"name"` + Spacecraft string `tfschema:"spacecraft_id"` + ReservationStartTime string `tfschema:"reservation_start_time"` + ReservationEndTime string `tfschema:"reservation_end_time"` + GroundStationName string `tfschema:"ground_station_name"` + ContactProfileId string `tfschema:"contact_profile_id"` +} + +func (r ContactResource) Arguments() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "spacecraft_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: spacecraft.ValidateSpacecraftID, + }, + + "reservation_start_time": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "reservation_end_time": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "ground_station_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "contact_profile_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: contactprofile.ValidateContactProfileID, + }, + } +} + +func (r ContactResource) Attributes() map[string]*schema.Schema { + return map[string]*schema.Schema{} +} + +func (r ContactResource) ModelObject() interface{} { + return &ContactResourceModel{} +} + +func (r ContactResource) ResourceType() string { + return "azurerm_orbital_contact" +} + +func (r ContactResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model ContactResourceModel + if err := metadata.Decode(&model); err != nil { + return err + } + + client := metadata.Client.Orbital.ContactClient + subscriptionId := metadata.Client.Account.SubscriptionId + + spacecraftId, err := contact.ParseSpacecraftID(model.Spacecraft) + if err != nil { + return err + } + id := contact.NewContactID(subscriptionId, spacecraftId.ResourceGroupName, spacecraftId.SpacecraftName, model.Name) + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + contactProfile := contact.ResourceReference{ + Id: &model.ContactProfileId, + } + + contactProperties := contact.ContactsProperties{ + ContactProfile: contactProfile, + GroundStationName: model.GroundStationName, + ReservationEndTime: model.ReservationEndTime, + ReservationStartTime: model.ReservationStartTime, + } + + contact := contact.Contact{ + Id: utils.String(id.ID()), + Name: utils.String(model.Name), + Properties: &contactProperties, + } + if _, err = client.Create(ctx, id, contact); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + metadata.SetID(id) + return nil + }, + } +} + +func (r ContactResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Orbital.ContactClient + id, err := contact.ParseContactID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("reading %s: %+v", *id, err) + } + + spacecraftId := contact.NewSpacecraftID(id.SubscriptionId, id.ResourceGroupName, id.SpacecraftName) + if model := resp.Model; model != nil { + props := model.Properties + state := ContactResourceModel{ + Name: id.ContactName, + Spacecraft: spacecraftId.ID(), + } + + if props != nil { + state.ReservationStartTime = props.ReservationStartTime + state.ReservationEndTime = props.ReservationEndTime + state.GroundStationName = props.GroundStationName + if props.ContactProfile.Id != nil { + state.ContactProfileId = *props.ContactProfile.Id + } else { + return fmt.Errorf("contact profile id is missing %s", *id) + } + } else { + return fmt.Errorf("required properties are missing %s", *id) + } + + return metadata.Encode(&state) + } + return nil + }, + } +} + +func (r ContactResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Orbital.ContactClient + id, err := contact.ParseContactID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("deleting %s", *id) + + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + return nil + }, + } +} + +func (r ContactResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return contact.ValidateContactID +} diff --git a/internal/services/orbital/contact_resource_test.go b/internal/services/orbital/contact_resource_test.go new file mode 100644 index 000000000000..366939cf7f46 --- /dev/null +++ b/internal/services/orbital/contact_resource_test.go @@ -0,0 +1,139 @@ +package orbital_test + +import ( + "context" + "fmt" + "os" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/contact" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type ContactResource struct{} + +func TestAccContact_basic(t *testing.T) { + skipContact(t) + + data := acceptance.BuildTestData(t, "azurerm_orbital_contact", "test") + r := ContactResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r ContactResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := contact.ParseContactID(state.ID) + if err != nil { + return nil, err + } + + resp, err := client.Orbital.ContactClient.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) + } + return utils.Bool(true), nil +} + +func (r ContactResource) basic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_orbital_contact" "test" { + name = "testcontact-%[2]d" + spacecraft_id = "%[3]s" + reservation_start_time = "2025-07-16T20:35:00Z" + reservation_end_time = "2025-07-16T20:55:00Z" + ground_station_name = "Microsoft_Quincy" + contact_profile_id = azurerm_orbital_contact_profile.test.id +} +`, template, data.RandomInteger, os.Getenv("ARM_TEST_SPACECRAFT_ID")) +} + +func (r ContactResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +resource "azurerm_virtual_network" "test" { + name = "testvnet" + address_space = ["10.0.0.0/16"] + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_subnet" "test" { + name = "testsubnet" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test.name + address_prefixes = ["10.0.1.0/24"] + + delegation { + name = "orbitalgateway" + + service_delegation { + name = "Microsoft.Orbital/orbitalGateways" + actions = [ + "Microsoft.Network/publicIPAddresses/join/action", + "Microsoft.Network/virtualNetworks/subnets/join/action", + "Microsoft.Network/virtualNetworks/read", + "Microsoft.Network/publicIPAddresses/read", + ] + } + } +} + +resource "azurerm_orbital_contact_profile" "test" { + name = "testcontactprofile-%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + minimum_variable_contact_duration = "PT1M" + auto_tracking = "disabled" + links { + channels { + name = "channelname" + bandwidth_mhz = 100 + center_frequency_mhz = 101 + end_point { + end_point_name = "AQUA_command" + ip_address = "10.0.1.0" + port = "49153" + protocol = "TCP" + } + } + direction = "Uplink" + name = "RHCP_UL" + polarization = "RHCP" + } + network_configuration_subnet_id = azurerm_subnet.test.id +} +`, data.RandomInteger, data.Locations.Primary) +} + +func skipContact(t *testing.T) { + if os.Getenv("ARM_TEST_SPACECRAFT_ID") == "" { + t.Skip("Skipping as `ARM_TEST_SPACECRAFT_ID` was not specified") + } +} diff --git a/internal/services/orbital/registration.go b/internal/services/orbital/registration.go index 6e8869751b35..f43c3669710b 100644 --- a/internal/services/orbital/registration.go +++ b/internal/services/orbital/registration.go @@ -22,6 +22,7 @@ func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ SpacecraftResource{}, ContactProfileResource{}, + ContactResource{}, } } diff --git a/internal/services/policy/assignment_data_source.go b/internal/services/policy/assignment_data_source.go index 46cfa7ae4401..5ce1bc4c0036 100644 --- a/internal/services/policy/assignment_data_source.go +++ b/internal/services/policy/assignment_data_source.go @@ -154,7 +154,7 @@ func (AssignmentDataSource) Read() sdk.ResourceFunc { resp, err := client.Get(ctx, id.Scope, id.Name) if err != nil { if utils.ResponseWasNotFound(resp.Response) { - return metadata.MarkAsGone(id) + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } diff --git a/internal/services/policy/assignment_data_source_test.go b/internal/services/policy/assignment_data_source_test.go index 883ccffbb923..5bb08733bc6b 100644 --- a/internal/services/policy/assignment_data_source_test.go +++ b/internal/services/policy/assignment_data_source_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" ) @@ -17,10 +16,10 @@ func TestAccDataSourceAssignment_builtinPolicyBasic(t *testing.T) { d := AssignmentDataSource{} r := ResourceGroupAssignmentTestResource{} - data.DataSourceTest(t, []resource.TestStep{ + data.DataSourceTest(t, []acceptance.TestStep{ { Config: d.builtinPolicy(data, r), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).Key("parameters").Exists(), ), }, @@ -31,10 +30,10 @@ func TestAccDataSourceAssignment_builtinPolicyComplete(t *testing.T) { data := acceptance.BuildTestData(t, "data.azurerm_policy_assignment", "test") d := AssignmentDataSource{} - data.DataSourceTest(t, []resource.TestStep{ + data.DataSourceTest(t, []acceptance.TestStep{ { Config: d.builtinPolicyComplete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).Key("location").HasValue(location.Normalize(data.Locations.Primary)), check.That(data.ResourceName).Key("policy_definition_id").Exists(), check.That(data.ResourceName).Key("description").HasValue("Description"), @@ -55,10 +54,10 @@ func TestAccDataSourceAssignment_identity(t *testing.T) { d := AssignmentDataSource{} r := ResourceGroupAssignmentTestResource{} - data.DataSourceTest(t, []resource.TestStep{ + data.DataSourceTest(t, []acceptance.TestStep{ { Config: d.systemAssignedIdentity(data, r), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).Key("identity.0.type").HasValue("SystemAssigned"), check.That(data.ResourceName).Key("identity.0.principal_id").Exists(), check.That(data.ResourceName).Key("identity.0.tenant_id").Exists(), @@ -66,7 +65,7 @@ func TestAccDataSourceAssignment_identity(t *testing.T) { }, { Config: d.userAssignedIdentity(data, r), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).Key("identity.0.type").HasValue("UserAssigned"), check.That(data.ResourceName).Key("identity.0.identity_ids.#").HasValue("1"), ), diff --git a/internal/services/policy/assignment_base_resource.go b/internal/services/policy/assignment_resource_base.go similarity index 100% rename from internal/services/policy/assignment_base_resource.go rename to internal/services/policy/assignment_resource_base.go diff --git a/internal/services/policy/exemption_management_group_test.go b/internal/services/policy/exemption_management_group_test.go index 2eb1c4c8202f..ceac51ded491 100644 --- a/internal/services/policy/exemption_management_group_test.go +++ b/internal/services/policy/exemption_management_group_test.go @@ -6,13 +6,12 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" managmentGroupParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/managementgroup/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -22,10 +21,10 @@ func TestAccAzureRMManagementGroupPolicyExemption_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_management_group_policy_exemption", "test") r := ManagementGroupPolicyExemptionResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -38,10 +37,10 @@ func TestAccAzureRMManagementGroupPolicyExemption_complete(t *testing.T) { r := ManagementGroupPolicyExemptionResource{} endDate := time.Now().UTC().Add(time.Hour * 24).Format(time.RFC3339) - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data, endDate), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -54,24 +53,24 @@ func TestAccAzureRMManagementGroupPolicyExemption_update(t *testing.T) { r := ManagementGroupPolicyExemptionResource{} endDate := time.Now().UTC().Add(time.Hour * 24).Format(time.RFC3339) - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data, endDate), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -79,7 +78,7 @@ func TestAccAzureRMManagementGroupPolicyExemption_update(t *testing.T) { }) } -func (r ManagementGroupPolicyExemptionResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r ManagementGroupPolicyExemptionResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.ResourcePolicyExemptionID(state.ID) if err != nil { return nil, err diff --git a/internal/services/policy/exemption_resource_group_test.go b/internal/services/policy/exemption_resource_group_test.go index 8113faa09ba6..862280024ff7 100644 --- a/internal/services/policy/exemption_resource_group_test.go +++ b/internal/services/policy/exemption_resource_group_test.go @@ -6,13 +6,12 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/parse" resourceParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -22,10 +21,10 @@ func TestAccAzureRMResourceGroupPolicyExemption_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_resource_group_policy_exemption", "test") r := ResourceGroupPolicyExemptionResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -38,10 +37,10 @@ func TestAccAzureRMResourceGroupPolicyExemption_complete(t *testing.T) { r := ResourceGroupPolicyExemptionResource{} endDate := time.Now().UTC().Add(time.Hour * 24).Format(time.RFC3339) - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data, endDate), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -54,24 +53,24 @@ func TestAccAzureRMResourceGroupPolicyExemption_update(t *testing.T) { r := ResourceGroupPolicyExemptionResource{} endDate := time.Now().UTC().Add(time.Hour * 24).Format(time.RFC3339) - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data, endDate), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -79,7 +78,7 @@ func TestAccAzureRMResourceGroupPolicyExemption_update(t *testing.T) { }) } -func (r ResourceGroupPolicyExemptionResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r ResourceGroupPolicyExemptionResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.ResourceGroupPolicyExemptionID(state.ID) if err != nil { return nil, err diff --git a/internal/services/policy/exemption_resource_test.go b/internal/services/policy/exemption_resource_test.go index 44acf28ff515..63acc87f0779 100644 --- a/internal/services/policy/exemption_resource_test.go +++ b/internal/services/policy/exemption_resource_test.go @@ -6,12 +6,11 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -21,10 +20,10 @@ func TestAccAzureRMResourcePolicyExemption_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_resource_policy_exemption", "test") r := ResourcePolicyExemptionResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -37,10 +36,10 @@ func TestAccAzureRMResourcePolicyExemption_complete(t *testing.T) { r := ResourcePolicyExemptionResource{} endDate := time.Now().UTC().Add(time.Hour * 24).Format(time.RFC3339) - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data, endDate), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -53,24 +52,24 @@ func TestAccAzureRMResourcePolicyExemption_update(t *testing.T) { r := ResourcePolicyExemptionResource{} endDate := time.Now().UTC().Add(time.Hour * 24).Format(time.RFC3339) - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data, endDate), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -78,7 +77,7 @@ func TestAccAzureRMResourcePolicyExemption_update(t *testing.T) { }) } -func (r ResourcePolicyExemptionResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r ResourcePolicyExemptionResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.ResourcePolicyExemptionID(state.ID) if err != nil { return nil, err diff --git a/internal/services/policy/exemption_subscription_test.go b/internal/services/policy/exemption_subscription_test.go index 6da418772a96..2ad823f4f4c9 100644 --- a/internal/services/policy/exemption_subscription_test.go +++ b/internal/services/policy/exemption_subscription_test.go @@ -7,12 +7,11 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -22,10 +21,10 @@ func TestAccAzureRMSubscriptionPolicyExemption_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_subscription_policy_exemption", "test") r := SubscriptionPolicyExemptionResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -38,10 +37,10 @@ func TestAccAzureRMSubscriptionPolicyExemption_complete(t *testing.T) { r := SubscriptionPolicyExemptionResource{} endDate := time.Now().UTC().Add(time.Hour * 24).Format(time.RFC3339) - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data, endDate), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -54,24 +53,24 @@ func TestAccAzureRMSubscriptionPolicyExemption_update(t *testing.T) { r := SubscriptionPolicyExemptionResource{} endDate := time.Now().UTC().Add(time.Hour * 24).Format(time.RFC3339) - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data, endDate), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -79,7 +78,7 @@ func TestAccAzureRMSubscriptionPolicyExemption_update(t *testing.T) { }) } -func (r SubscriptionPolicyExemptionResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r SubscriptionPolicyExemptionResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.SubscriptionPolicyExemptionID(state.ID) if err != nil { return nil, err diff --git a/internal/services/policy/policy.go b/internal/services/policy/policy.go index 7fefa678e6f7..d5c8b800f6af 100644 --- a/internal/services/policy/policy.go +++ b/internal/services/policy/policy.go @@ -10,14 +10,19 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/utils" ) -func getPolicyDefinitionByDisplayName(ctx context.Context, client *policy.DefinitionsClient, displayName, managementGroupName string) (policy.Definition, error) { +func getPolicyDefinitionByDisplayName(ctx context.Context, client *policy.DefinitionsClient, displayName, managementGroupName string, + builtInOnly bool) (policy.Definition, error) { var policyDefinitions policy.DefinitionListResultIterator var err error if managementGroupName != "" { policyDefinitions, err = client.ListByManagementGroupComplete(ctx, managementGroupName, "", nil) } else { - policyDefinitions, err = client.ListComplete(ctx, "", nil) + if builtInOnly { + policyDefinitions, err = client.ListBuiltInComplete(ctx, "", nil) + } else { + policyDefinitions, err = client.ListComplete(ctx, "", nil) + } } if err != nil { return policy.Definition{}, fmt.Errorf("loading Policy Definition List: %+v", err) @@ -37,12 +42,12 @@ func getPolicyDefinitionByDisplayName(ctx context.Context, client *policy.Defini // we found none if len(results) == 0 { - return policy.Definition{}, fmt.Errorf("loading Policy Definition List: could not find policy '%s'", displayName) + return policy.Definition{}, fmt.Errorf("loading Policy Definition List: could not find policy '%s'. has the policies name changed? list available with `az policy definition list`", displayName) } // we found more than one if len(results) > 1 { - return policy.Definition{}, fmt.Errorf("loading Policy Definition List: found more than one policy '%s'", displayName) + return policy.Definition{}, fmt.Errorf("loading Policy Definition List: found more than one (%d) policy '%s'", len(results), displayName) } return results[0], nil diff --git a/internal/services/policy/policy_definition_built_in_data_source.go b/internal/services/policy/policy_definition_built_in_data_source.go new file mode 100644 index 000000000000..0e9ed58d4c86 --- /dev/null +++ b/internal/services/policy/policy_definition_built_in_data_source.go @@ -0,0 +1,20 @@ +package policy + +import ( + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +// dataSourceArmPolicyDefinitionBuiltIn read built-in policy definition only +func dataSourceArmPolicyDefinitionBuiltIn() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: policyDefinitionReadFunc(true), + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: policyDefinitionDataSourceSchema(), + } +} diff --git a/internal/services/policy/policy_definition_built_in_data_source_test.go b/internal/services/policy/policy_definition_built_in_data_source_test.go new file mode 100644 index 000000000000..801b5dd4165d --- /dev/null +++ b/internal/services/policy/policy_definition_built_in_data_source_test.go @@ -0,0 +1,42 @@ +package policy_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type PolicyDefinitionBuiltInDataSource struct{} + +func TestAccDataSourceAzureRMPolicyDefinitionBuiltIn_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_policy_definition_built_in", "test") + d := PolicyDefinitionBuiltInDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: d.basic("Allowed resource types"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("id").HasValue("/providers/Microsoft.Authorization/policyDefinitions/a08ec900-254a-4555-9bf5-e42af04b5c5c"), + check.That(data.ResourceName).Key("name").HasValue("a08ec900-254a-4555-9bf5-e42af04b5c5c"), + check.That(data.ResourceName).Key("display_name").HasValue("Allowed resource types"), + check.That(data.ResourceName).Key("type").HasValue("Microsoft.Authorization/policyDefinitions"), + check.That(data.ResourceName).Key("description").HasValue("This policy enables you to specify the resource types that your organization can deploy. Only resource types that support 'tags' and 'location' will be affected by this policy. To restrict all resources please duplicate this policy and change the 'mode' to 'All'."), + check.That(data.ResourceName).Key("mode").HasValue("Indexed"), + ), + }, + }) +} + +func (d PolicyDefinitionBuiltInDataSource) basic(name string) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +data "azurerm_policy_definition_built_in" "test" { + display_name = "%s" +} +`, name) +} diff --git a/internal/services/policy/policy_definition_data_source.go b/internal/services/policy/policy_definition_data_source.go index 4cb9df72cbf5..e6d552d4fca2 100644 --- a/internal/services/policy/policy_definition_data_source.go +++ b/internal/services/policy/policy_definition_data_source.go @@ -14,133 +14,149 @@ import ( func dataSourceArmPolicyDefinition() *pluginsdk.Resource { return &pluginsdk.Resource{ - Read: dataSourceArmPolicyDefinitionRead, + Read: policyDefinitionReadFunc(false), Timeouts: &pluginsdk.ResourceTimeout{ Read: pluginsdk.DefaultTimeout(5 * time.Minute), }, - Schema: map[string]*pluginsdk.Schema{ - "display_name": { - Type: pluginsdk.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringIsNotEmpty, - ExactlyOneOf: []string{"name", "display_name"}, - }, + Schema: policyDefinitionDataSourceSchema(), + } +} - "name": { - Type: pluginsdk.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringIsNotEmpty, - ExactlyOneOf: []string{"name", "display_name"}, - }, +func policyDefinitionDataSourceSchema() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "display_name": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringIsNotEmpty, + ExactlyOneOf: []string{"name", "display_name"}, + }, - "management_group_name": { - Type: pluginsdk.TypeString, - Optional: true, - }, + "name": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringIsNotEmpty, + ExactlyOneOf: []string{"name", "display_name"}, + }, - "type": { - Type: pluginsdk.TypeString, - Computed: true, - }, + "management_group_name": { + Type: pluginsdk.TypeString, + Optional: true, + }, - "description": { - Type: pluginsdk.TypeString, - Computed: true, - }, + "type": { + Type: pluginsdk.TypeString, + Computed: true, + }, - "policy_type": { - Type: pluginsdk.TypeString, - Computed: true, - }, + "description": { + Type: pluginsdk.TypeString, + Computed: true, + }, - "policy_rule": { - Type: pluginsdk.TypeString, - Computed: true, - }, + "policy_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, - "parameters": { - Type: pluginsdk.TypeString, - Computed: true, - }, + "policy_rule": { + Type: pluginsdk.TypeString, + Computed: true, + }, - "metadata": { - Type: pluginsdk.TypeString, - Computed: true, - }, + "parameters": { + Type: pluginsdk.TypeString, + Computed: true, + }, - "role_definition_ids": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, + "metadata": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "role_definition_ids": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, }, }, + + "mode": { + Type: pluginsdk.TypeString, + Computed: true, + }, } } -func dataSourceArmPolicyDefinitionRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Policy.DefinitionsClient - ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) - defer cancel() - - displayName := d.Get("display_name").(string) - name := d.Get("name").(string) - managementGroupName := "" - if v, ok := d.GetOk("management_group_name"); ok { - managementGroupName = v.(string) - } +func policyDefinitionReadFunc(builtInOnly bool) func(d *pluginsdk.ResourceData, meta interface{}) error { + return func(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Policy.DefinitionsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + displayName := d.Get("display_name").(string) + name := d.Get("name").(string) + managementGroupName := "" + if v, ok := d.GetOk("management_group_name"); ok { + managementGroupName = v.(string) + } - var policyDefinition policy.Definition - var err error - // one of display_name and name must be non-empty, this is guaranteed by schema - if displayName != "" { - policyDefinition, err = getPolicyDefinitionByDisplayName(ctx, client, displayName, managementGroupName) - if err != nil { - return fmt.Errorf("reading Policy Definition (Display Name %q): %+v", displayName, err) + var policyDefinition policy.Definition + var err error + // one of display_name and name must be non-empty, this is guaranteed by schema + if displayName != "" { + policyDefinition, err = getPolicyDefinitionByDisplayName(ctx, client, displayName, managementGroupName, builtInOnly) + if err != nil { + return fmt.Errorf("reading Policy Definition (Display Name %q): %+v", displayName, err) + } } - } - if name != "" { - policyDefinition, err = getPolicyDefinitionByName(ctx, client, name, managementGroupName) + if name != "" { + if builtInOnly && managementGroupName == "" { + policyDefinition, err = client.GetBuiltIn(ctx, name) + } else { + policyDefinition, err = getPolicyDefinitionByName(ctx, client, name, managementGroupName) + } + if err != nil { + return fmt.Errorf("reading Policy Definition %q: %+v", name, err) + } + } + + id, err := parse.PolicyDefinitionID(*policyDefinition.ID) if err != nil { - return fmt.Errorf("reading Policy Definition %q: %+v", name, err) + return fmt.Errorf("parsing Policy Definition %q: %+v", *policyDefinition.ID, err) } - } - id, err := parse.PolicyDefinitionID(*policyDefinition.ID) - if err != nil { - return fmt.Errorf("parsing Policy Definition %q: %+v", *policyDefinition.ID, err) - } + d.SetId(id.Id) + d.Set("name", policyDefinition.Name) + d.Set("display_name", policyDefinition.DisplayName) + d.Set("description", policyDefinition.Description) + d.Set("type", policyDefinition.Type) + d.Set("policy_type", policyDefinition.PolicyType) + d.Set("mode", policyDefinition.Mode) + + policyRule := policyDefinition.PolicyRule.(map[string]interface{}) + if policyRuleStr := flattenJSON(policyRule); policyRuleStr != "" { + d.Set("policy_rule", policyRuleStr) + roleIDs, _ := getPolicyRoleDefinitionIDs(policyRuleStr) + d.Set("role_definition_ids", roleIDs) + } else { + return fmt.Errorf("flattening Policy Definition Rule %q: %+v", name, err) + } - d.SetId(id.Id) - d.Set("name", policyDefinition.Name) - d.Set("display_name", policyDefinition.DisplayName) - d.Set("description", policyDefinition.Description) - d.Set("type", policyDefinition.Type) - d.Set("policy_type", policyDefinition.PolicyType) - - policyRule := policyDefinition.PolicyRule.(map[string]interface{}) - if policyRuleStr := flattenJSON(policyRule); policyRuleStr != "" { - d.Set("policy_rule", policyRuleStr) - roleIDs, _ := getPolicyRoleDefinitionIDs(policyRuleStr) - d.Set("role_definition_ids", roleIDs) - } else { - return fmt.Errorf("flattening Policy Definition Rule %q: %+v", name, err) - } + if metadataStr := flattenJSON(policyDefinition.Metadata); metadataStr != "" { + d.Set("metadata", metadataStr) + } - if metadataStr := flattenJSON(policyDefinition.Metadata); metadataStr != "" { - d.Set("metadata", metadataStr) - } + if parametersStr, err := flattenParameterDefinitionsValueToString(policyDefinition.Parameters); err == nil { + d.Set("parameters", parametersStr) + } else { + return fmt.Errorf("failed to flatten Policy Parameters %q: %+v", name, err) + } - if parametersStr, err := flattenParameterDefinitionsValueToString(policyDefinition.Parameters); err == nil { - d.Set("parameters", parametersStr) - } else { - return fmt.Errorf("failed to flatten Policy Parameters %q: %+v", name, err) + return nil } - - return nil } diff --git a/internal/services/policy/policy_definition_data_source_test.go b/internal/services/policy/policy_definition_data_source_test.go index 8dd60b978d1f..bb1b89e7b140 100644 --- a/internal/services/policy/policy_definition_data_source_test.go +++ b/internal/services/policy/policy_definition_data_source_test.go @@ -23,6 +23,7 @@ func TestAccDataSourceAzureRMPolicyDefinition_builtIn(t *testing.T) { check.That(data.ResourceName).Key("display_name").HasValue("Allowed resource types"), check.That(data.ResourceName).Key("type").HasValue("Microsoft.Authorization/policyDefinitions"), check.That(data.ResourceName).Key("description").HasValue("This policy enables you to specify the resource types that your organization can deploy. Only resource types that support 'tags' and 'location' will be affected by this policy. To restrict all resources please duplicate this policy and change the 'mode' to 'All'."), + check.That(data.ResourceName).Key("mode").HasValue("Indexed"), ), }, }) @@ -56,6 +57,7 @@ func TestAccDataSourceAzureRMPolicyDefinition_builtInByName(t *testing.T) { check.That(data.ResourceName).Key("display_name").HasValue("Allowed resource types"), check.That(data.ResourceName).Key("type").HasValue("Microsoft.Authorization/policyDefinitions"), check.That(data.ResourceName).Key("description").HasValue("This policy enables you to specify the resource types that your organization can deploy. Only resource types that support 'tags' and 'location' will be affected by this policy. To restrict all resources please duplicate this policy and change the 'mode' to 'All'."), + check.That(data.ResourceName).Key("mode").HasValue("Indexed"), ), }, }) @@ -90,6 +92,7 @@ func TestAccDataSourceAzureRMPolicyDefinition_customByDisplayName(t *testing.T) check.That(data.ResourceName).Key("policy_rule").HasValue("{\"if\":{\"not\":{\"field\":\"location\",\"in\":\"[parameters('allowedLocations')]\"}},\"then\":{\"effect\":\"audit\"}}"), check.That(data.ResourceName).Key("parameters").HasValue("{\"allowedLocations\":{\"type\":\"Array\",\"metadata\":{\"description\":\"The list of allowed locations for resources.\",\"displayName\":\"Allowed locations\",\"strongType\":\"location\"}}}"), check.That(data.ResourceName).Key("metadata").Exists(), + check.That(data.ResourceName).Key("mode").HasValue("All"), ), }, }) @@ -110,6 +113,7 @@ func TestAccDataSourceAzureRMPolicyDefinition_customByName(t *testing.T) { check.That(data.ResourceName).Key("policy_rule").HasValue("{\"if\":{\"not\":{\"field\":\"location\",\"in\":\"[parameters('allowedLocations')]\"}},\"then\":{\"effect\":\"audit\"}}"), check.That(data.ResourceName).Key("parameters").HasValue("{\"allowedLocations\":{\"type\":\"Array\",\"metadata\":{\"description\":\"The list of allowed locations for resources.\",\"displayName\":\"Allowed locations\",\"strongType\":\"location\"}}}"), check.That(data.ResourceName).Key("metadata").Exists(), + check.That(data.ResourceName).Key("mode").HasValue("All"), ), }, }) diff --git a/internal/services/policy/registration.go b/internal/services/policy/registration.go index f22756c2fae7..1a35bd55e437 100644 --- a/internal/services/policy/registration.go +++ b/internal/services/policy/registration.go @@ -47,6 +47,7 @@ func (r Registration) WebsiteCategories() []string { func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ "azurerm_policy_definition": dataSourceArmPolicyDefinition(), + "azurerm_policy_definition_built_in": dataSourceArmPolicyDefinitionBuiltIn(), "azurerm_policy_set_definition": dataSourceArmPolicySetDefinition(), "azurerm_policy_virtual_machine_configuration_assignment": dataSourcePolicyVirtualMachineConfigurationAssignment(), } diff --git a/internal/services/postgres/client/client.go b/internal/services/postgres/client/client.go index b8dbeb5aadbf..151a853e5224 100644 --- a/internal/services/postgres/client/client.go +++ b/internal/services/postgres/client/client.go @@ -11,11 +11,11 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules" "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys" flexibleserverconfigurations "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations" - flexibleserverdatabases "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases" - flexibleserverfirewallrules "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules" "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart" - flexibleserveradministrators "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators" - flexibleservers "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers" + flexibleserveradministrators "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators" + flexibleserverdatabases "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases" + flexibleserverfirewallrules "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules" + flexibleservers "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) diff --git a/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource.go b/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource.go index 0a776c605231..794d037c4779 100644 --- a/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource.go +++ b/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource.go @@ -7,9 +7,10 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -85,6 +86,9 @@ func resourcePostgresqlFlexibleServerAdministratorCreate(d *pluginsdk.ResourceDa id := administrators.NewAdministratorID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("object_id").(string)) + locks.ByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) + defer locks.UnlockByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) + if d.IsNewResource() { existing, err := client.Get(ctx, id) if err != nil { @@ -139,7 +143,7 @@ func resourcePostgresqlFlexibleServerAdministratorRead(d *pluginsdk.ResourceData } d.Set("resource_group_name", id.ResourceGroupName) - d.Set("server_name", id.ServerName) + d.Set("server_name", id.FlexibleServerName) if model := resp.Model; model != nil { props := model.Properties @@ -162,6 +166,9 @@ func resourcePostgresqlFlexibleServerAdministratorDelete(d *pluginsdk.ResourceDa return err } + locks.ByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) + defer locks.UnlockByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) + if err := client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } diff --git a/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource_test.go b/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource_test.go index e480267cca6d..7a8fa57492fb 100644 --- a/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource_test.go +++ b/internal/services/postgres/postgresql_flexible_server_aad_administrator_resource_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/postgres/postgresql_flexible_server_configuration_resource.go b/internal/services/postgres/postgresql_flexible_server_configuration_resource.go index 2514a9eaf1a1..5c4e3dcf2e8c 100644 --- a/internal/services/postgres/postgresql_flexible_server_configuration_resource.go +++ b/internal/services/postgres/postgresql_flexible_server_configuration_resource.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -70,10 +71,10 @@ func resourceFlexibleServerConfigurationUpdate(d *pluginsdk.ResourceData, meta i if err != nil { return err } - id := configurations.NewConfigurationID(subscriptionId, serverId.ResourceGroupName, serverId.ServerName, d.Get("name").(string)) + id := configurations.NewConfigurationID(subscriptionId, serverId.ResourceGroupName, serverId.FlexibleServerName, d.Get("name").(string)) - locks.ByName(id.ServerName, postgresqlFlexibleServerResourceName) - defer locks.UnlockByName(id.ServerName, postgresqlFlexibleServerResourceName) + locks.ByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) + defer locks.UnlockByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) props := configurations.Configuration{ Properties: &configurations.ConfigurationProperties{ @@ -86,6 +87,26 @@ func resourceFlexibleServerConfigurationUpdate(d *pluginsdk.ResourceData, meta i return fmt.Errorf("updating %s: %+v", id, err) } + resp, err := client.Get(ctx, id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if model := resp.Model; model != nil { + props := model.Properties + + if isDynamicConfig := props.IsDynamicConfig; isDynamicConfig != nil && !*isDynamicConfig { + if isReadOnly := props.IsReadOnly; isReadOnly != nil && !*isReadOnly { + restartClient := meta.(*clients.Client).Postgres.ServerRestartClient + restartServerId := serverrestart.NewFlexibleServerID(id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName) + + if err = restartClient.ServersRestartThenPoll(ctx, restartServerId, serverrestart.RestartParameter{}); err != nil { + return fmt.Errorf("restarting server %s: %+v", id, err) + } + } + } + } + d.SetId(id.ID()) return resourceFlexibleServerConfigurationRead(d, meta) @@ -114,7 +135,7 @@ func resourceFlexibleServerConfigurationRead(d *pluginsdk.ResourceData, meta int } d.Set("name", id.ConfigurationName) - d.Set("server_id", configurations.NewFlexibleServerID(subscriptionId, id.ResourceGroupName, id.ServerName).ID()) + d.Set("server_id", configurations.NewFlexibleServerID(subscriptionId, id.ResourceGroupName, id.FlexibleServerName).ID()) if resp.Model != nil && resp.Model.Properties != nil { d.Set("value", resp.Model.Properties.Value) @@ -133,8 +154,8 @@ func resourceFlexibleServerConfigurationDelete(d *pluginsdk.ResourceData, meta i return err } - locks.ByName(id.ServerName, postgresqlFlexibleServerResourceName) - defer locks.UnlockByName(id.ServerName, postgresqlFlexibleServerResourceName) + locks.ByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) + defer locks.UnlockByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) resp, err := client.Get(ctx, *id) if err != nil { @@ -157,5 +178,20 @@ func resourceFlexibleServerConfigurationDelete(d *pluginsdk.ResourceData, meta i return fmt.Errorf("deleting %s: %+v", id, err) } + if model := resp.Model; model != nil { + props := model.Properties + + if isDynamicConfig := props.IsDynamicConfig; isDynamicConfig != nil && !*isDynamicConfig { + if isReadOnly := props.IsReadOnly; isReadOnly != nil && !*isReadOnly { + restartClient := meta.(*clients.Client).Postgres.ServerRestartClient + restartServerId := serverrestart.NewFlexibleServerID(id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName) + + if err = restartClient.ServersRestartThenPoll(ctx, restartServerId, serverrestart.RestartParameter{}); err != nil { + return fmt.Errorf("restarting server %s: %+v", id, err) + } + } + } + } + return nil } diff --git a/internal/services/postgres/postgresql_flexible_server_configuration_resource_test.go b/internal/services/postgres/postgresql_flexible_server_configuration_resource_test.go index 6f8243879fff..25ec21c8bca1 100644 --- a/internal/services/postgres/postgresql_flexible_server_configuration_resource_test.go +++ b/internal/services/postgres/postgresql_flexible_server_configuration_resource_test.go @@ -117,7 +117,7 @@ func (r PostgresqlFlexibleServerConfigurationResource) checkReset(configurationN return err } - configurationId := configurations.NewConfigurationID(id.SubscriptionId, id.ResourceGroupName, id.ServerName, configurationName) + configurationId := configurations.NewConfigurationID(id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName, configurationName) resp, err := clients.Postgres.FlexibleServersConfigurationsClient.Get(ctx, configurationId) if err != nil { @@ -159,6 +159,29 @@ func TestAccFlexibleServerConfiguration_multiplePostgresqlFlexibleServerConfigur }) } +func TestAccFlexibleServerConfiguration_restartServerForStaticParameters(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_postgresql_flexible_server_configuration", "test") + r := PostgresqlFlexibleServerConfigurationResource{} + name := "cron.max_running_jobs" + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data, name, "5"), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("name").HasValue(name), + check.That(data.ResourceName).Key("value").HasValue("5"), + ), + }, + data.ImportStep(), + { + Config: r.template(data), + Check: acceptance.ComposeTestCheckFunc( + data.CheckWithClientForResource(r.checkReset(name), "azurerm_postgresql_flexible_server.test"), + ), + }, + }) +} + // Helper functions for verification func (r PostgresqlFlexibleServerConfigurationResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := configurations.ParseConfigurationID(state.ID) diff --git a/internal/services/postgres/postgresql_flexible_server_data_source.go b/internal/services/postgres/postgresql_flexible_server_data_source.go index d4afeab86b33..33ca1853a2c6 100644 --- a/internal/services/postgres/postgresql_flexible_server_data_source.go +++ b/internal/services/postgres/postgresql_flexible_server_data_source.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -97,7 +97,7 @@ func dataSourceArmPostgresqlFlexibleServerRead(d *pluginsdk.ResourceData, meta i } d.SetId(id.ID()) - d.Set("name", id.ServerName) + d.Set("name", id.FlexibleServerName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/postgres/postgresql_flexible_server_database_resource.go b/internal/services/postgres/postgresql_flexible_server_database_resource.go index 7be176e223ee..94cf8979c161 100644 --- a/internal/services/postgres/postgresql_flexible_server_database_resource.go +++ b/internal/services/postgres/postgresql_flexible_server_database_resource.go @@ -6,7 +6,7 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" @@ -79,10 +79,10 @@ func resourcePostgresqlFlexibleServerDatabaseCreate(d *pluginsdk.ResourceData, m return err } - id := databases.NewDatabaseID(subscriptionId, serverId.ResourceGroupName, serverId.ServerName, d.Get("name").(string)) + id := databases.NewDatabaseID(subscriptionId, serverId.ResourceGroupName, serverId.FlexibleServerName, d.Get("name").(string)) - locks.ByName(id.ServerName, postgresqlFlexibleServerResourceName) - defer locks.UnlockByName(id.ServerName, postgresqlFlexibleServerResourceName) + locks.ByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) + defer locks.UnlockByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) if d.IsNewResource() { existing, err := client.Get(ctx, id) @@ -132,7 +132,7 @@ func resourcePostgresqlFlexibleServerDatabaseRead(d *pluginsdk.ResourceData, met return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("name", id.DatabaseName) - d.Set("server_id", databases.NewFlexibleServerID(subscriptionId, id.ResourceGroupName, id.ServerName).ID()) + d.Set("server_id", databases.NewFlexibleServerID(subscriptionId, id.ResourceGroupName, id.FlexibleServerName).ID()) if model := resp.Model; model != nil { if props := model.Properties; props != nil { @@ -154,8 +154,8 @@ func resourcePostgresqlFlexibleServerDatabaseDelete(d *pluginsdk.ResourceData, m return err } - locks.ByName(id.ServerName, postgresqlFlexibleServerResourceName) - defer locks.UnlockByName(id.ServerName, postgresqlFlexibleServerResourceName) + locks.ByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) + defer locks.UnlockByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) if err = client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) diff --git a/internal/services/postgres/postgresql_flexible_server_database_resource_test.go b/internal/services/postgres/postgresql_flexible_server_database_resource_test.go index 353a0c5b3e8d..047dcdd456ab 100644 --- a/internal/services/postgres/postgresql_flexible_server_database_resource_test.go +++ b/internal/services/postgres/postgresql_flexible_server_database_resource_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go b/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go index d3e99371be75..e4f6051869c5 100644 --- a/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go +++ b/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go @@ -6,7 +6,7 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" @@ -76,10 +76,10 @@ func resourcePostgresqlFlexibleServerFirewallRuleCreateUpdate(d *pluginsdk.Resou return err } - id := firewallrules.NewFirewallRuleID(subscriptionId, serverId.ResourceGroupName, serverId.ServerName, d.Get("name").(string)) + id := firewallrules.NewFirewallRuleID(subscriptionId, serverId.ResourceGroupName, serverId.FlexibleServerName, d.Get("name").(string)) - locks.ByName(id.ServerName, postgresqlFlexibleServerResourceName) - defer locks.UnlockByName(id.ServerName, postgresqlFlexibleServerResourceName) + locks.ByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) + defer locks.UnlockByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) if d.IsNewResource() { existing, err := client.Get(ctx, id) @@ -129,7 +129,7 @@ func resourcePostgresqlFlexibleServerFirewallRuleRead(d *pluginsdk.ResourceData, return fmt.Errorf("retrieving %q: %+v", id, err) } d.Set("name", id.FirewallRuleName) - d.Set("server_id", firewallrules.NewFlexibleServerID(subscriptionId, id.ResourceGroupName, id.ServerName).ID()) + d.Set("server_id", firewallrules.NewFlexibleServerID(subscriptionId, id.ResourceGroupName, id.FlexibleServerName).ID()) if model := resp.Model; model != nil { d.Set("end_ip_address", model.Properties.EndIPAddress) @@ -148,8 +148,8 @@ func resourcePostgresqlFlexibleServerFirewallRuleDelete(d *pluginsdk.ResourceDat return err } - locks.ByName(id.ServerName, postgresqlFlexibleServerResourceName) - defer locks.UnlockByName(id.ServerName, postgresqlFlexibleServerResourceName) + locks.ByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) + defer locks.UnlockByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) if err = client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %q: %+v", id, err) diff --git a/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource_test.go b/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource_test.go index 80419a2e6aff..ba0259a360c5 100644 --- a/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource_test.go +++ b/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/postgres/postgresql_flexible_server_resource.go b/internal/services/postgres/postgresql_flexible_server_resource.go index ce882527a5c3..01973ce64ae2 100644 --- a/internal/services/postgres/postgresql_flexible_server_resource.go +++ b/internal/services/postgres/postgresql_flexible_server_resource.go @@ -1,20 +1,25 @@ package postgres import ( + "context" "fmt" "log" + "strconv" "strings" "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers" "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -86,10 +91,12 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { "active_directory_auth_enabled": { Type: pluginsdk.TypeBool, Optional: true, + Default: false, }, "password_auth_enabled": { Type: pluginsdk.TypeBool, Optional: true, + Default: true, }, "tenant_id": { Type: pluginsdk.TypeString, @@ -121,7 +128,6 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ForceNew: true, ValidateFunc: validation.StringInSlice(servers.PossibleValuesForServerVersion(), false), }, @@ -130,10 +136,11 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { "create_mode": { Type: pluginsdk.TypeString, Optional: true, - ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ string(servers.CreateModeDefault), string(servers.CreateModePointInTimeRestore), + string(servers.CreateModeReplica), + string(servers.CreateModeUpdate), }, false), }, @@ -224,6 +231,7 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { Required: true, ValidateFunc: validation.StringInSlice([]string{ string(servers.HighAvailabilityModeZoneRedundant), + string(servers.HighAvailabilityModeSameZone), }, false), }, @@ -242,8 +250,72 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { Computed: true, }, + "replication_role": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(servers.ReplicationRoleNone), + }, false), + }, + + "identity": commonschema.SystemAssignedUserAssignedIdentityOptional(), + + "customer_managed_key": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + ForceNew: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "key_vault_key_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: keyVaultValidate.NestedItemIdWithOptionalVersion, + RequiredWith: []string{ + "identity", + "customer_managed_key.0.primary_user_assigned_identity_id", + }, + }, + "primary_user_assigned_identity_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, + }, + }, + }, + }, + "tags": commonschema.Tags(), }, + + CustomizeDiff: pluginsdk.CustomizeDiffShim(func(ctx context.Context, d *pluginsdk.ResourceDiff, v interface{}) error { + createModeVal := d.Get("create_mode").(string) + + if createModeVal == string(servers.CreateModeUpdate) { + oldVersionVal, newVersionVal := d.GetChange("version") + + if oldVersionVal != "" && newVersionVal != "" { + oldVersion, err := strconv.ParseInt(oldVersionVal.(string), 10, 32) + if err != nil { + return err + } + + newVersion, err := strconv.ParseInt(newVersionVal.(string), 10, 32) + if err != nil { + return err + } + + if oldVersion < newVersion { + return nil + } + } + } + + d.ForceNew("create_mode") + d.ForceNew("version") + + return nil + }), } } @@ -270,6 +342,10 @@ func resourcePostgresqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta inte createMode := d.Get("create_mode").(string) + if _, ok := d.GetOk("replication_role"); ok { + return fmt.Errorf("`replication_role` cannot be set while creating") + } + if servers.CreateMode(createMode) == servers.CreateModePointInTimeRestore { if _, ok := d.GetOk("source_server_id"); !ok { return fmt.Errorf("`source_server_id` is required when `create_mode` is `PointInTimeRestore`") @@ -279,6 +355,12 @@ func resourcePostgresqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta inte } } + if servers.CreateMode(createMode) == servers.CreateModeReplica { + if _, ok := d.GetOk("source_server_id"); !ok { + return fmt.Errorf("`source_server_id` is required when `create_mode` is `Replica`") + } + } + if createMode == "" || servers.CreateMode(createMode) == servers.CreateModeDefault { if _, ok := d.GetOk("administrator_login"); !ok { return fmt.Errorf("`administrator_login` is required when `create_mode` is `Default`") @@ -309,6 +391,7 @@ func resourcePostgresqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta inte Storage: expandArmServerStorage(d), HighAvailability: expandFlexibleServerHighAvailability(d.Get("high_availability").([]interface{}), true), Backup: expandArmServerBackup(d), + DataEncryption: expandFlexibleServerDataEncryption(d.Get("customer_managed_key").([]interface{})), }, Sku: sku, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), @@ -353,10 +436,17 @@ func resourcePostgresqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta inte // so we create it with `password_auth_enabled` set to `true`, then set it to `false` in an additional update. if authRaw, ok := d.GetOk("authentication"); ok { authConfig := expandFlexibleServerAuthConfig(authRaw.([]interface{})) - authConfig.PasswordAuthEnabled = utils.Bool(true) + passwordAuthEnabled := servers.PasswordAuthEnumEnabled + authConfig.PasswordAuth = &passwordAuthEnabled parameters.Properties.AuthConfig = authConfig } + identity, err := expandFlexibleServerIdentity(d.Get("identity").([]interface{})) + if err != nil { + return fmt.Errorf("expanding `identity`") + } + parameters.Identity = identity + if err = client.CreateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -365,7 +455,7 @@ func resourcePostgresqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta inte updateProperties := servers.ServerPropertiesForUpdate{} if authRaw, ok := d.GetOk("authentication"); ok { authConfig := expandFlexibleServerAuthConfig(authRaw.([]interface{})) - if !*authConfig.PasswordAuthEnabled { + if authConfig != nil && authConfig.PasswordAuth != nil && *authConfig.PasswordAuth == servers.PasswordAuthEnumDisabled { requireAdditionalUpdate = true updateProperties.AuthConfig = authConfig } @@ -411,7 +501,7 @@ func resourcePostgresqlFlexibleServerRead(d *pluginsdk.ResourceData, meta interf return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.ServerName) + d.Set("name", id.FlexibleServerName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { @@ -423,6 +513,9 @@ func resourcePostgresqlFlexibleServerRead(d *pluginsdk.ResourceData, meta interf d.Set("version", props.Version) d.Set("fqdn", props.FullyQualifiedDomainName) + // Currently, `replicationRole` is set to `Primary` when `createMode` is `Replica` and `replicationRole` is updated to `None`. Service team confirmed it should be set to `None` for this scenario. See more details from https://github.com/Azure/azure-rest-api-specs/issues/22499 + d.Set("replication_role", d.Get("replication_role").(string)) + if network := props.Network; network != nil { publicNetworkAccess := false if network.PublicNetworkAccess != nil { @@ -458,6 +551,22 @@ func resourcePostgresqlFlexibleServerRead(d *pluginsdk.ResourceData, meta interf if props.AuthConfig != nil { d.Set("authentication", flattenFlexibleServerAuthConfig(props.AuthConfig)) } + + cmk, err := flattenFlexibleServerDataEncryption(props.DataEncryption) + if err != nil { + return fmt.Errorf("flattening `customer_managed_key`: %+v", err) + } + if err := d.Set("customer_managed_key", cmk); err != nil { + return fmt.Errorf("setting `customer_managed_key`: %+v", err) + } + + id, err := flattenFlexibleServerIdentity(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + if err := d.Set("identity", id); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } } sku, err := flattenFlexibleServerSku(model.Sku) @@ -527,6 +636,25 @@ func resourcePostgresqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta inte } } + if d.HasChange("replication_role") { + createMode := d.Get("create_mode").(string) + replicationRole := d.Get("replication_role").(string) + if createMode == string(servers.CreateModeReplica) && replicationRole == string(servers.ReplicationRoleNone) { + replicationRole := servers.ReplicationRoleNone + parameters := servers.ServerForUpdate{ + Properties: &servers.ServerPropertiesForUpdate{ + ReplicationRole: &replicationRole, + }, + } + + if err := client.UpdateThenPoll(ctx, *id, parameters); err != nil { + return fmt.Errorf("updating `replication_role` for %s: %+v", *id, err) + } + } else { + return fmt.Errorf("`replication_role` only can be updated to `None` for replica server") + } + } + if d.HasChange("administrator_password") { parameters.Properties.AdministratorLoginPassword = utils.String(d.Get("administrator_password").(string)) } @@ -563,6 +691,28 @@ func resourcePostgresqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta inte parameters.Properties.HighAvailability = expandFlexibleServerHighAvailability(d.Get("high_availability").([]interface{}), false) } + if d.HasChange("customer_managed_key") { + parameters.Properties.DataEncryption = expandFlexibleServerDataEncryption(d.Get("customer_managed_key").([]interface{})) + } + + if d.HasChange("identity") { + identity, err := expandFlexibleServerIdentity(d.Get("identity").([]interface{})) + if err != nil { + return fmt.Errorf("expanding `identity` for Mysql Flexible Server %s (Resource Group %q): %v", id.FlexibleServerName, id.ResourceGroupName, err) + } + parameters.Identity = identity + } + + if d.HasChange("create_mode") { + createMode := servers.CreateModeForUpdate(d.Get("create_mode").(string)) + parameters.Properties.CreateMode = &createMode + } + + if d.HasChange("version") { + version := servers.ServerVersion(d.Get("version").(string)) + parameters.Properties.Version = &version + } + if err = client.UpdateThenPoll(ctx, *id, parameters); err != nil { return fmt.Errorf("updating %s: %+v", id, err) } @@ -570,7 +720,7 @@ func resourcePostgresqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta inte if requireFailover { restartClient := meta.(*clients.Client).Postgres.ServerRestartClient - restartServerId := serverrestart.NewFlexibleServerID(id.SubscriptionId, id.ResourceGroupName, id.ServerName) + restartServerId := serverrestart.NewFlexibleServerID(id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName) failoverMode := serverrestart.FailoverModePlannedFailover restartParameters := serverrestart.RestartParameter{ RestartWithFailover: utils.Bool(true), @@ -780,10 +930,20 @@ func expandFlexibleServerAuthConfig(authRaw []interface{}) *servers.AuthConfig { } authConfigs := authRaw[0].(map[string]interface{}) - out := servers.AuthConfig{ - ActiveDirectoryAuthEnabled: utils.Bool(authConfigs["active_directory_auth_enabled"].(bool)), - PasswordAuthEnabled: utils.Bool(authConfigs["password_auth_enabled"].(bool)), + out := servers.AuthConfig{} + + activeDirectoryAuthEnabled := servers.ActiveDirectoryAuthEnumDisabled + if authConfigs["active_directory_auth_enabled"].(bool) { + activeDirectoryAuthEnabled = servers.ActiveDirectoryAuthEnumEnabled + } + out.ActiveDirectoryAuth = &activeDirectoryAuthEnabled + + passwordAuthEnabled := servers.PasswordAuthEnumDisabled + if authConfigs["password_auth_enabled"].(bool) { + passwordAuthEnabled = servers.PasswordAuthEnumEnabled } + out.PasswordAuth = &passwordAuthEnabled + if tenantId, ok := authConfigs["tenant_id"].(string); ok { out.TenantId = &tenantId } @@ -799,15 +959,15 @@ func flattenFlexibleServerAuthConfig(ac *servers.AuthConfig) interface{} { } aadEnabled := false - if ac.ActiveDirectoryAuthEnabled != nil { - aadEnabled = *ac.ActiveDirectoryAuthEnabled + if ac.ActiveDirectoryAuth != nil { + aadEnabled = *ac.ActiveDirectoryAuth == servers.ActiveDirectoryAuthEnumEnabled } out["active_directory_auth_enabled"] = aadEnabled // It is by design if PasswordAuthEnabled is not returned or undefined, we consider it as true. pwdEnabled := true - if ac.PasswordAuthEnabled != nil { - pwdEnabled = *ac.PasswordAuthEnabled + if ac.PasswordAuth != nil { + pwdEnabled = *ac.PasswordAuth == servers.PasswordAuthEnumEnabled } out["password_auth_enabled"] = pwdEnabled @@ -819,3 +979,76 @@ func flattenFlexibleServerAuthConfig(ac *servers.AuthConfig) interface{} { result = append(result, out) return result } + +func expandFlexibleServerDataEncryption(input []interface{}) *servers.DataEncryption { + if len(input) == 0 { + return nil + } + v := input[0].(map[string]interface{}) + + det := servers.ArmServerKeyTypeAzureKeyVault + dataEncryption := servers.DataEncryption{ + Type: &det, + PrimaryKeyURI: utils.String(v["key_vault_key_id"].(string)), + PrimaryUserAssignedIdentityId: utils.String(v["primary_user_assigned_identity_id"].(string)), + } + + return &dataEncryption +} + +func flattenFlexibleServerDataEncryption(de *servers.DataEncryption) ([]interface{}, error) { + if de == nil || *de.Type != servers.ArmServerKeyTypeAzureKeyVault { + return []interface{}{}, nil + } + + item := map[string]interface{}{} + if de.PrimaryKeyURI != nil { + item["key_vault_key_id"] = *de.PrimaryKeyURI + } + if identity := de.PrimaryUserAssignedIdentityId; identity != nil { + parsed, err := commonids.ParseUserAssignedIdentityIDInsensitively(*identity) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", *identity, err) + } + item["primary_user_assigned_identity_id"] = parsed.ID() + } + + return []interface{}{item}, nil +} + +func expandFlexibleServerIdentity(input []interface{}) (*servers.UserAssignedIdentity, error) { + expanded, err := identity.ExpandUserAssignedMap(input) + if err != nil || expanded.Type != identity.TypeUserAssigned { + return nil, err + } + + idUserAssigned := servers.IdentityTypeUserAssigned + out := servers.UserAssignedIdentity{ + Type: idUserAssigned, + } + if expanded.Type == identity.TypeUserAssigned { + ids := make(map[string]servers.UserIdentity) + for k := range expanded.IdentityIds { + ids[k] = servers.UserIdentity{} + } + out.UserAssignedIdentities = &ids + } + + return &out, nil +} + +func flattenFlexibleServerIdentity(input *servers.UserAssignedIdentity) (*[]interface{}, error) { + var transform *identity.UserAssignedMap + + if input != nil { + transform = &identity.UserAssignedMap{ + Type: identity.Type(string(input.Type)), + IdentityIds: make(map[string]identity.UserAssignedIdentityDetails), + } + for k := range *input.UserAssignedIdentities { + transform.IdentityIds[k] = identity.UserAssignedIdentityDetails{} + } + } + + return identity.FlattenUserAssignedMap(transform) +} diff --git a/internal/services/postgres/postgresql_flexible_server_resource_test.go b/internal/services/postgres/postgresql_flexible_server_resource_test.go index 654fea35ccc6..aab22e9198f1 100644 --- a/internal/services/postgres/postgresql_flexible_server_resource_test.go +++ b/internal/services/postgres/postgresql_flexible_server_resource_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -268,6 +268,75 @@ func TestAccPostgresqlFlexibleServer_authConfig(t *testing.T) { }) } +func TestAccPostgresqlFlexibleServer_createWithCustomerManagedKey(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_postgresql_flexible_server", "test") + r := PostgresqlFlexibleServerResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withCustomerManagedKey(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That("azurerm_postgresql_flexible_server.test").Key("customer_managed_key.0.key_vault_key_id").Exists(), + check.That("azurerm_postgresql_flexible_server.test").Key("customer_managed_key.0.primary_user_assigned_identity_id").Exists(), + ), + }, + data.ImportStep("administrator_password", "create_mode"), + }) +} + +func TestAccPostgresqlFlexibleServer_replica(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_postgresql_flexible_server", "test") + r := PostgresqlFlexibleServerResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("administrator_password", "create_mode"), + { + PreConfig: func() { time.Sleep(15 * time.Minute) }, + Config: r.replica(data), + Check: acceptance.ComposeTestCheckFunc( + check.That("azurerm_postgresql_flexible_server.replica").ExistsInAzure(r), + ), + }, + data.ImportStep("administrator_password", "create_mode"), + { + Config: r.updateReplicationRole(data), + Check: acceptance.ComposeTestCheckFunc( + check.That("azurerm_postgresql_flexible_server.replica").ExistsInAzure(r), + ), + }, + data.ImportStep("administrator_password", "create_mode"), + }) +} + +func TestAccPostgresqlFlexibleServer_upgradeVersion(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_postgresql_flexible_server", "test") + r := PostgresqlFlexibleServerResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("administrator_password", "create_mode"), + { + Config: r.upgradeVersion(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("administrator_password", "create_mode"), + }) +} + func (PostgresqlFlexibleServerResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := servers.ParseFlexibleServerID(state.ID) if err != nil { @@ -668,3 +737,145 @@ resource "azurerm_postgresql_flexible_server" "test" { } `, r.template(data), data.RandomInteger, aadEnabled, pwdEnabled, tenantIdBlock) } + +func (r PostgresqlFlexibleServerResource) cmkTemplate(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features { + key_vault { + purge_soft_delete_on_destroy = false + purge_soft_deleted_keys_on_destroy = false + } + } +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-postgresql-%d" + location = "%s" +} + +resource "azurerm_user_assigned_identity" "test" { + name = "acctestmi%s" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_key_vault" "test" { + name = "acctestkv%s" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + tenant_id = data.azurerm_client_config.current.tenant_id + sku_name = "standard" + purge_protection_enabled = true +} + +resource "azurerm_key_vault_access_policy" "server" { + key_vault_id = azurerm_key_vault.test.id + tenant_id = data.azurerm_client_config.current.tenant_id + object_id = azurerm_user_assigned_identity.test.principal_id + + key_permissions = ["Get", "List", "WrapKey", "UnwrapKey"] +} + +resource "azurerm_key_vault_access_policy" "client" { + key_vault_id = azurerm_key_vault.test.id + tenant_id = data.azurerm_client_config.current.tenant_id + object_id = data.azurerm_client_config.current.object_id + + key_permissions = ["Get", "Create", "Delete", "List", "Restore", "Recover", "UnwrapKey", "WrapKey", "Purge", "Encrypt", "Decrypt", "Sign", "Verify"] +} + +resource "azurerm_key_vault_key" "test" { + name = "test" + key_vault_id = azurerm_key_vault.test.id + key_type = "RSA" + key_size = 2048 + key_opts = ["decrypt", "encrypt", "sign", "unwrapKey", "verify", "wrapKey"] + + depends_on = [ + azurerm_key_vault_access_policy.client, + azurerm_key_vault_access_policy.server, + ] +} +`, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomString) +} + +func (r PostgresqlFlexibleServerResource) withCustomerManagedKey(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_postgresql_flexible_server" "test" { + name = "acctest-fs-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + administrator_login = "adminTerraform" + administrator_password = "QAZwsx123" + storage_mb = 32768 + version = "12" + sku_name = "B_Standard_B1ms" + zone = "1" + + identity { + type = "UserAssigned" + identity_ids = [azurerm_user_assigned_identity.test.id] + } + + customer_managed_key { + key_vault_key_id = azurerm_key_vault_key.test.id + primary_user_assigned_identity_id = azurerm_user_assigned_identity.test.id + } +} +`, r.cmkTemplate(data), data.RandomInteger) +} + +func (r PostgresqlFlexibleServerResource) replica(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_postgresql_flexible_server" "replica" { + name = "acctest-fs-replica-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + zone = "2" + create_mode = "Replica" + source_server_id = azurerm_postgresql_flexible_server.test.id +} +`, r.basic(data), data.RandomInteger) +} + +func (r PostgresqlFlexibleServerResource) updateReplicationRole(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_postgresql_flexible_server" "replica" { + name = "acctest-fs-replica-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + zone = "2" + create_mode = "Replica" + source_server_id = azurerm_postgresql_flexible_server.test.id + replication_role = "None" +} +`, r.basic(data), data.RandomInteger) +} + +func (r PostgresqlFlexibleServerResource) upgradeVersion(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_postgresql_flexible_server" "test" { + name = "acctest-fs-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + administrator_login = "adminTerraform" + administrator_password = "QAZwsx123" + storage_mb = 32768 + create_mode = "Update" + version = "13" + sku_name = "GP_Standard_D2s_v3" + zone = "2" +} +`, r.template(data), data.RandomInteger) +} diff --git a/internal/services/powerbi/powerbi_embedded_resource.go b/internal/services/powerbi/powerbi_embedded_resource.go index 0aea24ded034..b849f9fc3dd1 100644 --- a/internal/services/powerbi/powerbi_embedded_resource.go +++ b/internal/services/powerbi/powerbi_embedded_resource.go @@ -151,7 +151,7 @@ func resourcePowerBIEmbeddedRead(d *pluginsdk.ResourceData, meta interface{}) er return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.DedicatedCapacityName) + d.Set("name", id.CapacityName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/privatedns/private_dns_a_record_data_source.go b/internal/services/privatedns/private_dns_a_record_data_source.go index 10a00a32012f..66b8b0b7abec 100644 --- a/internal/services/privatedns/private_dns_a_record_data_source.go +++ b/internal/services/privatedns/private_dns_a_record_data_source.go @@ -76,7 +76,7 @@ func dataSourcePrivateDnsARecordRead(d *pluginsdk.ResourceData, meta interface{} d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.PrivateZoneName) + d.Set("zone_name", id.PrivateDnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/privatedns/private_dns_a_record_resource.go b/internal/services/privatedns/private_dns_a_record_resource.go index 6945e4e0c7b8..e97b663083e0 100644 --- a/internal/services/privatedns/private_dns_a_record_resource.go +++ b/internal/services/privatedns/private_dns_a_record_resource.go @@ -147,7 +147,7 @@ func resourcePrivateDnsARecordRead(d *pluginsdk.ResourceData, meta interface{}) } d.Set("name", id.RelativeRecordSetName) - d.Set("zone_name", id.PrivateZoneName) + d.Set("zone_name", id.PrivateDnsZoneName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/privatedns/private_dns_aaaa_record_data_source.go b/internal/services/privatedns/private_dns_aaaa_record_data_source.go index 832b1a4bcca1..7ce45d1ea45c 100644 --- a/internal/services/privatedns/private_dns_aaaa_record_data_source.go +++ b/internal/services/privatedns/private_dns_aaaa_record_data_source.go @@ -77,7 +77,7 @@ func dataSourcePrivateDnsAAAARecordRead(d *pluginsdk.ResourceData, meta interfac d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.PrivateZoneName) + d.Set("zone_name", id.PrivateDnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/privatedns/private_dns_aaaa_record_resource.go b/internal/services/privatedns/private_dns_aaaa_record_resource.go index c58eaed50d18..d3967e0cd7a5 100644 --- a/internal/services/privatedns/private_dns_aaaa_record_resource.go +++ b/internal/services/privatedns/private_dns_aaaa_record_resource.go @@ -143,7 +143,7 @@ func resourcePrivateDnsAaaaRecordRead(d *pluginsdk.ResourceData, meta interface{ } d.Set("name", id.RelativeRecordSetName) - d.Set("zone_name", id.PrivateZoneName) + d.Set("zone_name", id.PrivateDnsZoneName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/privatedns/private_dns_cname_record_data_source.go b/internal/services/privatedns/private_dns_cname_record_data_source.go index e934a9ccae2e..c507c48fbe11 100644 --- a/internal/services/privatedns/private_dns_cname_record_data_source.go +++ b/internal/services/privatedns/private_dns_cname_record_data_source.go @@ -79,7 +79,7 @@ func dataSourcePrivateDnsCNameRecordRead(d *pluginsdk.ResourceData, meta interfa d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.PrivateZoneName) + d.Set("zone_name", id.PrivateDnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/privatedns/private_dns_cname_record_resource.go b/internal/services/privatedns/private_dns_cname_record_resource.go index 195a1f7be16d..2d0ec9c9f028 100644 --- a/internal/services/privatedns/private_dns_cname_record_resource.go +++ b/internal/services/privatedns/private_dns_cname_record_resource.go @@ -149,7 +149,7 @@ func resourcePrivateDnsCNameRecordRead(d *pluginsdk.ResourceData, meta interface } d.Set("name", id.RelativeRecordSetName) - d.Set("zone_name", id.PrivateZoneName) + d.Set("zone_name", id.PrivateDnsZoneName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/privatedns/private_dns_mx_record_data_source.go b/internal/services/privatedns/private_dns_mx_record_data_source.go index 74114ebd393f..e915b444e33e 100644 --- a/internal/services/privatedns/private_dns_mx_record_data_source.go +++ b/internal/services/privatedns/private_dns_mx_record_data_source.go @@ -87,7 +87,7 @@ func dataSourcePrivateDnsMxRecordRead(d *pluginsdk.ResourceData, meta interface{ d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.PrivateZoneName) + d.Set("zone_name", id.PrivateDnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/privatedns/private_dns_mx_record_resource.go b/internal/services/privatedns/private_dns_mx_record_resource.go index baacaf37710f..dd0d72d3e0e9 100644 --- a/internal/services/privatedns/private_dns_mx_record_resource.go +++ b/internal/services/privatedns/private_dns_mx_record_resource.go @@ -164,7 +164,7 @@ func resourcePrivateDnsMxRecordRead(d *pluginsdk.ResourceData, meta interface{}) } d.Set("name", id.RelativeRecordSetName) - d.Set("zone_name", id.PrivateZoneName) + d.Set("zone_name", id.PrivateDnsZoneName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/privatedns/private_dns_ptr_record_data_source.go b/internal/services/privatedns/private_dns_ptr_record_data_source.go index 810d513a56d8..cc98c346d7f5 100644 --- a/internal/services/privatedns/private_dns_ptr_record_data_source.go +++ b/internal/services/privatedns/private_dns_ptr_record_data_source.go @@ -76,7 +76,7 @@ func dataSourcePrivateDnsPtrRecordRead(d *pluginsdk.ResourceData, meta interface d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.PrivateZoneName) + d.Set("zone_name", id.PrivateDnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/privatedns/private_dns_ptr_record_resource.go b/internal/services/privatedns/private_dns_ptr_record_resource.go index d931a4f63f71..793fb6bf58b9 100644 --- a/internal/services/privatedns/private_dns_ptr_record_resource.go +++ b/internal/services/privatedns/private_dns_ptr_record_resource.go @@ -147,7 +147,7 @@ func resourcePrivateDnsPtrRecordRead(d *pluginsdk.ResourceData, meta interface{} } d.Set("name", id.RelativeRecordSetName) - d.Set("zone_name", id.PrivateZoneName) + d.Set("zone_name", id.PrivateDnsZoneName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/privatedns/private_dns_soa_record_data_source.go b/internal/services/privatedns/private_dns_soa_record_data_source.go index c04519b9d0a5..ac505add9ff8 100644 --- a/internal/services/privatedns/private_dns_soa_record_data_source.go +++ b/internal/services/privatedns/private_dns_soa_record_data_source.go @@ -103,7 +103,7 @@ func dataSourcePrivateDnsSoaRecordRead(d *pluginsdk.ResourceData, meta interface d.SetId(id.ID()) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.PrivateZoneName) + d.Set("zone_name", id.PrivateDnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/privatedns/private_dns_srv_record_data_source.go b/internal/services/privatedns/private_dns_srv_record_data_source.go index db4e79146ba1..16d463df188e 100644 --- a/internal/services/privatedns/private_dns_srv_record_data_source.go +++ b/internal/services/privatedns/private_dns_srv_record_data_source.go @@ -97,7 +97,7 @@ func dataSourcePrivateDnsSrvRecordRead(d *pluginsdk.ResourceData, meta interface d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.PrivateZoneName) + d.Set("zone_name", id.PrivateDnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/privatedns/private_dns_srv_record_resource.go b/internal/services/privatedns/private_dns_srv_record_resource.go index 24873f3bd753..1eecc723dfd8 100644 --- a/internal/services/privatedns/private_dns_srv_record_resource.go +++ b/internal/services/privatedns/private_dns_srv_record_resource.go @@ -173,7 +173,7 @@ func resourcePrivateDnsSrvRecordRead(d *pluginsdk.ResourceData, meta interface{} } d.Set("name", id.RelativeRecordSetName) - d.Set("zone_name", id.PrivateZoneName) + d.Set("zone_name", id.PrivateDnsZoneName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/privatedns/private_dns_txt_record_data_source.go b/internal/services/privatedns/private_dns_txt_record_data_source.go index 5cd3bcdad28b..4a7f857f4ec7 100644 --- a/internal/services/privatedns/private_dns_txt_record_data_source.go +++ b/internal/services/privatedns/private_dns_txt_record_data_source.go @@ -82,7 +82,7 @@ func dataSourcePrivateDnsTxtRecordRead(d *pluginsdk.ResourceData, meta interface d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.PrivateZoneName) + d.Set("zone_name", id.PrivateDnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/privatedns/private_dns_txt_record_resource.go b/internal/services/privatedns/private_dns_txt_record_resource.go index 60da922cbab5..483616a222e0 100644 --- a/internal/services/privatedns/private_dns_txt_record_resource.go +++ b/internal/services/privatedns/private_dns_txt_record_resource.go @@ -156,7 +156,7 @@ func resourcePrivateDnsTxtRecordRead(d *pluginsdk.ResourceData, meta interface{} d.Set("name", id.RelativeRecordSetName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("zone_name", id.PrivateZoneName) + d.Set("zone_name", id.PrivateDnsZoneName) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/privatedns/private_dns_zone_data_source.go b/internal/services/privatedns/private_dns_zone_data_source.go index a5b6e7bcf457..1aabca0f5dd8 100644 --- a/internal/services/privatedns/private_dns_zone_data_source.go +++ b/internal/services/privatedns/private_dns_zone_data_source.go @@ -81,7 +81,7 @@ func dataSourcePrivateDnsZoneRead(d *pluginsdk.ResourceData, meta interface{}) e } else { resourcesClient := meta.(*clients.Client).Resource.ResourcesClient - zone, err := findPrivateZone(ctx, client, resourcesClient, id.PrivateZoneName) + zone, err := findPrivateZone(ctx, client, resourcesClient, id.PrivateDnsZoneName) if err != nil { return err } @@ -96,7 +96,7 @@ func dataSourcePrivateDnsZoneRead(d *pluginsdk.ResourceData, meta interface{}) e d.SetId(id.ID()) - d.Set("name", id.PrivateZoneName) + d.Set("name", id.PrivateDnsZoneName) d.Set("resource_group_name", id.ResourceGroupName) if props := resp.Properties; props != nil { diff --git a/internal/services/privatedns/private_dns_zone_resource.go b/internal/services/privatedns/private_dns_zone_resource.go index 765e6bb671f6..eeefe5e6ee91 100644 --- a/internal/services/privatedns/private_dns_zone_resource.go +++ b/internal/services/privatedns/private_dns_zone_resource.go @@ -194,9 +194,9 @@ func resourcePrivateDnsZoneCreateUpdate(d *pluginsdk.ResourceData, meta interfac }, } - recordId := recordsets.NewRecordTypeID(id.SubscriptionId, id.ResourceGroupName, id.PrivateZoneName, recordsets.RecordTypeSOA, "@") + recordId := recordsets.NewRecordTypeID(id.SubscriptionId, id.ResourceGroupName, id.PrivateDnsZoneName, recordsets.RecordTypeSOA, "@") - val := fmt.Sprintf("%s%s", id.PrivateZoneName, strings.TrimSuffix(*soaRecord.Email, ".")) + val := fmt.Sprintf("%s%s", id.PrivateDnsZoneName, strings.TrimSuffix(*soaRecord.Email, ".")) if len(val) > 253 { return fmt.Errorf("the value %q for `email` which is concatenated with Private DNS Zone `name` cannot exceed 253 characters excluding a trailing period", val) } @@ -235,13 +235,13 @@ func resourcePrivateDnsZoneRead(d *pluginsdk.ResourceData, meta interface{}) err return fmt.Errorf("retrieving %s: %+v", *id, err) } - recordId := recordsets.NewRecordTypeID(id.SubscriptionId, id.ResourceGroupName, id.PrivateZoneName, recordsets.RecordTypeSOA, "@") + recordId := recordsets.NewRecordTypeID(id.SubscriptionId, id.ResourceGroupName, id.PrivateDnsZoneName, recordsets.RecordTypeSOA, "@") recordSetResp, err := recordSetsClient.Get(ctx, recordId) if err != nil { return fmt.Errorf("reading DNS SOA record @: %v", err) } - d.Set("name", id.PrivateZoneName) + d.Set("name", id.PrivateDnsZoneName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/privatedns/private_dns_zone_virtual_network_link_data_source.go b/internal/services/privatedns/private_dns_zone_virtual_network_link_data_source.go index 41e4789b3b1b..310b1cbc5762 100644 --- a/internal/services/privatedns/private_dns_zone_virtual_network_link_data_source.go +++ b/internal/services/privatedns/private_dns_zone_virtual_network_link_data_source.go @@ -69,7 +69,7 @@ func dataSourcePrivateDnsZoneVirtualNetworkLinkRead(d *pluginsdk.ResourceData, m d.SetId(id.ID()) d.Set("name", id.VirtualNetworkLinkName) - d.Set("private_dns_zone_name", id.PrivateZoneName) + d.Set("private_dns_zone_name", id.PrivateDnsZoneName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/privatedns/private_dns_zone_virtual_network_link_resource.go b/internal/services/privatedns/private_dns_zone_virtual_network_link_resource.go index 0484f8a31af0..9748fefb9896 100644 --- a/internal/services/privatedns/private_dns_zone_virtual_network_link_resource.go +++ b/internal/services/privatedns/private_dns_zone_virtual_network_link_resource.go @@ -140,7 +140,7 @@ func resourcePrivateDnsZoneVirtualNetworkLinkRead(d *pluginsdk.ResourceData, met } d.Set("name", id.VirtualNetworkLinkName) - d.Set("private_dns_zone_name", id.PrivateZoneName) + d.Set("private_dns_zone_name", id.PrivateDnsZoneName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/privatednsresolver/private_dns_resolver_data_source.go b/internal/services/privatednsresolver/private_dns_resolver_data_source.go index 454d62b9abd7..ed2967cd05ce 100644 --- a/internal/services/privatednsresolver/private_dns_resolver_data_source.go +++ b/internal/services/privatednsresolver/private_dns_resolver_data_source.go @@ -5,7 +5,6 @@ import ( "fmt" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/dnsresolvers" @@ -75,19 +74,16 @@ func (r PrivateDNSResolverDnsResolverDataSource) Read() sdk.ResourceFunc { return fmt.Errorf("decoding: %+v", err) } - var top int64 = 1 - resp, err := client.ListByResourceGroupCompleteMatchingPredicate(ctx, - commonids.NewResourceGroupID(metadata.Client.Account.SubscriptionId, state.ResourceGroupName), - dnsresolvers.ListByResourceGroupOperationOptions{Top: &top}, - dnsresolvers.DnsResolverOperationPredicate{Name: &state.Name}) - if err != nil || len(resp.Items) != int(top) { - return fmt.Errorf("retrieving %s: %+v", state.Name, err) + id := dnsresolvers.NewDnsResolverID( + metadata.Client.Account.SubscriptionId, state.ResourceGroupName, state.Name) + resp, err := client.Get(ctx, id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", id, err) } - model := resp.Items[0] - id, err := dnsresolvers.ParseDnsResolverID(*model.Id) - if err != nil { - return err + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) } state.Location = location.Normalize(model.Location) diff --git a/internal/services/privatednsresolver/private_dns_resolver_data_source_test.go b/internal/services/privatednsresolver/private_dns_resolver_data_source_test.go index 8ed38c193864..d402609972fa 100644 --- a/internal/services/privatednsresolver/private_dns_resolver_data_source_test.go +++ b/internal/services/privatednsresolver/private_dns_resolver_data_source_test.go @@ -28,81 +28,13 @@ func TestAccPrivateDNSResolverDnsResolverDataSource_basic(t *testing.T) { }) } -func TestAccPrivateDNSResolverDnsResolverDataSource_complete(t *testing.T) { - data := acceptance.BuildTestData(t, "data.azurerm_private_dns_resolver", "test") - d := PrivateDNSResolverDnsResolverDataSource{} - - data.DataSourceTest(t, []acceptance.TestStep{ - { - Config: d.complete(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).Key("name").Exists(), - check.That(data.ResourceName).Key("resource_group_name").Exists(), - check.That(data.ResourceName).Key("location").HasValue(location.Normalize(data.Locations.Primary)), - check.That(data.ResourceName).Key("virtual_network_id").Exists(), - check.That(data.ResourceName).Key("tags.key").HasValue("value"), - ), - }, - }) -} - -func (d PrivateDNSResolverDnsResolverDataSource) template(data acceptance.TestData) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -resource "azurerm_resource_group" "test" { - name = "acctest-rg-%[2]d" - location = "%[1]s" -} - -resource "azurerm_virtual_network" "test" { - name = "acctest-rg-%[2]d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - address_space = ["10.0.0.0/16"] -} -`, data.Locations.Primary, data.RandomInteger) -} - func (d PrivateDNSResolverDnsResolverDataSource) basic(data acceptance.TestData) string { - template := d.template(data) return fmt.Sprintf(` %s -resource "azurerm_private_dns_resolver" "test" { - name = "acctest-dr-%d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - virtual_network_id = azurerm_virtual_network.test.id -} - -data "azurerm_private_dns_resolver" "test" { - name = azurerm_private_dns_resolver.test.name - resource_group_name = azurerm_resource_group.test.name -} -`, template, data.RandomInteger) -} - -func (d PrivateDNSResolverDnsResolverDataSource) complete(data acceptance.TestData) string { - template := d.template(data) - return fmt.Sprintf(` -%s - -resource "azurerm_private_dns_resolver" "test" { - name = "acctest-dr-%d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - virtual_network_id = azurerm_virtual_network.test.id - tags = { - key = "value" - } -} - data "azurerm_private_dns_resolver" "test" { name = azurerm_private_dns_resolver.test.name resource_group_name = azurerm_resource_group.test.name } -`, template, data.RandomInteger) +`, PrivateDNSResolverDnsResolverResource{}.basic(data)) } diff --git a/internal/services/privatednsresolver/private_dns_resolver_dns_forwarding_ruleset_data_source_test.go b/internal/services/privatednsresolver/private_dns_resolver_dns_forwarding_ruleset_data_source_test.go index d0cd8f765044..7398a6e0445c 100644 --- a/internal/services/privatednsresolver/private_dns_resolver_dns_forwarding_ruleset_data_source_test.go +++ b/internal/services/privatednsresolver/private_dns_resolver_dns_forwarding_ruleset_data_source_test.go @@ -33,8 +33,8 @@ func (d PrivateDNSResolverDnsForwardingRulesetDataSource) basic(data acceptance. %s data "azurerm_private_dns_resolver_dns_forwarding_ruleset" "test" { - name = azurerm_private_dns_resolver_dns_forwarding_ruleset.test.name - resource_group_name = azurerm_resource_group.test.name + name = azurerm_private_dns_resolver_dns_forwarding_ruleset.test.name + resource_group_name = azurerm_resource_group.test.name } `, PrivateDNSResolverDnsForwardingRulesetResource{}.basic(data)) } diff --git a/internal/services/privatednsresolver/private_dns_resolver_forwarding_rule_data_source_test.go b/internal/services/privatednsresolver/private_dns_resolver_forwarding_rule_data_source_test.go index 7cbb634fe56b..0e133cd49c4e 100644 --- a/internal/services/privatednsresolver/private_dns_resolver_forwarding_rule_data_source_test.go +++ b/internal/services/privatednsresolver/private_dns_resolver_forwarding_rule_data_source_test.go @@ -33,8 +33,8 @@ func (d PrivateDNSResolverForwardingRuleDataSource) basic(data acceptance.TestDa %s data "azurerm_private_dns_resolver_forwarding_rule" "test" { - name = azurerm_private_dns_resolver_forwarding_rule.test.name - dns_forwarding_ruleset_id = azurerm_private_dns_resolver_dns_forwarding_ruleset.test.id + name = azurerm_private_dns_resolver_forwarding_rule.test.name + dns_forwarding_ruleset_id = azurerm_private_dns_resolver_dns_forwarding_ruleset.test.id } `, PrivateDNSResolverForwardingRuleResource{}.basic(data)) } diff --git a/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go b/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go index 1a500ec5ce7f..f4f497332075 100644 --- a/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go +++ b/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_data_source_test.go @@ -34,8 +34,8 @@ func (d DNSResolverInboundEndpointDataSource) basic(data acceptance.TestData) st %s data "azurerm_private_dns_resolver_inbound_endpoint" "test" { - name = azurerm_private_dns_resolver_inbound_endpoint.test.name - private_dns_resolver_id = azurerm_private_dns_resolver.test.id + name = azurerm_private_dns_resolver_inbound_endpoint.test.name + private_dns_resolver_id = azurerm_private_dns_resolver.test.id } `, DNSResolverInboundEndpointResource{}.basic(data)) } diff --git a/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_resource.go b/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_resource.go index bc9b0bf77505..3110fd1053b2 100644 --- a/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_resource.go +++ b/internal/services/privatednsresolver/private_dns_resolver_inbound_endpoint_resource.go @@ -11,7 +11,6 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/dnsresolvers" "github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/inboundendpoints" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -278,7 +277,7 @@ func (r PrivateDNSResolverInboundEndpointResource) Delete() sdk.ResourceFunc { } } -func dnsResolverInboundEndpointDeleteRefreshFunc(ctx context.Context, client *inboundendpoints.InboundEndpointsClient, id *inboundendpoints.InboundEndpointId) resource.StateRefreshFunc { +func dnsResolverInboundEndpointDeleteRefreshFunc(ctx context.Context, client *inboundendpoints.InboundEndpointsClient, id *inboundendpoints.InboundEndpointId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { existing, err := client.Get(ctx, *id) if err != nil { diff --git a/internal/services/privatednsresolver/private_dns_resolver_outbound_endpoint_data_source_test.go b/internal/services/privatednsresolver/private_dns_resolver_outbound_endpoint_data_source_test.go index e49edf42c1f7..caf3adec7c2d 100644 --- a/internal/services/privatednsresolver/private_dns_resolver_outbound_endpoint_data_source_test.go +++ b/internal/services/privatednsresolver/private_dns_resolver_outbound_endpoint_data_source_test.go @@ -33,8 +33,8 @@ func (d DNSResolverOutboundEndpointDataSource) basic(data acceptance.TestData) s %s data "azurerm_private_dns_resolver_outbound_endpoint" "test" { - name = azurerm_private_dns_resolver_outbound_endpoint.test.name - private_dns_resolver_id = azurerm_private_dns_resolver.test.id + name = azurerm_private_dns_resolver_outbound_endpoint.test.name + private_dns_resolver_id = azurerm_private_dns_resolver.test.id } `, DNSResolverOutboundEndpointResource{}.basic(data)) } diff --git a/internal/services/privatednsresolver/private_dns_resolver_outbound_endpoint_resource.go b/internal/services/privatednsresolver/private_dns_resolver_outbound_endpoint_resource.go index 585ec1919741..8fa1b2186ceb 100644 --- a/internal/services/privatednsresolver/private_dns_resolver_outbound_endpoint_resource.go +++ b/internal/services/privatednsresolver/private_dns_resolver_outbound_endpoint_resource.go @@ -11,7 +11,6 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/dnsresolvers" "github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/outboundendpoints" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -240,7 +239,7 @@ func (r PrivateDNSResolverOutboundEndpointResource) Delete() sdk.ResourceFunc { } } -func dnsResolverOutboundEndpointDeleteRefreshFunc(ctx context.Context, client *outboundendpoints.OutboundEndpointsClient, id *outboundendpoints.OutboundEndpointId) resource.StateRefreshFunc { +func dnsResolverOutboundEndpointDeleteRefreshFunc(ctx context.Context, client *outboundendpoints.OutboundEndpointsClient, id *outboundendpoints.OutboundEndpointId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { existing, err := client.Get(ctx, *id) if err != nil { diff --git a/internal/services/privatednsresolver/private_dns_resolver_virtual_network_link_data_source_test.go b/internal/services/privatednsresolver/private_dns_resolver_virtual_network_link_data_source_test.go index fc4680723702..261cbc49b734 100644 --- a/internal/services/privatednsresolver/private_dns_resolver_virtual_network_link_data_source_test.go +++ b/internal/services/privatednsresolver/private_dns_resolver_virtual_network_link_data_source_test.go @@ -31,7 +31,7 @@ func (d PrivateDNSResolverVirtualNetworkLinkDataSource) basic(data acceptance.Te %s data "azurerm_private_dns_resolver_virtual_network_link" "test" { - name = azurerm_private_dns_resolver_virtual_network_link.test.name + name = azurerm_private_dns_resolver_virtual_network_link.test.name dns_forwarding_ruleset_id = azurerm_private_dns_resolver_dns_forwarding_ruleset.test.id } `, PrivateDNSResolverVirtualNetworkLinkResource{}.basic(data)) diff --git a/internal/services/recoveryservices/backup_protected_vm_resource.go b/internal/services/recoveryservices/backup_protected_vm_resource.go index 747f127a8d48..a0dfba0a7579 100644 --- a/internal/services/recoveryservices/backup_protected_vm_resource.go +++ b/internal/services/recoveryservices/backup_protected_vm_resource.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "log" + "strconv" "strings" "time" @@ -172,7 +173,7 @@ func resourceRecoveryServicesBackupProtectedVMRead(d *pluginsdk.ResourceData, me func resourceRecoveryServicesBackupProtectedVMDelete(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).RecoveryServices.ProtectedItemsClient - containerClient := meta.(*clients.Client).RecoveryServices.BackupProtectionContainersClient + opResultClient := meta.(*clients.Client).RecoveryServices.BackupOperationResultsClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() @@ -190,7 +191,17 @@ func resourceRecoveryServicesBackupProtectedVMDelete(d *pluginsdk.ResourceData, } } - if _, err := resourceRecoveryServicesBackupProtectedVMWaitForDeletion(ctx, client, containerClient, id.VaultName, id.ResourceGroup, id.ProtectionContainerName, id.Name, d); err != nil { + locationURL, err := resp.Response.Location() + if err != nil || locationURL == nil { + return fmt.Errorf("deleting %s: Location header missing or empty", id) + } + + parsedLocation, err := azure.ParseAzureResourceID(handleAzureSdkForGoBug2824(locationURL.Path)) + if err != nil { + return err + } + + if _, err := resourceRecoveryServicesBackupProtectedVMWaitForDeletion(ctx, client, opResultClient, id.VaultName, id.ResourceGroup, id.ProtectionContainerName, id.Name, parsedLocation.Path["backupOperationResults"], d); err != nil { return err } @@ -221,7 +232,7 @@ func resourceRecoveryServicesBackupProtectedVMWaitForStateCreateUpdate(ctx conte return resp.(backup.ProtectedItemResource), nil } -func resourceRecoveryServicesBackupProtectedVMWaitForDeletion(ctx context.Context, client *backup.ProtectedItemsClient, containerClient *backup.ProtectionContainersClient, vaultName, resourceGroup, containerName, protectedItemName string, d *pluginsdk.ResourceData) (backup.ProtectedItemResource, error) { +func resourceRecoveryServicesBackupProtectedVMWaitForDeletion(ctx context.Context, client *backup.ProtectedItemsClient, opResultClient *backup.OperationResultsClient, vaultName, resourceGroup, containerName, protectedItemName, operationId string, d *pluginsdk.ResourceData) (backup.ProtectedItemResource, error) { state := &pluginsdk.StateChangeConf{ MinTimeout: 30 * time.Second, Delay: 10 * time.Second, @@ -256,31 +267,26 @@ func resourceRecoveryServicesBackupProtectedVMWaitForDeletion(ctx context.Contex return i, fmt.Errorf("waiting for the Azure Backup Protected VM %q to be deleted (Resource Group %q): %+v", protectedItemName, resourceGroup, err) } - // besides waiting for the protected item to be fully deleted, it's also needed to wait for the protection container to be unregistered, or it will fail when creating another backup for the same vm in another recovery vault. - containerState := &pluginsdk.StateChangeConf{ + // we should also wait for the operation to complete, or it will fail when creating a new backup vm with the same vm in different vault immediately. + opState := &pluginsdk.StateChangeConf{ MinTimeout: 30 * time.Second, Delay: 10 * time.Second, - Pending: []string{"Pending"}, - Target: []string{"NotFound"}, + Pending: []string{"202"}, + Target: []string{"200", "204"}, Refresh: func() (interface{}, string, error) { - resp, err := containerClient.Get(ctx, vaultName, resourceGroup, "Azure", containerName) + resp, err := opResultClient.Get(ctx, vaultName, resourceGroup, operationId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return resp, "NotFound", nil - } - - return resp, "Error", fmt.Errorf("making Read request on Azure Backup Protection Container %q (Resource Group %q): %+v", protectedItemName, resourceGroup, err) + return nil, "Error", fmt.Errorf("making Read request on Recovery Service Protected Item operation %q (Vault %q in Resource Group %q): %+v", operationId, vaultName, resourceGroup, err) } - - return resp, "Pending", nil + return resp, strconv.Itoa(resp.StatusCode), err }, Timeout: d.Timeout(pluginsdk.TimeoutDelete), } - _, err = containerState.WaitForStateContext(ctx) + _, err = opState.WaitForStateContext(ctx) if err != nil { - return resp.(backup.ProtectedItemResource), fmt.Errorf("waiting for the Azure Backup Protection Container %q to be deleted (Resource Group %q): %+v", containerName, resourceGroup, err) + return resp.(backup.ProtectedItemResource), fmt.Errorf("waiting for the Recovery Service Protected Item operation %q to be deleted (Resource Group %q): %+v", containerName, resourceGroup, err) } return resp.(backup.ProtectedItemResource), nil diff --git a/internal/services/recoveryservices/client/client.go b/internal/services/recoveryservices/client/client.go index b87b989cf9a6..73529f4765b4 100644 --- a/internal/services/recoveryservices/client/client.go +++ b/internal/services/recoveryservices/client/client.go @@ -1,8 +1,10 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices" // nolint: staticcheck - "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-12-01/backup" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-12-01/backup" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies" @@ -21,9 +23,10 @@ type Client struct { ProtectionContainerOperationResultsClient *backup.ProtectionContainerOperationResultsClient BackupProtectionContainersClient *backup.ProtectionContainersClient BackupOperationStatusesClient *backup.OperationStatusesClient - VaultsClient *recoveryservices.VaultsClient - VaultsConfigsClient *backup.ResourceVaultConfigsClient // Not sure why this is in backup, but https://github.com/Azure/azure-sdk-for-go/issues/7279 - StorageConfigsClient *backup.ResourceStorageConfigsNonCRRClient + BackupOperationResultsClient *backup.OperationResultsClient + VaultsClient *vaults.VaultsClient + VaultsConfigsClient *backupresourcevaultconfigs.BackupResourceVaultConfigsClient + StorageConfigsClient *backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient FabricClient *replicationfabrics.ReplicationFabricsClient ProtectionContainerClient *replicationprotectioncontainers.ReplicationProtectionContainersClient ReplicationPoliciesClient *replicationpolicies.ReplicationPoliciesClient @@ -34,13 +37,13 @@ type Client struct { } func NewClient(o *common.ClientOptions) *Client { - vaultConfigsClient := backup.NewResourceVaultConfigsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + vaultConfigsClient := backupresourcevaultconfigs.NewBackupResourceVaultConfigsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&vaultConfigsClient.Client, o.ResourceManagerAuthorizer) - storageConfigsClient := backup.NewResourceStorageConfigsNonCRRClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + storageConfigsClient := backupresourcestorageconfigsnoncrr.NewBackupResourceStorageConfigsNonCRRClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&storageConfigsClient.Client, o.ResourceManagerAuthorizer) - vaultsClient := recoveryservices.NewVaultsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + vaultsClient := vaults.NewVaultsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&vaultsClient.Client, o.ResourceManagerAuthorizer) protectableItemsClient := backup.NewProtectableItemsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) @@ -61,6 +64,9 @@ func NewClient(o *common.ClientOptions) *Client { backupOperationStatusesClient := backup.NewOperationStatusesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&backupOperationStatusesClient.Client, o.ResourceManagerAuthorizer) + backupOperationResultClient := backup.NewOperationResultsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&backupOperationResultClient.Client, o.ResourceManagerAuthorizer) + backupProtectionContainerOperationResultsClient := backup.NewProtectionContainerOperationResultsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&backupProtectionContainerOperationResultsClient.Client, o.ResourceManagerAuthorizer) @@ -93,6 +99,7 @@ func NewClient(o *common.ClientOptions) *Client { ProtectionContainerOperationResultsClient: &backupProtectionContainerOperationResultsClient, BackupProtectionContainersClient: &backupProtectionContainersClient, BackupOperationStatusesClient: &backupOperationStatusesClient, + BackupOperationResultsClient: &backupOperationResultClient, VaultsClient: &vaultsClient, VaultsConfigsClient: &vaultConfigsClient, StorageConfigsClient: &storageConfigsClient, diff --git a/internal/services/recoveryservices/parse/vault.go b/internal/services/recoveryservices/parse/vault.go deleted file mode 100644 index e9a436b37685..000000000000 --- a/internal/services/recoveryservices/parse/vault.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type VaultId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewVaultID(subscriptionId, resourceGroup, name string) VaultId { - return VaultId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id VaultId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Vault", segmentsStr) -} - -func (id VaultId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// VaultID parses a Vault ID into an VaultId struct -func VaultID(input string) (*VaultId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := VaultId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("vaults"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/recoveryservices/parse/vault_test.go b/internal/services/recoveryservices/parse/vault_test.go deleted file mode 100644 index 69a4bf1c9b17..000000000000 --- a/internal/services/recoveryservices/parse/vault_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = VaultId{} - -func TestVaultIDFormatter(t *testing.T) { - actual := NewVaultID("12345678-1234-9876-4563-123456789012", "group1", "vault1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/vault1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestVaultID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/vault1", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "vault1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.RECOVERYSERVICES/VAULTS/VAULT1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := VaultID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/recoveryservices/recovery_services_vault_data_source.go b/internal/services/recoveryservices/recovery_services_vault_data_source.go index 12e95579cd96..269e453c78bc 100644 --- a/internal/services/recoveryservices/recovery_services_vault_data_source.go +++ b/internal/services/recoveryservices/recovery_services_vault_data_source.go @@ -4,14 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceRecoveryServicesVault() *pluginsdk.Resource { @@ -32,7 +32,7 @@ func dataSourceRecoveryServicesVault() *pluginsdk.Resource { "location": commonschema.LocationComputed(), - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), "sku": { Type: pluginsdk.TypeString, @@ -48,26 +48,31 @@ func dataSourceRecoveryServicesVaultRead(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewVaultID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - vault, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := vaults.NewVaultID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(vault.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } + if resp.Model == nil { + return fmt.Errorf("retrieving %s: `model` was nil", id) + } + model := resp.Model + d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", azure.NormalizeLocation(*vault.Location)) + d.Set("name", id.VaultName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("location", location.Normalize(model.Location)) skuName := "" - if vault.Sku != nil { - skuName = string(vault.Sku.Name) + if model.Sku != nil { + skuName = string(model.Sku.Name) } d.Set("sku", skuName) - return tags.FlattenAndSet(d, vault.Tags) + return tags.FlattenAndSet(d, model.Tags) } diff --git a/internal/services/recoveryservices/recovery_services_vault_hyperv_site_resource.go b/internal/services/recoveryservices/recovery_services_vault_hyperv_site_resource.go new file mode 100644 index 000000000000..9315f603cc63 --- /dev/null +++ b/internal/services/recoveryservices/recovery_services_vault_hyperv_site_resource.go @@ -0,0 +1,155 @@ +package recoveryservices + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type HyperVSiteModel struct { + Name string `tfschema:"name"` + RecoveryVaultId string `tfschema:"recovery_vault_id"` +} + +type HyperVSiteResource struct{} + +var _ sdk.Resource = HyperVSiteResource{} + +func (r HyperVSiteResource) Arguments() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "recovery_vault_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: replicationfabrics.ValidateVaultID, + }, + } +} + +func (r HyperVSiteResource) Attributes() map[string]*schema.Schema { + return map[string]*schema.Schema{} +} + +func (r HyperVSiteResource) ModelObject() interface{} { + return &HyperVSiteModel{} +} + +func (r HyperVSiteResource) ResourceType() string { + return "azurerm_site_recovery_services_vault_hyperv_site" +} + +func (r HyperVSiteResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var metaModel HyperVSiteModel + if err := metadata.Decode(&metaModel); err != nil { + return fmt.Errorf("decoding %s", err) + } + + client := metadata.Client.RecoveryServices.FabricClient + subscriptionId := metadata.Client.Account.SubscriptionId + + vaultId, err := replicationfabrics.ParseVaultID(metaModel.RecoveryVaultId) + if err != nil { + return err + } + + id := replicationfabrics.NewReplicationFabricID(subscriptionId, vaultId.ResourceGroupName, vaultId.VaultName, metaModel.Name) + + type HyperVSiteInstanceType struct { + InstanceType string `json:"instanceType"` + } + + // the instance type `HyperVSite` is not exposed in Swagger, tracked on https://github.com/Azure/azure-rest-api-specs/issues/22016 + parameters := replicationfabrics.FabricCreationInput{ + Properties: &replicationfabrics.FabricCreationInputProperties{ + CustomDetails: HyperVSiteInstanceType{ + InstanceType: "HyperVSite", + }, + }, + } + + err = client.CreateThenPoll(ctx, id, parameters) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r HyperVSiteResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.RecoveryServices.FabricClient + id, err := replicationfabrics.ParseReplicationFabricID(metadata.ResourceData.Id()) + if err != nil { + return fmt.Errorf("parsing %s: %+v", metadata.ResourceData.Id(), err) + } + + resp, err := client.Get(ctx, *id, replicationfabrics.DefaultGetOperationOptions()) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if resp.Model == nil { + return fmt.Errorf("retrieving %s: `model` was nil", id) + } + + state := HyperVSiteModel{ + Name: id.ReplicationFabricName, + } + + vaultId := replicationfabrics.NewVaultID(id.SubscriptionId, id.ResourceGroupName, id.VaultName) + state.RecoveryVaultId = vaultId.ID() + + return metadata.Encode(&state) + }, + } +} + +func (r HyperVSiteResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, // when a host connected to site, it will cost up to 180 minutes to delete. + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.RecoveryServices.FabricClient + id, err := replicationfabrics.ParseReplicationFabricID(metadata.ResourceData.Id()) + if err != nil { + return fmt.Errorf("parsing %s: %+v", metadata.ResourceData.Id(), err) + } + + err = client.DeleteThenPoll(ctx, *id) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + return nil + }, + } +} + +func (r HyperVSiteResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return replicationfabrics.ValidateReplicationFabricID +} diff --git a/internal/services/recoveryservices/recovery_services_vault_hyperv_site_resource_test.go b/internal/services/recoveryservices/recovery_services_vault_hyperv_site_resource_test.go new file mode 100644 index 000000000000..349ec87d41af --- /dev/null +++ b/internal/services/recoveryservices/recovery_services_vault_hyperv_site_resource_test.go @@ -0,0 +1,72 @@ +package recoveryservices_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type HyperVSiteResource struct{} + +func TestAccSiteRecoveryHyperVSite_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_site_recovery_services_vault_hyperv_site", "test") + r := HyperVSiteResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (HyperVSiteResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-recovery-%[1]d" + location = "%s" +} + +resource "azurerm_recovery_services_vault" "test" { + name = "acctest-vault-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "Standard" + + soft_delete_enabled = false +} + +resource "azurerm_site_recovery_services_vault_hyperv_site" "test" { + recovery_vault_id = azurerm_recovery_services_vault.test.id + name = "acctest-site-%[1]d" +} +`, data.RandomInteger, data.Locations.Primary) +} + +func (t HyperVSiteResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := replicationfabrics.ParseReplicationFabricID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.RecoveryServices.FabricClient.Get(ctx, *id, replicationfabrics.DefaultGetOperationOptions()) + if err != nil { + return nil, fmt.Errorf("reading Recovery Service Vault (%s): %+v", id.String(), err) + } + + return utils.Bool(resp.Model != nil), nil +} diff --git a/internal/services/recoveryservices/recovery_services_vault_resource.go b/internal/services/recoveryservices/recovery_services_vault_resource.go index a7cc72f776b3..2f8cacebaec2 100644 --- a/internal/services/recoveryservices/recovery_services_vault_resource.go +++ b/internal/services/recoveryservices/recovery_services_vault_resource.go @@ -7,17 +7,19 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices" // nolint: staticcheck - "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-12-01/backup" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" keyvaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -32,12 +34,12 @@ func resourceRecoveryServicesVault() *pluginsdk.Resource { Delete: resourceRecoveryServicesVaultDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.VaultID(id) + _, err := vaults.ParseVaultID(id) return err }), Timeouts: &pluginsdk.ResourceTimeout{ - Create: pluginsdk.DefaultTimeout(60 * time.Minute), + Create: pluginsdk.DefaultTimeout(120 * time.Minute), Read: pluginsdk.DefaultTimeout(5 * time.Minute), Update: pluginsdk.DefaultTimeout(60 * time.Minute), Delete: pluginsdk.DefaultTimeout(30 * time.Minute), @@ -71,47 +73,59 @@ func resourceRecoveryServicesVault() *pluginsdk.Resource { Type: pluginsdk.TypeBool, Required: true, }, - // We must use system assigned identity for now since recovery vault only support system assigned for now. - // We can remove this property, but in that way when we enable user assigned identity in the future - // , many users might be surprised at update in place. So we use an anonymous function to restrict this value to `true` "use_system_assigned_identity": { Type: pluginsdk.TypeBool, Optional: true, - ValidateFunc: func(i interface{}, s string) ([]string, []error) { - use := i.(bool) - if !use { - return nil, []error{fmt.Errorf(" at this time `use_system_assigned_identity` only support `true`")} - } - return nil, nil - }, - Default: true, + Default: true, + }, + "user_assigned_identity_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, }, }, }, - // TODO: the API for this also supports UserAssigned & SystemAssigned, UserAssigned - "identity": commonschema.SystemAssignedIdentityOptional(), + "identity": commonschema.SystemAssignedUserAssignedIdentityOptional(), + + "public_network_access_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + // set `immutability` to Computed, because it will start to return from the service once it has been set. + "immutability": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + string(vaults.ImmutabilityStateLocked), + string(vaults.ImmutabilityStateUnlocked), + string(vaults.ImmutabilityStateDisabled), + }, false), + }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "sku": { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(recoveryservices.SkuNameRS0), - string(recoveryservices.SkuNameStandard), + string(vaults.SkuNameRSZero), + string(vaults.SkuNameStandard), }, false), }, "storage_mode_type": { Type: pluginsdk.TypeString, Optional: true, - Default: backup.StorageTypeGeoRedundant, + Default: backupresourcestorageconfigsnoncrr.StorageTypeGeoRedundant, ValidateFunc: validation.StringInSlice([]string{ - string(backup.StorageTypeGeoRedundant), - string(backup.StorageTypeLocallyRedundant), - string(backup.StorageTypeZoneRedundant), + string(backupresourcestorageconfigsnoncrr.StorageTypeGeoRedundant), + string(backupresourcestorageconfigsnoncrr.StorageTypeLocallyRedundant), + string(backupresourcestorageconfigsnoncrr.StorageTypeZoneRedundant), }, false), }, @@ -127,6 +141,12 @@ func resourceRecoveryServicesVault() *pluginsdk.Resource { Default: true, }, }, + + CustomizeDiff: pluginsdk.CustomDiffWithAll( + pluginsdk.ForceNewIfChange("cross_region_restore_enabled", func(ctx context.Context, old, new, meta interface{}) bool { + return old.(bool) && !new.(bool) + }), + ), } } @@ -138,13 +158,23 @@ func resourceRecoveryServicesVaultCreate(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewVaultID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := vaults.NewVaultID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + storageId := backupresourcestorageconfigsnoncrr.VaultId{ + SubscriptionId: id.SubscriptionId, + ResourceGroupName: id.ResourceGroupName, + VaultName: id.VaultName, + } + cfgId := backupresourcevaultconfigs.VaultId{ + SubscriptionId: id.SubscriptionId, + ResourceGroupName: id.ResourceGroupName, + VaultName: id.VaultName, + } storageMode := d.Get("storage_mode_type").(string) crossRegionRestore := d.Get("cross_region_restore_enabled").(bool) - if crossRegionRestore && storageMode != string(backup.StorageTypeGeoRedundant) { - return fmt.Errorf("cannot enable cross region restore when storage mode type is not %s. %s", string(backup.StorageTypeGeoRedundant), id.String()) + if crossRegionRestore && storageMode != string(backupresourcestorageconfigsnoncrr.StorageTypeGeoRedundant) { + return fmt.Errorf("cannot enable cross region restore when storage mode type is not %s. %s", string(backupresourcestorageconfigsnoncrr.StorageTypeGeoRedundant), id.String()) } location := d.Get("location").(string) @@ -152,56 +182,58 @@ func resourceRecoveryServicesVaultCreate(d *pluginsdk.ResourceData, meta interfa log.Printf("[DEBUG] Creating Recovery Service %s", id.String()) - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing Recovery Service %s: %+v", id.String(), err) } } - if existing.ID != nil && *existing.ID != "" { - return tf.ImportAsExistsError("azurerm_recovery_services_vault", *existing.ID) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_recovery_services_vault", id.ID()) } - expandedIdentity, err := expandVaultIdentity(d.Get("identity").([]interface{})) + expandedIdentity, err := identity.ExpandSystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } + sku := d.Get("sku").(string) - vault := recoveryservices.Vault{ - Location: utils.String(location), + vault := vaults.Vault{ + Location: location, Tags: tags.Expand(t), Identity: expandedIdentity, - Sku: &recoveryservices.Sku{ - Name: recoveryservices.SkuName(sku), + Sku: &vaults.Sku{ + Name: vaults.SkuName(sku), + }, + Properties: &vaults.VaultProperties{ + PublicNetworkAccess: expandRecoveryServicesVaultPublicNetworkAccess(d.Get("public_network_access_enabled").(bool)), }, - Properties: &recoveryservices.VaultProperties{}, } - if recoveryservices.SkuName(sku) == recoveryservices.SkuNameRS0 { + if vaults.SkuName(sku) == vaults.SkuNameRSZero { vault.Sku.Tier = utils.String("Standard") } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, vault) - if err != nil { - return fmt.Errorf("creating Recovery Service %s: %+v", id.String(), err) + if immutability, ok := d.GetOk("immutability"); ok { + vault.Properties.SecuritySettings = expandRecoveryServicesVaultSecuritySettings(immutability) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %q: %+v", id, err) + + err = client.CreateOrUpdateThenPoll(ctx, id, vault) + if err != nil { + return fmt.Errorf("creating %s: %+v", id.String(), err) } - storageCfg := backup.ResourceConfigResource{ - Properties: &backup.ResourceConfig{ - StorageModelType: backup.StorageType(d.Get("storage_mode_type").(string)), + storageType := backupresourcestorageconfigsnoncrr.StorageType(d.Get("storage_mode_type").(string)) + storageCfg := backupresourcestorageconfigsnoncrr.BackupResourceConfigResource{ + Properties: &backupresourcestorageconfigsnoncrr.BackupResourceConfig{ + StorageModelType: &storageType, CrossRegionRestoreFlag: utils.Bool(d.Get("cross_region_restore_enabled").(bool)), }, } err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { - if resp, err := storageCfgsClient.Update(ctx, id.Name, id.ResourceGroup, storageCfg); err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return pluginsdk.RetryableError(fmt.Errorf("updating Recovery Service Storage Cfg %s: %+v", id.String(), err)) - } - if utils.ResponseWasBadRequest(resp.Response) { + if resp, err := storageCfgsClient.Update(ctx, storageId, storageCfg); err != nil { + if response.WasNotFound(resp.HttpResponse) { return pluginsdk.RetryableError(fmt.Errorf("updating Recovery Service Storage Cfg %s: %+v", id.String(), err)) } @@ -215,14 +247,17 @@ func resourceRecoveryServicesVaultCreate(d *pluginsdk.ResourceData, meta interfa // storage type is not updated instantaneously, so we wait until storage type is correct err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { - if resp, err := storageCfgsClient.Get(ctx, id.Name, id.ResourceGroup); err == nil { - if resp.Properties == nil { + if resp, err := storageCfgsClient.Get(ctx, storageId); err == nil { + if resp.Model == nil { + return pluginsdk.NonRetryableError(fmt.Errorf("updating %s Storage Config: `model` was nil", id)) + } + if resp.Model.Properties == nil { return pluginsdk.NonRetryableError(fmt.Errorf("updating %s Storage Config: `properties` was nil", id)) } - if resp.Properties.StorageType != storageCfg.Properties.StorageModelType { + if *resp.Model.Properties.StorageType != *storageCfg.Properties.StorageModelType { return pluginsdk.RetryableError(fmt.Errorf("updating Storage Config: %+v", err)) } - if *resp.Properties.CrossRegionRestoreFlag != *storageCfg.Properties.CrossRegionRestoreFlag { + if *resp.Model.Properties.CrossRegionRestoreFlag != *storageCfg.Properties.CrossRegionRestoreFlag { return pluginsdk.RetryableError(fmt.Errorf("updating Storage Config: %+v", err)) } } else { @@ -237,39 +272,39 @@ func resourceRecoveryServicesVaultCreate(d *pluginsdk.ResourceData, meta interfa // recovery vault's encryption config cannot be set while creation, so a standalone update is required. if _, ok := d.GetOk("encryption"); ok { - updateFuture, err := client.Update(ctx, id.ResourceGroup, id.Name, recoveryservices.PatchVault{ - Properties: &recoveryservices.VaultProperties{ + err = client.UpdateThenPoll(ctx, id, vaults.PatchVault{ + Properties: &vaults.VaultProperties{ Encryption: expandEncryption(d), }, }) if err != nil { return fmt.Errorf("updating Recovery Service Encryption %s: %+v, but recovery vault was created, a manually import might be required", id.String(), err) } - if err = updateFuture.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update encryption of %s: %+v, but recovery vault was created, a manually import might be required", id.String(), err) - } } // an update on the vault will reset the vault config to default, so we handle it at last. - cfg := backup.ResourceVaultConfigResource{ - Properties: &backup.ResourceVaultConfig{ - EnhancedSecurityState: backup.EnhancedSecurityStateEnabled, // always enabled + enhancedSecurityState := backupresourcevaultconfigs.EnhancedSecurityStateEnabled + cfg := backupresourcevaultconfigs.BackupResourceVaultConfigResource{ + Properties: &backupresourcevaultconfigs.BackupResourceVaultConfig{ + EnhancedSecurityState: &enhancedSecurityState, // always enabled }, } var StateRefreshPendingStrings []string var StateRefreshTargetStrings []string if sd := d.Get("soft_delete_enabled").(bool); sd { - cfg.Properties.SoftDeleteFeatureState = backup.SoftDeleteFeatureStateEnabled - StateRefreshPendingStrings = []string{string(backup.SoftDeleteFeatureStateDisabled)} - StateRefreshTargetStrings = []string{string(backup.SoftDeleteFeatureStateEnabled)} + state := backupresourcevaultconfigs.SoftDeleteFeatureStateEnabled + cfg.Properties.SoftDeleteFeatureState = &state + StateRefreshPendingStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateDisabled)} + StateRefreshTargetStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateEnabled)} } else { - cfg.Properties.SoftDeleteFeatureState = backup.SoftDeleteFeatureStateDisabled - StateRefreshPendingStrings = []string{string(backup.SoftDeleteFeatureStateEnabled)} - StateRefreshTargetStrings = []string{string(backup.SoftDeleteFeatureStateDisabled)} + state := backupresourcevaultconfigs.SoftDeleteFeatureStateDisabled + cfg.Properties.SoftDeleteFeatureState = &state + StateRefreshPendingStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateEnabled)} + StateRefreshTargetStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateDisabled)} } - _, err = cfgsClient.Update(ctx, id.Name, id.ResourceGroup, cfg) + _, err = cfgsClient.Update(ctx, cfgId, cfg) if err != nil { return err } @@ -280,7 +315,7 @@ func resourceRecoveryServicesVaultCreate(d *pluginsdk.ResourceData, meta interfa Target: StateRefreshTargetStrings, MinTimeout: 30 * time.Second, ContinuousTargetOccurence: 3, - Refresh: resourceRecoveryServicesVaultSoftDeleteRefreshFunc(ctx, cfgsClient, id), + Refresh: resourceRecoveryServicesVaultSoftDeleteRefreshFunc(ctx, cfgsClient, cfgId), } stateConf.Timeout = d.Timeout(pluginsdk.TimeoutCreate) @@ -301,60 +336,84 @@ func resourceRecoveryServicesVaultUpdate(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewVaultID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := vaults.NewVaultID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + storageId := backupresourcestorageconfigsnoncrr.VaultId{ + SubscriptionId: id.SubscriptionId, + ResourceGroupName: id.ResourceGroupName, + VaultName: id.VaultName, + } + cfgId := backupresourcevaultconfigs.VaultId{ + SubscriptionId: id.SubscriptionId, + ResourceGroupName: id.ResourceGroupName, + VaultName: id.VaultName, + } encryption := expandEncryption(d) - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { return fmt.Errorf("checking for presence of existing Recovery Service %s: %+v", id.String(), err) } - if existing.Properties != nil && existing.Properties.Encryption != nil { - if encryption == nil { - return fmt.Errorf("once encryption with your own key has been enabled it's not possible to disable it") - } - if encryption.InfrastructureEncryption != existing.Properties.Encryption.InfrastructureEncryption { - return fmt.Errorf("once `infrastructure_encryption_enabled` has been set it's not possible to change it") - } - if d.HasChange("sku") { - // Once encryption has been enabled, calling `CreateOrUpdate` without it is not allowed. - // But `sku` can only be updated by `CreateOrUpdate` and the support for `encryption` in `CreateOrUpdate` is still under preview (https://docs.microsoft.com/azure/backup/encryption-at-rest-with-cmk?tabs=portal#enable-encryption-using-customer-managed-keys-at-vault-creation-in-preview). - // TODO remove this restriction and add `encryption` to below `sku` update block when `encryption` in `CreateOrUpdate` is GA - return fmt.Errorf("`sku` cannot be changed when encryption with your own key has been enabled") - } + if existing.Model == nil { + return fmt.Errorf("checking for presence of existing Recovery Service %s: `model` was nil", id.String()) } + model := existing.Model - storageMode := d.Get("storage_mode_type").(string) - crossRegionRestore := d.Get("cross_region_restore_enabled").(bool) - - if crossRegionRestore && storageMode != string(backup.StorageTypeGeoRedundant) { - return fmt.Errorf("cannot enable cross region restore when storage mode type is not %s. %s", string(backup.StorageTypeGeoRedundant), id.String()) + if model.Properties != nil { + prop := model.Properties + if prop.Encryption != nil { + if encryption == nil { + return fmt.Errorf("once encryption with your own key has been enabled it's not possible to disable it") + } + if *encryption.InfrastructureEncryption != *prop.Encryption.InfrastructureEncryption { + return fmt.Errorf("once `infrastructure_encryption_enabled` has been set it's not possible to change it") + } + if d.HasChange("sku") { + // Once encryption has been enabled, calling `CreateOrUpdate` without it is not allowed. + // But `sku` can only be updated by `CreateOrUpdate` and the support for `encryption` in `CreateOrUpdate` is still under preview (https://docs.microsoft.com/azure/backup/encryption-at-rest-with-cmk?tabs=portal#enable-encryption-using-customer-managed-keys-at-vault-creation-in-preview). + // TODO remove this restriction and add `encryption` to below `sku` update block when `encryption` in `CreateOrUpdate` is GA + return fmt.Errorf("`sku` cannot be changed when encryption with your own key has been enabled") + } + } } - expandedIdentity, err := expandVaultIdentity(d.Get("identity").([]interface{})) + expandedIdentity, err := identity.ExpandSystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } - cfg := backup.ResourceVaultConfigResource{ - Properties: &backup.ResourceVaultConfig{ - EnhancedSecurityState: backup.EnhancedSecurityStateEnabled, // always enabled + if model.Identity != nil && !validateIdentityUpdate(*existing.Model.Identity, *expandedIdentity) { + return fmt.Errorf("`Once `identity` sepcified, the managed identity must not be disabled (even temporarily). Disabling the managed identity may lead to inconsistent behavior. Details could be found on https://learn.microsoft.com/en-us/azure/backup/encryption-at-rest-with-cmk?tabs=portal#enable-system-assigned-managed-identity-for-the-vault") + } + + storageMode := d.Get("storage_mode_type").(string) + crossRegionRestore := d.Get("cross_region_restore_enabled").(bool) + + if crossRegionRestore && storageMode != string(backupresourcestorageconfigsnoncrr.StorageTypeGeoRedundant) { + return fmt.Errorf("cannot enable cross region restore when storage mode type is not %s. %s", string(backupresourcestorageconfigsnoncrr.StorageTypeGeoRedundant), id.String()) + } + + enhanchedSecurityState := backupresourcevaultconfigs.EnhancedSecurityStateEnabled + cfg := backupresourcevaultconfigs.BackupResourceVaultConfigResource{ + Properties: &backupresourcevaultconfigs.BackupResourceVaultConfig{ + EnhancedSecurityState: &enhanchedSecurityState, // always enabled }, } if d.HasChanges("storage_mode_type", "cross_region_restore_enabled") { - storageCfg := backup.ResourceConfigResource{ - Properties: &backup.ResourceConfig{ - StorageModelType: backup.StorageType(storageMode), + storageType := backupresourcestorageconfigsnoncrr.StorageType(storageMode) + storageCfg := backupresourcestorageconfigsnoncrr.BackupResourceConfigResource{ + Properties: &backupresourcestorageconfigsnoncrr.BackupResourceConfig{ + StorageModelType: &storageType, CrossRegionRestoreFlag: utils.Bool(crossRegionRestore), }, } err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutUpdate), func() *pluginsdk.RetryError { - if resp, err := storageCfgsClient.Update(ctx, id.Name, id.ResourceGroup, storageCfg); err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if resp, err := storageCfgsClient.Update(ctx, storageId, storageCfg); err != nil { + if response.WasNotFound(resp.HttpResponse) { return pluginsdk.RetryableError(fmt.Errorf("updating Recovery Service Storage Cfg %s: %+v", id.String(), err)) } - if utils.ResponseWasBadRequest(resp.Response) { + if response.WasBadRequest(resp.HttpResponse) { return pluginsdk.RetryableError(fmt.Errorf("updating Recovery Service Storage Cfg %s: %+v", id.String(), err)) } @@ -368,14 +427,17 @@ func resourceRecoveryServicesVaultUpdate(d *pluginsdk.ResourceData, meta interfa // storage type is not updated instantaneously, so we wait until storage type is correct err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutUpdate), func() *pluginsdk.RetryError { - if resp, err := storageCfgsClient.Get(ctx, id.Name, id.ResourceGroup); err == nil { - if resp.Properties == nil { + if resp, err := storageCfgsClient.Get(ctx, storageId); err == nil { + if resp.Model == nil { + return pluginsdk.NonRetryableError(fmt.Errorf("updating %s Storage Config: `model` was nil", id)) + } + if resp.Model.Properties == nil { return pluginsdk.NonRetryableError(fmt.Errorf("updating %s Storage Config: `properties` was nil", id)) } - if resp.Properties.StorageType != storageCfg.Properties.StorageModelType { + if *resp.Model.Properties.StorageType != *storageCfg.Properties.StorageModelType { return pluginsdk.RetryableError(fmt.Errorf("updating Storage Config: %+v", err)) } - if *resp.Properties.CrossRegionRestoreFlag != *storageCfg.Properties.CrossRegionRestoreFlag { + if *resp.Model.Properties.CrossRegionRestoreFlag != *storageCfg.Properties.CrossRegionRestoreFlag { return pluginsdk.RetryableError(fmt.Errorf("updating Storage Config: %+v", err)) } } else { @@ -392,39 +454,40 @@ func resourceRecoveryServicesVaultUpdate(d *pluginsdk.ResourceData, meta interfa // `sku` can only be updated by `CreateOrUpdate` but not `Update`, so use `CreateOrUpdate` with required and unchangeable properties if d.HasChange("sku") { sku := d.Get("sku").(string) - vault := recoveryservices.Vault{ - Location: utils.String(d.Get("location").(string)), + vault := vaults.Vault{ + Location: d.Get("location").(string), Identity: expandedIdentity, - Sku: &recoveryservices.Sku{ - Name: recoveryservices.SkuName(sku), + Sku: &vaults.Sku{ + Name: vaults.SkuName(sku), + }, + Properties: &vaults.VaultProperties{ + PublicNetworkAccess: expandRecoveryServicesVaultPublicNetworkAccess(d.Get("public_network_access_enabled").(bool)), // It's required to call CreateOrUpdate. }, - Properties: &recoveryservices.VaultProperties{}, } - if recoveryservices.SkuName(sku) == recoveryservices.SkuNameRS0 { + if vaults.SkuName(sku) == vaults.SkuNameRSZero { vault.Sku.Tier = utils.String("Standard") } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, vault) + err = client.CreateOrUpdateThenPoll(ctx, id, vault) if err != nil { return fmt.Errorf("updating Recovery Service %s: %+v", id.String(), err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of %q: %+v", id, err) - } } - vault := recoveryservices.PatchVault{} + vault := vaults.PatchVault{ + Properties: &vaults.VaultProperties{}, + } + + if d.HasChange("public_network_access_enabled") { + vault.Properties.PublicNetworkAccess = expandRecoveryServicesVaultPublicNetworkAccess(d.Get("public_network_access_enabled").(bool)) + } if d.HasChange("identity") { vault.Identity = expandedIdentity } if d.HasChange("encryption") { - if vault.Properties == nil { - vault.Properties = &recoveryservices.VaultProperties{} - } - vault.Properties.Encryption = encryption } @@ -432,28 +495,31 @@ func resourceRecoveryServicesVaultUpdate(d *pluginsdk.ResourceData, meta interfa vault.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) } - updateFuture, err := client.Update(ctx, id.ResourceGroup, id.Name, vault) - if err != nil { - return fmt.Errorf("updating Recovery Service Encryption %s: %+v", id, err) + if d.HasChange("immutability") { + vault.Properties.SecuritySettings = expandRecoveryServicesVaultSecuritySettings(d.Get("immutability")) } - if err = updateFuture.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update encryption of %s: %+v", id, err) + + err = client.UpdateThenPoll(ctx, id, vault) + if err != nil { + return fmt.Errorf("updating %s: %+v", id, err) } // an update on vault will cause the vault config reset to default, so whether the config has change or not, it needs to be updated. var StateRefreshPendingStrings []string var StateRefreshTargetStrings []string if sd := d.Get("soft_delete_enabled").(bool); sd { - cfg.Properties.SoftDeleteFeatureState = backup.SoftDeleteFeatureStateEnabled - StateRefreshPendingStrings = []string{string(backup.SoftDeleteFeatureStateDisabled)} - StateRefreshTargetStrings = []string{string(backup.SoftDeleteFeatureStateEnabled)} + state := backupresourcevaultconfigs.SoftDeleteFeatureStateEnabled + cfg.Properties.SoftDeleteFeatureState = &state + StateRefreshPendingStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateDisabled)} + StateRefreshTargetStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateEnabled)} } else { - cfg.Properties.SoftDeleteFeatureState = backup.SoftDeleteFeatureStateDisabled - StateRefreshPendingStrings = []string{string(backup.SoftDeleteFeatureStateEnabled)} - StateRefreshTargetStrings = []string{string(backup.SoftDeleteFeatureStateDisabled)} + state := backupresourcevaultconfigs.SoftDeleteFeatureStateDisabled + cfg.Properties.SoftDeleteFeatureState = &state + StateRefreshPendingStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateEnabled)} + StateRefreshTargetStrings = []string{string(backupresourcevaultconfigs.SoftDeleteFeatureStateDisabled)} } - _, err = cfgsClient.Update(ctx, id.Name, id.ResourceGroup, cfg) + _, err = cfgsClient.Update(ctx, cfgId, cfg) if err != nil { return err } @@ -465,7 +531,7 @@ func resourceRecoveryServicesVaultUpdate(d *pluginsdk.ResourceData, meta interfa Target: StateRefreshTargetStrings, MinTimeout: 30 * time.Second, ContinuousTargetOccurence: 3, - Refresh: resourceRecoveryServicesVaultSoftDeleteRefreshFunc(ctx, cfgsClient, id), + Refresh: resourceRecoveryServicesVaultSoftDeleteRefreshFunc(ctx, cfgsClient, cfgId), } stateConf.Timeout = d.Timeout(pluginsdk.TimeoutUpdate) @@ -485,16 +551,26 @@ func resourceRecoveryServicesVaultRead(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VaultID(d.Id()) + id, err := vaults.ParseVaultID(d.Id()) if err != nil { return err } + storageId := backupresourcestorageconfigsnoncrr.VaultId{ + SubscriptionId: id.SubscriptionId, + ResourceGroupName: id.ResourceGroupName, + VaultName: id.VaultName, + } + cfgId := backupresourcevaultconfigs.VaultId{ + SubscriptionId: id.SubscriptionId, + ResourceGroupName: id.ResourceGroupName, + VaultName: id.VaultName, + } log.Printf("[DEBUG] Reading Recovery Service %s", id.String()) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -502,45 +578,61 @@ func resourceRecoveryServicesVaultRead(d *pluginsdk.ResourceData, meta interface return fmt.Errorf("making Read request on Recovery Service %s: %+v", id.String(), err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) + if resp.Model == nil { + return fmt.Errorf("recovery Service Vault response %q : model is nil", id.ID()) } + model := resp.Model + + d.Set("name", id.VaultName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("location", location.Normalize(model.Location)) - if sku := resp.Sku; sku != nil { + if sku := model.Sku; sku != nil { d.Set("sku", string(sku.Name)) } - cfg, err := cfgsClient.Get(ctx, id.Name, id.ResourceGroup) + if model.Properties != nil && model.Properties.SecuritySettings != nil && model.Properties.SecuritySettings.ImmutabilitySettings != nil { + d.Set("immutability", *model.Properties.SecuritySettings.ImmutabilitySettings.State) + } + + if model.Properties != nil && model.Properties.PublicNetworkAccess != nil { + d.Set("public_network_access_enabled", flattenRecoveryServicesVaultPublicNetworkAccess(model.Properties.PublicNetworkAccess)) + } + + cfg, err := cfgsClient.Get(ctx, cfgId) if err != nil { return fmt.Errorf("reading Recovery Service Vault Cfg %s: %+v", id.String(), err) } - if props := cfg.Properties; props != nil { - d.Set("soft_delete_enabled", props.SoftDeleteFeatureState == backup.SoftDeleteFeatureStateEnabled) + if cfg.Model != nil && cfg.Model.Properties != nil && cfg.Model.Properties.SoftDeleteFeatureState != nil { + d.Set("soft_delete_enabled", *cfg.Model.Properties.SoftDeleteFeatureState == backupresourcevaultconfigs.SoftDeleteFeatureStateEnabled) } - storageCfg, err := storageCfgsClient.Get(ctx, id.Name, id.ResourceGroup) + storageCfg, err := storageCfgsClient.Get(ctx, storageId) if err != nil { return fmt.Errorf("reading Recovery Service storage Cfg %s: %+v", id.String(), err) } - if props := storageCfg.Properties; props != nil { - d.Set("storage_mode_type", string(props.StorageModelType)) + if storageCfg.Model != nil && storageCfg.Model.Properties != nil { + props := storageCfg.Model.Properties + d.Set("storage_mode_type", props.StorageModelType) d.Set("cross_region_restore_enabled", props.CrossRegionRestoreFlag) } - if err := d.Set("identity", flattenVaultIdentity(resp.Identity)); err != nil { + flattenIdentity, err := identity.FlattenSystemAndUserAssignedMap(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + if err := d.Set("identity", flattenIdentity); err != nil { return fmt.Errorf("setting `identity`: %+v", err) } - encryption := flattenVaultEncryption(resp) + encryption := flattenVaultEncryption(*model) if encryption != nil { d.Set("encryption", []interface{}{encryption}) } - return tags.FlattenAndSet(d, resp.Tags) + return tags.FlattenAndSet(d, model.Tags) } func resourceRecoveryServicesVaultDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -548,53 +640,57 @@ func resourceRecoveryServicesVaultDelete(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VaultID(d.Id()) + id, err := vaults.ParseVaultID(d.Id()) if err != nil { return err } log.Printf("[DEBUG] Deleting Recovery Service %s", id.String()) - resp, err := client.Delete(ctx, id.ResourceGroup, id.Name) + _, err = client.Delete(ctx, *id) if err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("issuing delete request for Recovery Service %s: %+v", id.String(), err) - } + return fmt.Errorf("deleting %s: %+v", id.String(), err) } return nil } -func expandVaultIdentity(input []interface{}) (*recoveryservices.IdentityData, error) { - expanded, err := identity.ExpandSystemAssigned(input) - if err != nil { - return nil, err - } - - return &recoveryservices.IdentityData{ - Type: recoveryservices.ResourceIdentityType(string(expanded.Type)), - }, nil -} - -func flattenVaultIdentity(input *recoveryservices.IdentityData) []interface{} { - var transition *identity.SystemAssigned - - if input != nil { - transition = &identity.SystemAssigned{ - Type: identity.Type(string(input.Type)), +func validateIdentityUpdate(origin identity.SystemAndUserAssignedMap, target identity.SystemAndUserAssignedMap) bool { + switch origin.Type { + case identity.TypeSystemAssigned: + switch target.Type { + case identity.TypeNone: + return false + case identity.TypeUserAssigned: + return false + default: + return true } - if input.PrincipalID != nil { - transition.PrincipalId = *input.PrincipalID + case identity.TypeUserAssigned: + switch target.Type { + case identity.TypeNone: + return false + case identity.TypeSystemAssigned: + return false + default: + return true } - if input.TenantID != nil { - transition.TenantId = *input.TenantID + case identity.TypeSystemAssignedUserAssigned: + switch target.Type { + case identity.TypeNone: + return false + case identity.TypeSystemAssigned: + return false + case identity.TypeUserAssigned: + return false + default: + return true } } - - return identity.FlattenSystemAssigned(transition) + return true } -func expandEncryption(d *pluginsdk.ResourceData) *recoveryservices.VaultPropertiesEncryption { +func expandEncryption(d *pluginsdk.ResourceData) *vaults.VaultPropertiesEncryption { encryptionRaw := d.Get("encryption") if encryptionRaw == nil { return nil @@ -606,28 +702,31 @@ func expandEncryption(d *pluginsdk.ResourceData) *recoveryservices.VaultProperti encryptionMap := settings[0].(map[string]interface{}) keyUri := encryptionMap["key_id"].(string) enabledInfraEncryption := encryptionMap["infrastructure_encryption_enabled"].(bool) - infraEncryptionState := recoveryservices.InfrastructureEncryptionStateEnabled + infraEncryptionState := vaults.InfrastructureEncryptionStateEnabled if !enabledInfraEncryption { - infraEncryptionState = recoveryservices.InfrastructureEncryptionStateDisabled + infraEncryptionState = vaults.InfrastructureEncryptionStateDisabled } - encryption := &recoveryservices.VaultPropertiesEncryption{ - KeyVaultProperties: &recoveryservices.CmkKeyVaultProperties{ - KeyURI: utils.String(keyUri), + encryption := &vaults.VaultPropertiesEncryption{ + KeyVaultProperties: &vaults.CmkKeyVaultProperties{ + KeyUri: utils.String(keyUri), }, - KekIdentity: &recoveryservices.CmkKekIdentity{ + KekIdentity: &vaults.CmkKekIdentity{ UseSystemAssignedIdentity: utils.Bool(encryptionMap["use_system_assigned_identity"].(bool)), }, - InfrastructureEncryption: infraEncryptionState, + InfrastructureEncryption: &infraEncryptionState, + } + if v, ok := encryptionMap["user_assigned_identity_id"].(string); ok && v != "" { + encryption.KekIdentity.UserAssignedIdentity = utils.String(v) } return encryption } -func flattenVaultEncryption(resp recoveryservices.Vault) interface{} { - if resp.Properties == nil || resp.Properties.Encryption == nil { +func flattenVaultEncryption(model vaults.Vault) interface{} { + if model.Properties == nil || model.Properties.Encryption == nil { return nil } - encryption := resp.Properties.Encryption - if encryption.KeyVaultProperties == nil || encryption.KeyVaultProperties.KeyURI == nil { + encryption := model.Properties.Encryption + if encryption.KeyVaultProperties == nil || encryption.KeyVaultProperties.KeyUri == nil { return nil } if encryption.KekIdentity == nil || encryption.KekIdentity.UseSystemAssignedIdentity == nil { @@ -635,15 +734,45 @@ func flattenVaultEncryption(resp recoveryservices.Vault) interface{} { } encryptionMap := make(map[string]interface{}) - encryptionMap["key_id"] = encryption.KeyVaultProperties.KeyURI + encryptionMap["key_id"] = encryption.KeyVaultProperties.KeyUri encryptionMap["use_system_assigned_identity"] = *encryption.KekIdentity.UseSystemAssignedIdentity - encryptionMap["infrastructure_encryption_enabled"] = encryption.InfrastructureEncryption == recoveryservices.InfrastructureEncryptionStateEnabled + encryptionMap["infrastructure_encryption_enabled"] = *encryption.InfrastructureEncryption == vaults.InfrastructureEncryptionStateEnabled + if encryption.KekIdentity.UserAssignedIdentity != nil { + encryptionMap["user_assigned_identity_id"] = *encryption.KekIdentity.UserAssignedIdentity + } return encryptionMap } -func resourceRecoveryServicesVaultSoftDeleteRefreshFunc(ctx context.Context, cfgsClient *backup.ResourceVaultConfigsClient, id parse.VaultId) pluginsdk.StateRefreshFunc { +func expandRecoveryServicesVaultSecuritySettings(input interface{}) *vaults.SecuritySettings { + if input == nil || len(input.(string)) == 0 { + return nil + } + immutabilityState := vaults.ImmutabilityState(input.(string)) + return &vaults.SecuritySettings{ + ImmutabilitySettings: &vaults.ImmutabilitySettings{ + State: &immutabilityState, + }, + } +} + +func expandRecoveryServicesVaultPublicNetworkAccess(input bool) *vaults.PublicNetworkAccess { + out := vaults.PublicNetworkAccessDisabled + if input { + out = vaults.PublicNetworkAccessEnabled + } + return &out +} + +func flattenRecoveryServicesVaultPublicNetworkAccess(input *vaults.PublicNetworkAccess) bool { + if input == nil { + return false + } + return *input == vaults.PublicNetworkAccessEnabled +} + +func resourceRecoveryServicesVaultSoftDeleteRefreshFunc(ctx context.Context, cfgsClient *backupresourcevaultconfigs.BackupResourceVaultConfigsClient, id backupresourcevaultconfigs.VaultId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - resp, err := cfgsClient.Get(ctx, id.Name, id.ResourceGroup) + resp, err := cfgsClient.Get(ctx, id) if err != nil { if strings.Contains(err.Error(), "ResourceNotYetSynced") { return resp, "syncing", nil @@ -651,9 +780,10 @@ func resourceRecoveryServicesVaultSoftDeleteRefreshFunc(ctx context.Context, cfg return resp, "error", fmt.Errorf("refreshing Recovery Service Vault Cfg %s: %+v", id.String(), err) } - if resp.Properties != nil { - return resp, string(resp.Properties.SoftDeleteFeatureState), nil + if resp.Model != nil && resp.Model.Properties != nil && resp.Model.Properties.SoftDeleteFeatureState != nil { + return resp.Model, string(*resp.Model.Properties.SoftDeleteFeatureState), nil } + return resp, "error", fmt.Errorf("refreshing Recovery Service Vault Cfg %s: Properties is nil", id.String()) } } diff --git a/internal/services/recoveryservices/recovery_services_vault_resource_test.go b/internal/services/recoveryservices/recovery_services_vault_resource_test.go index 12f8f102f0a1..43dc24e46dfc 100644 --- a/internal/services/recoveryservices/recovery_services_vault_resource_test.go +++ b/internal/services/recoveryservices/recovery_services_vault_resource_test.go @@ -6,10 +6,10 @@ import ( "regexp" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -32,19 +32,35 @@ func TestAccRecoveryServicesVault_basic(t *testing.T) { }) } -func TestAccRecoveryServicesVault_basicWithCrossRegionRestore(t *testing.T) { +func TestAccRecoveryServicesVault_ToggleCrossRegionRestore(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_recovery_services_vault", "test") r := RecoveryServicesVaultResource{} data.ResourceTest(t, r, []acceptance.TestStep{ { - Config: r.basicWithCrossRegionRestore(data), + Config: r.basicWithCrossRegionRestore(data, false), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("cross_region_restore_enabled").HasValue("false"), + ), + }, + data.ImportStep(), + { + Config: r.basicWithCrossRegionRestore(data, true), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("cross_region_restore_enabled").HasValue("true"), ), }, data.ImportStep(), + { + Config: r.basicWithCrossRegionRestore(data, false), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("cross_region_restore_enabled").HasValue("false"), + ), + }, + data.ImportStep(), }) } @@ -139,7 +155,7 @@ func TestAccRecoveryServicesVault_requiresImport(t *testing.T) { }) } -func TestAccRecoveryServicesVault_identity(t *testing.T) { +func TestAccRecoveryServicesVault_SystemAssignedIdentity(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_recovery_services_vault", "test") r := RecoveryServicesVaultResource{} @@ -151,6 +167,36 @@ func TestAccRecoveryServicesVault_identity(t *testing.T) { ), }, data.ImportStep(), + }) +} + +func TestAccRecoveryServicesVault_UserAssignedIdentity(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_recovery_services_vault", "test") + r := RecoveryServicesVaultResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basicWithUserAssignedIdentity(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccRecoveryServicesVault_immutability(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_recovery_services_vault", "test") + r := RecoveryServicesVaultResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basicWithImmutability(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), { Config: r.basic(data), Check: acceptance.ComposeTestCheckFunc( @@ -159,7 +205,7 @@ func TestAccRecoveryServicesVault_identity(t *testing.T) { }, data.ImportStep(), { - Config: r.basicWithIdentity(data), + Config: r.basicWithImmutability(data, false), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), @@ -291,17 +337,17 @@ func TestAccRecoveryServicesVault_updateSkuWithExistingEncryption(t *testing.T) } func (t RecoveryServicesVaultResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.VaultID(state.ID) + id, err := vaults.ParseVaultID(state.ID) if err != nil { return nil, err } - resp, err := clients.RecoveryServices.VaultsClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := clients.RecoveryServices.VaultsClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("reading Recovery Service (%s): %+v", id.String(), err) } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil), nil } func TestAccRecoveryServicesVault_encryptionWithKeyVaultKey(t *testing.T) { @@ -398,6 +444,50 @@ func TestAccRecoveryServicesVault_switchEncryptionKeyVaultKey(t *testing.T) { }) } +func TestAccRecoveryServicesVault_encryptionWithUserAssignedIdentity(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_recovery_services_vault", "test") + r := RecoveryServicesVaultResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.cmkEncryptionWithUserAssignedIdentity(data, false, 0), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccRecoveryServicesVault_TogglePublicNetworkAccessEnabled(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_recovery_services_vault", "test") + r := RecoveryServicesVaultResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basicWithPublicNetworkAccessEnabled(data, false), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.basicWithPublicNetworkAccessEnabled(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.basicWithPublicNetworkAccessEnabled(data, false), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func (RecoveryServicesVaultResource) basic(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { @@ -420,7 +510,30 @@ resource "azurerm_recovery_services_vault" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } -func (RecoveryServicesVaultResource) basicWithCrossRegionRestore(data acceptance.TestData) string { +func (RecoveryServicesVaultResource) basicWithPublicNetworkAccessEnabled(data acceptance.TestData, enabled bool) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-recovery-%d" + location = "%s" +} + +resource "azurerm_recovery_services_vault" "test" { + name = "acctest-Vault-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "Standard" + public_network_access_enabled = %t + + soft_delete_enabled = false +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, enabled) +} + +func (RecoveryServicesVaultResource) basicWithCrossRegionRestore(data acceptance.TestData, enable bool) string { return fmt.Sprintf(` provider "azurerm" { features {} @@ -437,11 +550,11 @@ resource "azurerm_recovery_services_vault" "test" { resource_group_name = azurerm_resource_group.test.name sku = "Standard" - cross_region_restore_enabled = true + cross_region_restore_enabled = %v soft_delete_enabled = false } -`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, enable) } func (RecoveryServicesVaultResource) basicWithCrossRegionRestoreAndWrongStorageType(data acceptance.TestData) string { @@ -497,6 +610,69 @@ resource "azurerm_recovery_services_vault" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } +func (RecoveryServicesVaultResource) basicWithUserAssignedIdentity(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_user_assigned_identity" "test" { + name = "acctest-uai-%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-recovery-%[1]d" + location = "%[2]s" +} + +resource "azurerm_recovery_services_vault" "test" { + name = "acctest-Vault-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "Standard" + + identity { + type = "UserAssigned" + identity_ids = [ + azurerm_user_assigned_identity.test.id, + ] + } + + soft_delete_enabled = false +} +`, data.RandomInteger, data.Locations.Primary) +} + +func (RecoveryServicesVaultResource) basicWithImmutability(data acceptance.TestData, enabled bool) string { + immutability := `Disabled` + if enabled { + immutability = `Unlocked` + } + + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-recovery-%d" + location = "%s" +} + +resource "azurerm_recovery_services_vault" "test" { + name = "acctest-Vault-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "Standard" + immutability = "%s" + + soft_delete_enabled = false +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, immutability) +} + func (RecoveryServicesVaultResource) complete(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { @@ -625,6 +801,115 @@ resource "azurerm_key_vault_key" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomString, enableInfraEncryptionState, keyIndex) } +func (r RecoveryServicesVaultResource) cmkEncryptionWithUserAssignedIdentity(data acceptance.TestData, enableInfraEncryptionState bool, keyIndex int) string { + return fmt.Sprintf(` +provider "azurerm" { + features { + key_vault { + purge_soft_delete_on_destroy = true + purge_soft_deleted_keys_on_destroy = false + } + } +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-recovery-%[1]d" + location = "%[2]s" +} + +resource "azurerm_user_assigned_identity" "test" { + name = "acctest-identity-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_recovery_services_vault" "test" { + name = "acctest-Vault-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "Standard" + + soft_delete_enabled = true + + identity { + type = "UserAssigned" + identity_ids = [azurerm_user_assigned_identity.test.id] + } + + encryption { + key_id = azurerm_key_vault_key.test[%[5]d].id + use_system_assigned_identity = false + user_assigned_identity_id = azurerm_user_assigned_identity.test.id + infrastructure_encryption_enabled = %[4]t + } +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_key_vault" "test" { + name = "acctest-key-vault-%[3]s" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + enabled_for_disk_encryption = true + tenant_id = data.azurerm_client_config.current.tenant_id + soft_delete_retention_days = 7 + purge_protection_enabled = false + + sku_name = "standard" + + access_policy { + tenant_id = data.azurerm_client_config.current.tenant_id + object_id = data.azurerm_client_config.current.object_id + + key_permissions = [ + "Create", + "Decrypt", + "Encrypt", + "Delete", + "Get", + "List", + "Purge", + "UnwrapKey", + "WrapKey", + "Verify", + ] + secret_permissions = [ + "Set", + ] + } + + access_policy { + tenant_id = data.azurerm_client_config.current.tenant_id + object_id = azurerm_user_assigned_identity.test.principal_id + + key_permissions = [ + "Get", + "List", + "WrapKey", + "UnwrapKey", + ] + } +} + +resource "azurerm_key_vault_key" "test" { + count = 2 + name = "acctest-key-vault-key-%[1]d${count.index}" + key_vault_id = azurerm_key_vault.test.id + key_type = "RSA" + key_size = 2048 + + key_opts = [ + "decrypt", + "encrypt", + "sign", + "unwrapKey", + "verify", + "wrapKey", + ] +} +`, data.RandomInteger, data.Locations.Primary, data.RandomString, enableInfraEncryptionState, keyIndex) +} + func (RecoveryServicesVaultResource) zrs(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/recoveryservices/registration.go b/internal/services/recoveryservices/registration.go index d8ec8352fe30..757cdfa88314 100644 --- a/internal/services/recoveryservices/registration.go +++ b/internal/services/recoveryservices/registration.go @@ -17,12 +17,16 @@ func (r Registration) AssociatedGitHubLabel() string { } func (r Registration) DataSources() []sdk.DataSource { - return []sdk.DataSource{} + return []sdk.DataSource{ + SiteRecoveryReplicationRecoveryPlanDataSource{}, + } } func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ BackupProtectionPolicyVMWorkloadResource{}, + SiteRecoveryReplicationRecoveryPlanResource{}, + HyperVSiteResource{}, } } diff --git a/internal/services/recoveryservices/resourceids.go b/internal/services/recoveryservices/resourceids.go index e03d943bb2b6..c01e77c164e2 100644 --- a/internal/services/recoveryservices/resourceids.go +++ b/internal/services/recoveryservices/resourceids.go @@ -9,4 +9,3 @@ package recoveryservices //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ProtectionContainer -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/vault1/backupFabrics/fabric1/protectionContainers/container1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=BackupPolicy -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/vault1/backupPolicies/policy1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ProtectedItem -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/vault1/backupFabrics/Azure/protectionContainers/container1/protectedItems/protectedItem1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Vault -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/vault1 diff --git a/internal/services/recoveryservices/site_recovery_fabric_data_source.go b/internal/services/recoveryservices/site_recovery_fabric_data_source.go index a20f7b5b8a23..830af64b4c83 100644 --- a/internal/services/recoveryservices/site_recovery_fabric_data_source.go +++ b/internal/services/recoveryservices/site_recovery_fabric_data_source.go @@ -63,9 +63,9 @@ func dataSourceSiteRecoveryFabricRead(d *pluginsdk.ResourceData, meta interface{ } d.SetId(id.ID()) - d.Set("name", id.FabricName) + d.Set("name", id.ReplicationFabricName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("recovery_vault_name", id.ResourceName) + d.Set("recovery_vault_name", id.VaultName) normalizedLocation := "" if l := model.Location; l != nil { diff --git a/internal/services/recoveryservices/site_recovery_fabric_resource.go b/internal/services/recoveryservices/site_recovery_fabric_resource.go index e5de59900f42..5ff25ffdf8ad 100644 --- a/internal/services/recoveryservices/site_recovery_fabric_resource.go +++ b/internal/services/recoveryservices/site_recovery_fabric_resource.go @@ -22,7 +22,6 @@ func resourceSiteRecoveryFabric() *pluginsdk.Resource { return &pluginsdk.Resource{ Create: resourceSiteRecoveryFabricCreate, Read: resourceSiteRecoveryFabricRead, - Update: nil, Delete: resourceSiteRecoveryFabricDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.ReplicationFabricID(id) @@ -121,18 +120,22 @@ func resourceSiteRecoveryFabricRead(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("making read request on site recovery fabric %s: %+v", id.String(), err) } - model := resp.Model - if model == nil { - return fmt.Errorf("making read request on site recovery fabric %s: model is nil", id.String()) - } - - d.Set("name", model.Name) + d.Set("name", id.ReplicationFabricName) d.Set("resource_group_name", id.ResourceGroupName) - if model.Properties.CustomDetails != nil { - loc := *model.Properties.CustomDetails.(replicationfabrics.AzureFabricSpecificDetails).Location - d.Set("location", location.Normalize(loc)) + d.Set("recovery_vault_name", id.VaultName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + if details := props.CustomDetails; details != nil { + fabric, ok := details.(replicationfabrics.AzureFabricSpecificDetails) + if !ok { + return fmt.Errorf("expected `details` to be an AzureFabricSpecificDetails but it wasn't: %+v", details) + } + d.Set("location", location.NormalizeNilable(fabric.Location)) + } + } } - d.Set("recovery_vault_name", id.ResourceName) + return nil } @@ -146,9 +149,8 @@ func resourceSiteRecoveryFabricDelete(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - err = client.DeleteThenPoll(ctx, *id) - if err != nil { - return fmt.Errorf("deleting site recovery fabric %s : %+v", id.String(), err) + if err = client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } return nil diff --git a/internal/services/recoveryservices/site_recovery_network_mapping_resource.go b/internal/services/recoveryservices/site_recovery_network_mapping_resource.go index 9601ca92bf9e..c5199db73c9b 100644 --- a/internal/services/recoveryservices/site_recovery_network_mapping_resource.go +++ b/internal/services/recoveryservices/site_recovery_network_mapping_resource.go @@ -161,9 +161,9 @@ func resourceSiteRecoveryNetworkMappingRead(d *pluginsdk.ResourceData, meta inte model := resp.Model d.Set("resource_group_name", id.ResourceGroupName) - d.Set("recovery_vault_name", id.ResourceName) - d.Set("source_recovery_fabric_name", id.FabricName) - d.Set("name", id.NetworkMappingName) + d.Set("recovery_vault_name", id.VaultName) + d.Set("source_recovery_fabric_name", id.ReplicationFabricName) + d.Set("name", id.ReplicationNetworkMappingName) if props := model.Properties; props != nil { d.Set("source_network_id", props.PrimaryNetworkId) d.Set("target_network_id", props.RecoveryNetworkId) diff --git a/internal/services/recoveryservices/site_recovery_protection_container_data_source.go b/internal/services/recoveryservices/site_recovery_protection_container_data_source.go index 0b0bedab8add..827bac49eef2 100644 --- a/internal/services/recoveryservices/site_recovery_protection_container_data_source.go +++ b/internal/services/recoveryservices/site_recovery_protection_container_data_source.go @@ -61,10 +61,10 @@ func dataSourceSiteRecoveryProtectionContainerRead(d *pluginsdk.ResourceData, me } d.SetId(handleAzureSdkForGoBug2824(id.ID())) - d.Set("name", id.ProtectionContainerName) + d.Set("name", id.ReplicationProtectionContainerName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("recovery_vault_name", id.ResourceName) - d.Set("recovery_fabric_name", id.FabricName) + d.Set("recovery_vault_name", id.VaultName) + d.Set("recovery_fabric_name", id.ReplicationFabricName) return nil } diff --git a/internal/services/recoveryservices/site_recovery_protection_container_mapping_resource.go b/internal/services/recoveryservices/site_recovery_protection_container_mapping_resource.go index 4519c9280c67..0ee3055f411c 100644 --- a/internal/services/recoveryservices/site_recovery_protection_container_mapping_resource.go +++ b/internal/services/recoveryservices/site_recovery_protection_container_mapping_resource.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -22,7 +23,7 @@ func resourceSiteRecoveryProtectionContainerMapping() *pluginsdk.Resource { return &pluginsdk.Resource{ Create: resourceSiteRecoveryContainerMappingCreate, Read: resourceSiteRecoveryContainerMappingRead, - Update: nil, + Update: resourceSiteRecoveryContainerMappingUpdate, Delete: resourceSiteRecoveryServicesContainerMappingDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.ReplicationProtectionContainerMappingsID(id) @@ -77,6 +78,28 @@ func resourceSiteRecoveryProtectionContainerMapping() *pluginsdk.Resource { ValidateFunc: azure.ValidateResourceID, DiffSuppressFunc: suppress.CaseDifference, }, + "automatic_update": { + Type: pluginsdk.TypeList, + MinItems: 1, + MaxItems: 1, + Optional: true, + Computed: true, // set it to computed because the service will return it no matter if we have passed it. + Elem: &pluginsdk.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + "automation_account_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: azure.ValidateResourceID, + RequiredWith: []string{"automatic_update.0.enabled"}, + }, + }, + }, + }, }, } } @@ -117,16 +140,73 @@ func resourceSiteRecoveryContainerMappingCreate(d *pluginsdk.ResourceData, meta ProviderSpecificInput: replicationprotectioncontainermappings.A2AContainerMappingInput{}, }, } + + autoUpdateEnabledValue, automationAccountArmId := expandAutoUpdateSettings(d.Get("automatic_update").([]interface{})) + + if autoUpdateEnabledValue == replicationprotectioncontainermappings.AgentAutoUpdateStatusEnabled { + parameters.Properties.ProviderSpecificInput = replicationprotectioncontainermappings.A2AContainerMappingInput{ + AgentAutoUpdateStatus: &autoUpdateEnabledValue, + AutomationAccountArmId: automationAccountArmId, + } + } + err := client.CreateThenPoll(ctx, id, parameters) if err != nil { return fmt.Errorf("creating site recovery protection container mapping %s (vault %s): %+v", name, vaultName, err) } - d.SetId(id.ID()) return resourceSiteRecoveryContainerMappingRead(d, meta) } +func resourceSiteRecoveryContainerMappingUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).RecoveryServices.ContainerMappingClient + ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := replicationprotectioncontainermappings.ParseReplicationProtectionContainerMappingID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + d.SetId("") + return nil + } + return fmt.Errorf("making Read request on site recovery protection container mapping %s : %+v", id.String(), err) + } + + if resp.Model == nil { + return fmt.Errorf("making Read request on site recovery protection container mapping %s : `Model` is nil", id.String()) + } + + if resp.Model.Properties == nil { + return fmt.Errorf("making Read request on site recovery protection container mapping %s : `Properties` is nil", id.String()) + } + + update := replicationprotectioncontainermappings.UpdateProtectionContainerMappingInput{ + Properties: &replicationprotectioncontainermappings.UpdateProtectionContainerMappingInputProperties{}, + } + + if d.HasChange("automatic_update") { + autoUpdateEnabledValue, automationAccountArmId := expandAutoUpdateSettings(d.Get("automatic_update").([]interface{})) + updateInput := replicationprotectioncontainermappings.A2AUpdateContainerMappingInput{ + AgentAutoUpdateStatus: &autoUpdateEnabledValue, + AutomationAccountArmId: automationAccountArmId, + } + update.Properties.ProviderSpecificInput = updateInput + } + + err = client.UpdateThenPoll(ctx, *id, update) + if err != nil { + return fmt.Errorf("update %s: %+v", id, err) + } + + return resourceSiteRecoveryContainerMappingRead(d, meta) +} + func resourceSiteRecoveryContainerMappingRead(d *pluginsdk.ResourceData, meta interface{}) error { id, err := replicationprotectioncontainermappings.ParseReplicationProtectionContainerMappingID(d.Id()) if err != nil { @@ -148,17 +228,23 @@ func resourceSiteRecoveryContainerMappingRead(d *pluginsdk.ResourceData, meta in model := resp.Model if model == nil { - return fmt.Errorf("retrieving site recovery protection container mapping %s (vault %s): model is nil", id.MappingName, id.ResourceName) + return fmt.Errorf("retrieving site recovery protection container mapping %s (vault %s): model is nil", id.ReplicationProtectionContainerMappingName, id.VaultName) } d.Set("resource_group_name", id.ResourceGroupName) - d.Set("recovery_vault_name", id.ResourceName) - d.Set("recovery_fabric_name", id.FabricName) + d.Set("recovery_vault_name", id.VaultName) + d.Set("recovery_fabric_name", id.ReplicationFabricName) d.Set("name", model.Name) if prop := model.Properties; prop != nil { d.Set("recovery_source_protection_container_name", model.Properties.SourceProtectionContainerFriendlyName) d.Set("recovery_replication_policy_id", model.Properties.PolicyId) d.Set("recovery_target_protection_container_id", model.Properties.TargetProtectionContainerId) + + if detail, ok := prop.ProviderSpecificDetails.(replicationprotectioncontainermappings.A2AProtectionContainerMappingDetails); ok { + d.Set("automatic_update", flattenAutoUpdateSettings(&detail)) + } else { + d.Set("automatic_update", flattenAutoUpdateSettings(nil)) + } } return nil @@ -191,3 +277,36 @@ func resourceSiteRecoveryServicesContainerMappingDelete(d *pluginsdk.ResourceDat return nil } + +func expandAutoUpdateSettings(input []interface{}) (enabled replicationprotectioncontainermappings.AgentAutoUpdateStatus, automationAccountId *string) { + if len(input) == 0 { + return replicationprotectioncontainermappings.AgentAutoUpdateStatusDisabled, nil + } + autoUpdateSettingMap := input[0].(map[string]interface{}) + + autoUpdateEnabledValue := replicationprotectioncontainermappings.AgentAutoUpdateStatusDisabled + if autoUpdateSettingMap["enabled"].(bool) { + autoUpdateEnabledValue = replicationprotectioncontainermappings.AgentAutoUpdateStatusEnabled + } + + var accountIdOutput *string + accountId := autoUpdateSettingMap["automation_account_id"].(string) + if accountId == "" { + accountIdOutput = nil + } else { + accountIdOutput = &accountId + } + + return autoUpdateEnabledValue, accountIdOutput +} + +func flattenAutoUpdateSettings(input *replicationprotectioncontainermappings.A2AProtectionContainerMappingDetails) []interface{} { + output := map[string]interface{}{} + if input == nil { + output["enabled"] = false + return []interface{}{output} + } + output["enabled"] = *input.AgentAutoUpdateStatus == replicationprotectioncontainermappings.AgentAutoUpdateStatusEnabled + output["automation_account_id"] = input.AutomationAccountArmId + return []interface{}{output} +} diff --git a/internal/services/recoveryservices/site_recovery_protection_container_mapping_resource_test.go b/internal/services/recoveryservices/site_recovery_protection_container_mapping_resource_test.go index 589452febacf..2486c1c56efb 100644 --- a/internal/services/recoveryservices/site_recovery_protection_container_mapping_resource_test.go +++ b/internal/services/recoveryservices/site_recovery_protection_container_mapping_resource_test.go @@ -30,7 +30,43 @@ func TestAccSiteRecoveryProtectionContainerMapping_basic(t *testing.T) { }) } -func (SiteRecoveryProtectionContainerMappingResource) basic(data acceptance.TestData) string { +func TestAccSiteRecoveryProtectionContainerMapping_withAutoUpdateExtension(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_site_recovery_protection_container_mapping", "test") + r := SiteRecoveryProtectionContainerMappingResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.autoUpdateExtension(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.autoUpdateExtension(data, false), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.autoUpdateExtension(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.autoUpdateExtension_changeAutomationAccount(data, true), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (SiteRecoveryProtectionContainerMappingResource) template(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { features {} @@ -86,6 +122,12 @@ resource "azurerm_site_recovery_replication_policy" "test" { recovery_point_retention_in_minutes = 24 * 60 application_consistent_snapshot_frequency_in_minutes = 4 * 60 } +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.Locations.Secondary, data.RandomInteger, data.RandomInteger, data.RandomInteger) +} + +func (r SiteRecoveryProtectionContainerMappingResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s resource "azurerm_site_recovery_protection_container_mapping" "test" { resource_group_name = azurerm_resource_group.test1.name @@ -96,7 +138,83 @@ resource "azurerm_site_recovery_protection_container_mapping" "test" { recovery_replication_policy_id = azurerm_site_recovery_replication_policy.test.id name = "mapping-%d" } -`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.Locations.Secondary, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger) +`, r.template(data), data.RandomInteger) +} + +func (r SiteRecoveryProtectionContainerMappingResource) autoUpdateExtension(data acceptance.TestData, enabled bool) string { + return fmt.Sprintf(` +%s + +resource "azurerm_automation_account" "test" { + name = "acctestAutomation-%[2]d" + location = azurerm_resource_group.test1.location + resource_group_name = azurerm_resource_group.test1.name + + sku_name = "Basic" + + tags = { + Environment = "Test" + } +} + +resource "azurerm_site_recovery_protection_container_mapping" "test" { + resource_group_name = azurerm_resource_group.test1.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + recovery_source_protection_container_name = azurerm_site_recovery_protection_container.test1.name + recovery_target_protection_container_id = azurerm_site_recovery_protection_container.test2.id + recovery_replication_policy_id = azurerm_site_recovery_replication_policy.test.id + name = "mapping-%[2]d" + automatic_update { + enabled = %[3]t + automation_account_id = azurerm_automation_account.test.id + } +} +`, r.template(data), data.RandomInteger, enabled) +} + +func (r SiteRecoveryProtectionContainerMappingResource) autoUpdateExtension_changeAutomationAccount(data acceptance.TestData, enabled bool) string { + return fmt.Sprintf(` +%s + +resource "azurerm_automation_account" "test" { + name = "acctestAutomation-%[2]d" + location = azurerm_resource_group.test1.location + resource_group_name = azurerm_resource_group.test1.name + + sku_name = "Basic" + + tags = { + Environment = "Test" + } +} + +resource "azurerm_automation_account" "test2" { + name = "acctestAutomation-2-%[2]d" + location = azurerm_resource_group.test1.location + resource_group_name = azurerm_resource_group.test1.name + + sku_name = "Basic" + + tags = { + Environment = "Test" + } +} + +resource "azurerm_site_recovery_protection_container_mapping" "test" { + resource_group_name = azurerm_resource_group.test1.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + recovery_source_protection_container_name = azurerm_site_recovery_protection_container.test1.name + recovery_target_protection_container_id = azurerm_site_recovery_protection_container.test2.id + recovery_replication_policy_id = azurerm_site_recovery_replication_policy.test.id + name = "mapping-%[2]d" + automatic_update { + enabled = %[3]t + automation_account_id = azurerm_automation_account.test2.id + } +} +`, r.template(data), data.RandomInteger, enabled) } func (t SiteRecoveryProtectionContainerMappingResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { diff --git a/internal/services/recoveryservices/site_recovery_protection_container_resource.go b/internal/services/recoveryservices/site_recovery_protection_container_resource.go index 390df309d200..f46c4b91f731 100644 --- a/internal/services/recoveryservices/site_recovery_protection_container_resource.go +++ b/internal/services/recoveryservices/site_recovery_protection_container_resource.go @@ -117,10 +117,10 @@ func resourceSiteRecoveryProtectionContainerRead(d *pluginsdk.ResourceData, meta return fmt.Errorf("making Read request on site recovery protection container %s : %+v", id.String(), err) } - d.Set("name", id.ProtectionContainerName) + d.Set("name", id.ReplicationProtectionContainerName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("recovery_vault_name", id.ResourceName) - d.Set("recovery_fabric_name", id.FabricName) + d.Set("recovery_vault_name", id.VaultName) + d.Set("recovery_fabric_name", id.ReplicationFabricName) return nil } diff --git a/internal/services/recoveryservices/site_recovery_replicated_vm_resource.go b/internal/services/recoveryservices/site_recovery_replicated_vm_resource.go index 1b76f4da9bf5..2f7292679d9c 100644 --- a/internal/services/recoveryservices/site_recovery_replicated_vm_resource.go +++ b/internal/services/recoveryservices/site_recovery_replicated_vm_resource.go @@ -11,11 +11,13 @@ import ( "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2018-07-10/siterecovery" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-02/disks" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/validate" @@ -132,6 +134,50 @@ func resourceSiteRecoveryReplicatedVM() *pluginsdk.Resource { ValidateFunc: azure.ValidateResourceID, }, + "test_network_id": { + Type: pluginsdk.TypeString, + Computed: true, + Optional: true, + ValidateFunc: azure.ValidateResourceID, + }, + + "target_edge_zone": commonschema.EdgeZoneOptionalForceNew(), + + "unmanaged_disk": { + Type: pluginsdk.TypeSet, + ConfigMode: pluginsdk.SchemaConfigModeAttr, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "disk_uri": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "staging_storage_account_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: azure.ValidateResourceID, + }, + "target_storage_account_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: azure.ValidateResourceID, + }, + }, + }, + }, + + "multi_vm_group_name": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "managed_disk": { Type: pluginsdk.TypeSet, ConfigMode: pluginsdk.SchemaConfigModeAttr, @@ -201,8 +247,29 @@ func resourceSiteRecoveryReplicatedVM() *pluginsdk.Resource { }, }, }, + "target_proximity_placement_group_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: azure.ValidateResourceID, + }, + "target_boot_diagnostic_storage_account_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: azure.ValidateResourceID, + }, + "target_capacity_reservation_group_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: azure.ValidateResourceID, + }, + "target_virtual_machine_scale_set_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: azure.ValidateResourceID, + }, "network_interface": { - Type: pluginsdk.TypeSet, + Type: pluginsdk.TypeSet, // use set to avoid diff caused by different orders. + Set: resourceSiteRecoveryReplicatedVMNicHash, ConfigMode: pluginsdk.SchemaConfigModeAttr, Computed: true, Optional: true, @@ -213,7 +280,7 @@ func resourceSiteRecoveryReplicatedVM() *pluginsdk.Resource { } func networkInterfaceResource() *pluginsdk.Resource { - return &pluginsdk.Resource{ + out := &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "source_network_interface_id": { Type: pluginsdk.TypeString, @@ -221,31 +288,60 @@ func networkInterfaceResource() *pluginsdk.Resource { Optional: true, ValidateFunc: azure.ValidateResourceID, }, + + "failover_test_static_ip": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ForceNew: false, + ValidateFunc: validation.StringIsNotEmpty, + }, "target_static_ip": { Type: pluginsdk.TypeString, Optional: true, ForceNew: false, ValidateFunc: validation.StringIsNotEmpty, }, + + "failover_test_subnet_name": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ForceNew: false, + ValidateFunc: validation.StringIsNotEmpty, + }, "target_subnet_name": { Type: pluginsdk.TypeString, Optional: true, ForceNew: false, ValidateFunc: validation.StringIsNotEmpty, }, - "recovery_public_ip_address_id": { + + "failover_test_public_ip_address_id": { Type: pluginsdk.TypeString, Optional: true, + Computed: true, ForceNew: false, ValidateFunc: azure.ValidateResourceID, }, - "is_primary": { - Type: pluginsdk.TypeBool, - Optional: true, - Default: false, + "recovery_public_ip_address_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: false, + ValidateFunc: azure.ValidateResourceID, }, }, } + + if !features.FourPointOhBeta() { + out.Schema["is_primary"] = &pluginsdk.Schema{ + Deprecated: "this property is not used and will be removed in version 4.0 of the provider", + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + } + } + return out } func diskEncryptionResource() *pluginsdk.Resource { @@ -369,19 +465,42 @@ func resourceSiteRecoveryReplicatedItemCreate(d *pluginsdk.ResourceData, meta in }) } + var vmDisks []replicationprotecteditems.A2AVMDiskInputDetails + for _, raw := range d.Get("unmanaged_disk").(*pluginsdk.Set).List() { + diskInput := raw.(map[string]interface{}) + diskUri := diskInput["disk_uri"].(string) + primaryStagingAzureStorageAccountID := diskInput["staging_storage_account_id"].(string) + recoveryAzureStorageAccountId := diskInput["target_storage_account_id"].(string) + + vmDisks = append(vmDisks, replicationprotecteditems.A2AVMDiskInputDetails{ + DiskUri: diskUri, + PrimaryStagingAzureStorageAccountId: primaryStagingAzureStorageAccountID, + RecoveryAzureStorageAccountId: recoveryAzureStorageAccountId, + }) + + } + parameters := replicationprotecteditems.EnableProtectionInput{ Properties: &replicationprotecteditems.EnableProtectionInputProperties{ PolicyId: &policyId, ProviderSpecificDetails: replicationprotecteditems.A2AEnableProtectionInput{ - FabricObjectId: sourceVmId, - RecoveryContainerId: &targetProtectionContainerId, - RecoveryResourceGroupId: &targetResourceGroupId, - RecoveryAvailabilitySetId: targetAvailabilitySetID, - RecoveryAvailabilityZone: targetAvailabilityZone, - VMManagedDisks: &managedDisks, + FabricObjectId: sourceVmId, + RecoveryContainerId: &targetProtectionContainerId, + RecoveryResourceGroupId: &targetResourceGroupId, + RecoveryAvailabilitySetId: targetAvailabilitySetID, + RecoveryAvailabilityZone: targetAvailabilityZone, + MultiVMGroupName: utils.String(d.Get("multi_vm_group_name").(string)), + RecoveryProximityPlacementGroupId: utils.String(d.Get("target_proximity_placement_group_id").(string)), + RecoveryBootDiagStorageAccountId: utils.String(d.Get("target_boot_diagnostic_storage_account_id").(string)), + RecoveryCapacityReservationGroupId: utils.String(d.Get("target_capacity_reservation_group_id").(string)), + RecoveryVirtualMachineScaleSetId: utils.String(d.Get("target_virtual_machine_scale_set_id").(string)), + VMManagedDisks: &managedDisks, + VMDisks: &vmDisks, + RecoveryExtendedLocation: expandEdgeZone(d.Get("target_edge_zone").(string)), }, }, } + err := client.CreateThenPoll(ctx, id, parameters) if err != nil { return fmt.Errorf("creating replicated vm %s (vault %s): %+v", name, vaultName, err) @@ -416,6 +535,7 @@ func resourceSiteRecoveryReplicatedItemUpdateInternal(ctx context.Context, d *pl fabricName := d.Get("source_recovery_fabric_name").(string) sourceProtectionContainerName := d.Get("source_recovery_protection_container_name").(string) targetNetworkId := d.Get("target_network_id").(string) + testNetworkId := d.Get("test_network_id").(string) id := replicationprotecteditems.NewReplicationProtectedItemID(subscriptionId, resGroup, vaultName, fabricName, sourceProtectionContainerName, name) @@ -435,10 +555,9 @@ func resourceSiteRecoveryReplicatedItemUpdateInternal(ctx context.Context, d *pl targetStaticIp := vmNicInput["target_static_ip"].(string) targetSubnetName := vmNicInput["target_subnet_name"].(string) recoveryPublicIPAddressID := vmNicInput["recovery_public_ip_address_id"].(string) - isPrimary := vmNicInput["is_primary"].(bool) - if len(nicList) == 1 { - isPrimary = true - } + testStaticIp := vmNicInput["target_static_ip"].(string) + testSubNetName := vmNicInput["target_subnet_name"].(string) + testPublicIpAddressID := vmNicInput["recovery_public_ip_address_id"].(string) nicId := findNicId(state, sourceNicId) if nicId == nil { @@ -449,7 +568,10 @@ func resourceSiteRecoveryReplicatedItemUpdateInternal(ctx context.Context, d *pl RecoverySubnetName: &targetSubnetName, RecoveryStaticIPAddress: &targetStaticIp, RecoveryPublicIPAddressId: &recoveryPublicIPAddressID, - IsPrimary: &isPrimary, + TfoStaticIPAddress: &testStaticIp, + TfoPublicIPAddressId: &testPublicIpAddressID, + TfoSubnetName: &testSubNetName, + IsPrimary: utils.Bool(true), // currently we can only set one IPconfig for a nic, so we dont need to expose this to users. }, } vmNics = append(vmNics, replicationprotecteditems.VMNicInputDetails{ @@ -486,14 +608,28 @@ func resourceSiteRecoveryReplicatedItemUpdateInternal(ctx context.Context, d *pl } } + if testNetworkId == "" { + // No test network id was specified, so we want to preserve what was selected + if a2aDetails, isA2a := state.Properties.ProviderSpecificDetails.(replicationprotecteditems.A2AReplicationDetails); isA2a { + if a2aDetails.SelectedTfoAzureNetworkId != nil { + testNetworkId = *a2aDetails.SelectedTfoAzureNetworkId + } + } + } + parameters := replicationprotecteditems.UpdateReplicationProtectedItemInput{ Properties: &replicationprotecteditems.UpdateReplicationProtectedItemInputProperties{ RecoveryAzureVMName: &name, SelectedRecoveryAzureNetworkId: &targetNetworkId, + SelectedTfoAzureNetworkId: &testNetworkId, VMNics: &vmNics, RecoveryAvailabilitySetId: targetAvailabilitySetID, ProviderSpecificDetails: replicationprotecteditems.A2AUpdateReplicationProtectedItemInput{ - ManagedDiskUpdateDetails: &managedDisks, + ManagedDiskUpdateDetails: &managedDisks, + RecoveryProximityPlacementGroupId: utils.String(d.Get("target_proximity_placement_group_id").(string)), + RecoveryBootDiagStorageAccountId: utils.String(d.Get("target_boot_diagnostic_storage_account_id").(string)), + RecoveryCapacityReservationGroupId: utils.String(d.Get("target_capacity_reservation_group_id").(string)), + RecoveryVirtualMachineScaleSetId: utils.String(d.Get("target_virtual_machine_scale_set_id").(string)), }, }, } @@ -544,11 +680,11 @@ func resourceSiteRecoveryReplicatedItemRead(d *pluginsdk.ResourceData, meta inte return fmt.Errorf("making Read request on site recovery replicated vm %s: model is nil", id.String()) } - d.Set("name", id.ReplicatedProtectedItemName) + d.Set("name", id.ReplicationProtectedItemName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("recovery_vault_name", id.ResourceName) - d.Set("source_recovery_fabric_name", id.FabricName) - d.Set("source_recovery_protection_container_name", id.ProtectionContainerName) + d.Set("recovery_vault_name", id.VaultName) + d.Set("source_recovery_fabric_name", id.ReplicationFabricName) + d.Set("source_recovery_protection_container_name", id.ReplicationProtectionContainerName) if prop := model.Properties; prop != nil { d.Set("target_recovery_fabric_id", prop.RecoveryFabricId) @@ -561,6 +697,25 @@ func resourceSiteRecoveryReplicatedItemRead(d *pluginsdk.ResourceData, meta inte d.Set("target_availability_set_id", a2aDetails.RecoveryAvailabilitySet) d.Set("target_zone", a2aDetails.RecoveryAvailabilityZone) d.Set("target_network_id", a2aDetails.SelectedRecoveryAzureNetworkId) + d.Set("test_network_id", a2aDetails.SelectedTfoAzureNetworkId) + d.Set("target_proximity_placement_group_id", a2aDetails.RecoveryProximityPlacementGroupId) + d.Set("target_boot_diagnostic_storage_account_id", a2aDetails.RecoveryBootDiagStorageAccountId) + d.Set("target_capacity_reservation_group_id", a2aDetails.RecoveryCapacityReservationGroupId) + d.Set("target_virtual_machine_scale_set_id", a2aDetails.RecoveryVirtualMachineScaleSetId) + d.Set("target_edge_zone", flattenEdgeZone(a2aDetails.RecoveryExtendedLocation)) + d.Set("multi_vm_group_name", a2aDetails.MultiVMGroupName) + + if a2aDetails.ProtectedDisks != nil { + disksOutput := make([]interface{}, 0) + for _, disk := range *a2aDetails.ProtectedDisks { + disksOutput = append(disksOutput, map[string]interface{}{ + "disk_uri": disk.DiskUri, + "staging_storage_account_id": disk.PrimaryStagingAzureStorageAccountId, + "target_storage_account_id": disk.RecoveryAzureStorageAccountId, + }) + } + d.Set("unmanaged_disk", disksOutput) + } if a2aDetails.ProtectedManagedDisks != nil { disksOutput := make([]interface{}, 0) @@ -627,6 +782,15 @@ func resourceSiteRecoveryReplicatedItemRead(d *pluginsdk.ResourceData, meta inte if ipConfig.RecoveryPublicIPAddressId != nil { nicOutput["recovery_public_ip_address_id"] = *ipConfig.RecoveryPublicIPAddressId } + if ipConfig.TfoStaticIPAddress != nil { + nicOutput["failover_test_static_ip"] = *ipConfig.TfoStaticIPAddress + } + if ipConfig.TfoSubnetName != nil { + nicOutput["failover_test_subnet_name"] = *ipConfig.TfoSubnetName + } + if ipConfig.TfoPublicIPAddressId != nil { + nicOutput["failover_test_public_ip_address_id"] = *ipConfig.TfoPublicIPAddressId + } } nicsOutput = append(nicsOutput, nicOutput) } @@ -680,6 +844,19 @@ func resourceSiteRecoveryReplicatedVMDiskHash(v interface{}) int { return pluginsdk.HashString(buf.String()) } +// the default hash function will not ignore Option + Computed properties, which will cause diff. +func resourceSiteRecoveryReplicatedVMNicHash(v interface{}) int { + var buf bytes.Buffer + + if m, ok := v.(map[string]interface{}); ok { + if v, ok := m["source_network_interface_id"]; ok { + buf.WriteString(strings.ToLower(v.(string))) + } + } + + return pluginsdk.HashString(buf.String()) +} + func waitForReplicationToBeHealthy(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) (*replicationprotecteditems.ReplicationProtectedItem, error) { log.Printf("Waiting for Site Recover to replicate VM.") stateConf := &pluginsdk.StateChangeConf{ @@ -824,3 +1001,21 @@ func flattenTargetDiskEncryption(disk replicationprotecteditems.A2AProtectedMana }, } } + +func expandEdgeZone(input string) *edgezones.Model { + normalized := edgezones.Normalize(input) + if normalized == "" { + return nil + } + + return &edgezones.Model{ + Name: normalized, + } +} + +func flattenEdgeZone(input *edgezones.Model) string { + if input == nil || input.Name == "" { + return "" + } + return edgezones.NormalizeNilable(&input.Name) +} diff --git a/internal/services/recoveryservices/site_recovery_replicated_vm_resource_test.go b/internal/services/recoveryservices/site_recovery_replicated_vm_resource_test.go index 0120e311f683..ccb7628ce806 100644 --- a/internal/services/recoveryservices/site_recovery_replicated_vm_resource_test.go +++ b/internal/services/recoveryservices/site_recovery_replicated_vm_resource_test.go @@ -31,6 +31,126 @@ func TestAccSiteRecoveryReplicatedVm_basic(t *testing.T) { }) } +func TestAccSiteRecoveryReplicatedVm_withTFOSettings(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_site_recovery_replicated_vm", "test") + r := SiteRecoveryReplicatedVmResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withTFOSettings(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSiteRecoveryReplicatedVm_withProximityPlacementGroup(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_site_recovery_replicated_vm", "test") + r := SiteRecoveryReplicatedVmResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withProximityPlacementGroup(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSiteRecoveryReplicatedVm_withBootDiagStorageAccount(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_site_recovery_replicated_vm", "test") + r := SiteRecoveryReplicatedVmResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withBootDiagStorageAccount(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSiteRecoveryReplicatedVm_withCapacityReservationGroup(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_site_recovery_replicated_vm", "test") + r := SiteRecoveryReplicatedVmResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withCapacityReservationGroup(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSiteRecoveryReplicatedVm_withVMSS(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_site_recovery_replicated_vm", "test") + r := SiteRecoveryReplicatedVmResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withVMSS(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSiteRecoveryReplicatedVm_withMultiVmGroup(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_site_recovery_replicated_vm", "test") + r := SiteRecoveryReplicatedVmResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withMultiVmGroup(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSiteRecoveryReplicatedVm_withEdgeZones(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_site_recovery_replicated_vm", "test") + r := SiteRecoveryReplicatedVmResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withTargetEdgeZone(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSiteRecoveryReplicatedVm_withUnManagedDisks(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_site_recovery_replicated_vm", "test") + r := SiteRecoveryReplicatedVmResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withUnManagedVmDisks(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func TestAccSiteRecoveryReplicatedVm_des(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_site_recovery_replicated_vm", "test") r := SiteRecoveryReplicatedVmResource{} @@ -76,7 +196,6 @@ func TestAccSiteRecoveryReplicatedVm_targetDiskEncryption(t *testing.T) { }) } -// TODO: remove the resource group features in this file before ready to review func (SiteRecoveryReplicatedVmResource) template(data acceptance.TestData) string { tags := "" if strings.HasPrefix(strings.ToLower(data.Client().SubscriptionID), "85b3dbca") { @@ -320,6 +439,48 @@ resource "azurerm_site_recovery_replicated_vm" "test" { `, r.template(data), data.RandomInteger) } +func (r SiteRecoveryReplicatedVmResource) withTFOSettings(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_site_recovery_replicated_vm" "test" { + name = "repl-%[2]d" + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + source_vm_id = azurerm_virtual_machine.test.id + source_recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + recovery_replication_policy_id = azurerm_site_recovery_replication_policy.test.id + source_recovery_protection_container_name = azurerm_site_recovery_protection_container.test1.name + + target_resource_group_id = azurerm_resource_group.test2.id + target_recovery_fabric_id = azurerm_site_recovery_fabric.test2.id + target_recovery_protection_container_id = azurerm_site_recovery_protection_container.test2.id + test_network_id = azurerm_virtual_network.test2.id + + managed_disk { + disk_id = azurerm_virtual_machine.test.storage_os_disk[0].managed_disk_id + staging_storage_account_id = azurerm_storage_account.test.id + target_resource_group_id = azurerm_resource_group.test2.id + target_disk_type = "Premium_LRS" + target_replica_disk_type = "Premium_LRS" + } + + network_interface { + source_network_interface_id = azurerm_network_interface.test.id + target_subnet_name = azurerm_subnet.test2.name + recovery_public_ip_address_id = azurerm_public_ip.test-recovery.id + failover_test_subnet_name = azurerm_subnet.test2.name + failover_test_public_ip_address_id = azurerm_public_ip.test-recovery.id + } + + depends_on = [ + azurerm_site_recovery_protection_container_mapping.test, + azurerm_site_recovery_network_mapping.test, + ] +} +`, r.template(data), data.RandomInteger) +} + func (SiteRecoveryReplicatedVmResource) des(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { @@ -1159,6 +1320,577 @@ resource "azurerm_site_recovery_replicated_vm" "test" { `, data.RandomInteger, data.Locations.Primary, data.Locations.Secondary, data.RandomString) } +func (r SiteRecoveryReplicatedVmResource) withProximityPlacementGroup(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_proximity_placement_group" "test" { + name = "acctest-replication-%[2]d" + location = azurerm_resource_group.test2.location + resource_group_name = azurerm_resource_group.test2.name +} + +resource "azurerm_site_recovery_replicated_vm" "test" { + name = "repl-%[2]d" + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + source_vm_id = azurerm_virtual_machine.test.id + source_recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + recovery_replication_policy_id = azurerm_site_recovery_replication_policy.test.id + source_recovery_protection_container_name = azurerm_site_recovery_protection_container.test1.name + + target_resource_group_id = azurerm_resource_group.test2.id + target_recovery_fabric_id = azurerm_site_recovery_fabric.test2.id + target_recovery_protection_container_id = azurerm_site_recovery_protection_container.test2.id + target_proximity_placement_group_id = azurerm_proximity_placement_group.test.id + + managed_disk { + disk_id = azurerm_virtual_machine.test.storage_os_disk[0].managed_disk_id + staging_storage_account_id = azurerm_storage_account.test.id + target_resource_group_id = azurerm_resource_group.test2.id + target_disk_type = "Premium_LRS" + target_replica_disk_type = "Premium_LRS" + } + + network_interface { + source_network_interface_id = azurerm_network_interface.test.id + target_subnet_name = azurerm_subnet.test2.name + recovery_public_ip_address_id = azurerm_public_ip.test-recovery.id + } + + depends_on = [ + azurerm_site_recovery_protection_container_mapping.test, + azurerm_site_recovery_network_mapping.test, + ] +} + + +`, r.template(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary) +} + +func (r SiteRecoveryReplicatedVmResource) withBootDiagStorageAccount(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_storage_account" "test2" { + name = "acctre%[2]d" + location = azurerm_resource_group.test2.location + resource_group_name = azurerm_resource_group.test2.name + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_site_recovery_replicated_vm" "test" { + name = "repl-%[2]d" + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + source_vm_id = azurerm_virtual_machine.test.id + source_recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + recovery_replication_policy_id = azurerm_site_recovery_replication_policy.test.id + source_recovery_protection_container_name = azurerm_site_recovery_protection_container.test1.name + + target_resource_group_id = azurerm_resource_group.test2.id + target_recovery_fabric_id = azurerm_site_recovery_fabric.test2.id + target_recovery_protection_container_id = azurerm_site_recovery_protection_container.test2.id + target_boot_diagnostic_storage_account_id = azurerm_storage_account.test2.id + + managed_disk { + disk_id = azurerm_virtual_machine.test.storage_os_disk[0].managed_disk_id + staging_storage_account_id = azurerm_storage_account.test.id + target_resource_group_id = azurerm_resource_group.test2.id + target_disk_type = "Premium_LRS" + target_replica_disk_type = "Premium_LRS" + } + + network_interface { + source_network_interface_id = azurerm_network_interface.test.id + target_subnet_name = azurerm_subnet.test2.name + recovery_public_ip_address_id = azurerm_public_ip.test-recovery.id + } + + depends_on = [ + azurerm_site_recovery_protection_container_mapping.test, + azurerm_site_recovery_network_mapping.test, + ] +} + + + + +`, r.template(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary) +} + +func (r SiteRecoveryReplicatedVmResource) withUnManagedVmDisks(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features { + key_vault { + purge_soft_delete_on_destroy = false + purge_soft_deleted_keys_on_destroy = false + } + resource_group { + prevent_deletion_if_contains_resources = false + } + } +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-recovery-%[1]d-1" + location = "%[2]s" +} + +resource "azurerm_resource_group" "test2" { + name = "acctestRG-recovery-%[1]d-2" + location = "%[3]s" +} + +resource "azurerm_managed_disk" "test" { + name = "acctestd-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + storage_account_type = "Standard_LRS" + create_option = "Empty" + disk_size_gb = 1 +} + +resource "azurerm_virtual_network" "test" { + name = "acctvn-%[1]d" + address_space = ["10.0.0.0/16"] + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_subnet" "test" { + name = "acctsub-%[1]d" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test.name + address_prefixes = ["10.0.2.0/24"] +} + +resource "azurerm_network_interface" "test" { + name = "acctni-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + ip_configuration { + name = "testconfiguration1" + subnet_id = azurerm_subnet.test.id + private_ip_address_allocation = "Dynamic" + } +} + + +resource "azurerm_virtual_machine" "test" { + name = "acctvm-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + network_interface_ids = [azurerm_network_interface.test.id] + vm_size = "Standard_D1_v2" + + delete_os_disk_on_termination = true + delete_data_disks_on_termination = true + + storage_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04-LTS" + version = "latest" + } + + storage_os_disk { + name = "myosdisk1" + vhd_uri = "${azurerm_storage_account.test.primary_blob_endpoint}${azurerm_storage_container.test.name}/myosdisk1.vhd" + caching = "ReadWrite" + create_option = "FromImage" + } + + os_profile { + computer_name = "hn%[1]d" + admin_username = "testadmin" + admin_password = "Password1234!" + } + + os_profile_linux_config { + disable_password_authentication = false + } + + tags = { + environment = "Production" + cost-center = "Ops" + } +} + +resource "azurerm_recovery_services_vault" "test" { + name = "acctest-vault-%[1]d" + location = azurerm_resource_group.test2.location + resource_group_name = azurerm_resource_group.test2.name + sku = "Standard" + + soft_delete_enabled = false +} + +resource "azurerm_site_recovery_fabric" "test1" { + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + name = "acctest-fabric1-%[1]d" + location = azurerm_resource_group.test.location +} + +resource "azurerm_site_recovery_fabric" "test2" { + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + name = "acctest-fabric2-%[1]d" + location = azurerm_resource_group.test2.location + depends_on = [azurerm_site_recovery_fabric.test1] +} + +resource "azurerm_site_recovery_protection_container" "test1" { + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + name = "acctest-protection-cont1-%[1]d" +} + +resource "azurerm_site_recovery_protection_container" "test2" { + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + recovery_fabric_name = azurerm_site_recovery_fabric.test2.name + name = "acctest-protection-cont2-%[1]d" +} + +resource "azurerm_site_recovery_replication_policy" "test" { + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + name = "acctest-policy-%[1]d" + recovery_point_retention_in_minutes = 24 * 60 + application_consistent_snapshot_frequency_in_minutes = 4 * 60 +} + +resource "azurerm_site_recovery_protection_container_mapping" "test" { + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + recovery_source_protection_container_name = azurerm_site_recovery_protection_container.test1.name + recovery_target_protection_container_id = azurerm_site_recovery_protection_container.test2.id + recovery_replication_policy_id = azurerm_site_recovery_replication_policy.test.id + name = "mapping-%[1]d" +} + +resource "azurerm_virtual_network" "test2" { + name = "net-%[1]d-2" + resource_group_name = azurerm_resource_group.test2.name + address_space = ["192.168.2.0/24"] + location = azurerm_site_recovery_fabric.test2.location +} + +resource "azurerm_site_recovery_network_mapping" "test" { + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + name = "mapping-%[1]d" + source_recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + target_recovery_fabric_name = azurerm_site_recovery_fabric.test2.name + source_network_id = azurerm_virtual_network.test.id + target_network_id = azurerm_virtual_network.test2.id +} + +resource "azurerm_public_ip" "test-recovery" { + name = "pubip%[1]d-recovery" + allocation_method = "Static" + location = azurerm_resource_group.test2.location + resource_group_name = azurerm_resource_group.test2.name + sku = "Basic" +} + +resource "azurerm_storage_account" "test" { + name = "acct%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_storage_container" "test" { + name = "vhds" + storage_account_name = azurerm_storage_account.test.name + container_access_type = "blob" +} + +resource "azurerm_storage_account" "test2" { + name = "acctre%[1]d" + location = azurerm_resource_group.test2.location + resource_group_name = azurerm_resource_group.test.name + account_tier = "Standard" + account_replication_type = "LRS" +} + + +resource "azurerm_site_recovery_replicated_vm" "test" { + name = "repl-%[1]d" + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + source_vm_id = azurerm_virtual_machine.test.id + source_recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + recovery_replication_policy_id = azurerm_site_recovery_replication_policy.test.id + source_recovery_protection_container_name = azurerm_site_recovery_protection_container.test1.name + + target_resource_group_id = azurerm_resource_group.test2.id + target_recovery_fabric_id = azurerm_site_recovery_fabric.test2.id + target_recovery_protection_container_id = azurerm_site_recovery_protection_container.test2.id + + unmanaged_disk { + disk_uri = azurerm_virtual_machine.test.storage_os_disk[0].vhd_uri + staging_storage_account_id = azurerm_storage_account.test.id + target_storage_account_id = azurerm_storage_account.test2.id + } + + depends_on = [ + azurerm_site_recovery_protection_container_mapping.test, + azurerm_site_recovery_network_mapping.test, + ] +} +`, data.RandomInteger, data.Locations.Primary, data.Locations.Secondary) +} + +func (r SiteRecoveryReplicatedVmResource) withCapacityReservationGroup(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_capacity_reservation_group" "test" { + name = "acctest-crg-%[2]d" + location = azurerm_resource_group.test2.location + resource_group_name = azurerm_resource_group.test2.name +} + +resource "azurerm_capacity_reservation" "test" { + name = "acctest-ccr-%[2]d" + capacity_reservation_group_id = azurerm_capacity_reservation_group.test.id + + sku { + name = "Standard_B1s" + capacity = 1 + } +} + +resource "azurerm_site_recovery_replicated_vm" "test" { + name = "repl-%[2]d" + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + source_vm_id = azurerm_virtual_machine.test.id + source_recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + recovery_replication_policy_id = azurerm_site_recovery_replication_policy.test.id + source_recovery_protection_container_name = azurerm_site_recovery_protection_container.test1.name + + target_resource_group_id = azurerm_resource_group.test2.id + target_recovery_fabric_id = azurerm_site_recovery_fabric.test2.id + target_recovery_protection_container_id = azurerm_site_recovery_protection_container.test2.id + target_capacity_reservation_group_id = azurerm_capacity_reservation_group.test.id + + managed_disk { + disk_id = azurerm_virtual_machine.test.storage_os_disk[0].managed_disk_id + staging_storage_account_id = azurerm_storage_account.test.id + target_resource_group_id = azurerm_resource_group.test2.id + target_disk_type = "Premium_LRS" + target_replica_disk_type = "Premium_LRS" + } + + network_interface { + source_network_interface_id = azurerm_network_interface.test.id + target_subnet_name = azurerm_subnet.test2.name + recovery_public_ip_address_id = azurerm_public_ip.test-recovery.id + } + + depends_on = [ + azurerm_site_recovery_protection_container_mapping.test, + azurerm_site_recovery_network_mapping.test, + azurerm_capacity_reservation.test, + ] +} + +`, r.template(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary) +} + +func (r SiteRecoveryReplicatedVmResource) withVMSS(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_orchestrated_virtual_machine_scale_set" "test" { + name = "acctestOVMSS-%[2]d" + location = azurerm_resource_group.test2.location + resource_group_name = azurerm_resource_group.test2.name + + sku_name = "Standard_B1s" + instances = 2 + platform_fault_domain_count = 2 + + network_interface { + name = "TestNetworkProfile-%[2]d" + primary = true + + ip_configuration { + name = "TestIPConfiguration" + primary = true + subnet_id = azurerm_subnet.test2.id + + public_ip_address { + name = "TestPublicIPConfiguration" + domain_name_label = "test-domain-label" + idle_timeout_in_minutes = 4 + } + } + } + + os_disk { + caching = "ReadWrite" + storage_account_type = "Standard_LRS" + } + + source_image_reference { + publisher = "Canonical" + offer = "UbuntuServer" + sku = "16.04-LTS" + version = "latest" + } + + os_profile { + linux_configuration { + computer_name_prefix = "testvm-%[2]d" + admin_username = "myadmin" + admin_password = "Passwword1234" + + disable_password_authentication = false + } + } + +} + +resource "azurerm_site_recovery_replicated_vm" "test" { + name = "repl-%[2]d" + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + source_vm_id = azurerm_virtual_machine.test.id + source_recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + recovery_replication_policy_id = azurerm_site_recovery_replication_policy.test.id + source_recovery_protection_container_name = azurerm_site_recovery_protection_container.test1.name + + target_resource_group_id = azurerm_resource_group.test2.id + target_recovery_fabric_id = azurerm_site_recovery_fabric.test2.id + target_recovery_protection_container_id = azurerm_site_recovery_protection_container.test2.id + target_virtual_machine_scale_set_id = azurerm_orchestrated_virtual_machine_scale_set.test.id + + managed_disk { + disk_id = azurerm_virtual_machine.test.storage_os_disk[0].managed_disk_id + staging_storage_account_id = azurerm_storage_account.test.id + target_resource_group_id = azurerm_resource_group.test2.id + target_disk_type = "Premium_LRS" + target_replica_disk_type = "Premium_LRS" + } + + network_interface { + source_network_interface_id = azurerm_network_interface.test.id + target_subnet_name = azurerm_subnet.test2.name + recovery_public_ip_address_id = azurerm_public_ip.test-recovery.id + } + + depends_on = [ + azurerm_site_recovery_protection_container_mapping.test, + azurerm_site_recovery_network_mapping.test, + ] +} + + +`, r.template(data), data.RandomInteger, data.RandomString) +} + +func (r SiteRecoveryReplicatedVmResource) withMultiVmGroup(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_site_recovery_replicated_vm" "test" { + name = "repl-%[2]d" + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + source_vm_id = azurerm_virtual_machine.test.id + source_recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + recovery_replication_policy_id = azurerm_site_recovery_replication_policy.test.id + source_recovery_protection_container_name = azurerm_site_recovery_protection_container.test1.name + multi_vm_group_name = "accmultivmgroup" + + target_resource_group_id = azurerm_resource_group.test2.id + target_recovery_fabric_id = azurerm_site_recovery_fabric.test2.id + target_recovery_protection_container_id = azurerm_site_recovery_protection_container.test2.id + + managed_disk { + disk_id = azurerm_virtual_machine.test.storage_os_disk[0].managed_disk_id + staging_storage_account_id = azurerm_storage_account.test.id + target_resource_group_id = azurerm_resource_group.test2.id + target_disk_type = "Premium_LRS" + target_replica_disk_type = "Premium_LRS" + } + + network_interface { + source_network_interface_id = azurerm_network_interface.test.id + target_subnet_name = azurerm_subnet.test2.name + recovery_public_ip_address_id = azurerm_public_ip.test-recovery.id + } + + depends_on = [ + azurerm_site_recovery_protection_container_mapping.test, + azurerm_site_recovery_network_mapping.test, + ] +} +`, r.template(data), data.RandomInteger) +} + +func (r SiteRecoveryReplicatedVmResource) withTargetEdgeZone(data acceptance.TestData) string { + // WestUS has an edge zone available - so hard-code to that for now + data.Locations.Secondary = "westus" + + return fmt.Sprintf(` +%s + +data "azurerm_extended_locations" "test" { + location = azurerm_resource_group.test.location +} + +resource "azurerm_site_recovery_replicated_vm" "test" { + name = "repl-%[2]d" + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + source_vm_id = azurerm_virtual_machine.test.id + source_recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + recovery_replication_policy_id = azurerm_site_recovery_replication_policy.test.id + source_recovery_protection_container_name = azurerm_site_recovery_protection_container.test1.name + target_edge_zone = data.azurerm_extended_locations.test.extended_locations[0] + + target_resource_group_id = azurerm_resource_group.test2.id + target_recovery_fabric_id = azurerm_site_recovery_fabric.test2.id + target_recovery_protection_container_id = azurerm_site_recovery_protection_container.test2.id + + managed_disk { + disk_id = azurerm_virtual_machine.test.storage_os_disk[0].managed_disk_id + staging_storage_account_id = azurerm_storage_account.test.id + target_resource_group_id = azurerm_resource_group.test2.id + target_disk_type = "Premium_LRS" + target_replica_disk_type = "Premium_LRS" + } + + network_interface { + source_network_interface_id = azurerm_network_interface.test.id + target_subnet_name = azurerm_subnet.test2.name + recovery_public_ip_address_id = azurerm_public_ip.test-recovery.id + } + + depends_on = [ + azurerm_site_recovery_protection_container_mapping.test, + azurerm_site_recovery_network_mapping.test, + ] +} +`, r.template(data), data.RandomInteger) + +} + func (r SiteRecoveryReplicatedVmResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := replicationprotecteditems.ParseReplicationProtectedItemID(state.ID) if err != nil { diff --git a/internal/services/recoveryservices/site_recovery_replication_policy_data_source.go b/internal/services/recoveryservices/site_recovery_replication_policy_data_source.go index bdc04cc155a8..2674842d607d 100644 --- a/internal/services/recoveryservices/site_recovery_replication_policy_data_source.go +++ b/internal/services/recoveryservices/site_recovery_replication_policy_data_source.go @@ -63,9 +63,9 @@ func dataSourceSiteRecoveryReplicationPolicyRead(d *pluginsdk.ResourceData, meta } d.SetId(id.ID()) - d.Set("name", id.PolicyName) + d.Set("name", id.ReplicationPolicyName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("recovery_vault_name", id.ResourceName) + d.Set("recovery_vault_name", id.VaultName) if model := resp.Model; model != nil { a2APolicyDetails, isA2A := expandA2APolicyDetail(model) diff --git a/internal/services/recoveryservices/site_recovery_replication_policy_resource.go b/internal/services/recoveryservices/site_recovery_replication_policy_resource.go index 759db441b199..1b02f942410c 100644 --- a/internal/services/recoveryservices/site_recovery_replication_policy_resource.go +++ b/internal/services/recoveryservices/site_recovery_replication_policy_resource.go @@ -171,9 +171,9 @@ func resourceSiteRecoveryReplicationPolicyRead(d *pluginsdk.ResourceData, meta i return fmt.Errorf("making Read request on site recovery replication policy %s : %+v", id.String(), err) } - d.Set("name", id.PolicyName) + d.Set("name", id.ReplicationPolicyName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("recovery_vault_name", id.ResourceName) + d.Set("recovery_vault_name", id.VaultName) if model := resp.Model; model != nil { if a2APolicyDetails, isA2A := expandA2APolicyDetail(resp.Model); isA2A { diff --git a/internal/services/recoveryservices/site_recovery_replication_recovery_plan_data_source.go b/internal/services/recoveryservices/site_recovery_replication_recovery_plan_data_source.go new file mode 100644 index 000000000000..58bd1ca3f016 --- /dev/null +++ b/internal/services/recoveryservices/site_recovery_replication_recovery_plan_data_source.go @@ -0,0 +1,199 @@ +package recoveryservices + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type SiteRecoveryReplicationRecoveryPlanDataSource struct{} + +var _ sdk.DataSource = SiteRecoveryReplicationRecoveryPlanDataSource{} + +func (r SiteRecoveryReplicationRecoveryPlanDataSource) ResourceType() string { + return "azurerm_site_recovery_replication_recovery_plan" +} + +func (r SiteRecoveryReplicationRecoveryPlanDataSource) ModelObject() interface{} { + return &SiteRecoveryReplicationRecoveryPlanModel{} +} + +func (r SiteRecoveryReplicationRecoveryPlanDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return replicationrecoveryplans.ValidateReplicationRecoveryPlanID +} + +func (r SiteRecoveryReplicationRecoveryPlanDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var metaModel SiteRecoveryReplicationRecoveryPlanModel + if err := metadata.Decode(&metaModel); err != nil { + return fmt.Errorf("decoding %+v", err) + } + + client := metadata.Client.RecoveryServices.ReplicationRecoveryPlansClient + subscriptionId := metadata.Client.Account.SubscriptionId + + vaultId, err := replicationrecoveryplans.ParseVaultID(metaModel.RecoveryVaultId) + if err != nil { + return err + } + + id := replicationrecoveryplans.NewReplicationRecoveryPlanID(subscriptionId, vaultId.ResourceGroupName, vaultId.VaultName, metaModel.Name) + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("making Read request on site recovery replication plan %s : model is nil", id.String()) + } + + state := SiteRecoveryReplicationRecoveryPlanModel{ + Name: id.ReplicationRecoveryPlanName, + RecoveryVaultId: vaultId.ID(), + } + + if prop := model.Properties; prop != nil { + if prop.PrimaryFabricId != nil { + state.SourceRecoveryFabricId = handleAzureSdkForGoBug2824(*prop.PrimaryFabricId) + } + if prop.RecoveryFabricId != nil { + state.TargetRecoveryFabricId = handleAzureSdkForGoBug2824(*prop.RecoveryFabricId) + } + + if group := prop.Groups; group != nil { + state.RecoveryGroup = flattenRecoveryGroups(*group) + } + } + + metadata.SetID(id) + return metadata.Encode(&state) + }, + } + +} + +func (r SiteRecoveryReplicationRecoveryPlanDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "recovery_vault_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: replicationrecoveryplans.ValidateVaultID, + }, + } +} + +func (r SiteRecoveryReplicationRecoveryPlanDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "source_recovery_fabric_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "target_recovery_fabric_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "failover_deployment_model": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "recovery_group": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "replicated_protected_items": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "pre_action": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: dataSourceSiteRecoveryReplicationPlanActions(), + }, + "post_action": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: dataSourceSiteRecoveryReplicationPlanActions(), + }, + }, + }, + }, + } +} + +func dataSourceSiteRecoveryReplicationPlanActions() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Elem: &pluginsdk.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "fail_over_directions": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "fail_over_types": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "runbook_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "fabric_location": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "manual_action_instruction": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "script_path": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + } +} diff --git a/internal/services/recoveryservices/site_recovery_replication_recovery_plan_data_source_test.go b/internal/services/recoveryservices/site_recovery_replication_recovery_plan_data_source_test.go new file mode 100644 index 000000000000..64766870918a --- /dev/null +++ b/internal/services/recoveryservices/site_recovery_replication_recovery_plan_data_source_test.go @@ -0,0 +1,42 @@ +package recoveryservices_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type SiteRecoveryReplicationRecoveryPlanDataSource struct{} + +func TestAccDataSourceSiteRecoveryReplicationRecoveryPlan_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_site_recovery_replication_recovery_plan", "test") + r := SiteRecoveryReplicationRecoveryPlanDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("name").Exists(), + check.That(data.ResourceName).Key("recovery_vault_id").Exists(), + check.That(data.ResourceName).Key("source_recovery_fabric_id").Exists(), + check.That(data.ResourceName).Key("target_recovery_fabric_id").Exists(), + check.That(data.ResourceName).Key("recovery_group.0.type").HasValue("Boot"), + check.That(data.ResourceName).Key("recovery_group.1.type").HasValue("Failover"), + check.That(data.ResourceName).Key("recovery_group.2.type").HasValue("Shutdown"), + ), + }, + }) +} + +func (SiteRecoveryReplicationRecoveryPlanDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +data "azurerm_site_recovery_replication_recovery_plan" "test" { + name = azurerm_site_recovery_replication_recovery_plan.test.name + recovery_vault_id = azurerm_site_recovery_replication_recovery_plan.test.recovery_vault_id +} +`, SiteRecoveryReplicationRecoveryPlan{}.basic(data)) +} diff --git a/internal/services/recoveryservices/site_recovery_replication_recovery_plan_resource.go b/internal/services/recoveryservices/site_recovery_replication_recovery_plan_resource.go new file mode 100644 index 000000000000..4ab848730e20 --- /dev/null +++ b/internal/services/recoveryservices/site_recovery_replication_recovery_plan_resource.go @@ -0,0 +1,545 @@ +package recoveryservices + +import ( + "context" + "fmt" + "regexp" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type SiteRecoveryReplicationRecoveryPlanModel struct { + Name string `tfschema:"name"` + RecoveryGroup []RecoveryGroupModel `tfschema:"recovery_group"` + RecoveryVaultId string `tfschema:"recovery_vault_id"` + SourceRecoveryFabricId string `tfschema:"source_recovery_fabric_id"` + TargetRecoveryFabricId string `tfschema:"target_recovery_fabric_id"` +} + +type RecoveryGroupModel struct { + GroupType replicationrecoveryplans.RecoveryPlanGroupType `tfschema:"type"` + PostAction []ActionModel `tfschema:"post_action"` + PreAction []ActionModel `tfschema:"pre_action"` + ReplicatedProtectedItems []string `tfschema:"replicated_protected_items"` +} + +type ActionModel struct { + ActionDetailType string `tfschema:"type"` + FabricLocation replicationrecoveryplans.RecoveryPlanActionLocation `tfschema:"fabric_location"` + FailOverDirections []string `tfschema:"fail_over_directions"` + FailOverTypes []string `tfschema:"fail_over_types"` + ManualActionInstruction string `tfschema:"manual_action_instruction"` + Name string `tfschema:"name"` + RunbookId string `tfschema:"runbook_id"` + ScriptPath string `tfschema:"script_path"` +} + +type SiteRecoveryReplicationRecoveryPlanResource struct{} + +var _ sdk.ResourceWithUpdate = SiteRecoveryReplicationRecoveryPlanResource{} + +func (r SiteRecoveryReplicationRecoveryPlanResource) ResourceType() string { + return "azurerm_site_recovery_replication_recovery_plan" +} + +func (r SiteRecoveryReplicationRecoveryPlanResource) ModelObject() interface{} { + return &SiteRecoveryReplicationRecoveryPlanModel{} +} + +func (r SiteRecoveryReplicationRecoveryPlanResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return replicationrecoveryplans.ValidateReplicationRecoveryPlanID +} + +func (r SiteRecoveryReplicationRecoveryPlanResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`[a-zA-Z][a-zA-Z0-9-]{1,63}[a-zA-Z0-9]$`), "The name can contain only letters, numbers, and hyphens. It should start with a letter and end with a letter or a number."), + }, + + "recovery_vault_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: replicationfabrics.ValidateVaultID, + }, + + "source_recovery_fabric_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: replicationfabrics.ValidateReplicationFabricID, + }, + + "target_recovery_fabric_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: replicationfabrics.ValidateReplicationFabricID, + }, + + "recovery_group": { + Type: pluginsdk.TypeSet, + Optional: true, + MinItems: 3, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "type": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(replicationrecoveryplans.RecoveryPlanGroupTypeBoot), + string(replicationrecoveryplans.RecoveryPlanGroupTypeShutdown), + string(replicationrecoveryplans.RecoveryPlanGroupTypeFailover), + }, false), + }, + "replicated_protected_items": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: azure.ValidateResourceID, + }, + }, + "pre_action": { + Type: pluginsdk.TypeSet, + Optional: true, + Elem: schemaAction(), + }, + "post_action": { + Type: pluginsdk.TypeSet, + Optional: true, + Elem: schemaAction(), + }, + }, + }, + }, + } +} + +func schemaAction() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "type": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + "AutomationRunbookActionDetails", + "ManualActionDetails", + "ScriptActionDetails", + }, false), + }, + + "fail_over_directions": { + Type: pluginsdk.TypeSet, + Required: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + string(replicationrecoveryplans.PossibleOperationsDirectionsPrimaryToRecovery), + string(replicationrecoveryplans.PossibleOperationsDirectionsRecoveryToPrimary), + }, false), + }, + }, + + "fail_over_types": { + Type: pluginsdk.TypeSet, + Required: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + string(replicationrecoveryplans.ReplicationProtectedItemOperationPlannedFailover), + string(replicationrecoveryplans.ReplicationProtectedItemOperationTestFailover), + string(replicationrecoveryplans.ReplicationProtectedItemOperationUnplannedFailover), + }, false), + }, + }, + "runbook_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: azure.ValidateResourceID, + }, + "fabric_location": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(replicationrecoveryplans.RecoveryPlanActionLocationPrimary), + string(replicationrecoveryplans.RecoveryPlanActionLocationRecovery), + }, false), + }, + "manual_action_instruction": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "script_path": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + } +} + +func (r SiteRecoveryReplicationRecoveryPlanResource) Attributes() map[string]*schema.Schema { + return map[string]*schema.Schema{} +} + +func (r SiteRecoveryReplicationRecoveryPlanResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model SiteRecoveryReplicationRecoveryPlanModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding %+v", err) + } + + client := metadata.Client.RecoveryServices.ReplicationRecoveryPlansClient + subscriptionId := metadata.Client.Account.SubscriptionId + + vaultId, err := replicationrecoveryplans.ParseVaultID(model.RecoveryVaultId) + if err != nil { + return err + } + + id := replicationrecoveryplans.NewReplicationRecoveryPlanID(subscriptionId, vaultId.ResourceGroupName, vaultId.VaultName, model.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + // NOTE: Bad Request due to https://github.com/Azure/azure-rest-api-specs/issues/12759 + if !response.WasNotFound(existing.HttpResponse) && !response.WasBadRequest(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing site recovery plan %q: %+v", id, err) + } + } + + if existing.Model != nil && existing.Model.Id != nil && *existing.Model.Id != "" { + return tf.ImportAsExistsError("azurerm_site_recovery_replication_recovery_plan", *existing.Model.Id) + } + + // FailoverDeploymentModelClassic is used for other cloud service back up to Azure. + deploymentModel := replicationrecoveryplans.FailoverDeploymentModelResourceManager + groupValue, err := expandRecoverGroup(model.RecoveryGroup) + if err != nil { + return fmt.Errorf("when expanding recovery group: %s", err) + } + + parameters := replicationrecoveryplans.CreateRecoveryPlanInput{ + Properties: replicationrecoveryplans.CreateRecoveryPlanInputProperties{ + PrimaryFabricId: model.SourceRecoveryFabricId, + RecoveryFabricId: model.TargetRecoveryFabricId, + FailoverDeploymentModel: &deploymentModel, + Groups: groupValue, + }, + } + + err = client.CreateThenPoll(ctx, id, parameters) + if err != nil { + return fmt.Errorf("creating site recovery replication plan %q: %+v", id, err) + } + + metadata.SetID(id) + + return nil + }, + } +} + +func (r SiteRecoveryReplicationRecoveryPlanResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.RecoveryServices.ReplicationRecoveryPlansClient + + id, err := replicationrecoveryplans.ParseReplicationRecoveryPlanID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + vaultId := replicationrecoveryplans.NewVaultID(id.SubscriptionId, id.ResourceGroupName, id.VaultName) + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("making Read request on site recovery replication plan %s : %+v", id.String(), err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("making Read request on site recovery replication plan %s : model is nil", id.String()) + } + + state := SiteRecoveryReplicationRecoveryPlanModel{ + Name: id.ReplicationRecoveryPlanName, + RecoveryVaultId: vaultId.ID(), + } + + if prop := model.Properties; prop != nil { + if prop.PrimaryFabricId != nil { + state.SourceRecoveryFabricId = handleAzureSdkForGoBug2824(*prop.PrimaryFabricId) + } + if prop.RecoveryFabricId != nil { + state.TargetRecoveryFabricId = handleAzureSdkForGoBug2824(*prop.RecoveryFabricId) + } + + if group := prop.Groups; group != nil { + state.RecoveryGroup = flattenRecoveryGroups(*group) + } + } + + return metadata.Encode(&state) + }, + } +} + +func (r SiteRecoveryReplicationRecoveryPlanResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model SiteRecoveryReplicationRecoveryPlanModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + client := metadata.Client.RecoveryServices.ReplicationRecoveryPlansClient + + id, err := replicationrecoveryplans.ParseReplicationRecoveryPlanID(metadata.ResourceData.Id()) + if err != nil { + return fmt.Errorf("parse Site reocvery replication plan id: %+v", err) + } + + recoveryPlanGroup, err := expandRecoverGroup(model.RecoveryGroup) + if err != nil { + return fmt.Errorf("when expanding recovery group: %s", err) + } + + parameters := replicationrecoveryplans.UpdateRecoveryPlanInput{ + Properties: &replicationrecoveryplans.UpdateRecoveryPlanInputProperties{ + Groups: &recoveryPlanGroup, + }, + } + + err = client.UpdateThenPoll(ctx, *id, parameters) + if err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r SiteRecoveryReplicationRecoveryPlanResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.RecoveryServices.ReplicationRecoveryPlansClient + + id, err := replicationrecoveryplans.ParseReplicationRecoveryPlanID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + err = client.DeleteThenPoll(ctx, *id) + if err != nil { + return fmt.Errorf("deleting site recovery protection replication plan %q : %+v", id, err) + } + + return nil + }, + } +} + +func expandRecoverGroup(input []RecoveryGroupModel) ([]replicationrecoveryplans.RecoveryPlanGroup, error) { + output := make([]replicationrecoveryplans.RecoveryPlanGroup, 0) + if pass, err := validateRecoverGroup(input); !pass { + return output, err + } + + for _, group := range input { + + protectedItems := make([]replicationrecoveryplans.RecoveryPlanProtectedItem, 0) + for _, protectedItem := range group.ReplicatedProtectedItems { + protectedItems = append(protectedItems, replicationrecoveryplans.RecoveryPlanProtectedItem{ + Id: utils.String(protectedItem), + }) + } + + preActions := make([]replicationrecoveryplans.RecoveryPlanAction, 0) + for _, preActionInput := range group.PreAction { + + failoverDirections := make([]replicationrecoveryplans.PossibleOperationsDirections, 0) + for _, direction := range preActionInput.FailOverDirections { + failoverDirections = append(failoverDirections, replicationrecoveryplans.PossibleOperationsDirections(direction)) + } + + failoverTypes := make([]replicationrecoveryplans.ReplicationProtectedItemOperation, 0) + for _, failoveType := range preActionInput.FailOverTypes { + failoverTypes = append(failoverTypes, replicationrecoveryplans.ReplicationProtectedItemOperation(failoveType)) + } + + preActions = append(preActions, replicationrecoveryplans.RecoveryPlanAction{ + ActionName: preActionInput.Name, + FailoverDirections: failoverDirections, + FailoverTypes: failoverTypes, + CustomDetails: expandActionDetail(preActionInput), + }) + } + + postActions := make([]replicationrecoveryplans.RecoveryPlanAction, 0) + for _, postActionInput := range group.PostAction { + + failoverDirections := make([]replicationrecoveryplans.PossibleOperationsDirections, 0) + for _, direction := range postActionInput.FailOverDirections { + failoverDirections = append(failoverDirections, replicationrecoveryplans.PossibleOperationsDirections(direction)) + } + + failoverTypes := make([]replicationrecoveryplans.ReplicationProtectedItemOperation, 0) + for _, failoveType := range postActionInput.FailOverTypes { + failoverTypes = append(failoverTypes, replicationrecoveryplans.ReplicationProtectedItemOperation(failoveType)) + } + + postActions = append(postActions, replicationrecoveryplans.RecoveryPlanAction{ + ActionName: postActionInput.Name, + FailoverDirections: failoverDirections, + FailoverTypes: failoverTypes, + CustomDetails: expandActionDetail(postActionInput), + }) + } + + output = append(output, replicationrecoveryplans.RecoveryPlanGroup{ + GroupType: group.GroupType, + ReplicationProtectedItems: &protectedItems, + StartGroupActions: &preActions, + EndGroupActions: &postActions, + }) + + } + return output, nil +} + +func validateRecoverGroup(input []RecoveryGroupModel) (bool, error) { + bootCount := 0 + shutdownCount := 0 + failoverCount := 0 + for _, group := range input { + if group.GroupType == replicationrecoveryplans.RecoveryPlanGroupTypeBoot { + bootCount += 1 + } + if group.GroupType == replicationrecoveryplans.RecoveryPlanGroupTypeFailover { + failoverCount += 1 + } + if group.GroupType == replicationrecoveryplans.RecoveryPlanGroupTypeShutdown { + shutdownCount += 1 + } + } + if bootCount == 0 || shutdownCount == 0 || failoverCount == 0 { + return false, fmt.Errorf("every group type needs at least one recovery group") + } + return true, nil +} + +func flattenRecoveryGroups(input []replicationrecoveryplans.RecoveryPlanGroup) []RecoveryGroupModel { + output := make([]RecoveryGroupModel, 0) + for _, groupItem := range input { + recoveryGroupOutput := RecoveryGroupModel{} + recoveryGroupOutput.GroupType = groupItem.GroupType + if groupItem.ReplicationProtectedItems != nil { + recoveryGroupOutput.ReplicatedProtectedItems = flattenRecoveryPlanProtectedItems(groupItem.ReplicationProtectedItems) + } + if groupItem.StartGroupActions != nil { + recoveryGroupOutput.PreAction = flattenRecoveryPlanActions(groupItem.StartGroupActions) + } + if groupItem.EndGroupActions != nil { + recoveryGroupOutput.PostAction = flattenRecoveryPlanActions(groupItem.EndGroupActions) + } + output = append(output, recoveryGroupOutput) + } + return output +} + +func expandActionDetail(input ActionModel) (output replicationrecoveryplans.RecoveryPlanActionDetails) { + switch input.ActionDetailType { + case "AutomationRunbookActionDetails": + output = replicationrecoveryplans.RecoveryPlanAutomationRunbookActionDetails{ + RunbookId: utils.String(input.RunbookId), + FabricLocation: input.FabricLocation, + } + case "ManualActionDetails": + output = replicationrecoveryplans.RecoveryPlanManualActionDetails{ + Description: utils.String(input.ManualActionInstruction), + } + case "ScriptActionDetails": + output = replicationrecoveryplans.RecoveryPlanScriptActionDetails{ + Path: input.ScriptPath, + FabricLocation: input.FabricLocation, + } + } + return +} + +func flattenRecoveryPlanProtectedItems(input *[]replicationrecoveryplans.RecoveryPlanProtectedItem) []string { + protectedItemOutputs := make([]string, 0) + for _, protectedItem := range *input { + protectedItemOutputs = append(protectedItemOutputs, handleAzureSdkForGoBug2824(*protectedItem.Id)) + } + return protectedItemOutputs +} + +func flattenRecoveryPlanActions(input *[]replicationrecoveryplans.RecoveryPlanAction) []ActionModel { + actionOutputs := make([]ActionModel, 0) + for _, action := range *input { + actionOutput := ActionModel{ + Name: action.ActionName, + } + switch detail := action.CustomDetails.(type) { + case replicationrecoveryplans.RecoveryPlanAutomationRunbookActionDetails: + actionOutput.ActionDetailType = "AutomationRunbookActionDetails" + actionOutput.FabricLocation = detail.FabricLocation + if detail.RunbookId != nil { + actionOutput.RunbookId = *detail.RunbookId + } + case replicationrecoveryplans.RecoveryPlanManualActionDetails: + actionOutput.ActionDetailType = "ManualActionDetails" + if detail.Description != nil { + actionOutput.ManualActionInstruction = *detail.Description + } + case replicationrecoveryplans.RecoveryPlanScriptActionDetails: + actionOutput.ActionDetailType = "ScriptActionDetails" + actionOutput.ScriptPath = detail.Path + actionOutput.FabricLocation = detail.FabricLocation + } + + failoverDirections := make([]string, 0) + for _, failoverDirection := range action.FailoverDirections { + failoverDirections = append(failoverDirections, string(failoverDirection)) + } + + failoverTypes := make([]string, 0) + for _, failoverType := range action.FailoverTypes { + failoverTypes = append(failoverTypes, string(failoverType)) + } + actionOutput.FailOverDirections = failoverDirections + actionOutput.FailOverTypes = failoverTypes + actionOutputs = append(actionOutputs, actionOutput) + } + return actionOutputs +} diff --git a/internal/services/recoveryservices/site_recovery_replication_recovery_plan_resource_test.go b/internal/services/recoveryservices/site_recovery_replication_recovery_plan_resource_test.go new file mode 100644 index 000000000000..0f8e34300a65 --- /dev/null +++ b/internal/services/recoveryservices/site_recovery_replication_recovery_plan_resource_test.go @@ -0,0 +1,398 @@ +package recoveryservices_test + +import ( + "context" + "fmt" + "strings" + "testing" + + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type SiteRecoveryReplicationRecoveryPlan struct{} + +func TestAccSiteRecoveryReplicationRecoveryPlan_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_site_recovery_replication_recovery_plan", "test") + r := SiteRecoveryReplicationRecoveryPlan{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSiteRecoveryReplicationRecoveryPlan_withPreActions(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_site_recovery_replication_recovery_plan", "test") + r := SiteRecoveryReplicationRecoveryPlan{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withPreActions(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSiteRecoveryReplicationRecoveryPlan_withPostActions(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_site_recovery_replication_recovery_plan", "test") + r := SiteRecoveryReplicationRecoveryPlan{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withPostActions(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (SiteRecoveryReplicationRecoveryPlan) template(data acceptance.TestData) string { + tags := "" + if strings.HasPrefix(strings.ToLower(data.Client().SubscriptionID), "85b3dbca") { + tags = ` + tags = { + "azsecpack" = "nonprod" + "platformsettings.host_environment.service.platform_optedin_for_rootcerts" = "true" + } +` + } + return fmt.Sprintf(` +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-recovery-%[1]d-1" + location = "%[3]s" +} + +resource "azurerm_resource_group" "test2" { + name = "acctestRG-recovery-%[1]d-2" + location = "%[4]s" +} + +resource "azurerm_recovery_services_vault" "test" { + name = "acctest-vault-%[1]d" + location = azurerm_resource_group.test2.location + resource_group_name = azurerm_resource_group.test2.name + sku = "Standard" + + soft_delete_enabled = false +} + +resource "azurerm_site_recovery_fabric" "test1" { + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + name = "acctest-fabric1-%[1]d" + location = azurerm_resource_group.test.location +} + +resource "azurerm_site_recovery_fabric" "test2" { + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + name = "acctest-fabric2-%[1]d" + location = azurerm_resource_group.test2.location + depends_on = [azurerm_site_recovery_fabric.test1] +} + +resource "azurerm_site_recovery_protection_container" "test1" { + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + name = "acctest-protection-cont1-%[1]d" +} + +resource "azurerm_site_recovery_protection_container" "test2" { + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + recovery_fabric_name = azurerm_site_recovery_fabric.test2.name + name = "acctest-protection-cont2-%[1]d" +} + +resource "azurerm_site_recovery_replication_policy" "test" { + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + name = "acctest-policy-%[1]d" + recovery_point_retention_in_minutes = 24 * 60 + application_consistent_snapshot_frequency_in_minutes = 4 * 60 +} + +resource "azurerm_site_recovery_protection_container_mapping" "test" { + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + recovery_source_protection_container_name = azurerm_site_recovery_protection_container.test1.name + recovery_target_protection_container_id = azurerm_site_recovery_protection_container.test2.id + recovery_replication_policy_id = azurerm_site_recovery_replication_policy.test.id + name = "mapping-%[1]d" +} + +resource "azurerm_virtual_network" "test1" { + name = "net-%[1]d" + resource_group_name = azurerm_resource_group.test.name + address_space = ["192.168.1.0/24"] + location = azurerm_site_recovery_fabric.test1.location +} + +resource "azurerm_subnet" "test1" { + name = "snet-%[1]d" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test1.name + address_prefixes = ["192.168.1.0/24"] +} + +resource "azurerm_virtual_network" "test2" { + name = "net-%[1]d" + resource_group_name = azurerm_resource_group.test2.name + address_space = ["192.168.2.0/24"] + location = azurerm_site_recovery_fabric.test2.location +} + +resource "azurerm_subnet" "test2_1" { + name = "acctest-snet-%[1]d_1" + resource_group_name = "${azurerm_resource_group.test2.name}" + virtual_network_name = "${azurerm_virtual_network.test2.name}" + address_prefixes = ["192.168.2.0/27"] +} + +resource "azurerm_subnet" "test2_2" { + name = "snet-%[1]d_2" + resource_group_name = "${azurerm_resource_group.test2.name}" + virtual_network_name = "${azurerm_virtual_network.test2.name}" + address_prefixes = ["192.168.2.32/27"] +} + +resource "azurerm_site_recovery_network_mapping" "test" { + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + name = "mapping-%[1]d" + source_recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + target_recovery_fabric_name = azurerm_site_recovery_fabric.test2.name + source_network_id = azurerm_virtual_network.test1.id + target_network_id = azurerm_virtual_network.test2.id +} + +resource "azurerm_network_interface" "test" { + name = "vm-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + ip_configuration { + name = "vm-%[1]d" + subnet_id = azurerm_subnet.test1.id + private_ip_address_allocation = "Dynamic" + } +} + +resource "azurerm_virtual_machine" "test" { + name = "vm-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + vm_size = "Standard_B1s" + + delete_os_disk_on_termination = true + + storage_image_reference { + publisher = "OpenLogic" + offer = "CentOS" + sku = "7.5" + version = "latest" + } + + storage_os_disk { + name = "disk-%[1]d" + os_type = "Linux" + caching = "ReadWrite" + create_option = "FromImage" + managed_disk_type = "Premium_LRS" + } + + os_profile { + admin_username = "testadmin" + admin_password = "Password1234!" + computer_name = "vm-%[1]d" + } + + os_profile_linux_config { + disable_password_authentication = false + } + network_interface_ids = [azurerm_network_interface.test.id] + + %[5]s +} + +resource "azurerm_storage_account" "test" { + name = "acct%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + account_tier = "Standard" + account_replication_type = "LRS" +} + + +resource "azurerm_site_recovery_replicated_vm" "test" { + name = "repl-%[2]d" + resource_group_name = azurerm_resource_group.test2.name + recovery_vault_name = azurerm_recovery_services_vault.test.name + source_vm_id = azurerm_virtual_machine.test.id + source_recovery_fabric_name = azurerm_site_recovery_fabric.test1.name + recovery_replication_policy_id = azurerm_site_recovery_replication_policy.test.id + source_recovery_protection_container_name = azurerm_site_recovery_protection_container.test1.name + + target_resource_group_id = azurerm_resource_group.test2.id + target_recovery_fabric_id = azurerm_site_recovery_fabric.test2.id + target_recovery_protection_container_id = azurerm_site_recovery_protection_container.test2.id + + managed_disk { + disk_id = azurerm_virtual_machine.test.storage_os_disk[0].managed_disk_id + staging_storage_account_id = azurerm_storage_account.test.id + target_resource_group_id = azurerm_resource_group.test2.id + target_disk_type = "Premium_LRS" + target_replica_disk_type = "Premium_LRS" + } + + network_interface { + source_network_interface_id = azurerm_network_interface.test.id + target_subnet_name = "snet-%[2]d_2" + } + + depends_on = [ + azurerm_site_recovery_protection_container_mapping.test, + azurerm_site_recovery_network_mapping.test, + ] +} +`, data.RandomInteger, data.RandomInteger, data.Locations.Primary, data.Locations.Secondary, tags) +} + +func (r SiteRecoveryReplicationRecoveryPlan) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_site_recovery_replication_recovery_plan" "test" { + name = "acctest-%[2]d" + recovery_vault_id = azurerm_recovery_services_vault.test.id + source_recovery_fabric_id = azurerm_site_recovery_fabric.test1.id + target_recovery_fabric_id = azurerm_site_recovery_fabric.test2.id + + recovery_group { + type = "Boot" + replicated_protected_items = [azurerm_site_recovery_replicated_vm.test.id] + } + + recovery_group { + type = "Failover" + } + + recovery_group { + type = "Shutdown" + } +} +`, r.template(data), data.RandomInteger) +} + +func (r SiteRecoveryReplicationRecoveryPlan) withPreActions(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_site_recovery_replication_recovery_plan" "test" { + name = "acctest-%[2]d" + recovery_vault_id = azurerm_recovery_services_vault.test.id + source_recovery_fabric_id = azurerm_site_recovery_fabric.test1.id + target_recovery_fabric_id = azurerm_site_recovery_fabric.test2.id + + recovery_group { + type = "Boot" + replicated_protected_items = [azurerm_site_recovery_replicated_vm.test.id] + pre_action { + name = "testPreAction" + type = "ManualActionDetails" + fail_over_directions = ["PrimaryToRecovery"] + fail_over_types = ["TestFailover"] + manual_action_instruction = "test instruction" + } + } + + recovery_group { + type = "Failover" + } + + recovery_group { + type = "Shutdown" + } +} +`, r.template(data), data.RandomInteger) +} + +func (r SiteRecoveryReplicationRecoveryPlan) withPostActions(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_site_recovery_replication_recovery_plan" "test" { + name = "acctest-%[2]d" + recovery_vault_id = azurerm_recovery_services_vault.test.id + source_recovery_fabric_id = azurerm_site_recovery_fabric.test1.id + target_recovery_fabric_id = azurerm_site_recovery_fabric.test2.id + + recovery_group { + type = "Boot" + replicated_protected_items = [azurerm_site_recovery_replicated_vm.test.id] + post_action { + name = "testPreAction" + type = "ManualActionDetails" + fail_over_directions = ["PrimaryToRecovery"] + fail_over_types = ["TestFailover"] + manual_action_instruction = "test instruction" + } + } + + recovery_group { + type = "Failover" + } + + recovery_group { + type = "Shutdown" + } + +} +`, r.template(data), data.RandomInteger) + +} + +func (r SiteRecoveryReplicationRecoveryPlan) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := replicationrecoveryplans.ParseReplicationRecoveryPlanID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.RecoveryServices.ReplicationRecoveryPlansClient.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("reading site recovery replication plan (%s): %+v", id.String(), err) + } + + model := resp.Model + if model == nil { + return nil, fmt.Errorf("reading site recovery replication plan (%s): model is nil. ", id.String()) + } + + return utils.Bool(model.Id != nil), nil +} diff --git a/internal/services/recoveryservices/validate/vault_id.go b/internal/services/recoveryservices/validate/vault_id.go deleted file mode 100644 index 8ce3572918d3..000000000000 --- a/internal/services/recoveryservices/validate/vault_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/parse" -) - -func VaultID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.VaultID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/recoveryservices/validate/vault_id_test.go b/internal/services/recoveryservices/validate/vault_id_test.go deleted file mode 100644 index 80c32f0ffb17..000000000000 --- a/internal/services/recoveryservices/validate/vault_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestVaultID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/vault1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.RECOVERYSERVICES/VAULTS/VAULT1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := VaultID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/redis/client/client.go b/internal/services/redis/client/client.go index c42dac3e290d..625d06e9c72e 100644 --- a/internal/services/redis/client/client.go +++ b/internal/services/redis/client/client.go @@ -1,34 +1,14 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis" // nolint: staticcheck + "github.com/Azure/go-autorest/autorest" + redis_2021_06_01 "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) -type Client struct { - Client *redis.Client - FirewallRulesClient *redis.FirewallRulesClient - PatchSchedulesClient *redis.PatchSchedulesClient - LinkedServerClient *redis.LinkedServerClient -} - -func NewClient(o *common.ClientOptions) *Client { - client := redis.NewClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&client.Client, o.ResourceManagerAuthorizer) - - FirewallRulesClient := redis.NewFirewallRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&FirewallRulesClient.Client, o.ResourceManagerAuthorizer) - - PatchSchedulesClient := redis.NewPatchSchedulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&PatchSchedulesClient.Client, o.ResourceManagerAuthorizer) - - LinkedServerClient := redis.NewLinkedServerClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&LinkedServerClient.Client, o.ResourceManagerAuthorizer) - - return &Client{ - Client: &client, - FirewallRulesClient: &FirewallRulesClient, - PatchSchedulesClient: &PatchSchedulesClient, - LinkedServerClient: &LinkedServerClient, - } +func NewClient(o *common.ClientOptions) *redis_2021_06_01.Client { + client := redis_2021_06_01.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) { + c.Authorizer = o.ResourceManagerAuthorizer + }) + return &client } diff --git a/internal/services/redis/migration/firewall_rule_v0_to_v1.go b/internal/services/redis/migration/firewall_rule_v0_to_v1.go new file mode 100644 index 000000000000..5b4022363cd0 --- /dev/null +++ b/internal/services/redis/migration/firewall_rule_v0_to_v1.go @@ -0,0 +1,61 @@ +package migration + +import ( + "context" + "log" + + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ pluginsdk.StateUpgrade = FirewallRuleV0ToV1{} + +type FirewallRuleV0ToV1 struct{} + +func (FirewallRuleV0ToV1) Schema() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "redis_cache_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "resource_group_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "start_ip": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "end_ip": { + Type: pluginsdk.TypeString, + Required: true, + }, + } +} + +func (FirewallRuleV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { + return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + oldIdRaw := rawState["id"].(string) + oldId, err := firewallrules.ParseFirewallRuleIDInsensitively(oldIdRaw) + if err != nil { + return rawState, err + } + + newId := oldId.ID() + log.Printf("[DEBUG] Updating ID from %q to %q", oldId, newId) + rawState["id"] = newId + + return rawState, nil + } +} diff --git a/internal/services/redis/migration/linked_server_v0_to_v1.go b/internal/services/redis/migration/linked_server_v0_to_v1.go new file mode 100644 index 000000000000..0c6d69cbc0c1 --- /dev/null +++ b/internal/services/redis/migration/linked_server_v0_to_v1.go @@ -0,0 +1,68 @@ +package migration + +import ( + "context" + "log" + + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ pluginsdk.StateUpgrade = LinkedServerV0ToV1{} + +type LinkedServerV0ToV1 struct{} + +func (LinkedServerV0ToV1) Schema() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "target_redis_cache_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "linked_redis_cache_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "linked_redis_cache_location": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "resource_group_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "server_role": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (LinkedServerV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { + return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + oldIdRaw := rawState["id"].(string) + oldId, err := redis.ParseLinkedServerIDInsensitively(oldIdRaw) + if err != nil { + return rawState, err + } + + newId := oldId.ID() + log.Printf("[DEBUG] Updating ID from %q to %q", oldId, newId) + rawState["id"] = newId + + return rawState, nil + } +} diff --git a/internal/services/redis/migration/redis_cache_v0_to_v1.go b/internal/services/redis/migration/redis_cache_v0_to_v1.go new file mode 100644 index 000000000000..5e5acabab0b9 --- /dev/null +++ b/internal/services/redis/migration/redis_cache_v0_to_v1.go @@ -0,0 +1,338 @@ +package migration + +import ( + "context" + "log" + "strings" + + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" +) + +var _ pluginsdk.StateUpgrade = RedisCacheV0ToV1{} + +type RedisCacheV0ToV1 struct{} + +func (RedisCacheV0ToV1) Schema() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "location": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "resource_group_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "zones": { + Type: pluginsdk.TypeSet, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "capacity": { + Type: pluginsdk.TypeInt, + Required: true, + }, + + "family": { + Type: pluginsdk.TypeString, + Required: true, + DiffSuppressFunc: suppress.CaseDifference, + }, + + "sku_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "minimum_tls_version": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "1.2", + }, + + "shard_count": { + Type: pluginsdk.TypeInt, + Optional: true, + }, + + // TODO 4.0: change this from enable_* to *_enabled + "enable_non_ssl_port": { + Type: pluginsdk.TypeBool, + Default: false, + Optional: true, + }, + + "subnet_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + }, + + "private_static_ip_address": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + + "redis_configuration": { + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "maxclients": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "maxmemory_delta": { + Type: pluginsdk.TypeInt, + Optional: true, + Computed: true, + }, + + "maxmemory_reserved": { + Type: pluginsdk.TypeInt, + Optional: true, + Computed: true, + }, + + "maxmemory_policy": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "volatile-lru", + }, + + "maxfragmentationmemory_reserved": { + Type: pluginsdk.TypeInt, + Optional: true, + Computed: true, + }, + + "rdb_backup_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + + "rdb_backup_frequency": { + Type: pluginsdk.TypeInt, + Optional: true, + }, + + "rdb_backup_max_snapshot_count": { + Type: pluginsdk.TypeInt, + Optional: true, + }, + + "rdb_storage_connection_string": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + }, + + "notify_keyspace_events": { + Type: pluginsdk.TypeString, + Optional: true, + }, + + "aof_backup_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + + "aof_storage_connection_string_0": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + }, + + "aof_storage_connection_string_1": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + }, + "enable_authentication": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + }, + }, + }, + + "patch_schedule": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "day_of_week": { + Type: pluginsdk.TypeString, + Required: true, + DiffSuppressFunc: suppress.CaseDifference, + }, + + "maintenance_window": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "PT5H", + }, + + "start_hour_utc": { + Type: pluginsdk.TypeInt, + Optional: true, + }, + }, + }, + }, + + "hostname": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "port": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "ssl_port": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "primary_access_key": { + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, + }, + + "secondary_access_key": { + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, + }, + + "primary_connection_string": { + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, + }, + + "secondary_connection_string": { + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, + }, + + "public_network_access_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "replicas_per_master": { + Type: pluginsdk.TypeInt, + Optional: true, + Computed: true, + }, + + "identity": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "type": { + Type: pluginsdk.TypeString, + Required: true, + }, + "identity_ids": { + Type: pluginsdk.TypeSet, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "principal_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "tenant_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "replicas_per_primary": { + Type: pluginsdk.TypeInt, + Optional: true, + Computed: true, + }, + + "tenant_settings": { + Type: pluginsdk.TypeMap, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "redis_version": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + DiffSuppressFunc: func(_, old, new string, _ *pluginsdk.ResourceData) bool { + n := strings.Split(old, ".") + if len(n) >= 1 { + newMajor := n[0] + return new == newMajor + } + return false + }, + }, + + "tags": { + Type: pluginsdk.TypeMap, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + } +} + +func (RedisCacheV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { + return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + oldIdRaw := rawState["id"].(string) + oldId, err := redis.ParseRediIDInsensitively(oldIdRaw) + if err != nil { + return rawState, err + } + + newId := oldId.ID() + log.Printf("[DEBUG] Updating ID from %q to %q", oldId, newId) + rawState["id"] = newId + + return rawState, nil + } +} diff --git a/internal/services/redis/parse/cache.go b/internal/services/redis/parse/cache.go deleted file mode 100644 index 0e08250d383f..000000000000 --- a/internal/services/redis/parse/cache.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type CacheId struct { - SubscriptionId string - ResourceGroup string - RediName string -} - -func NewCacheID(subscriptionId, resourceGroup, rediName string) CacheId { - return CacheId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - RediName: rediName, - } -} - -func (id CacheId) String() string { - segments := []string{ - fmt.Sprintf("Redi Name %q", id.RediName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Cache", segmentsStr) -} - -func (id CacheId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/Redis/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.RediName) -} - -// CacheID parses a Cache ID into an CacheId struct -func CacheID(input string) (*CacheId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := CacheId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.RediName, err = id.PopSegment("Redis"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/redis/parse/cache_test.go b/internal/services/redis/parse/cache_test.go deleted file mode 100644 index dd7ce94f36d9..000000000000 --- a/internal/services/redis/parse/cache_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = CacheId{} - -func TestCacheIDFormatter(t *testing.T) { - actual := NewCacheID("12345678-1234-9876-4563-123456789012", "resGroup1", "redis1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestCacheID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CacheId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing RediName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/", - Error: true, - }, - - { - // missing value for RediName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1", - Expected: &CacheId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - RediName: "redis1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.CACHE/REDIS/REDIS1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := CacheID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.RediName != v.Expected.RediName { - t.Fatalf("Expected %q but got %q for RediName", v.Expected.RediName, actual.RediName) - } - } -} diff --git a/internal/services/redis/parse/firewall_rule.go b/internal/services/redis/parse/firewall_rule.go deleted file mode 100644 index 4c2dab494c6d..000000000000 --- a/internal/services/redis/parse/firewall_rule.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type FirewallRuleId struct { - SubscriptionId string - ResourceGroup string - RediName string - Name string -} - -func NewFirewallRuleID(subscriptionId, resourceGroup, rediName, name string) FirewallRuleId { - return FirewallRuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - RediName: rediName, - Name: name, - } -} - -func (id FirewallRuleId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Redi Name %q", id.RediName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Firewall Rule", segmentsStr) -} - -func (id FirewallRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/Redis/%s/firewallRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.RediName, id.Name) -} - -// FirewallRuleID parses a FirewallRule ID into an FirewallRuleId struct -func FirewallRuleID(input string) (*FirewallRuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := FirewallRuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.RediName, err = id.PopSegment("Redis"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("firewallRules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/redis/parse/firewall_rule_test.go b/internal/services/redis/parse/firewall_rule_test.go deleted file mode 100644 index e2319ec099bd..000000000000 --- a/internal/services/redis/parse/firewall_rule_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = FirewallRuleId{} - -func TestFirewallRuleIDFormatter(t *testing.T) { - actual := NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "resGroup1", "redis1", "firewallRule1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/firewallRules/firewallRule1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestFirewallRuleID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *FirewallRuleId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing RediName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/", - Error: true, - }, - - { - // missing value for RediName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/firewallRules/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/firewallRules/firewallRule1", - Expected: &FirewallRuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - RediName: "redis1", - Name: "firewallRule1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.CACHE/REDIS/REDIS1/FIREWALLRULES/FIREWALLRULE1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := FirewallRuleID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.RediName != v.Expected.RediName { - t.Fatalf("Expected %q but got %q for RediName", v.Expected.RediName, actual.RediName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/redis/parse/linked_server.go b/internal/services/redis/parse/linked_server.go deleted file mode 100644 index e272199861cc..000000000000 --- a/internal/services/redis/parse/linked_server.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type LinkedServerId struct { - SubscriptionId string - ResourceGroup string - RediName string - Name string -} - -func NewLinkedServerID(subscriptionId, resourceGroup, rediName, name string) LinkedServerId { - return LinkedServerId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - RediName: rediName, - Name: name, - } -} - -func (id LinkedServerId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Redi Name %q", id.RediName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Linked Server", segmentsStr) -} - -func (id LinkedServerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/Redis/%s/linkedServers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.RediName, id.Name) -} - -// LinkedServerID parses a LinkedServer ID into an LinkedServerId struct -func LinkedServerID(input string) (*LinkedServerId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := LinkedServerId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.RediName, err = id.PopSegment("Redis"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("linkedServers"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/redis/parse/linked_server_test.go b/internal/services/redis/parse/linked_server_test.go deleted file mode 100644 index 567ed0f85ef0..000000000000 --- a/internal/services/redis/parse/linked_server_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = LinkedServerId{} - -func TestLinkedServerIDFormatter(t *testing.T) { - actual := NewLinkedServerID("12345678-1234-9876-4563-123456789012", "resGroup1", "redis1", "linkedServer1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/linkedServers/linkedServer1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestLinkedServerID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *LinkedServerId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing RediName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/", - Error: true, - }, - - { - // missing value for RediName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/linkedServers/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/linkedServers/linkedServer1", - Expected: &LinkedServerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - RediName: "redis1", - Name: "linkedServer1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.CACHE/REDIS/REDIS1/LINKEDSERVERS/LINKEDSERVER1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := LinkedServerID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.RediName != v.Expected.RediName { - t.Fatalf("Expected %q but got %q for RediName", v.Expected.RediName, actual.RediName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/redis/redis_cache_data_source.go b/internal/services/redis/redis_cache_data_source.go index a06f4b82febb..a8ecd87e2fed 100644 --- a/internal/services/redis/redis_cache_data_source.go +++ b/internal/services/redis/redis_cache_data_source.go @@ -4,16 +4,17 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" networkParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceRedisCache() *pluginsdk.Resource { @@ -220,43 +221,61 @@ func dataSourceRedisCache() *pluginsdk.Resource { Sensitive: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } func dataSourceRedisCacheRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Redis.Client + client := meta.(*clients.Client).Redis.Redis subscriptionId := meta.(*clients.Client).Account.SubscriptionId - patchSchedulesClient := meta.(*clients.Client).Redis.PatchSchedulesClient + patchSchedulesClient := meta.(*clients.Client).Redis.PatchSchedules ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewCacheID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.RediName) + id := redis.NewRediID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } + patchScheduleRedisId := patchschedules.NewRediID(id.SubscriptionId, id.ResourceGroupName, id.RedisName) + schedule, err := patchSchedulesClient.Get(ctx, patchScheduleRedisId) + if err != nil { + return fmt.Errorf("obtaining patch schedules for %s: %+v", id, err) + } + var patchSchedule []interface{} + if model := schedule.Model; model != nil { + patchSchedule = flattenRedisPatchSchedules(*schedule.Model) + } + + keys, err := client.ListKeys(ctx, id) + if err != nil { + return fmt.Errorf("listing keys for %s: %+v", id, err) + } + d.SetId(id.ID()) - d.Set("location", location.NormalizeNilable(resp.Location)) - d.Set("zones", zones.FlattenUntyped(resp.Zones)) + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + d.Set("zones", zones.FlattenUntyped(model.Zones)) - if sku := resp.Sku; sku != nil { + props := model.Properties + sku := props.Sku d.Set("capacity", sku.Capacity) d.Set("family", sku.Family) d.Set("sku_name", sku.Name) - } - props := resp.Properties - if props != nil { d.Set("ssl_port", props.SslPort) d.Set("hostname", props.HostName) - d.Set("minimum_tls_version", string(props.MinimumTLSVersion)) + minimumTlsVersion := string(redis.TlsVersionOnePointTwo) + if props.MinimumTlsVersion != nil { + minimumTlsVersion = string(*props.MinimumTlsVersion) + } + d.Set("minimum_tls_version", minimumTlsVersion) d.Set("port", props.Port) d.Set("enable_non_ssl_port", props.EnableNonSslPort) shardCount := 0 @@ -266,8 +285,8 @@ func dataSourceRedisCacheRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("shard_count", shardCount) d.Set("private_static_ip_address", props.StaticIP) subnetId := "" - if props.SubnetID != nil { - parsed, err := networkParse.SubnetIDInsensitively(*props.SubnetID) + if props.SubnetId != nil { + parsed, err := networkParse.SubnetIDInsensitively(*props.SubnetId) if err != nil { return err } @@ -275,39 +294,32 @@ func dataSourceRedisCacheRead(d *pluginsdk.ResourceData, meta interface{}) error subnetId = parsed.ID() } d.Set("subnet_id", subnetId) - } - redisConfiguration, err := flattenRedisConfiguration(resp.RedisConfiguration) - if err != nil { - return fmt.Errorf("flattening `redis_configuration`: %+v", err) - } - if err := d.Set("redis_configuration", redisConfiguration); err != nil { - return fmt.Errorf("setting `redis_configuration`: %+v", err) - } + redisConfiguration, err := flattenRedisConfiguration(props.RedisConfiguration) + if err != nil { + return fmt.Errorf("flattening `redis_configuration`: %+v", err) + } + if err := d.Set("redis_configuration", redisConfiguration); err != nil { + return fmt.Errorf("setting `redis_configuration`: %+v", err) + } - schedule, err := patchSchedulesClient.Get(ctx, id.ResourceGroup, id.RediName) - if err == nil { - patchSchedule := flattenRedisPatchSchedules(schedule) - if err = d.Set("patch_schedule", patchSchedule); err != nil { - return fmt.Errorf("setting `patch_schedule`: %+v", err) + enableSslPort := !*props.EnableNonSslPort + d.Set("primary_connection_string", getRedisConnectionString(*props.HostName, *props.SslPort, *keys.Model.PrimaryKey, enableSslPort)) + d.Set("secondary_connection_string", getRedisConnectionString(*props.HostName, *props.SslPort, *keys.Model.SecondaryKey, enableSslPort)) + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return fmt.Errorf("setting `tags`: %+v", err) } - } else { - d.Set("patch_schedule", []interface{}{}) } - keys, err := client.ListKeys(ctx, id.ResourceGroup, id.RediName) - if err != nil { - return err + if err = d.Set("patch_schedule", patchSchedule); err != nil { + return fmt.Errorf("setting `patch_schedule`: %+v", err) } - d.Set("primary_access_key", keys.PrimaryKey) - d.Set("secondary_access_key", keys.SecondaryKey) - - if props != nil { - enableSslPort := !*props.EnableNonSslPort - d.Set("primary_connection_string", getRedisConnectionString(*props.HostName, *props.SslPort, *keys.PrimaryKey, enableSslPort)) - d.Set("secondary_connection_string", getRedisConnectionString(*props.HostName, *props.SslPort, *keys.SecondaryKey, enableSslPort)) + if model := keys.Model; model != nil { + d.Set("primary_access_key", model.PrimaryKey) + d.Set("secondary_access_key", model.SecondaryKey) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/internal/services/redis/redis_cache_resource.go b/internal/services/redis/redis_cache_resource.go index 1f42d86bc906..7791a896396e 100644 --- a/internal/services/redis/redis_cache_resource.go +++ b/internal/services/redis/redis_cache_resource.go @@ -8,14 +8,16 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -23,9 +25,8 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/network" networkParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -46,7 +47,7 @@ func resourceRedisCache() *pluginsdk.Resource { Update: resourceRedisCacheUpdate, Delete: resourceRedisCacheDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.CacheID(id) + _, err := redis.ParseRediID(id) return err }), @@ -57,6 +58,11 @@ func resourceRedisCache() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(90 * time.Minute), }, + StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ + 0: migration.RedisCacheV0ToV1{}, + }), + SchemaVersion: 1, + Schema: map[string]*pluginsdk.Schema{ "name": { Type: pluginsdk.TypeString, @@ -76,9 +82,10 @@ func resourceRedisCache() *pluginsdk.Resource { }, "family": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validate.CacheFamily, + Type: pluginsdk.TypeString, + Required: true, + // TODO: this should become case-sensitive in v4.0 (true -> false and remove DiffSupressFunc) + ValidateFunc: validation.StringInSlice(redis.PossibleValuesForSkuFamily(), true), DiffSuppressFunc: suppress.CaseDifference, }, @@ -95,11 +102,11 @@ func resourceRedisCache() *pluginsdk.Resource { "minimum_tls_version": { Type: pluginsdk.TypeString, Optional: true, - Default: string(redis.TLSVersionOneFullStopTwo), + Default: string(redis.TlsVersionOnePointTwo), ValidateFunc: validation.StringInSlice([]string{ - string(redis.TLSVersionOneFullStopZero), - string(redis.TLSVersionOneFullStopOne), - string(redis.TLSVersionOneFullStopTwo), + string(redis.TlsVersionOnePointZero), + string(redis.TlsVersionOnePointOne), + string(redis.TlsVersionOnePointTwo), }, false), }, @@ -334,8 +341,9 @@ func resourceRedisCache() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, + CustomizeDiff: pluginsdk.CustomDiffWithAll( pluginsdk.ForceNewIfChange("sku_name", func(ctx context.Context, old, new, meta interface{}) bool { // downgrade the SKU is not supported, recreate the resource @@ -349,31 +357,20 @@ func resourceRedisCache() *pluginsdk.Resource { } func resourceRedisCacheCreate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Redis.Client - patchClient := meta.(*clients.Client).Redis.PatchSchedulesClient + client := meta.(*clients.Client).Redis.Redis + patchClient := meta.(*clients.Client).Redis.PatchSchedules subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[INFO] preparing arguments for Azure ARM Redis Cache creation.") - - location := azure.NormalizeLocation(d.Get("location").(string)) - enableNonSSLPort := d.Get("enable_non_ssl_port").(bool) - - capacity := int32(d.Get("capacity").(int)) - family := redis.SkuFamily(d.Get("family").(string)) - sku := redis.SkuName(d.Get("sku_name").(string)) - - t := d.Get("tags").(map[string]interface{}) - expandedTags := tags.Expand(t) - id := parse.NewCacheID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.RediName) + id := redis.NewRediID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing Redis Instance %s (resource group %q): %+v", id.RediName, id.ResourceGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_redis_cache", id.ID()) } @@ -388,55 +385,55 @@ func resourceRedisCacheCreate(d *pluginsdk.ResourceData, meta interface{}) error publicNetworkAccess = redis.PublicNetworkAccessDisabled } - redisIdentity, err := expandRedisIdentity(d.Get("identity").([]interface{})) + redisIdentity, err := identity.ExpandSystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf(`expanding "identity": %v`, err) } - parameters := redis.CreateParameters{ - Location: utils.String(location), - CreateProperties: &redis.CreateProperties{ - EnableNonSslPort: utils.Bool(enableNonSSLPort), - Sku: &redis.Sku{ - Capacity: utils.Int32(capacity), - Family: family, - Name: sku, + parameters := redis.RedisCreateParameters{ + Location: location.Normalize(d.Get("location").(string)), + Properties: redis.RedisCreateProperties{ + EnableNonSslPort: pointer.To(d.Get("enable_non_ssl_port").(bool)), + Sku: redis.Sku{ + Capacity: int64(d.Get("capacity").(int)), + Family: redis.SkuFamily(d.Get("family").(string)), + Name: redis.SkuName(d.Get("sku_name").(string)), }, - MinimumTLSVersion: redis.TLSVersion(d.Get("minimum_tls_version").(string)), + MinimumTlsVersion: pointer.To(redis.TlsVersion(d.Get("minimum_tls_version").(string))), RedisConfiguration: redisConfiguration, - PublicNetworkAccess: publicNetworkAccess, + PublicNetworkAccess: pointer.To(publicNetworkAccess), }, Identity: redisIdentity, - Tags: expandedTags, + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } if v, ok := d.GetOk("shard_count"); ok { - shardCount := int32(v.(int)) - parameters.ShardCount = &shardCount + shardCount := int64(v.(int)) + parameters.Properties.ShardCount = &shardCount } if v, ok := d.GetOk("replicas_per_master"); ok { - parameters.ReplicasPerMaster = utils.Int32(int32(v.(int))) + parameters.Properties.ReplicasPerMaster = utils.Int64(int64(v.(int))) } if v, ok := d.GetOk("replicas_per_primary"); ok { - parameters.ReplicasPerPrimary = utils.Int32(int32(v.(int))) + parameters.Properties.ReplicasPerPrimary = utils.Int64(int64(v.(int))) } if v, ok := d.GetOk("redis_version"); ok { - parameters.RedisVersion = utils.String(v.(string)) + parameters.Properties.RedisVersion = utils.String(v.(string)) } if v, ok := d.GetOk("tenant_settings"); ok { - parameters.TenantSettings = expandTenantSettings(v.(map[string]interface{})) + parameters.Properties.TenantSettings = expandTenantSettings(v.(map[string]interface{})) } if v, ok := d.GetOk("private_static_ip_address"); ok { - parameters.StaticIP = utils.String(v.(string)) + parameters.Properties.StaticIP = utils.String(v.(string)) } if v, ok := d.GetOk("subnet_id"); ok { - parsed, parseErr := networkParse.SubnetIDInsensitively(v.(string)) + parsed, parseErr := networkParse.SubnetID(v.(string)) if parseErr != nil { return err } @@ -447,7 +444,7 @@ func resourceRedisCacheCreate(d *pluginsdk.ResourceData, meta interface{}) error locks.ByName(parsed.Name, network.SubnetResourceName) defer locks.UnlockByName(parsed.Name, network.SubnetResourceName) - parameters.SubnetID = utils.String(v.(string)) + parameters.Properties.SubnetId = utils.String(v.(string)) } if v, ok := d.GetOk("zones"); ok { @@ -457,33 +454,32 @@ func resourceRedisCacheCreate(d *pluginsdk.ResourceData, meta interface{}) error } } - future, err := client.Create(ctx, id.ResourceGroup, id.RediName, parameters) - if err != nil { - return fmt.Errorf("creating Redis Cache %q (Resource Group %q): %v", id.RediName, id.ResourceGroup, err) + if err := client.CreateThenPoll(ctx, id, parameters); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the create of Redis Cache %q (Resource Group %q): %v", id.RediName, id.ResourceGroup, err) + log.Printf("[DEBUG] Waiting for %s to become available", id) + deadline, ok := ctx.Deadline() + if !ok { + return fmt.Errorf("internal-error: context had no deadline") } - - log.Printf("[DEBUG] Waiting for Redis Cache %q (Resource Group %q) to become available", id.RediName, id.ResourceGroup) stateConf := &pluginsdk.StateChangeConf{ Pending: []string{"Scaling", "Updating", "Creating"}, Target: []string{"Succeeded"}, - Refresh: redisStateRefreshFunc(ctx, client, id.ResourceGroup, id.RediName), + Refresh: redisStateRefreshFunc(ctx, client, id), MinTimeout: 15 * time.Second, - Timeout: d.Timeout(pluginsdk.TimeoutCreate), + Timeout: time.Until(deadline), } - if _, err = stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for Redis Cache %q (Resource Group %q) to become available: %s", id.RediName, id.ResourceGroup, err) + return fmt.Errorf("waiting for %s to become available: %+v", id, err) } d.SetId(id.ID()) if patchSchedule != nil { - if _, err = patchClient.CreateOrUpdate(ctx, id.ResourceGroup, id.RediName, *patchSchedule); err != nil { - return fmt.Errorf("setting Redis Patch Schedule: %+v", err) + patchScheduleRedisId := patchschedules.NewRediID(id.SubscriptionId, id.ResourceGroupName, id.RedisName) + if _, err = patchClient.CreateOrUpdate(ctx, patchScheduleRedisId, *patchSchedule); err != nil { + return fmt.Errorf("setting Patch Schedule for %s: %+v", id, err) } } @@ -491,34 +487,29 @@ func resourceRedisCacheCreate(d *pluginsdk.ResourceData, meta interface{}) error } func resourceRedisCacheUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Redis.Client - patchClient := meta.(*clients.Client).Redis.PatchSchedulesClient + client := meta.(*clients.Client).Redis.Redis + patchClient := meta.(*clients.Client).Redis.PatchSchedules ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[INFO] preparing arguments for Azure ARM Redis Cache update.") - id, err := parse.CacheID(d.Id()) + id, err := redis.ParseRediID(d.Id()) if err != nil { return err } enableNonSSLPort := d.Get("enable_non_ssl_port").(bool) - capacity := int32(d.Get("capacity").(int)) - family := redis.SkuFamily(d.Get("family").(string)) - sku := redis.SkuName(d.Get("sku_name").(string)) - t := d.Get("tags").(map[string]interface{}) expandedTags := tags.Expand(t) - parameters := redis.UpdateParameters{ - UpdateProperties: &redis.UpdateProperties{ - MinimumTLSVersion: redis.TLSVersion(d.Get("minimum_tls_version").(string)), + parameters := redis.RedisUpdateParameters{ + Properties: &redis.RedisUpdateProperties{ + MinimumTlsVersion: pointer.To(redis.TlsVersion(d.Get("minimum_tls_version").(string))), EnableNonSslPort: utils.Bool(enableNonSSLPort), Sku: &redis.Sku{ - Capacity: utils.Int32(capacity), - Family: family, - Name: sku, + Capacity: int64(d.Get("capacity").(int)), + Family: redis.SkuFamily(d.Get("family").(string)), + Name: redis.SkuName(d.Get("sku_name").(string)), }, }, Tags: expandedTags, @@ -526,32 +517,32 @@ func resourceRedisCacheUpdate(d *pluginsdk.ResourceData, meta interface{}) error if v, ok := d.GetOk("shard_count"); ok { if d.HasChange("shard_count") { - shardCount := int32(v.(int)) - parameters.ShardCount = &shardCount + shardCount := int64(v.(int)) + parameters.Properties.ShardCount = &shardCount } } if v, ok := d.GetOk("replicas_per_master"); ok { if d.HasChange("replicas_per_master") { - parameters.ReplicasPerMaster = utils.Int32(int32(v.(int))) + parameters.Properties.ReplicasPerMaster = utils.Int64(int64(v.(int))) } } if v, ok := d.GetOk("replicas_per_primary"); ok { if d.HasChange("replicas_per_primary") { - parameters.ReplicasPerPrimary = utils.Int32(int32(v.(int))) + parameters.Properties.ReplicasPerPrimary = utils.Int64(int64(v.(int))) } } if v, ok := d.GetOk("redis_version"); ok { if d.HasChange("redis_version") { - parameters.RedisVersion = utils.String(v.(string)) + parameters.Properties.RedisVersion = utils.String(v.(string)) } } if v, ok := d.GetOk("tenant_settings"); ok { if d.HasChange("tenant_settings") { - parameters.TenantSettings = expandTenantSettings(v.(map[string]interface{})) + parameters.Properties.TenantSettings = expandTenantSettings(v.(map[string]interface{})) } } @@ -560,7 +551,7 @@ func resourceRedisCacheUpdate(d *pluginsdk.ResourceData, meta interface{}) error if !d.Get("public_network_access_enabled").(bool) { publicNetworkAccess = redis.PublicNetworkAccessDisabled } - parameters.PublicNetworkAccess = publicNetworkAccess + parameters.Properties.PublicNetworkAccess = pointer.To(publicNetworkAccess) } if d.HasChange("redis_configuration") { @@ -568,57 +559,58 @@ func resourceRedisCacheUpdate(d *pluginsdk.ResourceData, meta interface{}) error if err != nil { return fmt.Errorf("parsing Redis Configuration: %+v", err) } - parameters.RedisConfiguration = redisConfiguration + parameters.Properties.RedisConfiguration = redisConfiguration } - if _, err := client.Update(ctx, id.ResourceGroup, id.RediName, parameters); err != nil { - return fmt.Errorf("updating Redis Cache %q (Resource Group %q): %+v", id.RediName, id.ResourceGroup, err) + if _, err := client.Update(ctx, *id, parameters); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) } - log.Printf("[DEBUG] Waiting for Redis Cache %q (Resource Group %q) to become available", id.RediName, id.ResourceGroup) + log.Printf("[DEBUG] Waiting for %s to become available", *id) stateConf := &pluginsdk.StateChangeConf{ Pending: []string{"Scaling", "Updating", "Creating", "UpgradingRedisServerVersion"}, Target: []string{"Succeeded"}, - Refresh: redisStateRefreshFunc(ctx, client, id.ResourceGroup, id.RediName), + Refresh: redisStateRefreshFunc(ctx, client, *id), MinTimeout: 15 * time.Second, Timeout: d.Timeout(pluginsdk.TimeoutUpdate), } if _, err = stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for Redis Cache %q (Resource Group %q) to become available: %+v", id.RediName, id.ResourceGroup, err) + return fmt.Errorf("waiting for %s to become available: %+v", id, err) } // identity cannot be updated with sku,publicNetworkAccess,redisVersion etc. if d.HasChange("identity") { - redisIdentity, err := expandRedisIdentity(d.Get("identity").([]interface{})) + redisIdentity, err := identity.ExpandSystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf(`expanding "identity": %v`, err) } - identityParameter := redis.UpdateParameters{ + identityParameter := redis.RedisUpdateParameters{ Identity: redisIdentity, } - if _, err := client.Update(ctx, id.ResourceGroup, id.RediName, identityParameter); err != nil { - return fmt.Errorf("updating Redis Cache identity %q identity (Resource Group %q): %+v", id.RediName, id.ResourceGroup, err) + if _, err := client.Update(ctx, *id, identityParameter); err != nil { + return fmt.Errorf("updating identity for %s: %+v", *id, err) } - log.Printf("[DEBUG] Waiting for Redis Cache %q (Resource Group %q) to become available", id.RediName, id.ResourceGroup) + log.Printf("[DEBUG] Waiting for %s to become available", id) if _, err = stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for Redis Cache %q (Resource Group %q) to become available: %+v", id.RediName, id.ResourceGroup, err) + return fmt.Errorf("waiting for %s to become available: %+v", id, err) } } patchSchedule := expandRedisPatchSchedule(d) - if patchSchedule == nil || len(*patchSchedule.ScheduleEntries.ScheduleEntries) == 0 { - _, err = patchClient.Delete(ctx, id.ResourceGroup, id.RediName) + patchSchedulesRedisId := patchschedules.NewRediID(id.SubscriptionId, id.ResourceGroupName, id.RedisName) + if patchSchedule == nil || len(patchSchedule.Properties.ScheduleEntries) == 0 { + _, err = patchClient.Delete(ctx, patchSchedulesRedisId) if err != nil { - return fmt.Errorf("deleting Redis Patch Schedule: %+v", err) + return fmt.Errorf("deleting Patch Schedule for %s: %+v", *id, err) } } else { - _, err = patchClient.CreateOrUpdate(ctx, id.ResourceGroup, id.RediName, *patchSchedule) + _, err = patchClient.CreateOrUpdate(ctx, patchSchedulesRedisId, *patchSchedule) if err != nil { - return fmt.Errorf("setting Redis Patch Schedule: %+v", err) + return fmt.Errorf("setting Patch Schedule for %s: %+v", *id, err) } } @@ -626,61 +618,66 @@ func resourceRedisCacheUpdate(d *pluginsdk.ResourceData, meta interface{}) error } func resourceRedisCacheRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Redis.Client - patchSchedulesClient := meta.(*clients.Client).Redis.PatchSchedulesClient + client := meta.(*clients.Client).Redis.Redis + patchSchedulesClient := meta.(*clients.Client).Redis.PatchSchedules ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CacheID(d.Id()) + id, err := redis.ParseRediID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.RediName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("retrieving Redis Cache %q (Resource Group %q): %+v", id.RediName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - keysResp, err := client.ListKeys(ctx, id.ResourceGroup, id.RediName) + keysResp, err := client.ListKeys(ctx, *id) if err != nil { - return fmt.Errorf("listing keys for Redis Cache %q (Resource Group %q): %+v", id.RediName, id.ResourceGroup, err) + return fmt.Errorf("listing keys for %s: %+v", *id, err) } - schedule, err := patchSchedulesClient.Get(ctx, id.ResourceGroup, id.RediName) + patchSchedulesRedisId := patchschedules.NewRediID(id.SubscriptionId, id.ResourceGroupName, id.RedisName) + schedule, err := patchSchedulesClient.Get(ctx, patchSchedulesRedisId) + var patchSchedule []interface{} if err == nil { - patchSchedule := flattenRedisPatchSchedules(schedule) - if err = d.Set("patch_schedule", patchSchedule); err != nil { - return fmt.Errorf("setting `patch_schedule`: %+v", err) - } + patchSchedule = flattenRedisPatchSchedules(*schedule.Model) } - - redisIdentity, err := flattenRedisIdentity(resp.Identity) - if err != nil { - return fmt.Errorf("flattening `identity`: %+v", err) - } - if err := d.Set("identity", redisIdentity); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) + if err = d.Set("patch_schedule", patchSchedule); err != nil { + return fmt.Errorf("setting `patch_schedule`: %+v", err) } - d.Set("name", id.RediName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - d.Set("zones", zones.FlattenUntyped(resp.Zones)) + d.Set("name", id.RedisName) + d.Set("resource_group_name", id.ResourceGroupName) + if model := resp.Model; model != nil { + redisIdentity, err := identity.FlattenSystemAndUserAssignedMap(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + if err := d.Set("identity", redisIdentity); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } - if sku := resp.Sku; sku != nil { - d.Set("capacity", sku.Capacity) - d.Set("family", sku.Family) - d.Set("sku_name", sku.Name) - } + d.Set("location", location.Normalize(model.Location)) + d.Set("zones", zones.FlattenUntyped(model.Zones)) + + props := model.Properties + d.Set("capacity", int(props.Sku.Capacity)) + d.Set("family", string(props.Sku.Family)) + d.Set("sku_name", string(props.Sku.Name)) - if props := resp.Properties; props != nil { d.Set("ssl_port", props.SslPort) d.Set("hostname", props.HostName) - d.Set("minimum_tls_version", string(props.MinimumTLSVersion)) + minimumTlsVersion := string(redis.TlsVersionOnePointTwo) + if props.MinimumTlsVersion != nil { + minimumTlsVersion = string(*props.MinimumTlsVersion) + } + d.Set("minimum_tls_version", minimumTlsVersion) d.Set("port", props.Port) d.Set("enable_non_ssl_port", props.EnableNonSslPort) shardCount := 0 @@ -691,8 +688,8 @@ func resourceRedisCacheRead(d *pluginsdk.ResourceData, meta interface{}) error { d.Set("private_static_ip_address", props.StaticIP) subnetId := "" - if props.SubnetID != nil { - parsed, err := networkParse.SubnetIDInsensitively(*props.SubnetID) + if props.SubnetId != nil { + parsed, err := networkParse.SubnetIDInsensitively(*props.SubnetId) if err != nil { return err } @@ -701,51 +698,56 @@ func resourceRedisCacheRead(d *pluginsdk.ResourceData, meta interface{}) error { } d.Set("subnet_id", subnetId) - d.Set("public_network_access_enabled", props.PublicNetworkAccess == redis.PublicNetworkAccessEnabled) + publicNetworkAccessEnabled := true + if props.PublicNetworkAccess != nil { + publicNetworkAccessEnabled = *props.PublicNetworkAccess == redis.PublicNetworkAccessEnabled + } + d.Set("public_network_access_enabled", publicNetworkAccessEnabled) d.Set("replicas_per_master", props.ReplicasPerMaster) d.Set("replicas_per_primary", props.ReplicasPerPrimary) d.Set("redis_version", props.RedisVersion) d.Set("tenant_settings", flattenTenantSettings(props.TenantSettings)) - } - redisConfiguration, err := flattenRedisConfiguration(resp.RedisConfiguration) - if err != nil { - return fmt.Errorf("flattening `redis_configuration`: %+v", err) - } - if err := d.Set("redis_configuration", redisConfiguration); err != nil { - return fmt.Errorf("setting `redis_configuration`: %+v", err) - } - - d.Set("primary_access_key", keysResp.PrimaryKey) - d.Set("secondary_access_key", keysResp.SecondaryKey) + redisConfiguration, err := flattenRedisConfiguration(props.RedisConfiguration) + if err != nil { + return fmt.Errorf("flattening `redis_configuration`: %+v", err) + } + if err := d.Set("redis_configuration", redisConfiguration); err != nil { + return fmt.Errorf("setting `redis_configuration`: %+v", err) + } - if props := resp.Properties; props != nil { enableSslPort := !*props.EnableNonSslPort - d.Set("primary_connection_string", getRedisConnectionString(*props.HostName, *props.SslPort, *keysResp.PrimaryKey, enableSslPort)) - d.Set("secondary_connection_string", getRedisConnectionString(*props.HostName, *props.SslPort, *keysResp.SecondaryKey, enableSslPort)) + d.Set("primary_connection_string", getRedisConnectionString(*props.HostName, *props.SslPort, *keysResp.Model.PrimaryKey, enableSslPort)) + d.Set("secondary_connection_string", getRedisConnectionString(*props.HostName, *props.SslPort, *keysResp.Model.SecondaryKey, enableSslPort)) + d.Set("primary_access_key", keysResp.Model.PrimaryKey) + d.Set("secondary_access_key", keysResp.Model.SecondaryKey) + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return fmt.Errorf("setting `tags`: %+v", err) + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceRedisCacheDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Redis.Client + client := meta.(*clients.Client).Redis.Redis ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CacheID(d.Id()) + id, err := redis.ParseRediID(d.Id()) if err != nil { return err } - read, err := client.Get(ctx, id.ResourceGroup, id.RediName) + read, err := client.Get(ctx, *id) if err != nil { - return fmt.Errorf("retrieving Redis Cache %q (Resource Group %q): %+v", id.RediName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - if read.Properties == nil { - return fmt.Errorf("retrieving Redis Cache %q (Resource Group %q): `properties` was nil", id.RediName, id.ResourceGroup) + if read.Model == nil { + return fmt.Errorf("retrieving %s: `model` was nil", *id) } - if subnetID := read.Properties.SubnetID; subnetID != nil { + if subnetID := read.Model.Properties.SubnetId; subnetID != nil { parsed, parseErr := networkParse.SubnetIDInsensitively(*subnetID) if parseErr != nil { return err @@ -758,35 +760,34 @@ func resourceRedisCacheDelete(d *pluginsdk.ResourceData, meta interface{}) error defer locks.UnlockByName(parsed.Name, network.SubnetResourceName) } - future, err := client.Delete(ctx, id.ResourceGroup, id.RediName) - if err != nil { - return fmt.Errorf("deleting Redis Cache %q (Resource Group %q): %+v", id.RediName, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for deletion of Redis Cache %q (Resource Group %q): %+v", id.RediName, id.ResourceGroup, err) - } + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } return nil } -func redisStateRefreshFunc(ctx context.Context, client *redis.Client, resourceGroupName string, sgName string) pluginsdk.StateRefreshFunc { +func redisStateRefreshFunc(ctx context.Context, client *redis.RedisClient, id redis.RediId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, resourceGroupName, sgName) + res, err := client.Get(ctx, id) if err != nil { - return nil, "", fmt.Errorf("polling for status of Redis Cache %q (Resource Group %q): %+v", sgName, resourceGroupName, err) + return nil, "", fmt.Errorf("polling for status of %s: %+v", id, err) + } + + provisioningState := "" + if model := res.Model; model != nil && model.Properties.ProvisioningState != nil { + provisioningState = string(*res.Model.Properties.ProvisioningState) + } + if provisioningState == "" { + return nil, "", fmt.Errorf("polling for status of %s: `provisioningState` was nil", id) } - return res, string(res.ProvisioningState), nil + return res, provisioningState, nil } } -func expandRedisConfiguration(d *pluginsdk.ResourceData) (*redis.CommonPropertiesRedisConfiguration, error) { - output := &redis.CommonPropertiesRedisConfiguration{ - AdditionalProperties: map[string]interface{}{}, - } +func expandRedisConfiguration(d *pluginsdk.ResourceData) (*redis.RedisCommonPropertiesRedisConfiguration, error) { + output := &redis.RedisCommonPropertiesRedisConfiguration{} input := d.Get("redis_configuration").([]interface{}) if len(input) == 0 || input[0] == nil { @@ -837,12 +838,12 @@ func expandRedisConfiguration(d *pluginsdk.ResourceData) (*redis.CommonPropertie } if v := raw["notify_keyspace_events"].(string); v != "" { - output.AdditionalProperties["notify-keyspace-events"] = utils.String(v) + output.NotifyKeyspaceEvents = utils.String(v) } // AOF Backup if v := raw["aof_backup_enabled"].(bool); v { - output.AdditionalProperties["aof-backup-enabled"] = utils.String(strconv.FormatBool(v)) + output.AofBackupEnabled = utils.String(strconv.FormatBool(v)) } if v := raw["aof_storage_connection_string_0"].(string); v != "" { @@ -861,63 +862,62 @@ func expandRedisConfiguration(d *pluginsdk.ResourceData) (*redis.CommonPropertie } } else { value := isAuthNotRequiredAsString(authEnabled) - output.AdditionalProperties["authnotrequired"] = utils.String(value) + output.Authnotrequired = utils.String(value) } return output, nil } -func expandRedisPatchSchedule(d *pluginsdk.ResourceData) *redis.PatchSchedule { +func expandRedisPatchSchedule(d *pluginsdk.ResourceData) *patchschedules.RedisPatchSchedule { v, ok := d.GetOk("patch_schedule") if !ok { return nil } scheduleValues := v.([]interface{}) - entries := make([]redis.ScheduleEntry, 0) + entries := make([]patchschedules.ScheduleEntry, 0) for _, scheduleValue := range scheduleValues { vals := scheduleValue.(map[string]interface{}) dayOfWeek := vals["day_of_week"].(string) maintenanceWindow := vals["maintenance_window"].(string) startHourUtc := vals["start_hour_utc"].(int) - entry := redis.ScheduleEntry{ - DayOfWeek: redis.DayOfWeek(dayOfWeek), + entries = append(entries, patchschedules.ScheduleEntry{ + DayOfWeek: patchschedules.DayOfWeek(dayOfWeek), MaintenanceWindow: utils.String(maintenanceWindow), - StartHourUtc: utils.Int32(int32(startHourUtc)), - } - entries = append(entries, entry) + StartHourUtc: int64(startHourUtc), + }) } - schedule := redis.PatchSchedule{ - ScheduleEntries: &redis.ScheduleEntries{ - ScheduleEntries: &entries, + schedule := patchschedules.RedisPatchSchedule{ + Properties: patchschedules.ScheduleEntries{ + ScheduleEntries: entries, }, } return &schedule } -func expandTenantSettings(input map[string]interface{}) map[string]*string { - output := make(map[string]*string, len(input)) +func expandTenantSettings(input map[string]interface{}) *map[string]string { + output := make(map[string]string, len(input)) - for i, v := range input { - output[i] = utils.String(v.(string)) + for k, v := range input { + output[k] = v.(string) } - return output + return &output } -func flattenTenantSettings(input map[string]*string) map[string]*string { - output := make(map[string]*string, len(input)) +func flattenTenantSettings(input *map[string]string) map[string]string { + output := make(map[string]string) - for i, v := range input { - if v == nil { - continue + if input != nil { + for k, v := range *input { + output[k] = v } - output[i] = v } + return output } -func flattenRedisConfiguration(input *redis.CommonPropertiesRedisConfiguration) ([]interface{}, error) { +func flattenRedisConfiguration(input *redis.RedisCommonPropertiesRedisConfiguration) ([]interface{}, error) { outputs := make(map[string]interface{}) if input.Maxclients != nil { @@ -978,14 +978,14 @@ func flattenRedisConfiguration(input *redis.CommonPropertiesRedisConfiguration) if input.RdbStorageConnectionString != nil { outputs["rdb_storage_connection_string"] = *input.RdbStorageConnectionString } - if v := input.AdditionalProperties["notify-keyspace-events"]; v != nil { + if v := input.NotifyKeyspaceEvents; v != nil { outputs["notify_keyspace_events"] = v } - if v := input.AdditionalProperties["aof-backup-enabled"]; v != nil { - b, err := strconv.ParseBool(v.(string)) + if v := input.AofBackupEnabled; v != nil { + b, err := strconv.ParseBool(*v) if err != nil { - return nil, fmt.Errorf("parsing `aof-backup-enabled` %q: %+v", v, err) + return nil, fmt.Errorf("parsing `aof-backup-enabled` %q: %+v", *v, err) } outputs["aof_backup_enabled"] = b } @@ -998,15 +998,15 @@ func flattenRedisConfiguration(input *redis.CommonPropertiesRedisConfiguration) // `authnotrequired` is not set for instances launched outside a VNET outputs["enable_authentication"] = true - if v := input.AdditionalProperties["authnotrequired"]; v != nil { - outputs["enable_authentication"] = isAuthRequiredAsBool(v.(string)) + if v := input.Authnotrequired; v != nil { + outputs["enable_authentication"] = isAuthRequiredAsBool(*v) } return []interface{}{outputs}, nil } -func isAuthRequiredAsBool(not_required string) bool { - value := strings.ToLower(not_required) +func isAuthRequiredAsBool(notRequired string) bool { + value := strings.ToLower(notRequired) output := map[string]bool{ "yes": false, "no": true, @@ -1014,74 +1014,33 @@ func isAuthRequiredAsBool(not_required string) bool { return output[value] } -func isAuthNotRequiredAsString(auth_required bool) string { +func isAuthNotRequiredAsString(authRequired bool) string { output := map[bool]string{ true: "no", false: "yes", } - return output[auth_required] + return output[authRequired] } -func flattenRedisPatchSchedules(schedule redis.PatchSchedule) []interface{} { +func flattenRedisPatchSchedules(schedule patchschedules.RedisPatchSchedule) []interface{} { outputs := make([]interface{}, 0) - for _, entry := range *schedule.ScheduleEntries.ScheduleEntries { - output := make(map[string]interface{}) - - output["day_of_week"] = string(entry.DayOfWeek) - output["maintenance_window"] = *entry.MaintenanceWindow - output["start_hour_utc"] = int(*entry.StartHourUtc) + for _, entry := range schedule.Properties.ScheduleEntries { + maintenanceWindow := "" + if entry.MaintenanceWindow != nil { + maintenanceWindow = *entry.MaintenanceWindow + } - outputs = append(outputs, output) + outputs = append(outputs, map[string]interface{}{ + "day_of_week": string(entry.DayOfWeek), + "maintenance_window": maintenanceWindow, + "start_hour_utc": int(entry.StartHourUtc), + }) } return outputs } -func getRedisConnectionString(redisHostName string, sslPort int32, accessKey string, enableSslPort bool) string { +func getRedisConnectionString(redisHostName string, sslPort int64, accessKey string, enableSslPort bool) string { return fmt.Sprintf("%s:%d,password=%s,ssl=%t,abortConnect=False", redisHostName, sslPort, accessKey, enableSslPort) } - -func expandRedisIdentity(input []interface{}) (*redis.ManagedServiceIdentity, error) { - expanded, err := identity.ExpandSystemAndUserAssignedMap(input) - if err != nil { - return nil, err - } - - out := redis.ManagedServiceIdentity{ - Type: redis.ManagedServiceIdentityType(expanded.Type), - } - if expanded.Type == identity.TypeUserAssigned || expanded.Type == identity.TypeSystemAssignedUserAssigned { - out.UserAssignedIdentities = make(map[string]*redis.UserAssignedIdentity) - for k := range expanded.IdentityIds { - out.UserAssignedIdentities[k] = &redis.UserAssignedIdentity{ - // intentionally empty - } - } - } - return &out, nil -} - -func flattenRedisIdentity(input *redis.ManagedServiceIdentity) (*[]interface{}, error) { - var transform *identity.SystemAndUserAssignedMap - - if input != nil { - transform = &identity.SystemAndUserAssignedMap{ - Type: identity.Type(input.Type), - IdentityIds: make(map[string]identity.UserAssignedIdentityDetails), - } - if input.PrincipalID != nil { - transform.PrincipalId = input.PrincipalID.String() - } - if input.TenantID != nil { - transform.TenantId = input.TenantID.String() - } - for k, v := range input.UserAssignedIdentities { - transform.IdentityIds[k] = identity.UserAssignedIdentityDetails{ - ClientId: utils.String(v.ClientID.String()), - PrincipalId: utils.String(v.PrincipalID.String()), - } - } - } - return identity.FlattenSystemAndUserAssignedMap(transform) -} diff --git a/internal/services/redis/redis_cache_resource_test.go b/internal/services/redis/redis_cache_resource_test.go index 0a105e3ceb29..550e8fb7068b 100644 --- a/internal/services/redis/redis_cache_resource_test.go +++ b/internal/services/redis/redis_cache_resource_test.go @@ -6,10 +6,10 @@ import ( "strings" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -518,17 +518,17 @@ func TestAccRedisCache_SkuDowngrade(t *testing.T) { } func (t RedisCacheResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.CacheID(state.ID) + id, err := redis.ParseRediID(state.ID) if err != nil { return nil, err } - resp, err := clients.Redis.Client.Get(ctx, id.ResourceGroup, id.RediName) + resp, err := clients.Redis.Redis.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading Redis Cache (%s): %+v", id.String(), err) + return nil, fmt.Errorf("reading %s: %+v", *id, err) } - return utils.Bool(resp.Properties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (RedisCacheResource) basic(data acceptance.TestData, requireSSL bool) string { diff --git a/internal/services/redis/redis_firewall_rule_resource.go b/internal/services/redis/redis_firewall_rule_resource.go index fe989a7d7997..0cc51bb59a4f 100644 --- a/internal/services/redis/redis_firewall_rule_resource.go +++ b/internal/services/redis/redis_firewall_rule_resource.go @@ -5,16 +5,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceRedisFirewallRule() *pluginsdk.Resource { @@ -24,7 +24,7 @@ func resourceRedisFirewallRule() *pluginsdk.Resource { Update: resourceRedisFirewallRuleCreateUpdate, Delete: resourceRedisFirewallRuleDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.FirewallRuleID(id) + _, err := firewallrules.ParseFirewallRuleID(id) return err }), @@ -35,6 +35,11 @@ func resourceRedisFirewallRule() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, + StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ + 0: migration.FirewallRuleV0ToV1{}, + }), + SchemaVersion: 1, + Schema: map[string]*pluginsdk.Schema{ "name": { Type: pluginsdk.TypeString, @@ -73,90 +78,84 @@ func resourceRedisFirewallRule() *pluginsdk.Resource { } func resourceRedisFirewallRuleCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Redis.FirewallRulesClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + client := meta.(*clients.Client).Redis.FirewallRules ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[INFO] preparing arguments for AzureRM Redis Firewall Rule creation.") - - startIP := d.Get("start_ip").(string) - endIP := d.Get("end_ip").(string) - subscriptionId := meta.(*clients.Client).Account.SubscriptionId - resourceId := parse.NewFirewallRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("redis_cache_name").(string), d.Get("name").(string)) + id := firewallrules.NewFirewallRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("redis_cache_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, resourceId.ResourceGroup, resourceId.RediName, resourceId.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing Firewall Rule %q (Redis Cache %q / Resource Group %q): %+v", resourceId.Name, resourceId.RediName, resourceId.ResourceGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_redis_firewall_rule", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_redis_firewall_rule", id.ID()) } } - parameters := redis.FirewallRule{ - FirewallRuleProperties: &redis.FirewallRuleProperties{ - StartIP: utils.String(startIP), - EndIP: utils.String(endIP), + payload := firewallrules.RedisFirewallRule{ + Properties: firewallrules.RedisFirewallRuleProperties{ + StartIP: d.Get("start_ip").(string), + EndIP: d.Get("end_ip").(string), }, } - if _, err := client.CreateOrUpdate(ctx, resourceId.ResourceGroup, resourceId.RediName, resourceId.Name, parameters); err != nil { - return fmt.Errorf("creating Firewall Rule %q (Redis Cache %q / Resource Group %q): %+v", resourceId.Name, resourceId.RediName, resourceId.ResourceGroup, err) + if _, err := client.CreateOrUpdate(ctx, id, payload); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) return resourceRedisFirewallRuleRead(d, meta) } func resourceRedisFirewallRuleRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Redis.FirewallRulesClient + client := meta.(*clients.Client).Redis.FirewallRules ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FirewallRuleID(d.Id()) + id, err := firewallrules.ParseFirewallRuleID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.RediName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Firewall Rule %q was not found in Redis Cache %q / Resource Group %q - removing from state", id.Name, id.RediName, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Firewall Rule %q (Redis Cache %q / Resource Group %q): %+v", id.Name, id.RediName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("redis_cache_name", id.RediName) - d.Set("resource_group_name", id.ResourceGroup) - if props := resp.FirewallRuleProperties; props != nil { - d.Set("start_ip", props.StartIP) - d.Set("end_ip", props.EndIP) + d.Set("name", id.FirewallRuleName) + d.Set("redis_cache_name", id.RedisName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("end_ip", model.Properties.EndIP) + d.Set("start_ip", model.Properties.StartIP) } return nil } func resourceRedisFirewallRuleDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Redis.FirewallRulesClient + client := meta.(*clients.Client).Redis.FirewallRules ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FirewallRuleID(d.Id()) + id, err := firewallrules.ParseFirewallRuleID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.RediName, id.Name) - if err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting Firewall Rule %q (Redis Cache %q / Resource Group %q): %+v", id.Name, id.RediName, id.ResourceGroup, err) - } + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/internal/services/redis/redis_firewall_rule_resource_test.go b/internal/services/redis/redis_firewall_rule_resource_test.go index cbb33791e852..7e2d4e06f8a5 100644 --- a/internal/services/redis/redis_firewall_rule_resource_test.go +++ b/internal/services/redis/redis_firewall_rule_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -83,17 +83,17 @@ func TestAccRedisFirewallRule_update(t *testing.T) { } func (t RedisFirewallRuleResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.FirewallRuleID(state.ID) + id, err := firewallrules.ParseFirewallRuleID(state.ID) if err != nil { return nil, err } - resp, err := clients.Redis.FirewallRulesClient.Get(ctx, id.ResourceGroup, id.RediName, id.Name) + resp, err := clients.Redis.FirewallRules.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading Redis Firewall Rule (%s): %+v", id.String(), err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.FirewallRuleProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (RedisFirewallRuleResource) basic(data acceptance.TestData) string { diff --git a/internal/services/redis/redis_linked_server_resource.go b/internal/services/redis/redis_linked_server_resource.go index 04fec875173f..abe889bf3c7b 100644 --- a/internal/services/redis/redis_linked_server_resource.go +++ b/internal/services/redis/redis_linked_server_resource.go @@ -6,16 +6,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceRedisLinkedServer() *pluginsdk.Resource { @@ -24,7 +24,7 @@ func resourceRedisLinkedServer() *pluginsdk.Resource { Read: resourceRedisLinkedServerRead, Delete: resourceRedisLinkedServerDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.LinkedServerID(id) + _, err := redis.ParseLinkedServerID(id) return err }), @@ -35,6 +35,11 @@ func resourceRedisLinkedServer() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(60 * time.Minute), }, + StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ + 0: migration.LinkedServerV0ToV1{}, + }), + SchemaVersion: 1, + Schema: map[string]*pluginsdk.Schema{ "target_redis_cache_name": { Type: pluginsdk.TypeString, @@ -47,7 +52,7 @@ func resourceRedisLinkedServer() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.CacheID, + ValidateFunc: redis.ValidateRediID, }, "linked_redis_cache_location": commonschema.Location(), @@ -73,168 +78,170 @@ func resourceRedisLinkedServer() *pluginsdk.Resource { } func resourceRedisLinkedServerCreate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Redis.LinkedServerClient + client := meta.(*clients.Client).Redis.Redis ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[INFO] preparing arguments for Redis Linked Server creation.") linkedRedisCacheId := d.Get("linked_redis_cache_id").(string) linkedRedisCacheLocation := d.Get("linked_redis_cache_location").(string) serverRole := redis.ReplicationRole(d.Get("server_role").(string)) // The name needs to match the linked_redis_cache_id - cacheId, err := parse.CacheID(linkedRedisCacheId) + cacheId, err := redis.ParseRediID(linkedRedisCacheId) if err != nil { return err } subscriptionId := meta.(*clients.Client).Account.SubscriptionId - resourceId := parse.NewLinkedServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("target_redis_cache_name").(string), cacheId.RediName) + id := redis.NewLinkedServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("target_redis_cache_name").(string), cacheId.RedisName) if d.IsNewResource() { - existing, err := client.Get(ctx, resourceId.ResourceGroup, resourceId.RediName, resourceId.Name) + existing, err := client.LinkedServerGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing Linked Server %q (Redis Cache %q / Resource Group %q): %+v", resourceId.Name, resourceId.RediName, resourceId.ResourceGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_redis_linked_server", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_redis_linked_server", id.ID()) } } - parameters := redis.LinkedServerCreateParameters{ - LinkedServerCreateProperties: &redis.LinkedServerCreateProperties{ - LinkedRedisCacheID: utils.String(linkedRedisCacheId), - LinkedRedisCacheLocation: utils.String(linkedRedisCacheLocation), + payload := redis.RedisLinkedServerCreateParameters{ + Properties: redis.RedisLinkedServerCreateProperties{ + LinkedRedisCacheId: linkedRedisCacheId, + LinkedRedisCacheLocation: location.Normalize(linkedRedisCacheLocation), ServerRole: serverRole, }, } - future, err := client.Create(ctx, resourceId.ResourceGroup, resourceId.RediName, resourceId.Name, parameters) - if err != nil { - return fmt.Errorf("waiting for creation of Linked Server %q (Redis Cache %q / Resource Group %q): %+v", resourceId.Name, resourceId.RediName, resourceId.ResourceGroup, err) + if err := client.LinkedServerCreateThenPoll(ctx, id, payload); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the creation of Linked Server %q (Redis Cache %q / Resource Group %q): %+v", resourceId.Name, resourceId.RediName, resourceId.ResourceGroup, err) + deadline, ok := ctx.Deadline() + if !ok { + return fmt.Errorf("internal-error: context had no deadline") } - - log.Printf("[DEBUG] Waiting for Linked Server %q (Redis Cache %q / Resource Group %q) to become available", resourceId.Name, resourceId.RediName, resourceId.ResourceGroup) + log.Printf("[DEBUG] Waiting for %s to become available", id) stateConf := &pluginsdk.StateChangeConf{ Pending: []string{"Linking", "Updating", "Creating", "Syncing"}, Target: []string{"Succeeded"}, - Refresh: redisLinkedServerStateRefreshFunc(ctx, client, resourceId), + Refresh: redisLinkedServerStateRefreshFunc(ctx, client, id), MinTimeout: 15 * time.Second, - Timeout: d.Timeout(pluginsdk.TimeoutCreate), + Timeout: time.Until(deadline), } - if _, err = stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for Linked Server %q (Redis Cache %q / Resource Group %q) to become available: %+v", resourceId.Name, resourceId.RediName, resourceId.ResourceGroup, err) + return fmt.Errorf("waiting for %s to become available: %+v", id, err) } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) return resourceRedisLinkedServerRead(d, meta) } func resourceRedisLinkedServerRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Redis.LinkedServerClient + client := meta.(*clients.Client).Redis.Redis ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.LinkedServerID(d.Id()) + id, err := redis.ParseLinkedServerID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.RediName, id.Name) + resp, err := client.LinkedServerGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Linked Server %q (Redis Cache %q / Resource Group %q) was not found - removing from state!", id.Name, id.RediName, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Linked Server %q (Redis Cache %q / Resource Group %q): %+v", id.Name, id.RediName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("target_redis_cache_name", id.RediName) - d.Set("resource_group_name", id.ResourceGroup) - if props := resp.LinkedServerProperties; props != nil { - linkedRedisCacheId := "" - if props.LinkedRedisCacheID != nil { - cacheId, err := parse.CacheID(*props.LinkedRedisCacheID) + d.Set("name", id.LinkedServerName) + d.Set("target_redis_cache_name", id.RedisName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + cacheId, err := redis.ParseRediIDInsensitively(props.LinkedRedisCacheId) if err != nil { - return err + return fmt.Errorf("parsing `linkedRedisCacheId` %q: %+v", props.LinkedRedisCacheId, err) } + d.Set("linked_redis_cache_id", cacheId.ID()) - linkedRedisCacheId = cacheId.ID() + d.Set("linked_redis_cache_location", location.Normalize(props.LinkedRedisCacheLocation)) + d.Set("server_role", string(props.ServerRole)) } - d.Set("linked_redis_cache_id", linkedRedisCacheId) - - d.Set("linked_redis_cache_location", props.LinkedRedisCacheLocation) - d.Set("server_role", string(props.ServerRole)) } return nil } func resourceRedisLinkedServerDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Redis.LinkedServerClient + client := meta.(*clients.Client).Redis.Redis ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.LinkedServerID(d.Id()) + id, err := redis.ParseLinkedServerID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.RediName, id.Name) - if err != nil { - if !utils.ResponseWasNotFound(resp) { - return fmt.Errorf("deleting Linked Server %q (Redis Cache %q / Resource Group %q): %+v", id.Name, id.RediName, id.ResourceGroup, err) - } + if _, err := client.LinkedServerDelete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } // No LinkedServerDeleteFuture // https://github.com/Azure/azure-sdk-for-go/issues/12159 - log.Printf("[DEBUG] Waiting for Linked Server %q (Redis Cache %q / Resource Group %q) to be eventually deleted", id.Name, id.RediName, id.ResourceGroup) + deadline, ok := ctx.Deadline() + if !ok { + return fmt.Errorf("internal-error: context had no deadline") + } + log.Printf("[DEBUG] Waiting for %s to be eventually deleted", *id) stateConf := &pluginsdk.StateChangeConf{ Pending: []string{"Exists"}, Target: []string{"NotFound"}, Refresh: redisLinkedServerDeleteStateRefreshFunc(ctx, client, *id), MinTimeout: 10 * time.Second, ContinuousTargetOccurence: 10, - Timeout: d.Timeout(pluginsdk.TimeoutDelete), + Timeout: time.Until(deadline), } if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for Linked Server %q (Redis Cache %q / Resource Group %q) to be deleted: %+v", id.Name, id.RediName, id.ResourceGroup, err) + return fmt.Errorf("waiting for %s to be deleted: %+v", *id, err) } return nil } -func redisLinkedServerStateRefreshFunc(ctx context.Context, client *redis.LinkedServerClient, id parse.LinkedServerId) pluginsdk.StateRefreshFunc { +func redisLinkedServerStateRefreshFunc(ctx context.Context, client *redis.RedisClient, id redis.LinkedServerId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.RediName, id.Name) + resp, err := client.LinkedServerGet(ctx, id) if err != nil { - return nil, "", fmt.Errorf("retrieving status of Linked Server %q (Redis Cache %q / Resource Group %q): %+v", id.Name, id.RediName, id.ResourceGroup, err) + return nil, "", fmt.Errorf("retrieving status of %s: %+v", id, err) + } + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil && props.ProvisioningState != nil { + return resp, *props.ProvisioningState, nil + } } - return res, *res.LinkedServerProperties.ProvisioningState, nil + return nil, "", fmt.Errorf("retrieving %s: `model` was nil", id) } } -func redisLinkedServerDeleteStateRefreshFunc(ctx context.Context, client *redis.LinkedServerClient, id parse.LinkedServerId) pluginsdk.StateRefreshFunc { +func redisLinkedServerDeleteStateRefreshFunc(ctx context.Context, client *redis.RedisClient, id redis.LinkedServerId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.RediName, id.Name) + res, err := client.LinkedServerGet(ctx, id) if err != nil { - if utils.ResponseWasNotFound(res.Response) { + if response.WasNotFound(res.HttpResponse) { return "NotFound", "NotFound", nil } - return nil, "", fmt.Errorf("retrieving status of Linked Server %q (Redis Cache %q / Resource Group %q): %+v", id.Name, id.RediName, id.ResourceGroup, err) + return nil, "", fmt.Errorf("retrieving status of %s: %+v", id, err) } return res, "Exists", nil diff --git a/internal/services/redis/redis_linked_server_resource_test.go b/internal/services/redis/redis_linked_server_resource_test.go index f21e60e228d4..ea41bd8a2dd6 100644 --- a/internal/services/redis/redis_linked_server_resource_test.go +++ b/internal/services/redis/redis_linked_server_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -45,17 +45,17 @@ func TestAccRedisLinkedServer_requiresImport(t *testing.T) { } func (t RedisLinkedServerResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.LinkedServerID(state.ID) + id, err := redis.ParseLinkedServerID(state.ID) if err != nil { return nil, err } - resp, err := clients.Redis.LinkedServerClient.Get(ctx, id.ResourceGroup, id.RediName, id.Name) + resp, err := clients.Redis.Redis.LinkedServerGet(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading Redis Linked Server (%s): %+v", id.String(), err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(resp.LinkedServerProperties != nil), nil + return utils.Bool(resp.Model != nil), nil } func (RedisLinkedServerResource) basic(data acceptance.TestData) string { diff --git a/internal/services/redis/resourceids.go b/internal/services/redis/resourceids.go deleted file mode 100644 index 2fb6f944f42d..000000000000 --- a/internal/services/redis/resourceids.go +++ /dev/null @@ -1,5 +0,0 @@ -package redis - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Cache -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FirewallRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/firewallRules/firewallRule1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=LinkedServer -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/linkedServers/linkedServer1 diff --git a/internal/services/redis/validate/cache_family.go b/internal/services/redis/validate/cache_family.go deleted file mode 100644 index 63e6ebb2b7eb..000000000000 --- a/internal/services/redis/validate/cache_family.go +++ /dev/null @@ -1,19 +0,0 @@ -package validate - -import ( - "fmt" - "strings" -) - -func CacheFamily(v interface{}, _ string) (warnings []string, errors []error) { - value := strings.ToLower(v.(string)) - families := map[string]bool{ - "c": true, - "p": true, - } - - if !families[value] { - errors = append(errors, fmt.Errorf("Redis Family can only be C or P")) - } - return warnings, errors -} diff --git a/internal/services/redis/validate/cache_family_test.go b/internal/services/redis/validate/cache_family_test.go deleted file mode 100644 index 88c4202bfaa5..000000000000 --- a/internal/services/redis/validate/cache_family_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package validate - -import "testing" - -func TestCacheFamily_validation(t *testing.T) { - cases := []struct { - Value string - ErrCount int - }{ - { - Value: "C", - ErrCount: 0, - }, - { - Value: "P", - ErrCount: 0, - }, - { - Value: "c", - ErrCount: 0, - }, - { - Value: "p", - ErrCount: 0, - }, - { - Value: "a", - ErrCount: 1, - }, - { - Value: "b", - ErrCount: 1, - }, - { - Value: "D", - ErrCount: 1, - }, - } - - for _, tc := range cases { - _, errors := CacheFamily(tc.Value, "azurerm_redis_cache") - - if len(errors) != tc.ErrCount { - t.Fatalf("Expected the Azure RM Redis Cache Family to trigger a validation error") - } - } -} diff --git a/internal/services/redis/validate/cache_id.go b/internal/services/redis/validate/cache_id.go deleted file mode 100644 index 554962dd096b..000000000000 --- a/internal/services/redis/validate/cache_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/parse" -) - -func CacheID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.CacheID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/redis/validate/cache_id_test.go b/internal/services/redis/validate/cache_id_test.go deleted file mode 100644 index 5564986ca3e1..000000000000 --- a/internal/services/redis/validate/cache_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestCacheID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing RediName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/", - Valid: false, - }, - - { - // missing value for RediName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.CACHE/REDIS/REDIS1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := CacheID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/redis/validate/firewall_rule_id.go b/internal/services/redis/validate/firewall_rule_id.go deleted file mode 100644 index ac0d37e4e1b1..000000000000 --- a/internal/services/redis/validate/firewall_rule_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/parse" -) - -func FirewallRuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.FirewallRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/redis/validate/firewall_rule_id_test.go b/internal/services/redis/validate/firewall_rule_id_test.go deleted file mode 100644 index 197b128ad66d..000000000000 --- a/internal/services/redis/validate/firewall_rule_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestFirewallRuleID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing RediName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/", - Valid: false, - }, - - { - // missing value for RediName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/firewallRules/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/firewallRules/firewallRule1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.CACHE/REDIS/REDIS1/FIREWALLRULES/FIREWALLRULE1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := FirewallRuleID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/redis/validate/linked_server_id.go b/internal/services/redis/validate/linked_server_id.go deleted file mode 100644 index 7a76e9ce18c3..000000000000 --- a/internal/services/redis/validate/linked_server_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/parse" -) - -func LinkedServerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.LinkedServerID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/redis/validate/linked_server_id_test.go b/internal/services/redis/validate/linked_server_id_test.go deleted file mode 100644 index 1a774b4f80e8..000000000000 --- a/internal/services/redis/validate/linked_server_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestLinkedServerID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing RediName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/", - Valid: false, - }, - - { - // missing value for RediName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/linkedServers/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cache/Redis/redis1/linkedServers/linkedServer1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.CACHE/REDIS/REDIS1/LINKEDSERVERS/LINKEDSERVER1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := LinkedServerID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/redisenterprise/redis_enterprise_cluster_resource.go b/internal/services/redisenterprise/redis_enterprise_cluster_resource.go index 13079dac54c5..f44cd0dfa354 100644 --- a/internal/services/redisenterprise/redis_enterprise_cluster_resource.go +++ b/internal/services/redisenterprise/redis_enterprise_cluster_resource.go @@ -124,7 +124,6 @@ func resourceRedisEnterpriseClusterCreate(d *pluginsdk.ResourceData, meta interf tlsVersion := redisenterprise.TlsVersion(d.Get("minimum_tls_version").(string)) parameters := redisenterprise.Cluster{ - Name: utils.String(id.ClusterName), Location: location, Sku: sku, Properties: &redisenterprise.ClusterProperties{ @@ -185,7 +184,7 @@ func resourceRedisEnterpriseClusterRead(d *pluginsdk.ResourceData, meta interfac return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.ClusterName) + d.Set("name", id.RedisEnterpriseName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/redisenterprise/redis_enterprise_database_data_source.go b/internal/services/redisenterprise/redis_enterprise_database_data_source.go index c823cc34e67f..e801b5b91f56 100644 --- a/internal/services/redisenterprise/redis_enterprise_database_data_source.go +++ b/internal/services/redisenterprise/redis_enterprise_database_data_source.go @@ -80,7 +80,7 @@ func dataSourceRedisEnterpriseDatabaseRead(d *pluginsdk.ResourceData, meta inter return err } - id := databases.NewDatabaseID(subscriptionId, clusterId.ResourceGroupName, clusterId.ClusterName, d.Get("name").(string)) + id := databases.NewDatabaseID(subscriptionId, clusterId.ResourceGroupName, clusterId.RedisEnterpriseName, d.Get("name").(string)) keysResp, err := client.ListKeys(ctx, id) if err != nil { @@ -90,8 +90,7 @@ func dataSourceRedisEnterpriseDatabaseRead(d *pluginsdk.ResourceData, meta inter resp, err := client.Get(ctx, id) if err != nil { if response.WasNotFound(resp.HttpResponse) { - d.SetId("") - return nil + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } diff --git a/internal/services/redisenterprise/redis_enterprise_database_resource.go b/internal/services/redisenterprise/redis_enterprise_database_resource.go index 4d823bc1a994..7f5ccea1a2fe 100644 --- a/internal/services/redisenterprise/redis_enterprise_database_resource.go +++ b/internal/services/redisenterprise/redis_enterprise_database_resource.go @@ -232,7 +232,7 @@ func resourceRedisEnterpriseDatabaseCreate(d *pluginsdk.ResourceData, meta inter return fmt.Errorf("parsing `cluster_id`: %+v", err) } - id := databases.NewDatabaseID(subscriptionId, clusterId.ResourceGroupName, clusterId.ClusterName, d.Get("name").(string)) + id := databases.NewDatabaseID(subscriptionId, clusterId.ResourceGroupName, clusterId.RedisEnterpriseName, d.Get("name").(string)) if d.IsNewResource() { existing, err := client.Get(ctx, id) if err != nil { @@ -339,7 +339,7 @@ func resourceRedisEnterpriseDatabaseRead(d *pluginsdk.ResourceData, meta interfa d.Set("name", id.DatabaseName) d.Set("resource_group_name", id.ResourceGroupName) - clusterId := redisenterprise.NewRedisEnterpriseID(id.SubscriptionId, id.ResourceGroupName, id.ClusterName) + clusterId := redisenterprise.NewRedisEnterpriseID(id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName) d.Set("cluster_id", clusterId.ID()) if !features.FourPointOhBeta() { @@ -402,7 +402,7 @@ func resourceRedisEnterpriseDatabaseUpdate(d *pluginsdk.ResourceData, meta inter return fmt.Errorf("parsing `cluster_id`: %+v", err) } - id := databases.NewDatabaseID(subscriptionId, clusterId.ResourceGroupName, clusterId.ClusterName, d.Get("name").(string)) + id := databases.NewDatabaseID(subscriptionId, clusterId.ResourceGroupName, clusterId.RedisEnterpriseName, d.Get("name").(string)) clusteringPolicy := databases.ClusteringPolicy(d.Get("clustering_policy").(string)) evictionPolicy := databases.EvictionPolicy(d.Get("eviction_policy").(string)) @@ -466,8 +466,8 @@ func resourceRedisEnterpriseDatabaseDelete(d *pluginsdk.ResourceData, meta inter return err } - dbId := databases.NewDatabaseID(id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.DatabaseName) - clusterId := redisenterprise.NewRedisEnterpriseID(id.SubscriptionId, id.ResourceGroupName, id.ClusterName) + dbId := databases.NewDatabaseID(id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName, id.DatabaseName) + clusterId := redisenterprise.NewRedisEnterpriseID(id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName) if _, err := client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) diff --git a/internal/services/redisenterprise/validate/redis_enterprise_cluster_sku_name.go b/internal/services/redisenterprise/validate/redis_enterprise_cluster_sku_name.go index 4bbfe8238852..8ce422b722f3 100644 --- a/internal/services/redisenterprise/validate/redis_enterprise_cluster_sku_name.go +++ b/internal/services/redisenterprise/validate/redis_enterprise_cluster_sku_name.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" ) @@ -68,12 +68,12 @@ func RedisEnterpriseClusterSkuName(v interface{}, k string) (warnings []string, func getValidRedisEnterpriseClusterSkus() []string { return []string{ - string(redisenterprise.EnterpriseE10), - string(redisenterprise.EnterpriseE20), - string(redisenterprise.EnterpriseE50), - string(redisenterprise.EnterpriseE100), - string(redisenterprise.EnterpriseFlashF300), - string(redisenterprise.EnterpriseFlashF700), - string(redisenterprise.EnterpriseFlashF1500), + string(redisenterprise.SkuNameEnterpriseEOneZero), + string(redisenterprise.SkuNameEnterpriseETwoZero), + string(redisenterprise.SkuNameEnterpriseEFiveZero), + string(redisenterprise.SkuNameEnterpriseEOneHundred), + string(redisenterprise.SkuNameEnterpriseFlashFThreeHundred), + string(redisenterprise.SkuNameEnterpriseFlashFSevenHundred), + string(redisenterprise.SkuNameEnterpriseFlashFOneFiveHundred), } } diff --git a/internal/services/resource/client/client.go b/internal/services/resource/client/client.go index 73e0742446a2..737a2e634fd0 100644 --- a/internal/services/resource/client/client.go +++ b/internal/services/resource/client/client.go @@ -4,8 +4,8 @@ import ( providers "github.com/Azure/azure-sdk-for-go/profiles/2017-03-09/resources/mgmt/resources" "github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2019-06-01-preview/templatespecs" // nolint: staticcheck "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2015-12-01/features" // nolint: staticcheck - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks" // nolint: staticcheck "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2020-06-01/resources" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks" "github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) @@ -15,7 +15,7 @@ type Client struct { DeploymentScriptsClient *deploymentscripts.DeploymentScriptsClient FeaturesClient *features.Client GroupsClient *resources.GroupsClient - LocksClient *locks.ManagementLocksClient + LocksClient *managementlocks.ManagementLocksClient ProvidersClient *providers.ProvidersClient ResourceProvidersClient *resources.ProvidersClient ResourcesClient *resources.Client @@ -38,7 +38,7 @@ func NewClient(o *common.ClientOptions) *Client { groupsClient := resources.NewGroupsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&groupsClient.Client, o.ResourceManagerAuthorizer) - locksClient := locks.NewManagementLocksClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + locksClient := managementlocks.NewManagementLocksClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&locksClient.Client, o.ResourceManagerAuthorizer) // this has to come from the Profile since this is shared with Stack diff --git a/internal/services/resource/management_lock_resource.go b/internal/services/resource/management_lock_resource.go index 7273fd7d37c6..737cb6f0788b 100644 --- a/internal/services/resource/management_lock_resource.go +++ b/internal/services/resource/management_lock_resource.go @@ -2,13 +2,12 @@ package resource import ( "fmt" - "log" "time" - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -18,12 +17,12 @@ import ( func resourceManagementLock() *pluginsdk.Resource { return &pluginsdk.Resource{ - Create: resourceManagementLockCreateUpdate, + Create: resourceManagementLockCreate, Read: resourceManagementLockRead, Delete: resourceManagementLockDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ParseManagementLockID(id) + _, err := managementlocks.ParseScopedLockID(id) return err }), @@ -53,8 +52,8 @@ func resourceManagementLock() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(locks.CanNotDelete), - string(locks.ReadOnly), + string(managementlocks.LockLevelCanNotDelete), + string(managementlocks.LockLevelReadOnly), }, false), }, @@ -68,34 +67,33 @@ func resourceManagementLock() *pluginsdk.Resource { } } -func resourceManagementLockCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { +func resourceManagementLockCreate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Resource.LocksClient - ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[INFO] preparing arguments for AzureRM Management Lock creation.") - id := parse.NewManagementLockID(d.Get("scope").(string), d.Get("name").(string)) + id := managementlocks.NewScopedLockID(d.Get("scope").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.GetByScope(ctx, id.Scope, id.Name) + existing, err := client.GetByScope(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_management_lock", id.ID()) } } - lock := locks.ManagementLockObject{ - ManagementLockProperties: &locks.ManagementLockProperties{ - Level: locks.LockLevel(d.Get("lock_level").(string)), + payload := managementlocks.ManagementLockObject{ + Properties: managementlocks.ManagementLockProperties{ + Level: managementlocks.LockLevel(d.Get("lock_level").(string)), Notes: utils.String(d.Get("notes").(string)), }, } - if _, err := client.CreateOrUpdateByScope(ctx, id.Scope, id.Name, lock); err != nil { + if _, err := client.CreateOrUpdateByScope(ctx, id, payload); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -108,14 +106,14 @@ func resourceManagementLockRead(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ParseManagementLockID(d.Id()) + id, err := managementlocks.ParseScopedLockID(d.Id()) if err != nil { return err } - resp, err := client.GetByScope(ctx, id.Scope, id.Name) + resp, err := client.GetByScope(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -123,12 +121,12 @@ func resourceManagementLockRead(d *pluginsdk.ResourceData, meta interface{}) err return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) + d.Set("name", id.LockName) d.Set("scope", id.Scope) - if props := resp.ManagementLockProperties; props != nil { - d.Set("lock_level", string(props.Level)) - d.Set("notes", props.Notes) + if model := resp.Model; model != nil { + d.Set("lock_level", string(model.Properties.Level)) + d.Set("notes", model.Properties.Notes) } return nil @@ -139,15 +137,15 @@ func resourceManagementLockDelete(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ParseManagementLockID(d.Id()) + id, err := managementlocks.ParseScopedLockID(d.Id()) if err != nil { return err } - if resp, err := client.DeleteByScope(ctx, id.Scope, id.Name); err != nil { + if resp, err := client.DeleteByScope(ctx, *id); err != nil { // @tombuildsstuff: this is intentionally here in case the parent is gone, since we're under a scope - // which isn't ideal (as this shouldn't be present for most resources) but should for this one - if utils.ResponseWasNotFound(resp) { + // which isn't ideal (as this logic shouldn't be present for most resources) but should for this one + if response.WasNotFound(resp.HttpResponse) { return nil } diff --git a/internal/services/resource/management_lock_resource_test.go b/internal/services/resource/management_lock_resource_test.go index 96f55ab2ffee..a55b4577a3c7 100644 --- a/internal/services/resource/management_lock_resource_test.go +++ b/internal/services/resource/management_lock_resource_test.go @@ -6,10 +6,10 @@ import ( "os" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -162,17 +162,17 @@ func TestAccManagementLock_subscriptionCanNotDeleteBasic(t *testing.T) { } func (t ManagementLockResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ParseManagementLockID(state.ID) + id, err := managementlocks.ParseScopedLockID(state.ID) if err != nil { return nil, err } - resp, err := clients.Resource.LocksClient.GetByScope(ctx, id.Scope, id.Name) + resp, err := clients.Resource.LocksClient.GetByScope(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading Management Lock (%s): %+v", id, err) + return nil, fmt.Errorf("reading %s: %+v", *id, err) } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil), nil } func (ManagementLockResource) resourceGroupReadOnlyBasic(data acceptance.TestData) string { diff --git a/internal/services/resource/parse/management_lock.go b/internal/services/resource/parse/management_lock.go deleted file mode 100644 index 277ec8689cca..000000000000 --- a/internal/services/resource/parse/management_lock.go +++ /dev/null @@ -1,87 +0,0 @@ -package parse - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ManagementLockId{} - -// ManagementLockId is a struct representing the Resource ID for a Management Lock -type ManagementLockId struct { - Scope string - Name string -} - -// NewManagementLockID returns a new ManagementLockId struct -func NewManagementLockID(scope string, name string) ManagementLockId { - return ManagementLockId{ - Scope: scope, - Name: name, - } -} - -// ParseManagementLockID parses 'input' into a ManagementLockId -func ParseManagementLockID(input string) (*ManagementLockId, error) { - parser := resourceids.NewParserFromResourceIdType(ManagementLockId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ManagementLockId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, fmt.Errorf("the segment 'scope' was not found in the resource id %q", input) - } - - if id.Name, ok = parsed.Parsed["lockName"]; !ok { - return nil, fmt.Errorf("the segment 'lockName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateManagementLockID checks that 'input' can be parsed as a Management Lock ID -func ValidateManagementLockID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseManagementLockID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Management Lock ID -func (id ManagementLockId) ID() string { - fmtString := "%s/providers/Microsoft.Authorization/locks/%s" - return fmt.Sprintf(fmtString, id.Scope, id.Name) -} - -// Segments returns a slice of Resource ID Segments which comprise this Management Lock ID -func (id ManagementLockId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.ScopeSegment("scope", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftAuthorization", "Microsoft.Authorization", "Microsoft.Authorization"), - resourceids.StaticSegment("locks", "locks", "locks"), - resourceids.UserSpecifiedSegment("lockName", "lockValue"), - } -} - -// String returns a human-readable description of this Management Lock ID -func (id ManagementLockId) String() string { - components := []string{ - fmt.Sprintf("Scope: %q", id.Scope), - fmt.Sprintf("Name: %q", id.Name), - } - return fmt.Sprintf("Management Lock (%s)", strings.Join(components, "\n")) -} diff --git a/internal/services/resource/resource_deployment_script_azure_cli_resource.go b/internal/services/resource/resource_deployment_script_azure_cli_resource.go index d11b235decc8..77ba29c001c3 100644 --- a/internal/services/resource/resource_deployment_script_azure_cli_resource.go +++ b/internal/services/resource/resource_deployment_script_azure_cli_resource.go @@ -144,7 +144,7 @@ func (r ResourceDeploymentScriptAzureCliResource) Read() sdk.ResourceFunc { } state := ResourceDeploymentScriptAzureCliModel{ - Name: id.ScriptName, + Name: id.DeploymentScriptName, ResourceGroupName: id.ResourceGroupName, Location: location.Normalize(model.Location), } diff --git a/internal/services/resource/resource_deployment_script_azure_power_shell_resource.go b/internal/services/resource/resource_deployment_script_azure_power_shell_resource.go index 522c02c33f7e..751f96da1a53 100644 --- a/internal/services/resource/resource_deployment_script_azure_power_shell_resource.go +++ b/internal/services/resource/resource_deployment_script_azure_power_shell_resource.go @@ -144,7 +144,7 @@ func (r ResourceDeploymentScriptAzurePowerShellResource) Read() sdk.ResourceFunc } state := ResourceDeploymentScriptAzurePowerShellModel{ - Name: id.ScriptName, + Name: id.DeploymentScriptName, ResourceGroupName: id.ResourceGroupName, Location: location.Normalize(model.Location), } diff --git a/internal/services/resource/resource_group_resource_test.go b/internal/services/resource/resource_group_resource_test.go index da1c0942e017..df64241d3392 100644 --- a/internal/services/resource/resource_group_resource_test.go +++ b/internal/services/resource/resource_group_resource_test.go @@ -6,13 +6,12 @@ import ( "regexp" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) type ResourceGroupResource struct{} @@ -129,8 +128,8 @@ func (t ResourceGroupResource) Exists(ctx context.Context, client *clients.Clien return utils.Bool(resp.Properties != nil), nil } -func (t ResourceGroupResource) createNetworkOutsideTerraform(name string) func(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) error { - return func(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) error { +func (t ResourceGroupResource) createNetworkOutsideTerraform(name string) func(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) error { + return func(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) error { client := clients.Network.VnetClient resourceGroup := state.Attributes["name"] location := state.Attributes["location"] diff --git a/internal/services/resource/template_deployment_common.go b/internal/services/resource/template_deployment_common.go index 2b5ea1e82b39..2f4619e0ef2c 100644 --- a/internal/services/resource/template_deployment_common.go +++ b/internal/services/resource/template_deployment_common.go @@ -12,7 +12,6 @@ import ( providers "github.com/Azure/azure-sdk-for-go/profiles/2017-03-09/resources/mgmt/resources" "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2020-06-01/resources" // nolint: staticcheck - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/client" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -217,7 +216,7 @@ func deleteItemsProvisionedByTemplate(ctx context.Context, client *client.Client return fmt.Errorf("could not retrieve context deadline") } - return pluginsdk.Retry(time.Until(deadline), func() *resource.RetryError { + return pluginsdk.Retry(time.Until(deadline), func() *pluginsdk.RetryError { deletedTimes := 0 var errorList []error for _, nestedResource := range nestedResources { diff --git a/internal/services/sentinel/azuresdkhacks/models.go b/internal/services/sentinel/azuresdkhacks/models.go index aa9b2ed59fa0..35c2eba089ad 100644 --- a/internal/services/sentinel/azuresdkhacks/models.go +++ b/internal/services/sentinel/azuresdkhacks/models.go @@ -97,7 +97,7 @@ func unmarshalBasicDataConnector(body []byte) (securityinsight.BasicDataConnecto err := json.Unmarshal(body, &odc) return odc, err case string(securityinsight.KindBasicDataConnectorKindThreatIntelligence): - var tdc securityinsight.TIDataConnector + var tdc TIDataConnector err := json.Unmarshal(body, &tdc) return tdc, err case string(securityinsight.KindBasicDataConnectorKindThreatIntelligenceTaxii): @@ -312,6 +312,109 @@ func (ttdc *TiTaxiiDataConnector) UnmarshalJSON(body []byte) error { return nil } +var _ securityinsight.BasicDataConnector = TIDataConnector{} + +type TIDataConnector struct { + *TIDataConnectorProperties `json:"properties,omitempty"` + Kind securityinsight.KindBasicDataConnector `json:"kind,omitempty"` + Etag *string `json:"etag,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + SystemData *securityinsight.SystemData `json:"systemData,omitempty"` +} + +func (TIDataConnector) AsAADDataConnector() (*securityinsight.AADDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsMSTIDataConnector() (*securityinsight.MSTIDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsMTPDataConnector() (*securityinsight.MTPDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsAATPDataConnector() (*securityinsight.AATPDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsASCDataConnector() (*securityinsight.ASCDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsAwsCloudTrailDataConnector() (*securityinsight.AwsCloudTrailDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsAwsS3DataConnector() (*securityinsight.AwsS3DataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsMCASDataConnector() (*securityinsight.MCASDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsDynamics365DataConnector() (*securityinsight.Dynamics365DataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsOfficeATPDataConnector() (*securityinsight.OfficeATPDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsOffice365ProjectDataConnector() (*securityinsight.Office365ProjectDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsOfficePowerBIDataConnector() (*securityinsight.OfficePowerBIDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsOfficeIRMDataConnector() (*securityinsight.OfficeIRMDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsMDATPDataConnector() (*securityinsight.MDATPDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsOfficeDataConnector() (*securityinsight.OfficeDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsTIDataConnector() (*securityinsight.TIDataConnector, bool) { + // This method is not used at all, only for implementing the interface. + return nil, false +} + +func (TIDataConnector) AsTiTaxiiDataConnector() (*securityinsight.TiTaxiiDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsIoTDataConnector() (*securityinsight.IoTDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsCodelessUIDataConnector() (*securityinsight.CodelessUIDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsCodelessAPIPollingDataConnector() (*securityinsight.CodelessAPIPollingDataConnector, bool) { + return nil, false +} + +func (TIDataConnector) AsDataConnector() (*securityinsight.DataConnector, bool) { + return nil, false +} + +type TIDataConnectorProperties struct { + TipLookbackPeriod *Time `json:"tipLookbackPeriod,omitempty"` + DataTypes *securityinsight.TIDataConnectorDataTypes `json:"dataTypes,omitempty"` + TenantID *string `json:"tenantId,omitempty"` +} + type PollingFrequency string func (freq *PollingFrequency) UnmarshalJSON(body []byte) error { @@ -346,7 +449,7 @@ func (t *Time) UnmarshalJSON(data []byte) (err error) { } // This is the format that the service returns at this moment, which is not the expected format (RFC3339). - t.Time, err = time.Parse(`"1/2/2006 15:04:05 PM -07:00"`, string(data)) + t.Time, err = time.Parse(`"01/02/2006 15:04:05"`, string(data)) return err } diff --git a/internal/services/sentinel/client/client.go b/internal/services/sentinel/client/client.go index bd0511cba523..e71307000a15 100644 --- a/internal/services/sentinel/client/client.go +++ b/internal/services/sentinel/client/client.go @@ -2,6 +2,7 @@ package client import ( alertruletemplates "github.com/Azure/azure-sdk-for-go/services/preview/securityinsight/mgmt/2021-09-01-preview/securityinsight" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates" "github.com/hashicorp/terraform-provider-azurerm/internal/common" securityinsight "github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights" ) @@ -13,6 +14,7 @@ type Client struct { DataConnectorsClient *securityinsight.DataConnectorsClient WatchlistsClient *securityinsight.WatchlistsClient WatchlistItemsClient *securityinsight.WatchlistItemsClient + OnboardingStatesClient *sentinelonboardingstates.SentinelOnboardingStatesClient } func NewClient(o *common.ClientOptions) *Client { @@ -34,6 +36,9 @@ func NewClient(o *common.ClientOptions) *Client { watchListItemsClient := securityinsight.NewWatchlistItemsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&watchListItemsClient.Client, o.ResourceManagerAuthorizer) + onboardingStatesClient := sentinelonboardingstates.NewSentinelOnboardingStatesClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&onboardingStatesClient.Client, o.ResourceManagerAuthorizer) + return &Client{ AlertRulesClient: &alertRulesClient, AlertRuleTemplatesClient: &alertRuleTemplatesClient, @@ -41,5 +46,6 @@ func NewClient(o *common.ClientOptions) *Client { DataConnectorsClient: &dataConnectorsClient, WatchlistsClient: &watchListsClient, WatchlistItemsClient: &watchListItemsClient, + OnboardingStatesClient: &onboardingStatesClient, } } diff --git a/internal/services/sentinel/registration.go b/internal/services/sentinel/registration.go index 7a4bde1515a1..2a4093bf7160 100644 --- a/internal/services/sentinel/registration.go +++ b/internal/services/sentinel/registration.go @@ -69,6 +69,8 @@ func (r Registration) Resources() []sdk.Resource { DataConnectorOffice365ProjectResource{}, DataConnectorOfficePowerBIResource{}, DataConnectorOfficeIRMResource{}, + LogAnalyticsWorkspaceOnboardResource{}, DataConnectorThreatIntelligenceTAXIIResource{}, + DataConnectorMicrosoftThreatIntelligenceResource{}, } } diff --git a/internal/services/sentinel/sentinel_alert_rule.go b/internal/services/sentinel/sentinel_alert_rule.go index 272ba444b19b..8183dd6539ea 100644 --- a/internal/services/sentinel/sentinel_alert_rule.go +++ b/internal/services/sentinel/sentinel_alert_rule.go @@ -268,6 +268,9 @@ func expandAlertRuleAlertDetailsOverride(input []interface{}) *securityinsight.A if v := b["tactics_column_name"]; v != "" { output.AlertTacticsColumnName = utils.String(v.(string)) } + if v := b["dynamic_property"]; v != nil && len(v.([]interface{})) > 0 { + output.AlertDynamicProperties = expandAlertRuleAlertDynamicProperties(v.([]interface{})) + } return output } @@ -297,16 +300,56 @@ func flattenAlertRuleAlertDetailsOverride(input *securityinsight.AlertDetailsOve tacticsColumnName = *input.AlertTacticsColumnName } + var dynamicProperties []interface{} + if input.AlertDynamicProperties != nil { + dynamicProperties = flattenAlertRuleAlertDynamicProperties(input.AlertDynamicProperties) + } + return []interface{}{ map[string]interface{}{ "description_format": descriptionFormat, "display_name_format": displayNameFormat, "severity_column_name": severityColumnName, "tactics_column_name": tacticsColumnName, + "dynamic_property": dynamicProperties, }, } } +func expandAlertRuleAlertDynamicProperties(input []interface{}) *[]securityinsight.AlertPropertyMapping { + if len(input) == 0 || input[0] == nil { + return nil + } + + var output []securityinsight.AlertPropertyMapping + + for _, v := range input { + b := v.(map[string]interface{}) + output = append(output, securityinsight.AlertPropertyMapping{ + AlertProperty: securityinsight.AlertProperty(b["name"].(string)), + Value: utils.String(b["value"].(string)), + }) + } + + return &output +} + +func flattenAlertRuleAlertDynamicProperties(input *[]securityinsight.AlertPropertyMapping) []interface{} { + output := make([]interface{}, 0) + if input == nil || len(*input) == 0 { + return output + } + + for _, i := range *input { + output = append(output, map[string]interface{}{ + "name": string(i.AlertProperty), + "value": i.Value, + }) + } + + return output +} + func expandAlertRuleEntityMapping(input []interface{}) *[]securityinsight.EntityMapping { if len(input) == 0 { return nil @@ -386,3 +429,41 @@ func flattenAlertRuleFieldMapping(input *[]securityinsight.FieldMapping) []inter return output } + +func expandAlertRuleSentinelEntityMapping(input []interface{}) *[]securityinsight.SentinelEntityMapping { + if len(input) == 0 { + return nil + } + + result := make([]securityinsight.SentinelEntityMapping, 0) + + for _, e := range input { + b := e.(map[string]interface{}) + result = append(result, securityinsight.SentinelEntityMapping{ + ColumnName: utils.String(b["column_name"].(string)), + }) + } + + return &result +} + +func flattenAlertRuleSentinelEntityMapping(input *[]securityinsight.SentinelEntityMapping) []interface{} { + if input == nil { + return []interface{}{} + } + + output := make([]interface{}, 0) + + for _, e := range *input { + var columnName string + if e.ColumnName != nil { + columnName = *e.ColumnName + } + + output = append(output, map[string]interface{}{ + "column_name": columnName, + }) + } + + return output +} diff --git a/internal/services/sentinel/sentinel_alert_rule_nrt_resource.go b/internal/services/sentinel/sentinel_alert_rule_nrt_resource.go index eeeeb9a60498..08c967ebdb05 100644 --- a/internal/services/sentinel/sentinel_alert_rule_nrt_resource.go +++ b/internal/services/sentinel/sentinel_alert_rule_nrt_resource.go @@ -6,9 +6,11 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -96,6 +98,26 @@ func resourceSentinelAlertRuleNrt() *pluginsdk.Resource { ValidateFunc: validation.StringIsNotEmpty, }, + "event_grouping": { + Type: pluginsdk.TypeList, + Required: features.FourPointOhBeta(), + Optional: !features.FourPointOhBeta(), + Computed: !features.FourPointOhBeta(), // the service will default it to `SingleAlert`. + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "aggregation_method": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(securityinsight.EventGroupingAggregationKindAlertPerResult), + string(securityinsight.EventGroupingAggregationKindSingleAlert), + }, false), + }, + }, + }, + }, + "tactics": { Type: pluginsdk.TypeSet, Optional: true, @@ -267,6 +289,35 @@ func resourceSentinelAlertRuleNrt() *pluginsdk.Resource { Optional: true, ValidateFunc: validation.StringIsNotEmpty, }, + "dynamic_property": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice( + []string{ + string(securityinsight.AlertPropertyAlertLink), + string(securityinsight.AlertPropertyConfidenceLevel), + string(securityinsight.AlertPropertyConfidenceScore), + string(securityinsight.AlertPropertyExtendedLinks), + string(securityinsight.AlertPropertyProductComponentName), + string(securityinsight.AlertPropertyProductName), + string(securityinsight.AlertPropertyProviderName), + string(securityinsight.AlertPropertyRemediationSteps), + string(securityinsight.AlertPropertyTechniques), + }, false), + }, + "value": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, }, }, }, @@ -311,6 +362,20 @@ func resourceSentinelAlertRuleNrt() *pluginsdk.Resource { }, }, }, + "sentinel_entity_mapping": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 5, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "column_name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, }, } } @@ -367,14 +432,30 @@ func resourceSentinelAlertRuleNrtCreateUpdate(d *pluginsdk.ResourceData, meta in if v, ok := d.GetOk("alert_rule_template_version"); ok { param.NrtAlertRuleProperties.TemplateVersion = utils.String(v.(string)) } + if v, ok := d.GetOk("event_grouping"); ok { + param.NrtAlertRuleProperties.EventGroupingSettings = expandAlertRuleScheduledEventGroupingSetting(v.([]interface{})) + } if v, ok := d.GetOk("alert_details_override"); ok { param.NrtAlertRuleProperties.AlertDetailsOverride = expandAlertRuleAlertDetailsOverride(v.([]interface{})) } if v, ok := d.GetOk("custom_details"); ok { param.NrtAlertRuleProperties.CustomDetails = utils.ExpandMapStringPtrString(v.(map[string]interface{})) } + + entityMappingCount := 0 + sentinelEntityMappingCount := 0 if v, ok := d.GetOk("entity_mapping"); ok { param.NrtAlertRuleProperties.EntityMappings = expandAlertRuleEntityMapping(v.([]interface{})) + entityMappingCount = len(*param.NrtAlertRuleProperties.EntityMappings) + } + if v, ok := d.GetOk("sentinel_entity_mapping"); ok { + param.NrtAlertRuleProperties.SentinelEntitiesMappings = expandAlertRuleSentinelEntityMapping(v.([]interface{})) + sentinelEntityMappingCount = len(*param.NrtAlertRuleProperties.SentinelEntitiesMappings) + } + + // the max number of `sentinel_entity_mapping` and `entity_mapping` together is 5 + if entityMappingCount+sentinelEntityMappingCount > 5 { + return fmt.Errorf("`entity_mapping` and `sentinel_entity_mapping` together can't exceed 5") } // Service avoid concurrent update of this resource via checking the "etag" to guarantee it is the same value as last Read. @@ -451,6 +532,9 @@ func resourceSentinelAlertRuleNrtRead(d *pluginsdk.ResourceData, meta interface{ d.Set("alert_rule_template_guid", prop.AlertRuleTemplateName) d.Set("alert_rule_template_version", prop.TemplateVersion) + if err := d.Set("event_grouping", flattenAlertRuleScheduledEventGroupingSetting(prop.EventGroupingSettings)); err != nil { + return fmt.Errorf("setting `event_grouping`: %+v", err) + } if err := d.Set("alert_details_override", flattenAlertRuleAlertDetailsOverride(prop.AlertDetailsOverride)); err != nil { return fmt.Errorf("setting `alert_details_override`: %+v", err) } @@ -460,6 +544,9 @@ func resourceSentinelAlertRuleNrtRead(d *pluginsdk.ResourceData, meta interface{ if err := d.Set("entity_mapping", flattenAlertRuleEntityMapping(prop.EntityMappings)); err != nil { return fmt.Errorf("setting `entity_mapping`: %+v", err) } + if err := d.Set("sentinel_entity_mapping", flattenAlertRuleSentinelEntityMapping(prop.SentinelEntitiesMappings)); err != nil { + return fmt.Errorf("setting `sentinel_entity_mapping`: %+v", err) + } } return nil diff --git a/internal/services/sentinel/sentinel_alert_rule_nrt_resource_test.go b/internal/services/sentinel/sentinel_alert_rule_nrt_resource_test.go index e3d3244d7b7e..69da6252acae 100644 --- a/internal/services/sentinel/sentinel_alert_rule_nrt_resource_test.go +++ b/internal/services/sentinel/sentinel_alert_rule_nrt_resource_test.go @@ -105,6 +105,28 @@ func TestAccSentinelAlertRuleNrt_withAlertRuleTemplateGuid(t *testing.T) { }) } +func TestAccSentinelAlertRuleNrt_updateEventGroupingSetting(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_sentinel_alert_rule_nrt", "test") + r := SentinelAlertRuleNrtResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.eventGroupingSetting(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.updateEventGroupingSetting(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func (t SentinelAlertRuleNrtResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.AlertRuleID(state.ID) if err != nil { @@ -176,6 +198,10 @@ resource "azurerm_sentinel_alert_rule_nrt" "test" { display_name_format = "Suspicious activity was made by {{ComputerIP}}" severity_column_name = "Computer" tactics_column_name = "Computer" + dynamic_property { + name = "AlertLink" + value = "dcount_ResourceId" + } } entity_mapping { entity_type = "Host" @@ -184,6 +210,9 @@ resource "azurerm_sentinel_alert_rule_nrt" "test" { column_name = "Computer" } } + sentinel_entity_mapping { + column_name = "Category" + } entity_mapping { entity_type = "IP" field_mapping { @@ -251,6 +280,52 @@ resource "azurerm_sentinel_alert_rule_nrt" "test" { `, r.template(data), data.RandomInteger) } +func (r SentinelAlertRuleNrtResource) eventGroupingSetting(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_sentinel_alert_rule_nrt" "test" { + name = "acctest-SentinelAlertRule-NRT-%d" + log_analytics_workspace_id = azurerm_log_analytics_solution.test.workspace_resource_id + display_name = "Some Rule" + severity = "High" + query = < 5 { + return fmt.Errorf("`entity_mapping` and `sentinel_entity_mapping` together can't exceed 5") } if !d.IsNewResource() { @@ -556,6 +613,9 @@ func resourceSentinelAlertRuleScheduledRead(d *pluginsdk.ResourceData, meta inte if err := d.Set("entity_mapping", flattenAlertRuleEntityMapping(prop.EntityMappings)); err != nil { return fmt.Errorf("setting `entity_mapping`: %+v", err) } + if err := d.Set("sentinel_entity_mapping", flattenAlertRuleSentinelEntityMapping(prop.SentinelEntitiesMappings)); err != nil { + return fmt.Errorf("setting `sentinel_entity_mapping`: %+v", err) + } } return nil diff --git a/internal/services/sentinel/sentinel_alert_rule_scheduled_resource_test.go b/internal/services/sentinel/sentinel_alert_rule_scheduled_resource_test.go index 1305e632ae97..897fca4fb7b4 100644 --- a/internal/services/sentinel/sentinel_alert_rule_scheduled_resource_test.go +++ b/internal/services/sentinel/sentinel_alert_rule_scheduled_resource_test.go @@ -202,6 +202,10 @@ resource "azurerm_sentinel_alert_rule_scheduled" "test" { display_name_format = "Suspicious activity was made by {{ComputerIP}}" severity_column_name = "Computer" tactics_column_name = "Computer" + dynamic_property { + name = "AlertLink" + value = "dcount_ResourceId" + } } entity_mapping { entity_type = "Host" @@ -210,6 +214,9 @@ resource "azurerm_sentinel_alert_rule_scheduled" "test" { column_name = "Computer" } } + sentinel_entity_mapping { + column_name = "Category" + } entity_mapping { entity_type = "IP" field_mapping { diff --git a/internal/services/sentinel/sentinel_data_connector.go b/internal/services/sentinel/sentinel_data_connector.go index 0726682d0067..9554166458a5 100644 --- a/internal/services/sentinel/sentinel_data_connector.go +++ b/internal/services/sentinel/sentinel_data_connector.go @@ -68,6 +68,8 @@ func assertDataConnectorKind(dc securityinsight.BasicDataConnector, expectKind s kind = securityinsight.DataConnectorKindAmazonWebServicesS3 case azuresdkhacks.TiTaxiiDataConnector: kind = securityinsight.DataConnectorKindThreatIntelligenceTaxii + case azuresdkhacks.TIDataConnector: + kind = securityinsight.DataConnectorKindThreatIntelligence } if expectKind != kind { return fmt.Errorf("Sentinel Data Connector has mismatched kind, expected: %q, got %q", expectKind, kind) diff --git a/internal/services/sentinel/sentinel_data_connector_microsoft_threat_intelligence.go b/internal/services/sentinel/sentinel_data_connector_microsoft_threat_intelligence.go new file mode 100644 index 000000000000..3838b73a9397 --- /dev/null +++ b/internal/services/sentinel/sentinel_data_connector_microsoft_threat_intelligence.go @@ -0,0 +1,265 @@ +package sentinel + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2022-10-01/workspaces" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" + securityinsight "github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights" +) + +type DataConnectorMicrosoftThreatIntelligenceResource struct{} + +type DataConnectorMicrosoftThreatIntelligenceModel struct { + Name string `tfschema:"name"` + WorkspaceId string `tfschema:"log_analytics_workspace_id"` + TenantId string `tfschema:"tenant_id"` + BingSafetyPhishingUrlLookBackDate string `tfschema:"bing_safety_phishing_url_lookback_date"` + MicrosoftEmergingThreatFeedLookBackDate string `tfschema:"microsoft_emerging_threat_feed_lookback_date"` +} + +type DataConnectorMicrosoftThreatIntelligenceDataType struct { + Enabled bool `tfschema:"enabled"` + LookbackDate string `tfschema:"lookback_date"` +} + +func (s DataConnectorMicrosoftThreatIntelligenceResource) Arguments() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "log_analytics_workspace_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: workspaces.ValidateWorkspaceID, + }, + + "tenant_id": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.IsUUID, + }, + + "bing_safety_phishing_url_lookback_date": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IsRFC3339Time, + AtLeastOneOf: []string{"bing_safety_phishing_url_lookback_date", "microsoft_emerging_threat_feed_lookback_date"}, + }, + + "microsoft_emerging_threat_feed_lookback_date": { + Type: pluginsdk.TypeString, + ForceNew: true, + Optional: true, + ValidateFunc: validation.IsRFC3339Time, + AtLeastOneOf: []string{"bing_safety_phishing_url_lookback_date", "microsoft_emerging_threat_feed_lookback_date"}, + }, + } +} + +func (s DataConnectorMicrosoftThreatIntelligenceResource) Attributes() map[string]*schema.Schema { + return map[string]*schema.Schema{} +} + +func (s DataConnectorMicrosoftThreatIntelligenceResource) ModelObject() interface{} { + return &DataConnectorMicrosoftThreatIntelligenceModel{} +} + +func (s DataConnectorMicrosoftThreatIntelligenceResource) ResourceType() string { + return "azurerm_sentinel_data_connector_microsoft_threat_intelligence" +} + +func (s DataConnectorMicrosoftThreatIntelligenceResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Sentinel.DataConnectorsClient + var metaModel DataConnectorMicrosoftThreatIntelligenceModel + if err := metadata.Decode(&metaModel); err != nil { + return fmt.Errorf("decoding %+v", err) + } + + workSpaceId, err := workspaces.ParseWorkspaceID(metaModel.WorkspaceId) + if err != nil { + return fmt.Errorf("parsing workspace id %+v", err) + } + + id := parse.NewDataConnectorID(workSpaceId.SubscriptionId, workSpaceId.ResourceGroupName, workSpaceId.WorkspaceName, metaModel.Name) + existing, err := client.Get(ctx, id.ResourceGroup, id.WorkspaceName, id.Name) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + if !utils.ResponseWasNotFound(existing.Response) { + return metadata.ResourceRequiresImport(s.ResourceType(), id) + } + + tenantId := metaModel.TenantId + if tenantId == "" { + tenantId = metadata.Client.Account.TenantId + } + + dataConnector := securityinsight.MSTIDataConnector{ + Name: &id.Name, + Kind: securityinsight.KindBasicDataConnectorKindMicrosoftThreatIntelligence, + MSTIDataConnectorProperties: &securityinsight.MSTIDataConnectorProperties{ + DataTypes: &securityinsight.MSTIDataConnectorDataTypes{ + BingSafetyPhishingURL: expandSentinelDataConnectorMicrosoftThreatIntelligenceBingSafetyPhishingUrl(metaModel), + MicrosoftEmergingThreatFeed: expandSentinelDataConnectorMicrosoftThreatIntelligenceMicrosoftEmergingThreatFeed(metaModel), + }, + TenantID: &tenantId, + }, + } + _, err = client.CreateOrUpdate(ctx, id.ResourceGroup, id.WorkspaceName, id.Name, dataConnector) + if err != nil { + return fmt.Errorf("creating %+v", err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (s DataConnectorMicrosoftThreatIntelligenceResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Sentinel.DataConnectorsClient + id, err := parse.DataConnectorID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + workspaceId := workspaces.NewWorkspaceID(id.SubscriptionId, id.ResourceGroup, id.WorkspaceName) + + existing, err := client.Get(ctx, id.ResourceGroup, id.WorkspaceName, id.Name) + if err != nil { + if utils.ResponseWasNotFound(existing.Response) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + dc, ok := existing.Value.(securityinsight.MSTIDataConnector) + if !ok { + return fmt.Errorf("%s was not an Microsoft Threat Protection Data Connector", id) + } + + state := DataConnectorMicrosoftThreatIntelligenceModel{ + Name: id.Name, + WorkspaceId: workspaceId.ID(), + TenantId: *dc.TenantID, + } + + if dc.TenantID != nil { + state.TenantId = *dc.TenantID + } + + if dt := dc.DataTypes; dt != nil { + if dt.BingSafetyPhishingURL != nil { + if strings.EqualFold(string(dt.BingSafetyPhishingURL.State), string(securityinsight.DataTypeStateEnabled)) { + state.BingSafetyPhishingUrlLookBackDate, err = flattenSentinelDataConnectorMicrosoftThreatIntelligenceTime(*dt.BingSafetyPhishingURL.LookbackPeriod) + if err != nil { + return fmt.Errorf("flattening `bing_safety_phishing_url`: %+v", err) + } + } + } + if dt.MicrosoftEmergingThreatFeed != nil { + if strings.EqualFold(string(dt.MicrosoftEmergingThreatFeed.State), string(securityinsight.DataTypeStateEnabled)) { + state.MicrosoftEmergingThreatFeedLookBackDate, err = flattenSentinelDataConnectorMicrosoftThreatIntelligenceTime(*dt.MicrosoftEmergingThreatFeed.LookbackPeriod) + if err != nil { + return fmt.Errorf("flattening `microsoft_emerging_threat_feed`: %+v", err) + } + } + } + } + + return metadata.Encode(&state) + }, + } +} + +func (s DataConnectorMicrosoftThreatIntelligenceResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Sentinel.DataConnectorsClient + + id, err := parse.DataConnectorID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, id.ResourceGroup, id.WorkspaceName, id.Name); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} + +func (s DataConnectorMicrosoftThreatIntelligenceResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.DataConnectorID +} + +func expandSentinelDataConnectorMicrosoftThreatIntelligenceBingSafetyPhishingUrl(input DataConnectorMicrosoftThreatIntelligenceModel) *securityinsight.MSTIDataConnectorDataTypesBingSafetyPhishingURL { + if input.BingSafetyPhishingUrlLookBackDate == "" { + return &securityinsight.MSTIDataConnectorDataTypesBingSafetyPhishingURL{ + LookbackPeriod: utils.String(""), + State: securityinsight.DataTypeStateDisabled, + } + } + + return &securityinsight.MSTIDataConnectorDataTypesBingSafetyPhishingURL{ + LookbackPeriod: utils.String(input.BingSafetyPhishingUrlLookBackDate), + State: securityinsight.DataTypeStateEnabled, + } +} + +func expandSentinelDataConnectorMicrosoftThreatIntelligenceMicrosoftEmergingThreatFeed(input DataConnectorMicrosoftThreatIntelligenceModel) *securityinsight.MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed { + if input.MicrosoftEmergingThreatFeedLookBackDate == "" { + return &securityinsight.MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed{ + LookbackPeriod: utils.String(""), + State: securityinsight.DataTypeStateDisabled, + } + } + + return &securityinsight.MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed{ + LookbackPeriod: utils.String(input.MicrosoftEmergingThreatFeedLookBackDate), + State: securityinsight.DataTypeStateEnabled, + } +} + +func flattenSentinelDataConnectorMicrosoftThreatIntelligenceTime(input string) (string, error) { + // TODO: check if this workaround could be removed in 4.0 + + t, err := time.Parse(time.RFC3339, input) + if err != nil { + t, err = time.Parse("01/02/2006 15:04:05", input) + if err != nil { + return "", err + } + } + + return t.Format(time.RFC3339), nil +} diff --git a/internal/services/sentinel/sentinel_data_connector_microsoft_threat_intelligence_test.go b/internal/services/sentinel/sentinel_data_connector_microsoft_threat_intelligence_test.go new file mode 100644 index 000000000000..b5b306820ee8 --- /dev/null +++ b/internal/services/sentinel/sentinel_data_connector_microsoft_threat_intelligence_test.go @@ -0,0 +1,125 @@ +package sentinel_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type SentinelDataConnectorMicrosoftThreatIntelligence struct{} + +func TestAccSentinelDataConnectorMicrosoftThreatIntelligence_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_sentinel_data_connector_microsoft_threat_intelligence", "test") + r := SentinelDataConnectorMicrosoftThreatIntelligence{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSentinelDataConnectorMicrosoftThreatIntelligence_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_sentinel_data_connector_microsoft_threat_intelligence", "test") + r := SentinelDataConnectorMicrosoftThreatIntelligence{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r SentinelDataConnectorMicrosoftThreatIntelligence) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_sentinel_data_connector_microsoft_threat_intelligence" "test" { + name = "acctest-DC-MTI-%d" + log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id + microsoft_emerging_threat_feed_lookback_date = "1970-01-01T00:00:00Z" + + depends_on = [ + azurerm_sentinel_log_analytics_workspace_onboarding.test + ] +} +`, r.template(data), data.RandomInteger) +} + +func (r SentinelDataConnectorMicrosoftThreatIntelligence) complete(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +data "azurerm_client_config" "test" {} + +resource "azurerm_sentinel_data_connector_microsoft_threat_intelligence" "test" { + name = "acctest-DC-MTI-%d" + log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id + tenant_id = data.azurerm_client_config.test.tenant_id + microsoft_emerging_threat_feed_lookback_date = "1970-01-01T00:00:00Z" + bing_safety_phishing_url_lookback_date = "1970-01-01T00:00:00Z" + + depends_on = [ + azurerm_sentinel_log_analytics_workspace_onboarding.test + ] +} +`, r.template(data), data.RandomInteger) +} + +func (r SentinelDataConnectorMicrosoftThreatIntelligence) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-sentinel-%d" + location = "%s" +} + +resource "azurerm_log_analytics_workspace" "test" { + name = "acctestLAW-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "PerGB2018" +} + +resource "azurerm_sentinel_log_analytics_workspace_onboarding" "test" { + resource_group_name = azurerm_resource_group.test.name + workspace_name = azurerm_log_analytics_workspace.test.name +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +} + +func (r SentinelDataConnectorMicrosoftThreatIntelligence) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + client := clients.Sentinel.DataConnectorsClient + + id, err := parse.DataConnectorID(state.ID) + if err != nil { + return nil, err + } + + if resp, err := client.Get(ctx, id.ResourceGroup, id.WorkspaceName, id.Name); err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + + return utils.Bool(true), nil +} diff --git a/internal/services/sentinel/sentinel_data_connector_threat_intelligence.go b/internal/services/sentinel/sentinel_data_connector_threat_intelligence.go index 5449c67e00bf..629cb30d1169 100644 --- a/internal/services/sentinel/sentinel_data_connector_threat_intelligence.go +++ b/internal/services/sentinel/sentinel_data_connector_threat_intelligence.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/azuresdkhacks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -55,12 +56,21 @@ func resourceSentinelDataConnectorThreatIntelligence() *pluginsdk.Resource { ForceNew: true, ValidateFunc: validation.IsUUID, }, + + "lookback_date": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + Default: "1970-01-01T00:00:00Z", + ValidateFunc: validation.IsRFC3339Time, + }, }, } } func resourceSentinelDataConnectorThreatIntelligenceCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Sentinel.DataConnectorsClient + client := azuresdkhacks.DataConnectorsClient{BaseClient: meta.(*clients.Client).Sentinel.DataConnectorsClient.BaseClient} + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -89,10 +99,15 @@ func resourceSentinelDataConnectorThreatIntelligenceCreateUpdate(d *pluginsdk.Re tenantId = meta.(*clients.Client).Account.TenantId } - param := securityinsight.TIDataConnector{ + lookbackDate, _ := time.Parse(time.RFC3339, d.Get("lookback_date").(string)) + + param := azuresdkhacks.TIDataConnector{ Name: &name, - TIDataConnectorProperties: &securityinsight.TIDataConnectorProperties{ + TIDataConnectorProperties: &azuresdkhacks.TIDataConnectorProperties{ TenantID: &tenantId, + TipLookbackPeriod: &azuresdkhacks.Time{ + Time: lookbackDate, + }, DataTypes: &securityinsight.TIDataConnectorDataTypes{ Indicators: &securityinsight.TIDataConnectorDataTypesIndicators{ State: securityinsight.DataTypeStateEnabled, @@ -112,7 +127,7 @@ func resourceSentinelDataConnectorThreatIntelligenceCreateUpdate(d *pluginsdk.Re } func resourceSentinelDataConnectorThreatIntelligenceRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Sentinel.DataConnectorsClient + client := azuresdkhacks.DataConnectorsClient{BaseClient: meta.(*clients.Client).Sentinel.DataConnectorsClient.BaseClient} ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -133,7 +148,7 @@ func resourceSentinelDataConnectorThreatIntelligenceRead(d *pluginsdk.ResourceDa return fmt.Errorf("retrieving %s: %+v", id, err) } - dc, ok := resp.Value.(securityinsight.TIDataConnector) + dc, ok := resp.Value.(azuresdkhacks.TIDataConnector) if !ok { return fmt.Errorf("%s was not a Threat Intelligence Data Connector", id) } @@ -141,6 +156,7 @@ func resourceSentinelDataConnectorThreatIntelligenceRead(d *pluginsdk.ResourceDa d.Set("name", id.Name) d.Set("log_analytics_workspace_id", workspaceId.ID()) d.Set("tenant_id", dc.TenantID) + d.Set("lookback_date", dc.TipLookbackPeriod.Format(time.RFC3339)) return nil } diff --git a/internal/services/sentinel/sentinel_data_connector_threat_intelligence_taxii_test.go b/internal/services/sentinel/sentinel_data_connector_threat_intelligence_taxii_test.go index 7945dbdc4482..70a1078c5d04 100644 --- a/internal/services/sentinel/sentinel_data_connector_threat_intelligence_taxii_test.go +++ b/internal/services/sentinel/sentinel_data_connector_threat_intelligence_taxii_test.go @@ -6,13 +6,12 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/azuresdkhacks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -67,10 +66,26 @@ func TestAccDataConnectorThreatIntelligenceTAXII_basic(t *testing.T) { r := NewDataConnectorThreatIntelligenceTAXIIResource() r.preCheck(t, false) - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("user_name", "password"), + }) +} + +func TestAccDataConnectorThreatIntelligenceTAXII_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_sentinel_data_connector_threat_intelligence_taxii", "test") + r := NewDataConnectorThreatIntelligenceTAXIIResource() + r.preCheck(t, false) + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -83,24 +98,24 @@ func TestAccDataConnectorThreatIntelligenceTAXII_update(t *testing.T) { r := NewDataConnectorThreatIntelligenceTAXIIResource() r.preCheck(t, true) - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("user_name", "password"), { Config: r.update(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("user_name", "password"), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -113,10 +128,10 @@ func TestAccDataConnectorThreatIntelligenceTAXII_requiresImport(t *testing.T) { r := NewDataConnectorThreatIntelligenceTAXIIResource() r.preCheck(t, false) - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -124,7 +139,7 @@ func TestAccDataConnectorThreatIntelligenceTAXII_requiresImport(t *testing.T) { }) } -func (r DataConnectorThreatIntelligenceTAXIIResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r DataConnectorThreatIntelligenceTAXIIResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { client := azuresdkhacks.DataConnectorsClient{BaseClient: clients.Sentinel.DataConnectorsClient.BaseClient} id, err := parse.DataConnectorID(state.ID) @@ -160,6 +175,26 @@ resource "azurerm_sentinel_data_connector_threat_intelligence_taxii" "test" { `, template, data.RandomInteger, r.taxiiInfo.APIRootURL, r.taxiiInfo.CollectionID, r.taxiiInfo.UserName, r.taxiiInfo.Password) } +func (r DataConnectorThreatIntelligenceTAXIIResource) complete(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_sentinel_data_connector_threat_intelligence_taxii" "test" { + name = "acctestDC-%d" + log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id + display_name = "test_update" + api_root_url = "%s" + collection_id = "%s" + user_name = "%s" + password = "%s" + polling_frequency = "OnceADay" + lookback_date = "1990-01-01T00:00:00Z" + depends_on = [azurerm_log_analytics_solution.test] +} +`, template, data.RandomInteger, r.taxiiInfo.APIRootURL, r.taxiiInfo.CollectionID, r.taxiiInfo.UserName, r.taxiiInfo.Password) +} + func (r DataConnectorThreatIntelligenceTAXIIResource) update(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` diff --git a/internal/services/sentinel/sentinel_data_connector_threat_intelligence_test.go b/internal/services/sentinel/sentinel_data_connector_threat_intelligence_test.go index bda269590594..fde52d1d4bf2 100644 --- a/internal/services/sentinel/sentinel_data_connector_threat_intelligence_test.go +++ b/internal/services/sentinel/sentinel_data_connector_threat_intelligence_test.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/azuresdkhacks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -61,7 +62,7 @@ func TestAccAzureRMSentinelDataConnectorThreatIntelligence_requiresImport(t *tes } func (r SentinelDataConnectorThreatIntelligenceResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - client := clients.Sentinel.DataConnectorsClient + client := azuresdkhacks.DataConnectorsClient{BaseClient: clients.Sentinel.DataConnectorsClient.BaseClient} id, err := parse.DataConnectorID(state.ID) if err != nil { @@ -103,6 +104,7 @@ resource "azurerm_sentinel_data_connector_threat_intelligence" "test" { log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id tenant_id = data.azurerm_client_config.test.tenant_id depends_on = [azurerm_log_analytics_solution.test] + lookback_date = "1990-01-01T00:00:00Z" } `, template, data.RandomInteger) } diff --git a/internal/services/sentinel/sentinel_log_analytics_workspace_onboard_resource.go b/internal/services/sentinel/sentinel_log_analytics_workspace_onboard_resource.go new file mode 100644 index 000000000000..96842fc56a4c --- /dev/null +++ b/internal/services/sentinel/sentinel_log_analytics_workspace_onboard_resource.go @@ -0,0 +1,190 @@ +package sentinel + +import ( + "context" + "fmt" + "strconv" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type SecurityInsightsSentinelOnboardingStateModel struct { + ResourceGroupName string `tfschema:"resource_group_name"` + WorkspaceName string `tfschema:"workspace_name"` + CustomerManagedKeyEnabled bool `tfschema:"customer_managed_key_enabled"` +} + +type LogAnalyticsWorkspaceOnboardResource struct{} + +var _ sdk.Resource = LogAnalyticsWorkspaceOnboardResource{} + +func (r LogAnalyticsWorkspaceOnboardResource) ResourceType() string { + return "azurerm_sentinel_log_analytics_workspace_onboarding" +} + +func (r LogAnalyticsWorkspaceOnboardResource) ModelObject() interface{} { + return &SecurityInsightsSentinelOnboardingStateModel{} +} + +func (r LogAnalyticsWorkspaceOnboardResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return sentinelonboardingstates.ValidateOnboardingStateID +} + +func (r LogAnalyticsWorkspaceOnboardResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + + "resource_group_name": commonschema.ResourceGroupName(), + + "workspace_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "customer_managed_key_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + ForceNew: true, + }, + } +} + +func (r LogAnalyticsWorkspaceOnboardResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r LogAnalyticsWorkspaceOnboardResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model SecurityInsightsSentinelOnboardingStateModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.Sentinel.OnboardingStatesClient + subscriptionId := metadata.Client.Account.SubscriptionId + // the service only support `default` state + id := sentinelonboardingstates.NewOnboardingStateID(subscriptionId, model.ResourceGroupName, model.WorkspaceName, "default") + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + properties := &sentinelonboardingstates.SentinelOnboardingState{ + Properties: &sentinelonboardingstates.SentinelOnboardingStateProperties{ + CustomerManagedKey: &model.CustomerManagedKeyEnabled, + }, + } + + if _, err := client.Create(ctx, id, *properties); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + deadline, ok := ctx.Deadline() + if !ok { + return fmt.Errorf("context has no deadline") + } + + stateConf := &pluginsdk.StateChangeConf{ + Pending: []string{"404"}, + Target: []string{"200"}, + Refresh: func() (interface{}, string, error) { + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return resp, "404", nil + } + return resp, "", err + } + if resp.HttpResponse != nil { + return resp, strconv.Itoa(resp.HttpResponse.StatusCode), nil + } + return resp, "", fmt.Errorf("http response is nil") + }, + Timeout: time.Until(deadline), + Delay: 15 * time.Second, + } + + if _, err = stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for %s to be fully onboarded: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r LogAnalyticsWorkspaceOnboardResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Sentinel.OnboardingStatesClient + + id, err := sentinelonboardingstates.ParseOnboardingStateID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + state := SecurityInsightsSentinelOnboardingStateModel{ + ResourceGroupName: id.ResourceGroupName, + WorkspaceName: id.WorkspaceName, + } + + if properties := model.Properties; properties != nil { + if properties.CustomerManagedKey != nil { + state.CustomerManagedKeyEnabled = *properties.CustomerManagedKey + } + } + + return metadata.Encode(&state) + }, + } +} + +func (r LogAnalyticsWorkspaceOnboardResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Sentinel.OnboardingStatesClient + + id, err := sentinelonboardingstates.ParseOnboardingStateID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} diff --git a/internal/services/sentinel/sentinel_log_analytics_workspace_onboard_resource_test.go b/internal/services/sentinel/sentinel_log_analytics_workspace_onboard_resource_test.go new file mode 100644 index 000000000000..b956ef648ad1 --- /dev/null +++ b/internal/services/sentinel/sentinel_log_analytics_workspace_onboard_resource_test.go @@ -0,0 +1,255 @@ +package sentinel_test + +import ( + "context" + "fmt" + "os" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type SecurityInsightsSentinelOnboardingStateResource struct{} + +func TestAccSecurityInsightsSentinelOnboardingState_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_sentinel_log_analytics_workspace_onboarding", "test") + r := SecurityInsightsSentinelOnboardingStateResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSecurityInsightsSentinelOnboardingState_ToggleCmkEnabled(t *testing.T) { + + if os.Getenv("ARM_RUN_TEST_LOG_ANALYTICS_CLUSTERS") == "" { + t.Skip("Skipping as ARM_RUN_TEST_LOG_ANALYTICS_CLUSTERS is not specified") + return + } + + data := acceptance.BuildTestData(t, "azurerm_sentinel_log_analytics_workspace_onboarding", "test") + r := SecurityInsightsSentinelOnboardingStateResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.withCmk(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSecurityInsightsSentinelOnboardingState_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_sentinel_log_analytics_workspace_onboarding", "test") + r := SecurityInsightsSentinelOnboardingStateResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func (r SecurityInsightsSentinelOnboardingStateResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := sentinelonboardingstates.ParseOnboardingStateID(state.ID) + if err != nil { + return nil, err + } + + client := clients.Sentinel.OnboardingStatesClient + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (r SecurityInsightsSentinelOnboardingStateResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_log_analytics_workspace" "test" { + name = "acctestLAW-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "PerGB2018" +} + +resource "azurerm_resource_group" "test" { + name = "acctest-rg-%[1]d" + location = "%[2]s" +} + +resource "azurerm_sentinel_log_analytics_workspace_onboarding" "test" { + resource_group_name = azurerm_resource_group.test.name + workspace_name = azurerm_log_analytics_workspace.test.name +} +`, data.RandomInteger, data.Locations.Primary) +} + +func (r SecurityInsightsSentinelOnboardingStateResource) withCmk(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +provider "azuread" { +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_resource_group" "test" { + name = "acctest-rg-%[1]d" + location = "%[2]s" +} + +resource "azurerm_log_analytics_cluster" "test" { + name = "acctest-LA-%[1]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + + identity { + type = "SystemAssigned" + } +} + +data "azuread_service_principal" "cosmos" { + display_name = "Azure Cosmos DB" +} + + +resource "azurerm_key_vault" "test" { + name = "vault%[3]s" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + tenant_id = data.azurerm_client_config.current.tenant_id + + sku_name = "standard" + + soft_delete_retention_days = 7 + purge_protection_enabled = true + + access_policy { + tenant_id = data.azurerm_client_config.current.tenant_id + object_id = data.azurerm_client_config.current.object_id + key_permissions = [ + "Create", + "Delete", + "Get", + "List", + "Purge", + "Update", + ] + + secret_permissions = [ + "Get", + "Delete", + "Set", + ] + } + + access_policy { + tenant_id = azurerm_log_analytics_cluster.test.identity.0.tenant_id + object_id = azurerm_log_analytics_cluster.test.identity.0.principal_id + key_permissions = [ + "Get", + "UnwrapKey", + "WrapKey" + ] + } + + access_policy { + tenant_id = azurerm_log_analytics_cluster.test.identity.0.tenant_id + object_id = data.azuread_service_principal.cosmos.object_id + key_permissions = [ + "Get", + "UnwrapKey", + "WrapKey" + ] + } +} + +resource "azurerm_key_vault_key" "test" { + name = "key-%[3]s" + key_vault_id = azurerm_key_vault.test.id + key_type = "RSA" + key_size = 2048 + + key_opts = [ + "decrypt", + "encrypt", + "sign", + "unwrapKey", + "verify", + "wrapKey", + ] + +} + +resource "azurerm_log_analytics_cluster_customer_managed_key" "test" { + log_analytics_cluster_id = azurerm_log_analytics_cluster.test.id + key_vault_key_id = azurerm_key_vault_key.test.id + +} + +resource "azurerm_log_analytics_workspace" "test" { + name = "acctest-law-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + sku = "PerGB2018" + retention_in_days = 30 + lifecycle { + ignore_changes = [sku] + } +} + +resource "azurerm_log_analytics_linked_service" "test" { + resource_group_name = azurerm_resource_group.test.name + workspace_id = azurerm_log_analytics_workspace.test.id + write_access_id = azurerm_log_analytics_cluster.test.id + + depends_on = [azurerm_log_analytics_cluster_customer_managed_key.test] +} + +resource "azurerm_sentinel_log_analytics_workspace_onboarding" "test" { + resource_group_name = azurerm_resource_group.test.name + workspace_name = azurerm_log_analytics_workspace.test.name + customer_managed_key_enabled = true + + depends_on = [azurerm_log_analytics_linked_service.test] +} + +`, data.RandomInteger, data.Locations.Primary, data.RandomString) +} + +func (r SecurityInsightsSentinelOnboardingStateResource) requiresImport(data acceptance.TestData) string { + config := r.basic(data) + return fmt.Sprintf(` + %s + +resource "azurerm_sentinel_log_analytics_workspace_onboarding" "import" { + resource_group_name = azurerm_resource_group.test.name + workspace_name = azurerm_log_analytics_workspace.test.name +} +`, config) +} diff --git a/internal/services/sentinel/sentinel_watchlist_item_resource_test.go b/internal/services/sentinel/sentinel_watchlist_item_resource_test.go index 5f5bd1830224..370b4d17d6f8 100644 --- a/internal/services/sentinel/sentinel_watchlist_item_resource_test.go +++ b/internal/services/sentinel/sentinel_watchlist_item_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,10 +19,10 @@ func TestAccWatchlistItem_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sentinel_watchlist_item", "test") r := WatchlistItemResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -35,24 +34,24 @@ func TestAccWatchlistItem_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sentinel_watchlist_item", "test") r := WatchlistItemResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.multipleFields(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -64,10 +63,10 @@ func TestAccWatchlistItem_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sentinel_watchlist_item", "test") r := WatchlistItemResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -75,7 +74,7 @@ func TestAccWatchlistItem_requiresImport(t *testing.T) { }) } -func (r WatchlistItemResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r WatchlistItemResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { client := clients.Sentinel.WatchlistItemsClient id, err := parse.WatchlistItemID(state.ID) diff --git a/internal/services/sentinel/sentinel_watchlist_resource_test.go b/internal/services/sentinel/sentinel_watchlist_resource_test.go index b168e6efd056..310ddf298322 100644 --- a/internal/services/sentinel/sentinel_watchlist_resource_test.go +++ b/internal/services/sentinel/sentinel_watchlist_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,10 +19,10 @@ func TestAccWatchlist_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sentinel_watchlist", "test") r := WatchlistResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -35,10 +34,10 @@ func TestAccWatchlist_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sentinel_watchlist", "test") r := WatchlistResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -50,10 +49,10 @@ func TestAccWatchlist_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sentinel_watchlist", "test") r := WatchlistResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -61,7 +60,7 @@ func TestAccWatchlist_requiresImport(t *testing.T) { }) } -func (r WatchlistResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r WatchlistResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { client := clients.Sentinel.WatchlistsClient id, err := parse.WatchlistID(state.ID) diff --git a/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_data_source.go b/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_data_source.go index 27bee139b02f..29bf85f14d9a 100644 --- a/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_data_source.go +++ b/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_data_source.go @@ -113,13 +113,12 @@ func dataSourceServiceBusNamespaceDisasterRecoveryConfigRead(d *pluginsdk.Resour resp, err := client.Get(ctx, id) if err != nil { if response.WasNotFound(resp.HttpResponse) { - d.SetId("") - return nil + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Alias) + d.Set("name", id.DisasterRecoveryConfigName) d.Set("resource_group_name", id.ResourceGroupName) d.Set("namespace_name", id.NamespaceName) diff --git a/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_resource.go b/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_resource.go index 55e4c8c5d654..ff9e93567377 100644 --- a/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_resource.go +++ b/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_resource.go @@ -196,7 +196,7 @@ func resourceServiceBusNamespaceDisasterRecoveryConfigRead(d *pluginsdk.Resource primaryId := disasterrecoveryconfigs.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) - d.Set("name", id.Alias) + d.Set("name", id.DisasterRecoveryConfigName) d.Set("primary_namespace_id", primaryId.ID()) if model := resp.Model; model != nil { @@ -290,7 +290,9 @@ func resourceServiceBusNamespaceDisasterRecoveryConfigDelete(d *pluginsdk.Resour MinTimeout: 30 * time.Second, Timeout: d.Timeout(pluginsdk.TimeoutDelete), Refresh: func() (interface{}, string, error) { - resp, err := client.CheckNameAvailability(ctx, namespaceId, disasterrecoveryconfigs.CheckNameAvailability{Name: id.Alias}) + resp, err := client.CheckNameAvailability(ctx, namespaceId, disasterrecoveryconfigs.CheckNameAvailability{ + Name: id.DisasterRecoveryConfigName, + }) if err != nil { return resp, "Error", fmt.Errorf("checking for the status of %s: %+v", *id, err) } diff --git a/internal/services/servicefabric/client/client.go b/internal/services/servicefabric/client/client.go index b3716b370253..bbc643a90827 100644 --- a/internal/services/servicefabric/client/client.go +++ b/internal/services/servicefabric/client/client.go @@ -1,16 +1,16 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - ClustersClient *servicefabric.ClustersClient + ClustersClient *cluster.ClusterClient } func NewClient(o *common.ClientOptions) *Client { - clustersClient := servicefabric.NewClustersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + clustersClient := cluster.NewClusterClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&clustersClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/internal/services/servicefabric/parse/cluster.go b/internal/services/servicefabric/parse/cluster.go deleted file mode 100644 index 53c0c5ea3709..000000000000 --- a/internal/services/servicefabric/parse/cluster.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ClusterId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewClusterID(subscriptionId, resourceGroup, name string) ClusterId { - return ClusterId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ClusterId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Cluster", segmentsStr) -} - -func (id ClusterId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceFabric/clusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ClusterID parses a Cluster ID into an ClusterId struct -func ClusterID(input string) (*ClusterId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ClusterId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("clusters"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/servicefabric/parse/cluster_test.go b/internal/services/servicefabric/parse/cluster_test.go deleted file mode 100644 index d5fc66985dfc..000000000000 --- a/internal/services/servicefabric/parse/cluster_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = ClusterId{} - -func TestClusterIDFormatter(t *testing.T) { - actual := NewClusterID("12345678-1234-9876-4563-123456789012", "resGroup1", "cluster1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/clusters/cluster1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestClusterID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ClusterId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/clusters/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/clusters/cluster1", - Expected: &ClusterId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "cluster1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.SERVICEFABRIC/CLUSTERS/CLUSTER1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ClusterID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/servicefabric/resourceids.go b/internal/services/servicefabric/resourceids.go deleted file mode 100644 index db7b44ca1630..000000000000 --- a/internal/services/servicefabric/resourceids.go +++ /dev/null @@ -1,3 +0,0 @@ -package servicefabric - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Cluster -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/clusters/cluster1 diff --git a/internal/services/servicefabric/service_fabric_cluster_resource.go b/internal/services/servicefabric/service_fabric_cluster_resource.go index 11621e93e8ae..c129ec062f6a 100644 --- a/internal/services/servicefabric/service_fabric_cluster_resource.go +++ b/internal/services/servicefabric/service_fabric_cluster_resource.go @@ -5,16 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric/parse" serviceFabricValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -37,7 +36,7 @@ func resourceServiceFabricCluster() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ClusterID(id) + _, err := cluster.ParseClusterID(id) return err }), @@ -56,11 +55,11 @@ func resourceServiceFabricCluster() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(servicefabric.ReliabilityLevelNone), - string(servicefabric.ReliabilityLevelBronze), - string(servicefabric.ReliabilityLevelSilver), - string(servicefabric.ReliabilityLevelGold), - string(servicefabric.ReliabilityLevelPlatinum), + string(cluster.ReliabilityLevelNone), + string(cluster.ReliabilityLevelBronze), + string(cluster.ReliabilityLevelSilver), + string(cluster.ReliabilityLevelGold), + string(cluster.ReliabilityLevelPlatinum), }, false), }, @@ -68,8 +67,8 @@ func resourceServiceFabricCluster() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(servicefabric.UpgradeModeAutomatic), - string(servicefabric.UpgradeModeManual), + string(cluster.UpgradeModeAutomatic), + string(cluster.UpgradeModeManual), }, false), }, @@ -77,8 +76,8 @@ func resourceServiceFabricCluster() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(servicefabric.SfZonalUpgradeModeHierarchical), - string(servicefabric.SfZonalUpgradeModeParallel), + string(cluster.SfZonalUpgradeModeHierarchical), + string(cluster.SfZonalUpgradeModeParallel), }, false), }, @@ -86,8 +85,8 @@ func resourceServiceFabricCluster() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(servicefabric.VmssZonalUpgradeModeHierarchical), - string(servicefabric.VmssZonalUpgradeModeParallel), + string(cluster.VMSSZonalUpgradeModeHierarchical), + string(cluster.VMSSZonalUpgradeModeParallel), }, false), }, @@ -502,11 +501,11 @@ func resourceServiceFabricCluster() *pluginsdk.Resource { "durability_level": { Type: pluginsdk.TypeString, Optional: true, - Default: string(servicefabric.DurabilityLevelBronze), + Default: string(cluster.DurabilityLevelBronze), ValidateFunc: validation.StringInSlice([]string{ - string(servicefabric.DurabilityLevelBronze), - string(servicefabric.DurabilityLevelSilver), - string(servicefabric.DurabilityLevelGold), + string(cluster.DurabilityLevelBronze), + string(cluster.DurabilityLevelSilver), + string(cluster.DurabilityLevelGold), }, false), }, @@ -551,7 +550,7 @@ func resourceServiceFabricCluster() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "cluster_endpoint": { Type: pluginsdk.TypeString, @@ -567,16 +566,16 @@ func resourceServiceFabricClusterCreateUpdate(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewClusterID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := cluster.NewClusterID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_service_fabric_cluster", id.ID()) } } @@ -600,73 +599,70 @@ func resourceServiceFabricClusterCreateUpdate(d *pluginsdk.ResourceData, meta in nodeTypes := expandServiceFabricClusterNodeTypes(nodeTypesRaw) location := d.Get("location").(string) - reliabilityLevel := d.Get("reliability_level").(string) + reliabilityLevel := cluster.ReliabilityLevel(d.Get("reliability_level").(string)) managementEndpoint := d.Get("management_endpoint").(string) - upgradeMode := d.Get("upgrade_mode").(string) + upgradeMode := cluster.UpgradeMode(d.Get("upgrade_mode").(string)) clusterCodeVersion := d.Get("cluster_code_version").(string) vmImage := d.Get("vm_image").(string) t := d.Get("tags").(map[string]interface{}) - cluster := servicefabric.Cluster{ - Location: utils.String(location), + clusterModel := cluster.Cluster{ + Location: location, Tags: tags.Expand(t), - ClusterProperties: &servicefabric.ClusterProperties{ + Properties: &cluster.ClusterProperties{ AddOnFeatures: addOnFeatures, AzureActiveDirectory: azureActiveDirectory, CertificateCommonNames: expandServiceFabricClusterCertificateCommonNames(d), ReverseProxyCertificateCommonNames: expandServiceFabricClusterReverseProxyCertificateCommonNames(d), DiagnosticsStorageAccountConfig: diagnostics, FabricSettings: fabricSettings, - ManagementEndpoint: utils.String(managementEndpoint), + ManagementEndpoint: managementEndpoint, NodeTypes: nodeTypes, - ReliabilityLevel: servicefabric.ReliabilityLevel(reliabilityLevel), + ReliabilityLevel: &reliabilityLevel, UpgradeDescription: upgradePolicy, - UpgradeMode: servicefabric.UpgradeMode(upgradeMode), - VMImage: utils.String(vmImage), + UpgradeMode: &upgradeMode, + VmImage: utils.String(vmImage), }, } if sfZonalUpgradeMode, ok := d.GetOk("service_fabric_zonal_upgrade_mode"); ok { - cluster.ClusterProperties.SfZonalUpgradeMode = servicefabric.SfZonalUpgradeMode(sfZonalUpgradeMode.(string)) + mode := cluster.SfZonalUpgradeMode(sfZonalUpgradeMode.(string)) + clusterModel.Properties.SfZonalUpgradeMode = &mode } if vmssZonalUpgradeMode, ok := d.GetOk("vmss_zonal_upgrade_mode"); ok { - cluster.ClusterProperties.VmssZonalUpgradeMode = servicefabric.VmssZonalUpgradeMode(vmssZonalUpgradeMode.(string)) + mode := cluster.VMSSZonalUpgradeMode(vmssZonalUpgradeMode.(string)) + clusterModel.Properties.VMSSZonalUpgradeMode = &mode } if certificateRaw, ok := d.GetOk("certificate"); ok { certificate := expandServiceFabricClusterCertificate(certificateRaw.([]interface{})) - cluster.ClusterProperties.Certificate = certificate + clusterModel.Properties.Certificate = certificate } if reverseProxyCertificateRaw, ok := d.GetOk("reverse_proxy_certificate"); ok { reverseProxyCertificate := expandServiceFabricClusterReverseProxyCertificate(reverseProxyCertificateRaw.([]interface{})) - cluster.ClusterProperties.ReverseProxyCertificate = reverseProxyCertificate + clusterModel.Properties.ReverseProxyCertificate = reverseProxyCertificate } if clientCertificateThumbprintRaw, ok := d.GetOk("client_certificate_thumbprint"); ok { clientCertificateThumbprints := expandServiceFabricClusterClientCertificateThumbprints(clientCertificateThumbprintRaw.([]interface{})) - cluster.ClusterProperties.ClientCertificateThumbprints = clientCertificateThumbprints + clusterModel.Properties.ClientCertificateThumbprints = clientCertificateThumbprints } if clientCertificateCommonNamesRaw, ok := d.GetOk("client_certificate_common_name"); ok { clientCertificateCommonNames := expandServiceFabricClusterClientCertificateCommonNames(clientCertificateCommonNamesRaw.([]interface{})) - cluster.ClusterProperties.ClientCertificateCommonNames = clientCertificateCommonNames + clusterModel.Properties.ClientCertificateCommonNames = clientCertificateCommonNames } if clusterCodeVersion != "" { - cluster.ClusterProperties.ClusterCodeVersion = utils.String(clusterCodeVersion) + clusterModel.Properties.ClusterCodeVersion = utils.String(clusterCodeVersion) } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, cluster) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, clusterModel); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the creation of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceServiceFabricClusterRead(d, meta) } @@ -676,98 +672,123 @@ func resourceServiceFabricClusterRead(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ClusterID(d.Id()) + id, err := cluster.ParseClusterID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[WARN] Service Fabric Cluster %q (Resource Group %q) was not found - removing from state!", id.Name, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[WARN] %s was not found - removing from state!", id.ID()) d.SetId("") return nil } - return fmt.Errorf("retrieving Service Fabric Cluster %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id.ID(), err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - - if props := resp.ClusterProperties; props != nil { - d.Set("cluster_code_version", props.ClusterCodeVersion) - d.Set("cluster_endpoint", props.ClusterEndpoint) - d.Set("management_endpoint", props.ManagementEndpoint) - d.Set("reliability_level", string(props.ReliabilityLevel)) - d.Set("vm_image", props.VMImage) - d.Set("upgrade_mode", string(props.UpgradeMode)) - d.Set("service_fabric_zonal_upgrade_mode", string(props.SfZonalUpgradeMode)) - d.Set("vmss_zonal_upgrade_mode", string(props.VmssZonalUpgradeMode)) - - addOnFeatures := flattenServiceFabricClusterAddOnFeatures(props.AddOnFeatures) - if err := d.Set("add_on_features", pluginsdk.NewSet(pluginsdk.HashString, addOnFeatures)); err != nil { - return fmt.Errorf("setting `add_on_features`: %+v", err) - } + d.Set("name", id.ClusterName) + d.Set("resource_group_name", id.ResourceGroupName) - azureActiveDirectory := flattenServiceFabricClusterAzureActiveDirectory(props.AzureActiveDirectory) - if err := d.Set("azure_active_directory", azureActiveDirectory); err != nil { - return fmt.Errorf("setting `azure_active_directory`: %+v", err) - } + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) - certificate := flattenServiceFabricClusterCertificate(props.Certificate) - if err := d.Set("certificate", certificate); err != nil { - return fmt.Errorf("setting `certificate`: %+v", err) - } + if props := model.Properties; props != nil { + d.Set("cluster_code_version", props.ClusterCodeVersion) + d.Set("cluster_endpoint", props.ClusterEndpoint) + d.Set("management_endpoint", props.ManagementEndpoint) + d.Set("vm_image", props.VmImage) - certificateCommonNames := flattenServiceFabricClusterCertificateCommonNames(props.CertificateCommonNames) - if err := d.Set("certificate_common_names", certificateCommonNames); err != nil { - return fmt.Errorf("setting `certificate_common_names`: %+v", err) - } + reliabilityLevel := "" + if props.ReliabilityLevel != nil { + reliabilityLevel = string(*props.ReliabilityLevel) + } + d.Set("reliability_level", reliabilityLevel) - reverseProxyCertificate := flattenServiceFabricClusterReverseProxyCertificate(props.ReverseProxyCertificate) - if err := d.Set("reverse_proxy_certificate", reverseProxyCertificate); err != nil { - return fmt.Errorf("setting `reverse_proxy_certificate`: %+v", err) - } + upgradeMode := "" + if props.UpgradeMode != nil { + upgradeMode = string(*props.UpgradeMode) + } + d.Set("upgrade_mode", upgradeMode) - reverseProxyCertificateCommonNames := flattenServiceFabricClusterCertificateCommonNames(props.ReverseProxyCertificateCommonNames) - if err := d.Set("reverse_proxy_certificate_common_names", reverseProxyCertificateCommonNames); err != nil { - return fmt.Errorf("setting `reverse_proxy_certificate_common_names`: %+v", err) - } + sfZonalMode := "" + if props.SfZonalUpgradeMode != nil { + sfZonalMode = string(*props.SfZonalUpgradeMode) + } + d.Set("service_fabric_zonal_upgrade_mode", sfZonalMode) - clientCertificateThumbprints := flattenServiceFabricClusterClientCertificateThumbprints(props.ClientCertificateThumbprints) - if err := d.Set("client_certificate_thumbprint", clientCertificateThumbprints); err != nil { - return fmt.Errorf("setting `client_certificate_thumbprint`: %+v", err) - } + vmssZonalMode := "" + if props.VMSSZonalUpgradeMode != nil { + vmssZonalMode = string(*props.VMSSZonalUpgradeMode) + } + d.Set("vmss_zonal_upgrade_mode", vmssZonalMode) - clientCertificateCommonNames := flattenServiceFabricClusterClientCertificateCommonNames(props.ClientCertificateCommonNames) - if err := d.Set("client_certificate_common_name", clientCertificateCommonNames); err != nil { - return fmt.Errorf("setting `client_certificate_common_name`: %+v", err) - } + addOnFeatures := flattenServiceFabricClusterAddOnFeatures(props.AddOnFeatures) + if err := d.Set("add_on_features", pluginsdk.NewSet(pluginsdk.HashString, addOnFeatures)); err != nil { + return fmt.Errorf("setting `add_on_features`: %+v", err) + } - diagnostics := flattenServiceFabricClusterDiagnosticsConfig(props.DiagnosticsStorageAccountConfig) - if err := d.Set("diagnostics_config", diagnostics); err != nil { - return fmt.Errorf("setting `diagnostics_config`: %+v", err) - } + azureActiveDirectory := flattenServiceFabricClusterAzureActiveDirectory(props.AzureActiveDirectory) + if err := d.Set("azure_active_directory", azureActiveDirectory); err != nil { + return fmt.Errorf("setting `azure_active_directory`: %+v", err) + } - upgradePolicy := flattenServiceFabricClusterUpgradePolicy(props.UpgradeDescription) - if err := d.Set("upgrade_policy", upgradePolicy); err != nil { - return fmt.Errorf("setting `upgrade_policy`: %+v", err) - } + certificate := flattenServiceFabricClusterCertificate(props.Certificate) + if err := d.Set("certificate", certificate); err != nil { + return fmt.Errorf("setting `certificate`: %+v", err) + } - fabricSettings := flattenServiceFabricClusterFabricSettings(props.FabricSettings) - if err := d.Set("fabric_settings", fabricSettings); err != nil { - return fmt.Errorf("setting `fabric_settings`: %+v", err) - } + certificateCommonNames := flattenServiceFabricClusterCertificateCommonNames(props.CertificateCommonNames) + if err := d.Set("certificate_common_names", certificateCommonNames); err != nil { + return fmt.Errorf("setting `certificate_common_names`: %+v", err) + } + + reverseProxyCertificate := flattenServiceFabricClusterReverseProxyCertificate(props.ReverseProxyCertificate) + if err := d.Set("reverse_proxy_certificate", reverseProxyCertificate); err != nil { + return fmt.Errorf("setting `reverse_proxy_certificate`: %+v", err) + } + + reverseProxyCertificateCommonNames := flattenServiceFabricClusterCertificateCommonNames(props.ReverseProxyCertificateCommonNames) + if err := d.Set("reverse_proxy_certificate_common_names", reverseProxyCertificateCommonNames); err != nil { + return fmt.Errorf("setting `reverse_proxy_certificate_common_names`: %+v", err) + } + + clientCertificateThumbprints := flattenServiceFabricClusterClientCertificateThumbprints(props.ClientCertificateThumbprints) + if err := d.Set("client_certificate_thumbprint", clientCertificateThumbprints); err != nil { + return fmt.Errorf("setting `client_certificate_thumbprint`: %+v", err) + } + + clientCertificateCommonNames := flattenServiceFabricClusterClientCertificateCommonNames(props.ClientCertificateCommonNames) + if err := d.Set("client_certificate_common_name", clientCertificateCommonNames); err != nil { + return fmt.Errorf("setting `client_certificate_common_name`: %+v", err) + } + + diagnostics := flattenServiceFabricClusterDiagnosticsConfig(props.DiagnosticsStorageAccountConfig) + if err := d.Set("diagnostics_config", diagnostics); err != nil { + return fmt.Errorf("setting `diagnostics_config`: %+v", err) + } + + upgradePolicy := flattenServiceFabricClusterUpgradePolicy(props.UpgradeDescription) + if err := d.Set("upgrade_policy", upgradePolicy); err != nil { + return fmt.Errorf("setting `upgrade_policy`: %+v", err) + } - nodeTypes := flattenServiceFabricClusterNodeTypes(props.NodeTypes) - if err := d.Set("node_type", nodeTypes); err != nil { - return fmt.Errorf("setting `node_type`: %+v", err) + fabricSettings := flattenServiceFabricClusterFabricSettings(props.FabricSettings) + if err := d.Set("fabric_settings", fabricSettings); err != nil { + return fmt.Errorf("setting `fabric_settings`: %+v", err) + } + + nodeTypes := flattenServiceFabricClusterNodeTypes(props.NodeTypes) + if err := d.Set("node_type", nodeTypes); err != nil { + return fmt.Errorf("setting `node_type`: %+v", err) + } } + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceServiceFabricClusterDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -775,34 +796,34 @@ func resourceServiceFabricClusterDelete(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ClusterID(d.Id()) + id, err := cluster.ParseClusterID(d.Id()) if err != nil { return err } - log.Printf("[DEBUG] Deleting Service Fabric Cluster %q (Resource Group %q)", id.Name, id.ResourceGroup) + log.Printf("[DEBUG] Deleting %s", id.ID()) - resp, err := client.Delete(ctx, id.ResourceGroup, id.Name) + resp, err := client.Delete(ctx, *id) if err != nil { - if !response.WasNotFound(resp.Response) { - return fmt.Errorf("deleting Service Fabric Cluster %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", id.ID(), err) } } return nil } -func expandServiceFabricClusterAddOnFeatures(input []interface{}) *[]string { - output := make([]string, 0) +func expandServiceFabricClusterAddOnFeatures(input []interface{}) *[]cluster.AddOnFeatures { + output := make([]cluster.AddOnFeatures, 0) for _, v := range input { - output = append(output, v.(string)) + output = append(output, cluster.AddOnFeatures(v.(string))) } return &output } -func expandServiceFabricClusterAzureActiveDirectory(input []interface{}) *servicefabric.AzureActiveDirectory { +func expandServiceFabricClusterAzureActiveDirectory(input []interface{}) *cluster.AzureActiveDirectory { if len(input) == 0 { return nil } @@ -813,21 +834,21 @@ func expandServiceFabricClusterAzureActiveDirectory(input []interface{}) *servic clusterApplication := v["cluster_application_id"].(string) clientApplication := v["client_application_id"].(string) - config := servicefabric.AzureActiveDirectory{ - TenantID: utils.String(tenantId), + config := cluster.AzureActiveDirectory{ + TenantId: utils.String(tenantId), ClusterApplication: utils.String(clusterApplication), ClientApplication: utils.String(clientApplication), } return &config } -func flattenServiceFabricClusterAzureActiveDirectory(input *servicefabric.AzureActiveDirectory) []interface{} { +func flattenServiceFabricClusterAzureActiveDirectory(input *cluster.AzureActiveDirectory) []interface{} { results := make([]interface{}, 0) if v := input; v != nil { output := make(map[string]interface{}) - if name := v.TenantID; name != nil { + if name := v.TenantId; name != nil { output["tenant_id"] = *name } @@ -845,19 +866,19 @@ func flattenServiceFabricClusterAzureActiveDirectory(input *servicefabric.AzureA return results } -func flattenServiceFabricClusterAddOnFeatures(input *[]string) []interface{} { +func flattenServiceFabricClusterAddOnFeatures(input *[]cluster.AddOnFeatures) []interface{} { output := make([]interface{}, 0) if input != nil { for _, v := range *input { - output = append(output, v) + output = append(output, string(v)) } } return output } -func expandServiceFabricClusterCertificate(input []interface{}) *servicefabric.CertificateDescription { +func expandServiceFabricClusterCertificate(input []interface{}) *cluster.CertificateDescription { if len(input) == 0 { return nil } @@ -865,11 +886,11 @@ func expandServiceFabricClusterCertificate(input []interface{}) *servicefabric.C v := input[0].(map[string]interface{}) thumbprint := v["thumbprint"].(string) - x509StoreName := v["x509_store_name"].(string) + x509StoreName := cluster.X509StoreName(v["x509_store_name"].(string)) - result := servicefabric.CertificateDescription{ - Thumbprint: utils.String(thumbprint), - X509StoreName: servicefabric.X509StoreName(x509StoreName), + result := cluster.CertificateDescription{ + Thumbprint: thumbprint, + X509StoreName: &x509StoreName, } if thumb, ok := v["thumbprint_secondary"]; ok { @@ -879,28 +900,26 @@ func expandServiceFabricClusterCertificate(input []interface{}) *servicefabric.C return &result } -func flattenServiceFabricClusterCertificate(input *servicefabric.CertificateDescription) []interface{} { +func flattenServiceFabricClusterCertificate(input *cluster.CertificateDescription) []interface{} { results := make([]interface{}, 0) if v := input; v != nil { output := make(map[string]interface{}) - if thumbprint := input.Thumbprint; thumbprint != nil { - output["thumbprint"] = *thumbprint - } + output["thumbprint"] = input.Thumbprint if thumbprint := input.ThumbprintSecondary; thumbprint != nil { output["thumbprint_secondary"] = *thumbprint } - output["x509_store_name"] = string(input.X509StoreName) + output["x509_store_name"] = input.X509StoreName results = append(results, output) } return results } -func expandServiceFabricClusterCertificateCommonNames(d *pluginsdk.ResourceData) *servicefabric.ServerCertificateCommonNames { +func expandServiceFabricClusterCertificateCommonNames(d *pluginsdk.ResourceData) *cluster.ServerCertificateCommonNames { i := d.Get("certificate_common_names").([]interface{}) if len(i) == 0 || i[0] == nil { return nil @@ -908,32 +927,30 @@ func expandServiceFabricClusterCertificateCommonNames(d *pluginsdk.ResourceData) input := i[0].(map[string]interface{}) commonNamesRaw := input["common_names"].(*pluginsdk.Set).List() - commonNames := make([]servicefabric.ServerCertificateCommonName, 0) + commonNames := make([]cluster.ServerCertificateCommonName, 0) for _, commonName := range commonNamesRaw { commonNameDetails := commonName.(map[string]interface{}) - certificateCommonName := commonNameDetails["certificate_common_name"].(string) - certificateIssuerThumbprint := commonNameDetails["certificate_issuer_thumbprint"].(string) - commonName := servicefabric.ServerCertificateCommonName{ - CertificateCommonName: &certificateCommonName, - CertificateIssuerThumbprint: &certificateIssuerThumbprint, + commonName := cluster.ServerCertificateCommonName{ + CertificateCommonName: commonNameDetails["certificate_common_name"].(string), + CertificateIssuerThumbprint: commonNameDetails["certificate_issuer_thumbprint"].(string), } commonNames = append(commonNames, commonName) } - x509StoreName := input["x509_store_name"].(string) + x509StoreName := cluster.X509StoreName(input["x509_store_name"].(string)) - output := servicefabric.ServerCertificateCommonNames{ + output := cluster.ServerCertificateCommonNames{ CommonNames: &commonNames, - X509StoreName: servicefabric.X509StoreName1(x509StoreName), + X509StoreName: &x509StoreName, } return &output } -func expandServiceFabricClusterReverseProxyCertificateCommonNames(d *pluginsdk.ResourceData) *servicefabric.ServerCertificateCommonNames { +func expandServiceFabricClusterReverseProxyCertificateCommonNames(d *pluginsdk.ResourceData) *cluster.ServerCertificateCommonNames { i := d.Get("reverse_proxy_certificate_common_names").([]interface{}) if len(i) == 0 || i[0] == nil { return nil @@ -941,32 +958,30 @@ func expandServiceFabricClusterReverseProxyCertificateCommonNames(d *pluginsdk.R input := i[0].(map[string]interface{}) commonNamesRaw := input["common_names"].(*pluginsdk.Set).List() - commonNames := make([]servicefabric.ServerCertificateCommonName, 0) + commonNames := make([]cluster.ServerCertificateCommonName, 0) for _, commonName := range commonNamesRaw { commonNameDetails := commonName.(map[string]interface{}) - certificateCommonName := commonNameDetails["certificate_common_name"].(string) - certificateIssuerThumbprint := commonNameDetails["certificate_issuer_thumbprint"].(string) - commonName := servicefabric.ServerCertificateCommonName{ - CertificateCommonName: &certificateCommonName, - CertificateIssuerThumbprint: &certificateIssuerThumbprint, + commonName := cluster.ServerCertificateCommonName{ + CertificateCommonName: commonNameDetails["certificate_common_name"].(string), + CertificateIssuerThumbprint: commonNameDetails["certificate_issuer_thumbprint"].(string), } commonNames = append(commonNames, commonName) } - x509StoreName := input["x509_store_name"].(string) + x509StoreName := cluster.X509StoreName(input["x509_store_name"].(string)) - output := servicefabric.ServerCertificateCommonNames{ + output := cluster.ServerCertificateCommonNames{ CommonNames: &commonNames, - X509StoreName: servicefabric.X509StoreName1(x509StoreName), + X509StoreName: &x509StoreName, } return &output } -func flattenServiceFabricClusterCertificateCommonNames(in *servicefabric.ServerCertificateCommonNames) []interface{} { +func flattenServiceFabricClusterCertificateCommonNames(in *cluster.ServerCertificateCommonNames) []interface{} { if in == nil { return []interface{}{} } @@ -978,13 +993,8 @@ func flattenServiceFabricClusterCertificateCommonNames(in *servicefabric.ServerC for _, i := range *commonNames { commonName := make(map[string]interface{}) - if i.CertificateCommonName != nil { - commonName["certificate_common_name"] = *i.CertificateCommonName - } - - if i.CertificateIssuerThumbprint != nil { - commonName["certificate_issuer_thumbprint"] = *i.CertificateIssuerThumbprint - } + commonName["certificate_common_name"] = i.CertificateCommonName + commonName["certificate_issuer_thumbprint"] = i.CertificateIssuerThumbprint common_names = append(common_names, commonName) } @@ -992,24 +1002,23 @@ func flattenServiceFabricClusterCertificateCommonNames(in *servicefabric.ServerC output["common_names"] = common_names } - output["x509_store_name"] = string(in.X509StoreName) + output["x509_store_name"] = in.X509StoreName return []interface{}{output} } -func expandServiceFabricClusterReverseProxyCertificate(input []interface{}) *servicefabric.CertificateDescription { +func expandServiceFabricClusterReverseProxyCertificate(input []interface{}) *cluster.CertificateDescription { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - thumbprint := v["thumbprint"].(string) - x509StoreName := v["x509_store_name"].(string) + x509StoreName := cluster.X509StoreName(v["x509_store_name"].(string)) - result := servicefabric.CertificateDescription{ - Thumbprint: utils.String(thumbprint), - X509StoreName: servicefabric.X509StoreName(x509StoreName), + result := cluster.CertificateDescription{ + Thumbprint: v["thumbprint"].(string), + X509StoreName: &x509StoreName, } if thumb, ok := v["thumbprint_secondary"]; ok { @@ -1019,39 +1028,34 @@ func expandServiceFabricClusterReverseProxyCertificate(input []interface{}) *ser return &result } -func flattenServiceFabricClusterReverseProxyCertificate(input *servicefabric.CertificateDescription) []interface{} { +func flattenServiceFabricClusterReverseProxyCertificate(input *cluster.CertificateDescription) []interface{} { results := make([]interface{}, 0) if v := input; v != nil { output := make(map[string]interface{}) - if thumbprint := input.Thumbprint; thumbprint != nil { - output["thumbprint"] = *thumbprint - } + output["thumbprint"] = input.Thumbprint if thumbprint := input.ThumbprintSecondary; thumbprint != nil { output["thumbprint_secondary"] = *thumbprint } - output["x509_store_name"] = string(input.X509StoreName) + output["x509_store_name"] = input.X509StoreName results = append(results, output) } return results } -func expandServiceFabricClusterClientCertificateThumbprints(input []interface{}) *[]servicefabric.ClientCertificateThumbprint { - results := make([]servicefabric.ClientCertificateThumbprint, 0) +func expandServiceFabricClusterClientCertificateThumbprints(input []interface{}) *[]cluster.ClientCertificateThumbprint { + results := make([]cluster.ClientCertificateThumbprint, 0) for _, v := range input { val := v.(map[string]interface{}) - thumbprint := val["thumbprint"].(string) - isAdmin := val["is_admin"].(bool) - - result := servicefabric.ClientCertificateThumbprint{ - CertificateThumbprint: utils.String(thumbprint), - IsAdmin: utils.Bool(isAdmin), + result := cluster.ClientCertificateThumbprint{ + CertificateThumbprint: val["thumbprint"].(string), + IsAdmin: val["is_admin"].(bool), } results = append(results, result) } @@ -1059,7 +1063,7 @@ func expandServiceFabricClusterClientCertificateThumbprints(input []interface{}) return &results } -func flattenServiceFabricClusterClientCertificateThumbprints(input *[]servicefabric.ClientCertificateThumbprint) []interface{} { +func flattenServiceFabricClusterClientCertificateThumbprints(input *[]cluster.ClientCertificateThumbprint) []interface{} { if input == nil { return []interface{}{} } @@ -1069,13 +1073,8 @@ func flattenServiceFabricClusterClientCertificateThumbprints(input *[]servicefab for _, v := range *input { result := make(map[string]interface{}) - if thumbprint := v.CertificateThumbprint; thumbprint != nil { - result["thumbprint"] = *thumbprint - } - - if isAdmin := v.IsAdmin; isAdmin != nil { - result["is_admin"] = *isAdmin - } + result["thumbprint"] = v.CertificateThumbprint + result["is_admin"] = v.IsAdmin results = append(results, result) } @@ -1083,20 +1082,20 @@ func flattenServiceFabricClusterClientCertificateThumbprints(input *[]servicefab return results } -func expandServiceFabricClusterClientCertificateCommonNames(input []interface{}) *[]servicefabric.ClientCertificateCommonName { - results := make([]servicefabric.ClientCertificateCommonName, 0) +func expandServiceFabricClusterClientCertificateCommonNames(input []interface{}) *[]cluster.ClientCertificateCommonName { + results := make([]cluster.ClientCertificateCommonName, 0) for _, v := range input { val := v.(map[string]interface{}) - certificate_common_name := val["common_name"].(string) - certificate_issuer_thumbprint := val["issuer_thumbprint"].(string) + certificateCommonName := val["common_name"].(string) + certificateIssuerThumbprint := val["issuer_thumbprint"].(string) isAdmin := val["is_admin"].(bool) - result := servicefabric.ClientCertificateCommonName{ - CertificateCommonName: utils.String(certificate_common_name), - CertificateIssuerThumbprint: utils.String(certificate_issuer_thumbprint), - IsAdmin: utils.Bool(isAdmin), + result := cluster.ClientCertificateCommonName{ + CertificateCommonName: certificateCommonName, + CertificateIssuerThumbprint: certificateIssuerThumbprint, + IsAdmin: isAdmin, } results = append(results, result) } @@ -1104,7 +1103,7 @@ func expandServiceFabricClusterClientCertificateCommonNames(input []interface{}) return &results } -func flattenServiceFabricClusterClientCertificateCommonNames(input *[]servicefabric.ClientCertificateCommonName) []interface{} { +func flattenServiceFabricClusterClientCertificateCommonNames(input *[]cluster.ClientCertificateCommonName) []interface{} { if input == nil { return []interface{}{} } @@ -1114,71 +1113,44 @@ func flattenServiceFabricClusterClientCertificateCommonNames(input *[]servicefab for _, v := range *input { result := make(map[string]interface{}) - if certificate_common_name := v.CertificateCommonName; certificate_common_name != nil { - result["common_name"] = *certificate_common_name - } - - if certificate_issuer_thumbprint := v.CertificateIssuerThumbprint; certificate_issuer_thumbprint != nil { - result["issuer_thumbprint"] = *certificate_issuer_thumbprint - } + result["common_name"] = v.CertificateCommonName + result["issuer_thumbprint"] = v.CertificateIssuerThumbprint + result["is_admin"] = v.IsAdmin - if isAdmin := v.IsAdmin; isAdmin != nil { - result["is_admin"] = *isAdmin - } results = append(results, result) } return results } -func expandServiceFabricClusterDiagnosticsConfig(input []interface{}) *servicefabric.DiagnosticsStorageAccountConfig { +func expandServiceFabricClusterDiagnosticsConfig(input []interface{}) *cluster.DiagnosticsStorageAccountConfig { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - storageAccountName := v["storage_account_name"].(string) - protectedAccountKeyName := v["protected_account_key_name"].(string) - blobEndpoint := v["blob_endpoint"].(string) - queueEndpoint := v["queue_endpoint"].(string) - tableEndpoint := v["table_endpoint"].(string) - - config := servicefabric.DiagnosticsStorageAccountConfig{ - StorageAccountName: utils.String(storageAccountName), - ProtectedAccountKeyName: utils.String(protectedAccountKeyName), - BlobEndpoint: utils.String(blobEndpoint), - QueueEndpoint: utils.String(queueEndpoint), - TableEndpoint: utils.String(tableEndpoint), + config := cluster.DiagnosticsStorageAccountConfig{ + StorageAccountName: v["storage_account_name"].(string), + ProtectedAccountKeyName: v["protected_account_key_name"].(string), + BlobEndpoint: v["blob_endpoint"].(string), + QueueEndpoint: v["queue_endpoint"].(string), + TableEndpoint: v["table_endpoint"].(string), } return &config } -func flattenServiceFabricClusterDiagnosticsConfig(input *servicefabric.DiagnosticsStorageAccountConfig) []interface{} { +func flattenServiceFabricClusterDiagnosticsConfig(input *cluster.DiagnosticsStorageAccountConfig) []interface{} { results := make([]interface{}, 0) if v := input; v != nil { output := make(map[string]interface{}) - if name := v.StorageAccountName; name != nil { - output["storage_account_name"] = *name - } - - if name := v.ProtectedAccountKeyName; name != nil { - output["protected_account_key_name"] = *name - } - - if endpoint := v.BlobEndpoint; endpoint != nil { - output["blob_endpoint"] = *endpoint - } - - if endpoint := v.QueueEndpoint; endpoint != nil { - output["queue_endpoint"] = *endpoint - } - - if endpoint := v.TableEndpoint; endpoint != nil { - output["table_endpoint"] = *endpoint - } + output["storage_account_name"] = v.StorageAccountName + output["protected_account_key_name"] = v.ProtectedAccountKeyName + output["blob_endpoint"] = v.BlobEndpoint + output["queue_endpoint"] = v.QueueEndpoint + output["table_endpoint"] = v.TableEndpoint results = append(results, output) } @@ -1186,48 +1158,48 @@ func flattenServiceFabricClusterDiagnosticsConfig(input *servicefabric.Diagnosti return results } -func expandServiceFabricClusterUpgradePolicyDeltaHealthPolicy(input []interface{}) *servicefabric.ClusterUpgradeDeltaHealthPolicy { +func expandServiceFabricClusterUpgradePolicyDeltaHealthPolicy(input []interface{}) *cluster.ClusterUpgradeDeltaHealthPolicy { if len(input) == 0 || input[0] == nil { return nil } - deltaHealthPolicy := &servicefabric.ClusterUpgradeDeltaHealthPolicy{} + deltaHealthPolicy := &cluster.ClusterUpgradeDeltaHealthPolicy{} v := input[0].(map[string]interface{}) - deltaHealthPolicy.MaxPercentDeltaUnhealthyNodes = utils.Int32(int32(v["max_delta_unhealthy_nodes_percent"].(int))) - deltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes = utils.Int32(int32(v["max_upgrade_domain_delta_unhealthy_nodes_percent"].(int))) - deltaHealthPolicy.MaxPercentDeltaUnhealthyApplications = utils.Int32(int32(v["max_delta_unhealthy_applications_percent"].(int))) + deltaHealthPolicy.MaxPercentDeltaUnhealthyNodes = int64(v["max_delta_unhealthy_nodes_percent"].(int)) + deltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes = int64(v["max_upgrade_domain_delta_unhealthy_nodes_percent"].(int)) + deltaHealthPolicy.MaxPercentDeltaUnhealthyApplications = int64(v["max_delta_unhealthy_applications_percent"].(int)) return deltaHealthPolicy } -func expandServiceFabricClusterUpgradePolicyHealthPolicy(input []interface{}) *servicefabric.ClusterHealthPolicy { +func expandServiceFabricClusterUpgradePolicyHealthPolicy(input []interface{}) cluster.ClusterHealthPolicy { + healthPolicy := cluster.ClusterHealthPolicy{} if len(input) == 0 || input[0] == nil { - return nil + return healthPolicy } - healthPolicy := &servicefabric.ClusterHealthPolicy{} v := input[0].(map[string]interface{}) - healthPolicy.MaxPercentUnhealthyApplications = utils.Int32(int32(v["max_unhealthy_applications_percent"].(int))) - healthPolicy.MaxPercentUnhealthyNodes = utils.Int32(int32(v["max_unhealthy_nodes_percent"].(int))) + healthPolicy.MaxPercentUnhealthyApplications = utils.Int64(int64(v["max_unhealthy_applications_percent"].(int))) + healthPolicy.MaxPercentUnhealthyNodes = utils.Int64(int64(v["max_unhealthy_nodes_percent"].(int))) return healthPolicy } -func expandServiceFabricClusterUpgradePolicy(input []interface{}) *servicefabric.ClusterUpgradePolicy { +func expandServiceFabricClusterUpgradePolicy(input []interface{}) *cluster.ClusterUpgradePolicy { if len(input) == 0 || input[0] == nil { return nil } - policy := &servicefabric.ClusterUpgradePolicy{} + policy := &cluster.ClusterUpgradePolicy{} v := input[0].(map[string]interface{}) policy.ForceRestart = utils.Bool(v["force_restart_enabled"].(bool)) - policy.HealthCheckStableDuration = utils.String(v["health_check_stable_duration"].(string)) - policy.UpgradeDomainTimeout = utils.String(v["upgrade_domain_timeout"].(string)) - policy.UpgradeReplicaSetCheckTimeout = utils.String(v["upgrade_replica_set_check_timeout"].(string)) - policy.UpgradeTimeout = utils.String(v["upgrade_timeout"].(string)) - policy.HealthCheckRetryTimeout = utils.String(v["health_check_retry_timeout"].(string)) - policy.HealthCheckWaitDuration = utils.String(v["health_check_wait_duration"].(string)) + policy.HealthCheckStableDuration = v["health_check_stable_duration"].(string) + policy.UpgradeDomainTimeout = v["upgrade_domain_timeout"].(string) + policy.UpgradeReplicaSetCheckTimeout = v["upgrade_replica_set_check_timeout"].(string) + policy.UpgradeTimeout = v["upgrade_timeout"].(string) + policy.HealthCheckRetryTimeout = v["health_check_retry_timeout"].(string) + policy.HealthCheckWaitDuration = v["health_check_wait_duration"].(string) if v["health_policy"] != nil { policy.HealthPolicy = expandServiceFabricClusterUpgradePolicyHealthPolicy(v["health_policy"].([]interface{})) @@ -1239,7 +1211,7 @@ func expandServiceFabricClusterUpgradePolicy(input []interface{}) *servicefabric return policy } -func flattenServiceFabricClusterUpgradePolicy(input *servicefabric.ClusterUpgradePolicy) []interface{} { +func flattenServiceFabricClusterUpgradePolicy(input *cluster.ClusterUpgradePolicy) []interface{} { if input == nil { return []interface{}{} } @@ -1250,29 +1222,12 @@ func flattenServiceFabricClusterUpgradePolicy(input *servicefabric.ClusterUpgrad output["force_restart_enabled"] = *forceRestart } - if healthCheckRetryTimeout := input.HealthCheckRetryTimeout; healthCheckRetryTimeout != nil { - output["health_check_retry_timeout"] = *healthCheckRetryTimeout - } - - if healthCheckStableDuration := input.HealthCheckStableDuration; healthCheckStableDuration != nil { - output["health_check_stable_duration"] = *healthCheckStableDuration - } - - if healthCheckWaitDuration := input.HealthCheckWaitDuration; healthCheckWaitDuration != nil { - output["health_check_wait_duration"] = *healthCheckWaitDuration - } - - if upgradeDomainTimeout := input.UpgradeDomainTimeout; upgradeDomainTimeout != nil { - output["upgrade_domain_timeout"] = *upgradeDomainTimeout - } - - if upgradeReplicaSetCheckTimeout := input.UpgradeReplicaSetCheckTimeout; upgradeReplicaSetCheckTimeout != nil { - output["upgrade_replica_set_check_timeout"] = *upgradeReplicaSetCheckTimeout - } - - if upgradeTimeout := input.UpgradeTimeout; upgradeTimeout != nil { - output["upgrade_timeout"] = *upgradeTimeout - } + output["health_check_retry_timeout"] = input.HealthCheckRetryTimeout + output["health_check_stable_duration"] = input.HealthCheckStableDuration + output["health_check_wait_duration"] = input.HealthCheckWaitDuration + output["upgrade_domain_timeout"] = input.UpgradeDomainTimeout + output["upgrade_replica_set_check_timeout"] = input.UpgradeReplicaSetCheckTimeout + output["upgrade_timeout"] = input.UpgradeTimeout output["health_policy"] = flattenServiceFabricClusterUpgradePolicyHealthPolicy(input.HealthPolicy) output["delta_health_policy"] = flattenServiceFabricClusterUpgradePolicyDeltaHealthPolicy(input.DeltaHealthPolicy) @@ -1280,11 +1235,7 @@ func flattenServiceFabricClusterUpgradePolicy(input *servicefabric.ClusterUpgrad return []interface{}{output} } -func flattenServiceFabricClusterUpgradePolicyHealthPolicy(input *servicefabric.ClusterHealthPolicy) []interface{} { - if input == nil { - return []interface{}{} - } - +func flattenServiceFabricClusterUpgradePolicyHealthPolicy(input cluster.ClusterHealthPolicy) []interface{} { output := make(map[string]interface{}) if input.MaxPercentUnhealthyApplications != nil { @@ -1298,48 +1249,40 @@ func flattenServiceFabricClusterUpgradePolicyHealthPolicy(input *servicefabric.C return []interface{}{output} } -func flattenServiceFabricClusterUpgradePolicyDeltaHealthPolicy(input *servicefabric.ClusterUpgradeDeltaHealthPolicy) []interface{} { +func flattenServiceFabricClusterUpgradePolicyDeltaHealthPolicy(input *cluster.ClusterUpgradeDeltaHealthPolicy) []interface{} { if input == nil { return []interface{}{} } output := make(map[string]interface{}) - if input.MaxPercentDeltaUnhealthyApplications != nil { - output["max_delta_unhealthy_applications_percent"] = input.MaxPercentDeltaUnhealthyApplications - } - - if input.MaxPercentDeltaUnhealthyNodes != nil { - output["max_delta_unhealthy_nodes_percent"] = input.MaxPercentDeltaUnhealthyNodes - } - - if input.MaxPercentUpgradeDomainDeltaUnhealthyNodes != nil { - output["max_upgrade_domain_delta_unhealthy_nodes_percent"] = input.MaxPercentUpgradeDomainDeltaUnhealthyNodes - } + output["max_delta_unhealthy_applications_percent"] = input.MaxPercentDeltaUnhealthyApplications + output["max_delta_unhealthy_nodes_percent"] = input.MaxPercentDeltaUnhealthyNodes + output["max_upgrade_domain_delta_unhealthy_nodes_percent"] = input.MaxPercentUpgradeDomainDeltaUnhealthyNodes return []interface{}{output} } -func expandServiceFabricClusterFabricSettings(input []interface{}) *[]servicefabric.SettingsSectionDescription { - results := make([]servicefabric.SettingsSectionDescription, 0) +func expandServiceFabricClusterFabricSettings(input []interface{}) *[]cluster.SettingsSectionDescription { + results := make([]cluster.SettingsSectionDescription, 0) for _, v := range input { val := v.(map[string]interface{}) name := val["name"].(string) - params := make([]servicefabric.SettingsParameterDescription, 0) + params := make([]cluster.SettingsParameterDescription, 0) paramsRaw := val["parameters"].(map[string]interface{}) for k, v := range paramsRaw { - param := servicefabric.SettingsParameterDescription{ - Name: utils.String(k), - Value: utils.String(v.(string)), + param := cluster.SettingsParameterDescription{ + Name: k, + Value: v.(string), } params = append(params, param) } - result := servicefabric.SettingsSectionDescription{ - Name: utils.String(name), - Parameters: ¶ms, + result := cluster.SettingsSectionDescription{ + Name: name, + Parameters: params, } results = append(results, result) } @@ -1347,7 +1290,7 @@ func expandServiceFabricClusterFabricSettings(input []interface{}) *[]servicefab return &results } -func flattenServiceFabricClusterFabricSettings(input *[]servicefabric.SettingsSectionDescription) []interface{} { +func flattenServiceFabricClusterFabricSettings(input *[]cluster.SettingsSectionDescription) []interface{} { if input == nil { return []interface{}{} } @@ -1357,18 +1300,12 @@ func flattenServiceFabricClusterFabricSettings(input *[]servicefabric.SettingsSe for _, v := range *input { result := make(map[string]interface{}) - if name := v.Name; name != nil { - result["name"] = *name - } + result["name"] = v.Name parameters := make(map[string]interface{}) if paramsRaw := v.Parameters; paramsRaw != nil { - for _, p := range *paramsRaw { - if p.Name == nil || p.Value == nil { - continue - } - - parameters[*p.Name] = *p.Value + for _, p := range paramsRaw { + parameters[p.Name] = p.Value } } result["parameters"] = parameters @@ -1378,26 +1315,21 @@ func flattenServiceFabricClusterFabricSettings(input *[]servicefabric.SettingsSe return results } -func expandServiceFabricClusterNodeTypes(input []interface{}) *[]servicefabric.NodeTypeDescription { - results := make([]servicefabric.NodeTypeDescription, 0) +func expandServiceFabricClusterNodeTypes(input []interface{}) []cluster.NodeTypeDescription { + results := make([]cluster.NodeTypeDescription, 0) for _, v := range input { node := v.(map[string]interface{}) - name := node["name"].(string) - instanceCount := node["instance_count"].(int) - clientEndpointPort := node["client_endpoint_port"].(int) - httpEndpointPort := node["http_endpoint_port"].(int) - isPrimary := node["is_primary"].(bool) - durabilityLevel := node["durability_level"].(string) - - result := servicefabric.NodeTypeDescription{ - Name: utils.String(name), - VMInstanceCount: utils.Int32(int32(instanceCount)), - IsPrimary: utils.Bool(isPrimary), - ClientConnectionEndpointPort: utils.Int32(int32(clientEndpointPort)), - HTTPGatewayEndpointPort: utils.Int32(int32(httpEndpointPort)), - DurabilityLevel: servicefabric.DurabilityLevel(durabilityLevel), + durabilityLevel := cluster.DurabilityLevel(node["durability_level"].(string)) + + result := cluster.NodeTypeDescription{ + Name: node["name"].(string), + VMInstanceCount: int64(node["instance_count"].(int)), + IsPrimary: node["is_primary"].(bool), + ClientConnectionEndpointPort: int64(node["client_endpoint_port"].(int)), + HTTPGatewayEndpointPort: int64(node["http_endpoint_port"].(int)), + DurabilityLevel: &durabilityLevel, } if isStateless, ok := node["is_stateless"]; ok { @@ -1409,37 +1341,34 @@ func expandServiceFabricClusterNodeTypes(input []interface{}) *[]servicefabric.N } if props, ok := node["placement_properties"]; ok { - placementProperties := make(map[string]*string) + placementProperties := make(map[string]string) for key, value := range props.(map[string]interface{}) { - placementProperties[key] = utils.String(value.(string)) + placementProperties[key] = value.(string) } - result.PlacementProperties = placementProperties + result.PlacementProperties = &placementProperties } if caps, ok := node["capacities"]; ok { - capacities := make(map[string]*string) + capacities := make(map[string]string) for key, value := range caps.(map[string]interface{}) { - capacities[key] = utils.String(value.(string)) + capacities[key] = value.(string) } - result.Capacities = capacities + result.Capacities = &capacities } - if v := int32(node["reverse_proxy_endpoint_port"].(int)); v != 0 { - result.ReverseProxyEndpointPort = utils.Int32(v) + if v := int64(node["reverse_proxy_endpoint_port"].(int)); v != 0 { + result.ReverseProxyEndpointPort = utils.Int64(v) } applicationPortsRaw := node["application_ports"].([]interface{}) if len(applicationPortsRaw) > 0 { portsRaw := applicationPortsRaw[0].(map[string]interface{}) - startPort := portsRaw["start_port"].(int) - endPort := portsRaw["end_port"].(int) - - result.ApplicationPorts = &servicefabric.EndpointRangeDescription{ - StartPort: utils.Int32(int32(startPort)), - EndPort: utils.Int32(int32(endPort)), + result.ApplicationPorts = &cluster.EndpointRangeDescription{ + StartPort: int64(portsRaw["start_port"].(int)), + EndPort: int64(portsRaw["end_port"].(int)), } } @@ -1447,57 +1376,40 @@ func expandServiceFabricClusterNodeTypes(input []interface{}) *[]servicefabric.N if len(ephemeralPortsRaw) > 0 { portsRaw := ephemeralPortsRaw[0].(map[string]interface{}) - startPort := portsRaw["start_port"].(int) - endPort := portsRaw["end_port"].(int) - - result.EphemeralPorts = &servicefabric.EndpointRangeDescription{ - StartPort: utils.Int32(int32(startPort)), - EndPort: utils.Int32(int32(endPort)), + result.EphemeralPorts = &cluster.EndpointRangeDescription{ + StartPort: int64(portsRaw["start_port"].(int)), + EndPort: int64(portsRaw["end_port"].(int)), } } results = append(results, result) } - return &results + return results } -func flattenServiceFabricClusterNodeTypes(input *[]servicefabric.NodeTypeDescription) []interface{} { +func flattenServiceFabricClusterNodeTypes(input []cluster.NodeTypeDescription) []interface{} { if input == nil { return []interface{}{} } results := make([]interface{}, 0) - for _, v := range *input { + for _, v := range input { output := make(map[string]interface{}) - if name := v.Name; name != nil { - output["name"] = *name - } + output["name"] = v.Name + output["instance_count"] = v.VMInstanceCount + output["is_primary"] = v.IsPrimary + output["client_endpoint_port"] = v.ClientConnectionEndpointPort + output["http_endpoint_port"] = v.HTTPGatewayEndpointPort if placementProperties := v.PlacementProperties; placementProperties != nil { - output["placement_properties"] = placementProperties + output["placement_properties"] = *placementProperties } if capacities := v.Capacities; capacities != nil { - output["capacities"] = capacities - } - - if count := v.VMInstanceCount; count != nil { - output["instance_count"] = int(*count) - } - - if primary := v.IsPrimary; primary != nil { - output["is_primary"] = *primary - } - - if port := v.ClientConnectionEndpointPort; port != nil { - output["client_endpoint_port"] = *port - } - - if port := v.HTTPGatewayEndpointPort; port != nil { - output["http_endpoint_port"] = *port + output["capacities"] = *capacities } if port := v.ReverseProxyEndpointPort; port != nil { @@ -1512,17 +1424,15 @@ func flattenServiceFabricClusterNodeTypes(input *[]servicefabric.NodeTypeDescrip output["multiple_availability_zones"] = *multipleAvailabilityZones } - output["durability_level"] = string(v.DurabilityLevel) + if durabilityLevel := v.DurabilityLevel; durabilityLevel != nil { + output["durability_level"] = string(*v.DurabilityLevel) + } applicationPorts := make([]interface{}, 0) if ports := v.ApplicationPorts; ports != nil { r := make(map[string]interface{}) - if start := ports.StartPort; start != nil { - r["start_port"] = int(*start) - } - if end := ports.EndPort; end != nil { - r["end_port"] = int(*end) - } + r["start_port"] = int(ports.StartPort) + r["end_port"] = int(ports.EndPort) applicationPorts = append(applicationPorts, r) } output["application_ports"] = applicationPorts @@ -1530,12 +1440,8 @@ func flattenServiceFabricClusterNodeTypes(input *[]servicefabric.NodeTypeDescrip ephemeralPorts := make([]interface{}, 0) if ports := v.EphemeralPorts; ports != nil { r := make(map[string]interface{}) - if start := ports.StartPort; start != nil { - r["start_port"] = int(*start) - } - if end := ports.EndPort; end != nil { - r["end_port"] = int(*end) - } + r["start_port"] = int(ports.StartPort) + r["end_port"] = int(ports.EndPort) ephemeralPorts = append(ephemeralPorts, r) } output["ephemeral_ports"] = ephemeralPorts diff --git a/internal/services/servicefabric/service_fabric_cluster_resource_test.go b/internal/services/servicefabric/service_fabric_cluster_resource_test.go index 3e15ba748a15..cce02f9e1a2a 100644 --- a/internal/services/servicefabric/service_fabric_cluster_resource_test.go +++ b/internal/services/servicefabric/service_fabric_cluster_resource_test.go @@ -5,10 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -768,16 +769,16 @@ func TestAccAzureRMServiceFabricCluster_zonalUpgradeMode(t *testing.T) { } func (r ServiceFabricClusterResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ClusterID(state.ID) + id, err := cluster.ParseClusterID(state.ID) if err != nil { return nil, err } - resp, err := client.ServiceFabric.ClustersClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.ServiceFabric.ClustersClient.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } - return nil, fmt.Errorf("retrieving Service Fabric Cluster %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", id.ID(), err) } return utils.Bool(true), nil } diff --git a/internal/services/servicefabric/validate/cluster_id.go b/internal/services/servicefabric/validate/cluster_id.go deleted file mode 100644 index 410f3ec62791..000000000000 --- a/internal/services/servicefabric/validate/cluster_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric/parse" -) - -func ClusterID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ClusterID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/servicefabric/validate/cluster_id_test.go b/internal/services/servicefabric/validate/cluster_id_test.go deleted file mode 100644 index 43647f3593fb..000000000000 --- a/internal/services/servicefabric/validate/cluster_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestClusterID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/clusters/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceFabric/clusters/cluster1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.SERVICEFABRIC/CLUSTERS/CLUSTER1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ClusterID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go b/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go index 26ee0d97bc9e..0372302e3574 100644 --- a/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go +++ b/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go @@ -154,17 +154,15 @@ func (k ClusterResource) Arguments() map[string]*pluginsdk.Schema { validation.StringMatch(regexp.MustCompile("^[^\\\\/\"\\[\\]:|<>+=;,?*$]{1,14}$"), "User names cannot contain special characters \\/\"\"[]:|<>+=;,$?*@")), }, "password": { - Type: pluginsdk.TypeString, - Optional: true, + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, ValidateFunc: validation.All( validation.StringLenBetween(8, 123), - validation.StringIsNotWhiteSpace), - }, - "resource_group_name": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringIsNotWhiteSpace, + validation.StringIsNotWhiteSpace, + ), }, + "resource_group_name": commonschema.ResourceGroupName(), "node_type": nodeTypeSchema(), "authentication": authSchema(), @@ -399,16 +397,16 @@ func (k ClusterResource) Read() sdk.ResourceFunc { if response.WasNotFound(cluster.HttpResponse) { return metadata.MarkAsGone(resourceId) } - return fmt.Errorf("while reading data for cluster %q: %+v", resourceId.ClusterName, err) + return fmt.Errorf("while reading data for cluster %q: %+v", resourceId.ManagedClusterName, err) } nts, err := nodeTypeClient.ListByManagedClustersComplete(ctx, nodetype.ManagedClusterId{ - SubscriptionId: resourceId.SubscriptionId, - ResourceGroupName: resourceId.ResourceGroupName, - ClusterName: resourceId.ClusterName, + SubscriptionId: resourceId.SubscriptionId, + ResourceGroupName: resourceId.ResourceGroupName, + ManagedClusterName: resourceId.ManagedClusterName, }) if err != nil { - return fmt.Errorf("while listing NodeTypes for cluster %q: +%v", resourceId.ClusterName, err) + return fmt.Errorf("while listing NodeTypes for cluster %q: +%v", resourceId.ManagedClusterName, err) } model := flattenClusterProperties(cluster.Model) @@ -770,11 +768,17 @@ func flattenNodetypeProperties(nt nodetype.NodeType) NodeType { VmImageVersion: utils.NormalizeNilableString(props.VMImageVersion), VmInstanceCount: props.VMInstanceCount, VmSize: utils.NormalizeNilableString(props.VMSize), - ApplicationPorts: fmt.Sprintf("%d-%d", props.ApplicationPorts.StartPort, props.ApplicationPorts.EndPort), - EphemeralPorts: fmt.Sprintf("%d-%d", props.EphemeralPorts.StartPort, props.EphemeralPorts.EndPort), Id: utils.NormalizeNilableString(nt.Id), } + if appPorts := props.ApplicationPorts; appPorts != nil { + out.ApplicationPorts = fmt.Sprintf("%d-%d", appPorts.StartPort, appPorts.EndPort) + } + + if ephemeralPorts := props.EphemeralPorts; ephemeralPorts != nil { + out.EphemeralPorts = fmt.Sprintf("%d-%d", ephemeralPorts.StartPort, ephemeralPorts.EndPort) + } + if mpg := props.MultiplePlacementGroups; mpg != nil { out.MultiplePlacementGroupsEnabled = *mpg } diff --git a/internal/services/signalr/signalr_service_data_source.go b/internal/services/signalr/signalr_service_data_source.go index 2ab75c7b3f4a..5b4f34c7bb31 100644 --- a/internal/services/signalr/signalr_service_data_source.go +++ b/internal/services/signalr/signalr_service_data_source.go @@ -106,7 +106,7 @@ func dataSourceArmSignalRServiceRead(d *pluginsdk.ResourceData, meta interface{} d.SetId(id.ID()) - d.Set("name", id.ResourceName) + d.Set("name", id.SignalRName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/signalr/signalr_service_network_acl_resource.go b/internal/services/signalr/signalr_service_network_acl_resource.go index b770192bc3ee..f424f3bdcdf4 100644 --- a/internal/services/signalr/signalr_service_network_acl_resource.go +++ b/internal/services/signalr/signalr_service_network_acl_resource.go @@ -151,8 +151,8 @@ func resourceSignalRServiceNetworkACLCreateUpdate(d *pluginsdk.ResourceData, met return err } - locks.ByName(id.ResourceName, "azurerm_signalr_service") - defer locks.UnlockByName(id.ResourceName, "azurerm_signalr_service") + locks.ByName(id.SignalRName, "azurerm_signalr_service") + defer locks.UnlockByName(id.SignalRName, "azurerm_signalr_service") resp, err := client.Get(ctx, *id) if err != nil { @@ -260,8 +260,8 @@ func resourceSignalRServiceNetworkACLDelete(d *pluginsdk.ResourceData, meta inte return err } - locks.ByName(id.ResourceName, "azurerm_signalr_service") - defer locks.UnlockByName(id.ResourceName, "azurerm_signalr_service") + locks.ByName(id.SignalRName, "azurerm_signalr_service") + defer locks.UnlockByName(id.SignalRName, "azurerm_signalr_service") resp, err := client.Get(ctx, *id) if err != nil { diff --git a/internal/services/signalr/signalr_service_resource.go b/internal/services/signalr/signalr_service_resource.go index 5b933d64184a..ba25781c7991 100644 --- a/internal/services/signalr/signalr_service_resource.go +++ b/internal/services/signalr/signalr_service_resource.go @@ -150,7 +150,7 @@ func resourceArmSignalRServiceRead(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("listing keys for %s: %+v", *id, err) } - d.Set("name", id.ResourceName) + d.Set("name", id.SignalRName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/signalr/signalr_shared_private_link_resource.go b/internal/services/signalr/signalr_shared_private_link_resource.go index 683154a89ce7..aa08b08160a7 100644 --- a/internal/services/signalr/signalr_shared_private_link_resource.go +++ b/internal/services/signalr/signalr_shared_private_link_resource.go @@ -89,7 +89,7 @@ func resourceSignalRSharedPrivateLinkCreateUpdate(d *pluginsdk.ResourceData, met return fmt.Errorf("parsing ID of %s: %+v", signalrID, err) } - id := signalr.NewSharedPrivateLinkResourceID(subscriptionId, signalrID.ResourceGroupName, signalrID.ResourceName, d.Get("name").(string)) + id := signalr.NewSharedPrivateLinkResourceID(subscriptionId, signalrID.ResourceGroupName, signalrID.SignalRName, d.Get("name").(string)) if d.IsNewResource() { existing, err := client.SharedPrivateLinkResourcesGet(ctx, id) if err != nil { @@ -143,7 +143,7 @@ func resourceSignalRSharedPrivateLinkRead(d *pluginsdk.ResourceData, meta interf if model := resp.Model; model != nil { d.Set("name", model.Name) - d.Set("signalr_service_id", signalr.NewSignalRID(id.SubscriptionId, id.ResourceGroupName, id.ResourceName).ID()) + d.Set("signalr_service_id", signalr.NewSignalRID(id.SubscriptionId, id.ResourceGroupName, id.SignalRName).ID()) if props := model.Properties; props != nil { d.Set("sub_resource_name", props.GroupId) diff --git a/internal/services/signalr/web_pubsub_data_source.go b/internal/services/signalr/web_pubsub_data_source.go index 53b495349207..0ca6b21553a2 100644 --- a/internal/services/signalr/web_pubsub_data_source.go +++ b/internal/services/signalr/web_pubsub_data_source.go @@ -2,7 +2,6 @@ package signalr import ( "fmt" - "log" "strings" "time" @@ -131,9 +130,7 @@ func dataSourceWebPubsubRead(d *pluginsdk.ResourceData, meta interface{}) error resp, err := client.Get(ctx, id) if err != nil { if response.WasNotFound(resp.HttpResponse) { - log.Printf("[INFO] Web Pubsub %s does not exist - removing from state", d.Id()) - d.SetId("") - return nil + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %q: %+v", id, err) } @@ -145,7 +142,7 @@ func dataSourceWebPubsubRead(d *pluginsdk.ResourceData, meta interface{}) error d.SetId(id.ID()) - d.Set("name", id.ResourceName) + d.Set("name", id.WebPubSubName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/signalr/web_pubsub_hub_resource.go b/internal/services/signalr/web_pubsub_hub_resource.go index 97bc1291cb99..b012e984f90c 100644 --- a/internal/services/signalr/web_pubsub_hub_resource.go +++ b/internal/services/signalr/web_pubsub_hub_resource.go @@ -126,7 +126,7 @@ func resourceWebPubSubHubCreateUpdate(d *pluginsdk.ResourceData, meta interface{ return fmt.Errorf("parsing ID of %q: %+v", webPubSubIdRaw, err) } - id := webpubsub.NewHubID(subscriptionId, webPubSubId.ResourceGroupName, webPubSubId.ResourceName, d.Get("name").(string)) + id := webpubsub.NewHubID(subscriptionId, webPubSubId.ResourceGroupName, webPubSubId.WebPubSubName, d.Get("name").(string)) if d.IsNewResource() { existing, err := client.HubsGet(ctx, id) if err != nil { @@ -181,7 +181,7 @@ func resourceWebPubSubHubRead(d *pluginsdk.ResourceData, meta interface{}) error } d.Set("name", id.HubName) - d.Set("web_pubsub_id", webpubsub.NewWebPubSubID(id.SubscriptionId, id.ResourceGroupName, id.ResourceName).ID()) + d.Set("web_pubsub_id", webpubsub.NewWebPubSubID(id.SubscriptionId, id.ResourceGroupName, id.WebPubSubName).ID()) if model := resp.Model; model != nil { if err := d.Set("event_handler", flattenEventHandler(model.Properties.EventHandlers)); err != nil { diff --git a/internal/services/signalr/web_pubsub_network_acl_resource.go b/internal/services/signalr/web_pubsub_network_acl_resource.go index 1bd39f4f3091..28276034f1fc 100644 --- a/internal/services/signalr/web_pubsub_network_acl_resource.go +++ b/internal/services/signalr/web_pubsub_network_acl_resource.go @@ -137,8 +137,8 @@ func resourceWebPubsubNetworkACLCreateUpdate(d *pluginsdk.ResourceData, meta int return fmt.Errorf("checking for present of existing %q: %+v", id, err) } - locks.ByName(id.ResourceName, "azurerm_web_pubsub") - defer locks.UnlockByName(id.ResourceName, "azurerm_web_pubsub") + locks.ByName(id.WebPubSubName, "azurerm_web_pubsub") + defer locks.UnlockByName(id.WebPubSubName, "azurerm_web_pubsub") if d.IsNewResource() { if !isNewNetworkACL(*existing.Model) { diff --git a/internal/services/signalr/web_pubsub_resource.go b/internal/services/signalr/web_pubsub_resource.go index 3a426e124af8..f2251106213a 100644 --- a/internal/services/signalr/web_pubsub_resource.go +++ b/internal/services/signalr/web_pubsub_resource.go @@ -272,7 +272,7 @@ func resourceWebPubSubRead(d *pluginsdk.ResourceData, meta interface{}) error { return fmt.Errorf("listing keys for %s: %+v", *id, err) } - d.Set("name", id.ResourceName) + d.Set("name", id.WebPubSubName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/signalr/web_pubsub_shared_private_link_resource.go b/internal/services/signalr/web_pubsub_shared_private_link_resource.go index a34091bc42b6..741c3beae487 100644 --- a/internal/services/signalr/web_pubsub_shared_private_link_resource.go +++ b/internal/services/signalr/web_pubsub_shared_private_link_resource.go @@ -85,7 +85,7 @@ func resourceWebPubsubSharedPrivateLinkServiceCreateUpdate(d *pluginsdk.Resource return fmt.Errorf("parsing ID of %q: %+v", webPubSubId, err) } - id := webpubsub.NewSharedPrivateLinkResourceID(subscriptionId, webPubSubId.ResourceGroupName, webPubSubId.ResourceName, d.Get("name").(string)) + id := webpubsub.NewSharedPrivateLinkResourceID(subscriptionId, webPubSubId.ResourceGroupName, webPubSubId.WebPubSubName, d.Get("name").(string)) if d.IsNewResource() { existing, err := client.SharedPrivateLinkResourcesGet(ctx, id) @@ -140,7 +140,7 @@ func resourceWebPubsubSharedPrivateLinkServiceRead(d *pluginsdk.ResourceData, me } d.Set("name", id.SharedPrivateLinkResourceName) - d.Set("web_pubsub_id", webpubsub.NewWebPubSubID(id.SubscriptionId, id.ResourceGroupName, id.ResourceName).ID()) + d.Set("web_pubsub_id", webpubsub.NewWebPubSubID(id.SubscriptionId, id.ResourceGroupName, id.WebPubSubName).ID()) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/springcloud/resourceids.go b/internal/services/springcloud/resourceids.go index c70416cf6365..58f411892cd5 100644 --- a/internal/services/springcloud/resourceids.go +++ b/internal/services/springcloud/resourceids.go @@ -1,22 +1,25 @@ package springcloud -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudAccelerator -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/Spring/spring1/applicationAccelerators/default //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudApp -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/spring/spring1/apps/app1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudAppAssociation -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/spring/spring1/apps/app1/bindings/bind1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudAPIPortal -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/spring/service1/apiPortals/apiPortal1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudAPIPortalCustomDomain -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/spring/service1/apiPortals/apiPortal1/domains/domain1 -rewrite=true -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudApplicationLiveView -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/spring/service1/applicationLiveViews/default //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudBuildServiceBuilder -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/spring/service1/buildServices/buildService1/builders/builder1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudBuildPackBinding -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/spring/service1/buildServices/buildService1/builders/builder1/buildPackBindings/buildPackBinding1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudDeployment -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/spring/spring1/apps/app1/deployments/deploy1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudCertificate -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/spring/spring1/certificates/cert1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudCustomDomain -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/spring/spring1/apps/app1/domains/domain.com -rewrite=true -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudCustomizedAccelerator -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/Spring/spring1/applicationAccelerators/default/customizedAccelerators/customizedAccelerator1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudConfigurationService -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/spring/service1/configurationServices/configurationService1 -rewrite=true -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudDevToolPortal -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/Spring/service1/DevToolPortals/default //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudGateway -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/spring/service1/gateways/gateway1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudGatewayCustomDomain -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/spring/service1/gateways/gateway1/domains/domain1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudGatewayRouteConfig -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/spring/service1/gateways/gateway1/routeConfigs/routeConfig1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudService -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/spring/spring1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudServiceRegistry -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/spring/spring1/serviceRegistries/serviceRegistry1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudStorage -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/spring/service1/storages/storage1 -rewrite=true + +// @tombuildsstuff: the following Resource IDs use the incorrect casing and will need State Migrations to fix the casing prior to moving to `hashicorp/go-azure-sdk` (e.g. `Spring` -> `spring`) +// in addition, Resources ending in `/default` shouldn't be exposed as separate resources - and instead should be embedded within the parent resource, as such these Resources will need to be deprecated and instead inlined within the parent Resource +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudAccelerator -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/Spring/spring1/applicationAccelerators/default +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudApplicationLiveView -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/spring/service1/applicationLiveViews/default +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudCustomizedAccelerator -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/Spring/spring1/applicationAccelerators/default/customizedAccelerators/customizedAccelerator1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudDevToolPortal -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/Spring/service1/DevToolPortals/default diff --git a/internal/services/springcloud/spring_cloud_accelerator_resource_test.go b/internal/services/springcloud/spring_cloud_accelerator_resource_test.go index 09c9b70b70fa..12e642f8a1ba 100644 --- a/internal/services/springcloud/spring_cloud_accelerator_resource_test.go +++ b/internal/services/springcloud/spring_cloud_accelerator_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -19,10 +18,10 @@ type SpringCloudAcceleratorResource struct{} func TestAccSpringCloudAccelerator_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_accelerator", "test") r := SpringCloudAcceleratorResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -33,10 +32,10 @@ func TestAccSpringCloudAccelerator_basic(t *testing.T) { func TestAccSpringCloudAccelerator_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_accelerator", "test") r := SpringCloudAcceleratorResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -44,7 +43,7 @@ func TestAccSpringCloudAccelerator_requiresImport(t *testing.T) { }) } -func (r SpringCloudAcceleratorResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r SpringCloudAcceleratorResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.SpringCloudAcceleratorID(state.ID) if err != nil { return nil, err diff --git a/internal/services/springcloud/spring_cloud_api_portal_custom_domain_resource_test.go b/internal/services/springcloud/spring_cloud_api_portal_custom_domain_resource_test.go index 08b4ca741c79..e4cb1be0215c 100644 --- a/internal/services/springcloud/spring_cloud_api_portal_custom_domain_resource_test.go +++ b/internal/services/springcloud/spring_cloud_api_portal_custom_domain_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -19,10 +18,10 @@ type SpringCloudAPIPortalCustomDomainResource struct{} func TestAccSpringCloudAPIPortalCustomDomain_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_api_portal_custom_domain", "test") r := SpringCloudAPIPortalCustomDomainResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -33,10 +32,10 @@ func TestAccSpringCloudAPIPortalCustomDomain_basic(t *testing.T) { func TestAccSpringCloudAPIPortalCustomDomain_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_api_portal_custom_domain", "test") r := SpringCloudAPIPortalCustomDomainResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -44,7 +43,7 @@ func TestAccSpringCloudAPIPortalCustomDomain_requiresImport(t *testing.T) { }) } -func (r SpringCloudAPIPortalCustomDomainResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r SpringCloudAPIPortalCustomDomainResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.SpringCloudAPIPortalCustomDomainID(state.ID) if err != nil { return nil, err diff --git a/internal/services/springcloud/spring_cloud_api_portal_resource_test.go b/internal/services/springcloud/spring_cloud_api_portal_resource_test.go index d8fd1bebf15f..9af2e1ac82bf 100644 --- a/internal/services/springcloud/spring_cloud_api_portal_resource_test.go +++ b/internal/services/springcloud/spring_cloud_api_portal_resource_test.go @@ -6,12 +6,11 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,10 +19,10 @@ type SpringCloudAPIPortalResource struct{} func TestAccSpringCloudAPIPortal_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_api_portal", "test") r := SpringCloudAPIPortalResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -34,10 +33,10 @@ func TestAccSpringCloudAPIPortal_basic(t *testing.T) { func TestAccSpringCloudAPIPortal_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_api_portal", "test") r := SpringCloudAPIPortalResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -50,10 +49,10 @@ func TestAccSpringCloudAPIPortal_complete(t *testing.T) { clientId := os.Getenv("ARM_CLIENT_ID") clientSecret := os.Getenv("ARM_CLIENT_SECRET") r := SpringCloudAPIPortalResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data, clientId, clientSecret), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -66,24 +65,24 @@ func TestAccSpringCloudAPIPortal_update(t *testing.T) { clientId := os.Getenv("ARM_CLIENT_ID") clientSecret := os.Getenv("ARM_CLIENT_SECRET") r := SpringCloudAPIPortalResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data, clientId, clientSecret), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("sso.0.client_id", "sso.0.client_secret"), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -91,7 +90,7 @@ func TestAccSpringCloudAPIPortal_update(t *testing.T) { }) } -func (r SpringCloudAPIPortalResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r SpringCloudAPIPortalResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.SpringCloudAPIPortalID(state.ID) if err != nil { return nil, err diff --git a/internal/services/springcloud/spring_cloud_app_redis_association_resource.go b/internal/services/springcloud/spring_cloud_app_redis_association_resource.go index 0b9ec905fc60..2b4a572eb712 100644 --- a/internal/services/springcloud/spring_cloud_app_redis_association_resource.go +++ b/internal/services/springcloud/spring_cloud_app_redis_association_resource.go @@ -6,9 +6,9 @@ import ( "strings" "time" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - redisValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/validate" @@ -64,7 +64,7 @@ func resourceSpringCloudAppRedisAssociation() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: redisValidate.CacheID, + ValidateFunc: redis.ValidateRediID, }, "redis_access_key": { diff --git a/internal/services/springcloud/spring_cloud_app_resource.go b/internal/services/springcloud/spring_cloud_app_resource.go index 50083073a1eb..d5704c371892 100644 --- a/internal/services/springcloud/spring_cloud_app_resource.go +++ b/internal/services/springcloud/spring_cloud_app_resource.go @@ -560,7 +560,10 @@ func flattenAppCustomPersistentDiskResourceArray(input *[]appplatform.CustomPers for _, item := range *input { var storageName string if item.StorageID != nil { - if id, err := parse.SpringCloudStorageID(*item.StorageID); err == nil { + // The returned value has inconsistent casing + // TODO: Remove the normalization codes once the following issue is fixed. + // Issue: https://github.com/Azure/azure-rest-api-specs/issues/22205 + if id, err := parse.SpringCloudStorageIDInsensitively(*item.StorageID); err == nil { storageName = id.StorageName } } @@ -598,6 +601,25 @@ func flattenSpringCloudAppAddon(configs map[string]map[string]interface{}) *stri if len(configs) == 0 { return nil } + // The returned value has inconsistent casing + // TODO: Remove the normalization codes once the following issue is fixed. + // Issue: https://github.com/Azure/azure-rest-api-specs/issues/22481 + if applicationConfigurationService, ok := configs["applicationConfigurationService"]; ok && len(applicationConfigurationService) != 0 { + if resourceId, ok := applicationConfigurationService["resourceId"]; ok && resourceId != nil { + applicationConfigurationServiceId, err := parse.SpringCloudConfigurationServiceIDInsensitively(resourceId.(string)) + if err == nil { + configs["applicationConfigurationService"]["resourceId"] = applicationConfigurationServiceId.ID() + } + } + } + if serviceRegistry, ok := configs["serviceRegistry"]; ok && len(serviceRegistry) != 0 { + if resourceId, ok := serviceRegistry["resourceId"]; ok && resourceId != nil { + serviceRegistryId, err := parse.SpringCloudServiceRegistryIDInsensitively(resourceId.(string)) + if err == nil { + configs["serviceRegistry"]["resourceId"] = serviceRegistryId.ID() + } + } + } addonConfig, _ := json.Marshal(configs) return utils.String(string(addonConfig)) } diff --git a/internal/services/springcloud/spring_cloud_application_live_view_resource_test.go b/internal/services/springcloud/spring_cloud_application_live_view_resource_test.go index 5e9f302f16d8..de9132695a8b 100644 --- a/internal/services/springcloud/spring_cloud_application_live_view_resource_test.go +++ b/internal/services/springcloud/spring_cloud_application_live_view_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -19,10 +18,10 @@ type SpringCloudApplicationLiveViewResource struct{} func TestAccSpringCloudApplicationLiveView_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_application_live_view", "test") r := SpringCloudApplicationLiveViewResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -33,10 +32,10 @@ func TestAccSpringCloudApplicationLiveView_basic(t *testing.T) { func TestAccSpringCloudApplicationLiveView_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_application_live_view", "test") r := SpringCloudApplicationLiveViewResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -44,7 +43,7 @@ func TestAccSpringCloudApplicationLiveView_requiresImport(t *testing.T) { }) } -func (r SpringCloudApplicationLiveViewResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r SpringCloudApplicationLiveViewResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.SpringCloudApplicationLiveViewID(state.ID) if err != nil { return nil, err diff --git a/internal/services/springcloud/spring_cloud_build_pack_binding_resource_test.go b/internal/services/springcloud/spring_cloud_build_pack_binding_resource_test.go index be11f9d6be2b..369781941aec 100644 --- a/internal/services/springcloud/spring_cloud_build_pack_binding_resource_test.go +++ b/internal/services/springcloud/spring_cloud_build_pack_binding_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -19,10 +18,10 @@ type SpringCloudBuildPackBindingResource struct{} func TestAccSpringCloudBuildPackBinding_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_build_pack_binding", "test") r := SpringCloudBuildPackBindingResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -33,10 +32,10 @@ func TestAccSpringCloudBuildPackBinding_basic(t *testing.T) { func TestAccSpringCloudBuildPackBinding_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_build_pack_binding", "test") r := SpringCloudBuildPackBindingResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -47,10 +46,10 @@ func TestAccSpringCloudBuildPackBinding_requiresImport(t *testing.T) { func TestAccSpringCloudBuildPackBinding_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_build_pack_binding", "test") r := SpringCloudBuildPackBindingResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -61,24 +60,24 @@ func TestAccSpringCloudBuildPackBinding_complete(t *testing.T) { func TestAccSpringCloudBuildPackBinding_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_build_pack_binding", "test") r := SpringCloudBuildPackBindingResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("launch.0.secrets.%", "launch.0.secrets.connection-string"), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -86,7 +85,7 @@ func TestAccSpringCloudBuildPackBinding_update(t *testing.T) { }) } -func (r SpringCloudBuildPackBindingResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r SpringCloudBuildPackBindingResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.SpringCloudBuildPackBindingID(state.ID) if err != nil { return nil, err diff --git a/internal/services/springcloud/spring_cloud_builder_resource_test.go b/internal/services/springcloud/spring_cloud_builder_resource_test.go index a101523d6ada..302fd69088b6 100644 --- a/internal/services/springcloud/spring_cloud_builder_resource_test.go +++ b/internal/services/springcloud/spring_cloud_builder_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -19,10 +18,10 @@ type SpringCloudBuildServiceBuilderResource struct{} func TestAccSpringCloudBuildServiceBuilder_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_builder", "test") r := SpringCloudBuildServiceBuilderResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -33,10 +32,10 @@ func TestAccSpringCloudBuildServiceBuilder_basic(t *testing.T) { func TestAccSpringCloudBuildServiceBuilder_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_builder", "test") r := SpringCloudBuildServiceBuilderResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -44,7 +43,7 @@ func TestAccSpringCloudBuildServiceBuilder_requiresImport(t *testing.T) { }) } -func (r SpringCloudBuildServiceBuilderResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r SpringCloudBuildServiceBuilderResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.SpringCloudBuildServiceBuilderID(state.ID) if err != nil { return nil, err diff --git a/internal/services/springcloud/spring_cloud_configuration_service_resource.go b/internal/services/springcloud/spring_cloud_configuration_service_resource.go index 9855c2ec0c9a..1afb41a81a90 100644 --- a/internal/services/springcloud/spring_cloud_configuration_service_resource.go +++ b/internal/services/springcloud/spring_cloud_configuration_service_resource.go @@ -105,12 +105,14 @@ func resourceSpringCloudConfigurationService() *pluginsdk.Resource { "password": { Type: pluginsdk.TypeString, Optional: true, + Sensitive: true, ValidateFunc: validation.StringIsNotEmpty, }, "private_key": { Type: pluginsdk.TypeString, Optional: true, + Sensitive: true, ValidateFunc: validation.StringIsNotEmpty, }, diff --git a/internal/services/springcloud/spring_cloud_configuration_service_resource_test.go b/internal/services/springcloud/spring_cloud_configuration_service_resource_test.go index 655e1d6e5c91..01ebfe0863dc 100644 --- a/internal/services/springcloud/spring_cloud_configuration_service_resource_test.go +++ b/internal/services/springcloud/spring_cloud_configuration_service_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -19,10 +18,10 @@ type SpringCloudConfigurationServiceResource struct{} func TestAccSpringCloudConfigurationService_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_configuration_service", "test") r := SpringCloudConfigurationServiceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -33,10 +32,10 @@ func TestAccSpringCloudConfigurationService_basic(t *testing.T) { func TestAccSpringCloudConfigurationService_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_configuration_service", "test") r := SpringCloudConfigurationServiceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -47,10 +46,10 @@ func TestAccSpringCloudConfigurationService_requiresImport(t *testing.T) { func TestAccSpringCloudConfigurationService_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_configuration_service", "test") r := SpringCloudConfigurationServiceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -61,10 +60,10 @@ func TestAccSpringCloudConfigurationService_complete(t *testing.T) { func TestAccSpringCloudConfigurationService_sshAuth(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_configuration_service", "test") r := SpringCloudConfigurationServiceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.sshAuth(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -75,24 +74,24 @@ func TestAccSpringCloudConfigurationService_sshAuth(t *testing.T) { func TestAccSpringCloudConfigurationService_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_configuration_service", "test") r := SpringCloudConfigurationServiceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("repository.0.password", "repository.0.username"), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -100,7 +99,7 @@ func TestAccSpringCloudConfigurationService_update(t *testing.T) { }) } -func (r SpringCloudConfigurationServiceResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r SpringCloudConfigurationServiceResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.SpringCloudConfigurationServiceID(state.ID) if err != nil { return nil, err diff --git a/internal/services/springcloud/spring_cloud_customized_accelerator_resource_test.go b/internal/services/springcloud/spring_cloud_customized_accelerator_resource_test.go index 8762cf7817b5..797d7442762d 100644 --- a/internal/services/springcloud/spring_cloud_customized_accelerator_resource_test.go +++ b/internal/services/springcloud/spring_cloud_customized_accelerator_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -19,10 +18,10 @@ type SpringCloudCustomizedAcceleratorResource struct{} func TestAccSpringCloudCustomizedAccelerator_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_customized_accelerator", "test") r := SpringCloudCustomizedAcceleratorResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -33,10 +32,10 @@ func TestAccSpringCloudCustomizedAccelerator_basic(t *testing.T) { func TestAccSpringCloudCustomizedAccelerator_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_customized_accelerator", "test") r := SpringCloudCustomizedAcceleratorResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -47,10 +46,10 @@ func TestAccSpringCloudCustomizedAccelerator_requiresImport(t *testing.T) { func TestAccSpringCloudCustomizedAccelerator_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_customized_accelerator", "test") r := SpringCloudCustomizedAcceleratorResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -61,24 +60,24 @@ func TestAccSpringCloudCustomizedAccelerator_complete(t *testing.T) { func TestAccSpringCloudCustomizedAccelerator_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_customized_accelerator", "test") r := SpringCloudCustomizedAcceleratorResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -86,7 +85,7 @@ func TestAccSpringCloudCustomizedAccelerator_update(t *testing.T) { }) } -func (r SpringCloudCustomizedAcceleratorResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r SpringCloudCustomizedAcceleratorResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.SpringCloudCustomizedAcceleratorID(state.ID) if err != nil { return nil, err diff --git a/internal/services/springcloud/spring_cloud_dev_tool_portal_resource_test.go b/internal/services/springcloud/spring_cloud_dev_tool_portal_resource_test.go index c96cb9dd5347..62ab3e6cda92 100644 --- a/internal/services/springcloud/spring_cloud_dev_tool_portal_resource_test.go +++ b/internal/services/springcloud/spring_cloud_dev_tool_portal_resource_test.go @@ -6,12 +6,11 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,10 +19,10 @@ type SpringCloudDevToolPortalResource struct{} func TestAccSpringCloudDevToolPortal_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_dev_tool_portal", "test") r := SpringCloudDevToolPortalResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -34,10 +33,10 @@ func TestAccSpringCloudDevToolPortal_basic(t *testing.T) { func TestAccSpringCloudDevToolPortal_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_dev_tool_portal", "test") r := SpringCloudDevToolPortalResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -50,10 +49,10 @@ func TestAccSpringCloudDevToolPortal_complete(t *testing.T) { r := SpringCloudDevToolPortalResource{} clientId := os.Getenv("ARM_CLIENT_ID") clientSecret := os.Getenv("ARM_CLIENT_SECRET") - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data, clientId, clientSecret), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -66,24 +65,24 @@ func TestAccSpringCloudDevToolPortal_update(t *testing.T) { clientId := os.Getenv("ARM_CLIENT_ID") clientSecret := os.Getenv("ARM_CLIENT_SECRET") r := SpringCloudDevToolPortalResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data, clientId, clientSecret), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("sso.0.client_id", "sso.0.client_secret"), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -91,7 +90,7 @@ func TestAccSpringCloudDevToolPortal_update(t *testing.T) { }) } -func (r SpringCloudDevToolPortalResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r SpringCloudDevToolPortalResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.SpringCloudDevToolPortalID(state.ID) if err != nil { return nil, err diff --git a/internal/services/springcloud/spring_cloud_gateway_custom_domain_resource_test.go b/internal/services/springcloud/spring_cloud_gateway_custom_domain_resource_test.go index 9c87c176d35b..45f562316801 100644 --- a/internal/services/springcloud/spring_cloud_gateway_custom_domain_resource_test.go +++ b/internal/services/springcloud/spring_cloud_gateway_custom_domain_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -19,10 +18,10 @@ type SpringCloudGatewayCustomDomainResource struct{} func TestAccSpringCloudGatewayCustomDomain_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_gateway_custom_domain", "test") r := SpringCloudGatewayCustomDomainResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -33,10 +32,10 @@ func TestAccSpringCloudGatewayCustomDomain_basic(t *testing.T) { func TestAccSpringCloudGatewayCustomDomain_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_gateway_custom_domain", "test") r := SpringCloudGatewayCustomDomainResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -44,7 +43,7 @@ func TestAccSpringCloudGatewayCustomDomain_requiresImport(t *testing.T) { }) } -func (r SpringCloudGatewayCustomDomainResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r SpringCloudGatewayCustomDomainResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.SpringCloudGatewayCustomDomainID(state.ID) if err != nil { return nil, err diff --git a/internal/services/springcloud/spring_cloud_gateway_resource_test.go b/internal/services/springcloud/spring_cloud_gateway_resource_test.go index 3a2b6429c77b..8a8283130018 100644 --- a/internal/services/springcloud/spring_cloud_gateway_resource_test.go +++ b/internal/services/springcloud/spring_cloud_gateway_resource_test.go @@ -6,12 +6,11 @@ import ( "os" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,10 +19,10 @@ type SpringCloudGatewayResource struct{} func TestAccSpringCloudGateway_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_gateway", "test") r := SpringCloudGatewayResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -34,10 +33,10 @@ func TestAccSpringCloudGateway_basic(t *testing.T) { func TestAccSpringCloudGateway_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_gateway", "test") r := SpringCloudGatewayResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -50,10 +49,10 @@ func TestAccSpringCloudGateway_complete(t *testing.T) { r := SpringCloudGatewayResource{} clientId := os.Getenv("ARM_CLIENT_ID") clientSecret := os.Getenv("ARM_CLIENT_SECRET") - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data, clientId, clientSecret), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -66,24 +65,24 @@ func TestAccSpringCloudGateway_update(t *testing.T) { clientId := os.Getenv("ARM_CLIENT_ID") clientSecret := os.Getenv("ARM_CLIENT_SECRET") r := SpringCloudGatewayResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data, clientId, clientSecret), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("sso.0.client_id", "sso.0.client_secret", "sensitive_environment_variables.%", "sensitive_environment_variables.NEW_RELIC_APP_NAME"), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -91,7 +90,7 @@ func TestAccSpringCloudGateway_update(t *testing.T) { }) } -func (r SpringCloudGatewayResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r SpringCloudGatewayResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.SpringCloudGatewayID(state.ID) if err != nil { return nil, err diff --git a/internal/services/springcloud/spring_cloud_gateway_route_config_resource_test.go b/internal/services/springcloud/spring_cloud_gateway_route_config_resource_test.go index 95ff3cd44430..d3f8b620b5fc 100644 --- a/internal/services/springcloud/spring_cloud_gateway_route_config_resource_test.go +++ b/internal/services/springcloud/spring_cloud_gateway_route_config_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -19,10 +18,10 @@ type SpringCloudGatewayRouteConfigResource struct{} func TestAccSpringCloudGatewayRouteConfig_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_gateway_route_config", "test") r := SpringCloudGatewayRouteConfigResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -33,10 +32,10 @@ func TestAccSpringCloudGatewayRouteConfig_basic(t *testing.T) { func TestAccSpringCloudGatewayRouteConfig_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_gateway_route_config", "test") r := SpringCloudGatewayRouteConfigResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -47,10 +46,10 @@ func TestAccSpringCloudGatewayRouteConfig_requiresImport(t *testing.T) { func TestAccSpringCloudGatewayRouteConfig_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_gateway_route_config", "test") r := SpringCloudGatewayRouteConfigResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -61,10 +60,10 @@ func TestAccSpringCloudGatewayRouteConfig_complete(t *testing.T) { func TestAccSpringCloudGatewayRouteConfig_multipleRoutes(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_gateway_route_config", "test") r := SpringCloudGatewayRouteConfigResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.multipleRoutes(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -75,30 +74,30 @@ func TestAccSpringCloudGatewayRouteConfig_multipleRoutes(t *testing.T) { func TestAccSpringCloudGatewayRouteConfig_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_gateway_route_config", "test") r := SpringCloudGatewayRouteConfigResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.complete(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.multipleRoutes(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -106,7 +105,7 @@ func TestAccSpringCloudGatewayRouteConfig_update(t *testing.T) { }) } -func (r SpringCloudGatewayRouteConfigResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r SpringCloudGatewayRouteConfigResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.SpringCloudGatewayRouteConfigID(state.ID) if err != nil { return nil, err diff --git a/internal/services/sql/sql_managed_instance_failover_group_resource_test.go b/internal/services/sql/sql_managed_instance_failover_group_resource_test.go index b3ba5cf0e377..d88eb10a043e 100644 --- a/internal/services/sql/sql_managed_instance_failover_group_resource_test.go +++ b/internal/services/sql/sql_managed_instance_failover_group_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,7 +19,7 @@ func TestAccAzureRMSqlInstanceFailoverGroup_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sql_managed_instance_failover_group", "test") r := SqlInstanceFailoverGroupResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: SqlManagedInstanceResource{}.dnsZonePartner(data), }, @@ -30,14 +29,14 @@ func TestAccAzureRMSqlInstanceFailoverGroup_basic(t *testing.T) { }, { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), { Config: r.update(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -49,7 +48,7 @@ func TestAccAzureRMSqlInstanceFailoverGroup_basic(t *testing.T) { }) } -func (r SqlInstanceFailoverGroupResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r SqlInstanceFailoverGroupResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.InstanceFailoverGroupID(state.ID) if err != nil { return nil, err diff --git a/internal/services/sql/sql_managed_instance_resource_test.go b/internal/services/sql/sql_managed_instance_resource_test.go index 87830b4f3920..6ba972b6d125 100644 --- a/internal/services/sql/sql_managed_instance_resource_test.go +++ b/internal/services/sql/sql_managed_instance_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,10 +19,10 @@ func TestAccAzureRMSqlMiServer_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sql_managed_instance", "test") r := SqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -35,10 +34,10 @@ func TestAccAzureRMSqlMiServer_backupRedundancyLRS(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sql_managed_instance", "test") r := SqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.storageType(data, "LRS"), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -50,10 +49,10 @@ func TestAccAzureRMSqlMiServer_identity(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sql_managed_instance", "test") r := SqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("identity.#").HasValue("0"), ), @@ -61,7 +60,7 @@ func TestAccAzureRMSqlMiServer_identity(t *testing.T) { data.ImportStep("administrator_login_password"), { Config: r.identity(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("identity.#").HasValue("1"), check.That(data.ResourceName).Key("identity.0.type").HasValue("SystemAssigned"), @@ -70,7 +69,7 @@ func TestAccAzureRMSqlMiServer_identity(t *testing.T) { data.ImportStep("administrator_login_password"), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("identity.#").HasValue("0"), ), @@ -83,24 +82,24 @@ func TestAccAzureRMSqlMiServer_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sql_managed_instance", "test") r := SqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("administrator_login_password"), { Config: r.update(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("administrator_login_password"), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -112,24 +111,24 @@ func TestAccAzureRMSqlMiServer_multiple(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sql_managed_instance", "test") r := SqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("administrator_login_password"), { Config: r.multiple(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("administrator_login_password"), { Config: r.basic(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -141,17 +140,17 @@ func TestAccAzureRMSqlMiServer_dnsZonePartner(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sql_managed_instance", "test") r := SqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.dnsZonePartnerPrep(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("administrator_login_password"), { Config: r.dnsZonePartner(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -159,7 +158,7 @@ func TestAccAzureRMSqlMiServer_dnsZonePartner(t *testing.T) { { // DNS Zone Partner empty makes delete faster as MI can be destroyed simultaneously Config: r.emptyDnsZonePartner(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -171,17 +170,17 @@ func TestAccAzureRMSqlMiServer_multipleDnsZonePartners(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sql_managed_instance", "test") r := SqlManagedInstanceResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.dnsZonePartnersPrep(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("administrator_login_password"), { Config: r.dnsZonePartners(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -189,7 +188,7 @@ func TestAccAzureRMSqlMiServer_multipleDnsZonePartners(t *testing.T) { { // DNS Zone Partner empty makes delete faster as MI can be destroyed simultaneously Config: r.emptyDnsZonePartners(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -197,7 +196,7 @@ func TestAccAzureRMSqlMiServer_multipleDnsZonePartners(t *testing.T) { }) } -func (r SqlManagedInstanceResource) Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r SqlManagedInstanceResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.ManagedInstanceID(state.ID) if err != nil { return nil, err diff --git a/internal/services/storage/client/client.go b/internal/services/storage/client/client.go index 29e7c0352a7a..d1bfa099209a 100644 --- a/internal/services/storage/client/client.go +++ b/internal/services/storage/client/client.go @@ -54,10 +54,10 @@ func NewClient(options *common.ClientOptions) *Client { localUsersClient := localusers.NewLocalUsersClientWithBaseURI(options.ResourceManagerEndpoint) localUsersClient.Client.Authorizer = options.ResourceManagerAuthorizer - fileSystemsClient := filesystems.NewWithEnvironment(options.Environment) + fileSystemsClient := filesystems.NewWithEnvironment(options.AzureEnvironment) options.ConfigureClient(&fileSystemsClient.Client, options.StorageAuthorizer) - adlsGen2PathsClient := paths.NewWithEnvironment(options.Environment) + adlsGen2PathsClient := paths.NewWithEnvironment(options.AzureEnvironment) options.ConfigureClient(&adlsGen2PathsClient.Client, options.StorageAuthorizer) managementPoliciesClient := storage.NewManagementPoliciesClientWithBaseURI(options.ResourceManagerEndpoint, options.SubscriptionId) @@ -101,7 +101,7 @@ func NewClient(options *common.ClientOptions) *Client { BlobInventoryPoliciesClient: &blobInventoryPoliciesClient, CloudEndpointsClient: &cloudEndpointsClient, EncryptionScopesClient: &encryptionScopesClient, - Environment: options.Environment, + Environment: options.AzureEnvironment, FileServicesClient: &fileServicesClient, ResourceManager: &resourceManager, SubscriptionId: options.SubscriptionId, diff --git a/internal/services/storage/migration/blob.go b/internal/services/storage/migration/blob.go index a2cfef3c3410..b62bbe563445 100644 --- a/internal/services/storage/migration/blob.go +++ b/internal/services/storage/migration/blob.go @@ -85,11 +85,15 @@ func (BlobV0ToV1) Schema() map[string]*pluginsdk.Schema { func (BlobV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { environment := meta.(*clients.Client).Account.Environment + storageDomainSuffix, ok := environment.Storage.DomainSuffix() + if !ok { + return nil, fmt.Errorf("could not determine storage endpoint suffix for environment %q", environment.Name) + } blobName := rawState["name"] containerName := rawState["storage_container_name"] storageAccountName := rawState["storage_account_name"] - newID := fmt.Sprintf("https://%s.blob.%s/%s/%s", storageAccountName, environment.StorageEndpointSuffix, containerName, blobName) + newID := fmt.Sprintf("https://%s.blob.%s/%s/%s", storageAccountName, *storageDomainSuffix, containerName, blobName) rawState["id"] = newID return rawState, nil diff --git a/internal/services/storage/migration/blob_test.go b/internal/services/storage/migration/blob_test.go index 54a8ce17e32e..e5c0fc47ffca 100644 --- a/internal/services/storage/migration/blob_test.go +++ b/internal/services/storage/migration/blob_test.go @@ -6,16 +6,15 @@ import ( "reflect" "testing" - "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-sdk/sdk/environments" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" ) func TestBlobV0ToV1(t *testing.T) { - clouds := []azure.Environment{ - azure.ChinaCloud, - azure.GermanCloud, - azure.PublicCloud, - azure.USGovernmentCloud, + clouds := []*environments.Environment{ + environments.AzurePublic(), + environments.AzureChina(), + environments.AzureUSGovernment(), } for _, cloud := range clouds { @@ -27,13 +26,20 @@ func TestBlobV0ToV1(t *testing.T) { "storage_container_name": "some-container", "storage_account_name": "some-account", } + meta := &clients.Client{ Account: &clients.ResourceManagerAccount{ - Environment: cloud, + Environment: *cloud, }, } + + suffix, ok := meta.Account.Environment.Storage.DomainSuffix() + if !ok { + t.Fatalf("could not determine Storage domain suffix for environment %q", meta.Account.Environment.Name) + } + expected := map[string]interface{}{ - "id": fmt.Sprintf("https://some-account.blob.%s/some-container/some-name", cloud.StorageEndpointSuffix), + "id": fmt.Sprintf("https://some-account.blob.%s/some-container/some-name", *suffix), "name": "some-name", "storage_container_name": "some-container", "storage_account_name": "some-account", diff --git a/internal/services/storage/migration/container.go b/internal/services/storage/migration/container.go index 9b4e9cb41eb0..0de51588bf1d 100644 --- a/internal/services/storage/migration/container.go +++ b/internal/services/storage/migration/container.go @@ -50,10 +50,14 @@ func (ContainerV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { // this should have been applied from pre-0.12 migration system; backporting just in-case return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { environment := meta.(*clients.Client).Account.Environment + storageDomainSuffix, ok := environment.Storage.DomainSuffix() + if !ok { + return nil, fmt.Errorf("could not determine Storage domain suffix for environment %q", environment.Name) + } containerName := rawState["name"] storageAccountName := rawState["storage_account_name"] - newID := fmt.Sprintf("https://%s.blob.%s/%s", storageAccountName, environment.StorageEndpointSuffix, containerName) + newID := fmt.Sprintf("https://%s.blob.%s/%s", storageAccountName, *storageDomainSuffix, containerName) rawState["id"] = newID return rawState, nil diff --git a/internal/services/storage/migration/container_test.go b/internal/services/storage/migration/container_test.go index c0f6442c4326..896c51a5c6ac 100644 --- a/internal/services/storage/migration/container_test.go +++ b/internal/services/storage/migration/container_test.go @@ -6,16 +6,15 @@ import ( "reflect" "testing" - "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-sdk/sdk/environments" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" ) func TestContainerV0ToV1(t *testing.T) { - clouds := []azure.Environment{ - azure.ChinaCloud, - azure.GermanCloud, - azure.PublicCloud, - azure.USGovernmentCloud, + clouds := []*environments.Environment{ + environments.AzurePublic(), + environments.AzureChina(), + environments.AzureUSGovernment(), } for _, cloud := range clouds { @@ -26,13 +25,20 @@ func TestContainerV0ToV1(t *testing.T) { "name": "some-name", "storage_account_name": "some-account", } + meta := &clients.Client{ Account: &clients.ResourceManagerAccount{ - Environment: cloud, + Environment: *cloud, }, } + + suffix, ok := meta.Account.Environment.Storage.DomainSuffix() + if !ok { + t.Fatalf("could not determine Storage domain suffix for environment %q", meta.Account.Environment.Name) + } + expected := map[string]interface{}{ - "id": fmt.Sprintf("https://some-account.blob.%s/some-name", cloud.StorageEndpointSuffix), + "id": fmt.Sprintf("https://some-account.blob.%s/some-name", *suffix), "name": "some-name", "storage_account_name": "some-account", } diff --git a/internal/services/storage/migration/queue.go b/internal/services/storage/migration/queue.go index 9f19c2046b75..0e5a8bc9b3cf 100644 --- a/internal/services/storage/migration/queue.go +++ b/internal/services/storage/migration/queue.go @@ -36,10 +36,14 @@ func (QueueV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { // this should have been applied from pre-0.12 migration system; backporting just in-case return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { environment := meta.(*clients.Client).Account.Environment + storageDomainSuffix, ok := environment.Storage.DomainSuffix() + if !ok { + return nil, fmt.Errorf("could not determine Storage domain suffix for environment %q", environment.Name) + } queueName := rawState["name"] storageAccountName := rawState["storage_account_name"] - newID := fmt.Sprintf("https://%s.queue.%s/%s", storageAccountName, environment.StorageEndpointSuffix, queueName) + newID := fmt.Sprintf("https://%s.queue.%s/%s", storageAccountName, *storageDomainSuffix, queueName) rawState["id"] = newID return rawState, nil diff --git a/internal/services/storage/migration/queue_test.go b/internal/services/storage/migration/queue_test.go index 734dc7663656..fcbeb8c32904 100644 --- a/internal/services/storage/migration/queue_test.go +++ b/internal/services/storage/migration/queue_test.go @@ -6,16 +6,15 @@ import ( "reflect" "testing" - "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-sdk/sdk/environments" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" ) func TestQueueV0ToV1(t *testing.T) { - clouds := []azure.Environment{ - azure.ChinaCloud, - azure.GermanCloud, - azure.PublicCloud, - azure.USGovernmentCloud, + clouds := []*environments.Environment{ + environments.AzurePublic(), + environments.AzureChina(), + environments.AzureUSGovernment(), } for _, cloud := range clouds { @@ -26,13 +25,20 @@ func TestQueueV0ToV1(t *testing.T) { "name": "some-name", "storage_account_name": "some-account", } + meta := &clients.Client{ Account: &clients.ResourceManagerAccount{ - Environment: cloud, + Environment: *cloud, }, } + + suffix, ok := meta.Account.Environment.Storage.DomainSuffix() + if !ok { + t.Fatalf("could not determine Storage domain suffix for environment %q", meta.Account.Environment.Name) + } + expected := map[string]interface{}{ - "id": fmt.Sprintf("https://some-account.queue.%s/some-name", cloud.StorageEndpointSuffix), + "id": fmt.Sprintf("https://some-account.queue.%s/some-name", *suffix), "name": "some-name", "storage_account_name": "some-account", } diff --git a/internal/services/storage/migration/share.go b/internal/services/storage/migration/share.go index 8d0cd6e04ee5..3d825935cfac 100644 --- a/internal/services/storage/migration/share.go +++ b/internal/services/storage/migration/share.go @@ -57,7 +57,7 @@ func (s ShareV1ToV2) UpgradeFunc() pluginsdk.StateUpgraderFunc { shareName := parsedId[0] accountName := parsedId[2] - environment := meta.(*clients.Client).Account.Environment + environment := meta.(*clients.Client).Account.AzureEnvironment client := shares.NewWithEnvironment(environment) newResourceId := client.GetResourceID(accountName, shareName) diff --git a/internal/services/storage/migration/share_test.go b/internal/services/storage/migration/share_test.go index f842d4eb4978..91307b4be3cd 100644 --- a/internal/services/storage/migration/share_test.go +++ b/internal/services/storage/migration/share_test.go @@ -13,7 +13,6 @@ import ( func TestShareV0ToV1(t *testing.T) { clouds := []azure.Environment{ azure.ChinaCloud, - azure.GermanCloud, azure.PublicCloud, azure.USGovernmentCloud, } @@ -28,11 +27,13 @@ func TestShareV0ToV1(t *testing.T) { "storage_account_name": "account1", "quota": 5120, } + meta := &clients.Client{ Account: &clients.ResourceManagerAccount{ - Environment: cloud, + AzureEnvironment: cloud, }, } + expected := map[string]interface{}{ "id": "share1/group1/account1", "name": "share1", @@ -57,7 +58,6 @@ func TestShareV0ToV1(t *testing.T) { func TestShareV1ToV2(t *testing.T) { clouds := []azure.Environment{ azure.ChinaCloud, - azure.GermanCloud, azure.PublicCloud, azure.USGovernmentCloud, } @@ -72,11 +72,13 @@ func TestShareV1ToV2(t *testing.T) { "storage_account_name": "account1", "quota": 5120, } + meta := &clients.Client{ Account: &clients.ResourceManagerAccount{ - Environment: cloud, + AzureEnvironment: cloud, }, } + expected := map[string]interface{}{ "id": fmt.Sprintf("https://account1.file.%s/share1", cloud.StorageEndpointSuffix), "name": "share1", diff --git a/internal/services/storage/migration/table.go b/internal/services/storage/migration/table.go index 5e50f4b5fcff..182031573f82 100644 --- a/internal/services/storage/migration/table.go +++ b/internal/services/storage/migration/table.go @@ -23,9 +23,13 @@ func (TableV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { tableName := rawState["name"].(string) accountName := rawState["storage_account_name"].(string) environment := meta.(*clients.Client).Account.Environment + storageDomainSuffix, ok := environment.Storage.DomainSuffix() + if !ok { + return nil, fmt.Errorf("could not determine Storage domain suffix for environment %q", environment.Name) + } id := rawState["id"].(string) - newResourceID := fmt.Sprintf("https://%s.table.%s/%s", accountName, environment.StorageEndpointSuffix, tableName) + newResourceID := fmt.Sprintf("https://%s.table.%s/%s", accountName, *storageDomainSuffix, tableName) log.Printf("[DEBUG] Updating ID from %q to %q", id, newResourceID) rawState["id"] = newResourceID @@ -47,9 +51,13 @@ func (TableV1ToV2) UpgradeFunc() pluginsdk.StateUpgraderFunc { tableName := rawState["name"].(string) accountName := rawState["storage_account_name"].(string) environment := meta.(*clients.Client).Account.Environment + storageDomainSuffix, ok := environment.Storage.DomainSuffix() + if !ok { + return nil, fmt.Errorf("could not determine Storage domain suffix for environment %q", environment.Name) + } id := rawState["id"].(string) - newResourceID := fmt.Sprintf("https://%s.table.%s/Tables('%s')", accountName, environment.StorageEndpointSuffix, tableName) + newResourceID := fmt.Sprintf("https://%s.table.%s/Tables('%s')", accountName, *storageDomainSuffix, tableName) log.Printf("[DEBUG] Updating ID from %q to %q", id, newResourceID) rawState["id"] = newResourceID diff --git a/internal/services/storage/migration/table_test.go b/internal/services/storage/migration/table_test.go index 7c6b412dd9a0..191bf71abc76 100644 --- a/internal/services/storage/migration/table_test.go +++ b/internal/services/storage/migration/table_test.go @@ -6,16 +6,15 @@ import ( "reflect" "testing" - "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-sdk/sdk/environments" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" ) func TestTableStateV0ToV1(t *testing.T) { - clouds := []azure.Environment{ - azure.ChinaCloud, - azure.GermanCloud, - azure.PublicCloud, - azure.USGovernmentCloud, + clouds := []*environments.Environment{ + environments.AzurePublic(), + environments.AzureChina(), + environments.AzureUSGovernment(), } for _, cloud := range clouds { @@ -26,15 +25,20 @@ func TestTableStateV0ToV1(t *testing.T) { "name": "table1", "storage_account_name": "account1", } + meta := &clients.Client{ Account: &clients.ResourceManagerAccount{ - Environment: cloud, + Environment: *cloud, }, } - suffix := meta.Account.Environment.StorageEndpointSuffix + + suffix, ok := meta.Account.Environment.Storage.DomainSuffix() + if !ok { + t.Fatalf("could not determine Storage domain suffix for environment %q", meta.Account.Environment.Name) + } expected := map[string]interface{}{ - "id": fmt.Sprintf("https://account1.table.%s/table1", suffix), + "id": fmt.Sprintf("https://account1.table.%s/table1", *suffix), "name": "table1", "storage_account_name": "account1", } @@ -53,11 +57,10 @@ func TestTableStateV0ToV1(t *testing.T) { } func TestTableStateV1ToV2(t *testing.T) { - clouds := []azure.Environment{ - azure.ChinaCloud, - azure.GermanCloud, - azure.PublicCloud, - azure.USGovernmentCloud, + clouds := []*environments.Environment{ + environments.AzurePublic(), + environments.AzureChina(), + environments.AzureUSGovernment(), } for _, cloud := range clouds { @@ -65,18 +68,21 @@ func TestTableStateV1ToV2(t *testing.T) { meta := &clients.Client{ Account: &clients.ResourceManagerAccount{ - Environment: cloud, + Environment: *cloud, }, } - suffix := meta.Account.Environment.StorageEndpointSuffix + suffix, ok := meta.Account.Environment.Storage.DomainSuffix() + if !ok { + t.Fatalf("could not determine Storage domain suffix for environment %q", meta.Account.Environment.Name) + } input := map[string]interface{}{ - "id": fmt.Sprintf("https://account1.table.%s/table1", suffix), + "id": fmt.Sprintf("https://account1.table.%s/table1", *suffix), "name": "table1", "storage_account_name": "account1", } expected := map[string]interface{}{ - "id": fmt.Sprintf("https://account1.table.%s/Tables('table1')", suffix), + "id": fmt.Sprintf("https://account1.table.%s/Tables('table1')", *suffix), "name": "table1", "storage_account_name": "account1", } diff --git a/internal/services/storage/parse/object_replication_test.go b/internal/services/storage/parse/object_replication_test.go index e3f3909eb2e5..35b0229e5886 100644 --- a/internal/services/storage/parse/object_replication_test.go +++ b/internal/services/storage/parse/object_replication_test.go @@ -134,13 +134,13 @@ func TestObjectReplicationID(t *testing.T) { Src: objectreplicationpolicies.ObjectReplicationPolicyId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroupName: "resGroup1", - AccountName: "storageAccount1", + StorageAccountName: "storageAccount1", ObjectReplicationPolicyId: "objectReplicationPolicy1", }, Dst: objectreplicationpolicies.ObjectReplicationPolicyId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroupName: "resGroup2", - AccountName: "storageAccount2", + StorageAccountName: "storageAccount2", ObjectReplicationPolicyId: "objectReplicationPolicy2", }, }, @@ -174,8 +174,8 @@ func TestObjectReplicationID(t *testing.T) { if actual.Src.ResourceGroupName != v.Expected.Src.ResourceGroupName { t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.Src.ResourceGroupName, actual.Src.ResourceGroupName) } - if actual.Src.AccountName != v.Expected.Src.AccountName { - t.Fatalf("Expected %q but got %q for StorageAccountName", v.Expected.Src.AccountName, actual.Src.AccountName) + if actual.Src.StorageAccountName != v.Expected.Src.StorageAccountName { + t.Fatalf("Expected %q but got %q for StorageAccountName", v.Expected.Src.StorageAccountName, actual.Src.StorageAccountName) } if actual.Src.ObjectReplicationPolicyId != v.Expected.Src.ObjectReplicationPolicyId { t.Fatalf("Expected %q but got %q for Name", v.Expected.Src.ObjectReplicationPolicyId, actual.Src.ObjectReplicationPolicyId) @@ -186,8 +186,8 @@ func TestObjectReplicationID(t *testing.T) { if actual.Dst.ResourceGroupName != v.Expected.Dst.ResourceGroupName { t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.Dst.ResourceGroupName, actual.Dst.ResourceGroupName) } - if actual.Dst.AccountName != v.Expected.Dst.AccountName { - t.Fatalf("Expected %q but got %q for StorageAccountName", v.Expected.Dst.AccountName, actual.Dst.AccountName) + if actual.Dst.StorageAccountName != v.Expected.Dst.StorageAccountName { + t.Fatalf("Expected %q but got %q for StorageAccountName", v.Expected.Dst.StorageAccountName, actual.Dst.StorageAccountName) } if actual.Dst.ObjectReplicationPolicyId != v.Expected.Dst.ObjectReplicationPolicyId { t.Fatalf("Expected %q but got %q for Name", v.Expected.Dst.ObjectReplicationPolicyId, actual.Dst.ObjectReplicationPolicyId) diff --git a/internal/services/storage/storage_account_data_source.go b/internal/services/storage/storage_account_data_source.go index 3cb4e6b385b8..20b67224a115 100644 --- a/internal/services/storage/storage_account_data_source.go +++ b/internal/services/storage/storage_account_data_source.go @@ -333,10 +333,14 @@ func dataSourceStorageAccount() *pluginsdk.Resource { func dataSourceStorageAccountRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Storage.AccountsClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId - endpointSuffix := meta.(*clients.Client).Account.Environment.StorageEndpointSuffix ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() + storageDomainSuffix, ok := meta.(*clients.Client).Account.Environment.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Storage domain suffix for environment %q", meta.(*clients.Client).Account.Environment.Name) + } + id := parse.NewStorageAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) resp, err := client.GetProperties(ctx, id.ResourceGroup, id.Name, "") if err != nil { @@ -402,12 +406,12 @@ func dataSourceStorageAccountRead(d *pluginsdk.ResourceData, meta interface{}) e if accessKeys := keys.Keys; accessKeys != nil { storageAccessKeys := *accessKeys if len(storageAccessKeys) > 0 { - pcs := fmt.Sprintf("DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s;EndpointSuffix=%s", *resp.Name, *storageAccessKeys[0].Value, endpointSuffix) + pcs := fmt.Sprintf("DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s;EndpointSuffix=%s", *resp.Name, *storageAccessKeys[0].Value, *storageDomainSuffix) d.Set("primary_connection_string", pcs) } if len(storageAccessKeys) > 1 { - scs := fmt.Sprintf("DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s;EndpointSuffix=%s", *resp.Name, *storageAccessKeys[1].Value, endpointSuffix) + scs := fmt.Sprintf("DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s;EndpointSuffix=%s", *resp.Name, *storageAccessKeys[1].Value, *storageDomainSuffix) d.Set("secondary_connection_string", scs) } } diff --git a/internal/services/storage/storage_account_local_user_resource.go b/internal/services/storage/storage_account_local_user_resource.go index fe97370e0235..d130c05316b2 100644 --- a/internal/services/storage/storage_account_local_user_resource.go +++ b/internal/services/storage/storage_account_local_user_resource.go @@ -307,8 +307,8 @@ func (r LocalUserResource) Read() sdk.ResourceFunc { } model := LocalUserModel{ - Name: id.Username, - StorageAccountId: parse.NewStorageAccountID(id.SubscriptionId, id.ResourceGroupName, id.AccountName).ID(), + Name: id.LocalUserName, + StorageAccountId: parse.NewStorageAccountID(id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName).ID(), // Password is only accessible during creation Password: state.Password, // SshAuthorizedKey is only accessible during creation, whilst this should be returned as it is not a secret. diff --git a/internal/services/storage/storage_account_local_user_resource_test.go b/internal/services/storage/storage_account_local_user_resource_test.go index f7b026ae49fc..1c4e7f1e7224 100644 --- a/internal/services/storage/storage_account_local_user_resource_test.go +++ b/internal/services/storage/storage_account_local_user_resource_test.go @@ -7,11 +7,10 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/localusers" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -21,10 +20,10 @@ func TestAccLocalUser_passwordOnly(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_storage_account_local_user", "test") r := LocalUserResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.passwordOnly(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -36,10 +35,10 @@ func TestAccLocalUser_sshKeyOnly(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_storage_account_local_user", "test") r := LocalUserResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.sshKeyOnly(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -51,10 +50,10 @@ func TestAccLocalUser_passwordAndSSHKey(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_storage_account_local_user", "test") r := LocalUserResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.passwordAndSSHKey(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("password").IsNotEmpty(), ), @@ -62,7 +61,7 @@ func TestAccLocalUser_passwordAndSSHKey(t *testing.T) { data.ImportStep("password", "ssh_authorized_key"), { Config: r.passwordAndSSHKeyMoreAuthKeys(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("password").IsNotEmpty(), ), @@ -70,7 +69,7 @@ func TestAccLocalUser_passwordAndSSHKey(t *testing.T) { data.ImportStep("password", "ssh_authorized_key"), { Config: r.sshKeyOnly(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("password").IsEmpty(), ), @@ -83,17 +82,17 @@ func TestAccLocalUser_homeDirectory(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_storage_account_local_user", "test") r := LocalUserResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.homeDirectory(data, "foo"), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("password"), { Config: r.homeDirectory(data, "bar"), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -105,24 +104,24 @@ func TestAccLocalUser_permissionScope(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_storage_account_local_user", "test") r := LocalUserResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.noPermissionScope(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("password"), { Config: r.permissionScope(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("password"), { Config: r.permissionScopeUpdate(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -134,10 +133,10 @@ func TestAccLocalUser_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_storage_account_local_user", "test") r := LocalUserResource{} - data.ResourceTest(t, r, []resource.TestStep{ + data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.passwordOnly(data), - Check: resource.ComposeTestCheckFunc( + Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, @@ -145,7 +144,7 @@ func TestAccLocalUser_requiresImport(t *testing.T) { }) } -func (r LocalUserResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { +func (r LocalUserResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { client := clients.Storage.LocalUsersClient id, err := localusers.ParseLocalUserID(state.ID) diff --git a/internal/services/storage/storage_account_resource.go b/internal/services/storage/storage_account_resource.go index 26404f36e89e..d7da4bb3b259 100644 --- a/internal/services/storage/storage_account_resource.go +++ b/internal/services/storage/storage_account_resource.go @@ -11,13 +11,14 @@ import ( "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage" // nolint: staticcheck azautorest "github.com/Azure/go-autorest/autorest" - autorestAzure "github.com/Azure/go-autorest/autorest/azure" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/storageaccounts" + "github.com/hashicorp/go-azure-sdk/sdk/environments" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -175,6 +176,7 @@ func resourceStorageAccount() *pluginsdk.Resource { ValidateFunc: validation.StringInSlice([]string{ string(storage.DirectoryServiceOptionsAADDS), string(storage.DirectoryServiceOptionsAD), + string(storageaccounts.DirectoryServiceOptionsAADKERB), }, false), }, @@ -1143,7 +1145,7 @@ func resourceStorageAccountCreate(d *pluginsdk.ResourceData, meta interface{}) e // https://github.com/hashicorp/terraform-provider-azurerm/issues/8083 // USGovernmentCloud allow_blob_public_access and min_tls_version allowed as of issue 9128 // https://github.com/hashicorp/terraform-provider-azurerm/issues/9128 - if envName != autorestAzure.PublicCloud.Name && envName != autorestAzure.USGovernmentCloud.Name && envName != autorestAzure.ChinaCloud.Name { + if envName != environments.AzurePublicCloud && envName != environments.AzureUSGovernmentCloud && envName != environments.AzureChinaCloud { if allowBlobPublicAccess || minimumTLSVersion != string(storage.MinimumTLSVersionTLS10) { return fmt.Errorf(`"allow_nested_items_to_be_public" and "min_tls_version" are not supported for a Storage Account located in %q`, envName) } @@ -1282,9 +1284,9 @@ func resourceStorageAccountCreate(d *pluginsdk.ResourceData, meta interface{}) e infrastructureEncryption := d.Get("infrastructure_encryption_enabled").(bool) if infrastructureEncryption { - if !((accountTier == string(storage.SkuTierPremium) && accountKind == string(storage.KindBlockBlobStorage)) || + if !((accountTier == string(storage.SkuTierPremium) && (accountKind == string(storage.KindBlockBlobStorage)) || accountKind == string(storage.KindFileStorage)) || (accountKind == string(storage.KindStorageV2))) { - return fmt.Errorf("`infrastructure_encryption_enabled` can only be used with account kind `StorageV2`, or account tier `Premium` and account kind `BlockBlobStorage`") + return fmt.Errorf("`infrastructure_encryption_enabled` can only be used with account kind `StorageV2`, or account tier `Premium` and account kind is one of `BlockBlobStorage` or `FileStorage`") } encryption.RequireInfrastructureEncryption = &infrastructureEncryption } @@ -1640,7 +1642,7 @@ func resourceStorageAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) e // https://github.com/hashicorp/terraform-provider-azurerm/issues/8083 // USGovernmentCloud "min_tls_version" allowed as of issue 9128 // https://github.com/hashicorp/terraform-provider-azurerm/issues/9128 - if envName != autorestAzure.PublicCloud.Name && envName != autorestAzure.USGovernmentCloud.Name && envName != autorestAzure.ChinaCloud.Name { + if envName != environments.AzurePublicCloud && envName != environments.AzureUSGovernmentCloud && envName != environments.AzureChinaCloud { if minimumTLSVersion != string(storage.MinimumTLSVersionTLS10) { return fmt.Errorf(`"min_tls_version" is not supported for a Storage Account located in %q`, envName) } @@ -1664,7 +1666,7 @@ func resourceStorageAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) e // https://github.com/hashicorp/terraform-provider-azurerm/issues/7812 // USGovernmentCloud "allow_blob_public_access" allowed as of issue 9128 // https://github.com/hashicorp/terraform-provider-azurerm/issues/9128 - if envName != autorestAzure.PublicCloud.Name && envName != autorestAzure.USGovernmentCloud.Name && envName != autorestAzure.ChinaCloud.Name { + if envName != environments.AzurePublicCloud && envName != environments.AzureUSGovernmentCloud && envName != environments.AzureChinaCloud { if allowBlobPublicAccess { return fmt.Errorf("allow_nested_items_to_be_public is not supported for a Storage Account located in %q", envName) } @@ -1918,10 +1920,14 @@ func resourceStorageAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) e func resourceStorageAccountRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Storage.AccountsClient - endpointSuffix := meta.(*clients.Client).Account.Environment.StorageEndpointSuffix ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() + storageDomainSuffix, ok := meta.(*clients.Client).Account.Environment.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Storage domain suffix for environment %q", meta.(*clients.Client).Account.Environment.Name) + } + id, err := parse.StorageAccountID(d.Id()) if err != nil { return err @@ -2010,7 +2016,7 @@ func resourceStorageAccountRead(d *pluginsdk.ResourceData, meta interface{}) err // USGovernmentCloud "min_tls_version" allowed as of issue 9128 // https://github.com/hashicorp/terraform-provider-azurerm/issues/9128 envName := meta.(*clients.Client).Account.Environment.Name - if envName != autorestAzure.PublicCloud.Name && envName != autorestAzure.USGovernmentCloud.Name && envName != autorestAzure.ChinaCloud.Name { + if envName != environments.AzurePublicCloud && envName != environments.AzureUSGovernmentCloud && envName != environments.AzureChinaCloud { d.Set("min_tls_version", string(storage.MinimumTLSVersionTLS10)) } else { // For storage account created using old API, the response of GET call will not return "min_tls_version", either. @@ -2040,12 +2046,12 @@ func resourceStorageAccountRead(d *pluginsdk.ResourceData, meta interface{}) err if accessKeys := keys.Keys; accessKeys != nil { storageAccountKeys := *accessKeys if len(storageAccountKeys) > 0 { - pcs := fmt.Sprintf("DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s;EndpointSuffix=%s", *resp.Name, *storageAccountKeys[0].Value, endpointSuffix) + pcs := fmt.Sprintf("DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s;EndpointSuffix=%s", *resp.Name, *storageAccountKeys[0].Value, *storageDomainSuffix) d.Set("primary_connection_string", pcs) } if len(storageAccountKeys) > 1 { - scs := fmt.Sprintf("DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s;EndpointSuffix=%s", *resp.Name, *storageAccountKeys[1].Value, endpointSuffix) + scs := fmt.Sprintf("DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s;EndpointSuffix=%s", *resp.Name, *storageAccountKeys[1].Value, *storageDomainSuffix) d.Set("secondary_connection_string", scs) } } @@ -2169,9 +2175,7 @@ func resourceStorageAccountRead(d *pluginsdk.ResourceData, meta interface{}) err blobClient := storageClient.BlobServicesClient blobProps, err := blobClient.GetServiceProperties(ctx, id.ResourceGroup, id.Name) if err != nil { - if !utils.ResponseWasNotFound(blobProps.Response) { - return fmt.Errorf("reading blob properties for AzureRM Storage Account %q: %+v", id.Name, err) - } + return fmt.Errorf("reading blob properties for AzureRM Storage Account %q: %+v", id.Name, err) } if err := d.Set("blob_properties", flattenBlobProperties(blobProps)); err != nil { return fmt.Errorf("setting `blob_properties `for AzureRM Storage Account %q: %+v", id.Name, err) @@ -2196,11 +2200,10 @@ func resourceStorageAccountRead(d *pluginsdk.ResourceData, meta interface{}) err if supportLevel.supportShare { fileServiceClient := storageClient.FileServicesClient + shareProps, err := fileServiceClient.GetServiceProperties(ctx, id.ResourceGroup, id.Name) if err != nil { - if !utils.ResponseWasNotFound(shareProps.Response) { - return fmt.Errorf("reading share properties for AzureRM Storage Account %q: %+v", id.Name, err) - } + return fmt.Errorf("reading share properties for AzureRM Storage Account %q: %+v", id.Name, err) } if err := d.Set("share_properties", flattenShareProperties(shareProps)); err != nil { @@ -2222,9 +2225,7 @@ func resourceStorageAccountRead(d *pluginsdk.ResourceData, meta interface{}) err staticWebsiteProps, err := accountsClient.GetServiceProperties(ctx, id.Name) if err != nil { - if staticWebsiteProps.Response.Response != nil && !utils.ResponseWasNotFound(staticWebsiteProps.Response) { - return fmt.Errorf("reading static website for AzureRM Storage Account %q: %+v", id.Name, err) - } + return fmt.Errorf("reading static website for AzureRM Storage Account %q: %+v", id.Name, err) } staticWebsite := flattenStaticWebsiteProperties(staticWebsiteProps) if err := d.Set("static_website", staticWebsite); err != nil { diff --git a/internal/services/storage/storage_account_resource_test.go b/internal/services/storage/storage_account_resource_test.go index 0a3724fcbac6..4dd3aa8bc477 100644 --- a/internal/services/storage/storage_account_resource_test.go +++ b/internal/services/storage/storage_account_resource_test.go @@ -887,6 +887,13 @@ func TestAccAzureRMStorageAccount_azureFilesAuthentication(t *testing.T) { ), }, data.ImportStep(), + { + Config: r.azureFilesAuthenticationAADKERB(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), { Config: r.basic(data), Check: acceptance.ComposeTestCheckFunc( @@ -1118,7 +1125,7 @@ func TestAccStorageAccount_encryptionKeyType(t *testing.T) { }) } -func TestAccStorageAccount_infrastructureEncryption(t *testing.T) { +func TestAccStorageAccount_infrastructureEncryptionStorageV2(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_storage_account", "test") r := StorageAccountResource{} @@ -1140,14 +1147,43 @@ func TestAccStorageAccount_infrastructureEncryption(t *testing.T) { }, data.ImportStep(), { - Config: r.infrastructureEncryptionForBlockBlobStorage(data), + Config: r.infrastructureEncryption(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("infrastructure_encryption_enabled").HasValue("true"), - check.That(data.ResourceName).Key("account_tier").HasValue("Premium"), - check.That(data.ResourceName).Key("account_kind").HasValue("BlockBlobStorage"), ), }, + data.ImportStep(), + }) +} + +func TestAccStorageAccount_infrastructureEncryptionFileStorage(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_storage_account", "test") + r := StorageAccountResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.infrastructureEncryptionForFileStorage(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccStorageAccount_infrastructureEncryptionBlockBlobStorage(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_storage_account", "test") + r := StorageAccountResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.infrastructureEncryptionForBlockBlobStorage(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), }) } @@ -3199,6 +3235,35 @@ resource "azurerm_storage_account" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomString) } +func (r StorageAccountResource) azureFilesAuthenticationAADKERB(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-storage-%d" + location = "%s" +} + +resource "azurerm_storage_account" "test" { + name = "unlikely23exst2acct%s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_tier = "Standard" + account_replication_type = "LRS" + + azure_files_authentication { + directory_type = "AADKERB" + } + + tags = { + environment = "production" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomString) +} + func (r StorageAccountResource) routing(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { @@ -3680,6 +3745,30 @@ resource "azurerm_storage_account" "test" { `, data.RandomInteger, data.Locations.Primary, data.RandomString) } +func (r StorageAccountResource) infrastructureEncryptionForFileStorage(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-storage-%d" + location = "%s" +} + +resource "azurerm_storage_account" "test" { + name = "unlikely23exst2acct%s" + resource_group_name = azurerm_resource_group.test.name + + location = azurerm_resource_group.test.location + account_kind = "FileStorage" + account_tier = "Premium" + account_replication_type = "LRS" + infrastructure_encryption_enabled = true +} +`, data.RandomInteger, data.Locations.Primary, data.RandomString) +} + func (r StorageAccountResource) infrastructureEncryptionDisabled(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/internal/services/storage/storage_blob_data_source.go b/internal/services/storage/storage_blob_data_source.go index 66d71913a204..26d50cba54d9 100644 --- a/internal/services/storage/storage_blob_data_source.go +++ b/internal/services/storage/storage_blob_data_source.go @@ -97,9 +97,7 @@ func dataSourceStorageBlobRead(d *pluginsdk.ResourceData, meta interface{}) erro props, err := blobsClient.GetProperties(ctx, accountName, containerName, name, input) if err != nil { if utils.ResponseWasNotFound(props.Response) { - log.Printf("[INFO] Blob %q was not found in Container %q / Account %q - assuming removed & removing from state...", name, containerName, accountName) - d.SetId("") - return nil + return fmt.Errorf("the Blob %q was not found in Container %q / Account %q", name, containerName, accountName) } return fmt.Errorf("retrieving properties for Blob %q (Container %q / Account %q): %s", name, containerName, accountName, err) diff --git a/internal/services/storage/storage_blob_inventory_policy_resource.go b/internal/services/storage/storage_blob_inventory_policy_resource.go index c500e934cd2d..05dabab21309 100644 --- a/internal/services/storage/storage_blob_inventory_policy_resource.go +++ b/internal/services/storage/storage_blob_inventory_policy_resource.go @@ -153,6 +153,17 @@ func storageBlobInventoryPolicyResourceSchema() map[string]*pluginsdk.Schema { "prefix_match": { Type: pluginsdk.TypeSet, Optional: true, + MaxItems: 10, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + + "exclude_prefixes": { + Type: pluginsdk.TypeSet, + Optional: true, + MaxItems: 10, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringIsNotEmpty, @@ -287,6 +298,7 @@ func expandBlobInventoryPolicyFilter(input []interface{}) *storage.BlobInventory v := input[0].(map[string]interface{}) return &storage.BlobInventoryPolicyFilter{ PrefixMatch: utils.ExpandStringSlice(v["prefix_match"].(*pluginsdk.Set).List()), + ExcludePrefix: utils.ExpandStringSlice(v["exclude_prefixes"].(*pluginsdk.Set).List()), BlobTypes: utils.ExpandStringSlice(v["blob_types"].(*pluginsdk.Set).List()), IncludeBlobVersions: utils.Bool(v["include_blob_versions"].(bool)), IncludeDeleted: utils.Bool(v["include_deleted"].(bool)), @@ -352,6 +364,7 @@ func flattenBlobInventoryPolicyFilter(input *storage.BlobInventoryPolicyFilter) "include_deleted": includeDeleted, "include_snapshots": includeSnapshots, "prefix_match": utils.FlattenStringSlice(input.PrefixMatch), + "exclude_prefixes": utils.FlattenStringSlice(input.ExcludePrefix), }, } } diff --git a/internal/services/storage/storage_blob_inventory_policy_resource_test.go b/internal/services/storage/storage_blob_inventory_policy_resource_test.go index a426a8f6dbe0..6da6866c66b1 100644 --- a/internal/services/storage/storage_blob_inventory_policy_resource_test.go +++ b/internal/services/storage/storage_blob_inventory_policy_resource_test.go @@ -219,6 +219,7 @@ resource "azurerm_storage_blob_inventory_policy" "test" { include_deleted = true include_snapshots = true prefix_match = ["*/test"] + exclude_prefixes = ["syslog.log"] } } } diff --git a/internal/services/storage/storage_management_policy_resource.go b/internal/services/storage/storage_management_policy_resource.go index e6bfc8a2af9e..0f8d2930ec47 100644 --- a/internal/services/storage/storage_management_policy_resource.go +++ b/internal/services/storage/storage_management_policy_resource.go @@ -58,7 +58,7 @@ func resourceStorageManagementPolicy() *pluginsdk.Resource { }, "filters": { Type: pluginsdk.TypeList, - Optional: true, + Required: true, MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ diff --git a/internal/services/storage/storage_object_replication_resource.go b/internal/services/storage/storage_object_replication_resource.go index 865539a90b25..8b9d173d6df7 100644 --- a/internal/services/storage/storage_object_replication_resource.go +++ b/internal/services/storage/storage_object_replication_resource.go @@ -124,8 +124,8 @@ func resourceStorageObjectReplicationCreate(d *pluginsdk.ResourceData, meta inte return err } - srcId := objectreplicationpolicies.NewObjectReplicationPolicyID(srcAccount.SubscriptionId, srcAccount.ResourceGroupName, srcAccount.AccountName, "default") - dstId := objectreplicationpolicies.NewObjectReplicationPolicyID(dstAccount.SubscriptionId, dstAccount.ResourceGroupName, dstAccount.AccountName, "default") + srcId := objectreplicationpolicies.NewObjectReplicationPolicyID(srcAccount.SubscriptionId, srcAccount.ResourceGroupName, srcAccount.StorageAccountName, "default") + dstId := objectreplicationpolicies.NewObjectReplicationPolicyID(dstAccount.SubscriptionId, dstAccount.ResourceGroupName, dstAccount.StorageAccountName, "default") resp, err := client.List(ctx, *dstAccount) if err != nil { @@ -136,7 +136,7 @@ func resourceStorageObjectReplicationCreate(d *pluginsdk.ResourceData, meta inte if resp.Model != nil && resp.Model.Value != nil { for _, existing := range *resp.Model.Value { if existing.Name != nil && *existing.Name != "" { - if prop := existing.Properties; prop != nil && prop.SourceAccount == srcAccount.AccountName && prop.DestinationAccount == dstAccount.AccountName { + if prop := existing.Properties; prop != nil && prop.SourceAccount == srcAccount.StorageAccountName && prop.DestinationAccount == dstAccount.StorageAccountName { srcId.ObjectReplicationPolicyId = *existing.Name dstId.ObjectReplicationPolicyId = *existing.Name return tf.ImportAsExistsError("azurerm_storage_object_replication", parse.NewObjectReplicationID(srcId, dstId).ID()) @@ -147,8 +147,8 @@ func resourceStorageObjectReplicationCreate(d *pluginsdk.ResourceData, meta inte props := objectreplicationpolicies.ObjectReplicationPolicy{ Properties: &objectreplicationpolicies.ObjectReplicationPolicyProperties{ - SourceAccount: srcId.AccountName, - DestinationAccount: dstId.AccountName, + SourceAccount: srcId.StorageAccountName, + DestinationAccount: dstId.StorageAccountName, Rules: expandArmObjectReplicationRuleArray(d.Get("rules").(*pluginsdk.Set).List()), }, } @@ -156,20 +156,20 @@ func resourceStorageObjectReplicationCreate(d *pluginsdk.ResourceData, meta inte // create in dest storage account dstResp, err := client.CreateOrUpdate(ctx, dstId, props) if err != nil { - return fmt.Errorf("creating Storage Object Replication for destination storage account name %q: %+v", dstId.AccountName, err) + return fmt.Errorf("creating Storage Object Replication for destination storage account name %q: %+v", dstId.StorageAccountName, err) } if dstResp.Model == nil { - return fmt.Errorf("nil model returned for Storage Object Replication for destination storage account name %q ID", dstId.AccountName) + return fmt.Errorf("nil model returned for Storage Object Replication for destination storage account name %q ID", dstId.StorageAccountName) } if dstResp.Model.Id == nil || *dstResp.Model.Id == "" { - return fmt.Errorf("empty or nil ID returned for Storage Object Replication for destination storage account name %q ID", dstId.AccountName) + return fmt.Errorf("empty or nil ID returned for Storage Object Replication for destination storage account name %q ID", dstId.StorageAccountName) } if dstResp.Model.Name == nil || *dstResp.Model.Name == "" { - return fmt.Errorf("empty or nil Name returned for Storage Object Replication for destination storage account name %q ID", dstAccount.AccountName) + return fmt.Errorf("empty or nil Name returned for Storage Object Replication for destination storage account name %q ID", dstAccount.StorageAccountName) } if dstResp.Model.Properties == nil { - return fmt.Errorf("nil properties returned for Storage Object Replication for destination storage account name %q ID", dstAccount.AccountName) + return fmt.Errorf("nil properties returned for Storage Object Replication for destination storage account name %q ID", dstAccount.StorageAccountName) } // Update the srcId and dstId using the returned computed object replication policy ID. @@ -179,7 +179,7 @@ func resourceStorageObjectReplicationCreate(d *pluginsdk.ResourceData, meta inte // create in source storage account, update policy Id and ruleId which are computed from destination ORP props.Properties.Rules = dstResp.Model.Properties.Rules if _, err := client.CreateOrUpdate(ctx, srcId, props); err != nil { - return fmt.Errorf("creating Storage Object Replication %q for source storage account name %q: %+v", srcId.ObjectReplicationPolicyId, srcId.AccountName, err) + return fmt.Errorf("creating Storage Object Replication %q for source storage account name %q: %+v", srcId.ObjectReplicationPolicyId, srcId.StorageAccountName, err) } d.SetId(parse.NewObjectReplicationID(srcId, dstId).ID()) @@ -199,8 +199,8 @@ func resourceStorageObjectReplicationUpdate(d *pluginsdk.ResourceData, meta inte props := objectreplicationpolicies.ObjectReplicationPolicy{ Properties: &objectreplicationpolicies.ObjectReplicationPolicyProperties{ - SourceAccount: id.Src.AccountName, - DestinationAccount: id.Dst.AccountName, + SourceAccount: id.Src.StorageAccountName, + DestinationAccount: id.Dst.StorageAccountName, Rules: expandArmObjectReplicationRuleArray(d.Get("rules").(*pluginsdk.Set).List()), }, } @@ -208,19 +208,19 @@ func resourceStorageObjectReplicationUpdate(d *pluginsdk.ResourceData, meta inte // update in dest storage account resp, err := client.CreateOrUpdate(ctx, id.Dst, props) if err != nil { - return fmt.Errorf("updating %q for destination storage account name %q: %+v", id, id.Dst.AccountName, err) + return fmt.Errorf("updating %q for destination storage account name %q: %+v", id, id.Dst.StorageAccountName, err) } if resp.Model == nil { - return fmt.Errorf("nil model returned for Storage Object Replication for destination storage account name %q ID", id.Dst.AccountName) + return fmt.Errorf("nil model returned for Storage Object Replication for destination storage account name %q ID", id.Dst.StorageAccountName) } if resp.Model.Properties == nil { - return fmt.Errorf("nil properties returned for Storage Object Replication for destination storage account name %q ID", id.Dst.AccountName) + return fmt.Errorf("nil properties returned for Storage Object Replication for destination storage account name %q ID", id.Dst.StorageAccountName) } // update in source storage account, update policy Id and ruleId props.Properties.Rules = resp.Model.Properties.Rules if _, err := client.CreateOrUpdate(ctx, id.Src, props); err != nil { - return fmt.Errorf("updating %q for source storage account name %q: %+v", id, id.Src.AccountName, err) + return fmt.Errorf("updating %q for source storage account name %q: %+v", id, id.Src.StorageAccountName, err) } return resourceStorageObjectReplicationRead(d, meta) @@ -258,8 +258,8 @@ func resourceStorageObjectReplicationRead(d *pluginsdk.ResourceData, meta interf if model := dstResp.Model; model != nil { if props := dstResp.Model.Properties; props != nil { - d.Set("source_storage_account_id", parse.NewStorageAccountID(id.Src.SubscriptionId, id.Src.ResourceGroupName, id.Src.AccountName).ID()) - d.Set("destination_storage_account_id", parse.NewStorageAccountID(id.Dst.SubscriptionId, id.Dst.ResourceGroupName, id.Dst.AccountName).ID()) + d.Set("source_storage_account_id", parse.NewStorageAccountID(id.Src.SubscriptionId, id.Src.ResourceGroupName, id.Src.StorageAccountName).ID()) + d.Set("destination_storage_account_id", parse.NewStorageAccountID(id.Dst.SubscriptionId, id.Dst.ResourceGroupName, id.Dst.StorageAccountName).ID()) if err := d.Set("rules", flattenObjectReplicationRules(props.Rules)); err != nil { return fmt.Errorf("setting `rules`: %+v", err) } diff --git a/internal/services/storage/storage_table_entity_data_source.go b/internal/services/storage/storage_table_entity_data_source.go index c0e3eb6acb31..4c83cf34ea14 100644 --- a/internal/services/storage/storage_table_entity_data_source.go +++ b/internal/services/storage/storage_table_entity_data_source.go @@ -2,7 +2,6 @@ package storage import ( "fmt" - "log" "time" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -72,9 +71,7 @@ func dataSourceStorageTableEntityRead(d *pluginsdk.ResourceData, meta interface{ return fmt.Errorf("retrieving Account %q for Table %q: %s", storageAccountName, tableName, err) } if account == nil { - log.Printf("[WARN] Unable to determine Resource Group for Storage Table %q (Account %s) - assuming removed & removing from state", tableName, storageAccountName) - d.SetId("") - return nil + return fmt.Errorf("the parent Storage Account %s was not found", storageAccountName) } client, err := storageClient.TableEntityClient(ctx, *account) diff --git a/internal/services/streamanalytics/client/client.go b/internal/services/streamanalytics/client/client.go index f75f6959d85c..9bb916be708b 100644 --- a/internal/services/streamanalytics/client/client.go +++ b/internal/services/streamanalytics/client/client.go @@ -4,10 +4,10 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/clusters" "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/functions" "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/inputs" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/privateendpoints" "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/streamingjobs" "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/transformations" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) diff --git a/internal/services/streamanalytics/helpers_output.go b/internal/services/streamanalytics/helpers_output.go index 61ae3c69474f..8c437ca1f3d9 100644 --- a/internal/services/streamanalytics/helpers_output.go +++ b/internal/services/streamanalytics/helpers_output.go @@ -3,7 +3,7 @@ package streamanalytics import ( "fmt" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" diff --git a/internal/services/streamanalytics/migration/stream_analytics_output_blob_v0_to_v1.go b/internal/services/streamanalytics/migration/stream_analytics_output_blob_v0_to_v1.go index 88d9a78e09ca..2dd1a7ea60f2 100644 --- a/internal/services/streamanalytics/migration/stream_analytics_output_blob_v0_to_v1.go +++ b/internal/services/streamanalytics/migration/stream_analytics_output_blob_v0_to_v1.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/streamanalytics/migration/stream_analytics_output_cosmosdb_v0_to_v1.go b/internal/services/streamanalytics/migration/stream_analytics_output_cosmosdb_v0_to_v1.go index 6285fb21f955..917d455d1c68 100644 --- a/internal/services/streamanalytics/migration/stream_analytics_output_cosmosdb_v0_to_v1.go +++ b/internal/services/streamanalytics/migration/stream_analytics_output_cosmosdb_v0_to_v1.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/streamanalytics/migration/stream_analytics_output_eventhub_v0_to_v1.go b/internal/services/streamanalytics/migration/stream_analytics_output_eventhub_v0_to_v1.go index 851d8855a578..87fa690213aa 100644 --- a/internal/services/streamanalytics/migration/stream_analytics_output_eventhub_v0_to_v1.go +++ b/internal/services/streamanalytics/migration/stream_analytics_output_eventhub_v0_to_v1.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/streamanalytics/migration/stream_analytics_output_function_v0_to_v1.go b/internal/services/streamanalytics/migration/stream_analytics_output_function_v0_to_v1.go index 27db8566c332..bfc5f1c2a81d 100644 --- a/internal/services/streamanalytics/migration/stream_analytics_output_function_v0_to_v1.go +++ b/internal/services/streamanalytics/migration/stream_analytics_output_function_v0_to_v1.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/streamanalytics/migration/stream_analytics_output_mssql_v0_to_v1.go b/internal/services/streamanalytics/migration/stream_analytics_output_mssql_v0_to_v1.go index fada92b861a3..a869d25f4462 100644 --- a/internal/services/streamanalytics/migration/stream_analytics_output_mssql_v0_to_v1.go +++ b/internal/services/streamanalytics/migration/stream_analytics_output_mssql_v0_to_v1.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/streamanalytics/migration/stream_analytics_output_powerbi_v0_to_v1.go b/internal/services/streamanalytics/migration/stream_analytics_output_powerbi_v0_to_v1.go index 32cfa978ea50..281d86a6c9da 100644 --- a/internal/services/streamanalytics/migration/stream_analytics_output_powerbi_v0_to_v1.go +++ b/internal/services/streamanalytics/migration/stream_analytics_output_powerbi_v0_to_v1.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/streamanalytics/migration/stream_analytics_output_servicebus_queue_v0_to_v1.go b/internal/services/streamanalytics/migration/stream_analytics_output_servicebus_queue_v0_to_v1.go index 24c0b180000a..55c07097f9f4 100644 --- a/internal/services/streamanalytics/migration/stream_analytics_output_servicebus_queue_v0_to_v1.go +++ b/internal/services/streamanalytics/migration/stream_analytics_output_servicebus_queue_v0_to_v1.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/streamanalytics/migration/stream_analytics_output_servicebus_topic_v0_to_v1.go b/internal/services/streamanalytics/migration/stream_analytics_output_servicebus_topic_v0_to_v1.go index f4882b39cb12..aa08cca7ab85 100644 --- a/internal/services/streamanalytics/migration/stream_analytics_output_servicebus_topic_v0_to_v1.go +++ b/internal/services/streamanalytics/migration/stream_analytics_output_servicebus_topic_v0_to_v1.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/streamanalytics/migration/stream_analytics_output_synapse_v0_to_v1.go b/internal/services/streamanalytics/migration/stream_analytics_output_synapse_v0_to_v1.go index 8fe9396cd297..947b9c941509 100644 --- a/internal/services/streamanalytics/migration/stream_analytics_output_synapse_v0_to_v1.go +++ b/internal/services/streamanalytics/migration/stream_analytics_output_synapse_v0_to_v1.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/streamanalytics/migration/stream_analytics_output_table_v0_to_v1.go b/internal/services/streamanalytics/migration/stream_analytics_output_table_v0_to_v1.go index 5665a8c10d2a..992e6bebb277 100644 --- a/internal/services/streamanalytics/migration/stream_analytics_output_table_v0_to_v1.go +++ b/internal/services/streamanalytics/migration/stream_analytics_output_table_v0_to_v1.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/streamanalytics/resourceids.go b/internal/services/streamanalytics/resourceids.go index 545dafbb8de3..eee1feaccbe5 100644 --- a/internal/services/streamanalytics/resourceids.go +++ b/internal/services/streamanalytics/resourceids.go @@ -1,3 +1,4 @@ package streamanalytics +// @tombuildsstuff: Resources using this Resource ID are going to need a state migration to account for `streamingjobs` -> `streamingJobs` prior to migrating to `hashicorp/go-azure-sdk` //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=StreamingJobSchedule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.StreamAnalytics/streamingjobs/streamingJob1/schedule/default diff --git a/internal/services/streamanalytics/stream_analytics_function_javascript_uda_resource.go b/internal/services/streamanalytics/stream_analytics_function_javascript_uda_resource.go index 9da2ad5e95ac..f631e6a3a280 100644 --- a/internal/services/streamanalytics/stream_analytics_function_javascript_uda_resource.go +++ b/internal/services/streamanalytics/stream_analytics_function_javascript_uda_resource.go @@ -129,7 +129,7 @@ func resourceStreamAnalyticsFunctionUDACreate(d *pluginsdk.ResourceData, meta in return err } - id := functions.NewFunctionID(subscriptionId, jobId.ResourceGroupName, jobId.JobName, d.Get("name").(string)) + id := functions.NewFunctionID(subscriptionId, jobId.ResourceGroupName, jobId.StreamingJobName, d.Get("name").(string)) existing, err := client.Get(ctx, id) if err != nil { @@ -189,7 +189,7 @@ func resourceStreamAnalyticsFunctionUDARead(d *pluginsdk.ResourceData, meta inte d.Set("name", id.FunctionName) - jobId := streamingjobs.NewStreamingJobID(id.SubscriptionId, id.ResourceGroupName, id.JobName) + jobId := streamingjobs.NewStreamingJobID(id.SubscriptionId, id.ResourceGroupName, id.StreamingJobName) d.Set("stream_analytics_job_id", jobId.ID()) if model := resp.Model; model != nil { diff --git a/internal/services/streamanalytics/stream_analytics_function_javascript_udf_resource.go b/internal/services/streamanalytics/stream_analytics_function_javascript_udf_resource.go index 0fe9ba3c46c8..71d531de416b 100644 --- a/internal/services/streamanalytics/stream_analytics_function_javascript_udf_resource.go +++ b/internal/services/streamanalytics/stream_analytics_function_javascript_udf_resource.go @@ -194,7 +194,7 @@ func resourceStreamAnalyticsFunctionUDFRead(d *pluginsdk.ResourceData, meta inte } d.Set("name", id.FunctionName) - d.Set("stream_analytics_job_name", id.JobName) + d.Set("stream_analytics_job_name", id.StreamingJobName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/streamanalytics/stream_analytics_job_data_source.go b/internal/services/streamanalytics/stream_analytics_job_data_source.go index 993b93c8cccc..fa2c9a19b8d3 100644 --- a/internal/services/streamanalytics/stream_analytics_job_data_source.go +++ b/internal/services/streamanalytics/stream_analytics_job_data_source.go @@ -118,7 +118,7 @@ func dataSourceStreamAnalyticsJobRead(d *pluginsdk.ResourceData, meta interface{ d.SetId(id.ID()) - d.Set("name", id.JobName) + d.Set("name", id.StreamingJobName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/streamanalytics/stream_analytics_job_resource.go b/internal/services/streamanalytics/stream_analytics_job_resource.go index d5bcb29881aa..876edebf27c5 100644 --- a/internal/services/streamanalytics/stream_analytics_job_resource.go +++ b/internal/services/streamanalytics/stream_analytics_job_resource.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/streamingjobs" "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/transformations" @@ -253,7 +254,7 @@ func resourceStreamAnalyticsJobCreateUpdate(d *pluginsdk.ResourceData, meta inte } props := streamingjobs.StreamingJob{ - Name: utils.String(id.JobName), + Name: utils.String(id.StreamingJobName), Location: utils.String(azure.NormalizeLocation(d.Get("location").(string))), Properties: &streamingjobs.StreamingJobProperties{ Sku: &streamingjobs.Sku{ @@ -338,7 +339,7 @@ func resourceStreamAnalyticsJobCreateUpdate(d *pluginsdk.ResourceData, meta inte } } - transformationId := transformations.NewTransformationID(subscriptionId, id.ResourceGroupName, id.JobName, *transformation.Name) + transformationId := transformations.NewTransformationID(subscriptionId, id.ResourceGroupName, id.StreamingJobName, *transformation.Name) var updateOpts transformations.UpdateOperationOptions if _, err := transformationsClient.Update(ctx, transformationId, transformationUpdate, updateOpts); err != nil { @@ -374,11 +375,11 @@ func resourceStreamAnalyticsJobRead(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.JobName) + d.Set("name", id.StreamingJobName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { - d.Set("location", azure.NormalizeLocation(*model.Location)) + d.Set("location", location.NormalizeNilable(model.Location)) if err := d.Set("identity", flattenJobIdentity(model.Identity)); err != nil { return fmt.Errorf("setting `identity`: %v", err) diff --git a/internal/services/streamanalytics/stream_analytics_job_schedule_resource.go b/internal/services/streamanalytics/stream_analytics_job_schedule_resource.go index 931b83f803d3..9d9937be06e2 100644 --- a/internal/services/streamanalytics/stream_analytics_job_schedule_resource.go +++ b/internal/services/streamanalytics/stream_analytics_job_schedule_resource.go @@ -92,7 +92,7 @@ func (r JobScheduleResource) Create() sdk.ResourceFunc { } // This is a virtual resource so the last segment is hardcoded - id := parse.NewStreamingJobScheduleID(streamAnalyticsId.SubscriptionId, streamAnalyticsId.ResourceGroupName, streamAnalyticsId.JobName, "default") + id := parse.NewStreamingJobScheduleID(streamAnalyticsId.SubscriptionId, streamAnalyticsId.ResourceGroupName, streamAnalyticsId.StreamingJobName, "default") locks.ByID(id.ID()) defer locks.UnlockByID(id.ID()) diff --git a/internal/services/streamanalytics/stream_analytics_output.go b/internal/services/streamanalytics/stream_analytics_output.go index 1eaa58fbf5aa..cc19aa82fb4f 100644 --- a/internal/services/streamanalytics/stream_analytics_output.go +++ b/internal/services/streamanalytics/stream_analytics_output.go @@ -5,7 +5,7 @@ import ( "fmt" "reflect" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/internal/services/streamanalytics/stream_analytics_output_blob_resource.go b/internal/services/streamanalytics/stream_analytics_output_blob_resource.go index fe8b55f9db97..38683d72165e 100644 --- a/internal/services/streamanalytics/stream_analytics_output_blob_resource.go +++ b/internal/services/streamanalytics/stream_analytics_output_blob_resource.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/migration" @@ -227,7 +227,7 @@ func resourceStreamAnalyticsOutputBlobRead(d *pluginsdk.ResourceData, meta inter } d.Set("name", id.OutputName) - d.Set("stream_analytics_job_name", id.JobName) + d.Set("stream_analytics_job_name", id.StreamingJobName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/streamanalytics/stream_analytics_output_blob_resource_test.go b/internal/services/streamanalytics/stream_analytics_output_blob_resource_test.go index 764e778914b5..a5593c00b617 100644 --- a/internal/services/streamanalytics/stream_analytics_output_blob_resource_test.go +++ b/internal/services/streamanalytics/stream_analytics_output_blob_resource_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource.go b/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource.go index 896f2ef07aaf..d2f2d132637c 100644 --- a/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource.go +++ b/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource.go @@ -6,8 +6,8 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/streamingjobs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" cosmosParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/parse" @@ -112,7 +112,7 @@ func (r OutputCosmosDBResource) Create() sdk.ResourceFunc { if err != nil { return err } - id := outputs.NewOutputID(subscriptionId, streamingJobId.ResourceGroupName, streamingJobId.JobName, model.Name) + id := outputs.NewOutputID(subscriptionId, streamingJobId.ResourceGroupName, streamingJobId.StreamingJobName, model.Name) existing, err := client.Get(ctx, id) if err != nil && !response.WasNotFound(existing.HttpResponse) { @@ -183,7 +183,7 @@ func (r OutputCosmosDBResource) Read() sdk.ResourceFunc { return fmt.Errorf("converting %s to a CosmosDb Output", *id) } - streamingJobId := streamingjobs.NewStreamingJobID(id.SubscriptionId, id.ResourceGroupName, id.JobName) + streamingJobId := streamingjobs.NewStreamingJobID(id.SubscriptionId, id.ResourceGroupName, id.StreamingJobName) state := OutputCosmosDBResourceModel{ Name: id.OutputName, StreamAnalyticsJob: streamingJobId.ID(), diff --git a/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource_test.go b/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource_test.go index 218f0a7dd679..6520b5be4c70 100644 --- a/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource_test.go +++ b/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/streamanalytics/stream_analytics_output_eventhub_resource.go b/internal/services/streamanalytics/stream_analytics_output_eventhub_resource.go index f2e1dffac32b..c1daba005672 100644 --- a/internal/services/streamanalytics/stream_analytics_output_eventhub_resource.go +++ b/internal/services/streamanalytics/stream_analytics_output_eventhub_resource.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/migration" @@ -208,7 +208,7 @@ func resourceStreamAnalyticsOutputEventHubRead(d *pluginsdk.ResourceData, meta i } d.Set("name", id.OutputName) - d.Set("stream_analytics_job_name", id.JobName) + d.Set("stream_analytics_job_name", id.StreamingJobName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/streamanalytics/stream_analytics_output_eventhub_resource_test.go b/internal/services/streamanalytics/stream_analytics_output_eventhub_resource_test.go index 2d44150a6136..3dac212969ad 100644 --- a/internal/services/streamanalytics/stream_analytics_output_eventhub_resource_test.go +++ b/internal/services/streamanalytics/stream_analytics_output_eventhub_resource_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/streamanalytics/stream_analytics_output_function_resource.go b/internal/services/streamanalytics/stream_analytics_output_function_resource.go index 995804e1d71c..f0e68f378e42 100644 --- a/internal/services/streamanalytics/stream_analytics_output_function_resource.go +++ b/internal/services/streamanalytics/stream_analytics_output_function_resource.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -184,7 +184,7 @@ func (r OutputFunctionResource) Read() sdk.ResourceFunc { state := OutputFunctionResourceModel{ Name: id.OutputName, ResourceGroup: id.ResourceGroupName, - StreamAnalyticsJob: id.JobName, + StreamAnalyticsJob: id.StreamingJobName, ApiKey: metadata.ResourceData.Get("api_key").(string), } diff --git a/internal/services/streamanalytics/stream_analytics_output_function_resource_test.go b/internal/services/streamanalytics/stream_analytics_output_function_resource_test.go index 77d89881c16d..daa9254e4360 100644 --- a/internal/services/streamanalytics/stream_analytics_output_function_resource_test.go +++ b/internal/services/streamanalytics/stream_analytics_output_function_resource_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/streamanalytics/stream_analytics_output_mssql_resource.go b/internal/services/streamanalytics/stream_analytics_output_mssql_resource.go index 634461a24b53..2d68e26c31c1 100644 --- a/internal/services/streamanalytics/stream_analytics_output_mssql_resource.go +++ b/internal/services/streamanalytics/stream_analytics_output_mssql_resource.go @@ -6,7 +6,7 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/migration" @@ -203,7 +203,7 @@ func resourceStreamAnalyticsOutputSqlRead(d *pluginsdk.ResourceData, meta interf } d.Set("name", id.OutputName) - d.Set("stream_analytics_job_name", id.JobName) + d.Set("stream_analytics_job_name", id.StreamingJobName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/streamanalytics/stream_analytics_output_mssql_resource_test.go b/internal/services/streamanalytics/stream_analytics_output_mssql_resource_test.go index dd036323cc4b..fad7408ce447 100644 --- a/internal/services/streamanalytics/stream_analytics_output_mssql_resource_test.go +++ b/internal/services/streamanalytics/stream_analytics_output_mssql_resource_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/streamanalytics/stream_analytics_output_powerbi_resource.go b/internal/services/streamanalytics/stream_analytics_output_powerbi_resource.go index ef7152b42e93..9c6bc7353e4c 100644 --- a/internal/services/streamanalytics/stream_analytics_output_powerbi_resource.go +++ b/internal/services/streamanalytics/stream_analytics_output_powerbi_resource.go @@ -6,8 +6,8 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/streamingjobs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/migration" @@ -116,7 +116,7 @@ func (r OutputPowerBIResource) Create() sdk.ResourceFunc { if err != nil { return err } - id := outputs.NewOutputID(subscriptionId, streamingJobId.ResourceGroupName, streamingJobId.JobName, model.Name) + id := outputs.NewOutputID(subscriptionId, streamingJobId.ResourceGroupName, streamingJobId.StreamingJobName, model.Name) existing, err := client.Get(ctx, id) if err != nil && !response.WasNotFound(existing.HttpResponse) { @@ -263,7 +263,7 @@ func (r OutputPowerBIResource) Read() sdk.ResourceFunc { return fmt.Errorf("converting %s to a PowerBI Output", *id) } - streamingJobId := streamingjobs.NewStreamingJobID(id.SubscriptionId, id.ResourceGroupName, id.JobName) + streamingJobId := streamingjobs.NewStreamingJobID(id.SubscriptionId, id.ResourceGroupName, id.StreamingJobName) state := OutputPowerBIResourceModel{ Name: id.OutputName, diff --git a/internal/services/streamanalytics/stream_analytics_output_powerbi_resource_test.go b/internal/services/streamanalytics/stream_analytics_output_powerbi_resource_test.go index f5ad3ccc5b64..c91e08a88896 100644 --- a/internal/services/streamanalytics/stream_analytics_output_powerbi_resource_test.go +++ b/internal/services/streamanalytics/stream_analytics_output_powerbi_resource_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/streamanalytics/stream_analytics_output_servicebus_queue_resource.go b/internal/services/streamanalytics/stream_analytics_output_servicebus_queue_resource.go index 0bd0206c7083..c29359a58e46 100644 --- a/internal/services/streamanalytics/stream_analytics_output_servicebus_queue_resource.go +++ b/internal/services/streamanalytics/stream_analytics_output_servicebus_queue_resource.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/migration" @@ -72,14 +72,14 @@ func resourceStreamAnalyticsOutputServiceBusQueue() *pluginsdk.Resource { "shared_access_policy_key": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, Sensitive: true, ValidateFunc: validation.StringIsNotEmpty, }, "shared_access_policy_name": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, ValidateFunc: validation.StringIsNotEmpty, }, @@ -148,19 +148,26 @@ func resourceStreamAnalyticsOutputServiceBusQueueCreateUpdate(d *pluginsdk.Resou } systemPropertyColumns := d.Get("system_property_columns") + + dataSourceProperties := &outputs.ServiceBusQueueOutputDataSourceProperties{ + QueueName: utils.String(queueName), + ServiceBusNamespace: utils.String(serviceBusNamespace), + PropertyColumns: utils.ExpandStringSlice(d.Get("property_columns").([]interface{})), + SystemPropertyColumns: &systemPropertyColumns, + AuthenticationMode: utils.ToPtr(outputs.AuthenticationMode(d.Get("authentication_mode").(string))), + } + + // Add shared access policy key/name only if required by authentication mode + if *dataSourceProperties.AuthenticationMode == outputs.AuthenticationModeConnectionString { + dataSourceProperties.SharedAccessPolicyName = utils.String(sharedAccessPolicyName) + dataSourceProperties.SharedAccessPolicyKey = utils.String(sharedAccessPolicyKey) + } + props := outputs.Output{ Name: utils.String(id.OutputName), Properties: &outputs.OutputProperties{ Datasource: &outputs.ServiceBusQueueOutputDataSource{ - Properties: &outputs.ServiceBusQueueOutputDataSourceProperties{ - QueueName: utils.String(queueName), - ServiceBusNamespace: utils.String(serviceBusNamespace), - SharedAccessPolicyKey: utils.String(sharedAccessPolicyKey), - SharedAccessPolicyName: utils.String(sharedAccessPolicyName), - PropertyColumns: utils.ExpandStringSlice(d.Get("property_columns").([]interface{})), - SystemPropertyColumns: &systemPropertyColumns, - AuthenticationMode: utils.ToPtr(outputs.AuthenticationMode(d.Get("authentication_mode").(string))), - }, + Properties: dataSourceProperties, }, Serialization: serialization, }, @@ -204,7 +211,7 @@ func resourceStreamAnalyticsOutputServiceBusQueueRead(d *pluginsdk.ResourceData, } d.Set("name", id.OutputName) - d.Set("stream_analytics_job_name", id.JobName) + d.Set("stream_analytics_job_name", id.StreamingJobName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/streamanalytics/stream_analytics_output_servicebus_queue_resource_test.go b/internal/services/streamanalytics/stream_analytics_output_servicebus_queue_resource_test.go index f2072e4de7db..2fa949c8f3b2 100644 --- a/internal/services/streamanalytics/stream_analytics_output_servicebus_queue_resource_test.go +++ b/internal/services/streamanalytics/stream_analytics_output_servicebus_queue_resource_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -61,14 +61,14 @@ func TestAccStreamAnalyticsOutputServiceBusQueue_json(t *testing.T) { }) } -func TestAccStreamAnalyticsOutputServiceBusQueue_authenticationMode(t *testing.T) { +func TestAccStreamAnalyticsOutputServiceBusQueue_authenticationModeMsi(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_stream_analytics_output_servicebus_queue", "test") r := StreamAnalyticsOutputServiceBusQueueResource{} identity := "identity { type = \"SystemAssigned\" }" data.ResourceTest(t, r, []acceptance.TestStep{ { - Config: r.authenticationMode(data, identity), + Config: r.authenticationModeMsi(data, identity), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), @@ -434,7 +434,7 @@ resource "azurerm_stream_analytics_output_servicebus_queue" "import" { `, template) } -func (r StreamAnalyticsOutputServiceBusQueueResource) authenticationMode(data acceptance.TestData, identity string) string { +func (r StreamAnalyticsOutputServiceBusQueueResource) authenticationModeMsi(data acceptance.TestData, identity string) string { template := r.template(data, identity) return fmt.Sprintf(` %s @@ -445,8 +445,7 @@ resource "azurerm_stream_analytics_output_servicebus_queue" "test" { resource_group_name = azurerm_stream_analytics_job.test.resource_group_name queue_name = azurerm_servicebus_queue.test.name servicebus_namespace = azurerm_servicebus_namespace.test.name - shared_access_policy_key = azurerm_servicebus_namespace.test.default_primary_key - shared_access_policy_name = "RootManageSharedAccessKey" + authentication_mode = "Msi" serialization { type = "Json" diff --git a/internal/services/streamanalytics/stream_analytics_output_servicebus_topic_resource.go b/internal/services/streamanalytics/stream_analytics_output_servicebus_topic_resource.go index 61caa22cb084..eaacd9fca158 100644 --- a/internal/services/streamanalytics/stream_analytics_output_servicebus_topic_resource.go +++ b/internal/services/streamanalytics/stream_analytics_output_servicebus_topic_resource.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/migration" @@ -72,14 +72,14 @@ func resourceStreamAnalyticsOutputServiceBusTopic() *pluginsdk.Resource { "shared_access_policy_key": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, Sensitive: true, ValidateFunc: validation.StringIsNotEmpty, }, "shared_access_policy_name": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, ValidateFunc: validation.StringIsNotEmpty, }, @@ -145,20 +145,25 @@ func resourceStreamAnalyticsOutputServiceBusTopicCreateUpdate(d *pluginsdk.Resou } systemPropertyColumns := d.Get("system_property_columns").(map[string]interface{}) + dataSourceProperties := &outputs.ServiceBusTopicOutputDataSourceProperties{ + TopicName: utils.String(d.Get("topic_name").(string)), + ServiceBusNamespace: utils.String(d.Get("servicebus_namespace").(string)), + PropertyColumns: utils.ExpandStringSlice(d.Get("property_columns").([]interface{})), + SystemPropertyColumns: expandSystemPropertyColumns(systemPropertyColumns), + AuthenticationMode: utils.ToPtr(outputs.AuthenticationMode(d.Get("authentication_mode").(string))), + } + + // Add shared access policy key/name only if required by authentication mode + if *dataSourceProperties.AuthenticationMode == outputs.AuthenticationModeConnectionString { + dataSourceProperties.SharedAccessPolicyKey = utils.String(d.Get("shared_access_policy_key").(string)) + dataSourceProperties.SharedAccessPolicyName = utils.String(d.Get("shared_access_policy_name").(string)) + } + props := outputs.Output{ Name: utils.String(id.OutputName), Properties: &outputs.OutputProperties{ Datasource: &outputs.ServiceBusTopicOutputDataSource{ - Properties: &outputs.ServiceBusTopicOutputDataSourceProperties{ - TopicName: utils.String(d.Get("topic_name").(string)), - ServiceBusNamespace: utils.String(d.Get("servicebus_namespace").(string)), - SharedAccessPolicyKey: utils.String(d.Get("shared_access_policy_key").(string)), - SharedAccessPolicyName: utils.String(d.Get("shared_access_policy_name").(string)), - PropertyColumns: utils.ExpandStringSlice(d.Get("property_columns").([]interface{})), - SystemPropertyColumns: expandSystemPropertyColumns(systemPropertyColumns), - //SystemPropertyColumns: utils.ExpandMapStringPtrString(d.Get("system_property_columns").(map[string]interface{})), - AuthenticationMode: utils.ToPtr(outputs.AuthenticationMode(d.Get("authentication_mode").(string))), - }, + Properties: dataSourceProperties, }, Serialization: serialization, }, @@ -201,7 +206,7 @@ func resourceStreamAnalyticsOutputServiceBusTopicRead(d *pluginsdk.ResourceData, } d.Set("name", id.OutputName) - d.Set("stream_analytics_job_name", id.JobName) + d.Set("stream_analytics_job_name", id.StreamingJobName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/streamanalytics/stream_analytics_output_servicebus_topic_resource_test.go b/internal/services/streamanalytics/stream_analytics_output_servicebus_topic_resource_test.go index 13d134e279bf..1c71c2101384 100644 --- a/internal/services/streamanalytics/stream_analytics_output_servicebus_topic_resource_test.go +++ b/internal/services/streamanalytics/stream_analytics_output_servicebus_topic_resource_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -114,13 +114,13 @@ func TestAccStreamAnalyticsOutputServiceBusTopic_requiresImport(t *testing.T) { }) } -func TestAccStreamAnalyticsOutputServiceBusTopic_authenticationMode(t *testing.T) { +func TestAccStreamAnalyticsOutputServiceBusTopic_authenticationModeMsi(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_stream_analytics_output_servicebus_topic", "test") r := StreamAnalyticsOutputServiceBusTopicResource{} data.ResourceTest(t, r, []acceptance.TestStep{ { - Config: r.json(data), + Config: r.authenticationModeMsi(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), @@ -248,6 +248,28 @@ resource "azurerm_stream_analytics_output_servicebus_topic" "test" { `, template, data.RandomInteger) } +func (r StreamAnalyticsOutputServiceBusTopicResource) authenticationModeMsi(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_stream_analytics_output_servicebus_topic" "test" { + name = "acctestinput-%d" + stream_analytics_job_name = azurerm_stream_analytics_job.test.name + resource_group_name = azurerm_stream_analytics_job.test.resource_group_name + topic_name = azurerm_servicebus_topic.test.name + servicebus_namespace = azurerm_servicebus_namespace.test.name + authentication_mode = "Msi" + + serialization { + type = "Json" + encoding = "UTF8" + format = "LineSeparated" + } +} +`, template, data.RandomInteger) +} + func (r StreamAnalyticsOutputServiceBusTopicResource) propertyColumns(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` diff --git a/internal/services/streamanalytics/stream_analytics_output_synapse_resource.go b/internal/services/streamanalytics/stream_analytics_output_synapse_resource.go index 118d940ccd64..b8bd6d87eb37 100644 --- a/internal/services/streamanalytics/stream_analytics_output_synapse_resource.go +++ b/internal/services/streamanalytics/stream_analytics_output_synapse_resource.go @@ -6,7 +6,7 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/migration" @@ -172,7 +172,7 @@ func resourceStreamAnalyticsOutputSynapseRead(d *pluginsdk.ResourceData, meta in } d.Set("name", id.OutputName) - d.Set("stream_analytics_job_name", id.JobName) + d.Set("stream_analytics_job_name", id.StreamingJobName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/streamanalytics/stream_analytics_output_synapse_resource_test.go b/internal/services/streamanalytics/stream_analytics_output_synapse_resource_test.go index 274b334c3b59..0f42d1b359e2 100644 --- a/internal/services/streamanalytics/stream_analytics_output_synapse_resource_test.go +++ b/internal/services/streamanalytics/stream_analytics_output_synapse_resource_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/streamanalytics/stream_analytics_output_table_resource.go b/internal/services/streamanalytics/stream_analytics_output_table_resource.go index 671227e26d3f..276d1b6ddce6 100644 --- a/internal/services/streamanalytics/stream_analytics_output_table_resource.go +++ b/internal/services/streamanalytics/stream_analytics_output_table_resource.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -207,7 +207,7 @@ func (r OutputTableResource) Read() sdk.ResourceFunc { state := OutputTableResourceModel{ Name: id.OutputName, ResourceGroup: id.ResourceGroupName, - StreamAnalyticsJob: id.JobName, + StreamAnalyticsJob: id.StreamingJobName, StorageAccountKey: metadata.ResourceData.Get("storage_account_key").(string), } diff --git a/internal/services/streamanalytics/stream_analytics_output_table_resource_test.go b/internal/services/streamanalytics/stream_analytics_output_table_resource_test.go index 0fa4eaeb26fb..2ead1e506706 100644 --- a/internal/services/streamanalytics/stream_analytics_output_table_resource_test.go +++ b/internal/services/streamanalytics/stream_analytics_output_table_resource_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" + "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/streamanalytics/stream_analytics_reference_input_blob_resource.go b/internal/services/streamanalytics/stream_analytics_reference_input_blob_resource.go index 4d3011fa2a41..3c37c7bd0f6c 100644 --- a/internal/services/streamanalytics/stream_analytics_reference_input_blob_resource.go +++ b/internal/services/streamanalytics/stream_analytics_reference_input_blob_resource.go @@ -238,7 +238,7 @@ func resourceStreamAnalyticsReferenceInputBlobRead(d *pluginsdk.ResourceData, me } d.Set("name", id.InputName) - d.Set("stream_analytics_job_name", id.JobName) + d.Set("stream_analytics_job_name", id.StreamingJobName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/streamanalytics/stream_analytics_reference_input_mssql_resource.go b/internal/services/streamanalytics/stream_analytics_reference_input_mssql_resource.go index 66a3d8990eb4..165fa9e259b3 100644 --- a/internal/services/streamanalytics/stream_analytics_reference_input_mssql_resource.go +++ b/internal/services/streamanalytics/stream_analytics_reference_input_mssql_resource.go @@ -215,7 +215,7 @@ func resourceStreamAnalyticsReferenceInputMsSqlRead(d *pluginsdk.ResourceData, m d.SetId(id.ID()) d.Set("name", id.InputName) - d.Set("stream_analytics_job_name", id.JobName) + d.Set("stream_analytics_job_name", id.StreamingJobName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/streamanalytics/stream_analytics_stream_input_blob_resource.go b/internal/services/streamanalytics/stream_analytics_stream_input_blob_resource.go index 863effc44a2d..abed2b67fad0 100644 --- a/internal/services/streamanalytics/stream_analytics_stream_input_blob_resource.go +++ b/internal/services/streamanalytics/stream_analytics_stream_input_blob_resource.go @@ -194,7 +194,7 @@ func resourceStreamAnalyticsStreamInputBlobRead(d *pluginsdk.ResourceData, meta } d.Set("name", id.InputName) - d.Set("stream_analytics_job_name", id.JobName) + d.Set("stream_analytics_job_name", id.StreamingJobName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/streamanalytics/stream_analytics_stream_input_eventhub_resource.go b/internal/services/streamanalytics/stream_analytics_stream_input_eventhub_resource.go index e69102e2340a..e87e45f0b653 100644 --- a/internal/services/streamanalytics/stream_analytics_stream_input_eventhub_resource.go +++ b/internal/services/streamanalytics/stream_analytics_stream_input_eventhub_resource.go @@ -200,7 +200,7 @@ func resourceStreamAnalyticsStreamInputEventHubRead(d *pluginsdk.ResourceData, m } d.Set("name", id.InputName) - d.Set("stream_analytics_job_name", id.JobName) + d.Set("stream_analytics_job_name", id.StreamingJobName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/streamanalytics/stream_analytics_stream_input_eventhub_v2_resource.go b/internal/services/streamanalytics/stream_analytics_stream_input_eventhub_v2_resource.go index 6c2a76f07a53..d1876b6b092d 100644 --- a/internal/services/streamanalytics/stream_analytics_stream_input_eventhub_v2_resource.go +++ b/internal/services/streamanalytics/stream_analytics_stream_input_eventhub_v2_resource.go @@ -138,7 +138,7 @@ func (r StreamInputEventHubV2Resource) Create() sdk.ResourceFunc { if err != nil { return err } - id := inputs.NewInputID(subscriptionId, streamingJobStruct.ResourceGroupName, streamingJobStruct.JobName, model.Name) + id := inputs.NewInputID(subscriptionId, streamingJobStruct.ResourceGroupName, streamingJobStruct.StreamingJobName, model.Name) existing, err := client.Get(ctx, id) if err != nil && !response.WasNotFound(existing.HttpResponse) { @@ -262,7 +262,7 @@ func (r StreamInputEventHubV2Resource) Read() sdk.ResourceFunc { return fmt.Errorf("reading %s: %+v", *id, err) } - streamingJobId := streamingjobs.NewStreamingJobID(id.SubscriptionId, id.ResourceGroupName, id.JobName) + streamingJobId := streamingjobs.NewStreamingJobID(id.SubscriptionId, id.ResourceGroupName, id.StreamingJobName) state := StreamInputEventHubV2ResourceModel{ Name: id.InputName, diff --git a/internal/services/streamanalytics/stream_analytics_stream_input_iothub_resource.go b/internal/services/streamanalytics/stream_analytics_stream_input_iothub_resource.go index 7b621cd73ebd..73b8a6117993 100644 --- a/internal/services/streamanalytics/stream_analytics_stream_input_iothub_resource.go +++ b/internal/services/streamanalytics/stream_analytics_stream_input_iothub_resource.go @@ -182,7 +182,7 @@ func resourceStreamAnalyticsStreamInputIoTHubRead(d *pluginsdk.ResourceData, met } d.Set("name", id.InputName) - d.Set("stream_analytics_job_name", id.JobName) + d.Set("stream_analytics_job_name", id.StreamingJobName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/synapse/synapse_linked_service_resource.go b/internal/services/synapse/synapse_linked_service_resource.go index 70afda295322..d9e6c170fc61 100644 --- a/internal/services/synapse/synapse_linked_service_resource.go +++ b/internal/services/synapse/synapse_linked_service_resource.go @@ -235,13 +235,17 @@ func resourceSynapseLinkedServiceCreateUpdate(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() environment := meta.(*clients.Client).Account.Environment + synapseDomainSuffix, ok := environment.Synapse.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Synapse domain suffix for environment %q", environment.Name) + } workspaceId, err := parse.WorkspaceID(d.Get("synapse_workspace_id").(string)) if err != nil { return err } - client, err := synapseClient.LinkedServiceClient(workspaceId.Name, environment.SynapseEndpointSuffix) + client, err := synapseClient.LinkedServiceClient(workspaceId.Name, *synapseDomainSuffix) if err != nil { return err } @@ -323,13 +327,17 @@ func resourceSynapseLinkedServiceRead(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() environment := meta.(*clients.Client).Account.Environment + synapseDomainSuffix, ok := environment.Synapse.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Synapse domain suffix for environment %q", environment.Name) + } id, err := parse.LinkedServiceID(d.Id()) if err != nil { return err } - client, err := synapseClient.LinkedServiceClient(id.WorkspaceName, environment.SynapseEndpointSuffix) + client, err := synapseClient.LinkedServiceClient(id.WorkspaceName, *synapseDomainSuffix) if err != nil { return err } @@ -428,13 +436,17 @@ func resourceSynapseLinkedServiceDelete(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() environment := meta.(*clients.Client).Account.Environment + synapseDomainSuffix, ok := environment.Synapse.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Synapse domain suffix for environment %q", environment.Name) + } id, err := parse.LinkedServiceID(d.Id()) if err != nil { return err } - client, err := synapseClient.LinkedServiceClient(id.WorkspaceName, environment.SynapseEndpointSuffix) + client, err := synapseClient.LinkedServiceClient(id.WorkspaceName, *synapseDomainSuffix) if err != nil { return err } diff --git a/internal/services/synapse/synapse_linked_service_resource_test.go b/internal/services/synapse/synapse_linked_service_resource_test.go index 841c67011b1c..e0c6ce681e10 100644 --- a/internal/services/synapse/synapse_linked_service_resource_test.go +++ b/internal/services/synapse/synapse_linked_service_resource_test.go @@ -125,8 +125,12 @@ func (t LinkedServiceResource) Exists(ctx context.Context, clients *clients.Clie return nil, err } - environment := clients.Account.Environment - client, err := clients.Synapse.LinkedServiceClient(id.WorkspaceName, environment.SynapseEndpointSuffix) + suffix, ok := clients.Account.Environment.Synapse.DomainSuffix() + if !ok { + return nil, fmt.Errorf("could not determine Synapse domain suffix for environment %q", clients.Account.Environment.Name) + } + + client, err := clients.Synapse.LinkedServiceClient(id.WorkspaceName, *suffix) if err != nil { return nil, err } diff --git a/internal/services/synapse/synapse_managed_private_endpoint_resource.go b/internal/services/synapse/synapse_managed_private_endpoint_resource.go index 7f4d0ffda099..6308adfb961e 100644 --- a/internal/services/synapse/synapse_managed_private_endpoint_resource.go +++ b/internal/services/synapse/synapse_managed_private_endpoint_resource.go @@ -73,6 +73,10 @@ func resourceSynapseManagedPrivateEndpointCreate(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() environment := meta.(*clients.Client).Account.Environment + synapseDomainSuffix, ok := environment.Synapse.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Synapse domain suffix for environment %q", environment.Name) + } workspaceId, err := parse.WorkspaceID(d.Get("synapse_workspace_id").(string)) if err != nil { @@ -89,7 +93,7 @@ func resourceSynapseManagedPrivateEndpointCreate(d *pluginsdk.ResourceData, meta virtualNetworkName := *workspace.WorkspaceProperties.ManagedVirtualNetwork id := parse.NewManagedPrivateEndpointID(workspaceId.SubscriptionId, workspaceId.ResourceGroup, workspaceId.Name, virtualNetworkName, d.Get("name").(string)) - client, err := synapseClient.ManagedPrivateEndpointsClient(workspaceId.Name, environment.SynapseEndpointSuffix) + client, err := synapseClient.ManagedPrivateEndpointsClient(workspaceId.Name, *synapseDomainSuffix) if err != nil { return fmt.Errorf("building Client for %s: %+v", id, err) } @@ -124,13 +128,17 @@ func resourceSynapseManagedPrivateEndpointRead(d *pluginsdk.ResourceData, meta i ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() environment := meta.(*clients.Client).Account.Environment + synapseDomainSuffix, ok := environment.Synapse.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Synapse domain suffix for environment %q", environment.Name) + } id, err := parse.ManagedPrivateEndpointID(d.Id()) if err != nil { return err } - client, err := synapseClient.ManagedPrivateEndpointsClient(id.WorkspaceName, environment.SynapseEndpointSuffix) + client, err := synapseClient.ManagedPrivateEndpointsClient(id.WorkspaceName, *synapseDomainSuffix) if err != nil { return fmt.Errorf("building Client for %s: %v", *id, err) } @@ -161,13 +169,17 @@ func resourceSynapseManagedPrivateEndpointDelete(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() environment := meta.(*clients.Client).Account.Environment + synapseDomainSuffix, ok := environment.Synapse.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Synapse domain suffix for environment %q", environment.Name) + } id, err := parse.ManagedPrivateEndpointID(d.Id()) if err != nil { return err } - client, err := synapseClient.ManagedPrivateEndpointsClient(id.WorkspaceName, environment.SynapseEndpointSuffix) + client, err := synapseClient.ManagedPrivateEndpointsClient(id.WorkspaceName, *synapseDomainSuffix) if err != nil { return fmt.Errorf("building Client for %s: %v", *id, err) } diff --git a/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go b/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go index 571bb9c9dcc5..6afd98458998 100644 --- a/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go +++ b/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go @@ -51,8 +51,12 @@ func (r SynapseManagedPrivateEndpointResource) Exists(ctx context.Context, clien return nil, err } - environment := client.Account.Environment - managedPrivateEndpointsClient, err := client.Synapse.ManagedPrivateEndpointsClient(id.WorkspaceName, environment.SynapseEndpointSuffix) + suffix, ok := client.Account.Environment.Synapse.DomainSuffix() + if !ok { + return nil, fmt.Errorf("could not determine Synapse domain suffix for environment %q", client.Account.Environment.Name) + } + + managedPrivateEndpointsClient, err := client.Synapse.ManagedPrivateEndpointsClient(id.WorkspaceName, *suffix) if err != nil { return nil, err } diff --git a/internal/services/synapse/synapse_role_assignment_resource.go b/internal/services/synapse/synapse_role_assignment_resource.go index 5007995386e5..2380a6cf2532 100644 --- a/internal/services/synapse/synapse_role_assignment_resource.go +++ b/internal/services/synapse/synapse_role_assignment_resource.go @@ -96,7 +96,11 @@ func resourceSynapseRoleAssignmentCreate(d *pluginsdk.ResourceData, meta interfa synapseClient := meta.(*clients.Client).Synapse ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - environment := meta.(*clients.Client).Account.Environment + env := meta.(*clients.Client).Account.Environment + synapseDomainSuffix, ok := env.Synapse.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine the domain suffix for synapse in environment %q: %+v", env.Name, env.Storage) + } synapseScope := "" if v, ok := d.GetOk("synapse_workspace_id"); ok { @@ -110,11 +114,11 @@ func resourceSynapseRoleAssignmentCreate(d *pluginsdk.ResourceData, meta interfa return err } - client, err := synapseClient.RoleAssignmentsClient(workspaceName, environment.SynapseEndpointSuffix) + client, err := synapseClient.RoleAssignmentsClient(workspaceName, *synapseDomainSuffix) if err != nil { return err } - roleDefinitionsClient, err := synapseClient.RoleDefinitionsClient(workspaceName, environment.SynapseEndpointSuffix) + roleDefinitionsClient, err := synapseClient.RoleDefinitionsClient(workspaceName, *synapseDomainSuffix) if err != nil { return err } @@ -176,7 +180,12 @@ func resourceSynapseRoleAssignmentRead(d *pluginsdk.ResourceData, meta interface synapseClient := meta.(*clients.Client).Synapse ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - environment := meta.(*clients.Client).Account.Environment + + env := meta.(*clients.Client).Account.Environment + synapseDomainSuffix, ok := env.Synapse.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine the domain suffix for synapse in environment %q: %+v", env.Name, env.Storage) + } id, err := parse.RoleAssignmentID(d.Id()) if err != nil { @@ -188,11 +197,11 @@ func resourceSynapseRoleAssignmentRead(d *pluginsdk.ResourceData, meta interface return err } - client, err := synapseClient.RoleAssignmentsClient(workspaceName, environment.SynapseEndpointSuffix) + client, err := synapseClient.RoleAssignmentsClient(workspaceName, *synapseDomainSuffix) if err != nil { return err } - roleDefinitionsClient, err := synapseClient.RoleDefinitionsClient(workspaceName, environment.SynapseEndpointSuffix) + roleDefinitionsClient, err := synapseClient.RoleDefinitionsClient(workspaceName, *synapseDomainSuffix) if err != nil { return err } @@ -238,7 +247,11 @@ func resourceSynapseRoleAssignmentDelete(d *pluginsdk.ResourceData, meta interfa synapseClient := meta.(*clients.Client).Synapse ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - environment := meta.(*clients.Client).Account.Environment + env := meta.(*clients.Client).Account.Environment + synapseDomainSuffix, ok := env.Synapse.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine the domain suffix for synapse in environment %q: %+v", env.Name, env.Storage) + } id, err := parse.RoleAssignmentID(d.Id()) if err != nil { @@ -250,7 +263,7 @@ func resourceSynapseRoleAssignmentDelete(d *pluginsdk.ResourceData, meta interfa return err } - client, err := synapseClient.RoleAssignmentsClient(workspaceName, environment.SynapseEndpointSuffix) + client, err := synapseClient.RoleAssignmentsClient(workspaceName, *synapseDomainSuffix) if err != nil { return err } diff --git a/internal/services/synapse/synapse_role_assignment_resource_test.go b/internal/services/synapse/synapse_role_assignment_resource_test.go index 22a2a69a6e5f..8def0caff604 100644 --- a/internal/services/synapse/synapse_role_assignment_resource_test.go +++ b/internal/services/synapse/synapse_role_assignment_resource_test.go @@ -71,8 +71,13 @@ func (r SynapseRoleAssignmentResource) Exists(ctx context.Context, client *clien return nil, err } - environment := client.Account.Environment - roleAssignmentsClient, err := client.Synapse.RoleAssignmentsClient(workspaceName, environment.SynapseEndpointSuffix) + env := client.Account.Environment + suffix, ok := env.Synapse.DomainSuffix() + if !ok { + return nil, fmt.Errorf("could not determine the domain suffix for synapse in environment %q: %+v", env.Name, env.Storage) + } + + roleAssignmentsClient, err := client.Synapse.RoleAssignmentsClient(workspaceName, *suffix) if err != nil { return nil, err } diff --git a/internal/services/synapse/synapse_sql_pool_resource_test.go b/internal/services/synapse/synapse_sql_pool_resource_test.go index fbbe373fdd48..0c8acb96af6a 100644 --- a/internal/services/synapse/synapse_sql_pool_resource_test.go +++ b/internal/services/synapse/synapse_sql_pool_resource_test.go @@ -272,10 +272,10 @@ provider "azurerm" { %s resource "azurerm_synapse_sql_pool" "test" { - name = "acctestSP%s" - synapse_workspace_id = azurerm_synapse_workspace.test.id - sku_name = "DW100c" - create_mode = "Default" + name = "acctestSP%s" + synapse_workspace_id = azurerm_synapse_workspace.test.id + sku_name = "DW100c" + create_mode = "Default" geo_backup_policy_enabled = false } `, template, data.RandomString) @@ -291,10 +291,10 @@ provider "azurerm" { %s resource "azurerm_synapse_sql_pool" "test" { - name = "acctestSP%s" - synapse_workspace_id = azurerm_synapse_workspace.test.id - sku_name = "DW100c" - create_mode = "Default" + name = "acctestSP%s" + synapse_workspace_id = azurerm_synapse_workspace.test.id + sku_name = "DW100c" + create_mode = "Default" geo_backup_policy_enabled = true } `, template, data.RandomString) diff --git a/internal/services/trafficmanager/azure_endpoint_resource.go b/internal/services/trafficmanager/azure_endpoint_resource.go index 311c08de7884..0f0ced979cd1 100644 --- a/internal/services/trafficmanager/azure_endpoint_resource.go +++ b/internal/services/trafficmanager/azure_endpoint_resource.go @@ -148,7 +148,7 @@ func resourceAzureEndpointCreateUpdate(d *pluginsdk.ResourceData, meta interface return fmt.Errorf("parsing `profile_id`: %+v", err) } - id := endpoints.NewEndpointTypeID(profileId.SubscriptionId, profileId.ResourceGroupName, profileId.ProfileName, endpoints.EndpointTypeAzureEndpoints, d.Get("name").(string)) + id := endpoints.NewEndpointTypeID(profileId.SubscriptionId, profileId.ResourceGroupName, profileId.TrafficManagerProfileName, endpoints.EndpointTypeAzureEndpoints, d.Get("name").(string)) if d.IsNewResource() { existing, err := client.Get(ctx, id) if err != nil { @@ -223,7 +223,7 @@ func resourceAzureEndpointRead(d *pluginsdk.ResourceData, meta interface{}) erro } d.Set("name", id.EndpointName) - d.Set("profile_id", profiles.NewTrafficManagerProfileID(id.SubscriptionId, id.ResourceGroupName, id.ProfileName).ID()) + d.Set("profile_id", profiles.NewTrafficManagerProfileID(id.SubscriptionId, id.ResourceGroupName, id.TrafficManagerProfileName).ID()) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/trafficmanager/external_endpoint_resource.go b/internal/services/trafficmanager/external_endpoint_resource.go index ce759b9ed30e..ae3223d58a02 100644 --- a/internal/services/trafficmanager/external_endpoint_resource.go +++ b/internal/services/trafficmanager/external_endpoint_resource.go @@ -156,7 +156,7 @@ func resourceExternalEndpointCreateUpdate(d *pluginsdk.ResourceData, meta interf return fmt.Errorf("parsing `profile_id`: %+v", err) } - id := endpoints.NewEndpointTypeID(profileId.SubscriptionId, profileId.ResourceGroupName, profileId.ProfileName, endpoints.EndpointTypeExternalEndpoints, d.Get("name").(string)) + id := endpoints.NewEndpointTypeID(profileId.SubscriptionId, profileId.ResourceGroupName, profileId.TrafficManagerProfileName, endpoints.EndpointTypeExternalEndpoints, d.Get("name").(string)) if d.IsNewResource() { existing, err := client.Get(ctx, id) if err != nil { @@ -235,7 +235,7 @@ func resourceExternalEndpointRead(d *pluginsdk.ResourceData, meta interface{}) e } d.Set("name", id.EndpointName) - d.Set("profile_id", profiles.NewTrafficManagerProfileID(id.SubscriptionId, id.ResourceGroupName, id.ProfileName).ID()) + d.Set("profile_id", profiles.NewTrafficManagerProfileID(id.SubscriptionId, id.ResourceGroupName, id.TrafficManagerProfileName).ID()) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/trafficmanager/nested_endpoint_resource.go b/internal/services/trafficmanager/nested_endpoint_resource.go index 0c88213af08e..0a3dcf96bd05 100644 --- a/internal/services/trafficmanager/nested_endpoint_resource.go +++ b/internal/services/trafficmanager/nested_endpoint_resource.go @@ -173,7 +173,7 @@ func resourceNestedEndpointCreateUpdate(d *pluginsdk.ResourceData, meta interfac return fmt.Errorf("parsing `profile_id`: %+v", err) } - id := endpoints.NewEndpointTypeID(profileId.SubscriptionId, profileId.ResourceGroupName, profileId.ProfileName, endpoints.EndpointTypeNestedEndpoints, d.Get("name").(string)) + id := endpoints.NewEndpointTypeID(profileId.SubscriptionId, profileId.ResourceGroupName, profileId.TrafficManagerProfileName, endpoints.EndpointTypeNestedEndpoints, d.Get("name").(string)) if d.IsNewResource() { existing, err := client.Get(ctx, id) @@ -264,7 +264,7 @@ func resourceNestedEndpointRead(d *pluginsdk.ResourceData, meta interface{}) err } d.Set("name", id.EndpointName) - d.Set("profile_id", profiles.NewTrafficManagerProfileID(id.SubscriptionId, id.ResourceGroupName, id.ProfileName).ID()) + d.Set("profile_id", profiles.NewTrafficManagerProfileID(id.SubscriptionId, id.ResourceGroupName, id.TrafficManagerProfileName).ID()) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/internal/services/trafficmanager/traffic_manager_profile_resource.go b/internal/services/trafficmanager/traffic_manager_profile_resource.go index 3e2849f64a01..288b279d0a60 100644 --- a/internal/services/trafficmanager/traffic_manager_profile_resource.go +++ b/internal/services/trafficmanager/traffic_manager_profile_resource.go @@ -215,7 +215,7 @@ func resourceArmTrafficManagerProfileCreate(d *pluginsdk.ResourceData, meta inte trafficRoutingMethod := profiles.TrafficRoutingMethod(d.Get("traffic_routing_method").(string)) // No existing profile - start from a new struct. profile := profiles.Profile{ - Name: utils.String(id.ProfileName), + Name: utils.String(id.TrafficManagerProfileName), Location: utils.String("global"), // must be provided in request Properties: &profiles.ProfileProperties{ TrafficRoutingMethod: &trafficRoutingMethod, @@ -276,7 +276,7 @@ func resourceArmTrafficManagerProfileRead(d *pluginsdk.ResourceData, meta interf return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.ProfileName) + d.Set("name", id.TrafficManagerProfileName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { diff --git a/internal/services/videoanalyzer/video_analyzer_edge_module_resource.go b/internal/services/videoanalyzer/video_analyzer_edge_module_resource.go index c6471de61ded..a673715955de 100644 --- a/internal/services/videoanalyzer/video_analyzer_edge_module_resource.go +++ b/internal/services/videoanalyzer/video_analyzer_edge_module_resource.go @@ -109,7 +109,7 @@ func resourceVideoAnalyzerEdgeModuleRead(d *pluginsdk.ResourceData, meta interfa d.Set("name", id.EdgeModuleName) d.Set("resource_group_name", id.ResourceGroupName) - d.Set("video_analyzer_name", id.AccountName) + d.Set("video_analyzer_name", id.VideoAnalyzerName) return nil } diff --git a/internal/services/videoanalyzer/video_analyzer_resource.go b/internal/services/videoanalyzer/video_analyzer_resource.go index 3b617c0d6dce..926b48bf38b6 100644 --- a/internal/services/videoanalyzer/video_analyzer_resource.go +++ b/internal/services/videoanalyzer/video_analyzer_resource.go @@ -143,21 +143,20 @@ func resourceVideoAnalyzerRead(d *pluginsdk.ResourceData, meta interface{}) erro return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.AccountName) + d.Set("name", id.VideoAnalyzerName) d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { d.Set("location", azure.NormalizeLocation(model.Location)) - props := resp.Model.Properties - if props != nil { + if props := model.Properties; props != nil { accounts := flattenVideoAnalyzerStorageAccounts(props.StorageAccounts) if err := d.Set("storage_account", accounts); err != nil { return fmt.Errorf("flattening `storage_account`: %s", err) } } - flattenedIdentity, err := flattenAzureRmVideoServiceIdentity(resp.Model.Identity) + flattenedIdentity, err := flattenAzureRmVideoServiceIdentity(model.Identity) if err != nil { return fmt.Errorf("flattening `identity`: %s", err) } diff --git a/internal/services/vmware/vmware_private_cloud_netapp_file_volume_attachment_resource.go b/internal/services/vmware/vmware_private_cloud_netapp_file_volume_attachment_resource.go index 2e2b9d063e76..bfb915a807d9 100644 --- a/internal/services/vmware/vmware_private_cloud_netapp_file_volume_attachment_resource.go +++ b/internal/services/vmware/vmware_private_cloud_netapp_file_volume_attachment_resource.go @@ -141,7 +141,7 @@ func (r NetappFileVolumeAttachmentResource) Read() sdk.ResourceFunc { } } return metadata.Encode(&NetappFileVolumeAttachment{ - Name: id.DatastoreName, + Name: id.DataStoreName, NetAppVolumeId: netAppVolumeId, VmwareClusterId: clusterId.ID(), }) diff --git a/internal/services/web/app_service_certificate_resource.go b/internal/services/web/app_service_certificate_resource.go index b1ca0b15df70..c2e0281f2153 100644 --- a/internal/services/web/app_service_certificate_resource.go +++ b/internal/services/web/app_service_certificate_resource.go @@ -159,6 +159,13 @@ func resourceAppServiceCertificateRead(d *pluginsdk.ResourceData, meta interface d.Set("subject_name", props.SubjectName) d.Set("host_names", props.HostNames) d.Set("issuer", props.Issuer) + if props.HostingEnvironmentProfile != nil && props.HostingEnvironmentProfile.ID != nil { + envId, err := parse.AppServiceEnvironmentID(*props.HostingEnvironmentProfile.ID) + if err != nil { + return fmt.Errorf("parsing hosting environment error: %+v", err) + } + d.Set("hosting_environment_profile_id", envId.ID()) + } issueDate := "" if props.IssueDate != nil { issueDate = props.IssueDate.Format(time.RFC3339) @@ -278,6 +285,11 @@ func resourceAppServiceCertificateSchema() map[string]*pluginsdk.Schema { Computed: true, }, + "hosting_environment_profile_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "tags": tags.Schema(), } } diff --git a/internal/services/web/app_service_environment_v3_data_source.go b/internal/services/web/app_service_environment_v3_data_source.go index 21de99b8be9a..91dfef4fbe75 100644 --- a/internal/services/web/app_service_environment_v3_data_source.go +++ b/internal/services/web/app_service_environment_v3_data_source.go @@ -187,7 +187,7 @@ func (r AppServiceEnvironmentV3DataSource) Read() sdk.ResourceFunc { existing, err := client.Get(ctx, id.ResourceGroup, id.HostingEnvironmentName) if err != nil { if utils.ResponseWasNotFound(existing.Response) { - return metadata.MarkAsGone(id) + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } diff --git a/internal/services/web/app_service_public_certificate_resource.go b/internal/services/web/app_service_public_certificate_resource.go index 8a77fd38ed92..1afb631199a8 100644 --- a/internal/services/web/app_service_public_certificate_resource.go +++ b/internal/services/web/app_service_public_certificate_resource.go @@ -6,7 +6,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" // nolint: staticcheck + "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/web/app_service_slot_virtual_network_swift_connection_resource.go b/internal/services/web/app_service_slot_virtual_network_swift_connection_resource.go index 41cdb441a237..f5347bcda96f 100644 --- a/internal/services/web/app_service_slot_virtual_network_swift_connection_resource.go +++ b/internal/services/web/app_service_slot_virtual_network_swift_connection_resource.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - azureNetwork "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + azureNetwork "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceAppServiceSlotVirtualNetworkSwiftConnection() *pluginsdk.Resource { diff --git a/internal/services/web/app_service_virtual_network_swift_connection_resource.go b/internal/services/web/app_service_virtual_network_swift_connection_resource.go index 00120605669d..7e36f51f0432 100644 --- a/internal/services/web/app_service_virtual_network_swift_connection_resource.go +++ b/internal/services/web/app_service_virtual_network_swift_connection_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - azureNetwork "github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network" + azureNetwork "github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network" ) func resourceAppServiceVirtualNetworkSwiftConnection() *pluginsdk.Resource { diff --git a/internal/services/web/function_app_resource.go b/internal/services/web/function_app_resource.go index 8ea5b2b181e3..e0283f7f281c 100644 --- a/internal/services/web/function_app_resource.go +++ b/internal/services/web/function_app_resource.go @@ -242,10 +242,14 @@ func resourceFunctionApp() *pluginsdk.Resource { func resourceFunctionAppCreate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Web.AppServicesClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId - endpointSuffix := meta.(*clients.Client).Account.Environment.StorageEndpointSuffix ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() + storageDomainSuffix, ok := meta.(*clients.Client).Account.Environment.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Storage domain suffix for environment %q", meta.(*clients.Client).Account.Environment.Name) + } + log.Printf("[INFO] preparing arguments for AzureRM Function App creation.") id := parse.NewFunctionAppID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) @@ -295,7 +299,7 @@ func resourceFunctionAppCreate(d *pluginsdk.ResourceData, meta interface{}) erro return err } - basicAppSettings, err := getBasicFunctionAppAppSettings(d, appServiceTier, endpointSuffix, nil) + basicAppSettings, err := getBasicFunctionAppAppSettings(d, appServiceTier, *storageDomainSuffix, nil) if err != nil { return err } @@ -385,10 +389,14 @@ func resourceFunctionAppCreate(d *pluginsdk.ResourceData, meta interface{}) erro func resourceFunctionAppUpdate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Web.AppServicesClient - endpointSuffix := meta.(*clients.Client).Account.Environment.StorageEndpointSuffix ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() + storageDomainSuffix, ok := meta.(*clients.Client).Account.Environment.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Storage domain suffix for environment %q", meta.(*clients.Client).Account.Environment.Name) + } + id, err := parse.FunctionAppID(d.Id()) if err != nil { return err @@ -424,7 +432,7 @@ func resourceFunctionAppUpdate(d *pluginsdk.ResourceData, meta interface{}) erro currentAppSettings = appSettingsList.Properties } - basicAppSettings, err := getBasicFunctionAppAppSettings(d, appServiceTier, endpointSuffix, currentAppSettings) + basicAppSettings, err := getBasicFunctionAppAppSettings(d, appServiceTier, *storageDomainSuffix, currentAppSettings) if err != nil { return err } diff --git a/internal/services/web/function_app_slot_resource.go b/internal/services/web/function_app_slot_resource.go index e0696e915387..f5da0048e7b0 100644 --- a/internal/services/web/function_app_slot_resource.go +++ b/internal/services/web/function_app_slot_resource.go @@ -220,10 +220,14 @@ func resourceFunctionAppSlot() *pluginsdk.Resource { func resourceFunctionAppSlotCreate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Web.AppServicesClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId - endpointSuffix := meta.(*clients.Client).Account.Environment.StorageEndpointSuffix ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() + storageDomainSuffix, ok := meta.(*clients.Client).Account.Environment.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Storage domain suffix for environment %q", meta.(*clients.Client).Account.Environment.Name) + } + log.Printf("[INFO] preparing arguments for AzureRM Function App Slot creation.") id := parse.NewFunctionAppSlotID(subscriptionId, d.Get("resource_group_name").(string), d.Get("function_app_name").(string), d.Get("name").(string)) @@ -260,7 +264,7 @@ func resourceFunctionAppSlotCreate(d *pluginsdk.ResourceData, meta interface{}) return err } - basicAppSettings := getBasicFunctionAppSlotAppSettings(d, appServiceTier, endpointSuffix, nil) + basicAppSettings := getBasicFunctionAppSlotAppSettings(d, appServiceTier, *storageDomainSuffix, nil) siteConfig, err := expandFunctionAppSiteConfig(d) if err != nil { @@ -319,10 +323,14 @@ func resourceFunctionAppSlotCreate(d *pluginsdk.ResourceData, meta interface{}) func resourceFunctionAppSlotUpdate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Web.AppServicesClient - endpointSuffix := meta.(*clients.Client).Account.Environment.StorageEndpointSuffix ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() + storageDomainSuffix, ok := meta.(*clients.Client).Account.Environment.Storage.DomainSuffix() + if !ok { + return fmt.Errorf("could not determine Storage domain suffix for environment %q", meta.(*clients.Client).Account.Environment.Name) + } + id, err := parse.FunctionAppSlotID(d.Id()) if err != nil { return err @@ -356,7 +364,7 @@ func resourceFunctionAppSlotUpdate(d *pluginsdk.ResourceData, meta interface{}) currentAppSettings = appSettingsList.Properties } - basicAppSettings := getBasicFunctionAppSlotAppSettings(d, appServiceTier, endpointSuffix, currentAppSettings) + basicAppSettings := getBasicFunctionAppSlotAppSettings(d, appServiceTier, *storageDomainSuffix, currentAppSettings) siteConfig, err := expandFunctionAppSiteConfig(d) if err != nil { diff --git a/internal/services/web/resourceids.go b/internal/services/web/resourceids.go index 5972312a436d..91592d03999a 100644 --- a/internal/services/web/resourceids.go +++ b/internal/services/web/resourceids.go @@ -2,7 +2,6 @@ package web //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AppService -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AppServiceEnvironment -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/hostingEnvironments/hostingEnvironment1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AppServicePlan -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/serverfarms/farm1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AppServiceSlot -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1/slots/slot1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AppServiceSlotCustomHostnameBinding -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1/slots/slot1/hostNameBindings/binding1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Certificate -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/certificates/certificate1 @@ -17,3 +16,6 @@ package web //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=StaticSite -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Web/staticSites/my-static-site1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=StaticSiteCustomDomain -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Web/staticSites/my-static-site1/customDomains/name.contoso.com //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=VirtualNetworkSwiftConnection -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/sites/site1/config/virtualNetwork + +// @tombuildsstuff: this is going to require a State Migration to account for `serverfarms` -> `serverFarms` prior to migrating to `hashicorp/go-azure-sdk` +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AppServicePlan -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Web/serverfarms/farm1 diff --git a/internal/services/web/static_site_resource.go b/internal/services/web/static_site_resource.go index 4d5bc310c3a4..885e8681556a 100644 --- a/internal/services/web/static_site_resource.go +++ b/internal/services/web/static_site_resource.go @@ -79,8 +79,9 @@ func resourceStaticSite() *pluginsdk.Resource { "identity": commonschema.SystemAssignedUserAssignedIdentityOptional(), "api_key": { - Type: pluginsdk.TypeString, - Computed: true, + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, }, "tags": tags.Schema(), diff --git a/internal/tf/pluginsdk/resource.go b/internal/tf/pluginsdk/resource.go index c759374b1d6c..ed6ee26ae649 100644 --- a/internal/tf/pluginsdk/resource.go +++ b/internal/tf/pluginsdk/resource.go @@ -1,8 +1,8 @@ package pluginsdk import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) // This file is intended to provide a transition from Plugin SDKv1 to Plugin SDKv2 diff --git a/internal/tf/pluginsdk/retries.go b/internal/tf/pluginsdk/retries.go index 4ad6f4dbe203..8b98e8520835 100644 --- a/internal/tf/pluginsdk/retries.go +++ b/internal/tf/pluginsdk/retries.go @@ -3,7 +3,7 @@ package pluginsdk import ( "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) // TODO: work through and switch these out for WaitForState funcs diff --git a/internal/tf/pluginsdk/tests.go b/internal/tf/pluginsdk/tests.go index 35df55c60e74..ae2c9ad89f66 100644 --- a/internal/tf/pluginsdk/tests.go +++ b/internal/tf/pluginsdk/tests.go @@ -1,10 +1,12 @@ package pluginsdk import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) type TestCheckFunc = resource.TestCheckFunc type InstanceState = terraform.InstanceState + +type State = terraform.State diff --git a/scripts/run-gradually-deprecated.sh b/scripts/run-gradually-deprecated.sh index bb3e44f9d8e6..14a41fbef7b7 100755 --- a/scripts/run-gradually-deprecated.sh +++ b/scripts/run-gradually-deprecated.sh @@ -72,30 +72,36 @@ function runGraduallyDeprecatedFunctions { } fi - # check for d.Get inside Delete - deleteFuncName=$(grep -o "Delete: .*," "$f" -m1 | grep -o " .*Delete"| tr -d " ") - if [ "$deleteFuncName" != "" ]; + # avoid false positives + isThisScript=$(echo "$f" | grep "run-gradually-deprecated") + if [ "$isThisScript" == "" ]; then - deleteMethod=$(cat -n $f | sed -n -e "/func $deleteFuncName.*$/,/[[:digit:]]*\treturn nil/{ /func $deleteFuncName$/d; /[[:digit:]]*\treturn nil/d; p; }") - foundGet=$(echo "$deleteMethod" | grep "d\.Get(.*)" -m1) - if [ "$foundGet" != "" ]; + # check for d.Get inside Delete + deleteFuncName=$(grep -o "Delete: .*," "$f" -m1 | grep -o " .*Delete"| tr -d " ") + if [ "$deleteFuncName" != "" ]; then - echo "$f $foundGet" - echo "Please do not use 'd.Get' within the Delete function as this does not work as expected in Delete" - exit 1 - fi - else - # check for Get in typed resource - deleteFuncName=" Delete() sdk.ResourceFunc " - deleteMethod=$(cat -n $f | sed -n -e "/$deleteFuncName.*$/,/[[:digit:]]*\t\t\treturn nil/{ /$deleteFuncName.*$/d; /[[:digit:]]*\t\t\treturn nil/d; p; }") - foundGet=$(echo "$deleteMethod" | grep "metadata.ResourceData.Get" -m1) - if [ "$foundGet" != "" ]; - then - echo "$f $foundGet" - echo "Please do not use 'metadata.ResourceData.Get' within the Delete function as this does not work as expected in Delete" - exit 1 - fi + deleteMethod=$(cat -n $f | sed -n -e "/func $deleteFuncName.*$/,/[[:digit:]]*\treturn nil/{ /func $deleteFuncName$/d; /[[:digit:]]*\treturn nil/d; p; }") + foundGet=$(echo "$deleteMethod" | grep "d\.Get(.*)" -m1) + if [ "$foundGet" != "" ]; + then + echo "$f $foundGet" + echo "Please do not use 'd.Get' within the Delete function as this does not work as expected in Delete" + exit 1 + fi + else + # check for Get in typed resource + deleteFuncName=" Delete() sdk.ResourceFunc " + deleteMethod=$(cat -n $f | sed -n -e "/$deleteFuncName.*$/,/[[:digit:]]*\t\t\treturn nil/{ /$deleteFuncName.*$/d; /[[:digit:]]*\t\t\treturn nil/d; p; }") + foundGet=$(echo "$deleteMethod" | grep "metadata.ResourceData.Get" -m1) + if [ "$foundGet" != "" ]; + then + echo "$f $foundGet" + echo "Please do not use 'metadata.ResourceData.Get' within the Delete function as this does not work as expected in Delete" + exit 1 + fi + fi fi + done } @@ -115,7 +121,7 @@ function checkForUnclearErrorMessages { function runDeprecatedFunctions { echo "==> Checking for use of deprecated functions..." - result=$(grep -Ril "d.setid(\"\")" ./internal/services/**/data_source_*.go) + result=$(grep -Ril "d.setid(\"\")" ./internal/services/**/*data_source*.go) if [ "$result" != "" ]; then echo "Data Sources should return an error when a resource cannot be found rather than" @@ -124,6 +130,19 @@ function runDeprecatedFunctions { echo "Please remove the references to 'd.SetId("") from the Data Sources listed below" echo "and raise an error instead:" echo "" + echo "$result" + exit 1 + fi + result=$(grep -Ril "markasgone" ./internal/services/**/*data_source*.go) + if [ "$result" != "" ]; + then + echo "Data Sources should return an error when a resource cannot be found rather than" + echo "marking the resource as gone." + echo "" + echo "Please remove the references to 'metadata.MarkAsGone' from the Data Sources listed below" + echo "and raise an error instead:" + echo "" + echo "$result" exit 1 fi } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/_meta.json deleted file mode 100644 index fd8e0a2af323..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "162460648e39b3cd20ef3d302008add138e90223", - "readme": "/_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", - "tag": "package-2022-01", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2022-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/account.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/account.go deleted file mode 100644 index 85e1bf96682f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/account.go +++ /dev/null @@ -1,1224 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AccountClient is the batch Client -type AccountClient struct { - BaseClient -} - -// NewAccountClient creates an instance of the AccountClient client. -func NewAccountClient(subscriptionID string) AccountClient { - return NewAccountClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountClientWithBaseURI creates an instance of the AccountClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAccountClientWithBaseURI(baseURI string, subscriptionID string) AccountClient { - return AccountClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API -// and should instead be updated with the Update Batch Account API. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - a name for the Batch account which must be unique within the region. Batch account names must -// be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used -// as part of the DNS name that is used to access the Batch service in the region in which the account is -// created. For example: http://accountname.region.batch.azure.com/. -// parameters - additional parameters for account creation. -func (client AccountClient) Create(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters) (result AccountCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccountCreateProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountCreateProperties.AutoStorage", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountCreateProperties.AutoStorage.StorageAccountID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.AccountCreateProperties.KeyVaultReference", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountCreateProperties.KeyVaultReference.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccountCreateProperties.KeyVaultReference.URL", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client AccountClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) CreateSender(req *http.Request) (future AccountCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client AccountClient) CreateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified Batch account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -func (client AccountClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result AccountDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) DeleteSender(req *http.Request) (future AccountDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AccountClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified Batch account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -func (client AccountClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AccountClient) GetResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDetector gets information about the given detector for a given Batch account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// detectorID - the name of the detector. -func (client AccountClient) GetDetector(ctx context.Context, resourceGroupName string, accountName string, detectorID string) (result DetectorResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.GetDetector") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "GetDetector", err.Error()) - } - - req, err := client.GetDetectorPreparer(ctx, resourceGroupName, accountName, detectorID) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetDetector", nil, "Failure preparing request") - return - } - - resp, err := client.GetDetectorSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetDetector", resp, "Failure sending request") - return - } - - result, err = client.GetDetectorResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetDetector", resp, "Failure responding to request") - return - } - - return -} - -// GetDetectorPreparer prepares the GetDetector request. -func (client AccountClient) GetDetectorPreparer(ctx context.Context, resourceGroupName string, accountName string, detectorID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "detectorId": autorest.Encode("path", detectorID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDetectorSender sends the GetDetector request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) GetDetectorSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDetectorResponder handles the response to the GetDetector request. The method always -// closes the http.Response Body. -func (client AccountClient) GetDetectorResponder(resp *http.Response) (result DetectorResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetKeys this operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. If the -// Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to -// authenticate, and must use another allowedAuthenticationModes instead. In this case, getting the keys will fail. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -func (client AccountClient) GetKeys(ctx context.Context, resourceGroupName string, accountName string) (result AccountKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.GetKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "GetKeys", err.Error()) - } - - req, err := client.GetKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", nil, "Failure preparing request") - return - } - - resp, err := client.GetKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", resp, "Failure sending request") - return - } - - result, err = client.GetKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", resp, "Failure responding to request") - return - } - - return -} - -// GetKeysPreparer prepares the GetKeys request. -func (client AccountClient) GetKeysPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetKeysSender sends the GetKeys request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) GetKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetKeysResponder handles the response to the GetKeys request. The method always -// closes the http.Response Body. -func (client AccountClient) GetKeysResponder(resp *http.Response) (result AccountKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets information about the Batch accounts associated with the subscription. -func (client AccountClient) List(ctx context.Context) (result AccountListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.List") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure sending request") - return - } - - result.alr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AccountClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AccountClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client AccountClient) listNextResults(ctx context.Context, lastResults AccountListResult) (result AccountListResult, err error) { - req, err := lastResults.accountListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountClient) ListComplete(ctx context.Context) (result AccountListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup gets information about the Batch accounts associated with the specified resource group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -func (client AccountClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AccountListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.alr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AccountClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AccountClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client AccountClient) listByResourceGroupNextResults(ctx context.Context, lastResults AccountListResult) (result AccountListResult, err error) { - req, err := lastResults.accountListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AccountListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListDetectors gets information about the detectors available for a given Batch account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -func (client AccountClient) ListDetectors(ctx context.Context, resourceGroupName string, accountName string) (result DetectorListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListDetectors") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "ListDetectors", err.Error()) - } - - result.fn = client.listDetectorsNextResults - req, err := client.ListDetectorsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListDetectors", nil, "Failure preparing request") - return - } - - resp, err := client.ListDetectorsSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListDetectors", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListDetectorsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListDetectors", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListDetectorsPreparer prepares the ListDetectors request. -func (client AccountClient) ListDetectorsPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListDetectorsSender sends the ListDetectors request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) ListDetectorsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListDetectorsResponder handles the response to the ListDetectors request. The method always -// closes the http.Response Body. -func (client AccountClient) ListDetectorsResponder(resp *http.Response) (result DetectorListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listDetectorsNextResults retrieves the next set of results, if any. -func (client AccountClient) listDetectorsNextResults(ctx context.Context, lastResults DetectorListResult) (result DetectorListResult, err error) { - req, err := lastResults.detectorListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listDetectorsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListDetectorsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listDetectorsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListDetectorsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "listDetectorsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListDetectorsComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountClient) ListDetectorsComplete(ctx context.Context, resourceGroupName string, accountName string) (result DetectorListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListDetectors") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListDetectors(ctx, resourceGroupName, accountName) - return -} - -// ListOutboundNetworkDependenciesEndpoints lists the endpoints that a Batch Compute Node under this Batch Account may -// call as part of Batch service administration. If you are deploying a Pool inside of a virtual network that you -// specify, you must make sure your network allows outbound access to these endpoints. Failure to allow access to these -// endpoints may cause Batch to mark the affected nodes as unusable. For more information about creating a pool inside -// of a virtual network, see https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -func (client AccountClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, accountName string) (result OutboundEnvironmentEndpointCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListOutboundNetworkDependenciesEndpoints") - defer func() { - sc := -1 - if result.oeec.Response.Response != nil { - sc = result.oeec.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "ListOutboundNetworkDependenciesEndpoints", err.Error()) - } - - result.fn = client.listOutboundNetworkDependenciesEndpointsNextResults - req, err := client.ListOutboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") - return - } - - resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) - if err != nil { - result.oeec.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure sending request") - return - } - - result.oeec, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure responding to request") - return - } - if result.oeec.hasNextLink() && result.oeec.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListOutboundNetworkDependenciesEndpointsPreparer prepares the ListOutboundNetworkDependenciesEndpoints request. -func (client AccountClient) ListOutboundNetworkDependenciesEndpointsPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/outboundNetworkDependenciesEndpoints", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListOutboundNetworkDependenciesEndpointsSender sends the ListOutboundNetworkDependenciesEndpoints request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) ListOutboundNetworkDependenciesEndpointsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListOutboundNetworkDependenciesEndpointsResponder handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always -// closes the http.Response Body. -func (client AccountClient) ListOutboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result OutboundEnvironmentEndpointCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listOutboundNetworkDependenciesEndpointsNextResults retrieves the next set of results, if any. -func (client AccountClient) listOutboundNetworkDependenciesEndpointsNextResults(ctx context.Context, lastResults OutboundEnvironmentEndpointCollection) (result OutboundEnvironmentEndpointCollection, err error) { - req, err := lastResults.outboundEnvironmentEndpointCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listOutboundNetworkDependenciesEndpointsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListOutboundNetworkDependenciesEndpointsComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, resourceGroupName string, accountName string) (result OutboundEnvironmentEndpointCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListOutboundNetworkDependenciesEndpoints") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListOutboundNetworkDependenciesEndpoints(ctx, resourceGroupName, accountName) - return -} - -// RegenerateKey this operation applies only to Batch accounts with allowedAuthenticationModes containing 'SharedKey'. -// If the Batch account doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients cannot use shared keys to -// authenticate, and must use another allowedAuthenticationModes instead. In this case, regenerating the keys will -// fail. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// parameters - the type of key to regenerate. -func (client AccountClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (result AccountKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.RegenerateKey") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client AccountClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateKeySender sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client AccountClient) RegenerateKeyResponder(resp *http.Response) (result AccountKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SynchronizeAutoStorageKeys synchronizes access keys for the auto-storage account configured for the specified Batch -// account, only if storage key authentication is being used. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -func (client AccountClient) SynchronizeAutoStorageKeys(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.SynchronizeAutoStorageKeys") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "SynchronizeAutoStorageKeys", err.Error()) - } - - req, err := client.SynchronizeAutoStorageKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", nil, "Failure preparing request") - return - } - - resp, err := client.SynchronizeAutoStorageKeysSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", resp, "Failure sending request") - return - } - - result, err = client.SynchronizeAutoStorageKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", resp, "Failure responding to request") - return - } - - return -} - -// SynchronizeAutoStorageKeysPreparer prepares the SynchronizeAutoStorageKeys request. -func (client AccountClient) SynchronizeAutoStorageKeysPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SynchronizeAutoStorageKeysSender sends the SynchronizeAutoStorageKeys request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) SynchronizeAutoStorageKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SynchronizeAutoStorageKeysResponder handles the response to the SynchronizeAutoStorageKeys request. The method always -// closes the http.Response Body. -func (client AccountClient) SynchronizeAutoStorageKeysResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates the properties of an existing Batch account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// parameters - additional parameters for account update. -func (client AccountClient) Update(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AccountClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AccountClient) UpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/application.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/application.go deleted file mode 100644 index d7019f9a7f45..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/application.go +++ /dev/null @@ -1,530 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ApplicationClient is the batch Client -type ApplicationClient struct { - BaseClient -} - -// NewApplicationClient creates an instance of the ApplicationClient client. -func NewApplicationClient(subscriptionID string) ApplicationClient { - return NewApplicationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationClientWithBaseURI creates an instance of the ApplicationClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewApplicationClientWithBaseURI(baseURI string, subscriptionID string) ApplicationClient { - return ApplicationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create adds an application to the specified Batch account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -// parameters - the parameters for the request. -func (client ApplicationClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters *Application) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, applicationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ApplicationClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters *Application) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ApplicationClient) CreateResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an application. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -func (client ApplicationClient) Delete(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified application. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -func (client ApplicationClient) Get(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationClient) GetResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all of the applications in the specified account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// maxresults - the maximum number of items to return in the response. -func (client ApplicationClient) List(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListApplicationsResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.List") - defer func() { - sc := -1 - if result.lar.Response.Response != nil { - sc = result.lar.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, accountName, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.lar.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure sending request") - return - } - - result.lar, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure responding to request") - return - } - if result.lar.hasNextLink() && result.lar.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationClient) ListResponder(resp *http.Response) (result ListApplicationsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ApplicationClient) listNextResults(ctx context.Context, lastResults ListApplicationsResult) (result ListApplicationsResult, err error) { - req, err := lastResults.listApplicationsResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListApplicationsResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, accountName, maxresults) - return -} - -// Update updates settings for the specified application. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -// parameters - the parameters for the request. -func (client ApplicationClient) Update(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters Application) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, applicationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ApplicationClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters Application) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ApplicationClient) UpdateResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/applicationpackage.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/applicationpackage.go deleted file mode 100644 index eb01a9e23848..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/applicationpackage.go +++ /dev/null @@ -1,566 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ApplicationPackageClient is the batch Client -type ApplicationPackageClient struct { - BaseClient -} - -// NewApplicationPackageClient creates an instance of the ApplicationPackageClient client. -func NewApplicationPackageClient(subscriptionID string) ApplicationPackageClient { - return NewApplicationPackageClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationPackageClientWithBaseURI creates an instance of the ApplicationPackageClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewApplicationPackageClientWithBaseURI(baseURI string, subscriptionID string) ApplicationPackageClient { - return ApplicationPackageClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Activate activates the specified application package. This should be done after the `ApplicationPackage` was created -// and uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -// versionName - the version of the application. -// parameters - the parameters for the request. -func (client ApplicationPackageClient) Activate(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters ActivateApplicationPackageParameters) (result ApplicationPackage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Activate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, - {TargetValue: versionName, - Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Format", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationPackageClient", "Activate", err.Error()) - } - - req, err := client.ActivatePreparer(ctx, resourceGroupName, accountName, applicationName, versionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", nil, "Failure preparing request") - return - } - - resp, err := client.ActivateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", resp, "Failure sending request") - return - } - - result, err = client.ActivateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", resp, "Failure responding to request") - return - } - - return -} - -// ActivatePreparer prepares the Activate request. -func (client ApplicationPackageClient) ActivatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters ActivateApplicationPackageParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionName": autorest.Encode("path", versionName), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ActivateSender sends the Activate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationPackageClient) ActivateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ActivateResponder handles the response to the Activate request. The method always -// closes the http.Response Body. -func (client ApplicationPackageClient) ActivateResponder(resp *http.Response) (result ApplicationPackage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Create creates an application package record. The record contains a storageUrl where the package should be uploaded -// to. Once it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it -// can be used. If the auto storage account was configured to use storage keys, the URL returned will contain a SAS. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -// versionName - the version of the application. -// parameters - the parameters for the request. -func (client ApplicationPackageClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters *ApplicationPackage) (result ApplicationPackage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, - {TargetValue: versionName, - Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationPackageClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, applicationName, versionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ApplicationPackageClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters *ApplicationPackage) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionName": autorest.Encode("path", versionName), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationPackageClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ApplicationPackageClient) CreateResponder(resp *http.Response) (result ApplicationPackage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an application package record and its associated binary file. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -// versionName - the version of the application. -func (client ApplicationPackageClient) Delete(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, - {TargetValue: versionName, - Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationPackageClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, applicationName, versionName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationPackageClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionName": autorest.Encode("path", versionName), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationPackageClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationPackageClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified application package. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -// versionName - the version of the application. -func (client ApplicationPackageClient) Get(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (result ApplicationPackage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, - {TargetValue: versionName, - Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationPackageClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, applicationName, versionName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationPackageClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionName": autorest.Encode("path", versionName), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationPackageClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationPackageClient) GetResponder(resp *http.Response) (result ApplicationPackage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all of the application packages in the specified application. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// applicationName - the name of the application. This must be unique within the account. -// maxresults - the maximum number of items to return in the response. -func (client ApplicationPackageClient) List(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (result ListApplicationPackagesResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.List") - defer func() { - sc := -1 - if result.lapr.Response.Response != nil { - sc = result.lapr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.ApplicationPackageClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, accountName, applicationName, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.lapr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "List", resp, "Failure sending request") - return - } - - result.lapr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "List", resp, "Failure responding to request") - return - } - if result.lapr.hasNextLink() && result.lapr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationPackageClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationPackageClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationPackageClient) ListResponder(resp *http.Response) (result ListApplicationPackagesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ApplicationPackageClient) listNextResults(ctx context.Context, lastResults ListApplicationPackagesResult) (result ListApplicationPackagesResult, err error) { - req, err := lastResults.listApplicationPackagesResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationPackageClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (result ListApplicationPackagesResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, accountName, applicationName, maxresults) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/certificate.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/certificate.go deleted file mode 100644 index 4e9e43a2a2ab..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/certificate.go +++ /dev/null @@ -1,660 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// CertificateClient is the batch Client -type CertificateClient struct { - BaseClient -} - -// NewCertificateClient creates an instance of the CertificateClient client. -func NewCertificateClient(subscriptionID string) CertificateClient { - return NewCertificateClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCertificateClientWithBaseURI creates an instance of the CertificateClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewCertificateClientWithBaseURI(baseURI string, subscriptionID string) CertificateClient { - return CertificateClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CancelDeletion if you try to delete a certificate that is being used by a pool or compute node, the status of the -// certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this -// operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not -// need to run this operation after the deletion failed. You must make sure that the certificate is not being used by -// any resources, and then you can try again to delete the certificate. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint -// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. -func (client CertificateClient) CancelDeletion(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result Certificate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.CancelDeletion") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: certificateName, - Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, - {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.CertificateClient", "CancelDeletion", err.Error()) - } - - req, err := client.CancelDeletionPreparer(ctx, resourceGroupName, accountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "CancelDeletion", nil, "Failure preparing request") - return - } - - resp, err := client.CancelDeletionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "CancelDeletion", resp, "Failure sending request") - return - } - - result, err = client.CancelDeletionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "CancelDeletion", resp, "Failure responding to request") - return - } - - return -} - -// CancelDeletionPreparer prepares the CancelDeletion request. -func (client CertificateClient) CancelDeletionPreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelDeletionSender sends the CancelDeletion request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) CancelDeletionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelDeletionResponder handles the response to the CancelDeletion request. The method always -// closes the http.Response Body. -func (client CertificateClient) CancelDeletionResponder(resp *http.Response) (result Certificate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Create creates a new certificate inside the specified account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint -// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. -// parameters - additional parameters for certificate creation. -// ifMatch - the entity state (ETag) version of the certificate to update. A value of "*" can be used to apply -// the operation only if the certificate already exists. If omitted, this operation will always be applied. -// ifNoneMatch - set to '*' to allow a new certificate to be created, but to prevent updating an existing -// certificate. Other values will be ignored. -func (client CertificateClient) Create(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string, ifNoneMatch string) (result Certificate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: certificateName, - Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, - {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.CertificateCreateOrUpdateProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CertificateCreateOrUpdateProperties.Data", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("batch.CertificateClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, certificateName, parameters, ifMatch, ifNoneMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client CertificateClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string, ifNoneMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - if len(ifNoneMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client CertificateClient) CreateResponder(resp *http.Response) (result Certificate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified certificate. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint -// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. -func (client CertificateClient) Delete(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result CertificateDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: certificateName, - Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, - {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.CertificateClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CertificateClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) DeleteSender(req *http.Request) (future CertificateDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client CertificateClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified certificate. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint -// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. -func (client CertificateClient) Get(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result Certificate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: certificateName, - Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, - {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.CertificateClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CertificateClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CertificateClient) GetResponder(resp *http.Response) (result Certificate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByBatchAccount lists all of the certificates in the specified account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// maxresults - the maximum number of items to return in the response. -// selectParameter - comma separated list of properties that should be returned. e.g. -// "properties/provisioningState". Only top level properties under properties/ are valid for selection. -// filter - oData filter expression. Valid properties for filtering are "properties/provisioningState", -// "properties/provisioningStateTransitionTime", "name". -func (client CertificateClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListCertificatesResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.lcr.Response.Response != nil { - sc = result.lcr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.CertificateClient", "ListByBatchAccount", err.Error()) - } - - result.fn = client.listByBatchAccountNextResults - req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "ListByBatchAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.lcr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "ListByBatchAccount", resp, "Failure sending request") - return - } - - result.lcr, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "ListByBatchAccount", resp, "Failure responding to request") - return - } - if result.lcr.hasNextLink() && result.lcr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByBatchAccountPreparer prepares the ListByBatchAccount request. -func (client CertificateClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always -// closes the http.Response Body. -func (client CertificateClient) ListByBatchAccountResponder(resp *http.Response) (result ListCertificatesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByBatchAccountNextResults retrieves the next set of results, if any. -func (client CertificateClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListCertificatesResult) (result ListCertificatesResult, err error) { - req, err := lastResults.listCertificatesResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.CertificateClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.CertificateClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client CertificateClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListCertificatesResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) - return -} - -// Update updates the properties of an existing certificate. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint -// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. -// parameters - certificate entity to update. -// ifMatch - the entity state (ETag) version of the certificate to update. This value can be omitted or set to -// "*" to apply the operation unconditionally. -func (client CertificateClient) Update(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (result Certificate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: certificateName, - Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, - {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.CertificateClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, certificateName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CertificateClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client CertificateClient) UpdateResponder(resp *http.Response) (result Certificate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/client.go deleted file mode 100644 index b44cdbf1fc22..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package batch implements the Azure ARM Batch service API version 2022-01-01. -// -// Batch Client -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Batch - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Batch. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/enums.go deleted file mode 100644 index 46526f60e854..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/enums.go +++ /dev/null @@ -1,617 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AccountKeyType enumerates the values for account key type. -type AccountKeyType string - -const ( - // AccountKeyTypePrimary The primary account key. - AccountKeyTypePrimary AccountKeyType = "Primary" - // AccountKeyTypeSecondary The secondary account key. - AccountKeyTypeSecondary AccountKeyType = "Secondary" -) - -// PossibleAccountKeyTypeValues returns an array of possible values for the AccountKeyType const type. -func PossibleAccountKeyTypeValues() []AccountKeyType { - return []AccountKeyType{AccountKeyTypePrimary, AccountKeyTypeSecondary} -} - -// AllocationState enumerates the values for allocation state. -type AllocationState string - -const ( - // AllocationStateResizing The pool is resizing; that is, compute nodes are being added to or removed from - // the pool. - AllocationStateResizing AllocationState = "Resizing" - // AllocationStateSteady The pool is not resizing. There are no changes to the number of nodes in the pool - // in progress. A pool enters this state when it is created and when no operations are being performed on - // the pool to change the number of nodes. - AllocationStateSteady AllocationState = "Steady" - // AllocationStateStopping The pool was resizing, but the user has requested that the resize be stopped, - // but the stop request has not yet been completed. - AllocationStateStopping AllocationState = "Stopping" -) - -// PossibleAllocationStateValues returns an array of possible values for the AllocationState const type. -func PossibleAllocationStateValues() []AllocationState { - return []AllocationState{AllocationStateResizing, AllocationStateSteady, AllocationStateStopping} -} - -// AuthenticationMode enumerates the values for authentication mode. -type AuthenticationMode string - -const ( - // AuthenticationModeAAD The authentication mode using Azure Active Directory. - AuthenticationModeAAD AuthenticationMode = "AAD" - // AuthenticationModeSharedKey The authentication mode using shared keys. - AuthenticationModeSharedKey AuthenticationMode = "SharedKey" - // AuthenticationModeTaskAuthenticationToken The authentication mode using task authentication tokens. - AuthenticationModeTaskAuthenticationToken AuthenticationMode = "TaskAuthenticationToken" -) - -// PossibleAuthenticationModeValues returns an array of possible values for the AuthenticationMode const type. -func PossibleAuthenticationModeValues() []AuthenticationMode { - return []AuthenticationMode{AuthenticationModeAAD, AuthenticationModeSharedKey, AuthenticationModeTaskAuthenticationToken} -} - -// AutoStorageAuthenticationMode enumerates the values for auto storage authentication mode. -type AutoStorageAuthenticationMode string - -const ( - // AutoStorageAuthenticationModeBatchAccountManagedIdentity The Batch service will authenticate requests to - // auto-storage using the managed identity assigned to the Batch account. - AutoStorageAuthenticationModeBatchAccountManagedIdentity AutoStorageAuthenticationMode = "BatchAccountManagedIdentity" - // AutoStorageAuthenticationModeStorageKeys The Batch service will authenticate requests to auto-storage - // using storage account keys. - AutoStorageAuthenticationModeStorageKeys AutoStorageAuthenticationMode = "StorageKeys" -) - -// PossibleAutoStorageAuthenticationModeValues returns an array of possible values for the AutoStorageAuthenticationMode const type. -func PossibleAutoStorageAuthenticationModeValues() []AutoStorageAuthenticationMode { - return []AutoStorageAuthenticationMode{AutoStorageAuthenticationModeBatchAccountManagedIdentity, AutoStorageAuthenticationModeStorageKeys} -} - -// AutoUserScope enumerates the values for auto user scope. -type AutoUserScope string - -const ( - // AutoUserScopePool Specifies that the task runs as the common auto user account which is created on every - // node in a pool. - AutoUserScopePool AutoUserScope = "Pool" - // AutoUserScopeTask Specifies that the service should create a new user for the task. - AutoUserScopeTask AutoUserScope = "Task" -) - -// PossibleAutoUserScopeValues returns an array of possible values for the AutoUserScope const type. -func PossibleAutoUserScopeValues() []AutoUserScope { - return []AutoUserScope{AutoUserScopePool, AutoUserScopeTask} -} - -// CachingType enumerates the values for caching type. -type CachingType string - -const ( - // CachingTypeNone The caching mode for the disk is not enabled. - CachingTypeNone CachingType = "None" - // CachingTypeReadOnly The caching mode for the disk is read only. - CachingTypeReadOnly CachingType = "ReadOnly" - // CachingTypeReadWrite The caching mode for the disk is read and write. - CachingTypeReadWrite CachingType = "ReadWrite" -) - -// PossibleCachingTypeValues returns an array of possible values for the CachingType const type. -func PossibleCachingTypeValues() []CachingType { - return []CachingType{CachingTypeNone, CachingTypeReadOnly, CachingTypeReadWrite} -} - -// CertificateFormat enumerates the values for certificate format. -type CertificateFormat string - -const ( - // CertificateFormatCer The certificate is a base64-encoded X.509 certificate. - CertificateFormatCer CertificateFormat = "Cer" - // CertificateFormatPfx The certificate is a PFX (PKCS#12) formatted certificate or certificate chain. - CertificateFormatPfx CertificateFormat = "Pfx" -) - -// PossibleCertificateFormatValues returns an array of possible values for the CertificateFormat const type. -func PossibleCertificateFormatValues() []CertificateFormat { - return []CertificateFormat{CertificateFormatCer, CertificateFormatPfx} -} - -// CertificateProvisioningState enumerates the values for certificate provisioning state. -type CertificateProvisioningState string - -const ( - // CertificateProvisioningStateDeleting The user has requested that the certificate be deleted, but the - // delete operation has not yet completed. You may not reference the certificate when creating or updating - // pools. - CertificateProvisioningStateDeleting CertificateProvisioningState = "Deleting" - // CertificateProvisioningStateFailed The user requested that the certificate be deleted, but there are - // pools that still have references to the certificate, or it is still installed on one or more compute - // nodes. (The latter can occur if the certificate has been removed from the pool, but the node has not yet - // restarted. Nodes refresh their certificates only when they restart.) You may use the cancel certificate - // delete operation to cancel the delete, or the delete certificate operation to retry the delete. - CertificateProvisioningStateFailed CertificateProvisioningState = "Failed" - // CertificateProvisioningStateSucceeded The certificate is available for use in pools. - CertificateProvisioningStateSucceeded CertificateProvisioningState = "Succeeded" -) - -// PossibleCertificateProvisioningStateValues returns an array of possible values for the CertificateProvisioningState const type. -func PossibleCertificateProvisioningStateValues() []CertificateProvisioningState { - return []CertificateProvisioningState{CertificateProvisioningStateDeleting, CertificateProvisioningStateFailed, CertificateProvisioningStateSucceeded} -} - -// CertificateStoreLocation enumerates the values for certificate store location. -type CertificateStoreLocation string - -const ( - // CertificateStoreLocationCurrentUser Certificates should be installed to the CurrentUser certificate - // store. - CertificateStoreLocationCurrentUser CertificateStoreLocation = "CurrentUser" - // CertificateStoreLocationLocalMachine Certificates should be installed to the LocalMachine certificate - // store. - CertificateStoreLocationLocalMachine CertificateStoreLocation = "LocalMachine" -) - -// PossibleCertificateStoreLocationValues returns an array of possible values for the CertificateStoreLocation const type. -func PossibleCertificateStoreLocationValues() []CertificateStoreLocation { - return []CertificateStoreLocation{CertificateStoreLocationCurrentUser, CertificateStoreLocationLocalMachine} -} - -// CertificateVisibility enumerates the values for certificate visibility. -type CertificateVisibility string - -const ( - // CertificateVisibilityRemoteUser The certificate should be visible to the user accounts under which users - // remotely access the node. - CertificateVisibilityRemoteUser CertificateVisibility = "RemoteUser" - // CertificateVisibilityStartTask The certificate should be visible to the user account under which the - // start task is run. Note that if AutoUser Scope is Pool for both the StartTask and a Task, this - // certificate will be visible to the Task as well. - CertificateVisibilityStartTask CertificateVisibility = "StartTask" - // CertificateVisibilityTask The certificate should be visible to the user accounts under which job tasks - // are run. - CertificateVisibilityTask CertificateVisibility = "Task" -) - -// PossibleCertificateVisibilityValues returns an array of possible values for the CertificateVisibility const type. -func PossibleCertificateVisibilityValues() []CertificateVisibility { - return []CertificateVisibility{CertificateVisibilityRemoteUser, CertificateVisibilityStartTask, CertificateVisibilityTask} -} - -// ComputeNodeDeallocationOption enumerates the values for compute node deallocation option. -type ComputeNodeDeallocationOption string - -const ( - // ComputeNodeDeallocationOptionRequeue Terminate running task processes and requeue the tasks. The tasks - // will run again when a node is available. Remove nodes as soon as tasks have been terminated. - ComputeNodeDeallocationOptionRequeue ComputeNodeDeallocationOption = "Requeue" - // ComputeNodeDeallocationOptionRetainedData Allow currently running tasks to complete, then wait for all - // task data retention periods to expire. Schedule no new tasks while waiting. Remove nodes when all task - // retention periods have expired. - ComputeNodeDeallocationOptionRetainedData ComputeNodeDeallocationOption = "RetainedData" - // ComputeNodeDeallocationOptionTaskCompletion Allow currently running tasks to complete. Schedule no new - // tasks while waiting. Remove nodes when all tasks have completed. - ComputeNodeDeallocationOptionTaskCompletion ComputeNodeDeallocationOption = "TaskCompletion" - // ComputeNodeDeallocationOptionTerminate Terminate running tasks. The tasks will be completed with - // failureInfo indicating that they were terminated, and will not run again. Remove nodes as soon as tasks - // have been terminated. - ComputeNodeDeallocationOptionTerminate ComputeNodeDeallocationOption = "Terminate" -) - -// PossibleComputeNodeDeallocationOptionValues returns an array of possible values for the ComputeNodeDeallocationOption const type. -func PossibleComputeNodeDeallocationOptionValues() []ComputeNodeDeallocationOption { - return []ComputeNodeDeallocationOption{ComputeNodeDeallocationOptionRequeue, ComputeNodeDeallocationOptionRetainedData, ComputeNodeDeallocationOptionTaskCompletion, ComputeNodeDeallocationOptionTerminate} -} - -// ComputeNodeFillType enumerates the values for compute node fill type. -type ComputeNodeFillType string - -const ( - // ComputeNodeFillTypePack As many tasks as possible (taskSlotsPerNode) should be assigned to each node in - // the pool before any tasks are assigned to the next node in the pool. - ComputeNodeFillTypePack ComputeNodeFillType = "Pack" - // ComputeNodeFillTypeSpread Tasks should be assigned evenly across all nodes in the pool. - ComputeNodeFillTypeSpread ComputeNodeFillType = "Spread" -) - -// PossibleComputeNodeFillTypeValues returns an array of possible values for the ComputeNodeFillType const type. -func PossibleComputeNodeFillTypeValues() []ComputeNodeFillType { - return []ComputeNodeFillType{ComputeNodeFillTypePack, ComputeNodeFillTypeSpread} -} - -// ContainerWorkingDirectory enumerates the values for container working directory. -type ContainerWorkingDirectory string - -const ( - // ContainerWorkingDirectoryContainerImageDefault Using container image defined working directory. Beware - // that this directory will not contain the resource files downloaded by Batch. - ContainerWorkingDirectoryContainerImageDefault ContainerWorkingDirectory = "ContainerImageDefault" - // ContainerWorkingDirectoryTaskWorkingDirectory Use the standard Batch service task working directory, - // which will contain the Task resource files populated by Batch. - ContainerWorkingDirectoryTaskWorkingDirectory ContainerWorkingDirectory = "TaskWorkingDirectory" -) - -// PossibleContainerWorkingDirectoryValues returns an array of possible values for the ContainerWorkingDirectory const type. -func PossibleContainerWorkingDirectoryValues() []ContainerWorkingDirectory { - return []ContainerWorkingDirectory{ContainerWorkingDirectoryContainerImageDefault, ContainerWorkingDirectoryTaskWorkingDirectory} -} - -// DiffDiskPlacement enumerates the values for diff disk placement. -type DiffDiskPlacement string - -const ( - // DiffDiskPlacementCacheDisk The Ephemeral OS Disk is stored on the VM cache. - DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk" -) - -// PossibleDiffDiskPlacementValues returns an array of possible values for the DiffDiskPlacement const type. -func PossibleDiffDiskPlacementValues() []DiffDiskPlacement { - return []DiffDiskPlacement{DiffDiskPlacementCacheDisk} -} - -// DiskEncryptionTarget enumerates the values for disk encryption target. -type DiskEncryptionTarget string - -const ( - // DiskEncryptionTargetOsDisk The OS Disk on the compute node is encrypted. - DiskEncryptionTargetOsDisk DiskEncryptionTarget = "OsDisk" - // DiskEncryptionTargetTemporaryDisk The temporary disk on the compute node is encrypted. On Linux this - // encryption applies to other partitions (such as those on mounted data disks) when encryption occurs at - // boot time. - DiskEncryptionTargetTemporaryDisk DiskEncryptionTarget = "TemporaryDisk" -) - -// PossibleDiskEncryptionTargetValues returns an array of possible values for the DiskEncryptionTarget const type. -func PossibleDiskEncryptionTargetValues() []DiskEncryptionTarget { - return []DiskEncryptionTarget{DiskEncryptionTargetOsDisk, DiskEncryptionTargetTemporaryDisk} -} - -// DynamicVNetAssignmentScope enumerates the values for dynamic v net assignment scope. -type DynamicVNetAssignmentScope string - -const ( - // DynamicVNetAssignmentScopeJob Dynamic VNet assignment is done per-job. Don't use this option unless your - // batch account has been approved to use this feature. - DynamicVNetAssignmentScopeJob DynamicVNetAssignmentScope = "job" - // DynamicVNetAssignmentScopeNone No dynamic VNet assignment is enabled. - DynamicVNetAssignmentScopeNone DynamicVNetAssignmentScope = "none" -) - -// PossibleDynamicVNetAssignmentScopeValues returns an array of possible values for the DynamicVNetAssignmentScope const type. -func PossibleDynamicVNetAssignmentScopeValues() []DynamicVNetAssignmentScope { - return []DynamicVNetAssignmentScope{DynamicVNetAssignmentScopeJob, DynamicVNetAssignmentScopeNone} -} - -// ElevationLevel enumerates the values for elevation level. -type ElevationLevel string - -const ( - // ElevationLevelAdmin The user is a user with elevated access and operates with full Administrator - // permissions. - ElevationLevelAdmin ElevationLevel = "Admin" - // ElevationLevelNonAdmin The user is a standard user without elevated access. - ElevationLevelNonAdmin ElevationLevel = "NonAdmin" -) - -// PossibleElevationLevelValues returns an array of possible values for the ElevationLevel const type. -func PossibleElevationLevelValues() []ElevationLevel { - return []ElevationLevel{ElevationLevelAdmin, ElevationLevelNonAdmin} -} - -// InboundEndpointProtocol enumerates the values for inbound endpoint protocol. -type InboundEndpointProtocol string - -const ( - // InboundEndpointProtocolTCP Use TCP for the endpoint. - InboundEndpointProtocolTCP InboundEndpointProtocol = "TCP" - // InboundEndpointProtocolUDP Use UDP for the endpoint. - InboundEndpointProtocolUDP InboundEndpointProtocol = "UDP" -) - -// PossibleInboundEndpointProtocolValues returns an array of possible values for the InboundEndpointProtocol const type. -func PossibleInboundEndpointProtocolValues() []InboundEndpointProtocol { - return []InboundEndpointProtocol{InboundEndpointProtocolTCP, InboundEndpointProtocolUDP} -} - -// InterNodeCommunicationState enumerates the values for inter node communication state. -type InterNodeCommunicationState string - -const ( - // InterNodeCommunicationStateDisabled Disable network communication between virtual machines. - InterNodeCommunicationStateDisabled InterNodeCommunicationState = "Disabled" - // InterNodeCommunicationStateEnabled Enable network communication between virtual machines. - InterNodeCommunicationStateEnabled InterNodeCommunicationState = "Enabled" -) - -// PossibleInterNodeCommunicationStateValues returns an array of possible values for the InterNodeCommunicationState const type. -func PossibleInterNodeCommunicationStateValues() []InterNodeCommunicationState { - return []InterNodeCommunicationState{InterNodeCommunicationStateDisabled, InterNodeCommunicationStateEnabled} -} - -// IPAddressProvisioningType enumerates the values for ip address provisioning type. -type IPAddressProvisioningType string - -const ( - // IPAddressProvisioningTypeBatchManaged A public IP will be created and managed by Batch. There may be - // multiple public IPs depending on the size of the Pool. - IPAddressProvisioningTypeBatchManaged IPAddressProvisioningType = "BatchManaged" - // IPAddressProvisioningTypeNoPublicIPAddresses No public IP Address will be created for the Compute Nodes - // in the Pool. - IPAddressProvisioningTypeNoPublicIPAddresses IPAddressProvisioningType = "NoPublicIPAddresses" - // IPAddressProvisioningTypeUserManaged Public IPs are provided by the user and will be used to provision - // the Compute Nodes. - IPAddressProvisioningTypeUserManaged IPAddressProvisioningType = "UserManaged" -) - -// PossibleIPAddressProvisioningTypeValues returns an array of possible values for the IPAddressProvisioningType const type. -func PossibleIPAddressProvisioningTypeValues() []IPAddressProvisioningType { - return []IPAddressProvisioningType{IPAddressProvisioningTypeBatchManaged, IPAddressProvisioningTypeNoPublicIPAddresses, IPAddressProvisioningTypeUserManaged} -} - -// KeySource enumerates the values for key source. -type KeySource string - -const ( - // KeySourceMicrosoftBatch Batch creates and manages the encryption keys used to protect the account data. - KeySourceMicrosoftBatch KeySource = "Microsoft.Batch" - // KeySourceMicrosoftKeyVault The encryption keys used to protect the account data are stored in an - // external key vault. If this is set then the Batch Account identity must be set to `SystemAssigned` and a - // valid Key Identifier must also be supplied under the keyVaultProperties. - KeySourceMicrosoftKeyVault KeySource = "Microsoft.KeyVault" -) - -// PossibleKeySourceValues returns an array of possible values for the KeySource const type. -func PossibleKeySourceValues() []KeySource { - return []KeySource{KeySourceMicrosoftBatch, KeySourceMicrosoftKeyVault} -} - -// LoginMode enumerates the values for login mode. -type LoginMode string - -const ( - // LoginModeBatch The LOGON32_LOGON_BATCH Win32 login mode. The batch login mode is recommended for long - // running parallel processes. - LoginModeBatch LoginMode = "Batch" - // LoginModeInteractive The LOGON32_LOGON_INTERACTIVE Win32 login mode. Some applications require having - // permissions associated with the interactive login mode. If this is the case for an application used in - // your task, then this option is recommended. - LoginModeInteractive LoginMode = "Interactive" -) - -// PossibleLoginModeValues returns an array of possible values for the LoginMode const type. -func PossibleLoginModeValues() []LoginMode { - return []LoginMode{LoginModeBatch, LoginModeInteractive} -} - -// NameAvailabilityReason enumerates the values for name availability reason. -type NameAvailabilityReason string - -const ( - // NameAvailabilityReasonAlreadyExists The requested name is already in use. - NameAvailabilityReasonAlreadyExists NameAvailabilityReason = "AlreadyExists" - // NameAvailabilityReasonInvalid The requested name is invalid. - NameAvailabilityReasonInvalid NameAvailabilityReason = "Invalid" -) - -// PossibleNameAvailabilityReasonValues returns an array of possible values for the NameAvailabilityReason const type. -func PossibleNameAvailabilityReasonValues() []NameAvailabilityReason { - return []NameAvailabilityReason{NameAvailabilityReasonAlreadyExists, NameAvailabilityReasonInvalid} -} - -// NetworkSecurityGroupRuleAccess enumerates the values for network security group rule access. -type NetworkSecurityGroupRuleAccess string - -const ( - // NetworkSecurityGroupRuleAccessAllow Allow access. - NetworkSecurityGroupRuleAccessAllow NetworkSecurityGroupRuleAccess = "Allow" - // NetworkSecurityGroupRuleAccessDeny Deny access. - NetworkSecurityGroupRuleAccessDeny NetworkSecurityGroupRuleAccess = "Deny" -) - -// PossibleNetworkSecurityGroupRuleAccessValues returns an array of possible values for the NetworkSecurityGroupRuleAccess const type. -func PossibleNetworkSecurityGroupRuleAccessValues() []NetworkSecurityGroupRuleAccess { - return []NetworkSecurityGroupRuleAccess{NetworkSecurityGroupRuleAccessAllow, NetworkSecurityGroupRuleAccessDeny} -} - -// NodePlacementPolicyType enumerates the values for node placement policy type. -type NodePlacementPolicyType string - -const ( - // NodePlacementPolicyTypeRegional All nodes in the pool will be allocated in the same region. - NodePlacementPolicyTypeRegional NodePlacementPolicyType = "Regional" - // NodePlacementPolicyTypeZonal Nodes in the pool will be spread across different zones with best effort - // balancing. - NodePlacementPolicyTypeZonal NodePlacementPolicyType = "Zonal" -) - -// PossibleNodePlacementPolicyTypeValues returns an array of possible values for the NodePlacementPolicyType const type. -func PossibleNodePlacementPolicyTypeValues() []NodePlacementPolicyType { - return []NodePlacementPolicyType{NodePlacementPolicyTypeRegional, NodePlacementPolicyTypeZonal} -} - -// PackageState enumerates the values for package state. -type PackageState string - -const ( - // PackageStateActive The application package is ready for use. - PackageStateActive PackageState = "Active" - // PackageStatePending The application package has been created but has not yet been activated. - PackageStatePending PackageState = "Pending" -) - -// PossiblePackageStateValues returns an array of possible values for the PackageState const type. -func PossiblePackageStateValues() []PackageState { - return []PackageState{PackageStateActive, PackageStatePending} -} - -// PoolAllocationMode enumerates the values for pool allocation mode. -type PoolAllocationMode string - -const ( - // PoolAllocationModeBatchService Pools will be allocated in subscriptions owned by the Batch service. - PoolAllocationModeBatchService PoolAllocationMode = "BatchService" - // PoolAllocationModeUserSubscription Pools will be allocated in a subscription owned by the user. - PoolAllocationModeUserSubscription PoolAllocationMode = "UserSubscription" -) - -// PossiblePoolAllocationModeValues returns an array of possible values for the PoolAllocationMode const type. -func PossiblePoolAllocationModeValues() []PoolAllocationMode { - return []PoolAllocationMode{PoolAllocationModeBatchService, PoolAllocationModeUserSubscription} -} - -// PoolIdentityType enumerates the values for pool identity type. -type PoolIdentityType string - -const ( - // PoolIdentityTypeNone Batch pool has no identity associated with it. Setting `None` in update pool will - // remove existing identities. - PoolIdentityTypeNone PoolIdentityType = "None" - // PoolIdentityTypeUserAssigned Batch pool has user assigned identities with it. - PoolIdentityTypeUserAssigned PoolIdentityType = "UserAssigned" -) - -// PossiblePoolIdentityTypeValues returns an array of possible values for the PoolIdentityType const type. -func PossiblePoolIdentityTypeValues() []PoolIdentityType { - return []PoolIdentityType{PoolIdentityTypeNone, PoolIdentityTypeUserAssigned} -} - -// PoolProvisioningState enumerates the values for pool provisioning state. -type PoolProvisioningState string - -const ( - // PoolProvisioningStateDeleting The user has requested that the pool be deleted, but the delete operation - // has not yet completed. - PoolProvisioningStateDeleting PoolProvisioningState = "Deleting" - // PoolProvisioningStateSucceeded The pool is available to run tasks subject to the availability of compute - // nodes. - PoolProvisioningStateSucceeded PoolProvisioningState = "Succeeded" -) - -// PossiblePoolProvisioningStateValues returns an array of possible values for the PoolProvisioningState const type. -func PossiblePoolProvisioningStateValues() []PoolProvisioningState { - return []PoolProvisioningState{PoolProvisioningStateDeleting, PoolProvisioningStateSucceeded} -} - -// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection -// provisioning state. -type PrivateEndpointConnectionProvisioningState string - -const ( - // PrivateEndpointConnectionProvisioningStateFailed The user requested that the connection be updated and - // it failed. You may retry the update operation. - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - // PrivateEndpointConnectionProvisioningStateSucceeded The connection status is final and is ready for use - // if Status is Approved. - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" - // PrivateEndpointConnectionProvisioningStateUpdating The user has requested that the connection status be - // updated, but the update operation has not yet completed. You may not reference the connection when - // connecting the Batch account. - PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" -) - -// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. -func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { - return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded, PrivateEndpointConnectionProvisioningStateUpdating} -} - -// PrivateLinkServiceConnectionStatus enumerates the values for private link service connection status. -type PrivateLinkServiceConnectionStatus string - -const ( - // PrivateLinkServiceConnectionStatusApproved The private endpoint connection is approved and can be used - // to access Batch account - PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" - // PrivateLinkServiceConnectionStatusDisconnected The private endpoint connection is disconnected and - // cannot be used to access Batch account - PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" - // PrivateLinkServiceConnectionStatusPending The private endpoint connection is pending and cannot be used - // to access Batch account - PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" - // PrivateLinkServiceConnectionStatusRejected The private endpoint connection is rejected and cannot be - // used to access Batch account - PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" -) - -// PossiblePrivateLinkServiceConnectionStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStatus const type. -func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConnectionStatus { - return []PrivateLinkServiceConnectionStatus{PrivateLinkServiceConnectionStatusApproved, PrivateLinkServiceConnectionStatusDisconnected, PrivateLinkServiceConnectionStatusPending, PrivateLinkServiceConnectionStatusRejected} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCancelled The last operation for the account is cancelled. - ProvisioningStateCancelled ProvisioningState = "Cancelled" - // ProvisioningStateCreating The account is being created. - ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting The account is being deleted. - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed The last operation for the account is failed. - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateInvalid The account is in an invalid state. - ProvisioningStateInvalid ProvisioningState = "Invalid" - // ProvisioningStateSucceeded The account has been created and is ready for use. - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCancelled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateInvalid, ProvisioningStateSucceeded} -} - -// PublicNetworkAccessType enumerates the values for public network access type. -type PublicNetworkAccessType string - -const ( - // PublicNetworkAccessTypeDisabled Disables public connectivity and enables private connectivity to Azure - // Batch Service through private endpoint resource. - PublicNetworkAccessTypeDisabled PublicNetworkAccessType = "Disabled" - // PublicNetworkAccessTypeEnabled Enables connectivity to Azure Batch through public DNS. - PublicNetworkAccessTypeEnabled PublicNetworkAccessType = "Enabled" -) - -// PossiblePublicNetworkAccessTypeValues returns an array of possible values for the PublicNetworkAccessType const type. -func PossiblePublicNetworkAccessTypeValues() []PublicNetworkAccessType { - return []PublicNetworkAccessType{PublicNetworkAccessTypeDisabled, PublicNetworkAccessTypeEnabled} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone Batch account has no identity associated with it. Setting `None` in update - // account will remove existing identities. - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned Batch account has a system assigned identity with it. - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeUserAssigned Batch account has user assigned identities with it. - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeUserAssigned} -} - -// StorageAccountType enumerates the values for storage account type. -type StorageAccountType string - -const ( - // StorageAccountTypePremiumLRS The data disk should use premium locally redundant storage. - StorageAccountTypePremiumLRS StorageAccountType = "Premium_LRS" - // StorageAccountTypeStandardLRS The data disk should use standard locally redundant storage. - StorageAccountTypeStandardLRS StorageAccountType = "Standard_LRS" -) - -// PossibleStorageAccountTypeValues returns an array of possible values for the StorageAccountType const type. -func PossibleStorageAccountTypeValues() []StorageAccountType { - return []StorageAccountType{StorageAccountTypePremiumLRS, StorageAccountTypeStandardLRS} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/location.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/location.go deleted file mode 100644 index 725202832bb4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/location.go +++ /dev/null @@ -1,440 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LocationClient is the batch Client -type LocationClient struct { - BaseClient -} - -// NewLocationClient creates an instance of the LocationClient client. -func NewLocationClient(subscriptionID string) LocationClient { - return NewLocationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLocationClientWithBaseURI creates an instance of the LocationClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewLocationClientWithBaseURI(baseURI string, subscriptionID string) LocationClient { - return LocationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks whether the Batch account name is available in the specified region. -// Parameters: -// locationName - the desired region for the name check. -// parameters - properties needed to check the availability of a name. -func (client LocationClient) CheckNameAvailability(ctx context.Context, locationName string, parameters CheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.LocationClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, locationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.LocationClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client LocationClient) CheckNameAvailabilityPreparer(ctx context.Context, locationName string, parameters CheckNameAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client LocationClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetQuotas gets the Batch service quotas for the specified subscription at the given location. -// Parameters: -// locationName - the region for which to retrieve Batch service quotas. -func (client LocationClient) GetQuotas(ctx context.Context, locationName string) (result LocationQuota, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.GetQuotas") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetQuotasPreparer(ctx, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", nil, "Failure preparing request") - return - } - - resp, err := client.GetQuotasSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", resp, "Failure sending request") - return - } - - result, err = client.GetQuotasResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", resp, "Failure responding to request") - return - } - - return -} - -// GetQuotasPreparer prepares the GetQuotas request. -func (client LocationClient) GetQuotasPreparer(ctx context.Context, locationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetQuotasSender sends the GetQuotas request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) GetQuotasSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetQuotasResponder handles the response to the GetQuotas request. The method always -// closes the http.Response Body. -func (client LocationClient) GetQuotasResponder(resp *http.Response) (result LocationQuota, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSupportedCloudServiceSkus gets the list of Batch supported Cloud Service VM sizes available at the given -// location. -// Parameters: -// locationName - the region for which to retrieve Batch service supported SKUs. -// maxresults - the maximum number of items to return in the response. -// filter - oData filter expression. Valid properties for filtering are "familyName". -func (client LocationClient) ListSupportedCloudServiceSkus(ctx context.Context, locationName string, maxresults *int32, filter string) (result SupportedSkusResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListSupportedCloudServiceSkus") - defer func() { - sc := -1 - if result.ssr.Response.Response != nil { - sc = result.ssr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listSupportedCloudServiceSkusNextResults - req, err := client.ListSupportedCloudServiceSkusPreparer(ctx, locationName, maxresults, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedCloudServiceSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListSupportedCloudServiceSkusSender(req) - if err != nil { - result.ssr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedCloudServiceSkus", resp, "Failure sending request") - return - } - - result.ssr, err = client.ListSupportedCloudServiceSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedCloudServiceSkus", resp, "Failure responding to request") - return - } - if result.ssr.hasNextLink() && result.ssr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListSupportedCloudServiceSkusPreparer prepares the ListSupportedCloudServiceSkus request. -func (client LocationClient) ListSupportedCloudServiceSkusPreparer(ctx context.Context, locationName string, maxresults *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSupportedCloudServiceSkusSender sends the ListSupportedCloudServiceSkus request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) ListSupportedCloudServiceSkusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSupportedCloudServiceSkusResponder handles the response to the ListSupportedCloudServiceSkus request. The method always -// closes the http.Response Body. -func (client LocationClient) ListSupportedCloudServiceSkusResponder(resp *http.Response) (result SupportedSkusResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listSupportedCloudServiceSkusNextResults retrieves the next set of results, if any. -func (client LocationClient) listSupportedCloudServiceSkusNextResults(ctx context.Context, lastResults SupportedSkusResult) (result SupportedSkusResult, err error) { - req, err := lastResults.supportedSkusResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedCloudServiceSkusNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSupportedCloudServiceSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedCloudServiceSkusNextResults", resp, "Failure sending next results request") - } - result, err = client.ListSupportedCloudServiceSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedCloudServiceSkusNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListSupportedCloudServiceSkusComplete enumerates all values, automatically crossing page boundaries as required. -func (client LocationClient) ListSupportedCloudServiceSkusComplete(ctx context.Context, locationName string, maxresults *int32, filter string) (result SupportedSkusResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListSupportedCloudServiceSkus") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListSupportedCloudServiceSkus(ctx, locationName, maxresults, filter) - return -} - -// ListSupportedVirtualMachineSkus gets the list of Batch supported Virtual Machine VM sizes available at the given -// location. -// Parameters: -// locationName - the region for which to retrieve Batch service supported SKUs. -// maxresults - the maximum number of items to return in the response. -// filter - oData filter expression. Valid properties for filtering are "familyName". -func (client LocationClient) ListSupportedVirtualMachineSkus(ctx context.Context, locationName string, maxresults *int32, filter string) (result SupportedSkusResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListSupportedVirtualMachineSkus") - defer func() { - sc := -1 - if result.ssr.Response.Response != nil { - sc = result.ssr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listSupportedVirtualMachineSkusNextResults - req, err := client.ListSupportedVirtualMachineSkusPreparer(ctx, locationName, maxresults, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedVirtualMachineSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListSupportedVirtualMachineSkusSender(req) - if err != nil { - result.ssr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedVirtualMachineSkus", resp, "Failure sending request") - return - } - - result.ssr, err = client.ListSupportedVirtualMachineSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "ListSupportedVirtualMachineSkus", resp, "Failure responding to request") - return - } - if result.ssr.hasNextLink() && result.ssr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListSupportedVirtualMachineSkusPreparer prepares the ListSupportedVirtualMachineSkus request. -func (client LocationClient) ListSupportedVirtualMachineSkusPreparer(ctx context.Context, locationName string, maxresults *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSupportedVirtualMachineSkusSender sends the ListSupportedVirtualMachineSkus request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) ListSupportedVirtualMachineSkusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSupportedVirtualMachineSkusResponder handles the response to the ListSupportedVirtualMachineSkus request. The method always -// closes the http.Response Body. -func (client LocationClient) ListSupportedVirtualMachineSkusResponder(resp *http.Response) (result SupportedSkusResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listSupportedVirtualMachineSkusNextResults retrieves the next set of results, if any. -func (client LocationClient) listSupportedVirtualMachineSkusNextResults(ctx context.Context, lastResults SupportedSkusResult) (result SupportedSkusResult, err error) { - req, err := lastResults.supportedSkusResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedVirtualMachineSkusNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSupportedVirtualMachineSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedVirtualMachineSkusNextResults", resp, "Failure sending next results request") - } - result, err = client.ListSupportedVirtualMachineSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "listSupportedVirtualMachineSkusNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListSupportedVirtualMachineSkusComplete enumerates all values, automatically crossing page boundaries as required. -func (client LocationClient) ListSupportedVirtualMachineSkusComplete(ctx context.Context, locationName string, maxresults *int32, filter string) (result SupportedSkusResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListSupportedVirtualMachineSkus") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListSupportedVirtualMachineSkus(ctx, locationName, maxresults, filter) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/models.go deleted file mode 100644 index 58e84aa89932..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/models.go +++ /dev/null @@ -1,4075 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" - -// Account contains information about an Azure Batch account. -type Account struct { - autorest.Response `json:"-"` - // AccountProperties - The properties associated with the account. - *AccountProperties `json:"properties,omitempty"` - // Identity - The identity of the Batch account. - Identity *AccountIdentity `json:"identity,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - READ-ONLY; The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - READ-ONLY; The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Account. -func (a Account) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.AccountProperties != nil { - objectMap["properties"] = a.AccountProperties - } - if a.Identity != nil { - objectMap["identity"] = a.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Account struct. -func (a *Account) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var accountProperties AccountProperties - err = json.Unmarshal(*v, &accountProperties) - if err != nil { - return err - } - a.AccountProperties = &accountProperties - } - case "identity": - if v != nil { - var identity AccountIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - a.Identity = &identity - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - a.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - a.Tags = tags - } - } - } - - return nil -} - -// AccountCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountClient) (Account, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountCreateFuture.Result. -func (future *AccountCreateFuture) result(client AccountClient) (a Account, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - a.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("batch.AccountCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { - a, err = client.CreateResponder(a.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountCreateFuture", "Result", a.Response.Response, "Failure responding to request") - } - } - return -} - -// AccountCreateParameters parameters supplied to the Create operation. -type AccountCreateParameters struct { - // Location - The region in which to create the account. - Location *string `json:"location,omitempty"` - // Tags - The user-specified tags associated with the account. - Tags map[string]*string `json:"tags"` - // AccountCreateProperties - The properties of the Batch account. - *AccountCreateProperties `json:"properties,omitempty"` - // Identity - The identity of the Batch account. - Identity *AccountIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountCreateParameters. -func (acp AccountCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acp.Location != nil { - objectMap["location"] = acp.Location - } - if acp.Tags != nil { - objectMap["tags"] = acp.Tags - } - if acp.AccountCreateProperties != nil { - objectMap["properties"] = acp.AccountCreateProperties - } - if acp.Identity != nil { - objectMap["identity"] = acp.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccountCreateParameters struct. -func (acp *AccountCreateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - acp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - acp.Tags = tags - } - case "properties": - if v != nil { - var accountCreateProperties AccountCreateProperties - err = json.Unmarshal(*v, &accountCreateProperties) - if err != nil { - return err - } - acp.AccountCreateProperties = &accountCreateProperties - } - case "identity": - if v != nil { - var identity AccountIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - acp.Identity = &identity - } - } - } - - return nil -} - -// AccountCreateProperties the properties of a Batch account. -type AccountCreateProperties struct { - // AutoStorage - The properties related to the auto-storage account. - AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` - // PoolAllocationMode - The pool allocation mode also affects how clients may authenticate to the Batch Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService. Possible values include: 'PoolAllocationModeBatchService', 'PoolAllocationModeUserSubscription' - PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` - // KeyVaultReference - A reference to the Azure key vault associated with the Batch account. - KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` - // PublicNetworkAccess - If not specified, the default value is 'enabled'. Possible values include: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' - PublicNetworkAccess PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` - // Encryption - Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. - Encryption *EncryptionProperties `json:"encryption,omitempty"` - // AllowedAuthenticationModes - List of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane. - AllowedAuthenticationModes *[]AuthenticationMode `json:"allowedAuthenticationModes,omitempty"` -} - -// AccountDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountDeleteFuture.Result. -func (future *AccountDeleteFuture) result(client AccountClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("batch.AccountDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AccountIdentity the identity of the Batch account, if configured. This is used when the user specifies -// 'Microsoft.KeyVault' as their Batch account encryption configuration or when `ManagedIdentity` is -// selected as the auto-storage authentication mode. -type AccountIdentity struct { - // PrincipalID - READ-ONLY; The principal id of the Batch account. This property will only be provided for a system assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant id associated with the Batch account. This property will only be provided for a system assigned identity. - TenantID *string `json:"tenantId,omitempty"` - // Type - The type of identity used for the Batch account. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeNone' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the Batch account. - UserAssignedIdentities map[string]*UserAssignedIdentities `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for AccountIdentity. -func (ai AccountIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ai.Type != "" { - objectMap["type"] = ai.Type - } - if ai.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = ai.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// AccountKeys a set of Azure Batch account keys. -type AccountKeys struct { - autorest.Response `json:"-"` - // AccountName - READ-ONLY; The Batch account name. - AccountName *string `json:"accountName,omitempty"` - // Primary - READ-ONLY; The primary key associated with the account. - Primary *string `json:"primary,omitempty"` - // Secondary - READ-ONLY; The secondary key associated with the account. - Secondary *string `json:"secondary,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountKeys. -func (ak AccountKeys) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AccountListResult values returned by the List operation. -type AccountListResult struct { - autorest.Response `json:"-"` - // Value - The collection of Batch accounts returned by the listing operation. - Value *[]Account `json:"value,omitempty"` - // NextLink - The continuation token. - NextLink *string `json:"nextLink,omitempty"` -} - -// AccountListResultIterator provides access to a complete listing of Account values. -type AccountListResultIterator struct { - i int - page AccountListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AccountListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AccountListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AccountListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AccountListResultIterator) Response() AccountListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AccountListResultIterator) Value() Account { - if !iter.page.NotDone() { - return Account{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AccountListResultIterator type. -func NewAccountListResultIterator(page AccountListResultPage) AccountListResultIterator { - return AccountListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (alr AccountListResult) IsEmpty() bool { - return alr.Value == nil || len(*alr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (alr AccountListResult) hasNextLink() bool { - return alr.NextLink != nil && len(*alr.NextLink) != 0 -} - -// accountListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (alr AccountListResult) accountListResultPreparer(ctx context.Context) (*http.Request, error) { - if !alr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(alr.NextLink))) -} - -// AccountListResultPage contains a page of Account values. -type AccountListResultPage struct { - fn func(context.Context, AccountListResult) (AccountListResult, error) - alr AccountListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AccountListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.alr) - if err != nil { - return err - } - page.alr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AccountListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AccountListResultPage) NotDone() bool { - return !page.alr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AccountListResultPage) Response() AccountListResult { - return page.alr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AccountListResultPage) Values() []Account { - if page.alr.IsEmpty() { - return nil - } - return *page.alr.Value -} - -// Creates a new instance of the AccountListResultPage type. -func NewAccountListResultPage(cur AccountListResult, getNextPage func(context.Context, AccountListResult) (AccountListResult, error)) AccountListResultPage { - return AccountListResultPage{ - fn: getNextPage, - alr: cur, - } -} - -// AccountProperties account specific properties. -type AccountProperties struct { - // AccountEndpoint - READ-ONLY; The account endpoint used to interact with the Batch service. - AccountEndpoint *string `json:"accountEndpoint,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateInvalid', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCancelled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // PoolAllocationMode - READ-ONLY; Possible values include: 'PoolAllocationModeBatchService', 'PoolAllocationModeUserSubscription' - PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` - // KeyVaultReference - READ-ONLY - KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` - // PublicNetworkAccess - READ-ONLY; If not specified, the default value is 'enabled'. Possible values include: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' - PublicNetworkAccess PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections associated with the Batch account - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // AutoStorage - READ-ONLY - AutoStorage *AutoStorageProperties `json:"autoStorage,omitempty"` - // Encryption - READ-ONLY; Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. - Encryption *EncryptionProperties `json:"encryption,omitempty"` - // DedicatedCoreQuota - READ-ONLY; For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the subscription so this value is not returned. - DedicatedCoreQuota *int32 `json:"dedicatedCoreQuota,omitempty"` - // LowPriorityCoreQuota - READ-ONLY; For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the subscription so this value is not returned. - LowPriorityCoreQuota *int32 `json:"lowPriorityCoreQuota,omitempty"` - // DedicatedCoreQuotaPerVMFamily - READ-ONLY; A list of the dedicated core quota per Virtual Machine family for the Batch account. For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the subscription so this value is not returned. - DedicatedCoreQuotaPerVMFamily *[]VirtualMachineFamilyCoreQuota `json:"dedicatedCoreQuotaPerVMFamily,omitempty"` - // DedicatedCoreQuotaPerVMFamilyEnforced - READ-ONLY; Batch is transitioning its core quota system for dedicated cores to be enforced per Virtual Machine family. During this transitional phase, the dedicated core quota per Virtual Machine family may not yet be enforced. If this flag is false, dedicated core quota is enforced via the old dedicatedCoreQuota property on the account and does not consider Virtual Machine family. If this flag is true, dedicated core quota is enforced via the dedicatedCoreQuotaPerVMFamily property on the account, and the old dedicatedCoreQuota does not apply. - DedicatedCoreQuotaPerVMFamilyEnforced *bool `json:"dedicatedCoreQuotaPerVMFamilyEnforced,omitempty"` - // PoolQuota - READ-ONLY - PoolQuota *int32 `json:"poolQuota,omitempty"` - // ActiveJobAndJobScheduleQuota - READ-ONLY - ActiveJobAndJobScheduleQuota *int32 `json:"activeJobAndJobScheduleQuota,omitempty"` - // AllowedAuthenticationModes - READ-ONLY; List of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane. - AllowedAuthenticationModes *[]AuthenticationMode `json:"allowedAuthenticationModes,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountProperties. -func (ap AccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AccountRegenerateKeyParameters parameters supplied to the RegenerateKey operation. -type AccountRegenerateKeyParameters struct { - // KeyName - The type of account key to regenerate. Possible values include: 'AccountKeyTypePrimary', 'AccountKeyTypeSecondary' - KeyName AccountKeyType `json:"keyName,omitempty"` -} - -// AccountUpdateParameters parameters for updating an Azure Batch account. -type AccountUpdateParameters struct { - // Tags - The user-specified tags associated with the account. - Tags map[string]*string `json:"tags"` - // AccountUpdateProperties - The properties of the account. - *AccountUpdateProperties `json:"properties,omitempty"` - // Identity - The identity of the Batch account. - Identity *AccountIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountUpdateParameters. -func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aup.Tags != nil { - objectMap["tags"] = aup.Tags - } - if aup.AccountUpdateProperties != nil { - objectMap["properties"] = aup.AccountUpdateProperties - } - if aup.Identity != nil { - objectMap["identity"] = aup.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccountUpdateParameters struct. -func (aup *AccountUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - aup.Tags = tags - } - case "properties": - if v != nil { - var accountUpdateProperties AccountUpdateProperties - err = json.Unmarshal(*v, &accountUpdateProperties) - if err != nil { - return err - } - aup.AccountUpdateProperties = &accountUpdateProperties - } - case "identity": - if v != nil { - var identity AccountIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - aup.Identity = &identity - } - } - } - - return nil -} - -// AccountUpdateProperties the properties of a Batch account. -type AccountUpdateProperties struct { - // AutoStorage - The properties related to the auto-storage account. - AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` - // Encryption - Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. - Encryption *EncryptionProperties `json:"encryption,omitempty"` - // AllowedAuthenticationModes - List of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane. - AllowedAuthenticationModes *[]AuthenticationMode `json:"allowedAuthenticationModes,omitempty"` -} - -// ActivateApplicationPackageParameters parameters for an activating an application package. -type ActivateApplicationPackageParameters struct { - // Format - The format of the application package binary file. - Format *string `json:"format,omitempty"` -} - -// Application contains information about an application in a Batch account. -type Application struct { - autorest.Response `json:"-"` - // ApplicationProperties - The properties associated with the Application. - *ApplicationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Application. -func (a Application) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.ApplicationProperties != nil { - objectMap["properties"] = a.ApplicationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Application struct. -func (a *Application) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationProperties ApplicationProperties - err = json.Unmarshal(*v, &applicationProperties) - if err != nil { - return err - } - a.ApplicationProperties = &applicationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - a.Etag = &etag - } - } - } - - return nil -} - -// ApplicationPackage an application package which represents a particular version of an application. -type ApplicationPackage struct { - autorest.Response `json:"-"` - // ApplicationPackageProperties - The properties associated with the Application Package. - *ApplicationPackageProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationPackage. -func (ap ApplicationPackage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.ApplicationPackageProperties != nil { - objectMap["properties"] = ap.ApplicationPackageProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationPackage struct. -func (ap *ApplicationPackage) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationPackageProperties ApplicationPackageProperties - err = json.Unmarshal(*v, &applicationPackageProperties) - if err != nil { - return err - } - ap.ApplicationPackageProperties = &applicationPackageProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ap.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ap.Etag = &etag - } - } - } - - return nil -} - -// ApplicationPackageProperties properties of an application package -type ApplicationPackageProperties struct { - // State - READ-ONLY; The current state of the application package. Possible values include: 'PackageStatePending', 'PackageStateActive' - State PackageState `json:"state,omitempty"` - // Format - READ-ONLY; The format of the application package, if the package is active. - Format *string `json:"format,omitempty"` - // StorageURL - READ-ONLY; The URL for the application package in Azure Storage. - StorageURL *string `json:"storageUrl,omitempty"` - // StorageURLExpiry - READ-ONLY; The UTC time at which the Azure Storage URL will expire. - StorageURLExpiry *date.Time `json:"storageUrlExpiry,omitempty"` - // LastActivationTime - READ-ONLY; The time at which the package was last activated, if the package is active. - LastActivationTime *date.Time `json:"lastActivationTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationPackageProperties. -func (app ApplicationPackageProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ApplicationPackageReference ... -type ApplicationPackageReference struct { - ID *string `json:"id,omitempty"` - // Version - If this is omitted, and no default version is specified for this application, the request fails with the error code InvalidApplicationPackageReferences. If you are calling the REST API directly, the HTTP status code is 409. - Version *string `json:"version,omitempty"` -} - -// ApplicationProperties the properties associated with the Application. -type ApplicationProperties struct { - // DisplayName - The display name for the application. - DisplayName *string `json:"displayName,omitempty"` - // AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string. - AllowUpdates *bool `json:"allowUpdates,omitempty"` - // DefaultVersion - The package to use if a client requests the application but does not specify a version. This property can only be set to the name of an existing package. - DefaultVersion *string `json:"defaultVersion,omitempty"` -} - -// AutoScaleRun ... -type AutoScaleRun struct { - EvaluationTime *date.Time `json:"evaluationTime,omitempty"` - // Results - Each variable value is returned in the form $variable=value, and variables are separated by semicolons. - Results *string `json:"results,omitempty"` - Error *AutoScaleRunError `json:"error,omitempty"` -} - -// AutoScaleRunError ... -type AutoScaleRunError struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - Details *[]AutoScaleRunError `json:"details,omitempty"` -} - -// AutoScaleSettings ... -type AutoScaleSettings struct { - Formula *string `json:"formula,omitempty"` - // EvaluationInterval - If omitted, the default value is 15 minutes (PT15M). - EvaluationInterval *string `json:"evaluationInterval,omitempty"` -} - -// AutoStorageBaseProperties the properties related to the auto-storage account. -type AutoStorageBaseProperties struct { - // StorageAccountID - The resource ID of the storage account to be used for auto-storage account. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // AuthenticationMode - The authentication mode which the Batch service will use to manage the auto-storage account. Possible values include: 'AutoStorageAuthenticationModeStorageKeys', 'AutoStorageAuthenticationModeBatchAccountManagedIdentity' - AuthenticationMode AutoStorageAuthenticationMode `json:"authenticationMode,omitempty"` - // NodeIdentityReference - The identity referenced here must be assigned to pools which have compute nodes that need access to auto-storage. - NodeIdentityReference *ComputeNodeIdentityReference `json:"nodeIdentityReference,omitempty"` -} - -// AutoStorageProperties contains information about the auto-storage account associated with a Batch -// account. -type AutoStorageProperties struct { - // LastKeySync - The UTC time at which storage keys were last synchronized with the Batch account. - LastKeySync *date.Time `json:"lastKeySync,omitempty"` - // StorageAccountID - The resource ID of the storage account to be used for auto-storage account. - StorageAccountID *string `json:"storageAccountId,omitempty"` - // AuthenticationMode - The authentication mode which the Batch service will use to manage the auto-storage account. Possible values include: 'AutoStorageAuthenticationModeStorageKeys', 'AutoStorageAuthenticationModeBatchAccountManagedIdentity' - AuthenticationMode AutoStorageAuthenticationMode `json:"authenticationMode,omitempty"` - // NodeIdentityReference - The identity referenced here must be assigned to pools which have compute nodes that need access to auto-storage. - NodeIdentityReference *ComputeNodeIdentityReference `json:"nodeIdentityReference,omitempty"` -} - -// AutoUserSpecification ... -type AutoUserSpecification struct { - // Scope - The default value is Pool. If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way which could impact other tasks, or if certificates have been specified on the pool which should not be accessible by normal tasks but should be accessible by start tasks. Possible values include: 'AutoUserScopeTask', 'AutoUserScopePool' - Scope AutoUserScope `json:"scope,omitempty"` - // ElevationLevel - The default value is nonAdmin. Possible values include: 'ElevationLevelNonAdmin', 'ElevationLevelAdmin' - ElevationLevel ElevationLevel `json:"elevationLevel,omitempty"` -} - -// AzureBlobFileSystemConfiguration ... -type AzureBlobFileSystemConfiguration struct { - AccountName *string `json:"accountName,omitempty"` - ContainerName *string `json:"containerName,omitempty"` - // AccountKey - This property is mutually exclusive with both sasKey and identity; exactly one must be specified. - AccountKey *string `json:"accountKey,omitempty"` - // SasKey - This property is mutually exclusive with both accountKey and identity; exactly one must be specified. - SasKey *string `json:"sasKey,omitempty"` - // BlobfuseOptions - These are 'net use' options in Windows and 'mount' options in Linux. - BlobfuseOptions *string `json:"blobfuseOptions,omitempty"` - // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - RelativeMountPath *string `json:"relativeMountPath,omitempty"` - // IdentityReference - This property is mutually exclusive with both accountKey and sasKey; exactly one must be specified. - IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` -} - -// AzureFileShareConfiguration ... -type AzureFileShareConfiguration struct { - AccountName *string `json:"accountName,omitempty"` - // AzureFileURL - This is of the form 'https://{account}.file.core.windows.net/'. - AzureFileURL *string `json:"azureFileUrl,omitempty"` - AccountKey *string `json:"accountKey,omitempty"` - // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - RelativeMountPath *string `json:"relativeMountPath,omitempty"` - // MountOptions - These are 'net use' options in Windows and 'mount' options in Linux. - MountOptions *string `json:"mountOptions,omitempty"` -} - -// Certificate contains information about a certificate. -type Certificate struct { - autorest.Response `json:"-"` - // CertificateProperties - The properties associated with the certificate. - *CertificateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Certificate. -func (c Certificate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.CertificateProperties != nil { - objectMap["properties"] = c.CertificateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Certificate struct. -func (c *Certificate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var certificateProperties CertificateProperties - err = json.Unmarshal(*v, &certificateProperties) - if err != nil { - return err - } - c.CertificateProperties = &certificateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - c.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - c.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - c.Etag = &etag - } - } - } - - return nil -} - -// CertificateBaseProperties base certificate properties. -type CertificateBaseProperties struct { - // ThumbprintAlgorithm - This must match the first portion of the certificate name. Currently required to be 'SHA1'. - ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` - // Thumbprint - This must match the thumbprint from the name. - Thumbprint *string `json:"thumbprint,omitempty"` - // Format - The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: 'CertificateFormatPfx', 'CertificateFormatCer' - Format CertificateFormat `json:"format,omitempty"` -} - -// CertificateCreateOrUpdateParameters contains information about a certificate. -type CertificateCreateOrUpdateParameters struct { - // CertificateCreateOrUpdateProperties - The properties associated with the certificate. - *CertificateCreateOrUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateCreateOrUpdateParameters. -func (ccoup CertificateCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccoup.CertificateCreateOrUpdateProperties != nil { - objectMap["properties"] = ccoup.CertificateCreateOrUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CertificateCreateOrUpdateParameters struct. -func (ccoup *CertificateCreateOrUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var certificateCreateOrUpdateProperties CertificateCreateOrUpdateProperties - err = json.Unmarshal(*v, &certificateCreateOrUpdateProperties) - if err != nil { - return err - } - ccoup.CertificateCreateOrUpdateProperties = &certificateCreateOrUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ccoup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ccoup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ccoup.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ccoup.Etag = &etag - } - } - } - - return nil -} - -// CertificateCreateOrUpdateProperties certificate properties for create operations -type CertificateCreateOrUpdateProperties struct { - // Data - The maximum size is 10KB. - Data *string `json:"data,omitempty"` - // Password - This must not be specified if the certificate format is Cer. - Password *string `json:"password,omitempty"` - // ThumbprintAlgorithm - This must match the first portion of the certificate name. Currently required to be 'SHA1'. - ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` - // Thumbprint - This must match the thumbprint from the name. - Thumbprint *string `json:"thumbprint,omitempty"` - // Format - The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: 'CertificateFormatPfx', 'CertificateFormatCer' - Format CertificateFormat `json:"format,omitempty"` -} - -// CertificateDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type CertificateDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CertificateClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CertificateDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CertificateDeleteFuture.Result. -func (future *CertificateDeleteFuture) result(client CertificateClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.CertificateDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("batch.CertificateDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// CertificateProperties certificate properties. -type CertificateProperties struct { - // ProvisioningState - READ-ONLY; Possible values include: 'CertificateProvisioningStateSucceeded', 'CertificateProvisioningStateDeleting', 'CertificateProvisioningStateFailed' - ProvisioningState CertificateProvisioningState `json:"provisioningState,omitempty"` - // ProvisioningStateTransitionTime - READ-ONLY - ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` - // PreviousProvisioningState - READ-ONLY; The previous provisioned state of the resource. Possible values include: 'CertificateProvisioningStateSucceeded', 'CertificateProvisioningStateDeleting', 'CertificateProvisioningStateFailed' - PreviousProvisioningState CertificateProvisioningState `json:"previousProvisioningState,omitempty"` - // PreviousProvisioningStateTransitionTime - READ-ONLY - PreviousProvisioningStateTransitionTime *date.Time `json:"previousProvisioningStateTransitionTime,omitempty"` - // PublicData - READ-ONLY; The public key of the certificate. - PublicData *string `json:"publicData,omitempty"` - // DeleteCertificateError - READ-ONLY; This is only returned when the certificate provisioningState is 'Failed'. - DeleteCertificateError *DeleteCertificateError `json:"deleteCertificateError,omitempty"` - // ThumbprintAlgorithm - This must match the first portion of the certificate name. Currently required to be 'SHA1'. - ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` - // Thumbprint - This must match the thumbprint from the name. - Thumbprint *string `json:"thumbprint,omitempty"` - // Format - The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: 'CertificateFormatPfx', 'CertificateFormatCer' - Format CertificateFormat `json:"format,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateProperties. -func (cp CertificateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.ThumbprintAlgorithm != nil { - objectMap["thumbprintAlgorithm"] = cp.ThumbprintAlgorithm - } - if cp.Thumbprint != nil { - objectMap["thumbprint"] = cp.Thumbprint - } - if cp.Format != "" { - objectMap["format"] = cp.Format - } - return json.Marshal(objectMap) -} - -// CertificateReference ... -type CertificateReference struct { - ID *string `json:"id,omitempty"` - // StoreLocation - The default value is currentUser. This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. Possible values include: 'CertificateStoreLocationCurrentUser', 'CertificateStoreLocationLocalMachine' - StoreLocation CertificateStoreLocation `json:"storeLocation,omitempty"` - // StoreName - This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be used. The default value is My. - StoreName *string `json:"storeName,omitempty"` - Visibility *[]CertificateVisibility `json:"visibility,omitempty"` -} - -// CheckNameAvailabilityParameters parameters for a check name availability request. -type CheckNameAvailabilityParameters struct { - // Name - The name to check for availability - Name *string `json:"name,omitempty"` - // Type - The resource type. - Type *string `json:"type,omitempty"` -} - -// CheckNameAvailabilityResult the CheckNameAvailability operation response. -type CheckNameAvailabilityResult struct { - autorest.Response `json:"-"` - // NameAvailable - READ-ONLY; Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or invalid and cannot be used. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - READ-ONLY; Gets the reason that a Batch account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: 'NameAvailabilityReasonInvalid', 'NameAvailabilityReasonAlreadyExists' - Reason NameAvailabilityReason `json:"reason,omitempty"` - // Message - READ-ONLY; Gets an error message explaining the Reason value in more detail. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for CheckNameAvailabilityResult. -func (cnar CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CIFSMountConfiguration ... -type CIFSMountConfiguration struct { - Username *string `json:"username,omitempty"` - Source *string `json:"source,omitempty"` - // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - RelativeMountPath *string `json:"relativeMountPath,omitempty"` - // MountOptions - These are 'net use' options in Windows and 'mount' options in Linux. - MountOptions *string `json:"mountOptions,omitempty"` - Password *string `json:"password,omitempty"` -} - -// CloudError an error response from the Batch service. -type CloudError struct { - // Error - The body of the error response. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from the Batch service. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// CloudServiceConfiguration ... -type CloudServiceConfiguration struct { - // OsFamily - Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family 5, equivalent to Windows Server 2016. 6 - OS Family 6, equivalent to Windows Server 2019. For more information, see Azure Guest OS Releases (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). - OsFamily *string `json:"osFamily,omitempty"` - // OsVersion - The default value is * which specifies the latest operating system version for the specified OS family. - OsVersion *string `json:"osVersion,omitempty"` -} - -// ComputeNodeIdentityReference the reference to a user assigned identity associated with the Batch pool -// which a compute node will use. -type ComputeNodeIdentityReference struct { - // ResourceID - The ARM resource id of the user assigned identity. - ResourceID *string `json:"resourceId,omitempty"` -} - -// ContainerConfiguration ... -type ContainerConfiguration struct { - Type *string `json:"type,omitempty"` - // ContainerImageNames - This is the full image reference, as would be specified to "docker pull". An image will be sourced from the default Docker registry unless the image is fully qualified with an alternative registry. - ContainerImageNames *[]string `json:"containerImageNames,omitempty"` - // ContainerRegistries - If any images must be downloaded from a private registry which requires credentials, then those credentials must be provided here. - ContainerRegistries *[]ContainerRegistry `json:"containerRegistries,omitempty"` -} - -// ContainerRegistry ... -type ContainerRegistry struct { - UserName *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` - // RegistryServer - If omitted, the default is "docker.io". - RegistryServer *string `json:"registryServer,omitempty"` - IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` -} - -// DataDisk settings which will be used by the data disks associated to Compute Nodes in the Pool. When -// using attached data disks, you need to mount and format the disks from within a VM to use them. -type DataDisk struct { - // Lun - The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. The value must be between 0 and 63, inclusive. - Lun *int32 `json:"lun,omitempty"` - // Caching - Values are: - // none - The caching mode for the disk is not enabled. - // readOnly - The caching mode for the disk is read only. - // readWrite - The caching mode for the disk is read and write. - // The default value for caching is none. For information about the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. Possible values include: 'CachingTypeNone', 'CachingTypeReadOnly', 'CachingTypeReadWrite' - Caching CachingType `json:"caching,omitempty"` - DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` - // StorageAccountType - If omitted, the default is "Standard_LRS". Values are: - // Standard_LRS - The data disk should use standard locally redundant storage. - // Premium_LRS - The data disk should use premium locally redundant storage. Possible values include: 'StorageAccountTypeStandardLRS', 'StorageAccountTypePremiumLRS' - StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` -} - -// DeleteCertificateError an error response from the Batch service. -type DeleteCertificateError struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]DeleteCertificateError `json:"details,omitempty"` -} - -// DeploymentConfiguration ... -type DeploymentConfiguration struct { - // CloudServiceConfiguration - This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. This property cannot be specified if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. - CloudServiceConfiguration *CloudServiceConfiguration `json:"cloudServiceConfiguration,omitempty"` - // VirtualMachineConfiguration - This property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. - VirtualMachineConfiguration *VirtualMachineConfiguration `json:"virtualMachineConfiguration,omitempty"` -} - -// DetectorListResult values returned by the List operation. -type DetectorListResult struct { - autorest.Response `json:"-"` - // Value - The collection of Batch account detectors returned by the listing operation. - Value *[]DetectorResponse `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// DetectorListResultIterator provides access to a complete listing of DetectorResponse values. -type DetectorListResultIterator struct { - i int - page DetectorListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DetectorListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DetectorListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DetectorListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DetectorListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DetectorListResultIterator) Response() DetectorListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DetectorListResultIterator) Value() DetectorResponse { - if !iter.page.NotDone() { - return DetectorResponse{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DetectorListResultIterator type. -func NewDetectorListResultIterator(page DetectorListResultPage) DetectorListResultIterator { - return DetectorListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dlr DetectorListResult) IsEmpty() bool { - return dlr.Value == nil || len(*dlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dlr DetectorListResult) hasNextLink() bool { - return dlr.NextLink != nil && len(*dlr.NextLink) != 0 -} - -// detectorListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dlr DetectorListResult) detectorListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dlr.NextLink))) -} - -// DetectorListResultPage contains a page of DetectorResponse values. -type DetectorListResultPage struct { - fn func(context.Context, DetectorListResult) (DetectorListResult, error) - dlr DetectorListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DetectorListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DetectorListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dlr) - if err != nil { - return err - } - page.dlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DetectorListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DetectorListResultPage) NotDone() bool { - return !page.dlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DetectorListResultPage) Response() DetectorListResult { - return page.dlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DetectorListResultPage) Values() []DetectorResponse { - if page.dlr.IsEmpty() { - return nil - } - return *page.dlr.Value -} - -// Creates a new instance of the DetectorListResultPage type. -func NewDetectorListResultPage(cur DetectorListResult, getNextPage func(context.Context, DetectorListResult) (DetectorListResult, error)) DetectorListResultPage { - return DetectorListResultPage{ - fn: getNextPage, - dlr: cur, - } -} - -// DetectorResponse contains the information for a detector. -type DetectorResponse struct { - autorest.Response `json:"-"` - // DetectorResponseProperties - The properties associated with the detector. - *DetectorResponseProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for DetectorResponse. -func (dr DetectorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dr.DetectorResponseProperties != nil { - objectMap["properties"] = dr.DetectorResponseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DetectorResponse struct. -func (dr *DetectorResponse) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var detectorResponseProperties DetectorResponseProperties - err = json.Unmarshal(*v, &detectorResponseProperties) - if err != nil { - return err - } - dr.DetectorResponseProperties = &detectorResponseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dr.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dr.Etag = &etag - } - } - } - - return nil -} - -// DetectorResponseProperties detector response properties. -type DetectorResponseProperties struct { - // Value - A base64 encoded string that represents the content of a detector. - Value *string `json:"value,omitempty"` -} - -// DiffDiskSettings ... -type DiffDiskSettings struct { - // Placement - This property can be used by user in the request to choose which location the operating system should be in. e.g., cache disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk size requirements for Windows VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. Possible values include: 'DiffDiskPlacementCacheDisk' - Placement DiffDiskPlacement `json:"placement,omitempty"` -} - -// DiskEncryptionConfiguration the disk encryption configuration applied on compute nodes in the pool. Disk -// encryption configuration is not supported on Linux pool created with Virtual Machine Image or Shared -// Image Gallery Image. -type DiskEncryptionConfiguration struct { - // Targets - On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and "TemporaryDisk" must be specified. - Targets *[]DiskEncryptionTarget `json:"targets,omitempty"` -} - -// EncryptionProperties configures how customer data is encrypted inside the Batch account. By default, -// accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can -// be used instead. -type EncryptionProperties struct { - // KeySource - Type of the key source. Possible values include: 'KeySourceMicrosoftBatch', 'KeySourceMicrosoftKeyVault' - KeySource KeySource `json:"keySource,omitempty"` - // KeyVaultProperties - Additional details when using Microsoft.KeyVault - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` -} - -// EndpointDependency a domain name and connection details used to access a dependency. -type EndpointDependency struct { - // DomainName - READ-ONLY; The domain name of the dependency. Domain names may be fully qualified or may contain a * wildcard. - DomainName *string `json:"domainName,omitempty"` - // Description - READ-ONLY; Human-readable supplemental information about the dependency and when it is applicable. - Description *string `json:"description,omitempty"` - // EndpointDetails - READ-ONLY; The list of connection details for this endpoint. - EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` -} - -// MarshalJSON is the custom marshaler for EndpointDependency. -func (ed EndpointDependency) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EndpointDetail details about the connection between the Batch service and the endpoint. -type EndpointDetail struct { - // Port - READ-ONLY; The port an endpoint is connected to. - Port *int32 `json:"port,omitempty"` -} - -// MarshalJSON is the custom marshaler for EndpointDetail. -func (ed EndpointDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EnvironmentSetting ... -type EnvironmentSetting struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} - -// FixedScaleSettings ... -type FixedScaleSettings struct { - // ResizeTimeout - The default value is 15 minutes. Timeout values use ISO 8601 format. For example, use PT10M for 10 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service rejects the request with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). - ResizeTimeout *string `json:"resizeTimeout,omitempty"` - // TargetDedicatedNodes - At least one of targetDedicatedNodes, targetLowPriorityNodes must be set. - TargetDedicatedNodes *int32 `json:"targetDedicatedNodes,omitempty"` - // TargetLowPriorityNodes - At least one of targetDedicatedNodes, targetLowPriorityNodes must be set. - TargetLowPriorityNodes *int32 `json:"targetLowPriorityNodes,omitempty"` - // NodeDeallocationOption - If omitted, the default value is Requeue. Possible values include: 'ComputeNodeDeallocationOptionRequeue', 'ComputeNodeDeallocationOptionTerminate', 'ComputeNodeDeallocationOptionTaskCompletion', 'ComputeNodeDeallocationOptionRetainedData' - NodeDeallocationOption ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` -} - -// ImageReference ... -type ImageReference struct { - // Publisher - For example, Canonical or MicrosoftWindowsServer. - Publisher *string `json:"publisher,omitempty"` - // Offer - For example, UbuntuServer or WindowsServer. - Offer *string `json:"offer,omitempty"` - // Sku - For example, 18.04-LTS or 2022-datacenter. - Sku *string `json:"sku,omitempty"` - // Version - A value of 'latest' can be specified to select the latest version of an image. If omitted, the default is 'latest'. - Version *string `json:"version,omitempty"` - // ID - This property is mutually exclusive with other properties. The Shared Image Gallery image must have replicas in the same region as the Azure Batch account. For information about the firewall settings for the Batch node agent to communicate with the Batch service see https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. - ID *string `json:"id,omitempty"` -} - -// InboundNatPool ... -type InboundNatPool struct { - // Name - The name must be unique within a Batch pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. - Name *string `json:"name,omitempty"` - // Protocol - Possible values include: 'InboundEndpointProtocolTCP', 'InboundEndpointProtocolUDP' - Protocol InboundEndpointProtocol `json:"protocol,omitempty"` - // BackendPort - This must be unique within a Batch pool. Acceptable values are between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved values are provided the request fails with HTTP status code 400. - BackendPort *int32 `json:"backendPort,omitempty"` - // FrontendPortRangeStart - Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved. All ranges within a pool must be distinct and cannot overlap. If any reserved or overlapping values are provided the request fails with HTTP status code 400. - FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` - // FrontendPortRangeEnd - Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved by the Batch service. All ranges within a pool must be distinct and cannot overlap. If any reserved or overlapping values are provided the request fails with HTTP status code 400. - FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` - // NetworkSecurityGroupRules - The maximum number of rules that can be specified across all the endpoints on a Batch pool is 25. If no network security group rules are specified, a default rule will be created to allow inbound access to the specified backendPort. If the maximum number of network security group rules is exceeded the request fails with HTTP status code 400. - NetworkSecurityGroupRules *[]NetworkSecurityGroupRule `json:"networkSecurityGroupRules,omitempty"` -} - -// KeyVaultProperties keyVault configuration when using an encryption KeySource of Microsoft.KeyVault. -type KeyVaultProperties struct { - // KeyIdentifier - Full path to the versioned secret. Example https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. To be usable the following prerequisites must be met: - // The Batch Account has a System Assigned identity - // The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap permissions - // The KeyVault has soft-delete and purge protection enabled - KeyIdentifier *string `json:"keyIdentifier,omitempty"` -} - -// KeyVaultReference identifies the Azure key vault associated with a Batch account. -type KeyVaultReference struct { - // ID - The resource ID of the Azure key vault associated with the Batch account. - ID *string `json:"id,omitempty"` - // URL - The URL of the Azure key vault associated with the Batch account. - URL *string `json:"url,omitempty"` -} - -// LinuxUserConfiguration ... -type LinuxUserConfiguration struct { - // UID - The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the uid. - UID *int32 `json:"uid,omitempty"` - // Gid - The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the gid. - Gid *int32 `json:"gid,omitempty"` - // SSHPrivateKey - The private key must not be password protected. The private key is used to automatically configure asymmetric-key based authentication for SSH between nodes in a Linux pool when the pool's enableInterNodeCommunication property is true (it is ignored if enableInterNodeCommunication is false). It does this by placing the key pair into the user's .ssh directory. If not specified, password-less SSH is not configured between nodes (no modification of the user's .ssh directory is done). - SSHPrivateKey *string `json:"sshPrivateKey,omitempty"` -} - -// ListApplicationPackagesResult the result of performing list application packages. -type ListApplicationPackagesResult struct { - autorest.Response `json:"-"` - // Value - The list of application packages. - Value *[]ApplicationPackage `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListApplicationPackagesResultIterator provides access to a complete listing of ApplicationPackage -// values. -type ListApplicationPackagesResultIterator struct { - i int - page ListApplicationPackagesResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListApplicationPackagesResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationPackagesResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListApplicationPackagesResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListApplicationPackagesResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListApplicationPackagesResultIterator) Response() ListApplicationPackagesResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListApplicationPackagesResultIterator) Value() ApplicationPackage { - if !iter.page.NotDone() { - return ApplicationPackage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListApplicationPackagesResultIterator type. -func NewListApplicationPackagesResultIterator(page ListApplicationPackagesResultPage) ListApplicationPackagesResultIterator { - return ListApplicationPackagesResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lapr ListApplicationPackagesResult) IsEmpty() bool { - return lapr.Value == nil || len(*lapr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lapr ListApplicationPackagesResult) hasNextLink() bool { - return lapr.NextLink != nil && len(*lapr.NextLink) != 0 -} - -// listApplicationPackagesResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lapr ListApplicationPackagesResult) listApplicationPackagesResultPreparer(ctx context.Context) (*http.Request, error) { - if !lapr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lapr.NextLink))) -} - -// ListApplicationPackagesResultPage contains a page of ApplicationPackage values. -type ListApplicationPackagesResultPage struct { - fn func(context.Context, ListApplicationPackagesResult) (ListApplicationPackagesResult, error) - lapr ListApplicationPackagesResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListApplicationPackagesResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationPackagesResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lapr) - if err != nil { - return err - } - page.lapr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListApplicationPackagesResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListApplicationPackagesResultPage) NotDone() bool { - return !page.lapr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListApplicationPackagesResultPage) Response() ListApplicationPackagesResult { - return page.lapr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListApplicationPackagesResultPage) Values() []ApplicationPackage { - if page.lapr.IsEmpty() { - return nil - } - return *page.lapr.Value -} - -// Creates a new instance of the ListApplicationPackagesResultPage type. -func NewListApplicationPackagesResultPage(cur ListApplicationPackagesResult, getNextPage func(context.Context, ListApplicationPackagesResult) (ListApplicationPackagesResult, error)) ListApplicationPackagesResultPage { - return ListApplicationPackagesResultPage{ - fn: getNextPage, - lapr: cur, - } -} - -// ListApplicationsResult the result of performing list applications. -type ListApplicationsResult struct { - autorest.Response `json:"-"` - // Value - The list of applications. - Value *[]Application `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListApplicationsResultIterator provides access to a complete listing of Application values. -type ListApplicationsResultIterator struct { - i int - page ListApplicationsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListApplicationsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListApplicationsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListApplicationsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListApplicationsResultIterator) Response() ListApplicationsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListApplicationsResultIterator) Value() Application { - if !iter.page.NotDone() { - return Application{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListApplicationsResultIterator type. -func NewListApplicationsResultIterator(page ListApplicationsResultPage) ListApplicationsResultIterator { - return ListApplicationsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lar ListApplicationsResult) IsEmpty() bool { - return lar.Value == nil || len(*lar.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lar ListApplicationsResult) hasNextLink() bool { - return lar.NextLink != nil && len(*lar.NextLink) != 0 -} - -// listApplicationsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lar ListApplicationsResult) listApplicationsResultPreparer(ctx context.Context) (*http.Request, error) { - if !lar.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lar.NextLink))) -} - -// ListApplicationsResultPage contains a page of Application values. -type ListApplicationsResultPage struct { - fn func(context.Context, ListApplicationsResult) (ListApplicationsResult, error) - lar ListApplicationsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListApplicationsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lar) - if err != nil { - return err - } - page.lar = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListApplicationsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListApplicationsResultPage) NotDone() bool { - return !page.lar.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListApplicationsResultPage) Response() ListApplicationsResult { - return page.lar -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListApplicationsResultPage) Values() []Application { - if page.lar.IsEmpty() { - return nil - } - return *page.lar.Value -} - -// Creates a new instance of the ListApplicationsResultPage type. -func NewListApplicationsResultPage(cur ListApplicationsResult, getNextPage func(context.Context, ListApplicationsResult) (ListApplicationsResult, error)) ListApplicationsResultPage { - return ListApplicationsResultPage{ - fn: getNextPage, - lar: cur, - } -} - -// ListCertificatesResult values returned by the List operation. -type ListCertificatesResult struct { - autorest.Response `json:"-"` - // Value - The collection of returned certificates. - Value *[]Certificate `json:"value,omitempty"` - // NextLink - The continuation token. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListCertificatesResultIterator provides access to a complete listing of Certificate values. -type ListCertificatesResultIterator struct { - i int - page ListCertificatesResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListCertificatesResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListCertificatesResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListCertificatesResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListCertificatesResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListCertificatesResultIterator) Response() ListCertificatesResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListCertificatesResultIterator) Value() Certificate { - if !iter.page.NotDone() { - return Certificate{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListCertificatesResultIterator type. -func NewListCertificatesResultIterator(page ListCertificatesResultPage) ListCertificatesResultIterator { - return ListCertificatesResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lcr ListCertificatesResult) IsEmpty() bool { - return lcr.Value == nil || len(*lcr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lcr ListCertificatesResult) hasNextLink() bool { - return lcr.NextLink != nil && len(*lcr.NextLink) != 0 -} - -// listCertificatesResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lcr ListCertificatesResult) listCertificatesResultPreparer(ctx context.Context) (*http.Request, error) { - if !lcr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lcr.NextLink))) -} - -// ListCertificatesResultPage contains a page of Certificate values. -type ListCertificatesResultPage struct { - fn func(context.Context, ListCertificatesResult) (ListCertificatesResult, error) - lcr ListCertificatesResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListCertificatesResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListCertificatesResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lcr) - if err != nil { - return err - } - page.lcr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListCertificatesResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListCertificatesResultPage) NotDone() bool { - return !page.lcr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListCertificatesResultPage) Response() ListCertificatesResult { - return page.lcr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListCertificatesResultPage) Values() []Certificate { - if page.lcr.IsEmpty() { - return nil - } - return *page.lcr.Value -} - -// Creates a new instance of the ListCertificatesResultPage type. -func NewListCertificatesResultPage(cur ListCertificatesResult, getNextPage func(context.Context, ListCertificatesResult) (ListCertificatesResult, error)) ListCertificatesResultPage { - return ListCertificatesResultPage{ - fn: getNextPage, - lcr: cur, - } -} - -// ListPoolsResult values returned by the List operation. -type ListPoolsResult struct { - autorest.Response `json:"-"` - // Value - The collection of returned pools. - Value *[]Pool `json:"value,omitempty"` - // NextLink - The continuation token. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListPoolsResultIterator provides access to a complete listing of Pool values. -type ListPoolsResultIterator struct { - i int - page ListPoolsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListPoolsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListPoolsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListPoolsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListPoolsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListPoolsResultIterator) Response() ListPoolsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListPoolsResultIterator) Value() Pool { - if !iter.page.NotDone() { - return Pool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListPoolsResultIterator type. -func NewListPoolsResultIterator(page ListPoolsResultPage) ListPoolsResultIterator { - return ListPoolsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lpr ListPoolsResult) IsEmpty() bool { - return lpr.Value == nil || len(*lpr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lpr ListPoolsResult) hasNextLink() bool { - return lpr.NextLink != nil && len(*lpr.NextLink) != 0 -} - -// listPoolsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lpr ListPoolsResult) listPoolsResultPreparer(ctx context.Context) (*http.Request, error) { - if !lpr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lpr.NextLink))) -} - -// ListPoolsResultPage contains a page of Pool values. -type ListPoolsResultPage struct { - fn func(context.Context, ListPoolsResult) (ListPoolsResult, error) - lpr ListPoolsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListPoolsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListPoolsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lpr) - if err != nil { - return err - } - page.lpr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListPoolsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListPoolsResultPage) NotDone() bool { - return !page.lpr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListPoolsResultPage) Response() ListPoolsResult { - return page.lpr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListPoolsResultPage) Values() []Pool { - if page.lpr.IsEmpty() { - return nil - } - return *page.lpr.Value -} - -// Creates a new instance of the ListPoolsResultPage type. -func NewListPoolsResultPage(cur ListPoolsResult, getNextPage func(context.Context, ListPoolsResult) (ListPoolsResult, error)) ListPoolsResultPage { - return ListPoolsResultPage{ - fn: getNextPage, - lpr: cur, - } -} - -// ListPrivateEndpointConnectionsResult values returned by the List operation. -type ListPrivateEndpointConnectionsResult struct { - autorest.Response `json:"-"` - // Value - The collection of returned private endpoint connection. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - The continuation token. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListPrivateEndpointConnectionsResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type ListPrivateEndpointConnectionsResultIterator struct { - i int - page ListPrivateEndpointConnectionsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListPrivateEndpointConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateEndpointConnectionsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListPrivateEndpointConnectionsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListPrivateEndpointConnectionsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListPrivateEndpointConnectionsResultIterator) Response() ListPrivateEndpointConnectionsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListPrivateEndpointConnectionsResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListPrivateEndpointConnectionsResultIterator type. -func NewListPrivateEndpointConnectionsResultIterator(page ListPrivateEndpointConnectionsResultPage) ListPrivateEndpointConnectionsResultIterator { - return ListPrivateEndpointConnectionsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lpecr ListPrivateEndpointConnectionsResult) IsEmpty() bool { - return lpecr.Value == nil || len(*lpecr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lpecr ListPrivateEndpointConnectionsResult) hasNextLink() bool { - return lpecr.NextLink != nil && len(*lpecr.NextLink) != 0 -} - -// listPrivateEndpointConnectionsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lpecr ListPrivateEndpointConnectionsResult) listPrivateEndpointConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { - if !lpecr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lpecr.NextLink))) -} - -// ListPrivateEndpointConnectionsResultPage contains a page of PrivateEndpointConnection values. -type ListPrivateEndpointConnectionsResultPage struct { - fn func(context.Context, ListPrivateEndpointConnectionsResult) (ListPrivateEndpointConnectionsResult, error) - lpecr ListPrivateEndpointConnectionsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListPrivateEndpointConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateEndpointConnectionsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lpecr) - if err != nil { - return err - } - page.lpecr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListPrivateEndpointConnectionsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListPrivateEndpointConnectionsResultPage) NotDone() bool { - return !page.lpecr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListPrivateEndpointConnectionsResultPage) Response() ListPrivateEndpointConnectionsResult { - return page.lpecr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListPrivateEndpointConnectionsResultPage) Values() []PrivateEndpointConnection { - if page.lpecr.IsEmpty() { - return nil - } - return *page.lpecr.Value -} - -// Creates a new instance of the ListPrivateEndpointConnectionsResultPage type. -func NewListPrivateEndpointConnectionsResultPage(cur ListPrivateEndpointConnectionsResult, getNextPage func(context.Context, ListPrivateEndpointConnectionsResult) (ListPrivateEndpointConnectionsResult, error)) ListPrivateEndpointConnectionsResultPage { - return ListPrivateEndpointConnectionsResultPage{ - fn: getNextPage, - lpecr: cur, - } -} - -// ListPrivateLinkResourcesResult values returned by the List operation. -type ListPrivateLinkResourcesResult struct { - autorest.Response `json:"-"` - // Value - The collection of returned private link resources. - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - The continuation token. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListPrivateLinkResourcesResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type ListPrivateLinkResourcesResultIterator struct { - i int - page ListPrivateLinkResourcesResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListPrivateLinkResourcesResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateLinkResourcesResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListPrivateLinkResourcesResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListPrivateLinkResourcesResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListPrivateLinkResourcesResultIterator) Response() ListPrivateLinkResourcesResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListPrivateLinkResourcesResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListPrivateLinkResourcesResultIterator type. -func NewListPrivateLinkResourcesResultIterator(page ListPrivateLinkResourcesResultPage) ListPrivateLinkResourcesResultIterator { - return ListPrivateLinkResourcesResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lplrr ListPrivateLinkResourcesResult) IsEmpty() bool { - return lplrr.Value == nil || len(*lplrr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lplrr ListPrivateLinkResourcesResult) hasNextLink() bool { - return lplrr.NextLink != nil && len(*lplrr.NextLink) != 0 -} - -// listPrivateLinkResourcesResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lplrr ListPrivateLinkResourcesResult) listPrivateLinkResourcesResultPreparer(ctx context.Context) (*http.Request, error) { - if !lplrr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lplrr.NextLink))) -} - -// ListPrivateLinkResourcesResultPage contains a page of PrivateLinkResource values. -type ListPrivateLinkResourcesResultPage struct { - fn func(context.Context, ListPrivateLinkResourcesResult) (ListPrivateLinkResourcesResult, error) - lplrr ListPrivateLinkResourcesResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListPrivateLinkResourcesResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateLinkResourcesResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lplrr) - if err != nil { - return err - } - page.lplrr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListPrivateLinkResourcesResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListPrivateLinkResourcesResultPage) NotDone() bool { - return !page.lplrr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListPrivateLinkResourcesResultPage) Response() ListPrivateLinkResourcesResult { - return page.lplrr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListPrivateLinkResourcesResultPage) Values() []PrivateLinkResource { - if page.lplrr.IsEmpty() { - return nil - } - return *page.lplrr.Value -} - -// Creates a new instance of the ListPrivateLinkResourcesResultPage type. -func NewListPrivateLinkResourcesResultPage(cur ListPrivateLinkResourcesResult, getNextPage func(context.Context, ListPrivateLinkResourcesResult) (ListPrivateLinkResourcesResult, error)) ListPrivateLinkResourcesResultPage { - return ListPrivateLinkResourcesResultPage{ - fn: getNextPage, - lplrr: cur, - } -} - -// LocationQuota quotas associated with a Batch region for a particular subscription. -type LocationQuota struct { - autorest.Response `json:"-"` - // AccountQuota - READ-ONLY; The number of Batch accounts that may be created under the subscription in the specified region. - AccountQuota *int32 `json:"accountQuota,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocationQuota. -func (lq LocationQuota) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MetadataItem the Batch service does not assign any meaning to this metadata; it is solely for the use of -// user code. -type MetadataItem struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} - -// MountConfiguration ... -type MountConfiguration struct { - // AzureBlobFileSystemConfiguration - This property is mutually exclusive with all other properties. - AzureBlobFileSystemConfiguration *AzureBlobFileSystemConfiguration `json:"azureBlobFileSystemConfiguration,omitempty"` - // NfsMountConfiguration - This property is mutually exclusive with all other properties. - NfsMountConfiguration *NFSMountConfiguration `json:"nfsMountConfiguration,omitempty"` - // CifsMountConfiguration - This property is mutually exclusive with all other properties. - CifsMountConfiguration *CIFSMountConfiguration `json:"cifsMountConfiguration,omitempty"` - // AzureFileShareConfiguration - This property is mutually exclusive with all other properties. - AzureFileShareConfiguration *AzureFileShareConfiguration `json:"azureFileShareConfiguration,omitempty"` -} - -// NetworkConfiguration the network configuration for a pool. -type NetworkConfiguration struct { - // SubnetID - The virtual network must be in the same region and subscription as the Azure Batch account. The specified subnet should have enough free IP addresses to accommodate the number of nodes in the pool. If the subnet doesn't have enough free IP addresses, the pool will partially allocate compute nodes and a resize error will occur. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control (RBAC) role for the specified VNet. The specified subnet must allow communication from the Azure Batch service to be able to schedule tasks on the compute nodes. This can be verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to the compute nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the compute nodes to unusable. If the specified VNet has any associated Network Security Groups (NSG), then a few reserved system ports must be enabled for inbound communication. For pools created with a virtual machine configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For pools created with a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound connections to Azure Storage on port 443. For cloudServiceConfiguration pools, only 'classic' VNETs are supported. For more details see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration - SubnetID *string `json:"subnetId,omitempty"` - // DynamicVNetAssignmentScope - Possible values include: 'DynamicVNetAssignmentScopeNone', 'DynamicVNetAssignmentScopeJob' - DynamicVNetAssignmentScope DynamicVNetAssignmentScope `json:"dynamicVNetAssignmentScope,omitempty"` - // EndpointConfiguration - Pool endpoint configuration is only supported on pools with the virtualMachineConfiguration property. - EndpointConfiguration *PoolEndpointConfiguration `json:"endpointConfiguration,omitempty"` - // PublicIPAddressConfiguration - This property is only supported on Pools with the virtualMachineConfiguration property. - PublicIPAddressConfiguration *PublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` -} - -// NetworkSecurityGroupRule ... -type NetworkSecurityGroupRule struct { - // Priority - Priorities within a pool must be unique and are evaluated in order of priority. The lower the number the higher the priority. For example, rules could be specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes precedence over the rule that has an order of 250. Allowed priorities are 150 to 4096. If any reserved or duplicate values are provided the request fails with HTTP status code 400. - Priority *int32 `json:"priority,omitempty"` - // Access - Possible values include: 'NetworkSecurityGroupRuleAccessAllow', 'NetworkSecurityGroupRuleAccessDeny' - Access NetworkSecurityGroupRuleAccess `json:"access,omitempty"` - // SourceAddressPrefix - Valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any other values are provided the request fails with HTTP status code 400. - SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` - // SourcePortRanges - Valid values are '*' (for all ports 0 - 65535) or arrays of ports or port ranges (i.e. 100-200). The ports should in the range of 0 to 65535 and the port ranges or ports can't overlap. If any other values are provided the request fails with HTTP status code 400. Default value will be *. - SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` -} - -// NFSMountConfiguration ... -type NFSMountConfiguration struct { - Source *string `json:"source,omitempty"` - // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. - RelativeMountPath *string `json:"relativeMountPath,omitempty"` - // MountOptions - These are 'net use' options in Windows and 'mount' options in Linux. - MountOptions *string `json:"mountOptions,omitempty"` -} - -// NodePlacementConfiguration allocation configuration used by Batch Service to provision the nodes. -type NodePlacementConfiguration struct { - // Policy - Allocation policy used by Batch Service to provision the nodes. If not specified, Batch will use the regional policy. Possible values include: 'NodePlacementPolicyTypeRegional', 'NodePlacementPolicyTypeZonal' - Policy NodePlacementPolicyType `json:"policy,omitempty"` -} - -// Operation ... -type Operation struct { - // Name - This is of the format {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // IsDataAction - Indicates whether the operation is a data action - IsDataAction *bool `json:"isDataAction,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` - Origin *string `json:"origin,omitempty"` - Properties interface{} `json:"properties,omitempty"` -} - -// OperationDisplay ... -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - // Operation - For example: read, write, delete, or listKeys/action - Operation *string `json:"operation,omitempty"` - Resource *string `json:"resource,omitempty"` - Description *string `json:"description,omitempty"` -} - -// OperationListResult ... -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// OSDisk ... -type OSDisk struct { - EphemeralOSDiskSettings *DiffDiskSettings `json:"ephemeralOSDiskSettings,omitempty"` -} - -// OutboundEnvironmentEndpoint a collection of related endpoints from the same service for which the Batch -// service requires outbound access. -type OutboundEnvironmentEndpoint struct { - // Category - READ-ONLY; The type of service that the Batch service connects to. - Category *string `json:"category,omitempty"` - // Endpoints - READ-ONLY; The endpoints for this service to which the Batch service makes outbound calls. - Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` -} - -// MarshalJSON is the custom marshaler for OutboundEnvironmentEndpoint. -func (oee OutboundEnvironmentEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OutboundEnvironmentEndpointCollection values returned by the List operation. -type OutboundEnvironmentEndpointCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The collection of outbound network dependency endpoints returned by the listing operation. - Value *[]OutboundEnvironmentEndpoint `json:"value,omitempty"` - // NextLink - The continuation token. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OutboundEnvironmentEndpointCollection. -func (oeec OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oeec.NextLink != nil { - objectMap["nextLink"] = oeec.NextLink - } - return json.Marshal(objectMap) -} - -// OutboundEnvironmentEndpointCollectionIterator provides access to a complete listing of -// OutboundEnvironmentEndpoint values. -type OutboundEnvironmentEndpointCollectionIterator struct { - i int - page OutboundEnvironmentEndpointCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OutboundEnvironmentEndpointCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OutboundEnvironmentEndpointCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OutboundEnvironmentEndpointCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OutboundEnvironmentEndpointCollectionIterator) Response() OutboundEnvironmentEndpointCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OutboundEnvironmentEndpointCollectionIterator) Value() OutboundEnvironmentEndpoint { - if !iter.page.NotDone() { - return OutboundEnvironmentEndpoint{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OutboundEnvironmentEndpointCollectionIterator type. -func NewOutboundEnvironmentEndpointCollectionIterator(page OutboundEnvironmentEndpointCollectionPage) OutboundEnvironmentEndpointCollectionIterator { - return OutboundEnvironmentEndpointCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (oeec OutboundEnvironmentEndpointCollection) IsEmpty() bool { - return oeec.Value == nil || len(*oeec.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (oeec OutboundEnvironmentEndpointCollection) hasNextLink() bool { - return oeec.NextLink != nil && len(*oeec.NextLink) != 0 -} - -// outboundEnvironmentEndpointCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (oeec OutboundEnvironmentEndpointCollection) outboundEnvironmentEndpointCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !oeec.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(oeec.NextLink))) -} - -// OutboundEnvironmentEndpointCollectionPage contains a page of OutboundEnvironmentEndpoint values. -type OutboundEnvironmentEndpointCollectionPage struct { - fn func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error) - oeec OutboundEnvironmentEndpointCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OutboundEnvironmentEndpointCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.oeec) - if err != nil { - return err - } - page.oeec = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OutboundEnvironmentEndpointCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OutboundEnvironmentEndpointCollectionPage) NotDone() bool { - return !page.oeec.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OutboundEnvironmentEndpointCollectionPage) Response() OutboundEnvironmentEndpointCollection { - return page.oeec -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OutboundEnvironmentEndpointCollectionPage) Values() []OutboundEnvironmentEndpoint { - if page.oeec.IsEmpty() { - return nil - } - return *page.oeec.Value -} - -// Creates a new instance of the OutboundEnvironmentEndpointCollectionPage type. -func NewOutboundEnvironmentEndpointCollectionPage(cur OutboundEnvironmentEndpointCollection, getNextPage func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error)) OutboundEnvironmentEndpointCollectionPage { - return OutboundEnvironmentEndpointCollectionPage{ - fn: getNextPage, - oeec: cur, - } -} - -// Pool contains information about a pool. -type Pool struct { - autorest.Response `json:"-"` - // PoolProperties - The properties associated with the pool. - *PoolProperties `json:"properties,omitempty"` - // Identity - The type of identity used for the Batch Pool. - Identity *PoolIdentity `json:"identity,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Pool. -func (p Pool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if p.PoolProperties != nil { - objectMap["properties"] = p.PoolProperties - } - if p.Identity != nil { - objectMap["identity"] = p.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Pool struct. -func (p *Pool) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var poolProperties PoolProperties - err = json.Unmarshal(*v, &poolProperties) - if err != nil { - return err - } - p.PoolProperties = &poolProperties - } - case "identity": - if v != nil { - var identity PoolIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - p.Identity = &identity - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - p.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - p.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - p.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - p.Etag = &etag - } - } - } - - return nil -} - -// PoolDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type PoolDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PoolClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PoolDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PoolDeleteFuture.Result. -func (future *PoolDeleteFuture) result(client PoolClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("batch.PoolDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PoolEndpointConfiguration ... -type PoolEndpointConfiguration struct { - // InboundNatPools - The maximum number of inbound NAT pools per Batch pool is 5. If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status code 400. This cannot be specified if the IPAddressProvisioningType is NoPublicIPAddresses. - InboundNatPools *[]InboundNatPool `json:"inboundNatPools,omitempty"` -} - -// PoolIdentity the identity of the Batch pool, if configured. If the pool identity is updated during -// update an existing pool, only the new vms which are created after the pool shrinks to 0 will have the -// updated identities -type PoolIdentity struct { - // Type - The type of identity used for the Batch Pool. Possible values include: 'PoolIdentityTypeUserAssigned', 'PoolIdentityTypeNone' - Type PoolIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the Batch pool. - UserAssignedIdentities map[string]*UserAssignedIdentities `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for PoolIdentity. -func (pi PoolIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pi.Type != "" { - objectMap["type"] = pi.Type - } - if pi.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = pi.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// PoolProperties pool properties. -type PoolProperties struct { - // DisplayName - The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. - DisplayName *string `json:"displayName,omitempty"` - // LastModified - READ-ONLY; This is the last time at which the pool level data, such as the targetDedicatedNodes or autoScaleSettings, changed. It does not factor in node-level changes such as a compute node changing state. - LastModified *date.Time `json:"lastModified,omitempty"` - // CreationTime - READ-ONLY - CreationTime *date.Time `json:"creationTime,omitempty"` - // ProvisioningState - READ-ONLY; Possible values include: 'PoolProvisioningStateSucceeded', 'PoolProvisioningStateDeleting' - ProvisioningState PoolProvisioningState `json:"provisioningState,omitempty"` - // ProvisioningStateTransitionTime - READ-ONLY - ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` - // AllocationState - READ-ONLY; Possible values include: 'AllocationStateSteady', 'AllocationStateResizing', 'AllocationStateStopping' - AllocationState AllocationState `json:"allocationState,omitempty"` - // AllocationStateTransitionTime - READ-ONLY - AllocationStateTransitionTime *date.Time `json:"allocationStateTransitionTime,omitempty"` - // VMSize - For information about available sizes of virtual machines for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all Cloud Services VM sizes except ExtraSmall. For information about available VM sizes for pools using images from the Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). - VMSize *string `json:"vmSize,omitempty"` - // DeploymentConfiguration - Using CloudServiceConfiguration specifies that the nodes should be creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses Azure Virtual Machines (IaaS). - DeploymentConfiguration *DeploymentConfiguration `json:"deploymentConfiguration,omitempty"` - // CurrentDedicatedNodes - READ-ONLY - CurrentDedicatedNodes *int32 `json:"currentDedicatedNodes,omitempty"` - // CurrentLowPriorityNodes - READ-ONLY - CurrentLowPriorityNodes *int32 `json:"currentLowPriorityNodes,omitempty"` - ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` - // AutoScaleRun - READ-ONLY; This property is set only if the pool automatically scales, i.e. autoScaleSettings are used. - AutoScaleRun *AutoScaleRun `json:"autoScaleRun,omitempty"` - // InterNodeCommunication - This imposes restrictions on which nodes can be assigned to the pool. Enabling this value can reduce the chance of the requested number of nodes to be allocated in the pool. If not specified, this value defaults to 'Disabled'. Possible values include: 'InterNodeCommunicationStateEnabled', 'InterNodeCommunicationStateDisabled' - InterNodeCommunication InterNodeCommunicationState `json:"interNodeCommunication,omitempty"` - NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"` - // TaskSlotsPerNode - The default value is 1. The maximum value is the smaller of 4 times the number of cores of the vmSize of the pool or 256. - TaskSlotsPerNode *int32 `json:"taskSlotsPerNode,omitempty"` - // TaskSchedulingPolicy - If not specified, the default is spread. - TaskSchedulingPolicy *TaskSchedulingPolicy `json:"taskSchedulingPolicy,omitempty"` - UserAccounts *[]UserAccount `json:"userAccounts,omitempty"` - // Metadata - The Batch service does not assign any meaning to metadata; it is solely for the use of user code. - Metadata *[]MetadataItem `json:"metadata,omitempty"` - // StartTask - In an PATCH (update) operation, this property can be set to an empty object to remove the start task from the pool. - StartTask *StartTask `json:"startTask,omitempty"` - // Certificates - For Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. - Certificates *[]CertificateReference `json:"certificates,omitempty"` - // ApplicationPackages - Changes to application package references affect all new compute nodes joining the pool, but do not affect compute nodes that are already in the pool until they are rebooted or reimaged. There is a maximum of 10 application package references on any given pool. - ApplicationPackages *[]ApplicationPackageReference `json:"applicationPackages,omitempty"` - // ApplicationLicenses - The list of application licenses must be a subset of available Batch service application licenses. If a license is requested which is not supported, pool creation will fail. - ApplicationLicenses *[]string `json:"applicationLicenses,omitempty"` - // ResizeOperationStatus - READ-ONLY - ResizeOperationStatus *ResizeOperationStatus `json:"resizeOperationStatus,omitempty"` - // MountConfiguration - This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. - MountConfiguration *[]MountConfiguration `json:"mountConfiguration,omitempty"` -} - -// MarshalJSON is the custom marshaler for PoolProperties. -func (pp PoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pp.DisplayName != nil { - objectMap["displayName"] = pp.DisplayName - } - if pp.VMSize != nil { - objectMap["vmSize"] = pp.VMSize - } - if pp.DeploymentConfiguration != nil { - objectMap["deploymentConfiguration"] = pp.DeploymentConfiguration - } - if pp.ScaleSettings != nil { - objectMap["scaleSettings"] = pp.ScaleSettings - } - if pp.InterNodeCommunication != "" { - objectMap["interNodeCommunication"] = pp.InterNodeCommunication - } - if pp.NetworkConfiguration != nil { - objectMap["networkConfiguration"] = pp.NetworkConfiguration - } - if pp.TaskSlotsPerNode != nil { - objectMap["taskSlotsPerNode"] = pp.TaskSlotsPerNode - } - if pp.TaskSchedulingPolicy != nil { - objectMap["taskSchedulingPolicy"] = pp.TaskSchedulingPolicy - } - if pp.UserAccounts != nil { - objectMap["userAccounts"] = pp.UserAccounts - } - if pp.Metadata != nil { - objectMap["metadata"] = pp.Metadata - } - if pp.StartTask != nil { - objectMap["startTask"] = pp.StartTask - } - if pp.Certificates != nil { - objectMap["certificates"] = pp.Certificates - } - if pp.ApplicationPackages != nil { - objectMap["applicationPackages"] = pp.ApplicationPackages - } - if pp.ApplicationLicenses != nil { - objectMap["applicationLicenses"] = pp.ApplicationLicenses - } - if pp.MountConfiguration != nil { - objectMap["mountConfiguration"] = pp.MountConfiguration - } - return json.Marshal(objectMap) -} - -// PrivateEndpoint the private endpoint of the private endpoint connection. -type PrivateEndpoint struct { - // ID - READ-ONLY - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpoint. -func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection contains information about a private link resource. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - The properties associated with the private endpoint connection. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - pec.Etag = &etag - } - } - } - - return nil -} - -// PrivateEndpointConnectionProperties private endpoint connection properties. -type PrivateEndpointConnectionProperties struct { - // ProvisioningState - READ-ONLY; Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateUpdating', 'PrivateEndpointConnectionProvisioningStateFailed' - ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. -func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecp.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = pecp.PrivateEndpoint - } - if pecp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionUpdateFuture.Result. -func (future *PrivateEndpointConnectionUpdateFuture) result(client PrivateEndpointConnectionClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("batch.PrivateEndpointConnectionUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.UpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateLinkResource contains information about a private link resource. -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - The properties associated with the private link resource. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.PrivateLinkResourceProperties != nil { - objectMap["properties"] = plr.PrivateLinkResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. -func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - plr.Etag = &etag - } - } - } - - return nil -} - -// PrivateLinkResourceProperties private link resource properties. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The group id is used to establish the private link connection. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionState the private link service connection state of the private endpoint -// connection -type PrivateLinkServiceConnectionState struct { - // Status - Possible values include: 'PrivateLinkServiceConnectionStatusApproved', 'PrivateLinkServiceConnectionStatusPending', 'PrivateLinkServiceConnectionStatusRejected', 'PrivateLinkServiceConnectionStatusDisconnected' - Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"` - Description *string `json:"description,omitempty"` - // ActionRequired - READ-ONLY - ActionRequired *string `json:"actionRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionState. -func (plscs PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscs.Status != "" { - objectMap["status"] = plscs.Status - } - if plscs.Description != nil { - objectMap["description"] = plscs.Description - } - return json.Marshal(objectMap) -} - -// ProxyResource a definition of an Azure resource. -type ProxyResource struct { - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PublicIPAddressConfiguration the public IP Address configuration of the networking configuration of a -// Pool. -type PublicIPAddressConfiguration struct { - // Provision - The default value is BatchManaged. Possible values include: 'IPAddressProvisioningTypeBatchManaged', 'IPAddressProvisioningTypeUserManaged', 'IPAddressProvisioningTypeNoPublicIPAddresses' - Provision IPAddressProvisioningType `json:"provision,omitempty"` - // IPAddressIds - The number of IPs specified here limits the maximum size of the Pool - 100 dedicated nodes or 100 Spot/low-priority nodes can be allocated for each public IP. For example, a pool needing 250 dedicated VMs would need at least 3 public IPs specified. Each element of this collection is of the form: /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. - IPAddressIds *[]string `json:"ipAddressIds,omitempty"` -} - -// ResizeError ... -type ResizeError struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - Details *[]ResizeError `json:"details,omitempty"` -} - -// ResizeOperationStatus describes either the current operation (if the pool AllocationState is Resizing) -// or the previously completed operation (if the AllocationState is Steady). -type ResizeOperationStatus struct { - TargetDedicatedNodes *int32 `json:"targetDedicatedNodes,omitempty"` - TargetLowPriorityNodes *int32 `json:"targetLowPriorityNodes,omitempty"` - // ResizeTimeout - The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). - ResizeTimeout *string `json:"resizeTimeout,omitempty"` - // NodeDeallocationOption - The default value is requeue. Possible values include: 'ComputeNodeDeallocationOptionRequeue', 'ComputeNodeDeallocationOptionTerminate', 'ComputeNodeDeallocationOptionTaskCompletion', 'ComputeNodeDeallocationOptionRetainedData' - NodeDeallocationOption ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - // Errors - This property is set only if an error occurred during the last pool resize, and only when the pool allocationState is Steady. - Errors *[]ResizeError `json:"errors,omitempty"` -} - -// Resource a definition of an Azure resource. -type Resource struct { - // ID - READ-ONLY; The ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - READ-ONLY; The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - READ-ONLY; The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceFile ... -type ResourceFile struct { - // AutoStorageContainerName - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. - AutoStorageContainerName *string `json:"autoStorageContainerName,omitempty"` - // StorageContainerURL - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. This URL must be readable and listable from compute nodes. There are three ways to get such a URL for a container in Azure storage: include a Shared Access Signature (SAS) granting read and list permissions on the container, use a managed identity with read and list permissions, or set the ACL for the container to allow public access. - StorageContainerURL *string `json:"storageContainerUrl,omitempty"` - // HTTPURL - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. If the URL points to Azure Blob Storage, it must be readable from compute nodes. There are three ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, use a managed identity with read permission, or set the ACL for the blob or its container to allow public access. - HTTPURL *string `json:"httpUrl,omitempty"` - // BlobPrefix - The property is valid only when autoStorageContainerName or storageContainerUrl is used. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the files in the container will be downloaded. - BlobPrefix *string `json:"blobPrefix,omitempty"` - // FilePath - If the httpUrl property is specified, the filePath is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the autoStorageContainerName or storageContainerUrl property is specified, filePath is optional and is the directory to download the files to. In the case where filePath is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory. The specified relative path cannot break out of the task's working directory (for example by using '..'). - FilePath *string `json:"filePath,omitempty"` - // FileMode - This property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a resourceFile which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file. - FileMode *string `json:"fileMode,omitempty"` - IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` -} - -// ScaleSettings defines the desired size of the pool. This can either be 'fixedScale' where the requested -// targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is periodically -// reevaluated. If this property is not specified, the pool will have a fixed scale with 0 -// targetDedicatedNodes. -type ScaleSettings struct { - // FixedScale - This property and autoScale are mutually exclusive and one of the properties must be specified. - FixedScale *FixedScaleSettings `json:"fixedScale,omitempty"` - // AutoScale - This property and fixedScale are mutually exclusive and one of the properties must be specified. - AutoScale *AutoScaleSettings `json:"autoScale,omitempty"` -} - -// SkuCapability a SKU capability, such as the number of cores. -type SkuCapability struct { - // Name - READ-ONLY; The name of the feature. - Name *string `json:"name,omitempty"` - // Value - READ-ONLY; The value of the feature. - Value *string `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkuCapability. -func (sc SkuCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// StartTask in some cases the start task may be re-run even though the node was not rebooted. Due to this, -// start tasks should be idempotent and exit gracefully if the setup they're performing has already been -// done. Special care should be taken to avoid start tasks which create breakaway process or install/launch -// services from the start task working directory, as this will block Batch from being able to re-run the -// start task. -type StartTask struct { - // CommandLine - The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. Required if any other properties of the startTask are specified. - CommandLine *string `json:"commandLine,omitempty"` - ResourceFiles *[]ResourceFile `json:"resourceFiles,omitempty"` - EnvironmentSettings *[]EnvironmentSetting `json:"environmentSettings,omitempty"` - // UserIdentity - If omitted, the task runs as a non-administrative user unique to the task. - UserIdentity *UserIdentity `json:"userIdentity,omitempty"` - // MaxTaskRetryCount - The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch service retries the task without limit, however this is not recommended for a start task or any task. The default value is 0 (no retries). - MaxTaskRetryCount *int32 `json:"maxTaskRetryCount,omitempty"` - // WaitForSuccess - If true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state and scheduling error detail. If false, the Batch service will not wait for the start task to complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is true. - WaitForSuccess *bool `json:"waitForSuccess,omitempty"` - // ContainerSettings - When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. - ContainerSettings *TaskContainerSettings `json:"containerSettings,omitempty"` -} - -// SupportedSku describes a Batch supported SKU. -type SupportedSku struct { - // Name - READ-ONLY; The name of the SKU. - Name *string `json:"name,omitempty"` - // FamilyName - READ-ONLY; The family name of the SKU. - FamilyName *string `json:"familyName,omitempty"` - // Capabilities - READ-ONLY; A collection of capabilities which this SKU supports. - Capabilities *[]SkuCapability `json:"capabilities,omitempty"` -} - -// MarshalJSON is the custom marshaler for SupportedSku. -func (ss SupportedSku) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SupportedSkusResult the Batch List supported SKUs operation response. -type SupportedSkusResult struct { - autorest.Response `json:"-"` - // Value - The list of SKUs available for the Batch service in the location. - Value *[]SupportedSku `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SupportedSkusResult. -func (ssr SupportedSkusResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ssr.Value != nil { - objectMap["value"] = ssr.Value - } - return json.Marshal(objectMap) -} - -// SupportedSkusResultIterator provides access to a complete listing of SupportedSku values. -type SupportedSkusResultIterator struct { - i int - page SupportedSkusResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SupportedSkusResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SupportedSkusResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SupportedSkusResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SupportedSkusResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SupportedSkusResultIterator) Response() SupportedSkusResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SupportedSkusResultIterator) Value() SupportedSku { - if !iter.page.NotDone() { - return SupportedSku{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SupportedSkusResultIterator type. -func NewSupportedSkusResultIterator(page SupportedSkusResultPage) SupportedSkusResultIterator { - return SupportedSkusResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ssr SupportedSkusResult) IsEmpty() bool { - return ssr.Value == nil || len(*ssr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ssr SupportedSkusResult) hasNextLink() bool { - return ssr.NextLink != nil && len(*ssr.NextLink) != 0 -} - -// supportedSkusResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ssr SupportedSkusResult) supportedSkusResultPreparer(ctx context.Context) (*http.Request, error) { - if !ssr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ssr.NextLink))) -} - -// SupportedSkusResultPage contains a page of SupportedSku values. -type SupportedSkusResultPage struct { - fn func(context.Context, SupportedSkusResult) (SupportedSkusResult, error) - ssr SupportedSkusResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SupportedSkusResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SupportedSkusResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ssr) - if err != nil { - return err - } - page.ssr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SupportedSkusResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SupportedSkusResultPage) NotDone() bool { - return !page.ssr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SupportedSkusResultPage) Response() SupportedSkusResult { - return page.ssr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SupportedSkusResultPage) Values() []SupportedSku { - if page.ssr.IsEmpty() { - return nil - } - return *page.ssr.Value -} - -// Creates a new instance of the SupportedSkusResultPage type. -func NewSupportedSkusResultPage(cur SupportedSkusResult, getNextPage func(context.Context, SupportedSkusResult) (SupportedSkusResult, error)) SupportedSkusResultPage { - return SupportedSkusResultPage{ - fn: getNextPage, - ssr: cur, - } -} - -// TaskContainerSettings ... -type TaskContainerSettings struct { - // ContainerRunOptions - These additional options are supplied as arguments to the "docker create" command, in addition to those controlled by the Batch Service. - ContainerRunOptions *string `json:"containerRunOptions,omitempty"` - // ImageName - This is the full image reference, as would be specified to "docker pull". If no tag is provided as part of the image name, the tag ":latest" is used as a default. - ImageName *string `json:"imageName,omitempty"` - // Registry - This setting can be omitted if was already provided at pool creation. - Registry *ContainerRegistry `json:"registry,omitempty"` - // WorkingDirectory - Possible values include: 'ContainerWorkingDirectoryTaskWorkingDirectory', 'ContainerWorkingDirectoryContainerImageDefault' - WorkingDirectory ContainerWorkingDirectory `json:"workingDirectory,omitempty"` -} - -// TaskSchedulingPolicy ... -type TaskSchedulingPolicy struct { - // NodeFillType - Possible values include: 'ComputeNodeFillTypeSpread', 'ComputeNodeFillTypePack' - NodeFillType ComputeNodeFillType `json:"nodeFillType,omitempty"` -} - -// UserAccount ... -type UserAccount struct { - Name *string `json:"name,omitempty"` - Password *string `json:"password,omitempty"` - // ElevationLevel - nonAdmin - The auto user is a standard user without elevated access. admin - The auto user is a user with elevated access and operates with full Administrator permissions. The default value is nonAdmin. Possible values include: 'ElevationLevelNonAdmin', 'ElevationLevelAdmin' - ElevationLevel ElevationLevel `json:"elevationLevel,omitempty"` - // LinuxUserConfiguration - This property is ignored if specified on a Windows pool. If not specified, the user is created with the default options. - LinuxUserConfiguration *LinuxUserConfiguration `json:"linuxUserConfiguration,omitempty"` - // WindowsUserConfiguration - This property can only be specified if the user is on a Windows pool. If not specified and on a Windows pool, the user is created with the default options. - WindowsUserConfiguration *WindowsUserConfiguration `json:"windowsUserConfiguration,omitempty"` -} - -// UserAssignedIdentities the list of associated user identities. -type UserAssignedIdentities struct { - // PrincipalID - READ-ONLY; The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - READ-ONLY; The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserAssignedIdentities. -func (uai UserAssignedIdentities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UserIdentity specify either the userName or autoUser property, but not both. -type UserIdentity struct { - // UserName - The userName and autoUser properties are mutually exclusive; you must specify one but not both. - UserName *string `json:"userName,omitempty"` - // AutoUser - The userName and autoUser properties are mutually exclusive; you must specify one but not both. - AutoUser *AutoUserSpecification `json:"autoUser,omitempty"` -} - -// VirtualMachineConfiguration ... -type VirtualMachineConfiguration struct { - ImageReference *ImageReference `json:"imageReference,omitempty"` - // NodeAgentSkuID - The Batch node agent is a program that runs on each node in the pool, and provides the command-and-control interface between the node and the Batch service. There are different implementations of the node agent, known as SKUs, for different operating systems. You must specify a node agent SKU which matches the selected image reference. To get the list of supported node agent SKUs along with their list of verified image references, see the 'List supported node agent SKUs' operation. - NodeAgentSkuID *string `json:"nodeAgentSkuId,omitempty"` - // WindowsConfiguration - This property must not be specified if the imageReference specifies a Linux OS image. - WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` - // DataDisks - This property must be specified if the compute nodes in the pool need to have empty data disks attached to them. - DataDisks *[]DataDisk `json:"dataDisks,omitempty"` - // LicenseType - This only applies to images that contain the Windows operating system, and should only be used when you hold valid on-premises licenses for the nodes which will be deployed. If omitted, no on-premises licensing discount is applied. Values are: - // Windows_Server - The on-premises license is for Windows Server. - // Windows_Client - The on-premises license is for Windows Client. - LicenseType *string `json:"licenseType,omitempty"` - // ContainerConfiguration - If specified, setup is performed on each node in the pool to allow tasks to run in containers. All regular tasks and job manager tasks run on this pool must specify the containerSettings property, and all other tasks may specify it. - ContainerConfiguration *ContainerConfiguration `json:"containerConfiguration,omitempty"` - // DiskEncryptionConfiguration - If specified, encryption is performed on each node in the pool during node provisioning. - DiskEncryptionConfiguration *DiskEncryptionConfiguration `json:"diskEncryptionConfiguration,omitempty"` - // NodePlacementConfiguration - This configuration will specify rules on how nodes in the pool will be physically allocated. - NodePlacementConfiguration *NodePlacementConfiguration `json:"nodePlacementConfiguration,omitempty"` - // Extensions - If specified, the extensions mentioned in this configuration will be installed on each node. - Extensions *[]VMExtension `json:"extensions,omitempty"` - // OsDisk - Contains configuration for ephemeral OSDisk settings. - OsDisk *OSDisk `json:"osDisk,omitempty"` -} - -// VirtualMachineFamilyCoreQuota a VM Family and its associated core quota for the Batch account. -type VirtualMachineFamilyCoreQuota struct { - // Name - READ-ONLY; The Virtual Machine family name. - Name *string `json:"name,omitempty"` - // CoreQuota - READ-ONLY; The core quota for the VM family for the Batch account. - CoreQuota *int32 `json:"coreQuota,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualMachineFamilyCoreQuota. -func (vmfcq VirtualMachineFamilyCoreQuota) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VMExtension ... -type VMExtension struct { - Name *string `json:"name,omitempty"` - Publisher *string `json:"publisher,omitempty"` - Type *string `json:"type,omitempty"` - TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` - // AutoUpgradeMinorVersion - 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. - AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` - Settings interface{} `json:"settings,omitempty"` - // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - ProtectedSettings interface{} `json:"protectedSettings,omitempty"` - // ProvisionAfterExtensions - Collection of extension names after which this extension needs to be provisioned. - ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` -} - -// WindowsConfiguration ... -type WindowsConfiguration struct { - // EnableAutomaticUpdates - If omitted, the default value is true. - EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` -} - -// WindowsUserConfiguration ... -type WindowsUserConfiguration struct { - // LoginMode - Specifies login mode for the user. The default value for VirtualMachineConfiguration pools is interactive mode and for CloudServiceConfiguration pools is batch mode. Possible values include: 'LoginModeBatch', 'LoginModeInteractive' - LoginMode LoginMode `json:"loginMode,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/operations.go deleted file mode 100644 index eb2366d7cadf..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the batch Client -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists available operations for the Microsoft.Batch provider -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Batch/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/pool.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/pool.go deleted file mode 100644 index 8b8c2f7c85bc..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/pool.go +++ /dev/null @@ -1,786 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PoolClient is the batch Client -type PoolClient struct { - BaseClient -} - -// NewPoolClient creates an instance of the PoolClient client. -func NewPoolClient(subscriptionID string) PoolClient { - return NewPoolClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPoolClientWithBaseURI creates an instance of the PoolClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewPoolClientWithBaseURI(baseURI string, subscriptionID string) PoolClient { - return PoolClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new pool inside the specified account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// poolName - the pool name. This must be unique within the account. -// parameters - additional parameters for pool creation. -// ifMatch - the entity state (ETag) version of the pool to update. A value of "*" can be used to apply the -// operation only if the pool already exists. If omitted, this operation will always be applied. -// ifNoneMatch - set to '*' to allow a new pool to be created, but to prevent updating an existing pool. Other -// values will be ignored. -func (client PoolClient) Create(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string, ifNoneMatch string) (result Pool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PoolProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.CloudServiceConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.CloudServiceConfiguration.OsFamily", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.ImageReference", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.NodeAgentSkuID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.ContainerConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.ContainerConfiguration.Type", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}, - {Target: "parameters.PoolProperties.ScaleSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.ScaleSettings.AutoScale", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.ScaleSettings.AutoScale.Formula", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - {Target: "parameters.PoolProperties.AutoScaleRun", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.AutoScaleRun.EvaluationTime", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PoolProperties.AutoScaleRun.Error", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.AutoScaleRun.Error.Code", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PoolProperties.AutoScaleRun.Error.Message", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - {Target: "parameters.PoolProperties.NetworkConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.NetworkConfiguration.EndpointConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.NetworkConfiguration.EndpointConfiguration.InboundNatPools", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - {Target: "parameters.PoolProperties.StartTask", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.StartTask.ContainerSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PoolProperties.StartTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("batch.PoolClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, poolName, parameters, ifMatch, ifNoneMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client PoolClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string, ifNoneMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - if len(ifNoneMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client PoolClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client PoolClient) CreateResponder(resp *http.Response) (result Pool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// poolName - the pool name. This must be unique within the account. -func (client PoolClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result PoolDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PoolClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PoolClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PoolClient) DeleteSender(req *http.Request) (future PoolDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PoolClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DisableAutoScale disables automatic scaling for a pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// poolName - the pool name. This must be unique within the account. -func (client PoolClient) DisableAutoScale(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result Pool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.DisableAutoScale") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PoolClient", "DisableAutoScale", err.Error()) - } - - req, err := client.DisableAutoScalePreparer(ctx, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "DisableAutoScale", nil, "Failure preparing request") - return - } - - resp, err := client.DisableAutoScaleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PoolClient", "DisableAutoScale", resp, "Failure sending request") - return - } - - result, err = client.DisableAutoScaleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "DisableAutoScale", resp, "Failure responding to request") - return - } - - return -} - -// DisableAutoScalePreparer prepares the DisableAutoScale request. -func (client PoolClient) DisableAutoScalePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DisableAutoScaleSender sends the DisableAutoScale request. The method will close the -// http.Response Body if it receives an error. -func (client PoolClient) DisableAutoScaleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DisableAutoScaleResponder handles the response to the DisableAutoScale request. The method always -// closes the http.Response Body. -func (client PoolClient) DisableAutoScaleResponder(resp *http.Response) (result Pool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets information about the specified pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// poolName - the pool name. This must be unique within the account. -func (client PoolClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result Pool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PoolClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PoolClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PoolClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PoolClient) GetResponder(resp *http.Response) (result Pool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByBatchAccount lists all of the pools in the specified account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// maxresults - the maximum number of items to return in the response. -// selectParameter - comma separated list of properties that should be returned. e.g. -// "properties/provisioningState". Only top level properties under properties/ are valid for selection. -// filter - oData filter expression. Valid properties for filtering are: -// -// name -// properties/allocationState -// properties/allocationStateTransitionTime -// properties/creationTime -// properties/provisioningState -// properties/provisioningStateTransitionTime -// properties/lastModified -// properties/vmSize -// properties/interNodeCommunication -// properties/scaleSettings/autoScale -// properties/scaleSettings/fixedScale -func (client PoolClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListPoolsResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.lpr.Response.Response != nil { - sc = result.lpr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PoolClient", "ListByBatchAccount", err.Error()) - } - - result.fn = client.listByBatchAccountNextResults - req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "ListByBatchAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.lpr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PoolClient", "ListByBatchAccount", resp, "Failure sending request") - return - } - - result.lpr, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "ListByBatchAccount", resp, "Failure responding to request") - return - } - if result.lpr.hasNextLink() && result.lpr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByBatchAccountPreparer prepares the ListByBatchAccount request. -func (client PoolClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PoolClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always -// closes the http.Response Body. -func (client PoolClient) ListByBatchAccountResponder(resp *http.Response) (result ListPoolsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByBatchAccountNextResults retrieves the next set of results, if any. -func (client PoolClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListPoolsResult) (result ListPoolsResult, err error) { - req, err := lastResults.listPoolsResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.PoolClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.PoolClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client PoolClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListPoolsResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) - return -} - -// StopResize this does not restore the pool to its previous state before the resize operation: it only stops any -// further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the -// number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state -// changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this -// API can also be used to halt the initial sizing of the pool when it is created. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// poolName - the pool name. This must be unique within the account. -func (client PoolClient) StopResize(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result Pool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.StopResize") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PoolClient", "StopResize", err.Error()) - } - - req, err := client.StopResizePreparer(ctx, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "StopResize", nil, "Failure preparing request") - return - } - - resp, err := client.StopResizeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PoolClient", "StopResize", resp, "Failure sending request") - return - } - - result, err = client.StopResizeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "StopResize", resp, "Failure responding to request") - return - } - - return -} - -// StopResizePreparer prepares the StopResize request. -func (client PoolClient) StopResizePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StopResizeSender sends the StopResize request. The method will close the -// http.Response Body if it receives an error. -func (client PoolClient) StopResizeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// StopResizeResponder handles the response to the StopResize request. The method always -// closes the http.Response Body. -func (client PoolClient) StopResizeResponder(resp *http.Response) (result Pool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates the properties of an existing pool. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// poolName - the pool name. This must be unique within the account. -// parameters - pool properties that should be updated. Properties that are supplied will be updated, any -// property not supplied will be unchanged. -// ifMatch - the entity state (ETag) version of the pool to update. This value can be omitted or set to "*" to -// apply the operation unconditionally. -func (client PoolClient) Update(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string) (result Pool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PoolClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, poolName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PoolClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client PoolClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client PoolClient) UpdateResponder(resp *http.Response) (result Pool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/privateendpointconnection.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/privateendpointconnection.go deleted file mode 100644 index 61441bead880..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/privateendpointconnection.go +++ /dev/null @@ -1,358 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionClient is the batch Client -type PrivateEndpointConnectionClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionClient creates an instance of the PrivateEndpointConnectionClient client. -func NewPrivateEndpointConnectionClient(subscriptionID string) PrivateEndpointConnectionClient { - return NewPrivateEndpointConnectionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionClientWithBaseURI creates an instance of the PrivateEndpointConnectionClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionClient { - return PrivateEndpointConnectionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets information about the specified private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// privateEndpointConnectionName - the private endpoint connection name. This must be unique within the -// account. -func (client PrivateEndpointConnectionClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: privateEndpointConnectionName, - Constraints: []validation.Constraint{{Target: "privateEndpointConnectionName", Name: validation.MaxLength, Rule: 101, Chain: nil}, - {Target: "privateEndpointConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "privateEndpointConnectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PrivateEndpointConnectionClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByBatchAccount lists all of the private endpoint connections in the specified account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// maxresults - the maximum number of items to return in the response. -func (client PrivateEndpointConnectionClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateEndpointConnectionsResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.lpecr.Response.Response != nil { - sc = result.lpecr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PrivateEndpointConnectionClient", "ListByBatchAccount", err.Error()) - } - - result.fn = client.listByBatchAccountNextResults - req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "ListByBatchAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.lpecr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "ListByBatchAccount", resp, "Failure sending request") - return - } - - result.lpecr, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "ListByBatchAccount", resp, "Failure responding to request") - return - } - if result.lpecr.hasNextLink() && result.lpecr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByBatchAccountPreparer prepares the ListByBatchAccount request. -func (client PrivateEndpointConnectionClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionClient) ListByBatchAccountResponder(resp *http.Response) (result ListPrivateEndpointConnectionsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByBatchAccountNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListPrivateEndpointConnectionsResult) (result ListPrivateEndpointConnectionsResult, err error) { - req, err := lastResults.listPrivateEndpointConnectionsResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateEndpointConnectionsResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults) - return -} - -// Update updates the properties of an existing private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// privateEndpointConnectionName - the private endpoint connection name. This must be unique within the -// account. -// parameters - privateEndpointConnection properties that should be updated. Properties that are supplied will -// be updated, any property not supplied will be unchanged. -// ifMatch - the state (ETag) version of the private endpoint connection to update. This value can be omitted -// or set to "*" to apply the operation unconditionally. -func (client PrivateEndpointConnectionClient) Update(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, ifMatch string) (result PrivateEndpointConnectionUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: privateEndpointConnectionName, - Constraints: []validation.Constraint{{Target: "privateEndpointConnectionName", Name: validation.MaxLength, Rule: 101, Chain: nil}, - {Target: "privateEndpointConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "privateEndpointConnectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PrivateEndpointConnectionClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PrivateEndpointConnectionClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionClient) UpdateSender(req *http.Request) (future PrivateEndpointConnectionUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionClient) UpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/privatelinkresource.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/privatelinkresource.go deleted file mode 100644 index 74d5e5c5a284..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/privatelinkresource.go +++ /dev/null @@ -1,253 +0,0 @@ -package batch - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourceClient is the batch Client -type PrivateLinkResourceClient struct { - BaseClient -} - -// NewPrivateLinkResourceClient creates an instance of the PrivateLinkResourceClient client. -func NewPrivateLinkResourceClient(subscriptionID string) PrivateLinkResourceClient { - return NewPrivateLinkResourceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourceClientWithBaseURI creates an instance of the PrivateLinkResourceClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourceClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourceClient { - return PrivateLinkResourceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets information about the specified private link resource. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// privateLinkResourceName - the private link resource name. This must be unique within the account. -func (client PrivateLinkResourceClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateLinkResourceName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: privateLinkResourceName, - Constraints: []validation.Constraint{{Target: "privateLinkResourceName", Name: validation.MaxLength, Rule: 101, Chain: nil}, - {Target: "privateLinkResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "privateLinkResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PrivateLinkResourceClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateLinkResourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourceClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, privateLinkResourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "privateLinkResourceName": autorest.Encode("path", privateLinkResourceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourceClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourceClient) GetResponder(resp *http.Response) (result PrivateLinkResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByBatchAccount lists all of the private link resources in the specified account. -// Parameters: -// resourceGroupName - the name of the resource group that contains the Batch account. -// accountName - the name of the Batch account. -// maxresults - the maximum number of items to return in the response. -func (client PrivateLinkResourceClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateLinkResourcesResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.lplrr.Response.Response != nil { - sc = result.lplrr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("batch.PrivateLinkResourceClient", "ListByBatchAccount", err.Error()) - } - - result.fn = client.listByBatchAccountNextResults - req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "ListByBatchAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.lplrr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "ListByBatchAccount", resp, "Failure sending request") - return - } - - result.lplrr, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "ListByBatchAccount", resp, "Failure responding to request") - return - } - if result.lplrr.hasNextLink() && result.lplrr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByBatchAccountPreparer prepares the ListByBatchAccount request. -func (client PrivateLinkResourceClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourceClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourceClient) ListByBatchAccountResponder(resp *http.Response) (result ListPrivateLinkResourcesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByBatchAccountNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourceClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListPrivateLinkResourcesResult) (result ListPrivateLinkResourcesResult, err error) { - req, err := lastResults.listPrivateLinkResourcesResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByBatchAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByBatchAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourceClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateLinkResourcesResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceClient.ListByBatchAccount") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/version.go deleted file mode 100644 index d8de98dcf60e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package batch - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " batch/2022-01-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/_meta.json deleted file mode 100644 index ee8e41dae278..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/containerservice/resource-manager/readme.md", - "tag": "package-2019-08", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2019-08 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/containerservice/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/agentpools.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/agentpools.go deleted file mode 100644 index 709d119a349a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/agentpools.go +++ /dev/null @@ -1,608 +0,0 @@ -package containerservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AgentPoolsClient is the the Container Service Client. -type AgentPoolsClient struct { - BaseClient -} - -// NewAgentPoolsClient creates an instance of the AgentPoolsClient client. -func NewAgentPoolsClient(subscriptionID string) AgentPoolsClient { - return NewAgentPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAgentPoolsClientWithBaseURI creates an instance of the AgentPoolsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAgentPoolsClientWithBaseURI(baseURI string, subscriptionID string) AgentPoolsClient { - return AgentPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an agent pool in the specified managed cluster. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -// agentPoolName - the name of the agent pool. -// parameters - parameters supplied to the Create or Update an agent pool operation. -func (client AgentPoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters AgentPool) (result AgentPoolsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.AgentPoolsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, agentPoolName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AgentPoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters AgentPool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AgentPoolsClient) CreateOrUpdateSender(req *http.Request) (future AgentPoolsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AgentPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result AgentPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the agent pool in the specified managed cluster. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -// agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPoolsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.AgentPoolsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, agentPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AgentPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AgentPoolsClient) DeleteSender(req *http.Request) (future AgentPoolsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AgentPoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the agent pool by managed cluster and resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -// agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.AgentPoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, agentPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AgentPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AgentPoolsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AgentPoolsClient) GetResponder(resp *http.Response) (result AgentPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAvailableAgentPoolVersions gets a list of supported versions for the specified agent pool. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -func (client AgentPoolsClient) GetAvailableAgentPoolVersions(ctx context.Context, resourceGroupName string, resourceName string) (result AgentPoolAvailableVersions, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.GetAvailableAgentPoolVersions") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", err.Error()) - } - - req, err := client.GetAvailableAgentPoolVersionsPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", nil, "Failure preparing request") - return - } - - resp, err := client.GetAvailableAgentPoolVersionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", resp, "Failure sending request") - return - } - - result, err = client.GetAvailableAgentPoolVersionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", resp, "Failure responding to request") - return - } - - return -} - -// GetAvailableAgentPoolVersionsPreparer prepares the GetAvailableAgentPoolVersions request. -func (client AgentPoolsClient) GetAvailableAgentPoolVersionsPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAvailableAgentPoolVersionsSender sends the GetAvailableAgentPoolVersions request. The method will close the -// http.Response Body if it receives an error. -func (client AgentPoolsClient) GetAvailableAgentPoolVersionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAvailableAgentPoolVersionsResponder handles the response to the GetAvailableAgentPoolVersions request. The method always -// closes the http.Response Body. -func (client AgentPoolsClient) GetAvailableAgentPoolVersionsResponder(resp *http.Response) (result AgentPoolAvailableVersions, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetUpgradeProfile gets the details of the upgrade profile for an agent pool with a specified resource group and -// managed cluster name. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -// agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPoolUpgradeProfile, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.GetUpgradeProfile") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.AgentPoolsClient", "GetUpgradeProfile", err.Error()) - } - - req, err := client.GetUpgradeProfilePreparer(ctx, resourceGroupName, resourceName, agentPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetUpgradeProfile", nil, "Failure preparing request") - return - } - - resp, err := client.GetUpgradeProfileSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetUpgradeProfile", resp, "Failure sending request") - return - } - - result, err = client.GetUpgradeProfileResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetUpgradeProfile", resp, "Failure responding to request") - return - } - - return -} - -// GetUpgradeProfilePreparer prepares the GetUpgradeProfile request. -func (client AgentPoolsClient) GetUpgradeProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agentPoolName": autorest.Encode("path", agentPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetUpgradeProfileSender sends the GetUpgradeProfile request. The method will close the -// http.Response Body if it receives an error. -func (client AgentPoolsClient) GetUpgradeProfileSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetUpgradeProfileResponder handles the response to the GetUpgradeProfile request. The method always -// closes the http.Response Body. -func (client AgentPoolsClient) GetUpgradeProfileResponder(resp *http.Response) (result AgentPoolUpgradeProfile, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent -// pool. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -func (client AgentPoolsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result AgentPoolListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.List") - defer func() { - sc := -1 - if result.aplr.Response.Response != nil { - sc = result.aplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.AgentPoolsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.aplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "List", resp, "Failure sending request") - return - } - - result.aplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "List", resp, "Failure responding to request") - return - } - if result.aplr.hasNextLink() && result.aplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AgentPoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AgentPoolsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AgentPoolsClient) ListResponder(resp *http.Response) (result AgentPoolListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client AgentPoolsClient) listNextResults(ctx context.Context, lastResults AgentPoolListResult) (result AgentPoolListResult, err error) { - req, err := lastResults.agentPoolListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AgentPoolsClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result AgentPoolListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, resourceName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/client.go deleted file mode 100644 index ce1a6043a98b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package containerservice implements the Azure ARM Containerservice service API version . -// -// The Container Service Client. -package containerservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Containerservice - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Containerservice. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/containerservices.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/containerservices.go deleted file mode 100644 index afd3daf68f3e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/containerservices.go +++ /dev/null @@ -1,621 +0,0 @@ -package containerservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ContainerServicesClient is the the Container Service Client. -type ContainerServicesClient struct { - BaseClient -} - -// NewContainerServicesClient creates an instance of the ContainerServicesClient client. -func NewContainerServicesClient(subscriptionID string) ContainerServicesClient { - return NewContainerServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewContainerServicesClientWithBaseURI creates an instance of the ContainerServicesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewContainerServicesClientWithBaseURI(baseURI string, subscriptionID string) ContainerServicesClient { - return ContainerServicesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a container service with the specified configuration of orchestrator, masters, and -// agents. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerServiceName - the name of the container service in the specified subscription and resource group. -// parameters - parameters supplied to the Create or Update a Container Service operation. -func (client ContainerServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, containerServiceName string, parameters ContainerService) (result ContainerServicesCreateOrUpdateFutureType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.OrchestratorProfile", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Properties.CustomProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.CustomProfile.Orchestrator", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Properties.ServicePrincipalProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.ServicePrincipalProfile.ClientID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Properties.ServicePrincipalProfile.KeyVaultSecretRef", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.ServicePrincipalProfile.KeyVaultSecretRef.VaultID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Properties.ServicePrincipalProfile.KeyVaultSecretRef.SecretName", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - {Target: "parameters.Properties.MasterProfile", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.MasterProfile.DNSPrefix", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Properties.WindowsProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.WindowsProfile.AdminUsername", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.WindowsProfile.AdminUsername", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$`, Chain: nil}}}, - {Target: "parameters.Properties.WindowsProfile.AdminPassword", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.Properties.LinuxProfile", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.LinuxProfile.AdminUsername", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.LinuxProfile.AdminUsername", Name: validation.Pattern, Rule: `^[A-Za-z][-A-Za-z0-9_]*$`, Chain: nil}}}, - {Target: "parameters.Properties.LinuxProfile.SSH", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.LinuxProfile.SSH.PublicKeys", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - {Target: "parameters.Properties.DiagnosticsProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.DiagnosticsProfile.VMDiagnostics", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.DiagnosticsProfile.VMDiagnostics.Enabled", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerservice.ContainerServicesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, containerServiceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ContainerServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, containerServiceName string, parameters ContainerService) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerServiceName": autorest.Encode("path", containerServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerServicesClient) CreateOrUpdateSender(req *http.Request) (future ContainerServicesCreateOrUpdateFutureType, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ContainerServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ContainerService, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified container service in the specified subscription and resource group. The operation does -// not delete other resources created as part of creating a container service, including storage accounts, VMs, and -// availability sets. All the other resources created with the container service are part of the same resource group -// and can be deleted individually. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerServiceName - the name of the container service in the specified subscription and resource group. -func (client ContainerServicesClient) Delete(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerServicesDeleteFutureType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, containerServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ContainerServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, containerServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerServiceName": autorest.Encode("path", containerServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerServicesClient) DeleteSender(req *http.Request) (future ContainerServicesDeleteFutureType, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ContainerServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the properties of the specified container service in the specified subscription and resource group. The -// operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters -// and agents. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerServiceName - the name of the container service in the specified subscription and resource group. -func (client ContainerServicesClient) Get(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerService, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, containerServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ContainerServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, containerServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerServiceName": autorest.Encode("path", containerServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerServicesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ContainerServicesClient) GetResponder(resp *http.Response) (result ContainerService, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of container services in the specified subscription. The operation returns properties of each -// container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. -func (client ContainerServicesClient) List(ctx context.Context) (result ListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.List") - defer func() { - sc := -1 - if result.lr.Response.Response != nil { - sc = result.lr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.lr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", resp, "Failure sending request") - return - } - - result.lr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", resp, "Failure responding to request") - return - } - if result.lr.hasNextLink() && result.lr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ContainerServicesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerServicesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ContainerServicesClient) ListResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ContainerServicesClient) listNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.listResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ContainerServicesClient) ListComplete(ctx context.Context) (result ListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup gets a list of container services in the specified subscription and resource group. The -// operation returns properties of each container service including state, orchestrator, number of masters and agents, -// and FQDNs of masters and agents. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ContainerServicesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.lr.Response.Response != nil { - sc = result.lr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.lr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.lr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.lr.hasNextLink() && result.lr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ContainerServicesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ContainerServicesClient) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ContainerServicesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.listResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ContainerServicesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListOrchestrators gets a list of supported orchestrators in the specified subscription. The operation returns -// properties of each orchestrator including version, available upgrades and whether that version or upgrades are in -// preview. -// Parameters: -// location - the name of a supported Azure region. -// resourceType - resource type for which the list of orchestrators needs to be returned -func (client ContainerServicesClient) ListOrchestrators(ctx context.Context, location string, resourceType string) (result OrchestratorVersionProfileListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.ListOrchestrators") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListOrchestratorsPreparer(ctx, location, resourceType) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListOrchestrators", nil, "Failure preparing request") - return - } - - resp, err := client.ListOrchestratorsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListOrchestrators", resp, "Failure sending request") - return - } - - result, err = client.ListOrchestratorsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListOrchestrators", resp, "Failure responding to request") - return - } - - return -} - -// ListOrchestratorsPreparer prepares the ListOrchestrators request. -func (client ContainerServicesClient) ListOrchestratorsPreparer(ctx context.Context, location string, resourceType string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(resourceType) > 0 { - queryParameters["resource-type"] = autorest.Encode("query", resourceType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/orchestrators", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListOrchestratorsSender sends the ListOrchestrators request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerServicesClient) ListOrchestratorsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListOrchestratorsResponder handles the response to the ListOrchestrators request. The method always -// closes the http.Response Body. -func (client ContainerServicesClient) ListOrchestratorsResponder(resp *http.Response) (result OrchestratorVersionProfileListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/enums.go deleted file mode 100644 index 88396f238a1d..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/enums.go +++ /dev/null @@ -1,629 +0,0 @@ -package containerservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AgentPoolType enumerates the values for agent pool type. -type AgentPoolType string - -const ( - // AvailabilitySet ... - AvailabilitySet AgentPoolType = "AvailabilitySet" - // VirtualMachineScaleSets ... - VirtualMachineScaleSets AgentPoolType = "VirtualMachineScaleSets" -) - -// PossibleAgentPoolTypeValues returns an array of possible values for the AgentPoolType const type. -func PossibleAgentPoolTypeValues() []AgentPoolType { - return []AgentPoolType{AvailabilitySet, VirtualMachineScaleSets} -} - -// Kind enumerates the values for kind. -type Kind string - -const ( - // KindAADIdentityProvider ... - KindAADIdentityProvider Kind = "AADIdentityProvider" - // KindOpenShiftManagedClusterBaseIdentityProvider ... - KindOpenShiftManagedClusterBaseIdentityProvider Kind = "OpenShiftManagedClusterBaseIdentityProvider" -) - -// PossibleKindValues returns an array of possible values for the Kind const type. -func PossibleKindValues() []Kind { - return []Kind{KindAADIdentityProvider, KindOpenShiftManagedClusterBaseIdentityProvider} -} - -// LoadBalancerSku enumerates the values for load balancer sku. -type LoadBalancerSku string - -const ( - // Basic ... - Basic LoadBalancerSku = "basic" - // Standard ... - Standard LoadBalancerSku = "standard" -) - -// PossibleLoadBalancerSkuValues returns an array of possible values for the LoadBalancerSku const type. -func PossibleLoadBalancerSkuValues() []LoadBalancerSku { - return []LoadBalancerSku{Basic, Standard} -} - -// NetworkPlugin enumerates the values for network plugin. -type NetworkPlugin string - -const ( - // Azure ... - Azure NetworkPlugin = "azure" - // Kubenet ... - Kubenet NetworkPlugin = "kubenet" -) - -// PossibleNetworkPluginValues returns an array of possible values for the NetworkPlugin const type. -func PossibleNetworkPluginValues() []NetworkPlugin { - return []NetworkPlugin{Azure, Kubenet} -} - -// NetworkPolicy enumerates the values for network policy. -type NetworkPolicy string - -const ( - // NetworkPolicyAzure ... - NetworkPolicyAzure NetworkPolicy = "azure" - // NetworkPolicyCalico ... - NetworkPolicyCalico NetworkPolicy = "calico" -) - -// PossibleNetworkPolicyValues returns an array of possible values for the NetworkPolicy const type. -func PossibleNetworkPolicyValues() []NetworkPolicy { - return []NetworkPolicy{NetworkPolicyAzure, NetworkPolicyCalico} -} - -// OpenShiftAgentPoolProfileRole enumerates the values for open shift agent pool profile role. -type OpenShiftAgentPoolProfileRole string - -const ( - // Compute ... - Compute OpenShiftAgentPoolProfileRole = "compute" - // Infra ... - Infra OpenShiftAgentPoolProfileRole = "infra" -) - -// PossibleOpenShiftAgentPoolProfileRoleValues returns an array of possible values for the OpenShiftAgentPoolProfileRole const type. -func PossibleOpenShiftAgentPoolProfileRoleValues() []OpenShiftAgentPoolProfileRole { - return []OpenShiftAgentPoolProfileRole{Compute, Infra} -} - -// OpenShiftContainerServiceVMSize enumerates the values for open shift container service vm size. -type OpenShiftContainerServiceVMSize string - -const ( - // StandardD16sV3 ... - StandardD16sV3 OpenShiftContainerServiceVMSize = "Standard_D16s_v3" - // StandardD2sV3 ... - StandardD2sV3 OpenShiftContainerServiceVMSize = "Standard_D2s_v3" - // StandardD32sV3 ... - StandardD32sV3 OpenShiftContainerServiceVMSize = "Standard_D32s_v3" - // StandardD4sV3 ... - StandardD4sV3 OpenShiftContainerServiceVMSize = "Standard_D4s_v3" - // StandardD64sV3 ... - StandardD64sV3 OpenShiftContainerServiceVMSize = "Standard_D64s_v3" - // StandardD8sV3 ... - StandardD8sV3 OpenShiftContainerServiceVMSize = "Standard_D8s_v3" - // StandardDS12V2 ... - StandardDS12V2 OpenShiftContainerServiceVMSize = "Standard_DS12_v2" - // StandardDS13V2 ... - StandardDS13V2 OpenShiftContainerServiceVMSize = "Standard_DS13_v2" - // StandardDS14V2 ... - StandardDS14V2 OpenShiftContainerServiceVMSize = "Standard_DS14_v2" - // StandardDS15V2 ... - StandardDS15V2 OpenShiftContainerServiceVMSize = "Standard_DS15_v2" - // StandardDS4V2 ... - StandardDS4V2 OpenShiftContainerServiceVMSize = "Standard_DS4_v2" - // StandardDS5V2 ... - StandardDS5V2 OpenShiftContainerServiceVMSize = "Standard_DS5_v2" - // StandardE16sV3 ... - StandardE16sV3 OpenShiftContainerServiceVMSize = "Standard_E16s_v3" - // StandardE20sV3 ... - StandardE20sV3 OpenShiftContainerServiceVMSize = "Standard_E20s_v3" - // StandardE32sV3 ... - StandardE32sV3 OpenShiftContainerServiceVMSize = "Standard_E32s_v3" - // StandardE4sV3 ... - StandardE4sV3 OpenShiftContainerServiceVMSize = "Standard_E4s_v3" - // StandardE64sV3 ... - StandardE64sV3 OpenShiftContainerServiceVMSize = "Standard_E64s_v3" - // StandardE8sV3 ... - StandardE8sV3 OpenShiftContainerServiceVMSize = "Standard_E8s_v3" - // StandardF16s ... - StandardF16s OpenShiftContainerServiceVMSize = "Standard_F16s" - // StandardF16sV2 ... - StandardF16sV2 OpenShiftContainerServiceVMSize = "Standard_F16s_v2" - // StandardF32sV2 ... - StandardF32sV2 OpenShiftContainerServiceVMSize = "Standard_F32s_v2" - // StandardF64sV2 ... - StandardF64sV2 OpenShiftContainerServiceVMSize = "Standard_F64s_v2" - // StandardF72sV2 ... - StandardF72sV2 OpenShiftContainerServiceVMSize = "Standard_F72s_v2" - // StandardF8s ... - StandardF8s OpenShiftContainerServiceVMSize = "Standard_F8s" - // StandardF8sV2 ... - StandardF8sV2 OpenShiftContainerServiceVMSize = "Standard_F8s_v2" - // StandardGS2 ... - StandardGS2 OpenShiftContainerServiceVMSize = "Standard_GS2" - // StandardGS3 ... - StandardGS3 OpenShiftContainerServiceVMSize = "Standard_GS3" - // StandardGS4 ... - StandardGS4 OpenShiftContainerServiceVMSize = "Standard_GS4" - // StandardGS5 ... - StandardGS5 OpenShiftContainerServiceVMSize = "Standard_GS5" - // StandardL16s ... - StandardL16s OpenShiftContainerServiceVMSize = "Standard_L16s" - // StandardL32s ... - StandardL32s OpenShiftContainerServiceVMSize = "Standard_L32s" - // StandardL4s ... - StandardL4s OpenShiftContainerServiceVMSize = "Standard_L4s" - // StandardL8s ... - StandardL8s OpenShiftContainerServiceVMSize = "Standard_L8s" -) - -// PossibleOpenShiftContainerServiceVMSizeValues returns an array of possible values for the OpenShiftContainerServiceVMSize const type. -func PossibleOpenShiftContainerServiceVMSizeValues() []OpenShiftContainerServiceVMSize { - return []OpenShiftContainerServiceVMSize{StandardD16sV3, StandardD2sV3, StandardD32sV3, StandardD4sV3, StandardD64sV3, StandardD8sV3, StandardDS12V2, StandardDS13V2, StandardDS14V2, StandardDS15V2, StandardDS4V2, StandardDS5V2, StandardE16sV3, StandardE20sV3, StandardE32sV3, StandardE4sV3, StandardE64sV3, StandardE8sV3, StandardF16s, StandardF16sV2, StandardF32sV2, StandardF64sV2, StandardF72sV2, StandardF8s, StandardF8sV2, StandardGS2, StandardGS3, StandardGS4, StandardGS5, StandardL16s, StandardL32s, StandardL4s, StandardL8s} -} - -// OrchestratorTypes enumerates the values for orchestrator types. -type OrchestratorTypes string - -const ( - // Custom ... - Custom OrchestratorTypes = "Custom" - // DCOS ... - DCOS OrchestratorTypes = "DCOS" - // DockerCE ... - DockerCE OrchestratorTypes = "DockerCE" - // Kubernetes ... - Kubernetes OrchestratorTypes = "Kubernetes" - // Swarm ... - Swarm OrchestratorTypes = "Swarm" -) - -// PossibleOrchestratorTypesValues returns an array of possible values for the OrchestratorTypes const type. -func PossibleOrchestratorTypesValues() []OrchestratorTypes { - return []OrchestratorTypes{Custom, DCOS, DockerCE, Kubernetes, Swarm} -} - -// OSType enumerates the values for os type. -type OSType string - -const ( - // Linux ... - Linux OSType = "Linux" - // Windows ... - Windows OSType = "Windows" -) - -// PossibleOSTypeValues returns an array of possible values for the OSType const type. -func PossibleOSTypeValues() []OSType { - return []OSType{Linux, Windows} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // None ... - None ResourceIdentityType = "None" - // SystemAssigned ... - SystemAssigned ResourceIdentityType = "SystemAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{None, SystemAssigned} -} - -// ScaleSetEvictionPolicy enumerates the values for scale set eviction policy. -type ScaleSetEvictionPolicy string - -const ( - // Deallocate ... - Deallocate ScaleSetEvictionPolicy = "Deallocate" - // Delete ... - Delete ScaleSetEvictionPolicy = "Delete" -) - -// PossibleScaleSetEvictionPolicyValues returns an array of possible values for the ScaleSetEvictionPolicy const type. -func PossibleScaleSetEvictionPolicyValues() []ScaleSetEvictionPolicy { - return []ScaleSetEvictionPolicy{Deallocate, Delete} -} - -// ScaleSetPriority enumerates the values for scale set priority. -type ScaleSetPriority string - -const ( - // Low ... - Low ScaleSetPriority = "Low" - // Regular ... - Regular ScaleSetPriority = "Regular" -) - -// PossibleScaleSetPriorityValues returns an array of possible values for the ScaleSetPriority const type. -func PossibleScaleSetPriorityValues() []ScaleSetPriority { - return []ScaleSetPriority{Low, Regular} -} - -// StorageProfileTypes enumerates the values for storage profile types. -type StorageProfileTypes string - -const ( - // ManagedDisks ... - ManagedDisks StorageProfileTypes = "ManagedDisks" - // StorageAccount ... - StorageAccount StorageProfileTypes = "StorageAccount" -) - -// PossibleStorageProfileTypesValues returns an array of possible values for the StorageProfileTypes const type. -func PossibleStorageProfileTypesValues() []StorageProfileTypes { - return []StorageProfileTypes{ManagedDisks, StorageAccount} -} - -// VMSizeTypes enumerates the values for vm size types. -type VMSizeTypes string - -const ( - // VMSizeTypesStandardA1 ... - VMSizeTypesStandardA1 VMSizeTypes = "Standard_A1" - // VMSizeTypesStandardA10 ... - VMSizeTypesStandardA10 VMSizeTypes = "Standard_A10" - // VMSizeTypesStandardA11 ... - VMSizeTypesStandardA11 VMSizeTypes = "Standard_A11" - // VMSizeTypesStandardA1V2 ... - VMSizeTypesStandardA1V2 VMSizeTypes = "Standard_A1_v2" - // VMSizeTypesStandardA2 ... - VMSizeTypesStandardA2 VMSizeTypes = "Standard_A2" - // VMSizeTypesStandardA2mV2 ... - VMSizeTypesStandardA2mV2 VMSizeTypes = "Standard_A2m_v2" - // VMSizeTypesStandardA2V2 ... - VMSizeTypesStandardA2V2 VMSizeTypes = "Standard_A2_v2" - // VMSizeTypesStandardA3 ... - VMSizeTypesStandardA3 VMSizeTypes = "Standard_A3" - // VMSizeTypesStandardA4 ... - VMSizeTypesStandardA4 VMSizeTypes = "Standard_A4" - // VMSizeTypesStandardA4mV2 ... - VMSizeTypesStandardA4mV2 VMSizeTypes = "Standard_A4m_v2" - // VMSizeTypesStandardA4V2 ... - VMSizeTypesStandardA4V2 VMSizeTypes = "Standard_A4_v2" - // VMSizeTypesStandardA5 ... - VMSizeTypesStandardA5 VMSizeTypes = "Standard_A5" - // VMSizeTypesStandardA6 ... - VMSizeTypesStandardA6 VMSizeTypes = "Standard_A6" - // VMSizeTypesStandardA7 ... - VMSizeTypesStandardA7 VMSizeTypes = "Standard_A7" - // VMSizeTypesStandardA8 ... - VMSizeTypesStandardA8 VMSizeTypes = "Standard_A8" - // VMSizeTypesStandardA8mV2 ... - VMSizeTypesStandardA8mV2 VMSizeTypes = "Standard_A8m_v2" - // VMSizeTypesStandardA8V2 ... - VMSizeTypesStandardA8V2 VMSizeTypes = "Standard_A8_v2" - // VMSizeTypesStandardA9 ... - VMSizeTypesStandardA9 VMSizeTypes = "Standard_A9" - // VMSizeTypesStandardB2ms ... - VMSizeTypesStandardB2ms VMSizeTypes = "Standard_B2ms" - // VMSizeTypesStandardB2s ... - VMSizeTypesStandardB2s VMSizeTypes = "Standard_B2s" - // VMSizeTypesStandardB4ms ... - VMSizeTypesStandardB4ms VMSizeTypes = "Standard_B4ms" - // VMSizeTypesStandardB8ms ... - VMSizeTypesStandardB8ms VMSizeTypes = "Standard_B8ms" - // VMSizeTypesStandardD1 ... - VMSizeTypesStandardD1 VMSizeTypes = "Standard_D1" - // VMSizeTypesStandardD11 ... - VMSizeTypesStandardD11 VMSizeTypes = "Standard_D11" - // VMSizeTypesStandardD11V2 ... - VMSizeTypesStandardD11V2 VMSizeTypes = "Standard_D11_v2" - // VMSizeTypesStandardD11V2Promo ... - VMSizeTypesStandardD11V2Promo VMSizeTypes = "Standard_D11_v2_Promo" - // VMSizeTypesStandardD12 ... - VMSizeTypesStandardD12 VMSizeTypes = "Standard_D12" - // VMSizeTypesStandardD12V2 ... - VMSizeTypesStandardD12V2 VMSizeTypes = "Standard_D12_v2" - // VMSizeTypesStandardD12V2Promo ... - VMSizeTypesStandardD12V2Promo VMSizeTypes = "Standard_D12_v2_Promo" - // VMSizeTypesStandardD13 ... - VMSizeTypesStandardD13 VMSizeTypes = "Standard_D13" - // VMSizeTypesStandardD13V2 ... - VMSizeTypesStandardD13V2 VMSizeTypes = "Standard_D13_v2" - // VMSizeTypesStandardD13V2Promo ... - VMSizeTypesStandardD13V2Promo VMSizeTypes = "Standard_D13_v2_Promo" - // VMSizeTypesStandardD14 ... - VMSizeTypesStandardD14 VMSizeTypes = "Standard_D14" - // VMSizeTypesStandardD14V2 ... - VMSizeTypesStandardD14V2 VMSizeTypes = "Standard_D14_v2" - // VMSizeTypesStandardD14V2Promo ... - VMSizeTypesStandardD14V2Promo VMSizeTypes = "Standard_D14_v2_Promo" - // VMSizeTypesStandardD15V2 ... - VMSizeTypesStandardD15V2 VMSizeTypes = "Standard_D15_v2" - // VMSizeTypesStandardD16sV3 ... - VMSizeTypesStandardD16sV3 VMSizeTypes = "Standard_D16s_v3" - // VMSizeTypesStandardD16V3 ... - VMSizeTypesStandardD16V3 VMSizeTypes = "Standard_D16_v3" - // VMSizeTypesStandardD1V2 ... - VMSizeTypesStandardD1V2 VMSizeTypes = "Standard_D1_v2" - // VMSizeTypesStandardD2 ... - VMSizeTypesStandardD2 VMSizeTypes = "Standard_D2" - // VMSizeTypesStandardD2sV3 ... - VMSizeTypesStandardD2sV3 VMSizeTypes = "Standard_D2s_v3" - // VMSizeTypesStandardD2V2 ... - VMSizeTypesStandardD2V2 VMSizeTypes = "Standard_D2_v2" - // VMSizeTypesStandardD2V2Promo ... - VMSizeTypesStandardD2V2Promo VMSizeTypes = "Standard_D2_v2_Promo" - // VMSizeTypesStandardD2V3 ... - VMSizeTypesStandardD2V3 VMSizeTypes = "Standard_D2_v3" - // VMSizeTypesStandardD3 ... - VMSizeTypesStandardD3 VMSizeTypes = "Standard_D3" - // VMSizeTypesStandardD32sV3 ... - VMSizeTypesStandardD32sV3 VMSizeTypes = "Standard_D32s_v3" - // VMSizeTypesStandardD32V3 ... - VMSizeTypesStandardD32V3 VMSizeTypes = "Standard_D32_v3" - // VMSizeTypesStandardD3V2 ... - VMSizeTypesStandardD3V2 VMSizeTypes = "Standard_D3_v2" - // VMSizeTypesStandardD3V2Promo ... - VMSizeTypesStandardD3V2Promo VMSizeTypes = "Standard_D3_v2_Promo" - // VMSizeTypesStandardD4 ... - VMSizeTypesStandardD4 VMSizeTypes = "Standard_D4" - // VMSizeTypesStandardD4sV3 ... - VMSizeTypesStandardD4sV3 VMSizeTypes = "Standard_D4s_v3" - // VMSizeTypesStandardD4V2 ... - VMSizeTypesStandardD4V2 VMSizeTypes = "Standard_D4_v2" - // VMSizeTypesStandardD4V2Promo ... - VMSizeTypesStandardD4V2Promo VMSizeTypes = "Standard_D4_v2_Promo" - // VMSizeTypesStandardD4V3 ... - VMSizeTypesStandardD4V3 VMSizeTypes = "Standard_D4_v3" - // VMSizeTypesStandardD5V2 ... - VMSizeTypesStandardD5V2 VMSizeTypes = "Standard_D5_v2" - // VMSizeTypesStandardD5V2Promo ... - VMSizeTypesStandardD5V2Promo VMSizeTypes = "Standard_D5_v2_Promo" - // VMSizeTypesStandardD64sV3 ... - VMSizeTypesStandardD64sV3 VMSizeTypes = "Standard_D64s_v3" - // VMSizeTypesStandardD64V3 ... - VMSizeTypesStandardD64V3 VMSizeTypes = "Standard_D64_v3" - // VMSizeTypesStandardD8sV3 ... - VMSizeTypesStandardD8sV3 VMSizeTypes = "Standard_D8s_v3" - // VMSizeTypesStandardD8V3 ... - VMSizeTypesStandardD8V3 VMSizeTypes = "Standard_D8_v3" - // VMSizeTypesStandardDS1 ... - VMSizeTypesStandardDS1 VMSizeTypes = "Standard_DS1" - // VMSizeTypesStandardDS11 ... - VMSizeTypesStandardDS11 VMSizeTypes = "Standard_DS11" - // VMSizeTypesStandardDS11V2 ... - VMSizeTypesStandardDS11V2 VMSizeTypes = "Standard_DS11_v2" - // VMSizeTypesStandardDS11V2Promo ... - VMSizeTypesStandardDS11V2Promo VMSizeTypes = "Standard_DS11_v2_Promo" - // VMSizeTypesStandardDS12 ... - VMSizeTypesStandardDS12 VMSizeTypes = "Standard_DS12" - // VMSizeTypesStandardDS12V2 ... - VMSizeTypesStandardDS12V2 VMSizeTypes = "Standard_DS12_v2" - // VMSizeTypesStandardDS12V2Promo ... - VMSizeTypesStandardDS12V2Promo VMSizeTypes = "Standard_DS12_v2_Promo" - // VMSizeTypesStandardDS13 ... - VMSizeTypesStandardDS13 VMSizeTypes = "Standard_DS13" - // VMSizeTypesStandardDS132V2 ... - VMSizeTypesStandardDS132V2 VMSizeTypes = "Standard_DS13-2_v2" - // VMSizeTypesStandardDS134V2 ... - VMSizeTypesStandardDS134V2 VMSizeTypes = "Standard_DS13-4_v2" - // VMSizeTypesStandardDS13V2 ... - VMSizeTypesStandardDS13V2 VMSizeTypes = "Standard_DS13_v2" - // VMSizeTypesStandardDS13V2Promo ... - VMSizeTypesStandardDS13V2Promo VMSizeTypes = "Standard_DS13_v2_Promo" - // VMSizeTypesStandardDS14 ... - VMSizeTypesStandardDS14 VMSizeTypes = "Standard_DS14" - // VMSizeTypesStandardDS144V2 ... - VMSizeTypesStandardDS144V2 VMSizeTypes = "Standard_DS14-4_v2" - // VMSizeTypesStandardDS148V2 ... - VMSizeTypesStandardDS148V2 VMSizeTypes = "Standard_DS14-8_v2" - // VMSizeTypesStandardDS14V2 ... - VMSizeTypesStandardDS14V2 VMSizeTypes = "Standard_DS14_v2" - // VMSizeTypesStandardDS14V2Promo ... - VMSizeTypesStandardDS14V2Promo VMSizeTypes = "Standard_DS14_v2_Promo" - // VMSizeTypesStandardDS15V2 ... - VMSizeTypesStandardDS15V2 VMSizeTypes = "Standard_DS15_v2" - // VMSizeTypesStandardDS1V2 ... - VMSizeTypesStandardDS1V2 VMSizeTypes = "Standard_DS1_v2" - // VMSizeTypesStandardDS2 ... - VMSizeTypesStandardDS2 VMSizeTypes = "Standard_DS2" - // VMSizeTypesStandardDS2V2 ... - VMSizeTypesStandardDS2V2 VMSizeTypes = "Standard_DS2_v2" - // VMSizeTypesStandardDS2V2Promo ... - VMSizeTypesStandardDS2V2Promo VMSizeTypes = "Standard_DS2_v2_Promo" - // VMSizeTypesStandardDS3 ... - VMSizeTypesStandardDS3 VMSizeTypes = "Standard_DS3" - // VMSizeTypesStandardDS3V2 ... - VMSizeTypesStandardDS3V2 VMSizeTypes = "Standard_DS3_v2" - // VMSizeTypesStandardDS3V2Promo ... - VMSizeTypesStandardDS3V2Promo VMSizeTypes = "Standard_DS3_v2_Promo" - // VMSizeTypesStandardDS4 ... - VMSizeTypesStandardDS4 VMSizeTypes = "Standard_DS4" - // VMSizeTypesStandardDS4V2 ... - VMSizeTypesStandardDS4V2 VMSizeTypes = "Standard_DS4_v2" - // VMSizeTypesStandardDS4V2Promo ... - VMSizeTypesStandardDS4V2Promo VMSizeTypes = "Standard_DS4_v2_Promo" - // VMSizeTypesStandardDS5V2 ... - VMSizeTypesStandardDS5V2 VMSizeTypes = "Standard_DS5_v2" - // VMSizeTypesStandardDS5V2Promo ... - VMSizeTypesStandardDS5V2Promo VMSizeTypes = "Standard_DS5_v2_Promo" - // VMSizeTypesStandardE16sV3 ... - VMSizeTypesStandardE16sV3 VMSizeTypes = "Standard_E16s_v3" - // VMSizeTypesStandardE16V3 ... - VMSizeTypesStandardE16V3 VMSizeTypes = "Standard_E16_v3" - // VMSizeTypesStandardE2sV3 ... - VMSizeTypesStandardE2sV3 VMSizeTypes = "Standard_E2s_v3" - // VMSizeTypesStandardE2V3 ... - VMSizeTypesStandardE2V3 VMSizeTypes = "Standard_E2_v3" - // VMSizeTypesStandardE3216sV3 ... - VMSizeTypesStandardE3216sV3 VMSizeTypes = "Standard_E32-16s_v3" - // VMSizeTypesStandardE328sV3 ... - VMSizeTypesStandardE328sV3 VMSizeTypes = "Standard_E32-8s_v3" - // VMSizeTypesStandardE32sV3 ... - VMSizeTypesStandardE32sV3 VMSizeTypes = "Standard_E32s_v3" - // VMSizeTypesStandardE32V3 ... - VMSizeTypesStandardE32V3 VMSizeTypes = "Standard_E32_v3" - // VMSizeTypesStandardE4sV3 ... - VMSizeTypesStandardE4sV3 VMSizeTypes = "Standard_E4s_v3" - // VMSizeTypesStandardE4V3 ... - VMSizeTypesStandardE4V3 VMSizeTypes = "Standard_E4_v3" - // VMSizeTypesStandardE6416sV3 ... - VMSizeTypesStandardE6416sV3 VMSizeTypes = "Standard_E64-16s_v3" - // VMSizeTypesStandardE6432sV3 ... - VMSizeTypesStandardE6432sV3 VMSizeTypes = "Standard_E64-32s_v3" - // VMSizeTypesStandardE64sV3 ... - VMSizeTypesStandardE64sV3 VMSizeTypes = "Standard_E64s_v3" - // VMSizeTypesStandardE64V3 ... - VMSizeTypesStandardE64V3 VMSizeTypes = "Standard_E64_v3" - // VMSizeTypesStandardE8sV3 ... - VMSizeTypesStandardE8sV3 VMSizeTypes = "Standard_E8s_v3" - // VMSizeTypesStandardE8V3 ... - VMSizeTypesStandardE8V3 VMSizeTypes = "Standard_E8_v3" - // VMSizeTypesStandardF1 ... - VMSizeTypesStandardF1 VMSizeTypes = "Standard_F1" - // VMSizeTypesStandardF16 ... - VMSizeTypesStandardF16 VMSizeTypes = "Standard_F16" - // VMSizeTypesStandardF16s ... - VMSizeTypesStandardF16s VMSizeTypes = "Standard_F16s" - // VMSizeTypesStandardF16sV2 ... - VMSizeTypesStandardF16sV2 VMSizeTypes = "Standard_F16s_v2" - // VMSizeTypesStandardF1s ... - VMSizeTypesStandardF1s VMSizeTypes = "Standard_F1s" - // VMSizeTypesStandardF2 ... - VMSizeTypesStandardF2 VMSizeTypes = "Standard_F2" - // VMSizeTypesStandardF2s ... - VMSizeTypesStandardF2s VMSizeTypes = "Standard_F2s" - // VMSizeTypesStandardF2sV2 ... - VMSizeTypesStandardF2sV2 VMSizeTypes = "Standard_F2s_v2" - // VMSizeTypesStandardF32sV2 ... - VMSizeTypesStandardF32sV2 VMSizeTypes = "Standard_F32s_v2" - // VMSizeTypesStandardF4 ... - VMSizeTypesStandardF4 VMSizeTypes = "Standard_F4" - // VMSizeTypesStandardF4s ... - VMSizeTypesStandardF4s VMSizeTypes = "Standard_F4s" - // VMSizeTypesStandardF4sV2 ... - VMSizeTypesStandardF4sV2 VMSizeTypes = "Standard_F4s_v2" - // VMSizeTypesStandardF64sV2 ... - VMSizeTypesStandardF64sV2 VMSizeTypes = "Standard_F64s_v2" - // VMSizeTypesStandardF72sV2 ... - VMSizeTypesStandardF72sV2 VMSizeTypes = "Standard_F72s_v2" - // VMSizeTypesStandardF8 ... - VMSizeTypesStandardF8 VMSizeTypes = "Standard_F8" - // VMSizeTypesStandardF8s ... - VMSizeTypesStandardF8s VMSizeTypes = "Standard_F8s" - // VMSizeTypesStandardF8sV2 ... - VMSizeTypesStandardF8sV2 VMSizeTypes = "Standard_F8s_v2" - // VMSizeTypesStandardG1 ... - VMSizeTypesStandardG1 VMSizeTypes = "Standard_G1" - // VMSizeTypesStandardG2 ... - VMSizeTypesStandardG2 VMSizeTypes = "Standard_G2" - // VMSizeTypesStandardG3 ... - VMSizeTypesStandardG3 VMSizeTypes = "Standard_G3" - // VMSizeTypesStandardG4 ... - VMSizeTypesStandardG4 VMSizeTypes = "Standard_G4" - // VMSizeTypesStandardG5 ... - VMSizeTypesStandardG5 VMSizeTypes = "Standard_G5" - // VMSizeTypesStandardGS1 ... - VMSizeTypesStandardGS1 VMSizeTypes = "Standard_GS1" - // VMSizeTypesStandardGS2 ... - VMSizeTypesStandardGS2 VMSizeTypes = "Standard_GS2" - // VMSizeTypesStandardGS3 ... - VMSizeTypesStandardGS3 VMSizeTypes = "Standard_GS3" - // VMSizeTypesStandardGS4 ... - VMSizeTypesStandardGS4 VMSizeTypes = "Standard_GS4" - // VMSizeTypesStandardGS44 ... - VMSizeTypesStandardGS44 VMSizeTypes = "Standard_GS4-4" - // VMSizeTypesStandardGS48 ... - VMSizeTypesStandardGS48 VMSizeTypes = "Standard_GS4-8" - // VMSizeTypesStandardGS5 ... - VMSizeTypesStandardGS5 VMSizeTypes = "Standard_GS5" - // VMSizeTypesStandardGS516 ... - VMSizeTypesStandardGS516 VMSizeTypes = "Standard_GS5-16" - // VMSizeTypesStandardGS58 ... - VMSizeTypesStandardGS58 VMSizeTypes = "Standard_GS5-8" - // VMSizeTypesStandardH16 ... - VMSizeTypesStandardH16 VMSizeTypes = "Standard_H16" - // VMSizeTypesStandardH16m ... - VMSizeTypesStandardH16m VMSizeTypes = "Standard_H16m" - // VMSizeTypesStandardH16mr ... - VMSizeTypesStandardH16mr VMSizeTypes = "Standard_H16mr" - // VMSizeTypesStandardH16r ... - VMSizeTypesStandardH16r VMSizeTypes = "Standard_H16r" - // VMSizeTypesStandardH8 ... - VMSizeTypesStandardH8 VMSizeTypes = "Standard_H8" - // VMSizeTypesStandardH8m ... - VMSizeTypesStandardH8m VMSizeTypes = "Standard_H8m" - // VMSizeTypesStandardL16s ... - VMSizeTypesStandardL16s VMSizeTypes = "Standard_L16s" - // VMSizeTypesStandardL32s ... - VMSizeTypesStandardL32s VMSizeTypes = "Standard_L32s" - // VMSizeTypesStandardL4s ... - VMSizeTypesStandardL4s VMSizeTypes = "Standard_L4s" - // VMSizeTypesStandardL8s ... - VMSizeTypesStandardL8s VMSizeTypes = "Standard_L8s" - // VMSizeTypesStandardM12832ms ... - VMSizeTypesStandardM12832ms VMSizeTypes = "Standard_M128-32ms" - // VMSizeTypesStandardM12864ms ... - VMSizeTypesStandardM12864ms VMSizeTypes = "Standard_M128-64ms" - // VMSizeTypesStandardM128ms ... - VMSizeTypesStandardM128ms VMSizeTypes = "Standard_M128ms" - // VMSizeTypesStandardM128s ... - VMSizeTypesStandardM128s VMSizeTypes = "Standard_M128s" - // VMSizeTypesStandardM6416ms ... - VMSizeTypesStandardM6416ms VMSizeTypes = "Standard_M64-16ms" - // VMSizeTypesStandardM6432ms ... - VMSizeTypesStandardM6432ms VMSizeTypes = "Standard_M64-32ms" - // VMSizeTypesStandardM64ms ... - VMSizeTypesStandardM64ms VMSizeTypes = "Standard_M64ms" - // VMSizeTypesStandardM64s ... - VMSizeTypesStandardM64s VMSizeTypes = "Standard_M64s" - // VMSizeTypesStandardNC12 ... - VMSizeTypesStandardNC12 VMSizeTypes = "Standard_NC12" - // VMSizeTypesStandardNC12sV2 ... - VMSizeTypesStandardNC12sV2 VMSizeTypes = "Standard_NC12s_v2" - // VMSizeTypesStandardNC12sV3 ... - VMSizeTypesStandardNC12sV3 VMSizeTypes = "Standard_NC12s_v3" - // VMSizeTypesStandardNC24 ... - VMSizeTypesStandardNC24 VMSizeTypes = "Standard_NC24" - // VMSizeTypesStandardNC24r ... - VMSizeTypesStandardNC24r VMSizeTypes = "Standard_NC24r" - // VMSizeTypesStandardNC24rsV2 ... - VMSizeTypesStandardNC24rsV2 VMSizeTypes = "Standard_NC24rs_v2" - // VMSizeTypesStandardNC24rsV3 ... - VMSizeTypesStandardNC24rsV3 VMSizeTypes = "Standard_NC24rs_v3" - // VMSizeTypesStandardNC24sV2 ... - VMSizeTypesStandardNC24sV2 VMSizeTypes = "Standard_NC24s_v2" - // VMSizeTypesStandardNC24sV3 ... - VMSizeTypesStandardNC24sV3 VMSizeTypes = "Standard_NC24s_v3" - // VMSizeTypesStandardNC6 ... - VMSizeTypesStandardNC6 VMSizeTypes = "Standard_NC6" - // VMSizeTypesStandardNC6sV2 ... - VMSizeTypesStandardNC6sV2 VMSizeTypes = "Standard_NC6s_v2" - // VMSizeTypesStandardNC6sV3 ... - VMSizeTypesStandardNC6sV3 VMSizeTypes = "Standard_NC6s_v3" - // VMSizeTypesStandardND12s ... - VMSizeTypesStandardND12s VMSizeTypes = "Standard_ND12s" - // VMSizeTypesStandardND24rs ... - VMSizeTypesStandardND24rs VMSizeTypes = "Standard_ND24rs" - // VMSizeTypesStandardND24s ... - VMSizeTypesStandardND24s VMSizeTypes = "Standard_ND24s" - // VMSizeTypesStandardND6s ... - VMSizeTypesStandardND6s VMSizeTypes = "Standard_ND6s" - // VMSizeTypesStandardNV12 ... - VMSizeTypesStandardNV12 VMSizeTypes = "Standard_NV12" - // VMSizeTypesStandardNV24 ... - VMSizeTypesStandardNV24 VMSizeTypes = "Standard_NV24" - // VMSizeTypesStandardNV6 ... - VMSizeTypesStandardNV6 VMSizeTypes = "Standard_NV6" -) - -// PossibleVMSizeTypesValues returns an array of possible values for the VMSizeTypes const type. -func PossibleVMSizeTypesValues() []VMSizeTypes { - return []VMSizeTypes{VMSizeTypesStandardA1, VMSizeTypesStandardA10, VMSizeTypesStandardA11, VMSizeTypesStandardA1V2, VMSizeTypesStandardA2, VMSizeTypesStandardA2mV2, VMSizeTypesStandardA2V2, VMSizeTypesStandardA3, VMSizeTypesStandardA4, VMSizeTypesStandardA4mV2, VMSizeTypesStandardA4V2, VMSizeTypesStandardA5, VMSizeTypesStandardA6, VMSizeTypesStandardA7, VMSizeTypesStandardA8, VMSizeTypesStandardA8mV2, VMSizeTypesStandardA8V2, VMSizeTypesStandardA9, VMSizeTypesStandardB2ms, VMSizeTypesStandardB2s, VMSizeTypesStandardB4ms, VMSizeTypesStandardB8ms, VMSizeTypesStandardD1, VMSizeTypesStandardD11, VMSizeTypesStandardD11V2, VMSizeTypesStandardD11V2Promo, VMSizeTypesStandardD12, VMSizeTypesStandardD12V2, VMSizeTypesStandardD12V2Promo, VMSizeTypesStandardD13, VMSizeTypesStandardD13V2, VMSizeTypesStandardD13V2Promo, VMSizeTypesStandardD14, VMSizeTypesStandardD14V2, VMSizeTypesStandardD14V2Promo, VMSizeTypesStandardD15V2, VMSizeTypesStandardD16sV3, VMSizeTypesStandardD16V3, VMSizeTypesStandardD1V2, VMSizeTypesStandardD2, VMSizeTypesStandardD2sV3, VMSizeTypesStandardD2V2, VMSizeTypesStandardD2V2Promo, VMSizeTypesStandardD2V3, VMSizeTypesStandardD3, VMSizeTypesStandardD32sV3, VMSizeTypesStandardD32V3, VMSizeTypesStandardD3V2, VMSizeTypesStandardD3V2Promo, VMSizeTypesStandardD4, VMSizeTypesStandardD4sV3, VMSizeTypesStandardD4V2, VMSizeTypesStandardD4V2Promo, VMSizeTypesStandardD4V3, VMSizeTypesStandardD5V2, VMSizeTypesStandardD5V2Promo, VMSizeTypesStandardD64sV3, VMSizeTypesStandardD64V3, VMSizeTypesStandardD8sV3, VMSizeTypesStandardD8V3, VMSizeTypesStandardDS1, VMSizeTypesStandardDS11, VMSizeTypesStandardDS11V2, VMSizeTypesStandardDS11V2Promo, VMSizeTypesStandardDS12, VMSizeTypesStandardDS12V2, VMSizeTypesStandardDS12V2Promo, VMSizeTypesStandardDS13, VMSizeTypesStandardDS132V2, VMSizeTypesStandardDS134V2, VMSizeTypesStandardDS13V2, VMSizeTypesStandardDS13V2Promo, VMSizeTypesStandardDS14, VMSizeTypesStandardDS144V2, VMSizeTypesStandardDS148V2, VMSizeTypesStandardDS14V2, VMSizeTypesStandardDS14V2Promo, VMSizeTypesStandardDS15V2, VMSizeTypesStandardDS1V2, VMSizeTypesStandardDS2, VMSizeTypesStandardDS2V2, VMSizeTypesStandardDS2V2Promo, VMSizeTypesStandardDS3, VMSizeTypesStandardDS3V2, VMSizeTypesStandardDS3V2Promo, VMSizeTypesStandardDS4, VMSizeTypesStandardDS4V2, VMSizeTypesStandardDS4V2Promo, VMSizeTypesStandardDS5V2, VMSizeTypesStandardDS5V2Promo, VMSizeTypesStandardE16sV3, VMSizeTypesStandardE16V3, VMSizeTypesStandardE2sV3, VMSizeTypesStandardE2V3, VMSizeTypesStandardE3216sV3, VMSizeTypesStandardE328sV3, VMSizeTypesStandardE32sV3, VMSizeTypesStandardE32V3, VMSizeTypesStandardE4sV3, VMSizeTypesStandardE4V3, VMSizeTypesStandardE6416sV3, VMSizeTypesStandardE6432sV3, VMSizeTypesStandardE64sV3, VMSizeTypesStandardE64V3, VMSizeTypesStandardE8sV3, VMSizeTypesStandardE8V3, VMSizeTypesStandardF1, VMSizeTypesStandardF16, VMSizeTypesStandardF16s, VMSizeTypesStandardF16sV2, VMSizeTypesStandardF1s, VMSizeTypesStandardF2, VMSizeTypesStandardF2s, VMSizeTypesStandardF2sV2, VMSizeTypesStandardF32sV2, VMSizeTypesStandardF4, VMSizeTypesStandardF4s, VMSizeTypesStandardF4sV2, VMSizeTypesStandardF64sV2, VMSizeTypesStandardF72sV2, VMSizeTypesStandardF8, VMSizeTypesStandardF8s, VMSizeTypesStandardF8sV2, VMSizeTypesStandardG1, VMSizeTypesStandardG2, VMSizeTypesStandardG3, VMSizeTypesStandardG4, VMSizeTypesStandardG5, VMSizeTypesStandardGS1, VMSizeTypesStandardGS2, VMSizeTypesStandardGS3, VMSizeTypesStandardGS4, VMSizeTypesStandardGS44, VMSizeTypesStandardGS48, VMSizeTypesStandardGS5, VMSizeTypesStandardGS516, VMSizeTypesStandardGS58, VMSizeTypesStandardH16, VMSizeTypesStandardH16m, VMSizeTypesStandardH16mr, VMSizeTypesStandardH16r, VMSizeTypesStandardH8, VMSizeTypesStandardH8m, VMSizeTypesStandardL16s, VMSizeTypesStandardL32s, VMSizeTypesStandardL4s, VMSizeTypesStandardL8s, VMSizeTypesStandardM12832ms, VMSizeTypesStandardM12864ms, VMSizeTypesStandardM128ms, VMSizeTypesStandardM128s, VMSizeTypesStandardM6416ms, VMSizeTypesStandardM6432ms, VMSizeTypesStandardM64ms, VMSizeTypesStandardM64s, VMSizeTypesStandardNC12, VMSizeTypesStandardNC12sV2, VMSizeTypesStandardNC12sV3, VMSizeTypesStandardNC24, VMSizeTypesStandardNC24r, VMSizeTypesStandardNC24rsV2, VMSizeTypesStandardNC24rsV3, VMSizeTypesStandardNC24sV2, VMSizeTypesStandardNC24sV3, VMSizeTypesStandardNC6, VMSizeTypesStandardNC6sV2, VMSizeTypesStandardNC6sV3, VMSizeTypesStandardND12s, VMSizeTypesStandardND24rs, VMSizeTypesStandardND24s, VMSizeTypesStandardND6s, VMSizeTypesStandardNV12, VMSizeTypesStandardNV24, VMSizeTypesStandardNV6} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/managedclusters.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/managedclusters.go deleted file mode 100644 index 07fc9ac41a93..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/managedclusters.go +++ /dev/null @@ -1,1288 +0,0 @@ -package containerservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ManagedClustersClient is the the Container Service Client. -type ManagedClustersClient struct { - BaseClient -} - -// NewManagedClustersClient creates an instance of the ManagedClustersClient client. -func NewManagedClustersClient(subscriptionID string) ManagedClustersClient { - return NewManagedClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedClustersClientWithBaseURI creates an instance of the ManagedClustersClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewManagedClustersClientWithBaseURI(baseURI string, subscriptionID string) ManagedClustersClient { - return ManagedClustersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a managed cluster with the specified configuration for agents and Kubernetes -// version. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -// parameters - parameters supplied to the Create or Update a Managed Cluster operation. -func (client ManagedClustersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedCluster) (result ManagedClustersCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ManagedClusterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile.AdminUsername", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile.AdminUsername", Name: validation.Pattern, Rule: `^[A-Za-z][-A-Za-z0-9_]*$`, Chain: nil}}}, - {Target: "parameters.ManagedClusterProperties.LinuxProfile.SSH", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile.SSH.PublicKeys", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - {Target: "parameters.ManagedClusterProperties.WindowsProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.WindowsProfile.AdminUsername", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.ManagedClusterProperties.ServicePrincipalProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.ServicePrincipalProfile.ClientID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.ManagedClusterProperties.NetworkProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.PodCidr", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.PodCidr", Name: validation.Pattern, Rule: `^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$`, Chain: nil}}}, - {Target: "parameters.ManagedClusterProperties.NetworkProfile.ServiceCidr", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.ServiceCidr", Name: validation.Pattern, Rule: `^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$`, Chain: nil}}}, - {Target: "parameters.ManagedClusterProperties.NetworkProfile.DNSServiceIP", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.DNSServiceIP", Name: validation.Pattern, Rule: `^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$`, Chain: nil}}}, - {Target: "parameters.ManagedClusterProperties.NetworkProfile.DockerBridgeCidr", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.DockerBridgeCidr", Name: validation.Pattern, Rule: `^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$`, Chain: nil}}}, - {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, - {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}, - }}, - }}, - {Target: "parameters.ManagedClusterProperties.AadProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.AadProfile.ClientAppID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ManagedClusterProperties.AadProfile.ServerAppID", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerservice.ManagedClustersClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedCluster) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedClustersClient) CreateOrUpdateSender(req *http.Request) (future ManagedClustersCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ManagedClustersClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedCluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the managed cluster with a specified resource group and name. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -func (client ManagedClustersClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.ManagedClustersClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedClustersClient) DeleteSender(req *http.Request) (future ManagedClustersDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ManagedClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the managed cluster with a specified resource group and name. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -func (client ManagedClustersClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedCluster, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.ManagedClustersClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedClustersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ManagedClustersClient) GetResponder(resp *http.Response) (result ManagedCluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAccessProfile gets the accessProfile for the specified role name of the managed cluster with a specified resource -// group and name. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -// roleName - the name of the role for managed cluster accessProfile resource. -func (client ManagedClustersClient) GetAccessProfile(ctx context.Context, resourceGroupName string, resourceName string, roleName string) (result ManagedClusterAccessProfile, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.GetAccessProfile") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.ManagedClustersClient", "GetAccessProfile", err.Error()) - } - - req, err := client.GetAccessProfilePreparer(ctx, resourceGroupName, resourceName, roleName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetAccessProfile", nil, "Failure preparing request") - return - } - - resp, err := client.GetAccessProfileSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetAccessProfile", resp, "Failure sending request") - return - } - - result, err = client.GetAccessProfileResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetAccessProfile", resp, "Failure responding to request") - return - } - - return -} - -// GetAccessProfilePreparer prepares the GetAccessProfile request. -func (client ManagedClustersClient) GetAccessProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, roleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "roleName": autorest.Encode("path", roleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAccessProfileSender sends the GetAccessProfile request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedClustersClient) GetAccessProfileSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAccessProfileResponder handles the response to the GetAccessProfile request. The method always -// closes the http.Response Body. -func (client ManagedClustersClient) GetAccessProfileResponder(resp *http.Response) (result ManagedClusterAccessProfile, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetUpgradeProfile gets the details of the upgrade profile for a managed cluster with a specified resource group and -// name. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -func (client ManagedClustersClient) GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClusterUpgradeProfile, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.GetUpgradeProfile") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.ManagedClustersClient", "GetUpgradeProfile", err.Error()) - } - - req, err := client.GetUpgradeProfilePreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetUpgradeProfile", nil, "Failure preparing request") - return - } - - resp, err := client.GetUpgradeProfileSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetUpgradeProfile", resp, "Failure sending request") - return - } - - result, err = client.GetUpgradeProfileResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetUpgradeProfile", resp, "Failure responding to request") - return - } - - return -} - -// GetUpgradeProfilePreparer prepares the GetUpgradeProfile request. -func (client ManagedClustersClient) GetUpgradeProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetUpgradeProfileSender sends the GetUpgradeProfile request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedClustersClient) GetUpgradeProfileSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetUpgradeProfileResponder handles the response to the GetUpgradeProfile request. The method always -// closes the http.Response Body. -func (client ManagedClustersClient) GetUpgradeProfileResponder(resp *http.Response) (result ManagedClusterUpgradeProfile, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of managed clusters in the specified subscription. The operation returns properties of each managed -// cluster. -func (client ManagedClustersClient) List(ctx context.Context) (result ManagedClusterListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.List") - defer func() { - sc := -1 - if result.mclr.Response.Response != nil { - sc = result.mclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.mclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "List", resp, "Failure sending request") - return - } - - result.mclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "List", resp, "Failure responding to request") - return - } - if result.mclr.hasNextLink() && result.mclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ManagedClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedClustersClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ManagedClustersClient) ListResponder(resp *http.Response) (result ManagedClusterListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ManagedClustersClient) listNextResults(ctx context.Context, lastResults ManagedClusterListResult) (result ManagedClusterListResult, err error) { - req, err := lastResults.managedClusterListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedClustersClient) ListComplete(ctx context.Context) (result ManagedClusterListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup lists managed clusters in the specified subscription and resource group. The operation returns -// properties of each managed cluster. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ManagedClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ManagedClusterListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.mclr.Response.Response != nil { - sc = result.mclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.ManagedClustersClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.mclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.mclr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.mclr.hasNextLink() && result.mclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ManagedClustersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ManagedClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ManagedClusterListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ManagedClustersClient) listByResourceGroupNextResults(ctx context.Context, lastResults ManagedClusterListResult) (result ManagedClusterListResult, err error) { - req, err := lastResults.managedClusterListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagedClustersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ManagedClusterListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListClusterAdminCredentials gets cluster admin credential of the managed cluster with a specified resource group and -// name. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -func (client ManagedClustersClient) ListClusterAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string) (result CredentialResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListClusterAdminCredentials") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.ManagedClustersClient", "ListClusterAdminCredentials", err.Error()) - } - - req, err := client.ListClusterAdminCredentialsPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterAdminCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListClusterAdminCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterAdminCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListClusterAdminCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterAdminCredentials", resp, "Failure responding to request") - return - } - - return -} - -// ListClusterAdminCredentialsPreparer prepares the ListClusterAdminCredentials request. -func (client ManagedClustersClient) ListClusterAdminCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListClusterAdminCredentialsSender sends the ListClusterAdminCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedClustersClient) ListClusterAdminCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListClusterAdminCredentialsResponder handles the response to the ListClusterAdminCredentials request. The method always -// closes the http.Response Body. -func (client ManagedClustersClient) ListClusterAdminCredentialsResponder(resp *http.Response) (result CredentialResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListClusterUserCredentials gets cluster user credential of the managed cluster with a specified resource group and -// name. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -func (client ManagedClustersClient) ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string) (result CredentialResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListClusterUserCredentials") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.ManagedClustersClient", "ListClusterUserCredentials", err.Error()) - } - - req, err := client.ListClusterUserCredentialsPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterUserCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListClusterUserCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterUserCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListClusterUserCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterUserCredentials", resp, "Failure responding to request") - return - } - - return -} - -// ListClusterUserCredentialsPreparer prepares the ListClusterUserCredentials request. -func (client ManagedClustersClient) ListClusterUserCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListClusterUserCredentialsSender sends the ListClusterUserCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedClustersClient) ListClusterUserCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListClusterUserCredentialsResponder handles the response to the ListClusterUserCredentials request. The method always -// closes the http.Response Body. -func (client ManagedClustersClient) ListClusterUserCredentialsResponder(resp *http.Response) (result CredentialResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ResetAADProfile update the AAD Profile for a managed cluster. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -// parameters - parameters supplied to the Reset AAD Profile operation for a Managed Cluster. -func (client ManagedClustersClient) ResetAADProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterAADProfile) (result ManagedClustersResetAADProfileFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ResetAADProfile") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ClientAppID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ServerAppID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.ManagedClustersClient", "ResetAADProfile", err.Error()) - } - - req, err := client.ResetAADProfilePreparer(ctx, resourceGroupName, resourceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetAADProfile", nil, "Failure preparing request") - return - } - - result, err = client.ResetAADProfileSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetAADProfile", result.Response(), "Failure sending request") - return - } - - return -} - -// ResetAADProfilePreparer prepares the ResetAADProfile request. -func (client ManagedClustersClient) ResetAADProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterAADProfile) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ResetAADProfileSender sends the ResetAADProfile request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedClustersClient) ResetAADProfileSender(req *http.Request) (future ManagedClustersResetAADProfileFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ResetAADProfileResponder handles the response to the ResetAADProfile request. The method always -// closes the http.Response Body. -func (client ManagedClustersClient) ResetAADProfileResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ResetServicePrincipalProfile update the service principal Profile for a managed cluster. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -// parameters - parameters supplied to the Reset Service Principal Profile operation for a Managed Cluster. -func (client ManagedClustersClient) ResetServicePrincipalProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterServicePrincipalProfile) (result ManagedClustersResetServicePrincipalProfileFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ResetServicePrincipalProfile") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ClientID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.ManagedClustersClient", "ResetServicePrincipalProfile", err.Error()) - } - - req, err := client.ResetServicePrincipalProfilePreparer(ctx, resourceGroupName, resourceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetServicePrincipalProfile", nil, "Failure preparing request") - return - } - - result, err = client.ResetServicePrincipalProfileSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetServicePrincipalProfile", result.Response(), "Failure sending request") - return - } - - return -} - -// ResetServicePrincipalProfilePreparer prepares the ResetServicePrincipalProfile request. -func (client ManagedClustersClient) ResetServicePrincipalProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterServicePrincipalProfile) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ResetServicePrincipalProfileSender sends the ResetServicePrincipalProfile request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedClustersClient) ResetServicePrincipalProfileSender(req *http.Request) (future ManagedClustersResetServicePrincipalProfileFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ResetServicePrincipalProfileResponder handles the response to the ResetServicePrincipalProfile request. The method always -// closes the http.Response Body. -func (client ManagedClustersClient) ResetServicePrincipalProfileResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// RotateClusterCertificates rotate certificates of a managed cluster. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -func (client ManagedClustersClient) RotateClusterCertificates(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersRotateClusterCertificatesFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.RotateClusterCertificates") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.ManagedClustersClient", "RotateClusterCertificates", err.Error()) - } - - req, err := client.RotateClusterCertificatesPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RotateClusterCertificates", nil, "Failure preparing request") - return - } - - result, err = client.RotateClusterCertificatesSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RotateClusterCertificates", result.Response(), "Failure sending request") - return - } - - return -} - -// RotateClusterCertificatesPreparer prepares the RotateClusterCertificates request. -func (client ManagedClustersClient) RotateClusterCertificatesPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RotateClusterCertificatesSender sends the RotateClusterCertificates request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedClustersClient) RotateClusterCertificatesSender(req *http.Request) (future ManagedClustersRotateClusterCertificatesFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RotateClusterCertificatesResponder handles the response to the RotateClusterCertificates request. The method always -// closes the http.Response Body. -func (client ManagedClustersClient) RotateClusterCertificatesResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// UpdateTags updates a managed cluster with the specified tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -// parameters - parameters supplied to the Update Managed Cluster Tags operation. -func (client ManagedClustersClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (result ManagedClustersUpdateTagsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.UpdateTags") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.ManagedClustersClient", "UpdateTags", err.Error()) - } - - req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, resourceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "UpdateTags", nil, "Failure preparing request") - return - } - - result, err = client.UpdateTagsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "UpdateTags", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateTagsPreparer prepares the UpdateTags request. -func (client ManagedClustersClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTagsSender sends the UpdateTags request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedClustersClient) UpdateTagsSender(req *http.Request) (future ManagedClustersUpdateTagsFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateTagsResponder handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (client ManagedClustersClient) UpdateTagsResponder(resp *http.Response) (result ManagedCluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/models.go deleted file mode 100644 index 5d3f58260f2c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/models.go +++ /dev/null @@ -1,3239 +0,0 @@ -package containerservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice" - -// AccessProfile profile for enabling a user to access a managed cluster. -type AccessProfile struct { - // KubeConfig - Base64-encoded Kubernetes configuration file. - KubeConfig *[]byte `json:"kubeConfig,omitempty"` -} - -// AgentPool agent Pool. -type AgentPool struct { - autorest.Response `json:"-"` - // ManagedClusterAgentPoolProfileProperties - Properties of an agent pool. - *ManagedClusterAgentPoolProfileProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPool. -func (ap AgentPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.ManagedClusterAgentPoolProfileProperties != nil { - objectMap["properties"] = ap.ManagedClusterAgentPoolProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AgentPool struct. -func (ap *AgentPool) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var managedClusterAgentPoolProfileProperties ManagedClusterAgentPoolProfileProperties - err = json.Unmarshal(*v, &managedClusterAgentPoolProfileProperties) - if err != nil { - return err - } - ap.ManagedClusterAgentPoolProfileProperties = &managedClusterAgentPoolProfileProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ap.Type = &typeVar - } - } - } - - return nil -} - -// AgentPoolAvailableVersions the list of available versions for an agent pool. -type AgentPoolAvailableVersions struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Id of the agent pool available versions. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the agent pool available versions. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the agent pool available versions. - Type *string `json:"type,omitempty"` - // AgentPoolAvailableVersionsProperties - Properties of agent pool available versions. - *AgentPoolAvailableVersionsProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPoolAvailableVersions. -func (apav AgentPoolAvailableVersions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if apav.AgentPoolAvailableVersionsProperties != nil { - objectMap["properties"] = apav.AgentPoolAvailableVersionsProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AgentPoolAvailableVersions struct. -func (apav *AgentPoolAvailableVersions) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - apav.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - apav.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - apav.Type = &typeVar - } - case "properties": - if v != nil { - var agentPoolAvailableVersionsProperties AgentPoolAvailableVersionsProperties - err = json.Unmarshal(*v, &agentPoolAvailableVersionsProperties) - if err != nil { - return err - } - apav.AgentPoolAvailableVersionsProperties = &agentPoolAvailableVersionsProperties - } - } - } - - return nil -} - -// AgentPoolAvailableVersionsProperties the list of available agent pool versions. -type AgentPoolAvailableVersionsProperties struct { - // AgentPoolVersions - List of versions available for agent pool. - AgentPoolVersions *[]AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem `json:"agentPoolVersions,omitempty"` -} - -// AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem ... -type AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem struct { - // Default - Whether this version is the default agent pool version. - Default *bool `json:"default,omitempty"` - // KubernetesVersion - Kubernetes version (major, minor, patch). - KubernetesVersion *string `json:"kubernetesVersion,omitempty"` - // IsPreview - Whether Kubernetes version is currently in preview. - IsPreview *bool `json:"isPreview,omitempty"` -} - -// AgentPoolListResult the response from the List Agent Pools operation. -type AgentPoolListResult struct { - autorest.Response `json:"-"` - // Value - The list of agent pools. - Value *[]AgentPool `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of agent pool results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPoolListResult. -func (aplr AgentPoolListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aplr.Value != nil { - objectMap["value"] = aplr.Value - } - return json.Marshal(objectMap) -} - -// AgentPoolListResultIterator provides access to a complete listing of AgentPool values. -type AgentPoolListResultIterator struct { - i int - page AgentPoolListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AgentPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AgentPoolListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AgentPoolListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AgentPoolListResultIterator) Response() AgentPoolListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AgentPoolListResultIterator) Value() AgentPool { - if !iter.page.NotDone() { - return AgentPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AgentPoolListResultIterator type. -func NewAgentPoolListResultIterator(page AgentPoolListResultPage) AgentPoolListResultIterator { - return AgentPoolListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aplr AgentPoolListResult) IsEmpty() bool { - return aplr.Value == nil || len(*aplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aplr AgentPoolListResult) hasNextLink() bool { - return aplr.NextLink != nil && len(*aplr.NextLink) != 0 -} - -// agentPoolListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aplr AgentPoolListResult) agentPoolListResultPreparer(ctx context.Context) (*http.Request, error) { - if !aplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aplr.NextLink))) -} - -// AgentPoolListResultPage contains a page of AgentPool values. -type AgentPoolListResultPage struct { - fn func(context.Context, AgentPoolListResult) (AgentPoolListResult, error) - aplr AgentPoolListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AgentPoolListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.aplr) - if err != nil { - return err - } - page.aplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AgentPoolListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AgentPoolListResultPage) NotDone() bool { - return !page.aplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AgentPoolListResultPage) Response() AgentPoolListResult { - return page.aplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AgentPoolListResultPage) Values() []AgentPool { - if page.aplr.IsEmpty() { - return nil - } - return *page.aplr.Value -} - -// Creates a new instance of the AgentPoolListResultPage type. -func NewAgentPoolListResultPage(cur AgentPoolListResult, getNextPage func(context.Context, AgentPoolListResult) (AgentPoolListResult, error)) AgentPoolListResultPage { - return AgentPoolListResultPage{ - fn: getNextPage, - aplr: cur, - } -} - -// AgentPoolProfile profile for the container service agent pool. -type AgentPoolProfile struct { - // Name - Unique name of the agent pool profile in the context of the subscription and resource group. - Name *string `json:"name,omitempty"` - // Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. - Count *int32 `json:"count,omitempty"` - // VMSize - Size of agent VMs. Possible values include: 'VMSizeTypesStandardA1', 'VMSizeTypesStandardA10', 'VMSizeTypesStandardA11', 'VMSizeTypesStandardA1V2', 'VMSizeTypesStandardA2', 'VMSizeTypesStandardA2V2', 'VMSizeTypesStandardA2mV2', 'VMSizeTypesStandardA3', 'VMSizeTypesStandardA4', 'VMSizeTypesStandardA4V2', 'VMSizeTypesStandardA4mV2', 'VMSizeTypesStandardA5', 'VMSizeTypesStandardA6', 'VMSizeTypesStandardA7', 'VMSizeTypesStandardA8', 'VMSizeTypesStandardA8V2', 'VMSizeTypesStandardA8mV2', 'VMSizeTypesStandardA9', 'VMSizeTypesStandardB2ms', 'VMSizeTypesStandardB2s', 'VMSizeTypesStandardB4ms', 'VMSizeTypesStandardB8ms', 'VMSizeTypesStandardD1', 'VMSizeTypesStandardD11', 'VMSizeTypesStandardD11V2', 'VMSizeTypesStandardD11V2Promo', 'VMSizeTypesStandardD12', 'VMSizeTypesStandardD12V2', 'VMSizeTypesStandardD12V2Promo', 'VMSizeTypesStandardD13', 'VMSizeTypesStandardD13V2', 'VMSizeTypesStandardD13V2Promo', 'VMSizeTypesStandardD14', 'VMSizeTypesStandardD14V2', 'VMSizeTypesStandardD14V2Promo', 'VMSizeTypesStandardD15V2', 'VMSizeTypesStandardD16V3', 'VMSizeTypesStandardD16sV3', 'VMSizeTypesStandardD1V2', 'VMSizeTypesStandardD2', 'VMSizeTypesStandardD2V2', 'VMSizeTypesStandardD2V2Promo', 'VMSizeTypesStandardD2V3', 'VMSizeTypesStandardD2sV3', 'VMSizeTypesStandardD3', 'VMSizeTypesStandardD32V3', 'VMSizeTypesStandardD32sV3', 'VMSizeTypesStandardD3V2', 'VMSizeTypesStandardD3V2Promo', 'VMSizeTypesStandardD4', 'VMSizeTypesStandardD4V2', 'VMSizeTypesStandardD4V2Promo', 'VMSizeTypesStandardD4V3', 'VMSizeTypesStandardD4sV3', 'VMSizeTypesStandardD5V2', 'VMSizeTypesStandardD5V2Promo', 'VMSizeTypesStandardD64V3', 'VMSizeTypesStandardD64sV3', 'VMSizeTypesStandardD8V3', 'VMSizeTypesStandardD8sV3', 'VMSizeTypesStandardDS1', 'VMSizeTypesStandardDS11', 'VMSizeTypesStandardDS11V2', 'VMSizeTypesStandardDS11V2Promo', 'VMSizeTypesStandardDS12', 'VMSizeTypesStandardDS12V2', 'VMSizeTypesStandardDS12V2Promo', 'VMSizeTypesStandardDS13', 'VMSizeTypesStandardDS132V2', 'VMSizeTypesStandardDS134V2', 'VMSizeTypesStandardDS13V2', 'VMSizeTypesStandardDS13V2Promo', 'VMSizeTypesStandardDS14', 'VMSizeTypesStandardDS144V2', 'VMSizeTypesStandardDS148V2', 'VMSizeTypesStandardDS14V2', 'VMSizeTypesStandardDS14V2Promo', 'VMSizeTypesStandardDS15V2', 'VMSizeTypesStandardDS1V2', 'VMSizeTypesStandardDS2', 'VMSizeTypesStandardDS2V2', 'VMSizeTypesStandardDS2V2Promo', 'VMSizeTypesStandardDS3', 'VMSizeTypesStandardDS3V2', 'VMSizeTypesStandardDS3V2Promo', 'VMSizeTypesStandardDS4', 'VMSizeTypesStandardDS4V2', 'VMSizeTypesStandardDS4V2Promo', 'VMSizeTypesStandardDS5V2', 'VMSizeTypesStandardDS5V2Promo', 'VMSizeTypesStandardE16V3', 'VMSizeTypesStandardE16sV3', 'VMSizeTypesStandardE2V3', 'VMSizeTypesStandardE2sV3', 'VMSizeTypesStandardE3216sV3', 'VMSizeTypesStandardE328sV3', 'VMSizeTypesStandardE32V3', 'VMSizeTypesStandardE32sV3', 'VMSizeTypesStandardE4V3', 'VMSizeTypesStandardE4sV3', 'VMSizeTypesStandardE6416sV3', 'VMSizeTypesStandardE6432sV3', 'VMSizeTypesStandardE64V3', 'VMSizeTypesStandardE64sV3', 'VMSizeTypesStandardE8V3', 'VMSizeTypesStandardE8sV3', 'VMSizeTypesStandardF1', 'VMSizeTypesStandardF16', 'VMSizeTypesStandardF16s', 'VMSizeTypesStandardF16sV2', 'VMSizeTypesStandardF1s', 'VMSizeTypesStandardF2', 'VMSizeTypesStandardF2s', 'VMSizeTypesStandardF2sV2', 'VMSizeTypesStandardF32sV2', 'VMSizeTypesStandardF4', 'VMSizeTypesStandardF4s', 'VMSizeTypesStandardF4sV2', 'VMSizeTypesStandardF64sV2', 'VMSizeTypesStandardF72sV2', 'VMSizeTypesStandardF8', 'VMSizeTypesStandardF8s', 'VMSizeTypesStandardF8sV2', 'VMSizeTypesStandardG1', 'VMSizeTypesStandardG2', 'VMSizeTypesStandardG3', 'VMSizeTypesStandardG4', 'VMSizeTypesStandardG5', 'VMSizeTypesStandardGS1', 'VMSizeTypesStandardGS2', 'VMSizeTypesStandardGS3', 'VMSizeTypesStandardGS4', 'VMSizeTypesStandardGS44', 'VMSizeTypesStandardGS48', 'VMSizeTypesStandardGS5', 'VMSizeTypesStandardGS516', 'VMSizeTypesStandardGS58', 'VMSizeTypesStandardH16', 'VMSizeTypesStandardH16m', 'VMSizeTypesStandardH16mr', 'VMSizeTypesStandardH16r', 'VMSizeTypesStandardH8', 'VMSizeTypesStandardH8m', 'VMSizeTypesStandardL16s', 'VMSizeTypesStandardL32s', 'VMSizeTypesStandardL4s', 'VMSizeTypesStandardL8s', 'VMSizeTypesStandardM12832ms', 'VMSizeTypesStandardM12864ms', 'VMSizeTypesStandardM128ms', 'VMSizeTypesStandardM128s', 'VMSizeTypesStandardM6416ms', 'VMSizeTypesStandardM6432ms', 'VMSizeTypesStandardM64ms', 'VMSizeTypesStandardM64s', 'VMSizeTypesStandardNC12', 'VMSizeTypesStandardNC12sV2', 'VMSizeTypesStandardNC12sV3', 'VMSizeTypesStandardNC24', 'VMSizeTypesStandardNC24r', 'VMSizeTypesStandardNC24rsV2', 'VMSizeTypesStandardNC24rsV3', 'VMSizeTypesStandardNC24sV2', 'VMSizeTypesStandardNC24sV3', 'VMSizeTypesStandardNC6', 'VMSizeTypesStandardNC6sV2', 'VMSizeTypesStandardNC6sV3', 'VMSizeTypesStandardND12s', 'VMSizeTypesStandardND24rs', 'VMSizeTypesStandardND24s', 'VMSizeTypesStandardND6s', 'VMSizeTypesStandardNV12', 'VMSizeTypesStandardNV24', 'VMSizeTypesStandardNV6' - VMSize VMSizeTypes `json:"vmSize,omitempty"` - // OsDiskSizeGB - OS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. - OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` - // DNSPrefix - DNS prefix to be used to create the FQDN for the agent pool. - DNSPrefix *string `json:"dnsPrefix,omitempty"` - // Fqdn - READ-ONLY; FQDN for the agent pool. - Fqdn *string `json:"fqdn,omitempty"` - // Ports - Ports number array used to expose on this agent pool. The default opened ports are different based on your choice of orchestrator. - Ports *[]int32 `json:"ports,omitempty"` - // StorageProfile - Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. Possible values include: 'StorageAccount', 'ManagedDisks' - StorageProfile StorageProfileTypes `json:"storageProfile,omitempty"` - // VnetSubnetID - VNet SubnetID specifies the VNet's subnet identifier. - VnetSubnetID *string `json:"vnetSubnetID,omitempty"` - // OsType - OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows' - OsType OSType `json:"osType,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPoolProfile. -func (app AgentPoolProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if app.Name != nil { - objectMap["name"] = app.Name - } - if app.Count != nil { - objectMap["count"] = app.Count - } - if app.VMSize != "" { - objectMap["vmSize"] = app.VMSize - } - if app.OsDiskSizeGB != nil { - objectMap["osDiskSizeGB"] = app.OsDiskSizeGB - } - if app.DNSPrefix != nil { - objectMap["dnsPrefix"] = app.DNSPrefix - } - if app.Ports != nil { - objectMap["ports"] = app.Ports - } - if app.StorageProfile != "" { - objectMap["storageProfile"] = app.StorageProfile - } - if app.VnetSubnetID != nil { - objectMap["vnetSubnetID"] = app.VnetSubnetID - } - if app.OsType != "" { - objectMap["osType"] = app.OsType - } - return json.Marshal(objectMap) -} - -// AgentPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type AgentPoolsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (AgentPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AgentPoolsCreateOrUpdateFuture.Result. -func (future *AgentPoolsCreateOrUpdateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { - ap, err = client.CreateOrUpdateResponder(ap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsCreateOrUpdateFuture", "Result", ap.Response.Response, "Failure responding to request") - } - } - return -} - -// AgentPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AgentPoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AgentPoolsDeleteFuture.Result. -func (future *AgentPoolsDeleteFuture) result(client AgentPoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AgentPoolUpgradeProfile the list of available upgrades for an agent pool. -type AgentPoolUpgradeProfile struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Id of the agent pool upgrade profile. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the agent pool upgrade profile. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the agent pool upgrade profile. - Type *string `json:"type,omitempty"` - // AgentPoolUpgradeProfileProperties - Properties of agent pool upgrade profile. - *AgentPoolUpgradeProfileProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPoolUpgradeProfile. -func (apup AgentPoolUpgradeProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if apup.AgentPoolUpgradeProfileProperties != nil { - objectMap["properties"] = apup.AgentPoolUpgradeProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AgentPoolUpgradeProfile struct. -func (apup *AgentPoolUpgradeProfile) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - apup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - apup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - apup.Type = &typeVar - } - case "properties": - if v != nil { - var agentPoolUpgradeProfileProperties AgentPoolUpgradeProfileProperties - err = json.Unmarshal(*v, &agentPoolUpgradeProfileProperties) - if err != nil { - return err - } - apup.AgentPoolUpgradeProfileProperties = &agentPoolUpgradeProfileProperties - } - } - } - - return nil -} - -// AgentPoolUpgradeProfileProperties the list of available upgrade versions. -type AgentPoolUpgradeProfileProperties struct { - // KubernetesVersion - Kubernetes version (major, minor, patch). - KubernetesVersion *string `json:"kubernetesVersion,omitempty"` - // OsType - OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows' - OsType OSType `json:"osType,omitempty"` - // Upgrades - List of orchestrator types and versions available for upgrade. - Upgrades *[]AgentPoolUpgradeProfilePropertiesUpgradesItem `json:"upgrades,omitempty"` -} - -// AgentPoolUpgradeProfilePropertiesUpgradesItem ... -type AgentPoolUpgradeProfilePropertiesUpgradesItem struct { - // KubernetesVersion - Kubernetes version (major, minor, patch). - KubernetesVersion *string `json:"kubernetesVersion,omitempty"` - // IsPreview - Whether Kubernetes version is currently in preview. - IsPreview *bool `json:"isPreview,omitempty"` -} - -// CloudError an error response from the Container service. -type CloudError struct { - // Error - Details about the error. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from the Container service. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// ContainerService container service. -type ContainerService struct { - autorest.Response `json:"-"` - // Properties - Properties of the container service. - *Properties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ContainerService. -func (cs ContainerService) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cs.Properties != nil { - objectMap["properties"] = cs.Properties - } - if cs.Location != nil { - objectMap["location"] = cs.Location - } - if cs.Tags != nil { - objectMap["tags"] = cs.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ContainerService struct. -func (cs *ContainerService) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var properties Properties - err = json.Unmarshal(*v, &properties) - if err != nil { - return err - } - cs.Properties = &properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cs.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cs.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cs.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - cs.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cs.Tags = tags - } - } - } - - return nil -} - -// ContainerServicesCreateOrUpdateFutureType an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ContainerServicesCreateOrUpdateFutureType struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ContainerServicesClient) (ContainerService, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ContainerServicesCreateOrUpdateFutureType) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ContainerServicesCreateOrUpdateFutureType.Result. -func (future *ContainerServicesCreateOrUpdateFutureType) result(client ContainerServicesClient) (cs ContainerService, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesCreateOrUpdateFutureType", "Result", future.Response(), "Polling failure") - return - } - if !done { - cs.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ContainerServicesCreateOrUpdateFutureType") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cs.Response.Response, err = future.GetResult(sender); err == nil && cs.Response.Response.StatusCode != http.StatusNoContent { - cs, err = client.CreateOrUpdateResponder(cs.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesCreateOrUpdateFutureType", "Result", cs.Response.Response, "Failure responding to request") - } - } - return -} - -// ContainerServicesDeleteFutureType an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ContainerServicesDeleteFutureType struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ContainerServicesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ContainerServicesDeleteFutureType) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ContainerServicesDeleteFutureType.Result. -func (future *ContainerServicesDeleteFutureType) result(client ContainerServicesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesDeleteFutureType", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ContainerServicesDeleteFutureType") - return - } - ar.Response = future.Response() - return -} - -// CredentialResult the credential result response. -type CredentialResult struct { - // Name - READ-ONLY; The name of the credential. - Name *string `json:"name,omitempty"` - // Value - READ-ONLY; Base64-encoded Kubernetes configuration file. - Value *[]byte `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CredentialResult. -func (cr CredentialResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CredentialResults the list of credential result response. -type CredentialResults struct { - autorest.Response `json:"-"` - // Kubeconfigs - READ-ONLY; Base64-encoded Kubernetes configuration file. - Kubeconfigs *[]CredentialResult `json:"kubeconfigs,omitempty"` -} - -// MarshalJSON is the custom marshaler for CredentialResults. -func (cr CredentialResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CustomProfile properties to configure a custom container service cluster. -type CustomProfile struct { - // Orchestrator - The name of the custom orchestrator to use. - Orchestrator *string `json:"orchestrator,omitempty"` -} - -// DiagnosticsProfile profile for diagnostics on the container service cluster. -type DiagnosticsProfile struct { - // VMDiagnostics - Profile for diagnostics on the container service VMs. - VMDiagnostics *VMDiagnostics `json:"vmDiagnostics,omitempty"` -} - -// KeyVaultSecretRef reference to a secret stored in Azure Key Vault. -type KeyVaultSecretRef struct { - // VaultID - Key vault identifier. - VaultID *string `json:"vaultID,omitempty"` - // SecretName - The secret name. - SecretName *string `json:"secretName,omitempty"` - // Version - The secret version. - Version *string `json:"version,omitempty"` -} - -// LinuxProfile profile for Linux VMs in the container service cluster. -type LinuxProfile struct { - // AdminUsername - The administrator username to use for Linux VMs. - AdminUsername *string `json:"adminUsername,omitempty"` - // SSH - SSH configuration for Linux-based VMs running on Azure. - SSH *SSHConfiguration `json:"ssh,omitempty"` -} - -// ListResult the response from the List Container Services operation. -type ListResult struct { - autorest.Response `json:"-"` - // Value - The list of container services. - Value *[]ContainerService `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of container service results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListResult. -func (lr ListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lr.Value != nil { - objectMap["value"] = lr.Value - } - return json.Marshal(objectMap) -} - -// ListResultIterator provides access to a complete listing of ContainerService values. -type ListResultIterator struct { - i int - page ListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListResultIterator) Response() ListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListResultIterator) Value() ContainerService { - if !iter.page.NotDone() { - return ContainerService{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListResultIterator type. -func NewListResultIterator(page ListResultPage) ListResultIterator { - return ListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lr ListResult) IsEmpty() bool { - return lr.Value == nil || len(*lr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lr ListResult) hasNextLink() bool { - return lr.NextLink != nil && len(*lr.NextLink) != 0 -} - -// listResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { - if !lr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lr.NextLink))) -} - -// ListResultPage contains a page of ContainerService values. -type ListResultPage struct { - fn func(context.Context, ListResult) (ListResult, error) - lr ListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lr) - if err != nil { - return err - } - page.lr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListResultPage) NotDone() bool { - return !page.lr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListResultPage) Response() ListResult { - return page.lr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListResultPage) Values() []ContainerService { - if page.lr.IsEmpty() { - return nil - } - return *page.lr.Value -} - -// Creates a new instance of the ListResultPage type. -func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { - return ListResultPage{ - fn: getNextPage, - lr: cur, - } -} - -// ManagedCluster managed cluster. -type ManagedCluster struct { - autorest.Response `json:"-"` - // ManagedClusterProperties - Properties of a managed cluster. - *ManagedClusterProperties `json:"properties,omitempty"` - // Identity - The identity of the managed cluster, if configured. - Identity *ManagedClusterIdentity `json:"identity,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ManagedCluster. -func (mc ManagedCluster) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mc.ManagedClusterProperties != nil { - objectMap["properties"] = mc.ManagedClusterProperties - } - if mc.Identity != nil { - objectMap["identity"] = mc.Identity - } - if mc.Location != nil { - objectMap["location"] = mc.Location - } - if mc.Tags != nil { - objectMap["tags"] = mc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedCluster struct. -func (mc *ManagedCluster) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var managedClusterProperties ManagedClusterProperties - err = json.Unmarshal(*v, &managedClusterProperties) - if err != nil { - return err - } - mc.ManagedClusterProperties = &managedClusterProperties - } - case "identity": - if v != nil { - var identity ManagedClusterIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - mc.Identity = &identity - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mc.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mc.Tags = tags - } - } - } - - return nil -} - -// ManagedClusterAADProfile aADProfile specifies attributes for Azure Active Directory integration. -type ManagedClusterAADProfile struct { - // ClientAppID - The client AAD application ID. - ClientAppID *string `json:"clientAppID,omitempty"` - // ServerAppID - The server AAD application ID. - ServerAppID *string `json:"serverAppID,omitempty"` - // ServerAppSecret - The server AAD application secret. - ServerAppSecret *string `json:"serverAppSecret,omitempty"` - // TenantID - The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. - TenantID *string `json:"tenantID,omitempty"` -} - -// ManagedClusterAccessProfile managed cluster Access Profile. -type ManagedClusterAccessProfile struct { - autorest.Response `json:"-"` - // AccessProfile - AccessProfile of a managed cluster. - *AccessProfile `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterAccessProfile. -func (mcap ManagedClusterAccessProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcap.AccessProfile != nil { - objectMap["properties"] = mcap.AccessProfile - } - if mcap.Location != nil { - objectMap["location"] = mcap.Location - } - if mcap.Tags != nil { - objectMap["tags"] = mcap.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedClusterAccessProfile struct. -func (mcap *ManagedClusterAccessProfile) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var accessProfile AccessProfile - err = json.Unmarshal(*v, &accessProfile) - if err != nil { - return err - } - mcap.AccessProfile = &accessProfile - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mcap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mcap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mcap.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mcap.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mcap.Tags = tags - } - } - } - - return nil -} - -// ManagedClusterAddonProfile a Kubernetes add-on profile for a managed cluster. -type ManagedClusterAddonProfile struct { - // Enabled - Whether the add-on is enabled or not. - Enabled *bool `json:"enabled,omitempty"` - // Config - Key-value pairs for configuring an add-on. - Config map[string]*string `json:"config"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterAddonProfile. -func (mcap ManagedClusterAddonProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcap.Enabled != nil { - objectMap["enabled"] = mcap.Enabled - } - if mcap.Config != nil { - objectMap["config"] = mcap.Config - } - return json.Marshal(objectMap) -} - -// ManagedClusterAgentPoolProfile profile for the container service agent pool. -type ManagedClusterAgentPoolProfile struct { - // Name - Unique name of the agent pool profile in the context of the subscription and resource group. - Name *string `json:"name,omitempty"` - // Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. - Count *int32 `json:"count,omitempty"` - // VMSize - Size of agent VMs. Possible values include: 'VMSizeTypesStandardA1', 'VMSizeTypesStandardA10', 'VMSizeTypesStandardA11', 'VMSizeTypesStandardA1V2', 'VMSizeTypesStandardA2', 'VMSizeTypesStandardA2V2', 'VMSizeTypesStandardA2mV2', 'VMSizeTypesStandardA3', 'VMSizeTypesStandardA4', 'VMSizeTypesStandardA4V2', 'VMSizeTypesStandardA4mV2', 'VMSizeTypesStandardA5', 'VMSizeTypesStandardA6', 'VMSizeTypesStandardA7', 'VMSizeTypesStandardA8', 'VMSizeTypesStandardA8V2', 'VMSizeTypesStandardA8mV2', 'VMSizeTypesStandardA9', 'VMSizeTypesStandardB2ms', 'VMSizeTypesStandardB2s', 'VMSizeTypesStandardB4ms', 'VMSizeTypesStandardB8ms', 'VMSizeTypesStandardD1', 'VMSizeTypesStandardD11', 'VMSizeTypesStandardD11V2', 'VMSizeTypesStandardD11V2Promo', 'VMSizeTypesStandardD12', 'VMSizeTypesStandardD12V2', 'VMSizeTypesStandardD12V2Promo', 'VMSizeTypesStandardD13', 'VMSizeTypesStandardD13V2', 'VMSizeTypesStandardD13V2Promo', 'VMSizeTypesStandardD14', 'VMSizeTypesStandardD14V2', 'VMSizeTypesStandardD14V2Promo', 'VMSizeTypesStandardD15V2', 'VMSizeTypesStandardD16V3', 'VMSizeTypesStandardD16sV3', 'VMSizeTypesStandardD1V2', 'VMSizeTypesStandardD2', 'VMSizeTypesStandardD2V2', 'VMSizeTypesStandardD2V2Promo', 'VMSizeTypesStandardD2V3', 'VMSizeTypesStandardD2sV3', 'VMSizeTypesStandardD3', 'VMSizeTypesStandardD32V3', 'VMSizeTypesStandardD32sV3', 'VMSizeTypesStandardD3V2', 'VMSizeTypesStandardD3V2Promo', 'VMSizeTypesStandardD4', 'VMSizeTypesStandardD4V2', 'VMSizeTypesStandardD4V2Promo', 'VMSizeTypesStandardD4V3', 'VMSizeTypesStandardD4sV3', 'VMSizeTypesStandardD5V2', 'VMSizeTypesStandardD5V2Promo', 'VMSizeTypesStandardD64V3', 'VMSizeTypesStandardD64sV3', 'VMSizeTypesStandardD8V3', 'VMSizeTypesStandardD8sV3', 'VMSizeTypesStandardDS1', 'VMSizeTypesStandardDS11', 'VMSizeTypesStandardDS11V2', 'VMSizeTypesStandardDS11V2Promo', 'VMSizeTypesStandardDS12', 'VMSizeTypesStandardDS12V2', 'VMSizeTypesStandardDS12V2Promo', 'VMSizeTypesStandardDS13', 'VMSizeTypesStandardDS132V2', 'VMSizeTypesStandardDS134V2', 'VMSizeTypesStandardDS13V2', 'VMSizeTypesStandardDS13V2Promo', 'VMSizeTypesStandardDS14', 'VMSizeTypesStandardDS144V2', 'VMSizeTypesStandardDS148V2', 'VMSizeTypesStandardDS14V2', 'VMSizeTypesStandardDS14V2Promo', 'VMSizeTypesStandardDS15V2', 'VMSizeTypesStandardDS1V2', 'VMSizeTypesStandardDS2', 'VMSizeTypesStandardDS2V2', 'VMSizeTypesStandardDS2V2Promo', 'VMSizeTypesStandardDS3', 'VMSizeTypesStandardDS3V2', 'VMSizeTypesStandardDS3V2Promo', 'VMSizeTypesStandardDS4', 'VMSizeTypesStandardDS4V2', 'VMSizeTypesStandardDS4V2Promo', 'VMSizeTypesStandardDS5V2', 'VMSizeTypesStandardDS5V2Promo', 'VMSizeTypesStandardE16V3', 'VMSizeTypesStandardE16sV3', 'VMSizeTypesStandardE2V3', 'VMSizeTypesStandardE2sV3', 'VMSizeTypesStandardE3216sV3', 'VMSizeTypesStandardE328sV3', 'VMSizeTypesStandardE32V3', 'VMSizeTypesStandardE32sV3', 'VMSizeTypesStandardE4V3', 'VMSizeTypesStandardE4sV3', 'VMSizeTypesStandardE6416sV3', 'VMSizeTypesStandardE6432sV3', 'VMSizeTypesStandardE64V3', 'VMSizeTypesStandardE64sV3', 'VMSizeTypesStandardE8V3', 'VMSizeTypesStandardE8sV3', 'VMSizeTypesStandardF1', 'VMSizeTypesStandardF16', 'VMSizeTypesStandardF16s', 'VMSizeTypesStandardF16sV2', 'VMSizeTypesStandardF1s', 'VMSizeTypesStandardF2', 'VMSizeTypesStandardF2s', 'VMSizeTypesStandardF2sV2', 'VMSizeTypesStandardF32sV2', 'VMSizeTypesStandardF4', 'VMSizeTypesStandardF4s', 'VMSizeTypesStandardF4sV2', 'VMSizeTypesStandardF64sV2', 'VMSizeTypesStandardF72sV2', 'VMSizeTypesStandardF8', 'VMSizeTypesStandardF8s', 'VMSizeTypesStandardF8sV2', 'VMSizeTypesStandardG1', 'VMSizeTypesStandardG2', 'VMSizeTypesStandardG3', 'VMSizeTypesStandardG4', 'VMSizeTypesStandardG5', 'VMSizeTypesStandardGS1', 'VMSizeTypesStandardGS2', 'VMSizeTypesStandardGS3', 'VMSizeTypesStandardGS4', 'VMSizeTypesStandardGS44', 'VMSizeTypesStandardGS48', 'VMSizeTypesStandardGS5', 'VMSizeTypesStandardGS516', 'VMSizeTypesStandardGS58', 'VMSizeTypesStandardH16', 'VMSizeTypesStandardH16m', 'VMSizeTypesStandardH16mr', 'VMSizeTypesStandardH16r', 'VMSizeTypesStandardH8', 'VMSizeTypesStandardH8m', 'VMSizeTypesStandardL16s', 'VMSizeTypesStandardL32s', 'VMSizeTypesStandardL4s', 'VMSizeTypesStandardL8s', 'VMSizeTypesStandardM12832ms', 'VMSizeTypesStandardM12864ms', 'VMSizeTypesStandardM128ms', 'VMSizeTypesStandardM128s', 'VMSizeTypesStandardM6416ms', 'VMSizeTypesStandardM6432ms', 'VMSizeTypesStandardM64ms', 'VMSizeTypesStandardM64s', 'VMSizeTypesStandardNC12', 'VMSizeTypesStandardNC12sV2', 'VMSizeTypesStandardNC12sV3', 'VMSizeTypesStandardNC24', 'VMSizeTypesStandardNC24r', 'VMSizeTypesStandardNC24rsV2', 'VMSizeTypesStandardNC24rsV3', 'VMSizeTypesStandardNC24sV2', 'VMSizeTypesStandardNC24sV3', 'VMSizeTypesStandardNC6', 'VMSizeTypesStandardNC6sV2', 'VMSizeTypesStandardNC6sV3', 'VMSizeTypesStandardND12s', 'VMSizeTypesStandardND24rs', 'VMSizeTypesStandardND24s', 'VMSizeTypesStandardND6s', 'VMSizeTypesStandardNV12', 'VMSizeTypesStandardNV24', 'VMSizeTypesStandardNV6' - VMSize VMSizeTypes `json:"vmSize,omitempty"` - // OsDiskSizeGB - OS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. - OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` - // VnetSubnetID - VNet SubnetID specifies the VNet's subnet identifier. - VnetSubnetID *string `json:"vnetSubnetID,omitempty"` - // MaxPods - Maximum number of pods that can run on a node. - MaxPods *int32 `json:"maxPods,omitempty"` - // OsType - OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows' - OsType OSType `json:"osType,omitempty"` - // MaxCount - Maximum number of nodes for auto-scaling - MaxCount *int32 `json:"maxCount,omitempty"` - // MinCount - Minimum number of nodes for auto-scaling - MinCount *int32 `json:"minCount,omitempty"` - // EnableAutoScaling - Whether to enable auto-scaler - EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` - // Type - AgentPoolType represents types of an agent pool. Possible values include: 'VirtualMachineScaleSets', 'AvailabilitySet' - Type AgentPoolType `json:"type,omitempty"` - // OrchestratorVersion - Version of orchestrator specified when creating the managed cluster. - OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` - // AvailabilityZones - (PREVIEW) Availability zones for nodes. Must use VirtualMachineScaleSets AgentPoolType. - AvailabilityZones *[]string `json:"availabilityZones,omitempty"` - // EnableNodePublicIP - Enable public IP for nodes - EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"` - // ScaleSetPriority - ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. Possible values include: 'Low', 'Regular' - ScaleSetPriority ScaleSetPriority `json:"scaleSetPriority,omitempty"` - // ScaleSetEvictionPolicy - ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Possible values include: 'Delete', 'Deallocate' - ScaleSetEvictionPolicy ScaleSetEvictionPolicy `json:"scaleSetEvictionPolicy,omitempty"` - // NodeTaints - Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. - NodeTaints *[]string `json:"nodeTaints,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterAgentPoolProfile. -func (mcapp ManagedClusterAgentPoolProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcapp.Name != nil { - objectMap["name"] = mcapp.Name - } - if mcapp.Count != nil { - objectMap["count"] = mcapp.Count - } - if mcapp.VMSize != "" { - objectMap["vmSize"] = mcapp.VMSize - } - if mcapp.OsDiskSizeGB != nil { - objectMap["osDiskSizeGB"] = mcapp.OsDiskSizeGB - } - if mcapp.VnetSubnetID != nil { - objectMap["vnetSubnetID"] = mcapp.VnetSubnetID - } - if mcapp.MaxPods != nil { - objectMap["maxPods"] = mcapp.MaxPods - } - if mcapp.OsType != "" { - objectMap["osType"] = mcapp.OsType - } - if mcapp.MaxCount != nil { - objectMap["maxCount"] = mcapp.MaxCount - } - if mcapp.MinCount != nil { - objectMap["minCount"] = mcapp.MinCount - } - if mcapp.EnableAutoScaling != nil { - objectMap["enableAutoScaling"] = mcapp.EnableAutoScaling - } - if mcapp.Type != "" { - objectMap["type"] = mcapp.Type - } - if mcapp.OrchestratorVersion != nil { - objectMap["orchestratorVersion"] = mcapp.OrchestratorVersion - } - if mcapp.AvailabilityZones != nil { - objectMap["availabilityZones"] = mcapp.AvailabilityZones - } - if mcapp.EnableNodePublicIP != nil { - objectMap["enableNodePublicIP"] = mcapp.EnableNodePublicIP - } - if mcapp.ScaleSetPriority != "" { - objectMap["scaleSetPriority"] = mcapp.ScaleSetPriority - } - if mcapp.ScaleSetEvictionPolicy != "" { - objectMap["scaleSetEvictionPolicy"] = mcapp.ScaleSetEvictionPolicy - } - if mcapp.NodeTaints != nil { - objectMap["nodeTaints"] = mcapp.NodeTaints - } - return json.Marshal(objectMap) -} - -// ManagedClusterAgentPoolProfileProperties properties for the container service agent pool profile. -type ManagedClusterAgentPoolProfileProperties struct { - // Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. - Count *int32 `json:"count,omitempty"` - // VMSize - Size of agent VMs. Possible values include: 'VMSizeTypesStandardA1', 'VMSizeTypesStandardA10', 'VMSizeTypesStandardA11', 'VMSizeTypesStandardA1V2', 'VMSizeTypesStandardA2', 'VMSizeTypesStandardA2V2', 'VMSizeTypesStandardA2mV2', 'VMSizeTypesStandardA3', 'VMSizeTypesStandardA4', 'VMSizeTypesStandardA4V2', 'VMSizeTypesStandardA4mV2', 'VMSizeTypesStandardA5', 'VMSizeTypesStandardA6', 'VMSizeTypesStandardA7', 'VMSizeTypesStandardA8', 'VMSizeTypesStandardA8V2', 'VMSizeTypesStandardA8mV2', 'VMSizeTypesStandardA9', 'VMSizeTypesStandardB2ms', 'VMSizeTypesStandardB2s', 'VMSizeTypesStandardB4ms', 'VMSizeTypesStandardB8ms', 'VMSizeTypesStandardD1', 'VMSizeTypesStandardD11', 'VMSizeTypesStandardD11V2', 'VMSizeTypesStandardD11V2Promo', 'VMSizeTypesStandardD12', 'VMSizeTypesStandardD12V2', 'VMSizeTypesStandardD12V2Promo', 'VMSizeTypesStandardD13', 'VMSizeTypesStandardD13V2', 'VMSizeTypesStandardD13V2Promo', 'VMSizeTypesStandardD14', 'VMSizeTypesStandardD14V2', 'VMSizeTypesStandardD14V2Promo', 'VMSizeTypesStandardD15V2', 'VMSizeTypesStandardD16V3', 'VMSizeTypesStandardD16sV3', 'VMSizeTypesStandardD1V2', 'VMSizeTypesStandardD2', 'VMSizeTypesStandardD2V2', 'VMSizeTypesStandardD2V2Promo', 'VMSizeTypesStandardD2V3', 'VMSizeTypesStandardD2sV3', 'VMSizeTypesStandardD3', 'VMSizeTypesStandardD32V3', 'VMSizeTypesStandardD32sV3', 'VMSizeTypesStandardD3V2', 'VMSizeTypesStandardD3V2Promo', 'VMSizeTypesStandardD4', 'VMSizeTypesStandardD4V2', 'VMSizeTypesStandardD4V2Promo', 'VMSizeTypesStandardD4V3', 'VMSizeTypesStandardD4sV3', 'VMSizeTypesStandardD5V2', 'VMSizeTypesStandardD5V2Promo', 'VMSizeTypesStandardD64V3', 'VMSizeTypesStandardD64sV3', 'VMSizeTypesStandardD8V3', 'VMSizeTypesStandardD8sV3', 'VMSizeTypesStandardDS1', 'VMSizeTypesStandardDS11', 'VMSizeTypesStandardDS11V2', 'VMSizeTypesStandardDS11V2Promo', 'VMSizeTypesStandardDS12', 'VMSizeTypesStandardDS12V2', 'VMSizeTypesStandardDS12V2Promo', 'VMSizeTypesStandardDS13', 'VMSizeTypesStandardDS132V2', 'VMSizeTypesStandardDS134V2', 'VMSizeTypesStandardDS13V2', 'VMSizeTypesStandardDS13V2Promo', 'VMSizeTypesStandardDS14', 'VMSizeTypesStandardDS144V2', 'VMSizeTypesStandardDS148V2', 'VMSizeTypesStandardDS14V2', 'VMSizeTypesStandardDS14V2Promo', 'VMSizeTypesStandardDS15V2', 'VMSizeTypesStandardDS1V2', 'VMSizeTypesStandardDS2', 'VMSizeTypesStandardDS2V2', 'VMSizeTypesStandardDS2V2Promo', 'VMSizeTypesStandardDS3', 'VMSizeTypesStandardDS3V2', 'VMSizeTypesStandardDS3V2Promo', 'VMSizeTypesStandardDS4', 'VMSizeTypesStandardDS4V2', 'VMSizeTypesStandardDS4V2Promo', 'VMSizeTypesStandardDS5V2', 'VMSizeTypesStandardDS5V2Promo', 'VMSizeTypesStandardE16V3', 'VMSizeTypesStandardE16sV3', 'VMSizeTypesStandardE2V3', 'VMSizeTypesStandardE2sV3', 'VMSizeTypesStandardE3216sV3', 'VMSizeTypesStandardE328sV3', 'VMSizeTypesStandardE32V3', 'VMSizeTypesStandardE32sV3', 'VMSizeTypesStandardE4V3', 'VMSizeTypesStandardE4sV3', 'VMSizeTypesStandardE6416sV3', 'VMSizeTypesStandardE6432sV3', 'VMSizeTypesStandardE64V3', 'VMSizeTypesStandardE64sV3', 'VMSizeTypesStandardE8V3', 'VMSizeTypesStandardE8sV3', 'VMSizeTypesStandardF1', 'VMSizeTypesStandardF16', 'VMSizeTypesStandardF16s', 'VMSizeTypesStandardF16sV2', 'VMSizeTypesStandardF1s', 'VMSizeTypesStandardF2', 'VMSizeTypesStandardF2s', 'VMSizeTypesStandardF2sV2', 'VMSizeTypesStandardF32sV2', 'VMSizeTypesStandardF4', 'VMSizeTypesStandardF4s', 'VMSizeTypesStandardF4sV2', 'VMSizeTypesStandardF64sV2', 'VMSizeTypesStandardF72sV2', 'VMSizeTypesStandardF8', 'VMSizeTypesStandardF8s', 'VMSizeTypesStandardF8sV2', 'VMSizeTypesStandardG1', 'VMSizeTypesStandardG2', 'VMSizeTypesStandardG3', 'VMSizeTypesStandardG4', 'VMSizeTypesStandardG5', 'VMSizeTypesStandardGS1', 'VMSizeTypesStandardGS2', 'VMSizeTypesStandardGS3', 'VMSizeTypesStandardGS4', 'VMSizeTypesStandardGS44', 'VMSizeTypesStandardGS48', 'VMSizeTypesStandardGS5', 'VMSizeTypesStandardGS516', 'VMSizeTypesStandardGS58', 'VMSizeTypesStandardH16', 'VMSizeTypesStandardH16m', 'VMSizeTypesStandardH16mr', 'VMSizeTypesStandardH16r', 'VMSizeTypesStandardH8', 'VMSizeTypesStandardH8m', 'VMSizeTypesStandardL16s', 'VMSizeTypesStandardL32s', 'VMSizeTypesStandardL4s', 'VMSizeTypesStandardL8s', 'VMSizeTypesStandardM12832ms', 'VMSizeTypesStandardM12864ms', 'VMSizeTypesStandardM128ms', 'VMSizeTypesStandardM128s', 'VMSizeTypesStandardM6416ms', 'VMSizeTypesStandardM6432ms', 'VMSizeTypesStandardM64ms', 'VMSizeTypesStandardM64s', 'VMSizeTypesStandardNC12', 'VMSizeTypesStandardNC12sV2', 'VMSizeTypesStandardNC12sV3', 'VMSizeTypesStandardNC24', 'VMSizeTypesStandardNC24r', 'VMSizeTypesStandardNC24rsV2', 'VMSizeTypesStandardNC24rsV3', 'VMSizeTypesStandardNC24sV2', 'VMSizeTypesStandardNC24sV3', 'VMSizeTypesStandardNC6', 'VMSizeTypesStandardNC6sV2', 'VMSizeTypesStandardNC6sV3', 'VMSizeTypesStandardND12s', 'VMSizeTypesStandardND24rs', 'VMSizeTypesStandardND24s', 'VMSizeTypesStandardND6s', 'VMSizeTypesStandardNV12', 'VMSizeTypesStandardNV24', 'VMSizeTypesStandardNV6' - VMSize VMSizeTypes `json:"vmSize,omitempty"` - // OsDiskSizeGB - OS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. - OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` - // VnetSubnetID - VNet SubnetID specifies the VNet's subnet identifier. - VnetSubnetID *string `json:"vnetSubnetID,omitempty"` - // MaxPods - Maximum number of pods that can run on a node. - MaxPods *int32 `json:"maxPods,omitempty"` - // OsType - OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows' - OsType OSType `json:"osType,omitempty"` - // MaxCount - Maximum number of nodes for auto-scaling - MaxCount *int32 `json:"maxCount,omitempty"` - // MinCount - Minimum number of nodes for auto-scaling - MinCount *int32 `json:"minCount,omitempty"` - // EnableAutoScaling - Whether to enable auto-scaler - EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` - // Type - AgentPoolType represents types of an agent pool. Possible values include: 'VirtualMachineScaleSets', 'AvailabilitySet' - Type AgentPoolType `json:"type,omitempty"` - // OrchestratorVersion - Version of orchestrator specified when creating the managed cluster. - OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` - // AvailabilityZones - (PREVIEW) Availability zones for nodes. Must use VirtualMachineScaleSets AgentPoolType. - AvailabilityZones *[]string `json:"availabilityZones,omitempty"` - // EnableNodePublicIP - Enable public IP for nodes - EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"` - // ScaleSetPriority - ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. Possible values include: 'Low', 'Regular' - ScaleSetPriority ScaleSetPriority `json:"scaleSetPriority,omitempty"` - // ScaleSetEvictionPolicy - ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Possible values include: 'Delete', 'Deallocate' - ScaleSetEvictionPolicy ScaleSetEvictionPolicy `json:"scaleSetEvictionPolicy,omitempty"` - // NodeTaints - Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. - NodeTaints *[]string `json:"nodeTaints,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterAgentPoolProfileProperties. -func (mcappp ManagedClusterAgentPoolProfileProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcappp.Count != nil { - objectMap["count"] = mcappp.Count - } - if mcappp.VMSize != "" { - objectMap["vmSize"] = mcappp.VMSize - } - if mcappp.OsDiskSizeGB != nil { - objectMap["osDiskSizeGB"] = mcappp.OsDiskSizeGB - } - if mcappp.VnetSubnetID != nil { - objectMap["vnetSubnetID"] = mcappp.VnetSubnetID - } - if mcappp.MaxPods != nil { - objectMap["maxPods"] = mcappp.MaxPods - } - if mcappp.OsType != "" { - objectMap["osType"] = mcappp.OsType - } - if mcappp.MaxCount != nil { - objectMap["maxCount"] = mcappp.MaxCount - } - if mcappp.MinCount != nil { - objectMap["minCount"] = mcappp.MinCount - } - if mcappp.EnableAutoScaling != nil { - objectMap["enableAutoScaling"] = mcappp.EnableAutoScaling - } - if mcappp.Type != "" { - objectMap["type"] = mcappp.Type - } - if mcappp.OrchestratorVersion != nil { - objectMap["orchestratorVersion"] = mcappp.OrchestratorVersion - } - if mcappp.AvailabilityZones != nil { - objectMap["availabilityZones"] = mcappp.AvailabilityZones - } - if mcappp.EnableNodePublicIP != nil { - objectMap["enableNodePublicIP"] = mcappp.EnableNodePublicIP - } - if mcappp.ScaleSetPriority != "" { - objectMap["scaleSetPriority"] = mcappp.ScaleSetPriority - } - if mcappp.ScaleSetEvictionPolicy != "" { - objectMap["scaleSetEvictionPolicy"] = mcappp.ScaleSetEvictionPolicy - } - if mcappp.NodeTaints != nil { - objectMap["nodeTaints"] = mcappp.NodeTaints - } - return json.Marshal(objectMap) -} - -// ManagedClusterAPIServerAccessProfile access profile for managed cluster API server. -type ManagedClusterAPIServerAccessProfile struct { - // AuthorizedIPRanges - Authorized IP Ranges to kubernetes API server. - AuthorizedIPRanges *[]string `json:"authorizedIPRanges,omitempty"` - // EnablePrivateCluster - Whether to create the cluster as a private cluster or not. - EnablePrivateCluster *bool `json:"enablePrivateCluster,omitempty"` -} - -// ManagedClusterIdentity identity for the managed cluster. -type ManagedClusterIdentity struct { - // PrincipalID - READ-ONLY; The principal id of the system assigned identity which is used by master components. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant id of the system assigned identity which is used by master components. - TenantID *string `json:"tenantId,omitempty"` - // Type - The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service principal will be used instead. Possible values include: 'SystemAssigned', 'None' - Type ResourceIdentityType `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterIdentity. -func (mci ManagedClusterIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mci.Type != "" { - objectMap["type"] = mci.Type - } - return json.Marshal(objectMap) -} - -// ManagedClusterListResult the response from the List Managed Clusters operation. -type ManagedClusterListResult struct { - autorest.Response `json:"-"` - // Value - The list of managed clusters. - Value *[]ManagedCluster `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of managed cluster results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterListResult. -func (mclr ManagedClusterListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mclr.Value != nil { - objectMap["value"] = mclr.Value - } - return json.Marshal(objectMap) -} - -// ManagedClusterListResultIterator provides access to a complete listing of ManagedCluster values. -type ManagedClusterListResultIterator struct { - i int - page ManagedClusterListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ManagedClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ManagedClusterListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedClusterListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ManagedClusterListResultIterator) Response() ManagedClusterListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ManagedClusterListResultIterator) Value() ManagedCluster { - if !iter.page.NotDone() { - return ManagedCluster{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedClusterListResultIterator type. -func NewManagedClusterListResultIterator(page ManagedClusterListResultPage) ManagedClusterListResultIterator { - return ManagedClusterListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mclr ManagedClusterListResult) IsEmpty() bool { - return mclr.Value == nil || len(*mclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mclr ManagedClusterListResult) hasNextLink() bool { - return mclr.NextLink != nil && len(*mclr.NextLink) != 0 -} - -// managedClusterListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mclr ManagedClusterListResult) managedClusterListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mclr.NextLink))) -} - -// ManagedClusterListResultPage contains a page of ManagedCluster values. -type ManagedClusterListResultPage struct { - fn func(context.Context, ManagedClusterListResult) (ManagedClusterListResult, error) - mclr ManagedClusterListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ManagedClusterListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.mclr) - if err != nil { - return err - } - page.mclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ManagedClusterListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedClusterListResultPage) NotDone() bool { - return !page.mclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedClusterListResultPage) Response() ManagedClusterListResult { - return page.mclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedClusterListResultPage) Values() []ManagedCluster { - if page.mclr.IsEmpty() { - return nil - } - return *page.mclr.Value -} - -// Creates a new instance of the ManagedClusterListResultPage type. -func NewManagedClusterListResultPage(cur ManagedClusterListResult, getNextPage func(context.Context, ManagedClusterListResult) (ManagedClusterListResult, error)) ManagedClusterListResultPage { - return ManagedClusterListResultPage{ - fn: getNextPage, - mclr: cur, - } -} - -// ManagedClusterLoadBalancerProfile profile of the managed cluster load balancer -type ManagedClusterLoadBalancerProfile struct { - // ManagedOutboundIPs - Desired managed outbound IPs for the cluster load balancer. - ManagedOutboundIPs *ManagedClusterLoadBalancerProfileManagedOutboundIPs `json:"managedOutboundIPs,omitempty"` - // OutboundIPPrefixes - Desired outbound IP Prefix resources for the cluster load balancer. - OutboundIPPrefixes *ManagedClusterLoadBalancerProfileOutboundIPPrefixes `json:"outboundIPPrefixes,omitempty"` - // OutboundIPs - Desired outbound IP resources for the cluster load balancer. - OutboundIPs *ManagedClusterLoadBalancerProfileOutboundIPs `json:"outboundIPs,omitempty"` - // EffectiveOutboundIPs - The effective outbound IP resources of the cluster load balancer. - EffectiveOutboundIPs *[]ResourceReference `json:"effectiveOutboundIPs,omitempty"` -} - -// ManagedClusterLoadBalancerProfileManagedOutboundIPs desired managed outbound IPs for the cluster load -// balancer. -type ManagedClusterLoadBalancerProfileManagedOutboundIPs struct { - // Count - Desired number of outbound IP 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. - Count *int32 `json:"count,omitempty"` -} - -// ManagedClusterLoadBalancerProfileOutboundIPPrefixes desired outbound IP Prefix resources for the cluster -// load balancer. -type ManagedClusterLoadBalancerProfileOutboundIPPrefixes struct { - // PublicIPPrefixes - A list of public IP prefix resources. - PublicIPPrefixes *[]ResourceReference `json:"publicIPPrefixes,omitempty"` -} - -// ManagedClusterLoadBalancerProfileOutboundIPs desired outbound IP resources for the cluster load -// balancer. -type ManagedClusterLoadBalancerProfileOutboundIPs struct { - // PublicIPs - A list of public IP resources. - PublicIPs *[]ResourceReference `json:"publicIPs,omitempty"` -} - -// ManagedClusterPoolUpgradeProfile the list of available upgrade versions. -type ManagedClusterPoolUpgradeProfile struct { - // KubernetesVersion - Kubernetes version (major, minor, patch). - KubernetesVersion *string `json:"kubernetesVersion,omitempty"` - // Name - Pool name. - Name *string `json:"name,omitempty"` - // OsType - OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows' - OsType OSType `json:"osType,omitempty"` - // Upgrades - List of orchestrator types and versions available for upgrade. - Upgrades *[]ManagedClusterPoolUpgradeProfileUpgradesItem `json:"upgrades,omitempty"` -} - -// ManagedClusterPoolUpgradeProfileUpgradesItem ... -type ManagedClusterPoolUpgradeProfileUpgradesItem struct { - // KubernetesVersion - Kubernetes version (major, minor, patch). - KubernetesVersion *string `json:"kubernetesVersion,omitempty"` - // IsPreview - Whether Kubernetes version is currently in preview. - IsPreview *bool `json:"isPreview,omitempty"` -} - -// ManagedClusterProperties properties of the managed cluster. -type ManagedClusterProperties struct { - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` - // MaxAgentPools - READ-ONLY; The max number of agent pools for the managed cluster. - MaxAgentPools *int32 `json:"maxAgentPools,omitempty"` - // KubernetesVersion - Version of Kubernetes specified when creating the managed cluster. - KubernetesVersion *string `json:"kubernetesVersion,omitempty"` - // DNSPrefix - DNS prefix specified when creating the managed cluster. - DNSPrefix *string `json:"dnsPrefix,omitempty"` - // Fqdn - READ-ONLY; FQDN for the master pool. - Fqdn *string `json:"fqdn,omitempty"` - // AgentPoolProfiles - Properties of the agent pool. - AgentPoolProfiles *[]ManagedClusterAgentPoolProfile `json:"agentPoolProfiles,omitempty"` - // LinuxProfile - Profile for Linux VMs in the container service cluster. - LinuxProfile *LinuxProfile `json:"linuxProfile,omitempty"` - // WindowsProfile - Profile for Windows VMs in the container service cluster. - WindowsProfile *ManagedClusterWindowsProfile `json:"windowsProfile,omitempty"` - // ServicePrincipalProfile - Information about a service principal identity for the cluster to use for manipulating Azure APIs. - ServicePrincipalProfile *ManagedClusterServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"` - // AddonProfiles - Profile of managed cluster add-on. - AddonProfiles map[string]*ManagedClusterAddonProfile `json:"addonProfiles"` - // NodeResourceGroup - Name of the resource group containing agent pool nodes. - NodeResourceGroup *string `json:"nodeResourceGroup,omitempty"` - // EnableRBAC - Whether to enable Kubernetes Role-Based Access Control. - EnableRBAC *bool `json:"enableRBAC,omitempty"` - // EnablePodSecurityPolicy - (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. - EnablePodSecurityPolicy *bool `json:"enablePodSecurityPolicy,omitempty"` - // NetworkProfile - Profile of network configuration. - NetworkProfile *NetworkProfileType `json:"networkProfile,omitempty"` - // AadProfile - Profile of Azure Active Directory configuration. - AadProfile *ManagedClusterAADProfile `json:"aadProfile,omitempty"` - // APIServerAccessProfile - Access profile for managed cluster API server. - APIServerAccessProfile *ManagedClusterAPIServerAccessProfile `json:"apiServerAccessProfile,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterProperties. -func (mcp ManagedClusterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcp.KubernetesVersion != nil { - objectMap["kubernetesVersion"] = mcp.KubernetesVersion - } - if mcp.DNSPrefix != nil { - objectMap["dnsPrefix"] = mcp.DNSPrefix - } - if mcp.AgentPoolProfiles != nil { - objectMap["agentPoolProfiles"] = mcp.AgentPoolProfiles - } - if mcp.LinuxProfile != nil { - objectMap["linuxProfile"] = mcp.LinuxProfile - } - if mcp.WindowsProfile != nil { - objectMap["windowsProfile"] = mcp.WindowsProfile - } - if mcp.ServicePrincipalProfile != nil { - objectMap["servicePrincipalProfile"] = mcp.ServicePrincipalProfile - } - if mcp.AddonProfiles != nil { - objectMap["addonProfiles"] = mcp.AddonProfiles - } - if mcp.NodeResourceGroup != nil { - objectMap["nodeResourceGroup"] = mcp.NodeResourceGroup - } - if mcp.EnableRBAC != nil { - objectMap["enableRBAC"] = mcp.EnableRBAC - } - if mcp.EnablePodSecurityPolicy != nil { - objectMap["enablePodSecurityPolicy"] = mcp.EnablePodSecurityPolicy - } - if mcp.NetworkProfile != nil { - objectMap["networkProfile"] = mcp.NetworkProfile - } - if mcp.AadProfile != nil { - objectMap["aadProfile"] = mcp.AadProfile - } - if mcp.APIServerAccessProfile != nil { - objectMap["apiServerAccessProfile"] = mcp.APIServerAccessProfile - } - return json.Marshal(objectMap) -} - -// ManagedClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedClustersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedClustersClient) (ManagedCluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedClustersCreateOrUpdateFuture.Result. -func (future *ManagedClustersCreateOrUpdateFuture) result(client ManagedClustersClient) (mc ManagedCluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mc.Response.Response, err = future.GetResult(sender); err == nil && mc.Response.Response.StatusCode != http.StatusNoContent { - mc, err = client.CreateOrUpdateResponder(mc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersCreateOrUpdateFuture", "Result", mc.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagedClustersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedClustersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedClustersDeleteFuture.Result. -func (future *ManagedClustersDeleteFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedClusterServicePrincipalProfile information about a service principal identity for the cluster to -// use for manipulating Azure APIs. -type ManagedClusterServicePrincipalProfile struct { - // ClientID - The ID for the service principal. - ClientID *string `json:"clientId,omitempty"` - // Secret - The secret password associated with the service principal in plain text. - Secret *string `json:"secret,omitempty"` -} - -// ManagedClustersResetAADProfileFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedClustersResetAADProfileFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedClustersResetAADProfileFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedClustersResetAADProfileFuture.Result. -func (future *ManagedClustersResetAADProfileFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersResetAADProfileFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersResetAADProfileFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedClustersResetServicePrincipalProfileFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedClustersResetServicePrincipalProfileFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedClustersResetServicePrincipalProfileFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedClustersResetServicePrincipalProfileFuture.Result. -func (future *ManagedClustersResetServicePrincipalProfileFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersResetServicePrincipalProfileFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersResetServicePrincipalProfileFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedClustersRotateClusterCertificatesFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ManagedClustersRotateClusterCertificatesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedClustersRotateClusterCertificatesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedClustersRotateClusterCertificatesFuture.Result. -func (future *ManagedClustersRotateClusterCertificatesFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRotateClusterCertificatesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersRotateClusterCertificatesFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedClustersUpdateTagsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedClustersUpdateTagsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedClustersClient) (ManagedCluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedClustersUpdateTagsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedClustersUpdateTagsFuture.Result. -func (future *ManagedClustersUpdateTagsFuture) result(client ManagedClustersClient) (mc ManagedCluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersUpdateTagsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersUpdateTagsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mc.Response.Response, err = future.GetResult(sender); err == nil && mc.Response.Response.StatusCode != http.StatusNoContent { - mc, err = client.UpdateTagsResponder(mc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersUpdateTagsFuture", "Result", mc.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedClusterUpgradeProfile the list of available upgrades for compute pools. -type ManagedClusterUpgradeProfile struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Id of upgrade profile. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of upgrade profile. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of upgrade profile. - Type *string `json:"type,omitempty"` - // ManagedClusterUpgradeProfileProperties - Properties of upgrade profile. - *ManagedClusterUpgradeProfileProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterUpgradeProfile. -func (mcup ManagedClusterUpgradeProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcup.ManagedClusterUpgradeProfileProperties != nil { - objectMap["properties"] = mcup.ManagedClusterUpgradeProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedClusterUpgradeProfile struct. -func (mcup *ManagedClusterUpgradeProfile) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mcup.Type = &typeVar - } - case "properties": - if v != nil { - var managedClusterUpgradeProfileProperties ManagedClusterUpgradeProfileProperties - err = json.Unmarshal(*v, &managedClusterUpgradeProfileProperties) - if err != nil { - return err - } - mcup.ManagedClusterUpgradeProfileProperties = &managedClusterUpgradeProfileProperties - } - } - } - - return nil -} - -// ManagedClusterUpgradeProfileProperties control plane and agent pool upgrade profiles. -type ManagedClusterUpgradeProfileProperties struct { - // ControlPlaneProfile - The list of available upgrade versions for the control plane. - ControlPlaneProfile *ManagedClusterPoolUpgradeProfile `json:"controlPlaneProfile,omitempty"` - // AgentPoolProfiles - The list of available upgrade versions for agent pools. - AgentPoolProfiles *[]ManagedClusterPoolUpgradeProfile `json:"agentPoolProfiles,omitempty"` -} - -// ManagedClusterWindowsProfile profile for Windows VMs in the container service cluster. -type ManagedClusterWindowsProfile struct { - // AdminUsername - 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 - AdminUsername *string `json:"adminUsername,omitempty"` - // AdminPassword - 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!" - AdminPassword *string `json:"adminPassword,omitempty"` -} - -// MasterProfile profile for the container service master. -type MasterProfile struct { - // Count - Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. - Count *int32 `json:"count,omitempty"` - // DNSPrefix - DNS prefix to be used to create the FQDN for the master pool. - DNSPrefix *string `json:"dnsPrefix,omitempty"` - // VMSize - Size of agent VMs. Possible values include: 'VMSizeTypesStandardA1', 'VMSizeTypesStandardA10', 'VMSizeTypesStandardA11', 'VMSizeTypesStandardA1V2', 'VMSizeTypesStandardA2', 'VMSizeTypesStandardA2V2', 'VMSizeTypesStandardA2mV2', 'VMSizeTypesStandardA3', 'VMSizeTypesStandardA4', 'VMSizeTypesStandardA4V2', 'VMSizeTypesStandardA4mV2', 'VMSizeTypesStandardA5', 'VMSizeTypesStandardA6', 'VMSizeTypesStandardA7', 'VMSizeTypesStandardA8', 'VMSizeTypesStandardA8V2', 'VMSizeTypesStandardA8mV2', 'VMSizeTypesStandardA9', 'VMSizeTypesStandardB2ms', 'VMSizeTypesStandardB2s', 'VMSizeTypesStandardB4ms', 'VMSizeTypesStandardB8ms', 'VMSizeTypesStandardD1', 'VMSizeTypesStandardD11', 'VMSizeTypesStandardD11V2', 'VMSizeTypesStandardD11V2Promo', 'VMSizeTypesStandardD12', 'VMSizeTypesStandardD12V2', 'VMSizeTypesStandardD12V2Promo', 'VMSizeTypesStandardD13', 'VMSizeTypesStandardD13V2', 'VMSizeTypesStandardD13V2Promo', 'VMSizeTypesStandardD14', 'VMSizeTypesStandardD14V2', 'VMSizeTypesStandardD14V2Promo', 'VMSizeTypesStandardD15V2', 'VMSizeTypesStandardD16V3', 'VMSizeTypesStandardD16sV3', 'VMSizeTypesStandardD1V2', 'VMSizeTypesStandardD2', 'VMSizeTypesStandardD2V2', 'VMSizeTypesStandardD2V2Promo', 'VMSizeTypesStandardD2V3', 'VMSizeTypesStandardD2sV3', 'VMSizeTypesStandardD3', 'VMSizeTypesStandardD32V3', 'VMSizeTypesStandardD32sV3', 'VMSizeTypesStandardD3V2', 'VMSizeTypesStandardD3V2Promo', 'VMSizeTypesStandardD4', 'VMSizeTypesStandardD4V2', 'VMSizeTypesStandardD4V2Promo', 'VMSizeTypesStandardD4V3', 'VMSizeTypesStandardD4sV3', 'VMSizeTypesStandardD5V2', 'VMSizeTypesStandardD5V2Promo', 'VMSizeTypesStandardD64V3', 'VMSizeTypesStandardD64sV3', 'VMSizeTypesStandardD8V3', 'VMSizeTypesStandardD8sV3', 'VMSizeTypesStandardDS1', 'VMSizeTypesStandardDS11', 'VMSizeTypesStandardDS11V2', 'VMSizeTypesStandardDS11V2Promo', 'VMSizeTypesStandardDS12', 'VMSizeTypesStandardDS12V2', 'VMSizeTypesStandardDS12V2Promo', 'VMSizeTypesStandardDS13', 'VMSizeTypesStandardDS132V2', 'VMSizeTypesStandardDS134V2', 'VMSizeTypesStandardDS13V2', 'VMSizeTypesStandardDS13V2Promo', 'VMSizeTypesStandardDS14', 'VMSizeTypesStandardDS144V2', 'VMSizeTypesStandardDS148V2', 'VMSizeTypesStandardDS14V2', 'VMSizeTypesStandardDS14V2Promo', 'VMSizeTypesStandardDS15V2', 'VMSizeTypesStandardDS1V2', 'VMSizeTypesStandardDS2', 'VMSizeTypesStandardDS2V2', 'VMSizeTypesStandardDS2V2Promo', 'VMSizeTypesStandardDS3', 'VMSizeTypesStandardDS3V2', 'VMSizeTypesStandardDS3V2Promo', 'VMSizeTypesStandardDS4', 'VMSizeTypesStandardDS4V2', 'VMSizeTypesStandardDS4V2Promo', 'VMSizeTypesStandardDS5V2', 'VMSizeTypesStandardDS5V2Promo', 'VMSizeTypesStandardE16V3', 'VMSizeTypesStandardE16sV3', 'VMSizeTypesStandardE2V3', 'VMSizeTypesStandardE2sV3', 'VMSizeTypesStandardE3216sV3', 'VMSizeTypesStandardE328sV3', 'VMSizeTypesStandardE32V3', 'VMSizeTypesStandardE32sV3', 'VMSizeTypesStandardE4V3', 'VMSizeTypesStandardE4sV3', 'VMSizeTypesStandardE6416sV3', 'VMSizeTypesStandardE6432sV3', 'VMSizeTypesStandardE64V3', 'VMSizeTypesStandardE64sV3', 'VMSizeTypesStandardE8V3', 'VMSizeTypesStandardE8sV3', 'VMSizeTypesStandardF1', 'VMSizeTypesStandardF16', 'VMSizeTypesStandardF16s', 'VMSizeTypesStandardF16sV2', 'VMSizeTypesStandardF1s', 'VMSizeTypesStandardF2', 'VMSizeTypesStandardF2s', 'VMSizeTypesStandardF2sV2', 'VMSizeTypesStandardF32sV2', 'VMSizeTypesStandardF4', 'VMSizeTypesStandardF4s', 'VMSizeTypesStandardF4sV2', 'VMSizeTypesStandardF64sV2', 'VMSizeTypesStandardF72sV2', 'VMSizeTypesStandardF8', 'VMSizeTypesStandardF8s', 'VMSizeTypesStandardF8sV2', 'VMSizeTypesStandardG1', 'VMSizeTypesStandardG2', 'VMSizeTypesStandardG3', 'VMSizeTypesStandardG4', 'VMSizeTypesStandardG5', 'VMSizeTypesStandardGS1', 'VMSizeTypesStandardGS2', 'VMSizeTypesStandardGS3', 'VMSizeTypesStandardGS4', 'VMSizeTypesStandardGS44', 'VMSizeTypesStandardGS48', 'VMSizeTypesStandardGS5', 'VMSizeTypesStandardGS516', 'VMSizeTypesStandardGS58', 'VMSizeTypesStandardH16', 'VMSizeTypesStandardH16m', 'VMSizeTypesStandardH16mr', 'VMSizeTypesStandardH16r', 'VMSizeTypesStandardH8', 'VMSizeTypesStandardH8m', 'VMSizeTypesStandardL16s', 'VMSizeTypesStandardL32s', 'VMSizeTypesStandardL4s', 'VMSizeTypesStandardL8s', 'VMSizeTypesStandardM12832ms', 'VMSizeTypesStandardM12864ms', 'VMSizeTypesStandardM128ms', 'VMSizeTypesStandardM128s', 'VMSizeTypesStandardM6416ms', 'VMSizeTypesStandardM6432ms', 'VMSizeTypesStandardM64ms', 'VMSizeTypesStandardM64s', 'VMSizeTypesStandardNC12', 'VMSizeTypesStandardNC12sV2', 'VMSizeTypesStandardNC12sV3', 'VMSizeTypesStandardNC24', 'VMSizeTypesStandardNC24r', 'VMSizeTypesStandardNC24rsV2', 'VMSizeTypesStandardNC24rsV3', 'VMSizeTypesStandardNC24sV2', 'VMSizeTypesStandardNC24sV3', 'VMSizeTypesStandardNC6', 'VMSizeTypesStandardNC6sV2', 'VMSizeTypesStandardNC6sV3', 'VMSizeTypesStandardND12s', 'VMSizeTypesStandardND24rs', 'VMSizeTypesStandardND24s', 'VMSizeTypesStandardND6s', 'VMSizeTypesStandardNV12', 'VMSizeTypesStandardNV24', 'VMSizeTypesStandardNV6' - VMSize VMSizeTypes `json:"vmSize,omitempty"` - // OsDiskSizeGB - OS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. - OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` - // VnetSubnetID - VNet SubnetID specifies the VNet's subnet identifier. - VnetSubnetID *string `json:"vnetSubnetID,omitempty"` - // FirstConsecutiveStaticIP - FirstConsecutiveStaticIP used to specify the first static ip of masters. - FirstConsecutiveStaticIP *string `json:"firstConsecutiveStaticIP,omitempty"` - // StorageProfile - Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. Possible values include: 'StorageAccount', 'ManagedDisks' - StorageProfile StorageProfileTypes `json:"storageProfile,omitempty"` - // Fqdn - READ-ONLY; FQDN for the master pool. - Fqdn *string `json:"fqdn,omitempty"` -} - -// MarshalJSON is the custom marshaler for MasterProfile. -func (mp MasterProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mp.Count != nil { - objectMap["count"] = mp.Count - } - if mp.DNSPrefix != nil { - objectMap["dnsPrefix"] = mp.DNSPrefix - } - if mp.VMSize != "" { - objectMap["vmSize"] = mp.VMSize - } - if mp.OsDiskSizeGB != nil { - objectMap["osDiskSizeGB"] = mp.OsDiskSizeGB - } - if mp.VnetSubnetID != nil { - objectMap["vnetSubnetID"] = mp.VnetSubnetID - } - if mp.FirstConsecutiveStaticIP != nil { - objectMap["firstConsecutiveStaticIP"] = mp.FirstConsecutiveStaticIP - } - if mp.StorageProfile != "" { - objectMap["storageProfile"] = mp.StorageProfile - } - return json.Marshal(objectMap) -} - -// NetworkProfile represents the OpenShift networking configuration -type NetworkProfile struct { - // VnetCidr - CIDR for the OpenShift Vnet. - VnetCidr *string `json:"vnetCidr,omitempty"` - // PeerVnetID - CIDR of the Vnet to peer. - PeerVnetID *string `json:"peerVnetId,omitempty"` - // VnetID - ID of the Vnet created for OSA cluster. - VnetID *string `json:"vnetId,omitempty"` -} - -// NetworkProfileType profile of network configuration. -type NetworkProfileType struct { - // NetworkPlugin - Network plugin used for building Kubernetes network. Possible values include: 'Azure', 'Kubenet' - NetworkPlugin NetworkPlugin `json:"networkPlugin,omitempty"` - // NetworkPolicy - Network policy used for building Kubernetes network. Possible values include: 'NetworkPolicyCalico', 'NetworkPolicyAzure' - NetworkPolicy NetworkPolicy `json:"networkPolicy,omitempty"` - // PodCidr - A CIDR notation IP range from which to assign pod IPs when kubenet is used. - PodCidr *string `json:"podCidr,omitempty"` - // ServiceCidr - A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges. - ServiceCidr *string `json:"serviceCidr,omitempty"` - // DNSServiceIP - An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr. - DNSServiceIP *string `json:"dnsServiceIP,omitempty"` - // DockerBridgeCidr - 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. - DockerBridgeCidr *string `json:"dockerBridgeCidr,omitempty"` - // LoadBalancerSku - The load balancer sku for the managed cluster. Possible values include: 'Standard', 'Basic' - LoadBalancerSku LoadBalancerSku `json:"loadBalancerSku,omitempty"` - // LoadBalancerProfile - Profile of the cluster load balancer. - LoadBalancerProfile *ManagedClusterLoadBalancerProfile `json:"loadBalancerProfile,omitempty"` -} - -// OpenShiftManagedCluster openShift Managed cluster. -type OpenShiftManagedCluster struct { - autorest.Response `json:"-"` - // Plan - Define the resource plan as required by ARM for billing purposes - Plan *PurchasePlan `json:"plan,omitempty"` - // OpenShiftManagedClusterProperties - Properties of a OpenShift managed cluster. - *OpenShiftManagedClusterProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for OpenShiftManagedCluster. -func (osmc OpenShiftManagedCluster) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if osmc.Plan != nil { - objectMap["plan"] = osmc.Plan - } - if osmc.OpenShiftManagedClusterProperties != nil { - objectMap["properties"] = osmc.OpenShiftManagedClusterProperties - } - if osmc.Location != nil { - objectMap["location"] = osmc.Location - } - if osmc.Tags != nil { - objectMap["tags"] = osmc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OpenShiftManagedCluster struct. -func (osmc *OpenShiftManagedCluster) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "plan": - if v != nil { - var plan PurchasePlan - err = json.Unmarshal(*v, &plan) - if err != nil { - return err - } - osmc.Plan = &plan - } - case "properties": - if v != nil { - var openShiftManagedClusterProperties OpenShiftManagedClusterProperties - err = json.Unmarshal(*v, &openShiftManagedClusterProperties) - if err != nil { - return err - } - osmc.OpenShiftManagedClusterProperties = &openShiftManagedClusterProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - osmc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - osmc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - osmc.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - osmc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - osmc.Tags = tags - } - } - } - - return nil -} - -// OpenShiftManagedClusterAADIdentityProvider defines the Identity provider for MS AAD. -type OpenShiftManagedClusterAADIdentityProvider struct { - // ClientID - The clientId password associated with the provider. - ClientID *string `json:"clientId,omitempty"` - // Secret - The secret password associated with the provider. - Secret *string `json:"secret,omitempty"` - // TenantID - The tenantId associated with the provider. - TenantID *string `json:"tenantId,omitempty"` - // CustomerAdminGroupID - The groupId to be granted cluster admin role. - CustomerAdminGroupID *string `json:"customerAdminGroupId,omitempty"` - // Kind - Possible values include: 'KindOpenShiftManagedClusterBaseIdentityProvider', 'KindAADIdentityProvider' - Kind Kind `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for OpenShiftManagedClusterAADIdentityProvider. -func (osmcaip OpenShiftManagedClusterAADIdentityProvider) MarshalJSON() ([]byte, error) { - osmcaip.Kind = KindAADIdentityProvider - objectMap := make(map[string]interface{}) - if osmcaip.ClientID != nil { - objectMap["clientId"] = osmcaip.ClientID - } - if osmcaip.Secret != nil { - objectMap["secret"] = osmcaip.Secret - } - if osmcaip.TenantID != nil { - objectMap["tenantId"] = osmcaip.TenantID - } - if osmcaip.CustomerAdminGroupID != nil { - objectMap["customerAdminGroupId"] = osmcaip.CustomerAdminGroupID - } - if osmcaip.Kind != "" { - objectMap["kind"] = osmcaip.Kind - } - return json.Marshal(objectMap) -} - -// AsOpenShiftManagedClusterAADIdentityProvider is the BasicOpenShiftManagedClusterBaseIdentityProvider implementation for OpenShiftManagedClusterAADIdentityProvider. -func (osmcaip OpenShiftManagedClusterAADIdentityProvider) AsOpenShiftManagedClusterAADIdentityProvider() (*OpenShiftManagedClusterAADIdentityProvider, bool) { - return &osmcaip, true -} - -// AsOpenShiftManagedClusterBaseIdentityProvider is the BasicOpenShiftManagedClusterBaseIdentityProvider implementation for OpenShiftManagedClusterAADIdentityProvider. -func (osmcaip OpenShiftManagedClusterAADIdentityProvider) AsOpenShiftManagedClusterBaseIdentityProvider() (*OpenShiftManagedClusterBaseIdentityProvider, bool) { - return nil, false -} - -// AsBasicOpenShiftManagedClusterBaseIdentityProvider is the BasicOpenShiftManagedClusterBaseIdentityProvider implementation for OpenShiftManagedClusterAADIdentityProvider. -func (osmcaip OpenShiftManagedClusterAADIdentityProvider) AsBasicOpenShiftManagedClusterBaseIdentityProvider() (BasicOpenShiftManagedClusterBaseIdentityProvider, bool) { - return &osmcaip, true -} - -// OpenShiftManagedClusterAgentPoolProfile defines the configuration of the OpenShift cluster VMs. -type OpenShiftManagedClusterAgentPoolProfile struct { - // Name - Unique name of the pool profile in the context of the subscription and resource group. - Name *string `json:"name,omitempty"` - // Count - Number of agents (VMs) to host docker containers. - Count *int32 `json:"count,omitempty"` - // VMSize - Size of agent VMs. Possible values include: 'StandardD2sV3', 'StandardD4sV3', 'StandardD8sV3', 'StandardD16sV3', 'StandardD32sV3', 'StandardD64sV3', 'StandardDS4V2', 'StandardDS5V2', 'StandardF8sV2', 'StandardF16sV2', 'StandardF32sV2', 'StandardF64sV2', 'StandardF72sV2', 'StandardF8s', 'StandardF16s', 'StandardE4sV3', 'StandardE8sV3', 'StandardE16sV3', 'StandardE20sV3', 'StandardE32sV3', 'StandardE64sV3', 'StandardGS2', 'StandardGS3', 'StandardGS4', 'StandardGS5', 'StandardDS12V2', 'StandardDS13V2', 'StandardDS14V2', 'StandardDS15V2', 'StandardL4s', 'StandardL8s', 'StandardL16s', 'StandardL32s' - VMSize OpenShiftContainerServiceVMSize `json:"vmSize,omitempty"` - // SubnetCidr - Subnet CIDR for the peering. - SubnetCidr *string `json:"subnetCidr,omitempty"` - // OsType - OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows' - OsType OSType `json:"osType,omitempty"` - // Role - Define the role of the AgentPoolProfile. Possible values include: 'Compute', 'Infra' - Role OpenShiftAgentPoolProfileRole `json:"role,omitempty"` -} - -// OpenShiftManagedClusterAuthProfile defines all possible authentication profiles for the OpenShift -// cluster. -type OpenShiftManagedClusterAuthProfile struct { - // IdentityProviders - Type of authentication profile to use. - IdentityProviders *[]OpenShiftManagedClusterIdentityProvider `json:"identityProviders,omitempty"` -} - -// BasicOpenShiftManagedClusterBaseIdentityProvider structure for any Identity provider. -type BasicOpenShiftManagedClusterBaseIdentityProvider interface { - AsOpenShiftManagedClusterAADIdentityProvider() (*OpenShiftManagedClusterAADIdentityProvider, bool) - AsOpenShiftManagedClusterBaseIdentityProvider() (*OpenShiftManagedClusterBaseIdentityProvider, bool) -} - -// OpenShiftManagedClusterBaseIdentityProvider structure for any Identity provider. -type OpenShiftManagedClusterBaseIdentityProvider struct { - // Kind - Possible values include: 'KindOpenShiftManagedClusterBaseIdentityProvider', 'KindAADIdentityProvider' - Kind Kind `json:"kind,omitempty"` -} - -func unmarshalBasicOpenShiftManagedClusterBaseIdentityProvider(body []byte) (BasicOpenShiftManagedClusterBaseIdentityProvider, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["kind"] { - case string(KindAADIdentityProvider): - var osmcaip OpenShiftManagedClusterAADIdentityProvider - err := json.Unmarshal(body, &osmcaip) - return osmcaip, err - default: - var osmcbip OpenShiftManagedClusterBaseIdentityProvider - err := json.Unmarshal(body, &osmcbip) - return osmcbip, err - } -} -func unmarshalBasicOpenShiftManagedClusterBaseIdentityProviderArray(body []byte) ([]BasicOpenShiftManagedClusterBaseIdentityProvider, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - osmcbipArray := make([]BasicOpenShiftManagedClusterBaseIdentityProvider, len(rawMessages)) - - for index, rawMessage := range rawMessages { - osmcbip, err := unmarshalBasicOpenShiftManagedClusterBaseIdentityProvider(*rawMessage) - if err != nil { - return nil, err - } - osmcbipArray[index] = osmcbip - } - return osmcbipArray, nil -} - -// MarshalJSON is the custom marshaler for OpenShiftManagedClusterBaseIdentityProvider. -func (osmcbip OpenShiftManagedClusterBaseIdentityProvider) MarshalJSON() ([]byte, error) { - osmcbip.Kind = KindOpenShiftManagedClusterBaseIdentityProvider - objectMap := make(map[string]interface{}) - if osmcbip.Kind != "" { - objectMap["kind"] = osmcbip.Kind - } - return json.Marshal(objectMap) -} - -// AsOpenShiftManagedClusterAADIdentityProvider is the BasicOpenShiftManagedClusterBaseIdentityProvider implementation for OpenShiftManagedClusterBaseIdentityProvider. -func (osmcbip OpenShiftManagedClusterBaseIdentityProvider) AsOpenShiftManagedClusterAADIdentityProvider() (*OpenShiftManagedClusterAADIdentityProvider, bool) { - return nil, false -} - -// AsOpenShiftManagedClusterBaseIdentityProvider is the BasicOpenShiftManagedClusterBaseIdentityProvider implementation for OpenShiftManagedClusterBaseIdentityProvider. -func (osmcbip OpenShiftManagedClusterBaseIdentityProvider) AsOpenShiftManagedClusterBaseIdentityProvider() (*OpenShiftManagedClusterBaseIdentityProvider, bool) { - return &osmcbip, true -} - -// AsBasicOpenShiftManagedClusterBaseIdentityProvider is the BasicOpenShiftManagedClusterBaseIdentityProvider implementation for OpenShiftManagedClusterBaseIdentityProvider. -func (osmcbip OpenShiftManagedClusterBaseIdentityProvider) AsBasicOpenShiftManagedClusterBaseIdentityProvider() (BasicOpenShiftManagedClusterBaseIdentityProvider, bool) { - return &osmcbip, true -} - -// OpenShiftManagedClusterIdentityProvider defines the configuration of the identity providers to be used -// in the OpenShift cluster. -type OpenShiftManagedClusterIdentityProvider struct { - // Name - Name of the provider. - Name *string `json:"name,omitempty"` - // Provider - Configuration of the provider. - Provider BasicOpenShiftManagedClusterBaseIdentityProvider `json:"provider,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for OpenShiftManagedClusterIdentityProvider struct. -func (osmcip *OpenShiftManagedClusterIdentityProvider) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - osmcip.Name = &name - } - case "provider": - if v != nil { - provider, err := unmarshalBasicOpenShiftManagedClusterBaseIdentityProvider(*v) - if err != nil { - return err - } - osmcip.Provider = provider - } - } - } - - return nil -} - -// OpenShiftManagedClusterListResult the response from the List OpenShift Managed Clusters operation. -type OpenShiftManagedClusterListResult struct { - autorest.Response `json:"-"` - // Value - The list of OpenShift managed clusters. - Value *[]OpenShiftManagedCluster `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of OpenShift managed cluster results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OpenShiftManagedClusterListResult. -func (osmclr OpenShiftManagedClusterListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if osmclr.Value != nil { - objectMap["value"] = osmclr.Value - } - return json.Marshal(objectMap) -} - -// OpenShiftManagedClusterListResultIterator provides access to a complete listing of -// OpenShiftManagedCluster values. -type OpenShiftManagedClusterListResultIterator struct { - i int - page OpenShiftManagedClusterListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OpenShiftManagedClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftManagedClusterListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OpenShiftManagedClusterListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OpenShiftManagedClusterListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OpenShiftManagedClusterListResultIterator) Response() OpenShiftManagedClusterListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OpenShiftManagedClusterListResultIterator) Value() OpenShiftManagedCluster { - if !iter.page.NotDone() { - return OpenShiftManagedCluster{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OpenShiftManagedClusterListResultIterator type. -func NewOpenShiftManagedClusterListResultIterator(page OpenShiftManagedClusterListResultPage) OpenShiftManagedClusterListResultIterator { - return OpenShiftManagedClusterListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (osmclr OpenShiftManagedClusterListResult) IsEmpty() bool { - return osmclr.Value == nil || len(*osmclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (osmclr OpenShiftManagedClusterListResult) hasNextLink() bool { - return osmclr.NextLink != nil && len(*osmclr.NextLink) != 0 -} - -// openShiftManagedClusterListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (osmclr OpenShiftManagedClusterListResult) openShiftManagedClusterListResultPreparer(ctx context.Context) (*http.Request, error) { - if !osmclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(osmclr.NextLink))) -} - -// OpenShiftManagedClusterListResultPage contains a page of OpenShiftManagedCluster values. -type OpenShiftManagedClusterListResultPage struct { - fn func(context.Context, OpenShiftManagedClusterListResult) (OpenShiftManagedClusterListResult, error) - osmclr OpenShiftManagedClusterListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OpenShiftManagedClusterListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftManagedClusterListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.osmclr) - if err != nil { - return err - } - page.osmclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OpenShiftManagedClusterListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OpenShiftManagedClusterListResultPage) NotDone() bool { - return !page.osmclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OpenShiftManagedClusterListResultPage) Response() OpenShiftManagedClusterListResult { - return page.osmclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OpenShiftManagedClusterListResultPage) Values() []OpenShiftManagedCluster { - if page.osmclr.IsEmpty() { - return nil - } - return *page.osmclr.Value -} - -// Creates a new instance of the OpenShiftManagedClusterListResultPage type. -func NewOpenShiftManagedClusterListResultPage(cur OpenShiftManagedClusterListResult, getNextPage func(context.Context, OpenShiftManagedClusterListResult) (OpenShiftManagedClusterListResult, error)) OpenShiftManagedClusterListResultPage { - return OpenShiftManagedClusterListResultPage{ - fn: getNextPage, - osmclr: cur, - } -} - -// OpenShiftManagedClusterMasterPoolProfile openShiftManagedClusterMaterPoolProfile contains configuration -// for OpenShift master VMs. -type OpenShiftManagedClusterMasterPoolProfile struct { - // Name - Unique name of the master pool profile in the context of the subscription and resource group. - Name *string `json:"name,omitempty"` - // Count - Number of masters (VMs) to host docker containers. The default value is 3. - Count *int32 `json:"count,omitempty"` - // VMSize - Size of agent VMs. Possible values include: 'StandardD2sV3', 'StandardD4sV3', 'StandardD8sV3', 'StandardD16sV3', 'StandardD32sV3', 'StandardD64sV3', 'StandardDS4V2', 'StandardDS5V2', 'StandardF8sV2', 'StandardF16sV2', 'StandardF32sV2', 'StandardF64sV2', 'StandardF72sV2', 'StandardF8s', 'StandardF16s', 'StandardE4sV3', 'StandardE8sV3', 'StandardE16sV3', 'StandardE20sV3', 'StandardE32sV3', 'StandardE64sV3', 'StandardGS2', 'StandardGS3', 'StandardGS4', 'StandardGS5', 'StandardDS12V2', 'StandardDS13V2', 'StandardDS14V2', 'StandardDS15V2', 'StandardL4s', 'StandardL8s', 'StandardL16s', 'StandardL32s' - VMSize OpenShiftContainerServiceVMSize `json:"vmSize,omitempty"` - // SubnetCidr - Subnet CIDR for the peering. - SubnetCidr *string `json:"subnetCidr,omitempty"` - // OsType - OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows' - OsType OSType `json:"osType,omitempty"` -} - -// OpenShiftManagedClusterProperties properties of the OpenShift managed cluster. -type OpenShiftManagedClusterProperties struct { - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` - // OpenShiftVersion - Version of OpenShift specified when creating the cluster. - OpenShiftVersion *string `json:"openShiftVersion,omitempty"` - // ClusterVersion - READ-ONLY; Version of OpenShift specified when creating the cluster. - ClusterVersion *string `json:"clusterVersion,omitempty"` - // PublicHostname - READ-ONLY; Service generated FQDN for OpenShift API server. - PublicHostname *string `json:"publicHostname,omitempty"` - // Fqdn - READ-ONLY; Service generated FQDN for OpenShift API server loadbalancer internal hostname. - Fqdn *string `json:"fqdn,omitempty"` - // NetworkProfile - Configuration for OpenShift networking. - NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` - // RouterProfiles - Configuration for OpenShift router(s). - RouterProfiles *[]OpenShiftRouterProfile `json:"routerProfiles,omitempty"` - // MasterPoolProfile - Configuration for OpenShift master VMs. - MasterPoolProfile *OpenShiftManagedClusterMasterPoolProfile `json:"masterPoolProfile,omitempty"` - // AgentPoolProfiles - Configuration of OpenShift cluster VMs. - AgentPoolProfiles *[]OpenShiftManagedClusterAgentPoolProfile `json:"agentPoolProfiles,omitempty"` - // AuthProfile - Configures OpenShift authentication. - AuthProfile *OpenShiftManagedClusterAuthProfile `json:"authProfile,omitempty"` -} - -// MarshalJSON is the custom marshaler for OpenShiftManagedClusterProperties. -func (osmcp OpenShiftManagedClusterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if osmcp.OpenShiftVersion != nil { - objectMap["openShiftVersion"] = osmcp.OpenShiftVersion - } - if osmcp.NetworkProfile != nil { - objectMap["networkProfile"] = osmcp.NetworkProfile - } - if osmcp.RouterProfiles != nil { - objectMap["routerProfiles"] = osmcp.RouterProfiles - } - if osmcp.MasterPoolProfile != nil { - objectMap["masterPoolProfile"] = osmcp.MasterPoolProfile - } - if osmcp.AgentPoolProfiles != nil { - objectMap["agentPoolProfiles"] = osmcp.AgentPoolProfiles - } - if osmcp.AuthProfile != nil { - objectMap["authProfile"] = osmcp.AuthProfile - } - return json.Marshal(objectMap) -} - -// OpenShiftManagedClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type OpenShiftManagedClustersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(OpenShiftManagedClustersClient) (OpenShiftManagedCluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *OpenShiftManagedClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for OpenShiftManagedClustersCreateOrUpdateFuture.Result. -func (future *OpenShiftManagedClustersCreateOrUpdateFuture) result(client OpenShiftManagedClustersClient) (osmc OpenShiftManagedCluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - osmc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.OpenShiftManagedClustersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if osmc.Response.Response, err = future.GetResult(sender); err == nil && osmc.Response.Response.StatusCode != http.StatusNoContent { - osmc, err = client.CreateOrUpdateResponder(osmc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersCreateOrUpdateFuture", "Result", osmc.Response.Response, "Failure responding to request") - } - } - return -} - -// OpenShiftManagedClustersDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type OpenShiftManagedClustersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(OpenShiftManagedClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *OpenShiftManagedClustersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for OpenShiftManagedClustersDeleteFuture.Result. -func (future *OpenShiftManagedClustersDeleteFuture) result(client OpenShiftManagedClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.OpenShiftManagedClustersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// OpenShiftManagedClustersUpdateTagsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type OpenShiftManagedClustersUpdateTagsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(OpenShiftManagedClustersClient) (OpenShiftManagedCluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *OpenShiftManagedClustersUpdateTagsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for OpenShiftManagedClustersUpdateTagsFuture.Result. -func (future *OpenShiftManagedClustersUpdateTagsFuture) result(client OpenShiftManagedClustersClient) (osmc OpenShiftManagedCluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersUpdateTagsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - osmc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.OpenShiftManagedClustersUpdateTagsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if osmc.Response.Response, err = future.GetResult(sender); err == nil && osmc.Response.Response.StatusCode != http.StatusNoContent { - osmc, err = client.UpdateTagsResponder(osmc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersUpdateTagsFuture", "Result", osmc.Response.Response, "Failure responding to request") - } - } - return -} - -// OpenShiftRouterProfile represents an OpenShift router -type OpenShiftRouterProfile struct { - // Name - Name of the router profile. - Name *string `json:"name,omitempty"` - // PublicSubdomain - READ-ONLY; DNS subdomain for OpenShift router. - PublicSubdomain *string `json:"publicSubdomain,omitempty"` - // Fqdn - READ-ONLY; Auto-allocated FQDN for the OpenShift router. - Fqdn *string `json:"fqdn,omitempty"` -} - -// MarshalJSON is the custom marshaler for OpenShiftRouterProfile. -func (osrp OpenShiftRouterProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if osrp.Name != nil { - objectMap["name"] = osrp.Name - } - return json.Marshal(objectMap) -} - -// OperationListResult the List Compute Operation operation response. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of compute operations - Value *[]OperationValue `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationValue describes the properties of a Compute Operation value. -type OperationValue struct { - // Origin - READ-ONLY; The origin of the compute operation. - Origin *string `json:"origin,omitempty"` - // Name - READ-ONLY; The name of the compute operation. - Name *string `json:"name,omitempty"` - // OperationValueDisplay - Describes the properties of a Compute Operation Value Display. - *OperationValueDisplay `json:"display,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationValue. -func (ov OperationValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ov.OperationValueDisplay != nil { - objectMap["display"] = ov.OperationValueDisplay - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationValue struct. -func (ov *OperationValue) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - ov.Origin = &origin - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ov.Name = &name - } - case "display": - if v != nil { - var operationValueDisplay OperationValueDisplay - err = json.Unmarshal(*v, &operationValueDisplay) - if err != nil { - return err - } - ov.OperationValueDisplay = &operationValueDisplay - } - } - } - - return nil -} - -// OperationValueDisplay describes the properties of a Compute Operation Value Display. -type OperationValueDisplay struct { - // Operation - READ-ONLY; The display name of the compute operation. - Operation *string `json:"operation,omitempty"` - // Resource - READ-ONLY; The display name of the resource the operation applies to. - Resource *string `json:"resource,omitempty"` - // Description - READ-ONLY; The description of the operation. - Description *string `json:"description,omitempty"` - // Provider - READ-ONLY; The resource provider for the operation. - Provider *string `json:"provider,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationValueDisplay. -func (ovd OperationValueDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OrchestratorProfile contains information about orchestrator. -type OrchestratorProfile struct { - // OrchestratorType - Orchestrator type. - OrchestratorType *string `json:"orchestratorType,omitempty"` - // OrchestratorVersion - Orchestrator version (major, minor, patch). - OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` - // IsPreview - Whether Kubernetes version is currently in preview. - IsPreview *bool `json:"isPreview,omitempty"` -} - -// OrchestratorProfileType profile for the container service orchestrator. -type OrchestratorProfileType struct { - // OrchestratorType - The orchestrator to use to manage container service cluster resources. Valid values are Kubernetes, Swarm, DCOS, DockerCE and Custom. Possible values include: 'Kubernetes', 'Swarm', 'DCOS', 'DockerCE', 'Custom' - OrchestratorType OrchestratorTypes `json:"orchestratorType,omitempty"` - // OrchestratorVersion - The version of the orchestrator to use. You can specify the major.minor.patch part of the actual version.For example, you can specify version as "1.6.11". - OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` -} - -// OrchestratorVersionProfile the profile of an orchestrator and its available versions. -type OrchestratorVersionProfile struct { - // OrchestratorType - Orchestrator type. - OrchestratorType *string `json:"orchestratorType,omitempty"` - // OrchestratorVersion - Orchestrator version (major, minor, patch). - OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` - // Default - Installed by default if version is not specified. - Default *bool `json:"default,omitempty"` - // IsPreview - Whether Kubernetes version is currently in preview. - IsPreview *bool `json:"isPreview,omitempty"` - // Upgrades - The list of available upgrade versions. - Upgrades *[]OrchestratorProfile `json:"upgrades,omitempty"` -} - -// OrchestratorVersionProfileListResult the list of versions for supported orchestrators. -type OrchestratorVersionProfileListResult struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Id of the orchestrator version profile list result. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the orchestrator version profile list result. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the orchestrator version profile list result. - Type *string `json:"type,omitempty"` - // OrchestratorVersionProfileProperties - The properties of an orchestrator version profile. - *OrchestratorVersionProfileProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for OrchestratorVersionProfileListResult. -func (ovplr OrchestratorVersionProfileListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ovplr.OrchestratorVersionProfileProperties != nil { - objectMap["properties"] = ovplr.OrchestratorVersionProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OrchestratorVersionProfileListResult struct. -func (ovplr *OrchestratorVersionProfileListResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ovplr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ovplr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ovplr.Type = &typeVar - } - case "properties": - if v != nil { - var orchestratorVersionProfileProperties OrchestratorVersionProfileProperties - err = json.Unmarshal(*v, &orchestratorVersionProfileProperties) - if err != nil { - return err - } - ovplr.OrchestratorVersionProfileProperties = &orchestratorVersionProfileProperties - } - } - } - - return nil -} - -// OrchestratorVersionProfileProperties the properties of an orchestrator version profile. -type OrchestratorVersionProfileProperties struct { - // Orchestrators - List of orchestrator version profiles. - Orchestrators *[]OrchestratorVersionProfile `json:"orchestrators,omitempty"` -} - -// Properties properties of the container service. -type Properties struct { - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` - // OrchestratorProfile - Profile for the container service orchestrator. - OrchestratorProfile *OrchestratorProfileType `json:"orchestratorProfile,omitempty"` - // CustomProfile - Properties to configure a custom container service cluster. - CustomProfile *CustomProfile `json:"customProfile,omitempty"` - // ServicePrincipalProfile - Information about a service principal identity for the cluster to use for manipulating Azure APIs. Exact one of secret or keyVaultSecretRef need to be specified. - ServicePrincipalProfile *ServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"` - // MasterProfile - Profile for the container service master. - MasterProfile *MasterProfile `json:"masterProfile,omitempty"` - // AgentPoolProfiles - Properties of the agent pool. - AgentPoolProfiles *[]AgentPoolProfile `json:"agentPoolProfiles,omitempty"` - // WindowsProfile - Profile for Windows VMs in the container service cluster. - WindowsProfile *WindowsProfile `json:"windowsProfile,omitempty"` - // LinuxProfile - Profile for Linux VMs in the container service cluster. - LinuxProfile *LinuxProfile `json:"linuxProfile,omitempty"` - // DiagnosticsProfile - Profile for diagnostics in the container service cluster. - DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` -} - -// MarshalJSON is the custom marshaler for Properties. -func (p Properties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if p.OrchestratorProfile != nil { - objectMap["orchestratorProfile"] = p.OrchestratorProfile - } - if p.CustomProfile != nil { - objectMap["customProfile"] = p.CustomProfile - } - if p.ServicePrincipalProfile != nil { - objectMap["servicePrincipalProfile"] = p.ServicePrincipalProfile - } - if p.MasterProfile != nil { - objectMap["masterProfile"] = p.MasterProfile - } - if p.AgentPoolProfiles != nil { - objectMap["agentPoolProfiles"] = p.AgentPoolProfiles - } - if p.WindowsProfile != nil { - objectMap["windowsProfile"] = p.WindowsProfile - } - if p.LinuxProfile != nil { - objectMap["linuxProfile"] = p.LinuxProfile - } - if p.DiagnosticsProfile != nil { - objectMap["diagnosticsProfile"] = p.DiagnosticsProfile - } - return json.Marshal(objectMap) -} - -// PurchasePlan used for establishing the purchase context of any 3rd Party artifact through MarketPlace. -type PurchasePlan struct { - // Name - The plan ID. - Name *string `json:"name,omitempty"` - // Product - Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. - Product *string `json:"product,omitempty"` - // PromotionCode - The promotion code. - PromotionCode *string `json:"promotionCode,omitempty"` - // Publisher - The plan ID. - Publisher *string `json:"publisher,omitempty"` -} - -// Resource the Resource model definition. -type Resource struct { - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// ResourceReference a reference to an Azure resource. -type ResourceReference struct { - // ID - The fully qualified Azure resource id. - ID *string `json:"id,omitempty"` -} - -// ServicePrincipalProfile information about a service principal identity for the cluster to use for -// manipulating Azure APIs. Either secret or keyVaultSecretRef must be specified. -type ServicePrincipalProfile struct { - // ClientID - The ID for the service principal. - ClientID *string `json:"clientId,omitempty"` - // Secret - The secret password associated with the service principal in plain text. - Secret *string `json:"secret,omitempty"` - // KeyVaultSecretRef - Reference to a secret stored in Azure Key Vault. - KeyVaultSecretRef *KeyVaultSecretRef `json:"keyVaultSecretRef,omitempty"` -} - -// SSHConfiguration SSH configuration for Linux-based VMs running on Azure. -type SSHConfiguration struct { - // PublicKeys - The list of SSH public keys used to authenticate with Linux-based VMs. Only expect one key specified. - PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` -} - -// SSHPublicKey contains information about SSH certificate public key data. -type SSHPublicKey struct { - // KeyData - Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. - KeyData *string `json:"keyData,omitempty"` -} - -// SubResource reference to another subresource. -type SubResource struct { - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubResource. -func (sr SubResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TagsObject tags object for patch operations. -type TagsObject struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TagsObject. -func (toVar TagsObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if toVar.Tags != nil { - objectMap["tags"] = toVar.Tags - } - return json.Marshal(objectMap) -} - -// VMDiagnostics profile for diagnostics on the container service VMs. -type VMDiagnostics struct { - // Enabled - Whether the VM diagnostic agent is provisioned on the VM. - Enabled *bool `json:"enabled,omitempty"` - // StorageURI - READ-ONLY; The URI of the storage account where diagnostics are stored. - StorageURI *string `json:"storageUri,omitempty"` -} - -// MarshalJSON is the custom marshaler for VMDiagnostics. -func (vd VMDiagnostics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vd.Enabled != nil { - objectMap["enabled"] = vd.Enabled - } - return json.Marshal(objectMap) -} - -// WindowsProfile profile for Windows VMs in the container service cluster. -type WindowsProfile struct { - // AdminUsername - The administrator username to use for Windows VMs. - AdminUsername *string `json:"adminUsername,omitempty"` - // AdminPassword - The administrator password to use for Windows VMs. - AdminPassword *string `json:"adminPassword,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/openshiftmanagedclusters.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/openshiftmanagedclusters.go deleted file mode 100644 index aad5edd3ba55..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/openshiftmanagedclusters.go +++ /dev/null @@ -1,619 +0,0 @@ -package containerservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OpenShiftManagedClustersClient is the the Container Service Client. -type OpenShiftManagedClustersClient struct { - BaseClient -} - -// NewOpenShiftManagedClustersClient creates an instance of the OpenShiftManagedClustersClient client. -func NewOpenShiftManagedClustersClient(subscriptionID string) OpenShiftManagedClustersClient { - return NewOpenShiftManagedClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOpenShiftManagedClustersClientWithBaseURI creates an instance of the OpenShiftManagedClustersClient client using -// a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewOpenShiftManagedClustersClientWithBaseURI(baseURI string, subscriptionID string) OpenShiftManagedClustersClient { - return OpenShiftManagedClustersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a OpenShift managed cluster with the specified configuration for agents and -// OpenShift version. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the OpenShift managed cluster resource. -// parameters - parameters supplied to the Create or Update an OpenShift Managed Cluster operation. -func (client OpenShiftManagedClustersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters OpenShiftManagedCluster) (result OpenShiftManagedClustersCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftManagedClustersClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.OpenShiftManagedClusterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.OpenShiftManagedClusterProperties.OpenShiftVersion", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.OpenShiftManagedClusterProperties.MasterPoolProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.OpenShiftManagedClusterProperties.MasterPoolProfile.Count", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("containerservice.OpenShiftManagedClustersClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client OpenShiftManagedClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters OpenShiftManagedCluster) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-04-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client OpenShiftManagedClustersClient) CreateOrUpdateSender(req *http.Request) (future OpenShiftManagedClustersCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client OpenShiftManagedClustersClient) CreateOrUpdateResponder(resp *http.Response) (result OpenShiftManagedCluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the OpenShift managed cluster with a specified resource group and name. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the OpenShift managed cluster resource. -func (client OpenShiftManagedClustersClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result OpenShiftManagedClustersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftManagedClustersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.OpenShiftManagedClustersClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client OpenShiftManagedClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-04-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client OpenShiftManagedClustersClient) DeleteSender(req *http.Request) (future OpenShiftManagedClustersDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client OpenShiftManagedClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the managed OpenShift cluster with a specified resource group and name. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the OpenShift managed cluster resource. -func (client OpenShiftManagedClustersClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result OpenShiftManagedCluster, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftManagedClustersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.OpenShiftManagedClustersClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client OpenShiftManagedClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-04-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client OpenShiftManagedClustersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client OpenShiftManagedClustersClient) GetResponder(resp *http.Response) (result OpenShiftManagedCluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of -// each OpenShift managed cluster. -func (client OpenShiftManagedClustersClient) List(ctx context.Context) (result OpenShiftManagedClusterListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftManagedClustersClient.List") - defer func() { - sc := -1 - if result.osmclr.Response.Response != nil { - sc = result.osmclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.osmclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "List", resp, "Failure sending request") - return - } - - result.osmclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "List", resp, "Failure responding to request") - return - } - if result.osmclr.hasNextLink() && result.osmclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OpenShiftManagedClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-04-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OpenShiftManagedClustersClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OpenShiftManagedClustersClient) ListResponder(resp *http.Response) (result OpenShiftManagedClusterListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OpenShiftManagedClustersClient) listNextResults(ctx context.Context, lastResults OpenShiftManagedClusterListResult) (result OpenShiftManagedClusterListResult, err error) { - req, err := lastResults.openShiftManagedClusterListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OpenShiftManagedClustersClient) ListComplete(ctx context.Context) (result OpenShiftManagedClusterListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftManagedClustersClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup lists OpenShift managed clusters in the specified subscription and resource group. The operation -// returns properties of each OpenShift managed cluster. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client OpenShiftManagedClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result OpenShiftManagedClusterListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftManagedClustersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.osmclr.Response.Response != nil { - sc = result.osmclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.OpenShiftManagedClustersClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.osmclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.osmclr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.osmclr.hasNextLink() && result.osmclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client OpenShiftManagedClustersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-04-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client OpenShiftManagedClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client OpenShiftManagedClustersClient) ListByResourceGroupResponder(resp *http.Response) (result OpenShiftManagedClusterListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client OpenShiftManagedClustersClient) listByResourceGroupNextResults(ctx context.Context, lastResults OpenShiftManagedClusterListResult) (result OpenShiftManagedClusterListResult, err error) { - req, err := lastResults.openShiftManagedClusterListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client OpenShiftManagedClustersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result OpenShiftManagedClusterListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftManagedClustersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// UpdateTags updates an OpenShift managed cluster with the specified tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the OpenShift managed cluster resource. -// parameters - parameters supplied to the Update OpenShift Managed Cluster Tags operation. -func (client OpenShiftManagedClustersClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (result OpenShiftManagedClustersUpdateTagsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftManagedClustersClient.UpdateTags") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.OpenShiftManagedClustersClient", "UpdateTags", err.Error()) - } - - req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, resourceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "UpdateTags", nil, "Failure preparing request") - return - } - - result, err = client.UpdateTagsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OpenShiftManagedClustersClient", "UpdateTags", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateTagsPreparer prepares the UpdateTags request. -func (client OpenShiftManagedClustersClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-04-30" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTagsSender sends the UpdateTags request. The method will close the -// http.Response Body if it receives an error. -func (client OpenShiftManagedClustersClient) UpdateTagsSender(req *http.Request) (future OpenShiftManagedClustersUpdateTagsFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateTagsResponder handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (client OpenShiftManagedClustersClient) UpdateTagsResponder(resp *http.Response) (result OpenShiftManagedCluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/operations.go deleted file mode 100644 index 47f43e588349..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package containerservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the the Container Service Client. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets a list of compute operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ContainerService/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/version.go deleted file mode 100644 index bbf140fce842..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package containerservice - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " containerservice/2019-08-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/_meta.json deleted file mode 100644 index 7f30d618a7c5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "394395ed0bdc1c5c05cb37a031379ca03bfebbb5", - "readme": "/_/azure-rest-api-specs/specification/datadog/resource-manager/readme.md", - "tag": "package-2021-03", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/datadog/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/client.go deleted file mode 100644 index cb559d08b931..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/datadog/armdatadog](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/datadog/armdatadog). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package datadog implements the Azure ARM Datadog service API version 2021-03-01. -// -// -package datadog - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Datadog - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Datadog. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/enums.go deleted file mode 100644 index 5b11464d49bb..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/enums.go +++ /dev/null @@ -1,153 +0,0 @@ -package datadog - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// LiftrResourceCategories enumerates the values for liftr resource categories. -type LiftrResourceCategories string - -const ( - // LiftrResourceCategoriesMonitorLogs ... - LiftrResourceCategoriesMonitorLogs LiftrResourceCategories = "MonitorLogs" - // LiftrResourceCategoriesUnknown ... - LiftrResourceCategoriesUnknown LiftrResourceCategories = "Unknown" -) - -// PossibleLiftrResourceCategoriesValues returns an array of possible values for the LiftrResourceCategories const type. -func PossibleLiftrResourceCategoriesValues() []LiftrResourceCategories { - return []LiftrResourceCategories{LiftrResourceCategoriesMonitorLogs, LiftrResourceCategoriesUnknown} -} - -// ManagedIdentityTypes enumerates the values for managed identity types. -type ManagedIdentityTypes string - -const ( - // ManagedIdentityTypesSystemAssigned ... - ManagedIdentityTypesSystemAssigned ManagedIdentityTypes = "SystemAssigned" - // ManagedIdentityTypesUserAssigned ... - ManagedIdentityTypesUserAssigned ManagedIdentityTypes = "UserAssigned" -) - -// PossibleManagedIdentityTypesValues returns an array of possible values for the ManagedIdentityTypes const type. -func PossibleManagedIdentityTypesValues() []ManagedIdentityTypes { - return []ManagedIdentityTypes{ManagedIdentityTypesSystemAssigned, ManagedIdentityTypesUserAssigned} -} - -// MarketplaceSubscriptionStatus enumerates the values for marketplace subscription status. -type MarketplaceSubscriptionStatus string - -const ( - // MarketplaceSubscriptionStatusActive ... - MarketplaceSubscriptionStatusActive MarketplaceSubscriptionStatus = "Active" - // MarketplaceSubscriptionStatusProvisioning ... - MarketplaceSubscriptionStatusProvisioning MarketplaceSubscriptionStatus = "Provisioning" - // MarketplaceSubscriptionStatusSuspended ... - MarketplaceSubscriptionStatusSuspended MarketplaceSubscriptionStatus = "Suspended" - // MarketplaceSubscriptionStatusUnsubscribed ... - MarketplaceSubscriptionStatusUnsubscribed MarketplaceSubscriptionStatus = "Unsubscribed" -) - -// PossibleMarketplaceSubscriptionStatusValues returns an array of possible values for the MarketplaceSubscriptionStatus const type. -func PossibleMarketplaceSubscriptionStatusValues() []MarketplaceSubscriptionStatus { - return []MarketplaceSubscriptionStatus{MarketplaceSubscriptionStatusActive, MarketplaceSubscriptionStatusProvisioning, MarketplaceSubscriptionStatusSuspended, MarketplaceSubscriptionStatusUnsubscribed} -} - -// MonitoringStatus enumerates the values for monitoring status. -type MonitoringStatus string - -const ( - // MonitoringStatusDisabled ... - MonitoringStatusDisabled MonitoringStatus = "Disabled" - // MonitoringStatusEnabled ... - MonitoringStatusEnabled MonitoringStatus = "Enabled" -) - -// PossibleMonitoringStatusValues returns an array of possible values for the MonitoringStatus const type. -func PossibleMonitoringStatusValues() []MonitoringStatus { - return []MonitoringStatus{MonitoringStatusDisabled, MonitoringStatusEnabled} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateAccepted ... - ProvisioningStateAccepted ProvisioningState = "Accepted" - // ProvisioningStateCanceled ... - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateCreating ... - ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleted ... - ProvisioningStateDeleted ProvisioningState = "Deleted" - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateNotSpecified ... - ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating ... - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateAccepted, ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateNotSpecified, ProvisioningStateSucceeded, ProvisioningStateUpdating} -} - -// SingleSignOnStates enumerates the values for single sign on states. -type SingleSignOnStates string - -const ( - // SingleSignOnStatesDisable ... - SingleSignOnStatesDisable SingleSignOnStates = "Disable" - // SingleSignOnStatesEnable ... - SingleSignOnStatesEnable SingleSignOnStates = "Enable" - // SingleSignOnStatesExisting ... - SingleSignOnStatesExisting SingleSignOnStates = "Existing" - // SingleSignOnStatesInitial ... - SingleSignOnStatesInitial SingleSignOnStates = "Initial" -) - -// PossibleSingleSignOnStatesValues returns an array of possible values for the SingleSignOnStates const type. -func PossibleSingleSignOnStatesValues() []SingleSignOnStates { - return []SingleSignOnStates{SingleSignOnStatesDisable, SingleSignOnStatesEnable, SingleSignOnStatesExisting, SingleSignOnStatesInitial} -} - -// TagAction enumerates the values for tag action. -type TagAction string - -const ( - // TagActionExclude ... - TagActionExclude TagAction = "Exclude" - // TagActionInclude ... - TagActionInclude TagAction = "Include" -) - -// PossibleTagActionValues returns an array of possible values for the TagAction const type. -func PossibleTagActionValues() []TagAction { - return []TagAction{TagActionExclude, TagActionInclude} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/marketplaceagreements.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/marketplaceagreements.go deleted file mode 100644 index 0f5053aaa3db..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/marketplaceagreements.go +++ /dev/null @@ -1,238 +0,0 @@ -package datadog - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MarketplaceAgreementsClient is the client for the MarketplaceAgreements methods of the Datadog service. -type MarketplaceAgreementsClient struct { - BaseClient -} - -// NewMarketplaceAgreementsClient creates an instance of the MarketplaceAgreementsClient client. -func NewMarketplaceAgreementsClient(subscriptionID string) MarketplaceAgreementsClient { - return NewMarketplaceAgreementsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMarketplaceAgreementsClientWithBaseURI creates an instance of the MarketplaceAgreementsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewMarketplaceAgreementsClientWithBaseURI(baseURI string, subscriptionID string) MarketplaceAgreementsClient { - return MarketplaceAgreementsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate sends the create or update request. -func (client MarketplaceAgreementsClient) CreateOrUpdate(ctx context.Context, body *AgreementResource) (result AgreementResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MarketplaceAgreementsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.MarketplaceAgreementsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, body) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client MarketplaceAgreementsClient) CreateOrUpdatePreparer(ctx context.Context, body *AgreementResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client MarketplaceAgreementsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client MarketplaceAgreementsClient) CreateOrUpdateResponder(resp *http.Response) (result AgreementResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List sends the list request. -func (client MarketplaceAgreementsClient) List(ctx context.Context) (result AgreementResourceListResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MarketplaceAgreementsClient.List") - defer func() { - sc := -1 - if result.arlr.Response.Response != nil { - sc = result.arlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.MarketplaceAgreementsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.arlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "List", resp, "Failure sending request") - return - } - - result.arlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "List", resp, "Failure responding to request") - return - } - if result.arlr.hasNextLink() && result.arlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MarketplaceAgreementsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client MarketplaceAgreementsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client MarketplaceAgreementsClient) ListResponder(resp *http.Response) (result AgreementResourceListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client MarketplaceAgreementsClient) listNextResults(ctx context.Context, lastResults AgreementResourceListResponse) (result AgreementResourceListResponse, err error) { - req, err := lastResults.agreementResourceListResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client MarketplaceAgreementsClient) ListComplete(ctx context.Context) (result AgreementResourceListResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MarketplaceAgreementsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/models.go deleted file mode 100644 index 3f10e0dfcad1..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/models.go +++ /dev/null @@ -1,2115 +0,0 @@ -package datadog - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog" - -// AgreementProperties terms properties. -type AgreementProperties struct { - // Publisher - Publisher identifier string. - Publisher *string `json:"publisher,omitempty"` - // Product - Product identifier string. - Product *string `json:"product,omitempty"` - // Plan - Plan identifier string. - Plan *string `json:"plan,omitempty"` - // LicenseTextLink - Link to HTML with Microsoft and Publisher terms. - LicenseTextLink *string `json:"licenseTextLink,omitempty"` - // PrivacyPolicyLink - Link to the privacy policy of the publisher. - PrivacyPolicyLink *string `json:"privacyPolicyLink,omitempty"` - // RetrieveDatetime - Date and time in UTC of when the terms were accepted. This is empty if Accepted is false. - RetrieveDatetime *date.Time `json:"retrieveDatetime,omitempty"` - // Signature - Terms signature. - Signature *string `json:"signature,omitempty"` - // Accepted - If any version of the terms have been accepted, otherwise false. - Accepted *bool `json:"accepted,omitempty"` -} - -// AgreementResource ... -type AgreementResource struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; ARM id of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the agreement. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Properties - Represents the properties of the resource. - Properties *AgreementProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgreementResource. -func (ar AgreementResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Properties != nil { - objectMap["properties"] = ar.Properties - } - return json.Marshal(objectMap) -} - -// AgreementResourceListResponse response of a list operation. -type AgreementResourceListResponse struct { - autorest.Response `json:"-"` - // Value - Results of a list operation. - Value *[]AgreementResource `json:"value,omitempty"` - // NextLink - Link to the next set of results, if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// AgreementResourceListResponseIterator provides access to a complete listing of AgreementResource values. -type AgreementResourceListResponseIterator struct { - i int - page AgreementResourceListResponsePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AgreementResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgreementResourceListResponseIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AgreementResourceListResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AgreementResourceListResponseIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AgreementResourceListResponseIterator) Response() AgreementResourceListResponse { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AgreementResourceListResponseIterator) Value() AgreementResource { - if !iter.page.NotDone() { - return AgreementResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AgreementResourceListResponseIterator type. -func NewAgreementResourceListResponseIterator(page AgreementResourceListResponsePage) AgreementResourceListResponseIterator { - return AgreementResourceListResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (arlr AgreementResourceListResponse) IsEmpty() bool { - return arlr.Value == nil || len(*arlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (arlr AgreementResourceListResponse) hasNextLink() bool { - return arlr.NextLink != nil && len(*arlr.NextLink) != 0 -} - -// agreementResourceListResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (arlr AgreementResourceListResponse) agreementResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { - if !arlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(arlr.NextLink))) -} - -// AgreementResourceListResponsePage contains a page of AgreementResource values. -type AgreementResourceListResponsePage struct { - fn func(context.Context, AgreementResourceListResponse) (AgreementResourceListResponse, error) - arlr AgreementResourceListResponse -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AgreementResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgreementResourceListResponsePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.arlr) - if err != nil { - return err - } - page.arlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AgreementResourceListResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AgreementResourceListResponsePage) NotDone() bool { - return !page.arlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AgreementResourceListResponsePage) Response() AgreementResourceListResponse { - return page.arlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AgreementResourceListResponsePage) Values() []AgreementResource { - if page.arlr.IsEmpty() { - return nil - } - return *page.arlr.Value -} - -// Creates a new instance of the AgreementResourceListResponsePage type. -func NewAgreementResourceListResponsePage(cur AgreementResourceListResponse, getNextPage func(context.Context, AgreementResourceListResponse) (AgreementResourceListResponse, error)) AgreementResourceListResponsePage { - return AgreementResourceListResponsePage{ - fn: getNextPage, - arlr: cur, - } -} - -// APIKey ... -type APIKey struct { - autorest.Response `json:"-"` - // CreatedBy - The user that created the API key. - CreatedBy *string `json:"createdBy,omitempty"` - // Name - The name of the API key. - Name *string `json:"name,omitempty"` - // Key - The value of the API key. - Key *string `json:"key,omitempty"` - // Created - The time of creation of the API key. - Created *string `json:"created,omitempty"` -} - -// APIKeyListResponse response of a list operation. -type APIKeyListResponse struct { - autorest.Response `json:"-"` - // Value - Results of a list operation. - Value *[]APIKey `json:"value,omitempty"` - // NextLink - Link to the next set of results, if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// APIKeyListResponseIterator provides access to a complete listing of APIKey values. -type APIKeyListResponseIterator struct { - i int - page APIKeyListResponsePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *APIKeyListResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIKeyListResponseIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *APIKeyListResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APIKeyListResponseIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter APIKeyListResponseIterator) Response() APIKeyListResponse { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter APIKeyListResponseIterator) Value() APIKey { - if !iter.page.NotDone() { - return APIKey{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APIKeyListResponseIterator type. -func NewAPIKeyListResponseIterator(page APIKeyListResponsePage) APIKeyListResponseIterator { - return APIKeyListResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aklr APIKeyListResponse) IsEmpty() bool { - return aklr.Value == nil || len(*aklr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aklr APIKeyListResponse) hasNextLink() bool { - return aklr.NextLink != nil && len(*aklr.NextLink) != 0 -} - -// aPIKeyListResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aklr APIKeyListResponse) aPIKeyListResponsePreparer(ctx context.Context) (*http.Request, error) { - if !aklr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aklr.NextLink))) -} - -// APIKeyListResponsePage contains a page of APIKey values. -type APIKeyListResponsePage struct { - fn func(context.Context, APIKeyListResponse) (APIKeyListResponse, error) - aklr APIKeyListResponse -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *APIKeyListResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIKeyListResponsePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.aklr) - if err != nil { - return err - } - page.aklr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *APIKeyListResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APIKeyListResponsePage) NotDone() bool { - return !page.aklr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APIKeyListResponsePage) Response() APIKeyListResponse { - return page.aklr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APIKeyListResponsePage) Values() []APIKey { - if page.aklr.IsEmpty() { - return nil - } - return *page.aklr.Value -} - -// Creates a new instance of the APIKeyListResponsePage type. -func NewAPIKeyListResponsePage(cur APIKeyListResponse, getNextPage func(context.Context, APIKeyListResponse) (APIKeyListResponse, error)) APIKeyListResponsePage { - return APIKeyListResponsePage{ - fn: getNextPage, - aklr: cur, - } -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorDetail the error detail. -type ErrorDetail struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]ErrorDetail `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorDetail. -func (ed ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for -// failed operations. (This also follows the OData error response format.). -type ErrorResponse struct { - // Error - The error object. - Error *ErrorDetail `json:"error,omitempty"` -} - -// FilteringTag the definition of a filtering tag. Filtering tags are used for capturing resources and -// include/exclude them from being monitored. -type FilteringTag struct { - // Name - The name (also known as the key) of the tag. - Name *string `json:"name,omitempty"` - // Value - The value of the tag. - Value *string `json:"value,omitempty"` - // Action - Possible values include: 'TagActionInclude', 'TagActionExclude' - Action TagAction `json:"action,omitempty"` -} - -// Host ... -type Host struct { - // Name - The name of the host. - Name *string `json:"name,omitempty"` - // Aliases - The aliases for the host. - Aliases *[]string `json:"aliases,omitempty"` - // Apps - The Datadog integrations reporting metrics for the host. - Apps *[]string `json:"apps,omitempty"` - Meta *HostMetadata `json:"meta,omitempty"` -} - -// HostListResponse response of a list operation. -type HostListResponse struct { - autorest.Response `json:"-"` - // Value - Results of a list operation. - Value *[]Host `json:"value,omitempty"` - // NextLink - Link to the next set of results, if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// HostListResponseIterator provides access to a complete listing of Host values. -type HostListResponseIterator struct { - i int - page HostListResponsePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *HostListResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostListResponseIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *HostListResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter HostListResponseIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter HostListResponseIterator) Response() HostListResponse { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter HostListResponseIterator) Value() Host { - if !iter.page.NotDone() { - return Host{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the HostListResponseIterator type. -func NewHostListResponseIterator(page HostListResponsePage) HostListResponseIterator { - return HostListResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (hlr HostListResponse) IsEmpty() bool { - return hlr.Value == nil || len(*hlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (hlr HostListResponse) hasNextLink() bool { - return hlr.NextLink != nil && len(*hlr.NextLink) != 0 -} - -// hostListResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (hlr HostListResponse) hostListResponsePreparer(ctx context.Context) (*http.Request, error) { - if !hlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(hlr.NextLink))) -} - -// HostListResponsePage contains a page of Host values. -type HostListResponsePage struct { - fn func(context.Context, HostListResponse) (HostListResponse, error) - hlr HostListResponse -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *HostListResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostListResponsePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.hlr) - if err != nil { - return err - } - page.hlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *HostListResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page HostListResponsePage) NotDone() bool { - return !page.hlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page HostListResponsePage) Response() HostListResponse { - return page.hlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page HostListResponsePage) Values() []Host { - if page.hlr.IsEmpty() { - return nil - } - return *page.hlr.Value -} - -// Creates a new instance of the HostListResponsePage type. -func NewHostListResponsePage(cur HostListResponse, getNextPage func(context.Context, HostListResponse) (HostListResponse, error)) HostListResponsePage { - return HostListResponsePage{ - fn: getNextPage, - hlr: cur, - } -} - -// HostMetadata ... -type HostMetadata struct { - // AgentVersion - The agent version. - AgentVersion *string `json:"agentVersion,omitempty"` - InstallMethod *InstallMethod `json:"installMethod,omitempty"` - LogsAgent *LogsAgent `json:"logsAgent,omitempty"` -} - -// IdentityProperties ... -type IdentityProperties struct { - // PrincipalID - READ-ONLY; The identity ID. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - Possible values include: 'ManagedIdentityTypesSystemAssigned', 'ManagedIdentityTypesUserAssigned' - Type ManagedIdentityTypes `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IdentityProperties. -func (IP IdentityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if IP.Type != "" { - objectMap["type"] = IP.Type - } - return json.Marshal(objectMap) -} - -// InstallMethod ... -type InstallMethod struct { - // Tool - The tool. - Tool *string `json:"tool,omitempty"` - // ToolVersion - The tool version. - ToolVersion *string `json:"toolVersion,omitempty"` - // InstallerVersion - The installer version. - InstallerVersion *string `json:"installerVersion,omitempty"` -} - -// LinkedResource the definition of a linked resource. -type LinkedResource struct { - // ID - The ARM id of the linked resource. - ID *string `json:"id,omitempty"` -} - -// LinkedResourceListResponse response of a list operation. -type LinkedResourceListResponse struct { - autorest.Response `json:"-"` - // Value - Results of a list operation. - Value *[]LinkedResource `json:"value,omitempty"` - // NextLink - Link to the next set of results, if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// LinkedResourceListResponseIterator provides access to a complete listing of LinkedResource values. -type LinkedResourceListResponseIterator struct { - i int - page LinkedResourceListResponsePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *LinkedResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LinkedResourceListResponseIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *LinkedResourceListResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LinkedResourceListResponseIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter LinkedResourceListResponseIterator) Response() LinkedResourceListResponse { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter LinkedResourceListResponseIterator) Value() LinkedResource { - if !iter.page.NotDone() { - return LinkedResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LinkedResourceListResponseIterator type. -func NewLinkedResourceListResponseIterator(page LinkedResourceListResponsePage) LinkedResourceListResponseIterator { - return LinkedResourceListResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lrlr LinkedResourceListResponse) IsEmpty() bool { - return lrlr.Value == nil || len(*lrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lrlr LinkedResourceListResponse) hasNextLink() bool { - return lrlr.NextLink != nil && len(*lrlr.NextLink) != 0 -} - -// linkedResourceListResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lrlr LinkedResourceListResponse) linkedResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { - if !lrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lrlr.NextLink))) -} - -// LinkedResourceListResponsePage contains a page of LinkedResource values. -type LinkedResourceListResponsePage struct { - fn func(context.Context, LinkedResourceListResponse) (LinkedResourceListResponse, error) - lrlr LinkedResourceListResponse -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *LinkedResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LinkedResourceListResponsePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lrlr) - if err != nil { - return err - } - page.lrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *LinkedResourceListResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LinkedResourceListResponsePage) NotDone() bool { - return !page.lrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LinkedResourceListResponsePage) Response() LinkedResourceListResponse { - return page.lrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LinkedResourceListResponsePage) Values() []LinkedResource { - if page.lrlr.IsEmpty() { - return nil - } - return *page.lrlr.Value -} - -// Creates a new instance of the LinkedResourceListResponsePage type. -func NewLinkedResourceListResponsePage(cur LinkedResourceListResponse, getNextPage func(context.Context, LinkedResourceListResponse) (LinkedResourceListResponse, error)) LinkedResourceListResponsePage { - return LinkedResourceListResponsePage{ - fn: getNextPage, - lrlr: cur, - } -} - -// LogRules set of rules for sending logs for the Monitor resource. -type LogRules struct { - // SendAadLogs - Flag specifying if AAD logs should be sent for the Monitor resource. - SendAadLogs *bool `json:"sendAadLogs,omitempty"` - // SendSubscriptionLogs - Flag specifying if Azure subscription logs should be sent for the Monitor resource. - SendSubscriptionLogs *bool `json:"sendSubscriptionLogs,omitempty"` - // SendResourceLogs - Flag specifying if Azure resource logs should be sent for the Monitor resource. - SendResourceLogs *bool `json:"sendResourceLogs,omitempty"` - // FilteringTags - List of filtering tags to be used for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. - FilteringTags *[]FilteringTag `json:"filteringTags,omitempty"` -} - -// LogsAgent ... -type LogsAgent struct { - // Transport - The transport. - Transport *string `json:"transport,omitempty"` -} - -// MetricRules set of rules for sending metrics for the Monitor resource. -type MetricRules struct { - // FilteringTags - List of filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. - FilteringTags *[]FilteringTag `json:"filteringTags,omitempty"` -} - -// MonitoredResource the properties of a resource currently being monitored by the Datadog monitor -// resource. -type MonitoredResource struct { - // ID - The ARM id of the resource. - ID *string `json:"id,omitempty"` - // SendingMetrics - Flag indicating if resource is sending metrics to Datadog. - SendingMetrics *bool `json:"sendingMetrics,omitempty"` - // ReasonForMetricsStatus - Reason for why the resource is sending metrics (or why it is not sending). - ReasonForMetricsStatus *string `json:"reasonForMetricsStatus,omitempty"` - // SendingLogs - Flag indicating if resource is sending logs to Datadog. - SendingLogs *bool `json:"sendingLogs,omitempty"` - // ReasonForLogsStatus - Reason for why the resource is sending logs (or why it is not sending). - ReasonForLogsStatus *string `json:"reasonForLogsStatus,omitempty"` -} - -// MonitoredResourceListResponse response of a list operation. -type MonitoredResourceListResponse struct { - autorest.Response `json:"-"` - // Value - Results of a list operation. - Value *[]MonitoredResource `json:"value,omitempty"` - // NextLink - Link to the next set of results, if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MonitoredResourceListResponseIterator provides access to a complete listing of MonitoredResource values. -type MonitoredResourceListResponseIterator struct { - i int - page MonitoredResourceListResponsePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *MonitoredResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitoredResourceListResponseIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *MonitoredResourceListResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter MonitoredResourceListResponseIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter MonitoredResourceListResponseIterator) Response() MonitoredResourceListResponse { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter MonitoredResourceListResponseIterator) Value() MonitoredResource { - if !iter.page.NotDone() { - return MonitoredResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the MonitoredResourceListResponseIterator type. -func NewMonitoredResourceListResponseIterator(page MonitoredResourceListResponsePage) MonitoredResourceListResponseIterator { - return MonitoredResourceListResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mrlr MonitoredResourceListResponse) IsEmpty() bool { - return mrlr.Value == nil || len(*mrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mrlr MonitoredResourceListResponse) hasNextLink() bool { - return mrlr.NextLink != nil && len(*mrlr.NextLink) != 0 -} - -// monitoredResourceListResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mrlr MonitoredResourceListResponse) monitoredResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { - if !mrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mrlr.NextLink))) -} - -// MonitoredResourceListResponsePage contains a page of MonitoredResource values. -type MonitoredResourceListResponsePage struct { - fn func(context.Context, MonitoredResourceListResponse) (MonitoredResourceListResponse, error) - mrlr MonitoredResourceListResponse -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *MonitoredResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitoredResourceListResponsePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.mrlr) - if err != nil { - return err - } - page.mrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *MonitoredResourceListResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page MonitoredResourceListResponsePage) NotDone() bool { - return !page.mrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page MonitoredResourceListResponsePage) Response() MonitoredResourceListResponse { - return page.mrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page MonitoredResourceListResponsePage) Values() []MonitoredResource { - if page.mrlr.IsEmpty() { - return nil - } - return *page.mrlr.Value -} - -// Creates a new instance of the MonitoredResourceListResponsePage type. -func NewMonitoredResourceListResponsePage(cur MonitoredResourceListResponse, getNextPage func(context.Context, MonitoredResourceListResponse) (MonitoredResourceListResponse, error)) MonitoredResourceListResponsePage { - return MonitoredResourceListResponsePage{ - fn: getNextPage, - mrlr: cur, - } -} - -// MonitoringTagRules capture logs and metrics of Azure resources based on ARM tags. -type MonitoringTagRules struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Name of the rule set. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; The id of the rule set. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; The type of the rule set. - Type *string `json:"type,omitempty"` - Properties *MonitoringTagRulesProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for MonitoringTagRules. -func (mtr MonitoringTagRules) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mtr.Properties != nil { - objectMap["properties"] = mtr.Properties - } - return json.Marshal(objectMap) -} - -// MonitoringTagRulesListResponse response of a list operation. -type MonitoringTagRulesListResponse struct { - autorest.Response `json:"-"` - // Value - Results of a list operation. - Value *[]MonitoringTagRules `json:"value,omitempty"` - // NextLink - Link to the next set of results, if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MonitoringTagRulesListResponseIterator provides access to a complete listing of MonitoringTagRules -// values. -type MonitoringTagRulesListResponseIterator struct { - i int - page MonitoringTagRulesListResponsePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *MonitoringTagRulesListResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringTagRulesListResponseIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *MonitoringTagRulesListResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter MonitoringTagRulesListResponseIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter MonitoringTagRulesListResponseIterator) Response() MonitoringTagRulesListResponse { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter MonitoringTagRulesListResponseIterator) Value() MonitoringTagRules { - if !iter.page.NotDone() { - return MonitoringTagRules{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the MonitoringTagRulesListResponseIterator type. -func NewMonitoringTagRulesListResponseIterator(page MonitoringTagRulesListResponsePage) MonitoringTagRulesListResponseIterator { - return MonitoringTagRulesListResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mtrlr MonitoringTagRulesListResponse) IsEmpty() bool { - return mtrlr.Value == nil || len(*mtrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mtrlr MonitoringTagRulesListResponse) hasNextLink() bool { - return mtrlr.NextLink != nil && len(*mtrlr.NextLink) != 0 -} - -// monitoringTagRulesListResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mtrlr MonitoringTagRulesListResponse) monitoringTagRulesListResponsePreparer(ctx context.Context) (*http.Request, error) { - if !mtrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mtrlr.NextLink))) -} - -// MonitoringTagRulesListResponsePage contains a page of MonitoringTagRules values. -type MonitoringTagRulesListResponsePage struct { - fn func(context.Context, MonitoringTagRulesListResponse) (MonitoringTagRulesListResponse, error) - mtrlr MonitoringTagRulesListResponse -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *MonitoringTagRulesListResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringTagRulesListResponsePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.mtrlr) - if err != nil { - return err - } - page.mtrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *MonitoringTagRulesListResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page MonitoringTagRulesListResponsePage) NotDone() bool { - return !page.mtrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page MonitoringTagRulesListResponsePage) Response() MonitoringTagRulesListResponse { - return page.mtrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page MonitoringTagRulesListResponsePage) Values() []MonitoringTagRules { - if page.mtrlr.IsEmpty() { - return nil - } - return *page.mtrlr.Value -} - -// Creates a new instance of the MonitoringTagRulesListResponsePage type. -func NewMonitoringTagRulesListResponsePage(cur MonitoringTagRulesListResponse, getNextPage func(context.Context, MonitoringTagRulesListResponse) (MonitoringTagRulesListResponse, error)) MonitoringTagRulesListResponsePage { - return MonitoringTagRulesListResponsePage{ - fn: getNextPage, - mtrlr: cur, - } -} - -// MonitoringTagRulesProperties definition of the properties for a TagRules resource. -type MonitoringTagRulesProperties struct { - // ProvisioningState - Possible values include: 'ProvisioningStateAccepted', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateDeleted', 'ProvisioningStateNotSpecified' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - LogRules *LogRules `json:"logRules,omitempty"` - MetricRules *MetricRules `json:"metricRules,omitempty"` -} - -// MonitorProperties properties specific to the monitor resource. -type MonitorProperties struct { - // ProvisioningState - Possible values include: 'ProvisioningStateAccepted', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateDeleted', 'ProvisioningStateNotSpecified' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // MonitoringStatus - Possible values include: 'MonitoringStatusEnabled', 'MonitoringStatusDisabled' - MonitoringStatus MonitoringStatus `json:"monitoringStatus,omitempty"` - // MarketplaceSubscriptionStatus - Possible values include: 'MarketplaceSubscriptionStatusProvisioning', 'MarketplaceSubscriptionStatusActive', 'MarketplaceSubscriptionStatusSuspended', 'MarketplaceSubscriptionStatusUnsubscribed' - MarketplaceSubscriptionStatus MarketplaceSubscriptionStatus `json:"marketplaceSubscriptionStatus,omitempty"` - DatadogOrganizationProperties *OrganizationProperties `json:"datadogOrganizationProperties,omitempty"` - UserInfo *UserInfo `json:"userInfo,omitempty"` - // LiftrResourceCategory - Possible values include: 'LiftrResourceCategoriesUnknown', 'LiftrResourceCategoriesMonitorLogs' - LiftrResourceCategory LiftrResourceCategories `json:"liftrResourceCategory,omitempty"` - // LiftrResourcePreference - READ-ONLY; The priority of the resource. - LiftrResourcePreference *int32 `json:"liftrResourcePreference,omitempty"` -} - -// MarshalJSON is the custom marshaler for MonitorProperties. -func (mp MonitorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mp.ProvisioningState != "" { - objectMap["provisioningState"] = mp.ProvisioningState - } - if mp.MonitoringStatus != "" { - objectMap["monitoringStatus"] = mp.MonitoringStatus - } - if mp.MarketplaceSubscriptionStatus != "" { - objectMap["marketplaceSubscriptionStatus"] = mp.MarketplaceSubscriptionStatus - } - if mp.DatadogOrganizationProperties != nil { - objectMap["datadogOrganizationProperties"] = mp.DatadogOrganizationProperties - } - if mp.UserInfo != nil { - objectMap["userInfo"] = mp.UserInfo - } - if mp.LiftrResourceCategory != "" { - objectMap["liftrResourceCategory"] = mp.LiftrResourceCategory - } - return json.Marshal(objectMap) -} - -// MonitorResource ... -type MonitorResource struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; ARM id of the monitor resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the monitor resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the monitor resource. - Type *string `json:"type,omitempty"` - Sku *ResourceSku `json:"sku,omitempty"` - Properties *MonitorProperties `json:"properties,omitempty"` - Identity *IdentityProperties `json:"identity,omitempty"` - Tags map[string]*string `json:"tags"` - Location *string `json:"location,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for MonitorResource. -func (mr MonitorResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mr.Sku != nil { - objectMap["sku"] = mr.Sku - } - if mr.Properties != nil { - objectMap["properties"] = mr.Properties - } - if mr.Identity != nil { - objectMap["identity"] = mr.Identity - } - if mr.Tags != nil { - objectMap["tags"] = mr.Tags - } - if mr.Location != nil { - objectMap["location"] = mr.Location - } - return json.Marshal(objectMap) -} - -// MonitorResourceListResponse response of a list operation. -type MonitorResourceListResponse struct { - autorest.Response `json:"-"` - // Value - Results of a list operation. - Value *[]MonitorResource `json:"value,omitempty"` - // NextLink - Link to the next set of results, if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MonitorResourceListResponseIterator provides access to a complete listing of MonitorResource values. -type MonitorResourceListResponseIterator struct { - i int - page MonitorResourceListResponsePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *MonitorResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorResourceListResponseIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *MonitorResourceListResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter MonitorResourceListResponseIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter MonitorResourceListResponseIterator) Response() MonitorResourceListResponse { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter MonitorResourceListResponseIterator) Value() MonitorResource { - if !iter.page.NotDone() { - return MonitorResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the MonitorResourceListResponseIterator type. -func NewMonitorResourceListResponseIterator(page MonitorResourceListResponsePage) MonitorResourceListResponseIterator { - return MonitorResourceListResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mrlr MonitorResourceListResponse) IsEmpty() bool { - return mrlr.Value == nil || len(*mrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mrlr MonitorResourceListResponse) hasNextLink() bool { - return mrlr.NextLink != nil && len(*mrlr.NextLink) != 0 -} - -// monitorResourceListResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mrlr MonitorResourceListResponse) monitorResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { - if !mrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mrlr.NextLink))) -} - -// MonitorResourceListResponsePage contains a page of MonitorResource values. -type MonitorResourceListResponsePage struct { - fn func(context.Context, MonitorResourceListResponse) (MonitorResourceListResponse, error) - mrlr MonitorResourceListResponse -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *MonitorResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorResourceListResponsePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.mrlr) - if err != nil { - return err - } - page.mrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *MonitorResourceListResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page MonitorResourceListResponsePage) NotDone() bool { - return !page.mrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page MonitorResourceListResponsePage) Response() MonitorResourceListResponse { - return page.mrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page MonitorResourceListResponsePage) Values() []MonitorResource { - if page.mrlr.IsEmpty() { - return nil - } - return *page.mrlr.Value -} - -// Creates a new instance of the MonitorResourceListResponsePage type. -func NewMonitorResourceListResponsePage(cur MonitorResourceListResponse, getNextPage func(context.Context, MonitorResourceListResponse) (MonitorResourceListResponse, error)) MonitorResourceListResponsePage { - return MonitorResourceListResponsePage{ - fn: getNextPage, - mrlr: cur, - } -} - -// MonitorResourceUpdateParameters the parameters for a PATCH request to a monitor resource. -type MonitorResourceUpdateParameters struct { - Properties *MonitorUpdateProperties `json:"properties,omitempty"` - // Tags - The new tags of the monitor resource. - Tags map[string]*string `json:"tags"` - Sku *ResourceSku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for MonitorResourceUpdateParameters. -func (mrup MonitorResourceUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mrup.Properties != nil { - objectMap["properties"] = mrup.Properties - } - if mrup.Tags != nil { - objectMap["tags"] = mrup.Tags - } - if mrup.Sku != nil { - objectMap["sku"] = mrup.Sku - } - return json.Marshal(objectMap) -} - -// MonitorsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type MonitorsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MonitorsClient) (MonitorResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MonitorsCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for MonitorsCreateFuture.Result. -func (future *MonitorsCreateFuture) result(client MonitorsClient) (mr MonitorResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datadog.MonitorsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mr.Response.Response, err = future.GetResult(sender); err == nil && mr.Response.Response.StatusCode != http.StatusNoContent { - mr, err = client.CreateResponder(mr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsCreateFuture", "Result", mr.Response.Response, "Failure responding to request") - } - } - return -} - -// MonitorsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type MonitorsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MonitorsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MonitorsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for MonitorsDeleteFuture.Result. -func (future *MonitorsDeleteFuture) result(client MonitorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datadog.MonitorsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// MonitorsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type MonitorsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MonitorsClient) (MonitorResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MonitorsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for MonitorsUpdateFuture.Result. -func (future *MonitorsUpdateFuture) result(client MonitorsClient) (mr MonitorResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datadog.MonitorsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mr.Response.Response, err = future.GetResult(sender); err == nil && mr.Response.Response.StatusCode != http.StatusNoContent { - mr, err = client.UpdateResponder(mr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsUpdateFuture", "Result", mr.Response.Response, "Failure responding to request") - } - } - return -} - -// MonitorUpdateProperties the set of properties that can be update in a PATCH request to a monitor -// resource. -type MonitorUpdateProperties struct { - // MonitoringStatus - Possible values include: 'MonitoringStatusEnabled', 'MonitoringStatusDisabled' - MonitoringStatus MonitoringStatus `json:"monitoringStatus,omitempty"` -} - -// OperationDisplay the object that represents the operation. -type OperationDisplay struct { - // Provider - Service provider, i.e., Microsoft.Datadog. - Provider *string `json:"provider,omitempty"` - // Resource - Type on which the operation is performed, e.g., 'monitors'. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type, e.g., read, write, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - Description of the operation, e.g., 'Write monitors'. - Description *string `json:"description,omitempty"` -} - -// OperationListResult result of GET request to list the Microsoft.Datadog operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the Microsoft.Datadog provider. - Value *[]OperationResult `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of OperationResult values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() OperationResult { - if !iter.page.NotDone() { - return OperationResult{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of OperationResult values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []OperationResult { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// OperationResult a Microsoft.Datadog REST API operation. -type OperationResult struct { - // Name - Operation name, i.e., {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` - // IsDataAction - Indicates whether the operation is a data action - IsDataAction *bool `json:"isDataAction,omitempty"` -} - -// OrganizationProperties datadog organization properties -type OrganizationProperties struct { - // Name - READ-ONLY; Name of the Datadog organization. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; Id of the Datadog organization. - ID *string `json:"id,omitempty"` - // LinkingAuthCode - The auth code used to linking to an existing datadog organization. - LinkingAuthCode *string `json:"linkingAuthCode,omitempty"` - // LinkingClientID - The client_id from an existing in exchange for an auth token to link organization. - LinkingClientID *string `json:"linkingClientId,omitempty"` - // RedirectURI - The redirect uri for linking. - RedirectURI *string `json:"redirectUri,omitempty"` - // APIKey - Api key associated to the Datadog organization. - APIKey *string `json:"apiKey,omitempty"` - // ApplicationKey - Application key associated to the Datadog organization. - ApplicationKey *string `json:"applicationKey,omitempty"` - // EnterpriseAppID - The Id of the Enterprise App used for Single sign on. - EnterpriseAppID *string `json:"enterpriseAppId,omitempty"` -} - -// MarshalJSON is the custom marshaler for OrganizationProperties. -func (op OrganizationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if op.LinkingAuthCode != nil { - objectMap["linkingAuthCode"] = op.LinkingAuthCode - } - if op.LinkingClientID != nil { - objectMap["linkingClientId"] = op.LinkingClientID - } - if op.RedirectURI != nil { - objectMap["redirectUri"] = op.RedirectURI - } - if op.APIKey != nil { - objectMap["apiKey"] = op.APIKey - } - if op.ApplicationKey != nil { - objectMap["applicationKey"] = op.ApplicationKey - } - if op.EnterpriseAppID != nil { - objectMap["enterpriseAppId"] = op.EnterpriseAppID - } - return json.Marshal(objectMap) -} - -// ResourceSku ... -type ResourceSku struct { - // Name - Name of the SKU. - Name *string `json:"name,omitempty"` -} - -// SetPasswordLink ... -type SetPasswordLink struct { - autorest.Response `json:"-"` - SetPasswordLink *string `json:"setPasswordLink,omitempty"` -} - -// SingleSignOnConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type SingleSignOnConfigurationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SingleSignOnConfigurationsClient) (SingleSignOnResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SingleSignOnConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SingleSignOnConfigurationsCreateOrUpdateFuture.Result. -func (future *SingleSignOnConfigurationsCreateOrUpdateFuture) result(client SingleSignOnConfigurationsClient) (ssor SingleSignOnResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ssor.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datadog.SingleSignOnConfigurationsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ssor.Response.Response, err = future.GetResult(sender); err == nil && ssor.Response.Response.StatusCode != http.StatusNoContent { - ssor, err = client.CreateOrUpdateResponder(ssor.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsCreateOrUpdateFuture", "Result", ssor.Response.Response, "Failure responding to request") - } - } - return -} - -// SingleSignOnProperties ... -type SingleSignOnProperties struct { - // ProvisioningState - Possible values include: 'ProvisioningStateAccepted', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateDeleted', 'ProvisioningStateNotSpecified' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // SingleSignOnState - Possible values include: 'SingleSignOnStatesInitial', 'SingleSignOnStatesEnable', 'SingleSignOnStatesDisable', 'SingleSignOnStatesExisting' - SingleSignOnState SingleSignOnStates `json:"singleSignOnState,omitempty"` - // EnterpriseAppID - The Id of the Enterprise App used for Single sign-on. - EnterpriseAppID *string `json:"enterpriseAppId,omitempty"` - // SingleSignOnURL - READ-ONLY; The login URL specific to this Datadog Organization. - SingleSignOnURL *string `json:"singleSignOnUrl,omitempty"` -} - -// MarshalJSON is the custom marshaler for SingleSignOnProperties. -func (ssop SingleSignOnProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ssop.ProvisioningState != "" { - objectMap["provisioningState"] = ssop.ProvisioningState - } - if ssop.SingleSignOnState != "" { - objectMap["singleSignOnState"] = ssop.SingleSignOnState - } - if ssop.EnterpriseAppID != nil { - objectMap["enterpriseAppId"] = ssop.EnterpriseAppID - } - return json.Marshal(objectMap) -} - -// SingleSignOnResource ... -type SingleSignOnResource struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; ARM id of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the configuration. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - Properties *SingleSignOnProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for SingleSignOnResource. -func (ssor SingleSignOnResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ssor.Properties != nil { - objectMap["properties"] = ssor.Properties - } - return json.Marshal(objectMap) -} - -// SingleSignOnResourceListResponse response of a list operation. -type SingleSignOnResourceListResponse struct { - autorest.Response `json:"-"` - // Value - Results of a list operation. - Value *[]SingleSignOnResource `json:"value,omitempty"` - // NextLink - Link to the next set of results, if any. - NextLink *string `json:"nextLink,omitempty"` -} - -// SingleSignOnResourceListResponseIterator provides access to a complete listing of SingleSignOnResource -// values. -type SingleSignOnResourceListResponseIterator struct { - i int - page SingleSignOnResourceListResponsePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SingleSignOnResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnResourceListResponseIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SingleSignOnResourceListResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SingleSignOnResourceListResponseIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SingleSignOnResourceListResponseIterator) Response() SingleSignOnResourceListResponse { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SingleSignOnResourceListResponseIterator) Value() SingleSignOnResource { - if !iter.page.NotDone() { - return SingleSignOnResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SingleSignOnResourceListResponseIterator type. -func NewSingleSignOnResourceListResponseIterator(page SingleSignOnResourceListResponsePage) SingleSignOnResourceListResponseIterator { - return SingleSignOnResourceListResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ssorlr SingleSignOnResourceListResponse) IsEmpty() bool { - return ssorlr.Value == nil || len(*ssorlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ssorlr SingleSignOnResourceListResponse) hasNextLink() bool { - return ssorlr.NextLink != nil && len(*ssorlr.NextLink) != 0 -} - -// singleSignOnResourceListResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ssorlr SingleSignOnResourceListResponse) singleSignOnResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { - if !ssorlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ssorlr.NextLink))) -} - -// SingleSignOnResourceListResponsePage contains a page of SingleSignOnResource values. -type SingleSignOnResourceListResponsePage struct { - fn func(context.Context, SingleSignOnResourceListResponse) (SingleSignOnResourceListResponse, error) - ssorlr SingleSignOnResourceListResponse -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SingleSignOnResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnResourceListResponsePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ssorlr) - if err != nil { - return err - } - page.ssorlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SingleSignOnResourceListResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SingleSignOnResourceListResponsePage) NotDone() bool { - return !page.ssorlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SingleSignOnResourceListResponsePage) Response() SingleSignOnResourceListResponse { - return page.ssorlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SingleSignOnResourceListResponsePage) Values() []SingleSignOnResource { - if page.ssorlr.IsEmpty() { - return nil - } - return *page.ssorlr.Value -} - -// Creates a new instance of the SingleSignOnResourceListResponsePage type. -func NewSingleSignOnResourceListResponsePage(cur SingleSignOnResourceListResponse, getNextPage func(context.Context, SingleSignOnResourceListResponse) (SingleSignOnResourceListResponse, error)) SingleSignOnResourceListResponsePage { - return SingleSignOnResourceListResponsePage{ - fn: getNextPage, - ssorlr: cur, - } -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// UserInfo user info -type UserInfo struct { - // Name - Name of the user - Name *string `json:"name,omitempty"` - // EmailAddress - Email of the user used by Datadog for contacting them if needed - EmailAddress *string `json:"emailAddress,omitempty"` - // PhoneNumber - Phone number of the user used by Datadog for contacting them if needed - PhoneNumber *string `json:"phoneNumber,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/monitors.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/monitors.go deleted file mode 100644 index f89c95093f41..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/monitors.go +++ /dev/null @@ -1,1436 +0,0 @@ -package datadog - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MonitorsClient is the client for the Monitors methods of the Datadog service. -type MonitorsClient struct { - BaseClient -} - -// NewMonitorsClient creates an instance of the MonitorsClient client. -func NewMonitorsClient(subscriptionID string) MonitorsClient { - return NewMonitorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMonitorsClientWithBaseURI creates an instance of the MonitorsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewMonitorsClientWithBaseURI(baseURI string, subscriptionID string) MonitorsClient { - return MonitorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create sends the create request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -func (client MonitorsClient) Create(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResource) (result MonitorsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "body.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.Properties.UserInfo", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.Name", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.Name", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, - {Target: "body.Properties.UserInfo.EmailAddress", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.EmailAddress", Name: validation.Pattern, Rule: `^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$`, Chain: nil}}}, - {Target: "body.Properties.UserInfo.PhoneNumber", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.PhoneNumber", Name: validation.MaxLength, Rule: 40, Chain: nil}}}, - }}, - }}, - {Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("datadog.MonitorsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, monitorName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client MonitorsClient) CreatePreparer(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client MonitorsClient) CreateSender(req *http.Request) (future MonitorsCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client MonitorsClient) CreateResponder(resp *http.Response) (result MonitorResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete sends the delete request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -func (client MonitorsClient) Delete(ctx context.Context, resourceGroupName string, monitorName string) (result MonitorsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.MonitorsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, monitorName) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client MonitorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client MonitorsClient) DeleteSender(req *http.Request) (future MonitorsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client MonitorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get sends the get request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -func (client MonitorsClient) Get(ctx context.Context, resourceGroupName string, monitorName string) (result MonitorResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.MonitorsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, monitorName) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MonitorsClient) GetPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client MonitorsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client MonitorsClient) GetResponder(resp *http.Response) (result MonitorResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDefaultKey sends the get default key request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -func (client MonitorsClient) GetDefaultKey(ctx context.Context, resourceGroupName string, monitorName string) (result APIKey, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.GetDefaultKey") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.MonitorsClient", "GetDefaultKey", err.Error()) - } - - req, err := client.GetDefaultKeyPreparer(ctx, resourceGroupName, monitorName) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "GetDefaultKey", nil, "Failure preparing request") - return - } - - resp, err := client.GetDefaultKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "GetDefaultKey", resp, "Failure sending request") - return - } - - result, err = client.GetDefaultKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "GetDefaultKey", resp, "Failure responding to request") - return - } - - return -} - -// GetDefaultKeyPreparer prepares the GetDefaultKey request. -func (client MonitorsClient) GetDefaultKeyPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDefaultKeySender sends the GetDefaultKey request. The method will close the -// http.Response Body if it receives an error. -func (client MonitorsClient) GetDefaultKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDefaultKeyResponder handles the response to the GetDefaultKey request. The method always -// closes the http.Response Body. -func (client MonitorsClient) GetDefaultKeyResponder(resp *http.Response) (result APIKey, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List sends the list request. -func (client MonitorsClient) List(ctx context.Context) (result MonitorResourceListResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.List") - defer func() { - sc := -1 - if result.mrlr.Response.Response != nil { - sc = result.mrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.MonitorsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.mrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "List", resp, "Failure sending request") - return - } - - result.mrlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "List", resp, "Failure responding to request") - return - } - if result.mrlr.hasNextLink() && result.mrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MonitorsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client MonitorsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client MonitorsClient) ListResponder(resp *http.Response) (result MonitorResourceListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client MonitorsClient) listNextResults(ctx context.Context, lastResults MonitorResourceListResponse) (result MonitorResourceListResponse, err error) { - req, err := lastResults.monitorResourceListResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client MonitorsClient) ListComplete(ctx context.Context) (result MonitorResourceListResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListAPIKeys sends the list api keys request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -func (client MonitorsClient) ListAPIKeys(ctx context.Context, resourceGroupName string, monitorName string) (result APIKeyListResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListAPIKeys") - defer func() { - sc := -1 - if result.aklr.Response.Response != nil { - sc = result.aklr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.MonitorsClient", "ListAPIKeys", err.Error()) - } - - result.fn = client.listAPIKeysNextResults - req, err := client.ListAPIKeysPreparer(ctx, resourceGroupName, monitorName) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListAPIKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListAPIKeysSender(req) - if err != nil { - result.aklr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListAPIKeys", resp, "Failure sending request") - return - } - - result.aklr, err = client.ListAPIKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListAPIKeys", resp, "Failure responding to request") - return - } - if result.aklr.hasNextLink() && result.aklr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAPIKeysPreparer prepares the ListAPIKeys request. -func (client MonitorsClient) ListAPIKeysPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAPIKeysSender sends the ListAPIKeys request. The method will close the -// http.Response Body if it receives an error. -func (client MonitorsClient) ListAPIKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAPIKeysResponder handles the response to the ListAPIKeys request. The method always -// closes the http.Response Body. -func (client MonitorsClient) ListAPIKeysResponder(resp *http.Response) (result APIKeyListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAPIKeysNextResults retrieves the next set of results, if any. -func (client MonitorsClient) listAPIKeysNextResults(ctx context.Context, lastResults APIKeyListResponse) (result APIKeyListResponse, err error) { - req, err := lastResults.aPIKeyListResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listAPIKeysNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAPIKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listAPIKeysNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAPIKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listAPIKeysNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAPIKeysComplete enumerates all values, automatically crossing page boundaries as required. -func (client MonitorsClient) ListAPIKeysComplete(ctx context.Context, resourceGroupName string, monitorName string) (result APIKeyListResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListAPIKeys") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAPIKeys(ctx, resourceGroupName, monitorName) - return -} - -// ListByResourceGroup sends the list by resource group request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client MonitorsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MonitorResourceListResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.mrlr.Response.Response != nil { - sc = result.mrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.MonitorsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.mrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.mrlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.mrlr.hasNextLink() && result.mrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client MonitorsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client MonitorsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client MonitorsClient) ListByResourceGroupResponder(resp *http.Response) (result MonitorResourceListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client MonitorsClient) listByResourceGroupNextResults(ctx context.Context, lastResults MonitorResourceListResponse) (result MonitorResourceListResponse, err error) { - req, err := lastResults.monitorResourceListResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client MonitorsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result MonitorResourceListResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListHosts sends the list hosts request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -func (client MonitorsClient) ListHosts(ctx context.Context, resourceGroupName string, monitorName string) (result HostListResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListHosts") - defer func() { - sc := -1 - if result.hlr.Response.Response != nil { - sc = result.hlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.MonitorsClient", "ListHosts", err.Error()) - } - - result.fn = client.listHostsNextResults - req, err := client.ListHostsPreparer(ctx, resourceGroupName, monitorName) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListHosts", nil, "Failure preparing request") - return - } - - resp, err := client.ListHostsSender(req) - if err != nil { - result.hlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListHosts", resp, "Failure sending request") - return - } - - result.hlr, err = client.ListHostsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListHosts", resp, "Failure responding to request") - return - } - if result.hlr.hasNextLink() && result.hlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListHostsPreparer prepares the ListHosts request. -func (client MonitorsClient) ListHostsPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListHostsSender sends the ListHosts request. The method will close the -// http.Response Body if it receives an error. -func (client MonitorsClient) ListHostsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListHostsResponder handles the response to the ListHosts request. The method always -// closes the http.Response Body. -func (client MonitorsClient) ListHostsResponder(resp *http.Response) (result HostListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listHostsNextResults retrieves the next set of results, if any. -func (client MonitorsClient) listHostsNextResults(ctx context.Context, lastResults HostListResponse) (result HostListResponse, err error) { - req, err := lastResults.hostListResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listHostsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListHostsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listHostsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListHostsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listHostsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListHostsComplete enumerates all values, automatically crossing page boundaries as required. -func (client MonitorsClient) ListHostsComplete(ctx context.Context, resourceGroupName string, monitorName string) (result HostListResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListHosts") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListHosts(ctx, resourceGroupName, monitorName) - return -} - -// ListLinkedResources sends the list linked resources request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -func (client MonitorsClient) ListLinkedResources(ctx context.Context, resourceGroupName string, monitorName string) (result LinkedResourceListResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListLinkedResources") - defer func() { - sc := -1 - if result.lrlr.Response.Response != nil { - sc = result.lrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.MonitorsClient", "ListLinkedResources", err.Error()) - } - - result.fn = client.listLinkedResourcesNextResults - req, err := client.ListLinkedResourcesPreparer(ctx, resourceGroupName, monitorName) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListLinkedResources", nil, "Failure preparing request") - return - } - - resp, err := client.ListLinkedResourcesSender(req) - if err != nil { - result.lrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListLinkedResources", resp, "Failure sending request") - return - } - - result.lrlr, err = client.ListLinkedResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListLinkedResources", resp, "Failure responding to request") - return - } - if result.lrlr.hasNextLink() && result.lrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListLinkedResourcesPreparer prepares the ListLinkedResources request. -func (client MonitorsClient) ListLinkedResourcesPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListLinkedResourcesSender sends the ListLinkedResources request. The method will close the -// http.Response Body if it receives an error. -func (client MonitorsClient) ListLinkedResourcesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListLinkedResourcesResponder handles the response to the ListLinkedResources request. The method always -// closes the http.Response Body. -func (client MonitorsClient) ListLinkedResourcesResponder(resp *http.Response) (result LinkedResourceListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listLinkedResourcesNextResults retrieves the next set of results, if any. -func (client MonitorsClient) listLinkedResourcesNextResults(ctx context.Context, lastResults LinkedResourceListResponse) (result LinkedResourceListResponse, err error) { - req, err := lastResults.linkedResourceListResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listLinkedResourcesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListLinkedResourcesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listLinkedResourcesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListLinkedResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listLinkedResourcesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListLinkedResourcesComplete enumerates all values, automatically crossing page boundaries as required. -func (client MonitorsClient) ListLinkedResourcesComplete(ctx context.Context, resourceGroupName string, monitorName string) (result LinkedResourceListResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListLinkedResources") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListLinkedResources(ctx, resourceGroupName, monitorName) - return -} - -// ListMonitoredResources sends the list monitored resources request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -func (client MonitorsClient) ListMonitoredResources(ctx context.Context, resourceGroupName string, monitorName string) (result MonitoredResourceListResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListMonitoredResources") - defer func() { - sc := -1 - if result.mrlr.Response.Response != nil { - sc = result.mrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.MonitorsClient", "ListMonitoredResources", err.Error()) - } - - result.fn = client.listMonitoredResourcesNextResults - req, err := client.ListMonitoredResourcesPreparer(ctx, resourceGroupName, monitorName) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListMonitoredResources", nil, "Failure preparing request") - return - } - - resp, err := client.ListMonitoredResourcesSender(req) - if err != nil { - result.mrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListMonitoredResources", resp, "Failure sending request") - return - } - - result.mrlr, err = client.ListMonitoredResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListMonitoredResources", resp, "Failure responding to request") - return - } - if result.mrlr.hasNextLink() && result.mrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListMonitoredResourcesPreparer prepares the ListMonitoredResources request. -func (client MonitorsClient) ListMonitoredResourcesPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMonitoredResourcesSender sends the ListMonitoredResources request. The method will close the -// http.Response Body if it receives an error. -func (client MonitorsClient) ListMonitoredResourcesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListMonitoredResourcesResponder handles the response to the ListMonitoredResources request. The method always -// closes the http.Response Body. -func (client MonitorsClient) ListMonitoredResourcesResponder(resp *http.Response) (result MonitoredResourceListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listMonitoredResourcesNextResults retrieves the next set of results, if any. -func (client MonitorsClient) listMonitoredResourcesNextResults(ctx context.Context, lastResults MonitoredResourceListResponse) (result MonitoredResourceListResponse, err error) { - req, err := lastResults.monitoredResourceListResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listMonitoredResourcesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListMonitoredResourcesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listMonitoredResourcesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListMonitoredResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listMonitoredResourcesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListMonitoredResourcesComplete enumerates all values, automatically crossing page boundaries as required. -func (client MonitorsClient) ListMonitoredResourcesComplete(ctx context.Context, resourceGroupName string, monitorName string) (result MonitoredResourceListResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListMonitoredResources") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListMonitoredResources(ctx, resourceGroupName, monitorName) - return -} - -// RefreshSetPasswordLink sends the refresh set password link request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -func (client MonitorsClient) RefreshSetPasswordLink(ctx context.Context, resourceGroupName string, monitorName string) (result SetPasswordLink, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.RefreshSetPasswordLink") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.MonitorsClient", "RefreshSetPasswordLink", err.Error()) - } - - req, err := client.RefreshSetPasswordLinkPreparer(ctx, resourceGroupName, monitorName) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "RefreshSetPasswordLink", nil, "Failure preparing request") - return - } - - resp, err := client.RefreshSetPasswordLinkSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "RefreshSetPasswordLink", resp, "Failure sending request") - return - } - - result, err = client.RefreshSetPasswordLinkResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "RefreshSetPasswordLink", resp, "Failure responding to request") - return - } - - return -} - -// RefreshSetPasswordLinkPreparer prepares the RefreshSetPasswordLink request. -func (client MonitorsClient) RefreshSetPasswordLinkPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RefreshSetPasswordLinkSender sends the RefreshSetPasswordLink request. The method will close the -// http.Response Body if it receives an error. -func (client MonitorsClient) RefreshSetPasswordLinkSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RefreshSetPasswordLinkResponder handles the response to the RefreshSetPasswordLink request. The method always -// closes the http.Response Body. -func (client MonitorsClient) RefreshSetPasswordLinkResponder(resp *http.Response) (result SetPasswordLink, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SetDefaultKey sends the set default key request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -func (client MonitorsClient) SetDefaultKey(ctx context.Context, resourceGroupName string, monitorName string, body *APIKey) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.SetDefaultKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.Key", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("datadog.MonitorsClient", "SetDefaultKey", err.Error()) - } - - req, err := client.SetDefaultKeyPreparer(ctx, resourceGroupName, monitorName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "SetDefaultKey", nil, "Failure preparing request") - return - } - - resp, err := client.SetDefaultKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "SetDefaultKey", resp, "Failure sending request") - return - } - - result, err = client.SetDefaultKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "SetDefaultKey", resp, "Failure responding to request") - return - } - - return -} - -// SetDefaultKeyPreparer prepares the SetDefaultKey request. -func (client MonitorsClient) SetDefaultKeyPreparer(ctx context.Context, resourceGroupName string, monitorName string, body *APIKey) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SetDefaultKeySender sends the SetDefaultKey request. The method will close the -// http.Response Body if it receives an error. -func (client MonitorsClient) SetDefaultKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SetDefaultKeyResponder handles the response to the SetDefaultKey request. The method always -// closes the http.Response Body. -func (client MonitorsClient) SetDefaultKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update sends the update request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -func (client MonitorsClient) Update(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResourceUpdateParameters) (result MonitorsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.MonitorsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, monitorName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client MonitorsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResourceUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client MonitorsClient) UpdateSender(req *http.Request) (future MonitorsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client MonitorsClient) UpdateResponder(resp *http.Response) (result MonitorResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/operations.go deleted file mode 100644 index b55ea967799d..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package datadog - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the client for the Operations methods of the Datadog service. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List sends the list request. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Datadog/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datadog.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datadog.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/singlesignonconfigurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/singlesignonconfigurations.go deleted file mode 100644 index e660f292e3f9..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/singlesignonconfigurations.go +++ /dev/null @@ -1,349 +0,0 @@ -package datadog - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SingleSignOnConfigurationsClient is the client for the SingleSignOnConfigurations methods of the Datadog service. -type SingleSignOnConfigurationsClient struct { - BaseClient -} - -// NewSingleSignOnConfigurationsClient creates an instance of the SingleSignOnConfigurationsClient client. -func NewSingleSignOnConfigurationsClient(subscriptionID string) SingleSignOnConfigurationsClient { - return NewSingleSignOnConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSingleSignOnConfigurationsClientWithBaseURI creates an instance of the SingleSignOnConfigurationsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewSingleSignOnConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SingleSignOnConfigurationsClient { - return SingleSignOnConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate sends the create or update request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -// configurationName - configuration name -func (client SingleSignOnConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, configurationName string, body *SingleSignOnResource) (result SingleSignOnConfigurationsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnConfigurationsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.SingleSignOnConfigurationsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, monitorName, configurationName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SingleSignOnConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, configurationName string, body *SingleSignOnResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", configurationName), - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SingleSignOnConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future SingleSignOnConfigurationsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SingleSignOnConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result SingleSignOnResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get sends the get request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -// configurationName - configuration name -func (client SingleSignOnConfigurationsClient) Get(ctx context.Context, resourceGroupName string, monitorName string, configurationName string) (result SingleSignOnResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnConfigurationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.SingleSignOnConfigurationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, monitorName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SingleSignOnConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, monitorName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", configurationName), - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SingleSignOnConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SingleSignOnConfigurationsClient) GetResponder(resp *http.Response) (result SingleSignOnResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List sends the list request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -func (client SingleSignOnConfigurationsClient) List(ctx context.Context, resourceGroupName string, monitorName string) (result SingleSignOnResourceListResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnConfigurationsClient.List") - defer func() { - sc := -1 - if result.ssorlr.Response.Response != nil { - sc = result.ssorlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.SingleSignOnConfigurationsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, monitorName) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.ssorlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "List", resp, "Failure sending request") - return - } - - result.ssorlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "List", resp, "Failure responding to request") - return - } - if result.ssorlr.hasNextLink() && result.ssorlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SingleSignOnConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SingleSignOnConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SingleSignOnConfigurationsClient) ListResponder(resp *http.Response) (result SingleSignOnResourceListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client SingleSignOnConfigurationsClient) listNextResults(ctx context.Context, lastResults SingleSignOnResourceListResponse) (result SingleSignOnResourceListResponse, err error) { - req, err := lastResults.singleSignOnResourceListResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SingleSignOnConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result SingleSignOnResourceListResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnConfigurationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, monitorName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/tagrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/tagrules.go deleted file mode 100644 index 475a400f790b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/tagrules.go +++ /dev/null @@ -1,345 +0,0 @@ -package datadog - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// TagRulesClient is the client for the TagRules methods of the Datadog service. -type TagRulesClient struct { - BaseClient -} - -// NewTagRulesClient creates an instance of the TagRulesClient client. -func NewTagRulesClient(subscriptionID string) TagRulesClient { - return NewTagRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTagRulesClientWithBaseURI creates an instance of the TagRulesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewTagRulesClientWithBaseURI(baseURI string, subscriptionID string) TagRulesClient { - return TagRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate sends the create or update request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -// ruleSetName - rule set name -func (client TagRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, body *MonitoringTagRules) (result MonitoringTagRules, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.TagRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, monitorName, ruleSetName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TagRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, body *MonitoringTagRules) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleSetName": autorest.Encode("path", ruleSetName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.Name = nil - body.ID = nil - body.Type = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client TagRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client TagRulesClient) CreateOrUpdateResponder(resp *http.Response) (result MonitoringTagRules, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get sends the get request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -// ruleSetName - rule set name -func (client TagRulesClient) Get(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (result MonitoringTagRules, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.TagRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, monitorName, ruleSetName) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TagRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleSetName": autorest.Encode("path", ruleSetName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TagRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TagRulesClient) GetResponder(resp *http.Response) (result MonitoringTagRules, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List sends the list request. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// monitorName - monitor resource name -func (client TagRulesClient) List(ctx context.Context, resourceGroupName string, monitorName string) (result MonitoringTagRulesListResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.List") - defer func() { - sc := -1 - if result.mtrlr.Response.Response != nil { - sc = result.mtrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("datadog.TagRulesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, monitorName) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.mtrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "List", resp, "Failure sending request") - return - } - - result.mtrlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "List", resp, "Failure responding to request") - return - } - if result.mtrlr.hasNextLink() && result.mtrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TagRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "monitorName": autorest.Encode("path", monitorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client TagRulesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client TagRulesClient) ListResponder(resp *http.Response) (result MonitoringTagRulesListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client TagRulesClient) listNextResults(ctx context.Context, lastResults MonitoringTagRulesListResponse) (result MonitoringTagRulesListResponse, err error) { - req, err := lastResults.monitoringTagRulesListResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datadog.TagRulesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datadog.TagRulesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TagRulesClient) ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result MonitoringTagRulesListResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, monitorName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/version.go deleted file mode 100644 index c14364a08c38..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package datadog - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " datadog/2021-03-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/_meta.json deleted file mode 100644 index 4c7c423f5d09..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/datamigration/resource-manager/readme.md", - "tag": "package-2018-04-19", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2018-04-19 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/datamigration/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/client.go deleted file mode 100644 index 8e446cae46da..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/datamigration/armdatamigration](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/datamigration/armdatamigration). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package datamigration implements the Azure ARM Datamigration service API version 2018-04-19. -// -// Data Migration Client -package datamigration - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Datamigration - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Datamigration. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/enums.go deleted file mode 100644 index 35bc61c7d64a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/enums.go +++ /dev/null @@ -1,1047 +0,0 @@ -package datamigration - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AuthenticationType enumerates the values for authentication type. -type AuthenticationType string - -const ( - // ActiveDirectoryIntegrated ... - ActiveDirectoryIntegrated AuthenticationType = "ActiveDirectoryIntegrated" - // ActiveDirectoryPassword ... - ActiveDirectoryPassword AuthenticationType = "ActiveDirectoryPassword" - // None ... - None AuthenticationType = "None" - // SQLAuthentication ... - SQLAuthentication AuthenticationType = "SqlAuthentication" - // WindowsAuthentication ... - WindowsAuthentication AuthenticationType = "WindowsAuthentication" -) - -// PossibleAuthenticationTypeValues returns an array of possible values for the AuthenticationType const type. -func PossibleAuthenticationTypeValues() []AuthenticationType { - return []AuthenticationType{ActiveDirectoryIntegrated, ActiveDirectoryPassword, None, SQLAuthentication, WindowsAuthentication} -} - -// BackupFileStatus enumerates the values for backup file status. -type BackupFileStatus string - -const ( - // Arrived ... - Arrived BackupFileStatus = "Arrived" - // Cancelled ... - Cancelled BackupFileStatus = "Cancelled" - // Queued ... - Queued BackupFileStatus = "Queued" - // Restored ... - Restored BackupFileStatus = "Restored" - // Restoring ... - Restoring BackupFileStatus = "Restoring" - // Uploaded ... - Uploaded BackupFileStatus = "Uploaded" - // Uploading ... - Uploading BackupFileStatus = "Uploading" -) - -// PossibleBackupFileStatusValues returns an array of possible values for the BackupFileStatus const type. -func PossibleBackupFileStatusValues() []BackupFileStatus { - return []BackupFileStatus{Arrived, Cancelled, Queued, Restored, Restoring, Uploaded, Uploading} -} - -// BackupMode enumerates the values for backup mode. -type BackupMode string - -const ( - // CreateBackup ... - CreateBackup BackupMode = "CreateBackup" - // ExistingBackup ... - ExistingBackup BackupMode = "ExistingBackup" -) - -// PossibleBackupModeValues returns an array of possible values for the BackupMode const type. -func PossibleBackupModeValues() []BackupMode { - return []BackupMode{CreateBackup, ExistingBackup} -} - -// BackupType enumerates the values for backup type. -type BackupType string - -const ( - // BackupTypeDatabase ... - BackupTypeDatabase BackupType = "Database" - // BackupTypeDifferentialDatabase ... - BackupTypeDifferentialDatabase BackupType = "DifferentialDatabase" - // BackupTypeDifferentialFile ... - BackupTypeDifferentialFile BackupType = "DifferentialFile" - // BackupTypeDifferentialPartial ... - BackupTypeDifferentialPartial BackupType = "DifferentialPartial" - // BackupTypeFile ... - BackupTypeFile BackupType = "File" - // BackupTypePartial ... - BackupTypePartial BackupType = "Partial" - // BackupTypeTransactionLog ... - BackupTypeTransactionLog BackupType = "TransactionLog" -) - -// PossibleBackupTypeValues returns an array of possible values for the BackupType const type. -func PossibleBackupTypeValues() []BackupType { - return []BackupType{BackupTypeDatabase, BackupTypeDifferentialDatabase, BackupTypeDifferentialFile, BackupTypeDifferentialPartial, BackupTypeFile, BackupTypePartial, BackupTypeTransactionLog} -} - -// CommandState enumerates the values for command state. -type CommandState string - -const ( - // Accepted ... - Accepted CommandState = "Accepted" - // Failed ... - Failed CommandState = "Failed" - // Running ... - Running CommandState = "Running" - // Succeeded ... - Succeeded CommandState = "Succeeded" - // Unknown ... - Unknown CommandState = "Unknown" -) - -// PossibleCommandStateValues returns an array of possible values for the CommandState const type. -func PossibleCommandStateValues() []CommandState { - return []CommandState{Accepted, Failed, Running, Succeeded, Unknown} -} - -// CommandType enumerates the values for command type. -type CommandType string - -const ( - // CommandTypeCommandProperties ... - CommandTypeCommandProperties CommandType = "CommandProperties" - // CommandTypeMigrateSQLServerAzureDbSQLMiComplete ... - CommandTypeMigrateSQLServerAzureDbSQLMiComplete CommandType = "Migrate.SqlServer.AzureDbSqlMi.Complete" - // CommandTypeMigrateSyncCompleteDatabase ... - CommandTypeMigrateSyncCompleteDatabase CommandType = "Migrate.Sync.Complete.Database" -) - -// PossibleCommandTypeValues returns an array of possible values for the CommandType const type. -func PossibleCommandTypeValues() []CommandType { - return []CommandType{CommandTypeCommandProperties, CommandTypeMigrateSQLServerAzureDbSQLMiComplete, CommandTypeMigrateSyncCompleteDatabase} -} - -// DatabaseCompatLevel enumerates the values for database compat level. -type DatabaseCompatLevel string - -const ( - // CompatLevel100 ... - CompatLevel100 DatabaseCompatLevel = "CompatLevel100" - // CompatLevel110 ... - CompatLevel110 DatabaseCompatLevel = "CompatLevel110" - // CompatLevel120 ... - CompatLevel120 DatabaseCompatLevel = "CompatLevel120" - // CompatLevel130 ... - CompatLevel130 DatabaseCompatLevel = "CompatLevel130" - // CompatLevel140 ... - CompatLevel140 DatabaseCompatLevel = "CompatLevel140" - // CompatLevel80 ... - CompatLevel80 DatabaseCompatLevel = "CompatLevel80" - // CompatLevel90 ... - CompatLevel90 DatabaseCompatLevel = "CompatLevel90" -) - -// PossibleDatabaseCompatLevelValues returns an array of possible values for the DatabaseCompatLevel const type. -func PossibleDatabaseCompatLevelValues() []DatabaseCompatLevel { - return []DatabaseCompatLevel{CompatLevel100, CompatLevel110, CompatLevel120, CompatLevel130, CompatLevel140, CompatLevel80, CompatLevel90} -} - -// DatabaseFileType enumerates the values for database file type. -type DatabaseFileType string - -const ( - // Filestream ... - Filestream DatabaseFileType = "Filestream" - // Fulltext ... - Fulltext DatabaseFileType = "Fulltext" - // Log ... - Log DatabaseFileType = "Log" - // NotSupported ... - NotSupported DatabaseFileType = "NotSupported" - // Rows ... - Rows DatabaseFileType = "Rows" -) - -// PossibleDatabaseFileTypeValues returns an array of possible values for the DatabaseFileType const type. -func PossibleDatabaseFileTypeValues() []DatabaseFileType { - return []DatabaseFileType{Filestream, Fulltext, Log, NotSupported, Rows} -} - -// DatabaseMigrationStage enumerates the values for database migration stage. -type DatabaseMigrationStage string - -const ( - // DatabaseMigrationStageBackup ... - DatabaseMigrationStageBackup DatabaseMigrationStage = "Backup" - // DatabaseMigrationStageCompleted ... - DatabaseMigrationStageCompleted DatabaseMigrationStage = "Completed" - // DatabaseMigrationStageFileCopy ... - DatabaseMigrationStageFileCopy DatabaseMigrationStage = "FileCopy" - // DatabaseMigrationStageInitialize ... - DatabaseMigrationStageInitialize DatabaseMigrationStage = "Initialize" - // DatabaseMigrationStageNone ... - DatabaseMigrationStageNone DatabaseMigrationStage = "None" - // DatabaseMigrationStageRestore ... - DatabaseMigrationStageRestore DatabaseMigrationStage = "Restore" -) - -// PossibleDatabaseMigrationStageValues returns an array of possible values for the DatabaseMigrationStage const type. -func PossibleDatabaseMigrationStageValues() []DatabaseMigrationStage { - return []DatabaseMigrationStage{DatabaseMigrationStageBackup, DatabaseMigrationStageCompleted, DatabaseMigrationStageFileCopy, DatabaseMigrationStageInitialize, DatabaseMigrationStageNone, DatabaseMigrationStageRestore} -} - -// DatabaseMigrationState enumerates the values for database migration state. -type DatabaseMigrationState string - -const ( - // CANCELLED ... - CANCELLED DatabaseMigrationState = "CANCELLED" - // COMPLETED ... - COMPLETED DatabaseMigrationState = "COMPLETED" - // CUTOVERSTART ... - CUTOVERSTART DatabaseMigrationState = "CUTOVER_START" - // FAILED ... - FAILED DatabaseMigrationState = "FAILED" - // FULLBACKUPUPLOADSTART ... - FULLBACKUPUPLOADSTART DatabaseMigrationState = "FULL_BACKUP_UPLOAD_START" - // INITIAL ... - INITIAL DatabaseMigrationState = "INITIAL" - // LOGSHIPPINGSTART ... - LOGSHIPPINGSTART DatabaseMigrationState = "LOG_SHIPPING_START" - // POSTCUTOVERCOMPLETE ... - POSTCUTOVERCOMPLETE DatabaseMigrationState = "POST_CUTOVER_COMPLETE" - // UNDEFINED ... - UNDEFINED DatabaseMigrationState = "UNDEFINED" - // UPLOADLOGFILESSTART ... - UPLOADLOGFILESSTART DatabaseMigrationState = "UPLOAD_LOG_FILES_START" -) - -// PossibleDatabaseMigrationStateValues returns an array of possible values for the DatabaseMigrationState const type. -func PossibleDatabaseMigrationStateValues() []DatabaseMigrationState { - return []DatabaseMigrationState{CANCELLED, COMPLETED, CUTOVERSTART, FAILED, FULLBACKUPUPLOADSTART, INITIAL, LOGSHIPPINGSTART, POSTCUTOVERCOMPLETE, UNDEFINED, UPLOADLOGFILESSTART} -} - -// DatabaseState enumerates the values for database state. -type DatabaseState string - -const ( - // DatabaseStateCopying ... - DatabaseStateCopying DatabaseState = "Copying" - // DatabaseStateEmergency ... - DatabaseStateEmergency DatabaseState = "Emergency" - // DatabaseStateOffline ... - DatabaseStateOffline DatabaseState = "Offline" - // DatabaseStateOfflineSecondary ... - DatabaseStateOfflineSecondary DatabaseState = "OfflineSecondary" - // DatabaseStateOnline ... - DatabaseStateOnline DatabaseState = "Online" - // DatabaseStateRecovering ... - DatabaseStateRecovering DatabaseState = "Recovering" - // DatabaseStateRecoveryPending ... - DatabaseStateRecoveryPending DatabaseState = "RecoveryPending" - // DatabaseStateRestoring ... - DatabaseStateRestoring DatabaseState = "Restoring" - // DatabaseStateSuspect ... - DatabaseStateSuspect DatabaseState = "Suspect" -) - -// PossibleDatabaseStateValues returns an array of possible values for the DatabaseState const type. -func PossibleDatabaseStateValues() []DatabaseState { - return []DatabaseState{DatabaseStateCopying, DatabaseStateEmergency, DatabaseStateOffline, DatabaseStateOfflineSecondary, DatabaseStateOnline, DatabaseStateRecovering, DatabaseStateRecoveryPending, DatabaseStateRestoring, DatabaseStateSuspect} -} - -// ErrorType enumerates the values for error type. -type ErrorType string - -const ( - // ErrorTypeDefault ... - ErrorTypeDefault ErrorType = "Default" - // ErrorTypeError ... - ErrorTypeError ErrorType = "Error" - // ErrorTypeWarning ... - ErrorTypeWarning ErrorType = "Warning" -) - -// PossibleErrorTypeValues returns an array of possible values for the ErrorType const type. -func PossibleErrorTypeValues() []ErrorType { - return []ErrorType{ErrorTypeDefault, ErrorTypeError, ErrorTypeWarning} -} - -// LoginMigrationStage enumerates the values for login migration stage. -type LoginMigrationStage string - -const ( - // LoginMigrationStageAssignRoleMembership ... - LoginMigrationStageAssignRoleMembership LoginMigrationStage = "AssignRoleMembership" - // LoginMigrationStageAssignRoleOwnership ... - LoginMigrationStageAssignRoleOwnership LoginMigrationStage = "AssignRoleOwnership" - // LoginMigrationStageCompleted ... - LoginMigrationStageCompleted LoginMigrationStage = "Completed" - // LoginMigrationStageEstablishObjectPermissions ... - LoginMigrationStageEstablishObjectPermissions LoginMigrationStage = "EstablishObjectPermissions" - // LoginMigrationStageEstablishServerPermissions ... - LoginMigrationStageEstablishServerPermissions LoginMigrationStage = "EstablishServerPermissions" - // LoginMigrationStageEstablishUserMapping ... - LoginMigrationStageEstablishUserMapping LoginMigrationStage = "EstablishUserMapping" - // LoginMigrationStageInitialize ... - LoginMigrationStageInitialize LoginMigrationStage = "Initialize" - // LoginMigrationStageLoginMigration ... - LoginMigrationStageLoginMigration LoginMigrationStage = "LoginMigration" - // LoginMigrationStageNone ... - LoginMigrationStageNone LoginMigrationStage = "None" -) - -// PossibleLoginMigrationStageValues returns an array of possible values for the LoginMigrationStage const type. -func PossibleLoginMigrationStageValues() []LoginMigrationStage { - return []LoginMigrationStage{LoginMigrationStageAssignRoleMembership, LoginMigrationStageAssignRoleOwnership, LoginMigrationStageCompleted, LoginMigrationStageEstablishObjectPermissions, LoginMigrationStageEstablishServerPermissions, LoginMigrationStageEstablishUserMapping, LoginMigrationStageInitialize, LoginMigrationStageLoginMigration, LoginMigrationStageNone} -} - -// LoginType enumerates the values for login type. -type LoginType string - -const ( - // AsymmetricKey ... - AsymmetricKey LoginType = "AsymmetricKey" - // Certificate ... - Certificate LoginType = "Certificate" - // ExternalGroup ... - ExternalGroup LoginType = "ExternalGroup" - // ExternalUser ... - ExternalUser LoginType = "ExternalUser" - // SQLLogin ... - SQLLogin LoginType = "SqlLogin" - // WindowsGroup ... - WindowsGroup LoginType = "WindowsGroup" - // WindowsUser ... - WindowsUser LoginType = "WindowsUser" -) - -// PossibleLoginTypeValues returns an array of possible values for the LoginType const type. -func PossibleLoginTypeValues() []LoginType { - return []LoginType{AsymmetricKey, Certificate, ExternalGroup, ExternalUser, SQLLogin, WindowsGroup, WindowsUser} -} - -// MigrationState enumerates the values for migration state. -type MigrationState string - -const ( - // MigrationStateCompleted ... - MigrationStateCompleted MigrationState = "Completed" - // MigrationStateFailed ... - MigrationStateFailed MigrationState = "Failed" - // MigrationStateInProgress ... - MigrationStateInProgress MigrationState = "InProgress" - // MigrationStateNone ... - MigrationStateNone MigrationState = "None" - // MigrationStateSkipped ... - MigrationStateSkipped MigrationState = "Skipped" - // MigrationStateStopped ... - MigrationStateStopped MigrationState = "Stopped" - // MigrationStateWarning ... - MigrationStateWarning MigrationState = "Warning" -) - -// PossibleMigrationStateValues returns an array of possible values for the MigrationState const type. -func PossibleMigrationStateValues() []MigrationState { - return []MigrationState{MigrationStateCompleted, MigrationStateFailed, MigrationStateInProgress, MigrationStateNone, MigrationStateSkipped, MigrationStateStopped, MigrationStateWarning} -} - -// MigrationStatus enumerates the values for migration status. -type MigrationStatus string - -const ( - // MigrationStatusCompleted ... - MigrationStatusCompleted MigrationStatus = "Completed" - // MigrationStatusCompletedWithWarnings ... - MigrationStatusCompletedWithWarnings MigrationStatus = "CompletedWithWarnings" - // MigrationStatusConfigured ... - MigrationStatusConfigured MigrationStatus = "Configured" - // MigrationStatusConnecting ... - MigrationStatusConnecting MigrationStatus = "Connecting" - // MigrationStatusDefault ... - MigrationStatusDefault MigrationStatus = "Default" - // MigrationStatusError ... - MigrationStatusError MigrationStatus = "Error" - // MigrationStatusRunning ... - MigrationStatusRunning MigrationStatus = "Running" - // MigrationStatusSelectLogins ... - MigrationStatusSelectLogins MigrationStatus = "SelectLogins" - // MigrationStatusSourceAndTargetSelected ... - MigrationStatusSourceAndTargetSelected MigrationStatus = "SourceAndTargetSelected" - // MigrationStatusStopped ... - MigrationStatusStopped MigrationStatus = "Stopped" -) - -// PossibleMigrationStatusValues returns an array of possible values for the MigrationStatus const type. -func PossibleMigrationStatusValues() []MigrationStatus { - return []MigrationStatus{MigrationStatusCompleted, MigrationStatusCompletedWithWarnings, MigrationStatusConfigured, MigrationStatusConnecting, MigrationStatusDefault, MigrationStatusError, MigrationStatusRunning, MigrationStatusSelectLogins, MigrationStatusSourceAndTargetSelected, MigrationStatusStopped} -} - -// MySQLTargetPlatformType enumerates the values for my sql target platform type. -type MySQLTargetPlatformType string - -const ( - // AzureDbForMySQL ... - AzureDbForMySQL MySQLTargetPlatformType = "AzureDbForMySQL" - // SQLServer ... - SQLServer MySQLTargetPlatformType = "SqlServer" -) - -// PossibleMySQLTargetPlatformTypeValues returns an array of possible values for the MySQLTargetPlatformType const type. -func PossibleMySQLTargetPlatformTypeValues() []MySQLTargetPlatformType { - return []MySQLTargetPlatformType{AzureDbForMySQL, SQLServer} -} - -// NameCheckFailureReason enumerates the values for name check failure reason. -type NameCheckFailureReason string - -const ( - // AlreadyExists ... - AlreadyExists NameCheckFailureReason = "AlreadyExists" - // Invalid ... - Invalid NameCheckFailureReason = "Invalid" -) - -// PossibleNameCheckFailureReasonValues returns an array of possible values for the NameCheckFailureReason const type. -func PossibleNameCheckFailureReasonValues() []NameCheckFailureReason { - return []NameCheckFailureReason{AlreadyExists, Invalid} -} - -// ObjectType enumerates the values for object type. -type ObjectType string - -const ( - // Function ... - Function ObjectType = "Function" - // StoredProcedures ... - StoredProcedures ObjectType = "StoredProcedures" - // Table ... - Table ObjectType = "Table" - // User ... - User ObjectType = "User" - // View ... - View ObjectType = "View" -) - -// PossibleObjectTypeValues returns an array of possible values for the ObjectType const type. -func PossibleObjectTypeValues() []ObjectType { - return []ObjectType{Function, StoredProcedures, Table, User, View} -} - -// ProjectProvisioningState enumerates the values for project provisioning state. -type ProjectProvisioningState string - -const ( - // ProjectProvisioningStateDeleting ... - ProjectProvisioningStateDeleting ProjectProvisioningState = "Deleting" - // ProjectProvisioningStateSucceeded ... - ProjectProvisioningStateSucceeded ProjectProvisioningState = "Succeeded" -) - -// PossibleProjectProvisioningStateValues returns an array of possible values for the ProjectProvisioningState const type. -func PossibleProjectProvisioningStateValues() []ProjectProvisioningState { - return []ProjectProvisioningState{ProjectProvisioningStateDeleting, ProjectProvisioningStateSucceeded} -} - -// ProjectSourcePlatform enumerates the values for project source platform. -type ProjectSourcePlatform string - -const ( - // ProjectSourcePlatformSQL ... - ProjectSourcePlatformSQL ProjectSourcePlatform = "SQL" - // ProjectSourcePlatformUnknown ... - ProjectSourcePlatformUnknown ProjectSourcePlatform = "Unknown" -) - -// PossibleProjectSourcePlatformValues returns an array of possible values for the ProjectSourcePlatform const type. -func PossibleProjectSourcePlatformValues() []ProjectSourcePlatform { - return []ProjectSourcePlatform{ProjectSourcePlatformSQL, ProjectSourcePlatformUnknown} -} - -// ProjectTargetPlatform enumerates the values for project target platform. -type ProjectTargetPlatform string - -const ( - // ProjectTargetPlatformSQLDB ... - ProjectTargetPlatformSQLDB ProjectTargetPlatform = "SQLDB" - // ProjectTargetPlatformUnknown ... - ProjectTargetPlatformUnknown ProjectTargetPlatform = "Unknown" -) - -// PossibleProjectTargetPlatformValues returns an array of possible values for the ProjectTargetPlatform const type. -func PossibleProjectTargetPlatformValues() []ProjectTargetPlatform { - return []ProjectTargetPlatform{ProjectTargetPlatformSQLDB, ProjectTargetPlatformUnknown} -} - -// ResourceSkuCapacityScaleType enumerates the values for resource sku capacity scale type. -type ResourceSkuCapacityScaleType string - -const ( - // ResourceSkuCapacityScaleTypeAutomatic ... - ResourceSkuCapacityScaleTypeAutomatic ResourceSkuCapacityScaleType = "Automatic" - // ResourceSkuCapacityScaleTypeManual ... - ResourceSkuCapacityScaleTypeManual ResourceSkuCapacityScaleType = "Manual" - // ResourceSkuCapacityScaleTypeNone ... - ResourceSkuCapacityScaleTypeNone ResourceSkuCapacityScaleType = "None" -) - -// PossibleResourceSkuCapacityScaleTypeValues returns an array of possible values for the ResourceSkuCapacityScaleType const type. -func PossibleResourceSkuCapacityScaleTypeValues() []ResourceSkuCapacityScaleType { - return []ResourceSkuCapacityScaleType{ResourceSkuCapacityScaleTypeAutomatic, ResourceSkuCapacityScaleTypeManual, ResourceSkuCapacityScaleTypeNone} -} - -// ResourceSkuRestrictionsReasonCode enumerates the values for resource sku restrictions reason code. -type ResourceSkuRestrictionsReasonCode string - -const ( - // NotAvailableForSubscription ... - NotAvailableForSubscription ResourceSkuRestrictionsReasonCode = "NotAvailableForSubscription" - // QuotaID ... - QuotaID ResourceSkuRestrictionsReasonCode = "QuotaId" -) - -// PossibleResourceSkuRestrictionsReasonCodeValues returns an array of possible values for the ResourceSkuRestrictionsReasonCode const type. -func PossibleResourceSkuRestrictionsReasonCodeValues() []ResourceSkuRestrictionsReasonCode { - return []ResourceSkuRestrictionsReasonCode{NotAvailableForSubscription, QuotaID} -} - -// ResourceSkuRestrictionsType enumerates the values for resource sku restrictions type. -type ResourceSkuRestrictionsType string - -const ( - // Location ... - Location ResourceSkuRestrictionsType = "location" -) - -// PossibleResourceSkuRestrictionsTypeValues returns an array of possible values for the ResourceSkuRestrictionsType const type. -func PossibleResourceSkuRestrictionsTypeValues() []ResourceSkuRestrictionsType { - return []ResourceSkuRestrictionsType{Location} -} - -// ResultCode enumerates the values for result code. -type ResultCode string - -const ( - // Completed ... - Completed ResultCode = "Completed" - // FatalError ... - FatalError ResultCode = "FatalError" - // Initial ... - Initial ResultCode = "Initial" - // ObjectNotExistsInSource ... - ObjectNotExistsInSource ResultCode = "ObjectNotExistsInSource" - // ObjectNotExistsInTarget ... - ObjectNotExistsInTarget ResultCode = "ObjectNotExistsInTarget" - // TargetObjectIsInaccessible ... - TargetObjectIsInaccessible ResultCode = "TargetObjectIsInaccessible" -) - -// PossibleResultCodeValues returns an array of possible values for the ResultCode const type. -func PossibleResultCodeValues() []ResultCode { - return []ResultCode{Completed, FatalError, Initial, ObjectNotExistsInSource, ObjectNotExistsInTarget, TargetObjectIsInaccessible} -} - -// ResultType enumerates the values for result type. -type ResultType string - -const ( - // ResultTypeDatabaseLevelErrorOutput ... - ResultTypeDatabaseLevelErrorOutput ResultType = "DatabaseLevelErrorOutput" - // ResultTypeDatabaseLevelOutput ... - ResultTypeDatabaseLevelOutput ResultType = "DatabaseLevelOutput" - // ResultTypeErrorOutput ... - ResultTypeErrorOutput ResultType = "ErrorOutput" - // ResultTypeMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput ... - ResultTypeMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput ResultType = "MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutput" - // ResultTypeMigrationLevelOutput ... - ResultTypeMigrationLevelOutput ResultType = "MigrationLevelOutput" - // ResultTypeTableLevelOutput ... - ResultTypeTableLevelOutput ResultType = "TableLevelOutput" -) - -// PossibleResultTypeValues returns an array of possible values for the ResultType const type. -func PossibleResultTypeValues() []ResultType { - return []ResultType{ResultTypeDatabaseLevelErrorOutput, ResultTypeDatabaseLevelOutput, ResultTypeErrorOutput, ResultTypeMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, ResultTypeMigrationLevelOutput, ResultTypeTableLevelOutput} -} - -// ResultTypeBasicConnectToSourceSQLServerTaskOutput enumerates the values for result type basic connect to -// source sql server task output. -type ResultTypeBasicConnectToSourceSQLServerTaskOutput string - -const ( - // ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput ... - ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput ResultTypeBasicConnectToSourceSQLServerTaskOutput = "AgentJobLevelOutput" - // ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput ... - ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput ResultTypeBasicConnectToSourceSQLServerTaskOutput = "ConnectToSourceSqlServerTaskOutput" - // ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput ... - ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput ResultTypeBasicConnectToSourceSQLServerTaskOutput = "DatabaseLevelOutput" - // ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput ... - ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput ResultTypeBasicConnectToSourceSQLServerTaskOutput = "LoginLevelOutput" - // ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput ... - ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput ResultTypeBasicConnectToSourceSQLServerTaskOutput = "TaskLevelOutput" -) - -// PossibleResultTypeBasicConnectToSourceSQLServerTaskOutputValues returns an array of possible values for the ResultTypeBasicConnectToSourceSQLServerTaskOutput const type. -func PossibleResultTypeBasicConnectToSourceSQLServerTaskOutputValues() []ResultTypeBasicConnectToSourceSQLServerTaskOutput { - return []ResultTypeBasicConnectToSourceSQLServerTaskOutput{ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput, ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput, ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput, ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput, ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput} -} - -// ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput enumerates the values for result type basic migrate -// my sql azure db for my sql sync task output. -type ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput string - -const ( - // ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelErrorOutput ... - ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelErrorOutput ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput = "DatabaseLevelErrorOutput" - // ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelOutput ... - ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelOutput ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput = "DatabaseLevelOutput" - // ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeErrorOutput ... - ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeErrorOutput ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput = "ErrorOutput" - // ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrateMySQLAzureDbForMySQLSyncTaskOutput ... - ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrateMySQLAzureDbForMySQLSyncTaskOutput ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput = "MigrateMySqlAzureDbForMySqlSyncTaskOutput" - // ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrationLevelOutput ... - ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrationLevelOutput ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput = "MigrationLevelOutput" - // ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeTableLevelOutput ... - ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeTableLevelOutput ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput = "TableLevelOutput" -) - -// PossibleResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputValues returns an array of possible values for the ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput const type. -func PossibleResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputValues() []ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput { - return []ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput{ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelErrorOutput, ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelOutput, ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeErrorOutput, ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrateMySQLAzureDbForMySQLSyncTaskOutput, ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrationLevelOutput, ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeTableLevelOutput} -} - -// ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput enumerates the values for result type basic migrate sql -// server sql db sync task output. -type ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput string - -const ( - // ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelErrorOutput ... - ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelErrorOutput ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput = "DatabaseLevelErrorOutput" - // ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelOutput ... - ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelOutput ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput = "DatabaseLevelOutput" - // ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeErrorOutput ... - ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeErrorOutput ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput = "ErrorOutput" - // ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrateSQLServerSQLDbSyncTaskOutput ... - ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrateSQLServerSQLDbSyncTaskOutput ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput = "MigrateSqlServerSqlDbSyncTaskOutput" - // ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrationLevelOutput ... - ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrationLevelOutput ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput = "MigrationLevelOutput" - // ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeTableLevelOutput ... - ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeTableLevelOutput ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput = "TableLevelOutput" -) - -// PossibleResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputValues returns an array of possible values for the ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput const type. -func PossibleResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputValues() []ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput { - return []ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput{ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelErrorOutput, ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelOutput, ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeErrorOutput, ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrateSQLServerSQLDbSyncTaskOutput, ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrationLevelOutput, ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeTableLevelOutput} -} - -// ResultTypeBasicMigrateSQLServerSQLDbTaskOutput enumerates the values for result type basic migrate sql -// server sql db task output. -type ResultTypeBasicMigrateSQLServerSQLDbTaskOutput string - -const ( - // ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeDatabaseLevelOutput ... - ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeDatabaseLevelOutput ResultTypeBasicMigrateSQLServerSQLDbTaskOutput = "DatabaseLevelOutput" - // ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeErrorOutput ... - ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeErrorOutput ResultTypeBasicMigrateSQLServerSQLDbTaskOutput = "ErrorOutput" - // ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrateSQLServerSQLDbTaskOutput ... - ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrateSQLServerSQLDbTaskOutput ResultTypeBasicMigrateSQLServerSQLDbTaskOutput = "MigrateSqlServerSqlDbTaskOutput" - // ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationDatabaseLevelValidationOutput ... - ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationDatabaseLevelValidationOutput ResultTypeBasicMigrateSQLServerSQLDbTaskOutput = "MigrationDatabaseLevelValidationOutput" - // ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationLevelOutput ... - ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationLevelOutput ResultTypeBasicMigrateSQLServerSQLDbTaskOutput = "MigrationLevelOutput" - // ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationValidationOutput ... - ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationValidationOutput ResultTypeBasicMigrateSQLServerSQLDbTaskOutput = "MigrationValidationOutput" - // ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeTableLevelOutput ... - ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeTableLevelOutput ResultTypeBasicMigrateSQLServerSQLDbTaskOutput = "TableLevelOutput" -) - -// PossibleResultTypeBasicMigrateSQLServerSQLDbTaskOutputValues returns an array of possible values for the ResultTypeBasicMigrateSQLServerSQLDbTaskOutput const type. -func PossibleResultTypeBasicMigrateSQLServerSQLDbTaskOutputValues() []ResultTypeBasicMigrateSQLServerSQLDbTaskOutput { - return []ResultTypeBasicMigrateSQLServerSQLDbTaskOutput{ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeDatabaseLevelOutput, ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeErrorOutput, ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrateSQLServerSQLDbTaskOutput, ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationDatabaseLevelValidationOutput, ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationLevelOutput, ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationValidationOutput, ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeTableLevelOutput} -} - -// ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutput enumerates the values for result type basic migrate sql -// server sqlmi sync task output. -type ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutput string - -const ( - // ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeDatabaseLevelOutput ... - ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeDatabaseLevelOutput ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutput = "DatabaseLevelOutput" - // ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeErrorOutput ... - ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeErrorOutput ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutput = "ErrorOutput" - // ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrateSQLServerSQLMISyncTaskOutput ... - ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrateSQLServerSQLMISyncTaskOutput ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutput = "MigrateSqlServerSqlMISyncTaskOutput" - // ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrationLevelOutput ... - ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrationLevelOutput ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutput = "MigrationLevelOutput" -) - -// PossibleResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputValues returns an array of possible values for the ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutput const type. -func PossibleResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputValues() []ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutput { - return []ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutput{ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeDatabaseLevelOutput, ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeErrorOutput, ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrateSQLServerSQLMISyncTaskOutput, ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrationLevelOutput} -} - -// ResultTypeBasicMigrateSQLServerSQLMITaskOutput enumerates the values for result type basic migrate sql -// server sqlmi task output. -type ResultTypeBasicMigrateSQLServerSQLMITaskOutput string - -const ( - // ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput ... - ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput ResultTypeBasicMigrateSQLServerSQLMITaskOutput = "AgentJobLevelOutput" - // ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput ... - ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput ResultTypeBasicMigrateSQLServerSQLMITaskOutput = "DatabaseLevelOutput" - // ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput ... - ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput ResultTypeBasicMigrateSQLServerSQLMITaskOutput = "ErrorOutput" - // ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput ... - ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput ResultTypeBasicMigrateSQLServerSQLMITaskOutput = "LoginLevelOutput" - // ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput ... - ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput ResultTypeBasicMigrateSQLServerSQLMITaskOutput = "MigrateSqlServerSqlMITaskOutput" - // ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput ... - ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput ResultTypeBasicMigrateSQLServerSQLMITaskOutput = "MigrationLevelOutput" -) - -// PossibleResultTypeBasicMigrateSQLServerSQLMITaskOutputValues returns an array of possible values for the ResultTypeBasicMigrateSQLServerSQLMITaskOutput const type. -func PossibleResultTypeBasicMigrateSQLServerSQLMITaskOutputValues() []ResultTypeBasicMigrateSQLServerSQLMITaskOutput { - return []ResultTypeBasicMigrateSQLServerSQLMITaskOutput{ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput, ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput, ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput, ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput, ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput, ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput} -} - -// SchemaMigrationStage enumerates the values for schema migration stage. -type SchemaMigrationStage string - -const ( - // SchemaMigrationStageCollectingObjects ... - SchemaMigrationStageCollectingObjects SchemaMigrationStage = "CollectingObjects" - // SchemaMigrationStageCompleted ... - SchemaMigrationStageCompleted SchemaMigrationStage = "Completed" - // SchemaMigrationStageCompletedWithWarnings ... - SchemaMigrationStageCompletedWithWarnings SchemaMigrationStage = "CompletedWithWarnings" - // SchemaMigrationStageDeployingSchema ... - SchemaMigrationStageDeployingSchema SchemaMigrationStage = "DeployingSchema" - // SchemaMigrationStageDownloadingScript ... - SchemaMigrationStageDownloadingScript SchemaMigrationStage = "DownloadingScript" - // SchemaMigrationStageFailed ... - SchemaMigrationStageFailed SchemaMigrationStage = "Failed" - // SchemaMigrationStageGeneratingScript ... - SchemaMigrationStageGeneratingScript SchemaMigrationStage = "GeneratingScript" - // SchemaMigrationStageNotStarted ... - SchemaMigrationStageNotStarted SchemaMigrationStage = "NotStarted" - // SchemaMigrationStageUploadingScript ... - SchemaMigrationStageUploadingScript SchemaMigrationStage = "UploadingScript" - // SchemaMigrationStageValidatingInputs ... - SchemaMigrationStageValidatingInputs SchemaMigrationStage = "ValidatingInputs" -) - -// PossibleSchemaMigrationStageValues returns an array of possible values for the SchemaMigrationStage const type. -func PossibleSchemaMigrationStageValues() []SchemaMigrationStage { - return []SchemaMigrationStage{SchemaMigrationStageCollectingObjects, SchemaMigrationStageCompleted, SchemaMigrationStageCompletedWithWarnings, SchemaMigrationStageDeployingSchema, SchemaMigrationStageDownloadingScript, SchemaMigrationStageFailed, SchemaMigrationStageGeneratingScript, SchemaMigrationStageNotStarted, SchemaMigrationStageUploadingScript, SchemaMigrationStageValidatingInputs} -} - -// ServerLevelPermissionsGroup enumerates the values for server level permissions group. -type ServerLevelPermissionsGroup string - -const ( - // Default ... - Default ServerLevelPermissionsGroup = "Default" - // MigrationFromMySQLToAzureDBForMySQL ... - MigrationFromMySQLToAzureDBForMySQL ServerLevelPermissionsGroup = "MigrationFromMySQLToAzureDBForMySQL" - // MigrationFromSQLServerToAzureDB ... - MigrationFromSQLServerToAzureDB ServerLevelPermissionsGroup = "MigrationFromSqlServerToAzureDB" - // MigrationFromSQLServerToAzureMI ... - MigrationFromSQLServerToAzureMI ServerLevelPermissionsGroup = "MigrationFromSqlServerToAzureMI" -) - -// PossibleServerLevelPermissionsGroupValues returns an array of possible values for the ServerLevelPermissionsGroup const type. -func PossibleServerLevelPermissionsGroupValues() []ServerLevelPermissionsGroup { - return []ServerLevelPermissionsGroup{Default, MigrationFromMySQLToAzureDBForMySQL, MigrationFromSQLServerToAzureDB, MigrationFromSQLServerToAzureMI} -} - -// ServiceProvisioningState enumerates the values for service provisioning state. -type ServiceProvisioningState string - -const ( - // ServiceProvisioningStateAccepted ... - ServiceProvisioningStateAccepted ServiceProvisioningState = "Accepted" - // ServiceProvisioningStateDeleting ... - ServiceProvisioningStateDeleting ServiceProvisioningState = "Deleting" - // ServiceProvisioningStateDeploying ... - ServiceProvisioningStateDeploying ServiceProvisioningState = "Deploying" - // ServiceProvisioningStateFailed ... - ServiceProvisioningStateFailed ServiceProvisioningState = "Failed" - // ServiceProvisioningStateFailedToStart ... - ServiceProvisioningStateFailedToStart ServiceProvisioningState = "FailedToStart" - // ServiceProvisioningStateFailedToStop ... - ServiceProvisioningStateFailedToStop ServiceProvisioningState = "FailedToStop" - // ServiceProvisioningStateStarting ... - ServiceProvisioningStateStarting ServiceProvisioningState = "Starting" - // ServiceProvisioningStateStopped ... - ServiceProvisioningStateStopped ServiceProvisioningState = "Stopped" - // ServiceProvisioningStateStopping ... - ServiceProvisioningStateStopping ServiceProvisioningState = "Stopping" - // ServiceProvisioningStateSucceeded ... - ServiceProvisioningStateSucceeded ServiceProvisioningState = "Succeeded" -) - -// PossibleServiceProvisioningStateValues returns an array of possible values for the ServiceProvisioningState const type. -func PossibleServiceProvisioningStateValues() []ServiceProvisioningState { - return []ServiceProvisioningState{ServiceProvisioningStateAccepted, ServiceProvisioningStateDeleting, ServiceProvisioningStateDeploying, ServiceProvisioningStateFailed, ServiceProvisioningStateFailedToStart, ServiceProvisioningStateFailedToStop, ServiceProvisioningStateStarting, ServiceProvisioningStateStopped, ServiceProvisioningStateStopping, ServiceProvisioningStateSucceeded} -} - -// ServiceScalability enumerates the values for service scalability. -type ServiceScalability string - -const ( - // ServiceScalabilityAutomatic ... - ServiceScalabilityAutomatic ServiceScalability = "automatic" - // ServiceScalabilityManual ... - ServiceScalabilityManual ServiceScalability = "manual" - // ServiceScalabilityNone ... - ServiceScalabilityNone ServiceScalability = "none" -) - -// PossibleServiceScalabilityValues returns an array of possible values for the ServiceScalability const type. -func PossibleServiceScalabilityValues() []ServiceScalability { - return []ServiceScalability{ServiceScalabilityAutomatic, ServiceScalabilityManual, ServiceScalabilityNone} -} - -// Severity enumerates the values for severity. -type Severity string - -const ( - // SeverityError ... - SeverityError Severity = "Error" - // SeverityMessage ... - SeverityMessage Severity = "Message" - // SeverityWarning ... - SeverityWarning Severity = "Warning" -) - -// PossibleSeverityValues returns an array of possible values for the Severity const type. -func PossibleSeverityValues() []Severity { - return []Severity{SeverityError, SeverityMessage, SeverityWarning} -} - -// SQLSourcePlatform enumerates the values for sql source platform. -type SQLSourcePlatform string - -const ( - // SQLOnPrem ... - SQLOnPrem SQLSourcePlatform = "SqlOnPrem" -) - -// PossibleSQLSourcePlatformValues returns an array of possible values for the SQLSourcePlatform const type. -func PossibleSQLSourcePlatformValues() []SQLSourcePlatform { - return []SQLSourcePlatform{SQLOnPrem} -} - -// SyncDatabaseMigrationReportingState enumerates the values for sync database migration reporting state. -type SyncDatabaseMigrationReportingState string - -const ( - // SyncDatabaseMigrationReportingStateCANCELLED ... - SyncDatabaseMigrationReportingStateCANCELLED SyncDatabaseMigrationReportingState = "CANCELLED" - // SyncDatabaseMigrationReportingStateCANCELLING ... - SyncDatabaseMigrationReportingStateCANCELLING SyncDatabaseMigrationReportingState = "CANCELLING" - // SyncDatabaseMigrationReportingStateCOMPLETE ... - SyncDatabaseMigrationReportingStateCOMPLETE SyncDatabaseMigrationReportingState = "COMPLETE" - // SyncDatabaseMigrationReportingStateCOMPLETING ... - SyncDatabaseMigrationReportingStateCOMPLETING SyncDatabaseMigrationReportingState = "COMPLETING" - // SyncDatabaseMigrationReportingStateCONFIGURING ... - SyncDatabaseMigrationReportingStateCONFIGURING SyncDatabaseMigrationReportingState = "CONFIGURING" - // SyncDatabaseMigrationReportingStateFAILED ... - SyncDatabaseMigrationReportingStateFAILED SyncDatabaseMigrationReportingState = "FAILED" - // SyncDatabaseMigrationReportingStateINITIALIAZING ... - SyncDatabaseMigrationReportingStateINITIALIAZING SyncDatabaseMigrationReportingState = "INITIALIAZING" - // SyncDatabaseMigrationReportingStateREADYTOCOMPLETE ... - SyncDatabaseMigrationReportingStateREADYTOCOMPLETE SyncDatabaseMigrationReportingState = "READY_TO_COMPLETE" - // SyncDatabaseMigrationReportingStateRUNNING ... - SyncDatabaseMigrationReportingStateRUNNING SyncDatabaseMigrationReportingState = "RUNNING" - // SyncDatabaseMigrationReportingStateSTARTING ... - SyncDatabaseMigrationReportingStateSTARTING SyncDatabaseMigrationReportingState = "STARTING" - // SyncDatabaseMigrationReportingStateUNDEFINED ... - SyncDatabaseMigrationReportingStateUNDEFINED SyncDatabaseMigrationReportingState = "UNDEFINED" -) - -// PossibleSyncDatabaseMigrationReportingStateValues returns an array of possible values for the SyncDatabaseMigrationReportingState const type. -func PossibleSyncDatabaseMigrationReportingStateValues() []SyncDatabaseMigrationReportingState { - return []SyncDatabaseMigrationReportingState{SyncDatabaseMigrationReportingStateCANCELLED, SyncDatabaseMigrationReportingStateCANCELLING, SyncDatabaseMigrationReportingStateCOMPLETE, SyncDatabaseMigrationReportingStateCOMPLETING, SyncDatabaseMigrationReportingStateCONFIGURING, SyncDatabaseMigrationReportingStateFAILED, SyncDatabaseMigrationReportingStateINITIALIAZING, SyncDatabaseMigrationReportingStateREADYTOCOMPLETE, SyncDatabaseMigrationReportingStateRUNNING, SyncDatabaseMigrationReportingStateSTARTING, SyncDatabaseMigrationReportingStateUNDEFINED} -} - -// SyncTableMigrationState enumerates the values for sync table migration state. -type SyncTableMigrationState string - -const ( - // SyncTableMigrationStateBEFORELOAD ... - SyncTableMigrationStateBEFORELOAD SyncTableMigrationState = "BEFORE_LOAD" - // SyncTableMigrationStateCANCELED ... - SyncTableMigrationStateCANCELED SyncTableMigrationState = "CANCELED" - // SyncTableMigrationStateCOMPLETED ... - SyncTableMigrationStateCOMPLETED SyncTableMigrationState = "COMPLETED" - // SyncTableMigrationStateERROR ... - SyncTableMigrationStateERROR SyncTableMigrationState = "ERROR" - // SyncTableMigrationStateFAILED ... - SyncTableMigrationStateFAILED SyncTableMigrationState = "FAILED" - // SyncTableMigrationStateFULLLOAD ... - SyncTableMigrationStateFULLLOAD SyncTableMigrationState = "FULL_LOAD" -) - -// PossibleSyncTableMigrationStateValues returns an array of possible values for the SyncTableMigrationState const type. -func PossibleSyncTableMigrationStateValues() []SyncTableMigrationState { - return []SyncTableMigrationState{SyncTableMigrationStateBEFORELOAD, SyncTableMigrationStateCANCELED, SyncTableMigrationStateCOMPLETED, SyncTableMigrationStateERROR, SyncTableMigrationStateFAILED, SyncTableMigrationStateFULLLOAD} -} - -// TaskState enumerates the values for task state. -type TaskState string - -const ( - // TaskStateCanceled ... - TaskStateCanceled TaskState = "Canceled" - // TaskStateFailed ... - TaskStateFailed TaskState = "Failed" - // TaskStateFailedInputValidation ... - TaskStateFailedInputValidation TaskState = "FailedInputValidation" - // TaskStateFaulted ... - TaskStateFaulted TaskState = "Faulted" - // TaskStateQueued ... - TaskStateQueued TaskState = "Queued" - // TaskStateRunning ... - TaskStateRunning TaskState = "Running" - // TaskStateSucceeded ... - TaskStateSucceeded TaskState = "Succeeded" - // TaskStateUnknown ... - TaskStateUnknown TaskState = "Unknown" -) - -// PossibleTaskStateValues returns an array of possible values for the TaskState const type. -func PossibleTaskStateValues() []TaskState { - return []TaskState{TaskStateCanceled, TaskStateFailed, TaskStateFailedInputValidation, TaskStateFaulted, TaskStateQueued, TaskStateRunning, TaskStateSucceeded, TaskStateUnknown} -} - -// TaskType enumerates the values for task type. -type TaskType string - -const ( - // TaskTypeConnectToSourceMySQL ... - TaskTypeConnectToSourceMySQL TaskType = "ConnectToSource.MySql" - // TaskTypeConnectToSourcePostgreSQLSync ... - TaskTypeConnectToSourcePostgreSQLSync TaskType = "ConnectToSource.PostgreSql.Sync" - // TaskTypeConnectToSourceSQLServer ... - TaskTypeConnectToSourceSQLServer TaskType = "ConnectToSource.SqlServer" - // TaskTypeConnectToSourceSQLServerSync ... - TaskTypeConnectToSourceSQLServerSync TaskType = "ConnectToSource.SqlServer.Sync" - // TaskTypeConnectToTargetAzureDbForMySQL ... - TaskTypeConnectToTargetAzureDbForMySQL TaskType = "ConnectToTarget.AzureDbForMySql" - // TaskTypeConnectToTargetAzureDbForPostgreSQLSync ... - TaskTypeConnectToTargetAzureDbForPostgreSQLSync TaskType = "ConnectToTarget.AzureDbForPostgreSql.Sync" - // TaskTypeConnectToTargetAzureSQLDbMI ... - TaskTypeConnectToTargetAzureSQLDbMI TaskType = "ConnectToTarget.AzureSqlDbMI" - // TaskTypeConnectToTargetAzureSQLDbMISyncLRS ... - TaskTypeConnectToTargetAzureSQLDbMISyncLRS TaskType = "ConnectToTarget.AzureSqlDbMI.Sync.LRS" - // TaskTypeConnectToTargetSQLDb ... - TaskTypeConnectToTargetSQLDb TaskType = "ConnectToTarget.SqlDb" - // TaskTypeConnectToTargetSQLDbSync ... - TaskTypeConnectToTargetSQLDbSync TaskType = "ConnectToTarget.SqlDb.Sync" - // TaskTypeGetTDECertificatesSQL ... - TaskTypeGetTDECertificatesSQL TaskType = "GetTDECertificates.Sql" - // TaskTypeGetUserTablesAzureSQLDbSync ... - TaskTypeGetUserTablesAzureSQLDbSync TaskType = "GetUserTables.AzureSqlDb.Sync" - // TaskTypeGetUserTablesSQL ... - TaskTypeGetUserTablesSQL TaskType = "GetUserTables.Sql" - // TaskTypeMigrateMySQLAzureDbForMySQLSync ... - TaskTypeMigrateMySQLAzureDbForMySQLSync TaskType = "Migrate.MySql.AzureDbForMySql.Sync" - // TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync ... - TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync TaskType = "Migrate.PostgreSql.AzureDbForPostgreSql.Sync" - // TaskTypeMigrateSQLServerAzureSQLDbMI ... - TaskTypeMigrateSQLServerAzureSQLDbMI TaskType = "Migrate.SqlServer.AzureSqlDbMI" - // TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS ... - TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS TaskType = "Migrate.SqlServer.AzureSqlDbMI.Sync.LRS" - // TaskTypeMigrateSQLServerAzureSQLDbSync ... - TaskTypeMigrateSQLServerAzureSQLDbSync TaskType = "Migrate.SqlServer.AzureSqlDb.Sync" - // TaskTypeMigrateSQLServerSQLDb ... - TaskTypeMigrateSQLServerSQLDb TaskType = "Migrate.SqlServer.SqlDb" - // TaskTypeProjectTaskProperties ... - TaskTypeProjectTaskProperties TaskType = "ProjectTaskProperties" - // TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI ... - TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI TaskType = "ValidateMigrationInput.SqlServer.AzureSqlDbMI" - // TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS ... - TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS TaskType = "ValidateMigrationInput.SqlServer.AzureSqlDbMI.Sync.LRS" - // TaskTypeValidateMigrationInputSQLServerSQLDbSync ... - TaskTypeValidateMigrationInputSQLServerSQLDbSync TaskType = "ValidateMigrationInput.SqlServer.SqlDb.Sync" -) - -// PossibleTaskTypeValues returns an array of possible values for the TaskType const type. -func PossibleTaskTypeValues() []TaskType { - return []TaskType{TaskTypeConnectToSourceMySQL, TaskTypeConnectToSourcePostgreSQLSync, TaskTypeConnectToSourceSQLServer, TaskTypeConnectToSourceSQLServerSync, TaskTypeConnectToTargetAzureDbForMySQL, TaskTypeConnectToTargetAzureDbForPostgreSQLSync, TaskTypeConnectToTargetAzureSQLDbMI, TaskTypeConnectToTargetAzureSQLDbMISyncLRS, TaskTypeConnectToTargetSQLDb, TaskTypeConnectToTargetSQLDbSync, TaskTypeGetTDECertificatesSQL, TaskTypeGetUserTablesAzureSQLDbSync, TaskTypeGetUserTablesSQL, TaskTypeMigrateMySQLAzureDbForMySQLSync, TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync, TaskTypeMigrateSQLServerAzureSQLDbMI, TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS, TaskTypeMigrateSQLServerAzureSQLDbSync, TaskTypeMigrateSQLServerSQLDb, TaskTypeProjectTaskProperties, TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI, TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS, TaskTypeValidateMigrationInputSQLServerSQLDbSync} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeConnectionInfo ... - TypeConnectionInfo Type = "ConnectionInfo" - // TypeMiSQLConnectionInfo ... - TypeMiSQLConnectionInfo Type = "MiSqlConnectionInfo" - // TypeMySQLConnectionInfo ... - TypeMySQLConnectionInfo Type = "MySqlConnectionInfo" - // TypePostgreSQLConnectionInfo ... - TypePostgreSQLConnectionInfo Type = "PostgreSqlConnectionInfo" - // TypeSQLConnectionInfo ... - TypeSQLConnectionInfo Type = "SqlConnectionInfo" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeConnectionInfo, TypeMiSQLConnectionInfo, TypeMySQLConnectionInfo, TypePostgreSQLConnectionInfo, TypeSQLConnectionInfo} -} - -// UpdateActionType enumerates the values for update action type. -type UpdateActionType string - -const ( - // AddedOnTarget ... - AddedOnTarget UpdateActionType = "AddedOnTarget" - // ChangedOnTarget ... - ChangedOnTarget UpdateActionType = "ChangedOnTarget" - // DeletedOnTarget ... - DeletedOnTarget UpdateActionType = "DeletedOnTarget" -) - -// PossibleUpdateActionTypeValues returns an array of possible values for the UpdateActionType const type. -func PossibleUpdateActionTypeValues() []UpdateActionType { - return []UpdateActionType{AddedOnTarget, ChangedOnTarget, DeletedOnTarget} -} - -// ValidationStatus enumerates the values for validation status. -type ValidationStatus string - -const ( - // ValidationStatusCompleted ... - ValidationStatusCompleted ValidationStatus = "Completed" - // ValidationStatusCompletedWithIssues ... - ValidationStatusCompletedWithIssues ValidationStatus = "CompletedWithIssues" - // ValidationStatusDefault ... - ValidationStatusDefault ValidationStatus = "Default" - // ValidationStatusFailed ... - ValidationStatusFailed ValidationStatus = "Failed" - // ValidationStatusInitialized ... - ValidationStatusInitialized ValidationStatus = "Initialized" - // ValidationStatusInProgress ... - ValidationStatusInProgress ValidationStatus = "InProgress" - // ValidationStatusNotStarted ... - ValidationStatusNotStarted ValidationStatus = "NotStarted" - // ValidationStatusStopped ... - ValidationStatusStopped ValidationStatus = "Stopped" -) - -// PossibleValidationStatusValues returns an array of possible values for the ValidationStatus const type. -func PossibleValidationStatusValues() []ValidationStatus { - return []ValidationStatus{ValidationStatusCompleted, ValidationStatusCompletedWithIssues, ValidationStatusDefault, ValidationStatusFailed, ValidationStatusInitialized, ValidationStatusInProgress, ValidationStatusNotStarted, ValidationStatusStopped} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/models.go deleted file mode 100644 index 72737099d01b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/models.go +++ /dev/null @@ -1,12286 +0,0 @@ -package datamigration - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration" - -// APIError error information. -type APIError struct { - // Error - Error information in OData format - Error *ODataError `json:"error,omitempty"` -} - -// AvailableServiceSku describes the available service SKU. -type AvailableServiceSku struct { - // ResourceType - The resource type, including the provider namespace - ResourceType *string `json:"resourceType,omitempty"` - // Sku - SKU name, tier, etc. - Sku *AvailableServiceSkuSku `json:"sku,omitempty"` - // Capacity - A description of the scaling capacities of the SKU - Capacity *AvailableServiceSkuCapacity `json:"capacity,omitempty"` -} - -// AvailableServiceSkuCapacity a description of the scaling capacities of the SKU -type AvailableServiceSkuCapacity struct { - // Minimum - The minimum capacity, usually 0 or 1. - Minimum *int32 `json:"minimum,omitempty"` - // Maximum - The maximum capacity - Maximum *int32 `json:"maximum,omitempty"` - // Default - The default capacity - Default *int32 `json:"default,omitempty"` - // ScaleType - The scalability approach. Possible values include: 'ServiceScalabilityNone', 'ServiceScalabilityManual', 'ServiceScalabilityAutomatic' - ScaleType ServiceScalability `json:"scaleType,omitempty"` -} - -// AvailableServiceSkuSku SKU name, tier, etc. -type AvailableServiceSkuSku struct { - // Name - The name of the SKU - Name *string `json:"name,omitempty"` - // Family - SKU family - Family *string `json:"family,omitempty"` - // Size - SKU size - Size *string `json:"size,omitempty"` - // Tier - The tier of the SKU, such as "Free", "Basic", "Standard", or "Premium" - Tier *string `json:"tier,omitempty"` -} - -// AzureActiveDirectoryApp azure Active Directory Application -type AzureActiveDirectoryApp struct { - // ApplicationID - Application ID of the Azure Active Directory Application - ApplicationID *string `json:"applicationId,omitempty"` - // AppKey - Key used to authenticate to the Azure Active Directory Application - AppKey *string `json:"appKey,omitempty"` - // TenantID - Tenant id of the customer - TenantID *string `json:"tenantId,omitempty"` -} - -// BackupFileInfo information of the backup file -type BackupFileInfo struct { - // FileLocation - Location of the backup file in shared folder - FileLocation *string `json:"fileLocation,omitempty"` - // FamilySequenceNumber - Sequence number of the backup file in the backup set - FamilySequenceNumber *int32 `json:"familySequenceNumber,omitempty"` - // Status - Status of the backup file during migration. Possible values include: 'Arrived', 'Queued', 'Uploading', 'Uploaded', 'Restoring', 'Restored', 'Cancelled' - Status BackupFileStatus `json:"status,omitempty"` -} - -// BackupSetInfo information of backup set -type BackupSetInfo struct { - // BackupSetID - Id for the set of backup files - BackupSetID *string `json:"backupSetId,omitempty"` - // FirstLsn - First log sequence number of the backup file - FirstLsn *string `json:"firstLsn,omitempty"` - // LastLsn - Last log sequence number of the backup file - LastLsn *string `json:"lastLsn,omitempty"` - // LastModifiedTime - Last modified time of the backup file in share location - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // BackupType - Enum of the different backup types. Possible values include: 'BackupTypeDatabase', 'BackupTypeTransactionLog', 'BackupTypeFile', 'BackupTypeDifferentialDatabase', 'BackupTypeDifferentialFile', 'BackupTypePartial', 'BackupTypeDifferentialPartial' - BackupType BackupType `json:"backupType,omitempty"` - // ListOfBackupFiles - List of files in the backup set - ListOfBackupFiles *[]BackupFileInfo `json:"listOfBackupFiles,omitempty"` - // DatabaseName - Name of the database to which the backup set belongs - DatabaseName *string `json:"databaseName,omitempty"` - // BackupStartDate - Date and time that the backup operation began - BackupStartDate *date.Time `json:"backupStartDate,omitempty"` - // BackupFinishedDate - Date and time that the backup operation finished - BackupFinishedDate *date.Time `json:"backupFinishedDate,omitempty"` - // IsBackupRestored - Whether the backup set is restored or not - IsBackupRestored *bool `json:"isBackupRestored,omitempty"` -} - -// BlobShare blob container storage information. -type BlobShare struct { - // SasURI - SAS URI of Azure Storage Account Container. - SasURI *string `json:"sasUri,omitempty"` -} - -// BasicCommandProperties base class for all types of DMS command properties. If command is not supported by current -// client, this object is returned. -type BasicCommandProperties interface { - AsMigrateMISyncCompleteCommandProperties() (*MigrateMISyncCompleteCommandProperties, bool) - AsMigrateSyncCompleteCommandProperties() (*MigrateSyncCompleteCommandProperties, bool) - AsCommandProperties() (*CommandProperties, bool) -} - -// CommandProperties base class for all types of DMS command properties. If command is not supported by current -// client, this object is returned. -type CommandProperties struct { - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the command. This is ignored if submitted. Possible values include: 'Unknown', 'Accepted', 'Running', 'Succeeded', 'Failed' - State CommandState `json:"state,omitempty"` - // CommandType - Possible values include: 'CommandTypeCommandProperties', 'CommandTypeMigrateSQLServerAzureDbSQLMiComplete', 'CommandTypeMigrateSyncCompleteDatabase' - CommandType CommandType `json:"commandType,omitempty"` -} - -func unmarshalBasicCommandProperties(body []byte) (BasicCommandProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["commandType"] { - case string(CommandTypeMigrateSQLServerAzureDbSQLMiComplete): - var mmsccp MigrateMISyncCompleteCommandProperties - err := json.Unmarshal(body, &mmsccp) - return mmsccp, err - case string(CommandTypeMigrateSyncCompleteDatabase): - var msccp MigrateSyncCompleteCommandProperties - err := json.Unmarshal(body, &msccp) - return msccp, err - default: - var cp CommandProperties - err := json.Unmarshal(body, &cp) - return cp, err - } -} -func unmarshalBasicCommandPropertiesArray(body []byte) ([]BasicCommandProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - cpArray := make([]BasicCommandProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - cp, err := unmarshalBasicCommandProperties(*rawMessage) - if err != nil { - return nil, err - } - cpArray[index] = cp - } - return cpArray, nil -} - -// MarshalJSON is the custom marshaler for CommandProperties. -func (cp CommandProperties) MarshalJSON() ([]byte, error) { - cp.CommandType = CommandTypeCommandProperties - objectMap := make(map[string]interface{}) - if cp.CommandType != "" { - objectMap["commandType"] = cp.CommandType - } - return json.Marshal(objectMap) -} - -// AsMigrateMISyncCompleteCommandProperties is the BasicCommandProperties implementation for CommandProperties. -func (cp CommandProperties) AsMigrateMISyncCompleteCommandProperties() (*MigrateMISyncCompleteCommandProperties, bool) { - return nil, false -} - -// AsMigrateSyncCompleteCommandProperties is the BasicCommandProperties implementation for CommandProperties. -func (cp CommandProperties) AsMigrateSyncCompleteCommandProperties() (*MigrateSyncCompleteCommandProperties, bool) { - return nil, false -} - -// AsCommandProperties is the BasicCommandProperties implementation for CommandProperties. -func (cp CommandProperties) AsCommandProperties() (*CommandProperties, bool) { - return &cp, true -} - -// AsBasicCommandProperties is the BasicCommandProperties implementation for CommandProperties. -func (cp CommandProperties) AsBasicCommandProperties() (BasicCommandProperties, bool) { - return &cp, true -} - -// BasicConnectionInfo defines the connection properties of a server -type BasicConnectionInfo interface { - AsMiSQLConnectionInfo() (*MiSQLConnectionInfo, bool) - AsPostgreSQLConnectionInfo() (*PostgreSQLConnectionInfo, bool) - AsMySQLConnectionInfo() (*MySQLConnectionInfo, bool) - AsSQLConnectionInfo() (*SQLConnectionInfo, bool) - AsConnectionInfo() (*ConnectionInfo, bool) -} - -// ConnectionInfo defines the connection properties of a server -type ConnectionInfo struct { - // UserName - User name - UserName *string `json:"userName,omitempty"` - // Password - Password credential. - Password *string `json:"password,omitempty"` - // Type - Possible values include: 'TypeConnectionInfo', 'TypeMiSQLConnectionInfo', 'TypePostgreSQLConnectionInfo', 'TypeMySQLConnectionInfo', 'TypeSQLConnectionInfo' - Type Type `json:"type,omitempty"` -} - -func unmarshalBasicConnectionInfo(body []byte) (BasicConnectionInfo, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeMiSQLConnectionInfo): - var msci MiSQLConnectionInfo - err := json.Unmarshal(body, &msci) - return msci, err - case string(TypePostgreSQLConnectionInfo): - var psci PostgreSQLConnectionInfo - err := json.Unmarshal(body, &psci) - return psci, err - case string(TypeMySQLConnectionInfo): - var msci MySQLConnectionInfo - err := json.Unmarshal(body, &msci) - return msci, err - case string(TypeSQLConnectionInfo): - var sci SQLConnectionInfo - err := json.Unmarshal(body, &sci) - return sci, err - default: - var ci ConnectionInfo - err := json.Unmarshal(body, &ci) - return ci, err - } -} -func unmarshalBasicConnectionInfoArray(body []byte) ([]BasicConnectionInfo, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - ciArray := make([]BasicConnectionInfo, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ci, err := unmarshalBasicConnectionInfo(*rawMessage) - if err != nil { - return nil, err - } - ciArray[index] = ci - } - return ciArray, nil -} - -// MarshalJSON is the custom marshaler for ConnectionInfo. -func (ci ConnectionInfo) MarshalJSON() ([]byte, error) { - ci.Type = TypeConnectionInfo - objectMap := make(map[string]interface{}) - if ci.UserName != nil { - objectMap["userName"] = ci.UserName - } - if ci.Password != nil { - objectMap["password"] = ci.Password - } - if ci.Type != "" { - objectMap["type"] = ci.Type - } - return json.Marshal(objectMap) -} - -// AsMiSQLConnectionInfo is the BasicConnectionInfo implementation for ConnectionInfo. -func (ci ConnectionInfo) AsMiSQLConnectionInfo() (*MiSQLConnectionInfo, bool) { - return nil, false -} - -// AsPostgreSQLConnectionInfo is the BasicConnectionInfo implementation for ConnectionInfo. -func (ci ConnectionInfo) AsPostgreSQLConnectionInfo() (*PostgreSQLConnectionInfo, bool) { - return nil, false -} - -// AsMySQLConnectionInfo is the BasicConnectionInfo implementation for ConnectionInfo. -func (ci ConnectionInfo) AsMySQLConnectionInfo() (*MySQLConnectionInfo, bool) { - return nil, false -} - -// AsSQLConnectionInfo is the BasicConnectionInfo implementation for ConnectionInfo. -func (ci ConnectionInfo) AsSQLConnectionInfo() (*SQLConnectionInfo, bool) { - return nil, false -} - -// AsConnectionInfo is the BasicConnectionInfo implementation for ConnectionInfo. -func (ci ConnectionInfo) AsConnectionInfo() (*ConnectionInfo, bool) { - return &ci, true -} - -// AsBasicConnectionInfo is the BasicConnectionInfo implementation for ConnectionInfo. -func (ci ConnectionInfo) AsBasicConnectionInfo() (BasicConnectionInfo, bool) { - return &ci, true -} - -// ConnectToSourceMySQLTaskInput input for the task that validates MySQL database connection -type ConnectToSourceMySQLTaskInput struct { - // SourceConnectionInfo - Information for connecting to MySQL source - SourceConnectionInfo *MySQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetPlatform - Target Platform for the migration. Possible values include: 'SQLServer', 'AzureDbForMySQL' - TargetPlatform MySQLTargetPlatformType `json:"targetPlatform,omitempty"` - // CheckPermissionsGroup - Permission group for validations. Possible values include: 'Default', 'MigrationFromSQLServerToAzureDB', 'MigrationFromSQLServerToAzureMI', 'MigrationFromMySQLToAzureDBForMySQL' - CheckPermissionsGroup ServerLevelPermissionsGroup `json:"checkPermissionsGroup,omitempty"` -} - -// ConnectToSourceMySQLTaskProperties properties for the task that validates MySQL database connection -type ConnectToSourceMySQLTaskProperties struct { - // Input - Task input - Input *ConnectToSourceMySQLTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]ConnectToSourceNonSQLTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) MarshalJSON() ([]byte, error) { - ctsmstp.TaskType = TaskTypeConnectToSourceMySQL - objectMap := make(map[string]interface{}) - if ctsmstp.Input != nil { - objectMap["input"] = ctsmstp.Input - } - if ctsmstp.TaskType != "" { - objectMap["taskType"] = ctsmstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return &ctsmstp, true -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceMySQLTaskProperties. -func (ctsmstp ConnectToSourceMySQLTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &ctsmstp, true -} - -// UnmarshalJSON is the custom unmarshaler for ConnectToSourceMySQLTaskProperties struct. -func (ctsmstp *ConnectToSourceMySQLTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input ConnectToSourceMySQLTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - ctsmstp.Input = &input - } - case "output": - if v != nil { - var output []ConnectToSourceNonSQLTaskOutput - err = json.Unmarshal(*v, &output) - if err != nil { - return err - } - ctsmstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - ctsmstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - ctsmstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - ctsmstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - ctsmstp.TaskType = taskType - } - } - } - - return nil -} - -// ConnectToSourceNonSQLTaskOutput output for connect to Oracle, MySQL type source -type ConnectToSourceNonSQLTaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // SourceServerBrandVersion - READ-ONLY; Server brand version - SourceServerBrandVersion *string `json:"sourceServerBrandVersion,omitempty"` - // ServerProperties - READ-ONLY; Server properties - ServerProperties *ServerProperties `json:"serverProperties,omitempty"` - // Databases - READ-ONLY; List of databases on the server - Databases *[]string `json:"databases,omitempty"` - // ValidationErrors - READ-ONLY; Validation errors associated with the task - ValidationErrors *[]ReportableException `json:"validationErrors,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToSourceNonSQLTaskOutput. -func (ctsnsto ConnectToSourceNonSQLTaskOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConnectToSourcePostgreSQLSyncTaskInput input for the task that validates connection to PostgreSQL and -// source server requirements -type ConnectToSourcePostgreSQLSyncTaskInput struct { - // SourceConnectionInfo - Connection information for source PostgreSQL server - SourceConnectionInfo *PostgreSQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` -} - -// ConnectToSourcePostgreSQLSyncTaskOutput output for the task that validates connection to PostgreSQL and -// source server requirements -type ConnectToSourcePostgreSQLSyncTaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // SourceServerVersion - READ-ONLY; Version of the source server - SourceServerVersion *string `json:"sourceServerVersion,omitempty"` - // Databases - READ-ONLY; List of databases on source server - Databases *[]string `json:"databases,omitempty"` - // SourceServerBrandVersion - READ-ONLY; Source server brand version - SourceServerBrandVersion *string `json:"sourceServerBrandVersion,omitempty"` - // ValidationErrors - READ-ONLY; Validation errors associated with the task - ValidationErrors *[]ReportableException `json:"validationErrors,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToSourcePostgreSQLSyncTaskOutput. -func (ctspssto ConnectToSourcePostgreSQLSyncTaskOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConnectToSourcePostgreSQLSyncTaskProperties properties for the task that validates connection to -// PostgreSQL server and source server requirements for online migration -type ConnectToSourcePostgreSQLSyncTaskProperties struct { - // Input - Task input - Input *ConnectToSourcePostgreSQLSyncTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]ConnectToSourcePostgreSQLSyncTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) MarshalJSON() ([]byte, error) { - ctspsstp.TaskType = TaskTypeConnectToSourcePostgreSQLSync - objectMap := make(map[string]interface{}) - if ctspsstp.Input != nil { - objectMap["input"] = ctspsstp.Input - } - if ctspsstp.TaskType != "" { - objectMap["taskType"] = ctspsstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return &ctspsstp, true -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourcePostgreSQLSyncTaskProperties. -func (ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &ctspsstp, true -} - -// UnmarshalJSON is the custom unmarshaler for ConnectToSourcePostgreSQLSyncTaskProperties struct. -func (ctspsstp *ConnectToSourcePostgreSQLSyncTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input ConnectToSourcePostgreSQLSyncTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - ctspsstp.Input = &input - } - case "output": - if v != nil { - var output []ConnectToSourcePostgreSQLSyncTaskOutput - err = json.Unmarshal(*v, &output) - if err != nil { - return err - } - ctspsstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - ctspsstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - ctspsstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - ctspsstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - ctspsstp.TaskType = taskType - } - } - } - - return nil -} - -// ConnectToSourceSQLServerSyncTaskProperties properties for the task that validates connection to SQL -// Server and source server requirements for online migration -type ConnectToSourceSQLServerSyncTaskProperties struct { - // Input - Task input - Input *ConnectToSourceSQLServerTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]BasicConnectToSourceSQLServerTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) MarshalJSON() ([]byte, error) { - ctsssstp.TaskType = TaskTypeConnectToSourceSQLServerSync - objectMap := make(map[string]interface{}) - if ctsssstp.Input != nil { - objectMap["input"] = ctsssstp.Input - } - if ctsssstp.TaskType != "" { - objectMap["taskType"] = ctsssstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return &ctsssstp, true -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerSyncTaskProperties. -func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &ctsssstp, true -} - -// UnmarshalJSON is the custom unmarshaler for ConnectToSourceSQLServerSyncTaskProperties struct. -func (ctsssstp *ConnectToSourceSQLServerSyncTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input ConnectToSourceSQLServerTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - ctsssstp.Input = &input - } - case "output": - if v != nil { - output, err := unmarshalBasicConnectToSourceSQLServerTaskOutputArray(*v) - if err != nil { - return err - } - ctsssstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - ctsssstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - ctsssstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - ctsssstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - ctsssstp.TaskType = taskType - } - } - } - - return nil -} - -// ConnectToSourceSQLServerTaskInput input for the task that validates connection to SQL Server and also -// validates source server requirements -type ConnectToSourceSQLServerTaskInput struct { - // SourceConnectionInfo - Connection information for Source SQL Server - SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // CheckPermissionsGroup - Permission group for validations. Possible values include: 'Default', 'MigrationFromSQLServerToAzureDB', 'MigrationFromSQLServerToAzureMI', 'MigrationFromMySQLToAzureDBForMySQL' - CheckPermissionsGroup ServerLevelPermissionsGroup `json:"checkPermissionsGroup,omitempty"` - // CollectLogins - Flag for whether to collect logins from source server. - CollectLogins *bool `json:"collectLogins,omitempty"` - // CollectAgentJobs - Flag for whether to collect agent jobs from source server. - CollectAgentJobs *bool `json:"collectAgentJobs,omitempty"` -} - -// BasicConnectToSourceSQLServerTaskOutput output for the task that validates connection to SQL Server and also -// validates source server requirements -type BasicConnectToSourceSQLServerTaskOutput interface { - AsConnectToSourceSQLServerTaskOutputAgentJobLevel() (*ConnectToSourceSQLServerTaskOutputAgentJobLevel, bool) - AsConnectToSourceSQLServerTaskOutputLoginLevel() (*ConnectToSourceSQLServerTaskOutputLoginLevel, bool) - AsConnectToSourceSQLServerTaskOutputDatabaseLevel() (*ConnectToSourceSQLServerTaskOutputDatabaseLevel, bool) - AsConnectToSourceSQLServerTaskOutputTaskLevel() (*ConnectToSourceSQLServerTaskOutputTaskLevel, bool) - AsConnectToSourceSQLServerTaskOutput() (*ConnectToSourceSQLServerTaskOutput, bool) -} - -// ConnectToSourceSQLServerTaskOutput output for the task that validates connection to SQL Server and also -// validates source server requirements -type ConnectToSourceSQLServerTaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput' - ResultType ResultTypeBasicConnectToSourceSQLServerTaskOutput `json:"resultType,omitempty"` -} - -func unmarshalBasicConnectToSourceSQLServerTaskOutput(body []byte) (BasicConnectToSourceSQLServerTaskOutput, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["resultType"] { - case string(ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput): - var ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel - err := json.Unmarshal(body, &ctssstoajl) - return ctssstoajl, err - case string(ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput): - var ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel - err := json.Unmarshal(body, &ctssstoll) - return ctssstoll, err - case string(ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput): - var ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel - err := json.Unmarshal(body, &ctssstodl) - return ctssstodl, err - case string(ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput): - var ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel - err := json.Unmarshal(body, &ctssstotl) - return ctssstotl, err - default: - var ctsssto ConnectToSourceSQLServerTaskOutput - err := json.Unmarshal(body, &ctsssto) - return ctsssto, err - } -} -func unmarshalBasicConnectToSourceSQLServerTaskOutputArray(body []byte) ([]BasicConnectToSourceSQLServerTaskOutput, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - ctssstoArray := make([]BasicConnectToSourceSQLServerTaskOutput, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ctsssto, err := unmarshalBasicConnectToSourceSQLServerTaskOutput(*rawMessage) - if err != nil { - return nil, err - } - ctssstoArray[index] = ctsssto - } - return ctssstoArray, nil -} - -// MarshalJSON is the custom marshaler for ConnectToSourceSQLServerTaskOutput. -func (ctsssto ConnectToSourceSQLServerTaskOutput) MarshalJSON() ([]byte, error) { - ctsssto.ResultType = ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput - objectMap := make(map[string]interface{}) - if ctsssto.ResultType != "" { - objectMap["resultType"] = ctsssto.ResultType - } - return json.Marshal(objectMap) -} - -// AsConnectToSourceSQLServerTaskOutputAgentJobLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutput. -func (ctsssto ConnectToSourceSQLServerTaskOutput) AsConnectToSourceSQLServerTaskOutputAgentJobLevel() (*ConnectToSourceSQLServerTaskOutputAgentJobLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutputLoginLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutput. -func (ctsssto ConnectToSourceSQLServerTaskOutput) AsConnectToSourceSQLServerTaskOutputLoginLevel() (*ConnectToSourceSQLServerTaskOutputLoginLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutputDatabaseLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutput. -func (ctsssto ConnectToSourceSQLServerTaskOutput) AsConnectToSourceSQLServerTaskOutputDatabaseLevel() (*ConnectToSourceSQLServerTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutputTaskLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutput. -func (ctsssto ConnectToSourceSQLServerTaskOutput) AsConnectToSourceSQLServerTaskOutputTaskLevel() (*ConnectToSourceSQLServerTaskOutputTaskLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutput. -func (ctsssto ConnectToSourceSQLServerTaskOutput) AsConnectToSourceSQLServerTaskOutput() (*ConnectToSourceSQLServerTaskOutput, bool) { - return &ctsssto, true -} - -// AsBasicConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutput. -func (ctsssto ConnectToSourceSQLServerTaskOutput) AsBasicConnectToSourceSQLServerTaskOutput() (BasicConnectToSourceSQLServerTaskOutput, bool) { - return &ctsssto, true -} - -// ConnectToSourceSQLServerTaskOutputAgentJobLevel agentJob level output for the task that validates -// connection to SQL Server and also validates source server requirements -type ConnectToSourceSQLServerTaskOutputAgentJobLevel struct { - // Name - READ-ONLY; AgentJob name - Name *string `json:"name,omitempty"` - // JobCategory - READ-ONLY; The type of AgentJob. - JobCategory *string `json:"jobCategory,omitempty"` - // IsEnabled - READ-ONLY; The state of the original AgentJob. - IsEnabled *bool `json:"isEnabled,omitempty"` - // JobOwner - READ-ONLY; The owner of the AgentJob - JobOwner *string `json:"jobOwner,omitempty"` - // LastExecutedOn - READ-ONLY; UTC Date and time when the AgentJob was last executed. - LastExecutedOn *date.Time `json:"lastExecutedOn,omitempty"` - // MigrationEligibility - READ-ONLY; Information about eligibility of agent job for migration. - MigrationEligibility *MigrationEligibilityInfo `json:"migrationEligibility,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput' - ResultType ResultTypeBasicConnectToSourceSQLServerTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToSourceSQLServerTaskOutputAgentJobLevel. -func (ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel) MarshalJSON() ([]byte, error) { - ctssstoajl.ResultType = ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput - objectMap := make(map[string]interface{}) - if ctssstoajl.ResultType != "" { - objectMap["resultType"] = ctssstoajl.ResultType - } - return json.Marshal(objectMap) -} - -// AsConnectToSourceSQLServerTaskOutputAgentJobLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputAgentJobLevel. -func (ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel) AsConnectToSourceSQLServerTaskOutputAgentJobLevel() (*ConnectToSourceSQLServerTaskOutputAgentJobLevel, bool) { - return &ctssstoajl, true -} - -// AsConnectToSourceSQLServerTaskOutputLoginLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputAgentJobLevel. -func (ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel) AsConnectToSourceSQLServerTaskOutputLoginLevel() (*ConnectToSourceSQLServerTaskOutputLoginLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutputDatabaseLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputAgentJobLevel. -func (ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel) AsConnectToSourceSQLServerTaskOutputDatabaseLevel() (*ConnectToSourceSQLServerTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutputTaskLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputAgentJobLevel. -func (ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel) AsConnectToSourceSQLServerTaskOutputTaskLevel() (*ConnectToSourceSQLServerTaskOutputTaskLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputAgentJobLevel. -func (ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel) AsConnectToSourceSQLServerTaskOutput() (*ConnectToSourceSQLServerTaskOutput, bool) { - return nil, false -} - -// AsBasicConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputAgentJobLevel. -func (ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel) AsBasicConnectToSourceSQLServerTaskOutput() (BasicConnectToSourceSQLServerTaskOutput, bool) { - return &ctssstoajl, true -} - -// ConnectToSourceSQLServerTaskOutputDatabaseLevel database level output for the task that validates -// connection to SQL Server and also validates source server requirements -type ConnectToSourceSQLServerTaskOutputDatabaseLevel struct { - // Name - READ-ONLY; Database name - Name *string `json:"name,omitempty"` - // SizeMB - READ-ONLY; Size of the file in megabytes - SizeMB *float64 `json:"sizeMB,omitempty"` - // DatabaseFiles - READ-ONLY; The list of database files - DatabaseFiles *[]DatabaseFileInfo `json:"databaseFiles,omitempty"` - // CompatibilityLevel - READ-ONLY; SQL Server compatibility level of database. Possible values include: 'CompatLevel80', 'CompatLevel90', 'CompatLevel100', 'CompatLevel110', 'CompatLevel120', 'CompatLevel130', 'CompatLevel140' - CompatibilityLevel DatabaseCompatLevel `json:"compatibilityLevel,omitempty"` - // DatabaseState - READ-ONLY; State of the database. Possible values include: 'DatabaseStateOnline', 'DatabaseStateRestoring', 'DatabaseStateRecovering', 'DatabaseStateRecoveryPending', 'DatabaseStateSuspect', 'DatabaseStateEmergency', 'DatabaseStateOffline', 'DatabaseStateCopying', 'DatabaseStateOfflineSecondary' - DatabaseState DatabaseState `json:"databaseState,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput' - ResultType ResultTypeBasicConnectToSourceSQLServerTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToSourceSQLServerTaskOutputDatabaseLevel. -func (ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel) MarshalJSON() ([]byte, error) { - ctssstodl.ResultType = ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput - objectMap := make(map[string]interface{}) - if ctssstodl.ResultType != "" { - objectMap["resultType"] = ctssstodl.ResultType - } - return json.Marshal(objectMap) -} - -// AsConnectToSourceSQLServerTaskOutputAgentJobLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputDatabaseLevel. -func (ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel) AsConnectToSourceSQLServerTaskOutputAgentJobLevel() (*ConnectToSourceSQLServerTaskOutputAgentJobLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutputLoginLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputDatabaseLevel. -func (ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel) AsConnectToSourceSQLServerTaskOutputLoginLevel() (*ConnectToSourceSQLServerTaskOutputLoginLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutputDatabaseLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputDatabaseLevel. -func (ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel) AsConnectToSourceSQLServerTaskOutputDatabaseLevel() (*ConnectToSourceSQLServerTaskOutputDatabaseLevel, bool) { - return &ctssstodl, true -} - -// AsConnectToSourceSQLServerTaskOutputTaskLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputDatabaseLevel. -func (ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel) AsConnectToSourceSQLServerTaskOutputTaskLevel() (*ConnectToSourceSQLServerTaskOutputTaskLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputDatabaseLevel. -func (ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel) AsConnectToSourceSQLServerTaskOutput() (*ConnectToSourceSQLServerTaskOutput, bool) { - return nil, false -} - -// AsBasicConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputDatabaseLevel. -func (ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel) AsBasicConnectToSourceSQLServerTaskOutput() (BasicConnectToSourceSQLServerTaskOutput, bool) { - return &ctssstodl, true -} - -// ConnectToSourceSQLServerTaskOutputLoginLevel login level output for the task that validates connection -// to SQL Server and also validates source server requirements -type ConnectToSourceSQLServerTaskOutputLoginLevel struct { - // Name - READ-ONLY; Login name. - Name *string `json:"name,omitempty"` - // LoginType - READ-ONLY; The type of login. Possible values include: 'WindowsUser', 'WindowsGroup', 'SQLLogin', 'Certificate', 'AsymmetricKey', 'ExternalUser', 'ExternalGroup' - LoginType LoginType `json:"loginType,omitempty"` - // DefaultDatabase - READ-ONLY; The default database for the login. - DefaultDatabase *string `json:"defaultDatabase,omitempty"` - // IsEnabled - READ-ONLY; The state of the login. - IsEnabled *bool `json:"isEnabled,omitempty"` - // MigrationEligibility - READ-ONLY; Information about eligibility of login for migration. - MigrationEligibility *MigrationEligibilityInfo `json:"migrationEligibility,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput' - ResultType ResultTypeBasicConnectToSourceSQLServerTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToSourceSQLServerTaskOutputLoginLevel. -func (ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel) MarshalJSON() ([]byte, error) { - ctssstoll.ResultType = ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput - objectMap := make(map[string]interface{}) - if ctssstoll.ResultType != "" { - objectMap["resultType"] = ctssstoll.ResultType - } - return json.Marshal(objectMap) -} - -// AsConnectToSourceSQLServerTaskOutputAgentJobLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputLoginLevel. -func (ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel) AsConnectToSourceSQLServerTaskOutputAgentJobLevel() (*ConnectToSourceSQLServerTaskOutputAgentJobLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutputLoginLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputLoginLevel. -func (ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel) AsConnectToSourceSQLServerTaskOutputLoginLevel() (*ConnectToSourceSQLServerTaskOutputLoginLevel, bool) { - return &ctssstoll, true -} - -// AsConnectToSourceSQLServerTaskOutputDatabaseLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputLoginLevel. -func (ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel) AsConnectToSourceSQLServerTaskOutputDatabaseLevel() (*ConnectToSourceSQLServerTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutputTaskLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputLoginLevel. -func (ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel) AsConnectToSourceSQLServerTaskOutputTaskLevel() (*ConnectToSourceSQLServerTaskOutputTaskLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputLoginLevel. -func (ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel) AsConnectToSourceSQLServerTaskOutput() (*ConnectToSourceSQLServerTaskOutput, bool) { - return nil, false -} - -// AsBasicConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputLoginLevel. -func (ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel) AsBasicConnectToSourceSQLServerTaskOutput() (BasicConnectToSourceSQLServerTaskOutput, bool) { - return &ctssstoll, true -} - -// ConnectToSourceSQLServerTaskOutputTaskLevel task level output for the task that validates connection to -// SQL Server and also validates source server requirements -type ConnectToSourceSQLServerTaskOutputTaskLevel struct { - // Databases - READ-ONLY; Source databases as a map from database name to database id - Databases map[string]*string `json:"databases"` - // Logins - READ-ONLY; Source logins as a map from login name to login id. - Logins map[string]*string `json:"logins"` - // AgentJobs - READ-ONLY; Source agent jobs as a map from agent job name to id. - AgentJobs map[string]*string `json:"agentJobs"` - // SourceServerVersion - READ-ONLY; Source server version - SourceServerVersion *string `json:"sourceServerVersion,omitempty"` - // SourceServerBrandVersion - READ-ONLY; Source server brand version - SourceServerBrandVersion *string `json:"sourceServerBrandVersion,omitempty"` - // ValidationErrors - READ-ONLY; Validation errors - ValidationErrors *[]ReportableException `json:"validationErrors,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput' - ResultType ResultTypeBasicConnectToSourceSQLServerTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToSourceSQLServerTaskOutputTaskLevel. -func (ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel) MarshalJSON() ([]byte, error) { - ctssstotl.ResultType = ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput - objectMap := make(map[string]interface{}) - if ctssstotl.ResultType != "" { - objectMap["resultType"] = ctssstotl.ResultType - } - return json.Marshal(objectMap) -} - -// AsConnectToSourceSQLServerTaskOutputAgentJobLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputTaskLevel. -func (ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel) AsConnectToSourceSQLServerTaskOutputAgentJobLevel() (*ConnectToSourceSQLServerTaskOutputAgentJobLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutputLoginLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputTaskLevel. -func (ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel) AsConnectToSourceSQLServerTaskOutputLoginLevel() (*ConnectToSourceSQLServerTaskOutputLoginLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutputDatabaseLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputTaskLevel. -func (ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel) AsConnectToSourceSQLServerTaskOutputDatabaseLevel() (*ConnectToSourceSQLServerTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskOutputTaskLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputTaskLevel. -func (ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel) AsConnectToSourceSQLServerTaskOutputTaskLevel() (*ConnectToSourceSQLServerTaskOutputTaskLevel, bool) { - return &ctssstotl, true -} - -// AsConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputTaskLevel. -func (ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel) AsConnectToSourceSQLServerTaskOutput() (*ConnectToSourceSQLServerTaskOutput, bool) { - return nil, false -} - -// AsBasicConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputTaskLevel. -func (ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel) AsBasicConnectToSourceSQLServerTaskOutput() (BasicConnectToSourceSQLServerTaskOutput, bool) { - return &ctssstotl, true -} - -// ConnectToSourceSQLServerTaskProperties properties for the task that validates connection to SQL Server -// and also validates source server requirements -type ConnectToSourceSQLServerTaskProperties struct { - // Input - Task input - Input *ConnectToSourceSQLServerTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]BasicConnectToSourceSQLServerTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) MarshalJSON() ([]byte, error) { - ctssstp.TaskType = TaskTypeConnectToSourceSQLServer - objectMap := make(map[string]interface{}) - if ctssstp.Input != nil { - objectMap["input"] = ctssstp.Input - } - if ctssstp.TaskType != "" { - objectMap["taskType"] = ctssstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return &ctssstp, true -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. -func (ctssstp ConnectToSourceSQLServerTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &ctssstp, true -} - -// UnmarshalJSON is the custom unmarshaler for ConnectToSourceSQLServerTaskProperties struct. -func (ctssstp *ConnectToSourceSQLServerTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input ConnectToSourceSQLServerTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - ctssstp.Input = &input - } - case "output": - if v != nil { - output, err := unmarshalBasicConnectToSourceSQLServerTaskOutputArray(*v) - if err != nil { - return err - } - ctssstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - ctssstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - ctssstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - ctssstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - ctssstp.TaskType = taskType - } - } - } - - return nil -} - -// ConnectToTargetAzureDbForMySQLTaskInput input for the task that validates connection to Azure Database -// for MySQL and target server requirements -type ConnectToTargetAzureDbForMySQLTaskInput struct { - // SourceConnectionInfo - Connection information for source MySQL server - SourceConnectionInfo *MySQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetConnectionInfo - Connection information for target Azure Database for MySQL server - TargetConnectionInfo *MySQLConnectionInfo `json:"targetConnectionInfo,omitempty"` -} - -// ConnectToTargetAzureDbForMySQLTaskOutput output for the task that validates connection to Azure Database -// for MySQL and target server requirements -type ConnectToTargetAzureDbForMySQLTaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ServerVersion - READ-ONLY; Version of the target server - ServerVersion *string `json:"serverVersion,omitempty"` - // Databases - READ-ONLY; List of databases on target server - Databases *[]string `json:"databases,omitempty"` - // TargetServerBrandVersion - READ-ONLY; Target server brand version - TargetServerBrandVersion *string `json:"targetServerBrandVersion,omitempty"` - // ValidationErrors - READ-ONLY; Validation errors associated with the task - ValidationErrors *[]ReportableException `json:"validationErrors,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToTargetAzureDbForMySQLTaskOutput. -func (cttadfmsto ConnectToTargetAzureDbForMySQLTaskOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConnectToTargetAzureDbForMySQLTaskProperties properties for the task that validates connection to Azure -// Database for MySQL and target server requirements -type ConnectToTargetAzureDbForMySQLTaskProperties struct { - // Input - Task input - Input *ConnectToTargetAzureDbForMySQLTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]ConnectToTargetAzureDbForMySQLTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) MarshalJSON() ([]byte, error) { - cttadfmstp.TaskType = TaskTypeConnectToTargetAzureDbForMySQL - objectMap := make(map[string]interface{}) - if cttadfmstp.Input != nil { - objectMap["input"] = cttadfmstp.Input - } - if cttadfmstp.TaskType != "" { - objectMap["taskType"] = cttadfmstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return &cttadfmstp, true -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForMySQLTaskProperties. -func (cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &cttadfmstp, true -} - -// UnmarshalJSON is the custom unmarshaler for ConnectToTargetAzureDbForMySQLTaskProperties struct. -func (cttadfmstp *ConnectToTargetAzureDbForMySQLTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input ConnectToTargetAzureDbForMySQLTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - cttadfmstp.Input = &input - } - case "output": - if v != nil { - var output []ConnectToTargetAzureDbForMySQLTaskOutput - err = json.Unmarshal(*v, &output) - if err != nil { - return err - } - cttadfmstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - cttadfmstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - cttadfmstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - cttadfmstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - cttadfmstp.TaskType = taskType - } - } - } - - return nil -} - -// ConnectToTargetAzureDbForPostgreSQLSyncTaskInput input for the task that validates connection to Azure -// Database for PostgreSQL and target server requirements -type ConnectToTargetAzureDbForPostgreSQLSyncTaskInput struct { - // SourceConnectionInfo - Connection information for source PostgreSQL server - SourceConnectionInfo *PostgreSQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetConnectionInfo - Connection information for target Azure Database for PostgreSQL server - TargetConnectionInfo *PostgreSQLConnectionInfo `json:"targetConnectionInfo,omitempty"` -} - -// ConnectToTargetAzureDbForPostgreSQLSyncTaskOutput output for the task that validates connection to Azure -// Database for PostgreSQL and target server requirements -type ConnectToTargetAzureDbForPostgreSQLSyncTaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // TargetServerVersion - READ-ONLY; Version of the target server - TargetServerVersion *string `json:"targetServerVersion,omitempty"` - // Databases - READ-ONLY; List of databases on target server - Databases *[]string `json:"databases,omitempty"` - // TargetServerBrandVersion - READ-ONLY; Target server brand version - TargetServerBrandVersion *string `json:"targetServerBrandVersion,omitempty"` - // ValidationErrors - READ-ONLY; Validation errors associated with the task - ValidationErrors *[]ReportableException `json:"validationErrors,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToTargetAzureDbForPostgreSQLSyncTaskOutput. -func (cttadfpssto ConnectToTargetAzureDbForPostgreSQLSyncTaskOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties properties for the task that validates connection -// to Azure Database For PostgreSQL server and target server requirements for online migration -type ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties struct { - // Input - Task input - Input *ConnectToTargetAzureDbForPostgreSQLSyncTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]ConnectToTargetAzureDbForPostgreSQLSyncTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) MarshalJSON() ([]byte, error) { - cttadfpsstp.TaskType = TaskTypeConnectToTargetAzureDbForPostgreSQLSync - objectMap := make(map[string]interface{}) - if cttadfpsstp.Input != nil { - objectMap["input"] = cttadfpsstp.Input - } - if cttadfpsstp.TaskType != "" { - objectMap["taskType"] = cttadfpsstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return &cttadfpsstp, true -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties. -func (cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &cttadfpsstp, true -} - -// UnmarshalJSON is the custom unmarshaler for ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties struct. -func (cttadfpsstp *ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input ConnectToTargetAzureDbForPostgreSQLSyncTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - cttadfpsstp.Input = &input - } - case "output": - if v != nil { - var output []ConnectToTargetAzureDbForPostgreSQLSyncTaskOutput - err = json.Unmarshal(*v, &output) - if err != nil { - return err - } - cttadfpsstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - cttadfpsstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - cttadfpsstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - cttadfpsstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - cttadfpsstp.TaskType = taskType - } - } - } - - return nil -} - -// ConnectToTargetSQLDbTaskInput input for the task that validates connection to SQL DB and target server -// requirements -type ConnectToTargetSQLDbTaskInput struct { - // TargetConnectionInfo - Connection information for target SQL DB - TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` -} - -// ConnectToTargetSQLDbTaskOutput output for the task that validates connection to SQL DB and target server -// requirements -type ConnectToTargetSQLDbTaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // Databases - READ-ONLY; Source databases as a map from database name to database id - Databases map[string]*string `json:"databases"` - // TargetServerVersion - READ-ONLY; Version of the target server - TargetServerVersion *string `json:"targetServerVersion,omitempty"` - // TargetServerBrandVersion - READ-ONLY; Target server brand version - TargetServerBrandVersion *string `json:"targetServerBrandVersion,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToTargetSQLDbTaskOutput. -func (cttsdto ConnectToTargetSQLDbTaskOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConnectToTargetSQLDbTaskProperties properties for the task that validates connection to SQL DB and -// target server requirements -type ConnectToTargetSQLDbTaskProperties struct { - // Input - Task input - Input *ConnectToTargetSQLDbTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]ConnectToTargetSQLDbTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) MarshalJSON() ([]byte, error) { - cttsdtp.TaskType = TaskTypeConnectToTargetSQLDb - objectMap := make(map[string]interface{}) - if cttsdtp.Input != nil { - objectMap["input"] = cttsdtp.Input - } - if cttsdtp.TaskType != "" { - objectMap["taskType"] = cttsdtp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return &cttsdtp, true -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. -func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &cttsdtp, true -} - -// UnmarshalJSON is the custom unmarshaler for ConnectToTargetSQLDbTaskProperties struct. -func (cttsdtp *ConnectToTargetSQLDbTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input ConnectToTargetSQLDbTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - cttsdtp.Input = &input - } - case "output": - if v != nil { - var output []ConnectToTargetSQLDbTaskOutput - err = json.Unmarshal(*v, &output) - if err != nil { - return err - } - cttsdtp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - cttsdtp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - cttsdtp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - cttsdtp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - cttsdtp.TaskType = taskType - } - } - } - - return nil -} - -// ConnectToTargetSQLMISyncTaskInput input for the task that validates connection to Azure SQL Database -// Managed Instance online scenario. -type ConnectToTargetSQLMISyncTaskInput struct { - // TargetConnectionInfo - Connection information for Azure SQL Database Managed Instance - TargetConnectionInfo *MiSQLConnectionInfo `json:"targetConnectionInfo,omitempty"` - // AzureApp - Azure Active Directory Application the DMS instance will use to connect to the target instance of Azure SQL Database Managed Instance and the Azure Storage Account - AzureApp *AzureActiveDirectoryApp `json:"azureApp,omitempty"` -} - -// ConnectToTargetSQLMISyncTaskOutput output for the task that validates connection to Azure SQL Database -// Managed Instance. -type ConnectToTargetSQLMISyncTaskOutput struct { - // TargetServerVersion - READ-ONLY; Target server version - TargetServerVersion *string `json:"targetServerVersion,omitempty"` - // TargetServerBrandVersion - READ-ONLY; Target server brand version - TargetServerBrandVersion *string `json:"targetServerBrandVersion,omitempty"` - // ValidationErrors - READ-ONLY; Validation errors - ValidationErrors *[]ReportableException `json:"validationErrors,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToTargetSQLMISyncTaskOutput. -func (cttsmsto ConnectToTargetSQLMISyncTaskOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConnectToTargetSQLMISyncTaskProperties properties for the task that validates connection to Azure SQL -// Database Managed Instance -type ConnectToTargetSQLMISyncTaskProperties struct { - // Input - Task input - Input *ConnectToTargetSQLMISyncTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]ConnectToTargetSQLMISyncTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) MarshalJSON() ([]byte, error) { - cttsmstp.TaskType = TaskTypeConnectToTargetAzureSQLDbMISyncLRS - objectMap := make(map[string]interface{}) - if cttsmstp.Input != nil { - objectMap["input"] = cttsmstp.Input - } - if cttsmstp.TaskType != "" { - objectMap["taskType"] = cttsmstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return &cttsmstp, true -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMISyncTaskProperties. -func (cttsmstp ConnectToTargetSQLMISyncTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &cttsmstp, true -} - -// UnmarshalJSON is the custom unmarshaler for ConnectToTargetSQLMISyncTaskProperties struct. -func (cttsmstp *ConnectToTargetSQLMISyncTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input ConnectToTargetSQLMISyncTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - cttsmstp.Input = &input - } - case "output": - if v != nil { - var output []ConnectToTargetSQLMISyncTaskOutput - err = json.Unmarshal(*v, &output) - if err != nil { - return err - } - cttsmstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - cttsmstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - cttsmstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - cttsmstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - cttsmstp.TaskType = taskType - } - } - } - - return nil -} - -// ConnectToTargetSQLMITaskInput input for the task that validates connection to Azure SQL Database Managed -// Instance. -type ConnectToTargetSQLMITaskInput struct { - // TargetConnectionInfo - Connection information for target SQL Server - TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` -} - -// ConnectToTargetSQLMITaskOutput output for the task that validates connection to Azure SQL Database -// Managed Instance. -type ConnectToTargetSQLMITaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // TargetServerVersion - READ-ONLY; Target server version - TargetServerVersion *string `json:"targetServerVersion,omitempty"` - // TargetServerBrandVersion - READ-ONLY; Target server brand version - TargetServerBrandVersion *string `json:"targetServerBrandVersion,omitempty"` - // Logins - READ-ONLY; List of logins on the target server. - Logins *[]string `json:"logins,omitempty"` - // AgentJobs - READ-ONLY; List of agent jobs on the target server. - AgentJobs *[]string `json:"agentJobs,omitempty"` - // ValidationErrors - READ-ONLY; Validation errors - ValidationErrors *[]ReportableException `json:"validationErrors,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToTargetSQLMITaskOutput. -func (cttsmto ConnectToTargetSQLMITaskOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConnectToTargetSQLMITaskProperties properties for the task that validates connection to Azure SQL -// Database Managed Instance -type ConnectToTargetSQLMITaskProperties struct { - // Input - Task input - Input *ConnectToTargetSQLMITaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]ConnectToTargetSQLMITaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) MarshalJSON() ([]byte, error) { - cttsmtp.TaskType = TaskTypeConnectToTargetAzureSQLDbMI - objectMap := make(map[string]interface{}) - if cttsmtp.Input != nil { - objectMap["input"] = cttsmtp.Input - } - if cttsmtp.TaskType != "" { - objectMap["taskType"] = cttsmtp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return &cttsmtp, true -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. -func (cttsmtp ConnectToTargetSQLMITaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &cttsmtp, true -} - -// UnmarshalJSON is the custom unmarshaler for ConnectToTargetSQLMITaskProperties struct. -func (cttsmtp *ConnectToTargetSQLMITaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input ConnectToTargetSQLMITaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - cttsmtp.Input = &input - } - case "output": - if v != nil { - var output []ConnectToTargetSQLMITaskOutput - err = json.Unmarshal(*v, &output) - if err != nil { - return err - } - cttsmtp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - cttsmtp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - cttsmtp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - cttsmtp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - cttsmtp.TaskType = taskType - } - } - } - - return nil -} - -// ConnectToTargetSQLSQLDbSyncTaskInput input for the task that validates connection to Azure SQL DB and -// target server requirements -type ConnectToTargetSQLSQLDbSyncTaskInput struct { - // SourceConnectionInfo - Connection information for source SQL Server - SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetConnectionInfo - Connection information for target SQL DB - TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` -} - -// ConnectToTargetSQLSQLDbSyncTaskProperties properties for the task that validates connection to SQL DB -// and target server requirements for online migration -type ConnectToTargetSQLSQLDbSyncTaskProperties struct { - // Input - Task input - Input *ConnectToTargetSQLSQLDbSyncTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]ConnectToTargetSQLDbTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) MarshalJSON() ([]byte, error) { - cttssdstp.TaskType = TaskTypeConnectToTargetSQLDbSync - objectMap := make(map[string]interface{}) - if cttssdstp.Input != nil { - objectMap["input"] = cttssdstp.Input - } - if cttssdstp.TaskType != "" { - objectMap["taskType"] = cttssdstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return &cttssdstp, true -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLSQLDbSyncTaskProperties. -func (cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &cttssdstp, true -} - -// UnmarshalJSON is the custom unmarshaler for ConnectToTargetSQLSQLDbSyncTaskProperties struct. -func (cttssdstp *ConnectToTargetSQLSQLDbSyncTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input ConnectToTargetSQLSQLDbSyncTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - cttssdstp.Input = &input - } - case "output": - if v != nil { - var output []ConnectToTargetSQLDbTaskOutput - err = json.Unmarshal(*v, &output) - if err != nil { - return err - } - cttssdstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - cttssdstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - cttssdstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - cttssdstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - cttssdstp.TaskType = taskType - } - } - } - - return nil -} - -// Database information about a single database -type Database struct { - // ID - READ-ONLY; Unique identifier for the database - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the database - Name *string `json:"name,omitempty"` - // CompatibilityLevel - READ-ONLY; SQL Server compatibility level of database. Possible values include: 'CompatLevel80', 'CompatLevel90', 'CompatLevel100', 'CompatLevel110', 'CompatLevel120', 'CompatLevel130', 'CompatLevel140' - CompatibilityLevel DatabaseCompatLevel `json:"compatibilityLevel,omitempty"` - // Collation - READ-ONLY; Collation name of the database - Collation *string `json:"collation,omitempty"` - // ServerName - READ-ONLY; Name of the server - ServerName *string `json:"serverName,omitempty"` - // Fqdn - READ-ONLY; Fully qualified name - Fqdn *string `json:"fqdn,omitempty"` - // InstallID - READ-ONLY; Install id of the database - InstallID *string `json:"installId,omitempty"` - // ServerVersion - READ-ONLY; Version of the server - ServerVersion *string `json:"serverVersion,omitempty"` - // ServerEdition - READ-ONLY; Edition of the server - ServerEdition *string `json:"serverEdition,omitempty"` - // ServerLevel - READ-ONLY; Product level of the server (RTM, SP, CTP). - ServerLevel *string `json:"serverLevel,omitempty"` - // ServerDefaultDataPath - READ-ONLY; Default path of the data files - ServerDefaultDataPath *string `json:"serverDefaultDataPath,omitempty"` - // ServerDefaultLogPath - READ-ONLY; Default path of the log files - ServerDefaultLogPath *string `json:"serverDefaultLogPath,omitempty"` - // ServerDefaultBackupPath - READ-ONLY; Default path of the backup folder - ServerDefaultBackupPath *string `json:"serverDefaultBackupPath,omitempty"` - // ServerCoreCount - READ-ONLY; Number of cores on the server - ServerCoreCount *int32 `json:"serverCoreCount,omitempty"` - // ServerVisibleOnlineCoreCount - READ-ONLY; Number of cores on the server that have VISIBLE ONLINE status - ServerVisibleOnlineCoreCount *int32 `json:"serverVisibleOnlineCoreCount,omitempty"` - // DatabaseState - READ-ONLY; State of the database. Possible values include: 'DatabaseStateOnline', 'DatabaseStateRestoring', 'DatabaseStateRecovering', 'DatabaseStateRecoveryPending', 'DatabaseStateSuspect', 'DatabaseStateEmergency', 'DatabaseStateOffline', 'DatabaseStateCopying', 'DatabaseStateOfflineSecondary' - DatabaseState DatabaseState `json:"databaseState,omitempty"` - // ServerID - READ-ONLY; The unique Server Id - ServerID *string `json:"serverId,omitempty"` -} - -// MarshalJSON is the custom marshaler for Database. -func (d Database) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseBackupInfo information about backup files when existing backup mode is used. -type DatabaseBackupInfo struct { - // DatabaseName - READ-ONLY; Database name. - DatabaseName *string `json:"databaseName,omitempty"` - // BackupType - READ-ONLY; Backup Type. Possible values include: 'BackupTypeDatabase', 'BackupTypeTransactionLog', 'BackupTypeFile', 'BackupTypeDifferentialDatabase', 'BackupTypeDifferentialFile', 'BackupTypePartial', 'BackupTypeDifferentialPartial' - BackupType BackupType `json:"backupType,omitempty"` - // BackupFiles - READ-ONLY; The list of backup files for the current database. - BackupFiles *[]string `json:"backupFiles,omitempty"` - // Position - READ-ONLY; Position of current database backup in the file. - Position *int32 `json:"position,omitempty"` - // IsDamaged - READ-ONLY; Database was damaged when backed up, but the backup operation was requested to continue despite errors. - IsDamaged *bool `json:"isDamaged,omitempty"` - // IsCompressed - READ-ONLY; Whether the backup set is compressed - IsCompressed *bool `json:"isCompressed,omitempty"` - // FamilyCount - READ-ONLY; Number of files in the backup set. - FamilyCount *int32 `json:"familyCount,omitempty"` - // BackupFinishDate - READ-ONLY; Date and time when the backup operation finished. - BackupFinishDate *date.Time `json:"backupFinishDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseBackupInfo. -func (dbi DatabaseBackupInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseFileInfo database file specific information -type DatabaseFileInfo struct { - // DatabaseName - Name of the database - DatabaseName *string `json:"databaseName,omitempty"` - // ID - Unique identifier for database file - ID *string `json:"id,omitempty"` - // LogicalName - Logical name of the file - LogicalName *string `json:"logicalName,omitempty"` - // PhysicalFullName - Operating-system full path of the file - PhysicalFullName *string `json:"physicalFullName,omitempty"` - // RestoreFullName - Suggested full path of the file for restoring - RestoreFullName *string `json:"restoreFullName,omitempty"` - // FileType - Database file type. Possible values include: 'Rows', 'Log', 'Filestream', 'NotSupported', 'Fulltext' - FileType DatabaseFileType `json:"fileType,omitempty"` - // SizeMB - Size of the file in megabytes - SizeMB *float64 `json:"sizeMB,omitempty"` -} - -// DatabaseFileInput database file specific information for input -type DatabaseFileInput struct { - // ID - Unique identifier for database file - ID *string `json:"id,omitempty"` - // LogicalName - Logical name of the file - LogicalName *string `json:"logicalName,omitempty"` - // PhysicalFullName - Operating-system full path of the file - PhysicalFullName *string `json:"physicalFullName,omitempty"` - // RestoreFullName - Suggested full path of the file for restoring - RestoreFullName *string `json:"restoreFullName,omitempty"` - // FileType - Database file type. Possible values include: 'Rows', 'Log', 'Filestream', 'NotSupported', 'Fulltext' - FileType DatabaseFileType `json:"fileType,omitempty"` -} - -// DatabaseInfo project Database Details -type DatabaseInfo struct { - // SourceDatabaseName - Name of the database - SourceDatabaseName *string `json:"sourceDatabaseName,omitempty"` -} - -// DatabaseObjectName a representation of the name of an object in a database -type DatabaseObjectName struct { - // DatabaseName - READ-ONLY; The unescaped name of the database containing the object - DatabaseName *string `json:"databaseName,omitempty"` - // ObjectName - READ-ONLY; The unescaped name of the object - ObjectName *string `json:"objectName,omitempty"` - // SchemaName - READ-ONLY; The unescaped name of the schema containing the object - SchemaName *string `json:"schemaName,omitempty"` - // ObjectType - Type of the object in the database. Possible values include: 'StoredProcedures', 'Table', 'User', 'View', 'Function' - ObjectType ObjectType `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseObjectName. -func (don DatabaseObjectName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if don.ObjectType != "" { - objectMap["objectType"] = don.ObjectType - } - return json.Marshal(objectMap) -} - -// DatabaseSummaryResult summary of database results in the migration -type DatabaseSummaryResult struct { - // SizeMB - READ-ONLY; Size of the database in megabytes - SizeMB *float64 `json:"sizeMB,omitempty"` - // Name - READ-ONLY; Name of the item - Name *string `json:"name,omitempty"` - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // State - READ-ONLY; Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' - State MigrationState `json:"state,omitempty"` - // StatusMessage - READ-ONLY; Status message - StatusMessage *string `json:"statusMessage,omitempty"` - // ItemsCount - READ-ONLY; Number of items - ItemsCount *int64 `json:"itemsCount,omitempty"` - // ItemsCompletedCount - READ-ONLY; Number of successfully completed items - ItemsCompletedCount *int64 `json:"itemsCompletedCount,omitempty"` - // ErrorPrefix - READ-ONLY; Wildcard string prefix to use for querying all errors of the item - ErrorPrefix *string `json:"errorPrefix,omitempty"` - // ResultPrefix - READ-ONLY; Wildcard string prefix to use for querying all sub-tem results of the item - ResultPrefix *string `json:"resultPrefix,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseSummaryResult. -func (dsr DatabaseSummaryResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DatabaseTable table properties -type DatabaseTable struct { - // HasRows - READ-ONLY; Indicates whether table is empty or not - HasRows *bool `json:"hasRows,omitempty"` - // Name - READ-ONLY; Schema-qualified name of the table - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseTable. -func (dt DatabaseTable) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DataIntegrityValidationResult results for checksum based Data Integrity validation results -type DataIntegrityValidationResult struct { - // FailedObjects - READ-ONLY; List of failed table names of source and target pair - FailedObjects map[string]*string `json:"failedObjects"` - // ValidationErrors - READ-ONLY; List of errors that happened while performing data integrity validation - ValidationErrors *ValidationError `json:"validationErrors,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataIntegrityValidationResult. -func (divr DataIntegrityValidationResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DataItemMigrationSummaryResult basic summary of a data item migration -type DataItemMigrationSummaryResult struct { - // Name - READ-ONLY; Name of the item - Name *string `json:"name,omitempty"` - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // State - READ-ONLY; Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' - State MigrationState `json:"state,omitempty"` - // StatusMessage - READ-ONLY; Status message - StatusMessage *string `json:"statusMessage,omitempty"` - // ItemsCount - READ-ONLY; Number of items - ItemsCount *int64 `json:"itemsCount,omitempty"` - // ItemsCompletedCount - READ-ONLY; Number of successfully completed items - ItemsCompletedCount *int64 `json:"itemsCompletedCount,omitempty"` - // ErrorPrefix - READ-ONLY; Wildcard string prefix to use for querying all errors of the item - ErrorPrefix *string `json:"errorPrefix,omitempty"` - // ResultPrefix - READ-ONLY; Wildcard string prefix to use for querying all sub-tem results of the item - ResultPrefix *string `json:"resultPrefix,omitempty"` -} - -// MarshalJSON is the custom marshaler for DataItemMigrationSummaryResult. -func (dimsr DataItemMigrationSummaryResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Error migration Task errors -type Error struct { - // Message - READ-ONLY; Error description - Message *string `json:"message,omitempty"` - // Type - Type of error. Possible values include: 'ErrorTypeDefault', 'ErrorTypeWarning', 'ErrorTypeError' - Type ErrorType `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Error. -func (e Error) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if e.Type != "" { - objectMap["type"] = e.Type - } - return json.Marshal(objectMap) -} - -// ExecutionStatistics description about the errors happen while performing migration validation -type ExecutionStatistics struct { - // ExecutionCount - READ-ONLY; No. of query executions - ExecutionCount *int64 `json:"executionCount,omitempty"` - // CPUTimeMs - READ-ONLY; CPU Time in millisecond(s) for the query execution - CPUTimeMs *float64 `json:"cpuTimeMs,omitempty"` - // ElapsedTimeMs - READ-ONLY; Time taken in millisecond(s) for executing the query - ElapsedTimeMs *float64 `json:"elapsedTimeMs,omitempty"` - // WaitStats - Dictionary of sql query execution wait types and the respective statistics - WaitStats map[string]*WaitStatistics `json:"waitStats"` - // HasErrors - READ-ONLY; Indicates whether the query resulted in an error - HasErrors *bool `json:"hasErrors,omitempty"` - // SQLErrors - READ-ONLY; List of sql Errors - SQLErrors *[]string `json:"sqlErrors,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExecutionStatistics. -func (es ExecutionStatistics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if es.WaitStats != nil { - objectMap["waitStats"] = es.WaitStats - } - return json.Marshal(objectMap) -} - -// FileShare file share information with Path, Username, and Password. -type FileShare struct { - // UserName - User name credential to connect to the share location - UserName *string `json:"userName,omitempty"` - // Password - Password credential used to connect to the share location. - Password *string `json:"password,omitempty"` - // Path - The folder path for this share. - Path *string `json:"path,omitempty"` -} - -// GetProjectDetailsNonSQLTaskInput input for the task that reads configuration from project artifacts -type GetProjectDetailsNonSQLTaskInput struct { - // ProjectName - Name of the migration project - ProjectName *string `json:"projectName,omitempty"` - // ProjectLocation - A URL that points to the location to access project artifacts - ProjectLocation *string `json:"projectLocation,omitempty"` -} - -// GetTdeCertificatesSQLTaskInput input for the task that gets TDE certificates in Base64 encoded format. -type GetTdeCertificatesSQLTaskInput struct { - // ConnectionInfo - Connection information for SQL Server - ConnectionInfo *SQLConnectionInfo `json:"connectionInfo,omitempty"` - // BackupFileShare - Backup file share information for file share to be used for temporarily storing files. - BackupFileShare *FileShare `json:"backupFileShare,omitempty"` - // SelectedCertificates - List containing certificate names and corresponding password to use for encrypting the exported certificate. - SelectedCertificates *[]SelectedCertificateInput `json:"selectedCertificates,omitempty"` -} - -// GetTdeCertificatesSQLTaskOutput output of the task that gets TDE certificates in Base64 encoded format. -type GetTdeCertificatesSQLTaskOutput struct { - // Base64EncodedCertificates - READ-ONLY; Mapping from certificate name to base 64 encoded format. - Base64EncodedCertificates map[string][]string `json:"base64EncodedCertificates"` - // ValidationErrors - READ-ONLY; Validation errors - ValidationErrors *[]ReportableException `json:"validationErrors,omitempty"` -} - -// MarshalJSON is the custom marshaler for GetTdeCertificatesSQLTaskOutput. -func (gtcsto GetTdeCertificatesSQLTaskOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GetTdeCertificatesSQLTaskProperties properties for the task that gets TDE certificates in Base64 encoded -// format. -type GetTdeCertificatesSQLTaskProperties struct { - // Input - Task input - Input *GetTdeCertificatesSQLTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]GetTdeCertificatesSQLTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) MarshalJSON() ([]byte, error) { - gtcstp.TaskType = TaskTypeGetTDECertificatesSQL - objectMap := make(map[string]interface{}) - if gtcstp.Input != nil { - objectMap["input"] = gtcstp.Input - } - if gtcstp.TaskType != "" { - objectMap["taskType"] = gtcstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return >cstp, true -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for GetTdeCertificatesSQLTaskProperties. -func (gtcstp GetTdeCertificatesSQLTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return >cstp, true -} - -// UnmarshalJSON is the custom unmarshaler for GetTdeCertificatesSQLTaskProperties struct. -func (gtcstp *GetTdeCertificatesSQLTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input GetTdeCertificatesSQLTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - gtcstp.Input = &input - } - case "output": - if v != nil { - var output []GetTdeCertificatesSQLTaskOutput - err = json.Unmarshal(*v, &output) - if err != nil { - return err - } - gtcstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - gtcstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - gtcstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - gtcstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - gtcstp.TaskType = taskType - } - } - } - - return nil -} - -// GetUserTablesSQLSyncTaskInput input for the task that collects user tables for the given list of -// databases -type GetUserTablesSQLSyncTaskInput struct { - // SourceConnectionInfo - Connection information for SQL Server - SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetConnectionInfo - Connection information for SQL DB - TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` - // SelectedSourceDatabases - List of source database names to collect tables for - SelectedSourceDatabases *[]string `json:"selectedSourceDatabases,omitempty"` - // SelectedTargetDatabases - List of target database names to collect tables for - SelectedTargetDatabases *[]string `json:"selectedTargetDatabases,omitempty"` -} - -// GetUserTablesSQLSyncTaskOutput output of the task that collects user tables for the given list of -// databases -type GetUserTablesSQLSyncTaskOutput struct { - // DatabasesToSourceTables - READ-ONLY; Mapping from database name to list of source tables - DatabasesToSourceTables map[string][]DatabaseTable `json:"databasesToSourceTables"` - // DatabasesToTargetTables - READ-ONLY; Mapping from database name to list of target tables - DatabasesToTargetTables map[string][]DatabaseTable `json:"databasesToTargetTables"` - // TableValidationErrors - READ-ONLY; Mapping from database name to list of validation errors - TableValidationErrors map[string][]string `json:"tableValidationErrors"` - // ValidationErrors - READ-ONLY; Validation errors - ValidationErrors *[]ReportableException `json:"validationErrors,omitempty"` -} - -// MarshalJSON is the custom marshaler for GetUserTablesSQLSyncTaskOutput. -func (gutssto GetUserTablesSQLSyncTaskOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GetUserTablesSQLSyncTaskProperties properties for the task that collects user tables for the given list -// of databases -type GetUserTablesSQLSyncTaskProperties struct { - // Input - Task input - Input *GetUserTablesSQLSyncTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]GetUserTablesSQLSyncTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) MarshalJSON() ([]byte, error) { - gutsstp.TaskType = TaskTypeGetUserTablesAzureSQLDbSync - objectMap := make(map[string]interface{}) - if gutsstp.Input != nil { - objectMap["input"] = gutsstp.Input - } - if gutsstp.TaskType != "" { - objectMap["taskType"] = gutsstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return &gutsstp, true -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLSyncTaskProperties. -func (gutsstp GetUserTablesSQLSyncTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &gutsstp, true -} - -// UnmarshalJSON is the custom unmarshaler for GetUserTablesSQLSyncTaskProperties struct. -func (gutsstp *GetUserTablesSQLSyncTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input GetUserTablesSQLSyncTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - gutsstp.Input = &input - } - case "output": - if v != nil { - var output []GetUserTablesSQLSyncTaskOutput - err = json.Unmarshal(*v, &output) - if err != nil { - return err - } - gutsstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - gutsstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - gutsstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - gutsstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - gutsstp.TaskType = taskType - } - } - } - - return nil -} - -// GetUserTablesSQLTaskInput input for the task that collects user tables for the given list of databases -type GetUserTablesSQLTaskInput struct { - // ConnectionInfo - Connection information for SQL Server - ConnectionInfo *SQLConnectionInfo `json:"connectionInfo,omitempty"` - // SelectedDatabases - List of database names to collect tables for - SelectedDatabases *[]string `json:"selectedDatabases,omitempty"` -} - -// GetUserTablesSQLTaskOutput output of the task that collects user tables for the given list of databases -type GetUserTablesSQLTaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // DatabasesToTables - READ-ONLY; Mapping from database name to list of tables - DatabasesToTables map[string][]DatabaseTable `json:"databasesToTables"` - // ValidationErrors - READ-ONLY; Validation errors - ValidationErrors *[]ReportableException `json:"validationErrors,omitempty"` -} - -// MarshalJSON is the custom marshaler for GetUserTablesSQLTaskOutput. -func (gutsto GetUserTablesSQLTaskOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GetUserTablesSQLTaskProperties properties for the task that collects user tables for the given list of -// databases -type GetUserTablesSQLTaskProperties struct { - // Input - Task input - Input *GetUserTablesSQLTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]GetUserTablesSQLTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) MarshalJSON() ([]byte, error) { - gutstp.TaskType = TaskTypeGetUserTablesSQL - objectMap := make(map[string]interface{}) - if gutstp.Input != nil { - objectMap["input"] = gutstp.Input - } - if gutstp.TaskType != "" { - objectMap["taskType"] = gutstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return &gutstp, true -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. -func (gutstp GetUserTablesSQLTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &gutstp, true -} - -// UnmarshalJSON is the custom unmarshaler for GetUserTablesSQLTaskProperties struct. -func (gutstp *GetUserTablesSQLTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input GetUserTablesSQLTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - gutstp.Input = &input - } - case "output": - if v != nil { - var output []GetUserTablesSQLTaskOutput - err = json.Unmarshal(*v, &output) - if err != nil { - return err - } - gutstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - gutstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - gutstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - gutstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - gutstp.TaskType = taskType - } - } - } - - return nil -} - -// MigrateMISyncCompleteCommandInput input for command that completes online migration for an Azure SQL -// Database Managed Instance. -type MigrateMISyncCompleteCommandInput struct { - // SourceDatabaseName - Name of managed instance database - SourceDatabaseName *string `json:"sourceDatabaseName,omitempty"` -} - -// MigrateMISyncCompleteCommandOutput output for command that completes online migration for an Azure SQL -// Database Managed Instance. -type MigrateMISyncCompleteCommandOutput struct { - // Errors - List of errors that happened during the command execution - Errors *[]ReportableException `json:"errors,omitempty"` -} - -// MigrateMISyncCompleteCommandProperties properties for the command that completes online migration for an -// Azure SQL Database Managed Instance. -type MigrateMISyncCompleteCommandProperties struct { - // Input - Command input - Input *MigrateMISyncCompleteCommandInput `json:"input,omitempty"` - // Output - READ-ONLY; Command output. This is ignored if submitted. - Output *MigrateMISyncCompleteCommandOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the command. This is ignored if submitted. Possible values include: 'Unknown', 'Accepted', 'Running', 'Succeeded', 'Failed' - State CommandState `json:"state,omitempty"` - // CommandType - Possible values include: 'CommandTypeCommandProperties', 'CommandTypeMigrateSQLServerAzureDbSQLMiComplete', 'CommandTypeMigrateSyncCompleteDatabase' - CommandType CommandType `json:"commandType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateMISyncCompleteCommandProperties. -func (mmsccp MigrateMISyncCompleteCommandProperties) MarshalJSON() ([]byte, error) { - mmsccp.CommandType = CommandTypeMigrateSQLServerAzureDbSQLMiComplete - objectMap := make(map[string]interface{}) - if mmsccp.Input != nil { - objectMap["input"] = mmsccp.Input - } - if mmsccp.CommandType != "" { - objectMap["commandType"] = mmsccp.CommandType - } - return json.Marshal(objectMap) -} - -// AsMigrateMISyncCompleteCommandProperties is the BasicCommandProperties implementation for MigrateMISyncCompleteCommandProperties. -func (mmsccp MigrateMISyncCompleteCommandProperties) AsMigrateMISyncCompleteCommandProperties() (*MigrateMISyncCompleteCommandProperties, bool) { - return &mmsccp, true -} - -// AsMigrateSyncCompleteCommandProperties is the BasicCommandProperties implementation for MigrateMISyncCompleteCommandProperties. -func (mmsccp MigrateMISyncCompleteCommandProperties) AsMigrateSyncCompleteCommandProperties() (*MigrateSyncCompleteCommandProperties, bool) { - return nil, false -} - -// AsCommandProperties is the BasicCommandProperties implementation for MigrateMISyncCompleteCommandProperties. -func (mmsccp MigrateMISyncCompleteCommandProperties) AsCommandProperties() (*CommandProperties, bool) { - return nil, false -} - -// AsBasicCommandProperties is the BasicCommandProperties implementation for MigrateMISyncCompleteCommandProperties. -func (mmsccp MigrateMISyncCompleteCommandProperties) AsBasicCommandProperties() (BasicCommandProperties, bool) { - return &mmsccp, true -} - -// MigrateMySQLAzureDbForMySQLSyncDatabaseInput database specific information for MySQL to Azure Database -// for MySQL migration task inputs -type MigrateMySQLAzureDbForMySQLSyncDatabaseInput struct { - // Name - Name of the database - Name *string `json:"name,omitempty"` - // TargetDatabaseName - Name of target database. Note: Target database will be truncated before starting migration. - TargetDatabaseName *string `json:"targetDatabaseName,omitempty"` - // MigrationSetting - Migration settings which tune the migration behavior - MigrationSetting map[string]*string `json:"migrationSetting"` - // SourceSetting - Source settings to tune source endpoint migration behavior - SourceSetting map[string]*string `json:"sourceSetting"` - // TargetSetting - Target settings to tune target endpoint migration behavior - TargetSetting map[string]*string `json:"targetSetting"` -} - -// MarshalJSON is the custom marshaler for MigrateMySQLAzureDbForMySQLSyncDatabaseInput. -func (mmsadfmssdi MigrateMySQLAzureDbForMySQLSyncDatabaseInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mmsadfmssdi.Name != nil { - objectMap["name"] = mmsadfmssdi.Name - } - if mmsadfmssdi.TargetDatabaseName != nil { - objectMap["targetDatabaseName"] = mmsadfmssdi.TargetDatabaseName - } - if mmsadfmssdi.MigrationSetting != nil { - objectMap["migrationSetting"] = mmsadfmssdi.MigrationSetting - } - if mmsadfmssdi.SourceSetting != nil { - objectMap["sourceSetting"] = mmsadfmssdi.SourceSetting - } - if mmsadfmssdi.TargetSetting != nil { - objectMap["targetSetting"] = mmsadfmssdi.TargetSetting - } - return json.Marshal(objectMap) -} - -// MigrateMySQLAzureDbForMySQLSyncTaskInput input for the task that migrates MySQL databases to Azure -// Database for MySQL for online migrations -type MigrateMySQLAzureDbForMySQLSyncTaskInput struct { - // SourceConnectionInfo - Connection information for source MySQL - SourceConnectionInfo *MySQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetConnectionInfo - Connection information for target Azure Database for MySQL - TargetConnectionInfo *MySQLConnectionInfo `json:"targetConnectionInfo,omitempty"` - // SelectedDatabases - Databases to migrate - SelectedDatabases *[]MigrateMySQLAzureDbForMySQLSyncDatabaseInput `json:"selectedDatabases,omitempty"` -} - -// BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput output for the task that migrates MySQL databases to Azure Database -// for MySQL for online migrations -type BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput interface { - AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError, bool) - AsMigrateMySQLAzureDbForMySQLSyncTaskOutputError() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputError, bool) - AsMigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel, bool) - AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel, bool) - AsMigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel, bool) - AsMigrateMySQLAzureDbForMySQLSyncTaskOutput() (*MigrateMySQLAzureDbForMySQLSyncTaskOutput, bool) -} - -// MigrateMySQLAzureDbForMySQLSyncTaskOutput output for the task that migrates MySQL databases to Azure -// Database for MySQL for online migrations -type MigrateMySQLAzureDbForMySQLSyncTaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrateMySQLAzureDbForMySQLSyncTaskOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelErrorOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput `json:"resultType,omitempty"` -} - -func unmarshalBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput(body []byte) (BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["resultType"] { - case string(ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelErrorOutput): - var mmsadfmsstode MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError - err := json.Unmarshal(body, &mmsadfmsstode) - return mmsadfmsstode, err - case string(ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeErrorOutput): - var mmsadfmsstoe MigrateMySQLAzureDbForMySQLSyncTaskOutputError - err := json.Unmarshal(body, &mmsadfmsstoe) - return mmsadfmsstoe, err - case string(ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeTableLevelOutput): - var mmsadfmsstotl MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel - err := json.Unmarshal(body, &mmsadfmsstotl) - return mmsadfmsstotl, err - case string(ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelOutput): - var mmsadfmsstodl MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel - err := json.Unmarshal(body, &mmsadfmsstodl) - return mmsadfmsstodl, err - case string(ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrationLevelOutput): - var mmsadfmsstoml MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel - err := json.Unmarshal(body, &mmsadfmsstoml) - return mmsadfmsstoml, err - default: - var mmsadfmssto MigrateMySQLAzureDbForMySQLSyncTaskOutput - err := json.Unmarshal(body, &mmsadfmssto) - return mmsadfmssto, err - } -} -func unmarshalBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputArray(body []byte) ([]BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - mmsadfmsstoArray := make([]BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mmsadfmssto, err := unmarshalBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput(*rawMessage) - if err != nil { - return nil, err - } - mmsadfmsstoArray[index] = mmsadfmssto - } - return mmsadfmsstoArray, nil -} - -// MarshalJSON is the custom marshaler for MigrateMySQLAzureDbForMySQLSyncTaskOutput. -func (mmsadfmssto MigrateMySQLAzureDbForMySQLSyncTaskOutput) MarshalJSON() ([]byte, error) { - mmsadfmssto.ResultType = ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrateMySQLAzureDbForMySQLSyncTaskOutput - objectMap := make(map[string]interface{}) - if mmsadfmssto.ResultType != "" { - objectMap["resultType"] = mmsadfmssto.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutput. -func (mmsadfmssto MigrateMySQLAzureDbForMySQLSyncTaskOutput) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputError is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutput. -func (mmsadfmssto MigrateMySQLAzureDbForMySQLSyncTaskOutput) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputError() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputError, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutput. -func (mmsadfmssto MigrateMySQLAzureDbForMySQLSyncTaskOutput) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutput. -func (mmsadfmssto MigrateMySQLAzureDbForMySQLSyncTaskOutput) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutput. -func (mmsadfmssto MigrateMySQLAzureDbForMySQLSyncTaskOutput) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutput is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutput. -func (mmsadfmssto MigrateMySQLAzureDbForMySQLSyncTaskOutput) AsMigrateMySQLAzureDbForMySQLSyncTaskOutput() (*MigrateMySQLAzureDbForMySQLSyncTaskOutput, bool) { - return &mmsadfmssto, true -} - -// AsBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutput. -func (mmsadfmssto MigrateMySQLAzureDbForMySQLSyncTaskOutput) AsBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput() (BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput, bool) { - return &mmsadfmssto, true -} - -// MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError ... -type MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError struct { - // ErrorMessage - Error message - ErrorMessage *string `json:"errorMessage,omitempty"` - // Events - List of error events. - Events *[]SyncMigrationDatabaseErrorEvent `json:"events,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrateMySQLAzureDbForMySQLSyncTaskOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelErrorOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError. -func (mmsadfmsstode MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError) MarshalJSON() ([]byte, error) { - mmsadfmsstode.ResultType = ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelErrorOutput - objectMap := make(map[string]interface{}) - if mmsadfmsstode.ErrorMessage != nil { - objectMap["errorMessage"] = mmsadfmsstode.ErrorMessage - } - if mmsadfmsstode.Events != nil { - objectMap["events"] = mmsadfmsstode.Events - } - if mmsadfmsstode.ResultType != "" { - objectMap["resultType"] = mmsadfmsstode.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError. -func (mmsadfmsstode MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError, bool) { - return &mmsadfmsstode, true -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputError is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError. -func (mmsadfmsstode MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputError() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputError, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError. -func (mmsadfmsstode MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError. -func (mmsadfmsstode MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError. -func (mmsadfmsstode MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutput is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError. -func (mmsadfmsstode MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError) AsMigrateMySQLAzureDbForMySQLSyncTaskOutput() (*MigrateMySQLAzureDbForMySQLSyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError. -func (mmsadfmsstode MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError) AsBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput() (BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput, bool) { - return &mmsadfmsstode, true -} - -// MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel ... -type MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel struct { - // DatabaseName - READ-ONLY; Name of the database - DatabaseName *string `json:"databaseName,omitempty"` - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // MigrationState - READ-ONLY; Migration state that this database is in. Possible values include: 'SyncDatabaseMigrationReportingStateUNDEFINED', 'SyncDatabaseMigrationReportingStateCONFIGURING', 'SyncDatabaseMigrationReportingStateINITIALIAZING', 'SyncDatabaseMigrationReportingStateSTARTING', 'SyncDatabaseMigrationReportingStateRUNNING', 'SyncDatabaseMigrationReportingStateREADYTOCOMPLETE', 'SyncDatabaseMigrationReportingStateCOMPLETING', 'SyncDatabaseMigrationReportingStateCOMPLETE', 'SyncDatabaseMigrationReportingStateCANCELLING', 'SyncDatabaseMigrationReportingStateCANCELLED', 'SyncDatabaseMigrationReportingStateFAILED' - MigrationState SyncDatabaseMigrationReportingState `json:"migrationState,omitempty"` - // IncomingChanges - READ-ONLY; Number of incoming changes - IncomingChanges *int64 `json:"incomingChanges,omitempty"` - // AppliedChanges - READ-ONLY; Number of applied changes - AppliedChanges *int64 `json:"appliedChanges,omitempty"` - // CdcInsertCounter - READ-ONLY; Number of cdc inserts - CdcInsertCounter *int64 `json:"cdcInsertCounter,omitempty"` - // CdcDeleteCounter - READ-ONLY; Number of cdc deletes - CdcDeleteCounter *int64 `json:"cdcDeleteCounter,omitempty"` - // CdcUpdateCounter - READ-ONLY; Number of cdc updates - CdcUpdateCounter *int64 `json:"cdcUpdateCounter,omitempty"` - // FullLoadCompletedTables - READ-ONLY; Number of tables completed in full load - FullLoadCompletedTables *int64 `json:"fullLoadCompletedTables,omitempty"` - // FullLoadLoadingTables - READ-ONLY; Number of tables loading in full load - FullLoadLoadingTables *int64 `json:"fullLoadLoadingTables,omitempty"` - // FullLoadQueuedTables - READ-ONLY; Number of tables queued in full load - FullLoadQueuedTables *int64 `json:"fullLoadQueuedTables,omitempty"` - // FullLoadErroredTables - READ-ONLY; Number of tables errored in full load - FullLoadErroredTables *int64 `json:"fullLoadErroredTables,omitempty"` - // InitializationCompleted - READ-ONLY; Indicates if initial load (full load) has been completed - InitializationCompleted *bool `json:"initializationCompleted,omitempty"` - // Latency - READ-ONLY; CDC apply latency - Latency *int64 `json:"latency,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrateMySQLAzureDbForMySQLSyncTaskOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelErrorOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel. -func (mmsadfmsstodl MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel) MarshalJSON() ([]byte, error) { - mmsadfmsstodl.ResultType = ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelOutput - objectMap := make(map[string]interface{}) - if mmsadfmsstodl.ResultType != "" { - objectMap["resultType"] = mmsadfmsstodl.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel. -func (mmsadfmsstodl MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputError is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel. -func (mmsadfmsstodl MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputError() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputError, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel. -func (mmsadfmsstodl MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel. -func (mmsadfmsstodl MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel, bool) { - return &mmsadfmsstodl, true -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel. -func (mmsadfmsstodl MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutput is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel. -func (mmsadfmsstodl MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutput() (*MigrateMySQLAzureDbForMySQLSyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel. -func (mmsadfmsstodl MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel) AsBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput() (BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput, bool) { - return &mmsadfmsstodl, true -} - -// MigrateMySQLAzureDbForMySQLSyncTaskOutputError ... -type MigrateMySQLAzureDbForMySQLSyncTaskOutputError struct { - // Error - READ-ONLY; Migration error - Error *ReportableException `json:"error,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrateMySQLAzureDbForMySQLSyncTaskOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelErrorOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateMySQLAzureDbForMySQLSyncTaskOutputError. -func (mmsadfmsstoe MigrateMySQLAzureDbForMySQLSyncTaskOutputError) MarshalJSON() ([]byte, error) { - mmsadfmsstoe.ResultType = ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeErrorOutput - objectMap := make(map[string]interface{}) - if mmsadfmsstoe.ResultType != "" { - objectMap["resultType"] = mmsadfmsstoe.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputError. -func (mmsadfmsstoe MigrateMySQLAzureDbForMySQLSyncTaskOutputError) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputError is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputError. -func (mmsadfmsstoe MigrateMySQLAzureDbForMySQLSyncTaskOutputError) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputError() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputError, bool) { - return &mmsadfmsstoe, true -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputError. -func (mmsadfmsstoe MigrateMySQLAzureDbForMySQLSyncTaskOutputError) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputError. -func (mmsadfmsstoe MigrateMySQLAzureDbForMySQLSyncTaskOutputError) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputError. -func (mmsadfmsstoe MigrateMySQLAzureDbForMySQLSyncTaskOutputError) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutput is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputError. -func (mmsadfmsstoe MigrateMySQLAzureDbForMySQLSyncTaskOutputError) AsMigrateMySQLAzureDbForMySQLSyncTaskOutput() (*MigrateMySQLAzureDbForMySQLSyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputError. -func (mmsadfmsstoe MigrateMySQLAzureDbForMySQLSyncTaskOutputError) AsBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput() (BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput, bool) { - return &mmsadfmsstoe, true -} - -// MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel ... -type MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel struct { - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // SourceServerVersion - READ-ONLY; Source server version - SourceServerVersion *string `json:"sourceServerVersion,omitempty"` - // SourceServer - READ-ONLY; Source server name - SourceServer *string `json:"sourceServer,omitempty"` - // TargetServerVersion - READ-ONLY; Target server version - TargetServerVersion *string `json:"targetServerVersion,omitempty"` - // TargetServer - READ-ONLY; Target server name - TargetServer *string `json:"targetServer,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrateMySQLAzureDbForMySQLSyncTaskOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelErrorOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel. -func (mmsadfmsstoml MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel) MarshalJSON() ([]byte, error) { - mmsadfmsstoml.ResultType = ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrationLevelOutput - objectMap := make(map[string]interface{}) - if mmsadfmsstoml.ResultType != "" { - objectMap["resultType"] = mmsadfmsstoml.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel. -func (mmsadfmsstoml MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputError is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel. -func (mmsadfmsstoml MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputError() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputError, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel. -func (mmsadfmsstoml MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel. -func (mmsadfmsstoml MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel. -func (mmsadfmsstoml MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel, bool) { - return &mmsadfmsstoml, true -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutput is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel. -func (mmsadfmsstoml MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutput() (*MigrateMySQLAzureDbForMySQLSyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel. -func (mmsadfmsstoml MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel) AsBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput() (BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput, bool) { - return &mmsadfmsstoml, true -} - -// MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel ... -type MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel struct { - // TableName - READ-ONLY; Name of the table - TableName *string `json:"tableName,omitempty"` - // DatabaseName - READ-ONLY; Name of the database - DatabaseName *string `json:"databaseName,omitempty"` - // CdcInsertCounter - READ-ONLY; Number of applied inserts - CdcInsertCounter *string `json:"cdcInsertCounter,omitempty"` - // CdcUpdateCounter - READ-ONLY; Number of applied updates - CdcUpdateCounter *string `json:"cdcUpdateCounter,omitempty"` - // CdcDeleteCounter - READ-ONLY; Number of applied deletes - CdcDeleteCounter *string `json:"cdcDeleteCounter,omitempty"` - // FullLoadEstFinishTime - READ-ONLY; Estimate to finish full load - FullLoadEstFinishTime *date.Time `json:"fullLoadEstFinishTime,omitempty"` - // FullLoadStartedOn - READ-ONLY; Full load start time - FullLoadStartedOn *date.Time `json:"fullLoadStartedOn,omitempty"` - // FullLoadEndedOn - READ-ONLY; Full load end time - FullLoadEndedOn *date.Time `json:"fullLoadEndedOn,omitempty"` - // FullLoadTotalRows - READ-ONLY; Number of rows applied in full load - FullLoadTotalRows *int64 `json:"fullLoadTotalRows,omitempty"` - // State - READ-ONLY; Current state of the table migration. Possible values include: 'SyncTableMigrationStateBEFORELOAD', 'SyncTableMigrationStateFULLLOAD', 'SyncTableMigrationStateCOMPLETED', 'SyncTableMigrationStateCANCELED', 'SyncTableMigrationStateERROR', 'SyncTableMigrationStateFAILED' - State SyncTableMigrationState `json:"state,omitempty"` - // TotalChangesApplied - READ-ONLY; Total number of applied changes - TotalChangesApplied *int64 `json:"totalChangesApplied,omitempty"` - // DataErrorsCounter - READ-ONLY; Number of data errors occurred - DataErrorsCounter *int64 `json:"dataErrorsCounter,omitempty"` - // LastModifiedTime - READ-ONLY; Last modified time on target - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrateMySQLAzureDbForMySQLSyncTaskOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelErrorOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel. -func (mmsadfmsstotl MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel) MarshalJSON() ([]byte, error) { - mmsadfmsstotl.ResultType = ResultTypeBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputResultTypeTableLevelOutput - objectMap := make(map[string]interface{}) - if mmsadfmsstotl.ResultType != "" { - objectMap["resultType"] = mmsadfmsstotl.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel. -func (mmsadfmsstotl MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseError, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputError is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel. -func (mmsadfmsstotl MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputError() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputError, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel. -func (mmsadfmsstotl MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel, bool) { - return &mmsadfmsstotl, true -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel. -func (mmsadfmsstotl MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel. -func (mmsadfmsstotl MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel() (*MigrateMySQLAzureDbForMySQLSyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskOutput is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel. -func (mmsadfmsstotl MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel) AsMigrateMySQLAzureDbForMySQLSyncTaskOutput() (*MigrateMySQLAzureDbForMySQLSyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput is the BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput implementation for MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel. -func (mmsadfmsstotl MigrateMySQLAzureDbForMySQLSyncTaskOutputTableLevel) AsBasicMigrateMySQLAzureDbForMySQLSyncTaskOutput() (BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput, bool) { - return &mmsadfmsstotl, true -} - -// MigrateMySQLAzureDbForMySQLSyncTaskProperties properties for the task that migrates MySQL databases to -// Azure Database for MySQL for online migrations -type MigrateMySQLAzureDbForMySQLSyncTaskProperties struct { - // Input - Task input - Input *MigrateMySQLAzureDbForMySQLSyncTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]BasicMigrateMySQLAzureDbForMySQLSyncTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) MarshalJSON() ([]byte, error) { - mmsadfmsstp.TaskType = TaskTypeMigrateMySQLAzureDbForMySQLSync - objectMap := make(map[string]interface{}) - if mmsadfmsstp.Input != nil { - objectMap["input"] = mmsadfmsstp.Input - } - if mmsadfmsstp.TaskType != "" { - objectMap["taskType"] = mmsadfmsstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return &mmsadfmsstp, true -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for MigrateMySQLAzureDbForMySQLSyncTaskProperties. -func (mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &mmsadfmsstp, true -} - -// UnmarshalJSON is the custom unmarshaler for MigrateMySQLAzureDbForMySQLSyncTaskProperties struct. -func (mmsadfmsstp *MigrateMySQLAzureDbForMySQLSyncTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input MigrateMySQLAzureDbForMySQLSyncTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - mmsadfmsstp.Input = &input - } - case "output": - if v != nil { - output, err := unmarshalBasicMigrateMySQLAzureDbForMySQLSyncTaskOutputArray(*v) - if err != nil { - return err - } - mmsadfmsstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - mmsadfmsstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - mmsadfmsstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - mmsadfmsstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - mmsadfmsstp.TaskType = taskType - } - } - } - - return nil -} - -// MigratePostgreSQLAzureDbForPostgreSQLSyncDatabaseInput database specific information for PostgreSQL to -// Azure Database for PostgreSQL migration task inputs -type MigratePostgreSQLAzureDbForPostgreSQLSyncDatabaseInput struct { - // Name - Name of the database - Name *string `json:"name,omitempty"` - // TargetDatabaseName - Name of target database. Note: Target database will be truncated before starting migration. - TargetDatabaseName *string `json:"targetDatabaseName,omitempty"` - // MigrationSetting - Migration settings which tune the migration behavior - MigrationSetting map[string]*string `json:"migrationSetting"` - // SourceSetting - Source settings to tune source endpoint migration behavior - SourceSetting map[string]*string `json:"sourceSetting"` - // TargetSetting - Target settings to tune target endpoint migration behavior - TargetSetting map[string]*string `json:"targetSetting"` -} - -// MarshalJSON is the custom marshaler for MigratePostgreSQLAzureDbForPostgreSQLSyncDatabaseInput. -func (mpsadfpssdi MigratePostgreSQLAzureDbForPostgreSQLSyncDatabaseInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mpsadfpssdi.Name != nil { - objectMap["name"] = mpsadfpssdi.Name - } - if mpsadfpssdi.TargetDatabaseName != nil { - objectMap["targetDatabaseName"] = mpsadfpssdi.TargetDatabaseName - } - if mpsadfpssdi.MigrationSetting != nil { - objectMap["migrationSetting"] = mpsadfpssdi.MigrationSetting - } - if mpsadfpssdi.SourceSetting != nil { - objectMap["sourceSetting"] = mpsadfpssdi.SourceSetting - } - if mpsadfpssdi.TargetSetting != nil { - objectMap["targetSetting"] = mpsadfpssdi.TargetSetting - } - return json.Marshal(objectMap) -} - -// MigratePostgreSQLAzureDbForPostgreSQLSyncTaskInput input for the task that migrates PostgreSQL databases -// to Azure Database for PostgreSQL for online migrations -type MigratePostgreSQLAzureDbForPostgreSQLSyncTaskInput struct { - // SelectedDatabases - Databases to migrate - SelectedDatabases *[]MigratePostgreSQLAzureDbForPostgreSQLSyncDatabaseInput `json:"selectedDatabases,omitempty"` - // TargetConnectionInfo - Connection information for target Azure Database for PostgreSQL - TargetConnectionInfo *PostgreSQLConnectionInfo `json:"targetConnectionInfo,omitempty"` - // SourceConnectionInfo - Connection information for source PostgreSQL - SourceConnectionInfo *PostgreSQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` -} - -// BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput output for the task that migrates PostgreSQL databases to -// Azure Database for PostgreSQL for online migrations -type BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput interface { - AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError, bool) - AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError, bool) - AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel, bool) - AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel, bool) - AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel, bool) - AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, bool) -} - -// MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput output for the task that migrates PostgreSQL databases -// to Azure Database for PostgreSQL for online migrations -type MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput', 'ResultTypeDatabaseLevelErrorOutput', 'ResultTypeErrorOutput', 'ResultTypeTableLevelOutput', 'ResultTypeDatabaseLevelOutput', 'ResultTypeMigrationLevelOutput' - ResultType ResultType `json:"resultType,omitempty"` -} - -func unmarshalBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput(body []byte) (BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["resultType"] { - case string(ResultTypeDatabaseLevelErrorOutput): - var mpsadfpsstode MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError - err := json.Unmarshal(body, &mpsadfpsstode) - return mpsadfpsstode, err - case string(ResultTypeErrorOutput): - var mpsadfpsstoe MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError - err := json.Unmarshal(body, &mpsadfpsstoe) - return mpsadfpsstoe, err - case string(ResultTypeTableLevelOutput): - var mpsadfpsstotl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel - err := json.Unmarshal(body, &mpsadfpsstotl) - return mpsadfpsstotl, err - case string(ResultTypeDatabaseLevelOutput): - var mpsadfpsstodl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel - err := json.Unmarshal(body, &mpsadfpsstodl) - return mpsadfpsstodl, err - case string(ResultTypeMigrationLevelOutput): - var mpsadfpsstoml MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel - err := json.Unmarshal(body, &mpsadfpsstoml) - return mpsadfpsstoml, err - default: - var mpsadfpssto MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput - err := json.Unmarshal(body, &mpsadfpssto) - return mpsadfpssto, err - } -} -func unmarshalBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputArray(body []byte) ([]BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - mpsadfpsstoArray := make([]BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, len(rawMessages)) - - for index, rawMessage := range rawMessages { - mpsadfpssto, err := unmarshalBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput(*rawMessage) - if err != nil { - return nil, err - } - mpsadfpsstoArray[index] = mpsadfpssto - } - return mpsadfpsstoArray, nil -} - -// MarshalJSON is the custom marshaler for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput. -func (mpsadfpssto MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput) MarshalJSON() ([]byte, error) { - mpsadfpssto.ResultType = ResultTypeMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput - objectMap := make(map[string]interface{}) - if mpsadfpssto.ResultType != "" { - objectMap["resultType"] = mpsadfpssto.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput. -func (mpsadfpssto MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput. -func (mpsadfpssto MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput. -func (mpsadfpssto MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput. -func (mpsadfpssto MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput. -func (mpsadfpssto MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput. -func (mpsadfpssto MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, bool) { - return &mpsadfpssto, true -} - -// AsBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput. -func (mpsadfpssto MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput) AsBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput() (BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, bool) { - return &mpsadfpssto, true -} - -// MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError ... -type MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError struct { - // ErrorMessage - Error message - ErrorMessage *string `json:"errorMessage,omitempty"` - // Events - List of error events. - Events *[]SyncMigrationDatabaseErrorEvent `json:"events,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput', 'ResultTypeDatabaseLevelErrorOutput', 'ResultTypeErrorOutput', 'ResultTypeTableLevelOutput', 'ResultTypeDatabaseLevelOutput', 'ResultTypeMigrationLevelOutput' - ResultType ResultType `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError. -func (mpsadfpsstode MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError) MarshalJSON() ([]byte, error) { - mpsadfpsstode.ResultType = ResultTypeDatabaseLevelErrorOutput - objectMap := make(map[string]interface{}) - if mpsadfpsstode.ErrorMessage != nil { - objectMap["errorMessage"] = mpsadfpsstode.ErrorMessage - } - if mpsadfpsstode.Events != nil { - objectMap["events"] = mpsadfpsstode.Events - } - if mpsadfpsstode.ResultType != "" { - objectMap["resultType"] = mpsadfpsstode.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError. -func (mpsadfpsstode MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError, bool) { - return &mpsadfpsstode, true -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError. -func (mpsadfpsstode MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError. -func (mpsadfpsstode MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError. -func (mpsadfpsstode MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError. -func (mpsadfpsstode MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError. -func (mpsadfpsstode MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError. -func (mpsadfpsstode MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError) AsBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput() (BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, bool) { - return &mpsadfpsstode, true -} - -// MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel ... -type MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel struct { - // DatabaseName - READ-ONLY; Name of the database - DatabaseName *string `json:"databaseName,omitempty"` - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // MigrationState - READ-ONLY; Migration state that this database is in. Possible values include: 'SyncDatabaseMigrationReportingStateUNDEFINED', 'SyncDatabaseMigrationReportingStateCONFIGURING', 'SyncDatabaseMigrationReportingStateINITIALIAZING', 'SyncDatabaseMigrationReportingStateSTARTING', 'SyncDatabaseMigrationReportingStateRUNNING', 'SyncDatabaseMigrationReportingStateREADYTOCOMPLETE', 'SyncDatabaseMigrationReportingStateCOMPLETING', 'SyncDatabaseMigrationReportingStateCOMPLETE', 'SyncDatabaseMigrationReportingStateCANCELLING', 'SyncDatabaseMigrationReportingStateCANCELLED', 'SyncDatabaseMigrationReportingStateFAILED' - MigrationState SyncDatabaseMigrationReportingState `json:"migrationState,omitempty"` - // IncomingChanges - READ-ONLY; Number of incoming changes - IncomingChanges *int64 `json:"incomingChanges,omitempty"` - // AppliedChanges - READ-ONLY; Number of applied changes - AppliedChanges *int64 `json:"appliedChanges,omitempty"` - // CdcInsertCounter - READ-ONLY; Number of cdc inserts - CdcInsertCounter *int64 `json:"cdcInsertCounter,omitempty"` - // CdcDeleteCounter - READ-ONLY; Number of cdc deletes - CdcDeleteCounter *int64 `json:"cdcDeleteCounter,omitempty"` - // CdcUpdateCounter - READ-ONLY; Number of cdc updates - CdcUpdateCounter *int64 `json:"cdcUpdateCounter,omitempty"` - // FullLoadCompletedTables - READ-ONLY; Number of tables completed in full load - FullLoadCompletedTables *int64 `json:"fullLoadCompletedTables,omitempty"` - // FullLoadLoadingTables - READ-ONLY; Number of tables loading in full load - FullLoadLoadingTables *int64 `json:"fullLoadLoadingTables,omitempty"` - // FullLoadQueuedTables - READ-ONLY; Number of tables queued in full load - FullLoadQueuedTables *int64 `json:"fullLoadQueuedTables,omitempty"` - // FullLoadErroredTables - READ-ONLY; Number of tables errored in full load - FullLoadErroredTables *int64 `json:"fullLoadErroredTables,omitempty"` - // InitializationCompleted - READ-ONLY; Indicates if initial load (full load) has been completed - InitializationCompleted *bool `json:"initializationCompleted,omitempty"` - // Latency - READ-ONLY; CDC apply latency - Latency *int64 `json:"latency,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput', 'ResultTypeDatabaseLevelErrorOutput', 'ResultTypeErrorOutput', 'ResultTypeTableLevelOutput', 'ResultTypeDatabaseLevelOutput', 'ResultTypeMigrationLevelOutput' - ResultType ResultType `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel. -func (mpsadfpsstodl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel) MarshalJSON() ([]byte, error) { - mpsadfpsstodl.ResultType = ResultTypeDatabaseLevelOutput - objectMap := make(map[string]interface{}) - if mpsadfpsstodl.ResultType != "" { - objectMap["resultType"] = mpsadfpsstodl.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel. -func (mpsadfpsstodl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel. -func (mpsadfpsstodl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel. -func (mpsadfpsstodl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel. -func (mpsadfpsstodl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel, bool) { - return &mpsadfpsstodl, true -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel. -func (mpsadfpsstodl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel. -func (mpsadfpsstodl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel. -func (mpsadfpsstodl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel) AsBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput() (BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, bool) { - return &mpsadfpsstodl, true -} - -// MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError ... -type MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError struct { - // Error - READ-ONLY; Migration error - Error *ReportableException `json:"error,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput', 'ResultTypeDatabaseLevelErrorOutput', 'ResultTypeErrorOutput', 'ResultTypeTableLevelOutput', 'ResultTypeDatabaseLevelOutput', 'ResultTypeMigrationLevelOutput' - ResultType ResultType `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError. -func (mpsadfpsstoe MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError) MarshalJSON() ([]byte, error) { - mpsadfpsstoe.ResultType = ResultTypeErrorOutput - objectMap := make(map[string]interface{}) - if mpsadfpsstoe.ResultType != "" { - objectMap["resultType"] = mpsadfpsstoe.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError. -func (mpsadfpsstoe MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError. -func (mpsadfpsstoe MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError, bool) { - return &mpsadfpsstoe, true -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError. -func (mpsadfpsstoe MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError. -func (mpsadfpsstoe MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError. -func (mpsadfpsstoe MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError. -func (mpsadfpsstoe MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError. -func (mpsadfpsstoe MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError) AsBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput() (BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, bool) { - return &mpsadfpsstoe, true -} - -// MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel ... -type MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel struct { - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // SourceServerVersion - READ-ONLY; Source server version - SourceServerVersion *string `json:"sourceServerVersion,omitempty"` - // SourceServer - READ-ONLY; Source server name - SourceServer *string `json:"sourceServer,omitempty"` - // TargetServerVersion - READ-ONLY; Target server version - TargetServerVersion *string `json:"targetServerVersion,omitempty"` - // TargetServer - READ-ONLY; Target server name - TargetServer *string `json:"targetServer,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput', 'ResultTypeDatabaseLevelErrorOutput', 'ResultTypeErrorOutput', 'ResultTypeTableLevelOutput', 'ResultTypeDatabaseLevelOutput', 'ResultTypeMigrationLevelOutput' - ResultType ResultType `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel. -func (mpsadfpsstoml MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel) MarshalJSON() ([]byte, error) { - mpsadfpsstoml.ResultType = ResultTypeMigrationLevelOutput - objectMap := make(map[string]interface{}) - if mpsadfpsstoml.ResultType != "" { - objectMap["resultType"] = mpsadfpsstoml.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel. -func (mpsadfpsstoml MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel. -func (mpsadfpsstoml MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel. -func (mpsadfpsstoml MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel. -func (mpsadfpsstoml MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel. -func (mpsadfpsstoml MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel, bool) { - return &mpsadfpsstoml, true -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel. -func (mpsadfpsstoml MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel. -func (mpsadfpsstoml MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel) AsBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput() (BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, bool) { - return &mpsadfpsstoml, true -} - -// MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel ... -type MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel struct { - // TableName - READ-ONLY; Name of the table - TableName *string `json:"tableName,omitempty"` - // DatabaseName - READ-ONLY; Name of the database - DatabaseName *string `json:"databaseName,omitempty"` - // CdcInsertCounter - READ-ONLY; Number of applied inserts - CdcInsertCounter *int64 `json:"cdcInsertCounter,omitempty"` - // CdcUpdateCounter - READ-ONLY; Number of applied updates - CdcUpdateCounter *int64 `json:"cdcUpdateCounter,omitempty"` - // CdcDeleteCounter - READ-ONLY; Number of applied deletes - CdcDeleteCounter *int64 `json:"cdcDeleteCounter,omitempty"` - // FullLoadEstFinishTime - READ-ONLY; Estimate to finish full load - FullLoadEstFinishTime *date.Time `json:"fullLoadEstFinishTime,omitempty"` - // FullLoadStartedOn - READ-ONLY; Full load start time - FullLoadStartedOn *date.Time `json:"fullLoadStartedOn,omitempty"` - // FullLoadEndedOn - READ-ONLY; Full load end time - FullLoadEndedOn *date.Time `json:"fullLoadEndedOn,omitempty"` - // FullLoadTotalRows - READ-ONLY; Number of rows applied in full load - FullLoadTotalRows *int64 `json:"fullLoadTotalRows,omitempty"` - // State - READ-ONLY; Current state of the table migration. Possible values include: 'SyncTableMigrationStateBEFORELOAD', 'SyncTableMigrationStateFULLLOAD', 'SyncTableMigrationStateCOMPLETED', 'SyncTableMigrationStateCANCELED', 'SyncTableMigrationStateERROR', 'SyncTableMigrationStateFAILED' - State SyncTableMigrationState `json:"state,omitempty"` - // TotalChangesApplied - READ-ONLY; Total number of applied changes - TotalChangesApplied *int64 `json:"totalChangesApplied,omitempty"` - // DataErrorsCounter - READ-ONLY; Number of data errors occurred - DataErrorsCounter *int64 `json:"dataErrorsCounter,omitempty"` - // LastModifiedTime - READ-ONLY; Last modified time on target - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput', 'ResultTypeDatabaseLevelErrorOutput', 'ResultTypeErrorOutput', 'ResultTypeTableLevelOutput', 'ResultTypeDatabaseLevelOutput', 'ResultTypeMigrationLevelOutput' - ResultType ResultType `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel. -func (mpsadfpsstotl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel) MarshalJSON() ([]byte, error) { - mpsadfpsstotl.ResultType = ResultTypeTableLevelOutput - objectMap := make(map[string]interface{}) - if mpsadfpsstotl.ResultType != "" { - objectMap["resultType"] = mpsadfpsstotl.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel. -func (mpsadfpsstotl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseError, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel. -func (mpsadfpsstotl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputError, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel. -func (mpsadfpsstotl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel, bool) { - return &mpsadfpsstotl, true -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel. -func (mpsadfpsstotl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel. -func (mpsadfpsstotl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel. -func (mpsadfpsstotl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput is the BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel. -func (mpsadfpsstotl MigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputTableLevel) AsBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput() (BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput, bool) { - return &mpsadfpsstotl, true -} - -// MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties properties for the task that migrates PostgreSQL -// databases to Azure Database for PostgreSQL for online migrations -type MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties struct { - // Input - Task input - Input *MigratePostgreSQLAzureDbForPostgreSQLSyncTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]BasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) MarshalJSON() ([]byte, error) { - mpsadfpsstp.TaskType = TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync - objectMap := make(map[string]interface{}) - if mpsadfpsstp.Input != nil { - objectMap["input"] = mpsadfpsstp.Input - } - if mpsadfpsstp.TaskType != "" { - objectMap["taskType"] = mpsadfpsstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return &mpsadfpsstp, true -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties. -func (mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &mpsadfpsstp, true -} - -// UnmarshalJSON is the custom unmarshaler for MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties struct. -func (mpsadfpsstp *MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input MigratePostgreSQLAzureDbForPostgreSQLSyncTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - mpsadfpsstp.Input = &input - } - case "output": - if v != nil { - output, err := unmarshalBasicMigratePostgreSQLAzureDbForPostgreSQLSyncTaskOutputArray(*v) - if err != nil { - return err - } - mpsadfpsstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - mpsadfpsstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - mpsadfpsstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - mpsadfpsstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - mpsadfpsstp.TaskType = taskType - } - } - } - - return nil -} - -// MigrateSQLServerSQLDbDatabaseInput database specific information for SQL to Azure SQL DB migration task -// inputs -type MigrateSQLServerSQLDbDatabaseInput struct { - // Name - Name of the database - Name *string `json:"name,omitempty"` - // TargetDatabaseName - Name of target database. Note: Target database will be truncated before starting migration. - TargetDatabaseName *string `json:"targetDatabaseName,omitempty"` - // MakeSourceDbReadOnly - Whether to set database read only before migration - MakeSourceDbReadOnly *bool `json:"makeSourceDbReadOnly,omitempty"` - // TableMap - Mapping of source to target tables - TableMap map[string]*string `json:"tableMap"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbDatabaseInput. -func (msssddi MigrateSQLServerSQLDbDatabaseInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if msssddi.Name != nil { - objectMap["name"] = msssddi.Name - } - if msssddi.TargetDatabaseName != nil { - objectMap["targetDatabaseName"] = msssddi.TargetDatabaseName - } - if msssddi.MakeSourceDbReadOnly != nil { - objectMap["makeSourceDbReadOnly"] = msssddi.MakeSourceDbReadOnly - } - if msssddi.TableMap != nil { - objectMap["tableMap"] = msssddi.TableMap - } - return json.Marshal(objectMap) -} - -// MigrateSQLServerSQLDbSyncDatabaseInput database specific information for SQL to Azure SQL DB sync -// migration task inputs -type MigrateSQLServerSQLDbSyncDatabaseInput struct { - // ID - Unique identifier for database - ID *string `json:"id,omitempty"` - // Name - Name of database - Name *string `json:"name,omitempty"` - // TargetDatabaseName - Target database name - TargetDatabaseName *string `json:"targetDatabaseName,omitempty"` - // SchemaName - Schema name to be migrated - SchemaName *string `json:"schemaName,omitempty"` - // TableMap - Mapping of source to target tables - TableMap map[string]*string `json:"tableMap"` - // MigrationSetting - Migration settings which tune the migration behavior - MigrationSetting map[string]*string `json:"migrationSetting"` - // SourceSetting - Source settings to tune source endpoint migration behavior - SourceSetting map[string]*string `json:"sourceSetting"` - // TargetSetting - Target settings to tune target endpoint migration behavior - TargetSetting map[string]*string `json:"targetSetting"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbSyncDatabaseInput. -func (msssdsdi MigrateSQLServerSQLDbSyncDatabaseInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if msssdsdi.ID != nil { - objectMap["id"] = msssdsdi.ID - } - if msssdsdi.Name != nil { - objectMap["name"] = msssdsdi.Name - } - if msssdsdi.TargetDatabaseName != nil { - objectMap["targetDatabaseName"] = msssdsdi.TargetDatabaseName - } - if msssdsdi.SchemaName != nil { - objectMap["schemaName"] = msssdsdi.SchemaName - } - if msssdsdi.TableMap != nil { - objectMap["tableMap"] = msssdsdi.TableMap - } - if msssdsdi.MigrationSetting != nil { - objectMap["migrationSetting"] = msssdsdi.MigrationSetting - } - if msssdsdi.SourceSetting != nil { - objectMap["sourceSetting"] = msssdsdi.SourceSetting - } - if msssdsdi.TargetSetting != nil { - objectMap["targetSetting"] = msssdsdi.TargetSetting - } - return json.Marshal(objectMap) -} - -// MigrateSQLServerSQLDbSyncTaskInput input for the task that migrates on-prem SQL Server databases to -// Azure SQL Database for online migrations -type MigrateSQLServerSQLDbSyncTaskInput struct { - // SelectedDatabases - Databases to migrate - SelectedDatabases *[]MigrateSQLServerSQLDbSyncDatabaseInput `json:"selectedDatabases,omitempty"` - // ValidationOptions - Validation options - ValidationOptions *MigrationValidationOptions `json:"validationOptions,omitempty"` - // SourceConnectionInfo - Information for connecting to source - SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetConnectionInfo - Information for connecting to target - TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` -} - -// BasicMigrateSQLServerSQLDbSyncTaskOutput output for the task that migrates on-prem SQL Server databases to Azure SQL -// Database for online migrations -type BasicMigrateSQLServerSQLDbSyncTaskOutput interface { - AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseError() (*MigrateSQLServerSQLDbSyncTaskOutputDatabaseError, bool) - AsMigrateSQLServerSQLDbSyncTaskOutputError() (*MigrateSQLServerSQLDbSyncTaskOutputError, bool) - AsMigrateSQLServerSQLDbSyncTaskOutputTableLevel() (*MigrateSQLServerSQLDbSyncTaskOutputTableLevel, bool) - AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel, bool) - AsMigrateSQLServerSQLDbSyncTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel, bool) - AsMigrateSQLServerSQLDbSyncTaskOutput() (*MigrateSQLServerSQLDbSyncTaskOutput, bool) -} - -// MigrateSQLServerSQLDbSyncTaskOutput output for the task that migrates on-prem SQL Server databases to Azure -// SQL Database for online migrations -type MigrateSQLServerSQLDbSyncTaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrateSQLServerSQLDbSyncTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput `json:"resultType,omitempty"` -} - -func unmarshalBasicMigrateSQLServerSQLDbSyncTaskOutput(body []byte) (BasicMigrateSQLServerSQLDbSyncTaskOutput, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["resultType"] { - case string(ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelErrorOutput): - var msssdstode MigrateSQLServerSQLDbSyncTaskOutputDatabaseError - err := json.Unmarshal(body, &msssdstode) - return msssdstode, err - case string(ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeErrorOutput): - var msssdstoe MigrateSQLServerSQLDbSyncTaskOutputError - err := json.Unmarshal(body, &msssdstoe) - return msssdstoe, err - case string(ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeTableLevelOutput): - var msssdstotl MigrateSQLServerSQLDbSyncTaskOutputTableLevel - err := json.Unmarshal(body, &msssdstotl) - return msssdstotl, err - case string(ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelOutput): - var msssdstodl MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel - err := json.Unmarshal(body, &msssdstodl) - return msssdstodl, err - case string(ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrationLevelOutput): - var msssdstoml MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel - err := json.Unmarshal(body, &msssdstoml) - return msssdstoml, err - default: - var msssdsto MigrateSQLServerSQLDbSyncTaskOutput - err := json.Unmarshal(body, &msssdsto) - return msssdsto, err - } -} -func unmarshalBasicMigrateSQLServerSQLDbSyncTaskOutputArray(body []byte) ([]BasicMigrateSQLServerSQLDbSyncTaskOutput, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - msssdstoArray := make([]BasicMigrateSQLServerSQLDbSyncTaskOutput, len(rawMessages)) - - for index, rawMessage := range rawMessages { - msssdsto, err := unmarshalBasicMigrateSQLServerSQLDbSyncTaskOutput(*rawMessage) - if err != nil { - return nil, err - } - msssdstoArray[index] = msssdsto - } - return msssdstoArray, nil -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbSyncTaskOutput. -func (msssdsto MigrateSQLServerSQLDbSyncTaskOutput) MarshalJSON() ([]byte, error) { - msssdsto.ResultType = ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrateSQLServerSQLDbSyncTaskOutput - objectMap := make(map[string]interface{}) - if msssdsto.ResultType != "" { - objectMap["resultType"] = msssdsto.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseError is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutput. -func (msssdsto MigrateSQLServerSQLDbSyncTaskOutput) AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseError() (*MigrateSQLServerSQLDbSyncTaskOutputDatabaseError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputError is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutput. -func (msssdsto MigrateSQLServerSQLDbSyncTaskOutput) AsMigrateSQLServerSQLDbSyncTaskOutputError() (*MigrateSQLServerSQLDbSyncTaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutput. -func (msssdsto MigrateSQLServerSQLDbSyncTaskOutput) AsMigrateSQLServerSQLDbSyncTaskOutputTableLevel() (*MigrateSQLServerSQLDbSyncTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutput. -func (msssdsto MigrateSQLServerSQLDbSyncTaskOutput) AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutput. -func (msssdsto MigrateSQLServerSQLDbSyncTaskOutput) AsMigrateSQLServerSQLDbSyncTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutput is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutput. -func (msssdsto MigrateSQLServerSQLDbSyncTaskOutput) AsMigrateSQLServerSQLDbSyncTaskOutput() (*MigrateSQLServerSQLDbSyncTaskOutput, bool) { - return &msssdsto, true -} - -// AsBasicMigrateSQLServerSQLDbSyncTaskOutput is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutput. -func (msssdsto MigrateSQLServerSQLDbSyncTaskOutput) AsBasicMigrateSQLServerSQLDbSyncTaskOutput() (BasicMigrateSQLServerSQLDbSyncTaskOutput, bool) { - return &msssdsto, true -} - -// MigrateSQLServerSQLDbSyncTaskOutputDatabaseError ... -type MigrateSQLServerSQLDbSyncTaskOutputDatabaseError struct { - // ErrorMessage - Error message - ErrorMessage *string `json:"errorMessage,omitempty"` - // Events - List of error events. - Events *[]SyncMigrationDatabaseErrorEvent `json:"events,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrateSQLServerSQLDbSyncTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbSyncTaskOutputDatabaseError. -func (msssdstode MigrateSQLServerSQLDbSyncTaskOutputDatabaseError) MarshalJSON() ([]byte, error) { - msssdstode.ResultType = ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelErrorOutput - objectMap := make(map[string]interface{}) - if msssdstode.ErrorMessage != nil { - objectMap["errorMessage"] = msssdstode.ErrorMessage - } - if msssdstode.Events != nil { - objectMap["events"] = msssdstode.Events - } - if msssdstode.ResultType != "" { - objectMap["resultType"] = msssdstode.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseError is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputDatabaseError. -func (msssdstode MigrateSQLServerSQLDbSyncTaskOutputDatabaseError) AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseError() (*MigrateSQLServerSQLDbSyncTaskOutputDatabaseError, bool) { - return &msssdstode, true -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputError is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputDatabaseError. -func (msssdstode MigrateSQLServerSQLDbSyncTaskOutputDatabaseError) AsMigrateSQLServerSQLDbSyncTaskOutputError() (*MigrateSQLServerSQLDbSyncTaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputDatabaseError. -func (msssdstode MigrateSQLServerSQLDbSyncTaskOutputDatabaseError) AsMigrateSQLServerSQLDbSyncTaskOutputTableLevel() (*MigrateSQLServerSQLDbSyncTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputDatabaseError. -func (msssdstode MigrateSQLServerSQLDbSyncTaskOutputDatabaseError) AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputDatabaseError. -func (msssdstode MigrateSQLServerSQLDbSyncTaskOutputDatabaseError) AsMigrateSQLServerSQLDbSyncTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutput is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputDatabaseError. -func (msssdstode MigrateSQLServerSQLDbSyncTaskOutputDatabaseError) AsMigrateSQLServerSQLDbSyncTaskOutput() (*MigrateSQLServerSQLDbSyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLDbSyncTaskOutput is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputDatabaseError. -func (msssdstode MigrateSQLServerSQLDbSyncTaskOutputDatabaseError) AsBasicMigrateSQLServerSQLDbSyncTaskOutput() (BasicMigrateSQLServerSQLDbSyncTaskOutput, bool) { - return &msssdstode, true -} - -// MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel ... -type MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel struct { - // DatabaseName - READ-ONLY; Name of the database - DatabaseName *string `json:"databaseName,omitempty"` - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // MigrationState - READ-ONLY; Migration state that this database is in. Possible values include: 'SyncDatabaseMigrationReportingStateUNDEFINED', 'SyncDatabaseMigrationReportingStateCONFIGURING', 'SyncDatabaseMigrationReportingStateINITIALIAZING', 'SyncDatabaseMigrationReportingStateSTARTING', 'SyncDatabaseMigrationReportingStateRUNNING', 'SyncDatabaseMigrationReportingStateREADYTOCOMPLETE', 'SyncDatabaseMigrationReportingStateCOMPLETING', 'SyncDatabaseMigrationReportingStateCOMPLETE', 'SyncDatabaseMigrationReportingStateCANCELLING', 'SyncDatabaseMigrationReportingStateCANCELLED', 'SyncDatabaseMigrationReportingStateFAILED' - MigrationState SyncDatabaseMigrationReportingState `json:"migrationState,omitempty"` - // IncomingChanges - READ-ONLY; Number of incoming changes - IncomingChanges *int64 `json:"incomingChanges,omitempty"` - // AppliedChanges - READ-ONLY; Number of applied changes - AppliedChanges *int64 `json:"appliedChanges,omitempty"` - // CdcInsertCounter - READ-ONLY; Number of cdc inserts - CdcInsertCounter *int64 `json:"cdcInsertCounter,omitempty"` - // CdcDeleteCounter - READ-ONLY; Number of cdc deletes - CdcDeleteCounter *int64 `json:"cdcDeleteCounter,omitempty"` - // CdcUpdateCounter - READ-ONLY; Number of cdc updates - CdcUpdateCounter *int64 `json:"cdcUpdateCounter,omitempty"` - // FullLoadCompletedTables - READ-ONLY; Number of tables completed in full load - FullLoadCompletedTables *int64 `json:"fullLoadCompletedTables,omitempty"` - // FullLoadLoadingTables - READ-ONLY; Number of tables loading in full load - FullLoadLoadingTables *int64 `json:"fullLoadLoadingTables,omitempty"` - // FullLoadQueuedTables - READ-ONLY; Number of tables queued in full load - FullLoadQueuedTables *int64 `json:"fullLoadQueuedTables,omitempty"` - // FullLoadErroredTables - READ-ONLY; Number of tables errored in full load - FullLoadErroredTables *int64 `json:"fullLoadErroredTables,omitempty"` - // InitializationCompleted - READ-ONLY; Indicates if initial load (full load) has been completed - InitializationCompleted *bool `json:"initializationCompleted,omitempty"` - // Latency - READ-ONLY; CDC apply latency - Latency *int64 `json:"latency,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrateSQLServerSQLDbSyncTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel. -func (msssdstodl MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel) MarshalJSON() ([]byte, error) { - msssdstodl.ResultType = ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelOutput - objectMap := make(map[string]interface{}) - if msssdstodl.ResultType != "" { - objectMap["resultType"] = msssdstodl.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseError is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel. -func (msssdstodl MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseError() (*MigrateSQLServerSQLDbSyncTaskOutputDatabaseError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputError is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel. -func (msssdstodl MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbSyncTaskOutputError() (*MigrateSQLServerSQLDbSyncTaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel. -func (msssdstodl MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbSyncTaskOutputTableLevel() (*MigrateSQLServerSQLDbSyncTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel. -func (msssdstodl MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel, bool) { - return &msssdstodl, true -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel. -func (msssdstodl MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbSyncTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutput is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel. -func (msssdstodl MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbSyncTaskOutput() (*MigrateSQLServerSQLDbSyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLDbSyncTaskOutput is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel. -func (msssdstodl MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel) AsBasicMigrateSQLServerSQLDbSyncTaskOutput() (BasicMigrateSQLServerSQLDbSyncTaskOutput, bool) { - return &msssdstodl, true -} - -// MigrateSQLServerSQLDbSyncTaskOutputError ... -type MigrateSQLServerSQLDbSyncTaskOutputError struct { - // Error - READ-ONLY; Migration error - Error *ReportableException `json:"error,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrateSQLServerSQLDbSyncTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbSyncTaskOutputError. -func (msssdstoe MigrateSQLServerSQLDbSyncTaskOutputError) MarshalJSON() ([]byte, error) { - msssdstoe.ResultType = ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeErrorOutput - objectMap := make(map[string]interface{}) - if msssdstoe.ResultType != "" { - objectMap["resultType"] = msssdstoe.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseError is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputError. -func (msssdstoe MigrateSQLServerSQLDbSyncTaskOutputError) AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseError() (*MigrateSQLServerSQLDbSyncTaskOutputDatabaseError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputError is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputError. -func (msssdstoe MigrateSQLServerSQLDbSyncTaskOutputError) AsMigrateSQLServerSQLDbSyncTaskOutputError() (*MigrateSQLServerSQLDbSyncTaskOutputError, bool) { - return &msssdstoe, true -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputError. -func (msssdstoe MigrateSQLServerSQLDbSyncTaskOutputError) AsMigrateSQLServerSQLDbSyncTaskOutputTableLevel() (*MigrateSQLServerSQLDbSyncTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputError. -func (msssdstoe MigrateSQLServerSQLDbSyncTaskOutputError) AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputError. -func (msssdstoe MigrateSQLServerSQLDbSyncTaskOutputError) AsMigrateSQLServerSQLDbSyncTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutput is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputError. -func (msssdstoe MigrateSQLServerSQLDbSyncTaskOutputError) AsMigrateSQLServerSQLDbSyncTaskOutput() (*MigrateSQLServerSQLDbSyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLDbSyncTaskOutput is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputError. -func (msssdstoe MigrateSQLServerSQLDbSyncTaskOutputError) AsBasicMigrateSQLServerSQLDbSyncTaskOutput() (BasicMigrateSQLServerSQLDbSyncTaskOutput, bool) { - return &msssdstoe, true -} - -// MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel ... -type MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel struct { - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // SourceServerVersion - READ-ONLY; Source server version - SourceServerVersion *string `json:"sourceServerVersion,omitempty"` - // SourceServer - READ-ONLY; Source server name - SourceServer *string `json:"sourceServer,omitempty"` - // TargetServerVersion - READ-ONLY; Target server version - TargetServerVersion *string `json:"targetServerVersion,omitempty"` - // TargetServer - READ-ONLY; Target server name - TargetServer *string `json:"targetServer,omitempty"` - // DatabaseCount - READ-ONLY; Count of databases - DatabaseCount *int32 `json:"databaseCount,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrateSQLServerSQLDbSyncTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel. -func (msssdstoml MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel) MarshalJSON() ([]byte, error) { - msssdstoml.ResultType = ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrationLevelOutput - objectMap := make(map[string]interface{}) - if msssdstoml.ResultType != "" { - objectMap["resultType"] = msssdstoml.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseError is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel. -func (msssdstoml MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseError() (*MigrateSQLServerSQLDbSyncTaskOutputDatabaseError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputError is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel. -func (msssdstoml MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbSyncTaskOutputError() (*MigrateSQLServerSQLDbSyncTaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel. -func (msssdstoml MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbSyncTaskOutputTableLevel() (*MigrateSQLServerSQLDbSyncTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel. -func (msssdstoml MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel. -func (msssdstoml MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbSyncTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel, bool) { - return &msssdstoml, true -} - -// AsMigrateSQLServerSQLDbSyncTaskOutput is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel. -func (msssdstoml MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbSyncTaskOutput() (*MigrateSQLServerSQLDbSyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLDbSyncTaskOutput is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel. -func (msssdstoml MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel) AsBasicMigrateSQLServerSQLDbSyncTaskOutput() (BasicMigrateSQLServerSQLDbSyncTaskOutput, bool) { - return &msssdstoml, true -} - -// MigrateSQLServerSQLDbSyncTaskOutputTableLevel ... -type MigrateSQLServerSQLDbSyncTaskOutputTableLevel struct { - // TableName - READ-ONLY; Name of the table - TableName *string `json:"tableName,omitempty"` - // DatabaseName - READ-ONLY; Name of the database - DatabaseName *string `json:"databaseName,omitempty"` - // CdcInsertCounter - READ-ONLY; Number of applied inserts - CdcInsertCounter *int64 `json:"cdcInsertCounter,omitempty"` - // CdcUpdateCounter - READ-ONLY; Number of applied updates - CdcUpdateCounter *int64 `json:"cdcUpdateCounter,omitempty"` - // CdcDeleteCounter - READ-ONLY; Number of applied deletes - CdcDeleteCounter *int64 `json:"cdcDeleteCounter,omitempty"` - // FullLoadEstFinishTime - READ-ONLY; Estimate to finish full load - FullLoadEstFinishTime *date.Time `json:"fullLoadEstFinishTime,omitempty"` - // FullLoadStartedOn - READ-ONLY; Full load start time - FullLoadStartedOn *date.Time `json:"fullLoadStartedOn,omitempty"` - // FullLoadEndedOn - READ-ONLY; Full load end time - FullLoadEndedOn *date.Time `json:"fullLoadEndedOn,omitempty"` - // FullLoadTotalRows - READ-ONLY; Number of rows applied in full load - FullLoadTotalRows *int64 `json:"fullLoadTotalRows,omitempty"` - // State - READ-ONLY; Current state of the table migration. Possible values include: 'SyncTableMigrationStateBEFORELOAD', 'SyncTableMigrationStateFULLLOAD', 'SyncTableMigrationStateCOMPLETED', 'SyncTableMigrationStateCANCELED', 'SyncTableMigrationStateERROR', 'SyncTableMigrationStateFAILED' - State SyncTableMigrationState `json:"state,omitempty"` - // TotalChangesApplied - READ-ONLY; Total number of applied changes - TotalChangesApplied *int64 `json:"totalChangesApplied,omitempty"` - // DataErrorsCounter - READ-ONLY; Number of data errors occurred - DataErrorsCounter *int64 `json:"dataErrorsCounter,omitempty"` - // LastModifiedTime - READ-ONLY; Last modified time on target - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrateSQLServerSQLDbSyncTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbSyncTaskOutputTableLevel. -func (msssdstotl MigrateSQLServerSQLDbSyncTaskOutputTableLevel) MarshalJSON() ([]byte, error) { - msssdstotl.ResultType = ResultTypeBasicMigrateSQLServerSQLDbSyncTaskOutputResultTypeTableLevelOutput - objectMap := make(map[string]interface{}) - if msssdstotl.ResultType != "" { - objectMap["resultType"] = msssdstotl.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseError is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputTableLevel. -func (msssdstotl MigrateSQLServerSQLDbSyncTaskOutputTableLevel) AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseError() (*MigrateSQLServerSQLDbSyncTaskOutputDatabaseError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputError is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputTableLevel. -func (msssdstotl MigrateSQLServerSQLDbSyncTaskOutputTableLevel) AsMigrateSQLServerSQLDbSyncTaskOutputError() (*MigrateSQLServerSQLDbSyncTaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputTableLevel. -func (msssdstotl MigrateSQLServerSQLDbSyncTaskOutputTableLevel) AsMigrateSQLServerSQLDbSyncTaskOutputTableLevel() (*MigrateSQLServerSQLDbSyncTaskOutputTableLevel, bool) { - return &msssdstotl, true -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputTableLevel. -func (msssdstotl MigrateSQLServerSQLDbSyncTaskOutputTableLevel) AsMigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbSyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputTableLevel. -func (msssdstotl MigrateSQLServerSQLDbSyncTaskOutputTableLevel) AsMigrateSQLServerSQLDbSyncTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbSyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskOutput is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputTableLevel. -func (msssdstotl MigrateSQLServerSQLDbSyncTaskOutputTableLevel) AsMigrateSQLServerSQLDbSyncTaskOutput() (*MigrateSQLServerSQLDbSyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLDbSyncTaskOutput is the BasicMigrateSQLServerSQLDbSyncTaskOutput implementation for MigrateSQLServerSQLDbSyncTaskOutputTableLevel. -func (msssdstotl MigrateSQLServerSQLDbSyncTaskOutputTableLevel) AsBasicMigrateSQLServerSQLDbSyncTaskOutput() (BasicMigrateSQLServerSQLDbSyncTaskOutput, bool) { - return &msssdstotl, true -} - -// MigrateSQLServerSQLDbSyncTaskProperties properties for the task that migrates on-prem SQL Server -// databases to Azure SQL Database for online migrations -type MigrateSQLServerSQLDbSyncTaskProperties struct { - // Input - Task input - Input *MigrateSQLServerSQLDbSyncTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]BasicMigrateSQLServerSQLDbSyncTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) MarshalJSON() ([]byte, error) { - msssdstp.TaskType = TaskTypeMigrateSQLServerAzureSQLDbSync - objectMap := make(map[string]interface{}) - if msssdstp.Input != nil { - objectMap["input"] = msssdstp.Input - } - if msssdstp.TaskType != "" { - objectMap["taskType"] = msssdstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return &msssdstp, true -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbSyncTaskProperties. -func (msssdstp MigrateSQLServerSQLDbSyncTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &msssdstp, true -} - -// UnmarshalJSON is the custom unmarshaler for MigrateSQLServerSQLDbSyncTaskProperties struct. -func (msssdstp *MigrateSQLServerSQLDbSyncTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input MigrateSQLServerSQLDbSyncTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - msssdstp.Input = &input - } - case "output": - if v != nil { - output, err := unmarshalBasicMigrateSQLServerSQLDbSyncTaskOutputArray(*v) - if err != nil { - return err - } - msssdstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - msssdstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - msssdstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - msssdstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - msssdstp.TaskType = taskType - } - } - } - - return nil -} - -// MigrateSQLServerSQLDbTaskInput input for the task that migrates on-prem SQL Server databases to Azure -// SQL Database -type MigrateSQLServerSQLDbTaskInput struct { - // SelectedDatabases - Databases to migrate - SelectedDatabases *[]MigrateSQLServerSQLDbDatabaseInput `json:"selectedDatabases,omitempty"` - // ValidationOptions - Options for enabling various post migration validations. Available options, - // 1.) Data Integrity Check: Performs a checksum based comparison on source and target tables after the migration to ensure the correctness of the data. - // 2.) Schema Validation: Performs a thorough schema comparison between the source and target tables and provides a list of differences between the source and target database, 3.) Query Analysis: Executes a set of queries picked up automatically either from the Query Plan Cache or Query Store and execute them and compares the execution time between the source and target database. - ValidationOptions *MigrationValidationOptions `json:"validationOptions,omitempty"` - // SourceConnectionInfo - Information for connecting to source - SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetConnectionInfo - Information for connecting to target - TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` -} - -// BasicMigrateSQLServerSQLDbTaskOutput output for the task that migrates on-prem SQL Server databases to Azure SQL -// Database -type BasicMigrateSQLServerSQLDbTaskOutput interface { - AsMigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult, bool) - AsMigrateSQLServerSQLDbTaskOutputValidationResult() (*MigrateSQLServerSQLDbTaskOutputValidationResult, bool) - AsMigrateSQLServerSQLDbTaskOutputError() (*MigrateSQLServerSQLDbTaskOutputError, bool) - AsMigrateSQLServerSQLDbTaskOutputTableLevel() (*MigrateSQLServerSQLDbTaskOutputTableLevel, bool) - AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevel, bool) - AsMigrateSQLServerSQLDbTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbTaskOutputMigrationLevel, bool) - AsMigrateSQLServerSQLDbTaskOutput() (*MigrateSQLServerSQLDbTaskOutput, bool) -} - -// MigrateSQLServerSQLDbTaskOutput output for the task that migrates on-prem SQL Server databases to Azure SQL -// Database -type MigrateSQLServerSQLDbTaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrateSQLServerSQLDbTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationDatabaseLevelValidationOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationValidationOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLDbTaskOutput `json:"resultType,omitempty"` -} - -func unmarshalBasicMigrateSQLServerSQLDbTaskOutput(body []byte) (BasicMigrateSQLServerSQLDbTaskOutput, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["resultType"] { - case string(ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationDatabaseLevelValidationOutput): - var msssdtodlvr MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult - err := json.Unmarshal(body, &msssdtodlvr) - return msssdtodlvr, err - case string(ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationValidationOutput): - var msssdtovr MigrateSQLServerSQLDbTaskOutputValidationResult - err := json.Unmarshal(body, &msssdtovr) - return msssdtovr, err - case string(ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeErrorOutput): - var msssdtoe MigrateSQLServerSQLDbTaskOutputError - err := json.Unmarshal(body, &msssdtoe) - return msssdtoe, err - case string(ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeTableLevelOutput): - var msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel - err := json.Unmarshal(body, &msssdtotl) - return msssdtotl, err - case string(ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeDatabaseLevelOutput): - var msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel - err := json.Unmarshal(body, &msssdtodl) - return msssdtodl, err - case string(ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationLevelOutput): - var msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel - err := json.Unmarshal(body, &msssdtoml) - return msssdtoml, err - default: - var msssdto MigrateSQLServerSQLDbTaskOutput - err := json.Unmarshal(body, &msssdto) - return msssdto, err - } -} -func unmarshalBasicMigrateSQLServerSQLDbTaskOutputArray(body []byte) ([]BasicMigrateSQLServerSQLDbTaskOutput, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - msssdtoArray := make([]BasicMigrateSQLServerSQLDbTaskOutput, len(rawMessages)) - - for index, rawMessage := range rawMessages { - msssdto, err := unmarshalBasicMigrateSQLServerSQLDbTaskOutput(*rawMessage) - if err != nil { - return nil, err - } - msssdtoArray[index] = msssdto - } - return msssdtoArray, nil -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbTaskOutput. -func (msssdto MigrateSQLServerSQLDbTaskOutput) MarshalJSON() ([]byte, error) { - msssdto.ResultType = ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrateSQLServerSQLDbTaskOutput - objectMap := make(map[string]interface{}) - if msssdto.ResultType != "" { - objectMap["resultType"] = msssdto.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutput. -func (msssdto MigrateSQLServerSQLDbTaskOutput) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputValidationResult is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutput. -func (msssdto MigrateSQLServerSQLDbTaskOutput) AsMigrateSQLServerSQLDbTaskOutputValidationResult() (*MigrateSQLServerSQLDbTaskOutputValidationResult, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputError is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutput. -func (msssdto MigrateSQLServerSQLDbTaskOutput) AsMigrateSQLServerSQLDbTaskOutputError() (*MigrateSQLServerSQLDbTaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutput. -func (msssdto MigrateSQLServerSQLDbTaskOutput) AsMigrateSQLServerSQLDbTaskOutputTableLevel() (*MigrateSQLServerSQLDbTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutput. -func (msssdto MigrateSQLServerSQLDbTaskOutput) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutput. -func (msssdto MigrateSQLServerSQLDbTaskOutput) AsMigrateSQLServerSQLDbTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutput. -func (msssdto MigrateSQLServerSQLDbTaskOutput) AsMigrateSQLServerSQLDbTaskOutput() (*MigrateSQLServerSQLDbTaskOutput, bool) { - return &msssdto, true -} - -// AsBasicMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutput. -func (msssdto MigrateSQLServerSQLDbTaskOutput) AsBasicMigrateSQLServerSQLDbTaskOutput() (BasicMigrateSQLServerSQLDbTaskOutput, bool) { - return &msssdto, true -} - -// MigrateSQLServerSQLDbTaskOutputDatabaseLevel database level result for Sql Server to Azure Sql DB -// migration. -type MigrateSQLServerSQLDbTaskOutputDatabaseLevel struct { - // DatabaseName - READ-ONLY; Name of the item - DatabaseName *string `json:"databaseName,omitempty"` - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // State - READ-ONLY; Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' - State MigrationState `json:"state,omitempty"` - // Stage - READ-ONLY; Migration stage that this database is in. Possible values include: 'DatabaseMigrationStageNone', 'DatabaseMigrationStageInitialize', 'DatabaseMigrationStageBackup', 'DatabaseMigrationStageFileCopy', 'DatabaseMigrationStageRestore', 'DatabaseMigrationStageCompleted' - Stage DatabaseMigrationStage `json:"stage,omitempty"` - // StatusMessage - READ-ONLY; Status message - StatusMessage *string `json:"statusMessage,omitempty"` - // Message - READ-ONLY; Migration progress message - Message *string `json:"message,omitempty"` - // NumberOfObjects - READ-ONLY; Number of objects - NumberOfObjects *int64 `json:"numberOfObjects,omitempty"` - // NumberOfObjectsCompleted - READ-ONLY; Number of successfully completed objects - NumberOfObjectsCompleted *int64 `json:"numberOfObjectsCompleted,omitempty"` - // ErrorCount - READ-ONLY; Number of database/object errors. - ErrorCount *int64 `json:"errorCount,omitempty"` - // ErrorPrefix - READ-ONLY; Wildcard string prefix to use for querying all errors of the item - ErrorPrefix *string `json:"errorPrefix,omitempty"` - // ResultPrefix - READ-ONLY; Wildcard string prefix to use for querying all sub-tem results of the item - ResultPrefix *string `json:"resultPrefix,omitempty"` - // ExceptionsAndWarnings - READ-ONLY; Migration exceptions and warnings. - ExceptionsAndWarnings *[]ReportableException `json:"exceptionsAndWarnings,omitempty"` - // ObjectSummary - READ-ONLY; Summary of object results in the migration - ObjectSummary map[string]*DataItemMigrationSummaryResult `json:"objectSummary"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrateSQLServerSQLDbTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationDatabaseLevelValidationOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationValidationOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLDbTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. -func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) MarshalJSON() ([]byte, error) { - msssdtodl.ResultType = ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeDatabaseLevelOutput - objectMap := make(map[string]interface{}) - if msssdtodl.ResultType != "" { - objectMap["resultType"] = msssdtodl.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. -func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputValidationResult is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. -func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbTaskOutputValidationResult() (*MigrateSQLServerSQLDbTaskOutputValidationResult, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputError is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. -func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbTaskOutputError() (*MigrateSQLServerSQLDbTaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. -func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbTaskOutputTableLevel() (*MigrateSQLServerSQLDbTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. -func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevel, bool) { - return &msssdtodl, true -} - -// AsMigrateSQLServerSQLDbTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. -func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. -func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbTaskOutput() (*MigrateSQLServerSQLDbTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. -func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) AsBasicMigrateSQLServerSQLDbTaskOutput() (BasicMigrateSQLServerSQLDbTaskOutput, bool) { - return &msssdtodl, true -} - -// MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult database validation result for Sql Server -// to Azure Sql DB migration. -type MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult struct { - // MigrationID - READ-ONLY; Migration Identifier - MigrationID *string `json:"migrationId,omitempty"` - // SourceDatabaseName - READ-ONLY; Name of the source database - SourceDatabaseName *string `json:"sourceDatabaseName,omitempty"` - // TargetDatabaseName - READ-ONLY; Name of the target database - TargetDatabaseName *string `json:"targetDatabaseName,omitempty"` - // StartedOn - READ-ONLY; Validation start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Validation end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // DataIntegrityValidationResult - READ-ONLY; Provides data integrity validation result between the source and target tables that are migrated. - DataIntegrityValidationResult *DataIntegrityValidationResult `json:"dataIntegrityValidationResult,omitempty"` - // SchemaValidationResult - READ-ONLY; Provides schema comparison result between source and target database - SchemaValidationResult *SchemaComparisonValidationResult `json:"schemaValidationResult,omitempty"` - // QueryAnalysisValidationResult - READ-ONLY; Results of some of the query execution result between source and target database - QueryAnalysisValidationResult *QueryAnalysisValidationResult `json:"queryAnalysisValidationResult,omitempty"` - // Status - READ-ONLY; Current status of validation at the database level. Possible values include: 'ValidationStatusDefault', 'ValidationStatusNotStarted', 'ValidationStatusInitialized', 'ValidationStatusInProgress', 'ValidationStatusCompleted', 'ValidationStatusCompletedWithIssues', 'ValidationStatusFailed', 'ValidationStatusStopped' - Status ValidationStatus `json:"status,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrateSQLServerSQLDbTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationDatabaseLevelValidationOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationValidationOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLDbTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult. -func (msssdtodlvr MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult) MarshalJSON() ([]byte, error) { - msssdtodlvr.ResultType = ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationDatabaseLevelValidationOutput - objectMap := make(map[string]interface{}) - if msssdtodlvr.ResultType != "" { - objectMap["resultType"] = msssdtodlvr.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult. -func (msssdtodlvr MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult, bool) { - return &msssdtodlvr, true -} - -// AsMigrateSQLServerSQLDbTaskOutputValidationResult is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult. -func (msssdtodlvr MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult) AsMigrateSQLServerSQLDbTaskOutputValidationResult() (*MigrateSQLServerSQLDbTaskOutputValidationResult, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputError is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult. -func (msssdtodlvr MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult) AsMigrateSQLServerSQLDbTaskOutputError() (*MigrateSQLServerSQLDbTaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult. -func (msssdtodlvr MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult) AsMigrateSQLServerSQLDbTaskOutputTableLevel() (*MigrateSQLServerSQLDbTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult. -func (msssdtodlvr MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult. -func (msssdtodlvr MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult) AsMigrateSQLServerSQLDbTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult. -func (msssdtodlvr MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult) AsMigrateSQLServerSQLDbTaskOutput() (*MigrateSQLServerSQLDbTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult. -func (msssdtodlvr MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult) AsBasicMigrateSQLServerSQLDbTaskOutput() (BasicMigrateSQLServerSQLDbTaskOutput, bool) { - return &msssdtodlvr, true -} - -// MigrateSQLServerSQLDbTaskOutputError task errors for Sql Server to Azure Sql DB migration. -type MigrateSQLServerSQLDbTaskOutputError struct { - // Error - READ-ONLY; Migration error - Error *ReportableException `json:"error,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrateSQLServerSQLDbTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationDatabaseLevelValidationOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationValidationOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLDbTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbTaskOutputError. -func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) MarshalJSON() ([]byte, error) { - msssdtoe.ResultType = ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeErrorOutput - objectMap := make(map[string]interface{}) - if msssdtoe.ResultType != "" { - objectMap["resultType"] = msssdtoe.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputError. -func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputValidationResult is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputError. -func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) AsMigrateSQLServerSQLDbTaskOutputValidationResult() (*MigrateSQLServerSQLDbTaskOutputValidationResult, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputError is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputError. -func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) AsMigrateSQLServerSQLDbTaskOutputError() (*MigrateSQLServerSQLDbTaskOutputError, bool) { - return &msssdtoe, true -} - -// AsMigrateSQLServerSQLDbTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputError. -func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) AsMigrateSQLServerSQLDbTaskOutputTableLevel() (*MigrateSQLServerSQLDbTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputError. -func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputError. -func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) AsMigrateSQLServerSQLDbTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputError. -func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) AsMigrateSQLServerSQLDbTaskOutput() (*MigrateSQLServerSQLDbTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputError. -func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) AsBasicMigrateSQLServerSQLDbTaskOutput() (BasicMigrateSQLServerSQLDbTaskOutput, bool) { - return &msssdtoe, true -} - -// MigrateSQLServerSQLDbTaskOutputMigrationLevel migration level result for Sql server to Azure Sql DB -// migration. -type MigrateSQLServerSQLDbTaskOutputMigrationLevel struct { - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // DurationInSeconds - READ-ONLY; Duration of task execution in seconds. - DurationInSeconds *int64 `json:"durationInSeconds,omitempty"` - // Status - READ-ONLY; Current status of migration. Possible values include: 'MigrationStatusDefault', 'MigrationStatusConnecting', 'MigrationStatusSourceAndTargetSelected', 'MigrationStatusSelectLogins', 'MigrationStatusConfigured', 'MigrationStatusRunning', 'MigrationStatusError', 'MigrationStatusStopped', 'MigrationStatusCompleted', 'MigrationStatusCompletedWithWarnings' - Status MigrationStatus `json:"status,omitempty"` - // StatusMessage - READ-ONLY; Migration status message - StatusMessage *string `json:"statusMessage,omitempty"` - // Message - READ-ONLY; Migration progress message - Message *string `json:"message,omitempty"` - // Databases - READ-ONLY; Selected databases as a map from database name to database id - Databases map[string]*string `json:"databases"` - // DatabaseSummary - READ-ONLY; Summary of database results in the migration - DatabaseSummary map[string]*DatabaseSummaryResult `json:"databaseSummary"` - // MigrationReport - READ-ONLY; Migration Report Result, provides unique url for downloading your migration report. - MigrationReport *MigrationReportResult `json:"migrationReport,omitempty"` - // SourceServerVersion - READ-ONLY; Source server version - SourceServerVersion *string `json:"sourceServerVersion,omitempty"` - // SourceServerBrandVersion - READ-ONLY; Source server brand version - SourceServerBrandVersion *string `json:"sourceServerBrandVersion,omitempty"` - // TargetServerVersion - READ-ONLY; Target server version - TargetServerVersion *string `json:"targetServerVersion,omitempty"` - // TargetServerBrandVersion - READ-ONLY; Target server brand version - TargetServerBrandVersion *string `json:"targetServerBrandVersion,omitempty"` - // ExceptionsAndWarnings - READ-ONLY; Migration exceptions and warnings. - ExceptionsAndWarnings *[]ReportableException `json:"exceptionsAndWarnings,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrateSQLServerSQLDbTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationDatabaseLevelValidationOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationValidationOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLDbTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbTaskOutputMigrationLevel. -func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) MarshalJSON() ([]byte, error) { - msssdtoml.ResultType = ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationLevelOutput - objectMap := make(map[string]interface{}) - if msssdtoml.ResultType != "" { - objectMap["resultType"] = msssdtoml.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputMigrationLevel. -func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputValidationResult is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputMigrationLevel. -func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbTaskOutputValidationResult() (*MigrateSQLServerSQLDbTaskOutputValidationResult, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputError is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputMigrationLevel. -func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbTaskOutputError() (*MigrateSQLServerSQLDbTaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputMigrationLevel. -func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbTaskOutputTableLevel() (*MigrateSQLServerSQLDbTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputMigrationLevel. -func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputMigrationLevel. -func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbTaskOutputMigrationLevel, bool) { - return &msssdtoml, true -} - -// AsMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputMigrationLevel. -func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbTaskOutput() (*MigrateSQLServerSQLDbTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputMigrationLevel. -func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) AsBasicMigrateSQLServerSQLDbTaskOutput() (BasicMigrateSQLServerSQLDbTaskOutput, bool) { - return &msssdtoml, true -} - -// MigrateSQLServerSQLDbTaskOutputTableLevel table level result for Sql Server to Azure Sql DB migration. -type MigrateSQLServerSQLDbTaskOutputTableLevel struct { - // ObjectName - READ-ONLY; Name of the item - ObjectName *string `json:"objectName,omitempty"` - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // State - READ-ONLY; Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' - State MigrationState `json:"state,omitempty"` - // StatusMessage - READ-ONLY; Status message - StatusMessage *string `json:"statusMessage,omitempty"` - // ItemsCount - READ-ONLY; Number of items - ItemsCount *int64 `json:"itemsCount,omitempty"` - // ItemsCompletedCount - READ-ONLY; Number of successfully completed items - ItemsCompletedCount *int64 `json:"itemsCompletedCount,omitempty"` - // ErrorPrefix - READ-ONLY; Wildcard string prefix to use for querying all errors of the item - ErrorPrefix *string `json:"errorPrefix,omitempty"` - // ResultPrefix - READ-ONLY; Wildcard string prefix to use for querying all sub-tem results of the item - ResultPrefix *string `json:"resultPrefix,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrateSQLServerSQLDbTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationDatabaseLevelValidationOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationValidationOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLDbTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbTaskOutputTableLevel. -func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) MarshalJSON() ([]byte, error) { - msssdtotl.ResultType = ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeTableLevelOutput - objectMap := make(map[string]interface{}) - if msssdtotl.ResultType != "" { - objectMap["resultType"] = msssdtotl.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputTableLevel. -func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputValidationResult is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputTableLevel. -func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) AsMigrateSQLServerSQLDbTaskOutputValidationResult() (*MigrateSQLServerSQLDbTaskOutputValidationResult, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputError is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputTableLevel. -func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) AsMigrateSQLServerSQLDbTaskOutputError() (*MigrateSQLServerSQLDbTaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputTableLevel. -func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) AsMigrateSQLServerSQLDbTaskOutputTableLevel() (*MigrateSQLServerSQLDbTaskOutputTableLevel, bool) { - return &msssdtotl, true -} - -// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputTableLevel. -func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputTableLevel. -func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) AsMigrateSQLServerSQLDbTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputTableLevel. -func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) AsMigrateSQLServerSQLDbTaskOutput() (*MigrateSQLServerSQLDbTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputTableLevel. -func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) AsBasicMigrateSQLServerSQLDbTaskOutput() (BasicMigrateSQLServerSQLDbTaskOutput, bool) { - return &msssdtotl, true -} - -// MigrateSQLServerSQLDbTaskOutputValidationResult validation result for Sql Server to Azure Sql DB -// migration. -type MigrateSQLServerSQLDbTaskOutputValidationResult struct { - // MigrationID - READ-ONLY; Migration Identifier - MigrationID *string `json:"migrationId,omitempty"` - // SummaryResults - Validation summary results for each database - SummaryResults map[string]*MigrationValidationDatabaseSummaryResult `json:"summaryResults"` - // Status - READ-ONLY; Current status of validation at the migration level. Status from the database validation result status will be aggregated here. Possible values include: 'ValidationStatusDefault', 'ValidationStatusNotStarted', 'ValidationStatusInitialized', 'ValidationStatusInProgress', 'ValidationStatusCompleted', 'ValidationStatusCompletedWithIssues', 'ValidationStatusFailed', 'ValidationStatusStopped' - Status ValidationStatus `json:"status,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrateSQLServerSQLDbTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationDatabaseLevelValidationOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationValidationOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeTableLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLDbTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbTaskOutputValidationResult. -func (msssdtovr MigrateSQLServerSQLDbTaskOutputValidationResult) MarshalJSON() ([]byte, error) { - msssdtovr.ResultType = ResultTypeBasicMigrateSQLServerSQLDbTaskOutputResultTypeMigrationValidationOutput - objectMap := make(map[string]interface{}) - if msssdtovr.SummaryResults != nil { - objectMap["summaryResults"] = msssdtovr.SummaryResults - } - if msssdtovr.ResultType != "" { - objectMap["resultType"] = msssdtovr.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputValidationResult. -func (msssdtovr MigrateSQLServerSQLDbTaskOutputValidationResult) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevelValidationResult, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputValidationResult is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputValidationResult. -func (msssdtovr MigrateSQLServerSQLDbTaskOutputValidationResult) AsMigrateSQLServerSQLDbTaskOutputValidationResult() (*MigrateSQLServerSQLDbTaskOutputValidationResult, bool) { - return &msssdtovr, true -} - -// AsMigrateSQLServerSQLDbTaskOutputError is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputValidationResult. -func (msssdtovr MigrateSQLServerSQLDbTaskOutputValidationResult) AsMigrateSQLServerSQLDbTaskOutputError() (*MigrateSQLServerSQLDbTaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputValidationResult. -func (msssdtovr MigrateSQLServerSQLDbTaskOutputValidationResult) AsMigrateSQLServerSQLDbTaskOutputTableLevel() (*MigrateSQLServerSQLDbTaskOutputTableLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputValidationResult. -func (msssdtovr MigrateSQLServerSQLDbTaskOutputValidationResult) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputValidationResult. -func (msssdtovr MigrateSQLServerSQLDbTaskOutputValidationResult) AsMigrateSQLServerSQLDbTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputValidationResult. -func (msssdtovr MigrateSQLServerSQLDbTaskOutputValidationResult) AsMigrateSQLServerSQLDbTaskOutput() (*MigrateSQLServerSQLDbTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputValidationResult. -func (msssdtovr MigrateSQLServerSQLDbTaskOutputValidationResult) AsBasicMigrateSQLServerSQLDbTaskOutput() (BasicMigrateSQLServerSQLDbTaskOutput, bool) { - return &msssdtovr, true -} - -// MigrateSQLServerSQLDbTaskProperties properties for the task that migrates on-prem SQL Server databases -// to Azure SQL Database -type MigrateSQLServerSQLDbTaskProperties struct { - // Input - Task input - Input *MigrateSQLServerSQLDbTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]BasicMigrateSQLServerSQLDbTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) MarshalJSON() ([]byte, error) { - msssdtp.TaskType = TaskTypeMigrateSQLServerSQLDb - objectMap := make(map[string]interface{}) - if msssdtp.Input != nil { - objectMap["input"] = msssdtp.Input - } - if msssdtp.TaskType != "" { - objectMap["taskType"] = msssdtp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return &msssdtp, true -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. -func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &msssdtp, true -} - -// UnmarshalJSON is the custom unmarshaler for MigrateSQLServerSQLDbTaskProperties struct. -func (msssdtp *MigrateSQLServerSQLDbTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input MigrateSQLServerSQLDbTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - msssdtp.Input = &input - } - case "output": - if v != nil { - output, err := unmarshalBasicMigrateSQLServerSQLDbTaskOutputArray(*v) - if err != nil { - return err - } - msssdtp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - msssdtp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - msssdtp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - msssdtp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - msssdtp.TaskType = taskType - } - } - } - - return nil -} - -// MigrateSQLServerSQLMIDatabaseInput database specific information for SQL to Azure SQL DB Managed -// Instance migration task inputs -type MigrateSQLServerSQLMIDatabaseInput struct { - // Name - Name of the database - Name *string `json:"name,omitempty"` - // RestoreDatabaseName - Name of the database at destination - RestoreDatabaseName *string `json:"restoreDatabaseName,omitempty"` - // BackupFileShare - Backup file share information for backing up this database. - BackupFileShare *FileShare `json:"backupFileShare,omitempty"` - // BackupFilePaths - The list of backup files to be used in case of existing backups. - BackupFilePaths *[]string `json:"backupFilePaths,omitempty"` -} - -// MigrateSQLServerSQLMISyncTaskInput input for task that migrates SQL Server databases to Azure SQL -// Database Managed Instance online scenario. -type MigrateSQLServerSQLMISyncTaskInput struct { - // SelectedDatabases - Databases to migrate - SelectedDatabases *[]MigrateSQLServerSQLMIDatabaseInput `json:"selectedDatabases,omitempty"` - // BackupFileShare - Backup file share information for all selected databases. - BackupFileShare *FileShare `json:"backupFileShare,omitempty"` - // StorageResourceID - Fully qualified resourceId of storage - StorageResourceID *string `json:"storageResourceId,omitempty"` - // SourceConnectionInfo - Connection information for source SQL Server - SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetConnectionInfo - Connection information for Azure SQL Database Managed Instance - TargetConnectionInfo *MiSQLConnectionInfo `json:"targetConnectionInfo,omitempty"` - // AzureApp - Azure Active Directory Application the DMS instance will use to connect to the target instance of Azure SQL Database Managed Instance and the Azure Storage Account - AzureApp *AzureActiveDirectoryApp `json:"azureApp,omitempty"` -} - -// BasicMigrateSQLServerSQLMISyncTaskOutput output for task that migrates SQL Server databases to Azure SQL Database -// Managed Instance using Log Replay Service. -type BasicMigrateSQLServerSQLMISyncTaskOutput interface { - AsMigrateSQLServerSQLMISyncTaskOutputError() (*MigrateSQLServerSQLMISyncTaskOutputError, bool) - AsMigrateSQLServerSQLMISyncTaskOutputDatabaseLevel() (*MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel, bool) - AsMigrateSQLServerSQLMISyncTaskOutputMigrationLevel() (*MigrateSQLServerSQLMISyncTaskOutputMigrationLevel, bool) - AsMigrateSQLServerSQLMISyncTaskOutput() (*MigrateSQLServerSQLMISyncTaskOutput, bool) -} - -// MigrateSQLServerSQLMISyncTaskOutput output for task that migrates SQL Server databases to Azure SQL Database -// Managed Instance using Log Replay Service. -type MigrateSQLServerSQLMISyncTaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrateSQLServerSQLMISyncTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutput `json:"resultType,omitempty"` -} - -func unmarshalBasicMigrateSQLServerSQLMISyncTaskOutput(body []byte) (BasicMigrateSQLServerSQLMISyncTaskOutput, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["resultType"] { - case string(ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeErrorOutput): - var msssmstoe MigrateSQLServerSQLMISyncTaskOutputError - err := json.Unmarshal(body, &msssmstoe) - return msssmstoe, err - case string(ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeDatabaseLevelOutput): - var msssmstodl MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel - err := json.Unmarshal(body, &msssmstodl) - return msssmstodl, err - case string(ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrationLevelOutput): - var msssmstoml MigrateSQLServerSQLMISyncTaskOutputMigrationLevel - err := json.Unmarshal(body, &msssmstoml) - return msssmstoml, err - default: - var msssmsto MigrateSQLServerSQLMISyncTaskOutput - err := json.Unmarshal(body, &msssmsto) - return msssmsto, err - } -} -func unmarshalBasicMigrateSQLServerSQLMISyncTaskOutputArray(body []byte) ([]BasicMigrateSQLServerSQLMISyncTaskOutput, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - msssmstoArray := make([]BasicMigrateSQLServerSQLMISyncTaskOutput, len(rawMessages)) - - for index, rawMessage := range rawMessages { - msssmsto, err := unmarshalBasicMigrateSQLServerSQLMISyncTaskOutput(*rawMessage) - if err != nil { - return nil, err - } - msssmstoArray[index] = msssmsto - } - return msssmstoArray, nil -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMISyncTaskOutput. -func (msssmsto MigrateSQLServerSQLMISyncTaskOutput) MarshalJSON() ([]byte, error) { - msssmsto.ResultType = ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrateSQLServerSQLMISyncTaskOutput - objectMap := make(map[string]interface{}) - if msssmsto.ResultType != "" { - objectMap["resultType"] = msssmsto.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLMISyncTaskOutputError is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutput. -func (msssmsto MigrateSQLServerSQLMISyncTaskOutput) AsMigrateSQLServerSQLMISyncTaskOutputError() (*MigrateSQLServerSQLMISyncTaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutput. -func (msssmsto MigrateSQLServerSQLMISyncTaskOutput) AsMigrateSQLServerSQLMISyncTaskOutputDatabaseLevel() (*MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutput. -func (msssmsto MigrateSQLServerSQLMISyncTaskOutput) AsMigrateSQLServerSQLMISyncTaskOutputMigrationLevel() (*MigrateSQLServerSQLMISyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskOutput is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutput. -func (msssmsto MigrateSQLServerSQLMISyncTaskOutput) AsMigrateSQLServerSQLMISyncTaskOutput() (*MigrateSQLServerSQLMISyncTaskOutput, bool) { - return &msssmsto, true -} - -// AsBasicMigrateSQLServerSQLMISyncTaskOutput is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutput. -func (msssmsto MigrateSQLServerSQLMISyncTaskOutput) AsBasicMigrateSQLServerSQLMISyncTaskOutput() (BasicMigrateSQLServerSQLMISyncTaskOutput, bool) { - return &msssmsto, true -} - -// MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel ... -type MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel struct { - // SourceDatabaseName - READ-ONLY; Name of the database - SourceDatabaseName *string `json:"sourceDatabaseName,omitempty"` - // MigrationState - READ-ONLY; Current state of database. Possible values include: 'UNDEFINED', 'INITIAL', 'FULLBACKUPUPLOADSTART', 'LOGSHIPPINGSTART', 'UPLOADLOGFILESSTART', 'CUTOVERSTART', 'POSTCUTOVERCOMPLETE', 'COMPLETED', 'CANCELLED', 'FAILED' - MigrationState DatabaseMigrationState `json:"migrationState,omitempty"` - // StartedOn - READ-ONLY; Database migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Database migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // FullBackupSetInfo - READ-ONLY; Details of full backup set - FullBackupSetInfo *BackupSetInfo `json:"fullBackupSetInfo,omitempty"` - // LastRestoredBackupSetInfo - READ-ONLY; Last applied backup set information - LastRestoredBackupSetInfo *BackupSetInfo `json:"lastRestoredBackupSetInfo,omitempty"` - // ActiveBackupSets - READ-ONLY; Backup sets that are currently active (Either being uploaded or getting restored) - ActiveBackupSets *[]BackupSetInfo `json:"activeBackupSets,omitempty"` - // ContainerName - READ-ONLY; Name of container created in the Azure Storage account where backups are copied to - ContainerName *string `json:"containerName,omitempty"` - // ErrorPrefix - READ-ONLY; prefix string to use for querying errors for this database - ErrorPrefix *string `json:"errorPrefix,omitempty"` - // IsFullBackupRestored - READ-ONLY; Whether full backup has been applied to the target database or not - IsFullBackupRestored *bool `json:"isFullBackupRestored,omitempty"` - // ExceptionsAndWarnings - READ-ONLY; Migration exceptions and warnings - ExceptionsAndWarnings *[]ReportableException `json:"exceptionsAndWarnings,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrateSQLServerSQLMISyncTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel. -func (msssmstodl MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel) MarshalJSON() ([]byte, error) { - msssmstodl.ResultType = ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeDatabaseLevelOutput - objectMap := make(map[string]interface{}) - if msssmstodl.ResultType != "" { - objectMap["resultType"] = msssmstodl.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLMISyncTaskOutputError is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel. -func (msssmstodl MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel) AsMigrateSQLServerSQLMISyncTaskOutputError() (*MigrateSQLServerSQLMISyncTaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel. -func (msssmstodl MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel) AsMigrateSQLServerSQLMISyncTaskOutputDatabaseLevel() (*MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel, bool) { - return &msssmstodl, true -} - -// AsMigrateSQLServerSQLMISyncTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel. -func (msssmstodl MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel) AsMigrateSQLServerSQLMISyncTaskOutputMigrationLevel() (*MigrateSQLServerSQLMISyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskOutput is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel. -func (msssmstodl MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel) AsMigrateSQLServerSQLMISyncTaskOutput() (*MigrateSQLServerSQLMISyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLMISyncTaskOutput is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel. -func (msssmstodl MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel) AsBasicMigrateSQLServerSQLMISyncTaskOutput() (BasicMigrateSQLServerSQLMISyncTaskOutput, bool) { - return &msssmstodl, true -} - -// MigrateSQLServerSQLMISyncTaskOutputError ... -type MigrateSQLServerSQLMISyncTaskOutputError struct { - // Error - READ-ONLY; Migration error - Error *ReportableException `json:"error,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrateSQLServerSQLMISyncTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMISyncTaskOutputError. -func (msssmstoe MigrateSQLServerSQLMISyncTaskOutputError) MarshalJSON() ([]byte, error) { - msssmstoe.ResultType = ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeErrorOutput - objectMap := make(map[string]interface{}) - if msssmstoe.ResultType != "" { - objectMap["resultType"] = msssmstoe.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLMISyncTaskOutputError is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutputError. -func (msssmstoe MigrateSQLServerSQLMISyncTaskOutputError) AsMigrateSQLServerSQLMISyncTaskOutputError() (*MigrateSQLServerSQLMISyncTaskOutputError, bool) { - return &msssmstoe, true -} - -// AsMigrateSQLServerSQLMISyncTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutputError. -func (msssmstoe MigrateSQLServerSQLMISyncTaskOutputError) AsMigrateSQLServerSQLMISyncTaskOutputDatabaseLevel() (*MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutputError. -func (msssmstoe MigrateSQLServerSQLMISyncTaskOutputError) AsMigrateSQLServerSQLMISyncTaskOutputMigrationLevel() (*MigrateSQLServerSQLMISyncTaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskOutput is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutputError. -func (msssmstoe MigrateSQLServerSQLMISyncTaskOutputError) AsMigrateSQLServerSQLMISyncTaskOutput() (*MigrateSQLServerSQLMISyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLMISyncTaskOutput is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutputError. -func (msssmstoe MigrateSQLServerSQLMISyncTaskOutputError) AsBasicMigrateSQLServerSQLMISyncTaskOutput() (BasicMigrateSQLServerSQLMISyncTaskOutput, bool) { - return &msssmstoe, true -} - -// MigrateSQLServerSQLMISyncTaskOutputMigrationLevel ... -type MigrateSQLServerSQLMISyncTaskOutputMigrationLevel struct { - // DatabaseCount - READ-ONLY; Count of databases - DatabaseCount *int32 `json:"databaseCount,omitempty"` - // State - READ-ONLY; Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' - State MigrationState `json:"state,omitempty"` - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // SourceServerName - READ-ONLY; Source server name - SourceServerName *string `json:"sourceServerName,omitempty"` - // SourceServerVersion - READ-ONLY; Source server version - SourceServerVersion *string `json:"sourceServerVersion,omitempty"` - // SourceServerBrandVersion - READ-ONLY; Source server brand version - SourceServerBrandVersion *string `json:"sourceServerBrandVersion,omitempty"` - // TargetServerName - READ-ONLY; Target server name - TargetServerName *string `json:"targetServerName,omitempty"` - // TargetServerVersion - READ-ONLY; Target server version - TargetServerVersion *string `json:"targetServerVersion,omitempty"` - // TargetServerBrandVersion - READ-ONLY; Target server brand version - TargetServerBrandVersion *string `json:"targetServerBrandVersion,omitempty"` - // DatabaseErrorCount - READ-ONLY; Number of database level errors - DatabaseErrorCount *int32 `json:"databaseErrorCount,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrateSQLServerSQLMISyncTaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMISyncTaskOutputMigrationLevel. -func (msssmstoml MigrateSQLServerSQLMISyncTaskOutputMigrationLevel) MarshalJSON() ([]byte, error) { - msssmstoml.ResultType = ResultTypeBasicMigrateSQLServerSQLMISyncTaskOutputResultTypeMigrationLevelOutput - objectMap := make(map[string]interface{}) - if msssmstoml.ResultType != "" { - objectMap["resultType"] = msssmstoml.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLMISyncTaskOutputError is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutputMigrationLevel. -func (msssmstoml MigrateSQLServerSQLMISyncTaskOutputMigrationLevel) AsMigrateSQLServerSQLMISyncTaskOutputError() (*MigrateSQLServerSQLMISyncTaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutputMigrationLevel. -func (msssmstoml MigrateSQLServerSQLMISyncTaskOutputMigrationLevel) AsMigrateSQLServerSQLMISyncTaskOutputDatabaseLevel() (*MigrateSQLServerSQLMISyncTaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutputMigrationLevel. -func (msssmstoml MigrateSQLServerSQLMISyncTaskOutputMigrationLevel) AsMigrateSQLServerSQLMISyncTaskOutputMigrationLevel() (*MigrateSQLServerSQLMISyncTaskOutputMigrationLevel, bool) { - return &msssmstoml, true -} - -// AsMigrateSQLServerSQLMISyncTaskOutput is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutputMigrationLevel. -func (msssmstoml MigrateSQLServerSQLMISyncTaskOutputMigrationLevel) AsMigrateSQLServerSQLMISyncTaskOutput() (*MigrateSQLServerSQLMISyncTaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLMISyncTaskOutput is the BasicMigrateSQLServerSQLMISyncTaskOutput implementation for MigrateSQLServerSQLMISyncTaskOutputMigrationLevel. -func (msssmstoml MigrateSQLServerSQLMISyncTaskOutputMigrationLevel) AsBasicMigrateSQLServerSQLMISyncTaskOutput() (BasicMigrateSQLServerSQLMISyncTaskOutput, bool) { - return &msssmstoml, true -} - -// MigrateSQLServerSQLMISyncTaskProperties properties for task that migrates SQL Server databases to Azure -// SQL Database Managed Instance sync scenario -type MigrateSQLServerSQLMISyncTaskProperties struct { - // Input - Task input - Input *MigrateSQLServerSQLMISyncTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]BasicMigrateSQLServerSQLMISyncTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) MarshalJSON() ([]byte, error) { - msssmstp.TaskType = TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS - objectMap := make(map[string]interface{}) - if msssmstp.Input != nil { - objectMap["input"] = msssmstp.Input - } - if msssmstp.TaskType != "" { - objectMap["taskType"] = msssmstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return &msssmstp, true -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMISyncTaskProperties. -func (msssmstp MigrateSQLServerSQLMISyncTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &msssmstp, true -} - -// UnmarshalJSON is the custom unmarshaler for MigrateSQLServerSQLMISyncTaskProperties struct. -func (msssmstp *MigrateSQLServerSQLMISyncTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input MigrateSQLServerSQLMISyncTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - msssmstp.Input = &input - } - case "output": - if v != nil { - output, err := unmarshalBasicMigrateSQLServerSQLMISyncTaskOutputArray(*v) - if err != nil { - return err - } - msssmstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - msssmstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - msssmstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - msssmstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - msssmstp.TaskType = taskType - } - } - } - - return nil -} - -// MigrateSQLServerSQLMITaskInput input for task that migrates SQL Server databases to Azure SQL Database -// Managed Instance. -type MigrateSQLServerSQLMITaskInput struct { - // SelectedDatabases - Databases to migrate - SelectedDatabases *[]MigrateSQLServerSQLMIDatabaseInput `json:"selectedDatabases,omitempty"` - // SelectedLogins - Logins to migrate. - SelectedLogins *[]string `json:"selectedLogins,omitempty"` - // SelectedAgentJobs - Agent Jobs to migrate. - SelectedAgentJobs *[]string `json:"selectedAgentJobs,omitempty"` - // BackupFileShare - Backup file share information for all selected databases. - BackupFileShare *FileShare `json:"backupFileShare,omitempty"` - // BackupBlobShare - SAS URI of Azure Storage Account Container to be used for storing backup files. - BackupBlobShare *BlobShare `json:"backupBlobShare,omitempty"` - // BackupMode - Backup Mode to specify whether to use existing backup or create new backup. If using existing backups, backup file paths are required to be provided in selectedDatabases. Possible values include: 'CreateBackup', 'ExistingBackup' - BackupMode BackupMode `json:"backupMode,omitempty"` - // SourceConnectionInfo - Information for connecting to source - SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetConnectionInfo - Information for connecting to target - TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` -} - -// BasicMigrateSQLServerSQLMITaskOutput output for task that migrates SQL Server databases to Azure SQL Database -// Managed Instance. -type BasicMigrateSQLServerSQLMITaskOutput interface { - AsMigrateSQLServerSQLMITaskOutputError() (*MigrateSQLServerSQLMITaskOutputError, bool) - AsMigrateSQLServerSQLMITaskOutputLoginLevel() (*MigrateSQLServerSQLMITaskOutputLoginLevel, bool) - AsMigrateSQLServerSQLMITaskOutputAgentJobLevel() (*MigrateSQLServerSQLMITaskOutputAgentJobLevel, bool) - AsMigrateSQLServerSQLMITaskOutputDatabaseLevel() (*MigrateSQLServerSQLMITaskOutputDatabaseLevel, bool) - AsMigrateSQLServerSQLMITaskOutputMigrationLevel() (*MigrateSQLServerSQLMITaskOutputMigrationLevel, bool) - AsMigrateSQLServerSQLMITaskOutput() (*MigrateSQLServerSQLMITaskOutput, bool) -} - -// MigrateSQLServerSQLMITaskOutput output for task that migrates SQL Server databases to Azure SQL Database -// Managed Instance. -type MigrateSQLServerSQLMITaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLMITaskOutput `json:"resultType,omitempty"` -} - -func unmarshalBasicMigrateSQLServerSQLMITaskOutput(body []byte) (BasicMigrateSQLServerSQLMITaskOutput, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["resultType"] { - case string(ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput): - var msssmtoe MigrateSQLServerSQLMITaskOutputError - err := json.Unmarshal(body, &msssmtoe) - return msssmtoe, err - case string(ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput): - var msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel - err := json.Unmarshal(body, &msssmtoll) - return msssmtoll, err - case string(ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput): - var msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel - err := json.Unmarshal(body, &msssmtoajl) - return msssmtoajl, err - case string(ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput): - var msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel - err := json.Unmarshal(body, &msssmtodl) - return msssmtodl, err - case string(ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput): - var msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel - err := json.Unmarshal(body, &msssmtoml) - return msssmtoml, err - default: - var msssmto MigrateSQLServerSQLMITaskOutput - err := json.Unmarshal(body, &msssmto) - return msssmto, err - } -} -func unmarshalBasicMigrateSQLServerSQLMITaskOutputArray(body []byte) ([]BasicMigrateSQLServerSQLMITaskOutput, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - msssmtoArray := make([]BasicMigrateSQLServerSQLMITaskOutput, len(rawMessages)) - - for index, rawMessage := range rawMessages { - msssmto, err := unmarshalBasicMigrateSQLServerSQLMITaskOutput(*rawMessage) - if err != nil { - return nil, err - } - msssmtoArray[index] = msssmto - } - return msssmtoArray, nil -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMITaskOutput. -func (msssmto MigrateSQLServerSQLMITaskOutput) MarshalJSON() ([]byte, error) { - msssmto.ResultType = ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput - objectMap := make(map[string]interface{}) - if msssmto.ResultType != "" { - objectMap["resultType"] = msssmto.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLMITaskOutputError is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutput. -func (msssmto MigrateSQLServerSQLMITaskOutput) AsMigrateSQLServerSQLMITaskOutputError() (*MigrateSQLServerSQLMITaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputLoginLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutput. -func (msssmto MigrateSQLServerSQLMITaskOutput) AsMigrateSQLServerSQLMITaskOutputLoginLevel() (*MigrateSQLServerSQLMITaskOutputLoginLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputAgentJobLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutput. -func (msssmto MigrateSQLServerSQLMITaskOutput) AsMigrateSQLServerSQLMITaskOutputAgentJobLevel() (*MigrateSQLServerSQLMITaskOutputAgentJobLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutput. -func (msssmto MigrateSQLServerSQLMITaskOutput) AsMigrateSQLServerSQLMITaskOutputDatabaseLevel() (*MigrateSQLServerSQLMITaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutput. -func (msssmto MigrateSQLServerSQLMITaskOutput) AsMigrateSQLServerSQLMITaskOutputMigrationLevel() (*MigrateSQLServerSQLMITaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutput. -func (msssmto MigrateSQLServerSQLMITaskOutput) AsMigrateSQLServerSQLMITaskOutput() (*MigrateSQLServerSQLMITaskOutput, bool) { - return &msssmto, true -} - -// AsBasicMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutput. -func (msssmto MigrateSQLServerSQLMITaskOutput) AsBasicMigrateSQLServerSQLMITaskOutput() (BasicMigrateSQLServerSQLMITaskOutput, bool) { - return &msssmto, true -} - -// MigrateSQLServerSQLMITaskOutputAgentJobLevel ... -type MigrateSQLServerSQLMITaskOutputAgentJobLevel struct { - // Name - READ-ONLY; Agent Job name. - Name *string `json:"name,omitempty"` - // IsEnabled - READ-ONLY; The state of the original Agent Job. - IsEnabled *bool `json:"isEnabled,omitempty"` - // State - READ-ONLY; Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' - State MigrationState `json:"state,omitempty"` - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // Message - READ-ONLY; Migration progress message - Message *string `json:"message,omitempty"` - // ExceptionsAndWarnings - READ-ONLY; Migration errors and warnings per job - ExceptionsAndWarnings *[]ReportableException `json:"exceptionsAndWarnings,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLMITaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMITaskOutputAgentJobLevel. -func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) MarshalJSON() ([]byte, error) { - msssmtoajl.ResultType = ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput - objectMap := make(map[string]interface{}) - if msssmtoajl.ResultType != "" { - objectMap["resultType"] = msssmtoajl.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLMITaskOutputError is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputAgentJobLevel. -func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) AsMigrateSQLServerSQLMITaskOutputError() (*MigrateSQLServerSQLMITaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputLoginLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputAgentJobLevel. -func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) AsMigrateSQLServerSQLMITaskOutputLoginLevel() (*MigrateSQLServerSQLMITaskOutputLoginLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputAgentJobLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputAgentJobLevel. -func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) AsMigrateSQLServerSQLMITaskOutputAgentJobLevel() (*MigrateSQLServerSQLMITaskOutputAgentJobLevel, bool) { - return &msssmtoajl, true -} - -// AsMigrateSQLServerSQLMITaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputAgentJobLevel. -func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) AsMigrateSQLServerSQLMITaskOutputDatabaseLevel() (*MigrateSQLServerSQLMITaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputAgentJobLevel. -func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) AsMigrateSQLServerSQLMITaskOutputMigrationLevel() (*MigrateSQLServerSQLMITaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputAgentJobLevel. -func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) AsMigrateSQLServerSQLMITaskOutput() (*MigrateSQLServerSQLMITaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputAgentJobLevel. -func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) AsBasicMigrateSQLServerSQLMITaskOutput() (BasicMigrateSQLServerSQLMITaskOutput, bool) { - return &msssmtoajl, true -} - -// MigrateSQLServerSQLMITaskOutputDatabaseLevel ... -type MigrateSQLServerSQLMITaskOutputDatabaseLevel struct { - // DatabaseName - READ-ONLY; Name of the database - DatabaseName *string `json:"databaseName,omitempty"` - // SizeMB - READ-ONLY; Size of the database in megabytes - SizeMB *float64 `json:"sizeMB,omitempty"` - // State - READ-ONLY; Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' - State MigrationState `json:"state,omitempty"` - // Stage - READ-ONLY; Current stage of migration. Possible values include: 'DatabaseMigrationStageNone', 'DatabaseMigrationStageInitialize', 'DatabaseMigrationStageBackup', 'DatabaseMigrationStageFileCopy', 'DatabaseMigrationStageRestore', 'DatabaseMigrationStageCompleted' - Stage DatabaseMigrationStage `json:"stage,omitempty"` - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // Message - READ-ONLY; Migration progress message - Message *string `json:"message,omitempty"` - // ExceptionsAndWarnings - READ-ONLY; Migration exceptions and warnings - ExceptionsAndWarnings *[]ReportableException `json:"exceptionsAndWarnings,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLMITaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMITaskOutputDatabaseLevel. -func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) MarshalJSON() ([]byte, error) { - msssmtodl.ResultType = ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput - objectMap := make(map[string]interface{}) - if msssmtodl.ResultType != "" { - objectMap["resultType"] = msssmtodl.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLMITaskOutputError is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputDatabaseLevel. -func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) AsMigrateSQLServerSQLMITaskOutputError() (*MigrateSQLServerSQLMITaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputLoginLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputDatabaseLevel. -func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) AsMigrateSQLServerSQLMITaskOutputLoginLevel() (*MigrateSQLServerSQLMITaskOutputLoginLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputAgentJobLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputDatabaseLevel. -func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) AsMigrateSQLServerSQLMITaskOutputAgentJobLevel() (*MigrateSQLServerSQLMITaskOutputAgentJobLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputDatabaseLevel. -func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) AsMigrateSQLServerSQLMITaskOutputDatabaseLevel() (*MigrateSQLServerSQLMITaskOutputDatabaseLevel, bool) { - return &msssmtodl, true -} - -// AsMigrateSQLServerSQLMITaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputDatabaseLevel. -func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) AsMigrateSQLServerSQLMITaskOutputMigrationLevel() (*MigrateSQLServerSQLMITaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputDatabaseLevel. -func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) AsMigrateSQLServerSQLMITaskOutput() (*MigrateSQLServerSQLMITaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputDatabaseLevel. -func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) AsBasicMigrateSQLServerSQLMITaskOutput() (BasicMigrateSQLServerSQLMITaskOutput, bool) { - return &msssmtodl, true -} - -// MigrateSQLServerSQLMITaskOutputError ... -type MigrateSQLServerSQLMITaskOutputError struct { - // Error - READ-ONLY; Migration error - Error *ReportableException `json:"error,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLMITaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMITaskOutputError. -func (msssmtoe MigrateSQLServerSQLMITaskOutputError) MarshalJSON() ([]byte, error) { - msssmtoe.ResultType = ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput - objectMap := make(map[string]interface{}) - if msssmtoe.ResultType != "" { - objectMap["resultType"] = msssmtoe.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLMITaskOutputError is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputError. -func (msssmtoe MigrateSQLServerSQLMITaskOutputError) AsMigrateSQLServerSQLMITaskOutputError() (*MigrateSQLServerSQLMITaskOutputError, bool) { - return &msssmtoe, true -} - -// AsMigrateSQLServerSQLMITaskOutputLoginLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputError. -func (msssmtoe MigrateSQLServerSQLMITaskOutputError) AsMigrateSQLServerSQLMITaskOutputLoginLevel() (*MigrateSQLServerSQLMITaskOutputLoginLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputAgentJobLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputError. -func (msssmtoe MigrateSQLServerSQLMITaskOutputError) AsMigrateSQLServerSQLMITaskOutputAgentJobLevel() (*MigrateSQLServerSQLMITaskOutputAgentJobLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputError. -func (msssmtoe MigrateSQLServerSQLMITaskOutputError) AsMigrateSQLServerSQLMITaskOutputDatabaseLevel() (*MigrateSQLServerSQLMITaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputError. -func (msssmtoe MigrateSQLServerSQLMITaskOutputError) AsMigrateSQLServerSQLMITaskOutputMigrationLevel() (*MigrateSQLServerSQLMITaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputError. -func (msssmtoe MigrateSQLServerSQLMITaskOutputError) AsMigrateSQLServerSQLMITaskOutput() (*MigrateSQLServerSQLMITaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputError. -func (msssmtoe MigrateSQLServerSQLMITaskOutputError) AsBasicMigrateSQLServerSQLMITaskOutput() (BasicMigrateSQLServerSQLMITaskOutput, bool) { - return &msssmtoe, true -} - -// MigrateSQLServerSQLMITaskOutputLoginLevel ... -type MigrateSQLServerSQLMITaskOutputLoginLevel struct { - // LoginName - READ-ONLY; Login name. - LoginName *string `json:"loginName,omitempty"` - // State - READ-ONLY; Current state of login. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' - State MigrationState `json:"state,omitempty"` - // Stage - READ-ONLY; Current stage of login. Possible values include: 'LoginMigrationStageNone', 'LoginMigrationStageInitialize', 'LoginMigrationStageLoginMigration', 'LoginMigrationStageEstablishUserMapping', 'LoginMigrationStageAssignRoleMembership', 'LoginMigrationStageAssignRoleOwnership', 'LoginMigrationStageEstablishServerPermissions', 'LoginMigrationStageEstablishObjectPermissions', 'LoginMigrationStageCompleted' - Stage LoginMigrationStage `json:"stage,omitempty"` - // StartedOn - READ-ONLY; Login migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Login migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // Message - READ-ONLY; Login migration progress message - Message *string `json:"message,omitempty"` - // ExceptionsAndWarnings - READ-ONLY; Login migration errors and warnings per login - ExceptionsAndWarnings *[]ReportableException `json:"exceptionsAndWarnings,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLMITaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMITaskOutputLoginLevel. -func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) MarshalJSON() ([]byte, error) { - msssmtoll.ResultType = ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput - objectMap := make(map[string]interface{}) - if msssmtoll.ResultType != "" { - objectMap["resultType"] = msssmtoll.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLMITaskOutputError is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputLoginLevel. -func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) AsMigrateSQLServerSQLMITaskOutputError() (*MigrateSQLServerSQLMITaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputLoginLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputLoginLevel. -func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) AsMigrateSQLServerSQLMITaskOutputLoginLevel() (*MigrateSQLServerSQLMITaskOutputLoginLevel, bool) { - return &msssmtoll, true -} - -// AsMigrateSQLServerSQLMITaskOutputAgentJobLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputLoginLevel. -func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) AsMigrateSQLServerSQLMITaskOutputAgentJobLevel() (*MigrateSQLServerSQLMITaskOutputAgentJobLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputLoginLevel. -func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) AsMigrateSQLServerSQLMITaskOutputDatabaseLevel() (*MigrateSQLServerSQLMITaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputLoginLevel. -func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) AsMigrateSQLServerSQLMITaskOutputMigrationLevel() (*MigrateSQLServerSQLMITaskOutputMigrationLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputLoginLevel. -func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) AsMigrateSQLServerSQLMITaskOutput() (*MigrateSQLServerSQLMITaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputLoginLevel. -func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) AsBasicMigrateSQLServerSQLMITaskOutput() (BasicMigrateSQLServerSQLMITaskOutput, bool) { - return &msssmtoll, true -} - -// MigrateSQLServerSQLMITaskOutputMigrationLevel ... -type MigrateSQLServerSQLMITaskOutputMigrationLevel struct { - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // Status - READ-ONLY; Current status of migration. Possible values include: 'MigrationStatusDefault', 'MigrationStatusConnecting', 'MigrationStatusSourceAndTargetSelected', 'MigrationStatusSelectLogins', 'MigrationStatusConfigured', 'MigrationStatusRunning', 'MigrationStatusError', 'MigrationStatusStopped', 'MigrationStatusCompleted', 'MigrationStatusCompletedWithWarnings' - Status MigrationStatus `json:"status,omitempty"` - // State - READ-ONLY; Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' - State MigrationState `json:"state,omitempty"` - // AgentJobs - READ-ONLY; Selected agent jobs as a map from name to id - AgentJobs map[string]*string `json:"agentJobs"` - // Logins - READ-ONLY; Selected logins as a map from name to id - Logins map[string]*string `json:"logins"` - // Message - READ-ONLY; Migration progress message - Message *string `json:"message,omitempty"` - // ServerRoleResults - READ-ONLY; Map of server role migration results. - ServerRoleResults map[string]*StartMigrationScenarioServerRoleResult `json:"serverRoleResults"` - // OrphanedUsersInfo - READ-ONLY; List of orphaned users. - OrphanedUsersInfo *[]OrphanedUserInfo `json:"orphanedUsersInfo,omitempty"` - // Databases - READ-ONLY; Selected databases as a map from database name to database id - Databases map[string]*string `json:"databases"` - // SourceServerVersion - READ-ONLY; Source server version - SourceServerVersion *string `json:"sourceServerVersion,omitempty"` - // SourceServerBrandVersion - READ-ONLY; Source server brand version - SourceServerBrandVersion *string `json:"sourceServerBrandVersion,omitempty"` - // TargetServerVersion - READ-ONLY; Target server version - TargetServerVersion *string `json:"targetServerVersion,omitempty"` - // TargetServerBrandVersion - READ-ONLY; Target server brand version - TargetServerBrandVersion *string `json:"targetServerBrandVersion,omitempty"` - // ExceptionsAndWarnings - READ-ONLY; Migration exceptions and warnings. - ExceptionsAndWarnings *[]ReportableException `json:"exceptionsAndWarnings,omitempty"` - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput' - ResultType ResultTypeBasicMigrateSQLServerSQLMITaskOutput `json:"resultType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMITaskOutputMigrationLevel. -func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) MarshalJSON() ([]byte, error) { - msssmtoml.ResultType = ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput - objectMap := make(map[string]interface{}) - if msssmtoml.ResultType != "" { - objectMap["resultType"] = msssmtoml.ResultType - } - return json.Marshal(objectMap) -} - -// AsMigrateSQLServerSQLMITaskOutputError is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputMigrationLevel. -func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) AsMigrateSQLServerSQLMITaskOutputError() (*MigrateSQLServerSQLMITaskOutputError, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputLoginLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputMigrationLevel. -func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) AsMigrateSQLServerSQLMITaskOutputLoginLevel() (*MigrateSQLServerSQLMITaskOutputLoginLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputAgentJobLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputMigrationLevel. -func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) AsMigrateSQLServerSQLMITaskOutputAgentJobLevel() (*MigrateSQLServerSQLMITaskOutputAgentJobLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputMigrationLevel. -func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) AsMigrateSQLServerSQLMITaskOutputDatabaseLevel() (*MigrateSQLServerSQLMITaskOutputDatabaseLevel, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputMigrationLevel. -func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) AsMigrateSQLServerSQLMITaskOutputMigrationLevel() (*MigrateSQLServerSQLMITaskOutputMigrationLevel, bool) { - return &msssmtoml, true -} - -// AsMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputMigrationLevel. -func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) AsMigrateSQLServerSQLMITaskOutput() (*MigrateSQLServerSQLMITaskOutput, bool) { - return nil, false -} - -// AsBasicMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputMigrationLevel. -func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) AsBasicMigrateSQLServerSQLMITaskOutput() (BasicMigrateSQLServerSQLMITaskOutput, bool) { - return &msssmtoml, true -} - -// MigrateSQLServerSQLMITaskProperties properties for task that migrates SQL Server databases to Azure SQL -// Database Managed Instance -type MigrateSQLServerSQLMITaskProperties struct { - // Input - Task input - Input *MigrateSQLServerSQLMITaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]BasicMigrateSQLServerSQLMITaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) MarshalJSON() ([]byte, error) { - msssmtp.TaskType = TaskTypeMigrateSQLServerAzureSQLDbMI - objectMap := make(map[string]interface{}) - if msssmtp.Input != nil { - objectMap["input"] = msssmtp.Input - } - if msssmtp.TaskType != "" { - objectMap["taskType"] = msssmtp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return &msssmtp, true -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. -func (msssmtp MigrateSQLServerSQLMITaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &msssmtp, true -} - -// UnmarshalJSON is the custom unmarshaler for MigrateSQLServerSQLMITaskProperties struct. -func (msssmtp *MigrateSQLServerSQLMITaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input MigrateSQLServerSQLMITaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - msssmtp.Input = &input - } - case "output": - if v != nil { - output, err := unmarshalBasicMigrateSQLServerSQLMITaskOutputArray(*v) - if err != nil { - return err - } - msssmtp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - msssmtp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - msssmtp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - msssmtp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - msssmtp.TaskType = taskType - } - } - } - - return nil -} - -// MigrateSQLServerSQLServerDatabaseInput database specific information for SQL to SQL migration task -// inputs -type MigrateSQLServerSQLServerDatabaseInput struct { - // Name - Name of the database - Name *string `json:"name,omitempty"` - // RestoreDatabaseName - Name of the database at destination - RestoreDatabaseName *string `json:"restoreDatabaseName,omitempty"` - // BackupAndRestoreFolder - The backup and restore folder - BackupAndRestoreFolder *string `json:"backupAndRestoreFolder,omitempty"` - // DatabaseFiles - The list of database files - DatabaseFiles *[]DatabaseFileInput `json:"databaseFiles,omitempty"` -} - -// MigrateSyncCompleteCommandInput input for command that completes sync migration for a database. -type MigrateSyncCompleteCommandInput struct { - // DatabaseName - Name of database - DatabaseName *string `json:"databaseName,omitempty"` - // CommitTimeStamp - Time stamp to complete - CommitTimeStamp *date.Time `json:"commitTimeStamp,omitempty"` -} - -// MigrateSyncCompleteCommandOutput output for command that completes sync migration for a database. -type MigrateSyncCompleteCommandOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // Errors - READ-ONLY; List of errors that happened during the command execution - Errors *[]ReportableException `json:"errors,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSyncCompleteCommandOutput. -func (mscco MigrateSyncCompleteCommandOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MigrateSyncCompleteCommandProperties properties for the command that completes sync migration for a -// database. -type MigrateSyncCompleteCommandProperties struct { - // Input - Command input - Input *MigrateSyncCompleteCommandInput `json:"input,omitempty"` - // Output - READ-ONLY; Command output. This is ignored if submitted. - Output *MigrateSyncCompleteCommandOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the command. This is ignored if submitted. Possible values include: 'Unknown', 'Accepted', 'Running', 'Succeeded', 'Failed' - State CommandState `json:"state,omitempty"` - // CommandType - Possible values include: 'CommandTypeCommandProperties', 'CommandTypeMigrateSQLServerAzureDbSQLMiComplete', 'CommandTypeMigrateSyncCompleteDatabase' - CommandType CommandType `json:"commandType,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrateSyncCompleteCommandProperties. -func (msccp MigrateSyncCompleteCommandProperties) MarshalJSON() ([]byte, error) { - msccp.CommandType = CommandTypeMigrateSyncCompleteDatabase - objectMap := make(map[string]interface{}) - if msccp.Input != nil { - objectMap["input"] = msccp.Input - } - if msccp.CommandType != "" { - objectMap["commandType"] = msccp.CommandType - } - return json.Marshal(objectMap) -} - -// AsMigrateMISyncCompleteCommandProperties is the BasicCommandProperties implementation for MigrateSyncCompleteCommandProperties. -func (msccp MigrateSyncCompleteCommandProperties) AsMigrateMISyncCompleteCommandProperties() (*MigrateMISyncCompleteCommandProperties, bool) { - return nil, false -} - -// AsMigrateSyncCompleteCommandProperties is the BasicCommandProperties implementation for MigrateSyncCompleteCommandProperties. -func (msccp MigrateSyncCompleteCommandProperties) AsMigrateSyncCompleteCommandProperties() (*MigrateSyncCompleteCommandProperties, bool) { - return &msccp, true -} - -// AsCommandProperties is the BasicCommandProperties implementation for MigrateSyncCompleteCommandProperties. -func (msccp MigrateSyncCompleteCommandProperties) AsCommandProperties() (*CommandProperties, bool) { - return nil, false -} - -// AsBasicCommandProperties is the BasicCommandProperties implementation for MigrateSyncCompleteCommandProperties. -func (msccp MigrateSyncCompleteCommandProperties) AsBasicCommandProperties() (BasicCommandProperties, bool) { - return &msccp, true -} - -// MigrationEligibilityInfo information about migration eligibility of a server object -type MigrationEligibilityInfo struct { - // IsEligibleForMigration - READ-ONLY; Whether object is eligible for migration or not. - IsEligibleForMigration *bool `json:"isEligibleForMigration,omitempty"` - // ValidationMessages - READ-ONLY; Information about eligibility failure for the server object. - ValidationMessages *[]string `json:"validationMessages,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrationEligibilityInfo. -func (mei MigrationEligibilityInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MigrationReportResult migration validation report result, contains the url for downloading the generated -// report. -type MigrationReportResult struct { - // ID - READ-ONLY; Migration validation result identifier - ID *string `json:"id,omitempty"` - // ReportURL - READ-ONLY; The url of the report. - ReportURL *string `json:"reportUrl,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrationReportResult. -func (mrr MigrationReportResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MigrationTableMetadata metadata for tables selected in migration project -type MigrationTableMetadata struct { - // SourceTableName - READ-ONLY; Source table name - SourceTableName *string `json:"sourceTableName,omitempty"` - // TargetTableName - READ-ONLY; Target table name - TargetTableName *string `json:"targetTableName,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrationTableMetadata. -func (mtm MigrationTableMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MigrationValidationDatabaseSummaryResult migration Validation Database level summary result -type MigrationValidationDatabaseSummaryResult struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // MigrationID - READ-ONLY; Migration Identifier - MigrationID *string `json:"migrationId,omitempty"` - // SourceDatabaseName - READ-ONLY; Name of the source database - SourceDatabaseName *string `json:"sourceDatabaseName,omitempty"` - // TargetDatabaseName - READ-ONLY; Name of the target database - TargetDatabaseName *string `json:"targetDatabaseName,omitempty"` - // StartedOn - READ-ONLY; Validation start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Validation end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // Status - READ-ONLY; Current status of validation at the database level. Possible values include: 'ValidationStatusDefault', 'ValidationStatusNotStarted', 'ValidationStatusInitialized', 'ValidationStatusInProgress', 'ValidationStatusCompleted', 'ValidationStatusCompletedWithIssues', 'ValidationStatusFailed', 'ValidationStatusStopped' - Status ValidationStatus `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrationValidationDatabaseSummaryResult. -func (mvdsr MigrationValidationDatabaseSummaryResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MigrationValidationOptions types of validations to run after the migration -type MigrationValidationOptions struct { - // EnableSchemaValidation - Allows to compare the schema information between source and target. - EnableSchemaValidation *bool `json:"enableSchemaValidation,omitempty"` - // EnableDataIntegrityValidation - Allows to perform a checksum based data integrity validation between source and target for the selected database / tables . - EnableDataIntegrityValidation *bool `json:"enableDataIntegrityValidation,omitempty"` - // EnableQueryAnalysisValidation - Allows to perform a quick and intelligent query analysis by retrieving queries from the source database and executes them in the target. The result will have execution statistics for executions in source and target databases for the extracted queries. - EnableQueryAnalysisValidation *bool `json:"enableQueryAnalysisValidation,omitempty"` -} - -// MiSQLConnectionInfo properties required to create a connection to Azure SQL database Managed instance -type MiSQLConnectionInfo struct { - // ManagedInstanceResourceID - Resource id for Azure SQL database Managed instance - ManagedInstanceResourceID *string `json:"managedInstanceResourceId,omitempty"` - // UserName - User name - UserName *string `json:"userName,omitempty"` - // Password - Password credential. - Password *string `json:"password,omitempty"` - // Type - Possible values include: 'TypeConnectionInfo', 'TypeMiSQLConnectionInfo', 'TypePostgreSQLConnectionInfo', 'TypeMySQLConnectionInfo', 'TypeSQLConnectionInfo' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MiSQLConnectionInfo. -func (msci MiSQLConnectionInfo) MarshalJSON() ([]byte, error) { - msci.Type = TypeMiSQLConnectionInfo - objectMap := make(map[string]interface{}) - if msci.ManagedInstanceResourceID != nil { - objectMap["managedInstanceResourceId"] = msci.ManagedInstanceResourceID - } - if msci.UserName != nil { - objectMap["userName"] = msci.UserName - } - if msci.Password != nil { - objectMap["password"] = msci.Password - } - if msci.Type != "" { - objectMap["type"] = msci.Type - } - return json.Marshal(objectMap) -} - -// AsMiSQLConnectionInfo is the BasicConnectionInfo implementation for MiSQLConnectionInfo. -func (msci MiSQLConnectionInfo) AsMiSQLConnectionInfo() (*MiSQLConnectionInfo, bool) { - return &msci, true -} - -// AsPostgreSQLConnectionInfo is the BasicConnectionInfo implementation for MiSQLConnectionInfo. -func (msci MiSQLConnectionInfo) AsPostgreSQLConnectionInfo() (*PostgreSQLConnectionInfo, bool) { - return nil, false -} - -// AsMySQLConnectionInfo is the BasicConnectionInfo implementation for MiSQLConnectionInfo. -func (msci MiSQLConnectionInfo) AsMySQLConnectionInfo() (*MySQLConnectionInfo, bool) { - return nil, false -} - -// AsSQLConnectionInfo is the BasicConnectionInfo implementation for MiSQLConnectionInfo. -func (msci MiSQLConnectionInfo) AsSQLConnectionInfo() (*SQLConnectionInfo, bool) { - return nil, false -} - -// AsConnectionInfo is the BasicConnectionInfo implementation for MiSQLConnectionInfo. -func (msci MiSQLConnectionInfo) AsConnectionInfo() (*ConnectionInfo, bool) { - return nil, false -} - -// AsBasicConnectionInfo is the BasicConnectionInfo implementation for MiSQLConnectionInfo. -func (msci MiSQLConnectionInfo) AsBasicConnectionInfo() (BasicConnectionInfo, bool) { - return &msci, true -} - -// MySQLConnectionInfo information for connecting to MySQL server -type MySQLConnectionInfo struct { - // ServerName - Name of the server - ServerName *string `json:"serverName,omitempty"` - // Port - Port for Server - Port *int32 `json:"port,omitempty"` - // UserName - User name - UserName *string `json:"userName,omitempty"` - // Password - Password credential. - Password *string `json:"password,omitempty"` - // Type - Possible values include: 'TypeConnectionInfo', 'TypeMiSQLConnectionInfo', 'TypePostgreSQLConnectionInfo', 'TypeMySQLConnectionInfo', 'TypeSQLConnectionInfo' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MySQLConnectionInfo. -func (msci MySQLConnectionInfo) MarshalJSON() ([]byte, error) { - msci.Type = TypeMySQLConnectionInfo - objectMap := make(map[string]interface{}) - if msci.ServerName != nil { - objectMap["serverName"] = msci.ServerName - } - if msci.Port != nil { - objectMap["port"] = msci.Port - } - if msci.UserName != nil { - objectMap["userName"] = msci.UserName - } - if msci.Password != nil { - objectMap["password"] = msci.Password - } - if msci.Type != "" { - objectMap["type"] = msci.Type - } - return json.Marshal(objectMap) -} - -// AsMiSQLConnectionInfo is the BasicConnectionInfo implementation for MySQLConnectionInfo. -func (msci MySQLConnectionInfo) AsMiSQLConnectionInfo() (*MiSQLConnectionInfo, bool) { - return nil, false -} - -// AsPostgreSQLConnectionInfo is the BasicConnectionInfo implementation for MySQLConnectionInfo. -func (msci MySQLConnectionInfo) AsPostgreSQLConnectionInfo() (*PostgreSQLConnectionInfo, bool) { - return nil, false -} - -// AsMySQLConnectionInfo is the BasicConnectionInfo implementation for MySQLConnectionInfo. -func (msci MySQLConnectionInfo) AsMySQLConnectionInfo() (*MySQLConnectionInfo, bool) { - return &msci, true -} - -// AsSQLConnectionInfo is the BasicConnectionInfo implementation for MySQLConnectionInfo. -func (msci MySQLConnectionInfo) AsSQLConnectionInfo() (*SQLConnectionInfo, bool) { - return nil, false -} - -// AsConnectionInfo is the BasicConnectionInfo implementation for MySQLConnectionInfo. -func (msci MySQLConnectionInfo) AsConnectionInfo() (*ConnectionInfo, bool) { - return nil, false -} - -// AsBasicConnectionInfo is the BasicConnectionInfo implementation for MySQLConnectionInfo. -func (msci MySQLConnectionInfo) AsBasicConnectionInfo() (BasicConnectionInfo, bool) { - return &msci, true -} - -// NameAvailabilityRequest a resource type and proposed name -type NameAvailabilityRequest struct { - // Name - The proposed resource name - Name *string `json:"name,omitempty"` - // Type - The resource type chain (e.g. virtualMachines/extensions) - Type *string `json:"type,omitempty"` -} - -// NameAvailabilityResponse indicates whether a proposed resource name is available -type NameAvailabilityResponse struct { - autorest.Response `json:"-"` - // NameAvailable - READ-ONLY; If true, the name is valid and available. If false, 'reason' describes why not. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - READ-ONLY; The reason why the name is not available, if nameAvailable is false. Possible values include: 'AlreadyExists', 'Invalid' - Reason NameCheckFailureReason `json:"reason,omitempty"` - // Message - READ-ONLY; The localized reason why the name is not available, if nameAvailable is false - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for NameAvailabilityResponse. -func (nar NameAvailabilityResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NonSQLDataMigrationTable defines metadata for table to be migrated -type NonSQLDataMigrationTable struct { - // SourceName - Source table name - SourceName *string `json:"sourceName,omitempty"` -} - -// NonSQLDataMigrationTableResult object used to report the data migration results of a table -type NonSQLDataMigrationTableResult struct { - // ResultCode - READ-ONLY; Result code of the data migration. Possible values include: 'Initial', 'Completed', 'ObjectNotExistsInSource', 'ObjectNotExistsInTarget', 'TargetObjectIsInaccessible', 'FatalError' - ResultCode ResultCode `json:"resultCode,omitempty"` - // SourceName - READ-ONLY; Name of the source table - SourceName *string `json:"sourceName,omitempty"` - // TargetName - READ-ONLY; Name of the target table - TargetName *string `json:"targetName,omitempty"` - // SourceRowCount - READ-ONLY; Number of rows in the source table - SourceRowCount *int64 `json:"sourceRowCount,omitempty"` - // TargetRowCount - READ-ONLY; Number of rows in the target table - TargetRowCount *int64 `json:"targetRowCount,omitempty"` - // ElapsedTimeInMiliseconds - READ-ONLY; Time taken to migrate the data - ElapsedTimeInMiliseconds *float64 `json:"elapsedTimeInMiliseconds,omitempty"` - // Errors - READ-ONLY; List of errors, if any, during migration - Errors *[]Error `json:"errors,omitempty"` -} - -// MarshalJSON is the custom marshaler for NonSQLDataMigrationTableResult. -func (nsdmtr NonSQLDataMigrationTableResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NonSQLMigrationTaskInput base class for non sql migration task input -type NonSQLMigrationTaskInput struct { - // TargetConnectionInfo - Information for connecting to target - TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` - // TargetDatabaseName - Target database name - TargetDatabaseName *string `json:"targetDatabaseName,omitempty"` - // ProjectName - Name of the migration project - ProjectName *string `json:"projectName,omitempty"` - // ProjectLocation - A URL that points to the drop location to access project artifacts - ProjectLocation *string `json:"projectLocation,omitempty"` - // SelectedTables - Metadata of the tables selected for migration - SelectedTables *[]NonSQLDataMigrationTable `json:"selectedTables,omitempty"` -} - -// NonSQLMigrationTaskOutput base class for non sql migration task output -type NonSQLMigrationTaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // StartedOn - READ-ONLY; Migration start time - StartedOn *date.Time `json:"startedOn,omitempty"` - // EndedOn - READ-ONLY; Migration end time - EndedOn *date.Time `json:"endedOn,omitempty"` - // Status - READ-ONLY; Current state of migration. Possible values include: 'MigrationStatusDefault', 'MigrationStatusConnecting', 'MigrationStatusSourceAndTargetSelected', 'MigrationStatusSelectLogins', 'MigrationStatusConfigured', 'MigrationStatusRunning', 'MigrationStatusError', 'MigrationStatusStopped', 'MigrationStatusCompleted', 'MigrationStatusCompletedWithWarnings' - Status MigrationStatus `json:"status,omitempty"` - // DataMigrationTableResults - READ-ONLY; Results of the migration. The key contains the table name and the value the table result object - DataMigrationTableResults map[string]*NonSQLDataMigrationTableResult `json:"dataMigrationTableResults"` - // ProgressMessage - READ-ONLY; Message about the progress of the migration - ProgressMessage *string `json:"progressMessage,omitempty"` - // SourceServerName - READ-ONLY; Name of source server - SourceServerName *string `json:"sourceServerName,omitempty"` - // TargetServerName - READ-ONLY; Name of target server - TargetServerName *string `json:"targetServerName,omitempty"` -} - -// MarshalJSON is the custom marshaler for NonSQLMigrationTaskOutput. -func (nsmto NonSQLMigrationTaskOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ODataError error information in OData format. -type ODataError struct { - // Code - READ-ONLY; The machine-readable description of the error, such as 'InvalidRequest' or 'InternalServerError' - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The human-readable description of the error - Message *string `json:"message,omitempty"` - // Details - READ-ONLY; Inner errors that caused this error - Details *[]ODataError `json:"details,omitempty"` -} - -// MarshalJSON is the custom marshaler for ODataError. -func (ode ODataError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OrphanedUserInfo information of orphaned users on the SQL server database. -type OrphanedUserInfo struct { - // Name - Name of the orphaned user - Name *string `json:"name,omitempty"` - // DatabaseName - Parent database of the user - DatabaseName *string `json:"databaseName,omitempty"` -} - -// PostgreSQLConnectionInfo information for connecting to PostgreSQL server -type PostgreSQLConnectionInfo struct { - // ServerName - Name of the server - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - Name of the database - DatabaseName *string `json:"databaseName,omitempty"` - // Port - Port for Server - Port *int32 `json:"port,omitempty"` - // UserName - User name - UserName *string `json:"userName,omitempty"` - // Password - Password credential. - Password *string `json:"password,omitempty"` - // Type - Possible values include: 'TypeConnectionInfo', 'TypeMiSQLConnectionInfo', 'TypePostgreSQLConnectionInfo', 'TypeMySQLConnectionInfo', 'TypeSQLConnectionInfo' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PostgreSQLConnectionInfo. -func (psci PostgreSQLConnectionInfo) MarshalJSON() ([]byte, error) { - psci.Type = TypePostgreSQLConnectionInfo - objectMap := make(map[string]interface{}) - if psci.ServerName != nil { - objectMap["serverName"] = psci.ServerName - } - if psci.DatabaseName != nil { - objectMap["databaseName"] = psci.DatabaseName - } - if psci.Port != nil { - objectMap["port"] = psci.Port - } - if psci.UserName != nil { - objectMap["userName"] = psci.UserName - } - if psci.Password != nil { - objectMap["password"] = psci.Password - } - if psci.Type != "" { - objectMap["type"] = psci.Type - } - return json.Marshal(objectMap) -} - -// AsMiSQLConnectionInfo is the BasicConnectionInfo implementation for PostgreSQLConnectionInfo. -func (psci PostgreSQLConnectionInfo) AsMiSQLConnectionInfo() (*MiSQLConnectionInfo, bool) { - return nil, false -} - -// AsPostgreSQLConnectionInfo is the BasicConnectionInfo implementation for PostgreSQLConnectionInfo. -func (psci PostgreSQLConnectionInfo) AsPostgreSQLConnectionInfo() (*PostgreSQLConnectionInfo, bool) { - return &psci, true -} - -// AsMySQLConnectionInfo is the BasicConnectionInfo implementation for PostgreSQLConnectionInfo. -func (psci PostgreSQLConnectionInfo) AsMySQLConnectionInfo() (*MySQLConnectionInfo, bool) { - return nil, false -} - -// AsSQLConnectionInfo is the BasicConnectionInfo implementation for PostgreSQLConnectionInfo. -func (psci PostgreSQLConnectionInfo) AsSQLConnectionInfo() (*SQLConnectionInfo, bool) { - return nil, false -} - -// AsConnectionInfo is the BasicConnectionInfo implementation for PostgreSQLConnectionInfo. -func (psci PostgreSQLConnectionInfo) AsConnectionInfo() (*ConnectionInfo, bool) { - return nil, false -} - -// AsBasicConnectionInfo is the BasicConnectionInfo implementation for PostgreSQLConnectionInfo. -func (psci PostgreSQLConnectionInfo) AsBasicConnectionInfo() (BasicConnectionInfo, bool) { - return &psci, true -} - -// Project a project resource -type Project struct { - autorest.Response `json:"-"` - // ProjectProperties - Project properties - *ProjectProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Project. -func (p Project) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if p.ProjectProperties != nil { - objectMap["properties"] = p.ProjectProperties - } - if p.Tags != nil { - objectMap["tags"] = p.Tags - } - if p.Location != nil { - objectMap["location"] = p.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Project struct. -func (p *Project) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var projectProperties ProjectProperties - err = json.Unmarshal(*v, &projectProperties) - if err != nil { - return err - } - p.ProjectProperties = &projectProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - p.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - p.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - p.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - p.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - p.Type = &typeVar - } - } - } - - return nil -} - -// ProjectList oData page of project resources -type ProjectList struct { - autorest.Response `json:"-"` - // Value - List of projects - Value *[]Project `json:"value,omitempty"` - // NextLink - URL to load the next page of projects - NextLink *string `json:"nextLink,omitempty"` -} - -// ProjectListIterator provides access to a complete listing of Project values. -type ProjectListIterator struct { - i int - page ProjectListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ProjectListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProjectListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ProjectListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ProjectListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ProjectListIterator) Response() ProjectList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ProjectListIterator) Value() Project { - if !iter.page.NotDone() { - return Project{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ProjectListIterator type. -func NewProjectListIterator(page ProjectListPage) ProjectListIterator { - return ProjectListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pl ProjectList) IsEmpty() bool { - return pl.Value == nil || len(*pl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pl ProjectList) hasNextLink() bool { - return pl.NextLink != nil && len(*pl.NextLink) != 0 -} - -// projectListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pl ProjectList) projectListPreparer(ctx context.Context) (*http.Request, error) { - if !pl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pl.NextLink))) -} - -// ProjectListPage contains a page of Project values. -type ProjectListPage struct { - fn func(context.Context, ProjectList) (ProjectList, error) - pl ProjectList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ProjectListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProjectListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.pl) - if err != nil { - return err - } - page.pl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ProjectListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ProjectListPage) NotDone() bool { - return !page.pl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ProjectListPage) Response() ProjectList { - return page.pl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ProjectListPage) Values() []Project { - if page.pl.IsEmpty() { - return nil - } - return *page.pl.Value -} - -// Creates a new instance of the ProjectListPage type. -func NewProjectListPage(cur ProjectList, getNextPage func(context.Context, ProjectList) (ProjectList, error)) ProjectListPage { - return ProjectListPage{ - fn: getNextPage, - pl: cur, - } -} - -// ProjectMetadata common metadata for migration projects -type ProjectMetadata struct { - // SourceServerName - READ-ONLY; Source server name - SourceServerName *string `json:"sourceServerName,omitempty"` - // SourceServerPort - READ-ONLY; Source server port number - SourceServerPort *string `json:"sourceServerPort,omitempty"` - // SourceUsername - READ-ONLY; Source username - SourceUsername *string `json:"sourceUsername,omitempty"` - // TargetServerName - READ-ONLY; Target server name - TargetServerName *string `json:"targetServerName,omitempty"` - // TargetUsername - READ-ONLY; Target username - TargetUsername *string `json:"targetUsername,omitempty"` - // TargetDbName - READ-ONLY; Target database name - TargetDbName *string `json:"targetDbName,omitempty"` - // TargetUsingWinAuth - READ-ONLY; Whether target connection is Windows authentication - TargetUsingWinAuth *bool `json:"targetUsingWinAuth,omitempty"` - // SelectedMigrationTables - READ-ONLY; List of tables selected for migration - SelectedMigrationTables *[]MigrationTableMetadata `json:"selectedMigrationTables,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProjectMetadata. -func (pm ProjectMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ProjectProperties project-specific properties -type ProjectProperties struct { - // SourcePlatform - Source platform for the project. Possible values include: 'ProjectSourcePlatformSQL', 'ProjectSourcePlatformUnknown' - SourcePlatform ProjectSourcePlatform `json:"sourcePlatform,omitempty"` - // TargetPlatform - Target platform for the project. Possible values include: 'ProjectTargetPlatformSQLDB', 'ProjectTargetPlatformUnknown' - TargetPlatform ProjectTargetPlatform `json:"targetPlatform,omitempty"` - // CreationTime - READ-ONLY; UTC Date and time when project was created - CreationTime *date.Time `json:"creationTime,omitempty"` - // SourceConnectionInfo - Information for connecting to source - SourceConnectionInfo BasicConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetConnectionInfo - Information for connecting to target - TargetConnectionInfo BasicConnectionInfo `json:"targetConnectionInfo,omitempty"` - // DatabasesInfo - List of DatabaseInfo - DatabasesInfo *[]DatabaseInfo `json:"databasesInfo,omitempty"` - // ProvisioningState - READ-ONLY; The project's provisioning state. Possible values include: 'ProjectProvisioningStateDeleting', 'ProjectProvisioningStateSucceeded' - ProvisioningState ProjectProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProjectProperties. -func (pp ProjectProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pp.SourcePlatform != "" { - objectMap["sourcePlatform"] = pp.SourcePlatform - } - if pp.TargetPlatform != "" { - objectMap["targetPlatform"] = pp.TargetPlatform - } - objectMap["sourceConnectionInfo"] = pp.SourceConnectionInfo - objectMap["targetConnectionInfo"] = pp.TargetConnectionInfo - if pp.DatabasesInfo != nil { - objectMap["databasesInfo"] = pp.DatabasesInfo - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ProjectProperties struct. -func (pp *ProjectProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sourcePlatform": - if v != nil { - var sourcePlatform ProjectSourcePlatform - err = json.Unmarshal(*v, &sourcePlatform) - if err != nil { - return err - } - pp.SourcePlatform = sourcePlatform - } - case "targetPlatform": - if v != nil { - var targetPlatform ProjectTargetPlatform - err = json.Unmarshal(*v, &targetPlatform) - if err != nil { - return err - } - pp.TargetPlatform = targetPlatform - } - case "creationTime": - if v != nil { - var creationTime date.Time - err = json.Unmarshal(*v, &creationTime) - if err != nil { - return err - } - pp.CreationTime = &creationTime - } - case "sourceConnectionInfo": - if v != nil { - sourceConnectionInfo, err := unmarshalBasicConnectionInfo(*v) - if err != nil { - return err - } - pp.SourceConnectionInfo = sourceConnectionInfo - } - case "targetConnectionInfo": - if v != nil { - targetConnectionInfo, err := unmarshalBasicConnectionInfo(*v) - if err != nil { - return err - } - pp.TargetConnectionInfo = targetConnectionInfo - } - case "databasesInfo": - if v != nil { - var databasesInfo []DatabaseInfo - err = json.Unmarshal(*v, &databasesInfo) - if err != nil { - return err - } - pp.DatabasesInfo = &databasesInfo - } - case "provisioningState": - if v != nil { - var provisioningState ProjectProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - pp.ProvisioningState = provisioningState - } - } - } - - return nil -} - -// ProjectTask a task resource -type ProjectTask struct { - autorest.Response `json:"-"` - // Etag - HTTP strong entity tag value. This is ignored if submitted. - Etag *string `json:"etag,omitempty"` - // Properties - Custom task properties - Properties BasicProjectTaskProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProjectTask. -func (pt ProjectTask) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pt.Etag != nil { - objectMap["etag"] = pt.Etag - } - objectMap["properties"] = pt.Properties - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ProjectTask struct. -func (pt *ProjectTask) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - pt.Etag = &etag - } - case "properties": - if v != nil { - properties, err := unmarshalBasicProjectTaskProperties(*v) - if err != nil { - return err - } - pt.Properties = properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pt.Type = &typeVar - } - } - } - - return nil -} - -// BasicProjectTaskProperties base class for all types of DMS task properties. If task is not supported by current -// client, this object is returned. -type BasicProjectTaskProperties interface { - AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) - AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) - AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) - AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) - AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) - AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) - AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) - AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) - AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) - AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) - AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) - AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) - AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) - AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) - AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) - AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) - AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) - AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) - AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) - AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) - AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) - AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) - AsProjectTaskProperties() (*ProjectTaskProperties, bool) -} - -// ProjectTaskProperties base class for all types of DMS task properties. If task is not supported by current -// client, this object is returned. -type ProjectTaskProperties struct { - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -func unmarshalBasicProjectTaskProperties(body []byte) (BasicProjectTaskProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["taskType"] { - case string(TaskTypeGetTDECertificatesSQL): - var gtcstp GetTdeCertificatesSQLTaskProperties - err := json.Unmarshal(body, >cstp) - return gtcstp, err - case string(TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS): - var vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties - err := json.Unmarshal(body, &vmisssmstp) - return vmisssmstp, err - case string(TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI): - var vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties - err := json.Unmarshal(body, &vmisssmtp) - return vmisssmtp, err - case string(TaskTypeValidateMigrationInputSQLServerSQLDbSync): - var vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties - err := json.Unmarshal(body, &vmisssdstp) - return vmisssdstp, err - case string(TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync): - var mpsadfpsstp MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties - err := json.Unmarshal(body, &mpsadfpsstp) - return mpsadfpsstp, err - case string(TaskTypeMigrateMySQLAzureDbForMySQLSync): - var mmsadfmsstp MigrateMySQLAzureDbForMySQLSyncTaskProperties - err := json.Unmarshal(body, &mmsadfmsstp) - return mmsadfmsstp, err - case string(TaskTypeMigrateSQLServerAzureSQLDbSync): - var msssdstp MigrateSQLServerSQLDbSyncTaskProperties - err := json.Unmarshal(body, &msssdstp) - return msssdstp, err - case string(TaskTypeMigrateSQLServerSQLDb): - var msssdtp MigrateSQLServerSQLDbTaskProperties - err := json.Unmarshal(body, &msssdtp) - return msssdtp, err - case string(TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS): - var msssmstp MigrateSQLServerSQLMISyncTaskProperties - err := json.Unmarshal(body, &msssmstp) - return msssmstp, err - case string(TaskTypeMigrateSQLServerAzureSQLDbMI): - var msssmtp MigrateSQLServerSQLMITaskProperties - err := json.Unmarshal(body, &msssmtp) - return msssmtp, err - case string(TaskTypeConnectToTargetAzureDbForMySQL): - var cttadfmstp ConnectToTargetAzureDbForMySQLTaskProperties - err := json.Unmarshal(body, &cttadfmstp) - return cttadfmstp, err - case string(TaskTypeConnectToTargetAzureSQLDbMISyncLRS): - var cttsmstp ConnectToTargetSQLMISyncTaskProperties - err := json.Unmarshal(body, &cttsmstp) - return cttsmstp, err - case string(TaskTypeConnectToTargetAzureSQLDbMI): - var cttsmtp ConnectToTargetSQLMITaskProperties - err := json.Unmarshal(body, &cttsmtp) - return cttsmtp, err - case string(TaskTypeGetUserTablesAzureSQLDbSync): - var gutsstp GetUserTablesSQLSyncTaskProperties - err := json.Unmarshal(body, &gutsstp) - return gutsstp, err - case string(TaskTypeGetUserTablesSQL): - var gutstp GetUserTablesSQLTaskProperties - err := json.Unmarshal(body, &gutstp) - return gutstp, err - case string(TaskTypeConnectToTargetAzureDbForPostgreSQLSync): - var cttadfpsstp ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties - err := json.Unmarshal(body, &cttadfpsstp) - return cttadfpsstp, err - case string(TaskTypeConnectToTargetSQLDbSync): - var cttssdstp ConnectToTargetSQLSQLDbSyncTaskProperties - err := json.Unmarshal(body, &cttssdstp) - return cttssdstp, err - case string(TaskTypeConnectToTargetSQLDb): - var cttsdtp ConnectToTargetSQLDbTaskProperties - err := json.Unmarshal(body, &cttsdtp) - return cttsdtp, err - case string(TaskTypeConnectToSourcePostgreSQLSync): - var ctspsstp ConnectToSourcePostgreSQLSyncTaskProperties - err := json.Unmarshal(body, &ctspsstp) - return ctspsstp, err - case string(TaskTypeConnectToSourceSQLServerSync): - var ctsssstp ConnectToSourceSQLServerSyncTaskProperties - err := json.Unmarshal(body, &ctsssstp) - return ctsssstp, err - case string(TaskTypeConnectToSourceSQLServer): - var ctssstp ConnectToSourceSQLServerTaskProperties - err := json.Unmarshal(body, &ctssstp) - return ctssstp, err - case string(TaskTypeConnectToSourceMySQL): - var ctsmstp ConnectToSourceMySQLTaskProperties - err := json.Unmarshal(body, &ctsmstp) - return ctsmstp, err - default: - var ptp ProjectTaskProperties - err := json.Unmarshal(body, &ptp) - return ptp, err - } -} -func unmarshalBasicProjectTaskPropertiesArray(body []byte) ([]BasicProjectTaskProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - ptpArray := make([]BasicProjectTaskProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ptp, err := unmarshalBasicProjectTaskProperties(*rawMessage) - if err != nil { - return nil, err - } - ptpArray[index] = ptp - } - return ptpArray, nil -} - -// MarshalJSON is the custom marshaler for ProjectTaskProperties. -func (ptp ProjectTaskProperties) MarshalJSON() ([]byte, error) { - ptp.TaskType = TaskTypeProjectTaskProperties - objectMap := make(map[string]interface{}) - if ptp.TaskType != "" { - objectMap["taskType"] = ptp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return &ptp, true -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. -func (ptp ProjectTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &ptp, true -} - -// UnmarshalJSON is the custom unmarshaler for ProjectTaskProperties struct. -func (ptp *ProjectTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - ptp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - ptp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - ptp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - ptp.TaskType = taskType - } - } - } - - return nil -} - -// QueryAnalysisValidationResult results for query analysis comparison between the source and target -type QueryAnalysisValidationResult struct { - // QueryResults - READ-ONLY; List of queries executed and it's execution results in source and target - QueryResults *QueryExecutionResult `json:"queryResults,omitempty"` - // ValidationErrors - READ-ONLY; Errors that are part of the execution - ValidationErrors *ValidationError `json:"validationErrors,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryAnalysisValidationResult. -func (qavr QueryAnalysisValidationResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// QueryExecutionResult describes query analysis results for execution in source and target -type QueryExecutionResult struct { - // QueryText - READ-ONLY; Query text retrieved from the source server - QueryText *string `json:"queryText,omitempty"` - // StatementsInBatch - READ-ONLY; Total no. of statements in the batch - StatementsInBatch *int64 `json:"statementsInBatch,omitempty"` - // SourceResult - READ-ONLY; Query analysis result from the source - SourceResult *ExecutionStatistics `json:"sourceResult,omitempty"` - // TargetResult - READ-ONLY; Query analysis result from the target - TargetResult *ExecutionStatistics `json:"targetResult,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryExecutionResult. -func (qer QueryExecutionResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Quota describes a quota for or usage details about a resource -type Quota struct { - // CurrentValue - The current value of the quota. If null or missing, the current value cannot be determined in the context of the request. - CurrentValue *float64 `json:"currentValue,omitempty"` - // ID - The resource ID of the quota object - ID *string `json:"id,omitempty"` - // Limit - The maximum value of the quota. If null or missing, the quota has no maximum, in which case it merely tracks usage. - Limit *float64 `json:"limit,omitempty"` - // Name - The name of the quota - Name *QuotaName `json:"name,omitempty"` - // Unit - The unit for the quota, such as Count, Bytes, BytesPerSecond, etc. - Unit *string `json:"unit,omitempty"` -} - -// QuotaList oData page of quota objects -type QuotaList struct { - autorest.Response `json:"-"` - // Value - List of quotas - Value *[]Quota `json:"value,omitempty"` - // NextLink - URL to load the next page of quotas, or null or missing if this is the last page - NextLink *string `json:"nextLink,omitempty"` -} - -// QuotaListIterator provides access to a complete listing of Quota values. -type QuotaListIterator struct { - i int - page QuotaListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *QuotaListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QuotaListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *QuotaListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter QuotaListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter QuotaListIterator) Response() QuotaList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter QuotaListIterator) Value() Quota { - if !iter.page.NotDone() { - return Quota{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the QuotaListIterator type. -func NewQuotaListIterator(page QuotaListPage) QuotaListIterator { - return QuotaListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ql QuotaList) IsEmpty() bool { - return ql.Value == nil || len(*ql.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ql QuotaList) hasNextLink() bool { - return ql.NextLink != nil && len(*ql.NextLink) != 0 -} - -// quotaListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ql QuotaList) quotaListPreparer(ctx context.Context) (*http.Request, error) { - if !ql.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ql.NextLink))) -} - -// QuotaListPage contains a page of Quota values. -type QuotaListPage struct { - fn func(context.Context, QuotaList) (QuotaList, error) - ql QuotaList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *QuotaListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QuotaListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ql) - if err != nil { - return err - } - page.ql = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *QuotaListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page QuotaListPage) NotDone() bool { - return !page.ql.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page QuotaListPage) Response() QuotaList { - return page.ql -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page QuotaListPage) Values() []Quota { - if page.ql.IsEmpty() { - return nil - } - return *page.ql.Value -} - -// Creates a new instance of the QuotaListPage type. -func NewQuotaListPage(cur QuotaList, getNextPage func(context.Context, QuotaList) (QuotaList, error)) QuotaListPage { - return QuotaListPage{ - fn: getNextPage, - ql: cur, - } -} - -// QuotaName the name of the quota -type QuotaName struct { - // LocalizedValue - The localized name of the quota - LocalizedValue *string `json:"localizedValue,omitempty"` - // Value - The unlocalized name (or ID) of the quota - Value *string `json:"value,omitempty"` -} - -// ReportableException exception object for all custom exceptions -type ReportableException struct { - // Message - READ-ONLY; Error message - Message *string `json:"message,omitempty"` - // ActionableMessage - Actionable steps for this exception - ActionableMessage *string `json:"actionableMessage,omitempty"` - // FilePath - READ-ONLY; The path to the file where exception occurred - FilePath *string `json:"filePath,omitempty"` - // LineNumber - READ-ONLY; The line number where exception occurred - LineNumber *string `json:"lineNumber,omitempty"` - // HResult - READ-ONLY; Coded numerical value that is assigned to a specific exception - HResult *int32 `json:"hResult,omitempty"` - // StackTrace - READ-ONLY; Stack trace - StackTrace *string `json:"stackTrace,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReportableException. -func (re ReportableException) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if re.ActionableMessage != nil { - objectMap["actionableMessage"] = re.ActionableMessage - } - return json.Marshal(objectMap) -} - -// Resource ARM resource. -type Resource struct { - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceSku describes an available DMS SKU. -type ResourceSku struct { - // ResourceType - READ-ONLY; The type of resource the SKU applies to. - ResourceType *string `json:"resourceType,omitempty"` - // Name - READ-ONLY; The name of SKU. - Name *string `json:"name,omitempty"` - // Tier - READ-ONLY; Specifies the tier of DMS in a scale set. - Tier *string `json:"tier,omitempty"` - // Size - READ-ONLY; The Size of the SKU. - Size *string `json:"size,omitempty"` - // Family - READ-ONLY; The Family of this particular SKU. - Family *string `json:"family,omitempty"` - // Kind - READ-ONLY; The Kind of resources that are supported in this SKU. - Kind *string `json:"kind,omitempty"` - // Capacity - READ-ONLY; Not used. - Capacity *ResourceSkuCapacity `json:"capacity,omitempty"` - // Locations - READ-ONLY; The set of locations that the SKU is available. - Locations *[]string `json:"locations,omitempty"` - // APIVersions - READ-ONLY; The api versions that support this SKU. - APIVersions *[]string `json:"apiVersions,omitempty"` - // Costs - READ-ONLY; Metadata for retrieving price info. - Costs *[]ResourceSkuCosts `json:"costs,omitempty"` - // Capabilities - READ-ONLY; A name value pair to describe the capability. - Capabilities *[]ResourceSkuCapabilities `json:"capabilities,omitempty"` - // Restrictions - READ-ONLY; The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - Restrictions *[]ResourceSkuRestrictions `json:"restrictions,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceSku. -func (rs ResourceSku) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceSkuCapabilities describes The SKU capabilities object. -type ResourceSkuCapabilities struct { - // Name - READ-ONLY; An invariant to describe the feature. - Name *string `json:"name,omitempty"` - // Value - READ-ONLY; An invariant if the feature is measured by quantity. - Value *string `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceSkuCapabilities. -func (rsc ResourceSkuCapabilities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceSkuCapacity describes scaling information of a SKU. -type ResourceSkuCapacity struct { - // Minimum - READ-ONLY; The minimum capacity. - Minimum *int64 `json:"minimum,omitempty"` - // Maximum - READ-ONLY; The maximum capacity. - Maximum *int64 `json:"maximum,omitempty"` - // Default - READ-ONLY; The default capacity. - Default *int64 `json:"default,omitempty"` - // ScaleType - READ-ONLY; The scale type applicable to the SKU. Possible values include: 'ResourceSkuCapacityScaleTypeAutomatic', 'ResourceSkuCapacityScaleTypeManual', 'ResourceSkuCapacityScaleTypeNone' - ScaleType ResourceSkuCapacityScaleType `json:"scaleType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceSkuCapacity. -func (rsc ResourceSkuCapacity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceSkuCosts describes metadata for retrieving price info. -type ResourceSkuCosts struct { - // MeterID - READ-ONLY; Used for querying price from commerce. - MeterID *string `json:"meterID,omitempty"` - // Quantity - READ-ONLY; The multiplier is needed to extend the base metered cost. - Quantity *int64 `json:"quantity,omitempty"` - // ExtendedUnit - READ-ONLY; An invariant to show the extended unit. - ExtendedUnit *string `json:"extendedUnit,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceSkuCosts. -func (rsc ResourceSkuCosts) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceSkuRestrictions describes scaling information of a SKU. -type ResourceSkuRestrictions struct { - // Type - READ-ONLY; The type of restrictions. Possible values include: 'Location' - Type ResourceSkuRestrictionsType `json:"type,omitempty"` - // Values - READ-ONLY; The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. - Values *[]string `json:"values,omitempty"` - // ReasonCode - READ-ONLY; The reason code for restriction. Possible values include: 'QuotaID', 'NotAvailableForSubscription' - ReasonCode ResourceSkuRestrictionsReasonCode `json:"reasonCode,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceSkuRestrictions. -func (rsr ResourceSkuRestrictions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceSkusResult the DMS List SKUs operation response. -type ResourceSkusResult struct { - autorest.Response `json:"-"` - // Value - The list of SKUs available for the subscription. - Value *[]ResourceSku `json:"value,omitempty"` - // NextLink - The uri to fetch the next page of DMS SKUs. Call ListNext() with this to fetch the next page of DMS SKUs. - NextLink *string `json:"nextLink,omitempty"` -} - -// ResourceSkusResultIterator provides access to a complete listing of ResourceSku values. -type ResourceSkusResultIterator struct { - i int - page ResourceSkusResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ResourceSkusResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ResourceSkusResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ResourceSkusResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ResourceSkusResultIterator) Response() ResourceSkusResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ResourceSkusResultIterator) Value() ResourceSku { - if !iter.page.NotDone() { - return ResourceSku{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ResourceSkusResultIterator type. -func NewResourceSkusResultIterator(page ResourceSkusResultPage) ResourceSkusResultIterator { - return ResourceSkusResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rsr ResourceSkusResult) IsEmpty() bool { - return rsr.Value == nil || len(*rsr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rsr ResourceSkusResult) hasNextLink() bool { - return rsr.NextLink != nil && len(*rsr.NextLink) != 0 -} - -// resourceSkusResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rsr ResourceSkusResult) resourceSkusResultPreparer(ctx context.Context) (*http.Request, error) { - if !rsr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rsr.NextLink))) -} - -// ResourceSkusResultPage contains a page of ResourceSku values. -type ResourceSkusResultPage struct { - fn func(context.Context, ResourceSkusResult) (ResourceSkusResult, error) - rsr ResourceSkusResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ResourceSkusResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rsr) - if err != nil { - return err - } - page.rsr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ResourceSkusResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ResourceSkusResultPage) NotDone() bool { - return !page.rsr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ResourceSkusResultPage) Response() ResourceSkusResult { - return page.rsr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ResourceSkusResultPage) Values() []ResourceSku { - if page.rsr.IsEmpty() { - return nil - } - return *page.rsr.Value -} - -// Creates a new instance of the ResourceSkusResultPage type. -func NewResourceSkusResultPage(cur ResourceSkusResult, getNextPage func(context.Context, ResourceSkusResult) (ResourceSkusResult, error)) ResourceSkusResultPage { - return ResourceSkusResultPage{ - fn: getNextPage, - rsr: cur, - } -} - -// SchemaComparisonValidationResult results for schema comparison between the source and target -type SchemaComparisonValidationResult struct { - // SchemaDifferences - READ-ONLY; List of schema differences between the source and target databases - SchemaDifferences *SchemaComparisonValidationResultType `json:"schemaDifferences,omitempty"` - // ValidationErrors - READ-ONLY; List of errors that happened while performing schema compare validation - ValidationErrors *ValidationError `json:"validationErrors,omitempty"` - // SourceDatabaseObjectCount - Count of source database objects - SourceDatabaseObjectCount map[string]*int64 `json:"sourceDatabaseObjectCount"` - // TargetDatabaseObjectCount - Count of target database objects - TargetDatabaseObjectCount map[string]*int64 `json:"targetDatabaseObjectCount"` -} - -// MarshalJSON is the custom marshaler for SchemaComparisonValidationResult. -func (scvr SchemaComparisonValidationResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scvr.SourceDatabaseObjectCount != nil { - objectMap["sourceDatabaseObjectCount"] = scvr.SourceDatabaseObjectCount - } - if scvr.TargetDatabaseObjectCount != nil { - objectMap["targetDatabaseObjectCount"] = scvr.TargetDatabaseObjectCount - } - return json.Marshal(objectMap) -} - -// SchemaComparisonValidationResultType description about the errors happen while performing migration -// validation -type SchemaComparisonValidationResultType struct { - // ObjectName - READ-ONLY; Name of the object that has the difference - ObjectName *string `json:"objectName,omitempty"` - // ObjectType - READ-ONLY; Type of the object that has the difference. e.g (Table/View/StoredProcedure). Possible values include: 'StoredProcedures', 'Table', 'User', 'View', 'Function' - ObjectType ObjectType `json:"objectType,omitempty"` - // UpdateAction - READ-ONLY; Update action type with respect to target. Possible values include: 'DeletedOnTarget', 'ChangedOnTarget', 'AddedOnTarget' - UpdateAction UpdateActionType `json:"updateAction,omitempty"` -} - -// MarshalJSON is the custom marshaler for SchemaComparisonValidationResultType. -func (scvrt SchemaComparisonValidationResultType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SelectedCertificateInput info for certificate to be exported for TDE enabled databases. -type SelectedCertificateInput struct { - // CertificateName - Name of certificate to be exported. - CertificateName *string `json:"certificateName,omitempty"` - // Password - Password to use for encrypting the exported certificate. - Password *string `json:"password,omitempty"` -} - -// ServerProperties server properties for Oracle, MySQL type source -type ServerProperties struct { - // ServerPlatform - READ-ONLY; Name of the server platform - ServerPlatform *string `json:"serverPlatform,omitempty"` - // ServerName - READ-ONLY; Name of the server - ServerName *string `json:"serverName,omitempty"` - // ServerVersion - READ-ONLY; Version of the database server - ServerVersion *string `json:"serverVersion,omitempty"` - // ServerEdition - READ-ONLY; Edition of the database server - ServerEdition *string `json:"serverEdition,omitempty"` - // ServerOperatingSystemVersion - READ-ONLY; Version of the operating system - ServerOperatingSystemVersion *string `json:"serverOperatingSystemVersion,omitempty"` - // ServerDatabaseCount - READ-ONLY; Number of databases in the server - ServerDatabaseCount *int32 `json:"serverDatabaseCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerProperties. -func (sp ServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Service a Database Migration Service resource -type Service struct { - autorest.Response `json:"-"` - // Etag - HTTP strong entity tag value. Ignored if submitted - Etag *string `json:"etag,omitempty"` - // Kind - The resource kind. Only 'vm' (the default) is supported. - Kind *string `json:"kind,omitempty"` - // ServiceProperties - Custom service properties - *ServiceProperties `json:"properties,omitempty"` - // Sku - Service SKU - Sku *ServiceSku `json:"sku,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Service. -func (s Service) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Etag != nil { - objectMap["etag"] = s.Etag - } - if s.Kind != nil { - objectMap["kind"] = s.Kind - } - if s.ServiceProperties != nil { - objectMap["properties"] = s.ServiceProperties - } - if s.Sku != nil { - objectMap["sku"] = s.Sku - } - if s.Tags != nil { - objectMap["tags"] = s.Tags - } - if s.Location != nil { - objectMap["location"] = s.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Service struct. -func (s *Service) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - s.Etag = &etag - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - s.Kind = &kind - } - case "properties": - if v != nil { - var serviceProperties ServiceProperties - err = json.Unmarshal(*v, &serviceProperties) - if err != nil { - return err - } - s.ServiceProperties = &serviceProperties - } - case "sku": - if v != nil { - var sku ServiceSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - s.Sku = &sku - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - s.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - s.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - s.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - s.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - s.Type = &typeVar - } - } - } - - return nil -} - -// ServiceList oData page of service objects -type ServiceList struct { - autorest.Response `json:"-"` - // Value - List of services - Value *[]Service `json:"value,omitempty"` - // NextLink - URL to load the next page of services - NextLink *string `json:"nextLink,omitempty"` -} - -// ServiceListIterator provides access to a complete listing of Service values. -type ServiceListIterator struct { - i int - page ServiceListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServiceListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServiceListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServiceListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServiceListIterator) Response() ServiceList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServiceListIterator) Value() Service { - if !iter.page.NotDone() { - return Service{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServiceListIterator type. -func NewServiceListIterator(page ServiceListPage) ServiceListIterator { - return ServiceListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sl ServiceList) IsEmpty() bool { - return sl.Value == nil || len(*sl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sl ServiceList) hasNextLink() bool { - return sl.NextLink != nil && len(*sl.NextLink) != 0 -} - -// serviceListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sl ServiceList) serviceListPreparer(ctx context.Context) (*http.Request, error) { - if !sl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sl.NextLink))) -} - -// ServiceListPage contains a page of Service values. -type ServiceListPage struct { - fn func(context.Context, ServiceList) (ServiceList, error) - sl ServiceList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServiceListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sl) - if err != nil { - return err - } - page.sl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServiceListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServiceListPage) NotDone() bool { - return !page.sl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServiceListPage) Response() ServiceList { - return page.sl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServiceListPage) Values() []Service { - if page.sl.IsEmpty() { - return nil - } - return *page.sl.Value -} - -// Creates a new instance of the ServiceListPage type. -func NewServiceListPage(cur ServiceList, getNextPage func(context.Context, ServiceList) (ServiceList, error)) ServiceListPage { - return ServiceListPage{ - fn: getNextPage, - sl: cur, - } -} - -// ServiceOperation description of an action supported by the Database Migration Service -type ServiceOperation struct { - // Name - The fully qualified action name, e.g. Microsoft.DataMigration/services/read - Name *string `json:"name,omitempty"` - // Display - Localized display text - Display *ServiceOperationDisplay `json:"display,omitempty"` -} - -// ServiceOperationDisplay localized display text -type ServiceOperationDisplay struct { - // Provider - The localized resource provider name - Provider *string `json:"provider,omitempty"` - // Resource - The localized resource type name - Resource *string `json:"resource,omitempty"` - // Operation - The localized operation name - Operation *string `json:"operation,omitempty"` - // Description - The localized operation description - Description *string `json:"description,omitempty"` -} - -// ServiceOperationList oData page of action (operation) objects -type ServiceOperationList struct { - autorest.Response `json:"-"` - // Value - List of actions - Value *[]ServiceOperation `json:"value,omitempty"` - // NextLink - URL to load the next page of actions - NextLink *string `json:"nextLink,omitempty"` -} - -// ServiceOperationListIterator provides access to a complete listing of ServiceOperation values. -type ServiceOperationListIterator struct { - i int - page ServiceOperationListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServiceOperationListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceOperationListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServiceOperationListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServiceOperationListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServiceOperationListIterator) Response() ServiceOperationList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServiceOperationListIterator) Value() ServiceOperation { - if !iter.page.NotDone() { - return ServiceOperation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServiceOperationListIterator type. -func NewServiceOperationListIterator(page ServiceOperationListPage) ServiceOperationListIterator { - return ServiceOperationListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sol ServiceOperationList) IsEmpty() bool { - return sol.Value == nil || len(*sol.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sol ServiceOperationList) hasNextLink() bool { - return sol.NextLink != nil && len(*sol.NextLink) != 0 -} - -// serviceOperationListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sol ServiceOperationList) serviceOperationListPreparer(ctx context.Context) (*http.Request, error) { - if !sol.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sol.NextLink))) -} - -// ServiceOperationListPage contains a page of ServiceOperation values. -type ServiceOperationListPage struct { - fn func(context.Context, ServiceOperationList) (ServiceOperationList, error) - sol ServiceOperationList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServiceOperationListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceOperationListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sol) - if err != nil { - return err - } - page.sol = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServiceOperationListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServiceOperationListPage) NotDone() bool { - return !page.sol.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServiceOperationListPage) Response() ServiceOperationList { - return page.sol -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServiceOperationListPage) Values() []ServiceOperation { - if page.sol.IsEmpty() { - return nil - } - return *page.sol.Value -} - -// Creates a new instance of the ServiceOperationListPage type. -func NewServiceOperationListPage(cur ServiceOperationList, getNextPage func(context.Context, ServiceOperationList) (ServiceOperationList, error)) ServiceOperationListPage { - return ServiceOperationListPage{ - fn: getNextPage, - sol: cur, - } -} - -// ServiceProperties properties of the Data Migration service instance -type ServiceProperties struct { - // ProvisioningState - READ-ONLY; The resource's provisioning state. Possible values include: 'ServiceProvisioningStateAccepted', 'ServiceProvisioningStateDeleting', 'ServiceProvisioningStateDeploying', 'ServiceProvisioningStateStopped', 'ServiceProvisioningStateStopping', 'ServiceProvisioningStateStarting', 'ServiceProvisioningStateFailedToStart', 'ServiceProvisioningStateFailedToStop', 'ServiceProvisioningStateSucceeded', 'ServiceProvisioningStateFailed' - ProvisioningState ServiceProvisioningState `json:"provisioningState,omitempty"` - // PublicKey - The public key of the service, used to encrypt secrets sent to the service - PublicKey *string `json:"publicKey,omitempty"` - // VirtualSubnetID - The ID of the Microsoft.Network/virtualNetworks/subnets resource to which the service should be joined - VirtualSubnetID *string `json:"virtualSubnetId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceProperties. -func (sp ServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.PublicKey != nil { - objectMap["publicKey"] = sp.PublicKey - } - if sp.VirtualSubnetID != nil { - objectMap["virtualSubnetId"] = sp.VirtualSubnetID - } - return json.Marshal(objectMap) -} - -// ServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServicesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (Service, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesCreateOrUpdateFuture.Result. -func (future *ServicesCreateOrUpdateFuture) result(client ServicesClient) (s Service, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datamigration.ServicesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.CreateOrUpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ServicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServicesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesDeleteFuture.Result. -func (future *ServicesDeleteFuture) result(client ServicesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datamigration.ServicesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServiceSku an Azure SKU instance -type ServiceSku struct { - // Name - The unique name of the SKU, such as 'P3' - Name *string `json:"name,omitempty"` - // Tier - The tier of the SKU, such as 'Free', 'Basic', 'Standard', or 'Premium' - Tier *string `json:"tier,omitempty"` - // Family - The SKU family, used when the service has multiple performance classes within a tier, such as 'A', 'D', etc. for virtual machines - Family *string `json:"family,omitempty"` - // Size - The size of the SKU, used when the name alone does not denote a service size or when a SKU has multiple performance classes within a family, e.g. 'A1' for virtual machines - Size *string `json:"size,omitempty"` - // Capacity - The capacity of the SKU, if it supports scaling - Capacity *int32 `json:"capacity,omitempty"` -} - -// ServiceSkuList oData page of available SKUs -type ServiceSkuList struct { - autorest.Response `json:"-"` - // Value - List of service SKUs - Value *[]AvailableServiceSku `json:"value,omitempty"` - // NextLink - URL to load the next page of service SKUs - NextLink *string `json:"nextLink,omitempty"` -} - -// ServiceSkuListIterator provides access to a complete listing of AvailableServiceSku values. -type ServiceSkuListIterator struct { - i int - page ServiceSkuListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServiceSkuListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceSkuListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServiceSkuListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServiceSkuListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServiceSkuListIterator) Response() ServiceSkuList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServiceSkuListIterator) Value() AvailableServiceSku { - if !iter.page.NotDone() { - return AvailableServiceSku{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServiceSkuListIterator type. -func NewServiceSkuListIterator(page ServiceSkuListPage) ServiceSkuListIterator { - return ServiceSkuListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ssl ServiceSkuList) IsEmpty() bool { - return ssl.Value == nil || len(*ssl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ssl ServiceSkuList) hasNextLink() bool { - return ssl.NextLink != nil && len(*ssl.NextLink) != 0 -} - -// serviceSkuListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ssl ServiceSkuList) serviceSkuListPreparer(ctx context.Context) (*http.Request, error) { - if !ssl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ssl.NextLink))) -} - -// ServiceSkuListPage contains a page of AvailableServiceSku values. -type ServiceSkuListPage struct { - fn func(context.Context, ServiceSkuList) (ServiceSkuList, error) - ssl ServiceSkuList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServiceSkuListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceSkuListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ssl) - if err != nil { - return err - } - page.ssl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServiceSkuListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServiceSkuListPage) NotDone() bool { - return !page.ssl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServiceSkuListPage) Response() ServiceSkuList { - return page.ssl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServiceSkuListPage) Values() []AvailableServiceSku { - if page.ssl.IsEmpty() { - return nil - } - return *page.ssl.Value -} - -// Creates a new instance of the ServiceSkuListPage type. -func NewServiceSkuListPage(cur ServiceSkuList, getNextPage func(context.Context, ServiceSkuList) (ServiceSkuList, error)) ServiceSkuListPage { - return ServiceSkuListPage{ - fn: getNextPage, - ssl: cur, - } -} - -// ServicesStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServicesStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesStartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesStartFuture.Result. -func (future *ServicesStartFuture) result(client ServicesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datamigration.ServicesStartFuture") - return - } - ar.Response = future.Response() - return -} - -// ServicesStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type ServicesStopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesStopFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesStopFuture.Result. -func (future *ServicesStopFuture) result(client ServicesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesStopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datamigration.ServicesStopFuture") - return - } - ar.Response = future.Response() - return -} - -// ServiceStatusResponse service health status -type ServiceStatusResponse struct { - autorest.Response `json:"-"` - // AgentVersion - The DMS instance agent version - AgentVersion *string `json:"agentVersion,omitempty"` - // Status - The machine-readable status, such as 'Initializing', 'Offline', 'Online', 'Deploying', 'Deleting', 'Stopped', 'Stopping', 'Starting', 'FailedToStart', 'FailedToStop' or 'Failed' - Status *string `json:"status,omitempty"` - // VMSize - The services virtual machine size, such as 'Standard_D2_v2' - VMSize *string `json:"vmSize,omitempty"` - // SupportedTaskTypes - The list of supported task types - SupportedTaskTypes *[]string `json:"supportedTaskTypes,omitempty"` -} - -// ServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServicesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (Service, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesUpdateFuture.Result. -func (future *ServicesUpdateFuture) result(client ServicesClient) (s Service, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datamigration.ServicesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.UpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLConnectionInfo information for connecting to SQL database server -type SQLConnectionInfo struct { - // DataSource - Data source in the format Protocol:MachineName\SQLServerInstanceName,PortNumber - DataSource *string `json:"dataSource,omitempty"` - // Authentication - Authentication type to use for connection. Possible values include: 'None', 'WindowsAuthentication', 'SQLAuthentication', 'ActiveDirectoryIntegrated', 'ActiveDirectoryPassword' - Authentication AuthenticationType `json:"authentication,omitempty"` - // EncryptConnection - Whether to encrypt the connection - EncryptConnection *bool `json:"encryptConnection,omitempty"` - // AdditionalSettings - Additional connection settings - AdditionalSettings *string `json:"additionalSettings,omitempty"` - // TrustServerCertificate - Whether to trust the server certificate - TrustServerCertificate *bool `json:"trustServerCertificate,omitempty"` - // Platform - Server platform type for connection. Possible values include: 'SQLOnPrem' - Platform SQLSourcePlatform `json:"platform,omitempty"` - // UserName - User name - UserName *string `json:"userName,omitempty"` - // Password - Password credential. - Password *string `json:"password,omitempty"` - // Type - Possible values include: 'TypeConnectionInfo', 'TypeMiSQLConnectionInfo', 'TypePostgreSQLConnectionInfo', 'TypeMySQLConnectionInfo', 'TypeSQLConnectionInfo' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLConnectionInfo. -func (sci SQLConnectionInfo) MarshalJSON() ([]byte, error) { - sci.Type = TypeSQLConnectionInfo - objectMap := make(map[string]interface{}) - if sci.DataSource != nil { - objectMap["dataSource"] = sci.DataSource - } - if sci.Authentication != "" { - objectMap["authentication"] = sci.Authentication - } - if sci.EncryptConnection != nil { - objectMap["encryptConnection"] = sci.EncryptConnection - } - if sci.AdditionalSettings != nil { - objectMap["additionalSettings"] = sci.AdditionalSettings - } - if sci.TrustServerCertificate != nil { - objectMap["trustServerCertificate"] = sci.TrustServerCertificate - } - if sci.Platform != "" { - objectMap["platform"] = sci.Platform - } - if sci.UserName != nil { - objectMap["userName"] = sci.UserName - } - if sci.Password != nil { - objectMap["password"] = sci.Password - } - if sci.Type != "" { - objectMap["type"] = sci.Type - } - return json.Marshal(objectMap) -} - -// AsMiSQLConnectionInfo is the BasicConnectionInfo implementation for SQLConnectionInfo. -func (sci SQLConnectionInfo) AsMiSQLConnectionInfo() (*MiSQLConnectionInfo, bool) { - return nil, false -} - -// AsPostgreSQLConnectionInfo is the BasicConnectionInfo implementation for SQLConnectionInfo. -func (sci SQLConnectionInfo) AsPostgreSQLConnectionInfo() (*PostgreSQLConnectionInfo, bool) { - return nil, false -} - -// AsMySQLConnectionInfo is the BasicConnectionInfo implementation for SQLConnectionInfo. -func (sci SQLConnectionInfo) AsMySQLConnectionInfo() (*MySQLConnectionInfo, bool) { - return nil, false -} - -// AsSQLConnectionInfo is the BasicConnectionInfo implementation for SQLConnectionInfo. -func (sci SQLConnectionInfo) AsSQLConnectionInfo() (*SQLConnectionInfo, bool) { - return &sci, true -} - -// AsConnectionInfo is the BasicConnectionInfo implementation for SQLConnectionInfo. -func (sci SQLConnectionInfo) AsConnectionInfo() (*ConnectionInfo, bool) { - return nil, false -} - -// AsBasicConnectionInfo is the BasicConnectionInfo implementation for SQLConnectionInfo. -func (sci SQLConnectionInfo) AsBasicConnectionInfo() (BasicConnectionInfo, bool) { - return &sci, true -} - -// SQLMigrationTaskInput base class for migration task input -type SQLMigrationTaskInput struct { - // SourceConnectionInfo - Information for connecting to source - SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetConnectionInfo - Information for connecting to target - TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` -} - -// SQLServerSQLMISyncTaskInput input for task that migrates SQL Server databases to Azure SQL Database -// Managed Instance online scenario. -type SQLServerSQLMISyncTaskInput struct { - // SelectedDatabases - Databases to migrate - SelectedDatabases *[]MigrateSQLServerSQLMIDatabaseInput `json:"selectedDatabases,omitempty"` - // BackupFileShare - Backup file share information for all selected databases. - BackupFileShare *FileShare `json:"backupFileShare,omitempty"` - // StorageResourceID - Fully qualified resourceId of storage - StorageResourceID *string `json:"storageResourceId,omitempty"` - // SourceConnectionInfo - Connection information for source SQL Server - SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetConnectionInfo - Connection information for Azure SQL Database Managed Instance - TargetConnectionInfo *MiSQLConnectionInfo `json:"targetConnectionInfo,omitempty"` - // AzureApp - Azure Active Directory Application the DMS instance will use to connect to the target instance of Azure SQL Database Managed Instance and the Azure Storage Account - AzureApp *AzureActiveDirectoryApp `json:"azureApp,omitempty"` -} - -// StartMigrationScenarioServerRoleResult server role migration result -type StartMigrationScenarioServerRoleResult struct { - // Name - READ-ONLY; Name of server role. - Name *string `json:"name,omitempty"` - // State - READ-ONLY; Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' - State MigrationState `json:"state,omitempty"` - // ExceptionsAndWarnings - READ-ONLY; Migration exceptions and warnings. - ExceptionsAndWarnings *[]ReportableException `json:"exceptionsAndWarnings,omitempty"` -} - -// MarshalJSON is the custom marshaler for StartMigrationScenarioServerRoleResult. -func (smssrr StartMigrationScenarioServerRoleResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SyncMigrationDatabaseErrorEvent database migration errors for online migration -type SyncMigrationDatabaseErrorEvent struct { - // TimestampString - READ-ONLY; String value of timestamp. - TimestampString *string `json:"timestampString,omitempty"` - // EventTypeString - READ-ONLY; Event type. - EventTypeString *string `json:"eventTypeString,omitempty"` - // EventText - READ-ONLY; Event text. - EventText *string `json:"eventText,omitempty"` -} - -// MarshalJSON is the custom marshaler for SyncMigrationDatabaseErrorEvent. -func (smdee SyncMigrationDatabaseErrorEvent) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TaskList oData page of tasks -type TaskList struct { - autorest.Response `json:"-"` - // Value - List of tasks - Value *[]ProjectTask `json:"value,omitempty"` - // NextLink - URL to load the next page of tasks - NextLink *string `json:"nextLink,omitempty"` -} - -// TaskListIterator provides access to a complete listing of ProjectTask values. -type TaskListIterator struct { - i int - page TaskListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *TaskListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *TaskListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TaskListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter TaskListIterator) Response() TaskList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter TaskListIterator) Value() ProjectTask { - if !iter.page.NotDone() { - return ProjectTask{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TaskListIterator type. -func NewTaskListIterator(page TaskListPage) TaskListIterator { - return TaskListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tl TaskList) IsEmpty() bool { - return tl.Value == nil || len(*tl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tl TaskList) hasNextLink() bool { - return tl.NextLink != nil && len(*tl.NextLink) != 0 -} - -// taskListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tl TaskList) taskListPreparer(ctx context.Context) (*http.Request, error) { - if !tl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tl.NextLink))) -} - -// TaskListPage contains a page of ProjectTask values. -type TaskListPage struct { - fn func(context.Context, TaskList) (TaskList, error) - tl TaskList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *TaskListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.tl) - if err != nil { - return err - } - page.tl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *TaskListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TaskListPage) NotDone() bool { - return !page.tl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TaskListPage) Response() TaskList { - return page.tl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TaskListPage) Values() []ProjectTask { - if page.tl.IsEmpty() { - return nil - } - return *page.tl.Value -} - -// Creates a new instance of the TaskListPage type. -func NewTaskListPage(cur TaskList, getNextPage func(context.Context, TaskList) (TaskList, error)) TaskListPage { - return TaskListPage{ - fn: getNextPage, - tl: cur, - } -} - -// TrackedResource ARM tracked top level resource. -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// ValidateMigrationInputSQLServerSQLDbSyncTaskProperties properties for task that validates migration -// input for SQL to Azure SQL DB sync migrations -type ValidateMigrationInputSQLServerSQLDbSyncTaskProperties struct { - // Input - Task input - Input *ValidateSyncMigrationInputSQLServerTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]ValidateSyncMigrationInputSQLServerTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) MarshalJSON() ([]byte, error) { - vmisssdstp.TaskType = TaskTypeValidateMigrationInputSQLServerSQLDbSync - objectMap := make(map[string]interface{}) - if vmisssdstp.Input != nil { - objectMap["input"] = vmisssdstp.Input - } - if vmisssdstp.TaskType != "" { - objectMap["taskType"] = vmisssdstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return &vmisssdstp, true -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties. -func (vmisssdstp ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &vmisssdstp, true -} - -// UnmarshalJSON is the custom unmarshaler for ValidateMigrationInputSQLServerSQLDbSyncTaskProperties struct. -func (vmisssdstp *ValidateMigrationInputSQLServerSQLDbSyncTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input ValidateSyncMigrationInputSQLServerTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - vmisssdstp.Input = &input - } - case "output": - if v != nil { - var output []ValidateSyncMigrationInputSQLServerTaskOutput - err = json.Unmarshal(*v, &output) - if err != nil { - return err - } - vmisssdstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - vmisssdstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - vmisssdstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - vmisssdstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - vmisssdstp.TaskType = taskType - } - } - } - - return nil -} - -// ValidateMigrationInputSQLServerSQLMISyncTaskInput input for task that migrates SQL Server databases to -// Azure SQL Database Managed Instance online scenario. -type ValidateMigrationInputSQLServerSQLMISyncTaskInput struct { - // SelectedDatabases - Databases to migrate - SelectedDatabases *[]MigrateSQLServerSQLMIDatabaseInput `json:"selectedDatabases,omitempty"` - // BackupFileShare - Backup file share information for all selected databases. - BackupFileShare *FileShare `json:"backupFileShare,omitempty"` - // StorageResourceID - Fully qualified resourceId of storage - StorageResourceID *string `json:"storageResourceId,omitempty"` - // SourceConnectionInfo - Connection information for source SQL Server - SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetConnectionInfo - Connection information for Azure SQL Database Managed Instance - TargetConnectionInfo *MiSQLConnectionInfo `json:"targetConnectionInfo,omitempty"` - // AzureApp - Azure Active Directory Application the DMS instance will use to connect to the target instance of Azure SQL Database Managed Instance and the Azure Storage Account - AzureApp *AzureActiveDirectoryApp `json:"azureApp,omitempty"` -} - -// ValidateMigrationInputSQLServerSQLMISyncTaskOutput output for task that validates migration input for -// Azure SQL Database Managed Instance online migration -type ValidateMigrationInputSQLServerSQLMISyncTaskOutput struct { - // ID - READ-ONLY; Database identifier - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of database - Name *string `json:"name,omitempty"` - // ValidationErrors - READ-ONLY; Errors associated with a selected database object - ValidationErrors *[]ReportableException `json:"validationErrors,omitempty"` -} - -// MarshalJSON is the custom marshaler for ValidateMigrationInputSQLServerSQLMISyncTaskOutput. -func (vmisssmsto ValidateMigrationInputSQLServerSQLMISyncTaskOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ValidateMigrationInputSQLServerSQLMISyncTaskProperties properties for task that validates migration -// input for SQL to Azure SQL Database Managed Instance sync scenario -type ValidateMigrationInputSQLServerSQLMISyncTaskProperties struct { - // Input - Task input - Input *ValidateMigrationInputSQLServerSQLMISyncTaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]ValidateMigrationInputSQLServerSQLMISyncTaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) MarshalJSON() ([]byte, error) { - vmisssmstp.TaskType = TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS - objectMap := make(map[string]interface{}) - if vmisssmstp.Input != nil { - objectMap["input"] = vmisssmstp.Input - } - if vmisssmstp.TaskType != "" { - objectMap["taskType"] = vmisssmstp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return &vmisssmstp, true -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMISyncTaskProperties. -func (vmisssmstp ValidateMigrationInputSQLServerSQLMISyncTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &vmisssmstp, true -} - -// UnmarshalJSON is the custom unmarshaler for ValidateMigrationInputSQLServerSQLMISyncTaskProperties struct. -func (vmisssmstp *ValidateMigrationInputSQLServerSQLMISyncTaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input ValidateMigrationInputSQLServerSQLMISyncTaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - vmisssmstp.Input = &input - } - case "output": - if v != nil { - var output []ValidateMigrationInputSQLServerSQLMISyncTaskOutput - err = json.Unmarshal(*v, &output) - if err != nil { - return err - } - vmisssmstp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - vmisssmstp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - vmisssmstp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - vmisssmstp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - vmisssmstp.TaskType = taskType - } - } - } - - return nil -} - -// ValidateMigrationInputSQLServerSQLMITaskInput input for task that validates migration input for SQL to -// Azure SQL Managed Instance -type ValidateMigrationInputSQLServerSQLMITaskInput struct { - // SourceConnectionInfo - Information for connecting to source - SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetConnectionInfo - Information for connecting to target - TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` - // SelectedDatabases - Databases to migrate - SelectedDatabases *[]MigrateSQLServerSQLMIDatabaseInput `json:"selectedDatabases,omitempty"` - // SelectedLogins - Logins to migrate - SelectedLogins *[]string `json:"selectedLogins,omitempty"` - // BackupFileShare - Backup file share information for all selected databases. - BackupFileShare *FileShare `json:"backupFileShare,omitempty"` - // BackupBlobShare - SAS URI of Azure Storage Account Container to be used for storing backup files. - BackupBlobShare *BlobShare `json:"backupBlobShare,omitempty"` - // BackupMode - Backup Mode to specify whether to use existing backup or create new backup. Possible values include: 'CreateBackup', 'ExistingBackup' - BackupMode BackupMode `json:"backupMode,omitempty"` -} - -// ValidateMigrationInputSQLServerSQLMITaskOutput output for task that validates migration input for SQL to -// Azure SQL Managed Instance migrations -type ValidateMigrationInputSQLServerSQLMITaskOutput struct { - // ID - READ-ONLY; Result identifier - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of database - Name *string `json:"name,omitempty"` - // RestoreDatabaseNameErrors - READ-ONLY; Errors associated with the RestoreDatabaseName - RestoreDatabaseNameErrors *[]ReportableException `json:"restoreDatabaseNameErrors,omitempty"` - // BackupFolderErrors - READ-ONLY; Errors associated with the BackupFolder path - BackupFolderErrors *[]ReportableException `json:"backupFolderErrors,omitempty"` - // BackupShareCredentialsErrors - READ-ONLY; Errors associated with backup share user name and password credentials - BackupShareCredentialsErrors *[]ReportableException `json:"backupShareCredentialsErrors,omitempty"` - // BackupStorageAccountErrors - READ-ONLY; Errors associated with the storage account provided. - BackupStorageAccountErrors *[]ReportableException `json:"backupStorageAccountErrors,omitempty"` - // ExistingBackupErrors - READ-ONLY; Errors associated with existing backup files. - ExistingBackupErrors *[]ReportableException `json:"existingBackupErrors,omitempty"` - // DatabaseBackupInfo - Information about backup files when existing backup mode is used. - DatabaseBackupInfo *DatabaseBackupInfo `json:"databaseBackupInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ValidateMigrationInputSQLServerSQLMITaskOutput. -func (vmisssmto ValidateMigrationInputSQLServerSQLMITaskOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vmisssmto.DatabaseBackupInfo != nil { - objectMap["databaseBackupInfo"] = vmisssmto.DatabaseBackupInfo - } - return json.Marshal(objectMap) -} - -// ValidateMigrationInputSQLServerSQLMITaskProperties properties for task that validates migration input -// for SQL to Azure SQL Database Managed Instance -type ValidateMigrationInputSQLServerSQLMITaskProperties struct { - // Input - Task input - Input *ValidateMigrationInputSQLServerSQLMITaskInput `json:"input,omitempty"` - // Output - READ-ONLY; Task output. This is ignored if submitted. - Output *[]ValidateMigrationInputSQLServerSQLMITaskOutput `json:"output,omitempty"` - // Errors - READ-ONLY; Array of errors. This is ignored if submitted. - Errors *[]ODataError `json:"errors,omitempty"` - // State - READ-ONLY; The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' - State TaskState `json:"state,omitempty"` - // Commands - READ-ONLY; Array of command properties. - Commands *[]BasicCommandProperties `json:"commands,omitempty"` - // TaskType - Possible values include: 'TaskTypeProjectTaskProperties', 'TaskTypeGetTDECertificatesSQL', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMISyncLRS', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeValidateMigrationInputSQLServerSQLDbSync', 'TaskTypeMigratePostgreSQLAzureDbForPostgreSQLSync', 'TaskTypeMigrateMySQLAzureDbForMySQLSync', 'TaskTypeMigrateSQLServerAzureSQLDbSync', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMISyncLRS', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeConnectToTargetAzureDbForMySQL', 'TaskTypeConnectToTargetAzureSQLDbMISyncLRS', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeGetUserTablesAzureSQLDbSync', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetAzureDbForPostgreSQLSync', 'TaskTypeConnectToTargetSQLDbSync', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToSourcePostgreSQLSync', 'TaskTypeConnectToSourceSQLServerSync', 'TaskTypeConnectToSourceSQLServer', 'TaskTypeConnectToSourceMySQL' - TaskType TaskType `json:"taskType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) MarshalJSON() ([]byte, error) { - vmisssmtp.TaskType = TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI - objectMap := make(map[string]interface{}) - if vmisssmtp.Input != nil { - objectMap["input"] = vmisssmtp.Input - } - if vmisssmtp.TaskType != "" { - objectMap["taskType"] = vmisssmtp.TaskType - } - return json.Marshal(objectMap) -} - -// AsGetTdeCertificatesSQLTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsGetTdeCertificatesSQLTaskProperties() (*GetTdeCertificatesSQLTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsValidateMigrationInputSQLServerSQLMISyncTaskProperties() (*ValidateMigrationInputSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { - return &vmisssmtp, true -} - -// AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsValidateMigrationInputSQLServerSQLDbSyncTaskProperties() (*ValidateMigrationInputSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsMigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties() (*MigratePostgreSQLAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateMySQLAzureDbForMySQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsMigrateMySQLAzureDbForMySQLSyncTaskProperties() (*MigrateMySQLAzureDbForMySQLSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsMigrateSQLServerSQLDbSyncTaskProperties() (*MigrateSQLServerSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsMigrateSQLServerSQLMISyncTaskProperties() (*MigrateSQLServerSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForMySQLTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsConnectToTargetAzureDbForMySQLTaskProperties() (*ConnectToTargetAzureDbForMySQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMISyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsGetUserTablesSQLSyncTaskProperties() (*GetUserTablesSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsConnectToTargetAzureDbForPostgreSQLSyncTaskProperties() (*ConnectToTargetAzureDbForPostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLSQLDbSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourcePostgreSQLSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsConnectToSourcePostgreSQLSyncTaskProperties() (*ConnectToSourcePostgreSQLSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerSyncTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { - return nil, false -} - -// AsConnectToSourceMySQLTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsConnectToSourceMySQLTaskProperties() (*ConnectToSourceMySQLTaskProperties, bool) { - return nil, false -} - -// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { - return nil, false -} - -// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. -func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { - return &vmisssmtp, true -} - -// UnmarshalJSON is the custom unmarshaler for ValidateMigrationInputSQLServerSQLMITaskProperties struct. -func (vmisssmtp *ValidateMigrationInputSQLServerSQLMITaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "input": - if v != nil { - var input ValidateMigrationInputSQLServerSQLMITaskInput - err = json.Unmarshal(*v, &input) - if err != nil { - return err - } - vmisssmtp.Input = &input - } - case "output": - if v != nil { - var output []ValidateMigrationInputSQLServerSQLMITaskOutput - err = json.Unmarshal(*v, &output) - if err != nil { - return err - } - vmisssmtp.Output = &output - } - case "errors": - if v != nil { - var errorsVar []ODataError - err = json.Unmarshal(*v, &errorsVar) - if err != nil { - return err - } - vmisssmtp.Errors = &errorsVar - } - case "state": - if v != nil { - var state TaskState - err = json.Unmarshal(*v, &state) - if err != nil { - return err - } - vmisssmtp.State = state - } - case "commands": - if v != nil { - commands, err := unmarshalBasicCommandPropertiesArray(*v) - if err != nil { - return err - } - vmisssmtp.Commands = &commands - } - case "taskType": - if v != nil { - var taskType TaskType - err = json.Unmarshal(*v, &taskType) - if err != nil { - return err - } - vmisssmtp.TaskType = taskType - } - } - } - - return nil -} - -// ValidateSyncMigrationInputSQLServerTaskInput input for task that validates migration input for SQL sync -// migrations -type ValidateSyncMigrationInputSQLServerTaskInput struct { - // SourceConnectionInfo - Information for connecting to source SQL server - SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` - // TargetConnectionInfo - Information for connecting to target - TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` - // SelectedDatabases - Databases to migrate - SelectedDatabases *[]MigrateSQLServerSQLDbSyncDatabaseInput `json:"selectedDatabases,omitempty"` -} - -// ValidateSyncMigrationInputSQLServerTaskOutput output for task that validates migration input for SQL -// sync migrations -type ValidateSyncMigrationInputSQLServerTaskOutput struct { - // ID - READ-ONLY; Database identifier - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of database - Name *string `json:"name,omitempty"` - // ValidationErrors - READ-ONLY; Errors associated with a selected database object - ValidationErrors *[]ReportableException `json:"validationErrors,omitempty"` -} - -// MarshalJSON is the custom marshaler for ValidateSyncMigrationInputSQLServerTaskOutput. -func (vsmissto ValidateSyncMigrationInputSQLServerTaskOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ValidationError description about the errors happen while performing migration validation -type ValidationError struct { - // Text - READ-ONLY; Error Text - Text *string `json:"text,omitempty"` - // Severity - READ-ONLY; Severity of the error. Possible values include: 'SeverityMessage', 'SeverityWarning', 'SeverityError' - Severity Severity `json:"severity,omitempty"` -} - -// MarshalJSON is the custom marshaler for ValidationError. -func (ve ValidationError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WaitStatistics wait statistics gathered during query batch execution -type WaitStatistics struct { - // WaitType - READ-ONLY; Type of the Wait - WaitType *string `json:"waitType,omitempty"` - // WaitTimeMs - READ-ONLY; Total wait time in millisecond(s) - WaitTimeMs *float64 `json:"waitTimeMs,omitempty"` - // WaitCount - READ-ONLY; Total no. of waits - WaitCount *int64 `json:"waitCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for WaitStatistics. -func (ws WaitStatistics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/operations.go deleted file mode 100644 index a88c8a645b1c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package datamigration - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the data Migration Client -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all available actions exposed by the Database Migration Service resource provider. -func (client OperationsClient) List(ctx context.Context) (result ServiceOperationListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.sol.Response.Response != nil { - sc = result.sol.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sol.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.sol, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.sol.hasNextLink() && result.sol.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DataMigration/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result ServiceOperationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults ServiceOperationList) (result ServiceOperationList, err error) { - req, err := lastResults.serviceOperationListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datamigration.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datamigration.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result ServiceOperationListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/projects.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/projects.go deleted file mode 100644 index e7fc0073b46d..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/projects.go +++ /dev/null @@ -1,475 +0,0 @@ -package datamigration - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ProjectsClient is the data Migration Client -type ProjectsClient struct { - BaseClient -} - -// NewProjectsClient creates an instance of the ProjectsClient client. -func NewProjectsClient(subscriptionID string) ProjectsClient { - return NewProjectsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProjectsClientWithBaseURI creates an instance of the ProjectsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewProjectsClientWithBaseURI(baseURI string, subscriptionID string) ProjectsClient { - return ProjectsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate the project resource is a nested resource representing a stored migration project. The PUT method -// creates a new project or updates an existing one. -// Parameters: -// parameters - information about the project -// groupName - name of the resource group -// serviceName - name of the service -// projectName - name of the project -func (client ProjectsClient) CreateOrUpdate(ctx context.Context, parameters Project, groupName string, serviceName string, projectName string) (result Project, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProjectsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, parameters, groupName, serviceName, projectName) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProjectsClient) CreateOrUpdatePreparer(ctx context.Context, parameters Project, groupName string, serviceName string, projectName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "projectName": autorest.Encode("path", projectName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ProjectsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ProjectsClient) CreateOrUpdateResponder(resp *http.Response) (result Project, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete the project resource is a nested resource representing a stored migration project. The DELETE method deletes -// a project. -// Parameters: -// groupName - name of the resource group -// serviceName - name of the service -// projectName - name of the project -// deleteRunningTasks - delete the resource even if it contains running tasks -func (client ProjectsClient) Delete(ctx context.Context, groupName string, serviceName string, projectName string, deleteRunningTasks *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProjectsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, groupName, serviceName, projectName, deleteRunningTasks) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProjectsClient) DeletePreparer(ctx context.Context, groupName string, serviceName string, projectName string, deleteRunningTasks *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "projectName": autorest.Encode("path", projectName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteRunningTasks != nil { - queryParameters["deleteRunningTasks"] = autorest.Encode("query", *deleteRunningTasks) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ProjectsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ProjectsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get the project resource is a nested resource representing a stored migration project. The GET method retrieves -// information about a project. -// Parameters: -// groupName - name of the resource group -// serviceName - name of the service -// projectName - name of the project -func (client ProjectsClient) Get(ctx context.Context, groupName string, serviceName string, projectName string) (result Project, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProjectsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, groupName, serviceName, projectName) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProjectsClient) GetPreparer(ctx context.Context, groupName string, serviceName string, projectName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "projectName": autorest.Encode("path", projectName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProjectsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProjectsClient) GetResponder(resp *http.Response) (result Project, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup the project resource is a nested resource representing a stored migration project. This method -// returns a list of projects owned by a service resource. -// Parameters: -// groupName - name of the resource group -// serviceName - name of the service -func (client ProjectsClient) ListByResourceGroup(ctx context.Context, groupName string, serviceName string) (result ProjectListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProjectsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.pl.Response.Response != nil { - sc = result.pl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, groupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.pl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.pl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.pl.hasNextLink() && result.pl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ProjectsClient) ListByResourceGroupPreparer(ctx context.Context, groupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ProjectsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ProjectsClient) ListByResourceGroupResponder(resp *http.Response) (result ProjectList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ProjectsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ProjectList) (result ProjectList, err error) { - req, err := lastResults.projectListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProjectsClient) ListByResourceGroupComplete(ctx context.Context, groupName string, serviceName string) (result ProjectListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProjectsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, groupName, serviceName) - return -} - -// Update the project resource is a nested resource representing a stored migration project. The PATCH method updates -// an existing project. -// Parameters: -// parameters - information about the project -// groupName - name of the resource group -// serviceName - name of the service -// projectName - name of the project -func (client ProjectsClient) Update(ctx context.Context, parameters Project, groupName string, serviceName string, projectName string) (result Project, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProjectsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, parameters, groupName, serviceName, projectName) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ProjectsClient) UpdatePreparer(ctx context.Context, parameters Project, groupName string, serviceName string, projectName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "projectName": autorest.Encode("path", projectName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ProjectsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ProjectsClient) UpdateResponder(resp *http.Response) (result Project, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/resourceskus.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/resourceskus.go deleted file mode 100644 index 6e815f87a882..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/resourceskus.go +++ /dev/null @@ -1,144 +0,0 @@ -package datamigration - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ResourceSkusClient is the data Migration Client -type ResourceSkusClient struct { - BaseClient -} - -// NewResourceSkusClient creates an instance of the ResourceSkusClient client. -func NewResourceSkusClient(subscriptionID string) ResourceSkusClient { - return NewResourceSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewResourceSkusClientWithBaseURI creates an instance of the ResourceSkusClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewResourceSkusClientWithBaseURI(baseURI string, subscriptionID string) ResourceSkusClient { - return ResourceSkusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListSkus the skus action returns the list of SKUs that DMS supports. -func (client ResourceSkusClient) ListSkus(ctx context.Context) (result ResourceSkusResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusClient.ListSkus") - defer func() { - sc := -1 - if result.rsr.Response.Response != nil { - sc = result.rsr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listSkusNextResults - req, err := client.ListSkusPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ResourceSkusClient", "ListSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListSkusSender(req) - if err != nil { - result.rsr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.ResourceSkusClient", "ListSkus", resp, "Failure sending request") - return - } - - result.rsr, err = client.ListSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ResourceSkusClient", "ListSkus", resp, "Failure responding to request") - return - } - if result.rsr.hasNextLink() && result.rsr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListSkusPreparer prepares the ListSkus request. -func (client ResourceSkusClient) ListSkusPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSkusSender sends the ListSkus request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceSkusClient) ListSkusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSkusResponder handles the response to the ListSkus request. The method always -// closes the http.Response Body. -func (client ResourceSkusClient) ListSkusResponder(resp *http.Response) (result ResourceSkusResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listSkusNextResults retrieves the next set of results, if any. -func (client ResourceSkusClient) listSkusNextResults(ctx context.Context, lastResults ResourceSkusResult) (result ResourceSkusResult, err error) { - req, err := lastResults.resourceSkusResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datamigration.ResourceSkusClient", "listSkusNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datamigration.ResourceSkusClient", "listSkusNextResults", resp, "Failure sending next results request") - } - result, err = client.ListSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ResourceSkusClient", "listSkusNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListSkusComplete enumerates all values, automatically crossing page boundaries as required. -func (client ResourceSkusClient) ListSkusComplete(ctx context.Context) (result ResourceSkusResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusClient.ListSkus") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListSkus(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/services.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/services.go deleted file mode 100644 index a083be57ba88..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/services.go +++ /dev/null @@ -1,1113 +0,0 @@ -package datamigration - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServicesClient is the data Migration Client -type ServicesClient struct { - BaseClient -} - -// NewServicesClient creates an instance of the ServicesClient client. -func NewServicesClient(subscriptionID string) ServicesClient { - return NewServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServicesClientWithBaseURI creates an instance of the ServicesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewServicesClientWithBaseURI(baseURI string, subscriptionID string) ServicesClient { - return ServicesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability this method checks whether a proposed top-level resource name is valid and available. -// Parameters: -// location - the Azure region of the operation -// parameters - requested name to validate -func (client ServicesClient) CheckNameAvailability(ctx context.Context, location string, parameters NameAvailabilityRequest) (result NameAvailabilityResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CheckNameAvailabilityPreparer(ctx, location, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ServicesClient) CheckNameAvailabilityPreparer(ctx context.Context, location string, parameters NameAvailabilityRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/locations/{location}/checkNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client ServicesClient) CheckNameAvailabilityResponder(resp *http.Response) (result NameAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CheckStatus the services resource is the top-level resource that represents the Database Migration Service. This -// action performs a health check and returns the status of the service and virtual machine size. -// Parameters: -// groupName - name of the resource group -// serviceName - name of the service -func (client ServicesClient) CheckStatus(ctx context.Context, groupName string, serviceName string) (result ServiceStatusResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.CheckStatus") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CheckStatusPreparer(ctx, groupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CheckStatus", nil, "Failure preparing request") - return - } - - resp, err := client.CheckStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CheckStatus", resp, "Failure sending request") - return - } - - result, err = client.CheckStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CheckStatus", resp, "Failure responding to request") - return - } - - return -} - -// CheckStatusPreparer prepares the CheckStatus request. -func (client ServicesClient) CheckStatusPreparer(ctx context.Context, groupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/checkStatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckStatusSender sends the CheckStatus request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) CheckStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckStatusResponder handles the response to the CheckStatus request. The method always -// closes the http.Response Body. -func (client ServicesClient) CheckStatusResponder(resp *http.Response) (result ServiceStatusResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate the services resource is the top-level resource that represents the Database Migration Service. The -// PUT method creates a new service or updates an existing one. When a service is updated, existing child resources -// (i.e. tasks) are unaffected. Services currently support a single kind, "vm", which refers to a VM-based service, -// although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, -// but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request -// ("ServiceIsBusy"). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use -// the provisioningState property. -// Parameters: -// parameters - information about the service -// groupName - name of the resource group -// serviceName - name of the service -func (client ServicesClient) CreateOrUpdate(ctx context.Context, parameters Service, groupName string, serviceName string) (result ServicesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ServiceProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.VirtualSubnetID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("datamigration.ServicesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, parameters, groupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServicesClient) CreateOrUpdatePreparer(ctx context.Context, parameters Service, groupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) CreateOrUpdateSender(req *http.Request) (future ServicesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServicesClient) CreateOrUpdateResponder(resp *http.Response) (result Service, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete the services resource is the top-level resource that represents the Database Migration Service. The DELETE -// method deletes a service. Any running tasks will be canceled. -// Parameters: -// groupName - name of the resource group -// serviceName - name of the service -// deleteRunningTasks - delete the resource even if it contains running tasks -func (client ServicesClient) Delete(ctx context.Context, groupName string, serviceName string, deleteRunningTasks *bool) (result ServicesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, groupName, serviceName, deleteRunningTasks) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServicesClient) DeletePreparer(ctx context.Context, groupName string, serviceName string, deleteRunningTasks *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteRunningTasks != nil { - queryParameters["deleteRunningTasks"] = autorest.Encode("query", *deleteRunningTasks) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) DeleteSender(req *http.Request) (future ServicesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get the services resource is the top-level resource that represents the Database Migration Service. The GET method -// retrieves information about a service instance. -// Parameters: -// groupName - name of the resource group -// serviceName - name of the service -func (client ServicesClient) Get(ctx context.Context, groupName string, serviceName string) (result Service, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, groupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServicesClient) GetPreparer(ctx context.Context, groupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServicesClient) GetResponder(resp *http.Response) (result Service, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List the services resource is the top-level resource that represents the Database Migration Service. This method -// returns a list of service resources in a subscription. -func (client ServicesClient) List(ctx context.Context) (result ServiceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.List") - defer func() { - sc := -1 - if result.sl.Response.Response != nil { - sc = result.sl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "List", resp, "Failure sending request") - return - } - - result.sl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "List", resp, "Failure responding to request") - return - } - if result.sl.hasNextLink() && result.sl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServicesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/services", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServicesClient) ListResponder(resp *http.Response) (result ServiceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ServicesClient) listNextResults(ctx context.Context, lastResults ServiceList) (result ServiceList, err error) { - req, err := lastResults.serviceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServicesClient) ListComplete(ctx context.Context) (result ServiceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup the Services resource is the top-level resource that represents the Database Migration Service. -// This method returns a list of service resources in a resource group. -// Parameters: -// groupName - name of the resource group -func (client ServicesClient) ListByResourceGroup(ctx context.Context, groupName string) (result ServiceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.sl.Response.Response != nil { - sc = result.sl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.sl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.sl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.sl.hasNextLink() && result.sl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ServicesClient) ListByResourceGroupPreparer(ctx context.Context, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ServicesClient) ListByResourceGroupResponder(resp *http.Response) (result ServiceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ServicesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ServiceList) (result ServiceList, err error) { - req, err := lastResults.serviceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServicesClient) ListByResourceGroupComplete(ctx context.Context, groupName string) (result ServiceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, groupName) - return -} - -// ListSkus the services resource is the top-level resource that represents the Database Migration Service. The skus -// action returns the list of SKUs that a service resource can be updated to. -// Parameters: -// groupName - name of the resource group -// serviceName - name of the service -func (client ServicesClient) ListSkus(ctx context.Context, groupName string, serviceName string) (result ServiceSkuListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListSkus") - defer func() { - sc := -1 - if result.ssl.Response.Response != nil { - sc = result.ssl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listSkusNextResults - req, err := client.ListSkusPreparer(ctx, groupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "ListSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListSkusSender(req) - if err != nil { - result.ssl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "ListSkus", resp, "Failure sending request") - return - } - - result.ssl, err = client.ListSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "ListSkus", resp, "Failure responding to request") - return - } - if result.ssl.hasNextLink() && result.ssl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListSkusPreparer prepares the ListSkus request. -func (client ServicesClient) ListSkusPreparer(ctx context.Context, groupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSkusSender sends the ListSkus request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) ListSkusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSkusResponder handles the response to the ListSkus request. The method always -// closes the http.Response Body. -func (client ServicesClient) ListSkusResponder(resp *http.Response) (result ServiceSkuList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listSkusNextResults retrieves the next set of results, if any. -func (client ServicesClient) listSkusNextResults(ctx context.Context, lastResults ServiceSkuList) (result ServiceSkuList, err error) { - req, err := lastResults.serviceSkuListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listSkusNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listSkusNextResults", resp, "Failure sending next results request") - } - result, err = client.ListSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listSkusNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListSkusComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServicesClient) ListSkusComplete(ctx context.Context, groupName string, serviceName string) (result ServiceSkuListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListSkus") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListSkus(ctx, groupName, serviceName) - return -} - -// NestedCheckNameAvailability this method checks whether a proposed nested resource name is valid and available. -// Parameters: -// groupName - name of the resource group -// serviceName - name of the service -// parameters - requested name to validate -func (client ServicesClient) NestedCheckNameAvailability(ctx context.Context, groupName string, serviceName string, parameters NameAvailabilityRequest) (result NameAvailabilityResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.NestedCheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.NestedCheckNameAvailabilityPreparer(ctx, groupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "NestedCheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.NestedCheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "NestedCheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.NestedCheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "NestedCheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// NestedCheckNameAvailabilityPreparer prepares the NestedCheckNameAvailability request. -func (client ServicesClient) NestedCheckNameAvailabilityPreparer(ctx context.Context, groupName string, serviceName string, parameters NameAvailabilityRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/checkNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// NestedCheckNameAvailabilitySender sends the NestedCheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) NestedCheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// NestedCheckNameAvailabilityResponder handles the response to the NestedCheckNameAvailability request. The method always -// closes the http.Response Body. -func (client ServicesClient) NestedCheckNameAvailabilityResponder(resp *http.Response) (result NameAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Start the services resource is the top-level resource that represents the Database Migration Service. This action -// starts the service and the service can be used for data migration. -// Parameters: -// groupName - name of the resource group -// serviceName - name of the service -func (client ServicesClient) Start(ctx context.Context, groupName string, serviceName string) (result ServicesStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Start") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.StartPreparer(ctx, groupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client ServicesClient) StartPreparer(ctx context.Context, groupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) StartSender(req *http.Request) (future ServicesStartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client ServicesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop the services resource is the top-level resource that represents the Database Migration Service. This action -// stops the service and the service cannot be used for data migration. The service owner won't be billed when the -// service is stopped. -// Parameters: -// groupName - name of the resource group -// serviceName - name of the service -func (client ServicesClient) Stop(ctx context.Context, groupName string, serviceName string) (result ServicesStopFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Stop") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.StopPreparer(ctx, groupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = client.StopSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Stop", result.Response(), "Failure sending request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client ServicesClient) StopPreparer(ctx context.Context, groupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) StopSender(req *http.Request) (future ServicesStopFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client ServicesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update the services resource is the top-level resource that represents the Database Migration Service. The PATCH -// method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks -// are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). -// Parameters: -// parameters - information about the service -// groupName - name of the resource group -// serviceName - name of the service -func (client ServicesClient) Update(ctx context.Context, parameters Service, groupName string, serviceName string) (result ServicesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, parameters, groupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServicesClient) UpdatePreparer(ctx context.Context, parameters Service, groupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) UpdateSender(req *http.Request) (future ServicesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ServicesClient) UpdateResponder(resp *http.Response) (result Service, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/tasks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/tasks.go deleted file mode 100644 index 5d74d2b573c2..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/tasks.go +++ /dev/null @@ -1,576 +0,0 @@ -package datamigration - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// TasksClient is the data Migration Client -type TasksClient struct { - BaseClient -} - -// NewTasksClient creates an instance of the TasksClient client. -func NewTasksClient(subscriptionID string) TasksClient { - return NewTasksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTasksClientWithBaseURI creates an instance of the TasksClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewTasksClientWithBaseURI(baseURI string, subscriptionID string) TasksClient { - return TasksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Cancel the tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This -// method cancels a task if it's currently queued or running. -// Parameters: -// groupName - name of the resource group -// serviceName - name of the service -// projectName - name of the project -// taskName - name of the Task -func (client TasksClient) Cancel(ctx context.Context, groupName string, serviceName string, projectName string, taskName string) (result ProjectTask, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.Cancel") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelPreparer(ctx, groupName, serviceName, projectName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Cancel", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Cancel", resp, "Failure sending request") - return - } - - result, err = client.CancelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Cancel", resp, "Failure responding to request") - return - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client TasksClient) CancelPreparer(ctx context.Context, groupName string, serviceName string, projectName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "projectName": autorest.Encode("path", projectName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/tasks/{taskName}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client TasksClient) CancelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client TasksClient) CancelResponder(resp *http.Response) (result ProjectTask, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate the tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. -// The PUT method creates a new task or updates an existing one, although since tasks have no mutable custom -// properties, there is little reason to update an existing one. -// Parameters: -// parameters - information about the task -// groupName - name of the resource group -// serviceName - name of the service -// projectName - name of the project -// taskName - name of the Task -func (client TasksClient) CreateOrUpdate(ctx context.Context, parameters ProjectTask, groupName string, serviceName string, projectName string, taskName string) (result ProjectTask, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, parameters, groupName, serviceName, projectName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TasksClient) CreateOrUpdatePreparer(ctx context.Context, parameters ProjectTask, groupName string, serviceName string, projectName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "projectName": autorest.Encode("path", projectName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/tasks/{taskName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client TasksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client TasksClient) CreateOrUpdateResponder(resp *http.Response) (result ProjectTask, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete the tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE -// method deletes a task, canceling it first if it's running. -// Parameters: -// groupName - name of the resource group -// serviceName - name of the service -// projectName - name of the project -// taskName - name of the Task -// deleteRunningTasks - delete the resource even if it contains running tasks -func (client TasksClient) Delete(ctx context.Context, groupName string, serviceName string, projectName string, taskName string, deleteRunningTasks *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, groupName, serviceName, projectName, taskName, deleteRunningTasks) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TasksClient) DeletePreparer(ctx context.Context, groupName string, serviceName string, projectName string, taskName string, deleteRunningTasks *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "projectName": autorest.Encode("path", projectName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteRunningTasks != nil { - queryParameters["deleteRunningTasks"] = autorest.Encode("query", *deleteRunningTasks) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/tasks/{taskName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client TasksClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client TasksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get the tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET -// method retrieves information about a task. -// Parameters: -// groupName - name of the resource group -// serviceName - name of the service -// projectName - name of the project -// taskName - name of the Task -// expand - expand the response -func (client TasksClient) Get(ctx context.Context, groupName string, serviceName string, projectName string, taskName string, expand string) (result ProjectTask, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, groupName, serviceName, projectName, taskName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TasksClient) GetPreparer(ctx context.Context, groupName string, serviceName string, projectName string, taskName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "projectName": autorest.Encode("path", projectName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/tasks/{taskName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TasksClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TasksClient) GetResponder(resp *http.Response) (result ProjectTask, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List the services resource is the top-level resource that represents the Database Migration Service. This method -// returns a list of tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that -// an error occurred while querying the status of that task. -// Parameters: -// groupName - name of the resource group -// serviceName - name of the service -// projectName - name of the project -// taskType - filter tasks by task type -func (client TasksClient) List(ctx context.Context, groupName string, serviceName string, projectName string, taskType string) (result TaskListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.List") - defer func() { - sc := -1 - if result.tl.Response.Response != nil { - sc = result.tl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, groupName, serviceName, projectName, taskType) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.tl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "List", resp, "Failure sending request") - return - } - - result.tl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "List", resp, "Failure responding to request") - return - } - if result.tl.hasNextLink() && result.tl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TasksClient) ListPreparer(ctx context.Context, groupName string, serviceName string, projectName string, taskType string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "projectName": autorest.Encode("path", projectName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(taskType) > 0 { - queryParameters["taskType"] = autorest.Encode("query", taskType) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/tasks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client TasksClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client TasksClient) ListResponder(resp *http.Response) (result TaskList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client TasksClient) listNextResults(ctx context.Context, lastResults TaskList) (result TaskList, err error) { - req, err := lastResults.taskListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datamigration.TasksClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datamigration.TasksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TasksClient) ListComplete(ctx context.Context, groupName string, serviceName string, projectName string, taskType string) (result TaskListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, groupName, serviceName, projectName, taskType) - return -} - -// Update the tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH -// method updates an existing task, but since tasks have no mutable custom properties, there is little reason to do so. -// Parameters: -// parameters - information about the task -// groupName - name of the resource group -// serviceName - name of the service -// projectName - name of the project -// taskName - name of the Task -func (client TasksClient) Update(ctx context.Context, parameters ProjectTask, groupName string, serviceName string, projectName string, taskName string) (result ProjectTask, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, parameters, groupName, serviceName, projectName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TasksClient) UpdatePreparer(ctx context.Context, parameters ProjectTask, groupName string, serviceName string, projectName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "projectName": autorest.Encode("path", projectName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/tasks/{taskName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client TasksClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client TasksClient) UpdateResponder(resp *http.Response) (result ProjectTask, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/usages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/usages.go deleted file mode 100644 index 76ad0afec273..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/usages.go +++ /dev/null @@ -1,147 +0,0 @@ -package datamigration - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// UsagesClient is the data Migration Client -type UsagesClient struct { - BaseClient -} - -// NewUsagesClient creates an instance of the UsagesClient client. -func NewUsagesClient(subscriptionID string) UsagesClient { - return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { - return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List this method returns region-specific quotas and resource usage information for the Database Migration Service. -// Parameters: -// location - the Azure region of the operation -func (client UsagesClient) List(ctx context.Context, location string) (result QuotaListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.List") - defer func() { - sc := -1 - if result.ql.Response.Response != nil { - sc = result.ql.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.UsagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.ql.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datamigration.UsagesClient", "List", resp, "Failure sending request") - return - } - - result.ql, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.UsagesClient", "List", resp, "Failure responding to request") - return - } - if result.ql.hasNextLink() && result.ql.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UsagesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/locations/{location}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UsagesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UsagesClient) ListResponder(resp *http.Response) (result QuotaList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client UsagesClient) listNextResults(ctx context.Context, lastResults QuotaList) (result QuotaList, err error) { - req, err := lastResults.quotaListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datamigration.UsagesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datamigration.UsagesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datamigration.UsagesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client UsagesClient) ListComplete(ctx context.Context, location string) (result QuotaListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, location) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/version.go deleted file mode 100644 index d3fbaaadc8ab..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package datamigration - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " datamigration/2018-04-19" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/_meta.json deleted file mode 100644 index 1350e7cfebf0..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/datashare/resource-manager/readme.md", - "tag": "package-2019-11-01", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2019-11-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/datashare/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/accounts.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/accounts.go deleted file mode 100644 index 735c70da9527..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/accounts.go +++ /dev/null @@ -1,592 +0,0 @@ -package datashare - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AccountsClient is the creates a Microsoft.DataShare management client. -type AccountsClient struct { - BaseClient -} - -// NewAccountsClient creates an instance of the AccountsClient client. -func NewAccountsClient(subscriptionID string) AccountsClient { - return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountsClientWithBaseURI creates an instance of the AccountsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { - return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create an account -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// account - the account payload. -func (client AccountsClient) Create(ctx context.Context, resourceGroupName string, accountName string, account Account) (result AccountsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: account, - Constraints: []validation.Constraint{{Target: "account.Identity", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("datashare.AccountsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, account) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client AccountsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, account Account) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}", pathParameters), - autorest.WithJSON(account), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) CreateSender(req *http.Request) (future AccountsCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client AccountsClient) CreateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deleteAccount -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -func (client AccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result AccountsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) DeleteSender(req *http.Request) (future AccountsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AccountsClient) DeleteResponder(resp *http.Response) (result OperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get an account -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -func (client AccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AccountsClient) GetResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list Accounts in ResourceGroup -// Parameters: -// resourceGroupName - the resource group name. -// skipToken - continuation token -func (client AccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, skipToken string) (result AccountListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.al.Response.Response != nil { - sc = result.al.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.al.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.al, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.al.hasNextLink() && result.al.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AccountsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) (result AccountList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client AccountsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AccountList) (result AccountList, err error) { - req, err := lastResults.accountListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.AccountsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.AccountsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, skipToken string) (result AccountListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, skipToken) - return -} - -// ListBySubscription list Accounts in Subscription -// Parameters: -// skipToken - continuation token -func (client AccountsClient) ListBySubscription(ctx context.Context, skipToken string) (result AccountListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.al.Response.Response != nil { - sc = result.al.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.al.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.al, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.al.hasNextLink() && result.al.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AccountsClient) ListBySubscriptionPreparer(ctx context.Context, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataShare/accounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListBySubscriptionResponder(resp *http.Response) (result AccountList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client AccountsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AccountList) (result AccountList, err error) { - req, err := lastResults.accountListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.AccountsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.AccountsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountsClient) ListBySubscriptionComplete(ctx context.Context, skipToken string) (result AccountListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx, skipToken) - return -} - -// Update patch an account -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// accountUpdateParameters - the account update parameters. -func (client AccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, accountUpdateParameters AccountUpdateParameters) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, accountUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, accountUpdateParameters AccountUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}", pathParameters), - autorest.WithJSON(accountUpdateParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/client.go deleted file mode 100644 index 722a7a29c496..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/datashare/armdatashare](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/datashare/armdatashare). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package datashare implements the Azure ARM Datashare service API version 2019-11-01. -// -// Creates a Microsoft.DataShare management client. -package datashare - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Datashare - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Datashare. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/consumerinvitations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/consumerinvitations.go deleted file mode 100644 index 1f9b9ee30676..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/consumerinvitations.go +++ /dev/null @@ -1,305 +0,0 @@ -package datashare - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ConsumerInvitationsClient is the creates a Microsoft.DataShare management client. -type ConsumerInvitationsClient struct { - BaseClient -} - -// NewConsumerInvitationsClient creates an instance of the ConsumerInvitationsClient client. -func NewConsumerInvitationsClient(subscriptionID string) ConsumerInvitationsClient { - return NewConsumerInvitationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConsumerInvitationsClientWithBaseURI creates an instance of the ConsumerInvitationsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewConsumerInvitationsClientWithBaseURI(baseURI string, subscriptionID string) ConsumerInvitationsClient { - return ConsumerInvitationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get an invitation -// Parameters: -// location - location of the invitation -// invitationID - an invitation id -func (client ConsumerInvitationsClient) Get(ctx context.Context, location string, invitationID string) (result ConsumerInvitation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConsumerInvitationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, location, invitationID) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ConsumerInvitationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.ConsumerInvitationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ConsumerInvitationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConsumerInvitationsClient) GetPreparer(ctx context.Context, location string, invitationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "invitationId": autorest.Encode("path", invitationID), - "location": autorest.Encode("path", location), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.DataShare/locations/{location}/consumerInvitations/{invitationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ConsumerInvitationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ConsumerInvitationsClient) GetResponder(resp *http.Response) (result ConsumerInvitation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListInvitations lists invitations -// Parameters: -// skipToken - the continuation token -func (client ConsumerInvitationsClient) ListInvitations(ctx context.Context, skipToken string) (result ConsumerInvitationListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConsumerInvitationsClient.ListInvitations") - defer func() { - sc := -1 - if result.cil.Response.Response != nil { - sc = result.cil.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listInvitationsNextResults - req, err := client.ListInvitationsPreparer(ctx, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ConsumerInvitationsClient", "ListInvitations", nil, "Failure preparing request") - return - } - - resp, err := client.ListInvitationsSender(req) - if err != nil { - result.cil.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.ConsumerInvitationsClient", "ListInvitations", resp, "Failure sending request") - return - } - - result.cil, err = client.ListInvitationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ConsumerInvitationsClient", "ListInvitations", resp, "Failure responding to request") - return - } - if result.cil.hasNextLink() && result.cil.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListInvitationsPreparer prepares the ListInvitations request. -func (client ConsumerInvitationsClient) ListInvitationsPreparer(ctx context.Context, skipToken string) (*http.Request, error) { - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DataShare/ListInvitations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListInvitationsSender sends the ListInvitations request. The method will close the -// http.Response Body if it receives an error. -func (client ConsumerInvitationsClient) ListInvitationsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListInvitationsResponder handles the response to the ListInvitations request. The method always -// closes the http.Response Body. -func (client ConsumerInvitationsClient) ListInvitationsResponder(resp *http.Response) (result ConsumerInvitationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listInvitationsNextResults retrieves the next set of results, if any. -func (client ConsumerInvitationsClient) listInvitationsNextResults(ctx context.Context, lastResults ConsumerInvitationList) (result ConsumerInvitationList, err error) { - req, err := lastResults.consumerInvitationListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.ConsumerInvitationsClient", "listInvitationsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListInvitationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.ConsumerInvitationsClient", "listInvitationsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListInvitationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ConsumerInvitationsClient", "listInvitationsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListInvitationsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ConsumerInvitationsClient) ListInvitationsComplete(ctx context.Context, skipToken string) (result ConsumerInvitationListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConsumerInvitationsClient.ListInvitations") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListInvitations(ctx, skipToken) - return -} - -// RejectInvitation reject an invitation -// Parameters: -// location - location of the invitation -// invitation - an invitation payload -func (client ConsumerInvitationsClient) RejectInvitation(ctx context.Context, location string, invitation ConsumerInvitation) (result ConsumerInvitation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConsumerInvitationsClient.RejectInvitation") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: invitation, - Constraints: []validation.Constraint{{Target: "invitation.ConsumerInvitationProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "invitation.ConsumerInvitationProperties.InvitationID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("datashare.ConsumerInvitationsClient", "RejectInvitation", err.Error()) - } - - req, err := client.RejectInvitationPreparer(ctx, location, invitation) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ConsumerInvitationsClient", "RejectInvitation", nil, "Failure preparing request") - return - } - - resp, err := client.RejectInvitationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.ConsumerInvitationsClient", "RejectInvitation", resp, "Failure sending request") - return - } - - result, err = client.RejectInvitationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ConsumerInvitationsClient", "RejectInvitation", resp, "Failure responding to request") - return - } - - return -} - -// RejectInvitationPreparer prepares the RejectInvitation request. -func (client ConsumerInvitationsClient) RejectInvitationPreparer(ctx context.Context, location string, invitation ConsumerInvitation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.DataShare/locations/{location}/RejectInvitation", pathParameters), - autorest.WithJSON(invitation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RejectInvitationSender sends the RejectInvitation request. The method will close the -// http.Response Body if it receives an error. -func (client ConsumerInvitationsClient) RejectInvitationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// RejectInvitationResponder handles the response to the RejectInvitation request. The method always -// closes the http.Response Body. -func (client ConsumerInvitationsClient) RejectInvitationResponder(resp *http.Response) (result ConsumerInvitation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/consumersourcedatasets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/consumersourcedatasets.go deleted file mode 100644 index bc3a55e8bd2b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/consumersourcedatasets.go +++ /dev/null @@ -1,156 +0,0 @@ -package datashare - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ConsumerSourceDataSetsClient is the creates a Microsoft.DataShare management client. -type ConsumerSourceDataSetsClient struct { - BaseClient -} - -// NewConsumerSourceDataSetsClient creates an instance of the ConsumerSourceDataSetsClient client. -func NewConsumerSourceDataSetsClient(subscriptionID string) ConsumerSourceDataSetsClient { - return NewConsumerSourceDataSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConsumerSourceDataSetsClientWithBaseURI creates an instance of the ConsumerSourceDataSetsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewConsumerSourceDataSetsClientWithBaseURI(baseURI string, subscriptionID string) ConsumerSourceDataSetsClient { - return ConsumerSourceDataSetsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByShareSubscription get source dataSets of a shareSubscription -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the shareSubscription. -// skipToken - continuation token -func (client ConsumerSourceDataSetsClient) ListByShareSubscription(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, skipToken string) (result ConsumerSourceDataSetListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConsumerSourceDataSetsClient.ListByShareSubscription") - defer func() { - sc := -1 - if result.csdsl.Response.Response != nil { - sc = result.csdsl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByShareSubscriptionNextResults - req, err := client.ListByShareSubscriptionPreparer(ctx, resourceGroupName, accountName, shareSubscriptionName, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ConsumerSourceDataSetsClient", "ListByShareSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListByShareSubscriptionSender(req) - if err != nil { - result.csdsl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.ConsumerSourceDataSetsClient", "ListByShareSubscription", resp, "Failure sending request") - return - } - - result.csdsl, err = client.ListByShareSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ConsumerSourceDataSetsClient", "ListByShareSubscription", resp, "Failure responding to request") - return - } - if result.csdsl.hasNextLink() && result.csdsl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByShareSubscriptionPreparer prepares the ListByShareSubscription request. -func (client ConsumerSourceDataSetsClient) ListByShareSubscriptionPreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/ConsumerSourceDataSets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByShareSubscriptionSender sends the ListByShareSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client ConsumerSourceDataSetsClient) ListByShareSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByShareSubscriptionResponder handles the response to the ListByShareSubscription request. The method always -// closes the http.Response Body. -func (client ConsumerSourceDataSetsClient) ListByShareSubscriptionResponder(resp *http.Response) (result ConsumerSourceDataSetList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByShareSubscriptionNextResults retrieves the next set of results, if any. -func (client ConsumerSourceDataSetsClient) listByShareSubscriptionNextResults(ctx context.Context, lastResults ConsumerSourceDataSetList) (result ConsumerSourceDataSetList, err error) { - req, err := lastResults.consumerSourceDataSetListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.ConsumerSourceDataSetsClient", "listByShareSubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByShareSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.ConsumerSourceDataSetsClient", "listByShareSubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByShareSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ConsumerSourceDataSetsClient", "listByShareSubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByShareSubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client ConsumerSourceDataSetsClient) ListByShareSubscriptionComplete(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, skipToken string) (result ConsumerSourceDataSetListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConsumerSourceDataSetsClient.ListByShareSubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByShareSubscription(ctx, resourceGroupName, accountName, shareSubscriptionName, skipToken) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/datasetmappings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/datasetmappings.go deleted file mode 100644 index 371fcc46c885..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/datasetmappings.go +++ /dev/null @@ -1,405 +0,0 @@ -package datashare - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DataSetMappingsClient is the creates a Microsoft.DataShare management client. -type DataSetMappingsClient struct { - BaseClient -} - -// NewDataSetMappingsClient creates an instance of the DataSetMappingsClient client. -func NewDataSetMappingsClient(subscriptionID string) DataSetMappingsClient { - return NewDataSetMappingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataSetMappingsClientWithBaseURI creates an instance of the DataSetMappingsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDataSetMappingsClientWithBaseURI(baseURI string, subscriptionID string) DataSetMappingsClient { - return DataSetMappingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a DataSetMapping -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the share subscription which will hold the data set sink. -// dataSetMappingName - the name of the data set mapping to be created. -// dataSetMapping - destination data set configuration details. -func (client DataSetMappingsClient) Create(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, dataSetMappingName string, dataSetMapping BasicDataSetMapping) (result DataSetMappingModel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataSetMappingsClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, shareSubscriptionName, dataSetMappingName, dataSetMapping) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetMappingsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.DataSetMappingsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetMappingsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client DataSetMappingsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, dataSetMappingName string, dataSetMapping BasicDataSetMapping) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "dataSetMappingName": autorest.Encode("path", dataSetMappingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/dataSetMappings/{dataSetMappingName}", pathParameters), - autorest.WithJSON(dataSetMapping), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client DataSetMappingsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client DataSetMappingsClient) CreateResponder(resp *http.Response) (result DataSetMappingModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a DataSetMapping in a shareSubscription -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the shareSubscription. -// dataSetMappingName - the name of the dataSetMapping. -func (client DataSetMappingsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, dataSetMappingName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataSetMappingsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, shareSubscriptionName, dataSetMappingName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetMappingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "datashare.DataSetMappingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetMappingsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DataSetMappingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, dataSetMappingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "dataSetMappingName": autorest.Encode("path", dataSetMappingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/dataSetMappings/{dataSetMappingName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DataSetMappingsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DataSetMappingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a DataSetMapping in a shareSubscription -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the shareSubscription. -// dataSetMappingName - the name of the dataSetMapping. -func (client DataSetMappingsClient) Get(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, dataSetMappingName string) (result DataSetMappingModel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataSetMappingsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, shareSubscriptionName, dataSetMappingName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetMappingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.DataSetMappingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetMappingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DataSetMappingsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, dataSetMappingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "dataSetMappingName": autorest.Encode("path", dataSetMappingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/dataSetMappings/{dataSetMappingName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DataSetMappingsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DataSetMappingsClient) GetResponder(resp *http.Response) (result DataSetMappingModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByShareSubscription list DataSetMappings in a share subscription -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the share subscription. -// skipToken - continuation token -// filter - filters the results using OData syntax. -// orderby - sorts the results using OData syntax. -func (client DataSetMappingsClient) ListByShareSubscription(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, skipToken string, filter string, orderby string) (result DataSetMappingListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataSetMappingsClient.ListByShareSubscription") - defer func() { - sc := -1 - if result.dsml.Response.Response != nil { - sc = result.dsml.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByShareSubscriptionNextResults - req, err := client.ListByShareSubscriptionPreparer(ctx, resourceGroupName, accountName, shareSubscriptionName, skipToken, filter, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetMappingsClient", "ListByShareSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListByShareSubscriptionSender(req) - if err != nil { - result.dsml.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.DataSetMappingsClient", "ListByShareSubscription", resp, "Failure sending request") - return - } - - result.dsml, err = client.ListByShareSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetMappingsClient", "ListByShareSubscription", resp, "Failure responding to request") - return - } - if result.dsml.hasNextLink() && result.dsml.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByShareSubscriptionPreparer prepares the ListByShareSubscription request. -func (client DataSetMappingsClient) ListByShareSubscriptionPreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, skipToken string, filter string, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/dataSetMappings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByShareSubscriptionSender sends the ListByShareSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client DataSetMappingsClient) ListByShareSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByShareSubscriptionResponder handles the response to the ListByShareSubscription request. The method always -// closes the http.Response Body. -func (client DataSetMappingsClient) ListByShareSubscriptionResponder(resp *http.Response) (result DataSetMappingList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByShareSubscriptionNextResults retrieves the next set of results, if any. -func (client DataSetMappingsClient) listByShareSubscriptionNextResults(ctx context.Context, lastResults DataSetMappingList) (result DataSetMappingList, err error) { - req, err := lastResults.dataSetMappingListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.DataSetMappingsClient", "listByShareSubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByShareSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.DataSetMappingsClient", "listByShareSubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByShareSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetMappingsClient", "listByShareSubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByShareSubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client DataSetMappingsClient) ListByShareSubscriptionComplete(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, skipToken string, filter string, orderby string) (result DataSetMappingListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataSetMappingsClient.ListByShareSubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByShareSubscription(ctx, resourceGroupName, accountName, shareSubscriptionName, skipToken, filter, orderby) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/datasets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/datasets.go deleted file mode 100644 index 1acc7764caa7..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/datasets.go +++ /dev/null @@ -1,408 +0,0 @@ -package datashare - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DataSetsClient is the creates a Microsoft.DataShare management client. -type DataSetsClient struct { - BaseClient -} - -// NewDataSetsClient creates an instance of the DataSetsClient client. -func NewDataSetsClient(subscriptionID string) DataSetsClient { - return NewDataSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataSetsClientWithBaseURI creates an instance of the DataSetsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDataSetsClientWithBaseURI(baseURI string, subscriptionID string) DataSetsClient { - return DataSetsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a DataSet -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share to add the data set to. -// dataSetName - the name of the dataSet. -// dataSet - the new data set information. -func (client DataSetsClient) Create(ctx context.Context, resourceGroupName string, accountName string, shareName string, dataSetName string, dataSet BasicDataSet) (result DataSetModel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataSetsClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, shareName, dataSetName, dataSet) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.DataSetsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client DataSetsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, dataSetName string, dataSet BasicDataSet) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "dataSetName": autorest.Encode("path", dataSetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/dataSets/{dataSetName}", pathParameters), - autorest.WithJSON(dataSet), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client DataSetsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client DataSetsClient) CreateResponder(resp *http.Response) (result DataSetModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a DataSet in a share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// dataSetName - the name of the dataSet. -func (client DataSetsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, shareName string, dataSetName string) (result DataSetsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataSetsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, shareName, dataSetName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DataSetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, dataSetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "dataSetName": autorest.Encode("path", dataSetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/dataSets/{dataSetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DataSetsClient) DeleteSender(req *http.Request) (future DataSetsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DataSetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a DataSet in a share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// dataSetName - the name of the dataSet. -func (client DataSetsClient) Get(ctx context.Context, resourceGroupName string, accountName string, shareName string, dataSetName string) (result DataSetModel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataSetsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, shareName, dataSetName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.DataSetsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DataSetsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, dataSetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "dataSetName": autorest.Encode("path", dataSetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/dataSets/{dataSetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DataSetsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DataSetsClient) GetResponder(resp *http.Response) (result DataSetModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByShare list DataSets in a share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// skipToken - continuation token -// filter - filters the results using OData syntax. -// orderby - sorts the results using OData syntax. -func (client DataSetsClient) ListByShare(ctx context.Context, resourceGroupName string, accountName string, shareName string, skipToken string, filter string, orderby string) (result DataSetListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataSetsClient.ListByShare") - defer func() { - sc := -1 - if result.dsl.Response.Response != nil { - sc = result.dsl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByShareNextResults - req, err := client.ListBySharePreparer(ctx, resourceGroupName, accountName, shareName, skipToken, filter, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetsClient", "ListByShare", nil, "Failure preparing request") - return - } - - resp, err := client.ListByShareSender(req) - if err != nil { - result.dsl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.DataSetsClient", "ListByShare", resp, "Failure sending request") - return - } - - result.dsl, err = client.ListByShareResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetsClient", "ListByShare", resp, "Failure responding to request") - return - } - if result.dsl.hasNextLink() && result.dsl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySharePreparer prepares the ListByShare request. -func (client DataSetsClient) ListBySharePreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, skipToken string, filter string, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/dataSets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByShareSender sends the ListByShare request. The method will close the -// http.Response Body if it receives an error. -func (client DataSetsClient) ListByShareSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByShareResponder handles the response to the ListByShare request. The method always -// closes the http.Response Body. -func (client DataSetsClient) ListByShareResponder(resp *http.Response) (result DataSetList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByShareNextResults retrieves the next set of results, if any. -func (client DataSetsClient) listByShareNextResults(ctx context.Context, lastResults DataSetList) (result DataSetList, err error) { - req, err := lastResults.dataSetListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.DataSetsClient", "listByShareNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByShareSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.DataSetsClient", "listByShareNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByShareResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetsClient", "listByShareNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByShareComplete enumerates all values, automatically crossing page boundaries as required. -func (client DataSetsClient) ListByShareComplete(ctx context.Context, resourceGroupName string, accountName string, shareName string, skipToken string, filter string, orderby string) (result DataSetListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataSetsClient.ListByShare") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByShare(ctx, resourceGroupName, accountName, shareName, skipToken, filter, orderby) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/enums.go deleted file mode 100644 index 0a9707ae4194..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/enums.go +++ /dev/null @@ -1,345 +0,0 @@ -package datashare - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DataSetMappingStatus enumerates the values for data set mapping status. -type DataSetMappingStatus string - -const ( - // Broken ... - Broken DataSetMappingStatus = "Broken" - // Ok ... - Ok DataSetMappingStatus = "Ok" -) - -// PossibleDataSetMappingStatusValues returns an array of possible values for the DataSetMappingStatus const type. -func PossibleDataSetMappingStatusValues() []DataSetMappingStatus { - return []DataSetMappingStatus{Broken, Ok} -} - -// DataSetType enumerates the values for data set type. -type DataSetType string - -const ( - // AdlsGen1File ... - AdlsGen1File DataSetType = "AdlsGen1File" - // AdlsGen1Folder ... - AdlsGen1Folder DataSetType = "AdlsGen1Folder" - // AdlsGen2File ... - AdlsGen2File DataSetType = "AdlsGen2File" - // AdlsGen2FileSystem ... - AdlsGen2FileSystem DataSetType = "AdlsGen2FileSystem" - // AdlsGen2Folder ... - AdlsGen2Folder DataSetType = "AdlsGen2Folder" - // Blob ... - Blob DataSetType = "Blob" - // BlobFolder ... - BlobFolder DataSetType = "BlobFolder" - // Container ... - Container DataSetType = "Container" - // KustoCluster ... - KustoCluster DataSetType = "KustoCluster" - // KustoDatabase ... - KustoDatabase DataSetType = "KustoDatabase" - // SQLDBTable ... - SQLDBTable DataSetType = "SqlDBTable" - // SQLDWTable ... - SQLDWTable DataSetType = "SqlDWTable" -) - -// PossibleDataSetTypeValues returns an array of possible values for the DataSetType const type. -func PossibleDataSetTypeValues() []DataSetType { - return []DataSetType{AdlsGen1File, AdlsGen1Folder, AdlsGen2File, AdlsGen2FileSystem, AdlsGen2Folder, Blob, BlobFolder, Container, KustoCluster, KustoDatabase, SQLDBTable, SQLDWTable} -} - -// InvitationStatus enumerates the values for invitation status. -type InvitationStatus string - -const ( - // Accepted ... - Accepted InvitationStatus = "Accepted" - // Pending ... - Pending InvitationStatus = "Pending" - // Rejected ... - Rejected InvitationStatus = "Rejected" - // Withdrawn ... - Withdrawn InvitationStatus = "Withdrawn" -) - -// PossibleInvitationStatusValues returns an array of possible values for the InvitationStatus const type. -func PossibleInvitationStatusValues() []InvitationStatus { - return []InvitationStatus{Accepted, Pending, Rejected, Withdrawn} -} - -// Kind enumerates the values for kind. -type Kind string - -const ( - // KindAdlsGen1File ... - KindAdlsGen1File Kind = "AdlsGen1File" - // KindAdlsGen1Folder ... - KindAdlsGen1Folder Kind = "AdlsGen1Folder" - // KindAdlsGen2File ... - KindAdlsGen2File Kind = "AdlsGen2File" - // KindAdlsGen2FileSystem ... - KindAdlsGen2FileSystem Kind = "AdlsGen2FileSystem" - // KindAdlsGen2Folder ... - KindAdlsGen2Folder Kind = "AdlsGen2Folder" - // KindBlob ... - KindBlob Kind = "Blob" - // KindBlobFolder ... - KindBlobFolder Kind = "BlobFolder" - // KindContainer ... - KindContainer Kind = "Container" - // KindDataSet ... - KindDataSet Kind = "DataSet" - // KindKustoCluster ... - KindKustoCluster Kind = "KustoCluster" - // KindKustoDatabase ... - KindKustoDatabase Kind = "KustoDatabase" - // KindSQLDBTable ... - KindSQLDBTable Kind = "SqlDBTable" - // KindSQLDWTable ... - KindSQLDWTable Kind = "SqlDWTable" -) - -// PossibleKindValues returns an array of possible values for the Kind const type. -func PossibleKindValues() []Kind { - return []Kind{KindAdlsGen1File, KindAdlsGen1Folder, KindAdlsGen2File, KindAdlsGen2FileSystem, KindAdlsGen2Folder, KindBlob, KindBlobFolder, KindContainer, KindDataSet, KindKustoCluster, KindKustoDatabase, KindSQLDBTable, KindSQLDWTable} -} - -// KindBasicDataSetMapping enumerates the values for kind basic data set mapping. -type KindBasicDataSetMapping string - -const ( - // KindBasicDataSetMappingKindAdlsGen2File ... - KindBasicDataSetMappingKindAdlsGen2File KindBasicDataSetMapping = "AdlsGen2File" - // KindBasicDataSetMappingKindAdlsGen2FileSystem ... - KindBasicDataSetMappingKindAdlsGen2FileSystem KindBasicDataSetMapping = "AdlsGen2FileSystem" - // KindBasicDataSetMappingKindAdlsGen2Folder ... - KindBasicDataSetMappingKindAdlsGen2Folder KindBasicDataSetMapping = "AdlsGen2Folder" - // KindBasicDataSetMappingKindBlob ... - KindBasicDataSetMappingKindBlob KindBasicDataSetMapping = "Blob" - // KindBasicDataSetMappingKindBlobFolder ... - KindBasicDataSetMappingKindBlobFolder KindBasicDataSetMapping = "BlobFolder" - // KindBasicDataSetMappingKindContainer ... - KindBasicDataSetMappingKindContainer KindBasicDataSetMapping = "Container" - // KindBasicDataSetMappingKindDataSetMapping ... - KindBasicDataSetMappingKindDataSetMapping KindBasicDataSetMapping = "DataSetMapping" - // KindBasicDataSetMappingKindKustoCluster ... - KindBasicDataSetMappingKindKustoCluster KindBasicDataSetMapping = "KustoCluster" - // KindBasicDataSetMappingKindKustoDatabase ... - KindBasicDataSetMappingKindKustoDatabase KindBasicDataSetMapping = "KustoDatabase" - // KindBasicDataSetMappingKindSQLDBTable ... - KindBasicDataSetMappingKindSQLDBTable KindBasicDataSetMapping = "SqlDBTable" - // KindBasicDataSetMappingKindSQLDWTable ... - KindBasicDataSetMappingKindSQLDWTable KindBasicDataSetMapping = "SqlDWTable" -) - -// PossibleKindBasicDataSetMappingValues returns an array of possible values for the KindBasicDataSetMapping const type. -func PossibleKindBasicDataSetMappingValues() []KindBasicDataSetMapping { - return []KindBasicDataSetMapping{KindBasicDataSetMappingKindAdlsGen2File, KindBasicDataSetMappingKindAdlsGen2FileSystem, KindBasicDataSetMappingKindAdlsGen2Folder, KindBasicDataSetMappingKindBlob, KindBasicDataSetMappingKindBlobFolder, KindBasicDataSetMappingKindContainer, KindBasicDataSetMappingKindDataSetMapping, KindBasicDataSetMappingKindKustoCluster, KindBasicDataSetMappingKindKustoDatabase, KindBasicDataSetMappingKindSQLDBTable, KindBasicDataSetMappingKindSQLDWTable} -} - -// KindBasicSourceShareSynchronizationSetting enumerates the values for kind basic source share synchronization -// setting. -type KindBasicSourceShareSynchronizationSetting string - -const ( - // KindScheduleBased ... - KindScheduleBased KindBasicSourceShareSynchronizationSetting = "ScheduleBased" - // KindSourceShareSynchronizationSetting ... - KindSourceShareSynchronizationSetting KindBasicSourceShareSynchronizationSetting = "SourceShareSynchronizationSetting" -) - -// PossibleKindBasicSourceShareSynchronizationSettingValues returns an array of possible values for the KindBasicSourceShareSynchronizationSetting const type. -func PossibleKindBasicSourceShareSynchronizationSettingValues() []KindBasicSourceShareSynchronizationSetting { - return []KindBasicSourceShareSynchronizationSetting{KindScheduleBased, KindSourceShareSynchronizationSetting} -} - -// KindBasicSynchronizationSetting enumerates the values for kind basic synchronization setting. -type KindBasicSynchronizationSetting string - -const ( - // KindBasicSynchronizationSettingKindScheduleBased ... - KindBasicSynchronizationSettingKindScheduleBased KindBasicSynchronizationSetting = "ScheduleBased" - // KindBasicSynchronizationSettingKindSynchronizationSetting ... - KindBasicSynchronizationSettingKindSynchronizationSetting KindBasicSynchronizationSetting = "SynchronizationSetting" -) - -// PossibleKindBasicSynchronizationSettingValues returns an array of possible values for the KindBasicSynchronizationSetting const type. -func PossibleKindBasicSynchronizationSettingValues() []KindBasicSynchronizationSetting { - return []KindBasicSynchronizationSetting{KindBasicSynchronizationSettingKindScheduleBased, KindBasicSynchronizationSettingKindSynchronizationSetting} -} - -// KindBasicTrigger enumerates the values for kind basic trigger. -type KindBasicTrigger string - -const ( - // KindBasicTriggerKindScheduleBased ... - KindBasicTriggerKindScheduleBased KindBasicTrigger = "ScheduleBased" - // KindBasicTriggerKindTrigger ... - KindBasicTriggerKindTrigger KindBasicTrigger = "Trigger" -) - -// PossibleKindBasicTriggerValues returns an array of possible values for the KindBasicTrigger const type. -func PossibleKindBasicTriggerValues() []KindBasicTrigger { - return []KindBasicTrigger{KindBasicTriggerKindScheduleBased, KindBasicTriggerKindTrigger} -} - -// OutputType enumerates the values for output type. -type OutputType string - -const ( - // Csv ... - Csv OutputType = "Csv" - // Parquet ... - Parquet OutputType = "Parquet" -) - -// PossibleOutputTypeValues returns an array of possible values for the OutputType const type. -func PossibleOutputTypeValues() []OutputType { - return []OutputType{Csv, Parquet} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Creating ... - Creating ProvisioningState = "Creating" - // Deleting ... - Deleting ProvisioningState = "Deleting" - // Failed ... - Failed ProvisioningState = "Failed" - // Moving ... - Moving ProvisioningState = "Moving" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Creating, Deleting, Failed, Moving, Succeeded} -} - -// RecurrenceInterval enumerates the values for recurrence interval. -type RecurrenceInterval string - -const ( - // Day ... - Day RecurrenceInterval = "Day" - // Hour ... - Hour RecurrenceInterval = "Hour" -) - -// PossibleRecurrenceIntervalValues returns an array of possible values for the RecurrenceInterval const type. -func PossibleRecurrenceIntervalValues() []RecurrenceInterval { - return []RecurrenceInterval{Day, Hour} -} - -// ShareKind enumerates the values for share kind. -type ShareKind string - -const ( - // CopyBased ... - CopyBased ShareKind = "CopyBased" - // InPlace ... - InPlace ShareKind = "InPlace" -) - -// PossibleShareKindValues returns an array of possible values for the ShareKind const type. -func PossibleShareKindValues() []ShareKind { - return []ShareKind{CopyBased, InPlace} -} - -// ShareSubscriptionStatus enumerates the values for share subscription status. -type ShareSubscriptionStatus string - -const ( - // Active ... - Active ShareSubscriptionStatus = "Active" - // Revoked ... - Revoked ShareSubscriptionStatus = "Revoked" - // Revoking ... - Revoking ShareSubscriptionStatus = "Revoking" - // SourceDeleted ... - SourceDeleted ShareSubscriptionStatus = "SourceDeleted" -) - -// PossibleShareSubscriptionStatusValues returns an array of possible values for the ShareSubscriptionStatus const type. -func PossibleShareSubscriptionStatusValues() []ShareSubscriptionStatus { - return []ShareSubscriptionStatus{Active, Revoked, Revoking, SourceDeleted} -} - -// Status enumerates the values for status. -type Status string - -const ( - // StatusAccepted ... - StatusAccepted Status = "Accepted" - // StatusCanceled ... - StatusCanceled Status = "Canceled" - // StatusFailed ... - StatusFailed Status = "Failed" - // StatusInProgress ... - StatusInProgress Status = "InProgress" - // StatusSucceeded ... - StatusSucceeded Status = "Succeeded" - // StatusTransientFailure ... - StatusTransientFailure Status = "TransientFailure" -) - -// PossibleStatusValues returns an array of possible values for the Status const type. -func PossibleStatusValues() []Status { - return []Status{StatusAccepted, StatusCanceled, StatusFailed, StatusInProgress, StatusSucceeded, StatusTransientFailure} -} - -// SynchronizationMode enumerates the values for synchronization mode. -type SynchronizationMode string - -const ( - // FullSync ... - FullSync SynchronizationMode = "FullSync" - // Incremental ... - Incremental SynchronizationMode = "Incremental" -) - -// PossibleSynchronizationModeValues returns an array of possible values for the SynchronizationMode const type. -func PossibleSynchronizationModeValues() []SynchronizationMode { - return []SynchronizationMode{FullSync, Incremental} -} - -// TriggerStatus enumerates the values for trigger status. -type TriggerStatus string - -const ( - // TriggerStatusActive ... - TriggerStatusActive TriggerStatus = "Active" - // TriggerStatusInactive ... - TriggerStatusInactive TriggerStatus = "Inactive" - // TriggerStatusSourceSynchronizationSettingDeleted ... - TriggerStatusSourceSynchronizationSettingDeleted TriggerStatus = "SourceSynchronizationSettingDeleted" -) - -// PossibleTriggerStatusValues returns an array of possible values for the TriggerStatus const type. -func PossibleTriggerStatusValues() []TriggerStatus { - return []TriggerStatus{TriggerStatusActive, TriggerStatusInactive, TriggerStatusSourceSynchronizationSettingDeleted} -} - -// Type enumerates the values for type. -type Type string - -const ( - // SystemAssigned ... - SystemAssigned Type = "SystemAssigned" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{SystemAssigned} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/invitations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/invitations.go deleted file mode 100644 index 5cac13560c44..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/invitations.go +++ /dev/null @@ -1,405 +0,0 @@ -package datashare - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// InvitationsClient is the creates a Microsoft.DataShare management client. -type InvitationsClient struct { - BaseClient -} - -// NewInvitationsClient creates an instance of the InvitationsClient client. -func NewInvitationsClient(subscriptionID string) InvitationsClient { - return NewInvitationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewInvitationsClientWithBaseURI creates an instance of the InvitationsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewInvitationsClientWithBaseURI(baseURI string, subscriptionID string) InvitationsClient { - return InvitationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create an invitation -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share to send the invitation for. -// invitationName - the name of the invitation. -// invitation - invitation details. -func (client InvitationsClient) Create(ctx context.Context, resourceGroupName string, accountName string, shareName string, invitationName string, invitation Invitation) (result Invitation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvitationsClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, shareName, invitationName, invitation) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.InvitationsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.InvitationsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.InvitationsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client InvitationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, invitationName string, invitation Invitation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "invitationName": autorest.Encode("path", invitationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/invitations/{invitationName}", pathParameters), - autorest.WithJSON(invitation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client InvitationsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client InvitationsClient) CreateResponder(resp *http.Response) (result Invitation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an invitation in a share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// invitationName - the name of the invitation. -func (client InvitationsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, shareName string, invitationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvitationsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, shareName, invitationName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.InvitationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "datashare.InvitationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.InvitationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client InvitationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, invitationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "invitationName": autorest.Encode("path", invitationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/invitations/{invitationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client InvitationsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client InvitationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an invitation in a share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// invitationName - the name of the invitation. -func (client InvitationsClient) Get(ctx context.Context, resourceGroupName string, accountName string, shareName string, invitationName string) (result Invitation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvitationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, shareName, invitationName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.InvitationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.InvitationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.InvitationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client InvitationsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, invitationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "invitationName": autorest.Encode("path", invitationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/invitations/{invitationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client InvitationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client InvitationsClient) GetResponder(resp *http.Response) (result Invitation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByShare list invitations in a share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// skipToken - the continuation token -// filter - filters the results using OData syntax. -// orderby - sorts the results using OData syntax. -func (client InvitationsClient) ListByShare(ctx context.Context, resourceGroupName string, accountName string, shareName string, skipToken string, filter string, orderby string) (result InvitationListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvitationsClient.ListByShare") - defer func() { - sc := -1 - if result.il.Response.Response != nil { - sc = result.il.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByShareNextResults - req, err := client.ListBySharePreparer(ctx, resourceGroupName, accountName, shareName, skipToken, filter, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.InvitationsClient", "ListByShare", nil, "Failure preparing request") - return - } - - resp, err := client.ListByShareSender(req) - if err != nil { - result.il.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.InvitationsClient", "ListByShare", resp, "Failure sending request") - return - } - - result.il, err = client.ListByShareResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.InvitationsClient", "ListByShare", resp, "Failure responding to request") - return - } - if result.il.hasNextLink() && result.il.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySharePreparer prepares the ListByShare request. -func (client InvitationsClient) ListBySharePreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, skipToken string, filter string, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/invitations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByShareSender sends the ListByShare request. The method will close the -// http.Response Body if it receives an error. -func (client InvitationsClient) ListByShareSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByShareResponder handles the response to the ListByShare request. The method always -// closes the http.Response Body. -func (client InvitationsClient) ListByShareResponder(resp *http.Response) (result InvitationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByShareNextResults retrieves the next set of results, if any. -func (client InvitationsClient) listByShareNextResults(ctx context.Context, lastResults InvitationList) (result InvitationList, err error) { - req, err := lastResults.invitationListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.InvitationsClient", "listByShareNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByShareSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.InvitationsClient", "listByShareNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByShareResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.InvitationsClient", "listByShareNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByShareComplete enumerates all values, automatically crossing page boundaries as required. -func (client InvitationsClient) ListByShareComplete(ctx context.Context, resourceGroupName string, accountName string, shareName string, skipToken string, filter string, orderby string) (result InvitationListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvitationsClient.ListByShare") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByShare(ctx, resourceGroupName, accountName, shareName, skipToken, filter, orderby) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/models.go deleted file mode 100644 index 75e2d6924043..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/models.go +++ /dev/null @@ -1,9503 +0,0 @@ -package datashare - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare" - -// Account an account data transfer object. -type Account struct { - autorest.Response `json:"-"` - // Identity - Identity Info on the Account - Identity *Identity `json:"identity,omitempty"` - // AccountProperties - Properties on the account - *AccountProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Location - Location of the azure resource. - Location *string `json:"location,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Tags - Tags on the azure resource. - Tags map[string]*string `json:"tags"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Account. -func (a Account) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.Identity != nil { - objectMap["identity"] = a.Identity - } - if a.AccountProperties != nil { - objectMap["properties"] = a.AccountProperties - } - if a.Location != nil { - objectMap["location"] = a.Location - } - if a.Tags != nil { - objectMap["tags"] = a.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Account struct. -func (a *Account) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "identity": - if v != nil { - var identity Identity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - a.Identity = &identity - } - case "properties": - if v != nil { - var accountProperties AccountProperties - err = json.Unmarshal(*v, &accountProperties) - if err != nil { - return err - } - a.AccountProperties = &accountProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - a.Location = &location - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - a.Tags = tags - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - } - } - - return nil -} - -// AccountList list response for get Accounts. -type AccountList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]Account `json:"value,omitempty"` -} - -// AccountListIterator provides access to a complete listing of Account values. -type AccountListIterator struct { - i int - page AccountListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AccountListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AccountListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AccountListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AccountListIterator) Response() AccountList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AccountListIterator) Value() Account { - if !iter.page.NotDone() { - return Account{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AccountListIterator type. -func NewAccountListIterator(page AccountListPage) AccountListIterator { - return AccountListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (al AccountList) IsEmpty() bool { - return al.Value == nil || len(*al.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (al AccountList) hasNextLink() bool { - return al.NextLink != nil && len(*al.NextLink) != 0 -} - -// accountListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (al AccountList) accountListPreparer(ctx context.Context) (*http.Request, error) { - if !al.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(al.NextLink))) -} - -// AccountListPage contains a page of Account values. -type AccountListPage struct { - fn func(context.Context, AccountList) (AccountList, error) - al AccountList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AccountListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.al) - if err != nil { - return err - } - page.al = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AccountListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AccountListPage) NotDone() bool { - return !page.al.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AccountListPage) Response() AccountList { - return page.al -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AccountListPage) Values() []Account { - if page.al.IsEmpty() { - return nil - } - return *page.al.Value -} - -// Creates a new instance of the AccountListPage type. -func NewAccountListPage(cur AccountList, getNextPage func(context.Context, AccountList) (AccountList, error)) AccountListPage { - return AccountListPage{ - fn: getNextPage, - al: cur, - } -} - -// AccountProperties account property bag. -type AccountProperties struct { - // CreatedAt - READ-ONLY; Time at which the account was created. - CreatedAt *date.Time `json:"createdAt,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the Account. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // UserEmail - READ-ONLY; Email of the user who created the resource - UserEmail *string `json:"userEmail,omitempty"` - // UserName - READ-ONLY; Name of the user who created the resource - UserName *string `json:"userName,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountProperties. -func (ap AccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AccountsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountsClient) (Account, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountsCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountsCreateFuture.Result. -func (future *AccountsCreateFuture) result(client AccountsClient) (a Account, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - a.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datashare.AccountsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { - a, err = client.CreateResponder(a.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsCreateFuture", "Result", a.Response.Response, "Failure responding to request") - } - } - return -} - -// AccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountsClient) (OperationResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountsDeleteFuture.Result. -func (future *AccountsDeleteFuture) result(client AccountsClient) (or OperationResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - or.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datashare.AccountsDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if or.Response.Response, err = future.GetResult(sender); err == nil && or.Response.Response.StatusCode != http.StatusNoContent { - or, err = client.DeleteResponder(or.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.AccountsDeleteFuture", "Result", or.Response.Response, "Failure responding to request") - } - } - return -} - -// AccountUpdateParameters update parameters for accounts -type AccountUpdateParameters struct { - // Tags - Tags on the azure resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AccountUpdateParameters. -func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aup.Tags != nil { - objectMap["tags"] = aup.Tags - } - return json.Marshal(objectMap) -} - -// ADLSGen1FileDataSet an ADLS Gen 1 file data set. -type ADLSGen1FileDataSet struct { - // ADLSGen1FileProperties - ADLS Gen 1 file data set properties. - *ADLSGen1FileProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` - // Kind - Possible values include: 'KindDataSet', 'KindAdlsGen1File', 'KindAdlsGen1Folder', 'KindAdlsGen2File', 'KindAdlsGen2FileSystem', 'KindAdlsGen2Folder', 'KindContainer', 'KindBlob', 'KindBlobFolder', 'KindKustoCluster', 'KindKustoDatabase', 'KindSQLDBTable', 'KindSQLDWTable' - Kind Kind `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen1FileDataSet. -func (ag1fds ADLSGen1FileDataSet) MarshalJSON() ([]byte, error) { - ag1fds.Kind = KindAdlsGen1File - objectMap := make(map[string]interface{}) - if ag1fds.ADLSGen1FileProperties != nil { - objectMap["properties"] = ag1fds.ADLSGen1FileProperties - } - if ag1fds.Kind != "" { - objectMap["kind"] = ag1fds.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen1FileDataSet is the BasicDataSet implementation for ADLSGen1FileDataSet. -func (ag1fds ADLSGen1FileDataSet) AsADLSGen1FileDataSet() (*ADLSGen1FileDataSet, bool) { - return &ag1fds, true -} - -// AsADLSGen1FolderDataSet is the BasicDataSet implementation for ADLSGen1FileDataSet. -func (ag1fds ADLSGen1FileDataSet) AsADLSGen1FolderDataSet() (*ADLSGen1FolderDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileDataSet is the BasicDataSet implementation for ADLSGen1FileDataSet. -func (ag1fds ADLSGen1FileDataSet) AsADLSGen2FileDataSet() (*ADLSGen2FileDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSet is the BasicDataSet implementation for ADLSGen1FileDataSet. -func (ag1fds ADLSGen1FileDataSet) AsADLSGen2FileSystemDataSet() (*ADLSGen2FileSystemDataSet, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSet is the BasicDataSet implementation for ADLSGen1FileDataSet. -func (ag1fds ADLSGen1FileDataSet) AsADLSGen2FolderDataSet() (*ADLSGen2FolderDataSet, bool) { - return nil, false -} - -// AsBlobContainerDataSet is the BasicDataSet implementation for ADLSGen1FileDataSet. -func (ag1fds ADLSGen1FileDataSet) AsBlobContainerDataSet() (*BlobContainerDataSet, bool) { - return nil, false -} - -// AsBlobDataSet is the BasicDataSet implementation for ADLSGen1FileDataSet. -func (ag1fds ADLSGen1FileDataSet) AsBlobDataSet() (*BlobDataSet, bool) { - return nil, false -} - -// AsBlobFolderDataSet is the BasicDataSet implementation for ADLSGen1FileDataSet. -func (ag1fds ADLSGen1FileDataSet) AsBlobFolderDataSet() (*BlobFolderDataSet, bool) { - return nil, false -} - -// AsKustoClusterDataSet is the BasicDataSet implementation for ADLSGen1FileDataSet. -func (ag1fds ADLSGen1FileDataSet) AsKustoClusterDataSet() (*KustoClusterDataSet, bool) { - return nil, false -} - -// AsKustoDatabaseDataSet is the BasicDataSet implementation for ADLSGen1FileDataSet. -func (ag1fds ADLSGen1FileDataSet) AsKustoDatabaseDataSet() (*KustoDatabaseDataSet, bool) { - return nil, false -} - -// AsSQLDBTableDataSet is the BasicDataSet implementation for ADLSGen1FileDataSet. -func (ag1fds ADLSGen1FileDataSet) AsSQLDBTableDataSet() (*SQLDBTableDataSet, bool) { - return nil, false -} - -// AsSQLDWTableDataSet is the BasicDataSet implementation for ADLSGen1FileDataSet. -func (ag1fds ADLSGen1FileDataSet) AsSQLDWTableDataSet() (*SQLDWTableDataSet, bool) { - return nil, false -} - -// AsDataSet is the BasicDataSet implementation for ADLSGen1FileDataSet. -func (ag1fds ADLSGen1FileDataSet) AsDataSet() (*DataSet, bool) { - return nil, false -} - -// AsBasicDataSet is the BasicDataSet implementation for ADLSGen1FileDataSet. -func (ag1fds ADLSGen1FileDataSet) AsBasicDataSet() (BasicDataSet, bool) { - return &ag1fds, true -} - -// UnmarshalJSON is the custom unmarshaler for ADLSGen1FileDataSet struct. -func (ag1fds *ADLSGen1FileDataSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var aDLSGen1FileProperties ADLSGen1FileProperties - err = json.Unmarshal(*v, &aDLSGen1FileProperties) - if err != nil { - return err - } - ag1fds.ADLSGen1FileProperties = &aDLSGen1FileProperties - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ag1fds.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ag1fds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ag1fds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ag1fds.Type = &typeVar - } - } - } - - return nil -} - -// ADLSGen1FileProperties properties of the ADLS Gen1 file data set. -type ADLSGen1FileProperties struct { - // AccountName - The ADLS account name. - AccountName *string `json:"accountName,omitempty"` - // DataSetID - READ-ONLY; Unique id for identifying a data set resource - DataSetID *string `json:"dataSetId,omitempty"` - // FileName - The file name in the ADLS account. - FileName *string `json:"fileName,omitempty"` - // FolderPath - The folder path within the ADLS account. - FolderPath *string `json:"folderPath,omitempty"` - // ResourceGroup - Resource group of ADLS account. - ResourceGroup *string `json:"resourceGroup,omitempty"` - // SubscriptionID - Subscription id of ADLS account. - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen1FileProperties. -func (ag1fp ADLSGen1FileProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ag1fp.AccountName != nil { - objectMap["accountName"] = ag1fp.AccountName - } - if ag1fp.FileName != nil { - objectMap["fileName"] = ag1fp.FileName - } - if ag1fp.FolderPath != nil { - objectMap["folderPath"] = ag1fp.FolderPath - } - if ag1fp.ResourceGroup != nil { - objectMap["resourceGroup"] = ag1fp.ResourceGroup - } - if ag1fp.SubscriptionID != nil { - objectMap["subscriptionId"] = ag1fp.SubscriptionID - } - return json.Marshal(objectMap) -} - -// ADLSGen1FolderDataSet an ADLS Gen 1 folder data set. -type ADLSGen1FolderDataSet struct { - // ADLSGen1FolderProperties - ADLS Gen 1 folder data set properties. - *ADLSGen1FolderProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindDataSet', 'KindAdlsGen1File', 'KindAdlsGen1Folder', 'KindAdlsGen2File', 'KindAdlsGen2FileSystem', 'KindAdlsGen2Folder', 'KindContainer', 'KindBlob', 'KindBlobFolder', 'KindKustoCluster', 'KindKustoDatabase', 'KindSQLDBTable', 'KindSQLDWTable' - Kind Kind `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen1FolderDataSet. -func (ag1fds ADLSGen1FolderDataSet) MarshalJSON() ([]byte, error) { - ag1fds.Kind = KindAdlsGen1Folder - objectMap := make(map[string]interface{}) - if ag1fds.ADLSGen1FolderProperties != nil { - objectMap["properties"] = ag1fds.ADLSGen1FolderProperties - } - if ag1fds.Kind != "" { - objectMap["kind"] = ag1fds.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen1FileDataSet is the BasicDataSet implementation for ADLSGen1FolderDataSet. -func (ag1fds ADLSGen1FolderDataSet) AsADLSGen1FileDataSet() (*ADLSGen1FileDataSet, bool) { - return nil, false -} - -// AsADLSGen1FolderDataSet is the BasicDataSet implementation for ADLSGen1FolderDataSet. -func (ag1fds ADLSGen1FolderDataSet) AsADLSGen1FolderDataSet() (*ADLSGen1FolderDataSet, bool) { - return &ag1fds, true -} - -// AsADLSGen2FileDataSet is the BasicDataSet implementation for ADLSGen1FolderDataSet. -func (ag1fds ADLSGen1FolderDataSet) AsADLSGen2FileDataSet() (*ADLSGen2FileDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSet is the BasicDataSet implementation for ADLSGen1FolderDataSet. -func (ag1fds ADLSGen1FolderDataSet) AsADLSGen2FileSystemDataSet() (*ADLSGen2FileSystemDataSet, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSet is the BasicDataSet implementation for ADLSGen1FolderDataSet. -func (ag1fds ADLSGen1FolderDataSet) AsADLSGen2FolderDataSet() (*ADLSGen2FolderDataSet, bool) { - return nil, false -} - -// AsBlobContainerDataSet is the BasicDataSet implementation for ADLSGen1FolderDataSet. -func (ag1fds ADLSGen1FolderDataSet) AsBlobContainerDataSet() (*BlobContainerDataSet, bool) { - return nil, false -} - -// AsBlobDataSet is the BasicDataSet implementation for ADLSGen1FolderDataSet. -func (ag1fds ADLSGen1FolderDataSet) AsBlobDataSet() (*BlobDataSet, bool) { - return nil, false -} - -// AsBlobFolderDataSet is the BasicDataSet implementation for ADLSGen1FolderDataSet. -func (ag1fds ADLSGen1FolderDataSet) AsBlobFolderDataSet() (*BlobFolderDataSet, bool) { - return nil, false -} - -// AsKustoClusterDataSet is the BasicDataSet implementation for ADLSGen1FolderDataSet. -func (ag1fds ADLSGen1FolderDataSet) AsKustoClusterDataSet() (*KustoClusterDataSet, bool) { - return nil, false -} - -// AsKustoDatabaseDataSet is the BasicDataSet implementation for ADLSGen1FolderDataSet. -func (ag1fds ADLSGen1FolderDataSet) AsKustoDatabaseDataSet() (*KustoDatabaseDataSet, bool) { - return nil, false -} - -// AsSQLDBTableDataSet is the BasicDataSet implementation for ADLSGen1FolderDataSet. -func (ag1fds ADLSGen1FolderDataSet) AsSQLDBTableDataSet() (*SQLDBTableDataSet, bool) { - return nil, false -} - -// AsSQLDWTableDataSet is the BasicDataSet implementation for ADLSGen1FolderDataSet. -func (ag1fds ADLSGen1FolderDataSet) AsSQLDWTableDataSet() (*SQLDWTableDataSet, bool) { - return nil, false -} - -// AsDataSet is the BasicDataSet implementation for ADLSGen1FolderDataSet. -func (ag1fds ADLSGen1FolderDataSet) AsDataSet() (*DataSet, bool) { - return nil, false -} - -// AsBasicDataSet is the BasicDataSet implementation for ADLSGen1FolderDataSet. -func (ag1fds ADLSGen1FolderDataSet) AsBasicDataSet() (BasicDataSet, bool) { - return &ag1fds, true -} - -// UnmarshalJSON is the custom unmarshaler for ADLSGen1FolderDataSet struct. -func (ag1fds *ADLSGen1FolderDataSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var aDLSGen1FolderProperties ADLSGen1FolderProperties - err = json.Unmarshal(*v, &aDLSGen1FolderProperties) - if err != nil { - return err - } - ag1fds.ADLSGen1FolderProperties = &aDLSGen1FolderProperties - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ag1fds.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ag1fds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ag1fds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ag1fds.Type = &typeVar - } - } - } - - return nil -} - -// ADLSGen1FolderProperties properties of the ADLS Gen1 folder data set. -type ADLSGen1FolderProperties struct { - // AccountName - The ADLS account name. - AccountName *string `json:"accountName,omitempty"` - // DataSetID - READ-ONLY; Unique id for identifying a data set resource - DataSetID *string `json:"dataSetId,omitempty"` - // FolderPath - The folder path within the ADLS account. - FolderPath *string `json:"folderPath,omitempty"` - // ResourceGroup - Resource group of ADLS account. - ResourceGroup *string `json:"resourceGroup,omitempty"` - // SubscriptionID - Subscription id of ADLS account. - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen1FolderProperties. -func (ag1fp ADLSGen1FolderProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ag1fp.AccountName != nil { - objectMap["accountName"] = ag1fp.AccountName - } - if ag1fp.FolderPath != nil { - objectMap["folderPath"] = ag1fp.FolderPath - } - if ag1fp.ResourceGroup != nil { - objectMap["resourceGroup"] = ag1fp.ResourceGroup - } - if ag1fp.SubscriptionID != nil { - objectMap["subscriptionId"] = ag1fp.SubscriptionID - } - return json.Marshal(objectMap) -} - -// ADLSGen2FileDataSet an ADLS Gen 2 file data set. -type ADLSGen2FileDataSet struct { - // ADLSGen2FileProperties - ADLS Gen 2 file data set properties. - *ADLSGen2FileProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindDataSet', 'KindAdlsGen1File', 'KindAdlsGen1Folder', 'KindAdlsGen2File', 'KindAdlsGen2FileSystem', 'KindAdlsGen2Folder', 'KindContainer', 'KindBlob', 'KindBlobFolder', 'KindKustoCluster', 'KindKustoDatabase', 'KindSQLDBTable', 'KindSQLDWTable' - Kind Kind `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen2FileDataSet. -func (ag2fds ADLSGen2FileDataSet) MarshalJSON() ([]byte, error) { - ag2fds.Kind = KindAdlsGen2File - objectMap := make(map[string]interface{}) - if ag2fds.ADLSGen2FileProperties != nil { - objectMap["properties"] = ag2fds.ADLSGen2FileProperties - } - if ag2fds.Kind != "" { - objectMap["kind"] = ag2fds.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen1FileDataSet is the BasicDataSet implementation for ADLSGen2FileDataSet. -func (ag2fds ADLSGen2FileDataSet) AsADLSGen1FileDataSet() (*ADLSGen1FileDataSet, bool) { - return nil, false -} - -// AsADLSGen1FolderDataSet is the BasicDataSet implementation for ADLSGen2FileDataSet. -func (ag2fds ADLSGen2FileDataSet) AsADLSGen1FolderDataSet() (*ADLSGen1FolderDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileDataSet is the BasicDataSet implementation for ADLSGen2FileDataSet. -func (ag2fds ADLSGen2FileDataSet) AsADLSGen2FileDataSet() (*ADLSGen2FileDataSet, bool) { - return &ag2fds, true -} - -// AsADLSGen2FileSystemDataSet is the BasicDataSet implementation for ADLSGen2FileDataSet. -func (ag2fds ADLSGen2FileDataSet) AsADLSGen2FileSystemDataSet() (*ADLSGen2FileSystemDataSet, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSet is the BasicDataSet implementation for ADLSGen2FileDataSet. -func (ag2fds ADLSGen2FileDataSet) AsADLSGen2FolderDataSet() (*ADLSGen2FolderDataSet, bool) { - return nil, false -} - -// AsBlobContainerDataSet is the BasicDataSet implementation for ADLSGen2FileDataSet. -func (ag2fds ADLSGen2FileDataSet) AsBlobContainerDataSet() (*BlobContainerDataSet, bool) { - return nil, false -} - -// AsBlobDataSet is the BasicDataSet implementation for ADLSGen2FileDataSet. -func (ag2fds ADLSGen2FileDataSet) AsBlobDataSet() (*BlobDataSet, bool) { - return nil, false -} - -// AsBlobFolderDataSet is the BasicDataSet implementation for ADLSGen2FileDataSet. -func (ag2fds ADLSGen2FileDataSet) AsBlobFolderDataSet() (*BlobFolderDataSet, bool) { - return nil, false -} - -// AsKustoClusterDataSet is the BasicDataSet implementation for ADLSGen2FileDataSet. -func (ag2fds ADLSGen2FileDataSet) AsKustoClusterDataSet() (*KustoClusterDataSet, bool) { - return nil, false -} - -// AsKustoDatabaseDataSet is the BasicDataSet implementation for ADLSGen2FileDataSet. -func (ag2fds ADLSGen2FileDataSet) AsKustoDatabaseDataSet() (*KustoDatabaseDataSet, bool) { - return nil, false -} - -// AsSQLDBTableDataSet is the BasicDataSet implementation for ADLSGen2FileDataSet. -func (ag2fds ADLSGen2FileDataSet) AsSQLDBTableDataSet() (*SQLDBTableDataSet, bool) { - return nil, false -} - -// AsSQLDWTableDataSet is the BasicDataSet implementation for ADLSGen2FileDataSet. -func (ag2fds ADLSGen2FileDataSet) AsSQLDWTableDataSet() (*SQLDWTableDataSet, bool) { - return nil, false -} - -// AsDataSet is the BasicDataSet implementation for ADLSGen2FileDataSet. -func (ag2fds ADLSGen2FileDataSet) AsDataSet() (*DataSet, bool) { - return nil, false -} - -// AsBasicDataSet is the BasicDataSet implementation for ADLSGen2FileDataSet. -func (ag2fds ADLSGen2FileDataSet) AsBasicDataSet() (BasicDataSet, bool) { - return &ag2fds, true -} - -// UnmarshalJSON is the custom unmarshaler for ADLSGen2FileDataSet struct. -func (ag2fds *ADLSGen2FileDataSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var aDLSGen2FileProperties ADLSGen2FileProperties - err = json.Unmarshal(*v, &aDLSGen2FileProperties) - if err != nil { - return err - } - ag2fds.ADLSGen2FileProperties = &aDLSGen2FileProperties - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ag2fds.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ag2fds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ag2fds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ag2fds.Type = &typeVar - } - } - } - - return nil -} - -// ADLSGen2FileDataSetMapping an ADLS Gen2 file data set mapping. -type ADLSGen2FileDataSetMapping struct { - // ADLSGen2FileDataSetMappingProperties - ADLS Gen2 file data set mapping properties. - *ADLSGen2FileDataSetMappingProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` - // Kind - Possible values include: 'KindBasicDataSetMappingKindDataSetMapping', 'KindBasicDataSetMappingKindAdlsGen2File', 'KindBasicDataSetMappingKindAdlsGen2FileSystem', 'KindBasicDataSetMappingKindAdlsGen2Folder', 'KindBasicDataSetMappingKindContainer', 'KindBasicDataSetMappingKindBlob', 'KindBasicDataSetMappingKindBlobFolder', 'KindBasicDataSetMappingKindKustoCluster', 'KindBasicDataSetMappingKindKustoDatabase', 'KindBasicDataSetMappingKindSQLDBTable', 'KindBasicDataSetMappingKindSQLDWTable' - Kind KindBasicDataSetMapping `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen2FileDataSetMapping. -func (ag2fdsm ADLSGen2FileDataSetMapping) MarshalJSON() ([]byte, error) { - ag2fdsm.Kind = KindBasicDataSetMappingKindAdlsGen2File - objectMap := make(map[string]interface{}) - if ag2fdsm.ADLSGen2FileDataSetMappingProperties != nil { - objectMap["properties"] = ag2fdsm.ADLSGen2FileDataSetMappingProperties - } - if ag2fdsm.Kind != "" { - objectMap["kind"] = ag2fdsm.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen2FileDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileDataSetMapping. -func (ag2fdsm ADLSGen2FileDataSetMapping) AsADLSGen2FileDataSetMapping() (*ADLSGen2FileDataSetMapping, bool) { - return &ag2fdsm, true -} - -// AsADLSGen2FileSystemDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileDataSetMapping. -func (ag2fdsm ADLSGen2FileDataSetMapping) AsADLSGen2FileSystemDataSetMapping() (*ADLSGen2FileSystemDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileDataSetMapping. -func (ag2fdsm ADLSGen2FileDataSetMapping) AsADLSGen2FolderDataSetMapping() (*ADLSGen2FolderDataSetMapping, bool) { - return nil, false -} - -// AsBlobContainerDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileDataSetMapping. -func (ag2fdsm ADLSGen2FileDataSetMapping) AsBlobContainerDataSetMapping() (*BlobContainerDataSetMapping, bool) { - return nil, false -} - -// AsBlobDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileDataSetMapping. -func (ag2fdsm ADLSGen2FileDataSetMapping) AsBlobDataSetMapping() (*BlobDataSetMapping, bool) { - return nil, false -} - -// AsBlobFolderDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileDataSetMapping. -func (ag2fdsm ADLSGen2FileDataSetMapping) AsBlobFolderDataSetMapping() (*BlobFolderDataSetMapping, bool) { - return nil, false -} - -// AsKustoClusterDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileDataSetMapping. -func (ag2fdsm ADLSGen2FileDataSetMapping) AsKustoClusterDataSetMapping() (*KustoClusterDataSetMapping, bool) { - return nil, false -} - -// AsKustoDatabaseDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileDataSetMapping. -func (ag2fdsm ADLSGen2FileDataSetMapping) AsKustoDatabaseDataSetMapping() (*KustoDatabaseDataSetMapping, bool) { - return nil, false -} - -// AsSQLDBTableDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileDataSetMapping. -func (ag2fdsm ADLSGen2FileDataSetMapping) AsSQLDBTableDataSetMapping() (*SQLDBTableDataSetMapping, bool) { - return nil, false -} - -// AsSQLDWTableDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileDataSetMapping. -func (ag2fdsm ADLSGen2FileDataSetMapping) AsSQLDWTableDataSetMapping() (*SQLDWTableDataSetMapping, bool) { - return nil, false -} - -// AsDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileDataSetMapping. -func (ag2fdsm ADLSGen2FileDataSetMapping) AsDataSetMapping() (*DataSetMapping, bool) { - return nil, false -} - -// AsBasicDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileDataSetMapping. -func (ag2fdsm ADLSGen2FileDataSetMapping) AsBasicDataSetMapping() (BasicDataSetMapping, bool) { - return &ag2fdsm, true -} - -// UnmarshalJSON is the custom unmarshaler for ADLSGen2FileDataSetMapping struct. -func (ag2fdsm *ADLSGen2FileDataSetMapping) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var aDLSGen2FileDataSetMappingProperties ADLSGen2FileDataSetMappingProperties - err = json.Unmarshal(*v, &aDLSGen2FileDataSetMappingProperties) - if err != nil { - return err - } - ag2fdsm.ADLSGen2FileDataSetMappingProperties = &aDLSGen2FileDataSetMappingProperties - } - case "kind": - if v != nil { - var kind KindBasicDataSetMapping - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ag2fdsm.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ag2fdsm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ag2fdsm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ag2fdsm.Type = &typeVar - } - } - } - - return nil -} - -// ADLSGen2FileDataSetMappingProperties ADLS Gen 2 file data set mapping property bag. -type ADLSGen2FileDataSetMappingProperties struct { - // DataSetID - The id of the source data set. - DataSetID *string `json:"dataSetId,omitempty"` - // DataSetMappingStatus - READ-ONLY; Gets the status of the data set mapping. Possible values include: 'Ok', 'Broken' - DataSetMappingStatus DataSetMappingStatus `json:"dataSetMappingStatus,omitempty"` - // FilePath - File path within the file system. - FilePath *string `json:"filePath,omitempty"` - // FileSystem - File system to which the file belongs. - FileSystem *string `json:"fileSystem,omitempty"` - // OutputType - Type of output file. Possible values include: 'Csv', 'Parquet' - OutputType OutputType `json:"outputType,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the data set mapping. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ResourceGroup - Resource group of storage account. - ResourceGroup *string `json:"resourceGroup,omitempty"` - // StorageAccountName - Storage account name of the source data set. - StorageAccountName *string `json:"storageAccountName,omitempty"` - // SubscriptionID - Subscription id of storage account. - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen2FileDataSetMappingProperties. -func (ag2fdsmp ADLSGen2FileDataSetMappingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ag2fdsmp.DataSetID != nil { - objectMap["dataSetId"] = ag2fdsmp.DataSetID - } - if ag2fdsmp.FilePath != nil { - objectMap["filePath"] = ag2fdsmp.FilePath - } - if ag2fdsmp.FileSystem != nil { - objectMap["fileSystem"] = ag2fdsmp.FileSystem - } - if ag2fdsmp.OutputType != "" { - objectMap["outputType"] = ag2fdsmp.OutputType - } - if ag2fdsmp.ResourceGroup != nil { - objectMap["resourceGroup"] = ag2fdsmp.ResourceGroup - } - if ag2fdsmp.StorageAccountName != nil { - objectMap["storageAccountName"] = ag2fdsmp.StorageAccountName - } - if ag2fdsmp.SubscriptionID != nil { - objectMap["subscriptionId"] = ag2fdsmp.SubscriptionID - } - return json.Marshal(objectMap) -} - -// ADLSGen2FileProperties properties of the ADLS Gen2 file data set. -type ADLSGen2FileProperties struct { - // DataSetID - READ-ONLY; Unique id for identifying a data set resource - DataSetID *string `json:"dataSetId,omitempty"` - // FilePath - File path within the file system. - FilePath *string `json:"filePath,omitempty"` - // FileSystem - File system to which the file belongs. - FileSystem *string `json:"fileSystem,omitempty"` - // ResourceGroup - Resource group of storage account - ResourceGroup *string `json:"resourceGroup,omitempty"` - // StorageAccountName - Storage account name of the source data set - StorageAccountName *string `json:"storageAccountName,omitempty"` - // SubscriptionID - Subscription id of storage account - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen2FileProperties. -func (ag2fp ADLSGen2FileProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ag2fp.FilePath != nil { - objectMap["filePath"] = ag2fp.FilePath - } - if ag2fp.FileSystem != nil { - objectMap["fileSystem"] = ag2fp.FileSystem - } - if ag2fp.ResourceGroup != nil { - objectMap["resourceGroup"] = ag2fp.ResourceGroup - } - if ag2fp.StorageAccountName != nil { - objectMap["storageAccountName"] = ag2fp.StorageAccountName - } - if ag2fp.SubscriptionID != nil { - objectMap["subscriptionId"] = ag2fp.SubscriptionID - } - return json.Marshal(objectMap) -} - -// ADLSGen2FileSystemDataSet an ADLS Gen 2 file system data set. -type ADLSGen2FileSystemDataSet struct { - // ADLSGen2FileSystemProperties - ADLS Gen 2 file system data set properties. - *ADLSGen2FileSystemProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindDataSet', 'KindAdlsGen1File', 'KindAdlsGen1Folder', 'KindAdlsGen2File', 'KindAdlsGen2FileSystem', 'KindAdlsGen2Folder', 'KindContainer', 'KindBlob', 'KindBlobFolder', 'KindKustoCluster', 'KindKustoDatabase', 'KindSQLDBTable', 'KindSQLDWTable' - Kind Kind `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen2FileSystemDataSet. -func (ag2fsds ADLSGen2FileSystemDataSet) MarshalJSON() ([]byte, error) { - ag2fsds.Kind = KindAdlsGen2FileSystem - objectMap := make(map[string]interface{}) - if ag2fsds.ADLSGen2FileSystemProperties != nil { - objectMap["properties"] = ag2fsds.ADLSGen2FileSystemProperties - } - if ag2fsds.Kind != "" { - objectMap["kind"] = ag2fsds.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen1FileDataSet is the BasicDataSet implementation for ADLSGen2FileSystemDataSet. -func (ag2fsds ADLSGen2FileSystemDataSet) AsADLSGen1FileDataSet() (*ADLSGen1FileDataSet, bool) { - return nil, false -} - -// AsADLSGen1FolderDataSet is the BasicDataSet implementation for ADLSGen2FileSystemDataSet. -func (ag2fsds ADLSGen2FileSystemDataSet) AsADLSGen1FolderDataSet() (*ADLSGen1FolderDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileDataSet is the BasicDataSet implementation for ADLSGen2FileSystemDataSet. -func (ag2fsds ADLSGen2FileSystemDataSet) AsADLSGen2FileDataSet() (*ADLSGen2FileDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSet is the BasicDataSet implementation for ADLSGen2FileSystemDataSet. -func (ag2fsds ADLSGen2FileSystemDataSet) AsADLSGen2FileSystemDataSet() (*ADLSGen2FileSystemDataSet, bool) { - return &ag2fsds, true -} - -// AsADLSGen2FolderDataSet is the BasicDataSet implementation for ADLSGen2FileSystemDataSet. -func (ag2fsds ADLSGen2FileSystemDataSet) AsADLSGen2FolderDataSet() (*ADLSGen2FolderDataSet, bool) { - return nil, false -} - -// AsBlobContainerDataSet is the BasicDataSet implementation for ADLSGen2FileSystemDataSet. -func (ag2fsds ADLSGen2FileSystemDataSet) AsBlobContainerDataSet() (*BlobContainerDataSet, bool) { - return nil, false -} - -// AsBlobDataSet is the BasicDataSet implementation for ADLSGen2FileSystemDataSet. -func (ag2fsds ADLSGen2FileSystemDataSet) AsBlobDataSet() (*BlobDataSet, bool) { - return nil, false -} - -// AsBlobFolderDataSet is the BasicDataSet implementation for ADLSGen2FileSystemDataSet. -func (ag2fsds ADLSGen2FileSystemDataSet) AsBlobFolderDataSet() (*BlobFolderDataSet, bool) { - return nil, false -} - -// AsKustoClusterDataSet is the BasicDataSet implementation for ADLSGen2FileSystemDataSet. -func (ag2fsds ADLSGen2FileSystemDataSet) AsKustoClusterDataSet() (*KustoClusterDataSet, bool) { - return nil, false -} - -// AsKustoDatabaseDataSet is the BasicDataSet implementation for ADLSGen2FileSystemDataSet. -func (ag2fsds ADLSGen2FileSystemDataSet) AsKustoDatabaseDataSet() (*KustoDatabaseDataSet, bool) { - return nil, false -} - -// AsSQLDBTableDataSet is the BasicDataSet implementation for ADLSGen2FileSystemDataSet. -func (ag2fsds ADLSGen2FileSystemDataSet) AsSQLDBTableDataSet() (*SQLDBTableDataSet, bool) { - return nil, false -} - -// AsSQLDWTableDataSet is the BasicDataSet implementation for ADLSGen2FileSystemDataSet. -func (ag2fsds ADLSGen2FileSystemDataSet) AsSQLDWTableDataSet() (*SQLDWTableDataSet, bool) { - return nil, false -} - -// AsDataSet is the BasicDataSet implementation for ADLSGen2FileSystemDataSet. -func (ag2fsds ADLSGen2FileSystemDataSet) AsDataSet() (*DataSet, bool) { - return nil, false -} - -// AsBasicDataSet is the BasicDataSet implementation for ADLSGen2FileSystemDataSet. -func (ag2fsds ADLSGen2FileSystemDataSet) AsBasicDataSet() (BasicDataSet, bool) { - return &ag2fsds, true -} - -// UnmarshalJSON is the custom unmarshaler for ADLSGen2FileSystemDataSet struct. -func (ag2fsds *ADLSGen2FileSystemDataSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var aDLSGen2FileSystemProperties ADLSGen2FileSystemProperties - err = json.Unmarshal(*v, &aDLSGen2FileSystemProperties) - if err != nil { - return err - } - ag2fsds.ADLSGen2FileSystemProperties = &aDLSGen2FileSystemProperties - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ag2fsds.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ag2fsds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ag2fsds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ag2fsds.Type = &typeVar - } - } - } - - return nil -} - -// ADLSGen2FileSystemDataSetMapping an ADLS Gen2 file system data set mapping. -type ADLSGen2FileSystemDataSetMapping struct { - // ADLSGen2FileSystemDataSetMappingProperties - ADLS Gen2 file system data set mapping properties. - *ADLSGen2FileSystemDataSetMappingProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindBasicDataSetMappingKindDataSetMapping', 'KindBasicDataSetMappingKindAdlsGen2File', 'KindBasicDataSetMappingKindAdlsGen2FileSystem', 'KindBasicDataSetMappingKindAdlsGen2Folder', 'KindBasicDataSetMappingKindContainer', 'KindBasicDataSetMappingKindBlob', 'KindBasicDataSetMappingKindBlobFolder', 'KindBasicDataSetMappingKindKustoCluster', 'KindBasicDataSetMappingKindKustoDatabase', 'KindBasicDataSetMappingKindSQLDBTable', 'KindBasicDataSetMappingKindSQLDWTable' - Kind KindBasicDataSetMapping `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen2FileSystemDataSetMapping. -func (ag2fsdsm ADLSGen2FileSystemDataSetMapping) MarshalJSON() ([]byte, error) { - ag2fsdsm.Kind = KindBasicDataSetMappingKindAdlsGen2FileSystem - objectMap := make(map[string]interface{}) - if ag2fsdsm.ADLSGen2FileSystemDataSetMappingProperties != nil { - objectMap["properties"] = ag2fsdsm.ADLSGen2FileSystemDataSetMappingProperties - } - if ag2fsdsm.Kind != "" { - objectMap["kind"] = ag2fsdsm.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen2FileDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileSystemDataSetMapping. -func (ag2fsdsm ADLSGen2FileSystemDataSetMapping) AsADLSGen2FileDataSetMapping() (*ADLSGen2FileDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileSystemDataSetMapping. -func (ag2fsdsm ADLSGen2FileSystemDataSetMapping) AsADLSGen2FileSystemDataSetMapping() (*ADLSGen2FileSystemDataSetMapping, bool) { - return &ag2fsdsm, true -} - -// AsADLSGen2FolderDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileSystemDataSetMapping. -func (ag2fsdsm ADLSGen2FileSystemDataSetMapping) AsADLSGen2FolderDataSetMapping() (*ADLSGen2FolderDataSetMapping, bool) { - return nil, false -} - -// AsBlobContainerDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileSystemDataSetMapping. -func (ag2fsdsm ADLSGen2FileSystemDataSetMapping) AsBlobContainerDataSetMapping() (*BlobContainerDataSetMapping, bool) { - return nil, false -} - -// AsBlobDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileSystemDataSetMapping. -func (ag2fsdsm ADLSGen2FileSystemDataSetMapping) AsBlobDataSetMapping() (*BlobDataSetMapping, bool) { - return nil, false -} - -// AsBlobFolderDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileSystemDataSetMapping. -func (ag2fsdsm ADLSGen2FileSystemDataSetMapping) AsBlobFolderDataSetMapping() (*BlobFolderDataSetMapping, bool) { - return nil, false -} - -// AsKustoClusterDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileSystemDataSetMapping. -func (ag2fsdsm ADLSGen2FileSystemDataSetMapping) AsKustoClusterDataSetMapping() (*KustoClusterDataSetMapping, bool) { - return nil, false -} - -// AsKustoDatabaseDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileSystemDataSetMapping. -func (ag2fsdsm ADLSGen2FileSystemDataSetMapping) AsKustoDatabaseDataSetMapping() (*KustoDatabaseDataSetMapping, bool) { - return nil, false -} - -// AsSQLDBTableDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileSystemDataSetMapping. -func (ag2fsdsm ADLSGen2FileSystemDataSetMapping) AsSQLDBTableDataSetMapping() (*SQLDBTableDataSetMapping, bool) { - return nil, false -} - -// AsSQLDWTableDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileSystemDataSetMapping. -func (ag2fsdsm ADLSGen2FileSystemDataSetMapping) AsSQLDWTableDataSetMapping() (*SQLDWTableDataSetMapping, bool) { - return nil, false -} - -// AsDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileSystemDataSetMapping. -func (ag2fsdsm ADLSGen2FileSystemDataSetMapping) AsDataSetMapping() (*DataSetMapping, bool) { - return nil, false -} - -// AsBasicDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FileSystemDataSetMapping. -func (ag2fsdsm ADLSGen2FileSystemDataSetMapping) AsBasicDataSetMapping() (BasicDataSetMapping, bool) { - return &ag2fsdsm, true -} - -// UnmarshalJSON is the custom unmarshaler for ADLSGen2FileSystemDataSetMapping struct. -func (ag2fsdsm *ADLSGen2FileSystemDataSetMapping) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var aDLSGen2FileSystemDataSetMappingProperties ADLSGen2FileSystemDataSetMappingProperties - err = json.Unmarshal(*v, &aDLSGen2FileSystemDataSetMappingProperties) - if err != nil { - return err - } - ag2fsdsm.ADLSGen2FileSystemDataSetMappingProperties = &aDLSGen2FileSystemDataSetMappingProperties - } - case "kind": - if v != nil { - var kind KindBasicDataSetMapping - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ag2fsdsm.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ag2fsdsm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ag2fsdsm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ag2fsdsm.Type = &typeVar - } - } - } - - return nil -} - -// ADLSGen2FileSystemDataSetMappingProperties ADLS Gen 2 file system data set mapping property bag. -type ADLSGen2FileSystemDataSetMappingProperties struct { - // DataSetID - The id of the source data set. - DataSetID *string `json:"dataSetId,omitempty"` - // DataSetMappingStatus - READ-ONLY; Gets the status of the data set mapping. Possible values include: 'Ok', 'Broken' - DataSetMappingStatus DataSetMappingStatus `json:"dataSetMappingStatus,omitempty"` - // FileSystem - The file system name. - FileSystem *string `json:"fileSystem,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the data set mapping. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ResourceGroup - Resource group of storage account. - ResourceGroup *string `json:"resourceGroup,omitempty"` - // StorageAccountName - Storage account name of the source data set. - StorageAccountName *string `json:"storageAccountName,omitempty"` - // SubscriptionID - Subscription id of storage account. - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen2FileSystemDataSetMappingProperties. -func (ag2fsdsmp ADLSGen2FileSystemDataSetMappingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ag2fsdsmp.DataSetID != nil { - objectMap["dataSetId"] = ag2fsdsmp.DataSetID - } - if ag2fsdsmp.FileSystem != nil { - objectMap["fileSystem"] = ag2fsdsmp.FileSystem - } - if ag2fsdsmp.ResourceGroup != nil { - objectMap["resourceGroup"] = ag2fsdsmp.ResourceGroup - } - if ag2fsdsmp.StorageAccountName != nil { - objectMap["storageAccountName"] = ag2fsdsmp.StorageAccountName - } - if ag2fsdsmp.SubscriptionID != nil { - objectMap["subscriptionId"] = ag2fsdsmp.SubscriptionID - } - return json.Marshal(objectMap) -} - -// ADLSGen2FileSystemProperties properties of the ADLS Gen2 file system data set. -type ADLSGen2FileSystemProperties struct { - // DataSetID - READ-ONLY; Unique id for identifying a data set resource - DataSetID *string `json:"dataSetId,omitempty"` - // FileSystem - The file system name. - FileSystem *string `json:"fileSystem,omitempty"` - // ResourceGroup - Resource group of storage account - ResourceGroup *string `json:"resourceGroup,omitempty"` - // StorageAccountName - Storage account name of the source data set - StorageAccountName *string `json:"storageAccountName,omitempty"` - // SubscriptionID - Subscription id of storage account - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen2FileSystemProperties. -func (ag2fsp ADLSGen2FileSystemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ag2fsp.FileSystem != nil { - objectMap["fileSystem"] = ag2fsp.FileSystem - } - if ag2fsp.ResourceGroup != nil { - objectMap["resourceGroup"] = ag2fsp.ResourceGroup - } - if ag2fsp.StorageAccountName != nil { - objectMap["storageAccountName"] = ag2fsp.StorageAccountName - } - if ag2fsp.SubscriptionID != nil { - objectMap["subscriptionId"] = ag2fsp.SubscriptionID - } - return json.Marshal(objectMap) -} - -// ADLSGen2FolderDataSet an ADLS Gen 2 folder data set. -type ADLSGen2FolderDataSet struct { - // ADLSGen2FolderProperties - ADLS Gen 2 folder data set properties. - *ADLSGen2FolderProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindDataSet', 'KindAdlsGen1File', 'KindAdlsGen1Folder', 'KindAdlsGen2File', 'KindAdlsGen2FileSystem', 'KindAdlsGen2Folder', 'KindContainer', 'KindBlob', 'KindBlobFolder', 'KindKustoCluster', 'KindKustoDatabase', 'KindSQLDBTable', 'KindSQLDWTable' - Kind Kind `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen2FolderDataSet. -func (ag2fds ADLSGen2FolderDataSet) MarshalJSON() ([]byte, error) { - ag2fds.Kind = KindAdlsGen2Folder - objectMap := make(map[string]interface{}) - if ag2fds.ADLSGen2FolderProperties != nil { - objectMap["properties"] = ag2fds.ADLSGen2FolderProperties - } - if ag2fds.Kind != "" { - objectMap["kind"] = ag2fds.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen1FileDataSet is the BasicDataSet implementation for ADLSGen2FolderDataSet. -func (ag2fds ADLSGen2FolderDataSet) AsADLSGen1FileDataSet() (*ADLSGen1FileDataSet, bool) { - return nil, false -} - -// AsADLSGen1FolderDataSet is the BasicDataSet implementation for ADLSGen2FolderDataSet. -func (ag2fds ADLSGen2FolderDataSet) AsADLSGen1FolderDataSet() (*ADLSGen1FolderDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileDataSet is the BasicDataSet implementation for ADLSGen2FolderDataSet. -func (ag2fds ADLSGen2FolderDataSet) AsADLSGen2FileDataSet() (*ADLSGen2FileDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSet is the BasicDataSet implementation for ADLSGen2FolderDataSet. -func (ag2fds ADLSGen2FolderDataSet) AsADLSGen2FileSystemDataSet() (*ADLSGen2FileSystemDataSet, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSet is the BasicDataSet implementation for ADLSGen2FolderDataSet. -func (ag2fds ADLSGen2FolderDataSet) AsADLSGen2FolderDataSet() (*ADLSGen2FolderDataSet, bool) { - return &ag2fds, true -} - -// AsBlobContainerDataSet is the BasicDataSet implementation for ADLSGen2FolderDataSet. -func (ag2fds ADLSGen2FolderDataSet) AsBlobContainerDataSet() (*BlobContainerDataSet, bool) { - return nil, false -} - -// AsBlobDataSet is the BasicDataSet implementation for ADLSGen2FolderDataSet. -func (ag2fds ADLSGen2FolderDataSet) AsBlobDataSet() (*BlobDataSet, bool) { - return nil, false -} - -// AsBlobFolderDataSet is the BasicDataSet implementation for ADLSGen2FolderDataSet. -func (ag2fds ADLSGen2FolderDataSet) AsBlobFolderDataSet() (*BlobFolderDataSet, bool) { - return nil, false -} - -// AsKustoClusterDataSet is the BasicDataSet implementation for ADLSGen2FolderDataSet. -func (ag2fds ADLSGen2FolderDataSet) AsKustoClusterDataSet() (*KustoClusterDataSet, bool) { - return nil, false -} - -// AsKustoDatabaseDataSet is the BasicDataSet implementation for ADLSGen2FolderDataSet. -func (ag2fds ADLSGen2FolderDataSet) AsKustoDatabaseDataSet() (*KustoDatabaseDataSet, bool) { - return nil, false -} - -// AsSQLDBTableDataSet is the BasicDataSet implementation for ADLSGen2FolderDataSet. -func (ag2fds ADLSGen2FolderDataSet) AsSQLDBTableDataSet() (*SQLDBTableDataSet, bool) { - return nil, false -} - -// AsSQLDWTableDataSet is the BasicDataSet implementation for ADLSGen2FolderDataSet. -func (ag2fds ADLSGen2FolderDataSet) AsSQLDWTableDataSet() (*SQLDWTableDataSet, bool) { - return nil, false -} - -// AsDataSet is the BasicDataSet implementation for ADLSGen2FolderDataSet. -func (ag2fds ADLSGen2FolderDataSet) AsDataSet() (*DataSet, bool) { - return nil, false -} - -// AsBasicDataSet is the BasicDataSet implementation for ADLSGen2FolderDataSet. -func (ag2fds ADLSGen2FolderDataSet) AsBasicDataSet() (BasicDataSet, bool) { - return &ag2fds, true -} - -// UnmarshalJSON is the custom unmarshaler for ADLSGen2FolderDataSet struct. -func (ag2fds *ADLSGen2FolderDataSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var aDLSGen2FolderProperties ADLSGen2FolderProperties - err = json.Unmarshal(*v, &aDLSGen2FolderProperties) - if err != nil { - return err - } - ag2fds.ADLSGen2FolderProperties = &aDLSGen2FolderProperties - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ag2fds.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ag2fds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ag2fds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ag2fds.Type = &typeVar - } - } - } - - return nil -} - -// ADLSGen2FolderDataSetMapping an ADLS Gen2 folder data set mapping. -type ADLSGen2FolderDataSetMapping struct { - // ADLSGen2FolderDataSetMappingProperties - ADLS Gen2 folder data set mapping properties. - *ADLSGen2FolderDataSetMappingProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindBasicDataSetMappingKindDataSetMapping', 'KindBasicDataSetMappingKindAdlsGen2File', 'KindBasicDataSetMappingKindAdlsGen2FileSystem', 'KindBasicDataSetMappingKindAdlsGen2Folder', 'KindBasicDataSetMappingKindContainer', 'KindBasicDataSetMappingKindBlob', 'KindBasicDataSetMappingKindBlobFolder', 'KindBasicDataSetMappingKindKustoCluster', 'KindBasicDataSetMappingKindKustoDatabase', 'KindBasicDataSetMappingKindSQLDBTable', 'KindBasicDataSetMappingKindSQLDWTable' - Kind KindBasicDataSetMapping `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen2FolderDataSetMapping. -func (ag2fdsm ADLSGen2FolderDataSetMapping) MarshalJSON() ([]byte, error) { - ag2fdsm.Kind = KindBasicDataSetMappingKindAdlsGen2Folder - objectMap := make(map[string]interface{}) - if ag2fdsm.ADLSGen2FolderDataSetMappingProperties != nil { - objectMap["properties"] = ag2fdsm.ADLSGen2FolderDataSetMappingProperties - } - if ag2fdsm.Kind != "" { - objectMap["kind"] = ag2fdsm.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen2FileDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FolderDataSetMapping. -func (ag2fdsm ADLSGen2FolderDataSetMapping) AsADLSGen2FileDataSetMapping() (*ADLSGen2FileDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FolderDataSetMapping. -func (ag2fdsm ADLSGen2FolderDataSetMapping) AsADLSGen2FileSystemDataSetMapping() (*ADLSGen2FileSystemDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FolderDataSetMapping. -func (ag2fdsm ADLSGen2FolderDataSetMapping) AsADLSGen2FolderDataSetMapping() (*ADLSGen2FolderDataSetMapping, bool) { - return &ag2fdsm, true -} - -// AsBlobContainerDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FolderDataSetMapping. -func (ag2fdsm ADLSGen2FolderDataSetMapping) AsBlobContainerDataSetMapping() (*BlobContainerDataSetMapping, bool) { - return nil, false -} - -// AsBlobDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FolderDataSetMapping. -func (ag2fdsm ADLSGen2FolderDataSetMapping) AsBlobDataSetMapping() (*BlobDataSetMapping, bool) { - return nil, false -} - -// AsBlobFolderDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FolderDataSetMapping. -func (ag2fdsm ADLSGen2FolderDataSetMapping) AsBlobFolderDataSetMapping() (*BlobFolderDataSetMapping, bool) { - return nil, false -} - -// AsKustoClusterDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FolderDataSetMapping. -func (ag2fdsm ADLSGen2FolderDataSetMapping) AsKustoClusterDataSetMapping() (*KustoClusterDataSetMapping, bool) { - return nil, false -} - -// AsKustoDatabaseDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FolderDataSetMapping. -func (ag2fdsm ADLSGen2FolderDataSetMapping) AsKustoDatabaseDataSetMapping() (*KustoDatabaseDataSetMapping, bool) { - return nil, false -} - -// AsSQLDBTableDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FolderDataSetMapping. -func (ag2fdsm ADLSGen2FolderDataSetMapping) AsSQLDBTableDataSetMapping() (*SQLDBTableDataSetMapping, bool) { - return nil, false -} - -// AsSQLDWTableDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FolderDataSetMapping. -func (ag2fdsm ADLSGen2FolderDataSetMapping) AsSQLDWTableDataSetMapping() (*SQLDWTableDataSetMapping, bool) { - return nil, false -} - -// AsDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FolderDataSetMapping. -func (ag2fdsm ADLSGen2FolderDataSetMapping) AsDataSetMapping() (*DataSetMapping, bool) { - return nil, false -} - -// AsBasicDataSetMapping is the BasicDataSetMapping implementation for ADLSGen2FolderDataSetMapping. -func (ag2fdsm ADLSGen2FolderDataSetMapping) AsBasicDataSetMapping() (BasicDataSetMapping, bool) { - return &ag2fdsm, true -} - -// UnmarshalJSON is the custom unmarshaler for ADLSGen2FolderDataSetMapping struct. -func (ag2fdsm *ADLSGen2FolderDataSetMapping) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var aDLSGen2FolderDataSetMappingProperties ADLSGen2FolderDataSetMappingProperties - err = json.Unmarshal(*v, &aDLSGen2FolderDataSetMappingProperties) - if err != nil { - return err - } - ag2fdsm.ADLSGen2FolderDataSetMappingProperties = &aDLSGen2FolderDataSetMappingProperties - } - case "kind": - if v != nil { - var kind KindBasicDataSetMapping - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ag2fdsm.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ag2fdsm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ag2fdsm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ag2fdsm.Type = &typeVar - } - } - } - - return nil -} - -// ADLSGen2FolderDataSetMappingProperties ADLS Gen 2 folder data set mapping property bag. -type ADLSGen2FolderDataSetMappingProperties struct { - // DataSetID - The id of the source data set. - DataSetID *string `json:"dataSetId,omitempty"` - // DataSetMappingStatus - READ-ONLY; Gets the status of the data set mapping. Possible values include: 'Ok', 'Broken' - DataSetMappingStatus DataSetMappingStatus `json:"dataSetMappingStatus,omitempty"` - // FileSystem - File system to which the folder belongs. - FileSystem *string `json:"fileSystem,omitempty"` - // FolderPath - Folder path within the file system. - FolderPath *string `json:"folderPath,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the data set mapping. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ResourceGroup - Resource group of storage account. - ResourceGroup *string `json:"resourceGroup,omitempty"` - // StorageAccountName - Storage account name of the source data set. - StorageAccountName *string `json:"storageAccountName,omitempty"` - // SubscriptionID - Subscription id of storage account. - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen2FolderDataSetMappingProperties. -func (ag2fdsmp ADLSGen2FolderDataSetMappingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ag2fdsmp.DataSetID != nil { - objectMap["dataSetId"] = ag2fdsmp.DataSetID - } - if ag2fdsmp.FileSystem != nil { - objectMap["fileSystem"] = ag2fdsmp.FileSystem - } - if ag2fdsmp.FolderPath != nil { - objectMap["folderPath"] = ag2fdsmp.FolderPath - } - if ag2fdsmp.ResourceGroup != nil { - objectMap["resourceGroup"] = ag2fdsmp.ResourceGroup - } - if ag2fdsmp.StorageAccountName != nil { - objectMap["storageAccountName"] = ag2fdsmp.StorageAccountName - } - if ag2fdsmp.SubscriptionID != nil { - objectMap["subscriptionId"] = ag2fdsmp.SubscriptionID - } - return json.Marshal(objectMap) -} - -// ADLSGen2FolderProperties properties of the ADLS Gen2 folder data set. -type ADLSGen2FolderProperties struct { - // DataSetID - READ-ONLY; Unique id for identifying a data set resource - DataSetID *string `json:"dataSetId,omitempty"` - // FileSystem - File system to which the folder belongs. - FileSystem *string `json:"fileSystem,omitempty"` - // FolderPath - Folder path within the file system. - FolderPath *string `json:"folderPath,omitempty"` - // ResourceGroup - Resource group of storage account - ResourceGroup *string `json:"resourceGroup,omitempty"` - // StorageAccountName - Storage account name of the source data set - StorageAccountName *string `json:"storageAccountName,omitempty"` - // SubscriptionID - Subscription id of storage account - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADLSGen2FolderProperties. -func (ag2fp ADLSGen2FolderProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ag2fp.FileSystem != nil { - objectMap["fileSystem"] = ag2fp.FileSystem - } - if ag2fp.FolderPath != nil { - objectMap["folderPath"] = ag2fp.FolderPath - } - if ag2fp.ResourceGroup != nil { - objectMap["resourceGroup"] = ag2fp.ResourceGroup - } - if ag2fp.StorageAccountName != nil { - objectMap["storageAccountName"] = ag2fp.StorageAccountName - } - if ag2fp.SubscriptionID != nil { - objectMap["subscriptionId"] = ag2fp.SubscriptionID - } - return json.Marshal(objectMap) -} - -// BlobContainerDataSet an Azure storage blob container data set. -type BlobContainerDataSet struct { - // BlobContainerProperties - Blob container data set properties. - *BlobContainerProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindDataSet', 'KindAdlsGen1File', 'KindAdlsGen1Folder', 'KindAdlsGen2File', 'KindAdlsGen2FileSystem', 'KindAdlsGen2Folder', 'KindContainer', 'KindBlob', 'KindBlobFolder', 'KindKustoCluster', 'KindKustoDatabase', 'KindSQLDBTable', 'KindSQLDWTable' - Kind Kind `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobContainerDataSet. -func (bcds BlobContainerDataSet) MarshalJSON() ([]byte, error) { - bcds.Kind = KindContainer - objectMap := make(map[string]interface{}) - if bcds.BlobContainerProperties != nil { - objectMap["properties"] = bcds.BlobContainerProperties - } - if bcds.Kind != "" { - objectMap["kind"] = bcds.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen1FileDataSet is the BasicDataSet implementation for BlobContainerDataSet. -func (bcds BlobContainerDataSet) AsADLSGen1FileDataSet() (*ADLSGen1FileDataSet, bool) { - return nil, false -} - -// AsADLSGen1FolderDataSet is the BasicDataSet implementation for BlobContainerDataSet. -func (bcds BlobContainerDataSet) AsADLSGen1FolderDataSet() (*ADLSGen1FolderDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileDataSet is the BasicDataSet implementation for BlobContainerDataSet. -func (bcds BlobContainerDataSet) AsADLSGen2FileDataSet() (*ADLSGen2FileDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSet is the BasicDataSet implementation for BlobContainerDataSet. -func (bcds BlobContainerDataSet) AsADLSGen2FileSystemDataSet() (*ADLSGen2FileSystemDataSet, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSet is the BasicDataSet implementation for BlobContainerDataSet. -func (bcds BlobContainerDataSet) AsADLSGen2FolderDataSet() (*ADLSGen2FolderDataSet, bool) { - return nil, false -} - -// AsBlobContainerDataSet is the BasicDataSet implementation for BlobContainerDataSet. -func (bcds BlobContainerDataSet) AsBlobContainerDataSet() (*BlobContainerDataSet, bool) { - return &bcds, true -} - -// AsBlobDataSet is the BasicDataSet implementation for BlobContainerDataSet. -func (bcds BlobContainerDataSet) AsBlobDataSet() (*BlobDataSet, bool) { - return nil, false -} - -// AsBlobFolderDataSet is the BasicDataSet implementation for BlobContainerDataSet. -func (bcds BlobContainerDataSet) AsBlobFolderDataSet() (*BlobFolderDataSet, bool) { - return nil, false -} - -// AsKustoClusterDataSet is the BasicDataSet implementation for BlobContainerDataSet. -func (bcds BlobContainerDataSet) AsKustoClusterDataSet() (*KustoClusterDataSet, bool) { - return nil, false -} - -// AsKustoDatabaseDataSet is the BasicDataSet implementation for BlobContainerDataSet. -func (bcds BlobContainerDataSet) AsKustoDatabaseDataSet() (*KustoDatabaseDataSet, bool) { - return nil, false -} - -// AsSQLDBTableDataSet is the BasicDataSet implementation for BlobContainerDataSet. -func (bcds BlobContainerDataSet) AsSQLDBTableDataSet() (*SQLDBTableDataSet, bool) { - return nil, false -} - -// AsSQLDWTableDataSet is the BasicDataSet implementation for BlobContainerDataSet. -func (bcds BlobContainerDataSet) AsSQLDWTableDataSet() (*SQLDWTableDataSet, bool) { - return nil, false -} - -// AsDataSet is the BasicDataSet implementation for BlobContainerDataSet. -func (bcds BlobContainerDataSet) AsDataSet() (*DataSet, bool) { - return nil, false -} - -// AsBasicDataSet is the BasicDataSet implementation for BlobContainerDataSet. -func (bcds BlobContainerDataSet) AsBasicDataSet() (BasicDataSet, bool) { - return &bcds, true -} - -// UnmarshalJSON is the custom unmarshaler for BlobContainerDataSet struct. -func (bcds *BlobContainerDataSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var blobContainerProperties BlobContainerProperties - err = json.Unmarshal(*v, &blobContainerProperties) - if err != nil { - return err - } - bcds.BlobContainerProperties = &blobContainerProperties - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - bcds.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bcds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bcds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bcds.Type = &typeVar - } - } - } - - return nil -} - -// BlobContainerDataSetMapping a Blob container data set mapping. -type BlobContainerDataSetMapping struct { - // BlobContainerMappingProperties - Blob container data set mapping properties. - *BlobContainerMappingProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindBasicDataSetMappingKindDataSetMapping', 'KindBasicDataSetMappingKindAdlsGen2File', 'KindBasicDataSetMappingKindAdlsGen2FileSystem', 'KindBasicDataSetMappingKindAdlsGen2Folder', 'KindBasicDataSetMappingKindContainer', 'KindBasicDataSetMappingKindBlob', 'KindBasicDataSetMappingKindBlobFolder', 'KindBasicDataSetMappingKindKustoCluster', 'KindBasicDataSetMappingKindKustoDatabase', 'KindBasicDataSetMappingKindSQLDBTable', 'KindBasicDataSetMappingKindSQLDWTable' - Kind KindBasicDataSetMapping `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobContainerDataSetMapping. -func (bcdsm BlobContainerDataSetMapping) MarshalJSON() ([]byte, error) { - bcdsm.Kind = KindBasicDataSetMappingKindContainer - objectMap := make(map[string]interface{}) - if bcdsm.BlobContainerMappingProperties != nil { - objectMap["properties"] = bcdsm.BlobContainerMappingProperties - } - if bcdsm.Kind != "" { - objectMap["kind"] = bcdsm.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen2FileDataSetMapping is the BasicDataSetMapping implementation for BlobContainerDataSetMapping. -func (bcdsm BlobContainerDataSetMapping) AsADLSGen2FileDataSetMapping() (*ADLSGen2FileDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSetMapping is the BasicDataSetMapping implementation for BlobContainerDataSetMapping. -func (bcdsm BlobContainerDataSetMapping) AsADLSGen2FileSystemDataSetMapping() (*ADLSGen2FileSystemDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSetMapping is the BasicDataSetMapping implementation for BlobContainerDataSetMapping. -func (bcdsm BlobContainerDataSetMapping) AsADLSGen2FolderDataSetMapping() (*ADLSGen2FolderDataSetMapping, bool) { - return nil, false -} - -// AsBlobContainerDataSetMapping is the BasicDataSetMapping implementation for BlobContainerDataSetMapping. -func (bcdsm BlobContainerDataSetMapping) AsBlobContainerDataSetMapping() (*BlobContainerDataSetMapping, bool) { - return &bcdsm, true -} - -// AsBlobDataSetMapping is the BasicDataSetMapping implementation for BlobContainerDataSetMapping. -func (bcdsm BlobContainerDataSetMapping) AsBlobDataSetMapping() (*BlobDataSetMapping, bool) { - return nil, false -} - -// AsBlobFolderDataSetMapping is the BasicDataSetMapping implementation for BlobContainerDataSetMapping. -func (bcdsm BlobContainerDataSetMapping) AsBlobFolderDataSetMapping() (*BlobFolderDataSetMapping, bool) { - return nil, false -} - -// AsKustoClusterDataSetMapping is the BasicDataSetMapping implementation for BlobContainerDataSetMapping. -func (bcdsm BlobContainerDataSetMapping) AsKustoClusterDataSetMapping() (*KustoClusterDataSetMapping, bool) { - return nil, false -} - -// AsKustoDatabaseDataSetMapping is the BasicDataSetMapping implementation for BlobContainerDataSetMapping. -func (bcdsm BlobContainerDataSetMapping) AsKustoDatabaseDataSetMapping() (*KustoDatabaseDataSetMapping, bool) { - return nil, false -} - -// AsSQLDBTableDataSetMapping is the BasicDataSetMapping implementation for BlobContainerDataSetMapping. -func (bcdsm BlobContainerDataSetMapping) AsSQLDBTableDataSetMapping() (*SQLDBTableDataSetMapping, bool) { - return nil, false -} - -// AsSQLDWTableDataSetMapping is the BasicDataSetMapping implementation for BlobContainerDataSetMapping. -func (bcdsm BlobContainerDataSetMapping) AsSQLDWTableDataSetMapping() (*SQLDWTableDataSetMapping, bool) { - return nil, false -} - -// AsDataSetMapping is the BasicDataSetMapping implementation for BlobContainerDataSetMapping. -func (bcdsm BlobContainerDataSetMapping) AsDataSetMapping() (*DataSetMapping, bool) { - return nil, false -} - -// AsBasicDataSetMapping is the BasicDataSetMapping implementation for BlobContainerDataSetMapping. -func (bcdsm BlobContainerDataSetMapping) AsBasicDataSetMapping() (BasicDataSetMapping, bool) { - return &bcdsm, true -} - -// UnmarshalJSON is the custom unmarshaler for BlobContainerDataSetMapping struct. -func (bcdsm *BlobContainerDataSetMapping) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var blobContainerMappingProperties BlobContainerMappingProperties - err = json.Unmarshal(*v, &blobContainerMappingProperties) - if err != nil { - return err - } - bcdsm.BlobContainerMappingProperties = &blobContainerMappingProperties - } - case "kind": - if v != nil { - var kind KindBasicDataSetMapping - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - bcdsm.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bcdsm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bcdsm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bcdsm.Type = &typeVar - } - } - } - - return nil -} - -// BlobContainerMappingProperties azure storage Blob container data set mapping property bag. -type BlobContainerMappingProperties struct { - // ContainerName - BLOB Container name. - ContainerName *string `json:"containerName,omitempty"` - // DataSetID - The id of the source data set. - DataSetID *string `json:"dataSetId,omitempty"` - // DataSetMappingStatus - READ-ONLY; Gets the status of the data set mapping. Possible values include: 'Ok', 'Broken' - DataSetMappingStatus DataSetMappingStatus `json:"dataSetMappingStatus,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the data set mapping. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ResourceGroup - Resource group of storage account. - ResourceGroup *string `json:"resourceGroup,omitempty"` - // StorageAccountName - Storage account name of the source data set. - StorageAccountName *string `json:"storageAccountName,omitempty"` - // SubscriptionID - Subscription id of storage account. - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobContainerMappingProperties. -func (bcmp BlobContainerMappingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bcmp.ContainerName != nil { - objectMap["containerName"] = bcmp.ContainerName - } - if bcmp.DataSetID != nil { - objectMap["dataSetId"] = bcmp.DataSetID - } - if bcmp.ResourceGroup != nil { - objectMap["resourceGroup"] = bcmp.ResourceGroup - } - if bcmp.StorageAccountName != nil { - objectMap["storageAccountName"] = bcmp.StorageAccountName - } - if bcmp.SubscriptionID != nil { - objectMap["subscriptionId"] = bcmp.SubscriptionID - } - return json.Marshal(objectMap) -} - -// BlobContainerProperties properties of the BLOB container data set. -type BlobContainerProperties struct { - // ContainerName - BLOB Container name. - ContainerName *string `json:"containerName,omitempty"` - // DataSetID - READ-ONLY; Unique id for identifying a data set resource - DataSetID *string `json:"dataSetId,omitempty"` - // ResourceGroup - Resource group of storage account - ResourceGroup *string `json:"resourceGroup,omitempty"` - // StorageAccountName - Storage account name of the source data set - StorageAccountName *string `json:"storageAccountName,omitempty"` - // SubscriptionID - Subscription id of storage account - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobContainerProperties. -func (bcp BlobContainerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bcp.ContainerName != nil { - objectMap["containerName"] = bcp.ContainerName - } - if bcp.ResourceGroup != nil { - objectMap["resourceGroup"] = bcp.ResourceGroup - } - if bcp.StorageAccountName != nil { - objectMap["storageAccountName"] = bcp.StorageAccountName - } - if bcp.SubscriptionID != nil { - objectMap["subscriptionId"] = bcp.SubscriptionID - } - return json.Marshal(objectMap) -} - -// BlobDataSet an Azure storage blob data set. -type BlobDataSet struct { - // BlobProperties - Blob data set properties. - *BlobProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindDataSet', 'KindAdlsGen1File', 'KindAdlsGen1Folder', 'KindAdlsGen2File', 'KindAdlsGen2FileSystem', 'KindAdlsGen2Folder', 'KindContainer', 'KindBlob', 'KindBlobFolder', 'KindKustoCluster', 'KindKustoDatabase', 'KindSQLDBTable', 'KindSQLDWTable' - Kind Kind `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobDataSet. -func (bds BlobDataSet) MarshalJSON() ([]byte, error) { - bds.Kind = KindBlob - objectMap := make(map[string]interface{}) - if bds.BlobProperties != nil { - objectMap["properties"] = bds.BlobProperties - } - if bds.Kind != "" { - objectMap["kind"] = bds.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen1FileDataSet is the BasicDataSet implementation for BlobDataSet. -func (bds BlobDataSet) AsADLSGen1FileDataSet() (*ADLSGen1FileDataSet, bool) { - return nil, false -} - -// AsADLSGen1FolderDataSet is the BasicDataSet implementation for BlobDataSet. -func (bds BlobDataSet) AsADLSGen1FolderDataSet() (*ADLSGen1FolderDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileDataSet is the BasicDataSet implementation for BlobDataSet. -func (bds BlobDataSet) AsADLSGen2FileDataSet() (*ADLSGen2FileDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSet is the BasicDataSet implementation for BlobDataSet. -func (bds BlobDataSet) AsADLSGen2FileSystemDataSet() (*ADLSGen2FileSystemDataSet, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSet is the BasicDataSet implementation for BlobDataSet. -func (bds BlobDataSet) AsADLSGen2FolderDataSet() (*ADLSGen2FolderDataSet, bool) { - return nil, false -} - -// AsBlobContainerDataSet is the BasicDataSet implementation for BlobDataSet. -func (bds BlobDataSet) AsBlobContainerDataSet() (*BlobContainerDataSet, bool) { - return nil, false -} - -// AsBlobDataSet is the BasicDataSet implementation for BlobDataSet. -func (bds BlobDataSet) AsBlobDataSet() (*BlobDataSet, bool) { - return &bds, true -} - -// AsBlobFolderDataSet is the BasicDataSet implementation for BlobDataSet. -func (bds BlobDataSet) AsBlobFolderDataSet() (*BlobFolderDataSet, bool) { - return nil, false -} - -// AsKustoClusterDataSet is the BasicDataSet implementation for BlobDataSet. -func (bds BlobDataSet) AsKustoClusterDataSet() (*KustoClusterDataSet, bool) { - return nil, false -} - -// AsKustoDatabaseDataSet is the BasicDataSet implementation for BlobDataSet. -func (bds BlobDataSet) AsKustoDatabaseDataSet() (*KustoDatabaseDataSet, bool) { - return nil, false -} - -// AsSQLDBTableDataSet is the BasicDataSet implementation for BlobDataSet. -func (bds BlobDataSet) AsSQLDBTableDataSet() (*SQLDBTableDataSet, bool) { - return nil, false -} - -// AsSQLDWTableDataSet is the BasicDataSet implementation for BlobDataSet. -func (bds BlobDataSet) AsSQLDWTableDataSet() (*SQLDWTableDataSet, bool) { - return nil, false -} - -// AsDataSet is the BasicDataSet implementation for BlobDataSet. -func (bds BlobDataSet) AsDataSet() (*DataSet, bool) { - return nil, false -} - -// AsBasicDataSet is the BasicDataSet implementation for BlobDataSet. -func (bds BlobDataSet) AsBasicDataSet() (BasicDataSet, bool) { - return &bds, true -} - -// UnmarshalJSON is the custom unmarshaler for BlobDataSet struct. -func (bds *BlobDataSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var blobProperties BlobProperties - err = json.Unmarshal(*v, &blobProperties) - if err != nil { - return err - } - bds.BlobProperties = &blobProperties - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - bds.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bds.Type = &typeVar - } - } - } - - return nil -} - -// BlobDataSetMapping a Blob data set mapping. -type BlobDataSetMapping struct { - // BlobMappingProperties - Blob data set mapping properties. - *BlobMappingProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindBasicDataSetMappingKindDataSetMapping', 'KindBasicDataSetMappingKindAdlsGen2File', 'KindBasicDataSetMappingKindAdlsGen2FileSystem', 'KindBasicDataSetMappingKindAdlsGen2Folder', 'KindBasicDataSetMappingKindContainer', 'KindBasicDataSetMappingKindBlob', 'KindBasicDataSetMappingKindBlobFolder', 'KindBasicDataSetMappingKindKustoCluster', 'KindBasicDataSetMappingKindKustoDatabase', 'KindBasicDataSetMappingKindSQLDBTable', 'KindBasicDataSetMappingKindSQLDWTable' - Kind KindBasicDataSetMapping `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobDataSetMapping. -func (bdsm BlobDataSetMapping) MarshalJSON() ([]byte, error) { - bdsm.Kind = KindBasicDataSetMappingKindBlob - objectMap := make(map[string]interface{}) - if bdsm.BlobMappingProperties != nil { - objectMap["properties"] = bdsm.BlobMappingProperties - } - if bdsm.Kind != "" { - objectMap["kind"] = bdsm.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen2FileDataSetMapping is the BasicDataSetMapping implementation for BlobDataSetMapping. -func (bdsm BlobDataSetMapping) AsADLSGen2FileDataSetMapping() (*ADLSGen2FileDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSetMapping is the BasicDataSetMapping implementation for BlobDataSetMapping. -func (bdsm BlobDataSetMapping) AsADLSGen2FileSystemDataSetMapping() (*ADLSGen2FileSystemDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSetMapping is the BasicDataSetMapping implementation for BlobDataSetMapping. -func (bdsm BlobDataSetMapping) AsADLSGen2FolderDataSetMapping() (*ADLSGen2FolderDataSetMapping, bool) { - return nil, false -} - -// AsBlobContainerDataSetMapping is the BasicDataSetMapping implementation for BlobDataSetMapping. -func (bdsm BlobDataSetMapping) AsBlobContainerDataSetMapping() (*BlobContainerDataSetMapping, bool) { - return nil, false -} - -// AsBlobDataSetMapping is the BasicDataSetMapping implementation for BlobDataSetMapping. -func (bdsm BlobDataSetMapping) AsBlobDataSetMapping() (*BlobDataSetMapping, bool) { - return &bdsm, true -} - -// AsBlobFolderDataSetMapping is the BasicDataSetMapping implementation for BlobDataSetMapping. -func (bdsm BlobDataSetMapping) AsBlobFolderDataSetMapping() (*BlobFolderDataSetMapping, bool) { - return nil, false -} - -// AsKustoClusterDataSetMapping is the BasicDataSetMapping implementation for BlobDataSetMapping. -func (bdsm BlobDataSetMapping) AsKustoClusterDataSetMapping() (*KustoClusterDataSetMapping, bool) { - return nil, false -} - -// AsKustoDatabaseDataSetMapping is the BasicDataSetMapping implementation for BlobDataSetMapping. -func (bdsm BlobDataSetMapping) AsKustoDatabaseDataSetMapping() (*KustoDatabaseDataSetMapping, bool) { - return nil, false -} - -// AsSQLDBTableDataSetMapping is the BasicDataSetMapping implementation for BlobDataSetMapping. -func (bdsm BlobDataSetMapping) AsSQLDBTableDataSetMapping() (*SQLDBTableDataSetMapping, bool) { - return nil, false -} - -// AsSQLDWTableDataSetMapping is the BasicDataSetMapping implementation for BlobDataSetMapping. -func (bdsm BlobDataSetMapping) AsSQLDWTableDataSetMapping() (*SQLDWTableDataSetMapping, bool) { - return nil, false -} - -// AsDataSetMapping is the BasicDataSetMapping implementation for BlobDataSetMapping. -func (bdsm BlobDataSetMapping) AsDataSetMapping() (*DataSetMapping, bool) { - return nil, false -} - -// AsBasicDataSetMapping is the BasicDataSetMapping implementation for BlobDataSetMapping. -func (bdsm BlobDataSetMapping) AsBasicDataSetMapping() (BasicDataSetMapping, bool) { - return &bdsm, true -} - -// UnmarshalJSON is the custom unmarshaler for BlobDataSetMapping struct. -func (bdsm *BlobDataSetMapping) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var blobMappingProperties BlobMappingProperties - err = json.Unmarshal(*v, &blobMappingProperties) - if err != nil { - return err - } - bdsm.BlobMappingProperties = &blobMappingProperties - } - case "kind": - if v != nil { - var kind KindBasicDataSetMapping - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - bdsm.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bdsm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bdsm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bdsm.Type = &typeVar - } - } - } - - return nil -} - -// BlobFolderDataSet an Azure storage blob folder data set. -type BlobFolderDataSet struct { - // BlobFolderProperties - Blob folder data set properties. - *BlobFolderProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindDataSet', 'KindAdlsGen1File', 'KindAdlsGen1Folder', 'KindAdlsGen2File', 'KindAdlsGen2FileSystem', 'KindAdlsGen2Folder', 'KindContainer', 'KindBlob', 'KindBlobFolder', 'KindKustoCluster', 'KindKustoDatabase', 'KindSQLDBTable', 'KindSQLDWTable' - Kind Kind `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobFolderDataSet. -func (bfds BlobFolderDataSet) MarshalJSON() ([]byte, error) { - bfds.Kind = KindBlobFolder - objectMap := make(map[string]interface{}) - if bfds.BlobFolderProperties != nil { - objectMap["properties"] = bfds.BlobFolderProperties - } - if bfds.Kind != "" { - objectMap["kind"] = bfds.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen1FileDataSet is the BasicDataSet implementation for BlobFolderDataSet. -func (bfds BlobFolderDataSet) AsADLSGen1FileDataSet() (*ADLSGen1FileDataSet, bool) { - return nil, false -} - -// AsADLSGen1FolderDataSet is the BasicDataSet implementation for BlobFolderDataSet. -func (bfds BlobFolderDataSet) AsADLSGen1FolderDataSet() (*ADLSGen1FolderDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileDataSet is the BasicDataSet implementation for BlobFolderDataSet. -func (bfds BlobFolderDataSet) AsADLSGen2FileDataSet() (*ADLSGen2FileDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSet is the BasicDataSet implementation for BlobFolderDataSet. -func (bfds BlobFolderDataSet) AsADLSGen2FileSystemDataSet() (*ADLSGen2FileSystemDataSet, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSet is the BasicDataSet implementation for BlobFolderDataSet. -func (bfds BlobFolderDataSet) AsADLSGen2FolderDataSet() (*ADLSGen2FolderDataSet, bool) { - return nil, false -} - -// AsBlobContainerDataSet is the BasicDataSet implementation for BlobFolderDataSet. -func (bfds BlobFolderDataSet) AsBlobContainerDataSet() (*BlobContainerDataSet, bool) { - return nil, false -} - -// AsBlobDataSet is the BasicDataSet implementation for BlobFolderDataSet. -func (bfds BlobFolderDataSet) AsBlobDataSet() (*BlobDataSet, bool) { - return nil, false -} - -// AsBlobFolderDataSet is the BasicDataSet implementation for BlobFolderDataSet. -func (bfds BlobFolderDataSet) AsBlobFolderDataSet() (*BlobFolderDataSet, bool) { - return &bfds, true -} - -// AsKustoClusterDataSet is the BasicDataSet implementation for BlobFolderDataSet. -func (bfds BlobFolderDataSet) AsKustoClusterDataSet() (*KustoClusterDataSet, bool) { - return nil, false -} - -// AsKustoDatabaseDataSet is the BasicDataSet implementation for BlobFolderDataSet. -func (bfds BlobFolderDataSet) AsKustoDatabaseDataSet() (*KustoDatabaseDataSet, bool) { - return nil, false -} - -// AsSQLDBTableDataSet is the BasicDataSet implementation for BlobFolderDataSet. -func (bfds BlobFolderDataSet) AsSQLDBTableDataSet() (*SQLDBTableDataSet, bool) { - return nil, false -} - -// AsSQLDWTableDataSet is the BasicDataSet implementation for BlobFolderDataSet. -func (bfds BlobFolderDataSet) AsSQLDWTableDataSet() (*SQLDWTableDataSet, bool) { - return nil, false -} - -// AsDataSet is the BasicDataSet implementation for BlobFolderDataSet. -func (bfds BlobFolderDataSet) AsDataSet() (*DataSet, bool) { - return nil, false -} - -// AsBasicDataSet is the BasicDataSet implementation for BlobFolderDataSet. -func (bfds BlobFolderDataSet) AsBasicDataSet() (BasicDataSet, bool) { - return &bfds, true -} - -// UnmarshalJSON is the custom unmarshaler for BlobFolderDataSet struct. -func (bfds *BlobFolderDataSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var blobFolderProperties BlobFolderProperties - err = json.Unmarshal(*v, &blobFolderProperties) - if err != nil { - return err - } - bfds.BlobFolderProperties = &blobFolderProperties - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - bfds.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bfds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bfds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bfds.Type = &typeVar - } - } - } - - return nil -} - -// BlobFolderDataSetMapping a Blob folder data set mapping. -type BlobFolderDataSetMapping struct { - // BlobFolderMappingProperties - Blob folder data set mapping properties. - *BlobFolderMappingProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindBasicDataSetMappingKindDataSetMapping', 'KindBasicDataSetMappingKindAdlsGen2File', 'KindBasicDataSetMappingKindAdlsGen2FileSystem', 'KindBasicDataSetMappingKindAdlsGen2Folder', 'KindBasicDataSetMappingKindContainer', 'KindBasicDataSetMappingKindBlob', 'KindBasicDataSetMappingKindBlobFolder', 'KindBasicDataSetMappingKindKustoCluster', 'KindBasicDataSetMappingKindKustoDatabase', 'KindBasicDataSetMappingKindSQLDBTable', 'KindBasicDataSetMappingKindSQLDWTable' - Kind KindBasicDataSetMapping `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobFolderDataSetMapping. -func (bfdsm BlobFolderDataSetMapping) MarshalJSON() ([]byte, error) { - bfdsm.Kind = KindBasicDataSetMappingKindBlobFolder - objectMap := make(map[string]interface{}) - if bfdsm.BlobFolderMappingProperties != nil { - objectMap["properties"] = bfdsm.BlobFolderMappingProperties - } - if bfdsm.Kind != "" { - objectMap["kind"] = bfdsm.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen2FileDataSetMapping is the BasicDataSetMapping implementation for BlobFolderDataSetMapping. -func (bfdsm BlobFolderDataSetMapping) AsADLSGen2FileDataSetMapping() (*ADLSGen2FileDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSetMapping is the BasicDataSetMapping implementation for BlobFolderDataSetMapping. -func (bfdsm BlobFolderDataSetMapping) AsADLSGen2FileSystemDataSetMapping() (*ADLSGen2FileSystemDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSetMapping is the BasicDataSetMapping implementation for BlobFolderDataSetMapping. -func (bfdsm BlobFolderDataSetMapping) AsADLSGen2FolderDataSetMapping() (*ADLSGen2FolderDataSetMapping, bool) { - return nil, false -} - -// AsBlobContainerDataSetMapping is the BasicDataSetMapping implementation for BlobFolderDataSetMapping. -func (bfdsm BlobFolderDataSetMapping) AsBlobContainerDataSetMapping() (*BlobContainerDataSetMapping, bool) { - return nil, false -} - -// AsBlobDataSetMapping is the BasicDataSetMapping implementation for BlobFolderDataSetMapping. -func (bfdsm BlobFolderDataSetMapping) AsBlobDataSetMapping() (*BlobDataSetMapping, bool) { - return nil, false -} - -// AsBlobFolderDataSetMapping is the BasicDataSetMapping implementation for BlobFolderDataSetMapping. -func (bfdsm BlobFolderDataSetMapping) AsBlobFolderDataSetMapping() (*BlobFolderDataSetMapping, bool) { - return &bfdsm, true -} - -// AsKustoClusterDataSetMapping is the BasicDataSetMapping implementation for BlobFolderDataSetMapping. -func (bfdsm BlobFolderDataSetMapping) AsKustoClusterDataSetMapping() (*KustoClusterDataSetMapping, bool) { - return nil, false -} - -// AsKustoDatabaseDataSetMapping is the BasicDataSetMapping implementation for BlobFolderDataSetMapping. -func (bfdsm BlobFolderDataSetMapping) AsKustoDatabaseDataSetMapping() (*KustoDatabaseDataSetMapping, bool) { - return nil, false -} - -// AsSQLDBTableDataSetMapping is the BasicDataSetMapping implementation for BlobFolderDataSetMapping. -func (bfdsm BlobFolderDataSetMapping) AsSQLDBTableDataSetMapping() (*SQLDBTableDataSetMapping, bool) { - return nil, false -} - -// AsSQLDWTableDataSetMapping is the BasicDataSetMapping implementation for BlobFolderDataSetMapping. -func (bfdsm BlobFolderDataSetMapping) AsSQLDWTableDataSetMapping() (*SQLDWTableDataSetMapping, bool) { - return nil, false -} - -// AsDataSetMapping is the BasicDataSetMapping implementation for BlobFolderDataSetMapping. -func (bfdsm BlobFolderDataSetMapping) AsDataSetMapping() (*DataSetMapping, bool) { - return nil, false -} - -// AsBasicDataSetMapping is the BasicDataSetMapping implementation for BlobFolderDataSetMapping. -func (bfdsm BlobFolderDataSetMapping) AsBasicDataSetMapping() (BasicDataSetMapping, bool) { - return &bfdsm, true -} - -// UnmarshalJSON is the custom unmarshaler for BlobFolderDataSetMapping struct. -func (bfdsm *BlobFolderDataSetMapping) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var blobFolderMappingProperties BlobFolderMappingProperties - err = json.Unmarshal(*v, &blobFolderMappingProperties) - if err != nil { - return err - } - bfdsm.BlobFolderMappingProperties = &blobFolderMappingProperties - } - case "kind": - if v != nil { - var kind KindBasicDataSetMapping - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - bfdsm.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bfdsm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bfdsm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bfdsm.Type = &typeVar - } - } - } - - return nil -} - -// BlobFolderMappingProperties azure storage Blob folder data set mapping property bag. -type BlobFolderMappingProperties struct { - // ContainerName - Container that has the file path. - ContainerName *string `json:"containerName,omitempty"` - // DataSetID - The id of the source data set. - DataSetID *string `json:"dataSetId,omitempty"` - // DataSetMappingStatus - READ-ONLY; Gets the status of the data set mapping. Possible values include: 'Ok', 'Broken' - DataSetMappingStatus DataSetMappingStatus `json:"dataSetMappingStatus,omitempty"` - // Prefix - Prefix for blob folder - Prefix *string `json:"prefix,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the data set mapping. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ResourceGroup - Resource group of storage account. - ResourceGroup *string `json:"resourceGroup,omitempty"` - // StorageAccountName - Storage account name of the source data set. - StorageAccountName *string `json:"storageAccountName,omitempty"` - // SubscriptionID - Subscription id of storage account. - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobFolderMappingProperties. -func (bfmp BlobFolderMappingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bfmp.ContainerName != nil { - objectMap["containerName"] = bfmp.ContainerName - } - if bfmp.DataSetID != nil { - objectMap["dataSetId"] = bfmp.DataSetID - } - if bfmp.Prefix != nil { - objectMap["prefix"] = bfmp.Prefix - } - if bfmp.ResourceGroup != nil { - objectMap["resourceGroup"] = bfmp.ResourceGroup - } - if bfmp.StorageAccountName != nil { - objectMap["storageAccountName"] = bfmp.StorageAccountName - } - if bfmp.SubscriptionID != nil { - objectMap["subscriptionId"] = bfmp.SubscriptionID - } - return json.Marshal(objectMap) -} - -// BlobFolderProperties properties of the blob folder data set. -type BlobFolderProperties struct { - // ContainerName - Container that has the file path. - ContainerName *string `json:"containerName,omitempty"` - // DataSetID - READ-ONLY; Unique id for identifying a data set resource - DataSetID *string `json:"dataSetId,omitempty"` - // Prefix - Prefix for blob folder - Prefix *string `json:"prefix,omitempty"` - // ResourceGroup - Resource group of storage account - ResourceGroup *string `json:"resourceGroup,omitempty"` - // StorageAccountName - Storage account name of the source data set - StorageAccountName *string `json:"storageAccountName,omitempty"` - // SubscriptionID - Subscription id of storage account - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobFolderProperties. -func (bfp BlobFolderProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bfp.ContainerName != nil { - objectMap["containerName"] = bfp.ContainerName - } - if bfp.Prefix != nil { - objectMap["prefix"] = bfp.Prefix - } - if bfp.ResourceGroup != nil { - objectMap["resourceGroup"] = bfp.ResourceGroup - } - if bfp.StorageAccountName != nil { - objectMap["storageAccountName"] = bfp.StorageAccountName - } - if bfp.SubscriptionID != nil { - objectMap["subscriptionId"] = bfp.SubscriptionID - } - return json.Marshal(objectMap) -} - -// BlobMappingProperties azure storage Blob data set mapping property bag. -type BlobMappingProperties struct { - // ContainerName - Container that has the file path. - ContainerName *string `json:"containerName,omitempty"` - // DataSetID - The id of the source data set. - DataSetID *string `json:"dataSetId,omitempty"` - // DataSetMappingStatus - READ-ONLY; Gets the status of the data set mapping. Possible values include: 'Ok', 'Broken' - DataSetMappingStatus DataSetMappingStatus `json:"dataSetMappingStatus,omitempty"` - // FilePath - File path within the source data set - FilePath *string `json:"filePath,omitempty"` - // OutputType - File output type. Possible values include: 'Csv', 'Parquet' - OutputType OutputType `json:"outputType,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the data set mapping. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ResourceGroup - Resource group of storage account. - ResourceGroup *string `json:"resourceGroup,omitempty"` - // StorageAccountName - Storage account name of the source data set. - StorageAccountName *string `json:"storageAccountName,omitempty"` - // SubscriptionID - Subscription id of storage account. - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobMappingProperties. -func (bmp BlobMappingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bmp.ContainerName != nil { - objectMap["containerName"] = bmp.ContainerName - } - if bmp.DataSetID != nil { - objectMap["dataSetId"] = bmp.DataSetID - } - if bmp.FilePath != nil { - objectMap["filePath"] = bmp.FilePath - } - if bmp.OutputType != "" { - objectMap["outputType"] = bmp.OutputType - } - if bmp.ResourceGroup != nil { - objectMap["resourceGroup"] = bmp.ResourceGroup - } - if bmp.StorageAccountName != nil { - objectMap["storageAccountName"] = bmp.StorageAccountName - } - if bmp.SubscriptionID != nil { - objectMap["subscriptionId"] = bmp.SubscriptionID - } - return json.Marshal(objectMap) -} - -// BlobProperties properties of the blob data set. -type BlobProperties struct { - // ContainerName - Container that has the file path. - ContainerName *string `json:"containerName,omitempty"` - // DataSetID - READ-ONLY; Unique id for identifying a data set resource - DataSetID *string `json:"dataSetId,omitempty"` - // FilePath - File path within the source data set - FilePath *string `json:"filePath,omitempty"` - // ResourceGroup - Resource group of storage account - ResourceGroup *string `json:"resourceGroup,omitempty"` - // StorageAccountName - Storage account name of the source data set - StorageAccountName *string `json:"storageAccountName,omitempty"` - // SubscriptionID - Subscription id of storage account - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobProperties. -func (bp BlobProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bp.ContainerName != nil { - objectMap["containerName"] = bp.ContainerName - } - if bp.FilePath != nil { - objectMap["filePath"] = bp.FilePath - } - if bp.ResourceGroup != nil { - objectMap["resourceGroup"] = bp.ResourceGroup - } - if bp.StorageAccountName != nil { - objectMap["storageAccountName"] = bp.StorageAccountName - } - if bp.SubscriptionID != nil { - objectMap["subscriptionId"] = bp.SubscriptionID - } - return json.Marshal(objectMap) -} - -// ConsumerInvitation a consumer Invitation data transfer object. -type ConsumerInvitation struct { - autorest.Response `json:"-"` - // ConsumerInvitationProperties - Properties on the account - *ConsumerInvitationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConsumerInvitation. -func (ci ConsumerInvitation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ci.ConsumerInvitationProperties != nil { - objectMap["properties"] = ci.ConsumerInvitationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConsumerInvitation struct. -func (ci *ConsumerInvitation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var consumerInvitationProperties ConsumerInvitationProperties - err = json.Unmarshal(*v, &consumerInvitationProperties) - if err != nil { - return err - } - ci.ConsumerInvitationProperties = &consumerInvitationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ci.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ci.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ci.Type = &typeVar - } - } - } - - return nil -} - -// ConsumerInvitationList list response for get InvitationList -type ConsumerInvitationList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]ConsumerInvitation `json:"value,omitempty"` -} - -// ConsumerInvitationListIterator provides access to a complete listing of ConsumerInvitation values. -type ConsumerInvitationListIterator struct { - i int - page ConsumerInvitationListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ConsumerInvitationListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConsumerInvitationListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ConsumerInvitationListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ConsumerInvitationListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ConsumerInvitationListIterator) Response() ConsumerInvitationList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ConsumerInvitationListIterator) Value() ConsumerInvitation { - if !iter.page.NotDone() { - return ConsumerInvitation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ConsumerInvitationListIterator type. -func NewConsumerInvitationListIterator(page ConsumerInvitationListPage) ConsumerInvitationListIterator { - return ConsumerInvitationListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cil ConsumerInvitationList) IsEmpty() bool { - return cil.Value == nil || len(*cil.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cil ConsumerInvitationList) hasNextLink() bool { - return cil.NextLink != nil && len(*cil.NextLink) != 0 -} - -// consumerInvitationListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cil ConsumerInvitationList) consumerInvitationListPreparer(ctx context.Context) (*http.Request, error) { - if !cil.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cil.NextLink))) -} - -// ConsumerInvitationListPage contains a page of ConsumerInvitation values. -type ConsumerInvitationListPage struct { - fn func(context.Context, ConsumerInvitationList) (ConsumerInvitationList, error) - cil ConsumerInvitationList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ConsumerInvitationListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConsumerInvitationListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cil) - if err != nil { - return err - } - page.cil = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ConsumerInvitationListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ConsumerInvitationListPage) NotDone() bool { - return !page.cil.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ConsumerInvitationListPage) Response() ConsumerInvitationList { - return page.cil -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ConsumerInvitationListPage) Values() []ConsumerInvitation { - if page.cil.IsEmpty() { - return nil - } - return *page.cil.Value -} - -// Creates a new instance of the ConsumerInvitationListPage type. -func NewConsumerInvitationListPage(cur ConsumerInvitationList, getNextPage func(context.Context, ConsumerInvitationList) (ConsumerInvitationList, error)) ConsumerInvitationListPage { - return ConsumerInvitationListPage{ - fn: getNextPage, - cil: cur, - } -} - -// ConsumerInvitationProperties properties of consumer invitation -type ConsumerInvitationProperties struct { - // DataSetCount - READ-ONLY; Number of data sets in a share - DataSetCount *int32 `json:"dataSetCount,omitempty"` - // Description - READ-ONLY; Description shared when the invitation was created - Description *string `json:"description,omitempty"` - // InvitationID - Unique id of the invitation. - InvitationID *string `json:"invitationId,omitempty"` - // InvitationStatus - READ-ONLY; The status of the invitation. Possible values include: 'Pending', 'Accepted', 'Rejected', 'Withdrawn' - InvitationStatus InvitationStatus `json:"invitationStatus,omitempty"` - // Location - READ-ONLY; invitation location - Location *string `json:"location,omitempty"` - // ProviderEmail - READ-ONLY; Email of the provider who created the resource - ProviderEmail *string `json:"providerEmail,omitempty"` - // ProviderName - READ-ONLY; Name of the provider who created the resource - ProviderName *string `json:"providerName,omitempty"` - // ProviderTenantName - READ-ONLY; Tenant name of the provider who created the resource - ProviderTenantName *string `json:"providerTenantName,omitempty"` - // RespondedAt - READ-ONLY; The time the recipient responded to the invitation. - RespondedAt *date.Time `json:"respondedAt,omitempty"` - // SentAt - READ-ONLY; Gets the time at which the invitation was sent. - SentAt *date.Time `json:"sentAt,omitempty"` - // ShareName - READ-ONLY; Gets the source share Name. - ShareName *string `json:"shareName,omitempty"` - // TermsOfUse - READ-ONLY; Terms of use shared when the invitation was created - TermsOfUse *string `json:"termsOfUse,omitempty"` - // UserEmail - READ-ONLY; Email of the user who created the resource - UserEmail *string `json:"userEmail,omitempty"` - // UserName - READ-ONLY; Name of the user who created the resource - UserName *string `json:"userName,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConsumerInvitationProperties. -func (cip ConsumerInvitationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cip.InvitationID != nil { - objectMap["invitationId"] = cip.InvitationID - } - return json.Marshal(objectMap) -} - -// ConsumerSourceDataSet a consumer side dataSet data transfer object. -type ConsumerSourceDataSet struct { - // ConsumerSourceDataSetProperties - source dataSet properties - *ConsumerSourceDataSetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConsumerSourceDataSet. -func (csds ConsumerSourceDataSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if csds.ConsumerSourceDataSetProperties != nil { - objectMap["properties"] = csds.ConsumerSourceDataSetProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConsumerSourceDataSet struct. -func (csds *ConsumerSourceDataSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var consumerSourceDataSetProperties ConsumerSourceDataSetProperties - err = json.Unmarshal(*v, &consumerSourceDataSetProperties) - if err != nil { - return err - } - csds.ConsumerSourceDataSetProperties = &consumerSourceDataSetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - csds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - csds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - csds.Type = &typeVar - } - } - } - - return nil -} - -// ConsumerSourceDataSetList a consumer side list of source dataSets -type ConsumerSourceDataSetList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]ConsumerSourceDataSet `json:"value,omitempty"` -} - -// ConsumerSourceDataSetListIterator provides access to a complete listing of ConsumerSourceDataSet values. -type ConsumerSourceDataSetListIterator struct { - i int - page ConsumerSourceDataSetListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ConsumerSourceDataSetListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConsumerSourceDataSetListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ConsumerSourceDataSetListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ConsumerSourceDataSetListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ConsumerSourceDataSetListIterator) Response() ConsumerSourceDataSetList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ConsumerSourceDataSetListIterator) Value() ConsumerSourceDataSet { - if !iter.page.NotDone() { - return ConsumerSourceDataSet{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ConsumerSourceDataSetListIterator type. -func NewConsumerSourceDataSetListIterator(page ConsumerSourceDataSetListPage) ConsumerSourceDataSetListIterator { - return ConsumerSourceDataSetListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (csdsl ConsumerSourceDataSetList) IsEmpty() bool { - return csdsl.Value == nil || len(*csdsl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (csdsl ConsumerSourceDataSetList) hasNextLink() bool { - return csdsl.NextLink != nil && len(*csdsl.NextLink) != 0 -} - -// consumerSourceDataSetListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (csdsl ConsumerSourceDataSetList) consumerSourceDataSetListPreparer(ctx context.Context) (*http.Request, error) { - if !csdsl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(csdsl.NextLink))) -} - -// ConsumerSourceDataSetListPage contains a page of ConsumerSourceDataSet values. -type ConsumerSourceDataSetListPage struct { - fn func(context.Context, ConsumerSourceDataSetList) (ConsumerSourceDataSetList, error) - csdsl ConsumerSourceDataSetList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ConsumerSourceDataSetListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConsumerSourceDataSetListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.csdsl) - if err != nil { - return err - } - page.csdsl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ConsumerSourceDataSetListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ConsumerSourceDataSetListPage) NotDone() bool { - return !page.csdsl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ConsumerSourceDataSetListPage) Response() ConsumerSourceDataSetList { - return page.csdsl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ConsumerSourceDataSetListPage) Values() []ConsumerSourceDataSet { - if page.csdsl.IsEmpty() { - return nil - } - return *page.csdsl.Value -} - -// Creates a new instance of the ConsumerSourceDataSetListPage type. -func NewConsumerSourceDataSetListPage(cur ConsumerSourceDataSetList, getNextPage func(context.Context, ConsumerSourceDataSetList) (ConsumerSourceDataSetList, error)) ConsumerSourceDataSetListPage { - return ConsumerSourceDataSetListPage{ - fn: getNextPage, - csdsl: cur, - } -} - -// ConsumerSourceDataSetProperties properties of consumer source dataSet -type ConsumerSourceDataSetProperties struct { - // DataSetID - READ-ONLY; DataSet Id - DataSetID *string `json:"dataSetId,omitempty"` - // DataSetLocation - READ-ONLY; Location of the data set. - DataSetLocation *string `json:"dataSetLocation,omitempty"` - // DataSetName - READ-ONLY; DataSet name - DataSetName *string `json:"dataSetName,omitempty"` - // DataSetPath - READ-ONLY; DataSet path - DataSetPath *string `json:"dataSetPath,omitempty"` - // DataSetType - READ-ONLY; Type of data set. Possible values include: 'Blob', 'Container', 'BlobFolder', 'AdlsGen2FileSystem', 'AdlsGen2Folder', 'AdlsGen2File', 'AdlsGen1Folder', 'AdlsGen1File', 'KustoCluster', 'KustoDatabase', 'SQLDBTable', 'SQLDWTable' - DataSetType DataSetType `json:"dataSetType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConsumerSourceDataSetProperties. -func (csdsp ConsumerSourceDataSetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BasicDataSet a DataSet data transfer object. -type BasicDataSet interface { - AsADLSGen1FileDataSet() (*ADLSGen1FileDataSet, bool) - AsADLSGen1FolderDataSet() (*ADLSGen1FolderDataSet, bool) - AsADLSGen2FileDataSet() (*ADLSGen2FileDataSet, bool) - AsADLSGen2FileSystemDataSet() (*ADLSGen2FileSystemDataSet, bool) - AsADLSGen2FolderDataSet() (*ADLSGen2FolderDataSet, bool) - AsBlobContainerDataSet() (*BlobContainerDataSet, bool) - AsBlobDataSet() (*BlobDataSet, bool) - AsBlobFolderDataSet() (*BlobFolderDataSet, bool) - AsKustoClusterDataSet() (*KustoClusterDataSet, bool) - AsKustoDatabaseDataSet() (*KustoDatabaseDataSet, bool) - AsSQLDBTableDataSet() (*SQLDBTableDataSet, bool) - AsSQLDWTableDataSet() (*SQLDWTableDataSet, bool) - AsDataSet() (*DataSet, bool) -} - -// DataSet a DataSet data transfer object. -type DataSet struct { - autorest.Response `json:"-"` - // Kind - Possible values include: 'KindDataSet', 'KindAdlsGen1File', 'KindAdlsGen1Folder', 'KindAdlsGen2File', 'KindAdlsGen2FileSystem', 'KindAdlsGen2Folder', 'KindContainer', 'KindBlob', 'KindBlobFolder', 'KindKustoCluster', 'KindKustoDatabase', 'KindSQLDBTable', 'KindSQLDWTable' - Kind Kind `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -func unmarshalBasicDataSet(body []byte) (BasicDataSet, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["kind"] { - case string(KindAdlsGen1File): - var ag1fds ADLSGen1FileDataSet - err := json.Unmarshal(body, &ag1fds) - return ag1fds, err - case string(KindAdlsGen1Folder): - var ag1fds ADLSGen1FolderDataSet - err := json.Unmarshal(body, &ag1fds) - return ag1fds, err - case string(KindAdlsGen2File): - var ag2fds ADLSGen2FileDataSet - err := json.Unmarshal(body, &ag2fds) - return ag2fds, err - case string(KindAdlsGen2FileSystem): - var ag2fsds ADLSGen2FileSystemDataSet - err := json.Unmarshal(body, &ag2fsds) - return ag2fsds, err - case string(KindAdlsGen2Folder): - var ag2fds ADLSGen2FolderDataSet - err := json.Unmarshal(body, &ag2fds) - return ag2fds, err - case string(KindContainer): - var bcds BlobContainerDataSet - err := json.Unmarshal(body, &bcds) - return bcds, err - case string(KindBlob): - var bds BlobDataSet - err := json.Unmarshal(body, &bds) - return bds, err - case string(KindBlobFolder): - var bfds BlobFolderDataSet - err := json.Unmarshal(body, &bfds) - return bfds, err - case string(KindKustoCluster): - var kcds KustoClusterDataSet - err := json.Unmarshal(body, &kcds) - return kcds, err - case string(KindKustoDatabase): - var kdds KustoDatabaseDataSet - err := json.Unmarshal(body, &kdds) - return kdds, err - case string(KindSQLDBTable): - var sdtds SQLDBTableDataSet - err := json.Unmarshal(body, &sdtds) - return sdtds, err - case string(KindSQLDWTable): - var sdtds SQLDWTableDataSet - err := json.Unmarshal(body, &sdtds) - return sdtds, err - default: - var ds DataSet - err := json.Unmarshal(body, &ds) - return ds, err - } -} -func unmarshalBasicDataSetArray(body []byte) ([]BasicDataSet, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - dsArray := make([]BasicDataSet, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ds, err := unmarshalBasicDataSet(*rawMessage) - if err != nil { - return nil, err - } - dsArray[index] = ds - } - return dsArray, nil -} - -// MarshalJSON is the custom marshaler for DataSet. -func (ds DataSet) MarshalJSON() ([]byte, error) { - ds.Kind = KindDataSet - objectMap := make(map[string]interface{}) - if ds.Kind != "" { - objectMap["kind"] = ds.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen1FileDataSet is the BasicDataSet implementation for DataSet. -func (ds DataSet) AsADLSGen1FileDataSet() (*ADLSGen1FileDataSet, bool) { - return nil, false -} - -// AsADLSGen1FolderDataSet is the BasicDataSet implementation for DataSet. -func (ds DataSet) AsADLSGen1FolderDataSet() (*ADLSGen1FolderDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileDataSet is the BasicDataSet implementation for DataSet. -func (ds DataSet) AsADLSGen2FileDataSet() (*ADLSGen2FileDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSet is the BasicDataSet implementation for DataSet. -func (ds DataSet) AsADLSGen2FileSystemDataSet() (*ADLSGen2FileSystemDataSet, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSet is the BasicDataSet implementation for DataSet. -func (ds DataSet) AsADLSGen2FolderDataSet() (*ADLSGen2FolderDataSet, bool) { - return nil, false -} - -// AsBlobContainerDataSet is the BasicDataSet implementation for DataSet. -func (ds DataSet) AsBlobContainerDataSet() (*BlobContainerDataSet, bool) { - return nil, false -} - -// AsBlobDataSet is the BasicDataSet implementation for DataSet. -func (ds DataSet) AsBlobDataSet() (*BlobDataSet, bool) { - return nil, false -} - -// AsBlobFolderDataSet is the BasicDataSet implementation for DataSet. -func (ds DataSet) AsBlobFolderDataSet() (*BlobFolderDataSet, bool) { - return nil, false -} - -// AsKustoClusterDataSet is the BasicDataSet implementation for DataSet. -func (ds DataSet) AsKustoClusterDataSet() (*KustoClusterDataSet, bool) { - return nil, false -} - -// AsKustoDatabaseDataSet is the BasicDataSet implementation for DataSet. -func (ds DataSet) AsKustoDatabaseDataSet() (*KustoDatabaseDataSet, bool) { - return nil, false -} - -// AsSQLDBTableDataSet is the BasicDataSet implementation for DataSet. -func (ds DataSet) AsSQLDBTableDataSet() (*SQLDBTableDataSet, bool) { - return nil, false -} - -// AsSQLDWTableDataSet is the BasicDataSet implementation for DataSet. -func (ds DataSet) AsSQLDWTableDataSet() (*SQLDWTableDataSet, bool) { - return nil, false -} - -// AsDataSet is the BasicDataSet implementation for DataSet. -func (ds DataSet) AsDataSet() (*DataSet, bool) { - return &ds, true -} - -// AsBasicDataSet is the BasicDataSet implementation for DataSet. -func (ds DataSet) AsBasicDataSet() (BasicDataSet, bool) { - return &ds, true -} - -// DataSetList list response for get DataSets -type DataSetList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]BasicDataSet `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DataSetList struct. -func (dsl *DataSetList) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "nextLink": - if v != nil { - var nextLink string - err = json.Unmarshal(*v, &nextLink) - if err != nil { - return err - } - dsl.NextLink = &nextLink - } - case "value": - if v != nil { - value, err := unmarshalBasicDataSetArray(*v) - if err != nil { - return err - } - dsl.Value = &value - } - } - } - - return nil -} - -// DataSetListIterator provides access to a complete listing of DataSet values. -type DataSetListIterator struct { - i int - page DataSetListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DataSetListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataSetListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DataSetListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DataSetListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DataSetListIterator) Response() DataSetList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DataSetListIterator) Value() BasicDataSet { - if !iter.page.NotDone() { - return DataSet{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DataSetListIterator type. -func NewDataSetListIterator(page DataSetListPage) DataSetListIterator { - return DataSetListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dsl DataSetList) IsEmpty() bool { - return dsl.Value == nil || len(*dsl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dsl DataSetList) hasNextLink() bool { - return dsl.NextLink != nil && len(*dsl.NextLink) != 0 -} - -// dataSetListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dsl DataSetList) dataSetListPreparer(ctx context.Context) (*http.Request, error) { - if !dsl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dsl.NextLink))) -} - -// DataSetListPage contains a page of BasicDataSet values. -type DataSetListPage struct { - fn func(context.Context, DataSetList) (DataSetList, error) - dsl DataSetList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DataSetListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataSetListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dsl) - if err != nil { - return err - } - page.dsl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DataSetListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DataSetListPage) NotDone() bool { - return !page.dsl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DataSetListPage) Response() DataSetList { - return page.dsl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DataSetListPage) Values() []BasicDataSet { - if page.dsl.IsEmpty() { - return nil - } - return *page.dsl.Value -} - -// Creates a new instance of the DataSetListPage type. -func NewDataSetListPage(cur DataSetList, getNextPage func(context.Context, DataSetList) (DataSetList, error)) DataSetListPage { - return DataSetListPage{ - fn: getNextPage, - dsl: cur, - } -} - -// BasicDataSetMapping a data set mapping data transfer object. -type BasicDataSetMapping interface { - AsADLSGen2FileDataSetMapping() (*ADLSGen2FileDataSetMapping, bool) - AsADLSGen2FileSystemDataSetMapping() (*ADLSGen2FileSystemDataSetMapping, bool) - AsADLSGen2FolderDataSetMapping() (*ADLSGen2FolderDataSetMapping, bool) - AsBlobContainerDataSetMapping() (*BlobContainerDataSetMapping, bool) - AsBlobDataSetMapping() (*BlobDataSetMapping, bool) - AsBlobFolderDataSetMapping() (*BlobFolderDataSetMapping, bool) - AsKustoClusterDataSetMapping() (*KustoClusterDataSetMapping, bool) - AsKustoDatabaseDataSetMapping() (*KustoDatabaseDataSetMapping, bool) - AsSQLDBTableDataSetMapping() (*SQLDBTableDataSetMapping, bool) - AsSQLDWTableDataSetMapping() (*SQLDWTableDataSetMapping, bool) - AsDataSetMapping() (*DataSetMapping, bool) -} - -// DataSetMapping a data set mapping data transfer object. -type DataSetMapping struct { - autorest.Response `json:"-"` - // Kind - Possible values include: 'KindBasicDataSetMappingKindDataSetMapping', 'KindBasicDataSetMappingKindAdlsGen2File', 'KindBasicDataSetMappingKindAdlsGen2FileSystem', 'KindBasicDataSetMappingKindAdlsGen2Folder', 'KindBasicDataSetMappingKindContainer', 'KindBasicDataSetMappingKindBlob', 'KindBasicDataSetMappingKindBlobFolder', 'KindBasicDataSetMappingKindKustoCluster', 'KindBasicDataSetMappingKindKustoDatabase', 'KindBasicDataSetMappingKindSQLDBTable', 'KindBasicDataSetMappingKindSQLDWTable' - Kind KindBasicDataSetMapping `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -func unmarshalBasicDataSetMapping(body []byte) (BasicDataSetMapping, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["kind"] { - case string(KindBasicDataSetMappingKindAdlsGen2File): - var ag2fdsm ADLSGen2FileDataSetMapping - err := json.Unmarshal(body, &ag2fdsm) - return ag2fdsm, err - case string(KindBasicDataSetMappingKindAdlsGen2FileSystem): - var ag2fsdsm ADLSGen2FileSystemDataSetMapping - err := json.Unmarshal(body, &ag2fsdsm) - return ag2fsdsm, err - case string(KindBasicDataSetMappingKindAdlsGen2Folder): - var ag2fdsm ADLSGen2FolderDataSetMapping - err := json.Unmarshal(body, &ag2fdsm) - return ag2fdsm, err - case string(KindBasicDataSetMappingKindContainer): - var bcdsm BlobContainerDataSetMapping - err := json.Unmarshal(body, &bcdsm) - return bcdsm, err - case string(KindBasicDataSetMappingKindBlob): - var bdsm BlobDataSetMapping - err := json.Unmarshal(body, &bdsm) - return bdsm, err - case string(KindBasicDataSetMappingKindBlobFolder): - var bfdsm BlobFolderDataSetMapping - err := json.Unmarshal(body, &bfdsm) - return bfdsm, err - case string(KindBasicDataSetMappingKindKustoCluster): - var kcdsm KustoClusterDataSetMapping - err := json.Unmarshal(body, &kcdsm) - return kcdsm, err - case string(KindBasicDataSetMappingKindKustoDatabase): - var kddsm KustoDatabaseDataSetMapping - err := json.Unmarshal(body, &kddsm) - return kddsm, err - case string(KindBasicDataSetMappingKindSQLDBTable): - var sdtdsm SQLDBTableDataSetMapping - err := json.Unmarshal(body, &sdtdsm) - return sdtdsm, err - case string(KindBasicDataSetMappingKindSQLDWTable): - var sdtdsm SQLDWTableDataSetMapping - err := json.Unmarshal(body, &sdtdsm) - return sdtdsm, err - default: - var dsm DataSetMapping - err := json.Unmarshal(body, &dsm) - return dsm, err - } -} -func unmarshalBasicDataSetMappingArray(body []byte) ([]BasicDataSetMapping, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - dsmArray := make([]BasicDataSetMapping, len(rawMessages)) - - for index, rawMessage := range rawMessages { - dsm, err := unmarshalBasicDataSetMapping(*rawMessage) - if err != nil { - return nil, err - } - dsmArray[index] = dsm - } - return dsmArray, nil -} - -// MarshalJSON is the custom marshaler for DataSetMapping. -func (dsm DataSetMapping) MarshalJSON() ([]byte, error) { - dsm.Kind = KindBasicDataSetMappingKindDataSetMapping - objectMap := make(map[string]interface{}) - if dsm.Kind != "" { - objectMap["kind"] = dsm.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen2FileDataSetMapping is the BasicDataSetMapping implementation for DataSetMapping. -func (dsm DataSetMapping) AsADLSGen2FileDataSetMapping() (*ADLSGen2FileDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSetMapping is the BasicDataSetMapping implementation for DataSetMapping. -func (dsm DataSetMapping) AsADLSGen2FileSystemDataSetMapping() (*ADLSGen2FileSystemDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSetMapping is the BasicDataSetMapping implementation for DataSetMapping. -func (dsm DataSetMapping) AsADLSGen2FolderDataSetMapping() (*ADLSGen2FolderDataSetMapping, bool) { - return nil, false -} - -// AsBlobContainerDataSetMapping is the BasicDataSetMapping implementation for DataSetMapping. -func (dsm DataSetMapping) AsBlobContainerDataSetMapping() (*BlobContainerDataSetMapping, bool) { - return nil, false -} - -// AsBlobDataSetMapping is the BasicDataSetMapping implementation for DataSetMapping. -func (dsm DataSetMapping) AsBlobDataSetMapping() (*BlobDataSetMapping, bool) { - return nil, false -} - -// AsBlobFolderDataSetMapping is the BasicDataSetMapping implementation for DataSetMapping. -func (dsm DataSetMapping) AsBlobFolderDataSetMapping() (*BlobFolderDataSetMapping, bool) { - return nil, false -} - -// AsKustoClusterDataSetMapping is the BasicDataSetMapping implementation for DataSetMapping. -func (dsm DataSetMapping) AsKustoClusterDataSetMapping() (*KustoClusterDataSetMapping, bool) { - return nil, false -} - -// AsKustoDatabaseDataSetMapping is the BasicDataSetMapping implementation for DataSetMapping. -func (dsm DataSetMapping) AsKustoDatabaseDataSetMapping() (*KustoDatabaseDataSetMapping, bool) { - return nil, false -} - -// AsSQLDBTableDataSetMapping is the BasicDataSetMapping implementation for DataSetMapping. -func (dsm DataSetMapping) AsSQLDBTableDataSetMapping() (*SQLDBTableDataSetMapping, bool) { - return nil, false -} - -// AsSQLDWTableDataSetMapping is the BasicDataSetMapping implementation for DataSetMapping. -func (dsm DataSetMapping) AsSQLDWTableDataSetMapping() (*SQLDWTableDataSetMapping, bool) { - return nil, false -} - -// AsDataSetMapping is the BasicDataSetMapping implementation for DataSetMapping. -func (dsm DataSetMapping) AsDataSetMapping() (*DataSetMapping, bool) { - return &dsm, true -} - -// AsBasicDataSetMapping is the BasicDataSetMapping implementation for DataSetMapping. -func (dsm DataSetMapping) AsBasicDataSetMapping() (BasicDataSetMapping, bool) { - return &dsm, true -} - -// DataSetMappingList list response for get DataSetMappings -type DataSetMappingList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]BasicDataSetMapping `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DataSetMappingList struct. -func (dsml *DataSetMappingList) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "nextLink": - if v != nil { - var nextLink string - err = json.Unmarshal(*v, &nextLink) - if err != nil { - return err - } - dsml.NextLink = &nextLink - } - case "value": - if v != nil { - value, err := unmarshalBasicDataSetMappingArray(*v) - if err != nil { - return err - } - dsml.Value = &value - } - } - } - - return nil -} - -// DataSetMappingListIterator provides access to a complete listing of DataSetMapping values. -type DataSetMappingListIterator struct { - i int - page DataSetMappingListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DataSetMappingListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataSetMappingListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DataSetMappingListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DataSetMappingListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DataSetMappingListIterator) Response() DataSetMappingList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DataSetMappingListIterator) Value() BasicDataSetMapping { - if !iter.page.NotDone() { - return DataSetMapping{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DataSetMappingListIterator type. -func NewDataSetMappingListIterator(page DataSetMappingListPage) DataSetMappingListIterator { - return DataSetMappingListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dsml DataSetMappingList) IsEmpty() bool { - return dsml.Value == nil || len(*dsml.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dsml DataSetMappingList) hasNextLink() bool { - return dsml.NextLink != nil && len(*dsml.NextLink) != 0 -} - -// dataSetMappingListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dsml DataSetMappingList) dataSetMappingListPreparer(ctx context.Context) (*http.Request, error) { - if !dsml.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dsml.NextLink))) -} - -// DataSetMappingListPage contains a page of BasicDataSetMapping values. -type DataSetMappingListPage struct { - fn func(context.Context, DataSetMappingList) (DataSetMappingList, error) - dsml DataSetMappingList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DataSetMappingListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataSetMappingListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dsml) - if err != nil { - return err - } - page.dsml = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DataSetMappingListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DataSetMappingListPage) NotDone() bool { - return !page.dsml.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DataSetMappingListPage) Response() DataSetMappingList { - return page.dsml -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DataSetMappingListPage) Values() []BasicDataSetMapping { - if page.dsml.IsEmpty() { - return nil - } - return *page.dsml.Value -} - -// Creates a new instance of the DataSetMappingListPage type. -func NewDataSetMappingListPage(cur DataSetMappingList, getNextPage func(context.Context, DataSetMappingList) (DataSetMappingList, error)) DataSetMappingListPage { - return DataSetMappingListPage{ - fn: getNextPage, - dsml: cur, - } -} - -// DataSetMappingModel ... -type DataSetMappingModel struct { - autorest.Response `json:"-"` - Value BasicDataSetMapping `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DataSetMappingModel struct. -func (dsmm *DataSetMappingModel) UnmarshalJSON(body []byte) error { - dsm, err := unmarshalBasicDataSetMapping(body) - if err != nil { - return err - } - dsmm.Value = dsm - - return nil -} - -// DataSetModel ... -type DataSetModel struct { - autorest.Response `json:"-"` - Value BasicDataSet `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DataSetModel struct. -func (dsm *DataSetModel) UnmarshalJSON(body []byte) error { - ds, err := unmarshalBasicDataSet(body) - if err != nil { - return err - } - dsm.Value = ds - - return nil -} - -// DataSetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DataSetsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DataSetsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DataSetsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DataSetsDeleteFuture.Result. -func (future *DataSetsDeleteFuture) result(client DataSetsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.DataSetsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datashare.DataSetsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DefaultDto base data transfer object implementation for default resources. -type DefaultDto struct { - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Location - Location of the azure resource. - Location *string `json:"location,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Tags - Tags on the azure resource. - Tags map[string]*string `json:"tags"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DefaultDto. -func (dd DefaultDto) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dd.Location != nil { - objectMap["location"] = dd.Location - } - if dd.Tags != nil { - objectMap["tags"] = dd.Tags - } - return json.Marshal(objectMap) -} - -// DimensionProperties properties for dimension -type DimensionProperties struct { - // DisplayName - localized display name of the dimension to customer - DisplayName *string `json:"displayName,omitempty"` - // Name - dimension name - Name *string `json:"name,omitempty"` -} - -// Error the data share error model. -type Error struct { - // Error - The data share error body - Error *ErrorInfo `json:"error,omitempty"` -} - -// ErrorInfo the data share error body model. -type ErrorInfo struct { - // Code - Code of the error - Code *string `json:"code,omitempty"` - // Details - Nested details of the error model - Details *[]ErrorInfo `json:"details,omitempty"` - // Message - Message of the error - Message *string `json:"message,omitempty"` - // Target - Target of the error - Target *string `json:"target,omitempty"` -} - -// Identity identity of resource -type Identity struct { - // PrincipalID - READ-ONLY; service principal Id - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; Tenant Id - TenantID *string `json:"tenantId,omitempty"` - // Type - Identity Type. Possible values include: 'SystemAssigned' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if i.Type != "" { - objectMap["type"] = i.Type - } - return json.Marshal(objectMap) -} - -// Invitation a Invitation data transfer object. -type Invitation struct { - autorest.Response `json:"-"` - // InvitationProperties - Properties on the Invitation - *InvitationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Invitation. -func (i Invitation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if i.InvitationProperties != nil { - objectMap["properties"] = i.InvitationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Invitation struct. -func (i *Invitation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var invitationProperties InvitationProperties - err = json.Unmarshal(*v, &invitationProperties) - if err != nil { - return err - } - i.InvitationProperties = &invitationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - i.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - i.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - i.Type = &typeVar - } - } - } - - return nil -} - -// InvitationList list response for get InvitationList -type InvitationList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]Invitation `json:"value,omitempty"` -} - -// InvitationListIterator provides access to a complete listing of Invitation values. -type InvitationListIterator struct { - i int - page InvitationListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *InvitationListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvitationListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *InvitationListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter InvitationListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter InvitationListIterator) Response() InvitationList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter InvitationListIterator) Value() Invitation { - if !iter.page.NotDone() { - return Invitation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the InvitationListIterator type. -func NewInvitationListIterator(page InvitationListPage) InvitationListIterator { - return InvitationListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (il InvitationList) IsEmpty() bool { - return il.Value == nil || len(*il.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (il InvitationList) hasNextLink() bool { - return il.NextLink != nil && len(*il.NextLink) != 0 -} - -// invitationListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (il InvitationList) invitationListPreparer(ctx context.Context) (*http.Request, error) { - if !il.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(il.NextLink))) -} - -// InvitationListPage contains a page of Invitation values. -type InvitationListPage struct { - fn func(context.Context, InvitationList) (InvitationList, error) - il InvitationList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *InvitationListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvitationListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.il) - if err != nil { - return err - } - page.il = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *InvitationListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page InvitationListPage) NotDone() bool { - return !page.il.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page InvitationListPage) Response() InvitationList { - return page.il -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page InvitationListPage) Values() []Invitation { - if page.il.IsEmpty() { - return nil - } - return *page.il.Value -} - -// Creates a new instance of the InvitationListPage type. -func NewInvitationListPage(cur InvitationList, getNextPage func(context.Context, InvitationList) (InvitationList, error)) InvitationListPage { - return InvitationListPage{ - fn: getNextPage, - il: cur, - } -} - -// InvitationProperties invitation property bag. -type InvitationProperties struct { - // InvitationID - READ-ONLY; unique invitation id - InvitationID *string `json:"invitationId,omitempty"` - // InvitationStatus - READ-ONLY; The status of the invitation. Possible values include: 'Pending', 'Accepted', 'Rejected', 'Withdrawn' - InvitationStatus InvitationStatus `json:"invitationStatus,omitempty"` - // RespondedAt - READ-ONLY; The time the recipient responded to the invitation. - RespondedAt *date.Time `json:"respondedAt,omitempty"` - // SentAt - READ-ONLY; Gets the time at which the invitation was sent. - SentAt *date.Time `json:"sentAt,omitempty"` - // TargetActiveDirectoryID - The target Azure AD Id. Can't be combined with email. - TargetActiveDirectoryID *string `json:"targetActiveDirectoryId,omitempty"` - // TargetEmail - The email the invitation is directed to. - TargetEmail *string `json:"targetEmail,omitempty"` - // TargetObjectID - The target user or application Id that invitation is being sent to. - // Must be specified along TargetActiveDirectoryId. This enables sending - // invitations to specific users or applications in an AD tenant. - TargetObjectID *string `json:"targetObjectId,omitempty"` - // UserEmail - READ-ONLY; Email of the user who created the resource - UserEmail *string `json:"userEmail,omitempty"` - // UserName - READ-ONLY; Name of the user who created the resource - UserName *string `json:"userName,omitempty"` -} - -// MarshalJSON is the custom marshaler for InvitationProperties. -func (IP InvitationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if IP.TargetActiveDirectoryID != nil { - objectMap["targetActiveDirectoryId"] = IP.TargetActiveDirectoryID - } - if IP.TargetEmail != nil { - objectMap["targetEmail"] = IP.TargetEmail - } - if IP.TargetObjectID != nil { - objectMap["targetObjectId"] = IP.TargetObjectID - } - return json.Marshal(objectMap) -} - -// KustoClusterDataSet a kusto cluster data set. -type KustoClusterDataSet struct { - // KustoClusterDataSetProperties - Kusto cluster data set properties. - *KustoClusterDataSetProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindDataSet', 'KindAdlsGen1File', 'KindAdlsGen1Folder', 'KindAdlsGen2File', 'KindAdlsGen2FileSystem', 'KindAdlsGen2Folder', 'KindContainer', 'KindBlob', 'KindBlobFolder', 'KindKustoCluster', 'KindKustoDatabase', 'KindSQLDBTable', 'KindSQLDWTable' - Kind Kind `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for KustoClusterDataSet. -func (kcds KustoClusterDataSet) MarshalJSON() ([]byte, error) { - kcds.Kind = KindKustoCluster - objectMap := make(map[string]interface{}) - if kcds.KustoClusterDataSetProperties != nil { - objectMap["properties"] = kcds.KustoClusterDataSetProperties - } - if kcds.Kind != "" { - objectMap["kind"] = kcds.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen1FileDataSet is the BasicDataSet implementation for KustoClusterDataSet. -func (kcds KustoClusterDataSet) AsADLSGen1FileDataSet() (*ADLSGen1FileDataSet, bool) { - return nil, false -} - -// AsADLSGen1FolderDataSet is the BasicDataSet implementation for KustoClusterDataSet. -func (kcds KustoClusterDataSet) AsADLSGen1FolderDataSet() (*ADLSGen1FolderDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileDataSet is the BasicDataSet implementation for KustoClusterDataSet. -func (kcds KustoClusterDataSet) AsADLSGen2FileDataSet() (*ADLSGen2FileDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSet is the BasicDataSet implementation for KustoClusterDataSet. -func (kcds KustoClusterDataSet) AsADLSGen2FileSystemDataSet() (*ADLSGen2FileSystemDataSet, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSet is the BasicDataSet implementation for KustoClusterDataSet. -func (kcds KustoClusterDataSet) AsADLSGen2FolderDataSet() (*ADLSGen2FolderDataSet, bool) { - return nil, false -} - -// AsBlobContainerDataSet is the BasicDataSet implementation for KustoClusterDataSet. -func (kcds KustoClusterDataSet) AsBlobContainerDataSet() (*BlobContainerDataSet, bool) { - return nil, false -} - -// AsBlobDataSet is the BasicDataSet implementation for KustoClusterDataSet. -func (kcds KustoClusterDataSet) AsBlobDataSet() (*BlobDataSet, bool) { - return nil, false -} - -// AsBlobFolderDataSet is the BasicDataSet implementation for KustoClusterDataSet. -func (kcds KustoClusterDataSet) AsBlobFolderDataSet() (*BlobFolderDataSet, bool) { - return nil, false -} - -// AsKustoClusterDataSet is the BasicDataSet implementation for KustoClusterDataSet. -func (kcds KustoClusterDataSet) AsKustoClusterDataSet() (*KustoClusterDataSet, bool) { - return &kcds, true -} - -// AsKustoDatabaseDataSet is the BasicDataSet implementation for KustoClusterDataSet. -func (kcds KustoClusterDataSet) AsKustoDatabaseDataSet() (*KustoDatabaseDataSet, bool) { - return nil, false -} - -// AsSQLDBTableDataSet is the BasicDataSet implementation for KustoClusterDataSet. -func (kcds KustoClusterDataSet) AsSQLDBTableDataSet() (*SQLDBTableDataSet, bool) { - return nil, false -} - -// AsSQLDWTableDataSet is the BasicDataSet implementation for KustoClusterDataSet. -func (kcds KustoClusterDataSet) AsSQLDWTableDataSet() (*SQLDWTableDataSet, bool) { - return nil, false -} - -// AsDataSet is the BasicDataSet implementation for KustoClusterDataSet. -func (kcds KustoClusterDataSet) AsDataSet() (*DataSet, bool) { - return nil, false -} - -// AsBasicDataSet is the BasicDataSet implementation for KustoClusterDataSet. -func (kcds KustoClusterDataSet) AsBasicDataSet() (BasicDataSet, bool) { - return &kcds, true -} - -// UnmarshalJSON is the custom unmarshaler for KustoClusterDataSet struct. -func (kcds *KustoClusterDataSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var kustoClusterDataSetProperties KustoClusterDataSetProperties - err = json.Unmarshal(*v, &kustoClusterDataSetProperties) - if err != nil { - return err - } - kcds.KustoClusterDataSetProperties = &kustoClusterDataSetProperties - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - kcds.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - kcds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - kcds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - kcds.Type = &typeVar - } - } - } - - return nil -} - -// KustoClusterDataSetMapping a Kusto cluster data set mapping -type KustoClusterDataSetMapping struct { - // KustoClusterDataSetMappingProperties - Kusto cluster data set mapping properties. - *KustoClusterDataSetMappingProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindBasicDataSetMappingKindDataSetMapping', 'KindBasicDataSetMappingKindAdlsGen2File', 'KindBasicDataSetMappingKindAdlsGen2FileSystem', 'KindBasicDataSetMappingKindAdlsGen2Folder', 'KindBasicDataSetMappingKindContainer', 'KindBasicDataSetMappingKindBlob', 'KindBasicDataSetMappingKindBlobFolder', 'KindBasicDataSetMappingKindKustoCluster', 'KindBasicDataSetMappingKindKustoDatabase', 'KindBasicDataSetMappingKindSQLDBTable', 'KindBasicDataSetMappingKindSQLDWTable' - Kind KindBasicDataSetMapping `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for KustoClusterDataSetMapping. -func (kcdsm KustoClusterDataSetMapping) MarshalJSON() ([]byte, error) { - kcdsm.Kind = KindBasicDataSetMappingKindKustoCluster - objectMap := make(map[string]interface{}) - if kcdsm.KustoClusterDataSetMappingProperties != nil { - objectMap["properties"] = kcdsm.KustoClusterDataSetMappingProperties - } - if kcdsm.Kind != "" { - objectMap["kind"] = kcdsm.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen2FileDataSetMapping is the BasicDataSetMapping implementation for KustoClusterDataSetMapping. -func (kcdsm KustoClusterDataSetMapping) AsADLSGen2FileDataSetMapping() (*ADLSGen2FileDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSetMapping is the BasicDataSetMapping implementation for KustoClusterDataSetMapping. -func (kcdsm KustoClusterDataSetMapping) AsADLSGen2FileSystemDataSetMapping() (*ADLSGen2FileSystemDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSetMapping is the BasicDataSetMapping implementation for KustoClusterDataSetMapping. -func (kcdsm KustoClusterDataSetMapping) AsADLSGen2FolderDataSetMapping() (*ADLSGen2FolderDataSetMapping, bool) { - return nil, false -} - -// AsBlobContainerDataSetMapping is the BasicDataSetMapping implementation for KustoClusterDataSetMapping. -func (kcdsm KustoClusterDataSetMapping) AsBlobContainerDataSetMapping() (*BlobContainerDataSetMapping, bool) { - return nil, false -} - -// AsBlobDataSetMapping is the BasicDataSetMapping implementation for KustoClusterDataSetMapping. -func (kcdsm KustoClusterDataSetMapping) AsBlobDataSetMapping() (*BlobDataSetMapping, bool) { - return nil, false -} - -// AsBlobFolderDataSetMapping is the BasicDataSetMapping implementation for KustoClusterDataSetMapping. -func (kcdsm KustoClusterDataSetMapping) AsBlobFolderDataSetMapping() (*BlobFolderDataSetMapping, bool) { - return nil, false -} - -// AsKustoClusterDataSetMapping is the BasicDataSetMapping implementation for KustoClusterDataSetMapping. -func (kcdsm KustoClusterDataSetMapping) AsKustoClusterDataSetMapping() (*KustoClusterDataSetMapping, bool) { - return &kcdsm, true -} - -// AsKustoDatabaseDataSetMapping is the BasicDataSetMapping implementation for KustoClusterDataSetMapping. -func (kcdsm KustoClusterDataSetMapping) AsKustoDatabaseDataSetMapping() (*KustoDatabaseDataSetMapping, bool) { - return nil, false -} - -// AsSQLDBTableDataSetMapping is the BasicDataSetMapping implementation for KustoClusterDataSetMapping. -func (kcdsm KustoClusterDataSetMapping) AsSQLDBTableDataSetMapping() (*SQLDBTableDataSetMapping, bool) { - return nil, false -} - -// AsSQLDWTableDataSetMapping is the BasicDataSetMapping implementation for KustoClusterDataSetMapping. -func (kcdsm KustoClusterDataSetMapping) AsSQLDWTableDataSetMapping() (*SQLDWTableDataSetMapping, bool) { - return nil, false -} - -// AsDataSetMapping is the BasicDataSetMapping implementation for KustoClusterDataSetMapping. -func (kcdsm KustoClusterDataSetMapping) AsDataSetMapping() (*DataSetMapping, bool) { - return nil, false -} - -// AsBasicDataSetMapping is the BasicDataSetMapping implementation for KustoClusterDataSetMapping. -func (kcdsm KustoClusterDataSetMapping) AsBasicDataSetMapping() (BasicDataSetMapping, bool) { - return &kcdsm, true -} - -// UnmarshalJSON is the custom unmarshaler for KustoClusterDataSetMapping struct. -func (kcdsm *KustoClusterDataSetMapping) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var kustoClusterDataSetMappingProperties KustoClusterDataSetMappingProperties - err = json.Unmarshal(*v, &kustoClusterDataSetMappingProperties) - if err != nil { - return err - } - kcdsm.KustoClusterDataSetMappingProperties = &kustoClusterDataSetMappingProperties - } - case "kind": - if v != nil { - var kind KindBasicDataSetMapping - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - kcdsm.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - kcdsm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - kcdsm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - kcdsm.Type = &typeVar - } - } - } - - return nil -} - -// KustoClusterDataSetMappingProperties properties of the Kusto cluster data set mapping -type KustoClusterDataSetMappingProperties struct { - // DataSetID - The id of the source data set. - DataSetID *string `json:"dataSetId,omitempty"` - // DataSetMappingStatus - READ-ONLY; Gets the status of the data set mapping. Possible values include: 'Ok', 'Broken' - DataSetMappingStatus DataSetMappingStatus `json:"dataSetMappingStatus,omitempty"` - // KustoClusterResourceID - Resource id of the sink kusto cluster. - KustoClusterResourceID *string `json:"kustoClusterResourceId,omitempty"` - // Location - READ-ONLY; Location of the sink kusto cluster. - Location *string `json:"location,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the data set mapping. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for KustoClusterDataSetMappingProperties. -func (kcdsmp KustoClusterDataSetMappingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if kcdsmp.DataSetID != nil { - objectMap["dataSetId"] = kcdsmp.DataSetID - } - if kcdsmp.KustoClusterResourceID != nil { - objectMap["kustoClusterResourceId"] = kcdsmp.KustoClusterResourceID - } - return json.Marshal(objectMap) -} - -// KustoClusterDataSetProperties properties of the kusto cluster data set. -type KustoClusterDataSetProperties struct { - // DataSetID - READ-ONLY; Unique id for identifying a data set resource - DataSetID *string `json:"dataSetId,omitempty"` - // KustoClusterResourceID - Resource id of the kusto cluster. - KustoClusterResourceID *string `json:"kustoClusterResourceId,omitempty"` - // Location - READ-ONLY; Location of the kusto cluster. - Location *string `json:"location,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the kusto cluster data set. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for KustoClusterDataSetProperties. -func (kcdsp KustoClusterDataSetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if kcdsp.KustoClusterResourceID != nil { - objectMap["kustoClusterResourceId"] = kcdsp.KustoClusterResourceID - } - return json.Marshal(objectMap) -} - -// KustoDatabaseDataSet a kusto database data set. -type KustoDatabaseDataSet struct { - // KustoDatabaseDataSetProperties - Kusto database data set properties. - *KustoDatabaseDataSetProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindDataSet', 'KindAdlsGen1File', 'KindAdlsGen1Folder', 'KindAdlsGen2File', 'KindAdlsGen2FileSystem', 'KindAdlsGen2Folder', 'KindContainer', 'KindBlob', 'KindBlobFolder', 'KindKustoCluster', 'KindKustoDatabase', 'KindSQLDBTable', 'KindSQLDWTable' - Kind Kind `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for KustoDatabaseDataSet. -func (kdds KustoDatabaseDataSet) MarshalJSON() ([]byte, error) { - kdds.Kind = KindKustoDatabase - objectMap := make(map[string]interface{}) - if kdds.KustoDatabaseDataSetProperties != nil { - objectMap["properties"] = kdds.KustoDatabaseDataSetProperties - } - if kdds.Kind != "" { - objectMap["kind"] = kdds.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen1FileDataSet is the BasicDataSet implementation for KustoDatabaseDataSet. -func (kdds KustoDatabaseDataSet) AsADLSGen1FileDataSet() (*ADLSGen1FileDataSet, bool) { - return nil, false -} - -// AsADLSGen1FolderDataSet is the BasicDataSet implementation for KustoDatabaseDataSet. -func (kdds KustoDatabaseDataSet) AsADLSGen1FolderDataSet() (*ADLSGen1FolderDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileDataSet is the BasicDataSet implementation for KustoDatabaseDataSet. -func (kdds KustoDatabaseDataSet) AsADLSGen2FileDataSet() (*ADLSGen2FileDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSet is the BasicDataSet implementation for KustoDatabaseDataSet. -func (kdds KustoDatabaseDataSet) AsADLSGen2FileSystemDataSet() (*ADLSGen2FileSystemDataSet, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSet is the BasicDataSet implementation for KustoDatabaseDataSet. -func (kdds KustoDatabaseDataSet) AsADLSGen2FolderDataSet() (*ADLSGen2FolderDataSet, bool) { - return nil, false -} - -// AsBlobContainerDataSet is the BasicDataSet implementation for KustoDatabaseDataSet. -func (kdds KustoDatabaseDataSet) AsBlobContainerDataSet() (*BlobContainerDataSet, bool) { - return nil, false -} - -// AsBlobDataSet is the BasicDataSet implementation for KustoDatabaseDataSet. -func (kdds KustoDatabaseDataSet) AsBlobDataSet() (*BlobDataSet, bool) { - return nil, false -} - -// AsBlobFolderDataSet is the BasicDataSet implementation for KustoDatabaseDataSet. -func (kdds KustoDatabaseDataSet) AsBlobFolderDataSet() (*BlobFolderDataSet, bool) { - return nil, false -} - -// AsKustoClusterDataSet is the BasicDataSet implementation for KustoDatabaseDataSet. -func (kdds KustoDatabaseDataSet) AsKustoClusterDataSet() (*KustoClusterDataSet, bool) { - return nil, false -} - -// AsKustoDatabaseDataSet is the BasicDataSet implementation for KustoDatabaseDataSet. -func (kdds KustoDatabaseDataSet) AsKustoDatabaseDataSet() (*KustoDatabaseDataSet, bool) { - return &kdds, true -} - -// AsSQLDBTableDataSet is the BasicDataSet implementation for KustoDatabaseDataSet. -func (kdds KustoDatabaseDataSet) AsSQLDBTableDataSet() (*SQLDBTableDataSet, bool) { - return nil, false -} - -// AsSQLDWTableDataSet is the BasicDataSet implementation for KustoDatabaseDataSet. -func (kdds KustoDatabaseDataSet) AsSQLDWTableDataSet() (*SQLDWTableDataSet, bool) { - return nil, false -} - -// AsDataSet is the BasicDataSet implementation for KustoDatabaseDataSet. -func (kdds KustoDatabaseDataSet) AsDataSet() (*DataSet, bool) { - return nil, false -} - -// AsBasicDataSet is the BasicDataSet implementation for KustoDatabaseDataSet. -func (kdds KustoDatabaseDataSet) AsBasicDataSet() (BasicDataSet, bool) { - return &kdds, true -} - -// UnmarshalJSON is the custom unmarshaler for KustoDatabaseDataSet struct. -func (kdds *KustoDatabaseDataSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var kustoDatabaseDataSetProperties KustoDatabaseDataSetProperties - err = json.Unmarshal(*v, &kustoDatabaseDataSetProperties) - if err != nil { - return err - } - kdds.KustoDatabaseDataSetProperties = &kustoDatabaseDataSetProperties - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - kdds.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - kdds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - kdds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - kdds.Type = &typeVar - } - } - } - - return nil -} - -// KustoDatabaseDataSetMapping a Kusto database data set mapping -type KustoDatabaseDataSetMapping struct { - // KustoDatabaseDataSetMappingProperties - Kusto database data set mapping properties. - *KustoDatabaseDataSetMappingProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindBasicDataSetMappingKindDataSetMapping', 'KindBasicDataSetMappingKindAdlsGen2File', 'KindBasicDataSetMappingKindAdlsGen2FileSystem', 'KindBasicDataSetMappingKindAdlsGen2Folder', 'KindBasicDataSetMappingKindContainer', 'KindBasicDataSetMappingKindBlob', 'KindBasicDataSetMappingKindBlobFolder', 'KindBasicDataSetMappingKindKustoCluster', 'KindBasicDataSetMappingKindKustoDatabase', 'KindBasicDataSetMappingKindSQLDBTable', 'KindBasicDataSetMappingKindSQLDWTable' - Kind KindBasicDataSetMapping `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for KustoDatabaseDataSetMapping. -func (kddsm KustoDatabaseDataSetMapping) MarshalJSON() ([]byte, error) { - kddsm.Kind = KindBasicDataSetMappingKindKustoDatabase - objectMap := make(map[string]interface{}) - if kddsm.KustoDatabaseDataSetMappingProperties != nil { - objectMap["properties"] = kddsm.KustoDatabaseDataSetMappingProperties - } - if kddsm.Kind != "" { - objectMap["kind"] = kddsm.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen2FileDataSetMapping is the BasicDataSetMapping implementation for KustoDatabaseDataSetMapping. -func (kddsm KustoDatabaseDataSetMapping) AsADLSGen2FileDataSetMapping() (*ADLSGen2FileDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSetMapping is the BasicDataSetMapping implementation for KustoDatabaseDataSetMapping. -func (kddsm KustoDatabaseDataSetMapping) AsADLSGen2FileSystemDataSetMapping() (*ADLSGen2FileSystemDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSetMapping is the BasicDataSetMapping implementation for KustoDatabaseDataSetMapping. -func (kddsm KustoDatabaseDataSetMapping) AsADLSGen2FolderDataSetMapping() (*ADLSGen2FolderDataSetMapping, bool) { - return nil, false -} - -// AsBlobContainerDataSetMapping is the BasicDataSetMapping implementation for KustoDatabaseDataSetMapping. -func (kddsm KustoDatabaseDataSetMapping) AsBlobContainerDataSetMapping() (*BlobContainerDataSetMapping, bool) { - return nil, false -} - -// AsBlobDataSetMapping is the BasicDataSetMapping implementation for KustoDatabaseDataSetMapping. -func (kddsm KustoDatabaseDataSetMapping) AsBlobDataSetMapping() (*BlobDataSetMapping, bool) { - return nil, false -} - -// AsBlobFolderDataSetMapping is the BasicDataSetMapping implementation for KustoDatabaseDataSetMapping. -func (kddsm KustoDatabaseDataSetMapping) AsBlobFolderDataSetMapping() (*BlobFolderDataSetMapping, bool) { - return nil, false -} - -// AsKustoClusterDataSetMapping is the BasicDataSetMapping implementation for KustoDatabaseDataSetMapping. -func (kddsm KustoDatabaseDataSetMapping) AsKustoClusterDataSetMapping() (*KustoClusterDataSetMapping, bool) { - return nil, false -} - -// AsKustoDatabaseDataSetMapping is the BasicDataSetMapping implementation for KustoDatabaseDataSetMapping. -func (kddsm KustoDatabaseDataSetMapping) AsKustoDatabaseDataSetMapping() (*KustoDatabaseDataSetMapping, bool) { - return &kddsm, true -} - -// AsSQLDBTableDataSetMapping is the BasicDataSetMapping implementation for KustoDatabaseDataSetMapping. -func (kddsm KustoDatabaseDataSetMapping) AsSQLDBTableDataSetMapping() (*SQLDBTableDataSetMapping, bool) { - return nil, false -} - -// AsSQLDWTableDataSetMapping is the BasicDataSetMapping implementation for KustoDatabaseDataSetMapping. -func (kddsm KustoDatabaseDataSetMapping) AsSQLDWTableDataSetMapping() (*SQLDWTableDataSetMapping, bool) { - return nil, false -} - -// AsDataSetMapping is the BasicDataSetMapping implementation for KustoDatabaseDataSetMapping. -func (kddsm KustoDatabaseDataSetMapping) AsDataSetMapping() (*DataSetMapping, bool) { - return nil, false -} - -// AsBasicDataSetMapping is the BasicDataSetMapping implementation for KustoDatabaseDataSetMapping. -func (kddsm KustoDatabaseDataSetMapping) AsBasicDataSetMapping() (BasicDataSetMapping, bool) { - return &kddsm, true -} - -// UnmarshalJSON is the custom unmarshaler for KustoDatabaseDataSetMapping struct. -func (kddsm *KustoDatabaseDataSetMapping) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var kustoDatabaseDataSetMappingProperties KustoDatabaseDataSetMappingProperties - err = json.Unmarshal(*v, &kustoDatabaseDataSetMappingProperties) - if err != nil { - return err - } - kddsm.KustoDatabaseDataSetMappingProperties = &kustoDatabaseDataSetMappingProperties - } - case "kind": - if v != nil { - var kind KindBasicDataSetMapping - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - kddsm.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - kddsm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - kddsm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - kddsm.Type = &typeVar - } - } - } - - return nil -} - -// KustoDatabaseDataSetMappingProperties properties of the Kusto database data set mapping -type KustoDatabaseDataSetMappingProperties struct { - // DataSetID - The id of the source data set. - DataSetID *string `json:"dataSetId,omitempty"` - // DataSetMappingStatus - READ-ONLY; Gets the status of the data set mapping. Possible values include: 'Ok', 'Broken' - DataSetMappingStatus DataSetMappingStatus `json:"dataSetMappingStatus,omitempty"` - // KustoClusterResourceID - Resource id of the sink kusto cluster. - KustoClusterResourceID *string `json:"kustoClusterResourceId,omitempty"` - // Location - READ-ONLY; Location of the sink kusto cluster. - Location *string `json:"location,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the data set mapping. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for KustoDatabaseDataSetMappingProperties. -func (kddsmp KustoDatabaseDataSetMappingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if kddsmp.DataSetID != nil { - objectMap["dataSetId"] = kddsmp.DataSetID - } - if kddsmp.KustoClusterResourceID != nil { - objectMap["kustoClusterResourceId"] = kddsmp.KustoClusterResourceID - } - return json.Marshal(objectMap) -} - -// KustoDatabaseDataSetProperties properties of the kusto database data set. -type KustoDatabaseDataSetProperties struct { - // DataSetID - READ-ONLY; Unique id for identifying a data set resource - DataSetID *string `json:"dataSetId,omitempty"` - // KustoDatabaseResourceID - Resource id of the kusto database. - KustoDatabaseResourceID *string `json:"kustoDatabaseResourceId,omitempty"` - // Location - READ-ONLY; Location of the kusto cluster. - Location *string `json:"location,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the kusto database data set. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for KustoDatabaseDataSetProperties. -func (kddsp KustoDatabaseDataSetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if kddsp.KustoDatabaseResourceID != nil { - objectMap["kustoDatabaseResourceId"] = kddsp.KustoDatabaseResourceID - } - return json.Marshal(objectMap) -} - -// OperationList list response for get operations. -type OperationList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]OperationModel `json:"value,omitempty"` -} - -// OperationListIterator provides access to a complete listing of OperationModel values. -type OperationListIterator struct { - i int - page OperationListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListIterator) Response() OperationList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListIterator) Value() OperationModel { - if !iter.page.NotDone() { - return OperationModel{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListIterator type. -func NewOperationListIterator(page OperationListPage) OperationListIterator { - return OperationListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ol OperationList) IsEmpty() bool { - return ol.Value == nil || len(*ol.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ol OperationList) hasNextLink() bool { - return ol.NextLink != nil && len(*ol.NextLink) != 0 -} - -// operationListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) { - if !ol.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ol.NextLink))) -} - -// OperationListPage contains a page of OperationModel values. -type OperationListPage struct { - fn func(context.Context, OperationList) (OperationList, error) - ol OperationList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ol) - if err != nil { - return err - } - page.ol = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListPage) NotDone() bool { - return !page.ol.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListPage) Response() OperationList { - return page.ol -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListPage) Values() []OperationModel { - if page.ol.IsEmpty() { - return nil - } - return *page.ol.Value -} - -// Creates a new instance of the OperationListPage type. -func NewOperationListPage(cur OperationList, getNextPage func(context.Context, OperationList) (OperationList, error)) OperationListPage { - return OperationListPage{ - fn: getNextPage, - ol: cur, - } -} - -// OperationMetaLogSpecification log specifications for operation api -type OperationMetaLogSpecification struct { - // BlobDuration - blob duration of the log - BlobDuration *string `json:"blobDuration,omitempty"` - // DisplayName - localized name of the log category - DisplayName *string `json:"displayName,omitempty"` - // Name - name of the log category - Name *string `json:"name,omitempty"` -} - -// OperationMetaMetricSpecification metric specifications for the operation -type OperationMetaMetricSpecification struct { - // AggregationType - aggregation type of metric - AggregationType *string `json:"aggregationType,omitempty"` - // Dimensions - properties for dimension - Dimensions *[]DimensionProperties `json:"dimensions,omitempty"` - // DisplayDescription - description of the metric - DisplayDescription *string `json:"displayDescription,omitempty"` - // DisplayName - localized name of the metric - DisplayName *string `json:"displayName,omitempty"` - // EnableRegionalMdmAccount - enable regional mdm account - EnableRegionalMdmAccount *string `json:"enableRegionalMdmAccount,omitempty"` - // InternalMetricName - internal metric name - InternalMetricName *string `json:"internalMetricName,omitempty"` - // Name - name of the metric - Name *string `json:"name,omitempty"` - // ResourceIDDimensionNameOverride - dimension name use to replace resource id if specified - ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` - // SupportedAggregationTypes - supported aggregation types - SupportedAggregationTypes *[]string `json:"supportedAggregationTypes,omitempty"` - // SupportedTimeGrainTypes - supported time grain types - SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` - // Unit - units for the metric - Unit *string `json:"unit,omitempty"` -} - -// OperationMetaPropertyInfo properties on meta info -type OperationMetaPropertyInfo struct { - // ServiceSpecification - meta service specification - ServiceSpecification *OperationMetaServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// OperationMetaServiceSpecification the operation meta service specification -type OperationMetaServiceSpecification struct { - // LogSpecifications - log specifications for the operation - LogSpecifications *[]OperationMetaLogSpecification `json:"logSpecifications,omitempty"` - // MetricSpecifications - metric specifications for the operation - MetricSpecifications *[]OperationMetaMetricSpecification `json:"metricSpecifications,omitempty"` -} - -// OperationModel the response model for get operations -type OperationModel struct { - // Display - Properties on the operation - Display *OperationModelProperties `json:"display,omitempty"` - // Name - Operation name for display purposes - Name *string `json:"name,omitempty"` - // Origin - origin of the operation - Origin *string `json:"origin,omitempty"` - // OperationMetaPropertyInfo - properties for the operation meta info - *OperationMetaPropertyInfo `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationModel. -func (om OperationModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if om.Display != nil { - objectMap["display"] = om.Display - } - if om.Name != nil { - objectMap["name"] = om.Name - } - if om.Origin != nil { - objectMap["origin"] = om.Origin - } - if om.OperationMetaPropertyInfo != nil { - objectMap["properties"] = om.OperationMetaPropertyInfo - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationModel struct. -func (om *OperationModel) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "display": - if v != nil { - var display OperationModelProperties - err = json.Unmarshal(*v, &display) - if err != nil { - return err - } - om.Display = &display - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - om.Name = &name - } - case "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - om.Origin = &origin - } - case "properties": - if v != nil { - var operationMetaPropertyInfo OperationMetaPropertyInfo - err = json.Unmarshal(*v, &operationMetaPropertyInfo) - if err != nil { - return err - } - om.OperationMetaPropertyInfo = &operationMetaPropertyInfo - } - } - } - - return nil -} - -// OperationModelProperties properties on operations -type OperationModelProperties struct { - // Description - Description of the operation for display purposes - Description *string `json:"description,omitempty"` - // Operation - Name of the operation for display purposes - Operation *string `json:"operation,omitempty"` - // Provider - Name of the provider for display purposes - Provider *string `json:"provider,omitempty"` - // Resource - Name of the resource type for display purposes - Resource *string `json:"resource,omitempty"` -} - -// OperationResponse response for long running operation -type OperationResponse struct { - autorest.Response `json:"-"` - // EndTime - start time - EndTime *date.Time `json:"endTime,omitempty"` - // Error - The error property when status is failed. - Error *ErrorInfo `json:"error,omitempty"` - // StartTime - start time - StartTime *date.Time `json:"startTime,omitempty"` - // Status - Operation state of the long running operation. Possible values include: 'StatusAccepted', 'StatusInProgress', 'StatusTransientFailure', 'StatusSucceeded', 'StatusFailed', 'StatusCanceled' - Status Status `json:"status,omitempty"` -} - -// ProviderShareSubscription a provider side share subscription data transfer object. -type ProviderShareSubscription struct { - autorest.Response `json:"-"` - // ProviderShareSubscriptionProperties - properties of providerShareSubscription - *ProviderShareSubscriptionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProviderShareSubscription. -func (pss ProviderShareSubscription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pss.ProviderShareSubscriptionProperties != nil { - objectMap["properties"] = pss.ProviderShareSubscriptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ProviderShareSubscription struct. -func (pss *ProviderShareSubscription) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var providerShareSubscriptionProperties ProviderShareSubscriptionProperties - err = json.Unmarshal(*v, &providerShareSubscriptionProperties) - if err != nil { - return err - } - pss.ProviderShareSubscriptionProperties = &providerShareSubscriptionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pss.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pss.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pss.Type = &typeVar - } - } - } - - return nil -} - -// ProviderShareSubscriptionList list response for get ShareSubscription. -type ProviderShareSubscriptionList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]ProviderShareSubscription `json:"value,omitempty"` -} - -// ProviderShareSubscriptionListIterator provides access to a complete listing of ProviderShareSubscription -// values. -type ProviderShareSubscriptionListIterator struct { - i int - page ProviderShareSubscriptionListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ProviderShareSubscriptionListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderShareSubscriptionListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ProviderShareSubscriptionListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ProviderShareSubscriptionListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ProviderShareSubscriptionListIterator) Response() ProviderShareSubscriptionList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ProviderShareSubscriptionListIterator) Value() ProviderShareSubscription { - if !iter.page.NotDone() { - return ProviderShareSubscription{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ProviderShareSubscriptionListIterator type. -func NewProviderShareSubscriptionListIterator(page ProviderShareSubscriptionListPage) ProviderShareSubscriptionListIterator { - return ProviderShareSubscriptionListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pssl ProviderShareSubscriptionList) IsEmpty() bool { - return pssl.Value == nil || len(*pssl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pssl ProviderShareSubscriptionList) hasNextLink() bool { - return pssl.NextLink != nil && len(*pssl.NextLink) != 0 -} - -// providerShareSubscriptionListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pssl ProviderShareSubscriptionList) providerShareSubscriptionListPreparer(ctx context.Context) (*http.Request, error) { - if !pssl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pssl.NextLink))) -} - -// ProviderShareSubscriptionListPage contains a page of ProviderShareSubscription values. -type ProviderShareSubscriptionListPage struct { - fn func(context.Context, ProviderShareSubscriptionList) (ProviderShareSubscriptionList, error) - pssl ProviderShareSubscriptionList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ProviderShareSubscriptionListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderShareSubscriptionListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.pssl) - if err != nil { - return err - } - page.pssl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ProviderShareSubscriptionListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ProviderShareSubscriptionListPage) NotDone() bool { - return !page.pssl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ProviderShareSubscriptionListPage) Response() ProviderShareSubscriptionList { - return page.pssl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ProviderShareSubscriptionListPage) Values() []ProviderShareSubscription { - if page.pssl.IsEmpty() { - return nil - } - return *page.pssl.Value -} - -// Creates a new instance of the ProviderShareSubscriptionListPage type. -func NewProviderShareSubscriptionListPage(cur ProviderShareSubscriptionList, getNextPage func(context.Context, ProviderShareSubscriptionList) (ProviderShareSubscriptionList, error)) ProviderShareSubscriptionListPage { - return ProviderShareSubscriptionListPage{ - fn: getNextPage, - pssl: cur, - } -} - -// ProviderShareSubscriptionProperties provider share subscription properties -type ProviderShareSubscriptionProperties struct { - // ConsumerEmail - READ-ONLY; Email of the consumer who created the share subscription - ConsumerEmail *string `json:"consumerEmail,omitempty"` - // ConsumerName - READ-ONLY; Name of the consumer who created the share subscription - ConsumerName *string `json:"consumerName,omitempty"` - // ConsumerTenantName - READ-ONLY; Tenant name of the consumer who created the share subscription - ConsumerTenantName *string `json:"consumerTenantName,omitempty"` - // CreatedAt - READ-ONLY; created at - CreatedAt *date.Time `json:"createdAt,omitempty"` - // ProviderEmail - READ-ONLY; Email of the provider who created the share - ProviderEmail *string `json:"providerEmail,omitempty"` - // ProviderName - READ-ONLY; Name of the provider who created the share - ProviderName *string `json:"providerName,omitempty"` - // SharedAt - READ-ONLY; Shared at - SharedAt *date.Time `json:"sharedAt,omitempty"` - // ShareSubscriptionObjectID - READ-ONLY; share Subscription Object Id - ShareSubscriptionObjectID *string `json:"shareSubscriptionObjectId,omitempty"` - // ShareSubscriptionStatus - READ-ONLY; Gets the status of share subscription. Possible values include: 'Active', 'Revoked', 'SourceDeleted', 'Revoking' - ShareSubscriptionStatus ShareSubscriptionStatus `json:"shareSubscriptionStatus,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProviderShareSubscriptionProperties. -func (pssp ProviderShareSubscriptionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ProviderShareSubscriptionsRevokeFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ProviderShareSubscriptionsRevokeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ProviderShareSubscriptionsClient) (ProviderShareSubscription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ProviderShareSubscriptionsRevokeFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ProviderShareSubscriptionsRevokeFuture.Result. -func (future *ProviderShareSubscriptionsRevokeFuture) result(client ProviderShareSubscriptionsClient) (pss ProviderShareSubscription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsRevokeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pss.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datashare.ProviderShareSubscriptionsRevokeFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pss.Response.Response, err = future.GetResult(sender); err == nil && pss.Response.Response.StatusCode != http.StatusNoContent { - pss, err = client.RevokeResponder(pss.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsRevokeFuture", "Result", pss.Response.Response, "Failure responding to request") - } - } - return -} - -// ProxyDto base data transfer object implementation for proxy resources. -type ProxyDto struct { - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyDto. -func (pd ProxyDto) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ScheduledSourceShareSynchronizationSettingProperties a Scheduled source synchronization setting data -// transfer object. -type ScheduledSourceShareSynchronizationSettingProperties struct { - // RecurrenceInterval - Recurrence Interval. Possible values include: 'Hour', 'Day' - RecurrenceInterval RecurrenceInterval `json:"recurrenceInterval,omitempty"` - // SynchronizationTime - Synchronization time - SynchronizationTime *date.Time `json:"synchronizationTime,omitempty"` -} - -// ScheduledSourceSynchronizationSetting a type of synchronization setting based on schedule -type ScheduledSourceSynchronizationSetting struct { - // ScheduledSourceShareSynchronizationSettingProperties - Properties of scheduled synchronization - *ScheduledSourceShareSynchronizationSettingProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindSourceShareSynchronizationSetting', 'KindScheduleBased' - Kind KindBasicSourceShareSynchronizationSetting `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduledSourceSynchronizationSetting. -func (ssss ScheduledSourceSynchronizationSetting) MarshalJSON() ([]byte, error) { - ssss.Kind = KindScheduleBased - objectMap := make(map[string]interface{}) - if ssss.ScheduledSourceShareSynchronizationSettingProperties != nil { - objectMap["properties"] = ssss.ScheduledSourceShareSynchronizationSettingProperties - } - if ssss.Kind != "" { - objectMap["kind"] = ssss.Kind - } - return json.Marshal(objectMap) -} - -// AsScheduledSourceSynchronizationSetting is the BasicSourceShareSynchronizationSetting implementation for ScheduledSourceSynchronizationSetting. -func (ssss ScheduledSourceSynchronizationSetting) AsScheduledSourceSynchronizationSetting() (*ScheduledSourceSynchronizationSetting, bool) { - return &ssss, true -} - -// AsSourceShareSynchronizationSetting is the BasicSourceShareSynchronizationSetting implementation for ScheduledSourceSynchronizationSetting. -func (ssss ScheduledSourceSynchronizationSetting) AsSourceShareSynchronizationSetting() (*SourceShareSynchronizationSetting, bool) { - return nil, false -} - -// AsBasicSourceShareSynchronizationSetting is the BasicSourceShareSynchronizationSetting implementation for ScheduledSourceSynchronizationSetting. -func (ssss ScheduledSourceSynchronizationSetting) AsBasicSourceShareSynchronizationSetting() (BasicSourceShareSynchronizationSetting, bool) { - return &ssss, true -} - -// UnmarshalJSON is the custom unmarshaler for ScheduledSourceSynchronizationSetting struct. -func (ssss *ScheduledSourceSynchronizationSetting) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var scheduledSourceShareSynchronizationSettingProperties ScheduledSourceShareSynchronizationSettingProperties - err = json.Unmarshal(*v, &scheduledSourceShareSynchronizationSettingProperties) - if err != nil { - return err - } - ssss.ScheduledSourceShareSynchronizationSettingProperties = &scheduledSourceShareSynchronizationSettingProperties - } - case "kind": - if v != nil { - var kind KindBasicSourceShareSynchronizationSetting - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ssss.Kind = kind - } - } - } - - return nil -} - -// ScheduledSynchronizationSetting a type of synchronization setting based on schedule -type ScheduledSynchronizationSetting struct { - // ScheduledSynchronizationSettingProperties - Properties of scheduled synchronization - *ScheduledSynchronizationSettingProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` - // Kind - Possible values include: 'KindBasicSynchronizationSettingKindSynchronizationSetting', 'KindBasicSynchronizationSettingKindScheduleBased' - Kind KindBasicSynchronizationSetting `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduledSynchronizationSetting. -func (sss ScheduledSynchronizationSetting) MarshalJSON() ([]byte, error) { - sss.Kind = KindBasicSynchronizationSettingKindScheduleBased - objectMap := make(map[string]interface{}) - if sss.ScheduledSynchronizationSettingProperties != nil { - objectMap["properties"] = sss.ScheduledSynchronizationSettingProperties - } - if sss.Kind != "" { - objectMap["kind"] = sss.Kind - } - return json.Marshal(objectMap) -} - -// AsScheduledSynchronizationSetting is the BasicSynchronizationSetting implementation for ScheduledSynchronizationSetting. -func (sss ScheduledSynchronizationSetting) AsScheduledSynchronizationSetting() (*ScheduledSynchronizationSetting, bool) { - return &sss, true -} - -// AsSynchronizationSetting is the BasicSynchronizationSetting implementation for ScheduledSynchronizationSetting. -func (sss ScheduledSynchronizationSetting) AsSynchronizationSetting() (*SynchronizationSetting, bool) { - return nil, false -} - -// AsBasicSynchronizationSetting is the BasicSynchronizationSetting implementation for ScheduledSynchronizationSetting. -func (sss ScheduledSynchronizationSetting) AsBasicSynchronizationSetting() (BasicSynchronizationSetting, bool) { - return &sss, true -} - -// UnmarshalJSON is the custom unmarshaler for ScheduledSynchronizationSetting struct. -func (sss *ScheduledSynchronizationSetting) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var scheduledSynchronizationSettingProperties ScheduledSynchronizationSettingProperties - err = json.Unmarshal(*v, &scheduledSynchronizationSettingProperties) - if err != nil { - return err - } - sss.ScheduledSynchronizationSettingProperties = &scheduledSynchronizationSettingProperties - } - case "kind": - if v != nil { - var kind KindBasicSynchronizationSetting - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - sss.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sss.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sss.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sss.Type = &typeVar - } - } - } - - return nil -} - -// ScheduledSynchronizationSettingProperties a Scheduled synchronization setting data transfer object. -type ScheduledSynchronizationSettingProperties struct { - // CreatedAt - READ-ONLY; Time at which the synchronization setting was created. - CreatedAt *date.Time `json:"createdAt,omitempty"` - // ProvisioningState - READ-ONLY; Gets or sets the provisioning state. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // RecurrenceInterval - Recurrence Interval. Possible values include: 'Hour', 'Day' - RecurrenceInterval RecurrenceInterval `json:"recurrenceInterval,omitempty"` - // SynchronizationTime - Synchronization time - SynchronizationTime *date.Time `json:"synchronizationTime,omitempty"` - // UserName - READ-ONLY; Name of the user who created the synchronization setting. - UserName *string `json:"userName,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduledSynchronizationSettingProperties. -func (sssp ScheduledSynchronizationSettingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sssp.RecurrenceInterval != "" { - objectMap["recurrenceInterval"] = sssp.RecurrenceInterval - } - if sssp.SynchronizationTime != nil { - objectMap["synchronizationTime"] = sssp.SynchronizationTime - } - return json.Marshal(objectMap) -} - -// ScheduledTrigger a type of trigger based on schedule -type ScheduledTrigger struct { - // ScheduledTriggerProperties - Properties of scheduled synchronization - *ScheduledTriggerProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` - // Kind - Possible values include: 'KindBasicTriggerKindTrigger', 'KindBasicTriggerKindScheduleBased' - Kind KindBasicTrigger `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduledTrigger. -func (st ScheduledTrigger) MarshalJSON() ([]byte, error) { - st.Kind = KindBasicTriggerKindScheduleBased - objectMap := make(map[string]interface{}) - if st.ScheduledTriggerProperties != nil { - objectMap["properties"] = st.ScheduledTriggerProperties - } - if st.Kind != "" { - objectMap["kind"] = st.Kind - } - return json.Marshal(objectMap) -} - -// AsScheduledTrigger is the BasicTrigger implementation for ScheduledTrigger. -func (st ScheduledTrigger) AsScheduledTrigger() (*ScheduledTrigger, bool) { - return &st, true -} - -// AsTrigger is the BasicTrigger implementation for ScheduledTrigger. -func (st ScheduledTrigger) AsTrigger() (*Trigger, bool) { - return nil, false -} - -// AsBasicTrigger is the BasicTrigger implementation for ScheduledTrigger. -func (st ScheduledTrigger) AsBasicTrigger() (BasicTrigger, bool) { - return &st, true -} - -// UnmarshalJSON is the custom unmarshaler for ScheduledTrigger struct. -func (st *ScheduledTrigger) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var scheduledTriggerProperties ScheduledTriggerProperties - err = json.Unmarshal(*v, &scheduledTriggerProperties) - if err != nil { - return err - } - st.ScheduledTriggerProperties = &scheduledTriggerProperties - } - case "kind": - if v != nil { - var kind KindBasicTrigger - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - st.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - st.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - st.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - st.Type = &typeVar - } - } - } - - return nil -} - -// ScheduledTriggerProperties a Scheduled trigger data transfer object. -type ScheduledTriggerProperties struct { - // CreatedAt - READ-ONLY; Time at which the trigger was created. - CreatedAt *date.Time `json:"createdAt,omitempty"` - // ProvisioningState - READ-ONLY; Gets the provisioning state. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // RecurrenceInterval - Recurrence Interval. Possible values include: 'Hour', 'Day' - RecurrenceInterval RecurrenceInterval `json:"recurrenceInterval,omitempty"` - // SynchronizationMode - Synchronization mode. Possible values include: 'Incremental', 'FullSync' - SynchronizationMode SynchronizationMode `json:"synchronizationMode,omitempty"` - // SynchronizationTime - Synchronization time - SynchronizationTime *date.Time `json:"synchronizationTime,omitempty"` - // TriggerStatus - READ-ONLY; Gets the trigger state. Possible values include: 'TriggerStatusActive', 'TriggerStatusInactive', 'TriggerStatusSourceSynchronizationSettingDeleted' - TriggerStatus TriggerStatus `json:"triggerStatus,omitempty"` - // UserName - READ-ONLY; Name of the user who created the trigger. - UserName *string `json:"userName,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduledTriggerProperties. -func (stp ScheduledTriggerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stp.RecurrenceInterval != "" { - objectMap["recurrenceInterval"] = stp.RecurrenceInterval - } - if stp.SynchronizationMode != "" { - objectMap["synchronizationMode"] = stp.SynchronizationMode - } - if stp.SynchronizationTime != nil { - objectMap["synchronizationTime"] = stp.SynchronizationTime - } - return json.Marshal(objectMap) -} - -// Share a share data transfer object. -type Share struct { - autorest.Response `json:"-"` - // ShareProperties - Properties on the share - *ShareProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Share. -func (s Share) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.ShareProperties != nil { - objectMap["properties"] = s.ShareProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Share struct. -func (s *Share) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var shareProperties ShareProperties - err = json.Unmarshal(*v, &shareProperties) - if err != nil { - return err - } - s.ShareProperties = &shareProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - s.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - s.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - s.Type = &typeVar - } - } - } - - return nil -} - -// ShareList list response for get Shares. -type ShareList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]Share `json:"value,omitempty"` -} - -// ShareListIterator provides access to a complete listing of Share values. -type ShareListIterator struct { - i int - page ShareListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ShareListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ShareListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ShareListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ShareListIterator) Response() ShareList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ShareListIterator) Value() Share { - if !iter.page.NotDone() { - return Share{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ShareListIterator type. -func NewShareListIterator(page ShareListPage) ShareListIterator { - return ShareListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sl ShareList) IsEmpty() bool { - return sl.Value == nil || len(*sl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sl ShareList) hasNextLink() bool { - return sl.NextLink != nil && len(*sl.NextLink) != 0 -} - -// shareListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sl ShareList) shareListPreparer(ctx context.Context) (*http.Request, error) { - if !sl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sl.NextLink))) -} - -// ShareListPage contains a page of Share values. -type ShareListPage struct { - fn func(context.Context, ShareList) (ShareList, error) - sl ShareList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ShareListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sl) - if err != nil { - return err - } - page.sl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ShareListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ShareListPage) NotDone() bool { - return !page.sl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ShareListPage) Response() ShareList { - return page.sl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ShareListPage) Values() []Share { - if page.sl.IsEmpty() { - return nil - } - return *page.sl.Value -} - -// Creates a new instance of the ShareListPage type. -func NewShareListPage(cur ShareList, getNextPage func(context.Context, ShareList) (ShareList, error)) ShareListPage { - return ShareListPage{ - fn: getNextPage, - sl: cur, - } -} - -// ShareProperties share property bag. -type ShareProperties struct { - // CreatedAt - READ-ONLY; Time at which the share was created. - CreatedAt *date.Time `json:"createdAt,omitempty"` - // Description - Share description. - Description *string `json:"description,omitempty"` - // ProvisioningState - READ-ONLY; Gets or sets the provisioning state. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ShareKind - Share kind. Possible values include: 'CopyBased', 'InPlace' - ShareKind ShareKind `json:"shareKind,omitempty"` - // Terms - Share terms. - Terms *string `json:"terms,omitempty"` - // UserEmail - READ-ONLY; Email of the user who created the resource - UserEmail *string `json:"userEmail,omitempty"` - // UserName - READ-ONLY; Name of the user who created the resource - UserName *string `json:"userName,omitempty"` -} - -// MarshalJSON is the custom marshaler for ShareProperties. -func (sp ShareProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.Description != nil { - objectMap["description"] = sp.Description - } - if sp.ShareKind != "" { - objectMap["shareKind"] = sp.ShareKind - } - if sp.Terms != nil { - objectMap["terms"] = sp.Terms - } - return json.Marshal(objectMap) -} - -// SharesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type SharesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SharesClient) (OperationResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SharesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SharesDeleteFuture.Result. -func (future *SharesDeleteFuture) result(client SharesClient) (or OperationResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - or.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datashare.SharesDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if or.Response.Response, err = future.GetResult(sender); err == nil && or.Response.Response.StatusCode != http.StatusNoContent { - or, err = client.DeleteResponder(or.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesDeleteFuture", "Result", or.Response.Response, "Failure responding to request") - } - } - return -} - -// ShareSubscription a share subscription data transfer object. -type ShareSubscription struct { - autorest.Response `json:"-"` - // ShareSubscriptionProperties - Properties on the share subscription - *ShareSubscriptionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ShareSubscription. -func (ss ShareSubscription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ss.ShareSubscriptionProperties != nil { - objectMap["properties"] = ss.ShareSubscriptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ShareSubscription struct. -func (ss *ShareSubscription) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var shareSubscriptionProperties ShareSubscriptionProperties - err = json.Unmarshal(*v, &shareSubscriptionProperties) - if err != nil { - return err - } - ss.ShareSubscriptionProperties = &shareSubscriptionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ss.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ss.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ss.Type = &typeVar - } - } - } - - return nil -} - -// ShareSubscriptionList list response for get ShareSubscription. -type ShareSubscriptionList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]ShareSubscription `json:"value,omitempty"` -} - -// ShareSubscriptionListIterator provides access to a complete listing of ShareSubscription values. -type ShareSubscriptionListIterator struct { - i int - page ShareSubscriptionListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ShareSubscriptionListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ShareSubscriptionListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ShareSubscriptionListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ShareSubscriptionListIterator) Response() ShareSubscriptionList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ShareSubscriptionListIterator) Value() ShareSubscription { - if !iter.page.NotDone() { - return ShareSubscription{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ShareSubscriptionListIterator type. -func NewShareSubscriptionListIterator(page ShareSubscriptionListPage) ShareSubscriptionListIterator { - return ShareSubscriptionListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ssl ShareSubscriptionList) IsEmpty() bool { - return ssl.Value == nil || len(*ssl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ssl ShareSubscriptionList) hasNextLink() bool { - return ssl.NextLink != nil && len(*ssl.NextLink) != 0 -} - -// shareSubscriptionListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ssl ShareSubscriptionList) shareSubscriptionListPreparer(ctx context.Context) (*http.Request, error) { - if !ssl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ssl.NextLink))) -} - -// ShareSubscriptionListPage contains a page of ShareSubscription values. -type ShareSubscriptionListPage struct { - fn func(context.Context, ShareSubscriptionList) (ShareSubscriptionList, error) - ssl ShareSubscriptionList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ShareSubscriptionListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ssl) - if err != nil { - return err - } - page.ssl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ShareSubscriptionListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ShareSubscriptionListPage) NotDone() bool { - return !page.ssl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ShareSubscriptionListPage) Response() ShareSubscriptionList { - return page.ssl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ShareSubscriptionListPage) Values() []ShareSubscription { - if page.ssl.IsEmpty() { - return nil - } - return *page.ssl.Value -} - -// Creates a new instance of the ShareSubscriptionListPage type. -func NewShareSubscriptionListPage(cur ShareSubscriptionList, getNextPage func(context.Context, ShareSubscriptionList) (ShareSubscriptionList, error)) ShareSubscriptionListPage { - return ShareSubscriptionListPage{ - fn: getNextPage, - ssl: cur, - } -} - -// ShareSubscriptionProperties share subscription property bag. -type ShareSubscriptionProperties struct { - // CreatedAt - READ-ONLY; Time at which the share subscription was created. - CreatedAt *date.Time `json:"createdAt,omitempty"` - // InvitationID - The invitation id. - InvitationID *string `json:"invitationId,omitempty"` - // ProviderEmail - READ-ONLY; Email of the provider who created the resource - ProviderEmail *string `json:"providerEmail,omitempty"` - // ProviderName - READ-ONLY; Name of the provider who created the resource - ProviderName *string `json:"providerName,omitempty"` - // ProviderTenantName - READ-ONLY; Tenant name of the provider who created the resource - ProviderTenantName *string `json:"providerTenantName,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the share subscription. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ShareDescription - READ-ONLY; Description of share - ShareDescription *string `json:"shareDescription,omitempty"` - // ShareKind - READ-ONLY; Kind of share. Possible values include: 'CopyBased', 'InPlace' - ShareKind ShareKind `json:"shareKind,omitempty"` - // ShareName - READ-ONLY; Name of the share - ShareName *string `json:"shareName,omitempty"` - // ShareSubscriptionStatus - READ-ONLY; Gets the current status of share subscription. Possible values include: 'Active', 'Revoked', 'SourceDeleted', 'Revoking' - ShareSubscriptionStatus ShareSubscriptionStatus `json:"shareSubscriptionStatus,omitempty"` - // ShareTerms - READ-ONLY; Terms of a share - ShareTerms *string `json:"shareTerms,omitempty"` - // SourceShareLocation - Source share location. - SourceShareLocation *string `json:"sourceShareLocation,omitempty"` - // UserEmail - READ-ONLY; Email of the user who created the resource - UserEmail *string `json:"userEmail,omitempty"` - // UserName - READ-ONLY; Name of the user who created the resource - UserName *string `json:"userName,omitempty"` -} - -// MarshalJSON is the custom marshaler for ShareSubscriptionProperties. -func (ssp ShareSubscriptionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ssp.InvitationID != nil { - objectMap["invitationId"] = ssp.InvitationID - } - if ssp.SourceShareLocation != nil { - objectMap["sourceShareLocation"] = ssp.SourceShareLocation - } - return json.Marshal(objectMap) -} - -// ShareSubscriptionsCancelSynchronizationFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ShareSubscriptionsCancelSynchronizationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ShareSubscriptionsClient) (ShareSubscriptionSynchronization, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ShareSubscriptionsCancelSynchronizationFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ShareSubscriptionsCancelSynchronizationFuture.Result. -func (future *ShareSubscriptionsCancelSynchronizationFuture) result(client ShareSubscriptionsClient) (sss ShareSubscriptionSynchronization, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsCancelSynchronizationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sss.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datashare.ShareSubscriptionsCancelSynchronizationFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sss.Response.Response, err = future.GetResult(sender); err == nil && sss.Response.Response.StatusCode != http.StatusNoContent { - sss, err = client.CancelSynchronizationResponder(sss.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsCancelSynchronizationFuture", "Result", sss.Response.Response, "Failure responding to request") - } - } - return -} - -// ShareSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ShareSubscriptionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ShareSubscriptionsClient) (OperationResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ShareSubscriptionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ShareSubscriptionsDeleteFuture.Result. -func (future *ShareSubscriptionsDeleteFuture) result(client ShareSubscriptionsClient) (or OperationResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - or.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datashare.ShareSubscriptionsDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if or.Response.Response, err = future.GetResult(sender); err == nil && or.Response.Response.StatusCode != http.StatusNoContent { - or, err = client.DeleteResponder(or.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsDeleteFuture", "Result", or.Response.Response, "Failure responding to request") - } - } - return -} - -// ShareSubscriptionsSynchronizeMethodFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ShareSubscriptionsSynchronizeMethodFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ShareSubscriptionsClient) (ShareSubscriptionSynchronization, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ShareSubscriptionsSynchronizeMethodFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ShareSubscriptionsSynchronizeMethodFuture.Result. -func (future *ShareSubscriptionsSynchronizeMethodFuture) result(client ShareSubscriptionsClient) (sss ShareSubscriptionSynchronization, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsSynchronizeMethodFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sss.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datashare.ShareSubscriptionsSynchronizeMethodFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sss.Response.Response, err = future.GetResult(sender); err == nil && sss.Response.Response.StatusCode != http.StatusNoContent { - sss, err = client.SynchronizeMethodResponder(sss.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsSynchronizeMethodFuture", "Result", sss.Response.Response, "Failure responding to request") - } - } - return -} - -// ShareSubscriptionSynchronization a ShareSubscriptionSynchronization data transfer object. -type ShareSubscriptionSynchronization struct { - autorest.Response `json:"-"` - // DurationMs - READ-ONLY; Synchronization duration - DurationMs *int32 `json:"durationMs,omitempty"` - // EndTime - READ-ONLY; End time of synchronization - EndTime *date.Time `json:"endTime,omitempty"` - // Message - READ-ONLY; message of Synchronization - Message *string `json:"message,omitempty"` - // StartTime - READ-ONLY; start time of synchronization - StartTime *date.Time `json:"startTime,omitempty"` - // Status - READ-ONLY; Raw Status - Status *string `json:"status,omitempty"` - // SynchronizationID - Synchronization id - SynchronizationID *string `json:"synchronizationId,omitempty"` - // SynchronizationMode - READ-ONLY; Synchronization Mode. Possible values include: 'Incremental', 'FullSync' - SynchronizationMode SynchronizationMode `json:"synchronizationMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for ShareSubscriptionSynchronization. -func (sss ShareSubscriptionSynchronization) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sss.SynchronizationID != nil { - objectMap["synchronizationId"] = sss.SynchronizationID - } - return json.Marshal(objectMap) -} - -// ShareSubscriptionSynchronizationList a consumer side list of share subscription synchronizations -type ShareSubscriptionSynchronizationList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]ShareSubscriptionSynchronization `json:"value,omitempty"` -} - -// ShareSubscriptionSynchronizationListIterator provides access to a complete listing of -// ShareSubscriptionSynchronization values. -type ShareSubscriptionSynchronizationListIterator struct { - i int - page ShareSubscriptionSynchronizationListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ShareSubscriptionSynchronizationListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionSynchronizationListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ShareSubscriptionSynchronizationListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ShareSubscriptionSynchronizationListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ShareSubscriptionSynchronizationListIterator) Response() ShareSubscriptionSynchronizationList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ShareSubscriptionSynchronizationListIterator) Value() ShareSubscriptionSynchronization { - if !iter.page.NotDone() { - return ShareSubscriptionSynchronization{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ShareSubscriptionSynchronizationListIterator type. -func NewShareSubscriptionSynchronizationListIterator(page ShareSubscriptionSynchronizationListPage) ShareSubscriptionSynchronizationListIterator { - return ShareSubscriptionSynchronizationListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sssl ShareSubscriptionSynchronizationList) IsEmpty() bool { - return sssl.Value == nil || len(*sssl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sssl ShareSubscriptionSynchronizationList) hasNextLink() bool { - return sssl.NextLink != nil && len(*sssl.NextLink) != 0 -} - -// shareSubscriptionSynchronizationListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sssl ShareSubscriptionSynchronizationList) shareSubscriptionSynchronizationListPreparer(ctx context.Context) (*http.Request, error) { - if !sssl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sssl.NextLink))) -} - -// ShareSubscriptionSynchronizationListPage contains a page of ShareSubscriptionSynchronization values. -type ShareSubscriptionSynchronizationListPage struct { - fn func(context.Context, ShareSubscriptionSynchronizationList) (ShareSubscriptionSynchronizationList, error) - sssl ShareSubscriptionSynchronizationList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ShareSubscriptionSynchronizationListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionSynchronizationListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sssl) - if err != nil { - return err - } - page.sssl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ShareSubscriptionSynchronizationListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ShareSubscriptionSynchronizationListPage) NotDone() bool { - return !page.sssl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ShareSubscriptionSynchronizationListPage) Response() ShareSubscriptionSynchronizationList { - return page.sssl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ShareSubscriptionSynchronizationListPage) Values() []ShareSubscriptionSynchronization { - if page.sssl.IsEmpty() { - return nil - } - return *page.sssl.Value -} - -// Creates a new instance of the ShareSubscriptionSynchronizationListPage type. -func NewShareSubscriptionSynchronizationListPage(cur ShareSubscriptionSynchronizationList, getNextPage func(context.Context, ShareSubscriptionSynchronizationList) (ShareSubscriptionSynchronizationList, error)) ShareSubscriptionSynchronizationListPage { - return ShareSubscriptionSynchronizationListPage{ - fn: getNextPage, - sssl: cur, - } -} - -// ShareSynchronization a ShareSynchronization data transfer object. -type ShareSynchronization struct { - // ConsumerEmail - Email of the user who created the synchronization - ConsumerEmail *string `json:"consumerEmail,omitempty"` - // ConsumerName - Name of the user who created the synchronization - ConsumerName *string `json:"consumerName,omitempty"` - // ConsumerTenantName - Tenant name of the consumer who created the synchronization - ConsumerTenantName *string `json:"consumerTenantName,omitempty"` - // DurationMs - synchronization duration - DurationMs *int32 `json:"durationMs,omitempty"` - // EndTime - End time of synchronization - EndTime *date.Time `json:"endTime,omitempty"` - // Message - message of synchronization - Message *string `json:"message,omitempty"` - // StartTime - start time of synchronization - StartTime *date.Time `json:"startTime,omitempty"` - // Status - Raw Status - Status *string `json:"status,omitempty"` - // SynchronizationID - Synchronization id - SynchronizationID *string `json:"synchronizationId,omitempty"` - // SynchronizationMode - READ-ONLY; Synchronization mode. Possible values include: 'Incremental', 'FullSync' - SynchronizationMode SynchronizationMode `json:"synchronizationMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for ShareSynchronization. -func (ss ShareSynchronization) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ss.ConsumerEmail != nil { - objectMap["consumerEmail"] = ss.ConsumerEmail - } - if ss.ConsumerName != nil { - objectMap["consumerName"] = ss.ConsumerName - } - if ss.ConsumerTenantName != nil { - objectMap["consumerTenantName"] = ss.ConsumerTenantName - } - if ss.DurationMs != nil { - objectMap["durationMs"] = ss.DurationMs - } - if ss.EndTime != nil { - objectMap["endTime"] = ss.EndTime - } - if ss.Message != nil { - objectMap["message"] = ss.Message - } - if ss.StartTime != nil { - objectMap["startTime"] = ss.StartTime - } - if ss.Status != nil { - objectMap["status"] = ss.Status - } - if ss.SynchronizationID != nil { - objectMap["synchronizationId"] = ss.SynchronizationID - } - return json.Marshal(objectMap) -} - -// ShareSynchronizationList list response for get ShareSynchronization. -type ShareSynchronizationList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]ShareSynchronization `json:"value,omitempty"` -} - -// ShareSynchronizationListIterator provides access to a complete listing of ShareSynchronization values. -type ShareSynchronizationListIterator struct { - i int - page ShareSynchronizationListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ShareSynchronizationListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSynchronizationListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ShareSynchronizationListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ShareSynchronizationListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ShareSynchronizationListIterator) Response() ShareSynchronizationList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ShareSynchronizationListIterator) Value() ShareSynchronization { - if !iter.page.NotDone() { - return ShareSynchronization{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ShareSynchronizationListIterator type. -func NewShareSynchronizationListIterator(page ShareSynchronizationListPage) ShareSynchronizationListIterator { - return ShareSynchronizationListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ssl ShareSynchronizationList) IsEmpty() bool { - return ssl.Value == nil || len(*ssl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ssl ShareSynchronizationList) hasNextLink() bool { - return ssl.NextLink != nil && len(*ssl.NextLink) != 0 -} - -// shareSynchronizationListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ssl ShareSynchronizationList) shareSynchronizationListPreparer(ctx context.Context) (*http.Request, error) { - if !ssl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ssl.NextLink))) -} - -// ShareSynchronizationListPage contains a page of ShareSynchronization values. -type ShareSynchronizationListPage struct { - fn func(context.Context, ShareSynchronizationList) (ShareSynchronizationList, error) - ssl ShareSynchronizationList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ShareSynchronizationListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSynchronizationListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ssl) - if err != nil { - return err - } - page.ssl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ShareSynchronizationListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ShareSynchronizationListPage) NotDone() bool { - return !page.ssl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ShareSynchronizationListPage) Response() ShareSynchronizationList { - return page.ssl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ShareSynchronizationListPage) Values() []ShareSynchronization { - if page.ssl.IsEmpty() { - return nil - } - return *page.ssl.Value -} - -// Creates a new instance of the ShareSynchronizationListPage type. -func NewShareSynchronizationListPage(cur ShareSynchronizationList, getNextPage func(context.Context, ShareSynchronizationList) (ShareSynchronizationList, error)) ShareSynchronizationListPage { - return ShareSynchronizationListPage{ - fn: getNextPage, - ssl: cur, - } -} - -// BasicSourceShareSynchronizationSetting a view of synchronization setting added by the provider -type BasicSourceShareSynchronizationSetting interface { - AsScheduledSourceSynchronizationSetting() (*ScheduledSourceSynchronizationSetting, bool) - AsSourceShareSynchronizationSetting() (*SourceShareSynchronizationSetting, bool) -} - -// SourceShareSynchronizationSetting a view of synchronization setting added by the provider -type SourceShareSynchronizationSetting struct { - // Kind - Possible values include: 'KindSourceShareSynchronizationSetting', 'KindScheduleBased' - Kind KindBasicSourceShareSynchronizationSetting `json:"kind,omitempty"` -} - -func unmarshalBasicSourceShareSynchronizationSetting(body []byte) (BasicSourceShareSynchronizationSetting, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["kind"] { - case string(KindScheduleBased): - var ssss ScheduledSourceSynchronizationSetting - err := json.Unmarshal(body, &ssss) - return ssss, err - default: - var ssss SourceShareSynchronizationSetting - err := json.Unmarshal(body, &ssss) - return ssss, err - } -} -func unmarshalBasicSourceShareSynchronizationSettingArray(body []byte) ([]BasicSourceShareSynchronizationSetting, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - ssssArray := make([]BasicSourceShareSynchronizationSetting, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ssss, err := unmarshalBasicSourceShareSynchronizationSetting(*rawMessage) - if err != nil { - return nil, err - } - ssssArray[index] = ssss - } - return ssssArray, nil -} - -// MarshalJSON is the custom marshaler for SourceShareSynchronizationSetting. -func (ssss SourceShareSynchronizationSetting) MarshalJSON() ([]byte, error) { - ssss.Kind = KindSourceShareSynchronizationSetting - objectMap := make(map[string]interface{}) - if ssss.Kind != "" { - objectMap["kind"] = ssss.Kind - } - return json.Marshal(objectMap) -} - -// AsScheduledSourceSynchronizationSetting is the BasicSourceShareSynchronizationSetting implementation for SourceShareSynchronizationSetting. -func (ssss SourceShareSynchronizationSetting) AsScheduledSourceSynchronizationSetting() (*ScheduledSourceSynchronizationSetting, bool) { - return nil, false -} - -// AsSourceShareSynchronizationSetting is the BasicSourceShareSynchronizationSetting implementation for SourceShareSynchronizationSetting. -func (ssss SourceShareSynchronizationSetting) AsSourceShareSynchronizationSetting() (*SourceShareSynchronizationSetting, bool) { - return &ssss, true -} - -// AsBasicSourceShareSynchronizationSetting is the BasicSourceShareSynchronizationSetting implementation for SourceShareSynchronizationSetting. -func (ssss SourceShareSynchronizationSetting) AsBasicSourceShareSynchronizationSetting() (BasicSourceShareSynchronizationSetting, bool) { - return &ssss, true -} - -// SourceShareSynchronizationSettingList list response for get source share Synchronization settings -type SourceShareSynchronizationSettingList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]BasicSourceShareSynchronizationSetting `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for SourceShareSynchronizationSettingList struct. -func (ssssl *SourceShareSynchronizationSettingList) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "nextLink": - if v != nil { - var nextLink string - err = json.Unmarshal(*v, &nextLink) - if err != nil { - return err - } - ssssl.NextLink = &nextLink - } - case "value": - if v != nil { - value, err := unmarshalBasicSourceShareSynchronizationSettingArray(*v) - if err != nil { - return err - } - ssssl.Value = &value - } - } - } - - return nil -} - -// SourceShareSynchronizationSettingListIterator provides access to a complete listing of -// SourceShareSynchronizationSetting values. -type SourceShareSynchronizationSettingListIterator struct { - i int - page SourceShareSynchronizationSettingListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SourceShareSynchronizationSettingListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceShareSynchronizationSettingListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SourceShareSynchronizationSettingListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SourceShareSynchronizationSettingListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SourceShareSynchronizationSettingListIterator) Response() SourceShareSynchronizationSettingList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SourceShareSynchronizationSettingListIterator) Value() BasicSourceShareSynchronizationSetting { - if !iter.page.NotDone() { - return SourceShareSynchronizationSetting{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SourceShareSynchronizationSettingListIterator type. -func NewSourceShareSynchronizationSettingListIterator(page SourceShareSynchronizationSettingListPage) SourceShareSynchronizationSettingListIterator { - return SourceShareSynchronizationSettingListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ssssl SourceShareSynchronizationSettingList) IsEmpty() bool { - return ssssl.Value == nil || len(*ssssl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ssssl SourceShareSynchronizationSettingList) hasNextLink() bool { - return ssssl.NextLink != nil && len(*ssssl.NextLink) != 0 -} - -// sourceShareSynchronizationSettingListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ssssl SourceShareSynchronizationSettingList) sourceShareSynchronizationSettingListPreparer(ctx context.Context) (*http.Request, error) { - if !ssssl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ssssl.NextLink))) -} - -// SourceShareSynchronizationSettingListPage contains a page of BasicSourceShareSynchronizationSetting -// values. -type SourceShareSynchronizationSettingListPage struct { - fn func(context.Context, SourceShareSynchronizationSettingList) (SourceShareSynchronizationSettingList, error) - ssssl SourceShareSynchronizationSettingList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SourceShareSynchronizationSettingListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SourceShareSynchronizationSettingListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ssssl) - if err != nil { - return err - } - page.ssssl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SourceShareSynchronizationSettingListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SourceShareSynchronizationSettingListPage) NotDone() bool { - return !page.ssssl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SourceShareSynchronizationSettingListPage) Response() SourceShareSynchronizationSettingList { - return page.ssssl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SourceShareSynchronizationSettingListPage) Values() []BasicSourceShareSynchronizationSetting { - if page.ssssl.IsEmpty() { - return nil - } - return *page.ssssl.Value -} - -// Creates a new instance of the SourceShareSynchronizationSettingListPage type. -func NewSourceShareSynchronizationSettingListPage(cur SourceShareSynchronizationSettingList, getNextPage func(context.Context, SourceShareSynchronizationSettingList) (SourceShareSynchronizationSettingList, error)) SourceShareSynchronizationSettingListPage { - return SourceShareSynchronizationSettingListPage{ - fn: getNextPage, - ssssl: cur, - } -} - -// SQLDBTableDataSet a SQL DB table data set. -type SQLDBTableDataSet struct { - // SQLDBTableProperties - SQL DB table data set properties. - *SQLDBTableProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindDataSet', 'KindAdlsGen1File', 'KindAdlsGen1Folder', 'KindAdlsGen2File', 'KindAdlsGen2FileSystem', 'KindAdlsGen2Folder', 'KindContainer', 'KindBlob', 'KindBlobFolder', 'KindKustoCluster', 'KindKustoDatabase', 'KindSQLDBTable', 'KindSQLDWTable' - Kind Kind `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDBTableDataSet. -func (sdtds SQLDBTableDataSet) MarshalJSON() ([]byte, error) { - sdtds.Kind = KindSQLDBTable - objectMap := make(map[string]interface{}) - if sdtds.SQLDBTableProperties != nil { - objectMap["properties"] = sdtds.SQLDBTableProperties - } - if sdtds.Kind != "" { - objectMap["kind"] = sdtds.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen1FileDataSet is the BasicDataSet implementation for SQLDBTableDataSet. -func (sdtds SQLDBTableDataSet) AsADLSGen1FileDataSet() (*ADLSGen1FileDataSet, bool) { - return nil, false -} - -// AsADLSGen1FolderDataSet is the BasicDataSet implementation for SQLDBTableDataSet. -func (sdtds SQLDBTableDataSet) AsADLSGen1FolderDataSet() (*ADLSGen1FolderDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileDataSet is the BasicDataSet implementation for SQLDBTableDataSet. -func (sdtds SQLDBTableDataSet) AsADLSGen2FileDataSet() (*ADLSGen2FileDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSet is the BasicDataSet implementation for SQLDBTableDataSet. -func (sdtds SQLDBTableDataSet) AsADLSGen2FileSystemDataSet() (*ADLSGen2FileSystemDataSet, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSet is the BasicDataSet implementation for SQLDBTableDataSet. -func (sdtds SQLDBTableDataSet) AsADLSGen2FolderDataSet() (*ADLSGen2FolderDataSet, bool) { - return nil, false -} - -// AsBlobContainerDataSet is the BasicDataSet implementation for SQLDBTableDataSet. -func (sdtds SQLDBTableDataSet) AsBlobContainerDataSet() (*BlobContainerDataSet, bool) { - return nil, false -} - -// AsBlobDataSet is the BasicDataSet implementation for SQLDBTableDataSet. -func (sdtds SQLDBTableDataSet) AsBlobDataSet() (*BlobDataSet, bool) { - return nil, false -} - -// AsBlobFolderDataSet is the BasicDataSet implementation for SQLDBTableDataSet. -func (sdtds SQLDBTableDataSet) AsBlobFolderDataSet() (*BlobFolderDataSet, bool) { - return nil, false -} - -// AsKustoClusterDataSet is the BasicDataSet implementation for SQLDBTableDataSet. -func (sdtds SQLDBTableDataSet) AsKustoClusterDataSet() (*KustoClusterDataSet, bool) { - return nil, false -} - -// AsKustoDatabaseDataSet is the BasicDataSet implementation for SQLDBTableDataSet. -func (sdtds SQLDBTableDataSet) AsKustoDatabaseDataSet() (*KustoDatabaseDataSet, bool) { - return nil, false -} - -// AsSQLDBTableDataSet is the BasicDataSet implementation for SQLDBTableDataSet. -func (sdtds SQLDBTableDataSet) AsSQLDBTableDataSet() (*SQLDBTableDataSet, bool) { - return &sdtds, true -} - -// AsSQLDWTableDataSet is the BasicDataSet implementation for SQLDBTableDataSet. -func (sdtds SQLDBTableDataSet) AsSQLDWTableDataSet() (*SQLDWTableDataSet, bool) { - return nil, false -} - -// AsDataSet is the BasicDataSet implementation for SQLDBTableDataSet. -func (sdtds SQLDBTableDataSet) AsDataSet() (*DataSet, bool) { - return nil, false -} - -// AsBasicDataSet is the BasicDataSet implementation for SQLDBTableDataSet. -func (sdtds SQLDBTableDataSet) AsBasicDataSet() (BasicDataSet, bool) { - return &sdtds, true -} - -// UnmarshalJSON is the custom unmarshaler for SQLDBTableDataSet struct. -func (sdtds *SQLDBTableDataSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var sQLDBTableProperties SQLDBTableProperties - err = json.Unmarshal(*v, &sQLDBTableProperties) - if err != nil { - return err - } - sdtds.SQLDBTableProperties = &sQLDBTableProperties - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - sdtds.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdtds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdtds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdtds.Type = &typeVar - } - } - } - - return nil -} - -// SQLDBTableDataSetMapping a SQL DB Table data set mapping. -type SQLDBTableDataSetMapping struct { - // SQLDBTableDataSetMappingProperties - Sql DB data set mapping properties. - *SQLDBTableDataSetMappingProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindBasicDataSetMappingKindDataSetMapping', 'KindBasicDataSetMappingKindAdlsGen2File', 'KindBasicDataSetMappingKindAdlsGen2FileSystem', 'KindBasicDataSetMappingKindAdlsGen2Folder', 'KindBasicDataSetMappingKindContainer', 'KindBasicDataSetMappingKindBlob', 'KindBasicDataSetMappingKindBlobFolder', 'KindBasicDataSetMappingKindKustoCluster', 'KindBasicDataSetMappingKindKustoDatabase', 'KindBasicDataSetMappingKindSQLDBTable', 'KindBasicDataSetMappingKindSQLDWTable' - Kind KindBasicDataSetMapping `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDBTableDataSetMapping. -func (sdtdsm SQLDBTableDataSetMapping) MarshalJSON() ([]byte, error) { - sdtdsm.Kind = KindBasicDataSetMappingKindSQLDBTable - objectMap := make(map[string]interface{}) - if sdtdsm.SQLDBTableDataSetMappingProperties != nil { - objectMap["properties"] = sdtdsm.SQLDBTableDataSetMappingProperties - } - if sdtdsm.Kind != "" { - objectMap["kind"] = sdtdsm.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen2FileDataSetMapping is the BasicDataSetMapping implementation for SQLDBTableDataSetMapping. -func (sdtdsm SQLDBTableDataSetMapping) AsADLSGen2FileDataSetMapping() (*ADLSGen2FileDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSetMapping is the BasicDataSetMapping implementation for SQLDBTableDataSetMapping. -func (sdtdsm SQLDBTableDataSetMapping) AsADLSGen2FileSystemDataSetMapping() (*ADLSGen2FileSystemDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSetMapping is the BasicDataSetMapping implementation for SQLDBTableDataSetMapping. -func (sdtdsm SQLDBTableDataSetMapping) AsADLSGen2FolderDataSetMapping() (*ADLSGen2FolderDataSetMapping, bool) { - return nil, false -} - -// AsBlobContainerDataSetMapping is the BasicDataSetMapping implementation for SQLDBTableDataSetMapping. -func (sdtdsm SQLDBTableDataSetMapping) AsBlobContainerDataSetMapping() (*BlobContainerDataSetMapping, bool) { - return nil, false -} - -// AsBlobDataSetMapping is the BasicDataSetMapping implementation for SQLDBTableDataSetMapping. -func (sdtdsm SQLDBTableDataSetMapping) AsBlobDataSetMapping() (*BlobDataSetMapping, bool) { - return nil, false -} - -// AsBlobFolderDataSetMapping is the BasicDataSetMapping implementation for SQLDBTableDataSetMapping. -func (sdtdsm SQLDBTableDataSetMapping) AsBlobFolderDataSetMapping() (*BlobFolderDataSetMapping, bool) { - return nil, false -} - -// AsKustoClusterDataSetMapping is the BasicDataSetMapping implementation for SQLDBTableDataSetMapping. -func (sdtdsm SQLDBTableDataSetMapping) AsKustoClusterDataSetMapping() (*KustoClusterDataSetMapping, bool) { - return nil, false -} - -// AsKustoDatabaseDataSetMapping is the BasicDataSetMapping implementation for SQLDBTableDataSetMapping. -func (sdtdsm SQLDBTableDataSetMapping) AsKustoDatabaseDataSetMapping() (*KustoDatabaseDataSetMapping, bool) { - return nil, false -} - -// AsSQLDBTableDataSetMapping is the BasicDataSetMapping implementation for SQLDBTableDataSetMapping. -func (sdtdsm SQLDBTableDataSetMapping) AsSQLDBTableDataSetMapping() (*SQLDBTableDataSetMapping, bool) { - return &sdtdsm, true -} - -// AsSQLDWTableDataSetMapping is the BasicDataSetMapping implementation for SQLDBTableDataSetMapping. -func (sdtdsm SQLDBTableDataSetMapping) AsSQLDWTableDataSetMapping() (*SQLDWTableDataSetMapping, bool) { - return nil, false -} - -// AsDataSetMapping is the BasicDataSetMapping implementation for SQLDBTableDataSetMapping. -func (sdtdsm SQLDBTableDataSetMapping) AsDataSetMapping() (*DataSetMapping, bool) { - return nil, false -} - -// AsBasicDataSetMapping is the BasicDataSetMapping implementation for SQLDBTableDataSetMapping. -func (sdtdsm SQLDBTableDataSetMapping) AsBasicDataSetMapping() (BasicDataSetMapping, bool) { - return &sdtdsm, true -} - -// UnmarshalJSON is the custom unmarshaler for SQLDBTableDataSetMapping struct. -func (sdtdsm *SQLDBTableDataSetMapping) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var sQLDBTableDataSetMappingProperties SQLDBTableDataSetMappingProperties - err = json.Unmarshal(*v, &sQLDBTableDataSetMappingProperties) - if err != nil { - return err - } - sdtdsm.SQLDBTableDataSetMappingProperties = &sQLDBTableDataSetMappingProperties - } - case "kind": - if v != nil { - var kind KindBasicDataSetMapping - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - sdtdsm.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdtdsm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdtdsm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdtdsm.Type = &typeVar - } - } - } - - return nil -} - -// SQLDBTableDataSetMappingProperties properties of the SQL DB table data set mapping. -type SQLDBTableDataSetMappingProperties struct { - // DatabaseName - DatabaseName name of the sink data set - DatabaseName *string `json:"databaseName,omitempty"` - // DataSetID - The id of the source data set. - DataSetID *string `json:"dataSetId,omitempty"` - // DataSetMappingStatus - READ-ONLY; Gets the status of the data set mapping. Possible values include: 'Ok', 'Broken' - DataSetMappingStatus DataSetMappingStatus `json:"dataSetMappingStatus,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the data set mapping. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // SchemaName - Schema of the table. Default value is dbo. - SchemaName *string `json:"schemaName,omitempty"` - // SQLServerResourceID - Resource id of SQL server - SQLServerResourceID *string `json:"sqlServerResourceId,omitempty"` - // TableName - SQL DB table name. - TableName *string `json:"tableName,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDBTableDataSetMappingProperties. -func (sdtdsmp SQLDBTableDataSetMappingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdtdsmp.DatabaseName != nil { - objectMap["databaseName"] = sdtdsmp.DatabaseName - } - if sdtdsmp.DataSetID != nil { - objectMap["dataSetId"] = sdtdsmp.DataSetID - } - if sdtdsmp.SchemaName != nil { - objectMap["schemaName"] = sdtdsmp.SchemaName - } - if sdtdsmp.SQLServerResourceID != nil { - objectMap["sqlServerResourceId"] = sdtdsmp.SQLServerResourceID - } - if sdtdsmp.TableName != nil { - objectMap["tableName"] = sdtdsmp.TableName - } - return json.Marshal(objectMap) -} - -// SQLDBTableProperties properties of the SQL DB table data set. -type SQLDBTableProperties struct { - // DatabaseName - Database name of the source data set - DatabaseName *string `json:"databaseName,omitempty"` - // DataSetID - READ-ONLY; Unique id for identifying a data set resource - DataSetID *string `json:"dataSetId,omitempty"` - // SchemaName - Schema of the table. Default value is dbo. - SchemaName *string `json:"schemaName,omitempty"` - // SQLServerResourceID - Resource id of SQL server - SQLServerResourceID *string `json:"sqlServerResourceId,omitempty"` - // TableName - SQL DB table name. - TableName *string `json:"tableName,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDBTableProperties. -func (sdtp SQLDBTableProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdtp.DatabaseName != nil { - objectMap["databaseName"] = sdtp.DatabaseName - } - if sdtp.SchemaName != nil { - objectMap["schemaName"] = sdtp.SchemaName - } - if sdtp.SQLServerResourceID != nil { - objectMap["sqlServerResourceId"] = sdtp.SQLServerResourceID - } - if sdtp.TableName != nil { - objectMap["tableName"] = sdtp.TableName - } - return json.Marshal(objectMap) -} - -// SQLDWTableDataSet a SQL DW table data set. -type SQLDWTableDataSet struct { - // SQLDWTableProperties - SQL DW table data set properties. - *SQLDWTableProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindDataSet', 'KindAdlsGen1File', 'KindAdlsGen1Folder', 'KindAdlsGen2File', 'KindAdlsGen2FileSystem', 'KindAdlsGen2Folder', 'KindContainer', 'KindBlob', 'KindBlobFolder', 'KindKustoCluster', 'KindKustoDatabase', 'KindSQLDBTable', 'KindSQLDWTable' - Kind Kind `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDWTableDataSet. -func (sdtds SQLDWTableDataSet) MarshalJSON() ([]byte, error) { - sdtds.Kind = KindSQLDWTable - objectMap := make(map[string]interface{}) - if sdtds.SQLDWTableProperties != nil { - objectMap["properties"] = sdtds.SQLDWTableProperties - } - if sdtds.Kind != "" { - objectMap["kind"] = sdtds.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen1FileDataSet is the BasicDataSet implementation for SQLDWTableDataSet. -func (sdtds SQLDWTableDataSet) AsADLSGen1FileDataSet() (*ADLSGen1FileDataSet, bool) { - return nil, false -} - -// AsADLSGen1FolderDataSet is the BasicDataSet implementation for SQLDWTableDataSet. -func (sdtds SQLDWTableDataSet) AsADLSGen1FolderDataSet() (*ADLSGen1FolderDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileDataSet is the BasicDataSet implementation for SQLDWTableDataSet. -func (sdtds SQLDWTableDataSet) AsADLSGen2FileDataSet() (*ADLSGen2FileDataSet, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSet is the BasicDataSet implementation for SQLDWTableDataSet. -func (sdtds SQLDWTableDataSet) AsADLSGen2FileSystemDataSet() (*ADLSGen2FileSystemDataSet, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSet is the BasicDataSet implementation for SQLDWTableDataSet. -func (sdtds SQLDWTableDataSet) AsADLSGen2FolderDataSet() (*ADLSGen2FolderDataSet, bool) { - return nil, false -} - -// AsBlobContainerDataSet is the BasicDataSet implementation for SQLDWTableDataSet. -func (sdtds SQLDWTableDataSet) AsBlobContainerDataSet() (*BlobContainerDataSet, bool) { - return nil, false -} - -// AsBlobDataSet is the BasicDataSet implementation for SQLDWTableDataSet. -func (sdtds SQLDWTableDataSet) AsBlobDataSet() (*BlobDataSet, bool) { - return nil, false -} - -// AsBlobFolderDataSet is the BasicDataSet implementation for SQLDWTableDataSet. -func (sdtds SQLDWTableDataSet) AsBlobFolderDataSet() (*BlobFolderDataSet, bool) { - return nil, false -} - -// AsKustoClusterDataSet is the BasicDataSet implementation for SQLDWTableDataSet. -func (sdtds SQLDWTableDataSet) AsKustoClusterDataSet() (*KustoClusterDataSet, bool) { - return nil, false -} - -// AsKustoDatabaseDataSet is the BasicDataSet implementation for SQLDWTableDataSet. -func (sdtds SQLDWTableDataSet) AsKustoDatabaseDataSet() (*KustoDatabaseDataSet, bool) { - return nil, false -} - -// AsSQLDBTableDataSet is the BasicDataSet implementation for SQLDWTableDataSet. -func (sdtds SQLDWTableDataSet) AsSQLDBTableDataSet() (*SQLDBTableDataSet, bool) { - return nil, false -} - -// AsSQLDWTableDataSet is the BasicDataSet implementation for SQLDWTableDataSet. -func (sdtds SQLDWTableDataSet) AsSQLDWTableDataSet() (*SQLDWTableDataSet, bool) { - return &sdtds, true -} - -// AsDataSet is the BasicDataSet implementation for SQLDWTableDataSet. -func (sdtds SQLDWTableDataSet) AsDataSet() (*DataSet, bool) { - return nil, false -} - -// AsBasicDataSet is the BasicDataSet implementation for SQLDWTableDataSet. -func (sdtds SQLDWTableDataSet) AsBasicDataSet() (BasicDataSet, bool) { - return &sdtds, true -} - -// UnmarshalJSON is the custom unmarshaler for SQLDWTableDataSet struct. -func (sdtds *SQLDWTableDataSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var sQLDWTableProperties SQLDWTableProperties - err = json.Unmarshal(*v, &sQLDWTableProperties) - if err != nil { - return err - } - sdtds.SQLDWTableProperties = &sQLDWTableProperties - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - sdtds.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdtds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdtds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdtds.Type = &typeVar - } - } - } - - return nil -} - -// SQLDWTableDataSetMapping a SQL DW Table data set mapping. -type SQLDWTableDataSetMapping struct { - // SQLDWTableDataSetMappingProperties - Sql DW data set mapping properties. - *SQLDWTableDataSetMappingProperties `json:"properties,omitempty"` - // Kind - Possible values include: 'KindBasicDataSetMappingKindDataSetMapping', 'KindBasicDataSetMappingKindAdlsGen2File', 'KindBasicDataSetMappingKindAdlsGen2FileSystem', 'KindBasicDataSetMappingKindAdlsGen2Folder', 'KindBasicDataSetMappingKindContainer', 'KindBasicDataSetMappingKindBlob', 'KindBasicDataSetMappingKindBlobFolder', 'KindBasicDataSetMappingKindKustoCluster', 'KindBasicDataSetMappingKindKustoDatabase', 'KindBasicDataSetMappingKindSQLDBTable', 'KindBasicDataSetMappingKindSQLDWTable' - Kind KindBasicDataSetMapping `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDWTableDataSetMapping. -func (sdtdsm SQLDWTableDataSetMapping) MarshalJSON() ([]byte, error) { - sdtdsm.Kind = KindBasicDataSetMappingKindSQLDWTable - objectMap := make(map[string]interface{}) - if sdtdsm.SQLDWTableDataSetMappingProperties != nil { - objectMap["properties"] = sdtdsm.SQLDWTableDataSetMappingProperties - } - if sdtdsm.Kind != "" { - objectMap["kind"] = sdtdsm.Kind - } - return json.Marshal(objectMap) -} - -// AsADLSGen2FileDataSetMapping is the BasicDataSetMapping implementation for SQLDWTableDataSetMapping. -func (sdtdsm SQLDWTableDataSetMapping) AsADLSGen2FileDataSetMapping() (*ADLSGen2FileDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FileSystemDataSetMapping is the BasicDataSetMapping implementation for SQLDWTableDataSetMapping. -func (sdtdsm SQLDWTableDataSetMapping) AsADLSGen2FileSystemDataSetMapping() (*ADLSGen2FileSystemDataSetMapping, bool) { - return nil, false -} - -// AsADLSGen2FolderDataSetMapping is the BasicDataSetMapping implementation for SQLDWTableDataSetMapping. -func (sdtdsm SQLDWTableDataSetMapping) AsADLSGen2FolderDataSetMapping() (*ADLSGen2FolderDataSetMapping, bool) { - return nil, false -} - -// AsBlobContainerDataSetMapping is the BasicDataSetMapping implementation for SQLDWTableDataSetMapping. -func (sdtdsm SQLDWTableDataSetMapping) AsBlobContainerDataSetMapping() (*BlobContainerDataSetMapping, bool) { - return nil, false -} - -// AsBlobDataSetMapping is the BasicDataSetMapping implementation for SQLDWTableDataSetMapping. -func (sdtdsm SQLDWTableDataSetMapping) AsBlobDataSetMapping() (*BlobDataSetMapping, bool) { - return nil, false -} - -// AsBlobFolderDataSetMapping is the BasicDataSetMapping implementation for SQLDWTableDataSetMapping. -func (sdtdsm SQLDWTableDataSetMapping) AsBlobFolderDataSetMapping() (*BlobFolderDataSetMapping, bool) { - return nil, false -} - -// AsKustoClusterDataSetMapping is the BasicDataSetMapping implementation for SQLDWTableDataSetMapping. -func (sdtdsm SQLDWTableDataSetMapping) AsKustoClusterDataSetMapping() (*KustoClusterDataSetMapping, bool) { - return nil, false -} - -// AsKustoDatabaseDataSetMapping is the BasicDataSetMapping implementation for SQLDWTableDataSetMapping. -func (sdtdsm SQLDWTableDataSetMapping) AsKustoDatabaseDataSetMapping() (*KustoDatabaseDataSetMapping, bool) { - return nil, false -} - -// AsSQLDBTableDataSetMapping is the BasicDataSetMapping implementation for SQLDWTableDataSetMapping. -func (sdtdsm SQLDWTableDataSetMapping) AsSQLDBTableDataSetMapping() (*SQLDBTableDataSetMapping, bool) { - return nil, false -} - -// AsSQLDWTableDataSetMapping is the BasicDataSetMapping implementation for SQLDWTableDataSetMapping. -func (sdtdsm SQLDWTableDataSetMapping) AsSQLDWTableDataSetMapping() (*SQLDWTableDataSetMapping, bool) { - return &sdtdsm, true -} - -// AsDataSetMapping is the BasicDataSetMapping implementation for SQLDWTableDataSetMapping. -func (sdtdsm SQLDWTableDataSetMapping) AsDataSetMapping() (*DataSetMapping, bool) { - return nil, false -} - -// AsBasicDataSetMapping is the BasicDataSetMapping implementation for SQLDWTableDataSetMapping. -func (sdtdsm SQLDWTableDataSetMapping) AsBasicDataSetMapping() (BasicDataSetMapping, bool) { - return &sdtdsm, true -} - -// UnmarshalJSON is the custom unmarshaler for SQLDWTableDataSetMapping struct. -func (sdtdsm *SQLDWTableDataSetMapping) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var sQLDWTableDataSetMappingProperties SQLDWTableDataSetMappingProperties - err = json.Unmarshal(*v, &sQLDWTableDataSetMappingProperties) - if err != nil { - return err - } - sdtdsm.SQLDWTableDataSetMappingProperties = &sQLDWTableDataSetMappingProperties - } - case "kind": - if v != nil { - var kind KindBasicDataSetMapping - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - sdtdsm.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sdtdsm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sdtdsm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sdtdsm.Type = &typeVar - } - } - } - - return nil -} - -// SQLDWTableDataSetMappingProperties properties of the SQL DW table data set mapping. -type SQLDWTableDataSetMappingProperties struct { - // DataSetID - The id of the source data set. - DataSetID *string `json:"dataSetId,omitempty"` - // DataSetMappingStatus - READ-ONLY; Gets the status of the data set mapping. Possible values include: 'Ok', 'Broken' - DataSetMappingStatus DataSetMappingStatus `json:"dataSetMappingStatus,omitempty"` - // DataWarehouseName - DataWarehouse name of the source data set - DataWarehouseName *string `json:"dataWarehouseName,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the data set mapping. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Moving', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // SchemaName - Schema of the table. Default value is dbo. - SchemaName *string `json:"schemaName,omitempty"` - // SQLServerResourceID - Resource id of SQL server - SQLServerResourceID *string `json:"sqlServerResourceId,omitempty"` - // TableName - SQL DW table name. - TableName *string `json:"tableName,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDWTableDataSetMappingProperties. -func (sdtdsmp SQLDWTableDataSetMappingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdtdsmp.DataSetID != nil { - objectMap["dataSetId"] = sdtdsmp.DataSetID - } - if sdtdsmp.DataWarehouseName != nil { - objectMap["dataWarehouseName"] = sdtdsmp.DataWarehouseName - } - if sdtdsmp.SchemaName != nil { - objectMap["schemaName"] = sdtdsmp.SchemaName - } - if sdtdsmp.SQLServerResourceID != nil { - objectMap["sqlServerResourceId"] = sdtdsmp.SQLServerResourceID - } - if sdtdsmp.TableName != nil { - objectMap["tableName"] = sdtdsmp.TableName - } - return json.Marshal(objectMap) -} - -// SQLDWTableProperties properties of the SQL DW table data set. -type SQLDWTableProperties struct { - // DataSetID - READ-ONLY; Unique id for identifying a data set resource - DataSetID *string `json:"dataSetId,omitempty"` - // DataWarehouseName - DataWarehouse name of the source data set - DataWarehouseName *string `json:"dataWarehouseName,omitempty"` - // SchemaName - Schema of the table. Default value is dbo. - SchemaName *string `json:"schemaName,omitempty"` - // SQLServerResourceID - Resource id of SQL server - SQLServerResourceID *string `json:"sqlServerResourceId,omitempty"` - // TableName - SQL DW table name. - TableName *string `json:"tableName,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLDWTableProperties. -func (sdtp SQLDWTableProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdtp.DataWarehouseName != nil { - objectMap["dataWarehouseName"] = sdtp.DataWarehouseName - } - if sdtp.SchemaName != nil { - objectMap["schemaName"] = sdtp.SchemaName - } - if sdtp.SQLServerResourceID != nil { - objectMap["sqlServerResourceId"] = sdtp.SQLServerResourceID - } - if sdtp.TableName != nil { - objectMap["tableName"] = sdtp.TableName - } - return json.Marshal(objectMap) -} - -// SynchronizationDetails synchronization details at data set level -type SynchronizationDetails struct { - // DataSetID - READ-ONLY; Id of data set - DataSetID *string `json:"dataSetId,omitempty"` - // DataSetType - READ-ONLY; Type of the data set. Possible values include: 'Blob', 'Container', 'BlobFolder', 'AdlsGen2FileSystem', 'AdlsGen2Folder', 'AdlsGen2File', 'AdlsGen1Folder', 'AdlsGen1File', 'KustoCluster', 'KustoDatabase', 'SQLDBTable', 'SQLDWTable' - DataSetType DataSetType `json:"dataSetType,omitempty"` - // DurationMs - READ-ONLY; Duration of data set level copy - DurationMs *int32 `json:"durationMs,omitempty"` - // EndTime - READ-ONLY; End time of data set level copy - EndTime *date.Time `json:"endTime,omitempty"` - // FilesRead - READ-ONLY; The number of files read from the source data set - FilesRead *int64 `json:"filesRead,omitempty"` - // FilesWritten - READ-ONLY; The number of files written into the sink data set - FilesWritten *int64 `json:"filesWritten,omitempty"` - // Message - READ-ONLY; Error message if any - Message *string `json:"message,omitempty"` - // Name - READ-ONLY; Name of the data set - Name *string `json:"name,omitempty"` - // RowsCopied - READ-ONLY; The number of files copied into the sink data set - RowsCopied *int64 `json:"rowsCopied,omitempty"` - // RowsRead - READ-ONLY; The number of rows read from the source data set. - RowsRead *int64 `json:"rowsRead,omitempty"` - // SizeRead - READ-ONLY; The size of the data read from the source data set in bytes - SizeRead *int64 `json:"sizeRead,omitempty"` - // SizeWritten - READ-ONLY; The size of the data written into the sink data set in bytes - SizeWritten *int64 `json:"sizeWritten,omitempty"` - // StartTime - READ-ONLY; Start time of data set level copy - StartTime *date.Time `json:"startTime,omitempty"` - // Status - READ-ONLY; Raw Status - Status *string `json:"status,omitempty"` - // VCore - READ-ONLY; The vCore units consumed for the data set synchronization - VCore *int64 `json:"vCore,omitempty"` -} - -// MarshalJSON is the custom marshaler for SynchronizationDetails. -func (sd SynchronizationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SynchronizationDetailsList details of synchronization -type SynchronizationDetailsList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]SynchronizationDetails `json:"value,omitempty"` -} - -// SynchronizationDetailsListIterator provides access to a complete listing of SynchronizationDetails -// values. -type SynchronizationDetailsListIterator struct { - i int - page SynchronizationDetailsListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SynchronizationDetailsListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SynchronizationDetailsListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SynchronizationDetailsListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SynchronizationDetailsListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SynchronizationDetailsListIterator) Response() SynchronizationDetailsList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SynchronizationDetailsListIterator) Value() SynchronizationDetails { - if !iter.page.NotDone() { - return SynchronizationDetails{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SynchronizationDetailsListIterator type. -func NewSynchronizationDetailsListIterator(page SynchronizationDetailsListPage) SynchronizationDetailsListIterator { - return SynchronizationDetailsListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sdl SynchronizationDetailsList) IsEmpty() bool { - return sdl.Value == nil || len(*sdl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sdl SynchronizationDetailsList) hasNextLink() bool { - return sdl.NextLink != nil && len(*sdl.NextLink) != 0 -} - -// synchronizationDetailsListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sdl SynchronizationDetailsList) synchronizationDetailsListPreparer(ctx context.Context) (*http.Request, error) { - if !sdl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sdl.NextLink))) -} - -// SynchronizationDetailsListPage contains a page of SynchronizationDetails values. -type SynchronizationDetailsListPage struct { - fn func(context.Context, SynchronizationDetailsList) (SynchronizationDetailsList, error) - sdl SynchronizationDetailsList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SynchronizationDetailsListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SynchronizationDetailsListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sdl) - if err != nil { - return err - } - page.sdl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SynchronizationDetailsListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SynchronizationDetailsListPage) NotDone() bool { - return !page.sdl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SynchronizationDetailsListPage) Response() SynchronizationDetailsList { - return page.sdl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SynchronizationDetailsListPage) Values() []SynchronizationDetails { - if page.sdl.IsEmpty() { - return nil - } - return *page.sdl.Value -} - -// Creates a new instance of the SynchronizationDetailsListPage type. -func NewSynchronizationDetailsListPage(cur SynchronizationDetailsList, getNextPage func(context.Context, SynchronizationDetailsList) (SynchronizationDetailsList, error)) SynchronizationDetailsListPage { - return SynchronizationDetailsListPage{ - fn: getNextPage, - sdl: cur, - } -} - -// BasicSynchronizationSetting a Synchronization Setting data transfer object. -type BasicSynchronizationSetting interface { - AsScheduledSynchronizationSetting() (*ScheduledSynchronizationSetting, bool) - AsSynchronizationSetting() (*SynchronizationSetting, bool) -} - -// SynchronizationSetting a Synchronization Setting data transfer object. -type SynchronizationSetting struct { - autorest.Response `json:"-"` - // Kind - Possible values include: 'KindBasicSynchronizationSettingKindSynchronizationSetting', 'KindBasicSynchronizationSettingKindScheduleBased' - Kind KindBasicSynchronizationSetting `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -func unmarshalBasicSynchronizationSetting(body []byte) (BasicSynchronizationSetting, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["kind"] { - case string(KindBasicSynchronizationSettingKindScheduleBased): - var sss ScheduledSynchronizationSetting - err := json.Unmarshal(body, &sss) - return sss, err - default: - var ss SynchronizationSetting - err := json.Unmarshal(body, &ss) - return ss, err - } -} -func unmarshalBasicSynchronizationSettingArray(body []byte) ([]BasicSynchronizationSetting, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - ssArray := make([]BasicSynchronizationSetting, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ss, err := unmarshalBasicSynchronizationSetting(*rawMessage) - if err != nil { - return nil, err - } - ssArray[index] = ss - } - return ssArray, nil -} - -// MarshalJSON is the custom marshaler for SynchronizationSetting. -func (ss SynchronizationSetting) MarshalJSON() ([]byte, error) { - ss.Kind = KindBasicSynchronizationSettingKindSynchronizationSetting - objectMap := make(map[string]interface{}) - if ss.Kind != "" { - objectMap["kind"] = ss.Kind - } - return json.Marshal(objectMap) -} - -// AsScheduledSynchronizationSetting is the BasicSynchronizationSetting implementation for SynchronizationSetting. -func (ss SynchronizationSetting) AsScheduledSynchronizationSetting() (*ScheduledSynchronizationSetting, bool) { - return nil, false -} - -// AsSynchronizationSetting is the BasicSynchronizationSetting implementation for SynchronizationSetting. -func (ss SynchronizationSetting) AsSynchronizationSetting() (*SynchronizationSetting, bool) { - return &ss, true -} - -// AsBasicSynchronizationSetting is the BasicSynchronizationSetting implementation for SynchronizationSetting. -func (ss SynchronizationSetting) AsBasicSynchronizationSetting() (BasicSynchronizationSetting, bool) { - return &ss, true -} - -// SynchronizationSettingList list response for get Synchronization settings -type SynchronizationSettingList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]BasicSynchronizationSetting `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for SynchronizationSettingList struct. -func (ssl *SynchronizationSettingList) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "nextLink": - if v != nil { - var nextLink string - err = json.Unmarshal(*v, &nextLink) - if err != nil { - return err - } - ssl.NextLink = &nextLink - } - case "value": - if v != nil { - value, err := unmarshalBasicSynchronizationSettingArray(*v) - if err != nil { - return err - } - ssl.Value = &value - } - } - } - - return nil -} - -// SynchronizationSettingListIterator provides access to a complete listing of SynchronizationSetting -// values. -type SynchronizationSettingListIterator struct { - i int - page SynchronizationSettingListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SynchronizationSettingListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SynchronizationSettingListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SynchronizationSettingListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SynchronizationSettingListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SynchronizationSettingListIterator) Response() SynchronizationSettingList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SynchronizationSettingListIterator) Value() BasicSynchronizationSetting { - if !iter.page.NotDone() { - return SynchronizationSetting{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SynchronizationSettingListIterator type. -func NewSynchronizationSettingListIterator(page SynchronizationSettingListPage) SynchronizationSettingListIterator { - return SynchronizationSettingListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ssl SynchronizationSettingList) IsEmpty() bool { - return ssl.Value == nil || len(*ssl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ssl SynchronizationSettingList) hasNextLink() bool { - return ssl.NextLink != nil && len(*ssl.NextLink) != 0 -} - -// synchronizationSettingListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ssl SynchronizationSettingList) synchronizationSettingListPreparer(ctx context.Context) (*http.Request, error) { - if !ssl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ssl.NextLink))) -} - -// SynchronizationSettingListPage contains a page of BasicSynchronizationSetting values. -type SynchronizationSettingListPage struct { - fn func(context.Context, SynchronizationSettingList) (SynchronizationSettingList, error) - ssl SynchronizationSettingList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SynchronizationSettingListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SynchronizationSettingListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ssl) - if err != nil { - return err - } - page.ssl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SynchronizationSettingListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SynchronizationSettingListPage) NotDone() bool { - return !page.ssl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SynchronizationSettingListPage) Response() SynchronizationSettingList { - return page.ssl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SynchronizationSettingListPage) Values() []BasicSynchronizationSetting { - if page.ssl.IsEmpty() { - return nil - } - return *page.ssl.Value -} - -// Creates a new instance of the SynchronizationSettingListPage type. -func NewSynchronizationSettingListPage(cur SynchronizationSettingList, getNextPage func(context.Context, SynchronizationSettingList) (SynchronizationSettingList, error)) SynchronizationSettingListPage { - return SynchronizationSettingListPage{ - fn: getNextPage, - ssl: cur, - } -} - -// SynchronizationSettingModel ... -type SynchronizationSettingModel struct { - autorest.Response `json:"-"` - Value BasicSynchronizationSetting `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for SynchronizationSettingModel struct. -func (ssm *SynchronizationSettingModel) UnmarshalJSON(body []byte) error { - ss, err := unmarshalBasicSynchronizationSetting(body) - if err != nil { - return err - } - ssm.Value = ss - - return nil -} - -// SynchronizationSettingsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SynchronizationSettingsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SynchronizationSettingsClient) (OperationResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SynchronizationSettingsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SynchronizationSettingsDeleteFuture.Result. -func (future *SynchronizationSettingsDeleteFuture) result(client SynchronizationSettingsClient) (or OperationResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - or.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datashare.SynchronizationSettingsDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if or.Response.Response, err = future.GetResult(sender); err == nil && or.Response.Response.StatusCode != http.StatusNoContent { - or, err = client.DeleteResponder(or.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsDeleteFuture", "Result", or.Response.Response, "Failure responding to request") - } - } - return -} - -// Synchronize payload for the synchronizing the data. -type Synchronize struct { - // SynchronizationMode - Mode of synchronization used in triggers and snapshot sync. Incremental by default. Possible values include: 'Incremental', 'FullSync' - SynchronizationMode SynchronizationMode `json:"synchronizationMode,omitempty"` -} - -// BasicTrigger a Trigger data transfer object. -type BasicTrigger interface { - AsScheduledTrigger() (*ScheduledTrigger, bool) - AsTrigger() (*Trigger, bool) -} - -// Trigger a Trigger data transfer object. -type Trigger struct { - autorest.Response `json:"-"` - // Kind - Possible values include: 'KindBasicTriggerKindTrigger', 'KindBasicTriggerKindScheduleBased' - Kind KindBasicTrigger `json:"kind,omitempty"` - // ID - READ-ONLY; The resource id of the azure resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the azure resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the azure resource - Type *string `json:"type,omitempty"` -} - -func unmarshalBasicTrigger(body []byte) (BasicTrigger, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["kind"] { - case string(KindBasicTriggerKindScheduleBased): - var st ScheduledTrigger - err := json.Unmarshal(body, &st) - return st, err - default: - var t Trigger - err := json.Unmarshal(body, &t) - return t, err - } -} -func unmarshalBasicTriggerArray(body []byte) ([]BasicTrigger, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - tArray := make([]BasicTrigger, len(rawMessages)) - - for index, rawMessage := range rawMessages { - t, err := unmarshalBasicTrigger(*rawMessage) - if err != nil { - return nil, err - } - tArray[index] = t - } - return tArray, nil -} - -// MarshalJSON is the custom marshaler for Trigger. -func (t Trigger) MarshalJSON() ([]byte, error) { - t.Kind = KindBasicTriggerKindTrigger - objectMap := make(map[string]interface{}) - if t.Kind != "" { - objectMap["kind"] = t.Kind - } - return json.Marshal(objectMap) -} - -// AsScheduledTrigger is the BasicTrigger implementation for Trigger. -func (t Trigger) AsScheduledTrigger() (*ScheduledTrigger, bool) { - return nil, false -} - -// AsTrigger is the BasicTrigger implementation for Trigger. -func (t Trigger) AsTrigger() (*Trigger, bool) { - return &t, true -} - -// AsBasicTrigger is the BasicTrigger implementation for Trigger. -func (t Trigger) AsBasicTrigger() (BasicTrigger, bool) { - return &t, true -} - -// TriggerList list response for get triggers -type TriggerList struct { - autorest.Response `json:"-"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type DataTransferObjects. - Value *[]BasicTrigger `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for TriggerList struct. -func (tl *TriggerList) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "nextLink": - if v != nil { - var nextLink string - err = json.Unmarshal(*v, &nextLink) - if err != nil { - return err - } - tl.NextLink = &nextLink - } - case "value": - if v != nil { - value, err := unmarshalBasicTriggerArray(*v) - if err != nil { - return err - } - tl.Value = &value - } - } - } - - return nil -} - -// TriggerListIterator provides access to a complete listing of Trigger values. -type TriggerListIterator struct { - i int - page TriggerListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *TriggerListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TriggerListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *TriggerListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TriggerListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter TriggerListIterator) Response() TriggerList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter TriggerListIterator) Value() BasicTrigger { - if !iter.page.NotDone() { - return Trigger{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TriggerListIterator type. -func NewTriggerListIterator(page TriggerListPage) TriggerListIterator { - return TriggerListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tl TriggerList) IsEmpty() bool { - return tl.Value == nil || len(*tl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tl TriggerList) hasNextLink() bool { - return tl.NextLink != nil && len(*tl.NextLink) != 0 -} - -// triggerListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tl TriggerList) triggerListPreparer(ctx context.Context) (*http.Request, error) { - if !tl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tl.NextLink))) -} - -// TriggerListPage contains a page of BasicTrigger values. -type TriggerListPage struct { - fn func(context.Context, TriggerList) (TriggerList, error) - tl TriggerList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *TriggerListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TriggerListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.tl) - if err != nil { - return err - } - page.tl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *TriggerListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TriggerListPage) NotDone() bool { - return !page.tl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TriggerListPage) Response() TriggerList { - return page.tl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TriggerListPage) Values() []BasicTrigger { - if page.tl.IsEmpty() { - return nil - } - return *page.tl.Value -} - -// Creates a new instance of the TriggerListPage type. -func NewTriggerListPage(cur TriggerList, getNextPage func(context.Context, TriggerList) (TriggerList, error)) TriggerListPage { - return TriggerListPage{ - fn: getNextPage, - tl: cur, - } -} - -// TriggerModel ... -type TriggerModel struct { - autorest.Response `json:"-"` - Value BasicTrigger `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for TriggerModel struct. -func (tm *TriggerModel) UnmarshalJSON(body []byte) error { - t, err := unmarshalBasicTrigger(body) - if err != nil { - return err - } - tm.Value = t - - return nil -} - -// TriggersCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TriggersCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TriggersClient) (TriggerModel, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TriggersCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for TriggersCreateFuture.Result. -func (future *TriggersCreateFuture) result(client TriggersClient) (tm TriggerModel, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.TriggersCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datashare.TriggersCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tm.Response.Response, err = future.GetResult(sender); err == nil && tm.Response.Response.StatusCode != http.StatusNoContent { - tm, err = client.CreateResponder(tm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.TriggersCreateFuture", "Result", tm.Response.Response, "Failure responding to request") - } - } - return -} - -// TriggersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TriggersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(TriggersClient) (OperationResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *TriggersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for TriggersDeleteFuture.Result. -func (future *TriggersDeleteFuture) result(client TriggersClient) (or OperationResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.TriggersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - or.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("datashare.TriggersDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if or.Response.Response, err = future.GetResult(sender); err == nil && or.Response.Response.StatusCode != http.StatusNoContent { - or, err = client.DeleteResponder(or.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.TriggersDeleteFuture", "Result", or.Response.Response, "Failure responding to request") - } - } - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/operations.go deleted file mode 100644 index 52adc45d18fb..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package datashare - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the creates a Microsoft.DataShare management client. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list of available operations -func (client OperationsClient) List(ctx context.Context) (result OperationListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.ol.Response.Response != nil { - sc = result.ol.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.ol.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.ol, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.ol.hasNextLink() && result.ol.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DataShare/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationList) (result OperationList, err error) { - req, err := lastResults.operationListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/providersharesubscriptions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/providersharesubscriptions.go deleted file mode 100644 index 7bc14fb22fcd..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/providersharesubscriptions.go +++ /dev/null @@ -1,399 +0,0 @@ -package datashare - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ProviderShareSubscriptionsClient is the creates a Microsoft.DataShare management client. -type ProviderShareSubscriptionsClient struct { - BaseClient -} - -// NewProviderShareSubscriptionsClient creates an instance of the ProviderShareSubscriptionsClient client. -func NewProviderShareSubscriptionsClient(subscriptionID string) ProviderShareSubscriptionsClient { - return NewProviderShareSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProviderShareSubscriptionsClientWithBaseURI creates an instance of the ProviderShareSubscriptionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewProviderShareSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) ProviderShareSubscriptionsClient { - return ProviderShareSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByShare get share subscription in a provider share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// providerShareSubscriptionID - to locate shareSubscription -func (client ProviderShareSubscriptionsClient) GetByShare(ctx context.Context, resourceGroupName string, accountName string, shareName string, providerShareSubscriptionID string) (result ProviderShareSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderShareSubscriptionsClient.GetByShare") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetBySharePreparer(ctx, resourceGroupName, accountName, shareName, providerShareSubscriptionID) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsClient", "GetByShare", nil, "Failure preparing request") - return - } - - resp, err := client.GetByShareSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsClient", "GetByShare", resp, "Failure sending request") - return - } - - result, err = client.GetByShareResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsClient", "GetByShare", resp, "Failure responding to request") - return - } - - return -} - -// GetBySharePreparer prepares the GetByShare request. -func (client ProviderShareSubscriptionsClient) GetBySharePreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, providerShareSubscriptionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "providerShareSubscriptionId": autorest.Encode("path", providerShareSubscriptionID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByShareSender sends the GetByShare request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderShareSubscriptionsClient) GetByShareSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByShareResponder handles the response to the GetByShare request. The method always -// closes the http.Response Body. -func (client ProviderShareSubscriptionsClient) GetByShareResponder(resp *http.Response) (result ProviderShareSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByShare list share subscriptions in a provider share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// skipToken - continuation Token -func (client ProviderShareSubscriptionsClient) ListByShare(ctx context.Context, resourceGroupName string, accountName string, shareName string, skipToken string) (result ProviderShareSubscriptionListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderShareSubscriptionsClient.ListByShare") - defer func() { - sc := -1 - if result.pssl.Response.Response != nil { - sc = result.pssl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByShareNextResults - req, err := client.ListBySharePreparer(ctx, resourceGroupName, accountName, shareName, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsClient", "ListByShare", nil, "Failure preparing request") - return - } - - resp, err := client.ListByShareSender(req) - if err != nil { - result.pssl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsClient", "ListByShare", resp, "Failure sending request") - return - } - - result.pssl, err = client.ListByShareResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsClient", "ListByShare", resp, "Failure responding to request") - return - } - if result.pssl.hasNextLink() && result.pssl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySharePreparer prepares the ListByShare request. -func (client ProviderShareSubscriptionsClient) ListBySharePreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByShareSender sends the ListByShare request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderShareSubscriptionsClient) ListByShareSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByShareResponder handles the response to the ListByShare request. The method always -// closes the http.Response Body. -func (client ProviderShareSubscriptionsClient) ListByShareResponder(resp *http.Response) (result ProviderShareSubscriptionList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByShareNextResults retrieves the next set of results, if any. -func (client ProviderShareSubscriptionsClient) listByShareNextResults(ctx context.Context, lastResults ProviderShareSubscriptionList) (result ProviderShareSubscriptionList, err error) { - req, err := lastResults.providerShareSubscriptionListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsClient", "listByShareNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByShareSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsClient", "listByShareNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByShareResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsClient", "listByShareNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByShareComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProviderShareSubscriptionsClient) ListByShareComplete(ctx context.Context, resourceGroupName string, accountName string, shareName string, skipToken string) (result ProviderShareSubscriptionListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderShareSubscriptionsClient.ListByShare") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByShare(ctx, resourceGroupName, accountName, shareName, skipToken) - return -} - -// Reinstate reinstate share subscription in a provider share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// providerShareSubscriptionID - to locate shareSubscription -func (client ProviderShareSubscriptionsClient) Reinstate(ctx context.Context, resourceGroupName string, accountName string, shareName string, providerShareSubscriptionID string) (result ProviderShareSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderShareSubscriptionsClient.Reinstate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ReinstatePreparer(ctx, resourceGroupName, accountName, shareName, providerShareSubscriptionID) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsClient", "Reinstate", nil, "Failure preparing request") - return - } - - resp, err := client.ReinstateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsClient", "Reinstate", resp, "Failure sending request") - return - } - - result, err = client.ReinstateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsClient", "Reinstate", resp, "Failure responding to request") - return - } - - return -} - -// ReinstatePreparer prepares the Reinstate request. -func (client ProviderShareSubscriptionsClient) ReinstatePreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, providerShareSubscriptionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "providerShareSubscriptionId": autorest.Encode("path", providerShareSubscriptionID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}/reinstate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ReinstateSender sends the Reinstate request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderShareSubscriptionsClient) ReinstateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ReinstateResponder handles the response to the Reinstate request. The method always -// closes the http.Response Body. -func (client ProviderShareSubscriptionsClient) ReinstateResponder(resp *http.Response) (result ProviderShareSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Revoke revoke share subscription in a provider share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// providerShareSubscriptionID - to locate shareSubscription -func (client ProviderShareSubscriptionsClient) Revoke(ctx context.Context, resourceGroupName string, accountName string, shareName string, providerShareSubscriptionID string) (result ProviderShareSubscriptionsRevokeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderShareSubscriptionsClient.Revoke") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RevokePreparer(ctx, resourceGroupName, accountName, shareName, providerShareSubscriptionID) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsClient", "Revoke", nil, "Failure preparing request") - return - } - - result, err = client.RevokeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ProviderShareSubscriptionsClient", "Revoke", result.Response(), "Failure sending request") - return - } - - return -} - -// RevokePreparer prepares the Revoke request. -func (client ProviderShareSubscriptionsClient) RevokePreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, providerShareSubscriptionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "providerShareSubscriptionId": autorest.Encode("path", providerShareSubscriptionID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}/revoke", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RevokeSender sends the Revoke request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderShareSubscriptionsClient) RevokeSender(req *http.Request) (future ProviderShareSubscriptionsRevokeFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RevokeResponder handles the response to the Revoke request. The method always -// closes the http.Response Body. -func (client ProviderShareSubscriptionsClient) RevokeResponder(resp *http.Response) (result ProviderShareSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/shares.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/shares.go deleted file mode 100644 index 59b000744ee8..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/shares.go +++ /dev/null @@ -1,669 +0,0 @@ -package datashare - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SharesClient is the creates a Microsoft.DataShare management client. -type SharesClient struct { - BaseClient -} - -// NewSharesClient creates an instance of the SharesClient client. -func NewSharesClient(subscriptionID string) SharesClient { - return NewSharesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSharesClientWithBaseURI creates an instance of the SharesClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSharesClientWithBaseURI(baseURI string, subscriptionID string) SharesClient { - return SharesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// share - the share payload -func (client SharesClient) Create(ctx context.Context, resourceGroupName string, accountName string, shareName string, share Share) (result Share, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SharesClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, shareName, share) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SharesClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, share Share) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}", pathParameters), - autorest.WithJSON(share), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client SharesClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client SharesClient) CreateResponder(resp *http.Response) (result Share, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -func (client SharesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, shareName string) (result SharesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SharesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, shareName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SharesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SharesClient) DeleteSender(req *http.Request) (future SharesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SharesClient) DeleteResponder(resp *http.Response) (result OperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share to retrieve. -func (client SharesClient) Get(ctx context.Context, resourceGroupName string, accountName string, shareName string) (result Share, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SharesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, shareName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SharesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SharesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SharesClient) GetResponder(resp *http.Response) (result Share, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAccount list shares in an account -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// skipToken - continuation Token -// filter - filters the results using OData syntax. -// orderby - sorts the results using OData syntax. -func (client SharesClient) ListByAccount(ctx context.Context, resourceGroupName string, accountName string, skipToken string, filter string, orderby string) (result ShareListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SharesClient.ListByAccount") - defer func() { - sc := -1 - if result.sl.Response.Response != nil { - sc = result.sl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByAccountNextResults - req, err := client.ListByAccountPreparer(ctx, resourceGroupName, accountName, skipToken, filter, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "ListByAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAccountSender(req) - if err != nil { - result.sl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "ListByAccount", resp, "Failure sending request") - return - } - - result.sl, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "ListByAccount", resp, "Failure responding to request") - return - } - if result.sl.hasNextLink() && result.sl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAccountPreparer prepares the ListByAccount request. -func (client SharesClient) ListByAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, skipToken string, filter string, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAccountSender sends the ListByAccount request. The method will close the -// http.Response Body if it receives an error. -func (client SharesClient) ListByAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAccountResponder handles the response to the ListByAccount request. The method always -// closes the http.Response Body. -func (client SharesClient) ListByAccountResponder(resp *http.Response) (result ShareList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAccountNextResults retrieves the next set of results, if any. -func (client SharesClient) listByAccountNextResults(ctx context.Context, lastResults ShareList) (result ShareList, err error) { - req, err := lastResults.shareListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.SharesClient", "listByAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.SharesClient", "listByAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "listByAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client SharesClient) ListByAccountComplete(ctx context.Context, resourceGroupName string, accountName string, skipToken string, filter string, orderby string) (result ShareListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SharesClient.ListByAccount") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByAccount(ctx, resourceGroupName, accountName, skipToken, filter, orderby) - return -} - -// ListSynchronizationDetails list synchronization details -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// shareSynchronization - share Synchronization payload. -// skipToken - continuation token -// filter - filters the results using OData syntax. -// orderby - sorts the results using OData syntax. -func (client SharesClient) ListSynchronizationDetails(ctx context.Context, resourceGroupName string, accountName string, shareName string, shareSynchronization ShareSynchronization, skipToken string, filter string, orderby string) (result SynchronizationDetailsListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SharesClient.ListSynchronizationDetails") - defer func() { - sc := -1 - if result.sdl.Response.Response != nil { - sc = result.sdl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listSynchronizationDetailsNextResults - req, err := client.ListSynchronizationDetailsPreparer(ctx, resourceGroupName, accountName, shareName, shareSynchronization, skipToken, filter, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "ListSynchronizationDetails", nil, "Failure preparing request") - return - } - - resp, err := client.ListSynchronizationDetailsSender(req) - if err != nil { - result.sdl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "ListSynchronizationDetails", resp, "Failure sending request") - return - } - - result.sdl, err = client.ListSynchronizationDetailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "ListSynchronizationDetails", resp, "Failure responding to request") - return - } - if result.sdl.hasNextLink() && result.sdl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListSynchronizationDetailsPreparer prepares the ListSynchronizationDetails request. -func (client SharesClient) ListSynchronizationDetailsPreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, shareSynchronization ShareSynchronization, skipToken string, filter string, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - shareSynchronization.SynchronizationMode = "" - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/listSynchronizationDetails", pathParameters), - autorest.WithJSON(shareSynchronization), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSynchronizationDetailsSender sends the ListSynchronizationDetails request. The method will close the -// http.Response Body if it receives an error. -func (client SharesClient) ListSynchronizationDetailsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSynchronizationDetailsResponder handles the response to the ListSynchronizationDetails request. The method always -// closes the http.Response Body. -func (client SharesClient) ListSynchronizationDetailsResponder(resp *http.Response) (result SynchronizationDetailsList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listSynchronizationDetailsNextResults retrieves the next set of results, if any. -func (client SharesClient) listSynchronizationDetailsNextResults(ctx context.Context, lastResults SynchronizationDetailsList) (result SynchronizationDetailsList, err error) { - req, err := lastResults.synchronizationDetailsListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.SharesClient", "listSynchronizationDetailsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSynchronizationDetailsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.SharesClient", "listSynchronizationDetailsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListSynchronizationDetailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "listSynchronizationDetailsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListSynchronizationDetailsComplete enumerates all values, automatically crossing page boundaries as required. -func (client SharesClient) ListSynchronizationDetailsComplete(ctx context.Context, resourceGroupName string, accountName string, shareName string, shareSynchronization ShareSynchronization, skipToken string, filter string, orderby string) (result SynchronizationDetailsListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SharesClient.ListSynchronizationDetails") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListSynchronizationDetails(ctx, resourceGroupName, accountName, shareName, shareSynchronization, skipToken, filter, orderby) - return -} - -// ListSynchronizations list synchronizations of a share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// skipToken - continuation token -// filter - filters the results using OData syntax. -// orderby - sorts the results using OData syntax. -func (client SharesClient) ListSynchronizations(ctx context.Context, resourceGroupName string, accountName string, shareName string, skipToken string, filter string, orderby string) (result ShareSynchronizationListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SharesClient.ListSynchronizations") - defer func() { - sc := -1 - if result.ssl.Response.Response != nil { - sc = result.ssl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listSynchronizationsNextResults - req, err := client.ListSynchronizationsPreparer(ctx, resourceGroupName, accountName, shareName, skipToken, filter, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "ListSynchronizations", nil, "Failure preparing request") - return - } - - resp, err := client.ListSynchronizationsSender(req) - if err != nil { - result.ssl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "ListSynchronizations", resp, "Failure sending request") - return - } - - result.ssl, err = client.ListSynchronizationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "ListSynchronizations", resp, "Failure responding to request") - return - } - if result.ssl.hasNextLink() && result.ssl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListSynchronizationsPreparer prepares the ListSynchronizations request. -func (client SharesClient) ListSynchronizationsPreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, skipToken string, filter string, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/listSynchronizations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSynchronizationsSender sends the ListSynchronizations request. The method will close the -// http.Response Body if it receives an error. -func (client SharesClient) ListSynchronizationsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSynchronizationsResponder handles the response to the ListSynchronizations request. The method always -// closes the http.Response Body. -func (client SharesClient) ListSynchronizationsResponder(resp *http.Response) (result ShareSynchronizationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listSynchronizationsNextResults retrieves the next set of results, if any. -func (client SharesClient) listSynchronizationsNextResults(ctx context.Context, lastResults ShareSynchronizationList) (result ShareSynchronizationList, err error) { - req, err := lastResults.shareSynchronizationListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.SharesClient", "listSynchronizationsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSynchronizationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.SharesClient", "listSynchronizationsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListSynchronizationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SharesClient", "listSynchronizationsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListSynchronizationsComplete enumerates all values, automatically crossing page boundaries as required. -func (client SharesClient) ListSynchronizationsComplete(ctx context.Context, resourceGroupName string, accountName string, shareName string, skipToken string, filter string, orderby string) (result ShareSynchronizationListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SharesClient.ListSynchronizations") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListSynchronizations(ctx, resourceGroupName, accountName, shareName, skipToken, filter, orderby) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/sharesubscriptions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/sharesubscriptions.go deleted file mode 100644 index 8edf0e1a5ba4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/sharesubscriptions.go +++ /dev/null @@ -1,995 +0,0 @@ -package datashare - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ShareSubscriptionsClient is the creates a Microsoft.DataShare management client. -type ShareSubscriptionsClient struct { - BaseClient -} - -// NewShareSubscriptionsClient creates an instance of the ShareSubscriptionsClient client. -func NewShareSubscriptionsClient(subscriptionID string) ShareSubscriptionsClient { - return NewShareSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewShareSubscriptionsClientWithBaseURI creates an instance of the ShareSubscriptionsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewShareSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) ShareSubscriptionsClient { - return ShareSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CancelSynchronization request to cancel a synchronization. -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the shareSubscription. -// shareSubscriptionSynchronization - share Subscription Synchronization payload. -func (client ShareSubscriptionsClient) CancelSynchronization(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, shareSubscriptionSynchronization ShareSubscriptionSynchronization) (result ShareSubscriptionsCancelSynchronizationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionsClient.CancelSynchronization") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: shareSubscriptionSynchronization, - Constraints: []validation.Constraint{{Target: "shareSubscriptionSynchronization.SynchronizationID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("datashare.ShareSubscriptionsClient", "CancelSynchronization", err.Error()) - } - - req, err := client.CancelSynchronizationPreparer(ctx, resourceGroupName, accountName, shareSubscriptionName, shareSubscriptionSynchronization) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "CancelSynchronization", nil, "Failure preparing request") - return - } - - result, err = client.CancelSynchronizationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "CancelSynchronization", result.Response(), "Failure sending request") - return - } - - return -} - -// CancelSynchronizationPreparer prepares the CancelSynchronization request. -func (client ShareSubscriptionsClient) CancelSynchronizationPreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, shareSubscriptionSynchronization ShareSubscriptionSynchronization) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - shareSubscriptionSynchronization.DurationMs = nil - shareSubscriptionSynchronization.EndTime = nil - shareSubscriptionSynchronization.Message = nil - shareSubscriptionSynchronization.StartTime = nil - shareSubscriptionSynchronization.Status = nil - shareSubscriptionSynchronization.SynchronizationMode = "" - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/cancelSynchronization", pathParameters), - autorest.WithJSON(shareSubscriptionSynchronization), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSynchronizationSender sends the CancelSynchronization request. The method will close the -// http.Response Body if it receives an error. -func (client ShareSubscriptionsClient) CancelSynchronizationSender(req *http.Request) (future ShareSubscriptionsCancelSynchronizationFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CancelSynchronizationResponder handles the response to the CancelSynchronization request. The method always -// closes the http.Response Body. -func (client ShareSubscriptionsClient) CancelSynchronizationResponder(resp *http.Response) (result ShareSubscriptionSynchronization, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Create create a shareSubscription in an account -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the shareSubscription. -// shareSubscription - create parameters for shareSubscription -func (client ShareSubscriptionsClient) Create(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, shareSubscription ShareSubscription) (result ShareSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionsClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: shareSubscription, - Constraints: []validation.Constraint{{Target: "shareSubscription.ShareSubscriptionProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "shareSubscription.ShareSubscriptionProperties.InvitationID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "shareSubscription.ShareSubscriptionProperties.SourceShareLocation", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("datashare.ShareSubscriptionsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, shareSubscriptionName, shareSubscription) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ShareSubscriptionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, shareSubscription ShareSubscription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}", pathParameters), - autorest.WithJSON(shareSubscription), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ShareSubscriptionsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ShareSubscriptionsClient) CreateResponder(resp *http.Response) (result ShareSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a shareSubscription in an account -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the shareSubscription. -func (client ShareSubscriptionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string) (result ShareSubscriptionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, shareSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ShareSubscriptionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ShareSubscriptionsClient) DeleteSender(req *http.Request) (future ShareSubscriptionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ShareSubscriptionsClient) DeleteResponder(resp *http.Response) (result OperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a shareSubscription in an account -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the shareSubscription. -func (client ShareSubscriptionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string) (result ShareSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, shareSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ShareSubscriptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ShareSubscriptionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ShareSubscriptionsClient) GetResponder(resp *http.Response) (result ShareSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAccount list share subscriptions in an account -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// skipToken - continuation Token -// filter - filters the results using OData syntax. -// orderby - sorts the results using OData syntax. -func (client ShareSubscriptionsClient) ListByAccount(ctx context.Context, resourceGroupName string, accountName string, skipToken string, filter string, orderby string) (result ShareSubscriptionListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionsClient.ListByAccount") - defer func() { - sc := -1 - if result.ssl.Response.Response != nil { - sc = result.ssl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByAccountNextResults - req, err := client.ListByAccountPreparer(ctx, resourceGroupName, accountName, skipToken, filter, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "ListByAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAccountSender(req) - if err != nil { - result.ssl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "ListByAccount", resp, "Failure sending request") - return - } - - result.ssl, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "ListByAccount", resp, "Failure responding to request") - return - } - if result.ssl.hasNextLink() && result.ssl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAccountPreparer prepares the ListByAccount request. -func (client ShareSubscriptionsClient) ListByAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, skipToken string, filter string, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAccountSender sends the ListByAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ShareSubscriptionsClient) ListByAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAccountResponder handles the response to the ListByAccount request. The method always -// closes the http.Response Body. -func (client ShareSubscriptionsClient) ListByAccountResponder(resp *http.Response) (result ShareSubscriptionList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAccountNextResults retrieves the next set of results, if any. -func (client ShareSubscriptionsClient) listByAccountNextResults(ctx context.Context, lastResults ShareSubscriptionList) (result ShareSubscriptionList, err error) { - req, err := lastResults.shareSubscriptionListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "listByAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "listByAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "listByAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client ShareSubscriptionsClient) ListByAccountComplete(ctx context.Context, resourceGroupName string, accountName string, skipToken string, filter string, orderby string) (result ShareSubscriptionListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionsClient.ListByAccount") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByAccount(ctx, resourceGroupName, accountName, skipToken, filter, orderby) - return -} - -// ListSourceShareSynchronizationSettings get synchronization settings set on a share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the shareSubscription. -// skipToken - continuation token -func (client ShareSubscriptionsClient) ListSourceShareSynchronizationSettings(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, skipToken string) (result SourceShareSynchronizationSettingListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionsClient.ListSourceShareSynchronizationSettings") - defer func() { - sc := -1 - if result.ssssl.Response.Response != nil { - sc = result.ssssl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listSourceShareSynchronizationSettingsNextResults - req, err := client.ListSourceShareSynchronizationSettingsPreparer(ctx, resourceGroupName, accountName, shareSubscriptionName, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "ListSourceShareSynchronizationSettings", nil, "Failure preparing request") - return - } - - resp, err := client.ListSourceShareSynchronizationSettingsSender(req) - if err != nil { - result.ssssl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "ListSourceShareSynchronizationSettings", resp, "Failure sending request") - return - } - - result.ssssl, err = client.ListSourceShareSynchronizationSettingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "ListSourceShareSynchronizationSettings", resp, "Failure responding to request") - return - } - if result.ssssl.hasNextLink() && result.ssssl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListSourceShareSynchronizationSettingsPreparer prepares the ListSourceShareSynchronizationSettings request. -func (client ShareSubscriptionsClient) ListSourceShareSynchronizationSettingsPreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSourceShareSynchronizationSettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSourceShareSynchronizationSettingsSender sends the ListSourceShareSynchronizationSettings request. The method will close the -// http.Response Body if it receives an error. -func (client ShareSubscriptionsClient) ListSourceShareSynchronizationSettingsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSourceShareSynchronizationSettingsResponder handles the response to the ListSourceShareSynchronizationSettings request. The method always -// closes the http.Response Body. -func (client ShareSubscriptionsClient) ListSourceShareSynchronizationSettingsResponder(resp *http.Response) (result SourceShareSynchronizationSettingList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listSourceShareSynchronizationSettingsNextResults retrieves the next set of results, if any. -func (client ShareSubscriptionsClient) listSourceShareSynchronizationSettingsNextResults(ctx context.Context, lastResults SourceShareSynchronizationSettingList) (result SourceShareSynchronizationSettingList, err error) { - req, err := lastResults.sourceShareSynchronizationSettingListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "listSourceShareSynchronizationSettingsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSourceShareSynchronizationSettingsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "listSourceShareSynchronizationSettingsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListSourceShareSynchronizationSettingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "listSourceShareSynchronizationSettingsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListSourceShareSynchronizationSettingsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ShareSubscriptionsClient) ListSourceShareSynchronizationSettingsComplete(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, skipToken string) (result SourceShareSynchronizationSettingListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionsClient.ListSourceShareSynchronizationSettings") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListSourceShareSynchronizationSettings(ctx, resourceGroupName, accountName, shareSubscriptionName, skipToken) - return -} - -// ListSynchronizationDetails list synchronization details -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the share subscription. -// shareSubscriptionSynchronization - share Subscription Synchronization payload. -// skipToken - continuation token -// filter - filters the results using OData syntax. -// orderby - sorts the results using OData syntax. -func (client ShareSubscriptionsClient) ListSynchronizationDetails(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, shareSubscriptionSynchronization ShareSubscriptionSynchronization, skipToken string, filter string, orderby string) (result SynchronizationDetailsListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionsClient.ListSynchronizationDetails") - defer func() { - sc := -1 - if result.sdl.Response.Response != nil { - sc = result.sdl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: shareSubscriptionSynchronization, - Constraints: []validation.Constraint{{Target: "shareSubscriptionSynchronization.SynchronizationID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("datashare.ShareSubscriptionsClient", "ListSynchronizationDetails", err.Error()) - } - - result.fn = client.listSynchronizationDetailsNextResults - req, err := client.ListSynchronizationDetailsPreparer(ctx, resourceGroupName, accountName, shareSubscriptionName, shareSubscriptionSynchronization, skipToken, filter, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "ListSynchronizationDetails", nil, "Failure preparing request") - return - } - - resp, err := client.ListSynchronizationDetailsSender(req) - if err != nil { - result.sdl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "ListSynchronizationDetails", resp, "Failure sending request") - return - } - - result.sdl, err = client.ListSynchronizationDetailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "ListSynchronizationDetails", resp, "Failure responding to request") - return - } - if result.sdl.hasNextLink() && result.sdl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListSynchronizationDetailsPreparer prepares the ListSynchronizationDetails request. -func (client ShareSubscriptionsClient) ListSynchronizationDetailsPreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, shareSubscriptionSynchronization ShareSubscriptionSynchronization, skipToken string, filter string, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - shareSubscriptionSynchronization.DurationMs = nil - shareSubscriptionSynchronization.EndTime = nil - shareSubscriptionSynchronization.Message = nil - shareSubscriptionSynchronization.StartTime = nil - shareSubscriptionSynchronization.Status = nil - shareSubscriptionSynchronization.SynchronizationMode = "" - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSynchronizationDetails", pathParameters), - autorest.WithJSON(shareSubscriptionSynchronization), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSynchronizationDetailsSender sends the ListSynchronizationDetails request. The method will close the -// http.Response Body if it receives an error. -func (client ShareSubscriptionsClient) ListSynchronizationDetailsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSynchronizationDetailsResponder handles the response to the ListSynchronizationDetails request. The method always -// closes the http.Response Body. -func (client ShareSubscriptionsClient) ListSynchronizationDetailsResponder(resp *http.Response) (result SynchronizationDetailsList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listSynchronizationDetailsNextResults retrieves the next set of results, if any. -func (client ShareSubscriptionsClient) listSynchronizationDetailsNextResults(ctx context.Context, lastResults SynchronizationDetailsList) (result SynchronizationDetailsList, err error) { - req, err := lastResults.synchronizationDetailsListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "listSynchronizationDetailsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSynchronizationDetailsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "listSynchronizationDetailsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListSynchronizationDetailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "listSynchronizationDetailsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListSynchronizationDetailsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ShareSubscriptionsClient) ListSynchronizationDetailsComplete(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, shareSubscriptionSynchronization ShareSubscriptionSynchronization, skipToken string, filter string, orderby string) (result SynchronizationDetailsListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionsClient.ListSynchronizationDetails") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListSynchronizationDetails(ctx, resourceGroupName, accountName, shareSubscriptionName, shareSubscriptionSynchronization, skipToken, filter, orderby) - return -} - -// ListSynchronizations list synchronizations of a share subscription -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the share subscription. -// skipToken - continuation token -// filter - filters the results using OData syntax. -// orderby - sorts the results using OData syntax. -func (client ShareSubscriptionsClient) ListSynchronizations(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, skipToken string, filter string, orderby string) (result ShareSubscriptionSynchronizationListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionsClient.ListSynchronizations") - defer func() { - sc := -1 - if result.sssl.Response.Response != nil { - sc = result.sssl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listSynchronizationsNextResults - req, err := client.ListSynchronizationsPreparer(ctx, resourceGroupName, accountName, shareSubscriptionName, skipToken, filter, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "ListSynchronizations", nil, "Failure preparing request") - return - } - - resp, err := client.ListSynchronizationsSender(req) - if err != nil { - result.sssl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "ListSynchronizations", resp, "Failure sending request") - return - } - - result.sssl, err = client.ListSynchronizationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "ListSynchronizations", resp, "Failure responding to request") - return - } - if result.sssl.hasNextLink() && result.sssl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListSynchronizationsPreparer prepares the ListSynchronizations request. -func (client ShareSubscriptionsClient) ListSynchronizationsPreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, skipToken string, filter string, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSynchronizations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSynchronizationsSender sends the ListSynchronizations request. The method will close the -// http.Response Body if it receives an error. -func (client ShareSubscriptionsClient) ListSynchronizationsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSynchronizationsResponder handles the response to the ListSynchronizations request. The method always -// closes the http.Response Body. -func (client ShareSubscriptionsClient) ListSynchronizationsResponder(resp *http.Response) (result ShareSubscriptionSynchronizationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listSynchronizationsNextResults retrieves the next set of results, if any. -func (client ShareSubscriptionsClient) listSynchronizationsNextResults(ctx context.Context, lastResults ShareSubscriptionSynchronizationList) (result ShareSubscriptionSynchronizationList, err error) { - req, err := lastResults.shareSubscriptionSynchronizationListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "listSynchronizationsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSynchronizationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "listSynchronizationsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListSynchronizationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "listSynchronizationsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListSynchronizationsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ShareSubscriptionsClient) ListSynchronizationsComplete(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, skipToken string, filter string, orderby string) (result ShareSubscriptionSynchronizationListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionsClient.ListSynchronizations") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListSynchronizations(ctx, resourceGroupName, accountName, shareSubscriptionName, skipToken, filter, orderby) - return -} - -// SynchronizeMethod initiate a copy -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of share subscription -// synchronize - synchronize payload -func (client ShareSubscriptionsClient) SynchronizeMethod(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, synchronize Synchronize) (result ShareSubscriptionsSynchronizeMethodFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ShareSubscriptionsClient.SynchronizeMethod") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.SynchronizeMethodPreparer(ctx, resourceGroupName, accountName, shareSubscriptionName, synchronize) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "SynchronizeMethod", nil, "Failure preparing request") - return - } - - result, err = client.SynchronizeMethodSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.ShareSubscriptionsClient", "SynchronizeMethod", result.Response(), "Failure sending request") - return - } - - return -} - -// SynchronizeMethodPreparer prepares the SynchronizeMethod request. -func (client ShareSubscriptionsClient) SynchronizeMethodPreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, synchronize Synchronize) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/Synchronize", pathParameters), - autorest.WithJSON(synchronize), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SynchronizeMethodSender sends the SynchronizeMethod request. The method will close the -// http.Response Body if it receives an error. -func (client ShareSubscriptionsClient) SynchronizeMethodSender(req *http.Request) (future ShareSubscriptionsSynchronizeMethodFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// SynchronizeMethodResponder handles the response to the SynchronizeMethod request. The method always -// closes the http.Response Body. -func (client ShareSubscriptionsClient) SynchronizeMethodResponder(resp *http.Response) (result ShareSubscriptionSynchronization, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/synchronizationsettings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/synchronizationsettings.go deleted file mode 100644 index 097b57b6345a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/synchronizationsettings.go +++ /dev/null @@ -1,402 +0,0 @@ -package datashare - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SynchronizationSettingsClient is the creates a Microsoft.DataShare management client. -type SynchronizationSettingsClient struct { - BaseClient -} - -// NewSynchronizationSettingsClient creates an instance of the SynchronizationSettingsClient client. -func NewSynchronizationSettingsClient(subscriptionID string) SynchronizationSettingsClient { - return NewSynchronizationSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSynchronizationSettingsClientWithBaseURI creates an instance of the SynchronizationSettingsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewSynchronizationSettingsClientWithBaseURI(baseURI string, subscriptionID string) SynchronizationSettingsClient { - return SynchronizationSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create or update a synchronizationSetting -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share to add the synchronization setting to. -// synchronizationSettingName - the name of the synchronizationSetting. -// synchronizationSetting - the new synchronization setting information. -func (client SynchronizationSettingsClient) Create(ctx context.Context, resourceGroupName string, accountName string, shareName string, synchronizationSettingName string, synchronizationSetting BasicSynchronizationSetting) (result SynchronizationSettingModel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SynchronizationSettingsClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, shareName, synchronizationSettingName, synchronizationSetting) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SynchronizationSettingsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, synchronizationSettingName string, synchronizationSetting BasicSynchronizationSetting) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "synchronizationSettingName": autorest.Encode("path", synchronizationSettingName), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/synchronizationSettings/{synchronizationSettingName}", pathParameters), - autorest.WithJSON(synchronizationSetting), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client SynchronizationSettingsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client SynchronizationSettingsClient) CreateResponder(resp *http.Response) (result SynchronizationSettingModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a synchronizationSetting in a share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// synchronizationSettingName - the name of the synchronizationSetting . -func (client SynchronizationSettingsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, shareName string, synchronizationSettingName string) (result SynchronizationSettingsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SynchronizationSettingsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, shareName, synchronizationSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SynchronizationSettingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, synchronizationSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "synchronizationSettingName": autorest.Encode("path", synchronizationSettingName), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/synchronizationSettings/{synchronizationSettingName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SynchronizationSettingsClient) DeleteSender(req *http.Request) (future SynchronizationSettingsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SynchronizationSettingsClient) DeleteResponder(resp *http.Response) (result OperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a synchronizationSetting in a share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// synchronizationSettingName - the name of the synchronizationSetting. -func (client SynchronizationSettingsClient) Get(ctx context.Context, resourceGroupName string, accountName string, shareName string, synchronizationSettingName string) (result SynchronizationSettingModel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SynchronizationSettingsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, shareName, synchronizationSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SynchronizationSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, synchronizationSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "synchronizationSettingName": autorest.Encode("path", synchronizationSettingName), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/synchronizationSettings/{synchronizationSettingName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SynchronizationSettingsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SynchronizationSettingsClient) GetResponder(resp *http.Response) (result SynchronizationSettingModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByShare list synchronizationSettings in a share -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareName - the name of the share. -// skipToken - continuation token -func (client SynchronizationSettingsClient) ListByShare(ctx context.Context, resourceGroupName string, accountName string, shareName string, skipToken string) (result SynchronizationSettingListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SynchronizationSettingsClient.ListByShare") - defer func() { - sc := -1 - if result.ssl.Response.Response != nil { - sc = result.ssl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByShareNextResults - req, err := client.ListBySharePreparer(ctx, resourceGroupName, accountName, shareName, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsClient", "ListByShare", nil, "Failure preparing request") - return - } - - resp, err := client.ListByShareSender(req) - if err != nil { - result.ssl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsClient", "ListByShare", resp, "Failure sending request") - return - } - - result.ssl, err = client.ListByShareResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsClient", "ListByShare", resp, "Failure responding to request") - return - } - if result.ssl.hasNextLink() && result.ssl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySharePreparer prepares the ListByShare request. -func (client SynchronizationSettingsClient) ListBySharePreparer(ctx context.Context, resourceGroupName string, accountName string, shareName string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareName": autorest.Encode("path", shareName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/synchronizationSettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByShareSender sends the ListByShare request. The method will close the -// http.Response Body if it receives an error. -func (client SynchronizationSettingsClient) ListByShareSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByShareResponder handles the response to the ListByShare request. The method always -// closes the http.Response Body. -func (client SynchronizationSettingsClient) ListByShareResponder(resp *http.Response) (result SynchronizationSettingList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByShareNextResults retrieves the next set of results, if any. -func (client SynchronizationSettingsClient) listByShareNextResults(ctx context.Context, lastResults SynchronizationSettingList) (result SynchronizationSettingList, err error) { - req, err := lastResults.synchronizationSettingListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsClient", "listByShareNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByShareSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsClient", "listByShareNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByShareResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.SynchronizationSettingsClient", "listByShareNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByShareComplete enumerates all values, automatically crossing page boundaries as required. -func (client SynchronizationSettingsClient) ListByShareComplete(ctx context.Context, resourceGroupName string, accountName string, shareName string, skipToken string) (result SynchronizationSettingListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SynchronizationSettingsClient.ListByShare") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByShare(ctx, resourceGroupName, accountName, shareName, skipToken) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/triggers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/triggers.go deleted file mode 100644 index cc5d6ecc5571..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/triggers.go +++ /dev/null @@ -1,404 +0,0 @@ -package datashare - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// TriggersClient is the creates a Microsoft.DataShare management client. -type TriggersClient struct { - BaseClient -} - -// NewTriggersClient creates an instance of the TriggersClient client. -func NewTriggersClient(subscriptionID string) TriggersClient { - return NewTriggersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTriggersClientWithBaseURI creates an instance of the TriggersClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewTriggersClientWithBaseURI(baseURI string, subscriptionID string) TriggersClient { - return TriggersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a Trigger -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the share subscription which will hold the data set sink. -// triggerName - the name of the trigger. -// trigger - trigger details. -func (client TriggersClient) Create(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, triggerName string, trigger BasicTrigger) (result TriggersCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, shareSubscriptionName, triggerName, trigger) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.TriggersClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.TriggersClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TriggersClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, triggerName string, trigger BasicTrigger) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/triggers/{triggerName}", pathParameters), - autorest.WithJSON(trigger), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client TriggersClient) CreateSender(req *http.Request) (future TriggersCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client TriggersClient) CreateResponder(resp *http.Response) (result TriggerModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Trigger in a shareSubscription -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the shareSubscription. -// triggerName - the name of the trigger. -func (client TriggersClient) Delete(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, triggerName string) (result TriggersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, shareSubscriptionName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.TriggersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.TriggersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TriggersClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client TriggersClient) DeleteSender(req *http.Request) (future TriggersDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client TriggersClient) DeleteResponder(resp *http.Response) (result OperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a Trigger in a shareSubscription -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the shareSubscription. -// triggerName - the name of the trigger. -func (client TriggersClient) Get(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, triggerName string) (result TriggerModel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, shareSubscriptionName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.TriggersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.TriggersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.TriggersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TriggersClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TriggersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TriggersClient) GetResponder(resp *http.Response) (result TriggerModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByShareSubscription list Triggers in a share subscription -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the share account. -// shareSubscriptionName - the name of the share subscription. -// skipToken - continuation token -func (client TriggersClient) ListByShareSubscription(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, skipToken string) (result TriggerListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.ListByShareSubscription") - defer func() { - sc := -1 - if result.tl.Response.Response != nil { - sc = result.tl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByShareSubscriptionNextResults - req, err := client.ListByShareSubscriptionPreparer(ctx, resourceGroupName, accountName, shareSubscriptionName, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.TriggersClient", "ListByShareSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListByShareSubscriptionSender(req) - if err != nil { - result.tl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datashare.TriggersClient", "ListByShareSubscription", resp, "Failure sending request") - return - } - - result.tl, err = client.ListByShareSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.TriggersClient", "ListByShareSubscription", resp, "Failure responding to request") - return - } - if result.tl.hasNextLink() && result.tl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByShareSubscriptionPreparer prepares the ListByShareSubscription request. -func (client TriggersClient) ListByShareSubscriptionPreparer(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "shareSubscriptionName": autorest.Encode("path", shareSubscriptionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/triggers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByShareSubscriptionSender sends the ListByShareSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client TriggersClient) ListByShareSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByShareSubscriptionResponder handles the response to the ListByShareSubscription request. The method always -// closes the http.Response Body. -func (client TriggersClient) ListByShareSubscriptionResponder(resp *http.Response) (result TriggerList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByShareSubscriptionNextResults retrieves the next set of results, if any. -func (client TriggersClient) listByShareSubscriptionNextResults(ctx context.Context, lastResults TriggerList) (result TriggerList, err error) { - req, err := lastResults.triggerListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "datashare.TriggersClient", "listByShareSubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByShareSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "datashare.TriggersClient", "listByShareSubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByShareSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "datashare.TriggersClient", "listByShareSubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByShareSubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client TriggersClient) ListByShareSubscriptionComplete(ctx context.Context, resourceGroupName string, accountName string, shareSubscriptionName string, skipToken string) (result TriggerListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.ListByShareSubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByShareSubscription(ctx, resourceGroupName, accountName, shareSubscriptionName, skipToken) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/version.go deleted file mode 100644 index 17bf317783a4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package datashare - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " datashare/2019-11-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/_meta.json deleted file mode 100644 index eaae38677dae..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/devtestlabs/resource-manager/readme.md", - "tag": "package-2018-09", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2018-09 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/devtestlabs/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/armtemplates.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/armtemplates.go deleted file mode 100644 index b00e5d365bde..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/armtemplates.go +++ /dev/null @@ -1,251 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ArmTemplatesClient is the the DevTest Labs Client. -type ArmTemplatesClient struct { - BaseClient -} - -// NewArmTemplatesClient creates an instance of the ArmTemplatesClient client. -func NewArmTemplatesClient(subscriptionID string) ArmTemplatesClient { - return NewArmTemplatesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewArmTemplatesClientWithBaseURI creates an instance of the ArmTemplatesClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewArmTemplatesClientWithBaseURI(baseURI string, subscriptionID string) ArmTemplatesClient { - return ArmTemplatesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get azure resource manager template. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// artifactSourceName - the name of the artifact source. -// name - the name of the azure resource manager template. -// expand - specify the $expand query. Example: 'properties($select=displayName)' -func (client ArmTemplatesClient) Get(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (result ArmTemplate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArmTemplatesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, artifactSourceName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ArmTemplatesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "artifactSourceName": autorest.Encode("path", artifactSourceName), - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ArmTemplatesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ArmTemplatesClient) GetResponder(resp *http.Response) (result ArmTemplate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list azure resource manager templates in a given artifact source. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// artifactSourceName - the name of the artifact source. -// expand - specify the $expand query. Example: 'properties($select=displayName)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client ArmTemplatesClient) List(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (result ArmTemplateListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArmTemplatesClient.List") - defer func() { - sc := -1 - if result.atl.Response.Response != nil { - sc = result.atl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.atl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "List", resp, "Failure sending request") - return - } - - result.atl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "List", resp, "Failure responding to request") - return - } - if result.atl.hasNextLink() && result.atl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ArmTemplatesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "artifactSourceName": autorest.Encode("path", artifactSourceName), - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ArmTemplatesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ArmTemplatesClient) ListResponder(resp *http.Response) (result ArmTemplateList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ArmTemplatesClient) listNextResults(ctx context.Context, lastResults ArmTemplateList) (result ArmTemplateList, err error) { - req, err := lastResults.armTemplateListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArmTemplatesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ArmTemplatesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (result ArmTemplateListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArmTemplatesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/artifacts.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/artifacts.go deleted file mode 100644 index 75747df41c8c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/artifacts.go +++ /dev/null @@ -1,335 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ArtifactsClient is the the DevTest Labs Client. -type ArtifactsClient struct { - BaseClient -} - -// NewArtifactsClient creates an instance of the ArtifactsClient client. -func NewArtifactsClient(subscriptionID string) ArtifactsClient { - return NewArtifactsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewArtifactsClientWithBaseURI creates an instance of the ArtifactsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewArtifactsClientWithBaseURI(baseURI string, subscriptionID string) ArtifactsClient { - return ArtifactsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GenerateArmTemplate generates an ARM template for the given artifact, uploads the required files to a storage -// account, and validates the generated artifact. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// artifactSourceName - the name of the artifact source. -// name - the name of the artifact. -// generateArmTemplateRequest - parameters for generating an ARM template for deploying artifacts. -func (client ArtifactsClient) GenerateArmTemplate(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, name string, generateArmTemplateRequest GenerateArmTemplateRequest) (result ArmTemplateInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArtifactsClient.GenerateArmTemplate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GenerateArmTemplatePreparer(ctx, resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "GenerateArmTemplate", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateArmTemplateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "GenerateArmTemplate", resp, "Failure sending request") - return - } - - result, err = client.GenerateArmTemplateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "GenerateArmTemplate", resp, "Failure responding to request") - return - } - - return -} - -// GenerateArmTemplatePreparer prepares the GenerateArmTemplate request. -func (client ArtifactsClient) GenerateArmTemplatePreparer(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, name string, generateArmTemplateRequest GenerateArmTemplateRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "artifactSourceName": autorest.Encode("path", artifactSourceName), - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate", pathParameters), - autorest.WithJSON(generateArmTemplateRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateArmTemplateSender sends the GenerateArmTemplate request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactsClient) GenerateArmTemplateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GenerateArmTemplateResponder handles the response to the GenerateArmTemplate request. The method always -// closes the http.Response Body. -func (client ArtifactsClient) GenerateArmTemplateResponder(resp *http.Response) (result ArmTemplateInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get artifact. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// artifactSourceName - the name of the artifact source. -// name - the name of the artifact. -// expand - specify the $expand query. Example: 'properties($select=title)' -func (client ArtifactsClient) Get(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (result Artifact, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArtifactsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, artifactSourceName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ArtifactsClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "artifactSourceName": autorest.Encode("path", artifactSourceName), - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ArtifactsClient) GetResponder(resp *http.Response) (result Artifact, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list artifacts in a given artifact source. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// artifactSourceName - the name of the artifact source. -// expand - specify the $expand query. Example: 'properties($select=title)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client ArtifactsClient) List(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (result ArtifactListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArtifactsClient.List") - defer func() { - sc := -1 - if result.al.Response.Response != nil { - sc = result.al.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.al.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "List", resp, "Failure sending request") - return - } - - result.al, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "List", resp, "Failure responding to request") - return - } - if result.al.hasNextLink() && result.al.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ArtifactsClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "artifactSourceName": autorest.Encode("path", artifactSourceName), - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ArtifactsClient) ListResponder(resp *http.Response) (result ArtifactList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ArtifactsClient) listNextResults(ctx context.Context, lastResults ArtifactList) (result ArtifactList, err error) { - req, err := lastResults.artifactListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ArtifactsClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (result ArtifactListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArtifactsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/artifactsources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/artifactsources.go deleted file mode 100644 index 212a4609c836..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/artifactsources.go +++ /dev/null @@ -1,493 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ArtifactSourcesClient is the the DevTest Labs Client. -type ArtifactSourcesClient struct { - BaseClient -} - -// NewArtifactSourcesClient creates an instance of the ArtifactSourcesClient client. -func NewArtifactSourcesClient(subscriptionID string) ArtifactSourcesClient { - return NewArtifactSourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewArtifactSourcesClientWithBaseURI creates an instance of the ArtifactSourcesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewArtifactSourcesClientWithBaseURI(baseURI string, subscriptionID string) ArtifactSourcesClient { - return ArtifactSourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing artifact source. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the artifact source. -// artifactSource - properties of an artifact source. -func (client ArtifactSourcesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, artifactSource ArtifactSource) (result ArtifactSource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArtifactSourcesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: artifactSource, - Constraints: []validation.Constraint{{Target: "artifactSource.ArtifactSourceProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("dtl.ArtifactSourcesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, artifactSource) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ArtifactSourcesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, artifactSource ArtifactSource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), - autorest.WithJSON(artifactSource), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactSourcesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ArtifactSourcesClient) CreateOrUpdateResponder(resp *http.Response) (result ArtifactSource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete artifact source. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the artifact source. -func (client ArtifactSourcesClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArtifactSourcesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ArtifactSourcesClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactSourcesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ArtifactSourcesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get artifact source. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the artifact source. -// expand - specify the $expand query. Example: 'properties($select=displayName)' -func (client ArtifactSourcesClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result ArtifactSource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArtifactSourcesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ArtifactSourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactSourcesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ArtifactSourcesClient) GetResponder(resp *http.Response) (result ArtifactSource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list artifact sources in a given lab. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// expand - specify the $expand query. Example: 'properties($select=displayName)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client ArtifactSourcesClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ArtifactSourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArtifactSourcesClient.List") - defer func() { - sc := -1 - if result.asl.Response.Response != nil { - sc = result.asl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.asl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "List", resp, "Failure sending request") - return - } - - result.asl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "List", resp, "Failure responding to request") - return - } - if result.asl.hasNextLink() && result.asl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ArtifactSourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactSourcesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ArtifactSourcesClient) ListResponder(resp *http.Response) (result ArtifactSourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ArtifactSourcesClient) listNextResults(ctx context.Context, lastResults ArtifactSourceList) (result ArtifactSourceList, err error) { - req, err := lastResults.artifactSourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ArtifactSourcesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ArtifactSourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArtifactSourcesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) - return -} - -// Update allows modifying tags of artifact sources. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the artifact source. -// artifactSource - properties of an artifact source. -func (client ArtifactSourcesClient) Update(ctx context.Context, resourceGroupName string, labName string, name string, artifactSource ArtifactSourceFragment) (result ArtifactSource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArtifactSourcesClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, name, artifactSource) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ArtifactSourcesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ArtifactSourcesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, artifactSource ArtifactSourceFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), - autorest.WithJSON(artifactSource), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactSourcesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ArtifactSourcesClient) UpdateResponder(resp *http.Response) (result ArtifactSource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/client.go deleted file mode 100644 index e8e68b96b63d..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devtestlabs/armdevtestlabs](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devtestlabs/armdevtestlabs). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package dtl implements the Azure ARM Dtl service API version 2018-09-15. -// -// The DevTest Labs Client. -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Dtl - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Dtl. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/costs.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/costs.go deleted file mode 100644 index 4552ebf48d28..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/costs.go +++ /dev/null @@ -1,201 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// CostsClient is the the DevTest Labs Client. -type CostsClient struct { - BaseClient -} - -// NewCostsClient creates an instance of the CostsClient client. -func NewCostsClient(subscriptionID string) CostsClient { - return NewCostsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCostsClientWithBaseURI creates an instance of the CostsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewCostsClientWithBaseURI(baseURI string, subscriptionID string) CostsClient { - return CostsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing cost. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the cost. -// labCost - a cost item. -func (client CostsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, labCost LabCost) (result LabCost, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CostsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: labCost, - Constraints: []validation.Constraint{{Target: "labCost.LabCostProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("dtl.CostsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, labCost) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CostsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.CostsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CostsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CostsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, labCost LabCost) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}", pathParameters), - autorest.WithJSON(labCost), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CostsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client CostsClient) CreateOrUpdateResponder(resp *http.Response) (result LabCost, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get cost. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the cost. -// expand - specify the $expand query. Example: 'properties($expand=labCostDetails)' -func (client CostsClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result LabCost, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CostsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CostsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.CostsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CostsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CostsClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CostsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CostsClient) GetResponder(resp *http.Response) (result LabCost, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/customimages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/customimages.go deleted file mode 100644 index 81db62e5a5b7..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/customimages.go +++ /dev/null @@ -1,499 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// CustomImagesClient is the the DevTest Labs Client. -type CustomImagesClient struct { - BaseClient -} - -// NewCustomImagesClient creates an instance of the CustomImagesClient client. -func NewCustomImagesClient(subscriptionID string) CustomImagesClient { - return NewCustomImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCustomImagesClientWithBaseURI creates an instance of the CustomImagesClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewCustomImagesClientWithBaseURI(baseURI string, subscriptionID string) CustomImagesClient { - return CustomImagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing custom image. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the custom image. -// customImage - a custom image. -func (client CustomImagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, customImage CustomImage) (result CustomImagesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomImagesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: customImage, - Constraints: []validation.Constraint{{Target: "customImage.CustomImageProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("dtl.CustomImagesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, customImage) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CustomImagesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, customImage CustomImage) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", pathParameters), - autorest.WithJSON(customImage), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CustomImagesClient) CreateOrUpdateSender(req *http.Request) (future CustomImagesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client CustomImagesClient) CreateOrUpdateResponder(resp *http.Response) (result CustomImage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete custom image. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the custom image. -func (client CustomImagesClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result CustomImagesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomImagesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CustomImagesClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client CustomImagesClient) DeleteSender(req *http.Request) (future CustomImagesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client CustomImagesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get custom image. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the custom image. -// expand - specify the $expand query. Example: 'properties($select=vm)' -func (client CustomImagesClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result CustomImage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomImagesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CustomImagesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CustomImagesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CustomImagesClient) GetResponder(resp *http.Response) (result CustomImage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list custom images in a given lab. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// expand - specify the $expand query. Example: 'properties($select=vm)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client CustomImagesClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result CustomImageListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomImagesClient.List") - defer func() { - sc := -1 - if result.cil.Response.Response != nil { - sc = result.cil.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.cil.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "List", resp, "Failure sending request") - return - } - - result.cil, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "List", resp, "Failure responding to request") - return - } - if result.cil.hasNextLink() && result.cil.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client CustomImagesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client CustomImagesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client CustomImagesClient) ListResponder(resp *http.Response) (result CustomImageList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client CustomImagesClient) listNextResults(ctx context.Context, lastResults CustomImageList) (result CustomImageList, err error) { - req, err := lastResults.customImageListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client CustomImagesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result CustomImageListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomImagesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) - return -} - -// Update allows modifying tags of custom images. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the custom image. -// customImage - a custom image. -func (client CustomImagesClient) Update(ctx context.Context, resourceGroupName string, labName string, name string, customImage CustomImageFragment) (result CustomImage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomImagesClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, name, customImage) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CustomImagesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CustomImagesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, customImage CustomImageFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", pathParameters), - autorest.WithJSON(customImage), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client CustomImagesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client CustomImagesClient) UpdateResponder(resp *http.Response) (result CustomImage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/disks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/disks.go deleted file mode 100644 index d9d7755be159..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/disks.go +++ /dev/null @@ -1,680 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DisksClient is the the DevTest Labs Client. -type DisksClient struct { - BaseClient -} - -// NewDisksClient creates an instance of the DisksClient client. -func NewDisksClient(subscriptionID string) DisksClient { - return NewDisksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDisksClientWithBaseURI creates an instance of the DisksClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClient { - return DisksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Attach attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the disk. -// attachDiskProperties - properties of the disk to attach. -func (client DisksClient) Attach(ctx context.Context, resourceGroupName string, labName string, userName string, name string, attachDiskProperties AttachDiskProperties) (result DisksAttachFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.Attach") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.AttachPreparer(ctx, resourceGroupName, labName, userName, name, attachDiskProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Attach", nil, "Failure preparing request") - return - } - - result, err = client.AttachSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Attach", result.Response(), "Failure sending request") - return - } - - return -} - -// AttachPreparer prepares the Attach request. -func (client DisksClient) AttachPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, attachDiskProperties AttachDiskProperties) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach", pathParameters), - autorest.WithJSON(attachDiskProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AttachSender sends the Attach request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) AttachSender(req *http.Request) (future DisksAttachFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// AttachResponder handles the response to the Attach request. The method always -// closes the http.Response Body. -func (client DisksClient) AttachResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate create or replace an existing disk. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the disk. -// disk - a Disk. -func (client DisksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, userName string, name string, disk Disk) (result DisksCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: disk, - Constraints: []validation.Constraint{{Target: "disk.DiskProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("dtl.DisksClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, userName, name, disk) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DisksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, disk Disk) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}", pathParameters), - autorest.WithJSON(disk), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) CreateOrUpdateSender(req *http.Request) (future DisksCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DisksClient) CreateOrUpdateResponder(resp *http.Response) (result Disk, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete disk. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the disk. -func (client DisksClient) Delete(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (result DisksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, userName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DisksClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) DeleteSender(req *http.Request) (future DisksDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DisksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Detach detach and break the lease of the disk attached to the virtual machine. This operation can take a while to -// complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the disk. -// detachDiskProperties - properties of the disk to detach. -func (client DisksClient) Detach(ctx context.Context, resourceGroupName string, labName string, userName string, name string, detachDiskProperties DetachDiskProperties) (result DisksDetachFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.Detach") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DetachPreparer(ctx, resourceGroupName, labName, userName, name, detachDiskProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Detach", nil, "Failure preparing request") - return - } - - result, err = client.DetachSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Detach", result.Response(), "Failure sending request") - return - } - - return -} - -// DetachPreparer prepares the Detach request. -func (client DisksClient) DetachPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, detachDiskProperties DetachDiskProperties) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach", pathParameters), - autorest.WithJSON(detachDiskProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DetachSender sends the Detach request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) DetachSender(req *http.Request) (future DisksDetachFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DetachResponder handles the response to the Detach request. The method always -// closes the http.Response Body. -func (client DisksClient) DetachResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get disk. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the disk. -// expand - specify the $expand query. Example: 'properties($select=diskType)' -func (client DisksClient) Get(ctx context.Context, resourceGroupName string, labName string, userName string, name string, expand string) (result Disk, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, userName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DisksClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DisksClient) GetResponder(resp *http.Response) (result Disk, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list disks in a given user profile. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// expand - specify the $expand query. Example: 'properties($select=diskType)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client DisksClient) List(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result DiskListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.List") - defer func() { - sc := -1 - if result.dl.Response.Response != nil { - sc = result.dl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, userName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.dl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "List", resp, "Failure sending request") - return - } - - result.dl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "List", resp, "Failure responding to request") - return - } - if result.dl.hasNextLink() && result.dl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DisksClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DisksClient) ListResponder(resp *http.Response) (result DiskList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client DisksClient) listNextResults(ctx context.Context, lastResults DiskList) (result DiskList, err error) { - req, err := lastResults.diskListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.DisksClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.DisksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client DisksClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result DiskListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, userName, expand, filter, top, orderby) - return -} - -// Update allows modifying tags of disks. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the disk. -// disk - a Disk. -func (client DisksClient) Update(ctx context.Context, resourceGroupName string, labName string, userName string, name string, disk DiskFragment) (result Disk, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisksClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, userName, name, disk) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DisksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, disk DiskFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}", pathParameters), - autorest.WithJSON(disk), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client DisksClient) UpdateResponder(resp *http.Response) (result Disk, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/enums.go deleted file mode 100644 index 34ee9ac80296..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/enums.go +++ /dev/null @@ -1,449 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CostThresholdStatus enumerates the values for cost threshold status. -type CostThresholdStatus string - -const ( - // Disabled ... - Disabled CostThresholdStatus = "Disabled" - // Enabled ... - Enabled CostThresholdStatus = "Enabled" -) - -// PossibleCostThresholdStatusValues returns an array of possible values for the CostThresholdStatus const type. -func PossibleCostThresholdStatusValues() []CostThresholdStatus { - return []CostThresholdStatus{Disabled, Enabled} -} - -// CostType enumerates the values for cost type. -type CostType string - -const ( - // Projected ... - Projected CostType = "Projected" - // Reported ... - Reported CostType = "Reported" - // Unavailable ... - Unavailable CostType = "Unavailable" -) - -// PossibleCostTypeValues returns an array of possible values for the CostType const type. -func PossibleCostTypeValues() []CostType { - return []CostType{Projected, Reported, Unavailable} -} - -// CustomImageOsType enumerates the values for custom image os type. -type CustomImageOsType string - -const ( - // Linux ... - Linux CustomImageOsType = "Linux" - // None ... - None CustomImageOsType = "None" - // Windows ... - Windows CustomImageOsType = "Windows" -) - -// PossibleCustomImageOsTypeValues returns an array of possible values for the CustomImageOsType const type. -func PossibleCustomImageOsTypeValues() []CustomImageOsType { - return []CustomImageOsType{Linux, None, Windows} -} - -// EnableStatus enumerates the values for enable status. -type EnableStatus string - -const ( - // EnableStatusDisabled ... - EnableStatusDisabled EnableStatus = "Disabled" - // EnableStatusEnabled ... - EnableStatusEnabled EnableStatus = "Enabled" -) - -// PossibleEnableStatusValues returns an array of possible values for the EnableStatus const type. -func PossibleEnableStatusValues() []EnableStatus { - return []EnableStatus{EnableStatusDisabled, EnableStatusEnabled} -} - -// EnvironmentPermission enumerates the values for environment permission. -type EnvironmentPermission string - -const ( - // Contributor ... - Contributor EnvironmentPermission = "Contributor" - // Reader ... - Reader EnvironmentPermission = "Reader" -) - -// PossibleEnvironmentPermissionValues returns an array of possible values for the EnvironmentPermission const type. -func PossibleEnvironmentPermissionValues() []EnvironmentPermission { - return []EnvironmentPermission{Contributor, Reader} -} - -// FileUploadOptions enumerates the values for file upload options. -type FileUploadOptions string - -const ( - // FileUploadOptionsNone ... - FileUploadOptionsNone FileUploadOptions = "None" - // FileUploadOptionsUploadFilesAndGenerateSasTokens ... - FileUploadOptionsUploadFilesAndGenerateSasTokens FileUploadOptions = "UploadFilesAndGenerateSasTokens" -) - -// PossibleFileUploadOptionsValues returns an array of possible values for the FileUploadOptions const type. -func PossibleFileUploadOptionsValues() []FileUploadOptions { - return []FileUploadOptions{FileUploadOptionsNone, FileUploadOptionsUploadFilesAndGenerateSasTokens} -} - -// HostCachingOptions enumerates the values for host caching options. -type HostCachingOptions string - -const ( - // HostCachingOptionsNone ... - HostCachingOptionsNone HostCachingOptions = "None" - // HostCachingOptionsReadOnly ... - HostCachingOptionsReadOnly HostCachingOptions = "ReadOnly" - // HostCachingOptionsReadWrite ... - HostCachingOptionsReadWrite HostCachingOptions = "ReadWrite" -) - -// PossibleHostCachingOptionsValues returns an array of possible values for the HostCachingOptions const type. -func PossibleHostCachingOptionsValues() []HostCachingOptions { - return []HostCachingOptions{HostCachingOptionsNone, HostCachingOptionsReadOnly, HostCachingOptionsReadWrite} -} - -// HTTPStatusCode enumerates the values for http status code. -type HTTPStatusCode string - -const ( - // Accepted ... - Accepted HTTPStatusCode = "Accepted" - // BadGateway ... - BadGateway HTTPStatusCode = "BadGateway" - // BadRequest ... - BadRequest HTTPStatusCode = "BadRequest" - // Conflict ... - Conflict HTTPStatusCode = "Conflict" - // Continue ... - Continue HTTPStatusCode = "Continue" - // Created ... - Created HTTPStatusCode = "Created" - // ExpectationFailed ... - ExpectationFailed HTTPStatusCode = "ExpectationFailed" - // Forbidden ... - Forbidden HTTPStatusCode = "Forbidden" - // GatewayTimeout ... - GatewayTimeout HTTPStatusCode = "GatewayTimeout" - // Gone ... - Gone HTTPStatusCode = "Gone" - // HTTPVersionNotSupported ... - HTTPVersionNotSupported HTTPStatusCode = "HttpVersionNotSupported" - // InternalServerError ... - InternalServerError HTTPStatusCode = "InternalServerError" - // LengthRequired ... - LengthRequired HTTPStatusCode = "LengthRequired" - // MethodNotAllowed ... - MethodNotAllowed HTTPStatusCode = "MethodNotAllowed" - // MovedPermanently ... - MovedPermanently HTTPStatusCode = "MovedPermanently" - // MultipleChoices ... - MultipleChoices HTTPStatusCode = "MultipleChoices" - // NoContent ... - NoContent HTTPStatusCode = "NoContent" - // NonAuthoritativeInformation ... - NonAuthoritativeInformation HTTPStatusCode = "NonAuthoritativeInformation" - // NotAcceptable ... - NotAcceptable HTTPStatusCode = "NotAcceptable" - // NotFound ... - NotFound HTTPStatusCode = "NotFound" - // NotImplemented ... - NotImplemented HTTPStatusCode = "NotImplemented" - // NotModified ... - NotModified HTTPStatusCode = "NotModified" - // OK ... - OK HTTPStatusCode = "OK" - // PartialContent ... - PartialContent HTTPStatusCode = "PartialContent" - // PaymentRequired ... - PaymentRequired HTTPStatusCode = "PaymentRequired" - // PreconditionFailed ... - PreconditionFailed HTTPStatusCode = "PreconditionFailed" - // ProxyAuthenticationRequired ... - ProxyAuthenticationRequired HTTPStatusCode = "ProxyAuthenticationRequired" - // Redirect ... - Redirect HTTPStatusCode = "Redirect" - // RequestedRangeNotSatisfiable ... - RequestedRangeNotSatisfiable HTTPStatusCode = "RequestedRangeNotSatisfiable" - // RequestEntityTooLarge ... - RequestEntityTooLarge HTTPStatusCode = "RequestEntityTooLarge" - // RequestTimeout ... - RequestTimeout HTTPStatusCode = "RequestTimeout" - // RequestURITooLong ... - RequestURITooLong HTTPStatusCode = "RequestUriTooLong" - // ResetContent ... - ResetContent HTTPStatusCode = "ResetContent" - // SeeOther ... - SeeOther HTTPStatusCode = "SeeOther" - // ServiceUnavailable ... - ServiceUnavailable HTTPStatusCode = "ServiceUnavailable" - // SwitchingProtocols ... - SwitchingProtocols HTTPStatusCode = "SwitchingProtocols" - // TemporaryRedirect ... - TemporaryRedirect HTTPStatusCode = "TemporaryRedirect" - // Unauthorized ... - Unauthorized HTTPStatusCode = "Unauthorized" - // UnsupportedMediaType ... - UnsupportedMediaType HTTPStatusCode = "UnsupportedMediaType" - // Unused ... - Unused HTTPStatusCode = "Unused" - // UpgradeRequired ... - UpgradeRequired HTTPStatusCode = "UpgradeRequired" - // UseProxy ... - UseProxy HTTPStatusCode = "UseProxy" -) - -// PossibleHTTPStatusCodeValues returns an array of possible values for the HTTPStatusCode const type. -func PossibleHTTPStatusCodeValues() []HTTPStatusCode { - return []HTTPStatusCode{Accepted, BadGateway, BadRequest, Conflict, Continue, Created, ExpectationFailed, Forbidden, GatewayTimeout, Gone, HTTPVersionNotSupported, InternalServerError, LengthRequired, MethodNotAllowed, MovedPermanently, MultipleChoices, NoContent, NonAuthoritativeInformation, NotAcceptable, NotFound, NotImplemented, NotModified, OK, PartialContent, PaymentRequired, PreconditionFailed, ProxyAuthenticationRequired, Redirect, RequestedRangeNotSatisfiable, RequestEntityTooLarge, RequestTimeout, RequestURITooLong, ResetContent, SeeOther, ServiceUnavailable, SwitchingProtocols, TemporaryRedirect, Unauthorized, UnsupportedMediaType, Unused, UpgradeRequired, UseProxy} -} - -// LinuxOsState enumerates the values for linux os state. -type LinuxOsState string - -const ( - // DeprovisionApplied ... - DeprovisionApplied LinuxOsState = "DeprovisionApplied" - // DeprovisionRequested ... - DeprovisionRequested LinuxOsState = "DeprovisionRequested" - // NonDeprovisioned ... - NonDeprovisioned LinuxOsState = "NonDeprovisioned" -) - -// PossibleLinuxOsStateValues returns an array of possible values for the LinuxOsState const type. -func PossibleLinuxOsStateValues() []LinuxOsState { - return []LinuxOsState{DeprovisionApplied, DeprovisionRequested, NonDeprovisioned} -} - -// NotificationChannelEventType enumerates the values for notification channel event type. -type NotificationChannelEventType string - -const ( - // AutoShutdown ... - AutoShutdown NotificationChannelEventType = "AutoShutdown" - // Cost ... - Cost NotificationChannelEventType = "Cost" -) - -// PossibleNotificationChannelEventTypeValues returns an array of possible values for the NotificationChannelEventType const type. -func PossibleNotificationChannelEventTypeValues() []NotificationChannelEventType { - return []NotificationChannelEventType{AutoShutdown, Cost} -} - -// PolicyEvaluatorType enumerates the values for policy evaluator type. -type PolicyEvaluatorType string - -const ( - // AllowedValuesPolicy ... - AllowedValuesPolicy PolicyEvaluatorType = "AllowedValuesPolicy" - // MaxValuePolicy ... - MaxValuePolicy PolicyEvaluatorType = "MaxValuePolicy" -) - -// PossiblePolicyEvaluatorTypeValues returns an array of possible values for the PolicyEvaluatorType const type. -func PossiblePolicyEvaluatorTypeValues() []PolicyEvaluatorType { - return []PolicyEvaluatorType{AllowedValuesPolicy, MaxValuePolicy} -} - -// PolicyFactName enumerates the values for policy fact name. -type PolicyFactName string - -const ( - // PolicyFactNameEnvironmentTemplate ... - PolicyFactNameEnvironmentTemplate PolicyFactName = "EnvironmentTemplate" - // PolicyFactNameGalleryImage ... - PolicyFactNameGalleryImage PolicyFactName = "GalleryImage" - // PolicyFactNameLabPremiumVMCount ... - PolicyFactNameLabPremiumVMCount PolicyFactName = "LabPremiumVmCount" - // PolicyFactNameLabTargetCost ... - PolicyFactNameLabTargetCost PolicyFactName = "LabTargetCost" - // PolicyFactNameLabVMCount ... - PolicyFactNameLabVMCount PolicyFactName = "LabVmCount" - // PolicyFactNameLabVMSize ... - PolicyFactNameLabVMSize PolicyFactName = "LabVmSize" - // PolicyFactNameScheduleEditPermission ... - PolicyFactNameScheduleEditPermission PolicyFactName = "ScheduleEditPermission" - // PolicyFactNameUserOwnedLabPremiumVMCount ... - PolicyFactNameUserOwnedLabPremiumVMCount PolicyFactName = "UserOwnedLabPremiumVmCount" - // PolicyFactNameUserOwnedLabVMCount ... - PolicyFactNameUserOwnedLabVMCount PolicyFactName = "UserOwnedLabVmCount" - // PolicyFactNameUserOwnedLabVMCountInSubnet ... - PolicyFactNameUserOwnedLabVMCountInSubnet PolicyFactName = "UserOwnedLabVmCountInSubnet" -) - -// PossiblePolicyFactNameValues returns an array of possible values for the PolicyFactName const type. -func PossiblePolicyFactNameValues() []PolicyFactName { - return []PolicyFactName{PolicyFactNameEnvironmentTemplate, PolicyFactNameGalleryImage, PolicyFactNameLabPremiumVMCount, PolicyFactNameLabTargetCost, PolicyFactNameLabVMCount, PolicyFactNameLabVMSize, PolicyFactNameScheduleEditPermission, PolicyFactNameUserOwnedLabPremiumVMCount, PolicyFactNameUserOwnedLabVMCount, PolicyFactNameUserOwnedLabVMCountInSubnet} -} - -// PolicyStatus enumerates the values for policy status. -type PolicyStatus string - -const ( - // PolicyStatusDisabled ... - PolicyStatusDisabled PolicyStatus = "Disabled" - // PolicyStatusEnabled ... - PolicyStatusEnabled PolicyStatus = "Enabled" -) - -// PossiblePolicyStatusValues returns an array of possible values for the PolicyStatus const type. -func PossiblePolicyStatusValues() []PolicyStatus { - return []PolicyStatus{PolicyStatusDisabled, PolicyStatusEnabled} -} - -// PremiumDataDisk enumerates the values for premium data disk. -type PremiumDataDisk string - -const ( - // PremiumDataDiskDisabled ... - PremiumDataDiskDisabled PremiumDataDisk = "Disabled" - // PremiumDataDiskEnabled ... - PremiumDataDiskEnabled PremiumDataDisk = "Enabled" -) - -// PossiblePremiumDataDiskValues returns an array of possible values for the PremiumDataDisk const type. -func PossiblePremiumDataDiskValues() []PremiumDataDisk { - return []PremiumDataDisk{PremiumDataDiskDisabled, PremiumDataDiskEnabled} -} - -// ReportingCycleType enumerates the values for reporting cycle type. -type ReportingCycleType string - -const ( - // CalendarMonth ... - CalendarMonth ReportingCycleType = "CalendarMonth" - // Custom ... - Custom ReportingCycleType = "Custom" -) - -// PossibleReportingCycleTypeValues returns an array of possible values for the ReportingCycleType const type. -func PossibleReportingCycleTypeValues() []ReportingCycleType { - return []ReportingCycleType{CalendarMonth, Custom} -} - -// SourceControlType enumerates the values for source control type. -type SourceControlType string - -const ( - // GitHub ... - GitHub SourceControlType = "GitHub" - // VsoGit ... - VsoGit SourceControlType = "VsoGit" -) - -// PossibleSourceControlTypeValues returns an array of possible values for the SourceControlType const type. -func PossibleSourceControlTypeValues() []SourceControlType { - return []SourceControlType{GitHub, VsoGit} -} - -// StorageType enumerates the values for storage type. -type StorageType string - -const ( - // Premium ... - Premium StorageType = "Premium" - // Standard ... - Standard StorageType = "Standard" - // StandardSSD ... - StandardSSD StorageType = "StandardSSD" -) - -// PossibleStorageTypeValues returns an array of possible values for the StorageType const type. -func PossibleStorageTypeValues() []StorageType { - return []StorageType{Premium, Standard, StandardSSD} -} - -// TargetCostStatus enumerates the values for target cost status. -type TargetCostStatus string - -const ( - // TargetCostStatusDisabled ... - TargetCostStatusDisabled TargetCostStatus = "Disabled" - // TargetCostStatusEnabled ... - TargetCostStatusEnabled TargetCostStatus = "Enabled" -) - -// PossibleTargetCostStatusValues returns an array of possible values for the TargetCostStatus const type. -func PossibleTargetCostStatusValues() []TargetCostStatus { - return []TargetCostStatus{TargetCostStatusDisabled, TargetCostStatusEnabled} -} - -// TransportProtocol enumerates the values for transport protocol. -type TransportProtocol string - -const ( - // TCP ... - TCP TransportProtocol = "Tcp" - // UDP ... - UDP TransportProtocol = "Udp" -) - -// PossibleTransportProtocolValues returns an array of possible values for the TransportProtocol const type. -func PossibleTransportProtocolValues() []TransportProtocol { - return []TransportProtocol{TCP, UDP} -} - -// UsagePermissionType enumerates the values for usage permission type. -type UsagePermissionType string - -const ( - // Allow ... - Allow UsagePermissionType = "Allow" - // Default ... - Default UsagePermissionType = "Default" - // Deny ... - Deny UsagePermissionType = "Deny" -) - -// PossibleUsagePermissionTypeValues returns an array of possible values for the UsagePermissionType const type. -func PossibleUsagePermissionTypeValues() []UsagePermissionType { - return []UsagePermissionType{Allow, Default, Deny} -} - -// VirtualMachineCreationSource enumerates the values for virtual machine creation source. -type VirtualMachineCreationSource string - -const ( - // FromCustomImage ... - FromCustomImage VirtualMachineCreationSource = "FromCustomImage" - // FromGalleryImage ... - FromGalleryImage VirtualMachineCreationSource = "FromGalleryImage" - // FromSharedGalleryImage ... - FromSharedGalleryImage VirtualMachineCreationSource = "FromSharedGalleryImage" -) - -// PossibleVirtualMachineCreationSourceValues returns an array of possible values for the VirtualMachineCreationSource const type. -func PossibleVirtualMachineCreationSourceValues() []VirtualMachineCreationSource { - return []VirtualMachineCreationSource{FromCustomImage, FromGalleryImage, FromSharedGalleryImage} -} - -// WindowsOsState enumerates the values for windows os state. -type WindowsOsState string - -const ( - // NonSysprepped ... - NonSysprepped WindowsOsState = "NonSysprepped" - // SysprepApplied ... - SysprepApplied WindowsOsState = "SysprepApplied" - // SysprepRequested ... - SysprepRequested WindowsOsState = "SysprepRequested" -) - -// PossibleWindowsOsStateValues returns an array of possible values for the WindowsOsState const type. -func PossibleWindowsOsStateValues() []WindowsOsState { - return []WindowsOsState{NonSysprepped, SysprepApplied, SysprepRequested} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/environments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/environments.go deleted file mode 100644 index a87b5e7a8a1d..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/environments.go +++ /dev/null @@ -1,509 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// EnvironmentsClient is the the DevTest Labs Client. -type EnvironmentsClient struct { - BaseClient -} - -// NewEnvironmentsClient creates an instance of the EnvironmentsClient client. -func NewEnvironmentsClient(subscriptionID string) EnvironmentsClient { - return NewEnvironmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEnvironmentsClientWithBaseURI creates an instance of the EnvironmentsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewEnvironmentsClientWithBaseURI(baseURI string, subscriptionID string) EnvironmentsClient { - return EnvironmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing environment. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the environment. -// dtlEnvironment - an environment, which is essentially an ARM template deployment. -func (client EnvironmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, userName string, name string, dtlEnvironment Environment) (result EnvironmentsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: dtlEnvironment, - Constraints: []validation.Constraint{{Target: "dtlEnvironment.EnvironmentProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("dtl.EnvironmentsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, userName, name, dtlEnvironment) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EnvironmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, dtlEnvironment Environment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}", pathParameters), - autorest.WithJSON(dtlEnvironment), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client EnvironmentsClient) CreateOrUpdateSender(req *http.Request) (future EnvironmentsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client EnvironmentsClient) CreateOrUpdateResponder(resp *http.Response) (result Environment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete environment. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the environment. -func (client EnvironmentsClient) Delete(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (result EnvironmentsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, userName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EnvironmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client EnvironmentsClient) DeleteSender(req *http.Request) (future EnvironmentsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client EnvironmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get environment. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the environment. -// expand - specify the $expand query. Example: 'properties($select=deploymentProperties)' -func (client EnvironmentsClient) Get(ctx context.Context, resourceGroupName string, labName string, userName string, name string, expand string) (result Environment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, userName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EnvironmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client EnvironmentsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client EnvironmentsClient) GetResponder(resp *http.Response) (result Environment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list environments in a given user profile. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// expand - specify the $expand query. Example: 'properties($select=deploymentProperties)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client EnvironmentsClient) List(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result EnvironmentListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.List") - defer func() { - sc := -1 - if result.el.Response.Response != nil { - sc = result.el.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, userName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.el.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "List", resp, "Failure sending request") - return - } - - result.el, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "List", resp, "Failure responding to request") - return - } - if result.el.hasNextLink() && result.el.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client EnvironmentsClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client EnvironmentsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client EnvironmentsClient) ListResponder(resp *http.Response) (result EnvironmentList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client EnvironmentsClient) listNextResults(ctx context.Context, lastResults EnvironmentList) (result EnvironmentList, err error) { - req, err := lastResults.environmentListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client EnvironmentsClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result EnvironmentListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, userName, expand, filter, top, orderby) - return -} - -// Update allows modifying tags of environments. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the environment. -// dtlEnvironment - an environment, which is essentially an ARM template deployment. -func (client EnvironmentsClient) Update(ctx context.Context, resourceGroupName string, labName string, userName string, name string, dtlEnvironment EnvironmentFragment) (result Environment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, userName, name, dtlEnvironment) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client EnvironmentsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, dtlEnvironment EnvironmentFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}", pathParameters), - autorest.WithJSON(dtlEnvironment), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client EnvironmentsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client EnvironmentsClient) UpdateResponder(resp *http.Response) (result Environment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/formulas.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/formulas.go deleted file mode 100644 index 385814f83758..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/formulas.go +++ /dev/null @@ -1,496 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// FormulasClient is the the DevTest Labs Client. -type FormulasClient struct { - BaseClient -} - -// NewFormulasClient creates an instance of the FormulasClient client. -func NewFormulasClient(subscriptionID string) FormulasClient { - return NewFormulasClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFormulasClientWithBaseURI creates an instance of the FormulasClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewFormulasClientWithBaseURI(baseURI string, subscriptionID string) FormulasClient { - return FormulasClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing formula. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the formula. -// formula - a formula for creating a VM, specifying an image base and other parameters -func (client FormulasClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, formula Formula) (result FormulasCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FormulasClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: formula, - Constraints: []validation.Constraint{{Target: "formula.FormulaProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("dtl.FormulasClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, formula) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FormulasClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, formula Formula) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}", pathParameters), - autorest.WithJSON(formula), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client FormulasClient) CreateOrUpdateSender(req *http.Request) (future FormulasCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client FormulasClient) CreateOrUpdateResponder(resp *http.Response) (result Formula, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete formula. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the formula. -func (client FormulasClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FormulasClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FormulasClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client FormulasClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client FormulasClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get formula. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the formula. -// expand - specify the $expand query. Example: 'properties($select=description)' -func (client FormulasClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result Formula, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FormulasClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client FormulasClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client FormulasClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client FormulasClient) GetResponder(resp *http.Response) (result Formula, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list formulas in a given lab. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// expand - specify the $expand query. Example: 'properties($select=description)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client FormulasClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result FormulaListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FormulasClient.List") - defer func() { - sc := -1 - if result.fl.Response.Response != nil { - sc = result.fl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.fl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "List", resp, "Failure sending request") - return - } - - result.fl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "List", resp, "Failure responding to request") - return - } - if result.fl.hasNextLink() && result.fl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client FormulasClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client FormulasClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client FormulasClient) ListResponder(resp *http.Response) (result FormulaList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client FormulasClient) listNextResults(ctx context.Context, lastResults FormulaList) (result FormulaList, err error) { - req, err := lastResults.formulaListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.FormulasClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.FormulasClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client FormulasClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result FormulaListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FormulasClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) - return -} - -// Update allows modifying tags of formulas. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the formula. -// formula - a formula for creating a VM, specifying an image base and other parameters -func (client FormulasClient) Update(ctx context.Context, resourceGroupName string, labName string, name string, formula FormulaFragment) (result Formula, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FormulasClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, name, formula) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.FormulasClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client FormulasClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, formula FormulaFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}", pathParameters), - autorest.WithJSON(formula), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client FormulasClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client FormulasClient) UpdateResponder(resp *http.Response) (result Formula, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/galleryimages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/galleryimages.go deleted file mode 100644 index 74554d4ca998..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/galleryimages.go +++ /dev/null @@ -1,165 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// GalleryImagesClient is the the DevTest Labs Client. -type GalleryImagesClient struct { - BaseClient -} - -// NewGalleryImagesClient creates an instance of the GalleryImagesClient client. -func NewGalleryImagesClient(subscriptionID string) GalleryImagesClient { - return NewGalleryImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGalleryImagesClientWithBaseURI creates an instance of the GalleryImagesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewGalleryImagesClientWithBaseURI(baseURI string, subscriptionID string) GalleryImagesClient { - return GalleryImagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list gallery images in a given lab. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// expand - specify the $expand query. Example: 'properties($select=author)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client GalleryImagesClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result GalleryImageListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.List") - defer func() { - sc := -1 - if result.gil.Response.Response != nil { - sc = result.gil.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GalleryImagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.gil.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.GalleryImagesClient", "List", resp, "Failure sending request") - return - } - - result.gil, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GalleryImagesClient", "List", resp, "Failure responding to request") - return - } - if result.gil.hasNextLink() && result.gil.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client GalleryImagesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GalleryImagesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GalleryImagesClient) ListResponder(resp *http.Response) (result GalleryImageList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client GalleryImagesClient) listNextResults(ctx context.Context, lastResults GalleryImageList) (result GalleryImageList, err error) { - req, err := lastResults.galleryImageListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.GalleryImagesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.GalleryImagesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GalleryImagesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client GalleryImagesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result GalleryImageListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/globalschedules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/globalschedules.go deleted file mode 100644 index 07b8cdd8c24f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/globalschedules.go +++ /dev/null @@ -1,772 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// GlobalSchedulesClient is the the DevTest Labs Client. -type GlobalSchedulesClient struct { - BaseClient -} - -// NewGlobalSchedulesClient creates an instance of the GlobalSchedulesClient client. -func NewGlobalSchedulesClient(subscriptionID string) GlobalSchedulesClient { - return NewGlobalSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGlobalSchedulesClientWithBaseURI creates an instance of the GlobalSchedulesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewGlobalSchedulesClientWithBaseURI(baseURI string, subscriptionID string) GlobalSchedulesClient { - return GlobalSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing schedule. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the schedule. -// schedule - a schedule. -func (client GlobalSchedulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, schedule Schedule) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GlobalSchedulesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: schedule, - Constraints: []validation.Constraint{{Target: "schedule.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("dtl.GlobalSchedulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, schedule) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GlobalSchedulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, schedule Schedule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), - autorest.WithJSON(schedule), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete schedule. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the schedule. -func (client GlobalSchedulesClient) Delete(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GlobalSchedulesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GlobalSchedulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Execute execute a schedule. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the schedule. -func (client GlobalSchedulesClient) Execute(ctx context.Context, resourceGroupName string, name string) (result GlobalSchedulesExecuteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GlobalSchedulesClient.Execute") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ExecutePreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Execute", nil, "Failure preparing request") - return - } - - result, err = client.ExecuteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Execute", result.Response(), "Failure sending request") - return - } - - return -} - -// ExecutePreparer prepares the Execute request. -func (client GlobalSchedulesClient) ExecutePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExecuteSender sends the Execute request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) ExecuteSender(req *http.Request) (future GlobalSchedulesExecuteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ExecuteResponder handles the response to the Execute request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get schedule. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the schedule. -// expand - specify the $expand query. Example: 'properties($select=status)' -func (client GlobalSchedulesClient) Get(ctx context.Context, resourceGroupName string, name string, expand string) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GlobalSchedulesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client GlobalSchedulesClient) GetPreparer(ctx context.Context, resourceGroupName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) GetResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list schedules in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -// expand - specify the $expand query. Example: 'properties($select=status)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client GlobalSchedulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (result ScheduleListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GlobalSchedulesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.sl.Response.Response != nil { - sc = result.sl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.sl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.sl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.sl.hasNextLink() && result.sl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client GlobalSchedulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) ListByResourceGroupResponder(resp *http.Response) (result ScheduleList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client GlobalSchedulesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ScheduleList) (result ScheduleList, err error) { - req, err := lastResults.scheduleListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client GlobalSchedulesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (result ScheduleListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GlobalSchedulesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, expand, filter, top, orderby) - return -} - -// ListBySubscription list schedules in a subscription. -// Parameters: -// expand - specify the $expand query. Example: 'properties($select=status)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client GlobalSchedulesClient) ListBySubscription(ctx context.Context, expand string, filter string, top *int32, orderby string) (result ScheduleListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GlobalSchedulesClient.ListBySubscription") - defer func() { - sc := -1 - if result.sl.Response.Response != nil { - sc = result.sl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.sl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.sl, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.sl.hasNextLink() && result.sl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client GlobalSchedulesClient) ListBySubscriptionPreparer(ctx context.Context, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) ListBySubscriptionResponder(resp *http.Response) (result ScheduleList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client GlobalSchedulesClient) listBySubscriptionNextResults(ctx context.Context, lastResults ScheduleList) (result ScheduleList, err error) { - req, err := lastResults.scheduleListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client GlobalSchedulesClient) ListBySubscriptionComplete(ctx context.Context, expand string, filter string, top *int32, orderby string) (result ScheduleListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GlobalSchedulesClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx, expand, filter, top, orderby) - return -} - -// Retarget updates a schedule's target resource Id. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the schedule. -// retargetScheduleProperties - properties for retargeting a virtual machine schedule. -func (client GlobalSchedulesClient) Retarget(ctx context.Context, resourceGroupName string, name string, retargetScheduleProperties RetargetScheduleProperties) (result GlobalSchedulesRetargetFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GlobalSchedulesClient.Retarget") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RetargetPreparer(ctx, resourceGroupName, name, retargetScheduleProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Retarget", nil, "Failure preparing request") - return - } - - result, err = client.RetargetSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Retarget", result.Response(), "Failure sending request") - return - } - - return -} - -// RetargetPreparer prepares the Retarget request. -func (client GlobalSchedulesClient) RetargetPreparer(ctx context.Context, resourceGroupName string, name string, retargetScheduleProperties RetargetScheduleProperties) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget", pathParameters), - autorest.WithJSON(retargetScheduleProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RetargetSender sends the Retarget request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) RetargetSender(req *http.Request) (future GlobalSchedulesRetargetFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RetargetResponder handles the response to the Retarget request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) RetargetResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update allows modifying tags of schedules. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the schedule. -// schedule - a schedule. -func (client GlobalSchedulesClient) Update(ctx context.Context, resourceGroupName string, name string, schedule ScheduleFragment) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GlobalSchedulesClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, name, schedule) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client GlobalSchedulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, schedule ScheduleFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), - autorest.WithJSON(schedule), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) UpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/labs.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/labs.go deleted file mode 100644 index 83c94e9ec38f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/labs.go +++ /dev/null @@ -1,1132 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LabsClient is the the DevTest Labs Client. -type LabsClient struct { - BaseClient -} - -// NewLabsClient creates an instance of the LabsClient client. -func NewLabsClient(subscriptionID string) LabsClient { - return NewLabsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLabsClientWithBaseURI creates an instance of the LabsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewLabsClientWithBaseURI(baseURI string, subscriptionID string) LabsClient { - return LabsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ClaimAnyVM claim a random claimable virtual machine in the lab. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the lab. -func (client LabsClient) ClaimAnyVM(ctx context.Context, resourceGroupName string, name string) (result LabsClaimAnyVMFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.ClaimAnyVM") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ClaimAnyVMPreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ClaimAnyVM", nil, "Failure preparing request") - return - } - - result, err = client.ClaimAnyVMSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ClaimAnyVM", result.Response(), "Failure sending request") - return - } - - return -} - -// ClaimAnyVMPreparer prepares the ClaimAnyVM request. -func (client LabsClient) ClaimAnyVMPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ClaimAnyVMSender sends the ClaimAnyVM request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) ClaimAnyVMSender(req *http.Request) (future LabsClaimAnyVMFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ClaimAnyVMResponder handles the response to the ClaimAnyVM request. The method always -// closes the http.Response Body. -func (client LabsClient) ClaimAnyVMResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateEnvironment create virtual machines in a lab. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the lab. -// labVirtualMachineCreationParameter - properties for creating a virtual machine. -func (client LabsClient) CreateEnvironment(ctx context.Context, resourceGroupName string, name string, labVirtualMachineCreationParameter LabVirtualMachineCreationParameter) (result LabsCreateEnvironmentFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.CreateEnvironment") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateEnvironmentPreparer(ctx, resourceGroupName, name, labVirtualMachineCreationParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "CreateEnvironment", nil, "Failure preparing request") - return - } - - result, err = client.CreateEnvironmentSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "CreateEnvironment", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateEnvironmentPreparer prepares the CreateEnvironment request. -func (client LabsClient) CreateEnvironmentPreparer(ctx context.Context, resourceGroupName string, name string, labVirtualMachineCreationParameter LabVirtualMachineCreationParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment", pathParameters), - autorest.WithJSON(labVirtualMachineCreationParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateEnvironmentSender sends the CreateEnvironment request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) CreateEnvironmentSender(req *http.Request) (future LabsCreateEnvironmentFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateEnvironmentResponder handles the response to the CreateEnvironment request. The method always -// closes the http.Response Body. -func (client LabsClient) CreateEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate create or replace an existing lab. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the lab. -// lab - a lab. -func (client LabsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, lab Lab) (result LabsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, lab) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LabsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, lab Lab) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), - autorest.WithJSON(lab), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) CreateOrUpdateSender(req *http.Request) (future LabsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client LabsClient) CreateOrUpdateResponder(resp *http.Response) (result Lab, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete lab. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the lab. -func (client LabsClient) Delete(ctx context.Context, resourceGroupName string, name string) (result LabsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LabsClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) DeleteSender(req *http.Request) (future LabsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client LabsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ExportResourceUsage exports the lab resource usage into a storage account This operation can take a while to -// complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the lab. -// exportResourceUsageParameters - the parameters of the export operation. -func (client LabsClient) ExportResourceUsage(ctx context.Context, resourceGroupName string, name string, exportResourceUsageParameters ExportResourceUsageParameters) (result LabsExportResourceUsageFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.ExportResourceUsage") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ExportResourceUsagePreparer(ctx, resourceGroupName, name, exportResourceUsageParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ExportResourceUsage", nil, "Failure preparing request") - return - } - - result, err = client.ExportResourceUsageSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ExportResourceUsage", result.Response(), "Failure sending request") - return - } - - return -} - -// ExportResourceUsagePreparer prepares the ExportResourceUsage request. -func (client LabsClient) ExportResourceUsagePreparer(ctx context.Context, resourceGroupName string, name string, exportResourceUsageParameters ExportResourceUsageParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage", pathParameters), - autorest.WithJSON(exportResourceUsageParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExportResourceUsageSender sends the ExportResourceUsage request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) ExportResourceUsageSender(req *http.Request) (future LabsExportResourceUsageFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ExportResourceUsageResponder handles the response to the ExportResourceUsage request. The method always -// closes the http.Response Body. -func (client LabsClient) ExportResourceUsageResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// GenerateUploadURI generate a URI for uploading custom disk images to a Lab. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the lab. -// generateUploadURIParameter - properties for generating an upload URI. -func (client LabsClient) GenerateUploadURI(ctx context.Context, resourceGroupName string, name string, generateUploadURIParameter GenerateUploadURIParameter) (result GenerateUploadURIResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.GenerateUploadURI") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GenerateUploadURIPreparer(ctx, resourceGroupName, name, generateUploadURIParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "GenerateUploadURI", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateUploadURISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "GenerateUploadURI", resp, "Failure sending request") - return - } - - result, err = client.GenerateUploadURIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "GenerateUploadURI", resp, "Failure responding to request") - return - } - - return -} - -// GenerateUploadURIPreparer prepares the GenerateUploadURI request. -func (client LabsClient) GenerateUploadURIPreparer(ctx context.Context, resourceGroupName string, name string, generateUploadURIParameter GenerateUploadURIParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri", pathParameters), - autorest.WithJSON(generateUploadURIParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateUploadURISender sends the GenerateUploadURI request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) GenerateUploadURISender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GenerateUploadURIResponder handles the response to the GenerateUploadURI request. The method always -// closes the http.Response Body. -func (client LabsClient) GenerateUploadURIResponder(resp *http.Response) (result GenerateUploadURIResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get lab. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the lab. -// expand - specify the $expand query. Example: 'properties($select=defaultStorageAccount)' -func (client LabsClient) Get(ctx context.Context, resourceGroupName string, name string, expand string) (result Lab, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LabsClient) GetPreparer(ctx context.Context, resourceGroupName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client LabsClient) GetResponder(resp *http.Response) (result Lab, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ImportVirtualMachine import a virtual machine into a different lab. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the lab. -// importLabVirtualMachineRequest - this represents the payload required to import a virtual machine from a -// different lab into the current one -func (client LabsClient) ImportVirtualMachine(ctx context.Context, resourceGroupName string, name string, importLabVirtualMachineRequest ImportLabVirtualMachineRequest) (result LabsImportVirtualMachineFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.ImportVirtualMachine") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ImportVirtualMachinePreparer(ctx, resourceGroupName, name, importLabVirtualMachineRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ImportVirtualMachine", nil, "Failure preparing request") - return - } - - result, err = client.ImportVirtualMachineSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ImportVirtualMachine", result.Response(), "Failure sending request") - return - } - - return -} - -// ImportVirtualMachinePreparer prepares the ImportVirtualMachine request. -func (client LabsClient) ImportVirtualMachinePreparer(ctx context.Context, resourceGroupName string, name string, importLabVirtualMachineRequest ImportLabVirtualMachineRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/importVirtualMachine", pathParameters), - autorest.WithJSON(importLabVirtualMachineRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ImportVirtualMachineSender sends the ImportVirtualMachine request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) ImportVirtualMachineSender(req *http.Request) (future LabsImportVirtualMachineFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ImportVirtualMachineResponder handles the response to the ImportVirtualMachine request. The method always -// closes the http.Response Body. -func (client LabsClient) ImportVirtualMachineResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByResourceGroup list labs in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -// expand - specify the $expand query. Example: 'properties($select=defaultStorageAccount)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client LabsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (result LabListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.ll.Response.Response != nil { - sc = result.ll.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.ll.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.ll, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.ll.hasNextLink() && result.ll.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client LabsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client LabsClient) ListByResourceGroupResponder(resp *http.Response) (result LabList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client LabsClient) listByResourceGroupNextResults(ctx context.Context, lastResults LabList) (result LabList, err error) { - req, err := lastResults.labListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.LabsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.LabsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client LabsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (result LabListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, expand, filter, top, orderby) - return -} - -// ListBySubscription list labs in a subscription. -// Parameters: -// expand - specify the $expand query. Example: 'properties($select=defaultStorageAccount)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client LabsClient) ListBySubscription(ctx context.Context, expand string, filter string, top *int32, orderby string) (result LabListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.ListBySubscription") - defer func() { - sc := -1 - if result.ll.Response.Response != nil { - sc = result.ll.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.ll.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.ll, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.ll.hasNextLink() && result.ll.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client LabsClient) ListBySubscriptionPreparer(ctx context.Context, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client LabsClient) ListBySubscriptionResponder(resp *http.Response) (result LabList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client LabsClient) listBySubscriptionNextResults(ctx context.Context, lastResults LabList) (result LabList, err error) { - req, err := lastResults.labListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.LabsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.LabsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client LabsClient) ListBySubscriptionComplete(ctx context.Context, expand string, filter string, top *int32, orderby string) (result LabListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx, expand, filter, top, orderby) - return -} - -// ListVhds list disk images available for custom image creation. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the lab. -func (client LabsClient) ListVhds(ctx context.Context, resourceGroupName string, name string) (result LabVhdListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.ListVhds") - defer func() { - sc := -1 - if result.lvl.Response.Response != nil { - sc = result.lvl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listVhdsNextResults - req, err := client.ListVhdsPreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListVhds", nil, "Failure preparing request") - return - } - - resp, err := client.ListVhdsSender(req) - if err != nil { - result.lvl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListVhds", resp, "Failure sending request") - return - } - - result.lvl, err = client.ListVhdsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "ListVhds", resp, "Failure responding to request") - return - } - if result.lvl.hasNextLink() && result.lvl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListVhdsPreparer prepares the ListVhds request. -func (client LabsClient) ListVhdsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListVhdsSender sends the ListVhds request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) ListVhdsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListVhdsResponder handles the response to the ListVhds request. The method always -// closes the http.Response Body. -func (client LabsClient) ListVhdsResponder(resp *http.Response) (result LabVhdList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listVhdsNextResults retrieves the next set of results, if any. -func (client LabsClient) listVhdsNextResults(ctx context.Context, lastResults LabVhdList) (result LabVhdList, err error) { - req, err := lastResults.labVhdListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.LabsClient", "listVhdsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListVhdsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.LabsClient", "listVhdsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListVhdsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "listVhdsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListVhdsComplete enumerates all values, automatically crossing page boundaries as required. -func (client LabsClient) ListVhdsComplete(ctx context.Context, resourceGroupName string, name string) (result LabVhdListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.ListVhds") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListVhds(ctx, resourceGroupName, name) - return -} - -// Update allows modifying tags of labs. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the lab. -// lab - a lab. -func (client LabsClient) Update(ctx context.Context, resourceGroupName string, name string, lab LabFragment) (result Lab, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, name, lab) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client LabsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, lab LabFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), - autorest.WithJSON(lab), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client LabsClient) UpdateResponder(resp *http.Response) (result Lab, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/models.go deleted file mode 100644 index bd4b57d78cf3..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/models.go +++ /dev/null @@ -1,10216 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl" - -// ApplicableSchedule schedules applicable to a virtual machine. The schedules may have been defined on a -// VM or on lab level. -type ApplicableSchedule struct { - autorest.Response `json:"-"` - // ApplicableScheduleProperties - The properties of the resource. - *ApplicableScheduleProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ApplicableSchedule. -func (as ApplicableSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if as.ApplicableScheduleProperties != nil { - objectMap["properties"] = as.ApplicableScheduleProperties - } - if as.Location != nil { - objectMap["location"] = as.Location - } - if as.Tags != nil { - objectMap["tags"] = as.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicableSchedule struct. -func (as *ApplicableSchedule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicableScheduleProperties ApplicableScheduleProperties - err = json.Unmarshal(*v, &applicableScheduleProperties) - if err != nil { - return err - } - as.ApplicableScheduleProperties = &applicableScheduleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - as.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - as.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - as.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - as.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - as.Tags = tags - } - } - } - - return nil -} - -// ApplicableScheduleFragment schedules applicable to a virtual machine. The schedules may have been -// defined on a VM or on lab level. -type ApplicableScheduleFragment struct { - // ApplicableSchedulePropertiesFragment - The properties of the resource. - *ApplicableSchedulePropertiesFragment `json:"properties,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ApplicableScheduleFragment. -func (asf ApplicableScheduleFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asf.ApplicableSchedulePropertiesFragment != nil { - objectMap["properties"] = asf.ApplicableSchedulePropertiesFragment - } - if asf.Tags != nil { - objectMap["tags"] = asf.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicableScheduleFragment struct. -func (asf *ApplicableScheduleFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicableSchedulePropertiesFragment ApplicableSchedulePropertiesFragment - err = json.Unmarshal(*v, &applicableSchedulePropertiesFragment) - if err != nil { - return err - } - asf.ApplicableSchedulePropertiesFragment = &applicableSchedulePropertiesFragment - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - asf.Tags = tags - } - } - } - - return nil -} - -// ApplicableScheduleProperties properties of a schedules applicable to a virtual machine. -type ApplicableScheduleProperties struct { - // LabVmsShutdown - The auto-shutdown schedule, if one has been set at the lab or lab resource level. - LabVmsShutdown *Schedule `json:"labVmsShutdown,omitempty"` - // LabVmsStartup - The auto-startup schedule, if one has been set at the lab or lab resource level. - LabVmsStartup *Schedule `json:"labVmsStartup,omitempty"` -} - -// ApplicableSchedulePropertiesFragment properties of a schedules applicable to a virtual machine. -type ApplicableSchedulePropertiesFragment struct { - // LabVmsShutdown - The auto-shutdown schedule, if one has been set at the lab or lab resource level. - LabVmsShutdown *ScheduleFragment `json:"labVmsShutdown,omitempty"` - // LabVmsStartup - The auto-startup schedule, if one has been set at the lab or lab resource level. - LabVmsStartup *ScheduleFragment `json:"labVmsStartup,omitempty"` -} - -// ApplyArtifactsRequest request body for applying artifacts to a virtual machine. -type ApplyArtifactsRequest struct { - // Artifacts - The list of artifacts to apply. - Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"` -} - -// ArmTemplate an Azure Resource Manager template. -type ArmTemplate struct { - autorest.Response `json:"-"` - // ArmTemplateProperties - The properties of the resource. - *ArmTemplateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ArmTemplate. -func (at ArmTemplate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if at.ArmTemplateProperties != nil { - objectMap["properties"] = at.ArmTemplateProperties - } - if at.Location != nil { - objectMap["location"] = at.Location - } - if at.Tags != nil { - objectMap["tags"] = at.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ArmTemplate struct. -func (at *ArmTemplate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var armTemplateProperties ArmTemplateProperties - err = json.Unmarshal(*v, &armTemplateProperties) - if err != nil { - return err - } - at.ArmTemplateProperties = &armTemplateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - at.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - at.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - at.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - at.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - at.Tags = tags - } - } - } - - return nil -} - -// ArmTemplateInfo information about a generated ARM template. -type ArmTemplateInfo struct { - autorest.Response `json:"-"` - // Template - The template's contents. - Template interface{} `json:"template,omitempty"` - // Parameters - The parameters of the ARM template. - Parameters interface{} `json:"parameters,omitempty"` -} - -// ArmTemplateList the response of a list operation. -type ArmTemplateList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]ArmTemplate `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ArmTemplateListIterator provides access to a complete listing of ArmTemplate values. -type ArmTemplateListIterator struct { - i int - page ArmTemplateListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ArmTemplateListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArmTemplateListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ArmTemplateListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ArmTemplateListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ArmTemplateListIterator) Response() ArmTemplateList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ArmTemplateListIterator) Value() ArmTemplate { - if !iter.page.NotDone() { - return ArmTemplate{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ArmTemplateListIterator type. -func NewArmTemplateListIterator(page ArmTemplateListPage) ArmTemplateListIterator { - return ArmTemplateListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (atl ArmTemplateList) IsEmpty() bool { - return atl.Value == nil || len(*atl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (atl ArmTemplateList) hasNextLink() bool { - return atl.NextLink != nil && len(*atl.NextLink) != 0 -} - -// armTemplateListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (atl ArmTemplateList) armTemplateListPreparer(ctx context.Context) (*http.Request, error) { - if !atl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(atl.NextLink))) -} - -// ArmTemplateListPage contains a page of ArmTemplate values. -type ArmTemplateListPage struct { - fn func(context.Context, ArmTemplateList) (ArmTemplateList, error) - atl ArmTemplateList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ArmTemplateListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArmTemplateListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.atl) - if err != nil { - return err - } - page.atl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ArmTemplateListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ArmTemplateListPage) NotDone() bool { - return !page.atl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ArmTemplateListPage) Response() ArmTemplateList { - return page.atl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ArmTemplateListPage) Values() []ArmTemplate { - if page.atl.IsEmpty() { - return nil - } - return *page.atl.Value -} - -// Creates a new instance of the ArmTemplateListPage type. -func NewArmTemplateListPage(cur ArmTemplateList, getNextPage func(context.Context, ArmTemplateList) (ArmTemplateList, error)) ArmTemplateListPage { - return ArmTemplateListPage{ - fn: getNextPage, - atl: cur, - } -} - -// ArmTemplateParameterProperties properties of an Azure Resource Manager template parameter. -type ArmTemplateParameterProperties struct { - // Name - The name of the template parameter. - Name *string `json:"name,omitempty"` - // Value - The value of the template parameter. - Value *string `json:"value,omitempty"` -} - -// ArmTemplateParameterPropertiesFragment properties of an Azure Resource Manager template parameter. -type ArmTemplateParameterPropertiesFragment struct { - // Name - The name of the template parameter. - Name *string `json:"name,omitempty"` - // Value - The value of the template parameter. - Value *string `json:"value,omitempty"` -} - -// ArmTemplateProperties properties of an Azure Resource Manager template. -type ArmTemplateProperties struct { - // DisplayName - READ-ONLY; The display name of the ARM template. - DisplayName *string `json:"displayName,omitempty"` - // Description - READ-ONLY; The description of the ARM template. - Description *string `json:"description,omitempty"` - // Publisher - READ-ONLY; The publisher of the ARM template. - Publisher *string `json:"publisher,omitempty"` - // Icon - READ-ONLY; The URI to the icon of the ARM template. - Icon *string `json:"icon,omitempty"` - // Contents - READ-ONLY; The contents of the ARM template. - Contents interface{} `json:"contents,omitempty"` - // CreatedDate - READ-ONLY; The creation date of the armTemplate. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // ParametersValueFilesInfo - READ-ONLY; File name and parameter values information from all azuredeploy.*.parameters.json for the ARM template. - ParametersValueFilesInfo *[]ParametersValueFileInfo `json:"parametersValueFilesInfo,omitempty"` - // Enabled - READ-ONLY; Whether or not ARM template is enabled for use by lab user. - Enabled *bool `json:"enabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for ArmTemplateProperties. -func (atp ArmTemplateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Artifact an artifact. -type Artifact struct { - autorest.Response `json:"-"` - // ArtifactProperties - The properties of the resource. - *ArtifactProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Artifact. -func (a Artifact) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.ArtifactProperties != nil { - objectMap["properties"] = a.ArtifactProperties - } - if a.Location != nil { - objectMap["location"] = a.Location - } - if a.Tags != nil { - objectMap["tags"] = a.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Artifact struct. -func (a *Artifact) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var artifactProperties ArtifactProperties - err = json.Unmarshal(*v, &artifactProperties) - if err != nil { - return err - } - a.ArtifactProperties = &artifactProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - a.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - a.Tags = tags - } - } - } - - return nil -} - -// ArtifactDeploymentStatusProperties properties of an artifact deployment. -type ArtifactDeploymentStatusProperties struct { - // DeploymentStatus - The deployment status of the artifact. - DeploymentStatus *string `json:"deploymentStatus,omitempty"` - // ArtifactsApplied - The total count of the artifacts that were successfully applied. - ArtifactsApplied *int32 `json:"artifactsApplied,omitempty"` - // TotalArtifacts - The total count of the artifacts that were tentatively applied. - TotalArtifacts *int32 `json:"totalArtifacts,omitempty"` -} - -// ArtifactDeploymentStatusPropertiesFragment properties of an artifact deployment. -type ArtifactDeploymentStatusPropertiesFragment struct { - // DeploymentStatus - The deployment status of the artifact. - DeploymentStatus *string `json:"deploymentStatus,omitempty"` - // ArtifactsApplied - The total count of the artifacts that were successfully applied. - ArtifactsApplied *int32 `json:"artifactsApplied,omitempty"` - // TotalArtifacts - The total count of the artifacts that were tentatively applied. - TotalArtifacts *int32 `json:"totalArtifacts,omitempty"` -} - -// ArtifactInstallProperties properties of an artifact. -type ArtifactInstallProperties struct { - // ArtifactID - The artifact's identifier. - ArtifactID *string `json:"artifactId,omitempty"` - // ArtifactTitle - The artifact's title. - ArtifactTitle *string `json:"artifactTitle,omitempty"` - // Parameters - The parameters of the artifact. - Parameters *[]ArtifactParameterProperties `json:"parameters,omitempty"` - // Status - The status of the artifact. - Status *string `json:"status,omitempty"` - // DeploymentStatusMessage - The status message from the deployment. - DeploymentStatusMessage *string `json:"deploymentStatusMessage,omitempty"` - // VMExtensionStatusMessage - The status message from the virtual machine extension. - VMExtensionStatusMessage *string `json:"vmExtensionStatusMessage,omitempty"` - // InstallTime - The time that the artifact starts to install on the virtual machine. - InstallTime *date.Time `json:"installTime,omitempty"` -} - -// ArtifactInstallPropertiesFragment properties of an artifact. -type ArtifactInstallPropertiesFragment struct { - // ArtifactID - The artifact's identifier. - ArtifactID *string `json:"artifactId,omitempty"` - // ArtifactTitle - The artifact's title. - ArtifactTitle *string `json:"artifactTitle,omitempty"` - // Parameters - The parameters of the artifact. - Parameters *[]ArtifactParameterPropertiesFragment `json:"parameters,omitempty"` - // Status - The status of the artifact. - Status *string `json:"status,omitempty"` - // DeploymentStatusMessage - The status message from the deployment. - DeploymentStatusMessage *string `json:"deploymentStatusMessage,omitempty"` - // VMExtensionStatusMessage - The status message from the virtual machine extension. - VMExtensionStatusMessage *string `json:"vmExtensionStatusMessage,omitempty"` - // InstallTime - The time that the artifact starts to install on the virtual machine. - InstallTime *date.Time `json:"installTime,omitempty"` -} - -// ArtifactList the response of a list operation. -type ArtifactList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]Artifact `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ArtifactListIterator provides access to a complete listing of Artifact values. -type ArtifactListIterator struct { - i int - page ArtifactListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ArtifactListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArtifactListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ArtifactListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ArtifactListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ArtifactListIterator) Response() ArtifactList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ArtifactListIterator) Value() Artifact { - if !iter.page.NotDone() { - return Artifact{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ArtifactListIterator type. -func NewArtifactListIterator(page ArtifactListPage) ArtifactListIterator { - return ArtifactListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (al ArtifactList) IsEmpty() bool { - return al.Value == nil || len(*al.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (al ArtifactList) hasNextLink() bool { - return al.NextLink != nil && len(*al.NextLink) != 0 -} - -// artifactListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (al ArtifactList) artifactListPreparer(ctx context.Context) (*http.Request, error) { - if !al.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(al.NextLink))) -} - -// ArtifactListPage contains a page of Artifact values. -type ArtifactListPage struct { - fn func(context.Context, ArtifactList) (ArtifactList, error) - al ArtifactList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ArtifactListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArtifactListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.al) - if err != nil { - return err - } - page.al = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ArtifactListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ArtifactListPage) NotDone() bool { - return !page.al.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ArtifactListPage) Response() ArtifactList { - return page.al -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ArtifactListPage) Values() []Artifact { - if page.al.IsEmpty() { - return nil - } - return *page.al.Value -} - -// Creates a new instance of the ArtifactListPage type. -func NewArtifactListPage(cur ArtifactList, getNextPage func(context.Context, ArtifactList) (ArtifactList, error)) ArtifactListPage { - return ArtifactListPage{ - fn: getNextPage, - al: cur, - } -} - -// ArtifactParameterProperties properties of an artifact parameter. -type ArtifactParameterProperties struct { - // Name - The name of the artifact parameter. - Name *string `json:"name,omitempty"` - // Value - The value of the artifact parameter. - Value *string `json:"value,omitempty"` -} - -// ArtifactParameterPropertiesFragment properties of an artifact parameter. -type ArtifactParameterPropertiesFragment struct { - // Name - The name of the artifact parameter. - Name *string `json:"name,omitempty"` - // Value - The value of the artifact parameter. - Value *string `json:"value,omitempty"` -} - -// ArtifactProperties properties of an artifact. -type ArtifactProperties struct { - // Title - READ-ONLY; The artifact's title. - Title *string `json:"title,omitempty"` - // Description - READ-ONLY; The artifact's description. - Description *string `json:"description,omitempty"` - // Publisher - READ-ONLY; The artifact's publisher. - Publisher *string `json:"publisher,omitempty"` - // FilePath - READ-ONLY; The file path to the artifact. - FilePath *string `json:"filePath,omitempty"` - // Icon - READ-ONLY; The URI to the artifact icon. - Icon *string `json:"icon,omitempty"` - // TargetOsType - READ-ONLY; The artifact's target OS. - TargetOsType *string `json:"targetOsType,omitempty"` - // Parameters - READ-ONLY; The artifact's parameters. - Parameters interface{} `json:"parameters,omitempty"` - // CreatedDate - READ-ONLY; The artifact's creation date. - CreatedDate *date.Time `json:"createdDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for ArtifactProperties. -func (ap ArtifactProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ArtifactSource properties of an artifact source. -type ArtifactSource struct { - autorest.Response `json:"-"` - // ArtifactSourceProperties - The properties of the resource. - *ArtifactSourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ArtifactSource. -func (as ArtifactSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if as.ArtifactSourceProperties != nil { - objectMap["properties"] = as.ArtifactSourceProperties - } - if as.Location != nil { - objectMap["location"] = as.Location - } - if as.Tags != nil { - objectMap["tags"] = as.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ArtifactSource struct. -func (as *ArtifactSource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var artifactSourceProperties ArtifactSourceProperties - err = json.Unmarshal(*v, &artifactSourceProperties) - if err != nil { - return err - } - as.ArtifactSourceProperties = &artifactSourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - as.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - as.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - as.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - as.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - as.Tags = tags - } - } - } - - return nil -} - -// ArtifactSourceFragment properties of an artifact source. -type ArtifactSourceFragment struct { - // ArtifactSourcePropertiesFragment - The properties of the resource. - *ArtifactSourcePropertiesFragment `json:"properties,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ArtifactSourceFragment. -func (asf ArtifactSourceFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asf.ArtifactSourcePropertiesFragment != nil { - objectMap["properties"] = asf.ArtifactSourcePropertiesFragment - } - if asf.Tags != nil { - objectMap["tags"] = asf.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ArtifactSourceFragment struct. -func (asf *ArtifactSourceFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var artifactSourcePropertiesFragment ArtifactSourcePropertiesFragment - err = json.Unmarshal(*v, &artifactSourcePropertiesFragment) - if err != nil { - return err - } - asf.ArtifactSourcePropertiesFragment = &artifactSourcePropertiesFragment - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - asf.Tags = tags - } - } - } - - return nil -} - -// ArtifactSourceList the response of a list operation. -type ArtifactSourceList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]ArtifactSource `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ArtifactSourceListIterator provides access to a complete listing of ArtifactSource values. -type ArtifactSourceListIterator struct { - i int - page ArtifactSourceListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ArtifactSourceListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArtifactSourceListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ArtifactSourceListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ArtifactSourceListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ArtifactSourceListIterator) Response() ArtifactSourceList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ArtifactSourceListIterator) Value() ArtifactSource { - if !iter.page.NotDone() { - return ArtifactSource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ArtifactSourceListIterator type. -func NewArtifactSourceListIterator(page ArtifactSourceListPage) ArtifactSourceListIterator { - return ArtifactSourceListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asl ArtifactSourceList) IsEmpty() bool { - return asl.Value == nil || len(*asl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asl ArtifactSourceList) hasNextLink() bool { - return asl.NextLink != nil && len(*asl.NextLink) != 0 -} - -// artifactSourceListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asl ArtifactSourceList) artifactSourceListPreparer(ctx context.Context) (*http.Request, error) { - if !asl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asl.NextLink))) -} - -// ArtifactSourceListPage contains a page of ArtifactSource values. -type ArtifactSourceListPage struct { - fn func(context.Context, ArtifactSourceList) (ArtifactSourceList, error) - asl ArtifactSourceList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ArtifactSourceListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArtifactSourceListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.asl) - if err != nil { - return err - } - page.asl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ArtifactSourceListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ArtifactSourceListPage) NotDone() bool { - return !page.asl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ArtifactSourceListPage) Response() ArtifactSourceList { - return page.asl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ArtifactSourceListPage) Values() []ArtifactSource { - if page.asl.IsEmpty() { - return nil - } - return *page.asl.Value -} - -// Creates a new instance of the ArtifactSourceListPage type. -func NewArtifactSourceListPage(cur ArtifactSourceList, getNextPage func(context.Context, ArtifactSourceList) (ArtifactSourceList, error)) ArtifactSourceListPage { - return ArtifactSourceListPage{ - fn: getNextPage, - asl: cur, - } -} - -// ArtifactSourceProperties properties of an artifact source. -type ArtifactSourceProperties struct { - // DisplayName - The artifact source's display name. - DisplayName *string `json:"displayName,omitempty"` - // URI - The artifact source's URI. - URI *string `json:"uri,omitempty"` - // SourceType - The artifact source's type. Possible values include: 'VsoGit', 'GitHub' - SourceType SourceControlType `json:"sourceType,omitempty"` - // FolderPath - The folder containing artifacts. - FolderPath *string `json:"folderPath,omitempty"` - // ArmTemplateFolderPath - The folder containing Azure Resource Manager templates. - ArmTemplateFolderPath *string `json:"armTemplateFolderPath,omitempty"` - // BranchRef - The artifact source's branch reference. - BranchRef *string `json:"branchRef,omitempty"` - // SecurityToken - The security token to authenticate to the artifact source. - SecurityToken *string `json:"securityToken,omitempty"` - // Status - Indicates if the artifact source is enabled (values: Enabled, Disabled). Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' - Status EnableStatus `json:"status,omitempty"` - // CreatedDate - READ-ONLY; The artifact source's creation date. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for ArtifactSourceProperties. -func (asp ArtifactSourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asp.DisplayName != nil { - objectMap["displayName"] = asp.DisplayName - } - if asp.URI != nil { - objectMap["uri"] = asp.URI - } - if asp.SourceType != "" { - objectMap["sourceType"] = asp.SourceType - } - if asp.FolderPath != nil { - objectMap["folderPath"] = asp.FolderPath - } - if asp.ArmTemplateFolderPath != nil { - objectMap["armTemplateFolderPath"] = asp.ArmTemplateFolderPath - } - if asp.BranchRef != nil { - objectMap["branchRef"] = asp.BranchRef - } - if asp.SecurityToken != nil { - objectMap["securityToken"] = asp.SecurityToken - } - if asp.Status != "" { - objectMap["status"] = asp.Status - } - return json.Marshal(objectMap) -} - -// ArtifactSourcePropertiesFragment properties of an artifact source. -type ArtifactSourcePropertiesFragment struct { - // DisplayName - The artifact source's display name. - DisplayName *string `json:"displayName,omitempty"` - // URI - The artifact source's URI. - URI *string `json:"uri,omitempty"` - // SourceType - The artifact source's type. Possible values include: 'VsoGit', 'GitHub' - SourceType SourceControlType `json:"sourceType,omitempty"` - // FolderPath - The folder containing artifacts. - FolderPath *string `json:"folderPath,omitempty"` - // ArmTemplateFolderPath - The folder containing Azure Resource Manager templates. - ArmTemplateFolderPath *string `json:"armTemplateFolderPath,omitempty"` - // BranchRef - The artifact source's branch reference. - BranchRef *string `json:"branchRef,omitempty"` - // SecurityToken - The security token to authenticate to the artifact source. - SecurityToken *string `json:"securityToken,omitempty"` - // Status - Indicates if the artifact source is enabled (values: Enabled, Disabled). Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' - Status EnableStatus `json:"status,omitempty"` -} - -// AttachDiskProperties properties of the disk to attach. -type AttachDiskProperties struct { - // LeasedByLabVMID - The resource ID of the Lab virtual machine to which the disk is attached. - LeasedByLabVMID *string `json:"leasedByLabVmId,omitempty"` -} - -// AttachNewDataDiskOptions properties to attach new disk to the Virtual Machine. -type AttachNewDataDiskOptions struct { - // DiskSizeGiB - Size of the disk to be attached in GibiBytes. - DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` - // DiskName - The name of the disk to be attached. - DiskName *string `json:"diskName,omitempty"` - // DiskType - The storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium', 'StandardSSD' - DiskType StorageType `json:"diskType,omitempty"` -} - -// AttachNewDataDiskOptionsFragment properties to attach new disk to the Virtual Machine. -type AttachNewDataDiskOptionsFragment struct { - // DiskSizeGiB - Size of the disk to be attached in GibiBytes. - DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` - // DiskName - The name of the disk to be attached. - DiskName *string `json:"diskName,omitempty"` - // DiskType - The storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium', 'StandardSSD' - DiskType StorageType `json:"diskType,omitempty"` -} - -// BulkCreationParameters parameters for creating multiple virtual machines as a single action. -type BulkCreationParameters struct { - // InstanceCount - The number of virtual machine instances to create. - InstanceCount *int32 `json:"instanceCount,omitempty"` -} - -// BulkCreationParametersFragment parameters for creating multiple virtual machines as a single action. -type BulkCreationParametersFragment struct { - // InstanceCount - The number of virtual machine instances to create. - InstanceCount *int32 `json:"instanceCount,omitempty"` -} - -// CloudError error from a REST request. -type CloudError struct { - // Error - The cloud error that occurred - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody body of an error from a REST request. -type CloudErrorBody struct { - // Code - The error code. - Code *string `json:"code,omitempty"` - // Message - The error message. - Message *string `json:"message,omitempty"` - // Target - The error target. - Target *string `json:"target,omitempty"` - // Details - Inner errors. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// ComputeDataDisk a data disks attached to a virtual machine. -type ComputeDataDisk struct { - // Name - Gets data disk name. - Name *string `json:"name,omitempty"` - // DiskURI - When backed by a blob, the URI of underlying blob. - DiskURI *string `json:"diskUri,omitempty"` - // ManagedDiskID - When backed by managed disk, this is the ID of the compute disk resource. - ManagedDiskID *string `json:"managedDiskId,omitempty"` - // DiskSizeGiB - Gets data disk size in GiB. - DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` -} - -// ComputeDataDiskFragment a data disks attached to a virtual machine. -type ComputeDataDiskFragment struct { - // Name - Gets data disk name. - Name *string `json:"name,omitempty"` - // DiskURI - When backed by a blob, the URI of underlying blob. - DiskURI *string `json:"diskUri,omitempty"` - // ManagedDiskID - When backed by managed disk, this is the ID of the compute disk resource. - ManagedDiskID *string `json:"managedDiskId,omitempty"` - // DiskSizeGiB - Gets data disk size in GiB. - DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` -} - -// ComputeVMInstanceViewStatus status information about a virtual machine. -type ComputeVMInstanceViewStatus struct { - // Code - Gets the status Code. - Code *string `json:"code,omitempty"` - // DisplayStatus - Gets the short localizable label for the status. - DisplayStatus *string `json:"displayStatus,omitempty"` - // Message - Gets the message associated with the status. - Message *string `json:"message,omitempty"` -} - -// ComputeVMInstanceViewStatusFragment status information about a virtual machine. -type ComputeVMInstanceViewStatusFragment struct { - // Code - Gets the status Code. - Code *string `json:"code,omitempty"` - // DisplayStatus - Gets the short localizable label for the status. - DisplayStatus *string `json:"displayStatus,omitempty"` - // Message - Gets the message associated with the status. - Message *string `json:"message,omitempty"` -} - -// ComputeVMProperties properties of a virtual machine returned by the Microsoft.Compute API. -type ComputeVMProperties struct { - // Statuses - Gets the statuses of the virtual machine. - Statuses *[]ComputeVMInstanceViewStatus `json:"statuses,omitempty"` - // OsType - Gets the OS type of the virtual machine. - OsType *string `json:"osType,omitempty"` - // VMSize - Gets the size of the virtual machine. - VMSize *string `json:"vmSize,omitempty"` - // NetworkInterfaceID - Gets the network interface ID of the virtual machine. - NetworkInterfaceID *string `json:"networkInterfaceId,omitempty"` - // OsDiskID - Gets OS disk blob uri for the virtual machine. - OsDiskID *string `json:"osDiskId,omitempty"` - // DataDiskIds - Gets data disks blob uri for the virtual machine. - DataDiskIds *[]string `json:"dataDiskIds,omitempty"` - // DataDisks - Gets all data disks attached to the virtual machine. - DataDisks *[]ComputeDataDisk `json:"dataDisks,omitempty"` -} - -// ComputeVMPropertiesFragment properties of a virtual machine returned by the Microsoft.Compute API. -type ComputeVMPropertiesFragment struct { - // Statuses - Gets the statuses of the virtual machine. - Statuses *[]ComputeVMInstanceViewStatusFragment `json:"statuses,omitempty"` - // OsType - Gets the OS type of the virtual machine. - OsType *string `json:"osType,omitempty"` - // VMSize - Gets the size of the virtual machine. - VMSize *string `json:"vmSize,omitempty"` - // NetworkInterfaceID - Gets the network interface ID of the virtual machine. - NetworkInterfaceID *string `json:"networkInterfaceId,omitempty"` - // OsDiskID - Gets OS disk blob uri for the virtual machine. - OsDiskID *string `json:"osDiskId,omitempty"` - // DataDiskIds - Gets data disks blob uri for the virtual machine. - DataDiskIds *[]string `json:"dataDiskIds,omitempty"` - // DataDisks - Gets all data disks attached to the virtual machine. - DataDisks *[]ComputeDataDiskFragment `json:"dataDisks,omitempty"` -} - -// CostThresholdProperties properties of a cost threshold item. -type CostThresholdProperties struct { - // ThresholdID - The ID of the cost threshold item. - ThresholdID *string `json:"thresholdId,omitempty"` - // PercentageThreshold - The value of the percentage cost threshold. - PercentageThreshold *PercentageCostThresholdProperties `json:"percentageThreshold,omitempty"` - // DisplayOnChart - Indicates whether this threshold will be displayed on cost charts. Possible values include: 'Enabled', 'Disabled' - DisplayOnChart CostThresholdStatus `json:"displayOnChart,omitempty"` - // SendNotificationWhenExceeded - Indicates whether notifications will be sent when this threshold is exceeded. Possible values include: 'Enabled', 'Disabled' - SendNotificationWhenExceeded CostThresholdStatus `json:"sendNotificationWhenExceeded,omitempty"` - // NotificationSent - Indicates the datetime when notifications were last sent for this threshold. - NotificationSent *string `json:"notificationSent,omitempty"` -} - -// CustomImage a custom image. -type CustomImage struct { - autorest.Response `json:"-"` - // CustomImageProperties - The properties of the resource. - *CustomImageProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CustomImage. -func (ci CustomImage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ci.CustomImageProperties != nil { - objectMap["properties"] = ci.CustomImageProperties - } - if ci.Location != nil { - objectMap["location"] = ci.Location - } - if ci.Tags != nil { - objectMap["tags"] = ci.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CustomImage struct. -func (ci *CustomImage) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var customImageProperties CustomImageProperties - err = json.Unmarshal(*v, &customImageProperties) - if err != nil { - return err - } - ci.CustomImageProperties = &customImageProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ci.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ci.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ci.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ci.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ci.Tags = tags - } - } - } - - return nil -} - -// CustomImageFragment a custom image. -type CustomImageFragment struct { - // CustomImagePropertiesFragment - The properties of the resource. - *CustomImagePropertiesFragment `json:"properties,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CustomImageFragment. -func (cif CustomImageFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cif.CustomImagePropertiesFragment != nil { - objectMap["properties"] = cif.CustomImagePropertiesFragment - } - if cif.Tags != nil { - objectMap["tags"] = cif.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CustomImageFragment struct. -func (cif *CustomImageFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var customImagePropertiesFragment CustomImagePropertiesFragment - err = json.Unmarshal(*v, &customImagePropertiesFragment) - if err != nil { - return err - } - cif.CustomImagePropertiesFragment = &customImagePropertiesFragment - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cif.Tags = tags - } - } - } - - return nil -} - -// CustomImageList the response of a list operation. -type CustomImageList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]CustomImage `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// CustomImageListIterator provides access to a complete listing of CustomImage values. -type CustomImageListIterator struct { - i int - page CustomImageListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *CustomImageListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomImageListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *CustomImageListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CustomImageListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter CustomImageListIterator) Response() CustomImageList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter CustomImageListIterator) Value() CustomImage { - if !iter.page.NotDone() { - return CustomImage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CustomImageListIterator type. -func NewCustomImageListIterator(page CustomImageListPage) CustomImageListIterator { - return CustomImageListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cil CustomImageList) IsEmpty() bool { - return cil.Value == nil || len(*cil.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cil CustomImageList) hasNextLink() bool { - return cil.NextLink != nil && len(*cil.NextLink) != 0 -} - -// customImageListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cil CustomImageList) customImageListPreparer(ctx context.Context) (*http.Request, error) { - if !cil.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cil.NextLink))) -} - -// CustomImageListPage contains a page of CustomImage values. -type CustomImageListPage struct { - fn func(context.Context, CustomImageList) (CustomImageList, error) - cil CustomImageList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *CustomImageListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomImageListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cil) - if err != nil { - return err - } - page.cil = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *CustomImageListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CustomImageListPage) NotDone() bool { - return !page.cil.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CustomImageListPage) Response() CustomImageList { - return page.cil -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CustomImageListPage) Values() []CustomImage { - if page.cil.IsEmpty() { - return nil - } - return *page.cil.Value -} - -// Creates a new instance of the CustomImageListPage type. -func NewCustomImageListPage(cur CustomImageList, getNextPage func(context.Context, CustomImageList) (CustomImageList, error)) CustomImageListPage { - return CustomImageListPage{ - fn: getNextPage, - cil: cur, - } -} - -// CustomImageProperties properties of a custom image. -type CustomImageProperties struct { - // VM - The virtual machine from which the image is to be created. - VM *CustomImagePropertiesFromVM `json:"vm,omitempty"` - // Vhd - The VHD from which the image is to be created. - Vhd *CustomImagePropertiesCustom `json:"vhd,omitempty"` - // Description - The description of the custom image. - Description *string `json:"description,omitempty"` - // Author - The author of the custom image. - Author *string `json:"author,omitempty"` - // CreationDate - READ-ONLY; The creation date of the custom image. - CreationDate *date.Time `json:"creationDate,omitempty"` - // ManagedImageID - The Managed Image Id backing the custom image. - ManagedImageID *string `json:"managedImageId,omitempty"` - // ManagedSnapshotID - The Managed Snapshot Id backing the custom image. - ManagedSnapshotID *string `json:"managedSnapshotId,omitempty"` - // DataDiskStorageInfo - Storage information about the data disks present in the custom image - DataDiskStorageInfo *[]DataDiskStorageTypeInfo `json:"dataDiskStorageInfo,omitempty"` - // CustomImagePlan - Storage information about the plan related to this custom image - CustomImagePlan *CustomImagePropertiesFromPlan `json:"customImagePlan,omitempty"` - // IsPlanAuthorized - Whether or not the custom images underlying offer/plan has been enabled for programmatic deployment - IsPlanAuthorized *bool `json:"isPlanAuthorized,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for CustomImageProperties. -func (cip CustomImageProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cip.VM != nil { - objectMap["vm"] = cip.VM - } - if cip.Vhd != nil { - objectMap["vhd"] = cip.Vhd - } - if cip.Description != nil { - objectMap["description"] = cip.Description - } - if cip.Author != nil { - objectMap["author"] = cip.Author - } - if cip.ManagedImageID != nil { - objectMap["managedImageId"] = cip.ManagedImageID - } - if cip.ManagedSnapshotID != nil { - objectMap["managedSnapshotId"] = cip.ManagedSnapshotID - } - if cip.DataDiskStorageInfo != nil { - objectMap["dataDiskStorageInfo"] = cip.DataDiskStorageInfo - } - if cip.CustomImagePlan != nil { - objectMap["customImagePlan"] = cip.CustomImagePlan - } - if cip.IsPlanAuthorized != nil { - objectMap["isPlanAuthorized"] = cip.IsPlanAuthorized - } - return json.Marshal(objectMap) -} - -// CustomImagePropertiesCustom properties for creating a custom image from a VHD. -type CustomImagePropertiesCustom struct { - // ImageName - The image name. - ImageName *string `json:"imageName,omitempty"` - // SysPrep - Indicates whether sysprep has been run on the VHD. - SysPrep *bool `json:"sysPrep,omitempty"` - // OsType - The OS type of the custom image (i.e. Windows, Linux). Possible values include: 'Windows', 'Linux', 'None' - OsType CustomImageOsType `json:"osType,omitempty"` -} - -// CustomImagePropertiesCustomFragment properties for creating a custom image from a VHD. -type CustomImagePropertiesCustomFragment struct { - // ImageName - The image name. - ImageName *string `json:"imageName,omitempty"` - // SysPrep - Indicates whether sysprep has been run on the VHD. - SysPrep *bool `json:"sysPrep,omitempty"` - // OsType - The OS type of the custom image (i.e. Windows, Linux). Possible values include: 'Windows', 'Linux', 'None' - OsType CustomImageOsType `json:"osType,omitempty"` -} - -// CustomImagePropertiesFragment properties of a custom image. -type CustomImagePropertiesFragment struct { - // VM - The virtual machine from which the image is to be created. - VM *CustomImagePropertiesFromVMFragment `json:"vm,omitempty"` - // Vhd - The VHD from which the image is to be created. - Vhd *CustomImagePropertiesCustomFragment `json:"vhd,omitempty"` - // Description - The description of the custom image. - Description *string `json:"description,omitempty"` - // Author - The author of the custom image. - Author *string `json:"author,omitempty"` - // ManagedImageID - The Managed Image Id backing the custom image. - ManagedImageID *string `json:"managedImageId,omitempty"` - // ManagedSnapshotID - The Managed Snapshot Id backing the custom image. - ManagedSnapshotID *string `json:"managedSnapshotId,omitempty"` - // DataDiskStorageInfo - Storage information about the data disks present in the custom image - DataDiskStorageInfo *[]DataDiskStorageTypeInfoFragment `json:"dataDiskStorageInfo,omitempty"` - // CustomImagePlan - Storage information about the plan related to this custom image - CustomImagePlan *CustomImagePropertiesFromPlanFragment `json:"customImagePlan,omitempty"` - // IsPlanAuthorized - Whether or not the custom images underlying offer/plan has been enabled for programmatic deployment - IsPlanAuthorized *bool `json:"isPlanAuthorized,omitempty"` -} - -// CustomImagePropertiesFromPlan properties for plan on a custom image. -type CustomImagePropertiesFromPlan struct { - // ID - The id of the plan, equivalent to name of the plan - ID *string `json:"id,omitempty"` - // Publisher - The publisher for the plan from the marketplace image the custom image is derived from - Publisher *string `json:"publisher,omitempty"` - // Offer - The offer for the plan from the marketplace image the custom image is derived from - Offer *string `json:"offer,omitempty"` -} - -// CustomImagePropertiesFromPlanFragment properties for plan on a custom image. -type CustomImagePropertiesFromPlanFragment struct { - // ID - The id of the plan, equivalent to name of the plan - ID *string `json:"id,omitempty"` - // Publisher - The publisher for the plan from the marketplace image the custom image is derived from - Publisher *string `json:"publisher,omitempty"` - // Offer - The offer for the plan from the marketplace image the custom image is derived from - Offer *string `json:"offer,omitempty"` -} - -// CustomImagePropertiesFromVM properties for creating a custom image from a virtual machine. -type CustomImagePropertiesFromVM struct { - // SourceVMID - The source vm identifier. - SourceVMID *string `json:"sourceVmId,omitempty"` - // WindowsOsInfo - The Windows OS information of the VM. - WindowsOsInfo *WindowsOsInfo `json:"windowsOsInfo,omitempty"` - // LinuxOsInfo - The Linux OS information of the VM. - LinuxOsInfo *LinuxOsInfo `json:"linuxOsInfo,omitempty"` -} - -// CustomImagePropertiesFromVMFragment properties for creating a custom image from a virtual machine. -type CustomImagePropertiesFromVMFragment struct { - // SourceVMID - The source vm identifier. - SourceVMID *string `json:"sourceVmId,omitempty"` - // WindowsOsInfo - The Windows OS information of the VM. - WindowsOsInfo *WindowsOsInfoFragment `json:"windowsOsInfo,omitempty"` - // LinuxOsInfo - The Linux OS information of the VM. - LinuxOsInfo *LinuxOsInfoFragment `json:"linuxOsInfo,omitempty"` -} - -// CustomImagesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type CustomImagesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CustomImagesClient) (CustomImage, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CustomImagesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CustomImagesCreateOrUpdateFuture.Result. -func (future *CustomImagesCreateOrUpdateFuture) result(client CustomImagesClient) (ci CustomImage, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CustomImagesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ci.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.CustomImagesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ci.Response.Response, err = future.GetResult(sender); err == nil && ci.Response.Response.StatusCode != http.StatusNoContent { - ci, err = client.CreateOrUpdateResponder(ci.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CustomImagesCreateOrUpdateFuture", "Result", ci.Response.Response, "Failure responding to request") - } - } - return -} - -// CustomImagesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type CustomImagesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CustomImagesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CustomImagesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CustomImagesDeleteFuture.Result. -func (future *CustomImagesDeleteFuture) result(client CustomImagesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.CustomImagesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.CustomImagesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DataDiskProperties request body for adding a new or existing data disk to a virtual machine. -type DataDiskProperties struct { - // AttachNewDataDiskOptions - Specifies options to attach a new disk to the virtual machine. - AttachNewDataDiskOptions *AttachNewDataDiskOptions `json:"attachNewDataDiskOptions,omitempty"` - // ExistingLabDiskID - Specifies the existing lab disk id to attach to virtual machine. - ExistingLabDiskID *string `json:"existingLabDiskId,omitempty"` - // HostCaching - Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). Possible values include: 'HostCachingOptionsNone', 'HostCachingOptionsReadOnly', 'HostCachingOptionsReadWrite' - HostCaching HostCachingOptions `json:"hostCaching,omitempty"` -} - -// DataDiskPropertiesFragment request body for adding a new or existing data disk to a virtual machine. -type DataDiskPropertiesFragment struct { - // AttachNewDataDiskOptions - Specifies options to attach a new disk to the virtual machine. - AttachNewDataDiskOptions *AttachNewDataDiskOptionsFragment `json:"attachNewDataDiskOptions,omitempty"` - // ExistingLabDiskID - Specifies the existing lab disk id to attach to virtual machine. - ExistingLabDiskID *string `json:"existingLabDiskId,omitempty"` - // HostCaching - Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). Possible values include: 'HostCachingOptionsNone', 'HostCachingOptionsReadOnly', 'HostCachingOptionsReadWrite' - HostCaching HostCachingOptions `json:"hostCaching,omitempty"` -} - -// DataDiskStorageTypeInfo storage information about the data disks present in the custom image -type DataDiskStorageTypeInfo struct { - // Lun - Disk Lun - Lun *string `json:"lun,omitempty"` - // StorageType - Disk Storage Type. Possible values include: 'Standard', 'Premium', 'StandardSSD' - StorageType StorageType `json:"storageType,omitempty"` -} - -// DataDiskStorageTypeInfoFragment storage information about the data disks present in the custom image -type DataDiskStorageTypeInfoFragment struct { - // Lun - Disk Lun - Lun *string `json:"lun,omitempty"` - // StorageType - Disk Storage Type. Possible values include: 'Standard', 'Premium', 'StandardSSD' - StorageType StorageType `json:"storageType,omitempty"` -} - -// DayDetails properties of a daily schedule. -type DayDetails struct { - // Time - The time of day the schedule will occur. - Time *string `json:"time,omitempty"` -} - -// DayDetailsFragment properties of a daily schedule. -type DayDetailsFragment struct { - // Time - The time of day the schedule will occur. - Time *string `json:"time,omitempty"` -} - -// DetachDataDiskProperties request body for detaching data disk from a virtual machine. -type DetachDataDiskProperties struct { - // ExistingLabDiskID - Specifies the disk resource ID to detach from virtual machine. - ExistingLabDiskID *string `json:"existingLabDiskId,omitempty"` -} - -// DetachDiskProperties properties of the disk to detach. -type DetachDiskProperties struct { - // LeasedByLabVMID - The resource ID of the Lab VM to which the disk is attached. - LeasedByLabVMID *string `json:"leasedByLabVmId,omitempty"` -} - -// Disk a Disk. -type Disk struct { - autorest.Response `json:"-"` - // DiskProperties - The properties of the resource. - *DiskProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Disk. -func (d Disk) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.DiskProperties != nil { - objectMap["properties"] = d.DiskProperties - } - if d.Location != nil { - objectMap["location"] = d.Location - } - if d.Tags != nil { - objectMap["tags"] = d.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Disk struct. -func (d *Disk) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var diskProperties DiskProperties - err = json.Unmarshal(*v, &diskProperties) - if err != nil { - return err - } - d.DiskProperties = &diskProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - d.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - d.Tags = tags - } - } - } - - return nil -} - -// DiskFragment a Disk. -type DiskFragment struct { - // DiskPropertiesFragment - The properties of the resource. - *DiskPropertiesFragment `json:"properties,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DiskFragment. -func (df DiskFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if df.DiskPropertiesFragment != nil { - objectMap["properties"] = df.DiskPropertiesFragment - } - if df.Tags != nil { - objectMap["tags"] = df.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DiskFragment struct. -func (df *DiskFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var diskPropertiesFragment DiskPropertiesFragment - err = json.Unmarshal(*v, &diskPropertiesFragment) - if err != nil { - return err - } - df.DiskPropertiesFragment = &diskPropertiesFragment - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - df.Tags = tags - } - } - } - - return nil -} - -// DiskList the response of a list operation. -type DiskList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]Disk `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// DiskListIterator provides access to a complete listing of Disk values. -type DiskListIterator struct { - i int - page DiskListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DiskListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiskListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DiskListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DiskListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DiskListIterator) Response() DiskList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DiskListIterator) Value() Disk { - if !iter.page.NotDone() { - return Disk{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DiskListIterator type. -func NewDiskListIterator(page DiskListPage) DiskListIterator { - return DiskListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dl DiskList) IsEmpty() bool { - return dl.Value == nil || len(*dl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dl DiskList) hasNextLink() bool { - return dl.NextLink != nil && len(*dl.NextLink) != 0 -} - -// diskListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dl DiskList) diskListPreparer(ctx context.Context) (*http.Request, error) { - if !dl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dl.NextLink))) -} - -// DiskListPage contains a page of Disk values. -type DiskListPage struct { - fn func(context.Context, DiskList) (DiskList, error) - dl DiskList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DiskListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiskListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dl) - if err != nil { - return err - } - page.dl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DiskListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DiskListPage) NotDone() bool { - return !page.dl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DiskListPage) Response() DiskList { - return page.dl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DiskListPage) Values() []Disk { - if page.dl.IsEmpty() { - return nil - } - return *page.dl.Value -} - -// Creates a new instance of the DiskListPage type. -func NewDiskListPage(cur DiskList, getNextPage func(context.Context, DiskList) (DiskList, error)) DiskListPage { - return DiskListPage{ - fn: getNextPage, - dl: cur, - } -} - -// DiskProperties properties of a disk. -type DiskProperties struct { - // DiskType - The storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium', 'StandardSSD' - DiskType StorageType `json:"diskType,omitempty"` - // DiskSizeGiB - The size of the disk in GibiBytes. - DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` - // LeasedByLabVMID - The resource ID of the VM to which this disk is leased. - LeasedByLabVMID *string `json:"leasedByLabVmId,omitempty"` - // DiskBlobName - When backed by a blob, the name of the VHD blob without extension. - DiskBlobName *string `json:"diskBlobName,omitempty"` - // DiskURI - When backed by a blob, the URI of underlying blob. - DiskURI *string `json:"diskUri,omitempty"` - // CreatedDate - READ-ONLY; The creation date of the disk. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // HostCaching - The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). - HostCaching *string `json:"hostCaching,omitempty"` - // ManagedDiskID - When backed by managed disk, this is the ID of the compute disk resource. - ManagedDiskID *string `json:"managedDiskId,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for DiskProperties. -func (dp DiskProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.DiskType != "" { - objectMap["diskType"] = dp.DiskType - } - if dp.DiskSizeGiB != nil { - objectMap["diskSizeGiB"] = dp.DiskSizeGiB - } - if dp.LeasedByLabVMID != nil { - objectMap["leasedByLabVmId"] = dp.LeasedByLabVMID - } - if dp.DiskBlobName != nil { - objectMap["diskBlobName"] = dp.DiskBlobName - } - if dp.DiskURI != nil { - objectMap["diskUri"] = dp.DiskURI - } - if dp.HostCaching != nil { - objectMap["hostCaching"] = dp.HostCaching - } - if dp.ManagedDiskID != nil { - objectMap["managedDiskId"] = dp.ManagedDiskID - } - return json.Marshal(objectMap) -} - -// DiskPropertiesFragment properties of a disk. -type DiskPropertiesFragment struct { - // DiskType - The storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium', 'StandardSSD' - DiskType StorageType `json:"diskType,omitempty"` - // DiskSizeGiB - The size of the disk in GibiBytes. - DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` - // LeasedByLabVMID - The resource ID of the VM to which this disk is leased. - LeasedByLabVMID *string `json:"leasedByLabVmId,omitempty"` - // DiskBlobName - When backed by a blob, the name of the VHD blob without extension. - DiskBlobName *string `json:"diskBlobName,omitempty"` - // DiskURI - When backed by a blob, the URI of underlying blob. - DiskURI *string `json:"diskUri,omitempty"` - // HostCaching - The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). - HostCaching *string `json:"hostCaching,omitempty"` - // ManagedDiskID - When backed by managed disk, this is the ID of the compute disk resource. - ManagedDiskID *string `json:"managedDiskId,omitempty"` -} - -// DisksAttachFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type DisksAttachFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DisksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DisksAttachFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DisksAttachFuture.Result. -func (future *DisksAttachFuture) result(client DisksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksAttachFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.DisksAttachFuture") - return - } - ar.Response = future.Response() - return -} - -// DisksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DisksCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DisksClient) (Disk, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DisksCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DisksCreateOrUpdateFuture.Result. -func (future *DisksCreateOrUpdateFuture) result(client DisksClient) (d Disk, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.DisksCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DisksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type DisksDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DisksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DisksDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DisksDeleteFuture.Result. -func (future *DisksDeleteFuture) result(client DisksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.DisksDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DisksDetachFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type DisksDetachFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DisksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DisksDetachFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DisksDetachFuture.Result. -func (future *DisksDetachFuture) result(client DisksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.DisksDetachFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.DisksDetachFuture") - return - } - ar.Response = future.Response() - return -} - -// Environment an environment, which is essentially an ARM template deployment. -type Environment struct { - autorest.Response `json:"-"` - // EnvironmentProperties - The properties of the resource. - *EnvironmentProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Environment. -func (e Environment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if e.EnvironmentProperties != nil { - objectMap["properties"] = e.EnvironmentProperties - } - if e.Location != nil { - objectMap["location"] = e.Location - } - if e.Tags != nil { - objectMap["tags"] = e.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Environment struct. -func (e *Environment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var environmentProperties EnvironmentProperties - err = json.Unmarshal(*v, &environmentProperties) - if err != nil { - return err - } - e.EnvironmentProperties = &environmentProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - e.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - e.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - e.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - e.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - e.Tags = tags - } - } - } - - return nil -} - -// EnvironmentDeploymentProperties properties of an environment deployment. -type EnvironmentDeploymentProperties struct { - // ArmTemplateID - The Azure Resource Manager template's identifier. - ArmTemplateID *string `json:"armTemplateId,omitempty"` - // Parameters - The parameters of the Azure Resource Manager template. - Parameters *[]ArmTemplateParameterProperties `json:"parameters,omitempty"` -} - -// EnvironmentDeploymentPropertiesFragment properties of an environment deployment. -type EnvironmentDeploymentPropertiesFragment struct { - // ArmTemplateID - The Azure Resource Manager template's identifier. - ArmTemplateID *string `json:"armTemplateId,omitempty"` - // Parameters - The parameters of the Azure Resource Manager template. - Parameters *[]ArmTemplateParameterPropertiesFragment `json:"parameters,omitempty"` -} - -// EnvironmentFragment an environment, which is essentially an ARM template deployment. -type EnvironmentFragment struct { - // EnvironmentPropertiesFragment - The properties of the resource. - *EnvironmentPropertiesFragment `json:"properties,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for EnvironmentFragment. -func (ef EnvironmentFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ef.EnvironmentPropertiesFragment != nil { - objectMap["properties"] = ef.EnvironmentPropertiesFragment - } - if ef.Tags != nil { - objectMap["tags"] = ef.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EnvironmentFragment struct. -func (ef *EnvironmentFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var environmentPropertiesFragment EnvironmentPropertiesFragment - err = json.Unmarshal(*v, &environmentPropertiesFragment) - if err != nil { - return err - } - ef.EnvironmentPropertiesFragment = &environmentPropertiesFragment - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ef.Tags = tags - } - } - } - - return nil -} - -// EnvironmentList the response of a list operation. -type EnvironmentList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]Environment `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// EnvironmentListIterator provides access to a complete listing of Environment values. -type EnvironmentListIterator struct { - i int - page EnvironmentListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *EnvironmentListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *EnvironmentListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EnvironmentListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter EnvironmentListIterator) Response() EnvironmentList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter EnvironmentListIterator) Value() Environment { - if !iter.page.NotDone() { - return Environment{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EnvironmentListIterator type. -func NewEnvironmentListIterator(page EnvironmentListPage) EnvironmentListIterator { - return EnvironmentListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (el EnvironmentList) IsEmpty() bool { - return el.Value == nil || len(*el.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (el EnvironmentList) hasNextLink() bool { - return el.NextLink != nil && len(*el.NextLink) != 0 -} - -// environmentListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (el EnvironmentList) environmentListPreparer(ctx context.Context) (*http.Request, error) { - if !el.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(el.NextLink))) -} - -// EnvironmentListPage contains a page of Environment values. -type EnvironmentListPage struct { - fn func(context.Context, EnvironmentList) (EnvironmentList, error) - el EnvironmentList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *EnvironmentListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.el) - if err != nil { - return err - } - page.el = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *EnvironmentListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EnvironmentListPage) NotDone() bool { - return !page.el.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EnvironmentListPage) Response() EnvironmentList { - return page.el -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EnvironmentListPage) Values() []Environment { - if page.el.IsEmpty() { - return nil - } - return *page.el.Value -} - -// Creates a new instance of the EnvironmentListPage type. -func NewEnvironmentListPage(cur EnvironmentList, getNextPage func(context.Context, EnvironmentList) (EnvironmentList, error)) EnvironmentListPage { - return EnvironmentListPage{ - fn: getNextPage, - el: cur, - } -} - -// EnvironmentProperties properties of an environment. -type EnvironmentProperties struct { - // DeploymentProperties - The deployment properties of the environment. - DeploymentProperties *EnvironmentDeploymentProperties `json:"deploymentProperties,omitempty"` - // ArmTemplateDisplayName - The display name of the Azure Resource Manager template that produced the environment. - ArmTemplateDisplayName *string `json:"armTemplateDisplayName,omitempty"` - // ResourceGroupID - READ-ONLY; The identifier of the resource group containing the environment's resources. - ResourceGroupID *string `json:"resourceGroupId,omitempty"` - // CreatedByUser - READ-ONLY; The creator of the environment. - CreatedByUser *string `json:"createdByUser,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for EnvironmentProperties. -func (ep EnvironmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ep.DeploymentProperties != nil { - objectMap["deploymentProperties"] = ep.DeploymentProperties - } - if ep.ArmTemplateDisplayName != nil { - objectMap["armTemplateDisplayName"] = ep.ArmTemplateDisplayName - } - return json.Marshal(objectMap) -} - -// EnvironmentPropertiesFragment properties of an environment. -type EnvironmentPropertiesFragment struct { - // DeploymentProperties - The deployment properties of the environment. - DeploymentProperties *EnvironmentDeploymentPropertiesFragment `json:"deploymentProperties,omitempty"` - // ArmTemplateDisplayName - The display name of the Azure Resource Manager template that produced the environment. - ArmTemplateDisplayName *string `json:"armTemplateDisplayName,omitempty"` -} - -// EnvironmentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EnvironmentsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EnvironmentsClient) (Environment, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EnvironmentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for EnvironmentsCreateOrUpdateFuture.Result. -func (future *EnvironmentsCreateOrUpdateFuture) result(client EnvironmentsClient) (e Environment, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - e.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.EnvironmentsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { - e, err = client.CreateOrUpdateResponder(e.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsCreateOrUpdateFuture", "Result", e.Response.Response, "Failure responding to request") - } - } - return -} - -// EnvironmentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type EnvironmentsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EnvironmentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EnvironmentsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for EnvironmentsDeleteFuture.Result. -func (future *EnvironmentsDeleteFuture) result(client EnvironmentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.EnvironmentsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.EnvironmentsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// EvaluatePoliciesProperties properties for evaluating a policy set. -type EvaluatePoliciesProperties struct { - // FactName - The fact name. - FactName *string `json:"factName,omitempty"` - // FactData - The fact data. - FactData *string `json:"factData,omitempty"` - // ValueOffset - The value offset. - ValueOffset *string `json:"valueOffset,omitempty"` - // UserObjectID - The user for which policies will be evaluated - UserObjectID *string `json:"userObjectId,omitempty"` -} - -// EvaluatePoliciesRequest request body for evaluating a policy set. -type EvaluatePoliciesRequest struct { - // Policies - Policies to evaluate. - Policies *[]EvaluatePoliciesProperties `json:"policies,omitempty"` -} - -// EvaluatePoliciesResponse response body for evaluating a policy set. -type EvaluatePoliciesResponse struct { - autorest.Response `json:"-"` - // Results - Results of evaluating a policy set. - Results *[]PolicySetResult `json:"results,omitempty"` -} - -// Event an event to be notified for. -type Event struct { - // EventName - The event type for which this notification is enabled (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', 'Cost' - EventName NotificationChannelEventType `json:"eventName,omitempty"` -} - -// EventFragment an event to be notified for. -type EventFragment struct { - // EventName - The event type for which this notification is enabled (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', 'Cost' - EventName NotificationChannelEventType `json:"eventName,omitempty"` -} - -// ExportResourceUsageParameters the parameters of the export operation. -type ExportResourceUsageParameters struct { - // BlobStorageAbsoluteSasURI - The blob storage absolute sas uri with write permission to the container which the usage data needs to be uploaded to. - BlobStorageAbsoluteSasURI *string `json:"blobStorageAbsoluteSasUri,omitempty"` - // UsageStartDate - The start time of the usage. If not provided, usage will be reported since the beginning of data collection. - UsageStartDate *date.Time `json:"usageStartDate,omitempty"` -} - -// ExternalSubnet subnet information as returned by the Microsoft.Network API. -type ExternalSubnet struct { - // ID - Gets or sets the identifier. - ID *string `json:"id,omitempty"` - // Name - Gets or sets the name. - Name *string `json:"name,omitempty"` -} - -// ExternalSubnetFragment subnet information as returned by the Microsoft.Network API. -type ExternalSubnetFragment struct { - // ID - Gets or sets the identifier. - ID *string `json:"id,omitempty"` - // Name - Gets or sets the name. - Name *string `json:"name,omitempty"` -} - -// Formula a formula for creating a VM, specifying an image base and other parameters -type Formula struct { - autorest.Response `json:"-"` - // FormulaProperties - The properties of the resource. - *FormulaProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Formula. -func (f Formula) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if f.FormulaProperties != nil { - objectMap["properties"] = f.FormulaProperties - } - if f.Location != nil { - objectMap["location"] = f.Location - } - if f.Tags != nil { - objectMap["tags"] = f.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Formula struct. -func (f *Formula) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var formulaProperties FormulaProperties - err = json.Unmarshal(*v, &formulaProperties) - if err != nil { - return err - } - f.FormulaProperties = &formulaProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - f.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - f.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - f.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - f.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - f.Tags = tags - } - } - } - - return nil -} - -// FormulaFragment a formula for creating a VM, specifying an image base and other parameters -type FormulaFragment struct { - // FormulaPropertiesFragment - The properties of the resource. - *FormulaPropertiesFragment `json:"properties,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for FormulaFragment. -func (ff FormulaFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ff.FormulaPropertiesFragment != nil { - objectMap["properties"] = ff.FormulaPropertiesFragment - } - if ff.Tags != nil { - objectMap["tags"] = ff.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FormulaFragment struct. -func (ff *FormulaFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var formulaPropertiesFragment FormulaPropertiesFragment - err = json.Unmarshal(*v, &formulaPropertiesFragment) - if err != nil { - return err - } - ff.FormulaPropertiesFragment = &formulaPropertiesFragment - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ff.Tags = tags - } - } - } - - return nil -} - -// FormulaList the response of a list operation. -type FormulaList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]Formula `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// FormulaListIterator provides access to a complete listing of Formula values. -type FormulaListIterator struct { - i int - page FormulaListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *FormulaListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FormulaListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *FormulaListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter FormulaListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter FormulaListIterator) Response() FormulaList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter FormulaListIterator) Value() Formula { - if !iter.page.NotDone() { - return Formula{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the FormulaListIterator type. -func NewFormulaListIterator(page FormulaListPage) FormulaListIterator { - return FormulaListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (fl FormulaList) IsEmpty() bool { - return fl.Value == nil || len(*fl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (fl FormulaList) hasNextLink() bool { - return fl.NextLink != nil && len(*fl.NextLink) != 0 -} - -// formulaListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (fl FormulaList) formulaListPreparer(ctx context.Context) (*http.Request, error) { - if !fl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(fl.NextLink))) -} - -// FormulaListPage contains a page of Formula values. -type FormulaListPage struct { - fn func(context.Context, FormulaList) (FormulaList, error) - fl FormulaList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *FormulaListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FormulaListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.fl) - if err != nil { - return err - } - page.fl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *FormulaListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page FormulaListPage) NotDone() bool { - return !page.fl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page FormulaListPage) Response() FormulaList { - return page.fl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page FormulaListPage) Values() []Formula { - if page.fl.IsEmpty() { - return nil - } - return *page.fl.Value -} - -// Creates a new instance of the FormulaListPage type. -func NewFormulaListPage(cur FormulaList, getNextPage func(context.Context, FormulaList) (FormulaList, error)) FormulaListPage { - return FormulaListPage{ - fn: getNextPage, - fl: cur, - } -} - -// FormulaProperties properties of a formula. -type FormulaProperties struct { - // Description - The description of the formula. - Description *string `json:"description,omitempty"` - // Author - The author of the formula. - Author *string `json:"author,omitempty"` - // OsType - The OS type of the formula. - OsType *string `json:"osType,omitempty"` - // CreationDate - READ-ONLY; The creation date of the formula. - CreationDate *date.Time `json:"creationDate,omitempty"` - // FormulaContent - The content of the formula. - FormulaContent *LabVirtualMachineCreationParameter `json:"formulaContent,omitempty"` - // VM - Information about a VM from which a formula is to be created. - VM *FormulaPropertiesFromVM `json:"vm,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for FormulaProperties. -func (fp FormulaProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fp.Description != nil { - objectMap["description"] = fp.Description - } - if fp.Author != nil { - objectMap["author"] = fp.Author - } - if fp.OsType != nil { - objectMap["osType"] = fp.OsType - } - if fp.FormulaContent != nil { - objectMap["formulaContent"] = fp.FormulaContent - } - if fp.VM != nil { - objectMap["vm"] = fp.VM - } - return json.Marshal(objectMap) -} - -// FormulaPropertiesFragment properties of a formula. -type FormulaPropertiesFragment struct { - // Description - The description of the formula. - Description *string `json:"description,omitempty"` - // Author - The author of the formula. - Author *string `json:"author,omitempty"` - // OsType - The OS type of the formula. - OsType *string `json:"osType,omitempty"` - // FormulaContent - The content of the formula. - FormulaContent *LabVirtualMachineCreationParameterFragment `json:"formulaContent,omitempty"` - // VM - Information about a VM from which a formula is to be created. - VM *FormulaPropertiesFromVMFragment `json:"vm,omitempty"` -} - -// FormulaPropertiesFromVM information about a VM from which a formula is to be created. -type FormulaPropertiesFromVM struct { - // LabVMID - The identifier of the VM from which a formula is to be created. - LabVMID *string `json:"labVmId,omitempty"` -} - -// FormulaPropertiesFromVMFragment information about a VM from which a formula is to be created. -type FormulaPropertiesFromVMFragment struct { - // LabVMID - The identifier of the VM from which a formula is to be created. - LabVMID *string `json:"labVmId,omitempty"` -} - -// FormulasCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FormulasCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FormulasClient) (Formula, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FormulasCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FormulasCreateOrUpdateFuture.Result. -func (future *FormulasCreateOrUpdateFuture) result(client FormulasClient) (f Formula, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.FormulasCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - f.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.FormulasCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if f.Response.Response, err = future.GetResult(sender); err == nil && f.Response.Response.StatusCode != http.StatusNoContent { - f, err = client.CreateOrUpdateResponder(f.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.FormulasCreateOrUpdateFuture", "Result", f.Response.Response, "Failure responding to request") - } - } - return -} - -// GalleryImage a gallery image. -type GalleryImage struct { - // GalleryImageProperties - The properties of the resource. - *GalleryImageProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GalleryImage. -func (gi GalleryImage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gi.GalleryImageProperties != nil { - objectMap["properties"] = gi.GalleryImageProperties - } - if gi.Location != nil { - objectMap["location"] = gi.Location - } - if gi.Tags != nil { - objectMap["tags"] = gi.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GalleryImage struct. -func (gi *GalleryImage) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var galleryImageProperties GalleryImageProperties - err = json.Unmarshal(*v, &galleryImageProperties) - if err != nil { - return err - } - gi.GalleryImageProperties = &galleryImageProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - gi.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - gi.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - gi.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - gi.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - gi.Tags = tags - } - } - } - - return nil -} - -// GalleryImageList the response of a list operation. -type GalleryImageList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]GalleryImage `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// GalleryImageListIterator provides access to a complete listing of GalleryImage values. -type GalleryImageListIterator struct { - i int - page GalleryImageListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *GalleryImageListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *GalleryImageListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GalleryImageListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter GalleryImageListIterator) Response() GalleryImageList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter GalleryImageListIterator) Value() GalleryImage { - if !iter.page.NotDone() { - return GalleryImage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GalleryImageListIterator type. -func NewGalleryImageListIterator(page GalleryImageListPage) GalleryImageListIterator { - return GalleryImageListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (gil GalleryImageList) IsEmpty() bool { - return gil.Value == nil || len(*gil.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (gil GalleryImageList) hasNextLink() bool { - return gil.NextLink != nil && len(*gil.NextLink) != 0 -} - -// galleryImageListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (gil GalleryImageList) galleryImageListPreparer(ctx context.Context) (*http.Request, error) { - if !gil.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(gil.NextLink))) -} - -// GalleryImageListPage contains a page of GalleryImage values. -type GalleryImageListPage struct { - fn func(context.Context, GalleryImageList) (GalleryImageList, error) - gil GalleryImageList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *GalleryImageListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImageListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.gil) - if err != nil { - return err - } - page.gil = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *GalleryImageListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GalleryImageListPage) NotDone() bool { - return !page.gil.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GalleryImageListPage) Response() GalleryImageList { - return page.gil -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GalleryImageListPage) Values() []GalleryImage { - if page.gil.IsEmpty() { - return nil - } - return *page.gil.Value -} - -// Creates a new instance of the GalleryImageListPage type. -func NewGalleryImageListPage(cur GalleryImageList, getNextPage func(context.Context, GalleryImageList) (GalleryImageList, error)) GalleryImageListPage { - return GalleryImageListPage{ - fn: getNextPage, - gil: cur, - } -} - -// GalleryImageProperties properties of a gallery image. -type GalleryImageProperties struct { - // Author - The author of the gallery image. - Author *string `json:"author,omitempty"` - // CreatedDate - READ-ONLY; The creation date of the gallery image. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // Description - The description of the gallery image. - Description *string `json:"description,omitempty"` - // ImageReference - The image reference of the gallery image. - ImageReference *GalleryImageReference `json:"imageReference,omitempty"` - // Icon - The icon of the gallery image. - Icon *string `json:"icon,omitempty"` - // Enabled - Indicates whether this gallery image is enabled. - Enabled *bool `json:"enabled,omitempty"` - // PlanID - The third party plan that applies to this image - PlanID *string `json:"planId,omitempty"` - // IsPlanAuthorized - Indicates if the plan has been authorized for programmatic deployment. - IsPlanAuthorized *bool `json:"isPlanAuthorized,omitempty"` -} - -// MarshalJSON is the custom marshaler for GalleryImageProperties. -func (gip GalleryImageProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gip.Author != nil { - objectMap["author"] = gip.Author - } - if gip.Description != nil { - objectMap["description"] = gip.Description - } - if gip.ImageReference != nil { - objectMap["imageReference"] = gip.ImageReference - } - if gip.Icon != nil { - objectMap["icon"] = gip.Icon - } - if gip.Enabled != nil { - objectMap["enabled"] = gip.Enabled - } - if gip.PlanID != nil { - objectMap["planId"] = gip.PlanID - } - if gip.IsPlanAuthorized != nil { - objectMap["isPlanAuthorized"] = gip.IsPlanAuthorized - } - return json.Marshal(objectMap) -} - -// GalleryImageReference the reference information for an Azure Marketplace image. -type GalleryImageReference struct { - // Offer - The offer of the gallery image. - Offer *string `json:"offer,omitempty"` - // Publisher - The publisher of the gallery image. - Publisher *string `json:"publisher,omitempty"` - // Sku - The SKU of the gallery image. - Sku *string `json:"sku,omitempty"` - // OsType - The OS type of the gallery image. - OsType *string `json:"osType,omitempty"` - // Version - The version of the gallery image. - Version *string `json:"version,omitempty"` -} - -// GalleryImageReferenceFragment the reference information for an Azure Marketplace image. -type GalleryImageReferenceFragment struct { - // Offer - The offer of the gallery image. - Offer *string `json:"offer,omitempty"` - // Publisher - The publisher of the gallery image. - Publisher *string `json:"publisher,omitempty"` - // Sku - The SKU of the gallery image. - Sku *string `json:"sku,omitempty"` - // OsType - The OS type of the gallery image. - OsType *string `json:"osType,omitempty"` - // Version - The version of the gallery image. - Version *string `json:"version,omitempty"` -} - -// GenerateArmTemplateRequest parameters for generating an ARM template for deploying artifacts. -type GenerateArmTemplateRequest struct { - // VirtualMachineName - The resource name of the virtual machine. - VirtualMachineName *string `json:"virtualMachineName,omitempty"` - // Parameters - The parameters of the ARM template. - Parameters *[]ParameterInfo `json:"parameters,omitempty"` - // Location - The location of the virtual machine. - Location *string `json:"location,omitempty"` - // FileUploadOptions - Options for uploading the files for the artifact. UploadFilesAndGenerateSasTokens is the default value. Possible values include: 'FileUploadOptionsUploadFilesAndGenerateSasTokens', 'FileUploadOptionsNone' - FileUploadOptions FileUploadOptions `json:"fileUploadOptions,omitempty"` -} - -// GenerateUploadURIParameter properties for generating an upload URI. -type GenerateUploadURIParameter struct { - // BlobName - The blob name of the upload URI. - BlobName *string `json:"blobName,omitempty"` -} - -// GenerateUploadURIResponse response body for generating an upload URI. -type GenerateUploadURIResponse struct { - autorest.Response `json:"-"` - // UploadURI - The upload URI for the VHD. - UploadURI *string `json:"uploadUri,omitempty"` -} - -// GlobalSchedulesExecuteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type GlobalSchedulesExecuteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GlobalSchedulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GlobalSchedulesExecuteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GlobalSchedulesExecuteFuture.Result. -func (future *GlobalSchedulesExecuteFuture) result(client GlobalSchedulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesExecuteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.GlobalSchedulesExecuteFuture") - return - } - ar.Response = future.Response() - return -} - -// GlobalSchedulesRetargetFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type GlobalSchedulesRetargetFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GlobalSchedulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GlobalSchedulesRetargetFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GlobalSchedulesRetargetFuture.Result. -func (future *GlobalSchedulesRetargetFuture) result(client GlobalSchedulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.GlobalSchedulesRetargetFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.GlobalSchedulesRetargetFuture") - return - } - ar.Response = future.Response() - return -} - -// HourDetails properties of an hourly schedule. -type HourDetails struct { - // Minute - Minutes of the hour the schedule will run. - Minute *int32 `json:"minute,omitempty"` -} - -// HourDetailsFragment properties of an hourly schedule. -type HourDetailsFragment struct { - // Minute - Minutes of the hour the schedule will run. - Minute *int32 `json:"minute,omitempty"` -} - -// IdentityProperties properties of a managed identity -type IdentityProperties struct { - // Type - Managed identity. - Type *string `json:"type,omitempty"` - // PrincipalID - The principal id of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - The tenant identifier of resource. - TenantID *string `json:"tenantId,omitempty"` - // ClientSecretURL - The client secret URL of the identity. - ClientSecretURL *string `json:"clientSecretUrl,omitempty"` -} - -// ImportLabVirtualMachineRequest this represents the payload required to import a virtual machine from a -// different lab into the current one -type ImportLabVirtualMachineRequest struct { - // SourceVirtualMachineResourceID - The full resource ID of the virtual machine to be imported. - SourceVirtualMachineResourceID *string `json:"sourceVirtualMachineResourceId,omitempty"` - // DestinationVirtualMachineName - The name of the virtual machine in the destination lab - DestinationVirtualMachineName *string `json:"destinationVirtualMachineName,omitempty"` -} - -// InboundNatRule a rule for NAT - exposing a VM's port (backendPort) on the public IP address using a load -// balancer. -type InboundNatRule struct { - // TransportProtocol - The transport protocol for the endpoint. Possible values include: 'TCP', 'UDP' - TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` - // FrontendPort - The external endpoint port of the inbound connection. Possible values range between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically. - FrontendPort *int32 `json:"frontendPort,omitempty"` - // BackendPort - The port to which the external traffic will be redirected. - BackendPort *int32 `json:"backendPort,omitempty"` -} - -// InboundNatRuleFragment a rule for NAT - exposing a VM's port (backendPort) on the public IP address -// using a load balancer. -type InboundNatRuleFragment struct { - // TransportProtocol - The transport protocol for the endpoint. Possible values include: 'TCP', 'UDP' - TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` - // FrontendPort - The external endpoint port of the inbound connection. Possible values range between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically. - FrontendPort *int32 `json:"frontendPort,omitempty"` - // BackendPort - The port to which the external traffic will be redirected. - BackendPort *int32 `json:"backendPort,omitempty"` -} - -// Lab a lab. -type Lab struct { - autorest.Response `json:"-"` - // LabProperties - The properties of the resource. - *LabProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Lab. -func (l Lab) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if l.LabProperties != nil { - objectMap["properties"] = l.LabProperties - } - if l.Location != nil { - objectMap["location"] = l.Location - } - if l.Tags != nil { - objectMap["tags"] = l.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Lab struct. -func (l *Lab) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var labProperties LabProperties - err = json.Unmarshal(*v, &labProperties) - if err != nil { - return err - } - l.LabProperties = &labProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - l.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - l.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - l.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - l.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - l.Tags = tags - } - } - } - - return nil -} - -// LabAnnouncementProperties properties of a lab's announcement banner -type LabAnnouncementProperties struct { - // Title - The plain text title for the lab announcement - Title *string `json:"title,omitempty"` - // Markdown - The markdown text (if any) that this lab displays in the UI. If left empty/null, nothing will be shown. - Markdown *string `json:"markdown,omitempty"` - // Enabled - Is the lab announcement active/enabled at this time?. Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' - Enabled EnableStatus `json:"enabled,omitempty"` - // ExpirationDate - The time at which the announcement expires (null for never) - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - // Expired - Has this announcement expired? - Expired *bool `json:"expired,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for LabAnnouncementProperties. -func (lap LabAnnouncementProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lap.Title != nil { - objectMap["title"] = lap.Title - } - if lap.Markdown != nil { - objectMap["markdown"] = lap.Markdown - } - if lap.Enabled != "" { - objectMap["enabled"] = lap.Enabled - } - if lap.ExpirationDate != nil { - objectMap["expirationDate"] = lap.ExpirationDate - } - if lap.Expired != nil { - objectMap["expired"] = lap.Expired - } - return json.Marshal(objectMap) -} - -// LabAnnouncementPropertiesFragment properties of a lab's announcement banner -type LabAnnouncementPropertiesFragment struct { - // Title - The plain text title for the lab announcement - Title *string `json:"title,omitempty"` - // Markdown - The markdown text (if any) that this lab displays in the UI. If left empty/null, nothing will be shown. - Markdown *string `json:"markdown,omitempty"` - // Enabled - Is the lab announcement active/enabled at this time?. Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' - Enabled EnableStatus `json:"enabled,omitempty"` - // ExpirationDate - The time at which the announcement expires (null for never) - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - // Expired - Has this announcement expired? - Expired *bool `json:"expired,omitempty"` -} - -// LabCost a cost item. -type LabCost struct { - autorest.Response `json:"-"` - // LabCostProperties - The properties of the resource. - *LabCostProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for LabCost. -func (lc LabCost) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lc.LabCostProperties != nil { - objectMap["properties"] = lc.LabCostProperties - } - if lc.Location != nil { - objectMap["location"] = lc.Location - } - if lc.Tags != nil { - objectMap["tags"] = lc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LabCost struct. -func (lc *LabCost) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var labCostProperties LabCostProperties - err = json.Unmarshal(*v, &labCostProperties) - if err != nil { - return err - } - lc.LabCostProperties = &labCostProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lc.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lc.Tags = tags - } - } - } - - return nil -} - -// LabCostDetailsProperties the properties of a lab cost item. -type LabCostDetailsProperties struct { - // Date - The date of the cost item. - Date *date.Time `json:"date,omitempty"` - // Cost - The cost component of the cost item. - Cost *float64 `json:"cost,omitempty"` - // CostType - The type of the cost. Possible values include: 'Unavailable', 'Reported', 'Projected' - CostType CostType `json:"costType,omitempty"` -} - -// LabCostProperties properties of a cost item. -type LabCostProperties struct { - // TargetCost - The target cost properties - TargetCost *TargetCostProperties `json:"targetCost,omitempty"` - // LabCostSummary - READ-ONLY; The lab cost summary component of the cost data. - LabCostSummary *LabCostSummaryProperties `json:"labCostSummary,omitempty"` - // LabCostDetails - READ-ONLY; The lab cost details component of the cost data. - LabCostDetails *[]LabCostDetailsProperties `json:"labCostDetails,omitempty"` - // ResourceCosts - READ-ONLY; The resource cost component of the cost data. - ResourceCosts *[]LabResourceCostProperties `json:"resourceCosts,omitempty"` - // CurrencyCode - The currency code of the cost. - CurrencyCode *string `json:"currencyCode,omitempty"` - // StartDateTime - The start time of the cost data. - StartDateTime *date.Time `json:"startDateTime,omitempty"` - // EndDateTime - The end time of the cost data. - EndDateTime *date.Time `json:"endDateTime,omitempty"` - // CreatedDate - The creation date of the cost. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for LabCostProperties. -func (lcp LabCostProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lcp.TargetCost != nil { - objectMap["targetCost"] = lcp.TargetCost - } - if lcp.CurrencyCode != nil { - objectMap["currencyCode"] = lcp.CurrencyCode - } - if lcp.StartDateTime != nil { - objectMap["startDateTime"] = lcp.StartDateTime - } - if lcp.EndDateTime != nil { - objectMap["endDateTime"] = lcp.EndDateTime - } - if lcp.CreatedDate != nil { - objectMap["createdDate"] = lcp.CreatedDate - } - return json.Marshal(objectMap) -} - -// LabCostSummaryProperties the properties of the cost summary. -type LabCostSummaryProperties struct { - // EstimatedLabCost - The cost component of the cost item. - EstimatedLabCost *float64 `json:"estimatedLabCost,omitempty"` -} - -// LabFragment a lab. -type LabFragment struct { - // LabPropertiesFragment - The properties of the resource. - *LabPropertiesFragment `json:"properties,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for LabFragment. -func (lf LabFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lf.LabPropertiesFragment != nil { - objectMap["properties"] = lf.LabPropertiesFragment - } - if lf.Tags != nil { - objectMap["tags"] = lf.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LabFragment struct. -func (lf *LabFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var labPropertiesFragment LabPropertiesFragment - err = json.Unmarshal(*v, &labPropertiesFragment) - if err != nil { - return err - } - lf.LabPropertiesFragment = &labPropertiesFragment - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lf.Tags = tags - } - } - } - - return nil -} - -// LabList the response of a list operation. -type LabList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]Lab `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// LabListIterator provides access to a complete listing of Lab values. -type LabListIterator struct { - i int - page LabListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *LabListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *LabListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LabListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter LabListIterator) Response() LabList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter LabListIterator) Value() Lab { - if !iter.page.NotDone() { - return Lab{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LabListIterator type. -func NewLabListIterator(page LabListPage) LabListIterator { - return LabListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ll LabList) IsEmpty() bool { - return ll.Value == nil || len(*ll.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ll LabList) hasNextLink() bool { - return ll.NextLink != nil && len(*ll.NextLink) != 0 -} - -// labListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ll LabList) labListPreparer(ctx context.Context) (*http.Request, error) { - if !ll.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ll.NextLink))) -} - -// LabListPage contains a page of Lab values. -type LabListPage struct { - fn func(context.Context, LabList) (LabList, error) - ll LabList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *LabListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ll) - if err != nil { - return err - } - page.ll = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *LabListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LabListPage) NotDone() bool { - return !page.ll.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LabListPage) Response() LabList { - return page.ll -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LabListPage) Values() []Lab { - if page.ll.IsEmpty() { - return nil - } - return *page.ll.Value -} - -// Creates a new instance of the LabListPage type. -func NewLabListPage(cur LabList, getNextPage func(context.Context, LabList) (LabList, error)) LabListPage { - return LabListPage{ - fn: getNextPage, - ll: cur, - } -} - -// LabProperties properties of a lab. -type LabProperties struct { - // DefaultStorageAccount - READ-ONLY; The lab's default storage account. - DefaultStorageAccount *string `json:"defaultStorageAccount,omitempty"` - // DefaultPremiumStorageAccount - READ-ONLY; The lab's default premium storage account. - DefaultPremiumStorageAccount *string `json:"defaultPremiumStorageAccount,omitempty"` - // ArtifactsStorageAccount - READ-ONLY; The lab's artifact storage account. - ArtifactsStorageAccount *string `json:"artifactsStorageAccount,omitempty"` - // PremiumDataDiskStorageAccount - READ-ONLY; The lab's premium data disk storage account. - PremiumDataDiskStorageAccount *string `json:"premiumDataDiskStorageAccount,omitempty"` - // VaultName - READ-ONLY; The lab's Key vault. - VaultName *string `json:"vaultName,omitempty"` - // LabStorageType - Type of storage used by the lab. It can be either Premium or Standard. Default is Premium. Possible values include: 'Standard', 'Premium', 'StandardSSD' - LabStorageType StorageType `json:"labStorageType,omitempty"` - // MandatoryArtifactsResourceIdsLinux - The ordered list of artifact resource IDs that should be applied on all Linux VM creations by default, prior to the artifacts specified by the user. - MandatoryArtifactsResourceIdsLinux *[]string `json:"mandatoryArtifactsResourceIdsLinux,omitempty"` - // MandatoryArtifactsResourceIdsWindows - The ordered list of artifact resource IDs that should be applied on all Windows VM creations by default, prior to the artifacts specified by the user. - MandatoryArtifactsResourceIdsWindows *[]string `json:"mandatoryArtifactsResourceIdsWindows,omitempty"` - // CreatedDate - READ-ONLY; The creation date of the lab. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // PremiumDataDisks - The setting to enable usage of premium data disks. - // When its value is 'Enabled', creation of standard or premium data disks is allowed. - // When its value is 'Disabled', only creation of standard data disks is allowed. Possible values include: 'PremiumDataDiskDisabled', 'PremiumDataDiskEnabled' - PremiumDataDisks PremiumDataDisk `json:"premiumDataDisks,omitempty"` - // EnvironmentPermission - The access rights to be granted to the user when provisioning an environment. Possible values include: 'Reader', 'Contributor' - EnvironmentPermission EnvironmentPermission `json:"environmentPermission,omitempty"` - // Announcement - The properties of any lab announcement associated with this lab - Announcement *LabAnnouncementProperties `json:"announcement,omitempty"` - // Support - The properties of any lab support message associated with this lab - Support *LabSupportProperties `json:"support,omitempty"` - // VMCreationResourceGroup - READ-ONLY; The resource group in which all new lab virtual machines will be created. To let DevTest Labs manage resource group creation, set this value to null. - VMCreationResourceGroup *string `json:"vmCreationResourceGroup,omitempty"` - // PublicIPID - READ-ONLY; The public IP address for the lab's load balancer. - PublicIPID *string `json:"publicIpId,omitempty"` - // LoadBalancerID - READ-ONLY; The load balancer used to for lab VMs that use shared IP address. - LoadBalancerID *string `json:"loadBalancerId,omitempty"` - // NetworkSecurityGroupID - READ-ONLY; The Network Security Group attached to the lab VMs Network interfaces to restrict open ports. - NetworkSecurityGroupID *string `json:"networkSecurityGroupId,omitempty"` - // ExtendedProperties - Extended properties of the lab used for experimental features - ExtendedProperties map[string]*string `json:"extendedProperties"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for LabProperties. -func (lp LabProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lp.LabStorageType != "" { - objectMap["labStorageType"] = lp.LabStorageType - } - if lp.MandatoryArtifactsResourceIdsLinux != nil { - objectMap["mandatoryArtifactsResourceIdsLinux"] = lp.MandatoryArtifactsResourceIdsLinux - } - if lp.MandatoryArtifactsResourceIdsWindows != nil { - objectMap["mandatoryArtifactsResourceIdsWindows"] = lp.MandatoryArtifactsResourceIdsWindows - } - if lp.PremiumDataDisks != "" { - objectMap["premiumDataDisks"] = lp.PremiumDataDisks - } - if lp.EnvironmentPermission != "" { - objectMap["environmentPermission"] = lp.EnvironmentPermission - } - if lp.Announcement != nil { - objectMap["announcement"] = lp.Announcement - } - if lp.Support != nil { - objectMap["support"] = lp.Support - } - if lp.ExtendedProperties != nil { - objectMap["extendedProperties"] = lp.ExtendedProperties - } - return json.Marshal(objectMap) -} - -// LabPropertiesFragment properties of a lab. -type LabPropertiesFragment struct { - // LabStorageType - Type of storage used by the lab. It can be either Premium or Standard. Default is Premium. Possible values include: 'Standard', 'Premium', 'StandardSSD' - LabStorageType StorageType `json:"labStorageType,omitempty"` - // MandatoryArtifactsResourceIdsLinux - The ordered list of artifact resource IDs that should be applied on all Linux VM creations by default, prior to the artifacts specified by the user. - MandatoryArtifactsResourceIdsLinux *[]string `json:"mandatoryArtifactsResourceIdsLinux,omitempty"` - // MandatoryArtifactsResourceIdsWindows - The ordered list of artifact resource IDs that should be applied on all Windows VM creations by default, prior to the artifacts specified by the user. - MandatoryArtifactsResourceIdsWindows *[]string `json:"mandatoryArtifactsResourceIdsWindows,omitempty"` - // PremiumDataDisks - The setting to enable usage of premium data disks. - // When its value is 'Enabled', creation of standard or premium data disks is allowed. - // When its value is 'Disabled', only creation of standard data disks is allowed. Possible values include: 'PremiumDataDiskDisabled', 'PremiumDataDiskEnabled' - PremiumDataDisks PremiumDataDisk `json:"premiumDataDisks,omitempty"` - // EnvironmentPermission - The access rights to be granted to the user when provisioning an environment. Possible values include: 'Reader', 'Contributor' - EnvironmentPermission EnvironmentPermission `json:"environmentPermission,omitempty"` - // Announcement - The properties of any lab announcement associated with this lab - Announcement *LabAnnouncementPropertiesFragment `json:"announcement,omitempty"` - // Support - The properties of any lab support message associated with this lab - Support *LabSupportPropertiesFragment `json:"support,omitempty"` - // ExtendedProperties - Extended properties of the lab used for experimental features - ExtendedProperties map[string]*string `json:"extendedProperties"` -} - -// MarshalJSON is the custom marshaler for LabPropertiesFragment. -func (lpf LabPropertiesFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lpf.LabStorageType != "" { - objectMap["labStorageType"] = lpf.LabStorageType - } - if lpf.MandatoryArtifactsResourceIdsLinux != nil { - objectMap["mandatoryArtifactsResourceIdsLinux"] = lpf.MandatoryArtifactsResourceIdsLinux - } - if lpf.MandatoryArtifactsResourceIdsWindows != nil { - objectMap["mandatoryArtifactsResourceIdsWindows"] = lpf.MandatoryArtifactsResourceIdsWindows - } - if lpf.PremiumDataDisks != "" { - objectMap["premiumDataDisks"] = lpf.PremiumDataDisks - } - if lpf.EnvironmentPermission != "" { - objectMap["environmentPermission"] = lpf.EnvironmentPermission - } - if lpf.Announcement != nil { - objectMap["announcement"] = lpf.Announcement - } - if lpf.Support != nil { - objectMap["support"] = lpf.Support - } - if lpf.ExtendedProperties != nil { - objectMap["extendedProperties"] = lpf.ExtendedProperties - } - return json.Marshal(objectMap) -} - -// LabResourceCostProperties the properties of a resource cost item. -type LabResourceCostProperties struct { - // Resourcename - The name of the resource. - Resourcename *string `json:"resourcename,omitempty"` - // ResourceUID - The unique identifier of the resource. - ResourceUID *string `json:"resourceUId,omitempty"` - // ResourceCost - The cost component of the resource cost item. - ResourceCost *float64 `json:"resourceCost,omitempty"` - // ResourceType - The logical resource type (ex. virtualmachine, storageaccount) - ResourceType *string `json:"resourceType,omitempty"` - // ResourceOwner - The owner of the resource (ex. janedoe@microsoft.com) - ResourceOwner *string `json:"resourceOwner,omitempty"` - // ResourcePricingTier - The category of the resource (ex. Premium_LRS, Standard_DS1) - ResourcePricingTier *string `json:"resourcePricingTier,omitempty"` - // ResourceStatus - The status of the resource (ex. Active) - ResourceStatus *string `json:"resourceStatus,omitempty"` - // ResourceID - The ID of the resource - ResourceID *string `json:"resourceId,omitempty"` - // ExternalResourceID - The ID of the external resource - ExternalResourceID *string `json:"externalResourceId,omitempty"` -} - -// LabsClaimAnyVMFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type LabsClaimAnyVMFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LabsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LabsClaimAnyVMFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LabsClaimAnyVMFuture.Result. -func (future *LabsClaimAnyVMFuture) result(client LabsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsClaimAnyVMFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.LabsClaimAnyVMFuture") - return - } - ar.Response = future.Response() - return -} - -// LabsCreateEnvironmentFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type LabsCreateEnvironmentFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LabsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LabsCreateEnvironmentFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LabsCreateEnvironmentFuture.Result. -func (future *LabsCreateEnvironmentFuture) result(client LabsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsCreateEnvironmentFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.LabsCreateEnvironmentFuture") - return - } - ar.Response = future.Response() - return -} - -// LabsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type LabsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LabsClient) (Lab, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LabsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LabsCreateOrUpdateFuture.Result. -func (future *LabsCreateOrUpdateFuture) result(client LabsClient) (l Lab, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - l.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.LabsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if l.Response.Response, err = future.GetResult(sender); err == nil && l.Response.Response.StatusCode != http.StatusNoContent { - l, err = client.CreateOrUpdateResponder(l.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsCreateOrUpdateFuture", "Result", l.Response.Response, "Failure responding to request") - } - } - return -} - -// LabsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type LabsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LabsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LabsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LabsDeleteFuture.Result. -func (future *LabsDeleteFuture) result(client LabsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.LabsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// LabsExportResourceUsageFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type LabsExportResourceUsageFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LabsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LabsExportResourceUsageFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LabsExportResourceUsageFuture.Result. -func (future *LabsExportResourceUsageFuture) result(client LabsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsExportResourceUsageFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.LabsExportResourceUsageFuture") - return - } - ar.Response = future.Response() - return -} - -// LabsImportVirtualMachineFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type LabsImportVirtualMachineFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LabsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LabsImportVirtualMachineFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LabsImportVirtualMachineFuture.Result. -func (future *LabsImportVirtualMachineFuture) result(client LabsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.LabsImportVirtualMachineFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.LabsImportVirtualMachineFuture") - return - } - ar.Response = future.Response() - return -} - -// LabSupportProperties properties of a lab's support banner -type LabSupportProperties struct { - // Enabled - Is the lab support banner active/enabled at this time?. Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' - Enabled EnableStatus `json:"enabled,omitempty"` - // Markdown - The markdown text (if any) that this lab displays in the UI. If left empty/null, nothing will be shown. - Markdown *string `json:"markdown,omitempty"` -} - -// LabSupportPropertiesFragment properties of a lab's support banner -type LabSupportPropertiesFragment struct { - // Enabled - Is the lab support banner active/enabled at this time?. Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' - Enabled EnableStatus `json:"enabled,omitempty"` - // Markdown - The markdown text (if any) that this lab displays in the UI. If left empty/null, nothing will be shown. - Markdown *string `json:"markdown,omitempty"` -} - -// LabVhd properties of a VHD in the lab. -type LabVhd struct { - // ID - The URI to the VHD. - ID *string `json:"id,omitempty"` -} - -// LabVhdList the response of a list operation. -type LabVhdList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]LabVhd `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// LabVhdListIterator provides access to a complete listing of LabVhd values. -type LabVhdListIterator struct { - i int - page LabVhdListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *LabVhdListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabVhdListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *LabVhdListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LabVhdListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter LabVhdListIterator) Response() LabVhdList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter LabVhdListIterator) Value() LabVhd { - if !iter.page.NotDone() { - return LabVhd{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LabVhdListIterator type. -func NewLabVhdListIterator(page LabVhdListPage) LabVhdListIterator { - return LabVhdListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvl LabVhdList) IsEmpty() bool { - return lvl.Value == nil || len(*lvl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvl LabVhdList) hasNextLink() bool { - return lvl.NextLink != nil && len(*lvl.NextLink) != 0 -} - -// labVhdListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvl LabVhdList) labVhdListPreparer(ctx context.Context) (*http.Request, error) { - if !lvl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvl.NextLink))) -} - -// LabVhdListPage contains a page of LabVhd values. -type LabVhdListPage struct { - fn func(context.Context, LabVhdList) (LabVhdList, error) - lvl LabVhdList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *LabVhdListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabVhdListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvl) - if err != nil { - return err - } - page.lvl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *LabVhdListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LabVhdListPage) NotDone() bool { - return !page.lvl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LabVhdListPage) Response() LabVhdList { - return page.lvl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LabVhdListPage) Values() []LabVhd { - if page.lvl.IsEmpty() { - return nil - } - return *page.lvl.Value -} - -// Creates a new instance of the LabVhdListPage type. -func NewLabVhdListPage(cur LabVhdList, getNextPage func(context.Context, LabVhdList) (LabVhdList, error)) LabVhdListPage { - return LabVhdListPage{ - fn: getNextPage, - lvl: cur, - } -} - -// LabVirtualMachine a virtual machine. -type LabVirtualMachine struct { - autorest.Response `json:"-"` - // LabVirtualMachineProperties - The properties of the resource. - *LabVirtualMachineProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for LabVirtualMachine. -func (lvm LabVirtualMachine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lvm.LabVirtualMachineProperties != nil { - objectMap["properties"] = lvm.LabVirtualMachineProperties - } - if lvm.Location != nil { - objectMap["location"] = lvm.Location - } - if lvm.Tags != nil { - objectMap["tags"] = lvm.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LabVirtualMachine struct. -func (lvm *LabVirtualMachine) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var labVirtualMachineProperties LabVirtualMachineProperties - err = json.Unmarshal(*v, &labVirtualMachineProperties) - if err != nil { - return err - } - lvm.LabVirtualMachineProperties = &labVirtualMachineProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lvm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lvm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lvm.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lvm.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lvm.Tags = tags - } - } - } - - return nil -} - -// LabVirtualMachineCreationParameter properties for creating a virtual machine. -type LabVirtualMachineCreationParameter struct { - // LabVirtualMachineCreationParameterProperties - The properties of the resource. - *LabVirtualMachineCreationParameterProperties `json:"properties,omitempty"` - // Name - The name of the virtual machine or environment - Name *string `json:"name,omitempty"` - // Location - The location of the new virtual machine or environment - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for LabVirtualMachineCreationParameter. -func (lvmcp LabVirtualMachineCreationParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lvmcp.LabVirtualMachineCreationParameterProperties != nil { - objectMap["properties"] = lvmcp.LabVirtualMachineCreationParameterProperties - } - if lvmcp.Name != nil { - objectMap["name"] = lvmcp.Name - } - if lvmcp.Location != nil { - objectMap["location"] = lvmcp.Location - } - if lvmcp.Tags != nil { - objectMap["tags"] = lvmcp.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LabVirtualMachineCreationParameter struct. -func (lvmcp *LabVirtualMachineCreationParameter) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var labVirtualMachineCreationParameterProperties LabVirtualMachineCreationParameterProperties - err = json.Unmarshal(*v, &labVirtualMachineCreationParameterProperties) - if err != nil { - return err - } - lvmcp.LabVirtualMachineCreationParameterProperties = &labVirtualMachineCreationParameterProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lvmcp.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lvmcp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lvmcp.Tags = tags - } - } - } - - return nil -} - -// LabVirtualMachineCreationParameterFragment properties for creating a virtual machine. -type LabVirtualMachineCreationParameterFragment struct { - // LabVirtualMachineCreationParameterPropertiesFragment - The properties of the resource. - *LabVirtualMachineCreationParameterPropertiesFragment `json:"properties,omitempty"` - // Name - The name of the virtual machine or environment - Name *string `json:"name,omitempty"` - // Location - The location of the new virtual machine or environment - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for LabVirtualMachineCreationParameterFragment. -func (lvmcpf LabVirtualMachineCreationParameterFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lvmcpf.LabVirtualMachineCreationParameterPropertiesFragment != nil { - objectMap["properties"] = lvmcpf.LabVirtualMachineCreationParameterPropertiesFragment - } - if lvmcpf.Name != nil { - objectMap["name"] = lvmcpf.Name - } - if lvmcpf.Location != nil { - objectMap["location"] = lvmcpf.Location - } - if lvmcpf.Tags != nil { - objectMap["tags"] = lvmcpf.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LabVirtualMachineCreationParameterFragment struct. -func (lvmcpf *LabVirtualMachineCreationParameterFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var labVirtualMachineCreationParameterPropertiesFragment LabVirtualMachineCreationParameterPropertiesFragment - err = json.Unmarshal(*v, &labVirtualMachineCreationParameterPropertiesFragment) - if err != nil { - return err - } - lvmcpf.LabVirtualMachineCreationParameterPropertiesFragment = &labVirtualMachineCreationParameterPropertiesFragment - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lvmcpf.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lvmcpf.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lvmcpf.Tags = tags - } - } - } - - return nil -} - -// LabVirtualMachineCreationParameterProperties properties for virtual machine creation. -type LabVirtualMachineCreationParameterProperties struct { - // BulkCreationParameters - The number of virtual machine instances to create. - BulkCreationParameters *BulkCreationParameters `json:"bulkCreationParameters,omitempty"` - // Notes - The notes of the virtual machine. - Notes *string `json:"notes,omitempty"` - // OwnerObjectID - The object identifier of the owner of the virtual machine. - OwnerObjectID *string `json:"ownerObjectId,omitempty"` - // OwnerUserPrincipalName - The user principal name of the virtual machine owner. - OwnerUserPrincipalName *string `json:"ownerUserPrincipalName,omitempty"` - // CreatedByUserID - The object identifier of the creator of the virtual machine. - CreatedByUserID *string `json:"createdByUserId,omitempty"` - // CreatedByUser - The email address of creator of the virtual machine. - CreatedByUser *string `json:"createdByUser,omitempty"` - // CreatedDate - The creation date of the virtual machine. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // ComputeID - The resource identifier (Microsoft.Compute) of the virtual machine. - ComputeID *string `json:"computeId,omitempty"` - // CustomImageID - The custom image identifier of the virtual machine. - CustomImageID *string `json:"customImageId,omitempty"` - // OsType - The OS type of the virtual machine. - OsType *string `json:"osType,omitempty"` - // Size - The size of the virtual machine. - Size *string `json:"size,omitempty"` - // UserName - The user name of the virtual machine. - UserName *string `json:"userName,omitempty"` - // Password - The password of the virtual machine administrator. - Password *string `json:"password,omitempty"` - // SSHKey - The SSH key of the virtual machine administrator. - SSHKey *string `json:"sshKey,omitempty"` - // IsAuthenticationWithSSHKey - Indicates whether this virtual machine uses an SSH key for authentication. - IsAuthenticationWithSSHKey *bool `json:"isAuthenticationWithSshKey,omitempty"` - // Fqdn - The fully-qualified domain name of the virtual machine. - Fqdn *string `json:"fqdn,omitempty"` - // LabSubnetName - The lab subnet name of the virtual machine. - LabSubnetName *string `json:"labSubnetName,omitempty"` - // LabVirtualNetworkID - The lab virtual network identifier of the virtual machine. - LabVirtualNetworkID *string `json:"labVirtualNetworkId,omitempty"` - // DisallowPublicIPAddress - Indicates whether the virtual machine is to be created without a public IP address. - DisallowPublicIPAddress *bool `json:"disallowPublicIpAddress,omitempty"` - // Artifacts - The artifacts to be installed on the virtual machine. - Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"` - // ArtifactDeploymentStatus - The artifact deployment status for the virtual machine. - ArtifactDeploymentStatus *ArtifactDeploymentStatusProperties `json:"artifactDeploymentStatus,omitempty"` - // GalleryImageReference - The Microsoft Azure Marketplace image reference of the virtual machine. - GalleryImageReference *GalleryImageReference `json:"galleryImageReference,omitempty"` - // PlanID - The id of the plan associated with the virtual machine image - PlanID *string `json:"planId,omitempty"` - // NetworkInterface - The network interface properties. - NetworkInterface *NetworkInterfaceProperties `json:"networkInterface,omitempty"` - // ExpirationDate - The expiration date for VM. - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - // AllowClaim - Indicates whether another user can take ownership of the virtual machine - AllowClaim *bool `json:"allowClaim,omitempty"` - // StorageType - Storage type to use for virtual machine (i.e. Standard, Premium). - StorageType *string `json:"storageType,omitempty"` - // VirtualMachineCreationSource - Tells source of creation of lab virtual machine. Output property only. Possible values include: 'FromCustomImage', 'FromGalleryImage', 'FromSharedGalleryImage' - VirtualMachineCreationSource VirtualMachineCreationSource `json:"virtualMachineCreationSource,omitempty"` - // EnvironmentID - The resource ID of the environment that contains this virtual machine, if any. - EnvironmentID *string `json:"environmentId,omitempty"` - // DataDiskParameters - New or existing data disks to attach to the virtual machine after creation - DataDiskParameters *[]DataDiskProperties `json:"dataDiskParameters,omitempty"` - // ScheduleParameters - Virtual Machine schedules to be created - ScheduleParameters *[]ScheduleCreationParameter `json:"scheduleParameters,omitempty"` - // LastKnownPowerState - Last known compute power state captured in DTL - LastKnownPowerState *string `json:"lastKnownPowerState,omitempty"` -} - -// LabVirtualMachineCreationParameterPropertiesFragment properties for virtual machine creation. -type LabVirtualMachineCreationParameterPropertiesFragment struct { - // BulkCreationParameters - The number of virtual machine instances to create. - BulkCreationParameters *BulkCreationParametersFragment `json:"bulkCreationParameters,omitempty"` - // Notes - The notes of the virtual machine. - Notes *string `json:"notes,omitempty"` - // OwnerObjectID - The object identifier of the owner of the virtual machine. - OwnerObjectID *string `json:"ownerObjectId,omitempty"` - // OwnerUserPrincipalName - The user principal name of the virtual machine owner. - OwnerUserPrincipalName *string `json:"ownerUserPrincipalName,omitempty"` - // CreatedByUserID - The object identifier of the creator of the virtual machine. - CreatedByUserID *string `json:"createdByUserId,omitempty"` - // CreatedByUser - The email address of creator of the virtual machine. - CreatedByUser *string `json:"createdByUser,omitempty"` - // CreatedDate - The creation date of the virtual machine. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // ComputeID - The resource identifier (Microsoft.Compute) of the virtual machine. - ComputeID *string `json:"computeId,omitempty"` - // CustomImageID - The custom image identifier of the virtual machine. - CustomImageID *string `json:"customImageId,omitempty"` - // OsType - The OS type of the virtual machine. - OsType *string `json:"osType,omitempty"` - // Size - The size of the virtual machine. - Size *string `json:"size,omitempty"` - // UserName - The user name of the virtual machine. - UserName *string `json:"userName,omitempty"` - // Password - The password of the virtual machine administrator. - Password *string `json:"password,omitempty"` - // SSHKey - The SSH key of the virtual machine administrator. - SSHKey *string `json:"sshKey,omitempty"` - // IsAuthenticationWithSSHKey - Indicates whether this virtual machine uses an SSH key for authentication. - IsAuthenticationWithSSHKey *bool `json:"isAuthenticationWithSshKey,omitempty"` - // Fqdn - The fully-qualified domain name of the virtual machine. - Fqdn *string `json:"fqdn,omitempty"` - // LabSubnetName - The lab subnet name of the virtual machine. - LabSubnetName *string `json:"labSubnetName,omitempty"` - // LabVirtualNetworkID - The lab virtual network identifier of the virtual machine. - LabVirtualNetworkID *string `json:"labVirtualNetworkId,omitempty"` - // DisallowPublicIPAddress - Indicates whether the virtual machine is to be created without a public IP address. - DisallowPublicIPAddress *bool `json:"disallowPublicIpAddress,omitempty"` - // Artifacts - The artifacts to be installed on the virtual machine. - Artifacts *[]ArtifactInstallPropertiesFragment `json:"artifacts,omitempty"` - // ArtifactDeploymentStatus - The artifact deployment status for the virtual machine. - ArtifactDeploymentStatus *ArtifactDeploymentStatusPropertiesFragment `json:"artifactDeploymentStatus,omitempty"` - // GalleryImageReference - The Microsoft Azure Marketplace image reference of the virtual machine. - GalleryImageReference *GalleryImageReferenceFragment `json:"galleryImageReference,omitempty"` - // PlanID - The id of the plan associated with the virtual machine image - PlanID *string `json:"planId,omitempty"` - // NetworkInterface - The network interface properties. - NetworkInterface *NetworkInterfacePropertiesFragment `json:"networkInterface,omitempty"` - // ExpirationDate - The expiration date for VM. - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - // AllowClaim - Indicates whether another user can take ownership of the virtual machine - AllowClaim *bool `json:"allowClaim,omitempty"` - // StorageType - Storage type to use for virtual machine (i.e. Standard, Premium). - StorageType *string `json:"storageType,omitempty"` - // VirtualMachineCreationSource - Tells source of creation of lab virtual machine. Output property only. Possible values include: 'FromCustomImage', 'FromGalleryImage', 'FromSharedGalleryImage' - VirtualMachineCreationSource VirtualMachineCreationSource `json:"virtualMachineCreationSource,omitempty"` - // EnvironmentID - The resource ID of the environment that contains this virtual machine, if any. - EnvironmentID *string `json:"environmentId,omitempty"` - // DataDiskParameters - New or existing data disks to attach to the virtual machine after creation - DataDiskParameters *[]DataDiskPropertiesFragment `json:"dataDiskParameters,omitempty"` - // ScheduleParameters - Virtual Machine schedules to be created - ScheduleParameters *[]ScheduleCreationParameterFragment `json:"scheduleParameters,omitempty"` - // LastKnownPowerState - Last known compute power state captured in DTL - LastKnownPowerState *string `json:"lastKnownPowerState,omitempty"` -} - -// LabVirtualMachineFragment a virtual machine. -type LabVirtualMachineFragment struct { - // LabVirtualMachinePropertiesFragment - The properties of the resource. - *LabVirtualMachinePropertiesFragment `json:"properties,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for LabVirtualMachineFragment. -func (lvmf LabVirtualMachineFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lvmf.LabVirtualMachinePropertiesFragment != nil { - objectMap["properties"] = lvmf.LabVirtualMachinePropertiesFragment - } - if lvmf.Tags != nil { - objectMap["tags"] = lvmf.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LabVirtualMachineFragment struct. -func (lvmf *LabVirtualMachineFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var labVirtualMachinePropertiesFragment LabVirtualMachinePropertiesFragment - err = json.Unmarshal(*v, &labVirtualMachinePropertiesFragment) - if err != nil { - return err - } - lvmf.LabVirtualMachinePropertiesFragment = &labVirtualMachinePropertiesFragment - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lvmf.Tags = tags - } - } - } - - return nil -} - -// LabVirtualMachineList the response of a list operation. -type LabVirtualMachineList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]LabVirtualMachine `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// LabVirtualMachineListIterator provides access to a complete listing of LabVirtualMachine values. -type LabVirtualMachineListIterator struct { - i int - page LabVirtualMachineListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *LabVirtualMachineListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabVirtualMachineListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *LabVirtualMachineListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LabVirtualMachineListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter LabVirtualMachineListIterator) Response() LabVirtualMachineList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter LabVirtualMachineListIterator) Value() LabVirtualMachine { - if !iter.page.NotDone() { - return LabVirtualMachine{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LabVirtualMachineListIterator type. -func NewLabVirtualMachineListIterator(page LabVirtualMachineListPage) LabVirtualMachineListIterator { - return LabVirtualMachineListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvml LabVirtualMachineList) IsEmpty() bool { - return lvml.Value == nil || len(*lvml.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvml LabVirtualMachineList) hasNextLink() bool { - return lvml.NextLink != nil && len(*lvml.NextLink) != 0 -} - -// labVirtualMachineListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvml LabVirtualMachineList) labVirtualMachineListPreparer(ctx context.Context) (*http.Request, error) { - if !lvml.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvml.NextLink))) -} - -// LabVirtualMachineListPage contains a page of LabVirtualMachine values. -type LabVirtualMachineListPage struct { - fn func(context.Context, LabVirtualMachineList) (LabVirtualMachineList, error) - lvml LabVirtualMachineList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *LabVirtualMachineListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LabVirtualMachineListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvml) - if err != nil { - return err - } - page.lvml = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *LabVirtualMachineListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LabVirtualMachineListPage) NotDone() bool { - return !page.lvml.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LabVirtualMachineListPage) Response() LabVirtualMachineList { - return page.lvml -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LabVirtualMachineListPage) Values() []LabVirtualMachine { - if page.lvml.IsEmpty() { - return nil - } - return *page.lvml.Value -} - -// Creates a new instance of the LabVirtualMachineListPage type. -func NewLabVirtualMachineListPage(cur LabVirtualMachineList, getNextPage func(context.Context, LabVirtualMachineList) (LabVirtualMachineList, error)) LabVirtualMachineListPage { - return LabVirtualMachineListPage{ - fn: getNextPage, - lvml: cur, - } -} - -// LabVirtualMachineProperties properties of a virtual machine. -type LabVirtualMachineProperties struct { - // Notes - The notes of the virtual machine. - Notes *string `json:"notes,omitempty"` - // OwnerObjectID - The object identifier of the owner of the virtual machine. - OwnerObjectID *string `json:"ownerObjectId,omitempty"` - // OwnerUserPrincipalName - The user principal name of the virtual machine owner. - OwnerUserPrincipalName *string `json:"ownerUserPrincipalName,omitempty"` - // CreatedByUserID - The object identifier of the creator of the virtual machine. - CreatedByUserID *string `json:"createdByUserId,omitempty"` - // CreatedByUser - The email address of creator of the virtual machine. - CreatedByUser *string `json:"createdByUser,omitempty"` - // CreatedDate - The creation date of the virtual machine. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // ComputeID - The resource identifier (Microsoft.Compute) of the virtual machine. - ComputeID *string `json:"computeId,omitempty"` - // CustomImageID - The custom image identifier of the virtual machine. - CustomImageID *string `json:"customImageId,omitempty"` - // OsType - The OS type of the virtual machine. - OsType *string `json:"osType,omitempty"` - // Size - The size of the virtual machine. - Size *string `json:"size,omitempty"` - // UserName - The user name of the virtual machine. - UserName *string `json:"userName,omitempty"` - // Password - The password of the virtual machine administrator. - Password *string `json:"password,omitempty"` - // SSHKey - The SSH key of the virtual machine administrator. - SSHKey *string `json:"sshKey,omitempty"` - // IsAuthenticationWithSSHKey - Indicates whether this virtual machine uses an SSH key for authentication. - IsAuthenticationWithSSHKey *bool `json:"isAuthenticationWithSshKey,omitempty"` - // Fqdn - The fully-qualified domain name of the virtual machine. - Fqdn *string `json:"fqdn,omitempty"` - // LabSubnetName - The lab subnet name of the virtual machine. - LabSubnetName *string `json:"labSubnetName,omitempty"` - // LabVirtualNetworkID - The lab virtual network identifier of the virtual machine. - LabVirtualNetworkID *string `json:"labVirtualNetworkId,omitempty"` - // DisallowPublicIPAddress - Indicates whether the virtual machine is to be created without a public IP address. - DisallowPublicIPAddress *bool `json:"disallowPublicIpAddress,omitempty"` - // Artifacts - The artifacts to be installed on the virtual machine. - Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"` - // ArtifactDeploymentStatus - The artifact deployment status for the virtual machine. - ArtifactDeploymentStatus *ArtifactDeploymentStatusProperties `json:"artifactDeploymentStatus,omitempty"` - // GalleryImageReference - The Microsoft Azure Marketplace image reference of the virtual machine. - GalleryImageReference *GalleryImageReference `json:"galleryImageReference,omitempty"` - // PlanID - The id of the plan associated with the virtual machine image - PlanID *string `json:"planId,omitempty"` - // ComputeVM - READ-ONLY; The compute virtual machine properties. - ComputeVM *ComputeVMProperties `json:"computeVm,omitempty"` - // NetworkInterface - The network interface properties. - NetworkInterface *NetworkInterfaceProperties `json:"networkInterface,omitempty"` - // ApplicableSchedule - READ-ONLY; The applicable schedule for the virtual machine. - ApplicableSchedule *ApplicableSchedule `json:"applicableSchedule,omitempty"` - // ExpirationDate - The expiration date for VM. - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - // AllowClaim - Indicates whether another user can take ownership of the virtual machine - AllowClaim *bool `json:"allowClaim,omitempty"` - // StorageType - Storage type to use for virtual machine (i.e. Standard, Premium). - StorageType *string `json:"storageType,omitempty"` - // VirtualMachineCreationSource - Tells source of creation of lab virtual machine. Output property only. Possible values include: 'FromCustomImage', 'FromGalleryImage', 'FromSharedGalleryImage' - VirtualMachineCreationSource VirtualMachineCreationSource `json:"virtualMachineCreationSource,omitempty"` - // EnvironmentID - The resource ID of the environment that contains this virtual machine, if any. - EnvironmentID *string `json:"environmentId,omitempty"` - // DataDiskParameters - New or existing data disks to attach to the virtual machine after creation - DataDiskParameters *[]DataDiskProperties `json:"dataDiskParameters,omitempty"` - // ScheduleParameters - Virtual Machine schedules to be created - ScheduleParameters *[]ScheduleCreationParameter `json:"scheduleParameters,omitempty"` - // LastKnownPowerState - Last known compute power state captured in DTL - LastKnownPowerState *string `json:"lastKnownPowerState,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for LabVirtualMachineProperties. -func (lvmp LabVirtualMachineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lvmp.Notes != nil { - objectMap["notes"] = lvmp.Notes - } - if lvmp.OwnerObjectID != nil { - objectMap["ownerObjectId"] = lvmp.OwnerObjectID - } - if lvmp.OwnerUserPrincipalName != nil { - objectMap["ownerUserPrincipalName"] = lvmp.OwnerUserPrincipalName - } - if lvmp.CreatedByUserID != nil { - objectMap["createdByUserId"] = lvmp.CreatedByUserID - } - if lvmp.CreatedByUser != nil { - objectMap["createdByUser"] = lvmp.CreatedByUser - } - if lvmp.CreatedDate != nil { - objectMap["createdDate"] = lvmp.CreatedDate - } - if lvmp.ComputeID != nil { - objectMap["computeId"] = lvmp.ComputeID - } - if lvmp.CustomImageID != nil { - objectMap["customImageId"] = lvmp.CustomImageID - } - if lvmp.OsType != nil { - objectMap["osType"] = lvmp.OsType - } - if lvmp.Size != nil { - objectMap["size"] = lvmp.Size - } - if lvmp.UserName != nil { - objectMap["userName"] = lvmp.UserName - } - if lvmp.Password != nil { - objectMap["password"] = lvmp.Password - } - if lvmp.SSHKey != nil { - objectMap["sshKey"] = lvmp.SSHKey - } - if lvmp.IsAuthenticationWithSSHKey != nil { - objectMap["isAuthenticationWithSshKey"] = lvmp.IsAuthenticationWithSSHKey - } - if lvmp.Fqdn != nil { - objectMap["fqdn"] = lvmp.Fqdn - } - if lvmp.LabSubnetName != nil { - objectMap["labSubnetName"] = lvmp.LabSubnetName - } - if lvmp.LabVirtualNetworkID != nil { - objectMap["labVirtualNetworkId"] = lvmp.LabVirtualNetworkID - } - if lvmp.DisallowPublicIPAddress != nil { - objectMap["disallowPublicIpAddress"] = lvmp.DisallowPublicIPAddress - } - if lvmp.Artifacts != nil { - objectMap["artifacts"] = lvmp.Artifacts - } - if lvmp.ArtifactDeploymentStatus != nil { - objectMap["artifactDeploymentStatus"] = lvmp.ArtifactDeploymentStatus - } - if lvmp.GalleryImageReference != nil { - objectMap["galleryImageReference"] = lvmp.GalleryImageReference - } - if lvmp.PlanID != nil { - objectMap["planId"] = lvmp.PlanID - } - if lvmp.NetworkInterface != nil { - objectMap["networkInterface"] = lvmp.NetworkInterface - } - if lvmp.ExpirationDate != nil { - objectMap["expirationDate"] = lvmp.ExpirationDate - } - if lvmp.AllowClaim != nil { - objectMap["allowClaim"] = lvmp.AllowClaim - } - if lvmp.StorageType != nil { - objectMap["storageType"] = lvmp.StorageType - } - if lvmp.VirtualMachineCreationSource != "" { - objectMap["virtualMachineCreationSource"] = lvmp.VirtualMachineCreationSource - } - if lvmp.EnvironmentID != nil { - objectMap["environmentId"] = lvmp.EnvironmentID - } - if lvmp.DataDiskParameters != nil { - objectMap["dataDiskParameters"] = lvmp.DataDiskParameters - } - if lvmp.ScheduleParameters != nil { - objectMap["scheduleParameters"] = lvmp.ScheduleParameters - } - if lvmp.LastKnownPowerState != nil { - objectMap["lastKnownPowerState"] = lvmp.LastKnownPowerState - } - return json.Marshal(objectMap) -} - -// LabVirtualMachinePropertiesFragment properties of a virtual machine. -type LabVirtualMachinePropertiesFragment struct { - // Notes - The notes of the virtual machine. - Notes *string `json:"notes,omitempty"` - // OwnerObjectID - The object identifier of the owner of the virtual machine. - OwnerObjectID *string `json:"ownerObjectId,omitempty"` - // OwnerUserPrincipalName - The user principal name of the virtual machine owner. - OwnerUserPrincipalName *string `json:"ownerUserPrincipalName,omitempty"` - // CreatedByUserID - The object identifier of the creator of the virtual machine. - CreatedByUserID *string `json:"createdByUserId,omitempty"` - // CreatedByUser - The email address of creator of the virtual machine. - CreatedByUser *string `json:"createdByUser,omitempty"` - // CreatedDate - The creation date of the virtual machine. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // ComputeID - The resource identifier (Microsoft.Compute) of the virtual machine. - ComputeID *string `json:"computeId,omitempty"` - // CustomImageID - The custom image identifier of the virtual machine. - CustomImageID *string `json:"customImageId,omitempty"` - // OsType - The OS type of the virtual machine. - OsType *string `json:"osType,omitempty"` - // Size - The size of the virtual machine. - Size *string `json:"size,omitempty"` - // UserName - The user name of the virtual machine. - UserName *string `json:"userName,omitempty"` - // Password - The password of the virtual machine administrator. - Password *string `json:"password,omitempty"` - // SSHKey - The SSH key of the virtual machine administrator. - SSHKey *string `json:"sshKey,omitempty"` - // IsAuthenticationWithSSHKey - Indicates whether this virtual machine uses an SSH key for authentication. - IsAuthenticationWithSSHKey *bool `json:"isAuthenticationWithSshKey,omitempty"` - // Fqdn - The fully-qualified domain name of the virtual machine. - Fqdn *string `json:"fqdn,omitempty"` - // LabSubnetName - The lab subnet name of the virtual machine. - LabSubnetName *string `json:"labSubnetName,omitempty"` - // LabVirtualNetworkID - The lab virtual network identifier of the virtual machine. - LabVirtualNetworkID *string `json:"labVirtualNetworkId,omitempty"` - // DisallowPublicIPAddress - Indicates whether the virtual machine is to be created without a public IP address. - DisallowPublicIPAddress *bool `json:"disallowPublicIpAddress,omitempty"` - // Artifacts - The artifacts to be installed on the virtual machine. - Artifacts *[]ArtifactInstallPropertiesFragment `json:"artifacts,omitempty"` - // ArtifactDeploymentStatus - The artifact deployment status for the virtual machine. - ArtifactDeploymentStatus *ArtifactDeploymentStatusPropertiesFragment `json:"artifactDeploymentStatus,omitempty"` - // GalleryImageReference - The Microsoft Azure Marketplace image reference of the virtual machine. - GalleryImageReference *GalleryImageReferenceFragment `json:"galleryImageReference,omitempty"` - // PlanID - The id of the plan associated with the virtual machine image - PlanID *string `json:"planId,omitempty"` - // NetworkInterface - The network interface properties. - NetworkInterface *NetworkInterfacePropertiesFragment `json:"networkInterface,omitempty"` - // ExpirationDate - The expiration date for VM. - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - // AllowClaim - Indicates whether another user can take ownership of the virtual machine - AllowClaim *bool `json:"allowClaim,omitempty"` - // StorageType - Storage type to use for virtual machine (i.e. Standard, Premium). - StorageType *string `json:"storageType,omitempty"` - // VirtualMachineCreationSource - Tells source of creation of lab virtual machine. Output property only. Possible values include: 'FromCustomImage', 'FromGalleryImage', 'FromSharedGalleryImage' - VirtualMachineCreationSource VirtualMachineCreationSource `json:"virtualMachineCreationSource,omitempty"` - // EnvironmentID - The resource ID of the environment that contains this virtual machine, if any. - EnvironmentID *string `json:"environmentId,omitempty"` - // DataDiskParameters - New or existing data disks to attach to the virtual machine after creation - DataDiskParameters *[]DataDiskPropertiesFragment `json:"dataDiskParameters,omitempty"` - // ScheduleParameters - Virtual Machine schedules to be created - ScheduleParameters *[]ScheduleCreationParameterFragment `json:"scheduleParameters,omitempty"` - // LastKnownPowerState - Last known compute power state captured in DTL - LastKnownPowerState *string `json:"lastKnownPowerState,omitempty"` -} - -// LinuxOsInfo information about a Linux OS. -type LinuxOsInfo struct { - // LinuxOsState - The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, DeprovisionApplied). Possible values include: 'NonDeprovisioned', 'DeprovisionRequested', 'DeprovisionApplied' - LinuxOsState LinuxOsState `json:"linuxOsState,omitempty"` -} - -// LinuxOsInfoFragment information about a Linux OS. -type LinuxOsInfoFragment struct { - // LinuxOsState - The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, DeprovisionApplied). Possible values include: 'NonDeprovisioned', 'DeprovisionRequested', 'DeprovisionApplied' - LinuxOsState LinuxOsState `json:"linuxOsState,omitempty"` -} - -// NetworkInterfaceProperties properties of a network interface. -type NetworkInterfaceProperties struct { - // VirtualNetworkID - The resource ID of the virtual network. - VirtualNetworkID *string `json:"virtualNetworkId,omitempty"` - // SubnetID - The resource ID of the sub net. - SubnetID *string `json:"subnetId,omitempty"` - // PublicIPAddressID - The resource ID of the public IP address. - PublicIPAddressID *string `json:"publicIpAddressId,omitempty"` - // PublicIPAddress - The public IP address. - PublicIPAddress *string `json:"publicIpAddress,omitempty"` - // PrivateIPAddress - The private IP address. - PrivateIPAddress *string `json:"privateIpAddress,omitempty"` - // DNSName - The DNS name. - DNSName *string `json:"dnsName,omitempty"` - // RdpAuthority - The RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol). - RdpAuthority *string `json:"rdpAuthority,omitempty"` - // SSHAuthority - The SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH. - SSHAuthority *string `json:"sshAuthority,omitempty"` - // SharedPublicIPAddressConfiguration - The configuration for sharing a public IP address across multiple virtual machines. - SharedPublicIPAddressConfiguration *SharedPublicIPAddressConfiguration `json:"sharedPublicIpAddressConfiguration,omitempty"` -} - -// NetworkInterfacePropertiesFragment properties of a network interface. -type NetworkInterfacePropertiesFragment struct { - // VirtualNetworkID - The resource ID of the virtual network. - VirtualNetworkID *string `json:"virtualNetworkId,omitempty"` - // SubnetID - The resource ID of the sub net. - SubnetID *string `json:"subnetId,omitempty"` - // PublicIPAddressID - The resource ID of the public IP address. - PublicIPAddressID *string `json:"publicIpAddressId,omitempty"` - // PublicIPAddress - The public IP address. - PublicIPAddress *string `json:"publicIpAddress,omitempty"` - // PrivateIPAddress - The private IP address. - PrivateIPAddress *string `json:"privateIpAddress,omitempty"` - // DNSName - The DNS name. - DNSName *string `json:"dnsName,omitempty"` - // RdpAuthority - The RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol). - RdpAuthority *string `json:"rdpAuthority,omitempty"` - // SSHAuthority - The SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH. - SSHAuthority *string `json:"sshAuthority,omitempty"` - // SharedPublicIPAddressConfiguration - The configuration for sharing a public IP address across multiple virtual machines. - SharedPublicIPAddressConfiguration *SharedPublicIPAddressConfigurationFragment `json:"sharedPublicIpAddressConfiguration,omitempty"` -} - -// NotificationChannel a notification. -type NotificationChannel struct { - autorest.Response `json:"-"` - // NotificationChannelProperties - The properties of the resource. - *NotificationChannelProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for NotificationChannel. -func (nc NotificationChannel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nc.NotificationChannelProperties != nil { - objectMap["properties"] = nc.NotificationChannelProperties - } - if nc.Location != nil { - objectMap["location"] = nc.Location - } - if nc.Tags != nil { - objectMap["tags"] = nc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NotificationChannel struct. -func (nc *NotificationChannel) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var notificationChannelProperties NotificationChannelProperties - err = json.Unmarshal(*v, ¬ificationChannelProperties) - if err != nil { - return err - } - nc.NotificationChannelProperties = ¬ificationChannelProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nc.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - nc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - nc.Tags = tags - } - } - } - - return nil -} - -// NotificationChannelFragment a notification. -type NotificationChannelFragment struct { - // NotificationChannelPropertiesFragment - The properties of the resource. - *NotificationChannelPropertiesFragment `json:"properties,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for NotificationChannelFragment. -func (ncf NotificationChannelFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ncf.NotificationChannelPropertiesFragment != nil { - objectMap["properties"] = ncf.NotificationChannelPropertiesFragment - } - if ncf.Tags != nil { - objectMap["tags"] = ncf.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NotificationChannelFragment struct. -func (ncf *NotificationChannelFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var notificationChannelPropertiesFragment NotificationChannelPropertiesFragment - err = json.Unmarshal(*v, ¬ificationChannelPropertiesFragment) - if err != nil { - return err - } - ncf.NotificationChannelPropertiesFragment = ¬ificationChannelPropertiesFragment - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ncf.Tags = tags - } - } - } - - return nil -} - -// NotificationChannelList the response of a list operation. -type NotificationChannelList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]NotificationChannel `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// NotificationChannelListIterator provides access to a complete listing of NotificationChannel values. -type NotificationChannelListIterator struct { - i int - page NotificationChannelListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *NotificationChannelListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationChannelListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *NotificationChannelListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter NotificationChannelListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter NotificationChannelListIterator) Response() NotificationChannelList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter NotificationChannelListIterator) Value() NotificationChannel { - if !iter.page.NotDone() { - return NotificationChannel{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the NotificationChannelListIterator type. -func NewNotificationChannelListIterator(page NotificationChannelListPage) NotificationChannelListIterator { - return NotificationChannelListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ncl NotificationChannelList) IsEmpty() bool { - return ncl.Value == nil || len(*ncl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ncl NotificationChannelList) hasNextLink() bool { - return ncl.NextLink != nil && len(*ncl.NextLink) != 0 -} - -// notificationChannelListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ncl NotificationChannelList) notificationChannelListPreparer(ctx context.Context) (*http.Request, error) { - if !ncl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ncl.NextLink))) -} - -// NotificationChannelListPage contains a page of NotificationChannel values. -type NotificationChannelListPage struct { - fn func(context.Context, NotificationChannelList) (NotificationChannelList, error) - ncl NotificationChannelList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *NotificationChannelListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationChannelListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ncl) - if err != nil { - return err - } - page.ncl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *NotificationChannelListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page NotificationChannelListPage) NotDone() bool { - return !page.ncl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page NotificationChannelListPage) Response() NotificationChannelList { - return page.ncl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page NotificationChannelListPage) Values() []NotificationChannel { - if page.ncl.IsEmpty() { - return nil - } - return *page.ncl.Value -} - -// Creates a new instance of the NotificationChannelListPage type. -func NewNotificationChannelListPage(cur NotificationChannelList, getNextPage func(context.Context, NotificationChannelList) (NotificationChannelList, error)) NotificationChannelListPage { - return NotificationChannelListPage{ - fn: getNextPage, - ncl: cur, - } -} - -// NotificationChannelProperties properties of a schedule. -type NotificationChannelProperties struct { - // WebHookURL - The webhook URL to send notifications to. - WebHookURL *string `json:"webHookUrl,omitempty"` - // EmailRecipient - The email recipient to send notifications to (can be a list of semi-colon separated email addresses). - EmailRecipient *string `json:"emailRecipient,omitempty"` - // NotificationLocale - The locale to use when sending a notification (fallback for unsupported languages is EN). - NotificationLocale *string `json:"notificationLocale,omitempty"` - // Description - Description of notification. - Description *string `json:"description,omitempty"` - // Events - The list of event for which this notification is enabled. - Events *[]Event `json:"events,omitempty"` - // CreatedDate - READ-ONLY; The creation date of the notification channel. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotificationChannelProperties. -func (ncp NotificationChannelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ncp.WebHookURL != nil { - objectMap["webHookUrl"] = ncp.WebHookURL - } - if ncp.EmailRecipient != nil { - objectMap["emailRecipient"] = ncp.EmailRecipient - } - if ncp.NotificationLocale != nil { - objectMap["notificationLocale"] = ncp.NotificationLocale - } - if ncp.Description != nil { - objectMap["description"] = ncp.Description - } - if ncp.Events != nil { - objectMap["events"] = ncp.Events - } - return json.Marshal(objectMap) -} - -// NotificationChannelPropertiesFragment properties of a schedule. -type NotificationChannelPropertiesFragment struct { - // WebHookURL - The webhook URL to send notifications to. - WebHookURL *string `json:"webHookUrl,omitempty"` - // EmailRecipient - The email recipient to send notifications to (can be a list of semi-colon separated email addresses). - EmailRecipient *string `json:"emailRecipient,omitempty"` - // NotificationLocale - The locale to use when sending a notification (fallback for unsupported languages is EN). - NotificationLocale *string `json:"notificationLocale,omitempty"` - // Description - Description of notification. - Description *string `json:"description,omitempty"` - // Events - The list of event for which this notification is enabled. - Events *[]EventFragment `json:"events,omitempty"` -} - -// NotificationSettings notification settings for a schedule. -type NotificationSettings struct { - // Status - If notifications are enabled for this schedule (i.e. Enabled, Disabled). Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' - Status EnableStatus `json:"status,omitempty"` - // TimeInMinutes - Time in minutes before event at which notification will be sent. - TimeInMinutes *int32 `json:"timeInMinutes,omitempty"` - // WebhookURL - The webhook URL to which the notification will be sent. - WebhookURL *string `json:"webhookUrl,omitempty"` - // EmailRecipient - The email recipient to send notifications to (can be a list of semi-colon separated email addresses). - EmailRecipient *string `json:"emailRecipient,omitempty"` - // NotificationLocale - The locale to use when sending a notification (fallback for unsupported languages is EN). - NotificationLocale *string `json:"notificationLocale,omitempty"` -} - -// NotificationSettingsFragment notification settings for a schedule. -type NotificationSettingsFragment struct { - // Status - If notifications are enabled for this schedule (i.e. Enabled, Disabled). Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' - Status EnableStatus `json:"status,omitempty"` - // TimeInMinutes - Time in minutes before event at which notification will be sent. - TimeInMinutes *int32 `json:"timeInMinutes,omitempty"` - // WebhookURL - The webhook URL to which the notification will be sent. - WebhookURL *string `json:"webhookUrl,omitempty"` - // EmailRecipient - The email recipient to send notifications to (can be a list of semi-colon separated email addresses). - EmailRecipient *string `json:"emailRecipient,omitempty"` - // NotificationLocale - The locale to use when sending a notification (fallback for unsupported languages is EN). - NotificationLocale *string `json:"notificationLocale,omitempty"` -} - -// NotifyParameters properties for generating a Notification. -type NotifyParameters struct { - // EventName - The type of event (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', 'Cost' - EventName NotificationChannelEventType `json:"eventName,omitempty"` - // JSONPayload - Properties for the notification in json format. - JSONPayload *string `json:"jsonPayload,omitempty"` -} - -// OperationError error details for the operation in case of a failure. -type OperationError struct { - // Code - The error code of the operation error. - Code *string `json:"code,omitempty"` - // Message - The error message of the operation error. - Message *string `json:"message,omitempty"` -} - -// OperationMetadata the REST API operation supported by DevTestLab ResourceProvider. -type OperationMetadata struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - The object that describes the operations - Display *OperationMetadataDisplay `json:"display,omitempty"` -} - -// OperationMetadataDisplay the object that describes the operations -type OperationMetadataDisplay struct { - // Provider - Friendly name of the resource provider - Provider *string `json:"provider,omitempty"` - // Resource - Resource type on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: read, write, delete, listKeys/action, etc. - Operation *string `json:"operation,omitempty"` - // Description - Friendly name of the operation - Description *string `json:"description,omitempty"` -} - -// OperationResult an Operation Result -type OperationResult struct { - autorest.Response `json:"-"` - // Status - The operation status. - Status *string `json:"status,omitempty"` - // StatusCode - The status code for the operation. Possible values include: 'Continue', 'SwitchingProtocols', 'OK', 'Created', 'Accepted', 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', 'PartialContent', 'MultipleChoices', 'MovedPermanently', 'Redirect', 'SeeOther', 'NotModified', 'UseProxy', 'Unused', 'TemporaryRedirect', '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' - StatusCode HTTPStatusCode `json:"statusCode,omitempty"` - // Error - Error details for the operation in case of a failure. - Error *OperationError `json:"error,omitempty"` -} - -// ParameterInfo information about an artifact's parameter. -type ParameterInfo struct { - // Name - The name of the artifact parameter. - Name *string `json:"name,omitempty"` - // Value - The value of the artifact parameter. - Value *string `json:"value,omitempty"` -} - -// ParametersValueFileInfo a file containing a set of parameter values for an ARM template. -type ParametersValueFileInfo struct { - // FileName - File name. - FileName *string `json:"fileName,omitempty"` - // ParametersValueInfo - Contents of the file. - ParametersValueInfo interface{} `json:"parametersValueInfo,omitempty"` -} - -// PercentageCostThresholdProperties properties of a percentage cost threshold. -type PercentageCostThresholdProperties struct { - // ThresholdValue - The cost threshold value. - ThresholdValue *float64 `json:"thresholdValue,omitempty"` -} - -// Policy a Policy. -type Policy struct { - autorest.Response `json:"-"` - // PolicyProperties - The properties of the resource. - *PolicyProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Policy. -func (p Policy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if p.PolicyProperties != nil { - objectMap["properties"] = p.PolicyProperties - } - if p.Location != nil { - objectMap["location"] = p.Location - } - if p.Tags != nil { - objectMap["tags"] = p.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Policy struct. -func (p *Policy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var policyProperties PolicyProperties - err = json.Unmarshal(*v, &policyProperties) - if err != nil { - return err - } - p.PolicyProperties = &policyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - p.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - p.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - p.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - p.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - p.Tags = tags - } - } - } - - return nil -} - -// PolicyFragment a Policy. -type PolicyFragment struct { - // PolicyPropertiesFragment - The properties of the resource. - *PolicyPropertiesFragment `json:"properties,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PolicyFragment. -func (pf PolicyFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pf.PolicyPropertiesFragment != nil { - objectMap["properties"] = pf.PolicyPropertiesFragment - } - if pf.Tags != nil { - objectMap["tags"] = pf.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PolicyFragment struct. -func (pf *PolicyFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var policyPropertiesFragment PolicyPropertiesFragment - err = json.Unmarshal(*v, &policyPropertiesFragment) - if err != nil { - return err - } - pf.PolicyPropertiesFragment = &policyPropertiesFragment - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - pf.Tags = tags - } - } - } - - return nil -} - -// PolicyList the response of a list operation. -type PolicyList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]Policy `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// PolicyListIterator provides access to a complete listing of Policy values. -type PolicyListIterator struct { - i int - page PolicyListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PolicyListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PolicyListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PolicyListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PolicyListIterator) Response() PolicyList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PolicyListIterator) Value() Policy { - if !iter.page.NotDone() { - return Policy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PolicyListIterator type. -func NewPolicyListIterator(page PolicyListPage) PolicyListIterator { - return PolicyListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pl PolicyList) IsEmpty() bool { - return pl.Value == nil || len(*pl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pl PolicyList) hasNextLink() bool { - return pl.NextLink != nil && len(*pl.NextLink) != 0 -} - -// policyListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pl PolicyList) policyListPreparer(ctx context.Context) (*http.Request, error) { - if !pl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pl.NextLink))) -} - -// PolicyListPage contains a page of Policy values. -type PolicyListPage struct { - fn func(context.Context, PolicyList) (PolicyList, error) - pl PolicyList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PolicyListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.pl) - if err != nil { - return err - } - page.pl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PolicyListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PolicyListPage) NotDone() bool { - return !page.pl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PolicyListPage) Response() PolicyList { - return page.pl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PolicyListPage) Values() []Policy { - if page.pl.IsEmpty() { - return nil - } - return *page.pl.Value -} - -// Creates a new instance of the PolicyListPage type. -func NewPolicyListPage(cur PolicyList, getNextPage func(context.Context, PolicyList) (PolicyList, error)) PolicyListPage { - return PolicyListPage{ - fn: getNextPage, - pl: cur, - } -} - -// PolicyProperties properties of a Policy. -type PolicyProperties struct { - // Description - The description of the policy. - Description *string `json:"description,omitempty"` - // Status - The status of the policy. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` - // FactName - The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: 'PolicyFactNameUserOwnedLabVMCount', 'PolicyFactNameUserOwnedLabPremiumVMCount', 'PolicyFactNameLabVMCount', 'PolicyFactNameLabPremiumVMCount', 'PolicyFactNameLabVMSize', 'PolicyFactNameGalleryImage', 'PolicyFactNameUserOwnedLabVMCountInSubnet', 'PolicyFactNameLabTargetCost', 'PolicyFactNameEnvironmentTemplate', 'PolicyFactNameScheduleEditPermission' - FactName PolicyFactName `json:"factName,omitempty"` - // FactData - The fact data of the policy. - FactData *string `json:"factData,omitempty"` - // Threshold - The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy). - Threshold *string `json:"threshold,omitempty"` - // EvaluatorType - The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' - EvaluatorType PolicyEvaluatorType `json:"evaluatorType,omitempty"` - // CreatedDate - READ-ONLY; The creation date of the policy. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyProperties. -func (pp PolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pp.Description != nil { - objectMap["description"] = pp.Description - } - if pp.Status != "" { - objectMap["status"] = pp.Status - } - if pp.FactName != "" { - objectMap["factName"] = pp.FactName - } - if pp.FactData != nil { - objectMap["factData"] = pp.FactData - } - if pp.Threshold != nil { - objectMap["threshold"] = pp.Threshold - } - if pp.EvaluatorType != "" { - objectMap["evaluatorType"] = pp.EvaluatorType - } - return json.Marshal(objectMap) -} - -// PolicyPropertiesFragment properties of a Policy. -type PolicyPropertiesFragment struct { - // Description - The description of the policy. - Description *string `json:"description,omitempty"` - // Status - The status of the policy. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' - Status PolicyStatus `json:"status,omitempty"` - // FactName - The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: 'PolicyFactNameUserOwnedLabVMCount', 'PolicyFactNameUserOwnedLabPremiumVMCount', 'PolicyFactNameLabVMCount', 'PolicyFactNameLabPremiumVMCount', 'PolicyFactNameLabVMSize', 'PolicyFactNameGalleryImage', 'PolicyFactNameUserOwnedLabVMCountInSubnet', 'PolicyFactNameLabTargetCost', 'PolicyFactNameEnvironmentTemplate', 'PolicyFactNameScheduleEditPermission' - FactName PolicyFactName `json:"factName,omitempty"` - // FactData - The fact data of the policy. - FactData *string `json:"factData,omitempty"` - // Threshold - The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy). - Threshold *string `json:"threshold,omitempty"` - // EvaluatorType - The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' - EvaluatorType PolicyEvaluatorType `json:"evaluatorType,omitempty"` -} - -// PolicySetResult result of a policy set evaluation. -type PolicySetResult struct { - // HasError - A value indicating whether this policy set evaluation has discovered violations. - HasError *bool `json:"hasError,omitempty"` - // PolicyViolations - The list of policy violations. - PolicyViolations *[]PolicyViolation `json:"policyViolations,omitempty"` -} - -// PolicyViolation policy violation. -type PolicyViolation struct { - // Code - The code of the policy violation. - Code *string `json:"code,omitempty"` - // Message - The message of the policy violation. - Message *string `json:"message,omitempty"` -} - -// Port properties of a network port. -type Port struct { - // TransportProtocol - Protocol type of the port. Possible values include: 'TCP', 'UDP' - TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` - // BackendPort - Backend port of the target virtual machine. - BackendPort *int32 `json:"backendPort,omitempty"` -} - -// PortFragment properties of a network port. -type PortFragment struct { - // TransportProtocol - Protocol type of the port. Possible values include: 'TCP', 'UDP' - TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` - // BackendPort - Backend port of the target virtual machine. - BackendPort *int32 `json:"backendPort,omitempty"` -} - -// ProviderOperationResult result of the request to list REST API operations -type ProviderOperationResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the resource provider. - Value *[]OperationMetadata `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProviderOperationResult. -func (por ProviderOperationResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if por.Value != nil { - objectMap["value"] = por.Value - } - return json.Marshal(objectMap) -} - -// ProviderOperationResultIterator provides access to a complete listing of OperationMetadata values. -type ProviderOperationResultIterator struct { - i int - page ProviderOperationResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ProviderOperationResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ProviderOperationResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ProviderOperationResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ProviderOperationResultIterator) Response() ProviderOperationResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ProviderOperationResultIterator) Value() OperationMetadata { - if !iter.page.NotDone() { - return OperationMetadata{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ProviderOperationResultIterator type. -func NewProviderOperationResultIterator(page ProviderOperationResultPage) ProviderOperationResultIterator { - return ProviderOperationResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (por ProviderOperationResult) IsEmpty() bool { - return por.Value == nil || len(*por.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (por ProviderOperationResult) hasNextLink() bool { - return por.NextLink != nil && len(*por.NextLink) != 0 -} - -// providerOperationResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (por ProviderOperationResult) providerOperationResultPreparer(ctx context.Context) (*http.Request, error) { - if !por.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(por.NextLink))) -} - -// ProviderOperationResultPage contains a page of OperationMetadata values. -type ProviderOperationResultPage struct { - fn func(context.Context, ProviderOperationResult) (ProviderOperationResult, error) - por ProviderOperationResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ProviderOperationResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.por) - if err != nil { - return err - } - page.por = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ProviderOperationResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ProviderOperationResultPage) NotDone() bool { - return !page.por.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ProviderOperationResultPage) Response() ProviderOperationResult { - return page.por -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ProviderOperationResultPage) Values() []OperationMetadata { - if page.por.IsEmpty() { - return nil - } - return *page.por.Value -} - -// Creates a new instance of the ProviderOperationResultPage type. -func NewProviderOperationResultPage(cur ProviderOperationResult, getNextPage func(context.Context, ProviderOperationResult) (ProviderOperationResult, error)) ProviderOperationResultPage { - return ProviderOperationResultPage{ - fn: getNextPage, - por: cur, - } -} - -// RdpConnection represents a .rdp file -type RdpConnection struct { - autorest.Response `json:"-"` - // Contents - The contents of the .rdp file - Contents *string `json:"contents,omitempty"` -} - -// ResizeLabVirtualMachineProperties request body for resizing a virtual machine. -type ResizeLabVirtualMachineProperties struct { - // Size - Specifies the size of the virtual machine. - Size *string `json:"size,omitempty"` -} - -// Resource an Azure resource. -type Resource struct { - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// RetargetScheduleProperties properties for retargeting a virtual machine schedule. -type RetargetScheduleProperties struct { - // CurrentResourceID - The resource Id of the virtual machine on which the schedule operates - CurrentResourceID *string `json:"currentResourceId,omitempty"` - // TargetResourceID - The resource Id of the virtual machine that the schedule should be retargeted to - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// Schedule a schedule. -type Schedule struct { - autorest.Response `json:"-"` - // ScheduleProperties - The properties of the resource. - *ScheduleProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Schedule. -func (s Schedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.ScheduleProperties != nil { - objectMap["properties"] = s.ScheduleProperties - } - if s.Location != nil { - objectMap["location"] = s.Location - } - if s.Tags != nil { - objectMap["tags"] = s.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Schedule struct. -func (s *Schedule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var scheduleProperties ScheduleProperties - err = json.Unmarshal(*v, &scheduleProperties) - if err != nil { - return err - } - s.ScheduleProperties = &scheduleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - s.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - s.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - s.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - s.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - s.Tags = tags - } - } - } - - return nil -} - -// ScheduleCreationParameter properties for creating a schedule. -type ScheduleCreationParameter struct { - // ScheduleCreationParameterProperties - The properties of the schedule. - *ScheduleCreationParameterProperties `json:"properties,omitempty"` - // Name - The name of the virtual machine or environment - Name *string `json:"name,omitempty"` - // Location - The location of the new virtual machine or environment - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ScheduleCreationParameter. -func (scp ScheduleCreationParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.ScheduleCreationParameterProperties != nil { - objectMap["properties"] = scp.ScheduleCreationParameterProperties - } - if scp.Name != nil { - objectMap["name"] = scp.Name - } - if scp.Location != nil { - objectMap["location"] = scp.Location - } - if scp.Tags != nil { - objectMap["tags"] = scp.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScheduleCreationParameter struct. -func (scp *ScheduleCreationParameter) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var scheduleCreationParameterProperties ScheduleCreationParameterProperties - err = json.Unmarshal(*v, &scheduleCreationParameterProperties) - if err != nil { - return err - } - scp.ScheduleCreationParameterProperties = &scheduleCreationParameterProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - scp.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - scp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - scp.Tags = tags - } - } - } - - return nil -} - -// ScheduleCreationParameterFragment properties for creating a schedule. -type ScheduleCreationParameterFragment struct { - // ScheduleCreationParameterPropertiesFragment - The properties of the schedule. - *ScheduleCreationParameterPropertiesFragment `json:"properties,omitempty"` - // Name - The name of the virtual machine or environment - Name *string `json:"name,omitempty"` - // Location - The location of the new virtual machine or environment - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ScheduleCreationParameterFragment. -func (scpf ScheduleCreationParameterFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scpf.ScheduleCreationParameterPropertiesFragment != nil { - objectMap["properties"] = scpf.ScheduleCreationParameterPropertiesFragment - } - if scpf.Name != nil { - objectMap["name"] = scpf.Name - } - if scpf.Location != nil { - objectMap["location"] = scpf.Location - } - if scpf.Tags != nil { - objectMap["tags"] = scpf.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScheduleCreationParameterFragment struct. -func (scpf *ScheduleCreationParameterFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var scheduleCreationParameterPropertiesFragment ScheduleCreationParameterPropertiesFragment - err = json.Unmarshal(*v, &scheduleCreationParameterPropertiesFragment) - if err != nil { - return err - } - scpf.ScheduleCreationParameterPropertiesFragment = &scheduleCreationParameterPropertiesFragment - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - scpf.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - scpf.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - scpf.Tags = tags - } - } - } - - return nil -} - -// ScheduleCreationParameterProperties properties for schedule creation. -type ScheduleCreationParameterProperties struct { - // Status - The status of the schedule (i.e. Enabled, Disabled). Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' - Status EnableStatus `json:"status,omitempty"` - // TaskType - The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). - TaskType *string `json:"taskType,omitempty"` - // WeeklyRecurrence - If the schedule will occur only some days of the week, specify the weekly recurrence. - WeeklyRecurrence *WeekDetails `json:"weeklyRecurrence,omitempty"` - // DailyRecurrence - If the schedule will occur once each day of the week, specify the daily recurrence. - DailyRecurrence *DayDetails `json:"dailyRecurrence,omitempty"` - // HourlyRecurrence - If the schedule will occur multiple times a day, specify the hourly recurrence. - HourlyRecurrence *HourDetails `json:"hourlyRecurrence,omitempty"` - // TimeZoneID - The time zone ID (e.g. Pacific Standard time). - TimeZoneID *string `json:"timeZoneId,omitempty"` - // NotificationSettings - Notification settings. - NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` - // TargetResourceID - The resource ID to which the schedule belongs - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// ScheduleCreationParameterPropertiesFragment properties for schedule creation. -type ScheduleCreationParameterPropertiesFragment struct { - // Status - The status of the schedule (i.e. Enabled, Disabled). Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' - Status EnableStatus `json:"status,omitempty"` - // TaskType - The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). - TaskType *string `json:"taskType,omitempty"` - // WeeklyRecurrence - If the schedule will occur only some days of the week, specify the weekly recurrence. - WeeklyRecurrence *WeekDetailsFragment `json:"weeklyRecurrence,omitempty"` - // DailyRecurrence - If the schedule will occur once each day of the week, specify the daily recurrence. - DailyRecurrence *DayDetailsFragment `json:"dailyRecurrence,omitempty"` - // HourlyRecurrence - If the schedule will occur multiple times a day, specify the hourly recurrence. - HourlyRecurrence *HourDetailsFragment `json:"hourlyRecurrence,omitempty"` - // TimeZoneID - The time zone ID (e.g. Pacific Standard time). - TimeZoneID *string `json:"timeZoneId,omitempty"` - // NotificationSettings - Notification settings. - NotificationSettings *NotificationSettingsFragment `json:"notificationSettings,omitempty"` - // TargetResourceID - The resource ID to which the schedule belongs - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// ScheduleFragment a schedule. -type ScheduleFragment struct { - // SchedulePropertiesFragment - The properties of the resource. - *SchedulePropertiesFragment `json:"properties,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ScheduleFragment. -func (sf ScheduleFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sf.SchedulePropertiesFragment != nil { - objectMap["properties"] = sf.SchedulePropertiesFragment - } - if sf.Tags != nil { - objectMap["tags"] = sf.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScheduleFragment struct. -func (sf *ScheduleFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var schedulePropertiesFragment SchedulePropertiesFragment - err = json.Unmarshal(*v, &schedulePropertiesFragment) - if err != nil { - return err - } - sf.SchedulePropertiesFragment = &schedulePropertiesFragment - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sf.Tags = tags - } - } - } - - return nil -} - -// ScheduleList the response of a list operation. -type ScheduleList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]Schedule `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ScheduleListIterator provides access to a complete listing of Schedule values. -type ScheduleListIterator struct { - i int - page ScheduleListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ScheduleListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ScheduleListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ScheduleListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ScheduleListIterator) Response() ScheduleList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ScheduleListIterator) Value() Schedule { - if !iter.page.NotDone() { - return Schedule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ScheduleListIterator type. -func NewScheduleListIterator(page ScheduleListPage) ScheduleListIterator { - return ScheduleListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sl ScheduleList) IsEmpty() bool { - return sl.Value == nil || len(*sl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sl ScheduleList) hasNextLink() bool { - return sl.NextLink != nil && len(*sl.NextLink) != 0 -} - -// scheduleListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sl ScheduleList) scheduleListPreparer(ctx context.Context) (*http.Request, error) { - if !sl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sl.NextLink))) -} - -// ScheduleListPage contains a page of Schedule values. -type ScheduleListPage struct { - fn func(context.Context, ScheduleList) (ScheduleList, error) - sl ScheduleList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ScheduleListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScheduleListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sl) - if err != nil { - return err - } - page.sl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ScheduleListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ScheduleListPage) NotDone() bool { - return !page.sl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ScheduleListPage) Response() ScheduleList { - return page.sl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ScheduleListPage) Values() []Schedule { - if page.sl.IsEmpty() { - return nil - } - return *page.sl.Value -} - -// Creates a new instance of the ScheduleListPage type. -func NewScheduleListPage(cur ScheduleList, getNextPage func(context.Context, ScheduleList) (ScheduleList, error)) ScheduleListPage { - return ScheduleListPage{ - fn: getNextPage, - sl: cur, - } -} - -// ScheduleProperties properties of a schedule. -type ScheduleProperties struct { - // Status - The status of the schedule (i.e. Enabled, Disabled). Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' - Status EnableStatus `json:"status,omitempty"` - // TaskType - The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). - TaskType *string `json:"taskType,omitempty"` - // WeeklyRecurrence - If the schedule will occur only some days of the week, specify the weekly recurrence. - WeeklyRecurrence *WeekDetails `json:"weeklyRecurrence,omitempty"` - // DailyRecurrence - If the schedule will occur once each day of the week, specify the daily recurrence. - DailyRecurrence *DayDetails `json:"dailyRecurrence,omitempty"` - // HourlyRecurrence - If the schedule will occur multiple times a day, specify the hourly recurrence. - HourlyRecurrence *HourDetails `json:"hourlyRecurrence,omitempty"` - // TimeZoneID - The time zone ID (e.g. Pacific Standard time). - TimeZoneID *string `json:"timeZoneId,omitempty"` - // NotificationSettings - Notification settings. - NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` - // CreatedDate - READ-ONLY; The creation date of the schedule. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // TargetResourceID - The resource ID to which the schedule belongs - TargetResourceID *string `json:"targetResourceId,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduleProperties. -func (sp ScheduleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.Status != "" { - objectMap["status"] = sp.Status - } - if sp.TaskType != nil { - objectMap["taskType"] = sp.TaskType - } - if sp.WeeklyRecurrence != nil { - objectMap["weeklyRecurrence"] = sp.WeeklyRecurrence - } - if sp.DailyRecurrence != nil { - objectMap["dailyRecurrence"] = sp.DailyRecurrence - } - if sp.HourlyRecurrence != nil { - objectMap["hourlyRecurrence"] = sp.HourlyRecurrence - } - if sp.TimeZoneID != nil { - objectMap["timeZoneId"] = sp.TimeZoneID - } - if sp.NotificationSettings != nil { - objectMap["notificationSettings"] = sp.NotificationSettings - } - if sp.TargetResourceID != nil { - objectMap["targetResourceId"] = sp.TargetResourceID - } - return json.Marshal(objectMap) -} - -// SchedulePropertiesFragment properties of a schedule. -type SchedulePropertiesFragment struct { - // Status - The status of the schedule (i.e. Enabled, Disabled). Possible values include: 'EnableStatusEnabled', 'EnableStatusDisabled' - Status EnableStatus `json:"status,omitempty"` - // TaskType - The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). - TaskType *string `json:"taskType,omitempty"` - // WeeklyRecurrence - If the schedule will occur only some days of the week, specify the weekly recurrence. - WeeklyRecurrence *WeekDetailsFragment `json:"weeklyRecurrence,omitempty"` - // DailyRecurrence - If the schedule will occur once each day of the week, specify the daily recurrence. - DailyRecurrence *DayDetailsFragment `json:"dailyRecurrence,omitempty"` - // HourlyRecurrence - If the schedule will occur multiple times a day, specify the hourly recurrence. - HourlyRecurrence *HourDetailsFragment `json:"hourlyRecurrence,omitempty"` - // TimeZoneID - The time zone ID (e.g. Pacific Standard time). - TimeZoneID *string `json:"timeZoneId,omitempty"` - // NotificationSettings - Notification settings. - NotificationSettings *NotificationSettingsFragment `json:"notificationSettings,omitempty"` - // TargetResourceID - The resource ID to which the schedule belongs - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// SchedulesExecuteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SchedulesExecuteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SchedulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SchedulesExecuteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SchedulesExecuteFuture.Result. -func (future *SchedulesExecuteFuture) result(client SchedulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesExecuteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.SchedulesExecuteFuture") - return - } - ar.Response = future.Response() - return -} - -// Secret a secret. -type Secret struct { - autorest.Response `json:"-"` - // SecretProperties - The properties of the resource. - *SecretProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Secret. -func (s Secret) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.SecretProperties != nil { - objectMap["properties"] = s.SecretProperties - } - if s.Location != nil { - objectMap["location"] = s.Location - } - if s.Tags != nil { - objectMap["tags"] = s.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Secret struct. -func (s *Secret) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var secretProperties SecretProperties - err = json.Unmarshal(*v, &secretProperties) - if err != nil { - return err - } - s.SecretProperties = &secretProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - s.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - s.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - s.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - s.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - s.Tags = tags - } - } - } - - return nil -} - -// SecretFragment a secret. -type SecretFragment struct { - // SecretPropertiesFragment - The properties of the resource. - *SecretPropertiesFragment `json:"properties,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SecretFragment. -func (sf SecretFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sf.SecretPropertiesFragment != nil { - objectMap["properties"] = sf.SecretPropertiesFragment - } - if sf.Tags != nil { - objectMap["tags"] = sf.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SecretFragment struct. -func (sf *SecretFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var secretPropertiesFragment SecretPropertiesFragment - err = json.Unmarshal(*v, &secretPropertiesFragment) - if err != nil { - return err - } - sf.SecretPropertiesFragment = &secretPropertiesFragment - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sf.Tags = tags - } - } - } - - return nil -} - -// SecretList the response of a list operation. -type SecretList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]Secret `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// SecretListIterator provides access to a complete listing of Secret values. -type SecretListIterator struct { - i int - page SecretListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SecretListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecretListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SecretListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SecretListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SecretListIterator) Response() SecretList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SecretListIterator) Value() Secret { - if !iter.page.NotDone() { - return Secret{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SecretListIterator type. -func NewSecretListIterator(page SecretListPage) SecretListIterator { - return SecretListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sl SecretList) IsEmpty() bool { - return sl.Value == nil || len(*sl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sl SecretList) hasNextLink() bool { - return sl.NextLink != nil && len(*sl.NextLink) != 0 -} - -// secretListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sl SecretList) secretListPreparer(ctx context.Context) (*http.Request, error) { - if !sl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sl.NextLink))) -} - -// SecretListPage contains a page of Secret values. -type SecretListPage struct { - fn func(context.Context, SecretList) (SecretList, error) - sl SecretList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SecretListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecretListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sl) - if err != nil { - return err - } - page.sl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SecretListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SecretListPage) NotDone() bool { - return !page.sl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SecretListPage) Response() SecretList { - return page.sl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SecretListPage) Values() []Secret { - if page.sl.IsEmpty() { - return nil - } - return *page.sl.Value -} - -// Creates a new instance of the SecretListPage type. -func NewSecretListPage(cur SecretList, getNextPage func(context.Context, SecretList) (SecretList, error)) SecretListPage { - return SecretListPage{ - fn: getNextPage, - sl: cur, - } -} - -// SecretProperties properties of a secret. -type SecretProperties struct { - // Value - The value of the secret for secret creation. - Value *string `json:"value,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for SecretProperties. -func (sp SecretProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.Value != nil { - objectMap["value"] = sp.Value - } - return json.Marshal(objectMap) -} - -// SecretPropertiesFragment properties of a secret. -type SecretPropertiesFragment struct { - // Value - The value of the secret for secret creation. - Value *string `json:"value,omitempty"` -} - -// SecretsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SecretsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SecretsClient) (Secret, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SecretsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SecretsCreateOrUpdateFuture.Result. -func (future *SecretsCreateOrUpdateFuture) result(client SecretsClient) (s Secret, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SecretsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.SecretsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.CreateOrUpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SecretsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceFabric a Service Fabric. -type ServiceFabric struct { - autorest.Response `json:"-"` - // ServiceFabricProperties - The properties of the resource. - *ServiceFabricProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServiceFabric. -func (sf ServiceFabric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sf.ServiceFabricProperties != nil { - objectMap["properties"] = sf.ServiceFabricProperties - } - if sf.Location != nil { - objectMap["location"] = sf.Location - } - if sf.Tags != nil { - objectMap["tags"] = sf.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceFabric struct. -func (sf *ServiceFabric) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var serviceFabricProperties ServiceFabricProperties - err = json.Unmarshal(*v, &serviceFabricProperties) - if err != nil { - return err - } - sf.ServiceFabricProperties = &serviceFabricProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sf.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sf.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sf.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sf.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sf.Tags = tags - } - } - } - - return nil -} - -// ServiceFabricFragment a Service Fabric. -type ServiceFabricFragment struct { - // ServiceFabricPropertiesFragment - The properties of the resource. - *ServiceFabricPropertiesFragment `json:"properties,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServiceFabricFragment. -func (sff ServiceFabricFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sff.ServiceFabricPropertiesFragment != nil { - objectMap["properties"] = sff.ServiceFabricPropertiesFragment - } - if sff.Tags != nil { - objectMap["tags"] = sff.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceFabricFragment struct. -func (sff *ServiceFabricFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var serviceFabricPropertiesFragment ServiceFabricPropertiesFragment - err = json.Unmarshal(*v, &serviceFabricPropertiesFragment) - if err != nil { - return err - } - sff.ServiceFabricPropertiesFragment = &serviceFabricPropertiesFragment - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sff.Tags = tags - } - } - } - - return nil -} - -// ServiceFabricList the response of a list operation. -type ServiceFabricList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]ServiceFabric `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ServiceFabricListIterator provides access to a complete listing of ServiceFabric values. -type ServiceFabricListIterator struct { - i int - page ServiceFabricListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServiceFabricListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServiceFabricListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServiceFabricListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServiceFabricListIterator) Response() ServiceFabricList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServiceFabricListIterator) Value() ServiceFabric { - if !iter.page.NotDone() { - return ServiceFabric{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServiceFabricListIterator type. -func NewServiceFabricListIterator(page ServiceFabricListPage) ServiceFabricListIterator { - return ServiceFabricListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sfl ServiceFabricList) IsEmpty() bool { - return sfl.Value == nil || len(*sfl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sfl ServiceFabricList) hasNextLink() bool { - return sfl.NextLink != nil && len(*sfl.NextLink) != 0 -} - -// serviceFabricListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sfl ServiceFabricList) serviceFabricListPreparer(ctx context.Context) (*http.Request, error) { - if !sfl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sfl.NextLink))) -} - -// ServiceFabricListPage contains a page of ServiceFabric values. -type ServiceFabricListPage struct { - fn func(context.Context, ServiceFabricList) (ServiceFabricList, error) - sfl ServiceFabricList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServiceFabricListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sfl) - if err != nil { - return err - } - page.sfl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServiceFabricListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServiceFabricListPage) NotDone() bool { - return !page.sfl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServiceFabricListPage) Response() ServiceFabricList { - return page.sfl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServiceFabricListPage) Values() []ServiceFabric { - if page.sfl.IsEmpty() { - return nil - } - return *page.sfl.Value -} - -// Creates a new instance of the ServiceFabricListPage type. -func NewServiceFabricListPage(cur ServiceFabricList, getNextPage func(context.Context, ServiceFabricList) (ServiceFabricList, error)) ServiceFabricListPage { - return ServiceFabricListPage{ - fn: getNextPage, - sfl: cur, - } -} - -// ServiceFabricProperties properties of a service fabric. -type ServiceFabricProperties struct { - // ExternalServiceFabricID - The backing service fabric resource's id - ExternalServiceFabricID *string `json:"externalServiceFabricId,omitempty"` - // EnvironmentID - The resource id of the environment under which the service fabric resource is present - EnvironmentID *string `json:"environmentId,omitempty"` - // ApplicableSchedule - READ-ONLY; The applicable schedule for the virtual machine. - ApplicableSchedule *ApplicableSchedule `json:"applicableSchedule,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceFabricProperties. -func (sfp ServiceFabricProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sfp.ExternalServiceFabricID != nil { - objectMap["externalServiceFabricId"] = sfp.ExternalServiceFabricID - } - if sfp.EnvironmentID != nil { - objectMap["environmentId"] = sfp.EnvironmentID - } - return json.Marshal(objectMap) -} - -// ServiceFabricPropertiesFragment properties of a service fabric. -type ServiceFabricPropertiesFragment struct { - // ExternalServiceFabricID - The backing service fabric resource's id - ExternalServiceFabricID *string `json:"externalServiceFabricId,omitempty"` - // EnvironmentID - The resource id of the environment under which the service fabric resource is present - EnvironmentID *string `json:"environmentId,omitempty"` -} - -// ServiceFabricSchedulesExecuteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServiceFabricSchedulesExecuteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceFabricSchedulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceFabricSchedulesExecuteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceFabricSchedulesExecuteFuture.Result. -func (future *ServiceFabricSchedulesExecuteFuture) result(client ServiceFabricSchedulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesExecuteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.ServiceFabricSchedulesExecuteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServiceFabricsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServiceFabricsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceFabricsClient) (ServiceFabric, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceFabricsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceFabricsCreateOrUpdateFuture.Result. -func (future *ServiceFabricsCreateOrUpdateFuture) result(client ServiceFabricsClient) (sf ServiceFabric, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sf.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.ServiceFabricsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sf.Response.Response, err = future.GetResult(sender); err == nil && sf.Response.Response.StatusCode != http.StatusNoContent { - sf, err = client.CreateOrUpdateResponder(sf.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsCreateOrUpdateFuture", "Result", sf.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceFabricsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceFabricsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceFabricsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceFabricsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceFabricsDeleteFuture.Result. -func (future *ServiceFabricsDeleteFuture) result(client ServiceFabricsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.ServiceFabricsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServiceFabricsStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceFabricsStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceFabricsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceFabricsStartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceFabricsStartFuture.Result. -func (future *ServiceFabricsStartFuture) result(client ServiceFabricsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.ServiceFabricsStartFuture") - return - } - ar.Response = future.Response() - return -} - -// ServiceFabricsStopFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceFabricsStopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceFabricsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceFabricsStopFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceFabricsStopFuture.Result. -func (future *ServiceFabricsStopFuture) result(client ServiceFabricsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsStopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.ServiceFabricsStopFuture") - return - } - ar.Response = future.Response() - return -} - -// ServiceRunner a container for a managed identity to execute DevTest lab services. -type ServiceRunner struct { - autorest.Response `json:"-"` - // Identity - The identity of the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServiceRunner. -func (sr ServiceRunner) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Identity != nil { - objectMap["identity"] = sr.Identity - } - if sr.Location != nil { - objectMap["location"] = sr.Location - } - if sr.Tags != nil { - objectMap["tags"] = sr.Tags - } - return json.Marshal(objectMap) -} - -// SharedPublicIPAddressConfiguration properties of a virtual machine that determine how it is connected to -// a load balancer. -type SharedPublicIPAddressConfiguration struct { - // InboundNatRules - The incoming NAT rules - InboundNatRules *[]InboundNatRule `json:"inboundNatRules,omitempty"` -} - -// SharedPublicIPAddressConfigurationFragment properties of a virtual machine that determine how it is -// connected to a load balancer. -type SharedPublicIPAddressConfigurationFragment struct { - // InboundNatRules - The incoming NAT rules - InboundNatRules *[]InboundNatRuleFragment `json:"inboundNatRules,omitempty"` -} - -// ShutdownNotificationContent the contents of a shutdown notification. Webhooks can use this type to -// deserialize the request body when they get notified of an imminent shutdown. -type ShutdownNotificationContent struct { - // SkipURL - The URL to skip auto-shutdown. - SkipURL *string `json:"skipUrl,omitempty"` - // DelayURL60 - The URL to delay shutdown by 60 minutes. - DelayURL60 *string `json:"delayUrl60,omitempty"` - // DelayURL120 - The URL to delay shutdown by 2 hours. - DelayURL120 *string `json:"delayUrl120,omitempty"` - // VMName - The virtual machine to be shut down. - VMName *string `json:"vmName,omitempty"` - // GUID - The GUID for the virtual machine to be shut down. - GUID *string `json:"guid,omitempty"` - // Owner - The owner of the virtual machine. - Owner *string `json:"owner,omitempty"` - // VMURL - The URL of the virtual machine. - VMURL *string `json:"vmUrl,omitempty"` - // MinutesUntilShutdown - Minutes remaining until shutdown - MinutesUntilShutdown *string `json:"minutesUntilShutdown,omitempty"` - // EventType - The event for which a notification will be sent. - EventType *string `json:"eventType,omitempty"` - // Text - The text for the notification. - Text *string `json:"text,omitempty"` - // SubscriptionID - The subscription ID for the schedule. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // ResourceGroupName - The resource group name for the schedule. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // LabName - The lab for the schedule. - LabName *string `json:"labName,omitempty"` -} - -// Subnet subnet information. -type Subnet struct { - // ResourceID - The resource ID of the subnet. - ResourceID *string `json:"resourceId,omitempty"` - // LabSubnetName - The name of the subnet as seen in the lab. - LabSubnetName *string `json:"labSubnetName,omitempty"` - // AllowPublicIP - The permission policy of the subnet for allowing public IP addresses (i.e. Allow, Deny)). Possible values include: 'Default', 'Deny', 'Allow' - AllowPublicIP UsagePermissionType `json:"allowPublicIp,omitempty"` -} - -// SubnetFragment subnet information. -type SubnetFragment struct { - // ResourceID - The resource ID of the subnet. - ResourceID *string `json:"resourceId,omitempty"` - // LabSubnetName - The name of the subnet as seen in the lab. - LabSubnetName *string `json:"labSubnetName,omitempty"` - // AllowPublicIP - The permission policy of the subnet for allowing public IP addresses (i.e. Allow, Deny)). Possible values include: 'Default', 'Deny', 'Allow' - AllowPublicIP UsagePermissionType `json:"allowPublicIp,omitempty"` -} - -// SubnetOverride property overrides on a subnet of a virtual network. -type SubnetOverride struct { - // ResourceID - The resource ID of the subnet. - ResourceID *string `json:"resourceId,omitempty"` - // LabSubnetName - The name given to the subnet within the lab. - LabSubnetName *string `json:"labSubnetName,omitempty"` - // UseInVMCreationPermission - Indicates whether this subnet can be used during virtual machine creation (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' - UseInVMCreationPermission UsagePermissionType `json:"useInVmCreationPermission,omitempty"` - // UsePublicIPAddressPermission - Indicates whether public IP addresses can be assigned to virtual machines on this subnet (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' - UsePublicIPAddressPermission UsagePermissionType `json:"usePublicIpAddressPermission,omitempty"` - // SharedPublicIPAddressConfiguration - Properties that virtual machines on this subnet will share. - SharedPublicIPAddressConfiguration *SubnetSharedPublicIPAddressConfiguration `json:"sharedPublicIpAddressConfiguration,omitempty"` - // VirtualNetworkPoolName - The virtual network pool associated with this subnet. - VirtualNetworkPoolName *string `json:"virtualNetworkPoolName,omitempty"` -} - -// SubnetOverrideFragment property overrides on a subnet of a virtual network. -type SubnetOverrideFragment struct { - // ResourceID - The resource ID of the subnet. - ResourceID *string `json:"resourceId,omitempty"` - // LabSubnetName - The name given to the subnet within the lab. - LabSubnetName *string `json:"labSubnetName,omitempty"` - // UseInVMCreationPermission - Indicates whether this subnet can be used during virtual machine creation (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' - UseInVMCreationPermission UsagePermissionType `json:"useInVmCreationPermission,omitempty"` - // UsePublicIPAddressPermission - Indicates whether public IP addresses can be assigned to virtual machines on this subnet (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow' - UsePublicIPAddressPermission UsagePermissionType `json:"usePublicIpAddressPermission,omitempty"` - // SharedPublicIPAddressConfiguration - Properties that virtual machines on this subnet will share. - SharedPublicIPAddressConfiguration *SubnetSharedPublicIPAddressConfigurationFragment `json:"sharedPublicIpAddressConfiguration,omitempty"` - // VirtualNetworkPoolName - The virtual network pool associated with this subnet. - VirtualNetworkPoolName *string `json:"virtualNetworkPoolName,omitempty"` -} - -// SubnetSharedPublicIPAddressConfiguration configuration for public IP address sharing. -type SubnetSharedPublicIPAddressConfiguration struct { - // AllowedPorts - Backend ports that virtual machines on this subnet are allowed to expose - AllowedPorts *[]Port `json:"allowedPorts,omitempty"` -} - -// SubnetSharedPublicIPAddressConfigurationFragment configuration for public IP address sharing. -type SubnetSharedPublicIPAddressConfigurationFragment struct { - // AllowedPorts - Backend ports that virtual machines on this subnet are allowed to expose - AllowedPorts *[]PortFragment `json:"allowedPorts,omitempty"` -} - -// TargetCostProperties properties of a cost target. -type TargetCostProperties struct { - // Status - Target cost status. Possible values include: 'TargetCostStatusEnabled', 'TargetCostStatusDisabled' - Status TargetCostStatus `json:"status,omitempty"` - // Target - Lab target cost - Target *int32 `json:"target,omitempty"` - // CostThresholds - Cost thresholds. - CostThresholds *[]CostThresholdProperties `json:"costThresholds,omitempty"` - // CycleStartDateTime - Reporting cycle start date. - CycleStartDateTime *date.Time `json:"cycleStartDateTime,omitempty"` - // CycleEndDateTime - Reporting cycle end date. - CycleEndDateTime *date.Time `json:"cycleEndDateTime,omitempty"` - // CycleType - Reporting cycle type. Possible values include: 'CalendarMonth', 'Custom' - CycleType ReportingCycleType `json:"cycleType,omitempty"` -} - -// UpdateResource represents an update resource -type UpdateResource struct { - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for UpdateResource. -func (ur UpdateResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ur.Tags != nil { - objectMap["tags"] = ur.Tags - } - return json.Marshal(objectMap) -} - -// User profile of a lab user. -type User struct { - autorest.Response `json:"-"` - // UserProperties - The properties of the resource. - *UserProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for User. -func (u User) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if u.UserProperties != nil { - objectMap["properties"] = u.UserProperties - } - if u.Location != nil { - objectMap["location"] = u.Location - } - if u.Tags != nil { - objectMap["tags"] = u.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for User struct. -func (u *User) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var userProperties UserProperties - err = json.Unmarshal(*v, &userProperties) - if err != nil { - return err - } - u.UserProperties = &userProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - u.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - u.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - u.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - u.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - u.Tags = tags - } - } - } - - return nil -} - -// UserFragment profile of a lab user. -type UserFragment struct { - // UserPropertiesFragment - The properties of the resource. - *UserPropertiesFragment `json:"properties,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for UserFragment. -func (uf UserFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if uf.UserPropertiesFragment != nil { - objectMap["properties"] = uf.UserPropertiesFragment - } - if uf.Tags != nil { - objectMap["tags"] = uf.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserFragment struct. -func (uf *UserFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var userPropertiesFragment UserPropertiesFragment - err = json.Unmarshal(*v, &userPropertiesFragment) - if err != nil { - return err - } - uf.UserPropertiesFragment = &userPropertiesFragment - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - uf.Tags = tags - } - } - } - - return nil -} - -// UserIdentity identity attributes of a lab user. -type UserIdentity struct { - // PrincipalName - Set to the principal name / UPN of the client JWT making the request. - PrincipalName *string `json:"principalName,omitempty"` - // PrincipalID - Set to the principal Id of the client JWT making the request. Service principal will not have the principal Id. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - Set to the tenant ID of the client JWT making the request. - TenantID *string `json:"tenantId,omitempty"` - // ObjectID - Set to the object Id of the client JWT making the request. Not all users have object Id. For CSP (reseller) scenarios for example, object Id is not available. - ObjectID *string `json:"objectId,omitempty"` - // AppID - Set to the app Id of the client JWT making the request. - AppID *string `json:"appId,omitempty"` -} - -// UserIdentityFragment identity attributes of a lab user. -type UserIdentityFragment struct { - // PrincipalName - Set to the principal name / UPN of the client JWT making the request. - PrincipalName *string `json:"principalName,omitempty"` - // PrincipalID - Set to the principal Id of the client JWT making the request. Service principal will not have the principal Id. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - Set to the tenant ID of the client JWT making the request. - TenantID *string `json:"tenantId,omitempty"` - // ObjectID - Set to the object Id of the client JWT making the request. Not all users have object Id. For CSP (reseller) scenarios for example, object Id is not available. - ObjectID *string `json:"objectId,omitempty"` - // AppID - Set to the app Id of the client JWT making the request. - AppID *string `json:"appId,omitempty"` -} - -// UserList the response of a list operation. -type UserList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]User `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// UserListIterator provides access to a complete listing of User values. -type UserListIterator struct { - i int - page UserListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *UserListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *UserListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter UserListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter UserListIterator) Response() UserList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter UserListIterator) Value() User { - if !iter.page.NotDone() { - return User{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the UserListIterator type. -func NewUserListIterator(page UserListPage) UserListIterator { - return UserListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ul UserList) IsEmpty() bool { - return ul.Value == nil || len(*ul.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ul UserList) hasNextLink() bool { - return ul.NextLink != nil && len(*ul.NextLink) != 0 -} - -// userListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ul UserList) userListPreparer(ctx context.Context) (*http.Request, error) { - if !ul.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ul.NextLink))) -} - -// UserListPage contains a page of User values. -type UserListPage struct { - fn func(context.Context, UserList) (UserList, error) - ul UserList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *UserListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ul) - if err != nil { - return err - } - page.ul = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *UserListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page UserListPage) NotDone() bool { - return !page.ul.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page UserListPage) Response() UserList { - return page.ul -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page UserListPage) Values() []User { - if page.ul.IsEmpty() { - return nil - } - return *page.ul.Value -} - -// Creates a new instance of the UserListPage type. -func NewUserListPage(cur UserList, getNextPage func(context.Context, UserList) (UserList, error)) UserListPage { - return UserListPage{ - fn: getNextPage, - ul: cur, - } -} - -// UserProperties properties of a lab user profile. -type UserProperties struct { - // Identity - The identity of the user. - Identity *UserIdentity `json:"identity,omitempty"` - // SecretStore - The secret store of the user. - SecretStore *UserSecretStore `json:"secretStore,omitempty"` - // CreatedDate - READ-ONLY; The creation date of the user profile. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserProperties. -func (up UserProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if up.Identity != nil { - objectMap["identity"] = up.Identity - } - if up.SecretStore != nil { - objectMap["secretStore"] = up.SecretStore - } - return json.Marshal(objectMap) -} - -// UserPropertiesFragment properties of a lab user profile. -type UserPropertiesFragment struct { - // Identity - The identity of the user. - Identity *UserIdentityFragment `json:"identity,omitempty"` - // SecretStore - The secret store of the user. - SecretStore *UserSecretStoreFragment `json:"secretStore,omitempty"` -} - -// UsersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type UsersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(UsersClient) (User, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *UsersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for UsersCreateOrUpdateFuture.Result. -func (future *UsersCreateOrUpdateFuture) result(client UsersClient) (u User, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.UsersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - u.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.UsersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if u.Response.Response, err = future.GetResult(sender); err == nil && u.Response.Response.StatusCode != http.StatusNoContent { - u, err = client.CreateOrUpdateResponder(u.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.UsersCreateOrUpdateFuture", "Result", u.Response.Response, "Failure responding to request") - } - } - return -} - -// UsersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type UsersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(UsersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *UsersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for UsersDeleteFuture.Result. -func (future *UsersDeleteFuture) result(client UsersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.UsersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.UsersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// UserSecretStore properties of a user's secret store. -type UserSecretStore struct { - // KeyVaultURI - The URI of the user's Key vault. - KeyVaultURI *string `json:"keyVaultUri,omitempty"` - // KeyVaultID - The ID of the user's Key vault. - KeyVaultID *string `json:"keyVaultId,omitempty"` -} - -// UserSecretStoreFragment properties of a user's secret store. -type UserSecretStoreFragment struct { - // KeyVaultURI - The URI of the user's Key vault. - KeyVaultURI *string `json:"keyVaultUri,omitempty"` - // KeyVaultID - The ID of the user's Key vault. - KeyVaultID *string `json:"keyVaultId,omitempty"` -} - -// VirtualMachinesAddDataDiskFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualMachinesAddDataDiskFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualMachinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualMachinesAddDataDiskFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualMachinesAddDataDiskFuture.Result. -func (future *VirtualMachinesAddDataDiskFuture) result(client VirtualMachinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesAddDataDiskFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesAddDataDiskFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualMachinesApplyArtifactsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualMachinesApplyArtifactsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualMachinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualMachinesApplyArtifactsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualMachinesApplyArtifactsFuture.Result. -func (future *VirtualMachinesApplyArtifactsFuture) result(client VirtualMachinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesApplyArtifactsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesApplyArtifactsFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualMachineSchedulesExecuteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualMachineSchedulesExecuteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualMachineSchedulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualMachineSchedulesExecuteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualMachineSchedulesExecuteFuture.Result. -func (future *VirtualMachineSchedulesExecuteFuture) result(client VirtualMachineSchedulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesExecuteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachineSchedulesExecuteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualMachinesClaimFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualMachinesClaimFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualMachinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualMachinesClaimFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualMachinesClaimFuture.Result. -func (future *VirtualMachinesClaimFuture) result(client VirtualMachinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClaimFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesClaimFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualMachinesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualMachinesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualMachinesClient) (LabVirtualMachine, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualMachinesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualMachinesCreateOrUpdateFuture.Result. -func (future *VirtualMachinesCreateOrUpdateFuture) result(client VirtualMachinesClient) (lvm LabVirtualMachine, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - lvm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if lvm.Response.Response, err = future.GetResult(sender); err == nil && lvm.Response.Response.StatusCode != http.StatusNoContent { - lvm, err = client.CreateOrUpdateResponder(lvm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesCreateOrUpdateFuture", "Result", lvm.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualMachinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualMachinesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualMachinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualMachinesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualMachinesDeleteFuture.Result. -func (future *VirtualMachinesDeleteFuture) result(client VirtualMachinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualMachinesDetachDataDiskFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualMachinesDetachDataDiskFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualMachinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualMachinesDetachDataDiskFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualMachinesDetachDataDiskFuture.Result. -func (future *VirtualMachinesDetachDataDiskFuture) result(client VirtualMachinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesDetachDataDiskFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesDetachDataDiskFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualMachinesRedeployFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualMachinesRedeployFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualMachinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualMachinesRedeployFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualMachinesRedeployFuture.Result. -func (future *VirtualMachinesRedeployFuture) result(client VirtualMachinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesRedeployFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesRedeployFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualMachinesResizeFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualMachinesResizeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualMachinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualMachinesResizeFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualMachinesResizeFuture.Result. -func (future *VirtualMachinesResizeFuture) result(client VirtualMachinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesResizeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesResizeFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualMachinesRestartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualMachinesRestartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualMachinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualMachinesRestartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualMachinesRestartFuture.Result. -func (future *VirtualMachinesRestartFuture) result(client VirtualMachinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesRestartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesRestartFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualMachinesStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualMachinesStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualMachinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualMachinesStartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualMachinesStartFuture.Result. -func (future *VirtualMachinesStartFuture) result(client VirtualMachinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesStartFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualMachinesStopFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualMachinesStopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualMachinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualMachinesStopFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualMachinesStopFuture.Result. -func (future *VirtualMachinesStopFuture) result(client VirtualMachinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesStopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesStopFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualMachinesTransferDisksFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualMachinesTransferDisksFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualMachinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualMachinesTransferDisksFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualMachinesTransferDisksFuture.Result. -func (future *VirtualMachinesTransferDisksFuture) result(client VirtualMachinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesTransferDisksFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesTransferDisksFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualMachinesUnClaimFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualMachinesUnClaimFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualMachinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualMachinesUnClaimFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualMachinesUnClaimFuture.Result. -func (future *VirtualMachinesUnClaimFuture) result(client VirtualMachinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesUnClaimFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualMachinesUnClaimFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualNetwork a virtual network. -type VirtualNetwork struct { - autorest.Response `json:"-"` - // VirtualNetworkProperties - The properties of the resource. - *VirtualNetworkProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - // Location - The location of the resource. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VirtualNetwork. -func (vn VirtualNetwork) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vn.VirtualNetworkProperties != nil { - objectMap["properties"] = vn.VirtualNetworkProperties - } - if vn.Location != nil { - objectMap["location"] = vn.Location - } - if vn.Tags != nil { - objectMap["tags"] = vn.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetwork struct. -func (vn *VirtualNetwork) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualNetworkProperties VirtualNetworkProperties - err = json.Unmarshal(*v, &virtualNetworkProperties) - if err != nil { - return err - } - vn.VirtualNetworkProperties = &virtualNetworkProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vn.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vn.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vn.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vn.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vn.Tags = tags - } - } - } - - return nil -} - -// VirtualNetworkFragment a virtual network. -type VirtualNetworkFragment struct { - // VirtualNetworkPropertiesFragment - The properties of the resource. - *VirtualNetworkPropertiesFragment `json:"properties,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkFragment. -func (vnf VirtualNetworkFragment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnf.VirtualNetworkPropertiesFragment != nil { - objectMap["properties"] = vnf.VirtualNetworkPropertiesFragment - } - if vnf.Tags != nil { - objectMap["tags"] = vnf.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetworkFragment struct. -func (vnf *VirtualNetworkFragment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualNetworkPropertiesFragment VirtualNetworkPropertiesFragment - err = json.Unmarshal(*v, &virtualNetworkPropertiesFragment) - if err != nil { - return err - } - vnf.VirtualNetworkPropertiesFragment = &virtualNetworkPropertiesFragment - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vnf.Tags = tags - } - } - } - - return nil -} - -// VirtualNetworkList the response of a list operation. -type VirtualNetworkList struct { - autorest.Response `json:"-"` - // Value - Results of the list operation. - Value *[]VirtualNetwork `json:"value,omitempty"` - // NextLink - Link for next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualNetworkListIterator provides access to a complete listing of VirtualNetwork values. -type VirtualNetworkListIterator struct { - i int - page VirtualNetworkListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualNetworkListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualNetworkListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualNetworkListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualNetworkListIterator) Response() VirtualNetworkList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualNetworkListIterator) Value() VirtualNetwork { - if !iter.page.NotDone() { - return VirtualNetwork{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualNetworkListIterator type. -func NewVirtualNetworkListIterator(page VirtualNetworkListPage) VirtualNetworkListIterator { - return VirtualNetworkListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vnl VirtualNetworkList) IsEmpty() bool { - return vnl.Value == nil || len(*vnl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vnl VirtualNetworkList) hasNextLink() bool { - return vnl.NextLink != nil && len(*vnl.NextLink) != 0 -} - -// virtualNetworkListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vnl VirtualNetworkList) virtualNetworkListPreparer(ctx context.Context) (*http.Request, error) { - if !vnl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vnl.NextLink))) -} - -// VirtualNetworkListPage contains a page of VirtualNetwork values. -type VirtualNetworkListPage struct { - fn func(context.Context, VirtualNetworkList) (VirtualNetworkList, error) - vnl VirtualNetworkList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualNetworkListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vnl) - if err != nil { - return err - } - page.vnl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualNetworkListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualNetworkListPage) NotDone() bool { - return !page.vnl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualNetworkListPage) Response() VirtualNetworkList { - return page.vnl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualNetworkListPage) Values() []VirtualNetwork { - if page.vnl.IsEmpty() { - return nil - } - return *page.vnl.Value -} - -// Creates a new instance of the VirtualNetworkListPage type. -func NewVirtualNetworkListPage(cur VirtualNetworkList, getNextPage func(context.Context, VirtualNetworkList) (VirtualNetworkList, error)) VirtualNetworkListPage { - return VirtualNetworkListPage{ - fn: getNextPage, - vnl: cur, - } -} - -// VirtualNetworkProperties properties of a virtual network. -type VirtualNetworkProperties struct { - // AllowedSubnets - The allowed subnets of the virtual network. - AllowedSubnets *[]Subnet `json:"allowedSubnets,omitempty"` - // Description - The description of the virtual network. - Description *string `json:"description,omitempty"` - // ExternalProviderResourceID - The Microsoft.Network resource identifier of the virtual network. - ExternalProviderResourceID *string `json:"externalProviderResourceId,omitempty"` - // ExternalSubnets - READ-ONLY; The external subnet properties. - ExternalSubnets *[]ExternalSubnet `json:"externalSubnets,omitempty"` - // SubnetOverrides - The subnet overrides of the virtual network. - SubnetOverrides *[]SubnetOverride `json:"subnetOverrides,omitempty"` - // CreatedDate - READ-ONLY; The creation date of the virtual network. - CreatedDate *date.Time `json:"createdDate,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning status of the resource. - ProvisioningState *string `json:"provisioningState,omitempty"` - // UniqueIdentifier - READ-ONLY; The unique immutable identifier of a resource (Guid). - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkProperties. -func (vnp VirtualNetworkProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnp.AllowedSubnets != nil { - objectMap["allowedSubnets"] = vnp.AllowedSubnets - } - if vnp.Description != nil { - objectMap["description"] = vnp.Description - } - if vnp.ExternalProviderResourceID != nil { - objectMap["externalProviderResourceId"] = vnp.ExternalProviderResourceID - } - if vnp.SubnetOverrides != nil { - objectMap["subnetOverrides"] = vnp.SubnetOverrides - } - return json.Marshal(objectMap) -} - -// VirtualNetworkPropertiesFragment properties of a virtual network. -type VirtualNetworkPropertiesFragment struct { - // AllowedSubnets - The allowed subnets of the virtual network. - AllowedSubnets *[]SubnetFragment `json:"allowedSubnets,omitempty"` - // Description - The description of the virtual network. - Description *string `json:"description,omitempty"` - // ExternalProviderResourceID - The Microsoft.Network resource identifier of the virtual network. - ExternalProviderResourceID *string `json:"externalProviderResourceId,omitempty"` - // SubnetOverrides - The subnet overrides of the virtual network. - SubnetOverrides *[]SubnetOverrideFragment `json:"subnetOverrides,omitempty"` -} - -// VirtualNetworksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworksCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworksClient) (VirtualNetwork, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworksCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworksCreateOrUpdateFuture.Result. -func (future *VirtualNetworksCreateOrUpdateFuture) result(client VirtualNetworksClient) (vn VirtualNetwork, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vn.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualNetworksCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vn.Response.Response, err = future.GetResult(sender); err == nil && vn.Response.Response.StatusCode != http.StatusNoContent { - vn, err = client.CreateOrUpdateResponder(vn.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksCreateOrUpdateFuture", "Result", vn.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualNetworksDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworksDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworksDeleteFuture.Result. -func (future *VirtualNetworksDeleteFuture) result(client VirtualNetworksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dtl.VirtualNetworksDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WeekDetails properties of a weekly schedule. -type WeekDetails struct { - // Weekdays - The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). - Weekdays *[]string `json:"weekdays,omitempty"` - // Time - The time of the day the schedule will occur. - Time *string `json:"time,omitempty"` -} - -// WeekDetailsFragment properties of a weekly schedule. -type WeekDetailsFragment struct { - // Weekdays - The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). - Weekdays *[]string `json:"weekdays,omitempty"` - // Time - The time of the day the schedule will occur. - Time *string `json:"time,omitempty"` -} - -// WindowsOsInfo information about a Windows OS. -type WindowsOsInfo struct { - // WindowsOsState - The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, SysprepApplied). Possible values include: 'NonSysprepped', 'SysprepRequested', 'SysprepApplied' - WindowsOsState WindowsOsState `json:"windowsOsState,omitempty"` -} - -// WindowsOsInfoFragment information about a Windows OS. -type WindowsOsInfoFragment struct { - // WindowsOsState - The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, SysprepApplied). Possible values include: 'NonSysprepped', 'SysprepRequested', 'SysprepApplied' - WindowsOsState WindowsOsState `json:"windowsOsState,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/notificationchannels.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/notificationchannels.go deleted file mode 100644 index 59bd13573df5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/notificationchannels.go +++ /dev/null @@ -1,574 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// NotificationChannelsClient is the the DevTest Labs Client. -type NotificationChannelsClient struct { - BaseClient -} - -// NewNotificationChannelsClient creates an instance of the NotificationChannelsClient client. -func NewNotificationChannelsClient(subscriptionID string) NotificationChannelsClient { - return NewNotificationChannelsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotificationChannelsClientWithBaseURI creates an instance of the NotificationChannelsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewNotificationChannelsClientWithBaseURI(baseURI string, subscriptionID string) NotificationChannelsClient { - return NotificationChannelsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing notification channel. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the notification channel. -// notificationChannel - a notification. -func (client NotificationChannelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, notificationChannel NotificationChannel) (result NotificationChannel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationChannelsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: notificationChannel, - Constraints: []validation.Constraint{{Target: "notificationChannel.NotificationChannelProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("dtl.NotificationChannelsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, notificationChannel) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotificationChannelsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, notificationChannel NotificationChannel) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), - autorest.WithJSON(notificationChannel), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationChannelsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client NotificationChannelsClient) CreateOrUpdateResponder(resp *http.Response) (result NotificationChannel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete notification channel. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the notification channel. -func (client NotificationChannelsClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationChannelsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NotificationChannelsClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationChannelsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client NotificationChannelsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get notification channel. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the notification channel. -// expand - specify the $expand query. Example: 'properties($select=webHookUrl)' -func (client NotificationChannelsClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result NotificationChannel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationChannelsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NotificationChannelsClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationChannelsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client NotificationChannelsClient) GetResponder(resp *http.Response) (result NotificationChannel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list notification channels in a given lab. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// expand - specify the $expand query. Example: 'properties($select=webHookUrl)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client NotificationChannelsClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result NotificationChannelListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationChannelsClient.List") - defer func() { - sc := -1 - if result.ncl.Response.Response != nil { - sc = result.ncl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.ncl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "List", resp, "Failure sending request") - return - } - - result.ncl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "List", resp, "Failure responding to request") - return - } - if result.ncl.hasNextLink() && result.ncl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client NotificationChannelsClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationChannelsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client NotificationChannelsClient) ListResponder(resp *http.Response) (result NotificationChannelList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client NotificationChannelsClient) listNextResults(ctx context.Context, lastResults NotificationChannelList) (result NotificationChannelList, err error) { - req, err := lastResults.notificationChannelListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client NotificationChannelsClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result NotificationChannelListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationChannelsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) - return -} - -// Notify send notification to provided channel. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the notification channel. -// notifyParameters - properties for generating a Notification. -func (client NotificationChannelsClient) Notify(ctx context.Context, resourceGroupName string, labName string, name string, notifyParameters NotifyParameters) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationChannelsClient.Notify") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.NotifyPreparer(ctx, resourceGroupName, labName, name, notifyParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Notify", nil, "Failure preparing request") - return - } - - resp, err := client.NotifySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Notify", resp, "Failure sending request") - return - } - - result, err = client.NotifyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Notify", resp, "Failure responding to request") - return - } - - return -} - -// NotifyPreparer prepares the Notify request. -func (client NotificationChannelsClient) NotifyPreparer(ctx context.Context, resourceGroupName string, labName string, name string, notifyParameters NotifyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify", pathParameters), - autorest.WithJSON(notifyParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// NotifySender sends the Notify request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationChannelsClient) NotifySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// NotifyResponder handles the response to the Notify request. The method always -// closes the http.Response Body. -func (client NotificationChannelsClient) NotifyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update allows modifying tags of notification channels. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the notification channel. -// notificationChannel - a notification. -func (client NotificationChannelsClient) Update(ctx context.Context, resourceGroupName string, labName string, name string, notificationChannel NotificationChannelFragment) (result NotificationChannel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationChannelsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, name, notificationChannel) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.NotificationChannelsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client NotificationChannelsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, notificationChannel NotificationChannelFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), - autorest.WithJSON(notificationChannel), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationChannelsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client NotificationChannelsClient) UpdateResponder(resp *http.Response) (result NotificationChannel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/operations.go deleted file mode 100644 index 5ddb571a68e1..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/operations.go +++ /dev/null @@ -1,107 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the the DevTest Labs Client. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get operation. -// Parameters: -// locationName - the name of the location. -// name - the name of the operation. -func (client OperationsClient) Get(ctx context.Context, locationName string, name string) (result OperationResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, locationName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.OperationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.OperationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.OperationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client OperationsClient) GetPreparer(ctx context.Context, locationName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "name": autorest.Encode("path", name), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/locations/{locationName}/operations/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client OperationsClient) GetResponder(resp *http.Response) (result OperationResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/policies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/policies.go deleted file mode 100644 index beffd2e1b708..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/policies.go +++ /dev/null @@ -1,503 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PoliciesClient is the the DevTest Labs Client. -type PoliciesClient struct { - BaseClient -} - -// NewPoliciesClient creates an instance of the PoliciesClient client. -func NewPoliciesClient(subscriptionID string) PoliciesClient { - return NewPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPoliciesClientWithBaseURI creates an instance of the PoliciesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewPoliciesClientWithBaseURI(baseURI string, subscriptionID string) PoliciesClient { - return PoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing policy. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// policySetName - the name of the policy set. -// name - the name of the policy. -// policy - a Policy. -func (client PoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string, policy Policy) (result Policy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: policy, - Constraints: []validation.Constraint{{Target: "policy.PolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("dtl.PoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, policySetName, name, policy) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string, policy Policy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "policySetName": autorest.Encode("path", policySetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), - autorest.WithJSON(policy), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result Policy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete policy. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// policySetName - the name of the policy set. -// name - the name of the policy. -func (client PoliciesClient) Delete(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, policySetName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "policySetName": autorest.Encode("path", policySetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PoliciesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get policy. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// policySetName - the name of the policy set. -// name - the name of the policy. -// expand - specify the $expand query. Example: 'properties($select=description)' -func (client PoliciesClient) Get(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string, expand string) (result Policy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, policySetName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "policySetName": autorest.Encode("path", policySetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PoliciesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PoliciesClient) GetResponder(resp *http.Response) (result Policy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list policies in a given policy set. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// policySetName - the name of the policy set. -// expand - specify the $expand query. Example: 'properties($select=description)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client PoliciesClient) List(ctx context.Context, resourceGroupName string, labName string, policySetName string, expand string, filter string, top *int32, orderby string) (result PolicyListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.List") - defer func() { - sc := -1 - if result.pl.Response.Response != nil { - sc = result.pl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, policySetName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.pl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "List", resp, "Failure sending request") - return - } - - result.pl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "List", resp, "Failure responding to request") - return - } - if result.pl.hasNextLink() && result.pl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, policySetName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "policySetName": autorest.Encode("path", policySetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PoliciesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PoliciesClient) ListResponder(resp *http.Response) (result PolicyList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client PoliciesClient) listNextResults(ctx context.Context, lastResults PolicyList) (result PolicyList, err error) { - req, err := lastResults.policyListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.PoliciesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.PoliciesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PoliciesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, policySetName string, expand string, filter string, top *int32, orderby string) (result PolicyListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, policySetName, expand, filter, top, orderby) - return -} - -// Update allows modifying tags of policies. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// policySetName - the name of the policy set. -// name - the name of the policy. -// policy - a Policy. -func (client PoliciesClient) Update(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string, policy PolicyFragment) (result Policy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, policySetName, name, policy) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.PoliciesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PoliciesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, policySetName string, name string, policy PolicyFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "policySetName": autorest.Encode("path", policySetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), - autorest.WithJSON(policy), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client PoliciesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client PoliciesClient) UpdateResponder(resp *http.Response) (result Policy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/policysets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/policysets.go deleted file mode 100644 index a9f43bc7ec61..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/policysets.go +++ /dev/null @@ -1,112 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PolicySetsClient is the the DevTest Labs Client. -type PolicySetsClient struct { - BaseClient -} - -// NewPolicySetsClient creates an instance of the PolicySetsClient client. -func NewPolicySetsClient(subscriptionID string) PolicySetsClient { - return NewPolicySetsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPolicySetsClientWithBaseURI creates an instance of the PolicySetsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewPolicySetsClientWithBaseURI(baseURI string, subscriptionID string) PolicySetsClient { - return PolicySetsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// EvaluatePolicies evaluates lab policy. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the policy set. -// evaluatePoliciesRequest - request body for evaluating a policy set. -func (client PolicySetsClient) EvaluatePolicies(ctx context.Context, resourceGroupName string, labName string, name string, evaluatePoliciesRequest EvaluatePoliciesRequest) (result EvaluatePoliciesResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicySetsClient.EvaluatePolicies") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.EvaluatePoliciesPreparer(ctx, resourceGroupName, labName, name, evaluatePoliciesRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.PolicySetsClient", "EvaluatePolicies", nil, "Failure preparing request") - return - } - - resp, err := client.EvaluatePoliciesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.PolicySetsClient", "EvaluatePolicies", resp, "Failure sending request") - return - } - - result, err = client.EvaluatePoliciesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.PolicySetsClient", "EvaluatePolicies", resp, "Failure responding to request") - return - } - - return -} - -// EvaluatePoliciesPreparer prepares the EvaluatePolicies request. -func (client PolicySetsClient) EvaluatePoliciesPreparer(ctx context.Context, resourceGroupName string, labName string, name string, evaluatePoliciesRequest EvaluatePoliciesRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies", pathParameters), - autorest.WithJSON(evaluatePoliciesRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EvaluatePoliciesSender sends the EvaluatePolicies request. The method will close the -// http.Response Body if it receives an error. -func (client PolicySetsClient) EvaluatePoliciesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// EvaluatePoliciesResponder handles the response to the EvaluatePolicies request. The method always -// closes the http.Response Body. -func (client PolicySetsClient) EvaluatePoliciesResponder(resp *http.Response) (result EvaluatePoliciesResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/provideroperations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/provideroperations.go deleted file mode 100644 index 46355a0d1743..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/provideroperations.go +++ /dev/null @@ -1,141 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ProviderOperationsClient is the the DevTest Labs Client. -type ProviderOperationsClient struct { - BaseClient -} - -// NewProviderOperationsClient creates an instance of the ProviderOperationsClient client. -func NewProviderOperationsClient(subscriptionID string) ProviderOperationsClient { - return NewProviderOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProviderOperationsClientWithBaseURI creates an instance of the ProviderOperationsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewProviderOperationsClientWithBaseURI(baseURI string, subscriptionID string) ProviderOperationsClient { - return ProviderOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List result of the request to list REST API operations -func (client ProviderOperationsClient) List(ctx context.Context) (result ProviderOperationResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsClient.List") - defer func() { - sc := -1 - if result.por.Response.Response != nil { - sc = result.por.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ProviderOperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.por.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ProviderOperationsClient", "List", resp, "Failure sending request") - return - } - - result.por, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ProviderOperationsClient", "List", resp, "Failure responding to request") - return - } - if result.por.hasNextLink() && result.por.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ProviderOperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DevTestLab/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderOperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ProviderOperationsClient) ListResponder(resp *http.Response) (result ProviderOperationResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ProviderOperationsClient) listNextResults(ctx context.Context, lastResults ProviderOperationResult) (result ProviderOperationResult, err error) { - req, err := lastResults.providerOperationResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.ProviderOperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.ProviderOperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ProviderOperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProviderOperationsClient) ListComplete(ctx context.Context) (result ProviderOperationResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/schedules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/schedules.go deleted file mode 100644 index d07d1426d0cf..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/schedules.go +++ /dev/null @@ -1,693 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SchedulesClient is the the DevTest Labs Client. -type SchedulesClient struct { - BaseClient -} - -// NewSchedulesClient creates an instance of the SchedulesClient client. -func NewSchedulesClient(subscriptionID string) SchedulesClient { - return NewSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSchedulesClientWithBaseURI creates an instance of the SchedulesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSchedulesClientWithBaseURI(baseURI string, subscriptionID string) SchedulesClient { - return SchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing schedule. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the schedule. -// schedule - a schedule. -func (client SchedulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, schedule Schedule) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SchedulesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: schedule, - Constraints: []validation.Constraint{{Target: "schedule.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("dtl.SchedulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, schedule) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SchedulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, schedule Schedule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), - autorest.WithJSON(schedule), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete schedule. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the schedule. -func (client SchedulesClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SchedulesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SchedulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Execute execute a schedule. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the schedule. -func (client SchedulesClient) Execute(ctx context.Context, resourceGroupName string, labName string, name string) (result SchedulesExecuteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SchedulesClient.Execute") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ExecutePreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Execute", nil, "Failure preparing request") - return - } - - result, err = client.ExecuteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Execute", result.Response(), "Failure sending request") - return - } - - return -} - -// ExecutePreparer prepares the Execute request. -func (client SchedulesClient) ExecutePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExecuteSender sends the Execute request. The method will close the -// http.Response Body if it receives an error. -func (client SchedulesClient) ExecuteSender(req *http.Request) (future SchedulesExecuteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ExecuteResponder handles the response to the Execute request. The method always -// closes the http.Response Body. -func (client SchedulesClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get schedule. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the schedule. -// expand - specify the $expand query. Example: 'properties($select=status)' -func (client SchedulesClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SchedulesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SchedulesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SchedulesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SchedulesClient) GetResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list schedules in a given lab. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// expand - specify the $expand query. Example: 'properties($select=status)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client SchedulesClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ScheduleListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SchedulesClient.List") - defer func() { - sc := -1 - if result.sl.Response.Response != nil { - sc = result.sl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "List", resp, "Failure sending request") - return - } - - result.sl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "List", resp, "Failure responding to request") - return - } - if result.sl.hasNextLink() && result.sl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SchedulesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SchedulesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SchedulesClient) ListResponder(resp *http.Response) (result ScheduleList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client SchedulesClient) listNextResults(ctx context.Context, lastResults ScheduleList) (result ScheduleList, err error) { - req, err := lastResults.scheduleListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.SchedulesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.SchedulesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SchedulesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ScheduleListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SchedulesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) - return -} - -// ListApplicable lists all applicable schedules -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the schedule. -func (client SchedulesClient) ListApplicable(ctx context.Context, resourceGroupName string, labName string, name string) (result ScheduleListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SchedulesClient.ListApplicable") - defer func() { - sc := -1 - if result.sl.Response.Response != nil { - sc = result.sl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listApplicableNextResults - req, err := client.ListApplicablePreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "ListApplicable", nil, "Failure preparing request") - return - } - - resp, err := client.ListApplicableSender(req) - if err != nil { - result.sl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "ListApplicable", resp, "Failure sending request") - return - } - - result.sl, err = client.ListApplicableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "ListApplicable", resp, "Failure responding to request") - return - } - if result.sl.hasNextLink() && result.sl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListApplicablePreparer prepares the ListApplicable request. -func (client SchedulesClient) ListApplicablePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListApplicableSender sends the ListApplicable request. The method will close the -// http.Response Body if it receives an error. -func (client SchedulesClient) ListApplicableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListApplicableResponder handles the response to the ListApplicable request. The method always -// closes the http.Response Body. -func (client SchedulesClient) ListApplicableResponder(resp *http.Response) (result ScheduleList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listApplicableNextResults retrieves the next set of results, if any. -func (client SchedulesClient) listApplicableNextResults(ctx context.Context, lastResults ScheduleList) (result ScheduleList, err error) { - req, err := lastResults.scheduleListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.SchedulesClient", "listApplicableNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListApplicableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.SchedulesClient", "listApplicableNextResults", resp, "Failure sending next results request") - } - result, err = client.ListApplicableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "listApplicableNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListApplicableComplete enumerates all values, automatically crossing page boundaries as required. -func (client SchedulesClient) ListApplicableComplete(ctx context.Context, resourceGroupName string, labName string, name string) (result ScheduleListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SchedulesClient.ListApplicable") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListApplicable(ctx, resourceGroupName, labName, name) - return -} - -// Update allows modifying tags of schedules. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the schedule. -// schedule - a schedule. -func (client SchedulesClient) Update(ctx context.Context, resourceGroupName string, labName string, name string, schedule ScheduleFragment) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SchedulesClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, name, schedule) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SchedulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SchedulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, schedule ScheduleFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), - autorest.WithJSON(schedule), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SchedulesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SchedulesClient) UpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/secrets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/secrets.go deleted file mode 100644 index 045fbcf51693..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/secrets.go +++ /dev/null @@ -1,506 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SecretsClient is the the DevTest Labs Client. -type SecretsClient struct { - BaseClient -} - -// NewSecretsClient creates an instance of the SecretsClient client. -func NewSecretsClient(subscriptionID string) SecretsClient { - return NewSecretsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSecretsClientWithBaseURI creates an instance of the SecretsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSecretsClientWithBaseURI(baseURI string, subscriptionID string) SecretsClient { - return SecretsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing secret. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the secret. -// secret - a secret. -func (client SecretsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, userName string, name string, secret Secret) (result SecretsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: secret, - Constraints: []validation.Constraint{{Target: "secret.SecretProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("dtl.SecretsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, userName, name, secret) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SecretsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, secret Secret) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}", pathParameters), - autorest.WithJSON(secret), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SecretsClient) CreateOrUpdateSender(req *http.Request) (future SecretsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SecretsClient) CreateOrUpdateResponder(resp *http.Response) (result Secret, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete secret. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the secret. -func (client SecretsClient) Delete(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, userName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SecretsClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SecretsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SecretsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get secret. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the secret. -// expand - specify the $expand query. Example: 'properties($select=value)' -func (client SecretsClient) Get(ctx context.Context, resourceGroupName string, labName string, userName string, name string, expand string) (result Secret, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, userName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SecretsClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SecretsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SecretsClient) GetResponder(resp *http.Response) (result Secret, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list secrets in a given user profile. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// expand - specify the $expand query. Example: 'properties($select=value)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client SecretsClient) List(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result SecretListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.List") - defer func() { - sc := -1 - if result.sl.Response.Response != nil { - sc = result.sl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, userName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "List", resp, "Failure sending request") - return - } - - result.sl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "List", resp, "Failure responding to request") - return - } - if result.sl.hasNextLink() && result.sl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SecretsClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SecretsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SecretsClient) ListResponder(resp *http.Response) (result SecretList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client SecretsClient) listNextResults(ctx context.Context, lastResults SecretList) (result SecretList, err error) { - req, err := lastResults.secretListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.SecretsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.SecretsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SecretsClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result SecretListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, userName, expand, filter, top, orderby) - return -} - -// Update allows modifying tags of secrets. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the secret. -// secret - a secret. -func (client SecretsClient) Update(ctx context.Context, resourceGroupName string, labName string, userName string, name string, secret SecretFragment) (result Secret, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, userName, name, secret) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.SecretsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SecretsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, secret SecretFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}", pathParameters), - autorest.WithJSON(secret), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SecretsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SecretsClient) UpdateResponder(resp *http.Response) (result Secret, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/servicefabrics.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/servicefabrics.go deleted file mode 100644 index fbc3a08f021e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/servicefabrics.go +++ /dev/null @@ -1,762 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServiceFabricsClient is the the DevTest Labs Client. -type ServiceFabricsClient struct { - BaseClient -} - -// NewServiceFabricsClient creates an instance of the ServiceFabricsClient client. -func NewServiceFabricsClient(subscriptionID string) ServiceFabricsClient { - return NewServiceFabricsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceFabricsClientWithBaseURI creates an instance of the ServiceFabricsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewServiceFabricsClientWithBaseURI(baseURI string, subscriptionID string) ServiceFabricsClient { - return ServiceFabricsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing service fabric. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the service fabric. -// serviceFabric - a Service Fabric. -func (client ServiceFabricsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, userName string, name string, serviceFabric ServiceFabric) (result ServiceFabricsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceFabric, - Constraints: []validation.Constraint{{Target: "serviceFabric.ServiceFabricProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "serviceFabric.ServiceFabricProperties.ApplicableSchedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "serviceFabric.ServiceFabricProperties.ApplicableSchedule.ApplicableScheduleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "serviceFabric.ServiceFabricProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "serviceFabric.ServiceFabricProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "serviceFabric.ServiceFabricProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "serviceFabric.ServiceFabricProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("dtl.ServiceFabricsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, userName, name, serviceFabric) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServiceFabricsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, serviceFabric ServiceFabric) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}", pathParameters), - autorest.WithJSON(serviceFabric), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceFabricsClient) CreateOrUpdateSender(req *http.Request) (future ServiceFabricsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServiceFabricsClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceFabric, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete service fabric. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the service fabric. -func (client ServiceFabricsClient) Delete(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (result ServiceFabricsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, userName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServiceFabricsClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceFabricsClient) DeleteSender(req *http.Request) (future ServiceFabricsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServiceFabricsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get service fabric. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the service fabric. -// expand - specify the $expand query. Example: 'properties($expand=applicableSchedule)' -func (client ServiceFabricsClient) Get(ctx context.Context, resourceGroupName string, labName string, userName string, name string, expand string) (result ServiceFabric, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, userName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServiceFabricsClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceFabricsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServiceFabricsClient) GetResponder(resp *http.Response) (result ServiceFabric, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list service fabrics in a given user profile. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// expand - specify the $expand query. Example: 'properties($expand=applicableSchedule)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client ServiceFabricsClient) List(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result ServiceFabricListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricsClient.List") - defer func() { - sc := -1 - if result.sfl.Response.Response != nil { - sc = result.sfl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, userName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sfl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "List", resp, "Failure sending request") - return - } - - result.sfl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "List", resp, "Failure responding to request") - return - } - if result.sfl.hasNextLink() && result.sfl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServiceFabricsClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceFabricsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServiceFabricsClient) ListResponder(resp *http.Response) (result ServiceFabricList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ServiceFabricsClient) listNextResults(ctx context.Context, lastResults ServiceFabricList) (result ServiceFabricList, err error) { - req, err := lastResults.serviceFabricListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServiceFabricsClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result ServiceFabricListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, userName, expand, filter, top, orderby) - return -} - -// ListApplicableSchedules lists the applicable start/stop schedules, if any. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the service fabric. -func (client ServiceFabricsClient) ListApplicableSchedules(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (result ApplicableSchedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricsClient.ListApplicableSchedules") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListApplicableSchedulesPreparer(ctx, resourceGroupName, labName, userName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "ListApplicableSchedules", nil, "Failure preparing request") - return - } - - resp, err := client.ListApplicableSchedulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "ListApplicableSchedules", resp, "Failure sending request") - return - } - - result, err = client.ListApplicableSchedulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "ListApplicableSchedules", resp, "Failure responding to request") - return - } - - return -} - -// ListApplicableSchedulesPreparer prepares the ListApplicableSchedules request. -func (client ServiceFabricsClient) ListApplicableSchedulesPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/listApplicableSchedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListApplicableSchedulesSender sends the ListApplicableSchedules request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceFabricsClient) ListApplicableSchedulesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListApplicableSchedulesResponder handles the response to the ListApplicableSchedules request. The method always -// closes the http.Response Body. -func (client ServiceFabricsClient) ListApplicableSchedulesResponder(resp *http.Response) (result ApplicableSchedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Start start a service fabric. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the service fabric. -func (client ServiceFabricsClient) Start(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (result ServiceFabricsStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricsClient.Start") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.StartPreparer(ctx, resourceGroupName, labName, userName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client ServiceFabricsClient) StartPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceFabricsClient) StartSender(req *http.Request) (future ServiceFabricsStartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client ServiceFabricsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stop a service fabric This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the service fabric. -func (client ServiceFabricsClient) Stop(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (result ServiceFabricsStopFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricsClient.Stop") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.StopPreparer(ctx, resourceGroupName, labName, userName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = client.StopSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "Stop", result.Response(), "Failure sending request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client ServiceFabricsClient) StopPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceFabricsClient) StopSender(req *http.Request) (future ServiceFabricsStopFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client ServiceFabricsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update allows modifying tags of service fabrics. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// name - the name of the service fabric. -// serviceFabric - a Service Fabric. -func (client ServiceFabricsClient) Update(ctx context.Context, resourceGroupName string, labName string, userName string, name string, serviceFabric ServiceFabricFragment) (result ServiceFabric, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, userName, name, serviceFabric) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServiceFabricsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, name string, serviceFabric ServiceFabricFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}", pathParameters), - autorest.WithJSON(serviceFabric), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceFabricsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ServiceFabricsClient) UpdateResponder(resp *http.Response) (result ServiceFabric, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/servicefabricschedules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/servicefabricschedules.go deleted file mode 100644 index e1518ddcf53f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/servicefabricschedules.go +++ /dev/null @@ -1,598 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServiceFabricSchedulesClient is the the DevTest Labs Client. -type ServiceFabricSchedulesClient struct { - BaseClient -} - -// NewServiceFabricSchedulesClient creates an instance of the ServiceFabricSchedulesClient client. -func NewServiceFabricSchedulesClient(subscriptionID string) ServiceFabricSchedulesClient { - return NewServiceFabricSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceFabricSchedulesClientWithBaseURI creates an instance of the ServiceFabricSchedulesClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewServiceFabricSchedulesClientWithBaseURI(baseURI string, subscriptionID string) ServiceFabricSchedulesClient { - return ServiceFabricSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing schedule. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// serviceFabricName - the name of the service fabric. -// name - the name of the schedule. -// schedule - a schedule. -func (client ServiceFabricSchedulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, userName string, serviceFabricName string, name string, schedule Schedule) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricSchedulesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: schedule, - Constraints: []validation.Constraint{{Target: "schedule.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("dtl.ServiceFabricSchedulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, userName, serviceFabricName, name, schedule) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServiceFabricSchedulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, serviceFabricName string, name string, schedule Schedule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceFabricName": autorest.Encode("path", serviceFabricName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}", pathParameters), - autorest.WithJSON(schedule), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceFabricSchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServiceFabricSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete schedule. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// serviceFabricName - the name of the service fabric. -// name - the name of the schedule. -func (client ServiceFabricSchedulesClient) Delete(ctx context.Context, resourceGroupName string, labName string, userName string, serviceFabricName string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricSchedulesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, userName, serviceFabricName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServiceFabricSchedulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, serviceFabricName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceFabricName": autorest.Encode("path", serviceFabricName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceFabricSchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServiceFabricSchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Execute execute a schedule. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// serviceFabricName - the name of the service fabric. -// name - the name of the schedule. -func (client ServiceFabricSchedulesClient) Execute(ctx context.Context, resourceGroupName string, labName string, userName string, serviceFabricName string, name string) (result ServiceFabricSchedulesExecuteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricSchedulesClient.Execute") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ExecutePreparer(ctx, resourceGroupName, labName, userName, serviceFabricName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "Execute", nil, "Failure preparing request") - return - } - - result, err = client.ExecuteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "Execute", result.Response(), "Failure sending request") - return - } - - return -} - -// ExecutePreparer prepares the Execute request. -func (client ServiceFabricSchedulesClient) ExecutePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, serviceFabricName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceFabricName": autorest.Encode("path", serviceFabricName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExecuteSender sends the Execute request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceFabricSchedulesClient) ExecuteSender(req *http.Request) (future ServiceFabricSchedulesExecuteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ExecuteResponder handles the response to the Execute request. The method always -// closes the http.Response Body. -func (client ServiceFabricSchedulesClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get schedule. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// serviceFabricName - the name of the service fabric. -// name - the name of the schedule. -// expand - specify the $expand query. Example: 'properties($select=status)' -func (client ServiceFabricSchedulesClient) Get(ctx context.Context, resourceGroupName string, labName string, userName string, serviceFabricName string, name string, expand string) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricSchedulesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, userName, serviceFabricName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServiceFabricSchedulesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, serviceFabricName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceFabricName": autorest.Encode("path", serviceFabricName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceFabricSchedulesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServiceFabricSchedulesClient) GetResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list schedules in a given service fabric. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// serviceFabricName - the name of the service fabric. -// expand - specify the $expand query. Example: 'properties($select=status)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client ServiceFabricSchedulesClient) List(ctx context.Context, resourceGroupName string, labName string, userName string, serviceFabricName string, expand string, filter string, top *int32, orderby string) (result ScheduleListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricSchedulesClient.List") - defer func() { - sc := -1 - if result.sl.Response.Response != nil { - sc = result.sl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, userName, serviceFabricName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "List", resp, "Failure sending request") - return - } - - result.sl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "List", resp, "Failure responding to request") - return - } - if result.sl.hasNextLink() && result.sl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServiceFabricSchedulesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, userName string, serviceFabricName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceFabricName": autorest.Encode("path", serviceFabricName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceFabricSchedulesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServiceFabricSchedulesClient) ListResponder(resp *http.Response) (result ScheduleList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ServiceFabricSchedulesClient) listNextResults(ctx context.Context, lastResults ScheduleList) (result ScheduleList, err error) { - req, err := lastResults.scheduleListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServiceFabricSchedulesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, userName string, serviceFabricName string, expand string, filter string, top *int32, orderby string) (result ScheduleListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricSchedulesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, userName, serviceFabricName, expand, filter, top, orderby) - return -} - -// Update allows modifying tags of schedules. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// userName - the name of the user profile. -// serviceFabricName - the name of the service fabric. -// name - the name of the schedule. -// schedule - a schedule. -func (client ServiceFabricSchedulesClient) Update(ctx context.Context, resourceGroupName string, labName string, userName string, serviceFabricName string, name string, schedule ScheduleFragment) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceFabricSchedulesClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, userName, serviceFabricName, name, schedule) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceFabricSchedulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServiceFabricSchedulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, userName string, serviceFabricName string, name string, schedule ScheduleFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceFabricName": autorest.Encode("path", serviceFabricName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}", pathParameters), - autorest.WithJSON(schedule), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceFabricSchedulesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ServiceFabricSchedulesClient) UpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/servicerunners.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/servicerunners.go deleted file mode 100644 index 42c5a344f7d5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/servicerunners.go +++ /dev/null @@ -1,267 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServiceRunnersClient is the the DevTest Labs Client. -type ServiceRunnersClient struct { - BaseClient -} - -// NewServiceRunnersClient creates an instance of the ServiceRunnersClient client. -func NewServiceRunnersClient(subscriptionID string) ServiceRunnersClient { - return NewServiceRunnersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceRunnersClientWithBaseURI creates an instance of the ServiceRunnersClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewServiceRunnersClientWithBaseURI(baseURI string, subscriptionID string) ServiceRunnersClient { - return ServiceRunnersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing service runner. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the service runner. -// serviceRunner - a container for a managed identity to execute DevTest lab services. -func (client ServiceRunnersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, serviceRunner ServiceRunner) (result ServiceRunner, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRunnersClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, serviceRunner) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServiceRunnersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, serviceRunner ServiceRunner) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}", pathParameters), - autorest.WithJSON(serviceRunner), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceRunnersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServiceRunnersClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceRunner, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete service runner. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the service runner. -func (client ServiceRunnersClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRunnersClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServiceRunnersClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceRunnersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServiceRunnersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get service runner. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the service runner. -func (client ServiceRunnersClient) Get(ctx context.Context, resourceGroupName string, labName string, name string) (result ServiceRunner, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRunnersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.ServiceRunnersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServiceRunnersClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceRunnersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServiceRunnersClient) GetResponder(resp *http.Response) (result ServiceRunner, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/users.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/users.go deleted file mode 100644 index fd8d7c84d751..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/users.go +++ /dev/null @@ -1,492 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// UsersClient is the the DevTest Labs Client. -type UsersClient struct { - BaseClient -} - -// NewUsersClient creates an instance of the UsersClient client. -func NewUsersClient(subscriptionID string) UsersClient { - return NewUsersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsersClientWithBaseURI creates an instance of the UsersClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewUsersClientWithBaseURI(baseURI string, subscriptionID string) UsersClient { - return UsersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing user profile. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the user profile. -// userParameter - profile of a lab user. -func (client UsersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, userParameter User) (result UsersCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, userParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.UsersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.UsersClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client UsersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, userParameter User) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), - autorest.WithJSON(userParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) CreateOrUpdateSender(req *http.Request) (future UsersCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client UsersClient) CreateOrUpdateResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete user profile. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the user profile. -func (client UsersClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result UsersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client UsersClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) DeleteSender(req *http.Request) (future UsersDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client UsersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get user profile. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the user profile. -// expand - specify the $expand query. Example: 'properties($select=identity)' -func (client UsersClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result User, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client UsersClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client UsersClient) GetResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list user profiles in a given lab. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// expand - specify the $expand query. Example: 'properties($select=identity)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client UsersClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result UserListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.List") - defer func() { - sc := -1 - if result.ul.Response.Response != nil { - sc = result.ul.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.UsersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.ul.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.UsersClient", "List", resp, "Failure sending request") - return - } - - result.ul, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.UsersClient", "List", resp, "Failure responding to request") - return - } - if result.ul.hasNextLink() && result.ul.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UsersClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UsersClient) ListResponder(resp *http.Response) (result UserList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client UsersClient) listNextResults(ctx context.Context, lastResults UserList) (result UserList, err error) { - req, err := lastResults.userListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.UsersClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.UsersClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.UsersClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client UsersClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result UserListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) - return -} - -// Update allows modifying tags of user profiles. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the user profile. -// userParameter - profile of a lab user. -func (client UsersClient) Update(ctx context.Context, resourceGroupName string, labName string, name string, userParameter UserFragment) (result User, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, name, userParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.UsersClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client UsersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, userParameter UserFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), - autorest.WithJSON(userParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client UsersClient) UpdateResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/version.go deleted file mode 100644 index a5acdc3a3439..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package dtl - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " dtl/2018-09-15" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/virtualmachines.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/virtualmachines.go deleted file mode 100644 index 392875b9f637..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/virtualmachines.go +++ /dev/null @@ -1,1559 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VirtualMachinesClient is the the DevTest Labs Client. -type VirtualMachinesClient struct { - BaseClient -} - -// NewVirtualMachinesClient creates an instance of the VirtualMachinesClient client. -func NewVirtualMachinesClient(subscriptionID string) VirtualMachinesClient { - return NewVirtualMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualMachinesClientWithBaseURI creates an instance of the VirtualMachinesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachinesClient { - return VirtualMachinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// AddDataDisk attach a new or existing data disk to virtual machine. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -// dataDiskProperties - request body for adding a new or existing data disk to a virtual machine. -func (client VirtualMachinesClient) AddDataDisk(ctx context.Context, resourceGroupName string, labName string, name string, dataDiskProperties DataDiskProperties) (result VirtualMachinesAddDataDiskFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.AddDataDisk") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.AddDataDiskPreparer(ctx, resourceGroupName, labName, name, dataDiskProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "AddDataDisk", nil, "Failure preparing request") - return - } - - result, err = client.AddDataDiskSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "AddDataDisk", result.Response(), "Failure sending request") - return - } - - return -} - -// AddDataDiskPreparer prepares the AddDataDisk request. -func (client VirtualMachinesClient) AddDataDiskPreparer(ctx context.Context, resourceGroupName string, labName string, name string, dataDiskProperties DataDiskProperties) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk", pathParameters), - autorest.WithJSON(dataDiskProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AddDataDiskSender sends the AddDataDisk request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) AddDataDiskSender(req *http.Request) (future VirtualMachinesAddDataDiskFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// AddDataDiskResponder handles the response to the AddDataDisk request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) AddDataDiskResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ApplyArtifacts apply artifacts to virtual machine. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -// applyArtifactsRequest - request body for applying artifacts to a virtual machine. -func (client VirtualMachinesClient) ApplyArtifacts(ctx context.Context, resourceGroupName string, labName string, name string, applyArtifactsRequest ApplyArtifactsRequest) (result VirtualMachinesApplyArtifactsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.ApplyArtifacts") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ApplyArtifactsPreparer(ctx, resourceGroupName, labName, name, applyArtifactsRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "ApplyArtifacts", nil, "Failure preparing request") - return - } - - result, err = client.ApplyArtifactsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "ApplyArtifacts", result.Response(), "Failure sending request") - return - } - - return -} - -// ApplyArtifactsPreparer prepares the ApplyArtifacts request. -func (client VirtualMachinesClient) ApplyArtifactsPreparer(ctx context.Context, resourceGroupName string, labName string, name string, applyArtifactsRequest ApplyArtifactsRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts", pathParameters), - autorest.WithJSON(applyArtifactsRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ApplyArtifactsSender sends the ApplyArtifacts request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) ApplyArtifactsSender(req *http.Request) (future VirtualMachinesApplyArtifactsFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ApplyArtifactsResponder handles the response to the ApplyArtifacts request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) ApplyArtifactsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Claim take ownership of an existing virtual machine This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -func (client VirtualMachinesClient) Claim(ctx context.Context, resourceGroupName string, labName string, name string) (result VirtualMachinesClaimFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Claim") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ClaimPreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Claim", nil, "Failure preparing request") - return - } - - result, err = client.ClaimSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Claim", result.Response(), "Failure sending request") - return - } - - return -} - -// ClaimPreparer prepares the Claim request. -func (client VirtualMachinesClient) ClaimPreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ClaimSender sends the Claim request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) ClaimSender(req *http.Request) (future VirtualMachinesClaimFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ClaimResponder handles the response to the Claim request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) ClaimResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate create or replace an existing virtual machine. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -// labVirtualMachine - a virtual machine. -func (client VirtualMachinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachine) (result VirtualMachinesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: labVirtualMachine, - Constraints: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("dtl.VirtualMachinesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, labVirtualMachine) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualMachinesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachine) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), - autorest.WithJSON(labVirtualMachine), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachinesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response) (result LabVirtualMachine, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete virtual machine. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -func (client VirtualMachinesClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result VirtualMachinesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VirtualMachinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) DeleteSender(req *http.Request) (future VirtualMachinesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DetachDataDisk detach the specified disk from the virtual machine. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -// detachDataDiskProperties - request body for detaching data disk from a virtual machine. -func (client VirtualMachinesClient) DetachDataDisk(ctx context.Context, resourceGroupName string, labName string, name string, detachDataDiskProperties DetachDataDiskProperties) (result VirtualMachinesDetachDataDiskFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.DetachDataDisk") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DetachDataDiskPreparer(ctx, resourceGroupName, labName, name, detachDataDiskProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "DetachDataDisk", nil, "Failure preparing request") - return - } - - result, err = client.DetachDataDiskSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "DetachDataDisk", result.Response(), "Failure sending request") - return - } - - return -} - -// DetachDataDiskPreparer prepares the DetachDataDisk request. -func (client VirtualMachinesClient) DetachDataDiskPreparer(ctx context.Context, resourceGroupName string, labName string, name string, detachDataDiskProperties DetachDataDiskProperties) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk", pathParameters), - autorest.WithJSON(detachDataDiskProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DetachDataDiskSender sends the DetachDataDisk request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) DetachDataDiskSender(req *http.Request) (future VirtualMachinesDetachDataDiskFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DetachDataDiskResponder handles the response to the DetachDataDisk request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) DetachDataDiskResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get virtual machine. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -// expand - specify the $expand query. Example: -// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' -func (client VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result LabVirtualMachine, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualMachinesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) GetResponder(resp *http.Response) (result LabVirtualMachine, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetRdpFileContents gets a string that represents the contents of the RDP file for the virtual machine -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -func (client VirtualMachinesClient) GetRdpFileContents(ctx context.Context, resourceGroupName string, labName string, name string) (result RdpConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.GetRdpFileContents") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetRdpFileContentsPreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "GetRdpFileContents", nil, "Failure preparing request") - return - } - - resp, err := client.GetRdpFileContentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "GetRdpFileContents", resp, "Failure sending request") - return - } - - result, err = client.GetRdpFileContentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "GetRdpFileContents", resp, "Failure responding to request") - return - } - - return -} - -// GetRdpFileContentsPreparer prepares the GetRdpFileContents request. -func (client VirtualMachinesClient) GetRdpFileContentsPreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/getRdpFileContents", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetRdpFileContentsSender sends the GetRdpFileContents request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) GetRdpFileContentsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetRdpFileContentsResponder handles the response to the GetRdpFileContents request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) GetRdpFileContentsResponder(resp *http.Response) (result RdpConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list virtual machines in a given lab. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// expand - specify the $expand query. Example: -// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client VirtualMachinesClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result LabVirtualMachineListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.List") - defer func() { - sc := -1 - if result.lvml.Response.Response != nil { - sc = result.lvml.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.lvml.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "List", resp, "Failure sending request") - return - } - - result.lvml, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "List", resp, "Failure responding to request") - return - } - if result.lvml.hasNextLink() && result.lvml.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualMachinesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) ListResponder(resp *http.Response) (result LabVirtualMachineList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client VirtualMachinesClient) listNextResults(ctx context.Context, lastResults LabVirtualMachineList) (result LabVirtualMachineList, err error) { - req, err := lastResults.labVirtualMachineListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualMachinesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result LabVirtualMachineListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) - return -} - -// ListApplicableSchedules lists the applicable start/stop schedules, if any. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -func (client VirtualMachinesClient) ListApplicableSchedules(ctx context.Context, resourceGroupName string, labName string, name string) (result ApplicableSchedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.ListApplicableSchedules") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListApplicableSchedulesPreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "ListApplicableSchedules", nil, "Failure preparing request") - return - } - - resp, err := client.ListApplicableSchedulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "ListApplicableSchedules", resp, "Failure sending request") - return - } - - result, err = client.ListApplicableSchedulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "ListApplicableSchedules", resp, "Failure responding to request") - return - } - - return -} - -// ListApplicableSchedulesPreparer prepares the ListApplicableSchedules request. -func (client VirtualMachinesClient) ListApplicableSchedulesPreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListApplicableSchedulesSender sends the ListApplicableSchedules request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) ListApplicableSchedulesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListApplicableSchedulesResponder handles the response to the ListApplicableSchedules request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) ListApplicableSchedulesResponder(resp *http.Response) (result ApplicableSchedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Redeploy redeploy a virtual machine This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -func (client VirtualMachinesClient) Redeploy(ctx context.Context, resourceGroupName string, labName string, name string) (result VirtualMachinesRedeployFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Redeploy") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RedeployPreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Redeploy", nil, "Failure preparing request") - return - } - - result, err = client.RedeploySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Redeploy", result.Response(), "Failure sending request") - return - } - - return -} - -// RedeployPreparer prepares the Redeploy request. -func (client VirtualMachinesClient) RedeployPreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/redeploy", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RedeploySender sends the Redeploy request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) RedeploySender(req *http.Request) (future VirtualMachinesRedeployFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RedeployResponder handles the response to the Redeploy request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) RedeployResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Resize resize Virtual Machine. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -// resizeLabVirtualMachineProperties - request body for resizing a virtual machine. -func (client VirtualMachinesClient) Resize(ctx context.Context, resourceGroupName string, labName string, name string, resizeLabVirtualMachineProperties ResizeLabVirtualMachineProperties) (result VirtualMachinesResizeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Resize") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ResizePreparer(ctx, resourceGroupName, labName, name, resizeLabVirtualMachineProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Resize", nil, "Failure preparing request") - return - } - - result, err = client.ResizeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Resize", result.Response(), "Failure sending request") - return - } - - return -} - -// ResizePreparer prepares the Resize request. -func (client VirtualMachinesClient) ResizePreparer(ctx context.Context, resourceGroupName string, labName string, name string, resizeLabVirtualMachineProperties ResizeLabVirtualMachineProperties) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/resize", pathParameters), - autorest.WithJSON(resizeLabVirtualMachineProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ResizeSender sends the Resize request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) ResizeSender(req *http.Request) (future VirtualMachinesResizeFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ResizeResponder handles the response to the Resize request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) ResizeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Restart restart a virtual machine. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -func (client VirtualMachinesClient) Restart(ctx context.Context, resourceGroupName string, labName string, name string) (result VirtualMachinesRestartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Restart") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RestartPreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Restart", nil, "Failure preparing request") - return - } - - result, err = client.RestartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Restart", result.Response(), "Failure sending request") - return - } - - return -} - -// RestartPreparer prepares the Restart request. -func (client VirtualMachinesClient) RestartPreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/restart", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RestartSender sends the Restart request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) RestartSender(req *http.Request) (future VirtualMachinesRestartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RestartResponder handles the response to the Restart request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Start start a virtual machine. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -func (client VirtualMachinesClient) Start(ctx context.Context, resourceGroupName string, labName string, name string) (result VirtualMachinesStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Start") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.StartPreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client VirtualMachinesClient) StartPreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) StartSender(req *http.Request) (future VirtualMachinesStartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stop a virtual machine This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -func (client VirtualMachinesClient) Stop(ctx context.Context, resourceGroupName string, labName string, name string) (result VirtualMachinesStopFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Stop") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.StopPreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = client.StopSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Stop", result.Response(), "Failure sending request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client VirtualMachinesClient) StopPreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) StopSender(req *http.Request) (future VirtualMachinesStopFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// TransferDisks transfers all data disks attached to the virtual machine to be owned by the current user. This -// operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -func (client VirtualMachinesClient) TransferDisks(ctx context.Context, resourceGroupName string, labName string, name string) (result VirtualMachinesTransferDisksFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.TransferDisks") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.TransferDisksPreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "TransferDisks", nil, "Failure preparing request") - return - } - - result, err = client.TransferDisksSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "TransferDisks", result.Response(), "Failure sending request") - return - } - - return -} - -// TransferDisksPreparer prepares the TransferDisks request. -func (client VirtualMachinesClient) TransferDisksPreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/transferDisks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// TransferDisksSender sends the TransferDisks request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) TransferDisksSender(req *http.Request) (future VirtualMachinesTransferDisksFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// TransferDisksResponder handles the response to the TransferDisks request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) TransferDisksResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// UnClaim release ownership of an existing virtual machine This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -func (client VirtualMachinesClient) UnClaim(ctx context.Context, resourceGroupName string, labName string, name string) (result VirtualMachinesUnClaimFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.UnClaim") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UnClaimPreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "UnClaim", nil, "Failure preparing request") - return - } - - result, err = client.UnClaimSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "UnClaim", result.Response(), "Failure sending request") - return - } - - return -} - -// UnClaimPreparer prepares the UnClaim request. -func (client VirtualMachinesClient) UnClaimPreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/unClaim", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UnClaimSender sends the UnClaim request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) UnClaimSender(req *http.Request) (future VirtualMachinesUnClaimFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UnClaimResponder handles the response to the UnClaim request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) UnClaimResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update allows modifying tags of virtual machines. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual machine. -// labVirtualMachine - a virtual machine. -func (client VirtualMachinesClient) Update(ctx context.Context, resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachineFragment) (result LabVirtualMachine, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachinesClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, name, labVirtualMachine) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachinesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VirtualMachinesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachineFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), - autorest.WithJSON(labVirtualMachine), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) UpdateResponder(resp *http.Response) (result LabVirtualMachine, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/virtualmachineschedules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/virtualmachineschedules.go deleted file mode 100644 index f2c2bd40de8d..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/virtualmachineschedules.go +++ /dev/null @@ -1,586 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VirtualMachineSchedulesClient is the the DevTest Labs Client. -type VirtualMachineSchedulesClient struct { - BaseClient -} - -// NewVirtualMachineSchedulesClient creates an instance of the VirtualMachineSchedulesClient client. -func NewVirtualMachineSchedulesClient(subscriptionID string) VirtualMachineSchedulesClient { - return NewVirtualMachineSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualMachineSchedulesClientWithBaseURI creates an instance of the VirtualMachineSchedulesClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewVirtualMachineSchedulesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSchedulesClient { - return VirtualMachineSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing schedule. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// virtualMachineName - the name of the virtual machine. -// name - the name of the schedule. -// schedule - a schedule. -func (client VirtualMachineSchedulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string, schedule Schedule) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineSchedulesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: schedule, - Constraints: []validation.Constraint{{Target: "schedule.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("dtl.VirtualMachineSchedulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, virtualMachineName, name, schedule) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualMachineSchedulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string, schedule Schedule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualMachineName": autorest.Encode("path", virtualMachineName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), - autorest.WithJSON(schedule), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineSchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualMachineSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete schedule. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// virtualMachineName - the name of the virtual machine. -// name - the name of the schedule. -func (client VirtualMachineSchedulesClient) Delete(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineSchedulesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, virtualMachineName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VirtualMachineSchedulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualMachineName": autorest.Encode("path", virtualMachineName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineSchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualMachineSchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Execute execute a schedule. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// virtualMachineName - the name of the virtual machine. -// name - the name of the schedule. -func (client VirtualMachineSchedulesClient) Execute(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string) (result VirtualMachineSchedulesExecuteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineSchedulesClient.Execute") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ExecutePreparer(ctx, resourceGroupName, labName, virtualMachineName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Execute", nil, "Failure preparing request") - return - } - - result, err = client.ExecuteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Execute", result.Response(), "Failure sending request") - return - } - - return -} - -// ExecutePreparer prepares the Execute request. -func (client VirtualMachineSchedulesClient) ExecutePreparer(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualMachineName": autorest.Encode("path", virtualMachineName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExecuteSender sends the Execute request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineSchedulesClient) ExecuteSender(req *http.Request) (future VirtualMachineSchedulesExecuteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ExecuteResponder handles the response to the Execute request. The method always -// closes the http.Response Body. -func (client VirtualMachineSchedulesClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get schedule. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// virtualMachineName - the name of the virtual machine. -// name - the name of the schedule. -// expand - specify the $expand query. Example: 'properties($select=status)' -func (client VirtualMachineSchedulesClient) Get(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string, expand string) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineSchedulesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, virtualMachineName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualMachineSchedulesClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualMachineName": autorest.Encode("path", virtualMachineName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineSchedulesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualMachineSchedulesClient) GetResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list schedules in a given virtual machine. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// virtualMachineName - the name of the virtual machine. -// expand - specify the $expand query. Example: 'properties($select=status)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client VirtualMachineSchedulesClient) List(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, expand string, filter string, top *int32, orderby string) (result ScheduleListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineSchedulesClient.List") - defer func() { - sc := -1 - if result.sl.Response.Response != nil { - sc = result.sl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, virtualMachineName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "List", resp, "Failure sending request") - return - } - - result.sl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "List", resp, "Failure responding to request") - return - } - if result.sl.hasNextLink() && result.sl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualMachineSchedulesClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualMachineName": autorest.Encode("path", virtualMachineName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineSchedulesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualMachineSchedulesClient) ListResponder(resp *http.Response) (result ScheduleList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client VirtualMachineSchedulesClient) listNextResults(ctx context.Context, lastResults ScheduleList) (result ScheduleList, err error) { - req, err := lastResults.scheduleListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualMachineSchedulesClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, expand string, filter string, top *int32, orderby string) (result ScheduleListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineSchedulesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, virtualMachineName, expand, filter, top, orderby) - return -} - -// Update allows modifying tags of schedules. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// virtualMachineName - the name of the virtual machine. -// name - the name of the schedule. -// schedule - a schedule. -func (client VirtualMachineSchedulesClient) Update(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string, schedule ScheduleFragment) (result Schedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineSchedulesClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, virtualMachineName, name, schedule) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualMachineSchedulesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VirtualMachineSchedulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, name string, schedule ScheduleFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualMachineName": autorest.Encode("path", virtualMachineName), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), - autorest.WithJSON(schedule), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineSchedulesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client VirtualMachineSchedulesClient) UpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/virtualnetworks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/virtualnetworks.go deleted file mode 100644 index 0d4fb39489ff..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl/virtualnetworks.go +++ /dev/null @@ -1,492 +0,0 @@ -package dtl - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VirtualNetworksClient is the the DevTest Labs Client. -type VirtualNetworksClient struct { - BaseClient -} - -// NewVirtualNetworksClient creates an instance of the VirtualNetworksClient client. -func NewVirtualNetworksClient(subscriptionID string) VirtualNetworksClient { - return NewVirtualNetworksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualNetworksClientWithBaseURI creates an instance of the VirtualNetworksClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworksClient { - return VirtualNetworksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing virtual network. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual network. -// virtualNetwork - a virtual network. -func (client VirtualNetworksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, name string, virtualNetwork VirtualNetwork) (result VirtualNetworksCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labName, name, virtualNetwork) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualNetworksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, virtualNetwork VirtualNetwork) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), - autorest.WithJSON(virtualNetwork), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworksCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetwork, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete virtual network. This operation can take a while to complete. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual network. -func (client VirtualNetworksClient) Delete(ctx context.Context, resourceGroupName string, labName string, name string) (result VirtualNetworksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VirtualNetworksClient) DeletePreparer(ctx context.Context, resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) DeleteSender(req *http.Request) (future VirtualNetworksDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get virtual network. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual network. -// expand - specify the $expand query. Example: 'properties($expand=externalSubnets)' -func (client VirtualNetworksClient) Get(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (result VirtualNetwork, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualNetworksClient) GetPreparer(ctx context.Context, resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) GetResponder(resp *http.Response) (result VirtualNetwork, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list virtual networks in a given lab. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// expand - specify the $expand query. Example: 'properties($expand=externalSubnets)' -// filter - the filter to apply to the operation. Example: '$filter=contains(name,'myName') -// top - the maximum number of resources to return from the operation. Example: '$top=10' -// orderby - the ordering expression for the results, using OData notation. Example: '$orderby=name desc' -func (client VirtualNetworksClient) List(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result VirtualNetworkListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.List") - defer func() { - sc := -1 - if result.vnl.Response.Response != nil { - sc = result.vnl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.vnl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "List", resp, "Failure sending request") - return - } - - result.vnl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "List", resp, "Failure responding to request") - return - } - if result.vnl.hasNextLink() && result.vnl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualNetworksClient) ListPreparer(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) ListResponder(resp *http.Response) (result VirtualNetworkList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client VirtualNetworksClient) listNextResults(ctx context.Context, lastResults VirtualNetworkList) (result VirtualNetworkList, err error) { - req, err := lastResults.virtualNetworkListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualNetworksClient) ListComplete(ctx context.Context, resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result VirtualNetworkListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, labName, expand, filter, top, orderby) - return -} - -// Update allows modifying tags of virtual networks. All other properties will be ignored. -// Parameters: -// resourceGroupName - the name of the resource group. -// labName - the name of the lab. -// name - the name of the virtual network. -// virtualNetwork - a virtual network. -func (client VirtualNetworksClient) Update(ctx context.Context, resourceGroupName string, labName string, name string, virtualNetwork VirtualNetworkFragment) (result VirtualNetwork, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, labName, name, virtualNetwork) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dtl.VirtualNetworksClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VirtualNetworksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labName string, name string, virtualNetwork VirtualNetworkFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), - autorest.WithJSON(virtualNetwork), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) UpdateResponder(resp *http.Response) (result VirtualNetwork, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/_meta.json deleted file mode 100644 index 45dba55c3365..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "d9506558e6389e62926ae385f1d625a1376a0f9d", - "readme": "/_/azure-rest-api-specs/specification/digitaltwins/resource-manager/readme.md", - "tag": "package-2020-12", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-12 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/digitaltwins/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/client.go deleted file mode 100644 index 8e89f0714ad8..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/digitaltwins/armdigitaltwins](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/digitaltwins/armdigitaltwins). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package digitaltwins implements the Azure ARM Digitaltwins service API version 2020-12-01. -// -// Azure Digital Twins Client for managing DigitalTwinsInstance -package digitaltwins - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Digitaltwins - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Digitaltwins. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/digitaltwins.go b/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/digitaltwins.go deleted file mode 100644 index 44bf98dbc19c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/digitaltwins.go +++ /dev/null @@ -1,716 +0,0 @@ -package digitaltwins - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// Client is the azure Digital Twins Client for managing DigitalTwinsInstance -type Client struct { - BaseClient -} - -// NewClient creates an instance of the Client client. -func NewClient(subscriptionID string) Client { - return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting -// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { - return Client{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability check if a DigitalTwinsInstance name is available. -// Parameters: -// location - location of DigitalTwinsInstance. -// digitalTwinsInstanceCheckName - set the name parameter in the DigitalTwinsInstanceCheckName structure to the -// name of the DigitalTwinsInstance to check. -func (client Client) CheckNameAvailability(ctx context.Context, location string, digitalTwinsInstanceCheckName CheckNameRequest) (result CheckNameResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: location, - Constraints: []validation.Constraint{{Target: "location", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: digitalTwinsInstanceCheckName, - Constraints: []validation.Constraint{{Target: "digitalTwinsInstanceCheckName.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "digitalTwinsInstanceCheckName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.Client", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, location, digitalTwinsInstanceCheckName) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client Client) CheckNameAvailabilityPreparer(ctx context.Context, location string, digitalTwinsInstanceCheckName CheckNameRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/locations/{location}/checkNameAvailability", pathParameters), - autorest.WithJSON(digitalTwinsInstanceCheckName), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client Client) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to -// retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new -// body to update the DigitalTwinsInstance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. -// resourceName - the name of the DigitalTwinsInstance. -// digitalTwinsCreate - the DigitalTwinsInstance and security metadata. -func (client Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, digitalTwinsCreate Description) (result CreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.Client", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, digitalTwinsCreate) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client Client) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, digitalTwinsCreate Description) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}", pathParameters), - autorest.WithJSON(digitalTwinsCreate), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CreateOrUpdateSender(req *http.Request) (future CreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client Client) CreateOrUpdateResponder(resp *http.Response) (result Description, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a DigitalTwinsInstance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. -// resourceName - the name of the DigitalTwinsInstance. -func (client Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result DeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.Client", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client Client) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client Client) DeleteSender(req *http.Request) (future DeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client Client) DeleteResponder(resp *http.Response) (result Description, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get DigitalTwinsInstances resource. -// Parameters: -// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. -// resourceName - the name of the DigitalTwinsInstance. -func (client Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Description, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.Client", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client Client) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client Client) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client Client) GetResponder(resp *http.Response) (result Description, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all the DigitalTwinsInstances in a subscription. -func (client Client) List(ctx context.Context) (result DescriptionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "List", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "List", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client Client) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/digitalTwinsInstances", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client Client) ListResponder(resp *http.Response) (result DescriptionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client Client) listNextResults(ctx context.Context, lastResults DescriptionListResult) (result DescriptionListResult, err error) { - req, err := lastResults.descriptionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "digitaltwins.Client", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "digitaltwins.Client", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client Client) ListComplete(ctx context.Context) (result DescriptionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup get all the DigitalTwinsInstances in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. -func (client Client) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DescriptionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.Client", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client Client) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client Client) ListByResourceGroupResponder(resp *http.Response) (result DescriptionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client Client) listByResourceGroupNextResults(ctx context.Context, lastResults DescriptionListResult) (result DescriptionListResult, err error) { - req, err := lastResults.descriptionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "digitaltwins.Client", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "digitaltwins.Client", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client Client) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DescriptionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// Update update metadata of DigitalTwinsInstance. -// Parameters: -// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. -// resourceName - the name of the DigitalTwinsInstance. -// digitalTwinsPatchDescription - the DigitalTwinsInstance and security metadata. -func (client Client) Update(ctx context.Context, resourceGroupName string, resourceName string, digitalTwinsPatchDescription PatchDescription) (result UpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.Client", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, digitalTwinsPatchDescription) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.Client", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client Client) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, digitalTwinsPatchDescription PatchDescription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}", pathParameters), - autorest.WithJSON(digitalTwinsPatchDescription), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client Client) UpdateSender(req *http.Request) (future UpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client Client) UpdateResponder(resp *http.Response) (result Description, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/endpoint.go b/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/endpoint.go deleted file mode 100644 index 849ef84614a3..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/endpoint.go +++ /dev/null @@ -1,442 +0,0 @@ -package digitaltwins - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// EndpointClient is the azure Digital Twins Client for managing DigitalTwinsInstance -type EndpointClient struct { - BaseClient -} - -// NewEndpointClient creates an instance of the EndpointClient client. -func NewEndpointClient(subscriptionID string) EndpointClient { - return NewEndpointClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEndpointClientWithBaseURI creates an instance of the EndpointClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewEndpointClientWithBaseURI(baseURI string, subscriptionID string) EndpointClient { - return EndpointClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update DigitalTwinsInstance endpoint. -// Parameters: -// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. -// resourceName - the name of the DigitalTwinsInstance. -// endpointName - name of Endpoint Resource. -// endpointDescription - the DigitalTwinsInstance endpoint metadata and security metadata. -func (client EndpointClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, endpointName string, endpointDescription EndpointResource) (result EndpointCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EndpointClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: endpointName, - Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.MaxLength, Rule: 49, Chain: nil}, - {Target: "endpointName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.EndpointClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, endpointName, endpointDescription) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EndpointClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, endpointName string, endpointDescription EndpointResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}", pathParameters), - autorest.WithJSON(endpointDescription), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointClient) CreateOrUpdateSender(req *http.Request) (future EndpointCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client EndpointClient) CreateOrUpdateResponder(resp *http.Response) (result EndpointResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a DigitalTwinsInstance endpoint. -// Parameters: -// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. -// resourceName - the name of the DigitalTwinsInstance. -// endpointName - name of Endpoint Resource. -func (client EndpointClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, endpointName string) (result EndpointDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EndpointClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: endpointName, - Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.MaxLength, Rule: 49, Chain: nil}, - {Target: "endpointName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.EndpointClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, endpointName) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EndpointClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, endpointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointClient) DeleteSender(req *http.Request) (future EndpointDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client EndpointClient) DeleteResponder(resp *http.Response) (result EndpointResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get DigitalTwinsInstances Endpoint. -// Parameters: -// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. -// resourceName - the name of the DigitalTwinsInstance. -// endpointName - name of Endpoint Resource. -func (client EndpointClient) Get(ctx context.Context, resourceGroupName string, resourceName string, endpointName string) (result EndpointResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EndpointClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: endpointName, - Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.MaxLength, Rule: 49, Chain: nil}, - {Target: "endpointName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.EndpointClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, endpointName) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client EndpointClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, endpointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client EndpointClient) GetResponder(resp *http.Response) (result EndpointResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get DigitalTwinsInstance Endpoints. -// Parameters: -// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. -// resourceName - the name of the DigitalTwinsInstance. -func (client EndpointClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result EndpointResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EndpointClient.List") - defer func() { - sc := -1 - if result.erlr.Response.Response != nil { - sc = result.erlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.EndpointClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.erlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "List", resp, "Failure sending request") - return - } - - result.erlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "List", resp, "Failure responding to request") - return - } - if result.erlr.hasNextLink() && result.erlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client EndpointClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client EndpointClient) ListResponder(resp *http.Response) (result EndpointResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client EndpointClient) listNextResults(ctx context.Context, lastResults EndpointResourceListResult) (result EndpointResourceListResult, err error) { - req, err := lastResults.endpointResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client EndpointClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result EndpointResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EndpointClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, resourceName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/enums.go deleted file mode 100644 index 03dca5ae1ea4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/enums.go +++ /dev/null @@ -1,190 +0,0 @@ -package digitaltwins - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AuthenticationType enumerates the values for authentication type. -type AuthenticationType string - -const ( - // IdentityBased ... - IdentityBased AuthenticationType = "IdentityBased" - // KeyBased ... - KeyBased AuthenticationType = "KeyBased" -) - -// PossibleAuthenticationTypeValues returns an array of possible values for the AuthenticationType const type. -func PossibleAuthenticationTypeValues() []AuthenticationType { - return []AuthenticationType{IdentityBased, KeyBased} -} - -// ConnectionPropertiesProvisioningState enumerates the values for connection properties provisioning state. -type ConnectionPropertiesProvisioningState string - -const ( - // Approved ... - Approved ConnectionPropertiesProvisioningState = "Approved" - // Disconnected ... - Disconnected ConnectionPropertiesProvisioningState = "Disconnected" - // Pending ... - Pending ConnectionPropertiesProvisioningState = "Pending" - // Rejected ... - Rejected ConnectionPropertiesProvisioningState = "Rejected" -) - -// PossibleConnectionPropertiesProvisioningStateValues returns an array of possible values for the ConnectionPropertiesProvisioningState const type. -func PossibleConnectionPropertiesProvisioningStateValues() []ConnectionPropertiesProvisioningState { - return []ConnectionPropertiesProvisioningState{Approved, Disconnected, Pending, Rejected} -} - -// EndpointProvisioningState enumerates the values for endpoint provisioning state. -type EndpointProvisioningState string - -const ( - // Canceled ... - Canceled EndpointProvisioningState = "Canceled" - // Deleted ... - Deleted EndpointProvisioningState = "Deleted" - // Deleting ... - Deleting EndpointProvisioningState = "Deleting" - // Disabled ... - Disabled EndpointProvisioningState = "Disabled" - // Failed ... - Failed EndpointProvisioningState = "Failed" - // Moving ... - Moving EndpointProvisioningState = "Moving" - // Provisioning ... - Provisioning EndpointProvisioningState = "Provisioning" - // Restoring ... - Restoring EndpointProvisioningState = "Restoring" - // Succeeded ... - Succeeded EndpointProvisioningState = "Succeeded" - // Suspending ... - Suspending EndpointProvisioningState = "Suspending" - // Warning ... - Warning EndpointProvisioningState = "Warning" -) - -// PossibleEndpointProvisioningStateValues returns an array of possible values for the EndpointProvisioningState const type. -func PossibleEndpointProvisioningStateValues() []EndpointProvisioningState { - return []EndpointProvisioningState{Canceled, Deleted, Deleting, Disabled, Failed, Moving, Provisioning, Restoring, Succeeded, Suspending, Warning} -} - -// EndpointType enumerates the values for endpoint type. -type EndpointType string - -const ( - // EndpointTypeDigitalTwinsEndpointResourceProperties ... - EndpointTypeDigitalTwinsEndpointResourceProperties EndpointType = "DigitalTwinsEndpointResourceProperties" - // EndpointTypeEventGrid ... - EndpointTypeEventGrid EndpointType = "EventGrid" - // EndpointTypeEventHub ... - EndpointTypeEventHub EndpointType = "EventHub" - // EndpointTypeServiceBus ... - EndpointTypeServiceBus EndpointType = "ServiceBus" -) - -// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. -func PossibleEndpointTypeValues() []EndpointType { - return []EndpointType{EndpointTypeDigitalTwinsEndpointResourceProperties, EndpointTypeEventGrid, EndpointTypeEventHub, EndpointTypeServiceBus} -} - -// IdentityType enumerates the values for identity type. -type IdentityType string - -const ( - // None ... - None IdentityType = "None" - // SystemAssigned ... - SystemAssigned IdentityType = "SystemAssigned" -) - -// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. -func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{None, SystemAssigned} -} - -// PrivateLinkServiceConnectionStatus enumerates the values for private link service connection status. -type PrivateLinkServiceConnectionStatus string - -const ( - // PrivateLinkServiceConnectionStatusApproved ... - PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" - // PrivateLinkServiceConnectionStatusDisconnected ... - PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" - // PrivateLinkServiceConnectionStatusPending ... - PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" - // PrivateLinkServiceConnectionStatusRejected ... - PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" -) - -// PossiblePrivateLinkServiceConnectionStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStatus const type. -func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConnectionStatus { - return []PrivateLinkServiceConnectionStatus{PrivateLinkServiceConnectionStatusApproved, PrivateLinkServiceConnectionStatusDisconnected, PrivateLinkServiceConnectionStatusPending, PrivateLinkServiceConnectionStatusRejected} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCanceled ... - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateDeleted ... - ProvisioningStateDeleted ProvisioningState = "Deleted" - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateMoving ... - ProvisioningStateMoving ProvisioningState = "Moving" - // ProvisioningStateProvisioning ... - ProvisioningStateProvisioning ProvisioningState = "Provisioning" - // ProvisioningStateRestoring ... - ProvisioningStateRestoring ProvisioningState = "Restoring" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateSuspending ... - ProvisioningStateSuspending ProvisioningState = "Suspending" - // ProvisioningStateUpdating ... - ProvisioningStateUpdating ProvisioningState = "Updating" - // ProvisioningStateWarning ... - ProvisioningStateWarning ProvisioningState = "Warning" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoving, ProvisioningStateProvisioning, ProvisioningStateRestoring, ProvisioningStateSucceeded, ProvisioningStateSuspending, ProvisioningStateUpdating, ProvisioningStateWarning} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // PublicNetworkAccessDisabled ... - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - // PublicNetworkAccessEnabled ... - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} -} - -// Reason enumerates the values for reason. -type Reason string - -const ( - // AlreadyExists ... - AlreadyExists Reason = "AlreadyExists" - // Invalid ... - Invalid Reason = "Invalid" -) - -// PossibleReasonValues returns an array of possible values for the Reason const type. -func PossibleReasonValues() []Reason { - return []Reason{AlreadyExists, Invalid} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/models.go deleted file mode 100644 index 7a9d2d0a62f1..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/models.go +++ /dev/null @@ -1,1711 +0,0 @@ -package digitaltwins - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins" - -// CheckNameRequest the result returned from a database check name availability request. -type CheckNameRequest struct { - // Name - Resource name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, for instance Microsoft.DigitalTwins/digitalTwinsInstances. - Type *string `json:"type,omitempty"` -} - -// CheckNameResult the result returned from a check name availability request. -type CheckNameResult struct { - autorest.Response `json:"-"` - // NameAvailable - Specifies a Boolean value that indicates if the name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Message - Message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated. - Message *string `json:"message,omitempty"` - // Reason - Message providing the reason why the given name is invalid. Possible values include: 'Invalid', 'AlreadyExists' - Reason Reason `json:"reason,omitempty"` -} - -// ConnectionProperties the properties of a private endpoint connection. -type ConnectionProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected' - ProvisioningState ConnectionPropertiesProvisioningState `json:"provisioningState,omitempty"` - PrivateEndpoint *ConnectionPropertiesPrivateEndpoint `json:"privateEndpoint,omitempty"` - // GroupIds - The list of group ids for the private endpoint connection. - GroupIds *[]string `json:"groupIds,omitempty"` - PrivateLinkServiceConnectionState *ConnectionPropertiesPrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionProperties. -func (cp ConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = cp.PrivateEndpoint - } - if cp.GroupIds != nil { - objectMap["groupIds"] = cp.GroupIds - } - if cp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = cp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// ConnectionPropertiesPrivateEndpoint ... -type ConnectionPropertiesPrivateEndpoint struct { - // ID - READ-ONLY; The resource identifier. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionPropertiesPrivateEndpoint. -func (cpE ConnectionPropertiesPrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConnectionPropertiesPrivateLinkServiceConnectionState ... -type ConnectionPropertiesPrivateLinkServiceConnectionState struct { - // Status - The status of a private endpoint connection. Possible values include: 'PrivateLinkServiceConnectionStatusPending', 'PrivateLinkServiceConnectionStatusApproved', 'PrivateLinkServiceConnectionStatusRejected', 'PrivateLinkServiceConnectionStatusDisconnected' - Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"` - // Description - The description for the current state of a private endpoint connection. - Description *string `json:"description,omitempty"` - // ActionsRequired - Actions required for a private endpoint connection. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// ConnectionState the current state of a private endpoint connection. -type ConnectionState struct { - // Status - The status of a private endpoint connection. Possible values include: 'PrivateLinkServiceConnectionStatusPending', 'PrivateLinkServiceConnectionStatusApproved', 'PrivateLinkServiceConnectionStatusRejected', 'PrivateLinkServiceConnectionStatusDisconnected' - Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"` - // Description - The description for the current state of a private endpoint connection. - Description *string `json:"description,omitempty"` - // ActionsRequired - Actions required for a private endpoint connection. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type CreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (Description, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CreateOrUpdateFuture.Result. -func (future *CreateOrUpdateFuture) result(client Client) (d Description, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.CreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("digitaltwins.CreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.CreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type DeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (Description, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeleteFuture.Result. -func (future *DeleteFuture) result(client Client) (d Description, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.DeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("digitaltwins.DeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.DeleteResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.DeleteFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// Description the description of the DigitalTwins service. -type Description struct { - autorest.Response `json:"-"` - // Properties - DigitalTwins instance properties. - *Properties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` - // Identity - The managed identity for the DigitalTwinsInstance. - Identity *Identity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for Description. -func (d Description) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.Properties != nil { - objectMap["properties"] = d.Properties - } - if d.Location != nil { - objectMap["location"] = d.Location - } - if d.Tags != nil { - objectMap["tags"] = d.Tags - } - if d.Identity != nil { - objectMap["identity"] = d.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Description struct. -func (d *Description) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var properties Properties - err = json.Unmarshal(*v, &properties) - if err != nil { - return err - } - d.Properties = &properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - d.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - d.Tags = tags - } - case "identity": - if v != nil { - var identity Identity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - d.Identity = &identity - } - } - } - - return nil -} - -// DescriptionListResult a list of DigitalTwins description objects with a next link. -type DescriptionListResult struct { - autorest.Response `json:"-"` - // NextLink - The link used to get the next page of DigitalTwins description objects. - NextLink *string `json:"nextLink,omitempty"` - // Value - A list of DigitalTwins description objects. - Value *[]Description `json:"value,omitempty"` -} - -// DescriptionListResultIterator provides access to a complete listing of Description values. -type DescriptionListResultIterator struct { - i int - page DescriptionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DescriptionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DescriptionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DescriptionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DescriptionListResultIterator) Response() DescriptionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DescriptionListResultIterator) Value() Description { - if !iter.page.NotDone() { - return Description{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DescriptionListResultIterator type. -func NewDescriptionListResultIterator(page DescriptionListResultPage) DescriptionListResultIterator { - return DescriptionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dlr DescriptionListResult) IsEmpty() bool { - return dlr.Value == nil || len(*dlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dlr DescriptionListResult) hasNextLink() bool { - return dlr.NextLink != nil && len(*dlr.NextLink) != 0 -} - -// descriptionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dlr DescriptionListResult) descriptionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dlr.NextLink))) -} - -// DescriptionListResultPage contains a page of Description values. -type DescriptionListResultPage struct { - fn func(context.Context, DescriptionListResult) (DescriptionListResult, error) - dlr DescriptionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DescriptionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DescriptionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dlr) - if err != nil { - return err - } - page.dlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DescriptionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DescriptionListResultPage) NotDone() bool { - return !page.dlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DescriptionListResultPage) Response() DescriptionListResult { - return page.dlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DescriptionListResultPage) Values() []Description { - if page.dlr.IsEmpty() { - return nil - } - return *page.dlr.Value -} - -// Creates a new instance of the DescriptionListResultPage type. -func NewDescriptionListResultPage(cur DescriptionListResult, getNextPage func(context.Context, DescriptionListResult) (DescriptionListResult, error)) DescriptionListResultPage { - return DescriptionListResultPage{ - fn: getNextPage, - dlr: cur, - } -} - -// EndpointCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type EndpointCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EndpointClient) (EndpointResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EndpointCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for EndpointCreateOrUpdateFuture.Result. -func (future *EndpointCreateOrUpdateFuture) result(client EndpointClient) (er EndpointResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.EndpointCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - er.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("digitaltwins.EndpointCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if er.Response.Response, err = future.GetResult(sender); err == nil && er.Response.Response.StatusCode != http.StatusNoContent { - er, err = client.CreateOrUpdateResponder(er.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.EndpointCreateOrUpdateFuture", "Result", er.Response.Response, "Failure responding to request") - } - } - return -} - -// EndpointDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type EndpointDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EndpointClient) (EndpointResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EndpointDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for EndpointDeleteFuture.Result. -func (future *EndpointDeleteFuture) result(client EndpointClient) (er EndpointResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.EndpointDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - er.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("digitaltwins.EndpointDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if er.Response.Response, err = future.GetResult(sender); err == nil && er.Response.Response.StatusCode != http.StatusNoContent { - er, err = client.DeleteResponder(er.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.EndpointDeleteFuture", "Result", er.Response.Response, "Failure responding to request") - } - } - return -} - -// EndpointResource digitalTwinsInstance endpoint resource. -type EndpointResource struct { - autorest.Response `json:"-"` - // Properties - DigitalTwinsInstance endpoint resource properties. - Properties BasicEndpointResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Extension resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EndpointResource. -func (er EndpointResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = er.Properties - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EndpointResource struct. -func (er *EndpointResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - properties, err := unmarshalBasicEndpointResourceProperties(*v) - if err != nil { - return err - } - er.Properties = properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - er.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - er.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - er.Type = &typeVar - } - } - } - - return nil -} - -// EndpointResourceListResult a list of DigitalTwinsInstance Endpoints with a next link. -type EndpointResourceListResult struct { - autorest.Response `json:"-"` - // NextLink - The link used to get the next page of DigitalTwinsInstance Endpoints. - NextLink *string `json:"nextLink,omitempty"` - // Value - A list of DigitalTwinsInstance Endpoints. - Value *[]EndpointResource `json:"value,omitempty"` -} - -// EndpointResourceListResultIterator provides access to a complete listing of EndpointResource values. -type EndpointResourceListResultIterator struct { - i int - page EndpointResourceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *EndpointResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EndpointResourceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *EndpointResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EndpointResourceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter EndpointResourceListResultIterator) Response() EndpointResourceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter EndpointResourceListResultIterator) Value() EndpointResource { - if !iter.page.NotDone() { - return EndpointResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EndpointResourceListResultIterator type. -func NewEndpointResourceListResultIterator(page EndpointResourceListResultPage) EndpointResourceListResultIterator { - return EndpointResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (erlr EndpointResourceListResult) IsEmpty() bool { - return erlr.Value == nil || len(*erlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (erlr EndpointResourceListResult) hasNextLink() bool { - return erlr.NextLink != nil && len(*erlr.NextLink) != 0 -} - -// endpointResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (erlr EndpointResourceListResult) endpointResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !erlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(erlr.NextLink))) -} - -// EndpointResourceListResultPage contains a page of EndpointResource values. -type EndpointResourceListResultPage struct { - fn func(context.Context, EndpointResourceListResult) (EndpointResourceListResult, error) - erlr EndpointResourceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *EndpointResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EndpointResourceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.erlr) - if err != nil { - return err - } - page.erlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *EndpointResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EndpointResourceListResultPage) NotDone() bool { - return !page.erlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EndpointResourceListResultPage) Response() EndpointResourceListResult { - return page.erlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EndpointResourceListResultPage) Values() []EndpointResource { - if page.erlr.IsEmpty() { - return nil - } - return *page.erlr.Value -} - -// Creates a new instance of the EndpointResourceListResultPage type. -func NewEndpointResourceListResultPage(cur EndpointResourceListResult, getNextPage func(context.Context, EndpointResourceListResult) (EndpointResourceListResult, error)) EndpointResourceListResultPage { - return EndpointResourceListResultPage{ - fn: getNextPage, - erlr: cur, - } -} - -// BasicEndpointResourceProperties properties related to Digital Twins Endpoint -type BasicEndpointResourceProperties interface { - AsServiceBus() (*ServiceBus, bool) - AsEventHub() (*EventHub, bool) - AsEventGrid() (*EventGrid, bool) - AsEndpointResourceProperties() (*EndpointResourceProperties, bool) -} - -// EndpointResourceProperties properties related to Digital Twins Endpoint -type EndpointResourceProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' - ProvisioningState EndpointProvisioningState `json:"provisioningState,omitempty"` - // CreatedTime - READ-ONLY; Time when the Endpoint was added to DigitalTwinsInstance. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // AuthenticationType - Specifies the authentication type being used for connecting to the endpoint. Possible values include: 'KeyBased', 'IdentityBased' - AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` - // DeadLetterSecret - Dead letter storage secret for key-based authentication. Will be obfuscated during read. - DeadLetterSecret *string `json:"deadLetterSecret,omitempty"` - // DeadLetterURI - Dead letter storage URL for identity-based authentication. - DeadLetterURI *string `json:"deadLetterUri,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeDigitalTwinsEndpointResourceProperties', 'EndpointTypeServiceBus', 'EndpointTypeEventHub', 'EndpointTypeEventGrid' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -func unmarshalBasicEndpointResourceProperties(body []byte) (BasicEndpointResourceProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["endpointType"] { - case string(EndpointTypeServiceBus): - var sb ServiceBus - err := json.Unmarshal(body, &sb) - return sb, err - case string(EndpointTypeEventHub): - var eh EventHub - err := json.Unmarshal(body, &eh) - return eh, err - case string(EndpointTypeEventGrid): - var eg EventGrid - err := json.Unmarshal(body, &eg) - return eg, err - default: - var erp EndpointResourceProperties - err := json.Unmarshal(body, &erp) - return erp, err - } -} -func unmarshalBasicEndpointResourcePropertiesArray(body []byte) ([]BasicEndpointResourceProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - erpArray := make([]BasicEndpointResourceProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - erp, err := unmarshalBasicEndpointResourceProperties(*rawMessage) - if err != nil { - return nil, err - } - erpArray[index] = erp - } - return erpArray, nil -} - -// MarshalJSON is the custom marshaler for EndpointResourceProperties. -func (erp EndpointResourceProperties) MarshalJSON() ([]byte, error) { - erp.EndpointType = EndpointTypeDigitalTwinsEndpointResourceProperties - objectMap := make(map[string]interface{}) - if erp.AuthenticationType != "" { - objectMap["authenticationType"] = erp.AuthenticationType - } - if erp.DeadLetterSecret != nil { - objectMap["deadLetterSecret"] = erp.DeadLetterSecret - } - if erp.DeadLetterURI != nil { - objectMap["deadLetterUri"] = erp.DeadLetterURI - } - if erp.EndpointType != "" { - objectMap["endpointType"] = erp.EndpointType - } - return json.Marshal(objectMap) -} - -// AsServiceBus is the BasicEndpointResourceProperties implementation for EndpointResourceProperties. -func (erp EndpointResourceProperties) AsServiceBus() (*ServiceBus, bool) { - return nil, false -} - -// AsEventHub is the BasicEndpointResourceProperties implementation for EndpointResourceProperties. -func (erp EndpointResourceProperties) AsEventHub() (*EventHub, bool) { - return nil, false -} - -// AsEventGrid is the BasicEndpointResourceProperties implementation for EndpointResourceProperties. -func (erp EndpointResourceProperties) AsEventGrid() (*EventGrid, bool) { - return nil, false -} - -// AsEndpointResourceProperties is the BasicEndpointResourceProperties implementation for EndpointResourceProperties. -func (erp EndpointResourceProperties) AsEndpointResourceProperties() (*EndpointResourceProperties, bool) { - return &erp, true -} - -// AsBasicEndpointResourceProperties is the BasicEndpointResourceProperties implementation for EndpointResourceProperties. -func (erp EndpointResourceProperties) AsBasicEndpointResourceProperties() (BasicEndpointResourceProperties, bool) { - return &erp, true -} - -// ErrorDefinition error definition. -type ErrorDefinition struct { - // Code - READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; Description of the error. - Message *string `json:"message,omitempty"` - // Details - READ-ONLY; Internal error details. - Details *[]ErrorDefinition `json:"details,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorDefinition. -func (ed ErrorDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse error response. -type ErrorResponse struct { - // Error - Error description - Error *ErrorDefinition `json:"error,omitempty"` -} - -// EventGrid properties related to EventGrid. -type EventGrid struct { - // TopicEndpoint - EventGrid Topic Endpoint - TopicEndpoint *string `json:"TopicEndpoint,omitempty"` - // AccessKey1 - EventGrid secondary accesskey. Will be obfuscated during read. - AccessKey1 *string `json:"accessKey1,omitempty"` - // AccessKey2 - EventGrid secondary accesskey. Will be obfuscated during read. - AccessKey2 *string `json:"accessKey2,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' - ProvisioningState EndpointProvisioningState `json:"provisioningState,omitempty"` - // CreatedTime - READ-ONLY; Time when the Endpoint was added to DigitalTwinsInstance. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // AuthenticationType - Specifies the authentication type being used for connecting to the endpoint. Possible values include: 'KeyBased', 'IdentityBased' - AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` - // DeadLetterSecret - Dead letter storage secret for key-based authentication. Will be obfuscated during read. - DeadLetterSecret *string `json:"deadLetterSecret,omitempty"` - // DeadLetterURI - Dead letter storage URL for identity-based authentication. - DeadLetterURI *string `json:"deadLetterUri,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeDigitalTwinsEndpointResourceProperties', 'EndpointTypeServiceBus', 'EndpointTypeEventHub', 'EndpointTypeEventGrid' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventGrid. -func (eg EventGrid) MarshalJSON() ([]byte, error) { - eg.EndpointType = EndpointTypeEventGrid - objectMap := make(map[string]interface{}) - if eg.TopicEndpoint != nil { - objectMap["TopicEndpoint"] = eg.TopicEndpoint - } - if eg.AccessKey1 != nil { - objectMap["accessKey1"] = eg.AccessKey1 - } - if eg.AccessKey2 != nil { - objectMap["accessKey2"] = eg.AccessKey2 - } - if eg.AuthenticationType != "" { - objectMap["authenticationType"] = eg.AuthenticationType - } - if eg.DeadLetterSecret != nil { - objectMap["deadLetterSecret"] = eg.DeadLetterSecret - } - if eg.DeadLetterURI != nil { - objectMap["deadLetterUri"] = eg.DeadLetterURI - } - if eg.EndpointType != "" { - objectMap["endpointType"] = eg.EndpointType - } - return json.Marshal(objectMap) -} - -// AsServiceBus is the BasicEndpointResourceProperties implementation for EventGrid. -func (eg EventGrid) AsServiceBus() (*ServiceBus, bool) { - return nil, false -} - -// AsEventHub is the BasicEndpointResourceProperties implementation for EventGrid. -func (eg EventGrid) AsEventHub() (*EventHub, bool) { - return nil, false -} - -// AsEventGrid is the BasicEndpointResourceProperties implementation for EventGrid. -func (eg EventGrid) AsEventGrid() (*EventGrid, bool) { - return &eg, true -} - -// AsEndpointResourceProperties is the BasicEndpointResourceProperties implementation for EventGrid. -func (eg EventGrid) AsEndpointResourceProperties() (*EndpointResourceProperties, bool) { - return nil, false -} - -// AsBasicEndpointResourceProperties is the BasicEndpointResourceProperties implementation for EventGrid. -func (eg EventGrid) AsBasicEndpointResourceProperties() (BasicEndpointResourceProperties, bool) { - return &eg, true -} - -// EventHub properties related to EventHub. -type EventHub struct { - // ConnectionStringPrimaryKey - PrimaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. - ConnectionStringPrimaryKey *string `json:"connectionStringPrimaryKey,omitempty"` - // ConnectionStringSecondaryKey - SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. - ConnectionStringSecondaryKey *string `json:"connectionStringSecondaryKey,omitempty"` - // EndpointURI - The URL of the EventHub namespace for identity-based authentication. It must include the protocol sb:// - EndpointURI *string `json:"endpointUri,omitempty"` - // EntityPath - The EventHub name in the EventHub namespace for identity-based authentication. - EntityPath *string `json:"entityPath,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' - ProvisioningState EndpointProvisioningState `json:"provisioningState,omitempty"` - // CreatedTime - READ-ONLY; Time when the Endpoint was added to DigitalTwinsInstance. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // AuthenticationType - Specifies the authentication type being used for connecting to the endpoint. Possible values include: 'KeyBased', 'IdentityBased' - AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` - // DeadLetterSecret - Dead letter storage secret for key-based authentication. Will be obfuscated during read. - DeadLetterSecret *string `json:"deadLetterSecret,omitempty"` - // DeadLetterURI - Dead letter storage URL for identity-based authentication. - DeadLetterURI *string `json:"deadLetterUri,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeDigitalTwinsEndpointResourceProperties', 'EndpointTypeServiceBus', 'EndpointTypeEventHub', 'EndpointTypeEventGrid' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventHub. -func (eh EventHub) MarshalJSON() ([]byte, error) { - eh.EndpointType = EndpointTypeEventHub - objectMap := make(map[string]interface{}) - if eh.ConnectionStringPrimaryKey != nil { - objectMap["connectionStringPrimaryKey"] = eh.ConnectionStringPrimaryKey - } - if eh.ConnectionStringSecondaryKey != nil { - objectMap["connectionStringSecondaryKey"] = eh.ConnectionStringSecondaryKey - } - if eh.EndpointURI != nil { - objectMap["endpointUri"] = eh.EndpointURI - } - if eh.EntityPath != nil { - objectMap["entityPath"] = eh.EntityPath - } - if eh.AuthenticationType != "" { - objectMap["authenticationType"] = eh.AuthenticationType - } - if eh.DeadLetterSecret != nil { - objectMap["deadLetterSecret"] = eh.DeadLetterSecret - } - if eh.DeadLetterURI != nil { - objectMap["deadLetterUri"] = eh.DeadLetterURI - } - if eh.EndpointType != "" { - objectMap["endpointType"] = eh.EndpointType - } - return json.Marshal(objectMap) -} - -// AsServiceBus is the BasicEndpointResourceProperties implementation for EventHub. -func (eh EventHub) AsServiceBus() (*ServiceBus, bool) { - return nil, false -} - -// AsEventHub is the BasicEndpointResourceProperties implementation for EventHub. -func (eh EventHub) AsEventHub() (*EventHub, bool) { - return &eh, true -} - -// AsEventGrid is the BasicEndpointResourceProperties implementation for EventHub. -func (eh EventHub) AsEventGrid() (*EventGrid, bool) { - return nil, false -} - -// AsEndpointResourceProperties is the BasicEndpointResourceProperties implementation for EventHub. -func (eh EventHub) AsEndpointResourceProperties() (*EndpointResourceProperties, bool) { - return nil, false -} - -// AsBasicEndpointResourceProperties is the BasicEndpointResourceProperties implementation for EventHub. -func (eh EventHub) AsBasicEndpointResourceProperties() (BasicEndpointResourceProperties, bool) { - return &eh, true -} - -// ExternalResource definition of a resource. -type ExternalResource struct { - // ID - READ-ONLY; The resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Extension resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExternalResource. -func (er ExternalResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GroupIDInformation the group information for creating a private endpoint on Digital Twin. -type GroupIDInformation struct { - autorest.Response `json:"-"` - Properties *GroupIDInformationPropertiesModel `json:"properties,omitempty"` - // ID - The resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupIDInformation. -func (gii GroupIDInformation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gii.Properties != nil { - objectMap["properties"] = gii.Properties - } - if gii.ID != nil { - objectMap["id"] = gii.ID - } - return json.Marshal(objectMap) -} - -// GroupIDInformationProperties the properties for a group information object. -type GroupIDInformationProperties struct { - // GroupID - The group id - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - The required members for a specific group id. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - The required DNS zones for a specific group id. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// GroupIDInformationPropertiesModel ... -type GroupIDInformationPropertiesModel struct { - // GroupID - The group id - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - The required members for a specific group id. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - The required DNS zones for a specific group id. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// GroupIDInformationResponse the available private link resources for a Digital Twin. -type GroupIDInformationResponse struct { - autorest.Response `json:"-"` - // Value - The list of available private link resources for a Digital Twin. - Value *[]GroupIDInformation `json:"value,omitempty"` -} - -// Identity the managed identity for the DigitalTwinsInstance. -type Identity struct { - // Type - The type of Managed Identity used by the DigitalTwinsInstance. Only SystemAssigned is supported. Possible values include: 'None', 'SystemAssigned' - Type IdentityType `json:"type,omitempty"` - // PrincipalID - READ-ONLY; The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a systemAssigned(implicit) identity - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-client-tenant-id header in the PUT request if the resource has a systemAssigned(implicit) identity - TenantID *string `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if i.Type != "" { - objectMap["type"] = i.Type - } - return json.Marshal(objectMap) -} - -// Operation digitalTwins service REST API operation -type Operation struct { - // Name - READ-ONLY; Operation name: {provider}/{resource}/{read | write | action | delete} - Name *string `json:"name,omitempty"` - // Display - Operation properties display - Display *OperationDisplay `json:"display,omitempty"` - // Origin - READ-ONLY; The intended executor of the operation. - Origin *string `json:"origin,omitempty"` - // IsDataAction - READ-ONLY; If the operation is a data action (for data plane rbac). - IsDataAction *bool `json:"isDataAction,omitempty"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if o.Display != nil { - objectMap["display"] = o.Display - } - return json.Marshal(objectMap) -} - -// OperationDisplay the object that represents the operation. -type OperationDisplay struct { - // Provider - READ-ONLY; Service provider: Microsoft DigitalTwins - Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; Resource Type: DigitalTwinsInstances - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; Name of the operation - Operation *string `json:"operation,omitempty"` - // Description - READ-ONLY; Friendly description for the operation, - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDisplay. -func (od OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResult a list of DigitalTwins service operations. It contains a list of operations and a -// URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // NextLink - The link used to get the next page of DigitalTwins description objects. - NextLink *string `json:"nextLink,omitempty"` - // Value - READ-ONLY; A list of DigitalTwins operations supported by the Microsoft.DigitalTwins resource provider. - Value *[]Operation `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if olr.NextLink != nil { - objectMap["nextLink"] = olr.NextLink - } - return json.Marshal(objectMap) -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// PatchDescription the description of the DigitalTwins service. -type PatchDescription struct { - // Tags - Instance patch properties - Tags map[string]*string `json:"tags"` - // Identity - The managed identity for the DigitalTwinsInstance. - Identity *Identity `json:"identity,omitempty"` - // Properties - Properties for the DigitalTwinsInstance. - Properties *PatchProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for PatchDescription. -func (pd PatchDescription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pd.Tags != nil { - objectMap["tags"] = pd.Tags - } - if pd.Identity != nil { - objectMap["identity"] = pd.Identity - } - if pd.Properties != nil { - objectMap["properties"] = pd.Properties - } - return json.Marshal(objectMap) -} - -// PatchProperties the properties of a DigitalTwinsInstance. -type PatchProperties struct { - // PublicNetworkAccess - Public network access for the DigitalTwinsInstance. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// PrivateEndpoint the private endpoint property of a private endpoint connection. -type PrivateEndpoint struct { - // ID - READ-ONLY; The resource identifier. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpoint. -func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection the private endpoint connection of a Digital Twin. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.Properties != nil { - objectMap["properties"] = pec.Properties - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionProperties ... -type PrivateEndpointConnectionProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected' - ProvisioningState ConnectionPropertiesProvisioningState `json:"provisioningState,omitempty"` - PrivateEndpoint *ConnectionPropertiesPrivateEndpoint `json:"privateEndpoint,omitempty"` - // GroupIds - The list of group ids for the private endpoint connection. - GroupIds *[]string `json:"groupIds,omitempty"` - PrivateLinkServiceConnectionState *ConnectionPropertiesPrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. -func (pec PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = pec.PrivateEndpoint - } - if pec.GroupIds != nil { - objectMap["groupIds"] = pec.GroupIds - } - if pec.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = pec.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("digitaltwins.PrivateEndpointConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("digitaltwins.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointConnectionsResponse the available private link connections for a Digital Twin. -type PrivateEndpointConnectionsResponse struct { - autorest.Response `json:"-"` - // Value - The list of available private link connections for a Digital Twin. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// Properties the properties of a DigitalTwinsInstance. -type Properties struct { - // CreatedTime - READ-ONLY; Time when DigitalTwinsInstance was created. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // LastUpdatedTime - READ-ONLY; Time when DigitalTwinsInstance was updated. - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'ProvisioningStateProvisioning', 'ProvisioningStateDeleting', 'ProvisioningStateUpdating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateDeleted', 'ProvisioningStateWarning', 'ProvisioningStateSuspending', 'ProvisioningStateRestoring', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // HostName - READ-ONLY; Api endpoint to work with DigitalTwinsInstance. - HostName *string `json:"hostName,omitempty"` - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // PublicNetworkAccess - Public network access for the DigitalTwinsInstance. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for Properties. -func (p Properties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if p.PrivateEndpointConnections != nil { - objectMap["privateEndpointConnections"] = p.PrivateEndpointConnections - } - if p.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = p.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// Resource the common properties of a DigitalTwinsInstance. -type Resource struct { - // ID - READ-ONLY; The resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` - // Identity - The managed identity for the DigitalTwinsInstance. - Identity *Identity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - if r.Identity != nil { - objectMap["identity"] = r.Identity - } - return json.Marshal(objectMap) -} - -// ServiceBus properties related to ServiceBus. -type ServiceBus struct { - // PrimaryConnectionString - PrimaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. - PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` - // SecondaryConnectionString - SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. - SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` - // EndpointURI - The URL of the ServiceBus namespace for identity-based authentication. It must include the protocol sb:// - EndpointURI *string `json:"endpointUri,omitempty"` - // EntityPath - The ServiceBus Topic name for identity-based authentication - EntityPath *string `json:"entityPath,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' - ProvisioningState EndpointProvisioningState `json:"provisioningState,omitempty"` - // CreatedTime - READ-ONLY; Time when the Endpoint was added to DigitalTwinsInstance. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // AuthenticationType - Specifies the authentication type being used for connecting to the endpoint. Possible values include: 'KeyBased', 'IdentityBased' - AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` - // DeadLetterSecret - Dead letter storage secret for key-based authentication. Will be obfuscated during read. - DeadLetterSecret *string `json:"deadLetterSecret,omitempty"` - // DeadLetterURI - Dead letter storage URL for identity-based authentication. - DeadLetterURI *string `json:"deadLetterUri,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeDigitalTwinsEndpointResourceProperties', 'EndpointTypeServiceBus', 'EndpointTypeEventHub', 'EndpointTypeEventGrid' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceBus. -func (sb ServiceBus) MarshalJSON() ([]byte, error) { - sb.EndpointType = EndpointTypeServiceBus - objectMap := make(map[string]interface{}) - if sb.PrimaryConnectionString != nil { - objectMap["primaryConnectionString"] = sb.PrimaryConnectionString - } - if sb.SecondaryConnectionString != nil { - objectMap["secondaryConnectionString"] = sb.SecondaryConnectionString - } - if sb.EndpointURI != nil { - objectMap["endpointUri"] = sb.EndpointURI - } - if sb.EntityPath != nil { - objectMap["entityPath"] = sb.EntityPath - } - if sb.AuthenticationType != "" { - objectMap["authenticationType"] = sb.AuthenticationType - } - if sb.DeadLetterSecret != nil { - objectMap["deadLetterSecret"] = sb.DeadLetterSecret - } - if sb.DeadLetterURI != nil { - objectMap["deadLetterUri"] = sb.DeadLetterURI - } - if sb.EndpointType != "" { - objectMap["endpointType"] = sb.EndpointType - } - return json.Marshal(objectMap) -} - -// AsServiceBus is the BasicEndpointResourceProperties implementation for ServiceBus. -func (sb ServiceBus) AsServiceBus() (*ServiceBus, bool) { - return &sb, true -} - -// AsEventHub is the BasicEndpointResourceProperties implementation for ServiceBus. -func (sb ServiceBus) AsEventHub() (*EventHub, bool) { - return nil, false -} - -// AsEventGrid is the BasicEndpointResourceProperties implementation for ServiceBus. -func (sb ServiceBus) AsEventGrid() (*EventGrid, bool) { - return nil, false -} - -// AsEndpointResourceProperties is the BasicEndpointResourceProperties implementation for ServiceBus. -func (sb ServiceBus) AsEndpointResourceProperties() (*EndpointResourceProperties, bool) { - return nil, false -} - -// AsBasicEndpointResourceProperties is the BasicEndpointResourceProperties implementation for ServiceBus. -func (sb ServiceBus) AsBasicEndpointResourceProperties() (BasicEndpointResourceProperties, bool) { - return &sb, true -} - -// UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type UpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (Description, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *UpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for UpdateFuture.Result. -func (future *UpdateFuture) result(client Client) (d Description, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.UpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("digitaltwins.UpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.UpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.UpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/operations.go deleted file mode 100644 index 00bd6a7127a5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package digitaltwins - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the azure Digital Twins Client for managing DigitalTwinsInstance -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available DigitalTwins service REST API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "digitaltwins.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DigitalTwins/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "digitaltwins.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "digitaltwins.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/privateendpointconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/privateendpointconnections.go deleted file mode 100644 index b774dc675d9d..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/privateendpointconnections.go +++ /dev/null @@ -1,396 +0,0 @@ -package digitaltwins - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionsClient is the azure Digital Twins Client for managing DigitalTwinsInstance -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate update the status of a private endpoint connection with the given name. -// Parameters: -// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. -// resourceName - the name of the DigitalTwinsInstance. -// privateEndpointConnectionName - the name of the private endpoint connection. -// privateEndpointConnection - the private endpoint connection with updated properties. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: privateEndpointConnection, - Constraints: []validation.Constraint{{Target: "privateEndpointConnection.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - privateEndpointConnection.ID = nil - privateEndpointConnection.Name = nil - privateEndpointConnection.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(privateEndpointConnection), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete private endpoint connection with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. -// resourceName - the name of the DigitalTwinsInstance. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get private endpoint connection properties for the given private endpoint. -// Parameters: -// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. -// resourceName - the name of the DigitalTwinsInstance. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list private endpoint connection properties. -// Parameters: -// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. -// resourceName - the name of the DigitalTwinsInstance. -func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateEndpointConnectionsResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.PrivateEndpointConnectionsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionsResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/privatelinkresources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/privatelinkresources.go deleted file mode 100644 index 3f1da7cf8b89..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/privatelinkresources.go +++ /dev/null @@ -1,207 +0,0 @@ -package digitaltwins - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the azure Digital Twins Client for managing DigitalTwinsInstance -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the specified private link resource for the given Digital Twin. -// Parameters: -// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. -// resourceName - the name of the DigitalTwinsInstance. -// resourceID - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, resourceID string) (result GroupIDInformation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, resourceID) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, resourceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceId": autorest.Encode("path", resourceID), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateLinkResources/{resourceId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) GetResponder(resp *http.Response) (result GroupIDInformation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list private link resources for given Digital Twin. -// Parameters: -// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. -// resourceName - the name of the DigitalTwinsInstance. -func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result GroupIDInformationResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("digitaltwins.PrivateLinkResourcesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateLinkResourcesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "digitaltwins.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result GroupIDInformationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/version.go deleted file mode 100644 index 2b537be54a5a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package digitaltwins - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " digitaltwins/2020-12-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/CHANGELOG.md deleted file mode 100644 index 97dacea793ea..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/CHANGELOG.md +++ /dev/null @@ -1,192 +0,0 @@ -# Change History - -## Breaking Changes - -### Removed Constants - -1. AgreementType.AS2 -1. AgreementType.Edifact -1. AgreementType.NotSpecified -1. AgreementType.X12 -1. AzureAsyncOperationState.Canceled -1. AzureAsyncOperationState.Failed -1. AzureAsyncOperationState.Pending -1. AzureAsyncOperationState.Succeeded -1. DayOfWeek.Friday -1. DayOfWeek.Monday -1. DayOfWeek.Saturday -1. DayOfWeek.Sunday -1. DayOfWeek.Thursday -1. DayOfWeek.Tuesday -1. DayOfWeek.Wednesday -1. EventLevel.Critical -1. EventLevel.Error -1. EventLevel.Informational -1. EventLevel.LogAlways -1. EventLevel.Verbose -1. EventLevel.Warning -1. IntegrationServiceEnvironmentSkuScaleType.Automatic -1. IntegrationServiceEnvironmentSkuScaleType.Manual -1. IntegrationServiceEnvironmentSkuScaleType.None -1. OpenAuthenticationProviderType.AAD -1. SwaggerSchemaType.Array -1. SwaggerSchemaType.Boolean -1. SwaggerSchemaType.File -1. SwaggerSchemaType.Integer -1. SwaggerSchemaType.Null -1. SwaggerSchemaType.Number -1. SwaggerSchemaType.Object -1. SwaggerSchemaType.String - -### Removed Funcs - -1. *ManagedAPIListResultIterator.Next() error -1. *ManagedAPIListResultIterator.NextWithContext(context.Context) error -1. *ManagedAPIListResultPage.Next() error -1. *ManagedAPIListResultPage.NextWithContext(context.Context) error -1. ManagedAPIListResult.IsEmpty() bool -1. ManagedAPIListResultIterator.NotDone() bool -1. ManagedAPIListResultIterator.Response() ManagedAPIListResult -1. ManagedAPIListResultIterator.Value() ManagedAPI -1. ManagedAPIListResultPage.NotDone() bool -1. ManagedAPIListResultPage.Response() ManagedAPIListResult -1. ManagedAPIListResultPage.Values() []ManagedAPI -1. NewManagedAPIListResultIterator(ManagedAPIListResultPage) ManagedAPIListResultIterator -1. NewManagedAPIListResultPage(ManagedAPIListResult, func(context.Context, ManagedAPIListResult) (ManagedAPIListResult, error)) ManagedAPIListResultPage -1. OpenAuthenticationAccessPolicy.MarshalJSON() ([]byte, error) - -### Struct Changes - -#### Removed Structs - -1. ManagedAPIListResultIterator -1. ManagedAPIListResultPage - -#### Removed Struct Fields - -1. ManagedAPI.autorest.Response -1. ManagedAPIListResult.autorest.Response - -### Signature Changes - -#### Funcs - -1. IntegrationServiceEnvironmentManagedApisClient.Get - - Returns - - From: ManagedAPI, error - - To: IntegrationServiceEnvironmentManagedAPI, error -1. IntegrationServiceEnvironmentManagedApisClient.GetResponder - - Returns - - From: ManagedAPI, error - - To: IntegrationServiceEnvironmentManagedAPI, error -1. IntegrationServiceEnvironmentManagedApisClient.List - - Returns - - From: ManagedAPIListResultPage, error - - To: IntegrationServiceEnvironmentManagedAPIListResultPage, error -1. IntegrationServiceEnvironmentManagedApisClient.ListComplete - - Returns - - From: ManagedAPIListResultIterator, error - - To: IntegrationServiceEnvironmentManagedAPIListResultIterator, error -1. IntegrationServiceEnvironmentManagedApisClient.ListResponder - - Returns - - From: ManagedAPIListResult, error - - To: IntegrationServiceEnvironmentManagedAPIListResult, error -1. IntegrationServiceEnvironmentManagedApisClient.Put - - Params - - From: context.Context, string, string, string - - To: context.Context, string, string, string, IntegrationServiceEnvironmentManagedAPI -1. IntegrationServiceEnvironmentManagedApisClient.PutPreparer - - Params - - From: context.Context, string, string, string - - To: context.Context, string, string, string, IntegrationServiceEnvironmentManagedAPI -1. IntegrationServiceEnvironmentManagedApisClient.PutResponder - - Returns - - From: ManagedAPI, error - - To: IntegrationServiceEnvironmentManagedAPI, error - -#### Struct Fields - -1. IntegrationAccountProperties.IntegrationServiceEnvironment changed type from *IntegrationServiceEnvironment to *ResourceReference -1. IntegrationServiceEnvironmentManagedApisPutFuture.Result changed type from func(IntegrationServiceEnvironmentManagedApisClient) (ManagedAPI, error) to func(IntegrationServiceEnvironmentManagedApisClient) (IntegrationServiceEnvironmentManagedAPI, error) - -## Additive Changes - -### New Constants - -1. AgreementType.AgreementTypeAS2 -1. AgreementType.AgreementTypeEdifact -1. AgreementType.AgreementTypeNotSpecified -1. AgreementType.AgreementTypeX12 -1. AzureAsyncOperationState.AzureAsyncOperationStateCanceled -1. AzureAsyncOperationState.AzureAsyncOperationStateFailed -1. AzureAsyncOperationState.AzureAsyncOperationStatePending -1. AzureAsyncOperationState.AzureAsyncOperationStateSucceeded -1. DayOfWeek.DayOfWeekFriday -1. DayOfWeek.DayOfWeekMonday -1. DayOfWeek.DayOfWeekSaturday -1. DayOfWeek.DayOfWeekSunday -1. DayOfWeek.DayOfWeekThursday -1. DayOfWeek.DayOfWeekTuesday -1. DayOfWeek.DayOfWeekWednesday -1. EventLevel.EventLevelCritical -1. EventLevel.EventLevelError -1. EventLevel.EventLevelInformational -1. EventLevel.EventLevelLogAlways -1. EventLevel.EventLevelVerbose -1. EventLevel.EventLevelWarning -1. IntegrationServiceEnvironmentSkuScaleType.IntegrationServiceEnvironmentSkuScaleTypeAutomatic -1. IntegrationServiceEnvironmentSkuScaleType.IntegrationServiceEnvironmentSkuScaleTypeManual -1. IntegrationServiceEnvironmentSkuScaleType.IntegrationServiceEnvironmentSkuScaleTypeNone -1. ManagedServiceIdentityType.ManagedServiceIdentityTypeNone -1. ManagedServiceIdentityType.ManagedServiceIdentityTypeSystemAssigned -1. ManagedServiceIdentityType.ManagedServiceIdentityTypeUserAssigned -1. OpenAuthenticationProviderType.OpenAuthenticationProviderTypeAAD -1. SwaggerSchemaType.SwaggerSchemaTypeArray -1. SwaggerSchemaType.SwaggerSchemaTypeBoolean -1. SwaggerSchemaType.SwaggerSchemaTypeFile -1. SwaggerSchemaType.SwaggerSchemaTypeInteger -1. SwaggerSchemaType.SwaggerSchemaTypeNull -1. SwaggerSchemaType.SwaggerSchemaTypeNumber -1. SwaggerSchemaType.SwaggerSchemaTypeObject -1. SwaggerSchemaType.SwaggerSchemaTypeString - -### New Funcs - -1. *IntegrationServiceEnvironmentManagedAPI.UnmarshalJSON([]byte) error -1. *IntegrationServiceEnvironmentManagedAPIListResultIterator.Next() error -1. *IntegrationServiceEnvironmentManagedAPIListResultIterator.NextWithContext(context.Context) error -1. *IntegrationServiceEnvironmentManagedAPIListResultPage.Next() error -1. *IntegrationServiceEnvironmentManagedAPIListResultPage.NextWithContext(context.Context) error -1. ContentLink.MarshalJSON() ([]byte, error) -1. IntegrationServiceEnvironmentManagedAPI.MarshalJSON() ([]byte, error) -1. IntegrationServiceEnvironmentManagedAPIListResult.IsEmpty() bool -1. IntegrationServiceEnvironmentManagedAPIListResultIterator.NotDone() bool -1. IntegrationServiceEnvironmentManagedAPIListResultIterator.Response() IntegrationServiceEnvironmentManagedAPIListResult -1. IntegrationServiceEnvironmentManagedAPIListResultIterator.Value() IntegrationServiceEnvironmentManagedAPI -1. IntegrationServiceEnvironmentManagedAPIListResultPage.NotDone() bool -1. IntegrationServiceEnvironmentManagedAPIListResultPage.Response() IntegrationServiceEnvironmentManagedAPIListResult -1. IntegrationServiceEnvironmentManagedAPIListResultPage.Values() []IntegrationServiceEnvironmentManagedAPI -1. IntegrationServiceEnvironmentManagedAPIProperties.MarshalJSON() ([]byte, error) -1. ManagedServiceIdentity.MarshalJSON() ([]byte, error) -1. NewIntegrationServiceEnvironmentManagedAPIListResultIterator(IntegrationServiceEnvironmentManagedAPIListResultPage) IntegrationServiceEnvironmentManagedAPIListResultIterator -1. NewIntegrationServiceEnvironmentManagedAPIListResultPage(IntegrationServiceEnvironmentManagedAPIListResult, func(context.Context, IntegrationServiceEnvironmentManagedAPIListResult) (IntegrationServiceEnvironmentManagedAPIListResult, error)) IntegrationServiceEnvironmentManagedAPIListResultPage -1. PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType -1. UserAssignedIdentity.MarshalJSON() ([]byte, error) - -### Struct Changes - -#### New Structs - -1. IntegrationServiceEnvironmentManagedAPI -1. IntegrationServiceEnvironmentManagedAPIDeploymentParameters -1. IntegrationServiceEnvironmentManagedAPIListResult -1. IntegrationServiceEnvironmentManagedAPIListResultIterator -1. IntegrationServiceEnvironmentManagedAPIListResultPage -1. IntegrationServiceEnvironmentManagedAPIProperties -1. ManagedServiceIdentity -1. UserAssignedIdentity - -#### New Struct Fields - -1. IntegrationServiceEnvironment.Identity -1. Workflow.Identity diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/_meta.json deleted file mode 100644 index a003cd1498a2..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "2b56c8a3da0e04aea6f6d80a9ac04741d1ae5904", - "readme": "/_/azure-rest-api-specs/specification/logic/resource-manager/readme.md", - "tag": "package-2019-05", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2019-05 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/logic/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/client.go deleted file mode 100644 index a031c7989b91..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/logic/armlogic](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/logic/armlogic). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package logic implements the Azure ARM Logic service API version 2019-05-01. -// -// REST API for Azure Logic Apps. -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Logic - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Logic. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/enums.go deleted file mode 100644 index d1efb92391fc..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/enums.go +++ /dev/null @@ -1,1060 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AgreementType enumerates the values for agreement type. -type AgreementType string - -const ( - // AgreementTypeAS2 ... - AgreementTypeAS2 AgreementType = "AS2" - // AgreementTypeEdifact ... - AgreementTypeEdifact AgreementType = "Edifact" - // AgreementTypeNotSpecified ... - AgreementTypeNotSpecified AgreementType = "NotSpecified" - // AgreementTypeX12 ... - AgreementTypeX12 AgreementType = "X12" -) - -// PossibleAgreementTypeValues returns an array of possible values for the AgreementType const type. -func PossibleAgreementTypeValues() []AgreementType { - return []AgreementType{AgreementTypeAS2, AgreementTypeEdifact, AgreementTypeNotSpecified, AgreementTypeX12} -} - -// APIDeploymentParameterVisibility enumerates the values for api deployment parameter visibility. -type APIDeploymentParameterVisibility string - -const ( - // APIDeploymentParameterVisibilityDefault ... - APIDeploymentParameterVisibilityDefault APIDeploymentParameterVisibility = "Default" - // APIDeploymentParameterVisibilityInternal ... - APIDeploymentParameterVisibilityInternal APIDeploymentParameterVisibility = "Internal" - // APIDeploymentParameterVisibilityNotSpecified ... - APIDeploymentParameterVisibilityNotSpecified APIDeploymentParameterVisibility = "NotSpecified" -) - -// PossibleAPIDeploymentParameterVisibilityValues returns an array of possible values for the APIDeploymentParameterVisibility const type. -func PossibleAPIDeploymentParameterVisibilityValues() []APIDeploymentParameterVisibility { - return []APIDeploymentParameterVisibility{APIDeploymentParameterVisibilityDefault, APIDeploymentParameterVisibilityInternal, APIDeploymentParameterVisibilityNotSpecified} -} - -// APITier enumerates the values for api tier. -type APITier string - -const ( - // APITierEnterprise ... - APITierEnterprise APITier = "Enterprise" - // APITierNotSpecified ... - APITierNotSpecified APITier = "NotSpecified" - // APITierPremium ... - APITierPremium APITier = "Premium" - // APITierStandard ... - APITierStandard APITier = "Standard" -) - -// PossibleAPITierValues returns an array of possible values for the APITier const type. -func PossibleAPITierValues() []APITier { - return []APITier{APITierEnterprise, APITierNotSpecified, APITierPremium, APITierStandard} -} - -// APIType enumerates the values for api type. -type APIType string - -const ( - // APITypeNotSpecified ... - APITypeNotSpecified APIType = "NotSpecified" - // APITypeRest ... - APITypeRest APIType = "Rest" - // APITypeSoap ... - APITypeSoap APIType = "Soap" -) - -// PossibleAPITypeValues returns an array of possible values for the APIType const type. -func PossibleAPITypeValues() []APIType { - return []APIType{APITypeNotSpecified, APITypeRest, APITypeSoap} -} - -// AzureAsyncOperationState enumerates the values for azure async operation state. -type AzureAsyncOperationState string - -const ( - // AzureAsyncOperationStateCanceled ... - AzureAsyncOperationStateCanceled AzureAsyncOperationState = "Canceled" - // AzureAsyncOperationStateFailed ... - AzureAsyncOperationStateFailed AzureAsyncOperationState = "Failed" - // AzureAsyncOperationStatePending ... - AzureAsyncOperationStatePending AzureAsyncOperationState = "Pending" - // AzureAsyncOperationStateSucceeded ... - AzureAsyncOperationStateSucceeded AzureAsyncOperationState = "Succeeded" -) - -// PossibleAzureAsyncOperationStateValues returns an array of possible values for the AzureAsyncOperationState const type. -func PossibleAzureAsyncOperationStateValues() []AzureAsyncOperationState { - return []AzureAsyncOperationState{AzureAsyncOperationStateCanceled, AzureAsyncOperationStateFailed, AzureAsyncOperationStatePending, AzureAsyncOperationStateSucceeded} -} - -// DayOfWeek enumerates the values for day of week. -type DayOfWeek string - -const ( - // DayOfWeekFriday ... - DayOfWeekFriday DayOfWeek = "Friday" - // DayOfWeekMonday ... - DayOfWeekMonday DayOfWeek = "Monday" - // DayOfWeekSaturday ... - DayOfWeekSaturday DayOfWeek = "Saturday" - // DayOfWeekSunday ... - DayOfWeekSunday DayOfWeek = "Sunday" - // DayOfWeekThursday ... - DayOfWeekThursday DayOfWeek = "Thursday" - // DayOfWeekTuesday ... - DayOfWeekTuesday DayOfWeek = "Tuesday" - // DayOfWeekWednesday ... - DayOfWeekWednesday DayOfWeek = "Wednesday" -) - -// PossibleDayOfWeekValues returns an array of possible values for the DayOfWeek const type. -func PossibleDayOfWeekValues() []DayOfWeek { - return []DayOfWeek{DayOfWeekFriday, DayOfWeekMonday, DayOfWeekSaturday, DayOfWeekSunday, DayOfWeekThursday, DayOfWeekTuesday, DayOfWeekWednesday} -} - -// DaysOfWeek enumerates the values for days of week. -type DaysOfWeek string - -const ( - // DaysOfWeekFriday ... - DaysOfWeekFriday DaysOfWeek = "Friday" - // DaysOfWeekMonday ... - DaysOfWeekMonday DaysOfWeek = "Monday" - // DaysOfWeekSaturday ... - DaysOfWeekSaturday DaysOfWeek = "Saturday" - // DaysOfWeekSunday ... - DaysOfWeekSunday DaysOfWeek = "Sunday" - // DaysOfWeekThursday ... - DaysOfWeekThursday DaysOfWeek = "Thursday" - // DaysOfWeekTuesday ... - DaysOfWeekTuesday DaysOfWeek = "Tuesday" - // DaysOfWeekWednesday ... - DaysOfWeekWednesday DaysOfWeek = "Wednesday" -) - -// PossibleDaysOfWeekValues returns an array of possible values for the DaysOfWeek const type. -func PossibleDaysOfWeekValues() []DaysOfWeek { - return []DaysOfWeek{DaysOfWeekFriday, DaysOfWeekMonday, DaysOfWeekSaturday, DaysOfWeekSunday, DaysOfWeekThursday, DaysOfWeekTuesday, DaysOfWeekWednesday} -} - -// EdifactCharacterSet enumerates the values for edifact character set. -type EdifactCharacterSet string - -const ( - // EdifactCharacterSetKECA ... - EdifactCharacterSetKECA EdifactCharacterSet = "KECA" - // EdifactCharacterSetNotSpecified ... - EdifactCharacterSetNotSpecified EdifactCharacterSet = "NotSpecified" - // EdifactCharacterSetUNOA ... - EdifactCharacterSetUNOA EdifactCharacterSet = "UNOA" - // EdifactCharacterSetUNOB ... - EdifactCharacterSetUNOB EdifactCharacterSet = "UNOB" - // EdifactCharacterSetUNOC ... - EdifactCharacterSetUNOC EdifactCharacterSet = "UNOC" - // EdifactCharacterSetUNOD ... - EdifactCharacterSetUNOD EdifactCharacterSet = "UNOD" - // EdifactCharacterSetUNOE ... - EdifactCharacterSetUNOE EdifactCharacterSet = "UNOE" - // EdifactCharacterSetUNOF ... - EdifactCharacterSetUNOF EdifactCharacterSet = "UNOF" - // EdifactCharacterSetUNOG ... - EdifactCharacterSetUNOG EdifactCharacterSet = "UNOG" - // EdifactCharacterSetUNOH ... - EdifactCharacterSetUNOH EdifactCharacterSet = "UNOH" - // EdifactCharacterSetUNOI ... - EdifactCharacterSetUNOI EdifactCharacterSet = "UNOI" - // EdifactCharacterSetUNOJ ... - EdifactCharacterSetUNOJ EdifactCharacterSet = "UNOJ" - // EdifactCharacterSetUNOK ... - EdifactCharacterSetUNOK EdifactCharacterSet = "UNOK" - // EdifactCharacterSetUNOX ... - EdifactCharacterSetUNOX EdifactCharacterSet = "UNOX" - // EdifactCharacterSetUNOY ... - EdifactCharacterSetUNOY EdifactCharacterSet = "UNOY" -) - -// PossibleEdifactCharacterSetValues returns an array of possible values for the EdifactCharacterSet const type. -func PossibleEdifactCharacterSetValues() []EdifactCharacterSet { - return []EdifactCharacterSet{EdifactCharacterSetKECA, EdifactCharacterSetNotSpecified, EdifactCharacterSetUNOA, EdifactCharacterSetUNOB, EdifactCharacterSetUNOC, EdifactCharacterSetUNOD, EdifactCharacterSetUNOE, EdifactCharacterSetUNOF, EdifactCharacterSetUNOG, EdifactCharacterSetUNOH, EdifactCharacterSetUNOI, EdifactCharacterSetUNOJ, EdifactCharacterSetUNOK, EdifactCharacterSetUNOX, EdifactCharacterSetUNOY} -} - -// EdifactDecimalIndicator enumerates the values for edifact decimal indicator. -type EdifactDecimalIndicator string - -const ( - // EdifactDecimalIndicatorComma ... - EdifactDecimalIndicatorComma EdifactDecimalIndicator = "Comma" - // EdifactDecimalIndicatorDecimal ... - EdifactDecimalIndicatorDecimal EdifactDecimalIndicator = "Decimal" - // EdifactDecimalIndicatorNotSpecified ... - EdifactDecimalIndicatorNotSpecified EdifactDecimalIndicator = "NotSpecified" -) - -// PossibleEdifactDecimalIndicatorValues returns an array of possible values for the EdifactDecimalIndicator const type. -func PossibleEdifactDecimalIndicatorValues() []EdifactDecimalIndicator { - return []EdifactDecimalIndicator{EdifactDecimalIndicatorComma, EdifactDecimalIndicatorDecimal, EdifactDecimalIndicatorNotSpecified} -} - -// EncryptionAlgorithm enumerates the values for encryption algorithm. -type EncryptionAlgorithm string - -const ( - // EncryptionAlgorithmAES128 ... - EncryptionAlgorithmAES128 EncryptionAlgorithm = "AES128" - // EncryptionAlgorithmAES192 ... - EncryptionAlgorithmAES192 EncryptionAlgorithm = "AES192" - // EncryptionAlgorithmAES256 ... - EncryptionAlgorithmAES256 EncryptionAlgorithm = "AES256" - // EncryptionAlgorithmDES3 ... - EncryptionAlgorithmDES3 EncryptionAlgorithm = "DES3" - // EncryptionAlgorithmNone ... - EncryptionAlgorithmNone EncryptionAlgorithm = "None" - // EncryptionAlgorithmNotSpecified ... - EncryptionAlgorithmNotSpecified EncryptionAlgorithm = "NotSpecified" - // EncryptionAlgorithmRC2 ... - EncryptionAlgorithmRC2 EncryptionAlgorithm = "RC2" -) - -// PossibleEncryptionAlgorithmValues returns an array of possible values for the EncryptionAlgorithm const type. -func PossibleEncryptionAlgorithmValues() []EncryptionAlgorithm { - return []EncryptionAlgorithm{EncryptionAlgorithmAES128, EncryptionAlgorithmAES192, EncryptionAlgorithmAES256, EncryptionAlgorithmDES3, EncryptionAlgorithmNone, EncryptionAlgorithmNotSpecified, EncryptionAlgorithmRC2} -} - -// ErrorResponseCode enumerates the values for error response code. -type ErrorResponseCode string - -const ( - // ErrorResponseCodeIntegrationServiceEnvironmentNotFound ... - ErrorResponseCodeIntegrationServiceEnvironmentNotFound ErrorResponseCode = "IntegrationServiceEnvironmentNotFound" - // ErrorResponseCodeInternalServerError ... - ErrorResponseCodeInternalServerError ErrorResponseCode = "InternalServerError" - // ErrorResponseCodeInvalidOperationID ... - ErrorResponseCodeInvalidOperationID ErrorResponseCode = "InvalidOperationId" - // ErrorResponseCodeNotSpecified ... - ErrorResponseCodeNotSpecified ErrorResponseCode = "NotSpecified" -) - -// PossibleErrorResponseCodeValues returns an array of possible values for the ErrorResponseCode const type. -func PossibleErrorResponseCodeValues() []ErrorResponseCode { - return []ErrorResponseCode{ErrorResponseCodeIntegrationServiceEnvironmentNotFound, ErrorResponseCodeInternalServerError, ErrorResponseCodeInvalidOperationID, ErrorResponseCodeNotSpecified} -} - -// EventLevel enumerates the values for event level. -type EventLevel string - -const ( - // EventLevelCritical ... - EventLevelCritical EventLevel = "Critical" - // EventLevelError ... - EventLevelError EventLevel = "Error" - // EventLevelInformational ... - EventLevelInformational EventLevel = "Informational" - // EventLevelLogAlways ... - EventLevelLogAlways EventLevel = "LogAlways" - // EventLevelVerbose ... - EventLevelVerbose EventLevel = "Verbose" - // EventLevelWarning ... - EventLevelWarning EventLevel = "Warning" -) - -// PossibleEventLevelValues returns an array of possible values for the EventLevel const type. -func PossibleEventLevelValues() []EventLevel { - return []EventLevel{EventLevelCritical, EventLevelError, EventLevelInformational, EventLevelLogAlways, EventLevelVerbose, EventLevelWarning} -} - -// HashingAlgorithm enumerates the values for hashing algorithm. -type HashingAlgorithm string - -const ( - // HashingAlgorithmMD5 ... - HashingAlgorithmMD5 HashingAlgorithm = "MD5" - // HashingAlgorithmNone ... - HashingAlgorithmNone HashingAlgorithm = "None" - // HashingAlgorithmNotSpecified ... - HashingAlgorithmNotSpecified HashingAlgorithm = "NotSpecified" - // HashingAlgorithmSHA1 ... - HashingAlgorithmSHA1 HashingAlgorithm = "SHA1" - // HashingAlgorithmSHA2256 ... - HashingAlgorithmSHA2256 HashingAlgorithm = "SHA2256" - // HashingAlgorithmSHA2384 ... - HashingAlgorithmSHA2384 HashingAlgorithm = "SHA2384" - // HashingAlgorithmSHA2512 ... - HashingAlgorithmSHA2512 HashingAlgorithm = "SHA2512" -) - -// PossibleHashingAlgorithmValues returns an array of possible values for the HashingAlgorithm const type. -func PossibleHashingAlgorithmValues() []HashingAlgorithm { - return []HashingAlgorithm{HashingAlgorithmMD5, HashingAlgorithmNone, HashingAlgorithmNotSpecified, HashingAlgorithmSHA1, HashingAlgorithmSHA2256, HashingAlgorithmSHA2384, HashingAlgorithmSHA2512} -} - -// IntegrationAccountSkuName enumerates the values for integration account sku name. -type IntegrationAccountSkuName string - -const ( - // IntegrationAccountSkuNameBasic ... - IntegrationAccountSkuNameBasic IntegrationAccountSkuName = "Basic" - // IntegrationAccountSkuNameFree ... - IntegrationAccountSkuNameFree IntegrationAccountSkuName = "Free" - // IntegrationAccountSkuNameNotSpecified ... - IntegrationAccountSkuNameNotSpecified IntegrationAccountSkuName = "NotSpecified" - // IntegrationAccountSkuNameStandard ... - IntegrationAccountSkuNameStandard IntegrationAccountSkuName = "Standard" -) - -// PossibleIntegrationAccountSkuNameValues returns an array of possible values for the IntegrationAccountSkuName const type. -func PossibleIntegrationAccountSkuNameValues() []IntegrationAccountSkuName { - return []IntegrationAccountSkuName{IntegrationAccountSkuNameBasic, IntegrationAccountSkuNameFree, IntegrationAccountSkuNameNotSpecified, IntegrationAccountSkuNameStandard} -} - -// IntegrationServiceEnvironmentAccessEndpointType enumerates the values for integration service environment -// access endpoint type. -type IntegrationServiceEnvironmentAccessEndpointType string - -const ( - // IntegrationServiceEnvironmentAccessEndpointTypeExternal ... - IntegrationServiceEnvironmentAccessEndpointTypeExternal IntegrationServiceEnvironmentAccessEndpointType = "External" - // IntegrationServiceEnvironmentAccessEndpointTypeInternal ... - IntegrationServiceEnvironmentAccessEndpointTypeInternal IntegrationServiceEnvironmentAccessEndpointType = "Internal" - // IntegrationServiceEnvironmentAccessEndpointTypeNotSpecified ... - IntegrationServiceEnvironmentAccessEndpointTypeNotSpecified IntegrationServiceEnvironmentAccessEndpointType = "NotSpecified" -) - -// PossibleIntegrationServiceEnvironmentAccessEndpointTypeValues returns an array of possible values for the IntegrationServiceEnvironmentAccessEndpointType const type. -func PossibleIntegrationServiceEnvironmentAccessEndpointTypeValues() []IntegrationServiceEnvironmentAccessEndpointType { - return []IntegrationServiceEnvironmentAccessEndpointType{IntegrationServiceEnvironmentAccessEndpointTypeExternal, IntegrationServiceEnvironmentAccessEndpointTypeInternal, IntegrationServiceEnvironmentAccessEndpointTypeNotSpecified} -} - -// IntegrationServiceEnvironmentNetworkDependencyCategoryType enumerates the values for integration service -// environment network dependency category type. -type IntegrationServiceEnvironmentNetworkDependencyCategoryType string - -const ( - // IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAccessEndpoints ... - IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAccessEndpoints IntegrationServiceEnvironmentNetworkDependencyCategoryType = "AccessEndpoints" - // IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAzureActiveDirectory ... - IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAzureActiveDirectory IntegrationServiceEnvironmentNetworkDependencyCategoryType = "AzureActiveDirectory" - // IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAzureManagement ... - IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAzureManagement IntegrationServiceEnvironmentNetworkDependencyCategoryType = "AzureManagement" - // IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAzureStorage ... - IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAzureStorage IntegrationServiceEnvironmentNetworkDependencyCategoryType = "AzureStorage" - // IntegrationServiceEnvironmentNetworkDependencyCategoryTypeDiagnosticLogsAndMetrics ... - IntegrationServiceEnvironmentNetworkDependencyCategoryTypeDiagnosticLogsAndMetrics IntegrationServiceEnvironmentNetworkDependencyCategoryType = "DiagnosticLogsAndMetrics" - // IntegrationServiceEnvironmentNetworkDependencyCategoryTypeIntegrationServiceEnvironmentConnectors ... - IntegrationServiceEnvironmentNetworkDependencyCategoryTypeIntegrationServiceEnvironmentConnectors IntegrationServiceEnvironmentNetworkDependencyCategoryType = "IntegrationServiceEnvironmentConnectors" - // IntegrationServiceEnvironmentNetworkDependencyCategoryTypeNotSpecified ... - IntegrationServiceEnvironmentNetworkDependencyCategoryTypeNotSpecified IntegrationServiceEnvironmentNetworkDependencyCategoryType = "NotSpecified" - // IntegrationServiceEnvironmentNetworkDependencyCategoryTypeRecoveryService ... - IntegrationServiceEnvironmentNetworkDependencyCategoryTypeRecoveryService IntegrationServiceEnvironmentNetworkDependencyCategoryType = "RecoveryService" - // IntegrationServiceEnvironmentNetworkDependencyCategoryTypeRedisCache ... - IntegrationServiceEnvironmentNetworkDependencyCategoryTypeRedisCache IntegrationServiceEnvironmentNetworkDependencyCategoryType = "RedisCache" - // IntegrationServiceEnvironmentNetworkDependencyCategoryTypeRegionalService ... - IntegrationServiceEnvironmentNetworkDependencyCategoryTypeRegionalService IntegrationServiceEnvironmentNetworkDependencyCategoryType = "RegionalService" - // IntegrationServiceEnvironmentNetworkDependencyCategoryTypeSQL ... - IntegrationServiceEnvironmentNetworkDependencyCategoryTypeSQL IntegrationServiceEnvironmentNetworkDependencyCategoryType = "SQL" - // IntegrationServiceEnvironmentNetworkDependencyCategoryTypeSSLCertificateVerification ... - IntegrationServiceEnvironmentNetworkDependencyCategoryTypeSSLCertificateVerification IntegrationServiceEnvironmentNetworkDependencyCategoryType = "SSLCertificateVerification" -) - -// PossibleIntegrationServiceEnvironmentNetworkDependencyCategoryTypeValues returns an array of possible values for the IntegrationServiceEnvironmentNetworkDependencyCategoryType const type. -func PossibleIntegrationServiceEnvironmentNetworkDependencyCategoryTypeValues() []IntegrationServiceEnvironmentNetworkDependencyCategoryType { - return []IntegrationServiceEnvironmentNetworkDependencyCategoryType{IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAccessEndpoints, IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAzureActiveDirectory, IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAzureManagement, IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAzureStorage, IntegrationServiceEnvironmentNetworkDependencyCategoryTypeDiagnosticLogsAndMetrics, IntegrationServiceEnvironmentNetworkDependencyCategoryTypeIntegrationServiceEnvironmentConnectors, IntegrationServiceEnvironmentNetworkDependencyCategoryTypeNotSpecified, IntegrationServiceEnvironmentNetworkDependencyCategoryTypeRecoveryService, IntegrationServiceEnvironmentNetworkDependencyCategoryTypeRedisCache, IntegrationServiceEnvironmentNetworkDependencyCategoryTypeRegionalService, IntegrationServiceEnvironmentNetworkDependencyCategoryTypeSQL, IntegrationServiceEnvironmentNetworkDependencyCategoryTypeSSLCertificateVerification} -} - -// IntegrationServiceEnvironmentNetworkDependencyHealthState enumerates the values for integration service -// environment network dependency health state. -type IntegrationServiceEnvironmentNetworkDependencyHealthState string - -const ( - // IntegrationServiceEnvironmentNetworkDependencyHealthStateHealthy ... - IntegrationServiceEnvironmentNetworkDependencyHealthStateHealthy IntegrationServiceEnvironmentNetworkDependencyHealthState = "Healthy" - // IntegrationServiceEnvironmentNetworkDependencyHealthStateNotSpecified ... - IntegrationServiceEnvironmentNetworkDependencyHealthStateNotSpecified IntegrationServiceEnvironmentNetworkDependencyHealthState = "NotSpecified" - // IntegrationServiceEnvironmentNetworkDependencyHealthStateUnhealthy ... - IntegrationServiceEnvironmentNetworkDependencyHealthStateUnhealthy IntegrationServiceEnvironmentNetworkDependencyHealthState = "Unhealthy" - // IntegrationServiceEnvironmentNetworkDependencyHealthStateUnknown ... - IntegrationServiceEnvironmentNetworkDependencyHealthStateUnknown IntegrationServiceEnvironmentNetworkDependencyHealthState = "Unknown" -) - -// PossibleIntegrationServiceEnvironmentNetworkDependencyHealthStateValues returns an array of possible values for the IntegrationServiceEnvironmentNetworkDependencyHealthState const type. -func PossibleIntegrationServiceEnvironmentNetworkDependencyHealthStateValues() []IntegrationServiceEnvironmentNetworkDependencyHealthState { - return []IntegrationServiceEnvironmentNetworkDependencyHealthState{IntegrationServiceEnvironmentNetworkDependencyHealthStateHealthy, IntegrationServiceEnvironmentNetworkDependencyHealthStateNotSpecified, IntegrationServiceEnvironmentNetworkDependencyHealthStateUnhealthy, IntegrationServiceEnvironmentNetworkDependencyHealthStateUnknown} -} - -// IntegrationServiceEnvironmentNetworkEndPointAccessibilityState enumerates the values for integration service -// environment network end point accessibility state. -type IntegrationServiceEnvironmentNetworkEndPointAccessibilityState string - -const ( - // IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateAvailable ... - IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateAvailable IntegrationServiceEnvironmentNetworkEndPointAccessibilityState = "Available" - // IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateNotAvailable ... - IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateNotAvailable IntegrationServiceEnvironmentNetworkEndPointAccessibilityState = "NotAvailable" - // IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateNotSpecified ... - IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateNotSpecified IntegrationServiceEnvironmentNetworkEndPointAccessibilityState = "NotSpecified" - // IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateUnknown ... - IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateUnknown IntegrationServiceEnvironmentNetworkEndPointAccessibilityState = "Unknown" -) - -// PossibleIntegrationServiceEnvironmentNetworkEndPointAccessibilityStateValues returns an array of possible values for the IntegrationServiceEnvironmentNetworkEndPointAccessibilityState const type. -func PossibleIntegrationServiceEnvironmentNetworkEndPointAccessibilityStateValues() []IntegrationServiceEnvironmentNetworkEndPointAccessibilityState { - return []IntegrationServiceEnvironmentNetworkEndPointAccessibilityState{IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateAvailable, IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateNotAvailable, IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateNotSpecified, IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateUnknown} -} - -// IntegrationServiceEnvironmentSkuName enumerates the values for integration service environment sku name. -type IntegrationServiceEnvironmentSkuName string - -const ( - // IntegrationServiceEnvironmentSkuNameDeveloper ... - IntegrationServiceEnvironmentSkuNameDeveloper IntegrationServiceEnvironmentSkuName = "Developer" - // IntegrationServiceEnvironmentSkuNameNotSpecified ... - IntegrationServiceEnvironmentSkuNameNotSpecified IntegrationServiceEnvironmentSkuName = "NotSpecified" - // IntegrationServiceEnvironmentSkuNamePremium ... - IntegrationServiceEnvironmentSkuNamePremium IntegrationServiceEnvironmentSkuName = "Premium" -) - -// PossibleIntegrationServiceEnvironmentSkuNameValues returns an array of possible values for the IntegrationServiceEnvironmentSkuName const type. -func PossibleIntegrationServiceEnvironmentSkuNameValues() []IntegrationServiceEnvironmentSkuName { - return []IntegrationServiceEnvironmentSkuName{IntegrationServiceEnvironmentSkuNameDeveloper, IntegrationServiceEnvironmentSkuNameNotSpecified, IntegrationServiceEnvironmentSkuNamePremium} -} - -// IntegrationServiceEnvironmentSkuScaleType enumerates the values for integration service environment sku -// scale type. -type IntegrationServiceEnvironmentSkuScaleType string - -const ( - // IntegrationServiceEnvironmentSkuScaleTypeAutomatic ... - IntegrationServiceEnvironmentSkuScaleTypeAutomatic IntegrationServiceEnvironmentSkuScaleType = "Automatic" - // IntegrationServiceEnvironmentSkuScaleTypeManual ... - IntegrationServiceEnvironmentSkuScaleTypeManual IntegrationServiceEnvironmentSkuScaleType = "Manual" - // IntegrationServiceEnvironmentSkuScaleTypeNone ... - IntegrationServiceEnvironmentSkuScaleTypeNone IntegrationServiceEnvironmentSkuScaleType = "None" -) - -// PossibleIntegrationServiceEnvironmentSkuScaleTypeValues returns an array of possible values for the IntegrationServiceEnvironmentSkuScaleType const type. -func PossibleIntegrationServiceEnvironmentSkuScaleTypeValues() []IntegrationServiceEnvironmentSkuScaleType { - return []IntegrationServiceEnvironmentSkuScaleType{IntegrationServiceEnvironmentSkuScaleTypeAutomatic, IntegrationServiceEnvironmentSkuScaleTypeManual, IntegrationServiceEnvironmentSkuScaleTypeNone} -} - -// KeyType enumerates the values for key type. -type KeyType string - -const ( - // KeyTypeNotSpecified ... - KeyTypeNotSpecified KeyType = "NotSpecified" - // KeyTypePrimary ... - KeyTypePrimary KeyType = "Primary" - // KeyTypeSecondary ... - KeyTypeSecondary KeyType = "Secondary" -) - -// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. -func PossibleKeyTypeValues() []KeyType { - return []KeyType{KeyTypeNotSpecified, KeyTypePrimary, KeyTypeSecondary} -} - -// ManagedServiceIdentityType enumerates the values for managed service identity type. -type ManagedServiceIdentityType string - -const ( - // ManagedServiceIdentityTypeNone ... - ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - // ManagedServiceIdentityTypeSystemAssigned ... - ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" - // ManagedServiceIdentityTypeUserAssigned ... - ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" -) - -// PossibleManagedServiceIdentityTypeValues returns an array of possible values for the ManagedServiceIdentityType const type. -func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { - return []ManagedServiceIdentityType{ManagedServiceIdentityTypeNone, ManagedServiceIdentityTypeSystemAssigned, ManagedServiceIdentityTypeUserAssigned} -} - -// MapType enumerates the values for map type. -type MapType string - -const ( - // MapTypeLiquid ... - MapTypeLiquid MapType = "Liquid" - // MapTypeNotSpecified ... - MapTypeNotSpecified MapType = "NotSpecified" - // MapTypeXslt ... - MapTypeXslt MapType = "Xslt" - // MapTypeXslt20 ... - MapTypeXslt20 MapType = "Xslt20" - // MapTypeXslt30 ... - MapTypeXslt30 MapType = "Xslt30" -) - -// PossibleMapTypeValues returns an array of possible values for the MapType const type. -func PossibleMapTypeValues() []MapType { - return []MapType{MapTypeLiquid, MapTypeNotSpecified, MapTypeXslt, MapTypeXslt20, MapTypeXslt30} -} - -// MessageFilterType enumerates the values for message filter type. -type MessageFilterType string - -const ( - // MessageFilterTypeExclude ... - MessageFilterTypeExclude MessageFilterType = "Exclude" - // MessageFilterTypeInclude ... - MessageFilterTypeInclude MessageFilterType = "Include" - // MessageFilterTypeNotSpecified ... - MessageFilterTypeNotSpecified MessageFilterType = "NotSpecified" -) - -// PossibleMessageFilterTypeValues returns an array of possible values for the MessageFilterType const type. -func PossibleMessageFilterTypeValues() []MessageFilterType { - return []MessageFilterType{MessageFilterTypeExclude, MessageFilterTypeInclude, MessageFilterTypeNotSpecified} -} - -// OpenAuthenticationProviderType enumerates the values for open authentication provider type. -type OpenAuthenticationProviderType string - -const ( - // OpenAuthenticationProviderTypeAAD ... - OpenAuthenticationProviderTypeAAD OpenAuthenticationProviderType = "AAD" -) - -// PossibleOpenAuthenticationProviderTypeValues returns an array of possible values for the OpenAuthenticationProviderType const type. -func PossibleOpenAuthenticationProviderTypeValues() []OpenAuthenticationProviderType { - return []OpenAuthenticationProviderType{OpenAuthenticationProviderTypeAAD} -} - -// ParameterType enumerates the values for parameter type. -type ParameterType string - -const ( - // ParameterTypeArray ... - ParameterTypeArray ParameterType = "Array" - // ParameterTypeBool ... - ParameterTypeBool ParameterType = "Bool" - // ParameterTypeFloat ... - ParameterTypeFloat ParameterType = "Float" - // ParameterTypeInt ... - ParameterTypeInt ParameterType = "Int" - // ParameterTypeNotSpecified ... - ParameterTypeNotSpecified ParameterType = "NotSpecified" - // ParameterTypeObject ... - ParameterTypeObject ParameterType = "Object" - // ParameterTypeSecureObject ... - ParameterTypeSecureObject ParameterType = "SecureObject" - // ParameterTypeSecureString ... - ParameterTypeSecureString ParameterType = "SecureString" - // ParameterTypeString ... - ParameterTypeString ParameterType = "String" -) - -// PossibleParameterTypeValues returns an array of possible values for the ParameterType const type. -func PossibleParameterTypeValues() []ParameterType { - return []ParameterType{ParameterTypeArray, ParameterTypeBool, ParameterTypeFloat, ParameterTypeInt, ParameterTypeNotSpecified, ParameterTypeObject, ParameterTypeSecureObject, ParameterTypeSecureString, ParameterTypeString} -} - -// PartnerType enumerates the values for partner type. -type PartnerType string - -const ( - // PartnerTypeB2B ... - PartnerTypeB2B PartnerType = "B2B" - // PartnerTypeNotSpecified ... - PartnerTypeNotSpecified PartnerType = "NotSpecified" -) - -// PossiblePartnerTypeValues returns an array of possible values for the PartnerType const type. -func PossiblePartnerTypeValues() []PartnerType { - return []PartnerType{PartnerTypeB2B, PartnerTypeNotSpecified} -} - -// RecurrenceFrequency enumerates the values for recurrence frequency. -type RecurrenceFrequency string - -const ( - // RecurrenceFrequencyDay ... - RecurrenceFrequencyDay RecurrenceFrequency = "Day" - // RecurrenceFrequencyHour ... - RecurrenceFrequencyHour RecurrenceFrequency = "Hour" - // RecurrenceFrequencyMinute ... - RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" - // RecurrenceFrequencyMonth ... - RecurrenceFrequencyMonth RecurrenceFrequency = "Month" - // RecurrenceFrequencyNotSpecified ... - RecurrenceFrequencyNotSpecified RecurrenceFrequency = "NotSpecified" - // RecurrenceFrequencySecond ... - RecurrenceFrequencySecond RecurrenceFrequency = "Second" - // RecurrenceFrequencyWeek ... - RecurrenceFrequencyWeek RecurrenceFrequency = "Week" - // RecurrenceFrequencyYear ... - RecurrenceFrequencyYear RecurrenceFrequency = "Year" -) - -// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. -func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { - return []RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNotSpecified, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} -} - -// SchemaType enumerates the values for schema type. -type SchemaType string - -const ( - // SchemaTypeNotSpecified ... - SchemaTypeNotSpecified SchemaType = "NotSpecified" - // SchemaTypeXML ... - SchemaTypeXML SchemaType = "Xml" -) - -// PossibleSchemaTypeValues returns an array of possible values for the SchemaType const type. -func PossibleSchemaTypeValues() []SchemaType { - return []SchemaType{SchemaTypeNotSpecified, SchemaTypeXML} -} - -// SegmentTerminatorSuffix enumerates the values for segment terminator suffix. -type SegmentTerminatorSuffix string - -const ( - // SegmentTerminatorSuffixCR ... - SegmentTerminatorSuffixCR SegmentTerminatorSuffix = "CR" - // SegmentTerminatorSuffixCRLF ... - SegmentTerminatorSuffixCRLF SegmentTerminatorSuffix = "CRLF" - // SegmentTerminatorSuffixLF ... - SegmentTerminatorSuffixLF SegmentTerminatorSuffix = "LF" - // SegmentTerminatorSuffixNone ... - SegmentTerminatorSuffixNone SegmentTerminatorSuffix = "None" - // SegmentTerminatorSuffixNotSpecified ... - SegmentTerminatorSuffixNotSpecified SegmentTerminatorSuffix = "NotSpecified" -) - -// PossibleSegmentTerminatorSuffixValues returns an array of possible values for the SegmentTerminatorSuffix const type. -func PossibleSegmentTerminatorSuffixValues() []SegmentTerminatorSuffix { - return []SegmentTerminatorSuffix{SegmentTerminatorSuffixCR, SegmentTerminatorSuffixCRLF, SegmentTerminatorSuffixLF, SegmentTerminatorSuffixNone, SegmentTerminatorSuffixNotSpecified} -} - -// SigningAlgorithm enumerates the values for signing algorithm. -type SigningAlgorithm string - -const ( - // SigningAlgorithmDefault ... - SigningAlgorithmDefault SigningAlgorithm = "Default" - // SigningAlgorithmNotSpecified ... - SigningAlgorithmNotSpecified SigningAlgorithm = "NotSpecified" - // SigningAlgorithmSHA1 ... - SigningAlgorithmSHA1 SigningAlgorithm = "SHA1" - // SigningAlgorithmSHA2256 ... - SigningAlgorithmSHA2256 SigningAlgorithm = "SHA2256" - // SigningAlgorithmSHA2384 ... - SigningAlgorithmSHA2384 SigningAlgorithm = "SHA2384" - // SigningAlgorithmSHA2512 ... - SigningAlgorithmSHA2512 SigningAlgorithm = "SHA2512" -) - -// PossibleSigningAlgorithmValues returns an array of possible values for the SigningAlgorithm const type. -func PossibleSigningAlgorithmValues() []SigningAlgorithm { - return []SigningAlgorithm{SigningAlgorithmDefault, SigningAlgorithmNotSpecified, SigningAlgorithmSHA1, SigningAlgorithmSHA2256, SigningAlgorithmSHA2384, SigningAlgorithmSHA2512} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // SkuNameBasic ... - SkuNameBasic SkuName = "Basic" - // SkuNameFree ... - SkuNameFree SkuName = "Free" - // SkuNameNotSpecified ... - SkuNameNotSpecified SkuName = "NotSpecified" - // SkuNamePremium ... - SkuNamePremium SkuName = "Premium" - // SkuNameShared ... - SkuNameShared SkuName = "Shared" - // SkuNameStandard ... - SkuNameStandard SkuName = "Standard" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{SkuNameBasic, SkuNameFree, SkuNameNotSpecified, SkuNamePremium, SkuNameShared, SkuNameStandard} -} - -// StatusAnnotation enumerates the values for status annotation. -type StatusAnnotation string - -const ( - // StatusAnnotationNotSpecified ... - StatusAnnotationNotSpecified StatusAnnotation = "NotSpecified" - // StatusAnnotationPreview ... - StatusAnnotationPreview StatusAnnotation = "Preview" - // StatusAnnotationProduction ... - StatusAnnotationProduction StatusAnnotation = "Production" -) - -// PossibleStatusAnnotationValues returns an array of possible values for the StatusAnnotation const type. -func PossibleStatusAnnotationValues() []StatusAnnotation { - return []StatusAnnotation{StatusAnnotationNotSpecified, StatusAnnotationPreview, StatusAnnotationProduction} -} - -// SwaggerSchemaType enumerates the values for swagger schema type. -type SwaggerSchemaType string - -const ( - // SwaggerSchemaTypeArray ... - SwaggerSchemaTypeArray SwaggerSchemaType = "Array" - // SwaggerSchemaTypeBoolean ... - SwaggerSchemaTypeBoolean SwaggerSchemaType = "Boolean" - // SwaggerSchemaTypeFile ... - SwaggerSchemaTypeFile SwaggerSchemaType = "File" - // SwaggerSchemaTypeInteger ... - SwaggerSchemaTypeInteger SwaggerSchemaType = "Integer" - // SwaggerSchemaTypeNull ... - SwaggerSchemaTypeNull SwaggerSchemaType = "Null" - // SwaggerSchemaTypeNumber ... - SwaggerSchemaTypeNumber SwaggerSchemaType = "Number" - // SwaggerSchemaTypeObject ... - SwaggerSchemaTypeObject SwaggerSchemaType = "Object" - // SwaggerSchemaTypeString ... - SwaggerSchemaTypeString SwaggerSchemaType = "String" -) - -// PossibleSwaggerSchemaTypeValues returns an array of possible values for the SwaggerSchemaType const type. -func PossibleSwaggerSchemaTypeValues() []SwaggerSchemaType { - return []SwaggerSchemaType{SwaggerSchemaTypeArray, SwaggerSchemaTypeBoolean, SwaggerSchemaTypeFile, SwaggerSchemaTypeInteger, SwaggerSchemaTypeNull, SwaggerSchemaTypeNumber, SwaggerSchemaTypeObject, SwaggerSchemaTypeString} -} - -// TrackEventsOperationOptions enumerates the values for track events operation options. -type TrackEventsOperationOptions string - -const ( - // TrackEventsOperationOptionsDisableSourceInfoEnrich ... - TrackEventsOperationOptionsDisableSourceInfoEnrich TrackEventsOperationOptions = "DisableSourceInfoEnrich" - // TrackEventsOperationOptionsNone ... - TrackEventsOperationOptionsNone TrackEventsOperationOptions = "None" -) - -// PossibleTrackEventsOperationOptionsValues returns an array of possible values for the TrackEventsOperationOptions const type. -func PossibleTrackEventsOperationOptionsValues() []TrackEventsOperationOptions { - return []TrackEventsOperationOptions{TrackEventsOperationOptionsDisableSourceInfoEnrich, TrackEventsOperationOptionsNone} -} - -// TrackingRecordType enumerates the values for tracking record type. -type TrackingRecordType string - -const ( - // TrackingRecordTypeAS2MDN ... - TrackingRecordTypeAS2MDN TrackingRecordType = "AS2MDN" - // TrackingRecordTypeAS2Message ... - TrackingRecordTypeAS2Message TrackingRecordType = "AS2Message" - // TrackingRecordTypeCustom ... - TrackingRecordTypeCustom TrackingRecordType = "Custom" - // TrackingRecordTypeEdifactFunctionalGroup ... - TrackingRecordTypeEdifactFunctionalGroup TrackingRecordType = "EdifactFunctionalGroup" - // TrackingRecordTypeEdifactFunctionalGroupAcknowledgment ... - TrackingRecordTypeEdifactFunctionalGroupAcknowledgment TrackingRecordType = "EdifactFunctionalGroupAcknowledgment" - // TrackingRecordTypeEdifactInterchange ... - TrackingRecordTypeEdifactInterchange TrackingRecordType = "EdifactInterchange" - // TrackingRecordTypeEdifactInterchangeAcknowledgment ... - TrackingRecordTypeEdifactInterchangeAcknowledgment TrackingRecordType = "EdifactInterchangeAcknowledgment" - // TrackingRecordTypeEdifactTransactionSet ... - TrackingRecordTypeEdifactTransactionSet TrackingRecordType = "EdifactTransactionSet" - // TrackingRecordTypeEdifactTransactionSetAcknowledgment ... - TrackingRecordTypeEdifactTransactionSetAcknowledgment TrackingRecordType = "EdifactTransactionSetAcknowledgment" - // TrackingRecordTypeNotSpecified ... - TrackingRecordTypeNotSpecified TrackingRecordType = "NotSpecified" - // TrackingRecordTypeX12FunctionalGroup ... - TrackingRecordTypeX12FunctionalGroup TrackingRecordType = "X12FunctionalGroup" - // TrackingRecordTypeX12FunctionalGroupAcknowledgment ... - TrackingRecordTypeX12FunctionalGroupAcknowledgment TrackingRecordType = "X12FunctionalGroupAcknowledgment" - // TrackingRecordTypeX12Interchange ... - TrackingRecordTypeX12Interchange TrackingRecordType = "X12Interchange" - // TrackingRecordTypeX12InterchangeAcknowledgment ... - TrackingRecordTypeX12InterchangeAcknowledgment TrackingRecordType = "X12InterchangeAcknowledgment" - // TrackingRecordTypeX12TransactionSet ... - TrackingRecordTypeX12TransactionSet TrackingRecordType = "X12TransactionSet" - // TrackingRecordTypeX12TransactionSetAcknowledgment ... - TrackingRecordTypeX12TransactionSetAcknowledgment TrackingRecordType = "X12TransactionSetAcknowledgment" -) - -// PossibleTrackingRecordTypeValues returns an array of possible values for the TrackingRecordType const type. -func PossibleTrackingRecordTypeValues() []TrackingRecordType { - return []TrackingRecordType{TrackingRecordTypeAS2MDN, TrackingRecordTypeAS2Message, TrackingRecordTypeCustom, TrackingRecordTypeEdifactFunctionalGroup, TrackingRecordTypeEdifactFunctionalGroupAcknowledgment, TrackingRecordTypeEdifactInterchange, TrackingRecordTypeEdifactInterchangeAcknowledgment, TrackingRecordTypeEdifactTransactionSet, TrackingRecordTypeEdifactTransactionSetAcknowledgment, TrackingRecordTypeNotSpecified, TrackingRecordTypeX12FunctionalGroup, TrackingRecordTypeX12FunctionalGroupAcknowledgment, TrackingRecordTypeX12Interchange, TrackingRecordTypeX12InterchangeAcknowledgment, TrackingRecordTypeX12TransactionSet, TrackingRecordTypeX12TransactionSetAcknowledgment} -} - -// TrailingSeparatorPolicy enumerates the values for trailing separator policy. -type TrailingSeparatorPolicy string - -const ( - // TrailingSeparatorPolicyMandatory ... - TrailingSeparatorPolicyMandatory TrailingSeparatorPolicy = "Mandatory" - // TrailingSeparatorPolicyNotAllowed ... - TrailingSeparatorPolicyNotAllowed TrailingSeparatorPolicy = "NotAllowed" - // TrailingSeparatorPolicyNotSpecified ... - TrailingSeparatorPolicyNotSpecified TrailingSeparatorPolicy = "NotSpecified" - // TrailingSeparatorPolicyOptional ... - TrailingSeparatorPolicyOptional TrailingSeparatorPolicy = "Optional" -) - -// PossibleTrailingSeparatorPolicyValues returns an array of possible values for the TrailingSeparatorPolicy const type. -func PossibleTrailingSeparatorPolicyValues() []TrailingSeparatorPolicy { - return []TrailingSeparatorPolicy{TrailingSeparatorPolicyMandatory, TrailingSeparatorPolicyNotAllowed, TrailingSeparatorPolicyNotSpecified, TrailingSeparatorPolicyOptional} -} - -// UsageIndicator enumerates the values for usage indicator. -type UsageIndicator string - -const ( - // UsageIndicatorInformation ... - UsageIndicatorInformation UsageIndicator = "Information" - // UsageIndicatorNotSpecified ... - UsageIndicatorNotSpecified UsageIndicator = "NotSpecified" - // UsageIndicatorProduction ... - UsageIndicatorProduction UsageIndicator = "Production" - // UsageIndicatorTest ... - UsageIndicatorTest UsageIndicator = "Test" -) - -// PossibleUsageIndicatorValues returns an array of possible values for the UsageIndicator const type. -func PossibleUsageIndicatorValues() []UsageIndicator { - return []UsageIndicator{UsageIndicatorInformation, UsageIndicatorNotSpecified, UsageIndicatorProduction, UsageIndicatorTest} -} - -// WorkflowProvisioningState enumerates the values for workflow provisioning state. -type WorkflowProvisioningState string - -const ( - // WorkflowProvisioningStateAccepted ... - WorkflowProvisioningStateAccepted WorkflowProvisioningState = "Accepted" - // WorkflowProvisioningStateCanceled ... - WorkflowProvisioningStateCanceled WorkflowProvisioningState = "Canceled" - // WorkflowProvisioningStateCompleted ... - WorkflowProvisioningStateCompleted WorkflowProvisioningState = "Completed" - // WorkflowProvisioningStateCreated ... - WorkflowProvisioningStateCreated WorkflowProvisioningState = "Created" - // WorkflowProvisioningStateCreating ... - WorkflowProvisioningStateCreating WorkflowProvisioningState = "Creating" - // WorkflowProvisioningStateDeleted ... - WorkflowProvisioningStateDeleted WorkflowProvisioningState = "Deleted" - // WorkflowProvisioningStateDeleting ... - WorkflowProvisioningStateDeleting WorkflowProvisioningState = "Deleting" - // WorkflowProvisioningStateFailed ... - WorkflowProvisioningStateFailed WorkflowProvisioningState = "Failed" - // WorkflowProvisioningStateInProgress ... - WorkflowProvisioningStateInProgress WorkflowProvisioningState = "InProgress" - // WorkflowProvisioningStateMoving ... - WorkflowProvisioningStateMoving WorkflowProvisioningState = "Moving" - // WorkflowProvisioningStateNotSpecified ... - WorkflowProvisioningStateNotSpecified WorkflowProvisioningState = "NotSpecified" - // WorkflowProvisioningStatePending ... - WorkflowProvisioningStatePending WorkflowProvisioningState = "Pending" - // WorkflowProvisioningStateReady ... - WorkflowProvisioningStateReady WorkflowProvisioningState = "Ready" - // WorkflowProvisioningStateRegistered ... - WorkflowProvisioningStateRegistered WorkflowProvisioningState = "Registered" - // WorkflowProvisioningStateRegistering ... - WorkflowProvisioningStateRegistering WorkflowProvisioningState = "Registering" - // WorkflowProvisioningStateRenewing ... - WorkflowProvisioningStateRenewing WorkflowProvisioningState = "Renewing" - // WorkflowProvisioningStateRunning ... - WorkflowProvisioningStateRunning WorkflowProvisioningState = "Running" - // WorkflowProvisioningStateSucceeded ... - WorkflowProvisioningStateSucceeded WorkflowProvisioningState = "Succeeded" - // WorkflowProvisioningStateUnregistered ... - WorkflowProvisioningStateUnregistered WorkflowProvisioningState = "Unregistered" - // WorkflowProvisioningStateUnregistering ... - WorkflowProvisioningStateUnregistering WorkflowProvisioningState = "Unregistering" - // WorkflowProvisioningStateUpdating ... - WorkflowProvisioningStateUpdating WorkflowProvisioningState = "Updating" - // WorkflowProvisioningStateWaiting ... - WorkflowProvisioningStateWaiting WorkflowProvisioningState = "Waiting" -) - -// PossibleWorkflowProvisioningStateValues returns an array of possible values for the WorkflowProvisioningState const type. -func PossibleWorkflowProvisioningStateValues() []WorkflowProvisioningState { - return []WorkflowProvisioningState{WorkflowProvisioningStateAccepted, WorkflowProvisioningStateCanceled, WorkflowProvisioningStateCompleted, WorkflowProvisioningStateCreated, WorkflowProvisioningStateCreating, WorkflowProvisioningStateDeleted, WorkflowProvisioningStateDeleting, WorkflowProvisioningStateFailed, WorkflowProvisioningStateInProgress, WorkflowProvisioningStateMoving, WorkflowProvisioningStateNotSpecified, WorkflowProvisioningStatePending, WorkflowProvisioningStateReady, WorkflowProvisioningStateRegistered, WorkflowProvisioningStateRegistering, WorkflowProvisioningStateRenewing, WorkflowProvisioningStateRunning, WorkflowProvisioningStateSucceeded, WorkflowProvisioningStateUnregistered, WorkflowProvisioningStateUnregistering, WorkflowProvisioningStateUpdating, WorkflowProvisioningStateWaiting} -} - -// WorkflowState enumerates the values for workflow state. -type WorkflowState string - -const ( - // WorkflowStateCompleted ... - WorkflowStateCompleted WorkflowState = "Completed" - // WorkflowStateDeleted ... - WorkflowStateDeleted WorkflowState = "Deleted" - // WorkflowStateDisabled ... - WorkflowStateDisabled WorkflowState = "Disabled" - // WorkflowStateEnabled ... - WorkflowStateEnabled WorkflowState = "Enabled" - // WorkflowStateNotSpecified ... - WorkflowStateNotSpecified WorkflowState = "NotSpecified" - // WorkflowStateSuspended ... - WorkflowStateSuspended WorkflowState = "Suspended" -) - -// PossibleWorkflowStateValues returns an array of possible values for the WorkflowState const type. -func PossibleWorkflowStateValues() []WorkflowState { - return []WorkflowState{WorkflowStateCompleted, WorkflowStateDeleted, WorkflowStateDisabled, WorkflowStateEnabled, WorkflowStateNotSpecified, WorkflowStateSuspended} -} - -// WorkflowStatus enumerates the values for workflow status. -type WorkflowStatus string - -const ( - // WorkflowStatusAborted ... - WorkflowStatusAborted WorkflowStatus = "Aborted" - // WorkflowStatusCancelled ... - WorkflowStatusCancelled WorkflowStatus = "Cancelled" - // WorkflowStatusFailed ... - WorkflowStatusFailed WorkflowStatus = "Failed" - // WorkflowStatusFaulted ... - WorkflowStatusFaulted WorkflowStatus = "Faulted" - // WorkflowStatusIgnored ... - WorkflowStatusIgnored WorkflowStatus = "Ignored" - // WorkflowStatusNotSpecified ... - WorkflowStatusNotSpecified WorkflowStatus = "NotSpecified" - // WorkflowStatusPaused ... - WorkflowStatusPaused WorkflowStatus = "Paused" - // WorkflowStatusRunning ... - WorkflowStatusRunning WorkflowStatus = "Running" - // WorkflowStatusSkipped ... - WorkflowStatusSkipped WorkflowStatus = "Skipped" - // WorkflowStatusSucceeded ... - WorkflowStatusSucceeded WorkflowStatus = "Succeeded" - // WorkflowStatusSuspended ... - WorkflowStatusSuspended WorkflowStatus = "Suspended" - // WorkflowStatusTimedOut ... - WorkflowStatusTimedOut WorkflowStatus = "TimedOut" - // WorkflowStatusWaiting ... - WorkflowStatusWaiting WorkflowStatus = "Waiting" -) - -// PossibleWorkflowStatusValues returns an array of possible values for the WorkflowStatus const type. -func PossibleWorkflowStatusValues() []WorkflowStatus { - return []WorkflowStatus{WorkflowStatusAborted, WorkflowStatusCancelled, WorkflowStatusFailed, WorkflowStatusFaulted, WorkflowStatusIgnored, WorkflowStatusNotSpecified, WorkflowStatusPaused, WorkflowStatusRunning, WorkflowStatusSkipped, WorkflowStatusSucceeded, WorkflowStatusSuspended, WorkflowStatusTimedOut, WorkflowStatusWaiting} -} - -// WorkflowTriggerProvisioningState enumerates the values for workflow trigger provisioning state. -type WorkflowTriggerProvisioningState string - -const ( - // WorkflowTriggerProvisioningStateAccepted ... - WorkflowTriggerProvisioningStateAccepted WorkflowTriggerProvisioningState = "Accepted" - // WorkflowTriggerProvisioningStateCanceled ... - WorkflowTriggerProvisioningStateCanceled WorkflowTriggerProvisioningState = "Canceled" - // WorkflowTriggerProvisioningStateCompleted ... - WorkflowTriggerProvisioningStateCompleted WorkflowTriggerProvisioningState = "Completed" - // WorkflowTriggerProvisioningStateCreated ... - WorkflowTriggerProvisioningStateCreated WorkflowTriggerProvisioningState = "Created" - // WorkflowTriggerProvisioningStateCreating ... - WorkflowTriggerProvisioningStateCreating WorkflowTriggerProvisioningState = "Creating" - // WorkflowTriggerProvisioningStateDeleted ... - WorkflowTriggerProvisioningStateDeleted WorkflowTriggerProvisioningState = "Deleted" - // WorkflowTriggerProvisioningStateDeleting ... - WorkflowTriggerProvisioningStateDeleting WorkflowTriggerProvisioningState = "Deleting" - // WorkflowTriggerProvisioningStateFailed ... - WorkflowTriggerProvisioningStateFailed WorkflowTriggerProvisioningState = "Failed" - // WorkflowTriggerProvisioningStateMoving ... - WorkflowTriggerProvisioningStateMoving WorkflowTriggerProvisioningState = "Moving" - // WorkflowTriggerProvisioningStateNotSpecified ... - WorkflowTriggerProvisioningStateNotSpecified WorkflowTriggerProvisioningState = "NotSpecified" - // WorkflowTriggerProvisioningStateReady ... - WorkflowTriggerProvisioningStateReady WorkflowTriggerProvisioningState = "Ready" - // WorkflowTriggerProvisioningStateRegistered ... - WorkflowTriggerProvisioningStateRegistered WorkflowTriggerProvisioningState = "Registered" - // WorkflowTriggerProvisioningStateRegistering ... - WorkflowTriggerProvisioningStateRegistering WorkflowTriggerProvisioningState = "Registering" - // WorkflowTriggerProvisioningStateRunning ... - WorkflowTriggerProvisioningStateRunning WorkflowTriggerProvisioningState = "Running" - // WorkflowTriggerProvisioningStateSucceeded ... - WorkflowTriggerProvisioningStateSucceeded WorkflowTriggerProvisioningState = "Succeeded" - // WorkflowTriggerProvisioningStateUnregistered ... - WorkflowTriggerProvisioningStateUnregistered WorkflowTriggerProvisioningState = "Unregistered" - // WorkflowTriggerProvisioningStateUnregistering ... - WorkflowTriggerProvisioningStateUnregistering WorkflowTriggerProvisioningState = "Unregistering" - // WorkflowTriggerProvisioningStateUpdating ... - WorkflowTriggerProvisioningStateUpdating WorkflowTriggerProvisioningState = "Updating" -) - -// PossibleWorkflowTriggerProvisioningStateValues returns an array of possible values for the WorkflowTriggerProvisioningState const type. -func PossibleWorkflowTriggerProvisioningStateValues() []WorkflowTriggerProvisioningState { - return []WorkflowTriggerProvisioningState{WorkflowTriggerProvisioningStateAccepted, WorkflowTriggerProvisioningStateCanceled, WorkflowTriggerProvisioningStateCompleted, WorkflowTriggerProvisioningStateCreated, WorkflowTriggerProvisioningStateCreating, WorkflowTriggerProvisioningStateDeleted, WorkflowTriggerProvisioningStateDeleting, WorkflowTriggerProvisioningStateFailed, WorkflowTriggerProvisioningStateMoving, WorkflowTriggerProvisioningStateNotSpecified, WorkflowTriggerProvisioningStateReady, WorkflowTriggerProvisioningStateRegistered, WorkflowTriggerProvisioningStateRegistering, WorkflowTriggerProvisioningStateRunning, WorkflowTriggerProvisioningStateSucceeded, WorkflowTriggerProvisioningStateUnregistered, WorkflowTriggerProvisioningStateUnregistering, WorkflowTriggerProvisioningStateUpdating} -} - -// WsdlImportMethod enumerates the values for wsdl import method. -type WsdlImportMethod string - -const ( - // WsdlImportMethodNotSpecified ... - WsdlImportMethodNotSpecified WsdlImportMethod = "NotSpecified" - // WsdlImportMethodSoapPassThrough ... - WsdlImportMethodSoapPassThrough WsdlImportMethod = "SoapPassThrough" - // WsdlImportMethodSoapToRest ... - WsdlImportMethodSoapToRest WsdlImportMethod = "SoapToRest" -) - -// PossibleWsdlImportMethodValues returns an array of possible values for the WsdlImportMethod const type. -func PossibleWsdlImportMethodValues() []WsdlImportMethod { - return []WsdlImportMethod{WsdlImportMethodNotSpecified, WsdlImportMethodSoapPassThrough, WsdlImportMethodSoapToRest} -} - -// X12CharacterSet enumerates the values for x12 character set. -type X12CharacterSet string - -const ( - // X12CharacterSetBasic ... - X12CharacterSetBasic X12CharacterSet = "Basic" - // X12CharacterSetExtended ... - X12CharacterSetExtended X12CharacterSet = "Extended" - // X12CharacterSetNotSpecified ... - X12CharacterSetNotSpecified X12CharacterSet = "NotSpecified" - // X12CharacterSetUTF8 ... - X12CharacterSetUTF8 X12CharacterSet = "UTF8" -) - -// PossibleX12CharacterSetValues returns an array of possible values for the X12CharacterSet const type. -func PossibleX12CharacterSetValues() []X12CharacterSet { - return []X12CharacterSet{X12CharacterSetBasic, X12CharacterSetExtended, X12CharacterSetNotSpecified, X12CharacterSetUTF8} -} - -// X12DateFormat enumerates the values for x12 date format. -type X12DateFormat string - -const ( - // X12DateFormatCCYYMMDD ... - X12DateFormatCCYYMMDD X12DateFormat = "CCYYMMDD" - // X12DateFormatNotSpecified ... - X12DateFormatNotSpecified X12DateFormat = "NotSpecified" - // X12DateFormatYYMMDD ... - X12DateFormatYYMMDD X12DateFormat = "YYMMDD" -) - -// PossibleX12DateFormatValues returns an array of possible values for the X12DateFormat const type. -func PossibleX12DateFormatValues() []X12DateFormat { - return []X12DateFormat{X12DateFormatCCYYMMDD, X12DateFormatNotSpecified, X12DateFormatYYMMDD} -} - -// X12TimeFormat enumerates the values for x12 time format. -type X12TimeFormat string - -const ( - // X12TimeFormatHHMM ... - X12TimeFormatHHMM X12TimeFormat = "HHMM" - // X12TimeFormatHHMMSS ... - X12TimeFormatHHMMSS X12TimeFormat = "HHMMSS" - // X12TimeFormatHHMMSSd ... - X12TimeFormatHHMMSSd X12TimeFormat = "HHMMSSd" - // X12TimeFormatHHMMSSdd ... - X12TimeFormatHHMMSSdd X12TimeFormat = "HHMMSSdd" - // X12TimeFormatNotSpecified ... - X12TimeFormatNotSpecified X12TimeFormat = "NotSpecified" -) - -// PossibleX12TimeFormatValues returns an array of possible values for the X12TimeFormat const type. -func PossibleX12TimeFormatValues() []X12TimeFormat { - return []X12TimeFormat{X12TimeFormatHHMM, X12TimeFormatHHMMSS, X12TimeFormatHHMMSSd, X12TimeFormatHHMMSSdd, X12TimeFormatNotSpecified} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountagreements.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountagreements.go deleted file mode 100644 index 59bd44134ce6..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountagreements.go +++ /dev/null @@ -1,910 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IntegrationAccountAgreementsClient is the REST API for Azure Logic Apps. -type IntegrationAccountAgreementsClient struct { - BaseClient -} - -// NewIntegrationAccountAgreementsClient creates an instance of the IntegrationAccountAgreementsClient client. -func NewIntegrationAccountAgreementsClient(subscriptionID string) IntegrationAccountAgreementsClient { - return NewIntegrationAccountAgreementsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationAccountAgreementsClientWithBaseURI creates an instance of the IntegrationAccountAgreementsClient -// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI -// (sovereign clouds, Azure stack). -func NewIntegrationAccountAgreementsClientWithBaseURI(baseURI string, subscriptionID string) IntegrationAccountAgreementsClient { - return IntegrationAccountAgreementsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an integration account agreement. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// agreementName - the integration account agreement name. -// agreement - the integration account agreement. -func (client IntegrationAccountAgreementsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, integrationAccountName string, agreementName string, agreement IntegrationAccountAgreement) (result IntegrationAccountAgreement, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountAgreementsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: agreement, - Constraints: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.HostPartner", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.GuestPartner", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.HostIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.HostIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.HostIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.GuestIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.GuestIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.GuestIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.NeedMDN", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SignMDN", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SendMDNAsynchronously", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SignOutboundMDNIfOptional", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SendInboundMDNToMessageBox", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.OverrideGroupSigningCertificate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNRRForInboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNRRForInboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNRRForOutboundMDN", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNRRForOutboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNRRForOutboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNRRForInboundMDN", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.OverrideMessageProperties", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.EncryptMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.SignMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CompressMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.InterchangeDuplicatesValidityDays", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnSend", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnReceive", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.MessageContentType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransmitFileNameInMimeHeader", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.FileNameTemplate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.SuspendMessageOnFileNameGenerationError", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.AutogenerateFileName", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ErrorSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ErrorSettings.SuspendDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ErrorSettings.ResendIfMDNNotReceived", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.NeedMDN", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SignMDN", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SendMDNAsynchronously", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SignOutboundMDNIfOptional", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SendInboundMDNToMessageBox", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.OverrideGroupSigningCertificate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNRRForInboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNRRForInboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNRRForOutboundMDN", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNRRForOutboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNRRForOutboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNRRForInboundMDN", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.OverrideMessageProperties", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.EncryptMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.SignMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CompressMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.InterchangeDuplicatesValidityDays", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnSend", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnReceive", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.MessageContentType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.TransmitFileNameInMimeHeader", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.FileNameTemplate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.SuspendMessageOnFileNameGenerationError", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.AutogenerateFileName", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ErrorSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ErrorSettings.SuspendDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ErrorSettings.ResendIfMDNNotReceived", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateEDITypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateXSDTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.ReplaceSeparatorsInPayload", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.ReplaceCharacter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ControlStandardsID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.UseControlStandardsIDAsRepetitionCharacter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.SenderApplicationID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ReceiverApplicationID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ControlVersionNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderAgencyCode", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderVersion", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedImplementationAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchImplementationAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SecuritySettings.AuthorizationQualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SecuritySettings.SecurityQualifier", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.ConvertImpliedDecimal", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.ValidateEDITypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.ValidateXSDTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.ReplaceSeparatorsInPayload", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.ReplaceCharacter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.ControlStandardsID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.UseControlStandardsIDAsRepetitionCharacter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.SenderApplicationID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.ReceiverApplicationID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.ControlVersionNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderAgencyCode", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderVersion", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedImplementationAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchImplementationAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SecuritySettings.AuthorizationQualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SecuritySettings.SecurityQualifier", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.ConvertImpliedDecimal", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateEDITypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateXSDTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.ProtocolVersion", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.ReleaseIndicator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.RepetitionSeparator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ApplyDelimiterStringAdvice", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.CreateGroupingSegments", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.IsTestInterchange", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.ValidateEDITypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.ValidateXSDTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.ProtocolVersion", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.ReleaseIndicator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.RepetitionSeparator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.ApplyDelimiterStringAdvice", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.CreateGroupingSegments", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.IsTestInterchange", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("logic.IntegrationAccountAgreementsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, integrationAccountName, agreementName, agreement) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IntegrationAccountAgreementsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, agreementName string, agreement IntegrationAccountAgreement) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agreementName": autorest.Encode("path", agreementName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}", pathParameters), - autorest.WithJSON(agreement), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountAgreementsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client IntegrationAccountAgreementsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountAgreement, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an integration account agreement. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// agreementName - the integration account agreement name. -func (client IntegrationAccountAgreementsClient) Delete(ctx context.Context, resourceGroupName string, integrationAccountName string, agreementName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountAgreementsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, integrationAccountName, agreementName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationAccountAgreementsClient) DeletePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, agreementName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agreementName": autorest.Encode("path", agreementName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountAgreementsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client IntegrationAccountAgreementsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an integration account agreement. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// agreementName - the integration account agreement name. -func (client IntegrationAccountAgreementsClient) Get(ctx context.Context, resourceGroupName string, integrationAccountName string, agreementName string) (result IntegrationAccountAgreement, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountAgreementsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, integrationAccountName, agreementName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationAccountAgreementsClient) GetPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, agreementName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agreementName": autorest.Encode("path", agreementName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountAgreementsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IntegrationAccountAgreementsClient) GetResponder(resp *http.Response) (result IntegrationAccountAgreement, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of integration account agreements. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// top - the number of items to be included in the result. -// filter - the filter to apply on the operation. Options for filters include: AgreementType. -func (client IntegrationAccountAgreementsClient) List(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountAgreementListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountAgreementsClient.List") - defer func() { - sc := -1 - if result.iaalr.Response.Response != nil { - sc = result.iaalr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, integrationAccountName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.iaalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "List", resp, "Failure sending request") - return - } - - result.iaalr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "List", resp, "Failure responding to request") - return - } - if result.iaalr.hasNextLink() && result.iaalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationAccountAgreementsClient) ListPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountAgreementsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client IntegrationAccountAgreementsClient) ListResponder(resp *http.Response) (result IntegrationAccountAgreementListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client IntegrationAccountAgreementsClient) listNextResults(ctx context.Context, lastResults IntegrationAccountAgreementListResult) (result IntegrationAccountAgreementListResult, err error) { - req, err := lastResults.integrationAccountAgreementListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client IntegrationAccountAgreementsClient) ListComplete(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountAgreementListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountAgreementsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, integrationAccountName, top, filter) - return -} - -// ListContentCallbackURL get the content callback url. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// agreementName - the integration account agreement name. -func (client IntegrationAccountAgreementsClient) ListContentCallbackURL(ctx context.Context, resourceGroupName string, integrationAccountName string, agreementName string, listContentCallbackURL GetCallbackURLParameters) (result WorkflowTriggerCallbackURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountAgreementsClient.ListContentCallbackURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListContentCallbackURLPreparer(ctx, resourceGroupName, integrationAccountName, agreementName, listContentCallbackURL) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "ListContentCallbackURL", nil, "Failure preparing request") - return - } - - resp, err := client.ListContentCallbackURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "ListContentCallbackURL", resp, "Failure sending request") - return - } - - result, err = client.ListContentCallbackURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAgreementsClient", "ListContentCallbackURL", resp, "Failure responding to request") - return - } - - return -} - -// ListContentCallbackURLPreparer prepares the ListContentCallbackURL request. -func (client IntegrationAccountAgreementsClient) ListContentCallbackURLPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, agreementName string, listContentCallbackURL GetCallbackURLParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agreementName": autorest.Encode("path", agreementName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}/listContentCallbackUrl", pathParameters), - autorest.WithJSON(listContentCallbackURL), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListContentCallbackURLSender sends the ListContentCallbackURL request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountAgreementsClient) ListContentCallbackURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListContentCallbackURLResponder handles the response to the ListContentCallbackURL request. The method always -// closes the http.Response Body. -func (client IntegrationAccountAgreementsClient) ListContentCallbackURLResponder(resp *http.Response) (result WorkflowTriggerCallbackURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountassemblies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountassemblies.go deleted file mode 100644 index 783ff1fd02a1..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountassemblies.go +++ /dev/null @@ -1,430 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IntegrationAccountAssembliesClient is the REST API for Azure Logic Apps. -type IntegrationAccountAssembliesClient struct { - BaseClient -} - -// NewIntegrationAccountAssembliesClient creates an instance of the IntegrationAccountAssembliesClient client. -func NewIntegrationAccountAssembliesClient(subscriptionID string) IntegrationAccountAssembliesClient { - return NewIntegrationAccountAssembliesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationAccountAssembliesClientWithBaseURI creates an instance of the IntegrationAccountAssembliesClient -// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI -// (sovereign clouds, Azure stack). -func NewIntegrationAccountAssembliesClientWithBaseURI(baseURI string, subscriptionID string) IntegrationAccountAssembliesClient { - return IntegrationAccountAssembliesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an assembly for an integration account. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// assemblyArtifactName - the assembly artifact name. -// assemblyArtifact - the assembly artifact. -func (client IntegrationAccountAssembliesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, integrationAccountName string, assemblyArtifactName string, assemblyArtifact AssemblyDefinition) (result AssemblyDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountAssembliesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: assemblyArtifact, - Constraints: []validation.Constraint{{Target: "assemblyArtifact.Properties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "assemblyArtifact.Properties.AssemblyName", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("logic.IntegrationAccountAssembliesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, integrationAccountName, assemblyArtifactName, assemblyArtifact) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAssembliesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAssembliesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAssembliesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IntegrationAccountAssembliesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, assemblyArtifactName string, assemblyArtifact AssemblyDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "assemblyArtifactName": autorest.Encode("path", assemblyArtifactName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/assemblies/{assemblyArtifactName}", pathParameters), - autorest.WithJSON(assemblyArtifact), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountAssembliesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client IntegrationAccountAssembliesClient) CreateOrUpdateResponder(resp *http.Response) (result AssemblyDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an assembly for an integration account. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// assemblyArtifactName - the assembly artifact name. -func (client IntegrationAccountAssembliesClient) Delete(ctx context.Context, resourceGroupName string, integrationAccountName string, assemblyArtifactName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountAssembliesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, integrationAccountName, assemblyArtifactName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAssembliesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAssembliesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAssembliesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationAccountAssembliesClient) DeletePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, assemblyArtifactName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "assemblyArtifactName": autorest.Encode("path", assemblyArtifactName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/assemblies/{assemblyArtifactName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountAssembliesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client IntegrationAccountAssembliesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an assembly for an integration account. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// assemblyArtifactName - the assembly artifact name. -func (client IntegrationAccountAssembliesClient) Get(ctx context.Context, resourceGroupName string, integrationAccountName string, assemblyArtifactName string) (result AssemblyDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountAssembliesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, integrationAccountName, assemblyArtifactName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAssembliesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAssembliesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAssembliesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationAccountAssembliesClient) GetPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, assemblyArtifactName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "assemblyArtifactName": autorest.Encode("path", assemblyArtifactName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/assemblies/{assemblyArtifactName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountAssembliesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IntegrationAccountAssembliesClient) GetResponder(resp *http.Response) (result AssemblyDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list the assemblies for an integration account. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -func (client IntegrationAccountAssembliesClient) List(ctx context.Context, resourceGroupName string, integrationAccountName string) (result AssemblyCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountAssembliesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, integrationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAssembliesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAssembliesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAssembliesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationAccountAssembliesClient) ListPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/assemblies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountAssembliesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client IntegrationAccountAssembliesClient) ListResponder(resp *http.Response) (result AssemblyCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListContentCallbackURL get the content callback url for an integration account assembly. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// assemblyArtifactName - the assembly artifact name. -func (client IntegrationAccountAssembliesClient) ListContentCallbackURL(ctx context.Context, resourceGroupName string, integrationAccountName string, assemblyArtifactName string) (result WorkflowTriggerCallbackURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountAssembliesClient.ListContentCallbackURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListContentCallbackURLPreparer(ctx, resourceGroupName, integrationAccountName, assemblyArtifactName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAssembliesClient", "ListContentCallbackURL", nil, "Failure preparing request") - return - } - - resp, err := client.ListContentCallbackURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAssembliesClient", "ListContentCallbackURL", resp, "Failure sending request") - return - } - - result, err = client.ListContentCallbackURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountAssembliesClient", "ListContentCallbackURL", resp, "Failure responding to request") - return - } - - return -} - -// ListContentCallbackURLPreparer prepares the ListContentCallbackURL request. -func (client IntegrationAccountAssembliesClient) ListContentCallbackURLPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, assemblyArtifactName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "assemblyArtifactName": autorest.Encode("path", assemblyArtifactName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/assemblies/{assemblyArtifactName}/listContentCallbackUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListContentCallbackURLSender sends the ListContentCallbackURL request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountAssembliesClient) ListContentCallbackURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListContentCallbackURLResponder handles the response to the ListContentCallbackURL request. The method always -// closes the http.Response Body. -func (client IntegrationAccountAssembliesClient) ListContentCallbackURLResponder(resp *http.Response) (result WorkflowTriggerCallbackURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountbatchconfigurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountbatchconfigurations.go deleted file mode 100644 index 6ab6598dc7e9..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountbatchconfigurations.go +++ /dev/null @@ -1,355 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IntegrationAccountBatchConfigurationsClient is the REST API for Azure Logic Apps. -type IntegrationAccountBatchConfigurationsClient struct { - BaseClient -} - -// NewIntegrationAccountBatchConfigurationsClient creates an instance of the -// IntegrationAccountBatchConfigurationsClient client. -func NewIntegrationAccountBatchConfigurationsClient(subscriptionID string) IntegrationAccountBatchConfigurationsClient { - return NewIntegrationAccountBatchConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationAccountBatchConfigurationsClientWithBaseURI creates an instance of the -// IntegrationAccountBatchConfigurationsClient client using a custom endpoint. Use this when interacting with an Azure -// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewIntegrationAccountBatchConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) IntegrationAccountBatchConfigurationsClient { - return IntegrationAccountBatchConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a batch configuration for an integration account. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// batchConfigurationName - the batch configuration name. -// batchConfiguration - the batch configuration. -func (client IntegrationAccountBatchConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, integrationAccountName string, batchConfigurationName string, batchConfiguration BatchConfiguration) (result BatchConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountBatchConfigurationsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: batchConfiguration, - Constraints: []validation.Constraint{{Target: "batchConfiguration.Properties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "batchConfiguration.Properties.BatchGroupName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "batchConfiguration.Properties.ReleaseCriteria", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("logic.IntegrationAccountBatchConfigurationsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, integrationAccountName, batchConfigurationName, batchConfiguration) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountBatchConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountBatchConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountBatchConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IntegrationAccountBatchConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, batchConfigurationName string, batchConfiguration BatchConfiguration) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "batchConfigurationName": autorest.Encode("path", batchConfigurationName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/batchConfigurations/{batchConfigurationName}", pathParameters), - autorest.WithJSON(batchConfiguration), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountBatchConfigurationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client IntegrationAccountBatchConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result BatchConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a batch configuration for an integration account. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// batchConfigurationName - the batch configuration name. -func (client IntegrationAccountBatchConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, integrationAccountName string, batchConfigurationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountBatchConfigurationsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, integrationAccountName, batchConfigurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountBatchConfigurationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountBatchConfigurationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountBatchConfigurationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationAccountBatchConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, batchConfigurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "batchConfigurationName": autorest.Encode("path", batchConfigurationName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/batchConfigurations/{batchConfigurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountBatchConfigurationsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client IntegrationAccountBatchConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a batch configuration for an integration account. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// batchConfigurationName - the batch configuration name. -func (client IntegrationAccountBatchConfigurationsClient) Get(ctx context.Context, resourceGroupName string, integrationAccountName string, batchConfigurationName string) (result BatchConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountBatchConfigurationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, integrationAccountName, batchConfigurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountBatchConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountBatchConfigurationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountBatchConfigurationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationAccountBatchConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, batchConfigurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "batchConfigurationName": autorest.Encode("path", batchConfigurationName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/batchConfigurations/{batchConfigurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountBatchConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IntegrationAccountBatchConfigurationsClient) GetResponder(resp *http.Response) (result BatchConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list the batch configurations for an integration account. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -func (client IntegrationAccountBatchConfigurationsClient) List(ctx context.Context, resourceGroupName string, integrationAccountName string) (result BatchConfigurationCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountBatchConfigurationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, integrationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountBatchConfigurationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountBatchConfigurationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountBatchConfigurationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationAccountBatchConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/batchConfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountBatchConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client IntegrationAccountBatchConfigurationsClient) ListResponder(resp *http.Response) (result BatchConfigurationCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountcertificates.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountcertificates.go deleted file mode 100644 index de2e161d39ef..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountcertificates.go +++ /dev/null @@ -1,402 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IntegrationAccountCertificatesClient is the REST API for Azure Logic Apps. -type IntegrationAccountCertificatesClient struct { - BaseClient -} - -// NewIntegrationAccountCertificatesClient creates an instance of the IntegrationAccountCertificatesClient client. -func NewIntegrationAccountCertificatesClient(subscriptionID string) IntegrationAccountCertificatesClient { - return NewIntegrationAccountCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationAccountCertificatesClientWithBaseURI creates an instance of the IntegrationAccountCertificatesClient -// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI -// (sovereign clouds, Azure stack). -func NewIntegrationAccountCertificatesClientWithBaseURI(baseURI string, subscriptionID string) IntegrationAccountCertificatesClient { - return IntegrationAccountCertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an integration account certificate. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// certificateName - the integration account certificate name. -// certificate - the integration account certificate. -func (client IntegrationAccountCertificatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, integrationAccountName string, certificateName string, certificate IntegrationAccountCertificate) (result IntegrationAccountCertificate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountCertificatesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: certificate, - Constraints: []validation.Constraint{{Target: "certificate.IntegrationAccountCertificateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "certificate.IntegrationAccountCertificateProperties.Key", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "certificate.IntegrationAccountCertificateProperties.Key.KeyVault", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "certificate.IntegrationAccountCertificateProperties.Key.KeyName", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("logic.IntegrationAccountCertificatesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, integrationAccountName, certificateName, certificate) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountCertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountCertificatesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountCertificatesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IntegrationAccountCertificatesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, certificateName string, certificate IntegrationAccountCertificate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateName": autorest.Encode("path", certificateName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}", pathParameters), - autorest.WithJSON(certificate), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountCertificatesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client IntegrationAccountCertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountCertificate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an integration account certificate. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// certificateName - the integration account certificate name. -func (client IntegrationAccountCertificatesClient) Delete(ctx context.Context, resourceGroupName string, integrationAccountName string, certificateName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountCertificatesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, integrationAccountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountCertificatesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountCertificatesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountCertificatesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationAccountCertificatesClient) DeletePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateName": autorest.Encode("path", certificateName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountCertificatesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client IntegrationAccountCertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an integration account certificate. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// certificateName - the integration account certificate name. -func (client IntegrationAccountCertificatesClient) Get(ctx context.Context, resourceGroupName string, integrationAccountName string, certificateName string) (result IntegrationAccountCertificate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountCertificatesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, integrationAccountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountCertificatesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountCertificatesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountCertificatesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationAccountCertificatesClient) GetPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateName": autorest.Encode("path", certificateName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountCertificatesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IntegrationAccountCertificatesClient) GetResponder(resp *http.Response) (result IntegrationAccountCertificate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of integration account certificates. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// top - the number of items to be included in the result. -func (client IntegrationAccountCertificatesClient) List(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32) (result IntegrationAccountCertificateListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountCertificatesClient.List") - defer func() { - sc := -1 - if result.iaclr.Response.Response != nil { - sc = result.iaclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, integrationAccountName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountCertificatesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.iaclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountCertificatesClient", "List", resp, "Failure sending request") - return - } - - result.iaclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountCertificatesClient", "List", resp, "Failure responding to request") - return - } - if result.iaclr.hasNextLink() && result.iaclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationAccountCertificatesClient) ListPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountCertificatesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client IntegrationAccountCertificatesClient) ListResponder(resp *http.Response) (result IntegrationAccountCertificateListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client IntegrationAccountCertificatesClient) listNextResults(ctx context.Context, lastResults IntegrationAccountCertificateListResult) (result IntegrationAccountCertificateListResult, err error) { - req, err := lastResults.integrationAccountCertificateListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountCertificatesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountCertificatesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountCertificatesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client IntegrationAccountCertificatesClient) ListComplete(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32) (result IntegrationAccountCertificateListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountCertificatesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, integrationAccountName, top) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountmaps.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountmaps.go deleted file mode 100644 index 745646819c16..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountmaps.go +++ /dev/null @@ -1,481 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IntegrationAccountMapsClient is the REST API for Azure Logic Apps. -type IntegrationAccountMapsClient struct { - BaseClient -} - -// NewIntegrationAccountMapsClient creates an instance of the IntegrationAccountMapsClient client. -func NewIntegrationAccountMapsClient(subscriptionID string) IntegrationAccountMapsClient { - return NewIntegrationAccountMapsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationAccountMapsClientWithBaseURI creates an instance of the IntegrationAccountMapsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewIntegrationAccountMapsClientWithBaseURI(baseURI string, subscriptionID string) IntegrationAccountMapsClient { - return IntegrationAccountMapsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an integration account map. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// mapName - the integration account map name. -// mapParameter - the integration account map. -func (client IntegrationAccountMapsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, integrationAccountName string, mapName string, mapParameter IntegrationAccountMap) (result IntegrationAccountMap, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountMapsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: mapParameter, - Constraints: []validation.Constraint{{Target: "mapParameter.IntegrationAccountMapProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("logic.IntegrationAccountMapsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, integrationAccountName, mapName, mapParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IntegrationAccountMapsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, mapName string, mapParameter IntegrationAccountMap) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "mapName": autorest.Encode("path", mapName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}", pathParameters), - autorest.WithJSON(mapParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountMapsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client IntegrationAccountMapsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountMap, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an integration account map. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// mapName - the integration account map name. -func (client IntegrationAccountMapsClient) Delete(ctx context.Context, resourceGroupName string, integrationAccountName string, mapName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountMapsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, integrationAccountName, mapName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationAccountMapsClient) DeletePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, mapName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "mapName": autorest.Encode("path", mapName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountMapsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client IntegrationAccountMapsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an integration account map. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// mapName - the integration account map name. -func (client IntegrationAccountMapsClient) Get(ctx context.Context, resourceGroupName string, integrationAccountName string, mapName string) (result IntegrationAccountMap, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountMapsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, integrationAccountName, mapName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationAccountMapsClient) GetPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, mapName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "mapName": autorest.Encode("path", mapName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountMapsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IntegrationAccountMapsClient) GetResponder(resp *http.Response) (result IntegrationAccountMap, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of integration account maps. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// top - the number of items to be included in the result. -// filter - the filter to apply on the operation. Options for filters include: MapType. -func (client IntegrationAccountMapsClient) List(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountMapListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountMapsClient.List") - defer func() { - sc := -1 - if result.iamlr.Response.Response != nil { - sc = result.iamlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, integrationAccountName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.iamlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "List", resp, "Failure sending request") - return - } - - result.iamlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "List", resp, "Failure responding to request") - return - } - if result.iamlr.hasNextLink() && result.iamlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationAccountMapsClient) ListPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountMapsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client IntegrationAccountMapsClient) ListResponder(resp *http.Response) (result IntegrationAccountMapListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client IntegrationAccountMapsClient) listNextResults(ctx context.Context, lastResults IntegrationAccountMapListResult) (result IntegrationAccountMapListResult, err error) { - req, err := lastResults.integrationAccountMapListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client IntegrationAccountMapsClient) ListComplete(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountMapListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountMapsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, integrationAccountName, top, filter) - return -} - -// ListContentCallbackURL get the content callback url. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// mapName - the integration account map name. -func (client IntegrationAccountMapsClient) ListContentCallbackURL(ctx context.Context, resourceGroupName string, integrationAccountName string, mapName string, listContentCallbackURL GetCallbackURLParameters) (result WorkflowTriggerCallbackURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountMapsClient.ListContentCallbackURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListContentCallbackURLPreparer(ctx, resourceGroupName, integrationAccountName, mapName, listContentCallbackURL) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "ListContentCallbackURL", nil, "Failure preparing request") - return - } - - resp, err := client.ListContentCallbackURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "ListContentCallbackURL", resp, "Failure sending request") - return - } - - result, err = client.ListContentCallbackURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountMapsClient", "ListContentCallbackURL", resp, "Failure responding to request") - return - } - - return -} - -// ListContentCallbackURLPreparer prepares the ListContentCallbackURL request. -func (client IntegrationAccountMapsClient) ListContentCallbackURLPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, mapName string, listContentCallbackURL GetCallbackURLParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "mapName": autorest.Encode("path", mapName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}/listContentCallbackUrl", pathParameters), - autorest.WithJSON(listContentCallbackURL), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListContentCallbackURLSender sends the ListContentCallbackURL request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountMapsClient) ListContentCallbackURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListContentCallbackURLResponder handles the response to the ListContentCallbackURL request. The method always -// closes the http.Response Body. -func (client IntegrationAccountMapsClient) ListContentCallbackURLResponder(resp *http.Response) (result WorkflowTriggerCallbackURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountpartners.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountpartners.go deleted file mode 100644 index 9678635db874..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountpartners.go +++ /dev/null @@ -1,482 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IntegrationAccountPartnersClient is the REST API for Azure Logic Apps. -type IntegrationAccountPartnersClient struct { - BaseClient -} - -// NewIntegrationAccountPartnersClient creates an instance of the IntegrationAccountPartnersClient client. -func NewIntegrationAccountPartnersClient(subscriptionID string) IntegrationAccountPartnersClient { - return NewIntegrationAccountPartnersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationAccountPartnersClientWithBaseURI creates an instance of the IntegrationAccountPartnersClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewIntegrationAccountPartnersClientWithBaseURI(baseURI string, subscriptionID string) IntegrationAccountPartnersClient { - return IntegrationAccountPartnersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an integration account partner. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// partnerName - the integration account partner name. -// partner - the integration account partner. -func (client IntegrationAccountPartnersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, integrationAccountName string, partnerName string, partner IntegrationAccountPartner) (result IntegrationAccountPartner, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountPartnersClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: partner, - Constraints: []validation.Constraint{{Target: "partner.IntegrationAccountPartnerProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "partner.IntegrationAccountPartnerProperties.Content", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("logic.IntegrationAccountPartnersClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, integrationAccountName, partnerName, partner) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IntegrationAccountPartnersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, partnerName string, partner IntegrationAccountPartner) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "partnerName": autorest.Encode("path", partnerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}", pathParameters), - autorest.WithJSON(partner), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountPartnersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client IntegrationAccountPartnersClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountPartner, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an integration account partner. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// partnerName - the integration account partner name. -func (client IntegrationAccountPartnersClient) Delete(ctx context.Context, resourceGroupName string, integrationAccountName string, partnerName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountPartnersClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, integrationAccountName, partnerName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationAccountPartnersClient) DeletePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, partnerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "partnerName": autorest.Encode("path", partnerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountPartnersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client IntegrationAccountPartnersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an integration account partner. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// partnerName - the integration account partner name. -func (client IntegrationAccountPartnersClient) Get(ctx context.Context, resourceGroupName string, integrationAccountName string, partnerName string) (result IntegrationAccountPartner, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountPartnersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, integrationAccountName, partnerName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationAccountPartnersClient) GetPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, partnerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "partnerName": autorest.Encode("path", partnerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountPartnersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IntegrationAccountPartnersClient) GetResponder(resp *http.Response) (result IntegrationAccountPartner, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of integration account partners. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// top - the number of items to be included in the result. -// filter - the filter to apply on the operation. Options for filters include: PartnerType. -func (client IntegrationAccountPartnersClient) List(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountPartnerListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountPartnersClient.List") - defer func() { - sc := -1 - if result.iaplr.Response.Response != nil { - sc = result.iaplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, integrationAccountName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.iaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "List", resp, "Failure sending request") - return - } - - result.iaplr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "List", resp, "Failure responding to request") - return - } - if result.iaplr.hasNextLink() && result.iaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationAccountPartnersClient) ListPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountPartnersClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client IntegrationAccountPartnersClient) ListResponder(resp *http.Response) (result IntegrationAccountPartnerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client IntegrationAccountPartnersClient) listNextResults(ctx context.Context, lastResults IntegrationAccountPartnerListResult) (result IntegrationAccountPartnerListResult, err error) { - req, err := lastResults.integrationAccountPartnerListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client IntegrationAccountPartnersClient) ListComplete(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountPartnerListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountPartnersClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, integrationAccountName, top, filter) - return -} - -// ListContentCallbackURL get the content callback url. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// partnerName - the integration account partner name. -func (client IntegrationAccountPartnersClient) ListContentCallbackURL(ctx context.Context, resourceGroupName string, integrationAccountName string, partnerName string, listContentCallbackURL GetCallbackURLParameters) (result WorkflowTriggerCallbackURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountPartnersClient.ListContentCallbackURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListContentCallbackURLPreparer(ctx, resourceGroupName, integrationAccountName, partnerName, listContentCallbackURL) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "ListContentCallbackURL", nil, "Failure preparing request") - return - } - - resp, err := client.ListContentCallbackURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "ListContentCallbackURL", resp, "Failure sending request") - return - } - - result, err = client.ListContentCallbackURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountPartnersClient", "ListContentCallbackURL", resp, "Failure responding to request") - return - } - - return -} - -// ListContentCallbackURLPreparer prepares the ListContentCallbackURL request. -func (client IntegrationAccountPartnersClient) ListContentCallbackURLPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, partnerName string, listContentCallbackURL GetCallbackURLParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "partnerName": autorest.Encode("path", partnerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}/listContentCallbackUrl", pathParameters), - autorest.WithJSON(listContentCallbackURL), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListContentCallbackURLSender sends the ListContentCallbackURL request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountPartnersClient) ListContentCallbackURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListContentCallbackURLResponder handles the response to the ListContentCallbackURL request. The method always -// closes the http.Response Body. -func (client IntegrationAccountPartnersClient) ListContentCallbackURLResponder(resp *http.Response) (result WorkflowTriggerCallbackURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccounts.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccounts.go deleted file mode 100644 index 7241b334c45a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccounts.go +++ /dev/null @@ -1,908 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IntegrationAccountsClient is the REST API for Azure Logic Apps. -type IntegrationAccountsClient struct { - BaseClient -} - -// NewIntegrationAccountsClient creates an instance of the IntegrationAccountsClient client. -func NewIntegrationAccountsClient(subscriptionID string) IntegrationAccountsClient { - return NewIntegrationAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationAccountsClientWithBaseURI creates an instance of the IntegrationAccountsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewIntegrationAccountsClientWithBaseURI(baseURI string, subscriptionID string) IntegrationAccountsClient { - return IntegrationAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an integration account. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// integrationAccount - the integration account. -func (client IntegrationAccountsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (result IntegrationAccount, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, integrationAccountName, integrationAccount) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IntegrationAccountsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}", pathParameters), - autorest.WithJSON(integrationAccount), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccount, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an integration account. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -func (client IntegrationAccountsClient) Delete(ctx context.Context, resourceGroupName string, integrationAccountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, integrationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationAccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an integration account. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -func (client IntegrationAccountsClient) Get(ctx context.Context, resourceGroupName string, integrationAccountName string) (result IntegrationAccount, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, integrationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationAccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) GetResponder(resp *http.Response) (result IntegrationAccount, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets a list of integration accounts by resource group. -// Parameters: -// resourceGroupName - the resource group name. -// top - the number of items to be included in the result. -func (client IntegrationAccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32) (result IntegrationAccountListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.ialr.Response.Response != nil { - sc = result.ialr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.ialr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.ialr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.ialr.hasNextLink() && result.ialr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client IntegrationAccountsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result IntegrationAccountListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client IntegrationAccountsClient) listByResourceGroupNextResults(ctx context.Context, lastResults IntegrationAccountListResult) (result IntegrationAccountListResult, err error) { - req, err := lastResults.integrationAccountListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client IntegrationAccountsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, top *int32) (result IntegrationAccountListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, top) - return -} - -// ListBySubscription gets a list of integration accounts by subscription. -// Parameters: -// top - the number of items to be included in the result. -func (client IntegrationAccountsClient) ListBySubscription(ctx context.Context, top *int32) (result IntegrationAccountListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.ialr.Response.Response != nil { - sc = result.ialr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, top) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.ialr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.ialr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.ialr.hasNextLink() && result.ialr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client IntegrationAccountsClient) ListBySubscriptionPreparer(ctx context.Context, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Logic/integrationAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) ListBySubscriptionResponder(resp *http.Response) (result IntegrationAccountListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client IntegrationAccountsClient) listBySubscriptionNextResults(ctx context.Context, lastResults IntegrationAccountListResult) (result IntegrationAccountListResult, err error) { - req, err := lastResults.integrationAccountListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client IntegrationAccountsClient) ListBySubscriptionComplete(ctx context.Context, top *int32) (result IntegrationAccountListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx, top) - return -} - -// ListCallbackURL gets the integration account callback URL. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// parameters - the callback URL parameters. -func (client IntegrationAccountsClient) ListCallbackURL(ctx context.Context, resourceGroupName string, integrationAccountName string, parameters GetCallbackURLParameters) (result CallbackURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountsClient.ListCallbackURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListCallbackURLPreparer(ctx, resourceGroupName, integrationAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListCallbackURL", nil, "Failure preparing request") - return - } - - resp, err := client.ListCallbackURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListCallbackURL", resp, "Failure sending request") - return - } - - result, err = client.ListCallbackURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListCallbackURL", resp, "Failure responding to request") - return - } - - return -} - -// ListCallbackURLPreparer prepares the ListCallbackURL request. -func (client IntegrationAccountsClient) ListCallbackURLPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, parameters GetCallbackURLParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/listCallbackUrl", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCallbackURLSender sends the ListCallbackURL request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) ListCallbackURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCallbackURLResponder handles the response to the ListCallbackURL request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) ListCallbackURLResponder(resp *http.Response) (result CallbackURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListKeyVaultKeys gets the integration account's Key Vault keys. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// listKeyVaultKeys - the key vault parameters. -func (client IntegrationAccountsClient) ListKeyVaultKeys(ctx context.Context, resourceGroupName string, integrationAccountName string, listKeyVaultKeys ListKeyVaultKeysDefinition) (result KeyVaultKeyCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountsClient.ListKeyVaultKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: listKeyVaultKeys, - Constraints: []validation.Constraint{{Target: "listKeyVaultKeys.KeyVault", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("logic.IntegrationAccountsClient", "ListKeyVaultKeys", err.Error()) - } - - req, err := client.ListKeyVaultKeysPreparer(ctx, resourceGroupName, integrationAccountName, listKeyVaultKeys) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListKeyVaultKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeyVaultKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListKeyVaultKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeyVaultKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListKeyVaultKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeyVaultKeysPreparer prepares the ListKeyVaultKeys request. -func (client IntegrationAccountsClient) ListKeyVaultKeysPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, listKeyVaultKeys ListKeyVaultKeysDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/listKeyVaultKeys", pathParameters), - autorest.WithJSON(listKeyVaultKeys), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeyVaultKeysSender sends the ListKeyVaultKeys request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) ListKeyVaultKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeyVaultKeysResponder handles the response to the ListKeyVaultKeys request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) ListKeyVaultKeysResponder(resp *http.Response) (result KeyVaultKeyCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// LogTrackingEvents logs the integration account's tracking events. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// logTrackingEvents - the callback URL parameters. -func (client IntegrationAccountsClient) LogTrackingEvents(ctx context.Context, resourceGroupName string, integrationAccountName string, logTrackingEvents TrackingEventsDefinition) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountsClient.LogTrackingEvents") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: logTrackingEvents, - Constraints: []validation.Constraint{{Target: "logTrackingEvents.SourceType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "logTrackingEvents.Events", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("logic.IntegrationAccountsClient", "LogTrackingEvents", err.Error()) - } - - req, err := client.LogTrackingEventsPreparer(ctx, resourceGroupName, integrationAccountName, logTrackingEvents) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "LogTrackingEvents", nil, "Failure preparing request") - return - } - - resp, err := client.LogTrackingEventsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "LogTrackingEvents", resp, "Failure sending request") - return - } - - result, err = client.LogTrackingEventsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "LogTrackingEvents", resp, "Failure responding to request") - return - } - - return -} - -// LogTrackingEventsPreparer prepares the LogTrackingEvents request. -func (client IntegrationAccountsClient) LogTrackingEventsPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, logTrackingEvents TrackingEventsDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/logTrackingEvents", pathParameters), - autorest.WithJSON(logTrackingEvents), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// LogTrackingEventsSender sends the LogTrackingEvents request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) LogTrackingEventsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// LogTrackingEventsResponder handles the response to the LogTrackingEvents request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) LogTrackingEventsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateAccessKey regenerates the integration account access key. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// regenerateAccessKey - the access key type. -func (client IntegrationAccountsClient) RegenerateAccessKey(ctx context.Context, resourceGroupName string, integrationAccountName string, regenerateAccessKey RegenerateActionParameter) (result IntegrationAccount, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountsClient.RegenerateAccessKey") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RegenerateAccessKeyPreparer(ctx, resourceGroupName, integrationAccountName, regenerateAccessKey) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "RegenerateAccessKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateAccessKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "RegenerateAccessKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateAccessKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "RegenerateAccessKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateAccessKeyPreparer prepares the RegenerateAccessKey request. -func (client IntegrationAccountsClient) RegenerateAccessKeyPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, regenerateAccessKey RegenerateActionParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/regenerateAccessKey", pathParameters), - autorest.WithJSON(regenerateAccessKey), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateAccessKeySender sends the RegenerateAccessKey request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) RegenerateAccessKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateAccessKeyResponder handles the response to the RegenerateAccessKey request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) RegenerateAccessKeyResponder(resp *http.Response) (result IntegrationAccount, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates an integration account. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// integrationAccount - the integration account. -func (client IntegrationAccountsClient) Update(ctx context.Context, resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (result IntegrationAccount, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, integrationAccountName, integrationAccount) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client IntegrationAccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}", pathParameters), - autorest.WithJSON(integrationAccount), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) UpdateResponder(resp *http.Response) (result IntegrationAccount, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountschemas.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountschemas.go deleted file mode 100644 index 936968a1f430..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountschemas.go +++ /dev/null @@ -1,481 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IntegrationAccountSchemasClient is the REST API for Azure Logic Apps. -type IntegrationAccountSchemasClient struct { - BaseClient -} - -// NewIntegrationAccountSchemasClient creates an instance of the IntegrationAccountSchemasClient client. -func NewIntegrationAccountSchemasClient(subscriptionID string) IntegrationAccountSchemasClient { - return NewIntegrationAccountSchemasClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationAccountSchemasClientWithBaseURI creates an instance of the IntegrationAccountSchemasClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewIntegrationAccountSchemasClientWithBaseURI(baseURI string, subscriptionID string) IntegrationAccountSchemasClient { - return IntegrationAccountSchemasClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an integration account schema. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// schemaName - the integration account schema name. -// schema - the integration account schema. -func (client IntegrationAccountSchemasClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, integrationAccountName string, schemaName string, schema IntegrationAccountSchema) (result IntegrationAccountSchema, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountSchemasClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: schema, - Constraints: []validation.Constraint{{Target: "schema.IntegrationAccountSchemaProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("logic.IntegrationAccountSchemasClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, integrationAccountName, schemaName, schema) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IntegrationAccountSchemasClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, schemaName string, schema IntegrationAccountSchema) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}", pathParameters), - autorest.WithJSON(schema), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountSchemasClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client IntegrationAccountSchemasClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountSchema, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an integration account schema. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// schemaName - the integration account schema name. -func (client IntegrationAccountSchemasClient) Delete(ctx context.Context, resourceGroupName string, integrationAccountName string, schemaName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountSchemasClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, integrationAccountName, schemaName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationAccountSchemasClient) DeletePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, schemaName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountSchemasClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client IntegrationAccountSchemasClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an integration account schema. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// schemaName - the integration account schema name. -func (client IntegrationAccountSchemasClient) Get(ctx context.Context, resourceGroupName string, integrationAccountName string, schemaName string) (result IntegrationAccountSchema, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountSchemasClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, integrationAccountName, schemaName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationAccountSchemasClient) GetPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, schemaName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountSchemasClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IntegrationAccountSchemasClient) GetResponder(resp *http.Response) (result IntegrationAccountSchema, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of integration account schemas. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// top - the number of items to be included in the result. -// filter - the filter to apply on the operation. Options for filters include: SchemaType. -func (client IntegrationAccountSchemasClient) List(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountSchemaListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountSchemasClient.List") - defer func() { - sc := -1 - if result.iaslr.Response.Response != nil { - sc = result.iaslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, integrationAccountName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.iaslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "List", resp, "Failure sending request") - return - } - - result.iaslr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "List", resp, "Failure responding to request") - return - } - if result.iaslr.hasNextLink() && result.iaslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationAccountSchemasClient) ListPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountSchemasClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client IntegrationAccountSchemasClient) ListResponder(resp *http.Response) (result IntegrationAccountSchemaListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client IntegrationAccountSchemasClient) listNextResults(ctx context.Context, lastResults IntegrationAccountSchemaListResult) (result IntegrationAccountSchemaListResult, err error) { - req, err := lastResults.integrationAccountSchemaListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client IntegrationAccountSchemasClient) ListComplete(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountSchemaListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountSchemasClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, integrationAccountName, top, filter) - return -} - -// ListContentCallbackURL get the content callback url. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// schemaName - the integration account schema name. -func (client IntegrationAccountSchemasClient) ListContentCallbackURL(ctx context.Context, resourceGroupName string, integrationAccountName string, schemaName string, listContentCallbackURL GetCallbackURLParameters) (result WorkflowTriggerCallbackURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountSchemasClient.ListContentCallbackURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListContentCallbackURLPreparer(ctx, resourceGroupName, integrationAccountName, schemaName, listContentCallbackURL) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "ListContentCallbackURL", nil, "Failure preparing request") - return - } - - resp, err := client.ListContentCallbackURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "ListContentCallbackURL", resp, "Failure sending request") - return - } - - result, err = client.ListContentCallbackURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSchemasClient", "ListContentCallbackURL", resp, "Failure responding to request") - return - } - - return -} - -// ListContentCallbackURLPreparer prepares the ListContentCallbackURL request. -func (client IntegrationAccountSchemasClient) ListContentCallbackURLPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, schemaName string, listContentCallbackURL GetCallbackURLParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}/listContentCallbackUrl", pathParameters), - autorest.WithJSON(listContentCallbackURL), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListContentCallbackURLSender sends the ListContentCallbackURL request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountSchemasClient) ListContentCallbackURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListContentCallbackURLResponder handles the response to the ListContentCallbackURL request. The method always -// closes the http.Response Body. -func (client IntegrationAccountSchemasClient) ListContentCallbackURLResponder(resp *http.Response) (result WorkflowTriggerCallbackURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountsessions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountsessions.go deleted file mode 100644 index ec89be01c744..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationaccountsessions.go +++ /dev/null @@ -1,401 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IntegrationAccountSessionsClient is the REST API for Azure Logic Apps. -type IntegrationAccountSessionsClient struct { - BaseClient -} - -// NewIntegrationAccountSessionsClient creates an instance of the IntegrationAccountSessionsClient client. -func NewIntegrationAccountSessionsClient(subscriptionID string) IntegrationAccountSessionsClient { - return NewIntegrationAccountSessionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationAccountSessionsClientWithBaseURI creates an instance of the IntegrationAccountSessionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewIntegrationAccountSessionsClientWithBaseURI(baseURI string, subscriptionID string) IntegrationAccountSessionsClient { - return IntegrationAccountSessionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an integration account session. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// sessionName - the integration account session name. -// session - the integration account session. -func (client IntegrationAccountSessionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, integrationAccountName string, sessionName string, session IntegrationAccountSession) (result IntegrationAccountSession, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountSessionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: session, - Constraints: []validation.Constraint{{Target: "session.IntegrationAccountSessionProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("logic.IntegrationAccountSessionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, integrationAccountName, sessionName, session) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSessionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSessionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSessionsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IntegrationAccountSessionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, sessionName string, session IntegrationAccountSession) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionName": autorest.Encode("path", sessionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}", pathParameters), - autorest.WithJSON(session), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountSessionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client IntegrationAccountSessionsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountSession, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an integration account session. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// sessionName - the integration account session name. -func (client IntegrationAccountSessionsClient) Delete(ctx context.Context, resourceGroupName string, integrationAccountName string, sessionName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountSessionsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, integrationAccountName, sessionName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSessionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSessionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSessionsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationAccountSessionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, sessionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionName": autorest.Encode("path", sessionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountSessionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client IntegrationAccountSessionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an integration account session. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// sessionName - the integration account session name. -func (client IntegrationAccountSessionsClient) Get(ctx context.Context, resourceGroupName string, integrationAccountName string, sessionName string) (result IntegrationAccountSession, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountSessionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, integrationAccountName, sessionName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSessionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSessionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSessionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationAccountSessionsClient) GetPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, sessionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionName": autorest.Encode("path", sessionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountSessionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IntegrationAccountSessionsClient) GetResponder(resp *http.Response) (result IntegrationAccountSession, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of integration account sessions. -// Parameters: -// resourceGroupName - the resource group name. -// integrationAccountName - the integration account name. -// top - the number of items to be included in the result. -// filter - the filter to apply on the operation. Options for filters include: ChangedTime. -func (client IntegrationAccountSessionsClient) List(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountSessionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountSessionsClient.List") - defer func() { - sc := -1 - if result.iaslr.Response.Response != nil { - sc = result.iaslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, integrationAccountName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSessionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.iaslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSessionsClient", "List", resp, "Failure sending request") - return - } - - result.iaslr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSessionsClient", "List", resp, "Failure responding to request") - return - } - if result.iaslr.hasNextLink() && result.iaslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationAccountSessionsClient) ListPreparer(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountSessionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client IntegrationAccountSessionsClient) ListResponder(resp *http.Response) (result IntegrationAccountSessionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client IntegrationAccountSessionsClient) listNextResults(ctx context.Context, lastResults IntegrationAccountSessionListResult) (result IntegrationAccountSessionListResult, err error) { - req, err := lastResults.integrationAccountSessionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountSessionsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountSessionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountSessionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client IntegrationAccountSessionsClient) ListComplete(ctx context.Context, resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountSessionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountSessionsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, integrationAccountName, top, filter) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationserviceenvironmentmanagedapioperations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationserviceenvironmentmanagedapioperations.go deleted file mode 100644 index 89be8f7d99b0..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationserviceenvironmentmanagedapioperations.go +++ /dev/null @@ -1,153 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IntegrationServiceEnvironmentManagedAPIOperationsClient is the REST API for Azure Logic Apps. -type IntegrationServiceEnvironmentManagedAPIOperationsClient struct { - BaseClient -} - -// NewIntegrationServiceEnvironmentManagedAPIOperationsClient creates an instance of the -// IntegrationServiceEnvironmentManagedAPIOperationsClient client. -func NewIntegrationServiceEnvironmentManagedAPIOperationsClient(subscriptionID string) IntegrationServiceEnvironmentManagedAPIOperationsClient { - return NewIntegrationServiceEnvironmentManagedAPIOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationServiceEnvironmentManagedAPIOperationsClientWithBaseURI creates an instance of the -// IntegrationServiceEnvironmentManagedAPIOperationsClient client using a custom endpoint. Use this when interacting -// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewIntegrationServiceEnvironmentManagedAPIOperationsClientWithBaseURI(baseURI string, subscriptionID string) IntegrationServiceEnvironmentManagedAPIOperationsClient { - return IntegrationServiceEnvironmentManagedAPIOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets the managed Api operations. -// Parameters: -// resourceGroup - the resource group. -// integrationServiceEnvironmentName - the integration service environment name. -// APIName - the api name. -func (client IntegrationServiceEnvironmentManagedAPIOperationsClient) List(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, APIName string) (result APIOperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentManagedAPIOperationsClient.List") - defer func() { - sc := -1 - if result.aolr.Response.Response != nil { - sc = result.aolr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroup, integrationServiceEnvironmentName, APIName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedAPIOperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.aolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedAPIOperationsClient", "List", resp, "Failure sending request") - return - } - - result.aolr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedAPIOperationsClient", "List", resp, "Failure responding to request") - return - } - if result.aolr.hasNextLink() && result.aolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationServiceEnvironmentManagedAPIOperationsClient) ListPreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, APIName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiName": autorest.Encode("path", APIName), - "integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName), - "resourceGroup": autorest.Encode("path", resourceGroup), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}/managedApis/{apiName}/apiOperations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationServiceEnvironmentManagedAPIOperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client IntegrationServiceEnvironmentManagedAPIOperationsClient) ListResponder(resp *http.Response) (result APIOperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client IntegrationServiceEnvironmentManagedAPIOperationsClient) listNextResults(ctx context.Context, lastResults APIOperationListResult) (result APIOperationListResult, err error) { - req, err := lastResults.aPIOperationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedAPIOperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedAPIOperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedAPIOperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client IntegrationServiceEnvironmentManagedAPIOperationsClient) ListComplete(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, APIName string) (result APIOperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentManagedAPIOperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroup, integrationServiceEnvironmentName, APIName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationserviceenvironmentmanagedapis.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationserviceenvironmentmanagedapis.go deleted file mode 100644 index c884341f5d8a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationserviceenvironmentmanagedapis.go +++ /dev/null @@ -1,393 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IntegrationServiceEnvironmentManagedApisClient is the REST API for Azure Logic Apps. -type IntegrationServiceEnvironmentManagedApisClient struct { - BaseClient -} - -// NewIntegrationServiceEnvironmentManagedApisClient creates an instance of the -// IntegrationServiceEnvironmentManagedApisClient client. -func NewIntegrationServiceEnvironmentManagedApisClient(subscriptionID string) IntegrationServiceEnvironmentManagedApisClient { - return NewIntegrationServiceEnvironmentManagedApisClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationServiceEnvironmentManagedApisClientWithBaseURI creates an instance of the -// IntegrationServiceEnvironmentManagedApisClient client using a custom endpoint. Use this when interacting with an -// Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewIntegrationServiceEnvironmentManagedApisClientWithBaseURI(baseURI string, subscriptionID string) IntegrationServiceEnvironmentManagedApisClient { - return IntegrationServiceEnvironmentManagedApisClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete deletes the integration service environment managed Api. -// Parameters: -// resourceGroup - the resource group. -// integrationServiceEnvironmentName - the integration service environment name. -// APIName - the api name. -func (client IntegrationServiceEnvironmentManagedApisClient) Delete(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, APIName string) (result IntegrationServiceEnvironmentManagedApisDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentManagedApisClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroup, integrationServiceEnvironmentName, APIName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationServiceEnvironmentManagedApisClient) DeletePreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, APIName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiName": autorest.Encode("path", APIName), - "integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName), - "resourceGroup": autorest.Encode("path", resourceGroup), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}/managedApis/{apiName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationServiceEnvironmentManagedApisClient) DeleteSender(req *http.Request) (future IntegrationServiceEnvironmentManagedApisDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client IntegrationServiceEnvironmentManagedApisClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the integration service environment managed Api. -// Parameters: -// resourceGroup - the resource group name. -// integrationServiceEnvironmentName - the integration service environment name. -// APIName - the api name. -func (client IntegrationServiceEnvironmentManagedApisClient) Get(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, APIName string) (result IntegrationServiceEnvironmentManagedAPI, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentManagedApisClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroup, integrationServiceEnvironmentName, APIName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationServiceEnvironmentManagedApisClient) GetPreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, APIName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiName": autorest.Encode("path", APIName), - "integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName), - "resourceGroup": autorest.Encode("path", resourceGroup), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}/managedApis/{apiName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationServiceEnvironmentManagedApisClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IntegrationServiceEnvironmentManagedApisClient) GetResponder(resp *http.Response) (result IntegrationServiceEnvironmentManagedAPI, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets the integration service environment managed Apis. -// Parameters: -// resourceGroup - the resource group. -// integrationServiceEnvironmentName - the integration service environment name. -func (client IntegrationServiceEnvironmentManagedApisClient) List(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (result IntegrationServiceEnvironmentManagedAPIListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentManagedApisClient.List") - defer func() { - sc := -1 - if result.isemalr.Response.Response != nil { - sc = result.isemalr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroup, integrationServiceEnvironmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.isemalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisClient", "List", resp, "Failure sending request") - return - } - - result.isemalr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisClient", "List", resp, "Failure responding to request") - return - } - if result.isemalr.hasNextLink() && result.isemalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationServiceEnvironmentManagedApisClient) ListPreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName), - "resourceGroup": autorest.Encode("path", resourceGroup), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}/managedApis", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationServiceEnvironmentManagedApisClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client IntegrationServiceEnvironmentManagedApisClient) ListResponder(resp *http.Response) (result IntegrationServiceEnvironmentManagedAPIListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client IntegrationServiceEnvironmentManagedApisClient) listNextResults(ctx context.Context, lastResults IntegrationServiceEnvironmentManagedAPIListResult) (result IntegrationServiceEnvironmentManagedAPIListResult, err error) { - req, err := lastResults.integrationServiceEnvironmentManagedAPIListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client IntegrationServiceEnvironmentManagedApisClient) ListComplete(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (result IntegrationServiceEnvironmentManagedAPIListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentManagedApisClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroup, integrationServiceEnvironmentName) - return -} - -// Put puts the integration service environment managed Api. -// Parameters: -// resourceGroup - the resource group name. -// integrationServiceEnvironmentName - the integration service environment name. -// APIName - the api name. -// integrationServiceEnvironmentManagedAPI - the integration service environment managed api. -func (client IntegrationServiceEnvironmentManagedApisClient) Put(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, APIName string, integrationServiceEnvironmentManagedAPI IntegrationServiceEnvironmentManagedAPI) (result IntegrationServiceEnvironmentManagedApisPutFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentManagedApisClient.Put") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.PutPreparer(ctx, resourceGroup, integrationServiceEnvironmentName, APIName, integrationServiceEnvironmentManagedAPI) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisClient", "Put", nil, "Failure preparing request") - return - } - - result, err = client.PutSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisClient", "Put", result.Response(), "Failure sending request") - return - } - - return -} - -// PutPreparer prepares the Put request. -func (client IntegrationServiceEnvironmentManagedApisClient) PutPreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, APIName string, integrationServiceEnvironmentManagedAPI IntegrationServiceEnvironmentManagedAPI) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiName": autorest.Encode("path", APIName), - "integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName), - "resourceGroup": autorest.Encode("path", resourceGroup), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}/managedApis/{apiName}", pathParameters), - autorest.WithJSON(integrationServiceEnvironmentManagedAPI), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PutSender sends the Put request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationServiceEnvironmentManagedApisClient) PutSender(req *http.Request) (future IntegrationServiceEnvironmentManagedApisPutFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// PutResponder handles the response to the Put request. The method always -// closes the http.Response Body. -func (client IntegrationServiceEnvironmentManagedApisClient) PutResponder(resp *http.Response) (result IntegrationServiceEnvironmentManagedAPI, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationserviceenvironmentnetworkhealth.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationserviceenvironmentnetworkhealth.go deleted file mode 100644 index 8873a8fb7728..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationserviceenvironmentnetworkhealth.go +++ /dev/null @@ -1,109 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IntegrationServiceEnvironmentNetworkHealthClient is the REST API for Azure Logic Apps. -type IntegrationServiceEnvironmentNetworkHealthClient struct { - BaseClient -} - -// NewIntegrationServiceEnvironmentNetworkHealthClient creates an instance of the -// IntegrationServiceEnvironmentNetworkHealthClient client. -func NewIntegrationServiceEnvironmentNetworkHealthClient(subscriptionID string) IntegrationServiceEnvironmentNetworkHealthClient { - return NewIntegrationServiceEnvironmentNetworkHealthClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationServiceEnvironmentNetworkHealthClientWithBaseURI creates an instance of the -// IntegrationServiceEnvironmentNetworkHealthClient client using a custom endpoint. Use this when interacting with an -// Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewIntegrationServiceEnvironmentNetworkHealthClientWithBaseURI(baseURI string, subscriptionID string) IntegrationServiceEnvironmentNetworkHealthClient { - return IntegrationServiceEnvironmentNetworkHealthClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the integration service environment network health. -// Parameters: -// resourceGroup - the resource group. -// integrationServiceEnvironmentName - the integration service environment name. -func (client IntegrationServiceEnvironmentNetworkHealthClient) Get(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (result SetIntegrationServiceEnvironmentSubnetNetworkHealth, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentNetworkHealthClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroup, integrationServiceEnvironmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentNetworkHealthClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentNetworkHealthClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentNetworkHealthClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationServiceEnvironmentNetworkHealthClient) GetPreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName), - "resourceGroup": autorest.Encode("path", resourceGroup), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}/health/network", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationServiceEnvironmentNetworkHealthClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IntegrationServiceEnvironmentNetworkHealthClient) GetResponder(resp *http.Response) (result SetIntegrationServiceEnvironmentSubnetNetworkHealth, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationserviceenvironments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationserviceenvironments.go deleted file mode 100644 index 80172c8e3aed..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationserviceenvironments.go +++ /dev/null @@ -1,660 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IntegrationServiceEnvironmentsClient is the REST API for Azure Logic Apps. -type IntegrationServiceEnvironmentsClient struct { - BaseClient -} - -// NewIntegrationServiceEnvironmentsClient creates an instance of the IntegrationServiceEnvironmentsClient client. -func NewIntegrationServiceEnvironmentsClient(subscriptionID string) IntegrationServiceEnvironmentsClient { - return NewIntegrationServiceEnvironmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationServiceEnvironmentsClientWithBaseURI creates an instance of the IntegrationServiceEnvironmentsClient -// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI -// (sovereign clouds, Azure stack). -func NewIntegrationServiceEnvironmentsClientWithBaseURI(baseURI string, subscriptionID string) IntegrationServiceEnvironmentsClient { - return IntegrationServiceEnvironmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an integration service environment. -// Parameters: -// resourceGroup - the resource group. -// integrationServiceEnvironmentName - the integration service environment name. -// integrationServiceEnvironment - the integration service environment. -func (client IntegrationServiceEnvironmentsClient) CreateOrUpdate(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, integrationServiceEnvironment IntegrationServiceEnvironment) (result IntegrationServiceEnvironmentsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroup, integrationServiceEnvironmentName, integrationServiceEnvironment) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IntegrationServiceEnvironmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, integrationServiceEnvironment IntegrationServiceEnvironment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName), - "resourceGroup": autorest.Encode("path", resourceGroup), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}", pathParameters), - autorest.WithJSON(integrationServiceEnvironment), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationServiceEnvironmentsClient) CreateOrUpdateSender(req *http.Request) (future IntegrationServiceEnvironmentsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client IntegrationServiceEnvironmentsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationServiceEnvironment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an integration service environment. -// Parameters: -// resourceGroup - the resource group. -// integrationServiceEnvironmentName - the integration service environment name. -func (client IntegrationServiceEnvironmentsClient) Delete(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroup, integrationServiceEnvironmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationServiceEnvironmentsClient) DeletePreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName), - "resourceGroup": autorest.Encode("path", resourceGroup), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationServiceEnvironmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client IntegrationServiceEnvironmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an integration service environment. -// Parameters: -// resourceGroup - the resource group. -// integrationServiceEnvironmentName - the integration service environment name. -func (client IntegrationServiceEnvironmentsClient) Get(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (result IntegrationServiceEnvironment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroup, integrationServiceEnvironmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationServiceEnvironmentsClient) GetPreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName), - "resourceGroup": autorest.Encode("path", resourceGroup), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationServiceEnvironmentsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IntegrationServiceEnvironmentsClient) GetResponder(resp *http.Response) (result IntegrationServiceEnvironment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets a list of integration service environments by resource group. -// Parameters: -// resourceGroup - the resource group. -// top - the number of items to be included in the result. -func (client IntegrationServiceEnvironmentsClient) ListByResourceGroup(ctx context.Context, resourceGroup string, top *int32) (result IntegrationServiceEnvironmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.iselr.Response.Response != nil { - sc = result.iselr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroup, top) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.iselr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.iselr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.iselr.hasNextLink() && result.iselr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client IntegrationServiceEnvironmentsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroup string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroup": autorest.Encode("path", resourceGroup), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationServiceEnvironmentsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client IntegrationServiceEnvironmentsClient) ListByResourceGroupResponder(resp *http.Response) (result IntegrationServiceEnvironmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client IntegrationServiceEnvironmentsClient) listByResourceGroupNextResults(ctx context.Context, lastResults IntegrationServiceEnvironmentListResult) (result IntegrationServiceEnvironmentListResult, err error) { - req, err := lastResults.integrationServiceEnvironmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client IntegrationServiceEnvironmentsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroup string, top *int32) (result IntegrationServiceEnvironmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroup, top) - return -} - -// ListBySubscription gets a list of integration service environments by subscription. -// Parameters: -// top - the number of items to be included in the result. -func (client IntegrationServiceEnvironmentsClient) ListBySubscription(ctx context.Context, top *int32) (result IntegrationServiceEnvironmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.ListBySubscription") - defer func() { - sc := -1 - if result.iselr.Response.Response != nil { - sc = result.iselr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, top) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.iselr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.iselr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.iselr.hasNextLink() && result.iselr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client IntegrationServiceEnvironmentsClient) ListBySubscriptionPreparer(ctx context.Context, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Logic/integrationServiceEnvironments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationServiceEnvironmentsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client IntegrationServiceEnvironmentsClient) ListBySubscriptionResponder(resp *http.Response) (result IntegrationServiceEnvironmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client IntegrationServiceEnvironmentsClient) listBySubscriptionNextResults(ctx context.Context, lastResults IntegrationServiceEnvironmentListResult) (result IntegrationServiceEnvironmentListResult, err error) { - req, err := lastResults.integrationServiceEnvironmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client IntegrationServiceEnvironmentsClient) ListBySubscriptionComplete(ctx context.Context, top *int32) (result IntegrationServiceEnvironmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx, top) - return -} - -// Restart restarts an integration service environment. -// Parameters: -// resourceGroup - the resource group. -// integrationServiceEnvironmentName - the integration service environment name. -func (client IntegrationServiceEnvironmentsClient) Restart(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.Restart") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RestartPreparer(ctx, resourceGroup, integrationServiceEnvironmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Restart", nil, "Failure preparing request") - return - } - - resp, err := client.RestartSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Restart", resp, "Failure sending request") - return - } - - result, err = client.RestartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Restart", resp, "Failure responding to request") - return - } - - return -} - -// RestartPreparer prepares the Restart request. -func (client IntegrationServiceEnvironmentsClient) RestartPreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName), - "resourceGroup": autorest.Encode("path", resourceGroup), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}/restart", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RestartSender sends the Restart request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationServiceEnvironmentsClient) RestartSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RestartResponder handles the response to the Restart request. The method always -// closes the http.Response Body. -func (client IntegrationServiceEnvironmentsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates an integration service environment. -// Parameters: -// resourceGroup - the resource group. -// integrationServiceEnvironmentName - the integration service environment name. -// integrationServiceEnvironment - the integration service environment. -func (client IntegrationServiceEnvironmentsClient) Update(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, integrationServiceEnvironment IntegrationServiceEnvironment) (result IntegrationServiceEnvironmentsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroup, integrationServiceEnvironmentName, integrationServiceEnvironment) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client IntegrationServiceEnvironmentsClient) UpdatePreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, integrationServiceEnvironment IntegrationServiceEnvironment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName), - "resourceGroup": autorest.Encode("path", resourceGroup), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}", pathParameters), - autorest.WithJSON(integrationServiceEnvironment), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationServiceEnvironmentsClient) UpdateSender(req *http.Request) (future IntegrationServiceEnvironmentsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client IntegrationServiceEnvironmentsClient) UpdateResponder(resp *http.Response) (result IntegrationServiceEnvironment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationserviceenvironmentskus.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationserviceenvironmentskus.go deleted file mode 100644 index 54bf4bee4777..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/integrationserviceenvironmentskus.go +++ /dev/null @@ -1,151 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IntegrationServiceEnvironmentSkusClient is the REST API for Azure Logic Apps. -type IntegrationServiceEnvironmentSkusClient struct { - BaseClient -} - -// NewIntegrationServiceEnvironmentSkusClient creates an instance of the IntegrationServiceEnvironmentSkusClient -// client. -func NewIntegrationServiceEnvironmentSkusClient(subscriptionID string) IntegrationServiceEnvironmentSkusClient { - return NewIntegrationServiceEnvironmentSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationServiceEnvironmentSkusClientWithBaseURI creates an instance of the -// IntegrationServiceEnvironmentSkusClient client using a custom endpoint. Use this when interacting with an Azure -// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewIntegrationServiceEnvironmentSkusClientWithBaseURI(baseURI string, subscriptionID string) IntegrationServiceEnvironmentSkusClient { - return IntegrationServiceEnvironmentSkusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets a list of integration service environment Skus. -// Parameters: -// resourceGroup - the resource group. -// integrationServiceEnvironmentName - the integration service environment name. -func (client IntegrationServiceEnvironmentSkusClient) List(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (result IntegrationServiceEnvironmentSkuListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentSkusClient.List") - defer func() { - sc := -1 - if result.isesl.Response.Response != nil { - sc = result.isesl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroup, integrationServiceEnvironmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentSkusClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.isesl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentSkusClient", "List", resp, "Failure sending request") - return - } - - result.isesl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentSkusClient", "List", resp, "Failure responding to request") - return - } - if result.isesl.hasNextLink() && result.isesl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client IntegrationServiceEnvironmentSkusClient) ListPreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName), - "resourceGroup": autorest.Encode("path", resourceGroup), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationServiceEnvironmentSkusClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client IntegrationServiceEnvironmentSkusClient) ListResponder(resp *http.Response) (result IntegrationServiceEnvironmentSkuList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client IntegrationServiceEnvironmentSkusClient) listNextResults(ctx context.Context, lastResults IntegrationServiceEnvironmentSkuList) (result IntegrationServiceEnvironmentSkuList, err error) { - req, err := lastResults.integrationServiceEnvironmentSkuListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentSkusClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentSkusClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentSkusClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client IntegrationServiceEnvironmentSkusClient) ListComplete(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (result IntegrationServiceEnvironmentSkuListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentSkusClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroup, integrationServiceEnvironmentName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/models.go deleted file mode 100644 index 63d8a1af4974..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/models.go +++ /dev/null @@ -1,8078 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "github.com/gofrs/uuid" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" - -// AgreementContent the integration account agreement content. -type AgreementContent struct { - // AS2 - The AS2 agreement content. - AS2 *AS2AgreementContent `json:"aS2,omitempty"` - // X12 - The X12 agreement content. - X12 *X12AgreementContent `json:"x12,omitempty"` - // Edifact - The EDIFACT agreement content. - Edifact *EdifactAgreementContent `json:"edifact,omitempty"` -} - -// APIDeploymentParameterMetadata the API deployment parameter metadata. -type APIDeploymentParameterMetadata struct { - // Type - The type. - Type *string `json:"type,omitempty"` - // IsRequired - Indicates whether its required. - IsRequired *bool `json:"isRequired,omitempty"` - // DisplayName - The display name. - DisplayName *string `json:"displayName,omitempty"` - // Description - The description. - Description *string `json:"description,omitempty"` - // Visibility - The visibility. Possible values include: 'APIDeploymentParameterVisibilityNotSpecified', 'APIDeploymentParameterVisibilityDefault', 'APIDeploymentParameterVisibilityInternal' - Visibility APIDeploymentParameterVisibility `json:"visibility,omitempty"` -} - -// APIDeploymentParameterMetadataSet the API deployment parameters metadata. -type APIDeploymentParameterMetadataSet struct { - // PackageContentLink - The package content link parameter. - PackageContentLink *APIDeploymentParameterMetadata `json:"packageContentLink,omitempty"` - // RedisCacheConnectionString - The package content link parameter. - RedisCacheConnectionString *APIDeploymentParameterMetadata `json:"redisCacheConnectionString,omitempty"` -} - -// APIOperation the api operation. -type APIOperation struct { - Properties *APIOperationPropertiesDefinition `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for APIOperation. -func (ao APIOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ao.Properties != nil { - objectMap["properties"] = ao.Properties - } - if ao.Location != nil { - objectMap["location"] = ao.Location - } - if ao.Tags != nil { - objectMap["tags"] = ao.Tags - } - return json.Marshal(objectMap) -} - -// APIOperationAnnotation the Api Operation Annotation. -type APIOperationAnnotation struct { - // Status - Possible values include: 'StatusAnnotationNotSpecified', 'StatusAnnotationPreview', 'StatusAnnotationProduction' - Status StatusAnnotation `json:"status,omitempty"` - // Family - The family. - Family *string `json:"family,omitempty"` - // Revision - The revision. - Revision *int32 `json:"revision,omitempty"` -} - -// APIOperationListResult the list of managed API operations. -type APIOperationListResult struct { - autorest.Response `json:"-"` - // Value - The api operation definitions for an API. - Value *[]APIOperation `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// APIOperationListResultIterator provides access to a complete listing of APIOperation values. -type APIOperationListResultIterator struct { - i int - page APIOperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *APIOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *APIOperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APIOperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter APIOperationListResultIterator) Response() APIOperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter APIOperationListResultIterator) Value() APIOperation { - if !iter.page.NotDone() { - return APIOperation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APIOperationListResultIterator type. -func NewAPIOperationListResultIterator(page APIOperationListResultPage) APIOperationListResultIterator { - return APIOperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aolr APIOperationListResult) IsEmpty() bool { - return aolr.Value == nil || len(*aolr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aolr APIOperationListResult) hasNextLink() bool { - return aolr.NextLink != nil && len(*aolr.NextLink) != 0 -} - -// aPIOperationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aolr APIOperationListResult) aPIOperationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !aolr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aolr.NextLink))) -} - -// APIOperationListResultPage contains a page of APIOperation values. -type APIOperationListResultPage struct { - fn func(context.Context, APIOperationListResult) (APIOperationListResult, error) - aolr APIOperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *APIOperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIOperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.aolr) - if err != nil { - return err - } - page.aolr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *APIOperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APIOperationListResultPage) NotDone() bool { - return !page.aolr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APIOperationListResultPage) Response() APIOperationListResult { - return page.aolr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APIOperationListResultPage) Values() []APIOperation { - if page.aolr.IsEmpty() { - return nil - } - return *page.aolr.Value -} - -// Creates a new instance of the APIOperationListResultPage type. -func NewAPIOperationListResultPage(cur APIOperationListResult, getNextPage func(context.Context, APIOperationListResult) (APIOperationListResult, error)) APIOperationListResultPage { - return APIOperationListResultPage{ - fn: getNextPage, - aolr: cur, - } -} - -// APIOperationPropertiesDefinition the api operations properties -type APIOperationPropertiesDefinition struct { - // Summary - The summary of the api operation. - Summary *string `json:"summary,omitempty"` - // Description - The description of the api operation. - Description *string `json:"description,omitempty"` - // Visibility - The visibility of the api operation. - Visibility *string `json:"visibility,omitempty"` - // Trigger - The trigger type of api operation. - Trigger *string `json:"trigger,omitempty"` - // TriggerHint - The trigger hint for the api operation. - TriggerHint *string `json:"triggerHint,omitempty"` - // Pageable - Indicates whether the api operation is pageable. - Pageable *bool `json:"pageable,omitempty"` - // Annotation - The annotation of api operation. - Annotation *APIOperationAnnotation `json:"annotation,omitempty"` - // API - The api reference. - API *APIReference `json:"api,omitempty"` - // InputsDefinition - The operation inputs definition schema. - InputsDefinition *SwaggerSchema `json:"inputsDefinition,omitempty"` - // ResponsesDefinition - The operation responses definition schemas. - ResponsesDefinition map[string]*SwaggerSchema `json:"responsesDefinition"` - // IsWebhook - Indicates whether the API operation is webhook or not. - IsWebhook *bool `json:"isWebhook,omitempty"` - // IsNotification - Indicates whether the API operation is notification or not. - IsNotification *bool `json:"isNotification,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIOperationPropertiesDefinition. -func (aopd APIOperationPropertiesDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aopd.Summary != nil { - objectMap["summary"] = aopd.Summary - } - if aopd.Description != nil { - objectMap["description"] = aopd.Description - } - if aopd.Visibility != nil { - objectMap["visibility"] = aopd.Visibility - } - if aopd.Trigger != nil { - objectMap["trigger"] = aopd.Trigger - } - if aopd.TriggerHint != nil { - objectMap["triggerHint"] = aopd.TriggerHint - } - if aopd.Pageable != nil { - objectMap["pageable"] = aopd.Pageable - } - if aopd.Annotation != nil { - objectMap["annotation"] = aopd.Annotation - } - if aopd.API != nil { - objectMap["api"] = aopd.API - } - if aopd.InputsDefinition != nil { - objectMap["inputsDefinition"] = aopd.InputsDefinition - } - if aopd.ResponsesDefinition != nil { - objectMap["responsesDefinition"] = aopd.ResponsesDefinition - } - if aopd.IsWebhook != nil { - objectMap["isWebhook"] = aopd.IsWebhook - } - if aopd.IsNotification != nil { - objectMap["isNotification"] = aopd.IsNotification - } - return json.Marshal(objectMap) -} - -// APIReference the Api reference. -type APIReference struct { - // DisplayName - The display name of the api. - DisplayName *string `json:"displayName,omitempty"` - // Description - The description of the api. - Description *string `json:"description,omitempty"` - // IconURI - The icon uri of the api. - IconURI *string `json:"iconUri,omitempty"` - // Swagger - The swagger of the api. - Swagger interface{} `json:"swagger,omitempty"` - // BrandColor - The brand color of the api. - BrandColor *string `json:"brandColor,omitempty"` - // Category - The tier. Possible values include: 'APITierNotSpecified', 'APITierEnterprise', 'APITierStandard', 'APITierPremium' - Category APITier `json:"category,omitempty"` - // IntegrationServiceEnvironment - The integration service environment reference. - IntegrationServiceEnvironment *ResourceReference `json:"integrationServiceEnvironment,omitempty"` - // ID - The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIReference. -func (ar APIReference) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.DisplayName != nil { - objectMap["displayName"] = ar.DisplayName - } - if ar.Description != nil { - objectMap["description"] = ar.Description - } - if ar.IconURI != nil { - objectMap["iconUri"] = ar.IconURI - } - if ar.Swagger != nil { - objectMap["swagger"] = ar.Swagger - } - if ar.BrandColor != nil { - objectMap["brandColor"] = ar.BrandColor - } - if ar.Category != "" { - objectMap["category"] = ar.Category - } - if ar.IntegrationServiceEnvironment != nil { - objectMap["integrationServiceEnvironment"] = ar.IntegrationServiceEnvironment - } - if ar.ID != nil { - objectMap["id"] = ar.ID - } - return json.Marshal(objectMap) -} - -// APIResourceBackendService the API backend service. -type APIResourceBackendService struct { - // ServiceURL - The service URL. - ServiceURL *string `json:"serviceUrl,omitempty"` -} - -// APIResourceDefinitions the Api resource definition. -type APIResourceDefinitions struct { - // OriginalSwaggerURL - The original swagger url. - OriginalSwaggerURL *string `json:"originalSwaggerUrl,omitempty"` - // ModifiedSwaggerURL - The modified swagger url. - ModifiedSwaggerURL *string `json:"modifiedSwaggerUrl,omitempty"` -} - -// APIResourceGeneralInformation the API general information. -type APIResourceGeneralInformation struct { - // IconURL - The icon url. - IconURL *string `json:"iconUrl,omitempty"` - // DisplayName - The display name. - DisplayName *string `json:"displayName,omitempty"` - // Description - The description. - Description *string `json:"description,omitempty"` - // TermsOfUseURL - The terms of use url. - TermsOfUseURL *string `json:"termsOfUseUrl,omitempty"` - // ReleaseTag - The release tag. - ReleaseTag *string `json:"releaseTag,omitempty"` - // Tier - The tier. Possible values include: 'APITierNotSpecified', 'APITierEnterprise', 'APITierStandard', 'APITierPremium' - Tier APITier `json:"tier,omitempty"` -} - -// APIResourceMetadata the api resource metadata. -type APIResourceMetadata struct { - // Source - The source. - Source *string `json:"source,omitempty"` - // BrandColor - The brand color. - BrandColor *string `json:"brandColor,omitempty"` - // HideKey - The hide key. - HideKey *string `json:"hideKey,omitempty"` - // Tags - The tags. - Tags map[string]*string `json:"tags"` - // APIType - The api type. Possible values include: 'APITypeNotSpecified', 'APITypeRest', 'APITypeSoap' - APIType APIType `json:"ApiType,omitempty"` - // WsdlService - The WSDL service. - WsdlService *WsdlService `json:"wsdlService,omitempty"` - // WsdlImportMethod - The WSDL import method. Possible values include: 'WsdlImportMethodNotSpecified', 'WsdlImportMethodSoapToRest', 'WsdlImportMethodSoapPassThrough' - WsdlImportMethod WsdlImportMethod `json:"wsdlImportMethod,omitempty"` - // ConnectionType - The connection type. - ConnectionType *string `json:"connectionType,omitempty"` - // ProvisioningState - The provisioning state. Possible values include: 'WorkflowProvisioningStateNotSpecified', 'WorkflowProvisioningStateAccepted', 'WorkflowProvisioningStateRunning', 'WorkflowProvisioningStateReady', 'WorkflowProvisioningStateCreating', 'WorkflowProvisioningStateCreated', 'WorkflowProvisioningStateDeleting', 'WorkflowProvisioningStateDeleted', 'WorkflowProvisioningStateCanceled', 'WorkflowProvisioningStateFailed', 'WorkflowProvisioningStateSucceeded', 'WorkflowProvisioningStateMoving', 'WorkflowProvisioningStateUpdating', 'WorkflowProvisioningStateRegistering', 'WorkflowProvisioningStateRegistered', 'WorkflowProvisioningStateUnregistering', 'WorkflowProvisioningStateUnregistered', 'WorkflowProvisioningStateCompleted', 'WorkflowProvisioningStateRenewing', 'WorkflowProvisioningStatePending', 'WorkflowProvisioningStateWaiting', 'WorkflowProvisioningStateInProgress' - ProvisioningState WorkflowProvisioningState `json:"provisioningState,omitempty"` - // DeploymentParameters - The connector deployment parameters metadata. - DeploymentParameters *APIDeploymentParameterMetadataSet `json:"deploymentParameters,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIResourceMetadata. -func (arm APIResourceMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arm.Source != nil { - objectMap["source"] = arm.Source - } - if arm.BrandColor != nil { - objectMap["brandColor"] = arm.BrandColor - } - if arm.HideKey != nil { - objectMap["hideKey"] = arm.HideKey - } - if arm.Tags != nil { - objectMap["tags"] = arm.Tags - } - if arm.APIType != "" { - objectMap["ApiType"] = arm.APIType - } - if arm.WsdlService != nil { - objectMap["wsdlService"] = arm.WsdlService - } - if arm.WsdlImportMethod != "" { - objectMap["wsdlImportMethod"] = arm.WsdlImportMethod - } - if arm.ConnectionType != nil { - objectMap["connectionType"] = arm.ConnectionType - } - if arm.ProvisioningState != "" { - objectMap["provisioningState"] = arm.ProvisioningState - } - if arm.DeploymentParameters != nil { - objectMap["deploymentParameters"] = arm.DeploymentParameters - } - return json.Marshal(objectMap) -} - -// APIResourcePolicies the API resource policies. -type APIResourcePolicies struct { - // Content - The API level only policies XML as embedded content. - Content *string `json:"content,omitempty"` - // ContentLink - The content link to the policies. - ContentLink *string `json:"contentLink,omitempty"` -} - -// APIResourceProperties the API resource properties. -type APIResourceProperties struct { - // Name - READ-ONLY; The name - Name *string `json:"name,omitempty"` - // ConnectionParameters - READ-ONLY; The connection parameters. - ConnectionParameters map[string]interface{} `json:"connectionParameters"` - // Metadata - READ-ONLY; The metadata. - Metadata *APIResourceMetadata `json:"metadata,omitempty"` - // RuntimeUrls - READ-ONLY; The runtime urls. - RuntimeUrls *[]string `json:"runtimeUrls,omitempty"` - // GeneralInformation - READ-ONLY; The api general information. - GeneralInformation *APIResourceGeneralInformation `json:"generalInformation,omitempty"` - // Capabilities - READ-ONLY; The capabilities. - Capabilities *[]string `json:"capabilities,omitempty"` - // BackendService - READ-ONLY; The backend service. - BackendService *APIResourceBackendService `json:"backendService,omitempty"` - // Policies - READ-ONLY; The policies for the API. - Policies *APIResourcePolicies `json:"policies,omitempty"` - // APIDefinitionURL - READ-ONLY; The API definition. - APIDefinitionURL *string `json:"apiDefinitionUrl,omitempty"` - // APIDefinitions - READ-ONLY; The api definitions. - APIDefinitions *APIResourceDefinitions `json:"apiDefinitions,omitempty"` - // IntegrationServiceEnvironment - The integration service environment reference. - IntegrationServiceEnvironment *ResourceReference `json:"integrationServiceEnvironment,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'WorkflowProvisioningStateNotSpecified', 'WorkflowProvisioningStateAccepted', 'WorkflowProvisioningStateRunning', 'WorkflowProvisioningStateReady', 'WorkflowProvisioningStateCreating', 'WorkflowProvisioningStateCreated', 'WorkflowProvisioningStateDeleting', 'WorkflowProvisioningStateDeleted', 'WorkflowProvisioningStateCanceled', 'WorkflowProvisioningStateFailed', 'WorkflowProvisioningStateSucceeded', 'WorkflowProvisioningStateMoving', 'WorkflowProvisioningStateUpdating', 'WorkflowProvisioningStateRegistering', 'WorkflowProvisioningStateRegistered', 'WorkflowProvisioningStateUnregistering', 'WorkflowProvisioningStateUnregistered', 'WorkflowProvisioningStateCompleted', 'WorkflowProvisioningStateRenewing', 'WorkflowProvisioningStatePending', 'WorkflowProvisioningStateWaiting', 'WorkflowProvisioningStateInProgress' - ProvisioningState WorkflowProvisioningState `json:"provisioningState,omitempty"` - // Category - READ-ONLY; The category. Possible values include: 'APITierNotSpecified', 'APITierEnterprise', 'APITierStandard', 'APITierPremium' - Category APITier `json:"category,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIResourceProperties. -func (arp APIResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arp.IntegrationServiceEnvironment != nil { - objectMap["integrationServiceEnvironment"] = arp.IntegrationServiceEnvironment - } - return json.Marshal(objectMap) -} - -// ArtifactContentPropertiesDefinition the artifact content properties definition. -type ArtifactContentPropertiesDefinition struct { - Content interface{} `json:"content,omitempty"` - // ContentType - The content type. - ContentType *string `json:"contentType,omitempty"` - // ContentLink - The content link. - ContentLink *ContentLink `json:"contentLink,omitempty"` - // CreatedTime - The artifact creation time. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ChangedTime - The artifact changed time. - ChangedTime *date.Time `json:"changedTime,omitempty"` - Metadata interface{} `json:"metadata,omitempty"` -} - -// ArtifactProperties the artifact properties definition. -type ArtifactProperties struct { - // CreatedTime - The artifact creation time. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ChangedTime - The artifact changed time. - ChangedTime *date.Time `json:"changedTime,omitempty"` - Metadata interface{} `json:"metadata,omitempty"` -} - -// AS2AcknowledgementConnectionSettings the AS2 agreement acknowledgement connection settings. -type AS2AcknowledgementConnectionSettings struct { - // IgnoreCertificateNameMismatch - Indicates whether to ignore mismatch in certificate name. - IgnoreCertificateNameMismatch *bool `json:"ignoreCertificateNameMismatch,omitempty"` - // SupportHTTPStatusCodeContinue - Indicates whether to support HTTP status code 'CONTINUE'. - SupportHTTPStatusCodeContinue *bool `json:"supportHttpStatusCodeContinue,omitempty"` - // KeepHTTPConnectionAlive - Indicates whether to keep the connection alive. - KeepHTTPConnectionAlive *bool `json:"keepHttpConnectionAlive,omitempty"` - // UnfoldHTTPHeaders - Indicates whether to unfold the HTTP headers. - UnfoldHTTPHeaders *bool `json:"unfoldHttpHeaders,omitempty"` -} - -// AS2AgreementContent the integration account AS2 agreement content. -type AS2AgreementContent struct { - // ReceiveAgreement - The AS2 one-way receive agreement. - ReceiveAgreement *AS2OneWayAgreement `json:"receiveAgreement,omitempty"` - // SendAgreement - The AS2 one-way send agreement. - SendAgreement *AS2OneWayAgreement `json:"sendAgreement,omitempty"` -} - -// AS2EnvelopeSettings the AS2 agreement envelope settings. -type AS2EnvelopeSettings struct { - // MessageContentType - The message content type. - MessageContentType *string `json:"messageContentType,omitempty"` - // TransmitFileNameInMimeHeader - The value indicating whether to transmit file name in mime header. - TransmitFileNameInMimeHeader *bool `json:"transmitFileNameInMimeHeader,omitempty"` - // FileNameTemplate - The template for file name. - FileNameTemplate *string `json:"fileNameTemplate,omitempty"` - // SuspendMessageOnFileNameGenerationError - The value indicating whether to suspend message on file name generation error. - SuspendMessageOnFileNameGenerationError *bool `json:"suspendMessageOnFileNameGenerationError,omitempty"` - // AutogenerateFileName - The value indicating whether to auto generate file name. - AutogenerateFileName *bool `json:"autogenerateFileName,omitempty"` -} - -// AS2ErrorSettings the AS2 agreement error settings. -type AS2ErrorSettings struct { - // SuspendDuplicateMessage - The value indicating whether to suspend duplicate message. - SuspendDuplicateMessage *bool `json:"suspendDuplicateMessage,omitempty"` - // ResendIfMDNNotReceived - The value indicating whether to resend message If MDN is not received. - ResendIfMDNNotReceived *bool `json:"resendIfMDNNotReceived,omitempty"` -} - -// AS2MdnSettings the AS2 agreement mdn settings. -type AS2MdnSettings struct { - // NeedMDN - The value indicating whether to send or request a MDN. - NeedMDN *bool `json:"needMDN,omitempty"` - // SignMDN - The value indicating whether the MDN needs to be signed or not. - SignMDN *bool `json:"signMDN,omitempty"` - // SendMDNAsynchronously - The value indicating whether to send the asynchronous MDN. - SendMDNAsynchronously *bool `json:"sendMDNAsynchronously,omitempty"` - // ReceiptDeliveryURL - The receipt delivery URL. - ReceiptDeliveryURL *string `json:"receiptDeliveryUrl,omitempty"` - // DispositionNotificationTo - The disposition notification to header value. - DispositionNotificationTo *string `json:"dispositionNotificationTo,omitempty"` - // SignOutboundMDNIfOptional - The value indicating whether to sign the outbound MDN if optional. - SignOutboundMDNIfOptional *bool `json:"signOutboundMDNIfOptional,omitempty"` - // MdnText - The MDN text. - MdnText *string `json:"mdnText,omitempty"` - // SendInboundMDNToMessageBox - The value indicating whether to send inbound MDN to message box. - SendInboundMDNToMessageBox *bool `json:"sendInboundMDNToMessageBox,omitempty"` - // MicHashingAlgorithm - The signing or hashing algorithm. Possible values include: 'HashingAlgorithmNotSpecified', 'HashingAlgorithmNone', 'HashingAlgorithmMD5', 'HashingAlgorithmSHA1', 'HashingAlgorithmSHA2256', 'HashingAlgorithmSHA2384', 'HashingAlgorithmSHA2512' - MicHashingAlgorithm HashingAlgorithm `json:"micHashingAlgorithm,omitempty"` -} - -// AS2MessageConnectionSettings the AS2 agreement message connection settings. -type AS2MessageConnectionSettings struct { - // IgnoreCertificateNameMismatch - The value indicating whether to ignore mismatch in certificate name. - IgnoreCertificateNameMismatch *bool `json:"ignoreCertificateNameMismatch,omitempty"` - // SupportHTTPStatusCodeContinue - The value indicating whether to support HTTP status code 'CONTINUE'. - SupportHTTPStatusCodeContinue *bool `json:"supportHttpStatusCodeContinue,omitempty"` - // KeepHTTPConnectionAlive - The value indicating whether to keep the connection alive. - KeepHTTPConnectionAlive *bool `json:"keepHttpConnectionAlive,omitempty"` - // UnfoldHTTPHeaders - The value indicating whether to unfold the HTTP headers. - UnfoldHTTPHeaders *bool `json:"unfoldHttpHeaders,omitempty"` -} - -// AS2OneWayAgreement the integration account AS2 one-way agreement. -type AS2OneWayAgreement struct { - // SenderBusinessIdentity - The sender business identity - SenderBusinessIdentity *BusinessIdentity `json:"senderBusinessIdentity,omitempty"` - // ReceiverBusinessIdentity - The receiver business identity - ReceiverBusinessIdentity *BusinessIdentity `json:"receiverBusinessIdentity,omitempty"` - // ProtocolSettings - The AS2 protocol settings. - ProtocolSettings *AS2ProtocolSettings `json:"protocolSettings,omitempty"` -} - -// AS2ProtocolSettings the AS2 agreement protocol settings. -type AS2ProtocolSettings struct { - // MessageConnectionSettings - The message connection settings. - MessageConnectionSettings *AS2MessageConnectionSettings `json:"messageConnectionSettings,omitempty"` - // AcknowledgementConnectionSettings - The acknowledgement connection settings. - AcknowledgementConnectionSettings *AS2AcknowledgementConnectionSettings `json:"acknowledgementConnectionSettings,omitempty"` - // MdnSettings - The MDN settings. - MdnSettings *AS2MdnSettings `json:"mdnSettings,omitempty"` - // SecuritySettings - The security settings. - SecuritySettings *AS2SecuritySettings `json:"securitySettings,omitempty"` - // ValidationSettings - The validation settings. - ValidationSettings *AS2ValidationSettings `json:"validationSettings,omitempty"` - // EnvelopeSettings - The envelope settings. - EnvelopeSettings *AS2EnvelopeSettings `json:"envelopeSettings,omitempty"` - // ErrorSettings - The error settings. - ErrorSettings *AS2ErrorSettings `json:"errorSettings,omitempty"` -} - -// AS2SecuritySettings the AS2 agreement security settings. -type AS2SecuritySettings struct { - // OverrideGroupSigningCertificate - The value indicating whether to send or request a MDN. - OverrideGroupSigningCertificate *bool `json:"overrideGroupSigningCertificate,omitempty"` - // SigningCertificateName - The name of the signing certificate. - SigningCertificateName *string `json:"signingCertificateName,omitempty"` - // EncryptionCertificateName - The name of the encryption certificate. - EncryptionCertificateName *string `json:"encryptionCertificateName,omitempty"` - // EnableNRRForInboundEncodedMessages - The value indicating whether to enable NRR for inbound encoded messages. - EnableNRRForInboundEncodedMessages *bool `json:"enableNRRForInboundEncodedMessages,omitempty"` - // EnableNRRForInboundDecodedMessages - The value indicating whether to enable NRR for inbound decoded messages. - EnableNRRForInboundDecodedMessages *bool `json:"enableNRRForInboundDecodedMessages,omitempty"` - // EnableNRRForOutboundMDN - The value indicating whether to enable NRR for outbound MDN. - EnableNRRForOutboundMDN *bool `json:"enableNRRForOutboundMDN,omitempty"` - // EnableNRRForOutboundEncodedMessages - The value indicating whether to enable NRR for outbound encoded messages. - EnableNRRForOutboundEncodedMessages *bool `json:"enableNRRForOutboundEncodedMessages,omitempty"` - // EnableNRRForOutboundDecodedMessages - The value indicating whether to enable NRR for outbound decoded messages. - EnableNRRForOutboundDecodedMessages *bool `json:"enableNRRForOutboundDecodedMessages,omitempty"` - // EnableNRRForInboundMDN - The value indicating whether to enable NRR for inbound MDN. - EnableNRRForInboundMDN *bool `json:"enableNRRForInboundMDN,omitempty"` - // Sha2AlgorithmFormat - The Sha2 algorithm format. Valid values are Sha2, ShaHashSize, ShaHyphenHashSize, Sha2UnderscoreHashSize. - Sha2AlgorithmFormat *string `json:"sha2AlgorithmFormat,omitempty"` -} - -// AS2ValidationSettings the AS2 agreement validation settings. -type AS2ValidationSettings struct { - // OverrideMessageProperties - The value indicating whether to override incoming message properties with those in agreement. - OverrideMessageProperties *bool `json:"overrideMessageProperties,omitempty"` - // EncryptMessage - The value indicating whether the message has to be encrypted. - EncryptMessage *bool `json:"encryptMessage,omitempty"` - // SignMessage - The value indicating whether the message has to be signed. - SignMessage *bool `json:"signMessage,omitempty"` - // CompressMessage - The value indicating whether the message has to be compressed. - CompressMessage *bool `json:"compressMessage,omitempty"` - // CheckDuplicateMessage - The value indicating whether to check for duplicate message. - CheckDuplicateMessage *bool `json:"checkDuplicateMessage,omitempty"` - // InterchangeDuplicatesValidityDays - The number of days to look back for duplicate interchange. - InterchangeDuplicatesValidityDays *int32 `json:"interchangeDuplicatesValidityDays,omitempty"` - // CheckCertificateRevocationListOnSend - The value indicating whether to check for certificate revocation list on send. - CheckCertificateRevocationListOnSend *bool `json:"checkCertificateRevocationListOnSend,omitempty"` - // CheckCertificateRevocationListOnReceive - The value indicating whether to check for certificate revocation list on receive. - CheckCertificateRevocationListOnReceive *bool `json:"checkCertificateRevocationListOnReceive,omitempty"` - // EncryptionAlgorithm - The encryption algorithm. Possible values include: 'EncryptionAlgorithmNotSpecified', 'EncryptionAlgorithmNone', 'EncryptionAlgorithmDES3', 'EncryptionAlgorithmRC2', 'EncryptionAlgorithmAES128', 'EncryptionAlgorithmAES192', 'EncryptionAlgorithmAES256' - EncryptionAlgorithm EncryptionAlgorithm `json:"encryptionAlgorithm,omitempty"` - // SigningAlgorithm - The signing algorithm. Possible values include: 'SigningAlgorithmNotSpecified', 'SigningAlgorithmDefault', 'SigningAlgorithmSHA1', 'SigningAlgorithmSHA2256', 'SigningAlgorithmSHA2384', 'SigningAlgorithmSHA2512' - SigningAlgorithm SigningAlgorithm `json:"signingAlgorithm,omitempty"` -} - -// AssemblyCollection a collection of assembly definitions. -type AssemblyCollection struct { - autorest.Response `json:"-"` - Value *[]AssemblyDefinition `json:"value,omitempty"` -} - -// AssemblyDefinition the assembly definition. -type AssemblyDefinition struct { - autorest.Response `json:"-"` - // Properties - The assembly properties. - Properties *AssemblyProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AssemblyDefinition. -func (ad AssemblyDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ad.Properties != nil { - objectMap["properties"] = ad.Properties - } - if ad.Location != nil { - objectMap["location"] = ad.Location - } - if ad.Tags != nil { - objectMap["tags"] = ad.Tags - } - return json.Marshal(objectMap) -} - -// AssemblyProperties the assembly properties definition. -type AssemblyProperties struct { - // AssemblyName - The assembly name. - AssemblyName *string `json:"assemblyName,omitempty"` - // AssemblyVersion - The assembly version. - AssemblyVersion *string `json:"assemblyVersion,omitempty"` - // AssemblyCulture - The assembly culture. - AssemblyCulture *string `json:"assemblyCulture,omitempty"` - // AssemblyPublicKeyToken - The assembly public key token. - AssemblyPublicKeyToken *string `json:"assemblyPublicKeyToken,omitempty"` - Content interface{} `json:"content,omitempty"` - // ContentType - The content type. - ContentType *string `json:"contentType,omitempty"` - // ContentLink - The content link. - ContentLink *ContentLink `json:"contentLink,omitempty"` - // CreatedTime - The artifact creation time. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ChangedTime - The artifact changed time. - ChangedTime *date.Time `json:"changedTime,omitempty"` - Metadata interface{} `json:"metadata,omitempty"` -} - -// AzureResourceErrorInfo the azure resource error info. -type AzureResourceErrorInfo struct { - // Message - The error message. - Message *string `json:"message,omitempty"` - // Details - The error details. - Details *[]AzureResourceErrorInfo `json:"details,omitempty"` - // Code - The error code. - Code *string `json:"code,omitempty"` -} - -// B2BPartnerContent the B2B partner content. -type B2BPartnerContent struct { - // BusinessIdentities - The list of partner business identities. - BusinessIdentities *[]BusinessIdentity `json:"businessIdentities,omitempty"` -} - -// BatchConfiguration the batch configuration resource definition. -type BatchConfiguration struct { - autorest.Response `json:"-"` - // Properties - The batch configuration properties. - Properties *BatchConfigurationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for BatchConfiguration. -func (bc BatchConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bc.Properties != nil { - objectMap["properties"] = bc.Properties - } - if bc.Location != nil { - objectMap["location"] = bc.Location - } - if bc.Tags != nil { - objectMap["tags"] = bc.Tags - } - return json.Marshal(objectMap) -} - -// BatchConfigurationCollection a collection of batch configurations. -type BatchConfigurationCollection struct { - autorest.Response `json:"-"` - Value *[]BatchConfiguration `json:"value,omitempty"` -} - -// BatchConfigurationProperties the batch configuration properties definition. -type BatchConfigurationProperties struct { - // BatchGroupName - The name of the batch group. - BatchGroupName *string `json:"batchGroupName,omitempty"` - // ReleaseCriteria - The batch release criteria. - ReleaseCriteria *BatchReleaseCriteria `json:"releaseCriteria,omitempty"` - // CreatedTime - The artifact creation time. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ChangedTime - The artifact changed time. - ChangedTime *date.Time `json:"changedTime,omitempty"` - Metadata interface{} `json:"metadata,omitempty"` -} - -// BatchReleaseCriteria the batch release criteria. -type BatchReleaseCriteria struct { - // MessageCount - The message count. - MessageCount *int32 `json:"messageCount,omitempty"` - // BatchSize - The batch size in bytes. - BatchSize *int32 `json:"batchSize,omitempty"` - // Recurrence - The recurrence. - Recurrence *WorkflowTriggerRecurrence `json:"recurrence,omitempty"` -} - -// BusinessIdentity the integration account partner's business identity. -type BusinessIdentity struct { - // Qualifier - The business identity qualifier e.g. as2identity, ZZ, ZZZ, 31, 32 - Qualifier *string `json:"qualifier,omitempty"` - // Value - The user defined business identity value. - Value *string `json:"value,omitempty"` -} - -// CallbackURL the callback url. -type CallbackURL struct { - autorest.Response `json:"-"` - // Value - The URL value. - Value *string `json:"value,omitempty"` -} - -// ContentHash the content hash. -type ContentHash struct { - // Algorithm - The algorithm of the content hash. - Algorithm *string `json:"algorithm,omitempty"` - // Value - The value of the content hash. - Value *string `json:"value,omitempty"` -} - -// ContentLink the content link. -type ContentLink struct { - // URI - The content link URI. - URI *string `json:"uri,omitempty"` - // ContentVersion - READ-ONLY; The content version. - ContentVersion *string `json:"contentVersion,omitempty"` - // ContentSize - READ-ONLY; The content size. - ContentSize *int64 `json:"contentSize,omitempty"` - // ContentHash - READ-ONLY; The content hash. - ContentHash *ContentHash `json:"contentHash,omitempty"` - // Metadata - READ-ONLY; The metadata. - Metadata interface{} `json:"metadata,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContentLink. -func (cl ContentLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cl.URI != nil { - objectMap["uri"] = cl.URI - } - return json.Marshal(objectMap) -} - -// Correlation the correlation property. -type Correlation struct { - // ClientTrackingID - The client tracking id. - ClientTrackingID *string `json:"clientTrackingId,omitempty"` -} - -// EdifactAcknowledgementSettings the Edifact agreement acknowledgement settings. -type EdifactAcknowledgementSettings struct { - // NeedTechnicalAcknowledgement - The value indicating whether technical acknowledgement is needed. - NeedTechnicalAcknowledgement *bool `json:"needTechnicalAcknowledgement,omitempty"` - // BatchTechnicalAcknowledgements - The value indicating whether to batch the technical acknowledgements. - BatchTechnicalAcknowledgements *bool `json:"batchTechnicalAcknowledgements,omitempty"` - // NeedFunctionalAcknowledgement - The value indicating whether functional acknowledgement is needed. - NeedFunctionalAcknowledgement *bool `json:"needFunctionalAcknowledgement,omitempty"` - // BatchFunctionalAcknowledgements - The value indicating whether to batch functional acknowledgements. - BatchFunctionalAcknowledgements *bool `json:"batchFunctionalAcknowledgements,omitempty"` - // NeedLoopForValidMessages - The value indicating whether a loop is needed for valid messages. - NeedLoopForValidMessages *bool `json:"needLoopForValidMessages,omitempty"` - // SendSynchronousAcknowledgement - The value indicating whether to send synchronous acknowledgement. - SendSynchronousAcknowledgement *bool `json:"sendSynchronousAcknowledgement,omitempty"` - // AcknowledgementControlNumberPrefix - The acknowledgement control number prefix. - AcknowledgementControlNumberPrefix *string `json:"acknowledgementControlNumberPrefix,omitempty"` - // AcknowledgementControlNumberSuffix - The acknowledgement control number suffix. - AcknowledgementControlNumberSuffix *string `json:"acknowledgementControlNumberSuffix,omitempty"` - // AcknowledgementControlNumberLowerBound - The acknowledgement control number lower bound. - AcknowledgementControlNumberLowerBound *int32 `json:"acknowledgementControlNumberLowerBound,omitempty"` - // AcknowledgementControlNumberUpperBound - The acknowledgement control number upper bound. - AcknowledgementControlNumberUpperBound *int32 `json:"acknowledgementControlNumberUpperBound,omitempty"` - // RolloverAcknowledgementControlNumber - The value indicating whether to rollover acknowledgement control number. - RolloverAcknowledgementControlNumber *bool `json:"rolloverAcknowledgementControlNumber,omitempty"` -} - -// EdifactAgreementContent the Edifact agreement content. -type EdifactAgreementContent struct { - // ReceiveAgreement - The EDIFACT one-way receive agreement. - ReceiveAgreement *EdifactOneWayAgreement `json:"receiveAgreement,omitempty"` - // SendAgreement - The EDIFACT one-way send agreement. - SendAgreement *EdifactOneWayAgreement `json:"sendAgreement,omitempty"` -} - -// EdifactDelimiterOverride the Edifact delimiter override settings. -type EdifactDelimiterOverride struct { - // MessageID - The message id. - MessageID *string `json:"messageId,omitempty"` - // MessageVersion - The message version. - MessageVersion *string `json:"messageVersion,omitempty"` - // MessageRelease - The message release. - MessageRelease *string `json:"messageRelease,omitempty"` - // DataElementSeparator - The data element separator. - DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` - // ComponentSeparator - The component separator. - ComponentSeparator *int32 `json:"componentSeparator,omitempty"` - // SegmentTerminator - The segment terminator. - SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` - // RepetitionSeparator - The repetition separator. - RepetitionSeparator *int32 `json:"repetitionSeparator,omitempty"` - // SegmentTerminatorSuffix - The segment terminator suffix. Possible values include: 'SegmentTerminatorSuffixNotSpecified', 'SegmentTerminatorSuffixNone', 'SegmentTerminatorSuffixCR', 'SegmentTerminatorSuffixLF', 'SegmentTerminatorSuffixCRLF' - SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` - // DecimalPointIndicator - The decimal point indicator. Possible values include: 'EdifactDecimalIndicatorNotSpecified', 'EdifactDecimalIndicatorComma', 'EdifactDecimalIndicatorDecimal' - DecimalPointIndicator EdifactDecimalIndicator `json:"decimalPointIndicator,omitempty"` - // ReleaseIndicator - The release indicator. - ReleaseIndicator *int32 `json:"releaseIndicator,omitempty"` - // MessageAssociationAssignedCode - The message association assigned code. - MessageAssociationAssignedCode *string `json:"messageAssociationAssignedCode,omitempty"` - // TargetNamespace - The target namespace on which this delimiter settings has to be applied. - TargetNamespace *string `json:"targetNamespace,omitempty"` -} - -// EdifactEnvelopeOverride the Edifact envelope override settings. -type EdifactEnvelopeOverride struct { - // MessageID - The message id on which this envelope settings has to be applied. - MessageID *string `json:"messageId,omitempty"` - // MessageVersion - The message version on which this envelope settings has to be applied. - MessageVersion *string `json:"messageVersion,omitempty"` - // MessageRelease - The message release version on which this envelope settings has to be applied. - MessageRelease *string `json:"messageRelease,omitempty"` - // MessageAssociationAssignedCode - The message association assigned code. - MessageAssociationAssignedCode *string `json:"messageAssociationAssignedCode,omitempty"` - // TargetNamespace - The target namespace on which this envelope settings has to be applied. - TargetNamespace *string `json:"targetNamespace,omitempty"` - // FunctionalGroupID - The functional group id. - FunctionalGroupID *string `json:"functionalGroupId,omitempty"` - // SenderApplicationQualifier - The sender application qualifier. - SenderApplicationQualifier *string `json:"senderApplicationQualifier,omitempty"` - // SenderApplicationID - The sender application id. - SenderApplicationID *string `json:"senderApplicationId,omitempty"` - // ReceiverApplicationQualifier - The receiver application qualifier. - ReceiverApplicationQualifier *string `json:"receiverApplicationQualifier,omitempty"` - // ReceiverApplicationID - The receiver application id. - ReceiverApplicationID *string `json:"receiverApplicationId,omitempty"` - // ControllingAgencyCode - The controlling agency code. - ControllingAgencyCode *string `json:"controllingAgencyCode,omitempty"` - // GroupHeaderMessageVersion - The group header message version. - GroupHeaderMessageVersion *string `json:"groupHeaderMessageVersion,omitempty"` - // GroupHeaderMessageRelease - The group header message release. - GroupHeaderMessageRelease *string `json:"groupHeaderMessageRelease,omitempty"` - // AssociationAssignedCode - The association assigned code. - AssociationAssignedCode *string `json:"associationAssignedCode,omitempty"` - // ApplicationPassword - The application password. - ApplicationPassword *string `json:"applicationPassword,omitempty"` -} - -// EdifactEnvelopeSettings the Edifact agreement envelope settings. -type EdifactEnvelopeSettings struct { - // GroupAssociationAssignedCode - The group association assigned code. - GroupAssociationAssignedCode *string `json:"groupAssociationAssignedCode,omitempty"` - // CommunicationAgreementID - The communication agreement id. - CommunicationAgreementID *string `json:"communicationAgreementId,omitempty"` - // ApplyDelimiterStringAdvice - The value indicating whether to apply delimiter string advice. - ApplyDelimiterStringAdvice *bool `json:"applyDelimiterStringAdvice,omitempty"` - // CreateGroupingSegments - The value indicating whether to create grouping segments. - CreateGroupingSegments *bool `json:"createGroupingSegments,omitempty"` - // EnableDefaultGroupHeaders - The value indicating whether to enable default group headers. - EnableDefaultGroupHeaders *bool `json:"enableDefaultGroupHeaders,omitempty"` - // RecipientReferencePasswordValue - The recipient reference password value. - RecipientReferencePasswordValue *string `json:"recipientReferencePasswordValue,omitempty"` - // RecipientReferencePasswordQualifier - The recipient reference password qualifier. - RecipientReferencePasswordQualifier *string `json:"recipientReferencePasswordQualifier,omitempty"` - // ApplicationReferenceID - The application reference id. - ApplicationReferenceID *string `json:"applicationReferenceId,omitempty"` - // ProcessingPriorityCode - The processing priority code. - ProcessingPriorityCode *string `json:"processingPriorityCode,omitempty"` - // InterchangeControlNumberLowerBound - The interchange control number lower bound. - InterchangeControlNumberLowerBound *int64 `json:"interchangeControlNumberLowerBound,omitempty"` - // InterchangeControlNumberUpperBound - The interchange control number upper bound. - InterchangeControlNumberUpperBound *int64 `json:"interchangeControlNumberUpperBound,omitempty"` - // RolloverInterchangeControlNumber - The value indicating whether to rollover interchange control number. - RolloverInterchangeControlNumber *bool `json:"rolloverInterchangeControlNumber,omitempty"` - // InterchangeControlNumberPrefix - The interchange control number prefix. - InterchangeControlNumberPrefix *string `json:"interchangeControlNumberPrefix,omitempty"` - // InterchangeControlNumberSuffix - The interchange control number suffix. - InterchangeControlNumberSuffix *string `json:"interchangeControlNumberSuffix,omitempty"` - // SenderReverseRoutingAddress - The sender reverse routing address. - SenderReverseRoutingAddress *string `json:"senderReverseRoutingAddress,omitempty"` - // ReceiverReverseRoutingAddress - The receiver reverse routing address. - ReceiverReverseRoutingAddress *string `json:"receiverReverseRoutingAddress,omitempty"` - // FunctionalGroupID - The functional group id. - FunctionalGroupID *string `json:"functionalGroupId,omitempty"` - // GroupControllingAgencyCode - The group controlling agency code. - GroupControllingAgencyCode *string `json:"groupControllingAgencyCode,omitempty"` - // GroupMessageVersion - The group message version. - GroupMessageVersion *string `json:"groupMessageVersion,omitempty"` - // GroupMessageRelease - The group message release. - GroupMessageRelease *string `json:"groupMessageRelease,omitempty"` - // GroupControlNumberLowerBound - The group control number lower bound. - GroupControlNumberLowerBound *int64 `json:"groupControlNumberLowerBound,omitempty"` - // GroupControlNumberUpperBound - The group control number upper bound. - GroupControlNumberUpperBound *int64 `json:"groupControlNumberUpperBound,omitempty"` - // RolloverGroupControlNumber - The value indicating whether to rollover group control number. - RolloverGroupControlNumber *bool `json:"rolloverGroupControlNumber,omitempty"` - // GroupControlNumberPrefix - The group control number prefix. - GroupControlNumberPrefix *string `json:"groupControlNumberPrefix,omitempty"` - // GroupControlNumberSuffix - The group control number suffix. - GroupControlNumberSuffix *string `json:"groupControlNumberSuffix,omitempty"` - // GroupApplicationReceiverQualifier - The group application receiver qualifier. - GroupApplicationReceiverQualifier *string `json:"groupApplicationReceiverQualifier,omitempty"` - // GroupApplicationReceiverID - The group application receiver id. - GroupApplicationReceiverID *string `json:"groupApplicationReceiverId,omitempty"` - // GroupApplicationSenderQualifier - The group application sender qualifier. - GroupApplicationSenderQualifier *string `json:"groupApplicationSenderQualifier,omitempty"` - // GroupApplicationSenderID - The group application sender id. - GroupApplicationSenderID *string `json:"groupApplicationSenderId,omitempty"` - // GroupApplicationPassword - The group application password. - GroupApplicationPassword *string `json:"groupApplicationPassword,omitempty"` - // OverwriteExistingTransactionSetControlNumber - The value indicating whether to overwrite existing transaction set control number. - OverwriteExistingTransactionSetControlNumber *bool `json:"overwriteExistingTransactionSetControlNumber,omitempty"` - // TransactionSetControlNumberPrefix - The transaction set control number prefix. - TransactionSetControlNumberPrefix *string `json:"transactionSetControlNumberPrefix,omitempty"` - // TransactionSetControlNumberSuffix - The transaction set control number suffix. - TransactionSetControlNumberSuffix *string `json:"transactionSetControlNumberSuffix,omitempty"` - // TransactionSetControlNumberLowerBound - The transaction set control number lower bound. - TransactionSetControlNumberLowerBound *int64 `json:"transactionSetControlNumberLowerBound,omitempty"` - // TransactionSetControlNumberUpperBound - The transaction set control number upper bound. - TransactionSetControlNumberUpperBound *int64 `json:"transactionSetControlNumberUpperBound,omitempty"` - // RolloverTransactionSetControlNumber - The value indicating whether to rollover transaction set control number. - RolloverTransactionSetControlNumber *bool `json:"rolloverTransactionSetControlNumber,omitempty"` - // IsTestInterchange - The value indicating whether the message is a test interchange. - IsTestInterchange *bool `json:"isTestInterchange,omitempty"` - // SenderInternalIdentification - The sender internal identification. - SenderInternalIdentification *string `json:"senderInternalIdentification,omitempty"` - // SenderInternalSubIdentification - The sender internal sub identification. - SenderInternalSubIdentification *string `json:"senderInternalSubIdentification,omitempty"` - // ReceiverInternalIdentification - The receiver internal identification. - ReceiverInternalIdentification *string `json:"receiverInternalIdentification,omitempty"` - // ReceiverInternalSubIdentification - The receiver internal sub identification. - ReceiverInternalSubIdentification *string `json:"receiverInternalSubIdentification,omitempty"` -} - -// EdifactFramingSettings the Edifact agreement framing settings. -type EdifactFramingSettings struct { - // ServiceCodeListDirectoryVersion - The service code list directory version. - ServiceCodeListDirectoryVersion *string `json:"serviceCodeListDirectoryVersion,omitempty"` - // CharacterEncoding - The character encoding. - CharacterEncoding *string `json:"characterEncoding,omitempty"` - // ProtocolVersion - The protocol version. - ProtocolVersion *int32 `json:"protocolVersion,omitempty"` - // DataElementSeparator - The data element separator. - DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` - // ComponentSeparator - The component separator. - ComponentSeparator *int32 `json:"componentSeparator,omitempty"` - // SegmentTerminator - The segment terminator. - SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` - // ReleaseIndicator - The release indicator. - ReleaseIndicator *int32 `json:"releaseIndicator,omitempty"` - // RepetitionSeparator - The repetition separator. - RepetitionSeparator *int32 `json:"repetitionSeparator,omitempty"` - // CharacterSet - The EDIFACT frame setting characterSet. Possible values include: 'EdifactCharacterSetNotSpecified', 'EdifactCharacterSetUNOB', 'EdifactCharacterSetUNOA', 'EdifactCharacterSetUNOC', 'EdifactCharacterSetUNOD', 'EdifactCharacterSetUNOE', 'EdifactCharacterSetUNOF', 'EdifactCharacterSetUNOG', 'EdifactCharacterSetUNOH', 'EdifactCharacterSetUNOI', 'EdifactCharacterSetUNOJ', 'EdifactCharacterSetUNOK', 'EdifactCharacterSetUNOX', 'EdifactCharacterSetUNOY', 'EdifactCharacterSetKECA' - CharacterSet EdifactCharacterSet `json:"characterSet,omitempty"` - // DecimalPointIndicator - The EDIFACT frame setting decimal indicator. Possible values include: 'EdifactDecimalIndicatorNotSpecified', 'EdifactDecimalIndicatorComma', 'EdifactDecimalIndicatorDecimal' - DecimalPointIndicator EdifactDecimalIndicator `json:"decimalPointIndicator,omitempty"` - // SegmentTerminatorSuffix - The EDIFACT frame setting segment terminator suffix. Possible values include: 'SegmentTerminatorSuffixNotSpecified', 'SegmentTerminatorSuffixNone', 'SegmentTerminatorSuffixCR', 'SegmentTerminatorSuffixLF', 'SegmentTerminatorSuffixCRLF' - SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` -} - -// EdifactMessageFilter the Edifact message filter for odata query. -type EdifactMessageFilter struct { - // MessageFilterType - The message filter type. Possible values include: 'MessageFilterTypeNotSpecified', 'MessageFilterTypeInclude', 'MessageFilterTypeExclude' - MessageFilterType MessageFilterType `json:"messageFilterType,omitempty"` -} - -// EdifactMessageIdentifier the Edifact message identifier. -type EdifactMessageIdentifier struct { - // MessageID - The message id on which this envelope settings has to be applied. - MessageID *string `json:"messageId,omitempty"` -} - -// EdifactOneWayAgreement the Edifact one way agreement. -type EdifactOneWayAgreement struct { - // SenderBusinessIdentity - The sender business identity - SenderBusinessIdentity *BusinessIdentity `json:"senderBusinessIdentity,omitempty"` - // ReceiverBusinessIdentity - The receiver business identity - ReceiverBusinessIdentity *BusinessIdentity `json:"receiverBusinessIdentity,omitempty"` - // ProtocolSettings - The EDIFACT protocol settings. - ProtocolSettings *EdifactProtocolSettings `json:"protocolSettings,omitempty"` -} - -// EdifactProcessingSettings the Edifact agreement protocol settings. -type EdifactProcessingSettings struct { - // MaskSecurityInfo - The value indicating whether to mask security information. - MaskSecurityInfo *bool `json:"maskSecurityInfo,omitempty"` - // PreserveInterchange - The value indicating whether to preserve interchange. - PreserveInterchange *bool `json:"preserveInterchange,omitempty"` - // SuspendInterchangeOnError - The value indicating whether to suspend interchange on error. - SuspendInterchangeOnError *bool `json:"suspendInterchangeOnError,omitempty"` - // CreateEmptyXMLTagsForTrailingSeparators - The value indicating whether to create empty xml tags for trailing separators. - CreateEmptyXMLTagsForTrailingSeparators *bool `json:"createEmptyXmlTagsForTrailingSeparators,omitempty"` - // UseDotAsDecimalSeparator - The value indicating whether to use dot as decimal separator. - UseDotAsDecimalSeparator *bool `json:"useDotAsDecimalSeparator,omitempty"` -} - -// EdifactProtocolSettings the Edifact agreement protocol settings. -type EdifactProtocolSettings struct { - // ValidationSettings - The EDIFACT validation settings. - ValidationSettings *EdifactValidationSettings `json:"validationSettings,omitempty"` - // FramingSettings - The EDIFACT framing settings. - FramingSettings *EdifactFramingSettings `json:"framingSettings,omitempty"` - // EnvelopeSettings - The EDIFACT envelope settings. - EnvelopeSettings *EdifactEnvelopeSettings `json:"envelopeSettings,omitempty"` - // AcknowledgementSettings - The EDIFACT acknowledgement settings. - AcknowledgementSettings *EdifactAcknowledgementSettings `json:"acknowledgementSettings,omitempty"` - // MessageFilter - The EDIFACT message filter. - MessageFilter *EdifactMessageFilter `json:"messageFilter,omitempty"` - // ProcessingSettings - The EDIFACT processing Settings. - ProcessingSettings *EdifactProcessingSettings `json:"processingSettings,omitempty"` - // EnvelopeOverrides - The EDIFACT envelope override settings. - EnvelopeOverrides *[]EdifactEnvelopeOverride `json:"envelopeOverrides,omitempty"` - // MessageFilterList - The EDIFACT message filter list. - MessageFilterList *[]EdifactMessageIdentifier `json:"messageFilterList,omitempty"` - // SchemaReferences - The EDIFACT schema references. - SchemaReferences *[]EdifactSchemaReference `json:"schemaReferences,omitempty"` - // ValidationOverrides - The EDIFACT validation override settings. - ValidationOverrides *[]EdifactValidationOverride `json:"validationOverrides,omitempty"` - // EdifactDelimiterOverrides - The EDIFACT delimiter override settings. - EdifactDelimiterOverrides *[]EdifactDelimiterOverride `json:"edifactDelimiterOverrides,omitempty"` -} - -// EdifactSchemaReference the Edifact schema reference. -type EdifactSchemaReference struct { - // MessageID - The message id. - MessageID *string `json:"messageId,omitempty"` - // MessageVersion - The message version. - MessageVersion *string `json:"messageVersion,omitempty"` - // MessageRelease - The message release version. - MessageRelease *string `json:"messageRelease,omitempty"` - // SenderApplicationID - The sender application id. - SenderApplicationID *string `json:"senderApplicationId,omitempty"` - // SenderApplicationQualifier - The sender application qualifier. - SenderApplicationQualifier *string `json:"senderApplicationQualifier,omitempty"` - // AssociationAssignedCode - The association assigned code. - AssociationAssignedCode *string `json:"associationAssignedCode,omitempty"` - // SchemaName - The schema name. - SchemaName *string `json:"schemaName,omitempty"` -} - -// EdifactValidationOverride the Edifact validation override settings. -type EdifactValidationOverride struct { - // MessageID - The message id on which the validation settings has to be applied. - MessageID *string `json:"messageId,omitempty"` - // EnforceCharacterSet - The value indicating whether to validate character Set. - EnforceCharacterSet *bool `json:"enforceCharacterSet,omitempty"` - // ValidateEDITypes - The value indicating whether to validate EDI types. - ValidateEDITypes *bool `json:"validateEDITypes,omitempty"` - // ValidateXSDTypes - The value indicating whether to validate XSD types. - ValidateXSDTypes *bool `json:"validateXSDTypes,omitempty"` - // AllowLeadingAndTrailingSpacesAndZeroes - The value indicating whether to allow leading and trailing spaces and zeroes. - AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` - // TrailingSeparatorPolicy - The trailing separator policy. Possible values include: 'TrailingSeparatorPolicyNotSpecified', 'TrailingSeparatorPolicyNotAllowed', 'TrailingSeparatorPolicyOptional', 'TrailingSeparatorPolicyMandatory' - TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` - // TrimLeadingAndTrailingSpacesAndZeroes - The value indicating whether to trim leading and trailing spaces and zeroes. - TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` -} - -// EdifactValidationSettings the Edifact agreement validation settings. -type EdifactValidationSettings struct { - // ValidateCharacterSet - The value indicating whether to validate character set in the message. - ValidateCharacterSet *bool `json:"validateCharacterSet,omitempty"` - // CheckDuplicateInterchangeControlNumber - The value indicating whether to check for duplicate interchange control number. - CheckDuplicateInterchangeControlNumber *bool `json:"checkDuplicateInterchangeControlNumber,omitempty"` - // InterchangeControlNumberValidityDays - The validity period of interchange control number. - InterchangeControlNumberValidityDays *int32 `json:"interchangeControlNumberValidityDays,omitempty"` - // CheckDuplicateGroupControlNumber - The value indicating whether to check for duplicate group control number. - CheckDuplicateGroupControlNumber *bool `json:"checkDuplicateGroupControlNumber,omitempty"` - // CheckDuplicateTransactionSetControlNumber - The value indicating whether to check for duplicate transaction set control number. - CheckDuplicateTransactionSetControlNumber *bool `json:"checkDuplicateTransactionSetControlNumber,omitempty"` - // ValidateEDITypes - The value indicating whether to Whether to validate EDI types. - ValidateEDITypes *bool `json:"validateEDITypes,omitempty"` - // ValidateXSDTypes - The value indicating whether to Whether to validate XSD types. - ValidateXSDTypes *bool `json:"validateXSDTypes,omitempty"` - // AllowLeadingAndTrailingSpacesAndZeroes - The value indicating whether to allow leading and trailing spaces and zeroes. - AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` - // TrimLeadingAndTrailingSpacesAndZeroes - The value indicating whether to trim leading and trailing spaces and zeroes. - TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` - // TrailingSeparatorPolicy - The trailing separator policy. Possible values include: 'TrailingSeparatorPolicyNotSpecified', 'TrailingSeparatorPolicyNotAllowed', 'TrailingSeparatorPolicyOptional', 'TrailingSeparatorPolicyMandatory' - TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` -} - -// ErrorInfo the error info. -type ErrorInfo struct { - // Code - The error code. - Code *string `json:"code,omitempty"` -} - -// ErrorProperties error properties indicate why the Logic service was not able to process the incoming -// request. The reason is provided in the error message. -type ErrorProperties struct { - // Code - Error code. - Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// ErrorResponse error response indicates Logic service is not able to process the incoming request. The -// error property contains the error details. -type ErrorResponse struct { - // Error - The error properties. - Error *ErrorProperties `json:"error,omitempty"` -} - -// Expression the expression. -type Expression struct { - // Text - The text. - Text *string `json:"text,omitempty"` - Value interface{} `json:"value,omitempty"` - // Subexpressions - The sub expressions. - Subexpressions *[]Expression `json:"subexpressions,omitempty"` - Error *AzureResourceErrorInfo `json:"error,omitempty"` -} - -// ExpressionRoot the expression root. -type ExpressionRoot struct { - // Path - The path. - Path *string `json:"path,omitempty"` - // Text - The text. - Text *string `json:"text,omitempty"` - Value interface{} `json:"value,omitempty"` - // Subexpressions - The sub expressions. - Subexpressions *[]Expression `json:"subexpressions,omitempty"` - Error *AzureResourceErrorInfo `json:"error,omitempty"` -} - -// ExpressionTraces the expression traces. -type ExpressionTraces struct { - autorest.Response `json:"-"` - Inputs *[]ExpressionRoot `json:"inputs,omitempty"` -} - -// ExtendedErrorInfo the extended error info. -type ExtendedErrorInfo struct { - // Code - The error code. Possible values include: 'ErrorResponseCodeNotSpecified', 'ErrorResponseCodeIntegrationServiceEnvironmentNotFound', 'ErrorResponseCodeInternalServerError', 'ErrorResponseCodeInvalidOperationID' - Code ErrorResponseCode `json:"code,omitempty"` - // Message - The error message. - Message *string `json:"message,omitempty"` - // Details - The error message details. - Details *[]ExtendedErrorInfo `json:"details,omitempty"` - // InnerError - The inner error. - InnerError interface{} `json:"innerError,omitempty"` -} - -// FlowAccessControlConfiguration the access control configuration. -type FlowAccessControlConfiguration struct { - // Triggers - The access control configuration for invoking workflow triggers. - Triggers *FlowAccessControlConfigurationPolicy `json:"triggers,omitempty"` - // Contents - The access control configuration for accessing workflow run contents. - Contents *FlowAccessControlConfigurationPolicy `json:"contents,omitempty"` - // Actions - The access control configuration for workflow actions. - Actions *FlowAccessControlConfigurationPolicy `json:"actions,omitempty"` - // WorkflowManagement - The access control configuration for workflow management. - WorkflowManagement *FlowAccessControlConfigurationPolicy `json:"workflowManagement,omitempty"` -} - -// FlowAccessControlConfigurationPolicy the access control configuration policy. -type FlowAccessControlConfigurationPolicy struct { - // AllowedCallerIPAddresses - The allowed caller IP address ranges. - AllowedCallerIPAddresses *[]IPAddressRange `json:"allowedCallerIpAddresses,omitempty"` - // OpenAuthenticationPolicies - The authentication policies for workflow. - OpenAuthenticationPolicies *OpenAuthenticationAccessPolicies `json:"openAuthenticationPolicies,omitempty"` -} - -// FlowEndpoints the flow endpoints configuration. -type FlowEndpoints struct { - // OutgoingIPAddresses - The outgoing ip address. - OutgoingIPAddresses *[]IPAddress `json:"outgoingIpAddresses,omitempty"` - // AccessEndpointIPAddresses - The access endpoint ip address. - AccessEndpointIPAddresses *[]IPAddress `json:"accessEndpointIpAddresses,omitempty"` -} - -// FlowEndpointsConfiguration the endpoints configuration. -type FlowEndpointsConfiguration struct { - // Workflow - The workflow endpoints. - Workflow *FlowEndpoints `json:"workflow,omitempty"` - // Connector - The connector endpoints. - Connector *FlowEndpoints `json:"connector,omitempty"` -} - -// GenerateUpgradedDefinitionParameters the parameters to generate upgraded definition. -type GenerateUpgradedDefinitionParameters struct { - // TargetSchemaVersion - The target schema version. - TargetSchemaVersion *string `json:"targetSchemaVersion,omitempty"` -} - -// GetCallbackURLParameters the callback url parameters. -type GetCallbackURLParameters struct { - // NotAfter - The expiry time. - NotAfter *date.Time `json:"notAfter,omitempty"` - // KeyType - The key type. Possible values include: 'KeyTypeNotSpecified', 'KeyTypePrimary', 'KeyTypeSecondary' - KeyType KeyType `json:"keyType,omitempty"` -} - -// IntegrationAccount the integration account. -type IntegrationAccount struct { - autorest.Response `json:"-"` - // IntegrationAccountProperties - The integration account properties. - *IntegrationAccountProperties `json:"properties,omitempty"` - // Sku - The sku. - Sku *IntegrationAccountSku `json:"sku,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for IntegrationAccount. -func (ia IntegrationAccount) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ia.IntegrationAccountProperties != nil { - objectMap["properties"] = ia.IntegrationAccountProperties - } - if ia.Sku != nil { - objectMap["sku"] = ia.Sku - } - if ia.Location != nil { - objectMap["location"] = ia.Location - } - if ia.Tags != nil { - objectMap["tags"] = ia.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationAccount struct. -func (ia *IntegrationAccount) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var integrationAccountProperties IntegrationAccountProperties - err = json.Unmarshal(*v, &integrationAccountProperties) - if err != nil { - return err - } - ia.IntegrationAccountProperties = &integrationAccountProperties - } - case "sku": - if v != nil { - var sku IntegrationAccountSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - ia.Sku = &sku - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ia.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ia.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ia.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ia.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ia.Tags = tags - } - } - } - - return nil -} - -// IntegrationAccountAgreement the integration account agreement. -type IntegrationAccountAgreement struct { - autorest.Response `json:"-"` - // IntegrationAccountAgreementProperties - The integration account agreement properties. - *IntegrationAccountAgreementProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for IntegrationAccountAgreement. -func (iaa IntegrationAccountAgreement) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iaa.IntegrationAccountAgreementProperties != nil { - objectMap["properties"] = iaa.IntegrationAccountAgreementProperties - } - if iaa.Location != nil { - objectMap["location"] = iaa.Location - } - if iaa.Tags != nil { - objectMap["tags"] = iaa.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationAccountAgreement struct. -func (iaa *IntegrationAccountAgreement) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var integrationAccountAgreementProperties IntegrationAccountAgreementProperties - err = json.Unmarshal(*v, &integrationAccountAgreementProperties) - if err != nil { - return err - } - iaa.IntegrationAccountAgreementProperties = &integrationAccountAgreementProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - iaa.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - iaa.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - iaa.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - iaa.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - iaa.Tags = tags - } - } - } - - return nil -} - -// IntegrationAccountAgreementFilter the integration account agreement filter for odata query. -type IntegrationAccountAgreementFilter struct { - // AgreementType - The agreement type of integration account agreement. Possible values include: 'AgreementTypeNotSpecified', 'AgreementTypeAS2', 'AgreementTypeX12', 'AgreementTypeEdifact' - AgreementType AgreementType `json:"agreementType,omitempty"` -} - -// IntegrationAccountAgreementListResult the list of integration account agreements. -type IntegrationAccountAgreementListResult struct { - autorest.Response `json:"-"` - // Value - The list of integration account agreements. - Value *[]IntegrationAccountAgreement `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationAccountAgreementListResultIterator provides access to a complete listing of -// IntegrationAccountAgreement values. -type IntegrationAccountAgreementListResultIterator struct { - i int - page IntegrationAccountAgreementListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IntegrationAccountAgreementListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountAgreementListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IntegrationAccountAgreementListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IntegrationAccountAgreementListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IntegrationAccountAgreementListResultIterator) Response() IntegrationAccountAgreementListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IntegrationAccountAgreementListResultIterator) Value() IntegrationAccountAgreement { - if !iter.page.NotDone() { - return IntegrationAccountAgreement{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IntegrationAccountAgreementListResultIterator type. -func NewIntegrationAccountAgreementListResultIterator(page IntegrationAccountAgreementListResultPage) IntegrationAccountAgreementListResultIterator { - return IntegrationAccountAgreementListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iaalr IntegrationAccountAgreementListResult) IsEmpty() bool { - return iaalr.Value == nil || len(*iaalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iaalr IntegrationAccountAgreementListResult) hasNextLink() bool { - return iaalr.NextLink != nil && len(*iaalr.NextLink) != 0 -} - -// integrationAccountAgreementListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iaalr IntegrationAccountAgreementListResult) integrationAccountAgreementListResultPreparer(ctx context.Context) (*http.Request, error) { - if !iaalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iaalr.NextLink))) -} - -// IntegrationAccountAgreementListResultPage contains a page of IntegrationAccountAgreement values. -type IntegrationAccountAgreementListResultPage struct { - fn func(context.Context, IntegrationAccountAgreementListResult) (IntegrationAccountAgreementListResult, error) - iaalr IntegrationAccountAgreementListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IntegrationAccountAgreementListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountAgreementListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.iaalr) - if err != nil { - return err - } - page.iaalr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IntegrationAccountAgreementListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IntegrationAccountAgreementListResultPage) NotDone() bool { - return !page.iaalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IntegrationAccountAgreementListResultPage) Response() IntegrationAccountAgreementListResult { - return page.iaalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IntegrationAccountAgreementListResultPage) Values() []IntegrationAccountAgreement { - if page.iaalr.IsEmpty() { - return nil - } - return *page.iaalr.Value -} - -// Creates a new instance of the IntegrationAccountAgreementListResultPage type. -func NewIntegrationAccountAgreementListResultPage(cur IntegrationAccountAgreementListResult, getNextPage func(context.Context, IntegrationAccountAgreementListResult) (IntegrationAccountAgreementListResult, error)) IntegrationAccountAgreementListResultPage { - return IntegrationAccountAgreementListResultPage{ - fn: getNextPage, - iaalr: cur, - } -} - -// IntegrationAccountAgreementProperties the integration account agreement properties. -type IntegrationAccountAgreementProperties struct { - // CreatedTime - READ-ONLY; The created time. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ChangedTime - READ-ONLY; The changed time. - ChangedTime *date.Time `json:"changedTime,omitempty"` - // Metadata - The metadata. - Metadata interface{} `json:"metadata,omitempty"` - // AgreementType - The agreement type. Possible values include: 'AgreementTypeNotSpecified', 'AgreementTypeAS2', 'AgreementTypeX12', 'AgreementTypeEdifact' - AgreementType AgreementType `json:"agreementType,omitempty"` - // HostPartner - The integration account partner that is set as host partner for this agreement. - HostPartner *string `json:"hostPartner,omitempty"` - // GuestPartner - The integration account partner that is set as guest partner for this agreement. - GuestPartner *string `json:"guestPartner,omitempty"` - // HostIdentity - The business identity of the host partner. - HostIdentity *BusinessIdentity `json:"hostIdentity,omitempty"` - // GuestIdentity - The business identity of the guest partner. - GuestIdentity *BusinessIdentity `json:"guestIdentity,omitempty"` - // Content - The agreement content. - Content *AgreementContent `json:"content,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationAccountAgreementProperties. -func (iaap IntegrationAccountAgreementProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iaap.Metadata != nil { - objectMap["metadata"] = iaap.Metadata - } - if iaap.AgreementType != "" { - objectMap["agreementType"] = iaap.AgreementType - } - if iaap.HostPartner != nil { - objectMap["hostPartner"] = iaap.HostPartner - } - if iaap.GuestPartner != nil { - objectMap["guestPartner"] = iaap.GuestPartner - } - if iaap.HostIdentity != nil { - objectMap["hostIdentity"] = iaap.HostIdentity - } - if iaap.GuestIdentity != nil { - objectMap["guestIdentity"] = iaap.GuestIdentity - } - if iaap.Content != nil { - objectMap["content"] = iaap.Content - } - return json.Marshal(objectMap) -} - -// IntegrationAccountCertificate the integration account certificate. -type IntegrationAccountCertificate struct { - autorest.Response `json:"-"` - // IntegrationAccountCertificateProperties - The integration account certificate properties. - *IntegrationAccountCertificateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for IntegrationAccountCertificate. -func (iac IntegrationAccountCertificate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iac.IntegrationAccountCertificateProperties != nil { - objectMap["properties"] = iac.IntegrationAccountCertificateProperties - } - if iac.Location != nil { - objectMap["location"] = iac.Location - } - if iac.Tags != nil { - objectMap["tags"] = iac.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationAccountCertificate struct. -func (iac *IntegrationAccountCertificate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var integrationAccountCertificateProperties IntegrationAccountCertificateProperties - err = json.Unmarshal(*v, &integrationAccountCertificateProperties) - if err != nil { - return err - } - iac.IntegrationAccountCertificateProperties = &integrationAccountCertificateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - iac.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - iac.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - iac.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - iac.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - iac.Tags = tags - } - } - } - - return nil -} - -// IntegrationAccountCertificateListResult the list of integration account certificates. -type IntegrationAccountCertificateListResult struct { - autorest.Response `json:"-"` - // Value - The list of integration account certificates. - Value *[]IntegrationAccountCertificate `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationAccountCertificateListResultIterator provides access to a complete listing of -// IntegrationAccountCertificate values. -type IntegrationAccountCertificateListResultIterator struct { - i int - page IntegrationAccountCertificateListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IntegrationAccountCertificateListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountCertificateListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IntegrationAccountCertificateListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IntegrationAccountCertificateListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IntegrationAccountCertificateListResultIterator) Response() IntegrationAccountCertificateListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IntegrationAccountCertificateListResultIterator) Value() IntegrationAccountCertificate { - if !iter.page.NotDone() { - return IntegrationAccountCertificate{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IntegrationAccountCertificateListResultIterator type. -func NewIntegrationAccountCertificateListResultIterator(page IntegrationAccountCertificateListResultPage) IntegrationAccountCertificateListResultIterator { - return IntegrationAccountCertificateListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iaclr IntegrationAccountCertificateListResult) IsEmpty() bool { - return iaclr.Value == nil || len(*iaclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iaclr IntegrationAccountCertificateListResult) hasNextLink() bool { - return iaclr.NextLink != nil && len(*iaclr.NextLink) != 0 -} - -// integrationAccountCertificateListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iaclr IntegrationAccountCertificateListResult) integrationAccountCertificateListResultPreparer(ctx context.Context) (*http.Request, error) { - if !iaclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iaclr.NextLink))) -} - -// IntegrationAccountCertificateListResultPage contains a page of IntegrationAccountCertificate values. -type IntegrationAccountCertificateListResultPage struct { - fn func(context.Context, IntegrationAccountCertificateListResult) (IntegrationAccountCertificateListResult, error) - iaclr IntegrationAccountCertificateListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IntegrationAccountCertificateListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountCertificateListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.iaclr) - if err != nil { - return err - } - page.iaclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IntegrationAccountCertificateListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IntegrationAccountCertificateListResultPage) NotDone() bool { - return !page.iaclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IntegrationAccountCertificateListResultPage) Response() IntegrationAccountCertificateListResult { - return page.iaclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IntegrationAccountCertificateListResultPage) Values() []IntegrationAccountCertificate { - if page.iaclr.IsEmpty() { - return nil - } - return *page.iaclr.Value -} - -// Creates a new instance of the IntegrationAccountCertificateListResultPage type. -func NewIntegrationAccountCertificateListResultPage(cur IntegrationAccountCertificateListResult, getNextPage func(context.Context, IntegrationAccountCertificateListResult) (IntegrationAccountCertificateListResult, error)) IntegrationAccountCertificateListResultPage { - return IntegrationAccountCertificateListResultPage{ - fn: getNextPage, - iaclr: cur, - } -} - -// IntegrationAccountCertificateProperties the integration account certificate properties. -type IntegrationAccountCertificateProperties struct { - // CreatedTime - READ-ONLY; The created time. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ChangedTime - READ-ONLY; The changed time. - ChangedTime *date.Time `json:"changedTime,omitempty"` - // Metadata - The metadata. - Metadata interface{} `json:"metadata,omitempty"` - // Key - The key details in the key vault. - Key *KeyVaultKeyReference `json:"key,omitempty"` - // PublicCertificate - The public certificate. - PublicCertificate *string `json:"publicCertificate,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationAccountCertificateProperties. -func (iacp IntegrationAccountCertificateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iacp.Metadata != nil { - objectMap["metadata"] = iacp.Metadata - } - if iacp.Key != nil { - objectMap["key"] = iacp.Key - } - if iacp.PublicCertificate != nil { - objectMap["publicCertificate"] = iacp.PublicCertificate - } - return json.Marshal(objectMap) -} - -// IntegrationAccountListResult the list of integration accounts. -type IntegrationAccountListResult struct { - autorest.Response `json:"-"` - // Value - The list of integration accounts. - Value *[]IntegrationAccount `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationAccountListResultIterator provides access to a complete listing of IntegrationAccount values. -type IntegrationAccountListResultIterator struct { - i int - page IntegrationAccountListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IntegrationAccountListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IntegrationAccountListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IntegrationAccountListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IntegrationAccountListResultIterator) Response() IntegrationAccountListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IntegrationAccountListResultIterator) Value() IntegrationAccount { - if !iter.page.NotDone() { - return IntegrationAccount{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IntegrationAccountListResultIterator type. -func NewIntegrationAccountListResultIterator(page IntegrationAccountListResultPage) IntegrationAccountListResultIterator { - return IntegrationAccountListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ialr IntegrationAccountListResult) IsEmpty() bool { - return ialr.Value == nil || len(*ialr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ialr IntegrationAccountListResult) hasNextLink() bool { - return ialr.NextLink != nil && len(*ialr.NextLink) != 0 -} - -// integrationAccountListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ialr IntegrationAccountListResult) integrationAccountListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ialr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ialr.NextLink))) -} - -// IntegrationAccountListResultPage contains a page of IntegrationAccount values. -type IntegrationAccountListResultPage struct { - fn func(context.Context, IntegrationAccountListResult) (IntegrationAccountListResult, error) - ialr IntegrationAccountListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IntegrationAccountListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ialr) - if err != nil { - return err - } - page.ialr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IntegrationAccountListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IntegrationAccountListResultPage) NotDone() bool { - return !page.ialr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IntegrationAccountListResultPage) Response() IntegrationAccountListResult { - return page.ialr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IntegrationAccountListResultPage) Values() []IntegrationAccount { - if page.ialr.IsEmpty() { - return nil - } - return *page.ialr.Value -} - -// Creates a new instance of the IntegrationAccountListResultPage type. -func NewIntegrationAccountListResultPage(cur IntegrationAccountListResult, getNextPage func(context.Context, IntegrationAccountListResult) (IntegrationAccountListResult, error)) IntegrationAccountListResultPage { - return IntegrationAccountListResultPage{ - fn: getNextPage, - ialr: cur, - } -} - -// IntegrationAccountMap the integration account map. -type IntegrationAccountMap struct { - autorest.Response `json:"-"` - // IntegrationAccountMapProperties - The integration account map properties. - *IntegrationAccountMapProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for IntegrationAccountMap. -func (iam IntegrationAccountMap) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iam.IntegrationAccountMapProperties != nil { - objectMap["properties"] = iam.IntegrationAccountMapProperties - } - if iam.Location != nil { - objectMap["location"] = iam.Location - } - if iam.Tags != nil { - objectMap["tags"] = iam.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationAccountMap struct. -func (iam *IntegrationAccountMap) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var integrationAccountMapProperties IntegrationAccountMapProperties - err = json.Unmarshal(*v, &integrationAccountMapProperties) - if err != nil { - return err - } - iam.IntegrationAccountMapProperties = &integrationAccountMapProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - iam.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - iam.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - iam.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - iam.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - iam.Tags = tags - } - } - } - - return nil -} - -// IntegrationAccountMapFilter the integration account map filter for odata query. -type IntegrationAccountMapFilter struct { - // MapType - The map type of integration account map. Possible values include: 'MapTypeNotSpecified', 'MapTypeXslt', 'MapTypeXslt20', 'MapTypeXslt30', 'MapTypeLiquid' - MapType MapType `json:"mapType,omitempty"` -} - -// IntegrationAccountMapListResult the list of integration account maps. -type IntegrationAccountMapListResult struct { - autorest.Response `json:"-"` - // Value - The list of integration account maps. - Value *[]IntegrationAccountMap `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationAccountMapListResultIterator provides access to a complete listing of IntegrationAccountMap -// values. -type IntegrationAccountMapListResultIterator struct { - i int - page IntegrationAccountMapListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IntegrationAccountMapListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountMapListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IntegrationAccountMapListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IntegrationAccountMapListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IntegrationAccountMapListResultIterator) Response() IntegrationAccountMapListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IntegrationAccountMapListResultIterator) Value() IntegrationAccountMap { - if !iter.page.NotDone() { - return IntegrationAccountMap{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IntegrationAccountMapListResultIterator type. -func NewIntegrationAccountMapListResultIterator(page IntegrationAccountMapListResultPage) IntegrationAccountMapListResultIterator { - return IntegrationAccountMapListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iamlr IntegrationAccountMapListResult) IsEmpty() bool { - return iamlr.Value == nil || len(*iamlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iamlr IntegrationAccountMapListResult) hasNextLink() bool { - return iamlr.NextLink != nil && len(*iamlr.NextLink) != 0 -} - -// integrationAccountMapListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iamlr IntegrationAccountMapListResult) integrationAccountMapListResultPreparer(ctx context.Context) (*http.Request, error) { - if !iamlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iamlr.NextLink))) -} - -// IntegrationAccountMapListResultPage contains a page of IntegrationAccountMap values. -type IntegrationAccountMapListResultPage struct { - fn func(context.Context, IntegrationAccountMapListResult) (IntegrationAccountMapListResult, error) - iamlr IntegrationAccountMapListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IntegrationAccountMapListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountMapListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.iamlr) - if err != nil { - return err - } - page.iamlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IntegrationAccountMapListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IntegrationAccountMapListResultPage) NotDone() bool { - return !page.iamlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IntegrationAccountMapListResultPage) Response() IntegrationAccountMapListResult { - return page.iamlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IntegrationAccountMapListResultPage) Values() []IntegrationAccountMap { - if page.iamlr.IsEmpty() { - return nil - } - return *page.iamlr.Value -} - -// Creates a new instance of the IntegrationAccountMapListResultPage type. -func NewIntegrationAccountMapListResultPage(cur IntegrationAccountMapListResult, getNextPage func(context.Context, IntegrationAccountMapListResult) (IntegrationAccountMapListResult, error)) IntegrationAccountMapListResultPage { - return IntegrationAccountMapListResultPage{ - fn: getNextPage, - iamlr: cur, - } -} - -// IntegrationAccountMapProperties the integration account map. -type IntegrationAccountMapProperties struct { - // MapType - The map type. Possible values include: 'MapTypeNotSpecified', 'MapTypeXslt', 'MapTypeXslt20', 'MapTypeXslt30', 'MapTypeLiquid' - MapType MapType `json:"mapType,omitempty"` - // ParametersSchema - The parameters schema of integration account map. - ParametersSchema *IntegrationAccountMapPropertiesParametersSchema `json:"parametersSchema,omitempty"` - // CreatedTime - READ-ONLY; The created time. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ChangedTime - READ-ONLY; The changed time. - ChangedTime *date.Time `json:"changedTime,omitempty"` - // Content - The content. - Content *string `json:"content,omitempty"` - // ContentType - The content type. - ContentType *string `json:"contentType,omitempty"` - // ContentLink - READ-ONLY; The content link. - ContentLink *ContentLink `json:"contentLink,omitempty"` - // Metadata - The metadata. - Metadata interface{} `json:"metadata,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationAccountMapProperties. -func (iamp IntegrationAccountMapProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iamp.MapType != "" { - objectMap["mapType"] = iamp.MapType - } - if iamp.ParametersSchema != nil { - objectMap["parametersSchema"] = iamp.ParametersSchema - } - if iamp.Content != nil { - objectMap["content"] = iamp.Content - } - if iamp.ContentType != nil { - objectMap["contentType"] = iamp.ContentType - } - if iamp.Metadata != nil { - objectMap["metadata"] = iamp.Metadata - } - return json.Marshal(objectMap) -} - -// IntegrationAccountMapPropertiesParametersSchema the parameters schema of integration account map. -type IntegrationAccountMapPropertiesParametersSchema struct { - // Ref - The reference name. - Ref *string `json:"ref,omitempty"` -} - -// IntegrationAccountPartner the integration account partner. -type IntegrationAccountPartner struct { - autorest.Response `json:"-"` - // IntegrationAccountPartnerProperties - The integration account partner properties. - *IntegrationAccountPartnerProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for IntegrationAccountPartner. -func (iap IntegrationAccountPartner) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iap.IntegrationAccountPartnerProperties != nil { - objectMap["properties"] = iap.IntegrationAccountPartnerProperties - } - if iap.Location != nil { - objectMap["location"] = iap.Location - } - if iap.Tags != nil { - objectMap["tags"] = iap.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationAccountPartner struct. -func (iap *IntegrationAccountPartner) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var integrationAccountPartnerProperties IntegrationAccountPartnerProperties - err = json.Unmarshal(*v, &integrationAccountPartnerProperties) - if err != nil { - return err - } - iap.IntegrationAccountPartnerProperties = &integrationAccountPartnerProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - iap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - iap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - iap.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - iap.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - iap.Tags = tags - } - } - } - - return nil -} - -// IntegrationAccountPartnerFilter the integration account partner filter for odata query. -type IntegrationAccountPartnerFilter struct { - // PartnerType - The partner type of integration account partner. Possible values include: 'PartnerTypeNotSpecified', 'PartnerTypeB2B' - PartnerType PartnerType `json:"partnerType,omitempty"` -} - -// IntegrationAccountPartnerListResult the list of integration account partners. -type IntegrationAccountPartnerListResult struct { - autorest.Response `json:"-"` - // Value - The list of integration account partners. - Value *[]IntegrationAccountPartner `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationAccountPartnerListResultIterator provides access to a complete listing of -// IntegrationAccountPartner values. -type IntegrationAccountPartnerListResultIterator struct { - i int - page IntegrationAccountPartnerListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IntegrationAccountPartnerListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountPartnerListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IntegrationAccountPartnerListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IntegrationAccountPartnerListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IntegrationAccountPartnerListResultIterator) Response() IntegrationAccountPartnerListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IntegrationAccountPartnerListResultIterator) Value() IntegrationAccountPartner { - if !iter.page.NotDone() { - return IntegrationAccountPartner{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IntegrationAccountPartnerListResultIterator type. -func NewIntegrationAccountPartnerListResultIterator(page IntegrationAccountPartnerListResultPage) IntegrationAccountPartnerListResultIterator { - return IntegrationAccountPartnerListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iaplr IntegrationAccountPartnerListResult) IsEmpty() bool { - return iaplr.Value == nil || len(*iaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iaplr IntegrationAccountPartnerListResult) hasNextLink() bool { - return iaplr.NextLink != nil && len(*iaplr.NextLink) != 0 -} - -// integrationAccountPartnerListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iaplr IntegrationAccountPartnerListResult) integrationAccountPartnerListResultPreparer(ctx context.Context) (*http.Request, error) { - if !iaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iaplr.NextLink))) -} - -// IntegrationAccountPartnerListResultPage contains a page of IntegrationAccountPartner values. -type IntegrationAccountPartnerListResultPage struct { - fn func(context.Context, IntegrationAccountPartnerListResult) (IntegrationAccountPartnerListResult, error) - iaplr IntegrationAccountPartnerListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IntegrationAccountPartnerListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountPartnerListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.iaplr) - if err != nil { - return err - } - page.iaplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IntegrationAccountPartnerListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IntegrationAccountPartnerListResultPage) NotDone() bool { - return !page.iaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IntegrationAccountPartnerListResultPage) Response() IntegrationAccountPartnerListResult { - return page.iaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IntegrationAccountPartnerListResultPage) Values() []IntegrationAccountPartner { - if page.iaplr.IsEmpty() { - return nil - } - return *page.iaplr.Value -} - -// Creates a new instance of the IntegrationAccountPartnerListResultPage type. -func NewIntegrationAccountPartnerListResultPage(cur IntegrationAccountPartnerListResult, getNextPage func(context.Context, IntegrationAccountPartnerListResult) (IntegrationAccountPartnerListResult, error)) IntegrationAccountPartnerListResultPage { - return IntegrationAccountPartnerListResultPage{ - fn: getNextPage, - iaplr: cur, - } -} - -// IntegrationAccountPartnerProperties the integration account partner properties. -type IntegrationAccountPartnerProperties struct { - // PartnerType - The partner type. Possible values include: 'PartnerTypeNotSpecified', 'PartnerTypeB2B' - PartnerType PartnerType `json:"partnerType,omitempty"` - // CreatedTime - READ-ONLY; The created time. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ChangedTime - READ-ONLY; The changed time. - ChangedTime *date.Time `json:"changedTime,omitempty"` - // Metadata - The metadata. - Metadata interface{} `json:"metadata,omitempty"` - // Content - The partner content. - Content *PartnerContent `json:"content,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationAccountPartnerProperties. -func (iapp IntegrationAccountPartnerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iapp.PartnerType != "" { - objectMap["partnerType"] = iapp.PartnerType - } - if iapp.Metadata != nil { - objectMap["metadata"] = iapp.Metadata - } - if iapp.Content != nil { - objectMap["content"] = iapp.Content - } - return json.Marshal(objectMap) -} - -// IntegrationAccountProperties the integration account properties. -type IntegrationAccountProperties struct { - // IntegrationServiceEnvironment - The integration service environment. - IntegrationServiceEnvironment *ResourceReference `json:"integrationServiceEnvironment,omitempty"` - // State - The workflow state. Possible values include: 'WorkflowStateNotSpecified', 'WorkflowStateCompleted', 'WorkflowStateEnabled', 'WorkflowStateDisabled', 'WorkflowStateDeleted', 'WorkflowStateSuspended' - State WorkflowState `json:"state,omitempty"` -} - -// IntegrationAccountSchema the integration account schema. -type IntegrationAccountSchema struct { - autorest.Response `json:"-"` - // IntegrationAccountSchemaProperties - The integration account schema properties. - *IntegrationAccountSchemaProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for IntegrationAccountSchema. -func (ias IntegrationAccountSchema) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ias.IntegrationAccountSchemaProperties != nil { - objectMap["properties"] = ias.IntegrationAccountSchemaProperties - } - if ias.Location != nil { - objectMap["location"] = ias.Location - } - if ias.Tags != nil { - objectMap["tags"] = ias.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationAccountSchema struct. -func (ias *IntegrationAccountSchema) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var integrationAccountSchemaProperties IntegrationAccountSchemaProperties - err = json.Unmarshal(*v, &integrationAccountSchemaProperties) - if err != nil { - return err - } - ias.IntegrationAccountSchemaProperties = &integrationAccountSchemaProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ias.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ias.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ias.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ias.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ias.Tags = tags - } - } - } - - return nil -} - -// IntegrationAccountSchemaFilter the integration account schema filter for odata query. -type IntegrationAccountSchemaFilter struct { - // SchemaType - The schema type of integration account schema. Possible values include: 'SchemaTypeNotSpecified', 'SchemaTypeXML' - SchemaType SchemaType `json:"schemaType,omitempty"` -} - -// IntegrationAccountSchemaListResult the list of integration account schemas. -type IntegrationAccountSchemaListResult struct { - autorest.Response `json:"-"` - // Value - The list of integration account schemas. - Value *[]IntegrationAccountSchema `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationAccountSchemaListResultIterator provides access to a complete listing of -// IntegrationAccountSchema values. -type IntegrationAccountSchemaListResultIterator struct { - i int - page IntegrationAccountSchemaListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IntegrationAccountSchemaListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountSchemaListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IntegrationAccountSchemaListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IntegrationAccountSchemaListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IntegrationAccountSchemaListResultIterator) Response() IntegrationAccountSchemaListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IntegrationAccountSchemaListResultIterator) Value() IntegrationAccountSchema { - if !iter.page.NotDone() { - return IntegrationAccountSchema{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IntegrationAccountSchemaListResultIterator type. -func NewIntegrationAccountSchemaListResultIterator(page IntegrationAccountSchemaListResultPage) IntegrationAccountSchemaListResultIterator { - return IntegrationAccountSchemaListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iaslr IntegrationAccountSchemaListResult) IsEmpty() bool { - return iaslr.Value == nil || len(*iaslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iaslr IntegrationAccountSchemaListResult) hasNextLink() bool { - return iaslr.NextLink != nil && len(*iaslr.NextLink) != 0 -} - -// integrationAccountSchemaListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iaslr IntegrationAccountSchemaListResult) integrationAccountSchemaListResultPreparer(ctx context.Context) (*http.Request, error) { - if !iaslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iaslr.NextLink))) -} - -// IntegrationAccountSchemaListResultPage contains a page of IntegrationAccountSchema values. -type IntegrationAccountSchemaListResultPage struct { - fn func(context.Context, IntegrationAccountSchemaListResult) (IntegrationAccountSchemaListResult, error) - iaslr IntegrationAccountSchemaListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IntegrationAccountSchemaListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountSchemaListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.iaslr) - if err != nil { - return err - } - page.iaslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IntegrationAccountSchemaListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IntegrationAccountSchemaListResultPage) NotDone() bool { - return !page.iaslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IntegrationAccountSchemaListResultPage) Response() IntegrationAccountSchemaListResult { - return page.iaslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IntegrationAccountSchemaListResultPage) Values() []IntegrationAccountSchema { - if page.iaslr.IsEmpty() { - return nil - } - return *page.iaslr.Value -} - -// Creates a new instance of the IntegrationAccountSchemaListResultPage type. -func NewIntegrationAccountSchemaListResultPage(cur IntegrationAccountSchemaListResult, getNextPage func(context.Context, IntegrationAccountSchemaListResult) (IntegrationAccountSchemaListResult, error)) IntegrationAccountSchemaListResultPage { - return IntegrationAccountSchemaListResultPage{ - fn: getNextPage, - iaslr: cur, - } -} - -// IntegrationAccountSchemaProperties the integration account schema properties. -type IntegrationAccountSchemaProperties struct { - // SchemaType - The schema type. Possible values include: 'SchemaTypeNotSpecified', 'SchemaTypeXML' - SchemaType SchemaType `json:"schemaType,omitempty"` - // TargetNamespace - The target namespace of the schema. - TargetNamespace *string `json:"targetNamespace,omitempty"` - // DocumentName - The document name. - DocumentName *string `json:"documentName,omitempty"` - // FileName - The file name. - FileName *string `json:"fileName,omitempty"` - // CreatedTime - READ-ONLY; The created time. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ChangedTime - READ-ONLY; The changed time. - ChangedTime *date.Time `json:"changedTime,omitempty"` - // Metadata - The metadata. - Metadata interface{} `json:"metadata,omitempty"` - // Content - The content. - Content *string `json:"content,omitempty"` - // ContentType - The content type. - ContentType *string `json:"contentType,omitempty"` - // ContentLink - READ-ONLY; The content link. - ContentLink *ContentLink `json:"contentLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationAccountSchemaProperties. -func (iasp IntegrationAccountSchemaProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iasp.SchemaType != "" { - objectMap["schemaType"] = iasp.SchemaType - } - if iasp.TargetNamespace != nil { - objectMap["targetNamespace"] = iasp.TargetNamespace - } - if iasp.DocumentName != nil { - objectMap["documentName"] = iasp.DocumentName - } - if iasp.FileName != nil { - objectMap["fileName"] = iasp.FileName - } - if iasp.Metadata != nil { - objectMap["metadata"] = iasp.Metadata - } - if iasp.Content != nil { - objectMap["content"] = iasp.Content - } - if iasp.ContentType != nil { - objectMap["contentType"] = iasp.ContentType - } - return json.Marshal(objectMap) -} - -// IntegrationAccountSession the integration account session. -type IntegrationAccountSession struct { - autorest.Response `json:"-"` - // IntegrationAccountSessionProperties - The integration account session properties. - *IntegrationAccountSessionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for IntegrationAccountSession. -func (ias IntegrationAccountSession) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ias.IntegrationAccountSessionProperties != nil { - objectMap["properties"] = ias.IntegrationAccountSessionProperties - } - if ias.Location != nil { - objectMap["location"] = ias.Location - } - if ias.Tags != nil { - objectMap["tags"] = ias.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationAccountSession struct. -func (ias *IntegrationAccountSession) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var integrationAccountSessionProperties IntegrationAccountSessionProperties - err = json.Unmarshal(*v, &integrationAccountSessionProperties) - if err != nil { - return err - } - ias.IntegrationAccountSessionProperties = &integrationAccountSessionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ias.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ias.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ias.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ias.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ias.Tags = tags - } - } - } - - return nil -} - -// IntegrationAccountSessionFilter the integration account session filter. -type IntegrationAccountSessionFilter struct { - // ChangedTime - The changed time of integration account sessions. - ChangedTime *date.Time `json:"changedTime,omitempty"` -} - -// IntegrationAccountSessionListResult the list of integration account sessions. -type IntegrationAccountSessionListResult struct { - autorest.Response `json:"-"` - // Value - The list of integration account sessions. - Value *[]IntegrationAccountSession `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationAccountSessionListResultIterator provides access to a complete listing of -// IntegrationAccountSession values. -type IntegrationAccountSessionListResultIterator struct { - i int - page IntegrationAccountSessionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IntegrationAccountSessionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountSessionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IntegrationAccountSessionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IntegrationAccountSessionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IntegrationAccountSessionListResultIterator) Response() IntegrationAccountSessionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IntegrationAccountSessionListResultIterator) Value() IntegrationAccountSession { - if !iter.page.NotDone() { - return IntegrationAccountSession{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IntegrationAccountSessionListResultIterator type. -func NewIntegrationAccountSessionListResultIterator(page IntegrationAccountSessionListResultPage) IntegrationAccountSessionListResultIterator { - return IntegrationAccountSessionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iaslr IntegrationAccountSessionListResult) IsEmpty() bool { - return iaslr.Value == nil || len(*iaslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iaslr IntegrationAccountSessionListResult) hasNextLink() bool { - return iaslr.NextLink != nil && len(*iaslr.NextLink) != 0 -} - -// integrationAccountSessionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iaslr IntegrationAccountSessionListResult) integrationAccountSessionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !iaslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iaslr.NextLink))) -} - -// IntegrationAccountSessionListResultPage contains a page of IntegrationAccountSession values. -type IntegrationAccountSessionListResultPage struct { - fn func(context.Context, IntegrationAccountSessionListResult) (IntegrationAccountSessionListResult, error) - iaslr IntegrationAccountSessionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IntegrationAccountSessionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationAccountSessionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.iaslr) - if err != nil { - return err - } - page.iaslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IntegrationAccountSessionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IntegrationAccountSessionListResultPage) NotDone() bool { - return !page.iaslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IntegrationAccountSessionListResultPage) Response() IntegrationAccountSessionListResult { - return page.iaslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IntegrationAccountSessionListResultPage) Values() []IntegrationAccountSession { - if page.iaslr.IsEmpty() { - return nil - } - return *page.iaslr.Value -} - -// Creates a new instance of the IntegrationAccountSessionListResultPage type. -func NewIntegrationAccountSessionListResultPage(cur IntegrationAccountSessionListResult, getNextPage func(context.Context, IntegrationAccountSessionListResult) (IntegrationAccountSessionListResult, error)) IntegrationAccountSessionListResultPage { - return IntegrationAccountSessionListResultPage{ - fn: getNextPage, - iaslr: cur, - } -} - -// IntegrationAccountSessionProperties the integration account session properties. -type IntegrationAccountSessionProperties struct { - // CreatedTime - READ-ONLY; The created time. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ChangedTime - READ-ONLY; The changed time. - ChangedTime *date.Time `json:"changedTime,omitempty"` - // Content - The session content. - Content interface{} `json:"content,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationAccountSessionProperties. -func (iasp IntegrationAccountSessionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iasp.Content != nil { - objectMap["content"] = iasp.Content - } - return json.Marshal(objectMap) -} - -// IntegrationAccountSku the integration account sku. -type IntegrationAccountSku struct { - // Name - The sku name. Possible values include: 'IntegrationAccountSkuNameNotSpecified', 'IntegrationAccountSkuNameFree', 'IntegrationAccountSkuNameBasic', 'IntegrationAccountSkuNameStandard' - Name IntegrationAccountSkuName `json:"name,omitempty"` -} - -// IntegrationServiceEnvironmenEncryptionConfiguration the encryption configuration for the integration -// service environment. -type IntegrationServiceEnvironmenEncryptionConfiguration struct { - // EncryptionKeyReference - The encryption key reference. - EncryptionKeyReference *IntegrationServiceEnvironmenEncryptionKeyReference `json:"encryptionKeyReference,omitempty"` -} - -// IntegrationServiceEnvironmenEncryptionKeyReference the encryption key details for the integration -// service environment. -type IntegrationServiceEnvironmenEncryptionKeyReference struct { - // KeyVault - The key vault reference. - KeyVault *ResourceReference `json:"keyVault,omitempty"` - // KeyName - Gets the key name in the Key Vault. - KeyName *string `json:"keyName,omitempty"` - // KeyVersion - Gets the version of the key specified in the keyName property. - KeyVersion *string `json:"keyVersion,omitempty"` -} - -// IntegrationServiceEnvironment the integration service environment. -type IntegrationServiceEnvironment struct { - autorest.Response `json:"-"` - // Properties - The integration service environment properties. - Properties *IntegrationServiceEnvironmentProperties `json:"properties,omitempty"` - // Sku - The sku. - Sku *IntegrationServiceEnvironmentSku `json:"sku,omitempty"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for IntegrationServiceEnvironment. -func (ise IntegrationServiceEnvironment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ise.Properties != nil { - objectMap["properties"] = ise.Properties - } - if ise.Sku != nil { - objectMap["sku"] = ise.Sku - } - if ise.Identity != nil { - objectMap["identity"] = ise.Identity - } - if ise.Location != nil { - objectMap["location"] = ise.Location - } - if ise.Tags != nil { - objectMap["tags"] = ise.Tags - } - return json.Marshal(objectMap) -} - -// IntegrationServiceEnvironmentAccessEndpoint the integration service environment access endpoint. -type IntegrationServiceEnvironmentAccessEndpoint struct { - // Type - The access endpoint type. Possible values include: 'IntegrationServiceEnvironmentAccessEndpointTypeNotSpecified', 'IntegrationServiceEnvironmentAccessEndpointTypeExternal', 'IntegrationServiceEnvironmentAccessEndpointTypeInternal' - Type IntegrationServiceEnvironmentAccessEndpointType `json:"type,omitempty"` -} - -// IntegrationServiceEnvironmentListResult the list of integration service environments. -type IntegrationServiceEnvironmentListResult struct { - autorest.Response `json:"-"` - Value *[]IntegrationServiceEnvironment `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationServiceEnvironmentListResultIterator provides access to a complete listing of -// IntegrationServiceEnvironment values. -type IntegrationServiceEnvironmentListResultIterator struct { - i int - page IntegrationServiceEnvironmentListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IntegrationServiceEnvironmentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IntegrationServiceEnvironmentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IntegrationServiceEnvironmentListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IntegrationServiceEnvironmentListResultIterator) Response() IntegrationServiceEnvironmentListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IntegrationServiceEnvironmentListResultIterator) Value() IntegrationServiceEnvironment { - if !iter.page.NotDone() { - return IntegrationServiceEnvironment{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IntegrationServiceEnvironmentListResultIterator type. -func NewIntegrationServiceEnvironmentListResultIterator(page IntegrationServiceEnvironmentListResultPage) IntegrationServiceEnvironmentListResultIterator { - return IntegrationServiceEnvironmentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iselr IntegrationServiceEnvironmentListResult) IsEmpty() bool { - return iselr.Value == nil || len(*iselr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iselr IntegrationServiceEnvironmentListResult) hasNextLink() bool { - return iselr.NextLink != nil && len(*iselr.NextLink) != 0 -} - -// integrationServiceEnvironmentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iselr IntegrationServiceEnvironmentListResult) integrationServiceEnvironmentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !iselr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iselr.NextLink))) -} - -// IntegrationServiceEnvironmentListResultPage contains a page of IntegrationServiceEnvironment values. -type IntegrationServiceEnvironmentListResultPage struct { - fn func(context.Context, IntegrationServiceEnvironmentListResult) (IntegrationServiceEnvironmentListResult, error) - iselr IntegrationServiceEnvironmentListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IntegrationServiceEnvironmentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.iselr) - if err != nil { - return err - } - page.iselr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IntegrationServiceEnvironmentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IntegrationServiceEnvironmentListResultPage) NotDone() bool { - return !page.iselr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IntegrationServiceEnvironmentListResultPage) Response() IntegrationServiceEnvironmentListResult { - return page.iselr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IntegrationServiceEnvironmentListResultPage) Values() []IntegrationServiceEnvironment { - if page.iselr.IsEmpty() { - return nil - } - return *page.iselr.Value -} - -// Creates a new instance of the IntegrationServiceEnvironmentListResultPage type. -func NewIntegrationServiceEnvironmentListResultPage(cur IntegrationServiceEnvironmentListResult, getNextPage func(context.Context, IntegrationServiceEnvironmentListResult) (IntegrationServiceEnvironmentListResult, error)) IntegrationServiceEnvironmentListResultPage { - return IntegrationServiceEnvironmentListResultPage{ - fn: getNextPage, - iselr: cur, - } -} - -// IntegrationServiceEnvironmentManagedAPI the integration service environment managed api. -type IntegrationServiceEnvironmentManagedAPI struct { - autorest.Response `json:"-"` - // IntegrationServiceEnvironmentManagedAPIProperties - The integration service environment managed api properties. - *IntegrationServiceEnvironmentManagedAPIProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for IntegrationServiceEnvironmentManagedAPI. -func (isema IntegrationServiceEnvironmentManagedAPI) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if isema.IntegrationServiceEnvironmentManagedAPIProperties != nil { - objectMap["properties"] = isema.IntegrationServiceEnvironmentManagedAPIProperties - } - if isema.Location != nil { - objectMap["location"] = isema.Location - } - if isema.Tags != nil { - objectMap["tags"] = isema.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IntegrationServiceEnvironmentManagedAPI struct. -func (isema *IntegrationServiceEnvironmentManagedAPI) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var integrationServiceEnvironmentManagedAPIProperties IntegrationServiceEnvironmentManagedAPIProperties - err = json.Unmarshal(*v, &integrationServiceEnvironmentManagedAPIProperties) - if err != nil { - return err - } - isema.IntegrationServiceEnvironmentManagedAPIProperties = &integrationServiceEnvironmentManagedAPIProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - isema.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - isema.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - isema.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - isema.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - isema.Tags = tags - } - } - } - - return nil -} - -// IntegrationServiceEnvironmentManagedAPIDeploymentParameters the integration service environment managed -// api deployment parameters. -type IntegrationServiceEnvironmentManagedAPIDeploymentParameters struct { - // ContentLinkDefinition - The integration service environment managed api content link for deployment. - ContentLinkDefinition *ContentLink `json:"contentLinkDefinition,omitempty"` -} - -// IntegrationServiceEnvironmentManagedAPIListResult the list of integration service environment managed -// APIs. -type IntegrationServiceEnvironmentManagedAPIListResult struct { - autorest.Response `json:"-"` - // Value - The integration service environment managed APIs. - Value *[]IntegrationServiceEnvironmentManagedAPI `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationServiceEnvironmentManagedAPIListResultIterator provides access to a complete listing of -// IntegrationServiceEnvironmentManagedAPI values. -type IntegrationServiceEnvironmentManagedAPIListResultIterator struct { - i int - page IntegrationServiceEnvironmentManagedAPIListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IntegrationServiceEnvironmentManagedAPIListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentManagedAPIListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IntegrationServiceEnvironmentManagedAPIListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IntegrationServiceEnvironmentManagedAPIListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IntegrationServiceEnvironmentManagedAPIListResultIterator) Response() IntegrationServiceEnvironmentManagedAPIListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IntegrationServiceEnvironmentManagedAPIListResultIterator) Value() IntegrationServiceEnvironmentManagedAPI { - if !iter.page.NotDone() { - return IntegrationServiceEnvironmentManagedAPI{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IntegrationServiceEnvironmentManagedAPIListResultIterator type. -func NewIntegrationServiceEnvironmentManagedAPIListResultIterator(page IntegrationServiceEnvironmentManagedAPIListResultPage) IntegrationServiceEnvironmentManagedAPIListResultIterator { - return IntegrationServiceEnvironmentManagedAPIListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (isemalr IntegrationServiceEnvironmentManagedAPIListResult) IsEmpty() bool { - return isemalr.Value == nil || len(*isemalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (isemalr IntegrationServiceEnvironmentManagedAPIListResult) hasNextLink() bool { - return isemalr.NextLink != nil && len(*isemalr.NextLink) != 0 -} - -// integrationServiceEnvironmentManagedAPIListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (isemalr IntegrationServiceEnvironmentManagedAPIListResult) integrationServiceEnvironmentManagedAPIListResultPreparer(ctx context.Context) (*http.Request, error) { - if !isemalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(isemalr.NextLink))) -} - -// IntegrationServiceEnvironmentManagedAPIListResultPage contains a page of -// IntegrationServiceEnvironmentManagedAPI values. -type IntegrationServiceEnvironmentManagedAPIListResultPage struct { - fn func(context.Context, IntegrationServiceEnvironmentManagedAPIListResult) (IntegrationServiceEnvironmentManagedAPIListResult, error) - isemalr IntegrationServiceEnvironmentManagedAPIListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IntegrationServiceEnvironmentManagedAPIListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentManagedAPIListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.isemalr) - if err != nil { - return err - } - page.isemalr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IntegrationServiceEnvironmentManagedAPIListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IntegrationServiceEnvironmentManagedAPIListResultPage) NotDone() bool { - return !page.isemalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IntegrationServiceEnvironmentManagedAPIListResultPage) Response() IntegrationServiceEnvironmentManagedAPIListResult { - return page.isemalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IntegrationServiceEnvironmentManagedAPIListResultPage) Values() []IntegrationServiceEnvironmentManagedAPI { - if page.isemalr.IsEmpty() { - return nil - } - return *page.isemalr.Value -} - -// Creates a new instance of the IntegrationServiceEnvironmentManagedAPIListResultPage type. -func NewIntegrationServiceEnvironmentManagedAPIListResultPage(cur IntegrationServiceEnvironmentManagedAPIListResult, getNextPage func(context.Context, IntegrationServiceEnvironmentManagedAPIListResult) (IntegrationServiceEnvironmentManagedAPIListResult, error)) IntegrationServiceEnvironmentManagedAPIListResultPage { - return IntegrationServiceEnvironmentManagedAPIListResultPage{ - fn: getNextPage, - isemalr: cur, - } -} - -// IntegrationServiceEnvironmentManagedAPIProperties the integration service environment managed api -// properties. -type IntegrationServiceEnvironmentManagedAPIProperties struct { - // DeploymentParameters - The integration service environment managed api deployment parameters. - DeploymentParameters *IntegrationServiceEnvironmentManagedAPIDeploymentParameters `json:"deploymentParameters,omitempty"` - // Name - READ-ONLY; The name - Name *string `json:"name,omitempty"` - // ConnectionParameters - READ-ONLY; The connection parameters. - ConnectionParameters map[string]interface{} `json:"connectionParameters"` - // Metadata - READ-ONLY; The metadata. - Metadata *APIResourceMetadata `json:"metadata,omitempty"` - // RuntimeUrls - READ-ONLY; The runtime urls. - RuntimeUrls *[]string `json:"runtimeUrls,omitempty"` - // GeneralInformation - READ-ONLY; The api general information. - GeneralInformation *APIResourceGeneralInformation `json:"generalInformation,omitempty"` - // Capabilities - READ-ONLY; The capabilities. - Capabilities *[]string `json:"capabilities,omitempty"` - // BackendService - READ-ONLY; The backend service. - BackendService *APIResourceBackendService `json:"backendService,omitempty"` - // Policies - READ-ONLY; The policies for the API. - Policies *APIResourcePolicies `json:"policies,omitempty"` - // APIDefinitionURL - READ-ONLY; The API definition. - APIDefinitionURL *string `json:"apiDefinitionUrl,omitempty"` - // APIDefinitions - READ-ONLY; The api definitions. - APIDefinitions *APIResourceDefinitions `json:"apiDefinitions,omitempty"` - // IntegrationServiceEnvironment - The integration service environment reference. - IntegrationServiceEnvironment *ResourceReference `json:"integrationServiceEnvironment,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'WorkflowProvisioningStateNotSpecified', 'WorkflowProvisioningStateAccepted', 'WorkflowProvisioningStateRunning', 'WorkflowProvisioningStateReady', 'WorkflowProvisioningStateCreating', 'WorkflowProvisioningStateCreated', 'WorkflowProvisioningStateDeleting', 'WorkflowProvisioningStateDeleted', 'WorkflowProvisioningStateCanceled', 'WorkflowProvisioningStateFailed', 'WorkflowProvisioningStateSucceeded', 'WorkflowProvisioningStateMoving', 'WorkflowProvisioningStateUpdating', 'WorkflowProvisioningStateRegistering', 'WorkflowProvisioningStateRegistered', 'WorkflowProvisioningStateUnregistering', 'WorkflowProvisioningStateUnregistered', 'WorkflowProvisioningStateCompleted', 'WorkflowProvisioningStateRenewing', 'WorkflowProvisioningStatePending', 'WorkflowProvisioningStateWaiting', 'WorkflowProvisioningStateInProgress' - ProvisioningState WorkflowProvisioningState `json:"provisioningState,omitempty"` - // Category - READ-ONLY; The category. Possible values include: 'APITierNotSpecified', 'APITierEnterprise', 'APITierStandard', 'APITierPremium' - Category APITier `json:"category,omitempty"` -} - -// MarshalJSON is the custom marshaler for IntegrationServiceEnvironmentManagedAPIProperties. -func (isemap IntegrationServiceEnvironmentManagedAPIProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if isemap.DeploymentParameters != nil { - objectMap["deploymentParameters"] = isemap.DeploymentParameters - } - if isemap.IntegrationServiceEnvironment != nil { - objectMap["integrationServiceEnvironment"] = isemap.IntegrationServiceEnvironment - } - return json.Marshal(objectMap) -} - -// IntegrationServiceEnvironmentManagedApisDeleteFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type IntegrationServiceEnvironmentManagedApisDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationServiceEnvironmentManagedApisClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationServiceEnvironmentManagedApisDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for IntegrationServiceEnvironmentManagedApisDeleteFuture.Result. -func (future *IntegrationServiceEnvironmentManagedApisDeleteFuture) result(client IntegrationServiceEnvironmentManagedApisClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("logic.IntegrationServiceEnvironmentManagedApisDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// IntegrationServiceEnvironmentManagedApisPutFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type IntegrationServiceEnvironmentManagedApisPutFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationServiceEnvironmentManagedApisClient) (IntegrationServiceEnvironmentManagedAPI, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationServiceEnvironmentManagedApisPutFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for IntegrationServiceEnvironmentManagedApisPutFuture.Result. -func (future *IntegrationServiceEnvironmentManagedApisPutFuture) result(client IntegrationServiceEnvironmentManagedApisClient) (isema IntegrationServiceEnvironmentManagedAPI, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisPutFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - isema.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("logic.IntegrationServiceEnvironmentManagedApisPutFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if isema.Response.Response, err = future.GetResult(sender); err == nil && isema.Response.Response.StatusCode != http.StatusNoContent { - isema, err = client.PutResponder(isema.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentManagedApisPutFuture", "Result", isema.Response.Response, "Failure responding to request") - } - } - return -} - -// IntegrationServiceEnvironmentNetworkDependency the azure async operation resource. -type IntegrationServiceEnvironmentNetworkDependency struct { - // Category - The network dependency category type. Possible values include: 'IntegrationServiceEnvironmentNetworkDependencyCategoryTypeNotSpecified', 'IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAzureStorage', 'IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAzureManagement', 'IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAzureActiveDirectory', 'IntegrationServiceEnvironmentNetworkDependencyCategoryTypeSSLCertificateVerification', 'IntegrationServiceEnvironmentNetworkDependencyCategoryTypeDiagnosticLogsAndMetrics', 'IntegrationServiceEnvironmentNetworkDependencyCategoryTypeIntegrationServiceEnvironmentConnectors', 'IntegrationServiceEnvironmentNetworkDependencyCategoryTypeRedisCache', 'IntegrationServiceEnvironmentNetworkDependencyCategoryTypeAccessEndpoints', 'IntegrationServiceEnvironmentNetworkDependencyCategoryTypeRecoveryService', 'IntegrationServiceEnvironmentNetworkDependencyCategoryTypeSQL', 'IntegrationServiceEnvironmentNetworkDependencyCategoryTypeRegionalService' - Category IntegrationServiceEnvironmentNetworkDependencyCategoryType `json:"category,omitempty"` - // DisplayName - The display name. - DisplayName *string `json:"displayName,omitempty"` - // Endpoints - The endpoints. - Endpoints *[]IntegrationServiceEnvironmentNetworkEndpoint `json:"endpoints,omitempty"` -} - -// IntegrationServiceEnvironmentNetworkDependencyHealth the integration service environment subnet network -// health. -type IntegrationServiceEnvironmentNetworkDependencyHealth struct { - // Error - The error if any occurred during the operation. - Error *ExtendedErrorInfo `json:"error,omitempty"` - // State - The network dependency health state. Possible values include: 'IntegrationServiceEnvironmentNetworkDependencyHealthStateNotSpecified', 'IntegrationServiceEnvironmentNetworkDependencyHealthStateHealthy', 'IntegrationServiceEnvironmentNetworkDependencyHealthStateUnhealthy', 'IntegrationServiceEnvironmentNetworkDependencyHealthStateUnknown' - State IntegrationServiceEnvironmentNetworkDependencyHealthState `json:"state,omitempty"` -} - -// IntegrationServiceEnvironmentNetworkEndpoint the network endpoint. -type IntegrationServiceEnvironmentNetworkEndpoint struct { - // Accessibility - The accessibility state. Possible values include: 'IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateNotSpecified', 'IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateUnknown', 'IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateAvailable', 'IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateNotAvailable' - Accessibility IntegrationServiceEnvironmentNetworkEndPointAccessibilityState `json:"accessibility,omitempty"` - // DomainName - The domain name. - DomainName *string `json:"domainName,omitempty"` - // Ports - The ports. - Ports *[]string `json:"ports,omitempty"` -} - -// IntegrationServiceEnvironmentProperties the integration service environment properties. -type IntegrationServiceEnvironmentProperties struct { - // ProvisioningState - The provisioning state. Possible values include: 'WorkflowProvisioningStateNotSpecified', 'WorkflowProvisioningStateAccepted', 'WorkflowProvisioningStateRunning', 'WorkflowProvisioningStateReady', 'WorkflowProvisioningStateCreating', 'WorkflowProvisioningStateCreated', 'WorkflowProvisioningStateDeleting', 'WorkflowProvisioningStateDeleted', 'WorkflowProvisioningStateCanceled', 'WorkflowProvisioningStateFailed', 'WorkflowProvisioningStateSucceeded', 'WorkflowProvisioningStateMoving', 'WorkflowProvisioningStateUpdating', 'WorkflowProvisioningStateRegistering', 'WorkflowProvisioningStateRegistered', 'WorkflowProvisioningStateUnregistering', 'WorkflowProvisioningStateUnregistered', 'WorkflowProvisioningStateCompleted', 'WorkflowProvisioningStateRenewing', 'WorkflowProvisioningStatePending', 'WorkflowProvisioningStateWaiting', 'WorkflowProvisioningStateInProgress' - ProvisioningState WorkflowProvisioningState `json:"provisioningState,omitempty"` - // State - The integration service environment state. Possible values include: 'WorkflowStateNotSpecified', 'WorkflowStateCompleted', 'WorkflowStateEnabled', 'WorkflowStateDisabled', 'WorkflowStateDeleted', 'WorkflowStateSuspended' - State WorkflowState `json:"state,omitempty"` - // IntegrationServiceEnvironmentID - Gets the tracking id. - IntegrationServiceEnvironmentID *string `json:"integrationServiceEnvironmentId,omitempty"` - // EndpointsConfiguration - The endpoints configuration. - EndpointsConfiguration *FlowEndpointsConfiguration `json:"endpointsConfiguration,omitempty"` - // NetworkConfiguration - The network configuration. - NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"` - // EncryptionConfiguration - The encryption configuration. - EncryptionConfiguration *IntegrationServiceEnvironmenEncryptionConfiguration `json:"encryptionConfiguration,omitempty"` -} - -// IntegrationServiceEnvironmentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type IntegrationServiceEnvironmentsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationServiceEnvironmentsClient) (IntegrationServiceEnvironment, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationServiceEnvironmentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for IntegrationServiceEnvironmentsCreateOrUpdateFuture.Result. -func (future *IntegrationServiceEnvironmentsCreateOrUpdateFuture) result(client IntegrationServiceEnvironmentsClient) (ise IntegrationServiceEnvironment, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ise.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("logic.IntegrationServiceEnvironmentsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ise.Response.Response, err = future.GetResult(sender); err == nil && ise.Response.Response.StatusCode != http.StatusNoContent { - ise, err = client.CreateOrUpdateResponder(ise.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsCreateOrUpdateFuture", "Result", ise.Response.Response, "Failure responding to request") - } - } - return -} - -// IntegrationServiceEnvironmentSku the integration service environment sku. -type IntegrationServiceEnvironmentSku struct { - // Name - The sku name. Possible values include: 'IntegrationServiceEnvironmentSkuNameNotSpecified', 'IntegrationServiceEnvironmentSkuNamePremium', 'IntegrationServiceEnvironmentSkuNameDeveloper' - Name IntegrationServiceEnvironmentSkuName `json:"name,omitempty"` - // Capacity - The sku capacity. - Capacity *int32 `json:"capacity,omitempty"` -} - -// IntegrationServiceEnvironmentSkuCapacity the integration service environment sku capacity. -type IntegrationServiceEnvironmentSkuCapacity struct { - // Minimum - The minimum capacity. - Minimum *int32 `json:"minimum,omitempty"` - // Maximum - The maximum capacity. - Maximum *int32 `json:"maximum,omitempty"` - // Default - The default capacity. - Default *int32 `json:"default,omitempty"` - // ScaleType - The sku scale type. Possible values include: 'IntegrationServiceEnvironmentSkuScaleTypeManual', 'IntegrationServiceEnvironmentSkuScaleTypeAutomatic', 'IntegrationServiceEnvironmentSkuScaleTypeNone' - ScaleType IntegrationServiceEnvironmentSkuScaleType `json:"scaleType,omitempty"` -} - -// IntegrationServiceEnvironmentSkuDefinition the integration service environment sku definition. -type IntegrationServiceEnvironmentSkuDefinition struct { - // ResourceType - The resource type. - ResourceType *string `json:"resourceType,omitempty"` - // Sku - The sku. - Sku *IntegrationServiceEnvironmentSkuDefinitionSku `json:"sku,omitempty"` - // Capacity - The sku capacity. - Capacity *IntegrationServiceEnvironmentSkuCapacity `json:"capacity,omitempty"` -} - -// IntegrationServiceEnvironmentSkuDefinitionSku the sku. -type IntegrationServiceEnvironmentSkuDefinitionSku struct { - // Name - The sku name. Possible values include: 'IntegrationServiceEnvironmentSkuNameNotSpecified', 'IntegrationServiceEnvironmentSkuNamePremium', 'IntegrationServiceEnvironmentSkuNameDeveloper' - Name IntegrationServiceEnvironmentSkuName `json:"name,omitempty"` - // Tier - The sku tier. - Tier *string `json:"tier,omitempty"` -} - -// IntegrationServiceEnvironmentSkuList the list of integration service environment skus. -type IntegrationServiceEnvironmentSkuList struct { - autorest.Response `json:"-"` - // Value - The list of integration service environment skus. - Value *[]IntegrationServiceEnvironmentSkuDefinition `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationServiceEnvironmentSkuListIterator provides access to a complete listing of -// IntegrationServiceEnvironmentSkuDefinition values. -type IntegrationServiceEnvironmentSkuListIterator struct { - i int - page IntegrationServiceEnvironmentSkuListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IntegrationServiceEnvironmentSkuListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentSkuListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IntegrationServiceEnvironmentSkuListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IntegrationServiceEnvironmentSkuListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IntegrationServiceEnvironmentSkuListIterator) Response() IntegrationServiceEnvironmentSkuList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IntegrationServiceEnvironmentSkuListIterator) Value() IntegrationServiceEnvironmentSkuDefinition { - if !iter.page.NotDone() { - return IntegrationServiceEnvironmentSkuDefinition{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IntegrationServiceEnvironmentSkuListIterator type. -func NewIntegrationServiceEnvironmentSkuListIterator(page IntegrationServiceEnvironmentSkuListPage) IntegrationServiceEnvironmentSkuListIterator { - return IntegrationServiceEnvironmentSkuListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (isesl IntegrationServiceEnvironmentSkuList) IsEmpty() bool { - return isesl.Value == nil || len(*isesl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (isesl IntegrationServiceEnvironmentSkuList) hasNextLink() bool { - return isesl.NextLink != nil && len(*isesl.NextLink) != 0 -} - -// integrationServiceEnvironmentSkuListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (isesl IntegrationServiceEnvironmentSkuList) integrationServiceEnvironmentSkuListPreparer(ctx context.Context) (*http.Request, error) { - if !isesl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(isesl.NextLink))) -} - -// IntegrationServiceEnvironmentSkuListPage contains a page of IntegrationServiceEnvironmentSkuDefinition -// values. -type IntegrationServiceEnvironmentSkuListPage struct { - fn func(context.Context, IntegrationServiceEnvironmentSkuList) (IntegrationServiceEnvironmentSkuList, error) - isesl IntegrationServiceEnvironmentSkuList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IntegrationServiceEnvironmentSkuListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentSkuListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.isesl) - if err != nil { - return err - } - page.isesl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IntegrationServiceEnvironmentSkuListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IntegrationServiceEnvironmentSkuListPage) NotDone() bool { - return !page.isesl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IntegrationServiceEnvironmentSkuListPage) Response() IntegrationServiceEnvironmentSkuList { - return page.isesl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IntegrationServiceEnvironmentSkuListPage) Values() []IntegrationServiceEnvironmentSkuDefinition { - if page.isesl.IsEmpty() { - return nil - } - return *page.isesl.Value -} - -// Creates a new instance of the IntegrationServiceEnvironmentSkuListPage type. -func NewIntegrationServiceEnvironmentSkuListPage(cur IntegrationServiceEnvironmentSkuList, getNextPage func(context.Context, IntegrationServiceEnvironmentSkuList) (IntegrationServiceEnvironmentSkuList, error)) IntegrationServiceEnvironmentSkuListPage { - return IntegrationServiceEnvironmentSkuListPage{ - fn: getNextPage, - isesl: cur, - } -} - -// IntegrationServiceEnvironmentSubnetNetworkHealth the integration service environment subnet network -// health. -type IntegrationServiceEnvironmentSubnetNetworkHealth struct { - // OutboundNetworkDependencies - The outbound network dependencies. - OutboundNetworkDependencies *[]IntegrationServiceEnvironmentNetworkDependency `json:"outboundNetworkDependencies,omitempty"` - // OutboundNetworkHealth - The integration service environment network health. - OutboundNetworkHealth *IntegrationServiceEnvironmentNetworkDependencyHealth `json:"outboundNetworkHealth,omitempty"` - // NetworkDependencyHealthState - The integration service environment network health state. Possible values include: 'IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateNotSpecified', 'IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateUnknown', 'IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateAvailable', 'IntegrationServiceEnvironmentNetworkEndPointAccessibilityStateNotAvailable' - NetworkDependencyHealthState IntegrationServiceEnvironmentNetworkEndPointAccessibilityState `json:"networkDependencyHealthState,omitempty"` -} - -// IntegrationServiceEnvironmentsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type IntegrationServiceEnvironmentsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IntegrationServiceEnvironmentsClient) (IntegrationServiceEnvironment, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IntegrationServiceEnvironmentsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for IntegrationServiceEnvironmentsUpdateFuture.Result. -func (future *IntegrationServiceEnvironmentsUpdateFuture) result(client IntegrationServiceEnvironmentsClient) (ise IntegrationServiceEnvironment, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ise.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("logic.IntegrationServiceEnvironmentsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ise.Response.Response, err = future.GetResult(sender); err == nil && ise.Response.Response.StatusCode != http.StatusNoContent { - ise, err = client.UpdateResponder(ise.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsUpdateFuture", "Result", ise.Response.Response, "Failure responding to request") - } - } - return -} - -// IPAddress the ip address. -type IPAddress struct { - // Address - The address. - Address *string `json:"address,omitempty"` -} - -// IPAddressRange the ip address range. -type IPAddressRange struct { - // AddressRange - The IP address range. - AddressRange *string `json:"addressRange,omitempty"` -} - -// JSONSchema the JSON schema. -type JSONSchema struct { - autorest.Response `json:"-"` - // Title - The JSON title. - Title *string `json:"title,omitempty"` - // Content - The JSON content. - Content *string `json:"content,omitempty"` -} - -// KeyVaultKey the key vault key. -type KeyVaultKey struct { - // Kid - The key id. - Kid *string `json:"kid,omitempty"` - // Attributes - The key attributes. - Attributes *KeyVaultKeyAttributes `json:"attributes,omitempty"` -} - -// KeyVaultKeyAttributes the key attributes. -type KeyVaultKeyAttributes struct { - // Enabled - Whether the key is enabled or not. - Enabled *bool `json:"enabled,omitempty"` - // Created - When the key was created. - Created *int64 `json:"created,omitempty"` - // Updated - When the key was updated. - Updated *int64 `json:"updated,omitempty"` -} - -// KeyVaultKeyCollection collection of key vault keys. -type KeyVaultKeyCollection struct { - autorest.Response `json:"-"` - // Value - The key vault keys. - Value *[]KeyVaultKey `json:"value,omitempty"` - // SkipToken - The skip token. - SkipToken *string `json:"skipToken,omitempty"` -} - -// KeyVaultKeyReference the reference to the key vault key. -type KeyVaultKeyReference struct { - // KeyVault - The key vault reference. - KeyVault *KeyVaultKeyReferenceKeyVault `json:"keyVault,omitempty"` - // KeyName - The private key name in key vault. - KeyName *string `json:"keyName,omitempty"` - // KeyVersion - The private key version in key vault. - KeyVersion *string `json:"keyVersion,omitempty"` -} - -// KeyVaultKeyReferenceKeyVault the key vault reference. -type KeyVaultKeyReferenceKeyVault struct { - // ID - The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for KeyVaultKeyReferenceKeyVault. -func (kvkrV KeyVaultKeyReferenceKeyVault) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if kvkrV.ID != nil { - objectMap["id"] = kvkrV.ID - } - return json.Marshal(objectMap) -} - -// KeyVaultReference the key vault reference. -type KeyVaultReference struct { - // ID - The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for KeyVaultReference. -func (kvr KeyVaultReference) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if kvr.ID != nil { - objectMap["id"] = kvr.ID - } - return json.Marshal(objectMap) -} - -// ListKeyVaultKeysDefinition the list key vault keys definition. -type ListKeyVaultKeysDefinition struct { - // KeyVault - The key vault reference. - KeyVault *KeyVaultReference `json:"keyVault,omitempty"` - // SkipToken - The skip token. - SkipToken *string `json:"skipToken,omitempty"` -} - -// ManagedAPI the managed api definition. -type ManagedAPI struct { - // Properties - The api resource properties. - Properties *APIResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ManagedAPI. -func (ma ManagedAPI) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ma.Properties != nil { - objectMap["properties"] = ma.Properties - } - if ma.Location != nil { - objectMap["location"] = ma.Location - } - if ma.Tags != nil { - objectMap["tags"] = ma.Tags - } - return json.Marshal(objectMap) -} - -// ManagedAPIListResult the list of managed APIs. -type ManagedAPIListResult struct { - // Value - The managed APIs. - Value *[]ManagedAPI `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ManagedServiceIdentity managed service identity properties. -type ManagedServiceIdentity struct { - // Type - Type of managed service identity. The type 'SystemAssigned' includes an implicitly created identity. The type 'None' will remove any identities from the resource. Possible values include: 'ManagedServiceIdentityTypeSystemAssigned', 'ManagedServiceIdentityTypeUserAssigned', 'ManagedServiceIdentityTypeNone' - Type ManagedServiceIdentityType `json:"type,omitempty"` - // TenantID - READ-ONLY; Tenant of managed service identity. - TenantID *uuid.UUID `json:"tenantId,omitempty"` - // PrincipalID - READ-ONLY; Principal Id of managed service identity. - PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // UserAssignedIdentities - The list of user assigned identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} - UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for ManagedServiceIdentity. -func (msi ManagedServiceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if msi.Type != "" { - objectMap["type"] = msi.Type - } - if msi.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = msi.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// NetworkConfiguration the network configuration. -type NetworkConfiguration struct { - // VirtualNetworkAddressSpace - Gets the virtual network address space. - VirtualNetworkAddressSpace *string `json:"virtualNetworkAddressSpace,omitempty"` - // AccessEndpoint - The access endpoint. - AccessEndpoint *IntegrationServiceEnvironmentAccessEndpoint `json:"accessEndpoint,omitempty"` - // Subnets - The subnets. - Subnets *[]ResourceReference `json:"subnets,omitempty"` -} - -// OpenAuthenticationAccessPolicies authenticationPolicy of type Open. -type OpenAuthenticationAccessPolicies struct { - // Policies - Open authentication policies. - Policies map[string]*OpenAuthenticationAccessPolicy `json:"policies"` -} - -// MarshalJSON is the custom marshaler for OpenAuthenticationAccessPolicies. -func (oaap OpenAuthenticationAccessPolicies) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oaap.Policies != nil { - objectMap["policies"] = oaap.Policies - } - return json.Marshal(objectMap) -} - -// OpenAuthenticationAccessPolicy open authentication access policy defined by user. -type OpenAuthenticationAccessPolicy struct { - // Type - Type of provider for OAuth. Possible values include: 'OpenAuthenticationProviderTypeAAD' - Type OpenAuthenticationProviderType `json:"type,omitempty"` - // Claims - The access policy claims. - Claims *[]OpenAuthenticationPolicyClaim `json:"claims,omitempty"` -} - -// OpenAuthenticationPolicyClaim open authentication policy claim. -type OpenAuthenticationPolicyClaim struct { - // Name - The name of the claim. - Name *string `json:"name,omitempty"` - // Value - The value of the claim. - Value *string `json:"value,omitempty"` -} - -// Operation logic REST API operation -type Operation struct { - // Origin - Operation: origin - Origin *string `json:"origin,omitempty"` - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - The object that represents the operation. - Display *OperationDisplay `json:"display,omitempty"` - // Properties - The properties. - Properties interface{} `json:"properties,omitempty"` -} - -// OperationDisplay the object that represents the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Logic - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: Profile, endpoint, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - Operation: description. - Description *string `json:"description,omitempty"` -} - -// OperationListResult result of the request to list Logic operations. It contains a list of operations and -// a URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of Logic operations supported by the Logic resource provider. - Value *[]Operation `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// OperationResult the operation result definition. -type OperationResult struct { - // TrackingID - READ-ONLY; Gets the tracking id. - TrackingID *string `json:"trackingId,omitempty"` - // Inputs - READ-ONLY; Gets the inputs. - Inputs interface{} `json:"inputs,omitempty"` - // InputsLink - READ-ONLY; Gets the link to inputs. - InputsLink *ContentLink `json:"inputsLink,omitempty"` - // Outputs - READ-ONLY; Gets the outputs. - Outputs interface{} `json:"outputs,omitempty"` - // OutputsLink - READ-ONLY; Gets the link to outputs. - OutputsLink *ContentLink `json:"outputsLink,omitempty"` - // TrackedProperties - READ-ONLY; Gets the tracked properties. - TrackedProperties interface{} `json:"trackedProperties,omitempty"` - // RetryHistory - Gets the retry histories. - RetryHistory *[]RetryHistory `json:"retryHistory,omitempty"` - IterationCount *int32 `json:"iterationCount,omitempty"` - // StartTime - The start time of the workflow scope repetition. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - The end time of the workflow scope repetition. - EndTime *date.Time `json:"endTime,omitempty"` - // Correlation - The correlation properties. - Correlation *RunActionCorrelation `json:"correlation,omitempty"` - // Status - The status of the workflow scope repetition. Possible values include: 'WorkflowStatusNotSpecified', 'WorkflowStatusPaused', 'WorkflowStatusRunning', 'WorkflowStatusWaiting', 'WorkflowStatusSucceeded', 'WorkflowStatusSkipped', 'WorkflowStatusSuspended', 'WorkflowStatusCancelled', 'WorkflowStatusFailed', 'WorkflowStatusFaulted', 'WorkflowStatusTimedOut', 'WorkflowStatusAborted', 'WorkflowStatusIgnored' - Status WorkflowStatus `json:"status,omitempty"` - // Code - The workflow scope repetition code. - Code *string `json:"code,omitempty"` - Error interface{} `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationResult. -func (or OperationResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if or.RetryHistory != nil { - objectMap["retryHistory"] = or.RetryHistory - } - if or.IterationCount != nil { - objectMap["iterationCount"] = or.IterationCount - } - if or.StartTime != nil { - objectMap["startTime"] = or.StartTime - } - if or.EndTime != nil { - objectMap["endTime"] = or.EndTime - } - if or.Correlation != nil { - objectMap["correlation"] = or.Correlation - } - if or.Status != "" { - objectMap["status"] = or.Status - } - if or.Code != nil { - objectMap["code"] = or.Code - } - if or.Error != nil { - objectMap["error"] = or.Error - } - return json.Marshal(objectMap) -} - -// OperationResultProperties the run operation result properties. -type OperationResultProperties struct { - // StartTime - The start time of the workflow scope repetition. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - The end time of the workflow scope repetition. - EndTime *date.Time `json:"endTime,omitempty"` - // Correlation - The correlation properties. - Correlation *RunActionCorrelation `json:"correlation,omitempty"` - // Status - The status of the workflow scope repetition. Possible values include: 'WorkflowStatusNotSpecified', 'WorkflowStatusPaused', 'WorkflowStatusRunning', 'WorkflowStatusWaiting', 'WorkflowStatusSucceeded', 'WorkflowStatusSkipped', 'WorkflowStatusSuspended', 'WorkflowStatusCancelled', 'WorkflowStatusFailed', 'WorkflowStatusFaulted', 'WorkflowStatusTimedOut', 'WorkflowStatusAborted', 'WorkflowStatusIgnored' - Status WorkflowStatus `json:"status,omitempty"` - // Code - The workflow scope repetition code. - Code *string `json:"code,omitempty"` - Error interface{} `json:"error,omitempty"` -} - -// PartnerContent the integration account partner content. -type PartnerContent struct { - // B2b - The B2B partner content. - B2b *B2BPartnerContent `json:"b2b,omitempty"` -} - -// RecurrenceSchedule the recurrence schedule. -type RecurrenceSchedule struct { - // Minutes - The minutes. - Minutes *[]int32 `json:"minutes,omitempty"` - // Hours - The hours. - Hours *[]int32 `json:"hours,omitempty"` - // WeekDays - The days of the week. - WeekDays *[]DaysOfWeek `json:"weekDays,omitempty"` - // MonthDays - The month days. - MonthDays *[]int32 `json:"monthDays,omitempty"` - // MonthlyOccurrences - The monthly occurrences. - MonthlyOccurrences *[]RecurrenceScheduleOccurrence `json:"monthlyOccurrences,omitempty"` -} - -// RecurrenceScheduleOccurrence the recurrence schedule occurrence. -type RecurrenceScheduleOccurrence struct { - // Day - The day of the week. Possible values include: 'DayOfWeekSunday', 'DayOfWeekMonday', 'DayOfWeekTuesday', 'DayOfWeekWednesday', 'DayOfWeekThursday', 'DayOfWeekFriday', 'DayOfWeekSaturday' - Day DayOfWeek `json:"day,omitempty"` - // Occurrence - The occurrence. - Occurrence *int32 `json:"occurrence,omitempty"` -} - -// RegenerateActionParameter the access key regenerate action content. -type RegenerateActionParameter struct { - // KeyType - The key type. Possible values include: 'KeyTypeNotSpecified', 'KeyTypePrimary', 'KeyTypeSecondary' - KeyType KeyType `json:"keyType,omitempty"` -} - -// RepetitionIndex the workflow run action repetition index. -type RepetitionIndex struct { - // ScopeName - The scope. - ScopeName *string `json:"scopeName,omitempty"` - // ItemIndex - The index. - ItemIndex *int32 `json:"itemIndex,omitempty"` -} - -// Request a request. -type Request struct { - // Headers - A list of all the headers attached to the request. - Headers interface{} `json:"headers,omitempty"` - // URI - The destination for the request. - URI *string `json:"uri,omitempty"` - // Method - The HTTP method used for the request. - Method *string `json:"method,omitempty"` -} - -// RequestHistory the request history. -type RequestHistory struct { - autorest.Response `json:"-"` - // Properties - The request history properties. - Properties *RequestHistoryProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for RequestHistory. -func (rh RequestHistory) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rh.Properties != nil { - objectMap["properties"] = rh.Properties - } - if rh.Location != nil { - objectMap["location"] = rh.Location - } - if rh.Tags != nil { - objectMap["tags"] = rh.Tags - } - return json.Marshal(objectMap) -} - -// RequestHistoryListResult the list of workflow request histories. -type RequestHistoryListResult struct { - autorest.Response `json:"-"` - // Value - A list of workflow request histories. - Value *[]RequestHistory `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// RequestHistoryListResultIterator provides access to a complete listing of RequestHistory values. -type RequestHistoryListResultIterator struct { - i int - page RequestHistoryListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RequestHistoryListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RequestHistoryListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RequestHistoryListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RequestHistoryListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RequestHistoryListResultIterator) Response() RequestHistoryListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RequestHistoryListResultIterator) Value() RequestHistory { - if !iter.page.NotDone() { - return RequestHistory{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RequestHistoryListResultIterator type. -func NewRequestHistoryListResultIterator(page RequestHistoryListResultPage) RequestHistoryListResultIterator { - return RequestHistoryListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rhlr RequestHistoryListResult) IsEmpty() bool { - return rhlr.Value == nil || len(*rhlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rhlr RequestHistoryListResult) hasNextLink() bool { - return rhlr.NextLink != nil && len(*rhlr.NextLink) != 0 -} - -// requestHistoryListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rhlr RequestHistoryListResult) requestHistoryListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rhlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rhlr.NextLink))) -} - -// RequestHistoryListResultPage contains a page of RequestHistory values. -type RequestHistoryListResultPage struct { - fn func(context.Context, RequestHistoryListResult) (RequestHistoryListResult, error) - rhlr RequestHistoryListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RequestHistoryListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RequestHistoryListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rhlr) - if err != nil { - return err - } - page.rhlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RequestHistoryListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RequestHistoryListResultPage) NotDone() bool { - return !page.rhlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RequestHistoryListResultPage) Response() RequestHistoryListResult { - return page.rhlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RequestHistoryListResultPage) Values() []RequestHistory { - if page.rhlr.IsEmpty() { - return nil - } - return *page.rhlr.Value -} - -// Creates a new instance of the RequestHistoryListResultPage type. -func NewRequestHistoryListResultPage(cur RequestHistoryListResult, getNextPage func(context.Context, RequestHistoryListResult) (RequestHistoryListResult, error)) RequestHistoryListResultPage { - return RequestHistoryListResultPage{ - fn: getNextPage, - rhlr: cur, - } -} - -// RequestHistoryProperties the request history. -type RequestHistoryProperties struct { - // StartTime - The time the request started. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - The time the request ended. - EndTime *date.Time `json:"endTime,omitempty"` - // Request - The request. - Request *Request `json:"request,omitempty"` - // Response - The response. - Response *Response `json:"response,omitempty"` -} - -// Resource the base resource type. -type Resource struct { - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// ResourceReference the resource reference. -type ResourceReference struct { - // ID - The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceReference. -func (rr ResourceReference) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rr.ID != nil { - objectMap["id"] = rr.ID - } - return json.Marshal(objectMap) -} - -// Response a response. -type Response struct { - // Headers - A list of all the headers attached to the response. - Headers interface{} `json:"headers,omitempty"` - // StatusCode - The status code of the response. - StatusCode *int32 `json:"statusCode,omitempty"` - // BodyLink - Details on the location of the body content. - BodyLink *ContentLink `json:"bodyLink,omitempty"` -} - -// RetryHistory the retry history. -type RetryHistory struct { - // StartTime - Gets the start time. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - Gets the end time. - EndTime *date.Time `json:"endTime,omitempty"` - // Code - Gets the status code. - Code *string `json:"code,omitempty"` - // ClientRequestID - Gets the client request Id. - ClientRequestID *string `json:"clientRequestId,omitempty"` - // ServiceRequestID - Gets the service request Id. - ServiceRequestID *string `json:"serviceRequestId,omitempty"` - // Error - Gets the error response. - Error *ErrorResponse `json:"error,omitempty"` -} - -// RunActionCorrelation the workflow run action correlation properties. -type RunActionCorrelation struct { - // ActionTrackingID - The action tracking identifier. - ActionTrackingID *string `json:"actionTrackingId,omitempty"` - // ClientTrackingID - The client tracking identifier. - ClientTrackingID *string `json:"clientTrackingId,omitempty"` - // ClientKeywords - The client keywords. - ClientKeywords *[]string `json:"clientKeywords,omitempty"` -} - -// RunCorrelation the correlation properties. -type RunCorrelation struct { - // ClientTrackingID - The client tracking identifier. - ClientTrackingID *string `json:"clientTrackingId,omitempty"` - // ClientKeywords - The client keywords. - ClientKeywords *[]string `json:"clientKeywords,omitempty"` -} - -// SetIntegrationServiceEnvironmentSubnetNetworkHealth ... -type SetIntegrationServiceEnvironmentSubnetNetworkHealth struct { - autorest.Response `json:"-"` - Value map[string]*IntegrationServiceEnvironmentSubnetNetworkHealth `json:"value"` -} - -// MarshalJSON is the custom marshaler for SetIntegrationServiceEnvironmentSubnetNetworkHealth. -func (sisesnh SetIntegrationServiceEnvironmentSubnetNetworkHealth) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sisesnh.Value != nil { - objectMap["value"] = sisesnh.Value - } - return json.Marshal(objectMap) -} - -// SetObject ... -type SetObject struct { - autorest.Response `json:"-"` - Value interface{} `json:"value,omitempty"` -} - -// SetTriggerStateActionDefinition the set trigger state action definition. -type SetTriggerStateActionDefinition struct { - // Source - The source. - Source *WorkflowTriggerReference `json:"source,omitempty"` -} - -// Sku the sku type. -type Sku struct { - // Name - The name. Possible values include: 'SkuNameNotSpecified', 'SkuNameFree', 'SkuNameShared', 'SkuNameBasic', 'SkuNameStandard', 'SkuNamePremium' - Name SkuName `json:"name,omitempty"` - // Plan - The reference to plan. - Plan *ResourceReference `json:"plan,omitempty"` -} - -// SubResource the sub resource type. -type SubResource struct { - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubResource. -func (sr SubResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SwaggerCustomDynamicList the swagger custom dynamic list. -type SwaggerCustomDynamicList struct { - // OperationID - The operation id to fetch dynamic schema. - OperationID *string `json:"operationId,omitempty"` - // BuiltInOperation - The built in operation. - BuiltInOperation *string `json:"builtInOperation,omitempty"` - // ItemsPath - The path to a response property (relative to the response object, not the response body) which contains an array of dynamic value items. - ItemsPath *string `json:"itemsPath,omitempty"` - // ItemValuePath - The path to a property which defines the value which should be used. - ItemValuePath *string `json:"itemValuePath,omitempty"` - // ItemTitlePath - The path to an item property which defines the display name of the item. - ItemTitlePath *string `json:"itemTitlePath,omitempty"` - // Parameters - The parameters. - Parameters map[string]*SwaggerCustomDynamicProperties `json:"parameters"` -} - -// MarshalJSON is the custom marshaler for SwaggerCustomDynamicList. -func (scdl SwaggerCustomDynamicList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scdl.OperationID != nil { - objectMap["operationId"] = scdl.OperationID - } - if scdl.BuiltInOperation != nil { - objectMap["builtInOperation"] = scdl.BuiltInOperation - } - if scdl.ItemsPath != nil { - objectMap["itemsPath"] = scdl.ItemsPath - } - if scdl.ItemValuePath != nil { - objectMap["itemValuePath"] = scdl.ItemValuePath - } - if scdl.ItemTitlePath != nil { - objectMap["itemTitlePath"] = scdl.ItemTitlePath - } - if scdl.Parameters != nil { - objectMap["parameters"] = scdl.Parameters - } - return json.Marshal(objectMap) -} - -// SwaggerCustomDynamicProperties the swagger custom dynamic properties. -type SwaggerCustomDynamicProperties struct { - // OperationID - The operation id to fetch dynamic schema. - OperationID *string `json:"operationId,omitempty"` - // ValuePath - Json pointer to the dynamic schema on the response body. - ValuePath *string `json:"valuePath,omitempty"` - // Parameters - The operation parameters. - Parameters map[string]*SwaggerCustomDynamicProperties `json:"parameters"` -} - -// MarshalJSON is the custom marshaler for SwaggerCustomDynamicProperties. -func (scdp SwaggerCustomDynamicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scdp.OperationID != nil { - objectMap["operationId"] = scdp.OperationID - } - if scdp.ValuePath != nil { - objectMap["valuePath"] = scdp.ValuePath - } - if scdp.Parameters != nil { - objectMap["parameters"] = scdp.Parameters - } - return json.Marshal(objectMap) -} - -// SwaggerCustomDynamicSchema the swagger custom dynamic schema. -type SwaggerCustomDynamicSchema struct { - // OperationID - The operation id to fetch dynamic schema. - OperationID *string `json:"operationId,omitempty"` - // ValuePath - Json pointer to the dynamic schema on the response body. - ValuePath *string `json:"valuePath,omitempty"` - // Parameters - The operation parameters. - Parameters map[string]interface{} `json:"parameters"` -} - -// MarshalJSON is the custom marshaler for SwaggerCustomDynamicSchema. -func (scds SwaggerCustomDynamicSchema) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scds.OperationID != nil { - objectMap["operationId"] = scds.OperationID - } - if scds.ValuePath != nil { - objectMap["valuePath"] = scds.ValuePath - } - if scds.Parameters != nil { - objectMap["parameters"] = scds.Parameters - } - return json.Marshal(objectMap) -} - -// SwaggerCustomDynamicTree the swagger custom dynamic tree. -type SwaggerCustomDynamicTree struct { - // Settings - The tree settings - Settings *SwaggerCustomDynamicTreeSettings `json:"settings,omitempty"` - // Open - The tree on-open configuration - Open *SwaggerCustomDynamicTreeCommand `json:"open,omitempty"` - // Browse - The tree on-browse configuration - Browse *SwaggerCustomDynamicTreeCommand `json:"browse,omitempty"` -} - -// SwaggerCustomDynamicTreeCommand the swagger tree command. -type SwaggerCustomDynamicTreeCommand struct { - // OperationID - The path to an item property which defines the display name of the item. - OperationID *string `json:"operationId,omitempty"` - // ItemsPath - The path to an item property which defines the display name of the item. - ItemsPath *string `json:"itemsPath,omitempty"` - // ItemValuePath - The path to an item property which defines the display name of the item. - ItemValuePath *string `json:"itemValuePath,omitempty"` - // ItemTitlePath - The path to an item property which defines the display name of the item. - ItemTitlePath *string `json:"itemTitlePath,omitempty"` - // ItemFullTitlePath - The path to an item property which defines the display name of the item. - ItemFullTitlePath *string `json:"itemFullTitlePath,omitempty"` - // ItemIsParent - The path to an item property which defines the display name of the item. - ItemIsParent *string `json:"itemIsParent,omitempty"` - // SelectableFilter - The path to an item property which defines the display name of the item. - SelectableFilter *string `json:"selectableFilter,omitempty"` - Parameters map[string]*SwaggerCustomDynamicTreeParameter `json:"parameters"` -} - -// MarshalJSON is the custom marshaler for SwaggerCustomDynamicTreeCommand. -func (scdtc SwaggerCustomDynamicTreeCommand) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scdtc.OperationID != nil { - objectMap["operationId"] = scdtc.OperationID - } - if scdtc.ItemsPath != nil { - objectMap["itemsPath"] = scdtc.ItemsPath - } - if scdtc.ItemValuePath != nil { - objectMap["itemValuePath"] = scdtc.ItemValuePath - } - if scdtc.ItemTitlePath != nil { - objectMap["itemTitlePath"] = scdtc.ItemTitlePath - } - if scdtc.ItemFullTitlePath != nil { - objectMap["itemFullTitlePath"] = scdtc.ItemFullTitlePath - } - if scdtc.ItemIsParent != nil { - objectMap["itemIsParent"] = scdtc.ItemIsParent - } - if scdtc.SelectableFilter != nil { - objectMap["selectableFilter"] = scdtc.SelectableFilter - } - if scdtc.Parameters != nil { - objectMap["parameters"] = scdtc.Parameters - } - return json.Marshal(objectMap) -} - -// SwaggerCustomDynamicTreeParameter the swagger custom dynamic tree parameter. -type SwaggerCustomDynamicTreeParameter struct { - // SelectedItemValuePath - Gets or sets a path to a property in the currently selected item to pass as a value to a parameter for the given operation. - SelectedItemValuePath *string `json:"selectedItemValuePath,omitempty"` - // Value - The parameter value. - Value interface{} `json:"value,omitempty"` - // ParameterReference - The parameter reference. - ParameterReference *string `json:"parameterReference,omitempty"` - // Required - Indicates whether the parameter is required. - Required *bool `json:"required,omitempty"` -} - -// SwaggerCustomDynamicTreeSettings the swagger custom dynamic tree settings. -type SwaggerCustomDynamicTreeSettings struct { - // CanSelectParentNodes - Indicates whether parent nodes can be selected. - CanSelectParentNodes *bool `json:"CanSelectParentNodes,omitempty"` - // CanSelectLeafNodes - Indicates whether leaf nodes can be selected. - CanSelectLeafNodes *bool `json:"CanSelectLeafNodes,omitempty"` -} - -// SwaggerExternalDocumentation the swagger external documentation -type SwaggerExternalDocumentation struct { - // Description - The document description. - Description *string `json:"description,omitempty"` - // URI - The documentation Uri. - URI *string `json:"uri,omitempty"` - // Extensions - The vendor extensions. - Extensions map[string]interface{} `json:"extensions"` -} - -// MarshalJSON is the custom marshaler for SwaggerExternalDocumentation. -func (sed SwaggerExternalDocumentation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sed.Description != nil { - objectMap["description"] = sed.Description - } - if sed.URI != nil { - objectMap["uri"] = sed.URI - } - if sed.Extensions != nil { - objectMap["extensions"] = sed.Extensions - } - return json.Marshal(objectMap) -} - -// SwaggerSchema the swagger schema. -type SwaggerSchema struct { - // Ref - The reference. - Ref *string `json:"ref,omitempty"` - // Type - The type. Possible values include: 'SwaggerSchemaTypeString', 'SwaggerSchemaTypeNumber', 'SwaggerSchemaTypeInteger', 'SwaggerSchemaTypeBoolean', 'SwaggerSchemaTypeArray', 'SwaggerSchemaTypeFile', 'SwaggerSchemaTypeObject', 'SwaggerSchemaTypeNull' - Type SwaggerSchemaType `json:"type,omitempty"` - // Title - The title. - Title *string `json:"title,omitempty"` - // Items - The items schema. - Items *SwaggerSchema `json:"items,omitempty"` - // Properties - The object properties - Properties map[string]*SwaggerSchema `json:"properties"` - // AdditionalProperties - The additional properties. - AdditionalProperties interface{} `json:"additionalProperties,omitempty"` - // Required - The object required properties. - Required *[]string `json:"required,omitempty"` - // MaxProperties - The maximum number of allowed properties. - MaxProperties *int32 `json:"maxProperties,omitempty"` - // MinProperties - The minimum number of allowed properties. - MinProperties *int32 `json:"minProperties,omitempty"` - // AllOf - The schemas which must pass validation when this schema is used. - AllOf *[]SwaggerSchema `json:"allOf,omitempty"` - // Discriminator - The discriminator. - Discriminator *string `json:"discriminator,omitempty"` - // ReadOnly - Indicates whether this property must be present in the a request. - ReadOnly *bool `json:"readOnly,omitempty"` - // XML - The xml representation format for a property. - XML *SwaggerXML `json:"xml,omitempty"` - // ExternalDocs - The external documentation. - ExternalDocs *SwaggerExternalDocumentation `json:"externalDocs,omitempty"` - // Example - The example value. - Example interface{} `json:"example,omitempty"` - // NotificationURLExtension - Indicates the notification url extension. If this is set, the property's value should be a callback url for a webhook. - NotificationURLExtension *bool `json:"notificationUrlExtension,omitempty"` - // DynamicSchemaOld - The dynamic schema configuration. - DynamicSchemaOld *SwaggerCustomDynamicSchema `json:"dynamicSchemaOld,omitempty"` - // DynamicSchemaNew - The dynamic schema configuration. - DynamicSchemaNew *SwaggerCustomDynamicProperties `json:"dynamicSchemaNew,omitempty"` - // DynamicListNew - The dynamic list. - DynamicListNew *SwaggerCustomDynamicList `json:"dynamicListNew,omitempty"` - // DynamicTree - The dynamic values tree configuration. - DynamicTree *SwaggerCustomDynamicTree `json:"dynamicTree,omitempty"` -} - -// MarshalJSON is the custom marshaler for SwaggerSchema. -func (ss SwaggerSchema) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ss.Ref != nil { - objectMap["ref"] = ss.Ref - } - if ss.Type != "" { - objectMap["type"] = ss.Type - } - if ss.Title != nil { - objectMap["title"] = ss.Title - } - if ss.Items != nil { - objectMap["items"] = ss.Items - } - if ss.Properties != nil { - objectMap["properties"] = ss.Properties - } - if ss.AdditionalProperties != nil { - objectMap["additionalProperties"] = ss.AdditionalProperties - } - if ss.Required != nil { - objectMap["required"] = ss.Required - } - if ss.MaxProperties != nil { - objectMap["maxProperties"] = ss.MaxProperties - } - if ss.MinProperties != nil { - objectMap["minProperties"] = ss.MinProperties - } - if ss.AllOf != nil { - objectMap["allOf"] = ss.AllOf - } - if ss.Discriminator != nil { - objectMap["discriminator"] = ss.Discriminator - } - if ss.ReadOnly != nil { - objectMap["readOnly"] = ss.ReadOnly - } - if ss.XML != nil { - objectMap["xml"] = ss.XML - } - if ss.ExternalDocs != nil { - objectMap["externalDocs"] = ss.ExternalDocs - } - if ss.Example != nil { - objectMap["example"] = ss.Example - } - if ss.NotificationURLExtension != nil { - objectMap["notificationUrlExtension"] = ss.NotificationURLExtension - } - if ss.DynamicSchemaOld != nil { - objectMap["dynamicSchemaOld"] = ss.DynamicSchemaOld - } - if ss.DynamicSchemaNew != nil { - objectMap["dynamicSchemaNew"] = ss.DynamicSchemaNew - } - if ss.DynamicListNew != nil { - objectMap["dynamicListNew"] = ss.DynamicListNew - } - if ss.DynamicTree != nil { - objectMap["dynamicTree"] = ss.DynamicTree - } - return json.Marshal(objectMap) -} - -// SwaggerXML the Swagger XML. -type SwaggerXML struct { - // Name - The xml element or attribute name. - Name *string `json:"name,omitempty"` - // Namespace - The xml namespace. - Namespace *string `json:"namespace,omitempty"` - // Prefix - The name prefix. - Prefix *string `json:"prefix,omitempty"` - // Attribute - Indicates whether the property should be an attribute instead of an element. - Attribute *bool `json:"attribute,omitempty"` - // Wrapped - Indicates whether the array elements are wrapped in a container element. - Wrapped *bool `json:"wrapped,omitempty"` - // Extensions - The vendor extensions. - Extensions map[string]interface{} `json:"extensions"` -} - -// MarshalJSON is the custom marshaler for SwaggerXML. -func (sx SwaggerXML) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sx.Name != nil { - objectMap["name"] = sx.Name - } - if sx.Namespace != nil { - objectMap["namespace"] = sx.Namespace - } - if sx.Prefix != nil { - objectMap["prefix"] = sx.Prefix - } - if sx.Attribute != nil { - objectMap["attribute"] = sx.Attribute - } - if sx.Wrapped != nil { - objectMap["wrapped"] = sx.Wrapped - } - if sx.Extensions != nil { - objectMap["extensions"] = sx.Extensions - } - return json.Marshal(objectMap) -} - -// TrackingEvent the tracking event. -type TrackingEvent struct { - // EventLevel - The event level. Possible values include: 'EventLevelLogAlways', 'EventLevelCritical', 'EventLevelError', 'EventLevelWarning', 'EventLevelInformational', 'EventLevelVerbose' - EventLevel EventLevel `json:"eventLevel,omitempty"` - // EventTime - The event time. - EventTime *date.Time `json:"eventTime,omitempty"` - // RecordType - The record type. Possible values include: 'TrackingRecordTypeNotSpecified', 'TrackingRecordTypeCustom', 'TrackingRecordTypeAS2Message', 'TrackingRecordTypeAS2MDN', 'TrackingRecordTypeX12Interchange', 'TrackingRecordTypeX12FunctionalGroup', 'TrackingRecordTypeX12TransactionSet', 'TrackingRecordTypeX12InterchangeAcknowledgment', 'TrackingRecordTypeX12FunctionalGroupAcknowledgment', 'TrackingRecordTypeX12TransactionSetAcknowledgment', 'TrackingRecordTypeEdifactInterchange', 'TrackingRecordTypeEdifactFunctionalGroup', 'TrackingRecordTypeEdifactTransactionSet', 'TrackingRecordTypeEdifactInterchangeAcknowledgment', 'TrackingRecordTypeEdifactFunctionalGroupAcknowledgment', 'TrackingRecordTypeEdifactTransactionSetAcknowledgment' - RecordType TrackingRecordType `json:"recordType,omitempty"` - // Record - The record. - Record interface{} `json:"record,omitempty"` - // Error - The error. - Error *TrackingEventErrorInfo `json:"error,omitempty"` -} - -// TrackingEventErrorInfo the tracking event error info. -type TrackingEventErrorInfo struct { - // Message - The message. - Message *string `json:"message,omitempty"` - // Code - The code. - Code *string `json:"code,omitempty"` -} - -// TrackingEventsDefinition the tracking events definition. -type TrackingEventsDefinition struct { - // SourceType - The source type. - SourceType *string `json:"sourceType,omitempty"` - // TrackEventsOptions - The track events options. Possible values include: 'TrackEventsOperationOptionsNone', 'TrackEventsOperationOptionsDisableSourceInfoEnrich' - TrackEventsOptions TrackEventsOperationOptions `json:"trackEventsOptions,omitempty"` - // Events - The events. - Events *[]TrackingEvent `json:"events,omitempty"` -} - -// UserAssignedIdentity user Assigned identity properties. -type UserAssignedIdentity struct { - // PrincipalID - READ-ONLY; Principal Id of user assigned identity - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - READ-ONLY; Client Id of user assigned identity - ClientID *string `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserAssignedIdentity. -func (uai UserAssignedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Workflow the workflow type. -type Workflow struct { - autorest.Response `json:"-"` - // WorkflowProperties - The workflow properties. - *WorkflowProperties `json:"properties,omitempty"` - Identity *ManagedServiceIdentity `json:"identity,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Workflow. -func (w Workflow) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.WorkflowProperties != nil { - objectMap["properties"] = w.WorkflowProperties - } - if w.Identity != nil { - objectMap["identity"] = w.Identity - } - if w.Location != nil { - objectMap["location"] = w.Location - } - if w.Tags != nil { - objectMap["tags"] = w.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Workflow struct. -func (w *Workflow) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var workflowProperties WorkflowProperties - err = json.Unmarshal(*v, &workflowProperties) - if err != nil { - return err - } - w.WorkflowProperties = &workflowProperties - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - w.Identity = &identity - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - w.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - w.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - w.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - w.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - w.Tags = tags - } - } - } - - return nil -} - -// WorkflowFilter the workflow filter. -type WorkflowFilter struct { - // State - The state of workflows. Possible values include: 'WorkflowStateNotSpecified', 'WorkflowStateCompleted', 'WorkflowStateEnabled', 'WorkflowStateDisabled', 'WorkflowStateDeleted', 'WorkflowStateSuspended' - State WorkflowState `json:"state,omitempty"` -} - -// WorkflowListResult the list of workflows. -type WorkflowListResult struct { - autorest.Response `json:"-"` - // Value - The list of workflows. - Value *[]Workflow `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// WorkflowListResultIterator provides access to a complete listing of Workflow values. -type WorkflowListResultIterator struct { - i int - page WorkflowListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *WorkflowListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *WorkflowListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkflowListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter WorkflowListResultIterator) Response() WorkflowListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter WorkflowListResultIterator) Value() Workflow { - if !iter.page.NotDone() { - return Workflow{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkflowListResultIterator type. -func NewWorkflowListResultIterator(page WorkflowListResultPage) WorkflowListResultIterator { - return WorkflowListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wlr WorkflowListResult) IsEmpty() bool { - return wlr.Value == nil || len(*wlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wlr WorkflowListResult) hasNextLink() bool { - return wlr.NextLink != nil && len(*wlr.NextLink) != 0 -} - -// workflowListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wlr WorkflowListResult) workflowListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wlr.NextLink))) -} - -// WorkflowListResultPage contains a page of Workflow values. -type WorkflowListResultPage struct { - fn func(context.Context, WorkflowListResult) (WorkflowListResult, error) - wlr WorkflowListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *WorkflowListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.wlr) - if err != nil { - return err - } - page.wlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *WorkflowListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkflowListResultPage) NotDone() bool { - return !page.wlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkflowListResultPage) Response() WorkflowListResult { - return page.wlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkflowListResultPage) Values() []Workflow { - if page.wlr.IsEmpty() { - return nil - } - return *page.wlr.Value -} - -// Creates a new instance of the WorkflowListResultPage type. -func NewWorkflowListResultPage(cur WorkflowListResult, getNextPage func(context.Context, WorkflowListResult) (WorkflowListResult, error)) WorkflowListResultPage { - return WorkflowListResultPage{ - fn: getNextPage, - wlr: cur, - } -} - -// WorkflowOutputParameter the workflow output parameter. -type WorkflowOutputParameter struct { - // Error - READ-ONLY; Gets the error. - Error interface{} `json:"error,omitempty"` - // Type - The type. Possible values include: 'ParameterTypeNotSpecified', 'ParameterTypeString', 'ParameterTypeSecureString', 'ParameterTypeInt', 'ParameterTypeFloat', 'ParameterTypeBool', 'ParameterTypeArray', 'ParameterTypeObject', 'ParameterTypeSecureObject' - Type ParameterType `json:"type,omitempty"` - // Value - The value. - Value interface{} `json:"value,omitempty"` - // Metadata - The metadata. - Metadata interface{} `json:"metadata,omitempty"` - // Description - The description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkflowOutputParameter. -func (wop WorkflowOutputParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wop.Type != "" { - objectMap["type"] = wop.Type - } - if wop.Value != nil { - objectMap["value"] = wop.Value - } - if wop.Metadata != nil { - objectMap["metadata"] = wop.Metadata - } - if wop.Description != nil { - objectMap["description"] = wop.Description - } - return json.Marshal(objectMap) -} - -// WorkflowParameter the workflow parameters. -type WorkflowParameter struct { - // Type - The type. Possible values include: 'ParameterTypeNotSpecified', 'ParameterTypeString', 'ParameterTypeSecureString', 'ParameterTypeInt', 'ParameterTypeFloat', 'ParameterTypeBool', 'ParameterTypeArray', 'ParameterTypeObject', 'ParameterTypeSecureObject' - Type ParameterType `json:"type,omitempty"` - // Value - The value. - Value interface{} `json:"value,omitempty"` - // Metadata - The metadata. - Metadata interface{} `json:"metadata,omitempty"` - // Description - The description. - Description *string `json:"description,omitempty"` -} - -// WorkflowProperties the workflow properties. -type WorkflowProperties struct { - // ProvisioningState - READ-ONLY; Gets the provisioning state. Possible values include: 'WorkflowProvisioningStateNotSpecified', 'WorkflowProvisioningStateAccepted', 'WorkflowProvisioningStateRunning', 'WorkflowProvisioningStateReady', 'WorkflowProvisioningStateCreating', 'WorkflowProvisioningStateCreated', 'WorkflowProvisioningStateDeleting', 'WorkflowProvisioningStateDeleted', 'WorkflowProvisioningStateCanceled', 'WorkflowProvisioningStateFailed', 'WorkflowProvisioningStateSucceeded', 'WorkflowProvisioningStateMoving', 'WorkflowProvisioningStateUpdating', 'WorkflowProvisioningStateRegistering', 'WorkflowProvisioningStateRegistered', 'WorkflowProvisioningStateUnregistering', 'WorkflowProvisioningStateUnregistered', 'WorkflowProvisioningStateCompleted', 'WorkflowProvisioningStateRenewing', 'WorkflowProvisioningStatePending', 'WorkflowProvisioningStateWaiting', 'WorkflowProvisioningStateInProgress' - ProvisioningState WorkflowProvisioningState `json:"provisioningState,omitempty"` - // CreatedTime - READ-ONLY; Gets the created time. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ChangedTime - READ-ONLY; Gets the changed time. - ChangedTime *date.Time `json:"changedTime,omitempty"` - // State - The state. Possible values include: 'WorkflowStateNotSpecified', 'WorkflowStateCompleted', 'WorkflowStateEnabled', 'WorkflowStateDisabled', 'WorkflowStateDeleted', 'WorkflowStateSuspended' - State WorkflowState `json:"state,omitempty"` - // Version - READ-ONLY; Gets the version. - Version *string `json:"version,omitempty"` - // AccessEndpoint - READ-ONLY; Gets the access endpoint. - AccessEndpoint *string `json:"accessEndpoint,omitempty"` - // EndpointsConfiguration - The endpoints configuration. - EndpointsConfiguration *FlowEndpointsConfiguration `json:"endpointsConfiguration,omitempty"` - // AccessControl - The access control configuration. - AccessControl *FlowAccessControlConfiguration `json:"accessControl,omitempty"` - // Sku - READ-ONLY; The sku. - Sku *Sku `json:"sku,omitempty"` - // IntegrationAccount - The integration account. - IntegrationAccount *ResourceReference `json:"integrationAccount,omitempty"` - // IntegrationServiceEnvironment - The integration service environment. - IntegrationServiceEnvironment *ResourceReference `json:"integrationServiceEnvironment,omitempty"` - // Definition - The definition. - Definition interface{} `json:"definition,omitempty"` - // Parameters - The parameters. - Parameters map[string]*WorkflowParameter `json:"parameters"` -} - -// MarshalJSON is the custom marshaler for WorkflowProperties. -func (wp WorkflowProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.State != "" { - objectMap["state"] = wp.State - } - if wp.EndpointsConfiguration != nil { - objectMap["endpointsConfiguration"] = wp.EndpointsConfiguration - } - if wp.AccessControl != nil { - objectMap["accessControl"] = wp.AccessControl - } - if wp.IntegrationAccount != nil { - objectMap["integrationAccount"] = wp.IntegrationAccount - } - if wp.IntegrationServiceEnvironment != nil { - objectMap["integrationServiceEnvironment"] = wp.IntegrationServiceEnvironment - } - if wp.Definition != nil { - objectMap["definition"] = wp.Definition - } - if wp.Parameters != nil { - objectMap["parameters"] = wp.Parameters - } - return json.Marshal(objectMap) -} - -// WorkflowReference the workflow reference. -type WorkflowReference struct { - // ID - The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkflowReference. -func (wr WorkflowReference) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wr.ID != nil { - objectMap["id"] = wr.ID - } - return json.Marshal(objectMap) -} - -// WorkflowRun the workflow run. -type WorkflowRun struct { - autorest.Response `json:"-"` - // WorkflowRunProperties - The workflow run properties. - *WorkflowRunProperties `json:"properties,omitempty"` - // Name - READ-ONLY; Gets the workflow run name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the workflow run type. - Type *string `json:"type,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkflowRun. -func (wr WorkflowRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wr.WorkflowRunProperties != nil { - objectMap["properties"] = wr.WorkflowRunProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkflowRun struct. -func (wr *WorkflowRun) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var workflowRunProperties WorkflowRunProperties - err = json.Unmarshal(*v, &workflowRunProperties) - if err != nil { - return err - } - wr.WorkflowRunProperties = &workflowRunProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - wr.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wr.ID = &ID - } - } - } - - return nil -} - -// WorkflowRunAction the workflow run action. -type WorkflowRunAction struct { - autorest.Response `json:"-"` - // WorkflowRunActionProperties - The workflow run action properties. - *WorkflowRunActionProperties `json:"properties,omitempty"` - // Name - READ-ONLY; Gets the workflow run action name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the workflow run action type. - Type *string `json:"type,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkflowRunAction. -func (wra WorkflowRunAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wra.WorkflowRunActionProperties != nil { - objectMap["properties"] = wra.WorkflowRunActionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkflowRunAction struct. -func (wra *WorkflowRunAction) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var workflowRunActionProperties WorkflowRunActionProperties - err = json.Unmarshal(*v, &workflowRunActionProperties) - if err != nil { - return err - } - wra.WorkflowRunActionProperties = &workflowRunActionProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wra.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - wra.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wra.ID = &ID - } - } - } - - return nil -} - -// WorkflowRunActionFilter the workflow run action filter. -type WorkflowRunActionFilter struct { - // Status - The status of workflow run action. Possible values include: 'WorkflowStatusNotSpecified', 'WorkflowStatusPaused', 'WorkflowStatusRunning', 'WorkflowStatusWaiting', 'WorkflowStatusSucceeded', 'WorkflowStatusSkipped', 'WorkflowStatusSuspended', 'WorkflowStatusCancelled', 'WorkflowStatusFailed', 'WorkflowStatusFaulted', 'WorkflowStatusTimedOut', 'WorkflowStatusAborted', 'WorkflowStatusIgnored' - Status WorkflowStatus `json:"status,omitempty"` -} - -// WorkflowRunActionListResult the list of workflow run actions. -type WorkflowRunActionListResult struct { - autorest.Response `json:"-"` - // Value - A list of workflow run actions. - Value *[]WorkflowRunAction `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// WorkflowRunActionListResultIterator provides access to a complete listing of WorkflowRunAction values. -type WorkflowRunActionListResultIterator struct { - i int - page WorkflowRunActionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *WorkflowRunActionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *WorkflowRunActionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkflowRunActionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter WorkflowRunActionListResultIterator) Response() WorkflowRunActionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter WorkflowRunActionListResultIterator) Value() WorkflowRunAction { - if !iter.page.NotDone() { - return WorkflowRunAction{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkflowRunActionListResultIterator type. -func NewWorkflowRunActionListResultIterator(page WorkflowRunActionListResultPage) WorkflowRunActionListResultIterator { - return WorkflowRunActionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wralr WorkflowRunActionListResult) IsEmpty() bool { - return wralr.Value == nil || len(*wralr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wralr WorkflowRunActionListResult) hasNextLink() bool { - return wralr.NextLink != nil && len(*wralr.NextLink) != 0 -} - -// workflowRunActionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wralr WorkflowRunActionListResult) workflowRunActionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wralr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wralr.NextLink))) -} - -// WorkflowRunActionListResultPage contains a page of WorkflowRunAction values. -type WorkflowRunActionListResultPage struct { - fn func(context.Context, WorkflowRunActionListResult) (WorkflowRunActionListResult, error) - wralr WorkflowRunActionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *WorkflowRunActionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.wralr) - if err != nil { - return err - } - page.wralr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *WorkflowRunActionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkflowRunActionListResultPage) NotDone() bool { - return !page.wralr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkflowRunActionListResultPage) Response() WorkflowRunActionListResult { - return page.wralr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkflowRunActionListResultPage) Values() []WorkflowRunAction { - if page.wralr.IsEmpty() { - return nil - } - return *page.wralr.Value -} - -// Creates a new instance of the WorkflowRunActionListResultPage type. -func NewWorkflowRunActionListResultPage(cur WorkflowRunActionListResult, getNextPage func(context.Context, WorkflowRunActionListResult) (WorkflowRunActionListResult, error)) WorkflowRunActionListResultPage { - return WorkflowRunActionListResultPage{ - fn: getNextPage, - wralr: cur, - } -} - -// WorkflowRunActionProperties the workflow run action properties. -type WorkflowRunActionProperties struct { - // StartTime - READ-ONLY; Gets the start time. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; Gets the end time. - EndTime *date.Time `json:"endTime,omitempty"` - // Status - READ-ONLY; Gets the status. Possible values include: 'WorkflowStatusNotSpecified', 'WorkflowStatusPaused', 'WorkflowStatusRunning', 'WorkflowStatusWaiting', 'WorkflowStatusSucceeded', 'WorkflowStatusSkipped', 'WorkflowStatusSuspended', 'WorkflowStatusCancelled', 'WorkflowStatusFailed', 'WorkflowStatusFaulted', 'WorkflowStatusTimedOut', 'WorkflowStatusAborted', 'WorkflowStatusIgnored' - Status WorkflowStatus `json:"status,omitempty"` - // Code - READ-ONLY; Gets the code. - Code *string `json:"code,omitempty"` - // Error - READ-ONLY; Gets the error. - Error interface{} `json:"error,omitempty"` - // TrackingID - READ-ONLY; Gets the tracking id. - TrackingID *string `json:"trackingId,omitempty"` - // Correlation - The correlation properties. - Correlation *RunActionCorrelation `json:"correlation,omitempty"` - // InputsLink - READ-ONLY; Gets the link to inputs. - InputsLink *ContentLink `json:"inputsLink,omitempty"` - // OutputsLink - READ-ONLY; Gets the link to outputs. - OutputsLink *ContentLink `json:"outputsLink,omitempty"` - // TrackedProperties - READ-ONLY; Gets the tracked properties. - TrackedProperties interface{} `json:"trackedProperties,omitempty"` - // RetryHistory - Gets the retry histories. - RetryHistory *[]RetryHistory `json:"retryHistory,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkflowRunActionProperties. -func (wrap WorkflowRunActionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wrap.Correlation != nil { - objectMap["correlation"] = wrap.Correlation - } - if wrap.RetryHistory != nil { - objectMap["retryHistory"] = wrap.RetryHistory - } - return json.Marshal(objectMap) -} - -// WorkflowRunActionRepetitionDefinition the workflow run action repetition definition. -type WorkflowRunActionRepetitionDefinition struct { - autorest.Response `json:"-"` - // WorkflowRunActionRepetitionProperties - The workflow run action repetition properties definition. - *WorkflowRunActionRepetitionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for WorkflowRunActionRepetitionDefinition. -func (wrard WorkflowRunActionRepetitionDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wrard.WorkflowRunActionRepetitionProperties != nil { - objectMap["properties"] = wrard.WorkflowRunActionRepetitionProperties - } - if wrard.Location != nil { - objectMap["location"] = wrard.Location - } - if wrard.Tags != nil { - objectMap["tags"] = wrard.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkflowRunActionRepetitionDefinition struct. -func (wrard *WorkflowRunActionRepetitionDefinition) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var workflowRunActionRepetitionProperties WorkflowRunActionRepetitionProperties - err = json.Unmarshal(*v, &workflowRunActionRepetitionProperties) - if err != nil { - return err - } - wrard.WorkflowRunActionRepetitionProperties = &workflowRunActionRepetitionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wrard.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wrard.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - wrard.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wrard.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - wrard.Tags = tags - } - } - } - - return nil -} - -// WorkflowRunActionRepetitionDefinitionCollection a collection of workflow run action repetitions. -type WorkflowRunActionRepetitionDefinitionCollection struct { - autorest.Response `json:"-"` - // NextLink - The link used to get the next page of recommendations. - NextLink *string `json:"nextLink,omitempty"` - Value *[]WorkflowRunActionRepetitionDefinition `json:"value,omitempty"` -} - -// WorkflowRunActionRepetitionProperties the workflow run action repetition properties definition. -type WorkflowRunActionRepetitionProperties struct { - // RepetitionIndexes - The repetition indexes. - RepetitionIndexes *[]RepetitionIndex `json:"repetitionIndexes,omitempty"` - // TrackingID - READ-ONLY; Gets the tracking id. - TrackingID *string `json:"trackingId,omitempty"` - // Inputs - READ-ONLY; Gets the inputs. - Inputs interface{} `json:"inputs,omitempty"` - // InputsLink - READ-ONLY; Gets the link to inputs. - InputsLink *ContentLink `json:"inputsLink,omitempty"` - // Outputs - READ-ONLY; Gets the outputs. - Outputs interface{} `json:"outputs,omitempty"` - // OutputsLink - READ-ONLY; Gets the link to outputs. - OutputsLink *ContentLink `json:"outputsLink,omitempty"` - // TrackedProperties - READ-ONLY; Gets the tracked properties. - TrackedProperties interface{} `json:"trackedProperties,omitempty"` - // RetryHistory - Gets the retry histories. - RetryHistory *[]RetryHistory `json:"retryHistory,omitempty"` - IterationCount *int32 `json:"iterationCount,omitempty"` - // StartTime - The start time of the workflow scope repetition. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - The end time of the workflow scope repetition. - EndTime *date.Time `json:"endTime,omitempty"` - // Correlation - The correlation properties. - Correlation *RunActionCorrelation `json:"correlation,omitempty"` - // Status - The status of the workflow scope repetition. Possible values include: 'WorkflowStatusNotSpecified', 'WorkflowStatusPaused', 'WorkflowStatusRunning', 'WorkflowStatusWaiting', 'WorkflowStatusSucceeded', 'WorkflowStatusSkipped', 'WorkflowStatusSuspended', 'WorkflowStatusCancelled', 'WorkflowStatusFailed', 'WorkflowStatusFaulted', 'WorkflowStatusTimedOut', 'WorkflowStatusAborted', 'WorkflowStatusIgnored' - Status WorkflowStatus `json:"status,omitempty"` - // Code - The workflow scope repetition code. - Code *string `json:"code,omitempty"` - Error interface{} `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkflowRunActionRepetitionProperties. -func (wrarp WorkflowRunActionRepetitionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wrarp.RepetitionIndexes != nil { - objectMap["repetitionIndexes"] = wrarp.RepetitionIndexes - } - if wrarp.RetryHistory != nil { - objectMap["retryHistory"] = wrarp.RetryHistory - } - if wrarp.IterationCount != nil { - objectMap["iterationCount"] = wrarp.IterationCount - } - if wrarp.StartTime != nil { - objectMap["startTime"] = wrarp.StartTime - } - if wrarp.EndTime != nil { - objectMap["endTime"] = wrarp.EndTime - } - if wrarp.Correlation != nil { - objectMap["correlation"] = wrarp.Correlation - } - if wrarp.Status != "" { - objectMap["status"] = wrarp.Status - } - if wrarp.Code != nil { - objectMap["code"] = wrarp.Code - } - if wrarp.Error != nil { - objectMap["error"] = wrarp.Error - } - return json.Marshal(objectMap) -} - -// WorkflowRunFilter the workflow run filter. -type WorkflowRunFilter struct { - // Status - The status of workflow run. Possible values include: 'WorkflowStatusNotSpecified', 'WorkflowStatusPaused', 'WorkflowStatusRunning', 'WorkflowStatusWaiting', 'WorkflowStatusSucceeded', 'WorkflowStatusSkipped', 'WorkflowStatusSuspended', 'WorkflowStatusCancelled', 'WorkflowStatusFailed', 'WorkflowStatusFaulted', 'WorkflowStatusTimedOut', 'WorkflowStatusAborted', 'WorkflowStatusIgnored' - Status WorkflowStatus `json:"status,omitempty"` -} - -// WorkflowRunListResult the list of workflow runs. -type WorkflowRunListResult struct { - autorest.Response `json:"-"` - // Value - A list of workflow runs. - Value *[]WorkflowRun `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// WorkflowRunListResultIterator provides access to a complete listing of WorkflowRun values. -type WorkflowRunListResultIterator struct { - i int - page WorkflowRunListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *WorkflowRunListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *WorkflowRunListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkflowRunListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter WorkflowRunListResultIterator) Response() WorkflowRunListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter WorkflowRunListResultIterator) Value() WorkflowRun { - if !iter.page.NotDone() { - return WorkflowRun{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkflowRunListResultIterator type. -func NewWorkflowRunListResultIterator(page WorkflowRunListResultPage) WorkflowRunListResultIterator { - return WorkflowRunListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wrlr WorkflowRunListResult) IsEmpty() bool { - return wrlr.Value == nil || len(*wrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wrlr WorkflowRunListResult) hasNextLink() bool { - return wrlr.NextLink != nil && len(*wrlr.NextLink) != 0 -} - -// workflowRunListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wrlr WorkflowRunListResult) workflowRunListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wrlr.NextLink))) -} - -// WorkflowRunListResultPage contains a page of WorkflowRun values. -type WorkflowRunListResultPage struct { - fn func(context.Context, WorkflowRunListResult) (WorkflowRunListResult, error) - wrlr WorkflowRunListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *WorkflowRunListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.wrlr) - if err != nil { - return err - } - page.wrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *WorkflowRunListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkflowRunListResultPage) NotDone() bool { - return !page.wrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkflowRunListResultPage) Response() WorkflowRunListResult { - return page.wrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkflowRunListResultPage) Values() []WorkflowRun { - if page.wrlr.IsEmpty() { - return nil - } - return *page.wrlr.Value -} - -// Creates a new instance of the WorkflowRunListResultPage type. -func NewWorkflowRunListResultPage(cur WorkflowRunListResult, getNextPage func(context.Context, WorkflowRunListResult) (WorkflowRunListResult, error)) WorkflowRunListResultPage { - return WorkflowRunListResultPage{ - fn: getNextPage, - wrlr: cur, - } -} - -// WorkflowRunProperties the workflow run properties. -type WorkflowRunProperties struct { - // WaitEndTime - READ-ONLY; Gets the wait end time. - WaitEndTime *date.Time `json:"waitEndTime,omitempty"` - // StartTime - READ-ONLY; Gets the start time. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; Gets the end time. - EndTime *date.Time `json:"endTime,omitempty"` - // Status - READ-ONLY; Gets the status. Possible values include: 'WorkflowStatusNotSpecified', 'WorkflowStatusPaused', 'WorkflowStatusRunning', 'WorkflowStatusWaiting', 'WorkflowStatusSucceeded', 'WorkflowStatusSkipped', 'WorkflowStatusSuspended', 'WorkflowStatusCancelled', 'WorkflowStatusFailed', 'WorkflowStatusFaulted', 'WorkflowStatusTimedOut', 'WorkflowStatusAborted', 'WorkflowStatusIgnored' - Status WorkflowStatus `json:"status,omitempty"` - // Code - READ-ONLY; Gets the code. - Code *string `json:"code,omitempty"` - // Error - READ-ONLY; Gets the error. - Error interface{} `json:"error,omitempty"` - // CorrelationID - READ-ONLY; Gets the correlation id. - CorrelationID *string `json:"correlationId,omitempty"` - // Correlation - The run correlation. - Correlation *Correlation `json:"correlation,omitempty"` - // Workflow - READ-ONLY; Gets the reference to workflow version. - Workflow *ResourceReference `json:"workflow,omitempty"` - // Trigger - READ-ONLY; Gets the fired trigger. - Trigger *WorkflowRunTrigger `json:"trigger,omitempty"` - // Outputs - READ-ONLY; Gets the outputs. - Outputs map[string]*WorkflowOutputParameter `json:"outputs"` - // Response - READ-ONLY; Gets the response of the flow run. - Response *WorkflowRunTrigger `json:"response,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkflowRunProperties. -func (wrp WorkflowRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wrp.Correlation != nil { - objectMap["correlation"] = wrp.Correlation - } - return json.Marshal(objectMap) -} - -// WorkflowRunTrigger the workflow run trigger. -type WorkflowRunTrigger struct { - // Name - READ-ONLY; Gets the name. - Name *string `json:"name,omitempty"` - // Inputs - READ-ONLY; Gets the inputs. - Inputs interface{} `json:"inputs,omitempty"` - // InputsLink - READ-ONLY; Gets the link to inputs. - InputsLink *ContentLink `json:"inputsLink,omitempty"` - // Outputs - READ-ONLY; Gets the outputs. - Outputs interface{} `json:"outputs,omitempty"` - // OutputsLink - READ-ONLY; Gets the link to outputs. - OutputsLink *ContentLink `json:"outputsLink,omitempty"` - // ScheduledTime - READ-ONLY; Gets the scheduled time. - ScheduledTime *date.Time `json:"scheduledTime,omitempty"` - // StartTime - READ-ONLY; Gets the start time. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; Gets the end time. - EndTime *date.Time `json:"endTime,omitempty"` - // TrackingID - READ-ONLY; Gets the tracking id. - TrackingID *string `json:"trackingId,omitempty"` - // Correlation - The run correlation. - Correlation *Correlation `json:"correlation,omitempty"` - // Code - READ-ONLY; Gets the code. - Code *string `json:"code,omitempty"` - // Status - READ-ONLY; Gets the status. Possible values include: 'WorkflowStatusNotSpecified', 'WorkflowStatusPaused', 'WorkflowStatusRunning', 'WorkflowStatusWaiting', 'WorkflowStatusSucceeded', 'WorkflowStatusSkipped', 'WorkflowStatusSuspended', 'WorkflowStatusCancelled', 'WorkflowStatusFailed', 'WorkflowStatusFaulted', 'WorkflowStatusTimedOut', 'WorkflowStatusAborted', 'WorkflowStatusIgnored' - Status WorkflowStatus `json:"status,omitempty"` - // Error - READ-ONLY; Gets the error. - Error interface{} `json:"error,omitempty"` - // TrackedProperties - READ-ONLY; Gets the tracked properties. - TrackedProperties interface{} `json:"trackedProperties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkflowRunTrigger. -func (wrt WorkflowRunTrigger) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wrt.Correlation != nil { - objectMap["correlation"] = wrt.Correlation - } - return json.Marshal(objectMap) -} - -// WorkflowsMoveFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WorkflowsMoveFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WorkflowsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WorkflowsMoveFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for WorkflowsMoveFuture.Result. -func (future *WorkflowsMoveFuture) result(client WorkflowsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsMoveFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("logic.WorkflowsMoveFuture") - return - } - ar.Response = future.Response() - return -} - -// WorkflowTrigger the workflow trigger. -type WorkflowTrigger struct { - autorest.Response `json:"-"` - // WorkflowTriggerProperties - The workflow trigger properties. - *WorkflowTriggerProperties `json:"properties,omitempty"` - // Name - READ-ONLY; Gets the workflow trigger name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the workflow trigger type. - Type *string `json:"type,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkflowTrigger. -func (wt WorkflowTrigger) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wt.WorkflowTriggerProperties != nil { - objectMap["properties"] = wt.WorkflowTriggerProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkflowTrigger struct. -func (wt *WorkflowTrigger) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var workflowTriggerProperties WorkflowTriggerProperties - err = json.Unmarshal(*v, &workflowTriggerProperties) - if err != nil { - return err - } - wt.WorkflowTriggerProperties = &workflowTriggerProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - wt.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wt.ID = &ID - } - } - } - - return nil -} - -// WorkflowTriggerCallbackURL the workflow trigger callback URL. -type WorkflowTriggerCallbackURL struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Gets the workflow trigger callback URL. - Value *string `json:"value,omitempty"` - // Method - READ-ONLY; Gets the workflow trigger callback URL HTTP method. - Method *string `json:"method,omitempty"` - // BasePath - READ-ONLY; Gets the workflow trigger callback URL base path. - BasePath *string `json:"basePath,omitempty"` - // RelativePath - READ-ONLY; Gets the workflow trigger callback URL relative path. - RelativePath *string `json:"relativePath,omitempty"` - // RelativePathParameters - Gets the workflow trigger callback URL relative path parameters. - RelativePathParameters *[]string `json:"relativePathParameters,omitempty"` - // Queries - Gets the workflow trigger callback URL query parameters. - Queries *WorkflowTriggerListCallbackURLQueries `json:"queries,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkflowTriggerCallbackURL. -func (wtcu WorkflowTriggerCallbackURL) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wtcu.RelativePathParameters != nil { - objectMap["relativePathParameters"] = wtcu.RelativePathParameters - } - if wtcu.Queries != nil { - objectMap["queries"] = wtcu.Queries - } - return json.Marshal(objectMap) -} - -// WorkflowTriggerFilter the workflow trigger filter. -type WorkflowTriggerFilter struct { - // State - The state of workflow trigger. Possible values include: 'WorkflowStateNotSpecified', 'WorkflowStateCompleted', 'WorkflowStateEnabled', 'WorkflowStateDisabled', 'WorkflowStateDeleted', 'WorkflowStateSuspended' - State WorkflowState `json:"state,omitempty"` -} - -// WorkflowTriggerHistory the workflow trigger history. -type WorkflowTriggerHistory struct { - autorest.Response `json:"-"` - // WorkflowTriggerHistoryProperties - Gets the workflow trigger history properties. - *WorkflowTriggerHistoryProperties `json:"properties,omitempty"` - // Name - READ-ONLY; Gets the workflow trigger history name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the workflow trigger history type. - Type *string `json:"type,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkflowTriggerHistory. -func (wth WorkflowTriggerHistory) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wth.WorkflowTriggerHistoryProperties != nil { - objectMap["properties"] = wth.WorkflowTriggerHistoryProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkflowTriggerHistory struct. -func (wth *WorkflowTriggerHistory) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var workflowTriggerHistoryProperties WorkflowTriggerHistoryProperties - err = json.Unmarshal(*v, &workflowTriggerHistoryProperties) - if err != nil { - return err - } - wth.WorkflowTriggerHistoryProperties = &workflowTriggerHistoryProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wth.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - wth.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wth.ID = &ID - } - } - } - - return nil -} - -// WorkflowTriggerHistoryFilter the workflow trigger history filter. -type WorkflowTriggerHistoryFilter struct { - // Status - The status of workflow trigger history. Possible values include: 'WorkflowStatusNotSpecified', 'WorkflowStatusPaused', 'WorkflowStatusRunning', 'WorkflowStatusWaiting', 'WorkflowStatusSucceeded', 'WorkflowStatusSkipped', 'WorkflowStatusSuspended', 'WorkflowStatusCancelled', 'WorkflowStatusFailed', 'WorkflowStatusFaulted', 'WorkflowStatusTimedOut', 'WorkflowStatusAborted', 'WorkflowStatusIgnored' - Status WorkflowStatus `json:"status,omitempty"` -} - -// WorkflowTriggerHistoryListResult the list of workflow trigger histories. -type WorkflowTriggerHistoryListResult struct { - autorest.Response `json:"-"` - // Value - A list of workflow trigger histories. - Value *[]WorkflowTriggerHistory `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// WorkflowTriggerHistoryListResultIterator provides access to a complete listing of WorkflowTriggerHistory -// values. -type WorkflowTriggerHistoryListResultIterator struct { - i int - page WorkflowTriggerHistoryListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *WorkflowTriggerHistoryListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggerHistoryListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *WorkflowTriggerHistoryListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkflowTriggerHistoryListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter WorkflowTriggerHistoryListResultIterator) Response() WorkflowTriggerHistoryListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter WorkflowTriggerHistoryListResultIterator) Value() WorkflowTriggerHistory { - if !iter.page.NotDone() { - return WorkflowTriggerHistory{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkflowTriggerHistoryListResultIterator type. -func NewWorkflowTriggerHistoryListResultIterator(page WorkflowTriggerHistoryListResultPage) WorkflowTriggerHistoryListResultIterator { - return WorkflowTriggerHistoryListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wthlr WorkflowTriggerHistoryListResult) IsEmpty() bool { - return wthlr.Value == nil || len(*wthlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wthlr WorkflowTriggerHistoryListResult) hasNextLink() bool { - return wthlr.NextLink != nil && len(*wthlr.NextLink) != 0 -} - -// workflowTriggerHistoryListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wthlr WorkflowTriggerHistoryListResult) workflowTriggerHistoryListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wthlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wthlr.NextLink))) -} - -// WorkflowTriggerHistoryListResultPage contains a page of WorkflowTriggerHistory values. -type WorkflowTriggerHistoryListResultPage struct { - fn func(context.Context, WorkflowTriggerHistoryListResult) (WorkflowTriggerHistoryListResult, error) - wthlr WorkflowTriggerHistoryListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *WorkflowTriggerHistoryListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggerHistoryListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.wthlr) - if err != nil { - return err - } - page.wthlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *WorkflowTriggerHistoryListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkflowTriggerHistoryListResultPage) NotDone() bool { - return !page.wthlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkflowTriggerHistoryListResultPage) Response() WorkflowTriggerHistoryListResult { - return page.wthlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkflowTriggerHistoryListResultPage) Values() []WorkflowTriggerHistory { - if page.wthlr.IsEmpty() { - return nil - } - return *page.wthlr.Value -} - -// Creates a new instance of the WorkflowTriggerHistoryListResultPage type. -func NewWorkflowTriggerHistoryListResultPage(cur WorkflowTriggerHistoryListResult, getNextPage func(context.Context, WorkflowTriggerHistoryListResult) (WorkflowTriggerHistoryListResult, error)) WorkflowTriggerHistoryListResultPage { - return WorkflowTriggerHistoryListResultPage{ - fn: getNextPage, - wthlr: cur, - } -} - -// WorkflowTriggerHistoryProperties the workflow trigger history properties. -type WorkflowTriggerHistoryProperties struct { - // StartTime - READ-ONLY; Gets the start time. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; Gets the end time. - EndTime *date.Time `json:"endTime,omitempty"` - // ScheduledTime - READ-ONLY; The scheduled time. - ScheduledTime *date.Time `json:"scheduledTime,omitempty"` - // Status - READ-ONLY; Gets the status. Possible values include: 'WorkflowStatusNotSpecified', 'WorkflowStatusPaused', 'WorkflowStatusRunning', 'WorkflowStatusWaiting', 'WorkflowStatusSucceeded', 'WorkflowStatusSkipped', 'WorkflowStatusSuspended', 'WorkflowStatusCancelled', 'WorkflowStatusFailed', 'WorkflowStatusFaulted', 'WorkflowStatusTimedOut', 'WorkflowStatusAborted', 'WorkflowStatusIgnored' - Status WorkflowStatus `json:"status,omitempty"` - // Code - READ-ONLY; Gets the code. - Code *string `json:"code,omitempty"` - // Error - READ-ONLY; Gets the error. - Error interface{} `json:"error,omitempty"` - // TrackingID - READ-ONLY; Gets the tracking id. - TrackingID *string `json:"trackingId,omitempty"` - // Correlation - The run correlation. - Correlation *Correlation `json:"correlation,omitempty"` - // InputsLink - READ-ONLY; Gets the link to input parameters. - InputsLink *ContentLink `json:"inputsLink,omitempty"` - // OutputsLink - READ-ONLY; Gets the link to output parameters. - OutputsLink *ContentLink `json:"outputsLink,omitempty"` - // Fired - READ-ONLY; The value indicating whether trigger was fired. - Fired *bool `json:"fired,omitempty"` - // Run - READ-ONLY; Gets the reference to workflow run. - Run *ResourceReference `json:"run,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkflowTriggerHistoryProperties. -func (wthp WorkflowTriggerHistoryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wthp.Correlation != nil { - objectMap["correlation"] = wthp.Correlation - } - return json.Marshal(objectMap) -} - -// WorkflowTriggerListCallbackURLQueries gets the workflow trigger callback URL query parameters. -type WorkflowTriggerListCallbackURLQueries struct { - // APIVersion - The api version. - APIVersion *string `json:"api-version,omitempty"` - // Sp - The SAS permissions. - Sp *string `json:"sp,omitempty"` - // Sv - The SAS version. - Sv *string `json:"sv,omitempty"` - // Sig - The SAS signature. - Sig *string `json:"sig,omitempty"` - // Se - The SAS timestamp. - Se *string `json:"se,omitempty"` -} - -// WorkflowTriggerListResult the list of workflow triggers. -type WorkflowTriggerListResult struct { - autorest.Response `json:"-"` - // Value - A list of workflow triggers. - Value *[]WorkflowTrigger `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// WorkflowTriggerListResultIterator provides access to a complete listing of WorkflowTrigger values. -type WorkflowTriggerListResultIterator struct { - i int - page WorkflowTriggerListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *WorkflowTriggerListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggerListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *WorkflowTriggerListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkflowTriggerListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter WorkflowTriggerListResultIterator) Response() WorkflowTriggerListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter WorkflowTriggerListResultIterator) Value() WorkflowTrigger { - if !iter.page.NotDone() { - return WorkflowTrigger{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkflowTriggerListResultIterator type. -func NewWorkflowTriggerListResultIterator(page WorkflowTriggerListResultPage) WorkflowTriggerListResultIterator { - return WorkflowTriggerListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wtlr WorkflowTriggerListResult) IsEmpty() bool { - return wtlr.Value == nil || len(*wtlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wtlr WorkflowTriggerListResult) hasNextLink() bool { - return wtlr.NextLink != nil && len(*wtlr.NextLink) != 0 -} - -// workflowTriggerListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wtlr WorkflowTriggerListResult) workflowTriggerListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wtlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wtlr.NextLink))) -} - -// WorkflowTriggerListResultPage contains a page of WorkflowTrigger values. -type WorkflowTriggerListResultPage struct { - fn func(context.Context, WorkflowTriggerListResult) (WorkflowTriggerListResult, error) - wtlr WorkflowTriggerListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *WorkflowTriggerListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggerListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.wtlr) - if err != nil { - return err - } - page.wtlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *WorkflowTriggerListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkflowTriggerListResultPage) NotDone() bool { - return !page.wtlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkflowTriggerListResultPage) Response() WorkflowTriggerListResult { - return page.wtlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkflowTriggerListResultPage) Values() []WorkflowTrigger { - if page.wtlr.IsEmpty() { - return nil - } - return *page.wtlr.Value -} - -// Creates a new instance of the WorkflowTriggerListResultPage type. -func NewWorkflowTriggerListResultPage(cur WorkflowTriggerListResult, getNextPage func(context.Context, WorkflowTriggerListResult) (WorkflowTriggerListResult, error)) WorkflowTriggerListResultPage { - return WorkflowTriggerListResultPage{ - fn: getNextPage, - wtlr: cur, - } -} - -// WorkflowTriggerProperties the workflow trigger properties. -type WorkflowTriggerProperties struct { - // ProvisioningState - READ-ONLY; Gets the provisioning state. Possible values include: 'WorkflowTriggerProvisioningStateNotSpecified', 'WorkflowTriggerProvisioningStateAccepted', 'WorkflowTriggerProvisioningStateRunning', 'WorkflowTriggerProvisioningStateReady', 'WorkflowTriggerProvisioningStateCreating', 'WorkflowTriggerProvisioningStateCreated', 'WorkflowTriggerProvisioningStateDeleting', 'WorkflowTriggerProvisioningStateDeleted', 'WorkflowTriggerProvisioningStateCanceled', 'WorkflowTriggerProvisioningStateFailed', 'WorkflowTriggerProvisioningStateSucceeded', 'WorkflowTriggerProvisioningStateMoving', 'WorkflowTriggerProvisioningStateUpdating', 'WorkflowTriggerProvisioningStateRegistering', 'WorkflowTriggerProvisioningStateRegistered', 'WorkflowTriggerProvisioningStateUnregistering', 'WorkflowTriggerProvisioningStateUnregistered', 'WorkflowTriggerProvisioningStateCompleted' - ProvisioningState WorkflowTriggerProvisioningState `json:"provisioningState,omitempty"` - // CreatedTime - READ-ONLY; Gets the created time. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ChangedTime - READ-ONLY; Gets the changed time. - ChangedTime *date.Time `json:"changedTime,omitempty"` - // State - READ-ONLY; Gets the state. Possible values include: 'WorkflowStateNotSpecified', 'WorkflowStateCompleted', 'WorkflowStateEnabled', 'WorkflowStateDisabled', 'WorkflowStateDeleted', 'WorkflowStateSuspended' - State WorkflowState `json:"state,omitempty"` - // Status - READ-ONLY; Gets the status. Possible values include: 'WorkflowStatusNotSpecified', 'WorkflowStatusPaused', 'WorkflowStatusRunning', 'WorkflowStatusWaiting', 'WorkflowStatusSucceeded', 'WorkflowStatusSkipped', 'WorkflowStatusSuspended', 'WorkflowStatusCancelled', 'WorkflowStatusFailed', 'WorkflowStatusFaulted', 'WorkflowStatusTimedOut', 'WorkflowStatusAborted', 'WorkflowStatusIgnored' - Status WorkflowStatus `json:"status,omitempty"` - // LastExecutionTime - READ-ONLY; Gets the last execution time. - LastExecutionTime *date.Time `json:"lastExecutionTime,omitempty"` - // NextExecutionTime - READ-ONLY; Gets the next execution time. - NextExecutionTime *date.Time `json:"nextExecutionTime,omitempty"` - // Recurrence - READ-ONLY; Gets the workflow trigger recurrence. - Recurrence *WorkflowTriggerRecurrence `json:"recurrence,omitempty"` - // Workflow - READ-ONLY; Gets the reference to workflow. - Workflow *ResourceReference `json:"workflow,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkflowTriggerProperties. -func (wtp WorkflowTriggerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WorkflowTriggerRecurrence the workflow trigger recurrence. -type WorkflowTriggerRecurrence struct { - // Frequency - The frequency. Possible values include: 'RecurrenceFrequencyNotSpecified', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - // Interval - The interval. - Interval *int32 `json:"interval,omitempty"` - // StartTime - The start time. - StartTime *string `json:"startTime,omitempty"` - // EndTime - The end time. - EndTime *string `json:"endTime,omitempty"` - // TimeZone - The time zone. - TimeZone *string `json:"timeZone,omitempty"` - // Schedule - The recurrence schedule. - Schedule *RecurrenceSchedule `json:"schedule,omitempty"` -} - -// WorkflowTriggerReference the workflow trigger reference. -type WorkflowTriggerReference struct { - // FlowName - The workflow name. - FlowName *string `json:"flowName,omitempty"` - // TriggerName - The workflow trigger name. - TriggerName *string `json:"triggerName,omitempty"` - // ID - The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkflowTriggerReference. -func (wtr WorkflowTriggerReference) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wtr.FlowName != nil { - objectMap["flowName"] = wtr.FlowName - } - if wtr.TriggerName != nil { - objectMap["triggerName"] = wtr.TriggerName - } - if wtr.ID != nil { - objectMap["id"] = wtr.ID - } - return json.Marshal(objectMap) -} - -// WorkflowVersion the workflow version. -type WorkflowVersion struct { - autorest.Response `json:"-"` - // WorkflowVersionProperties - The workflow version properties. - *WorkflowVersionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets the resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets the resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for WorkflowVersion. -func (wv WorkflowVersion) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wv.WorkflowVersionProperties != nil { - objectMap["properties"] = wv.WorkflowVersionProperties - } - if wv.Location != nil { - objectMap["location"] = wv.Location - } - if wv.Tags != nil { - objectMap["tags"] = wv.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkflowVersion struct. -func (wv *WorkflowVersion) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var workflowVersionProperties WorkflowVersionProperties - err = json.Unmarshal(*v, &workflowVersionProperties) - if err != nil { - return err - } - wv.WorkflowVersionProperties = &workflowVersionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wv.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wv.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - wv.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wv.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - wv.Tags = tags - } - } - } - - return nil -} - -// WorkflowVersionListResult the list of workflow versions. -type WorkflowVersionListResult struct { - autorest.Response `json:"-"` - // Value - A list of workflow versions. - Value *[]WorkflowVersion `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// WorkflowVersionListResultIterator provides access to a complete listing of WorkflowVersion values. -type WorkflowVersionListResultIterator struct { - i int - page WorkflowVersionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *WorkflowVersionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowVersionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *WorkflowVersionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkflowVersionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter WorkflowVersionListResultIterator) Response() WorkflowVersionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter WorkflowVersionListResultIterator) Value() WorkflowVersion { - if !iter.page.NotDone() { - return WorkflowVersion{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkflowVersionListResultIterator type. -func NewWorkflowVersionListResultIterator(page WorkflowVersionListResultPage) WorkflowVersionListResultIterator { - return WorkflowVersionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wvlr WorkflowVersionListResult) IsEmpty() bool { - return wvlr.Value == nil || len(*wvlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wvlr WorkflowVersionListResult) hasNextLink() bool { - return wvlr.NextLink != nil && len(*wvlr.NextLink) != 0 -} - -// workflowVersionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wvlr WorkflowVersionListResult) workflowVersionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wvlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wvlr.NextLink))) -} - -// WorkflowVersionListResultPage contains a page of WorkflowVersion values. -type WorkflowVersionListResultPage struct { - fn func(context.Context, WorkflowVersionListResult) (WorkflowVersionListResult, error) - wvlr WorkflowVersionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *WorkflowVersionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowVersionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.wvlr) - if err != nil { - return err - } - page.wvlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *WorkflowVersionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkflowVersionListResultPage) NotDone() bool { - return !page.wvlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkflowVersionListResultPage) Response() WorkflowVersionListResult { - return page.wvlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkflowVersionListResultPage) Values() []WorkflowVersion { - if page.wvlr.IsEmpty() { - return nil - } - return *page.wvlr.Value -} - -// Creates a new instance of the WorkflowVersionListResultPage type. -func NewWorkflowVersionListResultPage(cur WorkflowVersionListResult, getNextPage func(context.Context, WorkflowVersionListResult) (WorkflowVersionListResult, error)) WorkflowVersionListResultPage { - return WorkflowVersionListResultPage{ - fn: getNextPage, - wvlr: cur, - } -} - -// WorkflowVersionProperties the workflow version properties. -type WorkflowVersionProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'WorkflowProvisioningStateNotSpecified', 'WorkflowProvisioningStateAccepted', 'WorkflowProvisioningStateRunning', 'WorkflowProvisioningStateReady', 'WorkflowProvisioningStateCreating', 'WorkflowProvisioningStateCreated', 'WorkflowProvisioningStateDeleting', 'WorkflowProvisioningStateDeleted', 'WorkflowProvisioningStateCanceled', 'WorkflowProvisioningStateFailed', 'WorkflowProvisioningStateSucceeded', 'WorkflowProvisioningStateMoving', 'WorkflowProvisioningStateUpdating', 'WorkflowProvisioningStateRegistering', 'WorkflowProvisioningStateRegistered', 'WorkflowProvisioningStateUnregistering', 'WorkflowProvisioningStateUnregistered', 'WorkflowProvisioningStateCompleted', 'WorkflowProvisioningStateRenewing', 'WorkflowProvisioningStatePending', 'WorkflowProvisioningStateWaiting', 'WorkflowProvisioningStateInProgress' - ProvisioningState WorkflowProvisioningState `json:"provisioningState,omitempty"` - // CreatedTime - READ-ONLY; Gets the created time. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ChangedTime - READ-ONLY; Gets the changed time. - ChangedTime *date.Time `json:"changedTime,omitempty"` - // State - The state. Possible values include: 'WorkflowStateNotSpecified', 'WorkflowStateCompleted', 'WorkflowStateEnabled', 'WorkflowStateDisabled', 'WorkflowStateDeleted', 'WorkflowStateSuspended' - State WorkflowState `json:"state,omitempty"` - // Version - READ-ONLY; Gets the version. - Version *string `json:"version,omitempty"` - // AccessEndpoint - READ-ONLY; Gets the access endpoint. - AccessEndpoint *string `json:"accessEndpoint,omitempty"` - // EndpointsConfiguration - The endpoints configuration. - EndpointsConfiguration *FlowEndpointsConfiguration `json:"endpointsConfiguration,omitempty"` - // AccessControl - The access control configuration. - AccessControl *FlowAccessControlConfiguration `json:"accessControl,omitempty"` - // Sku - READ-ONLY; The sku. - Sku *Sku `json:"sku,omitempty"` - // IntegrationAccount - The integration account. - IntegrationAccount *ResourceReference `json:"integrationAccount,omitempty"` - // Definition - The definition. - Definition interface{} `json:"definition,omitempty"` - // Parameters - The parameters. - Parameters map[string]*WorkflowParameter `json:"parameters"` -} - -// MarshalJSON is the custom marshaler for WorkflowVersionProperties. -func (wvp WorkflowVersionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wvp.State != "" { - objectMap["state"] = wvp.State - } - if wvp.EndpointsConfiguration != nil { - objectMap["endpointsConfiguration"] = wvp.EndpointsConfiguration - } - if wvp.AccessControl != nil { - objectMap["accessControl"] = wvp.AccessControl - } - if wvp.IntegrationAccount != nil { - objectMap["integrationAccount"] = wvp.IntegrationAccount - } - if wvp.Definition != nil { - objectMap["definition"] = wvp.Definition - } - if wvp.Parameters != nil { - objectMap["parameters"] = wvp.Parameters - } - return json.Marshal(objectMap) -} - -// WsdlService the WSDL service. -type WsdlService struct { - // QualifiedName - The qualified name. - QualifiedName *string `json:"qualifiedName,omitempty"` - // EndpointQualifiedNames - The list of endpoints' qualified names. - EndpointQualifiedNames *[]string `json:"EndpointQualifiedNames,omitempty"` -} - -// X12AcknowledgementSettings the X12 agreement acknowledgement settings. -type X12AcknowledgementSettings struct { - // NeedTechnicalAcknowledgement - The value indicating whether technical acknowledgement is needed. - NeedTechnicalAcknowledgement *bool `json:"needTechnicalAcknowledgement,omitempty"` - // BatchTechnicalAcknowledgements - The value indicating whether to batch the technical acknowledgements. - BatchTechnicalAcknowledgements *bool `json:"batchTechnicalAcknowledgements,omitempty"` - // NeedFunctionalAcknowledgement - The value indicating whether functional acknowledgement is needed. - NeedFunctionalAcknowledgement *bool `json:"needFunctionalAcknowledgement,omitempty"` - // FunctionalAcknowledgementVersion - The functional acknowledgement version. - FunctionalAcknowledgementVersion *string `json:"functionalAcknowledgementVersion,omitempty"` - // BatchFunctionalAcknowledgements - The value indicating whether to batch functional acknowledgements. - BatchFunctionalAcknowledgements *bool `json:"batchFunctionalAcknowledgements,omitempty"` - // NeedImplementationAcknowledgement - The value indicating whether implementation acknowledgement is needed. - NeedImplementationAcknowledgement *bool `json:"needImplementationAcknowledgement,omitempty"` - // ImplementationAcknowledgementVersion - The implementation acknowledgement version. - ImplementationAcknowledgementVersion *string `json:"implementationAcknowledgementVersion,omitempty"` - // BatchImplementationAcknowledgements - The value indicating whether to batch implementation acknowledgements. - BatchImplementationAcknowledgements *bool `json:"batchImplementationAcknowledgements,omitempty"` - // NeedLoopForValidMessages - The value indicating whether a loop is needed for valid messages. - NeedLoopForValidMessages *bool `json:"needLoopForValidMessages,omitempty"` - // SendSynchronousAcknowledgement - The value indicating whether to send synchronous acknowledgement. - SendSynchronousAcknowledgement *bool `json:"sendSynchronousAcknowledgement,omitempty"` - // AcknowledgementControlNumberPrefix - The acknowledgement control number prefix. - AcknowledgementControlNumberPrefix *string `json:"acknowledgementControlNumberPrefix,omitempty"` - // AcknowledgementControlNumberSuffix - The acknowledgement control number suffix. - AcknowledgementControlNumberSuffix *string `json:"acknowledgementControlNumberSuffix,omitempty"` - // AcknowledgementControlNumberLowerBound - The acknowledgement control number lower bound. - AcknowledgementControlNumberLowerBound *int32 `json:"acknowledgementControlNumberLowerBound,omitempty"` - // AcknowledgementControlNumberUpperBound - The acknowledgement control number upper bound. - AcknowledgementControlNumberUpperBound *int32 `json:"acknowledgementControlNumberUpperBound,omitempty"` - // RolloverAcknowledgementControlNumber - The value indicating whether to rollover acknowledgement control number. - RolloverAcknowledgementControlNumber *bool `json:"rolloverAcknowledgementControlNumber,omitempty"` -} - -// X12AgreementContent the X12 agreement content. -type X12AgreementContent struct { - // ReceiveAgreement - The X12 one-way receive agreement. - ReceiveAgreement *X12OneWayAgreement `json:"receiveAgreement,omitempty"` - // SendAgreement - The X12 one-way send agreement. - SendAgreement *X12OneWayAgreement `json:"sendAgreement,omitempty"` -} - -// X12DelimiterOverrides the X12 delimiter override settings. -type X12DelimiterOverrides struct { - // ProtocolVersion - The protocol version. - ProtocolVersion *string `json:"protocolVersion,omitempty"` - // MessageID - The message id. - MessageID *string `json:"messageId,omitempty"` - // DataElementSeparator - The data element separator. - DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` - // ComponentSeparator - The component separator. - ComponentSeparator *int32 `json:"componentSeparator,omitempty"` - // SegmentTerminator - The segment terminator. - SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` - // SegmentTerminatorSuffix - The segment terminator suffix. Possible values include: 'SegmentTerminatorSuffixNotSpecified', 'SegmentTerminatorSuffixNone', 'SegmentTerminatorSuffixCR', 'SegmentTerminatorSuffixLF', 'SegmentTerminatorSuffixCRLF' - SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` - // ReplaceCharacter - The replacement character. - ReplaceCharacter *int32 `json:"replaceCharacter,omitempty"` - // ReplaceSeparatorsInPayload - The value indicating whether to replace separators in payload. - ReplaceSeparatorsInPayload *bool `json:"replaceSeparatorsInPayload,omitempty"` - // TargetNamespace - The target namespace on which this delimiter settings has to be applied. - TargetNamespace *string `json:"targetNamespace,omitempty"` -} - -// X12EnvelopeOverride the X12 envelope override settings. -type X12EnvelopeOverride struct { - // TargetNamespace - The target namespace on which this envelope settings has to be applied. - TargetNamespace *string `json:"targetNamespace,omitempty"` - // ProtocolVersion - The protocol version on which this envelope settings has to be applied. - ProtocolVersion *string `json:"protocolVersion,omitempty"` - // MessageID - The message id on which this envelope settings has to be applied. - MessageID *string `json:"messageId,omitempty"` - // ResponsibleAgencyCode - The responsible agency code. - ResponsibleAgencyCode *string `json:"responsibleAgencyCode,omitempty"` - // HeaderVersion - The header version. - HeaderVersion *string `json:"headerVersion,omitempty"` - // SenderApplicationID - The sender application id. - SenderApplicationID *string `json:"senderApplicationId,omitempty"` - // ReceiverApplicationID - The receiver application id. - ReceiverApplicationID *string `json:"receiverApplicationId,omitempty"` - // FunctionalIdentifierCode - The functional identifier code. - FunctionalIdentifierCode *string `json:"functionalIdentifierCode,omitempty"` - // DateFormat - The date format. Possible values include: 'X12DateFormatNotSpecified', 'X12DateFormatCCYYMMDD', 'X12DateFormatYYMMDD' - DateFormat X12DateFormat `json:"dateFormat,omitempty"` - // TimeFormat - The time format. Possible values include: 'X12TimeFormatNotSpecified', 'X12TimeFormatHHMM', 'X12TimeFormatHHMMSS', 'X12TimeFormatHHMMSSdd', 'X12TimeFormatHHMMSSd' - TimeFormat X12TimeFormat `json:"timeFormat,omitempty"` -} - -// X12EnvelopeSettings the X12 agreement envelope settings. -type X12EnvelopeSettings struct { - // ControlStandardsID - The controls standards id. - ControlStandardsID *int32 `json:"controlStandardsId,omitempty"` - // UseControlStandardsIDAsRepetitionCharacter - The value indicating whether to use control standards id as repetition character. - UseControlStandardsIDAsRepetitionCharacter *bool `json:"useControlStandardsIdAsRepetitionCharacter,omitempty"` - // SenderApplicationID - The sender application id. - SenderApplicationID *string `json:"senderApplicationId,omitempty"` - // ReceiverApplicationID - The receiver application id. - ReceiverApplicationID *string `json:"receiverApplicationId,omitempty"` - // ControlVersionNumber - The control version number. - ControlVersionNumber *string `json:"controlVersionNumber,omitempty"` - // InterchangeControlNumberLowerBound - The interchange control number lower bound. - InterchangeControlNumberLowerBound *int32 `json:"interchangeControlNumberLowerBound,omitempty"` - // InterchangeControlNumberUpperBound - The interchange control number upper bound. - InterchangeControlNumberUpperBound *int32 `json:"interchangeControlNumberUpperBound,omitempty"` - // RolloverInterchangeControlNumber - The value indicating whether to rollover interchange control number. - RolloverInterchangeControlNumber *bool `json:"rolloverInterchangeControlNumber,omitempty"` - // EnableDefaultGroupHeaders - The value indicating whether to enable default group headers. - EnableDefaultGroupHeaders *bool `json:"enableDefaultGroupHeaders,omitempty"` - // FunctionalGroupID - The functional group id. - FunctionalGroupID *string `json:"functionalGroupId,omitempty"` - // GroupControlNumberLowerBound - The group control number lower bound. - GroupControlNumberLowerBound *int32 `json:"groupControlNumberLowerBound,omitempty"` - // GroupControlNumberUpperBound - The group control number upper bound. - GroupControlNumberUpperBound *int32 `json:"groupControlNumberUpperBound,omitempty"` - // RolloverGroupControlNumber - The value indicating whether to rollover group control number. - RolloverGroupControlNumber *bool `json:"rolloverGroupControlNumber,omitempty"` - // GroupHeaderAgencyCode - The group header agency code. - GroupHeaderAgencyCode *string `json:"groupHeaderAgencyCode,omitempty"` - // GroupHeaderVersion - The group header version. - GroupHeaderVersion *string `json:"groupHeaderVersion,omitempty"` - // TransactionSetControlNumberLowerBound - The transaction set control number lower bound. - TransactionSetControlNumberLowerBound *int32 `json:"transactionSetControlNumberLowerBound,omitempty"` - // TransactionSetControlNumberUpperBound - The transaction set control number upper bound. - TransactionSetControlNumberUpperBound *int32 `json:"transactionSetControlNumberUpperBound,omitempty"` - // RolloverTransactionSetControlNumber - The value indicating whether to rollover transaction set control number. - RolloverTransactionSetControlNumber *bool `json:"rolloverTransactionSetControlNumber,omitempty"` - // TransactionSetControlNumberPrefix - The transaction set control number prefix. - TransactionSetControlNumberPrefix *string `json:"transactionSetControlNumberPrefix,omitempty"` - // TransactionSetControlNumberSuffix - The transaction set control number suffix. - TransactionSetControlNumberSuffix *string `json:"transactionSetControlNumberSuffix,omitempty"` - // OverwriteExistingTransactionSetControlNumber - The value indicating whether to overwrite existing transaction set control number. - OverwriteExistingTransactionSetControlNumber *bool `json:"overwriteExistingTransactionSetControlNumber,omitempty"` - // GroupHeaderDateFormat - The group header date format. Possible values include: 'X12DateFormatNotSpecified', 'X12DateFormatCCYYMMDD', 'X12DateFormatYYMMDD' - GroupHeaderDateFormat X12DateFormat `json:"groupHeaderDateFormat,omitempty"` - // GroupHeaderTimeFormat - The group header time format. Possible values include: 'X12TimeFormatNotSpecified', 'X12TimeFormatHHMM', 'X12TimeFormatHHMMSS', 'X12TimeFormatHHMMSSdd', 'X12TimeFormatHHMMSSd' - GroupHeaderTimeFormat X12TimeFormat `json:"groupHeaderTimeFormat,omitempty"` - // UsageIndicator - The usage indicator. Possible values include: 'UsageIndicatorNotSpecified', 'UsageIndicatorTest', 'UsageIndicatorInformation', 'UsageIndicatorProduction' - UsageIndicator UsageIndicator `json:"usageIndicator,omitempty"` -} - -// X12FramingSettings the X12 agreement framing settings. -type X12FramingSettings struct { - // DataElementSeparator - The data element separator. - DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` - // ComponentSeparator - The component separator. - ComponentSeparator *int32 `json:"componentSeparator,omitempty"` - // ReplaceSeparatorsInPayload - The value indicating whether to replace separators in payload. - ReplaceSeparatorsInPayload *bool `json:"replaceSeparatorsInPayload,omitempty"` - // ReplaceCharacter - The replacement character. - ReplaceCharacter *int32 `json:"replaceCharacter,omitempty"` - // SegmentTerminator - The segment terminator. - SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` - // CharacterSet - The X12 character set. Possible values include: 'X12CharacterSetNotSpecified', 'X12CharacterSetBasic', 'X12CharacterSetExtended', 'X12CharacterSetUTF8' - CharacterSet X12CharacterSet `json:"characterSet,omitempty"` - // SegmentTerminatorSuffix - The segment terminator suffix. Possible values include: 'SegmentTerminatorSuffixNotSpecified', 'SegmentTerminatorSuffixNone', 'SegmentTerminatorSuffixCR', 'SegmentTerminatorSuffixLF', 'SegmentTerminatorSuffixCRLF' - SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` -} - -// X12MessageFilter the X12 message filter for odata query. -type X12MessageFilter struct { - // MessageFilterType - The message filter type. Possible values include: 'MessageFilterTypeNotSpecified', 'MessageFilterTypeInclude', 'MessageFilterTypeExclude' - MessageFilterType MessageFilterType `json:"messageFilterType,omitempty"` -} - -// X12MessageIdentifier the X12 message identifier. -type X12MessageIdentifier struct { - // MessageID - The message id. - MessageID *string `json:"messageId,omitempty"` -} - -// X12OneWayAgreement the X12 one-way agreement. -type X12OneWayAgreement struct { - // SenderBusinessIdentity - The sender business identity - SenderBusinessIdentity *BusinessIdentity `json:"senderBusinessIdentity,omitempty"` - // ReceiverBusinessIdentity - The receiver business identity - ReceiverBusinessIdentity *BusinessIdentity `json:"receiverBusinessIdentity,omitempty"` - // ProtocolSettings - The X12 protocol settings. - ProtocolSettings *X12ProtocolSettings `json:"protocolSettings,omitempty"` -} - -// X12ProcessingSettings the X12 processing settings. -type X12ProcessingSettings struct { - // MaskSecurityInfo - The value indicating whether to mask security information. - MaskSecurityInfo *bool `json:"maskSecurityInfo,omitempty"` - // ConvertImpliedDecimal - The value indicating whether to convert numerical type to implied decimal. - ConvertImpliedDecimal *bool `json:"convertImpliedDecimal,omitempty"` - // PreserveInterchange - The value indicating whether to preserve interchange. - PreserveInterchange *bool `json:"preserveInterchange,omitempty"` - // SuspendInterchangeOnError - The value indicating whether to suspend interchange on error. - SuspendInterchangeOnError *bool `json:"suspendInterchangeOnError,omitempty"` - // CreateEmptyXMLTagsForTrailingSeparators - The value indicating whether to create empty xml tags for trailing separators. - CreateEmptyXMLTagsForTrailingSeparators *bool `json:"createEmptyXmlTagsForTrailingSeparators,omitempty"` - // UseDotAsDecimalSeparator - The value indicating whether to use dot as decimal separator. - UseDotAsDecimalSeparator *bool `json:"useDotAsDecimalSeparator,omitempty"` -} - -// X12ProtocolSettings the X12 agreement protocol settings. -type X12ProtocolSettings struct { - // ValidationSettings - The X12 validation settings. - ValidationSettings *X12ValidationSettings `json:"validationSettings,omitempty"` - // FramingSettings - The X12 framing settings. - FramingSettings *X12FramingSettings `json:"framingSettings,omitempty"` - // EnvelopeSettings - The X12 envelope settings. - EnvelopeSettings *X12EnvelopeSettings `json:"envelopeSettings,omitempty"` - // AcknowledgementSettings - The X12 acknowledgment settings. - AcknowledgementSettings *X12AcknowledgementSettings `json:"acknowledgementSettings,omitempty"` - // MessageFilter - The X12 message filter. - MessageFilter *X12MessageFilter `json:"messageFilter,omitempty"` - // SecuritySettings - The X12 security settings. - SecuritySettings *X12SecuritySettings `json:"securitySettings,omitempty"` - // ProcessingSettings - The X12 processing settings. - ProcessingSettings *X12ProcessingSettings `json:"processingSettings,omitempty"` - // EnvelopeOverrides - The X12 envelope override settings. - EnvelopeOverrides *[]X12EnvelopeOverride `json:"envelopeOverrides,omitempty"` - // ValidationOverrides - The X12 validation override settings. - ValidationOverrides *[]X12ValidationOverride `json:"validationOverrides,omitempty"` - // MessageFilterList - The X12 message filter list. - MessageFilterList *[]X12MessageIdentifier `json:"messageFilterList,omitempty"` - // SchemaReferences - The X12 schema references. - SchemaReferences *[]X12SchemaReference `json:"schemaReferences,omitempty"` - // X12DelimiterOverrides - The X12 delimiter override settings. - X12DelimiterOverrides *[]X12DelimiterOverrides `json:"x12DelimiterOverrides,omitempty"` -} - -// X12SchemaReference the X12 schema reference. -type X12SchemaReference struct { - // MessageID - The message id. - MessageID *string `json:"messageId,omitempty"` - // SenderApplicationID - The sender application id. - SenderApplicationID *string `json:"senderApplicationId,omitempty"` - // SchemaVersion - The schema version. - SchemaVersion *string `json:"schemaVersion,omitempty"` - // SchemaName - The schema name. - SchemaName *string `json:"schemaName,omitempty"` -} - -// X12SecuritySettings the X12 agreement security settings. -type X12SecuritySettings struct { - // AuthorizationQualifier - The authorization qualifier. - AuthorizationQualifier *string `json:"authorizationQualifier,omitempty"` - // AuthorizationValue - The authorization value. - AuthorizationValue *string `json:"authorizationValue,omitempty"` - // SecurityQualifier - The security qualifier. - SecurityQualifier *string `json:"securityQualifier,omitempty"` - // PasswordValue - The password value. - PasswordValue *string `json:"passwordValue,omitempty"` -} - -// X12ValidationOverride the X12 validation override settings. -type X12ValidationOverride struct { - // MessageID - The message id on which the validation settings has to be applied. - MessageID *string `json:"messageId,omitempty"` - // ValidateEDITypes - The value indicating whether to validate EDI types. - ValidateEDITypes *bool `json:"validateEDITypes,omitempty"` - // ValidateXSDTypes - The value indicating whether to validate XSD types. - ValidateXSDTypes *bool `json:"validateXSDTypes,omitempty"` - // AllowLeadingAndTrailingSpacesAndZeroes - The value indicating whether to allow leading and trailing spaces and zeroes. - AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` - // ValidateCharacterSet - The value indicating whether to validate character Set. - ValidateCharacterSet *bool `json:"validateCharacterSet,omitempty"` - // TrimLeadingAndTrailingSpacesAndZeroes - The value indicating whether to trim leading and trailing spaces and zeroes. - TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` - // TrailingSeparatorPolicy - The trailing separator policy. Possible values include: 'TrailingSeparatorPolicyNotSpecified', 'TrailingSeparatorPolicyNotAllowed', 'TrailingSeparatorPolicyOptional', 'TrailingSeparatorPolicyMandatory' - TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` -} - -// X12ValidationSettings the X12 agreement validation settings. -type X12ValidationSettings struct { - // ValidateCharacterSet - The value indicating whether to validate character set in the message. - ValidateCharacterSet *bool `json:"validateCharacterSet,omitempty"` - // CheckDuplicateInterchangeControlNumber - The value indicating whether to check for duplicate interchange control number. - CheckDuplicateInterchangeControlNumber *bool `json:"checkDuplicateInterchangeControlNumber,omitempty"` - // InterchangeControlNumberValidityDays - The validity period of interchange control number. - InterchangeControlNumberValidityDays *int32 `json:"interchangeControlNumberValidityDays,omitempty"` - // CheckDuplicateGroupControlNumber - The value indicating whether to check for duplicate group control number. - CheckDuplicateGroupControlNumber *bool `json:"checkDuplicateGroupControlNumber,omitempty"` - // CheckDuplicateTransactionSetControlNumber - The value indicating whether to check for duplicate transaction set control number. - CheckDuplicateTransactionSetControlNumber *bool `json:"checkDuplicateTransactionSetControlNumber,omitempty"` - // ValidateEDITypes - The value indicating whether to Whether to validate EDI types. - ValidateEDITypes *bool `json:"validateEDITypes,omitempty"` - // ValidateXSDTypes - The value indicating whether to Whether to validate XSD types. - ValidateXSDTypes *bool `json:"validateXSDTypes,omitempty"` - // AllowLeadingAndTrailingSpacesAndZeroes - The value indicating whether to allow leading and trailing spaces and zeroes. - AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` - // TrimLeadingAndTrailingSpacesAndZeroes - The value indicating whether to trim leading and trailing spaces and zeroes. - TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` - // TrailingSeparatorPolicy - The trailing separator policy. Possible values include: 'TrailingSeparatorPolicyNotSpecified', 'TrailingSeparatorPolicyNotAllowed', 'TrailingSeparatorPolicyOptional', 'TrailingSeparatorPolicyMandatory' - TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/operations.go deleted file mode 100644 index 88a6203eaae2..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the REST API for Azure Logic Apps. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available Logic REST API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Logic/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/version.go deleted file mode 100644 index 028b6457d494..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package logic - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " logic/2019-05-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunactionrepetitions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunactionrepetitions.go deleted file mode 100644 index 68d91e5255ab..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunactionrepetitions.go +++ /dev/null @@ -1,276 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WorkflowRunActionRepetitionsClient is the REST API for Azure Logic Apps. -type WorkflowRunActionRepetitionsClient struct { - BaseClient -} - -// NewWorkflowRunActionRepetitionsClient creates an instance of the WorkflowRunActionRepetitionsClient client. -func NewWorkflowRunActionRepetitionsClient(subscriptionID string) WorkflowRunActionRepetitionsClient { - return NewWorkflowRunActionRepetitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowRunActionRepetitionsClientWithBaseURI creates an instance of the WorkflowRunActionRepetitionsClient -// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI -// (sovereign clouds, Azure stack). -func NewWorkflowRunActionRepetitionsClientWithBaseURI(baseURI string, subscriptionID string) WorkflowRunActionRepetitionsClient { - return WorkflowRunActionRepetitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get a workflow run action repetition. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// runName - the workflow run name. -// actionName - the workflow action name. -// repetitionName - the workflow repetition. -func (client WorkflowRunActionRepetitionsClient) Get(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string, repetitionName string) (result WorkflowRunActionRepetitionDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionRepetitionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, workflowName, runName, actionName, repetitionName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowRunActionRepetitionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string, repetitionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionName": autorest.Encode("path", actionName), - "repetitionName": autorest.Encode("path", repetitionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/repetitions/{repetitionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunActionRepetitionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowRunActionRepetitionsClient) GetResponder(resp *http.Response) (result WorkflowRunActionRepetitionDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all of a workflow run action repetitions. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// runName - the workflow run name. -// actionName - the workflow action name. -func (client WorkflowRunActionRepetitionsClient) List(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string) (result WorkflowRunActionRepetitionDefinitionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionRepetitionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, workflowName, runName, actionName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkflowRunActionRepetitionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionName": autorest.Encode("path", actionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/repetitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunActionRepetitionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkflowRunActionRepetitionsClient) ListResponder(resp *http.Response) (result WorkflowRunActionRepetitionDefinitionCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListExpressionTraces lists a workflow run expression trace. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// runName - the workflow run name. -// actionName - the workflow action name. -// repetitionName - the workflow repetition. -func (client WorkflowRunActionRepetitionsClient) ListExpressionTraces(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string, repetitionName string) (result ExpressionTraces, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionRepetitionsClient.ListExpressionTraces") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListExpressionTracesPreparer(ctx, resourceGroupName, workflowName, runName, actionName, repetitionName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsClient", "ListExpressionTraces", nil, "Failure preparing request") - return - } - - resp, err := client.ListExpressionTracesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsClient", "ListExpressionTraces", resp, "Failure sending request") - return - } - - result, err = client.ListExpressionTracesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsClient", "ListExpressionTraces", resp, "Failure responding to request") - return - } - - return -} - -// ListExpressionTracesPreparer prepares the ListExpressionTraces request. -func (client WorkflowRunActionRepetitionsClient) ListExpressionTracesPreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string, repetitionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionName": autorest.Encode("path", actionName), - "repetitionName": autorest.Encode("path", repetitionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/repetitions/{repetitionName}/listExpressionTraces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListExpressionTracesSender sends the ListExpressionTraces request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunActionRepetitionsClient) ListExpressionTracesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListExpressionTracesResponder handles the response to the ListExpressionTraces request. The method always -// closes the http.Response Body. -func (client WorkflowRunActionRepetitionsClient) ListExpressionTracesResponder(resp *http.Response) (result ExpressionTraces, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunactionrepetitionsrequesthistories.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunactionrepetitionsrequesthistories.go deleted file mode 100644 index abadb2687575..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunactionrepetitionsrequesthistories.go +++ /dev/null @@ -1,241 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WorkflowRunActionRepetitionsRequestHistoriesClient is the REST API for Azure Logic Apps. -type WorkflowRunActionRepetitionsRequestHistoriesClient struct { - BaseClient -} - -// NewWorkflowRunActionRepetitionsRequestHistoriesClient creates an instance of the -// WorkflowRunActionRepetitionsRequestHistoriesClient client. -func NewWorkflowRunActionRepetitionsRequestHistoriesClient(subscriptionID string) WorkflowRunActionRepetitionsRequestHistoriesClient { - return NewWorkflowRunActionRepetitionsRequestHistoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowRunActionRepetitionsRequestHistoriesClientWithBaseURI creates an instance of the -// WorkflowRunActionRepetitionsRequestHistoriesClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWorkflowRunActionRepetitionsRequestHistoriesClientWithBaseURI(baseURI string, subscriptionID string) WorkflowRunActionRepetitionsRequestHistoriesClient { - return WorkflowRunActionRepetitionsRequestHistoriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a workflow run repetition request history. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// runName - the workflow run name. -// actionName - the workflow action name. -// repetitionName - the workflow repetition. -// requestHistoryName - the request history name. -func (client WorkflowRunActionRepetitionsRequestHistoriesClient) Get(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string, repetitionName string, requestHistoryName string) (result RequestHistory, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionRepetitionsRequestHistoriesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, workflowName, runName, actionName, repetitionName, requestHistoryName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsRequestHistoriesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsRequestHistoriesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsRequestHistoriesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowRunActionRepetitionsRequestHistoriesClient) GetPreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string, repetitionName string, requestHistoryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionName": autorest.Encode("path", actionName), - "repetitionName": autorest.Encode("path", repetitionName), - "requestHistoryName": autorest.Encode("path", requestHistoryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/repetitions/{repetitionName}/requestHistories/{requestHistoryName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunActionRepetitionsRequestHistoriesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowRunActionRepetitionsRequestHistoriesClient) GetResponder(resp *http.Response) (result RequestHistory, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list a workflow run repetition request history. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// runName - the workflow run name. -// actionName - the workflow action name. -// repetitionName - the workflow repetition. -func (client WorkflowRunActionRepetitionsRequestHistoriesClient) List(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string, repetitionName string) (result RequestHistoryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionRepetitionsRequestHistoriesClient.List") - defer func() { - sc := -1 - if result.rhlr.Response.Response != nil { - sc = result.rhlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workflowName, runName, actionName, repetitionName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsRequestHistoriesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rhlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsRequestHistoriesClient", "List", resp, "Failure sending request") - return - } - - result.rhlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsRequestHistoriesClient", "List", resp, "Failure responding to request") - return - } - if result.rhlr.hasNextLink() && result.rhlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkflowRunActionRepetitionsRequestHistoriesClient) ListPreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string, repetitionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionName": autorest.Encode("path", actionName), - "repetitionName": autorest.Encode("path", repetitionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/repetitions/{repetitionName}/requestHistories", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunActionRepetitionsRequestHistoriesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkflowRunActionRepetitionsRequestHistoriesClient) ListResponder(resp *http.Response) (result RequestHistoryListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client WorkflowRunActionRepetitionsRequestHistoriesClient) listNextResults(ctx context.Context, lastResults RequestHistoryListResult) (result RequestHistoryListResult, err error) { - req, err := lastResults.requestHistoryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsRequestHistoriesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsRequestHistoriesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRepetitionsRequestHistoriesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkflowRunActionRepetitionsRequestHistoriesClient) ListComplete(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string, repetitionName string) (result RequestHistoryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionRepetitionsRequestHistoriesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, workflowName, runName, actionName, repetitionName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunactionrequesthistories.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunactionrequesthistories.go deleted file mode 100644 index d6b8d1f5e714..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunactionrequesthistories.go +++ /dev/null @@ -1,237 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WorkflowRunActionRequestHistoriesClient is the REST API for Azure Logic Apps. -type WorkflowRunActionRequestHistoriesClient struct { - BaseClient -} - -// NewWorkflowRunActionRequestHistoriesClient creates an instance of the WorkflowRunActionRequestHistoriesClient -// client. -func NewWorkflowRunActionRequestHistoriesClient(subscriptionID string) WorkflowRunActionRequestHistoriesClient { - return NewWorkflowRunActionRequestHistoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowRunActionRequestHistoriesClientWithBaseURI creates an instance of the -// WorkflowRunActionRequestHistoriesClient client using a custom endpoint. Use this when interacting with an Azure -// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWorkflowRunActionRequestHistoriesClientWithBaseURI(baseURI string, subscriptionID string) WorkflowRunActionRequestHistoriesClient { - return WorkflowRunActionRequestHistoriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a workflow run request history. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// runName - the workflow run name. -// actionName - the workflow action name. -// requestHistoryName - the request history name. -func (client WorkflowRunActionRequestHistoriesClient) Get(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string, requestHistoryName string) (result RequestHistory, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionRequestHistoriesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, workflowName, runName, actionName, requestHistoryName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRequestHistoriesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRequestHistoriesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRequestHistoriesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowRunActionRequestHistoriesClient) GetPreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string, requestHistoryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionName": autorest.Encode("path", actionName), - "requestHistoryName": autorest.Encode("path", requestHistoryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/requestHistories/{requestHistoryName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunActionRequestHistoriesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowRunActionRequestHistoriesClient) GetResponder(resp *http.Response) (result RequestHistory, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list a workflow run request history. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// runName - the workflow run name. -// actionName - the workflow action name. -func (client WorkflowRunActionRequestHistoriesClient) List(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string) (result RequestHistoryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionRequestHistoriesClient.List") - defer func() { - sc := -1 - if result.rhlr.Response.Response != nil { - sc = result.rhlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workflowName, runName, actionName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRequestHistoriesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rhlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRequestHistoriesClient", "List", resp, "Failure sending request") - return - } - - result.rhlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRequestHistoriesClient", "List", resp, "Failure responding to request") - return - } - if result.rhlr.hasNextLink() && result.rhlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkflowRunActionRequestHistoriesClient) ListPreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionName": autorest.Encode("path", actionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/requestHistories", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunActionRequestHistoriesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkflowRunActionRequestHistoriesClient) ListResponder(resp *http.Response) (result RequestHistoryListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client WorkflowRunActionRequestHistoriesClient) listNextResults(ctx context.Context, lastResults RequestHistoryListResult) (result RequestHistoryListResult, err error) { - req, err := lastResults.requestHistoryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowRunActionRequestHistoriesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowRunActionRequestHistoriesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionRequestHistoriesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkflowRunActionRequestHistoriesClient) ListComplete(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string) (result RequestHistoryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionRequestHistoriesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, workflowName, runName, actionName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunactions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunactions.go deleted file mode 100644 index f6811c6ddb4f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunactions.go +++ /dev/null @@ -1,320 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WorkflowRunActionsClient is the REST API for Azure Logic Apps. -type WorkflowRunActionsClient struct { - BaseClient -} - -// NewWorkflowRunActionsClient creates an instance of the WorkflowRunActionsClient client. -func NewWorkflowRunActionsClient(subscriptionID string) WorkflowRunActionsClient { - return NewWorkflowRunActionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowRunActionsClientWithBaseURI creates an instance of the WorkflowRunActionsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewWorkflowRunActionsClientWithBaseURI(baseURI string, subscriptionID string) WorkflowRunActionsClient { - return WorkflowRunActionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a workflow run action. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// runName - the workflow run name. -// actionName - the workflow action name. -func (client WorkflowRunActionsClient) Get(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string) (result WorkflowRunAction, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, workflowName, runName, actionName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowRunActionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionName": autorest.Encode("path", actionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunActionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowRunActionsClient) GetResponder(resp *http.Response) (result WorkflowRunAction, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of workflow run actions. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// runName - the workflow run name. -// top - the number of items to be included in the result. -// filter - the filter to apply on the operation. Options for filters include: Status. -func (client WorkflowRunActionsClient) List(ctx context.Context, resourceGroupName string, workflowName string, runName string, top *int32, filter string) (result WorkflowRunActionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionsClient.List") - defer func() { - sc := -1 - if result.wralr.Response.Response != nil { - sc = result.wralr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workflowName, runName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wralr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "List", resp, "Failure sending request") - return - } - - result.wralr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "List", resp, "Failure responding to request") - return - } - if result.wralr.hasNextLink() && result.wralr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkflowRunActionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunActionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkflowRunActionsClient) ListResponder(resp *http.Response) (result WorkflowRunActionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client WorkflowRunActionsClient) listNextResults(ctx context.Context, lastResults WorkflowRunActionListResult) (result WorkflowRunActionListResult, err error) { - req, err := lastResults.workflowRunActionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkflowRunActionsClient) ListComplete(ctx context.Context, resourceGroupName string, workflowName string, runName string, top *int32, filter string) (result WorkflowRunActionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, workflowName, runName, top, filter) - return -} - -// ListExpressionTraces lists a workflow run expression trace. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// runName - the workflow run name. -// actionName - the workflow action name. -func (client WorkflowRunActionsClient) ListExpressionTraces(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string) (result ExpressionTraces, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionsClient.ListExpressionTraces") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListExpressionTracesPreparer(ctx, resourceGroupName, workflowName, runName, actionName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "ListExpressionTraces", nil, "Failure preparing request") - return - } - - resp, err := client.ListExpressionTracesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "ListExpressionTraces", resp, "Failure sending request") - return - } - - result, err = client.ListExpressionTracesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "ListExpressionTraces", resp, "Failure responding to request") - return - } - - return -} - -// ListExpressionTracesPreparer prepares the ListExpressionTraces request. -func (client WorkflowRunActionsClient) ListExpressionTracesPreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionName": autorest.Encode("path", actionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/listExpressionTraces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListExpressionTracesSender sends the ListExpressionTraces request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunActionsClient) ListExpressionTracesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListExpressionTracesResponder handles the response to the ListExpressionTraces request. The method always -// closes the http.Response Body. -func (client WorkflowRunActionsClient) ListExpressionTracesResponder(resp *http.Response) (result ExpressionTraces, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunactionscoperepetitions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunactionscoperepetitions.go deleted file mode 100644 index f81037738f9e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunactionscoperepetitions.go +++ /dev/null @@ -1,195 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WorkflowRunActionScopeRepetitionsClient is the REST API for Azure Logic Apps. -type WorkflowRunActionScopeRepetitionsClient struct { - BaseClient -} - -// NewWorkflowRunActionScopeRepetitionsClient creates an instance of the WorkflowRunActionScopeRepetitionsClient -// client. -func NewWorkflowRunActionScopeRepetitionsClient(subscriptionID string) WorkflowRunActionScopeRepetitionsClient { - return NewWorkflowRunActionScopeRepetitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowRunActionScopeRepetitionsClientWithBaseURI creates an instance of the -// WorkflowRunActionScopeRepetitionsClient client using a custom endpoint. Use this when interacting with an Azure -// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWorkflowRunActionScopeRepetitionsClientWithBaseURI(baseURI string, subscriptionID string) WorkflowRunActionScopeRepetitionsClient { - return WorkflowRunActionScopeRepetitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get a workflow run action scoped repetition. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// runName - the workflow run name. -// actionName - the workflow action name. -// repetitionName - the workflow repetition. -func (client WorkflowRunActionScopeRepetitionsClient) Get(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string, repetitionName string) (result WorkflowRunActionRepetitionDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionScopeRepetitionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, workflowName, runName, actionName, repetitionName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionScopeRepetitionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionScopeRepetitionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionScopeRepetitionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowRunActionScopeRepetitionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string, repetitionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionName": autorest.Encode("path", actionName), - "repetitionName": autorest.Encode("path", repetitionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/scopeRepetitions/{repetitionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunActionScopeRepetitionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowRunActionScopeRepetitionsClient) GetResponder(resp *http.Response) (result WorkflowRunActionRepetitionDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list the workflow run action scoped repetitions. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// runName - the workflow run name. -// actionName - the workflow action name. -func (client WorkflowRunActionScopeRepetitionsClient) List(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string) (result WorkflowRunActionRepetitionDefinitionCollection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunActionScopeRepetitionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, workflowName, runName, actionName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionScopeRepetitionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionScopeRepetitionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionScopeRepetitionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkflowRunActionScopeRepetitionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string, actionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionName": autorest.Encode("path", actionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/scopeRepetitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunActionScopeRepetitionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkflowRunActionScopeRepetitionsClient) ListResponder(resp *http.Response) (result WorkflowRunActionRepetitionDefinitionCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunoperations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunoperations.go deleted file mode 100644 index 48bb9bc8a8c9..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowrunoperations.go +++ /dev/null @@ -1,112 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WorkflowRunOperationsClient is the REST API for Azure Logic Apps. -type WorkflowRunOperationsClient struct { - BaseClient -} - -// NewWorkflowRunOperationsClient creates an instance of the WorkflowRunOperationsClient client. -func NewWorkflowRunOperationsClient(subscriptionID string) WorkflowRunOperationsClient { - return NewWorkflowRunOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowRunOperationsClientWithBaseURI creates an instance of the WorkflowRunOperationsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewWorkflowRunOperationsClientWithBaseURI(baseURI string, subscriptionID string) WorkflowRunOperationsClient { - return WorkflowRunOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets an operation for a run. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// runName - the workflow run name. -// operationID - the workflow operation id. -func (client WorkflowRunOperationsClient) Get(ctx context.Context, resourceGroupName string, workflowName string, runName string, operationID string) (result WorkflowRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunOperationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, workflowName, runName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunOperationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunOperationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunOperationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowRunOperationsClient) GetPreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunOperationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowRunOperationsClient) GetResponder(resp *http.Response) (result WorkflowRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowruns.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowruns.go deleted file mode 100644 index 8fcf3dfc49c0..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowruns.go +++ /dev/null @@ -1,313 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WorkflowRunsClient is the REST API for Azure Logic Apps. -type WorkflowRunsClient struct { - BaseClient -} - -// NewWorkflowRunsClient creates an instance of the WorkflowRunsClient client. -func NewWorkflowRunsClient(subscriptionID string) WorkflowRunsClient { - return NewWorkflowRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowRunsClientWithBaseURI creates an instance of the WorkflowRunsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWorkflowRunsClientWithBaseURI(baseURI string, subscriptionID string) WorkflowRunsClient { - return WorkflowRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Cancel cancels a workflow run. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// runName - the workflow run name. -func (client WorkflowRunsClient) Cancel(ctx context.Context, resourceGroupName string, workflowName string, runName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunsClient.Cancel") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelPreparer(ctx, resourceGroupName, workflowName, runName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Cancel", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Cancel", resp, "Failure sending request") - return - } - - result, err = client.CancelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Cancel", resp, "Failure responding to request") - return - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client WorkflowRunsClient) CancelPreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunsClient) CancelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client WorkflowRunsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a workflow run. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// runName - the workflow run name. -func (client WorkflowRunsClient) Get(ctx context.Context, resourceGroupName string, workflowName string, runName string) (result WorkflowRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, workflowName, runName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowRunsClient) GetPreparer(ctx context.Context, resourceGroupName string, workflowName string, runName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowRunsClient) GetResponder(resp *http.Response) (result WorkflowRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of workflow runs. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// top - the number of items to be included in the result. -// filter - the filter to apply on the operation. Options for filters include: Status, StartTime, and -// ClientTrackingId. -func (client WorkflowRunsClient) List(ctx context.Context, resourceGroupName string, workflowName string, top *int32, filter string) (result WorkflowRunListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunsClient.List") - defer func() { - sc := -1 - if result.wrlr.Response.Response != nil { - sc = result.wrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workflowName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "List", resp, "Failure sending request") - return - } - - result.wrlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "List", resp, "Failure responding to request") - return - } - if result.wrlr.hasNextLink() && result.wrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkflowRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, workflowName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkflowRunsClient) ListResponder(resp *http.Response) (result WorkflowRunListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client WorkflowRunsClient) listNextResults(ctx context.Context, lastResults WorkflowRunListResult) (result WorkflowRunListResult, err error) { - req, err := lastResults.workflowRunListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkflowRunsClient) ListComplete(ctx context.Context, resourceGroupName string, workflowName string, top *int32, filter string) (result WorkflowRunListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowRunsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, workflowName, top, filter) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflows.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflows.go deleted file mode 100644 index cff18e1d20b0..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflows.go +++ /dev/null @@ -1,1286 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WorkflowsClient is the REST API for Azure Logic Apps. -type WorkflowsClient struct { - BaseClient -} - -// NewWorkflowsClient creates an instance of the WorkflowsClient client. -func NewWorkflowsClient(subscriptionID string) WorkflowsClient { - return NewWorkflowsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowsClientWithBaseURI creates an instance of the WorkflowsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWorkflowsClientWithBaseURI(baseURI string, subscriptionID string) WorkflowsClient { - return WorkflowsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a workflow. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// workflow - the workflow. -func (client WorkflowsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workflowName string, workflow Workflow) (result Workflow, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workflowName, workflow) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkflowsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workflowName string, workflow Workflow) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}", pathParameters), - autorest.WithJSON(workflow), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) CreateOrUpdateResponder(resp *http.Response) (result Workflow, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a workflow. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -func (client WorkflowsClient) Delete(ctx context.Context, resourceGroupName string, workflowName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, workflowName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkflowsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workflowName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Disable disables a workflow. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -func (client WorkflowsClient) Disable(ctx context.Context, resourceGroupName string, workflowName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.Disable") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DisablePreparer(ctx, resourceGroupName, workflowName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Disable", nil, "Failure preparing request") - return - } - - resp, err := client.DisableSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Disable", resp, "Failure sending request") - return - } - - result, err = client.DisableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Disable", resp, "Failure responding to request") - return - } - - return -} - -// DisablePreparer prepares the Disable request. -func (client WorkflowsClient) DisablePreparer(ctx context.Context, resourceGroupName string, workflowName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/disable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DisableSender sends the Disable request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) DisableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DisableResponder handles the response to the Disable request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) DisableResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Enable enables a workflow. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -func (client WorkflowsClient) Enable(ctx context.Context, resourceGroupName string, workflowName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.Enable") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.EnablePreparer(ctx, resourceGroupName, workflowName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Enable", nil, "Failure preparing request") - return - } - - resp, err := client.EnableSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Enable", resp, "Failure sending request") - return - } - - result, err = client.EnableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Enable", resp, "Failure responding to request") - return - } - - return -} - -// EnablePreparer prepares the Enable request. -func (client WorkflowsClient) EnablePreparer(ctx context.Context, resourceGroupName string, workflowName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/enable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EnableSender sends the Enable request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) EnableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// EnableResponder handles the response to the Enable request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) EnableResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GenerateUpgradedDefinition generates the upgraded definition for a workflow. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// parameters - parameters for generating an upgraded definition. -func (client WorkflowsClient) GenerateUpgradedDefinition(ctx context.Context, resourceGroupName string, workflowName string, parameters GenerateUpgradedDefinitionParameters) (result SetObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.GenerateUpgradedDefinition") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GenerateUpgradedDefinitionPreparer(ctx, resourceGroupName, workflowName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "GenerateUpgradedDefinition", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateUpgradedDefinitionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "GenerateUpgradedDefinition", resp, "Failure sending request") - return - } - - result, err = client.GenerateUpgradedDefinitionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "GenerateUpgradedDefinition", resp, "Failure responding to request") - return - } - - return -} - -// GenerateUpgradedDefinitionPreparer prepares the GenerateUpgradedDefinition request. -func (client WorkflowsClient) GenerateUpgradedDefinitionPreparer(ctx context.Context, resourceGroupName string, workflowName string, parameters GenerateUpgradedDefinitionParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/generateUpgradedDefinition", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GenerateUpgradedDefinitionSender sends the GenerateUpgradedDefinition request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) GenerateUpgradedDefinitionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GenerateUpgradedDefinitionResponder handles the response to the GenerateUpgradedDefinition request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) GenerateUpgradedDefinitionResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a workflow. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -func (client WorkflowsClient) Get(ctx context.Context, resourceGroupName string, workflowName string) (result Workflow, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, workflowName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowsClient) GetPreparer(ctx context.Context, resourceGroupName string, workflowName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) GetResponder(resp *http.Response) (result Workflow, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets a list of workflows by resource group. -// Parameters: -// resourceGroupName - the resource group name. -// top - the number of items to be included in the result. -// filter - the filter to apply on the operation. Options for filters include: State, Trigger, and -// ReferencedResourceId. -func (client WorkflowsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32, filter string) (result WorkflowListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.wlr.Response.Response != nil { - sc = result.wlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.wlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.wlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.wlr.hasNextLink() && result.wlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client WorkflowsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) ListByResourceGroupResponder(resp *http.Response) (result WorkflowListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client WorkflowsClient) listByResourceGroupNextResults(ctx context.Context, lastResults WorkflowListResult) (result WorkflowListResult, err error) { - req, err := lastResults.workflowListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkflowsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, top *int32, filter string) (result WorkflowListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, top, filter) - return -} - -// ListBySubscription gets a list of workflows by subscription. -// Parameters: -// top - the number of items to be included in the result. -// filter - the filter to apply on the operation. Options for filters include: State, Trigger, and -// ReferencedResourceId. -func (client WorkflowsClient) ListBySubscription(ctx context.Context, top *int32, filter string) (result WorkflowListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.ListBySubscription") - defer func() { - sc := -1 - if result.wlr.Response.Response != nil { - sc = result.wlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.wlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.wlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.wlr.hasNextLink() && result.wlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client WorkflowsClient) ListBySubscriptionPreparer(ctx context.Context, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Logic/workflows", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) ListBySubscriptionResponder(resp *http.Response) (result WorkflowListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client WorkflowsClient) listBySubscriptionNextResults(ctx context.Context, lastResults WorkflowListResult) (result WorkflowListResult, err error) { - req, err := lastResults.workflowListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkflowsClient) ListBySubscriptionComplete(ctx context.Context, top *int32, filter string) (result WorkflowListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx, top, filter) - return -} - -// ListCallbackURL get the workflow callback Url. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// listCallbackURL - which callback url to list. -func (client WorkflowsClient) ListCallbackURL(ctx context.Context, resourceGroupName string, workflowName string, listCallbackURL GetCallbackURLParameters) (result WorkflowTriggerCallbackURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.ListCallbackURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListCallbackURLPreparer(ctx, resourceGroupName, workflowName, listCallbackURL) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListCallbackURL", nil, "Failure preparing request") - return - } - - resp, err := client.ListCallbackURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListCallbackURL", resp, "Failure sending request") - return - } - - result, err = client.ListCallbackURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListCallbackURL", resp, "Failure responding to request") - return - } - - return -} - -// ListCallbackURLPreparer prepares the ListCallbackURL request. -func (client WorkflowsClient) ListCallbackURLPreparer(ctx context.Context, resourceGroupName string, workflowName string, listCallbackURL GetCallbackURLParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/listCallbackUrl", pathParameters), - autorest.WithJSON(listCallbackURL), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCallbackURLSender sends the ListCallbackURL request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) ListCallbackURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCallbackURLResponder handles the response to the ListCallbackURL request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) ListCallbackURLResponder(resp *http.Response) (result WorkflowTriggerCallbackURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSwagger gets an OpenAPI definition for the workflow. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -func (client WorkflowsClient) ListSwagger(ctx context.Context, resourceGroupName string, workflowName string) (result SetObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.ListSwagger") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSwaggerPreparer(ctx, resourceGroupName, workflowName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListSwagger", nil, "Failure preparing request") - return - } - - resp, err := client.ListSwaggerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListSwagger", resp, "Failure sending request") - return - } - - result, err = client.ListSwaggerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListSwagger", resp, "Failure responding to request") - return - } - - return -} - -// ListSwaggerPreparer prepares the ListSwagger request. -func (client WorkflowsClient) ListSwaggerPreparer(ctx context.Context, resourceGroupName string, workflowName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/listSwagger", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSwaggerSender sends the ListSwagger request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) ListSwaggerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSwaggerResponder handles the response to the ListSwagger request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) ListSwaggerResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Move moves an existing workflow. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// move - the workflow to move. -func (client WorkflowsClient) Move(ctx context.Context, resourceGroupName string, workflowName string, move WorkflowReference) (result WorkflowsMoveFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.Move") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.MovePreparer(ctx, resourceGroupName, workflowName, move) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Move", nil, "Failure preparing request") - return - } - - result, err = client.MoveSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Move", result.Response(), "Failure sending request") - return - } - - return -} - -// MovePreparer prepares the Move request. -func (client WorkflowsClient) MovePreparer(ctx context.Context, resourceGroupName string, workflowName string, move WorkflowReference) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/move", pathParameters), - autorest.WithJSON(move), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// MoveSender sends the Move request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) MoveSender(req *http.Request) (future WorkflowsMoveFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// MoveResponder handles the response to the Move request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) MoveResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateAccessKey regenerates the callback URL access key for request triggers. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// keyType - the access key type. -func (client WorkflowsClient) RegenerateAccessKey(ctx context.Context, resourceGroupName string, workflowName string, keyType RegenerateActionParameter) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.RegenerateAccessKey") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RegenerateAccessKeyPreparer(ctx, resourceGroupName, workflowName, keyType) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "RegenerateAccessKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateAccessKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "RegenerateAccessKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateAccessKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "RegenerateAccessKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateAccessKeyPreparer prepares the RegenerateAccessKey request. -func (client WorkflowsClient) RegenerateAccessKeyPreparer(ctx context.Context, resourceGroupName string, workflowName string, keyType RegenerateActionParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/regenerateAccessKey", pathParameters), - autorest.WithJSON(keyType), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateAccessKeySender sends the RegenerateAccessKey request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) RegenerateAccessKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateAccessKeyResponder handles the response to the RegenerateAccessKey request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) RegenerateAccessKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates a workflow. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -func (client WorkflowsClient) Update(ctx context.Context, resourceGroupName string, workflowName string) (result Workflow, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, workflowName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WorkflowsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workflowName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) UpdateResponder(resp *http.Response) (result Workflow, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ValidateByLocation validates the workflow definition. -// Parameters: -// resourceGroupName - the resource group name. -// location - the workflow location. -// workflowName - the workflow name. -// validate - the workflow. -func (client WorkflowsClient) ValidateByLocation(ctx context.Context, resourceGroupName string, location string, workflowName string, validate Workflow) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.ValidateByLocation") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ValidateByLocationPreparer(ctx, resourceGroupName, location, workflowName, validate) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ValidateByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ValidateByLocationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ValidateByLocation", resp, "Failure sending request") - return - } - - result, err = client.ValidateByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ValidateByLocation", resp, "Failure responding to request") - return - } - - return -} - -// ValidateByLocationPreparer prepares the ValidateByLocation request. -func (client WorkflowsClient) ValidateByLocationPreparer(ctx context.Context, resourceGroupName string, location string, workflowName string, validate Workflow) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/locations/{location}/workflows/{workflowName}/validate", pathParameters), - autorest.WithJSON(validate), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ValidateByLocationSender sends the ValidateByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) ValidateByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ValidateByLocationResponder handles the response to the ValidateByLocation request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) ValidateByLocationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ValidateByResourceGroup validates the workflow. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// validate - the workflow. -func (client WorkflowsClient) ValidateByResourceGroup(ctx context.Context, resourceGroupName string, workflowName string, validate Workflow) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowsClient.ValidateByResourceGroup") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ValidateByResourceGroupPreparer(ctx, resourceGroupName, workflowName, validate) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ValidateByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ValidateByResourceGroupSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ValidateByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ValidateByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ValidateByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ValidateByResourceGroupPreparer prepares the ValidateByResourceGroup request. -func (client WorkflowsClient) ValidateByResourceGroupPreparer(ctx context.Context, resourceGroupName string, workflowName string, validate Workflow) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/validate", pathParameters), - autorest.WithJSON(validate), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ValidateByResourceGroupSender sends the ValidateByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) ValidateByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ValidateByResourceGroupResponder handles the response to the ValidateByResourceGroup request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) ValidateByResourceGroupResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowtriggerhistories.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowtriggerhistories.go deleted file mode 100644 index b16194dc9868..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowtriggerhistories.go +++ /dev/null @@ -1,322 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WorkflowTriggerHistoriesClient is the REST API for Azure Logic Apps. -type WorkflowTriggerHistoriesClient struct { - BaseClient -} - -// NewWorkflowTriggerHistoriesClient creates an instance of the WorkflowTriggerHistoriesClient client. -func NewWorkflowTriggerHistoriesClient(subscriptionID string) WorkflowTriggerHistoriesClient { - return NewWorkflowTriggerHistoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowTriggerHistoriesClientWithBaseURI creates an instance of the WorkflowTriggerHistoriesClient client using -// a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewWorkflowTriggerHistoriesClientWithBaseURI(baseURI string, subscriptionID string) WorkflowTriggerHistoriesClient { - return WorkflowTriggerHistoriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a workflow trigger history. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// triggerName - the workflow trigger name. -// historyName - the workflow trigger history name. Corresponds to the run name for triggers that resulted in a -// run. -func (client WorkflowTriggerHistoriesClient) Get(ctx context.Context, resourceGroupName string, workflowName string, triggerName string, historyName string) (result WorkflowTriggerHistory, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggerHistoriesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, workflowName, triggerName, historyName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowTriggerHistoriesClient) GetPreparer(ctx context.Context, resourceGroupName string, workflowName string, triggerName string, historyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "historyName": autorest.Encode("path", historyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/histories/{historyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggerHistoriesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowTriggerHistoriesClient) GetResponder(resp *http.Response) (result WorkflowTriggerHistory, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of workflow trigger histories. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// triggerName - the workflow trigger name. -// top - the number of items to be included in the result. -// filter - the filter to apply on the operation. Options for filters include: Status, StartTime, and -// ClientTrackingId. -func (client WorkflowTriggerHistoriesClient) List(ctx context.Context, resourceGroupName string, workflowName string, triggerName string, top *int32, filter string) (result WorkflowTriggerHistoryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggerHistoriesClient.List") - defer func() { - sc := -1 - if result.wthlr.Response.Response != nil { - sc = result.wthlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workflowName, triggerName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wthlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "List", resp, "Failure sending request") - return - } - - result.wthlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "List", resp, "Failure responding to request") - return - } - if result.wthlr.hasNextLink() && result.wthlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkflowTriggerHistoriesClient) ListPreparer(ctx context.Context, resourceGroupName string, workflowName string, triggerName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/histories", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggerHistoriesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkflowTriggerHistoriesClient) ListResponder(resp *http.Response) (result WorkflowTriggerHistoryListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client WorkflowTriggerHistoriesClient) listNextResults(ctx context.Context, lastResults WorkflowTriggerHistoryListResult) (result WorkflowTriggerHistoryListResult, err error) { - req, err := lastResults.workflowTriggerHistoryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkflowTriggerHistoriesClient) ListComplete(ctx context.Context, resourceGroupName string, workflowName string, triggerName string, top *int32, filter string) (result WorkflowTriggerHistoryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggerHistoriesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, workflowName, triggerName, top, filter) - return -} - -// Resubmit resubmits a workflow run based on the trigger history. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// triggerName - the workflow trigger name. -// historyName - the workflow trigger history name. Corresponds to the run name for triggers that resulted in a -// run. -func (client WorkflowTriggerHistoriesClient) Resubmit(ctx context.Context, resourceGroupName string, workflowName string, triggerName string, historyName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggerHistoriesClient.Resubmit") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ResubmitPreparer(ctx, resourceGroupName, workflowName, triggerName, historyName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Resubmit", nil, "Failure preparing request") - return - } - - resp, err := client.ResubmitSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Resubmit", resp, "Failure sending request") - return - } - - result, err = client.ResubmitResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Resubmit", resp, "Failure responding to request") - return - } - - return -} - -// ResubmitPreparer prepares the Resubmit request. -func (client WorkflowTriggerHistoriesClient) ResubmitPreparer(ctx context.Context, resourceGroupName string, workflowName string, triggerName string, historyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "historyName": autorest.Encode("path", historyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/histories/{historyName}/resubmit", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ResubmitSender sends the Resubmit request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggerHistoriesClient) ResubmitSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ResubmitResponder handles the response to the Resubmit request. The method always -// closes the http.Response Body. -func (client WorkflowTriggerHistoriesClient) ResubmitResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowtriggers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowtriggers.go deleted file mode 100644 index 665f54ae5e37..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowtriggers.go +++ /dev/null @@ -1,633 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WorkflowTriggersClient is the REST API for Azure Logic Apps. -type WorkflowTriggersClient struct { - BaseClient -} - -// NewWorkflowTriggersClient creates an instance of the WorkflowTriggersClient client. -func NewWorkflowTriggersClient(subscriptionID string) WorkflowTriggersClient { - return NewWorkflowTriggersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowTriggersClientWithBaseURI creates an instance of the WorkflowTriggersClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewWorkflowTriggersClientWithBaseURI(baseURI string, subscriptionID string) WorkflowTriggersClient { - return WorkflowTriggersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a workflow trigger. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// triggerName - the workflow trigger name. -func (client WorkflowTriggersClient) Get(ctx context.Context, resourceGroupName string, workflowName string, triggerName string) (result WorkflowTrigger, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, workflowName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowTriggersClient) GetPreparer(ctx context.Context, resourceGroupName string, workflowName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowTriggersClient) GetResponder(resp *http.Response) (result WorkflowTrigger, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSchemaJSON get the trigger schema as JSON. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// triggerName - the workflow trigger name. -func (client WorkflowTriggersClient) GetSchemaJSON(ctx context.Context, resourceGroupName string, workflowName string, triggerName string) (result JSONSchema, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggersClient.GetSchemaJSON") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetSchemaJSONPreparer(ctx, resourceGroupName, workflowName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "GetSchemaJSON", nil, "Failure preparing request") - return - } - - resp, err := client.GetSchemaJSONSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "GetSchemaJSON", resp, "Failure sending request") - return - } - - result, err = client.GetSchemaJSONResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "GetSchemaJSON", resp, "Failure responding to request") - return - } - - return -} - -// GetSchemaJSONPreparer prepares the GetSchemaJSON request. -func (client WorkflowTriggersClient) GetSchemaJSONPreparer(ctx context.Context, resourceGroupName string, workflowName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/schemas/json", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSchemaJSONSender sends the GetSchemaJSON request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggersClient) GetSchemaJSONSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetSchemaJSONResponder handles the response to the GetSchemaJSON request. The method always -// closes the http.Response Body. -func (client WorkflowTriggersClient) GetSchemaJSONResponder(resp *http.Response) (result JSONSchema, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of workflow triggers. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// top - the number of items to be included in the result. -// filter - the filter to apply on the operation. -func (client WorkflowTriggersClient) List(ctx context.Context, resourceGroupName string, workflowName string, top *int32, filter string) (result WorkflowTriggerListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggersClient.List") - defer func() { - sc := -1 - if result.wtlr.Response.Response != nil { - sc = result.wtlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workflowName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wtlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "List", resp, "Failure sending request") - return - } - - result.wtlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "List", resp, "Failure responding to request") - return - } - if result.wtlr.hasNextLink() && result.wtlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkflowTriggersClient) ListPreparer(ctx context.Context, resourceGroupName string, workflowName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggersClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkflowTriggersClient) ListResponder(resp *http.Response) (result WorkflowTriggerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client WorkflowTriggersClient) listNextResults(ctx context.Context, lastResults WorkflowTriggerListResult) (result WorkflowTriggerListResult, err error) { - req, err := lastResults.workflowTriggerListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkflowTriggersClient) ListComplete(ctx context.Context, resourceGroupName string, workflowName string, top *int32, filter string) (result WorkflowTriggerListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggersClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, workflowName, top, filter) - return -} - -// ListCallbackURL get the callback URL for a workflow trigger. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// triggerName - the workflow trigger name. -func (client WorkflowTriggersClient) ListCallbackURL(ctx context.Context, resourceGroupName string, workflowName string, triggerName string) (result WorkflowTriggerCallbackURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggersClient.ListCallbackURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListCallbackURLPreparer(ctx, resourceGroupName, workflowName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "ListCallbackURL", nil, "Failure preparing request") - return - } - - resp, err := client.ListCallbackURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "ListCallbackURL", resp, "Failure sending request") - return - } - - result, err = client.ListCallbackURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "ListCallbackURL", resp, "Failure responding to request") - return - } - - return -} - -// ListCallbackURLPreparer prepares the ListCallbackURL request. -func (client WorkflowTriggersClient) ListCallbackURLPreparer(ctx context.Context, resourceGroupName string, workflowName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/listCallbackUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCallbackURLSender sends the ListCallbackURL request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggersClient) ListCallbackURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCallbackURLResponder handles the response to the ListCallbackURL request. The method always -// closes the http.Response Body. -func (client WorkflowTriggersClient) ListCallbackURLResponder(resp *http.Response) (result WorkflowTriggerCallbackURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Reset resets a workflow trigger. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// triggerName - the workflow trigger name. -func (client WorkflowTriggersClient) Reset(ctx context.Context, resourceGroupName string, workflowName string, triggerName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggersClient.Reset") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ResetPreparer(ctx, resourceGroupName, workflowName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Reset", nil, "Failure preparing request") - return - } - - resp, err := client.ResetSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Reset", resp, "Failure sending request") - return - } - - result, err = client.ResetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Reset", resp, "Failure responding to request") - return - } - - return -} - -// ResetPreparer prepares the Reset request. -func (client WorkflowTriggersClient) ResetPreparer(ctx context.Context, resourceGroupName string, workflowName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/reset", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ResetSender sends the Reset request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggersClient) ResetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ResetResponder handles the response to the Reset request. The method always -// closes the http.Response Body. -func (client WorkflowTriggersClient) ResetResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Run runs a workflow trigger. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// triggerName - the workflow trigger name. -func (client WorkflowTriggersClient) Run(ctx context.Context, resourceGroupName string, workflowName string, triggerName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggersClient.Run") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RunPreparer(ctx, resourceGroupName, workflowName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Run", nil, "Failure preparing request") - return - } - - resp, err := client.RunSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Run", resp, "Failure sending request") - return - } - - result, err = client.RunResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Run", resp, "Failure responding to request") - return - } - - return -} - -// RunPreparer prepares the Run request. -func (client WorkflowTriggersClient) RunPreparer(ctx context.Context, resourceGroupName string, workflowName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/run", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RunSender sends the Run request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggersClient) RunSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RunResponder handles the response to the Run request. The method always -// closes the http.Response Body. -func (client WorkflowTriggersClient) RunResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// SetState sets the state of a workflow trigger. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// triggerName - the workflow trigger name. -// setState - the workflow trigger state. -func (client WorkflowTriggersClient) SetState(ctx context.Context, resourceGroupName string, workflowName string, triggerName string, setState SetTriggerStateActionDefinition) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowTriggersClient.SetState") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: setState, - Constraints: []validation.Constraint{{Target: "setState.Source", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("logic.WorkflowTriggersClient", "SetState", err.Error()) - } - - req, err := client.SetStatePreparer(ctx, resourceGroupName, workflowName, triggerName, setState) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "SetState", nil, "Failure preparing request") - return - } - - resp, err := client.SetStateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "SetState", resp, "Failure sending request") - return - } - - result, err = client.SetStateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "SetState", resp, "Failure responding to request") - return - } - - return -} - -// SetStatePreparer prepares the SetState request. -func (client WorkflowTriggersClient) SetStatePreparer(ctx context.Context, resourceGroupName string, workflowName string, triggerName string, setState SetTriggerStateActionDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/setState", pathParameters), - autorest.WithJSON(setState), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SetStateSender sends the SetState request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggersClient) SetStateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SetStateResponder handles the response to the SetState request. The method always -// closes the http.Response Body. -func (client WorkflowTriggersClient) SetStateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowversions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowversions.go deleted file mode 100644 index 4b2bc9b75d0d..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowversions.go +++ /dev/null @@ -1,232 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WorkflowVersionsClient is the REST API for Azure Logic Apps. -type WorkflowVersionsClient struct { - BaseClient -} - -// NewWorkflowVersionsClient creates an instance of the WorkflowVersionsClient client. -func NewWorkflowVersionsClient(subscriptionID string) WorkflowVersionsClient { - return NewWorkflowVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowVersionsClientWithBaseURI creates an instance of the WorkflowVersionsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewWorkflowVersionsClientWithBaseURI(baseURI string, subscriptionID string) WorkflowVersionsClient { - return WorkflowVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a workflow version. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// versionID - the workflow versionId. -func (client WorkflowVersionsClient) Get(ctx context.Context, resourceGroupName string, workflowName string, versionID string) (result WorkflowVersion, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowVersionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, workflowName, versionID) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowVersionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workflowName string, versionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionId": autorest.Encode("path", versionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/versions/{versionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowVersionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowVersionsClient) GetResponder(resp *http.Response) (result WorkflowVersion, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of workflow versions. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// top - the number of items to be included in the result. -func (client WorkflowVersionsClient) List(ctx context.Context, resourceGroupName string, workflowName string, top *int32) (result WorkflowVersionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowVersionsClient.List") - defer func() { - sc := -1 - if result.wvlr.Response.Response != nil { - sc = result.wvlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, workflowName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wvlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "List", resp, "Failure sending request") - return - } - - result.wvlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "List", resp, "Failure responding to request") - return - } - if result.wvlr.hasNextLink() && result.wvlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkflowVersionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workflowName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/versions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowVersionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkflowVersionsClient) ListResponder(resp *http.Response) (result WorkflowVersionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client WorkflowVersionsClient) listNextResults(ctx context.Context, lastResults WorkflowVersionListResult) (result WorkflowVersionListResult, err error) { - req, err := lastResults.workflowVersionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkflowVersionsClient) ListComplete(ctx context.Context, resourceGroupName string, workflowName string, top *int32) (result WorkflowVersionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowVersionsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, workflowName, top) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowversiontriggers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowversiontriggers.go deleted file mode 100644 index 015bbf9d504f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic/workflowversiontriggers.go +++ /dev/null @@ -1,118 +0,0 @@ -package logic - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WorkflowVersionTriggersClient is the REST API for Azure Logic Apps. -type WorkflowVersionTriggersClient struct { - BaseClient -} - -// NewWorkflowVersionTriggersClient creates an instance of the WorkflowVersionTriggersClient client. -func NewWorkflowVersionTriggersClient(subscriptionID string) WorkflowVersionTriggersClient { - return NewWorkflowVersionTriggersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowVersionTriggersClientWithBaseURI creates an instance of the WorkflowVersionTriggersClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewWorkflowVersionTriggersClientWithBaseURI(baseURI string, subscriptionID string) WorkflowVersionTriggersClient { - return WorkflowVersionTriggersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListCallbackURL get the callback url for a trigger of a workflow version. -// Parameters: -// resourceGroupName - the resource group name. -// workflowName - the workflow name. -// versionID - the workflow versionId. -// triggerName - the workflow trigger name. -// parameters - the callback URL parameters. -func (client WorkflowVersionTriggersClient) ListCallbackURL(ctx context.Context, resourceGroupName string, workflowName string, versionID string, triggerName string, parameters *GetCallbackURLParameters) (result WorkflowTriggerCallbackURL, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkflowVersionTriggersClient.ListCallbackURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListCallbackURLPreparer(ctx, resourceGroupName, workflowName, versionID, triggerName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionTriggersClient", "ListCallbackURL", nil, "Failure preparing request") - return - } - - resp, err := client.ListCallbackURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionTriggersClient", "ListCallbackURL", resp, "Failure sending request") - return - } - - result, err = client.ListCallbackURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionTriggersClient", "ListCallbackURL", resp, "Failure responding to request") - return - } - - return -} - -// ListCallbackURLPreparer prepares the ListCallbackURL request. -func (client WorkflowVersionTriggersClient) ListCallbackURLPreparer(ctx context.Context, resourceGroupName string, workflowName string, versionID string, triggerName string, parameters *GetCallbackURLParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "versionId": autorest.Encode("path", versionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/versions/{versionId}/triggers/{triggerName}/listCallbackUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCallbackURLSender sends the ListCallbackURL request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowVersionTriggersClient) ListCallbackURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCallbackURLResponder handles the response to the ListCallbackURL request. The method always -// closes the http.Response Body. -func (client WorkflowVersionTriggersClient) ListCallbackURLResponder(resp *http.Response) (result WorkflowTriggerCallbackURL, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/CHANGELOG.md deleted file mode 100644 index c57e1603a319..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/CHANGELOG.md +++ /dev/null @@ -1,15 +0,0 @@ -# Change History - -## Additive Changes - -### New Constants - -1. ChannelName.ChannelNameOutlookChannel - -### Struct Changes - -#### New Struct Fields - -1. ListChannelWithKeysResponse.ChangedTime -1. ListChannelWithKeysResponse.EntityTag -1. ListChannelWithKeysResponse.ProvisioningState diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/_meta.json deleted file mode 100644 index e36643ccc43b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "9d8640319ef481ae301b67b033d6ae0bd30422c3", - "readme": "/_/azure-rest-api-specs/specification/botservice/resource-manager/readme.md", - "tag": "package-preview-2021-05", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2021-05 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --pass-thru:schema-validator-swagger --enum-prefix /_/azure-rest-api-specs/specification/botservice/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --pass-thru:schema-validator-swagger --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/client.go deleted file mode 100644 index b1cca61d6e56..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/botservice/armbotservice](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/botservice/armbotservice). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package botservice implements the Azure ARM Botservice service API version 2021-05-01-preview. -// -// Azure Bot Service is a platform for creating smart conversational agents. -package botservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Botservice - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Botservice. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/enums.go deleted file mode 100644 index 3f76d8b6d903..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/enums.go +++ /dev/null @@ -1,256 +0,0 @@ -package botservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ChannelName enumerates the values for channel name. -type ChannelName string - -const ( - // ChannelNameAlexaChannel ... - ChannelNameAlexaChannel ChannelName = "AlexaChannel" - // ChannelNameDirectLineChannel ... - ChannelNameDirectLineChannel ChannelName = "DirectLineChannel" - // ChannelNameDirectLineSpeechChannel ... - ChannelNameDirectLineSpeechChannel ChannelName = "DirectLineSpeechChannel" - // ChannelNameEmailChannel ... - ChannelNameEmailChannel ChannelName = "EmailChannel" - // ChannelNameFacebookChannel ... - ChannelNameFacebookChannel ChannelName = "FacebookChannel" - // ChannelNameKikChannel ... - ChannelNameKikChannel ChannelName = "KikChannel" - // ChannelNameLineChannel ... - ChannelNameLineChannel ChannelName = "LineChannel" - // ChannelNameMsTeamsChannel ... - ChannelNameMsTeamsChannel ChannelName = "MsTeamsChannel" - // ChannelNameOutlookChannel ... - ChannelNameOutlookChannel ChannelName = "OutlookChannel" - // ChannelNameSkypeChannel ... - ChannelNameSkypeChannel ChannelName = "SkypeChannel" - // ChannelNameSlackChannel ... - ChannelNameSlackChannel ChannelName = "SlackChannel" - // ChannelNameSmsChannel ... - ChannelNameSmsChannel ChannelName = "SmsChannel" - // ChannelNameTelegramChannel ... - ChannelNameTelegramChannel ChannelName = "TelegramChannel" - // ChannelNameWebChatChannel ... - ChannelNameWebChatChannel ChannelName = "WebChatChannel" -) - -// PossibleChannelNameValues returns an array of possible values for the ChannelName const type. -func PossibleChannelNameValues() []ChannelName { - return []ChannelName{ChannelNameAlexaChannel, ChannelNameDirectLineChannel, ChannelNameDirectLineSpeechChannel, ChannelNameEmailChannel, ChannelNameFacebookChannel, ChannelNameKikChannel, ChannelNameLineChannel, ChannelNameMsTeamsChannel, ChannelNameOutlookChannel, ChannelNameSkypeChannel, ChannelNameSlackChannel, ChannelNameSmsChannel, ChannelNameTelegramChannel, ChannelNameWebChatChannel} -} - -// ChannelNameBasicChannel enumerates the values for channel name basic channel. -type ChannelNameBasicChannel string - -const ( - // ChannelNameBasicChannelChannelNameAlexaChannel ... - ChannelNameBasicChannelChannelNameAlexaChannel ChannelNameBasicChannel = "AlexaChannel" - // ChannelNameBasicChannelChannelNameChannel ... - ChannelNameBasicChannelChannelNameChannel ChannelNameBasicChannel = "Channel" - // ChannelNameBasicChannelChannelNameDirectLineChannel ... - ChannelNameBasicChannelChannelNameDirectLineChannel ChannelNameBasicChannel = "DirectLineChannel" - // ChannelNameBasicChannelChannelNameDirectLineSpeechChannel ... - ChannelNameBasicChannelChannelNameDirectLineSpeechChannel ChannelNameBasicChannel = "DirectLineSpeechChannel" - // ChannelNameBasicChannelChannelNameEmailChannel ... - ChannelNameBasicChannelChannelNameEmailChannel ChannelNameBasicChannel = "EmailChannel" - // ChannelNameBasicChannelChannelNameFacebookChannel ... - ChannelNameBasicChannelChannelNameFacebookChannel ChannelNameBasicChannel = "FacebookChannel" - // ChannelNameBasicChannelChannelNameKikChannel ... - ChannelNameBasicChannelChannelNameKikChannel ChannelNameBasicChannel = "KikChannel" - // ChannelNameBasicChannelChannelNameLineChannel ... - ChannelNameBasicChannelChannelNameLineChannel ChannelNameBasicChannel = "LineChannel" - // ChannelNameBasicChannelChannelNameMsTeamsChannel ... - ChannelNameBasicChannelChannelNameMsTeamsChannel ChannelNameBasicChannel = "MsTeamsChannel" - // ChannelNameBasicChannelChannelNameSkypeChannel ... - ChannelNameBasicChannelChannelNameSkypeChannel ChannelNameBasicChannel = "SkypeChannel" - // ChannelNameBasicChannelChannelNameSlackChannel ... - ChannelNameBasicChannelChannelNameSlackChannel ChannelNameBasicChannel = "SlackChannel" - // ChannelNameBasicChannelChannelNameSmsChannel ... - ChannelNameBasicChannelChannelNameSmsChannel ChannelNameBasicChannel = "SmsChannel" - // ChannelNameBasicChannelChannelNameTelegramChannel ... - ChannelNameBasicChannelChannelNameTelegramChannel ChannelNameBasicChannel = "TelegramChannel" - // ChannelNameBasicChannelChannelNameWebChatChannel ... - ChannelNameBasicChannelChannelNameWebChatChannel ChannelNameBasicChannel = "WebChatChannel" -) - -// PossibleChannelNameBasicChannelValues returns an array of possible values for the ChannelNameBasicChannel const type. -func PossibleChannelNameBasicChannelValues() []ChannelNameBasicChannel { - return []ChannelNameBasicChannel{ChannelNameBasicChannelChannelNameAlexaChannel, ChannelNameBasicChannelChannelNameChannel, ChannelNameBasicChannelChannelNameDirectLineChannel, ChannelNameBasicChannelChannelNameDirectLineSpeechChannel, ChannelNameBasicChannelChannelNameEmailChannel, ChannelNameBasicChannelChannelNameFacebookChannel, ChannelNameBasicChannelChannelNameKikChannel, ChannelNameBasicChannelChannelNameLineChannel, ChannelNameBasicChannelChannelNameMsTeamsChannel, ChannelNameBasicChannelChannelNameSkypeChannel, ChannelNameBasicChannelChannelNameSlackChannel, ChannelNameBasicChannelChannelNameSmsChannel, ChannelNameBasicChannelChannelNameTelegramChannel, ChannelNameBasicChannelChannelNameWebChatChannel} -} - -// Key enumerates the values for key. -type Key string - -const ( - // Key1 ... - Key1 Key = "key1" - // Key2 ... - Key2 Key = "key2" -) - -// PossibleKeyValues returns an array of possible values for the Key const type. -func PossibleKeyValues() []Key { - return []Key{Key1, Key2} -} - -// Kind enumerates the values for kind. -type Kind string - -const ( - // KindAzurebot ... - KindAzurebot Kind = "azurebot" - // KindBot ... - KindBot Kind = "bot" - // KindDesigner ... - KindDesigner Kind = "designer" - // KindFunction ... - KindFunction Kind = "function" - // KindSdk ... - KindSdk Kind = "sdk" -) - -// PossibleKindValues returns an array of possible values for the Kind const type. -func PossibleKindValues() []Kind { - return []Kind{KindAzurebot, KindBot, KindDesigner, KindFunction, KindSdk} -} - -// MsaAppType enumerates the values for msa app type. -type MsaAppType string - -const ( - // MsaAppTypeMultiTenant ... - MsaAppTypeMultiTenant MsaAppType = "MultiTenant" - // MsaAppTypeSingleTenant ... - MsaAppTypeSingleTenant MsaAppType = "SingleTenant" - // MsaAppTypeUserAssignedMSI ... - MsaAppTypeUserAssignedMSI MsaAppType = "UserAssignedMSI" -) - -// PossibleMsaAppTypeValues returns an array of possible values for the MsaAppType const type. -func PossibleMsaAppTypeValues() []MsaAppType { - return []MsaAppType{MsaAppTypeMultiTenant, MsaAppTypeSingleTenant, MsaAppTypeUserAssignedMSI} -} - -// OperationResultStatus enumerates the values for operation result status. -type OperationResultStatus string - -const ( - // OperationResultStatusCanceled ... - OperationResultStatusCanceled OperationResultStatus = "Canceled" - // OperationResultStatusFailed ... - OperationResultStatusFailed OperationResultStatus = "Failed" - // OperationResultStatusRequested ... - OperationResultStatusRequested OperationResultStatus = "Requested" - // OperationResultStatusRunning ... - OperationResultStatusRunning OperationResultStatus = "Running" - // OperationResultStatusSucceeded ... - OperationResultStatusSucceeded OperationResultStatus = "Succeeded" -) - -// PossibleOperationResultStatusValues returns an array of possible values for the OperationResultStatus const type. -func PossibleOperationResultStatusValues() []OperationResultStatus { - return []OperationResultStatus{OperationResultStatusCanceled, OperationResultStatusFailed, OperationResultStatusRequested, OperationResultStatusRunning, OperationResultStatusSucceeded} -} - -// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection -// provisioning state. -type PrivateEndpointConnectionProvisioningState string - -const ( - // PrivateEndpointConnectionProvisioningStateCreating ... - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - // PrivateEndpointConnectionProvisioningStateDeleting ... - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - // PrivateEndpointConnectionProvisioningStateFailed ... - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - // PrivateEndpointConnectionProvisioningStateSucceeded ... - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" -) - -// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. -func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { - return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded} -} - -// PrivateEndpointServiceConnectionStatus enumerates the values for private endpoint service connection status. -type PrivateEndpointServiceConnectionStatus string - -const ( - // PrivateEndpointServiceConnectionStatusApproved ... - PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - // PrivateEndpointServiceConnectionStatusPending ... - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" - // PrivateEndpointServiceConnectionStatusRejected ... - PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" -) - -// PossiblePrivateEndpointServiceConnectionStatusValues returns an array of possible values for the PrivateEndpointServiceConnectionStatus const type. -func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { - return []PrivateEndpointServiceConnectionStatus{PrivateEndpointServiceConnectionStatusApproved, PrivateEndpointServiceConnectionStatusPending, PrivateEndpointServiceConnectionStatusRejected} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // PublicNetworkAccessDisabled ... - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - // PublicNetworkAccessEnabled ... - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} -} - -// RegenerateKeysChannelName enumerates the values for regenerate keys channel name. -type RegenerateKeysChannelName string - -const ( - // RegenerateKeysChannelNameDirectLineChannel ... - RegenerateKeysChannelNameDirectLineChannel RegenerateKeysChannelName = "DirectLineChannel" - // RegenerateKeysChannelNameWebChatChannel ... - RegenerateKeysChannelNameWebChatChannel RegenerateKeysChannelName = "WebChatChannel" -) - -// PossibleRegenerateKeysChannelNameValues returns an array of possible values for the RegenerateKeysChannelName const type. -func PossibleRegenerateKeysChannelNameValues() []RegenerateKeysChannelName { - return []RegenerateKeysChannelName{RegenerateKeysChannelNameDirectLineChannel, RegenerateKeysChannelNameWebChatChannel} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // SkuNameF0 ... - SkuNameF0 SkuName = "F0" - // SkuNameS1 ... - SkuNameS1 SkuName = "S1" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{SkuNameF0, SkuNameS1} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // SkuTierFree ... - SkuTierFree SkuTier = "Free" - // SkuTierStandard ... - SkuTierStandard SkuTier = "Standard" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{SkuTierFree, SkuTierStandard} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/models.go deleted file mode 100644 index c124da72e028..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/models.go +++ /dev/null @@ -1,3976 +0,0 @@ -package botservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" - -// AlexaChannel alexa channel definition -type AlexaChannel struct { - // Properties - The set of properties specific to Alexa channel resource - Properties *AlexaChannelProperties `json:"properties,omitempty"` - // Etag - Entity Tag of the resource - Etag *string `json:"etag,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel' - ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlexaChannel. -func (ac AlexaChannel) MarshalJSON() ([]byte, error) { - ac.ChannelName = ChannelNameBasicChannelChannelNameAlexaChannel - objectMap := make(map[string]interface{}) - if ac.Properties != nil { - objectMap["properties"] = ac.Properties - } - if ac.Etag != nil { - objectMap["etag"] = ac.Etag - } - if ac.Location != nil { - objectMap["location"] = ac.Location - } - if ac.ChannelName != "" { - objectMap["channelName"] = ac.ChannelName - } - return json.Marshal(objectMap) -} - -// AsAlexaChannel is the BasicChannel implementation for AlexaChannel. -func (ac AlexaChannel) AsAlexaChannel() (*AlexaChannel, bool) { - return &ac, true -} - -// AsFacebookChannel is the BasicChannel implementation for AlexaChannel. -func (ac AlexaChannel) AsFacebookChannel() (*FacebookChannel, bool) { - return nil, false -} - -// AsEmailChannel is the BasicChannel implementation for AlexaChannel. -func (ac AlexaChannel) AsEmailChannel() (*EmailChannel, bool) { - return nil, false -} - -// AsMsTeamsChannel is the BasicChannel implementation for AlexaChannel. -func (ac AlexaChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { - return nil, false -} - -// AsSkypeChannel is the BasicChannel implementation for AlexaChannel. -func (ac AlexaChannel) AsSkypeChannel() (*SkypeChannel, bool) { - return nil, false -} - -// AsKikChannel is the BasicChannel implementation for AlexaChannel. -func (ac AlexaChannel) AsKikChannel() (*KikChannel, bool) { - return nil, false -} - -// AsWebChatChannel is the BasicChannel implementation for AlexaChannel. -func (ac AlexaChannel) AsWebChatChannel() (*WebChatChannel, bool) { - return nil, false -} - -// AsDirectLineChannel is the BasicChannel implementation for AlexaChannel. -func (ac AlexaChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { - return nil, false -} - -// AsTelegramChannel is the BasicChannel implementation for AlexaChannel. -func (ac AlexaChannel) AsTelegramChannel() (*TelegramChannel, bool) { - return nil, false -} - -// AsSmsChannel is the BasicChannel implementation for AlexaChannel. -func (ac AlexaChannel) AsSmsChannel() (*SmsChannel, bool) { - return nil, false -} - -// AsSlackChannel is the BasicChannel implementation for AlexaChannel. -func (ac AlexaChannel) AsSlackChannel() (*SlackChannel, bool) { - return nil, false -} - -// AsLineChannel is the BasicChannel implementation for AlexaChannel. -func (ac AlexaChannel) AsLineChannel() (*LineChannel, bool) { - return nil, false -} - -// AsDirectLineSpeechChannel is the BasicChannel implementation for AlexaChannel. -func (ac AlexaChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { - return nil, false -} - -// AsChannel is the BasicChannel implementation for AlexaChannel. -func (ac AlexaChannel) AsChannel() (*Channel, bool) { - return nil, false -} - -// AsBasicChannel is the BasicChannel implementation for AlexaChannel. -func (ac AlexaChannel) AsBasicChannel() (BasicChannel, bool) { - return &ac, true -} - -// AlexaChannelProperties the parameters to provide for the Alexa channel. -type AlexaChannelProperties struct { - // AlexaSkillID - The Alexa skill Id - AlexaSkillID *string `json:"alexaSkillId,omitempty"` - // URLFragment - READ-ONLY; Url fragment used in part of the Uri configured in Alexa - URLFragment *string `json:"urlFragment,omitempty"` - // ServiceEndpointURI - READ-ONLY; Full Uri used to configured the skill in Alexa - ServiceEndpointURI *string `json:"serviceEndpointUri,omitempty"` - // IsEnabled - Whether this channel is enabled for the bot - IsEnabled *bool `json:"isEnabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlexaChannelProperties. -func (acp AlexaChannelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acp.AlexaSkillID != nil { - objectMap["alexaSkillId"] = acp.AlexaSkillID - } - if acp.IsEnabled != nil { - objectMap["isEnabled"] = acp.IsEnabled - } - return json.Marshal(objectMap) -} - -// Bot bot resource definition -type Bot struct { - autorest.Response `json:"-"` - // Properties - The set of properties specific to bot resource - Properties *BotProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Specifies the resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Specifies the name of the resource. - Name *string `json:"name,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // Type - READ-ONLY; Specifies the type of the resource. - Type *string `json:"type,omitempty"` - // Tags - Contains resource tags defined as key/value pairs. - Tags map[string]*string `json:"tags"` - // Sku - Gets or sets the SKU of the resource. - Sku *Sku `json:"sku,omitempty"` - // Kind - Required. Gets or sets the Kind of the resource. Possible values include: 'KindSdk', 'KindDesigner', 'KindBot', 'KindFunction', 'KindAzurebot' - Kind Kind `json:"kind,omitempty"` - // Etag - Entity Tag - Etag *string `json:"etag,omitempty"` - // Zones - READ-ONLY; Entity zones - Zones *[]string `json:"zones,omitempty"` -} - -// MarshalJSON is the custom marshaler for Bot. -func (b Bot) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if b.Properties != nil { - objectMap["properties"] = b.Properties - } - if b.Location != nil { - objectMap["location"] = b.Location - } - if b.Tags != nil { - objectMap["tags"] = b.Tags - } - if b.Sku != nil { - objectMap["sku"] = b.Sku - } - if b.Kind != "" { - objectMap["kind"] = b.Kind - } - if b.Etag != nil { - objectMap["etag"] = b.Etag - } - return json.Marshal(objectMap) -} - -// BotChannel bot channel resource definition -type BotChannel struct { - autorest.Response `json:"-"` - // Properties - The set of properties specific to bot channel resource - Properties BasicChannel `json:"properties,omitempty"` - // ID - READ-ONLY; Specifies the resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Specifies the name of the resource. - Name *string `json:"name,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // Type - READ-ONLY; Specifies the type of the resource. - Type *string `json:"type,omitempty"` - // Tags - Contains resource tags defined as key/value pairs. - Tags map[string]*string `json:"tags"` - // Sku - Gets or sets the SKU of the resource. - Sku *Sku `json:"sku,omitempty"` - // Kind - Required. Gets or sets the Kind of the resource. Possible values include: 'KindSdk', 'KindDesigner', 'KindBot', 'KindFunction', 'KindAzurebot' - Kind Kind `json:"kind,omitempty"` - // Etag - Entity Tag - Etag *string `json:"etag,omitempty"` - // Zones - READ-ONLY; Entity zones - Zones *[]string `json:"zones,omitempty"` -} - -// MarshalJSON is the custom marshaler for BotChannel. -func (bc BotChannel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = bc.Properties - if bc.Location != nil { - objectMap["location"] = bc.Location - } - if bc.Tags != nil { - objectMap["tags"] = bc.Tags - } - if bc.Sku != nil { - objectMap["sku"] = bc.Sku - } - if bc.Kind != "" { - objectMap["kind"] = bc.Kind - } - if bc.Etag != nil { - objectMap["etag"] = bc.Etag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BotChannel struct. -func (bc *BotChannel) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - properties, err := unmarshalBasicChannel(*v) - if err != nil { - return err - } - bc.Properties = properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bc.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - bc.Location = &location - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bc.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - bc.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - bc.Sku = &sku - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - bc.Kind = kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - bc.Etag = &etag - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - bc.Zones = &zones - } - } - } - - return nil -} - -// BotProperties the parameters to provide for the Bot. -type BotProperties struct { - // DisplayName - The Name of the bot - DisplayName *string `json:"displayName,omitempty"` - // Description - The description of the bot - Description *string `json:"description,omitempty"` - // IconURL - The Icon Url of the bot - IconURL *string `json:"iconUrl,omitempty"` - // Endpoint - The bot's endpoint - Endpoint *string `json:"endpoint,omitempty"` - // EndpointVersion - READ-ONLY; The bot's endpoint version - EndpointVersion *string `json:"endpointVersion,omitempty"` - // AllSettings - Contains resource all settings defined as key/value pairs. - AllSettings map[string]*string `json:"allSettings"` - // Parameters - Contains resource parameters defined as key/value pairs. - Parameters map[string]*string `json:"parameters"` - // ManifestURL - The bot's manifest url - ManifestURL *string `json:"manifestUrl,omitempty"` - // MsaAppType - Microsoft App Type for the bot. Possible values include: 'MsaAppTypeUserAssignedMSI', 'MsaAppTypeSingleTenant', 'MsaAppTypeMultiTenant' - MsaAppType MsaAppType `json:"msaAppType,omitempty"` - // MsaAppID - Microsoft App Id for the bot - MsaAppID *string `json:"msaAppId,omitempty"` - // MsaAppTenantID - Microsoft App Tenant Id for the bot - MsaAppTenantID *string `json:"msaAppTenantId,omitempty"` - // MsaAppMSIResourceID - Microsoft App Managed Identity Resource Id for the bot - MsaAppMSIResourceID *string `json:"msaAppMSIResourceId,omitempty"` - // ConfiguredChannels - READ-ONLY; Collection of channels for which the bot is configured - ConfiguredChannels *[]string `json:"configuredChannels,omitempty"` - // EnabledChannels - READ-ONLY; Collection of channels for which the bot is enabled - EnabledChannels *[]string `json:"enabledChannels,omitempty"` - // DeveloperAppInsightKey - The Application Insights key - DeveloperAppInsightKey *string `json:"developerAppInsightKey,omitempty"` - // DeveloperAppInsightsAPIKey - The Application Insights Api Key - DeveloperAppInsightsAPIKey *string `json:"developerAppInsightsApiKey,omitempty"` - // DeveloperAppInsightsApplicationID - The Application Insights App Id - DeveloperAppInsightsApplicationID *string `json:"developerAppInsightsApplicationId,omitempty"` - // LuisAppIds - Collection of LUIS App Ids - LuisAppIds *[]string `json:"luisAppIds,omitempty"` - // LuisKey - The LUIS Key - LuisKey *string `json:"luisKey,omitempty"` - // IsCmekEnabled - Whether Cmek is enabled - IsCmekEnabled *bool `json:"isCmekEnabled,omitempty"` - // CmekKeyVaultURL - The CMK Url - CmekKeyVaultURL *string `json:"cmekKeyVaultUrl,omitempty"` - // CmekEncryptionStatus - READ-ONLY; The CMK encryption status - CmekEncryptionStatus *string `json:"cmekEncryptionStatus,omitempty"` - // PublicNetworkAccess - Whether the bot is in an isolated network. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // IsStreamingSupported - Whether the bot is streaming supported - IsStreamingSupported *bool `json:"isStreamingSupported,omitempty"` - // IsDeveloperAppInsightsAPIKeySet - READ-ONLY; Whether the bot is developerAppInsightsApiKey set - IsDeveloperAppInsightsAPIKeySet *bool `json:"isDeveloperAppInsightsApiKeySet,omitempty"` - // MigrationToken - READ-ONLY; Token used to migrate non Azure bot to azure subscription - MigrationToken *string `json:"migrationToken,omitempty"` - // DisableLocalAuth - Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. - DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` - // SchemaTransformationVersion - The channel schema transformation version for the bot - SchemaTransformationVersion *string `json:"schemaTransformationVersion,omitempty"` - // StorageResourceID - The storage resourceId for the bot - StorageResourceID *string `json:"storageResourceId,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of Private Endpoint Connections configured for the bot - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // OpenWithHint - The hint to browser (e.g. protocol handler) on how to open the bot for authoring - OpenWithHint *string `json:"openWithHint,omitempty"` - // AppPasswordHint - The hint (e.g. keyVault secret resourceId) on how to fetch the app secret - AppPasswordHint *string `json:"appPasswordHint,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // PublishingCredentials - Publishing credentials of the resource - PublishingCredentials *string `json:"publishingCredentials,omitempty"` -} - -// MarshalJSON is the custom marshaler for BotProperties. -func (bp BotProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bp.DisplayName != nil { - objectMap["displayName"] = bp.DisplayName - } - if bp.Description != nil { - objectMap["description"] = bp.Description - } - if bp.IconURL != nil { - objectMap["iconUrl"] = bp.IconURL - } - if bp.Endpoint != nil { - objectMap["endpoint"] = bp.Endpoint - } - if bp.AllSettings != nil { - objectMap["allSettings"] = bp.AllSettings - } - if bp.Parameters != nil { - objectMap["parameters"] = bp.Parameters - } - if bp.ManifestURL != nil { - objectMap["manifestUrl"] = bp.ManifestURL - } - if bp.MsaAppType != "" { - objectMap["msaAppType"] = bp.MsaAppType - } - if bp.MsaAppID != nil { - objectMap["msaAppId"] = bp.MsaAppID - } - if bp.MsaAppTenantID != nil { - objectMap["msaAppTenantId"] = bp.MsaAppTenantID - } - if bp.MsaAppMSIResourceID != nil { - objectMap["msaAppMSIResourceId"] = bp.MsaAppMSIResourceID - } - if bp.DeveloperAppInsightKey != nil { - objectMap["developerAppInsightKey"] = bp.DeveloperAppInsightKey - } - if bp.DeveloperAppInsightsAPIKey != nil { - objectMap["developerAppInsightsApiKey"] = bp.DeveloperAppInsightsAPIKey - } - if bp.DeveloperAppInsightsApplicationID != nil { - objectMap["developerAppInsightsApplicationId"] = bp.DeveloperAppInsightsApplicationID - } - if bp.LuisAppIds != nil { - objectMap["luisAppIds"] = bp.LuisAppIds - } - if bp.LuisKey != nil { - objectMap["luisKey"] = bp.LuisKey - } - if bp.IsCmekEnabled != nil { - objectMap["isCmekEnabled"] = bp.IsCmekEnabled - } - if bp.CmekKeyVaultURL != nil { - objectMap["cmekKeyVaultUrl"] = bp.CmekKeyVaultURL - } - if bp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = bp.PublicNetworkAccess - } - if bp.IsStreamingSupported != nil { - objectMap["isStreamingSupported"] = bp.IsStreamingSupported - } - if bp.DisableLocalAuth != nil { - objectMap["disableLocalAuth"] = bp.DisableLocalAuth - } - if bp.SchemaTransformationVersion != nil { - objectMap["schemaTransformationVersion"] = bp.SchemaTransformationVersion - } - if bp.StorageResourceID != nil { - objectMap["storageResourceId"] = bp.StorageResourceID - } - if bp.OpenWithHint != nil { - objectMap["openWithHint"] = bp.OpenWithHint - } - if bp.AppPasswordHint != nil { - objectMap["appPasswordHint"] = bp.AppPasswordHint - } - if bp.PublishingCredentials != nil { - objectMap["publishingCredentials"] = bp.PublishingCredentials - } - return json.Marshal(objectMap) -} - -// BotResponseList the list of bot service operation response. -type BotResponseList struct { - autorest.Response `json:"-"` - // NextLink - The link used to get the next page of bot service resources. - NextLink *string `json:"nextLink,omitempty"` - // Value - READ-ONLY; Gets the list of bot service results and their properties. - Value *[]Bot `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for BotResponseList. -func (brl BotResponseList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if brl.NextLink != nil { - objectMap["nextLink"] = brl.NextLink - } - return json.Marshal(objectMap) -} - -// BotResponseListIterator provides access to a complete listing of Bot values. -type BotResponseListIterator struct { - i int - page BotResponseListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BotResponseListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BotResponseListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BotResponseListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BotResponseListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BotResponseListIterator) Response() BotResponseList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BotResponseListIterator) Value() Bot { - if !iter.page.NotDone() { - return Bot{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BotResponseListIterator type. -func NewBotResponseListIterator(page BotResponseListPage) BotResponseListIterator { - return BotResponseListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (brl BotResponseList) IsEmpty() bool { - return brl.Value == nil || len(*brl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (brl BotResponseList) hasNextLink() bool { - return brl.NextLink != nil && len(*brl.NextLink) != 0 -} - -// botResponseListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (brl BotResponseList) botResponseListPreparer(ctx context.Context) (*http.Request, error) { - if !brl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(brl.NextLink))) -} - -// BotResponseListPage contains a page of Bot values. -type BotResponseListPage struct { - fn func(context.Context, BotResponseList) (BotResponseList, error) - brl BotResponseList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BotResponseListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BotResponseListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.brl) - if err != nil { - return err - } - page.brl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BotResponseListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BotResponseListPage) NotDone() bool { - return !page.brl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BotResponseListPage) Response() BotResponseList { - return page.brl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BotResponseListPage) Values() []Bot { - if page.brl.IsEmpty() { - return nil - } - return *page.brl.Value -} - -// Creates a new instance of the BotResponseListPage type. -func NewBotResponseListPage(cur BotResponseList, getNextPage func(context.Context, BotResponseList) (BotResponseList, error)) BotResponseListPage { - return BotResponseListPage{ - fn: getNextPage, - brl: cur, - } -} - -// BasicChannel channel definition -type BasicChannel interface { - AsAlexaChannel() (*AlexaChannel, bool) - AsFacebookChannel() (*FacebookChannel, bool) - AsEmailChannel() (*EmailChannel, bool) - AsMsTeamsChannel() (*MsTeamsChannel, bool) - AsSkypeChannel() (*SkypeChannel, bool) - AsKikChannel() (*KikChannel, bool) - AsWebChatChannel() (*WebChatChannel, bool) - AsDirectLineChannel() (*DirectLineChannel, bool) - AsTelegramChannel() (*TelegramChannel, bool) - AsSmsChannel() (*SmsChannel, bool) - AsSlackChannel() (*SlackChannel, bool) - AsLineChannel() (*LineChannel, bool) - AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) - AsChannel() (*Channel, bool) -} - -// Channel channel definition -type Channel struct { - // Etag - Entity Tag of the resource - Etag *string `json:"etag,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel' - ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` -} - -func unmarshalBasicChannel(body []byte) (BasicChannel, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["channelName"] { - case string(ChannelNameBasicChannelChannelNameAlexaChannel): - var ac AlexaChannel - err := json.Unmarshal(body, &ac) - return ac, err - case string(ChannelNameBasicChannelChannelNameFacebookChannel): - var fc FacebookChannel - err := json.Unmarshal(body, &fc) - return fc, err - case string(ChannelNameBasicChannelChannelNameEmailChannel): - var ec EmailChannel - err := json.Unmarshal(body, &ec) - return ec, err - case string(ChannelNameBasicChannelChannelNameMsTeamsChannel): - var mtc MsTeamsChannel - err := json.Unmarshal(body, &mtc) - return mtc, err - case string(ChannelNameBasicChannelChannelNameSkypeChannel): - var sc SkypeChannel - err := json.Unmarshal(body, &sc) - return sc, err - case string(ChannelNameBasicChannelChannelNameKikChannel): - var kc KikChannel - err := json.Unmarshal(body, &kc) - return kc, err - case string(ChannelNameBasicChannelChannelNameWebChatChannel): - var wcc WebChatChannel - err := json.Unmarshal(body, &wcc) - return wcc, err - case string(ChannelNameBasicChannelChannelNameDirectLineChannel): - var dlc DirectLineChannel - err := json.Unmarshal(body, &dlc) - return dlc, err - case string(ChannelNameBasicChannelChannelNameTelegramChannel): - var tc TelegramChannel - err := json.Unmarshal(body, &tc) - return tc, err - case string(ChannelNameBasicChannelChannelNameSmsChannel): - var sc SmsChannel - err := json.Unmarshal(body, &sc) - return sc, err - case string(ChannelNameBasicChannelChannelNameSlackChannel): - var sc SlackChannel - err := json.Unmarshal(body, &sc) - return sc, err - case string(ChannelNameBasicChannelChannelNameLineChannel): - var lc LineChannel - err := json.Unmarshal(body, &lc) - return lc, err - case string(ChannelNameBasicChannelChannelNameDirectLineSpeechChannel): - var dlsc DirectLineSpeechChannel - err := json.Unmarshal(body, &dlsc) - return dlsc, err - default: - var c Channel - err := json.Unmarshal(body, &c) - return c, err - } -} -func unmarshalBasicChannelArray(body []byte) ([]BasicChannel, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - cArray := make([]BasicChannel, len(rawMessages)) - - for index, rawMessage := range rawMessages { - c, err := unmarshalBasicChannel(*rawMessage) - if err != nil { - return nil, err - } - cArray[index] = c - } - return cArray, nil -} - -// MarshalJSON is the custom marshaler for Channel. -func (c Channel) MarshalJSON() ([]byte, error) { - c.ChannelName = ChannelNameBasicChannelChannelNameChannel - objectMap := make(map[string]interface{}) - if c.Etag != nil { - objectMap["etag"] = c.Etag - } - if c.Location != nil { - objectMap["location"] = c.Location - } - if c.ChannelName != "" { - objectMap["channelName"] = c.ChannelName - } - return json.Marshal(objectMap) -} - -// AsAlexaChannel is the BasicChannel implementation for Channel. -func (c Channel) AsAlexaChannel() (*AlexaChannel, bool) { - return nil, false -} - -// AsFacebookChannel is the BasicChannel implementation for Channel. -func (c Channel) AsFacebookChannel() (*FacebookChannel, bool) { - return nil, false -} - -// AsEmailChannel is the BasicChannel implementation for Channel. -func (c Channel) AsEmailChannel() (*EmailChannel, bool) { - return nil, false -} - -// AsMsTeamsChannel is the BasicChannel implementation for Channel. -func (c Channel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { - return nil, false -} - -// AsSkypeChannel is the BasicChannel implementation for Channel. -func (c Channel) AsSkypeChannel() (*SkypeChannel, bool) { - return nil, false -} - -// AsKikChannel is the BasicChannel implementation for Channel. -func (c Channel) AsKikChannel() (*KikChannel, bool) { - return nil, false -} - -// AsWebChatChannel is the BasicChannel implementation for Channel. -func (c Channel) AsWebChatChannel() (*WebChatChannel, bool) { - return nil, false -} - -// AsDirectLineChannel is the BasicChannel implementation for Channel. -func (c Channel) AsDirectLineChannel() (*DirectLineChannel, bool) { - return nil, false -} - -// AsTelegramChannel is the BasicChannel implementation for Channel. -func (c Channel) AsTelegramChannel() (*TelegramChannel, bool) { - return nil, false -} - -// AsSmsChannel is the BasicChannel implementation for Channel. -func (c Channel) AsSmsChannel() (*SmsChannel, bool) { - return nil, false -} - -// AsSlackChannel is the BasicChannel implementation for Channel. -func (c Channel) AsSlackChannel() (*SlackChannel, bool) { - return nil, false -} - -// AsLineChannel is the BasicChannel implementation for Channel. -func (c Channel) AsLineChannel() (*LineChannel, bool) { - return nil, false -} - -// AsDirectLineSpeechChannel is the BasicChannel implementation for Channel. -func (c Channel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { - return nil, false -} - -// AsChannel is the BasicChannel implementation for Channel. -func (c Channel) AsChannel() (*Channel, bool) { - return &c, true -} - -// AsBasicChannel is the BasicChannel implementation for Channel. -func (c Channel) AsBasicChannel() (BasicChannel, bool) { - return &c, true -} - -// ChannelResponseList the list of bot service channel operation response. -type ChannelResponseList struct { - autorest.Response `json:"-"` - // NextLink - The link used to get the next page of bot service channel resources. - NextLink *string `json:"nextLink,omitempty"` - // Value - READ-ONLY; Gets the list of bot service channel results and their properties. - Value *[]BotChannel `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for ChannelResponseList. -func (crl ChannelResponseList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if crl.NextLink != nil { - objectMap["nextLink"] = crl.NextLink - } - return json.Marshal(objectMap) -} - -// ChannelResponseListIterator provides access to a complete listing of BotChannel values. -type ChannelResponseListIterator struct { - i int - page ChannelResponseListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ChannelResponseListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ChannelResponseListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ChannelResponseListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ChannelResponseListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ChannelResponseListIterator) Response() ChannelResponseList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ChannelResponseListIterator) Value() BotChannel { - if !iter.page.NotDone() { - return BotChannel{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ChannelResponseListIterator type. -func NewChannelResponseListIterator(page ChannelResponseListPage) ChannelResponseListIterator { - return ChannelResponseListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (crl ChannelResponseList) IsEmpty() bool { - return crl.Value == nil || len(*crl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (crl ChannelResponseList) hasNextLink() bool { - return crl.NextLink != nil && len(*crl.NextLink) != 0 -} - -// channelResponseListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (crl ChannelResponseList) channelResponseListPreparer(ctx context.Context) (*http.Request, error) { - if !crl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(crl.NextLink))) -} - -// ChannelResponseListPage contains a page of BotChannel values. -type ChannelResponseListPage struct { - fn func(context.Context, ChannelResponseList) (ChannelResponseList, error) - crl ChannelResponseList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ChannelResponseListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ChannelResponseListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.crl) - if err != nil { - return err - } - page.crl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ChannelResponseListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ChannelResponseListPage) NotDone() bool { - return !page.crl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ChannelResponseListPage) Response() ChannelResponseList { - return page.crl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ChannelResponseListPage) Values() []BotChannel { - if page.crl.IsEmpty() { - return nil - } - return *page.crl.Value -} - -// Creates a new instance of the ChannelResponseListPage type. -func NewChannelResponseListPage(cur ChannelResponseList, getNextPage func(context.Context, ChannelResponseList) (ChannelResponseList, error)) ChannelResponseListPage { - return ChannelResponseListPage{ - fn: getNextPage, - crl: cur, - } -} - -// ChannelSettings channel settings definition -type ChannelSettings struct { - // ExtensionKey1 - The extensionKey1 - ExtensionKey1 *string `json:"extensionKey1,omitempty"` - // ExtensionKey2 - The extensionKey2 - ExtensionKey2 *string `json:"extensionKey2,omitempty"` - // Sites - The list of sites - Sites *[]Site `json:"sites,omitempty"` - // ChannelID - The channel id - ChannelID *string `json:"channelId,omitempty"` - // ChannelDisplayName - The channel display name - ChannelDisplayName *string `json:"channelDisplayName,omitempty"` - // BotID - The bot id - BotID *string `json:"botId,omitempty"` - // BotIconURL - The bot icon url - BotIconURL *string `json:"botIconUrl,omitempty"` - // IsEnabled - Whether this channel is enabled for the bot - IsEnabled *bool `json:"isEnabled,omitempty"` - // DisableLocalAuth - Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. - DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` -} - -// CheckNameAvailabilityRequestBody the request body for a request to Bot Service Management to check -// availability of a bot name. -type CheckNameAvailabilityRequestBody struct { - // Name - the name of the bot for which availability needs to be checked. - Name *string `json:"name,omitempty"` - // Type - the type of the bot for which availability needs to be checked - Type *string `json:"type,omitempty"` -} - -// CheckNameAvailabilityResponseBody the response body returned for a request to Bot Service Management to -// check availability of a bot name. -type CheckNameAvailabilityResponseBody struct { - autorest.Response `json:"-"` - // Valid - indicates if the bot name is valid. - Valid *bool `json:"valid,omitempty"` - // Message - additional message from the bot management api showing why a bot name is not available - Message *string `json:"message,omitempty"` -} - -// ConnectionItemName the display name of a connection Item Setting registered with the Bot -type ConnectionItemName struct { - // Name - READ-ONLY; Connection Item name that has been added in the API - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionItemName. -func (cin ConnectionItemName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConnectionSetting bot channel resource definition -type ConnectionSetting struct { - autorest.Response `json:"-"` - // Properties - The set of properties specific to bot channel resource - Properties *ConnectionSettingProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Specifies the resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Specifies the name of the resource. - Name *string `json:"name,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // Type - READ-ONLY; Specifies the type of the resource. - Type *string `json:"type,omitempty"` - // Tags - Contains resource tags defined as key/value pairs. - Tags map[string]*string `json:"tags"` - // Sku - Gets or sets the SKU of the resource. - Sku *Sku `json:"sku,omitempty"` - // Kind - Required. Gets or sets the Kind of the resource. Possible values include: 'KindSdk', 'KindDesigner', 'KindBot', 'KindFunction', 'KindAzurebot' - Kind Kind `json:"kind,omitempty"` - // Etag - Entity Tag - Etag *string `json:"etag,omitempty"` - // Zones - READ-ONLY; Entity zones - Zones *[]string `json:"zones,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionSetting. -func (cs ConnectionSetting) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cs.Properties != nil { - objectMap["properties"] = cs.Properties - } - if cs.Location != nil { - objectMap["location"] = cs.Location - } - if cs.Tags != nil { - objectMap["tags"] = cs.Tags - } - if cs.Sku != nil { - objectMap["sku"] = cs.Sku - } - if cs.Kind != "" { - objectMap["kind"] = cs.Kind - } - if cs.Etag != nil { - objectMap["etag"] = cs.Etag - } - return json.Marshal(objectMap) -} - -// ConnectionSettingParameter extra Parameter in a Connection Setting Properties to indicate service -// provider specific properties -type ConnectionSettingParameter struct { - // Key - Key for the Connection Setting Parameter. - Key *string `json:"key,omitempty"` - // Value - Value associated with the Connection Setting Parameter. - Value *string `json:"value,omitempty"` -} - -// ConnectionSettingProperties properties for a Connection Setting Item -type ConnectionSettingProperties struct { - // ID - Id associated with the Connection Setting. - ID *string `json:"id,omitempty"` - // Name - Name associated with the Connection Setting. - Name *string `json:"name,omitempty"` - // ClientID - Client Id associated with the Connection Setting. - ClientID *string `json:"clientId,omitempty"` - // SettingID - READ-ONLY; Setting Id set by the service for the Connection Setting. - SettingID *string `json:"settingId,omitempty"` - // ClientSecret - Client Secret associated with the Connection Setting - ClientSecret *string `json:"clientSecret,omitempty"` - // Scopes - Scopes associated with the Connection Setting - Scopes *string `json:"scopes,omitempty"` - // ServiceProviderID - Service Provider Id associated with the Connection Setting - ServiceProviderID *string `json:"serviceProviderId,omitempty"` - // ServiceProviderDisplayName - Service Provider Display Name associated with the Connection Setting - ServiceProviderDisplayName *string `json:"serviceProviderDisplayName,omitempty"` - // Parameters - Service Provider Parameters associated with the Connection Setting - Parameters *[]ConnectionSettingParameter `json:"parameters,omitempty"` - // ProvisioningState - Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionSettingProperties. -func (csp ConnectionSettingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if csp.ID != nil { - objectMap["id"] = csp.ID - } - if csp.Name != nil { - objectMap["name"] = csp.Name - } - if csp.ClientID != nil { - objectMap["clientId"] = csp.ClientID - } - if csp.ClientSecret != nil { - objectMap["clientSecret"] = csp.ClientSecret - } - if csp.Scopes != nil { - objectMap["scopes"] = csp.Scopes - } - if csp.ServiceProviderID != nil { - objectMap["serviceProviderId"] = csp.ServiceProviderID - } - if csp.ServiceProviderDisplayName != nil { - objectMap["serviceProviderDisplayName"] = csp.ServiceProviderDisplayName - } - if csp.Parameters != nil { - objectMap["parameters"] = csp.Parameters - } - if csp.ProvisioningState != nil { - objectMap["provisioningState"] = csp.ProvisioningState - } - return json.Marshal(objectMap) -} - -// ConnectionSettingResponseList the list of bot service connection settings response. -type ConnectionSettingResponseList struct { - autorest.Response `json:"-"` - // NextLink - The link used to get the next page of bot service connection setting resources. - NextLink *string `json:"nextLink,omitempty"` - // Value - READ-ONLY; Gets the list of bot service connection settings and their properties. - Value *[]ConnectionSetting `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionSettingResponseList. -func (csrl ConnectionSettingResponseList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if csrl.NextLink != nil { - objectMap["nextLink"] = csrl.NextLink - } - return json.Marshal(objectMap) -} - -// ConnectionSettingResponseListIterator provides access to a complete listing of ConnectionSetting values. -type ConnectionSettingResponseListIterator struct { - i int - page ConnectionSettingResponseListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ConnectionSettingResponseListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionSettingResponseListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ConnectionSettingResponseListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ConnectionSettingResponseListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ConnectionSettingResponseListIterator) Response() ConnectionSettingResponseList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ConnectionSettingResponseListIterator) Value() ConnectionSetting { - if !iter.page.NotDone() { - return ConnectionSetting{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ConnectionSettingResponseListIterator type. -func NewConnectionSettingResponseListIterator(page ConnectionSettingResponseListPage) ConnectionSettingResponseListIterator { - return ConnectionSettingResponseListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (csrl ConnectionSettingResponseList) IsEmpty() bool { - return csrl.Value == nil || len(*csrl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (csrl ConnectionSettingResponseList) hasNextLink() bool { - return csrl.NextLink != nil && len(*csrl.NextLink) != 0 -} - -// connectionSettingResponseListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (csrl ConnectionSettingResponseList) connectionSettingResponseListPreparer(ctx context.Context) (*http.Request, error) { - if !csrl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(csrl.NextLink))) -} - -// ConnectionSettingResponseListPage contains a page of ConnectionSetting values. -type ConnectionSettingResponseListPage struct { - fn func(context.Context, ConnectionSettingResponseList) (ConnectionSettingResponseList, error) - csrl ConnectionSettingResponseList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ConnectionSettingResponseListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionSettingResponseListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.csrl) - if err != nil { - return err - } - page.csrl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ConnectionSettingResponseListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ConnectionSettingResponseListPage) NotDone() bool { - return !page.csrl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ConnectionSettingResponseListPage) Response() ConnectionSettingResponseList { - return page.csrl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ConnectionSettingResponseListPage) Values() []ConnectionSetting { - if page.csrl.IsEmpty() { - return nil - } - return *page.csrl.Value -} - -// Creates a new instance of the ConnectionSettingResponseListPage type. -func NewConnectionSettingResponseListPage(cur ConnectionSettingResponseList, getNextPage func(context.Context, ConnectionSettingResponseList) (ConnectionSettingResponseList, error)) ConnectionSettingResponseListPage { - return ConnectionSettingResponseListPage{ - fn: getNextPage, - csrl: cur, - } -} - -// DirectLineChannel direct Line channel definition -type DirectLineChannel struct { - // Properties - The set of properties specific to Direct Line channel resource - Properties *DirectLineChannelProperties `json:"properties,omitempty"` - // Etag - Entity Tag of the resource - Etag *string `json:"etag,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel' - ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` -} - -// MarshalJSON is the custom marshaler for DirectLineChannel. -func (dlc DirectLineChannel) MarshalJSON() ([]byte, error) { - dlc.ChannelName = ChannelNameBasicChannelChannelNameDirectLineChannel - objectMap := make(map[string]interface{}) - if dlc.Properties != nil { - objectMap["properties"] = dlc.Properties - } - if dlc.Etag != nil { - objectMap["etag"] = dlc.Etag - } - if dlc.Location != nil { - objectMap["location"] = dlc.Location - } - if dlc.ChannelName != "" { - objectMap["channelName"] = dlc.ChannelName - } - return json.Marshal(objectMap) -} - -// AsAlexaChannel is the BasicChannel implementation for DirectLineChannel. -func (dlc DirectLineChannel) AsAlexaChannel() (*AlexaChannel, bool) { - return nil, false -} - -// AsFacebookChannel is the BasicChannel implementation for DirectLineChannel. -func (dlc DirectLineChannel) AsFacebookChannel() (*FacebookChannel, bool) { - return nil, false -} - -// AsEmailChannel is the BasicChannel implementation for DirectLineChannel. -func (dlc DirectLineChannel) AsEmailChannel() (*EmailChannel, bool) { - return nil, false -} - -// AsMsTeamsChannel is the BasicChannel implementation for DirectLineChannel. -func (dlc DirectLineChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { - return nil, false -} - -// AsSkypeChannel is the BasicChannel implementation for DirectLineChannel. -func (dlc DirectLineChannel) AsSkypeChannel() (*SkypeChannel, bool) { - return nil, false -} - -// AsKikChannel is the BasicChannel implementation for DirectLineChannel. -func (dlc DirectLineChannel) AsKikChannel() (*KikChannel, bool) { - return nil, false -} - -// AsWebChatChannel is the BasicChannel implementation for DirectLineChannel. -func (dlc DirectLineChannel) AsWebChatChannel() (*WebChatChannel, bool) { - return nil, false -} - -// AsDirectLineChannel is the BasicChannel implementation for DirectLineChannel. -func (dlc DirectLineChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { - return &dlc, true -} - -// AsTelegramChannel is the BasicChannel implementation for DirectLineChannel. -func (dlc DirectLineChannel) AsTelegramChannel() (*TelegramChannel, bool) { - return nil, false -} - -// AsSmsChannel is the BasicChannel implementation for DirectLineChannel. -func (dlc DirectLineChannel) AsSmsChannel() (*SmsChannel, bool) { - return nil, false -} - -// AsSlackChannel is the BasicChannel implementation for DirectLineChannel. -func (dlc DirectLineChannel) AsSlackChannel() (*SlackChannel, bool) { - return nil, false -} - -// AsLineChannel is the BasicChannel implementation for DirectLineChannel. -func (dlc DirectLineChannel) AsLineChannel() (*LineChannel, bool) { - return nil, false -} - -// AsDirectLineSpeechChannel is the BasicChannel implementation for DirectLineChannel. -func (dlc DirectLineChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { - return nil, false -} - -// AsChannel is the BasicChannel implementation for DirectLineChannel. -func (dlc DirectLineChannel) AsChannel() (*Channel, bool) { - return nil, false -} - -// AsBasicChannel is the BasicChannel implementation for DirectLineChannel. -func (dlc DirectLineChannel) AsBasicChannel() (BasicChannel, bool) { - return &dlc, true -} - -// DirectLineChannelProperties the parameters to provide for the Direct Line channel. -type DirectLineChannelProperties struct { - // Sites - The list of Direct Line sites - Sites *[]DirectLineSite `json:"sites,omitempty"` - // DirectLineEmbedCode - Direct Line embed code of the resource - DirectLineEmbedCode *string `json:"DirectLineEmbedCode,omitempty"` -} - -// DirectLineSite a site for the Direct Line channel -type DirectLineSite struct { - // SiteID - READ-ONLY; Site Id - SiteID *string `json:"siteId,omitempty"` - // SiteName - Site name - SiteName *string `json:"siteName,omitempty"` - // Key - READ-ONLY; Primary key. Value only returned through POST to the action Channel List API, otherwise empty. - Key *string `json:"key,omitempty"` - // Key2 - READ-ONLY; Secondary key. Value only returned through POST to the action Channel List API, otherwise empty. - Key2 *string `json:"key2,omitempty"` - // IsEnabled - Whether this site is enabled for DirectLine channel. - IsEnabled *bool `json:"isEnabled,omitempty"` - // IsV1Enabled - Whether this site is enabled for Bot Framework V1 protocol. - IsV1Enabled *bool `json:"isV1Enabled,omitempty"` - // IsV3Enabled - Whether this site is enabled for Bot Framework V1 protocol. - IsV3Enabled *bool `json:"isV3Enabled,omitempty"` - // IsSecureSiteEnabled - Whether this site is enabled for authentication with Bot Framework. - IsSecureSiteEnabled *bool `json:"isSecureSiteEnabled,omitempty"` - // IsBlockUserUploadEnabled - Whether this site is enabled for block user upload. - IsBlockUserUploadEnabled *bool `json:"isBlockUserUploadEnabled,omitempty"` - // TrustedOrigins - List of Trusted Origin URLs for this site. This field is applicable only if isSecureSiteEnabled is True. - TrustedOrigins *[]string `json:"trustedOrigins,omitempty"` -} - -// MarshalJSON is the custom marshaler for DirectLineSite. -func (dls DirectLineSite) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dls.SiteName != nil { - objectMap["siteName"] = dls.SiteName - } - if dls.IsEnabled != nil { - objectMap["isEnabled"] = dls.IsEnabled - } - if dls.IsV1Enabled != nil { - objectMap["isV1Enabled"] = dls.IsV1Enabled - } - if dls.IsV3Enabled != nil { - objectMap["isV3Enabled"] = dls.IsV3Enabled - } - if dls.IsSecureSiteEnabled != nil { - objectMap["isSecureSiteEnabled"] = dls.IsSecureSiteEnabled - } - if dls.IsBlockUserUploadEnabled != nil { - objectMap["isBlockUserUploadEnabled"] = dls.IsBlockUserUploadEnabled - } - if dls.TrustedOrigins != nil { - objectMap["trustedOrigins"] = dls.TrustedOrigins - } - return json.Marshal(objectMap) -} - -// DirectLineSpeechChannel directLine Speech channel definition -type DirectLineSpeechChannel struct { - // Properties - The set of properties specific to DirectLine Speech channel resource - Properties *DirectLineSpeechChannelProperties `json:"properties,omitempty"` - // Etag - Entity Tag of the resource - Etag *string `json:"etag,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel' - ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` -} - -// MarshalJSON is the custom marshaler for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) MarshalJSON() ([]byte, error) { - dlsc.ChannelName = ChannelNameBasicChannelChannelNameDirectLineSpeechChannel - objectMap := make(map[string]interface{}) - if dlsc.Properties != nil { - objectMap["properties"] = dlsc.Properties - } - if dlsc.Etag != nil { - objectMap["etag"] = dlsc.Etag - } - if dlsc.Location != nil { - objectMap["location"] = dlsc.Location - } - if dlsc.ChannelName != "" { - objectMap["channelName"] = dlsc.ChannelName - } - return json.Marshal(objectMap) -} - -// AsAlexaChannel is the BasicChannel implementation for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) AsAlexaChannel() (*AlexaChannel, bool) { - return nil, false -} - -// AsFacebookChannel is the BasicChannel implementation for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) AsFacebookChannel() (*FacebookChannel, bool) { - return nil, false -} - -// AsEmailChannel is the BasicChannel implementation for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) AsEmailChannel() (*EmailChannel, bool) { - return nil, false -} - -// AsMsTeamsChannel is the BasicChannel implementation for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { - return nil, false -} - -// AsSkypeChannel is the BasicChannel implementation for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) AsSkypeChannel() (*SkypeChannel, bool) { - return nil, false -} - -// AsKikChannel is the BasicChannel implementation for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) AsKikChannel() (*KikChannel, bool) { - return nil, false -} - -// AsWebChatChannel is the BasicChannel implementation for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) AsWebChatChannel() (*WebChatChannel, bool) { - return nil, false -} - -// AsDirectLineChannel is the BasicChannel implementation for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { - return nil, false -} - -// AsTelegramChannel is the BasicChannel implementation for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) AsTelegramChannel() (*TelegramChannel, bool) { - return nil, false -} - -// AsSmsChannel is the BasicChannel implementation for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) AsSmsChannel() (*SmsChannel, bool) { - return nil, false -} - -// AsSlackChannel is the BasicChannel implementation for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) AsSlackChannel() (*SlackChannel, bool) { - return nil, false -} - -// AsLineChannel is the BasicChannel implementation for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) AsLineChannel() (*LineChannel, bool) { - return nil, false -} - -// AsDirectLineSpeechChannel is the BasicChannel implementation for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { - return &dlsc, true -} - -// AsChannel is the BasicChannel implementation for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) AsChannel() (*Channel, bool) { - return nil, false -} - -// AsBasicChannel is the BasicChannel implementation for DirectLineSpeechChannel. -func (dlsc DirectLineSpeechChannel) AsBasicChannel() (BasicChannel, bool) { - return &dlsc, true -} - -// DirectLineSpeechChannelProperties the parameters to provide for the DirectLine Speech channel. -type DirectLineSpeechChannelProperties struct { - // CognitiveServiceRegion - The cognitive service region with this channel registration. - CognitiveServiceRegion *string `json:"cognitiveServiceRegion,omitempty"` - // CognitiveServiceSubscriptionKey - The cognitive service subscription key to use with this channel registration. - CognitiveServiceSubscriptionKey *string `json:"cognitiveServiceSubscriptionKey,omitempty"` - // IsEnabled - Whether this channel is enabled or not. - IsEnabled *bool `json:"isEnabled,omitempty"` - // CustomVoiceDeploymentID - Custom speech model id (optional). - CustomVoiceDeploymentID *string `json:"customVoiceDeploymentId,omitempty"` - // CustomSpeechModelID - Custom voice deployment id (optional). - CustomSpeechModelID *string `json:"customSpeechModelId,omitempty"` - // IsDefaultBotForCogSvcAccount - Make this a default bot for chosen cognitive service account. - IsDefaultBotForCogSvcAccount *bool `json:"isDefaultBotForCogSvcAccount,omitempty"` -} - -// EmailChannel email channel definition -type EmailChannel struct { - // Properties - The set of properties specific to email channel resource - Properties *EmailChannelProperties `json:"properties,omitempty"` - // Etag - Entity Tag of the resource - Etag *string `json:"etag,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel' - ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` -} - -// MarshalJSON is the custom marshaler for EmailChannel. -func (ec EmailChannel) MarshalJSON() ([]byte, error) { - ec.ChannelName = ChannelNameBasicChannelChannelNameEmailChannel - objectMap := make(map[string]interface{}) - if ec.Properties != nil { - objectMap["properties"] = ec.Properties - } - if ec.Etag != nil { - objectMap["etag"] = ec.Etag - } - if ec.Location != nil { - objectMap["location"] = ec.Location - } - if ec.ChannelName != "" { - objectMap["channelName"] = ec.ChannelName - } - return json.Marshal(objectMap) -} - -// AsAlexaChannel is the BasicChannel implementation for EmailChannel. -func (ec EmailChannel) AsAlexaChannel() (*AlexaChannel, bool) { - return nil, false -} - -// AsFacebookChannel is the BasicChannel implementation for EmailChannel. -func (ec EmailChannel) AsFacebookChannel() (*FacebookChannel, bool) { - return nil, false -} - -// AsEmailChannel is the BasicChannel implementation for EmailChannel. -func (ec EmailChannel) AsEmailChannel() (*EmailChannel, bool) { - return &ec, true -} - -// AsMsTeamsChannel is the BasicChannel implementation for EmailChannel. -func (ec EmailChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { - return nil, false -} - -// AsSkypeChannel is the BasicChannel implementation for EmailChannel. -func (ec EmailChannel) AsSkypeChannel() (*SkypeChannel, bool) { - return nil, false -} - -// AsKikChannel is the BasicChannel implementation for EmailChannel. -func (ec EmailChannel) AsKikChannel() (*KikChannel, bool) { - return nil, false -} - -// AsWebChatChannel is the BasicChannel implementation for EmailChannel. -func (ec EmailChannel) AsWebChatChannel() (*WebChatChannel, bool) { - return nil, false -} - -// AsDirectLineChannel is the BasicChannel implementation for EmailChannel. -func (ec EmailChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { - return nil, false -} - -// AsTelegramChannel is the BasicChannel implementation for EmailChannel. -func (ec EmailChannel) AsTelegramChannel() (*TelegramChannel, bool) { - return nil, false -} - -// AsSmsChannel is the BasicChannel implementation for EmailChannel. -func (ec EmailChannel) AsSmsChannel() (*SmsChannel, bool) { - return nil, false -} - -// AsSlackChannel is the BasicChannel implementation for EmailChannel. -func (ec EmailChannel) AsSlackChannel() (*SlackChannel, bool) { - return nil, false -} - -// AsLineChannel is the BasicChannel implementation for EmailChannel. -func (ec EmailChannel) AsLineChannel() (*LineChannel, bool) { - return nil, false -} - -// AsDirectLineSpeechChannel is the BasicChannel implementation for EmailChannel. -func (ec EmailChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { - return nil, false -} - -// AsChannel is the BasicChannel implementation for EmailChannel. -func (ec EmailChannel) AsChannel() (*Channel, bool) { - return nil, false -} - -// AsBasicChannel is the BasicChannel implementation for EmailChannel. -func (ec EmailChannel) AsBasicChannel() (BasicChannel, bool) { - return &ec, true -} - -// EmailChannelProperties the parameters to provide for the Email channel. -type EmailChannelProperties struct { - // EmailAddress - The email address - EmailAddress *string `json:"emailAddress,omitempty"` - // Password - The password for the email address. Value only returned through POST to the action Channel List API, otherwise empty. - Password *string `json:"password,omitempty"` - // IsEnabled - Whether this channel is enabled for the bot - IsEnabled *bool `json:"isEnabled,omitempty"` -} - -// Error bot Service error object. -type Error struct { - // Error - The error body. - Error *ErrorBody `json:"error,omitempty"` -} - -// ErrorBody bot Service error body. -type ErrorBody struct { - // Code - error code - Code *string `json:"code,omitempty"` - // Message - error message - Message *string `json:"message,omitempty"` -} - -// FacebookChannel facebook channel definition -type FacebookChannel struct { - // Properties - The set of properties specific to bot facebook channel - Properties *FacebookChannelProperties `json:"properties,omitempty"` - // Etag - Entity Tag of the resource - Etag *string `json:"etag,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel' - ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` -} - -// MarshalJSON is the custom marshaler for FacebookChannel. -func (fc FacebookChannel) MarshalJSON() ([]byte, error) { - fc.ChannelName = ChannelNameBasicChannelChannelNameFacebookChannel - objectMap := make(map[string]interface{}) - if fc.Properties != nil { - objectMap["properties"] = fc.Properties - } - if fc.Etag != nil { - objectMap["etag"] = fc.Etag - } - if fc.Location != nil { - objectMap["location"] = fc.Location - } - if fc.ChannelName != "" { - objectMap["channelName"] = fc.ChannelName - } - return json.Marshal(objectMap) -} - -// AsAlexaChannel is the BasicChannel implementation for FacebookChannel. -func (fc FacebookChannel) AsAlexaChannel() (*AlexaChannel, bool) { - return nil, false -} - -// AsFacebookChannel is the BasicChannel implementation for FacebookChannel. -func (fc FacebookChannel) AsFacebookChannel() (*FacebookChannel, bool) { - return &fc, true -} - -// AsEmailChannel is the BasicChannel implementation for FacebookChannel. -func (fc FacebookChannel) AsEmailChannel() (*EmailChannel, bool) { - return nil, false -} - -// AsMsTeamsChannel is the BasicChannel implementation for FacebookChannel. -func (fc FacebookChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { - return nil, false -} - -// AsSkypeChannel is the BasicChannel implementation for FacebookChannel. -func (fc FacebookChannel) AsSkypeChannel() (*SkypeChannel, bool) { - return nil, false -} - -// AsKikChannel is the BasicChannel implementation for FacebookChannel. -func (fc FacebookChannel) AsKikChannel() (*KikChannel, bool) { - return nil, false -} - -// AsWebChatChannel is the BasicChannel implementation for FacebookChannel. -func (fc FacebookChannel) AsWebChatChannel() (*WebChatChannel, bool) { - return nil, false -} - -// AsDirectLineChannel is the BasicChannel implementation for FacebookChannel. -func (fc FacebookChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { - return nil, false -} - -// AsTelegramChannel is the BasicChannel implementation for FacebookChannel. -func (fc FacebookChannel) AsTelegramChannel() (*TelegramChannel, bool) { - return nil, false -} - -// AsSmsChannel is the BasicChannel implementation for FacebookChannel. -func (fc FacebookChannel) AsSmsChannel() (*SmsChannel, bool) { - return nil, false -} - -// AsSlackChannel is the BasicChannel implementation for FacebookChannel. -func (fc FacebookChannel) AsSlackChannel() (*SlackChannel, bool) { - return nil, false -} - -// AsLineChannel is the BasicChannel implementation for FacebookChannel. -func (fc FacebookChannel) AsLineChannel() (*LineChannel, bool) { - return nil, false -} - -// AsDirectLineSpeechChannel is the BasicChannel implementation for FacebookChannel. -func (fc FacebookChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { - return nil, false -} - -// AsChannel is the BasicChannel implementation for FacebookChannel. -func (fc FacebookChannel) AsChannel() (*Channel, bool) { - return nil, false -} - -// AsBasicChannel is the BasicChannel implementation for FacebookChannel. -func (fc FacebookChannel) AsBasicChannel() (BasicChannel, bool) { - return &fc, true -} - -// FacebookChannelProperties the parameters to provide for the Facebook channel. -type FacebookChannelProperties struct { - // VerifyToken - READ-ONLY; Verify token. Value only returned through POST to the action Channel List API, otherwise empty. - VerifyToken *string `json:"verifyToken,omitempty"` - // Pages - The list of Facebook pages - Pages *[]FacebookPage `json:"pages,omitempty"` - // AppID - Facebook application id - AppID *string `json:"appId,omitempty"` - // AppSecret - Facebook application secret. Value only returned through POST to the action Channel List API, otherwise empty. - AppSecret *string `json:"appSecret,omitempty"` - // CallbackURL - READ-ONLY; Callback Url - CallbackURL *string `json:"callbackUrl,omitempty"` - // IsEnabled - Whether this channel is enabled for the bot - IsEnabled *bool `json:"isEnabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for FacebookChannelProperties. -func (fcp FacebookChannelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fcp.Pages != nil { - objectMap["pages"] = fcp.Pages - } - if fcp.AppID != nil { - objectMap["appId"] = fcp.AppID - } - if fcp.AppSecret != nil { - objectMap["appSecret"] = fcp.AppSecret - } - if fcp.IsEnabled != nil { - objectMap["isEnabled"] = fcp.IsEnabled - } - return json.Marshal(objectMap) -} - -// FacebookPage a Facebook page for Facebook channel registration -type FacebookPage struct { - // ID - Page id - ID *string `json:"id,omitempty"` - // AccessToken - Facebook application access token. Value only returned through POST to the action Channel List API, otherwise empty. - AccessToken *string `json:"accessToken,omitempty"` -} - -// HostSettingsResponse the response body returned for a request to Bot Service Management to check per -// subscription hostSettings -type HostSettingsResponse struct { - autorest.Response `json:"-"` - // OAuthURL - For in-conversation bot user authentication - OAuthURL *string `json:"OAuthUrl,omitempty"` - // ToBotFromChannelOpenIDMetadataURL - For verifying incoming tokens from the channels - ToBotFromChannelOpenIDMetadataURL *string `json:"ToBotFromChannelOpenIdMetadataUrl,omitempty"` - // ToBotFromChannelTokenIssuer - For verifying incoming tokens from the channels - ToBotFromChannelTokenIssuer *string `json:"ToBotFromChannelTokenIssuer,omitempty"` - // ToBotFromEmulatorOpenIDMetadataURL - For verifying incoming tokens from bot emulator - ToBotFromEmulatorOpenIDMetadataURL *string `json:"ToBotFromEmulatorOpenIdMetadataUrl,omitempty"` - // ToChannelFromBotLoginURL - For getting access token to channels from bot host - ToChannelFromBotLoginURL *string `json:"ToChannelFromBotLoginUrl,omitempty"` - // ToChannelFromBotOAuthScope - For getting access token to channels from bot host - ToChannelFromBotOAuthScope *string `json:"ToChannelFromBotOAuthScope,omitempty"` - // ValidateAuthority - Per cloud OAuth setting on whether authority is validated - ValidateAuthority *bool `json:"ValidateAuthority,omitempty"` - // BotOpenIDMetadata - Same as toBotFromChannelOpenIdMetadataUrl, used by SDK < v4.12 - BotOpenIDMetadata *string `json:"BotOpenIdMetadata,omitempty"` -} - -// KikChannel kik channel definition -type KikChannel struct { - // Properties - The set of properties specific to Kik channel resource - Properties *KikChannelProperties `json:"properties,omitempty"` - // Etag - Entity Tag of the resource - Etag *string `json:"etag,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel' - ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` -} - -// MarshalJSON is the custom marshaler for KikChannel. -func (kc KikChannel) MarshalJSON() ([]byte, error) { - kc.ChannelName = ChannelNameBasicChannelChannelNameKikChannel - objectMap := make(map[string]interface{}) - if kc.Properties != nil { - objectMap["properties"] = kc.Properties - } - if kc.Etag != nil { - objectMap["etag"] = kc.Etag - } - if kc.Location != nil { - objectMap["location"] = kc.Location - } - if kc.ChannelName != "" { - objectMap["channelName"] = kc.ChannelName - } - return json.Marshal(objectMap) -} - -// AsAlexaChannel is the BasicChannel implementation for KikChannel. -func (kc KikChannel) AsAlexaChannel() (*AlexaChannel, bool) { - return nil, false -} - -// AsFacebookChannel is the BasicChannel implementation for KikChannel. -func (kc KikChannel) AsFacebookChannel() (*FacebookChannel, bool) { - return nil, false -} - -// AsEmailChannel is the BasicChannel implementation for KikChannel. -func (kc KikChannel) AsEmailChannel() (*EmailChannel, bool) { - return nil, false -} - -// AsMsTeamsChannel is the BasicChannel implementation for KikChannel. -func (kc KikChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { - return nil, false -} - -// AsSkypeChannel is the BasicChannel implementation for KikChannel. -func (kc KikChannel) AsSkypeChannel() (*SkypeChannel, bool) { - return nil, false -} - -// AsKikChannel is the BasicChannel implementation for KikChannel. -func (kc KikChannel) AsKikChannel() (*KikChannel, bool) { - return &kc, true -} - -// AsWebChatChannel is the BasicChannel implementation for KikChannel. -func (kc KikChannel) AsWebChatChannel() (*WebChatChannel, bool) { - return nil, false -} - -// AsDirectLineChannel is the BasicChannel implementation for KikChannel. -func (kc KikChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { - return nil, false -} - -// AsTelegramChannel is the BasicChannel implementation for KikChannel. -func (kc KikChannel) AsTelegramChannel() (*TelegramChannel, bool) { - return nil, false -} - -// AsSmsChannel is the BasicChannel implementation for KikChannel. -func (kc KikChannel) AsSmsChannel() (*SmsChannel, bool) { - return nil, false -} - -// AsSlackChannel is the BasicChannel implementation for KikChannel. -func (kc KikChannel) AsSlackChannel() (*SlackChannel, bool) { - return nil, false -} - -// AsLineChannel is the BasicChannel implementation for KikChannel. -func (kc KikChannel) AsLineChannel() (*LineChannel, bool) { - return nil, false -} - -// AsDirectLineSpeechChannel is the BasicChannel implementation for KikChannel. -func (kc KikChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { - return nil, false -} - -// AsChannel is the BasicChannel implementation for KikChannel. -func (kc KikChannel) AsChannel() (*Channel, bool) { - return nil, false -} - -// AsBasicChannel is the BasicChannel implementation for KikChannel. -func (kc KikChannel) AsBasicChannel() (BasicChannel, bool) { - return &kc, true -} - -// KikChannelProperties the parameters to provide for the Kik channel. -type KikChannelProperties struct { - // UserName - The Kik user name - UserName *string `json:"userName,omitempty"` - // APIKey - Kik API key. Value only returned through POST to the action Channel List API, otherwise empty. - APIKey *string `json:"apiKey,omitempty"` - // IsValidated - Whether this channel is validated for the bot - IsValidated *bool `json:"isValidated,omitempty"` - // IsEnabled - Whether this channel is enabled for the bot - IsEnabled *bool `json:"isEnabled,omitempty"` -} - -// LineChannel line channel definition -type LineChannel struct { - // Properties - The set of properties specific to line channel resource - Properties *LineChannelProperties `json:"properties,omitempty"` - // Etag - Entity Tag of the resource - Etag *string `json:"etag,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel' - ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` -} - -// MarshalJSON is the custom marshaler for LineChannel. -func (lc LineChannel) MarshalJSON() ([]byte, error) { - lc.ChannelName = ChannelNameBasicChannelChannelNameLineChannel - objectMap := make(map[string]interface{}) - if lc.Properties != nil { - objectMap["properties"] = lc.Properties - } - if lc.Etag != nil { - objectMap["etag"] = lc.Etag - } - if lc.Location != nil { - objectMap["location"] = lc.Location - } - if lc.ChannelName != "" { - objectMap["channelName"] = lc.ChannelName - } - return json.Marshal(objectMap) -} - -// AsAlexaChannel is the BasicChannel implementation for LineChannel. -func (lc LineChannel) AsAlexaChannel() (*AlexaChannel, bool) { - return nil, false -} - -// AsFacebookChannel is the BasicChannel implementation for LineChannel. -func (lc LineChannel) AsFacebookChannel() (*FacebookChannel, bool) { - return nil, false -} - -// AsEmailChannel is the BasicChannel implementation for LineChannel. -func (lc LineChannel) AsEmailChannel() (*EmailChannel, bool) { - return nil, false -} - -// AsMsTeamsChannel is the BasicChannel implementation for LineChannel. -func (lc LineChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { - return nil, false -} - -// AsSkypeChannel is the BasicChannel implementation for LineChannel. -func (lc LineChannel) AsSkypeChannel() (*SkypeChannel, bool) { - return nil, false -} - -// AsKikChannel is the BasicChannel implementation for LineChannel. -func (lc LineChannel) AsKikChannel() (*KikChannel, bool) { - return nil, false -} - -// AsWebChatChannel is the BasicChannel implementation for LineChannel. -func (lc LineChannel) AsWebChatChannel() (*WebChatChannel, bool) { - return nil, false -} - -// AsDirectLineChannel is the BasicChannel implementation for LineChannel. -func (lc LineChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { - return nil, false -} - -// AsTelegramChannel is the BasicChannel implementation for LineChannel. -func (lc LineChannel) AsTelegramChannel() (*TelegramChannel, bool) { - return nil, false -} - -// AsSmsChannel is the BasicChannel implementation for LineChannel. -func (lc LineChannel) AsSmsChannel() (*SmsChannel, bool) { - return nil, false -} - -// AsSlackChannel is the BasicChannel implementation for LineChannel. -func (lc LineChannel) AsSlackChannel() (*SlackChannel, bool) { - return nil, false -} - -// AsLineChannel is the BasicChannel implementation for LineChannel. -func (lc LineChannel) AsLineChannel() (*LineChannel, bool) { - return &lc, true -} - -// AsDirectLineSpeechChannel is the BasicChannel implementation for LineChannel. -func (lc LineChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { - return nil, false -} - -// AsChannel is the BasicChannel implementation for LineChannel. -func (lc LineChannel) AsChannel() (*Channel, bool) { - return nil, false -} - -// AsBasicChannel is the BasicChannel implementation for LineChannel. -func (lc LineChannel) AsBasicChannel() (BasicChannel, bool) { - return &lc, true -} - -// LineChannelProperties the parameters to provide for the Line channel. -type LineChannelProperties struct { - // LineRegistrations - The list of line channel registrations - LineRegistrations *[]LineRegistration `json:"lineRegistrations,omitempty"` - // CallbackURL - READ-ONLY; Callback Url to enter in line registration. - CallbackURL *string `json:"callbackUrl,omitempty"` - // IsValidated - READ-ONLY; Whether this channel is validated for the bot - IsValidated *bool `json:"isValidated,omitempty"` -} - -// MarshalJSON is the custom marshaler for LineChannelProperties. -func (lcp LineChannelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lcp.LineRegistrations != nil { - objectMap["lineRegistrations"] = lcp.LineRegistrations - } - return json.Marshal(objectMap) -} - -// LineRegistration the properties corresponding to a line channel registration -type LineRegistration struct { - // GeneratedID - READ-ONLY; Id generated for the line channel registration - GeneratedID *string `json:"generatedId,omitempty"` - // ChannelSecret - Secret for the line channel registration - ChannelSecret *string `json:"channelSecret,omitempty"` - // ChannelAccessToken - Access token for the line channel registration - ChannelAccessToken *string `json:"channelAccessToken,omitempty"` -} - -// MarshalJSON is the custom marshaler for LineRegistration. -func (lr LineRegistration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lr.ChannelSecret != nil { - objectMap["channelSecret"] = lr.ChannelSecret - } - if lr.ChannelAccessToken != nil { - objectMap["channelAccessToken"] = lr.ChannelAccessToken - } - return json.Marshal(objectMap) -} - -// ListChannelWithKeysResponse the ARM channel of list channel with keys operation response. -type ListChannelWithKeysResponse struct { - autorest.Response `json:"-"` - // Resource - The set of properties specific to bot channel resource - Resource BasicChannel `json:"resource,omitempty"` - // Setting - Channel settings - Setting *ChannelSettings `json:"setting,omitempty"` - // ProvisioningState - Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // EntityTag - Entity tag of the resource - EntityTag *string `json:"entityTag,omitempty"` - // ChangedTime - Changed time of the resource - ChangedTime *string `json:"changedTime,omitempty"` - // Properties - The set of properties specific to bot channel resource - Properties BasicChannel `json:"properties,omitempty"` - // ID - READ-ONLY; Specifies the resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Specifies the name of the resource. - Name *string `json:"name,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // Type - READ-ONLY; Specifies the type of the resource. - Type *string `json:"type,omitempty"` - // Tags - Contains resource tags defined as key/value pairs. - Tags map[string]*string `json:"tags"` - // Sku - Gets or sets the SKU of the resource. - Sku *Sku `json:"sku,omitempty"` - // Kind - Required. Gets or sets the Kind of the resource. Possible values include: 'KindSdk', 'KindDesigner', 'KindBot', 'KindFunction', 'KindAzurebot' - Kind Kind `json:"kind,omitempty"` - // Etag - Entity Tag - Etag *string `json:"etag,omitempty"` - // Zones - READ-ONLY; Entity zones - Zones *[]string `json:"zones,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListChannelWithKeysResponse. -func (lcwkr ListChannelWithKeysResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["resource"] = lcwkr.Resource - if lcwkr.Setting != nil { - objectMap["setting"] = lcwkr.Setting - } - if lcwkr.ProvisioningState != nil { - objectMap["provisioningState"] = lcwkr.ProvisioningState - } - if lcwkr.EntityTag != nil { - objectMap["entityTag"] = lcwkr.EntityTag - } - if lcwkr.ChangedTime != nil { - objectMap["changedTime"] = lcwkr.ChangedTime - } - objectMap["properties"] = lcwkr.Properties - if lcwkr.Location != nil { - objectMap["location"] = lcwkr.Location - } - if lcwkr.Tags != nil { - objectMap["tags"] = lcwkr.Tags - } - if lcwkr.Sku != nil { - objectMap["sku"] = lcwkr.Sku - } - if lcwkr.Kind != "" { - objectMap["kind"] = lcwkr.Kind - } - if lcwkr.Etag != nil { - objectMap["etag"] = lcwkr.Etag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ListChannelWithKeysResponse struct. -func (lcwkr *ListChannelWithKeysResponse) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "resource": - if v != nil { - resource, err := unmarshalBasicChannel(*v) - if err != nil { - return err - } - lcwkr.Resource = resource - } - case "setting": - if v != nil { - var setting ChannelSettings - err = json.Unmarshal(*v, &setting) - if err != nil { - return err - } - lcwkr.Setting = &setting - } - case "provisioningState": - if v != nil { - var provisioningState string - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - lcwkr.ProvisioningState = &provisioningState - } - case "entityTag": - if v != nil { - var entityTag string - err = json.Unmarshal(*v, &entityTag) - if err != nil { - return err - } - lcwkr.EntityTag = &entityTag - } - case "changedTime": - if v != nil { - var changedTime string - err = json.Unmarshal(*v, &changedTime) - if err != nil { - return err - } - lcwkr.ChangedTime = &changedTime - } - case "properties": - if v != nil { - properties, err := unmarshalBasicChannel(*v) - if err != nil { - return err - } - lcwkr.Properties = properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lcwkr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lcwkr.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lcwkr.Location = &location - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lcwkr.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lcwkr.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - lcwkr.Sku = &sku - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - lcwkr.Kind = kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - lcwkr.Etag = &etag - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - lcwkr.Zones = &zones - } - } - } - - return nil -} - -// MsTeamsChannel microsoft Teams channel definition -type MsTeamsChannel struct { - // Properties - The set of properties specific to Microsoft Teams channel resource - Properties *MsTeamsChannelProperties `json:"properties,omitempty"` - // Etag - Entity Tag of the resource - Etag *string `json:"etag,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel' - ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` -} - -// MarshalJSON is the custom marshaler for MsTeamsChannel. -func (mtc MsTeamsChannel) MarshalJSON() ([]byte, error) { - mtc.ChannelName = ChannelNameBasicChannelChannelNameMsTeamsChannel - objectMap := make(map[string]interface{}) - if mtc.Properties != nil { - objectMap["properties"] = mtc.Properties - } - if mtc.Etag != nil { - objectMap["etag"] = mtc.Etag - } - if mtc.Location != nil { - objectMap["location"] = mtc.Location - } - if mtc.ChannelName != "" { - objectMap["channelName"] = mtc.ChannelName - } - return json.Marshal(objectMap) -} - -// AsAlexaChannel is the BasicChannel implementation for MsTeamsChannel. -func (mtc MsTeamsChannel) AsAlexaChannel() (*AlexaChannel, bool) { - return nil, false -} - -// AsFacebookChannel is the BasicChannel implementation for MsTeamsChannel. -func (mtc MsTeamsChannel) AsFacebookChannel() (*FacebookChannel, bool) { - return nil, false -} - -// AsEmailChannel is the BasicChannel implementation for MsTeamsChannel. -func (mtc MsTeamsChannel) AsEmailChannel() (*EmailChannel, bool) { - return nil, false -} - -// AsMsTeamsChannel is the BasicChannel implementation for MsTeamsChannel. -func (mtc MsTeamsChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { - return &mtc, true -} - -// AsSkypeChannel is the BasicChannel implementation for MsTeamsChannel. -func (mtc MsTeamsChannel) AsSkypeChannel() (*SkypeChannel, bool) { - return nil, false -} - -// AsKikChannel is the BasicChannel implementation for MsTeamsChannel. -func (mtc MsTeamsChannel) AsKikChannel() (*KikChannel, bool) { - return nil, false -} - -// AsWebChatChannel is the BasicChannel implementation for MsTeamsChannel. -func (mtc MsTeamsChannel) AsWebChatChannel() (*WebChatChannel, bool) { - return nil, false -} - -// AsDirectLineChannel is the BasicChannel implementation for MsTeamsChannel. -func (mtc MsTeamsChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { - return nil, false -} - -// AsTelegramChannel is the BasicChannel implementation for MsTeamsChannel. -func (mtc MsTeamsChannel) AsTelegramChannel() (*TelegramChannel, bool) { - return nil, false -} - -// AsSmsChannel is the BasicChannel implementation for MsTeamsChannel. -func (mtc MsTeamsChannel) AsSmsChannel() (*SmsChannel, bool) { - return nil, false -} - -// AsSlackChannel is the BasicChannel implementation for MsTeamsChannel. -func (mtc MsTeamsChannel) AsSlackChannel() (*SlackChannel, bool) { - return nil, false -} - -// AsLineChannel is the BasicChannel implementation for MsTeamsChannel. -func (mtc MsTeamsChannel) AsLineChannel() (*LineChannel, bool) { - return nil, false -} - -// AsDirectLineSpeechChannel is the BasicChannel implementation for MsTeamsChannel. -func (mtc MsTeamsChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { - return nil, false -} - -// AsChannel is the BasicChannel implementation for MsTeamsChannel. -func (mtc MsTeamsChannel) AsChannel() (*Channel, bool) { - return nil, false -} - -// AsBasicChannel is the BasicChannel implementation for MsTeamsChannel. -func (mtc MsTeamsChannel) AsBasicChannel() (BasicChannel, bool) { - return &mtc, true -} - -// MsTeamsChannelProperties the parameters to provide for the Microsoft Teams channel. -type MsTeamsChannelProperties struct { - // EnableCalling - Enable calling for Microsoft Teams channel - EnableCalling *bool `json:"enableCalling,omitempty"` - // CallingWebHook - Webhook for Microsoft Teams channel calls - CallingWebHook *string `json:"callingWebHook,omitempty"` - // IsEnabled - Whether this channel is enabled for the bot - IsEnabled *bool `json:"isEnabled,omitempty"` - // IncomingCallRoute - Webhook for Microsoft Teams channel calls - IncomingCallRoute *string `json:"incomingCallRoute,omitempty"` - // DeploymentEnvironment - Deployment environment for Microsoft Teams channel calls - DeploymentEnvironment *string `json:"deploymentEnvironment,omitempty"` - // AcceptedTerms - Whether this channel accepted terms - AcceptedTerms *bool `json:"acceptedTerms,omitempty"` -} - -// OperationDisplayInfo the operation supported by Bot Service Management. -type OperationDisplayInfo struct { - // Description - The description of the operation. - Description *string `json:"description,omitempty"` - // Operation - The action that users can perform, based on their permission level. - Operation *string `json:"operation,omitempty"` - // Provider - Service provider: Microsoft Bot Service. - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` -} - -// OperationEntity the operations supported by Bot Service Management. -type OperationEntity struct { - // Name - Operation name: {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty"` - // Display - The operation supported by Bot Service Management. - Display *OperationDisplayInfo `json:"display,omitempty"` - // Origin - The origin of the operation. - Origin *string `json:"origin,omitempty"` - // Properties - Additional properties. - Properties interface{} `json:"properties,omitempty"` -} - -// OperationEntityListResult the list of bot service operation response. -type OperationEntityListResult struct { - autorest.Response `json:"-"` - // NextLink - The link used to get the next page of operations. - NextLink *string `json:"nextLink,omitempty"` - // Value - The list of operations. - Value *[]OperationEntity `json:"value,omitempty"` -} - -// OperationEntityListResultIterator provides access to a complete listing of OperationEntity values. -type OperationEntityListResultIterator struct { - i int - page OperationEntityListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationEntityListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationEntityListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationEntityListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationEntityListResultIterator) Response() OperationEntityListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationEntityListResultIterator) Value() OperationEntity { - if !iter.page.NotDone() { - return OperationEntity{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationEntityListResultIterator type. -func NewOperationEntityListResultIterator(page OperationEntityListResultPage) OperationEntityListResultIterator { - return OperationEntityListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (oelr OperationEntityListResult) IsEmpty() bool { - return oelr.Value == nil || len(*oelr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (oelr OperationEntityListResult) hasNextLink() bool { - return oelr.NextLink != nil && len(*oelr.NextLink) != 0 -} - -// operationEntityListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (oelr OperationEntityListResult) operationEntityListResultPreparer(ctx context.Context) (*http.Request, error) { - if !oelr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(oelr.NextLink))) -} - -// OperationEntityListResultPage contains a page of OperationEntity values. -type OperationEntityListResultPage struct { - fn func(context.Context, OperationEntityListResult) (OperationEntityListResult, error) - oelr OperationEntityListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationEntityListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.oelr) - if err != nil { - return err - } - page.oelr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationEntityListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationEntityListResultPage) NotDone() bool { - return !page.oelr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationEntityListResultPage) Response() OperationEntityListResult { - return page.oelr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationEntityListResultPage) Values() []OperationEntity { - if page.oelr.IsEmpty() { - return nil - } - return *page.oelr.Value -} - -// Creates a new instance of the OperationEntityListResultPage type. -func NewOperationEntityListResultPage(cur OperationEntityListResult, getNextPage func(context.Context, OperationEntityListResult) (OperationEntityListResult, error)) OperationEntityListResultPage { - return OperationEntityListResultPage{ - fn: getNextPage, - oelr: cur, - } -} - -// OperationResultsDescription the properties indicating the operation result of an operation on a service. -type OperationResultsDescription struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The ID of the operation returned. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the operation result. - Name *string `json:"name,omitempty"` - // Status - READ-ONLY; The status of the operation being performed. Possible values include: 'OperationResultStatusCanceled', 'OperationResultStatusSucceeded', 'OperationResultStatusFailed', 'OperationResultStatusRequested', 'OperationResultStatusRunning' - Status OperationResultStatus `json:"status,omitempty"` - // StartTime - READ-ONLY; The time that the operation was started. - StartTime *date.Time `json:"startTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationResultsDescription. -func (ord OperationResultsDescription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationResultsGetFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type OperationResultsGetFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(OperationResultsClient) (OperationResultsDescription, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *OperationResultsGetFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for OperationResultsGetFuture.Result. -func (future *OperationResultsGetFuture) result(client OperationResultsClient) (ord OperationResultsDescription, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "botservice.OperationResultsGetFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ord.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("botservice.OperationResultsGetFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ord.Response.Response, err = future.GetResult(sender); err == nil && ord.Response.Response.StatusCode != http.StatusNoContent { - ord, err = client.GetResponder(ord.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "botservice.OperationResultsGetFuture", "Result", ord.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpoint the Private Endpoint resource. -type PrivateEndpoint struct { - // ID - READ-ONLY; The ARM identifier for Private Endpoint - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpoint. -func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection the Private Endpoint Connection resource. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult list of private endpoint connection associated with the specified -// storage account -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of the PrivateEndpointConnectProperties. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The resource of private end point. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - The provisioning state of the private endpoint connection resource. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' - ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.PrivateLinkResourceProperties != nil { - objectMap["properties"] = plr.PrivateLinkResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. -func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkResourceBase common fields that are returned in the response for all BotService Private Link -// Resources -type PrivateLinkResourceBase struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceBase. -func (plrb PrivateLinkResourceBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - The private link resource Private link DNS zone name. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plrp.RequiredZoneNames != nil { - objectMap["requiredZoneNames"] = plrp.RequiredZoneNames - } - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionState a collection of information about the state of the connection between -// service consumer and provider. -type PrivateLinkServiceConnectionState struct { - // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'PrivateEndpointServiceConnectionStatusPending', 'PrivateEndpointServiceConnectionStatusApproved', 'PrivateEndpointServiceConnectionStatusRejected' - Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` - // Description - The reason for approval/rejection of the connection. - Description *string `json:"description,omitempty"` - // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// Resource azure resource -type Resource struct { - // ID - READ-ONLY; Specifies the resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Specifies the name of the resource. - Name *string `json:"name,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // Type - READ-ONLY; Specifies the type of the resource. - Type *string `json:"type,omitempty"` - // Tags - Contains resource tags defined as key/value pairs. - Tags map[string]*string `json:"tags"` - // Sku - Gets or sets the SKU of the resource. - Sku *Sku `json:"sku,omitempty"` - // Kind - Required. Gets or sets the Kind of the resource. Possible values include: 'KindSdk', 'KindDesigner', 'KindBot', 'KindFunction', 'KindAzurebot' - Kind Kind `json:"kind,omitempty"` - // Etag - Entity Tag - Etag *string `json:"etag,omitempty"` - // Zones - READ-ONLY; Entity zones - Zones *[]string `json:"zones,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - if r.Sku != nil { - objectMap["sku"] = r.Sku - } - if r.Kind != "" { - objectMap["kind"] = r.Kind - } - if r.Etag != nil { - objectMap["etag"] = r.Etag - } - return json.Marshal(objectMap) -} - -// ServiceProvider service Provider Definition -type ServiceProvider struct { - // Properties - The Properties of a Service Provider Object - Properties *ServiceProviderProperties `json:"properties,omitempty"` -} - -// ServiceProviderParameter extra Parameters specific to each Service Provider -type ServiceProviderParameter struct { - // Name - READ-ONLY; Name of the Service Provider - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the Service Provider - Type *string `json:"type,omitempty"` - // DisplayName - READ-ONLY; Display Name of the Service Provider - DisplayName *string `json:"displayName,omitempty"` - // Description - READ-ONLY; Description of the Service Provider - Description *string `json:"description,omitempty"` - // HelpURL - READ-ONLY; Help Url for the Service Provider - HelpURL *string `json:"helpUrl,omitempty"` - // Default - READ-ONLY; Default Name for the Service Provider - Default *string `json:"default,omitempty"` - // Metadata - READ-ONLY; Meta data for the Service Provider - Metadata *ServiceProviderParameterMetadata `json:"metadata,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceProviderParameter. -func (spp ServiceProviderParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServiceProviderParameterMetadata meta data for the Service Provider -type ServiceProviderParameterMetadata struct { - // Constraints - the constraints of the bot meta data. - Constraints *ServiceProviderParameterMetadataConstraints `json:"constraints,omitempty"` -} - -// ServiceProviderParameterMetadataConstraints the constraints of the bot meta data. -type ServiceProviderParameterMetadataConstraints struct { - // Required - Whether required the constraints of the bot meta data. - Required *bool `json:"required,omitempty"` -} - -// ServiceProviderProperties the Object used to describe a Service Provider supported by Bot Service -type ServiceProviderProperties struct { - // ID - READ-ONLY; Id for Service Provider - ID *string `json:"id,omitempty"` - // DisplayName - READ-ONLY; Display Name of the Service Provider - DisplayName *string `json:"displayName,omitempty"` - // ServiceProviderName - READ-ONLY; Display Name of the Service Provider - ServiceProviderName *string `json:"serviceProviderName,omitempty"` - // DevPortalURL - READ-ONLY; Display Name of the Service Provider - DevPortalURL *string `json:"devPortalUrl,omitempty"` - // IconURL - READ-ONLY; Display Name of the Service Provider - IconURL *string `json:"iconUrl,omitempty"` - // Parameters - The list of parameters for the Service Provider - Parameters *[]ServiceProviderParameter `json:"parameters,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceProviderProperties. -func (spp ServiceProviderProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spp.Parameters != nil { - objectMap["parameters"] = spp.Parameters - } - return json.Marshal(objectMap) -} - -// ServiceProviderResponseList the list of bot service providers response. -type ServiceProviderResponseList struct { - autorest.Response `json:"-"` - // NextLink - The link used to get the next page of bot service providers. - NextLink *string `json:"nextLink,omitempty"` - // Value - READ-ONLY; Gets the list of bot service providers and their properties. - Value *[]ServiceProvider `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceProviderResponseList. -func (sprl ServiceProviderResponseList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sprl.NextLink != nil { - objectMap["nextLink"] = sprl.NextLink - } - return json.Marshal(objectMap) -} - -// Site a site for the channel -type Site struct { - // SiteID - READ-ONLY; Site Id - SiteID *string `json:"siteId,omitempty"` - // SiteName - Site name - SiteName *string `json:"siteName,omitempty"` - // Key - READ-ONLY; Primary key. Value only returned through POST to the action Channel List API, otherwise empty. - Key *string `json:"key,omitempty"` - // Key2 - READ-ONLY; Secondary key. Value only returned through POST to the action Channel List API, otherwise empty. - Key2 *string `json:"key2,omitempty"` - // IsEnabled - Whether this site is enabled for DirectLine channel - IsEnabled *bool `json:"isEnabled,omitempty"` - // IsWebchatPreviewEnabled - Whether this site is enabled for preview versions of Webchat - IsWebchatPreviewEnabled *bool `json:"isWebchatPreviewEnabled,omitempty"` - // IsV1Enabled - Whether this site is enabled for Bot Framework V1 protocol. - IsV1Enabled *bool `json:"isV1Enabled,omitempty"` - // IsV3Enabled - Whether this site is enabled for Bot Framework V1 protocol. - IsV3Enabled *bool `json:"isV3Enabled,omitempty"` - // IsSecureSiteEnabled - Whether this site is enabled for authentication with Bot Framework. - IsSecureSiteEnabled *bool `json:"isSecureSiteEnabled,omitempty"` - // IsBlockUserUploadEnabled - Whether this site is enabled for block user upload. - IsBlockUserUploadEnabled *bool `json:"isBlockUserUploadEnabled,omitempty"` - // TrustedOrigins - List of Trusted Origin URLs for this site. This field is applicable only if isSecureSiteEnabled is True. - TrustedOrigins *[]string `json:"trustedOrigins,omitempty"` - // IsTokenEnabled - Whether this site is token enabled for channel - IsTokenEnabled *bool `json:"isTokenEnabled,omitempty"` - // ETag - Entity Tag - ETag *string `json:"eTag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Site. -func (s Site) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.SiteName != nil { - objectMap["siteName"] = s.SiteName - } - if s.IsEnabled != nil { - objectMap["isEnabled"] = s.IsEnabled - } - if s.IsWebchatPreviewEnabled != nil { - objectMap["isWebchatPreviewEnabled"] = s.IsWebchatPreviewEnabled - } - if s.IsV1Enabled != nil { - objectMap["isV1Enabled"] = s.IsV1Enabled - } - if s.IsV3Enabled != nil { - objectMap["isV3Enabled"] = s.IsV3Enabled - } - if s.IsSecureSiteEnabled != nil { - objectMap["isSecureSiteEnabled"] = s.IsSecureSiteEnabled - } - if s.IsBlockUserUploadEnabled != nil { - objectMap["isBlockUserUploadEnabled"] = s.IsBlockUserUploadEnabled - } - if s.TrustedOrigins != nil { - objectMap["trustedOrigins"] = s.TrustedOrigins - } - if s.IsTokenEnabled != nil { - objectMap["isTokenEnabled"] = s.IsTokenEnabled - } - if s.ETag != nil { - objectMap["eTag"] = s.ETag - } - return json.Marshal(objectMap) -} - -// SiteInfo site information for WebChat or DirectLine Channels to identify which site to regenerate keys -// for. -type SiteInfo struct { - // SiteName - The site name - SiteName *string `json:"siteName,omitempty"` - // Key - Determines which key is to be regenerated. Possible values include: 'Key1', 'Key2' - Key Key `json:"key,omitempty"` -} - -// Sku the SKU of the cognitive services account. -type Sku struct { - // Name - The sku name. Possible values include: 'SkuNameF0', 'SkuNameS1' - Name SkuName `json:"name,omitempty"` - // Tier - READ-ONLY; Gets the sku tier. This is based on the SKU name. Possible values include: 'SkuTierFree', 'SkuTierStandard' - Tier SkuTier `json:"tier,omitempty"` -} - -// MarshalJSON is the custom marshaler for Sku. -func (s Sku) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Name != "" { - objectMap["name"] = s.Name - } - return json.Marshal(objectMap) -} - -// SkypeChannel skype channel definition -type SkypeChannel struct { - // Properties - The set of properties specific to Skype channel resource - Properties *SkypeChannelProperties `json:"properties,omitempty"` - // Etag - Entity Tag of the resource - Etag *string `json:"etag,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel' - ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkypeChannel. -func (sc SkypeChannel) MarshalJSON() ([]byte, error) { - sc.ChannelName = ChannelNameBasicChannelChannelNameSkypeChannel - objectMap := make(map[string]interface{}) - if sc.Properties != nil { - objectMap["properties"] = sc.Properties - } - if sc.Etag != nil { - objectMap["etag"] = sc.Etag - } - if sc.Location != nil { - objectMap["location"] = sc.Location - } - if sc.ChannelName != "" { - objectMap["channelName"] = sc.ChannelName - } - return json.Marshal(objectMap) -} - -// AsAlexaChannel is the BasicChannel implementation for SkypeChannel. -func (sc SkypeChannel) AsAlexaChannel() (*AlexaChannel, bool) { - return nil, false -} - -// AsFacebookChannel is the BasicChannel implementation for SkypeChannel. -func (sc SkypeChannel) AsFacebookChannel() (*FacebookChannel, bool) { - return nil, false -} - -// AsEmailChannel is the BasicChannel implementation for SkypeChannel. -func (sc SkypeChannel) AsEmailChannel() (*EmailChannel, bool) { - return nil, false -} - -// AsMsTeamsChannel is the BasicChannel implementation for SkypeChannel. -func (sc SkypeChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { - return nil, false -} - -// AsSkypeChannel is the BasicChannel implementation for SkypeChannel. -func (sc SkypeChannel) AsSkypeChannel() (*SkypeChannel, bool) { - return &sc, true -} - -// AsKikChannel is the BasicChannel implementation for SkypeChannel. -func (sc SkypeChannel) AsKikChannel() (*KikChannel, bool) { - return nil, false -} - -// AsWebChatChannel is the BasicChannel implementation for SkypeChannel. -func (sc SkypeChannel) AsWebChatChannel() (*WebChatChannel, bool) { - return nil, false -} - -// AsDirectLineChannel is the BasicChannel implementation for SkypeChannel. -func (sc SkypeChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { - return nil, false -} - -// AsTelegramChannel is the BasicChannel implementation for SkypeChannel. -func (sc SkypeChannel) AsTelegramChannel() (*TelegramChannel, bool) { - return nil, false -} - -// AsSmsChannel is the BasicChannel implementation for SkypeChannel. -func (sc SkypeChannel) AsSmsChannel() (*SmsChannel, bool) { - return nil, false -} - -// AsSlackChannel is the BasicChannel implementation for SkypeChannel. -func (sc SkypeChannel) AsSlackChannel() (*SlackChannel, bool) { - return nil, false -} - -// AsLineChannel is the BasicChannel implementation for SkypeChannel. -func (sc SkypeChannel) AsLineChannel() (*LineChannel, bool) { - return nil, false -} - -// AsDirectLineSpeechChannel is the BasicChannel implementation for SkypeChannel. -func (sc SkypeChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { - return nil, false -} - -// AsChannel is the BasicChannel implementation for SkypeChannel. -func (sc SkypeChannel) AsChannel() (*Channel, bool) { - return nil, false -} - -// AsBasicChannel is the BasicChannel implementation for SkypeChannel. -func (sc SkypeChannel) AsBasicChannel() (BasicChannel, bool) { - return &sc, true -} - -// SkypeChannelProperties the parameters to provide for the Microsoft Teams channel. -type SkypeChannelProperties struct { - // EnableMessaging - Enable messaging for Skype channel - EnableMessaging *bool `json:"enableMessaging,omitempty"` - // EnableMediaCards - Enable media cards for Skype channel - EnableMediaCards *bool `json:"enableMediaCards,omitempty"` - // EnableVideo - Enable video for Skype channel - EnableVideo *bool `json:"enableVideo,omitempty"` - // EnableCalling - Enable calling for Skype channel - EnableCalling *bool `json:"enableCalling,omitempty"` - // EnableScreenSharing - Enable screen sharing for Skype channel - EnableScreenSharing *bool `json:"enableScreenSharing,omitempty"` - // EnableGroups - Enable groups for Skype channel - EnableGroups *bool `json:"enableGroups,omitempty"` - // GroupsMode - Group mode for Skype channel - GroupsMode *string `json:"groupsMode,omitempty"` - // CallingWebHook - Calling web hook for Skype channel - CallingWebHook *string `json:"callingWebHook,omitempty"` - // IncomingCallRoute - Incoming call route for Skype channel - IncomingCallRoute *string `json:"incomingCallRoute,omitempty"` - // IsEnabled - Whether this channel is enabled for the bot - IsEnabled *bool `json:"isEnabled,omitempty"` -} - -// SlackChannel slack channel definition -type SlackChannel struct { - // Properties - The set of properties specific to Slack channel resource - Properties *SlackChannelProperties `json:"properties,omitempty"` - // Etag - Entity Tag of the resource - Etag *string `json:"etag,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel' - ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` -} - -// MarshalJSON is the custom marshaler for SlackChannel. -func (sc SlackChannel) MarshalJSON() ([]byte, error) { - sc.ChannelName = ChannelNameBasicChannelChannelNameSlackChannel - objectMap := make(map[string]interface{}) - if sc.Properties != nil { - objectMap["properties"] = sc.Properties - } - if sc.Etag != nil { - objectMap["etag"] = sc.Etag - } - if sc.Location != nil { - objectMap["location"] = sc.Location - } - if sc.ChannelName != "" { - objectMap["channelName"] = sc.ChannelName - } - return json.Marshal(objectMap) -} - -// AsAlexaChannel is the BasicChannel implementation for SlackChannel. -func (sc SlackChannel) AsAlexaChannel() (*AlexaChannel, bool) { - return nil, false -} - -// AsFacebookChannel is the BasicChannel implementation for SlackChannel. -func (sc SlackChannel) AsFacebookChannel() (*FacebookChannel, bool) { - return nil, false -} - -// AsEmailChannel is the BasicChannel implementation for SlackChannel. -func (sc SlackChannel) AsEmailChannel() (*EmailChannel, bool) { - return nil, false -} - -// AsMsTeamsChannel is the BasicChannel implementation for SlackChannel. -func (sc SlackChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { - return nil, false -} - -// AsSkypeChannel is the BasicChannel implementation for SlackChannel. -func (sc SlackChannel) AsSkypeChannel() (*SkypeChannel, bool) { - return nil, false -} - -// AsKikChannel is the BasicChannel implementation for SlackChannel. -func (sc SlackChannel) AsKikChannel() (*KikChannel, bool) { - return nil, false -} - -// AsWebChatChannel is the BasicChannel implementation for SlackChannel. -func (sc SlackChannel) AsWebChatChannel() (*WebChatChannel, bool) { - return nil, false -} - -// AsDirectLineChannel is the BasicChannel implementation for SlackChannel. -func (sc SlackChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { - return nil, false -} - -// AsTelegramChannel is the BasicChannel implementation for SlackChannel. -func (sc SlackChannel) AsTelegramChannel() (*TelegramChannel, bool) { - return nil, false -} - -// AsSmsChannel is the BasicChannel implementation for SlackChannel. -func (sc SlackChannel) AsSmsChannel() (*SmsChannel, bool) { - return nil, false -} - -// AsSlackChannel is the BasicChannel implementation for SlackChannel. -func (sc SlackChannel) AsSlackChannel() (*SlackChannel, bool) { - return &sc, true -} - -// AsLineChannel is the BasicChannel implementation for SlackChannel. -func (sc SlackChannel) AsLineChannel() (*LineChannel, bool) { - return nil, false -} - -// AsDirectLineSpeechChannel is the BasicChannel implementation for SlackChannel. -func (sc SlackChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { - return nil, false -} - -// AsChannel is the BasicChannel implementation for SlackChannel. -func (sc SlackChannel) AsChannel() (*Channel, bool) { - return nil, false -} - -// AsBasicChannel is the BasicChannel implementation for SlackChannel. -func (sc SlackChannel) AsBasicChannel() (BasicChannel, bool) { - return &sc, true -} - -// SlackChannelProperties the parameters to provide for the Slack channel. -type SlackChannelProperties struct { - // ClientID - The Slack client id - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - The Slack client secret. Value only returned through POST to the action Channel List API, otherwise empty. - ClientSecret *string `json:"clientSecret,omitempty"` - // VerificationToken - The Slack verification token. Value only returned through POST to the action Channel List API, otherwise empty. - VerificationToken *string `json:"verificationToken,omitempty"` - // Scopes - The Slack permission scopes. - Scopes *string `json:"scopes,omitempty"` - // LandingPageURL - The Slack landing page Url - LandingPageURL *string `json:"landingPageUrl,omitempty"` - // RedirectAction - READ-ONLY; The Slack redirect action - RedirectAction *string `json:"redirectAction,omitempty"` - // LastSubmissionID - READ-ONLY; The Sms auth token - LastSubmissionID *string `json:"lastSubmissionId,omitempty"` - // RegisterBeforeOAuthFlow - READ-ONLY; Whether to register the settings before OAuth validation is performed. Recommended to True. - RegisterBeforeOAuthFlow *bool `json:"registerBeforeOAuthFlow,omitempty"` - // IsValidated - READ-ONLY; Whether this channel is validated for the bot - IsValidated *bool `json:"IsValidated,omitempty"` - // SigningSecret - The Slack signing secret. - SigningSecret *string `json:"signingSecret,omitempty"` - // IsEnabled - Whether this channel is enabled for the bot - IsEnabled *bool `json:"isEnabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for SlackChannelProperties. -func (scp SlackChannelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if scp.ClientID != nil { - objectMap["clientId"] = scp.ClientID - } - if scp.ClientSecret != nil { - objectMap["clientSecret"] = scp.ClientSecret - } - if scp.VerificationToken != nil { - objectMap["verificationToken"] = scp.VerificationToken - } - if scp.Scopes != nil { - objectMap["scopes"] = scp.Scopes - } - if scp.LandingPageURL != nil { - objectMap["landingPageUrl"] = scp.LandingPageURL - } - if scp.SigningSecret != nil { - objectMap["signingSecret"] = scp.SigningSecret - } - if scp.IsEnabled != nil { - objectMap["isEnabled"] = scp.IsEnabled - } - return json.Marshal(objectMap) -} - -// SmsChannel sms channel definition -type SmsChannel struct { - // Properties - The set of properties specific to Sms channel resource - Properties *SmsChannelProperties `json:"properties,omitempty"` - // Etag - Entity Tag of the resource - Etag *string `json:"etag,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel' - ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` -} - -// MarshalJSON is the custom marshaler for SmsChannel. -func (sc SmsChannel) MarshalJSON() ([]byte, error) { - sc.ChannelName = ChannelNameBasicChannelChannelNameSmsChannel - objectMap := make(map[string]interface{}) - if sc.Properties != nil { - objectMap["properties"] = sc.Properties - } - if sc.Etag != nil { - objectMap["etag"] = sc.Etag - } - if sc.Location != nil { - objectMap["location"] = sc.Location - } - if sc.ChannelName != "" { - objectMap["channelName"] = sc.ChannelName - } - return json.Marshal(objectMap) -} - -// AsAlexaChannel is the BasicChannel implementation for SmsChannel. -func (sc SmsChannel) AsAlexaChannel() (*AlexaChannel, bool) { - return nil, false -} - -// AsFacebookChannel is the BasicChannel implementation for SmsChannel. -func (sc SmsChannel) AsFacebookChannel() (*FacebookChannel, bool) { - return nil, false -} - -// AsEmailChannel is the BasicChannel implementation for SmsChannel. -func (sc SmsChannel) AsEmailChannel() (*EmailChannel, bool) { - return nil, false -} - -// AsMsTeamsChannel is the BasicChannel implementation for SmsChannel. -func (sc SmsChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { - return nil, false -} - -// AsSkypeChannel is the BasicChannel implementation for SmsChannel. -func (sc SmsChannel) AsSkypeChannel() (*SkypeChannel, bool) { - return nil, false -} - -// AsKikChannel is the BasicChannel implementation for SmsChannel. -func (sc SmsChannel) AsKikChannel() (*KikChannel, bool) { - return nil, false -} - -// AsWebChatChannel is the BasicChannel implementation for SmsChannel. -func (sc SmsChannel) AsWebChatChannel() (*WebChatChannel, bool) { - return nil, false -} - -// AsDirectLineChannel is the BasicChannel implementation for SmsChannel. -func (sc SmsChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { - return nil, false -} - -// AsTelegramChannel is the BasicChannel implementation for SmsChannel. -func (sc SmsChannel) AsTelegramChannel() (*TelegramChannel, bool) { - return nil, false -} - -// AsSmsChannel is the BasicChannel implementation for SmsChannel. -func (sc SmsChannel) AsSmsChannel() (*SmsChannel, bool) { - return &sc, true -} - -// AsSlackChannel is the BasicChannel implementation for SmsChannel. -func (sc SmsChannel) AsSlackChannel() (*SlackChannel, bool) { - return nil, false -} - -// AsLineChannel is the BasicChannel implementation for SmsChannel. -func (sc SmsChannel) AsLineChannel() (*LineChannel, bool) { - return nil, false -} - -// AsDirectLineSpeechChannel is the BasicChannel implementation for SmsChannel. -func (sc SmsChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { - return nil, false -} - -// AsChannel is the BasicChannel implementation for SmsChannel. -func (sc SmsChannel) AsChannel() (*Channel, bool) { - return nil, false -} - -// AsBasicChannel is the BasicChannel implementation for SmsChannel. -func (sc SmsChannel) AsBasicChannel() (BasicChannel, bool) { - return &sc, true -} - -// SmsChannelProperties the parameters to provide for the Sms channel. -type SmsChannelProperties struct { - // Phone - The Sms phone - Phone *string `json:"phone,omitempty"` - // AccountSID - The Sms account SID. Value only returned through POST to the action Channel List API, otherwise empty. - AccountSID *string `json:"accountSID,omitempty"` - // AuthToken - The Sms auth token. Value only returned through POST to the action Channel List API, otherwise empty. - AuthToken *string `json:"authToken,omitempty"` - // IsValidated - Whether this channel is validated for the bot - IsValidated *bool `json:"isValidated,omitempty"` - // IsEnabled - Whether this channel is enabled for the bot - IsEnabled *bool `json:"isEnabled,omitempty"` -} - -// TelegramChannel telegram channel definition -type TelegramChannel struct { - // Properties - The set of properties specific to Telegram channel resource - Properties *TelegramChannelProperties `json:"properties,omitempty"` - // Etag - Entity Tag of the resource - Etag *string `json:"etag,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel' - ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` -} - -// MarshalJSON is the custom marshaler for TelegramChannel. -func (tc TelegramChannel) MarshalJSON() ([]byte, error) { - tc.ChannelName = ChannelNameBasicChannelChannelNameTelegramChannel - objectMap := make(map[string]interface{}) - if tc.Properties != nil { - objectMap["properties"] = tc.Properties - } - if tc.Etag != nil { - objectMap["etag"] = tc.Etag - } - if tc.Location != nil { - objectMap["location"] = tc.Location - } - if tc.ChannelName != "" { - objectMap["channelName"] = tc.ChannelName - } - return json.Marshal(objectMap) -} - -// AsAlexaChannel is the BasicChannel implementation for TelegramChannel. -func (tc TelegramChannel) AsAlexaChannel() (*AlexaChannel, bool) { - return nil, false -} - -// AsFacebookChannel is the BasicChannel implementation for TelegramChannel. -func (tc TelegramChannel) AsFacebookChannel() (*FacebookChannel, bool) { - return nil, false -} - -// AsEmailChannel is the BasicChannel implementation for TelegramChannel. -func (tc TelegramChannel) AsEmailChannel() (*EmailChannel, bool) { - return nil, false -} - -// AsMsTeamsChannel is the BasicChannel implementation for TelegramChannel. -func (tc TelegramChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { - return nil, false -} - -// AsSkypeChannel is the BasicChannel implementation for TelegramChannel. -func (tc TelegramChannel) AsSkypeChannel() (*SkypeChannel, bool) { - return nil, false -} - -// AsKikChannel is the BasicChannel implementation for TelegramChannel. -func (tc TelegramChannel) AsKikChannel() (*KikChannel, bool) { - return nil, false -} - -// AsWebChatChannel is the BasicChannel implementation for TelegramChannel. -func (tc TelegramChannel) AsWebChatChannel() (*WebChatChannel, bool) { - return nil, false -} - -// AsDirectLineChannel is the BasicChannel implementation for TelegramChannel. -func (tc TelegramChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { - return nil, false -} - -// AsTelegramChannel is the BasicChannel implementation for TelegramChannel. -func (tc TelegramChannel) AsTelegramChannel() (*TelegramChannel, bool) { - return &tc, true -} - -// AsSmsChannel is the BasicChannel implementation for TelegramChannel. -func (tc TelegramChannel) AsSmsChannel() (*SmsChannel, bool) { - return nil, false -} - -// AsSlackChannel is the BasicChannel implementation for TelegramChannel. -func (tc TelegramChannel) AsSlackChannel() (*SlackChannel, bool) { - return nil, false -} - -// AsLineChannel is the BasicChannel implementation for TelegramChannel. -func (tc TelegramChannel) AsLineChannel() (*LineChannel, bool) { - return nil, false -} - -// AsDirectLineSpeechChannel is the BasicChannel implementation for TelegramChannel. -func (tc TelegramChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { - return nil, false -} - -// AsChannel is the BasicChannel implementation for TelegramChannel. -func (tc TelegramChannel) AsChannel() (*Channel, bool) { - return nil, false -} - -// AsBasicChannel is the BasicChannel implementation for TelegramChannel. -func (tc TelegramChannel) AsBasicChannel() (BasicChannel, bool) { - return &tc, true -} - -// TelegramChannelProperties the parameters to provide for the Telegram channel. -type TelegramChannelProperties struct { - // AccessToken - The Telegram access token. Value only returned through POST to the action Channel List API, otherwise empty. - AccessToken *string `json:"accessToken,omitempty"` - // IsValidated - Whether this channel is validated for the bot - IsValidated *bool `json:"isValidated,omitempty"` - // IsEnabled - Whether this channel is enabled for the bot - IsEnabled *bool `json:"isEnabled,omitempty"` -} - -// WebChatChannel web Chat channel definition -type WebChatChannel struct { - // Properties - The set of properties specific to Web Chat channel resource - Properties *WebChatChannelProperties `json:"properties,omitempty"` - // Etag - Entity Tag of the resource - Etag *string `json:"etag,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the resource - ProvisioningState *string `json:"provisioningState,omitempty"` - // Location - Specifies the location of the resource. - Location *string `json:"location,omitempty"` - // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel' - ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebChatChannel. -func (wcc WebChatChannel) MarshalJSON() ([]byte, error) { - wcc.ChannelName = ChannelNameBasicChannelChannelNameWebChatChannel - objectMap := make(map[string]interface{}) - if wcc.Properties != nil { - objectMap["properties"] = wcc.Properties - } - if wcc.Etag != nil { - objectMap["etag"] = wcc.Etag - } - if wcc.Location != nil { - objectMap["location"] = wcc.Location - } - if wcc.ChannelName != "" { - objectMap["channelName"] = wcc.ChannelName - } - return json.Marshal(objectMap) -} - -// AsAlexaChannel is the BasicChannel implementation for WebChatChannel. -func (wcc WebChatChannel) AsAlexaChannel() (*AlexaChannel, bool) { - return nil, false -} - -// AsFacebookChannel is the BasicChannel implementation for WebChatChannel. -func (wcc WebChatChannel) AsFacebookChannel() (*FacebookChannel, bool) { - return nil, false -} - -// AsEmailChannel is the BasicChannel implementation for WebChatChannel. -func (wcc WebChatChannel) AsEmailChannel() (*EmailChannel, bool) { - return nil, false -} - -// AsMsTeamsChannel is the BasicChannel implementation for WebChatChannel. -func (wcc WebChatChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { - return nil, false -} - -// AsSkypeChannel is the BasicChannel implementation for WebChatChannel. -func (wcc WebChatChannel) AsSkypeChannel() (*SkypeChannel, bool) { - return nil, false -} - -// AsKikChannel is the BasicChannel implementation for WebChatChannel. -func (wcc WebChatChannel) AsKikChannel() (*KikChannel, bool) { - return nil, false -} - -// AsWebChatChannel is the BasicChannel implementation for WebChatChannel. -func (wcc WebChatChannel) AsWebChatChannel() (*WebChatChannel, bool) { - return &wcc, true -} - -// AsDirectLineChannel is the BasicChannel implementation for WebChatChannel. -func (wcc WebChatChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { - return nil, false -} - -// AsTelegramChannel is the BasicChannel implementation for WebChatChannel. -func (wcc WebChatChannel) AsTelegramChannel() (*TelegramChannel, bool) { - return nil, false -} - -// AsSmsChannel is the BasicChannel implementation for WebChatChannel. -func (wcc WebChatChannel) AsSmsChannel() (*SmsChannel, bool) { - return nil, false -} - -// AsSlackChannel is the BasicChannel implementation for WebChatChannel. -func (wcc WebChatChannel) AsSlackChannel() (*SlackChannel, bool) { - return nil, false -} - -// AsLineChannel is the BasicChannel implementation for WebChatChannel. -func (wcc WebChatChannel) AsLineChannel() (*LineChannel, bool) { - return nil, false -} - -// AsDirectLineSpeechChannel is the BasicChannel implementation for WebChatChannel. -func (wcc WebChatChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { - return nil, false -} - -// AsChannel is the BasicChannel implementation for WebChatChannel. -func (wcc WebChatChannel) AsChannel() (*Channel, bool) { - return nil, false -} - -// AsBasicChannel is the BasicChannel implementation for WebChatChannel. -func (wcc WebChatChannel) AsBasicChannel() (BasicChannel, bool) { - return &wcc, true -} - -// WebChatChannelProperties the parameters to provide for the Web Chat channel. -type WebChatChannelProperties struct { - // WebChatEmbedCode - READ-ONLY; Web chat control embed code - WebChatEmbedCode *string `json:"webChatEmbedCode,omitempty"` - // Sites - The list of Web Chat sites - Sites *[]WebChatSite `json:"sites,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebChatChannelProperties. -func (wccp WebChatChannelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wccp.Sites != nil { - objectMap["sites"] = wccp.Sites - } - return json.Marshal(objectMap) -} - -// WebChatSite a site for the Webchat channel -type WebChatSite struct { - // SiteID - READ-ONLY; Site Id - SiteID *string `json:"siteId,omitempty"` - // SiteName - Site name - SiteName *string `json:"siteName,omitempty"` - // Key - READ-ONLY; Primary key. Value only returned through POST to the action Channel List API, otherwise empty. - Key *string `json:"key,omitempty"` - // Key2 - READ-ONLY; Secondary key. Value only returned through POST to the action Channel List API, otherwise empty. - Key2 *string `json:"key2,omitempty"` - // IsEnabled - Whether this site is enabled for DirectLine channel - IsEnabled *bool `json:"isEnabled,omitempty"` - // IsWebchatPreviewEnabled - Whether this site is enabled for preview versions of Webchat - IsWebchatPreviewEnabled *bool `json:"isWebchatPreviewEnabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebChatSite. -func (wcs WebChatSite) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wcs.SiteName != nil { - objectMap["siteName"] = wcs.SiteName - } - if wcs.IsEnabled != nil { - objectMap["isEnabled"] = wcs.IsEnabled - } - if wcs.IsWebchatPreviewEnabled != nil { - objectMap["isWebchatPreviewEnabled"] = wcs.IsWebchatPreviewEnabled - } - return json.Marshal(objectMap) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/operations.go deleted file mode 100644 index 2cc6d6e16d46..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package botservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the azure Bot Service is a platform for creating smart conversational agents. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all the available BotService operations. -func (client OperationsClient) List(ctx context.Context) (result OperationEntityListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.oelr.Response.Response != nil { - sc = result.oelr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "botservice.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.oelr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "botservice.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.oelr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "botservice.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.oelr.hasNextLink() && result.oelr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.BotService/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationEntityListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationEntityListResult) (result OperationEntityListResult, err error) { - req, err := lastResults.operationEntityListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "botservice.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "botservice.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "botservice.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationEntityListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/privateendpointconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/privateendpointconnections.go deleted file mode 100644 index bd8eff11c97b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/privateendpointconnections.go +++ /dev/null @@ -1,399 +0,0 @@ -package botservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionsClient is the azure Bot Service is a platform for creating smart conversational agents. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create update the state of specified private endpoint connection associated with the Bot. -// Parameters: -// resourceGroupName - the name of the Bot resource group in the user subscription. -// resourceName - the name of the Bot resource. -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -// properties - the private endpoint connection properties. -func (client PrivateEndpointConnectionsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, - {TargetValue: properties, - Constraints: []validation.Constraint{{Target: "properties.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "properties.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("botservice.PrivateEndpointConnectionsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, properties) - if err != nil { - err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client PrivateEndpointConnectionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(properties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) CreateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified private endpoint connection associated with the Bot. -// Parameters: -// resourceGroupName - the name of the Bot resource group in the user subscription. -// resourceName - the name of the Bot resource. -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("botservice.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified private endpoint connection associated with the Bot. -// Parameters: -// resourceGroupName - the name of the Bot resource group in the user subscription. -// resourceName - the name of the Bot resource. -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("botservice.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all the private endpoint connections associated with the Bot. -// Parameters: -// resourceGroupName - the name of the Bot resource group in the user subscription. -// resourceName - the name of the Bot resource. -func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("botservice.PrivateEndpointConnectionsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/privatelinkresources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/privatelinkresources.go deleted file mode 100644 index a595559aa91e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/privatelinkresources.go +++ /dev/null @@ -1,121 +0,0 @@ -package botservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the azure Bot Service is a platform for creating smart conversational agents. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByBotResource gets the private link resources that need to be created for a Bot. -// Parameters: -// resourceGroupName - the name of the Bot resource group in the user subscription. -// resourceName - the name of the Bot resource. -func (client PrivateLinkResourcesClient) ListByBotResource(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateLinkResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByBotResource") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("botservice.PrivateLinkResourcesClient", "ListByBotResource", err.Error()) - } - - req, err := client.ListByBotResourcePreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "botservice.PrivateLinkResourcesClient", "ListByBotResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByBotResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "botservice.PrivateLinkResourcesClient", "ListByBotResource", resp, "Failure sending request") - return - } - - result, err = client.ListByBotResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "botservice.PrivateLinkResourcesClient", "ListByBotResource", resp, "Failure responding to request") - return - } - - return -} - -// ListByBotResourcePreparer prepares the ListByBotResource request. -func (client PrivateLinkResourcesClient) ListByBotResourcePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByBotResourceSender sends the ListByBotResource request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByBotResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByBotResourceResponder handles the response to the ListByBotResource request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByBotResourceResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/_meta.json deleted file mode 100644 index 36751a0d7105..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/customproviders/resource-manager/readme.md", - "tag": "package-2018-09-01-preview", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2018-09-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/customproviders/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/associations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/associations.go deleted file mode 100644 index b12503361093..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/associations.go +++ /dev/null @@ -1,384 +0,0 @@ -package customproviders - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AssociationsClient is the allows extension of ARM control plane with custom resource providers. -type AssociationsClient struct { - BaseClient -} - -// NewAssociationsClient creates an instance of the AssociationsClient client. -func NewAssociationsClient(subscriptionID string) AssociationsClient { - return NewAssociationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAssociationsClientWithBaseURI creates an instance of the AssociationsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAssociationsClientWithBaseURI(baseURI string, subscriptionID string) AssociationsClient { - return AssociationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an association. -// Parameters: -// scope - the scope of the association. The scope can be any valid REST resource instance. For example, use -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}' -// for a virtual machine resource. -// associationName - the name of the association. -// association - the parameters required to create or update an association. -func (client AssociationsClient) CreateOrUpdate(ctx context.Context, scope string, associationName string, association Association) (result AssociationsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AssociationsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, scope, associationName, association) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.AssociationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.AssociationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AssociationsClient) CreateOrUpdatePreparer(ctx context.Context, scope string, associationName string, association Association) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "associationName": autorest.Encode("path", associationName), - "scope": scope, - } - - const APIVersion = "2018-09-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - association.ID = nil - association.Name = nil - association.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}", pathParameters), - autorest.WithJSON(association), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AssociationsClient) CreateOrUpdateSender(req *http.Request) (future AssociationsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AssociationsClient) CreateOrUpdateResponder(resp *http.Response) (result Association, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an association. -// Parameters: -// scope - the scope of the association. -// associationName - the name of the association. -func (client AssociationsClient) Delete(ctx context.Context, scope string, associationName string) (result AssociationsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AssociationsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, scope, associationName) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.AssociationsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.AssociationsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AssociationsClient) DeletePreparer(ctx context.Context, scope string, associationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "associationName": autorest.Encode("path", associationName), - "scope": scope, - } - - const APIVersion = "2018-09-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AssociationsClient) DeleteSender(req *http.Request) (future AssociationsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AssociationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an association. -// Parameters: -// scope - the scope of the association. -// associationName - the name of the association. -func (client AssociationsClient) Get(ctx context.Context, scope string, associationName string) (result Association, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AssociationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, scope, associationName) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.AssociationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customproviders.AssociationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.AssociationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AssociationsClient) GetPreparer(ctx context.Context, scope string, associationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "associationName": autorest.Encode("path", associationName), - "scope": scope, - } - - const APIVersion = "2018-09-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CustomProviders/associations/{associationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AssociationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AssociationsClient) GetResponder(resp *http.Response) (result Association, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAll gets all association for the given scope. -// Parameters: -// scope - the scope of the association. -func (client AssociationsClient) ListAll(ctx context.Context, scope string) (result AssociationsListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AssociationsClient.ListAll") - defer func() { - sc := -1 - if result.al.Response.Response != nil { - sc = result.al.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listAllNextResults - req, err := client.ListAllPreparer(ctx, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.AssociationsClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.al.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customproviders.AssociationsClient", "ListAll", resp, "Failure sending request") - return - } - - result.al, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.AssociationsClient", "ListAll", resp, "Failure responding to request") - return - } - if result.al.hasNextLink() && result.al.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client AssociationsClient) ListAllPreparer(ctx context.Context, scope string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2018-09-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CustomProviders/associations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client AssociationsClient) ListAllSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client AssociationsClient) ListAllResponder(resp *http.Response) (result AssociationsList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAllNextResults retrieves the next set of results, if any. -func (client AssociationsClient) listAllNextResults(ctx context.Context, lastResults AssociationsList) (result AssociationsList, err error) { - req, err := lastResults.associationsListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "customproviders.AssociationsClient", "listAllNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customproviders.AssociationsClient", "listAllNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.AssociationsClient", "listAllNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAllComplete enumerates all values, automatically crossing page boundaries as required. -func (client AssociationsClient) ListAllComplete(ctx context.Context, scope string) (result AssociationsListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AssociationsClient.ListAll") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAll(ctx, scope) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/client.go deleted file mode 100644 index f5c0a9c15ebf..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/customproviders/armcustomproviders](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/customproviders/armcustomproviders). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package customproviders implements the Azure ARM Customproviders service API version 2018-09-01-preview. -// -// Allows extension of ARM control plane with custom resource providers. -package customproviders - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Customproviders - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Customproviders. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/customresourceprovider.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/customresourceprovider.go deleted file mode 100644 index a983c8feb58c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/customresourceprovider.go +++ /dev/null @@ -1,606 +0,0 @@ -package customproviders - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// CustomResourceProviderClient is the allows extension of ARM control plane with custom resource providers. -type CustomResourceProviderClient struct { - BaseClient -} - -// NewCustomResourceProviderClient creates an instance of the CustomResourceProviderClient client. -func NewCustomResourceProviderClient(subscriptionID string) CustomResourceProviderClient { - return NewCustomResourceProviderClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCustomResourceProviderClientWithBaseURI creates an instance of the CustomResourceProviderClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewCustomResourceProviderClientWithBaseURI(baseURI string, subscriptionID string) CustomResourceProviderClient { - return CustomResourceProviderClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the custom resource provider. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceProviderName - the name of the resource provider. -// resourceProvider - the parameters required to create or update a custom resource provider definition. -func (client CustomResourceProviderClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceProviderName string, resourceProvider CustomRPManifest) (result CustomResourceProviderCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomResourceProviderClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceProviderName, - Constraints: []validation.Constraint{{Target: "resourceProviderName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceProviderName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("customproviders.CustomResourceProviderClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceProviderName, resourceProvider) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CustomResourceProviderClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceProviderName string, resourceProvider CustomRPManifest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceProviderName": autorest.Encode("path", resourceProviderName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}", pathParameters), - autorest.WithJSON(resourceProvider), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CustomResourceProviderClient) CreateOrUpdateSender(req *http.Request) (future CustomResourceProviderCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client CustomResourceProviderClient) CreateOrUpdateResponder(resp *http.Response) (result CustomRPManifest, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the custom resource provider. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceProviderName - the name of the resource provider. -func (client CustomResourceProviderClient) Delete(ctx context.Context, resourceGroupName string, resourceProviderName string) (result CustomResourceProviderDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomResourceProviderClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceProviderName, - Constraints: []validation.Constraint{{Target: "resourceProviderName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceProviderName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("customproviders.CustomResourceProviderClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceProviderName) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CustomResourceProviderClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceProviderName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceProviderName": autorest.Encode("path", resourceProviderName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client CustomResourceProviderClient) DeleteSender(req *http.Request) (future CustomResourceProviderDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client CustomResourceProviderClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the custom resource provider manifest. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceProviderName - the name of the resource provider. -func (client CustomResourceProviderClient) Get(ctx context.Context, resourceGroupName string, resourceProviderName string) (result CustomRPManifest, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomResourceProviderClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceProviderName, - Constraints: []validation.Constraint{{Target: "resourceProviderName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceProviderName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("customproviders.CustomResourceProviderClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceProviderName) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CustomResourceProviderClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceProviderName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceProviderName": autorest.Encode("path", resourceProviderName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CustomResourceProviderClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CustomResourceProviderClient) GetResponder(resp *http.Response) (result CustomRPManifest, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets all the custom resource providers within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client CustomResourceProviderClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListByCustomRPManifestPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomResourceProviderClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.lbcrm.Response.Response != nil { - sc = result.lbcrm.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.lbcrm.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.lbcrm, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.lbcrm.hasNextLink() && result.lbcrm.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client CustomResourceProviderClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client CustomResourceProviderClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client CustomResourceProviderClient) ListByResourceGroupResponder(resp *http.Response) (result ListByCustomRPManifest, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client CustomResourceProviderClient) listByResourceGroupNextResults(ctx context.Context, lastResults ListByCustomRPManifest) (result ListByCustomRPManifest, err error) { - req, err := lastResults.listByCustomRPManifestPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client CustomResourceProviderClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ListByCustomRPManifestIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomResourceProviderClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription gets all the custom resource providers within a subscription. -func (client CustomResourceProviderClient) ListBySubscription(ctx context.Context) (result ListByCustomRPManifestPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomResourceProviderClient.ListBySubscription") - defer func() { - sc := -1 - if result.lbcrm.Response.Response != nil { - sc = result.lbcrm.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.lbcrm.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.lbcrm, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.lbcrm.hasNextLink() && result.lbcrm.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client CustomResourceProviderClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CustomProviders/resourceProviders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client CustomResourceProviderClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client CustomResourceProviderClient) ListBySubscriptionResponder(resp *http.Response) (result ListByCustomRPManifest, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client CustomResourceProviderClient) listBySubscriptionNextResults(ctx context.Context, lastResults ListByCustomRPManifest) (result ListByCustomRPManifest, err error) { - req, err := lastResults.listByCustomRPManifestPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client CustomResourceProviderClient) ListBySubscriptionComplete(ctx context.Context) (result ListByCustomRPManifestIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomResourceProviderClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// Update updates an existing custom resource provider. The only value that can be updated via PATCH currently is the -// tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceProviderName - the name of the resource provider. -// patchableResource - the updatable fields of a custom resource provider. -func (client CustomResourceProviderClient) Update(ctx context.Context, resourceGroupName string, resourceProviderName string, patchableResource ResourceProvidersUpdate) (result CustomRPManifest, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomResourceProviderClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceProviderName, - Constraints: []validation.Constraint{{Target: "resourceProviderName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceProviderName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("customproviders.CustomResourceProviderClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceProviderName, patchableResource) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CustomResourceProviderClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceProviderName string, patchableResource ResourceProvidersUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceProviderName": autorest.Encode("path", resourceProviderName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}", pathParameters), - autorest.WithJSON(patchableResource), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client CustomResourceProviderClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client CustomResourceProviderClient) UpdateResponder(resp *http.Response) (result CustomRPManifest, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/enums.go deleted file mode 100644 index 7b19bb2507ac..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/enums.go +++ /dev/null @@ -1,69 +0,0 @@ -package customproviders - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ActionRouting enumerates the values for action routing. -type ActionRouting string - -const ( - // Proxy ... - Proxy ActionRouting = "Proxy" -) - -// PossibleActionRoutingValues returns an array of possible values for the ActionRouting const type. -func PossibleActionRoutingValues() []ActionRouting { - return []ActionRouting{Proxy} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Accepted ... - Accepted ProvisioningState = "Accepted" - // Deleting ... - Deleting ProvisioningState = "Deleting" - // Failed ... - Failed ProvisioningState = "Failed" - // Running ... - Running ProvisioningState = "Running" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Accepted, Deleting, Failed, Running, Succeeded} -} - -// ResourceTypeRouting enumerates the values for resource type routing. -type ResourceTypeRouting string - -const ( - // ResourceTypeRoutingProxy ... - ResourceTypeRoutingProxy ResourceTypeRouting = "Proxy" - // ResourceTypeRoutingProxyCache ... - ResourceTypeRoutingProxyCache ResourceTypeRouting = "Proxy,Cache" -) - -// PossibleResourceTypeRoutingValues returns an array of possible values for the ResourceTypeRouting const type. -func PossibleResourceTypeRoutingValues() []ResourceTypeRouting { - return []ResourceTypeRouting{ResourceTypeRoutingProxy, ResourceTypeRoutingProxyCache} -} - -// ValidationType enumerates the values for validation type. -type ValidationType string - -const ( - // Swagger ... - Swagger ValidationType = "Swagger" -) - -// PossibleValidationTypeValues returns an array of possible values for the ValidationType const type. -func PossibleValidationTypeValues() []ValidationType { - return []ValidationType{Swagger} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/models.go deleted file mode 100644 index 6a787934cec5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/models.go +++ /dev/null @@ -1,998 +0,0 @@ -package customproviders - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders" - -// Association the resource definition of this association. -type Association struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The association id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The association name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The association type. - Type *string `json:"type,omitempty"` - // AssociationProperties - The properties of the association. - *AssociationProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Association. -func (a Association) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.AssociationProperties != nil { - objectMap["properties"] = a.AssociationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Association struct. -func (a *Association) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - case "properties": - if v != nil { - var associationProperties AssociationProperties - err = json.Unmarshal(*v, &associationProperties) - if err != nil { - return err - } - a.AssociationProperties = &associationProperties - } - } - } - - return nil -} - -// AssociationProperties the properties of the association. -type AssociationProperties struct { - // TargetResourceID - The REST resource instance of the target resource for this association. - TargetResourceID *string `json:"targetResourceId,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the association. Possible values include: 'Accepted', 'Deleting', 'Running', 'Succeeded', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for AssociationProperties. -func (a AssociationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.TargetResourceID != nil { - objectMap["targetResourceId"] = a.TargetResourceID - } - return json.Marshal(objectMap) -} - -// AssociationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type AssociationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AssociationsClient) (Association, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AssociationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AssociationsCreateOrUpdateFuture.Result. -func (future *AssociationsCreateOrUpdateFuture) result(client AssociationsClient) (a Association, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.AssociationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - a.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("customproviders.AssociationsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { - a, err = client.CreateOrUpdateResponder(a.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.AssociationsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request") - } - } - return -} - -// AssociationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AssociationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AssociationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AssociationsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AssociationsDeleteFuture.Result. -func (future *AssociationsDeleteFuture) result(client AssociationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.AssociationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("customproviders.AssociationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AssociationsList list of associations. -type AssociationsList struct { - autorest.Response `json:"-"` - // Value - The array of associations. - Value *[]Association `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AssociationsListIterator provides access to a complete listing of Association values. -type AssociationsListIterator struct { - i int - page AssociationsListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AssociationsListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AssociationsListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AssociationsListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AssociationsListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AssociationsListIterator) Response() AssociationsList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AssociationsListIterator) Value() Association { - if !iter.page.NotDone() { - return Association{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AssociationsListIterator type. -func NewAssociationsListIterator(page AssociationsListPage) AssociationsListIterator { - return AssociationsListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (al AssociationsList) IsEmpty() bool { - return al.Value == nil || len(*al.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (al AssociationsList) hasNextLink() bool { - return al.NextLink != nil && len(*al.NextLink) != 0 -} - -// associationsListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (al AssociationsList) associationsListPreparer(ctx context.Context) (*http.Request, error) { - if !al.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(al.NextLink))) -} - -// AssociationsListPage contains a page of Association values. -type AssociationsListPage struct { - fn func(context.Context, AssociationsList) (AssociationsList, error) - al AssociationsList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AssociationsListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AssociationsListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.al) - if err != nil { - return err - } - page.al = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AssociationsListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AssociationsListPage) NotDone() bool { - return !page.al.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AssociationsListPage) Response() AssociationsList { - return page.al -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AssociationsListPage) Values() []Association { - if page.al.IsEmpty() { - return nil - } - return *page.al.Value -} - -// Creates a new instance of the AssociationsListPage type. -func NewAssociationsListPage(cur AssociationsList, getNextPage func(context.Context, AssociationsList) (AssociationsList, error)) AssociationsListPage { - return AssociationsListPage{ - fn: getNextPage, - al: cur, - } -} - -// CustomResourceProviderCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type CustomResourceProviderCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CustomResourceProviderClient) (CustomRPManifest, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CustomResourceProviderCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CustomResourceProviderCreateOrUpdateFuture.Result. -func (future *CustomResourceProviderCreateOrUpdateFuture) result(client CustomResourceProviderClient) (crm CustomRPManifest, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - crm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("customproviders.CustomResourceProviderCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if crm.Response.Response, err = future.GetResult(sender); err == nil && crm.Response.Response.StatusCode != http.StatusNoContent { - crm, err = client.CreateOrUpdateResponder(crm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderCreateOrUpdateFuture", "Result", crm.Response.Response, "Failure responding to request") - } - } - return -} - -// CustomResourceProviderDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type CustomResourceProviderDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CustomResourceProviderClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CustomResourceProviderDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CustomResourceProviderDeleteFuture.Result. -func (future *CustomResourceProviderDeleteFuture) result(client CustomResourceProviderClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.CustomResourceProviderDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("customproviders.CustomResourceProviderDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// CustomRPActionRouteDefinition the route definition for an action implemented by the custom resource -// provider. -type CustomRPActionRouteDefinition struct { - // RoutingType - The routing types that are supported for action requests. Possible values include: 'Proxy' - RoutingType ActionRouting `json:"routingType,omitempty"` - // Name - The name of the route definition. This becomes the name for the ARM extension (e.g. '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}/{name}') - Name *string `json:"name,omitempty"` - // Endpoint - The route definition endpoint URI that the custom resource provider will proxy requests to. This can be in the form of a flat URI (e.g. 'https://testendpoint/') or can specify to route via a path (e.g. 'https://testendpoint/{requestPath}') - Endpoint *string `json:"endpoint,omitempty"` -} - -// CustomRPManifest a manifest file that defines the custom resource provider resources. -type CustomRPManifest struct { - autorest.Response `json:"-"` - // CustomRPManifestProperties - The manifest for the custom resource provider - *CustomRPManifestProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CustomRPManifest. -func (crm CustomRPManifest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if crm.CustomRPManifestProperties != nil { - objectMap["properties"] = crm.CustomRPManifestProperties - } - if crm.Location != nil { - objectMap["location"] = crm.Location - } - if crm.Tags != nil { - objectMap["tags"] = crm.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CustomRPManifest struct. -func (crm *CustomRPManifest) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var customRPManifestProperties CustomRPManifestProperties - err = json.Unmarshal(*v, &customRPManifestProperties) - if err != nil { - return err - } - crm.CustomRPManifestProperties = &customRPManifestProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - crm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - crm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - crm.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - crm.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - crm.Tags = tags - } - } - } - - return nil -} - -// CustomRPManifestProperties the manifest for the custom resource provider -type CustomRPManifestProperties struct { - // Actions - A list of actions that the custom resource provider implements. - Actions *[]CustomRPActionRouteDefinition `json:"actions,omitempty"` - // ResourceTypes - A list of resource types that the custom resource provider implements. - ResourceTypes *[]CustomRPResourceTypeRouteDefinition `json:"resourceTypes,omitempty"` - // Validations - A list of validations to run on the custom resource provider's requests. - Validations *[]CustomRPValidations `json:"validations,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the resource provider. Possible values include: 'Accepted', 'Deleting', 'Running', 'Succeeded', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for CustomRPManifestProperties. -func (crm CustomRPManifestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if crm.Actions != nil { - objectMap["actions"] = crm.Actions - } - if crm.ResourceTypes != nil { - objectMap["resourceTypes"] = crm.ResourceTypes - } - if crm.Validations != nil { - objectMap["validations"] = crm.Validations - } - return json.Marshal(objectMap) -} - -// CustomRPResourceTypeRouteDefinition the route definition for a resource implemented by the custom -// resource provider. -type CustomRPResourceTypeRouteDefinition struct { - // RoutingType - The routing types that are supported for resource requests. Possible values include: 'ResourceTypeRoutingProxy', 'ResourceTypeRoutingProxyCache' - RoutingType ResourceTypeRouting `json:"routingType,omitempty"` - // Name - The name of the route definition. This becomes the name for the ARM extension (e.g. '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}/{name}') - Name *string `json:"name,omitempty"` - // Endpoint - The route definition endpoint URI that the custom resource provider will proxy requests to. This can be in the form of a flat URI (e.g. 'https://testendpoint/') or can specify to route via a path (e.g. 'https://testendpoint/{requestPath}') - Endpoint *string `json:"endpoint,omitempty"` -} - -// CustomRPRouteDefinition a route definition that defines an action or resource that can be interacted -// with through the custom resource provider. -type CustomRPRouteDefinition struct { - // Name - The name of the route definition. This becomes the name for the ARM extension (e.g. '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomProviders/resourceProviders/{resourceProviderName}/{name}') - Name *string `json:"name,omitempty"` - // Endpoint - The route definition endpoint URI that the custom resource provider will proxy requests to. This can be in the form of a flat URI (e.g. 'https://testendpoint/') or can specify to route via a path (e.g. 'https://testendpoint/{requestPath}') - Endpoint *string `json:"endpoint,omitempty"` -} - -// CustomRPValidations a validation to apply on custom resource provider requests. -type CustomRPValidations struct { - // ValidationType - The type of validation to run against a matching request. Possible values include: 'Swagger' - ValidationType ValidationType `json:"validationType,omitempty"` - // Specification - A link to the validation specification. The specification must be hosted on raw.githubusercontent.com. - Specification *string `json:"specification,omitempty"` -} - -// ErrorDefinition error definition. -type ErrorDefinition struct { - // Code - READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; Description of the error. - Message *string `json:"message,omitempty"` - // Details - READ-ONLY; Internal error details. - Details *[]ErrorDefinition `json:"details,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorDefinition. -func (ed ErrorDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse error response. -type ErrorResponse struct { - // Error - The error details. - Error *ErrorDefinition `json:"error,omitempty"` -} - -// ListByCustomRPManifest list of custom resource providers. -type ListByCustomRPManifest struct { - autorest.Response `json:"-"` - // Value - The array of custom resource provider manifests. - Value *[]CustomRPManifest `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListByCustomRPManifestIterator provides access to a complete listing of CustomRPManifest values. -type ListByCustomRPManifestIterator struct { - i int - page ListByCustomRPManifestPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListByCustomRPManifestIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListByCustomRPManifestIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListByCustomRPManifestIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListByCustomRPManifestIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListByCustomRPManifestIterator) Response() ListByCustomRPManifest { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListByCustomRPManifestIterator) Value() CustomRPManifest { - if !iter.page.NotDone() { - return CustomRPManifest{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListByCustomRPManifestIterator type. -func NewListByCustomRPManifestIterator(page ListByCustomRPManifestPage) ListByCustomRPManifestIterator { - return ListByCustomRPManifestIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lbcrm ListByCustomRPManifest) IsEmpty() bool { - return lbcrm.Value == nil || len(*lbcrm.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lbcrm ListByCustomRPManifest) hasNextLink() bool { - return lbcrm.NextLink != nil && len(*lbcrm.NextLink) != 0 -} - -// listByCustomRPManifestPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lbcrm ListByCustomRPManifest) listByCustomRPManifestPreparer(ctx context.Context) (*http.Request, error) { - if !lbcrm.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lbcrm.NextLink))) -} - -// ListByCustomRPManifestPage contains a page of CustomRPManifest values. -type ListByCustomRPManifestPage struct { - fn func(context.Context, ListByCustomRPManifest) (ListByCustomRPManifest, error) - lbcrm ListByCustomRPManifest -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListByCustomRPManifestPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListByCustomRPManifestPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lbcrm) - if err != nil { - return err - } - page.lbcrm = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListByCustomRPManifestPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListByCustomRPManifestPage) NotDone() bool { - return !page.lbcrm.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListByCustomRPManifestPage) Response() ListByCustomRPManifest { - return page.lbcrm -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListByCustomRPManifestPage) Values() []CustomRPManifest { - if page.lbcrm.IsEmpty() { - return nil - } - return *page.lbcrm.Value -} - -// Creates a new instance of the ListByCustomRPManifestPage type. -func NewListByCustomRPManifestPage(cur ListByCustomRPManifest, getNextPage func(context.Context, ListByCustomRPManifest) (ListByCustomRPManifest, error)) ListByCustomRPManifestPage { - return ListByCustomRPManifestPage{ - fn: getNextPage, - lbcrm: cur, - } -} - -// Resource the resource definition. -type Resource struct { - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// ResourceProviderOperation supported operations of this resource provider. -type ResourceProviderOperation struct { - // Name - Operation name, in format of {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *ResourceProviderOperationDisplay `json:"display,omitempty"` -} - -// ResourceProviderOperationDisplay display metadata associated with the operation. -type ResourceProviderOperationDisplay struct { - // Provider - Resource provider: Microsoft Custom Providers. - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - Type of operation: get, read, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - Description of this operation. - Description *string `json:"description,omitempty"` -} - -// ResourceProviderOperationList results of the request to list operations. -type ResourceProviderOperationList struct { - autorest.Response `json:"-"` - // Value - List of operations supported by this resource provider. - Value *[]ResourceProviderOperation `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ResourceProviderOperationListIterator provides access to a complete listing of ResourceProviderOperation -// values. -type ResourceProviderOperationListIterator struct { - i int - page ResourceProviderOperationListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ResourceProviderOperationListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ResourceProviderOperationListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ResourceProviderOperationListIterator) Response() ResourceProviderOperationList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ResourceProviderOperationListIterator) Value() ResourceProviderOperation { - if !iter.page.NotDone() { - return ResourceProviderOperation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ResourceProviderOperationListIterator type. -func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator { - return ResourceProviderOperationListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rpol ResourceProviderOperationList) IsEmpty() bool { - return rpol.Value == nil || len(*rpol.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rpol ResourceProviderOperationList) hasNextLink() bool { - return rpol.NextLink != nil && len(*rpol.NextLink) != 0 -} - -// resourceProviderOperationListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) { - if !rpol.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rpol.NextLink))) -} - -// ResourceProviderOperationListPage contains a page of ResourceProviderOperation values. -type ResourceProviderOperationListPage struct { - fn func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error) - rpol ResourceProviderOperationList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rpol) - if err != nil { - return err - } - page.rpol = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ResourceProviderOperationListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ResourceProviderOperationListPage) NotDone() bool { - return !page.rpol.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList { - return page.rpol -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation { - if page.rpol.IsEmpty() { - return nil - } - return *page.rpol.Value -} - -// Creates a new instance of the ResourceProviderOperationListPage type. -func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage { - return ResourceProviderOperationListPage{ - fn: getNextPage, - rpol: cur, - } -} - -// ResourceProvidersUpdate custom resource provider update information. -type ResourceProvidersUpdate struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ResourceProvidersUpdate. -func (rpu ResourceProvidersUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rpu.Tags != nil { - objectMap["tags"] = rpu.Tags - } - return json.Marshal(objectMap) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/operations.go deleted file mode 100644 index f0f33f82aca0..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package customproviders - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the allows extension of ARM control plane with custom resource providers. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List the list of operations provided by Microsoft CustomProviders. -func (client OperationsClient) List(ctx context.Context) (result ResourceProviderOperationListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.rpol.Response.Response != nil { - sc = result.rpol.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rpol.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customproviders.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.rpol, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.rpol.hasNextLink() && result.rpol.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2018-09-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.CustomProviders/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result ResourceProviderOperationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults ResourceProviderOperationList) (result ResourceProviderOperationList, err error) { - req, err := lastResults.resourceProviderOperationListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "customproviders.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customproviders.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customproviders.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result ResourceProviderOperationListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/version.go deleted file mode 100644 index 7f79d09d0bf9..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package customproviders - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " customproviders/2018-09-01-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/_meta.json deleted file mode 100644 index a89b8d770067..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "d600759c3516b61a7c353bc8682bccbab85a6f65", - "readme": "/_/azure-rest-api-specs/specification/recoveryservices/resource-manager/readme.md", - "tag": "package-2021-08", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-08 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/recoveryservices/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/client.go deleted file mode 100644 index 08436a677ed5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/client.go +++ /dev/null @@ -1,201 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservices](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservices). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package recoveryservices implements the Azure ARM Recoveryservices service API version 2021-08-01. -// -// Recovery Services Client -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -const ( - // DefaultBaseURI is the default URI used for the service Recoveryservices - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Recoveryservices. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} - -// GetOperationResult gets the operation result for a resource. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client BaseClient) GetOperationResult(ctx context.Context, resourceGroupName string, vaultName string, operationID string) (result Vault, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetOperationResult") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetOperationResultPreparer(ctx, resourceGroupName, vaultName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.BaseClient", "GetOperationResult", nil, "Failure preparing request") - return - } - - resp, err := client.GetOperationResultSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.BaseClient", "GetOperationResult", resp, "Failure sending request") - return - } - - result, err = client.GetOperationResultResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.BaseClient", "GetOperationResult", resp, "Failure responding to request") - return - } - - return -} - -// GetOperationResultPreparer prepares the GetOperationResult request. -func (client BaseClient) GetOperationResultPreparer(ctx context.Context, resourceGroupName string, vaultName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetOperationResultSender sends the GetOperationResult request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetOperationResultSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetOperationResultResponder handles the response to the GetOperationResult request. The method always -// closes the http.Response Body. -func (client BaseClient) GetOperationResultResponder(resp *http.Response) (result Vault, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetOperationStatus gets the operation status for a resource. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client BaseClient) GetOperationStatus(ctx context.Context, resourceGroupName string, vaultName string, operationID string) (result OperationResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetOperationStatus") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetOperationStatusPreparer(ctx, resourceGroupName, vaultName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.BaseClient", "GetOperationStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetOperationStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.BaseClient", "GetOperationStatus", resp, "Failure sending request") - return - } - - result, err = client.GetOperationStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.BaseClient", "GetOperationStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetOperationStatusPreparer prepares the GetOperationStatus request. -func (client BaseClient) GetOperationStatusPreparer(ctx context.Context, resourceGroupName string, vaultName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationStatus/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetOperationStatusSender sends the GetOperationStatus request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetOperationStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetOperationStatusResponder handles the response to the GetOperationStatus request. The method always -// closes the http.Response Body. -func (client BaseClient) GetOperationStatusResponder(resp *http.Response) (result OperationResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/enums.go deleted file mode 100644 index b17c9c68a6be..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/enums.go +++ /dev/null @@ -1,255 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AuthType enumerates the values for auth type. -type AuthType string - -const ( - // AuthTypeAAD ... - AuthTypeAAD AuthType = "AAD" - // AuthTypeAccessControlService ... - AuthTypeAccessControlService AuthType = "AccessControlService" - // AuthTypeACS ... - AuthTypeACS AuthType = "ACS" - // AuthTypeAzureActiveDirectory ... - AuthTypeAzureActiveDirectory AuthType = "AzureActiveDirectory" - // AuthTypeInvalid ... - AuthTypeInvalid AuthType = "Invalid" -) - -// PossibleAuthTypeValues returns an array of possible values for the AuthType const type. -func PossibleAuthTypeValues() []AuthType { - return []AuthType{AuthTypeAAD, AuthTypeAccessControlService, AuthTypeACS, AuthTypeAzureActiveDirectory, AuthTypeInvalid} -} - -// AuthTypeBasicResourceCertificateDetails enumerates the values for auth type basic resource certificate -// details. -type AuthTypeBasicResourceCertificateDetails string - -const ( - // AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService ... - AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService AuthTypeBasicResourceCertificateDetails = "AccessControlService" - // AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory ... - AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory AuthTypeBasicResourceCertificateDetails = "AzureActiveDirectory" - // AuthTypeBasicResourceCertificateDetailsAuthTypeResourceCertificateDetails ... - AuthTypeBasicResourceCertificateDetailsAuthTypeResourceCertificateDetails AuthTypeBasicResourceCertificateDetails = "ResourceCertificateDetails" -) - -// PossibleAuthTypeBasicResourceCertificateDetailsValues returns an array of possible values for the AuthTypeBasicResourceCertificateDetails const type. -func PossibleAuthTypeBasicResourceCertificateDetailsValues() []AuthTypeBasicResourceCertificateDetails { - return []AuthTypeBasicResourceCertificateDetails{AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService, AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory, AuthTypeBasicResourceCertificateDetailsAuthTypeResourceCertificateDetails} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// InfrastructureEncryptionState enumerates the values for infrastructure encryption state. -type InfrastructureEncryptionState string - -const ( - // InfrastructureEncryptionStateDisabled ... - InfrastructureEncryptionStateDisabled InfrastructureEncryptionState = "Disabled" - // InfrastructureEncryptionStateEnabled ... - InfrastructureEncryptionStateEnabled InfrastructureEncryptionState = "Enabled" -) - -// PossibleInfrastructureEncryptionStateValues returns an array of possible values for the InfrastructureEncryptionState const type. -func PossibleInfrastructureEncryptionStateValues() []InfrastructureEncryptionState { - return []InfrastructureEncryptionState{InfrastructureEncryptionStateDisabled, InfrastructureEncryptionStateEnabled} -} - -// PrivateEndpointConnectionStatus enumerates the values for private endpoint connection status. -type PrivateEndpointConnectionStatus string - -const ( - // PrivateEndpointConnectionStatusApproved ... - PrivateEndpointConnectionStatusApproved PrivateEndpointConnectionStatus = "Approved" - // PrivateEndpointConnectionStatusDisconnected ... - PrivateEndpointConnectionStatusDisconnected PrivateEndpointConnectionStatus = "Disconnected" - // PrivateEndpointConnectionStatusPending ... - PrivateEndpointConnectionStatusPending PrivateEndpointConnectionStatus = "Pending" - // PrivateEndpointConnectionStatusRejected ... - PrivateEndpointConnectionStatusRejected PrivateEndpointConnectionStatus = "Rejected" -) - -// PossiblePrivateEndpointConnectionStatusValues returns an array of possible values for the PrivateEndpointConnectionStatus const type. -func PossiblePrivateEndpointConnectionStatusValues() []PrivateEndpointConnectionStatus { - return []PrivateEndpointConnectionStatus{PrivateEndpointConnectionStatusApproved, PrivateEndpointConnectionStatusDisconnected, PrivateEndpointConnectionStatusPending, PrivateEndpointConnectionStatusRejected} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStatePending ... - ProvisioningStatePending ProvisioningState = "Pending" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStatePending, ProvisioningStateSucceeded} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone ... - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeSystemAssignedUserAssigned ... - ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" - // ResourceIdentityTypeUserAssigned ... - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} -} - -// ResourceMoveState enumerates the values for resource move state. -type ResourceMoveState string - -const ( - // ResourceMoveStateCommitFailed ... - ResourceMoveStateCommitFailed ResourceMoveState = "CommitFailed" - // ResourceMoveStateCommitTimedout ... - ResourceMoveStateCommitTimedout ResourceMoveState = "CommitTimedout" - // ResourceMoveStateCriticalFailure ... - ResourceMoveStateCriticalFailure ResourceMoveState = "CriticalFailure" - // ResourceMoveStateFailure ... - ResourceMoveStateFailure ResourceMoveState = "Failure" - // ResourceMoveStateInProgress ... - ResourceMoveStateInProgress ResourceMoveState = "InProgress" - // ResourceMoveStateMoveSucceeded ... - ResourceMoveStateMoveSucceeded ResourceMoveState = "MoveSucceeded" - // ResourceMoveStatePartialSuccess ... - ResourceMoveStatePartialSuccess ResourceMoveState = "PartialSuccess" - // ResourceMoveStatePrepareFailed ... - ResourceMoveStatePrepareFailed ResourceMoveState = "PrepareFailed" - // ResourceMoveStatePrepareTimedout ... - ResourceMoveStatePrepareTimedout ResourceMoveState = "PrepareTimedout" - // ResourceMoveStateUnknown ... - ResourceMoveStateUnknown ResourceMoveState = "Unknown" -) - -// PossibleResourceMoveStateValues returns an array of possible values for the ResourceMoveState const type. -func PossibleResourceMoveStateValues() []ResourceMoveState { - return []ResourceMoveState{ResourceMoveStateCommitFailed, ResourceMoveStateCommitTimedout, ResourceMoveStateCriticalFailure, ResourceMoveStateFailure, ResourceMoveStateInProgress, ResourceMoveStateMoveSucceeded, ResourceMoveStatePartialSuccess, ResourceMoveStatePrepareFailed, ResourceMoveStatePrepareTimedout, ResourceMoveStateUnknown} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // SkuNameRS0 ... - SkuNameRS0 SkuName = "RS0" - // SkuNameStandard ... - SkuNameStandard SkuName = "Standard" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{SkuNameRS0, SkuNameStandard} -} - -// TriggerType enumerates the values for trigger type. -type TriggerType string - -const ( - // TriggerTypeForcedUpgrade ... - TriggerTypeForcedUpgrade TriggerType = "ForcedUpgrade" - // TriggerTypeUserTriggered ... - TriggerTypeUserTriggered TriggerType = "UserTriggered" -) - -// PossibleTriggerTypeValues returns an array of possible values for the TriggerType const type. -func PossibleTriggerTypeValues() []TriggerType { - return []TriggerType{TriggerTypeForcedUpgrade, TriggerTypeUserTriggered} -} - -// UsagesUnit enumerates the values for usages unit. -type UsagesUnit string - -const ( - // UsagesUnitBytes ... - UsagesUnitBytes UsagesUnit = "Bytes" - // UsagesUnitBytesPerSecond ... - UsagesUnitBytesPerSecond UsagesUnit = "BytesPerSecond" - // UsagesUnitCount ... - UsagesUnitCount UsagesUnit = "Count" - // UsagesUnitCountPerSecond ... - UsagesUnitCountPerSecond UsagesUnit = "CountPerSecond" - // UsagesUnitPercent ... - UsagesUnitPercent UsagesUnit = "Percent" - // UsagesUnitSeconds ... - UsagesUnitSeconds UsagesUnit = "Seconds" -) - -// PossibleUsagesUnitValues returns an array of possible values for the UsagesUnit const type. -func PossibleUsagesUnitValues() []UsagesUnit { - return []UsagesUnit{UsagesUnitBytes, UsagesUnitBytesPerSecond, UsagesUnitCount, UsagesUnitCountPerSecond, UsagesUnitPercent, UsagesUnitSeconds} -} - -// VaultPrivateEndpointState enumerates the values for vault private endpoint state. -type VaultPrivateEndpointState string - -const ( - // VaultPrivateEndpointStateEnabled ... - VaultPrivateEndpointStateEnabled VaultPrivateEndpointState = "Enabled" - // VaultPrivateEndpointStateNone ... - VaultPrivateEndpointStateNone VaultPrivateEndpointState = "None" -) - -// PossibleVaultPrivateEndpointStateValues returns an array of possible values for the VaultPrivateEndpointState const type. -func PossibleVaultPrivateEndpointStateValues() []VaultPrivateEndpointState { - return []VaultPrivateEndpointState{VaultPrivateEndpointStateEnabled, VaultPrivateEndpointStateNone} -} - -// VaultUpgradeState enumerates the values for vault upgrade state. -type VaultUpgradeState string - -const ( - // VaultUpgradeStateFailed ... - VaultUpgradeStateFailed VaultUpgradeState = "Failed" - // VaultUpgradeStateInProgress ... - VaultUpgradeStateInProgress VaultUpgradeState = "InProgress" - // VaultUpgradeStateUnknown ... - VaultUpgradeStateUnknown VaultUpgradeState = "Unknown" - // VaultUpgradeStateUpgraded ... - VaultUpgradeStateUpgraded VaultUpgradeState = "Upgraded" -) - -// PossibleVaultUpgradeStateValues returns an array of possible values for the VaultUpgradeState const type. -func PossibleVaultUpgradeStateValues() []VaultUpgradeState { - return []VaultUpgradeState{VaultUpgradeStateFailed, VaultUpgradeStateInProgress, VaultUpgradeStateUnknown, VaultUpgradeStateUpgraded} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/models.go deleted file mode 100644 index 62b30f59d924..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/models.go +++ /dev/null @@ -1,1802 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices" - -// CertificateRequest details of the certificate to be uploaded to the vault. -type CertificateRequest struct { - Properties *RawCertificateData `json:"properties,omitempty"` -} - -// CheckNameAvailabilityParameters resource Name availability input parameters - Resource type and resource -// name -type CheckNameAvailabilityParameters struct { - // Type - Describes the Resource type: Microsoft.RecoveryServices/Vaults - Type *string `json:"type,omitempty"` - // Name - Resource name for which availability needs to be checked - Name *string `json:"name,omitempty"` -} - -// CheckNameAvailabilityResult response for check name availability API. Resource provider will set -// availability as true | false. -type CheckNameAvailabilityResult struct { - autorest.Response `json:"-"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason *string `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// ClientDiscoveryDisplay localized display information of an operation. -type ClientDiscoveryDisplay struct { - // Provider - Name of the provider for display purposes - Provider *string `json:"provider,omitempty"` - // Resource - ResourceType for which this Operation can be performed. - Resource *string `json:"resource,omitempty"` - // Operation - Operations Name itself. - Operation *string `json:"operation,omitempty"` - // Description - Description of the operation having details of what operation is about. - Description *string `json:"description,omitempty"` -} - -// ClientDiscoveryForLogSpecification class to represent shoebox log specification in json client -// discovery. -type ClientDiscoveryForLogSpecification struct { - // Name - Name of the log. - Name *string `json:"name,omitempty"` - // DisplayName - Localized display name - DisplayName *string `json:"displayName,omitempty"` - // BlobDuration - Blobs created in customer storage account per hour - BlobDuration *string `json:"blobDuration,omitempty"` -} - -// ClientDiscoveryForProperties class to represent shoebox properties in json client discovery. -type ClientDiscoveryForProperties struct { - // ServiceSpecification - Operation properties. - ServiceSpecification *ClientDiscoveryForServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// ClientDiscoveryForServiceSpecification class to represent shoebox service specification in json client -// discovery. -type ClientDiscoveryForServiceSpecification struct { - // LogSpecifications - List of log specifications of this operation. - LogSpecifications *[]ClientDiscoveryForLogSpecification `json:"logSpecifications,omitempty"` -} - -// ClientDiscoveryResponse operations List response which contains list of available APIs. -type ClientDiscoveryResponse struct { - autorest.Response `json:"-"` - // Value - List of available operations. - Value *[]ClientDiscoveryValueForSingleAPI `json:"value,omitempty"` - // NextLink - Link to the next chunk of the response - NextLink *string `json:"nextLink,omitempty"` -} - -// ClientDiscoveryResponseIterator provides access to a complete listing of -// ClientDiscoveryValueForSingleAPI values. -type ClientDiscoveryResponseIterator struct { - i int - page ClientDiscoveryResponsePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ClientDiscoveryResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClientDiscoveryResponseIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ClientDiscoveryResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ClientDiscoveryResponseIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ClientDiscoveryResponseIterator) Response() ClientDiscoveryResponse { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ClientDiscoveryResponseIterator) Value() ClientDiscoveryValueForSingleAPI { - if !iter.page.NotDone() { - return ClientDiscoveryValueForSingleAPI{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ClientDiscoveryResponseIterator type. -func NewClientDiscoveryResponseIterator(page ClientDiscoveryResponsePage) ClientDiscoveryResponseIterator { - return ClientDiscoveryResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cdr ClientDiscoveryResponse) IsEmpty() bool { - return cdr.Value == nil || len(*cdr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cdr ClientDiscoveryResponse) hasNextLink() bool { - return cdr.NextLink != nil && len(*cdr.NextLink) != 0 -} - -// clientDiscoveryResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cdr ClientDiscoveryResponse) clientDiscoveryResponsePreparer(ctx context.Context) (*http.Request, error) { - if !cdr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cdr.NextLink))) -} - -// ClientDiscoveryResponsePage contains a page of ClientDiscoveryValueForSingleAPI values. -type ClientDiscoveryResponsePage struct { - fn func(context.Context, ClientDiscoveryResponse) (ClientDiscoveryResponse, error) - cdr ClientDiscoveryResponse -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ClientDiscoveryResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClientDiscoveryResponsePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cdr) - if err != nil { - return err - } - page.cdr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ClientDiscoveryResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ClientDiscoveryResponsePage) NotDone() bool { - return !page.cdr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ClientDiscoveryResponsePage) Response() ClientDiscoveryResponse { - return page.cdr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ClientDiscoveryResponsePage) Values() []ClientDiscoveryValueForSingleAPI { - if page.cdr.IsEmpty() { - return nil - } - return *page.cdr.Value -} - -// Creates a new instance of the ClientDiscoveryResponsePage type. -func NewClientDiscoveryResponsePage(cur ClientDiscoveryResponse, getNextPage func(context.Context, ClientDiscoveryResponse) (ClientDiscoveryResponse, error)) ClientDiscoveryResponsePage { - return ClientDiscoveryResponsePage{ - fn: getNextPage, - cdr: cur, - } -} - -// ClientDiscoveryValueForSingleAPI available operation details. -type ClientDiscoveryValueForSingleAPI struct { - // Name - Name of the Operation. - Name *string `json:"name,omitempty"` - // Display - Contains the localized display information for this particular operation - Display *ClientDiscoveryDisplay `json:"display,omitempty"` - // Origin - The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX - Origin *string `json:"origin,omitempty"` - // Properties - ShoeBox properties for the given operation. - Properties *ClientDiscoveryForProperties `json:"properties,omitempty"` -} - -// CloudError an error response from Azure Backup. -type CloudError struct { - Error *Error `json:"error,omitempty"` -} - -// CmkKekIdentity the details of the identity used for CMK -type CmkKekIdentity struct { - // UseSystemAssignedIdentity - Indicate that system assigned identity should be used. Mutually exclusive with 'userAssignedIdentity' field - UseSystemAssignedIdentity *bool `json:"useSystemAssignedIdentity,omitempty"` - // UserAssignedIdentity - The user assigned identity to be used to grant permissions in case the type of identity used is UserAssigned - UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` -} - -// CmkKeyVaultProperties the properties of the Key Vault which hosts CMK -type CmkKeyVaultProperties struct { - // KeyURI - The key uri of the Customer Managed Key - KeyURI *string `json:"keyUri,omitempty"` -} - -// Error the resource management error response. -type Error struct { - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]Error `json:"details,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` -} - -// MarshalJSON is the custom marshaler for Error. -func (e Error) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IdentityData identity for the resource. -type IdentityData struct { - // PrincipalID - READ-ONLY; The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - 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. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeNone', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - 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}'. - UserAssignedIdentities map[string]*UserIdentity `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for IdentityData. -func (ID IdentityData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ID.Type != "" { - objectMap["type"] = ID.Type - } - if ID.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = ID.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// JobsSummary summary of the replication job data for this vault. -type JobsSummary struct { - // FailedJobs - Count of failed jobs. - FailedJobs *int32 `json:"failedJobs,omitempty"` - // SuspendedJobs - Count of suspended jobs. - SuspendedJobs *int32 `json:"suspendedJobs,omitempty"` - // InProgressJobs - Count of in-progress jobs. - InProgressJobs *int32 `json:"inProgressJobs,omitempty"` -} - -// MonitoringSummary summary of the replication monitoring data for this vault. -type MonitoringSummary struct { - // UnHealthyVMCount - Count of unhealthy VMs. - UnHealthyVMCount *int32 `json:"unHealthyVmCount,omitempty"` - // UnHealthyProviderCount - Count of unhealthy replication providers. - UnHealthyProviderCount *int32 `json:"unHealthyProviderCount,omitempty"` - // EventsCount - Count of all critical warnings. - EventsCount *int32 `json:"eventsCount,omitempty"` - // DeprecatedProviderCount - Count of all deprecated recovery service providers. - DeprecatedProviderCount *int32 `json:"deprecatedProviderCount,omitempty"` - // SupportedProviderCount - Count of all the supported recovery service providers. - SupportedProviderCount *int32 `json:"supportedProviderCount,omitempty"` - // UnsupportedProviderCount - Count of all the unsupported recovery service providers. - UnsupportedProviderCount *int32 `json:"unsupportedProviderCount,omitempty"` -} - -// NameInfo the name of usage. -type NameInfo struct { - // Value - Value of usage. - Value *string `json:"value,omitempty"` - // LocalizedValue - Localized value of usage. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// OperationResource operation Resource -type OperationResource struct { - autorest.Response `json:"-"` - // EndTime - End time of the operation - EndTime *date.Time `json:"endTime,omitempty"` - // Error - Required if status == failed or status == canceled. This is the OData v4 error format, used by the RPC and will go into the v2.2 Azure REST API guidelines. - Error *Error `json:"error,omitempty"` - // ID - It should match what is used to GET the operation result - ID *string `json:"id,omitempty"` - // Name - It must match the last segment of the "id" field, and will typically be a GUID / system generated value - Name *string `json:"name,omitempty"` - // Status - The status of the operation. (InProgress/Success/Failed/Cancelled) - Status *string `json:"status,omitempty"` - // StartTime - Start time of the operation - StartTime *date.Time `json:"startTime,omitempty"` -} - -// PatchTrackedResource tracked resource with location. -type PatchTrackedResource struct { - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - // Etag - Optional ETag. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for PatchTrackedResource. -func (ptr PatchTrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ptr.Location != nil { - objectMap["location"] = ptr.Location - } - if ptr.Tags != nil { - objectMap["tags"] = ptr.Tags - } - if ptr.Etag != nil { - objectMap["etag"] = ptr.Etag - } - return json.Marshal(objectMap) -} - -// PatchVault patch Resource information, as returned by the resource provider. -type PatchVault struct { - Properties *VaultProperties `json:"properties,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Identity *IdentityData `json:"identity,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - // Etag - Optional ETag. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for PatchVault. -func (pv PatchVault) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pv.Properties != nil { - objectMap["properties"] = pv.Properties - } - if pv.Sku != nil { - objectMap["sku"] = pv.Sku - } - if pv.Identity != nil { - objectMap["identity"] = pv.Identity - } - if pv.Location != nil { - objectMap["location"] = pv.Location - } - if pv.Tags != nil { - objectMap["tags"] = pv.Tags - } - if pv.Etag != nil { - objectMap["etag"] = pv.Etag - } - return json.Marshal(objectMap) -} - -// PrivateEndpoint the Private Endpoint network resource that is linked to the Private Endpoint connection. -type PrivateEndpoint struct { - // ID - READ-ONLY; Gets or sets id. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpoint. -func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection private Endpoint Connection Response Properties. -type PrivateEndpointConnection struct { - // ProvisioningState - READ-ONLY; Gets or sets provisioning state of the private endpoint connection. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateDeleting', 'ProvisioningStateFailed', 'ProvisioningStatePending' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = pec.PrivateEndpoint - } - if pec.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = pec.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionVaultProperties information to be stored in Vault properties as an element of -// privateEndpointConnections List. -type PrivateEndpointConnectionVaultProperties struct { - // ID - READ-ONLY; Format of id subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.[Service]/{resource}/{resourceName}/privateEndpointConnections/{connectionName}. - ID *string `json:"id,omitempty"` - Properties *PrivateEndpointConnection `json:"properties,omitempty"` - // Name - READ-ONLY; The name of the private Endpoint Connection - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type, which will be of the format, Microsoft.RecoveryServices/vaults/privateEndpointConnections - Type *string `json:"type,omitempty"` - // Location - READ-ONLY; The location of the private Endpoint connection - Location *string `json:"location,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionVaultProperties. -func (pecvp PrivateEndpointConnectionVaultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecvp.Properties != nil { - objectMap["properties"] = pecvp.Properties - } - return json.Marshal(objectMap) -} - -// PrivateLinkResource information of the private link resource. -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; e.g. Microsoft.RecoveryServices/vaults/privateLinkResources - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.PrivateLinkResourceProperties != nil { - objectMap["properties"] = plr.PrivateLinkResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. -func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkResourceProperties properties of the private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; e.g. f9ad6492-33d4-4690-9999-6bfd52a0d081 (Backup) or f9ad6492-33d4-4690-9999-6bfd52a0d082 (SiteRecovery) - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; [backup-ecs1, backup-prot1, backup-prot1b, backup-prot1c, backup-id1] - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY; The private link resource Private link DNS zone name. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResources class which represent the stamps associated with the vault. -type PrivateLinkResources struct { - autorest.Response `json:"-"` - // Value - A collection of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - Link to the next chunk of the response - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateLinkResourcesIterator provides access to a complete listing of PrivateLinkResource values. -type PrivateLinkResourcesIterator struct { - i int - page PrivateLinkResourcesPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateLinkResourcesIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateLinkResourcesIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourcesIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateLinkResourcesIterator) Response() PrivateLinkResources { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateLinkResourcesIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourcesIterator type. -func NewPrivateLinkResourcesIterator(page PrivateLinkResourcesPage) PrivateLinkResourcesIterator { - return PrivateLinkResourcesIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plr PrivateLinkResources) IsEmpty() bool { - return plr.Value == nil || len(*plr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plr PrivateLinkResources) hasNextLink() bool { - return plr.NextLink != nil && len(*plr.NextLink) != 0 -} - -// privateLinkResourcesPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plr PrivateLinkResources) privateLinkResourcesPreparer(ctx context.Context) (*http.Request, error) { - if !plr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plr.NextLink))) -} - -// PrivateLinkResourcesPage contains a page of PrivateLinkResource values. -type PrivateLinkResourcesPage struct { - fn func(context.Context, PrivateLinkResources) (PrivateLinkResources, error) - plr PrivateLinkResources -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateLinkResourcesPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.plr) - if err != nil { - return err - } - page.plr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateLinkResourcesPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourcesPage) NotDone() bool { - return !page.plr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourcesPage) Response() PrivateLinkResources { - return page.plr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourcesPage) Values() []PrivateLinkResource { - if page.plr.IsEmpty() { - return nil - } - return *page.plr.Value -} - -// Creates a new instance of the PrivateLinkResourcesPage type. -func NewPrivateLinkResourcesPage(cur PrivateLinkResources, getNextPage func(context.Context, PrivateLinkResources) (PrivateLinkResources, error)) PrivateLinkResourcesPage { - return PrivateLinkResourcesPage{ - fn: getNextPage, - plr: cur, - } -} - -// PrivateLinkServiceConnectionState gets or sets private link service connection state. -type PrivateLinkServiceConnectionState struct { - // Status - READ-ONLY; Gets or sets the status. Possible values include: 'PrivateEndpointConnectionStatusPending', 'PrivateEndpointConnectionStatusApproved', 'PrivateEndpointConnectionStatusRejected', 'PrivateEndpointConnectionStatusDisconnected' - Status PrivateEndpointConnectionStatus `json:"status,omitempty"` - // Description - READ-ONLY; Gets or sets description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; Gets or sets actions required. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionState. -func (plscs PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RawCertificateData raw certificate data. -type RawCertificateData struct { - // AuthType - Specifies the authentication type. Possible values include: 'AuthTypeInvalid', 'AuthTypeACS', 'AuthTypeAAD', 'AuthTypeAccessControlService', 'AuthTypeAzureActiveDirectory' - AuthType AuthType `json:"authType,omitempty"` - // Certificate - The base64 encoded certificate raw data string - Certificate *[]byte `json:"certificate,omitempty"` -} - -// ReplicationUsage replication usages of a vault. -type ReplicationUsage struct { - // MonitoringSummary - Summary of the replication monitoring data for this vault. - MonitoringSummary *MonitoringSummary `json:"monitoringSummary,omitempty"` - // JobsSummary - Summary of the replication jobs data for this vault. - JobsSummary *JobsSummary `json:"jobsSummary,omitempty"` - // ProtectedItemCount - Number of replication protected items for this vault. - ProtectedItemCount *int32 `json:"protectedItemCount,omitempty"` - // RecoveryPlanCount - Number of replication recovery plans for this vault. - RecoveryPlanCount *int32 `json:"recoveryPlanCount,omitempty"` - // RegisteredServersCount - Number of servers registered to this vault. - RegisteredServersCount *int32 `json:"registeredServersCount,omitempty"` - // RecoveryServicesProviderAuthType - The authentication type of recovery service providers in the vault. - RecoveryServicesProviderAuthType *int32 `json:"recoveryServicesProviderAuthType,omitempty"` -} - -// ReplicationUsageList replication usages for vault. -type ReplicationUsageList struct { - autorest.Response `json:"-"` - // Value - The list of replication usages for the given vault. - Value *[]ReplicationUsage `json:"value,omitempty"` -} - -// Resource ARM Resource. -type Resource struct { - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - // Etag - Optional ETag. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Etag != nil { - objectMap["etag"] = r.Etag - } - return json.Marshal(objectMap) -} - -// ResourceCertificateAndAadDetails certificate details representing the Vault credentials for AAD. -type ResourceCertificateAndAadDetails struct { - // AadAuthority - AAD tenant authority. - AadAuthority *string `json:"aadAuthority,omitempty"` - // AadTenantID - AAD tenant Id. - AadTenantID *string `json:"aadTenantId,omitempty"` - // ServicePrincipalClientID - AAD service principal clientId. - ServicePrincipalClientID *string `json:"servicePrincipalClientId,omitempty"` - // ServicePrincipalObjectID - AAD service principal ObjectId. - ServicePrincipalObjectID *string `json:"servicePrincipalObjectId,omitempty"` - // AzureManagementEndpointAudience - Azure Management Endpoint Audience. - AzureManagementEndpointAudience *string `json:"azureManagementEndpointAudience,omitempty"` - // ServiceResourceID - Service Resource Id. - ServiceResourceID *string `json:"serviceResourceId,omitempty"` - // Certificate - The base64 encoded certificate raw data string. - Certificate *[]byte `json:"certificate,omitempty"` - // FriendlyName - Certificate friendly name. - FriendlyName *string `json:"friendlyName,omitempty"` - // Issuer - Certificate issuer. - Issuer *string `json:"issuer,omitempty"` - // ResourceID - Resource ID of the vault. - ResourceID *int64 `json:"resourceId,omitempty"` - // Subject - Certificate Subject Name. - Subject *string `json:"subject,omitempty"` - // Thumbprint - Certificate thumbprint. - Thumbprint *string `json:"thumbprint,omitempty"` - // ValidFrom - Certificate Validity start Date time. - ValidFrom *date.Time `json:"validFrom,omitempty"` - // ValidTo - Certificate Validity End Date time. - ValidTo *date.Time `json:"validTo,omitempty"` - // AuthType - Possible values include: 'AuthTypeBasicResourceCertificateDetailsAuthTypeResourceCertificateDetails', 'AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory', 'AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService' - AuthType AuthTypeBasicResourceCertificateDetails `json:"authType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceCertificateAndAadDetails. -func (rcaad ResourceCertificateAndAadDetails) MarshalJSON() ([]byte, error) { - rcaad.AuthType = AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory - objectMap := make(map[string]interface{}) - if rcaad.AadAuthority != nil { - objectMap["aadAuthority"] = rcaad.AadAuthority - } - if rcaad.AadTenantID != nil { - objectMap["aadTenantId"] = rcaad.AadTenantID - } - if rcaad.ServicePrincipalClientID != nil { - objectMap["servicePrincipalClientId"] = rcaad.ServicePrincipalClientID - } - if rcaad.ServicePrincipalObjectID != nil { - objectMap["servicePrincipalObjectId"] = rcaad.ServicePrincipalObjectID - } - if rcaad.AzureManagementEndpointAudience != nil { - objectMap["azureManagementEndpointAudience"] = rcaad.AzureManagementEndpointAudience - } - if rcaad.ServiceResourceID != nil { - objectMap["serviceResourceId"] = rcaad.ServiceResourceID - } - if rcaad.Certificate != nil { - objectMap["certificate"] = rcaad.Certificate - } - if rcaad.FriendlyName != nil { - objectMap["friendlyName"] = rcaad.FriendlyName - } - if rcaad.Issuer != nil { - objectMap["issuer"] = rcaad.Issuer - } - if rcaad.ResourceID != nil { - objectMap["resourceId"] = rcaad.ResourceID - } - if rcaad.Subject != nil { - objectMap["subject"] = rcaad.Subject - } - if rcaad.Thumbprint != nil { - objectMap["thumbprint"] = rcaad.Thumbprint - } - if rcaad.ValidFrom != nil { - objectMap["validFrom"] = rcaad.ValidFrom - } - if rcaad.ValidTo != nil { - objectMap["validTo"] = rcaad.ValidTo - } - if rcaad.AuthType != "" { - objectMap["authType"] = rcaad.AuthType - } - return json.Marshal(objectMap) -} - -// AsResourceCertificateAndAadDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAadDetails. -func (rcaad ResourceCertificateAndAadDetails) AsResourceCertificateAndAadDetails() (*ResourceCertificateAndAadDetails, bool) { - return &rcaad, true -} - -// AsResourceCertificateAndAcsDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAadDetails. -func (rcaad ResourceCertificateAndAadDetails) AsResourceCertificateAndAcsDetails() (*ResourceCertificateAndAcsDetails, bool) { - return nil, false -} - -// AsResourceCertificateDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAadDetails. -func (rcaad ResourceCertificateAndAadDetails) AsResourceCertificateDetails() (*ResourceCertificateDetails, bool) { - return nil, false -} - -// AsBasicResourceCertificateDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAadDetails. -func (rcaad ResourceCertificateAndAadDetails) AsBasicResourceCertificateDetails() (BasicResourceCertificateDetails, bool) { - return &rcaad, true -} - -// ResourceCertificateAndAcsDetails certificate details representing the Vault credentials for ACS. -type ResourceCertificateAndAcsDetails struct { - // GlobalAcsNamespace - ACS namespace name - tenant for our service. - GlobalAcsNamespace *string `json:"globalAcsNamespace,omitempty"` - // GlobalAcsHostName - Acs mgmt host name to connect to. - GlobalAcsHostName *string `json:"globalAcsHostName,omitempty"` - // GlobalAcsRPRealm - Global ACS namespace RP realm. - GlobalAcsRPRealm *string `json:"globalAcsRPRealm,omitempty"` - // Certificate - The base64 encoded certificate raw data string. - Certificate *[]byte `json:"certificate,omitempty"` - // FriendlyName - Certificate friendly name. - FriendlyName *string `json:"friendlyName,omitempty"` - // Issuer - Certificate issuer. - Issuer *string `json:"issuer,omitempty"` - // ResourceID - Resource ID of the vault. - ResourceID *int64 `json:"resourceId,omitempty"` - // Subject - Certificate Subject Name. - Subject *string `json:"subject,omitempty"` - // Thumbprint - Certificate thumbprint. - Thumbprint *string `json:"thumbprint,omitempty"` - // ValidFrom - Certificate Validity start Date time. - ValidFrom *date.Time `json:"validFrom,omitempty"` - // ValidTo - Certificate Validity End Date time. - ValidTo *date.Time `json:"validTo,omitempty"` - // AuthType - Possible values include: 'AuthTypeBasicResourceCertificateDetailsAuthTypeResourceCertificateDetails', 'AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory', 'AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService' - AuthType AuthTypeBasicResourceCertificateDetails `json:"authType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceCertificateAndAcsDetails. -func (rcaad ResourceCertificateAndAcsDetails) MarshalJSON() ([]byte, error) { - rcaad.AuthType = AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService - objectMap := make(map[string]interface{}) - if rcaad.GlobalAcsNamespace != nil { - objectMap["globalAcsNamespace"] = rcaad.GlobalAcsNamespace - } - if rcaad.GlobalAcsHostName != nil { - objectMap["globalAcsHostName"] = rcaad.GlobalAcsHostName - } - if rcaad.GlobalAcsRPRealm != nil { - objectMap["globalAcsRPRealm"] = rcaad.GlobalAcsRPRealm - } - if rcaad.Certificate != nil { - objectMap["certificate"] = rcaad.Certificate - } - if rcaad.FriendlyName != nil { - objectMap["friendlyName"] = rcaad.FriendlyName - } - if rcaad.Issuer != nil { - objectMap["issuer"] = rcaad.Issuer - } - if rcaad.ResourceID != nil { - objectMap["resourceId"] = rcaad.ResourceID - } - if rcaad.Subject != nil { - objectMap["subject"] = rcaad.Subject - } - if rcaad.Thumbprint != nil { - objectMap["thumbprint"] = rcaad.Thumbprint - } - if rcaad.ValidFrom != nil { - objectMap["validFrom"] = rcaad.ValidFrom - } - if rcaad.ValidTo != nil { - objectMap["validTo"] = rcaad.ValidTo - } - if rcaad.AuthType != "" { - objectMap["authType"] = rcaad.AuthType - } - return json.Marshal(objectMap) -} - -// AsResourceCertificateAndAadDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAcsDetails. -func (rcaad ResourceCertificateAndAcsDetails) AsResourceCertificateAndAadDetails() (*ResourceCertificateAndAadDetails, bool) { - return nil, false -} - -// AsResourceCertificateAndAcsDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAcsDetails. -func (rcaad ResourceCertificateAndAcsDetails) AsResourceCertificateAndAcsDetails() (*ResourceCertificateAndAcsDetails, bool) { - return &rcaad, true -} - -// AsResourceCertificateDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAcsDetails. -func (rcaad ResourceCertificateAndAcsDetails) AsResourceCertificateDetails() (*ResourceCertificateDetails, bool) { - return nil, false -} - -// AsBasicResourceCertificateDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateAndAcsDetails. -func (rcaad ResourceCertificateAndAcsDetails) AsBasicResourceCertificateDetails() (BasicResourceCertificateDetails, bool) { - return &rcaad, true -} - -// BasicResourceCertificateDetails certificate details representing the Vault credentials. -type BasicResourceCertificateDetails interface { - AsResourceCertificateAndAadDetails() (*ResourceCertificateAndAadDetails, bool) - AsResourceCertificateAndAcsDetails() (*ResourceCertificateAndAcsDetails, bool) - AsResourceCertificateDetails() (*ResourceCertificateDetails, bool) -} - -// ResourceCertificateDetails certificate details representing the Vault credentials. -type ResourceCertificateDetails struct { - // Certificate - The base64 encoded certificate raw data string. - Certificate *[]byte `json:"certificate,omitempty"` - // FriendlyName - Certificate friendly name. - FriendlyName *string `json:"friendlyName,omitempty"` - // Issuer - Certificate issuer. - Issuer *string `json:"issuer,omitempty"` - // ResourceID - Resource ID of the vault. - ResourceID *int64 `json:"resourceId,omitempty"` - // Subject - Certificate Subject Name. - Subject *string `json:"subject,omitempty"` - // Thumbprint - Certificate thumbprint. - Thumbprint *string `json:"thumbprint,omitempty"` - // ValidFrom - Certificate Validity start Date time. - ValidFrom *date.Time `json:"validFrom,omitempty"` - // ValidTo - Certificate Validity End Date time. - ValidTo *date.Time `json:"validTo,omitempty"` - // AuthType - Possible values include: 'AuthTypeBasicResourceCertificateDetailsAuthTypeResourceCertificateDetails', 'AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory', 'AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService' - AuthType AuthTypeBasicResourceCertificateDetails `json:"authType,omitempty"` -} - -func unmarshalBasicResourceCertificateDetails(body []byte) (BasicResourceCertificateDetails, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["authType"] { - case string(AuthTypeBasicResourceCertificateDetailsAuthTypeAzureActiveDirectory): - var rcaad ResourceCertificateAndAadDetails - err := json.Unmarshal(body, &rcaad) - return rcaad, err - case string(AuthTypeBasicResourceCertificateDetailsAuthTypeAccessControlService): - var rcaad ResourceCertificateAndAcsDetails - err := json.Unmarshal(body, &rcaad) - return rcaad, err - default: - var rcd ResourceCertificateDetails - err := json.Unmarshal(body, &rcd) - return rcd, err - } -} -func unmarshalBasicResourceCertificateDetailsArray(body []byte) ([]BasicResourceCertificateDetails, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rcdArray := make([]BasicResourceCertificateDetails, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rcd, err := unmarshalBasicResourceCertificateDetails(*rawMessage) - if err != nil { - return nil, err - } - rcdArray[index] = rcd - } - return rcdArray, nil -} - -// MarshalJSON is the custom marshaler for ResourceCertificateDetails. -func (rcd ResourceCertificateDetails) MarshalJSON() ([]byte, error) { - rcd.AuthType = AuthTypeBasicResourceCertificateDetailsAuthTypeResourceCertificateDetails - objectMap := make(map[string]interface{}) - if rcd.Certificate != nil { - objectMap["certificate"] = rcd.Certificate - } - if rcd.FriendlyName != nil { - objectMap["friendlyName"] = rcd.FriendlyName - } - if rcd.Issuer != nil { - objectMap["issuer"] = rcd.Issuer - } - if rcd.ResourceID != nil { - objectMap["resourceId"] = rcd.ResourceID - } - if rcd.Subject != nil { - objectMap["subject"] = rcd.Subject - } - if rcd.Thumbprint != nil { - objectMap["thumbprint"] = rcd.Thumbprint - } - if rcd.ValidFrom != nil { - objectMap["validFrom"] = rcd.ValidFrom - } - if rcd.ValidTo != nil { - objectMap["validTo"] = rcd.ValidTo - } - if rcd.AuthType != "" { - objectMap["authType"] = rcd.AuthType - } - return json.Marshal(objectMap) -} - -// AsResourceCertificateAndAadDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateDetails. -func (rcd ResourceCertificateDetails) AsResourceCertificateAndAadDetails() (*ResourceCertificateAndAadDetails, bool) { - return nil, false -} - -// AsResourceCertificateAndAcsDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateDetails. -func (rcd ResourceCertificateDetails) AsResourceCertificateAndAcsDetails() (*ResourceCertificateAndAcsDetails, bool) { - return nil, false -} - -// AsResourceCertificateDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateDetails. -func (rcd ResourceCertificateDetails) AsResourceCertificateDetails() (*ResourceCertificateDetails, bool) { - return &rcd, true -} - -// AsBasicResourceCertificateDetails is the BasicResourceCertificateDetails implementation for ResourceCertificateDetails. -func (rcd ResourceCertificateDetails) AsBasicResourceCertificateDetails() (BasicResourceCertificateDetails, bool) { - return &rcd, true -} - -// Sku identifies the unique system identifier for each Azure resource. -type Sku struct { - // Name - The Sku name. Possible values include: 'SkuNameStandard', 'SkuNameRS0' - Name SkuName `json:"name,omitempty"` - // Tier - The Sku tier. - Tier *string `json:"tier,omitempty"` - // Family - The sku family - Family *string `json:"family,omitempty"` - // Size - The sku size - Size *string `json:"size,omitempty"` - // Capacity - The sku capacity - Capacity *string `json:"capacity,omitempty"` -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The type of identity that last modified the resource. - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TrackedResource tracked resource with location. -type TrackedResource struct { - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - // Etag - Optional ETag. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Location != nil { - objectMap["location"] = tr.Location - } - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Etag != nil { - objectMap["etag"] = tr.Etag - } - return json.Marshal(objectMap) -} - -// UpgradeDetails details for upgrading vault. -type UpgradeDetails struct { - // OperationID - READ-ONLY; ID of the vault upgrade operation. - OperationID *string `json:"operationId,omitempty"` - // StartTimeUtc - READ-ONLY; UTC time at which the upgrade operation has started. - StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` - // LastUpdatedTimeUtc - READ-ONLY; UTC time at which the upgrade operation status was last updated. - LastUpdatedTimeUtc *date.Time `json:"lastUpdatedTimeUtc,omitempty"` - // EndTimeUtc - READ-ONLY; UTC time at which the upgrade operation has ended. - EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"` - // Status - READ-ONLY; Status of the vault upgrade operation. Possible values include: 'VaultUpgradeStateUnknown', 'VaultUpgradeStateInProgress', 'VaultUpgradeStateUpgraded', 'VaultUpgradeStateFailed' - Status VaultUpgradeState `json:"status,omitempty"` - // Message - READ-ONLY; Message to the user containing information about the upgrade operation. - Message *string `json:"message,omitempty"` - // TriggerType - READ-ONLY; The way the vault upgrade was triggered. Possible values include: 'TriggerTypeUserTriggered', 'TriggerTypeForcedUpgrade' - TriggerType TriggerType `json:"triggerType,omitempty"` - // UpgradedResourceID - READ-ONLY; Resource ID of the upgraded vault. - UpgradedResourceID *string `json:"upgradedResourceId,omitempty"` - // PreviousResourceID - READ-ONLY; Resource ID of the vault before the upgrade. - PreviousResourceID *string `json:"previousResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for UpgradeDetails. -func (ud UpgradeDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UserIdentity a resource identity that is managed by the user of the service. -type UserIdentity struct { - // PrincipalID - READ-ONLY; The principal ID of the user-assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - READ-ONLY; The client ID of the user-assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserIdentity. -func (UI UserIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Vault resource information, as returned by the resource provider. -type Vault struct { - autorest.Response `json:"-"` - Identity *IdentityData `json:"identity,omitempty"` - Properties *VaultProperties `json:"properties,omitempty"` - Sku *Sku `json:"sku,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - // Etag - Optional ETag. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Vault. -func (vVar Vault) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vVar.Identity != nil { - objectMap["identity"] = vVar.Identity - } - if vVar.Properties != nil { - objectMap["properties"] = vVar.Properties - } - if vVar.Sku != nil { - objectMap["sku"] = vVar.Sku - } - if vVar.SystemData != nil { - objectMap["systemData"] = vVar.SystemData - } - if vVar.Location != nil { - objectMap["location"] = vVar.Location - } - if vVar.Tags != nil { - objectMap["tags"] = vVar.Tags - } - if vVar.Etag != nil { - objectMap["etag"] = vVar.Etag - } - return json.Marshal(objectMap) -} - -// VaultCertificateResponse certificate corresponding to a vault that can be used by clients to register -// themselves with the vault. -type VaultCertificateResponse struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - Properties BasicResourceCertificateDetails `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VaultCertificateResponse. -func (vcr VaultCertificateResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = vcr.Properties - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VaultCertificateResponse struct. -func (vcr *VaultCertificateResponse) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vcr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vcr.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vcr.ID = &ID - } - case "properties": - if v != nil { - properties, err := unmarshalBasicResourceCertificateDetails(*v) - if err != nil { - return err - } - vcr.Properties = properties - } - } - } - - return nil -} - -// VaultExtendedInfo vault extended information. -type VaultExtendedInfo struct { - // IntegrityKey - Integrity key. - IntegrityKey *string `json:"integrityKey,omitempty"` - // EncryptionKey - Encryption key. - EncryptionKey *string `json:"encryptionKey,omitempty"` - // EncryptionKeyThumbprint - Encryption key thumbprint. - EncryptionKeyThumbprint *string `json:"encryptionKeyThumbprint,omitempty"` - // Algorithm - Algorithm for Vault ExtendedInfo - Algorithm *string `json:"algorithm,omitempty"` -} - -// VaultExtendedInfoResource vault extended information. -type VaultExtendedInfoResource struct { - autorest.Response `json:"-"` - *VaultExtendedInfo `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - // Etag - Optional ETag. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for VaultExtendedInfoResource. -func (veir VaultExtendedInfoResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if veir.VaultExtendedInfo != nil { - objectMap["properties"] = veir.VaultExtendedInfo - } - if veir.Etag != nil { - objectMap["etag"] = veir.Etag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VaultExtendedInfoResource struct. -func (veir *VaultExtendedInfoResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var vaultExtendedInfo VaultExtendedInfo - err = json.Unmarshal(*v, &vaultExtendedInfo) - if err != nil { - return err - } - veir.VaultExtendedInfo = &vaultExtendedInfo - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - veir.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - veir.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - veir.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - veir.Etag = &etag - } - } - } - - return nil -} - -// VaultList the response model for a list of Vaults. -type VaultList struct { - autorest.Response `json:"-"` - Value *[]Vault `json:"value,omitempty"` - // NextLink - READ-ONLY - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VaultList. -func (vl VaultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vl.Value != nil { - objectMap["value"] = vl.Value - } - return json.Marshal(objectMap) -} - -// VaultListIterator provides access to a complete listing of Vault values. -type VaultListIterator struct { - i int - page VaultListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VaultListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VaultListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VaultListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VaultListIterator) Response() VaultList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VaultListIterator) Value() Vault { - if !iter.page.NotDone() { - return Vault{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VaultListIterator type. -func NewVaultListIterator(page VaultListPage) VaultListIterator { - return VaultListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vl VaultList) IsEmpty() bool { - return vl.Value == nil || len(*vl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vl VaultList) hasNextLink() bool { - return vl.NextLink != nil && len(*vl.NextLink) != 0 -} - -// vaultListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vl VaultList) vaultListPreparer(ctx context.Context) (*http.Request, error) { - if !vl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vl.NextLink))) -} - -// VaultListPage contains a page of Vault values. -type VaultListPage struct { - fn func(context.Context, VaultList) (VaultList, error) - vl VaultList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VaultListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vl) - if err != nil { - return err - } - page.vl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VaultListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VaultListPage) NotDone() bool { - return !page.vl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VaultListPage) Response() VaultList { - return page.vl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VaultListPage) Values() []Vault { - if page.vl.IsEmpty() { - return nil - } - return *page.vl.Value -} - -// Creates a new instance of the VaultListPage type. -func NewVaultListPage(cur VaultList, getNextPage func(context.Context, VaultList) (VaultList, error)) VaultListPage { - return VaultListPage{ - fn: getNextPage, - vl: cur, - } -} - -// VaultProperties properties of the vault. -type VaultProperties struct { - // ProvisioningState - READ-ONLY; Provisioning State. - ProvisioningState *string `json:"provisioningState,omitempty"` - UpgradeDetails *UpgradeDetails `json:"upgradeDetails,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connection. - PrivateEndpointConnections *[]PrivateEndpointConnectionVaultProperties `json:"privateEndpointConnections,omitempty"` - // PrivateEndpointStateForBackup - READ-ONLY; Private endpoint state for backup. Possible values include: 'VaultPrivateEndpointStateNone', 'VaultPrivateEndpointStateEnabled' - PrivateEndpointStateForBackup VaultPrivateEndpointState `json:"privateEndpointStateForBackup,omitempty"` - // PrivateEndpointStateForSiteRecovery - READ-ONLY; Private endpoint state for site recovery. Possible values include: 'VaultPrivateEndpointStateNone', 'VaultPrivateEndpointStateEnabled' - PrivateEndpointStateForSiteRecovery VaultPrivateEndpointState `json:"privateEndpointStateForSiteRecovery,omitempty"` - // Encryption - Customer Managed Key details of the resource. - Encryption *VaultPropertiesEncryption `json:"encryption,omitempty"` - // MoveDetails - The details of the latest move operation performed on the Azure Resource - MoveDetails *VaultPropertiesMoveDetails `json:"moveDetails,omitempty"` - // MoveState - READ-ONLY; The State of the Resource after the move operation. Possible values include: 'ResourceMoveStateUnknown', 'ResourceMoveStateInProgress', 'ResourceMoveStatePrepareFailed', 'ResourceMoveStateCommitFailed', 'ResourceMoveStatePrepareTimedout', 'ResourceMoveStateCommitTimedout', 'ResourceMoveStateMoveSucceeded', 'ResourceMoveStateFailure', 'ResourceMoveStateCriticalFailure', 'ResourceMoveStatePartialSuccess' - MoveState ResourceMoveState `json:"moveState,omitempty"` -} - -// MarshalJSON is the custom marshaler for VaultProperties. -func (vp VaultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vp.UpgradeDetails != nil { - objectMap["upgradeDetails"] = vp.UpgradeDetails - } - if vp.Encryption != nil { - objectMap["encryption"] = vp.Encryption - } - if vp.MoveDetails != nil { - objectMap["moveDetails"] = vp.MoveDetails - } - return json.Marshal(objectMap) -} - -// VaultPropertiesEncryption customer Managed Key details of the resource. -type VaultPropertiesEncryption struct { - KeyVaultProperties *CmkKeyVaultProperties `json:"keyVaultProperties,omitempty"` - KekIdentity *CmkKekIdentity `json:"kekIdentity,omitempty"` - // InfrastructureEncryption - Enabling/Disabling the Double Encryption state. Possible values include: 'InfrastructureEncryptionStateEnabled', 'InfrastructureEncryptionStateDisabled' - InfrastructureEncryption InfrastructureEncryptionState `json:"infrastructureEncryption,omitempty"` -} - -// VaultPropertiesMoveDetails the details of the latest move operation performed on the Azure Resource -type VaultPropertiesMoveDetails struct { - // OperationID - READ-ONLY; OperationId of the Resource Move Operation - OperationID *string `json:"operationId,omitempty"` - // StartTimeUtc - READ-ONLY; Start Time of the Resource Move Operation - StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` - // CompletionTimeUtc - READ-ONLY; End Time of the Resource Move Operation - CompletionTimeUtc *date.Time `json:"completionTimeUtc,omitempty"` - // SourceResourceID - READ-ONLY; Source Resource of the Resource Move Operation - SourceResourceID *string `json:"sourceResourceId,omitempty"` - // TargetResourceID - READ-ONLY; Target Resource of the Resource Move Operation - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for VaultPropertiesMoveDetails. -func (vpD VaultPropertiesMoveDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VaultsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VaultsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VaultsClient) (Vault, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VaultsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VaultsCreateOrUpdateFuture.Result. -func (future *VaultsCreateOrUpdateFuture) result(client VaultsClient) (vVar Vault, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vVar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("recoveryservices.VaultsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent { - vVar, err = client.CreateOrUpdateResponder(vVar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsCreateOrUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request") - } - } - return -} - -// VaultsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type VaultsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VaultsClient) (Vault, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VaultsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VaultsUpdateFuture.Result. -func (future *VaultsUpdateFuture) result(client VaultsClient) (vVar Vault, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vVar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("recoveryservices.VaultsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent { - vVar, err = client.UpdateResponder(vVar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request") - } - } - return -} - -// VaultUsage usages of a vault. -type VaultUsage struct { - // Unit - Unit of the usage. Possible values include: 'UsagesUnitCount', 'UsagesUnitBytes', 'UsagesUnitSeconds', 'UsagesUnitPercent', 'UsagesUnitCountPerSecond', 'UsagesUnitBytesPerSecond' - Unit UsagesUnit `json:"unit,omitempty"` - // QuotaPeriod - Quota period of usage. - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - // NextResetTime - Next reset time of usage. - NextResetTime *date.Time `json:"nextResetTime,omitempty"` - // CurrentValue - Current value of usage. - CurrentValue *int64 `json:"currentValue,omitempty"` - // Limit - Limit of usage. - Limit *int64 `json:"limit,omitempty"` - // Name - Name of usage. - Name *NameInfo `json:"name,omitempty"` -} - -// VaultUsageList usage for vault. -type VaultUsageList struct { - autorest.Response `json:"-"` - // Value - The list of usages for the given vault. - Value *[]VaultUsage `json:"value,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/operations.go deleted file mode 100644 index e6394ba058d5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the recovery Services Client -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List returns the list of available operations. -func (client OperationsClient) List(ctx context.Context) (result ClientDiscoveryResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.cdr.Response.Response != nil { - sc = result.cdr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.cdr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.cdr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.cdr.hasNextLink() && result.cdr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.RecoveryServices/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result ClientDiscoveryResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults ClientDiscoveryResponse) (result ClientDiscoveryResponse, err error) { - req, err := lastResults.clientDiscoveryResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result ClientDiscoveryResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/privatelinkresources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/privatelinkresources.go deleted file mode 100644 index d550a9495608..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/privatelinkresources.go +++ /dev/null @@ -1,227 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the recovery Services Client -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get sends the get request. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, vaultName string, privateLinkResourceName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, vaultName, privateLinkResourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, vaultName string, privateLinkResourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateLinkResourceName": autorest.Encode("path", privateLinkResourceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateLinkResources/{privateLinkResourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) GetResponder(resp *http.Response) (result PrivateLinkResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List sends the list request. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, vaultName string) (result PrivateLinkResourcesPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") - defer func() { - sc := -1 - if result.plr.Response.Response != nil { - sc = result.plr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.plr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "List", resp, "Failure sending request") - return - } - - result.plr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") - return - } - if result.plr.hasNextLink() && result.plr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResources, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listNextResults(ctx context.Context, lastResults PrivateLinkResources) (result PrivateLinkResources, err error) { - req, err := lastResults.privateLinkResourcesPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.PrivateLinkResourcesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListComplete(ctx context.Context, resourceGroupName string, vaultName string) (result PrivateLinkResourcesIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, vaultName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/recoveryservices.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/recoveryservices.go deleted file mode 100644 index 113cdedcb770..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/recoveryservices.go +++ /dev/null @@ -1,110 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// Client is the recovery Services Client -type Client struct { - BaseClient -} - -// NewClient creates an instance of the Client client. -func NewClient(subscriptionID string) Client { - return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting -// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { - return Client{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability sends the check name availability request. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// location - location of the resource -// input - contains information about Resource type and Resource name -func (client Client) CheckNameAvailability(ctx context.Context, resourceGroupName string, location string, input CheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, location, input) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.Client", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.Client", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.Client", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client Client) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, location string, input CheckNameAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/locations/{location}/checkNameAvailability", pathParameters), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client Client) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/registeredidentities.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/registeredidentities.go deleted file mode 100644 index fe095a037739..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/registeredidentities.go +++ /dev/null @@ -1,109 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RegisteredIdentitiesClient is the recovery Services Client -type RegisteredIdentitiesClient struct { - BaseClient -} - -// NewRegisteredIdentitiesClient creates an instance of the RegisteredIdentitiesClient client. -func NewRegisteredIdentitiesClient(subscriptionID string) RegisteredIdentitiesClient { - return NewRegisteredIdentitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRegisteredIdentitiesClientWithBaseURI creates an instance of the RegisteredIdentitiesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewRegisteredIdentitiesClientWithBaseURI(baseURI string, subscriptionID string) RegisteredIdentitiesClient { - return RegisteredIdentitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete unregisters the given container from your Recovery Services vault. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -// identityName - name of the protection container to unregister. -func (client RegisteredIdentitiesClient) Delete(ctx context.Context, resourceGroupName string, vaultName string, identityName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegisteredIdentitiesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, vaultName, identityName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.RegisteredIdentitiesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservices.RegisteredIdentitiesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.RegisteredIdentitiesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RegisteredIdentitiesClient) DeletePreparer(ctx context.Context, resourceGroupName string, vaultName string, identityName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityName": autorest.Encode("path", identityName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/registeredIdentities/{identityName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RegisteredIdentitiesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RegisteredIdentitiesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/replicationusages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/replicationusages.go deleted file mode 100644 index d016b0fb9d54..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/replicationusages.go +++ /dev/null @@ -1,108 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ReplicationUsagesClient is the recovery Services Client -type ReplicationUsagesClient struct { - BaseClient -} - -// NewReplicationUsagesClient creates an instance of the ReplicationUsagesClient client. -func NewReplicationUsagesClient(subscriptionID string) ReplicationUsagesClient { - return NewReplicationUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReplicationUsagesClientWithBaseURI creates an instance of the ReplicationUsagesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewReplicationUsagesClientWithBaseURI(baseURI string, subscriptionID string) ReplicationUsagesClient { - return ReplicationUsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List fetches the replication usages of the vault. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client ReplicationUsagesClient) List(ctx context.Context, resourceGroupName string, vaultName string) (result ReplicationUsageList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationUsagesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.ReplicationUsagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.ReplicationUsagesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.ReplicationUsagesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ReplicationUsagesClient) ListPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/replicationUsages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicationUsagesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ReplicationUsagesClient) ListResponder(resp *http.Response) (result ReplicationUsageList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/usages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/usages.go deleted file mode 100644 index 8d0bcde28eb5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/usages.go +++ /dev/null @@ -1,107 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// UsagesClient is the recovery Services Client -type UsagesClient struct { - BaseClient -} - -// NewUsagesClient creates an instance of the UsagesClient client. -func NewUsagesClient(subscriptionID string) UsagesClient { - return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { - return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByVaults fetches the usages of the vault. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client UsagesClient) ListByVaults(ctx context.Context, resourceGroupName string, vaultName string) (result VaultUsageList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.ListByVaults") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByVaultsPreparer(ctx, resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.UsagesClient", "ListByVaults", nil, "Failure preparing request") - return - } - - resp, err := client.ListByVaultsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.UsagesClient", "ListByVaults", resp, "Failure sending request") - return - } - - result, err = client.ListByVaultsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.UsagesClient", "ListByVaults", resp, "Failure responding to request") - return - } - - return -} - -// ListByVaultsPreparer prepares the ListByVaults request. -func (client UsagesClient) ListByVaultsPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByVaultsSender sends the ListByVaults request. The method will close the -// http.Response Body if it receives an error. -func (client UsagesClient) ListByVaultsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByVaultsResponder handles the response to the ListByVaults request. The method always -// closes the http.Response Body. -func (client UsagesClient) ListByVaultsResponder(resp *http.Response) (result VaultUsageList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaultcertificates.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaultcertificates.go deleted file mode 100644 index ccb7419f50a1..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaultcertificates.go +++ /dev/null @@ -1,113 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VaultCertificatesClient is the recovery Services Client -type VaultCertificatesClient struct { - BaseClient -} - -// NewVaultCertificatesClient creates an instance of the VaultCertificatesClient client. -func NewVaultCertificatesClient(subscriptionID string) VaultCertificatesClient { - return NewVaultCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVaultCertificatesClientWithBaseURI creates an instance of the VaultCertificatesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewVaultCertificatesClientWithBaseURI(baseURI string, subscriptionID string) VaultCertificatesClient { - return VaultCertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create uploads a certificate for a resource. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -// certificateName - certificate friendly name. -// certificateRequest - input parameters for uploading the vault certificate. -func (client VaultCertificatesClient) Create(ctx context.Context, resourceGroupName string, vaultName string, certificateName string, certificateRequest CertificateRequest) (result VaultCertificateResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultCertificatesClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreatePreparer(ctx, resourceGroupName, vaultName, certificateName, certificateRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultCertificatesClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultCertificatesClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultCertificatesClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client VaultCertificatesClient) CreatePreparer(ctx context.Context, resourceGroupName string, vaultName string, certificateName string, certificateRequest CertificateRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/certificates/{certificateName}", pathParameters), - autorest.WithJSON(certificateRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client VaultCertificatesClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client VaultCertificatesClient) CreateResponder(resp *http.Response) (result VaultCertificateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaultextendedinfo.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaultextendedinfo.go deleted file mode 100644 index 3a5daa3e82b4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaultextendedinfo.go +++ /dev/null @@ -1,266 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VaultExtendedInfoClient is the recovery Services Client -type VaultExtendedInfoClient struct { - BaseClient -} - -// NewVaultExtendedInfoClient creates an instance of the VaultExtendedInfoClient client. -func NewVaultExtendedInfoClient(subscriptionID string) VaultExtendedInfoClient { - return NewVaultExtendedInfoClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVaultExtendedInfoClientWithBaseURI creates an instance of the VaultExtendedInfoClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewVaultExtendedInfoClientWithBaseURI(baseURI string, subscriptionID string) VaultExtendedInfoClient { - return VaultExtendedInfoClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create vault extended info. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -// resourceResourceExtendedInfoDetails - details of ResourceExtendedInfo -func (client VaultExtendedInfoClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (result VaultExtendedInfoResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultExtendedInfoClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, vaultName, resourceResourceExtendedInfoDetails) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VaultExtendedInfoClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo", pathParameters), - autorest.WithJSON(resourceResourceExtendedInfoDetails), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VaultExtendedInfoClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VaultExtendedInfoClient) CreateOrUpdateResponder(resp *http.Response) (result VaultExtendedInfoResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get the vault extended info. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client VaultExtendedInfoClient) Get(ctx context.Context, resourceGroupName string, vaultName string) (result VaultExtendedInfoResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultExtendedInfoClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VaultExtendedInfoClient) GetPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VaultExtendedInfoClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VaultExtendedInfoClient) GetResponder(resp *http.Response) (result VaultExtendedInfoResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update vault extended info. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -// resourceResourceExtendedInfoDetails - details of ResourceExtendedInfo -func (client VaultExtendedInfoClient) Update(ctx context.Context, resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (result VaultExtendedInfoResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultExtendedInfoClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, vaultName, resourceResourceExtendedInfoDetails) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VaultExtendedInfoClient) UpdatePreparer(ctx context.Context, resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo", pathParameters), - autorest.WithJSON(resourceResourceExtendedInfoDetails), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client VaultExtendedInfoClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client VaultExtendedInfoClient) UpdateResponder(resp *http.Response) (result VaultExtendedInfoResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaults.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaults.go deleted file mode 100644 index 839f9a9df309..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/vaults.go +++ /dev/null @@ -1,575 +0,0 @@ -package recoveryservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VaultsClient is the recovery Services Client -type VaultsClient struct { - BaseClient -} - -// NewVaultsClient creates an instance of the VaultsClient client. -func NewVaultsClient(subscriptionID string) VaultsClient { - return NewVaultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVaultsClientWithBaseURI creates an instance of the VaultsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewVaultsClientWithBaseURI(baseURI string, subscriptionID string) VaultsClient { - return VaultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Recovery Services vault. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -// vault - recovery Services Vault to be created. -func (client VaultsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, vault Vault) (result VaultsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, vaultName, vault) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VaultsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, vaultName string, vault Vault) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), - autorest.WithJSON(vault), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) CreateOrUpdateSender(req *http.Request) (future VaultsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VaultsClient) CreateOrUpdateResponder(resp *http.Response) (result Vault, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a vault. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client VaultsClient) Delete(ctx context.Context, resourceGroupName string, vaultName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VaultsClient) DeletePreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VaultsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the Vault details. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -func (client VaultsClient) Get(ctx context.Context, resourceGroupName string, vaultName string) (result Vault, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VaultsClient) GetPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VaultsClient) GetResponder(resp *http.Response) (result Vault, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup retrieve a list of Vaults. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -func (client VaultsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result VaultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.vl.Response.Response != nil { - sc = result.vl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.vl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.vl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.vl.hasNextLink() && result.vl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client VaultsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client VaultsClient) ListByResourceGroupResponder(resp *http.Response) (result VaultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client VaultsClient) listByResourceGroupNextResults(ctx context.Context, lastResults VaultList) (result VaultList, err error) { - req, err := lastResults.vaultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client VaultsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result VaultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscriptionID fetches all the resources of the specified type in the subscription. -func (client VaultsClient) ListBySubscriptionID(ctx context.Context) (result VaultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.vl.Response.Response != nil { - sc = result.vl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionIDNextResults - req, err := client.ListBySubscriptionIDPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.vl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result.vl, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListBySubscriptionID", resp, "Failure responding to request") - return - } - if result.vl.hasNextLink() && result.vl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client VaultsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/vaults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client VaultsClient) ListBySubscriptionIDResponder(resp *http.Response) (result VaultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionIDNextResults retrieves the next set of results, if any. -func (client VaultsClient) listBySubscriptionIDNextResults(ctx context.Context, lastResults VaultList) (result VaultList, err error) { - req, err := lastResults.vaultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "listBySubscriptionIDNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "listBySubscriptionIDNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "listBySubscriptionIDNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionIDComplete enumerates all values, automatically crossing page boundaries as required. -func (client VaultsClient) ListBySubscriptionIDComplete(ctx context.Context) (result VaultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.ListBySubscriptionID") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscriptionID(ctx) - return -} - -// Update updates the vault. -// Parameters: -// resourceGroupName - the name of the resource group where the recovery services vault is present. -// vaultName - the name of the recovery services vault. -// vault - recovery Services Vault to be created. -func (client VaultsClient) Update(ctx context.Context, resourceGroupName string, vaultName string, vault PatchVault) (result VaultsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, vaultName, vault) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VaultsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, vaultName string, vault PatchVault) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), - autorest.WithJSON(vault), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) UpdateSender(req *http.Request) (future VaultsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client VaultsClient) UpdateResponder(resp *http.Response) (result Vault, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/version.go deleted file mode 100644 index 91a651916f34..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package recoveryservices - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " recoveryservices/2021-08-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/_meta.json deleted file mode 100644 index 8882d032209b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "58cb0aa2979e64c7335cc26fe45a1854a6d0b7ad", - "readme": "/_/azure-rest-api-specs/specification/redis/resource-manager/readme.md", - "tag": "package-2021-06", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-06 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/redis/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/asyncoperationstatus.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/asyncoperationstatus.go deleted file mode 100644 index 0536da45e874..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/asyncoperationstatus.go +++ /dev/null @@ -1,108 +0,0 @@ -package redis - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AsyncOperationStatusClient is the REST API for Azure Redis Cache Service. -type AsyncOperationStatusClient struct { - BaseClient -} - -// NewAsyncOperationStatusClient creates an instance of the AsyncOperationStatusClient client. -func NewAsyncOperationStatusClient(subscriptionID string) AsyncOperationStatusClient { - return NewAsyncOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAsyncOperationStatusClientWithBaseURI creates an instance of the AsyncOperationStatusClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewAsyncOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) AsyncOperationStatusClient { - return AsyncOperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get for checking the ongoing status of an operation -// Parameters: -// location - the location at which operation was triggered -// operationID - the ID of asynchronous operation -func (client AsyncOperationStatusClient) Get(ctx context.Context, location string, operationID string) (result OperationStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AsyncOperationStatusClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, location, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.AsyncOperationStatusClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.AsyncOperationStatusClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.AsyncOperationStatusClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AsyncOperationStatusClient) GetPreparer(ctx context.Context, location string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "operationId": autorest.Encode("path", operationID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AsyncOperationStatusClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AsyncOperationStatusClient) GetResponder(resp *http.Response) (result OperationStatus, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/client.go deleted file mode 100644 index d34c9241618e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package redis implements the Azure ARM Redis service API version 2021-06-01. -// -// REST API for Azure Redis Cache Service. -package redis - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Redis - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Redis. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/enums.go deleted file mode 100644 index cf76cbe32602..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/enums.go +++ /dev/null @@ -1,238 +0,0 @@ -package redis - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// DayOfWeek enumerates the values for day of week. -type DayOfWeek string - -const ( - // DayOfWeekEveryday ... - DayOfWeekEveryday DayOfWeek = "Everyday" - // DayOfWeekFriday ... - DayOfWeekFriday DayOfWeek = "Friday" - // DayOfWeekMonday ... - DayOfWeekMonday DayOfWeek = "Monday" - // DayOfWeekSaturday ... - DayOfWeekSaturday DayOfWeek = "Saturday" - // DayOfWeekSunday ... - DayOfWeekSunday DayOfWeek = "Sunday" - // DayOfWeekThursday ... - DayOfWeekThursday DayOfWeek = "Thursday" - // DayOfWeekTuesday ... - DayOfWeekTuesday DayOfWeek = "Tuesday" - // DayOfWeekWednesday ... - DayOfWeekWednesday DayOfWeek = "Wednesday" - // DayOfWeekWeekend ... - DayOfWeekWeekend DayOfWeek = "Weekend" -) - -// PossibleDayOfWeekValues returns an array of possible values for the DayOfWeek const type. -func PossibleDayOfWeekValues() []DayOfWeek { - return []DayOfWeek{DayOfWeekEveryday, DayOfWeekFriday, DayOfWeekMonday, DayOfWeekSaturday, DayOfWeekSunday, DayOfWeekThursday, DayOfWeekTuesday, DayOfWeekWednesday, DayOfWeekWeekend} -} - -// KeyType enumerates the values for key type. -type KeyType string - -const ( - // KeyTypePrimary ... - KeyTypePrimary KeyType = "Primary" - // KeyTypeSecondary ... - KeyTypeSecondary KeyType = "Secondary" -) - -// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. -func PossibleKeyTypeValues() []KeyType { - return []KeyType{KeyTypePrimary, KeyTypeSecondary} -} - -// ManagedServiceIdentityType enumerates the values for managed service identity type. -type ManagedServiceIdentityType string - -const ( - // ManagedServiceIdentityTypeNone ... - ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - // ManagedServiceIdentityTypeSystemAssigned ... - ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" - // ManagedServiceIdentityTypeSystemAssignedUserAssigned ... - ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned, UserAssigned" - // ManagedServiceIdentityTypeUserAssigned ... - ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" -) - -// PossibleManagedServiceIdentityTypeValues returns an array of possible values for the ManagedServiceIdentityType const type. -func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { - return []ManagedServiceIdentityType{ManagedServiceIdentityTypeNone, ManagedServiceIdentityTypeSystemAssigned, ManagedServiceIdentityTypeSystemAssignedUserAssigned, ManagedServiceIdentityTypeUserAssigned} -} - -// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection -// provisioning state. -type PrivateEndpointConnectionProvisioningState string - -const ( - // PrivateEndpointConnectionProvisioningStateCreating ... - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - // PrivateEndpointConnectionProvisioningStateDeleting ... - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - // PrivateEndpointConnectionProvisioningStateFailed ... - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - // PrivateEndpointConnectionProvisioningStateSucceeded ... - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" -) - -// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. -func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { - return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded} -} - -// PrivateEndpointServiceConnectionStatus enumerates the values for private endpoint service connection status. -type PrivateEndpointServiceConnectionStatus string - -const ( - // PrivateEndpointServiceConnectionStatusApproved ... - PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - // PrivateEndpointServiceConnectionStatusPending ... - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" - // PrivateEndpointServiceConnectionStatusRejected ... - PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" -) - -// PossiblePrivateEndpointServiceConnectionStatusValues returns an array of possible values for the PrivateEndpointServiceConnectionStatus const type. -func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { - return []PrivateEndpointServiceConnectionStatus{PrivateEndpointServiceConnectionStatusApproved, PrivateEndpointServiceConnectionStatusPending, PrivateEndpointServiceConnectionStatusRejected} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCreating ... - ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateDisabled ... - ProvisioningStateDisabled ProvisioningState = "Disabled" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateLinking ... - ProvisioningStateLinking ProvisioningState = "Linking" - // ProvisioningStateProvisioning ... - ProvisioningStateProvisioning ProvisioningState = "Provisioning" - // ProvisioningStateRecoveringScaleFailure ... - ProvisioningStateRecoveringScaleFailure ProvisioningState = "RecoveringScaleFailure" - // ProvisioningStateScaling ... - ProvisioningStateScaling ProvisioningState = "Scaling" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUnlinking ... - ProvisioningStateUnlinking ProvisioningState = "Unlinking" - // ProvisioningStateUnprovisioning ... - ProvisioningStateUnprovisioning ProvisioningState = "Unprovisioning" - // ProvisioningStateUpdating ... - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateDisabled, ProvisioningStateFailed, ProvisioningStateLinking, ProvisioningStateProvisioning, ProvisioningStateRecoveringScaleFailure, ProvisioningStateScaling, ProvisioningStateSucceeded, ProvisioningStateUnlinking, ProvisioningStateUnprovisioning, ProvisioningStateUpdating} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // PublicNetworkAccessDisabled ... - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - // PublicNetworkAccessEnabled ... - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} -} - -// RebootType enumerates the values for reboot type. -type RebootType string - -const ( - // RebootTypeAllNodes ... - RebootTypeAllNodes RebootType = "AllNodes" - // RebootTypePrimaryNode ... - RebootTypePrimaryNode RebootType = "PrimaryNode" - // RebootTypeSecondaryNode ... - RebootTypeSecondaryNode RebootType = "SecondaryNode" -) - -// PossibleRebootTypeValues returns an array of possible values for the RebootType const type. -func PossibleRebootTypeValues() []RebootType { - return []RebootType{RebootTypeAllNodes, RebootTypePrimaryNode, RebootTypeSecondaryNode} -} - -// ReplicationRole enumerates the values for replication role. -type ReplicationRole string - -const ( - // ReplicationRolePrimary ... - ReplicationRolePrimary ReplicationRole = "Primary" - // ReplicationRoleSecondary ... - ReplicationRoleSecondary ReplicationRole = "Secondary" -) - -// PossibleReplicationRoleValues returns an array of possible values for the ReplicationRole const type. -func PossibleReplicationRoleValues() []ReplicationRole { - return []ReplicationRole{ReplicationRolePrimary, ReplicationRoleSecondary} -} - -// SkuFamily enumerates the values for sku family. -type SkuFamily string - -const ( - // SkuFamilyC ... - SkuFamilyC SkuFamily = "C" - // SkuFamilyP ... - SkuFamilyP SkuFamily = "P" -) - -// PossibleSkuFamilyValues returns an array of possible values for the SkuFamily const type. -func PossibleSkuFamilyValues() []SkuFamily { - return []SkuFamily{SkuFamilyC, SkuFamilyP} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // SkuNameBasic ... - SkuNameBasic SkuName = "Basic" - // SkuNamePremium ... - SkuNamePremium SkuName = "Premium" - // SkuNameStandard ... - SkuNameStandard SkuName = "Standard" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{SkuNameBasic, SkuNamePremium, SkuNameStandard} -} - -// TLSVersion enumerates the values for tls version. -type TLSVersion string - -const ( - // TLSVersionOneFullStopOne ... - TLSVersionOneFullStopOne TLSVersion = "1.1" - // TLSVersionOneFullStopTwo ... - TLSVersionOneFullStopTwo TLSVersion = "1.2" - // TLSVersionOneFullStopZero ... - TLSVersionOneFullStopZero TLSVersion = "1.0" -) - -// PossibleTLSVersionValues returns an array of possible values for the TLSVersion const type. -func PossibleTLSVersionValues() []TLSVersion { - return []TLSVersion{TLSVersionOneFullStopOne, TLSVersionOneFullStopTwo, TLSVersionOneFullStopZero} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/firewallrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/firewallrules.go deleted file mode 100644 index ce0d46a6b944..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/firewallrules.go +++ /dev/null @@ -1,395 +0,0 @@ -package redis - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// FirewallRulesClient is the REST API for Azure Redis Cache Service. -type FirewallRulesClient struct { - BaseClient -} - -// NewFirewallRulesClient creates an instance of the FirewallRulesClient client. -func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { - return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFirewallRulesClientWithBaseURI creates an instance of the FirewallRulesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { - return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a redis cache firewall rule -// Parameters: -// resourceGroupName - the name of the resource group. -// cacheName - the name of the Redis cache. -// ruleName - the name of the firewall rule. -// parameters - parameters supplied to the create or update redis firewall rule operation. -func (client FirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, ruleName string, parameters FirewallRule) (result FirewallRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIP", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.FirewallRuleProperties.EndIP", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("redis.FirewallRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, cacheName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, cacheName string, ruleName string, parameters FirewallRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheName": autorest.Encode("path", cacheName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a single firewall rule in a specified redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// cacheName - the name of the Redis cache. -// ruleName - the name of the firewall rule. -func (client FirewallRulesClient) Delete(ctx context.Context, resourceGroupName string, cacheName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, cacheName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FirewallRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, cacheName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheName": autorest.Encode("path", cacheName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a single firewall rule in a specified redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// cacheName - the name of the Redis cache. -// ruleName - the name of the firewall rule. -func (client FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, cacheName string, ruleName string) (result FirewallRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, cacheName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client FirewallRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, cacheName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheName": autorest.Encode("path", cacheName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all firewall rules in the specified redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// cacheName - the name of the Redis cache. -func (client FirewallRulesClient) List(ctx context.Context, resourceGroupName string, cacheName string) (result FirewallRuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.List") - defer func() { - sc := -1 - if result.frlr.Response.Response != nil { - sc = result.frlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, cacheName) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.frlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure sending request") - return - } - - result.frlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure responding to request") - return - } - if result.frlr.hasNextLink() && result.frlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client FirewallRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheName": autorest.Encode("path", cacheName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) ListResponder(resp *http.Response) (result FirewallRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client FirewallRulesClient) listNextResults(ctx context.Context, lastResults FirewallRuleListResult) (result FirewallRuleListResult, err error) { - req, err := lastResults.firewallRuleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client FirewallRulesClient) ListComplete(ctx context.Context, resourceGroupName string, cacheName string) (result FirewallRuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, cacheName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/linkedserver.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/linkedserver.go deleted file mode 100644 index 5a4c03a05923..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/linkedserver.go +++ /dev/null @@ -1,398 +0,0 @@ -package redis - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LinkedServerClient is the REST API for Azure Redis Cache Service. -type LinkedServerClient struct { - BaseClient -} - -// NewLinkedServerClient creates an instance of the LinkedServerClient client. -func NewLinkedServerClient(subscriptionID string) LinkedServerClient { - return NewLinkedServerClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLinkedServerClientWithBaseURI creates an instance of the LinkedServerClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewLinkedServerClientWithBaseURI(baseURI string, subscriptionID string) LinkedServerClient { - return LinkedServerClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create adds a linked server to the Redis cache (requires Premium SKU). -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the Redis cache. -// linkedServerName - the name of the linked server that is being added to the Redis cache. -// parameters - parameters supplied to the Create Linked server operation. -func (client LinkedServerClient) Create(ctx context.Context, resourceGroupName string, name string, linkedServerName string, parameters LinkedServerCreateParameters) (result LinkedServerCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LinkedServerClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LinkedServerCreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LinkedServerCreateProperties.LinkedRedisCacheID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LinkedServerCreateProperties.LinkedRedisCacheLocation", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("redis.LinkedServerClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, name, linkedServerName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.LinkedServerClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.LinkedServerClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client LinkedServerClient) CreatePreparer(ctx context.Context, resourceGroupName string, name string, linkedServerName string, parameters LinkedServerCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "linkedServerName": autorest.Encode("path", linkedServerName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client LinkedServerClient) CreateSender(req *http.Request) (future LinkedServerCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client LinkedServerClient) CreateResponder(resp *http.Response) (result LinkedServerWithProperties, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the linked server from a redis cache (requires Premium SKU). -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the redis cache. -// linkedServerName - the name of the linked server that is being added to the Redis cache. -func (client LinkedServerClient) Delete(ctx context.Context, resourceGroupName string, name string, linkedServerName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LinkedServerClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, name, linkedServerName) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.LinkedServerClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "redis.LinkedServerClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.LinkedServerClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LinkedServerClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string, linkedServerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "linkedServerName": autorest.Encode("path", linkedServerName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client LinkedServerClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client LinkedServerClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the detailed information about a linked server of a redis cache (requires Premium SKU). -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the redis cache. -// linkedServerName - the name of the linked server. -func (client LinkedServerClient) Get(ctx context.Context, resourceGroupName string, name string, linkedServerName string) (result LinkedServerWithProperties, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LinkedServerClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, name, linkedServerName) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.LinkedServerClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.LinkedServerClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.LinkedServerClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LinkedServerClient) GetPreparer(ctx context.Context, resourceGroupName string, name string, linkedServerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "linkedServerName": autorest.Encode("path", linkedServerName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client LinkedServerClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client LinkedServerClient) GetResponder(resp *http.Response) (result LinkedServerWithProperties, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets the list of linked servers associated with this redis cache (requires Premium SKU). -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the redis cache. -func (client LinkedServerClient) List(ctx context.Context, resourceGroupName string, name string) (result LinkedServerWithPropertiesListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LinkedServerClient.List") - defer func() { - sc := -1 - if result.lswpl.Response.Response != nil { - sc = result.lswpl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.LinkedServerClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.lswpl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.LinkedServerClient", "List", resp, "Failure sending request") - return - } - - result.lswpl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.LinkedServerClient", "List", resp, "Failure responding to request") - return - } - if result.lswpl.hasNextLink() && result.lswpl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client LinkedServerClient) ListPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client LinkedServerClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client LinkedServerClient) ListResponder(resp *http.Response) (result LinkedServerWithPropertiesList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client LinkedServerClient) listNextResults(ctx context.Context, lastResults LinkedServerWithPropertiesList) (result LinkedServerWithPropertiesList, err error) { - req, err := lastResults.linkedServerWithPropertiesListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "redis.LinkedServerClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "redis.LinkedServerClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.LinkedServerClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client LinkedServerClient) ListComplete(ctx context.Context, resourceGroupName string, name string) (result LinkedServerWithPropertiesListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LinkedServerClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, name) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/models.go deleted file mode 100644 index 2cc92b5d4a9b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/models.go +++ /dev/null @@ -1,3056 +0,0 @@ -package redis - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "github.com/gofrs/uuid" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis" - -// AccessKeys redis cache access keys. -type AccessKeys struct { - autorest.Response `json:"-"` - // PrimaryKey - READ-ONLY; The current primary key that clients can use to authenticate with Redis cache. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - READ-ONLY; The current secondary key that clients can use to authenticate with Redis cache. - SecondaryKey *string `json:"secondaryKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccessKeys. -func (ak AccessKeys) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CheckNameAvailabilityParameters parameters body to pass for resource name availability check. -type CheckNameAvailabilityParameters struct { - // Name - Resource name. - Name *string `json:"name,omitempty"` - // Type - Resource type. The only legal value of this property for checking redis cache name availability is 'Microsoft.Cache/redis'. - Type *string `json:"type,omitempty"` -} - -// CommonProperties create/Update/Get common properties of the redis cache. -type CommonProperties struct { - // RedisConfiguration - All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. - RedisConfiguration *CommonPropertiesRedisConfiguration `json:"redisConfiguration,omitempty"` - // RedisVersion - Redis version. Only major version will be used in PUT/PATCH request with current valid values: (4, 6) - RedisVersion *string `json:"redisVersion,omitempty"` - // EnableNonSslPort - Specifies whether the non-ssl Redis server port (6379) is enabled. - EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` - // ReplicasPerMaster - The number of replicas to be created per primary. - ReplicasPerMaster *int32 `json:"replicasPerMaster,omitempty"` - // ReplicasPerPrimary - The number of replicas to be created per primary. - ReplicasPerPrimary *int32 `json:"replicasPerPrimary,omitempty"` - // TenantSettings - A dictionary of tenant settings - TenantSettings map[string]*string `json:"tenantSettings"` - // ShardCount - The number of shards to be created on a Premium Cluster Cache. - ShardCount *int32 `json:"shardCount,omitempty"` - // MinimumTLSVersion - Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: 'TLSVersionOneFullStopZero', 'TLSVersionOneFullStopOne', 'TLSVersionOneFullStopTwo' - MinimumTLSVersion TLSVersion `json:"minimumTlsVersion,omitempty"` - // PublicNetworkAccess - Whether or not public endpoint access is allowed for this cache. 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'. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for CommonProperties. -func (cp CommonProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.RedisConfiguration != nil { - objectMap["redisConfiguration"] = cp.RedisConfiguration - } - if cp.RedisVersion != nil { - objectMap["redisVersion"] = cp.RedisVersion - } - if cp.EnableNonSslPort != nil { - objectMap["enableNonSslPort"] = cp.EnableNonSslPort - } - if cp.ReplicasPerMaster != nil { - objectMap["replicasPerMaster"] = cp.ReplicasPerMaster - } - if cp.ReplicasPerPrimary != nil { - objectMap["replicasPerPrimary"] = cp.ReplicasPerPrimary - } - if cp.TenantSettings != nil { - objectMap["tenantSettings"] = cp.TenantSettings - } - if cp.ShardCount != nil { - objectMap["shardCount"] = cp.ShardCount - } - if cp.MinimumTLSVersion != "" { - objectMap["minimumTlsVersion"] = cp.MinimumTLSVersion - } - if cp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = cp.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// CommonPropertiesRedisConfiguration all Redis Settings. Few possible keys: -// rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value -// etc. -type CommonPropertiesRedisConfiguration struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // RdbBackupEnabled - Specifies whether the rdb backup is enabled - RdbBackupEnabled *string `json:"rdb-backup-enabled,omitempty"` - // RdbBackupFrequency - Specifies the frequency for creating rdb backup - RdbBackupFrequency *string `json:"rdb-backup-frequency,omitempty"` - // RdbBackupMaxSnapshotCount - Specifies the maximum number of snapshots for rdb backup - RdbBackupMaxSnapshotCount *string `json:"rdb-backup-max-snapshot-count,omitempty"` - // RdbStorageConnectionString - The storage account connection string for storing rdb file - RdbStorageConnectionString *string `json:"rdb-storage-connection-string,omitempty"` - // AofStorageConnectionString0 - First storage account connection string - AofStorageConnectionString0 *string `json:"aof-storage-connection-string-0,omitempty"` - // AofStorageConnectionString1 - Second storage account connection string - AofStorageConnectionString1 *string `json:"aof-storage-connection-string-1,omitempty"` - // MaxfragmentationmemoryReserved - Value in megabytes reserved for fragmentation per shard - MaxfragmentationmemoryReserved *string `json:"maxfragmentationmemory-reserved,omitempty"` - // MaxmemoryPolicy - The eviction strategy used when your data won't fit within its memory limit. - MaxmemoryPolicy *string `json:"maxmemory-policy,omitempty"` - // MaxmemoryReserved - Value in megabytes reserved for non-cache usage per shard e.g. failover. - MaxmemoryReserved *string `json:"maxmemory-reserved,omitempty"` - // MaxmemoryDelta - Value in megabytes reserved for non-cache usage per shard e.g. failover. - MaxmemoryDelta *string `json:"maxmemory-delta,omitempty"` - // Maxclients - READ-ONLY; The max clients config - Maxclients *string `json:"maxclients,omitempty"` - // PreferredDataArchiveAuthMethod - READ-ONLY; Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS - PreferredDataArchiveAuthMethod *string `json:"preferred-data-archive-auth-method,omitempty"` - // PreferredDataPersistenceAuthMethod - READ-ONLY; Preferred auth method to communicate to storage account used for data persistence, specify SAS or ManagedIdentity, default value is SAS - PreferredDataPersistenceAuthMethod *string `json:"preferred-data-persistence-auth-method,omitempty"` - // ZonalConfiguration - READ-ONLY; Zonal Configuration - ZonalConfiguration *string `json:"zonal-configuration,omitempty"` -} - -// MarshalJSON is the custom marshaler for CommonPropertiesRedisConfiguration. -func (cpC CommonPropertiesRedisConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cpC.RdbBackupEnabled != nil { - objectMap["rdb-backup-enabled"] = cpC.RdbBackupEnabled - } - if cpC.RdbBackupFrequency != nil { - objectMap["rdb-backup-frequency"] = cpC.RdbBackupFrequency - } - if cpC.RdbBackupMaxSnapshotCount != nil { - objectMap["rdb-backup-max-snapshot-count"] = cpC.RdbBackupMaxSnapshotCount - } - if cpC.RdbStorageConnectionString != nil { - objectMap["rdb-storage-connection-string"] = cpC.RdbStorageConnectionString - } - if cpC.AofStorageConnectionString0 != nil { - objectMap["aof-storage-connection-string-0"] = cpC.AofStorageConnectionString0 - } - if cpC.AofStorageConnectionString1 != nil { - objectMap["aof-storage-connection-string-1"] = cpC.AofStorageConnectionString1 - } - if cpC.MaxfragmentationmemoryReserved != nil { - objectMap["maxfragmentationmemory-reserved"] = cpC.MaxfragmentationmemoryReserved - } - if cpC.MaxmemoryPolicy != nil { - objectMap["maxmemory-policy"] = cpC.MaxmemoryPolicy - } - if cpC.MaxmemoryReserved != nil { - objectMap["maxmemory-reserved"] = cpC.MaxmemoryReserved - } - if cpC.MaxmemoryDelta != nil { - objectMap["maxmemory-delta"] = cpC.MaxmemoryDelta - } - for k, v := range cpC.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CommonPropertiesRedisConfiguration struct. -func (cpC *CommonPropertiesRedisConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if cpC.AdditionalProperties == nil { - cpC.AdditionalProperties = make(map[string]interface{}) - } - cpC.AdditionalProperties[k] = additionalProperties - } - case "rdb-backup-enabled": - if v != nil { - var rdbBackupEnabled string - err = json.Unmarshal(*v, &rdbBackupEnabled) - if err != nil { - return err - } - cpC.RdbBackupEnabled = &rdbBackupEnabled - } - case "rdb-backup-frequency": - if v != nil { - var rdbBackupFrequency string - err = json.Unmarshal(*v, &rdbBackupFrequency) - if err != nil { - return err - } - cpC.RdbBackupFrequency = &rdbBackupFrequency - } - case "rdb-backup-max-snapshot-count": - if v != nil { - var rdbBackupMaxSnapshotCount string - err = json.Unmarshal(*v, &rdbBackupMaxSnapshotCount) - if err != nil { - return err - } - cpC.RdbBackupMaxSnapshotCount = &rdbBackupMaxSnapshotCount - } - case "rdb-storage-connection-string": - if v != nil { - var rdbStorageConnectionString string - err = json.Unmarshal(*v, &rdbStorageConnectionString) - if err != nil { - return err - } - cpC.RdbStorageConnectionString = &rdbStorageConnectionString - } - case "aof-storage-connection-string-0": - if v != nil { - var aofStorageConnectionString0 string - err = json.Unmarshal(*v, &aofStorageConnectionString0) - if err != nil { - return err - } - cpC.AofStorageConnectionString0 = &aofStorageConnectionString0 - } - case "aof-storage-connection-string-1": - if v != nil { - var aofStorageConnectionString1 string - err = json.Unmarshal(*v, &aofStorageConnectionString1) - if err != nil { - return err - } - cpC.AofStorageConnectionString1 = &aofStorageConnectionString1 - } - case "maxfragmentationmemory-reserved": - if v != nil { - var maxfragmentationmemoryReserved string - err = json.Unmarshal(*v, &maxfragmentationmemoryReserved) - if err != nil { - return err - } - cpC.MaxfragmentationmemoryReserved = &maxfragmentationmemoryReserved - } - case "maxmemory-policy": - if v != nil { - var maxmemoryPolicy string - err = json.Unmarshal(*v, &maxmemoryPolicy) - if err != nil { - return err - } - cpC.MaxmemoryPolicy = &maxmemoryPolicy - } - case "maxmemory-reserved": - if v != nil { - var maxmemoryReserved string - err = json.Unmarshal(*v, &maxmemoryReserved) - if err != nil { - return err - } - cpC.MaxmemoryReserved = &maxmemoryReserved - } - case "maxmemory-delta": - if v != nil { - var maxmemoryDelta string - err = json.Unmarshal(*v, &maxmemoryDelta) - if err != nil { - return err - } - cpC.MaxmemoryDelta = &maxmemoryDelta - } - case "maxclients": - if v != nil { - var maxclients string - err = json.Unmarshal(*v, &maxclients) - if err != nil { - return err - } - cpC.Maxclients = &maxclients - } - case "preferred-data-archive-auth-method": - if v != nil { - var preferredDataArchiveAuthMethod string - err = json.Unmarshal(*v, &preferredDataArchiveAuthMethod) - if err != nil { - return err - } - cpC.PreferredDataArchiveAuthMethod = &preferredDataArchiveAuthMethod - } - case "preferred-data-persistence-auth-method": - if v != nil { - var preferredDataPersistenceAuthMethod string - err = json.Unmarshal(*v, &preferredDataPersistenceAuthMethod) - if err != nil { - return err - } - cpC.PreferredDataPersistenceAuthMethod = &preferredDataPersistenceAuthMethod - } - case "zonal-configuration": - if v != nil { - var zonalConfiguration string - err = json.Unmarshal(*v, &zonalConfiguration) - if err != nil { - return err - } - cpC.ZonalConfiguration = &zonalConfiguration - } - } - } - - return nil -} - -// CreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type CreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (ResourceType, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CreateFuture.Result. -func (future *CreateFuture) result(client Client) (rt ResourceType, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.CreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rt.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redis.CreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent { - rt, err = client.CreateResponder(rt.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.CreateFuture", "Result", rt.Response.Response, "Failure responding to request") - } - } - return -} - -// CreateParameters parameters supplied to the Create Redis operation. -type CreateParameters struct { - // CreateProperties - Redis cache properties. - *CreateProperties `json:"properties,omitempty"` - // Zones - A list of availability zones denoting where the resource needs to come from. - Zones *[]string `json:"zones,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Identity - The identity of the resource. - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for CreateParameters. -func (cp CreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.CreateProperties != nil { - objectMap["properties"] = cp.CreateProperties - } - if cp.Zones != nil { - objectMap["zones"] = cp.Zones - } - if cp.Location != nil { - objectMap["location"] = cp.Location - } - if cp.Tags != nil { - objectMap["tags"] = cp.Tags - } - if cp.Identity != nil { - objectMap["identity"] = cp.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CreateParameters struct. -func (cp *CreateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var createProperties CreateProperties - err = json.Unmarshal(*v, &createProperties) - if err != nil { - return err - } - cp.CreateProperties = &createProperties - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - cp.Zones = &zones - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - cp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cp.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - cp.Identity = &identity - } - } - } - - return nil -} - -// CreateProperties properties supplied to Create Redis operation. -type CreateProperties struct { - // Sku - The SKU of the Redis cache to deploy. - Sku *Sku `json:"sku,omitempty"` - // SubnetID - The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 - SubnetID *string `json:"subnetId,omitempty"` - // StaticIP - Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. - StaticIP *string `json:"staticIP,omitempty"` - // RedisConfiguration - All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. - RedisConfiguration *CommonPropertiesRedisConfiguration `json:"redisConfiguration,omitempty"` - // RedisVersion - Redis version. Only major version will be used in PUT/PATCH request with current valid values: (4, 6) - RedisVersion *string `json:"redisVersion,omitempty"` - // EnableNonSslPort - Specifies whether the non-ssl Redis server port (6379) is enabled. - EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` - // ReplicasPerMaster - The number of replicas to be created per primary. - ReplicasPerMaster *int32 `json:"replicasPerMaster,omitempty"` - // ReplicasPerPrimary - The number of replicas to be created per primary. - ReplicasPerPrimary *int32 `json:"replicasPerPrimary,omitempty"` - // TenantSettings - A dictionary of tenant settings - TenantSettings map[string]*string `json:"tenantSettings"` - // ShardCount - The number of shards to be created on a Premium Cluster Cache. - ShardCount *int32 `json:"shardCount,omitempty"` - // MinimumTLSVersion - Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: 'TLSVersionOneFullStopZero', 'TLSVersionOneFullStopOne', 'TLSVersionOneFullStopTwo' - MinimumTLSVersion TLSVersion `json:"minimumTlsVersion,omitempty"` - // PublicNetworkAccess - Whether or not public endpoint access is allowed for this cache. 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'. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for CreateProperties. -func (cp CreateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Sku != nil { - objectMap["sku"] = cp.Sku - } - if cp.SubnetID != nil { - objectMap["subnetId"] = cp.SubnetID - } - if cp.StaticIP != nil { - objectMap["staticIP"] = cp.StaticIP - } - if cp.RedisConfiguration != nil { - objectMap["redisConfiguration"] = cp.RedisConfiguration - } - if cp.RedisVersion != nil { - objectMap["redisVersion"] = cp.RedisVersion - } - if cp.EnableNonSslPort != nil { - objectMap["enableNonSslPort"] = cp.EnableNonSslPort - } - if cp.ReplicasPerMaster != nil { - objectMap["replicasPerMaster"] = cp.ReplicasPerMaster - } - if cp.ReplicasPerPrimary != nil { - objectMap["replicasPerPrimary"] = cp.ReplicasPerPrimary - } - if cp.TenantSettings != nil { - objectMap["tenantSettings"] = cp.TenantSettings - } - if cp.ShardCount != nil { - objectMap["shardCount"] = cp.ShardCount - } - if cp.MinimumTLSVersion != "" { - objectMap["minimumTlsVersion"] = cp.MinimumTLSVersion - } - if cp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = cp.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type DeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeleteFuture.Result. -func (future *DeleteFuture) result(client Client) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.DeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redis.DeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorDetail the error detail. -type ErrorDetail struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]ErrorDetail `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorDetail. -func (ed ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for -// failed operations. (This also follows the OData error response format.). -type ErrorResponse struct { - // Error - The error object. - Error *ErrorDetail `json:"error,omitempty"` -} - -// ExportDataFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type ExportDataFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExportDataFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExportDataFuture.Result. -func (future *ExportDataFuture) result(client Client) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.ExportDataFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redis.ExportDataFuture") - return - } - ar.Response = future.Response() - return -} - -// ExportRDBParameters parameters for Redis export operation. -type ExportRDBParameters struct { - // Format - File format. - Format *string `json:"format,omitempty"` - // Prefix - Prefix to use for exported files. - Prefix *string `json:"prefix,omitempty"` - // Container - Container name to export to. - Container *string `json:"container,omitempty"` -} - -// FirewallRule a firewall rule on a redis cache has a name, and describes a contiguous range of IP -// addresses permitted to connect -type FirewallRule struct { - autorest.Response `json:"-"` - // FirewallRuleProperties - redis cache firewall rule properties - *FirewallRuleProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FirewallRule. -func (fr FirewallRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fr.FirewallRuleProperties != nil { - objectMap["properties"] = fr.FirewallRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FirewallRule struct. -func (fr *FirewallRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var firewallRuleProperties FirewallRuleProperties - err = json.Unmarshal(*v, &firewallRuleProperties) - if err != nil { - return err - } - fr.FirewallRuleProperties = &firewallRuleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fr.Type = &typeVar - } - } - } - - return nil -} - -// FirewallRuleCreateParameters parameters required for creating a firewall rule on redis cache. (Note, you -// can just use the FirewallRule type instead now.) -type FirewallRuleCreateParameters struct { - // FirewallRuleProperties - redis cache firewall rule properties - *FirewallRuleProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FirewallRuleCreateParameters. -func (frcp FirewallRuleCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if frcp.FirewallRuleProperties != nil { - objectMap["properties"] = frcp.FirewallRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FirewallRuleCreateParameters struct. -func (frcp *FirewallRuleCreateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var firewallRuleProperties FirewallRuleProperties - err = json.Unmarshal(*v, &firewallRuleProperties) - if err != nil { - return err - } - frcp.FirewallRuleProperties = &firewallRuleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - frcp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - frcp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - frcp.Type = &typeVar - } - } - } - - return nil -} - -// FirewallRuleListResult the response of list firewall rules Redis operation. -type FirewallRuleListResult struct { - autorest.Response `json:"-"` - // Value - Results of the list firewall rules operation. - Value *[]FirewallRule `json:"value,omitempty"` - // NextLink - READ-ONLY; Link for next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for FirewallRuleListResult. -func (frlr FirewallRuleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if frlr.Value != nil { - objectMap["value"] = frlr.Value - } - return json.Marshal(objectMap) -} - -// FirewallRuleListResultIterator provides access to a complete listing of FirewallRule values. -type FirewallRuleListResultIterator struct { - i int - page FirewallRuleListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *FirewallRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *FirewallRuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter FirewallRuleListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter FirewallRuleListResultIterator) Response() FirewallRuleListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter FirewallRuleListResultIterator) Value() FirewallRule { - if !iter.page.NotDone() { - return FirewallRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the FirewallRuleListResultIterator type. -func NewFirewallRuleListResultIterator(page FirewallRuleListResultPage) FirewallRuleListResultIterator { - return FirewallRuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (frlr FirewallRuleListResult) IsEmpty() bool { - return frlr.Value == nil || len(*frlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (frlr FirewallRuleListResult) hasNextLink() bool { - return frlr.NextLink != nil && len(*frlr.NextLink) != 0 -} - -// firewallRuleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (frlr FirewallRuleListResult) firewallRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !frlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(frlr.NextLink))) -} - -// FirewallRuleListResultPage contains a page of FirewallRule values. -type FirewallRuleListResultPage struct { - fn func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error) - frlr FirewallRuleListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *FirewallRuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.frlr) - if err != nil { - return err - } - page.frlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *FirewallRuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page FirewallRuleListResultPage) NotDone() bool { - return !page.frlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page FirewallRuleListResultPage) Response() FirewallRuleListResult { - return page.frlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page FirewallRuleListResultPage) Values() []FirewallRule { - if page.frlr.IsEmpty() { - return nil - } - return *page.frlr.Value -} - -// Creates a new instance of the FirewallRuleListResultPage type. -func NewFirewallRuleListResultPage(cur FirewallRuleListResult, getNextPage func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)) FirewallRuleListResultPage { - return FirewallRuleListResultPage{ - fn: getNextPage, - frlr: cur, - } -} - -// FirewallRuleProperties specifies a range of IP addresses permitted to connect to the cache -type FirewallRuleProperties struct { - // StartIP - lowest IP address included in the range - StartIP *string `json:"startIP,omitempty"` - // EndIP - highest IP address included in the range - EndIP *string `json:"endIP,omitempty"` -} - -// ForceRebootResponse response to force reboot for Redis cache. -type ForceRebootResponse struct { - autorest.Response `json:"-"` - // Message - READ-ONLY; Status message - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for ForceRebootResponse. -func (frr ForceRebootResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ImportDataFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type ImportDataFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ImportDataFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ImportDataFuture.Result. -func (future *ImportDataFuture) result(client Client) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.ImportDataFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redis.ImportDataFuture") - return - } - ar.Response = future.Response() - return -} - -// ImportRDBParameters parameters for Redis import operation. -type ImportRDBParameters struct { - // Format - File format. - Format *string `json:"format,omitempty"` - // Files - files to import. - Files *[]string `json:"files,omitempty"` -} - -// InstanceDetails details of single instance of redis. -type InstanceDetails struct { - // SslPort - READ-ONLY; Redis instance SSL port. - SslPort *int32 `json:"sslPort,omitempty"` - // NonSslPort - READ-ONLY; If enableNonSslPort is true, provides Redis instance Non-SSL port. - NonSslPort *int32 `json:"nonSslPort,omitempty"` - // Zone - READ-ONLY; If the Cache uses availability zones, specifies availability zone where this instance is located. - Zone *string `json:"zone,omitempty"` - // ShardID - READ-ONLY; If clustering is enabled, the Shard ID of Redis Instance - ShardID *int32 `json:"shardId,omitempty"` - // IsMaster - READ-ONLY; Specifies whether the instance is a primary node. - IsMaster *bool `json:"isMaster,omitempty"` - // IsPrimary - READ-ONLY; Specifies whether the instance is a primary node. - IsPrimary *bool `json:"isPrimary,omitempty"` -} - -// MarshalJSON is the custom marshaler for InstanceDetails. -func (ID InstanceDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LinkedServer linked server Id -type LinkedServer struct { - // ID - READ-ONLY; Linked server Id. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for LinkedServer. -func (ls LinkedServer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LinkedServerCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type LinkedServerCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LinkedServerClient) (LinkedServerWithProperties, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LinkedServerCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LinkedServerCreateFuture.Result. -func (future *LinkedServerCreateFuture) result(client LinkedServerClient) (lswp LinkedServerWithProperties, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.LinkedServerCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - lswp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redis.LinkedServerCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if lswp.Response.Response, err = future.GetResult(sender); err == nil && lswp.Response.Response.StatusCode != http.StatusNoContent { - lswp, err = client.CreateResponder(lswp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.LinkedServerCreateFuture", "Result", lswp.Response.Response, "Failure responding to request") - } - } - return -} - -// LinkedServerCreateParameters parameter required for creating a linked server to redis cache. -type LinkedServerCreateParameters struct { - // LinkedServerCreateProperties - Properties required to create a linked server. - *LinkedServerCreateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LinkedServerCreateParameters. -func (lscp LinkedServerCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lscp.LinkedServerCreateProperties != nil { - objectMap["properties"] = lscp.LinkedServerCreateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LinkedServerCreateParameters struct. -func (lscp *LinkedServerCreateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var linkedServerCreateProperties LinkedServerCreateProperties - err = json.Unmarshal(*v, &linkedServerCreateProperties) - if err != nil { - return err - } - lscp.LinkedServerCreateProperties = &linkedServerCreateProperties - } - } - } - - return nil -} - -// LinkedServerCreateProperties create properties for a linked server -type LinkedServerCreateProperties struct { - // LinkedRedisCacheID - Fully qualified resourceId of the linked redis cache. - LinkedRedisCacheID *string `json:"linkedRedisCacheId,omitempty"` - // LinkedRedisCacheLocation - Location of the linked redis cache. - LinkedRedisCacheLocation *string `json:"linkedRedisCacheLocation,omitempty"` - // ServerRole - Role of the linked server. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary' - ServerRole ReplicationRole `json:"serverRole,omitempty"` -} - -// LinkedServerProperties properties of a linked server to be returned in get/put response -type LinkedServerProperties struct { - // ProvisioningState - READ-ONLY; Terminal state of the link between primary and secondary redis cache. - ProvisioningState *string `json:"provisioningState,omitempty"` - // LinkedRedisCacheID - Fully qualified resourceId of the linked redis cache. - LinkedRedisCacheID *string `json:"linkedRedisCacheId,omitempty"` - // LinkedRedisCacheLocation - Location of the linked redis cache. - LinkedRedisCacheLocation *string `json:"linkedRedisCacheLocation,omitempty"` - // ServerRole - Role of the linked server. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary' - ServerRole ReplicationRole `json:"serverRole,omitempty"` -} - -// MarshalJSON is the custom marshaler for LinkedServerProperties. -func (lsp LinkedServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lsp.LinkedRedisCacheID != nil { - objectMap["linkedRedisCacheId"] = lsp.LinkedRedisCacheID - } - if lsp.LinkedRedisCacheLocation != nil { - objectMap["linkedRedisCacheLocation"] = lsp.LinkedRedisCacheLocation - } - if lsp.ServerRole != "" { - objectMap["serverRole"] = lsp.ServerRole - } - return json.Marshal(objectMap) -} - -// LinkedServerWithProperties response to put/get linked server (with properties) for Redis cache. -type LinkedServerWithProperties struct { - autorest.Response `json:"-"` - // LinkedServerProperties - Properties of the linked server. - *LinkedServerProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LinkedServerWithProperties. -func (lswp LinkedServerWithProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lswp.LinkedServerProperties != nil { - objectMap["properties"] = lswp.LinkedServerProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LinkedServerWithProperties struct. -func (lswp *LinkedServerWithProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var linkedServerProperties LinkedServerProperties - err = json.Unmarshal(*v, &linkedServerProperties) - if err != nil { - return err - } - lswp.LinkedServerProperties = &linkedServerProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lswp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lswp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lswp.Type = &typeVar - } - } - } - - return nil -} - -// LinkedServerWithPropertiesList list of linked servers (with properties) of a Redis cache. -type LinkedServerWithPropertiesList struct { - autorest.Response `json:"-"` - // Value - List of linked servers (with properties) of a Redis cache. - Value *[]LinkedServerWithProperties `json:"value,omitempty"` - // NextLink - READ-ONLY; Link for next set. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for LinkedServerWithPropertiesList. -func (lswpl LinkedServerWithPropertiesList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lswpl.Value != nil { - objectMap["value"] = lswpl.Value - } - return json.Marshal(objectMap) -} - -// LinkedServerWithPropertiesListIterator provides access to a complete listing of -// LinkedServerWithProperties values. -type LinkedServerWithPropertiesListIterator struct { - i int - page LinkedServerWithPropertiesListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *LinkedServerWithPropertiesListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LinkedServerWithPropertiesListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *LinkedServerWithPropertiesListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LinkedServerWithPropertiesListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter LinkedServerWithPropertiesListIterator) Response() LinkedServerWithPropertiesList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter LinkedServerWithPropertiesListIterator) Value() LinkedServerWithProperties { - if !iter.page.NotDone() { - return LinkedServerWithProperties{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LinkedServerWithPropertiesListIterator type. -func NewLinkedServerWithPropertiesListIterator(page LinkedServerWithPropertiesListPage) LinkedServerWithPropertiesListIterator { - return LinkedServerWithPropertiesListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lswpl LinkedServerWithPropertiesList) IsEmpty() bool { - return lswpl.Value == nil || len(*lswpl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lswpl LinkedServerWithPropertiesList) hasNextLink() bool { - return lswpl.NextLink != nil && len(*lswpl.NextLink) != 0 -} - -// linkedServerWithPropertiesListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lswpl LinkedServerWithPropertiesList) linkedServerWithPropertiesListPreparer(ctx context.Context) (*http.Request, error) { - if !lswpl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lswpl.NextLink))) -} - -// LinkedServerWithPropertiesListPage contains a page of LinkedServerWithProperties values. -type LinkedServerWithPropertiesListPage struct { - fn func(context.Context, LinkedServerWithPropertiesList) (LinkedServerWithPropertiesList, error) - lswpl LinkedServerWithPropertiesList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *LinkedServerWithPropertiesListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LinkedServerWithPropertiesListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lswpl) - if err != nil { - return err - } - page.lswpl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *LinkedServerWithPropertiesListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LinkedServerWithPropertiesListPage) NotDone() bool { - return !page.lswpl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LinkedServerWithPropertiesListPage) Response() LinkedServerWithPropertiesList { - return page.lswpl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LinkedServerWithPropertiesListPage) Values() []LinkedServerWithProperties { - if page.lswpl.IsEmpty() { - return nil - } - return *page.lswpl.Value -} - -// Creates a new instance of the LinkedServerWithPropertiesListPage type. -func NewLinkedServerWithPropertiesListPage(cur LinkedServerWithPropertiesList, getNextPage func(context.Context, LinkedServerWithPropertiesList) (LinkedServerWithPropertiesList, error)) LinkedServerWithPropertiesListPage { - return LinkedServerWithPropertiesListPage{ - fn: getNextPage, - lswpl: cur, - } -} - -// ListResult the response of list Redis operation. -type ListResult struct { - autorest.Response `json:"-"` - // Value - List of Redis cache instances. - Value *[]ResourceType `json:"value,omitempty"` - // NextLink - READ-ONLY; Link for next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListResult. -func (lr ListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lr.Value != nil { - objectMap["value"] = lr.Value - } - return json.Marshal(objectMap) -} - -// ListResultIterator provides access to a complete listing of ResourceType values. -type ListResultIterator struct { - i int - page ListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListResultIterator) Response() ListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListResultIterator) Value() ResourceType { - if !iter.page.NotDone() { - return ResourceType{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListResultIterator type. -func NewListResultIterator(page ListResultPage) ListResultIterator { - return ListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lr ListResult) IsEmpty() bool { - return lr.Value == nil || len(*lr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lr ListResult) hasNextLink() bool { - return lr.NextLink != nil && len(*lr.NextLink) != 0 -} - -// listResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { - if !lr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lr.NextLink))) -} - -// ListResultPage contains a page of ResourceType values. -type ListResultPage struct { - fn func(context.Context, ListResult) (ListResult, error) - lr ListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lr) - if err != nil { - return err - } - page.lr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListResultPage) NotDone() bool { - return !page.lr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListResultPage) Response() ListResult { - return page.lr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListResultPage) Values() []ResourceType { - if page.lr.IsEmpty() { - return nil - } - return *page.lr.Value -} - -// Creates a new instance of the ListResultPage type. -func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { - return ListResultPage{ - fn: getNextPage, - lr: cur, - } -} - -// ManagedServiceIdentity managed service identity (system assigned and/or user assigned identities) -type ManagedServiceIdentity struct { - // PrincipalID - READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. - PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. - TenantID *uuid.UUID `json:"tenantId,omitempty"` - // Type - Possible values include: 'ManagedServiceIdentityTypeNone', 'ManagedServiceIdentityTypeSystemAssigned', 'ManagedServiceIdentityTypeUserAssigned', 'ManagedServiceIdentityTypeSystemAssignedUserAssigned' - Type ManagedServiceIdentityType `json:"type,omitempty"` - UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for ManagedServiceIdentity. -func (msi ManagedServiceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if msi.Type != "" { - objectMap["type"] = msi.Type - } - if msi.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = msi.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// NotificationListResponse the response of listUpgradeNotifications. -type NotificationListResponse struct { - autorest.Response `json:"-"` - // Value - List of all notifications. - Value *[]UpgradeNotification `json:"value,omitempty"` - // NextLink - READ-ONLY; Link for next set of notifications. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for NotificationListResponse. -func (nlr NotificationListResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nlr.Value != nil { - objectMap["value"] = nlr.Value - } - return json.Marshal(objectMap) -} - -// NotificationListResponseIterator provides access to a complete listing of UpgradeNotification values. -type NotificationListResponseIterator struct { - i int - page NotificationListResponsePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *NotificationListResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationListResponseIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *NotificationListResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter NotificationListResponseIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter NotificationListResponseIterator) Response() NotificationListResponse { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter NotificationListResponseIterator) Value() UpgradeNotification { - if !iter.page.NotDone() { - return UpgradeNotification{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the NotificationListResponseIterator type. -func NewNotificationListResponseIterator(page NotificationListResponsePage) NotificationListResponseIterator { - return NotificationListResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (nlr NotificationListResponse) IsEmpty() bool { - return nlr.Value == nil || len(*nlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (nlr NotificationListResponse) hasNextLink() bool { - return nlr.NextLink != nil && len(*nlr.NextLink) != 0 -} - -// notificationListResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (nlr NotificationListResponse) notificationListResponsePreparer(ctx context.Context) (*http.Request, error) { - if !nlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(nlr.NextLink))) -} - -// NotificationListResponsePage contains a page of UpgradeNotification values. -type NotificationListResponsePage struct { - fn func(context.Context, NotificationListResponse) (NotificationListResponse, error) - nlr NotificationListResponse -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *NotificationListResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NotificationListResponsePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.nlr) - if err != nil { - return err - } - page.nlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *NotificationListResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page NotificationListResponsePage) NotDone() bool { - return !page.nlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page NotificationListResponsePage) Response() NotificationListResponse { - return page.nlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page NotificationListResponsePage) Values() []UpgradeNotification { - if page.nlr.IsEmpty() { - return nil - } - return *page.nlr.Value -} - -// Creates a new instance of the NotificationListResponsePage type. -func NewNotificationListResponsePage(cur NotificationListResponse, getNextPage func(context.Context, NotificationListResponse) (NotificationListResponse, error)) NotificationListResponsePage { - return NotificationListResponsePage{ - fn: getNextPage, - nlr: cur, - } -} - -// Operation REST API operation -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - The object that describes the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay the object that describes the operation. -type OperationDisplay struct { - // Provider - Friendly name of the resource provider - Provider *string `json:"provider,omitempty"` - // Operation - Operation type: read, write, delete, listKeys/action, etc. - Operation *string `json:"operation,omitempty"` - // Resource - Resource type on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Description - Friendly name of the operation - Description *string `json:"description,omitempty"` -} - -// OperationListResult 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. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the resource provider. - Value *[]Operation `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if olr.Value != nil { - objectMap["value"] = olr.Value - } - return json.Marshal(objectMap) -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// OperationStatus asynchronous operation status -type OperationStatus struct { - autorest.Response `json:"-"` - // Properties - Additional properties from RP, only when operation is successful - Properties map[string]interface{} `json:"properties"` - // ID - Fully qualified ID for the async operation. - ID *string `json:"id,omitempty"` - // Name - Name of the async operation. - Name *string `json:"name,omitempty"` - // Status - Operation status. - Status *string `json:"status,omitempty"` - // PercentComplete - Percent of the operation that is complete. - PercentComplete *float64 `json:"percentComplete,omitempty"` - // StartTime - The start time of the operation. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - The end time of the operation. - EndTime *date.Time `json:"endTime,omitempty"` - // Operations - The operations list. - Operations *[]OperationStatusResult `json:"operations,omitempty"` - // Error - If present, details of the operation error. - Error *ErrorDetail `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationStatus. -func (osVar OperationStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if osVar.Properties != nil { - objectMap["properties"] = osVar.Properties - } - if osVar.ID != nil { - objectMap["id"] = osVar.ID - } - if osVar.Name != nil { - objectMap["name"] = osVar.Name - } - if osVar.Status != nil { - objectMap["status"] = osVar.Status - } - if osVar.PercentComplete != nil { - objectMap["percentComplete"] = osVar.PercentComplete - } - if osVar.StartTime != nil { - objectMap["startTime"] = osVar.StartTime - } - if osVar.EndTime != nil { - objectMap["endTime"] = osVar.EndTime - } - if osVar.Operations != nil { - objectMap["operations"] = osVar.Operations - } - if osVar.Error != nil { - objectMap["error"] = osVar.Error - } - return json.Marshal(objectMap) -} - -// OperationStatusResult the current status of an async operation. -type OperationStatusResult struct { - // ID - Fully qualified ID for the async operation. - ID *string `json:"id,omitempty"` - // Name - Name of the async operation. - Name *string `json:"name,omitempty"` - // Status - Operation status. - Status *string `json:"status,omitempty"` - // PercentComplete - Percent of the operation that is complete. - PercentComplete *float64 `json:"percentComplete,omitempty"` - // StartTime - The start time of the operation. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - The end time of the operation. - EndTime *date.Time `json:"endTime,omitempty"` - // Operations - The operations list. - Operations *[]OperationStatusResult `json:"operations,omitempty"` - // Error - If present, details of the operation error. - Error *ErrorDetail `json:"error,omitempty"` -} - -// PatchSchedule response to put/get patch schedules for Redis cache. -type PatchSchedule struct { - autorest.Response `json:"-"` - // ScheduleEntries - List of patch schedules for a Redis cache. - *ScheduleEntries `json:"properties,omitempty"` - // Location - READ-ONLY; The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PatchSchedule. -func (ps PatchSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ps.ScheduleEntries != nil { - objectMap["properties"] = ps.ScheduleEntries - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PatchSchedule struct. -func (ps *PatchSchedule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var scheduleEntries ScheduleEntries - err = json.Unmarshal(*v, &scheduleEntries) - if err != nil { - return err - } - ps.ScheduleEntries = &scheduleEntries - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ps.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ps.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ps.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ps.Type = &typeVar - } - } - } - - return nil -} - -// PatchScheduleListResult the response of list patch schedules Redis operation. -type PatchScheduleListResult struct { - autorest.Response `json:"-"` - // Value - Results of the list patch schedules operation. - Value *[]PatchSchedule `json:"value,omitempty"` - // NextLink - READ-ONLY; Link for next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PatchScheduleListResult. -func (pslr PatchScheduleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pslr.Value != nil { - objectMap["value"] = pslr.Value - } - return json.Marshal(objectMap) -} - -// PatchScheduleListResultIterator provides access to a complete listing of PatchSchedule values. -type PatchScheduleListResultIterator struct { - i int - page PatchScheduleListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PatchScheduleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PatchScheduleListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PatchScheduleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PatchScheduleListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PatchScheduleListResultIterator) Response() PatchScheduleListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PatchScheduleListResultIterator) Value() PatchSchedule { - if !iter.page.NotDone() { - return PatchSchedule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PatchScheduleListResultIterator type. -func NewPatchScheduleListResultIterator(page PatchScheduleListResultPage) PatchScheduleListResultIterator { - return PatchScheduleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pslr PatchScheduleListResult) IsEmpty() bool { - return pslr.Value == nil || len(*pslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pslr PatchScheduleListResult) hasNextLink() bool { - return pslr.NextLink != nil && len(*pslr.NextLink) != 0 -} - -// patchScheduleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pslr PatchScheduleListResult) patchScheduleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !pslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pslr.NextLink))) -} - -// PatchScheduleListResultPage contains a page of PatchSchedule values. -type PatchScheduleListResultPage struct { - fn func(context.Context, PatchScheduleListResult) (PatchScheduleListResult, error) - pslr PatchScheduleListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PatchScheduleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PatchScheduleListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.pslr) - if err != nil { - return err - } - page.pslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PatchScheduleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PatchScheduleListResultPage) NotDone() bool { - return !page.pslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PatchScheduleListResultPage) Response() PatchScheduleListResult { - return page.pslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PatchScheduleListResultPage) Values() []PatchSchedule { - if page.pslr.IsEmpty() { - return nil - } - return *page.pslr.Value -} - -// Creates a new instance of the PatchScheduleListResultPage type. -func NewPatchScheduleListResultPage(cur PatchScheduleListResult, getNextPage func(context.Context, PatchScheduleListResult) (PatchScheduleListResult, error)) PatchScheduleListResultPage { - return PatchScheduleListResultPage{ - fn: getNextPage, - pslr: cur, - } -} - -// PrivateEndpoint the Private Endpoint resource. -type PrivateEndpoint struct { - // ID - READ-ONLY; The ARM identifier for Private Endpoint - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpoint. -func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection the Private Endpoint Connection resource. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult list of private endpoint connection associated with the specified -// storage account -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of the PrivateEndpointConnectProperties. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The resource of private end point. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - The provisioning state of the private endpoint connection resource. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' - ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionsPutFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsPutFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsPutFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsPutFuture.Result. -func (future *PrivateEndpointConnectionsPutFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PrivateEndpointConnectionsPutFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redis.PrivateEndpointConnectionsPutFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.PutResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PrivateEndpointConnectionsPutFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.PrivateLinkResourceProperties != nil { - objectMap["properties"] = plr.PrivateLinkResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. -func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - The private link resource Private link DNS zone name. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plrp.RequiredZoneNames != nil { - objectMap["requiredZoneNames"] = plrp.RequiredZoneNames - } - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionState a collection of information about the state of the connection between -// service consumer and provider. -type PrivateLinkServiceConnectionState struct { - // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'PrivateEndpointServiceConnectionStatusPending', 'PrivateEndpointServiceConnectionStatusApproved', 'PrivateEndpointServiceConnectionStatusRejected' - Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` - // Description - The reason for approval/rejection of the connection. - Description *string `json:"description,omitempty"` - // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// Properties properties of the redis cache. -type Properties struct { - // ProvisioningState - READ-ONLY; Redis instance provisioning status. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateDisabled', 'ProvisioningStateFailed', 'ProvisioningStateLinking', 'ProvisioningStateProvisioning', 'ProvisioningStateRecoveringScaleFailure', 'ProvisioningStateScaling', 'ProvisioningStateSucceeded', 'ProvisioningStateUnlinking', 'ProvisioningStateUnprovisioning', 'ProvisioningStateUpdating' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // HostName - READ-ONLY; Redis host name. - HostName *string `json:"hostName,omitempty"` - // Port - READ-ONLY; Redis non-SSL port. - Port *int32 `json:"port,omitempty"` - // SslPort - READ-ONLY; Redis SSL port. - SslPort *int32 `json:"sslPort,omitempty"` - // AccessKeys - READ-ONLY; The keys of the Redis cache - not set if this object is not the response to Create or Update redis cache - AccessKeys *AccessKeys `json:"accessKeys,omitempty"` - // LinkedServers - READ-ONLY; List of the linked servers associated with the cache - LinkedServers *[]LinkedServer `json:"linkedServers,omitempty"` - // Instances - READ-ONLY; List of the Redis instances associated with the cache - Instances *[]InstanceDetails `json:"instances,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connection associated with the specified redis cache - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // Sku - The SKU of the Redis cache to deploy. - Sku *Sku `json:"sku,omitempty"` - // SubnetID - The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 - SubnetID *string `json:"subnetId,omitempty"` - // StaticIP - Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. - StaticIP *string `json:"staticIP,omitempty"` - // RedisConfiguration - All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. - RedisConfiguration *CommonPropertiesRedisConfiguration `json:"redisConfiguration,omitempty"` - // RedisVersion - Redis version. Only major version will be used in PUT/PATCH request with current valid values: (4, 6) - RedisVersion *string `json:"redisVersion,omitempty"` - // EnableNonSslPort - Specifies whether the non-ssl Redis server port (6379) is enabled. - EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` - // ReplicasPerMaster - The number of replicas to be created per primary. - ReplicasPerMaster *int32 `json:"replicasPerMaster,omitempty"` - // ReplicasPerPrimary - The number of replicas to be created per primary. - ReplicasPerPrimary *int32 `json:"replicasPerPrimary,omitempty"` - // TenantSettings - A dictionary of tenant settings - TenantSettings map[string]*string `json:"tenantSettings"` - // ShardCount - The number of shards to be created on a Premium Cluster Cache. - ShardCount *int32 `json:"shardCount,omitempty"` - // MinimumTLSVersion - Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: 'TLSVersionOneFullStopZero', 'TLSVersionOneFullStopOne', 'TLSVersionOneFullStopTwo' - MinimumTLSVersion TLSVersion `json:"minimumTlsVersion,omitempty"` - // PublicNetworkAccess - Whether or not public endpoint access is allowed for this cache. 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'. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for Properties. -func (p Properties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if p.Sku != nil { - objectMap["sku"] = p.Sku - } - if p.SubnetID != nil { - objectMap["subnetId"] = p.SubnetID - } - if p.StaticIP != nil { - objectMap["staticIP"] = p.StaticIP - } - if p.RedisConfiguration != nil { - objectMap["redisConfiguration"] = p.RedisConfiguration - } - if p.RedisVersion != nil { - objectMap["redisVersion"] = p.RedisVersion - } - if p.EnableNonSslPort != nil { - objectMap["enableNonSslPort"] = p.EnableNonSslPort - } - if p.ReplicasPerMaster != nil { - objectMap["replicasPerMaster"] = p.ReplicasPerMaster - } - if p.ReplicasPerPrimary != nil { - objectMap["replicasPerPrimary"] = p.ReplicasPerPrimary - } - if p.TenantSettings != nil { - objectMap["tenantSettings"] = p.TenantSettings - } - if p.ShardCount != nil { - objectMap["shardCount"] = p.ShardCount - } - if p.MinimumTLSVersion != "" { - objectMap["minimumTlsVersion"] = p.MinimumTLSVersion - } - if p.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = p.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RebootParameters specifies which Redis node(s) to reboot. -type RebootParameters struct { - // RebootType - Which Redis node(s) to reboot. Depending on this value data loss is possible. Possible values include: 'RebootTypePrimaryNode', 'RebootTypeSecondaryNode', 'RebootTypeAllNodes' - RebootType RebootType `json:"rebootType,omitempty"` - // ShardID - If clustering is enabled, the ID of the shard to be rebooted. - ShardID *int32 `json:"shardId,omitempty"` - // Ports - A list of redis instances to reboot, specified by per-instance SSL ports or non-SSL ports. - Ports *[]int32 `json:"ports,omitempty"` -} - -// RegenerateKeyParameters specifies which Redis access keys to reset. -type RegenerateKeyParameters struct { - // KeyType - The Redis access key to regenerate. Possible values include: 'KeyTypePrimary', 'KeyTypeSecondary' - KeyType KeyType `json:"keyType,omitempty"` -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceType a single Redis item in List or Get Operation. -type ResourceType struct { - autorest.Response `json:"-"` - // Properties - Redis cache properties. - *Properties `json:"properties,omitempty"` - // Zones - A list of availability zones denoting where the resource needs to come from. - Zones *[]string `json:"zones,omitempty"` - // Identity - The identity of the resource. - Identity *ManagedServiceIdentity `json:"identity,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceType. -func (rt ResourceType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rt.Properties != nil { - objectMap["properties"] = rt.Properties - } - if rt.Zones != nil { - objectMap["zones"] = rt.Zones - } - if rt.Identity != nil { - objectMap["identity"] = rt.Identity - } - if rt.Tags != nil { - objectMap["tags"] = rt.Tags - } - if rt.Location != nil { - objectMap["location"] = rt.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ResourceType struct. -func (rt *ResourceType) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var properties Properties - err = json.Unmarshal(*v, &properties) - if err != nil { - return err - } - rt.Properties = &properties - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - rt.Zones = &zones - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - rt.Identity = &identity - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rt.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rt.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rt.Type = &typeVar - } - } - } - - return nil -} - -// ScheduleEntries list of patch schedules for a Redis cache. -type ScheduleEntries struct { - // ScheduleEntries - List of patch schedules for a Redis cache. - ScheduleEntries *[]ScheduleEntry `json:"scheduleEntries,omitempty"` -} - -// ScheduleEntry patch schedule entry for a Premium Redis Cache. -type ScheduleEntry struct { - // DayOfWeek - Day of the week when a cache can be patched. Possible values include: 'DayOfWeekMonday', 'DayOfWeekTuesday', 'DayOfWeekWednesday', 'DayOfWeekThursday', 'DayOfWeekFriday', 'DayOfWeekSaturday', 'DayOfWeekSunday', 'DayOfWeekEveryday', 'DayOfWeekWeekend' - DayOfWeek DayOfWeek `json:"dayOfWeek,omitempty"` - // StartHourUtc - Start hour after which cache patching can start. - StartHourUtc *int32 `json:"startHourUtc,omitempty"` - // MaintenanceWindow - ISO8601 timespan specifying how much time cache patching can take. - MaintenanceWindow *string `json:"maintenanceWindow,omitempty"` -} - -// Sku SKU parameters supplied to the create Redis operation. -type Sku struct { - // Name - The type of Redis cache to deploy. Valid values: (Basic, Standard, Premium). Possible values include: 'SkuNameBasic', 'SkuNameStandard', 'SkuNamePremium' - Name SkuName `json:"name,omitempty"` - // Family - The SKU family to use. Valid values: (C, P). (C = Basic/Standard, P = Premium). Possible values include: 'SkuFamilyC', 'SkuFamilyP' - Family SkuFamily `json:"family,omitempty"` - // Capacity - The size of the Redis cache to deploy. Valid values: for C (Basic/Standard) family (0, 1, 2, 3, 4, 5, 6), for P (Premium) family (1, 2, 3, 4). - Capacity *int32 `json:"capacity,omitempty"` -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// UpdateParameters parameters supplied to the Update Redis operation. -type UpdateParameters struct { - // UpdateProperties - Redis cache properties. - *UpdateProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Identity - The identity of the resource. - Identity *ManagedServiceIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for UpdateParameters. -func (up UpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if up.UpdateProperties != nil { - objectMap["properties"] = up.UpdateProperties - } - if up.Tags != nil { - objectMap["tags"] = up.Tags - } - if up.Identity != nil { - objectMap["identity"] = up.Identity - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UpdateParameters struct. -func (up *UpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var updateProperties UpdateProperties - err = json.Unmarshal(*v, &updateProperties) - if err != nil { - return err - } - up.UpdateProperties = &updateProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - up.Tags = tags - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - up.Identity = &identity - } - } - } - - return nil -} - -// UpdateProperties patchable properties of the redis cache. -type UpdateProperties struct { - // Sku - The SKU of the Redis cache to deploy. - Sku *Sku `json:"sku,omitempty"` - // RedisConfiguration - All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. - RedisConfiguration *CommonPropertiesRedisConfiguration `json:"redisConfiguration,omitempty"` - // RedisVersion - Redis version. Only major version will be used in PUT/PATCH request with current valid values: (4, 6) - RedisVersion *string `json:"redisVersion,omitempty"` - // EnableNonSslPort - Specifies whether the non-ssl Redis server port (6379) is enabled. - EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` - // ReplicasPerMaster - The number of replicas to be created per primary. - ReplicasPerMaster *int32 `json:"replicasPerMaster,omitempty"` - // ReplicasPerPrimary - The number of replicas to be created per primary. - ReplicasPerPrimary *int32 `json:"replicasPerPrimary,omitempty"` - // TenantSettings - A dictionary of tenant settings - TenantSettings map[string]*string `json:"tenantSettings"` - // ShardCount - The number of shards to be created on a Premium Cluster Cache. - ShardCount *int32 `json:"shardCount,omitempty"` - // MinimumTLSVersion - Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible values include: 'TLSVersionOneFullStopZero', 'TLSVersionOneFullStopOne', 'TLSVersionOneFullStopTwo' - MinimumTLSVersion TLSVersion `json:"minimumTlsVersion,omitempty"` - // PublicNetworkAccess - Whether or not public endpoint access is allowed for this cache. 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'. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for UpdateProperties. -func (up UpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if up.Sku != nil { - objectMap["sku"] = up.Sku - } - if up.RedisConfiguration != nil { - objectMap["redisConfiguration"] = up.RedisConfiguration - } - if up.RedisVersion != nil { - objectMap["redisVersion"] = up.RedisVersion - } - if up.EnableNonSslPort != nil { - objectMap["enableNonSslPort"] = up.EnableNonSslPort - } - if up.ReplicasPerMaster != nil { - objectMap["replicasPerMaster"] = up.ReplicasPerMaster - } - if up.ReplicasPerPrimary != nil { - objectMap["replicasPerPrimary"] = up.ReplicasPerPrimary - } - if up.TenantSettings != nil { - objectMap["tenantSettings"] = up.TenantSettings - } - if up.ShardCount != nil { - objectMap["shardCount"] = up.ShardCount - } - if up.MinimumTLSVersion != "" { - objectMap["minimumTlsVersion"] = up.MinimumTLSVersion - } - if up.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = up.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// UpgradeNotification properties of upgrade notification. -type UpgradeNotification struct { - // Name - READ-ONLY; Name of upgrade notification. - Name *string `json:"name,omitempty"` - // Timestamp - READ-ONLY; Timestamp when upgrade notification occurred. - Timestamp *date.Time `json:"timestamp,omitempty"` - // UpsellNotification - READ-ONLY; Details about this upgrade notification - UpsellNotification map[string]*string `json:"upsellNotification"` -} - -// MarshalJSON is the custom marshaler for UpgradeNotification. -func (un UpgradeNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UserAssignedIdentity user assigned identity properties -type UserAssignedIdentity struct { - // PrincipalID - READ-ONLY; The principal ID of the assigned identity. - PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // ClientID - READ-ONLY; The client ID of the assigned identity. - ClientID *uuid.UUID `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserAssignedIdentity. -func (uai UserAssignedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/operations.go deleted file mode 100644 index 88d4ffb36f83..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package redis - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the REST API for Azure Redis Cache Service. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available REST API operations of the Microsoft.Cache provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Cache/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "redis.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "redis.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/patchschedules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/patchschedules.go deleted file mode 100644 index 54df76cf8309..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/patchschedules.go +++ /dev/null @@ -1,391 +0,0 @@ -package redis - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PatchSchedulesClient is the REST API for Azure Redis Cache Service. -type PatchSchedulesClient struct { - BaseClient -} - -// NewPatchSchedulesClient creates an instance of the PatchSchedulesClient client. -func NewPatchSchedulesClient(subscriptionID string) PatchSchedulesClient { - return NewPatchSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPatchSchedulesClientWithBaseURI creates an instance of the PatchSchedulesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewPatchSchedulesClientWithBaseURI(baseURI string, subscriptionID string) PatchSchedulesClient { - return PatchSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace the patching schedule for Redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the Redis cache. -// parameters - parameters to set the patching schedule for Redis cache. -func (client PatchSchedulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters PatchSchedule) (result PatchSchedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PatchSchedulesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ScheduleEntries", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ScheduleEntries.ScheduleEntries", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("redis.PatchSchedulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PatchSchedulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, parameters PatchSchedule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "default": autorest.Encode("path", "default"), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Location = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PatchSchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PatchSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result PatchSchedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the patching schedule of a redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the redis cache. -func (client PatchSchedulesClient) Delete(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PatchSchedulesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PatchSchedulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "default": autorest.Encode("path", "default"), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PatchSchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PatchSchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the patching schedule of a redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the redis cache. -func (client PatchSchedulesClient) Get(ctx context.Context, resourceGroupName string, name string) (result PatchSchedule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PatchSchedulesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PatchSchedulesClient) GetPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "default": autorest.Encode("path", "default"), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PatchSchedulesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PatchSchedulesClient) GetResponder(resp *http.Response) (result PatchSchedule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByRedisResource gets all patch schedules in the specified redis cache (there is only one). -// Parameters: -// resourceGroupName - the name of the resource group. -// cacheName - the name of the Redis cache. -func (client PatchSchedulesClient) ListByRedisResource(ctx context.Context, resourceGroupName string, cacheName string) (result PatchScheduleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PatchSchedulesClient.ListByRedisResource") - defer func() { - sc := -1 - if result.pslr.Response.Response != nil { - sc = result.pslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByRedisResourceNextResults - req, err := client.ListByRedisResourcePreparer(ctx, resourceGroupName, cacheName) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "ListByRedisResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListByRedisResourceSender(req) - if err != nil { - result.pslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "ListByRedisResource", resp, "Failure sending request") - return - } - - result.pslr, err = client.ListByRedisResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "ListByRedisResource", resp, "Failure responding to request") - return - } - if result.pslr.hasNextLink() && result.pslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByRedisResourcePreparer prepares the ListByRedisResource request. -func (client PatchSchedulesClient) ListByRedisResourcePreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheName": autorest.Encode("path", cacheName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/patchSchedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByRedisResourceSender sends the ListByRedisResource request. The method will close the -// http.Response Body if it receives an error. -func (client PatchSchedulesClient) ListByRedisResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByRedisResourceResponder handles the response to the ListByRedisResource request. The method always -// closes the http.Response Body. -func (client PatchSchedulesClient) ListByRedisResourceResponder(resp *http.Response) (result PatchScheduleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByRedisResourceNextResults retrieves the next set of results, if any. -func (client PatchSchedulesClient) listByRedisResourceNextResults(ctx context.Context, lastResults PatchScheduleListResult) (result PatchScheduleListResult, err error) { - req, err := lastResults.patchScheduleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "listByRedisResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByRedisResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "listByRedisResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByRedisResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "listByRedisResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByRedisResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client PatchSchedulesClient) ListByRedisResourceComplete(ctx context.Context, resourceGroupName string, cacheName string) (result PatchScheduleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PatchSchedulesClient.ListByRedisResource") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByRedisResource(ctx, resourceGroupName, cacheName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/privateendpointconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/privateendpointconnections.go deleted file mode 100644 index 3c6cf1aa7ade..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/privateendpointconnections.go +++ /dev/null @@ -1,358 +0,0 @@ -package redis - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionsClient is the REST API for Azure Redis Cache Service. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete deletes the specified private endpoint connection associated with the redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// cacheName - the name of the Redis cache. -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, cacheName string, privateEndpointConnectionName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, cacheName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "redis.PrivateEndpointConnectionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PrivateEndpointConnectionsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, cacheName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheName": autorest.Encode("path", cacheName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified private endpoint connection associated with the redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// cacheName - the name of the Redis cache. -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, cacheName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, cacheName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, cacheName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheName": autorest.Encode("path", cacheName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all the private endpoint connections associated with the redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// cacheName - the name of the Redis cache. -func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, cacheName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, cacheName) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheName": autorest.Encode("path", cacheName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Put update the state of specified private endpoint connection associated with the redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// cacheName - the name of the Redis cache. -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -// properties - the private endpoint connection properties. -func (client PrivateEndpointConnectionsClient) Put(ctx context.Context, resourceGroupName string, cacheName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (result PrivateEndpointConnectionsPutFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Put") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: properties, - Constraints: []validation.Constraint{{Target: "properties.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "properties.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("redis.PrivateEndpointConnectionsClient", "Put", err.Error()) - } - - req, err := client.PutPreparer(ctx, resourceGroupName, cacheName, privateEndpointConnectionName, properties) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PrivateEndpointConnectionsClient", "Put", nil, "Failure preparing request") - return - } - - result, err = client.PutSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PrivateEndpointConnectionsClient", "Put", result.Response(), "Failure sending request") - return - } - - return -} - -// PutPreparer prepares the Put request. -func (client PrivateEndpointConnectionsClient) PutPreparer(ctx context.Context, resourceGroupName string, cacheName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheName": autorest.Encode("path", cacheName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(properties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PutSender sends the Put request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) PutSender(req *http.Request) (future PrivateEndpointConnectionsPutFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// PutResponder handles the response to the Put request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) PutResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/privatelinkresources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/privatelinkresources.go deleted file mode 100644 index 7a91fc392b71..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/privatelinkresources.go +++ /dev/null @@ -1,108 +0,0 @@ -package redis - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the REST API for Azure Redis Cache Service. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByRedisCache gets the private link resources that need to be created for a redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// cacheName - the name of the Redis cache. -func (client PrivateLinkResourcesClient) ListByRedisCache(ctx context.Context, resourceGroupName string, cacheName string) (result PrivateLinkResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByRedisCache") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByRedisCachePreparer(ctx, resourceGroupName, cacheName) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PrivateLinkResourcesClient", "ListByRedisCache", nil, "Failure preparing request") - return - } - - resp, err := client.ListByRedisCacheSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.PrivateLinkResourcesClient", "ListByRedisCache", resp, "Failure sending request") - return - } - - result, err = client.ListByRedisCacheResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PrivateLinkResourcesClient", "ListByRedisCache", resp, "Failure responding to request") - return - } - - return -} - -// ListByRedisCachePreparer prepares the ListByRedisCache request. -func (client PrivateLinkResourcesClient) ListByRedisCachePreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheName": autorest.Encode("path", cacheName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByRedisCacheSender sends the ListByRedisCache request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByRedisCacheSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByRedisCacheResponder handles the response to the ListByRedisCache request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByRedisCacheResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/redis.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/redis.go deleted file mode 100644 index 8c3884d92c6e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/redis.go +++ /dev/null @@ -1,1202 +0,0 @@ -package redis - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// Client is the REST API for Azure Redis Cache Service. -type Client struct { - BaseClient -} - -// NewClient creates an instance of the Client client. -func NewClient(subscriptionID string) Client { - return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting -// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { - return Client{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks that the redis cache name is valid and is not already in use. -// Parameters: -// parameters - parameters supplied to the CheckNameAvailability Redis operation. The only supported resource -// type is 'Microsoft.Cache/redis' -func (client Client) CheckNameAvailability(ctx context.Context, parameters CheckNameAvailabilityParameters) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("redis.Client", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "redis.Client", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client Client) CheckNameAvailabilityPreparer(ctx context.Context, parameters CheckNameAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client Client) CheckNameAvailabilityResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Create create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the Redis cache. -// parameters - parameters supplied to the Create Redis operation. -func (client Client) Create(ctx context.Context, resourceGroupName string, name string, parameters CreateParameters) (result CreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.CreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CreateProperties.Sku", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CreateProperties.Sku.Capacity", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.CreateProperties.SubnetID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CreateProperties.SubnetID", Name: validation.Pattern, Rule: `^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$`, Chain: nil}}}, - {Target: "parameters.CreateProperties.StaticIP", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CreateProperties.StaticIP", Name: validation.Pattern, Rule: `^\d+\.\d+\.\d+\.\d+$`, Chain: nil}}}, - }}, - {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("redis.Client", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client Client) CreatePreparer(ctx context.Context, resourceGroupName string, name string, parameters CreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CreateSender(req *http.Request) (future CreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client Client) CreateResponder(resp *http.Response) (result ResourceType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a Redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the Redis cache. -func (client Client) Delete(ctx context.Context, resourceGroupName string, name string) (result DeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client Client) DeletePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client Client) DeleteSender(req *http.Request) (future DeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ExportData export data from the redis cache to blobs in a container. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the Redis cache. -// parameters - parameters for Redis export operation. -func (client Client) ExportData(ctx context.Context, resourceGroupName string, name string, parameters ExportRDBParameters) (result ExportDataFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ExportData") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Prefix", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Container", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("redis.Client", "ExportData", err.Error()) - } - - req, err := client.ExportDataPreparer(ctx, resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "ExportData", nil, "Failure preparing request") - return - } - - result, err = client.ExportDataSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "ExportData", result.Response(), "Failure sending request") - return - } - - return -} - -// ExportDataPreparer prepares the ExportData request. -func (client Client) ExportDataPreparer(ctx context.Context, resourceGroupName string, name string, parameters ExportRDBParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExportDataSender sends the ExportData request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ExportDataSender(req *http.Request) (future ExportDataFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ExportDataResponder handles the response to the ExportData request. The method always -// closes the http.Response Body. -func (client Client) ExportDataResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ForceReboot reboot specified Redis node(s). This operation requires write permission to the cache resource. There -// can be potential data loss. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the Redis cache. -// parameters - specifies which Redis node(s) to reboot. -func (client Client) ForceReboot(ctx context.Context, resourceGroupName string, name string, parameters RebootParameters) (result ForceRebootResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ForceReboot") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ForceRebootPreparer(ctx, resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "ForceReboot", nil, "Failure preparing request") - return - } - - resp, err := client.ForceRebootSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.Client", "ForceReboot", resp, "Failure sending request") - return - } - - result, err = client.ForceRebootResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "ForceReboot", resp, "Failure responding to request") - return - } - - return -} - -// ForceRebootPreparer prepares the ForceReboot request. -func (client Client) ForceRebootPreparer(ctx context.Context, resourceGroupName string, name string, parameters RebootParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ForceRebootSender sends the ForceReboot request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ForceRebootSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ForceRebootResponder handles the response to the ForceReboot request. The method always -// closes the http.Response Body. -func (client Client) ForceRebootResponder(resp *http.Response) (result ForceRebootResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a Redis cache (resource description). -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the Redis cache. -func (client Client) Get(ctx context.Context, resourceGroupName string, name string) (result ResourceType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.Client", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client Client) GetPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client Client) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client Client) GetResponder(resp *http.Response) (result ResourceType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ImportData import data into Redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the Redis cache. -// parameters - parameters for Redis import operation. -func (client Client) ImportData(ctx context.Context, resourceGroupName string, name string, parameters ImportRDBParameters) (result ImportDataFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ImportData") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Files", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("redis.Client", "ImportData", err.Error()) - } - - req, err := client.ImportDataPreparer(ctx, resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "ImportData", nil, "Failure preparing request") - return - } - - result, err = client.ImportDataSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "ImportData", result.Response(), "Failure sending request") - return - } - - return -} - -// ImportDataPreparer prepares the ImportData request. -func (client Client) ImportDataPreparer(ctx context.Context, resourceGroupName string, name string, parameters ImportRDBParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ImportDataSender sends the ImportData request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ImportDataSender(req *http.Request) (future ImportDataFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ImportDataResponder handles the response to the ImportData request. The method always -// closes the http.Response Body. -func (client Client) ImportDataResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByResourceGroup lists all Redis caches in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client Client) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") - defer func() { - sc := -1 - if result.lr.Response.Response != nil { - sc = result.lr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.lr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.Client", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.lr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.lr.hasNextLink() && result.lr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client Client) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client Client) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client Client) listByResourceGroupNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.listResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "redis.Client", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "redis.Client", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client Client) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription gets all Redis caches in the specified subscription. -func (client Client) ListBySubscription(ctx context.Context) (result ListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListBySubscription") - defer func() { - sc := -1 - if result.lr.Response.Response != nil { - sc = result.lr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.lr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.Client", "ListBySubscription", resp, "Failure sending request") - return - } - - result.lr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.lr.hasNextLink() && result.lr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client Client) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client Client) ListBySubscriptionResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client Client) listBySubscriptionNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.listResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "redis.Client", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "redis.Client", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client Client) ListBySubscriptionComplete(ctx context.Context) (result ListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// ListKeys retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the Redis cache. -func (client Client) ListKeys(ctx context.Context, resourceGroupName string, name string) (result AccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListKeysPreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.Client", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client Client) ListKeysPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client Client) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUpgradeNotifications gets any upgrade notifications for a Redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the Redis cache. -// history - how many minutes in past to look for upgrade notifications -func (client Client) ListUpgradeNotifications(ctx context.Context, resourceGroupName string, name string, history float64) (result NotificationListResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListUpgradeNotifications") - defer func() { - sc := -1 - if result.nlr.Response.Response != nil { - sc = result.nlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listUpgradeNotificationsNextResults - req, err := client.ListUpgradeNotificationsPreparer(ctx, resourceGroupName, name, history) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "ListUpgradeNotifications", nil, "Failure preparing request") - return - } - - resp, err := client.ListUpgradeNotificationsSender(req) - if err != nil { - result.nlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.Client", "ListUpgradeNotifications", resp, "Failure sending request") - return - } - - result.nlr, err = client.ListUpgradeNotificationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "ListUpgradeNotifications", resp, "Failure responding to request") - return - } - if result.nlr.hasNextLink() && result.nlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListUpgradeNotificationsPreparer prepares the ListUpgradeNotifications request. -func (client Client) ListUpgradeNotificationsPreparer(ctx context.Context, resourceGroupName string, name string, history float64) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "history": autorest.Encode("query", history), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listUpgradeNotifications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUpgradeNotificationsSender sends the ListUpgradeNotifications request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListUpgradeNotificationsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUpgradeNotificationsResponder handles the response to the ListUpgradeNotifications request. The method always -// closes the http.Response Body. -func (client Client) ListUpgradeNotificationsResponder(resp *http.Response) (result NotificationListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listUpgradeNotificationsNextResults retrieves the next set of results, if any. -func (client Client) listUpgradeNotificationsNextResults(ctx context.Context, lastResults NotificationListResponse) (result NotificationListResponse, err error) { - req, err := lastResults.notificationListResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "redis.Client", "listUpgradeNotificationsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListUpgradeNotificationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "redis.Client", "listUpgradeNotificationsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListUpgradeNotificationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "listUpgradeNotificationsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListUpgradeNotificationsComplete enumerates all values, automatically crossing page boundaries as required. -func (client Client) ListUpgradeNotificationsComplete(ctx context.Context, resourceGroupName string, name string, history float64) (result NotificationListResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListUpgradeNotifications") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListUpgradeNotifications(ctx, resourceGroupName, name, history) - return -} - -// RegenerateKey regenerate Redis cache's access keys. This operation requires write permission to the cache resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the Redis cache. -// parameters - specifies which key to regenerate. -func (client Client) RegenerateKey(ctx context.Context, resourceGroupName string, name string, parameters RegenerateKeyParameters) (result AccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.RegenerateKey") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.Client", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client Client) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, name string, parameters RegenerateKeyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/regenerateKey", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateKeySender sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client Client) RegenerateKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client Client) RegenerateKeyResponder(resp *http.Response) (result AccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update an existing Redis cache. -// Parameters: -// resourceGroupName - the name of the resource group. -// name - the name of the Redis cache. -// parameters - parameters supplied to the Update Redis operation. -func (client Client) Update(ctx context.Context, resourceGroupName string, name string, parameters UpdateParameters) (result ResourceType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.Client", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.Client", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client Client) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, parameters UpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client Client) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client Client) UpdateResponder(resp *http.Response) (result ResourceType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/version.go deleted file mode 100644 index 7339da599f1f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package redis - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " redis/2021-06-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/_meta.json deleted file mode 100644 index d5b54bcc924d..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "a1eee0489c374782a934ec1f093abd16fa7718ca", - "readme": "/_/azure-rest-api-specs/specification/redisenterprise/resource-manager/readme.md", - "tag": "package-2021-03", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/redisenterprise/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/client.go deleted file mode 100644 index be2c54cce853..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redisenterprise/armredisenterprise](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redisenterprise/armredisenterprise). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package redisenterprise implements the Azure ARM Redisenterprise service API version 2021-03-01. -// -// REST API for managing Redis Enterprise resources in Azure. -package redisenterprise - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Redisenterprise - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Redisenterprise. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/databases.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/databases.go deleted file mode 100644 index 7d325fd0167c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/databases.go +++ /dev/null @@ -1,898 +0,0 @@ -package redisenterprise - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DatabasesClient is the REST API for managing Redis Enterprise resources in Azure. -type DatabasesClient struct { - BaseClient -} - -// NewDatabasesClient creates an instance of the DatabasesClient client. -func NewDatabasesClient(subscriptionID string) DatabasesClient { - return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { - return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -// databaseName - the name of the database. -// parameters - parameters supplied to the create or update database operation. -func (client DatabasesClient) Create(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters Database) (result DatabasesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.DatabasesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, clusterName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client DatabasesClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters Database) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) CreateSender(req *http.Request) (future DatabasesCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client DatabasesClient) CreateResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a single database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -// databaseName - the name of the database. -func (client DatabasesClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result DatabasesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.DatabasesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) DeleteSender(req *http.Request) (future DatabasesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Export exports a database file from target database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -// databaseName - the name of the database. -// parameters - storage information for exporting into the cluster -func (client DatabasesClient) Export(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ExportClusterParameters) (result DatabasesExportFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Export") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SasURI", Name: validation.Null, Rule: true, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.DatabasesClient", "Export", err.Error()) - } - - req, err := client.ExportPreparer(ctx, resourceGroupName, clusterName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "Export", nil, "Failure preparing request") - return - } - - result, err = client.ExportSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "Export", result.Response(), "Failure sending request") - return - } - - return -} - -// ExportPreparer prepares the Export request. -func (client DatabasesClient) ExportPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ExportClusterParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/export", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExportSender sends the Export request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ExportSender(req *http.Request) (future DatabasesExportFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ExportResponder handles the response to the Export request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ExportResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about a database in a RedisEnterprise cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -// databaseName - the name of the database. -func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result Database, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.DatabasesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DatabasesClient) GetResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Import imports a database file to target database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -// databaseName - the name of the database. -// parameters - storage information for importing into the cluster -func (client DatabasesClient) Import(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ImportClusterParameters) (result DatabasesImportFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Import") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SasURI", Name: validation.Null, Rule: true, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.DatabasesClient", "Import", err.Error()) - } - - req, err := client.ImportPreparer(ctx, resourceGroupName, clusterName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "Import", nil, "Failure preparing request") - return - } - - result, err = client.ImportSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "Import", result.Response(), "Failure sending request") - return - } - - return -} - -// ImportPreparer prepares the Import request. -func (client DatabasesClient) ImportPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ImportClusterParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/import", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ImportSender sends the Import request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ImportSender(req *http.Request) (future DatabasesImportFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ImportResponder handles the response to the Import request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ImportResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByCluster gets all databases in the specified RedisEnterprise cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -func (client DatabasesClient) ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result DatabaseListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByCluster") - defer func() { - sc := -1 - if result.dl.Response.Response != nil { - sc = result.dl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.DatabasesClient", "ListByCluster", err.Error()) - } - - result.fn = client.listByClusterNextResults - req, err := client.ListByClusterPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "ListByCluster", nil, "Failure preparing request") - return - } - - resp, err := client.ListByClusterSender(req) - if err != nil { - result.dl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "ListByCluster", resp, "Failure sending request") - return - } - - result.dl, err = client.ListByClusterResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "ListByCluster", resp, "Failure responding to request") - return - } - if result.dl.hasNextLink() && result.dl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByClusterPreparer prepares the ListByCluster request. -func (client DatabasesClient) ListByClusterPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByClusterSender sends the ListByCluster request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListByClusterSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByClusterResponder handles the response to the ListByCluster request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListByClusterResponder(resp *http.Response) (result DatabaseList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByClusterNextResults retrieves the next set of results, if any. -func (client DatabasesClient) listByClusterNextResults(ctx context.Context, lastResults DatabaseList) (result DatabaseList, err error) { - req, err := lastResults.databaseListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "listByClusterNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByClusterSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "listByClusterNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByClusterResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "listByClusterNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByClusterComplete enumerates all values, automatically crossing page boundaries as required. -func (client DatabasesClient) ListByClusterComplete(ctx context.Context, resourceGroupName string, clusterName string) (result DatabaseListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByCluster") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByCluster(ctx, resourceGroupName, clusterName) - return -} - -// ListKeys retrieves the access keys for the RedisEnterprise database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -// databaseName - the name of the database. -func (client DatabasesClient) ListKeys(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result AccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.DatabasesClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, clusterName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client DatabasesClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerates the RedisEnterprise database's access keys. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -// databaseName - the name of the database. -// parameters - specifies which key to regenerate. -func (client DatabasesClient) RegenerateKey(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters RegenerateKeyParameters) (result DatabasesRegenerateKeyFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.RegenerateKey") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.DatabasesClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, clusterName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - result, err = client.RegenerateKeySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "RegenerateKey", result.Response(), "Failure sending request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client DatabasesClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters RegenerateKeyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/regenerateKey", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateKeySender sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) RegenerateKeySender(req *http.Request) (future DatabasesRegenerateKeyFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client DatabasesClient) RegenerateKeyResponder(resp *http.Response) (result AccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a database -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -// databaseName - the name of the database. -// parameters - parameters supplied to the create or update database operation. -func (client DatabasesClient) Update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseUpdate) (result DatabasesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.DatabasesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) UpdateSender(req *http.Request) (future DatabasesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client DatabasesClient) UpdateResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/enums.go deleted file mode 100644 index 0f6cf2419a25..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/enums.go +++ /dev/null @@ -1,278 +0,0 @@ -package redisenterprise - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AccessKeyType enumerates the values for access key type. -type AccessKeyType string - -const ( - // Primary ... - Primary AccessKeyType = "Primary" - // Secondary ... - Secondary AccessKeyType = "Secondary" -) - -// PossibleAccessKeyTypeValues returns an array of possible values for the AccessKeyType const type. -func PossibleAccessKeyTypeValues() []AccessKeyType { - return []AccessKeyType{Primary, Secondary} -} - -// ActionType enumerates the values for action type. -type ActionType string - -const ( - // Internal ... - Internal ActionType = "Internal" -) - -// PossibleActionTypeValues returns an array of possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{Internal} -} - -// AofFrequency enumerates the values for aof frequency. -type AofFrequency string - -const ( - // Always ... - Always AofFrequency = "always" - // Ones ... - Ones AofFrequency = "1s" -) - -// PossibleAofFrequencyValues returns an array of possible values for the AofFrequency const type. -func PossibleAofFrequencyValues() []AofFrequency { - return []AofFrequency{Always, Ones} -} - -// ClusteringPolicy enumerates the values for clustering policy. -type ClusteringPolicy string - -const ( - // EnterpriseCluster ... - EnterpriseCluster ClusteringPolicy = "EnterpriseCluster" - // OSSCluster ... - OSSCluster ClusteringPolicy = "OSSCluster" -) - -// PossibleClusteringPolicyValues returns an array of possible values for the ClusteringPolicy const type. -func PossibleClusteringPolicyValues() []ClusteringPolicy { - return []ClusteringPolicy{EnterpriseCluster, OSSCluster} -} - -// EvictionPolicy enumerates the values for eviction policy. -type EvictionPolicy string - -const ( - // AllKeysLFU ... - AllKeysLFU EvictionPolicy = "AllKeysLFU" - // AllKeysLRU ... - AllKeysLRU EvictionPolicy = "AllKeysLRU" - // AllKeysRandom ... - AllKeysRandom EvictionPolicy = "AllKeysRandom" - // NoEviction ... - NoEviction EvictionPolicy = "NoEviction" - // VolatileLFU ... - VolatileLFU EvictionPolicy = "VolatileLFU" - // VolatileLRU ... - VolatileLRU EvictionPolicy = "VolatileLRU" - // VolatileRandom ... - VolatileRandom EvictionPolicy = "VolatileRandom" - // VolatileTTL ... - VolatileTTL EvictionPolicy = "VolatileTTL" -) - -// PossibleEvictionPolicyValues returns an array of possible values for the EvictionPolicy const type. -func PossibleEvictionPolicyValues() []EvictionPolicy { - return []EvictionPolicy{AllKeysLFU, AllKeysLRU, AllKeysRandom, NoEviction, VolatileLFU, VolatileLRU, VolatileRandom, VolatileTTL} -} - -// Origin enumerates the values for origin. -type Origin string - -const ( - // System ... - System Origin = "system" - // User ... - User Origin = "user" - // Usersystem ... - Usersystem Origin = "user,system" -) - -// PossibleOriginValues returns an array of possible values for the Origin const type. -func PossibleOriginValues() []Origin { - return []Origin{System, User, Usersystem} -} - -// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection -// provisioning state. -type PrivateEndpointConnectionProvisioningState string - -const ( - // Creating ... - Creating PrivateEndpointConnectionProvisioningState = "Creating" - // Deleting ... - Deleting PrivateEndpointConnectionProvisioningState = "Deleting" - // Failed ... - Failed PrivateEndpointConnectionProvisioningState = "Failed" - // Succeeded ... - Succeeded PrivateEndpointConnectionProvisioningState = "Succeeded" -) - -// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. -func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { - return []PrivateEndpointConnectionProvisioningState{Creating, Deleting, Failed, Succeeded} -} - -// PrivateEndpointServiceConnectionStatus enumerates the values for private endpoint service connection status. -type PrivateEndpointServiceConnectionStatus string - -const ( - // Approved ... - Approved PrivateEndpointServiceConnectionStatus = "Approved" - // Pending ... - Pending PrivateEndpointServiceConnectionStatus = "Pending" - // Rejected ... - Rejected PrivateEndpointServiceConnectionStatus = "Rejected" -) - -// PossiblePrivateEndpointServiceConnectionStatusValues returns an array of possible values for the PrivateEndpointServiceConnectionStatus const type. -func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { - return []PrivateEndpointServiceConnectionStatus{Approved, Pending, Rejected} -} - -// Protocol enumerates the values for protocol. -type Protocol string - -const ( - // Encrypted ... - Encrypted Protocol = "Encrypted" - // Plaintext ... - Plaintext Protocol = "Plaintext" -) - -// PossibleProtocolValues returns an array of possible values for the Protocol const type. -func PossibleProtocolValues() []Protocol { - return []Protocol{Encrypted, Plaintext} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCanceled ... - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateCreating ... - ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating ... - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} -} - -// RdbFrequency enumerates the values for rdb frequency. -type RdbFrequency string - -const ( - // Oneh ... - Oneh RdbFrequency = "1h" - // OneTwoh ... - OneTwoh RdbFrequency = "12h" - // Sixh ... - Sixh RdbFrequency = "6h" -) - -// PossibleRdbFrequencyValues returns an array of possible values for the RdbFrequency const type. -func PossibleRdbFrequencyValues() []RdbFrequency { - return []RdbFrequency{Oneh, OneTwoh, Sixh} -} - -// ResourceState enumerates the values for resource state. -type ResourceState string - -const ( - // ResourceStateCreateFailed ... - ResourceStateCreateFailed ResourceState = "CreateFailed" - // ResourceStateCreating ... - ResourceStateCreating ResourceState = "Creating" - // ResourceStateDeleteFailed ... - ResourceStateDeleteFailed ResourceState = "DeleteFailed" - // ResourceStateDeleting ... - ResourceStateDeleting ResourceState = "Deleting" - // ResourceStateDisabled ... - ResourceStateDisabled ResourceState = "Disabled" - // ResourceStateDisableFailed ... - ResourceStateDisableFailed ResourceState = "DisableFailed" - // ResourceStateDisabling ... - ResourceStateDisabling ResourceState = "Disabling" - // ResourceStateEnableFailed ... - ResourceStateEnableFailed ResourceState = "EnableFailed" - // ResourceStateEnabling ... - ResourceStateEnabling ResourceState = "Enabling" - // ResourceStateRunning ... - ResourceStateRunning ResourceState = "Running" - // ResourceStateUpdateFailed ... - ResourceStateUpdateFailed ResourceState = "UpdateFailed" - // ResourceStateUpdating ... - ResourceStateUpdating ResourceState = "Updating" -) - -// PossibleResourceStateValues returns an array of possible values for the ResourceState const type. -func PossibleResourceStateValues() []ResourceState { - return []ResourceState{ResourceStateCreateFailed, ResourceStateCreating, ResourceStateDeleteFailed, ResourceStateDeleting, ResourceStateDisabled, ResourceStateDisableFailed, ResourceStateDisabling, ResourceStateEnableFailed, ResourceStateEnabling, ResourceStateRunning, ResourceStateUpdateFailed, ResourceStateUpdating} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // EnterpriseE10 ... - EnterpriseE10 SkuName = "Enterprise_E10" - // EnterpriseE100 ... - EnterpriseE100 SkuName = "Enterprise_E100" - // EnterpriseE20 ... - EnterpriseE20 SkuName = "Enterprise_E20" - // EnterpriseE50 ... - EnterpriseE50 SkuName = "Enterprise_E50" - // EnterpriseFlashF1500 ... - EnterpriseFlashF1500 SkuName = "EnterpriseFlash_F1500" - // EnterpriseFlashF300 ... - EnterpriseFlashF300 SkuName = "EnterpriseFlash_F300" - // EnterpriseFlashF700 ... - EnterpriseFlashF700 SkuName = "EnterpriseFlash_F700" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{EnterpriseE10, EnterpriseE100, EnterpriseE20, EnterpriseE50, EnterpriseFlashF1500, EnterpriseFlashF300, EnterpriseFlashF700} -} - -// TLSVersion enumerates the values for tls version. -type TLSVersion string - -const ( - // OneFullStopOne ... - OneFullStopOne TLSVersion = "1.1" - // OneFullStopTwo ... - OneFullStopTwo TLSVersion = "1.2" - // OneFullStopZero ... - OneFullStopZero TLSVersion = "1.0" -) - -// PossibleTLSVersionValues returns an array of possible values for the TLSVersion const type. -func PossibleTLSVersionValues() []TLSVersion { - return []TLSVersion{OneFullStopOne, OneFullStopTwo, OneFullStopZero} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/models.go deleted file mode 100644 index fb78ec7d1b01..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/models.go +++ /dev/null @@ -1,1768 +0,0 @@ -package redisenterprise - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise" - -// AccessKeys the secret access keys used for authenticating connections to redis -type AccessKeys struct { - autorest.Response `json:"-"` - // PrimaryKey - READ-ONLY; The current primary key that clients can use to authenticate - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - READ-ONLY; The current secondary key that clients can use to authenticate - SecondaryKey *string `json:"secondaryKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccessKeys. -func (ak AccessKeys) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Cluster describes the RedisEnterprise cluster -type Cluster struct { - autorest.Response `json:"-"` - // Sku - The SKU to create, which affects price, performance, and features. - Sku *Sku `json:"sku,omitempty"` - // Zones - The Availability Zones where this cluster will be deployed. - Zones *[]string `json:"zones,omitempty"` - // ClusterProperties - Other properties of the cluster. - *ClusterProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Cluster. -func (c Cluster) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.Sku != nil { - objectMap["sku"] = c.Sku - } - if c.Zones != nil { - objectMap["zones"] = c.Zones - } - if c.ClusterProperties != nil { - objectMap["properties"] = c.ClusterProperties - } - if c.Tags != nil { - objectMap["tags"] = c.Tags - } - if c.Location != nil { - objectMap["location"] = c.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Cluster struct. -func (c *Cluster) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - c.Sku = &sku - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - c.Zones = &zones - } - case "properties": - if v != nil { - var clusterProperties ClusterProperties - err = json.Unmarshal(*v, &clusterProperties) - if err != nil { - return err - } - c.ClusterProperties = &clusterProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - c.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - c.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - c.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - c.Type = &typeVar - } - } - } - - return nil -} - -// ClusterList the response of a list-all operation. -type ClusterList struct { - autorest.Response `json:"-"` - // Value - List of clusters. - Value *[]Cluster `json:"value,omitempty"` - // NextLink - READ-ONLY; The URI to fetch the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterList. -func (cl ClusterList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cl.Value != nil { - objectMap["value"] = cl.Value - } - return json.Marshal(objectMap) -} - -// ClusterListIterator provides access to a complete listing of Cluster values. -type ClusterListIterator struct { - i int - page ClusterListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ClusterListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ClusterListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ClusterListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ClusterListIterator) Response() ClusterList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ClusterListIterator) Value() Cluster { - if !iter.page.NotDone() { - return Cluster{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ClusterListIterator type. -func NewClusterListIterator(page ClusterListPage) ClusterListIterator { - return ClusterListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cl ClusterList) IsEmpty() bool { - return cl.Value == nil || len(*cl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cl ClusterList) hasNextLink() bool { - return cl.NextLink != nil && len(*cl.NextLink) != 0 -} - -// clusterListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cl ClusterList) clusterListPreparer(ctx context.Context) (*http.Request, error) { - if !cl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cl.NextLink))) -} - -// ClusterListPage contains a page of Cluster values. -type ClusterListPage struct { - fn func(context.Context, ClusterList) (ClusterList, error) - cl ClusterList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ClusterListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cl) - if err != nil { - return err - } - page.cl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ClusterListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ClusterListPage) NotDone() bool { - return !page.cl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ClusterListPage) Response() ClusterList { - return page.cl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ClusterListPage) Values() []Cluster { - if page.cl.IsEmpty() { - return nil - } - return *page.cl.Value -} - -// Creates a new instance of the ClusterListPage type. -func NewClusterListPage(cur ClusterList, getNextPage func(context.Context, ClusterList) (ClusterList, error)) ClusterListPage { - return ClusterListPage{ - fn: getNextPage, - cl: cur, - } -} - -// ClusterProperties properties of RedisEnterprise clusters, as opposed to general resource properties like -// location, tags -type ClusterProperties struct { - // MinimumTLSVersion - The minimum TLS version for the cluster to support, e.g. '1.2'. Possible values include: 'OneFullStopZero', 'OneFullStopOne', 'OneFullStopTwo' - MinimumTLSVersion TLSVersion `json:"minimumTlsVersion,omitempty"` - // HostName - READ-ONLY; DNS name of the cluster endpoint - HostName *string `json:"hostName,omitempty"` - // ProvisioningState - READ-ONLY; Current provisioning status of the cluster. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ResourceState - READ-ONLY; Current resource status of the cluster. Possible values include: 'ResourceStateRunning', 'ResourceStateCreating', 'ResourceStateCreateFailed', 'ResourceStateUpdating', 'ResourceStateUpdateFailed', 'ResourceStateDeleting', 'ResourceStateDeleteFailed', 'ResourceStateEnabling', 'ResourceStateEnableFailed', 'ResourceStateDisabling', 'ResourceStateDisableFailed', 'ResourceStateDisabled' - ResourceState ResourceState `json:"resourceState,omitempty"` - // RedisVersion - READ-ONLY; Version of redis the cluster supports, e.g. '6' - RedisVersion *string `json:"redisVersion,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections associated with the specified RedisEnterprise cluster - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterProperties. -func (cp ClusterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.MinimumTLSVersion != "" { - objectMap["minimumTlsVersion"] = cp.MinimumTLSVersion - } - return json.Marshal(objectMap) -} - -// ClusterUpdate a partial update to the RedisEnterprise cluster -type ClusterUpdate struct { - // Sku - The SKU to create, which affects price, performance, and features. - Sku *Sku `json:"sku,omitempty"` - // ClusterProperties - Other properties of the cluster. - *ClusterProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ClusterUpdate. -func (cu ClusterUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cu.Sku != nil { - objectMap["sku"] = cu.Sku - } - if cu.ClusterProperties != nil { - objectMap["properties"] = cu.ClusterProperties - } - if cu.Tags != nil { - objectMap["tags"] = cu.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ClusterUpdate struct. -func (cu *ClusterUpdate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - cu.Sku = &sku - } - case "properties": - if v != nil { - var clusterProperties ClusterProperties - err = json.Unmarshal(*v, &clusterProperties) - if err != nil { - return err - } - cu.ClusterProperties = &clusterProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cu.Tags = tags - } - } - } - - return nil -} - -// CreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type CreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (Cluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CreateFuture.Result. -func (future *CreateFuture) result(client Client) (c Cluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.CreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - c.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redisenterprise.CreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { - c, err = client.CreateResponder(c.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.CreateFuture", "Result", c.Response.Response, "Failure responding to request") - } - } - return -} - -// Database describes a database on the RedisEnterprise cluster -type Database struct { - autorest.Response `json:"-"` - // DatabaseProperties - Other properties of the database. - *DatabaseProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Database. -func (d Database) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.DatabaseProperties != nil { - objectMap["properties"] = d.DatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Database struct. -func (d *Database) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - d.DatabaseProperties = &databaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseList the response of a list-all operation. -type DatabaseList struct { - autorest.Response `json:"-"` - // Value - List of databases - Value *[]Database `json:"value,omitempty"` - // NextLink - READ-ONLY; The URI to fetch the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseList. -func (dl DatabaseList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dl.Value != nil { - objectMap["value"] = dl.Value - } - return json.Marshal(objectMap) -} - -// DatabaseListIterator provides access to a complete listing of Database values. -type DatabaseListIterator struct { - i int - page DatabaseListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DatabaseListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DatabaseListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DatabaseListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DatabaseListIterator) Response() DatabaseList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DatabaseListIterator) Value() Database { - if !iter.page.NotDone() { - return Database{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DatabaseListIterator type. -func NewDatabaseListIterator(page DatabaseListPage) DatabaseListIterator { - return DatabaseListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dl DatabaseList) IsEmpty() bool { - return dl.Value == nil || len(*dl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dl DatabaseList) hasNextLink() bool { - return dl.NextLink != nil && len(*dl.NextLink) != 0 -} - -// databaseListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dl DatabaseList) databaseListPreparer(ctx context.Context) (*http.Request, error) { - if !dl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dl.NextLink))) -} - -// DatabaseListPage contains a page of Database values. -type DatabaseListPage struct { - fn func(context.Context, DatabaseList) (DatabaseList, error) - dl DatabaseList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DatabaseListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dl) - if err != nil { - return err - } - page.dl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DatabaseListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DatabaseListPage) NotDone() bool { - return !page.dl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DatabaseListPage) Response() DatabaseList { - return page.dl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DatabaseListPage) Values() []Database { - if page.dl.IsEmpty() { - return nil - } - return *page.dl.Value -} - -// Creates a new instance of the DatabaseListPage type. -func NewDatabaseListPage(cur DatabaseList, getNextPage func(context.Context, DatabaseList) (DatabaseList, error)) DatabaseListPage { - return DatabaseListPage{ - fn: getNextPage, - dl: cur, - } -} - -// DatabaseProperties properties of RedisEnterprise databases, as opposed to general resource properties -// like location, tags -type DatabaseProperties struct { - // ClientProtocol - Specifies whether redis clients can connect using TLS-encrypted or plaintext redis protocols. Default is TLS-encrypted. Possible values include: 'Encrypted', 'Plaintext' - ClientProtocol Protocol `json:"clientProtocol,omitempty"` - // Port - TCP port of the database endpoint. Specified at create time. Defaults to an available port. - Port *int32 `json:"port,omitempty"` - // ProvisioningState - READ-ONLY; Current provisioning status of the database. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ResourceState - READ-ONLY; Current resource status of the database. Possible values include: 'ResourceStateRunning', 'ResourceStateCreating', 'ResourceStateCreateFailed', 'ResourceStateUpdating', 'ResourceStateUpdateFailed', 'ResourceStateDeleting', 'ResourceStateDeleteFailed', 'ResourceStateEnabling', 'ResourceStateEnableFailed', 'ResourceStateDisabling', 'ResourceStateDisableFailed', 'ResourceStateDisabled' - ResourceState ResourceState `json:"resourceState,omitempty"` - // ClusteringPolicy - Clustering policy - default is OSSCluster. Specified at create time. Possible values include: 'EnterpriseCluster', 'OSSCluster' - ClusteringPolicy ClusteringPolicy `json:"clusteringPolicy,omitempty"` - // EvictionPolicy - Redis eviction policy - default is VolatileLRU. Possible values include: 'AllKeysLFU', 'AllKeysLRU', 'AllKeysRandom', 'VolatileLRU', 'VolatileLFU', 'VolatileTTL', 'VolatileRandom', 'NoEviction' - EvictionPolicy EvictionPolicy `json:"evictionPolicy,omitempty"` - // Persistence - Persistence settings - Persistence *Persistence `json:"persistence,omitempty"` - // Modules - Optional set of redis modules to enable in this database - modules can only be added at creation time. - Modules *[]Module `json:"modules,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseProperties. -func (dp DatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.ClientProtocol != "" { - objectMap["clientProtocol"] = dp.ClientProtocol - } - if dp.Port != nil { - objectMap["port"] = dp.Port - } - if dp.ClusteringPolicy != "" { - objectMap["clusteringPolicy"] = dp.ClusteringPolicy - } - if dp.EvictionPolicy != "" { - objectMap["evictionPolicy"] = dp.EvictionPolicy - } - if dp.Persistence != nil { - objectMap["persistence"] = dp.Persistence - } - if dp.Modules != nil { - objectMap["modules"] = dp.Modules - } - return json.Marshal(objectMap) -} - -// DatabasesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesCreateFuture.Result. -func (future *DatabasesCreateFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redisenterprise.DatabasesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesCreateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesDeleteFuture.Result. -func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redisenterprise.DatabasesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabasesExportFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesExportFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesExportFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesExportFuture.Result. -func (future *DatabasesExportFuture) result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesExportFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redisenterprise.DatabasesExportFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabasesImportFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesImportFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesImportFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesImportFuture.Result. -func (future *DatabasesImportFuture) result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesImportFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redisenterprise.DatabasesImportFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabasesRegenerateKeyFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesRegenerateKeyFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (AccessKeys, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesRegenerateKeyFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesRegenerateKeyFuture.Result. -func (future *DatabasesRegenerateKeyFuture) result(client DatabasesClient) (ak AccessKeys, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesRegenerateKeyFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ak.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redisenterprise.DatabasesRegenerateKeyFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ak.Response.Response, err = future.GetResult(sender); err == nil && ak.Response.Response.StatusCode != http.StatusNoContent { - ak, err = client.RegenerateKeyResponder(ak.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesRegenerateKeyFuture", "Result", ak.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesUpdateFuture.Result. -func (future *DatabasesUpdateFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redisenterprise.DatabasesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.UpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DatabasesUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseUpdate a partial update to the RedisEnterprise database -type DatabaseUpdate struct { - // DatabaseProperties - Properties of the database. - *DatabaseProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseUpdate. -func (du DatabaseUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if du.DatabaseProperties != nil { - objectMap["properties"] = du.DatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseUpdate struct. -func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - du.DatabaseProperties = &databaseProperties - } - } - } - - return nil -} - -// DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type DeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeleteFuture.Result. -func (future *DeleteFuture) result(client Client) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.DeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redisenterprise.DeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorDetail the error detail. -type ErrorDetail struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]ErrorDetail `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorDetail. -func (ed ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for -// failed operations. (This also follows the OData error response format.). -type ErrorResponse struct { - // Error - The error object. - Error *ErrorDetail `json:"error,omitempty"` -} - -// ExportClusterParameters parameters for a Redis Enterprise export operation. -type ExportClusterParameters struct { - // SasURI - SAS URI for the target directory to export to - SasURI *string `json:"sasUri,omitempty"` -} - -// ImportClusterParameters parameters for a Redis Enterprise import operation. -type ImportClusterParameters struct { - // SasURI - SAS URI for the target blob to import from - SasURI *string `json:"sasUri,omitempty"` -} - -// Module specifies configuration of a redis module -type Module struct { - // Name - The name of the module, e.g. 'RedisBloom', 'RediSearch', 'RedisTimeSeries' - Name *string `json:"name,omitempty"` - // Args - Configuration options for the module, e.g. 'ERROR_RATE 0.00 INITIAL_SIZE 400'. - Args *string `json:"args,omitempty"` - // Version - READ-ONLY; The version of the module, e.g. '1.0'. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for Module. -func (mVar Module) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mVar.Name != nil { - objectMap["name"] = mVar.Name - } - if mVar.Args != nil { - objectMap["args"] = mVar.Args - } - return json.Marshal(objectMap) -} - -// Operation details of a REST API operation, returned from the Resource Provider Operations API -type Operation struct { - // Name - READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" - Name *string `json:"name,omitempty"` - // IsDataAction - READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. - IsDataAction *bool `json:"isDataAction,omitempty"` - // Display - Localized display information for this particular operation. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". Possible values include: 'User', 'System', 'Usersystem' - Origin Origin `json:"origin,omitempty"` - // ActionType - READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: 'Internal' - ActionType ActionType `json:"actionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if o.Display != nil { - objectMap["display"] = o.Display - } - return json.Marshal(objectMap) -} - -// OperationDisplay localized display information for this particular operation. -type OperationDisplay struct { - // Provider - READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". - Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - Operation *string `json:"operation,omitempty"` - // Description - READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResult a list of REST API operations supported by an Azure Resource Provider. It contains -// an URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of operations supported by the resource provider - Value *[]Operation `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of operation list results (if there are any). - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// OperationStatus the status of a long-running operation. -type OperationStatus struct { - autorest.Response `json:"-"` - // ID - The operation's unique id. - ID *string `json:"id,omitempty"` - // Name - The operation's name. - Name *string `json:"name,omitempty"` - // StartTime - The start time of the operation. - StartTime *string `json:"startTime,omitempty"` - // EndTime - The end time of the operation. - EndTime *string `json:"endTime,omitempty"` - // Status - The current status of the operation. - Status *string `json:"status,omitempty"` - // Error - Error response describing why the operation failed. - Error *ErrorResponse `json:"error,omitempty"` -} - -// Persistence persistence-related configuration for the RedisEnterprise database -type Persistence struct { - // AofEnabled - Sets whether AOF is enabled. - AofEnabled *bool `json:"aofEnabled,omitempty"` - // RdbEnabled - Sets whether RDB is enabled. - RdbEnabled *bool `json:"rdbEnabled,omitempty"` - // AofFrequency - Sets the frequency at which data is written to disk. Possible values include: 'Ones', 'Always' - AofFrequency AofFrequency `json:"aofFrequency,omitempty"` - // RdbFrequency - Sets the frequency at which a snapshot of the database is created. Possible values include: 'Oneh', 'Sixh', 'OneTwoh' - RdbFrequency RdbFrequency `json:"rdbFrequency,omitempty"` -} - -// PrivateEndpoint the Private Endpoint resource. -type PrivateEndpoint struct { - // ID - READ-ONLY; The ARM identifier for Private Endpoint - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpoint. -func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection the Private Endpoint Connection resource. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult list of private endpoint connection associated with the specified -// storage account -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of the PrivateEndpointConnectProperties. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The resource of private end point. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - The provisioning state of the private endpoint connection resource. Possible values include: 'Succeeded', 'Creating', 'Deleting', 'Failed' - ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionsPutFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsPutFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsPutFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsPutFuture.Result. -func (future *PrivateEndpointConnectionsPutFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateEndpointConnectionsPutFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redisenterprise.PrivateEndpointConnectionsPutFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.PutResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateEndpointConnectionsPutFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.PrivateLinkResourceProperties != nil { - objectMap["properties"] = plr.PrivateLinkResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. -func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - The private link resource Private link DNS zone name. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plrp.RequiredZoneNames != nil { - objectMap["requiredZoneNames"] = plrp.RequiredZoneNames - } - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionState a collection of information about the state of the connection between -// service consumer and provider. -type PrivateLinkServiceConnectionState struct { - // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'Pending', 'Approved', 'Rejected' - Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` - // Description - The reason for approval/rejection of the connection. - Description *string `json:"description,omitempty"` - // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RegenerateKeyParameters specifies which access keys to reset to a new random value. -type RegenerateKeyParameters struct { - // KeyType - Which access key to regenerate. Possible values include: 'Primary', 'Secondary' - KeyType AccessKeyType `json:"keyType,omitempty"` -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Sku SKU parameters supplied to the create RedisEnterprise operation. -type Sku struct { - // Name - The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10, EnterpriseFlash_F300 etc.). Possible values include: 'EnterpriseE10', 'EnterpriseE20', 'EnterpriseE50', 'EnterpriseE100', 'EnterpriseFlashF300', 'EnterpriseFlashF700', 'EnterpriseFlashF1500' - Name SkuName `json:"name,omitempty"` - // Capacity - The size of the RedisEnterprise cluster. Defaults to 2 or 3 depending on SKU. Valid values are (2, 4, 6, ...) for Enterprise SKUs and (3, 9, 15, ...) for Flash SKUs. - Capacity *int32 `json:"capacity,omitempty"` -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type UpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(Client) (Cluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *UpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for UpdateFuture.Result. -func (future *UpdateFuture) result(client Client) (c Cluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.UpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - c.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("redisenterprise.UpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { - c, err = client.UpdateResponder(c.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.UpdateFuture", "Result", c.Response.Response, "Failure responding to request") - } - } - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/operations.go deleted file mode 100644 index 2aacd9262808..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package redisenterprise - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the REST API for managing Redis Enterprise resources in Azure. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available REST API operations of the Microsoft.Cache provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redisenterprise.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Cache/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "redisenterprise.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "redisenterprise.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/operationsstatus.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/operationsstatus.go deleted file mode 100644 index c4ae08374942..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/operationsstatus.go +++ /dev/null @@ -1,115 +0,0 @@ -package redisenterprise - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsStatusClient is the REST API for managing Redis Enterprise resources in Azure. -type OperationsStatusClient struct { - BaseClient -} - -// NewOperationsStatusClient creates an instance of the OperationsStatusClient client. -func NewOperationsStatusClient(subscriptionID string) OperationsStatusClient { - return NewOperationsStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsStatusClientWithBaseURI creates an instance of the OperationsStatusClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewOperationsStatusClientWithBaseURI(baseURI string, subscriptionID string) OperationsStatusClient { - return OperationsStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the status of operation. -// Parameters: -// location - the region the operation is in. -// operationID - the operation's unique identifier. -func (client OperationsStatusClient) Get(ctx context.Context, location string, operationID string) (result OperationStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsStatusClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.OperationsStatusClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, location, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.OperationsStatusClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redisenterprise.OperationsStatusClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.OperationsStatusClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client OperationsStatusClient) GetPreparer(ctx context.Context, location string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "operationId": autorest.Encode("path", operationID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/operationsStatus/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsStatusClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client OperationsStatusClient) GetResponder(resp *http.Response) (result OperationStatus, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/privateendpointconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/privateendpointconnections.go deleted file mode 100644 index c46563c9d936..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/privateendpointconnections.go +++ /dev/null @@ -1,394 +0,0 @@ -package redisenterprise - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionsClient is the REST API for managing Redis Enterprise resources in Azure. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete deletes the specified private endpoint connection associated with the RedisEnterprise cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateEndpointConnectionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateEndpointConnectionsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified private endpoint connection associated with the RedisEnterprise cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all the private endpoint connections associated with the RedisEnterprise cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.PrivateEndpointConnectionsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Put updates the state of the specified private endpoint connection associated with the RedisEnterprise cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -// properties - the private endpoint connection properties. -func (client PrivateEndpointConnectionsClient) Put(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (result PrivateEndpointConnectionsPutFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Put") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: properties, - Constraints: []validation.Constraint{{Target: "properties.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "properties.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("redisenterprise.PrivateEndpointConnectionsClient", "Put", err.Error()) - } - - req, err := client.PutPreparer(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, properties) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateEndpointConnectionsClient", "Put", nil, "Failure preparing request") - return - } - - result, err = client.PutSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateEndpointConnectionsClient", "Put", result.Response(), "Failure sending request") - return - } - - return -} - -// PutPreparer prepares the Put request. -func (client PrivateEndpointConnectionsClient) PutPreparer(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(properties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PutSender sends the Put request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) PutSender(req *http.Request) (future PrivateEndpointConnectionsPutFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// PutResponder handles the response to the Put request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) PutResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/privatelinkresources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/privatelinkresources.go deleted file mode 100644 index 41446e964b67..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/privatelinkresources.go +++ /dev/null @@ -1,119 +0,0 @@ -package redisenterprise - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the REST API for managing Redis Enterprise resources in Azure. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByCluster gets the private link resources that need to be created for a RedisEnterprise cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -func (client PrivateLinkResourcesClient) ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result PrivateLinkResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByCluster") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.PrivateLinkResourcesClient", "ListByCluster", err.Error()) - } - - req, err := client.ListByClusterPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateLinkResourcesClient", "ListByCluster", nil, "Failure preparing request") - return - } - - resp, err := client.ListByClusterSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateLinkResourcesClient", "ListByCluster", resp, "Failure sending request") - return - } - - result, err = client.ListByClusterResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.PrivateLinkResourcesClient", "ListByCluster", resp, "Failure responding to request") - return - } - - return -} - -// ListByClusterPreparer prepares the ListByCluster request. -func (client PrivateLinkResourcesClient) ListByClusterPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByClusterSender sends the ListByCluster request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByClusterSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByClusterResponder handles the response to the ListByCluster request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByClusterResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/redisenterprise.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/redisenterprise.go deleted file mode 100644 index bdc05fedde5f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/redisenterprise.go +++ /dev/null @@ -1,637 +0,0 @@ -package redisenterprise - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// Client is the REST API for managing Redis Enterprise resources in Azure. -type Client struct { - BaseClient -} - -// NewClient creates an instance of the Client client. -func NewClient(subscriptionID string) Client { - return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting -// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { - return Client{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates or updates an existing (overwrite/recreate, with potential downtime) cache cluster -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -// parameters - parameters supplied to the Create RedisEnterprise operation. -func (client Client) Create(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster) (result CreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.Client", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, clusterName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client Client) CreatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CreateSender(req *http.Request) (future CreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client Client) CreateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a RedisEnterprise cache cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -func (client Client) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result DeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.Client", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client Client) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client Client) DeleteSender(req *http.Request) (future DeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about a RedisEnterprise cluster -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -func (client Client) Get(ctx context.Context, resourceGroupName string, clusterName string) (result Cluster, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.Client", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client Client) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client Client) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client Client) GetResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all RedisEnterprise clusters in the specified subscription. -func (client Client) List(ctx context.Context) (result ClusterListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") - defer func() { - sc := -1 - if result.cl.Response.Response != nil { - sc = result.cl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.Client", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.cl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "List", resp, "Failure sending request") - return - } - - result.cl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "List", resp, "Failure responding to request") - return - } - if result.cl.hasNextLink() && result.cl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client Client) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redisEnterprise", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client Client) ListResponder(resp *http.Response) (result ClusterList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client Client) listNextResults(ctx context.Context, lastResults ClusterList) (result ClusterList, err error) { - req, err := lastResults.clusterListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "redisenterprise.Client", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "redisenterprise.Client", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client Client) ListComplete(ctx context.Context) (result ClusterListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup lists all RedisEnterprise clusters in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client Client) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ClusterListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") - defer func() { - sc := -1 - if result.cl.Response.Response != nil { - sc = result.cl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.Client", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.cl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.cl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.cl.hasNextLink() && result.cl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client Client) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client Client) ListByResourceGroupResponder(resp *http.Response) (result ClusterList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client Client) listByResourceGroupNextResults(ctx context.Context, lastResults ClusterList) (result ClusterList, err error) { - req, err := lastResults.clusterListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "redisenterprise.Client", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "redisenterprise.Client", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client Client) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ClusterListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// Update updates an existing RedisEnterprise cluster -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the RedisEnterprise cluster. -// parameters - parameters supplied to the Update RedisEnterprise operation. -func (client Client) Update(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate) (result UpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("redisenterprise.Client", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.Client", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client Client) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client Client) UpdateSender(req *http.Request) (future UpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client Client) UpdateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/version.go deleted file mode 100644 index 602d646d12a6..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package redisenterprise - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " redisenterprise/2021-03-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/_meta.json deleted file mode 100644 index 961e9e652911..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", - "tag": "package-locks-2016-09", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-locks-2016-09 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/resources/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/authorizationoperations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/authorizationoperations.go deleted file mode 100644 index 01011a4e3e1f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/authorizationoperations.go +++ /dev/null @@ -1,142 +0,0 @@ -package locks - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AuthorizationOperationsClient is the azure resources can be locked to prevent other users in your organization from -// deleting or modifying resources. -type AuthorizationOperationsClient struct { - BaseClient -} - -// NewAuthorizationOperationsClient creates an instance of the AuthorizationOperationsClient client. -func NewAuthorizationOperationsClient(subscriptionID string) AuthorizationOperationsClient { - return NewAuthorizationOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAuthorizationOperationsClientWithBaseURI creates an instance of the AuthorizationOperationsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewAuthorizationOperationsClientWithBaseURI(baseURI string, subscriptionID string) AuthorizationOperationsClient { - return AuthorizationOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available Microsoft.Authorization REST API operations. -func (client AuthorizationOperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationOperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.AuthorizationOperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.AuthorizationOperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.AuthorizationOperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AuthorizationOperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Authorization/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationOperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AuthorizationOperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client AuthorizationOperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "locks.AuthorizationOperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "locks.AuthorizationOperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.AuthorizationOperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AuthorizationOperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationOperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/client.go deleted file mode 100644 index fd1b93aad7f6..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armlocks](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armlocks). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package locks implements the Azure ARM Locks service API version 2016-09-01. -// -// Azure resources can be locked to prevent other users in your organization from deleting or modifying resources. -package locks - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Locks - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Locks. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/enums.go deleted file mode 100644 index 06a3905244ff..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/enums.go +++ /dev/null @@ -1,24 +0,0 @@ -package locks - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// LockLevel enumerates the values for lock level. -type LockLevel string - -const ( - // CanNotDelete ... - CanNotDelete LockLevel = "CanNotDelete" - // NotSpecified ... - NotSpecified LockLevel = "NotSpecified" - // ReadOnly ... - ReadOnly LockLevel = "ReadOnly" -) - -// PossibleLockLevelValues returns an array of possible values for the LockLevel const type. -func PossibleLockLevelValues() []LockLevel { - return []LockLevel{CanNotDelete, NotSpecified, ReadOnly} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/managementlocks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/managementlocks.go deleted file mode 100644 index 1fe741ce985c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/managementlocks.go +++ /dev/null @@ -1,1571 +0,0 @@ -package locks - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ManagementLocksClient is the azure resources can be locked to prevent other users in your organization from deleting -// or modifying resources. -type ManagementLocksClient struct { - BaseClient -} - -// NewManagementLocksClient creates an instance of the ManagementLocksClient client. -func NewManagementLocksClient(subscriptionID string) ManagementLocksClient { - return NewManagementLocksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagementLocksClientWithBaseURI creates an instance of the ManagementLocksClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewManagementLocksClientWithBaseURI(baseURI string, subscriptionID string) ManagementLocksClient { - return ManagementLocksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdateAtResourceGroupLevel when you apply a lock at a parent scope, all child resources inherit the same -// lock. To create management locks, you must have access to Microsoft.Authorization/* or -// Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted -// those actions. -// Parameters: -// resourceGroupName - the name of the resource group to lock. -// lockName - the lock name. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, :, -// \, ?, /, or any control characters. -// parameters - the management lock parameters. -func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevel(ctx context.Context, resourceGroupName string, lockName string, parameters ManagementLockObject) (result ManagementLockObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.CreateOrUpdateAtResourceGroupLevel") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ManagementLockProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("locks.ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", err.Error()) - } - - req, err := client.CreateOrUpdateAtResourceGroupLevelPreparer(ctx, resourceGroupName, lockName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAtResourceGroupLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAtResourceGroupLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateAtResourceGroupLevelPreparer prepares the CreateOrUpdateAtResourceGroupLevel request. -func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevelPreparer(ctx context.Context, resourceGroupName string, lockName string, parameters ManagementLockObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Type = nil - parameters.Name = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateAtResourceGroupLevelSender sends the CreateOrUpdateAtResourceGroupLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateAtResourceGroupLevelResponder handles the response to the CreateOrUpdateAtResourceGroupLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAtResourceLevel when you apply a lock at a parent scope, all child resources inherit the same lock. To -// create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* -// actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions. -// Parameters: -// resourceGroupName - the name of the resource group containing the resource to lock. -// resourceProviderNamespace - the resource provider namespace of the resource to lock. -// parentResourcePath - the parent resource identity. -// resourceType - the resource type of the resource to lock. -// resourceName - the name of the resource to lock. -// lockName - the name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, -// :, \, ?, /, or any control characters. -// parameters - parameters for creating or updating a management lock. -func (client ManagementLocksClient) CreateOrUpdateAtResourceLevel(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string, parameters ManagementLockObject) (result ManagementLockObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.CreateOrUpdateAtResourceLevel") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ManagementLockProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("locks.ManagementLocksClient", "CreateOrUpdateAtResourceLevel", err.Error()) - } - - req, err := client.CreateOrUpdateAtResourceLevelPreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceLevel", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAtResourceLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceLevel", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAtResourceLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceLevel", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateAtResourceLevelPreparer prepares the CreateOrUpdateAtResourceLevel request. -func (client ManagementLocksClient) CreateOrUpdateAtResourceLevelPreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string, parameters ManagementLockObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Type = nil - parameters.Name = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateAtResourceLevelSender sends the CreateOrUpdateAtResourceLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) CreateOrUpdateAtResourceLevelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateAtResourceLevelResponder handles the response to the CreateOrUpdateAtResourceLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) CreateOrUpdateAtResourceLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAtSubscriptionLevel when you apply a lock at a parent scope, all child resources inherit the same -// lock. To create management locks, you must have access to Microsoft.Authorization/* or -// Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted -// those actions. -// Parameters: -// lockName - the name of lock. The lock name can be a maximum of 260 characters. It cannot contain <, > %, &, -// :, \, ?, /, or any control characters. -// parameters - the management lock parameters. -func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevel(ctx context.Context, lockName string, parameters ManagementLockObject) (result ManagementLockObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.CreateOrUpdateAtSubscriptionLevel") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ManagementLockProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("locks.ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", err.Error()) - } - - req, err := client.CreateOrUpdateAtSubscriptionLevelPreparer(ctx, lockName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAtSubscriptionLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAtSubscriptionLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateAtSubscriptionLevelPreparer prepares the CreateOrUpdateAtSubscriptionLevel request. -func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevelPreparer(ctx context.Context, lockName string, parameters ManagementLockObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Type = nil - parameters.Name = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateAtSubscriptionLevelSender sends the CreateOrUpdateAtSubscriptionLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateAtSubscriptionLevelResponder handles the response to the CreateOrUpdateAtSubscriptionLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateByScope create or update a management lock by scope. -// Parameters: -// scope - the scope for the lock. When providing a scope for the assignment, use -// '/subscriptions/{subscriptionId}' for subscriptions, -// '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups, and -// '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' -// for resources. -// lockName - the name of lock. -// parameters - create or update management lock parameters. -func (client ManagementLocksClient) CreateOrUpdateByScope(ctx context.Context, scope string, lockName string, parameters ManagementLockObject) (result ManagementLockObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.CreateOrUpdateByScope") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ManagementLockProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("locks.ManagementLocksClient", "CreateOrUpdateByScope", err.Error()) - } - - req, err := client.CreateOrUpdateByScopePreparer(ctx, scope, lockName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateByScope", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateByScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateByScope", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateByScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateByScope", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateByScopePreparer prepares the CreateOrUpdateByScope request. -func (client ManagementLocksClient) CreateOrUpdateByScopePreparer(ctx context.Context, scope string, lockName string, parameters ManagementLockObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "scope": autorest.Encode("path", scope), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Type = nil - parameters.Name = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateByScopeSender sends the CreateOrUpdateByScope request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) CreateOrUpdateByScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateByScopeResponder handles the response to the CreateOrUpdateByScope request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) CreateOrUpdateByScopeResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteAtResourceGroupLevel to delete management locks, you must have access to Microsoft.Authorization/* or -// Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted -// those actions. -// Parameters: -// resourceGroupName - the name of the resource group containing the lock. -// lockName - the name of lock to delete. -func (client ManagementLocksClient) DeleteAtResourceGroupLevel(ctx context.Context, resourceGroupName string, lockName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.DeleteAtResourceGroupLevel") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("locks.ManagementLocksClient", "DeleteAtResourceGroupLevel", err.Error()) - } - - req, err := client.DeleteAtResourceGroupLevelPreparer(ctx, resourceGroupName, lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceGroupLevel", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAtResourceGroupLevelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceGroupLevel", resp, "Failure sending request") - return - } - - result, err = client.DeleteAtResourceGroupLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceGroupLevel", resp, "Failure responding to request") - return - } - - return -} - -// DeleteAtResourceGroupLevelPreparer prepares the DeleteAtResourceGroupLevel request. -func (client ManagementLocksClient) DeleteAtResourceGroupLevelPreparer(ctx context.Context, resourceGroupName string, lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteAtResourceGroupLevelSender sends the DeleteAtResourceGroupLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) DeleteAtResourceGroupLevelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteAtResourceGroupLevelResponder handles the response to the DeleteAtResourceGroupLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) DeleteAtResourceGroupLevelResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAtResourceLevel to delete management locks, you must have access to Microsoft.Authorization/* or -// Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted -// those actions. -// Parameters: -// resourceGroupName - the name of the resource group containing the resource with the lock to delete. -// resourceProviderNamespace - the resource provider namespace of the resource with the lock to delete. -// parentResourcePath - the parent resource identity. -// resourceType - the resource type of the resource with the lock to delete. -// resourceName - the name of the resource with the lock to delete. -// lockName - the name of the lock to delete. -func (client ManagementLocksClient) DeleteAtResourceLevel(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.DeleteAtResourceLevel") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("locks.ManagementLocksClient", "DeleteAtResourceLevel", err.Error()) - } - - req, err := client.DeleteAtResourceLevelPreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceLevel", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAtResourceLevelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceLevel", resp, "Failure sending request") - return - } - - result, err = client.DeleteAtResourceLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceLevel", resp, "Failure responding to request") - return - } - - return -} - -// DeleteAtResourceLevelPreparer prepares the DeleteAtResourceLevel request. -func (client ManagementLocksClient) DeleteAtResourceLevelPreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteAtResourceLevelSender sends the DeleteAtResourceLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) DeleteAtResourceLevelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteAtResourceLevelResponder handles the response to the DeleteAtResourceLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) DeleteAtResourceLevelResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAtSubscriptionLevel to delete management locks, you must have access to Microsoft.Authorization/* or -// Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted -// those actions. -// Parameters: -// lockName - the name of lock to delete. -func (client ManagementLocksClient) DeleteAtSubscriptionLevel(ctx context.Context, lockName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.DeleteAtSubscriptionLevel") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteAtSubscriptionLevelPreparer(ctx, lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtSubscriptionLevel", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAtSubscriptionLevelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtSubscriptionLevel", resp, "Failure sending request") - return - } - - result, err = client.DeleteAtSubscriptionLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtSubscriptionLevel", resp, "Failure responding to request") - return - } - - return -} - -// DeleteAtSubscriptionLevelPreparer prepares the DeleteAtSubscriptionLevel request. -func (client ManagementLocksClient) DeleteAtSubscriptionLevelPreparer(ctx context.Context, lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteAtSubscriptionLevelSender sends the DeleteAtSubscriptionLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) DeleteAtSubscriptionLevelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteAtSubscriptionLevelResponder handles the response to the DeleteAtSubscriptionLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) DeleteAtSubscriptionLevelResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteByScope delete a management lock by scope. -// Parameters: -// scope - the scope for the lock. -// lockName - the name of lock. -func (client ManagementLocksClient) DeleteByScope(ctx context.Context, scope string, lockName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.DeleteByScope") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteByScopePreparer(ctx, scope, lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteByScope", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteByScopeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteByScope", resp, "Failure sending request") - return - } - - result, err = client.DeleteByScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteByScope", resp, "Failure responding to request") - return - } - - return -} - -// DeleteByScopePreparer prepares the DeleteByScope request. -func (client ManagementLocksClient) DeleteByScopePreparer(ctx context.Context, scope string, lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "scope": autorest.Encode("path", scope), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteByScopeSender sends the DeleteByScope request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) DeleteByScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteByScopeResponder handles the response to the DeleteByScope request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) DeleteByScopeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetAtResourceGroupLevel gets a management lock at the resource group level. -// Parameters: -// resourceGroupName - the name of the locked resource group. -// lockName - the name of the lock to get. -func (client ManagementLocksClient) GetAtResourceGroupLevel(ctx context.Context, resourceGroupName string, lockName string) (result ManagementLockObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.GetAtResourceGroupLevel") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("locks.ManagementLocksClient", "GetAtResourceGroupLevel", err.Error()) - } - - req, err := client.GetAtResourceGroupLevelPreparer(ctx, resourceGroupName, lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceGroupLevel", nil, "Failure preparing request") - return - } - - resp, err := client.GetAtResourceGroupLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceGroupLevel", resp, "Failure sending request") - return - } - - result, err = client.GetAtResourceGroupLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceGroupLevel", resp, "Failure responding to request") - return - } - - return -} - -// GetAtResourceGroupLevelPreparer prepares the GetAtResourceGroupLevel request. -func (client ManagementLocksClient) GetAtResourceGroupLevelPreparer(ctx context.Context, resourceGroupName string, lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAtResourceGroupLevelSender sends the GetAtResourceGroupLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) GetAtResourceGroupLevelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAtResourceGroupLevelResponder handles the response to the GetAtResourceGroupLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) GetAtResourceGroupLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAtResourceLevel get the management lock of a resource or any level below resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceProviderNamespace - the namespace of the resource provider. -// parentResourcePath - an extra path parameter needed in some services, like SQL Databases. -// resourceType - the type of the resource. -// resourceName - the name of the resource. -// lockName - the name of lock. -func (client ManagementLocksClient) GetAtResourceLevel(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string) (result ManagementLockObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.GetAtResourceLevel") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("locks.ManagementLocksClient", "GetAtResourceLevel", err.Error()) - } - - req, err := client.GetAtResourceLevelPreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceLevel", nil, "Failure preparing request") - return - } - - resp, err := client.GetAtResourceLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceLevel", resp, "Failure sending request") - return - } - - result, err = client.GetAtResourceLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceLevel", resp, "Failure responding to request") - return - } - - return -} - -// GetAtResourceLevelPreparer prepares the GetAtResourceLevel request. -func (client ManagementLocksClient) GetAtResourceLevelPreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAtResourceLevelSender sends the GetAtResourceLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) GetAtResourceLevelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAtResourceLevelResponder handles the response to the GetAtResourceLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) GetAtResourceLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAtSubscriptionLevel gets a management lock at the subscription level. -// Parameters: -// lockName - the name of the lock to get. -func (client ManagementLocksClient) GetAtSubscriptionLevel(ctx context.Context, lockName string) (result ManagementLockObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.GetAtSubscriptionLevel") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAtSubscriptionLevelPreparer(ctx, lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtSubscriptionLevel", nil, "Failure preparing request") - return - } - - resp, err := client.GetAtSubscriptionLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtSubscriptionLevel", resp, "Failure sending request") - return - } - - result, err = client.GetAtSubscriptionLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtSubscriptionLevel", resp, "Failure responding to request") - return - } - - return -} - -// GetAtSubscriptionLevelPreparer prepares the GetAtSubscriptionLevel request. -func (client ManagementLocksClient) GetAtSubscriptionLevelPreparer(ctx context.Context, lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAtSubscriptionLevelSender sends the GetAtSubscriptionLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) GetAtSubscriptionLevelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAtSubscriptionLevelResponder handles the response to the GetAtSubscriptionLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) GetAtSubscriptionLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByScope get a management lock by scope. -// Parameters: -// scope - the scope for the lock. -// lockName - the name of lock. -func (client ManagementLocksClient) GetByScope(ctx context.Context, scope string, lockName string) (result ManagementLockObject, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.GetByScope") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByScopePreparer(ctx, scope, lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetByScope", nil, "Failure preparing request") - return - } - - resp, err := client.GetByScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetByScope", resp, "Failure sending request") - return - } - - result, err = client.GetByScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetByScope", resp, "Failure responding to request") - return - } - - return -} - -// GetByScopePreparer prepares the GetByScope request. -func (client ManagementLocksClient) GetByScopePreparer(ctx context.Context, scope string, lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "scope": autorest.Encode("path", scope), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByScopeSender sends the GetByScope request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) GetByScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetByScopeResponder handles the response to the GetByScope request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) GetByScopeResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAtResourceGroupLevel gets all the management locks for a resource group. -// Parameters: -// resourceGroupName - the name of the resource group containing the locks to get. -// filter - the filter to apply on the operation. -func (client ManagementLocksClient) ListAtResourceGroupLevel(ctx context.Context, resourceGroupName string, filter string) (result ManagementLockListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.ListAtResourceGroupLevel") - defer func() { - sc := -1 - if result.mllr.Response.Response != nil { - sc = result.mllr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("locks.ManagementLocksClient", "ListAtResourceGroupLevel", err.Error()) - } - - result.fn = client.listAtResourceGroupLevelNextResults - req, err := client.ListAtResourceGroupLevelPreparer(ctx, resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel", nil, "Failure preparing request") - return - } - - resp, err := client.ListAtResourceGroupLevelSender(req) - if err != nil { - result.mllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel", resp, "Failure sending request") - return - } - - result.mllr, err = client.ListAtResourceGroupLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel", resp, "Failure responding to request") - return - } - if result.mllr.hasNextLink() && result.mllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAtResourceGroupLevelPreparer prepares the ListAtResourceGroupLevel request. -func (client ManagementLocksClient) ListAtResourceGroupLevelPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAtResourceGroupLevelSender sends the ListAtResourceGroupLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) ListAtResourceGroupLevelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAtResourceGroupLevelResponder handles the response to the ListAtResourceGroupLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) ListAtResourceGroupLevelResponder(resp *http.Response) (result ManagementLockListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAtResourceGroupLevelNextResults retrieves the next set of results, if any. -func (client ManagementLocksClient) listAtResourceGroupLevelNextResults(ctx context.Context, lastResults ManagementLockListResult) (result ManagementLockListResult, err error) { - req, err := lastResults.managementLockListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "listAtResourceGroupLevelNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAtResourceGroupLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "listAtResourceGroupLevelNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAtResourceGroupLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "listAtResourceGroupLevelNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAtResourceGroupLevelComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagementLocksClient) ListAtResourceGroupLevelComplete(ctx context.Context, resourceGroupName string, filter string) (result ManagementLockListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.ListAtResourceGroupLevel") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAtResourceGroupLevel(ctx, resourceGroupName, filter) - return -} - -// ListAtResourceLevel gets all the management locks for a resource or any level below resource. -// Parameters: -// resourceGroupName - the name of the resource group containing the locked resource. The name is case -// insensitive. -// resourceProviderNamespace - the namespace of the resource provider. -// parentResourcePath - the parent resource identity. -// resourceType - the resource type of the locked resource. -// resourceName - the name of the locked resource. -// filter - the filter to apply on the operation. -func (client ManagementLocksClient) ListAtResourceLevel(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result ManagementLockListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.ListAtResourceLevel") - defer func() { - sc := -1 - if result.mllr.Response.Response != nil { - sc = result.mllr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\p{L}\._\(\)\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("locks.ManagementLocksClient", "ListAtResourceLevel", err.Error()) - } - - result.fn = client.listAtResourceLevelNextResults - req, err := client.ListAtResourceLevelPreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceLevel", nil, "Failure preparing request") - return - } - - resp, err := client.ListAtResourceLevelSender(req) - if err != nil { - result.mllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceLevel", resp, "Failure sending request") - return - } - - result.mllr, err = client.ListAtResourceLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceLevel", resp, "Failure responding to request") - return - } - if result.mllr.hasNextLink() && result.mllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAtResourceLevelPreparer prepares the ListAtResourceLevel request. -func (client ManagementLocksClient) ListAtResourceLevelPreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAtResourceLevelSender sends the ListAtResourceLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) ListAtResourceLevelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAtResourceLevelResponder handles the response to the ListAtResourceLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) ListAtResourceLevelResponder(resp *http.Response) (result ManagementLockListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAtResourceLevelNextResults retrieves the next set of results, if any. -func (client ManagementLocksClient) listAtResourceLevelNextResults(ctx context.Context, lastResults ManagementLockListResult) (result ManagementLockListResult, err error) { - req, err := lastResults.managementLockListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "listAtResourceLevelNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAtResourceLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "listAtResourceLevelNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAtResourceLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "listAtResourceLevelNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAtResourceLevelComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagementLocksClient) ListAtResourceLevelComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result ManagementLockListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.ListAtResourceLevel") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAtResourceLevel(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) - return -} - -// ListAtSubscriptionLevel gets all the management locks for a subscription. -// Parameters: -// filter - the filter to apply on the operation. -func (client ManagementLocksClient) ListAtSubscriptionLevel(ctx context.Context, filter string) (result ManagementLockListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.ListAtSubscriptionLevel") - defer func() { - sc := -1 - if result.mllr.Response.Response != nil { - sc = result.mllr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listAtSubscriptionLevelNextResults - req, err := client.ListAtSubscriptionLevelPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtSubscriptionLevel", nil, "Failure preparing request") - return - } - - resp, err := client.ListAtSubscriptionLevelSender(req) - if err != nil { - result.mllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtSubscriptionLevel", resp, "Failure sending request") - return - } - - result.mllr, err = client.ListAtSubscriptionLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtSubscriptionLevel", resp, "Failure responding to request") - return - } - if result.mllr.hasNextLink() && result.mllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAtSubscriptionLevelPreparer prepares the ListAtSubscriptionLevel request. -func (client ManagementLocksClient) ListAtSubscriptionLevelPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAtSubscriptionLevelSender sends the ListAtSubscriptionLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) ListAtSubscriptionLevelSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAtSubscriptionLevelResponder handles the response to the ListAtSubscriptionLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) ListAtSubscriptionLevelResponder(resp *http.Response) (result ManagementLockListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAtSubscriptionLevelNextResults retrieves the next set of results, if any. -func (client ManagementLocksClient) listAtSubscriptionLevelNextResults(ctx context.Context, lastResults ManagementLockListResult) (result ManagementLockListResult, err error) { - req, err := lastResults.managementLockListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "listAtSubscriptionLevelNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAtSubscriptionLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "listAtSubscriptionLevelNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAtSubscriptionLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "listAtSubscriptionLevelNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAtSubscriptionLevelComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagementLocksClient) ListAtSubscriptionLevelComplete(ctx context.Context, filter string) (result ManagementLockListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.ListAtSubscriptionLevel") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAtSubscriptionLevel(ctx, filter) - return -} - -// ListByScope gets all the management locks for a scope. -// Parameters: -// scope - the scope for the lock. When providing a scope for the assignment, use -// '/subscriptions/{subscriptionId}' for subscriptions, -// '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups, and -// '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' -// for resources. -// filter - the filter to apply on the operation. -func (client ManagementLocksClient) ListByScope(ctx context.Context, scope string, filter string) (result ManagementLockListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.ListByScope") - defer func() { - sc := -1 - if result.mllr.Response.Response != nil { - sc = result.mllr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByScopeNextResults - req, err := client.ListByScopePreparer(ctx, scope, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListByScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListByScopeSender(req) - if err != nil { - result.mllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListByScope", resp, "Failure sending request") - return - } - - result.mllr, err = client.ListByScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListByScope", resp, "Failure responding to request") - return - } - if result.mllr.hasNextLink() && result.mllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByScopePreparer prepares the ListByScope request. -func (client ManagementLocksClient) ListByScopePreparer(ctx context.Context, scope string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": autorest.Encode("path", scope), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/locks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByScopeSender sends the ListByScope request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) ListByScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListByScopeResponder handles the response to the ListByScope request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) ListByScopeResponder(resp *http.Response) (result ManagementLockListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByScopeNextResults retrieves the next set of results, if any. -func (client ManagementLocksClient) listByScopeNextResults(ctx context.Context, lastResults ManagementLockListResult) (result ManagementLockListResult, err error) { - req, err := lastResults.managementLockListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "listByScopeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "listByScopeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "listByScopeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByScopeComplete enumerates all values, automatically crossing page boundaries as required. -func (client ManagementLocksClient) ListByScopeComplete(ctx context.Context, scope string, filter string) (result ManagementLockListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLocksClient.ListByScope") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByScope(ctx, scope, filter) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/models.go deleted file mode 100644 index 5e44750dbfc6..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/models.go +++ /dev/null @@ -1,445 +0,0 @@ -package locks - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks" - -// ManagementLockListResult the list of locks. -type ManagementLockListResult struct { - autorest.Response `json:"-"` - // Value - The list of locks. - Value *[]ManagementLockObject `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ManagementLockListResultIterator provides access to a complete listing of ManagementLockObject values. -type ManagementLockListResultIterator struct { - i int - page ManagementLockListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ManagementLockListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLockListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ManagementLockListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagementLockListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ManagementLockListResultIterator) Response() ManagementLockListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ManagementLockListResultIterator) Value() ManagementLockObject { - if !iter.page.NotDone() { - return ManagementLockObject{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagementLockListResultIterator type. -func NewManagementLockListResultIterator(page ManagementLockListResultPage) ManagementLockListResultIterator { - return ManagementLockListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mllr ManagementLockListResult) IsEmpty() bool { - return mllr.Value == nil || len(*mllr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mllr ManagementLockListResult) hasNextLink() bool { - return mllr.NextLink != nil && len(*mllr.NextLink) != 0 -} - -// managementLockListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mllr ManagementLockListResult) managementLockListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mllr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mllr.NextLink))) -} - -// ManagementLockListResultPage contains a page of ManagementLockObject values. -type ManagementLockListResultPage struct { - fn func(context.Context, ManagementLockListResult) (ManagementLockListResult, error) - mllr ManagementLockListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ManagementLockListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagementLockListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.mllr) - if err != nil { - return err - } - page.mllr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ManagementLockListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagementLockListResultPage) NotDone() bool { - return !page.mllr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagementLockListResultPage) Response() ManagementLockListResult { - return page.mllr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagementLockListResultPage) Values() []ManagementLockObject { - if page.mllr.IsEmpty() { - return nil - } - return *page.mllr.Value -} - -// Creates a new instance of the ManagementLockListResultPage type. -func NewManagementLockListResultPage(cur ManagementLockListResult, getNextPage func(context.Context, ManagementLockListResult) (ManagementLockListResult, error)) ManagementLockListResultPage { - return ManagementLockListResultPage{ - fn: getNextPage, - mllr: cur, - } -} - -// ManagementLockObject the lock information. -type ManagementLockObject struct { - autorest.Response `json:"-"` - // ManagementLockProperties - The properties of the lock. - *ManagementLockProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource ID of the lock. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; The resource type of the lock - Microsoft.Authorization/locks. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; The name of the lock. - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagementLockObject. -func (mlo ManagementLockObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mlo.ManagementLockProperties != nil { - objectMap["properties"] = mlo.ManagementLockProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagementLockObject struct. -func (mlo *ManagementLockObject) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var managementLockProperties ManagementLockProperties - err = json.Unmarshal(*v, &managementLockProperties) - if err != nil { - return err - } - mlo.ManagementLockProperties = &managementLockProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mlo.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mlo.Type = &typeVar - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mlo.Name = &name - } - } - } - - return nil -} - -// ManagementLockOwner lock owner properties. -type ManagementLockOwner struct { - // ApplicationID - The application ID of the lock owner. - ApplicationID *string `json:"applicationId,omitempty"` -} - -// ManagementLockProperties the lock properties. -type ManagementLockProperties struct { - // Level - The level of the lock. Possible values are: NotSpecified, CanNotDelete, ReadOnly. CanNotDelete means authorized users are able to read and modify the resources, but not delete. ReadOnly means authorized users can only read from a resource, but they can't modify or delete it. Possible values include: 'NotSpecified', 'CanNotDelete', 'ReadOnly' - Level LockLevel `json:"level,omitempty"` - // Notes - Notes about the lock. Maximum of 512 characters. - Notes *string `json:"notes,omitempty"` - // Owners - The owners of the lock. - Owners *[]ManagementLockOwner `json:"owners,omitempty"` -} - -// Operation microsoft.Authorization operation -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - The object that represents the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay the object that represents the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Authorization - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: Profile, endpoint, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult result of the request to list Microsoft.Authorization operations. It contains a list -// of operations and a URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of Microsoft.Authorization operations. - Value *[]Operation `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/version.go deleted file mode 100644 index 22dc8ee7dac8..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package locks - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " locks/2016-09-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/_meta.json deleted file mode 100644 index 64df01fa2f3d..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "51b37b069ecbb9d2fcd300eabd4b10b7911b7d7d", - "readme": "/_/azure-rest-api-specs/specification/servicefabric/resource-manager/readme.md", - "tag": "package-2021-06", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-06 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/servicefabric/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applications.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applications.go deleted file mode 100644 index fb84001fe136..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applications.go +++ /dev/null @@ -1,435 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ApplicationsClient is the service Fabric Management Client -type ApplicationsClient struct { - BaseClient -} - -// NewApplicationsClient creates an instance of the ApplicationsClient client. -func NewApplicationsClient(subscriptionID string) ApplicationsClient { - return NewApplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationsClientWithBaseURI creates an instance of the ApplicationsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewApplicationsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationsClient { - return ApplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a Service Fabric application resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -// parameters - the application resource. -func (client ApplicationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters ApplicationResource) (result ApplicationsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, applicationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ApplicationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters ApplicationResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) CreateOrUpdateSender(req *http.Request) (future ApplicationsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Service Fabric application resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -func (client ApplicationsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (result ApplicationsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) DeleteSender(req *http.Request) (future ApplicationsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a Service Fabric application resource created or in the process of being created in the Service Fabric -// cluster resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -func (client ApplicationsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (result ApplicationResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) GetResponder(resp *http.Response) (result ApplicationResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all application resources created or in the process of being created in the Service Fabric cluster -// resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -func (client ApplicationsClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result ApplicationResourceList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) ListResponder(resp *http.Response) (result ApplicationResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update a Service Fabric application resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -// parameters - the application resource for patch operations. -func (client ApplicationsClient) Update(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters ApplicationResourceUpdate) (result ApplicationsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, applicationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ApplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters ApplicationResourceUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) UpdateSender(req *http.Request) (future ApplicationsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) UpdateResponder(resp *http.Response) (result ApplicationResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applicationtypes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applicationtypes.go deleted file mode 100644 index c6f9d26c3667..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applicationtypes.go +++ /dev/null @@ -1,349 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ApplicationTypesClient is the service Fabric Management Client -type ApplicationTypesClient struct { - BaseClient -} - -// NewApplicationTypesClient creates an instance of the ApplicationTypesClient client. -func NewApplicationTypesClient(subscriptionID string) ApplicationTypesClient { - return NewApplicationTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationTypesClientWithBaseURI creates an instance of the ApplicationTypesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewApplicationTypesClientWithBaseURI(baseURI string, subscriptionID string) ApplicationTypesClient { - return ApplicationTypesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a Service Fabric application type name resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationTypeName - the name of the application type name resource. -// parameters - the application type name resource. -func (client ApplicationTypesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, parameters ApplicationTypeResource) (result ApplicationTypeResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, applicationTypeName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ApplicationTypesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, parameters ApplicationTypeResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationTypeName": autorest.Encode("path", applicationTypeName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationTypesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ApplicationTypesClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationTypeResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Service Fabric application type name resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationTypeName - the name of the application type name resource. -func (client ApplicationTypesClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string) (result ApplicationTypesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, applicationTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationTypesClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationTypeName": autorest.Encode("path", applicationTypeName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationTypesClient) DeleteSender(req *http.Request) (future ApplicationTypesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationTypesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a Service Fabric application type name resource created or in the process of being created in the Service -// Fabric cluster resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationTypeName - the name of the application type name resource. -func (client ApplicationTypesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string) (result ApplicationTypeResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, applicationTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationTypesClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationTypeName": autorest.Encode("path", applicationTypeName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationTypesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationTypesClient) GetResponder(resp *http.Response) (result ApplicationTypeResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all application type name resources created or in the process of being created in the Service Fabric -// cluster resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -func (client ApplicationTypesClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result ApplicationTypeResourceList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationTypesClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationTypesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationTypesClient) ListResponder(resp *http.Response) (result ApplicationTypeResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applicationtypeversions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applicationtypeversions.go deleted file mode 100644 index 6159c40d6748..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/applicationtypeversions.go +++ /dev/null @@ -1,368 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ApplicationTypeVersionsClient is the service Fabric Management Client -type ApplicationTypeVersionsClient struct { - BaseClient -} - -// NewApplicationTypeVersionsClient creates an instance of the ApplicationTypeVersionsClient client. -func NewApplicationTypeVersionsClient(subscriptionID string) ApplicationTypeVersionsClient { - return NewApplicationTypeVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationTypeVersionsClientWithBaseURI creates an instance of the ApplicationTypeVersionsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewApplicationTypeVersionsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationTypeVersionsClient { - return ApplicationTypeVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a Service Fabric application type version resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationTypeName - the name of the application type name resource. -// version - the application type version. -// parameters - the application type version resource. -func (client ApplicationTypeVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, version string, parameters ApplicationTypeVersionResource) (result ApplicationTypeVersionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypeVersionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ApplicationTypeVersionResourceProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ApplicationTypeVersionResourceProperties.AppPackageURL", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("servicefabric.ApplicationTypeVersionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, applicationTypeName, version, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ApplicationTypeVersionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, version string, parameters ApplicationTypeVersionResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationTypeName": autorest.Encode("path", applicationTypeName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "version": autorest.Encode("path", version), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationTypeVersionsClient) CreateOrUpdateSender(req *http.Request) (future ApplicationTypeVersionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ApplicationTypeVersionsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationTypeVersionResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Service Fabric application type version resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationTypeName - the name of the application type name resource. -// version - the application type version. -func (client ApplicationTypeVersionsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, version string) (result ApplicationTypeVersionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypeVersionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, applicationTypeName, version) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationTypeVersionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, version string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationTypeName": autorest.Encode("path", applicationTypeName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "version": autorest.Encode("path", version), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationTypeVersionsClient) DeleteSender(req *http.Request) (future ApplicationTypeVersionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationTypeVersionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a Service Fabric application type version resource created or in the process of being created in the Service -// Fabric application type name resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationTypeName - the name of the application type name resource. -// version - the application type version. -func (client ApplicationTypeVersionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, version string) (result ApplicationTypeVersionResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypeVersionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, applicationTypeName, version) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationTypeVersionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string, version string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationTypeName": autorest.Encode("path", applicationTypeName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "version": autorest.Encode("path", version), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationTypeVersionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationTypeVersionsClient) GetResponder(resp *http.Response) (result ApplicationTypeVersionResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all application type version resources created or in the process of being created in the Service Fabric -// application type name resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationTypeName - the name of the application type name resource. -func (client ApplicationTypeVersionsClient) List(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string) (result ApplicationTypeVersionResourceList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationTypeVersionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, clusterName, applicationTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationTypeVersionsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationTypeName": autorest.Encode("path", applicationTypeName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationTypeVersionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationTypeVersionsClient) ListResponder(resp *http.Response) (result ApplicationTypeVersionResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/client.go deleted file mode 100644 index 24211ad66430..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicefabric/armservicefabric](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicefabric/armservicefabric). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package servicefabric implements the Azure ARM Servicefabric service API version 2021-06-01. -// -// Service Fabric Management Client -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Servicefabric - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Servicefabric. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/clusters.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/clusters.go deleted file mode 100644 index f473ad513491..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/clusters.go +++ /dev/null @@ -1,642 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ClustersClient is the service Fabric Management Client -type ClustersClient struct { - BaseClient -} - -// NewClustersClient creates an instance of the ClustersClient client. -func NewClustersClient(subscriptionID string) ClustersClient { - return NewClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClustersClientWithBaseURI creates an instance of the ClustersClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { - return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a Service Fabric cluster resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// parameters - the cluster resource. -func (client ClustersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster) (result ClustersCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ClusterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.Certificate", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.Certificate.Thumbprint", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.StorageAccountName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.ProtectedAccountKeyName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.BlobEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.QueueEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.TableEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.ClusterProperties.ManagementEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.NodeTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.ReverseProxyCertificate", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.ReverseProxyCertificate.Thumbprint", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.ClusterProperties.UpgradeDescription", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.UpgradeReplicaSetCheckTimeout", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthCheckWaitDuration", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthCheckStableDuration", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthCheckRetryTimeout", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.UpgradeTimeout", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.UpgradeDomainTimeout", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyNodes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyNodes", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyNodes", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}, - }}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyNodes", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyNodes", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyNodes", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyApplications", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyApplications", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyApplications", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}, - }}, - }}, - {Target: "parameters.ClusterProperties.ApplicationTypeVersionsCleanupPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.ApplicationTypeVersionsCleanupPolicy.MaxUnusedVersionsToKeep", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.ApplicationTypeVersionsCleanupPolicy.MaxUnusedVersionsToKeep", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("servicefabric.ClustersClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) CreateOrUpdateSender(req *http.Request) (future ClustersCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ClustersClient) CreateOrUpdateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Service Fabric cluster resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -func (client ClustersClient) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a Service Fabric cluster resource created or in the process of being created in the specified resource -// group. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -func (client ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string) (result Cluster, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ClustersClient) GetResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all Service Fabric cluster resources created or in the process of being created in the subscription. -func (client ClustersClient) List(ctx context.Context) (result ClusterListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListResponder(resp *http.Response) (result ClusterListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets all Service Fabric cluster resources created or in the process of being created in the -// resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ClusterListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ClustersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUpgradableVersions if a target is not provided, it will get the minimum and maximum versions available from the -// current cluster version. If a target is given, it will provide the required path to get from the current cluster -// version to the target version. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// versionsDescription - the upgrade path description with target version. -func (client ClustersClient) ListUpgradableVersions(ctx context.Context, resourceGroupName string, clusterName string, versionsDescription *UpgradableVersionsDescription) (result UpgradableVersionPathResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListUpgradableVersions") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: versionsDescription, - Constraints: []validation.Constraint{{Target: "versionsDescription", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "versionsDescription.TargetVersion", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("servicefabric.ClustersClient", "ListUpgradableVersions", err.Error()) - } - - req, err := client.ListUpgradableVersionsPreparer(ctx, resourceGroupName, clusterName, versionsDescription) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListUpgradableVersions", nil, "Failure preparing request") - return - } - - resp, err := client.ListUpgradableVersionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListUpgradableVersions", resp, "Failure sending request") - return - } - - result, err = client.ListUpgradableVersionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListUpgradableVersions", resp, "Failure responding to request") - return - } - - return -} - -// ListUpgradableVersionsPreparer prepares the ListUpgradableVersions request. -func (client ClustersClient) ListUpgradableVersionsPreparer(ctx context.Context, resourceGroupName string, clusterName string, versionsDescription *UpgradableVersionsDescription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/listUpgradableVersions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if versionsDescription != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(versionsDescription)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUpgradableVersionsSender sends the ListUpgradableVersions request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListUpgradableVersionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUpgradableVersionsResponder handles the response to the ListUpgradableVersions request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListUpgradableVersionsResponder(resp *http.Response) (result UpgradableVersionPathResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update the configuration of a Service Fabric cluster resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// parameters - the parameters which contains the property value and property name which used to update the -// cluster configuration. -func (client ClustersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdateParameters) (result ClustersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) UpdateSender(req *http.Request) (future ClustersUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/clusterversions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/clusterversions.go deleted file mode 100644 index e5af8279b207..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/clusterversions.go +++ /dev/null @@ -1,335 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ClusterVersionsClient is the service Fabric Management Client -type ClusterVersionsClient struct { - BaseClient -} - -// NewClusterVersionsClient creates an instance of the ClusterVersionsClient client. -func NewClusterVersionsClient(subscriptionID string) ClusterVersionsClient { - return NewClusterVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClusterVersionsClientWithBaseURI creates an instance of the ClusterVersionsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewClusterVersionsClientWithBaseURI(baseURI string, subscriptionID string) ClusterVersionsClient { - return ClusterVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets information about an available Service Fabric cluster code version. -// Parameters: -// location - the location for the cluster code versions. This is different from cluster location. -// clusterVersion - the cluster code version. -func (client ClusterVersionsClient) Get(ctx context.Context, location string, clusterVersion string) (result ClusterCodeVersionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClusterVersionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, location, clusterVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ClusterVersionsClient) GetPreparer(ctx context.Context, location string, clusterVersion string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterVersion": autorest.Encode("path", clusterVersion), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ClusterVersionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ClusterVersionsClient) GetResponder(resp *http.Response) (result ClusterCodeVersionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByEnvironment gets information about an available Service Fabric cluster code version by environment. -// Parameters: -// location - the location for the cluster code versions. This is different from cluster location. -// environment - the operating system of the cluster. The default means all. -// clusterVersion - the cluster code version. -func (client ClusterVersionsClient) GetByEnvironment(ctx context.Context, location string, environment string, clusterVersion string) (result ClusterCodeVersionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClusterVersionsClient.GetByEnvironment") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByEnvironmentPreparer(ctx, location, environment, clusterVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "GetByEnvironment", nil, "Failure preparing request") - return - } - - resp, err := client.GetByEnvironmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "GetByEnvironment", resp, "Failure sending request") - return - } - - result, err = client.GetByEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "GetByEnvironment", resp, "Failure responding to request") - return - } - - return -} - -// GetByEnvironmentPreparer prepares the GetByEnvironment request. -func (client ClusterVersionsClient) GetByEnvironmentPreparer(ctx context.Context, location string, environment string, clusterVersion string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterVersion": autorest.Encode("path", clusterVersion), - "environment": autorest.Encode("path", environment), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByEnvironmentSender sends the GetByEnvironment request. The method will close the -// http.Response Body if it receives an error. -func (client ClusterVersionsClient) GetByEnvironmentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByEnvironmentResponder handles the response to the GetByEnvironment request. The method always -// closes the http.Response Body. -func (client ClusterVersionsClient) GetByEnvironmentResponder(resp *http.Response) (result ClusterCodeVersionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all available code versions for Service Fabric cluster resources by location. -// Parameters: -// location - the location for the cluster code versions. This is different from cluster location. -func (client ClusterVersionsClient) List(ctx context.Context, location string) (result ClusterCodeVersionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClusterVersionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ClusterVersionsClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ClusterVersionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ClusterVersionsClient) ListResponder(resp *http.Response) (result ClusterCodeVersionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByEnvironment gets all available code versions for Service Fabric cluster resources by environment. -// Parameters: -// location - the location for the cluster code versions. This is different from cluster location. -// environment - the operating system of the cluster. The default means all. -func (client ClusterVersionsClient) ListByEnvironment(ctx context.Context, location string, environment string) (result ClusterCodeVersionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClusterVersionsClient.ListByEnvironment") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByEnvironmentPreparer(ctx, location, environment) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "ListByEnvironment", nil, "Failure preparing request") - return - } - - resp, err := client.ListByEnvironmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "ListByEnvironment", resp, "Failure sending request") - return - } - - result, err = client.ListByEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "ListByEnvironment", resp, "Failure responding to request") - return - } - - return -} - -// ListByEnvironmentPreparer prepares the ListByEnvironment request. -func (client ClusterVersionsClient) ListByEnvironmentPreparer(ctx context.Context, location string, environment string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "environment": autorest.Encode("path", environment), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByEnvironmentSender sends the ListByEnvironment request. The method will close the -// http.Response Body if it receives an error. -func (client ClusterVersionsClient) ListByEnvironmentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByEnvironmentResponder handles the response to the ListByEnvironment request. The method always -// closes the http.Response Body. -func (client ClusterVersionsClient) ListByEnvironmentResponder(resp *http.Response) (result ClusterCodeVersionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/enums.go deleted file mode 100644 index d0728bb16f52..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/enums.go +++ /dev/null @@ -1,584 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ArmServicePackageActivationMode enumerates the values for arm service package activation mode. -type ArmServicePackageActivationMode string - -const ( - // ArmServicePackageActivationModeExclusiveProcess Indicates the application package activation mode will - // use exclusive process. - ArmServicePackageActivationModeExclusiveProcess ArmServicePackageActivationMode = "ExclusiveProcess" - // ArmServicePackageActivationModeSharedProcess Indicates the application package activation mode will use - // shared process. - ArmServicePackageActivationModeSharedProcess ArmServicePackageActivationMode = "SharedProcess" -) - -// PossibleArmServicePackageActivationModeValues returns an array of possible values for the ArmServicePackageActivationMode const type. -func PossibleArmServicePackageActivationModeValues() []ArmServicePackageActivationMode { - return []ArmServicePackageActivationMode{ArmServicePackageActivationModeExclusiveProcess, ArmServicePackageActivationModeSharedProcess} -} - -// ArmUpgradeFailureAction enumerates the values for arm upgrade failure action. -type ArmUpgradeFailureAction string - -const ( - // ArmUpgradeFailureActionManual Indicates that a manual repair will need to be performed by the - // administrator if the upgrade fails. Service Fabric will not proceed to the next upgrade domain - // automatically. - ArmUpgradeFailureActionManual ArmUpgradeFailureAction = "Manual" - // ArmUpgradeFailureActionRollback Indicates that a rollback of the upgrade will be performed by Service - // Fabric if the upgrade fails. - ArmUpgradeFailureActionRollback ArmUpgradeFailureAction = "Rollback" -) - -// PossibleArmUpgradeFailureActionValues returns an array of possible values for the ArmUpgradeFailureAction const type. -func PossibleArmUpgradeFailureActionValues() []ArmUpgradeFailureAction { - return []ArmUpgradeFailureAction{ArmUpgradeFailureActionManual, ArmUpgradeFailureActionRollback} -} - -// ClusterState enumerates the values for cluster state. -type ClusterState string - -const ( - // ClusterStateAutoScale ... - ClusterStateAutoScale ClusterState = "AutoScale" - // ClusterStateBaselineUpgrade ... - ClusterStateBaselineUpgrade ClusterState = "BaselineUpgrade" - // ClusterStateDeploying ... - ClusterStateDeploying ClusterState = "Deploying" - // ClusterStateEnforcingClusterVersion ... - ClusterStateEnforcingClusterVersion ClusterState = "EnforcingClusterVersion" - // ClusterStateReady ... - ClusterStateReady ClusterState = "Ready" - // ClusterStateUpdatingInfrastructure ... - ClusterStateUpdatingInfrastructure ClusterState = "UpdatingInfrastructure" - // ClusterStateUpdatingUserCertificate ... - ClusterStateUpdatingUserCertificate ClusterState = "UpdatingUserCertificate" - // ClusterStateUpdatingUserConfiguration ... - ClusterStateUpdatingUserConfiguration ClusterState = "UpdatingUserConfiguration" - // ClusterStateUpgradeServiceUnreachable ... - ClusterStateUpgradeServiceUnreachable ClusterState = "UpgradeServiceUnreachable" - // ClusterStateWaitingForNodes ... - ClusterStateWaitingForNodes ClusterState = "WaitingForNodes" -) - -// PossibleClusterStateValues returns an array of possible values for the ClusterState const type. -func PossibleClusterStateValues() []ClusterState { - return []ClusterState{ClusterStateAutoScale, ClusterStateBaselineUpgrade, ClusterStateDeploying, ClusterStateEnforcingClusterVersion, ClusterStateReady, ClusterStateUpdatingInfrastructure, ClusterStateUpdatingUserCertificate, ClusterStateUpdatingUserConfiguration, ClusterStateUpgradeServiceUnreachable, ClusterStateWaitingForNodes} -} - -// ClusterUpgradeCadence enumerates the values for cluster upgrade cadence. -type ClusterUpgradeCadence string - -const ( - // ClusterUpgradeCadenceWave0 Cluster upgrade starts immediately after a new version is rolled out. - // Recommended for Test/Dev clusters. - ClusterUpgradeCadenceWave0 ClusterUpgradeCadence = "Wave0" - // ClusterUpgradeCadenceWave1 Cluster upgrade starts 7 days after a new version is rolled out. Recommended - // for Pre-prod clusters. - ClusterUpgradeCadenceWave1 ClusterUpgradeCadence = "Wave1" - // ClusterUpgradeCadenceWave2 Cluster upgrade starts 14 days after a new version is rolled out. Recommended - // for Production clusters. - ClusterUpgradeCadenceWave2 ClusterUpgradeCadence = "Wave2" -) - -// PossibleClusterUpgradeCadenceValues returns an array of possible values for the ClusterUpgradeCadence const type. -func PossibleClusterUpgradeCadenceValues() []ClusterUpgradeCadence { - return []ClusterUpgradeCadence{ClusterUpgradeCadenceWave0, ClusterUpgradeCadenceWave1, ClusterUpgradeCadenceWave2} -} - -// DurabilityLevel enumerates the values for durability level. -type DurabilityLevel string - -const ( - // DurabilityLevelBronze ... - DurabilityLevelBronze DurabilityLevel = "Bronze" - // DurabilityLevelGold ... - DurabilityLevelGold DurabilityLevel = "Gold" - // DurabilityLevelSilver ... - DurabilityLevelSilver DurabilityLevel = "Silver" -) - -// PossibleDurabilityLevelValues returns an array of possible values for the DurabilityLevel const type. -func PossibleDurabilityLevelValues() []DurabilityLevel { - return []DurabilityLevel{DurabilityLevelBronze, DurabilityLevelGold, DurabilityLevelSilver} -} - -// Environment enumerates the values for environment. -type Environment string - -const ( - // EnvironmentLinux ... - EnvironmentLinux Environment = "Linux" - // EnvironmentWindows ... - EnvironmentWindows Environment = "Windows" -) - -// PossibleEnvironmentValues returns an array of possible values for the Environment const type. -func PossibleEnvironmentValues() []Environment { - return []Environment{EnvironmentLinux, EnvironmentWindows} -} - -// ManagedIdentityType enumerates the values for managed identity type. -type ManagedIdentityType string - -const ( - // ManagedIdentityTypeNone Indicates that no identity is associated with the resource. - ManagedIdentityTypeNone ManagedIdentityType = "None" - // ManagedIdentityTypeSystemAssigned Indicates that system assigned identity is associated with the - // resource. - ManagedIdentityTypeSystemAssigned ManagedIdentityType = "SystemAssigned" - // ManagedIdentityTypeSystemAssignedUserAssigned Indicates that both system assigned and user assigned - // identity are associated with the resource. - ManagedIdentityTypeSystemAssignedUserAssigned ManagedIdentityType = "SystemAssigned, UserAssigned" - // ManagedIdentityTypeUserAssigned Indicates that user assigned identity is associated with the resource. - ManagedIdentityTypeUserAssigned ManagedIdentityType = "UserAssigned" -) - -// PossibleManagedIdentityTypeValues returns an array of possible values for the ManagedIdentityType const type. -func PossibleManagedIdentityTypeValues() []ManagedIdentityType { - return []ManagedIdentityType{ManagedIdentityTypeNone, ManagedIdentityTypeSystemAssigned, ManagedIdentityTypeSystemAssignedUserAssigned, ManagedIdentityTypeUserAssigned} -} - -// MoveCost enumerates the values for move cost. -type MoveCost string - -const ( - // MoveCostHigh Specifies the move cost of the service as High. The value is 3. - MoveCostHigh MoveCost = "High" - // MoveCostLow Specifies the move cost of the service as Low. The value is 1. - MoveCostLow MoveCost = "Low" - // MoveCostMedium Specifies the move cost of the service as Medium. The value is 2. - MoveCostMedium MoveCost = "Medium" - // MoveCostZero Zero move cost. This value is zero. - MoveCostZero MoveCost = "Zero" -) - -// PossibleMoveCostValues returns an array of possible values for the MoveCost const type. -func PossibleMoveCostValues() []MoveCost { - return []MoveCost{MoveCostHigh, MoveCostLow, MoveCostMedium, MoveCostZero} -} - -// NotificationChannel enumerates the values for notification channel. -type NotificationChannel string - -const ( - // NotificationChannelEmailSubscription For subscription receivers. In this case, the parameter receivers - // should be a list of roles of the subscription for the cluster (eg. Owner, AccountAdmin, etc) that will - // receive the notifications. - NotificationChannelEmailSubscription NotificationChannel = "EmailSubscription" - // NotificationChannelEmailUser For email user receivers. In this case, the parameter receivers should be a - // list of email addresses that will receive the notifications. - NotificationChannelEmailUser NotificationChannel = "EmailUser" -) - -// PossibleNotificationChannelValues returns an array of possible values for the NotificationChannel const type. -func PossibleNotificationChannelValues() []NotificationChannel { - return []NotificationChannel{NotificationChannelEmailSubscription, NotificationChannelEmailUser} -} - -// NotificationLevel enumerates the values for notification level. -type NotificationLevel string - -const ( - // NotificationLevelAll Receive all notifications. - NotificationLevelAll NotificationLevel = "All" - // NotificationLevelCritical Receive only critical notifications. - NotificationLevelCritical NotificationLevel = "Critical" -) - -// PossibleNotificationLevelValues returns an array of possible values for the NotificationLevel const type. -func PossibleNotificationLevelValues() []NotificationLevel { - return []NotificationLevel{NotificationLevelAll, NotificationLevelCritical} -} - -// PartitionScheme enumerates the values for partition scheme. -type PartitionScheme string - -const ( - // PartitionSchemeInvalid Indicates the partition kind is invalid. All Service Fabric enumerations have the - // invalid type. The value is zero. - PartitionSchemeInvalid PartitionScheme = "Invalid" - // PartitionSchemeNamed Indicates that the partition is based on string names, and is a - // NamedPartitionSchemeDescription object. The value is 3 - PartitionSchemeNamed PartitionScheme = "Named" - // PartitionSchemeSingleton Indicates that the partition is based on string names, and is a - // SingletonPartitionSchemeDescription object, The value is 1. - PartitionSchemeSingleton PartitionScheme = "Singleton" - // PartitionSchemeUniformInt64Range Indicates that the partition is based on Int64 key ranges, and is a - // UniformInt64RangePartitionSchemeDescription object. The value is 2. - PartitionSchemeUniformInt64Range PartitionScheme = "UniformInt64Range" -) - -// PossiblePartitionSchemeValues returns an array of possible values for the PartitionScheme const type. -func PossiblePartitionSchemeValues() []PartitionScheme { - return []PartitionScheme{PartitionSchemeInvalid, PartitionSchemeNamed, PartitionSchemeSingleton, PartitionSchemeUniformInt64Range} -} - -// PartitionSchemeBasicPartitionSchemeDescription enumerates the values for partition scheme basic partition -// scheme description. -type PartitionSchemeBasicPartitionSchemeDescription string - -const ( - // PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed ... - PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed PartitionSchemeBasicPartitionSchemeDescription = "Named" - // PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription ... - PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription PartitionSchemeBasicPartitionSchemeDescription = "PartitionSchemeDescription" - // PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton ... - PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton PartitionSchemeBasicPartitionSchemeDescription = "Singleton" - // PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range ... - PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range PartitionSchemeBasicPartitionSchemeDescription = "UniformInt64Range" -) - -// PossiblePartitionSchemeBasicPartitionSchemeDescriptionValues returns an array of possible values for the PartitionSchemeBasicPartitionSchemeDescription const type. -func PossiblePartitionSchemeBasicPartitionSchemeDescriptionValues() []PartitionSchemeBasicPartitionSchemeDescription { - return []PartitionSchemeBasicPartitionSchemeDescription{PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed, PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription, PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton, PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCanceled ... - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating ... - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} -} - -// ReliabilityLevel enumerates the values for reliability level. -type ReliabilityLevel string - -const ( - // ReliabilityLevelBronze ... - ReliabilityLevelBronze ReliabilityLevel = "Bronze" - // ReliabilityLevelGold ... - ReliabilityLevelGold ReliabilityLevel = "Gold" - // ReliabilityLevelNone ... - ReliabilityLevelNone ReliabilityLevel = "None" - // ReliabilityLevelPlatinum ... - ReliabilityLevelPlatinum ReliabilityLevel = "Platinum" - // ReliabilityLevelSilver ... - ReliabilityLevelSilver ReliabilityLevel = "Silver" -) - -// PossibleReliabilityLevelValues returns an array of possible values for the ReliabilityLevel const type. -func PossibleReliabilityLevelValues() []ReliabilityLevel { - return []ReliabilityLevel{ReliabilityLevelBronze, ReliabilityLevelGold, ReliabilityLevelNone, ReliabilityLevelPlatinum, ReliabilityLevelSilver} -} - -// ReliabilityLevel1 enumerates the values for reliability level 1. -type ReliabilityLevel1 string - -const ( - // ReliabilityLevel1Bronze ... - ReliabilityLevel1Bronze ReliabilityLevel1 = "Bronze" - // ReliabilityLevel1Gold ... - ReliabilityLevel1Gold ReliabilityLevel1 = "Gold" - // ReliabilityLevel1None ... - ReliabilityLevel1None ReliabilityLevel1 = "None" - // ReliabilityLevel1Platinum ... - ReliabilityLevel1Platinum ReliabilityLevel1 = "Platinum" - // ReliabilityLevel1Silver ... - ReliabilityLevel1Silver ReliabilityLevel1 = "Silver" -) - -// PossibleReliabilityLevel1Values returns an array of possible values for the ReliabilityLevel1 const type. -func PossibleReliabilityLevel1Values() []ReliabilityLevel1 { - return []ReliabilityLevel1{ReliabilityLevel1Bronze, ReliabilityLevel1Gold, ReliabilityLevel1None, ReliabilityLevel1Platinum, ReliabilityLevel1Silver} -} - -// RollingUpgradeMode enumerates the values for rolling upgrade mode. -type RollingUpgradeMode string - -const ( - // RollingUpgradeModeInvalid Indicates the upgrade mode is invalid. All Service Fabric enumerations have - // the invalid type. The value is zero. - RollingUpgradeModeInvalid RollingUpgradeMode = "Invalid" - // RollingUpgradeModeMonitored The upgrade will stop after completing each upgrade domain and automatically - // monitor health before proceeding. The value is 3 - RollingUpgradeModeMonitored RollingUpgradeMode = "Monitored" - // RollingUpgradeModeUnmonitoredAuto The upgrade will proceed automatically without performing any health - // monitoring. The value is 1 - RollingUpgradeModeUnmonitoredAuto RollingUpgradeMode = "UnmonitoredAuto" - // RollingUpgradeModeUnmonitoredManual The upgrade will stop after completing each upgrade domain, giving - // the opportunity to manually monitor health before proceeding. The value is 2 - RollingUpgradeModeUnmonitoredManual RollingUpgradeMode = "UnmonitoredManual" -) - -// PossibleRollingUpgradeModeValues returns an array of possible values for the RollingUpgradeMode const type. -func PossibleRollingUpgradeModeValues() []RollingUpgradeMode { - return []RollingUpgradeMode{RollingUpgradeModeInvalid, RollingUpgradeModeMonitored, RollingUpgradeModeUnmonitoredAuto, RollingUpgradeModeUnmonitoredManual} -} - -// ServiceCorrelationScheme enumerates the values for service correlation scheme. -type ServiceCorrelationScheme string - -const ( - // ServiceCorrelationSchemeAffinity Indicates that this service has an affinity relationship with another - // service. Provided for backwards compatibility, consider preferring the Aligned or NonAlignedAffinity - // options. The value is 1. - ServiceCorrelationSchemeAffinity ServiceCorrelationScheme = "Affinity" - // ServiceCorrelationSchemeAlignedAffinity Aligned affinity ensures that the primaries of the partitions of - // the affinitized services are collocated on the same nodes. This is the default and is the same as - // selecting the Affinity scheme. The value is 2. - ServiceCorrelationSchemeAlignedAffinity ServiceCorrelationScheme = "AlignedAffinity" - // ServiceCorrelationSchemeInvalid An invalid correlation scheme. Cannot be used. The value is zero. - ServiceCorrelationSchemeInvalid ServiceCorrelationScheme = "Invalid" - // ServiceCorrelationSchemeNonAlignedAffinity Non-Aligned affinity guarantees that all replicas of each - // service will be placed on the same nodes. Unlike Aligned Affinity, this does not guarantee that replicas - // of particular role will be collocated. The value is 3. - ServiceCorrelationSchemeNonAlignedAffinity ServiceCorrelationScheme = "NonAlignedAffinity" -) - -// PossibleServiceCorrelationSchemeValues returns an array of possible values for the ServiceCorrelationScheme const type. -func PossibleServiceCorrelationSchemeValues() []ServiceCorrelationScheme { - return []ServiceCorrelationScheme{ServiceCorrelationSchemeAffinity, ServiceCorrelationSchemeAlignedAffinity, ServiceCorrelationSchemeInvalid, ServiceCorrelationSchemeNonAlignedAffinity} -} - -// ServiceKind enumerates the values for service kind. -type ServiceKind string - -const ( - // ServiceKindInvalid Indicates the service kind is invalid. All Service Fabric enumerations have the - // invalid type. The value is zero. - ServiceKindInvalid ServiceKind = "Invalid" - // ServiceKindStateful Uses Service Fabric to make its state or part of its state highly available and - // reliable. The value is 2. - ServiceKindStateful ServiceKind = "Stateful" - // ServiceKindStateless Does not use Service Fabric to make its state highly available or reliable. The - // value is 1. - ServiceKindStateless ServiceKind = "Stateless" -) - -// PossibleServiceKindValues returns an array of possible values for the ServiceKind const type. -func PossibleServiceKindValues() []ServiceKind { - return []ServiceKind{ServiceKindInvalid, ServiceKindStateful, ServiceKindStateless} -} - -// ServiceKindBasicServiceResourceProperties enumerates the values for service kind basic service resource -// properties. -type ServiceKindBasicServiceResourceProperties string - -const ( - // ServiceKindBasicServiceResourcePropertiesServiceKindServiceResourceProperties ... - ServiceKindBasicServiceResourcePropertiesServiceKindServiceResourceProperties ServiceKindBasicServiceResourceProperties = "ServiceResourceProperties" - // ServiceKindBasicServiceResourcePropertiesServiceKindStateful ... - ServiceKindBasicServiceResourcePropertiesServiceKindStateful ServiceKindBasicServiceResourceProperties = "Stateful" - // ServiceKindBasicServiceResourcePropertiesServiceKindStateless ... - ServiceKindBasicServiceResourcePropertiesServiceKindStateless ServiceKindBasicServiceResourceProperties = "Stateless" -) - -// PossibleServiceKindBasicServiceResourcePropertiesValues returns an array of possible values for the ServiceKindBasicServiceResourceProperties const type. -func PossibleServiceKindBasicServiceResourcePropertiesValues() []ServiceKindBasicServiceResourceProperties { - return []ServiceKindBasicServiceResourceProperties{ServiceKindBasicServiceResourcePropertiesServiceKindServiceResourceProperties, ServiceKindBasicServiceResourcePropertiesServiceKindStateful, ServiceKindBasicServiceResourcePropertiesServiceKindStateless} -} - -// ServiceKindBasicServiceResourceUpdateProperties enumerates the values for service kind basic service -// resource update properties. -type ServiceKindBasicServiceResourceUpdateProperties string - -const ( - // ServiceKindBasicServiceResourceUpdatePropertiesServiceKindServiceResourceUpdateProperties ... - ServiceKindBasicServiceResourceUpdatePropertiesServiceKindServiceResourceUpdateProperties ServiceKindBasicServiceResourceUpdateProperties = "ServiceResourceUpdateProperties" - // ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful ... - ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful ServiceKindBasicServiceResourceUpdateProperties = "Stateful" - // ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless ... - ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless ServiceKindBasicServiceResourceUpdateProperties = "Stateless" -) - -// PossibleServiceKindBasicServiceResourceUpdatePropertiesValues returns an array of possible values for the ServiceKindBasicServiceResourceUpdateProperties const type. -func PossibleServiceKindBasicServiceResourceUpdatePropertiesValues() []ServiceKindBasicServiceResourceUpdateProperties { - return []ServiceKindBasicServiceResourceUpdateProperties{ServiceKindBasicServiceResourceUpdatePropertiesServiceKindServiceResourceUpdateProperties, ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful, ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless} -} - -// ServiceLoadMetricWeight enumerates the values for service load metric weight. -type ServiceLoadMetricWeight string - -const ( - // ServiceLoadMetricWeightHigh Specifies the metric weight of the service load as High. The value is 3. - ServiceLoadMetricWeightHigh ServiceLoadMetricWeight = "High" - // ServiceLoadMetricWeightLow Specifies the metric weight of the service load as Low. The value is 1. - ServiceLoadMetricWeightLow ServiceLoadMetricWeight = "Low" - // ServiceLoadMetricWeightMedium Specifies the metric weight of the service load as Medium. The value is 2. - ServiceLoadMetricWeightMedium ServiceLoadMetricWeight = "Medium" - // ServiceLoadMetricWeightZero Disables resource balancing for this metric. This value is zero. - ServiceLoadMetricWeightZero ServiceLoadMetricWeight = "Zero" -) - -// PossibleServiceLoadMetricWeightValues returns an array of possible values for the ServiceLoadMetricWeight const type. -func PossibleServiceLoadMetricWeightValues() []ServiceLoadMetricWeight { - return []ServiceLoadMetricWeight{ServiceLoadMetricWeightHigh, ServiceLoadMetricWeightLow, ServiceLoadMetricWeightMedium, ServiceLoadMetricWeightZero} -} - -// ServicePlacementPolicyType enumerates the values for service placement policy type. -type ServicePlacementPolicyType string - -const ( - // ServicePlacementPolicyTypeInvalid Indicates the type of the placement policy is invalid. All Service - // Fabric enumerations have the invalid type. The value is zero. - ServicePlacementPolicyTypeInvalid ServicePlacementPolicyType = "Invalid" - // ServicePlacementPolicyTypeInvalidDomain Indicates that the ServicePlacementPolicyDescription is of type - // ServicePlacementInvalidDomainPolicyDescription, which indicates that a particular fault or upgrade - // domain cannot be used for placement of this service. The value is 1. - ServicePlacementPolicyTypeInvalidDomain ServicePlacementPolicyType = "InvalidDomain" - // ServicePlacementPolicyTypeNonPartiallyPlaceService Indicates that the ServicePlacementPolicyDescription - // is of type ServicePlacementNonPartiallyPlaceServicePolicyDescription, which indicates that if possible - // all replicas of a particular partition of the service should be placed atomically. The value is 5. - ServicePlacementPolicyTypeNonPartiallyPlaceService ServicePlacementPolicyType = "NonPartiallyPlaceService" - // ServicePlacementPolicyTypePreferredPrimaryDomain Indicates that the ServicePlacementPolicyDescription is - // of type ServicePlacementPreferPrimaryDomainPolicyDescription, which indicates that if possible the - // Primary replica for the partitions of the service should be located in a particular domain as an - // optimization. The value is 3. - ServicePlacementPolicyTypePreferredPrimaryDomain ServicePlacementPolicyType = "PreferredPrimaryDomain" - // ServicePlacementPolicyTypeRequiredDomain Indicates that the ServicePlacementPolicyDescription is of type - // ServicePlacementRequireDomainDistributionPolicyDescription indicating that the replicas of the service - // must be placed in a specific domain. The value is 2. - ServicePlacementPolicyTypeRequiredDomain ServicePlacementPolicyType = "RequiredDomain" - // ServicePlacementPolicyTypeRequiredDomainDistribution Indicates that the - // ServicePlacementPolicyDescription is of type ServicePlacementRequireDomainDistributionPolicyDescription, - // indicating that the system will disallow placement of any two replicas from the same partition in the - // same domain at any time. The value is 4. - ServicePlacementPolicyTypeRequiredDomainDistribution ServicePlacementPolicyType = "RequiredDomainDistribution" -) - -// PossibleServicePlacementPolicyTypeValues returns an array of possible values for the ServicePlacementPolicyType const type. -func PossibleServicePlacementPolicyTypeValues() []ServicePlacementPolicyType { - return []ServicePlacementPolicyType{ServicePlacementPolicyTypeInvalid, ServicePlacementPolicyTypeInvalidDomain, ServicePlacementPolicyTypeNonPartiallyPlaceService, ServicePlacementPolicyTypePreferredPrimaryDomain, ServicePlacementPolicyTypeRequiredDomain, ServicePlacementPolicyTypeRequiredDomainDistribution} -} - -// SfZonalUpgradeMode enumerates the values for sf zonal upgrade mode. -type SfZonalUpgradeMode string - -const ( - // SfZonalUpgradeModeHierarchical If this value is omitted or set to Hierarchical, VMs are grouped to - // reflect the zonal distribution in up to 15 UDs. Each of the three zones has five UDs. This ensures that - // the zones are updated one at a time, moving to next zone only after completing five UDs within the first - // zone. This update process is safer for the cluster and the user application. - SfZonalUpgradeModeHierarchical SfZonalUpgradeMode = "Hierarchical" - // SfZonalUpgradeModeParallel VMs under the node type are grouped into UDs and ignore the zone info in five - // UDs. This setting causes UDs across all zones to be upgraded at the same time. This deployment mode is - // faster for upgrades, we don't recommend it because it goes against the SDP guidelines, which state that - // the updates should be applied to one zone at a time. - SfZonalUpgradeModeParallel SfZonalUpgradeMode = "Parallel" -) - -// PossibleSfZonalUpgradeModeValues returns an array of possible values for the SfZonalUpgradeMode const type. -func PossibleSfZonalUpgradeModeValues() []SfZonalUpgradeMode { - return []SfZonalUpgradeMode{SfZonalUpgradeModeHierarchical, SfZonalUpgradeModeParallel} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeServicePlacementPolicyDescription ... - TypeServicePlacementPolicyDescription Type = "ServicePlacementPolicyDescription" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeServicePlacementPolicyDescription} -} - -// UpgradeMode enumerates the values for upgrade mode. -type UpgradeMode string - -const ( - // UpgradeModeAutomatic The cluster will be automatically upgraded to the latest Service Fabric runtime - // version, **upgradeWave** will determine when the upgrade starts after the new version becomes available. - UpgradeModeAutomatic UpgradeMode = "Automatic" - // UpgradeModeManual The cluster will not be automatically upgraded to the latest Service Fabric runtime - // version. The cluster is upgraded by setting the **clusterCodeVersion** property in the cluster resource. - UpgradeModeManual UpgradeMode = "Manual" -) - -// PossibleUpgradeModeValues returns an array of possible values for the UpgradeMode const type. -func PossibleUpgradeModeValues() []UpgradeMode { - return []UpgradeMode{UpgradeModeAutomatic, UpgradeModeManual} -} - -// VmssZonalUpgradeMode enumerates the values for vmss zonal upgrade mode. -type VmssZonalUpgradeMode string - -const ( - // VmssZonalUpgradeModeHierarchical VMs are grouped to reflect the zonal distribution in up to 15 UDs. Each - // of the three zones has five UDs. This ensures that the zones are updated one at a time, moving to next - // zone only after completing five UDs within the first zone. - VmssZonalUpgradeModeHierarchical VmssZonalUpgradeMode = "Hierarchical" - // VmssZonalUpgradeModeParallel Updates will happen in all Availability Zones at once for the virtual - // machine scale sets. - VmssZonalUpgradeModeParallel VmssZonalUpgradeMode = "Parallel" -) - -// PossibleVmssZonalUpgradeModeValues returns an array of possible values for the VmssZonalUpgradeMode const type. -func PossibleVmssZonalUpgradeModeValues() []VmssZonalUpgradeMode { - return []VmssZonalUpgradeMode{VmssZonalUpgradeModeHierarchical, VmssZonalUpgradeModeParallel} -} - -// X509StoreName enumerates the values for x509 store name. -type X509StoreName string - -const ( - // X509StoreNameAddressBook ... - X509StoreNameAddressBook X509StoreName = "AddressBook" - // X509StoreNameAuthRoot ... - X509StoreNameAuthRoot X509StoreName = "AuthRoot" - // X509StoreNameCertificateAuthority ... - X509StoreNameCertificateAuthority X509StoreName = "CertificateAuthority" - // X509StoreNameDisallowed ... - X509StoreNameDisallowed X509StoreName = "Disallowed" - // X509StoreNameMy ... - X509StoreNameMy X509StoreName = "My" - // X509StoreNameRoot ... - X509StoreNameRoot X509StoreName = "Root" - // X509StoreNameTrustedPeople ... - X509StoreNameTrustedPeople X509StoreName = "TrustedPeople" - // X509StoreNameTrustedPublisher ... - X509StoreNameTrustedPublisher X509StoreName = "TrustedPublisher" -) - -// PossibleX509StoreNameValues returns an array of possible values for the X509StoreName const type. -func PossibleX509StoreNameValues() []X509StoreName { - return []X509StoreName{X509StoreNameAddressBook, X509StoreNameAuthRoot, X509StoreNameCertificateAuthority, X509StoreNameDisallowed, X509StoreNameMy, X509StoreNameRoot, X509StoreNameTrustedPeople, X509StoreNameTrustedPublisher} -} - -// X509StoreName1 enumerates the values for x509 store name 1. -type X509StoreName1 string - -const ( - // X509StoreName1AddressBook ... - X509StoreName1AddressBook X509StoreName1 = "AddressBook" - // X509StoreName1AuthRoot ... - X509StoreName1AuthRoot X509StoreName1 = "AuthRoot" - // X509StoreName1CertificateAuthority ... - X509StoreName1CertificateAuthority X509StoreName1 = "CertificateAuthority" - // X509StoreName1Disallowed ... - X509StoreName1Disallowed X509StoreName1 = "Disallowed" - // X509StoreName1My ... - X509StoreName1My X509StoreName1 = "My" - // X509StoreName1Root ... - X509StoreName1Root X509StoreName1 = "Root" - // X509StoreName1TrustedPeople ... - X509StoreName1TrustedPeople X509StoreName1 = "TrustedPeople" - // X509StoreName1TrustedPublisher ... - X509StoreName1TrustedPublisher X509StoreName1 = "TrustedPublisher" -) - -// PossibleX509StoreName1Values returns an array of possible values for the X509StoreName1 const type. -func PossibleX509StoreName1Values() []X509StoreName1 { - return []X509StoreName1{X509StoreName1AddressBook, X509StoreName1AuthRoot, X509StoreName1CertificateAuthority, X509StoreName1Disallowed, X509StoreName1My, X509StoreName1Root, X509StoreName1TrustedPeople, X509StoreName1TrustedPublisher} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/models.go deleted file mode 100644 index 145537b3cb61..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/models.go +++ /dev/null @@ -1,4342 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric" - -// ApplicationDeltaHealthPolicy defines a delta health policy used to evaluate the health of an application -// or one of its child entities when upgrading the cluster. -type ApplicationDeltaHealthPolicy struct { - // DefaultServiceTypeDeltaHealthPolicy - The delta health policy used by default to evaluate the health of a service type when upgrading the cluster. - DefaultServiceTypeDeltaHealthPolicy *ServiceTypeDeltaHealthPolicy `json:"defaultServiceTypeDeltaHealthPolicy,omitempty"` - // ServiceTypeDeltaHealthPolicies - The map with service type delta health policy per service type name. The map is empty by default. - ServiceTypeDeltaHealthPolicies map[string]*ServiceTypeDeltaHealthPolicy `json:"serviceTypeDeltaHealthPolicies"` -} - -// MarshalJSON is the custom marshaler for ApplicationDeltaHealthPolicy. -func (adhp ApplicationDeltaHealthPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if adhp.DefaultServiceTypeDeltaHealthPolicy != nil { - objectMap["defaultServiceTypeDeltaHealthPolicy"] = adhp.DefaultServiceTypeDeltaHealthPolicy - } - if adhp.ServiceTypeDeltaHealthPolicies != nil { - objectMap["serviceTypeDeltaHealthPolicies"] = adhp.ServiceTypeDeltaHealthPolicies - } - return json.Marshal(objectMap) -} - -// ApplicationHealthPolicy defines a health policy used to evaluate the health of an application or one of -// its children entities. -type ApplicationHealthPolicy struct { - // DefaultServiceTypeHealthPolicy - The health policy used by default to evaluate the health of a service type. - DefaultServiceTypeHealthPolicy *ServiceTypeHealthPolicy `json:"defaultServiceTypeHealthPolicy,omitempty"` - // ServiceTypeHealthPolicies - The map with service type health policy per service type name. The map is empty by default. - ServiceTypeHealthPolicies map[string]*ServiceTypeHealthPolicy `json:"serviceTypeHealthPolicies"` -} - -// MarshalJSON is the custom marshaler for ApplicationHealthPolicy. -func (ahp ApplicationHealthPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ahp.DefaultServiceTypeHealthPolicy != nil { - objectMap["defaultServiceTypeHealthPolicy"] = ahp.DefaultServiceTypeHealthPolicy - } - if ahp.ServiceTypeHealthPolicies != nil { - objectMap["serviceTypeHealthPolicies"] = ahp.ServiceTypeHealthPolicies - } - return json.Marshal(objectMap) -} - -// ApplicationMetricDescription describes capacity information for a custom resource balancing metric. This -// can be used to limit the total consumption of this metric by the services of this application. -type ApplicationMetricDescription struct { - // Name - The name of the metric. - Name *string `json:"name,omitempty"` - // MaximumCapacity - The maximum node capacity for Service Fabric application. - // This is the maximum Load for an instance of this application on a single node. Even if the capacity of node is greater than this value, Service Fabric will limit the total load of services within the application on each node to this value. - // If set to zero, capacity for this metric is unlimited on each node. - // When creating a new application with application capacity defined, the product of MaximumNodes and this value must always be smaller than or equal to TotalApplicationCapacity. - // When updating existing application with application capacity, the product of MaximumNodes and this value must always be smaller than or equal to TotalApplicationCapacity. - MaximumCapacity *int64 `json:"maximumCapacity,omitempty"` - // ReservationCapacity - The node reservation capacity for Service Fabric application. - // This is the amount of load which is reserved on nodes which have instances of this application. - // If MinimumNodes is specified, then the product of these values will be the capacity reserved in the cluster for the application. - // If set to zero, no capacity is reserved for this metric. - // When setting application capacity or when updating application capacity; this value must be smaller than or equal to MaximumCapacity for each metric. - ReservationCapacity *int64 `json:"reservationCapacity,omitempty"` - // TotalApplicationCapacity - The total metric capacity for Service Fabric application. - // This is the total metric capacity for this application in the cluster. Service Fabric will try to limit the sum of loads of services within the application to this value. - // When creating a new application with application capacity defined, the product of MaximumNodes and MaximumCapacity must always be smaller than or equal to this value. - TotalApplicationCapacity *int64 `json:"totalApplicationCapacity,omitempty"` -} - -// ApplicationResource the application resource. -type ApplicationResource struct { - autorest.Response `json:"-"` - Identity *ManagedIdentity `json:"identity,omitempty"` - *ApplicationResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - It will be deprecated in New API, resource location depends on the parent resource. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationResource. -func (ar ApplicationResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Identity != nil { - objectMap["identity"] = ar.Identity - } - if ar.ApplicationResourceProperties != nil { - objectMap["properties"] = ar.ApplicationResourceProperties - } - if ar.Location != nil { - objectMap["location"] = ar.Location - } - if ar.Tags != nil { - objectMap["tags"] = ar.Tags - } - if ar.SystemData != nil { - objectMap["systemData"] = ar.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationResource struct. -func (ar *ApplicationResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "identity": - if v != nil { - var identity ManagedIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ar.Identity = &identity - } - case "properties": - if v != nil { - var applicationResourceProperties ApplicationResourceProperties - err = json.Unmarshal(*v, &applicationResourceProperties) - if err != nil { - return err - } - ar.ApplicationResourceProperties = &applicationResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ar.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ar.Etag = &etag - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ar.SystemData = &systemData - } - } - } - - return nil -} - -// ApplicationResourceList the list of application resources. -type ApplicationResourceList struct { - autorest.Response `json:"-"` - Value *[]ApplicationResource `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of application list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationResourceList. -func (arl ApplicationResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arl.Value != nil { - objectMap["value"] = arl.Value - } - return json.Marshal(objectMap) -} - -// ApplicationResourceProperties the application resource properties. -type ApplicationResourceProperties struct { - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response - ProvisioningState *string `json:"provisioningState,omitempty"` - TypeName *string `json:"typeName,omitempty"` - TypeVersion *string `json:"typeVersion,omitempty"` - Parameters map[string]*string `json:"parameters"` - UpgradePolicy *ApplicationUpgradePolicy `json:"upgradePolicy,omitempty"` - // MinimumNodes - The minimum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property. - MinimumNodes *int64 `json:"minimumNodes,omitempty"` - // MaximumNodes - The maximum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. By default, the value of this property is zero and it means that the services can be placed on any node. - MaximumNodes *int64 `json:"maximumNodes,omitempty"` - // RemoveApplicationCapacity - Remove the current application capacity settings. - RemoveApplicationCapacity *bool `json:"removeApplicationCapacity,omitempty"` - Metrics *[]ApplicationMetricDescription `json:"metrics,omitempty"` - // ManagedIdentities - List of user assigned identities for the application, each mapped to a friendly name. - ManagedIdentities *[]ApplicationUserAssignedIdentity `json:"managedIdentities,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationResourceProperties. -func (arp ApplicationResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arp.TypeName != nil { - objectMap["typeName"] = arp.TypeName - } - if arp.TypeVersion != nil { - objectMap["typeVersion"] = arp.TypeVersion - } - if arp.Parameters != nil { - objectMap["parameters"] = arp.Parameters - } - if arp.UpgradePolicy != nil { - objectMap["upgradePolicy"] = arp.UpgradePolicy - } - if arp.MinimumNodes != nil { - objectMap["minimumNodes"] = arp.MinimumNodes - } - if arp.MaximumNodes != nil { - objectMap["maximumNodes"] = arp.MaximumNodes - } - if arp.RemoveApplicationCapacity != nil { - objectMap["removeApplicationCapacity"] = arp.RemoveApplicationCapacity - } - if arp.Metrics != nil { - objectMap["metrics"] = arp.Metrics - } - if arp.ManagedIdentities != nil { - objectMap["managedIdentities"] = arp.ManagedIdentities - } - return json.Marshal(objectMap) -} - -// ApplicationResourceUpdate the application resource for patch operations. -type ApplicationResourceUpdate struct { - *ApplicationResourceUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - It will be deprecated in New API, resource location depends on the parent resource. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationResourceUpdate. -func (aru ApplicationResourceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aru.ApplicationResourceUpdateProperties != nil { - objectMap["properties"] = aru.ApplicationResourceUpdateProperties - } - if aru.Location != nil { - objectMap["location"] = aru.Location - } - if aru.Tags != nil { - objectMap["tags"] = aru.Tags - } - if aru.SystemData != nil { - objectMap["systemData"] = aru.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationResourceUpdate struct. -func (aru *ApplicationResourceUpdate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationResourceUpdateProperties ApplicationResourceUpdateProperties - err = json.Unmarshal(*v, &applicationResourceUpdateProperties) - if err != nil { - return err - } - aru.ApplicationResourceUpdateProperties = &applicationResourceUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - aru.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - aru.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - aru.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - aru.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - aru.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - aru.Etag = &etag - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - aru.SystemData = &systemData - } - } - } - - return nil -} - -// ApplicationResourceUpdateProperties the application resource properties for patch operations. -type ApplicationResourceUpdateProperties struct { - TypeVersion *string `json:"typeVersion,omitempty"` - Parameters map[string]*string `json:"parameters"` - UpgradePolicy *ApplicationUpgradePolicy `json:"upgradePolicy,omitempty"` - // MinimumNodes - The minimum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property. - MinimumNodes *int64 `json:"minimumNodes,omitempty"` - // MaximumNodes - The maximum number of nodes where Service Fabric will reserve capacity for this application. Note that this does not mean that the services of this application will be placed on all of those nodes. By default, the value of this property is zero and it means that the services can be placed on any node. - MaximumNodes *int64 `json:"maximumNodes,omitempty"` - // RemoveApplicationCapacity - Remove the current application capacity settings. - RemoveApplicationCapacity *bool `json:"removeApplicationCapacity,omitempty"` - Metrics *[]ApplicationMetricDescription `json:"metrics,omitempty"` - // ManagedIdentities - List of user assigned identities for the application, each mapped to a friendly name. - ManagedIdentities *[]ApplicationUserAssignedIdentity `json:"managedIdentities,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationResourceUpdateProperties. -func (arup ApplicationResourceUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arup.TypeVersion != nil { - objectMap["typeVersion"] = arup.TypeVersion - } - if arup.Parameters != nil { - objectMap["parameters"] = arup.Parameters - } - if arup.UpgradePolicy != nil { - objectMap["upgradePolicy"] = arup.UpgradePolicy - } - if arup.MinimumNodes != nil { - objectMap["minimumNodes"] = arup.MinimumNodes - } - if arup.MaximumNodes != nil { - objectMap["maximumNodes"] = arup.MaximumNodes - } - if arup.RemoveApplicationCapacity != nil { - objectMap["removeApplicationCapacity"] = arup.RemoveApplicationCapacity - } - if arup.Metrics != nil { - objectMap["metrics"] = arup.Metrics - } - if arup.ManagedIdentities != nil { - objectMap["managedIdentities"] = arup.ManagedIdentities - } - return json.Marshal(objectMap) -} - -// ApplicationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ApplicationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationsClient) (ApplicationResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationsCreateOrUpdateFuture.Result. -func (future *ApplicationsCreateOrUpdateFuture) result(client ApplicationsClient) (ar ApplicationResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { - ar, err = client.CreateOrUpdateResponder(ar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsCreateOrUpdateFuture", "Result", ar.Response.Response, "Failure responding to request") - } - } - return -} - -// ApplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ApplicationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationsDeleteFuture.Result. -func (future *ApplicationsDeleteFuture) result(client ApplicationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ApplicationsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationsClient) (ApplicationResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationsUpdateFuture.Result. -func (future *ApplicationsUpdateFuture) result(client ApplicationsClient) (ar ApplicationResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { - ar, err = client.UpdateResponder(ar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationsUpdateFuture", "Result", ar.Response.Response, "Failure responding to request") - } - } - return -} - -// ApplicationTypeResource the application type name resource -type ApplicationTypeResource struct { - autorest.Response `json:"-"` - *ApplicationTypeResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - It will be deprecated in New API, resource location depends on the parent resource. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationTypeResource. -func (atr ApplicationTypeResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atr.ApplicationTypeResourceProperties != nil { - objectMap["properties"] = atr.ApplicationTypeResourceProperties - } - if atr.Location != nil { - objectMap["location"] = atr.Location - } - if atr.Tags != nil { - objectMap["tags"] = atr.Tags - } - if atr.SystemData != nil { - objectMap["systemData"] = atr.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationTypeResource struct. -func (atr *ApplicationTypeResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationTypeResourceProperties ApplicationTypeResourceProperties - err = json.Unmarshal(*v, &applicationTypeResourceProperties) - if err != nil { - return err - } - atr.ApplicationTypeResourceProperties = &applicationTypeResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - atr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - atr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - atr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - atr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - atr.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - atr.Etag = &etag - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - atr.SystemData = &systemData - } - } - } - - return nil -} - -// ApplicationTypeResourceList the list of application type names. -type ApplicationTypeResourceList struct { - autorest.Response `json:"-"` - Value *[]ApplicationTypeResource `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of application type list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationTypeResourceList. -func (atrl ApplicationTypeResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atrl.Value != nil { - objectMap["value"] = atrl.Value - } - return json.Marshal(objectMap) -} - -// ApplicationTypeResourceProperties the application type name properties -type ApplicationTypeResourceProperties struct { - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationTypeResourceProperties. -func (atrp ApplicationTypeResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ApplicationTypesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ApplicationTypesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationTypesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationTypesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationTypesDeleteFuture.Result. -func (future *ApplicationTypesDeleteFuture) result(client ApplicationTypesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationTypesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationTypeVersionResource an application type version resource for the specified application type -// name resource. -type ApplicationTypeVersionResource struct { - autorest.Response `json:"-"` - *ApplicationTypeVersionResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - It will be deprecated in New API, resource location depends on the parent resource. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationTypeVersionResource. -func (atvr ApplicationTypeVersionResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atvr.ApplicationTypeVersionResourceProperties != nil { - objectMap["properties"] = atvr.ApplicationTypeVersionResourceProperties - } - if atvr.Location != nil { - objectMap["location"] = atvr.Location - } - if atvr.Tags != nil { - objectMap["tags"] = atvr.Tags - } - if atvr.SystemData != nil { - objectMap["systemData"] = atvr.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationTypeVersionResource struct. -func (atvr *ApplicationTypeVersionResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationTypeVersionResourceProperties ApplicationTypeVersionResourceProperties - err = json.Unmarshal(*v, &applicationTypeVersionResourceProperties) - if err != nil { - return err - } - atvr.ApplicationTypeVersionResourceProperties = &applicationTypeVersionResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - atvr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - atvr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - atvr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - atvr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - atvr.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - atvr.Etag = &etag - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - atvr.SystemData = &systemData - } - } - } - - return nil -} - -// ApplicationTypeVersionResourceList the list of application type version resources for the specified -// application type name resource. -type ApplicationTypeVersionResourceList struct { - autorest.Response `json:"-"` - Value *[]ApplicationTypeVersionResource `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of application type version list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationTypeVersionResourceList. -func (atvrl ApplicationTypeVersionResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atvrl.Value != nil { - objectMap["value"] = atvrl.Value - } - return json.Marshal(objectMap) -} - -// ApplicationTypeVersionResourceProperties the properties of the application type version resource. -type ApplicationTypeVersionResourceProperties struct { - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response - ProvisioningState *string `json:"provisioningState,omitempty"` - // AppPackageURL - The URL to the application package - AppPackageURL *string `json:"appPackageUrl,omitempty"` - // DefaultParameterList - READ-ONLY - DefaultParameterList map[string]*string `json:"defaultParameterList"` -} - -// MarshalJSON is the custom marshaler for ApplicationTypeVersionResourceProperties. -func (atvrp ApplicationTypeVersionResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atvrp.AppPackageURL != nil { - objectMap["appPackageUrl"] = atvrp.AppPackageURL - } - return json.Marshal(objectMap) -} - -// ApplicationTypeVersionsCleanupPolicy ... -type ApplicationTypeVersionsCleanupPolicy struct { - // MaxUnusedVersionsToKeep - Number of unused versions per application type to keep. - MaxUnusedVersionsToKeep *int64 `json:"maxUnusedVersionsToKeep,omitempty"` -} - -// ApplicationTypeVersionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type ApplicationTypeVersionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationTypeVersionsClient) (ApplicationTypeVersionResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationTypeVersionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationTypeVersionsCreateOrUpdateFuture.Result. -func (future *ApplicationTypeVersionsCreateOrUpdateFuture) result(client ApplicationTypeVersionsClient) (atvr ApplicationTypeVersionResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - atvr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationTypeVersionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if atvr.Response.Response, err = future.GetResult(sender); err == nil && atvr.Response.Response.StatusCode != http.StatusNoContent { - atvr, err = client.CreateOrUpdateResponder(atvr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsCreateOrUpdateFuture", "Result", atvr.Response.Response, "Failure responding to request") - } - } - return -} - -// ApplicationTypeVersionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ApplicationTypeVersionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationTypeVersionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationTypeVersionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationTypeVersionsDeleteFuture.Result. -func (future *ApplicationTypeVersionsDeleteFuture) result(client ApplicationTypeVersionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ApplicationTypeVersionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ApplicationTypeVersionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationUpgradePolicy describes the policy for a monitored application upgrade. -type ApplicationUpgradePolicy struct { - // UpgradeReplicaSetCheckTimeout - The maximum amount of time to block processing of an upgrade domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each upgrade domain. Valid values are between 0 and 42949672925 inclusive. (unsigned 32-bit integer). - UpgradeReplicaSetCheckTimeout *string `json:"upgradeReplicaSetCheckTimeout,omitempty"` - ForceRestart *bool `json:"forceRestart,omitempty"` - RollingUpgradeMonitoringPolicy *ArmRollingUpgradeMonitoringPolicy `json:"rollingUpgradeMonitoringPolicy,omitempty"` - ApplicationHealthPolicy *ArmApplicationHealthPolicy `json:"applicationHealthPolicy,omitempty"` - // UpgradeMode - Possible values include: 'RollingUpgradeModeInvalid', 'RollingUpgradeModeUnmonitoredAuto', 'RollingUpgradeModeUnmonitoredManual', 'RollingUpgradeModeMonitored' - UpgradeMode RollingUpgradeMode `json:"upgradeMode,omitempty"` - // RecreateApplication - Determines whether the application should be recreated on update. If value=true, the rest of the upgrade policy parameters are not allowed and it will result in availability loss. - RecreateApplication *bool `json:"recreateApplication,omitempty"` -} - -// ApplicationUserAssignedIdentity ... -type ApplicationUserAssignedIdentity struct { - // Name - The friendly name of user assigned identity. - Name *string `json:"name,omitempty"` - // PrincipalID - The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` -} - -// ArmApplicationHealthPolicy defines a health policy used to evaluate the health of an application or one -// of its children entities. -type ArmApplicationHealthPolicy struct { - // ConsiderWarningAsError - Indicates whether warnings are treated with the same severity as errors. - ConsiderWarningAsError *bool `json:"considerWarningAsError,omitempty"` - // MaxPercentUnhealthyDeployedApplications - The maximum allowed percentage of unhealthy deployed applications. Allowed values are Byte values from zero to 100. - // The percentage represents the maximum tolerated percentage of deployed applications that can be unhealthy before the application is considered in error. - // This is calculated by dividing the number of unhealthy deployed applications over the number of nodes where the application is currently deployed on in the cluster. - // The computation rounds up to tolerate one failure on small numbers of nodes. Default percentage is zero. - MaxPercentUnhealthyDeployedApplications *int32 `json:"maxPercentUnhealthyDeployedApplications,omitempty"` - // DefaultServiceTypeHealthPolicy - The health policy used by default to evaluate the health of a service type. - DefaultServiceTypeHealthPolicy *ArmServiceTypeHealthPolicy `json:"defaultServiceTypeHealthPolicy,omitempty"` - // ServiceTypeHealthPolicyMap - The map with service type health policy per service type name. The map is empty by default. - ServiceTypeHealthPolicyMap map[string]*ArmServiceTypeHealthPolicy `json:"serviceTypeHealthPolicyMap"` -} - -// MarshalJSON is the custom marshaler for ArmApplicationHealthPolicy. -func (aahp ArmApplicationHealthPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aahp.ConsiderWarningAsError != nil { - objectMap["considerWarningAsError"] = aahp.ConsiderWarningAsError - } - if aahp.MaxPercentUnhealthyDeployedApplications != nil { - objectMap["maxPercentUnhealthyDeployedApplications"] = aahp.MaxPercentUnhealthyDeployedApplications - } - if aahp.DefaultServiceTypeHealthPolicy != nil { - objectMap["defaultServiceTypeHealthPolicy"] = aahp.DefaultServiceTypeHealthPolicy - } - if aahp.ServiceTypeHealthPolicyMap != nil { - objectMap["serviceTypeHealthPolicyMap"] = aahp.ServiceTypeHealthPolicyMap - } - return json.Marshal(objectMap) -} - -// ArmRollingUpgradeMonitoringPolicy the policy used for monitoring the application upgrade -type ArmRollingUpgradeMonitoringPolicy struct { - // FailureAction - The activation Mode of the service package. Possible values include: 'ArmUpgradeFailureActionRollback', 'ArmUpgradeFailureActionManual' - FailureAction ArmUpgradeFailureAction `json:"failureAction,omitempty"` - HealthCheckWaitDuration *string `json:"healthCheckWaitDuration,omitempty"` - HealthCheckStableDuration *string `json:"healthCheckStableDuration,omitempty"` - HealthCheckRetryTimeout *string `json:"healthCheckRetryTimeout,omitempty"` - UpgradeTimeout *string `json:"upgradeTimeout,omitempty"` - UpgradeDomainTimeout *string `json:"upgradeDomainTimeout,omitempty"` -} - -// ArmServiceTypeHealthPolicy represents the health policy used to evaluate the health of services -// belonging to a service type. -type ArmServiceTypeHealthPolicy struct { - // MaxPercentUnhealthyServices - The maximum percentage of services allowed to be unhealthy before your application is considered in error. - MaxPercentUnhealthyServices *int32 `json:"maxPercentUnhealthyServices,omitempty"` - // MaxPercentUnhealthyPartitionsPerService - The maximum percentage of partitions per service allowed to be unhealthy before your application is considered in error. - MaxPercentUnhealthyPartitionsPerService *int32 `json:"maxPercentUnhealthyPartitionsPerService,omitempty"` - // MaxPercentUnhealthyReplicasPerPartition - The maximum percentage of replicas per partition allowed to be unhealthy before your application is considered in error. - MaxPercentUnhealthyReplicasPerPartition *int32 `json:"maxPercentUnhealthyReplicasPerPartition,omitempty"` -} - -// AvailableOperationDisplay operation supported by the Service Fabric resource provider -type AvailableOperationDisplay struct { - // Provider - The name of the provider. - Provider *string `json:"provider,omitempty"` - // Resource - The resource on which the operation is performed - Resource *string `json:"resource,omitempty"` - // Operation - The operation that can be performed. - Operation *string `json:"operation,omitempty"` - // Description - Operation description - Description *string `json:"description,omitempty"` -} - -// AzureActiveDirectory the settings to enable AAD authentication on the cluster. -type AzureActiveDirectory struct { - // TenantID - Azure active directory tenant id. - TenantID *string `json:"tenantId,omitempty"` - // ClusterApplication - Azure active directory cluster application id. - ClusterApplication *string `json:"clusterApplication,omitempty"` - // ClientApplication - Azure active directory client application id. - ClientApplication *string `json:"clientApplication,omitempty"` -} - -// CertificateDescription describes the certificate details. -type CertificateDescription struct { - // Thumbprint - Thumbprint of the primary certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // ThumbprintSecondary - Thumbprint of the secondary certificate. - ThumbprintSecondary *string `json:"thumbprintSecondary,omitempty"` - // X509StoreName - Possible values include: 'X509StoreNameAddressBook', 'X509StoreNameAuthRoot', 'X509StoreNameCertificateAuthority', 'X509StoreNameDisallowed', 'X509StoreNameMy', 'X509StoreNameRoot', 'X509StoreNameTrustedPeople', 'X509StoreNameTrustedPublisher' - X509StoreName X509StoreName `json:"x509StoreName,omitempty"` -} - -// ClientCertificateCommonName describes the client certificate details using common name. -type ClientCertificateCommonName struct { - // IsAdmin - Indicates if the client certificate has admin access to the cluster. Non admin clients can perform only read only operations on the cluster. - IsAdmin *bool `json:"isAdmin,omitempty"` - // CertificateCommonName - The common name of the client certificate. - CertificateCommonName *string `json:"certificateCommonName,omitempty"` - // CertificateIssuerThumbprint - The issuer thumbprint of the client certificate. - CertificateIssuerThumbprint *string `json:"certificateIssuerThumbprint,omitempty"` -} - -// ClientCertificateThumbprint describes the client certificate details using thumbprint. -type ClientCertificateThumbprint struct { - // IsAdmin - Indicates if the client certificate has admin access to the cluster. Non admin clients can perform only read only operations on the cluster. - IsAdmin *bool `json:"isAdmin,omitempty"` - // CertificateThumbprint - The thumbprint of the client certificate. - CertificateThumbprint *string `json:"certificateThumbprint,omitempty"` -} - -// Cluster the cluster resource -type Cluster struct { - autorest.Response `json:"-"` - // ClusterProperties - The cluster resource properties - *ClusterProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - Azure resource location. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Cluster. -func (c Cluster) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.ClusterProperties != nil { - objectMap["properties"] = c.ClusterProperties - } - if c.Location != nil { - objectMap["location"] = c.Location - } - if c.Tags != nil { - objectMap["tags"] = c.Tags - } - if c.SystemData != nil { - objectMap["systemData"] = c.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Cluster struct. -func (c *Cluster) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var clusterProperties ClusterProperties - err = json.Unmarshal(*v, &clusterProperties) - if err != nil { - return err - } - c.ClusterProperties = &clusterProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - c.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - c.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - c.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - c.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - c.Etag = &etag - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - c.SystemData = &systemData - } - } - } - - return nil -} - -// ClusterCodeVersionsListResult the list results of the Service Fabric runtime versions. -type ClusterCodeVersionsListResult struct { - autorest.Response `json:"-"` - Value *[]ClusterCodeVersionsResult `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ClusterCodeVersionsResult the result of the Service Fabric runtime versions -type ClusterCodeVersionsResult struct { - // ID - The identification of the result - ID *string `json:"id,omitempty"` - // Name - The name of the result - Name *string `json:"name,omitempty"` - // Type - The result resource type - Type *string `json:"type,omitempty"` - *ClusterVersionDetails `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterCodeVersionsResult. -func (ccvr ClusterCodeVersionsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccvr.ID != nil { - objectMap["id"] = ccvr.ID - } - if ccvr.Name != nil { - objectMap["name"] = ccvr.Name - } - if ccvr.Type != nil { - objectMap["type"] = ccvr.Type - } - if ccvr.ClusterVersionDetails != nil { - objectMap["properties"] = ccvr.ClusterVersionDetails - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ClusterCodeVersionsResult struct. -func (ccvr *ClusterCodeVersionsResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ccvr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ccvr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ccvr.Type = &typeVar - } - case "properties": - if v != nil { - var clusterVersionDetails ClusterVersionDetails - err = json.Unmarshal(*v, &clusterVersionDetails) - if err != nil { - return err - } - ccvr.ClusterVersionDetails = &clusterVersionDetails - } - } - } - - return nil -} - -// ClusterHealthPolicy defines a health policy used to evaluate the health of the cluster or of a cluster -// node. -type ClusterHealthPolicy struct { - // MaxPercentUnhealthyNodes - The maximum allowed percentage of unhealthy nodes before reporting an error. For example, to allow 10% of nodes to be unhealthy, this value would be 10. - // The percentage represents the maximum tolerated percentage of nodes that can be unhealthy before the cluster is considered in error. - // If the percentage is respected but there is at least one unhealthy node, the health is evaluated as Warning. - // The percentage is calculated by dividing the number of unhealthy nodes over the total number of nodes in the cluster. - // The computation rounds up to tolerate one failure on small numbers of nodes. Default percentage is zero. - // In large clusters, some nodes will always be down or out for repairs, so this percentage should be configured to tolerate that. - MaxPercentUnhealthyNodes *int32 `json:"maxPercentUnhealthyNodes,omitempty"` - // MaxPercentUnhealthyApplications - The maximum allowed percentage of unhealthy applications before reporting an error. For example, to allow 10% of applications to be unhealthy, this value would be 10. - // The percentage represents the maximum tolerated percentage of applications that can be unhealthy before the cluster is considered in error. - // If the percentage is respected but there is at least one unhealthy application, the health is evaluated as Warning. - // This is calculated by dividing the number of unhealthy applications over the total number of application instances in the cluster, excluding applications of application types that are included in the ApplicationTypeHealthPolicyMap. - // The computation rounds up to tolerate one failure on small numbers of applications. Default percentage is zero. - MaxPercentUnhealthyApplications *int32 `json:"maxPercentUnhealthyApplications,omitempty"` - // ApplicationHealthPolicies - Defines the application health policy map used to evaluate the health of an application or one of its children entities. - ApplicationHealthPolicies map[string]*ApplicationHealthPolicy `json:"applicationHealthPolicies"` -} - -// MarshalJSON is the custom marshaler for ClusterHealthPolicy. -func (chp ClusterHealthPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if chp.MaxPercentUnhealthyNodes != nil { - objectMap["maxPercentUnhealthyNodes"] = chp.MaxPercentUnhealthyNodes - } - if chp.MaxPercentUnhealthyApplications != nil { - objectMap["maxPercentUnhealthyApplications"] = chp.MaxPercentUnhealthyApplications - } - if chp.ApplicationHealthPolicies != nil { - objectMap["applicationHealthPolicies"] = chp.ApplicationHealthPolicies - } - return json.Marshal(objectMap) -} - -// ClusterListResult cluster list results -type ClusterListResult struct { - autorest.Response `json:"-"` - Value *[]Cluster `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ClusterProperties describes the cluster resource properties. -type ClusterProperties struct { - // AddOnFeatures - The list of add-on features to enable in the cluster. - AddOnFeatures *[]string `json:"addOnFeatures,omitempty"` - // AvailableClusterVersions - READ-ONLY; The Service Fabric runtime versions available for this cluster. - AvailableClusterVersions *[]ClusterVersionDetails `json:"availableClusterVersions,omitempty"` - // AzureActiveDirectory - The AAD authentication settings of the cluster. - AzureActiveDirectory *AzureActiveDirectory `json:"azureActiveDirectory,omitempty"` - // Certificate - The certificate to use for securing the cluster. The certificate provided will be used for node to node security within the cluster, SSL certificate for cluster management endpoint and default admin client. - Certificate *CertificateDescription `json:"certificate,omitempty"` - CertificateCommonNames *ServerCertificateCommonNames `json:"certificateCommonNames,omitempty"` - // ClientCertificateCommonNames - The list of client certificates referenced by common name that are allowed to manage the cluster. - ClientCertificateCommonNames *[]ClientCertificateCommonName `json:"clientCertificateCommonNames,omitempty"` - // ClientCertificateThumbprints - The list of client certificates referenced by thumbprint that are allowed to manage the cluster. - ClientCertificateThumbprints *[]ClientCertificateThumbprint `json:"clientCertificateThumbprints,omitempty"` - // ClusterCodeVersion - The Service Fabric runtime version of the cluster. This property can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available Service Fabric versions for new clusters use [ClusterVersion API](./ClusterVersion.md). To get the list of available version for existing clusters use **availableClusterVersions**. - ClusterCodeVersion *string `json:"clusterCodeVersion,omitempty"` - // ClusterEndpoint - READ-ONLY; The Azure Resource Provider endpoint. A system service in the cluster connects to this endpoint. - ClusterEndpoint *string `json:"clusterEndpoint,omitempty"` - // ClusterID - READ-ONLY; A service generated unique identifier for the cluster resource. - ClusterID *string `json:"clusterId,omitempty"` - // ClusterState - READ-ONLY; Possible values include: 'ClusterStateWaitingForNodes', 'ClusterStateDeploying', 'ClusterStateBaselineUpgrade', 'ClusterStateUpdatingUserConfiguration', 'ClusterStateUpdatingUserCertificate', 'ClusterStateUpdatingInfrastructure', 'ClusterStateEnforcingClusterVersion', 'ClusterStateUpgradeServiceUnreachable', 'ClusterStateAutoScale', 'ClusterStateReady' - ClusterState ClusterState `json:"clusterState,omitempty"` - // DiagnosticsStorageAccountConfig - The storage account information for storing Service Fabric diagnostic logs. - DiagnosticsStorageAccountConfig *DiagnosticsStorageAccountConfig `json:"diagnosticsStorageAccountConfig,omitempty"` - // EventStoreServiceEnabled - Indicates if the event store service is enabled. - EventStoreServiceEnabled *bool `json:"eventStoreServiceEnabled,omitempty"` - // FabricSettings - The list of custom fabric settings to configure the cluster. - FabricSettings *[]SettingsSectionDescription `json:"fabricSettings,omitempty"` - // ManagementEndpoint - The http management endpoint of the cluster. - ManagementEndpoint *string `json:"managementEndpoint,omitempty"` - // NodeTypes - The list of node types in the cluster. - NodeTypes *[]NodeTypeDescription `json:"nodeTypes,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the cluster resource. Possible values include: 'ProvisioningStateUpdating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ReliabilityLevel - Possible values include: 'ReliabilityLevelNone', 'ReliabilityLevelBronze', 'ReliabilityLevelSilver', 'ReliabilityLevelGold', 'ReliabilityLevelPlatinum' - ReliabilityLevel ReliabilityLevel `json:"reliabilityLevel,omitempty"` - // ReverseProxyCertificate - The server certificate used by reverse proxy. - ReverseProxyCertificate *CertificateDescription `json:"reverseProxyCertificate,omitempty"` - ReverseProxyCertificateCommonNames *ServerCertificateCommonNames `json:"reverseProxyCertificateCommonNames,omitempty"` - // UpgradeDescription - The policy to use when upgrading the cluster. - UpgradeDescription *ClusterUpgradePolicy `json:"upgradeDescription,omitempty"` - // UpgradeMode - Possible values include: 'UpgradeModeAutomatic', 'UpgradeModeManual' - UpgradeMode UpgradeMode `json:"upgradeMode,omitempty"` - // ApplicationTypeVersionsCleanupPolicy - The policy used to clean up unused versions. - ApplicationTypeVersionsCleanupPolicy *ApplicationTypeVersionsCleanupPolicy `json:"applicationTypeVersionsCleanupPolicy,omitempty"` - // VMImage - The VM image VMSS has been configured with. Generic names such as Windows or Linux can be used. - VMImage *string `json:"vmImage,omitempty"` - // SfZonalUpgradeMode - Possible values include: 'SfZonalUpgradeModeParallel', 'SfZonalUpgradeModeHierarchical' - SfZonalUpgradeMode SfZonalUpgradeMode `json:"sfZonalUpgradeMode,omitempty"` - // VmssZonalUpgradeMode - Possible values include: 'VmssZonalUpgradeModeParallel', 'VmssZonalUpgradeModeHierarchical' - VmssZonalUpgradeMode VmssZonalUpgradeMode `json:"vmssZonalUpgradeMode,omitempty"` - // InfrastructureServiceManager - Indicates if infrastructure service manager is enabled. - InfrastructureServiceManager *bool `json:"infrastructureServiceManager,omitempty"` - // UpgradeWave - Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. Only applies when **upgradeMode** is set to 'Automatic'. Possible values include: 'ClusterUpgradeCadenceWave0', 'ClusterUpgradeCadenceWave1', 'ClusterUpgradeCadenceWave2' - UpgradeWave ClusterUpgradeCadence `json:"upgradeWave,omitempty"` - // UpgradePauseStartTimestampUtc - Indicates the start date and time to pause automatic runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). - UpgradePauseStartTimestampUtc *date.Time `json:"upgradePauseStartTimestampUtc,omitempty"` - // UpgradePauseEndTimestampUtc - Indicates the end date and time to pause automatic runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). - UpgradePauseEndTimestampUtc *date.Time `json:"upgradePauseEndTimestampUtc,omitempty"` - // WaveUpgradePaused - Boolean to pause automatic runtime version upgrades to the cluster. - WaveUpgradePaused *bool `json:"waveUpgradePaused,omitempty"` - // Notifications - Indicates a list of notification channels for cluster events. - Notifications *[]Notification `json:"notifications,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterProperties. -func (cp ClusterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.AddOnFeatures != nil { - objectMap["addOnFeatures"] = cp.AddOnFeatures - } - if cp.AzureActiveDirectory != nil { - objectMap["azureActiveDirectory"] = cp.AzureActiveDirectory - } - if cp.Certificate != nil { - objectMap["certificate"] = cp.Certificate - } - if cp.CertificateCommonNames != nil { - objectMap["certificateCommonNames"] = cp.CertificateCommonNames - } - if cp.ClientCertificateCommonNames != nil { - objectMap["clientCertificateCommonNames"] = cp.ClientCertificateCommonNames - } - if cp.ClientCertificateThumbprints != nil { - objectMap["clientCertificateThumbprints"] = cp.ClientCertificateThumbprints - } - if cp.ClusterCodeVersion != nil { - objectMap["clusterCodeVersion"] = cp.ClusterCodeVersion - } - if cp.DiagnosticsStorageAccountConfig != nil { - objectMap["diagnosticsStorageAccountConfig"] = cp.DiagnosticsStorageAccountConfig - } - if cp.EventStoreServiceEnabled != nil { - objectMap["eventStoreServiceEnabled"] = cp.EventStoreServiceEnabled - } - if cp.FabricSettings != nil { - objectMap["fabricSettings"] = cp.FabricSettings - } - if cp.ManagementEndpoint != nil { - objectMap["managementEndpoint"] = cp.ManagementEndpoint - } - if cp.NodeTypes != nil { - objectMap["nodeTypes"] = cp.NodeTypes - } - if cp.ReliabilityLevel != "" { - objectMap["reliabilityLevel"] = cp.ReliabilityLevel - } - if cp.ReverseProxyCertificate != nil { - objectMap["reverseProxyCertificate"] = cp.ReverseProxyCertificate - } - if cp.ReverseProxyCertificateCommonNames != nil { - objectMap["reverseProxyCertificateCommonNames"] = cp.ReverseProxyCertificateCommonNames - } - if cp.UpgradeDescription != nil { - objectMap["upgradeDescription"] = cp.UpgradeDescription - } - if cp.UpgradeMode != "" { - objectMap["upgradeMode"] = cp.UpgradeMode - } - if cp.ApplicationTypeVersionsCleanupPolicy != nil { - objectMap["applicationTypeVersionsCleanupPolicy"] = cp.ApplicationTypeVersionsCleanupPolicy - } - if cp.VMImage != nil { - objectMap["vmImage"] = cp.VMImage - } - if cp.SfZonalUpgradeMode != "" { - objectMap["sfZonalUpgradeMode"] = cp.SfZonalUpgradeMode - } - if cp.VmssZonalUpgradeMode != "" { - objectMap["vmssZonalUpgradeMode"] = cp.VmssZonalUpgradeMode - } - if cp.InfrastructureServiceManager != nil { - objectMap["infrastructureServiceManager"] = cp.InfrastructureServiceManager - } - if cp.UpgradeWave != "" { - objectMap["upgradeWave"] = cp.UpgradeWave - } - if cp.UpgradePauseStartTimestampUtc != nil { - objectMap["upgradePauseStartTimestampUtc"] = cp.UpgradePauseStartTimestampUtc - } - if cp.UpgradePauseEndTimestampUtc != nil { - objectMap["upgradePauseEndTimestampUtc"] = cp.UpgradePauseEndTimestampUtc - } - if cp.WaveUpgradePaused != nil { - objectMap["waveUpgradePaused"] = cp.WaveUpgradePaused - } - if cp.Notifications != nil { - objectMap["notifications"] = cp.Notifications - } - return json.Marshal(objectMap) -} - -// ClusterPropertiesUpdateParameters describes the cluster resource properties that can be updated during -// PATCH operation. -type ClusterPropertiesUpdateParameters struct { - // AddOnFeatures - The list of add-on features to enable in the cluster. - AddOnFeatures *[]string `json:"addOnFeatures,omitempty"` - // Certificate - The certificate to use for securing the cluster. The certificate provided will be used for node to node security within the cluster, SSL certificate for cluster management endpoint and default admin client. - Certificate *CertificateDescription `json:"certificate,omitempty"` - CertificateCommonNames *ServerCertificateCommonNames `json:"certificateCommonNames,omitempty"` - // ClientCertificateCommonNames - The list of client certificates referenced by common name that are allowed to manage the cluster. This will overwrite the existing list. - ClientCertificateCommonNames *[]ClientCertificateCommonName `json:"clientCertificateCommonNames,omitempty"` - // ClientCertificateThumbprints - The list of client certificates referenced by thumbprint that are allowed to manage the cluster. This will overwrite the existing list. - ClientCertificateThumbprints *[]ClientCertificateThumbprint `json:"clientCertificateThumbprints,omitempty"` - // ClusterCodeVersion - The Service Fabric runtime version of the cluster. This property can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available Service Fabric versions for new clusters use [ClusterVersion API](./ClusterVersion.md). To get the list of available version for existing clusters use **availableClusterVersions**. - ClusterCodeVersion *string `json:"clusterCodeVersion,omitempty"` - // EventStoreServiceEnabled - Indicates if the event store service is enabled. - EventStoreServiceEnabled *bool `json:"eventStoreServiceEnabled,omitempty"` - // FabricSettings - The list of custom fabric settings to configure the cluster. This will overwrite the existing list. - FabricSettings *[]SettingsSectionDescription `json:"fabricSettings,omitempty"` - // NodeTypes - The list of node types in the cluster. This will overwrite the existing list. - NodeTypes *[]NodeTypeDescription `json:"nodeTypes,omitempty"` - // ReliabilityLevel - Possible values include: 'ReliabilityLevel1None', 'ReliabilityLevel1Bronze', 'ReliabilityLevel1Silver', 'ReliabilityLevel1Gold', 'ReliabilityLevel1Platinum' - ReliabilityLevel ReliabilityLevel1 `json:"reliabilityLevel,omitempty"` - // ReverseProxyCertificate - The server certificate used by reverse proxy. - ReverseProxyCertificate *CertificateDescription `json:"reverseProxyCertificate,omitempty"` - // UpgradeDescription - The policy to use when upgrading the cluster. - UpgradeDescription *ClusterUpgradePolicy `json:"upgradeDescription,omitempty"` - // ApplicationTypeVersionsCleanupPolicy - The policy used to clean up unused versions. - ApplicationTypeVersionsCleanupPolicy *ApplicationTypeVersionsCleanupPolicy `json:"applicationTypeVersionsCleanupPolicy,omitempty"` - // UpgradeMode - Possible values include: 'UpgradeModeAutomatic', 'UpgradeModeManual' - UpgradeMode UpgradeMode `json:"upgradeMode,omitempty"` - // SfZonalUpgradeMode - Possible values include: 'SfZonalUpgradeModeParallel', 'SfZonalUpgradeModeHierarchical' - SfZonalUpgradeMode SfZonalUpgradeMode `json:"sfZonalUpgradeMode,omitempty"` - // VmssZonalUpgradeMode - Possible values include: 'VmssZonalUpgradeModeParallel', 'VmssZonalUpgradeModeHierarchical' - VmssZonalUpgradeMode VmssZonalUpgradeMode `json:"vmssZonalUpgradeMode,omitempty"` - // InfrastructureServiceManager - Indicates if infrastructure service manager is enabled. - InfrastructureServiceManager *bool `json:"infrastructureServiceManager,omitempty"` - // UpgradeWave - Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. Only applies when **upgradeMode** is set to 'Automatic'. Possible values include: 'ClusterUpgradeCadenceWave0', 'ClusterUpgradeCadenceWave1', 'ClusterUpgradeCadenceWave2' - UpgradeWave ClusterUpgradeCadence `json:"upgradeWave,omitempty"` - // UpgradePauseStartTimestampUtc - The start timestamp to pause runtime version upgrades on the cluster (UTC). - UpgradePauseStartTimestampUtc *date.Time `json:"upgradePauseStartTimestampUtc,omitempty"` - // UpgradePauseEndTimestampUtc - The end timestamp of pause runtime version upgrades on the cluster (UTC). - UpgradePauseEndTimestampUtc *date.Time `json:"upgradePauseEndTimestampUtc,omitempty"` - // WaveUpgradePaused - Boolean to pause automatic runtime version upgrades to the cluster. - WaveUpgradePaused *bool `json:"waveUpgradePaused,omitempty"` - // Notifications - Indicates a list of notification channels for cluster events. - Notifications *[]Notification `json:"notifications,omitempty"` -} - -// ClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ClustersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (Cluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersCreateOrUpdateFuture.Result. -func (future *ClustersCreateOrUpdateFuture) result(client ClustersClient) (c Cluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - c.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ClustersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { - c, err = client.CreateOrUpdateResponder(c.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") - } - } - return -} - -// ClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ClustersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (Cluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersUpdateFuture.Result. -func (future *ClustersUpdateFuture) result(client ClustersClient) (c Cluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - c.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ClustersUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { - c, err = client.UpdateResponder(c.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersUpdateFuture", "Result", c.Response.Response, "Failure responding to request") - } - } - return -} - -// ClusterUpdateParameters cluster update request -type ClusterUpdateParameters struct { - *ClusterPropertiesUpdateParameters `json:"properties,omitempty"` - // Tags - Cluster update parameters - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ClusterUpdateParameters. -func (cup ClusterUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.ClusterPropertiesUpdateParameters != nil { - objectMap["properties"] = cup.ClusterPropertiesUpdateParameters - } - if cup.Tags != nil { - objectMap["tags"] = cup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ClusterUpdateParameters struct. -func (cup *ClusterUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var clusterPropertiesUpdateParameters ClusterPropertiesUpdateParameters - err = json.Unmarshal(*v, &clusterPropertiesUpdateParameters) - if err != nil { - return err - } - cup.ClusterPropertiesUpdateParameters = &clusterPropertiesUpdateParameters - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cup.Tags = tags - } - } - } - - return nil -} - -// ClusterUpgradeDeltaHealthPolicy describes the delta health policies for the cluster upgrade. -type ClusterUpgradeDeltaHealthPolicy struct { - // MaxPercentDeltaUnhealthyNodes - The maximum allowed percentage of nodes health degradation allowed during cluster upgrades. - // The delta is measured between the state of the nodes at the beginning of upgrade and the state of the nodes at the time of the health evaluation. - // The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster is within tolerated limits. - MaxPercentDeltaUnhealthyNodes *int32 `json:"maxPercentDeltaUnhealthyNodes,omitempty"` - // MaxPercentUpgradeDomainDeltaUnhealthyNodes - The maximum allowed percentage of upgrade domain nodes health degradation allowed during cluster upgrades. - // The delta is measured between the state of the upgrade domain nodes at the beginning of upgrade and the state of the upgrade domain nodes at the time of the health evaluation. - // The check is performed after every upgrade domain upgrade completion for all completed upgrade domains to make sure the state of the upgrade domains is within tolerated limits. - MaxPercentUpgradeDomainDeltaUnhealthyNodes *int32 `json:"maxPercentUpgradeDomainDeltaUnhealthyNodes,omitempty"` - // MaxPercentDeltaUnhealthyApplications - The maximum allowed percentage of applications health degradation allowed during cluster upgrades. - // The delta is measured between the state of the applications at the beginning of upgrade and the state of the applications at the time of the health evaluation. - // The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster is within tolerated limits. System services are not included in this. - MaxPercentDeltaUnhealthyApplications *int32 `json:"maxPercentDeltaUnhealthyApplications,omitempty"` - // ApplicationDeltaHealthPolicies - Defines the application delta health policy map used to evaluate the health of an application or one of its child entities when upgrading the cluster. - ApplicationDeltaHealthPolicies map[string]*ApplicationDeltaHealthPolicy `json:"applicationDeltaHealthPolicies"` -} - -// MarshalJSON is the custom marshaler for ClusterUpgradeDeltaHealthPolicy. -func (cudhp ClusterUpgradeDeltaHealthPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cudhp.MaxPercentDeltaUnhealthyNodes != nil { - objectMap["maxPercentDeltaUnhealthyNodes"] = cudhp.MaxPercentDeltaUnhealthyNodes - } - if cudhp.MaxPercentUpgradeDomainDeltaUnhealthyNodes != nil { - objectMap["maxPercentUpgradeDomainDeltaUnhealthyNodes"] = cudhp.MaxPercentUpgradeDomainDeltaUnhealthyNodes - } - if cudhp.MaxPercentDeltaUnhealthyApplications != nil { - objectMap["maxPercentDeltaUnhealthyApplications"] = cudhp.MaxPercentDeltaUnhealthyApplications - } - if cudhp.ApplicationDeltaHealthPolicies != nil { - objectMap["applicationDeltaHealthPolicies"] = cudhp.ApplicationDeltaHealthPolicies - } - return json.Marshal(objectMap) -} - -// ClusterUpgradePolicy describes the policy used when upgrading the cluster. -type ClusterUpgradePolicy struct { - // ForceRestart - If true, then processes are forcefully restarted during upgrade even when the code version has not changed (the upgrade only changes configuration or data). - ForceRestart *bool `json:"forceRestart,omitempty"` - // UpgradeReplicaSetCheckTimeout - The maximum amount of time to block processing of an upgrade domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each upgrade domain. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - UpgradeReplicaSetCheckTimeout *string `json:"upgradeReplicaSetCheckTimeout,omitempty"` - // HealthCheckWaitDuration - The length of time to wait after completing an upgrade domain before performing health checks. The duration can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - HealthCheckWaitDuration *string `json:"healthCheckWaitDuration,omitempty"` - // HealthCheckStableDuration - The amount of time that the application or cluster must remain healthy before the upgrade proceeds to the next upgrade domain. The duration can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - HealthCheckStableDuration *string `json:"healthCheckStableDuration,omitempty"` - // HealthCheckRetryTimeout - The amount of time to retry health evaluation when the application or cluster is unhealthy before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - HealthCheckRetryTimeout *string `json:"healthCheckRetryTimeout,omitempty"` - // UpgradeTimeout - The amount of time the overall upgrade has to complete before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - UpgradeTimeout *string `json:"upgradeTimeout,omitempty"` - // UpgradeDomainTimeout - The amount of time each upgrade domain has to complete before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - UpgradeDomainTimeout *string `json:"upgradeDomainTimeout,omitempty"` - // HealthPolicy - The cluster health policy used when upgrading the cluster. - HealthPolicy *ClusterHealthPolicy `json:"healthPolicy,omitempty"` - // DeltaHealthPolicy - The cluster delta health policy used when upgrading the cluster. - DeltaHealthPolicy *ClusterUpgradeDeltaHealthPolicy `json:"deltaHealthPolicy,omitempty"` -} - -// ClusterVersionDetails the detail of the Service Fabric runtime version result -type ClusterVersionDetails struct { - // CodeVersion - The Service Fabric runtime version of the cluster. - CodeVersion *string `json:"codeVersion,omitempty"` - // SupportExpiryUtc - The date of expiry of support of the version. - SupportExpiryUtc *string `json:"supportExpiryUtc,omitempty"` - // Environment - Indicates if this version is for Windows or Linux operating system. Possible values include: 'EnvironmentWindows', 'EnvironmentLinux' - Environment Environment `json:"environment,omitempty"` -} - -// DiagnosticsStorageAccountConfig the storage account information for storing Service Fabric diagnostic -// logs. -type DiagnosticsStorageAccountConfig struct { - // StorageAccountName - The Azure storage account name. - StorageAccountName *string `json:"storageAccountName,omitempty"` - // ProtectedAccountKeyName - The protected diagnostics storage key name. - ProtectedAccountKeyName *string `json:"protectedAccountKeyName,omitempty"` - // ProtectedAccountKeyName2 - The secondary protected diagnostics storage key name. If one of the storage account keys is rotated the cluster will fallback to using the other. - ProtectedAccountKeyName2 *string `json:"protectedAccountKeyName2,omitempty"` - // BlobEndpoint - The blob endpoint of the azure storage account. - BlobEndpoint *string `json:"blobEndpoint,omitempty"` - // QueueEndpoint - The queue endpoint of the azure storage account. - QueueEndpoint *string `json:"queueEndpoint,omitempty"` - // TableEndpoint - The table endpoint of the azure storage account. - TableEndpoint *string `json:"tableEndpoint,omitempty"` -} - -// EndpointRangeDescription port range details -type EndpointRangeDescription struct { - // StartPort - Starting port of a range of ports - StartPort *int32 `json:"startPort,omitempty"` - // EndPort - End port of a range of ports - EndPort *int32 `json:"endPort,omitempty"` -} - -// ErrorModel the structure of the error. -type ErrorModel struct { - Error *ErrorModelError `json:"error,omitempty"` -} - -// ErrorModelError the error details. -type ErrorModelError struct { - // Code - The error code. - Code *string `json:"code,omitempty"` - // Message - The error message. - Message *string `json:"message,omitempty"` -} - -// ManagedIdentity describes the managed identities for an Azure resource. -type ManagedIdentity struct { - // PrincipalID - READ-ONLY; The principal id of the managed identity. This property will only be provided for a system assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant id of the managed identity. This property will only be provided for a system assigned identity. - TenantID *string `json:"tenantId,omitempty"` - // Type - Possible values include: 'ManagedIdentityTypeSystemAssigned', 'ManagedIdentityTypeUserAssigned', 'ManagedIdentityTypeSystemAssignedUserAssigned', 'ManagedIdentityTypeNone' - Type ManagedIdentityType `json:"type,omitempty"` - UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for ManagedIdentity. -func (mi ManagedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mi.Type != "" { - objectMap["type"] = mi.Type - } - if mi.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = mi.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// NamedPartitionSchemeDescription describes the named partition scheme of the service. -type NamedPartitionSchemeDescription struct { - // Count - The number of partitions. - Count *int32 `json:"count,omitempty"` - // Names - Array of size specified by the ‘count’ parameter, for the names of the partitions. - Names *[]string `json:"names,omitempty"` - // PartitionScheme - Possible values include: 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range' - PartitionScheme PartitionSchemeBasicPartitionSchemeDescription `json:"partitionScheme,omitempty"` -} - -// MarshalJSON is the custom marshaler for NamedPartitionSchemeDescription. -func (npsd NamedPartitionSchemeDescription) MarshalJSON() ([]byte, error) { - npsd.PartitionScheme = PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed - objectMap := make(map[string]interface{}) - if npsd.Count != nil { - objectMap["count"] = npsd.Count - } - if npsd.Names != nil { - objectMap["names"] = npsd.Names - } - if npsd.PartitionScheme != "" { - objectMap["partitionScheme"] = npsd.PartitionScheme - } - return json.Marshal(objectMap) -} - -// AsNamedPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for NamedPartitionSchemeDescription. -func (npsd NamedPartitionSchemeDescription) AsNamedPartitionSchemeDescription() (*NamedPartitionSchemeDescription, bool) { - return &npsd, true -} - -// AsSingletonPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for NamedPartitionSchemeDescription. -func (npsd NamedPartitionSchemeDescription) AsSingletonPartitionSchemeDescription() (*SingletonPartitionSchemeDescription, bool) { - return nil, false -} - -// AsUniformInt64RangePartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for NamedPartitionSchemeDescription. -func (npsd NamedPartitionSchemeDescription) AsUniformInt64RangePartitionSchemeDescription() (*UniformInt64RangePartitionSchemeDescription, bool) { - return nil, false -} - -// AsPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for NamedPartitionSchemeDescription. -func (npsd NamedPartitionSchemeDescription) AsPartitionSchemeDescription() (*PartitionSchemeDescription, bool) { - return nil, false -} - -// AsBasicPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for NamedPartitionSchemeDescription. -func (npsd NamedPartitionSchemeDescription) AsBasicPartitionSchemeDescription() (BasicPartitionSchemeDescription, bool) { - return &npsd, true -} - -// NodeTypeDescription describes a node type in the cluster, each node type represents sub set of nodes in -// the cluster. -type NodeTypeDescription struct { - // Name - The name of the node type. - Name *string `json:"name,omitempty"` - // PlacementProperties - The placement tags applied to nodes in the node type, which can be used to indicate where certain services (workload) should run. - PlacementProperties map[string]*string `json:"placementProperties"` - // Capacities - The capacity tags applied to the nodes in the node type, the cluster resource manager uses these tags to understand how much resource a node has. - Capacities map[string]*string `json:"capacities"` - // ClientConnectionEndpointPort - The TCP cluster management endpoint port. - ClientConnectionEndpointPort *int32 `json:"clientConnectionEndpointPort,omitempty"` - // HTTPGatewayEndpointPort - The HTTP cluster management endpoint port. - HTTPGatewayEndpointPort *int32 `json:"httpGatewayEndpointPort,omitempty"` - // DurabilityLevel - Possible values include: 'DurabilityLevelBronze', 'DurabilityLevelSilver', 'DurabilityLevelGold' - DurabilityLevel DurabilityLevel `json:"durabilityLevel,omitempty"` - // ApplicationPorts - The range of ports from which cluster assigned port to Service Fabric applications. - ApplicationPorts *EndpointRangeDescription `json:"applicationPorts,omitempty"` - // EphemeralPorts - The range of ephemeral ports that nodes in this node type should be configured with. - EphemeralPorts *EndpointRangeDescription `json:"ephemeralPorts,omitempty"` - // IsPrimary - The node type on which system services will run. Only one node type should be marked as primary. Primary node type cannot be deleted or changed for existing clusters. - IsPrimary *bool `json:"isPrimary,omitempty"` - // VMInstanceCount - VMInstanceCount should be 1 to n, where n indicates the number of VM instances corresponding to this nodeType. VMInstanceCount = 0 can be done only in these scenarios: NodeType is a secondary nodeType. Durability = Bronze or Durability >= Bronze and InfrastructureServiceManager = true. If VMInstanceCount = 0, implies the VMs for this nodeType will not be used for the initial cluster size computation. - VMInstanceCount *int32 `json:"vmInstanceCount,omitempty"` - // ReverseProxyEndpointPort - The endpoint used by reverse proxy. - ReverseProxyEndpointPort *int32 `json:"reverseProxyEndpointPort,omitempty"` - // IsStateless - Indicates if the node type can only host Stateless workloads. - IsStateless *bool `json:"isStateless,omitempty"` - // MultipleAvailabilityZones - Indicates if the node type is enabled to support multiple zones. - MultipleAvailabilityZones *bool `json:"multipleAvailabilityZones,omitempty"` -} - -// MarshalJSON is the custom marshaler for NodeTypeDescription. -func (ntd NodeTypeDescription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ntd.Name != nil { - objectMap["name"] = ntd.Name - } - if ntd.PlacementProperties != nil { - objectMap["placementProperties"] = ntd.PlacementProperties - } - if ntd.Capacities != nil { - objectMap["capacities"] = ntd.Capacities - } - if ntd.ClientConnectionEndpointPort != nil { - objectMap["clientConnectionEndpointPort"] = ntd.ClientConnectionEndpointPort - } - if ntd.HTTPGatewayEndpointPort != nil { - objectMap["httpGatewayEndpointPort"] = ntd.HTTPGatewayEndpointPort - } - if ntd.DurabilityLevel != "" { - objectMap["durabilityLevel"] = ntd.DurabilityLevel - } - if ntd.ApplicationPorts != nil { - objectMap["applicationPorts"] = ntd.ApplicationPorts - } - if ntd.EphemeralPorts != nil { - objectMap["ephemeralPorts"] = ntd.EphemeralPorts - } - if ntd.IsPrimary != nil { - objectMap["isPrimary"] = ntd.IsPrimary - } - if ntd.VMInstanceCount != nil { - objectMap["vmInstanceCount"] = ntd.VMInstanceCount - } - if ntd.ReverseProxyEndpointPort != nil { - objectMap["reverseProxyEndpointPort"] = ntd.ReverseProxyEndpointPort - } - if ntd.IsStateless != nil { - objectMap["isStateless"] = ntd.IsStateless - } - if ntd.MultipleAvailabilityZones != nil { - objectMap["multipleAvailabilityZones"] = ntd.MultipleAvailabilityZones - } - return json.Marshal(objectMap) -} - -// Notification describes the notification channel for cluster events. -type Notification struct { - // IsEnabled - Indicates if the notification is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - // NotificationCategory - The category of notification. - NotificationCategory *string `json:"notificationCategory,omitempty"` - // NotificationLevel - The level of notification. Possible values include: 'NotificationLevelCritical', 'NotificationLevelAll' - NotificationLevel NotificationLevel `json:"notificationLevel,omitempty"` - // NotificationTargets - List of targets that subscribe to the notification. - NotificationTargets *[]NotificationTarget `json:"notificationTargets,omitempty"` -} - -// NotificationTarget describes the notification target properties. -type NotificationTarget struct { - // NotificationChannel - The notification channel indicates the type of receivers subscribed to the notification, either user or subscription. Possible values include: 'NotificationChannelEmailUser', 'NotificationChannelEmailSubscription' - NotificationChannel NotificationChannel `json:"notificationChannel,omitempty"` - // Receivers - List of targets that subscribe to the notification. - Receivers *[]string `json:"receivers,omitempty"` -} - -// OperationListResult describes the result of the request to list Service Fabric resource provider -// operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the Service Fabric resource provider. - Value *[]OperationResult `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if olr.Value != nil { - objectMap["value"] = olr.Value - } - return json.Marshal(objectMap) -} - -// OperationListResultIterator provides access to a complete listing of OperationResult values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() OperationResult { - if !iter.page.NotDone() { - return OperationResult{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of OperationResult values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []OperationResult { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// OperationResult available operation list result -type OperationResult struct { - // Name - The name of the operation. - Name *string `json:"name,omitempty"` - // IsDataAction - Indicates whether the operation is a data action - IsDataAction *bool `json:"isDataAction,omitempty"` - // Display - The object that represents the operation. - Display *AvailableOperationDisplay `json:"display,omitempty"` - // Origin - Origin result - Origin *string `json:"origin,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// BasicPartitionSchemeDescription describes how the service is partitioned. -type BasicPartitionSchemeDescription interface { - AsNamedPartitionSchemeDescription() (*NamedPartitionSchemeDescription, bool) - AsSingletonPartitionSchemeDescription() (*SingletonPartitionSchemeDescription, bool) - AsUniformInt64RangePartitionSchemeDescription() (*UniformInt64RangePartitionSchemeDescription, bool) - AsPartitionSchemeDescription() (*PartitionSchemeDescription, bool) -} - -// PartitionSchemeDescription describes how the service is partitioned. -type PartitionSchemeDescription struct { - // PartitionScheme - Possible values include: 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range' - PartitionScheme PartitionSchemeBasicPartitionSchemeDescription `json:"partitionScheme,omitempty"` -} - -func unmarshalBasicPartitionSchemeDescription(body []byte) (BasicPartitionSchemeDescription, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["partitionScheme"] { - case string(PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed): - var npsd NamedPartitionSchemeDescription - err := json.Unmarshal(body, &npsd) - return npsd, err - case string(PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton): - var spsd SingletonPartitionSchemeDescription - err := json.Unmarshal(body, &spsd) - return spsd, err - case string(PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range): - var ui6rpsd UniformInt64RangePartitionSchemeDescription - err := json.Unmarshal(body, &ui6rpsd) - return ui6rpsd, err - default: - var psd PartitionSchemeDescription - err := json.Unmarshal(body, &psd) - return psd, err - } -} -func unmarshalBasicPartitionSchemeDescriptionArray(body []byte) ([]BasicPartitionSchemeDescription, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - psdArray := make([]BasicPartitionSchemeDescription, len(rawMessages)) - - for index, rawMessage := range rawMessages { - psd, err := unmarshalBasicPartitionSchemeDescription(*rawMessage) - if err != nil { - return nil, err - } - psdArray[index] = psd - } - return psdArray, nil -} - -// MarshalJSON is the custom marshaler for PartitionSchemeDescription. -func (psd PartitionSchemeDescription) MarshalJSON() ([]byte, error) { - psd.PartitionScheme = PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription - objectMap := make(map[string]interface{}) - if psd.PartitionScheme != "" { - objectMap["partitionScheme"] = psd.PartitionScheme - } - return json.Marshal(objectMap) -} - -// AsNamedPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for PartitionSchemeDescription. -func (psd PartitionSchemeDescription) AsNamedPartitionSchemeDescription() (*NamedPartitionSchemeDescription, bool) { - return nil, false -} - -// AsSingletonPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for PartitionSchemeDescription. -func (psd PartitionSchemeDescription) AsSingletonPartitionSchemeDescription() (*SingletonPartitionSchemeDescription, bool) { - return nil, false -} - -// AsUniformInt64RangePartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for PartitionSchemeDescription. -func (psd PartitionSchemeDescription) AsUniformInt64RangePartitionSchemeDescription() (*UniformInt64RangePartitionSchemeDescription, bool) { - return nil, false -} - -// AsPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for PartitionSchemeDescription. -func (psd PartitionSchemeDescription) AsPartitionSchemeDescription() (*PartitionSchemeDescription, bool) { - return &psd, true -} - -// AsBasicPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for PartitionSchemeDescription. -func (psd PartitionSchemeDescription) AsBasicPartitionSchemeDescription() (BasicPartitionSchemeDescription, bool) { - return &psd, true -} - -// ProxyResource the resource model definition for proxy-only resource. -type ProxyResource struct { - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - It will be deprecated in New API, resource location depends on the parent resource. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pr.Location != nil { - objectMap["location"] = pr.Location - } - if pr.Tags != nil { - objectMap["tags"] = pr.Tags - } - if pr.SystemData != nil { - objectMap["systemData"] = pr.SystemData - } - return json.Marshal(objectMap) -} - -// Resource the resource model definition. -type Resource struct { - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - Azure resource location. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - if r.SystemData != nil { - objectMap["systemData"] = r.SystemData - } - return json.Marshal(objectMap) -} - -// ServerCertificateCommonName describes the server certificate details using common name. -type ServerCertificateCommonName struct { - // CertificateCommonName - The common name of the server certificate. - CertificateCommonName *string `json:"certificateCommonName,omitempty"` - // CertificateIssuerThumbprint - The issuer thumbprint of the server certificate. - CertificateIssuerThumbprint *string `json:"certificateIssuerThumbprint,omitempty"` -} - -// ServerCertificateCommonNames describes a list of server certificates referenced by common name that are -// used to secure the cluster. -type ServerCertificateCommonNames struct { - // CommonNames - The list of server certificates referenced by common name that are used to secure the cluster. - CommonNames *[]ServerCertificateCommonName `json:"commonNames,omitempty"` - // X509StoreName - Possible values include: 'X509StoreName1AddressBook', 'X509StoreName1AuthRoot', 'X509StoreName1CertificateAuthority', 'X509StoreName1Disallowed', 'X509StoreName1My', 'X509StoreName1Root', 'X509StoreName1TrustedPeople', 'X509StoreName1TrustedPublisher' - X509StoreName X509StoreName1 `json:"x509StoreName,omitempty"` -} - -// ServiceCorrelationDescription creates a particular correlation between services. -type ServiceCorrelationDescription struct { - // Scheme - The ServiceCorrelationScheme which describes the relationship between this service and the service specified via ServiceName. Possible values include: 'ServiceCorrelationSchemeInvalid', 'ServiceCorrelationSchemeAffinity', 'ServiceCorrelationSchemeAlignedAffinity', 'ServiceCorrelationSchemeNonAlignedAffinity' - Scheme ServiceCorrelationScheme `json:"scheme,omitempty"` - // ServiceName - The name of the service that the correlation relationship is established with. - ServiceName *string `json:"serviceName,omitempty"` -} - -// ServiceLoadMetricDescription specifies a metric to load balance a service during runtime. -type ServiceLoadMetricDescription struct { - // Name - The name of the metric. If the service chooses to report load during runtime, the load metric name should match the name that is specified in Name exactly. Note that metric names are case sensitive. - Name *string `json:"name,omitempty"` - // Weight - The service load metric relative weight, compared to other metrics configured for this service, as a number. Possible values include: 'ServiceLoadMetricWeightZero', 'ServiceLoadMetricWeightLow', 'ServiceLoadMetricWeightMedium', 'ServiceLoadMetricWeightHigh' - Weight ServiceLoadMetricWeight `json:"weight,omitempty"` - // PrimaryDefaultLoad - Used only for Stateful services. The default amount of load, as a number, that this service creates for this metric when it is a Primary replica. - PrimaryDefaultLoad *int32 `json:"primaryDefaultLoad,omitempty"` - // SecondaryDefaultLoad - Used only for Stateful services. The default amount of load, as a number, that this service creates for this metric when it is a Secondary replica. - SecondaryDefaultLoad *int32 `json:"secondaryDefaultLoad,omitempty"` - // DefaultLoad - Used only for Stateless services. The default amount of load, as a number, that this service creates for this metric. - DefaultLoad *int32 `json:"defaultLoad,omitempty"` -} - -// BasicServicePlacementPolicyDescription describes the policy to be used for placement of a Service Fabric service. -type BasicServicePlacementPolicyDescription interface { - AsServicePlacementPolicyDescription() (*ServicePlacementPolicyDescription, bool) -} - -// ServicePlacementPolicyDescription describes the policy to be used for placement of a Service Fabric service. -type ServicePlacementPolicyDescription struct { - // Type - Possible values include: 'TypeServicePlacementPolicyDescription' - Type Type `json:"type,omitempty"` -} - -func unmarshalBasicServicePlacementPolicyDescription(body []byte) (BasicServicePlacementPolicyDescription, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - default: - var sppd ServicePlacementPolicyDescription - err := json.Unmarshal(body, &sppd) - return sppd, err - } -} -func unmarshalBasicServicePlacementPolicyDescriptionArray(body []byte) ([]BasicServicePlacementPolicyDescription, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - sppdArray := make([]BasicServicePlacementPolicyDescription, len(rawMessages)) - - for index, rawMessage := range rawMessages { - sppd, err := unmarshalBasicServicePlacementPolicyDescription(*rawMessage) - if err != nil { - return nil, err - } - sppdArray[index] = sppd - } - return sppdArray, nil -} - -// MarshalJSON is the custom marshaler for ServicePlacementPolicyDescription. -func (sppd ServicePlacementPolicyDescription) MarshalJSON() ([]byte, error) { - sppd.Type = TypeServicePlacementPolicyDescription - objectMap := make(map[string]interface{}) - if sppd.Type != "" { - objectMap["type"] = sppd.Type - } - return json.Marshal(objectMap) -} - -// AsServicePlacementPolicyDescription is the BasicServicePlacementPolicyDescription implementation for ServicePlacementPolicyDescription. -func (sppd ServicePlacementPolicyDescription) AsServicePlacementPolicyDescription() (*ServicePlacementPolicyDescription, bool) { - return &sppd, true -} - -// AsBasicServicePlacementPolicyDescription is the BasicServicePlacementPolicyDescription implementation for ServicePlacementPolicyDescription. -func (sppd ServicePlacementPolicyDescription) AsBasicServicePlacementPolicyDescription() (BasicServicePlacementPolicyDescription, bool) { - return &sppd, true -} - -// ServiceResource the service resource. -type ServiceResource struct { - autorest.Response `json:"-"` - BasicServiceResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - It will be deprecated in New API, resource location depends on the parent resource. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceResource. -func (sr ServiceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = sr.BasicServiceResourceProperties - if sr.Location != nil { - objectMap["location"] = sr.Location - } - if sr.Tags != nil { - objectMap["tags"] = sr.Tags - } - if sr.SystemData != nil { - objectMap["systemData"] = sr.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceResource struct. -func (sr *ServiceResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - basicServiceResourceProperties, err := unmarshalBasicServiceResourceProperties(*v) - if err != nil { - return err - } - sr.BasicServiceResourceProperties = basicServiceResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sr.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sr.Etag = &etag - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sr.SystemData = &systemData - } - } - } - - return nil -} - -// ServiceResourceList the list of service resources. -type ServiceResourceList struct { - autorest.Response `json:"-"` - Value *[]ServiceResource `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of service list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceResourceList. -func (srl ServiceResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if srl.Value != nil { - objectMap["value"] = srl.Value - } - return json.Marshal(objectMap) -} - -// BasicServiceResourceProperties the service resource properties. -type BasicServiceResourceProperties interface { - AsStatefulServiceProperties() (*StatefulServiceProperties, bool) - AsStatelessServiceProperties() (*StatelessServiceProperties, bool) - AsServiceResourceProperties() (*ServiceResourceProperties, bool) -} - -// ServiceResourceProperties the service resource properties. -type ServiceResourceProperties struct { - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response - ProvisioningState *string `json:"provisioningState,omitempty"` - // ServiceTypeName - The name of the service type - ServiceTypeName *string `json:"serviceTypeName,omitempty"` - PartitionDescription BasicPartitionSchemeDescription `json:"partitionDescription,omitempty"` - // ServicePackageActivationMode - The activation Mode of the service package. Possible values include: 'ArmServicePackageActivationModeSharedProcess', 'ArmServicePackageActivationModeExclusiveProcess' - ServicePackageActivationMode ArmServicePackageActivationMode `json:"servicePackageActivationMode,omitempty"` - // ServiceDNSName - Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. - ServiceDNSName *string `json:"serviceDnsName,omitempty"` - // ServiceKind - Possible values include: 'ServiceKindBasicServiceResourcePropertiesServiceKindServiceResourceProperties', 'ServiceKindBasicServiceResourcePropertiesServiceKindStateful', 'ServiceKindBasicServiceResourcePropertiesServiceKindStateless' - ServiceKind ServiceKindBasicServiceResourceProperties `json:"serviceKind,omitempty"` - // PlacementConstraints - The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - PlacementConstraints *string `json:"placementConstraints,omitempty"` - CorrelationScheme *[]ServiceCorrelationDescription `json:"correlationScheme,omitempty"` - ServiceLoadMetrics *[]ServiceLoadMetricDescription `json:"serviceLoadMetrics,omitempty"` - ServicePlacementPolicies *[]BasicServicePlacementPolicyDescription `json:"servicePlacementPolicies,omitempty"` - // DefaultMoveCost - Possible values include: 'MoveCostZero', 'MoveCostLow', 'MoveCostMedium', 'MoveCostHigh' - DefaultMoveCost MoveCost `json:"defaultMoveCost,omitempty"` -} - -func unmarshalBasicServiceResourceProperties(body []byte) (BasicServiceResourceProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["serviceKind"] { - case string(ServiceKindBasicServiceResourcePropertiesServiceKindStateful): - var ssp StatefulServiceProperties - err := json.Unmarshal(body, &ssp) - return ssp, err - case string(ServiceKindBasicServiceResourcePropertiesServiceKindStateless): - var ssp StatelessServiceProperties - err := json.Unmarshal(body, &ssp) - return ssp, err - default: - var srp ServiceResourceProperties - err := json.Unmarshal(body, &srp) - return srp, err - } -} -func unmarshalBasicServiceResourcePropertiesArray(body []byte) ([]BasicServiceResourceProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - srpArray := make([]BasicServiceResourceProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - srp, err := unmarshalBasicServiceResourceProperties(*rawMessage) - if err != nil { - return nil, err - } - srpArray[index] = srp - } - return srpArray, nil -} - -// MarshalJSON is the custom marshaler for ServiceResourceProperties. -func (srp ServiceResourceProperties) MarshalJSON() ([]byte, error) { - srp.ServiceKind = ServiceKindBasicServiceResourcePropertiesServiceKindServiceResourceProperties - objectMap := make(map[string]interface{}) - if srp.ServiceTypeName != nil { - objectMap["serviceTypeName"] = srp.ServiceTypeName - } - objectMap["partitionDescription"] = srp.PartitionDescription - if srp.ServicePackageActivationMode != "" { - objectMap["servicePackageActivationMode"] = srp.ServicePackageActivationMode - } - if srp.ServiceDNSName != nil { - objectMap["serviceDnsName"] = srp.ServiceDNSName - } - if srp.ServiceKind != "" { - objectMap["serviceKind"] = srp.ServiceKind - } - if srp.PlacementConstraints != nil { - objectMap["placementConstraints"] = srp.PlacementConstraints - } - if srp.CorrelationScheme != nil { - objectMap["correlationScheme"] = srp.CorrelationScheme - } - if srp.ServiceLoadMetrics != nil { - objectMap["serviceLoadMetrics"] = srp.ServiceLoadMetrics - } - if srp.ServicePlacementPolicies != nil { - objectMap["servicePlacementPolicies"] = srp.ServicePlacementPolicies - } - if srp.DefaultMoveCost != "" { - objectMap["defaultMoveCost"] = srp.DefaultMoveCost - } - return json.Marshal(objectMap) -} - -// AsStatefulServiceProperties is the BasicServiceResourceProperties implementation for ServiceResourceProperties. -func (srp ServiceResourceProperties) AsStatefulServiceProperties() (*StatefulServiceProperties, bool) { - return nil, false -} - -// AsStatelessServiceProperties is the BasicServiceResourceProperties implementation for ServiceResourceProperties. -func (srp ServiceResourceProperties) AsStatelessServiceProperties() (*StatelessServiceProperties, bool) { - return nil, false -} - -// AsServiceResourceProperties is the BasicServiceResourceProperties implementation for ServiceResourceProperties. -func (srp ServiceResourceProperties) AsServiceResourceProperties() (*ServiceResourceProperties, bool) { - return &srp, true -} - -// AsBasicServiceResourceProperties is the BasicServiceResourceProperties implementation for ServiceResourceProperties. -func (srp ServiceResourceProperties) AsBasicServiceResourceProperties() (BasicServiceResourceProperties, bool) { - return &srp, true -} - -// UnmarshalJSON is the custom unmarshaler for ServiceResourceProperties struct. -func (srp *ServiceResourceProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "provisioningState": - if v != nil { - var provisioningState string - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - srp.ProvisioningState = &provisioningState - } - case "serviceTypeName": - if v != nil { - var serviceTypeName string - err = json.Unmarshal(*v, &serviceTypeName) - if err != nil { - return err - } - srp.ServiceTypeName = &serviceTypeName - } - case "partitionDescription": - if v != nil { - partitionDescription, err := unmarshalBasicPartitionSchemeDescription(*v) - if err != nil { - return err - } - srp.PartitionDescription = partitionDescription - } - case "servicePackageActivationMode": - if v != nil { - var servicePackageActivationMode ArmServicePackageActivationMode - err = json.Unmarshal(*v, &servicePackageActivationMode) - if err != nil { - return err - } - srp.ServicePackageActivationMode = servicePackageActivationMode - } - case "serviceDnsName": - if v != nil { - var serviceDNSName string - err = json.Unmarshal(*v, &serviceDNSName) - if err != nil { - return err - } - srp.ServiceDNSName = &serviceDNSName - } - case "serviceKind": - if v != nil { - var serviceKind ServiceKindBasicServiceResourceProperties - err = json.Unmarshal(*v, &serviceKind) - if err != nil { - return err - } - srp.ServiceKind = serviceKind - } - case "placementConstraints": - if v != nil { - var placementConstraints string - err = json.Unmarshal(*v, &placementConstraints) - if err != nil { - return err - } - srp.PlacementConstraints = &placementConstraints - } - case "correlationScheme": - if v != nil { - var correlationScheme []ServiceCorrelationDescription - err = json.Unmarshal(*v, &correlationScheme) - if err != nil { - return err - } - srp.CorrelationScheme = &correlationScheme - } - case "serviceLoadMetrics": - if v != nil { - var serviceLoadMetrics []ServiceLoadMetricDescription - err = json.Unmarshal(*v, &serviceLoadMetrics) - if err != nil { - return err - } - srp.ServiceLoadMetrics = &serviceLoadMetrics - } - case "servicePlacementPolicies": - if v != nil { - servicePlacementPolicies, err := unmarshalBasicServicePlacementPolicyDescriptionArray(*v) - if err != nil { - return err - } - srp.ServicePlacementPolicies = &servicePlacementPolicies - } - case "defaultMoveCost": - if v != nil { - var defaultMoveCost MoveCost - err = json.Unmarshal(*v, &defaultMoveCost) - if err != nil { - return err - } - srp.DefaultMoveCost = defaultMoveCost - } - } - } - - return nil -} - -// ServiceResourcePropertiesBase the common service resource properties. -type ServiceResourcePropertiesBase struct { - // PlacementConstraints - The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - PlacementConstraints *string `json:"placementConstraints,omitempty"` - CorrelationScheme *[]ServiceCorrelationDescription `json:"correlationScheme,omitempty"` - ServiceLoadMetrics *[]ServiceLoadMetricDescription `json:"serviceLoadMetrics,omitempty"` - ServicePlacementPolicies *[]BasicServicePlacementPolicyDescription `json:"servicePlacementPolicies,omitempty"` - // DefaultMoveCost - Possible values include: 'MoveCostZero', 'MoveCostLow', 'MoveCostMedium', 'MoveCostHigh' - DefaultMoveCost MoveCost `json:"defaultMoveCost,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for ServiceResourcePropertiesBase struct. -func (srpb *ServiceResourcePropertiesBase) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "placementConstraints": - if v != nil { - var placementConstraints string - err = json.Unmarshal(*v, &placementConstraints) - if err != nil { - return err - } - srpb.PlacementConstraints = &placementConstraints - } - case "correlationScheme": - if v != nil { - var correlationScheme []ServiceCorrelationDescription - err = json.Unmarshal(*v, &correlationScheme) - if err != nil { - return err - } - srpb.CorrelationScheme = &correlationScheme - } - case "serviceLoadMetrics": - if v != nil { - var serviceLoadMetrics []ServiceLoadMetricDescription - err = json.Unmarshal(*v, &serviceLoadMetrics) - if err != nil { - return err - } - srpb.ServiceLoadMetrics = &serviceLoadMetrics - } - case "servicePlacementPolicies": - if v != nil { - servicePlacementPolicies, err := unmarshalBasicServicePlacementPolicyDescriptionArray(*v) - if err != nil { - return err - } - srpb.ServicePlacementPolicies = &servicePlacementPolicies - } - case "defaultMoveCost": - if v != nil { - var defaultMoveCost MoveCost - err = json.Unmarshal(*v, &defaultMoveCost) - if err != nil { - return err - } - srpb.DefaultMoveCost = defaultMoveCost - } - } - } - - return nil -} - -// ServiceResourceUpdate the service resource for patch operations. -type ServiceResourceUpdate struct { - BasicServiceResourceUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type. - Type *string `json:"type,omitempty"` - // Location - It will be deprecated in New API, resource location depends on the parent resource. - Location *string `json:"location,omitempty"` - // Tags - Azure resource tags. - Tags map[string]*string `json:"tags"` - // Etag - READ-ONLY; Azure resource etag. - Etag *string `json:"etag,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceResourceUpdate. -func (sru ServiceResourceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = sru.BasicServiceResourceUpdateProperties - if sru.Location != nil { - objectMap["location"] = sru.Location - } - if sru.Tags != nil { - objectMap["tags"] = sru.Tags - } - if sru.SystemData != nil { - objectMap["systemData"] = sru.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceResourceUpdate struct. -func (sru *ServiceResourceUpdate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - basicServiceResourceUpdateProperties, err := unmarshalBasicServiceResourceUpdateProperties(*v) - if err != nil { - return err - } - sru.BasicServiceResourceUpdateProperties = basicServiceResourceUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sru.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sru.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sru.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sru.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sru.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sru.Etag = &etag - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sru.SystemData = &systemData - } - } - } - - return nil -} - -// BasicServiceResourceUpdateProperties the service resource properties for patch operations. -type BasicServiceResourceUpdateProperties interface { - AsStatefulServiceUpdateProperties() (*StatefulServiceUpdateProperties, bool) - AsStatelessServiceUpdateProperties() (*StatelessServiceUpdateProperties, bool) - AsServiceResourceUpdateProperties() (*ServiceResourceUpdateProperties, bool) -} - -// ServiceResourceUpdateProperties the service resource properties for patch operations. -type ServiceResourceUpdateProperties struct { - // ServiceKind - Possible values include: 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindServiceResourceUpdateProperties', 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful', 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless' - ServiceKind ServiceKindBasicServiceResourceUpdateProperties `json:"serviceKind,omitempty"` - // PlacementConstraints - The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - PlacementConstraints *string `json:"placementConstraints,omitempty"` - CorrelationScheme *[]ServiceCorrelationDescription `json:"correlationScheme,omitempty"` - ServiceLoadMetrics *[]ServiceLoadMetricDescription `json:"serviceLoadMetrics,omitempty"` - ServicePlacementPolicies *[]BasicServicePlacementPolicyDescription `json:"servicePlacementPolicies,omitempty"` - // DefaultMoveCost - Possible values include: 'MoveCostZero', 'MoveCostLow', 'MoveCostMedium', 'MoveCostHigh' - DefaultMoveCost MoveCost `json:"defaultMoveCost,omitempty"` -} - -func unmarshalBasicServiceResourceUpdateProperties(body []byte) (BasicServiceResourceUpdateProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["serviceKind"] { - case string(ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful): - var ssup StatefulServiceUpdateProperties - err := json.Unmarshal(body, &ssup) - return ssup, err - case string(ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless): - var ssup StatelessServiceUpdateProperties - err := json.Unmarshal(body, &ssup) - return ssup, err - default: - var srup ServiceResourceUpdateProperties - err := json.Unmarshal(body, &srup) - return srup, err - } -} -func unmarshalBasicServiceResourceUpdatePropertiesArray(body []byte) ([]BasicServiceResourceUpdateProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - srupArray := make([]BasicServiceResourceUpdateProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - srup, err := unmarshalBasicServiceResourceUpdateProperties(*rawMessage) - if err != nil { - return nil, err - } - srupArray[index] = srup - } - return srupArray, nil -} - -// MarshalJSON is the custom marshaler for ServiceResourceUpdateProperties. -func (srup ServiceResourceUpdateProperties) MarshalJSON() ([]byte, error) { - srup.ServiceKind = ServiceKindBasicServiceResourceUpdatePropertiesServiceKindServiceResourceUpdateProperties - objectMap := make(map[string]interface{}) - if srup.ServiceKind != "" { - objectMap["serviceKind"] = srup.ServiceKind - } - if srup.PlacementConstraints != nil { - objectMap["placementConstraints"] = srup.PlacementConstraints - } - if srup.CorrelationScheme != nil { - objectMap["correlationScheme"] = srup.CorrelationScheme - } - if srup.ServiceLoadMetrics != nil { - objectMap["serviceLoadMetrics"] = srup.ServiceLoadMetrics - } - if srup.ServicePlacementPolicies != nil { - objectMap["servicePlacementPolicies"] = srup.ServicePlacementPolicies - } - if srup.DefaultMoveCost != "" { - objectMap["defaultMoveCost"] = srup.DefaultMoveCost - } - return json.Marshal(objectMap) -} - -// AsStatefulServiceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for ServiceResourceUpdateProperties. -func (srup ServiceResourceUpdateProperties) AsStatefulServiceUpdateProperties() (*StatefulServiceUpdateProperties, bool) { - return nil, false -} - -// AsStatelessServiceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for ServiceResourceUpdateProperties. -func (srup ServiceResourceUpdateProperties) AsStatelessServiceUpdateProperties() (*StatelessServiceUpdateProperties, bool) { - return nil, false -} - -// AsServiceResourceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for ServiceResourceUpdateProperties. -func (srup ServiceResourceUpdateProperties) AsServiceResourceUpdateProperties() (*ServiceResourceUpdateProperties, bool) { - return &srup, true -} - -// AsBasicServiceResourceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for ServiceResourceUpdateProperties. -func (srup ServiceResourceUpdateProperties) AsBasicServiceResourceUpdateProperties() (BasicServiceResourceUpdateProperties, bool) { - return &srup, true -} - -// UnmarshalJSON is the custom unmarshaler for ServiceResourceUpdateProperties struct. -func (srup *ServiceResourceUpdateProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "serviceKind": - if v != nil { - var serviceKind ServiceKindBasicServiceResourceUpdateProperties - err = json.Unmarshal(*v, &serviceKind) - if err != nil { - return err - } - srup.ServiceKind = serviceKind - } - case "placementConstraints": - if v != nil { - var placementConstraints string - err = json.Unmarshal(*v, &placementConstraints) - if err != nil { - return err - } - srup.PlacementConstraints = &placementConstraints - } - case "correlationScheme": - if v != nil { - var correlationScheme []ServiceCorrelationDescription - err = json.Unmarshal(*v, &correlationScheme) - if err != nil { - return err - } - srup.CorrelationScheme = &correlationScheme - } - case "serviceLoadMetrics": - if v != nil { - var serviceLoadMetrics []ServiceLoadMetricDescription - err = json.Unmarshal(*v, &serviceLoadMetrics) - if err != nil { - return err - } - srup.ServiceLoadMetrics = &serviceLoadMetrics - } - case "servicePlacementPolicies": - if v != nil { - servicePlacementPolicies, err := unmarshalBasicServicePlacementPolicyDescriptionArray(*v) - if err != nil { - return err - } - srup.ServicePlacementPolicies = &servicePlacementPolicies - } - case "defaultMoveCost": - if v != nil { - var defaultMoveCost MoveCost - err = json.Unmarshal(*v, &defaultMoveCost) - if err != nil { - return err - } - srup.DefaultMoveCost = defaultMoveCost - } - } - } - - return nil -} - -// ServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServicesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesCreateOrUpdateFuture.Result. -func (future *ServicesCreateOrUpdateFuture) result(client ServicesClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ServicesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.CreateOrUpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServicesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesDeleteFuture.Result. -func (future *ServicesDeleteFuture) result(client ServicesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ServicesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServicesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesUpdateFuture.Result. -func (future *ServicesUpdateFuture) result(client ServicesClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicefabric.ServicesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.UpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceTypeDeltaHealthPolicy represents the delta health policy used to evaluate the health of services -// belonging to a service type when upgrading the cluster. -type ServiceTypeDeltaHealthPolicy struct { - // MaxPercentDeltaUnhealthyServices - The maximum allowed percentage of services health degradation allowed during cluster upgrades. - // The delta is measured between the state of the services at the beginning of upgrade and the state of the services at the time of the health evaluation. - // The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster is within tolerated limits. - MaxPercentDeltaUnhealthyServices *int32 `json:"maxPercentDeltaUnhealthyServices,omitempty"` -} - -// ServiceTypeHealthPolicy represents the health policy used to evaluate the health of services belonging -// to a service type. -type ServiceTypeHealthPolicy struct { - // MaxPercentUnhealthyServices - The maximum percentage of services allowed to be unhealthy before your application is considered in error. - MaxPercentUnhealthyServices *int32 `json:"maxPercentUnhealthyServices,omitempty"` -} - -// SettingsParameterDescription describes a parameter in fabric settings of the cluster. -type SettingsParameterDescription struct { - // Name - The parameter name of fabric setting. - Name *string `json:"name,omitempty"` - // Value - The parameter value of fabric setting. - Value *string `json:"value,omitempty"` -} - -// SettingsSectionDescription describes a section in the fabric settings of the cluster. -type SettingsSectionDescription struct { - // Name - The section name of the fabric settings. - Name *string `json:"name,omitempty"` - // Parameters - The collection of parameters in the section. - Parameters *[]SettingsParameterDescription `json:"parameters,omitempty"` -} - -// SingletonPartitionSchemeDescription describes the partition scheme of a singleton-partitioned, or -// non-partitioned service. -type SingletonPartitionSchemeDescription struct { - // PartitionScheme - Possible values include: 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range' - PartitionScheme PartitionSchemeBasicPartitionSchemeDescription `json:"partitionScheme,omitempty"` -} - -// MarshalJSON is the custom marshaler for SingletonPartitionSchemeDescription. -func (spsd SingletonPartitionSchemeDescription) MarshalJSON() ([]byte, error) { - spsd.PartitionScheme = PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton - objectMap := make(map[string]interface{}) - if spsd.PartitionScheme != "" { - objectMap["partitionScheme"] = spsd.PartitionScheme - } - return json.Marshal(objectMap) -} - -// AsNamedPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for SingletonPartitionSchemeDescription. -func (spsd SingletonPartitionSchemeDescription) AsNamedPartitionSchemeDescription() (*NamedPartitionSchemeDescription, bool) { - return nil, false -} - -// AsSingletonPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for SingletonPartitionSchemeDescription. -func (spsd SingletonPartitionSchemeDescription) AsSingletonPartitionSchemeDescription() (*SingletonPartitionSchemeDescription, bool) { - return &spsd, true -} - -// AsUniformInt64RangePartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for SingletonPartitionSchemeDescription. -func (spsd SingletonPartitionSchemeDescription) AsUniformInt64RangePartitionSchemeDescription() (*UniformInt64RangePartitionSchemeDescription, bool) { - return nil, false -} - -// AsPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for SingletonPartitionSchemeDescription. -func (spsd SingletonPartitionSchemeDescription) AsPartitionSchemeDescription() (*PartitionSchemeDescription, bool) { - return nil, false -} - -// AsBasicPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for SingletonPartitionSchemeDescription. -func (spsd SingletonPartitionSchemeDescription) AsBasicPartitionSchemeDescription() (BasicPartitionSchemeDescription, bool) { - return &spsd, true -} - -// StatefulServiceProperties the properties of a stateful service resource. -type StatefulServiceProperties struct { - // HasPersistedState - A flag indicating whether this is a persistent service which stores states on the local disk. If it is then the value of this property is true, if not it is false. - HasPersistedState *bool `json:"hasPersistedState,omitempty"` - // TargetReplicaSetSize - The target replica set size as a number. - TargetReplicaSetSize *int32 `json:"targetReplicaSetSize,omitempty"` - // MinReplicaSetSize - The minimum replica set size as a number. - MinReplicaSetSize *int32 `json:"minReplicaSetSize,omitempty"` - // ReplicaRestartWaitDuration - The duration between when a replica goes down and when a new replica is created, represented in ISO 8601 format (hh:mm:ss.s). - ReplicaRestartWaitDuration *date.Time `json:"replicaRestartWaitDuration,omitempty"` - // QuorumLossWaitDuration - The maximum duration for which a partition is allowed to be in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). - QuorumLossWaitDuration *date.Time `json:"quorumLossWaitDuration,omitempty"` - // StandByReplicaKeepDuration - The definition on how long StandBy replicas should be maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). - StandByReplicaKeepDuration *date.Time `json:"standByReplicaKeepDuration,omitempty"` - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response - ProvisioningState *string `json:"provisioningState,omitempty"` - // ServiceTypeName - The name of the service type - ServiceTypeName *string `json:"serviceTypeName,omitempty"` - PartitionDescription BasicPartitionSchemeDescription `json:"partitionDescription,omitempty"` - // ServicePackageActivationMode - The activation Mode of the service package. Possible values include: 'ArmServicePackageActivationModeSharedProcess', 'ArmServicePackageActivationModeExclusiveProcess' - ServicePackageActivationMode ArmServicePackageActivationMode `json:"servicePackageActivationMode,omitempty"` - // ServiceDNSName - Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. - ServiceDNSName *string `json:"serviceDnsName,omitempty"` - // ServiceKind - Possible values include: 'ServiceKindBasicServiceResourcePropertiesServiceKindServiceResourceProperties', 'ServiceKindBasicServiceResourcePropertiesServiceKindStateful', 'ServiceKindBasicServiceResourcePropertiesServiceKindStateless' - ServiceKind ServiceKindBasicServiceResourceProperties `json:"serviceKind,omitempty"` - // PlacementConstraints - The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - PlacementConstraints *string `json:"placementConstraints,omitempty"` - CorrelationScheme *[]ServiceCorrelationDescription `json:"correlationScheme,omitempty"` - ServiceLoadMetrics *[]ServiceLoadMetricDescription `json:"serviceLoadMetrics,omitempty"` - ServicePlacementPolicies *[]BasicServicePlacementPolicyDescription `json:"servicePlacementPolicies,omitempty"` - // DefaultMoveCost - Possible values include: 'MoveCostZero', 'MoveCostLow', 'MoveCostMedium', 'MoveCostHigh' - DefaultMoveCost MoveCost `json:"defaultMoveCost,omitempty"` -} - -// MarshalJSON is the custom marshaler for StatefulServiceProperties. -func (ssp StatefulServiceProperties) MarshalJSON() ([]byte, error) { - ssp.ServiceKind = ServiceKindBasicServiceResourcePropertiesServiceKindStateful - objectMap := make(map[string]interface{}) - if ssp.HasPersistedState != nil { - objectMap["hasPersistedState"] = ssp.HasPersistedState - } - if ssp.TargetReplicaSetSize != nil { - objectMap["targetReplicaSetSize"] = ssp.TargetReplicaSetSize - } - if ssp.MinReplicaSetSize != nil { - objectMap["minReplicaSetSize"] = ssp.MinReplicaSetSize - } - if ssp.ReplicaRestartWaitDuration != nil { - objectMap["replicaRestartWaitDuration"] = ssp.ReplicaRestartWaitDuration - } - if ssp.QuorumLossWaitDuration != nil { - objectMap["quorumLossWaitDuration"] = ssp.QuorumLossWaitDuration - } - if ssp.StandByReplicaKeepDuration != nil { - objectMap["standByReplicaKeepDuration"] = ssp.StandByReplicaKeepDuration - } - if ssp.ServiceTypeName != nil { - objectMap["serviceTypeName"] = ssp.ServiceTypeName - } - objectMap["partitionDescription"] = ssp.PartitionDescription - if ssp.ServicePackageActivationMode != "" { - objectMap["servicePackageActivationMode"] = ssp.ServicePackageActivationMode - } - if ssp.ServiceDNSName != nil { - objectMap["serviceDnsName"] = ssp.ServiceDNSName - } - if ssp.ServiceKind != "" { - objectMap["serviceKind"] = ssp.ServiceKind - } - if ssp.PlacementConstraints != nil { - objectMap["placementConstraints"] = ssp.PlacementConstraints - } - if ssp.CorrelationScheme != nil { - objectMap["correlationScheme"] = ssp.CorrelationScheme - } - if ssp.ServiceLoadMetrics != nil { - objectMap["serviceLoadMetrics"] = ssp.ServiceLoadMetrics - } - if ssp.ServicePlacementPolicies != nil { - objectMap["servicePlacementPolicies"] = ssp.ServicePlacementPolicies - } - if ssp.DefaultMoveCost != "" { - objectMap["defaultMoveCost"] = ssp.DefaultMoveCost - } - return json.Marshal(objectMap) -} - -// AsStatefulServiceProperties is the BasicServiceResourceProperties implementation for StatefulServiceProperties. -func (ssp StatefulServiceProperties) AsStatefulServiceProperties() (*StatefulServiceProperties, bool) { - return &ssp, true -} - -// AsStatelessServiceProperties is the BasicServiceResourceProperties implementation for StatefulServiceProperties. -func (ssp StatefulServiceProperties) AsStatelessServiceProperties() (*StatelessServiceProperties, bool) { - return nil, false -} - -// AsServiceResourceProperties is the BasicServiceResourceProperties implementation for StatefulServiceProperties. -func (ssp StatefulServiceProperties) AsServiceResourceProperties() (*ServiceResourceProperties, bool) { - return nil, false -} - -// AsBasicServiceResourceProperties is the BasicServiceResourceProperties implementation for StatefulServiceProperties. -func (ssp StatefulServiceProperties) AsBasicServiceResourceProperties() (BasicServiceResourceProperties, bool) { - return &ssp, true -} - -// UnmarshalJSON is the custom unmarshaler for StatefulServiceProperties struct. -func (ssp *StatefulServiceProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "hasPersistedState": - if v != nil { - var hasPersistedState bool - err = json.Unmarshal(*v, &hasPersistedState) - if err != nil { - return err - } - ssp.HasPersistedState = &hasPersistedState - } - case "targetReplicaSetSize": - if v != nil { - var targetReplicaSetSize int32 - err = json.Unmarshal(*v, &targetReplicaSetSize) - if err != nil { - return err - } - ssp.TargetReplicaSetSize = &targetReplicaSetSize - } - case "minReplicaSetSize": - if v != nil { - var minReplicaSetSize int32 - err = json.Unmarshal(*v, &minReplicaSetSize) - if err != nil { - return err - } - ssp.MinReplicaSetSize = &minReplicaSetSize - } - case "replicaRestartWaitDuration": - if v != nil { - var replicaRestartWaitDuration date.Time - err = json.Unmarshal(*v, &replicaRestartWaitDuration) - if err != nil { - return err - } - ssp.ReplicaRestartWaitDuration = &replicaRestartWaitDuration - } - case "quorumLossWaitDuration": - if v != nil { - var quorumLossWaitDuration date.Time - err = json.Unmarshal(*v, &quorumLossWaitDuration) - if err != nil { - return err - } - ssp.QuorumLossWaitDuration = &quorumLossWaitDuration - } - case "standByReplicaKeepDuration": - if v != nil { - var standByReplicaKeepDuration date.Time - err = json.Unmarshal(*v, &standByReplicaKeepDuration) - if err != nil { - return err - } - ssp.StandByReplicaKeepDuration = &standByReplicaKeepDuration - } - case "provisioningState": - if v != nil { - var provisioningState string - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - ssp.ProvisioningState = &provisioningState - } - case "serviceTypeName": - if v != nil { - var serviceTypeName string - err = json.Unmarshal(*v, &serviceTypeName) - if err != nil { - return err - } - ssp.ServiceTypeName = &serviceTypeName - } - case "partitionDescription": - if v != nil { - partitionDescription, err := unmarshalBasicPartitionSchemeDescription(*v) - if err != nil { - return err - } - ssp.PartitionDescription = partitionDescription - } - case "servicePackageActivationMode": - if v != nil { - var servicePackageActivationMode ArmServicePackageActivationMode - err = json.Unmarshal(*v, &servicePackageActivationMode) - if err != nil { - return err - } - ssp.ServicePackageActivationMode = servicePackageActivationMode - } - case "serviceDnsName": - if v != nil { - var serviceDNSName string - err = json.Unmarshal(*v, &serviceDNSName) - if err != nil { - return err - } - ssp.ServiceDNSName = &serviceDNSName - } - case "serviceKind": - if v != nil { - var serviceKind ServiceKindBasicServiceResourceProperties - err = json.Unmarshal(*v, &serviceKind) - if err != nil { - return err - } - ssp.ServiceKind = serviceKind - } - case "placementConstraints": - if v != nil { - var placementConstraints string - err = json.Unmarshal(*v, &placementConstraints) - if err != nil { - return err - } - ssp.PlacementConstraints = &placementConstraints - } - case "correlationScheme": - if v != nil { - var correlationScheme []ServiceCorrelationDescription - err = json.Unmarshal(*v, &correlationScheme) - if err != nil { - return err - } - ssp.CorrelationScheme = &correlationScheme - } - case "serviceLoadMetrics": - if v != nil { - var serviceLoadMetrics []ServiceLoadMetricDescription - err = json.Unmarshal(*v, &serviceLoadMetrics) - if err != nil { - return err - } - ssp.ServiceLoadMetrics = &serviceLoadMetrics - } - case "servicePlacementPolicies": - if v != nil { - servicePlacementPolicies, err := unmarshalBasicServicePlacementPolicyDescriptionArray(*v) - if err != nil { - return err - } - ssp.ServicePlacementPolicies = &servicePlacementPolicies - } - case "defaultMoveCost": - if v != nil { - var defaultMoveCost MoveCost - err = json.Unmarshal(*v, &defaultMoveCost) - if err != nil { - return err - } - ssp.DefaultMoveCost = defaultMoveCost - } - } - } - - return nil -} - -// StatefulServiceUpdateProperties the properties of a stateful service resource for patch operations. -type StatefulServiceUpdateProperties struct { - // TargetReplicaSetSize - The target replica set size as a number. - TargetReplicaSetSize *int32 `json:"targetReplicaSetSize,omitempty"` - // MinReplicaSetSize - The minimum replica set size as a number. - MinReplicaSetSize *int32 `json:"minReplicaSetSize,omitempty"` - // ReplicaRestartWaitDuration - The duration between when a replica goes down and when a new replica is created, represented in ISO 8601 format (hh:mm:ss.s). - ReplicaRestartWaitDuration *date.Time `json:"replicaRestartWaitDuration,omitempty"` - // QuorumLossWaitDuration - The maximum duration for which a partition is allowed to be in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). - QuorumLossWaitDuration *date.Time `json:"quorumLossWaitDuration,omitempty"` - // StandByReplicaKeepDuration - The definition on how long StandBy replicas should be maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). - StandByReplicaKeepDuration *date.Time `json:"standByReplicaKeepDuration,omitempty"` - // ServiceKind - Possible values include: 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindServiceResourceUpdateProperties', 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful', 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless' - ServiceKind ServiceKindBasicServiceResourceUpdateProperties `json:"serviceKind,omitempty"` - // PlacementConstraints - The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - PlacementConstraints *string `json:"placementConstraints,omitempty"` - CorrelationScheme *[]ServiceCorrelationDescription `json:"correlationScheme,omitempty"` - ServiceLoadMetrics *[]ServiceLoadMetricDescription `json:"serviceLoadMetrics,omitempty"` - ServicePlacementPolicies *[]BasicServicePlacementPolicyDescription `json:"servicePlacementPolicies,omitempty"` - // DefaultMoveCost - Possible values include: 'MoveCostZero', 'MoveCostLow', 'MoveCostMedium', 'MoveCostHigh' - DefaultMoveCost MoveCost `json:"defaultMoveCost,omitempty"` -} - -// MarshalJSON is the custom marshaler for StatefulServiceUpdateProperties. -func (ssup StatefulServiceUpdateProperties) MarshalJSON() ([]byte, error) { - ssup.ServiceKind = ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful - objectMap := make(map[string]interface{}) - if ssup.TargetReplicaSetSize != nil { - objectMap["targetReplicaSetSize"] = ssup.TargetReplicaSetSize - } - if ssup.MinReplicaSetSize != nil { - objectMap["minReplicaSetSize"] = ssup.MinReplicaSetSize - } - if ssup.ReplicaRestartWaitDuration != nil { - objectMap["replicaRestartWaitDuration"] = ssup.ReplicaRestartWaitDuration - } - if ssup.QuorumLossWaitDuration != nil { - objectMap["quorumLossWaitDuration"] = ssup.QuorumLossWaitDuration - } - if ssup.StandByReplicaKeepDuration != nil { - objectMap["standByReplicaKeepDuration"] = ssup.StandByReplicaKeepDuration - } - if ssup.ServiceKind != "" { - objectMap["serviceKind"] = ssup.ServiceKind - } - if ssup.PlacementConstraints != nil { - objectMap["placementConstraints"] = ssup.PlacementConstraints - } - if ssup.CorrelationScheme != nil { - objectMap["correlationScheme"] = ssup.CorrelationScheme - } - if ssup.ServiceLoadMetrics != nil { - objectMap["serviceLoadMetrics"] = ssup.ServiceLoadMetrics - } - if ssup.ServicePlacementPolicies != nil { - objectMap["servicePlacementPolicies"] = ssup.ServicePlacementPolicies - } - if ssup.DefaultMoveCost != "" { - objectMap["defaultMoveCost"] = ssup.DefaultMoveCost - } - return json.Marshal(objectMap) -} - -// AsStatefulServiceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatefulServiceUpdateProperties. -func (ssup StatefulServiceUpdateProperties) AsStatefulServiceUpdateProperties() (*StatefulServiceUpdateProperties, bool) { - return &ssup, true -} - -// AsStatelessServiceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatefulServiceUpdateProperties. -func (ssup StatefulServiceUpdateProperties) AsStatelessServiceUpdateProperties() (*StatelessServiceUpdateProperties, bool) { - return nil, false -} - -// AsServiceResourceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatefulServiceUpdateProperties. -func (ssup StatefulServiceUpdateProperties) AsServiceResourceUpdateProperties() (*ServiceResourceUpdateProperties, bool) { - return nil, false -} - -// AsBasicServiceResourceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatefulServiceUpdateProperties. -func (ssup StatefulServiceUpdateProperties) AsBasicServiceResourceUpdateProperties() (BasicServiceResourceUpdateProperties, bool) { - return &ssup, true -} - -// UnmarshalJSON is the custom unmarshaler for StatefulServiceUpdateProperties struct. -func (ssup *StatefulServiceUpdateProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "targetReplicaSetSize": - if v != nil { - var targetReplicaSetSize int32 - err = json.Unmarshal(*v, &targetReplicaSetSize) - if err != nil { - return err - } - ssup.TargetReplicaSetSize = &targetReplicaSetSize - } - case "minReplicaSetSize": - if v != nil { - var minReplicaSetSize int32 - err = json.Unmarshal(*v, &minReplicaSetSize) - if err != nil { - return err - } - ssup.MinReplicaSetSize = &minReplicaSetSize - } - case "replicaRestartWaitDuration": - if v != nil { - var replicaRestartWaitDuration date.Time - err = json.Unmarshal(*v, &replicaRestartWaitDuration) - if err != nil { - return err - } - ssup.ReplicaRestartWaitDuration = &replicaRestartWaitDuration - } - case "quorumLossWaitDuration": - if v != nil { - var quorumLossWaitDuration date.Time - err = json.Unmarshal(*v, &quorumLossWaitDuration) - if err != nil { - return err - } - ssup.QuorumLossWaitDuration = &quorumLossWaitDuration - } - case "standByReplicaKeepDuration": - if v != nil { - var standByReplicaKeepDuration date.Time - err = json.Unmarshal(*v, &standByReplicaKeepDuration) - if err != nil { - return err - } - ssup.StandByReplicaKeepDuration = &standByReplicaKeepDuration - } - case "serviceKind": - if v != nil { - var serviceKind ServiceKindBasicServiceResourceUpdateProperties - err = json.Unmarshal(*v, &serviceKind) - if err != nil { - return err - } - ssup.ServiceKind = serviceKind - } - case "placementConstraints": - if v != nil { - var placementConstraints string - err = json.Unmarshal(*v, &placementConstraints) - if err != nil { - return err - } - ssup.PlacementConstraints = &placementConstraints - } - case "correlationScheme": - if v != nil { - var correlationScheme []ServiceCorrelationDescription - err = json.Unmarshal(*v, &correlationScheme) - if err != nil { - return err - } - ssup.CorrelationScheme = &correlationScheme - } - case "serviceLoadMetrics": - if v != nil { - var serviceLoadMetrics []ServiceLoadMetricDescription - err = json.Unmarshal(*v, &serviceLoadMetrics) - if err != nil { - return err - } - ssup.ServiceLoadMetrics = &serviceLoadMetrics - } - case "servicePlacementPolicies": - if v != nil { - servicePlacementPolicies, err := unmarshalBasicServicePlacementPolicyDescriptionArray(*v) - if err != nil { - return err - } - ssup.ServicePlacementPolicies = &servicePlacementPolicies - } - case "defaultMoveCost": - if v != nil { - var defaultMoveCost MoveCost - err = json.Unmarshal(*v, &defaultMoveCost) - if err != nil { - return err - } - ssup.DefaultMoveCost = defaultMoveCost - } - } - } - - return nil -} - -// StatelessServiceProperties the properties of a stateless service resource. -type StatelessServiceProperties struct { - // InstanceCount - The instance count. - InstanceCount *int32 `json:"instanceCount,omitempty"` - // InstanceCloseDelayDuration - Delay duration for RequestDrain feature to ensures that the endpoint advertised by the stateless instance is removed before the delay starts prior to closing the instance. This delay enables existing requests to drain gracefully before the instance actually goes down (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number of milliseconds. - InstanceCloseDelayDuration *string `json:"instanceCloseDelayDuration,omitempty"` - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response - ProvisioningState *string `json:"provisioningState,omitempty"` - // ServiceTypeName - The name of the service type - ServiceTypeName *string `json:"serviceTypeName,omitempty"` - PartitionDescription BasicPartitionSchemeDescription `json:"partitionDescription,omitempty"` - // ServicePackageActivationMode - The activation Mode of the service package. Possible values include: 'ArmServicePackageActivationModeSharedProcess', 'ArmServicePackageActivationModeExclusiveProcess' - ServicePackageActivationMode ArmServicePackageActivationMode `json:"servicePackageActivationMode,omitempty"` - // ServiceDNSName - Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. - ServiceDNSName *string `json:"serviceDnsName,omitempty"` - // ServiceKind - Possible values include: 'ServiceKindBasicServiceResourcePropertiesServiceKindServiceResourceProperties', 'ServiceKindBasicServiceResourcePropertiesServiceKindStateful', 'ServiceKindBasicServiceResourcePropertiesServiceKindStateless' - ServiceKind ServiceKindBasicServiceResourceProperties `json:"serviceKind,omitempty"` - // PlacementConstraints - The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - PlacementConstraints *string `json:"placementConstraints,omitempty"` - CorrelationScheme *[]ServiceCorrelationDescription `json:"correlationScheme,omitempty"` - ServiceLoadMetrics *[]ServiceLoadMetricDescription `json:"serviceLoadMetrics,omitempty"` - ServicePlacementPolicies *[]BasicServicePlacementPolicyDescription `json:"servicePlacementPolicies,omitempty"` - // DefaultMoveCost - Possible values include: 'MoveCostZero', 'MoveCostLow', 'MoveCostMedium', 'MoveCostHigh' - DefaultMoveCost MoveCost `json:"defaultMoveCost,omitempty"` -} - -// MarshalJSON is the custom marshaler for StatelessServiceProperties. -func (ssp StatelessServiceProperties) MarshalJSON() ([]byte, error) { - ssp.ServiceKind = ServiceKindBasicServiceResourcePropertiesServiceKindStateless - objectMap := make(map[string]interface{}) - if ssp.InstanceCount != nil { - objectMap["instanceCount"] = ssp.InstanceCount - } - if ssp.InstanceCloseDelayDuration != nil { - objectMap["instanceCloseDelayDuration"] = ssp.InstanceCloseDelayDuration - } - if ssp.ServiceTypeName != nil { - objectMap["serviceTypeName"] = ssp.ServiceTypeName - } - objectMap["partitionDescription"] = ssp.PartitionDescription - if ssp.ServicePackageActivationMode != "" { - objectMap["servicePackageActivationMode"] = ssp.ServicePackageActivationMode - } - if ssp.ServiceDNSName != nil { - objectMap["serviceDnsName"] = ssp.ServiceDNSName - } - if ssp.ServiceKind != "" { - objectMap["serviceKind"] = ssp.ServiceKind - } - if ssp.PlacementConstraints != nil { - objectMap["placementConstraints"] = ssp.PlacementConstraints - } - if ssp.CorrelationScheme != nil { - objectMap["correlationScheme"] = ssp.CorrelationScheme - } - if ssp.ServiceLoadMetrics != nil { - objectMap["serviceLoadMetrics"] = ssp.ServiceLoadMetrics - } - if ssp.ServicePlacementPolicies != nil { - objectMap["servicePlacementPolicies"] = ssp.ServicePlacementPolicies - } - if ssp.DefaultMoveCost != "" { - objectMap["defaultMoveCost"] = ssp.DefaultMoveCost - } - return json.Marshal(objectMap) -} - -// AsStatefulServiceProperties is the BasicServiceResourceProperties implementation for StatelessServiceProperties. -func (ssp StatelessServiceProperties) AsStatefulServiceProperties() (*StatefulServiceProperties, bool) { - return nil, false -} - -// AsStatelessServiceProperties is the BasicServiceResourceProperties implementation for StatelessServiceProperties. -func (ssp StatelessServiceProperties) AsStatelessServiceProperties() (*StatelessServiceProperties, bool) { - return &ssp, true -} - -// AsServiceResourceProperties is the BasicServiceResourceProperties implementation for StatelessServiceProperties. -func (ssp StatelessServiceProperties) AsServiceResourceProperties() (*ServiceResourceProperties, bool) { - return nil, false -} - -// AsBasicServiceResourceProperties is the BasicServiceResourceProperties implementation for StatelessServiceProperties. -func (ssp StatelessServiceProperties) AsBasicServiceResourceProperties() (BasicServiceResourceProperties, bool) { - return &ssp, true -} - -// UnmarshalJSON is the custom unmarshaler for StatelessServiceProperties struct. -func (ssp *StatelessServiceProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "instanceCount": - if v != nil { - var instanceCount int32 - err = json.Unmarshal(*v, &instanceCount) - if err != nil { - return err - } - ssp.InstanceCount = &instanceCount - } - case "instanceCloseDelayDuration": - if v != nil { - var instanceCloseDelayDuration string - err = json.Unmarshal(*v, &instanceCloseDelayDuration) - if err != nil { - return err - } - ssp.InstanceCloseDelayDuration = &instanceCloseDelayDuration - } - case "provisioningState": - if v != nil { - var provisioningState string - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - ssp.ProvisioningState = &provisioningState - } - case "serviceTypeName": - if v != nil { - var serviceTypeName string - err = json.Unmarshal(*v, &serviceTypeName) - if err != nil { - return err - } - ssp.ServiceTypeName = &serviceTypeName - } - case "partitionDescription": - if v != nil { - partitionDescription, err := unmarshalBasicPartitionSchemeDescription(*v) - if err != nil { - return err - } - ssp.PartitionDescription = partitionDescription - } - case "servicePackageActivationMode": - if v != nil { - var servicePackageActivationMode ArmServicePackageActivationMode - err = json.Unmarshal(*v, &servicePackageActivationMode) - if err != nil { - return err - } - ssp.ServicePackageActivationMode = servicePackageActivationMode - } - case "serviceDnsName": - if v != nil { - var serviceDNSName string - err = json.Unmarshal(*v, &serviceDNSName) - if err != nil { - return err - } - ssp.ServiceDNSName = &serviceDNSName - } - case "serviceKind": - if v != nil { - var serviceKind ServiceKindBasicServiceResourceProperties - err = json.Unmarshal(*v, &serviceKind) - if err != nil { - return err - } - ssp.ServiceKind = serviceKind - } - case "placementConstraints": - if v != nil { - var placementConstraints string - err = json.Unmarshal(*v, &placementConstraints) - if err != nil { - return err - } - ssp.PlacementConstraints = &placementConstraints - } - case "correlationScheme": - if v != nil { - var correlationScheme []ServiceCorrelationDescription - err = json.Unmarshal(*v, &correlationScheme) - if err != nil { - return err - } - ssp.CorrelationScheme = &correlationScheme - } - case "serviceLoadMetrics": - if v != nil { - var serviceLoadMetrics []ServiceLoadMetricDescription - err = json.Unmarshal(*v, &serviceLoadMetrics) - if err != nil { - return err - } - ssp.ServiceLoadMetrics = &serviceLoadMetrics - } - case "servicePlacementPolicies": - if v != nil { - servicePlacementPolicies, err := unmarshalBasicServicePlacementPolicyDescriptionArray(*v) - if err != nil { - return err - } - ssp.ServicePlacementPolicies = &servicePlacementPolicies - } - case "defaultMoveCost": - if v != nil { - var defaultMoveCost MoveCost - err = json.Unmarshal(*v, &defaultMoveCost) - if err != nil { - return err - } - ssp.DefaultMoveCost = defaultMoveCost - } - } - } - - return nil -} - -// StatelessServiceUpdateProperties the properties of a stateless service resource for patch operations. -type StatelessServiceUpdateProperties struct { - // InstanceCount - The instance count. - InstanceCount *int32 `json:"instanceCount,omitempty"` - // InstanceCloseDelayDuration - Delay duration for RequestDrain feature to ensures that the endpoint advertised by the stateless instance is removed before the delay starts prior to closing the instance. This delay enables existing requests to drain gracefully before the instance actually goes down (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number of milliseconds. - InstanceCloseDelayDuration *string `json:"instanceCloseDelayDuration,omitempty"` - // ServiceKind - Possible values include: 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindServiceResourceUpdateProperties', 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateful', 'ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless' - ServiceKind ServiceKindBasicServiceResourceUpdateProperties `json:"serviceKind,omitempty"` - // PlacementConstraints - The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - PlacementConstraints *string `json:"placementConstraints,omitempty"` - CorrelationScheme *[]ServiceCorrelationDescription `json:"correlationScheme,omitempty"` - ServiceLoadMetrics *[]ServiceLoadMetricDescription `json:"serviceLoadMetrics,omitempty"` - ServicePlacementPolicies *[]BasicServicePlacementPolicyDescription `json:"servicePlacementPolicies,omitempty"` - // DefaultMoveCost - Possible values include: 'MoveCostZero', 'MoveCostLow', 'MoveCostMedium', 'MoveCostHigh' - DefaultMoveCost MoveCost `json:"defaultMoveCost,omitempty"` -} - -// MarshalJSON is the custom marshaler for StatelessServiceUpdateProperties. -func (ssup StatelessServiceUpdateProperties) MarshalJSON() ([]byte, error) { - ssup.ServiceKind = ServiceKindBasicServiceResourceUpdatePropertiesServiceKindStateless - objectMap := make(map[string]interface{}) - if ssup.InstanceCount != nil { - objectMap["instanceCount"] = ssup.InstanceCount - } - if ssup.InstanceCloseDelayDuration != nil { - objectMap["instanceCloseDelayDuration"] = ssup.InstanceCloseDelayDuration - } - if ssup.ServiceKind != "" { - objectMap["serviceKind"] = ssup.ServiceKind - } - if ssup.PlacementConstraints != nil { - objectMap["placementConstraints"] = ssup.PlacementConstraints - } - if ssup.CorrelationScheme != nil { - objectMap["correlationScheme"] = ssup.CorrelationScheme - } - if ssup.ServiceLoadMetrics != nil { - objectMap["serviceLoadMetrics"] = ssup.ServiceLoadMetrics - } - if ssup.ServicePlacementPolicies != nil { - objectMap["servicePlacementPolicies"] = ssup.ServicePlacementPolicies - } - if ssup.DefaultMoveCost != "" { - objectMap["defaultMoveCost"] = ssup.DefaultMoveCost - } - return json.Marshal(objectMap) -} - -// AsStatefulServiceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatelessServiceUpdateProperties. -func (ssup StatelessServiceUpdateProperties) AsStatefulServiceUpdateProperties() (*StatefulServiceUpdateProperties, bool) { - return nil, false -} - -// AsStatelessServiceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatelessServiceUpdateProperties. -func (ssup StatelessServiceUpdateProperties) AsStatelessServiceUpdateProperties() (*StatelessServiceUpdateProperties, bool) { - return &ssup, true -} - -// AsServiceResourceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatelessServiceUpdateProperties. -func (ssup StatelessServiceUpdateProperties) AsServiceResourceUpdateProperties() (*ServiceResourceUpdateProperties, bool) { - return nil, false -} - -// AsBasicServiceResourceUpdateProperties is the BasicServiceResourceUpdateProperties implementation for StatelessServiceUpdateProperties. -func (ssup StatelessServiceUpdateProperties) AsBasicServiceResourceUpdateProperties() (BasicServiceResourceUpdateProperties, bool) { - return &ssup, true -} - -// UnmarshalJSON is the custom unmarshaler for StatelessServiceUpdateProperties struct. -func (ssup *StatelessServiceUpdateProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "instanceCount": - if v != nil { - var instanceCount int32 - err = json.Unmarshal(*v, &instanceCount) - if err != nil { - return err - } - ssup.InstanceCount = &instanceCount - } - case "instanceCloseDelayDuration": - if v != nil { - var instanceCloseDelayDuration string - err = json.Unmarshal(*v, &instanceCloseDelayDuration) - if err != nil { - return err - } - ssup.InstanceCloseDelayDuration = &instanceCloseDelayDuration - } - case "serviceKind": - if v != nil { - var serviceKind ServiceKindBasicServiceResourceUpdateProperties - err = json.Unmarshal(*v, &serviceKind) - if err != nil { - return err - } - ssup.ServiceKind = serviceKind - } - case "placementConstraints": - if v != nil { - var placementConstraints string - err = json.Unmarshal(*v, &placementConstraints) - if err != nil { - return err - } - ssup.PlacementConstraints = &placementConstraints - } - case "correlationScheme": - if v != nil { - var correlationScheme []ServiceCorrelationDescription - err = json.Unmarshal(*v, &correlationScheme) - if err != nil { - return err - } - ssup.CorrelationScheme = &correlationScheme - } - case "serviceLoadMetrics": - if v != nil { - var serviceLoadMetrics []ServiceLoadMetricDescription - err = json.Unmarshal(*v, &serviceLoadMetrics) - if err != nil { - return err - } - ssup.ServiceLoadMetrics = &serviceLoadMetrics - } - case "servicePlacementPolicies": - if v != nil { - servicePlacementPolicies, err := unmarshalBasicServicePlacementPolicyDescriptionArray(*v) - if err != nil { - return err - } - ssup.ServicePlacementPolicies = &servicePlacementPolicies - } - case "defaultMoveCost": - if v != nil { - var defaultMoveCost MoveCost - err = json.Unmarshal(*v, &defaultMoveCost) - if err != nil { - return err - } - ssup.DefaultMoveCost = defaultMoveCost - } - } - } - - return nil -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. - CreatedByType *string `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. - LastModifiedByType *string `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC). - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// UniformInt64RangePartitionSchemeDescription describes a partitioning scheme where an integer range is -// allocated evenly across a number of partitions. -type UniformInt64RangePartitionSchemeDescription struct { - // Count - The number of partitions. - Count *int32 `json:"count,omitempty"` - // LowKey - String indicating the lower bound of the partition key range that - // should be split between the partition ‘count’ - LowKey *string `json:"lowKey,omitempty"` - // HighKey - String indicating the upper bound of the partition key range that - // should be split between the partition ‘count’ - HighKey *string `json:"highKey,omitempty"` - // PartitionScheme - Possible values include: 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemePartitionSchemeDescription', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeNamed', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeSingleton', 'PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range' - PartitionScheme PartitionSchemeBasicPartitionSchemeDescription `json:"partitionScheme,omitempty"` -} - -// MarshalJSON is the custom marshaler for UniformInt64RangePartitionSchemeDescription. -func (ui6rpsd UniformInt64RangePartitionSchemeDescription) MarshalJSON() ([]byte, error) { - ui6rpsd.PartitionScheme = PartitionSchemeBasicPartitionSchemeDescriptionPartitionSchemeUniformInt64Range - objectMap := make(map[string]interface{}) - if ui6rpsd.Count != nil { - objectMap["count"] = ui6rpsd.Count - } - if ui6rpsd.LowKey != nil { - objectMap["lowKey"] = ui6rpsd.LowKey - } - if ui6rpsd.HighKey != nil { - objectMap["highKey"] = ui6rpsd.HighKey - } - if ui6rpsd.PartitionScheme != "" { - objectMap["partitionScheme"] = ui6rpsd.PartitionScheme - } - return json.Marshal(objectMap) -} - -// AsNamedPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for UniformInt64RangePartitionSchemeDescription. -func (ui6rpsd UniformInt64RangePartitionSchemeDescription) AsNamedPartitionSchemeDescription() (*NamedPartitionSchemeDescription, bool) { - return nil, false -} - -// AsSingletonPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for UniformInt64RangePartitionSchemeDescription. -func (ui6rpsd UniformInt64RangePartitionSchemeDescription) AsSingletonPartitionSchemeDescription() (*SingletonPartitionSchemeDescription, bool) { - return nil, false -} - -// AsUniformInt64RangePartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for UniformInt64RangePartitionSchemeDescription. -func (ui6rpsd UniformInt64RangePartitionSchemeDescription) AsUniformInt64RangePartitionSchemeDescription() (*UniformInt64RangePartitionSchemeDescription, bool) { - return &ui6rpsd, true -} - -// AsPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for UniformInt64RangePartitionSchemeDescription. -func (ui6rpsd UniformInt64RangePartitionSchemeDescription) AsPartitionSchemeDescription() (*PartitionSchemeDescription, bool) { - return nil, false -} - -// AsBasicPartitionSchemeDescription is the BasicPartitionSchemeDescription implementation for UniformInt64RangePartitionSchemeDescription. -func (ui6rpsd UniformInt64RangePartitionSchemeDescription) AsBasicPartitionSchemeDescription() (BasicPartitionSchemeDescription, bool) { - return &ui6rpsd, true -} - -// UpgradableVersionPathResult the list of intermediate cluster code versions for an upgrade or downgrade. -// Or minimum and maximum upgradable version if no target was given -type UpgradableVersionPathResult struct { - autorest.Response `json:"-"` - SupportedPath *[]string `json:"supportedPath,omitempty"` -} - -// UpgradableVersionsDescription ... -type UpgradableVersionsDescription struct { - // TargetVersion - The target code version. - TargetVersion *string `json:"targetVersion,omitempty"` -} - -// UserAssignedIdentity ... -type UserAssignedIdentity struct { - // PrincipalID - READ-ONLY; The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - READ-ONLY; The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserAssignedIdentity. -func (uai UserAssignedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/operations.go deleted file mode 100644 index a87fedac4662..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/operations.go +++ /dev/null @@ -1,141 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the service Fabric Management Client -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get the list of available Service Fabric resource provider API operations. -// Parameters: -// APIVersion - the version of the Service Fabric resource provider API -func (client OperationsClient) List(ctx context.Context, APIVersion string) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, APIVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context, APIVersion string) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ServiceFabric/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context, APIVersion string) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, APIVersion) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/services.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/services.go deleted file mode 100644 index 6293c4b06fd7..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/services.go +++ /dev/null @@ -1,445 +0,0 @@ -package servicefabric - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServicesClient is the service Fabric Management Client -type ServicesClient struct { - BaseClient -} - -// NewServicesClient creates an instance of the ServicesClient client. -func NewServicesClient(subscriptionID string) ServicesClient { - return NewServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServicesClientWithBaseURI creates an instance of the ServicesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewServicesClientWithBaseURI(baseURI string, subscriptionID string) ServicesClient { - return ServicesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a Service Fabric service resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -// serviceName - the name of the service resource in the format of {applicationName}~{serviceName}. -// parameters - the service resource. -func (client ServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, serviceName string, parameters ServiceResource) (result ServicesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, applicationName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, serviceName string, parameters ServiceResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) CreateOrUpdateSender(req *http.Request) (future ServicesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Service Fabric service resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -// serviceName - the name of the service resource in the format of {applicationName}~{serviceName}. -func (client ServicesClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, serviceName string) (result ServicesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, applicationName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) DeleteSender(req *http.Request) (future ServicesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a Service Fabric service resource created or in the process of being created in the Service Fabric -// application resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -// serviceName - the name of the service resource in the format of {applicationName}~{serviceName}. -func (client ServicesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, serviceName string) (result ServiceResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, applicationName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServicesClient) GetResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all service resources created or in the process of being created in the Service Fabric application -// resource. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -func (client ServicesClient) List(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (result ServiceResourceList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, clusterName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServicesClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServicesClient) ListResponder(resp *http.Response) (result ServiceResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update a Service Fabric service resource with the specified name. -// Parameters: -// resourceGroupName - the name of the resource group. -// clusterName - the name of the cluster resource. -// applicationName - the name of the application resource. -// serviceName - the name of the service resource in the format of {applicationName}~{serviceName}. -// parameters - the service resource for patch operations. -func (client ServicesClient) Update(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, serviceName string, parameters ServiceResourceUpdate) (result ServicesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, applicationName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ServicesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServicesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, serviceName string, parameters ServiceResourceUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) UpdateSender(req *http.Request) (future ServicesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ServicesClient) UpdateResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/version.go deleted file mode 100644 index abc4358c603f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package servicefabric - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " servicefabric/2021-06-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/CHANGELOG.md similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch/CHANGELOG.md rename to vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/CHANGELOG.md diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/_meta.json new file mode 100644 index 000000000000..5e8289ecebf2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "3587a60ea8f18e76a41e4b56b72aeddce879aae9", + "readme": "/_/azure-rest-api-specs/specification/web/resource-manager/readme.md", + "tag": "package-2021-03", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --pass-thru:schema-validator-swagger --enum-prefix /_/azure-rest-api-specs/specification/web/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --pass-thru:schema-validator-swagger --enum-prefix" + } +} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/apps.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/apps.go new file mode 100644 index 000000000000..31cff2b913d3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/apps.go @@ -0,0 +1,37361 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AppsClient is the webSite Management Client +type AppsClient struct { + BaseClient +} + +// NewAppsClient creates an instance of the AppsClient client. +func NewAppsClient(subscriptionID string) AppsClient { + return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppsClientWithBaseURI creates an instance of the AppsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { + return AppsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// AddPremierAddOn description for Updates a named add-on of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// premierAddOnName - add-on name. +// premierAddOn - a JSON representation of the edited premier add-on. +func (client AppsClient) AddPremierAddOn(ctx context.Context, resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn) (result PremierAddOn, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.AddPremierAddOn") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "AddPremierAddOn", err.Error()) + } + + req, err := client.AddPremierAddOnPreparer(ctx, resourceGroupName, name, premierAddOnName, premierAddOn) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOn", nil, "Failure preparing request") + return + } + + resp, err := client.AddPremierAddOnSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOn", resp, "Failure sending request") + return + } + + result, err = client.AddPremierAddOnResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOn", resp, "Failure responding to request") + return + } + + return +} + +// AddPremierAddOnPreparer prepares the AddPremierAddOn request. +func (client AppsClient) AddPremierAddOnPreparer(ctx context.Context, resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithJSON(premierAddOn), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddPremierAddOnSender sends the AddPremierAddOn request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) AddPremierAddOnSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// AddPremierAddOnResponder handles the response to the AddPremierAddOn request. The method always +// closes the http.Response Body. +func (client AppsClient) AddPremierAddOnResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddPremierAddOnSlot description for Updates a named add-on of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// premierAddOnName - add-on name. +// premierAddOn - a JSON representation of the edited premier add-on. +// slot - name of the deployment slot. If a slot is not specified, the API will update the named add-on for the +// production slot. +func (client AppsClient) AddPremierAddOnSlot(ctx context.Context, resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn, slot string) (result PremierAddOn, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.AddPremierAddOnSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "AddPremierAddOnSlot", err.Error()) + } + + req, err := client.AddPremierAddOnSlotPreparer(ctx, resourceGroupName, name, premierAddOnName, premierAddOn, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOnSlot", nil, "Failure preparing request") + return + } + + resp, err := client.AddPremierAddOnSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOnSlot", resp, "Failure sending request") + return + } + + result, err = client.AddPremierAddOnSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOnSlot", resp, "Failure responding to request") + return + } + + return +} + +// AddPremierAddOnSlotPreparer prepares the AddPremierAddOnSlot request. +func (client AppsClient) AddPremierAddOnSlotPreparer(ctx context.Context, resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithJSON(premierAddOn), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddPremierAddOnSlotSender sends the AddPremierAddOnSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) AddPremierAddOnSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// AddPremierAddOnSlotResponder handles the response to the AddPremierAddOnSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) AddPremierAddOnSlotResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AnalyzeCustomHostname description for Analyze a custom hostname. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// hostName - custom hostname. +func (client AppsClient) AnalyzeCustomHostname(ctx context.Context, resourceGroupName string, name string, hostName string) (result CustomHostnameAnalysisResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.AnalyzeCustomHostname") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "AnalyzeCustomHostname", err.Error()) + } + + req, err := client.AnalyzeCustomHostnamePreparer(ctx, resourceGroupName, name, hostName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostname", nil, "Failure preparing request") + return + } + + resp, err := client.AnalyzeCustomHostnameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostname", resp, "Failure sending request") + return + } + + result, err = client.AnalyzeCustomHostnameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostname", resp, "Failure responding to request") + return + } + + return +} + +// AnalyzeCustomHostnamePreparer prepares the AnalyzeCustomHostname request. +func (client AppsClient) AnalyzeCustomHostnamePreparer(ctx context.Context, resourceGroupName string, name string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(hostName) > 0 { + queryParameters["hostName"] = autorest.Encode("query", hostName) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/analyzeCustomHostname", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AnalyzeCustomHostnameSender sends the AnalyzeCustomHostname request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) AnalyzeCustomHostnameSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// AnalyzeCustomHostnameResponder handles the response to the AnalyzeCustomHostname request. The method always +// closes the http.Response Body. +func (client AppsClient) AnalyzeCustomHostnameResponder(resp *http.Response) (result CustomHostnameAnalysisResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AnalyzeCustomHostnameSlot description for Analyze a custom hostname. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of web app slot. If not specified then will default to production slot. +// hostName - custom hostname. +func (client AppsClient) AnalyzeCustomHostnameSlot(ctx context.Context, resourceGroupName string, name string, slot string, hostName string) (result CustomHostnameAnalysisResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.AnalyzeCustomHostnameSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "AnalyzeCustomHostnameSlot", err.Error()) + } + + req, err := client.AnalyzeCustomHostnameSlotPreparer(ctx, resourceGroupName, name, slot, hostName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostnameSlot", nil, "Failure preparing request") + return + } + + resp, err := client.AnalyzeCustomHostnameSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostnameSlot", resp, "Failure sending request") + return + } + + result, err = client.AnalyzeCustomHostnameSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostnameSlot", resp, "Failure responding to request") + return + } + + return +} + +// AnalyzeCustomHostnameSlotPreparer prepares the AnalyzeCustomHostnameSlot request. +func (client AppsClient) AnalyzeCustomHostnameSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(hostName) > 0 { + queryParameters["hostName"] = autorest.Encode("query", hostName) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/analyzeCustomHostname", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AnalyzeCustomHostnameSlotSender sends the AnalyzeCustomHostnameSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) AnalyzeCustomHostnameSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// AnalyzeCustomHostnameSlotResponder handles the response to the AnalyzeCustomHostnameSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) AnalyzeCustomHostnameSlotResponder(resp *http.Response) (result CustomHostnameAnalysisResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ApplySlotConfigToProduction description for Applies the configuration settings from the target slot onto the current +// slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slotSwapEntity - JSON object that contains the target slot name. See example. +func (client AppsClient) ApplySlotConfigToProduction(ctx context.Context, resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ApplySlotConfigToProduction") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ApplySlotConfigToProduction", err.Error()) + } + + req, err := client.ApplySlotConfigToProductionPreparer(ctx, resourceGroupName, name, slotSwapEntity) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigToProduction", nil, "Failure preparing request") + return + } + + resp, err := client.ApplySlotConfigToProductionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigToProduction", resp, "Failure sending request") + return + } + + result, err = client.ApplySlotConfigToProductionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigToProduction", resp, "Failure responding to request") + return + } + + return +} + +// ApplySlotConfigToProductionPreparer prepares the ApplySlotConfigToProduction request. +func (client AppsClient) ApplySlotConfigToProductionPreparer(ctx context.Context, resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/applySlotConfig", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ApplySlotConfigToProductionSender sends the ApplySlotConfigToProduction request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ApplySlotConfigToProductionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ApplySlotConfigToProductionResponder handles the response to the ApplySlotConfigToProduction request. The method always +// closes the http.Response Body. +func (client AppsClient) ApplySlotConfigToProductionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ApplySlotConfigurationSlot description for Applies the configuration settings from the target slot onto the current +// slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slotSwapEntity - JSON object that contains the target slot name. See example. +// slot - name of the source slot. If a slot is not specified, the production slot is used as the source slot. +func (client AppsClient) ApplySlotConfigurationSlot(ctx context.Context, resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ApplySlotConfigurationSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ApplySlotConfigurationSlot", err.Error()) + } + + req, err := client.ApplySlotConfigurationSlotPreparer(ctx, resourceGroupName, name, slotSwapEntity, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ApplySlotConfigurationSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.ApplySlotConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigurationSlot", resp, "Failure responding to request") + return + } + + return +} + +// ApplySlotConfigurationSlotPreparer prepares the ApplySlotConfigurationSlot request. +func (client AppsClient) ApplySlotConfigurationSlotPreparer(ctx context.Context, resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/applySlotConfig", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ApplySlotConfigurationSlotSender sends the ApplySlotConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ApplySlotConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ApplySlotConfigurationSlotResponder handles the response to the ApplySlotConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ApplySlotConfigurationSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ApproveOrRejectPrivateEndpointConnection description for Approves or rejects a private endpoint connection +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the site. +func (client AppsClient) ApproveOrRejectPrivateEndpointConnection(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, privateEndpointWrapper PrivateLinkConnectionApprovalRequestResource) (result AppsApproveOrRejectPrivateEndpointConnectionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ApproveOrRejectPrivateEndpointConnection") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ApproveOrRejectPrivateEndpointConnection", err.Error()) + } + + req, err := client.ApproveOrRejectPrivateEndpointConnectionPreparer(ctx, resourceGroupName, name, privateEndpointConnectionName, privateEndpointWrapper) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApproveOrRejectPrivateEndpointConnection", nil, "Failure preparing request") + return + } + + result, err = client.ApproveOrRejectPrivateEndpointConnectionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApproveOrRejectPrivateEndpointConnection", result.Response(), "Failure sending request") + return + } + + return +} + +// ApproveOrRejectPrivateEndpointConnectionPreparer prepares the ApproveOrRejectPrivateEndpointConnection request. +func (client AppsClient) ApproveOrRejectPrivateEndpointConnectionPreparer(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, privateEndpointWrapper PrivateLinkConnectionApprovalRequestResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(privateEndpointWrapper), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ApproveOrRejectPrivateEndpointConnectionSender sends the ApproveOrRejectPrivateEndpointConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ApproveOrRejectPrivateEndpointConnectionSender(req *http.Request) (future AppsApproveOrRejectPrivateEndpointConnectionFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ApproveOrRejectPrivateEndpointConnectionResponder handles the response to the ApproveOrRejectPrivateEndpointConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) ApproveOrRejectPrivateEndpointConnectionResponder(resp *http.Response) (result RemotePrivateEndpointConnectionARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ApproveOrRejectPrivateEndpointConnectionSlot description for Approves or rejects a private endpoint connection +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the site. +func (client AppsClient) ApproveOrRejectPrivateEndpointConnectionSlot(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, privateEndpointWrapper PrivateLinkConnectionApprovalRequestResource, slot string) (result AppsApproveOrRejectPrivateEndpointConnectionSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ApproveOrRejectPrivateEndpointConnectionSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ApproveOrRejectPrivateEndpointConnectionSlot", err.Error()) + } + + req, err := client.ApproveOrRejectPrivateEndpointConnectionSlotPreparer(ctx, resourceGroupName, name, privateEndpointConnectionName, privateEndpointWrapper, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApproveOrRejectPrivateEndpointConnectionSlot", nil, "Failure preparing request") + return + } + + result, err = client.ApproveOrRejectPrivateEndpointConnectionSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApproveOrRejectPrivateEndpointConnectionSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// ApproveOrRejectPrivateEndpointConnectionSlotPreparer prepares the ApproveOrRejectPrivateEndpointConnectionSlot request. +func (client AppsClient) ApproveOrRejectPrivateEndpointConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, privateEndpointWrapper PrivateLinkConnectionApprovalRequestResource, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(privateEndpointWrapper), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ApproveOrRejectPrivateEndpointConnectionSlotSender sends the ApproveOrRejectPrivateEndpointConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ApproveOrRejectPrivateEndpointConnectionSlotSender(req *http.Request) (future AppsApproveOrRejectPrivateEndpointConnectionSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ApproveOrRejectPrivateEndpointConnectionSlotResponder handles the response to the ApproveOrRejectPrivateEndpointConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ApproveOrRejectPrivateEndpointConnectionSlotResponder(resp *http.Response) (result RemotePrivateEndpointConnectionARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Backup description for Creates a backup of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// request - backup configuration. You can use the JSON response from the POST action as input here. +func (client AppsClient) Backup(ctx context.Context, resourceGroupName string, name string, request BackupRequest) (result BackupItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Backup") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.StorageAccountURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "Backup", err.Error()) + } + + req, err := client.BackupPreparer(ctx, resourceGroupName, name, request) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Backup", nil, "Failure preparing request") + return + } + + resp, err := client.BackupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "Backup", resp, "Failure sending request") + return + } + + result, err = client.BackupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Backup", resp, "Failure responding to request") + return + } + + return +} + +// BackupPreparer prepares the Backup request. +func (client AppsClient) BackupPreparer(ctx context.Context, resourceGroupName string, name string, request BackupRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BackupSender sends the Backup request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) BackupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// BackupResponder handles the response to the Backup request. The method always +// closes the http.Response Body. +func (client AppsClient) BackupResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// BackupSlot description for Creates a backup of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// request - backup configuration. You can use the JSON response from the POST action as input here. +// slot - name of the deployment slot. If a slot is not specified, the API will create a backup for the +// production slot. +func (client AppsClient) BackupSlot(ctx context.Context, resourceGroupName string, name string, request BackupRequest, slot string) (result BackupItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.BackupSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.StorageAccountURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "BackupSlot", err.Error()) + } + + req, err := client.BackupSlotPreparer(ctx, resourceGroupName, name, request, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "BackupSlot", nil, "Failure preparing request") + return + } + + resp, err := client.BackupSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "BackupSlot", resp, "Failure sending request") + return + } + + result, err = client.BackupSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "BackupSlot", resp, "Failure responding to request") + return + } + + return +} + +// BackupSlotPreparer prepares the BackupSlot request. +func (client AppsClient) BackupSlotPreparer(ctx context.Context, resourceGroupName string, name string, request BackupRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backup", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BackupSlotSender sends the BackupSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) BackupSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// BackupSlotResponder handles the response to the BackupSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) BackupSlotResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateDeployment description for Create a deployment for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// ID - ID of an existing deployment. +// deployment - deployment details. +func (client AppsClient) CreateDeployment(ctx context.Context, resourceGroupName string, name string, ID string, deployment Deployment) (result Deployment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateDeployment") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateDeployment", err.Error()) + } + + req, err := client.CreateDeploymentPreparer(ctx, resourceGroupName, name, ID, deployment) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeployment", nil, "Failure preparing request") + return + } + + resp, err := client.CreateDeploymentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeployment", resp, "Failure sending request") + return + } + + result, err = client.CreateDeploymentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeployment", resp, "Failure responding to request") + return + } + + return +} + +// CreateDeploymentPreparer prepares the CreateDeployment request. +func (client AppsClient) CreateDeploymentPreparer(ctx context.Context, resourceGroupName string, name string, ID string, deployment Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}", pathParameters), + autorest.WithJSON(deployment), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateDeploymentSender sends the CreateDeployment request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateDeploymentSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateDeploymentResponder handles the response to the CreateDeployment request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateDeploymentResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateDeploymentSlot description for Create a deployment for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// ID - ID of an existing deployment. +// slot - name of the deployment slot. If a slot is not specified, the API creates a deployment for the +// production slot. +// deployment - deployment details. +func (client AppsClient) CreateDeploymentSlot(ctx context.Context, resourceGroupName string, name string, ID string, slot string, deployment Deployment) (result Deployment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateDeploymentSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateDeploymentSlot", err.Error()) + } + + req, err := client.CreateDeploymentSlotPreparer(ctx, resourceGroupName, name, ID, slot, deployment) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeploymentSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateDeploymentSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeploymentSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateDeploymentSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeploymentSlot", resp, "Failure responding to request") + return + } + + return +} + +// CreateDeploymentSlotPreparer prepares the CreateDeploymentSlot request. +func (client AppsClient) CreateDeploymentSlotPreparer(ctx context.Context, resourceGroupName string, name string, ID string, slot string, deployment Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}", pathParameters), + autorest.WithJSON(deployment), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateDeploymentSlotSender sends the CreateDeploymentSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateDeploymentSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateDeploymentSlotResponder handles the response to the CreateDeploymentSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateFunction description for Create function for web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// functionName - function name. +// functionEnvelope - function details. +func (client AppsClient) CreateFunction(ctx context.Context, resourceGroupName string, name string, functionName string, functionEnvelope FunctionEnvelope) (result AppsCreateFunctionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateFunction") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateFunction", err.Error()) + } + + req, err := client.CreateFunctionPreparer(ctx, resourceGroupName, name, functionName, functionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateFunction", nil, "Failure preparing request") + return + } + + result, err = client.CreateFunctionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateFunction", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateFunctionPreparer prepares the CreateFunction request. +func (client AppsClient) CreateFunctionPreparer(ctx context.Context, resourceGroupName string, name string, functionName string, functionEnvelope FunctionEnvelope) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}", pathParameters), + autorest.WithJSON(functionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateFunctionSender sends the CreateFunction request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateFunctionSender(req *http.Request) (future AppsCreateFunctionFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateFunctionResponder handles the response to the CreateFunction request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateFunctionResponder(resp *http.Response) (result FunctionEnvelope, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateInstanceFunctionSlot description for Create function for web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// functionName - function name. +// slot - name of the deployment slot. +// functionEnvelope - function details. +func (client AppsClient) CreateInstanceFunctionSlot(ctx context.Context, resourceGroupName string, name string, functionName string, slot string, functionEnvelope FunctionEnvelope) (result AppsCreateInstanceFunctionSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateInstanceFunctionSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateInstanceFunctionSlot", err.Error()) + } + + req, err := client.CreateInstanceFunctionSlotPreparer(ctx, resourceGroupName, name, functionName, slot, functionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceFunctionSlot", nil, "Failure preparing request") + return + } + + result, err = client.CreateInstanceFunctionSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceFunctionSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateInstanceFunctionSlotPreparer prepares the CreateInstanceFunctionSlot request. +func (client AppsClient) CreateInstanceFunctionSlotPreparer(ctx context.Context, resourceGroupName string, name string, functionName string, slot string, functionEnvelope FunctionEnvelope) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}", pathParameters), + autorest.WithJSON(functionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateInstanceFunctionSlotSender sends the CreateInstanceFunctionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateInstanceFunctionSlotSender(req *http.Request) (future AppsCreateInstanceFunctionSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateInstanceFunctionSlotResponder handles the response to the CreateInstanceFunctionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateInstanceFunctionSlotResponder(resp *http.Response) (result FunctionEnvelope, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateInstanceMSDeployOperation description for Invoke the MSDeploy web app extension. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// instanceID - ID of web app instance. +// mSDeploy - details of MSDeploy operation +func (client AppsClient) CreateInstanceMSDeployOperation(ctx context.Context, resourceGroupName string, name string, instanceID string, mSDeploy MSDeploy) (result AppsCreateInstanceMSDeployOperationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateInstanceMSDeployOperation") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateInstanceMSDeployOperation", err.Error()) + } + + req, err := client.CreateInstanceMSDeployOperationPreparer(ctx, resourceGroupName, name, instanceID, mSDeploy) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceMSDeployOperation", nil, "Failure preparing request") + return + } + + result, err = client.CreateInstanceMSDeployOperationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceMSDeployOperation", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateInstanceMSDeployOperationPreparer prepares the CreateInstanceMSDeployOperation request. +func (client AppsClient) CreateInstanceMSDeployOperationPreparer(ctx context.Context, resourceGroupName string, name string, instanceID string, mSDeploy MSDeploy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy", pathParameters), + autorest.WithJSON(mSDeploy), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateInstanceMSDeployOperationSender sends the CreateInstanceMSDeployOperation request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateInstanceMSDeployOperationSender(req *http.Request) (future AppsCreateInstanceMSDeployOperationFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateInstanceMSDeployOperationResponder handles the response to the CreateInstanceMSDeployOperation request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateInstanceMSDeployOperationResponder(resp *http.Response) (result MSDeployStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateInstanceMSDeployOperationSlot description for Invoke the MSDeploy web app extension. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of web app slot. If not specified then will default to production slot. +// instanceID - ID of web app instance. +// mSDeploy - details of MSDeploy operation +func (client AppsClient) CreateInstanceMSDeployOperationSlot(ctx context.Context, resourceGroupName string, name string, slot string, instanceID string, mSDeploy MSDeploy) (result AppsCreateInstanceMSDeployOperationSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateInstanceMSDeployOperationSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateInstanceMSDeployOperationSlot", err.Error()) + } + + req, err := client.CreateInstanceMSDeployOperationSlotPreparer(ctx, resourceGroupName, name, slot, instanceID, mSDeploy) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceMSDeployOperationSlot", nil, "Failure preparing request") + return + } + + result, err = client.CreateInstanceMSDeployOperationSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceMSDeployOperationSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateInstanceMSDeployOperationSlotPreparer prepares the CreateInstanceMSDeployOperationSlot request. +func (client AppsClient) CreateInstanceMSDeployOperationSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, instanceID string, mSDeploy MSDeploy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy", pathParameters), + autorest.WithJSON(mSDeploy), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateInstanceMSDeployOperationSlotSender sends the CreateInstanceMSDeployOperationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateInstanceMSDeployOperationSlotSender(req *http.Request) (future AppsCreateInstanceMSDeployOperationSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateInstanceMSDeployOperationSlotResponder handles the response to the CreateInstanceMSDeployOperationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateInstanceMSDeployOperationSlotResponder(resp *http.Response) (result MSDeployStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateMSDeployOperation description for Invoke the MSDeploy web app extension. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// mSDeploy - details of MSDeploy operation +func (client AppsClient) CreateMSDeployOperation(ctx context.Context, resourceGroupName string, name string, mSDeploy MSDeploy) (result AppsCreateMSDeployOperationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateMSDeployOperation") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateMSDeployOperation", err.Error()) + } + + req, err := client.CreateMSDeployOperationPreparer(ctx, resourceGroupName, name, mSDeploy) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateMSDeployOperation", nil, "Failure preparing request") + return + } + + result, err = client.CreateMSDeployOperationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateMSDeployOperation", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateMSDeployOperationPreparer prepares the CreateMSDeployOperation request. +func (client AppsClient) CreateMSDeployOperationPreparer(ctx context.Context, resourceGroupName string, name string, mSDeploy MSDeploy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy", pathParameters), + autorest.WithJSON(mSDeploy), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateMSDeployOperationSender sends the CreateMSDeployOperation request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateMSDeployOperationSender(req *http.Request) (future AppsCreateMSDeployOperationFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateMSDeployOperationResponder handles the response to the CreateMSDeployOperation request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateMSDeployOperationResponder(resp *http.Response) (result MSDeployStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateMSDeployOperationSlot description for Invoke the MSDeploy web app extension. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of web app slot. If not specified then will default to production slot. +// mSDeploy - details of MSDeploy operation +func (client AppsClient) CreateMSDeployOperationSlot(ctx context.Context, resourceGroupName string, name string, slot string, mSDeploy MSDeploy) (result AppsCreateMSDeployOperationSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateMSDeployOperationSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateMSDeployOperationSlot", err.Error()) + } + + req, err := client.CreateMSDeployOperationSlotPreparer(ctx, resourceGroupName, name, slot, mSDeploy) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateMSDeployOperationSlot", nil, "Failure preparing request") + return + } + + result, err = client.CreateMSDeployOperationSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateMSDeployOperationSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateMSDeployOperationSlotPreparer prepares the CreateMSDeployOperationSlot request. +func (client AppsClient) CreateMSDeployOperationSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, mSDeploy MSDeploy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy", pathParameters), + autorest.WithJSON(mSDeploy), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateMSDeployOperationSlotSender sends the CreateMSDeployOperationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateMSDeployOperationSlotSender(req *http.Request) (future AppsCreateMSDeployOperationSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateMSDeployOperationSlotResponder handles the response to the CreateMSDeployOperationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateMSDeployOperationSlotResponder(resp *http.Response) (result MSDeployStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate description for Creates a new web, mobile, or API app in an existing resource group, or updates an +// existing app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - unique name of the app to create or update. To create or update a deployment slot, use the {slot} +// parameter. +// siteEnvelope - a JSON representation of the app properties. See example. +func (client AppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, siteEnvelope Site) (result AppsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteEnvelope, + Constraints: []validation.Constraint{{Target: "siteEnvelope.SiteProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push.PushSettingsProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push.PushSettingsProperties.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "siteEnvelope.SiteProperties.SiteConfig.PreWarmedInstanceCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.PreWarmedInstanceCount", Name: validation.InclusiveMaximum, Rule: int64(10), Chain: nil}, + {Target: "siteEnvelope.SiteProperties.SiteConfig.PreWarmedInstanceCount", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "siteEnvelope.SiteProperties.SiteConfig.FunctionAppScaleLimit", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.FunctionAppScaleLimit", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, + {Target: "siteEnvelope.SiteProperties.SiteConfig.MinimumElasticInstanceCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.MinimumElasticInstanceCount", Name: validation.InclusiveMaximum, Rule: int64(20), Chain: nil}, + {Target: "siteEnvelope.SiteProperties.SiteConfig.MinimumElasticInstanceCount", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + {Target: "siteEnvelope.SiteProperties.CloningInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.CloningInfo.SourceWebAppID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, siteEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, siteEnvelope Site) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", pathParameters), + autorest.WithJSON(siteEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSender(req *http.Request) (future AppsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateResponder(resp *http.Response) (result Site, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateConfiguration description for Updates the configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// siteConfig - JSON representation of a SiteConfig object. See example. +func (client AppsClient) CreateOrUpdateConfiguration(ctx context.Context, resourceGroupName string, name string, siteConfig SiteConfigResource) (result SiteConfigResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateConfiguration") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteConfig, + Constraints: []validation.Constraint{{Target: "siteConfig.SiteConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push.PushSettingsProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push.PushSettingsProperties.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "siteConfig.SiteConfig.PreWarmedInstanceCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.PreWarmedInstanceCount", Name: validation.InclusiveMaximum, Rule: int64(10), Chain: nil}, + {Target: "siteConfig.SiteConfig.PreWarmedInstanceCount", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "siteConfig.SiteConfig.FunctionAppScaleLimit", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.FunctionAppScaleLimit", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, + {Target: "siteConfig.SiteConfig.MinimumElasticInstanceCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.MinimumElasticInstanceCount", Name: validation.InclusiveMaximum, Rule: int64(20), Chain: nil}, + {Target: "siteConfig.SiteConfig.MinimumElasticInstanceCount", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateConfiguration", err.Error()) + } + + req, err := client.CreateOrUpdateConfigurationPreparer(ctx, resourceGroupName, name, siteConfig) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfiguration", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfiguration", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateConfigurationPreparer prepares the CreateOrUpdateConfiguration request. +func (client AppsClient) CreateOrUpdateConfigurationPreparer(ctx context.Context, resourceGroupName string, name string, siteConfig SiteConfigResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web", pathParameters), + autorest.WithJSON(siteConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateConfigurationSender sends the CreateOrUpdateConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateConfigurationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateConfigurationResponder handles the response to the CreateOrUpdateConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateConfigurationResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateConfigurationSlot description for Updates the configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// siteConfig - JSON representation of a SiteConfig object. See example. +// slot - name of the deployment slot. If a slot is not specified, the API will update configuration for the +// production slot. +func (client AppsClient) CreateOrUpdateConfigurationSlot(ctx context.Context, resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (result SiteConfigResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateConfigurationSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteConfig, + Constraints: []validation.Constraint{{Target: "siteConfig.SiteConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push.PushSettingsProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push.PushSettingsProperties.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "siteConfig.SiteConfig.PreWarmedInstanceCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.PreWarmedInstanceCount", Name: validation.InclusiveMaximum, Rule: int64(10), Chain: nil}, + {Target: "siteConfig.SiteConfig.PreWarmedInstanceCount", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "siteConfig.SiteConfig.FunctionAppScaleLimit", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.FunctionAppScaleLimit", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, + {Target: "siteConfig.SiteConfig.MinimumElasticInstanceCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.MinimumElasticInstanceCount", Name: validation.InclusiveMaximum, Rule: int64(20), Chain: nil}, + {Target: "siteConfig.SiteConfig.MinimumElasticInstanceCount", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateConfigurationSlot", err.Error()) + } + + req, err := client.CreateOrUpdateConfigurationSlotPreparer(ctx, resourceGroupName, name, siteConfig, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfigurationSlot", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateConfigurationSlotPreparer prepares the CreateOrUpdateConfigurationSlot request. +func (client AppsClient) CreateOrUpdateConfigurationSlotPreparer(ctx context.Context, resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web", pathParameters), + autorest.WithJSON(siteConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateConfigurationSlotSender sends the CreateOrUpdateConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateConfigurationSlotResponder handles the response to the CreateOrUpdateConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateConfigurationSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateDomainOwnershipIdentifier description for Creates a domain ownership identifier for web app, or +// updates an existing ownership identifier. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// domainOwnershipIdentifierName - name of domain ownership identifier. +// domainOwnershipIdentifier - a JSON representation of the domain ownership properties. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifier(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (result Identifier, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateDomainOwnershipIdentifier") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier", err.Error()) + } + + req, err := client.CreateOrUpdateDomainOwnershipIdentifierPreparer(ctx, resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateDomainOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateDomainOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateDomainOwnershipIdentifierPreparer prepares the CreateOrUpdateDomainOwnershipIdentifier request. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierPreparer(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateDomainOwnershipIdentifierSender sends the CreateOrUpdateDomainOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateDomainOwnershipIdentifierResponder handles the response to the CreateOrUpdateDomainOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateDomainOwnershipIdentifierSlot description for Creates a domain ownership identifier for web app, or +// updates an existing ownership identifier. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// domainOwnershipIdentifierName - name of domain ownership identifier. +// domainOwnershipIdentifier - a JSON representation of the domain ownership properties. +// slot - name of the deployment slot. If a slot is not specified, the API will delete the binding for the +// production slot. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlot(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (result Identifier, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateDomainOwnershipIdentifierSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot", err.Error()) + } + + req, err := client.CreateOrUpdateDomainOwnershipIdentifierSlotPreparer(ctx, resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateDomainOwnershipIdentifierSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateDomainOwnershipIdentifierSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateDomainOwnershipIdentifierSlotPreparer prepares the CreateOrUpdateDomainOwnershipIdentifierSlot request. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlotPreparer(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateDomainOwnershipIdentifierSlotSender sends the CreateOrUpdateDomainOwnershipIdentifierSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateDomainOwnershipIdentifierSlotResponder handles the response to the CreateOrUpdateDomainOwnershipIdentifierSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateFunctionSecret description for Add or update a function secret. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// functionName - the name of the function. +// keyName - the name of the key. +// key - the key to create or update +func (client AppsClient) CreateOrUpdateFunctionSecret(ctx context.Context, resourceGroupName string, name string, functionName string, keyName string, key KeyInfo) (result KeyInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateFunctionSecret") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateFunctionSecret", err.Error()) + } + + req, err := client.CreateOrUpdateFunctionSecretPreparer(ctx, resourceGroupName, name, functionName, keyName, key) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateFunctionSecret", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateFunctionSecretSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateFunctionSecret", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateFunctionSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateFunctionSecret", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateFunctionSecretPreparer prepares the CreateOrUpdateFunctionSecret request. +func (client AppsClient) CreateOrUpdateFunctionSecretPreparer(ctx context.Context, resourceGroupName string, name string, functionName string, keyName string, key KeyInfo) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "keyName": autorest.Encode("path", keyName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/keys/{keyName}", pathParameters), + autorest.WithJSON(key), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateFunctionSecretSender sends the CreateOrUpdateFunctionSecret request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateFunctionSecretSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateFunctionSecretResponder handles the response to the CreateOrUpdateFunctionSecret request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateFunctionSecretResponder(resp *http.Response) (result KeyInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateFunctionSecretSlot description for Add or update a function secret. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// functionName - the name of the function. +// keyName - the name of the key. +// slot - name of the deployment slot. +// key - the key to create or update +func (client AppsClient) CreateOrUpdateFunctionSecretSlot(ctx context.Context, resourceGroupName string, name string, functionName string, keyName string, slot string, key KeyInfo) (result KeyInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateFunctionSecretSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateFunctionSecretSlot", err.Error()) + } + + req, err := client.CreateOrUpdateFunctionSecretSlotPreparer(ctx, resourceGroupName, name, functionName, keyName, slot, key) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateFunctionSecretSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateFunctionSecretSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateFunctionSecretSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateFunctionSecretSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateFunctionSecretSlot", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateFunctionSecretSlotPreparer prepares the CreateOrUpdateFunctionSecretSlot request. +func (client AppsClient) CreateOrUpdateFunctionSecretSlotPreparer(ctx context.Context, resourceGroupName string, name string, functionName string, keyName string, slot string, key KeyInfo) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "keyName": autorest.Encode("path", keyName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/keys/{keyName}", pathParameters), + autorest.WithJSON(key), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateFunctionSecretSlotSender sends the CreateOrUpdateFunctionSecretSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateFunctionSecretSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateFunctionSecretSlotResponder handles the response to the CreateOrUpdateFunctionSecretSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateFunctionSecretSlotResponder(resp *http.Response) (result KeyInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateHostNameBinding description for Creates a hostname binding for an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// hostName - hostname in the hostname binding. +// hostNameBinding - binding details. This is the JSON representation of a HostNameBinding object. +func (client AppsClient) CreateOrUpdateHostNameBinding(ctx context.Context, resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding) (result HostNameBinding, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateHostNameBinding") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateHostNameBinding", err.Error()) + } + + req, err := client.CreateOrUpdateHostNameBindingPreparer(ctx, resourceGroupName, name, hostName, hostNameBinding) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBinding", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateHostNameBindingSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBinding", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateHostNameBindingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBinding", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateHostNameBindingPreparer prepares the CreateOrUpdateHostNameBinding request. +func (client AppsClient) CreateOrUpdateHostNameBindingPreparer(ctx context.Context, resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}", pathParameters), + autorest.WithJSON(hostNameBinding), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateHostNameBindingSender sends the CreateOrUpdateHostNameBinding request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateHostNameBindingSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateHostNameBindingResponder handles the response to the CreateOrUpdateHostNameBinding request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateHostNameBindingResponder(resp *http.Response) (result HostNameBinding, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateHostNameBindingSlot description for Creates a hostname binding for an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// hostName - hostname in the hostname binding. +// hostNameBinding - binding details. This is the JSON representation of a HostNameBinding object. +// slot - name of the deployment slot. If a slot is not specified, the API will create a binding for the +// production slot. +func (client AppsClient) CreateOrUpdateHostNameBindingSlot(ctx context.Context, resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding, slot string) (result HostNameBinding, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateHostNameBindingSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateHostNameBindingSlot", err.Error()) + } + + req, err := client.CreateOrUpdateHostNameBindingSlotPreparer(ctx, resourceGroupName, name, hostName, hostNameBinding, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBindingSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateHostNameBindingSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBindingSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateHostNameBindingSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBindingSlot", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateHostNameBindingSlotPreparer prepares the CreateOrUpdateHostNameBindingSlot request. +func (client AppsClient) CreateOrUpdateHostNameBindingSlotPreparer(ctx context.Context, resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}", pathParameters), + autorest.WithJSON(hostNameBinding), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateHostNameBindingSlotSender sends the CreateOrUpdateHostNameBindingSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateHostNameBindingSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateHostNameBindingSlotResponder handles the response to the CreateOrUpdateHostNameBindingSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateHostNameBindingSlotResponder(resp *http.Response) (result HostNameBinding, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateHostSecret description for Add or update a host level secret. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// keyType - the type of host key. +// keyName - the name of the key. +// key - the key to create or update +func (client AppsClient) CreateOrUpdateHostSecret(ctx context.Context, resourceGroupName string, name string, keyType string, keyName string, key KeyInfo) (result KeyInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateHostSecret") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateHostSecret", err.Error()) + } + + req, err := client.CreateOrUpdateHostSecretPreparer(ctx, resourceGroupName, name, keyType, keyName, key) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostSecret", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateHostSecretSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostSecret", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateHostSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostSecret", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateHostSecretPreparer prepares the CreateOrUpdateHostSecret request. +func (client AppsClient) CreateOrUpdateHostSecretPreparer(ctx context.Context, resourceGroupName string, name string, keyType string, keyName string, key KeyInfo) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "keyName": autorest.Encode("path", keyName), + "keyType": autorest.Encode("path", keyType), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/{keyType}/{keyName}", pathParameters), + autorest.WithJSON(key), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateHostSecretSender sends the CreateOrUpdateHostSecret request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateHostSecretSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateHostSecretResponder handles the response to the CreateOrUpdateHostSecret request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateHostSecretResponder(resp *http.Response) (result KeyInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateHostSecretSlot description for Add or update a host level secret. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// keyType - the type of host key. +// keyName - the name of the key. +// slot - name of the deployment slot. +// key - the key to create or update +func (client AppsClient) CreateOrUpdateHostSecretSlot(ctx context.Context, resourceGroupName string, name string, keyType string, keyName string, slot string, key KeyInfo) (result KeyInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateHostSecretSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateHostSecretSlot", err.Error()) + } + + req, err := client.CreateOrUpdateHostSecretSlotPreparer(ctx, resourceGroupName, name, keyType, keyName, slot, key) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostSecretSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateHostSecretSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostSecretSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateHostSecretSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostSecretSlot", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateHostSecretSlotPreparer prepares the CreateOrUpdateHostSecretSlot request. +func (client AppsClient) CreateOrUpdateHostSecretSlotPreparer(ctx context.Context, resourceGroupName string, name string, keyType string, keyName string, slot string, key KeyInfo) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "keyName": autorest.Encode("path", keyName), + "keyType": autorest.Encode("path", keyType), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/{keyType}/{keyName}", pathParameters), + autorest.WithJSON(key), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateHostSecretSlotSender sends the CreateOrUpdateHostSecretSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateHostSecretSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateHostSecretSlotResponder handles the response to the CreateOrUpdateHostSecretSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateHostSecretSlotResponder(resp *http.Response) (result KeyInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateHybridConnection description for Creates a new Hybrid Connection using a Service Bus relay. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// namespaceName - the namespace for this hybrid connection. +// relayName - the relay name for this hybrid connection. +// connectionEnvelope - the details of the hybrid connection. +func (client AppsClient) CreateOrUpdateHybridConnection(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (result HybridConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateHybridConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateHybridConnection", err.Error()) + } + + req, err := client.CreateOrUpdateHybridConnectionPreparer(ctx, resourceGroupName, name, namespaceName, relayName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnection", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnection", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnection", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateHybridConnectionPreparer prepares the CreateOrUpdateHybridConnection request. +func (client AppsClient) CreateOrUpdateHybridConnectionPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateHybridConnectionSender sends the CreateOrUpdateHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateHybridConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateHybridConnectionResponder handles the response to the CreateOrUpdateHybridConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateHybridConnectionSlot description for Creates a new Hybrid Connection using a Service Bus relay. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// namespaceName - the namespace for this hybrid connection. +// relayName - the relay name for this hybrid connection. +// connectionEnvelope - the details of the hybrid connection. +// slot - the name of the slot for the web app. +func (client AppsClient) CreateOrUpdateHybridConnectionSlot(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (result HybridConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateHybridConnectionSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateHybridConnectionSlot", err.Error()) + } + + req, err := client.CreateOrUpdateHybridConnectionSlotPreparer(ctx, resourceGroupName, name, namespaceName, relayName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateHybridConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateHybridConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnectionSlot", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateHybridConnectionSlotPreparer prepares the CreateOrUpdateHybridConnectionSlot request. +func (client AppsClient) CreateOrUpdateHybridConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateHybridConnectionSlotSender sends the CreateOrUpdateHybridConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateHybridConnectionSlotResponder handles the response to the CreateOrUpdateHybridConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateHybridConnectionSlotResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdatePublicCertificate description for Creates a hostname binding for an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// publicCertificateName - public certificate name. +// publicCertificate - public certificate details. This is the JSON representation of a PublicCertificate +// object. +func (client AppsClient) CreateOrUpdatePublicCertificate(ctx context.Context, resourceGroupName string, name string, publicCertificateName string, publicCertificate PublicCertificate) (result PublicCertificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdatePublicCertificate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdatePublicCertificate", err.Error()) + } + + req, err := client.CreateOrUpdatePublicCertificatePreparer(ctx, resourceGroupName, name, publicCertificateName, publicCertificate) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdatePublicCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdatePublicCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdatePublicCertificate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdatePublicCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdatePublicCertificate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePublicCertificatePreparer prepares the CreateOrUpdatePublicCertificate request. +func (client AppsClient) CreateOrUpdatePublicCertificatePreparer(ctx context.Context, resourceGroupName string, name string, publicCertificateName string, publicCertificate PublicCertificate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "publicCertificateName": autorest.Encode("path", publicCertificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}", pathParameters), + autorest.WithJSON(publicCertificate), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdatePublicCertificateSender sends the CreateOrUpdatePublicCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdatePublicCertificateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdatePublicCertificateResponder handles the response to the CreateOrUpdatePublicCertificate request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdatePublicCertificateResponder(resp *http.Response) (result PublicCertificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdatePublicCertificateSlot description for Creates a hostname binding for an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// publicCertificateName - public certificate name. +// publicCertificate - public certificate details. This is the JSON representation of a PublicCertificate +// object. +// slot - name of the deployment slot. If a slot is not specified, the API will create a binding for the +// production slot. +func (client AppsClient) CreateOrUpdatePublicCertificateSlot(ctx context.Context, resourceGroupName string, name string, publicCertificateName string, publicCertificate PublicCertificate, slot string) (result PublicCertificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdatePublicCertificateSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdatePublicCertificateSlot", err.Error()) + } + + req, err := client.CreateOrUpdatePublicCertificateSlotPreparer(ctx, resourceGroupName, name, publicCertificateName, publicCertificate, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdatePublicCertificateSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdatePublicCertificateSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdatePublicCertificateSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdatePublicCertificateSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdatePublicCertificateSlot", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePublicCertificateSlotPreparer prepares the CreateOrUpdatePublicCertificateSlot request. +func (client AppsClient) CreateOrUpdatePublicCertificateSlotPreparer(ctx context.Context, resourceGroupName string, name string, publicCertificateName string, publicCertificate PublicCertificate, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "publicCertificateName": autorest.Encode("path", publicCertificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}", pathParameters), + autorest.WithJSON(publicCertificate), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdatePublicCertificateSlotSender sends the CreateOrUpdatePublicCertificateSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdatePublicCertificateSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdatePublicCertificateSlotResponder handles the response to the CreateOrUpdatePublicCertificateSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdatePublicCertificateSlotResponder(resp *http.Response) (result PublicCertificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateRelayServiceConnection description for Creates a new hybrid connection configuration (PUT), or updates +// an existing one (PATCH). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// entityName - name of the hybrid connection configuration. +// connectionEnvelope - details of the hybrid connection configuration. +func (client AppsClient) CreateOrUpdateRelayServiceConnection(ctx context.Context, resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (result RelayServiceConnectionEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateRelayServiceConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateRelayServiceConnection", err.Error()) + } + + req, err := client.CreateOrUpdateRelayServiceConnectionPreparer(ctx, resourceGroupName, name, entityName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnection", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateRelayServiceConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnection", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateRelayServiceConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnection", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateRelayServiceConnectionPreparer prepares the CreateOrUpdateRelayServiceConnection request. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionPreparer(ctx context.Context, resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateRelayServiceConnectionSender sends the CreateOrUpdateRelayServiceConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateRelayServiceConnectionResponder handles the response to the CreateOrUpdateRelayServiceConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateRelayServiceConnectionSlot description for Creates a new hybrid connection configuration (PUT), or +// updates an existing one (PATCH). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// entityName - name of the hybrid connection configuration. +// connectionEnvelope - details of the hybrid connection configuration. +// slot - name of the deployment slot. If a slot is not specified, the API will create or update a hybrid +// connection for the production slot. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlot(ctx context.Context, resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (result RelayServiceConnectionEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateRelayServiceConnectionSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot", err.Error()) + } + + req, err := client.CreateOrUpdateRelayServiceConnectionSlotPreparer(ctx, resourceGroupName, name, entityName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateRelayServiceConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateRelayServiceConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateRelayServiceConnectionSlotPreparer prepares the CreateOrUpdateRelayServiceConnectionSlot request. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateRelayServiceConnectionSlotSender sends the CreateOrUpdateRelayServiceConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateRelayServiceConnectionSlotResponder handles the response to the CreateOrUpdateRelayServiceConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateSlot description for Creates a new web, mobile, or API app in an existing resource group, or updates +// an existing app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - unique name of the app to create or update. To create or update a deployment slot, use the {slot} +// parameter. +// siteEnvelope - a JSON representation of the app properties. See example. +// slot - name of the deployment slot to create or update. By default, this API attempts to create or modify +// the production slot. +func (client AppsClient) CreateOrUpdateSlot(ctx context.Context, resourceGroupName string, name string, siteEnvelope Site, slot string) (result AppsCreateOrUpdateSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteEnvelope, + Constraints: []validation.Constraint{{Target: "siteEnvelope.SiteProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push.PushSettingsProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push.PushSettingsProperties.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "siteEnvelope.SiteProperties.SiteConfig.PreWarmedInstanceCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.PreWarmedInstanceCount", Name: validation.InclusiveMaximum, Rule: int64(10), Chain: nil}, + {Target: "siteEnvelope.SiteProperties.SiteConfig.PreWarmedInstanceCount", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "siteEnvelope.SiteProperties.SiteConfig.FunctionAppScaleLimit", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.FunctionAppScaleLimit", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, + {Target: "siteEnvelope.SiteProperties.SiteConfig.MinimumElasticInstanceCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.MinimumElasticInstanceCount", Name: validation.InclusiveMaximum, Rule: int64(20), Chain: nil}, + {Target: "siteEnvelope.SiteProperties.SiteConfig.MinimumElasticInstanceCount", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + {Target: "siteEnvelope.SiteProperties.CloningInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.CloningInfo.SourceWebAppID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateSlot", err.Error()) + } + + req, err := client.CreateOrUpdateSlotPreparer(ctx, resourceGroupName, name, siteEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSlot", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdateSlotPreparer prepares the CreateOrUpdateSlot request. +func (client AppsClient) CreateOrUpdateSlotPreparer(ctx context.Context, resourceGroupName string, name string, siteEnvelope Site, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}", pathParameters), + autorest.WithJSON(siteEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSlotSender sends the CreateOrUpdateSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSlotSender(req *http.Request) (future AppsCreateOrUpdateSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateSlotResponder handles the response to the CreateOrUpdateSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateSlotResponder(resp *http.Response) (result Site, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateSourceControl description for Updates the source control configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// siteSourceControl - JSON representation of a SiteSourceControl object. See example. +func (client AppsClient) CreateOrUpdateSourceControl(ctx context.Context, resourceGroupName string, name string, siteSourceControl SiteSourceControl) (result AppsCreateOrUpdateSourceControlFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateSourceControl") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateSourceControl", err.Error()) + } + + req, err := client.CreateOrUpdateSourceControlPreparer(ctx, resourceGroupName, name, siteSourceControl) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControl", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSourceControlSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControl", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdateSourceControlPreparer prepares the CreateOrUpdateSourceControl request. +func (client AppsClient) CreateOrUpdateSourceControlPreparer(ctx context.Context, resourceGroupName string, name string, siteSourceControl SiteSourceControl) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web", pathParameters), + autorest.WithJSON(siteSourceControl), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSourceControlSender sends the CreateOrUpdateSourceControl request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSourceControlSender(req *http.Request) (future AppsCreateOrUpdateSourceControlFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateSourceControlResponder handles the response to the CreateOrUpdateSourceControl request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateSourceControlResponder(resp *http.Response) (result SiteSourceControl, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateSourceControlSlot description for Updates the source control configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// siteSourceControl - JSON representation of a SiteSourceControl object. See example. +// slot - name of the deployment slot. If a slot is not specified, the API will update the source control +// configuration for the production slot. +func (client AppsClient) CreateOrUpdateSourceControlSlot(ctx context.Context, resourceGroupName string, name string, siteSourceControl SiteSourceControl, slot string) (result AppsCreateOrUpdateSourceControlSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateSourceControlSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateSourceControlSlot", err.Error()) + } + + req, err := client.CreateOrUpdateSourceControlSlotPreparer(ctx, resourceGroupName, name, siteSourceControl, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControlSlot", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSourceControlSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControlSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdateSourceControlSlotPreparer prepares the CreateOrUpdateSourceControlSlot request. +func (client AppsClient) CreateOrUpdateSourceControlSlotPreparer(ctx context.Context, resourceGroupName string, name string, siteSourceControl SiteSourceControl, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), + autorest.WithJSON(siteSourceControl), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSourceControlSlotSender sends the CreateOrUpdateSourceControlSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSourceControlSlotSender(req *http.Request) (future AppsCreateOrUpdateSourceControlSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateSourceControlSlotResponder handles the response to the CreateOrUpdateSourceControlSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateSourceControlSlotResponder(resp *http.Response) (result SiteSourceControl, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck description for Integrates this Web App with a Virtual Network. +// This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet +// has already been delegated, and is not +// in use by another App Service Plan other than the one this App is in. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// connectionEnvelope - properties of the Virtual Network connection. See example. +func (client AppsClient) CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck(ctx context.Context, resourceGroupName string, name string, connectionEnvelope SwiftVirtualNetwork) (result SwiftVirtualNetwork, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck", err.Error()) + } + + req, err := client.CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckPreparer(ctx, resourceGroupName, name, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckPreparer prepares the CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck request. +func (client AppsClient) CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckPreparer(ctx context.Context, resourceGroupName string, name string, connectionEnvelope SwiftVirtualNetwork) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSender sends the CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckResponder handles the response to the CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckResponder(resp *http.Response) (result SwiftVirtualNetwork, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlot description for Integrates this Web App with a Virtual +// Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the +// target Subnet has already been delegated, and is not +// in use by another App Service Plan other than the one this App is in. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// connectionEnvelope - properties of the Virtual Network connection. See example. +// slot - name of the deployment slot. If a slot is not specified, the API will add or update connections for +// the production slot. +func (client AppsClient) CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlot(ctx context.Context, resourceGroupName string, name string, connectionEnvelope SwiftVirtualNetwork, slot string) (result SwiftVirtualNetwork, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlot", err.Error()) + } + + req, err := client.CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlotPreparer(ctx, resourceGroupName, name, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlot", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlotPreparer prepares the CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlot request. +func (client AppsClient) CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlotPreparer(ctx context.Context, resourceGroupName string, name string, connectionEnvelope SwiftVirtualNetwork, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlotSender sends the CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlotResponder handles the response to the CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlotResponder(resp *http.Response) (result SwiftVirtualNetwork, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateVnetConnection description for Adds a Virtual Network connection to an app or slot (PUT) or updates +// the connection properties (PATCH). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// vnetName - name of an existing Virtual Network. +// connectionEnvelope - properties of the Virtual Network connection. See example. +func (client AppsClient) CreateOrUpdateVnetConnection(ctx context.Context, resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfoResource) (result VnetInfoResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateVnetConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateVnetConnection", err.Error()) + } + + req, err := client.CreateOrUpdateVnetConnectionPreparer(ctx, resourceGroupName, name, vnetName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnection", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateVnetConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnection", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateVnetConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnection", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateVnetConnectionPreparer prepares the CreateOrUpdateVnetConnection request. +func (client AppsClient) CreateOrUpdateVnetConnectionPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfoResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateVnetConnectionSender sends the CreateOrUpdateVnetConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateVnetConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateVnetConnectionResponder handles the response to the CreateOrUpdateVnetConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateVnetConnectionResponder(resp *http.Response) (result VnetInfoResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateVnetConnectionGateway description for Adds a gateway to a connected Virtual Network (PUT) or updates +// it (PATCH). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// vnetName - name of the Virtual Network. +// gatewayName - name of the gateway. Currently, the only supported string is "primary". +// connectionEnvelope - the properties to update this gateway with. +func (client AppsClient) CreateOrUpdateVnetConnectionGateway(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateVnetConnectionGateway") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: connectionEnvelope, + Constraints: []validation.Constraint{{Target: "connectionEnvelope.VnetGatewayProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "connectionEnvelope.VnetGatewayProperties.VpnPackageURI", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateVnetConnectionGateway", err.Error()) + } + + req, err := client.CreateOrUpdateVnetConnectionGatewayPreparer(ctx, resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGateway", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateVnetConnectionGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGateway", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateVnetConnectionGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGateway", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateVnetConnectionGatewayPreparer prepares the CreateOrUpdateVnetConnectionGateway request. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewayPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateVnetConnectionGatewaySender sends the CreateOrUpdateVnetConnectionGateway request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateVnetConnectionGatewayResponder handles the response to the CreateOrUpdateVnetConnectionGateway request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewayResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateVnetConnectionGatewaySlot description for Adds a gateway to a connected Virtual Network (PUT) or +// updates it (PATCH). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// vnetName - name of the Virtual Network. +// gatewayName - name of the gateway. Currently, the only supported string is "primary". +// connectionEnvelope - the properties to update this gateway with. +// slot - name of the deployment slot. If a slot is not specified, the API will add or update a gateway for the +// production slot's Virtual Network. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlot(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (result VnetGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateVnetConnectionGatewaySlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: connectionEnvelope, + Constraints: []validation.Constraint{{Target: "connectionEnvelope.VnetGatewayProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "connectionEnvelope.VnetGatewayProperties.VpnPackageURI", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot", err.Error()) + } + + req, err := client.CreateOrUpdateVnetConnectionGatewaySlotPreparer(ctx, resourceGroupName, name, vnetName, gatewayName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateVnetConnectionGatewaySlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateVnetConnectionGatewaySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateVnetConnectionGatewaySlotPreparer prepares the CreateOrUpdateVnetConnectionGatewaySlot request. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlotPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateVnetConnectionGatewaySlotSender sends the CreateOrUpdateVnetConnectionGatewaySlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateVnetConnectionGatewaySlotResponder handles the response to the CreateOrUpdateVnetConnectionGatewaySlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlotResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateVnetConnectionSlot description for Adds a Virtual Network connection to an app or slot (PUT) or +// updates the connection properties (PATCH). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// vnetName - name of an existing Virtual Network. +// connectionEnvelope - properties of the Virtual Network connection. See example. +// slot - name of the deployment slot. If a slot is not specified, the API will add or update connections for +// the production slot. +func (client AppsClient) CreateOrUpdateVnetConnectionSlot(ctx context.Context, resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfoResource, slot string) (result VnetInfoResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdateVnetConnectionSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "CreateOrUpdateVnetConnectionSlot", err.Error()) + } + + req, err := client.CreateOrUpdateVnetConnectionSlotPreparer(ctx, resourceGroupName, name, vnetName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateVnetConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateVnetConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionSlot", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateVnetConnectionSlotPreparer prepares the CreateOrUpdateVnetConnectionSlot request. +func (client AppsClient) CreateOrUpdateVnetConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfoResource, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateVnetConnectionSlotSender sends the CreateOrUpdateVnetConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateVnetConnectionSlotResponder handles the response to the CreateOrUpdateVnetConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateVnetConnectionSlotResponder(resp *http.Response) (result VnetInfoResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete description for Deletes a web, mobile, or API app, or one of the deployment slots. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app to delete. +// deleteMetrics - if true, web app metrics are also deleted. +// deleteEmptyServerFarm - specify false if you want to keep empty App Service plan. By default, empty App +// Service plan is deleted. +func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppsClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if deleteMetrics != nil { + queryParameters["deleteMetrics"] = autorest.Encode("query", *deleteMetrics) + } + if deleteEmptyServerFarm != nil { + queryParameters["deleteEmptyServerFarm"] = autorest.Encode("query", *deleteEmptyServerFarm) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteBackup description for Deletes a backup of an app by its ID. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// backupID - ID of the backup. +func (client AppsClient) DeleteBackup(ctx context.Context, resourceGroupName string, name string, backupID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteBackup") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteBackup", err.Error()) + } + + req, err := client.DeleteBackupPreparer(ctx, resourceGroupName, name, backupID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackup", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteBackupSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackup", resp, "Failure sending request") + return + } + + result, err = client.DeleteBackupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackup", resp, "Failure responding to request") + return + } + + return +} + +// DeleteBackupPreparer prepares the DeleteBackup request. +func (client AppsClient) DeleteBackupPreparer(ctx context.Context, resourceGroupName string, name string, backupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteBackupSender sends the DeleteBackup request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteBackupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteBackupResponder handles the response to the DeleteBackup request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteBackupResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteBackupConfiguration description for Deletes the backup configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) DeleteBackupConfiguration(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteBackupConfiguration") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteBackupConfiguration", err.Error()) + } + + req, err := client.DeleteBackupConfigurationPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteBackupConfigurationSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfiguration", resp, "Failure sending request") + return + } + + result, err = client.DeleteBackupConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfiguration", resp, "Failure responding to request") + return + } + + return +} + +// DeleteBackupConfigurationPreparer prepares the DeleteBackupConfiguration request. +func (client AppsClient) DeleteBackupConfigurationPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteBackupConfigurationSender sends the DeleteBackupConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteBackupConfigurationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteBackupConfigurationResponder handles the response to the DeleteBackupConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteBackupConfigurationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteBackupConfigurationSlot description for Deletes the backup configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will delete the backup configuration +// for the production slot. +func (client AppsClient) DeleteBackupConfigurationSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteBackupConfigurationSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteBackupConfigurationSlot", err.Error()) + } + + req, err := client.DeleteBackupConfigurationSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteBackupConfigurationSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteBackupConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfigurationSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteBackupConfigurationSlotPreparer prepares the DeleteBackupConfigurationSlot request. +func (client AppsClient) DeleteBackupConfigurationSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteBackupConfigurationSlotSender sends the DeleteBackupConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteBackupConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteBackupConfigurationSlotResponder handles the response to the DeleteBackupConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteBackupConfigurationSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteBackupSlot description for Deletes a backup of an app by its ID. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// backupID - ID of the backup. +// slot - name of the deployment slot. If a slot is not specified, the API will delete a backup of the +// production slot. +func (client AppsClient) DeleteBackupSlot(ctx context.Context, resourceGroupName string, name string, backupID string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteBackupSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteBackupSlot", err.Error()) + } + + req, err := client.DeleteBackupSlotPreparer(ctx, resourceGroupName, name, backupID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteBackupSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteBackupSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteBackupSlotPreparer prepares the DeleteBackupSlot request. +func (client AppsClient) DeleteBackupSlotPreparer(ctx context.Context, resourceGroupName string, name string, backupID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteBackupSlotSender sends the DeleteBackupSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteBackupSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteBackupSlotResponder handles the response to the DeleteBackupSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteBackupSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteContinuousWebJob description for Delete a continuous web job by its ID for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +func (client AppsClient) DeleteContinuousWebJob(ctx context.Context, resourceGroupName string, name string, webJobName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteContinuousWebJob") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteContinuousWebJob", err.Error()) + } + + req, err := client.DeleteContinuousWebJobPreparer(ctx, resourceGroupName, name, webJobName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteContinuousWebJob", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteContinuousWebJobSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteContinuousWebJob", resp, "Failure sending request") + return + } + + result, err = client.DeleteContinuousWebJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteContinuousWebJob", resp, "Failure responding to request") + return + } + + return +} + +// DeleteContinuousWebJobPreparer prepares the DeleteContinuousWebJob request. +func (client AppsClient) DeleteContinuousWebJobPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteContinuousWebJobSender sends the DeleteContinuousWebJob request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteContinuousWebJobSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteContinuousWebJobResponder handles the response to the DeleteContinuousWebJob request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteContinuousWebJobResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteContinuousWebJobSlot description for Delete a continuous web job by its ID for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +// slot - name of the deployment slot. If a slot is not specified, the API deletes a deployment for the +// production slot. +func (client AppsClient) DeleteContinuousWebJobSlot(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteContinuousWebJobSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteContinuousWebJobSlot", err.Error()) + } + + req, err := client.DeleteContinuousWebJobSlotPreparer(ctx, resourceGroupName, name, webJobName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteContinuousWebJobSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteContinuousWebJobSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteContinuousWebJobSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteContinuousWebJobSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteContinuousWebJobSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteContinuousWebJobSlotPreparer prepares the DeleteContinuousWebJobSlot request. +func (client AppsClient) DeleteContinuousWebJobSlotPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteContinuousWebJobSlotSender sends the DeleteContinuousWebJobSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteContinuousWebJobSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteContinuousWebJobSlotResponder handles the response to the DeleteContinuousWebJobSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteContinuousWebJobSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteDeployment description for Delete a deployment by its ID for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// ID - deployment ID. +func (client AppsClient) DeleteDeployment(ctx context.Context, resourceGroupName string, name string, ID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteDeployment") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteDeployment", err.Error()) + } + + req, err := client.DeleteDeploymentPreparer(ctx, resourceGroupName, name, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeployment", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteDeploymentSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeployment", resp, "Failure sending request") + return + } + + result, err = client.DeleteDeploymentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeployment", resp, "Failure responding to request") + return + } + + return +} + +// DeleteDeploymentPreparer prepares the DeleteDeployment request. +func (client AppsClient) DeleteDeploymentPreparer(ctx context.Context, resourceGroupName string, name string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteDeploymentSender sends the DeleteDeployment request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteDeploymentSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteDeploymentResponder handles the response to the DeleteDeployment request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteDeploymentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteDeploymentSlot description for Delete a deployment by its ID for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// ID - deployment ID. +// slot - name of the deployment slot. If a slot is not specified, the API deletes a deployment for the +// production slot. +func (client AppsClient) DeleteDeploymentSlot(ctx context.Context, resourceGroupName string, name string, ID string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteDeploymentSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteDeploymentSlot", err.Error()) + } + + req, err := client.DeleteDeploymentSlotPreparer(ctx, resourceGroupName, name, ID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeploymentSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteDeploymentSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeploymentSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteDeploymentSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeploymentSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteDeploymentSlotPreparer prepares the DeleteDeploymentSlot request. +func (client AppsClient) DeleteDeploymentSlotPreparer(ctx context.Context, resourceGroupName string, name string, ID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteDeploymentSlotSender sends the DeleteDeploymentSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteDeploymentSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteDeploymentSlotResponder handles the response to the DeleteDeploymentSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteDeploymentSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteDomainOwnershipIdentifier description for Deletes a domain ownership identifier for a web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// domainOwnershipIdentifierName - name of domain ownership identifier. +func (client AppsClient) DeleteDomainOwnershipIdentifier(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteDomainOwnershipIdentifier") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteDomainOwnershipIdentifier", err.Error()) + } + + req, err := client.DeleteDomainOwnershipIdentifierPreparer(ctx, resourceGroupName, name, domainOwnershipIdentifierName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteDomainOwnershipIdentifierSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.DeleteDomainOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifier", resp, "Failure responding to request") + return + } + + return +} + +// DeleteDomainOwnershipIdentifierPreparer prepares the DeleteDomainOwnershipIdentifier request. +func (client AppsClient) DeleteDomainOwnershipIdentifierPreparer(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteDomainOwnershipIdentifierSender sends the DeleteDomainOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteDomainOwnershipIdentifierResponder handles the response to the DeleteDomainOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteDomainOwnershipIdentifierResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteDomainOwnershipIdentifierSlot description for Deletes a domain ownership identifier for a web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// domainOwnershipIdentifierName - name of domain ownership identifier. +// slot - name of the deployment slot. If a slot is not specified, the API will delete the binding for the +// production slot. +func (client AppsClient) DeleteDomainOwnershipIdentifierSlot(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteDomainOwnershipIdentifierSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteDomainOwnershipIdentifierSlot", err.Error()) + } + + req, err := client.DeleteDomainOwnershipIdentifierSlotPreparer(ctx, resourceGroupName, name, domainOwnershipIdentifierName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifierSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteDomainOwnershipIdentifierSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifierSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteDomainOwnershipIdentifierSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifierSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteDomainOwnershipIdentifierSlotPreparer prepares the DeleteDomainOwnershipIdentifierSlot request. +func (client AppsClient) DeleteDomainOwnershipIdentifierSlotPreparer(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteDomainOwnershipIdentifierSlotSender sends the DeleteDomainOwnershipIdentifierSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteDomainOwnershipIdentifierSlotResponder handles the response to the DeleteDomainOwnershipIdentifierSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteFunction description for Delete a function for web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// functionName - function name. +func (client AppsClient) DeleteFunction(ctx context.Context, resourceGroupName string, name string, functionName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteFunction") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteFunction", err.Error()) + } + + req, err := client.DeleteFunctionPreparer(ctx, resourceGroupName, name, functionName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteFunction", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteFunctionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteFunction", resp, "Failure sending request") + return + } + + result, err = client.DeleteFunctionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteFunction", resp, "Failure responding to request") + return + } + + return +} + +// DeleteFunctionPreparer prepares the DeleteFunction request. +func (client AppsClient) DeleteFunctionPreparer(ctx context.Context, resourceGroupName string, name string, functionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteFunctionSender sends the DeleteFunction request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteFunctionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteFunctionResponder handles the response to the DeleteFunction request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteFunctionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteFunctionSecret description for Delete a function secret. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// functionName - the name of the function. +// keyName - the name of the key. +func (client AppsClient) DeleteFunctionSecret(ctx context.Context, resourceGroupName string, name string, functionName string, keyName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteFunctionSecret") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteFunctionSecret", err.Error()) + } + + req, err := client.DeleteFunctionSecretPreparer(ctx, resourceGroupName, name, functionName, keyName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteFunctionSecret", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteFunctionSecretSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteFunctionSecret", resp, "Failure sending request") + return + } + + result, err = client.DeleteFunctionSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteFunctionSecret", resp, "Failure responding to request") + return + } + + return +} + +// DeleteFunctionSecretPreparer prepares the DeleteFunctionSecret request. +func (client AppsClient) DeleteFunctionSecretPreparer(ctx context.Context, resourceGroupName string, name string, functionName string, keyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "keyName": autorest.Encode("path", keyName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/keys/{keyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteFunctionSecretSender sends the DeleteFunctionSecret request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteFunctionSecretSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteFunctionSecretResponder handles the response to the DeleteFunctionSecret request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteFunctionSecretResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteFunctionSecretSlot description for Delete a function secret. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// functionName - the name of the function. +// keyName - the name of the key. +// slot - name of the deployment slot. +func (client AppsClient) DeleteFunctionSecretSlot(ctx context.Context, resourceGroupName string, name string, functionName string, keyName string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteFunctionSecretSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteFunctionSecretSlot", err.Error()) + } + + req, err := client.DeleteFunctionSecretSlotPreparer(ctx, resourceGroupName, name, functionName, keyName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteFunctionSecretSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteFunctionSecretSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteFunctionSecretSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteFunctionSecretSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteFunctionSecretSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteFunctionSecretSlotPreparer prepares the DeleteFunctionSecretSlot request. +func (client AppsClient) DeleteFunctionSecretSlotPreparer(ctx context.Context, resourceGroupName string, name string, functionName string, keyName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "keyName": autorest.Encode("path", keyName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/keys/{keyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteFunctionSecretSlotSender sends the DeleteFunctionSecretSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteFunctionSecretSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteFunctionSecretSlotResponder handles the response to the DeleteFunctionSecretSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteFunctionSecretSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHostNameBinding description for Deletes a hostname binding for an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// hostName - hostname in the hostname binding. +func (client AppsClient) DeleteHostNameBinding(ctx context.Context, resourceGroupName string, name string, hostName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteHostNameBinding") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteHostNameBinding", err.Error()) + } + + req, err := client.DeleteHostNameBindingPreparer(ctx, resourceGroupName, name, hostName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBinding", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteHostNameBindingSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBinding", resp, "Failure sending request") + return + } + + result, err = client.DeleteHostNameBindingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBinding", resp, "Failure responding to request") + return + } + + return +} + +// DeleteHostNameBindingPreparer prepares the DeleteHostNameBinding request. +func (client AppsClient) DeleteHostNameBindingPreparer(ctx context.Context, resourceGroupName string, name string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteHostNameBindingSender sends the DeleteHostNameBinding request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteHostNameBindingSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteHostNameBindingResponder handles the response to the DeleteHostNameBinding request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteHostNameBindingResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHostNameBindingSlot description for Deletes a hostname binding for an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will delete the binding for the +// production slot. +// hostName - hostname in the hostname binding. +func (client AppsClient) DeleteHostNameBindingSlot(ctx context.Context, resourceGroupName string, name string, slot string, hostName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteHostNameBindingSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteHostNameBindingSlot", err.Error()) + } + + req, err := client.DeleteHostNameBindingSlotPreparer(ctx, resourceGroupName, name, slot, hostName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBindingSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteHostNameBindingSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBindingSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteHostNameBindingSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBindingSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteHostNameBindingSlotPreparer prepares the DeleteHostNameBindingSlot request. +func (client AppsClient) DeleteHostNameBindingSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteHostNameBindingSlotSender sends the DeleteHostNameBindingSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteHostNameBindingSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteHostNameBindingSlotResponder handles the response to the DeleteHostNameBindingSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteHostNameBindingSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHostSecret description for Delete a host level secret. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// keyType - the type of host key. +// keyName - the name of the key. +func (client AppsClient) DeleteHostSecret(ctx context.Context, resourceGroupName string, name string, keyType string, keyName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteHostSecret") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteHostSecret", err.Error()) + } + + req, err := client.DeleteHostSecretPreparer(ctx, resourceGroupName, name, keyType, keyName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostSecret", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteHostSecretSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostSecret", resp, "Failure sending request") + return + } + + result, err = client.DeleteHostSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostSecret", resp, "Failure responding to request") + return + } + + return +} + +// DeleteHostSecretPreparer prepares the DeleteHostSecret request. +func (client AppsClient) DeleteHostSecretPreparer(ctx context.Context, resourceGroupName string, name string, keyType string, keyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "keyName": autorest.Encode("path", keyName), + "keyType": autorest.Encode("path", keyType), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/{keyType}/{keyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteHostSecretSender sends the DeleteHostSecret request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteHostSecretSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteHostSecretResponder handles the response to the DeleteHostSecret request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteHostSecretResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHostSecretSlot description for Delete a host level secret. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// keyType - the type of host key. +// keyName - the name of the key. +// slot - name of the deployment slot. +func (client AppsClient) DeleteHostSecretSlot(ctx context.Context, resourceGroupName string, name string, keyType string, keyName string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteHostSecretSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteHostSecretSlot", err.Error()) + } + + req, err := client.DeleteHostSecretSlotPreparer(ctx, resourceGroupName, name, keyType, keyName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostSecretSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteHostSecretSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostSecretSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteHostSecretSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostSecretSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteHostSecretSlotPreparer prepares the DeleteHostSecretSlot request. +func (client AppsClient) DeleteHostSecretSlotPreparer(ctx context.Context, resourceGroupName string, name string, keyType string, keyName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "keyName": autorest.Encode("path", keyName), + "keyType": autorest.Encode("path", keyType), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/{keyType}/{keyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteHostSecretSlotSender sends the DeleteHostSecretSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteHostSecretSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteHostSecretSlotResponder handles the response to the DeleteHostSecretSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteHostSecretSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHybridConnection description for Removes a Hybrid Connection from this site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// namespaceName - the namespace for this hybrid connection. +// relayName - the relay name for this hybrid connection. +func (client AppsClient) DeleteHybridConnection(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteHybridConnection") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteHybridConnection", err.Error()) + } + + req, err := client.DeleteHybridConnectionPreparer(ctx, resourceGroupName, name, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnection", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteHybridConnectionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnection", resp, "Failure sending request") + return + } + + result, err = client.DeleteHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnection", resp, "Failure responding to request") + return + } + + return +} + +// DeleteHybridConnectionPreparer prepares the DeleteHybridConnection request. +func (client AppsClient) DeleteHybridConnectionPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteHybridConnectionSender sends the DeleteHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteHybridConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteHybridConnectionResponder handles the response to the DeleteHybridConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteHybridConnectionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHybridConnectionSlot description for Removes a Hybrid Connection from this site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// namespaceName - the namespace for this hybrid connection. +// relayName - the relay name for this hybrid connection. +// slot - the name of the slot for the web app. +func (client AppsClient) DeleteHybridConnectionSlot(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteHybridConnectionSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteHybridConnectionSlot", err.Error()) + } + + req, err := client.DeleteHybridConnectionSlotPreparer(ctx, resourceGroupName, name, namespaceName, relayName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteHybridConnectionSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteHybridConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnectionSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteHybridConnectionSlotPreparer prepares the DeleteHybridConnectionSlot request. +func (client AppsClient) DeleteHybridConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteHybridConnectionSlotSender sends the DeleteHybridConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteHybridConnectionSlotResponder handles the response to the DeleteHybridConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteHybridConnectionSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteInstanceFunctionSlot description for Delete a function for web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// functionName - function name. +// slot - name of the deployment slot. +func (client AppsClient) DeleteInstanceFunctionSlot(ctx context.Context, resourceGroupName string, name string, functionName string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteInstanceFunctionSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteInstanceFunctionSlot", err.Error()) + } + + req, err := client.DeleteInstanceFunctionSlotPreparer(ctx, resourceGroupName, name, functionName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceFunctionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteInstanceFunctionSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceFunctionSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteInstanceFunctionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceFunctionSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteInstanceFunctionSlotPreparer prepares the DeleteInstanceFunctionSlot request. +func (client AppsClient) DeleteInstanceFunctionSlotPreparer(ctx context.Context, resourceGroupName string, name string, functionName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteInstanceFunctionSlotSender sends the DeleteInstanceFunctionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteInstanceFunctionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteInstanceFunctionSlotResponder handles the response to the DeleteInstanceFunctionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteInstanceFunctionSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteInstanceProcess description for Terminate a process by its ID for a web site, or a deployment slot, or +// specific scaled-out instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// instanceID - ID of a specific scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances". +func (client AppsClient) DeleteInstanceProcess(ctx context.Context, resourceGroupName string, name string, processID string, instanceID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteInstanceProcess") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteInstanceProcess", err.Error()) + } + + req, err := client.DeleteInstanceProcessPreparer(ctx, resourceGroupName, name, processID, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceProcess", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteInstanceProcessSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceProcess", resp, "Failure sending request") + return + } + + result, err = client.DeleteInstanceProcessResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceProcess", resp, "Failure responding to request") + return + } + + return +} + +// DeleteInstanceProcessPreparer prepares the DeleteInstanceProcess request. +func (client AppsClient) DeleteInstanceProcessPreparer(ctx context.Context, resourceGroupName string, name string, processID string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteInstanceProcessSender sends the DeleteInstanceProcess request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteInstanceProcessSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteInstanceProcessResponder handles the response to the DeleteInstanceProcess request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteInstanceProcessResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteInstanceProcessSlot description for Terminate a process by its ID for a web site, or a deployment slot, or +// specific scaled-out instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +// instanceID - ID of a specific scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances". +func (client AppsClient) DeleteInstanceProcessSlot(ctx context.Context, resourceGroupName string, name string, processID string, slot string, instanceID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteInstanceProcessSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteInstanceProcessSlot", err.Error()) + } + + req, err := client.DeleteInstanceProcessSlotPreparer(ctx, resourceGroupName, name, processID, slot, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceProcessSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteInstanceProcessSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceProcessSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteInstanceProcessSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceProcessSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteInstanceProcessSlotPreparer prepares the DeleteInstanceProcessSlot request. +func (client AppsClient) DeleteInstanceProcessSlotPreparer(ctx context.Context, resourceGroupName string, name string, processID string, slot string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteInstanceProcessSlotSender sends the DeleteInstanceProcessSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteInstanceProcessSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteInstanceProcessSlotResponder handles the response to the DeleteInstanceProcessSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteInstanceProcessSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeletePremierAddOn description for Delete a premier add-on from an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// premierAddOnName - add-on name. +func (client AppsClient) DeletePremierAddOn(ctx context.Context, resourceGroupName string, name string, premierAddOnName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeletePremierAddOn") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeletePremierAddOn", err.Error()) + } + + req, err := client.DeletePremierAddOnPreparer(ctx, resourceGroupName, name, premierAddOnName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOn", nil, "Failure preparing request") + return + } + + resp, err := client.DeletePremierAddOnSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOn", resp, "Failure sending request") + return + } + + result, err = client.DeletePremierAddOnResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOn", resp, "Failure responding to request") + return + } + + return +} + +// DeletePremierAddOnPreparer prepares the DeletePremierAddOn request. +func (client AppsClient) DeletePremierAddOnPreparer(ctx context.Context, resourceGroupName string, name string, premierAddOnName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePremierAddOnSender sends the DeletePremierAddOn request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeletePremierAddOnSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeletePremierAddOnResponder handles the response to the DeletePremierAddOn request. The method always +// closes the http.Response Body. +func (client AppsClient) DeletePremierAddOnResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeletePremierAddOnSlot description for Delete a premier add-on from an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// premierAddOnName - add-on name. +// slot - name of the deployment slot. If a slot is not specified, the API will delete the named add-on for the +// production slot. +func (client AppsClient) DeletePremierAddOnSlot(ctx context.Context, resourceGroupName string, name string, premierAddOnName string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeletePremierAddOnSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeletePremierAddOnSlot", err.Error()) + } + + req, err := client.DeletePremierAddOnSlotPreparer(ctx, resourceGroupName, name, premierAddOnName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOnSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeletePremierAddOnSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOnSlot", resp, "Failure sending request") + return + } + + result, err = client.DeletePremierAddOnSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOnSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeletePremierAddOnSlotPreparer prepares the DeletePremierAddOnSlot request. +func (client AppsClient) DeletePremierAddOnSlotPreparer(ctx context.Context, resourceGroupName string, name string, premierAddOnName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePremierAddOnSlotSender sends the DeletePremierAddOnSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeletePremierAddOnSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeletePremierAddOnSlotResponder handles the response to the DeletePremierAddOnSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeletePremierAddOnSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeletePrivateEndpointConnection description for Deletes a private endpoint connection +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the site. +func (client AppsClient) DeletePrivateEndpointConnection(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (result AppsDeletePrivateEndpointConnectionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeletePrivateEndpointConnection") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeletePrivateEndpointConnection", err.Error()) + } + + req, err := client.DeletePrivateEndpointConnectionPreparer(ctx, resourceGroupName, name, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePrivateEndpointConnection", nil, "Failure preparing request") + return + } + + result, err = client.DeletePrivateEndpointConnectionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePrivateEndpointConnection", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePrivateEndpointConnectionPreparer prepares the DeletePrivateEndpointConnection request. +func (client AppsClient) DeletePrivateEndpointConnectionPreparer(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePrivateEndpointConnectionSender sends the DeletePrivateEndpointConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeletePrivateEndpointConnectionSender(req *http.Request) (future AppsDeletePrivateEndpointConnectionFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeletePrivateEndpointConnectionResponder handles the response to the DeletePrivateEndpointConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) DeletePrivateEndpointConnectionResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeletePrivateEndpointConnectionSlot description for Deletes a private endpoint connection +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the site. +func (client AppsClient) DeletePrivateEndpointConnectionSlot(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, slot string) (result AppsDeletePrivateEndpointConnectionSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeletePrivateEndpointConnectionSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeletePrivateEndpointConnectionSlot", err.Error()) + } + + req, err := client.DeletePrivateEndpointConnectionSlotPreparer(ctx, resourceGroupName, name, privateEndpointConnectionName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePrivateEndpointConnectionSlot", nil, "Failure preparing request") + return + } + + result, err = client.DeletePrivateEndpointConnectionSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePrivateEndpointConnectionSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePrivateEndpointConnectionSlotPreparer prepares the DeletePrivateEndpointConnectionSlot request. +func (client AppsClient) DeletePrivateEndpointConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePrivateEndpointConnectionSlotSender sends the DeletePrivateEndpointConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeletePrivateEndpointConnectionSlotSender(req *http.Request) (future AppsDeletePrivateEndpointConnectionSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeletePrivateEndpointConnectionSlotResponder handles the response to the DeletePrivateEndpointConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeletePrivateEndpointConnectionSlotResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteProcess description for Terminate a process by its ID for a web site, or a deployment slot, or specific +// scaled-out instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +func (client AppsClient) DeleteProcess(ctx context.Context, resourceGroupName string, name string, processID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteProcess") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteProcess", err.Error()) + } + + req, err := client.DeleteProcessPreparer(ctx, resourceGroupName, name, processID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteProcess", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteProcessSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteProcess", resp, "Failure sending request") + return + } + + result, err = client.DeleteProcessResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteProcess", resp, "Failure responding to request") + return + } + + return +} + +// DeleteProcessPreparer prepares the DeleteProcess request. +func (client AppsClient) DeleteProcessPreparer(ctx context.Context, resourceGroupName string, name string, processID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteProcessSender sends the DeleteProcess request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteProcessSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteProcessResponder handles the response to the DeleteProcess request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteProcessResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteProcessSlot description for Terminate a process by its ID for a web site, or a deployment slot, or specific +// scaled-out instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +func (client AppsClient) DeleteProcessSlot(ctx context.Context, resourceGroupName string, name string, processID string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteProcessSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteProcessSlot", err.Error()) + } + + req, err := client.DeleteProcessSlotPreparer(ctx, resourceGroupName, name, processID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteProcessSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteProcessSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteProcessSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteProcessSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteProcessSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteProcessSlotPreparer prepares the DeleteProcessSlot request. +func (client AppsClient) DeleteProcessSlotPreparer(ctx context.Context, resourceGroupName string, name string, processID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteProcessSlotSender sends the DeleteProcessSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteProcessSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteProcessSlotResponder handles the response to the DeleteProcessSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteProcessSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeletePublicCertificate description for Deletes a hostname binding for an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// publicCertificateName - public certificate name. +func (client AppsClient) DeletePublicCertificate(ctx context.Context, resourceGroupName string, name string, publicCertificateName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeletePublicCertificate") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeletePublicCertificate", err.Error()) + } + + req, err := client.DeletePublicCertificatePreparer(ctx, resourceGroupName, name, publicCertificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePublicCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.DeletePublicCertificateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePublicCertificate", resp, "Failure sending request") + return + } + + result, err = client.DeletePublicCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePublicCertificate", resp, "Failure responding to request") + return + } + + return +} + +// DeletePublicCertificatePreparer prepares the DeletePublicCertificate request. +func (client AppsClient) DeletePublicCertificatePreparer(ctx context.Context, resourceGroupName string, name string, publicCertificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "publicCertificateName": autorest.Encode("path", publicCertificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePublicCertificateSender sends the DeletePublicCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeletePublicCertificateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeletePublicCertificateResponder handles the response to the DeletePublicCertificate request. The method always +// closes the http.Response Body. +func (client AppsClient) DeletePublicCertificateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeletePublicCertificateSlot description for Deletes a hostname binding for an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will delete the binding for the +// production slot. +// publicCertificateName - public certificate name. +func (client AppsClient) DeletePublicCertificateSlot(ctx context.Context, resourceGroupName string, name string, slot string, publicCertificateName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeletePublicCertificateSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeletePublicCertificateSlot", err.Error()) + } + + req, err := client.DeletePublicCertificateSlotPreparer(ctx, resourceGroupName, name, slot, publicCertificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePublicCertificateSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeletePublicCertificateSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePublicCertificateSlot", resp, "Failure sending request") + return + } + + result, err = client.DeletePublicCertificateSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePublicCertificateSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeletePublicCertificateSlotPreparer prepares the DeletePublicCertificateSlot request. +func (client AppsClient) DeletePublicCertificateSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, publicCertificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "publicCertificateName": autorest.Encode("path", publicCertificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePublicCertificateSlotSender sends the DeletePublicCertificateSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeletePublicCertificateSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeletePublicCertificateSlotResponder handles the response to the DeletePublicCertificateSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeletePublicCertificateSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteRelayServiceConnection description for Deletes a relay service connection by its name. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// entityName - name of the hybrid connection configuration. +func (client AppsClient) DeleteRelayServiceConnection(ctx context.Context, resourceGroupName string, name string, entityName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteRelayServiceConnection") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteRelayServiceConnection", err.Error()) + } + + req, err := client.DeleteRelayServiceConnectionPreparer(ctx, resourceGroupName, name, entityName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnection", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteRelayServiceConnectionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnection", resp, "Failure sending request") + return + } + + result, err = client.DeleteRelayServiceConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnection", resp, "Failure responding to request") + return + } + + return +} + +// DeleteRelayServiceConnectionPreparer prepares the DeleteRelayServiceConnection request. +func (client AppsClient) DeleteRelayServiceConnectionPreparer(ctx context.Context, resourceGroupName string, name string, entityName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteRelayServiceConnectionSender sends the DeleteRelayServiceConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteRelayServiceConnectionResponder handles the response to the DeleteRelayServiceConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteRelayServiceConnectionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteRelayServiceConnectionSlot description for Deletes a relay service connection by its name. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// entityName - name of the hybrid connection configuration. +// slot - name of the deployment slot. If a slot is not specified, the API will delete a hybrid connection for +// the production slot. +func (client AppsClient) DeleteRelayServiceConnectionSlot(ctx context.Context, resourceGroupName string, name string, entityName string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteRelayServiceConnectionSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteRelayServiceConnectionSlot", err.Error()) + } + + req, err := client.DeleteRelayServiceConnectionSlotPreparer(ctx, resourceGroupName, name, entityName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteRelayServiceConnectionSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteRelayServiceConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnectionSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteRelayServiceConnectionSlotPreparer prepares the DeleteRelayServiceConnectionSlot request. +func (client AppsClient) DeleteRelayServiceConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, entityName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteRelayServiceConnectionSlotSender sends the DeleteRelayServiceConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteRelayServiceConnectionSlotResponder handles the response to the DeleteRelayServiceConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteRelayServiceConnectionSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteSiteExtension description for Remove a site extension from a web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// siteExtensionID - site extension name. +func (client AppsClient) DeleteSiteExtension(ctx context.Context, resourceGroupName string, name string, siteExtensionID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteSiteExtension") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteSiteExtension", err.Error()) + } + + req, err := client.DeleteSiteExtensionPreparer(ctx, resourceGroupName, name, siteExtensionID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSiteExtension", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSiteExtensionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSiteExtension", resp, "Failure sending request") + return + } + + result, err = client.DeleteSiteExtensionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSiteExtension", resp, "Failure responding to request") + return + } + + return +} + +// DeleteSiteExtensionPreparer prepares the DeleteSiteExtension request. +func (client AppsClient) DeleteSiteExtensionPreparer(ctx context.Context, resourceGroupName string, name string, siteExtensionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteExtensionId": autorest.Encode("path", siteExtensionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSiteExtensionSender sends the DeleteSiteExtension request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSiteExtensionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteSiteExtensionResponder handles the response to the DeleteSiteExtension request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteSiteExtensionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteSiteExtensionSlot description for Remove a site extension from a web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// siteExtensionID - site extension name. +// slot - name of the deployment slot. If a slot is not specified, the API deletes a deployment for the +// production slot. +func (client AppsClient) DeleteSiteExtensionSlot(ctx context.Context, resourceGroupName string, name string, siteExtensionID string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteSiteExtensionSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteSiteExtensionSlot", err.Error()) + } + + req, err := client.DeleteSiteExtensionSlotPreparer(ctx, resourceGroupName, name, siteExtensionID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSiteExtensionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSiteExtensionSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSiteExtensionSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteSiteExtensionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSiteExtensionSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteSiteExtensionSlotPreparer prepares the DeleteSiteExtensionSlot request. +func (client AppsClient) DeleteSiteExtensionSlotPreparer(ctx context.Context, resourceGroupName string, name string, siteExtensionID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteExtensionId": autorest.Encode("path", siteExtensionID), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSiteExtensionSlotSender sends the DeleteSiteExtensionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSiteExtensionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteSiteExtensionSlotResponder handles the response to the DeleteSiteExtensionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteSiteExtensionSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteSlot description for Deletes a web, mobile, or API app, or one of the deployment slots. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app to delete. +// slot - name of the deployment slot to delete. By default, the API deletes the production slot. +// deleteMetrics - if true, web app metrics are also deleted. +// deleteEmptyServerFarm - specify false if you want to keep empty App Service plan. By default, empty App +// Service plan is deleted. +func (client AppsClient) DeleteSlot(ctx context.Context, resourceGroupName string, name string, slot string, deleteMetrics *bool, deleteEmptyServerFarm *bool) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteSlot", err.Error()) + } + + req, err := client.DeleteSlotPreparer(ctx, resourceGroupName, name, slot, deleteMetrics, deleteEmptyServerFarm) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteSlotPreparer prepares the DeleteSlot request. +func (client AppsClient) DeleteSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, deleteMetrics *bool, deleteEmptyServerFarm *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if deleteMetrics != nil { + queryParameters["deleteMetrics"] = autorest.Encode("query", *deleteMetrics) + } + if deleteEmptyServerFarm != nil { + queryParameters["deleteEmptyServerFarm"] = autorest.Encode("query", *deleteEmptyServerFarm) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSlotSender sends the DeleteSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteSlotResponder handles the response to the DeleteSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteSourceControl description for Deletes the source control configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) DeleteSourceControl(ctx context.Context, resourceGroupName string, name string, additionalFlags string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteSourceControl") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteSourceControl", err.Error()) + } + + req, err := client.DeleteSourceControlPreparer(ctx, resourceGroupName, name, additionalFlags) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControl", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSourceControlSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControl", resp, "Failure sending request") + return + } + + result, err = client.DeleteSourceControlResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControl", resp, "Failure responding to request") + return + } + + return +} + +// DeleteSourceControlPreparer prepares the DeleteSourceControl request. +func (client AppsClient) DeleteSourceControlPreparer(ctx context.Context, resourceGroupName string, name string, additionalFlags string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(additionalFlags) > 0 { + queryParameters["additionalFlags"] = autorest.Encode("query", additionalFlags) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSourceControlSender sends the DeleteSourceControl request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSourceControlSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteSourceControlResponder handles the response to the DeleteSourceControl request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteSourceControlResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteSourceControlSlot description for Deletes the source control configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will delete the source control +// configuration for the production slot. +func (client AppsClient) DeleteSourceControlSlot(ctx context.Context, resourceGroupName string, name string, slot string, additionalFlags string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteSourceControlSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteSourceControlSlot", err.Error()) + } + + req, err := client.DeleteSourceControlSlotPreparer(ctx, resourceGroupName, name, slot, additionalFlags) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControlSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSourceControlSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControlSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteSourceControlSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControlSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteSourceControlSlotPreparer prepares the DeleteSourceControlSlot request. +func (client AppsClient) DeleteSourceControlSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, additionalFlags string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(additionalFlags) > 0 { + queryParameters["additionalFlags"] = autorest.Encode("query", additionalFlags) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSourceControlSlotSender sends the DeleteSourceControlSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSourceControlSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteSourceControlSlotResponder handles the response to the DeleteSourceControlSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteSourceControlSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteSwiftVirtualNetwork description for Deletes a Swift Virtual Network connection from an app (or deployment +// slot). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) DeleteSwiftVirtualNetwork(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteSwiftVirtualNetwork") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteSwiftVirtualNetwork", err.Error()) + } + + req, err := client.DeleteSwiftVirtualNetworkPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSwiftVirtualNetwork", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSwiftVirtualNetworkSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSwiftVirtualNetwork", resp, "Failure sending request") + return + } + + result, err = client.DeleteSwiftVirtualNetworkResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSwiftVirtualNetwork", resp, "Failure responding to request") + return + } + + return +} + +// DeleteSwiftVirtualNetworkPreparer prepares the DeleteSwiftVirtualNetwork request. +func (client AppsClient) DeleteSwiftVirtualNetworkPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSwiftVirtualNetworkSender sends the DeleteSwiftVirtualNetwork request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSwiftVirtualNetworkSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteSwiftVirtualNetworkResponder handles the response to the DeleteSwiftVirtualNetwork request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteSwiftVirtualNetworkResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteSwiftVirtualNetworkSlot description for Deletes a Swift Virtual Network connection from an app (or deployment +// slot). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will delete the connection for the +// production slot. +func (client AppsClient) DeleteSwiftVirtualNetworkSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteSwiftVirtualNetworkSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteSwiftVirtualNetworkSlot", err.Error()) + } + + req, err := client.DeleteSwiftVirtualNetworkSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSwiftVirtualNetworkSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSwiftVirtualNetworkSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSwiftVirtualNetworkSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteSwiftVirtualNetworkSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSwiftVirtualNetworkSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteSwiftVirtualNetworkSlotPreparer prepares the DeleteSwiftVirtualNetworkSlot request. +func (client AppsClient) DeleteSwiftVirtualNetworkSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSwiftVirtualNetworkSlotSender sends the DeleteSwiftVirtualNetworkSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSwiftVirtualNetworkSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteSwiftVirtualNetworkSlotResponder handles the response to the DeleteSwiftVirtualNetworkSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteSwiftVirtualNetworkSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteTriggeredWebJob description for Delete a triggered web job by its ID for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +func (client AppsClient) DeleteTriggeredWebJob(ctx context.Context, resourceGroupName string, name string, webJobName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteTriggeredWebJob") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteTriggeredWebJob", err.Error()) + } + + req, err := client.DeleteTriggeredWebJobPreparer(ctx, resourceGroupName, name, webJobName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteTriggeredWebJob", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteTriggeredWebJobSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteTriggeredWebJob", resp, "Failure sending request") + return + } + + result, err = client.DeleteTriggeredWebJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteTriggeredWebJob", resp, "Failure responding to request") + return + } + + return +} + +// DeleteTriggeredWebJobPreparer prepares the DeleteTriggeredWebJob request. +func (client AppsClient) DeleteTriggeredWebJobPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteTriggeredWebJobSender sends the DeleteTriggeredWebJob request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteTriggeredWebJobSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteTriggeredWebJobResponder handles the response to the DeleteTriggeredWebJob request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteTriggeredWebJobResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteTriggeredWebJobSlot description for Delete a triggered web job by its ID for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +// slot - name of the deployment slot. If a slot is not specified, the API deletes web job for the production +// slot. +func (client AppsClient) DeleteTriggeredWebJobSlot(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteTriggeredWebJobSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteTriggeredWebJobSlot", err.Error()) + } + + req, err := client.DeleteTriggeredWebJobSlotPreparer(ctx, resourceGroupName, name, webJobName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteTriggeredWebJobSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteTriggeredWebJobSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteTriggeredWebJobSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteTriggeredWebJobSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteTriggeredWebJobSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteTriggeredWebJobSlotPreparer prepares the DeleteTriggeredWebJobSlot request. +func (client AppsClient) DeleteTriggeredWebJobSlotPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteTriggeredWebJobSlotSender sends the DeleteTriggeredWebJobSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteTriggeredWebJobSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteTriggeredWebJobSlotResponder handles the response to the DeleteTriggeredWebJobSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteTriggeredWebJobSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteVnetConnection description for Deletes a connection from an app (or deployment slot to a named virtual +// network. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// vnetName - name of the virtual network. +func (client AppsClient) DeleteVnetConnection(ctx context.Context, resourceGroupName string, name string, vnetName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteVnetConnection") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteVnetConnection", err.Error()) + } + + req, err := client.DeleteVnetConnectionPreparer(ctx, resourceGroupName, name, vnetName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnection", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteVnetConnectionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnection", resp, "Failure sending request") + return + } + + result, err = client.DeleteVnetConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnection", resp, "Failure responding to request") + return + } + + return +} + +// DeleteVnetConnectionPreparer prepares the DeleteVnetConnection request. +func (client AppsClient) DeleteVnetConnectionPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteVnetConnectionSender sends the DeleteVnetConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteVnetConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteVnetConnectionResponder handles the response to the DeleteVnetConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteVnetConnectionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteVnetConnectionSlot description for Deletes a connection from an app (or deployment slot to a named virtual +// network. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// vnetName - name of the virtual network. +// slot - name of the deployment slot. If a slot is not specified, the API will delete the connection for the +// production slot. +func (client AppsClient) DeleteVnetConnectionSlot(ctx context.Context, resourceGroupName string, name string, vnetName string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DeleteVnetConnectionSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DeleteVnetConnectionSlot", err.Error()) + } + + req, err := client.DeleteVnetConnectionSlotPreparer(ctx, resourceGroupName, name, vnetName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteVnetConnectionSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteVnetConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnectionSlot", resp, "Failure responding to request") + return + } + + return +} + +// DeleteVnetConnectionSlotPreparer prepares the DeleteVnetConnectionSlot request. +func (client AppsClient) DeleteVnetConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteVnetConnectionSlotSender sends the DeleteVnetConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteVnetConnectionSlotResponder handles the response to the DeleteVnetConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteVnetConnectionSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DiscoverBackup description for Discovers an existing app backup that can be restored from a blob in Azure storage. +// Use this to get information about the databases stored in a backup. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// request - a RestoreRequest object that includes Azure storage URL and blog name for discovery of backup. +func (client AppsClient) DiscoverBackup(ctx context.Context, resourceGroupName string, name string, request RestoreRequest) (result RestoreRequest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DiscoverBackup") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.RestoreRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.RestoreRequestProperties.StorageAccountURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.RestoreRequestProperties.Overwrite", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DiscoverBackup", err.Error()) + } + + req, err := client.DiscoverBackupPreparer(ctx, resourceGroupName, name, request) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverBackup", nil, "Failure preparing request") + return + } + + resp, err := client.DiscoverBackupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverBackup", resp, "Failure sending request") + return + } + + result, err = client.DiscoverBackupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverBackup", resp, "Failure responding to request") + return + } + + return +} + +// DiscoverBackupPreparer prepares the DiscoverBackup request. +func (client AppsClient) DiscoverBackupPreparer(ctx context.Context, resourceGroupName string, name string, request RestoreRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/discoverbackup", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DiscoverBackupSender sends the DiscoverBackup request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DiscoverBackupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DiscoverBackupResponder handles the response to the DiscoverBackup request. The method always +// closes the http.Response Body. +func (client AppsClient) DiscoverBackupResponder(resp *http.Response) (result RestoreRequest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DiscoverBackupSlot description for Discovers an existing app backup that can be restored from a blob in Azure +// storage. Use this to get information about the databases stored in a backup. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// request - a RestoreRequest object that includes Azure storage URL and blog name for discovery of backup. +// slot - name of the deployment slot. If a slot is not specified, the API will perform discovery for the +// production slot. +func (client AppsClient) DiscoverBackupSlot(ctx context.Context, resourceGroupName string, name string, request RestoreRequest, slot string) (result RestoreRequest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.DiscoverBackupSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.RestoreRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.RestoreRequestProperties.StorageAccountURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.RestoreRequestProperties.Overwrite", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "DiscoverBackupSlot", err.Error()) + } + + req, err := client.DiscoverBackupSlotPreparer(ctx, resourceGroupName, name, request, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverBackupSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DiscoverBackupSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverBackupSlot", resp, "Failure sending request") + return + } + + result, err = client.DiscoverBackupSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverBackupSlot", resp, "Failure responding to request") + return + } + + return +} + +// DiscoverBackupSlotPreparer prepares the DiscoverBackupSlot request. +func (client AppsClient) DiscoverBackupSlotPreparer(ctx context.Context, resourceGroupName string, name string, request RestoreRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/discoverbackup", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DiscoverBackupSlotSender sends the DiscoverBackupSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DiscoverBackupSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DiscoverBackupSlotResponder handles the response to the DiscoverBackupSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DiscoverBackupSlotResponder(resp *http.Response) (result RestoreRequest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GenerateNewSitePublishingPassword description for Generates a new publishing password for an app (or deployment +// slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GenerateNewSitePublishingPassword(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GenerateNewSitePublishingPassword") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GenerateNewSitePublishingPassword", err.Error()) + } + + req, err := client.GenerateNewSitePublishingPasswordPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPassword", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateNewSitePublishingPasswordSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPassword", resp, "Failure sending request") + return + } + + result, err = client.GenerateNewSitePublishingPasswordResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPassword", resp, "Failure responding to request") + return + } + + return +} + +// GenerateNewSitePublishingPasswordPreparer prepares the GenerateNewSitePublishingPassword request. +func (client AppsClient) GenerateNewSitePublishingPasswordPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/newpassword", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateNewSitePublishingPasswordSender sends the GenerateNewSitePublishingPassword request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GenerateNewSitePublishingPasswordSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GenerateNewSitePublishingPasswordResponder handles the response to the GenerateNewSitePublishingPassword request. The method always +// closes the http.Response Body. +func (client AppsClient) GenerateNewSitePublishingPasswordResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateNewSitePublishingPasswordSlot description for Generates a new publishing password for an app (or deployment +// slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API generate a new publishing password +// for the production slot. +func (client AppsClient) GenerateNewSitePublishingPasswordSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GenerateNewSitePublishingPasswordSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GenerateNewSitePublishingPasswordSlot", err.Error()) + } + + req, err := client.GenerateNewSitePublishingPasswordSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPasswordSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateNewSitePublishingPasswordSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPasswordSlot", resp, "Failure sending request") + return + } + + result, err = client.GenerateNewSitePublishingPasswordSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPasswordSlot", resp, "Failure responding to request") + return + } + + return +} + +// GenerateNewSitePublishingPasswordSlotPreparer prepares the GenerateNewSitePublishingPasswordSlot request. +func (client AppsClient) GenerateNewSitePublishingPasswordSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/newpassword", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateNewSitePublishingPasswordSlotSender sends the GenerateNewSitePublishingPasswordSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GenerateNewSitePublishingPasswordSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GenerateNewSitePublishingPasswordSlotResponder handles the response to the GenerateNewSitePublishingPasswordSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GenerateNewSitePublishingPasswordSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get description for Gets the details of a web, mobile, or API app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) Get(ctx context.Context, resourceGroupName string, name string) (result Site, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppsClient) GetPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppsClient) GetResponder(resp *http.Response) (result Site, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAppSettingKeyVaultReference description for Gets the config reference and status of an app +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// appSettingKey - app Setting key name. +func (client AppsClient) GetAppSettingKeyVaultReference(ctx context.Context, resourceGroupName string, name string, appSettingKey string) (result APIKVReference, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetAppSettingKeyVaultReference") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetAppSettingKeyVaultReference", err.Error()) + } + + req, err := client.GetAppSettingKeyVaultReferencePreparer(ctx, resourceGroupName, name, appSettingKey) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAppSettingKeyVaultReference", nil, "Failure preparing request") + return + } + + resp, err := client.GetAppSettingKeyVaultReferenceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAppSettingKeyVaultReference", resp, "Failure sending request") + return + } + + result, err = client.GetAppSettingKeyVaultReferenceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAppSettingKeyVaultReference", resp, "Failure responding to request") + return + } + + return +} + +// GetAppSettingKeyVaultReferencePreparer prepares the GetAppSettingKeyVaultReference request. +func (client AppsClient) GetAppSettingKeyVaultReferencePreparer(ctx context.Context, resourceGroupName string, name string, appSettingKey string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appSettingKey": autorest.Encode("path", appSettingKey), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/appsettings/{appSettingKey}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAppSettingKeyVaultReferenceSender sends the GetAppSettingKeyVaultReference request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetAppSettingKeyVaultReferenceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAppSettingKeyVaultReferenceResponder handles the response to the GetAppSettingKeyVaultReference request. The method always +// closes the http.Response Body. +func (client AppsClient) GetAppSettingKeyVaultReferenceResponder(resp *http.Response) (result APIKVReference, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAppSettingKeyVaultReferenceSlot description for Gets the config reference and status of an app +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// appSettingKey - app Setting key name. +func (client AppsClient) GetAppSettingKeyVaultReferenceSlot(ctx context.Context, resourceGroupName string, name string, appSettingKey string, slot string) (result APIKVReference, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetAppSettingKeyVaultReferenceSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetAppSettingKeyVaultReferenceSlot", err.Error()) + } + + req, err := client.GetAppSettingKeyVaultReferenceSlotPreparer(ctx, resourceGroupName, name, appSettingKey, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAppSettingKeyVaultReferenceSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetAppSettingKeyVaultReferenceSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAppSettingKeyVaultReferenceSlot", resp, "Failure sending request") + return + } + + result, err = client.GetAppSettingKeyVaultReferenceSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAppSettingKeyVaultReferenceSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetAppSettingKeyVaultReferenceSlotPreparer prepares the GetAppSettingKeyVaultReferenceSlot request. +func (client AppsClient) GetAppSettingKeyVaultReferenceSlotPreparer(ctx context.Context, resourceGroupName string, name string, appSettingKey string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appSettingKey": autorest.Encode("path", appSettingKey), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/appsettings/{appSettingKey}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAppSettingKeyVaultReferenceSlotSender sends the GetAppSettingKeyVaultReferenceSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetAppSettingKeyVaultReferenceSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAppSettingKeyVaultReferenceSlotResponder handles the response to the GetAppSettingKeyVaultReferenceSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetAppSettingKeyVaultReferenceSlotResponder(resp *http.Response) (result APIKVReference, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAppSettingsKeyVaultReferences description for Gets the config reference app settings and status of an app +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetAppSettingsKeyVaultReferences(ctx context.Context, resourceGroupName string, name string) (result APIKVReferenceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetAppSettingsKeyVaultReferences") + defer func() { + sc := -1 + if result.arc.Response.Response != nil { + sc = result.arc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetAppSettingsKeyVaultReferences", err.Error()) + } + + result.fn = client.getAppSettingsKeyVaultReferencesNextResults + req, err := client.GetAppSettingsKeyVaultReferencesPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAppSettingsKeyVaultReferences", nil, "Failure preparing request") + return + } + + resp, err := client.GetAppSettingsKeyVaultReferencesSender(req) + if err != nil { + result.arc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAppSettingsKeyVaultReferences", resp, "Failure sending request") + return + } + + result.arc, err = client.GetAppSettingsKeyVaultReferencesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAppSettingsKeyVaultReferences", resp, "Failure responding to request") + return + } + if result.arc.hasNextLink() && result.arc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetAppSettingsKeyVaultReferencesPreparer prepares the GetAppSettingsKeyVaultReferences request. +func (client AppsClient) GetAppSettingsKeyVaultReferencesPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/appsettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAppSettingsKeyVaultReferencesSender sends the GetAppSettingsKeyVaultReferences request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetAppSettingsKeyVaultReferencesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAppSettingsKeyVaultReferencesResponder handles the response to the GetAppSettingsKeyVaultReferences request. The method always +// closes the http.Response Body. +func (client AppsClient) GetAppSettingsKeyVaultReferencesResponder(resp *http.Response) (result APIKVReferenceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getAppSettingsKeyVaultReferencesNextResults retrieves the next set of results, if any. +func (client AppsClient) getAppSettingsKeyVaultReferencesNextResults(ctx context.Context, lastResults APIKVReferenceCollection) (result APIKVReferenceCollection, err error) { + req, err := lastResults.aPIKVReferenceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "getAppSettingsKeyVaultReferencesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetAppSettingsKeyVaultReferencesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "getAppSettingsKeyVaultReferencesNextResults", resp, "Failure sending next results request") + } + result, err = client.GetAppSettingsKeyVaultReferencesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "getAppSettingsKeyVaultReferencesNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetAppSettingsKeyVaultReferencesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) GetAppSettingsKeyVaultReferencesComplete(ctx context.Context, resourceGroupName string, name string) (result APIKVReferenceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetAppSettingsKeyVaultReferences") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetAppSettingsKeyVaultReferences(ctx, resourceGroupName, name) + return +} + +// GetAppSettingsKeyVaultReferencesSlot description for Gets the config reference app settings and status of an app +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetAppSettingsKeyVaultReferencesSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result APIKVReferenceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetAppSettingsKeyVaultReferencesSlot") + defer func() { + sc := -1 + if result.arc.Response.Response != nil { + sc = result.arc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetAppSettingsKeyVaultReferencesSlot", err.Error()) + } + + result.fn = client.getAppSettingsKeyVaultReferencesSlotNextResults + req, err := client.GetAppSettingsKeyVaultReferencesSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAppSettingsKeyVaultReferencesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetAppSettingsKeyVaultReferencesSlotSender(req) + if err != nil { + result.arc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAppSettingsKeyVaultReferencesSlot", resp, "Failure sending request") + return + } + + result.arc, err = client.GetAppSettingsKeyVaultReferencesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAppSettingsKeyVaultReferencesSlot", resp, "Failure responding to request") + return + } + if result.arc.hasNextLink() && result.arc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetAppSettingsKeyVaultReferencesSlotPreparer prepares the GetAppSettingsKeyVaultReferencesSlot request. +func (client AppsClient) GetAppSettingsKeyVaultReferencesSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/appsettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAppSettingsKeyVaultReferencesSlotSender sends the GetAppSettingsKeyVaultReferencesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetAppSettingsKeyVaultReferencesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAppSettingsKeyVaultReferencesSlotResponder handles the response to the GetAppSettingsKeyVaultReferencesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetAppSettingsKeyVaultReferencesSlotResponder(resp *http.Response) (result APIKVReferenceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getAppSettingsKeyVaultReferencesSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) getAppSettingsKeyVaultReferencesSlotNextResults(ctx context.Context, lastResults APIKVReferenceCollection) (result APIKVReferenceCollection, err error) { + req, err := lastResults.aPIKVReferenceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "getAppSettingsKeyVaultReferencesSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetAppSettingsKeyVaultReferencesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "getAppSettingsKeyVaultReferencesSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.GetAppSettingsKeyVaultReferencesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "getAppSettingsKeyVaultReferencesSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetAppSettingsKeyVaultReferencesSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) GetAppSettingsKeyVaultReferencesSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result APIKVReferenceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetAppSettingsKeyVaultReferencesSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetAppSettingsKeyVaultReferencesSlot(ctx, resourceGroupName, name, slot) + return +} + +// GetAuthSettings description for Gets the Authentication/Authorization settings of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetAuthSettings(ctx context.Context, resourceGroupName string, name string) (result SiteAuthSettings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetAuthSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetAuthSettings", err.Error()) + } + + req, err := client.GetAuthSettingsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettings", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettings", resp, "Failure sending request") + return + } + + result, err = client.GetAuthSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettings", resp, "Failure responding to request") + return + } + + return +} + +// GetAuthSettingsPreparer prepares the GetAuthSettings request. +func (client AppsClient) GetAuthSettingsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAuthSettingsSender sends the GetAuthSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetAuthSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAuthSettingsResponder handles the response to the GetAuthSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) GetAuthSettingsResponder(resp *http.Response) (result SiteAuthSettings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthSettingsSlot description for Gets the Authentication/Authorization settings of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get the settings for the +// production slot. +func (client AppsClient) GetAuthSettingsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result SiteAuthSettings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetAuthSettingsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetAuthSettingsSlot", err.Error()) + } + + req, err := client.GetAuthSettingsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsSlot", resp, "Failure sending request") + return + } + + result, err = client.GetAuthSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetAuthSettingsSlotPreparer prepares the GetAuthSettingsSlot request. +func (client AppsClient) GetAuthSettingsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAuthSettingsSlotSender sends the GetAuthSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetAuthSettingsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAuthSettingsSlotResponder handles the response to the GetAuthSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetAuthSettingsSlotResponder(resp *http.Response) (result SiteAuthSettings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthSettingsV2 description for Gets site's Authentication / Authorization settings for apps via the V2 format +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetAuthSettingsV2(ctx context.Context, resourceGroupName string, name string) (result SiteAuthSettingsV2, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetAuthSettingsV2") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetAuthSettingsV2", err.Error()) + } + + req, err := client.GetAuthSettingsV2Preparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsV2", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthSettingsV2Sender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsV2", resp, "Failure sending request") + return + } + + result, err = client.GetAuthSettingsV2Responder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsV2", resp, "Failure responding to request") + return + } + + return +} + +// GetAuthSettingsV2Preparer prepares the GetAuthSettingsV2 request. +func (client AppsClient) GetAuthSettingsV2Preparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettingsV2/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAuthSettingsV2Sender sends the GetAuthSettingsV2 request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetAuthSettingsV2Sender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAuthSettingsV2Responder handles the response to the GetAuthSettingsV2 request. The method always +// closes the http.Response Body. +func (client AppsClient) GetAuthSettingsV2Responder(resp *http.Response) (result SiteAuthSettingsV2, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthSettingsV2Slot description for Gets site's Authentication / Authorization settings for apps via the V2 format +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get the settings for the +// production slot. +func (client AppsClient) GetAuthSettingsV2Slot(ctx context.Context, resourceGroupName string, name string, slot string) (result SiteAuthSettingsV2, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetAuthSettingsV2Slot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetAuthSettingsV2Slot", err.Error()) + } + + req, err := client.GetAuthSettingsV2SlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsV2Slot", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthSettingsV2SlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsV2Slot", resp, "Failure sending request") + return + } + + result, err = client.GetAuthSettingsV2SlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsV2Slot", resp, "Failure responding to request") + return + } + + return +} + +// GetAuthSettingsV2SlotPreparer prepares the GetAuthSettingsV2Slot request. +func (client AppsClient) GetAuthSettingsV2SlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettingsV2/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAuthSettingsV2SlotSender sends the GetAuthSettingsV2Slot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetAuthSettingsV2SlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAuthSettingsV2SlotResponder handles the response to the GetAuthSettingsV2Slot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetAuthSettingsV2SlotResponder(resp *http.Response) (result SiteAuthSettingsV2, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthSettingsV2WithoutSecrets description for Gets site's Authentication / Authorization settings for apps via the +// V2 format +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetAuthSettingsV2WithoutSecrets(ctx context.Context, resourceGroupName string, name string) (result SiteAuthSettingsV2, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetAuthSettingsV2WithoutSecrets") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetAuthSettingsV2WithoutSecrets", err.Error()) + } + + req, err := client.GetAuthSettingsV2WithoutSecretsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsV2WithoutSecrets", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthSettingsV2WithoutSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsV2WithoutSecrets", resp, "Failure sending request") + return + } + + result, err = client.GetAuthSettingsV2WithoutSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsV2WithoutSecrets", resp, "Failure responding to request") + return + } + + return +} + +// GetAuthSettingsV2WithoutSecretsPreparer prepares the GetAuthSettingsV2WithoutSecrets request. +func (client AppsClient) GetAuthSettingsV2WithoutSecretsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettingsV2", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAuthSettingsV2WithoutSecretsSender sends the GetAuthSettingsV2WithoutSecrets request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetAuthSettingsV2WithoutSecretsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAuthSettingsV2WithoutSecretsResponder handles the response to the GetAuthSettingsV2WithoutSecrets request. The method always +// closes the http.Response Body. +func (client AppsClient) GetAuthSettingsV2WithoutSecretsResponder(resp *http.Response) (result SiteAuthSettingsV2, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBackupConfiguration description for Gets the backup configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetBackupConfiguration(ctx context.Context, resourceGroupName string, name string) (result BackupRequest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetBackupConfiguration") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetBackupConfiguration", err.Error()) + } + + req, err := client.GetBackupConfigurationPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.GetBackupConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfiguration", resp, "Failure sending request") + return + } + + result, err = client.GetBackupConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfiguration", resp, "Failure responding to request") + return + } + + return +} + +// GetBackupConfigurationPreparer prepares the GetBackupConfiguration request. +func (client AppsClient) GetBackupConfigurationPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBackupConfigurationSender sends the GetBackupConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetBackupConfigurationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBackupConfigurationResponder handles the response to the GetBackupConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) GetBackupConfigurationResponder(resp *http.Response) (result BackupRequest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBackupConfigurationSlot description for Gets the backup configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get the backup configuration +// for the production slot. +func (client AppsClient) GetBackupConfigurationSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result BackupRequest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetBackupConfigurationSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetBackupConfigurationSlot", err.Error()) + } + + req, err := client.GetBackupConfigurationSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetBackupConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.GetBackupConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfigurationSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetBackupConfigurationSlotPreparer prepares the GetBackupConfigurationSlot request. +func (client AppsClient) GetBackupConfigurationSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBackupConfigurationSlotSender sends the GetBackupConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetBackupConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBackupConfigurationSlotResponder handles the response to the GetBackupConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetBackupConfigurationSlotResponder(resp *http.Response) (result BackupRequest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBackupStatus description for Gets a backup of an app by its ID. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// backupID - ID of the backup. +func (client AppsClient) GetBackupStatus(ctx context.Context, resourceGroupName string, name string, backupID string) (result BackupItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetBackupStatus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetBackupStatus", err.Error()) + } + + req, err := client.GetBackupStatusPreparer(ctx, resourceGroupName, name, backupID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetBackupStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatus", resp, "Failure sending request") + return + } + + result, err = client.GetBackupStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatus", resp, "Failure responding to request") + return + } + + return +} + +// GetBackupStatusPreparer prepares the GetBackupStatus request. +func (client AppsClient) GetBackupStatusPreparer(ctx context.Context, resourceGroupName string, name string, backupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBackupStatusSender sends the GetBackupStatus request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetBackupStatusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBackupStatusResponder handles the response to the GetBackupStatus request. The method always +// closes the http.Response Body. +func (client AppsClient) GetBackupStatusResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBackupStatusSlot description for Gets a backup of an app by its ID. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// backupID - ID of the backup. +// slot - name of the deployment slot. If a slot is not specified, the API will get a backup of the production +// slot. +func (client AppsClient) GetBackupStatusSlot(ctx context.Context, resourceGroupName string, name string, backupID string, slot string) (result BackupItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetBackupStatusSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetBackupStatusSlot", err.Error()) + } + + req, err := client.GetBackupStatusSlotPreparer(ctx, resourceGroupName, name, backupID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatusSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetBackupStatusSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatusSlot", resp, "Failure sending request") + return + } + + result, err = client.GetBackupStatusSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatusSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetBackupStatusSlotPreparer prepares the GetBackupStatusSlot request. +func (client AppsClient) GetBackupStatusSlotPreparer(ctx context.Context, resourceGroupName string, name string, backupID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBackupStatusSlotSender sends the GetBackupStatusSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetBackupStatusSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBackupStatusSlotResponder handles the response to the GetBackupStatusSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetBackupStatusSlotResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetConfiguration description for Gets the configuration of an app, such as platform version and bitness, default +// documents, virtual applications, Always On, etc. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetConfiguration(ctx context.Context, resourceGroupName string, name string) (result SiteConfigResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetConfiguration") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetConfiguration", err.Error()) + } + + req, err := client.GetConfigurationPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.GetConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfiguration", resp, "Failure sending request") + return + } + + result, err = client.GetConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfiguration", resp, "Failure responding to request") + return + } + + return +} + +// GetConfigurationPreparer prepares the GetConfiguration request. +func (client AppsClient) GetConfigurationPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetConfigurationSender sends the GetConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetConfigurationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetConfigurationResponder handles the response to the GetConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) GetConfigurationResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetConfigurationSlot description for Gets the configuration of an app, such as platform version and bitness, default +// documents, virtual applications, Always On, etc. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will return configuration for the +// production slot. +func (client AppsClient) GetConfigurationSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result SiteConfigResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetConfigurationSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetConfigurationSlot", err.Error()) + } + + req, err := client.GetConfigurationSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.GetConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetConfigurationSlotPreparer prepares the GetConfigurationSlot request. +func (client AppsClient) GetConfigurationSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetConfigurationSlotSender sends the GetConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetConfigurationSlotResponder handles the response to the GetConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetConfigurationSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetConfigurationSnapshot description for Gets a snapshot of the configuration of an app at a previous point in time. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// snapshotID - the ID of the snapshot to read. +func (client AppsClient) GetConfigurationSnapshot(ctx context.Context, resourceGroupName string, name string, snapshotID string) (result SiteConfigResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetConfigurationSnapshot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetConfigurationSnapshot", err.Error()) + } + + req, err := client.GetConfigurationSnapshotPreparer(ctx, resourceGroupName, name, snapshotID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshot", nil, "Failure preparing request") + return + } + + resp, err := client.GetConfigurationSnapshotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshot", resp, "Failure sending request") + return + } + + result, err = client.GetConfigurationSnapshotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshot", resp, "Failure responding to request") + return + } + + return +} + +// GetConfigurationSnapshotPreparer prepares the GetConfigurationSnapshot request. +func (client AppsClient) GetConfigurationSnapshotPreparer(ctx context.Context, resourceGroupName string, name string, snapshotID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotId": autorest.Encode("path", snapshotID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetConfigurationSnapshotSender sends the GetConfigurationSnapshot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetConfigurationSnapshotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetConfigurationSnapshotResponder handles the response to the GetConfigurationSnapshot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetConfigurationSnapshotResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetConfigurationSnapshotSlot description for Gets a snapshot of the configuration of an app at a previous point in +// time. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// snapshotID - the ID of the snapshot to read. +// slot - name of the deployment slot. If a slot is not specified, the API will return configuration for the +// production slot. +func (client AppsClient) GetConfigurationSnapshotSlot(ctx context.Context, resourceGroupName string, name string, snapshotID string, slot string) (result SiteConfigResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetConfigurationSnapshotSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetConfigurationSnapshotSlot", err.Error()) + } + + req, err := client.GetConfigurationSnapshotSlotPreparer(ctx, resourceGroupName, name, snapshotID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshotSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetConfigurationSnapshotSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshotSlot", resp, "Failure sending request") + return + } + + result, err = client.GetConfigurationSnapshotSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshotSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetConfigurationSnapshotSlotPreparer prepares the GetConfigurationSnapshotSlot request. +func (client AppsClient) GetConfigurationSnapshotSlotPreparer(ctx context.Context, resourceGroupName string, name string, snapshotID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "snapshotId": autorest.Encode("path", snapshotID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetConfigurationSnapshotSlotSender sends the GetConfigurationSnapshotSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetConfigurationSnapshotSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetConfigurationSnapshotSlotResponder handles the response to the GetConfigurationSnapshotSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetConfigurationSnapshotSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetContainerLogsZip description for Gets the ZIP archived docker log files for the given site +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +func (client AppsClient) GetContainerLogsZip(ctx context.Context, resourceGroupName string, name string) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetContainerLogsZip") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetContainerLogsZip", err.Error()) + } + + req, err := client.GetContainerLogsZipPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetContainerLogsZip", nil, "Failure preparing request") + return + } + + resp, err := client.GetContainerLogsZipSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetContainerLogsZip", resp, "Failure sending request") + return + } + + result, err = client.GetContainerLogsZipResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetContainerLogsZip", resp, "Failure responding to request") + return + } + + return +} + +// GetContainerLogsZipPreparer prepares the GetContainerLogsZip request. +func (client AppsClient) GetContainerLogsZipPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs/zip/download", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetContainerLogsZipSender sends the GetContainerLogsZip request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetContainerLogsZipSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetContainerLogsZipResponder handles the response to the GetContainerLogsZip request. The method always +// closes the http.Response Body. +func (client AppsClient) GetContainerLogsZipResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent)) + result.Response = autorest.Response{Response: resp} + return +} + +// GetContainerLogsZipSlot description for Gets the ZIP archived docker log files for the given site +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of web app slot. If not specified then will default to production slot. +func (client AppsClient) GetContainerLogsZipSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetContainerLogsZipSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetContainerLogsZipSlot", err.Error()) + } + + req, err := client.GetContainerLogsZipSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetContainerLogsZipSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetContainerLogsZipSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetContainerLogsZipSlot", resp, "Failure sending request") + return + } + + result, err = client.GetContainerLogsZipSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetContainerLogsZipSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetContainerLogsZipSlotPreparer prepares the GetContainerLogsZipSlot request. +func (client AppsClient) GetContainerLogsZipSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs/zip/download", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetContainerLogsZipSlotSender sends the GetContainerLogsZipSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetContainerLogsZipSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetContainerLogsZipSlotResponder handles the response to the GetContainerLogsZipSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetContainerLogsZipSlotResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent)) + result.Response = autorest.Response{Response: resp} + return +} + +// GetContinuousWebJob description for Gets a continuous web job by its ID for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +func (client AppsClient) GetContinuousWebJob(ctx context.Context, resourceGroupName string, name string, webJobName string) (result ContinuousWebJob, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetContinuousWebJob") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetContinuousWebJob", err.Error()) + } + + req, err := client.GetContinuousWebJobPreparer(ctx, resourceGroupName, name, webJobName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetContinuousWebJob", nil, "Failure preparing request") + return + } + + resp, err := client.GetContinuousWebJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetContinuousWebJob", resp, "Failure sending request") + return + } + + result, err = client.GetContinuousWebJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetContinuousWebJob", resp, "Failure responding to request") + return + } + + return +} + +// GetContinuousWebJobPreparer prepares the GetContinuousWebJob request. +func (client AppsClient) GetContinuousWebJobPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetContinuousWebJobSender sends the GetContinuousWebJob request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetContinuousWebJobSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetContinuousWebJobResponder handles the response to the GetContinuousWebJob request. The method always +// closes the http.Response Body. +func (client AppsClient) GetContinuousWebJobResponder(resp *http.Response) (result ContinuousWebJob, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetContinuousWebJobSlot description for Gets a continuous web job by its ID for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +// slot - name of the deployment slot. If a slot is not specified, the API deletes a deployment for the +// production slot. +func (client AppsClient) GetContinuousWebJobSlot(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (result ContinuousWebJob, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetContinuousWebJobSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetContinuousWebJobSlot", err.Error()) + } + + req, err := client.GetContinuousWebJobSlotPreparer(ctx, resourceGroupName, name, webJobName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetContinuousWebJobSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetContinuousWebJobSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetContinuousWebJobSlot", resp, "Failure sending request") + return + } + + result, err = client.GetContinuousWebJobSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetContinuousWebJobSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetContinuousWebJobSlotPreparer prepares the GetContinuousWebJobSlot request. +func (client AppsClient) GetContinuousWebJobSlotPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetContinuousWebJobSlotSender sends the GetContinuousWebJobSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetContinuousWebJobSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetContinuousWebJobSlotResponder handles the response to the GetContinuousWebJobSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetContinuousWebJobSlotResponder(resp *http.Response) (result ContinuousWebJob, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeployment description for Get a deployment by its ID for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// ID - deployment ID. +func (client AppsClient) GetDeployment(ctx context.Context, resourceGroupName string, name string, ID string) (result Deployment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetDeployment") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetDeployment", err.Error()) + } + + req, err := client.GetDeploymentPreparer(ctx, resourceGroupName, name, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeployment", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeploymentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeployment", resp, "Failure sending request") + return + } + + result, err = client.GetDeploymentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeployment", resp, "Failure responding to request") + return + } + + return +} + +// GetDeploymentPreparer prepares the GetDeployment request. +func (client AppsClient) GetDeploymentPreparer(ctx context.Context, resourceGroupName string, name string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeploymentSender sends the GetDeployment request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDeploymentSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDeploymentResponder handles the response to the GetDeployment request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDeploymentResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeploymentSlot description for Get a deployment by its ID for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// ID - deployment ID. +// slot - name of the deployment slot. If a slot is not specified, the API gets a deployment for the production +// slot. +func (client AppsClient) GetDeploymentSlot(ctx context.Context, resourceGroupName string, name string, ID string, slot string) (result Deployment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetDeploymentSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetDeploymentSlot", err.Error()) + } + + req, err := client.GetDeploymentSlotPreparer(ctx, resourceGroupName, name, ID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeploymentSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeploymentSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeploymentSlot", resp, "Failure sending request") + return + } + + result, err = client.GetDeploymentSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeploymentSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetDeploymentSlotPreparer prepares the GetDeploymentSlot request. +func (client AppsClient) GetDeploymentSlotPreparer(ctx context.Context, resourceGroupName string, name string, ID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeploymentSlotSender sends the GetDeploymentSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDeploymentSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDeploymentSlotResponder handles the response to the GetDeploymentSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDiagnosticLogsConfiguration description for Gets the logging configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetDiagnosticLogsConfiguration(ctx context.Context, resourceGroupName string, name string) (result SiteLogsConfig, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetDiagnosticLogsConfiguration") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetDiagnosticLogsConfiguration", err.Error()) + } + + req, err := client.GetDiagnosticLogsConfigurationPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.GetDiagnosticLogsConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfiguration", resp, "Failure sending request") + return + } + + result, err = client.GetDiagnosticLogsConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfiguration", resp, "Failure responding to request") + return + } + + return +} + +// GetDiagnosticLogsConfigurationPreparer prepares the GetDiagnosticLogsConfiguration request. +func (client AppsClient) GetDiagnosticLogsConfigurationPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDiagnosticLogsConfigurationSender sends the GetDiagnosticLogsConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDiagnosticLogsConfigurationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDiagnosticLogsConfigurationResponder handles the response to the GetDiagnosticLogsConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDiagnosticLogsConfigurationResponder(resp *http.Response) (result SiteLogsConfig, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDiagnosticLogsConfigurationSlot description for Gets the logging configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get the logging configuration +// for the production slot. +func (client AppsClient) GetDiagnosticLogsConfigurationSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result SiteLogsConfig, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetDiagnosticLogsConfigurationSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetDiagnosticLogsConfigurationSlot", err.Error()) + } + + req, err := client.GetDiagnosticLogsConfigurationSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetDiagnosticLogsConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.GetDiagnosticLogsConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfigurationSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetDiagnosticLogsConfigurationSlotPreparer prepares the GetDiagnosticLogsConfigurationSlot request. +func (client AppsClient) GetDiagnosticLogsConfigurationSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDiagnosticLogsConfigurationSlotSender sends the GetDiagnosticLogsConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDiagnosticLogsConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDiagnosticLogsConfigurationSlotResponder handles the response to the GetDiagnosticLogsConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDiagnosticLogsConfigurationSlotResponder(resp *http.Response) (result SiteLogsConfig, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDomainOwnershipIdentifier description for Get domain ownership identifier for web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// domainOwnershipIdentifierName - name of domain ownership identifier. +func (client AppsClient) GetDomainOwnershipIdentifier(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string) (result Identifier, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetDomainOwnershipIdentifier") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetDomainOwnershipIdentifier", err.Error()) + } + + req, err := client.GetDomainOwnershipIdentifierPreparer(ctx, resourceGroupName, name, domainOwnershipIdentifierName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.GetDomainOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.GetDomainOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifier", resp, "Failure responding to request") + return + } + + return +} + +// GetDomainOwnershipIdentifierPreparer prepares the GetDomainOwnershipIdentifier request. +func (client AppsClient) GetDomainOwnershipIdentifierPreparer(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDomainOwnershipIdentifierSender sends the GetDomainOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDomainOwnershipIdentifierResponder handles the response to the GetDomainOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDomainOwnershipIdentifierResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDomainOwnershipIdentifierSlot description for Get domain ownership identifier for web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// domainOwnershipIdentifierName - name of domain ownership identifier. +// slot - name of the deployment slot. If a slot is not specified, the API will delete the binding for the +// production slot. +func (client AppsClient) GetDomainOwnershipIdentifierSlot(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (result Identifier, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetDomainOwnershipIdentifierSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetDomainOwnershipIdentifierSlot", err.Error()) + } + + req, err := client.GetDomainOwnershipIdentifierSlotPreparer(ctx, resourceGroupName, name, domainOwnershipIdentifierName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifierSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetDomainOwnershipIdentifierSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifierSlot", resp, "Failure sending request") + return + } + + result, err = client.GetDomainOwnershipIdentifierSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifierSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetDomainOwnershipIdentifierSlotPreparer prepares the GetDomainOwnershipIdentifierSlot request. +func (client AppsClient) GetDomainOwnershipIdentifierSlotPreparer(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDomainOwnershipIdentifierSlotSender sends the GetDomainOwnershipIdentifierSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDomainOwnershipIdentifierSlotResponder handles the response to the GetDomainOwnershipIdentifierSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetFtpAllowed description for Returns whether FTP is allowed on the site or not. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetFtpAllowed(ctx context.Context, resourceGroupName string, name string) (result CsmPublishingCredentialsPoliciesEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetFtpAllowed") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetFtpAllowed", err.Error()) + } + + req, err := client.GetFtpAllowedPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetFtpAllowed", nil, "Failure preparing request") + return + } + + resp, err := client.GetFtpAllowedSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetFtpAllowed", resp, "Failure sending request") + return + } + + result, err = client.GetFtpAllowedResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetFtpAllowed", resp, "Failure responding to request") + return + } + + return +} + +// GetFtpAllowedPreparer prepares the GetFtpAllowed request. +func (client AppsClient) GetFtpAllowedPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/ftp", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetFtpAllowedSender sends the GetFtpAllowed request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetFtpAllowedSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetFtpAllowedResponder handles the response to the GetFtpAllowed request. The method always +// closes the http.Response Body. +func (client AppsClient) GetFtpAllowedResponder(resp *http.Response) (result CsmPublishingCredentialsPoliciesEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetFtpAllowedSlot description for Returns whether FTP is allowed on the site or not. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetFtpAllowedSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result CsmPublishingCredentialsPoliciesEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetFtpAllowedSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetFtpAllowedSlot", err.Error()) + } + + req, err := client.GetFtpAllowedSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetFtpAllowedSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetFtpAllowedSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetFtpAllowedSlot", resp, "Failure sending request") + return + } + + result, err = client.GetFtpAllowedSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetFtpAllowedSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetFtpAllowedSlotPreparer prepares the GetFtpAllowedSlot request. +func (client AppsClient) GetFtpAllowedSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/basicPublishingCredentialsPolicies/ftp", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetFtpAllowedSlotSender sends the GetFtpAllowedSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetFtpAllowedSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetFtpAllowedSlotResponder handles the response to the GetFtpAllowedSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetFtpAllowedSlotResponder(resp *http.Response) (result CsmPublishingCredentialsPoliciesEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetFunction description for Get function information by its ID for web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// functionName - function name. +func (client AppsClient) GetFunction(ctx context.Context, resourceGroupName string, name string, functionName string) (result FunctionEnvelope, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetFunction") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetFunction", err.Error()) + } + + req, err := client.GetFunctionPreparer(ctx, resourceGroupName, name, functionName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetFunction", nil, "Failure preparing request") + return + } + + resp, err := client.GetFunctionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetFunction", resp, "Failure sending request") + return + } + + result, err = client.GetFunctionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetFunction", resp, "Failure responding to request") + return + } + + return +} + +// GetFunctionPreparer prepares the GetFunction request. +func (client AppsClient) GetFunctionPreparer(ctx context.Context, resourceGroupName string, name string, functionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetFunctionSender sends the GetFunction request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetFunctionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetFunctionResponder handles the response to the GetFunction request. The method always +// closes the http.Response Body. +func (client AppsClient) GetFunctionResponder(resp *http.Response) (result FunctionEnvelope, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetFunctionsAdminToken description for Fetch a short lived token that can be exchanged for a master key. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +func (client AppsClient) GetFunctionsAdminToken(ctx context.Context, resourceGroupName string, name string) (result String, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetFunctionsAdminToken") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetFunctionsAdminToken", err.Error()) + } + + req, err := client.GetFunctionsAdminTokenPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetFunctionsAdminToken", nil, "Failure preparing request") + return + } + + resp, err := client.GetFunctionsAdminTokenSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetFunctionsAdminToken", resp, "Failure sending request") + return + } + + result, err = client.GetFunctionsAdminTokenResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetFunctionsAdminToken", resp, "Failure responding to request") + return + } + + return +} + +// GetFunctionsAdminTokenPreparer prepares the GetFunctionsAdminToken request. +func (client AppsClient) GetFunctionsAdminTokenPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/admin/token", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetFunctionsAdminTokenSender sends the GetFunctionsAdminToken request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetFunctionsAdminTokenSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetFunctionsAdminTokenResponder handles the response to the GetFunctionsAdminToken request. The method always +// closes the http.Response Body. +func (client AppsClient) GetFunctionsAdminTokenResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetFunctionsAdminTokenSlot description for Fetch a short lived token that can be exchanged for a master key. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of web app slot. If not specified then will default to production slot. +func (client AppsClient) GetFunctionsAdminTokenSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result String, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetFunctionsAdminTokenSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetFunctionsAdminTokenSlot", err.Error()) + } + + req, err := client.GetFunctionsAdminTokenSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetFunctionsAdminTokenSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetFunctionsAdminTokenSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetFunctionsAdminTokenSlot", resp, "Failure sending request") + return + } + + result, err = client.GetFunctionsAdminTokenSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetFunctionsAdminTokenSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetFunctionsAdminTokenSlotPreparer prepares the GetFunctionsAdminTokenSlot request. +func (client AppsClient) GetFunctionsAdminTokenSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/admin/token", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetFunctionsAdminTokenSlotSender sends the GetFunctionsAdminTokenSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetFunctionsAdminTokenSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetFunctionsAdminTokenSlotResponder handles the response to the GetFunctionsAdminTokenSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetFunctionsAdminTokenSlotResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHostNameBinding description for Get the named hostname binding for an app (or deployment slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// hostName - hostname in the hostname binding. +func (client AppsClient) GetHostNameBinding(ctx context.Context, resourceGroupName string, name string, hostName string) (result HostNameBinding, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetHostNameBinding") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetHostNameBinding", err.Error()) + } + + req, err := client.GetHostNameBindingPreparer(ctx, resourceGroupName, name, hostName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBinding", nil, "Failure preparing request") + return + } + + resp, err := client.GetHostNameBindingSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBinding", resp, "Failure sending request") + return + } + + result, err = client.GetHostNameBindingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBinding", resp, "Failure responding to request") + return + } + + return +} + +// GetHostNameBindingPreparer prepares the GetHostNameBinding request. +func (client AppsClient) GetHostNameBindingPreparer(ctx context.Context, resourceGroupName string, name string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetHostNameBindingSender sends the GetHostNameBinding request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetHostNameBindingSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetHostNameBindingResponder handles the response to the GetHostNameBinding request. The method always +// closes the http.Response Body. +func (client AppsClient) GetHostNameBindingResponder(resp *http.Response) (result HostNameBinding, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHostNameBindingSlot description for Get the named hostname binding for an app (or deployment slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API the named binding for the production +// slot. +// hostName - hostname in the hostname binding. +func (client AppsClient) GetHostNameBindingSlot(ctx context.Context, resourceGroupName string, name string, slot string, hostName string) (result HostNameBinding, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetHostNameBindingSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetHostNameBindingSlot", err.Error()) + } + + req, err := client.GetHostNameBindingSlotPreparer(ctx, resourceGroupName, name, slot, hostName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBindingSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetHostNameBindingSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBindingSlot", resp, "Failure sending request") + return + } + + result, err = client.GetHostNameBindingSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBindingSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetHostNameBindingSlotPreparer prepares the GetHostNameBindingSlot request. +func (client AppsClient) GetHostNameBindingSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetHostNameBindingSlotSender sends the GetHostNameBindingSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetHostNameBindingSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetHostNameBindingSlotResponder handles the response to the GetHostNameBindingSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetHostNameBindingSlotResponder(resp *http.Response) (result HostNameBinding, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHybridConnection description for Retrieves a specific Service Bus Hybrid Connection used by this Web App. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// namespaceName - the namespace for this hybrid connection. +// relayName - the relay name for this hybrid connection. +func (client AppsClient) GetHybridConnection(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetHybridConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetHybridConnection", err.Error()) + } + + req, err := client.GetHybridConnectionPreparer(ctx, resourceGroupName, name, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnection", nil, "Failure preparing request") + return + } + + resp, err := client.GetHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnection", resp, "Failure sending request") + return + } + + result, err = client.GetHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnection", resp, "Failure responding to request") + return + } + + return +} + +// GetHybridConnectionPreparer prepares the GetHybridConnection request. +func (client AppsClient) GetHybridConnectionPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetHybridConnectionSender sends the GetHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetHybridConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetHybridConnectionResponder handles the response to the GetHybridConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) GetHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHybridConnectionSlot description for Retrieves a specific Service Bus Hybrid Connection used by this Web App. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// namespaceName - the namespace for this hybrid connection. +// relayName - the relay name for this hybrid connection. +// slot - the name of the slot for the web app. +func (client AppsClient) GetHybridConnectionSlot(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string, slot string) (result HybridConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetHybridConnectionSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetHybridConnectionSlot", err.Error()) + } + + req, err := client.GetHybridConnectionSlotPreparer(ctx, resourceGroupName, name, namespaceName, relayName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetHybridConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.GetHybridConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnectionSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetHybridConnectionSlotPreparer prepares the GetHybridConnectionSlot request. +func (client AppsClient) GetHybridConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetHybridConnectionSlotSender sends the GetHybridConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetHybridConnectionSlotResponder handles the response to the GetHybridConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetHybridConnectionSlotResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceFunctionSlot description for Get function information by its ID for web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// functionName - function name. +// slot - name of the deployment slot. +func (client AppsClient) GetInstanceFunctionSlot(ctx context.Context, resourceGroupName string, name string, functionName string, slot string) (result FunctionEnvelope, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetInstanceFunctionSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetInstanceFunctionSlot", err.Error()) + } + + req, err := client.GetInstanceFunctionSlotPreparer(ctx, resourceGroupName, name, functionName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceFunctionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceFunctionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceFunctionSlot", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceFunctionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceFunctionSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetInstanceFunctionSlotPreparer prepares the GetInstanceFunctionSlot request. +func (client AppsClient) GetInstanceFunctionSlotPreparer(ctx context.Context, resourceGroupName string, name string, functionName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInstanceFunctionSlotSender sends the GetInstanceFunctionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceFunctionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetInstanceFunctionSlotResponder handles the response to the GetInstanceFunctionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceFunctionSlotResponder(resp *http.Response) (result FunctionEnvelope, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceInfo description for Gets all scale-out instances of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetInstanceInfo(ctx context.Context, resourceGroupName string, name string, instanceID string) (result SiteInstanceStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetInstanceInfo") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetInstanceInfo", err.Error()) + } + + req, err := client.GetInstanceInfoPreparer(ctx, resourceGroupName, name, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceInfo", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceInfoSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceInfo", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceInfoResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceInfo", resp, "Failure responding to request") + return + } + + return +} + +// GetInstanceInfoPreparer prepares the GetInstanceInfo request. +func (client AppsClient) GetInstanceInfoPreparer(ctx context.Context, resourceGroupName string, name string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInstanceInfoSender sends the GetInstanceInfo request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceInfoSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetInstanceInfoResponder handles the response to the GetInstanceInfo request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceInfoResponder(resp *http.Response) (result SiteInstanceStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceInfoSlot description for Gets all scale-out instances of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API gets the production slot instances. +func (client AppsClient) GetInstanceInfoSlot(ctx context.Context, resourceGroupName string, name string, instanceID string, slot string) (result SiteInstanceStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetInstanceInfoSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetInstanceInfoSlot", err.Error()) + } + + req, err := client.GetInstanceInfoSlotPreparer(ctx, resourceGroupName, name, instanceID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceInfoSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceInfoSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceInfoSlot", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceInfoSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceInfoSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetInstanceInfoSlotPreparer prepares the GetInstanceInfoSlot request. +func (client AppsClient) GetInstanceInfoSlotPreparer(ctx context.Context, resourceGroupName string, name string, instanceID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInstanceInfoSlotSender sends the GetInstanceInfoSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceInfoSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetInstanceInfoSlotResponder handles the response to the GetInstanceInfoSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceInfoSlotResponder(resp *http.Response) (result SiteInstanceStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceMSDeployLog description for Get the MSDeploy Log for the last MSDeploy operation. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// instanceID - ID of web app instance. +func (client AppsClient) GetInstanceMSDeployLog(ctx context.Context, resourceGroupName string, name string, instanceID string) (result MSDeployLog, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetInstanceMSDeployLog") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetInstanceMSDeployLog", err.Error()) + } + + req, err := client.GetInstanceMSDeployLogPreparer(ctx, resourceGroupName, name, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceMSDeployLog", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceMSDeployLogSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceMSDeployLog", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceMSDeployLogResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceMSDeployLog", resp, "Failure responding to request") + return + } + + return +} + +// GetInstanceMSDeployLogPreparer prepares the GetInstanceMSDeployLog request. +func (client AppsClient) GetInstanceMSDeployLogPreparer(ctx context.Context, resourceGroupName string, name string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy/log", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInstanceMSDeployLogSender sends the GetInstanceMSDeployLog request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceMSDeployLogSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetInstanceMSDeployLogResponder handles the response to the GetInstanceMSDeployLog request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceMSDeployLogResponder(resp *http.Response) (result MSDeployLog, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceMSDeployLogSlot description for Get the MSDeploy Log for the last MSDeploy operation. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of web app slot. If not specified then will default to production slot. +// instanceID - ID of web app instance. +func (client AppsClient) GetInstanceMSDeployLogSlot(ctx context.Context, resourceGroupName string, name string, slot string, instanceID string) (result MSDeployLog, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetInstanceMSDeployLogSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetInstanceMSDeployLogSlot", err.Error()) + } + + req, err := client.GetInstanceMSDeployLogSlotPreparer(ctx, resourceGroupName, name, slot, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceMSDeployLogSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceMSDeployLogSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceMSDeployLogSlot", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceMSDeployLogSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceMSDeployLogSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetInstanceMSDeployLogSlotPreparer prepares the GetInstanceMSDeployLogSlot request. +func (client AppsClient) GetInstanceMSDeployLogSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy/log", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInstanceMSDeployLogSlotSender sends the GetInstanceMSDeployLogSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceMSDeployLogSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetInstanceMSDeployLogSlotResponder handles the response to the GetInstanceMSDeployLogSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceMSDeployLogSlotResponder(resp *http.Response) (result MSDeployLog, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceMsDeployStatus description for Get the status of the last MSDeploy operation. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// instanceID - ID of web app instance. +func (client AppsClient) GetInstanceMsDeployStatus(ctx context.Context, resourceGroupName string, name string, instanceID string) (result MSDeployStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetInstanceMsDeployStatus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetInstanceMsDeployStatus", err.Error()) + } + + req, err := client.GetInstanceMsDeployStatusPreparer(ctx, resourceGroupName, name, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceMsDeployStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceMsDeployStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceMsDeployStatus", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceMsDeployStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceMsDeployStatus", resp, "Failure responding to request") + return + } + + return +} + +// GetInstanceMsDeployStatusPreparer prepares the GetInstanceMsDeployStatus request. +func (client AppsClient) GetInstanceMsDeployStatusPreparer(ctx context.Context, resourceGroupName string, name string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInstanceMsDeployStatusSender sends the GetInstanceMsDeployStatus request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceMsDeployStatusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetInstanceMsDeployStatusResponder handles the response to the GetInstanceMsDeployStatus request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceMsDeployStatusResponder(resp *http.Response) (result MSDeployStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceMsDeployStatusSlot description for Get the status of the last MSDeploy operation. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of web app slot. If not specified then will default to production slot. +// instanceID - ID of web app instance. +func (client AppsClient) GetInstanceMsDeployStatusSlot(ctx context.Context, resourceGroupName string, name string, slot string, instanceID string) (result MSDeployStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetInstanceMsDeployStatusSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetInstanceMsDeployStatusSlot", err.Error()) + } + + req, err := client.GetInstanceMsDeployStatusSlotPreparer(ctx, resourceGroupName, name, slot, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceMsDeployStatusSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceMsDeployStatusSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceMsDeployStatusSlot", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceMsDeployStatusSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceMsDeployStatusSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetInstanceMsDeployStatusSlotPreparer prepares the GetInstanceMsDeployStatusSlot request. +func (client AppsClient) GetInstanceMsDeployStatusSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInstanceMsDeployStatusSlotSender sends the GetInstanceMsDeployStatusSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceMsDeployStatusSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetInstanceMsDeployStatusSlotResponder handles the response to the GetInstanceMsDeployStatusSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceMsDeployStatusSlotResponder(resp *http.Response) (result MSDeployStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceProcess description for Get process information by its ID for a specific scaled-out instance in a web +// site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// instanceID - ID of a specific scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances". +func (client AppsClient) GetInstanceProcess(ctx context.Context, resourceGroupName string, name string, processID string, instanceID string) (result ProcessInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetInstanceProcess") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetInstanceProcess", err.Error()) + } + + req, err := client.GetInstanceProcessPreparer(ctx, resourceGroupName, name, processID, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcess", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceProcessSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcess", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceProcessResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcess", resp, "Failure responding to request") + return + } + + return +} + +// GetInstanceProcessPreparer prepares the GetInstanceProcess request. +func (client AppsClient) GetInstanceProcessPreparer(ctx context.Context, resourceGroupName string, name string, processID string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInstanceProcessSender sends the GetInstanceProcess request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceProcessSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetInstanceProcessResponder handles the response to the GetInstanceProcess request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceProcessResponder(resp *http.Response) (result ProcessInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceProcessDump description for Get a memory dump of a process by its ID for a specific scaled-out instance +// in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// instanceID - ID of a specific scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances". +func (client AppsClient) GetInstanceProcessDump(ctx context.Context, resourceGroupName string, name string, processID string, instanceID string) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetInstanceProcessDump") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetInstanceProcessDump", err.Error()) + } + + req, err := client.GetInstanceProcessDumpPreparer(ctx, resourceGroupName, name, processID, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcessDump", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceProcessDumpSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcessDump", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceProcessDumpResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcessDump", resp, "Failure responding to request") + return + } + + return +} + +// GetInstanceProcessDumpPreparer prepares the GetInstanceProcessDump request. +func (client AppsClient) GetInstanceProcessDumpPreparer(ctx context.Context, resourceGroupName string, name string, processID string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/dump", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInstanceProcessDumpSender sends the GetInstanceProcessDump request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceProcessDumpSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetInstanceProcessDumpResponder handles the response to the GetInstanceProcessDump request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceProcessDumpResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceProcessDumpSlot description for Get a memory dump of a process by its ID for a specific scaled-out +// instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +// instanceID - ID of a specific scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances". +func (client AppsClient) GetInstanceProcessDumpSlot(ctx context.Context, resourceGroupName string, name string, processID string, slot string, instanceID string) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetInstanceProcessDumpSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetInstanceProcessDumpSlot", err.Error()) + } + + req, err := client.GetInstanceProcessDumpSlotPreparer(ctx, resourceGroupName, name, processID, slot, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcessDumpSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceProcessDumpSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcessDumpSlot", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceProcessDumpSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcessDumpSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetInstanceProcessDumpSlotPreparer prepares the GetInstanceProcessDumpSlot request. +func (client AppsClient) GetInstanceProcessDumpSlotPreparer(ctx context.Context, resourceGroupName string, name string, processID string, slot string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/dump", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInstanceProcessDumpSlotSender sends the GetInstanceProcessDumpSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceProcessDumpSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetInstanceProcessDumpSlotResponder handles the response to the GetInstanceProcessDumpSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceProcessDumpSlotResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceProcessModule description for Get process information by its ID for a specific scaled-out instance in a +// web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// baseAddress - module base address. +// instanceID - ID of a specific scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances". +func (client AppsClient) GetInstanceProcessModule(ctx context.Context, resourceGroupName string, name string, processID string, baseAddress string, instanceID string) (result ProcessModuleInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetInstanceProcessModule") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetInstanceProcessModule", err.Error()) + } + + req, err := client.GetInstanceProcessModulePreparer(ctx, resourceGroupName, name, processID, baseAddress, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcessModule", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceProcessModuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcessModule", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceProcessModuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcessModule", resp, "Failure responding to request") + return + } + + return +} + +// GetInstanceProcessModulePreparer prepares the GetInstanceProcessModule request. +func (client AppsClient) GetInstanceProcessModulePreparer(ctx context.Context, resourceGroupName string, name string, processID string, baseAddress string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "baseAddress": autorest.Encode("path", baseAddress), + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInstanceProcessModuleSender sends the GetInstanceProcessModule request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceProcessModuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetInstanceProcessModuleResponder handles the response to the GetInstanceProcessModule request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceProcessModuleResponder(resp *http.Response) (result ProcessModuleInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceProcessModuleSlot description for Get process information by its ID for a specific scaled-out instance in +// a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// baseAddress - module base address. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +// instanceID - ID of a specific scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances". +func (client AppsClient) GetInstanceProcessModuleSlot(ctx context.Context, resourceGroupName string, name string, processID string, baseAddress string, slot string, instanceID string) (result ProcessModuleInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetInstanceProcessModuleSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetInstanceProcessModuleSlot", err.Error()) + } + + req, err := client.GetInstanceProcessModuleSlotPreparer(ctx, resourceGroupName, name, processID, baseAddress, slot, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcessModuleSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceProcessModuleSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcessModuleSlot", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceProcessModuleSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcessModuleSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetInstanceProcessModuleSlotPreparer prepares the GetInstanceProcessModuleSlot request. +func (client AppsClient) GetInstanceProcessModuleSlotPreparer(ctx context.Context, resourceGroupName string, name string, processID string, baseAddress string, slot string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "baseAddress": autorest.Encode("path", baseAddress), + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInstanceProcessModuleSlotSender sends the GetInstanceProcessModuleSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceProcessModuleSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetInstanceProcessModuleSlotResponder handles the response to the GetInstanceProcessModuleSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceProcessModuleSlotResponder(resp *http.Response) (result ProcessModuleInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceProcessSlot description for Get process information by its ID for a specific scaled-out instance in a web +// site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +// instanceID - ID of a specific scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances". +func (client AppsClient) GetInstanceProcessSlot(ctx context.Context, resourceGroupName string, name string, processID string, slot string, instanceID string) (result ProcessInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetInstanceProcessSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetInstanceProcessSlot", err.Error()) + } + + req, err := client.GetInstanceProcessSlotPreparer(ctx, resourceGroupName, name, processID, slot, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcessSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceProcessSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcessSlot", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceProcessSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceProcessSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetInstanceProcessSlotPreparer prepares the GetInstanceProcessSlot request. +func (client AppsClient) GetInstanceProcessSlotPreparer(ctx context.Context, resourceGroupName string, name string, processID string, slot string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInstanceProcessSlotSender sends the GetInstanceProcessSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceProcessSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetInstanceProcessSlotResponder handles the response to the GetInstanceProcessSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceProcessSlotResponder(resp *http.Response) (result ProcessInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMigrateMySQLStatus description for Returns the status of MySql in app migration, if one is active, and whether or +// not MySql in app is enabled +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +func (client AppsClient) GetMigrateMySQLStatus(ctx context.Context, resourceGroupName string, name string) (result MigrateMySQLStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetMigrateMySQLStatus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetMigrateMySQLStatus", err.Error()) + } + + req, err := client.GetMigrateMySQLStatusPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetMigrateMySQLStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatus", resp, "Failure sending request") + return + } + + result, err = client.GetMigrateMySQLStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatus", resp, "Failure responding to request") + return + } + + return +} + +// GetMigrateMySQLStatusPreparer prepares the GetMigrateMySQLStatus request. +func (client AppsClient) GetMigrateMySQLStatusPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql/status", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetMigrateMySQLStatusSender sends the GetMigrateMySQLStatus request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetMigrateMySQLStatusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetMigrateMySQLStatusResponder handles the response to the GetMigrateMySQLStatus request. The method always +// closes the http.Response Body. +func (client AppsClient) GetMigrateMySQLStatusResponder(resp *http.Response) (result MigrateMySQLStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMigrateMySQLStatusSlot description for Returns the status of MySql in app migration, if one is active, and +// whether or not MySql in app is enabled +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of the deployment slot. +func (client AppsClient) GetMigrateMySQLStatusSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result MigrateMySQLStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetMigrateMySQLStatusSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetMigrateMySQLStatusSlot", err.Error()) + } + + req, err := client.GetMigrateMySQLStatusSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatusSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetMigrateMySQLStatusSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatusSlot", resp, "Failure sending request") + return + } + + result, err = client.GetMigrateMySQLStatusSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatusSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetMigrateMySQLStatusSlotPreparer prepares the GetMigrateMySQLStatusSlot request. +func (client AppsClient) GetMigrateMySQLStatusSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetMigrateMySQLStatusSlotSender sends the GetMigrateMySQLStatusSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetMigrateMySQLStatusSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetMigrateMySQLStatusSlotResponder handles the response to the GetMigrateMySQLStatusSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetMigrateMySQLStatusSlotResponder(resp *http.Response) (result MigrateMySQLStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMSDeployLog description for Get the MSDeploy Log for the last MSDeploy operation. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +func (client AppsClient) GetMSDeployLog(ctx context.Context, resourceGroupName string, name string) (result MSDeployLog, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetMSDeployLog") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetMSDeployLog", err.Error()) + } + + req, err := client.GetMSDeployLogPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMSDeployLog", nil, "Failure preparing request") + return + } + + resp, err := client.GetMSDeployLogSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMSDeployLog", resp, "Failure sending request") + return + } + + result, err = client.GetMSDeployLogResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMSDeployLog", resp, "Failure responding to request") + return + } + + return +} + +// GetMSDeployLogPreparer prepares the GetMSDeployLog request. +func (client AppsClient) GetMSDeployLogPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy/log", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetMSDeployLogSender sends the GetMSDeployLog request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetMSDeployLogSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetMSDeployLogResponder handles the response to the GetMSDeployLog request. The method always +// closes the http.Response Body. +func (client AppsClient) GetMSDeployLogResponder(resp *http.Response) (result MSDeployLog, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMSDeployLogSlot description for Get the MSDeploy Log for the last MSDeploy operation. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of web app slot. If not specified then will default to production slot. +func (client AppsClient) GetMSDeployLogSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result MSDeployLog, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetMSDeployLogSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetMSDeployLogSlot", err.Error()) + } + + req, err := client.GetMSDeployLogSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMSDeployLogSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetMSDeployLogSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMSDeployLogSlot", resp, "Failure sending request") + return + } + + result, err = client.GetMSDeployLogSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMSDeployLogSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetMSDeployLogSlotPreparer prepares the GetMSDeployLogSlot request. +func (client AppsClient) GetMSDeployLogSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy/log", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetMSDeployLogSlotSender sends the GetMSDeployLogSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetMSDeployLogSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetMSDeployLogSlotResponder handles the response to the GetMSDeployLogSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetMSDeployLogSlotResponder(resp *http.Response) (result MSDeployLog, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMSDeployStatus description for Get the status of the last MSDeploy operation. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +func (client AppsClient) GetMSDeployStatus(ctx context.Context, resourceGroupName string, name string) (result MSDeployStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetMSDeployStatus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetMSDeployStatus", err.Error()) + } + + req, err := client.GetMSDeployStatusPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMSDeployStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetMSDeployStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMSDeployStatus", resp, "Failure sending request") + return + } + + result, err = client.GetMSDeployStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMSDeployStatus", resp, "Failure responding to request") + return + } + + return +} + +// GetMSDeployStatusPreparer prepares the GetMSDeployStatus request. +func (client AppsClient) GetMSDeployStatusPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetMSDeployStatusSender sends the GetMSDeployStatus request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetMSDeployStatusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetMSDeployStatusResponder handles the response to the GetMSDeployStatus request. The method always +// closes the http.Response Body. +func (client AppsClient) GetMSDeployStatusResponder(resp *http.Response) (result MSDeployStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMSDeployStatusSlot description for Get the status of the last MSDeploy operation. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of web app slot. If not specified then will default to production slot. +func (client AppsClient) GetMSDeployStatusSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result MSDeployStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetMSDeployStatusSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetMSDeployStatusSlot", err.Error()) + } + + req, err := client.GetMSDeployStatusSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMSDeployStatusSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetMSDeployStatusSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMSDeployStatusSlot", resp, "Failure sending request") + return + } + + result, err = client.GetMSDeployStatusSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMSDeployStatusSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetMSDeployStatusSlotPreparer prepares the GetMSDeployStatusSlot request. +func (client AppsClient) GetMSDeployStatusSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetMSDeployStatusSlotSender sends the GetMSDeployStatusSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetMSDeployStatusSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetMSDeployStatusSlotResponder handles the response to the GetMSDeployStatusSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetMSDeployStatusSlotResponder(resp *http.Response) (result MSDeployStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetNetworkTraceOperation description for Gets a named operation for a network trace capturing (or deployment slot, +// if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// operationID - GUID of the operation. +func (client AppsClient) GetNetworkTraceOperation(ctx context.Context, resourceGroupName string, name string, operationID string) (result ListNetworkTrace, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetNetworkTraceOperation") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetNetworkTraceOperation", err.Error()) + } + + req, err := client.GetNetworkTraceOperationPreparer(ctx, resourceGroupName, name, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTraceOperation", nil, "Failure preparing request") + return + } + + resp, err := client.GetNetworkTraceOperationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTraceOperation", resp, "Failure sending request") + return + } + + result, err = client.GetNetworkTraceOperationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTraceOperation", resp, "Failure responding to request") + return + } + + return +} + +// GetNetworkTraceOperationPreparer prepares the GetNetworkTraceOperation request. +func (client AppsClient) GetNetworkTraceOperationPreparer(ctx context.Context, resourceGroupName string, name string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/operationresults/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetNetworkTraceOperationSender sends the GetNetworkTraceOperation request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetNetworkTraceOperationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetNetworkTraceOperationResponder handles the response to the GetNetworkTraceOperation request. The method always +// closes the http.Response Body. +func (client AppsClient) GetNetworkTraceOperationResponder(resp *http.Response) (result ListNetworkTrace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetNetworkTraceOperationSlot description for Gets a named operation for a network trace capturing (or deployment +// slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// operationID - GUID of the operation. +// slot - name of the deployment slot. If a slot is not specified, the API will get an operation for the +// production slot. +func (client AppsClient) GetNetworkTraceOperationSlot(ctx context.Context, resourceGroupName string, name string, operationID string, slot string) (result ListNetworkTrace, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetNetworkTraceOperationSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetNetworkTraceOperationSlot", err.Error()) + } + + req, err := client.GetNetworkTraceOperationSlotPreparer(ctx, resourceGroupName, name, operationID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTraceOperationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetNetworkTraceOperationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTraceOperationSlot", resp, "Failure sending request") + return + } + + result, err = client.GetNetworkTraceOperationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTraceOperationSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetNetworkTraceOperationSlotPreparer prepares the GetNetworkTraceOperationSlot request. +func (client AppsClient) GetNetworkTraceOperationSlotPreparer(ctx context.Context, resourceGroupName string, name string, operationID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/operationresults/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetNetworkTraceOperationSlotSender sends the GetNetworkTraceOperationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetNetworkTraceOperationSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetNetworkTraceOperationSlotResponder handles the response to the GetNetworkTraceOperationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetNetworkTraceOperationSlotResponder(resp *http.Response) (result ListNetworkTrace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetNetworkTraceOperationSlotV2 description for Gets a named operation for a network trace capturing (or deployment +// slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// operationID - GUID of the operation. +// slot - name of the deployment slot. If a slot is not specified, the API will get an operation for the +// production slot. +func (client AppsClient) GetNetworkTraceOperationSlotV2(ctx context.Context, resourceGroupName string, name string, operationID string, slot string) (result ListNetworkTrace, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetNetworkTraceOperationSlotV2") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetNetworkTraceOperationSlotV2", err.Error()) + } + + req, err := client.GetNetworkTraceOperationSlotV2Preparer(ctx, resourceGroupName, name, operationID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTraceOperationSlotV2", nil, "Failure preparing request") + return + } + + resp, err := client.GetNetworkTraceOperationSlotV2Sender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTraceOperationSlotV2", resp, "Failure sending request") + return + } + + result, err = client.GetNetworkTraceOperationSlotV2Responder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTraceOperationSlotV2", resp, "Failure responding to request") + return + } + + return +} + +// GetNetworkTraceOperationSlotV2Preparer prepares the GetNetworkTraceOperationSlotV2 request. +func (client AppsClient) GetNetworkTraceOperationSlotV2Preparer(ctx context.Context, resourceGroupName string, name string, operationID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTraces/current/operationresults/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetNetworkTraceOperationSlotV2Sender sends the GetNetworkTraceOperationSlotV2 request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetNetworkTraceOperationSlotV2Sender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetNetworkTraceOperationSlotV2Responder handles the response to the GetNetworkTraceOperationSlotV2 request. The method always +// closes the http.Response Body. +func (client AppsClient) GetNetworkTraceOperationSlotV2Responder(resp *http.Response) (result ListNetworkTrace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetNetworkTraceOperationV2 description for Gets a named operation for a network trace capturing (or deployment slot, +// if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// operationID - GUID of the operation. +func (client AppsClient) GetNetworkTraceOperationV2(ctx context.Context, resourceGroupName string, name string, operationID string) (result ListNetworkTrace, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetNetworkTraceOperationV2") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetNetworkTraceOperationV2", err.Error()) + } + + req, err := client.GetNetworkTraceOperationV2Preparer(ctx, resourceGroupName, name, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTraceOperationV2", nil, "Failure preparing request") + return + } + + resp, err := client.GetNetworkTraceOperationV2Sender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTraceOperationV2", resp, "Failure sending request") + return + } + + result, err = client.GetNetworkTraceOperationV2Responder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTraceOperationV2", resp, "Failure responding to request") + return + } + + return +} + +// GetNetworkTraceOperationV2Preparer prepares the GetNetworkTraceOperationV2 request. +func (client AppsClient) GetNetworkTraceOperationV2Preparer(ctx context.Context, resourceGroupName string, name string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTraces/current/operationresults/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetNetworkTraceOperationV2Sender sends the GetNetworkTraceOperationV2 request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetNetworkTraceOperationV2Sender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetNetworkTraceOperationV2Responder handles the response to the GetNetworkTraceOperationV2 request. The method always +// closes the http.Response Body. +func (client AppsClient) GetNetworkTraceOperationV2Responder(resp *http.Response) (result ListNetworkTrace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetNetworkTraces description for Gets a named operation for a network trace capturing (or deployment slot, if +// specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// operationID - GUID of the operation. +func (client AppsClient) GetNetworkTraces(ctx context.Context, resourceGroupName string, name string, operationID string) (result ListNetworkTrace, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetNetworkTraces") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetNetworkTraces", err.Error()) + } + + req, err := client.GetNetworkTracesPreparer(ctx, resourceGroupName, name, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTraces", nil, "Failure preparing request") + return + } + + resp, err := client.GetNetworkTracesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTraces", resp, "Failure sending request") + return + } + + result, err = client.GetNetworkTracesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTraces", resp, "Failure responding to request") + return + } + + return +} + +// GetNetworkTracesPreparer prepares the GetNetworkTraces request. +func (client AppsClient) GetNetworkTracesPreparer(ctx context.Context, resourceGroupName string, name string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetNetworkTracesSender sends the GetNetworkTraces request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetNetworkTracesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetNetworkTracesResponder handles the response to the GetNetworkTraces request. The method always +// closes the http.Response Body. +func (client AppsClient) GetNetworkTracesResponder(resp *http.Response) (result ListNetworkTrace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetNetworkTracesSlot description for Gets a named operation for a network trace capturing (or deployment slot, if +// specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// operationID - GUID of the operation. +// slot - name of the deployment slot. If a slot is not specified, the API will get an operation for the +// production slot. +func (client AppsClient) GetNetworkTracesSlot(ctx context.Context, resourceGroupName string, name string, operationID string, slot string) (result ListNetworkTrace, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetNetworkTracesSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetNetworkTracesSlot", err.Error()) + } + + req, err := client.GetNetworkTracesSlotPreparer(ctx, resourceGroupName, name, operationID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTracesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetNetworkTracesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTracesSlot", resp, "Failure sending request") + return + } + + result, err = client.GetNetworkTracesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTracesSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetNetworkTracesSlotPreparer prepares the GetNetworkTracesSlot request. +func (client AppsClient) GetNetworkTracesSlotPreparer(ctx context.Context, resourceGroupName string, name string, operationID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetNetworkTracesSlotSender sends the GetNetworkTracesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetNetworkTracesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetNetworkTracesSlotResponder handles the response to the GetNetworkTracesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetNetworkTracesSlotResponder(resp *http.Response) (result ListNetworkTrace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetNetworkTracesSlotV2 description for Gets a named operation for a network trace capturing (or deployment slot, if +// specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// operationID - GUID of the operation. +// slot - name of the deployment slot. If a slot is not specified, the API will get an operation for the +// production slot. +func (client AppsClient) GetNetworkTracesSlotV2(ctx context.Context, resourceGroupName string, name string, operationID string, slot string) (result ListNetworkTrace, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetNetworkTracesSlotV2") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetNetworkTracesSlotV2", err.Error()) + } + + req, err := client.GetNetworkTracesSlotV2Preparer(ctx, resourceGroupName, name, operationID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTracesSlotV2", nil, "Failure preparing request") + return + } + + resp, err := client.GetNetworkTracesSlotV2Sender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTracesSlotV2", resp, "Failure sending request") + return + } + + result, err = client.GetNetworkTracesSlotV2Responder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTracesSlotV2", resp, "Failure responding to request") + return + } + + return +} + +// GetNetworkTracesSlotV2Preparer prepares the GetNetworkTracesSlotV2 request. +func (client AppsClient) GetNetworkTracesSlotV2Preparer(ctx context.Context, resourceGroupName string, name string, operationID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTraces/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetNetworkTracesSlotV2Sender sends the GetNetworkTracesSlotV2 request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetNetworkTracesSlotV2Sender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetNetworkTracesSlotV2Responder handles the response to the GetNetworkTracesSlotV2 request. The method always +// closes the http.Response Body. +func (client AppsClient) GetNetworkTracesSlotV2Responder(resp *http.Response) (result ListNetworkTrace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetNetworkTracesV2 description for Gets a named operation for a network trace capturing (or deployment slot, if +// specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// operationID - GUID of the operation. +func (client AppsClient) GetNetworkTracesV2(ctx context.Context, resourceGroupName string, name string, operationID string) (result ListNetworkTrace, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetNetworkTracesV2") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetNetworkTracesV2", err.Error()) + } + + req, err := client.GetNetworkTracesV2Preparer(ctx, resourceGroupName, name, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTracesV2", nil, "Failure preparing request") + return + } + + resp, err := client.GetNetworkTracesV2Sender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTracesV2", resp, "Failure sending request") + return + } + + result, err = client.GetNetworkTracesV2Responder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetNetworkTracesV2", resp, "Failure responding to request") + return + } + + return +} + +// GetNetworkTracesV2Preparer prepares the GetNetworkTracesV2 request. +func (client AppsClient) GetNetworkTracesV2Preparer(ctx context.Context, resourceGroupName string, name string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTraces/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetNetworkTracesV2Sender sends the GetNetworkTracesV2 request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetNetworkTracesV2Sender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetNetworkTracesV2Responder handles the response to the GetNetworkTracesV2 request. The method always +// closes the http.Response Body. +func (client AppsClient) GetNetworkTracesV2Responder(resp *http.Response) (result ListNetworkTrace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPremierAddOn description for Gets a named add-on of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// premierAddOnName - add-on name. +func (client AppsClient) GetPremierAddOn(ctx context.Context, resourceGroupName string, name string, premierAddOnName string) (result PremierAddOn, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPremierAddOn") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetPremierAddOn", err.Error()) + } + + req, err := client.GetPremierAddOnPreparer(ctx, resourceGroupName, name, premierAddOnName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOn", nil, "Failure preparing request") + return + } + + resp, err := client.GetPremierAddOnSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOn", resp, "Failure sending request") + return + } + + result, err = client.GetPremierAddOnResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOn", resp, "Failure responding to request") + return + } + + return +} + +// GetPremierAddOnPreparer prepares the GetPremierAddOn request. +func (client AppsClient) GetPremierAddOnPreparer(ctx context.Context, resourceGroupName string, name string, premierAddOnName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPremierAddOnSender sends the GetPremierAddOn request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPremierAddOnSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPremierAddOnResponder handles the response to the GetPremierAddOn request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPremierAddOnResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPremierAddOnSlot description for Gets a named add-on of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// premierAddOnName - add-on name. +// slot - name of the deployment slot. If a slot is not specified, the API will get the named add-on for the +// production slot. +func (client AppsClient) GetPremierAddOnSlot(ctx context.Context, resourceGroupName string, name string, premierAddOnName string, slot string) (result PremierAddOn, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPremierAddOnSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetPremierAddOnSlot", err.Error()) + } + + req, err := client.GetPremierAddOnSlotPreparer(ctx, resourceGroupName, name, premierAddOnName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOnSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetPremierAddOnSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOnSlot", resp, "Failure sending request") + return + } + + result, err = client.GetPremierAddOnSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOnSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetPremierAddOnSlotPreparer prepares the GetPremierAddOnSlot request. +func (client AppsClient) GetPremierAddOnSlotPreparer(ctx context.Context, resourceGroupName string, name string, premierAddOnName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPremierAddOnSlotSender sends the GetPremierAddOnSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPremierAddOnSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPremierAddOnSlotResponder handles the response to the GetPremierAddOnSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPremierAddOnSlotResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPrivateAccess description for Gets data around private site access enablement and authorized Virtual Networks +// that can access the site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +func (client AppsClient) GetPrivateAccess(ctx context.Context, resourceGroupName string, name string) (result PrivateAccess, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPrivateAccess") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetPrivateAccess", err.Error()) + } + + req, err := client.GetPrivateAccessPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateAccess", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateAccessSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateAccess", resp, "Failure sending request") + return + } + + result, err = client.GetPrivateAccessResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateAccess", resp, "Failure responding to request") + return + } + + return +} + +// GetPrivateAccessPreparer prepares the GetPrivateAccess request. +func (client AppsClient) GetPrivateAccessPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateAccess/virtualNetworks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateAccessSender sends the GetPrivateAccess request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPrivateAccessSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateAccessResponder handles the response to the GetPrivateAccess request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPrivateAccessResponder(resp *http.Response) (result PrivateAccess, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPrivateAccessSlot description for Gets data around private site access enablement and authorized Virtual Networks +// that can access the site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// slot - the name of the slot for the web app. +func (client AppsClient) GetPrivateAccessSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result PrivateAccess, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPrivateAccessSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetPrivateAccessSlot", err.Error()) + } + + req, err := client.GetPrivateAccessSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateAccessSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateAccessSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateAccessSlot", resp, "Failure sending request") + return + } + + result, err = client.GetPrivateAccessSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateAccessSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetPrivateAccessSlotPreparer prepares the GetPrivateAccessSlot request. +func (client AppsClient) GetPrivateAccessSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateAccessSlotSender sends the GetPrivateAccessSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPrivateAccessSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateAccessSlotResponder handles the response to the GetPrivateAccessSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPrivateAccessSlotResponder(resp *http.Response) (result PrivateAccess, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPrivateEndpointConnection description for Gets a private endpoint connection +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the site. +// privateEndpointConnectionName - name of the private endpoint connection. +func (client AppsClient) GetPrivateEndpointConnection(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (result RemotePrivateEndpointConnectionARMResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPrivateEndpointConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetPrivateEndpointConnection", err.Error()) + } + + req, err := client.GetPrivateEndpointConnectionPreparer(ctx, resourceGroupName, name, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateEndpointConnection", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateEndpointConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateEndpointConnection", resp, "Failure sending request") + return + } + + result, err = client.GetPrivateEndpointConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateEndpointConnection", resp, "Failure responding to request") + return + } + + return +} + +// GetPrivateEndpointConnectionPreparer prepares the GetPrivateEndpointConnection request. +func (client AppsClient) GetPrivateEndpointConnectionPreparer(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateEndpointConnectionSender sends the GetPrivateEndpointConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPrivateEndpointConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateEndpointConnectionResponder handles the response to the GetPrivateEndpointConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPrivateEndpointConnectionResponder(resp *http.Response) (result RemotePrivateEndpointConnectionARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPrivateEndpointConnectionList description for Gets the list of private endpoint connections associated with a +// site +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the site. +func (client AppsClient) GetPrivateEndpointConnectionList(ctx context.Context, resourceGroupName string, name string) (result PrivateEndpointConnectionCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPrivateEndpointConnectionList") + defer func() { + sc := -1 + if result.pecc.Response.Response != nil { + sc = result.pecc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetPrivateEndpointConnectionList", err.Error()) + } + + result.fn = client.getPrivateEndpointConnectionListNextResults + req, err := client.GetPrivateEndpointConnectionListPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateEndpointConnectionList", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateEndpointConnectionListSender(req) + if err != nil { + result.pecc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateEndpointConnectionList", resp, "Failure sending request") + return + } + + result.pecc, err = client.GetPrivateEndpointConnectionListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateEndpointConnectionList", resp, "Failure responding to request") + return + } + if result.pecc.hasNextLink() && result.pecc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetPrivateEndpointConnectionListPreparer prepares the GetPrivateEndpointConnectionList request. +func (client AppsClient) GetPrivateEndpointConnectionListPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateEndpointConnectionListSender sends the GetPrivateEndpointConnectionList request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPrivateEndpointConnectionListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateEndpointConnectionListResponder handles the response to the GetPrivateEndpointConnectionList request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPrivateEndpointConnectionListResponder(resp *http.Response) (result PrivateEndpointConnectionCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getPrivateEndpointConnectionListNextResults retrieves the next set of results, if any. +func (client AppsClient) getPrivateEndpointConnectionListNextResults(ctx context.Context, lastResults PrivateEndpointConnectionCollection) (result PrivateEndpointConnectionCollection, err error) { + req, err := lastResults.privateEndpointConnectionCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "getPrivateEndpointConnectionListNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetPrivateEndpointConnectionListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "getPrivateEndpointConnectionListNextResults", resp, "Failure sending next results request") + } + result, err = client.GetPrivateEndpointConnectionListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "getPrivateEndpointConnectionListNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetPrivateEndpointConnectionListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) GetPrivateEndpointConnectionListComplete(ctx context.Context, resourceGroupName string, name string) (result PrivateEndpointConnectionCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPrivateEndpointConnectionList") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetPrivateEndpointConnectionList(ctx, resourceGroupName, name) + return +} + +// GetPrivateEndpointConnectionListSlot description for Gets the list of private endpoint connections associated with a +// site +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the site. +// slot - name of the site deployment slot. +func (client AppsClient) GetPrivateEndpointConnectionListSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result PrivateEndpointConnectionCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPrivateEndpointConnectionListSlot") + defer func() { + sc := -1 + if result.pecc.Response.Response != nil { + sc = result.pecc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetPrivateEndpointConnectionListSlot", err.Error()) + } + + result.fn = client.getPrivateEndpointConnectionListSlotNextResults + req, err := client.GetPrivateEndpointConnectionListSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateEndpointConnectionListSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateEndpointConnectionListSlotSender(req) + if err != nil { + result.pecc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateEndpointConnectionListSlot", resp, "Failure sending request") + return + } + + result.pecc, err = client.GetPrivateEndpointConnectionListSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateEndpointConnectionListSlot", resp, "Failure responding to request") + return + } + if result.pecc.hasNextLink() && result.pecc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetPrivateEndpointConnectionListSlotPreparer prepares the GetPrivateEndpointConnectionListSlot request. +func (client AppsClient) GetPrivateEndpointConnectionListSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateEndpointConnectionListSlotSender sends the GetPrivateEndpointConnectionListSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPrivateEndpointConnectionListSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateEndpointConnectionListSlotResponder handles the response to the GetPrivateEndpointConnectionListSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPrivateEndpointConnectionListSlotResponder(resp *http.Response) (result PrivateEndpointConnectionCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getPrivateEndpointConnectionListSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) getPrivateEndpointConnectionListSlotNextResults(ctx context.Context, lastResults PrivateEndpointConnectionCollection) (result PrivateEndpointConnectionCollection, err error) { + req, err := lastResults.privateEndpointConnectionCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "getPrivateEndpointConnectionListSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetPrivateEndpointConnectionListSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "getPrivateEndpointConnectionListSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.GetPrivateEndpointConnectionListSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "getPrivateEndpointConnectionListSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetPrivateEndpointConnectionListSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) GetPrivateEndpointConnectionListSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result PrivateEndpointConnectionCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPrivateEndpointConnectionListSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetPrivateEndpointConnectionListSlot(ctx, resourceGroupName, name, slot) + return +} + +// GetPrivateEndpointConnectionSlot description for Gets a private endpoint connection +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the site. +// privateEndpointConnectionName - name of the private endpoint connection. +// slot - name of the site deployment slot. +func (client AppsClient) GetPrivateEndpointConnectionSlot(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, slot string) (result RemotePrivateEndpointConnectionARMResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPrivateEndpointConnectionSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetPrivateEndpointConnectionSlot", err.Error()) + } + + req, err := client.GetPrivateEndpointConnectionSlotPreparer(ctx, resourceGroupName, name, privateEndpointConnectionName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateEndpointConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateEndpointConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateEndpointConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.GetPrivateEndpointConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateEndpointConnectionSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetPrivateEndpointConnectionSlotPreparer prepares the GetPrivateEndpointConnectionSlot request. +func (client AppsClient) GetPrivateEndpointConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateEndpointConnectionSlotSender sends the GetPrivateEndpointConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPrivateEndpointConnectionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateEndpointConnectionSlotResponder handles the response to the GetPrivateEndpointConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPrivateEndpointConnectionSlotResponder(resp *http.Response) (result RemotePrivateEndpointConnectionARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPrivateLinkResources description for Gets the private link resources +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the site. +func (client AppsClient) GetPrivateLinkResources(ctx context.Context, resourceGroupName string, name string) (result PrivateLinkResourcesWrapper, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPrivateLinkResources") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetPrivateLinkResources", err.Error()) + } + + req, err := client.GetPrivateLinkResourcesPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateLinkResources", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateLinkResourcesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateLinkResources", resp, "Failure sending request") + return + } + + result, err = client.GetPrivateLinkResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateLinkResources", resp, "Failure responding to request") + return + } + + return +} + +// GetPrivateLinkResourcesPreparer prepares the GetPrivateLinkResources request. +func (client AppsClient) GetPrivateLinkResourcesPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateLinkResourcesSender sends the GetPrivateLinkResources request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPrivateLinkResourcesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateLinkResourcesResponder handles the response to the GetPrivateLinkResources request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPrivateLinkResourcesResponder(resp *http.Response) (result PrivateLinkResourcesWrapper, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPrivateLinkResourcesSlot description for Gets the private link resources +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the site. +func (client AppsClient) GetPrivateLinkResourcesSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result PrivateLinkResourcesWrapper, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPrivateLinkResourcesSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetPrivateLinkResourcesSlot", err.Error()) + } + + req, err := client.GetPrivateLinkResourcesSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateLinkResourcesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateLinkResourcesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateLinkResourcesSlot", resp, "Failure sending request") + return + } + + result, err = client.GetPrivateLinkResourcesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPrivateLinkResourcesSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetPrivateLinkResourcesSlotPreparer prepares the GetPrivateLinkResourcesSlot request. +func (client AppsClient) GetPrivateLinkResourcesSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateLinkResourcesSlotSender sends the GetPrivateLinkResourcesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPrivateLinkResourcesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateLinkResourcesSlotResponder handles the response to the GetPrivateLinkResourcesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPrivateLinkResourcesSlotResponder(resp *http.Response) (result PrivateLinkResourcesWrapper, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetProcess description for Get process information by its ID for a specific scaled-out instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +func (client AppsClient) GetProcess(ctx context.Context, resourceGroupName string, name string, processID string) (result ProcessInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetProcess") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetProcess", err.Error()) + } + + req, err := client.GetProcessPreparer(ctx, resourceGroupName, name, processID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcess", nil, "Failure preparing request") + return + } + + resp, err := client.GetProcessSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcess", resp, "Failure sending request") + return + } + + result, err = client.GetProcessResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcess", resp, "Failure responding to request") + return + } + + return +} + +// GetProcessPreparer prepares the GetProcess request. +func (client AppsClient) GetProcessPreparer(ctx context.Context, resourceGroupName string, name string, processID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetProcessSender sends the GetProcess request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetProcessSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetProcessResponder handles the response to the GetProcess request. The method always +// closes the http.Response Body. +func (client AppsClient) GetProcessResponder(resp *http.Response) (result ProcessInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetProcessDump description for Get a memory dump of a process by its ID for a specific scaled-out instance in a web +// site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +func (client AppsClient) GetProcessDump(ctx context.Context, resourceGroupName string, name string, processID string) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetProcessDump") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetProcessDump", err.Error()) + } + + req, err := client.GetProcessDumpPreparer(ctx, resourceGroupName, name, processID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcessDump", nil, "Failure preparing request") + return + } + + resp, err := client.GetProcessDumpSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcessDump", resp, "Failure sending request") + return + } + + result, err = client.GetProcessDumpResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcessDump", resp, "Failure responding to request") + return + } + + return +} + +// GetProcessDumpPreparer prepares the GetProcessDump request. +func (client AppsClient) GetProcessDumpPreparer(ctx context.Context, resourceGroupName string, name string, processID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/dump", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetProcessDumpSender sends the GetProcessDump request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetProcessDumpSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetProcessDumpResponder handles the response to the GetProcessDump request. The method always +// closes the http.Response Body. +func (client AppsClient) GetProcessDumpResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// GetProcessDumpSlot description for Get a memory dump of a process by its ID for a specific scaled-out instance in a +// web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +func (client AppsClient) GetProcessDumpSlot(ctx context.Context, resourceGroupName string, name string, processID string, slot string) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetProcessDumpSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetProcessDumpSlot", err.Error()) + } + + req, err := client.GetProcessDumpSlotPreparer(ctx, resourceGroupName, name, processID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcessDumpSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetProcessDumpSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcessDumpSlot", resp, "Failure sending request") + return + } + + result, err = client.GetProcessDumpSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcessDumpSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetProcessDumpSlotPreparer prepares the GetProcessDumpSlot request. +func (client AppsClient) GetProcessDumpSlotPreparer(ctx context.Context, resourceGroupName string, name string, processID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/dump", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetProcessDumpSlotSender sends the GetProcessDumpSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetProcessDumpSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetProcessDumpSlotResponder handles the response to the GetProcessDumpSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetProcessDumpSlotResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// GetProcessModule description for Get process information by its ID for a specific scaled-out instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// baseAddress - module base address. +func (client AppsClient) GetProcessModule(ctx context.Context, resourceGroupName string, name string, processID string, baseAddress string) (result ProcessModuleInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetProcessModule") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetProcessModule", err.Error()) + } + + req, err := client.GetProcessModulePreparer(ctx, resourceGroupName, name, processID, baseAddress) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcessModule", nil, "Failure preparing request") + return + } + + resp, err := client.GetProcessModuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcessModule", resp, "Failure sending request") + return + } + + result, err = client.GetProcessModuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcessModule", resp, "Failure responding to request") + return + } + + return +} + +// GetProcessModulePreparer prepares the GetProcessModule request. +func (client AppsClient) GetProcessModulePreparer(ctx context.Context, resourceGroupName string, name string, processID string, baseAddress string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "baseAddress": autorest.Encode("path", baseAddress), + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules/{baseAddress}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetProcessModuleSender sends the GetProcessModule request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetProcessModuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetProcessModuleResponder handles the response to the GetProcessModule request. The method always +// closes the http.Response Body. +func (client AppsClient) GetProcessModuleResponder(resp *http.Response) (result ProcessModuleInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetProcessModuleSlot description for Get process information by its ID for a specific scaled-out instance in a web +// site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// baseAddress - module base address. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +func (client AppsClient) GetProcessModuleSlot(ctx context.Context, resourceGroupName string, name string, processID string, baseAddress string, slot string) (result ProcessModuleInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetProcessModuleSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetProcessModuleSlot", err.Error()) + } + + req, err := client.GetProcessModuleSlotPreparer(ctx, resourceGroupName, name, processID, baseAddress, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcessModuleSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetProcessModuleSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcessModuleSlot", resp, "Failure sending request") + return + } + + result, err = client.GetProcessModuleSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcessModuleSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetProcessModuleSlotPreparer prepares the GetProcessModuleSlot request. +func (client AppsClient) GetProcessModuleSlotPreparer(ctx context.Context, resourceGroupName string, name string, processID string, baseAddress string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "baseAddress": autorest.Encode("path", baseAddress), + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules/{baseAddress}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetProcessModuleSlotSender sends the GetProcessModuleSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetProcessModuleSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetProcessModuleSlotResponder handles the response to the GetProcessModuleSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetProcessModuleSlotResponder(resp *http.Response) (result ProcessModuleInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetProcessSlot description for Get process information by its ID for a specific scaled-out instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +func (client AppsClient) GetProcessSlot(ctx context.Context, resourceGroupName string, name string, processID string, slot string) (result ProcessInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetProcessSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetProcessSlot", err.Error()) + } + + req, err := client.GetProcessSlotPreparer(ctx, resourceGroupName, name, processID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcessSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetProcessSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcessSlot", resp, "Failure sending request") + return + } + + result, err = client.GetProcessSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetProcessSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetProcessSlotPreparer prepares the GetProcessSlot request. +func (client AppsClient) GetProcessSlotPreparer(ctx context.Context, resourceGroupName string, name string, processID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetProcessSlotSender sends the GetProcessSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetProcessSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetProcessSlotResponder handles the response to the GetProcessSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetProcessSlotResponder(resp *http.Response) (result ProcessInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPublicCertificate description for Get the named public certificate for an app (or deployment slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// publicCertificateName - public certificate name. +func (client AppsClient) GetPublicCertificate(ctx context.Context, resourceGroupName string, name string, publicCertificateName string) (result PublicCertificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPublicCertificate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetPublicCertificate", err.Error()) + } + + req, err := client.GetPublicCertificatePreparer(ctx, resourceGroupName, name, publicCertificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPublicCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.GetPublicCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPublicCertificate", resp, "Failure sending request") + return + } + + result, err = client.GetPublicCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPublicCertificate", resp, "Failure responding to request") + return + } + + return +} + +// GetPublicCertificatePreparer prepares the GetPublicCertificate request. +func (client AppsClient) GetPublicCertificatePreparer(ctx context.Context, resourceGroupName string, name string, publicCertificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "publicCertificateName": autorest.Encode("path", publicCertificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPublicCertificateSender sends the GetPublicCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPublicCertificateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPublicCertificateResponder handles the response to the GetPublicCertificate request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPublicCertificateResponder(resp *http.Response) (result PublicCertificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPublicCertificateSlot description for Get the named public certificate for an app (or deployment slot, if +// specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API the named binding for the production +// slot. +// publicCertificateName - public certificate name. +func (client AppsClient) GetPublicCertificateSlot(ctx context.Context, resourceGroupName string, name string, slot string, publicCertificateName string) (result PublicCertificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetPublicCertificateSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetPublicCertificateSlot", err.Error()) + } + + req, err := client.GetPublicCertificateSlotPreparer(ctx, resourceGroupName, name, slot, publicCertificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPublicCertificateSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetPublicCertificateSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPublicCertificateSlot", resp, "Failure sending request") + return + } + + result, err = client.GetPublicCertificateSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPublicCertificateSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetPublicCertificateSlotPreparer prepares the GetPublicCertificateSlot request. +func (client AppsClient) GetPublicCertificateSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, publicCertificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "publicCertificateName": autorest.Encode("path", publicCertificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPublicCertificateSlotSender sends the GetPublicCertificateSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPublicCertificateSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPublicCertificateSlotResponder handles the response to the GetPublicCertificateSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPublicCertificateSlotResponder(resp *http.Response) (result PublicCertificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRelayServiceConnection description for Gets a hybrid connection configuration by its name. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// entityName - name of the hybrid connection. +func (client AppsClient) GetRelayServiceConnection(ctx context.Context, resourceGroupName string, name string, entityName string) (result RelayServiceConnectionEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetRelayServiceConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetRelayServiceConnection", err.Error()) + } + + req, err := client.GetRelayServiceConnectionPreparer(ctx, resourceGroupName, name, entityName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnection", nil, "Failure preparing request") + return + } + + resp, err := client.GetRelayServiceConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnection", resp, "Failure sending request") + return + } + + result, err = client.GetRelayServiceConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnection", resp, "Failure responding to request") + return + } + + return +} + +// GetRelayServiceConnectionPreparer prepares the GetRelayServiceConnection request. +func (client AppsClient) GetRelayServiceConnectionPreparer(ctx context.Context, resourceGroupName string, name string, entityName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetRelayServiceConnectionSender sends the GetRelayServiceConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetRelayServiceConnectionResponder handles the response to the GetRelayServiceConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) GetRelayServiceConnectionResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRelayServiceConnectionSlot description for Gets a hybrid connection configuration by its name. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// entityName - name of the hybrid connection. +// slot - name of the deployment slot. If a slot is not specified, the API will get a hybrid connection for the +// production slot. +func (client AppsClient) GetRelayServiceConnectionSlot(ctx context.Context, resourceGroupName string, name string, entityName string, slot string) (result RelayServiceConnectionEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetRelayServiceConnectionSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetRelayServiceConnectionSlot", err.Error()) + } + + req, err := client.GetRelayServiceConnectionSlotPreparer(ctx, resourceGroupName, name, entityName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetRelayServiceConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.GetRelayServiceConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnectionSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetRelayServiceConnectionSlotPreparer prepares the GetRelayServiceConnectionSlot request. +func (client AppsClient) GetRelayServiceConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, entityName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetRelayServiceConnectionSlotSender sends the GetRelayServiceConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetRelayServiceConnectionSlotResponder handles the response to the GetRelayServiceConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetRelayServiceConnectionSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetScmAllowed description for Returns whether Scm basic auth is allowed on the site or not. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetScmAllowed(ctx context.Context, resourceGroupName string, name string) (result CsmPublishingCredentialsPoliciesEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetScmAllowed") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetScmAllowed", err.Error()) + } + + req, err := client.GetScmAllowedPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetScmAllowed", nil, "Failure preparing request") + return + } + + resp, err := client.GetScmAllowedSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetScmAllowed", resp, "Failure sending request") + return + } + + result, err = client.GetScmAllowedResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetScmAllowed", resp, "Failure responding to request") + return + } + + return +} + +// GetScmAllowedPreparer prepares the GetScmAllowed request. +func (client AppsClient) GetScmAllowedPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/scm", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetScmAllowedSender sends the GetScmAllowed request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetScmAllowedSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetScmAllowedResponder handles the response to the GetScmAllowed request. The method always +// closes the http.Response Body. +func (client AppsClient) GetScmAllowedResponder(resp *http.Response) (result CsmPublishingCredentialsPoliciesEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetScmAllowedSlot description for Returns whether Scm basic auth is allowed on the site or not. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetScmAllowedSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result CsmPublishingCredentialsPoliciesEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetScmAllowedSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetScmAllowedSlot", err.Error()) + } + + req, err := client.GetScmAllowedSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetScmAllowedSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetScmAllowedSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetScmAllowedSlot", resp, "Failure sending request") + return + } + + result, err = client.GetScmAllowedSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetScmAllowedSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetScmAllowedSlotPreparer prepares the GetScmAllowedSlot request. +func (client AppsClient) GetScmAllowedSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/basicPublishingCredentialsPolicies/scm", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetScmAllowedSlotSender sends the GetScmAllowedSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetScmAllowedSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetScmAllowedSlotResponder handles the response to the GetScmAllowedSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetScmAllowedSlotResponder(resp *http.Response) (result CsmPublishingCredentialsPoliciesEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSiteConnectionStringKeyVaultReference description for Gets the config reference and status of an app +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetSiteConnectionStringKeyVaultReference(ctx context.Context, resourceGroupName string, name string, connectionStringKey string) (result APIKVReference, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSiteConnectionStringKeyVaultReference") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetSiteConnectionStringKeyVaultReference", err.Error()) + } + + req, err := client.GetSiteConnectionStringKeyVaultReferencePreparer(ctx, resourceGroupName, name, connectionStringKey) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteConnectionStringKeyVaultReference", nil, "Failure preparing request") + return + } + + resp, err := client.GetSiteConnectionStringKeyVaultReferenceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteConnectionStringKeyVaultReference", resp, "Failure sending request") + return + } + + result, err = client.GetSiteConnectionStringKeyVaultReferenceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteConnectionStringKeyVaultReference", resp, "Failure responding to request") + return + } + + return +} + +// GetSiteConnectionStringKeyVaultReferencePreparer prepares the GetSiteConnectionStringKeyVaultReference request. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferencePreparer(ctx context.Context, resourceGroupName string, name string, connectionStringKey string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionStringKey": autorest.Encode("path", connectionStringKey), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/connectionstrings/{connectionStringKey}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSiteConnectionStringKeyVaultReferenceSender sends the GetSiteConnectionStringKeyVaultReference request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferenceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSiteConnectionStringKeyVaultReferenceResponder handles the response to the GetSiteConnectionStringKeyVaultReference request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferenceResponder(resp *http.Response) (result APIKVReference, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSiteConnectionStringKeyVaultReferences description for Gets the config reference app settings and status of an +// app +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferences(ctx context.Context, resourceGroupName string, name string) (result APIKVReferenceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSiteConnectionStringKeyVaultReferences") + defer func() { + sc := -1 + if result.arc.Response.Response != nil { + sc = result.arc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetSiteConnectionStringKeyVaultReferences", err.Error()) + } + + result.fn = client.getSiteConnectionStringKeyVaultReferencesNextResults + req, err := client.GetSiteConnectionStringKeyVaultReferencesPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteConnectionStringKeyVaultReferences", nil, "Failure preparing request") + return + } + + resp, err := client.GetSiteConnectionStringKeyVaultReferencesSender(req) + if err != nil { + result.arc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteConnectionStringKeyVaultReferences", resp, "Failure sending request") + return + } + + result.arc, err = client.GetSiteConnectionStringKeyVaultReferencesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteConnectionStringKeyVaultReferences", resp, "Failure responding to request") + return + } + if result.arc.hasNextLink() && result.arc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetSiteConnectionStringKeyVaultReferencesPreparer prepares the GetSiteConnectionStringKeyVaultReferences request. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferencesPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/connectionstrings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSiteConnectionStringKeyVaultReferencesSender sends the GetSiteConnectionStringKeyVaultReferences request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferencesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSiteConnectionStringKeyVaultReferencesResponder handles the response to the GetSiteConnectionStringKeyVaultReferences request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferencesResponder(resp *http.Response) (result APIKVReferenceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getSiteConnectionStringKeyVaultReferencesNextResults retrieves the next set of results, if any. +func (client AppsClient) getSiteConnectionStringKeyVaultReferencesNextResults(ctx context.Context, lastResults APIKVReferenceCollection) (result APIKVReferenceCollection, err error) { + req, err := lastResults.aPIKVReferenceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "getSiteConnectionStringKeyVaultReferencesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetSiteConnectionStringKeyVaultReferencesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "getSiteConnectionStringKeyVaultReferencesNextResults", resp, "Failure sending next results request") + } + result, err = client.GetSiteConnectionStringKeyVaultReferencesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "getSiteConnectionStringKeyVaultReferencesNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetSiteConnectionStringKeyVaultReferencesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferencesComplete(ctx context.Context, resourceGroupName string, name string) (result APIKVReferenceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSiteConnectionStringKeyVaultReferences") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetSiteConnectionStringKeyVaultReferences(ctx, resourceGroupName, name) + return +} + +// GetSiteConnectionStringKeyVaultReferenceSlot description for Gets the config reference and status of an app +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferenceSlot(ctx context.Context, resourceGroupName string, name string, connectionStringKey string, slot string) (result APIKVReference, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSiteConnectionStringKeyVaultReferenceSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetSiteConnectionStringKeyVaultReferenceSlot", err.Error()) + } + + req, err := client.GetSiteConnectionStringKeyVaultReferenceSlotPreparer(ctx, resourceGroupName, name, connectionStringKey, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteConnectionStringKeyVaultReferenceSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetSiteConnectionStringKeyVaultReferenceSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteConnectionStringKeyVaultReferenceSlot", resp, "Failure sending request") + return + } + + result, err = client.GetSiteConnectionStringKeyVaultReferenceSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteConnectionStringKeyVaultReferenceSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetSiteConnectionStringKeyVaultReferenceSlotPreparer prepares the GetSiteConnectionStringKeyVaultReferenceSlot request. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferenceSlotPreparer(ctx context.Context, resourceGroupName string, name string, connectionStringKey string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionStringKey": autorest.Encode("path", connectionStringKey), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/connectionstrings/{connectionStringKey}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSiteConnectionStringKeyVaultReferenceSlotSender sends the GetSiteConnectionStringKeyVaultReferenceSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferenceSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSiteConnectionStringKeyVaultReferenceSlotResponder handles the response to the GetSiteConnectionStringKeyVaultReferenceSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferenceSlotResponder(resp *http.Response) (result APIKVReference, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSiteConnectionStringKeyVaultReferencesSlot description for Gets the config reference app settings and status of +// an app +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferencesSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result APIKVReferenceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSiteConnectionStringKeyVaultReferencesSlot") + defer func() { + sc := -1 + if result.arc.Response.Response != nil { + sc = result.arc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetSiteConnectionStringKeyVaultReferencesSlot", err.Error()) + } + + result.fn = client.getSiteConnectionStringKeyVaultReferencesSlotNextResults + req, err := client.GetSiteConnectionStringKeyVaultReferencesSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteConnectionStringKeyVaultReferencesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetSiteConnectionStringKeyVaultReferencesSlotSender(req) + if err != nil { + result.arc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteConnectionStringKeyVaultReferencesSlot", resp, "Failure sending request") + return + } + + result.arc, err = client.GetSiteConnectionStringKeyVaultReferencesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteConnectionStringKeyVaultReferencesSlot", resp, "Failure responding to request") + return + } + if result.arc.hasNextLink() && result.arc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetSiteConnectionStringKeyVaultReferencesSlotPreparer prepares the GetSiteConnectionStringKeyVaultReferencesSlot request. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferencesSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/connectionstrings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSiteConnectionStringKeyVaultReferencesSlotSender sends the GetSiteConnectionStringKeyVaultReferencesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferencesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSiteConnectionStringKeyVaultReferencesSlotResponder handles the response to the GetSiteConnectionStringKeyVaultReferencesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferencesSlotResponder(resp *http.Response) (result APIKVReferenceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getSiteConnectionStringKeyVaultReferencesSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) getSiteConnectionStringKeyVaultReferencesSlotNextResults(ctx context.Context, lastResults APIKVReferenceCollection) (result APIKVReferenceCollection, err error) { + req, err := lastResults.aPIKVReferenceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "getSiteConnectionStringKeyVaultReferencesSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetSiteConnectionStringKeyVaultReferencesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "getSiteConnectionStringKeyVaultReferencesSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.GetSiteConnectionStringKeyVaultReferencesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "getSiteConnectionStringKeyVaultReferencesSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetSiteConnectionStringKeyVaultReferencesSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) GetSiteConnectionStringKeyVaultReferencesSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result APIKVReferenceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSiteConnectionStringKeyVaultReferencesSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetSiteConnectionStringKeyVaultReferencesSlot(ctx, resourceGroupName, name, slot) + return +} + +// GetSiteExtension description for Get site extension information by its ID for a web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// siteExtensionID - site extension name. +func (client AppsClient) GetSiteExtension(ctx context.Context, resourceGroupName string, name string, siteExtensionID string) (result SiteExtensionInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSiteExtension") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetSiteExtension", err.Error()) + } + + req, err := client.GetSiteExtensionPreparer(ctx, resourceGroupName, name, siteExtensionID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteExtension", nil, "Failure preparing request") + return + } + + resp, err := client.GetSiteExtensionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteExtension", resp, "Failure sending request") + return + } + + result, err = client.GetSiteExtensionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteExtension", resp, "Failure responding to request") + return + } + + return +} + +// GetSiteExtensionPreparer prepares the GetSiteExtension request. +func (client AppsClient) GetSiteExtensionPreparer(ctx context.Context, resourceGroupName string, name string, siteExtensionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteExtensionId": autorest.Encode("path", siteExtensionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSiteExtensionSender sends the GetSiteExtension request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSiteExtensionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSiteExtensionResponder handles the response to the GetSiteExtension request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSiteExtensionResponder(resp *http.Response) (result SiteExtensionInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSiteExtensionSlot description for Get site extension information by its ID for a web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// siteExtensionID - site extension name. +// slot - name of the deployment slot. If a slot is not specified, the API uses the production slot. +func (client AppsClient) GetSiteExtensionSlot(ctx context.Context, resourceGroupName string, name string, siteExtensionID string, slot string) (result SiteExtensionInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSiteExtensionSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetSiteExtensionSlot", err.Error()) + } + + req, err := client.GetSiteExtensionSlotPreparer(ctx, resourceGroupName, name, siteExtensionID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteExtensionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetSiteExtensionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteExtensionSlot", resp, "Failure sending request") + return + } + + result, err = client.GetSiteExtensionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSiteExtensionSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetSiteExtensionSlotPreparer prepares the GetSiteExtensionSlot request. +func (client AppsClient) GetSiteExtensionSlotPreparer(ctx context.Context, resourceGroupName string, name string, siteExtensionID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteExtensionId": autorest.Encode("path", siteExtensionID), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSiteExtensionSlotSender sends the GetSiteExtensionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSiteExtensionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSiteExtensionSlotResponder handles the response to the GetSiteExtensionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSiteExtensionSlotResponder(resp *http.Response) (result SiteExtensionInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSitePhpErrorLogFlag description for Gets web app's event logs. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +func (client AppsClient) GetSitePhpErrorLogFlag(ctx context.Context, resourceGroupName string, name string) (result SitePhpErrorLogFlag, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSitePhpErrorLogFlag") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetSitePhpErrorLogFlag", err.Error()) + } + + req, err := client.GetSitePhpErrorLogFlagPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlag", nil, "Failure preparing request") + return + } + + resp, err := client.GetSitePhpErrorLogFlagSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlag", resp, "Failure sending request") + return + } + + result, err = client.GetSitePhpErrorLogFlagResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlag", resp, "Failure responding to request") + return + } + + return +} + +// GetSitePhpErrorLogFlagPreparer prepares the GetSitePhpErrorLogFlag request. +func (client AppsClient) GetSitePhpErrorLogFlagPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/phplogging", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSitePhpErrorLogFlagSender sends the GetSitePhpErrorLogFlag request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSitePhpErrorLogFlagSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSitePhpErrorLogFlagResponder handles the response to the GetSitePhpErrorLogFlag request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSitePhpErrorLogFlagResponder(resp *http.Response) (result SitePhpErrorLogFlag, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSitePhpErrorLogFlagSlot description for Gets web app's event logs. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of web app slot. If not specified then will default to production slot. +func (client AppsClient) GetSitePhpErrorLogFlagSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result SitePhpErrorLogFlag, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSitePhpErrorLogFlagSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetSitePhpErrorLogFlagSlot", err.Error()) + } + + req, err := client.GetSitePhpErrorLogFlagSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlagSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetSitePhpErrorLogFlagSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlagSlot", resp, "Failure sending request") + return + } + + result, err = client.GetSitePhpErrorLogFlagSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlagSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetSitePhpErrorLogFlagSlotPreparer prepares the GetSitePhpErrorLogFlagSlot request. +func (client AppsClient) GetSitePhpErrorLogFlagSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/phplogging", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSitePhpErrorLogFlagSlotSender sends the GetSitePhpErrorLogFlagSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSitePhpErrorLogFlagSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSitePhpErrorLogFlagSlotResponder handles the response to the GetSitePhpErrorLogFlagSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSitePhpErrorLogFlagSlotResponder(resp *http.Response) (result SitePhpErrorLogFlag, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSlot description for Gets the details of a web, mobile, or API app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. By default, this API returns the production slot. +func (client AppsClient) GetSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result Site, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetSlot", err.Error()) + } + + req, err := client.GetSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSlot", resp, "Failure sending request") + return + } + + result, err = client.GetSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetSlotPreparer prepares the GetSlot request. +func (client AppsClient) GetSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSlotSender sends the GetSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSlotResponder handles the response to the GetSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSlotResponder(resp *http.Response) (result Site, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSourceControl description for Gets the source control configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetSourceControl(ctx context.Context, resourceGroupName string, name string) (result SiteSourceControl, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSourceControl") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetSourceControl", err.Error()) + } + + req, err := client.GetSourceControlPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControl", nil, "Failure preparing request") + return + } + + resp, err := client.GetSourceControlSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControl", resp, "Failure sending request") + return + } + + result, err = client.GetSourceControlResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControl", resp, "Failure responding to request") + return + } + + return +} + +// GetSourceControlPreparer prepares the GetSourceControl request. +func (client AppsClient) GetSourceControlPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSourceControlSender sends the GetSourceControl request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSourceControlSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSourceControlResponder handles the response to the GetSourceControl request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSourceControlResponder(resp *http.Response) (result SiteSourceControl, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSourceControlSlot description for Gets the source control configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get the source control +// configuration for the production slot. +func (client AppsClient) GetSourceControlSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result SiteSourceControl, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSourceControlSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetSourceControlSlot", err.Error()) + } + + req, err := client.GetSourceControlSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControlSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetSourceControlSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControlSlot", resp, "Failure sending request") + return + } + + result, err = client.GetSourceControlSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControlSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetSourceControlSlotPreparer prepares the GetSourceControlSlot request. +func (client AppsClient) GetSourceControlSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSourceControlSlotSender sends the GetSourceControlSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSourceControlSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSourceControlSlotResponder handles the response to the GetSourceControlSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSourceControlSlotResponder(resp *http.Response) (result SiteSourceControl, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSwiftVirtualNetworkConnection description for Gets a Swift Virtual Network connection. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) GetSwiftVirtualNetworkConnection(ctx context.Context, resourceGroupName string, name string) (result SwiftVirtualNetwork, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSwiftVirtualNetworkConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetSwiftVirtualNetworkConnection", err.Error()) + } + + req, err := client.GetSwiftVirtualNetworkConnectionPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSwiftVirtualNetworkConnection", nil, "Failure preparing request") + return + } + + resp, err := client.GetSwiftVirtualNetworkConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSwiftVirtualNetworkConnection", resp, "Failure sending request") + return + } + + result, err = client.GetSwiftVirtualNetworkConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSwiftVirtualNetworkConnection", resp, "Failure responding to request") + return + } + + return +} + +// GetSwiftVirtualNetworkConnectionPreparer prepares the GetSwiftVirtualNetworkConnection request. +func (client AppsClient) GetSwiftVirtualNetworkConnectionPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSwiftVirtualNetworkConnectionSender sends the GetSwiftVirtualNetworkConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSwiftVirtualNetworkConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSwiftVirtualNetworkConnectionResponder handles the response to the GetSwiftVirtualNetworkConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSwiftVirtualNetworkConnectionResponder(resp *http.Response) (result SwiftVirtualNetwork, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSwiftVirtualNetworkConnectionSlot description for Gets a Swift Virtual Network connection. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get a gateway for the +// production slot's Virtual Network. +func (client AppsClient) GetSwiftVirtualNetworkConnectionSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result SwiftVirtualNetwork, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetSwiftVirtualNetworkConnectionSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetSwiftVirtualNetworkConnectionSlot", err.Error()) + } + + req, err := client.GetSwiftVirtualNetworkConnectionSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSwiftVirtualNetworkConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetSwiftVirtualNetworkConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSwiftVirtualNetworkConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.GetSwiftVirtualNetworkConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSwiftVirtualNetworkConnectionSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetSwiftVirtualNetworkConnectionSlotPreparer prepares the GetSwiftVirtualNetworkConnectionSlot request. +func (client AppsClient) GetSwiftVirtualNetworkConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSwiftVirtualNetworkConnectionSlotSender sends the GetSwiftVirtualNetworkConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSwiftVirtualNetworkConnectionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSwiftVirtualNetworkConnectionSlotResponder handles the response to the GetSwiftVirtualNetworkConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSwiftVirtualNetworkConnectionSlotResponder(resp *http.Response) (result SwiftVirtualNetwork, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTriggeredWebJob description for Gets a triggered web job by its ID for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +func (client AppsClient) GetTriggeredWebJob(ctx context.Context, resourceGroupName string, name string, webJobName string) (result TriggeredWebJob, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetTriggeredWebJob") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetTriggeredWebJob", err.Error()) + } + + req, err := client.GetTriggeredWebJobPreparer(ctx, resourceGroupName, name, webJobName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetTriggeredWebJob", nil, "Failure preparing request") + return + } + + resp, err := client.GetTriggeredWebJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetTriggeredWebJob", resp, "Failure sending request") + return + } + + result, err = client.GetTriggeredWebJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetTriggeredWebJob", resp, "Failure responding to request") + return + } + + return +} + +// GetTriggeredWebJobPreparer prepares the GetTriggeredWebJob request. +func (client AppsClient) GetTriggeredWebJobPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetTriggeredWebJobSender sends the GetTriggeredWebJob request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetTriggeredWebJobSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetTriggeredWebJobResponder handles the response to the GetTriggeredWebJob request. The method always +// closes the http.Response Body. +func (client AppsClient) GetTriggeredWebJobResponder(resp *http.Response) (result TriggeredWebJob, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTriggeredWebJobHistory description for Gets a triggered web job's history by its ID for an app, , or a deployment +// slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +// ID - history ID. +func (client AppsClient) GetTriggeredWebJobHistory(ctx context.Context, resourceGroupName string, name string, webJobName string, ID string) (result TriggeredJobHistory, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetTriggeredWebJobHistory") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetTriggeredWebJobHistory", err.Error()) + } + + req, err := client.GetTriggeredWebJobHistoryPreparer(ctx, resourceGroupName, name, webJobName, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetTriggeredWebJobHistory", nil, "Failure preparing request") + return + } + + resp, err := client.GetTriggeredWebJobHistorySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetTriggeredWebJobHistory", resp, "Failure sending request") + return + } + + result, err = client.GetTriggeredWebJobHistoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetTriggeredWebJobHistory", resp, "Failure responding to request") + return + } + + return +} + +// GetTriggeredWebJobHistoryPreparer prepares the GetTriggeredWebJobHistory request. +func (client AppsClient) GetTriggeredWebJobHistoryPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetTriggeredWebJobHistorySender sends the GetTriggeredWebJobHistory request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetTriggeredWebJobHistorySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetTriggeredWebJobHistoryResponder handles the response to the GetTriggeredWebJobHistory request. The method always +// closes the http.Response Body. +func (client AppsClient) GetTriggeredWebJobHistoryResponder(resp *http.Response) (result TriggeredJobHistory, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTriggeredWebJobHistorySlot description for Gets a triggered web job's history by its ID for an app, , or a +// deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +// ID - history ID. +// slot - name of the deployment slot. If a slot is not specified, the API uses the production slot. +func (client AppsClient) GetTriggeredWebJobHistorySlot(ctx context.Context, resourceGroupName string, name string, webJobName string, ID string, slot string) (result TriggeredJobHistory, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetTriggeredWebJobHistorySlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetTriggeredWebJobHistorySlot", err.Error()) + } + + req, err := client.GetTriggeredWebJobHistorySlotPreparer(ctx, resourceGroupName, name, webJobName, ID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetTriggeredWebJobHistorySlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetTriggeredWebJobHistorySlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetTriggeredWebJobHistorySlot", resp, "Failure sending request") + return + } + + result, err = client.GetTriggeredWebJobHistorySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetTriggeredWebJobHistorySlot", resp, "Failure responding to request") + return + } + + return +} + +// GetTriggeredWebJobHistorySlotPreparer prepares the GetTriggeredWebJobHistorySlot request. +func (client AppsClient) GetTriggeredWebJobHistorySlotPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string, ID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetTriggeredWebJobHistorySlotSender sends the GetTriggeredWebJobHistorySlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetTriggeredWebJobHistorySlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetTriggeredWebJobHistorySlotResponder handles the response to the GetTriggeredWebJobHistorySlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetTriggeredWebJobHistorySlotResponder(resp *http.Response) (result TriggeredJobHistory, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTriggeredWebJobSlot description for Gets a triggered web job by its ID for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +// slot - name of the deployment slot. If a slot is not specified, the API uses the production slot. +func (client AppsClient) GetTriggeredWebJobSlot(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (result TriggeredWebJob, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetTriggeredWebJobSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetTriggeredWebJobSlot", err.Error()) + } + + req, err := client.GetTriggeredWebJobSlotPreparer(ctx, resourceGroupName, name, webJobName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetTriggeredWebJobSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetTriggeredWebJobSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetTriggeredWebJobSlot", resp, "Failure sending request") + return + } + + result, err = client.GetTriggeredWebJobSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetTriggeredWebJobSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetTriggeredWebJobSlotPreparer prepares the GetTriggeredWebJobSlot request. +func (client AppsClient) GetTriggeredWebJobSlotPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetTriggeredWebJobSlotSender sends the GetTriggeredWebJobSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetTriggeredWebJobSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetTriggeredWebJobSlotResponder handles the response to the GetTriggeredWebJobSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetTriggeredWebJobSlotResponder(resp *http.Response) (result TriggeredWebJob, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetConnection description for Gets a virtual network the app (or deployment slot) is connected to by name. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// vnetName - name of the virtual network. +func (client AppsClient) GetVnetConnection(ctx context.Context, resourceGroupName string, name string, vnetName string) (result VnetInfoResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetVnetConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetVnetConnection", err.Error()) + } + + req, err := client.GetVnetConnectionPreparer(ctx, resourceGroupName, name, vnetName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnection", nil, "Failure preparing request") + return + } + + resp, err := client.GetVnetConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnection", resp, "Failure sending request") + return + } + + result, err = client.GetVnetConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnection", resp, "Failure responding to request") + return + } + + return +} + +// GetVnetConnectionPreparer prepares the GetVnetConnection request. +func (client AppsClient) GetVnetConnectionPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVnetConnectionSender sends the GetVnetConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetVnetConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetVnetConnectionResponder handles the response to the GetVnetConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) GetVnetConnectionResponder(resp *http.Response) (result VnetInfoResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetConnectionGateway description for Gets an app's Virtual Network gateway. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// vnetName - name of the Virtual Network. +// gatewayName - name of the gateway. Currently, the only supported string is "primary". +func (client AppsClient) GetVnetConnectionGateway(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string) (result VnetGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetVnetConnectionGateway") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetVnetConnectionGateway", err.Error()) + } + + req, err := client.GetVnetConnectionGatewayPreparer(ctx, resourceGroupName, name, vnetName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGateway", nil, "Failure preparing request") + return + } + + resp, err := client.GetVnetConnectionGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGateway", resp, "Failure sending request") + return + } + + result, err = client.GetVnetConnectionGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGateway", resp, "Failure responding to request") + return + } + + return +} + +// GetVnetConnectionGatewayPreparer prepares the GetVnetConnectionGateway request. +func (client AppsClient) GetVnetConnectionGatewayPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVnetConnectionGatewaySender sends the GetVnetConnectionGateway request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetVnetConnectionGatewaySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetVnetConnectionGatewayResponder handles the response to the GetVnetConnectionGateway request. The method always +// closes the http.Response Body. +func (client AppsClient) GetVnetConnectionGatewayResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetConnectionGatewaySlot description for Gets an app's Virtual Network gateway. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// vnetName - name of the Virtual Network. +// gatewayName - name of the gateway. Currently, the only supported string is "primary". +// slot - name of the deployment slot. If a slot is not specified, the API will get a gateway for the +// production slot's Virtual Network. +func (client AppsClient) GetVnetConnectionGatewaySlot(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string, slot string) (result VnetGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetVnetConnectionGatewaySlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetVnetConnectionGatewaySlot", err.Error()) + } + + req, err := client.GetVnetConnectionGatewaySlotPreparer(ctx, resourceGroupName, name, vnetName, gatewayName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGatewaySlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetVnetConnectionGatewaySlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGatewaySlot", resp, "Failure sending request") + return + } + + result, err = client.GetVnetConnectionGatewaySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGatewaySlot", resp, "Failure responding to request") + return + } + + return +} + +// GetVnetConnectionGatewaySlotPreparer prepares the GetVnetConnectionGatewaySlot request. +func (client AppsClient) GetVnetConnectionGatewaySlotPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVnetConnectionGatewaySlotSender sends the GetVnetConnectionGatewaySlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetVnetConnectionGatewaySlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetVnetConnectionGatewaySlotResponder handles the response to the GetVnetConnectionGatewaySlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetVnetConnectionGatewaySlotResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetConnectionSlot description for Gets a virtual network the app (or deployment slot) is connected to by name. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// vnetName - name of the virtual network. +// slot - name of the deployment slot. If a slot is not specified, the API will get the named virtual network +// for the production slot. +func (client AppsClient) GetVnetConnectionSlot(ctx context.Context, resourceGroupName string, name string, vnetName string, slot string) (result VnetInfoResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetVnetConnectionSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetVnetConnectionSlot", err.Error()) + } + + req, err := client.GetVnetConnectionSlotPreparer(ctx, resourceGroupName, name, vnetName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetVnetConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.GetVnetConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetVnetConnectionSlotPreparer prepares the GetVnetConnectionSlot request. +func (client AppsClient) GetVnetConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVnetConnectionSlotSender sends the GetVnetConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetVnetConnectionSlotResponder handles the response to the GetVnetConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetVnetConnectionSlotResponder(resp *http.Response) (result VnetInfoResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetWebJob description for Get webjob information for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of the web job. +func (client AppsClient) GetWebJob(ctx context.Context, resourceGroupName string, name string, webJobName string) (result Job, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetWebJob") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetWebJob", err.Error()) + } + + req, err := client.GetWebJobPreparer(ctx, resourceGroupName, name, webJobName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetWebJob", nil, "Failure preparing request") + return + } + + resp, err := client.GetWebJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetWebJob", resp, "Failure sending request") + return + } + + result, err = client.GetWebJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetWebJob", resp, "Failure responding to request") + return + } + + return +} + +// GetWebJobPreparer prepares the GetWebJob request. +func (client AppsClient) GetWebJobPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetWebJobSender sends the GetWebJob request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetWebJobSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetWebJobResponder handles the response to the GetWebJob request. The method always +// closes the http.Response Body. +func (client AppsClient) GetWebJobResponder(resp *http.Response) (result Job, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetWebJobSlot description for Get webjob information for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of the web job. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +func (client AppsClient) GetWebJobSlot(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (result Job, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetWebJobSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetWebJobSlot", err.Error()) + } + + req, err := client.GetWebJobSlotPreparer(ctx, resourceGroupName, name, webJobName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetWebJobSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetWebJobSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetWebJobSlot", resp, "Failure sending request") + return + } + + result, err = client.GetWebJobSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetWebJobSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetWebJobSlotPreparer prepares the GetWebJobSlot request. +func (client AppsClient) GetWebJobSlotPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetWebJobSlotSender sends the GetWebJobSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetWebJobSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetWebJobSlotResponder handles the response to the GetWebJobSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetWebJobSlotResponder(resp *http.Response) (result Job, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetWebSiteContainerLogs description for Gets the last lines of docker logs for the given site +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +func (client AppsClient) GetWebSiteContainerLogs(ctx context.Context, resourceGroupName string, name string) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetWebSiteContainerLogs") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetWebSiteContainerLogs", err.Error()) + } + + req, err := client.GetWebSiteContainerLogsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetWebSiteContainerLogs", nil, "Failure preparing request") + return + } + + resp, err := client.GetWebSiteContainerLogsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetWebSiteContainerLogs", resp, "Failure sending request") + return + } + + result, err = client.GetWebSiteContainerLogsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetWebSiteContainerLogs", resp, "Failure responding to request") + return + } + + return +} + +// GetWebSiteContainerLogsPreparer prepares the GetWebSiteContainerLogs request. +func (client AppsClient) GetWebSiteContainerLogsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/containerlogs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetWebSiteContainerLogsSender sends the GetWebSiteContainerLogs request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetWebSiteContainerLogsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetWebSiteContainerLogsResponder handles the response to the GetWebSiteContainerLogs request. The method always +// closes the http.Response Body. +func (client AppsClient) GetWebSiteContainerLogsResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent)) + result.Response = autorest.Response{Response: resp} + return +} + +// GetWebSiteContainerLogsSlot description for Gets the last lines of docker logs for the given site +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of web app slot. If not specified then will default to production slot. +func (client AppsClient) GetWebSiteContainerLogsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetWebSiteContainerLogsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "GetWebSiteContainerLogsSlot", err.Error()) + } + + req, err := client.GetWebSiteContainerLogsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetWebSiteContainerLogsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetWebSiteContainerLogsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetWebSiteContainerLogsSlot", resp, "Failure sending request") + return + } + + result, err = client.GetWebSiteContainerLogsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetWebSiteContainerLogsSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetWebSiteContainerLogsSlotPreparer prepares the GetWebSiteContainerLogsSlot request. +func (client AppsClient) GetWebSiteContainerLogsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/containerlogs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetWebSiteContainerLogsSlotSender sends the GetWebSiteContainerLogsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetWebSiteContainerLogsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetWebSiteContainerLogsSlotResponder handles the response to the GetWebSiteContainerLogsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetWebSiteContainerLogsSlotResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent)) + result.Response = autorest.Response{Response: resp} + return +} + +// InstallSiteExtension description for Install site extension on a web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// siteExtensionID - site extension name. +func (client AppsClient) InstallSiteExtension(ctx context.Context, resourceGroupName string, name string, siteExtensionID string) (result AppsInstallSiteExtensionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.InstallSiteExtension") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "InstallSiteExtension", err.Error()) + } + + req, err := client.InstallSiteExtensionPreparer(ctx, resourceGroupName, name, siteExtensionID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "InstallSiteExtension", nil, "Failure preparing request") + return + } + + result, err = client.InstallSiteExtensionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "InstallSiteExtension", result.Response(), "Failure sending request") + return + } + + return +} + +// InstallSiteExtensionPreparer prepares the InstallSiteExtension request. +func (client AppsClient) InstallSiteExtensionPreparer(ctx context.Context, resourceGroupName string, name string, siteExtensionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteExtensionId": autorest.Encode("path", siteExtensionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// InstallSiteExtensionSender sends the InstallSiteExtension request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) InstallSiteExtensionSender(req *http.Request) (future AppsInstallSiteExtensionFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// InstallSiteExtensionResponder handles the response to the InstallSiteExtension request. The method always +// closes the http.Response Body. +func (client AppsClient) InstallSiteExtensionResponder(resp *http.Response) (result SiteExtensionInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// InstallSiteExtensionSlot description for Install site extension on a web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// siteExtensionID - site extension name. +// slot - name of the deployment slot. If a slot is not specified, the API uses the production slot. +func (client AppsClient) InstallSiteExtensionSlot(ctx context.Context, resourceGroupName string, name string, siteExtensionID string, slot string) (result AppsInstallSiteExtensionSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.InstallSiteExtensionSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "InstallSiteExtensionSlot", err.Error()) + } + + req, err := client.InstallSiteExtensionSlotPreparer(ctx, resourceGroupName, name, siteExtensionID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "InstallSiteExtensionSlot", nil, "Failure preparing request") + return + } + + result, err = client.InstallSiteExtensionSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "InstallSiteExtensionSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// InstallSiteExtensionSlotPreparer prepares the InstallSiteExtensionSlot request. +func (client AppsClient) InstallSiteExtensionSlotPreparer(ctx context.Context, resourceGroupName string, name string, siteExtensionID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteExtensionId": autorest.Encode("path", siteExtensionID), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// InstallSiteExtensionSlotSender sends the InstallSiteExtensionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) InstallSiteExtensionSlotSender(req *http.Request) (future AppsInstallSiteExtensionSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// InstallSiteExtensionSlotResponder handles the response to the InstallSiteExtensionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) InstallSiteExtensionSlotResponder(resp *http.Response) (result SiteExtensionInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// IsCloneable description for Shows whether an app can be cloned to another resource group or subscription. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) IsCloneable(ctx context.Context, resourceGroupName string, name string) (result SiteCloneability, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.IsCloneable") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "IsCloneable", err.Error()) + } + + req, err := client.IsCloneablePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneable", nil, "Failure preparing request") + return + } + + resp, err := client.IsCloneableSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneable", resp, "Failure sending request") + return + } + + result, err = client.IsCloneableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneable", resp, "Failure responding to request") + return + } + + return +} + +// IsCloneablePreparer prepares the IsCloneable request. +func (client AppsClient) IsCloneablePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/iscloneable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// IsCloneableSender sends the IsCloneable request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) IsCloneableSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// IsCloneableResponder handles the response to the IsCloneable request. The method always +// closes the http.Response Body. +func (client AppsClient) IsCloneableResponder(resp *http.Response) (result SiteCloneability, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// IsCloneableSlot description for Shows whether an app can be cloned to another resource group or subscription. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. By default, this API returns information on the production slot. +func (client AppsClient) IsCloneableSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result SiteCloneability, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.IsCloneableSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "IsCloneableSlot", err.Error()) + } + + req, err := client.IsCloneableSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneableSlot", nil, "Failure preparing request") + return + } + + resp, err := client.IsCloneableSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneableSlot", resp, "Failure sending request") + return + } + + result, err = client.IsCloneableSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneableSlot", resp, "Failure responding to request") + return + } + + return +} + +// IsCloneableSlotPreparer prepares the IsCloneableSlot request. +func (client AppsClient) IsCloneableSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/iscloneable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// IsCloneableSlotSender sends the IsCloneableSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) IsCloneableSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// IsCloneableSlotResponder handles the response to the IsCloneableSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) IsCloneableSlotResponder(resp *http.Response) (result SiteCloneability, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List description for Get all apps for a subscription. +func (client AppsClient) List(ctx context.Context) (result AppCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.List") + defer func() { + sc := -1 + if result.ac.Response.Response != nil { + sc = result.ac.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ac.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "List", resp, "Failure sending request") + return + } + + result.ac, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "List", resp, "Failure responding to request") + return + } + if result.ac.hasNextLink() && result.ac.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AppsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/sites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppsClient) ListResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AppsClient) listNextResults(ctx context.Context, lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.appCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListComplete(ctx context.Context) (result AppCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListApplicationSettings description for Gets the application settings of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListApplicationSettings(ctx context.Context, resourceGroupName string, name string) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListApplicationSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListApplicationSettings", err.Error()) + } + + req, err := client.ListApplicationSettingsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettings", nil, "Failure preparing request") + return + } + + resp, err := client.ListApplicationSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettings", resp, "Failure sending request") + return + } + + result, err = client.ListApplicationSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettings", resp, "Failure responding to request") + return + } + + return +} + +// ListApplicationSettingsPreparer prepares the ListApplicationSettings request. +func (client AppsClient) ListApplicationSettingsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListApplicationSettingsSender sends the ListApplicationSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListApplicationSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListApplicationSettingsResponder handles the response to the ListApplicationSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) ListApplicationSettingsResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListApplicationSettingsSlot description for Gets the application settings of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get the application settings +// for the production slot. +func (client AppsClient) ListApplicationSettingsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListApplicationSettingsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListApplicationSettingsSlot", err.Error()) + } + + req, err := client.ListApplicationSettingsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettingsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListApplicationSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettingsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListApplicationSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettingsSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListApplicationSettingsSlotPreparer prepares the ListApplicationSettingsSlot request. +func (client AppsClient) ListApplicationSettingsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListApplicationSettingsSlotSender sends the ListApplicationSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListApplicationSettingsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListApplicationSettingsSlotResponder handles the response to the ListApplicationSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListApplicationSettingsSlotResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAzureStorageAccounts description for Gets the Azure storage account configurations of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListAzureStorageAccounts(ctx context.Context, resourceGroupName string, name string) (result AzureStoragePropertyDictionaryResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListAzureStorageAccounts") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListAzureStorageAccounts", err.Error()) + } + + req, err := client.ListAzureStorageAccountsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListAzureStorageAccounts", nil, "Failure preparing request") + return + } + + resp, err := client.ListAzureStorageAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListAzureStorageAccounts", resp, "Failure sending request") + return + } + + result, err = client.ListAzureStorageAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListAzureStorageAccounts", resp, "Failure responding to request") + return + } + + return +} + +// ListAzureStorageAccountsPreparer prepares the ListAzureStorageAccounts request. +func (client AppsClient) ListAzureStorageAccountsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/azurestorageaccounts/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAzureStorageAccountsSender sends the ListAzureStorageAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListAzureStorageAccountsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAzureStorageAccountsResponder handles the response to the ListAzureStorageAccounts request. The method always +// closes the http.Response Body. +func (client AppsClient) ListAzureStorageAccountsResponder(resp *http.Response) (result AzureStoragePropertyDictionaryResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAzureStorageAccountsSlot description for Gets the Azure storage account configurations of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will update the Azure storage +// account configurations for the production slot. +func (client AppsClient) ListAzureStorageAccountsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result AzureStoragePropertyDictionaryResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListAzureStorageAccountsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListAzureStorageAccountsSlot", err.Error()) + } + + req, err := client.ListAzureStorageAccountsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListAzureStorageAccountsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListAzureStorageAccountsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListAzureStorageAccountsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListAzureStorageAccountsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListAzureStorageAccountsSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListAzureStorageAccountsSlotPreparer prepares the ListAzureStorageAccountsSlot request. +func (client AppsClient) ListAzureStorageAccountsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/azurestorageaccounts/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAzureStorageAccountsSlotSender sends the ListAzureStorageAccountsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListAzureStorageAccountsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAzureStorageAccountsSlotResponder handles the response to the ListAzureStorageAccountsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListAzureStorageAccountsSlotResponder(resp *http.Response) (result AzureStoragePropertyDictionaryResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBackups description for Gets existing backups of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListBackups(ctx context.Context, resourceGroupName string, name string) (result BackupItemCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListBackups") + defer func() { + sc := -1 + if result.bic.Response.Response != nil { + sc = result.bic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListBackups", err.Error()) + } + + result.fn = client.listBackupsNextResults + req, err := client.ListBackupsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", nil, "Failure preparing request") + return + } + + resp, err := client.ListBackupsSender(req) + if err != nil { + result.bic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", resp, "Failure sending request") + return + } + + result.bic, err = client.ListBackupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", resp, "Failure responding to request") + return + } + if result.bic.hasNextLink() && result.bic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBackupsPreparer prepares the ListBackups request. +func (client AppsClient) ListBackupsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBackupsSender sends the ListBackups request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListBackupsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBackupsResponder handles the response to the ListBackups request. The method always +// closes the http.Response Body. +func (client AppsClient) ListBackupsResponder(resp *http.Response) (result BackupItemCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBackupsNextResults retrieves the next set of results, if any. +func (client AppsClient) listBackupsNextResults(ctx context.Context, lastResults BackupItemCollection) (result BackupItemCollection, err error) { + req, err := lastResults.backupItemCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listBackupsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBackupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listBackupsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBackupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listBackupsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBackupsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListBackupsComplete(ctx context.Context, resourceGroupName string, name string) (result BackupItemCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListBackups") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBackups(ctx, resourceGroupName, name) + return +} + +// ListBackupsSlot description for Gets existing backups of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get backups of the production +// slot. +func (client AppsClient) ListBackupsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result BackupItemCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListBackupsSlot") + defer func() { + sc := -1 + if result.bic.Response.Response != nil { + sc = result.bic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListBackupsSlot", err.Error()) + } + + result.fn = client.listBackupsSlotNextResults + req, err := client.ListBackupsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListBackupsSlotSender(req) + if err != nil { + result.bic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", resp, "Failure sending request") + return + } + + result.bic, err = client.ListBackupsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", resp, "Failure responding to request") + return + } + if result.bic.hasNextLink() && result.bic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBackupsSlotPreparer prepares the ListBackupsSlot request. +func (client AppsClient) ListBackupsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBackupsSlotSender sends the ListBackupsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListBackupsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBackupsSlotResponder handles the response to the ListBackupsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListBackupsSlotResponder(resp *http.Response) (result BackupItemCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBackupsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listBackupsSlotNextResults(ctx context.Context, lastResults BackupItemCollection) (result BackupItemCollection, err error) { + req, err := lastResults.backupItemCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listBackupsSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBackupsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listBackupsSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBackupsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listBackupsSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBackupsSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListBackupsSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result BackupItemCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListBackupsSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBackupsSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListBackupStatusSecrets description for Gets status of a web app backup that may be in progress, including secrets +// associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for the backup +// if a new URL is passed in the request body. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// backupID - ID of backup. +// request - information on backup request. +func (client AppsClient) ListBackupStatusSecrets(ctx context.Context, resourceGroupName string, name string, backupID string, request BackupRequest) (result BackupItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListBackupStatusSecrets") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.StorageAccountURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListBackupStatusSecrets", err.Error()) + } + + req, err := client.ListBackupStatusSecretsPreparer(ctx, resourceGroupName, name, backupID, request) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecrets", nil, "Failure preparing request") + return + } + + resp, err := client.ListBackupStatusSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecrets", resp, "Failure sending request") + return + } + + result, err = client.ListBackupStatusSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecrets", resp, "Failure responding to request") + return + } + + return +} + +// ListBackupStatusSecretsPreparer prepares the ListBackupStatusSecrets request. +func (client AppsClient) ListBackupStatusSecretsPreparer(ctx context.Context, resourceGroupName string, name string, backupID string, request BackupRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/list", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBackupStatusSecretsSender sends the ListBackupStatusSecrets request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListBackupStatusSecretsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBackupStatusSecretsResponder handles the response to the ListBackupStatusSecrets request. The method always +// closes the http.Response Body. +func (client AppsClient) ListBackupStatusSecretsResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBackupStatusSecretsSlot description for Gets status of a web app backup that may be in progress, including +// secrets associated with the backup, such as the Azure Storage SAS URL. Also can be used to update the SAS URL for +// the backup if a new URL is passed in the request body. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// backupID - ID of backup. +// request - information on backup request. +// slot - name of web app slot. If not specified then will default to production slot. +func (client AppsClient) ListBackupStatusSecretsSlot(ctx context.Context, resourceGroupName string, name string, backupID string, request BackupRequest, slot string) (result BackupItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListBackupStatusSecretsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.StorageAccountURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListBackupStatusSecretsSlot", err.Error()) + } + + req, err := client.ListBackupStatusSecretsSlotPreparer(ctx, resourceGroupName, name, backupID, request, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecretsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListBackupStatusSecretsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecretsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListBackupStatusSecretsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecretsSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListBackupStatusSecretsSlotPreparer prepares the ListBackupStatusSecretsSlot request. +func (client AppsClient) ListBackupStatusSecretsSlotPreparer(ctx context.Context, resourceGroupName string, name string, backupID string, request BackupRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/list", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBackupStatusSecretsSlotSender sends the ListBackupStatusSecretsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListBackupStatusSecretsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBackupStatusSecretsSlotResponder handles the response to the ListBackupStatusSecretsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListBackupStatusSecretsSlotResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBasicPublishingCredentialsPolicies description for Returns whether Scm basic auth is allowed and whether Ftp is +// allowed for a given site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListBasicPublishingCredentialsPolicies(ctx context.Context, resourceGroupName string, name string) (result PublishingCredentialsPoliciesCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListBasicPublishingCredentialsPolicies") + defer func() { + sc := -1 + if result.pcpc.Response.Response != nil { + sc = result.pcpc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListBasicPublishingCredentialsPolicies", err.Error()) + } + + result.fn = client.listBasicPublishingCredentialsPoliciesNextResults + req, err := client.ListBasicPublishingCredentialsPoliciesPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBasicPublishingCredentialsPolicies", nil, "Failure preparing request") + return + } + + resp, err := client.ListBasicPublishingCredentialsPoliciesSender(req) + if err != nil { + result.pcpc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBasicPublishingCredentialsPolicies", resp, "Failure sending request") + return + } + + result.pcpc, err = client.ListBasicPublishingCredentialsPoliciesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBasicPublishingCredentialsPolicies", resp, "Failure responding to request") + return + } + if result.pcpc.hasNextLink() && result.pcpc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBasicPublishingCredentialsPoliciesPreparer prepares the ListBasicPublishingCredentialsPolicies request. +func (client AppsClient) ListBasicPublishingCredentialsPoliciesPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBasicPublishingCredentialsPoliciesSender sends the ListBasicPublishingCredentialsPolicies request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListBasicPublishingCredentialsPoliciesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBasicPublishingCredentialsPoliciesResponder handles the response to the ListBasicPublishingCredentialsPolicies request. The method always +// closes the http.Response Body. +func (client AppsClient) ListBasicPublishingCredentialsPoliciesResponder(resp *http.Response) (result PublishingCredentialsPoliciesCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBasicPublishingCredentialsPoliciesNextResults retrieves the next set of results, if any. +func (client AppsClient) listBasicPublishingCredentialsPoliciesNextResults(ctx context.Context, lastResults PublishingCredentialsPoliciesCollection) (result PublishingCredentialsPoliciesCollection, err error) { + req, err := lastResults.publishingCredentialsPoliciesCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listBasicPublishingCredentialsPoliciesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBasicPublishingCredentialsPoliciesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listBasicPublishingCredentialsPoliciesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBasicPublishingCredentialsPoliciesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listBasicPublishingCredentialsPoliciesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBasicPublishingCredentialsPoliciesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListBasicPublishingCredentialsPoliciesComplete(ctx context.Context, resourceGroupName string, name string) (result PublishingCredentialsPoliciesCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListBasicPublishingCredentialsPolicies") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBasicPublishingCredentialsPolicies(ctx, resourceGroupName, name) + return +} + +// ListBasicPublishingCredentialsPoliciesSlot description for Returns whether Scm basic auth is allowed and whether Ftp +// is allowed for a given site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListBasicPublishingCredentialsPoliciesSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result PublishingCredentialsPoliciesCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListBasicPublishingCredentialsPoliciesSlot") + defer func() { + sc := -1 + if result.pcpc.Response.Response != nil { + sc = result.pcpc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListBasicPublishingCredentialsPoliciesSlot", err.Error()) + } + + result.fn = client.listBasicPublishingCredentialsPoliciesSlotNextResults + req, err := client.ListBasicPublishingCredentialsPoliciesSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBasicPublishingCredentialsPoliciesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListBasicPublishingCredentialsPoliciesSlotSender(req) + if err != nil { + result.pcpc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBasicPublishingCredentialsPoliciesSlot", resp, "Failure sending request") + return + } + + result.pcpc, err = client.ListBasicPublishingCredentialsPoliciesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBasicPublishingCredentialsPoliciesSlot", resp, "Failure responding to request") + return + } + if result.pcpc.hasNextLink() && result.pcpc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBasicPublishingCredentialsPoliciesSlotPreparer prepares the ListBasicPublishingCredentialsPoliciesSlot request. +func (client AppsClient) ListBasicPublishingCredentialsPoliciesSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/basicPublishingCredentialsPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBasicPublishingCredentialsPoliciesSlotSender sends the ListBasicPublishingCredentialsPoliciesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListBasicPublishingCredentialsPoliciesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBasicPublishingCredentialsPoliciesSlotResponder handles the response to the ListBasicPublishingCredentialsPoliciesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListBasicPublishingCredentialsPoliciesSlotResponder(resp *http.Response) (result PublishingCredentialsPoliciesCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBasicPublishingCredentialsPoliciesSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listBasicPublishingCredentialsPoliciesSlotNextResults(ctx context.Context, lastResults PublishingCredentialsPoliciesCollection) (result PublishingCredentialsPoliciesCollection, err error) { + req, err := lastResults.publishingCredentialsPoliciesCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listBasicPublishingCredentialsPoliciesSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBasicPublishingCredentialsPoliciesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listBasicPublishingCredentialsPoliciesSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBasicPublishingCredentialsPoliciesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listBasicPublishingCredentialsPoliciesSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBasicPublishingCredentialsPoliciesSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListBasicPublishingCredentialsPoliciesSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result PublishingCredentialsPoliciesCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListBasicPublishingCredentialsPoliciesSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBasicPublishingCredentialsPoliciesSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListByResourceGroup description for Gets all web, mobile, and API apps in the specified resource group. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// includeSlots - specify true to include deployment slots in results. The default is false, +// which only gives you the production slot of all apps. +func (client AppsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, includeSlots *bool) (result AppCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.ac.Response.Response != nil { + sc = result.ac.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, includeSlots) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.ac.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.ac, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.ac.hasNextLink() && result.ac.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AppsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, includeSlots *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if includeSlots != nil { + queryParameters["includeSlots"] = autorest.Encode("query", *includeSlots) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AppsClient) ListByResourceGroupResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client AppsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.appCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, includeSlots *bool) (result AppCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, includeSlots) + return +} + +// ListConfigurations description for List the configurations of an app +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListConfigurations(ctx context.Context, resourceGroupName string, name string) (result SiteConfigResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListConfigurations") + defer func() { + sc := -1 + if result.scrc.Response.Response != nil { + sc = result.scrc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListConfigurations", err.Error()) + } + + result.fn = client.listConfigurationsNextResults + req, err := client.ListConfigurationsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurations", nil, "Failure preparing request") + return + } + + resp, err := client.ListConfigurationsSender(req) + if err != nil { + result.scrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurations", resp, "Failure sending request") + return + } + + result.scrc, err = client.ListConfigurationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurations", resp, "Failure responding to request") + return + } + if result.scrc.hasNextLink() && result.scrc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListConfigurationsPreparer prepares the ListConfigurations request. +func (client AppsClient) ListConfigurationsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListConfigurationsSender sends the ListConfigurations request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConfigurationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListConfigurationsResponder handles the response to the ListConfigurations request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConfigurationsResponder(resp *http.Response) (result SiteConfigResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listConfigurationsNextResults retrieves the next set of results, if any. +func (client AppsClient) listConfigurationsNextResults(ctx context.Context, lastResults SiteConfigResourceCollection) (result SiteConfigResourceCollection, err error) { + req, err := lastResults.siteConfigResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listConfigurationsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListConfigurationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listConfigurationsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListConfigurationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listConfigurationsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListConfigurationsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListConfigurationsComplete(ctx context.Context, resourceGroupName string, name string) (result SiteConfigResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListConfigurations") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListConfigurations(ctx, resourceGroupName, name) + return +} + +// ListConfigurationSnapshotInfo description for Gets a list of web app configuration snapshots identifiers. Each +// element of the list contains a timestamp and the ID of the snapshot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListConfigurationSnapshotInfo(ctx context.Context, resourceGroupName string, name string) (result SiteConfigurationSnapshotInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListConfigurationSnapshotInfo") + defer func() { + sc := -1 + if result.scsic.Response.Response != nil { + sc = result.scsic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListConfigurationSnapshotInfo", err.Error()) + } + + result.fn = client.listConfigurationSnapshotInfoNextResults + req, err := client.ListConfigurationSnapshotInfoPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfo", nil, "Failure preparing request") + return + } + + resp, err := client.ListConfigurationSnapshotInfoSender(req) + if err != nil { + result.scsic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfo", resp, "Failure sending request") + return + } + + result.scsic, err = client.ListConfigurationSnapshotInfoResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfo", resp, "Failure responding to request") + return + } + if result.scsic.hasNextLink() && result.scsic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListConfigurationSnapshotInfoPreparer prepares the ListConfigurationSnapshotInfo request. +func (client AppsClient) ListConfigurationSnapshotInfoPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListConfigurationSnapshotInfoSender sends the ListConfigurationSnapshotInfo request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConfigurationSnapshotInfoSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListConfigurationSnapshotInfoResponder handles the response to the ListConfigurationSnapshotInfo request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConfigurationSnapshotInfoResponder(resp *http.Response) (result SiteConfigurationSnapshotInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listConfigurationSnapshotInfoNextResults retrieves the next set of results, if any. +func (client AppsClient) listConfigurationSnapshotInfoNextResults(ctx context.Context, lastResults SiteConfigurationSnapshotInfoCollection) (result SiteConfigurationSnapshotInfoCollection, err error) { + req, err := lastResults.siteConfigurationSnapshotInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listConfigurationSnapshotInfoNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListConfigurationSnapshotInfoSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listConfigurationSnapshotInfoNextResults", resp, "Failure sending next results request") + } + result, err = client.ListConfigurationSnapshotInfoResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listConfigurationSnapshotInfoNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListConfigurationSnapshotInfoComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListConfigurationSnapshotInfoComplete(ctx context.Context, resourceGroupName string, name string) (result SiteConfigurationSnapshotInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListConfigurationSnapshotInfo") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListConfigurationSnapshotInfo(ctx, resourceGroupName, name) + return +} + +// ListConfigurationSnapshotInfoSlot description for Gets a list of web app configuration snapshots identifiers. Each +// element of the list contains a timestamp and the ID of the snapshot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will return configuration for the +// production slot. +func (client AppsClient) ListConfigurationSnapshotInfoSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result SiteConfigurationSnapshotInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListConfigurationSnapshotInfoSlot") + defer func() { + sc := -1 + if result.scsic.Response.Response != nil { + sc = result.scsic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListConfigurationSnapshotInfoSlot", err.Error()) + } + + result.fn = client.listConfigurationSnapshotInfoSlotNextResults + req, err := client.ListConfigurationSnapshotInfoSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfoSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListConfigurationSnapshotInfoSlotSender(req) + if err != nil { + result.scsic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfoSlot", resp, "Failure sending request") + return + } + + result.scsic, err = client.ListConfigurationSnapshotInfoSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfoSlot", resp, "Failure responding to request") + return + } + if result.scsic.hasNextLink() && result.scsic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListConfigurationSnapshotInfoSlotPreparer prepares the ListConfigurationSnapshotInfoSlot request. +func (client AppsClient) ListConfigurationSnapshotInfoSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListConfigurationSnapshotInfoSlotSender sends the ListConfigurationSnapshotInfoSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConfigurationSnapshotInfoSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListConfigurationSnapshotInfoSlotResponder handles the response to the ListConfigurationSnapshotInfoSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConfigurationSnapshotInfoSlotResponder(resp *http.Response) (result SiteConfigurationSnapshotInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listConfigurationSnapshotInfoSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listConfigurationSnapshotInfoSlotNextResults(ctx context.Context, lastResults SiteConfigurationSnapshotInfoCollection) (result SiteConfigurationSnapshotInfoCollection, err error) { + req, err := lastResults.siteConfigurationSnapshotInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listConfigurationSnapshotInfoSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListConfigurationSnapshotInfoSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listConfigurationSnapshotInfoSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListConfigurationSnapshotInfoSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listConfigurationSnapshotInfoSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListConfigurationSnapshotInfoSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListConfigurationSnapshotInfoSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result SiteConfigurationSnapshotInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListConfigurationSnapshotInfoSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListConfigurationSnapshotInfoSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListConfigurationsSlot description for List the configurations of an app +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will return configuration for the +// production slot. +func (client AppsClient) ListConfigurationsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result SiteConfigResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListConfigurationsSlot") + defer func() { + sc := -1 + if result.scrc.Response.Response != nil { + sc = result.scrc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListConfigurationsSlot", err.Error()) + } + + result.fn = client.listConfigurationsSlotNextResults + req, err := client.ListConfigurationsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListConfigurationsSlotSender(req) + if err != nil { + result.scrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationsSlot", resp, "Failure sending request") + return + } + + result.scrc, err = client.ListConfigurationsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationsSlot", resp, "Failure responding to request") + return + } + if result.scrc.hasNextLink() && result.scrc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListConfigurationsSlotPreparer prepares the ListConfigurationsSlot request. +func (client AppsClient) ListConfigurationsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListConfigurationsSlotSender sends the ListConfigurationsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConfigurationsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListConfigurationsSlotResponder handles the response to the ListConfigurationsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConfigurationsSlotResponder(resp *http.Response) (result SiteConfigResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listConfigurationsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listConfigurationsSlotNextResults(ctx context.Context, lastResults SiteConfigResourceCollection) (result SiteConfigResourceCollection, err error) { + req, err := lastResults.siteConfigResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listConfigurationsSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListConfigurationsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listConfigurationsSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListConfigurationsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listConfigurationsSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListConfigurationsSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListConfigurationsSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result SiteConfigResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListConfigurationsSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListConfigurationsSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListConnectionStrings description for Gets the connection strings of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListConnectionStrings(ctx context.Context, resourceGroupName string, name string) (result ConnectionStringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListConnectionStrings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListConnectionStrings", err.Error()) + } + + req, err := client.ListConnectionStringsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStrings", nil, "Failure preparing request") + return + } + + resp, err := client.ListConnectionStringsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStrings", resp, "Failure sending request") + return + } + + result, err = client.ListConnectionStringsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStrings", resp, "Failure responding to request") + return + } + + return +} + +// ListConnectionStringsPreparer prepares the ListConnectionStrings request. +func (client AppsClient) ListConnectionStringsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConnectionStringsResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListConnectionStringsSlot description for Gets the connection strings of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get the connection settings for +// the production slot. +func (client AppsClient) ListConnectionStringsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result ConnectionStringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListConnectionStringsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListConnectionStringsSlot", err.Error()) + } + + req, err := client.ListConnectionStringsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStringsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListConnectionStringsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStringsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListConnectionStringsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStringsSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListConnectionStringsSlotPreparer prepares the ListConnectionStringsSlot request. +func (client AppsClient) ListConnectionStringsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListConnectionStringsSlotSender sends the ListConnectionStringsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConnectionStringsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListConnectionStringsSlotResponder handles the response to the ListConnectionStringsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConnectionStringsSlotResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListContinuousWebJobs description for List continuous web jobs for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +func (client AppsClient) ListContinuousWebJobs(ctx context.Context, resourceGroupName string, name string) (result ContinuousWebJobCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListContinuousWebJobs") + defer func() { + sc := -1 + if result.cwjc.Response.Response != nil { + sc = result.cwjc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListContinuousWebJobs", err.Error()) + } + + result.fn = client.listContinuousWebJobsNextResults + req, err := client.ListContinuousWebJobsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListContinuousWebJobs", nil, "Failure preparing request") + return + } + + resp, err := client.ListContinuousWebJobsSender(req) + if err != nil { + result.cwjc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListContinuousWebJobs", resp, "Failure sending request") + return + } + + result.cwjc, err = client.ListContinuousWebJobsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListContinuousWebJobs", resp, "Failure responding to request") + return + } + if result.cwjc.hasNextLink() && result.cwjc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListContinuousWebJobsPreparer prepares the ListContinuousWebJobs request. +func (client AppsClient) ListContinuousWebJobsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListContinuousWebJobsSender sends the ListContinuousWebJobs request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListContinuousWebJobsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListContinuousWebJobsResponder handles the response to the ListContinuousWebJobs request. The method always +// closes the http.Response Body. +func (client AppsClient) ListContinuousWebJobsResponder(resp *http.Response) (result ContinuousWebJobCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listContinuousWebJobsNextResults retrieves the next set of results, if any. +func (client AppsClient) listContinuousWebJobsNextResults(ctx context.Context, lastResults ContinuousWebJobCollection) (result ContinuousWebJobCollection, err error) { + req, err := lastResults.continuousWebJobCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listContinuousWebJobsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListContinuousWebJobsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listContinuousWebJobsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListContinuousWebJobsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listContinuousWebJobsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListContinuousWebJobsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListContinuousWebJobsComplete(ctx context.Context, resourceGroupName string, name string) (result ContinuousWebJobCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListContinuousWebJobs") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListContinuousWebJobs(ctx, resourceGroupName, name) + return +} + +// ListContinuousWebJobsSlot description for List continuous web jobs for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// slot - name of the deployment slot. If a slot is not specified, the API deletes a deployment for the +// production slot. +func (client AppsClient) ListContinuousWebJobsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result ContinuousWebJobCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListContinuousWebJobsSlot") + defer func() { + sc := -1 + if result.cwjc.Response.Response != nil { + sc = result.cwjc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListContinuousWebJobsSlot", err.Error()) + } + + result.fn = client.listContinuousWebJobsSlotNextResults + req, err := client.ListContinuousWebJobsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListContinuousWebJobsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListContinuousWebJobsSlotSender(req) + if err != nil { + result.cwjc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListContinuousWebJobsSlot", resp, "Failure sending request") + return + } + + result.cwjc, err = client.ListContinuousWebJobsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListContinuousWebJobsSlot", resp, "Failure responding to request") + return + } + if result.cwjc.hasNextLink() && result.cwjc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListContinuousWebJobsSlotPreparer prepares the ListContinuousWebJobsSlot request. +func (client AppsClient) ListContinuousWebJobsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListContinuousWebJobsSlotSender sends the ListContinuousWebJobsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListContinuousWebJobsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListContinuousWebJobsSlotResponder handles the response to the ListContinuousWebJobsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListContinuousWebJobsSlotResponder(resp *http.Response) (result ContinuousWebJobCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listContinuousWebJobsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listContinuousWebJobsSlotNextResults(ctx context.Context, lastResults ContinuousWebJobCollection) (result ContinuousWebJobCollection, err error) { + req, err := lastResults.continuousWebJobCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listContinuousWebJobsSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListContinuousWebJobsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listContinuousWebJobsSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListContinuousWebJobsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listContinuousWebJobsSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListContinuousWebJobsSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListContinuousWebJobsSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result ContinuousWebJobCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListContinuousWebJobsSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListContinuousWebJobsSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListDeploymentLog description for List deployment log for specific deployment for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// ID - the ID of a specific deployment. This is the value of the name property in the JSON response from "GET +// /api/sites/{siteName}/deployments". +func (client AppsClient) ListDeploymentLog(ctx context.Context, resourceGroupName string, name string, ID string) (result Deployment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListDeploymentLog") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListDeploymentLog", err.Error()) + } + + req, err := client.ListDeploymentLogPreparer(ctx, resourceGroupName, name, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentLog", nil, "Failure preparing request") + return + } + + resp, err := client.ListDeploymentLogSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentLog", resp, "Failure sending request") + return + } + + result, err = client.ListDeploymentLogResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentLog", resp, "Failure responding to request") + return + } + + return +} + +// ListDeploymentLogPreparer prepares the ListDeploymentLog request. +func (client AppsClient) ListDeploymentLogPreparer(ctx context.Context, resourceGroupName string, name string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}/log", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListDeploymentLogSender sends the ListDeploymentLog request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListDeploymentLogSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListDeploymentLogResponder handles the response to the ListDeploymentLog request. The method always +// closes the http.Response Body. +func (client AppsClient) ListDeploymentLogResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDeploymentLogSlot description for List deployment log for specific deployment for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// ID - the ID of a specific deployment. This is the value of the name property in the JSON response from "GET +// /api/sites/{siteName}/deployments". +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +func (client AppsClient) ListDeploymentLogSlot(ctx context.Context, resourceGroupName string, name string, ID string, slot string) (result Deployment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListDeploymentLogSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListDeploymentLogSlot", err.Error()) + } + + req, err := client.ListDeploymentLogSlotPreparer(ctx, resourceGroupName, name, ID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentLogSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListDeploymentLogSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentLogSlot", resp, "Failure sending request") + return + } + + result, err = client.ListDeploymentLogSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentLogSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListDeploymentLogSlotPreparer prepares the ListDeploymentLogSlot request. +func (client AppsClient) ListDeploymentLogSlotPreparer(ctx context.Context, resourceGroupName string, name string, ID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}/log", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListDeploymentLogSlotSender sends the ListDeploymentLogSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListDeploymentLogSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListDeploymentLogSlotResponder handles the response to the ListDeploymentLogSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListDeploymentLogSlotResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDeployments description for List deployments for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListDeployments(ctx context.Context, resourceGroupName string, name string) (result DeploymentCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListDeployments") + defer func() { + sc := -1 + if result.dc.Response.Response != nil { + sc = result.dc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListDeployments", err.Error()) + } + + result.fn = client.listDeploymentsNextResults + req, err := client.ListDeploymentsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", nil, "Failure preparing request") + return + } + + resp, err := client.ListDeploymentsSender(req) + if err != nil { + result.dc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", resp, "Failure sending request") + return + } + + result.dc, err = client.ListDeploymentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", resp, "Failure responding to request") + return + } + if result.dc.hasNextLink() && result.dc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListDeploymentsPreparer prepares the ListDeployments request. +func (client AppsClient) ListDeploymentsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListDeploymentsSender sends the ListDeployments request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListDeploymentsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListDeploymentsResponder handles the response to the ListDeployments request. The method always +// closes the http.Response Body. +func (client AppsClient) ListDeploymentsResponder(resp *http.Response) (result DeploymentCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listDeploymentsNextResults retrieves the next set of results, if any. +func (client AppsClient) listDeploymentsNextResults(ctx context.Context, lastResults DeploymentCollection) (result DeploymentCollection, err error) { + req, err := lastResults.deploymentCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listDeploymentsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListDeploymentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listDeploymentsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListDeploymentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listDeploymentsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListDeploymentsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListDeploymentsComplete(ctx context.Context, resourceGroupName string, name string) (result DeploymentCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListDeployments") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListDeployments(ctx, resourceGroupName, name) + return +} + +// ListDeploymentsSlot description for List deployments for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +func (client AppsClient) ListDeploymentsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result DeploymentCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListDeploymentsSlot") + defer func() { + sc := -1 + if result.dc.Response.Response != nil { + sc = result.dc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListDeploymentsSlot", err.Error()) + } + + result.fn = client.listDeploymentsSlotNextResults + req, err := client.ListDeploymentsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListDeploymentsSlotSender(req) + if err != nil { + result.dc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", resp, "Failure sending request") + return + } + + result.dc, err = client.ListDeploymentsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", resp, "Failure responding to request") + return + } + if result.dc.hasNextLink() && result.dc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListDeploymentsSlotPreparer prepares the ListDeploymentsSlot request. +func (client AppsClient) ListDeploymentsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListDeploymentsSlotSender sends the ListDeploymentsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListDeploymentsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListDeploymentsSlotResponder handles the response to the ListDeploymentsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListDeploymentsSlotResponder(resp *http.Response) (result DeploymentCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listDeploymentsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listDeploymentsSlotNextResults(ctx context.Context, lastResults DeploymentCollection) (result DeploymentCollection, err error) { + req, err := lastResults.deploymentCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listDeploymentsSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListDeploymentsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listDeploymentsSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListDeploymentsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listDeploymentsSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListDeploymentsSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListDeploymentsSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result DeploymentCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListDeploymentsSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListDeploymentsSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListDomainOwnershipIdentifiers description for Lists ownership identifiers for domain associated with web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListDomainOwnershipIdentifiers(ctx context.Context, resourceGroupName string, name string) (result IdentifierCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListDomainOwnershipIdentifiers") + defer func() { + sc := -1 + if result.ic.Response.Response != nil { + sc = result.ic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListDomainOwnershipIdentifiers", err.Error()) + } + + result.fn = client.listDomainOwnershipIdentifiersNextResults + req, err := client.ListDomainOwnershipIdentifiersPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", nil, "Failure preparing request") + return + } + + resp, err := client.ListDomainOwnershipIdentifiersSender(req) + if err != nil { + result.ic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", resp, "Failure sending request") + return + } + + result.ic, err = client.ListDomainOwnershipIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", resp, "Failure responding to request") + return + } + if result.ic.hasNextLink() && result.ic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListDomainOwnershipIdentifiersPreparer prepares the ListDomainOwnershipIdentifiers request. +func (client AppsClient) ListDomainOwnershipIdentifiersPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListDomainOwnershipIdentifiersSender sends the ListDomainOwnershipIdentifiers request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListDomainOwnershipIdentifiersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListDomainOwnershipIdentifiersResponder handles the response to the ListDomainOwnershipIdentifiers request. The method always +// closes the http.Response Body. +func (client AppsClient) ListDomainOwnershipIdentifiersResponder(resp *http.Response) (result IdentifierCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listDomainOwnershipIdentifiersNextResults retrieves the next set of results, if any. +func (client AppsClient) listDomainOwnershipIdentifiersNextResults(ctx context.Context, lastResults IdentifierCollection) (result IdentifierCollection, err error) { + req, err := lastResults.identifierCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listDomainOwnershipIdentifiersNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListDomainOwnershipIdentifiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listDomainOwnershipIdentifiersNextResults", resp, "Failure sending next results request") + } + result, err = client.ListDomainOwnershipIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listDomainOwnershipIdentifiersNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListDomainOwnershipIdentifiersComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListDomainOwnershipIdentifiersComplete(ctx context.Context, resourceGroupName string, name string) (result IdentifierCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListDomainOwnershipIdentifiers") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListDomainOwnershipIdentifiers(ctx, resourceGroupName, name) + return +} + +// ListDomainOwnershipIdentifiersSlot description for Lists ownership identifiers for domain associated with web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will delete the binding for the +// production slot. +func (client AppsClient) ListDomainOwnershipIdentifiersSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result IdentifierCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListDomainOwnershipIdentifiersSlot") + defer func() { + sc := -1 + if result.ic.Response.Response != nil { + sc = result.ic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListDomainOwnershipIdentifiersSlot", err.Error()) + } + + result.fn = client.listDomainOwnershipIdentifiersSlotNextResults + req, err := client.ListDomainOwnershipIdentifiersSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListDomainOwnershipIdentifiersSlotSender(req) + if err != nil { + result.ic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", resp, "Failure sending request") + return + } + + result.ic, err = client.ListDomainOwnershipIdentifiersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", resp, "Failure responding to request") + return + } + if result.ic.hasNextLink() && result.ic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListDomainOwnershipIdentifiersSlotPreparer prepares the ListDomainOwnershipIdentifiersSlot request. +func (client AppsClient) ListDomainOwnershipIdentifiersSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListDomainOwnershipIdentifiersSlotSender sends the ListDomainOwnershipIdentifiersSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListDomainOwnershipIdentifiersSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListDomainOwnershipIdentifiersSlotResponder handles the response to the ListDomainOwnershipIdentifiersSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListDomainOwnershipIdentifiersSlotResponder(resp *http.Response) (result IdentifierCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listDomainOwnershipIdentifiersSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listDomainOwnershipIdentifiersSlotNextResults(ctx context.Context, lastResults IdentifierCollection) (result IdentifierCollection, err error) { + req, err := lastResults.identifierCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listDomainOwnershipIdentifiersSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListDomainOwnershipIdentifiersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listDomainOwnershipIdentifiersSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListDomainOwnershipIdentifiersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listDomainOwnershipIdentifiersSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListDomainOwnershipIdentifiersSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListDomainOwnershipIdentifiersSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result IdentifierCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListDomainOwnershipIdentifiersSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListDomainOwnershipIdentifiersSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListFunctionKeys description for Get function keys for a function in a web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// functionName - function name. +func (client AppsClient) ListFunctionKeys(ctx context.Context, resourceGroupName string, name string, functionName string) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListFunctionKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListFunctionKeys", err.Error()) + } + + req, err := client.ListFunctionKeysPreparer(ctx, resourceGroupName, name, functionName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListFunctionKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListFunctionKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListFunctionKeys", resp, "Failure sending request") + return + } + + result, err = client.ListFunctionKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListFunctionKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListFunctionKeysPreparer prepares the ListFunctionKeys request. +func (client AppsClient) ListFunctionKeysPreparer(ctx context.Context, resourceGroupName string, name string, functionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listkeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListFunctionKeysSender sends the ListFunctionKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListFunctionKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListFunctionKeysResponder handles the response to the ListFunctionKeys request. The method always +// closes the http.Response Body. +func (client AppsClient) ListFunctionKeysResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListFunctionKeysSlot description for Get function keys for a function in a web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// functionName - function name. +// slot - name of the deployment slot. +func (client AppsClient) ListFunctionKeysSlot(ctx context.Context, resourceGroupName string, name string, functionName string, slot string) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListFunctionKeysSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListFunctionKeysSlot", err.Error()) + } + + req, err := client.ListFunctionKeysSlotPreparer(ctx, resourceGroupName, name, functionName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListFunctionKeysSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListFunctionKeysSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListFunctionKeysSlot", resp, "Failure sending request") + return + } + + result, err = client.ListFunctionKeysSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListFunctionKeysSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListFunctionKeysSlotPreparer prepares the ListFunctionKeysSlot request. +func (client AppsClient) ListFunctionKeysSlotPreparer(ctx context.Context, resourceGroupName string, name string, functionName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listkeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListFunctionKeysSlotSender sends the ListFunctionKeysSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListFunctionKeysSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListFunctionKeysSlotResponder handles the response to the ListFunctionKeysSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListFunctionKeysSlotResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListFunctions description for List the functions for a web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +func (client AppsClient) ListFunctions(ctx context.Context, resourceGroupName string, name string) (result FunctionEnvelopeCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListFunctions") + defer func() { + sc := -1 + if result.fec.Response.Response != nil { + sc = result.fec.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListFunctions", err.Error()) + } + + result.fn = client.listFunctionsNextResults + req, err := client.ListFunctionsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListFunctions", nil, "Failure preparing request") + return + } + + resp, err := client.ListFunctionsSender(req) + if err != nil { + result.fec.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListFunctions", resp, "Failure sending request") + return + } + + result.fec, err = client.ListFunctionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListFunctions", resp, "Failure responding to request") + return + } + if result.fec.hasNextLink() && result.fec.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListFunctionsPreparer prepares the ListFunctions request. +func (client AppsClient) ListFunctionsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListFunctionsSender sends the ListFunctions request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListFunctionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListFunctionsResponder handles the response to the ListFunctions request. The method always +// closes the http.Response Body. +func (client AppsClient) ListFunctionsResponder(resp *http.Response) (result FunctionEnvelopeCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listFunctionsNextResults retrieves the next set of results, if any. +func (client AppsClient) listFunctionsNextResults(ctx context.Context, lastResults FunctionEnvelopeCollection) (result FunctionEnvelopeCollection, err error) { + req, err := lastResults.functionEnvelopeCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listFunctionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListFunctionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listFunctionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListFunctionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listFunctionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListFunctionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListFunctionsComplete(ctx context.Context, resourceGroupName string, name string) (result FunctionEnvelopeCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListFunctions") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListFunctions(ctx, resourceGroupName, name) + return +} + +// ListFunctionSecrets description for Get function secrets for a function in a web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// functionName - function name. +func (client AppsClient) ListFunctionSecrets(ctx context.Context, resourceGroupName string, name string, functionName string) (result FunctionSecrets, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListFunctionSecrets") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListFunctionSecrets", err.Error()) + } + + req, err := client.ListFunctionSecretsPreparer(ctx, resourceGroupName, name, functionName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListFunctionSecrets", nil, "Failure preparing request") + return + } + + resp, err := client.ListFunctionSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListFunctionSecrets", resp, "Failure sending request") + return + } + + result, err = client.ListFunctionSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListFunctionSecrets", resp, "Failure responding to request") + return + } + + return +} + +// ListFunctionSecretsPreparer prepares the ListFunctionSecrets request. +func (client AppsClient) ListFunctionSecretsPreparer(ctx context.Context, resourceGroupName string, name string, functionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}/listsecrets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListFunctionSecretsSender sends the ListFunctionSecrets request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListFunctionSecretsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListFunctionSecretsResponder handles the response to the ListFunctionSecrets request. The method always +// closes the http.Response Body. +func (client AppsClient) ListFunctionSecretsResponder(resp *http.Response) (result FunctionSecrets, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListFunctionSecretsSlot description for Get function secrets for a function in a web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// functionName - function name. +// slot - name of the deployment slot. +func (client AppsClient) ListFunctionSecretsSlot(ctx context.Context, resourceGroupName string, name string, functionName string, slot string) (result FunctionSecrets, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListFunctionSecretsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListFunctionSecretsSlot", err.Error()) + } + + req, err := client.ListFunctionSecretsSlotPreparer(ctx, resourceGroupName, name, functionName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListFunctionSecretsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListFunctionSecretsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListFunctionSecretsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListFunctionSecretsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListFunctionSecretsSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListFunctionSecretsSlotPreparer prepares the ListFunctionSecretsSlot request. +func (client AppsClient) ListFunctionSecretsSlotPreparer(ctx context.Context, resourceGroupName string, name string, functionName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}/listsecrets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListFunctionSecretsSlotSender sends the ListFunctionSecretsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListFunctionSecretsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListFunctionSecretsSlotResponder handles the response to the ListFunctionSecretsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListFunctionSecretsSlotResponder(resp *http.Response) (result FunctionSecrets, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHostKeys description for Get host secrets for a function app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +func (client AppsClient) ListHostKeys(ctx context.Context, resourceGroupName string, name string) (result HostKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListHostKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListHostKeys", err.Error()) + } + + req, err := client.ListHostKeysPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListHostKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostKeys", resp, "Failure sending request") + return + } + + result, err = client.ListHostKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListHostKeysPreparer prepares the ListHostKeys request. +func (client AppsClient) ListHostKeysPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/listkeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHostKeysSender sends the ListHostKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHostKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListHostKeysResponder handles the response to the ListHostKeys request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHostKeysResponder(resp *http.Response) (result HostKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHostKeysSlot description for Get host secrets for a function app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// slot - name of the deployment slot. +func (client AppsClient) ListHostKeysSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result HostKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListHostKeysSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListHostKeysSlot", err.Error()) + } + + req, err := client.ListHostKeysSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostKeysSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListHostKeysSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostKeysSlot", resp, "Failure sending request") + return + } + + result, err = client.ListHostKeysSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostKeysSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListHostKeysSlotPreparer prepares the ListHostKeysSlot request. +func (client AppsClient) ListHostKeysSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/listkeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHostKeysSlotSender sends the ListHostKeysSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHostKeysSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListHostKeysSlotResponder handles the response to the ListHostKeysSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHostKeysSlotResponder(resp *http.Response) (result HostKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHostNameBindings description for Get hostname bindings for an app or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListHostNameBindings(ctx context.Context, resourceGroupName string, name string) (result HostNameBindingCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListHostNameBindings") + defer func() { + sc := -1 + if result.hnbc.Response.Response != nil { + sc = result.hnbc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListHostNameBindings", err.Error()) + } + + result.fn = client.listHostNameBindingsNextResults + req, err := client.ListHostNameBindingsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", nil, "Failure preparing request") + return + } + + resp, err := client.ListHostNameBindingsSender(req) + if err != nil { + result.hnbc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", resp, "Failure sending request") + return + } + + result.hnbc, err = client.ListHostNameBindingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", resp, "Failure responding to request") + return + } + if result.hnbc.hasNextLink() && result.hnbc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListHostNameBindingsPreparer prepares the ListHostNameBindings request. +func (client AppsClient) ListHostNameBindingsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHostNameBindingsSender sends the ListHostNameBindings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHostNameBindingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListHostNameBindingsResponder handles the response to the ListHostNameBindings request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHostNameBindingsResponder(resp *http.Response) (result HostNameBindingCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listHostNameBindingsNextResults retrieves the next set of results, if any. +func (client AppsClient) listHostNameBindingsNextResults(ctx context.Context, lastResults HostNameBindingCollection) (result HostNameBindingCollection, err error) { + req, err := lastResults.hostNameBindingCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listHostNameBindingsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListHostNameBindingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listHostNameBindingsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListHostNameBindingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listHostNameBindingsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListHostNameBindingsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListHostNameBindingsComplete(ctx context.Context, resourceGroupName string, name string) (result HostNameBindingCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListHostNameBindings") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListHostNameBindings(ctx, resourceGroupName, name) + return +} + +// ListHostNameBindingsSlot description for Get hostname bindings for an app or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API gets hostname bindings for the +// production slot. +func (client AppsClient) ListHostNameBindingsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result HostNameBindingCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListHostNameBindingsSlot") + defer func() { + sc := -1 + if result.hnbc.Response.Response != nil { + sc = result.hnbc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListHostNameBindingsSlot", err.Error()) + } + + result.fn = client.listHostNameBindingsSlotNextResults + req, err := client.ListHostNameBindingsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListHostNameBindingsSlotSender(req) + if err != nil { + result.hnbc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", resp, "Failure sending request") + return + } + + result.hnbc, err = client.ListHostNameBindingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", resp, "Failure responding to request") + return + } + if result.hnbc.hasNextLink() && result.hnbc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListHostNameBindingsSlotPreparer prepares the ListHostNameBindingsSlot request. +func (client AppsClient) ListHostNameBindingsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHostNameBindingsSlotSender sends the ListHostNameBindingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHostNameBindingsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListHostNameBindingsSlotResponder handles the response to the ListHostNameBindingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHostNameBindingsSlotResponder(resp *http.Response) (result HostNameBindingCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listHostNameBindingsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listHostNameBindingsSlotNextResults(ctx context.Context, lastResults HostNameBindingCollection) (result HostNameBindingCollection, err error) { + req, err := lastResults.hostNameBindingCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listHostNameBindingsSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListHostNameBindingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listHostNameBindingsSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListHostNameBindingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listHostNameBindingsSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListHostNameBindingsSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListHostNameBindingsSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result HostNameBindingCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListHostNameBindingsSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListHostNameBindingsSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListHybridConnections description for Retrieves all Service Bus Hybrid Connections used by this Web App. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +func (client AppsClient) ListHybridConnections(ctx context.Context, resourceGroupName string, name string) (result HybridConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListHybridConnections") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListHybridConnections", err.Error()) + } + + req, err := client.ListHybridConnectionsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnections", nil, "Failure preparing request") + return + } + + resp, err := client.ListHybridConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnections", resp, "Failure sending request") + return + } + + result, err = client.ListHybridConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnections", resp, "Failure responding to request") + return + } + + return +} + +// ListHybridConnectionsPreparer prepares the ListHybridConnections request. +func (client AppsClient) ListHybridConnectionsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionRelays", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHybridConnectionsSender sends the ListHybridConnections request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHybridConnectionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListHybridConnectionsResponder handles the response to the ListHybridConnections request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHybridConnectionsResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHybridConnectionsSlot description for Retrieves all Service Bus Hybrid Connections used by this Web App. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// slot - the name of the slot for the web app. +func (client AppsClient) ListHybridConnectionsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result HybridConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListHybridConnectionsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListHybridConnectionsSlot", err.Error()) + } + + req, err := client.ListHybridConnectionsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListHybridConnectionsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListHybridConnectionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionsSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListHybridConnectionsSlotPreparer prepares the ListHybridConnectionsSlot request. +func (client AppsClient) ListHybridConnectionsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHybridConnectionsSlotSender sends the ListHybridConnectionsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHybridConnectionsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListHybridConnectionsSlotResponder handles the response to the ListHybridConnectionsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHybridConnectionsSlotResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListInstanceFunctionsSlot description for List the functions for a web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// slot - name of the deployment slot. +func (client AppsClient) ListInstanceFunctionsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result FunctionEnvelopeCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceFunctionsSlot") + defer func() { + sc := -1 + if result.fec.Response.Response != nil { + sc = result.fec.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListInstanceFunctionsSlot", err.Error()) + } + + result.fn = client.listInstanceFunctionsSlotNextResults + req, err := client.ListInstanceFunctionsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceFunctionsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListInstanceFunctionsSlotSender(req) + if err != nil { + result.fec.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceFunctionsSlot", resp, "Failure sending request") + return + } + + result.fec, err = client.ListInstanceFunctionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceFunctionsSlot", resp, "Failure responding to request") + return + } + if result.fec.hasNextLink() && result.fec.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListInstanceFunctionsSlotPreparer prepares the ListInstanceFunctionsSlot request. +func (client AppsClient) ListInstanceFunctionsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListInstanceFunctionsSlotSender sends the ListInstanceFunctionsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceFunctionsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListInstanceFunctionsSlotResponder handles the response to the ListInstanceFunctionsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceFunctionsSlotResponder(resp *http.Response) (result FunctionEnvelopeCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listInstanceFunctionsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listInstanceFunctionsSlotNextResults(ctx context.Context, lastResults FunctionEnvelopeCollection) (result FunctionEnvelopeCollection, err error) { + req, err := lastResults.functionEnvelopeCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceFunctionsSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListInstanceFunctionsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceFunctionsSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListInstanceFunctionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceFunctionsSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListInstanceFunctionsSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListInstanceFunctionsSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result FunctionEnvelopeCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceFunctionsSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListInstanceFunctionsSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListInstanceIdentifiers description for Gets all scale-out instances of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListInstanceIdentifiers(ctx context.Context, resourceGroupName string, name string) (result AppInstanceStatusCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceIdentifiers") + defer func() { + sc := -1 + if result.aisc.Response.Response != nil { + sc = result.aisc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListInstanceIdentifiers", err.Error()) + } + + result.fn = client.listInstanceIdentifiersNextResults + req, err := client.ListInstanceIdentifiersPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", nil, "Failure preparing request") + return + } + + resp, err := client.ListInstanceIdentifiersSender(req) + if err != nil { + result.aisc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", resp, "Failure sending request") + return + } + + result.aisc, err = client.ListInstanceIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", resp, "Failure responding to request") + return + } + if result.aisc.hasNextLink() && result.aisc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListInstanceIdentifiersPreparer prepares the ListInstanceIdentifiers request. +func (client AppsClient) ListInstanceIdentifiersPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListInstanceIdentifiersSender sends the ListInstanceIdentifiers request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceIdentifiersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListInstanceIdentifiersResponder handles the response to the ListInstanceIdentifiers request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceIdentifiersResponder(resp *http.Response) (result AppInstanceStatusCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listInstanceIdentifiersNextResults retrieves the next set of results, if any. +func (client AppsClient) listInstanceIdentifiersNextResults(ctx context.Context, lastResults AppInstanceStatusCollection) (result AppInstanceStatusCollection, err error) { + req, err := lastResults.appInstanceStatusCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceIdentifiersNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListInstanceIdentifiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceIdentifiersNextResults", resp, "Failure sending next results request") + } + result, err = client.ListInstanceIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceIdentifiersNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListInstanceIdentifiersComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListInstanceIdentifiersComplete(ctx context.Context, resourceGroupName string, name string) (result AppInstanceStatusCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceIdentifiers") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListInstanceIdentifiers(ctx, resourceGroupName, name) + return +} + +// ListInstanceIdentifiersSlot description for Gets all scale-out instances of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API gets the production slot instances. +func (client AppsClient) ListInstanceIdentifiersSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result AppInstanceStatusCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceIdentifiersSlot") + defer func() { + sc := -1 + if result.aisc.Response.Response != nil { + sc = result.aisc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListInstanceIdentifiersSlot", err.Error()) + } + + result.fn = client.listInstanceIdentifiersSlotNextResults + req, err := client.ListInstanceIdentifiersSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListInstanceIdentifiersSlotSender(req) + if err != nil { + result.aisc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", resp, "Failure sending request") + return + } + + result.aisc, err = client.ListInstanceIdentifiersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", resp, "Failure responding to request") + return + } + if result.aisc.hasNextLink() && result.aisc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListInstanceIdentifiersSlotPreparer prepares the ListInstanceIdentifiersSlot request. +func (client AppsClient) ListInstanceIdentifiersSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListInstanceIdentifiersSlotSender sends the ListInstanceIdentifiersSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceIdentifiersSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListInstanceIdentifiersSlotResponder handles the response to the ListInstanceIdentifiersSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceIdentifiersSlotResponder(resp *http.Response) (result AppInstanceStatusCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listInstanceIdentifiersSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listInstanceIdentifiersSlotNextResults(ctx context.Context, lastResults AppInstanceStatusCollection) (result AppInstanceStatusCollection, err error) { + req, err := lastResults.appInstanceStatusCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceIdentifiersSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListInstanceIdentifiersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceIdentifiersSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListInstanceIdentifiersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceIdentifiersSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListInstanceIdentifiersSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListInstanceIdentifiersSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result AppInstanceStatusCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceIdentifiersSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListInstanceIdentifiersSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListInstanceProcesses description for Get list of processes for a web site, or a deployment slot, or for a specific +// scaled-out instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// instanceID - ID of a specific scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances". +func (client AppsClient) ListInstanceProcesses(ctx context.Context, resourceGroupName string, name string, instanceID string) (result ProcessInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceProcesses") + defer func() { + sc := -1 + if result.pic.Response.Response != nil { + sc = result.pic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListInstanceProcesses", err.Error()) + } + + result.fn = client.listInstanceProcessesNextResults + req, err := client.ListInstanceProcessesPreparer(ctx, resourceGroupName, name, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcesses", nil, "Failure preparing request") + return + } + + resp, err := client.ListInstanceProcessesSender(req) + if err != nil { + result.pic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcesses", resp, "Failure sending request") + return + } + + result.pic, err = client.ListInstanceProcessesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcesses", resp, "Failure responding to request") + return + } + if result.pic.hasNextLink() && result.pic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListInstanceProcessesPreparer prepares the ListInstanceProcesses request. +func (client AppsClient) ListInstanceProcessesPreparer(ctx context.Context, resourceGroupName string, name string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListInstanceProcessesSender sends the ListInstanceProcesses request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceProcessesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListInstanceProcessesResponder handles the response to the ListInstanceProcesses request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceProcessesResponder(resp *http.Response) (result ProcessInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listInstanceProcessesNextResults retrieves the next set of results, if any. +func (client AppsClient) listInstanceProcessesNextResults(ctx context.Context, lastResults ProcessInfoCollection) (result ProcessInfoCollection, err error) { + req, err := lastResults.processInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListInstanceProcessesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListInstanceProcessesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListInstanceProcessesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListInstanceProcessesComplete(ctx context.Context, resourceGroupName string, name string, instanceID string) (result ProcessInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceProcesses") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListInstanceProcesses(ctx, resourceGroupName, name, instanceID) + return +} + +// ListInstanceProcessesSlot description for Get list of processes for a web site, or a deployment slot, or for a +// specific scaled-out instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +// instanceID - ID of a specific scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances". +func (client AppsClient) ListInstanceProcessesSlot(ctx context.Context, resourceGroupName string, name string, slot string, instanceID string) (result ProcessInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceProcessesSlot") + defer func() { + sc := -1 + if result.pic.Response.Response != nil { + sc = result.pic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListInstanceProcessesSlot", err.Error()) + } + + result.fn = client.listInstanceProcessesSlotNextResults + req, err := client.ListInstanceProcessesSlotPreparer(ctx, resourceGroupName, name, slot, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcessesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListInstanceProcessesSlotSender(req) + if err != nil { + result.pic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcessesSlot", resp, "Failure sending request") + return + } + + result.pic, err = client.ListInstanceProcessesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcessesSlot", resp, "Failure responding to request") + return + } + if result.pic.hasNextLink() && result.pic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListInstanceProcessesSlotPreparer prepares the ListInstanceProcessesSlot request. +func (client AppsClient) ListInstanceProcessesSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListInstanceProcessesSlotSender sends the ListInstanceProcessesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceProcessesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListInstanceProcessesSlotResponder handles the response to the ListInstanceProcessesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceProcessesSlotResponder(resp *http.Response) (result ProcessInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listInstanceProcessesSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listInstanceProcessesSlotNextResults(ctx context.Context, lastResults ProcessInfoCollection) (result ProcessInfoCollection, err error) { + req, err := lastResults.processInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessesSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListInstanceProcessesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessesSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListInstanceProcessesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessesSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListInstanceProcessesSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListInstanceProcessesSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string, instanceID string) (result ProcessInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceProcessesSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListInstanceProcessesSlot(ctx, resourceGroupName, name, slot, instanceID) + return +} + +// ListInstanceProcessModules description for List module information for a process by its ID for a specific scaled-out +// instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// instanceID - ID of a specific scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances". +func (client AppsClient) ListInstanceProcessModules(ctx context.Context, resourceGroupName string, name string, processID string, instanceID string) (result ProcessModuleInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceProcessModules") + defer func() { + sc := -1 + if result.pmic.Response.Response != nil { + sc = result.pmic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListInstanceProcessModules", err.Error()) + } + + result.fn = client.listInstanceProcessModulesNextResults + req, err := client.ListInstanceProcessModulesPreparer(ctx, resourceGroupName, name, processID, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcessModules", nil, "Failure preparing request") + return + } + + resp, err := client.ListInstanceProcessModulesSender(req) + if err != nil { + result.pmic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcessModules", resp, "Failure sending request") + return + } + + result.pmic, err = client.ListInstanceProcessModulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcessModules", resp, "Failure responding to request") + return + } + if result.pmic.hasNextLink() && result.pmic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListInstanceProcessModulesPreparer prepares the ListInstanceProcessModules request. +func (client AppsClient) ListInstanceProcessModulesPreparer(ctx context.Context, resourceGroupName string, name string, processID string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListInstanceProcessModulesSender sends the ListInstanceProcessModules request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceProcessModulesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListInstanceProcessModulesResponder handles the response to the ListInstanceProcessModules request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceProcessModulesResponder(resp *http.Response) (result ProcessModuleInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listInstanceProcessModulesNextResults retrieves the next set of results, if any. +func (client AppsClient) listInstanceProcessModulesNextResults(ctx context.Context, lastResults ProcessModuleInfoCollection) (result ProcessModuleInfoCollection, err error) { + req, err := lastResults.processModuleInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessModulesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListInstanceProcessModulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessModulesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListInstanceProcessModulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessModulesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListInstanceProcessModulesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListInstanceProcessModulesComplete(ctx context.Context, resourceGroupName string, name string, processID string, instanceID string) (result ProcessModuleInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceProcessModules") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListInstanceProcessModules(ctx, resourceGroupName, name, processID, instanceID) + return +} + +// ListInstanceProcessModulesSlot description for List module information for a process by its ID for a specific +// scaled-out instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +// instanceID - ID of a specific scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances". +func (client AppsClient) ListInstanceProcessModulesSlot(ctx context.Context, resourceGroupName string, name string, processID string, slot string, instanceID string) (result ProcessModuleInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceProcessModulesSlot") + defer func() { + sc := -1 + if result.pmic.Response.Response != nil { + sc = result.pmic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListInstanceProcessModulesSlot", err.Error()) + } + + result.fn = client.listInstanceProcessModulesSlotNextResults + req, err := client.ListInstanceProcessModulesSlotPreparer(ctx, resourceGroupName, name, processID, slot, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcessModulesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListInstanceProcessModulesSlotSender(req) + if err != nil { + result.pmic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcessModulesSlot", resp, "Failure sending request") + return + } + + result.pmic, err = client.ListInstanceProcessModulesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcessModulesSlot", resp, "Failure responding to request") + return + } + if result.pmic.hasNextLink() && result.pmic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListInstanceProcessModulesSlotPreparer prepares the ListInstanceProcessModulesSlot request. +func (client AppsClient) ListInstanceProcessModulesSlotPreparer(ctx context.Context, resourceGroupName string, name string, processID string, slot string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListInstanceProcessModulesSlotSender sends the ListInstanceProcessModulesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceProcessModulesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListInstanceProcessModulesSlotResponder handles the response to the ListInstanceProcessModulesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceProcessModulesSlotResponder(resp *http.Response) (result ProcessModuleInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listInstanceProcessModulesSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listInstanceProcessModulesSlotNextResults(ctx context.Context, lastResults ProcessModuleInfoCollection) (result ProcessModuleInfoCollection, err error) { + req, err := lastResults.processModuleInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessModulesSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListInstanceProcessModulesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessModulesSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListInstanceProcessModulesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessModulesSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListInstanceProcessModulesSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListInstanceProcessModulesSlotComplete(ctx context.Context, resourceGroupName string, name string, processID string, slot string, instanceID string) (result ProcessModuleInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceProcessModulesSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListInstanceProcessModulesSlot(ctx, resourceGroupName, name, processID, slot, instanceID) + return +} + +// ListInstanceProcessThreads description for List the threads in a process by its ID for a specific scaled-out +// instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// instanceID - ID of a specific scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances". +func (client AppsClient) ListInstanceProcessThreads(ctx context.Context, resourceGroupName string, name string, processID string, instanceID string) (result ProcessThreadInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceProcessThreads") + defer func() { + sc := -1 + if result.ptic.Response.Response != nil { + sc = result.ptic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListInstanceProcessThreads", err.Error()) + } + + result.fn = client.listInstanceProcessThreadsNextResults + req, err := client.ListInstanceProcessThreadsPreparer(ctx, resourceGroupName, name, processID, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcessThreads", nil, "Failure preparing request") + return + } + + resp, err := client.ListInstanceProcessThreadsSender(req) + if err != nil { + result.ptic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcessThreads", resp, "Failure sending request") + return + } + + result.ptic, err = client.ListInstanceProcessThreadsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcessThreads", resp, "Failure responding to request") + return + } + if result.ptic.hasNextLink() && result.ptic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListInstanceProcessThreadsPreparer prepares the ListInstanceProcessThreads request. +func (client AppsClient) ListInstanceProcessThreadsPreparer(ctx context.Context, resourceGroupName string, name string, processID string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/threads", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListInstanceProcessThreadsSender sends the ListInstanceProcessThreads request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceProcessThreadsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListInstanceProcessThreadsResponder handles the response to the ListInstanceProcessThreads request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceProcessThreadsResponder(resp *http.Response) (result ProcessThreadInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listInstanceProcessThreadsNextResults retrieves the next set of results, if any. +func (client AppsClient) listInstanceProcessThreadsNextResults(ctx context.Context, lastResults ProcessThreadInfoCollection) (result ProcessThreadInfoCollection, err error) { + req, err := lastResults.processThreadInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessThreadsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListInstanceProcessThreadsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessThreadsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListInstanceProcessThreadsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessThreadsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListInstanceProcessThreadsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListInstanceProcessThreadsComplete(ctx context.Context, resourceGroupName string, name string, processID string, instanceID string) (result ProcessThreadInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceProcessThreads") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListInstanceProcessThreads(ctx, resourceGroupName, name, processID, instanceID) + return +} + +// ListInstanceProcessThreadsSlot description for List the threads in a process by its ID for a specific scaled-out +// instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +// instanceID - ID of a specific scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances". +func (client AppsClient) ListInstanceProcessThreadsSlot(ctx context.Context, resourceGroupName string, name string, processID string, slot string, instanceID string) (result ProcessThreadInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceProcessThreadsSlot") + defer func() { + sc := -1 + if result.ptic.Response.Response != nil { + sc = result.ptic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListInstanceProcessThreadsSlot", err.Error()) + } + + result.fn = client.listInstanceProcessThreadsSlotNextResults + req, err := client.ListInstanceProcessThreadsSlotPreparer(ctx, resourceGroupName, name, processID, slot, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcessThreadsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListInstanceProcessThreadsSlotSender(req) + if err != nil { + result.ptic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcessThreadsSlot", resp, "Failure sending request") + return + } + + result.ptic, err = client.ListInstanceProcessThreadsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceProcessThreadsSlot", resp, "Failure responding to request") + return + } + if result.ptic.hasNextLink() && result.ptic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListInstanceProcessThreadsSlotPreparer prepares the ListInstanceProcessThreadsSlot request. +func (client AppsClient) ListInstanceProcessThreadsSlotPreparer(ctx context.Context, resourceGroupName string, name string, processID string, slot string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/threads", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListInstanceProcessThreadsSlotSender sends the ListInstanceProcessThreadsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceProcessThreadsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListInstanceProcessThreadsSlotResponder handles the response to the ListInstanceProcessThreadsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceProcessThreadsSlotResponder(resp *http.Response) (result ProcessThreadInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listInstanceProcessThreadsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listInstanceProcessThreadsSlotNextResults(ctx context.Context, lastResults ProcessThreadInfoCollection) (result ProcessThreadInfoCollection, err error) { + req, err := lastResults.processThreadInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessThreadsSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListInstanceProcessThreadsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessThreadsSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListInstanceProcessThreadsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listInstanceProcessThreadsSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListInstanceProcessThreadsSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListInstanceProcessThreadsSlotComplete(ctx context.Context, resourceGroupName string, name string, processID string, slot string, instanceID string) (result ProcessThreadInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListInstanceProcessThreadsSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListInstanceProcessThreadsSlot(ctx, resourceGroupName, name, processID, slot, instanceID) + return +} + +// ListMetadata description for Gets the metadata of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListMetadata(ctx context.Context, resourceGroupName string, name string) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListMetadata") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListMetadata", err.Error()) + } + + req, err := client.ListMetadataPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadata", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetadataSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadata", resp, "Failure sending request") + return + } + + result, err = client.ListMetadataResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadata", resp, "Failure responding to request") + return + } + + return +} + +// ListMetadataPreparer prepares the ListMetadata request. +func (client AppsClient) ListMetadataPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListMetadataSender sends the ListMetadata request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListMetadataSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListMetadataResponder handles the response to the ListMetadata request. The method always +// closes the http.Response Body. +func (client AppsClient) ListMetadataResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetadataSlot description for Gets the metadata of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get the metadata for the +// production slot. +func (client AppsClient) ListMetadataSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListMetadataSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListMetadataSlot", err.Error()) + } + + req, err := client.ListMetadataSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadataSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetadataSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadataSlot", resp, "Failure sending request") + return + } + + result, err = client.ListMetadataSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadataSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListMetadataSlotPreparer prepares the ListMetadataSlot request. +func (client AppsClient) ListMetadataSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListMetadataSlotSender sends the ListMetadataSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListMetadataSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListMetadataSlotResponder handles the response to the ListMetadataSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListMetadataSlotResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNetworkFeatures description for Gets all network features used by the app (or deployment slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// view - the type of view. Only "summary" is supported at this time. +func (client AppsClient) ListNetworkFeatures(ctx context.Context, resourceGroupName string, name string, view string) (result NetworkFeatures, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListNetworkFeatures") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListNetworkFeatures", err.Error()) + } + + req, err := client.ListNetworkFeaturesPreparer(ctx, resourceGroupName, name, view) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeatures", nil, "Failure preparing request") + return + } + + resp, err := client.ListNetworkFeaturesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeatures", resp, "Failure sending request") + return + } + + result, err = client.ListNetworkFeaturesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeatures", resp, "Failure responding to request") + return + } + + return +} + +// ListNetworkFeaturesPreparer prepares the ListNetworkFeatures request. +func (client AppsClient) ListNetworkFeaturesPreparer(ctx context.Context, resourceGroupName string, name string, view string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "view": autorest.Encode("path", view), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkFeatures/{view}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListNetworkFeaturesSender sends the ListNetworkFeatures request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListNetworkFeaturesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListNetworkFeaturesResponder handles the response to the ListNetworkFeatures request. The method always +// closes the http.Response Body. +func (client AppsClient) ListNetworkFeaturesResponder(resp *http.Response) (result NetworkFeatures, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNetworkFeaturesSlot description for Gets all network features used by the app (or deployment slot, if +// specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// view - the type of view. Only "summary" is supported at this time. +// slot - name of the deployment slot. If a slot is not specified, the API will get network features for the +// production slot. +func (client AppsClient) ListNetworkFeaturesSlot(ctx context.Context, resourceGroupName string, name string, view string, slot string) (result NetworkFeatures, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListNetworkFeaturesSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListNetworkFeaturesSlot", err.Error()) + } + + req, err := client.ListNetworkFeaturesSlotPreparer(ctx, resourceGroupName, name, view, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeaturesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListNetworkFeaturesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeaturesSlot", resp, "Failure sending request") + return + } + + result, err = client.ListNetworkFeaturesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeaturesSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListNetworkFeaturesSlotPreparer prepares the ListNetworkFeaturesSlot request. +func (client AppsClient) ListNetworkFeaturesSlotPreparer(ctx context.Context, resourceGroupName string, name string, view string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "view": autorest.Encode("path", view), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkFeatures/{view}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListNetworkFeaturesSlotSender sends the ListNetworkFeaturesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListNetworkFeaturesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListNetworkFeaturesSlotResponder handles the response to the ListNetworkFeaturesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListNetworkFeaturesSlotResponder(resp *http.Response) (result NetworkFeatures, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPerfMonCounters description for Gets perfmon counters for web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// filter - return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: +// $filter=(startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq +// duration'[Hour|Minute|Day]'. +func (client AppsClient) ListPerfMonCounters(ctx context.Context, resourceGroupName string, name string, filter string) (result PerfMonCounterCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListPerfMonCounters") + defer func() { + sc := -1 + if result.pmcc.Response.Response != nil { + sc = result.pmcc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListPerfMonCounters", err.Error()) + } + + result.fn = client.listPerfMonCountersNextResults + req, err := client.ListPerfMonCountersPreparer(ctx, resourceGroupName, name, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", nil, "Failure preparing request") + return + } + + resp, err := client.ListPerfMonCountersSender(req) + if err != nil { + result.pmcc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", resp, "Failure sending request") + return + } + + result.pmcc, err = client.ListPerfMonCountersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", resp, "Failure responding to request") + return + } + if result.pmcc.hasNextLink() && result.pmcc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPerfMonCountersPreparer prepares the ListPerfMonCounters request. +func (client AppsClient) ListPerfMonCountersPreparer(ctx context.Context, resourceGroupName string, name string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/perfcounters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPerfMonCountersSender sends the ListPerfMonCounters request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPerfMonCountersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListPerfMonCountersResponder handles the response to the ListPerfMonCounters request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPerfMonCountersResponder(resp *http.Response) (result PerfMonCounterCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listPerfMonCountersNextResults retrieves the next set of results, if any. +func (client AppsClient) listPerfMonCountersNextResults(ctx context.Context, lastResults PerfMonCounterCollection) (result PerfMonCounterCollection, err error) { + req, err := lastResults.perfMonCounterCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listPerfMonCountersNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListPerfMonCountersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listPerfMonCountersNextResults", resp, "Failure sending next results request") + } + result, err = client.ListPerfMonCountersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listPerfMonCountersNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListPerfMonCountersComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListPerfMonCountersComplete(ctx context.Context, resourceGroupName string, name string, filter string) (result PerfMonCounterCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListPerfMonCounters") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListPerfMonCounters(ctx, resourceGroupName, name, filter) + return +} + +// ListPerfMonCountersSlot description for Gets perfmon counters for web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of web app slot. If not specified then will default to production slot. +// filter - return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: +// $filter=(startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq +// duration'[Hour|Minute|Day]'. +func (client AppsClient) ListPerfMonCountersSlot(ctx context.Context, resourceGroupName string, name string, slot string, filter string) (result PerfMonCounterCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListPerfMonCountersSlot") + defer func() { + sc := -1 + if result.pmcc.Response.Response != nil { + sc = result.pmcc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListPerfMonCountersSlot", err.Error()) + } + + result.fn = client.listPerfMonCountersSlotNextResults + req, err := client.ListPerfMonCountersSlotPreparer(ctx, resourceGroupName, name, slot, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListPerfMonCountersSlotSender(req) + if err != nil { + result.pmcc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", resp, "Failure sending request") + return + } + + result.pmcc, err = client.ListPerfMonCountersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", resp, "Failure responding to request") + return + } + if result.pmcc.hasNextLink() && result.pmcc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPerfMonCountersSlotPreparer prepares the ListPerfMonCountersSlot request. +func (client AppsClient) ListPerfMonCountersSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/perfcounters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPerfMonCountersSlotSender sends the ListPerfMonCountersSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPerfMonCountersSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListPerfMonCountersSlotResponder handles the response to the ListPerfMonCountersSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPerfMonCountersSlotResponder(resp *http.Response) (result PerfMonCounterCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listPerfMonCountersSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listPerfMonCountersSlotNextResults(ctx context.Context, lastResults PerfMonCounterCollection) (result PerfMonCounterCollection, err error) { + req, err := lastResults.perfMonCounterCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listPerfMonCountersSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListPerfMonCountersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listPerfMonCountersSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListPerfMonCountersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listPerfMonCountersSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListPerfMonCountersSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListPerfMonCountersSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string, filter string) (result PerfMonCounterCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListPerfMonCountersSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListPerfMonCountersSlot(ctx, resourceGroupName, name, slot, filter) + return +} + +// ListPremierAddOns description for Gets the premier add-ons of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListPremierAddOns(ctx context.Context, resourceGroupName string, name string) (result PremierAddOn, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListPremierAddOns") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListPremierAddOns", err.Error()) + } + + req, err := client.ListPremierAddOnsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOns", nil, "Failure preparing request") + return + } + + resp, err := client.ListPremierAddOnsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOns", resp, "Failure sending request") + return + } + + result, err = client.ListPremierAddOnsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOns", resp, "Failure responding to request") + return + } + + return +} + +// ListPremierAddOnsPreparer prepares the ListPremierAddOns request. +func (client AppsClient) ListPremierAddOnsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPremierAddOnsSender sends the ListPremierAddOns request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPremierAddOnsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListPremierAddOnsResponder handles the response to the ListPremierAddOns request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPremierAddOnsResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPremierAddOnsSlot description for Gets the premier add-ons of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get the premier add-ons for the +// production slot. +func (client AppsClient) ListPremierAddOnsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result PremierAddOn, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListPremierAddOnsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListPremierAddOnsSlot", err.Error()) + } + + req, err := client.ListPremierAddOnsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOnsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListPremierAddOnsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOnsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListPremierAddOnsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOnsSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListPremierAddOnsSlotPreparer prepares the ListPremierAddOnsSlot request. +func (client AppsClient) ListPremierAddOnsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPremierAddOnsSlotSender sends the ListPremierAddOnsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPremierAddOnsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListPremierAddOnsSlotResponder handles the response to the ListPremierAddOnsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPremierAddOnsSlotResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListProcesses description for Get list of processes for a web site, or a deployment slot, or for a specific +// scaled-out instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +func (client AppsClient) ListProcesses(ctx context.Context, resourceGroupName string, name string) (result ProcessInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListProcesses") + defer func() { + sc := -1 + if result.pic.Response.Response != nil { + sc = result.pic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListProcesses", err.Error()) + } + + result.fn = client.listProcessesNextResults + req, err := client.ListProcessesPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcesses", nil, "Failure preparing request") + return + } + + resp, err := client.ListProcessesSender(req) + if err != nil { + result.pic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcesses", resp, "Failure sending request") + return + } + + result.pic, err = client.ListProcessesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcesses", resp, "Failure responding to request") + return + } + if result.pic.hasNextLink() && result.pic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListProcessesPreparer prepares the ListProcesses request. +func (client AppsClient) ListProcessesPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListProcessesSender sends the ListProcesses request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListProcessesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListProcessesResponder handles the response to the ListProcesses request. The method always +// closes the http.Response Body. +func (client AppsClient) ListProcessesResponder(resp *http.Response) (result ProcessInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listProcessesNextResults retrieves the next set of results, if any. +func (client AppsClient) listProcessesNextResults(ctx context.Context, lastResults ProcessInfoCollection) (result ProcessInfoCollection, err error) { + req, err := lastResults.processInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listProcessesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListProcessesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listProcessesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListProcessesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listProcessesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListProcessesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListProcessesComplete(ctx context.Context, resourceGroupName string, name string) (result ProcessInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListProcesses") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListProcesses(ctx, resourceGroupName, name) + return +} + +// ListProcessesSlot description for Get list of processes for a web site, or a deployment slot, or for a specific +// scaled-out instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +func (client AppsClient) ListProcessesSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result ProcessInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListProcessesSlot") + defer func() { + sc := -1 + if result.pic.Response.Response != nil { + sc = result.pic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListProcessesSlot", err.Error()) + } + + result.fn = client.listProcessesSlotNextResults + req, err := client.ListProcessesSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcessesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListProcessesSlotSender(req) + if err != nil { + result.pic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcessesSlot", resp, "Failure sending request") + return + } + + result.pic, err = client.ListProcessesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcessesSlot", resp, "Failure responding to request") + return + } + if result.pic.hasNextLink() && result.pic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListProcessesSlotPreparer prepares the ListProcessesSlot request. +func (client AppsClient) ListProcessesSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListProcessesSlotSender sends the ListProcessesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListProcessesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListProcessesSlotResponder handles the response to the ListProcessesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListProcessesSlotResponder(resp *http.Response) (result ProcessInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listProcessesSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listProcessesSlotNextResults(ctx context.Context, lastResults ProcessInfoCollection) (result ProcessInfoCollection, err error) { + req, err := lastResults.processInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listProcessesSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListProcessesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listProcessesSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListProcessesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listProcessesSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListProcessesSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListProcessesSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result ProcessInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListProcessesSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListProcessesSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListProcessModules description for List module information for a process by its ID for a specific scaled-out +// instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +func (client AppsClient) ListProcessModules(ctx context.Context, resourceGroupName string, name string, processID string) (result ProcessModuleInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListProcessModules") + defer func() { + sc := -1 + if result.pmic.Response.Response != nil { + sc = result.pmic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListProcessModules", err.Error()) + } + + result.fn = client.listProcessModulesNextResults + req, err := client.ListProcessModulesPreparer(ctx, resourceGroupName, name, processID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcessModules", nil, "Failure preparing request") + return + } + + resp, err := client.ListProcessModulesSender(req) + if err != nil { + result.pmic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcessModules", resp, "Failure sending request") + return + } + + result.pmic, err = client.ListProcessModulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcessModules", resp, "Failure responding to request") + return + } + if result.pmic.hasNextLink() && result.pmic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListProcessModulesPreparer prepares the ListProcessModules request. +func (client AppsClient) ListProcessModulesPreparer(ctx context.Context, resourceGroupName string, name string, processID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListProcessModulesSender sends the ListProcessModules request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListProcessModulesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListProcessModulesResponder handles the response to the ListProcessModules request. The method always +// closes the http.Response Body. +func (client AppsClient) ListProcessModulesResponder(resp *http.Response) (result ProcessModuleInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listProcessModulesNextResults retrieves the next set of results, if any. +func (client AppsClient) listProcessModulesNextResults(ctx context.Context, lastResults ProcessModuleInfoCollection) (result ProcessModuleInfoCollection, err error) { + req, err := lastResults.processModuleInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listProcessModulesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListProcessModulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listProcessModulesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListProcessModulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listProcessModulesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListProcessModulesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListProcessModulesComplete(ctx context.Context, resourceGroupName string, name string, processID string) (result ProcessModuleInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListProcessModules") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListProcessModules(ctx, resourceGroupName, name, processID) + return +} + +// ListProcessModulesSlot description for List module information for a process by its ID for a specific scaled-out +// instance in a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +func (client AppsClient) ListProcessModulesSlot(ctx context.Context, resourceGroupName string, name string, processID string, slot string) (result ProcessModuleInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListProcessModulesSlot") + defer func() { + sc := -1 + if result.pmic.Response.Response != nil { + sc = result.pmic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListProcessModulesSlot", err.Error()) + } + + result.fn = client.listProcessModulesSlotNextResults + req, err := client.ListProcessModulesSlotPreparer(ctx, resourceGroupName, name, processID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcessModulesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListProcessModulesSlotSender(req) + if err != nil { + result.pmic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcessModulesSlot", resp, "Failure sending request") + return + } + + result.pmic, err = client.ListProcessModulesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcessModulesSlot", resp, "Failure responding to request") + return + } + if result.pmic.hasNextLink() && result.pmic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListProcessModulesSlotPreparer prepares the ListProcessModulesSlot request. +func (client AppsClient) ListProcessModulesSlotPreparer(ctx context.Context, resourceGroupName string, name string, processID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListProcessModulesSlotSender sends the ListProcessModulesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListProcessModulesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListProcessModulesSlotResponder handles the response to the ListProcessModulesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListProcessModulesSlotResponder(resp *http.Response) (result ProcessModuleInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listProcessModulesSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listProcessModulesSlotNextResults(ctx context.Context, lastResults ProcessModuleInfoCollection) (result ProcessModuleInfoCollection, err error) { + req, err := lastResults.processModuleInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listProcessModulesSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListProcessModulesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listProcessModulesSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListProcessModulesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listProcessModulesSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListProcessModulesSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListProcessModulesSlotComplete(ctx context.Context, resourceGroupName string, name string, processID string, slot string) (result ProcessModuleInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListProcessModulesSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListProcessModulesSlot(ctx, resourceGroupName, name, processID, slot) + return +} + +// ListProcessThreads description for List the threads in a process by its ID for a specific scaled-out instance in a +// web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +func (client AppsClient) ListProcessThreads(ctx context.Context, resourceGroupName string, name string, processID string) (result ProcessThreadInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListProcessThreads") + defer func() { + sc := -1 + if result.ptic.Response.Response != nil { + sc = result.ptic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListProcessThreads", err.Error()) + } + + result.fn = client.listProcessThreadsNextResults + req, err := client.ListProcessThreadsPreparer(ctx, resourceGroupName, name, processID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcessThreads", nil, "Failure preparing request") + return + } + + resp, err := client.ListProcessThreadsSender(req) + if err != nil { + result.ptic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcessThreads", resp, "Failure sending request") + return + } + + result.ptic, err = client.ListProcessThreadsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcessThreads", resp, "Failure responding to request") + return + } + if result.ptic.hasNextLink() && result.ptic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListProcessThreadsPreparer prepares the ListProcessThreads request. +func (client AppsClient) ListProcessThreadsPreparer(ctx context.Context, resourceGroupName string, name string, processID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/threads", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListProcessThreadsSender sends the ListProcessThreads request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListProcessThreadsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListProcessThreadsResponder handles the response to the ListProcessThreads request. The method always +// closes the http.Response Body. +func (client AppsClient) ListProcessThreadsResponder(resp *http.Response) (result ProcessThreadInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listProcessThreadsNextResults retrieves the next set of results, if any. +func (client AppsClient) listProcessThreadsNextResults(ctx context.Context, lastResults ProcessThreadInfoCollection) (result ProcessThreadInfoCollection, err error) { + req, err := lastResults.processThreadInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listProcessThreadsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListProcessThreadsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listProcessThreadsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListProcessThreadsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listProcessThreadsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListProcessThreadsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListProcessThreadsComplete(ctx context.Context, resourceGroupName string, name string, processID string) (result ProcessThreadInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListProcessThreads") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListProcessThreads(ctx, resourceGroupName, name, processID) + return +} + +// ListProcessThreadsSlot description for List the threads in a process by its ID for a specific scaled-out instance in +// a web site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// processID - pID. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +func (client AppsClient) ListProcessThreadsSlot(ctx context.Context, resourceGroupName string, name string, processID string, slot string) (result ProcessThreadInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListProcessThreadsSlot") + defer func() { + sc := -1 + if result.ptic.Response.Response != nil { + sc = result.ptic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListProcessThreadsSlot", err.Error()) + } + + result.fn = client.listProcessThreadsSlotNextResults + req, err := client.ListProcessThreadsSlotPreparer(ctx, resourceGroupName, name, processID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcessThreadsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListProcessThreadsSlotSender(req) + if err != nil { + result.ptic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcessThreadsSlot", resp, "Failure sending request") + return + } + + result.ptic, err = client.ListProcessThreadsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListProcessThreadsSlot", resp, "Failure responding to request") + return + } + if result.ptic.hasNextLink() && result.ptic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListProcessThreadsSlotPreparer prepares the ListProcessThreadsSlot request. +func (client AppsClient) ListProcessThreadsSlotPreparer(ctx context.Context, resourceGroupName string, name string, processID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "processId": autorest.Encode("path", processID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/threads", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListProcessThreadsSlotSender sends the ListProcessThreadsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListProcessThreadsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListProcessThreadsSlotResponder handles the response to the ListProcessThreadsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListProcessThreadsSlotResponder(resp *http.Response) (result ProcessThreadInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listProcessThreadsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listProcessThreadsSlotNextResults(ctx context.Context, lastResults ProcessThreadInfoCollection) (result ProcessThreadInfoCollection, err error) { + req, err := lastResults.processThreadInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listProcessThreadsSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListProcessThreadsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listProcessThreadsSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListProcessThreadsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listProcessThreadsSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListProcessThreadsSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListProcessThreadsSlotComplete(ctx context.Context, resourceGroupName string, name string, processID string, slot string) (result ProcessThreadInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListProcessThreadsSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListProcessThreadsSlot(ctx, resourceGroupName, name, processID, slot) + return +} + +// ListPublicCertificates description for Get public certificates for an app or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListPublicCertificates(ctx context.Context, resourceGroupName string, name string) (result PublicCertificateCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListPublicCertificates") + defer func() { + sc := -1 + if result.pcc.Response.Response != nil { + sc = result.pcc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListPublicCertificates", err.Error()) + } + + result.fn = client.listPublicCertificatesNextResults + req, err := client.ListPublicCertificatesPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublicCertificates", nil, "Failure preparing request") + return + } + + resp, err := client.ListPublicCertificatesSender(req) + if err != nil { + result.pcc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublicCertificates", resp, "Failure sending request") + return + } + + result.pcc, err = client.ListPublicCertificatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublicCertificates", resp, "Failure responding to request") + return + } + if result.pcc.hasNextLink() && result.pcc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPublicCertificatesPreparer prepares the ListPublicCertificates request. +func (client AppsClient) ListPublicCertificatesPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPublicCertificatesSender sends the ListPublicCertificates request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPublicCertificatesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListPublicCertificatesResponder handles the response to the ListPublicCertificates request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPublicCertificatesResponder(resp *http.Response) (result PublicCertificateCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listPublicCertificatesNextResults retrieves the next set of results, if any. +func (client AppsClient) listPublicCertificatesNextResults(ctx context.Context, lastResults PublicCertificateCollection) (result PublicCertificateCollection, err error) { + req, err := lastResults.publicCertificateCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listPublicCertificatesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListPublicCertificatesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listPublicCertificatesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListPublicCertificatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listPublicCertificatesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListPublicCertificatesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListPublicCertificatesComplete(ctx context.Context, resourceGroupName string, name string) (result PublicCertificateCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListPublicCertificates") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListPublicCertificates(ctx, resourceGroupName, name) + return +} + +// ListPublicCertificatesSlot description for Get public certificates for an app or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API gets hostname bindings for the +// production slot. +func (client AppsClient) ListPublicCertificatesSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result PublicCertificateCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListPublicCertificatesSlot") + defer func() { + sc := -1 + if result.pcc.Response.Response != nil { + sc = result.pcc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListPublicCertificatesSlot", err.Error()) + } + + result.fn = client.listPublicCertificatesSlotNextResults + req, err := client.ListPublicCertificatesSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublicCertificatesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListPublicCertificatesSlotSender(req) + if err != nil { + result.pcc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublicCertificatesSlot", resp, "Failure sending request") + return + } + + result.pcc, err = client.ListPublicCertificatesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublicCertificatesSlot", resp, "Failure responding to request") + return + } + if result.pcc.hasNextLink() && result.pcc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPublicCertificatesSlotPreparer prepares the ListPublicCertificatesSlot request. +func (client AppsClient) ListPublicCertificatesSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPublicCertificatesSlotSender sends the ListPublicCertificatesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPublicCertificatesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListPublicCertificatesSlotResponder handles the response to the ListPublicCertificatesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPublicCertificatesSlotResponder(resp *http.Response) (result PublicCertificateCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listPublicCertificatesSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listPublicCertificatesSlotNextResults(ctx context.Context, lastResults PublicCertificateCollection) (result PublicCertificateCollection, err error) { + req, err := lastResults.publicCertificateCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listPublicCertificatesSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListPublicCertificatesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listPublicCertificatesSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListPublicCertificatesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listPublicCertificatesSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListPublicCertificatesSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListPublicCertificatesSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result PublicCertificateCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListPublicCertificatesSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListPublicCertificatesSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListPublishingCredentials description for Gets the Git/FTP publishing credentials of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListPublishingCredentials(ctx context.Context, resourceGroupName string, name string) (result AppsListPublishingCredentialsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListPublishingCredentials") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListPublishingCredentials", err.Error()) + } + + req, err := client.ListPublishingCredentialsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentials", nil, "Failure preparing request") + return + } + + result, err = client.ListPublishingCredentialsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentials", result.Response(), "Failure sending request") + return + } + + return +} + +// ListPublishingCredentialsPreparer prepares the ListPublishingCredentials request. +func (client AppsClient) ListPublishingCredentialsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPublishingCredentialsSender sends the ListPublishingCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPublishingCredentialsSender(req *http.Request) (future AppsListPublishingCredentialsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ListPublishingCredentialsResponder handles the response to the ListPublishingCredentials request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPublishingCredentialsResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPublishingCredentialsSlot description for Gets the Git/FTP publishing credentials of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get the publishing credentials +// for the production slot. +func (client AppsClient) ListPublishingCredentialsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result AppsListPublishingCredentialsSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListPublishingCredentialsSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListPublishingCredentialsSlot", err.Error()) + } + + req, err := client.ListPublishingCredentialsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentialsSlot", nil, "Failure preparing request") + return + } + + result, err = client.ListPublishingCredentialsSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentialsSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// ListPublishingCredentialsSlotPreparer prepares the ListPublishingCredentialsSlot request. +func (client AppsClient) ListPublishingCredentialsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPublishingCredentialsSlotSender sends the ListPublishingCredentialsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPublishingCredentialsSlotSender(req *http.Request) (future AppsListPublishingCredentialsSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ListPublishingCredentialsSlotResponder handles the response to the ListPublishingCredentialsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPublishingCredentialsSlotResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPublishingProfileXMLWithSecrets description for Gets the publishing profile for an app (or deployment slot, if +// specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// publishingProfileOptions - specifies publishingProfileOptions for publishing profile. For example, use +// {"format": "FileZilla3"} to get a FileZilla publishing profile. +func (client AppsClient) ListPublishingProfileXMLWithSecrets(ctx context.Context, resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListPublishingProfileXMLWithSecrets") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListPublishingProfileXMLWithSecrets", err.Error()) + } + + req, err := client.ListPublishingProfileXMLWithSecretsPreparer(ctx, resourceGroupName, name, publishingProfileOptions) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecrets", nil, "Failure preparing request") + return + } + + resp, err := client.ListPublishingProfileXMLWithSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecrets", resp, "Failure sending request") + return + } + + result, err = client.ListPublishingProfileXMLWithSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecrets", resp, "Failure responding to request") + return + } + + return +} + +// ListPublishingProfileXMLWithSecretsPreparer prepares the ListPublishingProfileXMLWithSecrets request. +func (client AppsClient) ListPublishingProfileXMLWithSecretsPreparer(ctx context.Context, resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publishxml", pathParameters), + autorest.WithJSON(publishingProfileOptions), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPublishingProfileXMLWithSecretsSender sends the ListPublishingProfileXMLWithSecrets request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPublishingProfileXMLWithSecretsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListPublishingProfileXMLWithSecretsResponder handles the response to the ListPublishingProfileXMLWithSecrets request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPublishingProfileXMLWithSecretsResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPublishingProfileXMLWithSecretsSlot description for Gets the publishing profile for an app (or deployment slot, +// if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// publishingProfileOptions - specifies publishingProfileOptions for publishing profile. For example, use +// {"format": "FileZilla3"} to get a FileZilla publishing profile. +// slot - name of the deployment slot. If a slot is not specified, the API will get the publishing profile for +// the production slot. +func (client AppsClient) ListPublishingProfileXMLWithSecretsSlot(ctx context.Context, resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions, slot string) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListPublishingProfileXMLWithSecretsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot", err.Error()) + } + + req, err := client.ListPublishingProfileXMLWithSecretsSlotPreparer(ctx, resourceGroupName, name, publishingProfileOptions, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListPublishingProfileXMLWithSecretsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListPublishingProfileXMLWithSecretsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListPublishingProfileXMLWithSecretsSlotPreparer prepares the ListPublishingProfileXMLWithSecretsSlot request. +func (client AppsClient) ListPublishingProfileXMLWithSecretsSlotPreparer(ctx context.Context, resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publishxml", pathParameters), + autorest.WithJSON(publishingProfileOptions), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPublishingProfileXMLWithSecretsSlotSender sends the ListPublishingProfileXMLWithSecretsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPublishingProfileXMLWithSecretsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListPublishingProfileXMLWithSecretsSlotResponder handles the response to the ListPublishingProfileXMLWithSecretsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPublishingProfileXMLWithSecretsSlotResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRelayServiceConnections description for Gets hybrid connections configured for an app (or deployment slot, if +// specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListRelayServiceConnections(ctx context.Context, resourceGroupName string, name string) (result RelayServiceConnectionEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListRelayServiceConnections") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListRelayServiceConnections", err.Error()) + } + + req, err := client.ListRelayServiceConnectionsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnections", nil, "Failure preparing request") + return + } + + resp, err := client.ListRelayServiceConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnections", resp, "Failure sending request") + return + } + + result, err = client.ListRelayServiceConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnections", resp, "Failure responding to request") + return + } + + return +} + +// ListRelayServiceConnectionsPreparer prepares the ListRelayServiceConnections request. +func (client AppsClient) ListRelayServiceConnectionsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRelayServiceConnectionsSender sends the ListRelayServiceConnections request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListRelayServiceConnectionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListRelayServiceConnectionsResponder handles the response to the ListRelayServiceConnections request. The method always +// closes the http.Response Body. +func (client AppsClient) ListRelayServiceConnectionsResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRelayServiceConnectionsSlot description for Gets hybrid connections configured for an app (or deployment slot, +// if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get hybrid connections for the +// production slot. +func (client AppsClient) ListRelayServiceConnectionsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result RelayServiceConnectionEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListRelayServiceConnectionsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListRelayServiceConnectionsSlot", err.Error()) + } + + req, err := client.ListRelayServiceConnectionsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnectionsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListRelayServiceConnectionsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnectionsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListRelayServiceConnectionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnectionsSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListRelayServiceConnectionsSlotPreparer prepares the ListRelayServiceConnectionsSlot request. +func (client AppsClient) ListRelayServiceConnectionsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRelayServiceConnectionsSlotSender sends the ListRelayServiceConnectionsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListRelayServiceConnectionsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListRelayServiceConnectionsSlotResponder handles the response to the ListRelayServiceConnectionsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListRelayServiceConnectionsSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSiteBackups description for Gets existing backups of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListSiteBackups(ctx context.Context, resourceGroupName string, name string) (result BackupItemCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSiteBackups") + defer func() { + sc := -1 + if result.bic.Response.Response != nil { + sc = result.bic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSiteBackups", err.Error()) + } + + result.fn = client.listSiteBackupsNextResults + req, err := client.ListSiteBackupsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSiteBackups", nil, "Failure preparing request") + return + } + + resp, err := client.ListSiteBackupsSender(req) + if err != nil { + result.bic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSiteBackups", resp, "Failure sending request") + return + } + + result.bic, err = client.ListSiteBackupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSiteBackups", resp, "Failure responding to request") + return + } + if result.bic.hasNextLink() && result.bic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSiteBackupsPreparer prepares the ListSiteBackups request. +func (client AppsClient) ListSiteBackupsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/listbackups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSiteBackupsSender sends the ListSiteBackups request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSiteBackupsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSiteBackupsResponder handles the response to the ListSiteBackups request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSiteBackupsResponder(resp *http.Response) (result BackupItemCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSiteBackupsNextResults retrieves the next set of results, if any. +func (client AppsClient) listSiteBackupsNextResults(ctx context.Context, lastResults BackupItemCollection) (result BackupItemCollection, err error) { + req, err := lastResults.backupItemCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSiteBackupsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSiteBackupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSiteBackupsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSiteBackupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listSiteBackupsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSiteBackupsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListSiteBackupsComplete(ctx context.Context, resourceGroupName string, name string) (result BackupItemCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSiteBackups") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSiteBackups(ctx, resourceGroupName, name) + return +} + +// ListSiteBackupsSlot description for Gets existing backups of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get backups of the production +// slot. +func (client AppsClient) ListSiteBackupsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result BackupItemCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSiteBackupsSlot") + defer func() { + sc := -1 + if result.bic.Response.Response != nil { + sc = result.bic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSiteBackupsSlot", err.Error()) + } + + result.fn = client.listSiteBackupsSlotNextResults + req, err := client.ListSiteBackupsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSiteBackupsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListSiteBackupsSlotSender(req) + if err != nil { + result.bic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSiteBackupsSlot", resp, "Failure sending request") + return + } + + result.bic, err = client.ListSiteBackupsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSiteBackupsSlot", resp, "Failure responding to request") + return + } + if result.bic.hasNextLink() && result.bic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSiteBackupsSlotPreparer prepares the ListSiteBackupsSlot request. +func (client AppsClient) ListSiteBackupsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/listbackups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSiteBackupsSlotSender sends the ListSiteBackupsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSiteBackupsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSiteBackupsSlotResponder handles the response to the ListSiteBackupsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSiteBackupsSlotResponder(resp *http.Response) (result BackupItemCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSiteBackupsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listSiteBackupsSlotNextResults(ctx context.Context, lastResults BackupItemCollection) (result BackupItemCollection, err error) { + req, err := lastResults.backupItemCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSiteBackupsSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSiteBackupsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSiteBackupsSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSiteBackupsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listSiteBackupsSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSiteBackupsSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListSiteBackupsSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result BackupItemCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSiteBackupsSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSiteBackupsSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListSiteExtensions description for Get list of siteextensions for a web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +func (client AppsClient) ListSiteExtensions(ctx context.Context, resourceGroupName string, name string) (result SiteExtensionInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSiteExtensions") + defer func() { + sc := -1 + if result.seic.Response.Response != nil { + sc = result.seic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSiteExtensions", err.Error()) + } + + result.fn = client.listSiteExtensionsNextResults + req, err := client.ListSiteExtensionsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSiteExtensions", nil, "Failure preparing request") + return + } + + resp, err := client.ListSiteExtensionsSender(req) + if err != nil { + result.seic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSiteExtensions", resp, "Failure sending request") + return + } + + result.seic, err = client.ListSiteExtensionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSiteExtensions", resp, "Failure responding to request") + return + } + if result.seic.hasNextLink() && result.seic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSiteExtensionsPreparer prepares the ListSiteExtensions request. +func (client AppsClient) ListSiteExtensionsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSiteExtensionsSender sends the ListSiteExtensions request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSiteExtensionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSiteExtensionsResponder handles the response to the ListSiteExtensions request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSiteExtensionsResponder(resp *http.Response) (result SiteExtensionInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSiteExtensionsNextResults retrieves the next set of results, if any. +func (client AppsClient) listSiteExtensionsNextResults(ctx context.Context, lastResults SiteExtensionInfoCollection) (result SiteExtensionInfoCollection, err error) { + req, err := lastResults.siteExtensionInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSiteExtensionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSiteExtensionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSiteExtensionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSiteExtensionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listSiteExtensionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSiteExtensionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListSiteExtensionsComplete(ctx context.Context, resourceGroupName string, name string) (result SiteExtensionInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSiteExtensions") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSiteExtensions(ctx, resourceGroupName, name) + return +} + +// ListSiteExtensionsSlot description for Get list of siteextensions for a web site, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// slot - name of the deployment slot. If a slot is not specified, the API uses the production slot. +func (client AppsClient) ListSiteExtensionsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result SiteExtensionInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSiteExtensionsSlot") + defer func() { + sc := -1 + if result.seic.Response.Response != nil { + sc = result.seic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSiteExtensionsSlot", err.Error()) + } + + result.fn = client.listSiteExtensionsSlotNextResults + req, err := client.ListSiteExtensionsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSiteExtensionsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListSiteExtensionsSlotSender(req) + if err != nil { + result.seic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSiteExtensionsSlot", resp, "Failure sending request") + return + } + + result.seic, err = client.ListSiteExtensionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSiteExtensionsSlot", resp, "Failure responding to request") + return + } + if result.seic.hasNextLink() && result.seic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSiteExtensionsSlotPreparer prepares the ListSiteExtensionsSlot request. +func (client AppsClient) ListSiteExtensionsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSiteExtensionsSlotSender sends the ListSiteExtensionsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSiteExtensionsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSiteExtensionsSlotResponder handles the response to the ListSiteExtensionsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSiteExtensionsSlotResponder(resp *http.Response) (result SiteExtensionInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSiteExtensionsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listSiteExtensionsSlotNextResults(ctx context.Context, lastResults SiteExtensionInfoCollection) (result SiteExtensionInfoCollection, err error) { + req, err := lastResults.siteExtensionInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSiteExtensionsSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSiteExtensionsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSiteExtensionsSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSiteExtensionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listSiteExtensionsSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSiteExtensionsSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListSiteExtensionsSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result SiteExtensionInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSiteExtensionsSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSiteExtensionsSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListSitePushSettings description for Gets the Push settings associated with web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +func (client AppsClient) ListSitePushSettings(ctx context.Context, resourceGroupName string, name string) (result PushSettings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSitePushSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSitePushSettings", err.Error()) + } + + req, err := client.ListSitePushSettingsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettings", nil, "Failure preparing request") + return + } + + resp, err := client.ListSitePushSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettings", resp, "Failure sending request") + return + } + + result, err = client.ListSitePushSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettings", resp, "Failure responding to request") + return + } + + return +} + +// ListSitePushSettingsPreparer prepares the ListSitePushSettings request. +func (client AppsClient) ListSitePushSettingsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSitePushSettingsSender sends the ListSitePushSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSitePushSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSitePushSettingsResponder handles the response to the ListSitePushSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSitePushSettingsResponder(resp *http.Response) (result PushSettings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSitePushSettingsSlot description for Gets the Push settings associated with web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of web app slot. If not specified then will default to production slot. +func (client AppsClient) ListSitePushSettingsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result PushSettings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSitePushSettingsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSitePushSettingsSlot", err.Error()) + } + + req, err := client.ListSitePushSettingsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettingsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListSitePushSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettingsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListSitePushSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettingsSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListSitePushSettingsSlotPreparer prepares the ListSitePushSettingsSlot request. +func (client AppsClient) ListSitePushSettingsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSitePushSettingsSlotSender sends the ListSitePushSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSitePushSettingsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSitePushSettingsSlotResponder handles the response to the ListSitePushSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSitePushSettingsSlotResponder(resp *http.Response) (result PushSettings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSlotConfigurationNames description for Gets the names of app settings and connection strings that stick to the +// slot (not swapped). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListSlotConfigurationNames(ctx context.Context, resourceGroupName string, name string) (result SlotConfigNamesResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSlotConfigurationNames") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSlotConfigurationNames", err.Error()) + } + + req, err := client.ListSlotConfigurationNamesPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotConfigurationNames", nil, "Failure preparing request") + return + } + + resp, err := client.ListSlotConfigurationNamesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotConfigurationNames", resp, "Failure sending request") + return + } + + result, err = client.ListSlotConfigurationNamesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotConfigurationNames", resp, "Failure responding to request") + return + } + + return +} + +// ListSlotConfigurationNamesPreparer prepares the ListSlotConfigurationNames request. +func (client AppsClient) ListSlotConfigurationNamesPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSlotConfigurationNamesSender sends the ListSlotConfigurationNames request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSlotConfigurationNamesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSlotConfigurationNamesResponder handles the response to the ListSlotConfigurationNames request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSlotConfigurationNamesResponder(resp *http.Response) (result SlotConfigNamesResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSlotDifferencesFromProduction description for Get the difference in configuration settings between two web app +// slots. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slotSwapEntity - JSON object that contains the target slot name. See example. +func (client AppsClient) ListSlotDifferencesFromProduction(ctx context.Context, resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (result SlotDifferenceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSlotDifferencesFromProduction") + defer func() { + sc := -1 + if result.sdc.Response.Response != nil { + sc = result.sdc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSlotDifferencesFromProduction", err.Error()) + } + + result.fn = client.listSlotDifferencesFromProductionNextResults + req, err := client.ListSlotDifferencesFromProductionPreparer(ctx, resourceGroupName, name, slotSwapEntity) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", nil, "Failure preparing request") + return + } + + resp, err := client.ListSlotDifferencesFromProductionSender(req) + if err != nil { + result.sdc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", resp, "Failure sending request") + return + } + + result.sdc, err = client.ListSlotDifferencesFromProductionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", resp, "Failure responding to request") + return + } + if result.sdc.hasNextLink() && result.sdc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSlotDifferencesFromProductionPreparer prepares the ListSlotDifferencesFromProduction request. +func (client AppsClient) ListSlotDifferencesFromProductionPreparer(ctx context.Context, resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsdiffs", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSlotDifferencesFromProductionSender sends the ListSlotDifferencesFromProduction request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSlotDifferencesFromProductionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSlotDifferencesFromProductionResponder handles the response to the ListSlotDifferencesFromProduction request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSlotDifferencesFromProductionResponder(resp *http.Response) (result SlotDifferenceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSlotDifferencesFromProductionNextResults retrieves the next set of results, if any. +func (client AppsClient) listSlotDifferencesFromProductionNextResults(ctx context.Context, lastResults SlotDifferenceCollection) (result SlotDifferenceCollection, err error) { + req, err := lastResults.slotDifferenceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSlotDifferencesFromProductionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSlotDifferencesFromProductionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSlotDifferencesFromProductionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSlotDifferencesFromProductionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listSlotDifferencesFromProductionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSlotDifferencesFromProductionComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListSlotDifferencesFromProductionComplete(ctx context.Context, resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (result SlotDifferenceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSlotDifferencesFromProduction") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSlotDifferencesFromProduction(ctx, resourceGroupName, name, slotSwapEntity) + return +} + +// ListSlotDifferencesSlot description for Get the difference in configuration settings between two web app slots. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slotSwapEntity - JSON object that contains the target slot name. See example. +// slot - name of the source slot. If a slot is not specified, the production slot is used as the source slot. +func (client AppsClient) ListSlotDifferencesSlot(ctx context.Context, resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (result SlotDifferenceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSlotDifferencesSlot") + defer func() { + sc := -1 + if result.sdc.Response.Response != nil { + sc = result.sdc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSlotDifferencesSlot", err.Error()) + } + + result.fn = client.listSlotDifferencesSlotNextResults + req, err := client.ListSlotDifferencesSlotPreparer(ctx, resourceGroupName, name, slotSwapEntity, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListSlotDifferencesSlotSender(req) + if err != nil { + result.sdc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", resp, "Failure sending request") + return + } + + result.sdc, err = client.ListSlotDifferencesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", resp, "Failure responding to request") + return + } + if result.sdc.hasNextLink() && result.sdc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSlotDifferencesSlotPreparer prepares the ListSlotDifferencesSlot request. +func (client AppsClient) ListSlotDifferencesSlotPreparer(ctx context.Context, resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsdiffs", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSlotDifferencesSlotSender sends the ListSlotDifferencesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSlotDifferencesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSlotDifferencesSlotResponder handles the response to the ListSlotDifferencesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSlotDifferencesSlotResponder(resp *http.Response) (result SlotDifferenceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSlotDifferencesSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listSlotDifferencesSlotNextResults(ctx context.Context, lastResults SlotDifferenceCollection) (result SlotDifferenceCollection, err error) { + req, err := lastResults.slotDifferenceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSlotDifferencesSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSlotDifferencesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSlotDifferencesSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSlotDifferencesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listSlotDifferencesSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSlotDifferencesSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListSlotDifferencesSlotComplete(ctx context.Context, resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (result SlotDifferenceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSlotDifferencesSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSlotDifferencesSlot(ctx, resourceGroupName, name, slotSwapEntity, slot) + return +} + +// ListSlots description for Gets an app's deployment slots. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListSlots(ctx context.Context, resourceGroupName string, name string) (result AppCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSlots") + defer func() { + sc := -1 + if result.ac.Response.Response != nil { + sc = result.ac.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSlots", err.Error()) + } + + result.fn = client.listSlotsNextResults + req, err := client.ListSlotsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", nil, "Failure preparing request") + return + } + + resp, err := client.ListSlotsSender(req) + if err != nil { + result.ac.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", resp, "Failure sending request") + return + } + + result.ac, err = client.ListSlotsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", resp, "Failure responding to request") + return + } + if result.ac.hasNextLink() && result.ac.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSlotsPreparer prepares the ListSlots request. +func (client AppsClient) ListSlotsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSlotsSender sends the ListSlots request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSlotsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSlotsResponder handles the response to the ListSlots request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSlotsResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSlotsNextResults retrieves the next set of results, if any. +func (client AppsClient) listSlotsNextResults(ctx context.Context, lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.appCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSlotsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSlotsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSlotsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSlotsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listSlotsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSlotsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListSlotsComplete(ctx context.Context, resourceGroupName string, name string) (result AppCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSlots") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSlots(ctx, resourceGroupName, name) + return +} + +// ListSnapshots description for Returns all Snapshots to the user. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - website Name. +func (client AppsClient) ListSnapshots(ctx context.Context, resourceGroupName string, name string) (result SnapshotCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSnapshots") + defer func() { + sc := -1 + if result.sc.Response.Response != nil { + sc = result.sc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSnapshots", err.Error()) + } + + result.fn = client.listSnapshotsNextResults + req, err := client.ListSnapshotsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", nil, "Failure preparing request") + return + } + + resp, err := client.ListSnapshotsSender(req) + if err != nil { + result.sc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", resp, "Failure sending request") + return + } + + result.sc, err = client.ListSnapshotsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", resp, "Failure responding to request") + return + } + if result.sc.hasNextLink() && result.sc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSnapshotsPreparer prepares the ListSnapshots request. +func (client AppsClient) ListSnapshotsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSnapshotsSender sends the ListSnapshots request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSnapshotsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSnapshotsResponder handles the response to the ListSnapshots request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSnapshotsResponder(resp *http.Response) (result SnapshotCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSnapshotsNextResults retrieves the next set of results, if any. +func (client AppsClient) listSnapshotsNextResults(ctx context.Context, lastResults SnapshotCollection) (result SnapshotCollection, err error) { + req, err := lastResults.snapshotCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSnapshotsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSnapshotsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSnapshotsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSnapshotsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listSnapshotsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSnapshotsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListSnapshotsComplete(ctx context.Context, resourceGroupName string, name string) (result SnapshotCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSnapshots") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSnapshots(ctx, resourceGroupName, name) + return +} + +// ListSnapshotsFromDRSecondary description for Returns all Snapshots to the user from DRSecondary endpoint. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - website Name. +func (client AppsClient) ListSnapshotsFromDRSecondary(ctx context.Context, resourceGroupName string, name string) (result SnapshotCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSnapshotsFromDRSecondary") + defer func() { + sc := -1 + if result.sc.Response.Response != nil { + sc = result.sc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSnapshotsFromDRSecondary", err.Error()) + } + + result.fn = client.listSnapshotsFromDRSecondaryNextResults + req, err := client.ListSnapshotsFromDRSecondaryPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsFromDRSecondary", nil, "Failure preparing request") + return + } + + resp, err := client.ListSnapshotsFromDRSecondarySender(req) + if err != nil { + result.sc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsFromDRSecondary", resp, "Failure sending request") + return + } + + result.sc, err = client.ListSnapshotsFromDRSecondaryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsFromDRSecondary", resp, "Failure responding to request") + return + } + if result.sc.hasNextLink() && result.sc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSnapshotsFromDRSecondaryPreparer prepares the ListSnapshotsFromDRSecondary request. +func (client AppsClient) ListSnapshotsFromDRSecondaryPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshotsdr", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSnapshotsFromDRSecondarySender sends the ListSnapshotsFromDRSecondary request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSnapshotsFromDRSecondarySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSnapshotsFromDRSecondaryResponder handles the response to the ListSnapshotsFromDRSecondary request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSnapshotsFromDRSecondaryResponder(resp *http.Response) (result SnapshotCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSnapshotsFromDRSecondaryNextResults retrieves the next set of results, if any. +func (client AppsClient) listSnapshotsFromDRSecondaryNextResults(ctx context.Context, lastResults SnapshotCollection) (result SnapshotCollection, err error) { + req, err := lastResults.snapshotCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSnapshotsFromDRSecondaryNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSnapshotsFromDRSecondarySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSnapshotsFromDRSecondaryNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSnapshotsFromDRSecondaryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listSnapshotsFromDRSecondaryNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSnapshotsFromDRSecondaryComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListSnapshotsFromDRSecondaryComplete(ctx context.Context, resourceGroupName string, name string) (result SnapshotCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSnapshotsFromDRSecondary") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSnapshotsFromDRSecondary(ctx, resourceGroupName, name) + return +} + +// ListSnapshotsFromDRSecondarySlot description for Returns all Snapshots to the user from DRSecondary endpoint. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - website Name. +// slot - website Slot. +func (client AppsClient) ListSnapshotsFromDRSecondarySlot(ctx context.Context, resourceGroupName string, name string, slot string) (result SnapshotCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSnapshotsFromDRSecondarySlot") + defer func() { + sc := -1 + if result.sc.Response.Response != nil { + sc = result.sc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSnapshotsFromDRSecondarySlot", err.Error()) + } + + result.fn = client.listSnapshotsFromDRSecondarySlotNextResults + req, err := client.ListSnapshotsFromDRSecondarySlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsFromDRSecondarySlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListSnapshotsFromDRSecondarySlotSender(req) + if err != nil { + result.sc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsFromDRSecondarySlot", resp, "Failure sending request") + return + } + + result.sc, err = client.ListSnapshotsFromDRSecondarySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsFromDRSecondarySlot", resp, "Failure responding to request") + return + } + if result.sc.hasNextLink() && result.sc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSnapshotsFromDRSecondarySlotPreparer prepares the ListSnapshotsFromDRSecondarySlot request. +func (client AppsClient) ListSnapshotsFromDRSecondarySlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshotsdr", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSnapshotsFromDRSecondarySlotSender sends the ListSnapshotsFromDRSecondarySlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSnapshotsFromDRSecondarySlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSnapshotsFromDRSecondarySlotResponder handles the response to the ListSnapshotsFromDRSecondarySlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSnapshotsFromDRSecondarySlotResponder(resp *http.Response) (result SnapshotCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSnapshotsFromDRSecondarySlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listSnapshotsFromDRSecondarySlotNextResults(ctx context.Context, lastResults SnapshotCollection) (result SnapshotCollection, err error) { + req, err := lastResults.snapshotCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSnapshotsFromDRSecondarySlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSnapshotsFromDRSecondarySlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSnapshotsFromDRSecondarySlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSnapshotsFromDRSecondarySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listSnapshotsFromDRSecondarySlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSnapshotsFromDRSecondarySlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListSnapshotsFromDRSecondarySlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result SnapshotCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSnapshotsFromDRSecondarySlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSnapshotsFromDRSecondarySlot(ctx, resourceGroupName, name, slot) + return +} + +// ListSnapshotsSlot description for Returns all Snapshots to the user. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - website Name. +// slot - website Slot. +func (client AppsClient) ListSnapshotsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result SnapshotCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSnapshotsSlot") + defer func() { + sc := -1 + if result.sc.Response.Response != nil { + sc = result.sc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSnapshotsSlot", err.Error()) + } + + result.fn = client.listSnapshotsSlotNextResults + req, err := client.ListSnapshotsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListSnapshotsSlotSender(req) + if err != nil { + result.sc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", resp, "Failure sending request") + return + } + + result.sc, err = client.ListSnapshotsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", resp, "Failure responding to request") + return + } + if result.sc.hasNextLink() && result.sc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSnapshotsSlotPreparer prepares the ListSnapshotsSlot request. +func (client AppsClient) ListSnapshotsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSnapshotsSlotSender sends the ListSnapshotsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSnapshotsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSnapshotsSlotResponder handles the response to the ListSnapshotsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSnapshotsSlotResponder(resp *http.Response) (result SnapshotCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSnapshotsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listSnapshotsSlotNextResults(ctx context.Context, lastResults SnapshotCollection) (result SnapshotCollection, err error) { + req, err := lastResults.snapshotCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSnapshotsSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSnapshotsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listSnapshotsSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSnapshotsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listSnapshotsSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSnapshotsSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListSnapshotsSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result SnapshotCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSnapshotsSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSnapshotsSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListSyncFunctionTriggers description for This is to allow calling via powershell and ARM template. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListSyncFunctionTriggers(ctx context.Context, resourceGroupName string, name string) (result FunctionSecrets, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSyncFunctionTriggers") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSyncFunctionTriggers", err.Error()) + } + + req, err := client.ListSyncFunctionTriggersPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSyncFunctionTriggers", nil, "Failure preparing request") + return + } + + resp, err := client.ListSyncFunctionTriggersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSyncFunctionTriggers", resp, "Failure sending request") + return + } + + result, err = client.ListSyncFunctionTriggersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSyncFunctionTriggers", resp, "Failure responding to request") + return + } + + return +} + +// ListSyncFunctionTriggersPreparer prepares the ListSyncFunctionTriggers request. +func (client AppsClient) ListSyncFunctionTriggersPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/listsyncfunctiontriggerstatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSyncFunctionTriggersSender sends the ListSyncFunctionTriggers request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSyncFunctionTriggersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSyncFunctionTriggersResponder handles the response to the ListSyncFunctionTriggers request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSyncFunctionTriggersResponder(resp *http.Response) (result FunctionSecrets, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSyncFunctionTriggersSlot description for This is to allow calling via powershell and ARM template. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. +func (client AppsClient) ListSyncFunctionTriggersSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result FunctionSecrets, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSyncFunctionTriggersSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSyncFunctionTriggersSlot", err.Error()) + } + + req, err := client.ListSyncFunctionTriggersSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSyncFunctionTriggersSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListSyncFunctionTriggersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSyncFunctionTriggersSlot", resp, "Failure sending request") + return + } + + result, err = client.ListSyncFunctionTriggersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSyncFunctionTriggersSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListSyncFunctionTriggersSlotPreparer prepares the ListSyncFunctionTriggersSlot request. +func (client AppsClient) ListSyncFunctionTriggersSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/listsyncfunctiontriggerstatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSyncFunctionTriggersSlotSender sends the ListSyncFunctionTriggersSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSyncFunctionTriggersSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSyncFunctionTriggersSlotResponder handles the response to the ListSyncFunctionTriggersSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSyncFunctionTriggersSlotResponder(resp *http.Response) (result FunctionSecrets, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSyncStatus description for This is to allow calling via powershell and ARM template. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListSyncStatus(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSyncStatus") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSyncStatus", err.Error()) + } + + req, err := client.ListSyncStatusPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSyncStatus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSyncStatusSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSyncStatus", resp, "Failure sending request") + return + } + + result, err = client.ListSyncStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSyncStatus", resp, "Failure responding to request") + return + } + + return +} + +// ListSyncStatusPreparer prepares the ListSyncStatus request. +func (client AppsClient) ListSyncStatusPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/listsyncstatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSyncStatusSender sends the ListSyncStatus request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSyncStatusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSyncStatusResponder handles the response to the ListSyncStatus request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSyncStatusResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ListSyncStatusSlot description for This is to allow calling via powershell and ARM template. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. +func (client AppsClient) ListSyncStatusSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListSyncStatusSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListSyncStatusSlot", err.Error()) + } + + req, err := client.ListSyncStatusSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSyncStatusSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListSyncStatusSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSyncStatusSlot", resp, "Failure sending request") + return + } + + result, err = client.ListSyncStatusSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSyncStatusSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListSyncStatusSlotPreparer prepares the ListSyncStatusSlot request. +func (client AppsClient) ListSyncStatusSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/listsyncstatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSyncStatusSlotSender sends the ListSyncStatusSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSyncStatusSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSyncStatusSlotResponder handles the response to the ListSyncStatusSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSyncStatusSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ListTriggeredWebJobHistory description for List a triggered web job's history for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +func (client AppsClient) ListTriggeredWebJobHistory(ctx context.Context, resourceGroupName string, name string, webJobName string) (result TriggeredJobHistoryCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListTriggeredWebJobHistory") + defer func() { + sc := -1 + if result.tjhc.Response.Response != nil { + sc = result.tjhc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListTriggeredWebJobHistory", err.Error()) + } + + result.fn = client.listTriggeredWebJobHistoryNextResults + req, err := client.ListTriggeredWebJobHistoryPreparer(ctx, resourceGroupName, name, webJobName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListTriggeredWebJobHistory", nil, "Failure preparing request") + return + } + + resp, err := client.ListTriggeredWebJobHistorySender(req) + if err != nil { + result.tjhc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListTriggeredWebJobHistory", resp, "Failure sending request") + return + } + + result.tjhc, err = client.ListTriggeredWebJobHistoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListTriggeredWebJobHistory", resp, "Failure responding to request") + return + } + if result.tjhc.hasNextLink() && result.tjhc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListTriggeredWebJobHistoryPreparer prepares the ListTriggeredWebJobHistory request. +func (client AppsClient) ListTriggeredWebJobHistoryPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListTriggeredWebJobHistorySender sends the ListTriggeredWebJobHistory request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListTriggeredWebJobHistorySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListTriggeredWebJobHistoryResponder handles the response to the ListTriggeredWebJobHistory request. The method always +// closes the http.Response Body. +func (client AppsClient) ListTriggeredWebJobHistoryResponder(resp *http.Response) (result TriggeredJobHistoryCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listTriggeredWebJobHistoryNextResults retrieves the next set of results, if any. +func (client AppsClient) listTriggeredWebJobHistoryNextResults(ctx context.Context, lastResults TriggeredJobHistoryCollection) (result TriggeredJobHistoryCollection, err error) { + req, err := lastResults.triggeredJobHistoryCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listTriggeredWebJobHistoryNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListTriggeredWebJobHistorySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listTriggeredWebJobHistoryNextResults", resp, "Failure sending next results request") + } + result, err = client.ListTriggeredWebJobHistoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listTriggeredWebJobHistoryNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListTriggeredWebJobHistoryComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListTriggeredWebJobHistoryComplete(ctx context.Context, resourceGroupName string, name string, webJobName string) (result TriggeredJobHistoryCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListTriggeredWebJobHistory") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListTriggeredWebJobHistory(ctx, resourceGroupName, name, webJobName) + return +} + +// ListTriggeredWebJobHistorySlot description for List a triggered web job's history for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +// slot - name of the deployment slot. If a slot is not specified, the API uses the production slot. +func (client AppsClient) ListTriggeredWebJobHistorySlot(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (result TriggeredJobHistoryCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListTriggeredWebJobHistorySlot") + defer func() { + sc := -1 + if result.tjhc.Response.Response != nil { + sc = result.tjhc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListTriggeredWebJobHistorySlot", err.Error()) + } + + result.fn = client.listTriggeredWebJobHistorySlotNextResults + req, err := client.ListTriggeredWebJobHistorySlotPreparer(ctx, resourceGroupName, name, webJobName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListTriggeredWebJobHistorySlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListTriggeredWebJobHistorySlotSender(req) + if err != nil { + result.tjhc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListTriggeredWebJobHistorySlot", resp, "Failure sending request") + return + } + + result.tjhc, err = client.ListTriggeredWebJobHistorySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListTriggeredWebJobHistorySlot", resp, "Failure responding to request") + return + } + if result.tjhc.hasNextLink() && result.tjhc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListTriggeredWebJobHistorySlotPreparer prepares the ListTriggeredWebJobHistorySlot request. +func (client AppsClient) ListTriggeredWebJobHistorySlotPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListTriggeredWebJobHistorySlotSender sends the ListTriggeredWebJobHistorySlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListTriggeredWebJobHistorySlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListTriggeredWebJobHistorySlotResponder handles the response to the ListTriggeredWebJobHistorySlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListTriggeredWebJobHistorySlotResponder(resp *http.Response) (result TriggeredJobHistoryCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listTriggeredWebJobHistorySlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listTriggeredWebJobHistorySlotNextResults(ctx context.Context, lastResults TriggeredJobHistoryCollection) (result TriggeredJobHistoryCollection, err error) { + req, err := lastResults.triggeredJobHistoryCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listTriggeredWebJobHistorySlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListTriggeredWebJobHistorySlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listTriggeredWebJobHistorySlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListTriggeredWebJobHistorySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listTriggeredWebJobHistorySlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListTriggeredWebJobHistorySlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListTriggeredWebJobHistorySlotComplete(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (result TriggeredJobHistoryCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListTriggeredWebJobHistorySlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListTriggeredWebJobHistorySlot(ctx, resourceGroupName, name, webJobName, slot) + return +} + +// ListTriggeredWebJobs description for List triggered web jobs for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +func (client AppsClient) ListTriggeredWebJobs(ctx context.Context, resourceGroupName string, name string) (result TriggeredWebJobCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListTriggeredWebJobs") + defer func() { + sc := -1 + if result.twjc.Response.Response != nil { + sc = result.twjc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListTriggeredWebJobs", err.Error()) + } + + result.fn = client.listTriggeredWebJobsNextResults + req, err := client.ListTriggeredWebJobsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListTriggeredWebJobs", nil, "Failure preparing request") + return + } + + resp, err := client.ListTriggeredWebJobsSender(req) + if err != nil { + result.twjc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListTriggeredWebJobs", resp, "Failure sending request") + return + } + + result.twjc, err = client.ListTriggeredWebJobsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListTriggeredWebJobs", resp, "Failure responding to request") + return + } + if result.twjc.hasNextLink() && result.twjc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListTriggeredWebJobsPreparer prepares the ListTriggeredWebJobs request. +func (client AppsClient) ListTriggeredWebJobsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListTriggeredWebJobsSender sends the ListTriggeredWebJobs request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListTriggeredWebJobsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListTriggeredWebJobsResponder handles the response to the ListTriggeredWebJobs request. The method always +// closes the http.Response Body. +func (client AppsClient) ListTriggeredWebJobsResponder(resp *http.Response) (result TriggeredWebJobCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listTriggeredWebJobsNextResults retrieves the next set of results, if any. +func (client AppsClient) listTriggeredWebJobsNextResults(ctx context.Context, lastResults TriggeredWebJobCollection) (result TriggeredWebJobCollection, err error) { + req, err := lastResults.triggeredWebJobCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listTriggeredWebJobsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListTriggeredWebJobsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listTriggeredWebJobsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListTriggeredWebJobsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listTriggeredWebJobsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListTriggeredWebJobsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListTriggeredWebJobsComplete(ctx context.Context, resourceGroupName string, name string) (result TriggeredWebJobCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListTriggeredWebJobs") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListTriggeredWebJobs(ctx, resourceGroupName, name) + return +} + +// ListTriggeredWebJobsSlot description for List triggered web jobs for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// slot - name of the deployment slot. If a slot is not specified, the API deletes a deployment for the +// production slot. +func (client AppsClient) ListTriggeredWebJobsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result TriggeredWebJobCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListTriggeredWebJobsSlot") + defer func() { + sc := -1 + if result.twjc.Response.Response != nil { + sc = result.twjc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListTriggeredWebJobsSlot", err.Error()) + } + + result.fn = client.listTriggeredWebJobsSlotNextResults + req, err := client.ListTriggeredWebJobsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListTriggeredWebJobsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListTriggeredWebJobsSlotSender(req) + if err != nil { + result.twjc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListTriggeredWebJobsSlot", resp, "Failure sending request") + return + } + + result.twjc, err = client.ListTriggeredWebJobsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListTriggeredWebJobsSlot", resp, "Failure responding to request") + return + } + if result.twjc.hasNextLink() && result.twjc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListTriggeredWebJobsSlotPreparer prepares the ListTriggeredWebJobsSlot request. +func (client AppsClient) ListTriggeredWebJobsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListTriggeredWebJobsSlotSender sends the ListTriggeredWebJobsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListTriggeredWebJobsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListTriggeredWebJobsSlotResponder handles the response to the ListTriggeredWebJobsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListTriggeredWebJobsSlotResponder(resp *http.Response) (result TriggeredWebJobCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listTriggeredWebJobsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listTriggeredWebJobsSlotNextResults(ctx context.Context, lastResults TriggeredWebJobCollection) (result TriggeredWebJobCollection, err error) { + req, err := lastResults.triggeredWebJobCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listTriggeredWebJobsSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListTriggeredWebJobsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listTriggeredWebJobsSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListTriggeredWebJobsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listTriggeredWebJobsSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListTriggeredWebJobsSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListTriggeredWebJobsSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result TriggeredWebJobCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListTriggeredWebJobsSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListTriggeredWebJobsSlot(ctx, resourceGroupName, name, slot) + return +} + +// ListUsages description for Gets the quota usage information of an app (or deployment slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// filter - return only information specified in the filter (using OData syntax). For example: +// $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and +// endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppsClient) ListUsages(ctx context.Context, resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListUsages") + defer func() { + sc := -1 + if result.cuqc.Response.Response != nil { + sc = result.cuqc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListUsages", err.Error()) + } + + result.fn = client.listUsagesNextResults + req, err := client.ListUsagesPreparer(ctx, resourceGroupName, name, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.cuqc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", resp, "Failure sending request") + return + } + + result.cuqc, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", resp, "Failure responding to request") + return + } + if result.cuqc.hasNextLink() && result.cuqc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListUsagesPreparer prepares the ListUsages request. +func (client AppsClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, name string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListUsagesSender sends the ListUsages request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListUsagesResponder handles the response to the ListUsages request. The method always +// closes the http.Response Body. +func (client AppsClient) ListUsagesResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listUsagesNextResults retrieves the next set of results, if any. +func (client AppsClient) listUsagesNextResults(ctx context.Context, lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { + req, err := lastResults.csmUsageQuotaCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listUsagesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listUsagesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listUsagesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListUsagesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListUsagesComplete(ctx context.Context, resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListUsages") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListUsages(ctx, resourceGroupName, name, filter) + return +} + +// ListUsagesSlot description for Gets the quota usage information of an app (or deployment slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get quota information of the +// production slot. +// filter - return only information specified in the filter (using OData syntax). For example: +// $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and +// endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppsClient) ListUsagesSlot(ctx context.Context, resourceGroupName string, name string, slot string, filter string) (result CsmUsageQuotaCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListUsagesSlot") + defer func() { + sc := -1 + if result.cuqc.Response.Response != nil { + sc = result.cuqc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListUsagesSlot", err.Error()) + } + + result.fn = client.listUsagesSlotNextResults + req, err := client.ListUsagesSlotPreparer(ctx, resourceGroupName, name, slot, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsagesSlotSender(req) + if err != nil { + result.cuqc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", resp, "Failure sending request") + return + } + + result.cuqc, err = client.ListUsagesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", resp, "Failure responding to request") + return + } + if result.cuqc.hasNextLink() && result.cuqc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListUsagesSlotPreparer prepares the ListUsagesSlot request. +func (client AppsClient) ListUsagesSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListUsagesSlotSender sends the ListUsagesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListUsagesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListUsagesSlotResponder handles the response to the ListUsagesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListUsagesSlotResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listUsagesSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listUsagesSlotNextResults(ctx context.Context, lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { + req, err := lastResults.csmUsageQuotaCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listUsagesSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListUsagesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listUsagesSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListUsagesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listUsagesSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListUsagesSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListUsagesSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string, filter string) (result CsmUsageQuotaCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListUsagesSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListUsagesSlot(ctx, resourceGroupName, name, slot, filter) + return +} + +// ListVnetConnections description for Gets the virtual networks the app (or deployment slot) is connected to. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ListVnetConnections(ctx context.Context, resourceGroupName string, name string) (result ListVnetInfoResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListVnetConnections") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListVnetConnections", err.Error()) + } + + req, err := client.ListVnetConnectionsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnections", nil, "Failure preparing request") + return + } + + resp, err := client.ListVnetConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnections", resp, "Failure sending request") + return + } + + result, err = client.ListVnetConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnections", resp, "Failure responding to request") + return + } + + return +} + +// ListVnetConnectionsPreparer prepares the ListVnetConnections request. +func (client AppsClient) ListVnetConnectionsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVnetConnectionsSender sends the ListVnetConnections request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListVnetConnectionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListVnetConnectionsResponder handles the response to the ListVnetConnections request. The method always +// closes the http.Response Body. +func (client AppsClient) ListVnetConnectionsResponder(resp *http.Response) (result ListVnetInfoResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListVnetConnectionsSlot description for Gets the virtual networks the app (or deployment slot) is connected to. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will get virtual network connections +// for the production slot. +func (client AppsClient) ListVnetConnectionsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result ListVnetInfoResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListVnetConnectionsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListVnetConnectionsSlot", err.Error()) + } + + req, err := client.ListVnetConnectionsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnectionsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListVnetConnectionsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnectionsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListVnetConnectionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnectionsSlot", resp, "Failure responding to request") + return + } + + return +} + +// ListVnetConnectionsSlotPreparer prepares the ListVnetConnectionsSlot request. +func (client AppsClient) ListVnetConnectionsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVnetConnectionsSlotSender sends the ListVnetConnectionsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListVnetConnectionsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListVnetConnectionsSlotResponder handles the response to the ListVnetConnectionsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListVnetConnectionsSlotResponder(resp *http.Response) (result ListVnetInfoResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebJobs description for List webjobs for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +func (client AppsClient) ListWebJobs(ctx context.Context, resourceGroupName string, name string) (result JobCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListWebJobs") + defer func() { + sc := -1 + if result.jc.Response.Response != nil { + sc = result.jc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListWebJobs", err.Error()) + } + + result.fn = client.listWebJobsNextResults + req, err := client.ListWebJobsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListWebJobs", nil, "Failure preparing request") + return + } + + resp, err := client.ListWebJobsSender(req) + if err != nil { + result.jc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListWebJobs", resp, "Failure sending request") + return + } + + result.jc, err = client.ListWebJobsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListWebJobs", resp, "Failure responding to request") + return + } + if result.jc.hasNextLink() && result.jc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListWebJobsPreparer prepares the ListWebJobs request. +func (client AppsClient) ListWebJobsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListWebJobsSender sends the ListWebJobs request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListWebJobsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListWebJobsResponder handles the response to the ListWebJobs request. The method always +// closes the http.Response Body. +func (client AppsClient) ListWebJobsResponder(resp *http.Response) (result JobCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listWebJobsNextResults retrieves the next set of results, if any. +func (client AppsClient) listWebJobsNextResults(ctx context.Context, lastResults JobCollection) (result JobCollection, err error) { + req, err := lastResults.jobCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listWebJobsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListWebJobsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listWebJobsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListWebJobsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listWebJobsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListWebJobsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListWebJobsComplete(ctx context.Context, resourceGroupName string, name string) (result JobCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListWebJobs") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListWebJobs(ctx, resourceGroupName, name) + return +} + +// ListWebJobsSlot description for List webjobs for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// slot - name of the deployment slot. If a slot is not specified, the API returns deployments for the +// production slot. +func (client AppsClient) ListWebJobsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result JobCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListWebJobsSlot") + defer func() { + sc := -1 + if result.jc.Response.Response != nil { + sc = result.jc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ListWebJobsSlot", err.Error()) + } + + result.fn = client.listWebJobsSlotNextResults + req, err := client.ListWebJobsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListWebJobsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListWebJobsSlotSender(req) + if err != nil { + result.jc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListWebJobsSlot", resp, "Failure sending request") + return + } + + result.jc, err = client.ListWebJobsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListWebJobsSlot", resp, "Failure responding to request") + return + } + if result.jc.hasNextLink() && result.jc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListWebJobsSlotPreparer prepares the ListWebJobsSlot request. +func (client AppsClient) ListWebJobsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListWebJobsSlotSender sends the ListWebJobsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListWebJobsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListWebJobsSlotResponder handles the response to the ListWebJobsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListWebJobsSlotResponder(resp *http.Response) (result JobCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listWebJobsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) listWebJobsSlotNextResults(ctx context.Context, lastResults JobCollection) (result JobCollection, err error) { + req, err := lastResults.jobCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listWebJobsSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListWebJobsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "listWebJobsSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListWebJobsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "listWebJobsSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListWebJobsSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListWebJobsSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result JobCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListWebJobsSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListWebJobsSlot(ctx, resourceGroupName, name, slot) + return +} + +// MigrateMySQL description for Migrates a local (in-app) MySql database to a remote MySql database. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// migrationRequestEnvelope - mySql migration options. +func (client AppsClient) MigrateMySQL(ctx context.Context, resourceGroupName string, name string, migrationRequestEnvelope MigrateMySQLRequest) (result AppsMigrateMySQLFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.MigrateMySQL") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: migrationRequestEnvelope, + Constraints: []validation.Constraint{{Target: "migrationRequestEnvelope.MigrateMySQLRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "migrationRequestEnvelope.MigrateMySQLRequestProperties.ConnectionString", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "MigrateMySQL", err.Error()) + } + + req, err := client.MigrateMySQLPreparer(ctx, resourceGroupName, name, migrationRequestEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateMySQL", nil, "Failure preparing request") + return + } + + result, err = client.MigrateMySQLSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateMySQL", result.Response(), "Failure sending request") + return + } + + return +} + +// MigrateMySQLPreparer prepares the MigrateMySQL request. +func (client AppsClient) MigrateMySQLPreparer(ctx context.Context, resourceGroupName string, name string, migrationRequestEnvelope MigrateMySQLRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql", pathParameters), + autorest.WithJSON(migrationRequestEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// MigrateMySQLSender sends the MigrateMySQL request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) MigrateMySQLSender(req *http.Request) (future AppsMigrateMySQLFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// MigrateMySQLResponder handles the response to the MigrateMySQL request. The method always +// closes the http.Response Body. +func (client AppsClient) MigrateMySQLResponder(resp *http.Response) (result Operation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// MigrateStorage description for Restores a web app. +// Parameters: +// subscriptionName - azure subscription. +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// migrationOptions - migration migrationOptions. +func (client AppsClient) MigrateStorage(ctx context.Context, subscriptionName string, resourceGroupName string, name string, migrationOptions StorageMigrationOptions) (result AppsMigrateStorageFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.MigrateStorage") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: migrationOptions, + Constraints: []validation.Constraint{{Target: "migrationOptions.StorageMigrationOptionsProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "migrationOptions.StorageMigrationOptionsProperties.AzurefilesConnectionString", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "migrationOptions.StorageMigrationOptionsProperties.AzurefilesShare", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "MigrateStorage", err.Error()) + } + + req, err := client.MigrateStoragePreparer(ctx, subscriptionName, resourceGroupName, name, migrationOptions) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateStorage", nil, "Failure preparing request") + return + } + + result, err = client.MigrateStorageSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateStorage", result.Response(), "Failure sending request") + return + } + + return +} + +// MigrateStoragePreparer prepares the MigrateStorage request. +func (client AppsClient) MigrateStoragePreparer(ctx context.Context, subscriptionName string, resourceGroupName string, name string, migrationOptions StorageMigrationOptions) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "subscriptionName": autorest.Encode("query", subscriptionName), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate", pathParameters), + autorest.WithJSON(migrationOptions), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// MigrateStorageSender sends the MigrateStorage request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) MigrateStorageSender(req *http.Request) (future AppsMigrateStorageFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// MigrateStorageResponder handles the response to the MigrateStorage request. The method always +// closes the http.Response Body. +func (client AppsClient) MigrateStorageResponder(resp *http.Response) (result StorageMigrationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// PutPrivateAccessVnet description for Sets data around private site access enablement and authorized Virtual Networks +// that can access the site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// access - the information for the private access +func (client AppsClient) PutPrivateAccessVnet(ctx context.Context, resourceGroupName string, name string, access PrivateAccess) (result PrivateAccess, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.PutPrivateAccessVnet") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "PutPrivateAccessVnet", err.Error()) + } + + req, err := client.PutPrivateAccessVnetPreparer(ctx, resourceGroupName, name, access) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "PutPrivateAccessVnet", nil, "Failure preparing request") + return + } + + resp, err := client.PutPrivateAccessVnetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "PutPrivateAccessVnet", resp, "Failure sending request") + return + } + + result, err = client.PutPrivateAccessVnetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "PutPrivateAccessVnet", resp, "Failure responding to request") + return + } + + return +} + +// PutPrivateAccessVnetPreparer prepares the PutPrivateAccessVnet request. +func (client AppsClient) PutPrivateAccessVnetPreparer(ctx context.Context, resourceGroupName string, name string, access PrivateAccess) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateAccess/virtualNetworks", pathParameters), + autorest.WithJSON(access), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutPrivateAccessVnetSender sends the PutPrivateAccessVnet request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) PutPrivateAccessVnetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PutPrivateAccessVnetResponder handles the response to the PutPrivateAccessVnet request. The method always +// closes the http.Response Body. +func (client AppsClient) PutPrivateAccessVnetResponder(resp *http.Response) (result PrivateAccess, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// PutPrivateAccessVnetSlot description for Sets data around private site access enablement and authorized Virtual +// Networks that can access the site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// access - the information for the private access +// slot - the name of the slot for the web app. +func (client AppsClient) PutPrivateAccessVnetSlot(ctx context.Context, resourceGroupName string, name string, access PrivateAccess, slot string) (result PrivateAccess, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.PutPrivateAccessVnetSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "PutPrivateAccessVnetSlot", err.Error()) + } + + req, err := client.PutPrivateAccessVnetSlotPreparer(ctx, resourceGroupName, name, access, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "PutPrivateAccessVnetSlot", nil, "Failure preparing request") + return + } + + resp, err := client.PutPrivateAccessVnetSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "PutPrivateAccessVnetSlot", resp, "Failure sending request") + return + } + + result, err = client.PutPrivateAccessVnetSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "PutPrivateAccessVnetSlot", resp, "Failure responding to request") + return + } + + return +} + +// PutPrivateAccessVnetSlotPreparer prepares the PutPrivateAccessVnetSlot request. +func (client AppsClient) PutPrivateAccessVnetSlotPreparer(ctx context.Context, resourceGroupName string, name string, access PrivateAccess, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks", pathParameters), + autorest.WithJSON(access), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutPrivateAccessVnetSlotSender sends the PutPrivateAccessVnetSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) PutPrivateAccessVnetSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PutPrivateAccessVnetSlotResponder handles the response to the PutPrivateAccessVnetSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) PutPrivateAccessVnetSlotResponder(resp *http.Response) (result PrivateAccess, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RecoverSiteConfigurationSnapshot description for Reverts the configuration of an app to a previous snapshot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// snapshotID - the ID of the snapshot to read. +func (client AppsClient) RecoverSiteConfigurationSnapshot(ctx context.Context, resourceGroupName string, name string, snapshotID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.RecoverSiteConfigurationSnapshot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "RecoverSiteConfigurationSnapshot", err.Error()) + } + + req, err := client.RecoverSiteConfigurationSnapshotPreparer(ctx, resourceGroupName, name, snapshotID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshot", nil, "Failure preparing request") + return + } + + resp, err := client.RecoverSiteConfigurationSnapshotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshot", resp, "Failure sending request") + return + } + + result, err = client.RecoverSiteConfigurationSnapshotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshot", resp, "Failure responding to request") + return + } + + return +} + +// RecoverSiteConfigurationSnapshotPreparer prepares the RecoverSiteConfigurationSnapshot request. +func (client AppsClient) RecoverSiteConfigurationSnapshotPreparer(ctx context.Context, resourceGroupName string, name string, snapshotID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotId": autorest.Encode("path", snapshotID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}/recover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RecoverSiteConfigurationSnapshotSender sends the RecoverSiteConfigurationSnapshot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RecoverSiteConfigurationSnapshotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RecoverSiteConfigurationSnapshotResponder handles the response to the RecoverSiteConfigurationSnapshot request. The method always +// closes the http.Response Body. +func (client AppsClient) RecoverSiteConfigurationSnapshotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RecoverSiteConfigurationSnapshotSlot description for Reverts the configuration of an app to a previous snapshot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// snapshotID - the ID of the snapshot to read. +// slot - name of the deployment slot. If a slot is not specified, the API will return configuration for the +// production slot. +func (client AppsClient) RecoverSiteConfigurationSnapshotSlot(ctx context.Context, resourceGroupName string, name string, snapshotID string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.RecoverSiteConfigurationSnapshotSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "RecoverSiteConfigurationSnapshotSlot", err.Error()) + } + + req, err := client.RecoverSiteConfigurationSnapshotSlotPreparer(ctx, resourceGroupName, name, snapshotID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshotSlot", nil, "Failure preparing request") + return + } + + resp, err := client.RecoverSiteConfigurationSnapshotSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshotSlot", resp, "Failure sending request") + return + } + + result, err = client.RecoverSiteConfigurationSnapshotSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshotSlot", resp, "Failure responding to request") + return + } + + return +} + +// RecoverSiteConfigurationSnapshotSlotPreparer prepares the RecoverSiteConfigurationSnapshotSlot request. +func (client AppsClient) RecoverSiteConfigurationSnapshotSlotPreparer(ctx context.Context, resourceGroupName string, name string, snapshotID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "snapshotId": autorest.Encode("path", snapshotID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}/recover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RecoverSiteConfigurationSnapshotSlotSender sends the RecoverSiteConfigurationSnapshotSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RecoverSiteConfigurationSnapshotSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RecoverSiteConfigurationSnapshotSlotResponder handles the response to the RecoverSiteConfigurationSnapshotSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RecoverSiteConfigurationSnapshotSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResetProductionSlotConfig description for Resets the configuration settings of the current slot if they were +// previously modified by calling the API with POST. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) ResetProductionSlotConfig(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ResetProductionSlotConfig") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ResetProductionSlotConfig", err.Error()) + } + + req, err := client.ResetProductionSlotConfigPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetProductionSlotConfig", nil, "Failure preparing request") + return + } + + resp, err := client.ResetProductionSlotConfigSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetProductionSlotConfig", resp, "Failure sending request") + return + } + + result, err = client.ResetProductionSlotConfigResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetProductionSlotConfig", resp, "Failure responding to request") + return + } + + return +} + +// ResetProductionSlotConfigPreparer prepares the ResetProductionSlotConfig request. +func (client AppsClient) ResetProductionSlotConfigPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resetSlotConfig", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetProductionSlotConfigSender sends the ResetProductionSlotConfig request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ResetProductionSlotConfigSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ResetProductionSlotConfigResponder handles the response to the ResetProductionSlotConfig request. The method always +// closes the http.Response Body. +func (client AppsClient) ResetProductionSlotConfigResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResetSlotConfigurationSlot description for Resets the configuration settings of the current slot if they were +// previously modified by calling the API with POST. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API resets configuration settings for +// the production slot. +func (client AppsClient) ResetSlotConfigurationSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ResetSlotConfigurationSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "ResetSlotConfigurationSlot", err.Error()) + } + + req, err := client.ResetSlotConfigurationSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetSlotConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ResetSlotConfigurationSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetSlotConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.ResetSlotConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetSlotConfigurationSlot", resp, "Failure responding to request") + return + } + + return +} + +// ResetSlotConfigurationSlotPreparer prepares the ResetSlotConfigurationSlot request. +func (client AppsClient) ResetSlotConfigurationSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resetSlotConfig", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetSlotConfigurationSlotSender sends the ResetSlotConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ResetSlotConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ResetSlotConfigurationSlotResponder handles the response to the ResetSlotConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ResetSlotConfigurationSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Restart description for Restarts an app (or deployment slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// softRestart - specify true to apply the configuration settings and restarts the app only if necessary. By +// default, the API always restarts and reprovisions the app. +// synchronous - specify true to block until the app is restarted. By default, it is set to false, and the API +// responds immediately (asynchronous). +func (client AppsClient) Restart(ctx context.Context, resourceGroupName string, name string, softRestart *bool, synchronous *bool) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Restart") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "Restart", err.Error()) + } + + req, err := client.RestartPreparer(ctx, resourceGroupName, name, softRestart, synchronous) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Restart", nil, "Failure preparing request") + return + } + + resp, err := client.RestartSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "Restart", resp, "Failure sending request") + return + } + + result, err = client.RestartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Restart", resp, "Failure responding to request") + return + } + + return +} + +// RestartPreparer prepares the Restart request. +func (client AppsClient) RestartPreparer(ctx context.Context, resourceGroupName string, name string, softRestart *bool, synchronous *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if softRestart != nil { + queryParameters["softRestart"] = autorest.Encode("query", *softRestart) + } + if synchronous != nil { + queryParameters["synchronous"] = autorest.Encode("query", *synchronous) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestartSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client AppsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// RestartSlot description for Restarts an app (or deployment slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will restart the production slot. +// softRestart - specify true to apply the configuration settings and restarts the app only if necessary. By +// default, the API always restarts and reprovisions the app. +// synchronous - specify true to block until the app is restarted. By default, it is set to false, and the API +// responds immediately (asynchronous). +func (client AppsClient) RestartSlot(ctx context.Context, resourceGroupName string, name string, slot string, softRestart *bool, synchronous *bool) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.RestartSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "RestartSlot", err.Error()) + } + + req, err := client.RestartSlotPreparer(ctx, resourceGroupName, name, slot, softRestart, synchronous) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestartSlot", nil, "Failure preparing request") + return + } + + resp, err := client.RestartSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestartSlot", resp, "Failure sending request") + return + } + + result, err = client.RestartSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestartSlot", resp, "Failure responding to request") + return + } + + return +} + +// RestartSlotPreparer prepares the RestartSlot request. +func (client AppsClient) RestartSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, softRestart *bool, synchronous *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if softRestart != nil { + queryParameters["softRestart"] = autorest.Encode("query", *softRestart) + } + if synchronous != nil { + queryParameters["synchronous"] = autorest.Encode("query", *synchronous) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestartSlotSender sends the RestartSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestartSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RestartSlotResponder handles the response to the RestartSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RestartSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Restore description for Restores a specific backup to another app (or deployment slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// backupID - ID of the backup. +// request - information on restore request . +func (client AppsClient) Restore(ctx context.Context, resourceGroupName string, name string, backupID string, request RestoreRequest) (result AppsRestoreFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Restore") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.RestoreRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.RestoreRequestProperties.StorageAccountURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.RestoreRequestProperties.Overwrite", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "Restore", err.Error()) + } + + req, err := client.RestorePreparer(ctx, resourceGroupName, name, backupID, request) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Restore", nil, "Failure preparing request") + return + } + + result, err = client.RestoreSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Restore", result.Response(), "Failure sending request") + return + } + + return +} + +// RestorePreparer prepares the Restore request. +func (client AppsClient) RestorePreparer(ctx context.Context, resourceGroupName string, name string, backupID string, request RestoreRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreSender sends the Restore request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestoreSender(req *http.Request) (future AppsRestoreFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RestoreResponder handles the response to the Restore request. The method always +// closes the http.Response Body. +func (client AppsClient) RestoreResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// RestoreFromBackupBlob description for Restores an app from a backup blob in Azure Storage. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// request - information on restore request . +func (client AppsClient) RestoreFromBackupBlob(ctx context.Context, resourceGroupName string, name string, request RestoreRequest) (result AppsRestoreFromBackupBlobFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.RestoreFromBackupBlob") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.RestoreRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.RestoreRequestProperties.StorageAccountURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.RestoreRequestProperties.Overwrite", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "RestoreFromBackupBlob", err.Error()) + } + + req, err := client.RestoreFromBackupBlobPreparer(ctx, resourceGroupName, name, request) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreFromBackupBlob", nil, "Failure preparing request") + return + } + + result, err = client.RestoreFromBackupBlobSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreFromBackupBlob", result.Response(), "Failure sending request") + return + } + + return +} + +// RestoreFromBackupBlobPreparer prepares the RestoreFromBackupBlob request. +func (client AppsClient) RestoreFromBackupBlobPreparer(ctx context.Context, resourceGroupName string, name string, request RestoreRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromBackupBlob", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreFromBackupBlobSender sends the RestoreFromBackupBlob request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestoreFromBackupBlobSender(req *http.Request) (future AppsRestoreFromBackupBlobFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RestoreFromBackupBlobResponder handles the response to the RestoreFromBackupBlob request. The method always +// closes the http.Response Body. +func (client AppsClient) RestoreFromBackupBlobResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// RestoreFromBackupBlobSlot description for Restores an app from a backup blob in Azure Storage. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// request - information on restore request . +// slot - name of the deployment slot. If a slot is not specified, the API will restore a backup of the +// production slot. +func (client AppsClient) RestoreFromBackupBlobSlot(ctx context.Context, resourceGroupName string, name string, request RestoreRequest, slot string) (result AppsRestoreFromBackupBlobSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.RestoreFromBackupBlobSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.RestoreRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.RestoreRequestProperties.StorageAccountURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.RestoreRequestProperties.Overwrite", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "RestoreFromBackupBlobSlot", err.Error()) + } + + req, err := client.RestoreFromBackupBlobSlotPreparer(ctx, resourceGroupName, name, request, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreFromBackupBlobSlot", nil, "Failure preparing request") + return + } + + result, err = client.RestoreFromBackupBlobSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreFromBackupBlobSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// RestoreFromBackupBlobSlotPreparer prepares the RestoreFromBackupBlobSlot request. +func (client AppsClient) RestoreFromBackupBlobSlotPreparer(ctx context.Context, resourceGroupName string, name string, request RestoreRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromBackupBlob", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreFromBackupBlobSlotSender sends the RestoreFromBackupBlobSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestoreFromBackupBlobSlotSender(req *http.Request) (future AppsRestoreFromBackupBlobSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RestoreFromBackupBlobSlotResponder handles the response to the RestoreFromBackupBlobSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RestoreFromBackupBlobSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// RestoreFromDeletedApp description for Restores a deleted web app to this web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// restoreRequest - deleted web app restore information. +func (client AppsClient) RestoreFromDeletedApp(ctx context.Context, resourceGroupName string, name string, restoreRequest DeletedAppRestoreRequest) (result AppsRestoreFromDeletedAppFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.RestoreFromDeletedApp") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "RestoreFromDeletedApp", err.Error()) + } + + req, err := client.RestoreFromDeletedAppPreparer(ctx, resourceGroupName, name, restoreRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreFromDeletedApp", nil, "Failure preparing request") + return + } + + result, err = client.RestoreFromDeletedAppSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreFromDeletedApp", result.Response(), "Failure sending request") + return + } + + return +} + +// RestoreFromDeletedAppPreparer prepares the RestoreFromDeletedApp request. +func (client AppsClient) RestoreFromDeletedAppPreparer(ctx context.Context, resourceGroupName string, name string, restoreRequest DeletedAppRestoreRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromDeletedApp", pathParameters), + autorest.WithJSON(restoreRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreFromDeletedAppSender sends the RestoreFromDeletedApp request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestoreFromDeletedAppSender(req *http.Request) (future AppsRestoreFromDeletedAppFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RestoreFromDeletedAppResponder handles the response to the RestoreFromDeletedApp request. The method always +// closes the http.Response Body. +func (client AppsClient) RestoreFromDeletedAppResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// RestoreFromDeletedAppSlot description for Restores a deleted web app to this web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// restoreRequest - deleted web app restore information. +// slot - name of web app slot. If not specified then will default to production slot. +func (client AppsClient) RestoreFromDeletedAppSlot(ctx context.Context, resourceGroupName string, name string, restoreRequest DeletedAppRestoreRequest, slot string) (result AppsRestoreFromDeletedAppSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.RestoreFromDeletedAppSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "RestoreFromDeletedAppSlot", err.Error()) + } + + req, err := client.RestoreFromDeletedAppSlotPreparer(ctx, resourceGroupName, name, restoreRequest, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreFromDeletedAppSlot", nil, "Failure preparing request") + return + } + + result, err = client.RestoreFromDeletedAppSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreFromDeletedAppSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// RestoreFromDeletedAppSlotPreparer prepares the RestoreFromDeletedAppSlot request. +func (client AppsClient) RestoreFromDeletedAppSlotPreparer(ctx context.Context, resourceGroupName string, name string, restoreRequest DeletedAppRestoreRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromDeletedApp", pathParameters), + autorest.WithJSON(restoreRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreFromDeletedAppSlotSender sends the RestoreFromDeletedAppSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestoreFromDeletedAppSlotSender(req *http.Request) (future AppsRestoreFromDeletedAppSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RestoreFromDeletedAppSlotResponder handles the response to the RestoreFromDeletedAppSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RestoreFromDeletedAppSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// RestoreSlot description for Restores a specific backup to another app (or deployment slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// backupID - ID of the backup. +// request - information on restore request . +// slot - name of the deployment slot. If a slot is not specified, the API will restore a backup of the +// production slot. +func (client AppsClient) RestoreSlot(ctx context.Context, resourceGroupName string, name string, backupID string, request RestoreRequest, slot string) (result AppsRestoreSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.RestoreSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.RestoreRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.RestoreRequestProperties.StorageAccountURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.RestoreRequestProperties.Overwrite", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "RestoreSlot", err.Error()) + } + + req, err := client.RestoreSlotPreparer(ctx, resourceGroupName, name, backupID, request, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreSlot", nil, "Failure preparing request") + return + } + + result, err = client.RestoreSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// RestoreSlotPreparer prepares the RestoreSlot request. +func (client AppsClient) RestoreSlotPreparer(ctx context.Context, resourceGroupName string, name string, backupID string, request RestoreRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreSlotSender sends the RestoreSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestoreSlotSender(req *http.Request) (future AppsRestoreSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RestoreSlotResponder handles the response to the RestoreSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RestoreSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// RestoreSnapshot description for Restores a web app from a snapshot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// restoreRequest - snapshot restore settings. Snapshot information can be obtained by calling GetDeletedSites +// or GetSiteSnapshots API. +func (client AppsClient) RestoreSnapshot(ctx context.Context, resourceGroupName string, name string, restoreRequest SnapshotRestoreRequest) (result AppsRestoreSnapshotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.RestoreSnapshot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: restoreRequest, + Constraints: []validation.Constraint{{Target: "restoreRequest.SnapshotRestoreRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "restoreRequest.SnapshotRestoreRequestProperties.Overwrite", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "RestoreSnapshot", err.Error()) + } + + req, err := client.RestoreSnapshotPreparer(ctx, resourceGroupName, name, restoreRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreSnapshot", nil, "Failure preparing request") + return + } + + result, err = client.RestoreSnapshotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreSnapshot", result.Response(), "Failure sending request") + return + } + + return +} + +// RestoreSnapshotPreparer prepares the RestoreSnapshot request. +func (client AppsClient) RestoreSnapshotPreparer(ctx context.Context, resourceGroupName string, name string, restoreRequest SnapshotRestoreRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreSnapshot", pathParameters), + autorest.WithJSON(restoreRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreSnapshotSender sends the RestoreSnapshot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestoreSnapshotSender(req *http.Request) (future AppsRestoreSnapshotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RestoreSnapshotResponder handles the response to the RestoreSnapshot request. The method always +// closes the http.Response Body. +func (client AppsClient) RestoreSnapshotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// RestoreSnapshotSlot description for Restores a web app from a snapshot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// restoreRequest - snapshot restore settings. Snapshot information can be obtained by calling GetDeletedSites +// or GetSiteSnapshots API. +// slot - name of web app slot. If not specified then will default to production slot. +func (client AppsClient) RestoreSnapshotSlot(ctx context.Context, resourceGroupName string, name string, restoreRequest SnapshotRestoreRequest, slot string) (result AppsRestoreSnapshotSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.RestoreSnapshotSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: restoreRequest, + Constraints: []validation.Constraint{{Target: "restoreRequest.SnapshotRestoreRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "restoreRequest.SnapshotRestoreRequestProperties.Overwrite", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "RestoreSnapshotSlot", err.Error()) + } + + req, err := client.RestoreSnapshotSlotPreparer(ctx, resourceGroupName, name, restoreRequest, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreSnapshotSlot", nil, "Failure preparing request") + return + } + + result, err = client.RestoreSnapshotSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreSnapshotSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// RestoreSnapshotSlotPreparer prepares the RestoreSnapshotSlot request. +func (client AppsClient) RestoreSnapshotSlotPreparer(ctx context.Context, resourceGroupName string, name string, restoreRequest SnapshotRestoreRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreSnapshot", pathParameters), + autorest.WithJSON(restoreRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreSnapshotSlotSender sends the RestoreSnapshotSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestoreSnapshotSlotSender(req *http.Request) (future AppsRestoreSnapshotSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RestoreSnapshotSlotResponder handles the response to the RestoreSnapshotSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RestoreSnapshotSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// RunTriggeredWebJob description for Run a triggered web job for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +func (client AppsClient) RunTriggeredWebJob(ctx context.Context, resourceGroupName string, name string, webJobName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.RunTriggeredWebJob") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "RunTriggeredWebJob", err.Error()) + } + + req, err := client.RunTriggeredWebJobPreparer(ctx, resourceGroupName, name, webJobName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RunTriggeredWebJob", nil, "Failure preparing request") + return + } + + resp, err := client.RunTriggeredWebJobSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "RunTriggeredWebJob", resp, "Failure sending request") + return + } + + result, err = client.RunTriggeredWebJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RunTriggeredWebJob", resp, "Failure responding to request") + return + } + + return +} + +// RunTriggeredWebJobPreparer prepares the RunTriggeredWebJob request. +func (client AppsClient) RunTriggeredWebJobPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/run", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RunTriggeredWebJobSender sends the RunTriggeredWebJob request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RunTriggeredWebJobSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RunTriggeredWebJobResponder handles the response to the RunTriggeredWebJob request. The method always +// closes the http.Response Body. +func (client AppsClient) RunTriggeredWebJobResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// RunTriggeredWebJobSlot description for Run a triggered web job for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +// slot - name of the deployment slot. If a slot is not specified, the API uses the production slot. +func (client AppsClient) RunTriggeredWebJobSlot(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.RunTriggeredWebJobSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "RunTriggeredWebJobSlot", err.Error()) + } + + req, err := client.RunTriggeredWebJobSlotPreparer(ctx, resourceGroupName, name, webJobName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RunTriggeredWebJobSlot", nil, "Failure preparing request") + return + } + + resp, err := client.RunTriggeredWebJobSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "RunTriggeredWebJobSlot", resp, "Failure sending request") + return + } + + result, err = client.RunTriggeredWebJobSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RunTriggeredWebJobSlot", resp, "Failure responding to request") + return + } + + return +} + +// RunTriggeredWebJobSlotPreparer prepares the RunTriggeredWebJobSlot request. +func (client AppsClient) RunTriggeredWebJobSlotPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/run", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RunTriggeredWebJobSlotSender sends the RunTriggeredWebJobSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RunTriggeredWebJobSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RunTriggeredWebJobSlotResponder handles the response to the RunTriggeredWebJobSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RunTriggeredWebJobSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Start description for Starts an app (or deployment slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) Start(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Start") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "Start", err.Error()) + } + + req, err := client.StartPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Start", nil, "Failure preparing request") + return + } + + resp, err := client.StartSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "Start", resp, "Failure sending request") + return + } + + result, err = client.StartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Start", resp, "Failure responding to request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client AppsClient) StartPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client AppsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StartContinuousWebJob description for Start a continuous web job for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +func (client AppsClient) StartContinuousWebJob(ctx context.Context, resourceGroupName string, name string, webJobName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StartContinuousWebJob") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StartContinuousWebJob", err.Error()) + } + + req, err := client.StartContinuousWebJobPreparer(ctx, resourceGroupName, name, webJobName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartContinuousWebJob", nil, "Failure preparing request") + return + } + + resp, err := client.StartContinuousWebJobSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartContinuousWebJob", resp, "Failure sending request") + return + } + + result, err = client.StartContinuousWebJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartContinuousWebJob", resp, "Failure responding to request") + return + } + + return +} + +// StartContinuousWebJobPreparer prepares the StartContinuousWebJob request. +func (client AppsClient) StartContinuousWebJobPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartContinuousWebJobSender sends the StartContinuousWebJob request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartContinuousWebJobSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StartContinuousWebJobResponder handles the response to the StartContinuousWebJob request. The method always +// closes the http.Response Body. +func (client AppsClient) StartContinuousWebJobResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StartContinuousWebJobSlot description for Start a continuous web job for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +// slot - name of the deployment slot. If a slot is not specified, the API deletes a deployment for the +// production slot. +func (client AppsClient) StartContinuousWebJobSlot(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StartContinuousWebJobSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StartContinuousWebJobSlot", err.Error()) + } + + req, err := client.StartContinuousWebJobSlotPreparer(ctx, resourceGroupName, name, webJobName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartContinuousWebJobSlot", nil, "Failure preparing request") + return + } + + resp, err := client.StartContinuousWebJobSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartContinuousWebJobSlot", resp, "Failure sending request") + return + } + + result, err = client.StartContinuousWebJobSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartContinuousWebJobSlot", resp, "Failure responding to request") + return + } + + return +} + +// StartContinuousWebJobSlotPreparer prepares the StartContinuousWebJobSlot request. +func (client AppsClient) StartContinuousWebJobSlotPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartContinuousWebJobSlotSender sends the StartContinuousWebJobSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartContinuousWebJobSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StartContinuousWebJobSlotResponder handles the response to the StartContinuousWebJobSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StartContinuousWebJobSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StartNetworkTrace description for Start capturing network packets for the site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// durationInSeconds - the duration to keep capturing in seconds. +// maxFrameLength - the maximum frame length in bytes (Optional). +// sasURL - the Blob URL to store capture file. +func (client AppsClient) StartNetworkTrace(ctx context.Context, resourceGroupName string, name string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (result AppsStartNetworkTraceFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StartNetworkTrace") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StartNetworkTrace", err.Error()) + } + + req, err := client.StartNetworkTracePreparer(ctx, resourceGroupName, name, durationInSeconds, maxFrameLength, sasURL) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartNetworkTrace", nil, "Failure preparing request") + return + } + + result, err = client.StartNetworkTraceSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartNetworkTrace", result.Response(), "Failure sending request") + return + } + + return +} + +// StartNetworkTracePreparer prepares the StartNetworkTrace request. +func (client AppsClient) StartNetworkTracePreparer(ctx context.Context, resourceGroupName string, name string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if durationInSeconds != nil { + queryParameters["durationInSeconds"] = autorest.Encode("query", *durationInSeconds) + } + if maxFrameLength != nil { + queryParameters["maxFrameLength"] = autorest.Encode("query", *maxFrameLength) + } + if len(sasURL) > 0 { + queryParameters["sasUrl"] = autorest.Encode("query", sasURL) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/startNetworkTrace", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartNetworkTraceSender sends the StartNetworkTrace request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartNetworkTraceSender(req *http.Request) (future AppsStartNetworkTraceFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartNetworkTraceResponder handles the response to the StartNetworkTrace request. The method always +// closes the http.Response Body. +func (client AppsClient) StartNetworkTraceResponder(resp *http.Response) (result ListNetworkTrace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StartNetworkTraceSlot description for Start capturing network packets for the site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// slot - the name of the slot for this web app. +// durationInSeconds - the duration to keep capturing in seconds. +// maxFrameLength - the maximum frame length in bytes (Optional). +// sasURL - the Blob URL to store capture file. +func (client AppsClient) StartNetworkTraceSlot(ctx context.Context, resourceGroupName string, name string, slot string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (result AppsStartNetworkTraceSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StartNetworkTraceSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StartNetworkTraceSlot", err.Error()) + } + + req, err := client.StartNetworkTraceSlotPreparer(ctx, resourceGroupName, name, slot, durationInSeconds, maxFrameLength, sasURL) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartNetworkTraceSlot", nil, "Failure preparing request") + return + } + + result, err = client.StartNetworkTraceSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartNetworkTraceSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// StartNetworkTraceSlotPreparer prepares the StartNetworkTraceSlot request. +func (client AppsClient) StartNetworkTraceSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if durationInSeconds != nil { + queryParameters["durationInSeconds"] = autorest.Encode("query", *durationInSeconds) + } + if maxFrameLength != nil { + queryParameters["maxFrameLength"] = autorest.Encode("query", *maxFrameLength) + } + if len(sasURL) > 0 { + queryParameters["sasUrl"] = autorest.Encode("query", sasURL) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/startNetworkTrace", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartNetworkTraceSlotSender sends the StartNetworkTraceSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartNetworkTraceSlotSender(req *http.Request) (future AppsStartNetworkTraceSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartNetworkTraceSlotResponder handles the response to the StartNetworkTraceSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StartNetworkTraceSlotResponder(resp *http.Response) (result ListNetworkTrace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StartSlot description for Starts an app (or deployment slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will start the production slot. +func (client AppsClient) StartSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StartSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StartSlot", err.Error()) + } + + req, err := client.StartSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartSlot", nil, "Failure preparing request") + return + } + + resp, err := client.StartSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartSlot", resp, "Failure sending request") + return + } + + result, err = client.StartSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartSlot", resp, "Failure responding to request") + return + } + + return +} + +// StartSlotPreparer prepares the StartSlot request. +func (client AppsClient) StartSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSlotSender sends the StartSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StartSlotResponder handles the response to the StartSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StartSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StartWebSiteNetworkTrace description for Start capturing network packets for the site (To be deprecated). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// durationInSeconds - the duration to keep capturing in seconds. +// maxFrameLength - the maximum frame length in bytes (Optional). +// sasURL - the Blob URL to store capture file. +func (client AppsClient) StartWebSiteNetworkTrace(ctx context.Context, resourceGroupName string, name string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (result String, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StartWebSiteNetworkTrace") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StartWebSiteNetworkTrace", err.Error()) + } + + req, err := client.StartWebSiteNetworkTracePreparer(ctx, resourceGroupName, name, durationInSeconds, maxFrameLength, sasURL) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTrace", nil, "Failure preparing request") + return + } + + resp, err := client.StartWebSiteNetworkTraceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTrace", resp, "Failure sending request") + return + } + + result, err = client.StartWebSiteNetworkTraceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTrace", resp, "Failure responding to request") + return + } + + return +} + +// StartWebSiteNetworkTracePreparer prepares the StartWebSiteNetworkTrace request. +func (client AppsClient) StartWebSiteNetworkTracePreparer(ctx context.Context, resourceGroupName string, name string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if durationInSeconds != nil { + queryParameters["durationInSeconds"] = autorest.Encode("query", *durationInSeconds) + } + if maxFrameLength != nil { + queryParameters["maxFrameLength"] = autorest.Encode("query", *maxFrameLength) + } + if len(sasURL) > 0 { + queryParameters["sasUrl"] = autorest.Encode("query", sasURL) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartWebSiteNetworkTraceSender sends the StartWebSiteNetworkTrace request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartWebSiteNetworkTraceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StartWebSiteNetworkTraceResponder handles the response to the StartWebSiteNetworkTrace request. The method always +// closes the http.Response Body. +func (client AppsClient) StartWebSiteNetworkTraceResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StartWebSiteNetworkTraceOperation description for Start capturing network packets for the site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// durationInSeconds - the duration to keep capturing in seconds. +// maxFrameLength - the maximum frame length in bytes (Optional). +// sasURL - the Blob URL to store capture file. +func (client AppsClient) StartWebSiteNetworkTraceOperation(ctx context.Context, resourceGroupName string, name string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (result AppsStartWebSiteNetworkTraceOperationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StartWebSiteNetworkTraceOperation") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StartWebSiteNetworkTraceOperation", err.Error()) + } + + req, err := client.StartWebSiteNetworkTraceOperationPreparer(ctx, resourceGroupName, name, durationInSeconds, maxFrameLength, sasURL) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceOperation", nil, "Failure preparing request") + return + } + + result, err = client.StartWebSiteNetworkTraceOperationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceOperation", result.Response(), "Failure sending request") + return + } + + return +} + +// StartWebSiteNetworkTraceOperationPreparer prepares the StartWebSiteNetworkTraceOperation request. +func (client AppsClient) StartWebSiteNetworkTraceOperationPreparer(ctx context.Context, resourceGroupName string, name string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if durationInSeconds != nil { + queryParameters["durationInSeconds"] = autorest.Encode("query", *durationInSeconds) + } + if maxFrameLength != nil { + queryParameters["maxFrameLength"] = autorest.Encode("query", *maxFrameLength) + } + if len(sasURL) > 0 { + queryParameters["sasUrl"] = autorest.Encode("query", sasURL) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/startOperation", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartWebSiteNetworkTraceOperationSender sends the StartWebSiteNetworkTraceOperation request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartWebSiteNetworkTraceOperationSender(req *http.Request) (future AppsStartWebSiteNetworkTraceOperationFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartWebSiteNetworkTraceOperationResponder handles the response to the StartWebSiteNetworkTraceOperation request. The method always +// closes the http.Response Body. +func (client AppsClient) StartWebSiteNetworkTraceOperationResponder(resp *http.Response) (result ListNetworkTrace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StartWebSiteNetworkTraceOperationSlot description for Start capturing network packets for the site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// slot - the name of the slot for this web app. +// durationInSeconds - the duration to keep capturing in seconds. +// maxFrameLength - the maximum frame length in bytes (Optional). +// sasURL - the Blob URL to store capture file. +func (client AppsClient) StartWebSiteNetworkTraceOperationSlot(ctx context.Context, resourceGroupName string, name string, slot string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (result AppsStartWebSiteNetworkTraceOperationSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StartWebSiteNetworkTraceOperationSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StartWebSiteNetworkTraceOperationSlot", err.Error()) + } + + req, err := client.StartWebSiteNetworkTraceOperationSlotPreparer(ctx, resourceGroupName, name, slot, durationInSeconds, maxFrameLength, sasURL) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceOperationSlot", nil, "Failure preparing request") + return + } + + result, err = client.StartWebSiteNetworkTraceOperationSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceOperationSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// StartWebSiteNetworkTraceOperationSlotPreparer prepares the StartWebSiteNetworkTraceOperationSlot request. +func (client AppsClient) StartWebSiteNetworkTraceOperationSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if durationInSeconds != nil { + queryParameters["durationInSeconds"] = autorest.Encode("query", *durationInSeconds) + } + if maxFrameLength != nil { + queryParameters["maxFrameLength"] = autorest.Encode("query", *maxFrameLength) + } + if len(sasURL) > 0 { + queryParameters["sasUrl"] = autorest.Encode("query", sasURL) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/startOperation", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartWebSiteNetworkTraceOperationSlotSender sends the StartWebSiteNetworkTraceOperationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartWebSiteNetworkTraceOperationSlotSender(req *http.Request) (future AppsStartWebSiteNetworkTraceOperationSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartWebSiteNetworkTraceOperationSlotResponder handles the response to the StartWebSiteNetworkTraceOperationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StartWebSiteNetworkTraceOperationSlotResponder(resp *http.Response) (result ListNetworkTrace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StartWebSiteNetworkTraceSlot description for Start capturing network packets for the site (To be deprecated). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// slot - the name of the slot for this web app. +// durationInSeconds - the duration to keep capturing in seconds. +// maxFrameLength - the maximum frame length in bytes (Optional). +// sasURL - the Blob URL to store capture file. +func (client AppsClient) StartWebSiteNetworkTraceSlot(ctx context.Context, resourceGroupName string, name string, slot string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (result String, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StartWebSiteNetworkTraceSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StartWebSiteNetworkTraceSlot", err.Error()) + } + + req, err := client.StartWebSiteNetworkTraceSlotPreparer(ctx, resourceGroupName, name, slot, durationInSeconds, maxFrameLength, sasURL) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceSlot", nil, "Failure preparing request") + return + } + + resp, err := client.StartWebSiteNetworkTraceSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceSlot", resp, "Failure sending request") + return + } + + result, err = client.StartWebSiteNetworkTraceSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceSlot", resp, "Failure responding to request") + return + } + + return +} + +// StartWebSiteNetworkTraceSlotPreparer prepares the StartWebSiteNetworkTraceSlot request. +func (client AppsClient) StartWebSiteNetworkTraceSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if durationInSeconds != nil { + queryParameters["durationInSeconds"] = autorest.Encode("query", *durationInSeconds) + } + if maxFrameLength != nil { + queryParameters["maxFrameLength"] = autorest.Encode("query", *maxFrameLength) + } + if len(sasURL) > 0 { + queryParameters["sasUrl"] = autorest.Encode("query", sasURL) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartWebSiteNetworkTraceSlotSender sends the StartWebSiteNetworkTraceSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartWebSiteNetworkTraceSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StartWebSiteNetworkTraceSlotResponder handles the response to the StartWebSiteNetworkTraceSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StartWebSiteNetworkTraceSlotResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Stop description for Stops an app (or deployment slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) Stop(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Stop") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "Stop", err.Error()) + } + + req, err := client.StopPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Stop", nil, "Failure preparing request") + return + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "Stop", resp, "Failure sending request") + return + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Stop", resp, "Failure responding to request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client AppsClient) StopPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client AppsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StopContinuousWebJob description for Stop a continuous web job for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +func (client AppsClient) StopContinuousWebJob(ctx context.Context, resourceGroupName string, name string, webJobName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StopContinuousWebJob") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StopContinuousWebJob", err.Error()) + } + + req, err := client.StopContinuousWebJobPreparer(ctx, resourceGroupName, name, webJobName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopContinuousWebJob", nil, "Failure preparing request") + return + } + + resp, err := client.StopContinuousWebJobSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopContinuousWebJob", resp, "Failure sending request") + return + } + + result, err = client.StopContinuousWebJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopContinuousWebJob", resp, "Failure responding to request") + return + } + + return +} + +// StopContinuousWebJobPreparer prepares the StopContinuousWebJob request. +func (client AppsClient) StopContinuousWebJobPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopContinuousWebJobSender sends the StopContinuousWebJob request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopContinuousWebJobSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StopContinuousWebJobResponder handles the response to the StopContinuousWebJob request. The method always +// closes the http.Response Body. +func (client AppsClient) StopContinuousWebJobResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StopContinuousWebJobSlot description for Stop a continuous web job for an app, or a deployment slot. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site name. +// webJobName - name of Web Job. +// slot - name of the deployment slot. If a slot is not specified, the API deletes a deployment for the +// production slot. +func (client AppsClient) StopContinuousWebJobSlot(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StopContinuousWebJobSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StopContinuousWebJobSlot", err.Error()) + } + + req, err := client.StopContinuousWebJobSlotPreparer(ctx, resourceGroupName, name, webJobName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopContinuousWebJobSlot", nil, "Failure preparing request") + return + } + + resp, err := client.StopContinuousWebJobSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopContinuousWebJobSlot", resp, "Failure sending request") + return + } + + result, err = client.StopContinuousWebJobSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopContinuousWebJobSlot", resp, "Failure responding to request") + return + } + + return +} + +// StopContinuousWebJobSlotPreparer prepares the StopContinuousWebJobSlot request. +func (client AppsClient) StopContinuousWebJobSlotPreparer(ctx context.Context, resourceGroupName string, name string, webJobName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webJobName": autorest.Encode("path", webJobName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopContinuousWebJobSlotSender sends the StopContinuousWebJobSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopContinuousWebJobSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StopContinuousWebJobSlotResponder handles the response to the StopContinuousWebJobSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StopContinuousWebJobSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StopNetworkTrace description for Stop ongoing capturing network packets for the site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +func (client AppsClient) StopNetworkTrace(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StopNetworkTrace") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StopNetworkTrace", err.Error()) + } + + req, err := client.StopNetworkTracePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopNetworkTrace", nil, "Failure preparing request") + return + } + + resp, err := client.StopNetworkTraceSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopNetworkTrace", resp, "Failure sending request") + return + } + + result, err = client.StopNetworkTraceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopNetworkTrace", resp, "Failure responding to request") + return + } + + return +} + +// StopNetworkTracePreparer prepares the StopNetworkTrace request. +func (client AppsClient) StopNetworkTracePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stopNetworkTrace", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopNetworkTraceSender sends the StopNetworkTrace request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopNetworkTraceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StopNetworkTraceResponder handles the response to the StopNetworkTrace request. The method always +// closes the http.Response Body. +func (client AppsClient) StopNetworkTraceResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// StopNetworkTraceSlot description for Stop ongoing capturing network packets for the site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// slot - the name of the slot for this web app. +func (client AppsClient) StopNetworkTraceSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StopNetworkTraceSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StopNetworkTraceSlot", err.Error()) + } + + req, err := client.StopNetworkTraceSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopNetworkTraceSlot", nil, "Failure preparing request") + return + } + + resp, err := client.StopNetworkTraceSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopNetworkTraceSlot", resp, "Failure sending request") + return + } + + result, err = client.StopNetworkTraceSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopNetworkTraceSlot", resp, "Failure responding to request") + return + } + + return +} + +// StopNetworkTraceSlotPreparer prepares the StopNetworkTraceSlot request. +func (client AppsClient) StopNetworkTraceSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stopNetworkTrace", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopNetworkTraceSlotSender sends the StopNetworkTraceSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopNetworkTraceSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StopNetworkTraceSlotResponder handles the response to the StopNetworkTraceSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StopNetworkTraceSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// StopSlot description for Stops an app (or deployment slot, if specified). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will stop the production slot. +func (client AppsClient) StopSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StopSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StopSlot", err.Error()) + } + + req, err := client.StopSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopSlot", nil, "Failure preparing request") + return + } + + resp, err := client.StopSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopSlot", resp, "Failure sending request") + return + } + + result, err = client.StopSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopSlot", resp, "Failure responding to request") + return + } + + return +} + +// StopSlotPreparer prepares the StopSlot request. +func (client AppsClient) StopSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSlotSender sends the StopSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StopSlotResponder handles the response to the StopSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StopSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StopWebSiteNetworkTrace description for Stop ongoing capturing network packets for the site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +func (client AppsClient) StopWebSiteNetworkTrace(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StopWebSiteNetworkTrace") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StopWebSiteNetworkTrace", err.Error()) + } + + req, err := client.StopWebSiteNetworkTracePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTrace", nil, "Failure preparing request") + return + } + + resp, err := client.StopWebSiteNetworkTraceSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTrace", resp, "Failure sending request") + return + } + + result, err = client.StopWebSiteNetworkTraceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTrace", resp, "Failure responding to request") + return + } + + return +} + +// StopWebSiteNetworkTracePreparer prepares the StopWebSiteNetworkTrace request. +func (client AppsClient) StopWebSiteNetworkTracePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopWebSiteNetworkTraceSender sends the StopWebSiteNetworkTrace request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopWebSiteNetworkTraceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StopWebSiteNetworkTraceResponder handles the response to the StopWebSiteNetworkTrace request. The method always +// closes the http.Response Body. +func (client AppsClient) StopWebSiteNetworkTraceResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// StopWebSiteNetworkTraceSlot description for Stop ongoing capturing network packets for the site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// slot - the name of the slot for this web app. +func (client AppsClient) StopWebSiteNetworkTraceSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.StopWebSiteNetworkTraceSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "StopWebSiteNetworkTraceSlot", err.Error()) + } + + req, err := client.StopWebSiteNetworkTraceSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTraceSlot", nil, "Failure preparing request") + return + } + + resp, err := client.StopWebSiteNetworkTraceSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTraceSlot", resp, "Failure sending request") + return + } + + result, err = client.StopWebSiteNetworkTraceSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTraceSlot", resp, "Failure responding to request") + return + } + + return +} + +// StopWebSiteNetworkTraceSlotPreparer prepares the StopWebSiteNetworkTraceSlot request. +func (client AppsClient) StopWebSiteNetworkTraceSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopWebSiteNetworkTraceSlotSender sends the StopWebSiteNetworkTraceSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopWebSiteNetworkTraceSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StopWebSiteNetworkTraceSlotResponder handles the response to the StopWebSiteNetworkTraceSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StopWebSiteNetworkTraceSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// SwapSlotSlot description for Swaps two deployment slots of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slotSwapEntity - JSON object that contains the target slot name. See example. +// slot - name of the source slot. If a slot is not specified, the production slot is used as the source slot. +func (client AppsClient) SwapSlotSlot(ctx context.Context, resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (result AppsSwapSlotSlotFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.SwapSlotSlot") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "SwapSlotSlot", err.Error()) + } + + req, err := client.SwapSlotSlotPreparer(ctx, resourceGroupName, name, slotSwapEntity, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotSlot", nil, "Failure preparing request") + return + } + + result, err = client.SwapSlotSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// SwapSlotSlotPreparer prepares the SwapSlotSlot request. +func (client AppsClient) SwapSlotSlotPreparer(ctx context.Context, resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SwapSlotSlotSender sends the SwapSlotSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SwapSlotSlotSender(req *http.Request) (future AppsSwapSlotSlotFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// SwapSlotSlotResponder handles the response to the SwapSlotSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) SwapSlotSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// SwapSlotWithProduction description for Swaps two deployment slots of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slotSwapEntity - JSON object that contains the target slot name. See example. +func (client AppsClient) SwapSlotWithProduction(ctx context.Context, resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (result AppsSwapSlotWithProductionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.SwapSlotWithProduction") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "SwapSlotWithProduction", err.Error()) + } + + req, err := client.SwapSlotWithProductionPreparer(ctx, resourceGroupName, name, slotSwapEntity) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotWithProduction", nil, "Failure preparing request") + return + } + + result, err = client.SwapSlotWithProductionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotWithProduction", result.Response(), "Failure sending request") + return + } + + return +} + +// SwapSlotWithProductionPreparer prepares the SwapSlotWithProduction request. +func (client AppsClient) SwapSlotWithProductionPreparer(ctx context.Context, resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SwapSlotWithProductionSender sends the SwapSlotWithProduction request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SwapSlotWithProductionSender(req *http.Request) (future AppsSwapSlotWithProductionFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// SwapSlotWithProductionResponder handles the response to the SwapSlotWithProduction request. The method always +// closes the http.Response Body. +func (client AppsClient) SwapSlotWithProductionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// SyncFunctions description for Syncs function trigger metadata to the management database +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) SyncFunctions(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.SyncFunctions") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "SyncFunctions", err.Error()) + } + + req, err := client.SyncFunctionsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctions", nil, "Failure preparing request") + return + } + + resp, err := client.SyncFunctionsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctions", resp, "Failure sending request") + return + } + + result, err = client.SyncFunctionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctions", resp, "Failure responding to request") + return + } + + return +} + +// SyncFunctionsPreparer prepares the SyncFunctions request. +func (client AppsClient) SyncFunctionsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/host/default/sync", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SyncFunctionsSender sends the SyncFunctions request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SyncFunctionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SyncFunctionsResponder handles the response to the SyncFunctions request. The method always +// closes the http.Response Body. +func (client AppsClient) SyncFunctionsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// SyncFunctionsSlot description for Syncs function trigger metadata to the management database +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. +func (client AppsClient) SyncFunctionsSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.SyncFunctionsSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "SyncFunctionsSlot", err.Error()) + } + + req, err := client.SyncFunctionsSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.SyncFunctionsSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionsSlot", resp, "Failure sending request") + return + } + + result, err = client.SyncFunctionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionsSlot", resp, "Failure responding to request") + return + } + + return +} + +// SyncFunctionsSlotPreparer prepares the SyncFunctionsSlot request. +func (client AppsClient) SyncFunctionsSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/host/default/sync", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SyncFunctionsSlotSender sends the SyncFunctionsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SyncFunctionsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SyncFunctionsSlotResponder handles the response to the SyncFunctionsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) SyncFunctionsSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// SyncFunctionTriggers description for Syncs function trigger metadata to the management database +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) SyncFunctionTriggers(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.SyncFunctionTriggers") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "SyncFunctionTriggers", err.Error()) + } + + req, err := client.SyncFunctionTriggersPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggers", nil, "Failure preparing request") + return + } + + resp, err := client.SyncFunctionTriggersSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggers", resp, "Failure sending request") + return + } + + result, err = client.SyncFunctionTriggersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggers", resp, "Failure responding to request") + return + } + + return +} + +// SyncFunctionTriggersPreparer prepares the SyncFunctionTriggers request. +func (client AppsClient) SyncFunctionTriggersPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/syncfunctiontriggers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SyncFunctionTriggersSender sends the SyncFunctionTriggers request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SyncFunctionTriggersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SyncFunctionTriggersResponder handles the response to the SyncFunctionTriggers request. The method always +// closes the http.Response Body. +func (client AppsClient) SyncFunctionTriggersResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// SyncFunctionTriggersSlot description for Syncs function trigger metadata to the management database +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slot - name of the deployment slot. +func (client AppsClient) SyncFunctionTriggersSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.SyncFunctionTriggersSlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "SyncFunctionTriggersSlot", err.Error()) + } + + req, err := client.SyncFunctionTriggersSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggersSlot", nil, "Failure preparing request") + return + } + + resp, err := client.SyncFunctionTriggersSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggersSlot", resp, "Failure sending request") + return + } + + result, err = client.SyncFunctionTriggersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggersSlot", resp, "Failure responding to request") + return + } + + return +} + +// SyncFunctionTriggersSlotPreparer prepares the SyncFunctionTriggersSlot request. +func (client AppsClient) SyncFunctionTriggersSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/syncfunctiontriggers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SyncFunctionTriggersSlotSender sends the SyncFunctionTriggersSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SyncFunctionTriggersSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SyncFunctionTriggersSlotResponder handles the response to the SyncFunctionTriggersSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) SyncFunctionTriggersSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// SyncRepository description for Sync web app repository. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +func (client AppsClient) SyncRepository(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.SyncRepository") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "SyncRepository", err.Error()) + } + + req, err := client.SyncRepositoryPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepository", nil, "Failure preparing request") + return + } + + resp, err := client.SyncRepositorySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepository", resp, "Failure sending request") + return + } + + result, err = client.SyncRepositoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepository", resp, "Failure responding to request") + return + } + + return +} + +// SyncRepositoryPreparer prepares the SyncRepository request. +func (client AppsClient) SyncRepositoryPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sync", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SyncRepositorySender sends the SyncRepository request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SyncRepositorySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SyncRepositoryResponder handles the response to the SyncRepository request. The method always +// closes the http.Response Body. +func (client AppsClient) SyncRepositoryResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// SyncRepositorySlot description for Sync web app repository. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of web app slot. If not specified then will default to production slot. +func (client AppsClient) SyncRepositorySlot(ctx context.Context, resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.SyncRepositorySlot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "SyncRepositorySlot", err.Error()) + } + + req, err := client.SyncRepositorySlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepositorySlot", nil, "Failure preparing request") + return + } + + resp, err := client.SyncRepositorySlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepositorySlot", resp, "Failure sending request") + return + } + + result, err = client.SyncRepositorySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepositorySlot", resp, "Failure responding to request") + return + } + + return +} + +// SyncRepositorySlotPreparer prepares the SyncRepositorySlot request. +func (client AppsClient) SyncRepositorySlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sync", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SyncRepositorySlotSender sends the SyncRepositorySlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SyncRepositorySlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SyncRepositorySlotResponder handles the response to the SyncRepositorySlot request. The method always +// closes the http.Response Body. +func (client AppsClient) SyncRepositorySlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update description for Creates a new web, mobile, or API app in an existing resource group, or updates an existing +// app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - unique name of the app to create or update. To create or update a deployment slot, use the {slot} +// parameter. +// siteEnvelope - a JSON representation of the app properties. See example. +func (client AppsClient) Update(ctx context.Context, resourceGroupName string, name string, siteEnvelope SitePatchResource) (result Site, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, name, siteEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AppsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, siteEnvelope SitePatchResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", pathParameters), + autorest.WithJSON(siteEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateResponder(resp *http.Response) (result Site, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateApplicationSettings description for Replaces the application settings of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// appSettings - application settings of the app. +func (client AppsClient) UpdateApplicationSettings(ctx context.Context, resourceGroupName string, name string, appSettings StringDictionary) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateApplicationSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateApplicationSettings", err.Error()) + } + + req, err := client.UpdateApplicationSettingsPreparer(ctx, resourceGroupName, name, appSettings) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettings", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateApplicationSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettings", resp, "Failure sending request") + return + } + + result, err = client.UpdateApplicationSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettings", resp, "Failure responding to request") + return + } + + return +} + +// UpdateApplicationSettingsPreparer prepares the UpdateApplicationSettings request. +func (client AppsClient) UpdateApplicationSettingsPreparer(ctx context.Context, resourceGroupName string, name string, appSettings StringDictionary) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings", pathParameters), + autorest.WithJSON(appSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateApplicationSettingsSender sends the UpdateApplicationSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateApplicationSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateApplicationSettingsResponder handles the response to the UpdateApplicationSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateApplicationSettingsResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateApplicationSettingsSlot description for Replaces the application settings of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// appSettings - application settings of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will update the application settings +// for the production slot. +func (client AppsClient) UpdateApplicationSettingsSlot(ctx context.Context, resourceGroupName string, name string, appSettings StringDictionary, slot string) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateApplicationSettingsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateApplicationSettingsSlot", err.Error()) + } + + req, err := client.UpdateApplicationSettingsSlotPreparer(ctx, resourceGroupName, name, appSettings, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettingsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateApplicationSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettingsSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateApplicationSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettingsSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateApplicationSettingsSlotPreparer prepares the UpdateApplicationSettingsSlot request. +func (client AppsClient) UpdateApplicationSettingsSlotPreparer(ctx context.Context, resourceGroupName string, name string, appSettings StringDictionary, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings", pathParameters), + autorest.WithJSON(appSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateApplicationSettingsSlotSender sends the UpdateApplicationSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateApplicationSettingsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateApplicationSettingsSlotResponder handles the response to the UpdateApplicationSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateApplicationSettingsSlotResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateAuthSettings description for Updates the Authentication / Authorization settings associated with web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// siteAuthSettings - auth settings associated with web app. +func (client AppsClient) UpdateAuthSettings(ctx context.Context, resourceGroupName string, name string, siteAuthSettings SiteAuthSettings) (result SiteAuthSettings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateAuthSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateAuthSettings", err.Error()) + } + + req, err := client.UpdateAuthSettingsPreparer(ctx, resourceGroupName, name, siteAuthSettings) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettings", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateAuthSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettings", resp, "Failure sending request") + return + } + + result, err = client.UpdateAuthSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettings", resp, "Failure responding to request") + return + } + + return +} + +// UpdateAuthSettingsPreparer prepares the UpdateAuthSettings request. +func (client AppsClient) UpdateAuthSettingsPreparer(ctx context.Context, resourceGroupName string, name string, siteAuthSettings SiteAuthSettings) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings", pathParameters), + autorest.WithJSON(siteAuthSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateAuthSettingsSender sends the UpdateAuthSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateAuthSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateAuthSettingsResponder handles the response to the UpdateAuthSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateAuthSettingsResponder(resp *http.Response) (result SiteAuthSettings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateAuthSettingsSlot description for Updates the Authentication / Authorization settings associated with web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// siteAuthSettings - auth settings associated with web app. +// slot - name of web app slot. If not specified then will default to production slot. +func (client AppsClient) UpdateAuthSettingsSlot(ctx context.Context, resourceGroupName string, name string, siteAuthSettings SiteAuthSettings, slot string) (result SiteAuthSettings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateAuthSettingsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateAuthSettingsSlot", err.Error()) + } + + req, err := client.UpdateAuthSettingsSlotPreparer(ctx, resourceGroupName, name, siteAuthSettings, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateAuthSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateAuthSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateAuthSettingsSlotPreparer prepares the UpdateAuthSettingsSlot request. +func (client AppsClient) UpdateAuthSettingsSlotPreparer(ctx context.Context, resourceGroupName string, name string, siteAuthSettings SiteAuthSettings, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings", pathParameters), + autorest.WithJSON(siteAuthSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateAuthSettingsSlotSender sends the UpdateAuthSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateAuthSettingsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateAuthSettingsSlotResponder handles the response to the UpdateAuthSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateAuthSettingsSlotResponder(resp *http.Response) (result SiteAuthSettings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateAuthSettingsV2 description for Updates site's Authentication / Authorization settings for apps via the V2 +// format +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// siteAuthSettingsV2 - auth settings associated with web app. +func (client AppsClient) UpdateAuthSettingsV2(ctx context.Context, resourceGroupName string, name string, siteAuthSettingsV2 SiteAuthSettingsV2) (result SiteAuthSettingsV2, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateAuthSettingsV2") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateAuthSettingsV2", err.Error()) + } + + req, err := client.UpdateAuthSettingsV2Preparer(ctx, resourceGroupName, name, siteAuthSettingsV2) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsV2", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateAuthSettingsV2Sender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsV2", resp, "Failure sending request") + return + } + + result, err = client.UpdateAuthSettingsV2Responder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsV2", resp, "Failure responding to request") + return + } + + return +} + +// UpdateAuthSettingsV2Preparer prepares the UpdateAuthSettingsV2 request. +func (client AppsClient) UpdateAuthSettingsV2Preparer(ctx context.Context, resourceGroupName string, name string, siteAuthSettingsV2 SiteAuthSettingsV2) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettingsV2", pathParameters), + autorest.WithJSON(siteAuthSettingsV2), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateAuthSettingsV2Sender sends the UpdateAuthSettingsV2 request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateAuthSettingsV2Sender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateAuthSettingsV2Responder handles the response to the UpdateAuthSettingsV2 request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateAuthSettingsV2Responder(resp *http.Response) (result SiteAuthSettingsV2, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateAuthSettingsV2Slot description for Updates site's Authentication / Authorization settings for apps via the V2 +// format +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// siteAuthSettingsV2 - auth settings associated with web app. +// slot - name of web app slot. If not specified then will default to production slot. +func (client AppsClient) UpdateAuthSettingsV2Slot(ctx context.Context, resourceGroupName string, name string, siteAuthSettingsV2 SiteAuthSettingsV2, slot string) (result SiteAuthSettingsV2, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateAuthSettingsV2Slot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateAuthSettingsV2Slot", err.Error()) + } + + req, err := client.UpdateAuthSettingsV2SlotPreparer(ctx, resourceGroupName, name, siteAuthSettingsV2, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsV2Slot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateAuthSettingsV2SlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsV2Slot", resp, "Failure sending request") + return + } + + result, err = client.UpdateAuthSettingsV2SlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsV2Slot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateAuthSettingsV2SlotPreparer prepares the UpdateAuthSettingsV2Slot request. +func (client AppsClient) UpdateAuthSettingsV2SlotPreparer(ctx context.Context, resourceGroupName string, name string, siteAuthSettingsV2 SiteAuthSettingsV2, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettingsV2", pathParameters), + autorest.WithJSON(siteAuthSettingsV2), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateAuthSettingsV2SlotSender sends the UpdateAuthSettingsV2Slot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateAuthSettingsV2SlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateAuthSettingsV2SlotResponder handles the response to the UpdateAuthSettingsV2Slot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateAuthSettingsV2SlotResponder(resp *http.Response) (result SiteAuthSettingsV2, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateAzureStorageAccounts description for Updates the Azure storage account configurations of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// azureStorageAccounts - azure storage accounts of the app. +func (client AppsClient) UpdateAzureStorageAccounts(ctx context.Context, resourceGroupName string, name string, azureStorageAccounts AzureStoragePropertyDictionaryResource) (result AzureStoragePropertyDictionaryResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateAzureStorageAccounts") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateAzureStorageAccounts", err.Error()) + } + + req, err := client.UpdateAzureStorageAccountsPreparer(ctx, resourceGroupName, name, azureStorageAccounts) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAzureStorageAccounts", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateAzureStorageAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAzureStorageAccounts", resp, "Failure sending request") + return + } + + result, err = client.UpdateAzureStorageAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAzureStorageAccounts", resp, "Failure responding to request") + return + } + + return +} + +// UpdateAzureStorageAccountsPreparer prepares the UpdateAzureStorageAccounts request. +func (client AppsClient) UpdateAzureStorageAccountsPreparer(ctx context.Context, resourceGroupName string, name string, azureStorageAccounts AzureStoragePropertyDictionaryResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/azurestorageaccounts", pathParameters), + autorest.WithJSON(azureStorageAccounts), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateAzureStorageAccountsSender sends the UpdateAzureStorageAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateAzureStorageAccountsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateAzureStorageAccountsResponder handles the response to the UpdateAzureStorageAccounts request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateAzureStorageAccountsResponder(resp *http.Response) (result AzureStoragePropertyDictionaryResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateAzureStorageAccountsSlot description for Updates the Azure storage account configurations of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// azureStorageAccounts - azure storage accounts of the app. +// slot - name of the deployment slot. If a slot is not specified, the API will update the Azure storage +// account configurations for the production slot. +func (client AppsClient) UpdateAzureStorageAccountsSlot(ctx context.Context, resourceGroupName string, name string, azureStorageAccounts AzureStoragePropertyDictionaryResource, slot string) (result AzureStoragePropertyDictionaryResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateAzureStorageAccountsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateAzureStorageAccountsSlot", err.Error()) + } + + req, err := client.UpdateAzureStorageAccountsSlotPreparer(ctx, resourceGroupName, name, azureStorageAccounts, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAzureStorageAccountsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateAzureStorageAccountsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAzureStorageAccountsSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateAzureStorageAccountsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAzureStorageAccountsSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateAzureStorageAccountsSlotPreparer prepares the UpdateAzureStorageAccountsSlot request. +func (client AppsClient) UpdateAzureStorageAccountsSlotPreparer(ctx context.Context, resourceGroupName string, name string, azureStorageAccounts AzureStoragePropertyDictionaryResource, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/azurestorageaccounts", pathParameters), + autorest.WithJSON(azureStorageAccounts), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateAzureStorageAccountsSlotSender sends the UpdateAzureStorageAccountsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateAzureStorageAccountsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateAzureStorageAccountsSlotResponder handles the response to the UpdateAzureStorageAccountsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateAzureStorageAccountsSlotResponder(resp *http.Response) (result AzureStoragePropertyDictionaryResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateBackupConfiguration description for Updates the backup configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// request - edited backup configuration. +func (client AppsClient) UpdateBackupConfiguration(ctx context.Context, resourceGroupName string, name string, request BackupRequest) (result BackupRequest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateBackupConfiguration") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.StorageAccountURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateBackupConfiguration", err.Error()) + } + + req, err := client.UpdateBackupConfigurationPreparer(ctx, resourceGroupName, name, request) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateBackupConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfiguration", resp, "Failure sending request") + return + } + + result, err = client.UpdateBackupConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfiguration", resp, "Failure responding to request") + return + } + + return +} + +// UpdateBackupConfigurationPreparer prepares the UpdateBackupConfiguration request. +func (client AppsClient) UpdateBackupConfigurationPreparer(ctx context.Context, resourceGroupName string, name string, request BackupRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateBackupConfigurationSender sends the UpdateBackupConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateBackupConfigurationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateBackupConfigurationResponder handles the response to the UpdateBackupConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateBackupConfigurationResponder(resp *http.Response) (result BackupRequest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateBackupConfigurationSlot description for Updates the backup configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// request - edited backup configuration. +// slot - name of the deployment slot. If a slot is not specified, the API will update the backup configuration +// for the production slot. +func (client AppsClient) UpdateBackupConfigurationSlot(ctx context.Context, resourceGroupName string, name string, request BackupRequest, slot string) (result BackupRequest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateBackupConfigurationSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.StorageAccountURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateBackupConfigurationSlot", err.Error()) + } + + req, err := client.UpdateBackupConfigurationSlotPreparer(ctx, resourceGroupName, name, request, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateBackupConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateBackupConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfigurationSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateBackupConfigurationSlotPreparer prepares the UpdateBackupConfigurationSlot request. +func (client AppsClient) UpdateBackupConfigurationSlotPreparer(ctx context.Context, resourceGroupName string, name string, request BackupRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateBackupConfigurationSlotSender sends the UpdateBackupConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateBackupConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateBackupConfigurationSlotResponder handles the response to the UpdateBackupConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateBackupConfigurationSlotResponder(resp *http.Response) (result BackupRequest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateConfiguration description for Updates the configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// siteConfig - JSON representation of a SiteConfig object. See example. +func (client AppsClient) UpdateConfiguration(ctx context.Context, resourceGroupName string, name string, siteConfig SiteConfigResource) (result SiteConfigResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateConfiguration") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateConfiguration", err.Error()) + } + + req, err := client.UpdateConfigurationPreparer(ctx, resourceGroupName, name, siteConfig) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfiguration", resp, "Failure sending request") + return + } + + result, err = client.UpdateConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfiguration", resp, "Failure responding to request") + return + } + + return +} + +// UpdateConfigurationPreparer prepares the UpdateConfiguration request. +func (client AppsClient) UpdateConfigurationPreparer(ctx context.Context, resourceGroupName string, name string, siteConfig SiteConfigResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web", pathParameters), + autorest.WithJSON(siteConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateConfigurationSender sends the UpdateConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateConfigurationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateConfigurationResponder handles the response to the UpdateConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateConfigurationResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateConfigurationSlot description for Updates the configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// siteConfig - JSON representation of a SiteConfig object. See example. +// slot - name of the deployment slot. If a slot is not specified, the API will update configuration for the +// production slot. +func (client AppsClient) UpdateConfigurationSlot(ctx context.Context, resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (result SiteConfigResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateConfigurationSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateConfigurationSlot", err.Error()) + } + + req, err := client.UpdateConfigurationSlotPreparer(ctx, resourceGroupName, name, siteConfig, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfigurationSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateConfigurationSlotPreparer prepares the UpdateConfigurationSlot request. +func (client AppsClient) UpdateConfigurationSlotPreparer(ctx context.Context, resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web", pathParameters), + autorest.WithJSON(siteConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateConfigurationSlotSender sends the UpdateConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateConfigurationSlotResponder handles the response to the UpdateConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateConfigurationSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateConnectionStrings description for Replaces the connection strings of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// connectionStrings - connection strings of the app or deployment slot. See example. +func (client AppsClient) UpdateConnectionStrings(ctx context.Context, resourceGroupName string, name string, connectionStrings ConnectionStringDictionary) (result ConnectionStringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateConnectionStrings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateConnectionStrings", err.Error()) + } + + req, err := client.UpdateConnectionStringsPreparer(ctx, resourceGroupName, name, connectionStrings) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStrings", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateConnectionStringsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStrings", resp, "Failure sending request") + return + } + + result, err = client.UpdateConnectionStringsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStrings", resp, "Failure responding to request") + return + } + + return +} + +// UpdateConnectionStringsPreparer prepares the UpdateConnectionStrings request. +func (client AppsClient) UpdateConnectionStringsPreparer(ctx context.Context, resourceGroupName string, name string, connectionStrings ConnectionStringDictionary) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings", pathParameters), + autorest.WithJSON(connectionStrings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateConnectionStringsSender sends the UpdateConnectionStrings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateConnectionStringsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateConnectionStringsResponder handles the response to the UpdateConnectionStrings request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateConnectionStringsResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateConnectionStringsSlot description for Replaces the connection strings of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// connectionStrings - connection strings of the app or deployment slot. See example. +// slot - name of the deployment slot. If a slot is not specified, the API will update the connection settings +// for the production slot. +func (client AppsClient) UpdateConnectionStringsSlot(ctx context.Context, resourceGroupName string, name string, connectionStrings ConnectionStringDictionary, slot string) (result ConnectionStringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateConnectionStringsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateConnectionStringsSlot", err.Error()) + } + + req, err := client.UpdateConnectionStringsSlotPreparer(ctx, resourceGroupName, name, connectionStrings, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStringsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateConnectionStringsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStringsSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateConnectionStringsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStringsSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateConnectionStringsSlotPreparer prepares the UpdateConnectionStringsSlot request. +func (client AppsClient) UpdateConnectionStringsSlotPreparer(ctx context.Context, resourceGroupName string, name string, connectionStrings ConnectionStringDictionary, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings", pathParameters), + autorest.WithJSON(connectionStrings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateConnectionStringsSlotSender sends the UpdateConnectionStringsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateConnectionStringsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateConnectionStringsSlotResponder handles the response to the UpdateConnectionStringsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateConnectionStringsSlotResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateDiagnosticLogsConfig description for Updates the logging configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// siteLogsConfig - a SiteLogsConfig JSON object that contains the logging configuration to change in the +// "properties" property. +func (client AppsClient) UpdateDiagnosticLogsConfig(ctx context.Context, resourceGroupName string, name string, siteLogsConfig SiteLogsConfig) (result SiteLogsConfig, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateDiagnosticLogsConfig") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteLogsConfig, + Constraints: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage.SasURL", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, + {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMinimum, Rule: int64(25), Chain: nil}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateDiagnosticLogsConfig", err.Error()) + } + + req, err := client.UpdateDiagnosticLogsConfigPreparer(ctx, resourceGroupName, name, siteLogsConfig) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfig", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateDiagnosticLogsConfigSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfig", resp, "Failure sending request") + return + } + + result, err = client.UpdateDiagnosticLogsConfigResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfig", resp, "Failure responding to request") + return + } + + return +} + +// UpdateDiagnosticLogsConfigPreparer prepares the UpdateDiagnosticLogsConfig request. +func (client AppsClient) UpdateDiagnosticLogsConfigPreparer(ctx context.Context, resourceGroupName string, name string, siteLogsConfig SiteLogsConfig) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs", pathParameters), + autorest.WithJSON(siteLogsConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateDiagnosticLogsConfigSender sends the UpdateDiagnosticLogsConfig request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateDiagnosticLogsConfigSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateDiagnosticLogsConfigResponder handles the response to the UpdateDiagnosticLogsConfig request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateDiagnosticLogsConfigResponder(resp *http.Response) (result SiteLogsConfig, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateDiagnosticLogsConfigSlot description for Updates the logging configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// siteLogsConfig - a SiteLogsConfig JSON object that contains the logging configuration to change in the +// "properties" property. +// slot - name of the deployment slot. If a slot is not specified, the API will update the logging +// configuration for the production slot. +func (client AppsClient) UpdateDiagnosticLogsConfigSlot(ctx context.Context, resourceGroupName string, name string, siteLogsConfig SiteLogsConfig, slot string) (result SiteLogsConfig, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateDiagnosticLogsConfigSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteLogsConfig, + Constraints: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage.SasURL", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, + {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMinimum, Rule: int64(25), Chain: nil}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateDiagnosticLogsConfigSlot", err.Error()) + } + + req, err := client.UpdateDiagnosticLogsConfigSlotPreparer(ctx, resourceGroupName, name, siteLogsConfig, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfigSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateDiagnosticLogsConfigSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfigSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateDiagnosticLogsConfigSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfigSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateDiagnosticLogsConfigSlotPreparer prepares the UpdateDiagnosticLogsConfigSlot request. +func (client AppsClient) UpdateDiagnosticLogsConfigSlotPreparer(ctx context.Context, resourceGroupName string, name string, siteLogsConfig SiteLogsConfig, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs", pathParameters), + autorest.WithJSON(siteLogsConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateDiagnosticLogsConfigSlotSender sends the UpdateDiagnosticLogsConfigSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateDiagnosticLogsConfigSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateDiagnosticLogsConfigSlotResponder handles the response to the UpdateDiagnosticLogsConfigSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateDiagnosticLogsConfigSlotResponder(resp *http.Response) (result SiteLogsConfig, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateDomainOwnershipIdentifier description for Creates a domain ownership identifier for web app, or updates an +// existing ownership identifier. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// domainOwnershipIdentifierName - name of domain ownership identifier. +// domainOwnershipIdentifier - a JSON representation of the domain ownership properties. +func (client AppsClient) UpdateDomainOwnershipIdentifier(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (result Identifier, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateDomainOwnershipIdentifier") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateDomainOwnershipIdentifier", err.Error()) + } + + req, err := client.UpdateDomainOwnershipIdentifierPreparer(ctx, resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateDomainOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.UpdateDomainOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifier", resp, "Failure responding to request") + return + } + + return +} + +// UpdateDomainOwnershipIdentifierPreparer prepares the UpdateDomainOwnershipIdentifier request. +func (client AppsClient) UpdateDomainOwnershipIdentifierPreparer(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateDomainOwnershipIdentifierSender sends the UpdateDomainOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateDomainOwnershipIdentifierResponder handles the response to the UpdateDomainOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateDomainOwnershipIdentifierResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateDomainOwnershipIdentifierSlot description for Creates a domain ownership identifier for web app, or updates an +// existing ownership identifier. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// domainOwnershipIdentifierName - name of domain ownership identifier. +// domainOwnershipIdentifier - a JSON representation of the domain ownership properties. +// slot - name of the deployment slot. If a slot is not specified, the API will delete the binding for the +// production slot. +func (client AppsClient) UpdateDomainOwnershipIdentifierSlot(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (result Identifier, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateDomainOwnershipIdentifierSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateDomainOwnershipIdentifierSlot", err.Error()) + } + + req, err := client.UpdateDomainOwnershipIdentifierSlotPreparer(ctx, resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifierSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateDomainOwnershipIdentifierSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifierSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateDomainOwnershipIdentifierSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifierSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateDomainOwnershipIdentifierSlotPreparer prepares the UpdateDomainOwnershipIdentifierSlot request. +func (client AppsClient) UpdateDomainOwnershipIdentifierSlotPreparer(ctx context.Context, resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateDomainOwnershipIdentifierSlotSender sends the UpdateDomainOwnershipIdentifierSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateDomainOwnershipIdentifierSlotResponder handles the response to the UpdateDomainOwnershipIdentifierSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateFtpAllowed description for Updates whether FTP is allowed on the site or not. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) UpdateFtpAllowed(ctx context.Context, resourceGroupName string, name string, csmPublishingAccessPoliciesEntity CsmPublishingCredentialsPoliciesEntity) (result CsmPublishingCredentialsPoliciesEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateFtpAllowed") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: csmPublishingAccessPoliciesEntity, + Constraints: []validation.Constraint{{Target: "csmPublishingAccessPoliciesEntity.CsmPublishingCredentialsPoliciesEntityProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "csmPublishingAccessPoliciesEntity.CsmPublishingCredentialsPoliciesEntityProperties.Allow", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateFtpAllowed", err.Error()) + } + + req, err := client.UpdateFtpAllowedPreparer(ctx, resourceGroupName, name, csmPublishingAccessPoliciesEntity) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateFtpAllowed", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateFtpAllowedSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateFtpAllowed", resp, "Failure sending request") + return + } + + result, err = client.UpdateFtpAllowedResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateFtpAllowed", resp, "Failure responding to request") + return + } + + return +} + +// UpdateFtpAllowedPreparer prepares the UpdateFtpAllowed request. +func (client AppsClient) UpdateFtpAllowedPreparer(ctx context.Context, resourceGroupName string, name string, csmPublishingAccessPoliciesEntity CsmPublishingCredentialsPoliciesEntity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/ftp", pathParameters), + autorest.WithJSON(csmPublishingAccessPoliciesEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateFtpAllowedSender sends the UpdateFtpAllowed request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateFtpAllowedSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateFtpAllowedResponder handles the response to the UpdateFtpAllowed request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateFtpAllowedResponder(resp *http.Response) (result CsmPublishingCredentialsPoliciesEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateFtpAllowedSlot description for Updates whether FTP is allowed on the site or not. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) UpdateFtpAllowedSlot(ctx context.Context, resourceGroupName string, name string, csmPublishingAccessPoliciesEntity CsmPublishingCredentialsPoliciesEntity, slot string) (result CsmPublishingCredentialsPoliciesEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateFtpAllowedSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: csmPublishingAccessPoliciesEntity, + Constraints: []validation.Constraint{{Target: "csmPublishingAccessPoliciesEntity.CsmPublishingCredentialsPoliciesEntityProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "csmPublishingAccessPoliciesEntity.CsmPublishingCredentialsPoliciesEntityProperties.Allow", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateFtpAllowedSlot", err.Error()) + } + + req, err := client.UpdateFtpAllowedSlotPreparer(ctx, resourceGroupName, name, csmPublishingAccessPoliciesEntity, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateFtpAllowedSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateFtpAllowedSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateFtpAllowedSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateFtpAllowedSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateFtpAllowedSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateFtpAllowedSlotPreparer prepares the UpdateFtpAllowedSlot request. +func (client AppsClient) UpdateFtpAllowedSlotPreparer(ctx context.Context, resourceGroupName string, name string, csmPublishingAccessPoliciesEntity CsmPublishingCredentialsPoliciesEntity, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/basicPublishingCredentialsPolicies/ftp", pathParameters), + autorest.WithJSON(csmPublishingAccessPoliciesEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateFtpAllowedSlotSender sends the UpdateFtpAllowedSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateFtpAllowedSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateFtpAllowedSlotResponder handles the response to the UpdateFtpAllowedSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateFtpAllowedSlotResponder(resp *http.Response) (result CsmPublishingCredentialsPoliciesEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateHybridConnection description for Creates a new Hybrid Connection using a Service Bus relay. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// namespaceName - the namespace for this hybrid connection. +// relayName - the relay name for this hybrid connection. +// connectionEnvelope - the details of the hybrid connection. +func (client AppsClient) UpdateHybridConnection(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (result HybridConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateHybridConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateHybridConnection", err.Error()) + } + + req, err := client.UpdateHybridConnectionPreparer(ctx, resourceGroupName, name, namespaceName, relayName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnection", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnection", resp, "Failure sending request") + return + } + + result, err = client.UpdateHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnection", resp, "Failure responding to request") + return + } + + return +} + +// UpdateHybridConnectionPreparer prepares the UpdateHybridConnection request. +func (client AppsClient) UpdateHybridConnectionPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateHybridConnectionSender sends the UpdateHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateHybridConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateHybridConnectionResponder handles the response to the UpdateHybridConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateHybridConnectionSlot description for Creates a new Hybrid Connection using a Service Bus relay. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - the name of the web app. +// namespaceName - the namespace for this hybrid connection. +// relayName - the relay name for this hybrid connection. +// connectionEnvelope - the details of the hybrid connection. +// slot - the name of the slot for the web app. +func (client AppsClient) UpdateHybridConnectionSlot(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (result HybridConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateHybridConnectionSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateHybridConnectionSlot", err.Error()) + } + + req, err := client.UpdateHybridConnectionSlotPreparer(ctx, resourceGroupName, name, namespaceName, relayName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateHybridConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateHybridConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnectionSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateHybridConnectionSlotPreparer prepares the UpdateHybridConnectionSlot request. +func (client AppsClient) UpdateHybridConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateHybridConnectionSlotSender sends the UpdateHybridConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateHybridConnectionSlotResponder handles the response to the UpdateHybridConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateHybridConnectionSlotResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateMetadata description for Replaces the metadata of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// metadata - edited metadata of the app or deployment slot. See example. +func (client AppsClient) UpdateMetadata(ctx context.Context, resourceGroupName string, name string, metadata StringDictionary) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateMetadata") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateMetadata", err.Error()) + } + + req, err := client.UpdateMetadataPreparer(ctx, resourceGroupName, name, metadata) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadata", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateMetadataSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadata", resp, "Failure sending request") + return + } + + result, err = client.UpdateMetadataResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadata", resp, "Failure responding to request") + return + } + + return +} + +// UpdateMetadataPreparer prepares the UpdateMetadata request. +func (client AppsClient) UpdateMetadataPreparer(ctx context.Context, resourceGroupName string, name string, metadata StringDictionary) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata", pathParameters), + autorest.WithJSON(metadata), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateMetadataSender sends the UpdateMetadata request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateMetadataSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateMetadataResponder handles the response to the UpdateMetadata request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateMetadataResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateMetadataSlot description for Replaces the metadata of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// metadata - edited metadata of the app or deployment slot. See example. +// slot - name of the deployment slot. If a slot is not specified, the API will update the metadata for the +// production slot. +func (client AppsClient) UpdateMetadataSlot(ctx context.Context, resourceGroupName string, name string, metadata StringDictionary, slot string) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateMetadataSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateMetadataSlot", err.Error()) + } + + req, err := client.UpdateMetadataSlotPreparer(ctx, resourceGroupName, name, metadata, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadataSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateMetadataSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadataSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateMetadataSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadataSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateMetadataSlotPreparer prepares the UpdateMetadataSlot request. +func (client AppsClient) UpdateMetadataSlotPreparer(ctx context.Context, resourceGroupName string, name string, metadata StringDictionary, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata", pathParameters), + autorest.WithJSON(metadata), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateMetadataSlotSender sends the UpdateMetadataSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateMetadataSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateMetadataSlotResponder handles the response to the UpdateMetadataSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateMetadataSlotResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePremierAddOn description for Updates a named add-on of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// premierAddOnName - add-on name. +// premierAddOn - a JSON representation of the edited premier add-on. +func (client AppsClient) UpdatePremierAddOn(ctx context.Context, resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOnPatchResource) (result PremierAddOn, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdatePremierAddOn") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdatePremierAddOn", err.Error()) + } + + req, err := client.UpdatePremierAddOnPreparer(ctx, resourceGroupName, name, premierAddOnName, premierAddOn) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdatePremierAddOn", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePremierAddOnSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdatePremierAddOn", resp, "Failure sending request") + return + } + + result, err = client.UpdatePremierAddOnResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdatePremierAddOn", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePremierAddOnPreparer prepares the UpdatePremierAddOn request. +func (client AppsClient) UpdatePremierAddOnPreparer(ctx context.Context, resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOnPatchResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithJSON(premierAddOn), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePremierAddOnSender sends the UpdatePremierAddOn request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdatePremierAddOnSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdatePremierAddOnResponder handles the response to the UpdatePremierAddOn request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdatePremierAddOnResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePremierAddOnSlot description for Updates a named add-on of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// premierAddOnName - add-on name. +// premierAddOn - a JSON representation of the edited premier add-on. +// slot - name of the deployment slot. If a slot is not specified, the API will update the named add-on for the +// production slot. +func (client AppsClient) UpdatePremierAddOnSlot(ctx context.Context, resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOnPatchResource, slot string) (result PremierAddOn, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdatePremierAddOnSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdatePremierAddOnSlot", err.Error()) + } + + req, err := client.UpdatePremierAddOnSlotPreparer(ctx, resourceGroupName, name, premierAddOnName, premierAddOn, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdatePremierAddOnSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePremierAddOnSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdatePremierAddOnSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdatePremierAddOnSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdatePremierAddOnSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePremierAddOnSlotPreparer prepares the UpdatePremierAddOnSlot request. +func (client AppsClient) UpdatePremierAddOnSlotPreparer(ctx context.Context, resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOnPatchResource, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithJSON(premierAddOn), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePremierAddOnSlotSender sends the UpdatePremierAddOnSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdatePremierAddOnSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdatePremierAddOnSlotResponder handles the response to the UpdatePremierAddOnSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdatePremierAddOnSlotResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateRelayServiceConnection description for Creates a new hybrid connection configuration (PUT), or updates an +// existing one (PATCH). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// entityName - name of the hybrid connection configuration. +// connectionEnvelope - details of the hybrid connection configuration. +func (client AppsClient) UpdateRelayServiceConnection(ctx context.Context, resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (result RelayServiceConnectionEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateRelayServiceConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateRelayServiceConnection", err.Error()) + } + + req, err := client.UpdateRelayServiceConnectionPreparer(ctx, resourceGroupName, name, entityName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnection", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateRelayServiceConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnection", resp, "Failure sending request") + return + } + + result, err = client.UpdateRelayServiceConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnection", resp, "Failure responding to request") + return + } + + return +} + +// UpdateRelayServiceConnectionPreparer prepares the UpdateRelayServiceConnection request. +func (client AppsClient) UpdateRelayServiceConnectionPreparer(ctx context.Context, resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateRelayServiceConnectionSender sends the UpdateRelayServiceConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateRelayServiceConnectionResponder handles the response to the UpdateRelayServiceConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateRelayServiceConnectionResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateRelayServiceConnectionSlot description for Creates a new hybrid connection configuration (PUT), or updates an +// existing one (PATCH). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// entityName - name of the hybrid connection configuration. +// connectionEnvelope - details of the hybrid connection configuration. +// slot - name of the deployment slot. If a slot is not specified, the API will create or update a hybrid +// connection for the production slot. +func (client AppsClient) UpdateRelayServiceConnectionSlot(ctx context.Context, resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (result RelayServiceConnectionEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateRelayServiceConnectionSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateRelayServiceConnectionSlot", err.Error()) + } + + req, err := client.UpdateRelayServiceConnectionSlotPreparer(ctx, resourceGroupName, name, entityName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateRelayServiceConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateRelayServiceConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnectionSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateRelayServiceConnectionSlotPreparer prepares the UpdateRelayServiceConnectionSlot request. +func (client AppsClient) UpdateRelayServiceConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateRelayServiceConnectionSlotSender sends the UpdateRelayServiceConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateRelayServiceConnectionSlotResponder handles the response to the UpdateRelayServiceConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateRelayServiceConnectionSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateScmAllowed description for Updates whether user publishing credentials are allowed on the site or not. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) UpdateScmAllowed(ctx context.Context, resourceGroupName string, name string, csmPublishingAccessPoliciesEntity CsmPublishingCredentialsPoliciesEntity) (result CsmPublishingCredentialsPoliciesEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateScmAllowed") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: csmPublishingAccessPoliciesEntity, + Constraints: []validation.Constraint{{Target: "csmPublishingAccessPoliciesEntity.CsmPublishingCredentialsPoliciesEntityProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "csmPublishingAccessPoliciesEntity.CsmPublishingCredentialsPoliciesEntityProperties.Allow", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateScmAllowed", err.Error()) + } + + req, err := client.UpdateScmAllowedPreparer(ctx, resourceGroupName, name, csmPublishingAccessPoliciesEntity) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateScmAllowed", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateScmAllowedSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateScmAllowed", resp, "Failure sending request") + return + } + + result, err = client.UpdateScmAllowedResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateScmAllowed", resp, "Failure responding to request") + return + } + + return +} + +// UpdateScmAllowedPreparer prepares the UpdateScmAllowed request. +func (client AppsClient) UpdateScmAllowedPreparer(ctx context.Context, resourceGroupName string, name string, csmPublishingAccessPoliciesEntity CsmPublishingCredentialsPoliciesEntity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/scm", pathParameters), + autorest.WithJSON(csmPublishingAccessPoliciesEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateScmAllowedSender sends the UpdateScmAllowed request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateScmAllowedSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateScmAllowedResponder handles the response to the UpdateScmAllowed request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateScmAllowedResponder(resp *http.Response) (result CsmPublishingCredentialsPoliciesEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateScmAllowedSlot description for Updates whether user publishing credentials are allowed on the site or not. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +func (client AppsClient) UpdateScmAllowedSlot(ctx context.Context, resourceGroupName string, name string, csmPublishingAccessPoliciesEntity CsmPublishingCredentialsPoliciesEntity, slot string) (result CsmPublishingCredentialsPoliciesEntity, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateScmAllowedSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: csmPublishingAccessPoliciesEntity, + Constraints: []validation.Constraint{{Target: "csmPublishingAccessPoliciesEntity.CsmPublishingCredentialsPoliciesEntityProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "csmPublishingAccessPoliciesEntity.CsmPublishingCredentialsPoliciesEntityProperties.Allow", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateScmAllowedSlot", err.Error()) + } + + req, err := client.UpdateScmAllowedSlotPreparer(ctx, resourceGroupName, name, csmPublishingAccessPoliciesEntity, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateScmAllowedSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateScmAllowedSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateScmAllowedSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateScmAllowedSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateScmAllowedSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateScmAllowedSlotPreparer prepares the UpdateScmAllowedSlot request. +func (client AppsClient) UpdateScmAllowedSlotPreparer(ctx context.Context, resourceGroupName string, name string, csmPublishingAccessPoliciesEntity CsmPublishingCredentialsPoliciesEntity, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/basicPublishingCredentialsPolicies/scm", pathParameters), + autorest.WithJSON(csmPublishingAccessPoliciesEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateScmAllowedSlotSender sends the UpdateScmAllowedSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateScmAllowedSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateScmAllowedSlotResponder handles the response to the UpdateScmAllowedSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateScmAllowedSlotResponder(resp *http.Response) (result CsmPublishingCredentialsPoliciesEntity, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSitePushSettings description for Updates the Push settings associated with web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// pushSettings - push settings associated with web app. +func (client AppsClient) UpdateSitePushSettings(ctx context.Context, resourceGroupName string, name string, pushSettings PushSettings) (result PushSettings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateSitePushSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: pushSettings, + Constraints: []validation.Constraint{{Target: "pushSettings.PushSettingsProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "pushSettings.PushSettingsProperties.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateSitePushSettings", err.Error()) + } + + req, err := client.UpdateSitePushSettingsPreparer(ctx, resourceGroupName, name, pushSettings) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettings", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSitePushSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettings", resp, "Failure sending request") + return + } + + result, err = client.UpdateSitePushSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettings", resp, "Failure responding to request") + return + } + + return +} + +// UpdateSitePushSettingsPreparer prepares the UpdateSitePushSettings request. +func (client AppsClient) UpdateSitePushSettingsPreparer(ctx context.Context, resourceGroupName string, name string, pushSettings PushSettings) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings", pathParameters), + autorest.WithJSON(pushSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSitePushSettingsSender sends the UpdateSitePushSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSitePushSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateSitePushSettingsResponder handles the response to the UpdateSitePushSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateSitePushSettingsResponder(resp *http.Response) (result PushSettings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSitePushSettingsSlot description for Updates the Push settings associated with web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// pushSettings - push settings associated with web app. +// slot - name of web app slot. If not specified then will default to production slot. +func (client AppsClient) UpdateSitePushSettingsSlot(ctx context.Context, resourceGroupName string, name string, pushSettings PushSettings, slot string) (result PushSettings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateSitePushSettingsSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: pushSettings, + Constraints: []validation.Constraint{{Target: "pushSettings.PushSettingsProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "pushSettings.PushSettingsProperties.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateSitePushSettingsSlot", err.Error()) + } + + req, err := client.UpdateSitePushSettingsSlotPreparer(ctx, resourceGroupName, name, pushSettings, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettingsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSitePushSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettingsSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateSitePushSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettingsSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateSitePushSettingsSlotPreparer prepares the UpdateSitePushSettingsSlot request. +func (client AppsClient) UpdateSitePushSettingsSlotPreparer(ctx context.Context, resourceGroupName string, name string, pushSettings PushSettings, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings", pathParameters), + autorest.WithJSON(pushSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSitePushSettingsSlotSender sends the UpdateSitePushSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSitePushSettingsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateSitePushSettingsSlotResponder handles the response to the UpdateSitePushSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateSitePushSettingsSlotResponder(resp *http.Response) (result PushSettings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSlot description for Creates a new web, mobile, or API app in an existing resource group, or updates an +// existing app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - unique name of the app to create or update. To create or update a deployment slot, use the {slot} +// parameter. +// siteEnvelope - a JSON representation of the app properties. See example. +// slot - name of the deployment slot to create or update. By default, this API attempts to create or modify +// the production slot. +func (client AppsClient) UpdateSlot(ctx context.Context, resourceGroupName string, name string, siteEnvelope SitePatchResource, slot string) (result Site, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateSlot", err.Error()) + } + + req, err := client.UpdateSlotPreparer(ctx, resourceGroupName, name, siteEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateSlotPreparer prepares the UpdateSlot request. +func (client AppsClient) UpdateSlotPreparer(ctx context.Context, resourceGroupName string, name string, siteEnvelope SitePatchResource, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}", pathParameters), + autorest.WithJSON(siteEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSlotSender sends the UpdateSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateSlotResponder handles the response to the UpdateSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateSlotResponder(resp *http.Response) (result Site, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSlotConfigurationNames description for Updates the names of application settings and connection string that +// remain with the slot during swap operation. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// slotConfigNames - names of application settings and connection strings. See example. +func (client AppsClient) UpdateSlotConfigurationNames(ctx context.Context, resourceGroupName string, name string, slotConfigNames SlotConfigNamesResource) (result SlotConfigNamesResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateSlotConfigurationNames") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateSlotConfigurationNames", err.Error()) + } + + req, err := client.UpdateSlotConfigurationNamesPreparer(ctx, resourceGroupName, name, slotConfigNames) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSlotConfigurationNames", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSlotConfigurationNamesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSlotConfigurationNames", resp, "Failure sending request") + return + } + + result, err = client.UpdateSlotConfigurationNamesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSlotConfigurationNames", resp, "Failure responding to request") + return + } + + return +} + +// UpdateSlotConfigurationNamesPreparer prepares the UpdateSlotConfigurationNames request. +func (client AppsClient) UpdateSlotConfigurationNamesPreparer(ctx context.Context, resourceGroupName string, name string, slotConfigNames SlotConfigNamesResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames", pathParameters), + autorest.WithJSON(slotConfigNames), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSlotConfigurationNamesSender sends the UpdateSlotConfigurationNames request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSlotConfigurationNamesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateSlotConfigurationNamesResponder handles the response to the UpdateSlotConfigurationNames request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateSlotConfigurationNamesResponder(resp *http.Response) (result SlotConfigNamesResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSourceControl description for Updates the source control configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// siteSourceControl - JSON representation of a SiteSourceControl object. See example. +func (client AppsClient) UpdateSourceControl(ctx context.Context, resourceGroupName string, name string, siteSourceControl SiteSourceControl) (result SiteSourceControl, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateSourceControl") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateSourceControl", err.Error()) + } + + req, err := client.UpdateSourceControlPreparer(ctx, resourceGroupName, name, siteSourceControl) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSourceControl", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSourceControlSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSourceControl", resp, "Failure sending request") + return + } + + result, err = client.UpdateSourceControlResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSourceControl", resp, "Failure responding to request") + return + } + + return +} + +// UpdateSourceControlPreparer prepares the UpdateSourceControl request. +func (client AppsClient) UpdateSourceControlPreparer(ctx context.Context, resourceGroupName string, name string, siteSourceControl SiteSourceControl) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web", pathParameters), + autorest.WithJSON(siteSourceControl), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSourceControlSender sends the UpdateSourceControl request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSourceControlSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateSourceControlResponder handles the response to the UpdateSourceControl request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateSourceControlResponder(resp *http.Response) (result SiteSourceControl, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSourceControlSlot description for Updates the source control configuration of an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// siteSourceControl - JSON representation of a SiteSourceControl object. See example. +// slot - name of the deployment slot. If a slot is not specified, the API will update the source control +// configuration for the production slot. +func (client AppsClient) UpdateSourceControlSlot(ctx context.Context, resourceGroupName string, name string, siteSourceControl SiteSourceControl, slot string) (result SiteSourceControl, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateSourceControlSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateSourceControlSlot", err.Error()) + } + + req, err := client.UpdateSourceControlSlotPreparer(ctx, resourceGroupName, name, siteSourceControl, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSourceControlSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSourceControlSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSourceControlSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateSourceControlSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSourceControlSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateSourceControlSlotPreparer prepares the UpdateSourceControlSlot request. +func (client AppsClient) UpdateSourceControlSlotPreparer(ctx context.Context, resourceGroupName string, name string, siteSourceControl SiteSourceControl, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), + autorest.WithJSON(siteSourceControl), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSourceControlSlotSender sends the UpdateSourceControlSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSourceControlSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateSourceControlSlotResponder handles the response to the UpdateSourceControlSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateSourceControlSlotResponder(resp *http.Response) (result SiteSourceControl, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSwiftVirtualNetworkConnectionWithCheck description for Integrates this Web App with a Virtual Network. This +// requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has +// already been delegated, and is not +// in use by another App Service Plan other than the one this App is in. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// connectionEnvelope - properties of the Virtual Network connection. See example. +func (client AppsClient) UpdateSwiftVirtualNetworkConnectionWithCheck(ctx context.Context, resourceGroupName string, name string, connectionEnvelope SwiftVirtualNetwork) (result SwiftVirtualNetwork, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateSwiftVirtualNetworkConnectionWithCheck") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateSwiftVirtualNetworkConnectionWithCheck", err.Error()) + } + + req, err := client.UpdateSwiftVirtualNetworkConnectionWithCheckPreparer(ctx, resourceGroupName, name, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSwiftVirtualNetworkConnectionWithCheck", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSwiftVirtualNetworkConnectionWithCheckSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSwiftVirtualNetworkConnectionWithCheck", resp, "Failure sending request") + return + } + + result, err = client.UpdateSwiftVirtualNetworkConnectionWithCheckResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSwiftVirtualNetworkConnectionWithCheck", resp, "Failure responding to request") + return + } + + return +} + +// UpdateSwiftVirtualNetworkConnectionWithCheckPreparer prepares the UpdateSwiftVirtualNetworkConnectionWithCheck request. +func (client AppsClient) UpdateSwiftVirtualNetworkConnectionWithCheckPreparer(ctx context.Context, resourceGroupName string, name string, connectionEnvelope SwiftVirtualNetwork) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSwiftVirtualNetworkConnectionWithCheckSender sends the UpdateSwiftVirtualNetworkConnectionWithCheck request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSwiftVirtualNetworkConnectionWithCheckSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateSwiftVirtualNetworkConnectionWithCheckResponder handles the response to the UpdateSwiftVirtualNetworkConnectionWithCheck request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateSwiftVirtualNetworkConnectionWithCheckResponder(resp *http.Response) (result SwiftVirtualNetwork, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSwiftVirtualNetworkConnectionWithCheckSlot description for Integrates this Web App with a Virtual Network. +// This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet +// has already been delegated, and is not +// in use by another App Service Plan other than the one this App is in. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// connectionEnvelope - properties of the Virtual Network connection. See example. +// slot - name of the deployment slot. If a slot is not specified, the API will add or update connections for +// the production slot. +func (client AppsClient) UpdateSwiftVirtualNetworkConnectionWithCheckSlot(ctx context.Context, resourceGroupName string, name string, connectionEnvelope SwiftVirtualNetwork, slot string) (result SwiftVirtualNetwork, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateSwiftVirtualNetworkConnectionWithCheckSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateSwiftVirtualNetworkConnectionWithCheckSlot", err.Error()) + } + + req, err := client.UpdateSwiftVirtualNetworkConnectionWithCheckSlotPreparer(ctx, resourceGroupName, name, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSwiftVirtualNetworkConnectionWithCheckSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSwiftVirtualNetworkConnectionWithCheckSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSwiftVirtualNetworkConnectionWithCheckSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateSwiftVirtualNetworkConnectionWithCheckSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSwiftVirtualNetworkConnectionWithCheckSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateSwiftVirtualNetworkConnectionWithCheckSlotPreparer prepares the UpdateSwiftVirtualNetworkConnectionWithCheckSlot request. +func (client AppsClient) UpdateSwiftVirtualNetworkConnectionWithCheckSlotPreparer(ctx context.Context, resourceGroupName string, name string, connectionEnvelope SwiftVirtualNetwork, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSwiftVirtualNetworkConnectionWithCheckSlotSender sends the UpdateSwiftVirtualNetworkConnectionWithCheckSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSwiftVirtualNetworkConnectionWithCheckSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateSwiftVirtualNetworkConnectionWithCheckSlotResponder handles the response to the UpdateSwiftVirtualNetworkConnectionWithCheckSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateSwiftVirtualNetworkConnectionWithCheckSlotResponder(resp *http.Response) (result SwiftVirtualNetwork, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetConnection description for Adds a Virtual Network connection to an app or slot (PUT) or updates the +// connection properties (PATCH). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// vnetName - name of an existing Virtual Network. +// connectionEnvelope - properties of the Virtual Network connection. See example. +func (client AppsClient) UpdateVnetConnection(ctx context.Context, resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfoResource) (result VnetInfoResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateVnetConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateVnetConnection", err.Error()) + } + + req, err := client.UpdateVnetConnectionPreparer(ctx, resourceGroupName, name, vnetName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnection", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateVnetConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnection", resp, "Failure sending request") + return + } + + result, err = client.UpdateVnetConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnection", resp, "Failure responding to request") + return + } + + return +} + +// UpdateVnetConnectionPreparer prepares the UpdateVnetConnection request. +func (client AppsClient) UpdateVnetConnectionPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfoResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateVnetConnectionSender sends the UpdateVnetConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateVnetConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateVnetConnectionResponder handles the response to the UpdateVnetConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateVnetConnectionResponder(resp *http.Response) (result VnetInfoResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetConnectionGateway description for Adds a gateway to a connected Virtual Network (PUT) or updates it +// (PATCH). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// vnetName - name of the Virtual Network. +// gatewayName - name of the gateway. Currently, the only supported string is "primary". +// connectionEnvelope - the properties to update this gateway with. +func (client AppsClient) UpdateVnetConnectionGateway(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateVnetConnectionGateway") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateVnetConnectionGateway", err.Error()) + } + + req, err := client.UpdateVnetConnectionGatewayPreparer(ctx, resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGateway", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateVnetConnectionGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGateway", resp, "Failure sending request") + return + } + + result, err = client.UpdateVnetConnectionGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGateway", resp, "Failure responding to request") + return + } + + return +} + +// UpdateVnetConnectionGatewayPreparer prepares the UpdateVnetConnectionGateway request. +func (client AppsClient) UpdateVnetConnectionGatewayPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateVnetConnectionGatewaySender sends the UpdateVnetConnectionGateway request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateVnetConnectionGatewaySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateVnetConnectionGatewayResponder handles the response to the UpdateVnetConnectionGateway request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateVnetConnectionGatewayResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetConnectionGatewaySlot description for Adds a gateway to a connected Virtual Network (PUT) or updates it +// (PATCH). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// vnetName - name of the Virtual Network. +// gatewayName - name of the gateway. Currently, the only supported string is "primary". +// connectionEnvelope - the properties to update this gateway with. +// slot - name of the deployment slot. If a slot is not specified, the API will add or update a gateway for the +// production slot's Virtual Network. +func (client AppsClient) UpdateVnetConnectionGatewaySlot(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (result VnetGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateVnetConnectionGatewaySlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateVnetConnectionGatewaySlot", err.Error()) + } + + req, err := client.UpdateVnetConnectionGatewaySlotPreparer(ctx, resourceGroupName, name, vnetName, gatewayName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGatewaySlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateVnetConnectionGatewaySlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGatewaySlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateVnetConnectionGatewaySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGatewaySlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateVnetConnectionGatewaySlotPreparer prepares the UpdateVnetConnectionGatewaySlot request. +func (client AppsClient) UpdateVnetConnectionGatewaySlotPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateVnetConnectionGatewaySlotSender sends the UpdateVnetConnectionGatewaySlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateVnetConnectionGatewaySlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateVnetConnectionGatewaySlotResponder handles the response to the UpdateVnetConnectionGatewaySlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateVnetConnectionGatewaySlotResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetConnectionSlot description for Adds a Virtual Network connection to an app or slot (PUT) or updates the +// connection properties (PATCH). +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the app. +// vnetName - name of an existing Virtual Network. +// connectionEnvelope - properties of the Virtual Network connection. See example. +// slot - name of the deployment slot. If a slot is not specified, the API will add or update connections for +// the production slot. +func (client AppsClient) UpdateVnetConnectionSlot(ctx context.Context, resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfoResource, slot string) (result VnetInfoResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.UpdateVnetConnectionSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "UpdateVnetConnectionSlot", err.Error()) + } + + req, err := client.UpdateVnetConnectionSlotPreparer(ctx, resourceGroupName, name, vnetName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateVnetConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateVnetConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionSlot", resp, "Failure responding to request") + return + } + + return +} + +// UpdateVnetConnectionSlotPreparer prepares the UpdateVnetConnectionSlot request. +func (client AppsClient) UpdateVnetConnectionSlotPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfoResource, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateVnetConnectionSlotSender sends the UpdateVnetConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateVnetConnectionSlotResponder handles the response to the UpdateVnetConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateVnetConnectionSlotResponder(resp *http.Response) (result VnetInfoResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/appservicecertificateorders.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/appservicecertificateorders.go new file mode 100644 index 000000000000..3b852f77db6c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/appservicecertificateorders.go @@ -0,0 +1,1851 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AppServiceCertificateOrdersClient is the webSite Management Client +type AppServiceCertificateOrdersClient struct { + BaseClient +} + +// NewAppServiceCertificateOrdersClient creates an instance of the AppServiceCertificateOrdersClient client. +func NewAppServiceCertificateOrdersClient(subscriptionID string) AppServiceCertificateOrdersClient { + return NewAppServiceCertificateOrdersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppServiceCertificateOrdersClientWithBaseURI creates an instance of the AppServiceCertificateOrdersClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewAppServiceCertificateOrdersClientWithBaseURI(baseURI string, subscriptionID string) AppServiceCertificateOrdersClient { + return AppServiceCertificateOrdersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate description for Create or update a certificate purchase order. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - name of the certificate order. +// certificateDistinguishedName - distinguished name to use for the certificate order. +func (client AppServiceCertificateOrdersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, certificateOrderName string, certificateDistinguishedName AppServiceCertificateOrder) (result AppServiceCertificateOrdersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, certificateOrderName, certificateDistinguishedName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppServiceCertificateOrdersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, certificateOrderName string, certificateDistinguishedName AppServiceCertificateOrder) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}", pathParameters), + autorest.WithJSON(certificateDistinguishedName), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateSender(req *http.Request) (future AppServiceCertificateOrdersCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateResponder(resp *http.Response) (result AppServiceCertificateOrder, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateCertificate description for Creates or updates a certificate and associates with key vault secret. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - name of the certificate order. +// name - name of the certificate. +// keyVaultCertificate - key vault certificate resource Id. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificate(ctx context.Context, resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate AppServiceCertificateResource) (result AppServiceCertificateOrdersCreateOrUpdateCertificateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.CreateOrUpdateCertificate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "CreateOrUpdateCertificate", err.Error()) + } + + req, err := client.CreateOrUpdateCertificatePreparer(ctx, resourceGroupName, certificateOrderName, name, keyVaultCertificate) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdateCertificate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateCertificateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdateCertificate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdateCertificatePreparer prepares the CreateOrUpdateCertificate request. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificatePreparer(ctx context.Context, resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate AppServiceCertificateResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), + autorest.WithJSON(keyVaultCertificate), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateCertificateSender sends the CreateOrUpdateCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificateSender(req *http.Request) (future AppServiceCertificateOrdersCreateOrUpdateCertificateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateCertificateResponder handles the response to the CreateOrUpdateCertificate request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificateResponder(resp *http.Response) (result AppServiceCertificateResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete description for Delete an existing certificate order. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - name of the certificate order. +func (client AppServiceCertificateOrdersClient) Delete(ctx context.Context, resourceGroupName string, certificateOrderName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, certificateOrderName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppServiceCertificateOrdersClient) DeletePreparer(ctx context.Context, resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteCertificate description for Delete the certificate associated with a certificate order. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - name of the certificate order. +// name - name of the certificate. +func (client AppServiceCertificateOrdersClient) DeleteCertificate(ctx context.Context, resourceGroupName string, certificateOrderName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.DeleteCertificate") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "DeleteCertificate", err.Error()) + } + + req, err := client.DeleteCertificatePreparer(ctx, resourceGroupName, certificateOrderName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "DeleteCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteCertificateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "DeleteCertificate", resp, "Failure sending request") + return + } + + result, err = client.DeleteCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "DeleteCertificate", resp, "Failure responding to request") + return + } + + return +} + +// DeleteCertificatePreparer prepares the DeleteCertificate request. +func (client AppServiceCertificateOrdersClient) DeleteCertificatePreparer(ctx context.Context, resourceGroupName string, certificateOrderName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteCertificateSender sends the DeleteCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) DeleteCertificateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteCertificateResponder handles the response to the DeleteCertificate request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) DeleteCertificateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get description for Get a certificate order. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - name of the certificate order.. +func (client AppServiceCertificateOrdersClient) Get(ctx context.Context, resourceGroupName string, certificateOrderName string) (result AppServiceCertificateOrder, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, certificateOrderName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppServiceCertificateOrdersClient) GetPreparer(ctx context.Context, resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) GetResponder(resp *http.Response) (result AppServiceCertificateOrder, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificate description for Get the certificate associated with a certificate order. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - name of the certificate order. +// name - name of the certificate. +func (client AppServiceCertificateOrdersClient) GetCertificate(ctx context.Context, resourceGroupName string, certificateOrderName string, name string) (result AppServiceCertificateResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.GetCertificate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "GetCertificate", err.Error()) + } + + req, err := client.GetCertificatePreparer(ctx, resourceGroupName, certificateOrderName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "GetCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "GetCertificate", resp, "Failure sending request") + return + } + + result, err = client.GetCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "GetCertificate", resp, "Failure responding to request") + return + } + + return +} + +// GetCertificatePreparer prepares the GetCertificate request. +func (client AppServiceCertificateOrdersClient) GetCertificatePreparer(ctx context.Context, resourceGroupName string, certificateOrderName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCertificateSender sends the GetCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) GetCertificateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetCertificateResponder handles the response to the GetCertificate request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) GetCertificateResponder(resp *http.Response) (result AppServiceCertificateResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List description for List all certificate orders in a subscription. +func (client AppServiceCertificateOrdersClient) List(ctx context.Context) (result AppServiceCertificateOrderCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.List") + defer func() { + sc := -1 + if result.ascoc.Response.Response != nil { + sc = result.ascoc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ascoc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", resp, "Failure sending request") + return + } + + result.ascoc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", resp, "Failure responding to request") + return + } + if result.ascoc.hasNextLink() && result.ascoc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AppServiceCertificateOrdersClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ListResponder(resp *http.Response) (result AppServiceCertificateOrderCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AppServiceCertificateOrdersClient) listNextResults(ctx context.Context, lastResults AppServiceCertificateOrderCollection) (result AppServiceCertificateOrderCollection, err error) { + req, err := lastResults.appServiceCertificateOrderCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceCertificateOrdersClient) ListComplete(ctx context.Context) (result AppServiceCertificateOrderCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup description for Get certificate orders in a resource group. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +func (client AppServiceCertificateOrdersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AppServiceCertificateOrderCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.ascoc.Response.Response != nil { + sc = result.ascoc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.ascoc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.ascoc, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.ascoc.hasNextLink() && result.ascoc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AppServiceCertificateOrdersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ListByResourceGroupResponder(resp *http.Response) (result AppServiceCertificateOrderCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client AppServiceCertificateOrdersClient) listByResourceGroupNextResults(ctx context.Context, lastResults AppServiceCertificateOrderCollection) (result AppServiceCertificateOrderCollection, err error) { + req, err := lastResults.appServiceCertificateOrderCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceCertificateOrdersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AppServiceCertificateOrderCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListCertificates description for List all certificates associated with a certificate order. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - name of the certificate order. +func (client AppServiceCertificateOrdersClient) ListCertificates(ctx context.Context, resourceGroupName string, certificateOrderName string) (result AppServiceCertificateCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.ListCertificates") + defer func() { + sc := -1 + if result.ascc.Response.Response != nil { + sc = result.ascc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "ListCertificates", err.Error()) + } + + result.fn = client.listCertificatesNextResults + req, err := client.ListCertificatesPreparer(ctx, resourceGroupName, certificateOrderName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", nil, "Failure preparing request") + return + } + + resp, err := client.ListCertificatesSender(req) + if err != nil { + result.ascc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", resp, "Failure sending request") + return + } + + result.ascc, err = client.ListCertificatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", resp, "Failure responding to request") + return + } + if result.ascc.hasNextLink() && result.ascc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListCertificatesPreparer prepares the ListCertificates request. +func (client AppServiceCertificateOrdersClient) ListCertificatesPreparer(ctx context.Context, resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCertificatesSender sends the ListCertificates request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ListCertificatesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListCertificatesResponder handles the response to the ListCertificates request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ListCertificatesResponder(resp *http.Response) (result AppServiceCertificateCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listCertificatesNextResults retrieves the next set of results, if any. +func (client AppServiceCertificateOrdersClient) listCertificatesNextResults(ctx context.Context, lastResults AppServiceCertificateCollection) (result AppServiceCertificateCollection, err error) { + req, err := lastResults.appServiceCertificateCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "listCertificatesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListCertificatesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "listCertificatesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListCertificatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "listCertificatesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListCertificatesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceCertificateOrdersClient) ListCertificatesComplete(ctx context.Context, resourceGroupName string, certificateOrderName string) (result AppServiceCertificateCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.ListCertificates") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListCertificates(ctx, resourceGroupName, certificateOrderName) + return +} + +// Reissue description for Reissue an existing certificate order. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - name of the certificate order. +// reissueCertificateOrderRequest - parameters for the reissue. +func (client AppServiceCertificateOrdersClient) Reissue(ctx context.Context, resourceGroupName string, certificateOrderName string, reissueCertificateOrderRequest ReissueCertificateOrderRequest) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.Reissue") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "Reissue", err.Error()) + } + + req, err := client.ReissuePreparer(ctx, resourceGroupName, certificateOrderName, reissueCertificateOrderRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Reissue", nil, "Failure preparing request") + return + } + + resp, err := client.ReissueSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Reissue", resp, "Failure sending request") + return + } + + result, err = client.ReissueResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Reissue", resp, "Failure responding to request") + return + } + + return +} + +// ReissuePreparer prepares the Reissue request. +func (client AppServiceCertificateOrdersClient) ReissuePreparer(ctx context.Context, resourceGroupName string, certificateOrderName string, reissueCertificateOrderRequest ReissueCertificateOrderRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/reissue", pathParameters), + autorest.WithJSON(reissueCertificateOrderRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReissueSender sends the Reissue request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ReissueSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ReissueResponder handles the response to the Reissue request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ReissueResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Renew description for Renew an existing certificate order. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - name of the certificate order. +// renewCertificateOrderRequest - renew parameters +func (client AppServiceCertificateOrdersClient) Renew(ctx context.Context, resourceGroupName string, certificateOrderName string, renewCertificateOrderRequest RenewCertificateOrderRequest) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.Renew") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "Renew", err.Error()) + } + + req, err := client.RenewPreparer(ctx, resourceGroupName, certificateOrderName, renewCertificateOrderRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Renew", nil, "Failure preparing request") + return + } + + resp, err := client.RenewSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Renew", resp, "Failure sending request") + return + } + + result, err = client.RenewResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Renew", resp, "Failure responding to request") + return + } + + return +} + +// RenewPreparer prepares the Renew request. +func (client AppServiceCertificateOrdersClient) RenewPreparer(ctx context.Context, resourceGroupName string, certificateOrderName string, renewCertificateOrderRequest RenewCertificateOrderRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/renew", pathParameters), + autorest.WithJSON(renewCertificateOrderRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RenewSender sends the Renew request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) RenewSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RenewResponder handles the response to the Renew request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) RenewResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResendEmail description for Resend certificate email. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - name of the certificate order. +func (client AppServiceCertificateOrdersClient) ResendEmail(ctx context.Context, resourceGroupName string, certificateOrderName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.ResendEmail") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "ResendEmail", err.Error()) + } + + req, err := client.ResendEmailPreparer(ctx, resourceGroupName, certificateOrderName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendEmail", nil, "Failure preparing request") + return + } + + resp, err := client.ResendEmailSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendEmail", resp, "Failure sending request") + return + } + + result, err = client.ResendEmailResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendEmail", resp, "Failure responding to request") + return + } + + return +} + +// ResendEmailPreparer prepares the ResendEmail request. +func (client AppServiceCertificateOrdersClient) ResendEmailPreparer(ctx context.Context, resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendEmail", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResendEmailSender sends the ResendEmail request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ResendEmailSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ResendEmailResponder handles the response to the ResendEmail request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ResendEmailResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResendRequestEmails resend domain verification ownership email containing steps on how to verify a domain for a +// given certificate order +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - name of the certificate order. +// nameIdentifier - email address +func (client AppServiceCertificateOrdersClient) ResendRequestEmails(ctx context.Context, resourceGroupName string, certificateOrderName string, nameIdentifier NameIdentifier) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.ResendRequestEmails") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "ResendRequestEmails", err.Error()) + } + + req, err := client.ResendRequestEmailsPreparer(ctx, resourceGroupName, certificateOrderName, nameIdentifier) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendRequestEmails", nil, "Failure preparing request") + return + } + + resp, err := client.ResendRequestEmailsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendRequestEmails", resp, "Failure sending request") + return + } + + result, err = client.ResendRequestEmailsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendRequestEmails", resp, "Failure responding to request") + return + } + + return +} + +// ResendRequestEmailsPreparer prepares the ResendRequestEmails request. +func (client AppServiceCertificateOrdersClient) ResendRequestEmailsPreparer(ctx context.Context, resourceGroupName string, certificateOrderName string, nameIdentifier NameIdentifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendRequestEmails", pathParameters), + autorest.WithJSON(nameIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResendRequestEmailsSender sends the ResendRequestEmails request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ResendRequestEmailsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ResendRequestEmailsResponder handles the response to the ResendRequestEmails request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ResendRequestEmailsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RetrieveCertificateActions description for Retrieve the list of certificate actions. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the certificate order. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateActions(ctx context.Context, resourceGroupName string, name string) (result ListCertificateOrderAction, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.RetrieveCertificateActions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions", err.Error()) + } + + req, err := client.RetrieveCertificateActionsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions", nil, "Failure preparing request") + return + } + + resp, err := client.RetrieveCertificateActionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions", resp, "Failure sending request") + return + } + + result, err = client.RetrieveCertificateActionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions", resp, "Failure responding to request") + return + } + + return +} + +// RetrieveCertificateActionsPreparer prepares the RetrieveCertificateActions request. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateActionsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveCertificateActions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RetrieveCertificateActionsSender sends the RetrieveCertificateActions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateActionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RetrieveCertificateActionsResponder handles the response to the RetrieveCertificateActions request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateActionsResponder(resp *http.Response) (result ListCertificateOrderAction, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RetrieveCertificateEmailHistory description for Retrieve email history. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the certificate order. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistory(ctx context.Context, resourceGroupName string, name string) (result ListCertificateEmail, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.RetrieveCertificateEmailHistory") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory", err.Error()) + } + + req, err := client.RetrieveCertificateEmailHistoryPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory", nil, "Failure preparing request") + return + } + + resp, err := client.RetrieveCertificateEmailHistorySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory", resp, "Failure sending request") + return + } + + result, err = client.RetrieveCertificateEmailHistoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory", resp, "Failure responding to request") + return + } + + return +} + +// RetrieveCertificateEmailHistoryPreparer prepares the RetrieveCertificateEmailHistory request. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistoryPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveEmailHistory", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RetrieveCertificateEmailHistorySender sends the RetrieveCertificateEmailHistory request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistorySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RetrieveCertificateEmailHistoryResponder handles the response to the RetrieveCertificateEmailHistory request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistoryResponder(resp *http.Response) (result ListCertificateEmail, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RetrieveSiteSeal this method is used to obtain the site seal information for an issued certificate. A site seal is a +// graphic that the certificate purchaser can embed on their web site to show their visitors information about their +// SSL certificate. If a web site visitor clicks on the site seal image, a pop-up page is displayed that contains +// detailed information about the SSL certificate. The site seal token is used to link the site seal graphic image to +// the appropriate certificate details pop-up page display when a user clicks on the site seal. The site seal images +// are expected to be static images and hosted by the reseller, to minimize delays for customer page load times. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - name of the certificate order. +// siteSealRequest - site seal request. +func (client AppServiceCertificateOrdersClient) RetrieveSiteSeal(ctx context.Context, resourceGroupName string, certificateOrderName string, siteSealRequest SiteSealRequest) (result SiteSeal, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.RetrieveSiteSeal") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal", err.Error()) + } + + req, err := client.RetrieveSiteSealPreparer(ctx, resourceGroupName, certificateOrderName, siteSealRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal", nil, "Failure preparing request") + return + } + + resp, err := client.RetrieveSiteSealSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal", resp, "Failure sending request") + return + } + + result, err = client.RetrieveSiteSealResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal", resp, "Failure responding to request") + return + } + + return +} + +// RetrieveSiteSealPreparer prepares the RetrieveSiteSeal request. +func (client AppServiceCertificateOrdersClient) RetrieveSiteSealPreparer(ctx context.Context, resourceGroupName string, certificateOrderName string, siteSealRequest SiteSealRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/retrieveSiteSeal", pathParameters), + autorest.WithJSON(siteSealRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RetrieveSiteSealSender sends the RetrieveSiteSeal request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) RetrieveSiteSealSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RetrieveSiteSealResponder handles the response to the RetrieveSiteSeal request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) RetrieveSiteSealResponder(resp *http.Response) (result SiteSeal, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update description for Create or update a certificate purchase order. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - name of the certificate order. +// certificateDistinguishedName - distinguished name to use for the certificate order. +func (client AppServiceCertificateOrdersClient) Update(ctx context.Context, resourceGroupName string, certificateOrderName string, certificateDistinguishedName AppServiceCertificateOrderPatchResource) (result AppServiceCertificateOrder, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, certificateOrderName, certificateDistinguishedName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AppServiceCertificateOrdersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, certificateOrderName string, certificateDistinguishedName AppServiceCertificateOrderPatchResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}", pathParameters), + autorest.WithJSON(certificateDistinguishedName), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) UpdateResponder(resp *http.Response) (result AppServiceCertificateOrder, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateCertificate description for Creates or updates a certificate and associates with key vault secret. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - name of the certificate order. +// name - name of the certificate. +// keyVaultCertificate - key vault certificate resource Id. +func (client AppServiceCertificateOrdersClient) UpdateCertificate(ctx context.Context, resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate AppServiceCertificatePatchResource) (result AppServiceCertificateResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.UpdateCertificate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "UpdateCertificate", err.Error()) + } + + req, err := client.UpdateCertificatePreparer(ctx, resourceGroupName, certificateOrderName, name, keyVaultCertificate) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "UpdateCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "UpdateCertificate", resp, "Failure sending request") + return + } + + result, err = client.UpdateCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "UpdateCertificate", resp, "Failure responding to request") + return + } + + return +} + +// UpdateCertificatePreparer prepares the UpdateCertificate request. +func (client AppServiceCertificateOrdersClient) UpdateCertificatePreparer(ctx context.Context, resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate AppServiceCertificatePatchResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), + autorest.WithJSON(keyVaultCertificate), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateCertificateSender sends the UpdateCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) UpdateCertificateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateCertificateResponder handles the response to the UpdateCertificate request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) UpdateCertificateResponder(resp *http.Response) (result AppServiceCertificateResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidatePurchaseInformation description for Validate information for a certificate order. +// Parameters: +// appServiceCertificateOrder - information for a certificate order. +func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformation(ctx context.Context, appServiceCertificateOrder AppServiceCertificateOrder) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.ValidatePurchaseInformation") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ValidatePurchaseInformationPreparer(ctx, appServiceCertificateOrder) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ValidatePurchaseInformation", nil, "Failure preparing request") + return + } + + resp, err := client.ValidatePurchaseInformationSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ValidatePurchaseInformation", resp, "Failure sending request") + return + } + + result, err = client.ValidatePurchaseInformationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ValidatePurchaseInformation", resp, "Failure responding to request") + return + } + + return +} + +// ValidatePurchaseInformationPreparer prepares the ValidatePurchaseInformation request. +func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformationPreparer(ctx context.Context, appServiceCertificateOrder AppServiceCertificateOrder) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation", pathParameters), + autorest.WithJSON(appServiceCertificateOrder), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidatePurchaseInformationSender sends the ValidatePurchaseInformation request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidatePurchaseInformationResponder handles the response to the ValidatePurchaseInformation request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// VerifyDomainOwnership description for Verify domain ownership for this certificate order. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - name of the certificate order. +func (client AppServiceCertificateOrdersClient) VerifyDomainOwnership(ctx context.Context, resourceGroupName string, certificateOrderName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrdersClient.VerifyDomainOwnership") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership", err.Error()) + } + + req, err := client.VerifyDomainOwnershipPreparer(ctx, resourceGroupName, certificateOrderName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership", nil, "Failure preparing request") + return + } + + resp, err := client.VerifyDomainOwnershipSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership", resp, "Failure sending request") + return + } + + result, err = client.VerifyDomainOwnershipResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership", resp, "Failure responding to request") + return + } + + return +} + +// VerifyDomainOwnershipPreparer prepares the VerifyDomainOwnership request. +func (client AppServiceCertificateOrdersClient) VerifyDomainOwnershipPreparer(ctx context.Context, resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/verifyDomainOwnership", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// VerifyDomainOwnershipSender sends the VerifyDomainOwnership request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) VerifyDomainOwnershipSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// VerifyDomainOwnershipResponder handles the response to the VerifyDomainOwnership request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) VerifyDomainOwnershipResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/appserviceenvironments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/appserviceenvironments.go new file mode 100644 index 000000000000..1c51249c605d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/appserviceenvironments.go @@ -0,0 +1,4656 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AppServiceEnvironmentsClient is the webSite Management Client +type AppServiceEnvironmentsClient struct { + BaseClient +} + +// NewAppServiceEnvironmentsClient creates an instance of the AppServiceEnvironmentsClient client. +func NewAppServiceEnvironmentsClient(subscriptionID string) AppServiceEnvironmentsClient { + return NewAppServiceEnvironmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppServiceEnvironmentsClientWithBaseURI creates an instance of the AppServiceEnvironmentsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewAppServiceEnvironmentsClientWithBaseURI(baseURI string, subscriptionID string) AppServiceEnvironmentsClient { + return AppServiceEnvironmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ApproveOrRejectPrivateEndpointConnection description for Approves or rejects a private endpoint connection +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ApproveOrRejectPrivateEndpointConnection(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, privateEndpointWrapper PrivateLinkConnectionApprovalRequestResource) (result AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ApproveOrRejectPrivateEndpointConnection") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ApproveOrRejectPrivateEndpointConnection", err.Error()) + } + + req, err := client.ApproveOrRejectPrivateEndpointConnectionPreparer(ctx, resourceGroupName, name, privateEndpointConnectionName, privateEndpointWrapper) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ApproveOrRejectPrivateEndpointConnection", nil, "Failure preparing request") + return + } + + result, err = client.ApproveOrRejectPrivateEndpointConnectionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ApproveOrRejectPrivateEndpointConnection", result.Response(), "Failure sending request") + return + } + + return +} + +// ApproveOrRejectPrivateEndpointConnectionPreparer prepares the ApproveOrRejectPrivateEndpointConnection request. +func (client AppServiceEnvironmentsClient) ApproveOrRejectPrivateEndpointConnectionPreparer(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, privateEndpointWrapper PrivateLinkConnectionApprovalRequestResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(privateEndpointWrapper), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ApproveOrRejectPrivateEndpointConnectionSender sends the ApproveOrRejectPrivateEndpointConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ApproveOrRejectPrivateEndpointConnectionSender(req *http.Request) (future AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ApproveOrRejectPrivateEndpointConnectionResponder handles the response to the ApproveOrRejectPrivateEndpointConnection request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ApproveOrRejectPrivateEndpointConnectionResponder(resp *http.Response) (result RemotePrivateEndpointConnectionARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ChangeVnet description for Move an App Service Environment to a different VNET. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// vnetInfo - details for the new virtual network. +func (client AppServiceEnvironmentsClient) ChangeVnet(ctx context.Context, resourceGroupName string, name string, vnetInfo VirtualNetworkProfile) (result AppServiceEnvironmentsChangeVnetFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ChangeVnet") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: vnetInfo, + Constraints: []validation.Constraint{{Target: "vnetInfo.ID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ChangeVnet", err.Error()) + } + + req, err := client.ChangeVnetPreparer(ctx, resourceGroupName, name, vnetInfo) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ChangeVnet", nil, "Failure preparing request") + return + } + + result, err = client.ChangeVnetSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ChangeVnet", result.Response(), "Failure sending request") + return + } + + return +} + +// ChangeVnetPreparer prepares the ChangeVnet request. +func (client AppServiceEnvironmentsClient) ChangeVnetPreparer(ctx context.Context, resourceGroupName string, name string, vnetInfo VirtualNetworkProfile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + vnetInfo.Name = nil + vnetInfo.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/changeVirtualNetwork", pathParameters), + autorest.WithJSON(vnetInfo), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ChangeVnetSender sends the ChangeVnet request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ChangeVnetSender(req *http.Request) (future AppServiceEnvironmentsChangeVnetFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ChangeVnetResponder handles the response to the ChangeVnet request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ChangeVnetResponder(resp *http.Response) (result AppCollectionPage, err error) { + result.ac, err = client.changeVnetResponder(resp) + result.fn = client.changeVnetNextResults + return +} + +func (client AppServiceEnvironmentsClient) changeVnetResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// changeVnetNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) changeVnetNextResults(ctx context.Context, lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.appCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "changeVnetNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + var resp *http.Response + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "changeVnetNextResults", resp, "Failure sending next results request") + } + return client.changeVnetResponder(resp) +} + +// ChangeVnetComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ChangeVnetComplete(ctx context.Context, resourceGroupName string, name string, vnetInfo VirtualNetworkProfile) (result AppServiceEnvironmentsChangeVnetAllFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ChangeVnet") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + var future AppServiceEnvironmentsChangeVnetFuture + future, err = client.ChangeVnet(ctx, resourceGroupName, name, vnetInfo) + result.FutureAPI = future.FutureAPI + return +} + +// CreateOrUpdate description for Create or update an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// hostingEnvironmentEnvelope - configuration details of the App Service Environment. +func (client AppServiceEnvironmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, hostingEnvironmentEnvelope AppServiceEnvironmentResource) (result AppServiceEnvironmentsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: hostingEnvironmentEnvelope, + Constraints: []validation.Constraint{{Target: "hostingEnvironmentEnvelope.AppServiceEnvironment", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "hostingEnvironmentEnvelope.AppServiceEnvironment.VirtualNetwork", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "hostingEnvironmentEnvelope.AppServiceEnvironment.VirtualNetwork.ID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, hostingEnvironmentEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppServiceEnvironmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, hostingEnvironmentEnvelope AppServiceEnvironmentResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}", pathParameters), + autorest.WithJSON(hostingEnvironmentEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) CreateOrUpdateSender(req *http.Request) (future AppServiceEnvironmentsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) CreateOrUpdateResponder(resp *http.Response) (result AppServiceEnvironmentResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateMultiRolePool description for Create or update a multi-role pool. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// multiRolePoolEnvelope - properties of the multi-role pool. +func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePool(ctx context.Context, resourceGroupName string, name string, multiRolePoolEnvelope WorkerPoolResource) (result AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.CreateOrUpdateMultiRolePool") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "CreateOrUpdateMultiRolePool", err.Error()) + } + + req, err := client.CreateOrUpdateMultiRolePoolPreparer(ctx, resourceGroupName, name, multiRolePoolEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateMultiRolePool", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateMultiRolePoolSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateMultiRolePool", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdateMultiRolePoolPreparer prepares the CreateOrUpdateMultiRolePool request. +func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePoolPreparer(ctx context.Context, resourceGroupName string, name string, multiRolePoolEnvelope WorkerPoolResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default", pathParameters), + autorest.WithJSON(multiRolePoolEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateMultiRolePoolSender sends the CreateOrUpdateMultiRolePool request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePoolSender(req *http.Request) (future AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateMultiRolePoolResponder handles the response to the CreateOrUpdateMultiRolePool request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateWorkerPool description for Create or update a worker pool. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// workerPoolName - name of the worker pool. +// workerPoolEnvelope - properties of the worker pool. +func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPool(ctx context.Context, resourceGroupName string, name string, workerPoolName string, workerPoolEnvelope WorkerPoolResource) (result AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.CreateOrUpdateWorkerPool") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "CreateOrUpdateWorkerPool", err.Error()) + } + + req, err := client.CreateOrUpdateWorkerPoolPreparer(ctx, resourceGroupName, name, workerPoolName, workerPoolEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateWorkerPool", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateWorkerPoolSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateWorkerPool", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdateWorkerPoolPreparer prepares the CreateOrUpdateWorkerPool request. +func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPoolPreparer(ctx context.Context, resourceGroupName string, name string, workerPoolName string, workerPoolEnvelope WorkerPoolResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}", pathParameters), + autorest.WithJSON(workerPoolEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateWorkerPoolSender sends the CreateOrUpdateWorkerPool request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPoolSender(req *http.Request) (future AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateWorkerPoolResponder handles the response to the CreateOrUpdateWorkerPool request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete description for Delete an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// forceDelete - specify true to force the deletion even if the App Service Environment contains +// resources. The default is false. +func (client AppServiceEnvironmentsClient) Delete(ctx context.Context, resourceGroupName string, name string, forceDelete *bool) (result AppServiceEnvironmentsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, name, forceDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppServiceEnvironmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string, forceDelete *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) DeleteSender(req *http.Request) (future AppServiceEnvironmentsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeletePrivateEndpointConnection description for Deletes a private endpoint connection +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) DeletePrivateEndpointConnection(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (result AppServiceEnvironmentsDeletePrivateEndpointConnectionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.DeletePrivateEndpointConnection") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "DeletePrivateEndpointConnection", err.Error()) + } + + req, err := client.DeletePrivateEndpointConnectionPreparer(ctx, resourceGroupName, name, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "DeletePrivateEndpointConnection", nil, "Failure preparing request") + return + } + + result, err = client.DeletePrivateEndpointConnectionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "DeletePrivateEndpointConnection", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePrivateEndpointConnectionPreparer prepares the DeletePrivateEndpointConnection request. +func (client AppServiceEnvironmentsClient) DeletePrivateEndpointConnectionPreparer(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePrivateEndpointConnectionSender sends the DeletePrivateEndpointConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) DeletePrivateEndpointConnectionSender(req *http.Request) (future AppServiceEnvironmentsDeletePrivateEndpointConnectionFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeletePrivateEndpointConnectionResponder handles the response to the DeletePrivateEndpointConnection request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) DeletePrivateEndpointConnectionResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get description for Get the properties of an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) Get(ctx context.Context, resourceGroupName string, name string) (result AppServiceEnvironmentResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppServiceEnvironmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetResponder(resp *http.Response) (result AppServiceEnvironmentResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAseV3NetworkingConfiguration description for Get networking configuration of an App Service Environment +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) GetAseV3NetworkingConfiguration(ctx context.Context, resourceGroupName string, name string) (result AseV3NetworkingConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.GetAseV3NetworkingConfiguration") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "GetAseV3NetworkingConfiguration", err.Error()) + } + + req, err := client.GetAseV3NetworkingConfigurationPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetAseV3NetworkingConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.GetAseV3NetworkingConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetAseV3NetworkingConfiguration", resp, "Failure sending request") + return + } + + result, err = client.GetAseV3NetworkingConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetAseV3NetworkingConfiguration", resp, "Failure responding to request") + return + } + + return +} + +// GetAseV3NetworkingConfigurationPreparer prepares the GetAseV3NetworkingConfiguration request. +func (client AppServiceEnvironmentsClient) GetAseV3NetworkingConfigurationPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/configurations/networking", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAseV3NetworkingConfigurationSender sends the GetAseV3NetworkingConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetAseV3NetworkingConfigurationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAseV3NetworkingConfigurationResponder handles the response to the GetAseV3NetworkingConfiguration request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetAseV3NetworkingConfigurationResponder(resp *http.Response) (result AseV3NetworkingConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDiagnosticsItem description for Get a diagnostics item for an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// diagnosticsName - name of the diagnostics item. +func (client AppServiceEnvironmentsClient) GetDiagnosticsItem(ctx context.Context, resourceGroupName string, name string, diagnosticsName string) (result HostingEnvironmentDiagnostics, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.GetDiagnosticsItem") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "GetDiagnosticsItem", err.Error()) + } + + req, err := client.GetDiagnosticsItemPreparer(ctx, resourceGroupName, name, diagnosticsName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetDiagnosticsItem", nil, "Failure preparing request") + return + } + + resp, err := client.GetDiagnosticsItemSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetDiagnosticsItem", resp, "Failure sending request") + return + } + + result, err = client.GetDiagnosticsItemResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetDiagnosticsItem", resp, "Failure responding to request") + return + } + + return +} + +// GetDiagnosticsItemPreparer prepares the GetDiagnosticsItem request. +func (client AppServiceEnvironmentsClient) GetDiagnosticsItemPreparer(ctx context.Context, resourceGroupName string, name string, diagnosticsName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diagnosticsName": autorest.Encode("path", diagnosticsName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDiagnosticsItemSender sends the GetDiagnosticsItem request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetDiagnosticsItemSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDiagnosticsItemResponder handles the response to the GetDiagnosticsItem request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetDiagnosticsItemResponder(resp *http.Response) (result HostingEnvironmentDiagnostics, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInboundNetworkDependenciesEndpoints description for Get the network endpoints of all inbound dependencies of an +// App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) GetInboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, name string) (result InboundEnvironmentEndpointCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.GetInboundNetworkDependenciesEndpoints") + defer func() { + sc := -1 + if result.ieec.Response.Response != nil { + sc = result.ieec.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "GetInboundNetworkDependenciesEndpoints", err.Error()) + } + + result.fn = client.getInboundNetworkDependenciesEndpointsNextResults + req, err := client.GetInboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetInboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + resp, err := client.GetInboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.ieec.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetInboundNetworkDependenciesEndpoints", resp, "Failure sending request") + return + } + + result.ieec, err = client.GetInboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetInboundNetworkDependenciesEndpoints", resp, "Failure responding to request") + return + } + if result.ieec.hasNextLink() && result.ieec.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetInboundNetworkDependenciesEndpointsPreparer prepares the GetInboundNetworkDependenciesEndpoints request. +func (client AppServiceEnvironmentsClient) GetInboundNetworkDependenciesEndpointsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/inboundNetworkDependenciesEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInboundNetworkDependenciesEndpointsSender sends the GetInboundNetworkDependenciesEndpoints request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetInboundNetworkDependenciesEndpointsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetInboundNetworkDependenciesEndpointsResponder handles the response to the GetInboundNetworkDependenciesEndpoints request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetInboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result InboundEnvironmentEndpointCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getInboundNetworkDependenciesEndpointsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) getInboundNetworkDependenciesEndpointsNextResults(ctx context.Context, lastResults InboundEnvironmentEndpointCollection) (result InboundEnvironmentEndpointCollection, err error) { + req, err := lastResults.inboundEnvironmentEndpointCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "getInboundNetworkDependenciesEndpointsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetInboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "getInboundNetworkDependenciesEndpointsNextResults", resp, "Failure sending next results request") + } + result, err = client.GetInboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "getInboundNetworkDependenciesEndpointsNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetInboundNetworkDependenciesEndpointsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) GetInboundNetworkDependenciesEndpointsComplete(ctx context.Context, resourceGroupName string, name string) (result InboundEnvironmentEndpointCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.GetInboundNetworkDependenciesEndpoints") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetInboundNetworkDependenciesEndpoints(ctx, resourceGroupName, name) + return +} + +// GetMultiRolePool description for Get properties of a multi-role pool. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) GetMultiRolePool(ctx context.Context, resourceGroupName string, name string) (result WorkerPoolResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.GetMultiRolePool") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "GetMultiRolePool", err.Error()) + } + + req, err := client.GetMultiRolePoolPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetMultiRolePool", nil, "Failure preparing request") + return + } + + resp, err := client.GetMultiRolePoolSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetMultiRolePool", resp, "Failure sending request") + return + } + + result, err = client.GetMultiRolePoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetMultiRolePool", resp, "Failure responding to request") + return + } + + return +} + +// GetMultiRolePoolPreparer prepares the GetMultiRolePool request. +func (client AppServiceEnvironmentsClient) GetMultiRolePoolPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetMultiRolePoolSender sends the GetMultiRolePool request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetMultiRolePoolSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetMultiRolePoolResponder handles the response to the GetMultiRolePool request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetMultiRolePoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetOutboundNetworkDependenciesEndpoints description for Get the network endpoints of all outbound dependencies of an +// App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) GetOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, name string) (result OutboundEnvironmentEndpointCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.GetOutboundNetworkDependenciesEndpoints") + defer func() { + sc := -1 + if result.oeec.Response.Response != nil { + sc = result.oeec.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "GetOutboundNetworkDependenciesEndpoints", err.Error()) + } + + result.fn = client.getOutboundNetworkDependenciesEndpointsNextResults + req, err := client.GetOutboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + resp, err := client.GetOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.oeec.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetOutboundNetworkDependenciesEndpoints", resp, "Failure sending request") + return + } + + result.oeec, err = client.GetOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetOutboundNetworkDependenciesEndpoints", resp, "Failure responding to request") + return + } + if result.oeec.hasNextLink() && result.oeec.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetOutboundNetworkDependenciesEndpointsPreparer prepares the GetOutboundNetworkDependenciesEndpoints request. +func (client AppServiceEnvironmentsClient) GetOutboundNetworkDependenciesEndpointsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/outboundNetworkDependenciesEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetOutboundNetworkDependenciesEndpointsSender sends the GetOutboundNetworkDependenciesEndpoints request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetOutboundNetworkDependenciesEndpointsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetOutboundNetworkDependenciesEndpointsResponder handles the response to the GetOutboundNetworkDependenciesEndpoints request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetOutboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result OutboundEnvironmentEndpointCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getOutboundNetworkDependenciesEndpointsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) getOutboundNetworkDependenciesEndpointsNextResults(ctx context.Context, lastResults OutboundEnvironmentEndpointCollection) (result OutboundEnvironmentEndpointCollection, err error) { + req, err := lastResults.outboundEnvironmentEndpointCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "getOutboundNetworkDependenciesEndpointsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "getOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure sending next results request") + } + result, err = client.GetOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "getOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetOutboundNetworkDependenciesEndpointsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) GetOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, resourceGroupName string, name string) (result OutboundEnvironmentEndpointCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.GetOutboundNetworkDependenciesEndpoints") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetOutboundNetworkDependenciesEndpoints(ctx, resourceGroupName, name) + return +} + +// GetPrivateEndpointConnection description for Gets a private endpoint connection +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// privateEndpointConnectionName - name of the private endpoint connection. +func (client AppServiceEnvironmentsClient) GetPrivateEndpointConnection(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (result RemotePrivateEndpointConnectionARMResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.GetPrivateEndpointConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "GetPrivateEndpointConnection", err.Error()) + } + + req, err := client.GetPrivateEndpointConnectionPreparer(ctx, resourceGroupName, name, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetPrivateEndpointConnection", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateEndpointConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetPrivateEndpointConnection", resp, "Failure sending request") + return + } + + result, err = client.GetPrivateEndpointConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetPrivateEndpointConnection", resp, "Failure responding to request") + return + } + + return +} + +// GetPrivateEndpointConnectionPreparer prepares the GetPrivateEndpointConnection request. +func (client AppServiceEnvironmentsClient) GetPrivateEndpointConnectionPreparer(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateEndpointConnectionSender sends the GetPrivateEndpointConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetPrivateEndpointConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateEndpointConnectionResponder handles the response to the GetPrivateEndpointConnection request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetPrivateEndpointConnectionResponder(resp *http.Response) (result RemotePrivateEndpointConnectionARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPrivateEndpointConnectionList description for Gets the list of private endpoints associated with a hosting +// environment +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) GetPrivateEndpointConnectionList(ctx context.Context, resourceGroupName string, name string) (result PrivateEndpointConnectionCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.GetPrivateEndpointConnectionList") + defer func() { + sc := -1 + if result.pecc.Response.Response != nil { + sc = result.pecc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "GetPrivateEndpointConnectionList", err.Error()) + } + + result.fn = client.getPrivateEndpointConnectionListNextResults + req, err := client.GetPrivateEndpointConnectionListPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetPrivateEndpointConnectionList", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateEndpointConnectionListSender(req) + if err != nil { + result.pecc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetPrivateEndpointConnectionList", resp, "Failure sending request") + return + } + + result.pecc, err = client.GetPrivateEndpointConnectionListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetPrivateEndpointConnectionList", resp, "Failure responding to request") + return + } + if result.pecc.hasNextLink() && result.pecc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetPrivateEndpointConnectionListPreparer prepares the GetPrivateEndpointConnectionList request. +func (client AppServiceEnvironmentsClient) GetPrivateEndpointConnectionListPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateEndpointConnectionListSender sends the GetPrivateEndpointConnectionList request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetPrivateEndpointConnectionListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateEndpointConnectionListResponder handles the response to the GetPrivateEndpointConnectionList request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetPrivateEndpointConnectionListResponder(resp *http.Response) (result PrivateEndpointConnectionCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getPrivateEndpointConnectionListNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) getPrivateEndpointConnectionListNextResults(ctx context.Context, lastResults PrivateEndpointConnectionCollection) (result PrivateEndpointConnectionCollection, err error) { + req, err := lastResults.privateEndpointConnectionCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "getPrivateEndpointConnectionListNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetPrivateEndpointConnectionListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "getPrivateEndpointConnectionListNextResults", resp, "Failure sending next results request") + } + result, err = client.GetPrivateEndpointConnectionListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "getPrivateEndpointConnectionListNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetPrivateEndpointConnectionListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) GetPrivateEndpointConnectionListComplete(ctx context.Context, resourceGroupName string, name string) (result PrivateEndpointConnectionCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.GetPrivateEndpointConnectionList") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetPrivateEndpointConnectionList(ctx, resourceGroupName, name) + return +} + +// GetPrivateLinkResources description for Gets the private link resources +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) GetPrivateLinkResources(ctx context.Context, resourceGroupName string, name string) (result PrivateLinkResourcesWrapper, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.GetPrivateLinkResources") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "GetPrivateLinkResources", err.Error()) + } + + req, err := client.GetPrivateLinkResourcesPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetPrivateLinkResources", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateLinkResourcesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetPrivateLinkResources", resp, "Failure sending request") + return + } + + result, err = client.GetPrivateLinkResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetPrivateLinkResources", resp, "Failure responding to request") + return + } + + return +} + +// GetPrivateLinkResourcesPreparer prepares the GetPrivateLinkResources request. +func (client AppServiceEnvironmentsClient) GetPrivateLinkResourcesPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateLinkResourcesSender sends the GetPrivateLinkResources request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetPrivateLinkResourcesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateLinkResourcesResponder handles the response to the GetPrivateLinkResources request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetPrivateLinkResourcesResponder(resp *http.Response) (result PrivateLinkResourcesWrapper, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVipInfo description for Get IP addresses assigned to an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) GetVipInfo(ctx context.Context, resourceGroupName string, name string) (result AddressResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.GetVipInfo") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "GetVipInfo", err.Error()) + } + + req, err := client.GetVipInfoPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetVipInfo", nil, "Failure preparing request") + return + } + + resp, err := client.GetVipInfoSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetVipInfo", resp, "Failure sending request") + return + } + + result, err = client.GetVipInfoResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetVipInfo", resp, "Failure responding to request") + return + } + + return +} + +// GetVipInfoPreparer prepares the GetVipInfo request. +func (client AppServiceEnvironmentsClient) GetVipInfoPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/virtualip", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVipInfoSender sends the GetVipInfo request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetVipInfoSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetVipInfoResponder handles the response to the GetVipInfo request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetVipInfoResponder(resp *http.Response) (result AddressResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetWorkerPool description for Get properties of a worker pool. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// workerPoolName - name of the worker pool. +func (client AppServiceEnvironmentsClient) GetWorkerPool(ctx context.Context, resourceGroupName string, name string, workerPoolName string) (result WorkerPoolResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.GetWorkerPool") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "GetWorkerPool", err.Error()) + } + + req, err := client.GetWorkerPoolPreparer(ctx, resourceGroupName, name, workerPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetWorkerPool", nil, "Failure preparing request") + return + } + + resp, err := client.GetWorkerPoolSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetWorkerPool", resp, "Failure sending request") + return + } + + result, err = client.GetWorkerPoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetWorkerPool", resp, "Failure responding to request") + return + } + + return +} + +// GetWorkerPoolPreparer prepares the GetWorkerPool request. +func (client AppServiceEnvironmentsClient) GetWorkerPoolPreparer(ctx context.Context, resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetWorkerPoolSender sends the GetWorkerPool request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetWorkerPoolSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetWorkerPoolResponder handles the response to the GetWorkerPool request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetWorkerPoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List description for Get all App Service Environments for a subscription. +func (client AppServiceEnvironmentsClient) List(ctx context.Context) (result AppServiceEnvironmentCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.List") + defer func() { + sc := -1 + if result.asec.Response.Response != nil { + sc = result.asec.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.asec.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", resp, "Failure sending request") + return + } + + result.asec, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", resp, "Failure responding to request") + return + } + if result.asec.hasNextLink() && result.asec.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AppServiceEnvironmentsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListResponder(resp *http.Response) (result AppServiceEnvironmentCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listNextResults(ctx context.Context, lastResults AppServiceEnvironmentCollection) (result AppServiceEnvironmentCollection, err error) { + req, err := lastResults.appServiceEnvironmentCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListComplete(ctx context.Context) (result AppServiceEnvironmentCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListAppServicePlans description for Get all App Service plans in an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListAppServicePlans(ctx context.Context, resourceGroupName string, name string) (result AppServicePlanCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListAppServicePlans") + defer func() { + sc := -1 + if result.aspc.Response.Response != nil { + sc = result.aspc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListAppServicePlans", err.Error()) + } + + result.fn = client.listAppServicePlansNextResults + req, err := client.ListAppServicePlansPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", nil, "Failure preparing request") + return + } + + resp, err := client.ListAppServicePlansSender(req) + if err != nil { + result.aspc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", resp, "Failure sending request") + return + } + + result.aspc, err = client.ListAppServicePlansResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", resp, "Failure responding to request") + return + } + if result.aspc.hasNextLink() && result.aspc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAppServicePlansPreparer prepares the ListAppServicePlans request. +func (client AppServiceEnvironmentsClient) ListAppServicePlansPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/serverfarms", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAppServicePlansSender sends the ListAppServicePlans request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListAppServicePlansSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAppServicePlansResponder handles the response to the ListAppServicePlans request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListAppServicePlansResponder(resp *http.Response) (result AppServicePlanCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAppServicePlansNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listAppServicePlansNextResults(ctx context.Context, lastResults AppServicePlanCollection) (result AppServicePlanCollection, err error) { + req, err := lastResults.appServicePlanCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listAppServicePlansNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAppServicePlansSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listAppServicePlansNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAppServicePlansResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listAppServicePlansNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAppServicePlansComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListAppServicePlansComplete(ctx context.Context, resourceGroupName string, name string) (result AppServicePlanCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListAppServicePlans") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAppServicePlans(ctx, resourceGroupName, name) + return +} + +// ListByResourceGroup description for Get all App Service Environments in a resource group. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +func (client AppServiceEnvironmentsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AppServiceEnvironmentCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.asec.Response.Response != nil { + sc = result.asec.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.asec.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.asec, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.asec.hasNextLink() && result.asec.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AppServiceEnvironmentsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListByResourceGroupResponder(resp *http.Response) (result AppServiceEnvironmentCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AppServiceEnvironmentCollection) (result AppServiceEnvironmentCollection, err error) { + req, err := lastResults.appServiceEnvironmentCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AppServiceEnvironmentCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListCapacities description for Get the used, available, and total worker capacity an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListCapacities(ctx context.Context, resourceGroupName string, name string) (result StampCapacityCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListCapacities") + defer func() { + sc := -1 + if result.scc.Response.Response != nil { + sc = result.scc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListCapacities", err.Error()) + } + + result.fn = client.listCapacitiesNextResults + req, err := client.ListCapacitiesPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", nil, "Failure preparing request") + return + } + + resp, err := client.ListCapacitiesSender(req) + if err != nil { + result.scc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", resp, "Failure sending request") + return + } + + result.scc, err = client.ListCapacitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", resp, "Failure responding to request") + return + } + if result.scc.hasNextLink() && result.scc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListCapacitiesPreparer prepares the ListCapacities request. +func (client AppServiceEnvironmentsClient) ListCapacitiesPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCapacitiesSender sends the ListCapacities request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListCapacitiesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListCapacitiesResponder handles the response to the ListCapacities request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListCapacitiesResponder(resp *http.Response) (result StampCapacityCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listCapacitiesNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listCapacitiesNextResults(ctx context.Context, lastResults StampCapacityCollection) (result StampCapacityCollection, err error) { + req, err := lastResults.stampCapacityCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listCapacitiesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListCapacitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listCapacitiesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListCapacitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listCapacitiesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListCapacitiesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListCapacitiesComplete(ctx context.Context, resourceGroupName string, name string) (result StampCapacityCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListCapacities") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListCapacities(ctx, resourceGroupName, name) + return +} + +// ListDiagnostics description for Get diagnostic information for an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListDiagnostics(ctx context.Context, resourceGroupName string, name string) (result ListHostingEnvironmentDiagnostics, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListDiagnostics") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListDiagnostics", err.Error()) + } + + req, err := client.ListDiagnosticsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListDiagnostics", nil, "Failure preparing request") + return + } + + resp, err := client.ListDiagnosticsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListDiagnostics", resp, "Failure sending request") + return + } + + result, err = client.ListDiagnosticsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListDiagnostics", resp, "Failure responding to request") + return + } + + return +} + +// ListDiagnosticsPreparer prepares the ListDiagnostics request. +func (client AppServiceEnvironmentsClient) ListDiagnosticsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListDiagnosticsSender sends the ListDiagnostics request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListDiagnosticsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListDiagnosticsResponder handles the response to the ListDiagnostics request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListDiagnosticsResponder(resp *http.Response) (result ListHostingEnvironmentDiagnostics, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMultiRoleMetricDefinitions description for Get metric definitions for a multi-role pool of an App Service +// Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitions(ctx context.Context, resourceGroupName string, name string) (result ResourceMetricDefinitionCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListMultiRoleMetricDefinitions") + defer func() { + sc := -1 + if result.rmdc.Response.Response != nil { + sc = result.rmdc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", err.Error()) + } + + result.fn = client.listMultiRoleMetricDefinitionsNextResults + req, err := client.ListMultiRoleMetricDefinitionsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", nil, "Failure preparing request") + return + } + + resp, err := client.ListMultiRoleMetricDefinitionsSender(req) + if err != nil { + result.rmdc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", resp, "Failure sending request") + return + } + + result.rmdc, err = client.ListMultiRoleMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", resp, "Failure responding to request") + return + } + if result.rmdc.hasNextLink() && result.rmdc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListMultiRoleMetricDefinitionsPreparer prepares the ListMultiRoleMetricDefinitions request. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListMultiRoleMetricDefinitionsSender sends the ListMultiRoleMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListMultiRoleMetricDefinitionsResponder handles the response to the ListMultiRoleMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listMultiRoleMetricDefinitionsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listMultiRoleMetricDefinitionsNextResults(ctx context.Context, lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.resourceMetricDefinitionCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listMultiRoleMetricDefinitionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListMultiRoleMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listMultiRoleMetricDefinitionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListMultiRoleMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listMultiRoleMetricDefinitionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListMultiRoleMetricDefinitionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsComplete(ctx context.Context, resourceGroupName string, name string) (result ResourceMetricDefinitionCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListMultiRoleMetricDefinitions") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListMultiRoleMetricDefinitions(ctx, resourceGroupName, name) + return +} + +// ListMultiRolePoolInstanceMetricDefinitions description for Get metric definitions for a specific instance of a +// multi-role pool of an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// instance - name of the instance in the multi-role pool. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitions(ctx context.Context, resourceGroupName string, name string, instance string) (result ResourceMetricDefinitionCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListMultiRolePoolInstanceMetricDefinitions") + defer func() { + sc := -1 + if result.rmdc.Response.Response != nil { + sc = result.rmdc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", err.Error()) + } + + result.fn = client.listMultiRolePoolInstanceMetricDefinitionsNextResults + req, err := client.ListMultiRolePoolInstanceMetricDefinitionsPreparer(ctx, resourceGroupName, name, instance) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", nil, "Failure preparing request") + return + } + + resp, err := client.ListMultiRolePoolInstanceMetricDefinitionsSender(req) + if err != nil { + result.rmdc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", resp, "Failure sending request") + return + } + + result.rmdc, err = client.ListMultiRolePoolInstanceMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", resp, "Failure responding to request") + return + } + if result.rmdc.hasNextLink() && result.rmdc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListMultiRolePoolInstanceMetricDefinitionsPreparer prepares the ListMultiRolePoolInstanceMetricDefinitions request. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, name string, instance string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instance": autorest.Encode("path", instance), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListMultiRolePoolInstanceMetricDefinitionsSender sends the ListMultiRolePoolInstanceMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListMultiRolePoolInstanceMetricDefinitionsResponder handles the response to the ListMultiRolePoolInstanceMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listMultiRolePoolInstanceMetricDefinitionsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listMultiRolePoolInstanceMetricDefinitionsNextResults(ctx context.Context, lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.resourceMetricDefinitionCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listMultiRolePoolInstanceMetricDefinitionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListMultiRolePoolInstanceMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listMultiRolePoolInstanceMetricDefinitionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListMultiRolePoolInstanceMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listMultiRolePoolInstanceMetricDefinitionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListMultiRolePoolInstanceMetricDefinitionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsComplete(ctx context.Context, resourceGroupName string, name string, instance string) (result ResourceMetricDefinitionCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListMultiRolePoolInstanceMetricDefinitions") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListMultiRolePoolInstanceMetricDefinitions(ctx, resourceGroupName, name, instance) + return +} + +// ListMultiRolePools description for Get all multi-role pools. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListMultiRolePools(ctx context.Context, resourceGroupName string, name string) (result WorkerPoolCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListMultiRolePools") + defer func() { + sc := -1 + if result.wpc.Response.Response != nil { + sc = result.wpc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListMultiRolePools", err.Error()) + } + + result.fn = client.listMultiRolePoolsNextResults + req, err := client.ListMultiRolePoolsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", nil, "Failure preparing request") + return + } + + resp, err := client.ListMultiRolePoolsSender(req) + if err != nil { + result.wpc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", resp, "Failure sending request") + return + } + + result.wpc, err = client.ListMultiRolePoolsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", resp, "Failure responding to request") + return + } + if result.wpc.hasNextLink() && result.wpc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListMultiRolePoolsPreparer prepares the ListMultiRolePools request. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListMultiRolePoolsSender sends the ListMultiRolePools request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListMultiRolePoolsResponder handles the response to the ListMultiRolePools request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolsResponder(resp *http.Response) (result WorkerPoolCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listMultiRolePoolsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listMultiRolePoolsNextResults(ctx context.Context, lastResults WorkerPoolCollection) (result WorkerPoolCollection, err error) { + req, err := lastResults.workerPoolCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listMultiRolePoolsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListMultiRolePoolsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listMultiRolePoolsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListMultiRolePoolsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listMultiRolePoolsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListMultiRolePoolsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolsComplete(ctx context.Context, resourceGroupName string, name string) (result WorkerPoolCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListMultiRolePools") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListMultiRolePools(ctx, resourceGroupName, name) + return +} + +// ListMultiRolePoolSkus description for Get available SKUs for scaling a multi-role pool. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkus(ctx context.Context, resourceGroupName string, name string) (result SkuInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListMultiRolePoolSkus") + defer func() { + sc := -1 + if result.sic.Response.Response != nil { + sc = result.sic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", err.Error()) + } + + result.fn = client.listMultiRolePoolSkusNextResults + req, err := client.ListMultiRolePoolSkusPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListMultiRolePoolSkusSender(req) + if err != nil { + result.sic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", resp, "Failure sending request") + return + } + + result.sic, err = client.ListMultiRolePoolSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", resp, "Failure responding to request") + return + } + if result.sic.hasNextLink() && result.sic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListMultiRolePoolSkusPreparer prepares the ListMultiRolePoolSkus request. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListMultiRolePoolSkusSender sends the ListMultiRolePoolSkus request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListMultiRolePoolSkusResponder handles the response to the ListMultiRolePoolSkus request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusResponder(resp *http.Response) (result SkuInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listMultiRolePoolSkusNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listMultiRolePoolSkusNextResults(ctx context.Context, lastResults SkuInfoCollection) (result SkuInfoCollection, err error) { + req, err := lastResults.skuInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listMultiRolePoolSkusNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListMultiRolePoolSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listMultiRolePoolSkusNextResults", resp, "Failure sending next results request") + } + result, err = client.ListMultiRolePoolSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listMultiRolePoolSkusNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListMultiRolePoolSkusComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusComplete(ctx context.Context, resourceGroupName string, name string) (result SkuInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListMultiRolePoolSkus") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListMultiRolePoolSkus(ctx, resourceGroupName, name) + return +} + +// ListMultiRoleUsages description for Get usage metrics for a multi-role pool of an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListMultiRoleUsages(ctx context.Context, resourceGroupName string, name string) (result UsageCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListMultiRoleUsages") + defer func() { + sc := -1 + if result.uc.Response.Response != nil { + sc = result.uc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", err.Error()) + } + + result.fn = client.listMultiRoleUsagesNextResults + req, err := client.ListMultiRoleUsagesPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", nil, "Failure preparing request") + return + } + + resp, err := client.ListMultiRoleUsagesSender(req) + if err != nil { + result.uc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", resp, "Failure sending request") + return + } + + result.uc, err = client.ListMultiRoleUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", resp, "Failure responding to request") + return + } + if result.uc.hasNextLink() && result.uc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListMultiRoleUsagesPreparer prepares the ListMultiRoleUsages request. +func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListMultiRoleUsagesSender sends the ListMultiRoleUsages request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListMultiRoleUsagesResponder handles the response to the ListMultiRoleUsages request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesResponder(resp *http.Response) (result UsageCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listMultiRoleUsagesNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listMultiRoleUsagesNextResults(ctx context.Context, lastResults UsageCollection) (result UsageCollection, err error) { + req, err := lastResults.usageCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listMultiRoleUsagesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListMultiRoleUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listMultiRoleUsagesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListMultiRoleUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listMultiRoleUsagesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListMultiRoleUsagesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesComplete(ctx context.Context, resourceGroupName string, name string) (result UsageCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListMultiRoleUsages") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListMultiRoleUsages(ctx, resourceGroupName, name) + return +} + +// ListOperations description for List all currently running operations on the App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListOperations(ctx context.Context, resourceGroupName string, name string) (result ListOperation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListOperations") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListOperations", err.Error()) + } + + req, err := client.ListOperationsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListOperations", nil, "Failure preparing request") + return + } + + resp, err := client.ListOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListOperations", resp, "Failure sending request") + return + } + + result, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListOperations", resp, "Failure responding to request") + return + } + + return +} + +// ListOperationsPreparer prepares the ListOperations request. +func (client AppServiceEnvironmentsClient) ListOperationsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListOperationsSender sends the ListOperations request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListOperationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListOperationsResponder handles the response to the ListOperations request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListOperationsResponder(resp *http.Response) (result ListOperation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsages description for Get global usage metrics of an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// filter - return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: +// $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and +// endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppServiceEnvironmentsClient) ListUsages(ctx context.Context, resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListUsages") + defer func() { + sc := -1 + if result.cuqc.Response.Response != nil { + sc = result.cuqc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListUsages", err.Error()) + } + + result.fn = client.listUsagesNextResults + req, err := client.ListUsagesPreparer(ctx, resourceGroupName, name, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.cuqc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", resp, "Failure sending request") + return + } + + result.cuqc, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", resp, "Failure responding to request") + return + } + if result.cuqc.hasNextLink() && result.cuqc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListUsagesPreparer prepares the ListUsages request. +func (client AppServiceEnvironmentsClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, name string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListUsagesSender sends the ListUsages request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListUsagesResponder handles the response to the ListUsages request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListUsagesResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listUsagesNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listUsagesNextResults(ctx context.Context, lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { + req, err := lastResults.csmUsageQuotaCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listUsagesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listUsagesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listUsagesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListUsagesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListUsagesComplete(ctx context.Context, resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListUsages") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListUsages(ctx, resourceGroupName, name, filter) + return +} + +// ListWebApps description for Get all apps in an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// propertiesToInclude - comma separated list of app properties to include. +func (client AppServiceEnvironmentsClient) ListWebApps(ctx context.Context, resourceGroupName string, name string, propertiesToInclude string) (result AppCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListWebApps") + defer func() { + sc := -1 + if result.ac.Response.Response != nil { + sc = result.ac.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListWebApps", err.Error()) + } + + result.fn = client.listWebAppsNextResults + req, err := client.ListWebAppsPreparer(ctx, resourceGroupName, name, propertiesToInclude) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", nil, "Failure preparing request") + return + } + + resp, err := client.ListWebAppsSender(req) + if err != nil { + result.ac.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", resp, "Failure sending request") + return + } + + result.ac, err = client.ListWebAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", resp, "Failure responding to request") + return + } + if result.ac.hasNextLink() && result.ac.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListWebAppsPreparer prepares the ListWebApps request. +func (client AppServiceEnvironmentsClient) ListWebAppsPreparer(ctx context.Context, resourceGroupName string, name string, propertiesToInclude string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(propertiesToInclude) > 0 { + queryParameters["propertiesToInclude"] = autorest.Encode("query", propertiesToInclude) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListWebAppsSender sends the ListWebApps request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWebAppsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListWebAppsResponder handles the response to the ListWebApps request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWebAppsResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listWebAppsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listWebAppsNextResults(ctx context.Context, lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.appCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWebAppsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListWebAppsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWebAppsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListWebAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWebAppsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListWebAppsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListWebAppsComplete(ctx context.Context, resourceGroupName string, name string, propertiesToInclude string) (result AppCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListWebApps") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListWebApps(ctx, resourceGroupName, name, propertiesToInclude) + return +} + +// ListWebWorkerMetricDefinitions description for Get metric definitions for a worker pool of an App Service +// Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// workerPoolName - name of the worker pool. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitions(ctx context.Context, resourceGroupName string, name string, workerPoolName string) (result ResourceMetricDefinitionCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListWebWorkerMetricDefinitions") + defer func() { + sc := -1 + if result.rmdc.Response.Response != nil { + sc = result.rmdc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", err.Error()) + } + + result.fn = client.listWebWorkerMetricDefinitionsNextResults + req, err := client.ListWebWorkerMetricDefinitionsPreparer(ctx, resourceGroupName, name, workerPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", nil, "Failure preparing request") + return + } + + resp, err := client.ListWebWorkerMetricDefinitionsSender(req) + if err != nil { + result.rmdc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", resp, "Failure sending request") + return + } + + result.rmdc, err = client.ListWebWorkerMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", resp, "Failure responding to request") + return + } + if result.rmdc.hasNextLink() && result.rmdc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListWebWorkerMetricDefinitionsPreparer prepares the ListWebWorkerMetricDefinitions request. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListWebWorkerMetricDefinitionsSender sends the ListWebWorkerMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListWebWorkerMetricDefinitionsResponder handles the response to the ListWebWorkerMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listWebWorkerMetricDefinitionsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listWebWorkerMetricDefinitionsNextResults(ctx context.Context, lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.resourceMetricDefinitionCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWebWorkerMetricDefinitionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListWebWorkerMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWebWorkerMetricDefinitionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListWebWorkerMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWebWorkerMetricDefinitionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListWebWorkerMetricDefinitionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsComplete(ctx context.Context, resourceGroupName string, name string, workerPoolName string) (result ResourceMetricDefinitionCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListWebWorkerMetricDefinitions") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListWebWorkerMetricDefinitions(ctx, resourceGroupName, name, workerPoolName) + return +} + +// ListWebWorkerUsages description for Get usage metrics for a worker pool of an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// workerPoolName - name of the worker pool. +func (client AppServiceEnvironmentsClient) ListWebWorkerUsages(ctx context.Context, resourceGroupName string, name string, workerPoolName string) (result UsageCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListWebWorkerUsages") + defer func() { + sc := -1 + if result.uc.Response.Response != nil { + sc = result.uc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", err.Error()) + } + + result.fn = client.listWebWorkerUsagesNextResults + req, err := client.ListWebWorkerUsagesPreparer(ctx, resourceGroupName, name, workerPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", nil, "Failure preparing request") + return + } + + resp, err := client.ListWebWorkerUsagesSender(req) + if err != nil { + result.uc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", resp, "Failure sending request") + return + } + + result.uc, err = client.ListWebWorkerUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", resp, "Failure responding to request") + return + } + if result.uc.hasNextLink() && result.uc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListWebWorkerUsagesPreparer prepares the ListWebWorkerUsages request. +func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesPreparer(ctx context.Context, resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListWebWorkerUsagesSender sends the ListWebWorkerUsages request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListWebWorkerUsagesResponder handles the response to the ListWebWorkerUsages request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesResponder(resp *http.Response) (result UsageCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listWebWorkerUsagesNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listWebWorkerUsagesNextResults(ctx context.Context, lastResults UsageCollection) (result UsageCollection, err error) { + req, err := lastResults.usageCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWebWorkerUsagesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListWebWorkerUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWebWorkerUsagesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListWebWorkerUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWebWorkerUsagesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListWebWorkerUsagesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesComplete(ctx context.Context, resourceGroupName string, name string, workerPoolName string) (result UsageCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListWebWorkerUsages") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListWebWorkerUsages(ctx, resourceGroupName, name, workerPoolName) + return +} + +// ListWorkerPoolInstanceMetricDefinitions description for Get metric definitions for a specific instance of a worker +// pool of an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// workerPoolName - name of the worker pool. +// instance - name of the instance in the worker pool. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitions(ctx context.Context, resourceGroupName string, name string, workerPoolName string, instance string) (result ResourceMetricDefinitionCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListWorkerPoolInstanceMetricDefinitions") + defer func() { + sc := -1 + if result.rmdc.Response.Response != nil { + sc = result.rmdc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", err.Error()) + } + + result.fn = client.listWorkerPoolInstanceMetricDefinitionsNextResults + req, err := client.ListWorkerPoolInstanceMetricDefinitionsPreparer(ctx, resourceGroupName, name, workerPoolName, instance) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", nil, "Failure preparing request") + return + } + + resp, err := client.ListWorkerPoolInstanceMetricDefinitionsSender(req) + if err != nil { + result.rmdc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", resp, "Failure sending request") + return + } + + result.rmdc, err = client.ListWorkerPoolInstanceMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", resp, "Failure responding to request") + return + } + if result.rmdc.hasNextLink() && result.rmdc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListWorkerPoolInstanceMetricDefinitionsPreparer prepares the ListWorkerPoolInstanceMetricDefinitions request. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsPreparer(ctx context.Context, resourceGroupName string, name string, workerPoolName string, instance string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instance": autorest.Encode("path", instance), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListWorkerPoolInstanceMetricDefinitionsSender sends the ListWorkerPoolInstanceMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListWorkerPoolInstanceMetricDefinitionsResponder handles the response to the ListWorkerPoolInstanceMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listWorkerPoolInstanceMetricDefinitionsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listWorkerPoolInstanceMetricDefinitionsNextResults(ctx context.Context, lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.resourceMetricDefinitionCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWorkerPoolInstanceMetricDefinitionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListWorkerPoolInstanceMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWorkerPoolInstanceMetricDefinitionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListWorkerPoolInstanceMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWorkerPoolInstanceMetricDefinitionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListWorkerPoolInstanceMetricDefinitionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsComplete(ctx context.Context, resourceGroupName string, name string, workerPoolName string, instance string) (result ResourceMetricDefinitionCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListWorkerPoolInstanceMetricDefinitions") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListWorkerPoolInstanceMetricDefinitions(ctx, resourceGroupName, name, workerPoolName, instance) + return +} + +// ListWorkerPools description for Get all worker pools of an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListWorkerPools(ctx context.Context, resourceGroupName string, name string) (result WorkerPoolCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListWorkerPools") + defer func() { + sc := -1 + if result.wpc.Response.Response != nil { + sc = result.wpc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListWorkerPools", err.Error()) + } + + result.fn = client.listWorkerPoolsNextResults + req, err := client.ListWorkerPoolsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", nil, "Failure preparing request") + return + } + + resp, err := client.ListWorkerPoolsSender(req) + if err != nil { + result.wpc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", resp, "Failure sending request") + return + } + + result.wpc, err = client.ListWorkerPoolsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", resp, "Failure responding to request") + return + } + if result.wpc.hasNextLink() && result.wpc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListWorkerPoolsPreparer prepares the ListWorkerPools request. +func (client AppServiceEnvironmentsClient) ListWorkerPoolsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListWorkerPoolsSender sends the ListWorkerPools request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWorkerPoolsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListWorkerPoolsResponder handles the response to the ListWorkerPools request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWorkerPoolsResponder(resp *http.Response) (result WorkerPoolCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listWorkerPoolsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listWorkerPoolsNextResults(ctx context.Context, lastResults WorkerPoolCollection) (result WorkerPoolCollection, err error) { + req, err := lastResults.workerPoolCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWorkerPoolsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListWorkerPoolsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWorkerPoolsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListWorkerPoolsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWorkerPoolsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListWorkerPoolsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListWorkerPoolsComplete(ctx context.Context, resourceGroupName string, name string) (result WorkerPoolCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListWorkerPools") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListWorkerPools(ctx, resourceGroupName, name) + return +} + +// ListWorkerPoolSkus description for Get available SKUs for scaling a worker pool. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// workerPoolName - name of the worker pool. +func (client AppServiceEnvironmentsClient) ListWorkerPoolSkus(ctx context.Context, resourceGroupName string, name string, workerPoolName string) (result SkuInfoCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListWorkerPoolSkus") + defer func() { + sc := -1 + if result.sic.Response.Response != nil { + sc = result.sic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", err.Error()) + } + + result.fn = client.listWorkerPoolSkusNextResults + req, err := client.ListWorkerPoolSkusPreparer(ctx, resourceGroupName, name, workerPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListWorkerPoolSkusSender(req) + if err != nil { + result.sic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", resp, "Failure sending request") + return + } + + result.sic, err = client.ListWorkerPoolSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", resp, "Failure responding to request") + return + } + if result.sic.hasNextLink() && result.sic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListWorkerPoolSkusPreparer prepares the ListWorkerPoolSkus request. +func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusPreparer(ctx context.Context, resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListWorkerPoolSkusSender sends the ListWorkerPoolSkus request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListWorkerPoolSkusResponder handles the response to the ListWorkerPoolSkus request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusResponder(resp *http.Response) (result SkuInfoCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listWorkerPoolSkusNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) listWorkerPoolSkusNextResults(ctx context.Context, lastResults SkuInfoCollection) (result SkuInfoCollection, err error) { + req, err := lastResults.skuInfoCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWorkerPoolSkusNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListWorkerPoolSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWorkerPoolSkusNextResults", resp, "Failure sending next results request") + } + result, err = client.ListWorkerPoolSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "listWorkerPoolSkusNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListWorkerPoolSkusComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusComplete(ctx context.Context, resourceGroupName string, name string, workerPoolName string) (result SkuInfoCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.ListWorkerPoolSkus") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListWorkerPoolSkus(ctx, resourceGroupName, name, workerPoolName) + return +} + +// Reboot description for Reboot all machines in an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) Reboot(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.Reboot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "Reboot", err.Error()) + } + + req, err := client.RebootPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Reboot", nil, "Failure preparing request") + return + } + + resp, err := client.RebootSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Reboot", resp, "Failure sending request") + return + } + + result, err = client.RebootResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Reboot", resp, "Failure responding to request") + return + } + + return +} + +// RebootPreparer prepares the Reboot request. +func (client AppServiceEnvironmentsClient) RebootPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RebootSender sends the Reboot request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) RebootSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RebootResponder handles the response to the Reboot request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) RebootResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Resume description for Resume an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) Resume(ctx context.Context, resourceGroupName string, name string) (result AppServiceEnvironmentsResumeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.Resume") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "Resume", err.Error()) + } + + req, err := client.ResumePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", nil, "Failure preparing request") + return + } + + result, err = client.ResumeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", result.Response(), "Failure sending request") + return + } + + return +} + +// ResumePreparer prepares the Resume request. +func (client AppServiceEnvironmentsClient) ResumePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResumeSender sends the Resume request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ResumeSender(req *http.Request) (future AppServiceEnvironmentsResumeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResumeResponder handles the response to the Resume request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ResumeResponder(resp *http.Response) (result AppCollectionPage, err error) { + result.ac, err = client.resumeResponder(resp) + result.fn = client.resumeNextResults + return +} + +func (client AppServiceEnvironmentsClient) resumeResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// resumeNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) resumeNextResults(ctx context.Context, lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.appCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "resumeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + var resp *http.Response + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "resumeNextResults", resp, "Failure sending next results request") + } + return client.resumeResponder(resp) +} + +// ResumeComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) ResumeComplete(ctx context.Context, resourceGroupName string, name string) (result AppServiceEnvironmentsResumeAllFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.Resume") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + var future AppServiceEnvironmentsResumeFuture + future, err = client.Resume(ctx, resourceGroupName, name) + result.FutureAPI = future.FutureAPI + return +} + +// Suspend description for Suspend an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) Suspend(ctx context.Context, resourceGroupName string, name string) (result AppServiceEnvironmentsSuspendFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.Suspend") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "Suspend", err.Error()) + } + + req, err := client.SuspendPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", nil, "Failure preparing request") + return + } + + result, err = client.SuspendSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", result.Response(), "Failure sending request") + return + } + + return +} + +// SuspendPreparer prepares the Suspend request. +func (client AppServiceEnvironmentsClient) SuspendPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SuspendSender sends the Suspend request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) SuspendSender(req *http.Request) (future AppServiceEnvironmentsSuspendFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// SuspendResponder handles the response to the Suspend request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) SuspendResponder(resp *http.Response) (result AppCollectionPage, err error) { + result.ac, err = client.suspendResponder(resp) + result.fn = client.suspendNextResults + return +} + +func (client AppServiceEnvironmentsClient) suspendResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// suspendNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) suspendNextResults(ctx context.Context, lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.appCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "suspendNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + var resp *http.Response + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "suspendNextResults", resp, "Failure sending next results request") + } + return client.suspendResponder(resp) +} + +// SuspendComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServiceEnvironmentsClient) SuspendComplete(ctx context.Context, resourceGroupName string, name string) (result AppServiceEnvironmentsSuspendAllFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.Suspend") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + var future AppServiceEnvironmentsSuspendFuture + future, err = client.Suspend(ctx, resourceGroupName, name) + result.FutureAPI = future.FutureAPI + return +} + +// Update description for Create or update an App Service Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// hostingEnvironmentEnvelope - configuration details of the App Service Environment. +func (client AppServiceEnvironmentsClient) Update(ctx context.Context, resourceGroupName string, name string, hostingEnvironmentEnvelope AppServiceEnvironmentPatchResource) (result AppServiceEnvironmentResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, name, hostingEnvironmentEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AppServiceEnvironmentsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, hostingEnvironmentEnvelope AppServiceEnvironmentPatchResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}", pathParameters), + autorest.WithJSON(hostingEnvironmentEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) UpdateResponder(resp *http.Response) (result AppServiceEnvironmentResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateAseNetworkingConfiguration description for Update networking configuration of an App Service Environment +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +func (client AppServiceEnvironmentsClient) UpdateAseNetworkingConfiguration(ctx context.Context, resourceGroupName string, name string, aseNetworkingConfiguration AseV3NetworkingConfiguration) (result AseV3NetworkingConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.UpdateAseNetworkingConfiguration") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "UpdateAseNetworkingConfiguration", err.Error()) + } + + req, err := client.UpdateAseNetworkingConfigurationPreparer(ctx, resourceGroupName, name, aseNetworkingConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "UpdateAseNetworkingConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateAseNetworkingConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "UpdateAseNetworkingConfiguration", resp, "Failure sending request") + return + } + + result, err = client.UpdateAseNetworkingConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "UpdateAseNetworkingConfiguration", resp, "Failure responding to request") + return + } + + return +} + +// UpdateAseNetworkingConfigurationPreparer prepares the UpdateAseNetworkingConfiguration request. +func (client AppServiceEnvironmentsClient) UpdateAseNetworkingConfigurationPreparer(ctx context.Context, resourceGroupName string, name string, aseNetworkingConfiguration AseV3NetworkingConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/configurations/networking", pathParameters), + autorest.WithJSON(aseNetworkingConfiguration), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateAseNetworkingConfigurationSender sends the UpdateAseNetworkingConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) UpdateAseNetworkingConfigurationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateAseNetworkingConfigurationResponder handles the response to the UpdateAseNetworkingConfiguration request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) UpdateAseNetworkingConfigurationResponder(resp *http.Response) (result AseV3NetworkingConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateMultiRolePool description for Create or update a multi-role pool. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// multiRolePoolEnvelope - properties of the multi-role pool. +func (client AppServiceEnvironmentsClient) UpdateMultiRolePool(ctx context.Context, resourceGroupName string, name string, multiRolePoolEnvelope WorkerPoolResource) (result WorkerPoolResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.UpdateMultiRolePool") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "UpdateMultiRolePool", err.Error()) + } + + req, err := client.UpdateMultiRolePoolPreparer(ctx, resourceGroupName, name, multiRolePoolEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "UpdateMultiRolePool", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateMultiRolePoolSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "UpdateMultiRolePool", resp, "Failure sending request") + return + } + + result, err = client.UpdateMultiRolePoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "UpdateMultiRolePool", resp, "Failure responding to request") + return + } + + return +} + +// UpdateMultiRolePoolPreparer prepares the UpdateMultiRolePool request. +func (client AppServiceEnvironmentsClient) UpdateMultiRolePoolPreparer(ctx context.Context, resourceGroupName string, name string, multiRolePoolEnvelope WorkerPoolResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default", pathParameters), + autorest.WithJSON(multiRolePoolEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateMultiRolePoolSender sends the UpdateMultiRolePool request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) UpdateMultiRolePoolSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateMultiRolePoolResponder handles the response to the UpdateMultiRolePool request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) UpdateMultiRolePoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateWorkerPool description for Create or update a worker pool. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service Environment. +// workerPoolName - name of the worker pool. +// workerPoolEnvelope - properties of the worker pool. +func (client AppServiceEnvironmentsClient) UpdateWorkerPool(ctx context.Context, resourceGroupName string, name string, workerPoolName string, workerPoolEnvelope WorkerPoolResource) (result WorkerPoolResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentsClient.UpdateWorkerPool") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServiceEnvironmentsClient", "UpdateWorkerPool", err.Error()) + } + + req, err := client.UpdateWorkerPoolPreparer(ctx, resourceGroupName, name, workerPoolName, workerPoolEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "UpdateWorkerPool", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateWorkerPoolSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "UpdateWorkerPool", resp, "Failure sending request") + return + } + + result, err = client.UpdateWorkerPoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "UpdateWorkerPool", resp, "Failure responding to request") + return + } + + return +} + +// UpdateWorkerPoolPreparer prepares the UpdateWorkerPool request. +func (client AppServiceEnvironmentsClient) UpdateWorkerPoolPreparer(ctx context.Context, resourceGroupName string, name string, workerPoolName string, workerPoolEnvelope WorkerPoolResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}", pathParameters), + autorest.WithJSON(workerPoolEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateWorkerPoolSender sends the UpdateWorkerPool request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) UpdateWorkerPoolSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateWorkerPoolResponder handles the response to the UpdateWorkerPool request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) UpdateWorkerPoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/appserviceplans.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/appserviceplans.go new file mode 100644 index 000000000000..90503203f87d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/appserviceplans.go @@ -0,0 +1,2632 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AppServicePlansClient is the webSite Management Client +type AppServicePlansClient struct { + BaseClient +} + +// NewAppServicePlansClient creates an instance of the AppServicePlansClient client. +func NewAppServicePlansClient(subscriptionID string) AppServicePlansClient { + return NewAppServicePlansClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppServicePlansClientWithBaseURI creates an instance of the AppServicePlansClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAppServicePlansClientWithBaseURI(baseURI string, subscriptionID string) AppServicePlansClient { + return AppServicePlansClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate description for Creates or updates an App Service Plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// appServicePlan - details of the App Service plan. +func (client AppServicePlansClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, appServicePlan AppServicePlan) (result AppServicePlansCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, appServicePlan) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppServicePlansClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, appServicePlan AppServicePlan) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), + autorest.WithJSON(appServicePlan), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) CreateOrUpdateSender(req *http.Request) (future AppServicePlansCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) CreateOrUpdateResponder(resp *http.Response) (result AppServicePlan, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateVnetRoute description for Create or update a Virtual Network route in an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// vnetName - name of the Virtual Network. +// routeName - name of the Virtual Network route. +// route - definition of the Virtual Network route. +func (client AppServicePlansClient) CreateOrUpdateVnetRoute(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (result VnetRoute, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.CreateOrUpdateVnetRoute") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "CreateOrUpdateVnetRoute", err.Error()) + } + + req, err := client.CreateOrUpdateVnetRoutePreparer(ctx, resourceGroupName, name, vnetName, routeName, route) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateVnetRouteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateVnetRouteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateVnetRoutePreparer prepares the CreateOrUpdateVnetRoute request. +func (client AppServicePlansClient) CreateOrUpdateVnetRoutePreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), + autorest.WithJSON(route), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateVnetRouteSender sends the CreateOrUpdateVnetRoute request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) CreateOrUpdateVnetRouteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateVnetRouteResponder handles the response to the CreateOrUpdateVnetRoute request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) CreateOrUpdateVnetRouteResponder(resp *http.Response) (result VnetRoute, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete description for Delete an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +func (client AppServicePlansClient) Delete(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppServicePlansClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHybridConnection description for Delete a Hybrid Connection in use in an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// namespaceName - name of the Service Bus namespace. +// relayName - name of the Service Bus relay. +func (client AppServicePlansClient) DeleteHybridConnection(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.DeleteHybridConnection") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "DeleteHybridConnection", err.Error()) + } + + req, err := client.DeleteHybridConnectionPreparer(ctx, resourceGroupName, name, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteHybridConnection", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteHybridConnectionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteHybridConnection", resp, "Failure sending request") + return + } + + result, err = client.DeleteHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteHybridConnection", resp, "Failure responding to request") + return + } + + return +} + +// DeleteHybridConnectionPreparer prepares the DeleteHybridConnection request. +func (client AppServicePlansClient) DeleteHybridConnectionPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteHybridConnectionSender sends the DeleteHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) DeleteHybridConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteHybridConnectionResponder handles the response to the DeleteHybridConnection request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) DeleteHybridConnectionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteVnetRoute description for Delete a Virtual Network route in an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// vnetName - name of the Virtual Network. +// routeName - name of the Virtual Network route. +func (client AppServicePlansClient) DeleteVnetRoute(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.DeleteVnetRoute") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "DeleteVnetRoute", err.Error()) + } + + req, err := client.DeleteVnetRoutePreparer(ctx, resourceGroupName, name, vnetName, routeName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteVnetRoute", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteVnetRouteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteVnetRoute", resp, "Failure sending request") + return + } + + result, err = client.DeleteVnetRouteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteVnetRoute", resp, "Failure responding to request") + return + } + + return +} + +// DeleteVnetRoutePreparer prepares the DeleteVnetRoute request. +func (client AppServicePlansClient) DeleteVnetRoutePreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteVnetRouteSender sends the DeleteVnetRoute request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) DeleteVnetRouteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteVnetRouteResponder handles the response to the DeleteVnetRoute request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) DeleteVnetRouteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get description for Get an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +func (client AppServicePlansClient) Get(ctx context.Context, resourceGroupName string, name string) (result AppServicePlan, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppServicePlansClient) GetPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetResponder(resp *http.Response) (result AppServicePlan, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHybridConnection description for Retrieve a Hybrid Connection in use in an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// namespaceName - name of the Service Bus namespace. +// relayName - name of the Service Bus relay. +func (client AppServicePlansClient) GetHybridConnection(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.GetHybridConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "GetHybridConnection", err.Error()) + } + + req, err := client.GetHybridConnectionPreparer(ctx, resourceGroupName, name, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnection", nil, "Failure preparing request") + return + } + + resp, err := client.GetHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnection", resp, "Failure sending request") + return + } + + result, err = client.GetHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnection", resp, "Failure responding to request") + return + } + + return +} + +// GetHybridConnectionPreparer prepares the GetHybridConnection request. +func (client AppServicePlansClient) GetHybridConnectionPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetHybridConnectionSender sends the GetHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetHybridConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetHybridConnectionResponder handles the response to the GetHybridConnection request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHybridConnectionPlanLimit description for Get the maximum number of Hybrid Connections allowed in an App Service +// plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +func (client AppServicePlansClient) GetHybridConnectionPlanLimit(ctx context.Context, resourceGroupName string, name string) (result HybridConnectionLimits, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.GetHybridConnectionPlanLimit") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "GetHybridConnectionPlanLimit", err.Error()) + } + + req, err := client.GetHybridConnectionPlanLimitPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit", nil, "Failure preparing request") + return + } + + resp, err := client.GetHybridConnectionPlanLimitSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit", resp, "Failure sending request") + return + } + + result, err = client.GetHybridConnectionPlanLimitResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit", resp, "Failure responding to request") + return + } + + return +} + +// GetHybridConnectionPlanLimitPreparer prepares the GetHybridConnectionPlanLimit request. +func (client AppServicePlansClient) GetHybridConnectionPlanLimitPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetHybridConnectionPlanLimitSender sends the GetHybridConnectionPlanLimit request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetHybridConnectionPlanLimitSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetHybridConnectionPlanLimitResponder handles the response to the GetHybridConnectionPlanLimit request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetHybridConnectionPlanLimitResponder(resp *http.Response) (result HybridConnectionLimits, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRouteForVnet description for Get a Virtual Network route in an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// vnetName - name of the Virtual Network. +// routeName - name of the Virtual Network route. +func (client AppServicePlansClient) GetRouteForVnet(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string) (result ListVnetRoute, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.GetRouteForVnet") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "GetRouteForVnet", err.Error()) + } + + req, err := client.GetRouteForVnetPreparer(ctx, resourceGroupName, name, vnetName, routeName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetRouteForVnet", nil, "Failure preparing request") + return + } + + resp, err := client.GetRouteForVnetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetRouteForVnet", resp, "Failure sending request") + return + } + + result, err = client.GetRouteForVnetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetRouteForVnet", resp, "Failure responding to request") + return + } + + return +} + +// GetRouteForVnetPreparer prepares the GetRouteForVnet request. +func (client AppServicePlansClient) GetRouteForVnetPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetRouteForVnetSender sends the GetRouteForVnet request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetRouteForVnetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetRouteForVnetResponder handles the response to the GetRouteForVnet request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetRouteForVnetResponder(resp *http.Response) (result ListVnetRoute, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetServerFarmSkus description for Gets all selectable SKUs for a given App Service Plan +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of App Service Plan +func (client AppServicePlansClient) GetServerFarmSkus(ctx context.Context, resourceGroupName string, name string) (result SetObject, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.GetServerFarmSkus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "GetServerFarmSkus", err.Error()) + } + + req, err := client.GetServerFarmSkusPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetServerFarmSkus", nil, "Failure preparing request") + return + } + + resp, err := client.GetServerFarmSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetServerFarmSkus", resp, "Failure sending request") + return + } + + result, err = client.GetServerFarmSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetServerFarmSkus", resp, "Failure responding to request") + return + } + + return +} + +// GetServerFarmSkusPreparer prepares the GetServerFarmSkus request. +func (client AppServicePlansClient) GetServerFarmSkusPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetServerFarmSkusSender sends the GetServerFarmSkus request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetServerFarmSkusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetServerFarmSkusResponder handles the response to the GetServerFarmSkus request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetServerFarmSkusResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetFromServerFarm description for Get a Virtual Network associated with an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// vnetName - name of the Virtual Network. +func (client AppServicePlansClient) GetVnetFromServerFarm(ctx context.Context, resourceGroupName string, name string, vnetName string) (result VnetInfoResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.GetVnetFromServerFarm") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "GetVnetFromServerFarm", err.Error()) + } + + req, err := client.GetVnetFromServerFarmPreparer(ctx, resourceGroupName, name, vnetName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm", nil, "Failure preparing request") + return + } + + resp, err := client.GetVnetFromServerFarmSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm", resp, "Failure sending request") + return + } + + result, err = client.GetVnetFromServerFarmResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm", resp, "Failure responding to request") + return + } + + return +} + +// GetVnetFromServerFarmPreparer prepares the GetVnetFromServerFarm request. +func (client AppServicePlansClient) GetVnetFromServerFarmPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVnetFromServerFarmSender sends the GetVnetFromServerFarm request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetVnetFromServerFarmSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetVnetFromServerFarmResponder handles the response to the GetVnetFromServerFarm request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetVnetFromServerFarmResponder(resp *http.Response) (result VnetInfoResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetGateway description for Get a Virtual Network gateway. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// vnetName - name of the Virtual Network. +// gatewayName - name of the gateway. Only the 'primary' gateway is supported. +func (client AppServicePlansClient) GetVnetGateway(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string) (result VnetGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.GetVnetGateway") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "GetVnetGateway", err.Error()) + } + + req, err := client.GetVnetGatewayPreparer(ctx, resourceGroupName, name, vnetName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetGateway", nil, "Failure preparing request") + return + } + + resp, err := client.GetVnetGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetGateway", resp, "Failure sending request") + return + } + + result, err = client.GetVnetGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetGateway", resp, "Failure responding to request") + return + } + + return +} + +// GetVnetGatewayPreparer prepares the GetVnetGateway request. +func (client AppServicePlansClient) GetVnetGatewayPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVnetGatewaySender sends the GetVnetGateway request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetVnetGatewaySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetVnetGatewayResponder handles the response to the GetVnetGateway request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetVnetGatewayResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List description for Get all App Service plans for a subscription. +// Parameters: +// detailed - specify true to return all App Service plan properties. The default is +// false, which returns a subset of the properties. +// Retrieval of all properties may increase the API latency. +func (client AppServicePlansClient) List(ctx context.Context, detailed *bool) (result AppServicePlanCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.List") + defer func() { + sc := -1 + if result.aspc.Response.Response != nil { + sc = result.aspc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, detailed) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.aspc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", resp, "Failure sending request") + return + } + + result.aspc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", resp, "Failure responding to request") + return + } + if result.aspc.hasNextLink() && result.aspc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AppServicePlansClient) ListPreparer(ctx context.Context, detailed *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if detailed != nil { + queryParameters["detailed"] = autorest.Encode("query", *detailed) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListResponder(resp *http.Response) (result AppServicePlanCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) listNextResults(ctx context.Context, lastResults AppServicePlanCollection) (result AppServicePlanCollection, err error) { + req, err := lastResults.appServicePlanCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServicePlansClient) ListComplete(ctx context.Context, detailed *bool) (result AppServicePlanCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, detailed) + return +} + +// ListByResourceGroup description for Get all App Service plans in a resource group. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +func (client AppServicePlansClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AppServicePlanCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.aspc.Response.Response != nil { + sc = result.aspc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.aspc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.aspc, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.aspc.hasNextLink() && result.aspc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AppServicePlansClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListByResourceGroupResponder(resp *http.Response) (result AppServicePlanCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) listByResourceGroupNextResults(ctx context.Context, lastResults AppServicePlanCollection) (result AppServicePlanCollection, err error) { + req, err := lastResults.appServicePlanCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServicePlansClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AppServicePlanCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListCapabilities description for List all capabilities of an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +func (client AppServicePlansClient) ListCapabilities(ctx context.Context, resourceGroupName string, name string) (result ListCapability, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListCapabilities") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "ListCapabilities", err.Error()) + } + + req, err := client.ListCapabilitiesPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListCapabilities", nil, "Failure preparing request") + return + } + + resp, err := client.ListCapabilitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListCapabilities", resp, "Failure sending request") + return + } + + result, err = client.ListCapabilitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListCapabilities", resp, "Failure responding to request") + return + } + + return +} + +// ListCapabilitiesPreparer prepares the ListCapabilities request. +func (client AppServicePlansClient) ListCapabilitiesPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/capabilities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCapabilitiesSender sends the ListCapabilities request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListCapabilitiesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListCapabilitiesResponder handles the response to the ListCapabilities request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListCapabilitiesResponder(resp *http.Response) (result ListCapability, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHybridConnectionKeys description for Get the send key name and value of a Hybrid Connection. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// namespaceName - the name of the Service Bus namespace. +// relayName - the name of the Service Bus relay. +func (client AppServicePlansClient) ListHybridConnectionKeys(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnectionKey, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListHybridConnectionKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "ListHybridConnectionKeys", err.Error()) + } + + req, err := client.ListHybridConnectionKeysPreparer(ctx, resourceGroupName, name, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListHybridConnectionKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys", resp, "Failure sending request") + return + } + + result, err = client.ListHybridConnectionKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListHybridConnectionKeysPreparer prepares the ListHybridConnectionKeys request. +func (client AppServicePlansClient) ListHybridConnectionKeysPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHybridConnectionKeysSender sends the ListHybridConnectionKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListHybridConnectionKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListHybridConnectionKeysResponder handles the response to the ListHybridConnectionKeys request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListHybridConnectionKeysResponder(resp *http.Response) (result HybridConnectionKey, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHybridConnections description for Retrieve all Hybrid Connections in use in an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +func (client AppServicePlansClient) ListHybridConnections(ctx context.Context, resourceGroupName string, name string) (result HybridConnectionCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListHybridConnections") + defer func() { + sc := -1 + if result.hcc.Response.Response != nil { + sc = result.hcc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "ListHybridConnections", err.Error()) + } + + result.fn = client.listHybridConnectionsNextResults + req, err := client.ListHybridConnectionsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", nil, "Failure preparing request") + return + } + + resp, err := client.ListHybridConnectionsSender(req) + if err != nil { + result.hcc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure sending request") + return + } + + result.hcc, err = client.ListHybridConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure responding to request") + return + } + if result.hcc.hasNextLink() && result.hcc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListHybridConnectionsPreparer prepares the ListHybridConnections request. +func (client AppServicePlansClient) ListHybridConnectionsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionRelays", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHybridConnectionsSender sends the ListHybridConnections request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListHybridConnectionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListHybridConnectionsResponder handles the response to the ListHybridConnections request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListHybridConnectionsResponder(resp *http.Response) (result HybridConnectionCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listHybridConnectionsNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) listHybridConnectionsNextResults(ctx context.Context, lastResults HybridConnectionCollection) (result HybridConnectionCollection, err error) { + req, err := lastResults.hybridConnectionCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listHybridConnectionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListHybridConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listHybridConnectionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListHybridConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listHybridConnectionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListHybridConnectionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServicePlansClient) ListHybridConnectionsComplete(ctx context.Context, resourceGroupName string, name string) (result HybridConnectionCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListHybridConnections") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListHybridConnections(ctx, resourceGroupName, name) + return +} + +// ListRoutesForVnet description for Get all routes that are associated with a Virtual Network in an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// vnetName - name of the Virtual Network. +func (client AppServicePlansClient) ListRoutesForVnet(ctx context.Context, resourceGroupName string, name string, vnetName string) (result ListVnetRoute, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListRoutesForVnet") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "ListRoutesForVnet", err.Error()) + } + + req, err := client.ListRoutesForVnetPreparer(ctx, resourceGroupName, name, vnetName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListRoutesForVnet", nil, "Failure preparing request") + return + } + + resp, err := client.ListRoutesForVnetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListRoutesForVnet", resp, "Failure sending request") + return + } + + result, err = client.ListRoutesForVnetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListRoutesForVnet", resp, "Failure responding to request") + return + } + + return +} + +// ListRoutesForVnetPreparer prepares the ListRoutesForVnet request. +func (client AppServicePlansClient) ListRoutesForVnetPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRoutesForVnetSender sends the ListRoutesForVnet request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListRoutesForVnetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListRoutesForVnetResponder handles the response to the ListRoutesForVnet request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListRoutesForVnetResponder(resp *http.Response) (result ListVnetRoute, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsages description for Gets server farm usage information +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of App Service Plan +// filter - return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: +// $filter=(name.value eq 'Metric1' or name.value eq 'Metric2'). +func (client AppServicePlansClient) ListUsages(ctx context.Context, resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListUsages") + defer func() { + sc := -1 + if result.cuqc.Response.Response != nil { + sc = result.cuqc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "ListUsages", err.Error()) + } + + result.fn = client.listUsagesNextResults + req, err := client.ListUsagesPreparer(ctx, resourceGroupName, name, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListUsages", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.cuqc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListUsages", resp, "Failure sending request") + return + } + + result.cuqc, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListUsages", resp, "Failure responding to request") + return + } + if result.cuqc.hasNextLink() && result.cuqc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListUsagesPreparer prepares the ListUsages request. +func (client AppServicePlansClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, name string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListUsagesSender sends the ListUsages request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListUsagesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListUsagesResponder handles the response to the ListUsages request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListUsagesResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listUsagesNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) listUsagesNextResults(ctx context.Context, lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { + req, err := lastResults.csmUsageQuotaCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listUsagesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listUsagesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listUsagesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListUsagesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServicePlansClient) ListUsagesComplete(ctx context.Context, resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListUsages") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListUsages(ctx, resourceGroupName, name, filter) + return +} + +// ListVnets description for Get all Virtual Networks associated with an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +func (client AppServicePlansClient) ListVnets(ctx context.Context, resourceGroupName string, name string) (result ListVnetInfoResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListVnets") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "ListVnets", err.Error()) + } + + req, err := client.ListVnetsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListVnets", nil, "Failure preparing request") + return + } + + resp, err := client.ListVnetsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListVnets", resp, "Failure sending request") + return + } + + result, err = client.ListVnetsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListVnets", resp, "Failure responding to request") + return + } + + return +} + +// ListVnetsPreparer prepares the ListVnets request. +func (client AppServicePlansClient) ListVnetsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVnetsSender sends the ListVnets request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListVnetsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListVnetsResponder handles the response to the ListVnets request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListVnetsResponder(resp *http.Response) (result ListVnetInfoResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebApps description for Get all apps associated with an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// skipToken - skip to a web app in the list of webapps associated with app service plan. If specified, the +// resulting list will contain web apps starting from (including) the skipToken. Otherwise, the resulting list +// contains web apps from the start of the list +// filter - supported filter: $filter=state eq running. Returns only web apps that are currently running +// top - list page size. If specified, results are paged. +func (client AppServicePlansClient) ListWebApps(ctx context.Context, resourceGroupName string, name string, skipToken string, filter string, top string) (result AppCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListWebApps") + defer func() { + sc := -1 + if result.ac.Response.Response != nil { + sc = result.ac.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "ListWebApps", err.Error()) + } + + result.fn = client.listWebAppsNextResults + req, err := client.ListWebAppsPreparer(ctx, resourceGroupName, name, skipToken, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", nil, "Failure preparing request") + return + } + + resp, err := client.ListWebAppsSender(req) + if err != nil { + result.ac.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure sending request") + return + } + + result.ac, err = client.ListWebAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure responding to request") + return + } + if result.ac.hasNextLink() && result.ac.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListWebAppsPreparer prepares the ListWebApps request. +func (client AppServicePlansClient) ListWebAppsPreparer(ctx context.Context, resourceGroupName string, name string, skipToken string, filter string, top string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + if len(top) > 0 { + queryParameters["$top"] = autorest.Encode("query", top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListWebAppsSender sends the ListWebApps request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListWebAppsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListWebAppsResponder handles the response to the ListWebApps request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListWebAppsResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listWebAppsNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) listWebAppsNextResults(ctx context.Context, lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.appCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listWebAppsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListWebAppsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listWebAppsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListWebAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listWebAppsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListWebAppsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServicePlansClient) ListWebAppsComplete(ctx context.Context, resourceGroupName string, name string, skipToken string, filter string, top string) (result AppCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListWebApps") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListWebApps(ctx, resourceGroupName, name, skipToken, filter, top) + return +} + +// ListWebAppsByHybridConnection description for Get all apps that use a Hybrid Connection in an App Service Plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// namespaceName - name of the Hybrid Connection namespace. +// relayName - name of the Hybrid Connection relay. +func (client AppServicePlansClient) ListWebAppsByHybridConnection(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (result ResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListWebAppsByHybridConnection") + defer func() { + sc := -1 + if result.rc.Response.Response != nil { + sc = result.rc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "ListWebAppsByHybridConnection", err.Error()) + } + + result.fn = client.listWebAppsByHybridConnectionNextResults + req, err := client.ListWebAppsByHybridConnectionPreparer(ctx, resourceGroupName, name, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", nil, "Failure preparing request") + return + } + + resp, err := client.ListWebAppsByHybridConnectionSender(req) + if err != nil { + result.rc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure sending request") + return + } + + result.rc, err = client.ListWebAppsByHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure responding to request") + return + } + if result.rc.hasNextLink() && result.rc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListWebAppsByHybridConnectionPreparer prepares the ListWebAppsByHybridConnection request. +func (client AppServicePlansClient) ListWebAppsByHybridConnectionPreparer(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListWebAppsByHybridConnectionSender sends the ListWebAppsByHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListWebAppsByHybridConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListWebAppsByHybridConnectionResponder handles the response to the ListWebAppsByHybridConnection request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListWebAppsByHybridConnectionResponder(resp *http.Response) (result ResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listWebAppsByHybridConnectionNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) listWebAppsByHybridConnectionNextResults(ctx context.Context, lastResults ResourceCollection) (result ResourceCollection, err error) { + req, err := lastResults.resourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listWebAppsByHybridConnectionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListWebAppsByHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listWebAppsByHybridConnectionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListWebAppsByHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "listWebAppsByHybridConnectionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListWebAppsByHybridConnectionComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppServicePlansClient) ListWebAppsByHybridConnectionComplete(ctx context.Context, resourceGroupName string, name string, namespaceName string, relayName string) (result ResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.ListWebAppsByHybridConnection") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListWebAppsByHybridConnection(ctx, resourceGroupName, name, namespaceName, relayName) + return +} + +// RebootWorker description for Reboot a worker machine in an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// workerName - name of worker machine, which typically starts with RD. +func (client AppServicePlansClient) RebootWorker(ctx context.Context, resourceGroupName string, name string, workerName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.RebootWorker") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "RebootWorker", err.Error()) + } + + req, err := client.RebootWorkerPreparer(ctx, resourceGroupName, name, workerName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RebootWorker", nil, "Failure preparing request") + return + } + + resp, err := client.RebootWorkerSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RebootWorker", resp, "Failure sending request") + return + } + + result, err = client.RebootWorkerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RebootWorker", resp, "Failure responding to request") + return + } + + return +} + +// RebootWorkerPreparer prepares the RebootWorker request. +func (client AppServicePlansClient) RebootWorkerPreparer(ctx context.Context, resourceGroupName string, name string, workerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerName": autorest.Encode("path", workerName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RebootWorkerSender sends the RebootWorker request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) RebootWorkerSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RebootWorkerResponder handles the response to the RebootWorker request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) RebootWorkerResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RestartWebApps description for Restart all apps in an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// softRestart - specify true to perform a soft restart, applies the configuration settings and +// restarts the apps if necessary. The default is false, which always restarts and reprovisions +// the apps +func (client AppServicePlansClient) RestartWebApps(ctx context.Context, resourceGroupName string, name string, softRestart *bool) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.RestartWebApps") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "RestartWebApps", err.Error()) + } + + req, err := client.RestartWebAppsPreparer(ctx, resourceGroupName, name, softRestart) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RestartWebApps", nil, "Failure preparing request") + return + } + + resp, err := client.RestartWebAppsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RestartWebApps", resp, "Failure sending request") + return + } + + result, err = client.RestartWebAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RestartWebApps", resp, "Failure responding to request") + return + } + + return +} + +// RestartWebAppsPreparer prepares the RestartWebApps request. +func (client AppServicePlansClient) RestartWebAppsPreparer(ctx context.Context, resourceGroupName string, name string, softRestart *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if softRestart != nil { + queryParameters["softRestart"] = autorest.Encode("query", *softRestart) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestartWebAppsSender sends the RestartWebApps request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) RestartWebAppsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RestartWebAppsResponder handles the response to the RestartWebApps request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) RestartWebAppsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update description for Creates or updates an App Service Plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// appServicePlan - details of the App Service plan. +func (client AppServicePlansClient) Update(ctx context.Context, resourceGroupName string, name string, appServicePlan AppServicePlanPatchResource) (result AppServicePlan, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, name, appServicePlan) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AppServicePlansClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, appServicePlan AppServicePlanPatchResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), + autorest.WithJSON(appServicePlan), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) UpdateResponder(resp *http.Response) (result AppServicePlan, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetGateway description for Update a Virtual Network gateway. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// vnetName - name of the Virtual Network. +// gatewayName - name of the gateway. Only the 'primary' gateway is supported. +// connectionEnvelope - definition of the gateway. +func (client AppServicePlansClient) UpdateVnetGateway(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.UpdateVnetGateway") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: connectionEnvelope, + Constraints: []validation.Constraint{{Target: "connectionEnvelope.VnetGatewayProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "connectionEnvelope.VnetGatewayProperties.VpnPackageURI", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "UpdateVnetGateway", err.Error()) + } + + req, err := client.UpdateVnetGatewayPreparer(ctx, resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetGateway", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateVnetGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetGateway", resp, "Failure sending request") + return + } + + result, err = client.UpdateVnetGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetGateway", resp, "Failure responding to request") + return + } + + return +} + +// UpdateVnetGatewayPreparer prepares the UpdateVnetGateway request. +func (client AppServicePlansClient) UpdateVnetGatewayPreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateVnetGatewaySender sends the UpdateVnetGateway request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) UpdateVnetGatewaySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateVnetGatewayResponder handles the response to the UpdateVnetGateway request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) UpdateVnetGatewayResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetRoute description for Create or update a Virtual Network route in an App Service plan. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the App Service plan. +// vnetName - name of the Virtual Network. +// routeName - name of the Virtual Network route. +// route - definition of the Virtual Network route. +func (client AppServicePlansClient) UpdateVnetRoute(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (result VnetRoute, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlansClient.UpdateVnetRoute") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppServicePlansClient", "UpdateVnetRoute", err.Error()) + } + + req, err := client.UpdateVnetRoutePreparer(ctx, resourceGroupName, name, vnetName, routeName, route) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetRoute", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateVnetRouteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetRoute", resp, "Failure sending request") + return + } + + result, err = client.UpdateVnetRouteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetRoute", resp, "Failure responding to request") + return + } + + return +} + +// UpdateVnetRoutePreparer prepares the UpdateVnetRoute request. +func (client AppServicePlansClient) UpdateVnetRoutePreparer(ctx context.Context, resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), + autorest.WithJSON(route), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateVnetRouteSender sends the UpdateVnetRoute request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) UpdateVnetRouteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateVnetRouteResponder handles the response to the UpdateVnetRoute request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) UpdateVnetRouteResponder(resp *http.Response) (result VnetRoute, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/certificateordersdiagnostics.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/certificateordersdiagnostics.go new file mode 100644 index 000000000000..5394a46f0ee1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/certificateordersdiagnostics.go @@ -0,0 +1,263 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CertificateOrdersDiagnosticsClient is the webSite Management Client +type CertificateOrdersDiagnosticsClient struct { + BaseClient +} + +// NewCertificateOrdersDiagnosticsClient creates an instance of the CertificateOrdersDiagnosticsClient client. +func NewCertificateOrdersDiagnosticsClient(subscriptionID string) CertificateOrdersDiagnosticsClient { + return NewCertificateOrdersDiagnosticsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCertificateOrdersDiagnosticsClientWithBaseURI creates an instance of the CertificateOrdersDiagnosticsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewCertificateOrdersDiagnosticsClientWithBaseURI(baseURI string, subscriptionID string) CertificateOrdersDiagnosticsClient { + return CertificateOrdersDiagnosticsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetAppServiceCertificateOrderDetectorResponse description for Microsoft.CertificateRegistration call to get a +// detector response from App Lens. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - the certificate order name for which the response is needed. +// detectorName - the detector name which needs to be run. +// startTime - the start time for detector response. +// endTime - the end time for the detector response. +// timeGrain - the time grain for the detector response. +func (client CertificateOrdersDiagnosticsClient) GetAppServiceCertificateOrderDetectorResponse(ctx context.Context, resourceGroupName string, certificateOrderName string, detectorName string, startTime *date.Time, endTime *date.Time, timeGrain string) (result DetectorResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersDiagnosticsClient.GetAppServiceCertificateOrderDetectorResponse") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: timeGrain, + Constraints: []validation.Constraint{{Target: "timeGrain", Name: validation.Empty, Rule: false, + Chain: []validation.Constraint{{Target: "timeGrain", Name: validation.Pattern, Rule: `PT[1-9][0-9]+[SMH]`, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.CertificateOrdersDiagnosticsClient", "GetAppServiceCertificateOrderDetectorResponse", err.Error()) + } + + req, err := client.GetAppServiceCertificateOrderDetectorResponsePreparer(ctx, resourceGroupName, certificateOrderName, detectorName, startTime, endTime, timeGrain) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificateOrdersDiagnosticsClient", "GetAppServiceCertificateOrderDetectorResponse", nil, "Failure preparing request") + return + } + + resp, err := client.GetAppServiceCertificateOrderDetectorResponseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.CertificateOrdersDiagnosticsClient", "GetAppServiceCertificateOrderDetectorResponse", resp, "Failure sending request") + return + } + + result, err = client.GetAppServiceCertificateOrderDetectorResponseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificateOrdersDiagnosticsClient", "GetAppServiceCertificateOrderDetectorResponse", resp, "Failure responding to request") + return + } + + return +} + +// GetAppServiceCertificateOrderDetectorResponsePreparer prepares the GetAppServiceCertificateOrderDetectorResponse request. +func (client CertificateOrdersDiagnosticsClient) GetAppServiceCertificateOrderDetectorResponsePreparer(ctx context.Context, resourceGroupName string, certificateOrderName string, detectorName string, startTime *date.Time, endTime *date.Time, timeGrain string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "detectorName": autorest.Encode("path", detectorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + if len(timeGrain) > 0 { + queryParameters["timeGrain"] = autorest.Encode("query", timeGrain) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/detectors/{detectorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAppServiceCertificateOrderDetectorResponseSender sends the GetAppServiceCertificateOrderDetectorResponse request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateOrdersDiagnosticsClient) GetAppServiceCertificateOrderDetectorResponseSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAppServiceCertificateOrderDetectorResponseResponder handles the response to the GetAppServiceCertificateOrderDetectorResponse request. The method always +// closes the http.Response Body. +func (client CertificateOrdersDiagnosticsClient) GetAppServiceCertificateOrderDetectorResponseResponder(resp *http.Response) (result DetectorResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAppServiceCertificateOrderDetectorResponse description for Microsoft.CertificateRegistration to get the list of +// detectors for this RP. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// certificateOrderName - the certificate order name for which the response is needed. +func (client CertificateOrdersDiagnosticsClient) ListAppServiceCertificateOrderDetectorResponse(ctx context.Context, resourceGroupName string, certificateOrderName string) (result DetectorResponseCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersDiagnosticsClient.ListAppServiceCertificateOrderDetectorResponse") + defer func() { + sc := -1 + if result.drc.Response.Response != nil { + sc = result.drc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.CertificateOrdersDiagnosticsClient", "ListAppServiceCertificateOrderDetectorResponse", err.Error()) + } + + result.fn = client.listAppServiceCertificateOrderDetectorResponseNextResults + req, err := client.ListAppServiceCertificateOrderDetectorResponsePreparer(ctx, resourceGroupName, certificateOrderName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificateOrdersDiagnosticsClient", "ListAppServiceCertificateOrderDetectorResponse", nil, "Failure preparing request") + return + } + + resp, err := client.ListAppServiceCertificateOrderDetectorResponseSender(req) + if err != nil { + result.drc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.CertificateOrdersDiagnosticsClient", "ListAppServiceCertificateOrderDetectorResponse", resp, "Failure sending request") + return + } + + result.drc, err = client.ListAppServiceCertificateOrderDetectorResponseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificateOrdersDiagnosticsClient", "ListAppServiceCertificateOrderDetectorResponse", resp, "Failure responding to request") + return + } + if result.drc.hasNextLink() && result.drc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAppServiceCertificateOrderDetectorResponsePreparer prepares the ListAppServiceCertificateOrderDetectorResponse request. +func (client CertificateOrdersDiagnosticsClient) ListAppServiceCertificateOrderDetectorResponsePreparer(ctx context.Context, resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/detectors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAppServiceCertificateOrderDetectorResponseSender sends the ListAppServiceCertificateOrderDetectorResponse request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateOrdersDiagnosticsClient) ListAppServiceCertificateOrderDetectorResponseSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAppServiceCertificateOrderDetectorResponseResponder handles the response to the ListAppServiceCertificateOrderDetectorResponse request. The method always +// closes the http.Response Body. +func (client CertificateOrdersDiagnosticsClient) ListAppServiceCertificateOrderDetectorResponseResponder(resp *http.Response) (result DetectorResponseCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAppServiceCertificateOrderDetectorResponseNextResults retrieves the next set of results, if any. +func (client CertificateOrdersDiagnosticsClient) listAppServiceCertificateOrderDetectorResponseNextResults(ctx context.Context, lastResults DetectorResponseCollection) (result DetectorResponseCollection, err error) { + req, err := lastResults.detectorResponseCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.CertificateOrdersDiagnosticsClient", "listAppServiceCertificateOrderDetectorResponseNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAppServiceCertificateOrderDetectorResponseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.CertificateOrdersDiagnosticsClient", "listAppServiceCertificateOrderDetectorResponseNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAppServiceCertificateOrderDetectorResponseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificateOrdersDiagnosticsClient", "listAppServiceCertificateOrderDetectorResponseNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAppServiceCertificateOrderDetectorResponseComplete enumerates all values, automatically crossing page boundaries as required. +func (client CertificateOrdersDiagnosticsClient) ListAppServiceCertificateOrderDetectorResponseComplete(ctx context.Context, resourceGroupName string, certificateOrderName string) (result DetectorResponseCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateOrdersDiagnosticsClient.ListAppServiceCertificateOrderDetectorResponse") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAppServiceCertificateOrderDetectorResponse(ctx, resourceGroupName, certificateOrderName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/certificateregistrationprovider.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/certificateregistrationprovider.go new file mode 100644 index 000000000000..f551c2b175c7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/certificateregistrationprovider.go @@ -0,0 +1,142 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CertificateRegistrationProviderClient is the webSite Management Client +type CertificateRegistrationProviderClient struct { + BaseClient +} + +// NewCertificateRegistrationProviderClient creates an instance of the CertificateRegistrationProviderClient client. +func NewCertificateRegistrationProviderClient(subscriptionID string) CertificateRegistrationProviderClient { + return NewCertificateRegistrationProviderClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCertificateRegistrationProviderClientWithBaseURI creates an instance of the CertificateRegistrationProviderClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewCertificateRegistrationProviderClientWithBaseURI(baseURI string, subscriptionID string) CertificateRegistrationProviderClient { + return CertificateRegistrationProviderClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListOperations description for Implements Csm operations Api to exposes the list of available Csm Apis under the +// resource provider +func (client CertificateRegistrationProviderClient) ListOperations(ctx context.Context) (result CsmOperationCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateRegistrationProviderClient.ListOperations") + defer func() { + sc := -1 + if result.coc.Response.Response != nil { + sc = result.coc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listOperationsNextResults + req, err := client.ListOperationsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificateRegistrationProviderClient", "ListOperations", nil, "Failure preparing request") + return + } + + resp, err := client.ListOperationsSender(req) + if err != nil { + result.coc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.CertificateRegistrationProviderClient", "ListOperations", resp, "Failure sending request") + return + } + + result.coc, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificateRegistrationProviderClient", "ListOperations", resp, "Failure responding to request") + return + } + if result.coc.hasNextLink() && result.coc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListOperationsPreparer prepares the ListOperations request. +func (client CertificateRegistrationProviderClient) ListOperationsPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.CertificateRegistration/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListOperationsSender sends the ListOperations request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateRegistrationProviderClient) ListOperationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListOperationsResponder handles the response to the ListOperations request. The method always +// closes the http.Response Body. +func (client CertificateRegistrationProviderClient) ListOperationsResponder(resp *http.Response) (result CsmOperationCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listOperationsNextResults retrieves the next set of results, if any. +func (client CertificateRegistrationProviderClient) listOperationsNextResults(ctx context.Context, lastResults CsmOperationCollection) (result CsmOperationCollection, err error) { + req, err := lastResults.csmOperationCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.CertificateRegistrationProviderClient", "listOperationsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.CertificateRegistrationProviderClient", "listOperationsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificateRegistrationProviderClient", "listOperationsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListOperationsComplete enumerates all values, automatically crossing page boundaries as required. +func (client CertificateRegistrationProviderClient) ListOperationsComplete(ctx context.Context) (result CsmOperationCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateRegistrationProviderClient.ListOperations") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListOperations(ctx) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/certificates.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/certificates.go new file mode 100644 index 000000000000..b10e3b7cb595 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/certificates.go @@ -0,0 +1,616 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CertificatesClient is the webSite Management Client +type CertificatesClient struct { + BaseClient +} + +// NewCertificatesClient creates an instance of the CertificatesClient client. +func NewCertificatesClient(subscriptionID string) CertificatesClient { + return NewCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCertificatesClientWithBaseURI creates an instance of the CertificatesClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewCertificatesClientWithBaseURI(baseURI string, subscriptionID string) CertificatesClient { + return CertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate description for Create or update a certificate. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the certificate. +// certificateEnvelope - details of certificate, if it exists already. +func (client CertificatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, certificateEnvelope Certificate) (result Certificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.CertificatesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, certificateEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CertificatesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, certificateEnvelope Certificate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}", pathParameters), + autorest.WithJSON(certificateEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete description for Delete a certificate. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the certificate. +func (client CertificatesClient) Delete(ctx context.Context, resourceGroupName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.CertificatesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CertificatesClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get description for Get a certificate. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the certificate. +func (client CertificatesClient) Get(ctx context.Context, resourceGroupName string, name string) (result Certificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.CertificatesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CertificatesClient) GetPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CertificatesClient) GetResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List description for Get all certificates for a subscription. +// Parameters: +// filter - return only information specified in the filter (using OData syntax). For example: +// $filter=KeyVaultId eq 'KeyVaultId' +func (client CertificatesClient) List(ctx context.Context, filter string) (result CertificateCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.List") + defer func() { + sc := -1 + if result.cc.Response.Response != nil { + sc = result.cc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.cc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "List", resp, "Failure sending request") + return + } + + result.cc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "List", resp, "Failure responding to request") + return + } + if result.cc.hasNextLink() && result.cc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client CertificatesClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client CertificatesClient) ListResponder(resp *http.Response) (result CertificateCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client CertificatesClient) listNextResults(ctx context.Context, lastResults CertificateCollection) (result CertificateCollection, err error) { + req, err := lastResults.certificateCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client CertificatesClient) ListComplete(ctx context.Context, filter string) (result CertificateCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, filter) + return +} + +// ListByResourceGroup description for Get all certificates in a resource group. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +func (client CertificatesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result CertificateCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.cc.Response.Response != nil { + sc = result.cc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.CertificatesClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.cc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.cc, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.cc.hasNextLink() && result.cc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client CertificatesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client CertificatesClient) ListByResourceGroupResponder(resp *http.Response) (result CertificateCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client CertificatesClient) listByResourceGroupNextResults(ctx context.Context, lastResults CertificateCollection) (result CertificateCollection, err error) { + req, err := lastResults.certificateCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client CertificatesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result CertificateCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Update description for Create or update a certificate. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the certificate. +// certificateEnvelope - details of certificate, if it exists already. +func (client CertificatesClient) Update(ctx context.Context, resourceGroupName string, name string, certificateEnvelope CertificatePatchResource) (result Certificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.CertificatesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, name, certificateEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client CertificatesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, certificateEnvelope CertificatePatchResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}", pathParameters), + autorest.WithJSON(certificateEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client CertificatesClient) UpdateResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/client.go new file mode 100644 index 000000000000..76dabba5da8d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/client.go @@ -0,0 +1,1624 @@ +// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appservice/armappservice](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appservice/armappservice). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. +// +// Package web implements the Azure ARM Web service API version 2021-03-01. +// +// WebSite Management Client +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +const ( + // DefaultBaseURI is the default URI used for the service Web + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Web. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} + +// CheckNameAvailability description for Check if a resource name is available. +// Parameters: +// request - name availability request. +func (client BaseClient) CheckNameAvailability(ctx context.Context, request ResourceNameAvailabilityRequest) (result ResourceNameAvailability, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.BaseClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, request) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BaseClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client BaseClient) CheckNameAvailabilityPreparer(ctx context.Context, request ResourceNameAvailabilityRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client BaseClient) CheckNameAvailabilityResponder(resp *http.Response) (result ResourceNameAvailability, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPublishingUser description for Gets publishing user +func (client BaseClient) GetPublishingUser(ctx context.Context) (result User, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetPublishingUser") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPublishingUserPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "GetPublishingUser", nil, "Failure preparing request") + return + } + + resp, err := client.GetPublishingUserSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BaseClient", "GetPublishingUser", resp, "Failure sending request") + return + } + + result, err = client.GetPublishingUserResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "GetPublishingUser", resp, "Failure responding to request") + return + } + + return +} + +// GetPublishingUserPreparer prepares the GetPublishingUser request. +func (client BaseClient) GetPublishingUserPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Web/publishingUsers/web"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPublishingUserSender sends the GetPublishingUser request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetPublishingUserSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetPublishingUserResponder handles the response to the GetPublishingUser request. The method always +// closes the http.Response Body. +func (client BaseClient) GetPublishingUserResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSourceControl description for Gets source control token +// Parameters: +// sourceControlType - type of source control +func (client BaseClient) GetSourceControl(ctx context.Context, sourceControlType string) (result SourceControl, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSourceControl") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetSourceControlPreparer(ctx, sourceControlType) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "GetSourceControl", nil, "Failure preparing request") + return + } + + resp, err := client.GetSourceControlSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BaseClient", "GetSourceControl", resp, "Failure sending request") + return + } + + result, err = client.GetSourceControlResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "GetSourceControl", resp, "Failure responding to request") + return + } + + return +} + +// GetSourceControlPreparer prepares the GetSourceControl request. +func (client BaseClient) GetSourceControlPreparer(ctx context.Context, sourceControlType string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "sourceControlType": autorest.Encode("path", sourceControlType), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Web/sourcecontrols/{sourceControlType}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSourceControlSender sends the GetSourceControl request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetSourceControlSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetSourceControlResponder handles the response to the GetSourceControl request. The method always +// closes the http.Response Body. +func (client BaseClient) GetSourceControlResponder(resp *http.Response) (result SourceControl, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSubscriptionDeploymentLocations description for Gets list of available geo regions plus ministamps +func (client BaseClient) GetSubscriptionDeploymentLocations(ctx context.Context) (result DeploymentLocations, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetSubscriptionDeploymentLocations") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetSubscriptionDeploymentLocationsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "GetSubscriptionDeploymentLocations", nil, "Failure preparing request") + return + } + + resp, err := client.GetSubscriptionDeploymentLocationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BaseClient", "GetSubscriptionDeploymentLocations", resp, "Failure sending request") + return + } + + result, err = client.GetSubscriptionDeploymentLocationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "GetSubscriptionDeploymentLocations", resp, "Failure responding to request") + return + } + + return +} + +// GetSubscriptionDeploymentLocationsPreparer prepares the GetSubscriptionDeploymentLocations request. +func (client BaseClient) GetSubscriptionDeploymentLocationsPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/deploymentLocations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSubscriptionDeploymentLocationsSender sends the GetSubscriptionDeploymentLocations request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetSubscriptionDeploymentLocationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSubscriptionDeploymentLocationsResponder handles the response to the GetSubscriptionDeploymentLocations request. The method always +// closes the http.Response Body. +func (client BaseClient) GetSubscriptionDeploymentLocationsResponder(resp *http.Response) (result DeploymentLocations, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBillingMeters description for Gets a list of meters for a given location. +// Parameters: +// billingLocation - azure Location of billable resource +// osType - app Service OS type meters used for +func (client BaseClient) ListBillingMeters(ctx context.Context, billingLocation string, osType string) (result BillingMeterCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListBillingMeters") + defer func() { + sc := -1 + if result.bmc.Response.Response != nil { + sc = result.bmc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBillingMetersNextResults + req, err := client.ListBillingMetersPreparer(ctx, billingLocation, osType) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListBillingMeters", nil, "Failure preparing request") + return + } + + resp, err := client.ListBillingMetersSender(req) + if err != nil { + result.bmc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListBillingMeters", resp, "Failure sending request") + return + } + + result.bmc, err = client.ListBillingMetersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListBillingMeters", resp, "Failure responding to request") + return + } + if result.bmc.hasNextLink() && result.bmc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBillingMetersPreparer prepares the ListBillingMeters request. +func (client BaseClient) ListBillingMetersPreparer(ctx context.Context, billingLocation string, osType string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(billingLocation) > 0 { + queryParameters["billingLocation"] = autorest.Encode("query", billingLocation) + } + if len(osType) > 0 { + queryParameters["osType"] = autorest.Encode("query", osType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBillingMetersSender sends the ListBillingMeters request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ListBillingMetersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBillingMetersResponder handles the response to the ListBillingMeters request. The method always +// closes the http.Response Body. +func (client BaseClient) ListBillingMetersResponder(resp *http.Response) (result BillingMeterCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBillingMetersNextResults retrieves the next set of results, if any. +func (client BaseClient) listBillingMetersNextResults(ctx context.Context, lastResults BillingMeterCollection) (result BillingMeterCollection, err error) { + req, err := lastResults.billingMeterCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.BaseClient", "listBillingMetersNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBillingMetersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.BaseClient", "listBillingMetersNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBillingMetersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "listBillingMetersNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBillingMetersComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) ListBillingMetersComplete(ctx context.Context, billingLocation string, osType string) (result BillingMeterCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListBillingMeters") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBillingMeters(ctx, billingLocation, osType) + return +} + +// ListCustomHostNameSites sends the list custom host name sites request. +func (client BaseClient) ListCustomHostNameSites(ctx context.Context) (result CustomHostnameSitesCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListCustomHostNameSites") + defer func() { + sc := -1 + if result.chsc.Response.Response != nil { + sc = result.chsc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listCustomHostNameSitesNextResults + req, err := client.ListCustomHostNameSitesPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListCustomHostNameSites", nil, "Failure preparing request") + return + } + + resp, err := client.ListCustomHostNameSitesSender(req) + if err != nil { + result.chsc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListCustomHostNameSites", resp, "Failure sending request") + return + } + + result.chsc, err = client.ListCustomHostNameSitesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListCustomHostNameSites", resp, "Failure responding to request") + return + } + if result.chsc.hasNextLink() && result.chsc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListCustomHostNameSitesPreparer prepares the ListCustomHostNameSites request. +func (client BaseClient) ListCustomHostNameSitesPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/customhostnameSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCustomHostNameSitesSender sends the ListCustomHostNameSites request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ListCustomHostNameSitesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListCustomHostNameSitesResponder handles the response to the ListCustomHostNameSites request. The method always +// closes the http.Response Body. +func (client BaseClient) ListCustomHostNameSitesResponder(resp *http.Response) (result CustomHostnameSitesCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listCustomHostNameSitesNextResults retrieves the next set of results, if any. +func (client BaseClient) listCustomHostNameSitesNextResults(ctx context.Context, lastResults CustomHostnameSitesCollection) (result CustomHostnameSitesCollection, err error) { + req, err := lastResults.customHostnameSitesCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.BaseClient", "listCustomHostNameSitesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListCustomHostNameSitesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.BaseClient", "listCustomHostNameSitesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListCustomHostNameSitesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "listCustomHostNameSitesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListCustomHostNameSitesComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) ListCustomHostNameSitesComplete(ctx context.Context) (result CustomHostnameSitesCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListCustomHostNameSites") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListCustomHostNameSites(ctx) + return +} + +// ListGeoRegions description for Get a list of available geographical regions. +// Parameters: +// sku - name of SKU used to filter the regions. +// linuxWorkersEnabled - specify true if you want to filter to only regions that support Linux +// workers. +// xenonWorkersEnabled - specify true if you want to filter to only regions that support Xenon +// workers. +// linuxDynamicWorkersEnabled - specify true if you want to filter to only regions that support +// Linux Consumption Workers. +func (client BaseClient) ListGeoRegions(ctx context.Context, sku SkuName, linuxWorkersEnabled *bool, xenonWorkersEnabled *bool, linuxDynamicWorkersEnabled *bool) (result GeoRegionCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListGeoRegions") + defer func() { + sc := -1 + if result.grc.Response.Response != nil { + sc = result.grc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listGeoRegionsNextResults + req, err := client.ListGeoRegionsPreparer(ctx, sku, linuxWorkersEnabled, xenonWorkersEnabled, linuxDynamicWorkersEnabled) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListGeoRegions", nil, "Failure preparing request") + return + } + + resp, err := client.ListGeoRegionsSender(req) + if err != nil { + result.grc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListGeoRegions", resp, "Failure sending request") + return + } + + result.grc, err = client.ListGeoRegionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListGeoRegions", resp, "Failure responding to request") + return + } + if result.grc.hasNextLink() && result.grc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListGeoRegionsPreparer prepares the ListGeoRegions request. +func (client BaseClient) ListGeoRegionsPreparer(ctx context.Context, sku SkuName, linuxWorkersEnabled *bool, xenonWorkersEnabled *bool, linuxDynamicWorkersEnabled *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(sku)) > 0 { + queryParameters["sku"] = autorest.Encode("query", sku) + } + if linuxWorkersEnabled != nil { + queryParameters["linuxWorkersEnabled"] = autorest.Encode("query", *linuxWorkersEnabled) + } + if xenonWorkersEnabled != nil { + queryParameters["xenonWorkersEnabled"] = autorest.Encode("query", *xenonWorkersEnabled) + } + if linuxDynamicWorkersEnabled != nil { + queryParameters["linuxDynamicWorkersEnabled"] = autorest.Encode("query", *linuxDynamicWorkersEnabled) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListGeoRegionsSender sends the ListGeoRegions request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ListGeoRegionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListGeoRegionsResponder handles the response to the ListGeoRegions request. The method always +// closes the http.Response Body. +func (client BaseClient) ListGeoRegionsResponder(resp *http.Response) (result GeoRegionCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listGeoRegionsNextResults retrieves the next set of results, if any. +func (client BaseClient) listGeoRegionsNextResults(ctx context.Context, lastResults GeoRegionCollection) (result GeoRegionCollection, err error) { + req, err := lastResults.geoRegionCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.BaseClient", "listGeoRegionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListGeoRegionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.BaseClient", "listGeoRegionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListGeoRegionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "listGeoRegionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListGeoRegionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) ListGeoRegionsComplete(ctx context.Context, sku SkuName, linuxWorkersEnabled *bool, xenonWorkersEnabled *bool, linuxDynamicWorkersEnabled *bool) (result GeoRegionCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListGeoRegions") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListGeoRegions(ctx, sku, linuxWorkersEnabled, xenonWorkersEnabled, linuxDynamicWorkersEnabled) + return +} + +// ListPremierAddOnOffers description for List all premier add-on offers. +func (client BaseClient) ListPremierAddOnOffers(ctx context.Context) (result PremierAddOnOfferCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListPremierAddOnOffers") + defer func() { + sc := -1 + if result.paooc.Response.Response != nil { + sc = result.paooc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listPremierAddOnOffersNextResults + req, err := client.ListPremierAddOnOffersPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListPremierAddOnOffers", nil, "Failure preparing request") + return + } + + resp, err := client.ListPremierAddOnOffersSender(req) + if err != nil { + result.paooc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListPremierAddOnOffers", resp, "Failure sending request") + return + } + + result.paooc, err = client.ListPremierAddOnOffersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListPremierAddOnOffers", resp, "Failure responding to request") + return + } + if result.paooc.hasNextLink() && result.paooc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPremierAddOnOffersPreparer prepares the ListPremierAddOnOffers request. +func (client BaseClient) ListPremierAddOnOffersPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPremierAddOnOffersSender sends the ListPremierAddOnOffers request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ListPremierAddOnOffersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListPremierAddOnOffersResponder handles the response to the ListPremierAddOnOffers request. The method always +// closes the http.Response Body. +func (client BaseClient) ListPremierAddOnOffersResponder(resp *http.Response) (result PremierAddOnOfferCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listPremierAddOnOffersNextResults retrieves the next set of results, if any. +func (client BaseClient) listPremierAddOnOffersNextResults(ctx context.Context, lastResults PremierAddOnOfferCollection) (result PremierAddOnOfferCollection, err error) { + req, err := lastResults.premierAddOnOfferCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.BaseClient", "listPremierAddOnOffersNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListPremierAddOnOffersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.BaseClient", "listPremierAddOnOffersNextResults", resp, "Failure sending next results request") + } + result, err = client.ListPremierAddOnOffersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "listPremierAddOnOffersNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListPremierAddOnOffersComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) ListPremierAddOnOffersComplete(ctx context.Context) (result PremierAddOnOfferCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListPremierAddOnOffers") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListPremierAddOnOffers(ctx) + return +} + +// ListSiteIdentifiersAssignedToHostName description for List all apps that are assigned to a hostname. +// Parameters: +// nameIdentifier - hostname information. +func (client BaseClient) ListSiteIdentifiersAssignedToHostName(ctx context.Context, nameIdentifier NameIdentifier) (result IdentifierCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListSiteIdentifiersAssignedToHostName") + defer func() { + sc := -1 + if result.ic.Response.Response != nil { + sc = result.ic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listSiteIdentifiersAssignedToHostNameNextResults + req, err := client.ListSiteIdentifiersAssignedToHostNamePreparer(ctx, nameIdentifier) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListSiteIdentifiersAssignedToHostName", nil, "Failure preparing request") + return + } + + resp, err := client.ListSiteIdentifiersAssignedToHostNameSender(req) + if err != nil { + result.ic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListSiteIdentifiersAssignedToHostName", resp, "Failure sending request") + return + } + + result.ic, err = client.ListSiteIdentifiersAssignedToHostNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListSiteIdentifiersAssignedToHostName", resp, "Failure responding to request") + return + } + if result.ic.hasNextLink() && result.ic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSiteIdentifiersAssignedToHostNamePreparer prepares the ListSiteIdentifiersAssignedToHostName request. +func (client BaseClient) ListSiteIdentifiersAssignedToHostNamePreparer(ctx context.Context, nameIdentifier NameIdentifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/listSitesAssignedToHostName", pathParameters), + autorest.WithJSON(nameIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSiteIdentifiersAssignedToHostNameSender sends the ListSiteIdentifiersAssignedToHostName request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ListSiteIdentifiersAssignedToHostNameSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSiteIdentifiersAssignedToHostNameResponder handles the response to the ListSiteIdentifiersAssignedToHostName request. The method always +// closes the http.Response Body. +func (client BaseClient) ListSiteIdentifiersAssignedToHostNameResponder(resp *http.Response) (result IdentifierCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSiteIdentifiersAssignedToHostNameNextResults retrieves the next set of results, if any. +func (client BaseClient) listSiteIdentifiersAssignedToHostNameNextResults(ctx context.Context, lastResults IdentifierCollection) (result IdentifierCollection, err error) { + req, err := lastResults.identifierCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.BaseClient", "listSiteIdentifiersAssignedToHostNameNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSiteIdentifiersAssignedToHostNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.BaseClient", "listSiteIdentifiersAssignedToHostNameNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSiteIdentifiersAssignedToHostNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "listSiteIdentifiersAssignedToHostNameNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSiteIdentifiersAssignedToHostNameComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) ListSiteIdentifiersAssignedToHostNameComplete(ctx context.Context, nameIdentifier NameIdentifier) (result IdentifierCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListSiteIdentifiersAssignedToHostName") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSiteIdentifiersAssignedToHostName(ctx, nameIdentifier) + return +} + +// ListSkus description for List all SKUs. +func (client BaseClient) ListSkus(ctx context.Context) (result SkuInfos, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListSkus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSkusPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListSkus", resp, "Failure sending request") + return + } + + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListSkus", resp, "Failure responding to request") + return + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client BaseClient) ListSkusPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSkusSender sends the ListSkus request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ListSkusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSkusResponder handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (client BaseClient) ListSkusResponder(resp *http.Response) (result SkuInfos, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSourceControls description for Gets the source controls available for Azure websites. +func (client BaseClient) ListSourceControls(ctx context.Context) (result SourceControlCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListSourceControls") + defer func() { + sc := -1 + if result.scc.Response.Response != nil { + sc = result.scc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listSourceControlsNextResults + req, err := client.ListSourceControlsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListSourceControls", nil, "Failure preparing request") + return + } + + resp, err := client.ListSourceControlsSender(req) + if err != nil { + result.scc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListSourceControls", resp, "Failure sending request") + return + } + + result.scc, err = client.ListSourceControlsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ListSourceControls", resp, "Failure responding to request") + return + } + if result.scc.hasNextLink() && result.scc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSourceControlsPreparer prepares the ListSourceControls request. +func (client BaseClient) ListSourceControlsPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Web/sourcecontrols"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSourceControlsSender sends the ListSourceControls request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ListSourceControlsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListSourceControlsResponder handles the response to the ListSourceControls request. The method always +// closes the http.Response Body. +func (client BaseClient) ListSourceControlsResponder(resp *http.Response) (result SourceControlCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSourceControlsNextResults retrieves the next set of results, if any. +func (client BaseClient) listSourceControlsNextResults(ctx context.Context, lastResults SourceControlCollection) (result SourceControlCollection, err error) { + req, err := lastResults.sourceControlCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.BaseClient", "listSourceControlsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSourceControlsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.BaseClient", "listSourceControlsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSourceControlsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "listSourceControlsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSourceControlsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) ListSourceControlsComplete(ctx context.Context) (result SourceControlCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListSourceControls") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSourceControls(ctx) + return +} + +// Move description for Move resources between resource groups. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// moveResourceEnvelope - object that represents the resource to move. +func (client BaseClient) Move(ctx context.Context, resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.Move") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: moveResourceEnvelope, + Constraints: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Pattern, Rule: ` ^[-\w\._\(\)]+[^\.]$`, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("web.BaseClient", "Move", err.Error()) + } + + req, err := client.MovePreparer(ctx, resourceGroupName, moveResourceEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "Move", nil, "Failure preparing request") + return + } + + resp, err := client.MoveSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.BaseClient", "Move", resp, "Failure sending request") + return + } + + result, err = client.MoveResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "Move", resp, "Failure responding to request") + return + } + + return +} + +// MovePreparer prepares the Move request. +func (client BaseClient) MovePreparer(ctx context.Context, resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources", pathParameters), + autorest.WithJSON(moveResourceEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// MoveSender sends the Move request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) MoveSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// MoveResponder handles the response to the Move request. The method always +// closes the http.Response Body. +func (client BaseClient) MoveResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdatePublishingUser description for Updates publishing user +// Parameters: +// userDetails - details of publishing user +func (client BaseClient) UpdatePublishingUser(ctx context.Context, userDetails User) (result User, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdatePublishingUser") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: userDetails, + Constraints: []validation.Constraint{{Target: "userDetails.UserProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "userDetails.UserProperties.PublishingUserName", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.BaseClient", "UpdatePublishingUser", err.Error()) + } + + req, err := client.UpdatePublishingUserPreparer(ctx, userDetails) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "UpdatePublishingUser", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePublishingUserSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BaseClient", "UpdatePublishingUser", resp, "Failure sending request") + return + } + + result, err = client.UpdatePublishingUserResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "UpdatePublishingUser", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePublishingUserPreparer prepares the UpdatePublishingUser request. +func (client BaseClient) UpdatePublishingUserPreparer(ctx context.Context, userDetails User) (*http.Request, error) { + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Web/publishingUsers/web"), + autorest.WithJSON(userDetails), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePublishingUserSender sends the UpdatePublishingUser request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) UpdatePublishingUserSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdatePublishingUserResponder handles the response to the UpdatePublishingUser request. The method always +// closes the http.Response Body. +func (client BaseClient) UpdatePublishingUserResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSourceControl description for Updates source control token +// Parameters: +// sourceControlType - type of source control +// requestMessage - source control token information +func (client BaseClient) UpdateSourceControl(ctx context.Context, sourceControlType string, requestMessage SourceControl) (result SourceControl, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateSourceControl") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateSourceControlPreparer(ctx, sourceControlType, requestMessage) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "UpdateSourceControl", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSourceControlSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BaseClient", "UpdateSourceControl", resp, "Failure sending request") + return + } + + result, err = client.UpdateSourceControlResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "UpdateSourceControl", resp, "Failure responding to request") + return + } + + return +} + +// UpdateSourceControlPreparer prepares the UpdateSourceControl request. +func (client BaseClient) UpdateSourceControlPreparer(ctx context.Context, sourceControlType string, requestMessage SourceControl) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "sourceControlType": autorest.Encode("path", sourceControlType), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Web/sourcecontrols/{sourceControlType}", pathParameters), + autorest.WithJSON(requestMessage), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSourceControlSender sends the UpdateSourceControl request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) UpdateSourceControlSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateSourceControlResponder handles the response to the UpdateSourceControl request. The method always +// closes the http.Response Body. +func (client BaseClient) UpdateSourceControlResponder(resp *http.Response) (result SourceControl, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Validate description for Validate if a resource can be created. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// validateRequest - request with the resources to validate. +func (client BaseClient) Validate(ctx context.Context, resourceGroupName string, validateRequest ValidateRequest) (result ValidateResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.Validate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: validateRequest, + Constraints: []validation.Constraint{{Target: "validateRequest.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "validateRequest.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "validateRequest.ValidateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "validateRequest.ValidateProperties.Capacity", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "validateRequest.ValidateProperties.Capacity", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}, + {Target: "validateRequest.ValidateProperties.AppServiceEnvironment", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "validateRequest.ValidateProperties.AppServiceEnvironment.VirtualNetwork", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "validateRequest.ValidateProperties.AppServiceEnvironment.VirtualNetwork.ID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("web.BaseClient", "Validate", err.Error()) + } + + req, err := client.ValidatePreparer(ctx, resourceGroupName, validateRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "Validate", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BaseClient", "Validate", resp, "Failure sending request") + return + } + + result, err = client.ValidateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "Validate", resp, "Failure responding to request") + return + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client BaseClient) ValidatePreparer(ctx context.Context, resourceGroupName string, validateRequest ValidateRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate", pathParameters), + autorest.WithJSON(validateRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ValidateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client BaseClient) ValidateResponder(resp *http.Response) (result ValidateResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateMove description for Validate whether a resource can be moved. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// moveResourceEnvelope - object that represents the resource to move. +func (client BaseClient) ValidateMove(ctx context.Context, resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ValidateMove") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: moveResourceEnvelope, + Constraints: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Pattern, Rule: ` ^[-\w\._\(\)]+[^\.]$`, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("web.BaseClient", "ValidateMove", err.Error()) + } + + req, err := client.ValidateMovePreparer(ctx, resourceGroupName, moveResourceEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ValidateMove", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateMoveSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.BaseClient", "ValidateMove", resp, "Failure sending request") + return + } + + result, err = client.ValidateMoveResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "ValidateMove", resp, "Failure responding to request") + return + } + + return +} + +// ValidateMovePreparer prepares the ValidateMove request. +func (client BaseClient) ValidateMovePreparer(ctx context.Context, resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/validateMoveResources", pathParameters), + autorest.WithJSON(moveResourceEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateMoveSender sends the ValidateMove request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ValidateMoveSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateMoveResponder handles the response to the ValidateMove request. The method always +// closes the http.Response Body. +func (client BaseClient) ValidateMoveResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// VerifyHostingEnvironmentVnet description for Verifies if this VNET is compatible with an App Service Environment by +// analyzing the Network Security Group rules. +// Parameters: +// parameters - VNET information +func (client BaseClient) VerifyHostingEnvironmentVnet(ctx context.Context, parameters VnetParameters) (result VnetValidationFailureDetails, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.VerifyHostingEnvironmentVnet") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.VerifyHostingEnvironmentVnetPreparer(ctx, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "VerifyHostingEnvironmentVnet", nil, "Failure preparing request") + return + } + + resp, err := client.VerifyHostingEnvironmentVnetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.BaseClient", "VerifyHostingEnvironmentVnet", resp, "Failure sending request") + return + } + + result, err = client.VerifyHostingEnvironmentVnetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.BaseClient", "VerifyHostingEnvironmentVnet", resp, "Failure responding to request") + return + } + + return +} + +// VerifyHostingEnvironmentVnetPreparer prepares the VerifyHostingEnvironmentVnet request. +func (client BaseClient) VerifyHostingEnvironmentVnetPreparer(ctx context.Context, parameters VnetParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/verifyHostingEnvironmentVnet", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// VerifyHostingEnvironmentVnetSender sends the VerifyHostingEnvironmentVnet request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) VerifyHostingEnvironmentVnetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// VerifyHostingEnvironmentVnetResponder handles the response to the VerifyHostingEnvironmentVnet request. The method always +// closes the http.Response Body. +func (client BaseClient) VerifyHostingEnvironmentVnetResponder(resp *http.Response) (result VnetValidationFailureDetails, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/containerapps.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/containerapps.go new file mode 100644 index 000000000000..6c999ce689be --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/containerapps.go @@ -0,0 +1,602 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ContainerAppsClient is the webSite Management Client +type ContainerAppsClient struct { + BaseClient +} + +// NewContainerAppsClient creates an instance of the ContainerAppsClient client. +func NewContainerAppsClient(subscriptionID string) ContainerAppsClient { + return NewContainerAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewContainerAppsClientWithBaseURI creates an instance of the ContainerAppsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewContainerAppsClientWithBaseURI(baseURI string, subscriptionID string) ContainerAppsClient { + return ContainerAppsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate description for Create or update a Container App. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the Container App. +func (client ContainerAppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, containerAppEnvelope ContainerApp) (result ContainerAppsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.ContainerAppsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, containerAppEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ContainerAppsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, containerAppEnvelope ContainerApp) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name}", pathParameters), + autorest.WithJSON(containerAppEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerAppsClient) CreateOrUpdateSender(req *http.Request) (future ContainerAppsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ContainerAppsClient) CreateOrUpdateResponder(resp *http.Response) (result ContainerApp, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete description for Delete a Container App. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the Container App. +func (client ContainerAppsClient) Delete(ctx context.Context, resourceGroupName string, name string) (result ContainerAppsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.ContainerAppsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ContainerAppsClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerAppsClient) DeleteSender(req *http.Request) (future ContainerAppsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ContainerAppsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the Container App. +func (client ContainerAppsClient) Get(ctx context.Context, resourceGroupName string, name string) (result ContainerApp, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.ContainerAppsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ContainerAppsClient) GetPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerAppsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ContainerAppsClient) GetResponder(resp *http.Response) (result ContainerApp, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup sends the list by resource group request. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +func (client ContainerAppsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ContainerAppCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.cac.Response.Response != nil { + sc = result.cac.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.ContainerAppsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.cac.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.cac, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.cac.hasNextLink() && result.cac.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ContainerAppsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerAppsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ContainerAppsClient) ListByResourceGroupResponder(resp *http.Response) (result ContainerAppCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ContainerAppsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ContainerAppCollection) (result ContainerAppCollection, err error) { + req, err := lastResults.containerAppCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ContainerAppsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ContainerAppsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ContainerAppsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ContainerAppCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscription sends the list by subscription request. +func (client ContainerAppsClient) ListBySubscription(ctx context.Context) (result ContainerAppCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppsClient.ListBySubscription") + defer func() { + sc := -1 + if result.cac.Response.Response != nil { + sc = result.cac.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.cac.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.cac, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.cac.hasNextLink() && result.cac.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client ContainerAppsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/containerApps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerAppsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client ContainerAppsClient) ListBySubscriptionResponder(resp *http.Response) (result ContainerAppCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client ContainerAppsClient) listBySubscriptionNextResults(ctx context.Context, lastResults ContainerAppCollection) (result ContainerAppCollection, err error) { + req, err := lastResults.containerAppCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ContainerAppsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ContainerAppsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client ContainerAppsClient) ListBySubscriptionComplete(ctx context.Context) (result ContainerAppCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppsClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// ListSecrets sends the list secrets request. +// Parameters: +// name - name of the Container App. +func (client ContainerAppsClient) ListSecrets(ctx context.Context, name string) (result SecretsCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppsClient.ListSecrets") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSecretsPreparer(ctx, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "ListSecrets", nil, "Failure preparing request") + return + } + + resp, err := client.ListSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "ListSecrets", resp, "Failure sending request") + return + } + + result, err = client.ListSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsClient", "ListSecrets", resp, "Failure responding to request") + return + } + + return +} + +// ListSecretsPreparer prepares the ListSecrets request. +func (client ContainerAppsClient) ListSecretsPreparer(ctx context.Context, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/containerApps/{name}/listSecrets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSecretsSender sends the ListSecrets request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerAppsClient) ListSecretsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSecretsResponder handles the response to the ListSecrets request. The method always +// closes the http.Response Body. +func (client ContainerAppsClient) ListSecretsResponder(resp *http.Response) (result SecretsCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/containerappsrevisions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/containerappsrevisions.go new file mode 100644 index 000000000000..e12a386c7b64 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/containerappsrevisions.go @@ -0,0 +1,500 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ContainerAppsRevisionsClient is the webSite Management Client +type ContainerAppsRevisionsClient struct { + BaseClient +} + +// NewContainerAppsRevisionsClient creates an instance of the ContainerAppsRevisionsClient client. +func NewContainerAppsRevisionsClient(subscriptionID string) ContainerAppsRevisionsClient { + return NewContainerAppsRevisionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewContainerAppsRevisionsClientWithBaseURI creates an instance of the ContainerAppsRevisionsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewContainerAppsRevisionsClientWithBaseURI(baseURI string, subscriptionID string) ContainerAppsRevisionsClient { + return ContainerAppsRevisionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ActivateRevision sends the activate revision request. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// containerAppName - name of the Container App. +// name - name of the Container App Revision to activate +func (client ContainerAppsRevisionsClient) ActivateRevision(ctx context.Context, resourceGroupName string, containerAppName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppsRevisionsClient.ActivateRevision") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.ContainerAppsRevisionsClient", "ActivateRevision", err.Error()) + } + + req, err := client.ActivateRevisionPreparer(ctx, resourceGroupName, containerAppName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "ActivateRevision", nil, "Failure preparing request") + return + } + + resp, err := client.ActivateRevisionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "ActivateRevision", resp, "Failure sending request") + return + } + + result, err = client.ActivateRevisionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "ActivateRevision", resp, "Failure responding to request") + return + } + + return +} + +// ActivateRevisionPreparer prepares the ActivateRevision request. +func (client ContainerAppsRevisionsClient) ActivateRevisionPreparer(ctx context.Context, resourceGroupName string, containerAppName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerAppName": autorest.Encode("path", containerAppName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{containerAppName}/revisions/{name}/activate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ActivateRevisionSender sends the ActivateRevision request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerAppsRevisionsClient) ActivateRevisionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ActivateRevisionResponder handles the response to the ActivateRevision request. The method always +// closes the http.Response Body. +func (client ContainerAppsRevisionsClient) ActivateRevisionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeactivateRevision sends the deactivate revision request. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// containerAppName - name of the Container App. +// name - name of the Container App Revision to deactivate +func (client ContainerAppsRevisionsClient) DeactivateRevision(ctx context.Context, resourceGroupName string, containerAppName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppsRevisionsClient.DeactivateRevision") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.ContainerAppsRevisionsClient", "DeactivateRevision", err.Error()) + } + + req, err := client.DeactivateRevisionPreparer(ctx, resourceGroupName, containerAppName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "DeactivateRevision", nil, "Failure preparing request") + return + } + + resp, err := client.DeactivateRevisionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "DeactivateRevision", resp, "Failure sending request") + return + } + + result, err = client.DeactivateRevisionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "DeactivateRevision", resp, "Failure responding to request") + return + } + + return +} + +// DeactivateRevisionPreparer prepares the DeactivateRevision request. +func (client ContainerAppsRevisionsClient) DeactivateRevisionPreparer(ctx context.Context, resourceGroupName string, containerAppName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerAppName": autorest.Encode("path", containerAppName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{containerAppName}/revisions/{name}/deactivate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeactivateRevisionSender sends the DeactivateRevision request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerAppsRevisionsClient) DeactivateRevisionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeactivateRevisionResponder handles the response to the DeactivateRevision request. The method always +// closes the http.Response Body. +func (client ContainerAppsRevisionsClient) DeactivateRevisionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetRevision sends the get revision request. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// containerAppName - name of the Container App. +// name - name of the Container App Revision. +func (client ContainerAppsRevisionsClient) GetRevision(ctx context.Context, resourceGroupName string, containerAppName string, name string) (result Revision, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppsRevisionsClient.GetRevision") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.ContainerAppsRevisionsClient", "GetRevision", err.Error()) + } + + req, err := client.GetRevisionPreparer(ctx, resourceGroupName, containerAppName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "GetRevision", nil, "Failure preparing request") + return + } + + resp, err := client.GetRevisionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "GetRevision", resp, "Failure sending request") + return + } + + result, err = client.GetRevisionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "GetRevision", resp, "Failure responding to request") + return + } + + return +} + +// GetRevisionPreparer prepares the GetRevision request. +func (client ContainerAppsRevisionsClient) GetRevisionPreparer(ctx context.Context, resourceGroupName string, containerAppName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerAppName": autorest.Encode("path", containerAppName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{containerAppName}/revisions/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetRevisionSender sends the GetRevision request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerAppsRevisionsClient) GetRevisionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetRevisionResponder handles the response to the GetRevision request. The method always +// closes the http.Response Body. +func (client ContainerAppsRevisionsClient) GetRevisionResponder(resp *http.Response) (result Revision, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRevisions sends the list revisions request. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// containerAppName - name of the Container App for which Revisions are needed. +func (client ContainerAppsRevisionsClient) ListRevisions(ctx context.Context, resourceGroupName string, containerAppName string) (result RevisionCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppsRevisionsClient.ListRevisions") + defer func() { + sc := -1 + if result.rc.Response.Response != nil { + sc = result.rc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.ContainerAppsRevisionsClient", "ListRevisions", err.Error()) + } + + result.fn = client.listRevisionsNextResults + req, err := client.ListRevisionsPreparer(ctx, resourceGroupName, containerAppName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "ListRevisions", nil, "Failure preparing request") + return + } + + resp, err := client.ListRevisionsSender(req) + if err != nil { + result.rc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "ListRevisions", resp, "Failure sending request") + return + } + + result.rc, err = client.ListRevisionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "ListRevisions", resp, "Failure responding to request") + return + } + if result.rc.hasNextLink() && result.rc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListRevisionsPreparer prepares the ListRevisions request. +func (client ContainerAppsRevisionsClient) ListRevisionsPreparer(ctx context.Context, resourceGroupName string, containerAppName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerAppName": autorest.Encode("path", containerAppName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{containerAppName}/revisions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRevisionsSender sends the ListRevisions request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerAppsRevisionsClient) ListRevisionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListRevisionsResponder handles the response to the ListRevisions request. The method always +// closes the http.Response Body. +func (client ContainerAppsRevisionsClient) ListRevisionsResponder(resp *http.Response) (result RevisionCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listRevisionsNextResults retrieves the next set of results, if any. +func (client ContainerAppsRevisionsClient) listRevisionsNextResults(ctx context.Context, lastResults RevisionCollection) (result RevisionCollection, err error) { + req, err := lastResults.revisionCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "listRevisionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListRevisionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "listRevisionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListRevisionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "listRevisionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListRevisionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client ContainerAppsRevisionsClient) ListRevisionsComplete(ctx context.Context, resourceGroupName string, containerAppName string) (result RevisionCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppsRevisionsClient.ListRevisions") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListRevisions(ctx, resourceGroupName, containerAppName) + return +} + +// RestartRevision sends the restart revision request. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// containerAppName - name of the Container App. +// name - name of the Container App Revision to restart +func (client ContainerAppsRevisionsClient) RestartRevision(ctx context.Context, resourceGroupName string, containerAppName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppsRevisionsClient.RestartRevision") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.ContainerAppsRevisionsClient", "RestartRevision", err.Error()) + } + + req, err := client.RestartRevisionPreparer(ctx, resourceGroupName, containerAppName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "RestartRevision", nil, "Failure preparing request") + return + } + + resp, err := client.RestartRevisionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "RestartRevision", resp, "Failure sending request") + return + } + + result, err = client.RestartRevisionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsRevisionsClient", "RestartRevision", resp, "Failure responding to request") + return + } + + return +} + +// RestartRevisionPreparer prepares the RestartRevision request. +func (client ContainerAppsRevisionsClient) RestartRevisionPreparer(ctx context.Context, resourceGroupName string, containerAppName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerAppName": autorest.Encode("path", containerAppName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{containerAppName}/revisions/{name}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestartRevisionSender sends the RestartRevision request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerAppsRevisionsClient) RestartRevisionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RestartRevisionResponder handles the response to the RestartRevision request. The method always +// closes the http.Response Body. +func (client ContainerAppsRevisionsClient) RestartRevisionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/deletedwebapps.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/deletedwebapps.go new file mode 100644 index 000000000000..8bd440611dba --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/deletedwebapps.go @@ -0,0 +1,333 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DeletedWebAppsClient is the webSite Management Client +type DeletedWebAppsClient struct { + BaseClient +} + +// NewDeletedWebAppsClient creates an instance of the DeletedWebAppsClient client. +func NewDeletedWebAppsClient(subscriptionID string) DeletedWebAppsClient { + return NewDeletedWebAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDeletedWebAppsClientWithBaseURI creates an instance of the DeletedWebAppsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDeletedWebAppsClientWithBaseURI(baseURI string, subscriptionID string) DeletedWebAppsClient { + return DeletedWebAppsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetDeletedWebAppByLocation description for Get deleted app for a subscription at location. +// Parameters: +// deletedSiteID - the numeric ID of the deleted app, e.g. 12345 +func (client DeletedWebAppsClient) GetDeletedWebAppByLocation(ctx context.Context, location string, deletedSiteID string) (result DeletedSite, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedWebAppsClient.GetDeletedWebAppByLocation") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetDeletedWebAppByLocationPreparer(ctx, location, deletedSiteID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "GetDeletedWebAppByLocation", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedWebAppByLocationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "GetDeletedWebAppByLocation", resp, "Failure sending request") + return + } + + result, err = client.GetDeletedWebAppByLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "GetDeletedWebAppByLocation", resp, "Failure responding to request") + return + } + + return +} + +// GetDeletedWebAppByLocationPreparer prepares the GetDeletedWebAppByLocation request. +func (client DeletedWebAppsClient) GetDeletedWebAppByLocationPreparer(ctx context.Context, location string, deletedSiteID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deletedSiteId": autorest.Encode("path", deletedSiteID), + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites/{deletedSiteId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedWebAppByLocationSender sends the GetDeletedWebAppByLocation request. The method will close the +// http.Response Body if it receives an error. +func (client DeletedWebAppsClient) GetDeletedWebAppByLocationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDeletedWebAppByLocationResponder handles the response to the GetDeletedWebAppByLocation request. The method always +// closes the http.Response Body. +func (client DeletedWebAppsClient) GetDeletedWebAppByLocationResponder(resp *http.Response) (result DeletedSite, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List description for Get all deleted apps for a subscription. +func (client DeletedWebAppsClient) List(ctx context.Context) (result DeletedWebAppCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedWebAppsClient.List") + defer func() { + sc := -1 + if result.dwac.Response.Response != nil { + sc = result.dwac.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dwac.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", resp, "Failure sending request") + return + } + + result.dwac, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", resp, "Failure responding to request") + return + } + if result.dwac.hasNextLink() && result.dwac.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DeletedWebAppsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DeletedWebAppsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DeletedWebAppsClient) ListResponder(resp *http.Response) (result DeletedWebAppCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DeletedWebAppsClient) listNextResults(ctx context.Context, lastResults DeletedWebAppCollection) (result DeletedWebAppCollection, err error) { + req, err := lastResults.deletedWebAppCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeletedWebAppsClient) ListComplete(ctx context.Context) (result DeletedWebAppCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedWebAppsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByLocation description for Get all deleted apps for a subscription at location +func (client DeletedWebAppsClient) ListByLocation(ctx context.Context, location string) (result DeletedWebAppCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedWebAppsClient.ListByLocation") + defer func() { + sc := -1 + if result.dwac.Response.Response != nil { + sc = result.dwac.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByLocationNextResults + req, err := client.ListByLocationPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByLocation", nil, "Failure preparing request") + return + } + + resp, err := client.ListByLocationSender(req) + if err != nil { + result.dwac.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByLocation", resp, "Failure sending request") + return + } + + result.dwac, err = client.ListByLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByLocation", resp, "Failure responding to request") + return + } + if result.dwac.hasNextLink() && result.dwac.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByLocationPreparer prepares the ListByLocation request. +func (client DeletedWebAppsClient) ListByLocationPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByLocationSender sends the ListByLocation request. The method will close the +// http.Response Body if it receives an error. +func (client DeletedWebAppsClient) ListByLocationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByLocationResponder handles the response to the ListByLocation request. The method always +// closes the http.Response Body. +func (client DeletedWebAppsClient) ListByLocationResponder(resp *http.Response) (result DeletedWebAppCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByLocationNextResults retrieves the next set of results, if any. +func (client DeletedWebAppsClient) listByLocationNextResults(ctx context.Context, lastResults DeletedWebAppCollection) (result DeletedWebAppCollection, err error) { + req, err := lastResults.deletedWebAppCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "listByLocationNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByLocationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "listByLocationNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "listByLocationNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeletedWebAppsClient) ListByLocationComplete(ctx context.Context, location string) (result DeletedWebAppCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedWebAppsClient.ListByLocation") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByLocation(ctx, location) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/diagnostics.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/diagnostics.go new file mode 100644 index 000000000000..43988e0c81c4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/diagnostics.go @@ -0,0 +1,2434 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DiagnosticsClient is the webSite Management Client +type DiagnosticsClient struct { + BaseClient +} + +// NewDiagnosticsClient creates an instance of the DiagnosticsClient client. +func NewDiagnosticsClient(subscriptionID string) DiagnosticsClient { + return NewDiagnosticsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDiagnosticsClientWithBaseURI creates an instance of the DiagnosticsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDiagnosticsClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticsClient { + return DiagnosticsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ExecuteSiteAnalysis description for Execute Analysis +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// diagnosticCategory - category Name +// analysisName - analysis Resource Name +// startTime - start Time +// endTime - end Time +// timeGrain - time Grain +func (client DiagnosticsClient) ExecuteSiteAnalysis(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, analysisName string, startTime *date.Time, endTime *date.Time, timeGrain string) (result DiagnosticAnalysis, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ExecuteSiteAnalysis") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: timeGrain, + Constraints: []validation.Constraint{{Target: "timeGrain", Name: validation.Empty, Rule: false, + Chain: []validation.Constraint{{Target: "timeGrain", Name: validation.Pattern, Rule: `PT[1-9][0-9]+[SMH]`, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "ExecuteSiteAnalysis", err.Error()) + } + + req, err := client.ExecuteSiteAnalysisPreparer(ctx, resourceGroupName, siteName, diagnosticCategory, analysisName, startTime, endTime, timeGrain) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ExecuteSiteAnalysis", nil, "Failure preparing request") + return + } + + resp, err := client.ExecuteSiteAnalysisSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ExecuteSiteAnalysis", resp, "Failure sending request") + return + } + + result, err = client.ExecuteSiteAnalysisResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ExecuteSiteAnalysis", resp, "Failure responding to request") + return + } + + return +} + +// ExecuteSiteAnalysisPreparer prepares the ExecuteSiteAnalysis request. +func (client DiagnosticsClient) ExecuteSiteAnalysisPreparer(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, analysisName string, startTime *date.Time, endTime *date.Time, timeGrain string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "analysisName": autorest.Encode("path", analysisName), + "diagnosticCategory": autorest.Encode("path", diagnosticCategory), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + if len(timeGrain) > 0 { + queryParameters["timeGrain"] = autorest.Encode("query", timeGrain) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExecuteSiteAnalysisSender sends the ExecuteSiteAnalysis request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) ExecuteSiteAnalysisSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ExecuteSiteAnalysisResponder handles the response to the ExecuteSiteAnalysis request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) ExecuteSiteAnalysisResponder(resp *http.Response) (result DiagnosticAnalysis, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ExecuteSiteAnalysisSlot description for Execute Analysis +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// diagnosticCategory - category Name +// analysisName - analysis Resource Name +// slot - slot Name +// startTime - start Time +// endTime - end Time +// timeGrain - time Grain +func (client DiagnosticsClient) ExecuteSiteAnalysisSlot(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, analysisName string, slot string, startTime *date.Time, endTime *date.Time, timeGrain string) (result DiagnosticAnalysis, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ExecuteSiteAnalysisSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: timeGrain, + Constraints: []validation.Constraint{{Target: "timeGrain", Name: validation.Empty, Rule: false, + Chain: []validation.Constraint{{Target: "timeGrain", Name: validation.Pattern, Rule: `PT[1-9][0-9]+[SMH]`, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "ExecuteSiteAnalysisSlot", err.Error()) + } + + req, err := client.ExecuteSiteAnalysisSlotPreparer(ctx, resourceGroupName, siteName, diagnosticCategory, analysisName, slot, startTime, endTime, timeGrain) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ExecuteSiteAnalysisSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ExecuteSiteAnalysisSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ExecuteSiteAnalysisSlot", resp, "Failure sending request") + return + } + + result, err = client.ExecuteSiteAnalysisSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ExecuteSiteAnalysisSlot", resp, "Failure responding to request") + return + } + + return +} + +// ExecuteSiteAnalysisSlotPreparer prepares the ExecuteSiteAnalysisSlot request. +func (client DiagnosticsClient) ExecuteSiteAnalysisSlotPreparer(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, analysisName string, slot string, startTime *date.Time, endTime *date.Time, timeGrain string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "analysisName": autorest.Encode("path", analysisName), + "diagnosticCategory": autorest.Encode("path", diagnosticCategory), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + if len(timeGrain) > 0 { + queryParameters["timeGrain"] = autorest.Encode("query", timeGrain) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}/execute", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExecuteSiteAnalysisSlotSender sends the ExecuteSiteAnalysisSlot request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) ExecuteSiteAnalysisSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ExecuteSiteAnalysisSlotResponder handles the response to the ExecuteSiteAnalysisSlot request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) ExecuteSiteAnalysisSlotResponder(resp *http.Response) (result DiagnosticAnalysis, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ExecuteSiteDetector description for Execute Detector +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// detectorName - detector Resource Name +// diagnosticCategory - category Name +// startTime - start Time +// endTime - end Time +// timeGrain - time Grain +func (client DiagnosticsClient) ExecuteSiteDetector(ctx context.Context, resourceGroupName string, siteName string, detectorName string, diagnosticCategory string, startTime *date.Time, endTime *date.Time, timeGrain string) (result DiagnosticDetectorResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ExecuteSiteDetector") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: timeGrain, + Constraints: []validation.Constraint{{Target: "timeGrain", Name: validation.Empty, Rule: false, + Chain: []validation.Constraint{{Target: "timeGrain", Name: validation.Pattern, Rule: `PT[1-9][0-9]+[SMH]`, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "ExecuteSiteDetector", err.Error()) + } + + req, err := client.ExecuteSiteDetectorPreparer(ctx, resourceGroupName, siteName, detectorName, diagnosticCategory, startTime, endTime, timeGrain) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ExecuteSiteDetector", nil, "Failure preparing request") + return + } + + resp, err := client.ExecuteSiteDetectorSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ExecuteSiteDetector", resp, "Failure sending request") + return + } + + result, err = client.ExecuteSiteDetectorResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ExecuteSiteDetector", resp, "Failure responding to request") + return + } + + return +} + +// ExecuteSiteDetectorPreparer prepares the ExecuteSiteDetector request. +func (client DiagnosticsClient) ExecuteSiteDetectorPreparer(ctx context.Context, resourceGroupName string, siteName string, detectorName string, diagnosticCategory string, startTime *date.Time, endTime *date.Time, timeGrain string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "detectorName": autorest.Encode("path", detectorName), + "diagnosticCategory": autorest.Encode("path", diagnosticCategory), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + if len(timeGrain) > 0 { + queryParameters["timeGrain"] = autorest.Encode("query", timeGrain) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExecuteSiteDetectorSender sends the ExecuteSiteDetector request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) ExecuteSiteDetectorSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ExecuteSiteDetectorResponder handles the response to the ExecuteSiteDetector request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) ExecuteSiteDetectorResponder(resp *http.Response) (result DiagnosticDetectorResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ExecuteSiteDetectorSlot description for Execute Detector +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// detectorName - detector Resource Name +// diagnosticCategory - category Name +// slot - slot Name +// startTime - start Time +// endTime - end Time +// timeGrain - time Grain +func (client DiagnosticsClient) ExecuteSiteDetectorSlot(ctx context.Context, resourceGroupName string, siteName string, detectorName string, diagnosticCategory string, slot string, startTime *date.Time, endTime *date.Time, timeGrain string) (result DiagnosticDetectorResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ExecuteSiteDetectorSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: timeGrain, + Constraints: []validation.Constraint{{Target: "timeGrain", Name: validation.Empty, Rule: false, + Chain: []validation.Constraint{{Target: "timeGrain", Name: validation.Pattern, Rule: `PT[1-9][0-9]+[SMH]`, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "ExecuteSiteDetectorSlot", err.Error()) + } + + req, err := client.ExecuteSiteDetectorSlotPreparer(ctx, resourceGroupName, siteName, detectorName, diagnosticCategory, slot, startTime, endTime, timeGrain) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ExecuteSiteDetectorSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ExecuteSiteDetectorSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ExecuteSiteDetectorSlot", resp, "Failure sending request") + return + } + + result, err = client.ExecuteSiteDetectorSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ExecuteSiteDetectorSlot", resp, "Failure responding to request") + return + } + + return +} + +// ExecuteSiteDetectorSlotPreparer prepares the ExecuteSiteDetectorSlot request. +func (client DiagnosticsClient) ExecuteSiteDetectorSlotPreparer(ctx context.Context, resourceGroupName string, siteName string, detectorName string, diagnosticCategory string, slot string, startTime *date.Time, endTime *date.Time, timeGrain string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "detectorName": autorest.Encode("path", detectorName), + "diagnosticCategory": autorest.Encode("path", diagnosticCategory), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + if len(timeGrain) > 0 { + queryParameters["timeGrain"] = autorest.Encode("query", timeGrain) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}/execute", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExecuteSiteDetectorSlotSender sends the ExecuteSiteDetectorSlot request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) ExecuteSiteDetectorSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ExecuteSiteDetectorSlotResponder handles the response to the ExecuteSiteDetectorSlot request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) ExecuteSiteDetectorSlotResponder(resp *http.Response) (result DiagnosticDetectorResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHostingEnvironmentDetectorResponse description for Get Hosting Environment Detector Response +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - app Service Environment Name +// detectorName - detector Resource Name +// startTime - start Time +// endTime - end Time +// timeGrain - time Grain +func (client DiagnosticsClient) GetHostingEnvironmentDetectorResponse(ctx context.Context, resourceGroupName string, name string, detectorName string, startTime *date.Time, endTime *date.Time, timeGrain string) (result DetectorResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.GetHostingEnvironmentDetectorResponse") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: timeGrain, + Constraints: []validation.Constraint{{Target: "timeGrain", Name: validation.Empty, Rule: false, + Chain: []validation.Constraint{{Target: "timeGrain", Name: validation.Pattern, Rule: `PT[1-9][0-9]+[SMH]`, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "GetHostingEnvironmentDetectorResponse", err.Error()) + } + + req, err := client.GetHostingEnvironmentDetectorResponsePreparer(ctx, resourceGroupName, name, detectorName, startTime, endTime, timeGrain) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetHostingEnvironmentDetectorResponse", nil, "Failure preparing request") + return + } + + resp, err := client.GetHostingEnvironmentDetectorResponseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetHostingEnvironmentDetectorResponse", resp, "Failure sending request") + return + } + + result, err = client.GetHostingEnvironmentDetectorResponseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetHostingEnvironmentDetectorResponse", resp, "Failure responding to request") + return + } + + return +} + +// GetHostingEnvironmentDetectorResponsePreparer prepares the GetHostingEnvironmentDetectorResponse request. +func (client DiagnosticsClient) GetHostingEnvironmentDetectorResponsePreparer(ctx context.Context, resourceGroupName string, name string, detectorName string, startTime *date.Time, endTime *date.Time, timeGrain string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "detectorName": autorest.Encode("path", detectorName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + if len(timeGrain) > 0 { + queryParameters["timeGrain"] = autorest.Encode("query", timeGrain) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors/{detectorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetHostingEnvironmentDetectorResponseSender sends the GetHostingEnvironmentDetectorResponse request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) GetHostingEnvironmentDetectorResponseSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetHostingEnvironmentDetectorResponseResponder handles the response to the GetHostingEnvironmentDetectorResponse request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) GetHostingEnvironmentDetectorResponseResponder(resp *http.Response) (result DetectorResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSiteAnalysis description for Get Site Analysis +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// diagnosticCategory - diagnostic Category +// analysisName - analysis Name +func (client DiagnosticsClient) GetSiteAnalysis(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, analysisName string) (result AnalysisDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.GetSiteAnalysis") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "GetSiteAnalysis", err.Error()) + } + + req, err := client.GetSiteAnalysisPreparer(ctx, resourceGroupName, siteName, diagnosticCategory, analysisName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteAnalysis", nil, "Failure preparing request") + return + } + + resp, err := client.GetSiteAnalysisSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteAnalysis", resp, "Failure sending request") + return + } + + result, err = client.GetSiteAnalysisResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteAnalysis", resp, "Failure responding to request") + return + } + + return +} + +// GetSiteAnalysisPreparer prepares the GetSiteAnalysis request. +func (client DiagnosticsClient) GetSiteAnalysisPreparer(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, analysisName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "analysisName": autorest.Encode("path", analysisName), + "diagnosticCategory": autorest.Encode("path", diagnosticCategory), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSiteAnalysisSender sends the GetSiteAnalysis request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) GetSiteAnalysisSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSiteAnalysisResponder handles the response to the GetSiteAnalysis request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) GetSiteAnalysisResponder(resp *http.Response) (result AnalysisDefinition, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSiteAnalysisSlot description for Get Site Analysis +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// diagnosticCategory - diagnostic Category +// analysisName - analysis Name +// slot - slot - optional +func (client DiagnosticsClient) GetSiteAnalysisSlot(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, analysisName string, slot string) (result AnalysisDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.GetSiteAnalysisSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "GetSiteAnalysisSlot", err.Error()) + } + + req, err := client.GetSiteAnalysisSlotPreparer(ctx, resourceGroupName, siteName, diagnosticCategory, analysisName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteAnalysisSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetSiteAnalysisSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteAnalysisSlot", resp, "Failure sending request") + return + } + + result, err = client.GetSiteAnalysisSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteAnalysisSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetSiteAnalysisSlotPreparer prepares the GetSiteAnalysisSlot request. +func (client DiagnosticsClient) GetSiteAnalysisSlotPreparer(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, analysisName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "analysisName": autorest.Encode("path", analysisName), + "diagnosticCategory": autorest.Encode("path", diagnosticCategory), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSiteAnalysisSlotSender sends the GetSiteAnalysisSlot request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) GetSiteAnalysisSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSiteAnalysisSlotResponder handles the response to the GetSiteAnalysisSlot request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) GetSiteAnalysisSlotResponder(resp *http.Response) (result AnalysisDefinition, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSiteDetector description for Get Detector +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// diagnosticCategory - diagnostic Category +// detectorName - detector Name +func (client DiagnosticsClient) GetSiteDetector(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, detectorName string) (result DetectorDefinitionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.GetSiteDetector") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "GetSiteDetector", err.Error()) + } + + req, err := client.GetSiteDetectorPreparer(ctx, resourceGroupName, siteName, diagnosticCategory, detectorName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDetector", nil, "Failure preparing request") + return + } + + resp, err := client.GetSiteDetectorSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDetector", resp, "Failure sending request") + return + } + + result, err = client.GetSiteDetectorResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDetector", resp, "Failure responding to request") + return + } + + return +} + +// GetSiteDetectorPreparer prepares the GetSiteDetector request. +func (client DiagnosticsClient) GetSiteDetectorPreparer(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, detectorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "detectorName": autorest.Encode("path", detectorName), + "diagnosticCategory": autorest.Encode("path", diagnosticCategory), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSiteDetectorSender sends the GetSiteDetector request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) GetSiteDetectorSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSiteDetectorResponder handles the response to the GetSiteDetector request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) GetSiteDetectorResponder(resp *http.Response) (result DetectorDefinitionResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSiteDetectorResponse description for Get site detector response +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// detectorName - detector Resource Name +// startTime - start Time +// endTime - end Time +// timeGrain - time Grain +func (client DiagnosticsClient) GetSiteDetectorResponse(ctx context.Context, resourceGroupName string, siteName string, detectorName string, startTime *date.Time, endTime *date.Time, timeGrain string) (result DetectorResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.GetSiteDetectorResponse") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: timeGrain, + Constraints: []validation.Constraint{{Target: "timeGrain", Name: validation.Empty, Rule: false, + Chain: []validation.Constraint{{Target: "timeGrain", Name: validation.Pattern, Rule: `PT[1-9][0-9]+[SMH]`, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "GetSiteDetectorResponse", err.Error()) + } + + req, err := client.GetSiteDetectorResponsePreparer(ctx, resourceGroupName, siteName, detectorName, startTime, endTime, timeGrain) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDetectorResponse", nil, "Failure preparing request") + return + } + + resp, err := client.GetSiteDetectorResponseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDetectorResponse", resp, "Failure sending request") + return + } + + result, err = client.GetSiteDetectorResponseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDetectorResponse", resp, "Failure responding to request") + return + } + + return +} + +// GetSiteDetectorResponsePreparer prepares the GetSiteDetectorResponse request. +func (client DiagnosticsClient) GetSiteDetectorResponsePreparer(ctx context.Context, resourceGroupName string, siteName string, detectorName string, startTime *date.Time, endTime *date.Time, timeGrain string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "detectorName": autorest.Encode("path", detectorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + if len(timeGrain) > 0 { + queryParameters["timeGrain"] = autorest.Encode("query", timeGrain) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors/{detectorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSiteDetectorResponseSender sends the GetSiteDetectorResponse request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) GetSiteDetectorResponseSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSiteDetectorResponseResponder handles the response to the GetSiteDetectorResponse request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) GetSiteDetectorResponseResponder(resp *http.Response) (result DetectorResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSiteDetectorResponseSlot description for Get site detector response +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// detectorName - detector Resource Name +// slot - slot Name +// startTime - start Time +// endTime - end Time +// timeGrain - time Grain +func (client DiagnosticsClient) GetSiteDetectorResponseSlot(ctx context.Context, resourceGroupName string, siteName string, detectorName string, slot string, startTime *date.Time, endTime *date.Time, timeGrain string) (result DetectorResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.GetSiteDetectorResponseSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: timeGrain, + Constraints: []validation.Constraint{{Target: "timeGrain", Name: validation.Empty, Rule: false, + Chain: []validation.Constraint{{Target: "timeGrain", Name: validation.Pattern, Rule: `PT[1-9][0-9]+[SMH]`, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "GetSiteDetectorResponseSlot", err.Error()) + } + + req, err := client.GetSiteDetectorResponseSlotPreparer(ctx, resourceGroupName, siteName, detectorName, slot, startTime, endTime, timeGrain) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDetectorResponseSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetSiteDetectorResponseSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDetectorResponseSlot", resp, "Failure sending request") + return + } + + result, err = client.GetSiteDetectorResponseSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDetectorResponseSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetSiteDetectorResponseSlotPreparer prepares the GetSiteDetectorResponseSlot request. +func (client DiagnosticsClient) GetSiteDetectorResponseSlotPreparer(ctx context.Context, resourceGroupName string, siteName string, detectorName string, slot string, startTime *date.Time, endTime *date.Time, timeGrain string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "detectorName": autorest.Encode("path", detectorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + if len(timeGrain) > 0 { + queryParameters["timeGrain"] = autorest.Encode("query", timeGrain) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors/{detectorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSiteDetectorResponseSlotSender sends the GetSiteDetectorResponseSlot request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) GetSiteDetectorResponseSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSiteDetectorResponseSlotResponder handles the response to the GetSiteDetectorResponseSlot request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) GetSiteDetectorResponseSlotResponder(resp *http.Response) (result DetectorResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSiteDetectorSlot description for Get Detector +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// diagnosticCategory - diagnostic Category +// detectorName - detector Name +// slot - slot Name +func (client DiagnosticsClient) GetSiteDetectorSlot(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, detectorName string, slot string) (result DetectorDefinitionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.GetSiteDetectorSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "GetSiteDetectorSlot", err.Error()) + } + + req, err := client.GetSiteDetectorSlotPreparer(ctx, resourceGroupName, siteName, diagnosticCategory, detectorName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDetectorSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetSiteDetectorSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDetectorSlot", resp, "Failure sending request") + return + } + + result, err = client.GetSiteDetectorSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDetectorSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetSiteDetectorSlotPreparer prepares the GetSiteDetectorSlot request. +func (client DiagnosticsClient) GetSiteDetectorSlotPreparer(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, detectorName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "detectorName": autorest.Encode("path", detectorName), + "diagnosticCategory": autorest.Encode("path", diagnosticCategory), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSiteDetectorSlotSender sends the GetSiteDetectorSlot request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) GetSiteDetectorSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSiteDetectorSlotResponder handles the response to the GetSiteDetectorSlot request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) GetSiteDetectorSlotResponder(resp *http.Response) (result DetectorDefinitionResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSiteDiagnosticCategory description for Get Diagnostics Category +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// diagnosticCategory - diagnostic Category +func (client DiagnosticsClient) GetSiteDiagnosticCategory(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string) (result DiagnosticCategory, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.GetSiteDiagnosticCategory") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "GetSiteDiagnosticCategory", err.Error()) + } + + req, err := client.GetSiteDiagnosticCategoryPreparer(ctx, resourceGroupName, siteName, diagnosticCategory) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDiagnosticCategory", nil, "Failure preparing request") + return + } + + resp, err := client.GetSiteDiagnosticCategorySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDiagnosticCategory", resp, "Failure sending request") + return + } + + result, err = client.GetSiteDiagnosticCategoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDiagnosticCategory", resp, "Failure responding to request") + return + } + + return +} + +// GetSiteDiagnosticCategoryPreparer prepares the GetSiteDiagnosticCategory request. +func (client DiagnosticsClient) GetSiteDiagnosticCategoryPreparer(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diagnosticCategory": autorest.Encode("path", diagnosticCategory), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSiteDiagnosticCategorySender sends the GetSiteDiagnosticCategory request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) GetSiteDiagnosticCategorySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSiteDiagnosticCategoryResponder handles the response to the GetSiteDiagnosticCategory request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) GetSiteDiagnosticCategoryResponder(resp *http.Response) (result DiagnosticCategory, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSiteDiagnosticCategorySlot description for Get Diagnostics Category +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// diagnosticCategory - diagnostic Category +// slot - slot Name +func (client DiagnosticsClient) GetSiteDiagnosticCategorySlot(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, slot string) (result DiagnosticCategory, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.GetSiteDiagnosticCategorySlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "GetSiteDiagnosticCategorySlot", err.Error()) + } + + req, err := client.GetSiteDiagnosticCategorySlotPreparer(ctx, resourceGroupName, siteName, diagnosticCategory, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDiagnosticCategorySlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetSiteDiagnosticCategorySlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDiagnosticCategorySlot", resp, "Failure sending request") + return + } + + result, err = client.GetSiteDiagnosticCategorySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "GetSiteDiagnosticCategorySlot", resp, "Failure responding to request") + return + } + + return +} + +// GetSiteDiagnosticCategorySlotPreparer prepares the GetSiteDiagnosticCategorySlot request. +func (client DiagnosticsClient) GetSiteDiagnosticCategorySlotPreparer(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diagnosticCategory": autorest.Encode("path", diagnosticCategory), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSiteDiagnosticCategorySlotSender sends the GetSiteDiagnosticCategorySlot request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) GetSiteDiagnosticCategorySlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSiteDiagnosticCategorySlotResponder handles the response to the GetSiteDiagnosticCategorySlot request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) GetSiteDiagnosticCategorySlotResponder(resp *http.Response) (result DiagnosticCategory, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHostingEnvironmentDetectorResponses description for List Hosting Environment Detector Responses +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - site Name +func (client DiagnosticsClient) ListHostingEnvironmentDetectorResponses(ctx context.Context, resourceGroupName string, name string) (result DetectorResponseCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListHostingEnvironmentDetectorResponses") + defer func() { + sc := -1 + if result.drc.Response.Response != nil { + sc = result.drc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "ListHostingEnvironmentDetectorResponses", err.Error()) + } + + result.fn = client.listHostingEnvironmentDetectorResponsesNextResults + req, err := client.ListHostingEnvironmentDetectorResponsesPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListHostingEnvironmentDetectorResponses", nil, "Failure preparing request") + return + } + + resp, err := client.ListHostingEnvironmentDetectorResponsesSender(req) + if err != nil { + result.drc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListHostingEnvironmentDetectorResponses", resp, "Failure sending request") + return + } + + result.drc, err = client.ListHostingEnvironmentDetectorResponsesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListHostingEnvironmentDetectorResponses", resp, "Failure responding to request") + return + } + if result.drc.hasNextLink() && result.drc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListHostingEnvironmentDetectorResponsesPreparer prepares the ListHostingEnvironmentDetectorResponses request. +func (client DiagnosticsClient) ListHostingEnvironmentDetectorResponsesPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHostingEnvironmentDetectorResponsesSender sends the ListHostingEnvironmentDetectorResponses request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) ListHostingEnvironmentDetectorResponsesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListHostingEnvironmentDetectorResponsesResponder handles the response to the ListHostingEnvironmentDetectorResponses request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) ListHostingEnvironmentDetectorResponsesResponder(resp *http.Response) (result DetectorResponseCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listHostingEnvironmentDetectorResponsesNextResults retrieves the next set of results, if any. +func (client DiagnosticsClient) listHostingEnvironmentDetectorResponsesNextResults(ctx context.Context, lastResults DetectorResponseCollection) (result DetectorResponseCollection, err error) { + req, err := lastResults.detectorResponseCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listHostingEnvironmentDetectorResponsesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListHostingEnvironmentDetectorResponsesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listHostingEnvironmentDetectorResponsesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListHostingEnvironmentDetectorResponsesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listHostingEnvironmentDetectorResponsesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListHostingEnvironmentDetectorResponsesComplete enumerates all values, automatically crossing page boundaries as required. +func (client DiagnosticsClient) ListHostingEnvironmentDetectorResponsesComplete(ctx context.Context, resourceGroupName string, name string) (result DetectorResponseCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListHostingEnvironmentDetectorResponses") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListHostingEnvironmentDetectorResponses(ctx, resourceGroupName, name) + return +} + +// ListSiteAnalyses description for Get Site Analyses +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// diagnosticCategory - diagnostic Category +func (client DiagnosticsClient) ListSiteAnalyses(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string) (result DiagnosticAnalysisCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteAnalyses") + defer func() { + sc := -1 + if result.dac.Response.Response != nil { + sc = result.dac.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "ListSiteAnalyses", err.Error()) + } + + result.fn = client.listSiteAnalysesNextResults + req, err := client.ListSiteAnalysesPreparer(ctx, resourceGroupName, siteName, diagnosticCategory) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteAnalyses", nil, "Failure preparing request") + return + } + + resp, err := client.ListSiteAnalysesSender(req) + if err != nil { + result.dac.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteAnalyses", resp, "Failure sending request") + return + } + + result.dac, err = client.ListSiteAnalysesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteAnalyses", resp, "Failure responding to request") + return + } + if result.dac.hasNextLink() && result.dac.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSiteAnalysesPreparer prepares the ListSiteAnalyses request. +func (client DiagnosticsClient) ListSiteAnalysesPreparer(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diagnosticCategory": autorest.Encode("path", diagnosticCategory), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSiteAnalysesSender sends the ListSiteAnalyses request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) ListSiteAnalysesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSiteAnalysesResponder handles the response to the ListSiteAnalyses request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) ListSiteAnalysesResponder(resp *http.Response) (result DiagnosticAnalysisCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSiteAnalysesNextResults retrieves the next set of results, if any. +func (client DiagnosticsClient) listSiteAnalysesNextResults(ctx context.Context, lastResults DiagnosticAnalysisCollection) (result DiagnosticAnalysisCollection, err error) { + req, err := lastResults.diagnosticAnalysisCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteAnalysesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSiteAnalysesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteAnalysesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSiteAnalysesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteAnalysesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSiteAnalysesComplete enumerates all values, automatically crossing page boundaries as required. +func (client DiagnosticsClient) ListSiteAnalysesComplete(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string) (result DiagnosticAnalysisCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteAnalyses") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSiteAnalyses(ctx, resourceGroupName, siteName, diagnosticCategory) + return +} + +// ListSiteAnalysesSlot description for Get Site Analyses +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// diagnosticCategory - diagnostic Category +// slot - slot Name +func (client DiagnosticsClient) ListSiteAnalysesSlot(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, slot string) (result DiagnosticAnalysisCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteAnalysesSlot") + defer func() { + sc := -1 + if result.dac.Response.Response != nil { + sc = result.dac.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "ListSiteAnalysesSlot", err.Error()) + } + + result.fn = client.listSiteAnalysesSlotNextResults + req, err := client.ListSiteAnalysesSlotPreparer(ctx, resourceGroupName, siteName, diagnosticCategory, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteAnalysesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListSiteAnalysesSlotSender(req) + if err != nil { + result.dac.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteAnalysesSlot", resp, "Failure sending request") + return + } + + result.dac, err = client.ListSiteAnalysesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteAnalysesSlot", resp, "Failure responding to request") + return + } + if result.dac.hasNextLink() && result.dac.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSiteAnalysesSlotPreparer prepares the ListSiteAnalysesSlot request. +func (client DiagnosticsClient) ListSiteAnalysesSlotPreparer(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diagnosticCategory": autorest.Encode("path", diagnosticCategory), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSiteAnalysesSlotSender sends the ListSiteAnalysesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) ListSiteAnalysesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSiteAnalysesSlotResponder handles the response to the ListSiteAnalysesSlot request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) ListSiteAnalysesSlotResponder(resp *http.Response) (result DiagnosticAnalysisCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSiteAnalysesSlotNextResults retrieves the next set of results, if any. +func (client DiagnosticsClient) listSiteAnalysesSlotNextResults(ctx context.Context, lastResults DiagnosticAnalysisCollection) (result DiagnosticAnalysisCollection, err error) { + req, err := lastResults.diagnosticAnalysisCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteAnalysesSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSiteAnalysesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteAnalysesSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSiteAnalysesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteAnalysesSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSiteAnalysesSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client DiagnosticsClient) ListSiteAnalysesSlotComplete(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, slot string) (result DiagnosticAnalysisCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteAnalysesSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSiteAnalysesSlot(ctx, resourceGroupName, siteName, diagnosticCategory, slot) + return +} + +// ListSiteDetectorResponses description for List Site Detector Responses +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +func (client DiagnosticsClient) ListSiteDetectorResponses(ctx context.Context, resourceGroupName string, siteName string) (result DetectorResponseCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteDetectorResponses") + defer func() { + sc := -1 + if result.drc.Response.Response != nil { + sc = result.drc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "ListSiteDetectorResponses", err.Error()) + } + + result.fn = client.listSiteDetectorResponsesNextResults + req, err := client.ListSiteDetectorResponsesPreparer(ctx, resourceGroupName, siteName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDetectorResponses", nil, "Failure preparing request") + return + } + + resp, err := client.ListSiteDetectorResponsesSender(req) + if err != nil { + result.drc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDetectorResponses", resp, "Failure sending request") + return + } + + result.drc, err = client.ListSiteDetectorResponsesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDetectorResponses", resp, "Failure responding to request") + return + } + if result.drc.hasNextLink() && result.drc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSiteDetectorResponsesPreparer prepares the ListSiteDetectorResponses request. +func (client DiagnosticsClient) ListSiteDetectorResponsesPreparer(ctx context.Context, resourceGroupName string, siteName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSiteDetectorResponsesSender sends the ListSiteDetectorResponses request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) ListSiteDetectorResponsesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSiteDetectorResponsesResponder handles the response to the ListSiteDetectorResponses request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) ListSiteDetectorResponsesResponder(resp *http.Response) (result DetectorResponseCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSiteDetectorResponsesNextResults retrieves the next set of results, if any. +func (client DiagnosticsClient) listSiteDetectorResponsesNextResults(ctx context.Context, lastResults DetectorResponseCollection) (result DetectorResponseCollection, err error) { + req, err := lastResults.detectorResponseCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDetectorResponsesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSiteDetectorResponsesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDetectorResponsesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSiteDetectorResponsesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDetectorResponsesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSiteDetectorResponsesComplete enumerates all values, automatically crossing page boundaries as required. +func (client DiagnosticsClient) ListSiteDetectorResponsesComplete(ctx context.Context, resourceGroupName string, siteName string) (result DetectorResponseCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteDetectorResponses") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSiteDetectorResponses(ctx, resourceGroupName, siteName) + return +} + +// ListSiteDetectorResponsesSlot description for List Site Detector Responses +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// slot - slot Name +func (client DiagnosticsClient) ListSiteDetectorResponsesSlot(ctx context.Context, resourceGroupName string, siteName string, slot string) (result DetectorResponseCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteDetectorResponsesSlot") + defer func() { + sc := -1 + if result.drc.Response.Response != nil { + sc = result.drc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "ListSiteDetectorResponsesSlot", err.Error()) + } + + result.fn = client.listSiteDetectorResponsesSlotNextResults + req, err := client.ListSiteDetectorResponsesSlotPreparer(ctx, resourceGroupName, siteName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDetectorResponsesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListSiteDetectorResponsesSlotSender(req) + if err != nil { + result.drc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDetectorResponsesSlot", resp, "Failure sending request") + return + } + + result.drc, err = client.ListSiteDetectorResponsesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDetectorResponsesSlot", resp, "Failure responding to request") + return + } + if result.drc.hasNextLink() && result.drc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSiteDetectorResponsesSlotPreparer prepares the ListSiteDetectorResponsesSlot request. +func (client DiagnosticsClient) ListSiteDetectorResponsesSlotPreparer(ctx context.Context, resourceGroupName string, siteName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSiteDetectorResponsesSlotSender sends the ListSiteDetectorResponsesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) ListSiteDetectorResponsesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSiteDetectorResponsesSlotResponder handles the response to the ListSiteDetectorResponsesSlot request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) ListSiteDetectorResponsesSlotResponder(resp *http.Response) (result DetectorResponseCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSiteDetectorResponsesSlotNextResults retrieves the next set of results, if any. +func (client DiagnosticsClient) listSiteDetectorResponsesSlotNextResults(ctx context.Context, lastResults DetectorResponseCollection) (result DetectorResponseCollection, err error) { + req, err := lastResults.detectorResponseCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDetectorResponsesSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSiteDetectorResponsesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDetectorResponsesSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSiteDetectorResponsesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDetectorResponsesSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSiteDetectorResponsesSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client DiagnosticsClient) ListSiteDetectorResponsesSlotComplete(ctx context.Context, resourceGroupName string, siteName string, slot string) (result DetectorResponseCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteDetectorResponsesSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSiteDetectorResponsesSlot(ctx, resourceGroupName, siteName, slot) + return +} + +// ListSiteDetectors description for Get Detectors +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// diagnosticCategory - diagnostic Category +func (client DiagnosticsClient) ListSiteDetectors(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string) (result DiagnosticDetectorCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteDetectors") + defer func() { + sc := -1 + if result.ddc.Response.Response != nil { + sc = result.ddc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "ListSiteDetectors", err.Error()) + } + + result.fn = client.listSiteDetectorsNextResults + req, err := client.ListSiteDetectorsPreparer(ctx, resourceGroupName, siteName, diagnosticCategory) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDetectors", nil, "Failure preparing request") + return + } + + resp, err := client.ListSiteDetectorsSender(req) + if err != nil { + result.ddc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDetectors", resp, "Failure sending request") + return + } + + result.ddc, err = client.ListSiteDetectorsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDetectors", resp, "Failure responding to request") + return + } + if result.ddc.hasNextLink() && result.ddc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSiteDetectorsPreparer prepares the ListSiteDetectors request. +func (client DiagnosticsClient) ListSiteDetectorsPreparer(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diagnosticCategory": autorest.Encode("path", diagnosticCategory), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSiteDetectorsSender sends the ListSiteDetectors request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) ListSiteDetectorsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSiteDetectorsResponder handles the response to the ListSiteDetectors request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) ListSiteDetectorsResponder(resp *http.Response) (result DiagnosticDetectorCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSiteDetectorsNextResults retrieves the next set of results, if any. +func (client DiagnosticsClient) listSiteDetectorsNextResults(ctx context.Context, lastResults DiagnosticDetectorCollection) (result DiagnosticDetectorCollection, err error) { + req, err := lastResults.diagnosticDetectorCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDetectorsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSiteDetectorsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDetectorsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSiteDetectorsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDetectorsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSiteDetectorsComplete enumerates all values, automatically crossing page boundaries as required. +func (client DiagnosticsClient) ListSiteDetectorsComplete(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string) (result DiagnosticDetectorCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteDetectors") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSiteDetectors(ctx, resourceGroupName, siteName, diagnosticCategory) + return +} + +// ListSiteDetectorsSlot description for Get Detectors +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// diagnosticCategory - diagnostic Category +// slot - slot Name +func (client DiagnosticsClient) ListSiteDetectorsSlot(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, slot string) (result DiagnosticDetectorCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteDetectorsSlot") + defer func() { + sc := -1 + if result.ddc.Response.Response != nil { + sc = result.ddc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "ListSiteDetectorsSlot", err.Error()) + } + + result.fn = client.listSiteDetectorsSlotNextResults + req, err := client.ListSiteDetectorsSlotPreparer(ctx, resourceGroupName, siteName, diagnosticCategory, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDetectorsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListSiteDetectorsSlotSender(req) + if err != nil { + result.ddc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDetectorsSlot", resp, "Failure sending request") + return + } + + result.ddc, err = client.ListSiteDetectorsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDetectorsSlot", resp, "Failure responding to request") + return + } + if result.ddc.hasNextLink() && result.ddc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSiteDetectorsSlotPreparer prepares the ListSiteDetectorsSlot request. +func (client DiagnosticsClient) ListSiteDetectorsSlotPreparer(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diagnosticCategory": autorest.Encode("path", diagnosticCategory), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSiteDetectorsSlotSender sends the ListSiteDetectorsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) ListSiteDetectorsSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSiteDetectorsSlotResponder handles the response to the ListSiteDetectorsSlot request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) ListSiteDetectorsSlotResponder(resp *http.Response) (result DiagnosticDetectorCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSiteDetectorsSlotNextResults retrieves the next set of results, if any. +func (client DiagnosticsClient) listSiteDetectorsSlotNextResults(ctx context.Context, lastResults DiagnosticDetectorCollection) (result DiagnosticDetectorCollection, err error) { + req, err := lastResults.diagnosticDetectorCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDetectorsSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSiteDetectorsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDetectorsSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSiteDetectorsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDetectorsSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSiteDetectorsSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client DiagnosticsClient) ListSiteDetectorsSlotComplete(ctx context.Context, resourceGroupName string, siteName string, diagnosticCategory string, slot string) (result DiagnosticDetectorCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteDetectorsSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSiteDetectorsSlot(ctx, resourceGroupName, siteName, diagnosticCategory, slot) + return +} + +// ListSiteDiagnosticCategories description for Get Diagnostics Categories +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +func (client DiagnosticsClient) ListSiteDiagnosticCategories(ctx context.Context, resourceGroupName string, siteName string) (result DiagnosticCategoryCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteDiagnosticCategories") + defer func() { + sc := -1 + if result.dcc.Response.Response != nil { + sc = result.dcc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "ListSiteDiagnosticCategories", err.Error()) + } + + result.fn = client.listSiteDiagnosticCategoriesNextResults + req, err := client.ListSiteDiagnosticCategoriesPreparer(ctx, resourceGroupName, siteName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDiagnosticCategories", nil, "Failure preparing request") + return + } + + resp, err := client.ListSiteDiagnosticCategoriesSender(req) + if err != nil { + result.dcc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDiagnosticCategories", resp, "Failure sending request") + return + } + + result.dcc, err = client.ListSiteDiagnosticCategoriesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDiagnosticCategories", resp, "Failure responding to request") + return + } + if result.dcc.hasNextLink() && result.dcc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSiteDiagnosticCategoriesPreparer prepares the ListSiteDiagnosticCategories request. +func (client DiagnosticsClient) ListSiteDiagnosticCategoriesPreparer(ctx context.Context, resourceGroupName string, siteName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSiteDiagnosticCategoriesSender sends the ListSiteDiagnosticCategories request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) ListSiteDiagnosticCategoriesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSiteDiagnosticCategoriesResponder handles the response to the ListSiteDiagnosticCategories request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) ListSiteDiagnosticCategoriesResponder(resp *http.Response) (result DiagnosticCategoryCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSiteDiagnosticCategoriesNextResults retrieves the next set of results, if any. +func (client DiagnosticsClient) listSiteDiagnosticCategoriesNextResults(ctx context.Context, lastResults DiagnosticCategoryCollection) (result DiagnosticCategoryCollection, err error) { + req, err := lastResults.diagnosticCategoryCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDiagnosticCategoriesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSiteDiagnosticCategoriesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDiagnosticCategoriesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSiteDiagnosticCategoriesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDiagnosticCategoriesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSiteDiagnosticCategoriesComplete enumerates all values, automatically crossing page boundaries as required. +func (client DiagnosticsClient) ListSiteDiagnosticCategoriesComplete(ctx context.Context, resourceGroupName string, siteName string) (result DiagnosticCategoryCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteDiagnosticCategories") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSiteDiagnosticCategories(ctx, resourceGroupName, siteName) + return +} + +// ListSiteDiagnosticCategoriesSlot description for Get Diagnostics Categories +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site Name +// slot - slot Name +func (client DiagnosticsClient) ListSiteDiagnosticCategoriesSlot(ctx context.Context, resourceGroupName string, siteName string, slot string) (result DiagnosticCategoryCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteDiagnosticCategoriesSlot") + defer func() { + sc := -1 + if result.dcc.Response.Response != nil { + sc = result.dcc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DiagnosticsClient", "ListSiteDiagnosticCategoriesSlot", err.Error()) + } + + result.fn = client.listSiteDiagnosticCategoriesSlotNextResults + req, err := client.ListSiteDiagnosticCategoriesSlotPreparer(ctx, resourceGroupName, siteName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDiagnosticCategoriesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListSiteDiagnosticCategoriesSlotSender(req) + if err != nil { + result.dcc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDiagnosticCategoriesSlot", resp, "Failure sending request") + return + } + + result.dcc, err = client.ListSiteDiagnosticCategoriesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "ListSiteDiagnosticCategoriesSlot", resp, "Failure responding to request") + return + } + if result.dcc.hasNextLink() && result.dcc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSiteDiagnosticCategoriesSlotPreparer prepares the ListSiteDiagnosticCategoriesSlot request. +func (client DiagnosticsClient) ListSiteDiagnosticCategoriesSlotPreparer(ctx context.Context, resourceGroupName string, siteName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSiteDiagnosticCategoriesSlotSender sends the ListSiteDiagnosticCategoriesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticsClient) ListSiteDiagnosticCategoriesSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSiteDiagnosticCategoriesSlotResponder handles the response to the ListSiteDiagnosticCategoriesSlot request. The method always +// closes the http.Response Body. +func (client DiagnosticsClient) ListSiteDiagnosticCategoriesSlotResponder(resp *http.Response) (result DiagnosticCategoryCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSiteDiagnosticCategoriesSlotNextResults retrieves the next set of results, if any. +func (client DiagnosticsClient) listSiteDiagnosticCategoriesSlotNextResults(ctx context.Context, lastResults DiagnosticCategoryCollection) (result DiagnosticCategoryCollection, err error) { + req, err := lastResults.diagnosticCategoryCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDiagnosticCategoriesSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSiteDiagnosticCategoriesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDiagnosticCategoriesSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSiteDiagnosticCategoriesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DiagnosticsClient", "listSiteDiagnosticCategoriesSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSiteDiagnosticCategoriesSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client DiagnosticsClient) ListSiteDiagnosticCategoriesSlotComplete(ctx context.Context, resourceGroupName string, siteName string, slot string) (result DiagnosticCategoryCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticsClient.ListSiteDiagnosticCategoriesSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSiteDiagnosticCategoriesSlot(ctx, resourceGroupName, siteName, slot) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/domainregistrationprovider.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/domainregistrationprovider.go new file mode 100644 index 000000000000..a04e086e447c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/domainregistrationprovider.go @@ -0,0 +1,142 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DomainRegistrationProviderClient is the webSite Management Client +type DomainRegistrationProviderClient struct { + BaseClient +} + +// NewDomainRegistrationProviderClient creates an instance of the DomainRegistrationProviderClient client. +func NewDomainRegistrationProviderClient(subscriptionID string) DomainRegistrationProviderClient { + return NewDomainRegistrationProviderClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDomainRegistrationProviderClientWithBaseURI creates an instance of the DomainRegistrationProviderClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewDomainRegistrationProviderClientWithBaseURI(baseURI string, subscriptionID string) DomainRegistrationProviderClient { + return DomainRegistrationProviderClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListOperations description for Implements Csm operations Api to exposes the list of available Csm Apis under the +// resource provider +func (client DomainRegistrationProviderClient) ListOperations(ctx context.Context) (result CsmOperationCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainRegistrationProviderClient.ListOperations") + defer func() { + sc := -1 + if result.coc.Response.Response != nil { + sc = result.coc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listOperationsNextResults + req, err := client.ListOperationsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainRegistrationProviderClient", "ListOperations", nil, "Failure preparing request") + return + } + + resp, err := client.ListOperationsSender(req) + if err != nil { + result.coc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainRegistrationProviderClient", "ListOperations", resp, "Failure sending request") + return + } + + result.coc, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainRegistrationProviderClient", "ListOperations", resp, "Failure responding to request") + return + } + if result.coc.hasNextLink() && result.coc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListOperationsPreparer prepares the ListOperations request. +func (client DomainRegistrationProviderClient) ListOperationsPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.DomainRegistration/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListOperationsSender sends the ListOperations request. The method will close the +// http.Response Body if it receives an error. +func (client DomainRegistrationProviderClient) ListOperationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListOperationsResponder handles the response to the ListOperations request. The method always +// closes the http.Response Body. +func (client DomainRegistrationProviderClient) ListOperationsResponder(resp *http.Response) (result CsmOperationCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listOperationsNextResults retrieves the next set of results, if any. +func (client DomainRegistrationProviderClient) listOperationsNextResults(ctx context.Context, lastResults CsmOperationCollection) (result CsmOperationCollection, err error) { + req, err := lastResults.csmOperationCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainRegistrationProviderClient", "listOperationsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DomainRegistrationProviderClient", "listOperationsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainRegistrationProviderClient", "listOperationsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListOperationsComplete enumerates all values, automatically crossing page boundaries as required. +func (client DomainRegistrationProviderClient) ListOperationsComplete(ctx context.Context) (result CsmOperationCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainRegistrationProviderClient.ListOperations") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListOperations(ctx) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/domains.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/domains.go new file mode 100644 index 000000000000..1c9d9b47fe37 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/domains.go @@ -0,0 +1,1585 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DomainsClient is the webSite Management Client +type DomainsClient struct { + BaseClient +} + +// NewDomainsClient creates an instance of the DomainsClient client. +func NewDomainsClient(subscriptionID string) DomainsClient { + return NewDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDomainsClientWithBaseURI creates an instance of the DomainsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDomainsClientWithBaseURI(baseURI string, subscriptionID string) DomainsClient { + return DomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckAvailability description for Check if a domain is available for registration. +// Parameters: +// identifier - name of the domain. +func (client DomainsClient) CheckAvailability(ctx context.Context, identifier NameIdentifier) (result DomainAvailabilityCheckResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.CheckAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckAvailabilityPreparer(ctx, identifier) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CheckAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CheckAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CheckAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckAvailabilityPreparer prepares the CheckAvailability request. +func (client DomainsClient) CheckAvailabilityPreparer(ctx context.Context, identifier NameIdentifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability", pathParameters), + autorest.WithJSON(identifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckAvailabilitySender sends the CheckAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) CheckAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckAvailabilityResponder handles the response to the CheckAvailability request. The method always +// closes the http.Response Body. +func (client DomainsClient) CheckAvailabilityResponder(resp *http.Response) (result DomainAvailabilityCheckResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate description for Creates or updates a domain. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// domainName - name of the domain. +// domain - domain registration information. +func (client DomainsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domain Domain) (result DomainsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: domainName, + Constraints: []validation.Constraint{{Target: "domainName", Name: validation.Pattern, Rule: `[a-zA-Z0-9][a-zA-Z0-9\.-]+`, Chain: nil}}}, + {TargetValue: domain, + Constraints: []validation.Constraint{{Target: "domain.DomainProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactAdmin", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactAdmin.AddressMailing", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactAdmin.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactAdmin.Email", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.NameLast", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.Phone", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactBilling", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactBilling.AddressMailing", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactBilling.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactBilling.Email", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.NameLast", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.Phone", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactRegistrant", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactRegistrant.AddressMailing", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactRegistrant.Email", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.NameLast", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.Phone", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactTech", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactTech.AddressMailing", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactTech.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactTech.Email", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.NameLast", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.Phone", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.Consent", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("web.DomainsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainName, domain) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DomainsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domain Domain) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}", pathParameters), + autorest.WithJSON(domain), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) CreateOrUpdateSender(req *http.Request) (future DomainsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DomainsClient) CreateOrUpdateResponder(resp *http.Response) (result Domain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateOwnershipIdentifier description for Creates an ownership identifier for a domain or updates identifier +// details for an existing identifier +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// domainName - name of domain. +// name - name of identifier. +// domainOwnershipIdentifier - a JSON representation of the domain ownership properties. +func (client DomainsClient) CreateOrUpdateOwnershipIdentifier(ctx context.Context, resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (result DomainOwnershipIdentifier, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.CreateOrUpdateOwnershipIdentifier") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DomainsClient", "CreateOrUpdateOwnershipIdentifier", err.Error()) + } + + req, err := client.CreateOrUpdateOwnershipIdentifierPreparer(ctx, resourceGroupName, domainName, name, domainOwnershipIdentifier) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdateOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdateOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdateOwnershipIdentifier", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateOwnershipIdentifierPreparer prepares the CreateOrUpdateOwnershipIdentifier request. +func (client DomainsClient) CreateOrUpdateOwnershipIdentifierPreparer(ctx context.Context, resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateOwnershipIdentifierSender sends the CreateOrUpdateOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) CreateOrUpdateOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateOwnershipIdentifierResponder handles the response to the CreateOrUpdateOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client DomainsClient) CreateOrUpdateOwnershipIdentifierResponder(resp *http.Response) (result DomainOwnershipIdentifier, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete description for Delete a domain. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// domainName - name of the domain. +// forceHardDeleteDomain - specify true to delete the domain immediately. The default is +// false which deletes the domain after 24 hours. +func (client DomainsClient) Delete(ctx context.Context, resourceGroupName string, domainName string, forceHardDeleteDomain *bool) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DomainsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, domainName, forceHardDeleteDomain) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainName string, forceHardDeleteDomain *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceHardDeleteDomain != nil { + queryParameters["forceHardDeleteDomain"] = autorest.Encode("query", *forceHardDeleteDomain) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DomainsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteOwnershipIdentifier description for Delete ownership identifier for domain +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// domainName - name of domain. +// name - name of identifier. +func (client DomainsClient) DeleteOwnershipIdentifier(ctx context.Context, resourceGroupName string, domainName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.DeleteOwnershipIdentifier") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DomainsClient", "DeleteOwnershipIdentifier", err.Error()) + } + + req, err := client.DeleteOwnershipIdentifierPreparer(ctx, resourceGroupName, domainName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "DeleteOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteOwnershipIdentifierSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.DomainsClient", "DeleteOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.DeleteOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "DeleteOwnershipIdentifier", resp, "Failure responding to request") + return + } + + return +} + +// DeleteOwnershipIdentifierPreparer prepares the DeleteOwnershipIdentifier request. +func (client DomainsClient) DeleteOwnershipIdentifierPreparer(ctx context.Context, resourceGroupName string, domainName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteOwnershipIdentifierSender sends the DeleteOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) DeleteOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteOwnershipIdentifierResponder handles the response to the DeleteOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client DomainsClient) DeleteOwnershipIdentifierResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get description for Get a domain. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// domainName - name of the domain. +func (client DomainsClient) Get(ctx context.Context, resourceGroupName string, domainName string) (result Domain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DomainsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DomainsClient) GetResponder(resp *http.Response) (result Domain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetControlCenterSsoRequest description for Generate a single sign-on request for the domain management portal. +func (client DomainsClient) GetControlCenterSsoRequest(ctx context.Context) (result DomainControlCenterSsoRequest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.GetControlCenterSsoRequest") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetControlCenterSsoRequestPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetControlCenterSsoRequest", nil, "Failure preparing request") + return + } + + resp, err := client.GetControlCenterSsoRequestSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetControlCenterSsoRequest", resp, "Failure sending request") + return + } + + result, err = client.GetControlCenterSsoRequestResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetControlCenterSsoRequest", resp, "Failure responding to request") + return + } + + return +} + +// GetControlCenterSsoRequestPreparer prepares the GetControlCenterSsoRequest request. +func (client DomainsClient) GetControlCenterSsoRequestPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetControlCenterSsoRequestSender sends the GetControlCenterSsoRequest request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) GetControlCenterSsoRequestSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetControlCenterSsoRequestResponder handles the response to the GetControlCenterSsoRequest request. The method always +// closes the http.Response Body. +func (client DomainsClient) GetControlCenterSsoRequestResponder(resp *http.Response) (result DomainControlCenterSsoRequest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetOwnershipIdentifier description for Get ownership identifier for domain +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// domainName - name of domain. +// name - name of identifier. +func (client DomainsClient) GetOwnershipIdentifier(ctx context.Context, resourceGroupName string, domainName string, name string) (result DomainOwnershipIdentifier, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.GetOwnershipIdentifier") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DomainsClient", "GetOwnershipIdentifier", err.Error()) + } + + req, err := client.GetOwnershipIdentifierPreparer(ctx, resourceGroupName, domainName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.GetOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.GetOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetOwnershipIdentifier", resp, "Failure responding to request") + return + } + + return +} + +// GetOwnershipIdentifierPreparer prepares the GetOwnershipIdentifier request. +func (client DomainsClient) GetOwnershipIdentifierPreparer(ctx context.Context, resourceGroupName string, domainName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetOwnershipIdentifierSender sends the GetOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) GetOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetOwnershipIdentifierResponder handles the response to the GetOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client DomainsClient) GetOwnershipIdentifierResponder(resp *http.Response) (result DomainOwnershipIdentifier, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List description for Get all domains in a subscription. +func (client DomainsClient) List(ctx context.Context) (result DomainCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.List") + defer func() { + sc := -1 + if result.dc.Response.Response != nil { + sc = result.dc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "List", resp, "Failure sending request") + return + } + + result.dc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "List", resp, "Failure responding to request") + return + } + if result.dc.hasNextLink() && result.dc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DomainsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DomainsClient) ListResponder(resp *http.Response) (result DomainCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DomainsClient) listNextResults(ctx context.Context, lastResults DomainCollection) (result DomainCollection, err error) { + req, err := lastResults.domainCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DomainsClient) ListComplete(ctx context.Context) (result DomainCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup description for Get all domains in a resource group. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +func (client DomainsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DomainCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.dc.Response.Response != nil { + sc = result.dc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DomainsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.dc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dc, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.dc.hasNextLink() && result.dc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DomainsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DomainsClient) ListByResourceGroupResponder(resp *http.Response) (result DomainCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client DomainsClient) listByResourceGroupNextResults(ctx context.Context, lastResults DomainCollection) (result DomainCollection, err error) { + req, err := lastResults.domainCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DomainsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DomainCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListOwnershipIdentifiers description for Lists domain ownership identifiers. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// domainName - name of domain. +func (client DomainsClient) ListOwnershipIdentifiers(ctx context.Context, resourceGroupName string, domainName string) (result DomainOwnershipIdentifierCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListOwnershipIdentifiers") + defer func() { + sc := -1 + if result.doic.Response.Response != nil { + sc = result.doic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DomainsClient", "ListOwnershipIdentifiers", err.Error()) + } + + result.fn = client.listOwnershipIdentifiersNextResults + req, err := client.ListOwnershipIdentifiersPreparer(ctx, resourceGroupName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", nil, "Failure preparing request") + return + } + + resp, err := client.ListOwnershipIdentifiersSender(req) + if err != nil { + result.doic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", resp, "Failure sending request") + return + } + + result.doic, err = client.ListOwnershipIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", resp, "Failure responding to request") + return + } + if result.doic.hasNextLink() && result.doic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListOwnershipIdentifiersPreparer prepares the ListOwnershipIdentifiers request. +func (client DomainsClient) ListOwnershipIdentifiersPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListOwnershipIdentifiersSender sends the ListOwnershipIdentifiers request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) ListOwnershipIdentifiersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListOwnershipIdentifiersResponder handles the response to the ListOwnershipIdentifiers request. The method always +// closes the http.Response Body. +func (client DomainsClient) ListOwnershipIdentifiersResponder(resp *http.Response) (result DomainOwnershipIdentifierCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listOwnershipIdentifiersNextResults retrieves the next set of results, if any. +func (client DomainsClient) listOwnershipIdentifiersNextResults(ctx context.Context, lastResults DomainOwnershipIdentifierCollection) (result DomainOwnershipIdentifierCollection, err error) { + req, err := lastResults.domainOwnershipIdentifierCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "listOwnershipIdentifiersNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListOwnershipIdentifiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "listOwnershipIdentifiersNextResults", resp, "Failure sending next results request") + } + result, err = client.ListOwnershipIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "listOwnershipIdentifiersNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListOwnershipIdentifiersComplete enumerates all values, automatically crossing page boundaries as required. +func (client DomainsClient) ListOwnershipIdentifiersComplete(ctx context.Context, resourceGroupName string, domainName string) (result DomainOwnershipIdentifierCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListOwnershipIdentifiers") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListOwnershipIdentifiers(ctx, resourceGroupName, domainName) + return +} + +// ListRecommendations description for Get domain name recommendations based on keywords. +// Parameters: +// parameters - search parameters for domain name recommendations. +func (client DomainsClient) ListRecommendations(ctx context.Context, parameters DomainRecommendationSearchParameters) (result NameIdentifierCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListRecommendations") + defer func() { + sc := -1 + if result.nic.Response.Response != nil { + sc = result.nic.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listRecommendationsNextResults + req, err := client.ListRecommendationsPreparer(ctx, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", nil, "Failure preparing request") + return + } + + resp, err := client.ListRecommendationsSender(req) + if err != nil { + result.nic.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", resp, "Failure sending request") + return + } + + result.nic, err = client.ListRecommendationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", resp, "Failure responding to request") + return + } + if result.nic.hasNextLink() && result.nic.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListRecommendationsPreparer prepares the ListRecommendations request. +func (client DomainsClient) ListRecommendationsPreparer(ctx context.Context, parameters DomainRecommendationSearchParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRecommendationsSender sends the ListRecommendations request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) ListRecommendationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListRecommendationsResponder handles the response to the ListRecommendations request. The method always +// closes the http.Response Body. +func (client DomainsClient) ListRecommendationsResponder(resp *http.Response) (result NameIdentifierCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listRecommendationsNextResults retrieves the next set of results, if any. +func (client DomainsClient) listRecommendationsNextResults(ctx context.Context, lastResults NameIdentifierCollection) (result NameIdentifierCollection, err error) { + req, err := lastResults.nameIdentifierCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "listRecommendationsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListRecommendationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "listRecommendationsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListRecommendationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "listRecommendationsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListRecommendationsComplete enumerates all values, automatically crossing page boundaries as required. +func (client DomainsClient) ListRecommendationsComplete(ctx context.Context, parameters DomainRecommendationSearchParameters) (result NameIdentifierCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListRecommendations") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListRecommendations(ctx, parameters) + return +} + +// Renew description for Renew a domain. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// domainName - name of the domain. +func (client DomainsClient) Renew(ctx context.Context, resourceGroupName string, domainName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Renew") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DomainsClient", "Renew", err.Error()) + } + + req, err := client.RenewPreparer(ctx, resourceGroupName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Renew", nil, "Failure preparing request") + return + } + + resp, err := client.RenewSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Renew", resp, "Failure sending request") + return + } + + result, err = client.RenewResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Renew", resp, "Failure responding to request") + return + } + + return +} + +// RenewPreparer prepares the Renew request. +func (client DomainsClient) RenewPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/renew", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RenewSender sends the Renew request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) RenewSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RenewResponder handles the response to the Renew request. The method always +// closes the http.Response Body. +func (client DomainsClient) RenewResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// TransferOut sends the transfer out request. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// domainName - name of domain. +func (client DomainsClient) TransferOut(ctx context.Context, resourceGroupName string, domainName string) (result Domain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.TransferOut") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DomainsClient", "TransferOut", err.Error()) + } + + req, err := client.TransferOutPreparer(ctx, resourceGroupName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "TransferOut", nil, "Failure preparing request") + return + } + + resp, err := client.TransferOutSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "TransferOut", resp, "Failure sending request") + return + } + + result, err = client.TransferOutResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "TransferOut", resp, "Failure responding to request") + return + } + + return +} + +// TransferOutPreparer prepares the TransferOut request. +func (client DomainsClient) TransferOutPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/transferOut", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// TransferOutSender sends the TransferOut request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) TransferOutSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// TransferOutResponder handles the response to the TransferOut request. The method always +// closes the http.Response Body. +func (client DomainsClient) TransferOutResponder(resp *http.Response) (result Domain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update description for Creates or updates a domain. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// domainName - name of the domain. +// domain - domain registration information. +func (client DomainsClient) Update(ctx context.Context, resourceGroupName string, domainName string, domain DomainPatchResource) (result Domain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: domainName, + Constraints: []validation.Constraint{{Target: "domainName", Name: validation.Pattern, Rule: `[a-zA-Z0-9][a-zA-Z0-9\.-]+`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DomainsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, domainName, domain) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DomainsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domain DomainPatchResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}", pathParameters), + autorest.WithJSON(domain), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DomainsClient) UpdateResponder(resp *http.Response) (result Domain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateOwnershipIdentifier description for Creates an ownership identifier for a domain or updates identifier details +// for an existing identifier +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// domainName - name of domain. +// name - name of identifier. +// domainOwnershipIdentifier - a JSON representation of the domain ownership properties. +func (client DomainsClient) UpdateOwnershipIdentifier(ctx context.Context, resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (result DomainOwnershipIdentifier, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.UpdateOwnershipIdentifier") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.DomainsClient", "UpdateOwnershipIdentifier", err.Error()) + } + + req, err := client.UpdateOwnershipIdentifierPreparer(ctx, resourceGroupName, domainName, name, domainOwnershipIdentifier) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "UpdateOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "UpdateOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.UpdateOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "UpdateOwnershipIdentifier", resp, "Failure responding to request") + return + } + + return +} + +// UpdateOwnershipIdentifierPreparer prepares the UpdateOwnershipIdentifier request. +func (client DomainsClient) UpdateOwnershipIdentifierPreparer(ctx context.Context, resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateOwnershipIdentifierSender sends the UpdateOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) UpdateOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateOwnershipIdentifierResponder handles the response to the UpdateOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client DomainsClient) UpdateOwnershipIdentifierResponder(resp *http.Response) (result DomainOwnershipIdentifier, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/enums.go new file mode 100644 index 000000000000..1d61f48637d3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/enums.go @@ -0,0 +1,1794 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ActiveRevisionsMode enumerates the values for active revisions mode. +type ActiveRevisionsMode string + +const ( + // ActiveRevisionsModeMultiple ... + ActiveRevisionsModeMultiple ActiveRevisionsMode = "multiple" + // ActiveRevisionsModeSingle ... + ActiveRevisionsModeSingle ActiveRevisionsMode = "single" +) + +// PossibleActiveRevisionsModeValues returns an array of possible values for the ActiveRevisionsMode const type. +func PossibleActiveRevisionsModeValues() []ActiveRevisionsMode { + return []ActiveRevisionsMode{ActiveRevisionsModeMultiple, ActiveRevisionsModeSingle} +} + +// AppServicePlanRestrictions enumerates the values for app service plan restrictions. +type AppServicePlanRestrictions string + +const ( + // AppServicePlanRestrictionsBasic ... + AppServicePlanRestrictionsBasic AppServicePlanRestrictions = "Basic" + // AppServicePlanRestrictionsFree ... + AppServicePlanRestrictionsFree AppServicePlanRestrictions = "Free" + // AppServicePlanRestrictionsNone ... + AppServicePlanRestrictionsNone AppServicePlanRestrictions = "None" + // AppServicePlanRestrictionsPremium ... + AppServicePlanRestrictionsPremium AppServicePlanRestrictions = "Premium" + // AppServicePlanRestrictionsShared ... + AppServicePlanRestrictionsShared AppServicePlanRestrictions = "Shared" + // AppServicePlanRestrictionsStandard ... + AppServicePlanRestrictionsStandard AppServicePlanRestrictions = "Standard" +) + +// PossibleAppServicePlanRestrictionsValues returns an array of possible values for the AppServicePlanRestrictions const type. +func PossibleAppServicePlanRestrictionsValues() []AppServicePlanRestrictions { + return []AppServicePlanRestrictions{AppServicePlanRestrictionsBasic, AppServicePlanRestrictionsFree, AppServicePlanRestrictionsNone, AppServicePlanRestrictionsPremium, AppServicePlanRestrictionsShared, AppServicePlanRestrictionsStandard} +} + +// AutoHealActionType enumerates the values for auto heal action type. +type AutoHealActionType string + +const ( + // AutoHealActionTypeCustomAction ... + AutoHealActionTypeCustomAction AutoHealActionType = "CustomAction" + // AutoHealActionTypeLogEvent ... + AutoHealActionTypeLogEvent AutoHealActionType = "LogEvent" + // AutoHealActionTypeRecycle ... + AutoHealActionTypeRecycle AutoHealActionType = "Recycle" +) + +// PossibleAutoHealActionTypeValues returns an array of possible values for the AutoHealActionType const type. +func PossibleAutoHealActionTypeValues() []AutoHealActionType { + return []AutoHealActionType{AutoHealActionTypeCustomAction, AutoHealActionTypeLogEvent, AutoHealActionTypeRecycle} +} + +// AzureResourceType enumerates the values for azure resource type. +type AzureResourceType string + +const ( + // AzureResourceTypeTrafficManager ... + AzureResourceTypeTrafficManager AzureResourceType = "TrafficManager" + // AzureResourceTypeWebsite ... + AzureResourceTypeWebsite AzureResourceType = "Website" +) + +// PossibleAzureResourceTypeValues returns an array of possible values for the AzureResourceType const type. +func PossibleAzureResourceTypeValues() []AzureResourceType { + return []AzureResourceType{AzureResourceTypeTrafficManager, AzureResourceTypeWebsite} +} + +// AzureStorageState enumerates the values for azure storage state. +type AzureStorageState string + +const ( + // AzureStorageStateInvalidCredentials ... + AzureStorageStateInvalidCredentials AzureStorageState = "InvalidCredentials" + // AzureStorageStateInvalidShare ... + AzureStorageStateInvalidShare AzureStorageState = "InvalidShare" + // AzureStorageStateNotValidated ... + AzureStorageStateNotValidated AzureStorageState = "NotValidated" + // AzureStorageStateOk ... + AzureStorageStateOk AzureStorageState = "Ok" +) + +// PossibleAzureStorageStateValues returns an array of possible values for the AzureStorageState const type. +func PossibleAzureStorageStateValues() []AzureStorageState { + return []AzureStorageState{AzureStorageStateInvalidCredentials, AzureStorageStateInvalidShare, AzureStorageStateNotValidated, AzureStorageStateOk} +} + +// AzureStorageType enumerates the values for azure storage type. +type AzureStorageType string + +const ( + // AzureStorageTypeAzureBlob ... + AzureStorageTypeAzureBlob AzureStorageType = "AzureBlob" + // AzureStorageTypeAzureFiles ... + AzureStorageTypeAzureFiles AzureStorageType = "AzureFiles" +) + +// PossibleAzureStorageTypeValues returns an array of possible values for the AzureStorageType const type. +func PossibleAzureStorageTypeValues() []AzureStorageType { + return []AzureStorageType{AzureStorageTypeAzureBlob, AzureStorageTypeAzureFiles} +} + +// BackupItemStatus enumerates the values for backup item status. +type BackupItemStatus string + +const ( + // BackupItemStatusCreated ... + BackupItemStatusCreated BackupItemStatus = "Created" + // BackupItemStatusDeleted ... + BackupItemStatusDeleted BackupItemStatus = "Deleted" + // BackupItemStatusDeleteFailed ... + BackupItemStatusDeleteFailed BackupItemStatus = "DeleteFailed" + // BackupItemStatusDeleteInProgress ... + BackupItemStatusDeleteInProgress BackupItemStatus = "DeleteInProgress" + // BackupItemStatusFailed ... + BackupItemStatusFailed BackupItemStatus = "Failed" + // BackupItemStatusInProgress ... + BackupItemStatusInProgress BackupItemStatus = "InProgress" + // BackupItemStatusPartiallySucceeded ... + BackupItemStatusPartiallySucceeded BackupItemStatus = "PartiallySucceeded" + // BackupItemStatusSkipped ... + BackupItemStatusSkipped BackupItemStatus = "Skipped" + // BackupItemStatusSucceeded ... + BackupItemStatusSucceeded BackupItemStatus = "Succeeded" + // BackupItemStatusTimedOut ... + BackupItemStatusTimedOut BackupItemStatus = "TimedOut" +) + +// PossibleBackupItemStatusValues returns an array of possible values for the BackupItemStatus const type. +func PossibleBackupItemStatusValues() []BackupItemStatus { + return []BackupItemStatus{BackupItemStatusCreated, BackupItemStatusDeleted, BackupItemStatusDeleteFailed, BackupItemStatusDeleteInProgress, BackupItemStatusFailed, BackupItemStatusInProgress, BackupItemStatusPartiallySucceeded, BackupItemStatusSkipped, BackupItemStatusSucceeded, BackupItemStatusTimedOut} +} + +// BackupRestoreOperationType enumerates the values for backup restore operation type. +type BackupRestoreOperationType string + +const ( + // BackupRestoreOperationTypeClone ... + BackupRestoreOperationTypeClone BackupRestoreOperationType = "Clone" + // BackupRestoreOperationTypeCloudFS ... + BackupRestoreOperationTypeCloudFS BackupRestoreOperationType = "CloudFS" + // BackupRestoreOperationTypeDefault ... + BackupRestoreOperationTypeDefault BackupRestoreOperationType = "Default" + // BackupRestoreOperationTypeRelocation ... + BackupRestoreOperationTypeRelocation BackupRestoreOperationType = "Relocation" + // BackupRestoreOperationTypeSnapshot ... + BackupRestoreOperationTypeSnapshot BackupRestoreOperationType = "Snapshot" +) + +// PossibleBackupRestoreOperationTypeValues returns an array of possible values for the BackupRestoreOperationType const type. +func PossibleBackupRestoreOperationTypeValues() []BackupRestoreOperationType { + return []BackupRestoreOperationType{BackupRestoreOperationTypeClone, BackupRestoreOperationTypeCloudFS, BackupRestoreOperationTypeDefault, BackupRestoreOperationTypeRelocation, BackupRestoreOperationTypeSnapshot} +} + +// BuildStatus enumerates the values for build status. +type BuildStatus string + +const ( + // BuildStatusDeleting ... + BuildStatusDeleting BuildStatus = "Deleting" + // BuildStatusDeploying ... + BuildStatusDeploying BuildStatus = "Deploying" + // BuildStatusDetached ... + BuildStatusDetached BuildStatus = "Detached" + // BuildStatusFailed ... + BuildStatusFailed BuildStatus = "Failed" + // BuildStatusReady ... + BuildStatusReady BuildStatus = "Ready" + // BuildStatusUploading ... + BuildStatusUploading BuildStatus = "Uploading" + // BuildStatusWaitingForDeployment ... + BuildStatusWaitingForDeployment BuildStatus = "WaitingForDeployment" +) + +// PossibleBuildStatusValues returns an array of possible values for the BuildStatus const type. +func PossibleBuildStatusValues() []BuildStatus { + return []BuildStatus{BuildStatusDeleting, BuildStatusDeploying, BuildStatusDetached, BuildStatusFailed, BuildStatusReady, BuildStatusUploading, BuildStatusWaitingForDeployment} +} + +// BuiltInAuthenticationProvider enumerates the values for built in authentication provider. +type BuiltInAuthenticationProvider string + +const ( + // BuiltInAuthenticationProviderAzureActiveDirectory ... + BuiltInAuthenticationProviderAzureActiveDirectory BuiltInAuthenticationProvider = "AzureActiveDirectory" + // BuiltInAuthenticationProviderFacebook ... + BuiltInAuthenticationProviderFacebook BuiltInAuthenticationProvider = "Facebook" + // BuiltInAuthenticationProviderGithub ... + BuiltInAuthenticationProviderGithub BuiltInAuthenticationProvider = "Github" + // BuiltInAuthenticationProviderGoogle ... + BuiltInAuthenticationProviderGoogle BuiltInAuthenticationProvider = "Google" + // BuiltInAuthenticationProviderMicrosoftAccount ... + BuiltInAuthenticationProviderMicrosoftAccount BuiltInAuthenticationProvider = "MicrosoftAccount" + // BuiltInAuthenticationProviderTwitter ... + BuiltInAuthenticationProviderTwitter BuiltInAuthenticationProvider = "Twitter" +) + +// PossibleBuiltInAuthenticationProviderValues returns an array of possible values for the BuiltInAuthenticationProvider const type. +func PossibleBuiltInAuthenticationProviderValues() []BuiltInAuthenticationProvider { + return []BuiltInAuthenticationProvider{BuiltInAuthenticationProviderAzureActiveDirectory, BuiltInAuthenticationProviderFacebook, BuiltInAuthenticationProviderGithub, BuiltInAuthenticationProviderGoogle, BuiltInAuthenticationProviderMicrosoftAccount, BuiltInAuthenticationProviderTwitter} +} + +// CertificateOrderActionType enumerates the values for certificate order action type. +type CertificateOrderActionType string + +const ( + // CertificateOrderActionTypeCertificateExpirationWarning ... + CertificateOrderActionTypeCertificateExpirationWarning CertificateOrderActionType = "CertificateExpirationWarning" + // CertificateOrderActionTypeCertificateExpired ... + CertificateOrderActionTypeCertificateExpired CertificateOrderActionType = "CertificateExpired" + // CertificateOrderActionTypeCertificateIssued ... + CertificateOrderActionTypeCertificateIssued CertificateOrderActionType = "CertificateIssued" + // CertificateOrderActionTypeCertificateOrderCanceled ... + CertificateOrderActionTypeCertificateOrderCanceled CertificateOrderActionType = "CertificateOrderCanceled" + // CertificateOrderActionTypeCertificateOrderCreated ... + CertificateOrderActionTypeCertificateOrderCreated CertificateOrderActionType = "CertificateOrderCreated" + // CertificateOrderActionTypeCertificateRevoked ... + CertificateOrderActionTypeCertificateRevoked CertificateOrderActionType = "CertificateRevoked" + // CertificateOrderActionTypeDomainValidationComplete ... + CertificateOrderActionTypeDomainValidationComplete CertificateOrderActionType = "DomainValidationComplete" + // CertificateOrderActionTypeFraudCleared ... + CertificateOrderActionTypeFraudCleared CertificateOrderActionType = "FraudCleared" + // CertificateOrderActionTypeFraudDetected ... + CertificateOrderActionTypeFraudDetected CertificateOrderActionType = "FraudDetected" + // CertificateOrderActionTypeFraudDocumentationRequired ... + CertificateOrderActionTypeFraudDocumentationRequired CertificateOrderActionType = "FraudDocumentationRequired" + // CertificateOrderActionTypeOrgNameChange ... + CertificateOrderActionTypeOrgNameChange CertificateOrderActionType = "OrgNameChange" + // CertificateOrderActionTypeOrgValidationComplete ... + CertificateOrderActionTypeOrgValidationComplete CertificateOrderActionType = "OrgValidationComplete" + // CertificateOrderActionTypeSanDrop ... + CertificateOrderActionTypeSanDrop CertificateOrderActionType = "SanDrop" + // CertificateOrderActionTypeUnknown ... + CertificateOrderActionTypeUnknown CertificateOrderActionType = "Unknown" +) + +// PossibleCertificateOrderActionTypeValues returns an array of possible values for the CertificateOrderActionType const type. +func PossibleCertificateOrderActionTypeValues() []CertificateOrderActionType { + return []CertificateOrderActionType{CertificateOrderActionTypeCertificateExpirationWarning, CertificateOrderActionTypeCertificateExpired, CertificateOrderActionTypeCertificateIssued, CertificateOrderActionTypeCertificateOrderCanceled, CertificateOrderActionTypeCertificateOrderCreated, CertificateOrderActionTypeCertificateRevoked, CertificateOrderActionTypeDomainValidationComplete, CertificateOrderActionTypeFraudCleared, CertificateOrderActionTypeFraudDetected, CertificateOrderActionTypeFraudDocumentationRequired, CertificateOrderActionTypeOrgNameChange, CertificateOrderActionTypeOrgValidationComplete, CertificateOrderActionTypeSanDrop, CertificateOrderActionTypeUnknown} +} + +// CertificateOrderStatus enumerates the values for certificate order status. +type CertificateOrderStatus string + +const ( + // CertificateOrderStatusCanceled ... + CertificateOrderStatusCanceled CertificateOrderStatus = "Canceled" + // CertificateOrderStatusDenied ... + CertificateOrderStatusDenied CertificateOrderStatus = "Denied" + // CertificateOrderStatusExpired ... + CertificateOrderStatusExpired CertificateOrderStatus = "Expired" + // CertificateOrderStatusIssued ... + CertificateOrderStatusIssued CertificateOrderStatus = "Issued" + // CertificateOrderStatusNotSubmitted ... + CertificateOrderStatusNotSubmitted CertificateOrderStatus = "NotSubmitted" + // CertificateOrderStatusPendingissuance ... + CertificateOrderStatusPendingissuance CertificateOrderStatus = "Pendingissuance" + // CertificateOrderStatusPendingRekey ... + CertificateOrderStatusPendingRekey CertificateOrderStatus = "PendingRekey" + // CertificateOrderStatusPendingrevocation ... + CertificateOrderStatusPendingrevocation CertificateOrderStatus = "Pendingrevocation" + // CertificateOrderStatusRevoked ... + CertificateOrderStatusRevoked CertificateOrderStatus = "Revoked" + // CertificateOrderStatusUnused ... + CertificateOrderStatusUnused CertificateOrderStatus = "Unused" +) + +// PossibleCertificateOrderStatusValues returns an array of possible values for the CertificateOrderStatus const type. +func PossibleCertificateOrderStatusValues() []CertificateOrderStatus { + return []CertificateOrderStatus{CertificateOrderStatusCanceled, CertificateOrderStatusDenied, CertificateOrderStatusExpired, CertificateOrderStatusIssued, CertificateOrderStatusNotSubmitted, CertificateOrderStatusPendingissuance, CertificateOrderStatusPendingRekey, CertificateOrderStatusPendingrevocation, CertificateOrderStatusRevoked, CertificateOrderStatusUnused} +} + +// CertificateProductType enumerates the values for certificate product type. +type CertificateProductType string + +const ( + // CertificateProductTypeStandardDomainValidatedSsl ... + CertificateProductTypeStandardDomainValidatedSsl CertificateProductType = "StandardDomainValidatedSsl" + // CertificateProductTypeStandardDomainValidatedWildCardSsl ... + CertificateProductTypeStandardDomainValidatedWildCardSsl CertificateProductType = "StandardDomainValidatedWildCardSsl" +) + +// PossibleCertificateProductTypeValues returns an array of possible values for the CertificateProductType const type. +func PossibleCertificateProductTypeValues() []CertificateProductType { + return []CertificateProductType{CertificateProductTypeStandardDomainValidatedSsl, CertificateProductTypeStandardDomainValidatedWildCardSsl} +} + +// Channels enumerates the values for channels. +type Channels string + +const ( + // ChannelsAll ... + ChannelsAll Channels = "All" + // ChannelsAPI ... + ChannelsAPI Channels = "Api" + // ChannelsEmail ... + ChannelsEmail Channels = "Email" + // ChannelsNotification ... + ChannelsNotification Channels = "Notification" + // ChannelsWebhook ... + ChannelsWebhook Channels = "Webhook" +) + +// PossibleChannelsValues returns an array of possible values for the Channels const type. +func PossibleChannelsValues() []Channels { + return []Channels{ChannelsAll, ChannelsAPI, ChannelsEmail, ChannelsNotification, ChannelsWebhook} +} + +// CheckNameResourceTypes enumerates the values for check name resource types. +type CheckNameResourceTypes string + +const ( + // CheckNameResourceTypesHostingEnvironment ... + CheckNameResourceTypesHostingEnvironment CheckNameResourceTypes = "HostingEnvironment" + // CheckNameResourceTypesMicrosoftWebhostingEnvironments ... + CheckNameResourceTypesMicrosoftWebhostingEnvironments CheckNameResourceTypes = "Microsoft.Web/hostingEnvironments" + // CheckNameResourceTypesMicrosoftWebpublishingUsers ... + CheckNameResourceTypesMicrosoftWebpublishingUsers CheckNameResourceTypes = "Microsoft.Web/publishingUsers" + // CheckNameResourceTypesMicrosoftWebsites ... + CheckNameResourceTypesMicrosoftWebsites CheckNameResourceTypes = "Microsoft.Web/sites" + // CheckNameResourceTypesMicrosoftWebsitesslots ... + CheckNameResourceTypesMicrosoftWebsitesslots CheckNameResourceTypes = "Microsoft.Web/sites/slots" + // CheckNameResourceTypesPublishingUser ... + CheckNameResourceTypesPublishingUser CheckNameResourceTypes = "PublishingUser" + // CheckNameResourceTypesSite ... + CheckNameResourceTypesSite CheckNameResourceTypes = "Site" + // CheckNameResourceTypesSlot ... + CheckNameResourceTypesSlot CheckNameResourceTypes = "Slot" +) + +// PossibleCheckNameResourceTypesValues returns an array of possible values for the CheckNameResourceTypes const type. +func PossibleCheckNameResourceTypesValues() []CheckNameResourceTypes { + return []CheckNameResourceTypes{CheckNameResourceTypesHostingEnvironment, CheckNameResourceTypesMicrosoftWebhostingEnvironments, CheckNameResourceTypesMicrosoftWebpublishingUsers, CheckNameResourceTypesMicrosoftWebsites, CheckNameResourceTypesMicrosoftWebsitesslots, CheckNameResourceTypesPublishingUser, CheckNameResourceTypesSite, CheckNameResourceTypesSlot} +} + +// ClientCertMode enumerates the values for client cert mode. +type ClientCertMode string + +const ( + // ClientCertModeOptional ... + ClientCertModeOptional ClientCertMode = "Optional" + // ClientCertModeOptionalInteractiveUser ... + ClientCertModeOptionalInteractiveUser ClientCertMode = "OptionalInteractiveUser" + // ClientCertModeRequired ... + ClientCertModeRequired ClientCertMode = "Required" +) + +// PossibleClientCertModeValues returns an array of possible values for the ClientCertMode const type. +func PossibleClientCertModeValues() []ClientCertMode { + return []ClientCertMode{ClientCertModeOptional, ClientCertModeOptionalInteractiveUser, ClientCertModeRequired} +} + +// ClientCredentialMethod enumerates the values for client credential method. +type ClientCredentialMethod string + +const ( + // ClientCredentialMethodClientSecretPost ... + ClientCredentialMethodClientSecretPost ClientCredentialMethod = "ClientSecretPost" +) + +// PossibleClientCredentialMethodValues returns an array of possible values for the ClientCredentialMethod const type. +func PossibleClientCredentialMethodValues() []ClientCredentialMethod { + return []ClientCredentialMethod{ClientCredentialMethodClientSecretPost} +} + +// CloneAbilityResult enumerates the values for clone ability result. +type CloneAbilityResult string + +const ( + // CloneAbilityResultCloneable ... + CloneAbilityResultCloneable CloneAbilityResult = "Cloneable" + // CloneAbilityResultNotCloneable ... + CloneAbilityResultNotCloneable CloneAbilityResult = "NotCloneable" + // CloneAbilityResultPartiallyCloneable ... + CloneAbilityResultPartiallyCloneable CloneAbilityResult = "PartiallyCloneable" +) + +// PossibleCloneAbilityResultValues returns an array of possible values for the CloneAbilityResult const type. +func PossibleCloneAbilityResultValues() []CloneAbilityResult { + return []CloneAbilityResult{CloneAbilityResultCloneable, CloneAbilityResultNotCloneable, CloneAbilityResultPartiallyCloneable} +} + +// ComputeModeOptions enumerates the values for compute mode options. +type ComputeModeOptions string + +const ( + // ComputeModeOptionsDedicated ... + ComputeModeOptionsDedicated ComputeModeOptions = "Dedicated" + // ComputeModeOptionsDynamic ... + ComputeModeOptionsDynamic ComputeModeOptions = "Dynamic" + // ComputeModeOptionsShared ... + ComputeModeOptionsShared ComputeModeOptions = "Shared" +) + +// PossibleComputeModeOptionsValues returns an array of possible values for the ComputeModeOptions const type. +func PossibleComputeModeOptionsValues() []ComputeModeOptions { + return []ComputeModeOptions{ComputeModeOptionsDedicated, ComputeModeOptionsDynamic, ComputeModeOptionsShared} +} + +// ConfigReferenceSource enumerates the values for config reference source. +type ConfigReferenceSource string + +const ( + // ConfigReferenceSourceKeyVault ... + ConfigReferenceSourceKeyVault ConfigReferenceSource = "KeyVault" +) + +// PossibleConfigReferenceSourceValues returns an array of possible values for the ConfigReferenceSource const type. +func PossibleConfigReferenceSourceValues() []ConfigReferenceSource { + return []ConfigReferenceSource{ConfigReferenceSourceKeyVault} +} + +// ConnectionStringType enumerates the values for connection string type. +type ConnectionStringType string + +const ( + // ConnectionStringTypeAPIHub ... + ConnectionStringTypeAPIHub ConnectionStringType = "ApiHub" + // ConnectionStringTypeCustom ... + ConnectionStringTypeCustom ConnectionStringType = "Custom" + // ConnectionStringTypeDocDb ... + ConnectionStringTypeDocDb ConnectionStringType = "DocDb" + // ConnectionStringTypeEventHub ... + ConnectionStringTypeEventHub ConnectionStringType = "EventHub" + // ConnectionStringTypeMySQL ... + ConnectionStringTypeMySQL ConnectionStringType = "MySql" + // ConnectionStringTypeNotificationHub ... + ConnectionStringTypeNotificationHub ConnectionStringType = "NotificationHub" + // ConnectionStringTypePostgreSQL ... + ConnectionStringTypePostgreSQL ConnectionStringType = "PostgreSQL" + // ConnectionStringTypeRedisCache ... + ConnectionStringTypeRedisCache ConnectionStringType = "RedisCache" + // ConnectionStringTypeServiceBus ... + ConnectionStringTypeServiceBus ConnectionStringType = "ServiceBus" + // ConnectionStringTypeSQLAzure ... + ConnectionStringTypeSQLAzure ConnectionStringType = "SQLAzure" + // ConnectionStringTypeSQLServer ... + ConnectionStringTypeSQLServer ConnectionStringType = "SQLServer" +) + +// PossibleConnectionStringTypeValues returns an array of possible values for the ConnectionStringType const type. +func PossibleConnectionStringTypeValues() []ConnectionStringType { + return []ConnectionStringType{ConnectionStringTypeAPIHub, ConnectionStringTypeCustom, ConnectionStringTypeDocDb, ConnectionStringTypeEventHub, ConnectionStringTypeMySQL, ConnectionStringTypeNotificationHub, ConnectionStringTypePostgreSQL, ConnectionStringTypeRedisCache, ConnectionStringTypeServiceBus, ConnectionStringTypeSQLAzure, ConnectionStringTypeSQLServer} +} + +// ContainerAppProvisioningState enumerates the values for container app provisioning state. +type ContainerAppProvisioningState string + +const ( + // ContainerAppProvisioningStateCanceled ... + ContainerAppProvisioningStateCanceled ContainerAppProvisioningState = "Canceled" + // ContainerAppProvisioningStateFailed ... + ContainerAppProvisioningStateFailed ContainerAppProvisioningState = "Failed" + // ContainerAppProvisioningStateInProgress ... + ContainerAppProvisioningStateInProgress ContainerAppProvisioningState = "InProgress" + // ContainerAppProvisioningStateSucceeded ... + ContainerAppProvisioningStateSucceeded ContainerAppProvisioningState = "Succeeded" +) + +// PossibleContainerAppProvisioningStateValues returns an array of possible values for the ContainerAppProvisioningState const type. +func PossibleContainerAppProvisioningStateValues() []ContainerAppProvisioningState { + return []ContainerAppProvisioningState{ContainerAppProvisioningStateCanceled, ContainerAppProvisioningStateFailed, ContainerAppProvisioningStateInProgress, ContainerAppProvisioningStateSucceeded} +} + +// ContinuousWebJobStatus enumerates the values for continuous web job status. +type ContinuousWebJobStatus string + +const ( + // ContinuousWebJobStatusInitializing ... + ContinuousWebJobStatusInitializing ContinuousWebJobStatus = "Initializing" + // ContinuousWebJobStatusPendingRestart ... + ContinuousWebJobStatusPendingRestart ContinuousWebJobStatus = "PendingRestart" + // ContinuousWebJobStatusRunning ... + ContinuousWebJobStatusRunning ContinuousWebJobStatus = "Running" + // ContinuousWebJobStatusStarting ... + ContinuousWebJobStatusStarting ContinuousWebJobStatus = "Starting" + // ContinuousWebJobStatusStopped ... + ContinuousWebJobStatusStopped ContinuousWebJobStatus = "Stopped" +) + +// PossibleContinuousWebJobStatusValues returns an array of possible values for the ContinuousWebJobStatus const type. +func PossibleContinuousWebJobStatusValues() []ContinuousWebJobStatus { + return []ContinuousWebJobStatus{ContinuousWebJobStatusInitializing, ContinuousWebJobStatusPendingRestart, ContinuousWebJobStatusRunning, ContinuousWebJobStatusStarting, ContinuousWebJobStatusStopped} +} + +// CookieExpirationConvention enumerates the values for cookie expiration convention. +type CookieExpirationConvention string + +const ( + // CookieExpirationConventionFixedTime ... + CookieExpirationConventionFixedTime CookieExpirationConvention = "FixedTime" + // CookieExpirationConventionIdentityProviderDerived ... + CookieExpirationConventionIdentityProviderDerived CookieExpirationConvention = "IdentityProviderDerived" +) + +// PossibleCookieExpirationConventionValues returns an array of possible values for the CookieExpirationConvention const type. +func PossibleCookieExpirationConventionValues() []CookieExpirationConvention { + return []CookieExpirationConvention{CookieExpirationConventionFixedTime, CookieExpirationConventionIdentityProviderDerived} +} + +// CustomDomainStatus enumerates the values for custom domain status. +type CustomDomainStatus string + +const ( + // CustomDomainStatusAdding ... + CustomDomainStatusAdding CustomDomainStatus = "Adding" + // CustomDomainStatusDeleting ... + CustomDomainStatusDeleting CustomDomainStatus = "Deleting" + // CustomDomainStatusFailed ... + CustomDomainStatusFailed CustomDomainStatus = "Failed" + // CustomDomainStatusReady ... + CustomDomainStatusReady CustomDomainStatus = "Ready" + // CustomDomainStatusRetrievingValidationToken ... + CustomDomainStatusRetrievingValidationToken CustomDomainStatus = "RetrievingValidationToken" + // CustomDomainStatusValidating ... + CustomDomainStatusValidating CustomDomainStatus = "Validating" +) + +// PossibleCustomDomainStatusValues returns an array of possible values for the CustomDomainStatus const type. +func PossibleCustomDomainStatusValues() []CustomDomainStatus { + return []CustomDomainStatus{CustomDomainStatusAdding, CustomDomainStatusDeleting, CustomDomainStatusFailed, CustomDomainStatusReady, CustomDomainStatusRetrievingValidationToken, CustomDomainStatusValidating} +} + +// CustomHostNameDNSRecordType enumerates the values for custom host name dns record type. +type CustomHostNameDNSRecordType string + +const ( + // CustomHostNameDNSRecordTypeA ... + CustomHostNameDNSRecordTypeA CustomHostNameDNSRecordType = "A" + // CustomHostNameDNSRecordTypeCName ... + CustomHostNameDNSRecordTypeCName CustomHostNameDNSRecordType = "CName" +) + +// PossibleCustomHostNameDNSRecordTypeValues returns an array of possible values for the CustomHostNameDNSRecordType const type. +func PossibleCustomHostNameDNSRecordTypeValues() []CustomHostNameDNSRecordType { + return []CustomHostNameDNSRecordType{CustomHostNameDNSRecordTypeA, CustomHostNameDNSRecordTypeCName} +} + +// DatabaseType enumerates the values for database type. +type DatabaseType string + +const ( + // DatabaseTypeLocalMySQL ... + DatabaseTypeLocalMySQL DatabaseType = "LocalMySql" + // DatabaseTypeMySQL ... + DatabaseTypeMySQL DatabaseType = "MySql" + // DatabaseTypePostgreSQL ... + DatabaseTypePostgreSQL DatabaseType = "PostgreSql" + // DatabaseTypeSQLAzure ... + DatabaseTypeSQLAzure DatabaseType = "SqlAzure" +) + +// PossibleDatabaseTypeValues returns an array of possible values for the DatabaseType const type. +func PossibleDatabaseTypeValues() []DatabaseType { + return []DatabaseType{DatabaseTypeLocalMySQL, DatabaseTypeMySQL, DatabaseTypePostgreSQL, DatabaseTypeSQLAzure} +} + +// DetectorType enumerates the values for detector type. +type DetectorType string + +const ( + // DetectorTypeAnalysis ... + DetectorTypeAnalysis DetectorType = "Analysis" + // DetectorTypeCategoryOverview ... + DetectorTypeCategoryOverview DetectorType = "CategoryOverview" + // DetectorTypeDetector ... + DetectorTypeDetector DetectorType = "Detector" +) + +// PossibleDetectorTypeValues returns an array of possible values for the DetectorType const type. +func PossibleDetectorTypeValues() []DetectorType { + return []DetectorType{DetectorTypeAnalysis, DetectorTypeCategoryOverview, DetectorTypeDetector} +} + +// DNSType enumerates the values for dns type. +type DNSType string + +const ( + // DNSTypeAzureDNS ... + DNSTypeAzureDNS DNSType = "AzureDns" + // DNSTypeDefaultDomainRegistrarDNS ... + DNSTypeDefaultDomainRegistrarDNS DNSType = "DefaultDomainRegistrarDns" +) + +// PossibleDNSTypeValues returns an array of possible values for the DNSType const type. +func PossibleDNSTypeValues() []DNSType { + return []DNSType{DNSTypeAzureDNS, DNSTypeDefaultDomainRegistrarDNS} +} + +// DNSVerificationTestResult enumerates the values for dns verification test result. +type DNSVerificationTestResult string + +const ( + // DNSVerificationTestResultFailed ... + DNSVerificationTestResultFailed DNSVerificationTestResult = "Failed" + // DNSVerificationTestResultPassed ... + DNSVerificationTestResultPassed DNSVerificationTestResult = "Passed" + // DNSVerificationTestResultSkipped ... + DNSVerificationTestResultSkipped DNSVerificationTestResult = "Skipped" +) + +// PossibleDNSVerificationTestResultValues returns an array of possible values for the DNSVerificationTestResult const type. +func PossibleDNSVerificationTestResultValues() []DNSVerificationTestResult { + return []DNSVerificationTestResult{DNSVerificationTestResultFailed, DNSVerificationTestResultPassed, DNSVerificationTestResultSkipped} +} + +// DomainStatus enumerates the values for domain status. +type DomainStatus string + +const ( + // DomainStatusActive ... + DomainStatusActive DomainStatus = "Active" + // DomainStatusAwaiting ... + DomainStatusAwaiting DomainStatus = "Awaiting" + // DomainStatusCancelled ... + DomainStatusCancelled DomainStatus = "Cancelled" + // DomainStatusConfiscated ... + DomainStatusConfiscated DomainStatus = "Confiscated" + // DomainStatusDisabled ... + DomainStatusDisabled DomainStatus = "Disabled" + // DomainStatusExcluded ... + DomainStatusExcluded DomainStatus = "Excluded" + // DomainStatusExpired ... + DomainStatusExpired DomainStatus = "Expired" + // DomainStatusFailed ... + DomainStatusFailed DomainStatus = "Failed" + // DomainStatusHeld ... + DomainStatusHeld DomainStatus = "Held" + // DomainStatusJSONConverterFailed ... + DomainStatusJSONConverterFailed DomainStatus = "JsonConverterFailed" + // DomainStatusLocked ... + DomainStatusLocked DomainStatus = "Locked" + // DomainStatusParked ... + DomainStatusParked DomainStatus = "Parked" + // DomainStatusPending ... + DomainStatusPending DomainStatus = "Pending" + // DomainStatusReserved ... + DomainStatusReserved DomainStatus = "Reserved" + // DomainStatusReverted ... + DomainStatusReverted DomainStatus = "Reverted" + // DomainStatusSuspended ... + DomainStatusSuspended DomainStatus = "Suspended" + // DomainStatusTransferred ... + DomainStatusTransferred DomainStatus = "Transferred" + // DomainStatusUnknown ... + DomainStatusUnknown DomainStatus = "Unknown" + // DomainStatusUnlocked ... + DomainStatusUnlocked DomainStatus = "Unlocked" + // DomainStatusUnparked ... + DomainStatusUnparked DomainStatus = "Unparked" + // DomainStatusUpdated ... + DomainStatusUpdated DomainStatus = "Updated" +) + +// PossibleDomainStatusValues returns an array of possible values for the DomainStatus const type. +func PossibleDomainStatusValues() []DomainStatus { + return []DomainStatus{DomainStatusActive, DomainStatusAwaiting, DomainStatusCancelled, DomainStatusConfiscated, DomainStatusDisabled, DomainStatusExcluded, DomainStatusExpired, DomainStatusFailed, DomainStatusHeld, DomainStatusJSONConverterFailed, DomainStatusLocked, DomainStatusParked, DomainStatusPending, DomainStatusReserved, DomainStatusReverted, DomainStatusSuspended, DomainStatusTransferred, DomainStatusUnknown, DomainStatusUnlocked, DomainStatusUnparked, DomainStatusUpdated} +} + +// DomainType enumerates the values for domain type. +type DomainType string + +const ( + // DomainTypeRegular ... + DomainTypeRegular DomainType = "Regular" + // DomainTypeSoftDeleted ... + DomainTypeSoftDeleted DomainType = "SoftDeleted" +) + +// PossibleDomainTypeValues returns an array of possible values for the DomainType const type. +func PossibleDomainTypeValues() []DomainType { + return []DomainType{DomainTypeRegular, DomainTypeSoftDeleted} +} + +// EnterpriseGradeCdnStatus enumerates the values for enterprise grade cdn status. +type EnterpriseGradeCdnStatus string + +const ( + // EnterpriseGradeCdnStatusDisabled ... + EnterpriseGradeCdnStatusDisabled EnterpriseGradeCdnStatus = "Disabled" + // EnterpriseGradeCdnStatusDisabling ... + EnterpriseGradeCdnStatusDisabling EnterpriseGradeCdnStatus = "Disabling" + // EnterpriseGradeCdnStatusEnabled ... + EnterpriseGradeCdnStatusEnabled EnterpriseGradeCdnStatus = "Enabled" + // EnterpriseGradeCdnStatusEnabling ... + EnterpriseGradeCdnStatusEnabling EnterpriseGradeCdnStatus = "Enabling" +) + +// PossibleEnterpriseGradeCdnStatusValues returns an array of possible values for the EnterpriseGradeCdnStatus const type. +func PossibleEnterpriseGradeCdnStatusValues() []EnterpriseGradeCdnStatus { + return []EnterpriseGradeCdnStatus{EnterpriseGradeCdnStatusDisabled, EnterpriseGradeCdnStatusDisabling, EnterpriseGradeCdnStatusEnabled, EnterpriseGradeCdnStatusEnabling} +} + +// ForwardProxyConvention enumerates the values for forward proxy convention. +type ForwardProxyConvention string + +const ( + // ForwardProxyConventionCustom ... + ForwardProxyConventionCustom ForwardProxyConvention = "Custom" + // ForwardProxyConventionNoProxy ... + ForwardProxyConventionNoProxy ForwardProxyConvention = "NoProxy" + // ForwardProxyConventionStandard ... + ForwardProxyConventionStandard ForwardProxyConvention = "Standard" +) + +// PossibleForwardProxyConventionValues returns an array of possible values for the ForwardProxyConvention const type. +func PossibleForwardProxyConventionValues() []ForwardProxyConvention { + return []ForwardProxyConvention{ForwardProxyConventionCustom, ForwardProxyConventionNoProxy, ForwardProxyConventionStandard} +} + +// FrequencyUnit enumerates the values for frequency unit. +type FrequencyUnit string + +const ( + // FrequencyUnitDay ... + FrequencyUnitDay FrequencyUnit = "Day" + // FrequencyUnitHour ... + FrequencyUnitHour FrequencyUnit = "Hour" +) + +// PossibleFrequencyUnitValues returns an array of possible values for the FrequencyUnit const type. +func PossibleFrequencyUnitValues() []FrequencyUnit { + return []FrequencyUnit{FrequencyUnitDay, FrequencyUnitHour} +} + +// FrontEndServiceType enumerates the values for front end service type. +type FrontEndServiceType string + +const ( + // FrontEndServiceTypeLoadBalancer ... + FrontEndServiceTypeLoadBalancer FrontEndServiceType = "LoadBalancer" + // FrontEndServiceTypeNodePort ... + FrontEndServiceTypeNodePort FrontEndServiceType = "NodePort" +) + +// PossibleFrontEndServiceTypeValues returns an array of possible values for the FrontEndServiceType const type. +func PossibleFrontEndServiceTypeValues() []FrontEndServiceType { + return []FrontEndServiceType{FrontEndServiceTypeLoadBalancer, FrontEndServiceTypeNodePort} +} + +// FtpsState enumerates the values for ftps state. +type FtpsState string + +const ( + // FtpsStateAllAllowed ... + FtpsStateAllAllowed FtpsState = "AllAllowed" + // FtpsStateDisabled ... + FtpsStateDisabled FtpsState = "Disabled" + // FtpsStateFtpsOnly ... + FtpsStateFtpsOnly FtpsState = "FtpsOnly" +) + +// PossibleFtpsStateValues returns an array of possible values for the FtpsState const type. +func PossibleFtpsStateValues() []FtpsState { + return []FtpsState{FtpsStateAllAllowed, FtpsStateDisabled, FtpsStateFtpsOnly} +} + +// HostingEnvironmentStatus enumerates the values for hosting environment status. +type HostingEnvironmentStatus string + +const ( + // HostingEnvironmentStatusDeleting ... + HostingEnvironmentStatusDeleting HostingEnvironmentStatus = "Deleting" + // HostingEnvironmentStatusPreparing ... + HostingEnvironmentStatusPreparing HostingEnvironmentStatus = "Preparing" + // HostingEnvironmentStatusReady ... + HostingEnvironmentStatusReady HostingEnvironmentStatus = "Ready" + // HostingEnvironmentStatusScaling ... + HostingEnvironmentStatusScaling HostingEnvironmentStatus = "Scaling" +) + +// PossibleHostingEnvironmentStatusValues returns an array of possible values for the HostingEnvironmentStatus const type. +func PossibleHostingEnvironmentStatusValues() []HostingEnvironmentStatus { + return []HostingEnvironmentStatus{HostingEnvironmentStatusDeleting, HostingEnvironmentStatusPreparing, HostingEnvironmentStatusReady, HostingEnvironmentStatusScaling} +} + +// HostNameType enumerates the values for host name type. +type HostNameType string + +const ( + // HostNameTypeManaged ... + HostNameTypeManaged HostNameType = "Managed" + // HostNameTypeVerified ... + HostNameTypeVerified HostNameType = "Verified" +) + +// PossibleHostNameTypeValues returns an array of possible values for the HostNameType const type. +func PossibleHostNameTypeValues() []HostNameType { + return []HostNameType{HostNameTypeManaged, HostNameTypeVerified} +} + +// HostType enumerates the values for host type. +type HostType string + +const ( + // HostTypeRepository ... + HostTypeRepository HostType = "Repository" + // HostTypeStandard ... + HostTypeStandard HostType = "Standard" +) + +// PossibleHostTypeValues returns an array of possible values for the HostType const type. +func PossibleHostTypeValues() []HostType { + return []HostType{HostTypeRepository, HostTypeStandard} +} + +// InAvailabilityReasonType enumerates the values for in availability reason type. +type InAvailabilityReasonType string + +const ( + // InAvailabilityReasonTypeAlreadyExists ... + InAvailabilityReasonTypeAlreadyExists InAvailabilityReasonType = "AlreadyExists" + // InAvailabilityReasonTypeInvalid ... + InAvailabilityReasonTypeInvalid InAvailabilityReasonType = "Invalid" +) + +// PossibleInAvailabilityReasonTypeValues returns an array of possible values for the InAvailabilityReasonType const type. +func PossibleInAvailabilityReasonTypeValues() []InAvailabilityReasonType { + return []InAvailabilityReasonType{InAvailabilityReasonTypeAlreadyExists, InAvailabilityReasonTypeInvalid} +} + +// IngressTransportMethod enumerates the values for ingress transport method. +type IngressTransportMethod string + +const ( + // IngressTransportMethodAuto ... + IngressTransportMethodAuto IngressTransportMethod = "auto" + // IngressTransportMethodHTTP ... + IngressTransportMethodHTTP IngressTransportMethod = "http" + // IngressTransportMethodHTTP2 ... + IngressTransportMethodHTTP2 IngressTransportMethod = "http2" +) + +// PossibleIngressTransportMethodValues returns an array of possible values for the IngressTransportMethod const type. +func PossibleIngressTransportMethodValues() []IngressTransportMethod { + return []IngressTransportMethod{IngressTransportMethodAuto, IngressTransportMethodHTTP, IngressTransportMethodHTTP2} +} + +// InsightStatus enumerates the values for insight status. +type InsightStatus string + +const ( + // InsightStatusCritical ... + InsightStatusCritical InsightStatus = "Critical" + // InsightStatusInfo ... + InsightStatusInfo InsightStatus = "Info" + // InsightStatusNone ... + InsightStatusNone InsightStatus = "None" + // InsightStatusSuccess ... + InsightStatusSuccess InsightStatus = "Success" + // InsightStatusWarning ... + InsightStatusWarning InsightStatus = "Warning" +) + +// PossibleInsightStatusValues returns an array of possible values for the InsightStatus const type. +func PossibleInsightStatusValues() []InsightStatus { + return []InsightStatus{InsightStatusCritical, InsightStatusInfo, InsightStatusNone, InsightStatusSuccess, InsightStatusWarning} +} + +// IPFilterTag enumerates the values for ip filter tag. +type IPFilterTag string + +const ( + // IPFilterTagDefault ... + IPFilterTagDefault IPFilterTag = "Default" + // IPFilterTagServiceTag ... + IPFilterTagServiceTag IPFilterTag = "ServiceTag" + // IPFilterTagXffProxy ... + IPFilterTagXffProxy IPFilterTag = "XffProxy" +) + +// PossibleIPFilterTagValues returns an array of possible values for the IPFilterTag const type. +func PossibleIPFilterTagValues() []IPFilterTag { + return []IPFilterTag{IPFilterTagDefault, IPFilterTagServiceTag, IPFilterTagXffProxy} +} + +// IssueType enumerates the values for issue type. +type IssueType string + +const ( + // IssueTypeAppCrash ... + IssueTypeAppCrash IssueType = "AppCrash" + // IssueTypeAppDeployment ... + IssueTypeAppDeployment IssueType = "AppDeployment" + // IssueTypeAseDeployment ... + IssueTypeAseDeployment IssueType = "AseDeployment" + // IssueTypeOther ... + IssueTypeOther IssueType = "Other" + // IssueTypePlatformIssue ... + IssueTypePlatformIssue IssueType = "PlatformIssue" + // IssueTypeRuntimeIssueDetected ... + IssueTypeRuntimeIssueDetected IssueType = "RuntimeIssueDetected" + // IssueTypeServiceIncident ... + IssueTypeServiceIncident IssueType = "ServiceIncident" + // IssueTypeUserIssue ... + IssueTypeUserIssue IssueType = "UserIssue" +) + +// PossibleIssueTypeValues returns an array of possible values for the IssueType const type. +func PossibleIssueTypeValues() []IssueType { + return []IssueType{IssueTypeAppCrash, IssueTypeAppDeployment, IssueTypeAseDeployment, IssueTypeOther, IssueTypePlatformIssue, IssueTypeRuntimeIssueDetected, IssueTypeServiceIncident, IssueTypeUserIssue} +} + +// JobType enumerates the values for job type. +type JobType string + +const ( + // JobTypeContinuous ... + JobTypeContinuous JobType = "Continuous" + // JobTypeTriggered ... + JobTypeTriggered JobType = "Triggered" +) + +// PossibleJobTypeValues returns an array of possible values for the JobType const type. +func PossibleJobTypeValues() []JobType { + return []JobType{JobTypeContinuous, JobTypeTriggered} +} + +// KeyVaultSecretStatus enumerates the values for key vault secret status. +type KeyVaultSecretStatus string + +const ( + // KeyVaultSecretStatusAzureServiceUnauthorizedToAccessKeyVault ... + KeyVaultSecretStatusAzureServiceUnauthorizedToAccessKeyVault KeyVaultSecretStatus = "AzureServiceUnauthorizedToAccessKeyVault" + // KeyVaultSecretStatusCertificateOrderFailed ... + KeyVaultSecretStatusCertificateOrderFailed KeyVaultSecretStatus = "CertificateOrderFailed" + // KeyVaultSecretStatusExternalPrivateKey ... + KeyVaultSecretStatusExternalPrivateKey KeyVaultSecretStatus = "ExternalPrivateKey" + // KeyVaultSecretStatusInitialized ... + KeyVaultSecretStatusInitialized KeyVaultSecretStatus = "Initialized" + // KeyVaultSecretStatusKeyVaultDoesNotExist ... + KeyVaultSecretStatusKeyVaultDoesNotExist KeyVaultSecretStatus = "KeyVaultDoesNotExist" + // KeyVaultSecretStatusKeyVaultSecretDoesNotExist ... + KeyVaultSecretStatusKeyVaultSecretDoesNotExist KeyVaultSecretStatus = "KeyVaultSecretDoesNotExist" + // KeyVaultSecretStatusOperationNotPermittedOnKeyVault ... + KeyVaultSecretStatusOperationNotPermittedOnKeyVault KeyVaultSecretStatus = "OperationNotPermittedOnKeyVault" + // KeyVaultSecretStatusSucceeded ... + KeyVaultSecretStatusSucceeded KeyVaultSecretStatus = "Succeeded" + // KeyVaultSecretStatusUnknown ... + KeyVaultSecretStatusUnknown KeyVaultSecretStatus = "Unknown" + // KeyVaultSecretStatusUnknownError ... + KeyVaultSecretStatusUnknownError KeyVaultSecretStatus = "UnknownError" + // KeyVaultSecretStatusWaitingOnCertificateOrder ... + KeyVaultSecretStatusWaitingOnCertificateOrder KeyVaultSecretStatus = "WaitingOnCertificateOrder" +) + +// PossibleKeyVaultSecretStatusValues returns an array of possible values for the KeyVaultSecretStatus const type. +func PossibleKeyVaultSecretStatusValues() []KeyVaultSecretStatus { + return []KeyVaultSecretStatus{KeyVaultSecretStatusAzureServiceUnauthorizedToAccessKeyVault, KeyVaultSecretStatusCertificateOrderFailed, KeyVaultSecretStatusExternalPrivateKey, KeyVaultSecretStatusInitialized, KeyVaultSecretStatusKeyVaultDoesNotExist, KeyVaultSecretStatusKeyVaultSecretDoesNotExist, KeyVaultSecretStatusOperationNotPermittedOnKeyVault, KeyVaultSecretStatusSucceeded, KeyVaultSecretStatusUnknown, KeyVaultSecretStatusUnknownError, KeyVaultSecretStatusWaitingOnCertificateOrder} +} + +// KubeEnvironmentProvisioningState enumerates the values for kube environment provisioning state. +type KubeEnvironmentProvisioningState string + +const ( + // KubeEnvironmentProvisioningStateCanceled ... + KubeEnvironmentProvisioningStateCanceled KubeEnvironmentProvisioningState = "Canceled" + // KubeEnvironmentProvisioningStateFailed ... + KubeEnvironmentProvisioningStateFailed KubeEnvironmentProvisioningState = "Failed" + // KubeEnvironmentProvisioningStateInfrastructureSetupComplete ... + KubeEnvironmentProvisioningStateInfrastructureSetupComplete KubeEnvironmentProvisioningState = "InfrastructureSetupComplete" + // KubeEnvironmentProvisioningStateInfrastructureSetupInProgress ... + KubeEnvironmentProvisioningStateInfrastructureSetupInProgress KubeEnvironmentProvisioningState = "InfrastructureSetupInProgress" + // KubeEnvironmentProvisioningStateInitializationInProgress ... + KubeEnvironmentProvisioningStateInitializationInProgress KubeEnvironmentProvisioningState = "InitializationInProgress" + // KubeEnvironmentProvisioningStateScheduledForDelete ... + KubeEnvironmentProvisioningStateScheduledForDelete KubeEnvironmentProvisioningState = "ScheduledForDelete" + // KubeEnvironmentProvisioningStateSucceeded ... + KubeEnvironmentProvisioningStateSucceeded KubeEnvironmentProvisioningState = "Succeeded" + // KubeEnvironmentProvisioningStateUpgradeFailed ... + KubeEnvironmentProvisioningStateUpgradeFailed KubeEnvironmentProvisioningState = "UpgradeFailed" + // KubeEnvironmentProvisioningStateUpgradeRequested ... + KubeEnvironmentProvisioningStateUpgradeRequested KubeEnvironmentProvisioningState = "UpgradeRequested" + // KubeEnvironmentProvisioningStateWaiting ... + KubeEnvironmentProvisioningStateWaiting KubeEnvironmentProvisioningState = "Waiting" +) + +// PossibleKubeEnvironmentProvisioningStateValues returns an array of possible values for the KubeEnvironmentProvisioningState const type. +func PossibleKubeEnvironmentProvisioningStateValues() []KubeEnvironmentProvisioningState { + return []KubeEnvironmentProvisioningState{KubeEnvironmentProvisioningStateCanceled, KubeEnvironmentProvisioningStateFailed, KubeEnvironmentProvisioningStateInfrastructureSetupComplete, KubeEnvironmentProvisioningStateInfrastructureSetupInProgress, KubeEnvironmentProvisioningStateInitializationInProgress, KubeEnvironmentProvisioningStateScheduledForDelete, KubeEnvironmentProvisioningStateSucceeded, KubeEnvironmentProvisioningStateUpgradeFailed, KubeEnvironmentProvisioningStateUpgradeRequested, KubeEnvironmentProvisioningStateWaiting} +} + +// LoadBalancingMode enumerates the values for load balancing mode. +type LoadBalancingMode string + +const ( + // LoadBalancingModeNone ... + LoadBalancingModeNone LoadBalancingMode = "None" + // LoadBalancingModePublishing ... + LoadBalancingModePublishing LoadBalancingMode = "Publishing" + // LoadBalancingModeWeb ... + LoadBalancingModeWeb LoadBalancingMode = "Web" + // LoadBalancingModeWebPublishing ... + LoadBalancingModeWebPublishing LoadBalancingMode = "Web, Publishing" +) + +// PossibleLoadBalancingModeValues returns an array of possible values for the LoadBalancingMode const type. +func PossibleLoadBalancingModeValues() []LoadBalancingMode { + return []LoadBalancingMode{LoadBalancingModeNone, LoadBalancingModePublishing, LoadBalancingModeWeb, LoadBalancingModeWebPublishing} +} + +// LogLevel enumerates the values for log level. +type LogLevel string + +const ( + // LogLevelError ... + LogLevelError LogLevel = "Error" + // LogLevelInformation ... + LogLevelInformation LogLevel = "Information" + // LogLevelOff ... + LogLevelOff LogLevel = "Off" + // LogLevelVerbose ... + LogLevelVerbose LogLevel = "Verbose" + // LogLevelWarning ... + LogLevelWarning LogLevel = "Warning" +) + +// PossibleLogLevelValues returns an array of possible values for the LogLevel const type. +func PossibleLogLevelValues() []LogLevel { + return []LogLevel{LogLevelError, LogLevelInformation, LogLevelOff, LogLevelVerbose, LogLevelWarning} +} + +// ManagedPipelineMode enumerates the values for managed pipeline mode. +type ManagedPipelineMode string + +const ( + // ManagedPipelineModeClassic ... + ManagedPipelineModeClassic ManagedPipelineMode = "Classic" + // ManagedPipelineModeIntegrated ... + ManagedPipelineModeIntegrated ManagedPipelineMode = "Integrated" +) + +// PossibleManagedPipelineModeValues returns an array of possible values for the ManagedPipelineMode const type. +func PossibleManagedPipelineModeValues() []ManagedPipelineMode { + return []ManagedPipelineMode{ManagedPipelineModeClassic, ManagedPipelineModeIntegrated} +} + +// ManagedServiceIdentityType enumerates the values for managed service identity type. +type ManagedServiceIdentityType string + +const ( + // ManagedServiceIdentityTypeNone ... + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + // ManagedServiceIdentityTypeSystemAssigned ... + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeSystemAssignedUserAssigned ... + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned, UserAssigned" + // ManagedServiceIdentityTypeUserAssigned ... + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns an array of possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ManagedServiceIdentityTypeNone, ManagedServiceIdentityTypeSystemAssigned, ManagedServiceIdentityTypeSystemAssignedUserAssigned, ManagedServiceIdentityTypeUserAssigned} +} + +// MSDeployLogEntryType enumerates the values for ms deploy log entry type. +type MSDeployLogEntryType string + +const ( + // MSDeployLogEntryTypeError ... + MSDeployLogEntryTypeError MSDeployLogEntryType = "Error" + // MSDeployLogEntryTypeMessage ... + MSDeployLogEntryTypeMessage MSDeployLogEntryType = "Message" + // MSDeployLogEntryTypeWarning ... + MSDeployLogEntryTypeWarning MSDeployLogEntryType = "Warning" +) + +// PossibleMSDeployLogEntryTypeValues returns an array of possible values for the MSDeployLogEntryType const type. +func PossibleMSDeployLogEntryTypeValues() []MSDeployLogEntryType { + return []MSDeployLogEntryType{MSDeployLogEntryTypeError, MSDeployLogEntryTypeMessage, MSDeployLogEntryTypeWarning} +} + +// MSDeployProvisioningState enumerates the values for ms deploy provisioning state. +type MSDeployProvisioningState string + +const ( + // MSDeployProvisioningStateAccepted ... + MSDeployProvisioningStateAccepted MSDeployProvisioningState = "accepted" + // MSDeployProvisioningStateCanceled ... + MSDeployProvisioningStateCanceled MSDeployProvisioningState = "canceled" + // MSDeployProvisioningStateFailed ... + MSDeployProvisioningStateFailed MSDeployProvisioningState = "failed" + // MSDeployProvisioningStateRunning ... + MSDeployProvisioningStateRunning MSDeployProvisioningState = "running" + // MSDeployProvisioningStateSucceeded ... + MSDeployProvisioningStateSucceeded MSDeployProvisioningState = "succeeded" +) + +// PossibleMSDeployProvisioningStateValues returns an array of possible values for the MSDeployProvisioningState const type. +func PossibleMSDeployProvisioningStateValues() []MSDeployProvisioningState { + return []MSDeployProvisioningState{MSDeployProvisioningStateAccepted, MSDeployProvisioningStateCanceled, MSDeployProvisioningStateFailed, MSDeployProvisioningStateRunning, MSDeployProvisioningStateSucceeded} +} + +// MySQLMigrationType enumerates the values for my sql migration type. +type MySQLMigrationType string + +const ( + // MySQLMigrationTypeLocalToRemote ... + MySQLMigrationTypeLocalToRemote MySQLMigrationType = "LocalToRemote" + // MySQLMigrationTypeRemoteToLocal ... + MySQLMigrationTypeRemoteToLocal MySQLMigrationType = "RemoteToLocal" +) + +// PossibleMySQLMigrationTypeValues returns an array of possible values for the MySQLMigrationType const type. +func PossibleMySQLMigrationTypeValues() []MySQLMigrationType { + return []MySQLMigrationType{MySQLMigrationTypeLocalToRemote, MySQLMigrationTypeRemoteToLocal} +} + +// NotificationLevel enumerates the values for notification level. +type NotificationLevel string + +const ( + // NotificationLevelCritical ... + NotificationLevelCritical NotificationLevel = "Critical" + // NotificationLevelInformation ... + NotificationLevelInformation NotificationLevel = "Information" + // NotificationLevelNonUrgentSuggestion ... + NotificationLevelNonUrgentSuggestion NotificationLevel = "NonUrgentSuggestion" + // NotificationLevelWarning ... + NotificationLevelWarning NotificationLevel = "Warning" +) + +// PossibleNotificationLevelValues returns an array of possible values for the NotificationLevel const type. +func PossibleNotificationLevelValues() []NotificationLevel { + return []NotificationLevel{NotificationLevelCritical, NotificationLevelInformation, NotificationLevelNonUrgentSuggestion, NotificationLevelWarning} +} + +// OperationStatus enumerates the values for operation status. +type OperationStatus string + +const ( + // OperationStatusCreated ... + OperationStatusCreated OperationStatus = "Created" + // OperationStatusFailed ... + OperationStatusFailed OperationStatus = "Failed" + // OperationStatusInProgress ... + OperationStatusInProgress OperationStatus = "InProgress" + // OperationStatusSucceeded ... + OperationStatusSucceeded OperationStatus = "Succeeded" + // OperationStatusTimedOut ... + OperationStatusTimedOut OperationStatus = "TimedOut" +) + +// PossibleOperationStatusValues returns an array of possible values for the OperationStatus const type. +func PossibleOperationStatusValues() []OperationStatus { + return []OperationStatus{OperationStatusCreated, OperationStatusFailed, OperationStatusInProgress, OperationStatusSucceeded, OperationStatusTimedOut} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateInProgress ... + ProvisioningStateInProgress ProvisioningState = "InProgress" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateInProgress, ProvisioningStateSucceeded} +} + +// PublicCertificateLocation enumerates the values for public certificate location. +type PublicCertificateLocation string + +const ( + // PublicCertificateLocationCurrentUserMy ... + PublicCertificateLocationCurrentUserMy PublicCertificateLocation = "CurrentUserMy" + // PublicCertificateLocationLocalMachineMy ... + PublicCertificateLocationLocalMachineMy PublicCertificateLocation = "LocalMachineMy" + // PublicCertificateLocationUnknown ... + PublicCertificateLocationUnknown PublicCertificateLocation = "Unknown" +) + +// PossiblePublicCertificateLocationValues returns an array of possible values for the PublicCertificateLocation const type. +func PossiblePublicCertificateLocationValues() []PublicCertificateLocation { + return []PublicCertificateLocation{PublicCertificateLocationCurrentUserMy, PublicCertificateLocationLocalMachineMy, PublicCertificateLocationUnknown} +} + +// PublishingProfileFormat enumerates the values for publishing profile format. +type PublishingProfileFormat string + +const ( + // PublishingProfileFormatFileZilla3 ... + PublishingProfileFormatFileZilla3 PublishingProfileFormat = "FileZilla3" + // PublishingProfileFormatFtp ... + PublishingProfileFormatFtp PublishingProfileFormat = "Ftp" + // PublishingProfileFormatWebDeploy ... + PublishingProfileFormatWebDeploy PublishingProfileFormat = "WebDeploy" +) + +// PossiblePublishingProfileFormatValues returns an array of possible values for the PublishingProfileFormat const type. +func PossiblePublishingProfileFormatValues() []PublishingProfileFormat { + return []PublishingProfileFormat{PublishingProfileFormatFileZilla3, PublishingProfileFormatFtp, PublishingProfileFormatWebDeploy} +} + +// RedundancyMode enumerates the values for redundancy mode. +type RedundancyMode string + +const ( + // RedundancyModeActiveActive ... + RedundancyModeActiveActive RedundancyMode = "ActiveActive" + // RedundancyModeFailover ... + RedundancyModeFailover RedundancyMode = "Failover" + // RedundancyModeGeoRedundant ... + RedundancyModeGeoRedundant RedundancyMode = "GeoRedundant" + // RedundancyModeManual ... + RedundancyModeManual RedundancyMode = "Manual" + // RedundancyModeNone ... + RedundancyModeNone RedundancyMode = "None" +) + +// PossibleRedundancyModeValues returns an array of possible values for the RedundancyMode const type. +func PossibleRedundancyModeValues() []RedundancyMode { + return []RedundancyMode{RedundancyModeActiveActive, RedundancyModeFailover, RedundancyModeGeoRedundant, RedundancyModeManual, RedundancyModeNone} +} + +// RenderingType enumerates the values for rendering type. +type RenderingType string + +const ( + // RenderingTypeAppInsight ... + RenderingTypeAppInsight RenderingType = "AppInsight" + // RenderingTypeAppInsightEnablement ... + RenderingTypeAppInsightEnablement RenderingType = "AppInsightEnablement" + // RenderingTypeCard ... + RenderingTypeCard RenderingType = "Card" + // RenderingTypeChangeAnalysisOnboarding ... + RenderingTypeChangeAnalysisOnboarding RenderingType = "ChangeAnalysisOnboarding" + // RenderingTypeChangeSets ... + RenderingTypeChangeSets RenderingType = "ChangeSets" + // RenderingTypeChangesView ... + RenderingTypeChangesView RenderingType = "ChangesView" + // RenderingTypeDataSummary ... + RenderingTypeDataSummary RenderingType = "DataSummary" + // RenderingTypeDependencyGraph ... + RenderingTypeDependencyGraph RenderingType = "DependencyGraph" + // RenderingTypeDetector ... + RenderingTypeDetector RenderingType = "Detector" + // RenderingTypeDownTime ... + RenderingTypeDownTime RenderingType = "DownTime" + // RenderingTypeDropDown ... + RenderingTypeDropDown RenderingType = "DropDown" + // RenderingTypeDynamicInsight ... + RenderingTypeDynamicInsight RenderingType = "DynamicInsight" + // RenderingTypeEmail ... + RenderingTypeEmail RenderingType = "Email" + // RenderingTypeForm ... + RenderingTypeForm RenderingType = "Form" + // RenderingTypeGuage ... + RenderingTypeGuage RenderingType = "Guage" + // RenderingTypeInsights ... + RenderingTypeInsights RenderingType = "Insights" + // RenderingTypeMarkdown ... + RenderingTypeMarkdown RenderingType = "Markdown" + // RenderingTypeNoGraph ... + RenderingTypeNoGraph RenderingType = "NoGraph" + // RenderingTypePieChart ... + RenderingTypePieChart RenderingType = "PieChart" + // RenderingTypeSearchComponent ... + RenderingTypeSearchComponent RenderingType = "SearchComponent" + // RenderingTypeSolution ... + RenderingTypeSolution RenderingType = "Solution" + // RenderingTypeSummaryCard ... + RenderingTypeSummaryCard RenderingType = "SummaryCard" + // RenderingTypeTable ... + RenderingTypeTable RenderingType = "Table" + // RenderingTypeTimeSeries ... + RenderingTypeTimeSeries RenderingType = "TimeSeries" + // RenderingTypeTimeSeriesPerInstance ... + RenderingTypeTimeSeriesPerInstance RenderingType = "TimeSeriesPerInstance" +) + +// PossibleRenderingTypeValues returns an array of possible values for the RenderingType const type. +func PossibleRenderingTypeValues() []RenderingType { + return []RenderingType{RenderingTypeAppInsight, RenderingTypeAppInsightEnablement, RenderingTypeCard, RenderingTypeChangeAnalysisOnboarding, RenderingTypeChangeSets, RenderingTypeChangesView, RenderingTypeDataSummary, RenderingTypeDependencyGraph, RenderingTypeDetector, RenderingTypeDownTime, RenderingTypeDropDown, RenderingTypeDynamicInsight, RenderingTypeEmail, RenderingTypeForm, RenderingTypeGuage, RenderingTypeInsights, RenderingTypeMarkdown, RenderingTypeNoGraph, RenderingTypePieChart, RenderingTypeSearchComponent, RenderingTypeSolution, RenderingTypeSummaryCard, RenderingTypeTable, RenderingTypeTimeSeries, RenderingTypeTimeSeriesPerInstance} +} + +// ResolveStatus enumerates the values for resolve status. +type ResolveStatus string + +const ( + // ResolveStatusAccessToKeyVaultDenied ... + ResolveStatusAccessToKeyVaultDenied ResolveStatus = "AccessToKeyVaultDenied" + // ResolveStatusFetchTimedOut ... + ResolveStatusFetchTimedOut ResolveStatus = "FetchTimedOut" + // ResolveStatusInitialized ... + ResolveStatusInitialized ResolveStatus = "Initialized" + // ResolveStatusInvalidSyntax ... + ResolveStatusInvalidSyntax ResolveStatus = "InvalidSyntax" + // ResolveStatusMSINotEnabled ... + ResolveStatusMSINotEnabled ResolveStatus = "MSINotEnabled" + // ResolveStatusOtherReasons ... + ResolveStatusOtherReasons ResolveStatus = "OtherReasons" + // ResolveStatusResolved ... + ResolveStatusResolved ResolveStatus = "Resolved" + // ResolveStatusSecretNotFound ... + ResolveStatusSecretNotFound ResolveStatus = "SecretNotFound" + // ResolveStatusSecretVersionNotFound ... + ResolveStatusSecretVersionNotFound ResolveStatus = "SecretVersionNotFound" + // ResolveStatusUnauthorizedClient ... + ResolveStatusUnauthorizedClient ResolveStatus = "UnauthorizedClient" + // ResolveStatusVaultNotFound ... + ResolveStatusVaultNotFound ResolveStatus = "VaultNotFound" +) + +// PossibleResolveStatusValues returns an array of possible values for the ResolveStatus const type. +func PossibleResolveStatusValues() []ResolveStatus { + return []ResolveStatus{ResolveStatusAccessToKeyVaultDenied, ResolveStatusFetchTimedOut, ResolveStatusInitialized, ResolveStatusInvalidSyntax, ResolveStatusMSINotEnabled, ResolveStatusOtherReasons, ResolveStatusResolved, ResolveStatusSecretNotFound, ResolveStatusSecretVersionNotFound, ResolveStatusUnauthorizedClient, ResolveStatusVaultNotFound} +} + +// ResourceScopeType enumerates the values for resource scope type. +type ResourceScopeType string + +const ( + // ResourceScopeTypeServerFarm ... + ResourceScopeTypeServerFarm ResourceScopeType = "ServerFarm" + // ResourceScopeTypeSubscription ... + ResourceScopeTypeSubscription ResourceScopeType = "Subscription" + // ResourceScopeTypeWebSite ... + ResourceScopeTypeWebSite ResourceScopeType = "WebSite" +) + +// PossibleResourceScopeTypeValues returns an array of possible values for the ResourceScopeType const type. +func PossibleResourceScopeTypeValues() []ResourceScopeType { + return []ResourceScopeType{ResourceScopeTypeServerFarm, ResourceScopeTypeSubscription, ResourceScopeTypeWebSite} +} + +// RevisionHealthState enumerates the values for revision health state. +type RevisionHealthState string + +const ( + // RevisionHealthStateHealthy ... + RevisionHealthStateHealthy RevisionHealthState = "Healthy" + // RevisionHealthStateNone ... + RevisionHealthStateNone RevisionHealthState = "None" + // RevisionHealthStateUnhealthy ... + RevisionHealthStateUnhealthy RevisionHealthState = "Unhealthy" +) + +// PossibleRevisionHealthStateValues returns an array of possible values for the RevisionHealthState const type. +func PossibleRevisionHealthStateValues() []RevisionHealthState { + return []RevisionHealthState{RevisionHealthStateHealthy, RevisionHealthStateNone, RevisionHealthStateUnhealthy} +} + +// RevisionProvisioningState enumerates the values for revision provisioning state. +type RevisionProvisioningState string + +const ( + // RevisionProvisioningStateDeprovisioned ... + RevisionProvisioningStateDeprovisioned RevisionProvisioningState = "Deprovisioned" + // RevisionProvisioningStateDeprovisioning ... + RevisionProvisioningStateDeprovisioning RevisionProvisioningState = "Deprovisioning" + // RevisionProvisioningStateFailed ... + RevisionProvisioningStateFailed RevisionProvisioningState = "Failed" + // RevisionProvisioningStateProvisioned ... + RevisionProvisioningStateProvisioned RevisionProvisioningState = "Provisioned" + // RevisionProvisioningStateProvisioning ... + RevisionProvisioningStateProvisioning RevisionProvisioningState = "Provisioning" +) + +// PossibleRevisionProvisioningStateValues returns an array of possible values for the RevisionProvisioningState const type. +func PossibleRevisionProvisioningStateValues() []RevisionProvisioningState { + return []RevisionProvisioningState{RevisionProvisioningStateDeprovisioned, RevisionProvisioningStateDeprovisioning, RevisionProvisioningStateFailed, RevisionProvisioningStateProvisioned, RevisionProvisioningStateProvisioning} +} + +// RouteType enumerates the values for route type. +type RouteType string + +const ( + // RouteTypeDEFAULT ... + RouteTypeDEFAULT RouteType = "DEFAULT" + // RouteTypeINHERITED ... + RouteTypeINHERITED RouteType = "INHERITED" + // RouteTypeSTATIC ... + RouteTypeSTATIC RouteType = "STATIC" +) + +// PossibleRouteTypeValues returns an array of possible values for the RouteType const type. +func PossibleRouteTypeValues() []RouteType { + return []RouteType{RouteTypeDEFAULT, RouteTypeINHERITED, RouteTypeSTATIC} +} + +// ScmType enumerates the values for scm type. +type ScmType string + +const ( + // ScmTypeBitbucketGit ... + ScmTypeBitbucketGit ScmType = "BitbucketGit" + // ScmTypeBitbucketHg ... + ScmTypeBitbucketHg ScmType = "BitbucketHg" + // ScmTypeCodePlexGit ... + ScmTypeCodePlexGit ScmType = "CodePlexGit" + // ScmTypeCodePlexHg ... + ScmTypeCodePlexHg ScmType = "CodePlexHg" + // ScmTypeDropbox ... + ScmTypeDropbox ScmType = "Dropbox" + // ScmTypeExternalGit ... + ScmTypeExternalGit ScmType = "ExternalGit" + // ScmTypeExternalHg ... + ScmTypeExternalHg ScmType = "ExternalHg" + // ScmTypeGitHub ... + ScmTypeGitHub ScmType = "GitHub" + // ScmTypeLocalGit ... + ScmTypeLocalGit ScmType = "LocalGit" + // ScmTypeNone ... + ScmTypeNone ScmType = "None" + // ScmTypeOneDrive ... + ScmTypeOneDrive ScmType = "OneDrive" + // ScmTypeTfs ... + ScmTypeTfs ScmType = "Tfs" + // ScmTypeVSO ... + ScmTypeVSO ScmType = "VSO" + // ScmTypeVSTSRM ... + ScmTypeVSTSRM ScmType = "VSTSRM" +) + +// PossibleScmTypeValues returns an array of possible values for the ScmType const type. +func PossibleScmTypeValues() []ScmType { + return []ScmType{ScmTypeBitbucketGit, ScmTypeBitbucketHg, ScmTypeCodePlexGit, ScmTypeCodePlexHg, ScmTypeDropbox, ScmTypeExternalGit, ScmTypeExternalHg, ScmTypeGitHub, ScmTypeLocalGit, ScmTypeNone, ScmTypeOneDrive, ScmTypeTfs, ScmTypeVSO, ScmTypeVSTSRM} +} + +// SiteAvailabilityState enumerates the values for site availability state. +type SiteAvailabilityState string + +const ( + // SiteAvailabilityStateDisasterRecoveryMode ... + SiteAvailabilityStateDisasterRecoveryMode SiteAvailabilityState = "DisasterRecoveryMode" + // SiteAvailabilityStateLimited ... + SiteAvailabilityStateLimited SiteAvailabilityState = "Limited" + // SiteAvailabilityStateNormal ... + SiteAvailabilityStateNormal SiteAvailabilityState = "Normal" +) + +// PossibleSiteAvailabilityStateValues returns an array of possible values for the SiteAvailabilityState const type. +func PossibleSiteAvailabilityStateValues() []SiteAvailabilityState { + return []SiteAvailabilityState{SiteAvailabilityStateDisasterRecoveryMode, SiteAvailabilityStateLimited, SiteAvailabilityStateNormal} +} + +// SiteExtensionType enumerates the values for site extension type. +type SiteExtensionType string + +const ( + // SiteExtensionTypeGallery ... + SiteExtensionTypeGallery SiteExtensionType = "Gallery" + // SiteExtensionTypeWebRoot ... + SiteExtensionTypeWebRoot SiteExtensionType = "WebRoot" +) + +// PossibleSiteExtensionTypeValues returns an array of possible values for the SiteExtensionType const type. +func PossibleSiteExtensionTypeValues() []SiteExtensionType { + return []SiteExtensionType{SiteExtensionTypeGallery, SiteExtensionTypeWebRoot} +} + +// SiteLoadBalancing enumerates the values for site load balancing. +type SiteLoadBalancing string + +const ( + // SiteLoadBalancingLeastRequests ... + SiteLoadBalancingLeastRequests SiteLoadBalancing = "LeastRequests" + // SiteLoadBalancingLeastResponseTime ... + SiteLoadBalancingLeastResponseTime SiteLoadBalancing = "LeastResponseTime" + // SiteLoadBalancingPerSiteRoundRobin ... + SiteLoadBalancingPerSiteRoundRobin SiteLoadBalancing = "PerSiteRoundRobin" + // SiteLoadBalancingRequestHash ... + SiteLoadBalancingRequestHash SiteLoadBalancing = "RequestHash" + // SiteLoadBalancingWeightedRoundRobin ... + SiteLoadBalancingWeightedRoundRobin SiteLoadBalancing = "WeightedRoundRobin" + // SiteLoadBalancingWeightedTotalTraffic ... + SiteLoadBalancingWeightedTotalTraffic SiteLoadBalancing = "WeightedTotalTraffic" +) + +// PossibleSiteLoadBalancingValues returns an array of possible values for the SiteLoadBalancing const type. +func PossibleSiteLoadBalancingValues() []SiteLoadBalancing { + return []SiteLoadBalancing{SiteLoadBalancingLeastRequests, SiteLoadBalancingLeastResponseTime, SiteLoadBalancingPerSiteRoundRobin, SiteLoadBalancingRequestHash, SiteLoadBalancingWeightedRoundRobin, SiteLoadBalancingWeightedTotalTraffic} +} + +// SiteRuntimeState enumerates the values for site runtime state. +type SiteRuntimeState string + +const ( + // SiteRuntimeStateREADY ... + SiteRuntimeStateREADY SiteRuntimeState = "READY" + // SiteRuntimeStateSTOPPED ... + SiteRuntimeStateSTOPPED SiteRuntimeState = "STOPPED" + // SiteRuntimeStateUNKNOWN ... + SiteRuntimeStateUNKNOWN SiteRuntimeState = "UNKNOWN" +) + +// PossibleSiteRuntimeStateValues returns an array of possible values for the SiteRuntimeState const type. +func PossibleSiteRuntimeStateValues() []SiteRuntimeState { + return []SiteRuntimeState{SiteRuntimeStateREADY, SiteRuntimeStateSTOPPED, SiteRuntimeStateUNKNOWN} +} + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // SkuNameBasic ... + SkuNameBasic SkuName = "Basic" + // SkuNameDynamic ... + SkuNameDynamic SkuName = "Dynamic" + // SkuNameElasticIsolated ... + SkuNameElasticIsolated SkuName = "ElasticIsolated" + // SkuNameElasticPremium ... + SkuNameElasticPremium SkuName = "ElasticPremium" + // SkuNameFree ... + SkuNameFree SkuName = "Free" + // SkuNameIsolated ... + SkuNameIsolated SkuName = "Isolated" + // SkuNameIsolatedV2 ... + SkuNameIsolatedV2 SkuName = "IsolatedV2" + // SkuNamePremium ... + SkuNamePremium SkuName = "Premium" + // SkuNamePremiumContainer ... + SkuNamePremiumContainer SkuName = "PremiumContainer" + // SkuNamePremiumV2 ... + SkuNamePremiumV2 SkuName = "PremiumV2" + // SkuNamePremiumV3 ... + SkuNamePremiumV3 SkuName = "PremiumV3" + // SkuNameShared ... + SkuNameShared SkuName = "Shared" + // SkuNameStandard ... + SkuNameStandard SkuName = "Standard" +) + +// PossibleSkuNameValues returns an array of possible values for the SkuName const type. +func PossibleSkuNameValues() []SkuName { + return []SkuName{SkuNameBasic, SkuNameDynamic, SkuNameElasticIsolated, SkuNameElasticPremium, SkuNameFree, SkuNameIsolated, SkuNameIsolatedV2, SkuNamePremium, SkuNamePremiumContainer, SkuNamePremiumV2, SkuNamePremiumV3, SkuNameShared, SkuNameStandard} +} + +// SolutionType enumerates the values for solution type. +type SolutionType string + +const ( + // SolutionTypeBestPractices ... + SolutionTypeBestPractices SolutionType = "BestPractices" + // SolutionTypeDeepInvestigation ... + SolutionTypeDeepInvestigation SolutionType = "DeepInvestigation" + // SolutionTypeQuickSolution ... + SolutionTypeQuickSolution SolutionType = "QuickSolution" +) + +// PossibleSolutionTypeValues returns an array of possible values for the SolutionType const type. +func PossibleSolutionTypeValues() []SolutionType { + return []SolutionType{SolutionTypeBestPractices, SolutionTypeDeepInvestigation, SolutionTypeQuickSolution} +} + +// SslState enumerates the values for ssl state. +type SslState string + +const ( + // SslStateDisabled ... + SslStateDisabled SslState = "Disabled" + // SslStateIPBasedEnabled ... + SslStateIPBasedEnabled SslState = "IpBasedEnabled" + // SslStateSniEnabled ... + SslStateSniEnabled SslState = "SniEnabled" +) + +// PossibleSslStateValues returns an array of possible values for the SslState const type. +func PossibleSslStateValues() []SslState { + return []SslState{SslStateDisabled, SslStateIPBasedEnabled, SslStateSniEnabled} +} + +// StackPreferredOs enumerates the values for stack preferred os. +type StackPreferredOs string + +const ( + // StackPreferredOsLinux ... + StackPreferredOsLinux StackPreferredOs = "Linux" + // StackPreferredOsWindows ... + StackPreferredOsWindows StackPreferredOs = "Windows" +) + +// PossibleStackPreferredOsValues returns an array of possible values for the StackPreferredOs const type. +func PossibleStackPreferredOsValues() []StackPreferredOs { + return []StackPreferredOs{StackPreferredOsLinux, StackPreferredOsWindows} +} + +// StagingEnvironmentPolicy enumerates the values for staging environment policy. +type StagingEnvironmentPolicy string + +const ( + // StagingEnvironmentPolicyDisabled ... + StagingEnvironmentPolicyDisabled StagingEnvironmentPolicy = "Disabled" + // StagingEnvironmentPolicyEnabled ... + StagingEnvironmentPolicyEnabled StagingEnvironmentPolicy = "Enabled" +) + +// PossibleStagingEnvironmentPolicyValues returns an array of possible values for the StagingEnvironmentPolicy const type. +func PossibleStagingEnvironmentPolicyValues() []StagingEnvironmentPolicy { + return []StagingEnvironmentPolicy{StagingEnvironmentPolicyDisabled, StagingEnvironmentPolicyEnabled} +} + +// StatusOptions enumerates the values for status options. +type StatusOptions string + +const ( + // StatusOptionsCreating ... + StatusOptionsCreating StatusOptions = "Creating" + // StatusOptionsPending ... + StatusOptionsPending StatusOptions = "Pending" + // StatusOptionsReady ... + StatusOptionsReady StatusOptions = "Ready" +) + +// PossibleStatusOptionsValues returns an array of possible values for the StatusOptions const type. +func PossibleStatusOptionsValues() []StatusOptions { + return []StatusOptions{StatusOptionsCreating, StatusOptionsPending, StatusOptionsReady} +} + +// StorageType enumerates the values for storage type. +type StorageType string + +const ( + // StorageTypeLocalNode ... + StorageTypeLocalNode StorageType = "LocalNode" + // StorageTypeNetworkFileSystem ... + StorageTypeNetworkFileSystem StorageType = "NetworkFileSystem" +) + +// PossibleStorageTypeValues returns an array of possible values for the StorageType const type. +func PossibleStorageTypeValues() []StorageType { + return []StorageType{StorageTypeLocalNode, StorageTypeNetworkFileSystem} +} + +// SupportedTLSVersions enumerates the values for supported tls versions. +type SupportedTLSVersions string + +const ( + // SupportedTLSVersionsOneFullStopOne ... + SupportedTLSVersionsOneFullStopOne SupportedTLSVersions = "1.1" + // SupportedTLSVersionsOneFullStopTwo ... + SupportedTLSVersionsOneFullStopTwo SupportedTLSVersions = "1.2" + // SupportedTLSVersionsOneFullStopZero ... + SupportedTLSVersionsOneFullStopZero SupportedTLSVersions = "1.0" +) + +// PossibleSupportedTLSVersionsValues returns an array of possible values for the SupportedTLSVersions const type. +func PossibleSupportedTLSVersionsValues() []SupportedTLSVersions { + return []SupportedTLSVersions{SupportedTLSVersionsOneFullStopOne, SupportedTLSVersionsOneFullStopTwo, SupportedTLSVersionsOneFullStopZero} +} + +// TriggeredWebJobStatus enumerates the values for triggered web job status. +type TriggeredWebJobStatus string + +const ( + // TriggeredWebJobStatusError ... + TriggeredWebJobStatusError TriggeredWebJobStatus = "Error" + // TriggeredWebJobStatusFailed ... + TriggeredWebJobStatusFailed TriggeredWebJobStatus = "Failed" + // TriggeredWebJobStatusSuccess ... + TriggeredWebJobStatusSuccess TriggeredWebJobStatus = "Success" +) + +// PossibleTriggeredWebJobStatusValues returns an array of possible values for the TriggeredWebJobStatus const type. +func PossibleTriggeredWebJobStatusValues() []TriggeredWebJobStatus { + return []TriggeredWebJobStatus{TriggeredWebJobStatusError, TriggeredWebJobStatusFailed, TriggeredWebJobStatusSuccess} +} + +// TriggerTypes enumerates the values for trigger types. +type TriggerTypes string + +const ( + // TriggerTypesHTTPTrigger ... + TriggerTypesHTTPTrigger TriggerTypes = "HttpTrigger" + // TriggerTypesUnknown ... + TriggerTypesUnknown TriggerTypes = "Unknown" +) + +// PossibleTriggerTypesValues returns an array of possible values for the TriggerTypes const type. +func PossibleTriggerTypesValues() []TriggerTypes { + return []TriggerTypes{TriggerTypesHTTPTrigger, TriggerTypesUnknown} +} + +// UnauthenticatedClientAction enumerates the values for unauthenticated client action. +type UnauthenticatedClientAction string + +const ( + // UnauthenticatedClientActionAllowAnonymous ... + UnauthenticatedClientActionAllowAnonymous UnauthenticatedClientAction = "AllowAnonymous" + // UnauthenticatedClientActionRedirectToLoginPage ... + UnauthenticatedClientActionRedirectToLoginPage UnauthenticatedClientAction = "RedirectToLoginPage" +) + +// PossibleUnauthenticatedClientActionValues returns an array of possible values for the UnauthenticatedClientAction const type. +func PossibleUnauthenticatedClientActionValues() []UnauthenticatedClientAction { + return []UnauthenticatedClientAction{UnauthenticatedClientActionAllowAnonymous, UnauthenticatedClientActionRedirectToLoginPage} +} + +// UnauthenticatedClientActionV2 enumerates the values for unauthenticated client action v2. +type UnauthenticatedClientActionV2 string + +const ( + // UnauthenticatedClientActionV2AllowAnonymous ... + UnauthenticatedClientActionV2AllowAnonymous UnauthenticatedClientActionV2 = "AllowAnonymous" + // UnauthenticatedClientActionV2RedirectToLoginPage ... + UnauthenticatedClientActionV2RedirectToLoginPage UnauthenticatedClientActionV2 = "RedirectToLoginPage" + // UnauthenticatedClientActionV2Return401 ... + UnauthenticatedClientActionV2Return401 UnauthenticatedClientActionV2 = "Return401" + // UnauthenticatedClientActionV2Return403 ... + UnauthenticatedClientActionV2Return403 UnauthenticatedClientActionV2 = "Return403" +) + +// PossibleUnauthenticatedClientActionV2Values returns an array of possible values for the UnauthenticatedClientActionV2 const type. +func PossibleUnauthenticatedClientActionV2Values() []UnauthenticatedClientActionV2 { + return []UnauthenticatedClientActionV2{UnauthenticatedClientActionV2AllowAnonymous, UnauthenticatedClientActionV2RedirectToLoginPage, UnauthenticatedClientActionV2Return401, UnauthenticatedClientActionV2Return403} +} + +// UsageState enumerates the values for usage state. +type UsageState string + +const ( + // UsageStateExceeded ... + UsageStateExceeded UsageState = "Exceeded" + // UsageStateNormal ... + UsageStateNormal UsageState = "Normal" +) + +// PossibleUsageStateValues returns an array of possible values for the UsageState const type. +func PossibleUsageStateValues() []UsageState { + return []UsageState{UsageStateExceeded, UsageStateNormal} +} + +// ValidateResourceTypes enumerates the values for validate resource types. +type ValidateResourceTypes string + +const ( + // ValidateResourceTypesMicrosoftWebhostingEnvironments ... + ValidateResourceTypesMicrosoftWebhostingEnvironments ValidateResourceTypes = "Microsoft.Web/hostingEnvironments" + // ValidateResourceTypesServerFarm ... + ValidateResourceTypesServerFarm ValidateResourceTypes = "ServerFarm" + // ValidateResourceTypesSite ... + ValidateResourceTypesSite ValidateResourceTypes = "Site" +) + +// PossibleValidateResourceTypesValues returns an array of possible values for the ValidateResourceTypes const type. +func PossibleValidateResourceTypesValues() []ValidateResourceTypes { + return []ValidateResourceTypes{ValidateResourceTypesMicrosoftWebhostingEnvironments, ValidateResourceTypesServerFarm, ValidateResourceTypesSite} +} + +// WorkerSizeOptions enumerates the values for worker size options. +type WorkerSizeOptions string + +const ( + // WorkerSizeOptionsD1 ... + WorkerSizeOptionsD1 WorkerSizeOptions = "D1" + // WorkerSizeOptionsD2 ... + WorkerSizeOptionsD2 WorkerSizeOptions = "D2" + // WorkerSizeOptionsD3 ... + WorkerSizeOptionsD3 WorkerSizeOptions = "D3" + // WorkerSizeOptionsDefault ... + WorkerSizeOptionsDefault WorkerSizeOptions = "Default" + // WorkerSizeOptionsLarge ... + WorkerSizeOptionsLarge WorkerSizeOptions = "Large" + // WorkerSizeOptionsLargeV3 ... + WorkerSizeOptionsLargeV3 WorkerSizeOptions = "LargeV3" + // WorkerSizeOptionsMedium ... + WorkerSizeOptionsMedium WorkerSizeOptions = "Medium" + // WorkerSizeOptionsMediumV3 ... + WorkerSizeOptionsMediumV3 WorkerSizeOptions = "MediumV3" + // WorkerSizeOptionsNestedSmall ... + WorkerSizeOptionsNestedSmall WorkerSizeOptions = "NestedSmall" + // WorkerSizeOptionsNestedSmallLinux ... + WorkerSizeOptionsNestedSmallLinux WorkerSizeOptions = "NestedSmallLinux" + // WorkerSizeOptionsSmall ... + WorkerSizeOptionsSmall WorkerSizeOptions = "Small" + // WorkerSizeOptionsSmallV3 ... + WorkerSizeOptionsSmallV3 WorkerSizeOptions = "SmallV3" +) + +// PossibleWorkerSizeOptionsValues returns an array of possible values for the WorkerSizeOptions const type. +func PossibleWorkerSizeOptionsValues() []WorkerSizeOptions { + return []WorkerSizeOptions{WorkerSizeOptionsD1, WorkerSizeOptionsD2, WorkerSizeOptionsD3, WorkerSizeOptionsDefault, WorkerSizeOptionsLarge, WorkerSizeOptionsLargeV3, WorkerSizeOptionsMedium, WorkerSizeOptionsMediumV3, WorkerSizeOptionsNestedSmall, WorkerSizeOptionsNestedSmallLinux, WorkerSizeOptionsSmall, WorkerSizeOptionsSmallV3} +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/global.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/global.go new file mode 100644 index 000000000000..3e7d015aea25 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/global.go @@ -0,0 +1,254 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// GlobalClient is the webSite Management Client +type GlobalClient struct { + BaseClient +} + +// NewGlobalClient creates an instance of the GlobalClient client. +func NewGlobalClient(subscriptionID string) GlobalClient { + return NewGlobalClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGlobalClientWithBaseURI creates an instance of the GlobalClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewGlobalClientWithBaseURI(baseURI string, subscriptionID string) GlobalClient { + return GlobalClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetDeletedWebApp description for Get deleted app for a subscription. +// Parameters: +// deletedSiteID - the numeric ID of the deleted app, e.g. 12345 +func (client GlobalClient) GetDeletedWebApp(ctx context.Context, deletedSiteID string) (result DeletedSite, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GlobalClient.GetDeletedWebApp") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetDeletedWebAppPreparer(ctx, deletedSiteID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetDeletedWebApp", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedWebAppSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetDeletedWebApp", resp, "Failure sending request") + return + } + + result, err = client.GetDeletedWebAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetDeletedWebApp", resp, "Failure responding to request") + return + } + + return +} + +// GetDeletedWebAppPreparer prepares the GetDeletedWebApp request. +func (client GlobalClient) GetDeletedWebAppPreparer(ctx context.Context, deletedSiteID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deletedSiteId": autorest.Encode("path", deletedSiteID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites/{deletedSiteId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedWebAppSender sends the GetDeletedWebApp request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalClient) GetDeletedWebAppSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDeletedWebAppResponder handles the response to the GetDeletedWebApp request. The method always +// closes the http.Response Body. +func (client GlobalClient) GetDeletedWebAppResponder(resp *http.Response) (result DeletedSite, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeletedWebAppSnapshots description for Get all deleted apps for a subscription. +// Parameters: +// deletedSiteID - the numeric ID of the deleted app, e.g. 12345 +func (client GlobalClient) GetDeletedWebAppSnapshots(ctx context.Context, deletedSiteID string) (result ListSnapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GlobalClient.GetDeletedWebAppSnapshots") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetDeletedWebAppSnapshotsPreparer(ctx, deletedSiteID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetDeletedWebAppSnapshots", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedWebAppSnapshotsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetDeletedWebAppSnapshots", resp, "Failure sending request") + return + } + + result, err = client.GetDeletedWebAppSnapshotsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetDeletedWebAppSnapshots", resp, "Failure responding to request") + return + } + + return +} + +// GetDeletedWebAppSnapshotsPreparer prepares the GetDeletedWebAppSnapshots request. +func (client GlobalClient) GetDeletedWebAppSnapshotsPreparer(ctx context.Context, deletedSiteID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deletedSiteId": autorest.Encode("path", deletedSiteID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites/{deletedSiteId}/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedWebAppSnapshotsSender sends the GetDeletedWebAppSnapshots request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalClient) GetDeletedWebAppSnapshotsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDeletedWebAppSnapshotsResponder handles the response to the GetDeletedWebAppSnapshots request. The method always +// closes the http.Response Body. +func (client GlobalClient) GetDeletedWebAppSnapshotsResponder(resp *http.Response) (result ListSnapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSubscriptionOperationWithAsyncResponse description for Gets an operation in a subscription and given region +// Parameters: +// location - location name +// operationID - operation Id +func (client GlobalClient) GetSubscriptionOperationWithAsyncResponse(ctx context.Context, location string, operationID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GlobalClient.GetSubscriptionOperationWithAsyncResponse") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetSubscriptionOperationWithAsyncResponsePreparer(ctx, location, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetSubscriptionOperationWithAsyncResponse", nil, "Failure preparing request") + return + } + + resp, err := client.GetSubscriptionOperationWithAsyncResponseSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetSubscriptionOperationWithAsyncResponse", resp, "Failure sending request") + return + } + + result, err = client.GetSubscriptionOperationWithAsyncResponseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.GlobalClient", "GetSubscriptionOperationWithAsyncResponse", resp, "Failure responding to request") + return + } + + return +} + +// GetSubscriptionOperationWithAsyncResponsePreparer prepares the GetSubscriptionOperationWithAsyncResponse request. +func (client GlobalClient) GetSubscriptionOperationWithAsyncResponsePreparer(ctx context.Context, location string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "operationId": autorest.Encode("path", operationID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/operations/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSubscriptionOperationWithAsyncResponseSender sends the GetSubscriptionOperationWithAsyncResponse request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalClient) GetSubscriptionOperationWithAsyncResponseSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSubscriptionOperationWithAsyncResponseResponder handles the response to the GetSubscriptionOperationWithAsyncResponse request. The method always +// closes the http.Response Body. +func (client GlobalClient) GetSubscriptionOperationWithAsyncResponseResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/kubeenvironments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/kubeenvironments.go new file mode 100644 index 000000000000..6b8a3cca1e4a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/kubeenvironments.go @@ -0,0 +1,617 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// KubeEnvironmentsClient is the webSite Management Client +type KubeEnvironmentsClient struct { + BaseClient +} + +// NewKubeEnvironmentsClient creates an instance of the KubeEnvironmentsClient client. +func NewKubeEnvironmentsClient(subscriptionID string) KubeEnvironmentsClient { + return NewKubeEnvironmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewKubeEnvironmentsClientWithBaseURI creates an instance of the KubeEnvironmentsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewKubeEnvironmentsClientWithBaseURI(baseURI string, subscriptionID string) KubeEnvironmentsClient { + return KubeEnvironmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate description for Creates or updates a Kubernetes Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the Kubernetes Environment. +// kubeEnvironmentEnvelope - configuration details of the Kubernetes Environment. +func (client KubeEnvironmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, kubeEnvironmentEnvelope KubeEnvironment) (result KubeEnvironmentsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KubeEnvironmentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.KubeEnvironmentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, kubeEnvironmentEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client KubeEnvironmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, kubeEnvironmentEnvelope KubeEnvironment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/kubeEnvironments/{name}", pathParameters), + autorest.WithJSON(kubeEnvironmentEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client KubeEnvironmentsClient) CreateOrUpdateSender(req *http.Request) (future KubeEnvironmentsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client KubeEnvironmentsClient) CreateOrUpdateResponder(resp *http.Response) (result KubeEnvironment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete description for Delete a Kubernetes Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the Kubernetes Environment. +func (client KubeEnvironmentsClient) Delete(ctx context.Context, resourceGroupName string, name string) (result KubeEnvironmentsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KubeEnvironmentsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.KubeEnvironmentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client KubeEnvironmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/kubeEnvironments/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client KubeEnvironmentsClient) DeleteSender(req *http.Request) (future KubeEnvironmentsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client KubeEnvironmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get description for Get the properties of a Kubernetes Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the Kubernetes Environment. +func (client KubeEnvironmentsClient) Get(ctx context.Context, resourceGroupName string, name string) (result KubeEnvironment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KubeEnvironmentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.KubeEnvironmentsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client KubeEnvironmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/kubeEnvironments/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client KubeEnvironmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client KubeEnvironmentsClient) GetResponder(resp *http.Response) (result KubeEnvironment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup description for Get all the Kubernetes Environments in a resource group. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +func (client KubeEnvironmentsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result KubeEnvironmentCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KubeEnvironmentsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.kec.Response.Response != nil { + sc = result.kec.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.KubeEnvironmentsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.kec.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.kec, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.kec.hasNextLink() && result.kec.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client KubeEnvironmentsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/kubeEnvironments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client KubeEnvironmentsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client KubeEnvironmentsClient) ListByResourceGroupResponder(resp *http.Response) (result KubeEnvironmentCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client KubeEnvironmentsClient) listByResourceGroupNextResults(ctx context.Context, lastResults KubeEnvironmentCollection) (result KubeEnvironmentCollection, err error) { + req, err := lastResults.kubeEnvironmentCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client KubeEnvironmentsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result KubeEnvironmentCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KubeEnvironmentsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscription description for Get all Kubernetes Environments for a subscription. +func (client KubeEnvironmentsClient) ListBySubscription(ctx context.Context) (result KubeEnvironmentCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KubeEnvironmentsClient.ListBySubscription") + defer func() { + sc := -1 + if result.kec.Response.Response != nil { + sc = result.kec.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.kec.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.kec, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.kec.hasNextLink() && result.kec.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client KubeEnvironmentsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/kubeEnvironments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client KubeEnvironmentsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client KubeEnvironmentsClient) ListBySubscriptionResponder(resp *http.Response) (result KubeEnvironmentCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client KubeEnvironmentsClient) listBySubscriptionNextResults(ctx context.Context, lastResults KubeEnvironmentCollection) (result KubeEnvironmentCollection, err error) { + req, err := lastResults.kubeEnvironmentCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client KubeEnvironmentsClient) ListBySubscriptionComplete(ctx context.Context) (result KubeEnvironmentCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KubeEnvironmentsClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// Update description for Creates or updates a Kubernetes Environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the Kubernetes Environment. +// kubeEnvironmentEnvelope - configuration details of the Kubernetes Environment. +func (client KubeEnvironmentsClient) Update(ctx context.Context, resourceGroupName string, name string, kubeEnvironmentEnvelope KubeEnvironmentPatchResource) (result KubeEnvironment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KubeEnvironmentsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.KubeEnvironmentsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, name, kubeEnvironmentEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client KubeEnvironmentsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, kubeEnvironmentEnvelope KubeEnvironmentPatchResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/kubeEnvironments/{name}", pathParameters), + autorest.WithJSON(kubeEnvironmentEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client KubeEnvironmentsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client KubeEnvironmentsClient) UpdateResponder(resp *http.Response) (result KubeEnvironment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/models.go new file mode 100644 index 000000000000..9867b5dc40e6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/models.go @@ -0,0 +1,32941 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "io" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web" + +// AbnormalTimePeriod class representing Abnormal Time Period identified in diagnosis +type AbnormalTimePeriod struct { + // StartTime - Start time of the downtime + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - End time of the downtime + EndTime *date.Time `json:"endTime,omitempty"` + // Events - List of Possible Cause of downtime + Events *[]DetectorAbnormalTimePeriod `json:"events,omitempty"` + // Solutions - List of proposed solutions + Solutions *[]Solution `json:"solutions,omitempty"` +} + +// Address address information for domain registration. +type Address struct { + // Address1 - First line of an Address. + Address1 *string `json:"address1,omitempty"` + // Address2 - The second line of the Address. Optional. + Address2 *string `json:"address2,omitempty"` + // City - The city for the address. + City *string `json:"city,omitempty"` + // Country - The country for the address. + Country *string `json:"country,omitempty"` + // PostalCode - The postal code for the address. + PostalCode *string `json:"postalCode,omitempty"` + // State - The state or province for the address. + State *string `json:"state,omitempty"` +} + +// AddressResponse describes main public IP address and any extra virtual IPs. +type AddressResponse struct { + autorest.Response `json:"-"` + // AddressResponseProperties - AddressResponse resource specific properties + *AddressResponseProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AddressResponse. +func (ar AddressResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.AddressResponseProperties != nil { + objectMap["properties"] = ar.AddressResponseProperties + } + if ar.Kind != nil { + objectMap["kind"] = ar.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AddressResponse struct. +func (ar *AddressResponse) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var addressResponseProperties AddressResponseProperties + err = json.Unmarshal(*v, &addressResponseProperties) + if err != nil { + return err + } + ar.AddressResponseProperties = &addressResponseProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ar.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ar.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ar.Type = &typeVar + } + } + } + + return nil +} + +// AddressResponseProperties addressResponse resource specific properties +type AddressResponseProperties struct { + // ServiceIPAddress - Main public virtual IP. + ServiceIPAddress *string `json:"serviceIpAddress,omitempty"` + // InternalIPAddress - Virtual Network internal IP address of the App Service Environment if it is in internal load-balancing mode. + InternalIPAddress *string `json:"internalIpAddress,omitempty"` + // OutboundIPAddresses - IP addresses appearing on outbound connections. + OutboundIPAddresses *[]string `json:"outboundIpAddresses,omitempty"` + // VipMappings - Additional virtual IPs. + VipMappings *[]VirtualIPMapping `json:"vipMappings,omitempty"` +} + +// AllowedAudiencesValidation the configuration settings of the Allowed Audiences validation flow. +type AllowedAudiencesValidation struct { + // AllowedAudiences - The configuration settings of the allowed list of audiences from which to validate the JWT token. + AllowedAudiences *[]string `json:"allowedAudiences,omitempty"` +} + +// AllowedPrincipals the configuration settings of the Azure Active Directory allowed principals. +type AllowedPrincipals struct { + // Groups - The list of the allowed groups. + Groups *[]string `json:"groups,omitempty"` + // Identities - The list of the allowed identities. + Identities *[]string `json:"identities,omitempty"` +} + +// AnalysisData class Representing Detector Evidence used for analysis +type AnalysisData struct { + // Source - Name of the Detector + Source *string `json:"source,omitempty"` + // DetectorDefinition - Detector Definition + DetectorDefinition *DetectorDefinition `json:"detectorDefinition,omitempty"` + // Metrics - Source Metrics + Metrics *[]DiagnosticMetricSet `json:"metrics,omitempty"` + // Data - Additional Source Data + Data *[][]NameValuePair `json:"data,omitempty"` + // DetectorMetaData - Detector Meta Data + DetectorMetaData *ResponseMetaData `json:"detectorMetaData,omitempty"` +} + +// AnalysisDefinition definition of Analysis +type AnalysisDefinition struct { + autorest.Response `json:"-"` + // AnalysisDefinitionProperties - AnalysisDefinition resource specific properties + *AnalysisDefinitionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AnalysisDefinition. +func (ad AnalysisDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ad.AnalysisDefinitionProperties != nil { + objectMap["properties"] = ad.AnalysisDefinitionProperties + } + if ad.Kind != nil { + objectMap["kind"] = ad.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AnalysisDefinition struct. +func (ad *AnalysisDefinition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var analysisDefinitionProperties AnalysisDefinitionProperties + err = json.Unmarshal(*v, &analysisDefinitionProperties) + if err != nil { + return err + } + ad.AnalysisDefinitionProperties = &analysisDefinitionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ad.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ad.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ad.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ad.Type = &typeVar + } + } + } + + return nil +} + +// AnalysisDefinitionProperties analysisDefinition resource specific properties +type AnalysisDefinitionProperties struct { + // Description - READ-ONLY; Description of the Analysis + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for AnalysisDefinitionProperties. +func (ad AnalysisDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// APIDefinitionInfo information about the formal API definition for the app. +type APIDefinitionInfo struct { + // URL - The URL of the API definition. + URL *string `json:"url,omitempty"` +} + +// APIKVReference description of site key vault references. +type APIKVReference struct { + autorest.Response `json:"-"` + // APIKVReferenceProperties - ApiKVReference resource specific properties + *APIKVReferenceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for APIKVReference. +func (akr APIKVReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if akr.APIKVReferenceProperties != nil { + objectMap["properties"] = akr.APIKVReferenceProperties + } + if akr.Kind != nil { + objectMap["kind"] = akr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for APIKVReference struct. +func (akr *APIKVReference) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aPIKVReferenceProperties APIKVReferenceProperties + err = json.Unmarshal(*v, &aPIKVReferenceProperties) + if err != nil { + return err + } + akr.APIKVReferenceProperties = &aPIKVReferenceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + akr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + akr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + akr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + akr.Type = &typeVar + } + } + } + + return nil +} + +// APIKVReferenceCollection ... +type APIKVReferenceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]APIKVReference `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for APIKVReferenceCollection. +func (akrc APIKVReferenceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if akrc.Value != nil { + objectMap["value"] = akrc.Value + } + return json.Marshal(objectMap) +} + +// APIKVReferenceCollectionIterator provides access to a complete listing of APIKVReference values. +type APIKVReferenceCollectionIterator struct { + i int + page APIKVReferenceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *APIKVReferenceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIKVReferenceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *APIKVReferenceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter APIKVReferenceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter APIKVReferenceCollectionIterator) Response() APIKVReferenceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter APIKVReferenceCollectionIterator) Value() APIKVReference { + if !iter.page.NotDone() { + return APIKVReference{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the APIKVReferenceCollectionIterator type. +func NewAPIKVReferenceCollectionIterator(page APIKVReferenceCollectionPage) APIKVReferenceCollectionIterator { + return APIKVReferenceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (akrc APIKVReferenceCollection) IsEmpty() bool { + return akrc.Value == nil || len(*akrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (akrc APIKVReferenceCollection) hasNextLink() bool { + return akrc.NextLink != nil && len(*akrc.NextLink) != 0 +} + +// aPIKVReferenceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (akrc APIKVReferenceCollection) aPIKVReferenceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !akrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(akrc.NextLink))) +} + +// APIKVReferenceCollectionPage contains a page of APIKVReference values. +type APIKVReferenceCollectionPage struct { + fn func(context.Context, APIKVReferenceCollection) (APIKVReferenceCollection, error) + arc APIKVReferenceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *APIKVReferenceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIKVReferenceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.arc) + if err != nil { + return err + } + page.arc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *APIKVReferenceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page APIKVReferenceCollectionPage) NotDone() bool { + return !page.arc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page APIKVReferenceCollectionPage) Response() APIKVReferenceCollection { + return page.arc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page APIKVReferenceCollectionPage) Values() []APIKVReference { + if page.arc.IsEmpty() { + return nil + } + return *page.arc.Value +} + +// Creates a new instance of the APIKVReferenceCollectionPage type. +func NewAPIKVReferenceCollectionPage(cur APIKVReferenceCollection, getNextPage func(context.Context, APIKVReferenceCollection) (APIKVReferenceCollection, error)) APIKVReferenceCollectionPage { + return APIKVReferenceCollectionPage{ + fn: getNextPage, + arc: cur, + } +} + +// APIKVReferenceProperties apiKVReference resource specific properties +type APIKVReferenceProperties struct { + Reference *string `json:"reference,omitempty"` + // Status - Possible values include: 'ResolveStatusInitialized', 'ResolveStatusResolved', 'ResolveStatusInvalidSyntax', 'ResolveStatusMSINotEnabled', 'ResolveStatusVaultNotFound', 'ResolveStatusSecretNotFound', 'ResolveStatusSecretVersionNotFound', 'ResolveStatusAccessToKeyVaultDenied', 'ResolveStatusOtherReasons', 'ResolveStatusFetchTimedOut', 'ResolveStatusUnauthorizedClient' + Status ResolveStatus `json:"status,omitempty"` + VaultName *string `json:"vaultName,omitempty"` + SecretName *string `json:"secretName,omitempty"` + SecretVersion *string `json:"secretVersion,omitempty"` + IdentityType *ManagedServiceIdentity `json:"identityType,omitempty"` + Details *string `json:"details,omitempty"` + // Source - Possible values include: 'ConfigReferenceSourceKeyVault' + Source ConfigReferenceSource `json:"source,omitempty"` + ActiveVersion *string `json:"activeVersion,omitempty"` +} + +// APIManagementConfig azure API management (APIM) configuration linked to the app. +type APIManagementConfig struct { + // ID - APIM-Api Identifier. + ID *string `json:"id,omitempty"` +} + +// AppCollection collection of App Service apps. +type AppCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]Site `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppCollection. +func (ac AppCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ac.Value != nil { + objectMap["value"] = ac.Value + } + return json.Marshal(objectMap) +} + +// AppCollectionIterator provides access to a complete listing of Site values. +type AppCollectionIterator struct { + i int + page AppCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AppCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AppCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AppCollectionIterator) Response() AppCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AppCollectionIterator) Value() Site { + if !iter.page.NotDone() { + return Site{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppCollectionIterator type. +func NewAppCollectionIterator(page AppCollectionPage) AppCollectionIterator { + return AppCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ac AppCollection) IsEmpty() bool { + return ac.Value == nil || len(*ac.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ac AppCollection) hasNextLink() bool { + return ac.NextLink != nil && len(*ac.NextLink) != 0 +} + +// appCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ac AppCollection) appCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !ac.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ac.NextLink))) +} + +// AppCollectionPage contains a page of Site values. +type AppCollectionPage struct { + fn func(context.Context, AppCollection) (AppCollection, error) + ac AppCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AppCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ac) + if err != nil { + return err + } + page.ac = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AppCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppCollectionPage) NotDone() bool { + return !page.ac.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppCollectionPage) Response() AppCollection { + return page.ac +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppCollectionPage) Values() []Site { + if page.ac.IsEmpty() { + return nil + } + return *page.ac.Value +} + +// Creates a new instance of the AppCollectionPage type. +func NewAppCollectionPage(cur AppCollection, getNextPage func(context.Context, AppCollection) (AppCollection, error)) AppCollectionPage { + return AppCollectionPage{ + fn: getNextPage, + ac: cur, + } +} + +// AppInsightsWebAppStackSettings app Insights Web App stack settings. +type AppInsightsWebAppStackSettings struct { + // IsSupported - READ-ONLY; true if remote Application Insights is supported for the stack; otherwise, false. + IsSupported *bool `json:"isSupported,omitempty"` + // IsDefaultOff - READ-ONLY; true if Application Insights is disabled by default for the stack; otherwise, false. + IsDefaultOff *bool `json:"isDefaultOff,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppInsightsWebAppStackSettings. +func (aiwass AppInsightsWebAppStackSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AppInstanceStatusCollection collection of app instances. +type AppInstanceStatusCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]SiteInstanceStatus `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppInstanceStatusCollection. +func (aisc AppInstanceStatusCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aisc.Value != nil { + objectMap["value"] = aisc.Value + } + return json.Marshal(objectMap) +} + +// AppInstanceStatusCollectionIterator provides access to a complete listing of SiteInstanceStatus values. +type AppInstanceStatusCollectionIterator struct { + i int + page AppInstanceStatusCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AppInstanceStatusCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppInstanceStatusCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AppInstanceStatusCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppInstanceStatusCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AppInstanceStatusCollectionIterator) Response() AppInstanceStatusCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AppInstanceStatusCollectionIterator) Value() SiteInstanceStatus { + if !iter.page.NotDone() { + return SiteInstanceStatus{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppInstanceStatusCollectionIterator type. +func NewAppInstanceStatusCollectionIterator(page AppInstanceStatusCollectionPage) AppInstanceStatusCollectionIterator { + return AppInstanceStatusCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aisc AppInstanceStatusCollection) IsEmpty() bool { + return aisc.Value == nil || len(*aisc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aisc AppInstanceStatusCollection) hasNextLink() bool { + return aisc.NextLink != nil && len(*aisc.NextLink) != 0 +} + +// appInstanceStatusCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aisc AppInstanceStatusCollection) appInstanceStatusCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !aisc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aisc.NextLink))) +} + +// AppInstanceStatusCollectionPage contains a page of SiteInstanceStatus values. +type AppInstanceStatusCollectionPage struct { + fn func(context.Context, AppInstanceStatusCollection) (AppInstanceStatusCollection, error) + aisc AppInstanceStatusCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AppInstanceStatusCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppInstanceStatusCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aisc) + if err != nil { + return err + } + page.aisc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AppInstanceStatusCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppInstanceStatusCollectionPage) NotDone() bool { + return !page.aisc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppInstanceStatusCollectionPage) Response() AppInstanceStatusCollection { + return page.aisc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppInstanceStatusCollectionPage) Values() []SiteInstanceStatus { + if page.aisc.IsEmpty() { + return nil + } + return *page.aisc.Value +} + +// Creates a new instance of the AppInstanceStatusCollectionPage type. +func NewAppInstanceStatusCollectionPage(cur AppInstanceStatusCollection, getNextPage func(context.Context, AppInstanceStatusCollection) (AppInstanceStatusCollection, error)) AppInstanceStatusCollectionPage { + return AppInstanceStatusCollectionPage{ + fn: getNextPage, + aisc: cur, + } +} + +// Apple the configuration settings of the Apple provider. +type Apple struct { + // Enabled - false if the Apple provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + // Registration - The configuration settings of the Apple registration. + Registration *AppleRegistration `json:"registration,omitempty"` + // Login - The configuration settings of the login flow. + Login *LoginScopes `json:"login,omitempty"` +} + +// AppleRegistration the configuration settings of the registration for the Apple provider +type AppleRegistration struct { + // ClientID - The Client ID of the app used for login. + ClientID *string `json:"clientId,omitempty"` + // ClientSecretSettingName - The app setting name that contains the client secret. + ClientSecretSettingName *string `json:"clientSecretSettingName,omitempty"` +} + +// ApplicationLogsConfig application logs configuration. +type ApplicationLogsConfig struct { + // FileSystem - Application logs to file system configuration. + FileSystem *FileSystemApplicationLogsConfig `json:"fileSystem,omitempty"` + // AzureTableStorage - Application logs to azure table storage configuration. + AzureTableStorage *AzureTableStorageApplicationLogsConfig `json:"azureTableStorage,omitempty"` + // AzureBlobStorage - Application logs to blob storage configuration. + AzureBlobStorage *AzureBlobStorageApplicationLogsConfig `json:"azureBlobStorage,omitempty"` +} + +// ApplicationStack application stack. +type ApplicationStack struct { + // Name - Application stack name. + Name *string `json:"name,omitempty"` + // Display - Application stack display name. + Display *string `json:"display,omitempty"` + // Dependency - Application stack dependency. + Dependency *string `json:"dependency,omitempty"` + // MajorVersions - List of major versions available. + MajorVersions *[]StackMajorVersion `json:"majorVersions,omitempty"` + // Frameworks - List of frameworks associated with application stack. + Frameworks *[]ApplicationStack `json:"frameworks,omitempty"` + // IsDeprecated - true if this is the stack is deprecated; otherwise, false. + IsDeprecated *[]ApplicationStack `json:"isDeprecated,omitempty"` +} + +// ApplicationStackCollection collection of Application Stacks +type ApplicationStackCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]ApplicationStackResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationStackCollection. +func (asc ApplicationStackCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asc.Value != nil { + objectMap["value"] = asc.Value + } + return json.Marshal(objectMap) +} + +// ApplicationStackCollectionIterator provides access to a complete listing of ApplicationStackResource +// values. +type ApplicationStackCollectionIterator struct { + i int + page ApplicationStackCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ApplicationStackCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationStackCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationStackCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationStackCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ApplicationStackCollectionIterator) Response() ApplicationStackCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ApplicationStackCollectionIterator) Value() ApplicationStackResource { + if !iter.page.NotDone() { + return ApplicationStackResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ApplicationStackCollectionIterator type. +func NewApplicationStackCollectionIterator(page ApplicationStackCollectionPage) ApplicationStackCollectionIterator { + return ApplicationStackCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (asc ApplicationStackCollection) IsEmpty() bool { + return asc.Value == nil || len(*asc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (asc ApplicationStackCollection) hasNextLink() bool { + return asc.NextLink != nil && len(*asc.NextLink) != 0 +} + +// applicationStackCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (asc ApplicationStackCollection) applicationStackCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !asc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(asc.NextLink))) +} + +// ApplicationStackCollectionPage contains a page of ApplicationStackResource values. +type ApplicationStackCollectionPage struct { + fn func(context.Context, ApplicationStackCollection) (ApplicationStackCollection, error) + asc ApplicationStackCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ApplicationStackCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationStackCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.asc) + if err != nil { + return err + } + page.asc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationStackCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationStackCollectionPage) NotDone() bool { + return !page.asc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationStackCollectionPage) Response() ApplicationStackCollection { + return page.asc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationStackCollectionPage) Values() []ApplicationStackResource { + if page.asc.IsEmpty() { + return nil + } + return *page.asc.Value +} + +// Creates a new instance of the ApplicationStackCollectionPage type. +func NewApplicationStackCollectionPage(cur ApplicationStackCollection, getNextPage func(context.Context, ApplicationStackCollection) (ApplicationStackCollection, error)) ApplicationStackCollectionPage { + return ApplicationStackCollectionPage{ + fn: getNextPage, + asc: cur, + } +} + +// ApplicationStackResource ARM resource for a ApplicationStack. +type ApplicationStackResource struct { + // ApplicationStack - Core resource properties + *ApplicationStack `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationStackResource. +func (asr ApplicationStackResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asr.ApplicationStack != nil { + objectMap["properties"] = asr.ApplicationStack + } + if asr.Kind != nil { + objectMap["kind"] = asr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationStackResource struct. +func (asr *ApplicationStackResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationStack ApplicationStack + err = json.Unmarshal(*v, &applicationStack) + if err != nil { + return err + } + asr.ApplicationStack = &applicationStack + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + asr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asr.Type = &typeVar + } + } + } + + return nil +} + +// AppLogsConfiguration ... +type AppLogsConfiguration struct { + Destination *string `json:"destination,omitempty"` + LogAnalyticsConfiguration *LogAnalyticsConfiguration `json:"logAnalyticsConfiguration,omitempty"` +} + +// AppMajorVersion web App stack major version. +type AppMajorVersion struct { + // DisplayText - READ-ONLY; Web App stack major version (display only). + DisplayText *string `json:"displayText,omitempty"` + // Value - READ-ONLY; Web App stack major version name. + Value *string `json:"value,omitempty"` + // MinorVersions - READ-ONLY; Minor versions associated with the major version. + MinorVersions *[]AppMinorVersion `json:"minorVersions,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppMajorVersion. +func (amv AppMajorVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AppMinorVersion web App stack minor version. +type AppMinorVersion struct { + // DisplayText - READ-ONLY; Web App stack minor version (display only). + DisplayText *string `json:"displayText,omitempty"` + // Value - READ-ONLY; Web App stack major version name. + Value *string `json:"value,omitempty"` + // StackSettings - READ-ONLY; Settings associated with the minor version. + StackSettings *AppRuntimes `json:"stackSettings,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppMinorVersion. +func (amv AppMinorVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AppRegistration the configuration settings of the app registration for providers that have app ids and +// app secrets +type AppRegistration struct { + // AppID - The App ID of the app used for login. + AppID *string `json:"appId,omitempty"` + // AppSecretSettingName - The app setting name that contains the app secret. + AppSecretSettingName *string `json:"appSecretSettingName,omitempty"` +} + +// AppRuntimes web App stack runtimes. +type AppRuntimes struct { + // LinuxRuntimeSettings - READ-ONLY; Linux-specific settings associated with the minor version. + LinuxRuntimeSettings *AppRuntimeSettings `json:"linuxRuntimeSettings,omitempty"` + // WindowsRuntimeSettings - READ-ONLY; Windows-specific settings associated with the minor version. + WindowsRuntimeSettings *AppRuntimeSettings `json:"windowsRuntimeSettings,omitempty"` + // LinuxContainerSettings - READ-ONLY; Linux-specific settings associated with the Java container minor version. + LinuxContainerSettings *LinuxJavaContainerSettings `json:"linuxContainerSettings,omitempty"` + // WindowsContainerSettings - READ-ONLY; Windows-specific settings associated with the Java container minor version. + WindowsContainerSettings *WindowsJavaContainerSettings `json:"windowsContainerSettings,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppRuntimes. +func (ar AppRuntimes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AppRuntimeSettings web App runtime settings. +type AppRuntimeSettings struct { + // RuntimeVersion - READ-ONLY; Web App stack minor version (runtime only). + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + // RemoteDebuggingSupported - READ-ONLY; true if remote debugging is supported for the stack; otherwise, false. + RemoteDebuggingSupported *bool `json:"remoteDebuggingSupported,omitempty"` + // AppInsightsSettings - READ-ONLY; Application Insights settings associated with the minor version. + AppInsightsSettings *AppInsightsWebAppStackSettings `json:"appInsightsSettings,omitempty"` + // GitHubActionSettings - READ-ONLY; GitHub Actions settings associated with the minor version. + GitHubActionSettings *GitHubActionWebAppStackSettings `json:"gitHubActionSettings,omitempty"` + // IsPreview - READ-ONLY; true if the stack is in preview; otherwise, false. + IsPreview *bool `json:"isPreview,omitempty"` + // IsDeprecated - READ-ONLY; true if the stack is deprecated; otherwise, false. + IsDeprecated *bool `json:"isDeprecated,omitempty"` + // IsHidden - READ-ONLY; true if the stack should be hidden; otherwise, false. + IsHidden *bool `json:"isHidden,omitempty"` + // EndOfLifeDate - READ-ONLY; End-of-life date for the minor version. + EndOfLifeDate *date.Time `json:"endOfLifeDate,omitempty"` + // IsAutoUpdate - READ-ONLY; true if the stack version is auto-updated; otherwise, false. + IsAutoUpdate *bool `json:"isAutoUpdate,omitempty"` + // IsEarlyAccess - READ-ONLY; true if the minor version is early-access; otherwise, false. + IsEarlyAccess *bool `json:"isEarlyAccess,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppRuntimeSettings. +func (ars AppRuntimeSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AppsApproveOrRejectPrivateEndpointConnectionFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type AppsApproveOrRejectPrivateEndpointConnectionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (RemotePrivateEndpointConnectionARMResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsApproveOrRejectPrivateEndpointConnectionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsApproveOrRejectPrivateEndpointConnectionFuture.Result. +func (future *AppsApproveOrRejectPrivateEndpointConnectionFuture) result(client AppsClient) (rpecar RemotePrivateEndpointConnectionARMResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsApproveOrRejectPrivateEndpointConnectionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rpecar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsApproveOrRejectPrivateEndpointConnectionFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rpecar.Response.Response, err = future.GetResult(sender); err == nil && rpecar.Response.Response.StatusCode != http.StatusNoContent { + rpecar, err = client.ApproveOrRejectPrivateEndpointConnectionResponder(rpecar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsApproveOrRejectPrivateEndpointConnectionFuture", "Result", rpecar.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsApproveOrRejectPrivateEndpointConnectionSlotFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type AppsApproveOrRejectPrivateEndpointConnectionSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (RemotePrivateEndpointConnectionARMResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsApproveOrRejectPrivateEndpointConnectionSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsApproveOrRejectPrivateEndpointConnectionSlotFuture.Result. +func (future *AppsApproveOrRejectPrivateEndpointConnectionSlotFuture) result(client AppsClient) (rpecar RemotePrivateEndpointConnectionARMResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsApproveOrRejectPrivateEndpointConnectionSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rpecar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsApproveOrRejectPrivateEndpointConnectionSlotFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rpecar.Response.Response, err = future.GetResult(sender); err == nil && rpecar.Response.Response.StatusCode != http.StatusNoContent { + rpecar, err = client.ApproveOrRejectPrivateEndpointConnectionSlotResponder(rpecar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsApproveOrRejectPrivateEndpointConnectionSlotFuture", "Result", rpecar.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsCreateFunctionFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsCreateFunctionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (FunctionEnvelope, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsCreateFunctionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsCreateFunctionFuture.Result. +func (future *AppsCreateFunctionFuture) result(client AppsClient) (fe FunctionEnvelope, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateFunctionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fe.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsCreateFunctionFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fe.Response.Response, err = future.GetResult(sender); err == nil && fe.Response.Response.StatusCode != http.StatusNoContent { + fe, err = client.CreateFunctionResponder(fe.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateFunctionFuture", "Result", fe.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsCreateInstanceFunctionSlotFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsCreateInstanceFunctionSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (FunctionEnvelope, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsCreateInstanceFunctionSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsCreateInstanceFunctionSlotFuture.Result. +func (future *AppsCreateInstanceFunctionSlotFuture) result(client AppsClient) (fe FunctionEnvelope, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceFunctionSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fe.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsCreateInstanceFunctionSlotFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fe.Response.Response, err = future.GetResult(sender); err == nil && fe.Response.Response.StatusCode != http.StatusNoContent { + fe, err = client.CreateInstanceFunctionSlotResponder(fe.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceFunctionSlotFuture", "Result", fe.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsCreateInstanceMSDeployOperationFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsCreateInstanceMSDeployOperationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (MSDeployStatus, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsCreateInstanceMSDeployOperationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsCreateInstanceMSDeployOperationFuture.Result. +func (future *AppsCreateInstanceMSDeployOperationFuture) result(client AppsClient) (mds MSDeployStatus, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceMSDeployOperationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mds.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsCreateInstanceMSDeployOperationFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mds.Response.Response, err = future.GetResult(sender); err == nil && mds.Response.Response.StatusCode != http.StatusNoContent { + mds, err = client.CreateInstanceMSDeployOperationResponder(mds.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceMSDeployOperationFuture", "Result", mds.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsCreateInstanceMSDeployOperationSlotFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type AppsCreateInstanceMSDeployOperationSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (MSDeployStatus, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsCreateInstanceMSDeployOperationSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsCreateInstanceMSDeployOperationSlotFuture.Result. +func (future *AppsCreateInstanceMSDeployOperationSlotFuture) result(client AppsClient) (mds MSDeployStatus, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceMSDeployOperationSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mds.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsCreateInstanceMSDeployOperationSlotFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mds.Response.Response, err = future.GetResult(sender); err == nil && mds.Response.Response.StatusCode != http.StatusNoContent { + mds, err = client.CreateInstanceMSDeployOperationSlotResponder(mds.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateInstanceMSDeployOperationSlotFuture", "Result", mds.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsCreateMSDeployOperationFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsCreateMSDeployOperationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (MSDeployStatus, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsCreateMSDeployOperationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsCreateMSDeployOperationFuture.Result. +func (future *AppsCreateMSDeployOperationFuture) result(client AppsClient) (mds MSDeployStatus, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateMSDeployOperationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mds.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsCreateMSDeployOperationFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mds.Response.Response, err = future.GetResult(sender); err == nil && mds.Response.Response.StatusCode != http.StatusNoContent { + mds, err = client.CreateMSDeployOperationResponder(mds.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateMSDeployOperationFuture", "Result", mds.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsCreateMSDeployOperationSlotFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsCreateMSDeployOperationSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (MSDeployStatus, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsCreateMSDeployOperationSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsCreateMSDeployOperationSlotFuture.Result. +func (future *AppsCreateMSDeployOperationSlotFuture) result(client AppsClient) (mds MSDeployStatus, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateMSDeployOperationSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mds.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsCreateMSDeployOperationSlotFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mds.Response.Response, err = future.GetResult(sender); err == nil && mds.Response.Response.StatusCode != http.StatusNoContent { + mds, err = client.CreateMSDeployOperationSlotResponder(mds.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateMSDeployOperationSlotFuture", "Result", mds.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (Site, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsCreateOrUpdateFuture.Result. +func (future *AppsCreateOrUpdateFuture) result(client AppsClient) (s Site, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.CreateOrUpdateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsCreateOrUpdateSlotFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsCreateOrUpdateSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (Site, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsCreateOrUpdateSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsCreateOrUpdateSlotFuture.Result. +func (future *AppsCreateOrUpdateSlotFuture) result(client AppsClient) (s Site, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsCreateOrUpdateSlotFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.CreateOrUpdateSlotResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSlotFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsCreateOrUpdateSourceControlFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsCreateOrUpdateSourceControlFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (SiteSourceControl, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsCreateOrUpdateSourceControlFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsCreateOrUpdateSourceControlFuture.Result. +func (future *AppsCreateOrUpdateSourceControlFuture) result(client AppsClient) (ssc SiteSourceControl, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSourceControlFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ssc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsCreateOrUpdateSourceControlFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ssc.Response.Response, err = future.GetResult(sender); err == nil && ssc.Response.Response.StatusCode != http.StatusNoContent { + ssc, err = client.CreateOrUpdateSourceControlResponder(ssc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSourceControlFuture", "Result", ssc.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsCreateOrUpdateSourceControlSlotFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsCreateOrUpdateSourceControlSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (SiteSourceControl, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsCreateOrUpdateSourceControlSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsCreateOrUpdateSourceControlSlotFuture.Result. +func (future *AppsCreateOrUpdateSourceControlSlotFuture) result(client AppsClient) (ssc SiteSourceControl, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSourceControlSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ssc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsCreateOrUpdateSourceControlSlotFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ssc.Response.Response, err = future.GetResult(sender); err == nil && ssc.Response.Response.StatusCode != http.StatusNoContent { + ssc, err = client.CreateOrUpdateSourceControlSlotResponder(ssc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsCreateOrUpdateSourceControlSlotFuture", "Result", ssc.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsDeletePrivateEndpointConnectionFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsDeletePrivateEndpointConnectionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (SetObject, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsDeletePrivateEndpointConnectionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsDeletePrivateEndpointConnectionFuture.Result. +func (future *AppsDeletePrivateEndpointConnectionFuture) result(client AppsClient) (so SetObject, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsDeletePrivateEndpointConnectionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + so.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsDeletePrivateEndpointConnectionFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { + so, err = client.DeletePrivateEndpointConnectionResponder(so.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsDeletePrivateEndpointConnectionFuture", "Result", so.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsDeletePrivateEndpointConnectionSlotFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type AppsDeletePrivateEndpointConnectionSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (SetObject, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsDeletePrivateEndpointConnectionSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsDeletePrivateEndpointConnectionSlotFuture.Result. +func (future *AppsDeletePrivateEndpointConnectionSlotFuture) result(client AppsClient) (so SetObject, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsDeletePrivateEndpointConnectionSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + so.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsDeletePrivateEndpointConnectionSlotFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { + so, err = client.DeletePrivateEndpointConnectionSlotResponder(so.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsDeletePrivateEndpointConnectionSlotFuture", "Result", so.Response.Response, "Failure responding to request") + } + } + return +} + +// AppServiceCertificate key Vault container for a certificate that is purchased through Azure. +type AppServiceCertificate struct { + // KeyVaultID - Key Vault resource Id. + KeyVaultID *string `json:"keyVaultId,omitempty"` + // KeyVaultSecretName - Key Vault secret name. + KeyVaultSecretName *string `json:"keyVaultSecretName,omitempty"` + // ProvisioningState - READ-ONLY; Status of the Key Vault secret. Possible values include: 'KeyVaultSecretStatusInitialized', 'KeyVaultSecretStatusWaitingOnCertificateOrder', 'KeyVaultSecretStatusSucceeded', 'KeyVaultSecretStatusCertificateOrderFailed', 'KeyVaultSecretStatusOperationNotPermittedOnKeyVault', 'KeyVaultSecretStatusAzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultSecretStatusKeyVaultDoesNotExist', 'KeyVaultSecretStatusKeyVaultSecretDoesNotExist', 'KeyVaultSecretStatusUnknownError', 'KeyVaultSecretStatusExternalPrivateKey', 'KeyVaultSecretStatusUnknown' + ProvisioningState KeyVaultSecretStatus `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppServiceCertificate. +func (asc AppServiceCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asc.KeyVaultID != nil { + objectMap["keyVaultId"] = asc.KeyVaultID + } + if asc.KeyVaultSecretName != nil { + objectMap["keyVaultSecretName"] = asc.KeyVaultSecretName + } + return json.Marshal(objectMap) +} + +// AppServiceCertificateCollection collection of certificate order certificates. +type AppServiceCertificateCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]AppServiceCertificateResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppServiceCertificateCollection. +func (ascc AppServiceCertificateCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ascc.Value != nil { + objectMap["value"] = ascc.Value + } + return json.Marshal(objectMap) +} + +// AppServiceCertificateCollectionIterator provides access to a complete listing of +// AppServiceCertificateResource values. +type AppServiceCertificateCollectionIterator struct { + i int + page AppServiceCertificateCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AppServiceCertificateCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AppServiceCertificateCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppServiceCertificateCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AppServiceCertificateCollectionIterator) Response() AppServiceCertificateCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AppServiceCertificateCollectionIterator) Value() AppServiceCertificateResource { + if !iter.page.NotDone() { + return AppServiceCertificateResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppServiceCertificateCollectionIterator type. +func NewAppServiceCertificateCollectionIterator(page AppServiceCertificateCollectionPage) AppServiceCertificateCollectionIterator { + return AppServiceCertificateCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ascc AppServiceCertificateCollection) IsEmpty() bool { + return ascc.Value == nil || len(*ascc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ascc AppServiceCertificateCollection) hasNextLink() bool { + return ascc.NextLink != nil && len(*ascc.NextLink) != 0 +} + +// appServiceCertificateCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ascc AppServiceCertificateCollection) appServiceCertificateCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !ascc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ascc.NextLink))) +} + +// AppServiceCertificateCollectionPage contains a page of AppServiceCertificateResource values. +type AppServiceCertificateCollectionPage struct { + fn func(context.Context, AppServiceCertificateCollection) (AppServiceCertificateCollection, error) + ascc AppServiceCertificateCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AppServiceCertificateCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ascc) + if err != nil { + return err + } + page.ascc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AppServiceCertificateCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppServiceCertificateCollectionPage) NotDone() bool { + return !page.ascc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppServiceCertificateCollectionPage) Response() AppServiceCertificateCollection { + return page.ascc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppServiceCertificateCollectionPage) Values() []AppServiceCertificateResource { + if page.ascc.IsEmpty() { + return nil + } + return *page.ascc.Value +} + +// Creates a new instance of the AppServiceCertificateCollectionPage type. +func NewAppServiceCertificateCollectionPage(cur AppServiceCertificateCollection, getNextPage func(context.Context, AppServiceCertificateCollection) (AppServiceCertificateCollection, error)) AppServiceCertificateCollectionPage { + return AppServiceCertificateCollectionPage{ + fn: getNextPage, + ascc: cur, + } +} + +// AppServiceCertificateOrder SSL certificate purchase order. +type AppServiceCertificateOrder struct { + autorest.Response `json:"-"` + // AppServiceCertificateOrderProperties - AppServiceCertificateOrder resource specific properties + *AppServiceCertificateOrderProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Location - Resource Location. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AppServiceCertificateOrder. +func (asco AppServiceCertificateOrder) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asco.AppServiceCertificateOrderProperties != nil { + objectMap["properties"] = asco.AppServiceCertificateOrderProperties + } + if asco.Kind != nil { + objectMap["kind"] = asco.Kind + } + if asco.Location != nil { + objectMap["location"] = asco.Location + } + if asco.Tags != nil { + objectMap["tags"] = asco.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AppServiceCertificateOrder struct. +func (asco *AppServiceCertificateOrder) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var appServiceCertificateOrderProperties AppServiceCertificateOrderProperties + err = json.Unmarshal(*v, &appServiceCertificateOrderProperties) + if err != nil { + return err + } + asco.AppServiceCertificateOrderProperties = &appServiceCertificateOrderProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asco.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + asco.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asco.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + asco.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asco.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asco.Tags = tags + } + } + } + + return nil +} + +// AppServiceCertificateOrderCollection collection of certificate orders. +type AppServiceCertificateOrderCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]AppServiceCertificateOrder `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppServiceCertificateOrderCollection. +func (ascoc AppServiceCertificateOrderCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ascoc.Value != nil { + objectMap["value"] = ascoc.Value + } + return json.Marshal(objectMap) +} + +// AppServiceCertificateOrderCollectionIterator provides access to a complete listing of +// AppServiceCertificateOrder values. +type AppServiceCertificateOrderCollectionIterator struct { + i int + page AppServiceCertificateOrderCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AppServiceCertificateOrderCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrderCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AppServiceCertificateOrderCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppServiceCertificateOrderCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AppServiceCertificateOrderCollectionIterator) Response() AppServiceCertificateOrderCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AppServiceCertificateOrderCollectionIterator) Value() AppServiceCertificateOrder { + if !iter.page.NotDone() { + return AppServiceCertificateOrder{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppServiceCertificateOrderCollectionIterator type. +func NewAppServiceCertificateOrderCollectionIterator(page AppServiceCertificateOrderCollectionPage) AppServiceCertificateOrderCollectionIterator { + return AppServiceCertificateOrderCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ascoc AppServiceCertificateOrderCollection) IsEmpty() bool { + return ascoc.Value == nil || len(*ascoc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ascoc AppServiceCertificateOrderCollection) hasNextLink() bool { + return ascoc.NextLink != nil && len(*ascoc.NextLink) != 0 +} + +// appServiceCertificateOrderCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ascoc AppServiceCertificateOrderCollection) appServiceCertificateOrderCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !ascoc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ascoc.NextLink))) +} + +// AppServiceCertificateOrderCollectionPage contains a page of AppServiceCertificateOrder values. +type AppServiceCertificateOrderCollectionPage struct { + fn func(context.Context, AppServiceCertificateOrderCollection) (AppServiceCertificateOrderCollection, error) + ascoc AppServiceCertificateOrderCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AppServiceCertificateOrderCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceCertificateOrderCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ascoc) + if err != nil { + return err + } + page.ascoc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AppServiceCertificateOrderCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppServiceCertificateOrderCollectionPage) NotDone() bool { + return !page.ascoc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppServiceCertificateOrderCollectionPage) Response() AppServiceCertificateOrderCollection { + return page.ascoc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppServiceCertificateOrderCollectionPage) Values() []AppServiceCertificateOrder { + if page.ascoc.IsEmpty() { + return nil + } + return *page.ascoc.Value +} + +// Creates a new instance of the AppServiceCertificateOrderCollectionPage type. +func NewAppServiceCertificateOrderCollectionPage(cur AppServiceCertificateOrderCollection, getNextPage func(context.Context, AppServiceCertificateOrderCollection) (AppServiceCertificateOrderCollection, error)) AppServiceCertificateOrderCollectionPage { + return AppServiceCertificateOrderCollectionPage{ + fn: getNextPage, + ascoc: cur, + } +} + +// AppServiceCertificateOrderPatchResource ARM resource for a certificate order that is purchased through +// Azure. +type AppServiceCertificateOrderPatchResource struct { + // AppServiceCertificateOrderPatchResourceProperties - AppServiceCertificateOrderPatchResource resource specific properties + *AppServiceCertificateOrderPatchResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppServiceCertificateOrderPatchResource. +func (ascopr AppServiceCertificateOrderPatchResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ascopr.AppServiceCertificateOrderPatchResourceProperties != nil { + objectMap["properties"] = ascopr.AppServiceCertificateOrderPatchResourceProperties + } + if ascopr.Kind != nil { + objectMap["kind"] = ascopr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AppServiceCertificateOrderPatchResource struct. +func (ascopr *AppServiceCertificateOrderPatchResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var appServiceCertificateOrderPatchResourceProperties AppServiceCertificateOrderPatchResourceProperties + err = json.Unmarshal(*v, &appServiceCertificateOrderPatchResourceProperties) + if err != nil { + return err + } + ascopr.AppServiceCertificateOrderPatchResourceProperties = &appServiceCertificateOrderPatchResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ascopr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ascopr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ascopr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ascopr.Type = &typeVar + } + } + } + + return nil +} + +// AppServiceCertificateOrderPatchResourceProperties appServiceCertificateOrderPatchResource resource +// specific properties +type AppServiceCertificateOrderPatchResourceProperties struct { + // Certificates - State of the Key Vault secret. + Certificates map[string]*AppServiceCertificate `json:"certificates"` + // DistinguishedName - Certificate distinguished name. + DistinguishedName *string `json:"distinguishedName,omitempty"` + // DomainVerificationToken - READ-ONLY; Domain verification token. + DomainVerificationToken *string `json:"domainVerificationToken,omitempty"` + // ValidityInYears - Duration in years (must be 1). + ValidityInYears *int32 `json:"validityInYears,omitempty"` + // KeySize - Certificate key size. + KeySize *int32 `json:"keySize,omitempty"` + // ProductType - Certificate product type. Possible values include: 'CertificateProductTypeStandardDomainValidatedSsl', 'CertificateProductTypeStandardDomainValidatedWildCardSsl' + ProductType CertificateProductType `json:"productType,omitempty"` + // AutoRenew - true if the certificate should be automatically renewed when it expires; otherwise, false. + AutoRenew *bool `json:"autoRenew,omitempty"` + // ProvisioningState - READ-ONLY; Status of certificate order. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateInProgress', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Status - READ-ONLY; Current order status. Possible values include: 'CertificateOrderStatusPendingissuance', 'CertificateOrderStatusIssued', 'CertificateOrderStatusRevoked', 'CertificateOrderStatusCanceled', 'CertificateOrderStatusDenied', 'CertificateOrderStatusPendingrevocation', 'CertificateOrderStatusPendingRekey', 'CertificateOrderStatusUnused', 'CertificateOrderStatusExpired', 'CertificateOrderStatusNotSubmitted' + Status CertificateOrderStatus `json:"status,omitempty"` + // SignedCertificate - READ-ONLY; Signed certificate. + SignedCertificate *CertificateDetails `json:"signedCertificate,omitempty"` + // Csr - Last CSR that was created for this order. + Csr *string `json:"csr,omitempty"` + // Intermediate - READ-ONLY; Intermediate certificate. + Intermediate *CertificateDetails `json:"intermediate,omitempty"` + // Root - READ-ONLY; Root certificate. + Root *CertificateDetails `json:"root,omitempty"` + // SerialNumber - READ-ONLY; Current serial number of the certificate. + SerialNumber *string `json:"serialNumber,omitempty"` + // LastCertificateIssuanceTime - READ-ONLY; Certificate last issuance time. + LastCertificateIssuanceTime *date.Time `json:"lastCertificateIssuanceTime,omitempty"` + // ExpirationTime - READ-ONLY; Certificate expiration time. + ExpirationTime *date.Time `json:"expirationTime,omitempty"` + // IsPrivateKeyExternal - READ-ONLY; true if private key is external; otherwise, false. + IsPrivateKeyExternal *bool `json:"isPrivateKeyExternal,omitempty"` + // AppServiceCertificateNotRenewableReasons - READ-ONLY; Reasons why App Service Certificate is not renewable at the current moment. + AppServiceCertificateNotRenewableReasons *[]string `json:"appServiceCertificateNotRenewableReasons,omitempty"` + // NextAutoRenewalTimeStamp - READ-ONLY; Time stamp when the certificate would be auto renewed next + NextAutoRenewalTimeStamp *date.Time `json:"nextAutoRenewalTimeStamp,omitempty"` + // Contact - READ-ONLY; Contact info + Contact *CertificateOrderContact `json:"contact,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppServiceCertificateOrderPatchResourceProperties. +func (ascopr AppServiceCertificateOrderPatchResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ascopr.Certificates != nil { + objectMap["certificates"] = ascopr.Certificates + } + if ascopr.DistinguishedName != nil { + objectMap["distinguishedName"] = ascopr.DistinguishedName + } + if ascopr.ValidityInYears != nil { + objectMap["validityInYears"] = ascopr.ValidityInYears + } + if ascopr.KeySize != nil { + objectMap["keySize"] = ascopr.KeySize + } + if ascopr.ProductType != "" { + objectMap["productType"] = ascopr.ProductType + } + if ascopr.AutoRenew != nil { + objectMap["autoRenew"] = ascopr.AutoRenew + } + if ascopr.Csr != nil { + objectMap["csr"] = ascopr.Csr + } + return json.Marshal(objectMap) +} + +// AppServiceCertificateOrderProperties appServiceCertificateOrder resource specific properties +type AppServiceCertificateOrderProperties struct { + // Certificates - State of the Key Vault secret. + Certificates map[string]*AppServiceCertificate `json:"certificates"` + // DistinguishedName - Certificate distinguished name. + DistinguishedName *string `json:"distinguishedName,omitempty"` + // DomainVerificationToken - READ-ONLY; Domain verification token. + DomainVerificationToken *string `json:"domainVerificationToken,omitempty"` + // ValidityInYears - Duration in years (must be 1). + ValidityInYears *int32 `json:"validityInYears,omitempty"` + // KeySize - Certificate key size. + KeySize *int32 `json:"keySize,omitempty"` + // ProductType - Certificate product type. Possible values include: 'CertificateProductTypeStandardDomainValidatedSsl', 'CertificateProductTypeStandardDomainValidatedWildCardSsl' + ProductType CertificateProductType `json:"productType,omitempty"` + // AutoRenew - true if the certificate should be automatically renewed when it expires; otherwise, false. + AutoRenew *bool `json:"autoRenew,omitempty"` + // ProvisioningState - READ-ONLY; Status of certificate order. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateInProgress', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Status - READ-ONLY; Current order status. Possible values include: 'CertificateOrderStatusPendingissuance', 'CertificateOrderStatusIssued', 'CertificateOrderStatusRevoked', 'CertificateOrderStatusCanceled', 'CertificateOrderStatusDenied', 'CertificateOrderStatusPendingrevocation', 'CertificateOrderStatusPendingRekey', 'CertificateOrderStatusUnused', 'CertificateOrderStatusExpired', 'CertificateOrderStatusNotSubmitted' + Status CertificateOrderStatus `json:"status,omitempty"` + // SignedCertificate - READ-ONLY; Signed certificate. + SignedCertificate *CertificateDetails `json:"signedCertificate,omitempty"` + // Csr - Last CSR that was created for this order. + Csr *string `json:"csr,omitempty"` + // Intermediate - READ-ONLY; Intermediate certificate. + Intermediate *CertificateDetails `json:"intermediate,omitempty"` + // Root - READ-ONLY; Root certificate. + Root *CertificateDetails `json:"root,omitempty"` + // SerialNumber - READ-ONLY; Current serial number of the certificate. + SerialNumber *string `json:"serialNumber,omitempty"` + // LastCertificateIssuanceTime - READ-ONLY; Certificate last issuance time. + LastCertificateIssuanceTime *date.Time `json:"lastCertificateIssuanceTime,omitempty"` + // ExpirationTime - READ-ONLY; Certificate expiration time. + ExpirationTime *date.Time `json:"expirationTime,omitempty"` + // IsPrivateKeyExternal - READ-ONLY; true if private key is external; otherwise, false. + IsPrivateKeyExternal *bool `json:"isPrivateKeyExternal,omitempty"` + // AppServiceCertificateNotRenewableReasons - READ-ONLY; Reasons why App Service Certificate is not renewable at the current moment. + AppServiceCertificateNotRenewableReasons *[]string `json:"appServiceCertificateNotRenewableReasons,omitempty"` + // NextAutoRenewalTimeStamp - READ-ONLY; Time stamp when the certificate would be auto renewed next + NextAutoRenewalTimeStamp *date.Time `json:"nextAutoRenewalTimeStamp,omitempty"` + // Contact - READ-ONLY; Contact info + Contact *CertificateOrderContact `json:"contact,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppServiceCertificateOrderProperties. +func (asco AppServiceCertificateOrderProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asco.Certificates != nil { + objectMap["certificates"] = asco.Certificates + } + if asco.DistinguishedName != nil { + objectMap["distinguishedName"] = asco.DistinguishedName + } + if asco.ValidityInYears != nil { + objectMap["validityInYears"] = asco.ValidityInYears + } + if asco.KeySize != nil { + objectMap["keySize"] = asco.KeySize + } + if asco.ProductType != "" { + objectMap["productType"] = asco.ProductType + } + if asco.AutoRenew != nil { + objectMap["autoRenew"] = asco.AutoRenew + } + if asco.Csr != nil { + objectMap["csr"] = asco.Csr + } + return json.Marshal(objectMap) +} + +// AppServiceCertificateOrdersCreateOrUpdateCertificateFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type AppServiceCertificateOrdersCreateOrUpdateCertificateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppServiceCertificateOrdersClient) (AppServiceCertificateResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppServiceCertificateOrdersCreateOrUpdateCertificateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppServiceCertificateOrdersCreateOrUpdateCertificateFuture.Result. +func (future *AppServiceCertificateOrdersCreateOrUpdateCertificateFuture) result(client AppServiceCertificateOrdersClient) (ascr AppServiceCertificateResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersCreateOrUpdateCertificateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ascr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppServiceCertificateOrdersCreateOrUpdateCertificateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ascr.Response.Response, err = future.GetResult(sender); err == nil && ascr.Response.Response.StatusCode != http.StatusNoContent { + ascr, err = client.CreateOrUpdateCertificateResponder(ascr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersCreateOrUpdateCertificateFuture", "Result", ascr.Response.Response, "Failure responding to request") + } + } + return +} + +// AppServiceCertificateOrdersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type AppServiceCertificateOrdersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppServiceCertificateOrdersClient) (AppServiceCertificateOrder, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppServiceCertificateOrdersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppServiceCertificateOrdersCreateOrUpdateFuture.Result. +func (future *AppServiceCertificateOrdersCreateOrUpdateFuture) result(client AppServiceCertificateOrdersClient) (asco AppServiceCertificateOrder, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + asco.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppServiceCertificateOrdersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if asco.Response.Response, err = future.GetResult(sender); err == nil && asco.Response.Response.StatusCode != http.StatusNoContent { + asco, err = client.CreateOrUpdateResponder(asco.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersCreateOrUpdateFuture", "Result", asco.Response.Response, "Failure responding to request") + } + } + return +} + +// AppServiceCertificatePatchResource key Vault container ARM resource for a certificate that is purchased +// through Azure. +type AppServiceCertificatePatchResource struct { + // AppServiceCertificate - Core resource properties + *AppServiceCertificate `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppServiceCertificatePatchResource. +func (ascpr AppServiceCertificatePatchResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ascpr.AppServiceCertificate != nil { + objectMap["properties"] = ascpr.AppServiceCertificate + } + if ascpr.Kind != nil { + objectMap["kind"] = ascpr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AppServiceCertificatePatchResource struct. +func (ascpr *AppServiceCertificatePatchResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var appServiceCertificate AppServiceCertificate + err = json.Unmarshal(*v, &appServiceCertificate) + if err != nil { + return err + } + ascpr.AppServiceCertificate = &appServiceCertificate + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ascpr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ascpr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ascpr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ascpr.Type = &typeVar + } + } + } + + return nil +} + +// AppServiceCertificateResource key Vault container ARM resource for a certificate that is purchased +// through Azure. +type AppServiceCertificateResource struct { + autorest.Response `json:"-"` + // AppServiceCertificate - Core resource properties + *AppServiceCertificate `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Location - Resource Location. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AppServiceCertificateResource. +func (ascr AppServiceCertificateResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ascr.AppServiceCertificate != nil { + objectMap["properties"] = ascr.AppServiceCertificate + } + if ascr.Kind != nil { + objectMap["kind"] = ascr.Kind + } + if ascr.Location != nil { + objectMap["location"] = ascr.Location + } + if ascr.Tags != nil { + objectMap["tags"] = ascr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AppServiceCertificateResource struct. +func (ascr *AppServiceCertificateResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var appServiceCertificate AppServiceCertificate + err = json.Unmarshal(*v, &appServiceCertificate) + if err != nil { + return err + } + ascr.AppServiceCertificate = &appServiceCertificate + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ascr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ascr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ascr.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ascr.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ascr.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ascr.Tags = tags + } + } + } + + return nil +} + +// AppServiceEnvironment description of an App Service Environment. +type AppServiceEnvironment struct { + // ProvisioningState - READ-ONLY; Provisioning state of the App Service Environment. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateInProgress', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Status - READ-ONLY; Current status of the App Service Environment. Possible values include: 'HostingEnvironmentStatusPreparing', 'HostingEnvironmentStatusReady', 'HostingEnvironmentStatusScaling', 'HostingEnvironmentStatusDeleting' + Status HostingEnvironmentStatus `json:"status,omitempty"` + // VirtualNetwork - Description of the Virtual Network. + VirtualNetwork *VirtualNetworkProfile `json:"virtualNetwork,omitempty"` + // InternalLoadBalancingMode - Specifies which endpoints to serve internally in the Virtual Network for the App Service Environment. Possible values include: 'LoadBalancingModeNone', 'LoadBalancingModeWeb', 'LoadBalancingModePublishing', 'LoadBalancingModeWebPublishing' + InternalLoadBalancingMode LoadBalancingMode `json:"internalLoadBalancingMode,omitempty"` + // MultiSize - Front-end VM size, e.g. "Medium", "Large". + MultiSize *string `json:"multiSize,omitempty"` + // MultiRoleCount - READ-ONLY; Number of front-end instances. + MultiRoleCount *int32 `json:"multiRoleCount,omitempty"` + // IpsslAddressCount - Number of IP SSL addresses reserved for the App Service Environment. + IpsslAddressCount *int32 `json:"ipsslAddressCount,omitempty"` + // DNSSuffix - DNS suffix of the App Service Environment. + DNSSuffix *string `json:"dnsSuffix,omitempty"` + // MaximumNumberOfMachines - READ-ONLY; Maximum number of VMs in the App Service Environment. + MaximumNumberOfMachines *int32 `json:"maximumNumberOfMachines,omitempty"` + // FrontEndScaleFactor - Scale factor for front-ends. + FrontEndScaleFactor *int32 `json:"frontEndScaleFactor,omitempty"` + // Suspended - READ-ONLY; true if the App Service Environment is suspended; otherwise, false. The environment can be suspended, e.g. when the management endpoint is no longer available + // (most likely because NSG blocked the incoming traffic). + Suspended *bool `json:"suspended,omitempty"` + // ClusterSettings - Custom settings for changing the behavior of the App Service Environment. + ClusterSettings *[]NameValuePair `json:"clusterSettings,omitempty"` + // UserWhitelistedIPRanges - User added ip ranges to whitelist on ASE db + UserWhitelistedIPRanges *[]string `json:"userWhitelistedIpRanges,omitempty"` + // HasLinuxWorkers - READ-ONLY; Flag that displays whether an ASE has linux workers or not + HasLinuxWorkers *bool `json:"hasLinuxWorkers,omitempty"` + // DedicatedHostCount - Dedicated Host Count + DedicatedHostCount *int32 `json:"dedicatedHostCount,omitempty"` + // ZoneRedundant - Whether or not this App Service Environment is zone-redundant. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppServiceEnvironment. +func (ase AppServiceEnvironment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ase.VirtualNetwork != nil { + objectMap["virtualNetwork"] = ase.VirtualNetwork + } + if ase.InternalLoadBalancingMode != "" { + objectMap["internalLoadBalancingMode"] = ase.InternalLoadBalancingMode + } + if ase.MultiSize != nil { + objectMap["multiSize"] = ase.MultiSize + } + if ase.IpsslAddressCount != nil { + objectMap["ipsslAddressCount"] = ase.IpsslAddressCount + } + if ase.DNSSuffix != nil { + objectMap["dnsSuffix"] = ase.DNSSuffix + } + if ase.FrontEndScaleFactor != nil { + objectMap["frontEndScaleFactor"] = ase.FrontEndScaleFactor + } + if ase.ClusterSettings != nil { + objectMap["clusterSettings"] = ase.ClusterSettings + } + if ase.UserWhitelistedIPRanges != nil { + objectMap["userWhitelistedIpRanges"] = ase.UserWhitelistedIPRanges + } + if ase.DedicatedHostCount != nil { + objectMap["dedicatedHostCount"] = ase.DedicatedHostCount + } + if ase.ZoneRedundant != nil { + objectMap["zoneRedundant"] = ase.ZoneRedundant + } + return json.Marshal(objectMap) +} + +// AppServiceEnvironmentCollection collection of App Service Environments. +type AppServiceEnvironmentCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]AppServiceEnvironmentResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppServiceEnvironmentCollection. +func (asec AppServiceEnvironmentCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asec.Value != nil { + objectMap["value"] = asec.Value + } + return json.Marshal(objectMap) +} + +// AppServiceEnvironmentCollectionIterator provides access to a complete listing of +// AppServiceEnvironmentResource values. +type AppServiceEnvironmentCollectionIterator struct { + i int + page AppServiceEnvironmentCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AppServiceEnvironmentCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AppServiceEnvironmentCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppServiceEnvironmentCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AppServiceEnvironmentCollectionIterator) Response() AppServiceEnvironmentCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AppServiceEnvironmentCollectionIterator) Value() AppServiceEnvironmentResource { + if !iter.page.NotDone() { + return AppServiceEnvironmentResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppServiceEnvironmentCollectionIterator type. +func NewAppServiceEnvironmentCollectionIterator(page AppServiceEnvironmentCollectionPage) AppServiceEnvironmentCollectionIterator { + return AppServiceEnvironmentCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (asec AppServiceEnvironmentCollection) IsEmpty() bool { + return asec.Value == nil || len(*asec.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (asec AppServiceEnvironmentCollection) hasNextLink() bool { + return asec.NextLink != nil && len(*asec.NextLink) != 0 +} + +// appServiceEnvironmentCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (asec AppServiceEnvironmentCollection) appServiceEnvironmentCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !asec.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(asec.NextLink))) +} + +// AppServiceEnvironmentCollectionPage contains a page of AppServiceEnvironmentResource values. +type AppServiceEnvironmentCollectionPage struct { + fn func(context.Context, AppServiceEnvironmentCollection) (AppServiceEnvironmentCollection, error) + asec AppServiceEnvironmentCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AppServiceEnvironmentCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceEnvironmentCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.asec) + if err != nil { + return err + } + page.asec = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AppServiceEnvironmentCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppServiceEnvironmentCollectionPage) NotDone() bool { + return !page.asec.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppServiceEnvironmentCollectionPage) Response() AppServiceEnvironmentCollection { + return page.asec +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppServiceEnvironmentCollectionPage) Values() []AppServiceEnvironmentResource { + if page.asec.IsEmpty() { + return nil + } + return *page.asec.Value +} + +// Creates a new instance of the AppServiceEnvironmentCollectionPage type. +func NewAppServiceEnvironmentCollectionPage(cur AppServiceEnvironmentCollection, getNextPage func(context.Context, AppServiceEnvironmentCollection) (AppServiceEnvironmentCollection, error)) AppServiceEnvironmentCollectionPage { + return AppServiceEnvironmentCollectionPage{ + fn: getNextPage, + asec: cur, + } +} + +// AppServiceEnvironmentPatchResource ARM resource for a app service environment. +type AppServiceEnvironmentPatchResource struct { + // AppServiceEnvironment - Core resource properties + *AppServiceEnvironment `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppServiceEnvironmentPatchResource. +func (asepr AppServiceEnvironmentPatchResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asepr.AppServiceEnvironment != nil { + objectMap["properties"] = asepr.AppServiceEnvironment + } + if asepr.Kind != nil { + objectMap["kind"] = asepr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AppServiceEnvironmentPatchResource struct. +func (asepr *AppServiceEnvironmentPatchResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var appServiceEnvironment AppServiceEnvironment + err = json.Unmarshal(*v, &appServiceEnvironment) + if err != nil { + return err + } + asepr.AppServiceEnvironment = &appServiceEnvironment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asepr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + asepr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asepr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asepr.Type = &typeVar + } + } + } + + return nil +} + +// AppServiceEnvironmentResource app Service Environment ARM resource. +type AppServiceEnvironmentResource struct { + autorest.Response `json:"-"` + // AppServiceEnvironment - Core resource properties + *AppServiceEnvironment `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Location - Resource Location. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AppServiceEnvironmentResource. +func (aser AppServiceEnvironmentResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aser.AppServiceEnvironment != nil { + objectMap["properties"] = aser.AppServiceEnvironment + } + if aser.Kind != nil { + objectMap["kind"] = aser.Kind + } + if aser.Location != nil { + objectMap["location"] = aser.Location + } + if aser.Tags != nil { + objectMap["tags"] = aser.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AppServiceEnvironmentResource struct. +func (aser *AppServiceEnvironmentResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var appServiceEnvironment AppServiceEnvironment + err = json.Unmarshal(*v, &appServiceEnvironment) + if err != nil { + return err + } + aser.AppServiceEnvironment = &appServiceEnvironment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + aser.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + aser.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + aser.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + aser.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + aser.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + aser.Tags = tags + } + } + } + + return nil +} + +// AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionFuture an abstraction for monitoring and +// retrieving the results of a long-running operation. +type AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppServiceEnvironmentsClient) (RemotePrivateEndpointConnectionARMResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionFuture.Result. +func (future *AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionFuture) result(client AppServiceEnvironmentsClient) (rpecar RemotePrivateEndpointConnectionARMResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rpecar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rpecar.Response.Response, err = future.GetResult(sender); err == nil && rpecar.Response.Response.StatusCode != http.StatusNoContent { + rpecar, err = client.ApproveOrRejectPrivateEndpointConnectionResponder(rpecar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionFuture", "Result", rpecar.Response.Response, "Failure responding to request") + } + } + return +} + +// AppServiceEnvironmentsChangeVnetAllFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppServiceEnvironmentsChangeVnetAllFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppServiceEnvironmentsClient) (AppCollectionPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppServiceEnvironmentsChangeVnetAllFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppServiceEnvironmentsChangeVnetAllFuture.Result. +func (future *AppServiceEnvironmentsChangeVnetAllFuture) result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsChangeVnetAllFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + acp.ac.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsChangeVnetAllFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if acp.ac.Response.Response, err = future.GetResult(sender); err == nil && acp.ac.Response.Response.StatusCode != http.StatusNoContent { + acp, err = client.ChangeVnetResponder(acp.ac.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsChangeVnetAllFuture", "Result", acp.ac.Response.Response, "Failure responding to request") + } + } + return +} + +// AppServiceEnvironmentsChangeVnetFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppServiceEnvironmentsChangeVnetFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppServiceEnvironmentsClient) (AppCollectionPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppServiceEnvironmentsChangeVnetFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppServiceEnvironmentsChangeVnetFuture.Result. +func (future *AppServiceEnvironmentsChangeVnetFuture) result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsChangeVnetFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + acp.ac.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsChangeVnetFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if acp.ac.Response.Response, err = future.GetResult(sender); err == nil && acp.ac.Response.Response.StatusCode != http.StatusNoContent { + acp, err = client.ChangeVnetResponder(acp.ac.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsChangeVnetFuture", "Result", acp.ac.Response.Response, "Failure responding to request") + } + } + return +} + +// AppServiceEnvironmentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppServiceEnvironmentsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppServiceEnvironmentsClient) (AppServiceEnvironmentResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppServiceEnvironmentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppServiceEnvironmentsCreateOrUpdateFuture.Result. +func (future *AppServiceEnvironmentsCreateOrUpdateFuture) result(client AppServiceEnvironmentsClient) (aser AppServiceEnvironmentResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + aser.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if aser.Response.Response, err = future.GetResult(sender); err == nil && aser.Response.Response.StatusCode != http.StatusNoContent { + aser, err = client.CreateOrUpdateResponder(aser.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateFuture", "Result", aser.Response.Response, "Failure responding to request") + } + } + return +} + +// AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppServiceEnvironmentsClient) (WorkerPoolResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture.Result. +func (future *AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture) result(client AppServiceEnvironmentsClient) (wpr WorkerPoolResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + wpr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if wpr.Response.Response, err = future.GetResult(sender); err == nil && wpr.Response.Response.StatusCode != http.StatusNoContent { + wpr, err = client.CreateOrUpdateMultiRolePoolResponder(wpr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateMultiRolePoolFuture", "Result", wpr.Response.Response, "Failure responding to request") + } + } + return +} + +// AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppServiceEnvironmentsClient) (WorkerPoolResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture.Result. +func (future *AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture) result(client AppServiceEnvironmentsClient) (wpr WorkerPoolResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + wpr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if wpr.Response.Response, err = future.GetResult(sender); err == nil && wpr.Response.Response.StatusCode != http.StatusNoContent { + wpr, err = client.CreateOrUpdateWorkerPoolResponder(wpr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsCreateOrUpdateWorkerPoolFuture", "Result", wpr.Response.Response, "Failure responding to request") + } + } + return +} + +// AppServiceEnvironmentsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppServiceEnvironmentsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppServiceEnvironmentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppServiceEnvironmentsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppServiceEnvironmentsDeleteFuture.Result. +func (future *AppServiceEnvironmentsDeleteFuture) result(client AppServiceEnvironmentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AppServiceEnvironmentsDeletePrivateEndpointConnectionFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type AppServiceEnvironmentsDeletePrivateEndpointConnectionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppServiceEnvironmentsClient) (SetObject, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppServiceEnvironmentsDeletePrivateEndpointConnectionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppServiceEnvironmentsDeletePrivateEndpointConnectionFuture.Result. +func (future *AppServiceEnvironmentsDeletePrivateEndpointConnectionFuture) result(client AppServiceEnvironmentsClient) (so SetObject, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsDeletePrivateEndpointConnectionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + so.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsDeletePrivateEndpointConnectionFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { + so, err = client.DeletePrivateEndpointConnectionResponder(so.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsDeletePrivateEndpointConnectionFuture", "Result", so.Response.Response, "Failure responding to request") + } + } + return +} + +// AppServiceEnvironmentsResumeAllFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppServiceEnvironmentsResumeAllFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppServiceEnvironmentsClient) (AppCollectionPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppServiceEnvironmentsResumeAllFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppServiceEnvironmentsResumeAllFuture.Result. +func (future *AppServiceEnvironmentsResumeAllFuture) result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsResumeAllFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + acp.ac.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsResumeAllFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if acp.ac.Response.Response, err = future.GetResult(sender); err == nil && acp.ac.Response.Response.StatusCode != http.StatusNoContent { + acp, err = client.ResumeResponder(acp.ac.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsResumeAllFuture", "Result", acp.ac.Response.Response, "Failure responding to request") + } + } + return +} + +// AppServiceEnvironmentsResumeFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppServiceEnvironmentsResumeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppServiceEnvironmentsClient) (AppCollectionPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppServiceEnvironmentsResumeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppServiceEnvironmentsResumeFuture.Result. +func (future *AppServiceEnvironmentsResumeFuture) result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsResumeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + acp.ac.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsResumeFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if acp.ac.Response.Response, err = future.GetResult(sender); err == nil && acp.ac.Response.Response.StatusCode != http.StatusNoContent { + acp, err = client.ResumeResponder(acp.ac.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsResumeFuture", "Result", acp.ac.Response.Response, "Failure responding to request") + } + } + return +} + +// AppServiceEnvironmentsSuspendAllFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppServiceEnvironmentsSuspendAllFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppServiceEnvironmentsClient) (AppCollectionPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppServiceEnvironmentsSuspendAllFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppServiceEnvironmentsSuspendAllFuture.Result. +func (future *AppServiceEnvironmentsSuspendAllFuture) result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsSuspendAllFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + acp.ac.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsSuspendAllFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if acp.ac.Response.Response, err = future.GetResult(sender); err == nil && acp.ac.Response.Response.StatusCode != http.StatusNoContent { + acp, err = client.SuspendResponder(acp.ac.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsSuspendAllFuture", "Result", acp.ac.Response.Response, "Failure responding to request") + } + } + return +} + +// AppServiceEnvironmentsSuspendFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppServiceEnvironmentsSuspendFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppServiceEnvironmentsClient) (AppCollectionPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppServiceEnvironmentsSuspendFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppServiceEnvironmentsSuspendFuture.Result. +func (future *AppServiceEnvironmentsSuspendFuture) result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsSuspendFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + acp.ac.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppServiceEnvironmentsSuspendFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if acp.ac.Response.Response, err = future.GetResult(sender); err == nil && acp.ac.Response.Response.StatusCode != http.StatusNoContent { + acp, err = client.SuspendResponder(acp.ac.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsSuspendFuture", "Result", acp.ac.Response.Response, "Failure responding to request") + } + } + return +} + +// AppserviceGithubToken github access token for Appservice CLI github integration. +type AppserviceGithubToken struct { + // AccessToken - Github access token for Appservice CLI github integration + AccessToken *string `json:"accessToken,omitempty"` + // Scope - Scope of the github access token + Scope *string `json:"scope,omitempty"` + // TokenType - token type + TokenType *string `json:"tokenType,omitempty"` + // GotToken - True if valid github token received, False otherwise + GotToken *bool `json:"gotToken,omitempty"` + // ErrorMessage - Error message if unable to get token + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// AppserviceGithubTokenRequest appservice Github token request content. +type AppserviceGithubTokenRequest struct { + // Code - Code string to exchange for Github Access token + Code *string `json:"code,omitempty"` + // State - State string used for verification. + State *string `json:"state,omitempty"` +} + +// AppServicePlan app Service plan. +type AppServicePlan struct { + autorest.Response `json:"-"` + // AppServicePlanProperties - AppServicePlan resource specific properties + *AppServicePlanProperties `json:"properties,omitempty"` + Sku *SkuDescription `json:"sku,omitempty"` + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Location - Resource Location. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AppServicePlan. +func (asp AppServicePlan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asp.AppServicePlanProperties != nil { + objectMap["properties"] = asp.AppServicePlanProperties + } + if asp.Sku != nil { + objectMap["sku"] = asp.Sku + } + if asp.ExtendedLocation != nil { + objectMap["extendedLocation"] = asp.ExtendedLocation + } + if asp.Kind != nil { + objectMap["kind"] = asp.Kind + } + if asp.Location != nil { + objectMap["location"] = asp.Location + } + if asp.Tags != nil { + objectMap["tags"] = asp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AppServicePlan struct. +func (asp *AppServicePlan) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var appServicePlanProperties AppServicePlanProperties + err = json.Unmarshal(*v, &appServicePlanProperties) + if err != nil { + return err + } + asp.AppServicePlanProperties = &appServicePlanProperties + } + case "sku": + if v != nil { + var sku SkuDescription + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + asp.Sku = &sku + } + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + asp.ExtendedLocation = &extendedLocation + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + asp.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asp.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + asp.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asp.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asp.Tags = tags + } + } + } + + return nil +} + +// AppServicePlanCollection collection of App Service plans. +type AppServicePlanCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]AppServicePlan `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppServicePlanCollection. +func (aspc AppServicePlanCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aspc.Value != nil { + objectMap["value"] = aspc.Value + } + return json.Marshal(objectMap) +} + +// AppServicePlanCollectionIterator provides access to a complete listing of AppServicePlan values. +type AppServicePlanCollectionIterator struct { + i int + page AppServicePlanCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AppServicePlanCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlanCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AppServicePlanCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppServicePlanCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AppServicePlanCollectionIterator) Response() AppServicePlanCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AppServicePlanCollectionIterator) Value() AppServicePlan { + if !iter.page.NotDone() { + return AppServicePlan{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppServicePlanCollectionIterator type. +func NewAppServicePlanCollectionIterator(page AppServicePlanCollectionPage) AppServicePlanCollectionIterator { + return AppServicePlanCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aspc AppServicePlanCollection) IsEmpty() bool { + return aspc.Value == nil || len(*aspc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aspc AppServicePlanCollection) hasNextLink() bool { + return aspc.NextLink != nil && len(*aspc.NextLink) != 0 +} + +// appServicePlanCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aspc AppServicePlanCollection) appServicePlanCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !aspc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aspc.NextLink))) +} + +// AppServicePlanCollectionPage contains a page of AppServicePlan values. +type AppServicePlanCollectionPage struct { + fn func(context.Context, AppServicePlanCollection) (AppServicePlanCollection, error) + aspc AppServicePlanCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AppServicePlanCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServicePlanCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aspc) + if err != nil { + return err + } + page.aspc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AppServicePlanCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppServicePlanCollectionPage) NotDone() bool { + return !page.aspc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppServicePlanCollectionPage) Response() AppServicePlanCollection { + return page.aspc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppServicePlanCollectionPage) Values() []AppServicePlan { + if page.aspc.IsEmpty() { + return nil + } + return *page.aspc.Value +} + +// Creates a new instance of the AppServicePlanCollectionPage type. +func NewAppServicePlanCollectionPage(cur AppServicePlanCollection, getNextPage func(context.Context, AppServicePlanCollection) (AppServicePlanCollection, error)) AppServicePlanCollectionPage { + return AppServicePlanCollectionPage{ + fn: getNextPage, + aspc: cur, + } +} + +// AppServicePlanPatchResource ARM resource for a app service plan. +type AppServicePlanPatchResource struct { + // AppServicePlanPatchResourceProperties - AppServicePlanPatchResource resource specific properties + *AppServicePlanPatchResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppServicePlanPatchResource. +func (asppr AppServicePlanPatchResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asppr.AppServicePlanPatchResourceProperties != nil { + objectMap["properties"] = asppr.AppServicePlanPatchResourceProperties + } + if asppr.Kind != nil { + objectMap["kind"] = asppr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AppServicePlanPatchResource struct. +func (asppr *AppServicePlanPatchResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var appServicePlanPatchResourceProperties AppServicePlanPatchResourceProperties + err = json.Unmarshal(*v, &appServicePlanPatchResourceProperties) + if err != nil { + return err + } + asppr.AppServicePlanPatchResourceProperties = &appServicePlanPatchResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asppr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + asppr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asppr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asppr.Type = &typeVar + } + } + } + + return nil +} + +// AppServicePlanPatchResourceProperties appServicePlanPatchResource resource specific properties +type AppServicePlanPatchResourceProperties struct { + // WorkerTierName - Target worker tier assigned to the App Service plan. + WorkerTierName *string `json:"workerTierName,omitempty"` + // Status - READ-ONLY; App Service plan status. Possible values include: 'StatusOptionsReady', 'StatusOptionsPending', 'StatusOptionsCreating' + Status StatusOptions `json:"status,omitempty"` + // Subscription - READ-ONLY; App Service plan subscription. + Subscription *string `json:"subscription,omitempty"` + // HostingEnvironmentProfile - Specification for the App Service Environment to use for the App Service plan. + HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` + // MaximumNumberOfWorkers - READ-ONLY; Maximum number of instances that can be assigned to this App Service plan. + MaximumNumberOfWorkers *int32 `json:"maximumNumberOfWorkers,omitempty"` + // GeoRegion - READ-ONLY; Geographical location for the App Service plan. + GeoRegion *string `json:"geoRegion,omitempty"` + // PerSiteScaling - If true, apps assigned to this App Service plan can be scaled independently. + // If false, apps assigned to this App Service plan will scale to all instances of the plan. + PerSiteScaling *bool `json:"perSiteScaling,omitempty"` + // ElasticScaleEnabled - ServerFarm supports ElasticScale. Apps in this plan will scale as if the ServerFarm was ElasticPremium sku + ElasticScaleEnabled *bool `json:"elasticScaleEnabled,omitempty"` + // MaximumElasticWorkerCount - Maximum number of total workers allowed for this ElasticScaleEnabled App Service Plan + MaximumElasticWorkerCount *int32 `json:"maximumElasticWorkerCount,omitempty"` + // NumberOfSites - READ-ONLY; Number of apps assigned to this App Service plan. + NumberOfSites *int32 `json:"numberOfSites,omitempty"` + // IsSpot - If true, this App Service Plan owns spot instances. + IsSpot *bool `json:"isSpot,omitempty"` + // SpotExpirationTime - The time when the server farm expires. Valid only if it is a spot server farm. + SpotExpirationTime *date.Time `json:"spotExpirationTime,omitempty"` + // FreeOfferExpirationTime - The time when the server farm free offer expires. + FreeOfferExpirationTime *date.Time `json:"freeOfferExpirationTime,omitempty"` + // ResourceGroup - READ-ONLY; Resource group of the App Service plan. + ResourceGroup *string `json:"resourceGroup,omitempty"` + // Reserved - If Linux app service plan true, false otherwise. + Reserved *bool `json:"reserved,omitempty"` + // IsXenon - Obsolete: If Hyper-V container app service plan true, false otherwise. + IsXenon *bool `json:"isXenon,omitempty"` + // HyperV - If Hyper-V container app service plan true, false otherwise. + HyperV *bool `json:"hyperV,omitempty"` + // TargetWorkerCount - Scaling worker count. + TargetWorkerCount *int32 `json:"targetWorkerCount,omitempty"` + // TargetWorkerSizeID - Scaling worker size ID. + TargetWorkerSizeID *int32 `json:"targetWorkerSizeId,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the App Service Plan. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateInProgress', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // KubeEnvironmentProfile - Specification for the Kubernetes Environment to use for the App Service plan. + KubeEnvironmentProfile *KubeEnvironmentProfile `json:"kubeEnvironmentProfile,omitempty"` + // ZoneRedundant - If true, this App Service Plan will perform availability zone balancing. + // If false, this App Service Plan will not perform availability zone balancing. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppServicePlanPatchResourceProperties. +func (asppr AppServicePlanPatchResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asppr.WorkerTierName != nil { + objectMap["workerTierName"] = asppr.WorkerTierName + } + if asppr.HostingEnvironmentProfile != nil { + objectMap["hostingEnvironmentProfile"] = asppr.HostingEnvironmentProfile + } + if asppr.PerSiteScaling != nil { + objectMap["perSiteScaling"] = asppr.PerSiteScaling + } + if asppr.ElasticScaleEnabled != nil { + objectMap["elasticScaleEnabled"] = asppr.ElasticScaleEnabled + } + if asppr.MaximumElasticWorkerCount != nil { + objectMap["maximumElasticWorkerCount"] = asppr.MaximumElasticWorkerCount + } + if asppr.IsSpot != nil { + objectMap["isSpot"] = asppr.IsSpot + } + if asppr.SpotExpirationTime != nil { + objectMap["spotExpirationTime"] = asppr.SpotExpirationTime + } + if asppr.FreeOfferExpirationTime != nil { + objectMap["freeOfferExpirationTime"] = asppr.FreeOfferExpirationTime + } + if asppr.Reserved != nil { + objectMap["reserved"] = asppr.Reserved + } + if asppr.IsXenon != nil { + objectMap["isXenon"] = asppr.IsXenon + } + if asppr.HyperV != nil { + objectMap["hyperV"] = asppr.HyperV + } + if asppr.TargetWorkerCount != nil { + objectMap["targetWorkerCount"] = asppr.TargetWorkerCount + } + if asppr.TargetWorkerSizeID != nil { + objectMap["targetWorkerSizeId"] = asppr.TargetWorkerSizeID + } + if asppr.KubeEnvironmentProfile != nil { + objectMap["kubeEnvironmentProfile"] = asppr.KubeEnvironmentProfile + } + if asppr.ZoneRedundant != nil { + objectMap["zoneRedundant"] = asppr.ZoneRedundant + } + return json.Marshal(objectMap) +} + +// AppServicePlanProperties appServicePlan resource specific properties +type AppServicePlanProperties struct { + // WorkerTierName - Target worker tier assigned to the App Service plan. + WorkerTierName *string `json:"workerTierName,omitempty"` + // Status - READ-ONLY; App Service plan status. Possible values include: 'StatusOptionsReady', 'StatusOptionsPending', 'StatusOptionsCreating' + Status StatusOptions `json:"status,omitempty"` + // Subscription - READ-ONLY; App Service plan subscription. + Subscription *string `json:"subscription,omitempty"` + // HostingEnvironmentProfile - Specification for the App Service Environment to use for the App Service plan. + HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` + // MaximumNumberOfWorkers - READ-ONLY; Maximum number of instances that can be assigned to this App Service plan. + MaximumNumberOfWorkers *int32 `json:"maximumNumberOfWorkers,omitempty"` + // GeoRegion - READ-ONLY; Geographical location for the App Service plan. + GeoRegion *string `json:"geoRegion,omitempty"` + // PerSiteScaling - If true, apps assigned to this App Service plan can be scaled independently. + // If false, apps assigned to this App Service plan will scale to all instances of the plan. + PerSiteScaling *bool `json:"perSiteScaling,omitempty"` + // ElasticScaleEnabled - ServerFarm supports ElasticScale. Apps in this plan will scale as if the ServerFarm was ElasticPremium sku + ElasticScaleEnabled *bool `json:"elasticScaleEnabled,omitempty"` + // MaximumElasticWorkerCount - Maximum number of total workers allowed for this ElasticScaleEnabled App Service Plan + MaximumElasticWorkerCount *int32 `json:"maximumElasticWorkerCount,omitempty"` + // NumberOfSites - READ-ONLY; Number of apps assigned to this App Service plan. + NumberOfSites *int32 `json:"numberOfSites,omitempty"` + // IsSpot - If true, this App Service Plan owns spot instances. + IsSpot *bool `json:"isSpot,omitempty"` + // SpotExpirationTime - The time when the server farm expires. Valid only if it is a spot server farm. + SpotExpirationTime *date.Time `json:"spotExpirationTime,omitempty"` + // FreeOfferExpirationTime - The time when the server farm free offer expires. + FreeOfferExpirationTime *date.Time `json:"freeOfferExpirationTime,omitempty"` + // ResourceGroup - READ-ONLY; Resource group of the App Service plan. + ResourceGroup *string `json:"resourceGroup,omitempty"` + // Reserved - If Linux app service plan true, false otherwise. + Reserved *bool `json:"reserved,omitempty"` + // IsXenon - Obsolete: If Hyper-V container app service plan true, false otherwise. + IsXenon *bool `json:"isXenon,omitempty"` + // HyperV - If Hyper-V container app service plan true, false otherwise. + HyperV *bool `json:"hyperV,omitempty"` + // TargetWorkerCount - Scaling worker count. + TargetWorkerCount *int32 `json:"targetWorkerCount,omitempty"` + // TargetWorkerSizeID - Scaling worker size ID. + TargetWorkerSizeID *int32 `json:"targetWorkerSizeId,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the App Service Plan. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateInProgress', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // KubeEnvironmentProfile - Specification for the Kubernetes Environment to use for the App Service plan. + KubeEnvironmentProfile *KubeEnvironmentProfile `json:"kubeEnvironmentProfile,omitempty"` + // ZoneRedundant - If true, this App Service Plan will perform availability zone balancing. + // If false, this App Service Plan will not perform availability zone balancing. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppServicePlanProperties. +func (asp AppServicePlanProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asp.WorkerTierName != nil { + objectMap["workerTierName"] = asp.WorkerTierName + } + if asp.HostingEnvironmentProfile != nil { + objectMap["hostingEnvironmentProfile"] = asp.HostingEnvironmentProfile + } + if asp.PerSiteScaling != nil { + objectMap["perSiteScaling"] = asp.PerSiteScaling + } + if asp.ElasticScaleEnabled != nil { + objectMap["elasticScaleEnabled"] = asp.ElasticScaleEnabled + } + if asp.MaximumElasticWorkerCount != nil { + objectMap["maximumElasticWorkerCount"] = asp.MaximumElasticWorkerCount + } + if asp.IsSpot != nil { + objectMap["isSpot"] = asp.IsSpot + } + if asp.SpotExpirationTime != nil { + objectMap["spotExpirationTime"] = asp.SpotExpirationTime + } + if asp.FreeOfferExpirationTime != nil { + objectMap["freeOfferExpirationTime"] = asp.FreeOfferExpirationTime + } + if asp.Reserved != nil { + objectMap["reserved"] = asp.Reserved + } + if asp.IsXenon != nil { + objectMap["isXenon"] = asp.IsXenon + } + if asp.HyperV != nil { + objectMap["hyperV"] = asp.HyperV + } + if asp.TargetWorkerCount != nil { + objectMap["targetWorkerCount"] = asp.TargetWorkerCount + } + if asp.TargetWorkerSizeID != nil { + objectMap["targetWorkerSizeId"] = asp.TargetWorkerSizeID + } + if asp.KubeEnvironmentProfile != nil { + objectMap["kubeEnvironmentProfile"] = asp.KubeEnvironmentProfile + } + if asp.ZoneRedundant != nil { + objectMap["zoneRedundant"] = asp.ZoneRedundant + } + return json.Marshal(objectMap) +} + +// AppServicePlansCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppServicePlansCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppServicePlansClient) (AppServicePlan, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppServicePlansCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppServicePlansCreateOrUpdateFuture.Result. +func (future *AppServicePlansCreateOrUpdateFuture) result(client AppServicePlansClient) (asp AppServicePlan, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + asp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppServicePlansCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if asp.Response.Response, err = future.GetResult(sender); err == nil && asp.Response.Response.StatusCode != http.StatusNoContent { + asp, err = client.CreateOrUpdateResponder(asp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansCreateOrUpdateFuture", "Result", asp.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsInstallSiteExtensionFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsInstallSiteExtensionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (SiteExtensionInfo, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsInstallSiteExtensionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsInstallSiteExtensionFuture.Result. +func (future *AppsInstallSiteExtensionFuture) result(client AppsClient) (sei SiteExtensionInfo, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsInstallSiteExtensionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sei.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsInstallSiteExtensionFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sei.Response.Response, err = future.GetResult(sender); err == nil && sei.Response.Response.StatusCode != http.StatusNoContent { + sei, err = client.InstallSiteExtensionResponder(sei.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsInstallSiteExtensionFuture", "Result", sei.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsInstallSiteExtensionSlotFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsInstallSiteExtensionSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (SiteExtensionInfo, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsInstallSiteExtensionSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsInstallSiteExtensionSlotFuture.Result. +func (future *AppsInstallSiteExtensionSlotFuture) result(client AppsClient) (sei SiteExtensionInfo, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsInstallSiteExtensionSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sei.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsInstallSiteExtensionSlotFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sei.Response.Response, err = future.GetResult(sender); err == nil && sei.Response.Response.StatusCode != http.StatusNoContent { + sei, err = client.InstallSiteExtensionSlotResponder(sei.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsInstallSiteExtensionSlotFuture", "Result", sei.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsListPublishingCredentialsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsListPublishingCredentialsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (User, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsListPublishingCredentialsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsListPublishingCredentialsFuture.Result. +func (future *AppsListPublishingCredentialsFuture) result(client AppsClient) (u User, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsListPublishingCredentialsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + u.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsListPublishingCredentialsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if u.Response.Response, err = future.GetResult(sender); err == nil && u.Response.Response.StatusCode != http.StatusNoContent { + u, err = client.ListPublishingCredentialsResponder(u.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsListPublishingCredentialsFuture", "Result", u.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsListPublishingCredentialsSlotFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsListPublishingCredentialsSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (User, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsListPublishingCredentialsSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsListPublishingCredentialsSlotFuture.Result. +func (future *AppsListPublishingCredentialsSlotFuture) result(client AppsClient) (u User, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsListPublishingCredentialsSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + u.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsListPublishingCredentialsSlotFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if u.Response.Response, err = future.GetResult(sender); err == nil && u.Response.Response.StatusCode != http.StatusNoContent { + u, err = client.ListPublishingCredentialsSlotResponder(u.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsListPublishingCredentialsSlotFuture", "Result", u.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsMigrateMySQLFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsMigrateMySQLFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (Operation, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsMigrateMySQLFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsMigrateMySQLFuture.Result. +func (future *AppsMigrateMySQLFuture) result(client AppsClient) (o Operation, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsMigrateMySQLFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + o.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsMigrateMySQLFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if o.Response.Response, err = future.GetResult(sender); err == nil && o.Response.Response.StatusCode != http.StatusNoContent { + o, err = client.MigrateMySQLResponder(o.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsMigrateMySQLFuture", "Result", o.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsMigrateStorageFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsMigrateStorageFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (StorageMigrationResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsMigrateStorageFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsMigrateStorageFuture.Result. +func (future *AppsMigrateStorageFuture) result(client AppsClient) (smr StorageMigrationResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsMigrateStorageFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + smr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsMigrateStorageFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if smr.Response.Response, err = future.GetResult(sender); err == nil && smr.Response.Response.StatusCode != http.StatusNoContent { + smr, err = client.MigrateStorageResponder(smr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsMigrateStorageFuture", "Result", smr.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsRestoreFromBackupBlobFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsRestoreFromBackupBlobFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsRestoreFromBackupBlobFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsRestoreFromBackupBlobFuture.Result. +func (future *AppsRestoreFromBackupBlobFuture) result(client AppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreFromBackupBlobFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsRestoreFromBackupBlobFuture") + return + } + ar.Response = future.Response() + return +} + +// AppsRestoreFromBackupBlobSlotFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsRestoreFromBackupBlobSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsRestoreFromBackupBlobSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsRestoreFromBackupBlobSlotFuture.Result. +func (future *AppsRestoreFromBackupBlobSlotFuture) result(client AppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreFromBackupBlobSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsRestoreFromBackupBlobSlotFuture") + return + } + ar.Response = future.Response() + return +} + +// AppsRestoreFromDeletedAppFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsRestoreFromDeletedAppFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsRestoreFromDeletedAppFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsRestoreFromDeletedAppFuture.Result. +func (future *AppsRestoreFromDeletedAppFuture) result(client AppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreFromDeletedAppFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsRestoreFromDeletedAppFuture") + return + } + ar.Response = future.Response() + return +} + +// AppsRestoreFromDeletedAppSlotFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsRestoreFromDeletedAppSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsRestoreFromDeletedAppSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsRestoreFromDeletedAppSlotFuture.Result. +func (future *AppsRestoreFromDeletedAppSlotFuture) result(client AppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreFromDeletedAppSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsRestoreFromDeletedAppSlotFuture") + return + } + ar.Response = future.Response() + return +} + +// AppsRestoreFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type AppsRestoreFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsRestoreFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsRestoreFuture.Result. +func (future *AppsRestoreFuture) result(client AppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsRestoreFuture") + return + } + ar.Response = future.Response() + return +} + +// AppsRestoreSlotFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsRestoreSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsRestoreSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsRestoreSlotFuture.Result. +func (future *AppsRestoreSlotFuture) result(client AppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsRestoreSlotFuture") + return + } + ar.Response = future.Response() + return +} + +// AppsRestoreSnapshotFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsRestoreSnapshotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsRestoreSnapshotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsRestoreSnapshotFuture.Result. +func (future *AppsRestoreSnapshotFuture) result(client AppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreSnapshotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsRestoreSnapshotFuture") + return + } + ar.Response = future.Response() + return +} + +// AppsRestoreSnapshotSlotFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsRestoreSnapshotSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsRestoreSnapshotSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsRestoreSnapshotSlotFuture.Result. +func (future *AppsRestoreSnapshotSlotFuture) result(client AppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreSnapshotSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsRestoreSnapshotSlotFuture") + return + } + ar.Response = future.Response() + return +} + +// AppsStartNetworkTraceFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsStartNetworkTraceFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (ListNetworkTrace, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsStartNetworkTraceFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsStartNetworkTraceFuture.Result. +func (future *AppsStartNetworkTraceFuture) result(client AppsClient) (lnt ListNetworkTrace, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsStartNetworkTraceFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + lnt.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsStartNetworkTraceFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if lnt.Response.Response, err = future.GetResult(sender); err == nil && lnt.Response.Response.StatusCode != http.StatusNoContent { + lnt, err = client.StartNetworkTraceResponder(lnt.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsStartNetworkTraceFuture", "Result", lnt.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsStartNetworkTraceSlotFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsStartNetworkTraceSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (ListNetworkTrace, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsStartNetworkTraceSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsStartNetworkTraceSlotFuture.Result. +func (future *AppsStartNetworkTraceSlotFuture) result(client AppsClient) (lnt ListNetworkTrace, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsStartNetworkTraceSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + lnt.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsStartNetworkTraceSlotFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if lnt.Response.Response, err = future.GetResult(sender); err == nil && lnt.Response.Response.StatusCode != http.StatusNoContent { + lnt, err = client.StartNetworkTraceSlotResponder(lnt.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsStartNetworkTraceSlotFuture", "Result", lnt.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsStartWebSiteNetworkTraceOperationFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type AppsStartWebSiteNetworkTraceOperationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (ListNetworkTrace, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsStartWebSiteNetworkTraceOperationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsStartWebSiteNetworkTraceOperationFuture.Result. +func (future *AppsStartWebSiteNetworkTraceOperationFuture) result(client AppsClient) (lnt ListNetworkTrace, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsStartWebSiteNetworkTraceOperationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + lnt.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsStartWebSiteNetworkTraceOperationFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if lnt.Response.Response, err = future.GetResult(sender); err == nil && lnt.Response.Response.StatusCode != http.StatusNoContent { + lnt, err = client.StartWebSiteNetworkTraceOperationResponder(lnt.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsStartWebSiteNetworkTraceOperationFuture", "Result", lnt.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsStartWebSiteNetworkTraceOperationSlotFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type AppsStartWebSiteNetworkTraceOperationSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (ListNetworkTrace, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsStartWebSiteNetworkTraceOperationSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsStartWebSiteNetworkTraceOperationSlotFuture.Result. +func (future *AppsStartWebSiteNetworkTraceOperationSlotFuture) result(client AppsClient) (lnt ListNetworkTrace, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsStartWebSiteNetworkTraceOperationSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + lnt.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsStartWebSiteNetworkTraceOperationSlotFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if lnt.Response.Response, err = future.GetResult(sender); err == nil && lnt.Response.Response.StatusCode != http.StatusNoContent { + lnt, err = client.StartWebSiteNetworkTraceOperationSlotResponder(lnt.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsStartWebSiteNetworkTraceOperationSlotFuture", "Result", lnt.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsSwapSlotSlotFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsSwapSlotSlotFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsSwapSlotSlotFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsSwapSlotSlotFuture.Result. +func (future *AppsSwapSlotSlotFuture) result(client AppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsSwapSlotSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsSwapSlotSlotFuture") + return + } + ar.Response = future.Response() + return +} + +// AppsSwapSlotWithProductionFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsSwapSlotWithProductionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsSwapSlotWithProductionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsSwapSlotWithProductionFuture.Result. +func (future *AppsSwapSlotWithProductionFuture) result(client AppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsSwapSlotWithProductionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.AppsSwapSlotWithProductionFuture") + return + } + ar.Response = future.Response() + return +} + +// AppStack web App stack. +type AppStack struct { + // Location - READ-ONLY; Web App stack location. + Location *string `json:"location,omitempty"` + // AppStackProperties - WebAppStack resource specific properties + *AppStackProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppStack. +func (as AppStack) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if as.AppStackProperties != nil { + objectMap["properties"] = as.AppStackProperties + } + if as.Kind != nil { + objectMap["kind"] = as.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AppStack struct. +func (as *AppStack) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + as.Location = &location + } + case "properties": + if v != nil { + var appStackProperties AppStackProperties + err = json.Unmarshal(*v, &appStackProperties) + if err != nil { + return err + } + as.AppStackProperties = &appStackProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + as.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + as.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + as.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + as.Type = &typeVar + } + } + } + + return nil +} + +// AppStackCollection collection of Web app Stacks +type AppStackCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]AppStack `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppStackCollection. +func (asc AppStackCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asc.Value != nil { + objectMap["value"] = asc.Value + } + return json.Marshal(objectMap) +} + +// AppStackCollectionIterator provides access to a complete listing of AppStack values. +type AppStackCollectionIterator struct { + i int + page AppStackCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AppStackCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppStackCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AppStackCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppStackCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AppStackCollectionIterator) Response() AppStackCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AppStackCollectionIterator) Value() AppStack { + if !iter.page.NotDone() { + return AppStack{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppStackCollectionIterator type. +func NewAppStackCollectionIterator(page AppStackCollectionPage) AppStackCollectionIterator { + return AppStackCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (asc AppStackCollection) IsEmpty() bool { + return asc.Value == nil || len(*asc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (asc AppStackCollection) hasNextLink() bool { + return asc.NextLink != nil && len(*asc.NextLink) != 0 +} + +// appStackCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (asc AppStackCollection) appStackCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !asc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(asc.NextLink))) +} + +// AppStackCollectionPage contains a page of AppStack values. +type AppStackCollectionPage struct { + fn func(context.Context, AppStackCollection) (AppStackCollection, error) + asc AppStackCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AppStackCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppStackCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.asc) + if err != nil { + return err + } + page.asc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AppStackCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppStackCollectionPage) NotDone() bool { + return !page.asc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppStackCollectionPage) Response() AppStackCollection { + return page.asc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppStackCollectionPage) Values() []AppStack { + if page.asc.IsEmpty() { + return nil + } + return *page.asc.Value +} + +// Creates a new instance of the AppStackCollectionPage type. +func NewAppStackCollectionPage(cur AppStackCollection, getNextPage func(context.Context, AppStackCollection) (AppStackCollection, error)) AppStackCollectionPage { + return AppStackCollectionPage{ + fn: getNextPage, + asc: cur, + } +} + +// AppStackProperties webAppStack resource specific properties +type AppStackProperties struct { + // DisplayText - READ-ONLY; Web App stack (display only). + DisplayText *string `json:"displayText,omitempty"` + // Value - READ-ONLY; Web App stack name. + Value *string `json:"value,omitempty"` + // MajorVersions - READ-ONLY; List of major versions available. + MajorVersions *[]AppMajorVersion `json:"majorVersions,omitempty"` + // PreferredOs - READ-ONLY; Web App stack preferred OS. Possible values include: 'StackPreferredOsWindows', 'StackPreferredOsLinux' + PreferredOs StackPreferredOs `json:"preferredOs,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppStackProperties. +func (as AppStackProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ArcConfiguration ... +type ArcConfiguration struct { + // ArtifactsStorageType - Possible values include: 'StorageTypeLocalNode', 'StorageTypeNetworkFileSystem' + ArtifactsStorageType StorageType `json:"artifactsStorageType,omitempty"` + ArtifactStorageClassName *string `json:"artifactStorageClassName,omitempty"` + ArtifactStorageMountPath *string `json:"artifactStorageMountPath,omitempty"` + ArtifactStorageNodeName *string `json:"artifactStorageNodeName,omitempty"` + ArtifactStorageAccessMode *string `json:"artifactStorageAccessMode,omitempty"` + FrontEndServiceConfiguration *FrontEndConfiguration `json:"frontEndServiceConfiguration,omitempty"` + KubeConfig *string `json:"kubeConfig,omitempty"` +} + +// ArmIDWrapper a wrapper for an ARM resource id +type ArmIDWrapper struct { + // ID - READ-ONLY + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ArmIDWrapper. +func (aiw ArmIDWrapper) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ArmPlan the plan object in Azure Resource Manager, represents a marketplace plan. +type ArmPlan struct { + // Name - The name. + Name *string `json:"name,omitempty"` + // Publisher - The publisher. + Publisher *string `json:"publisher,omitempty"` + // Product - The product. + Product *string `json:"product,omitempty"` + // PromotionCode - The promotion code. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - Version of product. + Version *string `json:"version,omitempty"` +} + +// AseV3NetworkingConfiguration full view of networking configuration for an ASE. +type AseV3NetworkingConfiguration struct { + autorest.Response `json:"-"` + // AseV3NetworkingConfigurationProperties - AseV3NetworkingConfiguration resource specific properties + *AseV3NetworkingConfigurationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AseV3NetworkingConfiguration. +func (avnc AseV3NetworkingConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if avnc.AseV3NetworkingConfigurationProperties != nil { + objectMap["properties"] = avnc.AseV3NetworkingConfigurationProperties + } + if avnc.Kind != nil { + objectMap["kind"] = avnc.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AseV3NetworkingConfiguration struct. +func (avnc *AseV3NetworkingConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var aseV3NetworkingConfigurationProperties AseV3NetworkingConfigurationProperties + err = json.Unmarshal(*v, &aseV3NetworkingConfigurationProperties) + if err != nil { + return err + } + avnc.AseV3NetworkingConfigurationProperties = &aseV3NetworkingConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + avnc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + avnc.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + avnc.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + avnc.Type = &typeVar + } + } + } + + return nil +} + +// AseV3NetworkingConfigurationProperties aseV3NetworkingConfiguration resource specific properties +type AseV3NetworkingConfigurationProperties struct { + // WindowsOutboundIPAddresses - READ-ONLY + WindowsOutboundIPAddresses *[]string `json:"windowsOutboundIpAddresses,omitempty"` + // LinuxOutboundIPAddresses - READ-ONLY + LinuxOutboundIPAddresses *[]string `json:"linuxOutboundIpAddresses,omitempty"` + // ExternalInboundIPAddresses - READ-ONLY + ExternalInboundIPAddresses *[]string `json:"externalInboundIpAddresses,omitempty"` + // InternalInboundIPAddresses - READ-ONLY + InternalInboundIPAddresses *[]string `json:"internalInboundIpAddresses,omitempty"` + // AllowNewPrivateEndpointConnections - Property to enable and disable new private endpoint connection creation on ASE + AllowNewPrivateEndpointConnections *bool `json:"allowNewPrivateEndpointConnections,omitempty"` +} + +// MarshalJSON is the custom marshaler for AseV3NetworkingConfigurationProperties. +func (avnc AseV3NetworkingConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if avnc.AllowNewPrivateEndpointConnections != nil { + objectMap["allowNewPrivateEndpointConnections"] = avnc.AllowNewPrivateEndpointConnections + } + return json.Marshal(objectMap) +} + +// AuthPlatform the configuration settings of the platform of App Service Authentication/Authorization. +type AuthPlatform struct { + // Enabled - true if the Authentication / Authorization feature is enabled for the current app; otherwise, false. + Enabled *bool `json:"enabled,omitempty"` + // RuntimeVersion - The RuntimeVersion of the Authentication / Authorization feature in use for the current app. + // The setting in this value can control the behavior of certain features in the Authentication / Authorization module. + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + // ConfigFilePath - The path of the config file containing auth settings if they come from a file. + // If the path is relative, base will the site's root directory. + ConfigFilePath *string `json:"configFilePath,omitempty"` +} + +// AutoHealActions actions which to take by the auto-heal module when a rule is triggered. +type AutoHealActions struct { + // ActionType - Predefined action to be taken. Possible values include: 'AutoHealActionTypeRecycle', 'AutoHealActionTypeLogEvent', 'AutoHealActionTypeCustomAction' + ActionType AutoHealActionType `json:"actionType,omitempty"` + // CustomAction - Custom action to be taken. + CustomAction *AutoHealCustomAction `json:"customAction,omitempty"` + // MinProcessExecutionTime - Minimum time the process must execute + // before taking the action + MinProcessExecutionTime *string `json:"minProcessExecutionTime,omitempty"` +} + +// AutoHealCustomAction custom action to be executed +// when an auto heal rule is triggered. +type AutoHealCustomAction struct { + // Exe - Executable to be run. + Exe *string `json:"exe,omitempty"` + // Parameters - Parameters for the executable. + Parameters *string `json:"parameters,omitempty"` +} + +// AutoHealRules rules that can be defined for auto-heal. +type AutoHealRules struct { + // Triggers - Conditions that describe when to execute the auto-heal actions. + Triggers *AutoHealTriggers `json:"triggers,omitempty"` + // Actions - Actions to be executed when a rule is triggered. + Actions *AutoHealActions `json:"actions,omitempty"` +} + +// AutoHealTriggers triggers for auto-heal. +type AutoHealTriggers struct { + // Requests - A rule based on total requests. + Requests *RequestsBasedTrigger `json:"requests,omitempty"` + // PrivateBytesInKB - A rule based on private bytes. + PrivateBytesInKB *int32 `json:"privateBytesInKB,omitempty"` + // StatusCodes - A rule based on status codes. + StatusCodes *[]StatusCodesBasedTrigger `json:"statusCodes,omitempty"` + // SlowRequests - A rule based on request execution time. + SlowRequests *SlowRequestsBasedTrigger `json:"slowRequests,omitempty"` + // SlowRequestsWithPath - A rule based on multiple Slow Requests Rule with path + SlowRequestsWithPath *[]SlowRequestsBasedTrigger `json:"slowRequestsWithPath,omitempty"` + // StatusCodesRange - A rule based on status codes ranges. + StatusCodesRange *[]StatusCodesRangeBasedTrigger `json:"statusCodesRange,omitempty"` +} + +// AzureActiveDirectory the configuration settings of the Azure Active directory provider. +type AzureActiveDirectory struct { + // Enabled - false if the Azure Active Directory provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + // Registration - The configuration settings of the Azure Active Directory app registration. + Registration *AzureActiveDirectoryRegistration `json:"registration,omitempty"` + // Login - The configuration settings of the Azure Active Directory login flow. + Login *AzureActiveDirectoryLogin `json:"login,omitempty"` + // Validation - The configuration settings of the Azure Active Directory token validation flow. + Validation *AzureActiveDirectoryValidation `json:"validation,omitempty"` + // IsAutoProvisioned - Gets a value indicating whether the Azure AD configuration was auto-provisioned using 1st party tooling. + // This is an internal flag primarily intended to support the Azure Management Portal. Users should not + // read or write to this property. + IsAutoProvisioned *bool `json:"isAutoProvisioned,omitempty"` +} + +// AzureActiveDirectoryLogin the configuration settings of the Azure Active Directory login flow. +type AzureActiveDirectoryLogin struct { + // LoginParameters - Login parameters to send to the OpenID Connect authorization endpoint when + // a user logs in. Each parameter must be in the form "key=value". + LoginParameters *[]string `json:"loginParameters,omitempty"` + // DisableWWWAuthenticate - true if the www-authenticate provider should be omitted from the request; otherwise, false. + DisableWWWAuthenticate *bool `json:"disableWWWAuthenticate,omitempty"` +} + +// AzureActiveDirectoryRegistration the configuration settings of the Azure Active Directory app +// registration. +type AzureActiveDirectoryRegistration struct { + // OpenIDIssuer - The OpenID Connect Issuer URI that represents the entity which issues access tokens for this application. + // When using Azure Active Directory, this value is the URI of the directory tenant, e.g. https://login.microsoftonline.com/v2.0/{tenant-guid}/. + // This URI is a case-sensitive identifier for the token issuer. + // More information on OpenID Connect Discovery: http://openid.net/specs/openid-connect-discovery-1_0.html + OpenIDIssuer *string `json:"openIdIssuer,omitempty"` + // ClientID - The Client ID of this relying party application, known as the client_id. + // This setting is required for enabling OpenID Connection authentication with Azure Active Directory or + // other 3rd party OpenID Connect providers. + // More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html + ClientID *string `json:"clientId,omitempty"` + // ClientSecretSettingName - The app setting name that contains the client secret of the relying party application. + ClientSecretSettingName *string `json:"clientSecretSettingName,omitempty"` + // ClientSecretCertificateThumbprint - An alternative to the client secret, that is the thumbprint of a certificate used for signing purposes. This property acts as + // a replacement for the Client Secret. It is also optional. + ClientSecretCertificateThumbprint *string `json:"clientSecretCertificateThumbprint,omitempty"` + // ClientSecretCertificateSubjectAlternativeName - An alternative to the client secret thumbprint, that is the subject alternative name of a certificate used for signing purposes. This property acts as + // a replacement for the Client Secret Certificate Thumbprint. It is also optional. + ClientSecretCertificateSubjectAlternativeName *string `json:"clientSecretCertificateSubjectAlternativeName,omitempty"` + // ClientSecretCertificateIssuer - An alternative to the client secret thumbprint, that is the issuer of a certificate used for signing purposes. This property acts as + // a replacement for the Client Secret Certificate Thumbprint. It is also optional. + ClientSecretCertificateIssuer *string `json:"clientSecretCertificateIssuer,omitempty"` +} + +// AzureActiveDirectoryValidation the configuration settings of the Azure Active Directory token validation +// flow. +type AzureActiveDirectoryValidation struct { + // JwtClaimChecks - The configuration settings of the checks that should be made while validating the JWT Claims. + JwtClaimChecks *JwtClaimChecks `json:"jwtClaimChecks,omitempty"` + // AllowedAudiences - The list of audiences that can make successful authentication/authorization requests. + AllowedAudiences *[]string `json:"allowedAudiences,omitempty"` + // DefaultAuthorizationPolicy - The configuration settings of the default authorization policy. + DefaultAuthorizationPolicy *DefaultAuthorizationPolicy `json:"defaultAuthorizationPolicy,omitempty"` +} + +// AzureBlobStorageApplicationLogsConfig application logs azure blob storage configuration. +type AzureBlobStorageApplicationLogsConfig struct { + // Level - Log level. Possible values include: 'LogLevelOff', 'LogLevelVerbose', 'LogLevelInformation', 'LogLevelWarning', 'LogLevelError' + Level LogLevel `json:"level,omitempty"` + // SasURL - SAS url to a azure blob container with read/write/list/delete permissions. + SasURL *string `json:"sasUrl,omitempty"` + // RetentionInDays - Retention in days. + // Remove blobs older than X days. + // 0 or lower means no retention. + RetentionInDays *int32 `json:"retentionInDays,omitempty"` +} + +// AzureBlobStorageHTTPLogsConfig http logs to azure blob storage configuration. +type AzureBlobStorageHTTPLogsConfig struct { + // SasURL - SAS url to a azure blob container with read/write/list/delete permissions. + SasURL *string `json:"sasUrl,omitempty"` + // RetentionInDays - Retention in days. + // Remove blobs older than X days. + // 0 or lower means no retention. + RetentionInDays *int32 `json:"retentionInDays,omitempty"` + // Enabled - True if configuration is enabled, false if it is disabled and null if configuration is not set. + Enabled *bool `json:"enabled,omitempty"` +} + +// AzureStaticWebApps the configuration settings of the Azure Static Web Apps provider. +type AzureStaticWebApps struct { + // Enabled - false if the Azure Static Web Apps provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + // Registration - The configuration settings of the Azure Static Web Apps registration. + Registration *AzureStaticWebAppsRegistration `json:"registration,omitempty"` +} + +// AzureStaticWebAppsRegistration the configuration settings of the registration for the Azure Static Web +// Apps provider +type AzureStaticWebAppsRegistration struct { + // ClientID - The Client ID of the app used for login. + ClientID *string `json:"clientId,omitempty"` +} + +// AzureStorageInfoValue azure Files or Blob Storage access information value for dictionary storage. +type AzureStorageInfoValue struct { + // Type - Type of storage. Possible values include: 'AzureStorageTypeAzureFiles', 'AzureStorageTypeAzureBlob' + Type AzureStorageType `json:"type,omitempty"` + // AccountName - Name of the storage account. + AccountName *string `json:"accountName,omitempty"` + // ShareName - Name of the file share (container name, for Blob storage). + ShareName *string `json:"shareName,omitempty"` + // AccessKey - Access key for the storage account. + AccessKey *string `json:"accessKey,omitempty"` + // MountPath - Path to mount the storage within the site's runtime environment. + MountPath *string `json:"mountPath,omitempty"` + // State - READ-ONLY; State of the storage account. Possible values include: 'AzureStorageStateOk', 'AzureStorageStateInvalidCredentials', 'AzureStorageStateInvalidShare', 'AzureStorageStateNotValidated' + State AzureStorageState `json:"state,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureStorageInfoValue. +func (asiv AzureStorageInfoValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asiv.Type != "" { + objectMap["type"] = asiv.Type + } + if asiv.AccountName != nil { + objectMap["accountName"] = asiv.AccountName + } + if asiv.ShareName != nil { + objectMap["shareName"] = asiv.ShareName + } + if asiv.AccessKey != nil { + objectMap["accessKey"] = asiv.AccessKey + } + if asiv.MountPath != nil { + objectMap["mountPath"] = asiv.MountPath + } + return json.Marshal(objectMap) +} + +// AzureStoragePropertyDictionaryResource azureStorageInfo dictionary resource. +type AzureStoragePropertyDictionaryResource struct { + autorest.Response `json:"-"` + // Properties - Azure storage accounts. + Properties map[string]*AzureStorageInfoValue `json:"properties"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureStoragePropertyDictionaryResource. +func (aspdr AzureStoragePropertyDictionaryResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aspdr.Properties != nil { + objectMap["properties"] = aspdr.Properties + } + if aspdr.Kind != nil { + objectMap["kind"] = aspdr.Kind + } + return json.Marshal(objectMap) +} + +// AzureTableStorageApplicationLogsConfig application logs to Azure table storage configuration. +type AzureTableStorageApplicationLogsConfig struct { + // Level - Log level. Possible values include: 'LogLevelOff', 'LogLevelVerbose', 'LogLevelInformation', 'LogLevelWarning', 'LogLevelError' + Level LogLevel `json:"level,omitempty"` + // SasURL - SAS URL to an Azure table with add/query/delete permissions. + SasURL *string `json:"sasUrl,omitempty"` +} + +// BackupItem backup description. +type BackupItem struct { + autorest.Response `json:"-"` + // BackupItemProperties - BackupItem resource specific properties + *BackupItemProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupItem. +func (bi BackupItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bi.BackupItemProperties != nil { + objectMap["properties"] = bi.BackupItemProperties + } + if bi.Kind != nil { + objectMap["kind"] = bi.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BackupItem struct. +func (bi *BackupItem) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var backupItemProperties BackupItemProperties + err = json.Unmarshal(*v, &backupItemProperties) + if err != nil { + return err + } + bi.BackupItemProperties = &backupItemProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bi.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + bi.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bi.Type = &typeVar + } + } + } + + return nil +} + +// BackupItemCollection collection of backup items. +type BackupItemCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]BackupItem `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupItemCollection. +func (bic BackupItemCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bic.Value != nil { + objectMap["value"] = bic.Value + } + return json.Marshal(objectMap) +} + +// BackupItemCollectionIterator provides access to a complete listing of BackupItem values. +type BackupItemCollectionIterator struct { + i int + page BackupItemCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BackupItemCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupItemCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BackupItemCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BackupItemCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BackupItemCollectionIterator) Response() BackupItemCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BackupItemCollectionIterator) Value() BackupItem { + if !iter.page.NotDone() { + return BackupItem{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BackupItemCollectionIterator type. +func NewBackupItemCollectionIterator(page BackupItemCollectionPage) BackupItemCollectionIterator { + return BackupItemCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bic BackupItemCollection) IsEmpty() bool { + return bic.Value == nil || len(*bic.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bic BackupItemCollection) hasNextLink() bool { + return bic.NextLink != nil && len(*bic.NextLink) != 0 +} + +// backupItemCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bic BackupItemCollection) backupItemCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !bic.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bic.NextLink))) +} + +// BackupItemCollectionPage contains a page of BackupItem values. +type BackupItemCollectionPage struct { + fn func(context.Context, BackupItemCollection) (BackupItemCollection, error) + bic BackupItemCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BackupItemCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BackupItemCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bic) + if err != nil { + return err + } + page.bic = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BackupItemCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BackupItemCollectionPage) NotDone() bool { + return !page.bic.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BackupItemCollectionPage) Response() BackupItemCollection { + return page.bic +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BackupItemCollectionPage) Values() []BackupItem { + if page.bic.IsEmpty() { + return nil + } + return *page.bic.Value +} + +// Creates a new instance of the BackupItemCollectionPage type. +func NewBackupItemCollectionPage(cur BackupItemCollection, getNextPage func(context.Context, BackupItemCollection) (BackupItemCollection, error)) BackupItemCollectionPage { + return BackupItemCollectionPage{ + fn: getNextPage, + bic: cur, + } +} + +// BackupItemProperties backupItem resource specific properties +type BackupItemProperties struct { + // BackupID - READ-ONLY; Id of the backup. + BackupID *int32 `json:"id,omitempty"` + // StorageAccountURL - READ-ONLY; SAS URL for the storage account container which contains this backup. + StorageAccountURL *string `json:"storageAccountUrl,omitempty"` + // BlobName - READ-ONLY; Name of the blob which contains data for this backup. + BlobName *string `json:"blobName,omitempty"` + // Name - READ-ONLY; Name of this backup. + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Backup status. Possible values include: 'BackupItemStatusInProgress', 'BackupItemStatusFailed', 'BackupItemStatusSucceeded', 'BackupItemStatusTimedOut', 'BackupItemStatusCreated', 'BackupItemStatusSkipped', 'BackupItemStatusPartiallySucceeded', 'BackupItemStatusDeleteInProgress', 'BackupItemStatusDeleteFailed', 'BackupItemStatusDeleted' + Status BackupItemStatus `json:"status,omitempty"` + // SizeInBytes - READ-ONLY; Size of the backup in bytes. + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` + // Created - READ-ONLY; Timestamp of the backup creation. + Created *date.Time `json:"created,omitempty"` + // Log - READ-ONLY; Details regarding this backup. Might contain an error message. + Log *string `json:"log,omitempty"` + // Databases - READ-ONLY; List of databases included in the backup. + Databases *[]DatabaseBackupSetting `json:"databases,omitempty"` + // Scheduled - READ-ONLY; True if this backup has been created due to a schedule being triggered. + Scheduled *bool `json:"scheduled,omitempty"` + // LastRestoreTimeStamp - READ-ONLY; Timestamp of a last restore operation which used this backup. + LastRestoreTimeStamp *date.Time `json:"lastRestoreTimeStamp,omitempty"` + // FinishedTimeStamp - READ-ONLY; Timestamp when this backup finished. + FinishedTimeStamp *date.Time `json:"finishedTimeStamp,omitempty"` + // CorrelationID - READ-ONLY; Unique correlation identifier. Please use this along with the timestamp while communicating with Azure support. + CorrelationID *string `json:"correlationId,omitempty"` + // WebsiteSizeInBytes - READ-ONLY; Size of the original web app which has been backed up. + WebsiteSizeInBytes *int64 `json:"websiteSizeInBytes,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupItemProperties. +func (bi BackupItemProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BackupRequest description of a backup which will be performed. +type BackupRequest struct { + autorest.Response `json:"-"` + // BackupRequestProperties - BackupRequest resource specific properties + *BackupRequestProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupRequest. +func (br BackupRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if br.BackupRequestProperties != nil { + objectMap["properties"] = br.BackupRequestProperties + } + if br.Kind != nil { + objectMap["kind"] = br.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BackupRequest struct. +func (br *BackupRequest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var backupRequestProperties BackupRequestProperties + err = json.Unmarshal(*v, &backupRequestProperties) + if err != nil { + return err + } + br.BackupRequestProperties = &backupRequestProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + br.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + br.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + br.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + br.Type = &typeVar + } + } + } + + return nil +} + +// BackupRequestProperties backupRequest resource specific properties +type BackupRequestProperties struct { + // BackupName - Name of the backup. + BackupName *string `json:"backupName,omitempty"` + // Enabled - True if the backup schedule is enabled (must be included in that case), false if the backup schedule should be disabled. + Enabled *bool `json:"enabled,omitempty"` + // StorageAccountURL - SAS URL to the container. + StorageAccountURL *string `json:"storageAccountUrl,omitempty"` + // BackupSchedule - Schedule for the backup if it is executed periodically. + BackupSchedule *BackupSchedule `json:"backupSchedule,omitempty"` + // Databases - Databases included in the backup. + Databases *[]DatabaseBackupSetting `json:"databases,omitempty"` +} + +// BackupSchedule description of a backup schedule. Describes how often should be the backup performed and +// what should be the retention policy. +type BackupSchedule struct { + // FrequencyInterval - How often the backup should be executed (e.g. for weekly backup, this should be set to 7 and FrequencyUnit should be set to Day) + FrequencyInterval *int32 `json:"frequencyInterval,omitempty"` + // FrequencyUnit - The unit of time for how often the backup should be executed (e.g. for weekly backup, this should be set to Day and FrequencyInterval should be set to 7). Possible values include: 'FrequencyUnitDay', 'FrequencyUnitHour' + FrequencyUnit FrequencyUnit `json:"frequencyUnit,omitempty"` + // KeepAtLeastOneBackup - True if the retention policy should always keep at least one backup in the storage account, regardless how old it is; false otherwise. + KeepAtLeastOneBackup *bool `json:"keepAtLeastOneBackup,omitempty"` + // RetentionPeriodInDays - After how many days backups should be deleted. + RetentionPeriodInDays *int32 `json:"retentionPeriodInDays,omitempty"` + // StartTime - When the schedule should start working. + StartTime *date.Time `json:"startTime,omitempty"` + // LastExecutionTime - READ-ONLY; Last time when this schedule was triggered. + LastExecutionTime *date.Time `json:"lastExecutionTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackupSchedule. +func (bs BackupSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bs.FrequencyInterval != nil { + objectMap["frequencyInterval"] = bs.FrequencyInterval + } + if bs.FrequencyUnit != "" { + objectMap["frequencyUnit"] = bs.FrequencyUnit + } + if bs.KeepAtLeastOneBackup != nil { + objectMap["keepAtLeastOneBackup"] = bs.KeepAtLeastOneBackup + } + if bs.RetentionPeriodInDays != nil { + objectMap["retentionPeriodInDays"] = bs.RetentionPeriodInDays + } + if bs.StartTime != nil { + objectMap["startTime"] = bs.StartTime + } + return json.Marshal(objectMap) +} + +// BillingMeter app Service billing entity that contains information about meter which the Azure billing +// system utilizes to charge users for services. +type BillingMeter struct { + // BillingMeterProperties - BillingMeter resource specific properties + *BillingMeterProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BillingMeter. +func (bm BillingMeter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bm.BillingMeterProperties != nil { + objectMap["properties"] = bm.BillingMeterProperties + } + if bm.Kind != nil { + objectMap["kind"] = bm.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BillingMeter struct. +func (bm *BillingMeter) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var billingMeterProperties BillingMeterProperties + err = json.Unmarshal(*v, &billingMeterProperties) + if err != nil { + return err + } + bm.BillingMeterProperties = &billingMeterProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bm.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bm.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + bm.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bm.Type = &typeVar + } + } + } + + return nil +} + +// BillingMeterCollection collection of Billing Meters +type BillingMeterCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]BillingMeter `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for BillingMeterCollection. +func (bmc BillingMeterCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bmc.Value != nil { + objectMap["value"] = bmc.Value + } + return json.Marshal(objectMap) +} + +// BillingMeterCollectionIterator provides access to a complete listing of BillingMeter values. +type BillingMeterCollectionIterator struct { + i int + page BillingMeterCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BillingMeterCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BillingMeterCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BillingMeterCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BillingMeterCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BillingMeterCollectionIterator) Response() BillingMeterCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BillingMeterCollectionIterator) Value() BillingMeter { + if !iter.page.NotDone() { + return BillingMeter{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BillingMeterCollectionIterator type. +func NewBillingMeterCollectionIterator(page BillingMeterCollectionPage) BillingMeterCollectionIterator { + return BillingMeterCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bmc BillingMeterCollection) IsEmpty() bool { + return bmc.Value == nil || len(*bmc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bmc BillingMeterCollection) hasNextLink() bool { + return bmc.NextLink != nil && len(*bmc.NextLink) != 0 +} + +// billingMeterCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bmc BillingMeterCollection) billingMeterCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !bmc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bmc.NextLink))) +} + +// BillingMeterCollectionPage contains a page of BillingMeter values. +type BillingMeterCollectionPage struct { + fn func(context.Context, BillingMeterCollection) (BillingMeterCollection, error) + bmc BillingMeterCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BillingMeterCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BillingMeterCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bmc) + if err != nil { + return err + } + page.bmc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BillingMeterCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BillingMeterCollectionPage) NotDone() bool { + return !page.bmc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BillingMeterCollectionPage) Response() BillingMeterCollection { + return page.bmc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BillingMeterCollectionPage) Values() []BillingMeter { + if page.bmc.IsEmpty() { + return nil + } + return *page.bmc.Value +} + +// Creates a new instance of the BillingMeterCollectionPage type. +func NewBillingMeterCollectionPage(cur BillingMeterCollection, getNextPage func(context.Context, BillingMeterCollection) (BillingMeterCollection, error)) BillingMeterCollectionPage { + return BillingMeterCollectionPage{ + fn: getNextPage, + bmc: cur, + } +} + +// BillingMeterProperties billingMeter resource specific properties +type BillingMeterProperties struct { + // MeterID - Meter GUID onboarded in Commerce + MeterID *string `json:"meterId,omitempty"` + // BillingLocation - Azure Location of billable resource + BillingLocation *string `json:"billingLocation,omitempty"` + // ShortName - Short Name from App Service Azure pricing Page + ShortName *string `json:"shortName,omitempty"` + // FriendlyName - Friendly name of the meter + FriendlyName *string `json:"friendlyName,omitempty"` + // ResourceType - App Service ResourceType meter used for + ResourceType *string `json:"resourceType,omitempty"` + // OsType - App Service OS type meter used for + OsType *string `json:"osType,omitempty"` + // Multiplier - Meter Multiplier + Multiplier *float64 `json:"multiplier,omitempty"` +} + +// BlobStorageTokenStore the configuration settings of the storage of the tokens if blob storage is used. +type BlobStorageTokenStore struct { + // SasURLSettingName - The name of the app setting containing the SAS URL of the blob storage containing the tokens. + SasURLSettingName *string `json:"sasUrlSettingName,omitempty"` +} + +// Capability describes the capabilities/features allowed for a specific SKU. +type Capability struct { + // Name - Name of the SKU capability. + Name *string `json:"name,omitempty"` + // Value - Value of the SKU capability. + Value *string `json:"value,omitempty"` + // Reason - Reason of the SKU capability. + Reason *string `json:"reason,omitempty"` +} + +// Certificate SSL certificate for an app. +type Certificate struct { + autorest.Response `json:"-"` + // CertificateProperties - Certificate resource specific properties + *CertificateProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Location - Resource Location. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Certificate. +func (c Certificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.CertificateProperties != nil { + objectMap["properties"] = c.CertificateProperties + } + if c.Kind != nil { + objectMap["kind"] = c.Kind + } + if c.Location != nil { + objectMap["location"] = c.Location + } + if c.Tags != nil { + objectMap["tags"] = c.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Certificate struct. +func (c *Certificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var certificateProperties CertificateProperties + err = json.Unmarshal(*v, &certificateProperties) + if err != nil { + return err + } + c.CertificateProperties = &certificateProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + c.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + c.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + c.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + c.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + c.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + c.Tags = tags + } + } + } + + return nil +} + +// CertificateCollection collection of certificates. +type CertificateCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]Certificate `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateCollection. +func (cc CertificateCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cc.Value != nil { + objectMap["value"] = cc.Value + } + return json.Marshal(objectMap) +} + +// CertificateCollectionIterator provides access to a complete listing of Certificate values. +type CertificateCollectionIterator struct { + i int + page CertificateCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CertificateCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CertificateCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CertificateCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CertificateCollectionIterator) Response() CertificateCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CertificateCollectionIterator) Value() Certificate { + if !iter.page.NotDone() { + return Certificate{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CertificateCollectionIterator type. +func NewCertificateCollectionIterator(page CertificateCollectionPage) CertificateCollectionIterator { + return CertificateCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cc CertificateCollection) IsEmpty() bool { + return cc.Value == nil || len(*cc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cc CertificateCollection) hasNextLink() bool { + return cc.NextLink != nil && len(*cc.NextLink) != 0 +} + +// certificateCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cc CertificateCollection) certificateCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !cc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cc.NextLink))) +} + +// CertificateCollectionPage contains a page of Certificate values. +type CertificateCollectionPage struct { + fn func(context.Context, CertificateCollection) (CertificateCollection, error) + cc CertificateCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CertificateCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cc) + if err != nil { + return err + } + page.cc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CertificateCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CertificateCollectionPage) NotDone() bool { + return !page.cc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CertificateCollectionPage) Response() CertificateCollection { + return page.cc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CertificateCollectionPage) Values() []Certificate { + if page.cc.IsEmpty() { + return nil + } + return *page.cc.Value +} + +// Creates a new instance of the CertificateCollectionPage type. +func NewCertificateCollectionPage(cur CertificateCollection, getNextPage func(context.Context, CertificateCollection) (CertificateCollection, error)) CertificateCollectionPage { + return CertificateCollectionPage{ + fn: getNextPage, + cc: cur, + } +} + +// CertificateDetails SSL certificate details. +type CertificateDetails struct { + // Version - READ-ONLY; Certificate Version. + Version *int32 `json:"version,omitempty"` + // SerialNumber - READ-ONLY; Certificate Serial Number. + SerialNumber *string `json:"serialNumber,omitempty"` + // Thumbprint - READ-ONLY; Certificate Thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` + // Subject - READ-ONLY; Certificate Subject. + Subject *string `json:"subject,omitempty"` + // NotBefore - READ-ONLY; Date Certificate is valid from. + NotBefore *date.Time `json:"notBefore,omitempty"` + // NotAfter - READ-ONLY; Date Certificate is valid to. + NotAfter *date.Time `json:"notAfter,omitempty"` + // SignatureAlgorithm - READ-ONLY; Certificate Signature algorithm. + SignatureAlgorithm *string `json:"signatureAlgorithm,omitempty"` + // Issuer - READ-ONLY; Certificate Issuer. + Issuer *string `json:"issuer,omitempty"` + // RawData - READ-ONLY; Raw certificate data. + RawData *string `json:"rawData,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateDetails. +func (cd CertificateDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CertificateEmail SSL certificate email. +type CertificateEmail struct { + // CertificateEmailProperties - CertificateEmail resource specific properties + *CertificateEmailProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateEmail. +func (ce CertificateEmail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ce.CertificateEmailProperties != nil { + objectMap["properties"] = ce.CertificateEmailProperties + } + if ce.Kind != nil { + objectMap["kind"] = ce.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CertificateEmail struct. +func (ce *CertificateEmail) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var certificateEmailProperties CertificateEmailProperties + err = json.Unmarshal(*v, &certificateEmailProperties) + if err != nil { + return err + } + ce.CertificateEmailProperties = &certificateEmailProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ce.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ce.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ce.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ce.Type = &typeVar + } + } + } + + return nil +} + +// CertificateEmailProperties certificateEmail resource specific properties +type CertificateEmailProperties struct { + // EmailID - Email id. + EmailID *string `json:"emailId,omitempty"` + // TimeStamp - Time stamp. + TimeStamp *date.Time `json:"timeStamp,omitempty"` +} + +// CertificateOrderAction certificate order action. +type CertificateOrderAction struct { + // CertificateOrderActionProperties - CertificateOrderAction resource specific properties + *CertificateOrderActionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateOrderAction. +func (coa CertificateOrderAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if coa.CertificateOrderActionProperties != nil { + objectMap["properties"] = coa.CertificateOrderActionProperties + } + if coa.Kind != nil { + objectMap["kind"] = coa.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CertificateOrderAction struct. +func (coa *CertificateOrderAction) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var certificateOrderActionProperties CertificateOrderActionProperties + err = json.Unmarshal(*v, &certificateOrderActionProperties) + if err != nil { + return err + } + coa.CertificateOrderActionProperties = &certificateOrderActionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + coa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + coa.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + coa.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + coa.Type = &typeVar + } + } + } + + return nil +} + +// CertificateOrderActionProperties certificateOrderAction resource specific properties +type CertificateOrderActionProperties struct { + // ActionType - READ-ONLY; Action type. Possible values include: 'CertificateOrderActionTypeCertificateIssued', 'CertificateOrderActionTypeCertificateOrderCanceled', 'CertificateOrderActionTypeCertificateOrderCreated', 'CertificateOrderActionTypeCertificateRevoked', 'CertificateOrderActionTypeDomainValidationComplete', 'CertificateOrderActionTypeFraudDetected', 'CertificateOrderActionTypeOrgNameChange', 'CertificateOrderActionTypeOrgValidationComplete', 'CertificateOrderActionTypeSanDrop', 'CertificateOrderActionTypeFraudCleared', 'CertificateOrderActionTypeCertificateExpired', 'CertificateOrderActionTypeCertificateExpirationWarning', 'CertificateOrderActionTypeFraudDocumentationRequired', 'CertificateOrderActionTypeUnknown' + ActionType CertificateOrderActionType `json:"actionType,omitempty"` + // CreatedAt - READ-ONLY; Time at which the certificate action was performed. + CreatedAt *date.Time `json:"createdAt,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateOrderActionProperties. +func (coa CertificateOrderActionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CertificateOrderContact ... +type CertificateOrderContact struct { + Email *string `json:"email,omitempty"` + NameFirst *string `json:"nameFirst,omitempty"` + NameLast *string `json:"nameLast,omitempty"` + Phone *string `json:"phone,omitempty"` +} + +// CertificatePatchResource ARM resource for a certificate. +type CertificatePatchResource struct { + // CertificatePatchResourceProperties - CertificatePatchResource resource specific properties + *CertificatePatchResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificatePatchResource. +func (cpr CertificatePatchResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cpr.CertificatePatchResourceProperties != nil { + objectMap["properties"] = cpr.CertificatePatchResourceProperties + } + if cpr.Kind != nil { + objectMap["kind"] = cpr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CertificatePatchResource struct. +func (cpr *CertificatePatchResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var certificatePatchResourceProperties CertificatePatchResourceProperties + err = json.Unmarshal(*v, &certificatePatchResourceProperties) + if err != nil { + return err + } + cpr.CertificatePatchResourceProperties = &certificatePatchResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cpr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cpr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + cpr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cpr.Type = &typeVar + } + } + } + + return nil +} + +// CertificatePatchResourceProperties certificatePatchResource resource specific properties +type CertificatePatchResourceProperties struct { + // Password - Certificate password. + Password *string `json:"password,omitempty"` + // FriendlyName - READ-ONLY; Friendly name of the certificate. + FriendlyName *string `json:"friendlyName,omitempty"` + // SubjectName - READ-ONLY; Subject name of the certificate. + SubjectName *string `json:"subjectName,omitempty"` + // HostNames - Host names the certificate applies to. + HostNames *[]string `json:"hostNames,omitempty"` + // PfxBlob - Pfx blob. + PfxBlob *[]byte `json:"pfxBlob,omitempty"` + // SiteName - READ-ONLY; App name. + SiteName *string `json:"siteName,omitempty"` + // SelfLink - READ-ONLY; Self link. + SelfLink *string `json:"selfLink,omitempty"` + // Issuer - READ-ONLY; Certificate issuer. + Issuer *string `json:"issuer,omitempty"` + // IssueDate - READ-ONLY; Certificate issue Date. + IssueDate *date.Time `json:"issueDate,omitempty"` + // ExpirationDate - READ-ONLY; Certificate expiration date. + ExpirationDate *date.Time `json:"expirationDate,omitempty"` + // Thumbprint - READ-ONLY; Certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` + // Valid - READ-ONLY; Is the certificate valid?. + Valid *bool `json:"valid,omitempty"` + // CerBlob - READ-ONLY; Raw bytes of .cer file + CerBlob *[]byte `json:"cerBlob,omitempty"` + // PublicKeyHash - READ-ONLY; Public key hash. + PublicKeyHash *string `json:"publicKeyHash,omitempty"` + // HostingEnvironmentProfile - READ-ONLY; Specification for the App Service Environment to use for the certificate. + HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` + // KeyVaultID - Key Vault Csm resource Id. + KeyVaultID *string `json:"keyVaultId,omitempty"` + // KeyVaultSecretName - Key Vault secret name. + KeyVaultSecretName *string `json:"keyVaultSecretName,omitempty"` + // KeyVaultSecretStatus - READ-ONLY; Status of the Key Vault secret. Possible values include: 'KeyVaultSecretStatusInitialized', 'KeyVaultSecretStatusWaitingOnCertificateOrder', 'KeyVaultSecretStatusSucceeded', 'KeyVaultSecretStatusCertificateOrderFailed', 'KeyVaultSecretStatusOperationNotPermittedOnKeyVault', 'KeyVaultSecretStatusAzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultSecretStatusKeyVaultDoesNotExist', 'KeyVaultSecretStatusKeyVaultSecretDoesNotExist', 'KeyVaultSecretStatusUnknownError', 'KeyVaultSecretStatusExternalPrivateKey', 'KeyVaultSecretStatusUnknown' + KeyVaultSecretStatus KeyVaultSecretStatus `json:"keyVaultSecretStatus,omitempty"` + // ServerFarmID - Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". + ServerFarmID *string `json:"serverFarmId,omitempty"` + // CanonicalName - CNAME of the certificate to be issued via free certificate + CanonicalName *string `json:"canonicalName,omitempty"` + // DomainValidationMethod - Method of domain validation for free cert + DomainValidationMethod *string `json:"domainValidationMethod,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificatePatchResourceProperties. +func (cpr CertificatePatchResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cpr.Password != nil { + objectMap["password"] = cpr.Password + } + if cpr.HostNames != nil { + objectMap["hostNames"] = cpr.HostNames + } + if cpr.PfxBlob != nil { + objectMap["pfxBlob"] = cpr.PfxBlob + } + if cpr.KeyVaultID != nil { + objectMap["keyVaultId"] = cpr.KeyVaultID + } + if cpr.KeyVaultSecretName != nil { + objectMap["keyVaultSecretName"] = cpr.KeyVaultSecretName + } + if cpr.ServerFarmID != nil { + objectMap["serverFarmId"] = cpr.ServerFarmID + } + if cpr.CanonicalName != nil { + objectMap["canonicalName"] = cpr.CanonicalName + } + if cpr.DomainValidationMethod != nil { + objectMap["domainValidationMethod"] = cpr.DomainValidationMethod + } + return json.Marshal(objectMap) +} + +// CertificateProperties certificate resource specific properties +type CertificateProperties struct { + // Password - Certificate password. + Password *string `json:"password,omitempty"` + // FriendlyName - READ-ONLY; Friendly name of the certificate. + FriendlyName *string `json:"friendlyName,omitempty"` + // SubjectName - READ-ONLY; Subject name of the certificate. + SubjectName *string `json:"subjectName,omitempty"` + // HostNames - Host names the certificate applies to. + HostNames *[]string `json:"hostNames,omitempty"` + // PfxBlob - Pfx blob. + PfxBlob *[]byte `json:"pfxBlob,omitempty"` + // SiteName - READ-ONLY; App name. + SiteName *string `json:"siteName,omitempty"` + // SelfLink - READ-ONLY; Self link. + SelfLink *string `json:"selfLink,omitempty"` + // Issuer - READ-ONLY; Certificate issuer. + Issuer *string `json:"issuer,omitempty"` + // IssueDate - READ-ONLY; Certificate issue Date. + IssueDate *date.Time `json:"issueDate,omitempty"` + // ExpirationDate - READ-ONLY; Certificate expiration date. + ExpirationDate *date.Time `json:"expirationDate,omitempty"` + // Thumbprint - READ-ONLY; Certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` + // Valid - READ-ONLY; Is the certificate valid?. + Valid *bool `json:"valid,omitempty"` + // CerBlob - READ-ONLY; Raw bytes of .cer file + CerBlob *[]byte `json:"cerBlob,omitempty"` + // PublicKeyHash - READ-ONLY; Public key hash. + PublicKeyHash *string `json:"publicKeyHash,omitempty"` + // HostingEnvironmentProfile - READ-ONLY; Specification for the App Service Environment to use for the certificate. + HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` + // KeyVaultID - Key Vault Csm resource Id. + KeyVaultID *string `json:"keyVaultId,omitempty"` + // KeyVaultSecretName - Key Vault secret name. + KeyVaultSecretName *string `json:"keyVaultSecretName,omitempty"` + // KeyVaultSecretStatus - READ-ONLY; Status of the Key Vault secret. Possible values include: 'KeyVaultSecretStatusInitialized', 'KeyVaultSecretStatusWaitingOnCertificateOrder', 'KeyVaultSecretStatusSucceeded', 'KeyVaultSecretStatusCertificateOrderFailed', 'KeyVaultSecretStatusOperationNotPermittedOnKeyVault', 'KeyVaultSecretStatusAzureServiceUnauthorizedToAccessKeyVault', 'KeyVaultSecretStatusKeyVaultDoesNotExist', 'KeyVaultSecretStatusKeyVaultSecretDoesNotExist', 'KeyVaultSecretStatusUnknownError', 'KeyVaultSecretStatusExternalPrivateKey', 'KeyVaultSecretStatusUnknown' + KeyVaultSecretStatus KeyVaultSecretStatus `json:"keyVaultSecretStatus,omitempty"` + // ServerFarmID - Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". + ServerFarmID *string `json:"serverFarmId,omitempty"` + // CanonicalName - CNAME of the certificate to be issued via free certificate + CanonicalName *string `json:"canonicalName,omitempty"` + // DomainValidationMethod - Method of domain validation for free cert + DomainValidationMethod *string `json:"domainValidationMethod,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateProperties. +func (c CertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.Password != nil { + objectMap["password"] = c.Password + } + if c.HostNames != nil { + objectMap["hostNames"] = c.HostNames + } + if c.PfxBlob != nil { + objectMap["pfxBlob"] = c.PfxBlob + } + if c.KeyVaultID != nil { + objectMap["keyVaultId"] = c.KeyVaultID + } + if c.KeyVaultSecretName != nil { + objectMap["keyVaultSecretName"] = c.KeyVaultSecretName + } + if c.ServerFarmID != nil { + objectMap["serverFarmId"] = c.ServerFarmID + } + if c.CanonicalName != nil { + objectMap["canonicalName"] = c.CanonicalName + } + if c.DomainValidationMethod != nil { + objectMap["domainValidationMethod"] = c.DomainValidationMethod + } + return json.Marshal(objectMap) +} + +// ClientRegistration the configuration settings of the app registration for providers that have client ids +// and client secrets +type ClientRegistration struct { + // ClientID - The Client ID of the app used for login. + ClientID *string `json:"clientId,omitempty"` + // ClientSecretSettingName - The app setting name that contains the client secret. + ClientSecretSettingName *string `json:"clientSecretSettingName,omitempty"` +} + +// CloningInfo information needed for cloning operation. +type CloningInfo struct { + // CorrelationID - Correlation ID of cloning operation. This ID ties multiple cloning operations + // together to use the same snapshot. + CorrelationID *uuid.UUID `json:"correlationId,omitempty"` + // Overwrite - true to overwrite destination app; otherwise, false. + Overwrite *bool `json:"overwrite,omitempty"` + // CloneCustomHostNames - true to clone custom hostnames from source app; otherwise, false. + CloneCustomHostNames *bool `json:"cloneCustomHostNames,omitempty"` + // CloneSourceControl - true to clone source control from source app; otherwise, false. + CloneSourceControl *bool `json:"cloneSourceControl,omitempty"` + // SourceWebAppID - ARM resource ID of the source app. App resource ID is of the form + // /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and + // /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. + SourceWebAppID *string `json:"sourceWebAppId,omitempty"` + // SourceWebAppLocation - Location of source app ex: West US or North Europe + SourceWebAppLocation *string `json:"sourceWebAppLocation,omitempty"` + // HostingEnvironment - App Service Environment. + HostingEnvironment *string `json:"hostingEnvironment,omitempty"` + // AppSettingsOverrides - Application setting overrides for cloned app. If specified, these settings override the settings cloned + // from source app. Otherwise, application settings from source app are retained. + AppSettingsOverrides map[string]*string `json:"appSettingsOverrides"` + // ConfigureLoadBalancing - true to configure load balancing for source and destination app. + ConfigureLoadBalancing *bool `json:"configureLoadBalancing,omitempty"` + // TrafficManagerProfileID - ARM resource ID of the Traffic Manager profile to use, if it exists. Traffic Manager resource ID is of the form + // /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}. + TrafficManagerProfileID *string `json:"trafficManagerProfileId,omitempty"` + // TrafficManagerProfileName - Name of Traffic Manager profile to create. This is only needed if Traffic Manager profile does not already exist. + TrafficManagerProfileName *string `json:"trafficManagerProfileName,omitempty"` +} + +// MarshalJSON is the custom marshaler for CloningInfo. +func (ci CloningInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ci.CorrelationID != nil { + objectMap["correlationId"] = ci.CorrelationID + } + if ci.Overwrite != nil { + objectMap["overwrite"] = ci.Overwrite + } + if ci.CloneCustomHostNames != nil { + objectMap["cloneCustomHostNames"] = ci.CloneCustomHostNames + } + if ci.CloneSourceControl != nil { + objectMap["cloneSourceControl"] = ci.CloneSourceControl + } + if ci.SourceWebAppID != nil { + objectMap["sourceWebAppId"] = ci.SourceWebAppID + } + if ci.SourceWebAppLocation != nil { + objectMap["sourceWebAppLocation"] = ci.SourceWebAppLocation + } + if ci.HostingEnvironment != nil { + objectMap["hostingEnvironment"] = ci.HostingEnvironment + } + if ci.AppSettingsOverrides != nil { + objectMap["appSettingsOverrides"] = ci.AppSettingsOverrides + } + if ci.ConfigureLoadBalancing != nil { + objectMap["configureLoadBalancing"] = ci.ConfigureLoadBalancing + } + if ci.TrafficManagerProfileID != nil { + objectMap["trafficManagerProfileId"] = ci.TrafficManagerProfileID + } + if ci.TrafficManagerProfileName != nil { + objectMap["trafficManagerProfileName"] = ci.TrafficManagerProfileName + } + return json.Marshal(objectMap) +} + +// Configuration non versioned Container App configuration properties that define the mutable settings of a +// Container app +type Configuration struct { + // Secrets - Collection of secrets used by a Container app + Secrets *[]Secret `json:"secrets,omitempty"` + // ActiveRevisionsMode - ActiveRevisionsMode controls how active revisions are handled for the Container app: + // Multiple: multiple revisions can be active. If no value if provided, this is the defaultSingle: Only one revision can be active at a time. Revision weights can not be used in this mode. Possible values include: 'ActiveRevisionsModeMultiple', 'ActiveRevisionsModeSingle' + ActiveRevisionsMode ActiveRevisionsMode `json:"activeRevisionsMode,omitempty"` + // Ingress - Ingress configurations. + Ingress *Ingress `json:"ingress,omitempty"` + // Registries - Collection of private container registry credentials for containers used by the Container app + Registries *[]RegistryCredentials `json:"registries,omitempty"` +} + +// ConnectionStringDictionary string dictionary resource. +type ConnectionStringDictionary struct { + autorest.Response `json:"-"` + // Properties - Connection strings. + Properties map[string]*ConnStringValueTypePair `json:"properties"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionStringDictionary. +func (csd ConnectionStringDictionary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csd.Properties != nil { + objectMap["properties"] = csd.Properties + } + if csd.Kind != nil { + objectMap["kind"] = csd.Kind + } + return json.Marshal(objectMap) +} + +// ConnStringInfo database connection string information. +type ConnStringInfo struct { + // Name - Name of connection string. + Name *string `json:"name,omitempty"` + // ConnectionString - Connection string value. + ConnectionString *string `json:"connectionString,omitempty"` + // Type - Type of database. Possible values include: 'ConnectionStringTypeMySQL', 'ConnectionStringTypeSQLServer', 'ConnectionStringTypeSQLAzure', 'ConnectionStringTypeCustom', 'ConnectionStringTypeNotificationHub', 'ConnectionStringTypeServiceBus', 'ConnectionStringTypeEventHub', 'ConnectionStringTypeAPIHub', 'ConnectionStringTypeDocDb', 'ConnectionStringTypeRedisCache', 'ConnectionStringTypePostgreSQL' + Type ConnectionStringType `json:"type,omitempty"` +} + +// ConnStringValueTypePair database connection string value to type pair. +type ConnStringValueTypePair struct { + // Value - Value of pair. + Value *string `json:"value,omitempty"` + // Type - Type of database. Possible values include: 'ConnectionStringTypeMySQL', 'ConnectionStringTypeSQLServer', 'ConnectionStringTypeSQLAzure', 'ConnectionStringTypeCustom', 'ConnectionStringTypeNotificationHub', 'ConnectionStringTypeServiceBus', 'ConnectionStringTypeEventHub', 'ConnectionStringTypeAPIHub', 'ConnectionStringTypeDocDb', 'ConnectionStringTypeRedisCache', 'ConnectionStringTypePostgreSQL' + Type ConnectionStringType `json:"type,omitempty"` +} + +// Contact contact information for domain registration. If 'Domain Privacy' option is not selected then the +// contact information is made publicly available through the Whois +// directories as per ICANN requirements. +type Contact struct { + // AddressMailing - Mailing address. + AddressMailing *Address `json:"addressMailing,omitempty"` + // Email - Email address. + Email *string `json:"email,omitempty"` + // Fax - Fax number. + Fax *string `json:"fax,omitempty"` + // JobTitle - Job title. + JobTitle *string `json:"jobTitle,omitempty"` + // NameFirst - First name. + NameFirst *string `json:"nameFirst,omitempty"` + // NameLast - Last name. + NameLast *string `json:"nameLast,omitempty"` + // NameMiddle - Middle name. + NameMiddle *string `json:"nameMiddle,omitempty"` + // Organization - Organization contact belongs to. + Organization *string `json:"organization,omitempty"` + // Phone - Phone number. + Phone *string `json:"phone,omitempty"` +} + +// Container container App container definition. +type Container struct { + // Image - Container image tag. + Image *string `json:"image,omitempty"` + // Name - Custom container name. + Name *string `json:"name,omitempty"` + // Command - Container start command. + Command *[]string `json:"command,omitempty"` + // Args - Container start command arguments. + Args *[]string `json:"args,omitempty"` + // Env - Container environment variables. + Env *[]EnvironmentVar `json:"env,omitempty"` + // Resources - Container resource requirements. + Resources *ContainerResources `json:"resources,omitempty"` +} + +// ContainerApp container App. +type ContainerApp struct { + autorest.Response `json:"-"` + // ContainerAppProperties - ContainerApp resource specific properties + *ContainerAppProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Location - Resource Location. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ContainerApp. +func (ca ContainerApp) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ca.ContainerAppProperties != nil { + objectMap["properties"] = ca.ContainerAppProperties + } + if ca.Kind != nil { + objectMap["kind"] = ca.Kind + } + if ca.Location != nil { + objectMap["location"] = ca.Location + } + if ca.Tags != nil { + objectMap["tags"] = ca.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ContainerApp struct. +func (ca *ContainerApp) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var containerAppProperties ContainerAppProperties + err = json.Unmarshal(*v, &containerAppProperties) + if err != nil { + return err + } + ca.ContainerAppProperties = &containerAppProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ca.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ca.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ca.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ca.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ca.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ca.Tags = tags + } + } + } + + return nil +} + +// ContainerAppCollection container App collection ARM resource. +type ContainerAppCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]ContainerApp `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerAppCollection. +func (cac ContainerAppCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cac.Value != nil { + objectMap["value"] = cac.Value + } + return json.Marshal(objectMap) +} + +// ContainerAppCollectionIterator provides access to a complete listing of ContainerApp values. +type ContainerAppCollectionIterator struct { + i int + page ContainerAppCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ContainerAppCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ContainerAppCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ContainerAppCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ContainerAppCollectionIterator) Response() ContainerAppCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ContainerAppCollectionIterator) Value() ContainerApp { + if !iter.page.NotDone() { + return ContainerApp{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ContainerAppCollectionIterator type. +func NewContainerAppCollectionIterator(page ContainerAppCollectionPage) ContainerAppCollectionIterator { + return ContainerAppCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cac ContainerAppCollection) IsEmpty() bool { + return cac.Value == nil || len(*cac.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cac ContainerAppCollection) hasNextLink() bool { + return cac.NextLink != nil && len(*cac.NextLink) != 0 +} + +// containerAppCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cac ContainerAppCollection) containerAppCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !cac.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cac.NextLink))) +} + +// ContainerAppCollectionPage contains a page of ContainerApp values. +type ContainerAppCollectionPage struct { + fn func(context.Context, ContainerAppCollection) (ContainerAppCollection, error) + cac ContainerAppCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ContainerAppCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerAppCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cac) + if err != nil { + return err + } + page.cac = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ContainerAppCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ContainerAppCollectionPage) NotDone() bool { + return !page.cac.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ContainerAppCollectionPage) Response() ContainerAppCollection { + return page.cac +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ContainerAppCollectionPage) Values() []ContainerApp { + if page.cac.IsEmpty() { + return nil + } + return *page.cac.Value +} + +// Creates a new instance of the ContainerAppCollectionPage type. +func NewContainerAppCollectionPage(cur ContainerAppCollection, getNextPage func(context.Context, ContainerAppCollection) (ContainerAppCollection, error)) ContainerAppCollectionPage { + return ContainerAppCollectionPage{ + fn: getNextPage, + cac: cur, + } +} + +// ContainerAppProperties containerApp resource specific properties +type ContainerAppProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the Container App. Possible values include: 'ContainerAppProvisioningStateInProgress', 'ContainerAppProvisioningStateSucceeded', 'ContainerAppProvisioningStateFailed', 'ContainerAppProvisioningStateCanceled' + ProvisioningState ContainerAppProvisioningState `json:"provisioningState,omitempty"` + // KubeEnvironmentID - Resource ID of the Container App's KubeEnvironment. + KubeEnvironmentID *string `json:"kubeEnvironmentId,omitempty"` + // LatestRevisionName - READ-ONLY; Name of the latest revision of the Container App. + LatestRevisionName *string `json:"latestRevisionName,omitempty"` + // LatestRevisionFqdn - READ-ONLY; Fully Qualified Domain Name of the latest revision of the Container App. + LatestRevisionFqdn *string `json:"latestRevisionFqdn,omitempty"` + // Configuration - Non versioned Container App configuration properties. + Configuration *Configuration `json:"configuration,omitempty"` + // Template - Container App versioned application definition. + Template *Template `json:"template,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerAppProperties. +func (ca ContainerAppProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ca.KubeEnvironmentID != nil { + objectMap["kubeEnvironmentId"] = ca.KubeEnvironmentID + } + if ca.Configuration != nil { + objectMap["configuration"] = ca.Configuration + } + if ca.Template != nil { + objectMap["template"] = ca.Template + } + return json.Marshal(objectMap) +} + +// ContainerAppsConfiguration ... +type ContainerAppsConfiguration struct { + // DaprAIInstrumentationKey - Azure Monitor instrumentation key used by Dapr to export Service to Service communication telemetry + DaprAIInstrumentationKey *string `json:"daprAIInstrumentationKey,omitempty"` + // PlatformReservedCidr - IP range in CIDR notation that can be reserved for environment infrastructure IP addresses. It must not overlap with any other Subnet IP ranges. + PlatformReservedCidr *string `json:"platformReservedCidr,omitempty"` + // PlatformReservedDNSIP - An IP address from the IP range defined by platformReservedCidr that will be reserved for the internal DNS server + PlatformReservedDNSIP *string `json:"platformReservedDnsIP,omitempty"` + // ControlPlaneSubnetResourceID - Resource ID of a subnet for control plane infrastructure components. This subnet must be in the same VNET as the subnet defined in appSubnetResourceId. Must not overlap with the IP range defined in platformReservedCidr, if defined. + ControlPlaneSubnetResourceID *string `json:"controlPlaneSubnetResourceId,omitempty"` + // AppSubnetResourceID - Resource ID of a subnet for control plane infrastructure components. This subnet must be in the same VNET as the subnet defined in appSubnetResourceId. Must not overlap with the IP range defined in platformReservedCidr, if defined. + AppSubnetResourceID *string `json:"appSubnetResourceId,omitempty"` + // DockerBridgeCidr - CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the IP range defined in platformReservedCidr, if defined. + DockerBridgeCidr *string `json:"dockerBridgeCidr,omitempty"` +} + +// ContainerAppsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ContainerAppsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ContainerAppsClient) (ContainerApp, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ContainerAppsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ContainerAppsCreateOrUpdateFuture.Result. +func (future *ContainerAppsCreateOrUpdateFuture) result(client ContainerAppsClient) (ca ContainerApp, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ca.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.ContainerAppsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ca.Response.Response, err = future.GetResult(sender); err == nil && ca.Response.Response.StatusCode != http.StatusNoContent { + ca, err = client.CreateOrUpdateResponder(ca.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsCreateOrUpdateFuture", "Result", ca.Response.Response, "Failure responding to request") + } + } + return +} + +// ContainerAppsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ContainerAppsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ContainerAppsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ContainerAppsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ContainerAppsDeleteFuture.Result. +func (future *ContainerAppsDeleteFuture) result(client ContainerAppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ContainerAppsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.ContainerAppsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ContainerAppSecret container App Secret. +type ContainerAppSecret struct { + // Name - READ-ONLY; Secret Name. + Name *string `json:"name,omitempty"` + // Value - READ-ONLY; Secret Value. + Value *string `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerAppSecret. +func (cas ContainerAppSecret) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ContainerCPUStatistics ... +type ContainerCPUStatistics struct { + CPUUsage *ContainerCPUUsage `json:"cpuUsage,omitempty"` + SystemCPUUsage *int64 `json:"systemCpuUsage,omitempty"` + OnlineCPUCount *int32 `json:"onlineCpuCount,omitempty"` + ThrottlingData *ContainerThrottlingData `json:"throttlingData,omitempty"` +} + +// ContainerCPUUsage ... +type ContainerCPUUsage struct { + TotalUsage *int64 `json:"totalUsage,omitempty"` + PerCPUUsage *[]int64 `json:"perCpuUsage,omitempty"` + KernelModeUsage *int64 `json:"kernelModeUsage,omitempty"` + UserModeUsage *int64 `json:"userModeUsage,omitempty"` +} + +// ContainerInfo ... +type ContainerInfo struct { + CurrentTimeStamp *date.Time `json:"currentTimeStamp,omitempty"` + PreviousTimeStamp *date.Time `json:"previousTimeStamp,omitempty"` + CurrentCPUStats *ContainerCPUStatistics `json:"currentCpuStats,omitempty"` + PreviousCPUStats *ContainerCPUStatistics `json:"previousCpuStats,omitempty"` + MemoryStats *ContainerMemoryStatistics `json:"memoryStats,omitempty"` + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + Eth0 *ContainerNetworkInterfaceStatistics `json:"eth0,omitempty"` +} + +// ContainerMemoryStatistics ... +type ContainerMemoryStatistics struct { + Usage *int64 `json:"usage,omitempty"` + MaxUsage *int64 `json:"maxUsage,omitempty"` + Limit *int64 `json:"limit,omitempty"` +} + +// ContainerNetworkInterfaceStatistics ... +type ContainerNetworkInterfaceStatistics struct { + RxBytes *int64 `json:"rxBytes,omitempty"` + RxPackets *int64 `json:"rxPackets,omitempty"` + RxErrors *int64 `json:"rxErrors,omitempty"` + RxDropped *int64 `json:"rxDropped,omitempty"` + TxBytes *int64 `json:"txBytes,omitempty"` + TxPackets *int64 `json:"txPackets,omitempty"` + TxErrors *int64 `json:"txErrors,omitempty"` + TxDropped *int64 `json:"txDropped,omitempty"` +} + +// ContainerResources container App container resource requirements. +type ContainerResources struct { + // CPU - Required CPU in cores, e.g. 0.5 + CPU *float64 `json:"cpu,omitempty"` + // Memory - Required memory, e.g. "250Mb" + Memory *string `json:"memory,omitempty"` +} + +// ContainerThrottlingData ... +type ContainerThrottlingData struct { + Periods *int32 `json:"periods,omitempty"` + ThrottledPeriods *int32 `json:"throttledPeriods,omitempty"` + ThrottledTime *int32 `json:"throttledTime,omitempty"` +} + +// ContinuousWebJob continuous Web Job Information. +type ContinuousWebJob struct { + autorest.Response `json:"-"` + // ContinuousWebJobProperties - ContinuousWebJob resource specific properties + *ContinuousWebJobProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContinuousWebJob. +func (cwj ContinuousWebJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cwj.ContinuousWebJobProperties != nil { + objectMap["properties"] = cwj.ContinuousWebJobProperties + } + if cwj.Kind != nil { + objectMap["kind"] = cwj.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ContinuousWebJob struct. +func (cwj *ContinuousWebJob) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var continuousWebJobProperties ContinuousWebJobProperties + err = json.Unmarshal(*v, &continuousWebJobProperties) + if err != nil { + return err + } + cwj.ContinuousWebJobProperties = &continuousWebJobProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cwj.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cwj.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + cwj.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cwj.Type = &typeVar + } + } + } + + return nil +} + +// ContinuousWebJobCollection collection of Kudu continuous web job information elements. +type ContinuousWebJobCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]ContinuousWebJob `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContinuousWebJobCollection. +func (cwjc ContinuousWebJobCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cwjc.Value != nil { + objectMap["value"] = cwjc.Value + } + return json.Marshal(objectMap) +} + +// ContinuousWebJobCollectionIterator provides access to a complete listing of ContinuousWebJob values. +type ContinuousWebJobCollectionIterator struct { + i int + page ContinuousWebJobCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ContinuousWebJobCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContinuousWebJobCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ContinuousWebJobCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ContinuousWebJobCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ContinuousWebJobCollectionIterator) Response() ContinuousWebJobCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ContinuousWebJobCollectionIterator) Value() ContinuousWebJob { + if !iter.page.NotDone() { + return ContinuousWebJob{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ContinuousWebJobCollectionIterator type. +func NewContinuousWebJobCollectionIterator(page ContinuousWebJobCollectionPage) ContinuousWebJobCollectionIterator { + return ContinuousWebJobCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cwjc ContinuousWebJobCollection) IsEmpty() bool { + return cwjc.Value == nil || len(*cwjc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cwjc ContinuousWebJobCollection) hasNextLink() bool { + return cwjc.NextLink != nil && len(*cwjc.NextLink) != 0 +} + +// continuousWebJobCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cwjc ContinuousWebJobCollection) continuousWebJobCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !cwjc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cwjc.NextLink))) +} + +// ContinuousWebJobCollectionPage contains a page of ContinuousWebJob values. +type ContinuousWebJobCollectionPage struct { + fn func(context.Context, ContinuousWebJobCollection) (ContinuousWebJobCollection, error) + cwjc ContinuousWebJobCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ContinuousWebJobCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContinuousWebJobCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cwjc) + if err != nil { + return err + } + page.cwjc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ContinuousWebJobCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ContinuousWebJobCollectionPage) NotDone() bool { + return !page.cwjc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ContinuousWebJobCollectionPage) Response() ContinuousWebJobCollection { + return page.cwjc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ContinuousWebJobCollectionPage) Values() []ContinuousWebJob { + if page.cwjc.IsEmpty() { + return nil + } + return *page.cwjc.Value +} + +// Creates a new instance of the ContinuousWebJobCollectionPage type. +func NewContinuousWebJobCollectionPage(cur ContinuousWebJobCollection, getNextPage func(context.Context, ContinuousWebJobCollection) (ContinuousWebJobCollection, error)) ContinuousWebJobCollectionPage { + return ContinuousWebJobCollectionPage{ + fn: getNextPage, + cwjc: cur, + } +} + +// ContinuousWebJobProperties continuousWebJob resource specific properties +type ContinuousWebJobProperties struct { + // Status - Job status. Possible values include: 'ContinuousWebJobStatusInitializing', 'ContinuousWebJobStatusStarting', 'ContinuousWebJobStatusRunning', 'ContinuousWebJobStatusPendingRestart', 'ContinuousWebJobStatusStopped' + Status ContinuousWebJobStatus `json:"status,omitempty"` + // DetailedStatus - Detailed status. + DetailedStatus *string `json:"detailed_status,omitempty"` + // LogURL - Log URL. + LogURL *string `json:"log_url,omitempty"` + // RunCommand - Run command. + RunCommand *string `json:"run_command,omitempty"` + // URL - Job URL. + URL *string `json:"url,omitempty"` + // ExtraInfoURL - Extra Info URL. + ExtraInfoURL *string `json:"extra_info_url,omitempty"` + // WebJobType - Job type. Possible values include: 'JobTypeContinuous', 'JobTypeTriggered' + WebJobType JobType `json:"web_job_type,omitempty"` + // Error - Error information. + Error *string `json:"error,omitempty"` + // UsingSdk - Using SDK? + UsingSdk *bool `json:"using_sdk,omitempty"` + // Settings - Job settings. + Settings map[string]interface{} `json:"settings"` +} + +// MarshalJSON is the custom marshaler for ContinuousWebJobProperties. +func (cwj ContinuousWebJobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cwj.Status != "" { + objectMap["status"] = cwj.Status + } + if cwj.DetailedStatus != nil { + objectMap["detailed_status"] = cwj.DetailedStatus + } + if cwj.LogURL != nil { + objectMap["log_url"] = cwj.LogURL + } + if cwj.RunCommand != nil { + objectMap["run_command"] = cwj.RunCommand + } + if cwj.URL != nil { + objectMap["url"] = cwj.URL + } + if cwj.ExtraInfoURL != nil { + objectMap["extra_info_url"] = cwj.ExtraInfoURL + } + if cwj.WebJobType != "" { + objectMap["web_job_type"] = cwj.WebJobType + } + if cwj.Error != nil { + objectMap["error"] = cwj.Error + } + if cwj.UsingSdk != nil { + objectMap["using_sdk"] = cwj.UsingSdk + } + if cwj.Settings != nil { + objectMap["settings"] = cwj.Settings + } + return json.Marshal(objectMap) +} + +// CookieExpiration the configuration settings of the session cookie's expiration. +type CookieExpiration struct { + // Convention - The convention used when determining the session cookie's expiration. Possible values include: 'CookieExpirationConventionFixedTime', 'CookieExpirationConventionIdentityProviderDerived' + Convention CookieExpirationConvention `json:"convention,omitempty"` + // TimeToExpiration - The time after the request is made when the session cookie should expire. + TimeToExpiration *string `json:"timeToExpiration,omitempty"` +} + +// CorsSettings cross-Origin Resource Sharing (CORS) settings for the app. +type CorsSettings struct { + // AllowedOrigins - Gets or sets the list of origins that should be allowed to make cross-origin + // calls (for example: http://example.com:12345). Use "*" to allow all. + AllowedOrigins *[]string `json:"allowedOrigins,omitempty"` + // SupportCredentials - Gets or sets whether CORS requests with credentials are allowed. See + // https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Requests_with_credentials + // for more details. + SupportCredentials *bool `json:"supportCredentials,omitempty"` +} + +// CsmMoveResourceEnvelope object with a list of the resources that need to be moved and the resource group +// they should be moved to. +type CsmMoveResourceEnvelope struct { + TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` + Resources *[]string `json:"resources,omitempty"` +} + +// CsmOperationCollection collection of Azure resource manager operation metadata. +type CsmOperationCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]CsmOperationDescription `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for CsmOperationCollection. +func (coc CsmOperationCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if coc.Value != nil { + objectMap["value"] = coc.Value + } + return json.Marshal(objectMap) +} + +// CsmOperationCollectionIterator provides access to a complete listing of CsmOperationDescription values. +type CsmOperationCollectionIterator struct { + i int + page CsmOperationCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CsmOperationCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CsmOperationCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CsmOperationCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CsmOperationCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CsmOperationCollectionIterator) Response() CsmOperationCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CsmOperationCollectionIterator) Value() CsmOperationDescription { + if !iter.page.NotDone() { + return CsmOperationDescription{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CsmOperationCollectionIterator type. +func NewCsmOperationCollectionIterator(page CsmOperationCollectionPage) CsmOperationCollectionIterator { + return CsmOperationCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (coc CsmOperationCollection) IsEmpty() bool { + return coc.Value == nil || len(*coc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (coc CsmOperationCollection) hasNextLink() bool { + return coc.NextLink != nil && len(*coc.NextLink) != 0 +} + +// csmOperationCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (coc CsmOperationCollection) csmOperationCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !coc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(coc.NextLink))) +} + +// CsmOperationCollectionPage contains a page of CsmOperationDescription values. +type CsmOperationCollectionPage struct { + fn func(context.Context, CsmOperationCollection) (CsmOperationCollection, error) + coc CsmOperationCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CsmOperationCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CsmOperationCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.coc) + if err != nil { + return err + } + page.coc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CsmOperationCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CsmOperationCollectionPage) NotDone() bool { + return !page.coc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CsmOperationCollectionPage) Response() CsmOperationCollection { + return page.coc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CsmOperationCollectionPage) Values() []CsmOperationDescription { + if page.coc.IsEmpty() { + return nil + } + return *page.coc.Value +} + +// Creates a new instance of the CsmOperationCollectionPage type. +func NewCsmOperationCollectionPage(cur CsmOperationCollection, getNextPage func(context.Context, CsmOperationCollection) (CsmOperationCollection, error)) CsmOperationCollectionPage { + return CsmOperationCollectionPage{ + fn: getNextPage, + coc: cur, + } +} + +// CsmOperationDescription description of an operation available for Microsoft.Web resource provider. +type CsmOperationDescription struct { + Name *string `json:"name,omitempty"` + IsDataAction *bool `json:"isDataAction,omitempty"` + Display *CsmOperationDisplay `json:"display,omitempty"` + Origin *string `json:"origin,omitempty"` + Properties *CsmOperationDescriptionProperties `json:"properties,omitempty"` +} + +// CsmOperationDescriptionProperties properties available for a Microsoft.Web resource provider operation. +type CsmOperationDescriptionProperties struct { + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// CsmOperationDisplay meta data about operation used for display in portal. +type CsmOperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` + Description *string `json:"description,omitempty"` +} + +// CsmPublishingCredentialsPoliciesEntity publishing Credentials Policies parameters. +type CsmPublishingCredentialsPoliciesEntity struct { + autorest.Response `json:"-"` + // CsmPublishingCredentialsPoliciesEntityProperties - CsmPublishingCredentialsPoliciesEntity resource specific properties + *CsmPublishingCredentialsPoliciesEntityProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for CsmPublishingCredentialsPoliciesEntity. +func (cpcpe CsmPublishingCredentialsPoliciesEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cpcpe.CsmPublishingCredentialsPoliciesEntityProperties != nil { + objectMap["properties"] = cpcpe.CsmPublishingCredentialsPoliciesEntityProperties + } + if cpcpe.Kind != nil { + objectMap["kind"] = cpcpe.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CsmPublishingCredentialsPoliciesEntity struct. +func (cpcpe *CsmPublishingCredentialsPoliciesEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var csmPublishingCredentialsPoliciesEntityProperties CsmPublishingCredentialsPoliciesEntityProperties + err = json.Unmarshal(*v, &csmPublishingCredentialsPoliciesEntityProperties) + if err != nil { + return err + } + cpcpe.CsmPublishingCredentialsPoliciesEntityProperties = &csmPublishingCredentialsPoliciesEntityProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cpcpe.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cpcpe.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + cpcpe.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cpcpe.Type = &typeVar + } + } + } + + return nil +} + +// CsmPublishingCredentialsPoliciesEntityProperties csmPublishingCredentialsPoliciesEntity resource +// specific properties +type CsmPublishingCredentialsPoliciesEntityProperties struct { + // Allow - true to allow access to a publishing method; otherwise, false. + Allow *bool `json:"allow,omitempty"` +} + +// CsmPublishingProfileOptions publishing options for requested profile. +type CsmPublishingProfileOptions struct { + // Format - Name of the format. Valid values are: + // FileZilla3 + // WebDeploy -- default + // Ftp. Possible values include: 'PublishingProfileFormatFileZilla3', 'PublishingProfileFormatWebDeploy', 'PublishingProfileFormatFtp' + Format PublishingProfileFormat `json:"format,omitempty"` + // IncludeDisasterRecoveryEndpoints - Include the DisasterRecover endpoint if true + IncludeDisasterRecoveryEndpoints *bool `json:"includeDisasterRecoveryEndpoints,omitempty"` +} + +// CsmSlotEntity deployment slot parameters. +type CsmSlotEntity struct { + // TargetSlot - Destination deployment slot during swap operation. + TargetSlot *string `json:"targetSlot,omitempty"` + // PreserveVnet - true to preserve Virtual Network to the slot during swap; otherwise, false. + PreserveVnet *bool `json:"preserveVnet,omitempty"` +} + +// CsmUsageQuota usage of the quota resource. +type CsmUsageQuota struct { + // Unit - Units of measurement for the quota resource. + Unit *string `json:"unit,omitempty"` + // NextResetTime - Next reset time for the resource counter. + NextResetTime *date.Time `json:"nextResetTime,omitempty"` + // CurrentValue - The current value of the resource counter. + CurrentValue *int64 `json:"currentValue,omitempty"` + // Limit - The resource limit. + Limit *int64 `json:"limit,omitempty"` + // Name - Quota name. + Name *LocalizableString `json:"name,omitempty"` +} + +// CsmUsageQuotaCollection collection of CSM usage quotas. +type CsmUsageQuotaCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]CsmUsageQuota `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for CsmUsageQuotaCollection. +func (cuqc CsmUsageQuotaCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cuqc.Value != nil { + objectMap["value"] = cuqc.Value + } + return json.Marshal(objectMap) +} + +// CsmUsageQuotaCollectionIterator provides access to a complete listing of CsmUsageQuota values. +type CsmUsageQuotaCollectionIterator struct { + i int + page CsmUsageQuotaCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CsmUsageQuotaCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CsmUsageQuotaCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CsmUsageQuotaCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CsmUsageQuotaCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CsmUsageQuotaCollectionIterator) Response() CsmUsageQuotaCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CsmUsageQuotaCollectionIterator) Value() CsmUsageQuota { + if !iter.page.NotDone() { + return CsmUsageQuota{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CsmUsageQuotaCollectionIterator type. +func NewCsmUsageQuotaCollectionIterator(page CsmUsageQuotaCollectionPage) CsmUsageQuotaCollectionIterator { + return CsmUsageQuotaCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cuqc CsmUsageQuotaCollection) IsEmpty() bool { + return cuqc.Value == nil || len(*cuqc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cuqc CsmUsageQuotaCollection) hasNextLink() bool { + return cuqc.NextLink != nil && len(*cuqc.NextLink) != 0 +} + +// csmUsageQuotaCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cuqc CsmUsageQuotaCollection) csmUsageQuotaCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !cuqc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cuqc.NextLink))) +} + +// CsmUsageQuotaCollectionPage contains a page of CsmUsageQuota values. +type CsmUsageQuotaCollectionPage struct { + fn func(context.Context, CsmUsageQuotaCollection) (CsmUsageQuotaCollection, error) + cuqc CsmUsageQuotaCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CsmUsageQuotaCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CsmUsageQuotaCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cuqc) + if err != nil { + return err + } + page.cuqc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CsmUsageQuotaCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CsmUsageQuotaCollectionPage) NotDone() bool { + return !page.cuqc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CsmUsageQuotaCollectionPage) Response() CsmUsageQuotaCollection { + return page.cuqc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CsmUsageQuotaCollectionPage) Values() []CsmUsageQuota { + if page.cuqc.IsEmpty() { + return nil + } + return *page.cuqc.Value +} + +// Creates a new instance of the CsmUsageQuotaCollectionPage type. +func NewCsmUsageQuotaCollectionPage(cur CsmUsageQuotaCollection, getNextPage func(context.Context, CsmUsageQuotaCollection) (CsmUsageQuotaCollection, error)) CsmUsageQuotaCollectionPage { + return CsmUsageQuotaCollectionPage{ + fn: getNextPage, + cuqc: cur, + } +} + +// CustomHostnameAnalysisResult custom domain analysis. +type CustomHostnameAnalysisResult struct { + autorest.Response `json:"-"` + // CustomHostnameAnalysisResultProperties - CustomHostnameAnalysisResult resource specific properties + *CustomHostnameAnalysisResultProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomHostnameAnalysisResult. +func (char CustomHostnameAnalysisResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if char.CustomHostnameAnalysisResultProperties != nil { + objectMap["properties"] = char.CustomHostnameAnalysisResultProperties + } + if char.Kind != nil { + objectMap["kind"] = char.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CustomHostnameAnalysisResult struct. +func (char *CustomHostnameAnalysisResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var customHostnameAnalysisResultProperties CustomHostnameAnalysisResultProperties + err = json.Unmarshal(*v, &customHostnameAnalysisResultProperties) + if err != nil { + return err + } + char.CustomHostnameAnalysisResultProperties = &customHostnameAnalysisResultProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + char.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + char.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + char.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + char.Type = &typeVar + } + } + } + + return nil +} + +// CustomHostnameAnalysisResultProperties customHostnameAnalysisResult resource specific properties +type CustomHostnameAnalysisResultProperties struct { + // IsHostnameAlreadyVerified - READ-ONLY; true if hostname is already verified; otherwise, false. + IsHostnameAlreadyVerified *bool `json:"isHostnameAlreadyVerified,omitempty"` + // CustomDomainVerificationTest - READ-ONLY; DNS verification test result. Possible values include: 'DNSVerificationTestResultPassed', 'DNSVerificationTestResultFailed', 'DNSVerificationTestResultSkipped' + CustomDomainVerificationTest DNSVerificationTestResult `json:"customDomainVerificationTest,omitempty"` + // CustomDomainVerificationFailureInfo - READ-ONLY; Raw failure information if DNS verification fails. + CustomDomainVerificationFailureInfo *ErrorEntity `json:"customDomainVerificationFailureInfo,omitempty"` + // HasConflictOnScaleUnit - READ-ONLY; true if there is a conflict on a scale unit; otherwise, false. + HasConflictOnScaleUnit *bool `json:"hasConflictOnScaleUnit,omitempty"` + // HasConflictAcrossSubscription - READ-ONLY; true if there is a conflict across subscriptions; otherwise, false. + HasConflictAcrossSubscription *bool `json:"hasConflictAcrossSubscription,omitempty"` + // ConflictingAppResourceID - READ-ONLY; Name of the conflicting app on scale unit if it's within the same subscription. + ConflictingAppResourceID *string `json:"conflictingAppResourceId,omitempty"` + // CNameRecords - CName records controller can see for this hostname. + CNameRecords *[]string `json:"cNameRecords,omitempty"` + // TxtRecords - TXT records controller can see for this hostname. + TxtRecords *[]string `json:"txtRecords,omitempty"` + // ARecords - A records controller can see for this hostname. + ARecords *[]string `json:"aRecords,omitempty"` + // AlternateCNameRecords - Alternate CName records controller can see for this hostname. + AlternateCNameRecords *[]string `json:"alternateCNameRecords,omitempty"` + // AlternateTxtRecords - Alternate TXT records controller can see for this hostname. + AlternateTxtRecords *[]string `json:"alternateTxtRecords,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomHostnameAnalysisResultProperties. +func (char CustomHostnameAnalysisResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if char.CNameRecords != nil { + objectMap["cNameRecords"] = char.CNameRecords + } + if char.TxtRecords != nil { + objectMap["txtRecords"] = char.TxtRecords + } + if char.ARecords != nil { + objectMap["aRecords"] = char.ARecords + } + if char.AlternateCNameRecords != nil { + objectMap["alternateCNameRecords"] = char.AlternateCNameRecords + } + if char.AlternateTxtRecords != nil { + objectMap["alternateTxtRecords"] = char.AlternateTxtRecords + } + return json.Marshal(objectMap) +} + +// CustomHostnameSites a hostname and its assigned sites +type CustomHostnameSites struct { + // CustomHostnameSitesProperties - CustomHostnameSites resource specific properties + *CustomHostnameSitesProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomHostnameSites. +func (chs CustomHostnameSites) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if chs.CustomHostnameSitesProperties != nil { + objectMap["properties"] = chs.CustomHostnameSitesProperties + } + if chs.Kind != nil { + objectMap["kind"] = chs.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CustomHostnameSites struct. +func (chs *CustomHostnameSites) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var customHostnameSitesProperties CustomHostnameSitesProperties + err = json.Unmarshal(*v, &customHostnameSitesProperties) + if err != nil { + return err + } + chs.CustomHostnameSitesProperties = &customHostnameSitesProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + chs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + chs.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + chs.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + chs.Type = &typeVar + } + } + } + + return nil +} + +// CustomHostnameSitesCollection collection of custom hostname sites +type CustomHostnameSitesCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]CustomHostnameSites `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomHostnameSitesCollection. +func (chsc CustomHostnameSitesCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if chsc.Value != nil { + objectMap["value"] = chsc.Value + } + return json.Marshal(objectMap) +} + +// CustomHostnameSitesCollectionIterator provides access to a complete listing of CustomHostnameSites +// values. +type CustomHostnameSitesCollectionIterator struct { + i int + page CustomHostnameSitesCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CustomHostnameSitesCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomHostnameSitesCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CustomHostnameSitesCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CustomHostnameSitesCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CustomHostnameSitesCollectionIterator) Response() CustomHostnameSitesCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CustomHostnameSitesCollectionIterator) Value() CustomHostnameSites { + if !iter.page.NotDone() { + return CustomHostnameSites{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CustomHostnameSitesCollectionIterator type. +func NewCustomHostnameSitesCollectionIterator(page CustomHostnameSitesCollectionPage) CustomHostnameSitesCollectionIterator { + return CustomHostnameSitesCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (chsc CustomHostnameSitesCollection) IsEmpty() bool { + return chsc.Value == nil || len(*chsc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (chsc CustomHostnameSitesCollection) hasNextLink() bool { + return chsc.NextLink != nil && len(*chsc.NextLink) != 0 +} + +// customHostnameSitesCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (chsc CustomHostnameSitesCollection) customHostnameSitesCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !chsc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(chsc.NextLink))) +} + +// CustomHostnameSitesCollectionPage contains a page of CustomHostnameSites values. +type CustomHostnameSitesCollectionPage struct { + fn func(context.Context, CustomHostnameSitesCollection) (CustomHostnameSitesCollection, error) + chsc CustomHostnameSitesCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CustomHostnameSitesCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomHostnameSitesCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.chsc) + if err != nil { + return err + } + page.chsc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CustomHostnameSitesCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CustomHostnameSitesCollectionPage) NotDone() bool { + return !page.chsc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CustomHostnameSitesCollectionPage) Response() CustomHostnameSitesCollection { + return page.chsc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CustomHostnameSitesCollectionPage) Values() []CustomHostnameSites { + if page.chsc.IsEmpty() { + return nil + } + return *page.chsc.Value +} + +// Creates a new instance of the CustomHostnameSitesCollectionPage type. +func NewCustomHostnameSitesCollectionPage(cur CustomHostnameSitesCollection, getNextPage func(context.Context, CustomHostnameSitesCollection) (CustomHostnameSitesCollection, error)) CustomHostnameSitesCollectionPage { + return CustomHostnameSitesCollectionPage{ + fn: getNextPage, + chsc: cur, + } +} + +// CustomHostnameSitesProperties customHostnameSites resource specific properties +type CustomHostnameSitesProperties struct { + CustomHostname *string `json:"customHostname,omitempty"` + Region *string `json:"region,omitempty"` + SiteResourceIds *[]Identifier `json:"siteResourceIds,omitempty"` +} + +// CustomOpenIDConnectProvider the configuration settings of the custom Open ID Connect provider. +type CustomOpenIDConnectProvider struct { + // Enabled - false if the custom Open ID provider provider should not be enabled; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + // Registration - The configuration settings of the app registration for the custom Open ID Connect provider. + Registration *OpenIDConnectRegistration `json:"registration,omitempty"` + // Login - The configuration settings of the login flow of the custom Open ID Connect provider. + Login *OpenIDConnectLogin `json:"login,omitempty"` +} + +// CustomScaleRule container App container Custom scaling rule. +type CustomScaleRule struct { + // Type - Type of the custom scale rule + // eg: azure-servicebus, redis etc. + Type *string `json:"type,omitempty"` + // Metadata - Metadata properties to describe custom scale rule. + Metadata map[string]*string `json:"metadata"` + // Auth - Authentication secrets for the custom scale rule. + Auth *[]ScaleRuleAuth `json:"auth,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomScaleRule. +func (csr CustomScaleRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csr.Type != nil { + objectMap["type"] = csr.Type + } + if csr.Metadata != nil { + objectMap["metadata"] = csr.Metadata + } + if csr.Auth != nil { + objectMap["auth"] = csr.Auth + } + return json.Marshal(objectMap) +} + +// Dapr container App Dapr configuration. +type Dapr struct { + // Enabled - Boolean indicating if the Dapr side car is enabled + Enabled *bool `json:"enabled,omitempty"` + // AppID - Dapr application identifier + AppID *string `json:"appId,omitempty"` + // AppPort - Port on which the Dapr side car + AppPort *int32 `json:"appPort,omitempty"` + // Components - Collection of Dapr components + Components *[]DaprComponent `json:"components,omitempty"` +} + +// DaprComponent dapr component configuration +type DaprComponent struct { + // Name - Component name + Name *string `json:"name,omitempty"` + // Type - Component type + Type *string `json:"type,omitempty"` + // Version - Component version + Version *string `json:"version,omitempty"` + // Metadata - Component metadata + Metadata *[]DaprMetadata `json:"metadata,omitempty"` +} + +// DaprMetadata container App Dapr component metadata. +type DaprMetadata struct { + // Name - Metadata property name. + Name *string `json:"name,omitempty"` + // Value - Metadata property value. + Value *string `json:"value,omitempty"` + // SecretRef - Name of the Container App secret from which to pull the metadata property value. + SecretRef *string `json:"secretRef,omitempty"` +} + +// DatabaseBackupSetting database backup settings. +type DatabaseBackupSetting struct { + // DatabaseType - Database type (e.g. SqlAzure / MySql). Possible values include: 'DatabaseTypeSQLAzure', 'DatabaseTypeMySQL', 'DatabaseTypeLocalMySQL', 'DatabaseTypePostgreSQL' + DatabaseType DatabaseType `json:"databaseType,omitempty"` + Name *string `json:"name,omitempty"` + // ConnectionStringName - Contains a connection string name that is linked to the SiteConfig.ConnectionStrings. + // This is used during restore with overwrite connection strings options. + ConnectionStringName *string `json:"connectionStringName,omitempty"` + // ConnectionString - Contains a connection string to a database which is being backed up or restored. If the restore should happen to a new database, the database name inside is the new one. + ConnectionString *string `json:"connectionString,omitempty"` +} + +// DataProviderMetadata additional configuration for a data providers +type DataProviderMetadata struct { + ProviderName *string `json:"providerName,omitempty"` + // PropertyBag - READ-ONLY; Settings for the data provider + PropertyBag *[]KeyValuePairStringObject `json:"propertyBag,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataProviderMetadata. +func (dpm DataProviderMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dpm.ProviderName != nil { + objectMap["providerName"] = dpm.ProviderName + } + return json.Marshal(objectMap) +} + +// DataSource class representing data source used by the detectors +type DataSource struct { + // Instructions - Instructions if any for the data source + Instructions *[]string `json:"instructions,omitempty"` + // DataSourceURI - Datasource Uri Links + DataSourceURI *[]NameValuePair `json:"dataSourceUri,omitempty"` +} + +// DataTableResponseColumn column definition +type DataTableResponseColumn struct { + // ColumnName - Name of the column + ColumnName *string `json:"columnName,omitempty"` + // DataType - Data type which looks like 'String' or 'Int32'. + DataType *string `json:"dataType,omitempty"` + // ColumnType - Column Type + ColumnType *string `json:"columnType,omitempty"` +} + +// DataTableResponseObject data Table which defines columns and raw row values +type DataTableResponseObject struct { + // TableName - Name of the table + TableName *string `json:"tableName,omitempty"` + // Columns - List of columns with data types + Columns *[]DataTableResponseColumn `json:"columns,omitempty"` + // Rows - Raw row values + Rows *[][]string `json:"rows,omitempty"` +} + +// DefaultAuthorizationPolicy the configuration settings of the Azure Active Directory default +// authorization policy. +type DefaultAuthorizationPolicy struct { + // AllowedPrincipals - The configuration settings of the Azure Active Directory allowed principals. + AllowedPrincipals *AllowedPrincipals `json:"allowedPrincipals,omitempty"` + // AllowedApplications - The configuration settings of the Azure Active Directory allowed applications. + AllowedApplications *[]string `json:"allowedApplications,omitempty"` +} + +// DefaultErrorResponse app Service error response. +type DefaultErrorResponse struct { + // Error - READ-ONLY; Error model. + Error *DefaultErrorResponseError `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for DefaultErrorResponse. +func (der DefaultErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DefaultErrorResponseError error model. +type DefaultErrorResponseError struct { + // Code - READ-ONLY; Standardized string to programmatically identify the error. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Detailed error description and debugging information. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; Detailed error description and debugging information. + Target *string `json:"target,omitempty"` + Details *[]DefaultErrorResponseErrorDetailsItem `json:"details,omitempty"` + // Innererror - READ-ONLY; More information to debug error. + Innererror *string `json:"innererror,omitempty"` +} + +// MarshalJSON is the custom marshaler for DefaultErrorResponseError. +func (der DefaultErrorResponseError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if der.Details != nil { + objectMap["details"] = der.Details + } + return json.Marshal(objectMap) +} + +// DefaultErrorResponseErrorDetailsItem detailed errors. +type DefaultErrorResponseErrorDetailsItem struct { + // Code - READ-ONLY; Standardized string to programmatically identify the error. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Detailed error description and debugging information. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; Detailed error description and debugging information. + Target *string `json:"target,omitempty"` +} + +// MarshalJSON is the custom marshaler for DefaultErrorResponseErrorDetailsItem. +func (derI DefaultErrorResponseErrorDetailsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DeletedAppRestoreRequest details about restoring a deleted app. +type DeletedAppRestoreRequest struct { + // DeletedAppRestoreRequestProperties - DeletedAppRestoreRequest resource specific properties + *DeletedAppRestoreRequestProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeletedAppRestoreRequest. +func (darr DeletedAppRestoreRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if darr.DeletedAppRestoreRequestProperties != nil { + objectMap["properties"] = darr.DeletedAppRestoreRequestProperties + } + if darr.Kind != nil { + objectMap["kind"] = darr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DeletedAppRestoreRequest struct. +func (darr *DeletedAppRestoreRequest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var deletedAppRestoreRequestProperties DeletedAppRestoreRequestProperties + err = json.Unmarshal(*v, &deletedAppRestoreRequestProperties) + if err != nil { + return err + } + darr.DeletedAppRestoreRequestProperties = &deletedAppRestoreRequestProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + darr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + darr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + darr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + darr.Type = &typeVar + } + } + } + + return nil +} + +// DeletedAppRestoreRequestProperties deletedAppRestoreRequest resource specific properties +type DeletedAppRestoreRequestProperties struct { + // DeletedSiteID - ARM resource ID of the deleted app. Example: + // /subscriptions/{subId}/providers/Microsoft.Web/deletedSites/{deletedSiteId} + DeletedSiteID *string `json:"deletedSiteId,omitempty"` + // RecoverConfiguration - If true, deleted site configuration, in addition to content, will be restored. + RecoverConfiguration *bool `json:"recoverConfiguration,omitempty"` + // SnapshotTime - Point in time to restore the deleted app from, formatted as a DateTime string. + // If unspecified, default value is the time that the app was deleted. + SnapshotTime *string `json:"snapshotTime,omitempty"` + // UseDRSecondary - If true, the snapshot is retrieved from DRSecondary endpoint. + UseDRSecondary *bool `json:"useDRSecondary,omitempty"` +} + +// DeletedSite a deleted app. +type DeletedSite struct { + autorest.Response `json:"-"` + // DeletedSiteProperties - DeletedSite resource specific properties + *DeletedSiteProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeletedSite. +func (ds DeletedSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ds.DeletedSiteProperties != nil { + objectMap["properties"] = ds.DeletedSiteProperties + } + if ds.Kind != nil { + objectMap["kind"] = ds.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DeletedSite struct. +func (ds *DeletedSite) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var deletedSiteProperties DeletedSiteProperties + err = json.Unmarshal(*v, &deletedSiteProperties) + if err != nil { + return err + } + ds.DeletedSiteProperties = &deletedSiteProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ds.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ds.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ds.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ds.Type = &typeVar + } + } + } + + return nil +} + +// DeletedSiteProperties deletedSite resource specific properties +type DeletedSiteProperties struct { + // DeletedSiteID - READ-ONLY; Numeric id for the deleted site + DeletedSiteID *int32 `json:"deletedSiteId,omitempty"` + // DeletedTimestamp - READ-ONLY; Time in UTC when the app was deleted. + DeletedTimestamp *string `json:"deletedTimestamp,omitempty"` + // Subscription - READ-ONLY; Subscription containing the deleted site + Subscription *string `json:"subscription,omitempty"` + // ResourceGroup - READ-ONLY; ResourceGroup that contained the deleted site + ResourceGroup *string `json:"resourceGroup,omitempty"` + // DeletedSiteName - READ-ONLY; Name of the deleted site + DeletedSiteName *string `json:"deletedSiteName,omitempty"` + // Slot - READ-ONLY; Slot of the deleted site + Slot *string `json:"slot,omitempty"` + // Kind - READ-ONLY; Kind of site that was deleted + Kind *string `json:"kind,omitempty"` + // GeoRegionName - READ-ONLY; Geo Region of the deleted site + GeoRegionName *string `json:"geoRegionName,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeletedSiteProperties. +func (ds DeletedSiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DeletedWebAppCollection collection of deleted apps. +type DeletedWebAppCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]DeletedSite `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeletedWebAppCollection. +func (dwac DeletedWebAppCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dwac.Value != nil { + objectMap["value"] = dwac.Value + } + return json.Marshal(objectMap) +} + +// DeletedWebAppCollectionIterator provides access to a complete listing of DeletedSite values. +type DeletedWebAppCollectionIterator struct { + i int + page DeletedWebAppCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeletedWebAppCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedWebAppCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DeletedWebAppCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeletedWebAppCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeletedWebAppCollectionIterator) Response() DeletedWebAppCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeletedWebAppCollectionIterator) Value() DeletedSite { + if !iter.page.NotDone() { + return DeletedSite{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DeletedWebAppCollectionIterator type. +func NewDeletedWebAppCollectionIterator(page DeletedWebAppCollectionPage) DeletedWebAppCollectionIterator { + return DeletedWebAppCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dwac DeletedWebAppCollection) IsEmpty() bool { + return dwac.Value == nil || len(*dwac.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dwac DeletedWebAppCollection) hasNextLink() bool { + return dwac.NextLink != nil && len(*dwac.NextLink) != 0 +} + +// deletedWebAppCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dwac DeletedWebAppCollection) deletedWebAppCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !dwac.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dwac.NextLink))) +} + +// DeletedWebAppCollectionPage contains a page of DeletedSite values. +type DeletedWebAppCollectionPage struct { + fn func(context.Context, DeletedWebAppCollection) (DeletedWebAppCollection, error) + dwac DeletedWebAppCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeletedWebAppCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedWebAppCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dwac) + if err != nil { + return err + } + page.dwac = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DeletedWebAppCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeletedWebAppCollectionPage) NotDone() bool { + return !page.dwac.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeletedWebAppCollectionPage) Response() DeletedWebAppCollection { + return page.dwac +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeletedWebAppCollectionPage) Values() []DeletedSite { + if page.dwac.IsEmpty() { + return nil + } + return *page.dwac.Value +} + +// Creates a new instance of the DeletedWebAppCollectionPage type. +func NewDeletedWebAppCollectionPage(cur DeletedWebAppCollection, getNextPage func(context.Context, DeletedWebAppCollection) (DeletedWebAppCollection, error)) DeletedWebAppCollectionPage { + return DeletedWebAppCollectionPage{ + fn: getNextPage, + dwac: cur, + } +} + +// Deployment user credentials used for publishing activity. +type Deployment struct { + autorest.Response `json:"-"` + // DeploymentProperties - Deployment resource specific properties + *DeploymentProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Deployment. +func (d Deployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.DeploymentProperties != nil { + objectMap["properties"] = d.DeploymentProperties + } + if d.Kind != nil { + objectMap["kind"] = d.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Deployment struct. +func (d *Deployment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var deploymentProperties DeploymentProperties + err = json.Unmarshal(*v, &deploymentProperties) + if err != nil { + return err + } + d.DeploymentProperties = &deploymentProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + d.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + d.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + d.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + d.Type = &typeVar + } + } + } + + return nil +} + +// DeploymentCollection collection of app deployments. +type DeploymentCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]Deployment `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentCollection. +func (dc DeploymentCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dc.Value != nil { + objectMap["value"] = dc.Value + } + return json.Marshal(objectMap) +} + +// DeploymentCollectionIterator provides access to a complete listing of Deployment values. +type DeploymentCollectionIterator struct { + i int + page DeploymentCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeploymentCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DeploymentCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeploymentCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeploymentCollectionIterator) Response() DeploymentCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeploymentCollectionIterator) Value() Deployment { + if !iter.page.NotDone() { + return Deployment{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DeploymentCollectionIterator type. +func NewDeploymentCollectionIterator(page DeploymentCollectionPage) DeploymentCollectionIterator { + return DeploymentCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dc DeploymentCollection) IsEmpty() bool { + return dc.Value == nil || len(*dc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dc DeploymentCollection) hasNextLink() bool { + return dc.NextLink != nil && len(*dc.NextLink) != 0 +} + +// deploymentCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dc DeploymentCollection) deploymentCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !dc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dc.NextLink))) +} + +// DeploymentCollectionPage contains a page of Deployment values. +type DeploymentCollectionPage struct { + fn func(context.Context, DeploymentCollection) (DeploymentCollection, error) + dc DeploymentCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeploymentCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dc) + if err != nil { + return err + } + page.dc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DeploymentCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeploymentCollectionPage) NotDone() bool { + return !page.dc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeploymentCollectionPage) Response() DeploymentCollection { + return page.dc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeploymentCollectionPage) Values() []Deployment { + if page.dc.IsEmpty() { + return nil + } + return *page.dc.Value +} + +// Creates a new instance of the DeploymentCollectionPage type. +func NewDeploymentCollectionPage(cur DeploymentCollection, getNextPage func(context.Context, DeploymentCollection) (DeploymentCollection, error)) DeploymentCollectionPage { + return DeploymentCollectionPage{ + fn: getNextPage, + dc: cur, + } +} + +// DeploymentLocations list of available locations (regions or App Service Environments) for +// deployment of App Service resources. +type DeploymentLocations struct { + autorest.Response `json:"-"` + // Locations - Available regions. + Locations *[]GeoRegion `json:"locations,omitempty"` + // HostingEnvironments - Available App Service Environments with full descriptions of the environments. + HostingEnvironments *[]AppServiceEnvironment `json:"hostingEnvironments,omitempty"` + // HostingEnvironmentDeploymentInfos - Available App Service Environments with basic information. + HostingEnvironmentDeploymentInfos *[]HostingEnvironmentDeploymentInfo `json:"hostingEnvironmentDeploymentInfos,omitempty"` +} + +// DeploymentProperties deployment resource specific properties +type DeploymentProperties struct { + // Status - Deployment status. + Status *int32 `json:"status,omitempty"` + // Message - Details about deployment status. + Message *string `json:"message,omitempty"` + // Author - Who authored the deployment. + Author *string `json:"author,omitempty"` + // Deployer - Who performed the deployment. + Deployer *string `json:"deployer,omitempty"` + // AuthorEmail - Author email. + AuthorEmail *string `json:"author_email,omitempty"` + // StartTime - Start time. + StartTime *date.Time `json:"start_time,omitempty"` + // EndTime - End time. + EndTime *date.Time `json:"end_time,omitempty"` + // Active - True if deployment is currently active, false if completed and null if not started. + Active *bool `json:"active,omitempty"` + // Details - Details on deployment. + Details *string `json:"details,omitempty"` +} + +// DetectorAbnormalTimePeriod class representing Abnormal Time Period detected. +type DetectorAbnormalTimePeriod struct { + // StartTime - Start time of the correlated event + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - End time of the correlated event + EndTime *date.Time `json:"endTime,omitempty"` + // Message - Message describing the event + Message *string `json:"message,omitempty"` + // Source - Represents the name of the Detector + Source *string `json:"source,omitempty"` + // Priority - Represents the rank of the Detector + Priority *float64 `json:"priority,omitempty"` + // MetaData - Downtime metadata + MetaData *[][]NameValuePair `json:"metaData,omitempty"` + // Type - Represents the type of the Detector. Possible values include: 'IssueTypeServiceIncident', 'IssueTypeAppDeployment', 'IssueTypeAppCrash', 'IssueTypeRuntimeIssueDetected', 'IssueTypeAseDeployment', 'IssueTypeUserIssue', 'IssueTypePlatformIssue', 'IssueTypeOther' + Type IssueType `json:"type,omitempty"` + // Solutions - List of proposed solutions + Solutions *[]Solution `json:"solutions,omitempty"` +} + +// DetectorDefinition class representing detector definition +type DetectorDefinition struct { + // DisplayName - READ-ONLY; Display name of the detector + DisplayName *string `json:"displayName,omitempty"` + // Description - READ-ONLY; Description of the detector + Description *string `json:"description,omitempty"` + // Rank - READ-ONLY; Detector Rank + Rank *float64 `json:"rank,omitempty"` + // IsEnabled - READ-ONLY; Flag representing whether detector is enabled or not. + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for DetectorDefinition. +func (dd DetectorDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DetectorDefinitionResource ARM resource for a detector definition +type DetectorDefinitionResource struct { + autorest.Response `json:"-"` + // DetectorDefinition - Core resource properties + *DetectorDefinition `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DetectorDefinitionResource. +func (ddr DetectorDefinitionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ddr.DetectorDefinition != nil { + objectMap["properties"] = ddr.DetectorDefinition + } + if ddr.Kind != nil { + objectMap["kind"] = ddr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DetectorDefinitionResource struct. +func (ddr *DetectorDefinitionResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var detectorDefinition DetectorDefinition + err = json.Unmarshal(*v, &detectorDefinition) + if err != nil { + return err + } + ddr.DetectorDefinition = &detectorDefinition + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ddr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ddr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ddr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ddr.Type = &typeVar + } + } + } + + return nil +} + +// DetectorInfo definition of Detector +type DetectorInfo struct { + // ID - READ-ONLY; Id of detector + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of detector + Name *string `json:"name,omitempty"` + // Description - READ-ONLY; Short description of the detector and its purpose. + Description *string `json:"description,omitempty"` + // Author - READ-ONLY; Author of the detector. + Author *string `json:"author,omitempty"` + // Category - READ-ONLY; Problem category. This serves for organizing group for detectors. + Category *string `json:"category,omitempty"` + // SupportTopicList - READ-ONLY; List of Support Topics for which this detector is enabled. + SupportTopicList *[]SupportTopic `json:"supportTopicList,omitempty"` + // AnalysisType - READ-ONLY; Analysis Types for which this detector should apply to. + AnalysisType *[]string `json:"analysisType,omitempty"` + // Type - READ-ONLY; Whether this detector is an Analysis Detector or not. Possible values include: 'DetectorTypeDetector', 'DetectorTypeAnalysis', 'DetectorTypeCategoryOverview' + Type DetectorType `json:"type,omitempty"` + // Score - READ-ONLY; Defines score of a detector to power ML based matching. + Score *float64 `json:"score,omitempty"` +} + +// MarshalJSON is the custom marshaler for DetectorInfo. +func (di DetectorInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DetectorResponse class representing Response from Detector +type DetectorResponse struct { + autorest.Response `json:"-"` + // DetectorResponseProperties - DetectorResponse resource specific properties + *DetectorResponseProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DetectorResponse. +func (dr DetectorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dr.DetectorResponseProperties != nil { + objectMap["properties"] = dr.DetectorResponseProperties + } + if dr.Kind != nil { + objectMap["kind"] = dr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DetectorResponse struct. +func (dr *DetectorResponse) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var detectorResponseProperties DetectorResponseProperties + err = json.Unmarshal(*v, &detectorResponseProperties) + if err != nil { + return err + } + dr.DetectorResponseProperties = &detectorResponseProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + dr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dr.Type = &typeVar + } + } + } + + return nil +} + +// DetectorResponseCollection collection of detector responses +type DetectorResponseCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]DetectorResponse `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DetectorResponseCollection. +func (drc DetectorResponseCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if drc.Value != nil { + objectMap["value"] = drc.Value + } + return json.Marshal(objectMap) +} + +// DetectorResponseCollectionIterator provides access to a complete listing of DetectorResponse values. +type DetectorResponseCollectionIterator struct { + i int + page DetectorResponseCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DetectorResponseCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DetectorResponseCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DetectorResponseCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DetectorResponseCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DetectorResponseCollectionIterator) Response() DetectorResponseCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DetectorResponseCollectionIterator) Value() DetectorResponse { + if !iter.page.NotDone() { + return DetectorResponse{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DetectorResponseCollectionIterator type. +func NewDetectorResponseCollectionIterator(page DetectorResponseCollectionPage) DetectorResponseCollectionIterator { + return DetectorResponseCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (drc DetectorResponseCollection) IsEmpty() bool { + return drc.Value == nil || len(*drc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (drc DetectorResponseCollection) hasNextLink() bool { + return drc.NextLink != nil && len(*drc.NextLink) != 0 +} + +// detectorResponseCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (drc DetectorResponseCollection) detectorResponseCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !drc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(drc.NextLink))) +} + +// DetectorResponseCollectionPage contains a page of DetectorResponse values. +type DetectorResponseCollectionPage struct { + fn func(context.Context, DetectorResponseCollection) (DetectorResponseCollection, error) + drc DetectorResponseCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DetectorResponseCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DetectorResponseCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.drc) + if err != nil { + return err + } + page.drc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DetectorResponseCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DetectorResponseCollectionPage) NotDone() bool { + return !page.drc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DetectorResponseCollectionPage) Response() DetectorResponseCollection { + return page.drc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DetectorResponseCollectionPage) Values() []DetectorResponse { + if page.drc.IsEmpty() { + return nil + } + return *page.drc.Value +} + +// Creates a new instance of the DetectorResponseCollectionPage type. +func NewDetectorResponseCollectionPage(cur DetectorResponseCollection, getNextPage func(context.Context, DetectorResponseCollection) (DetectorResponseCollection, error)) DetectorResponseCollectionPage { + return DetectorResponseCollectionPage{ + fn: getNextPage, + drc: cur, + } +} + +// DetectorResponseProperties detectorResponse resource specific properties +type DetectorResponseProperties struct { + // Metadata - metadata for the detector + Metadata *DetectorInfo `json:"metadata,omitempty"` + // Dataset - Data Set + Dataset *[]DiagnosticData `json:"dataset,omitempty"` + // Status - Indicates status of the most severe insight. + Status *Status `json:"status,omitempty"` + // DataProvidersMetadata - Additional configuration for different data providers to be used by the UI + DataProvidersMetadata *[]DataProviderMetadata `json:"dataProvidersMetadata,omitempty"` + // SuggestedUtterances - Suggested utterances where the detector can be applicable. + SuggestedUtterances *QueryUtterancesResults `json:"suggestedUtterances,omitempty"` +} + +// DiagnosticAnalysis class representing a diagnostic analysis done on an application +type DiagnosticAnalysis struct { + autorest.Response `json:"-"` + // DiagnosticAnalysisProperties - DiagnosticAnalysis resource specific properties + *DiagnosticAnalysisProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiagnosticAnalysis. +func (da DiagnosticAnalysis) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if da.DiagnosticAnalysisProperties != nil { + objectMap["properties"] = da.DiagnosticAnalysisProperties + } + if da.Kind != nil { + objectMap["kind"] = da.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DiagnosticAnalysis struct. +func (da *DiagnosticAnalysis) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var diagnosticAnalysisProperties DiagnosticAnalysisProperties + err = json.Unmarshal(*v, &diagnosticAnalysisProperties) + if err != nil { + return err + } + da.DiagnosticAnalysisProperties = &diagnosticAnalysisProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + da.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + da.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + da.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + da.Type = &typeVar + } + } + } + + return nil +} + +// DiagnosticAnalysisCollection collection of Diagnostic Analyses +type DiagnosticAnalysisCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]AnalysisDefinition `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiagnosticAnalysisCollection. +func (dac DiagnosticAnalysisCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dac.Value != nil { + objectMap["value"] = dac.Value + } + return json.Marshal(objectMap) +} + +// DiagnosticAnalysisCollectionIterator provides access to a complete listing of AnalysisDefinition values. +type DiagnosticAnalysisCollectionIterator struct { + i int + page DiagnosticAnalysisCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DiagnosticAnalysisCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticAnalysisCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DiagnosticAnalysisCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DiagnosticAnalysisCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DiagnosticAnalysisCollectionIterator) Response() DiagnosticAnalysisCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DiagnosticAnalysisCollectionIterator) Value() AnalysisDefinition { + if !iter.page.NotDone() { + return AnalysisDefinition{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DiagnosticAnalysisCollectionIterator type. +func NewDiagnosticAnalysisCollectionIterator(page DiagnosticAnalysisCollectionPage) DiagnosticAnalysisCollectionIterator { + return DiagnosticAnalysisCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dac DiagnosticAnalysisCollection) IsEmpty() bool { + return dac.Value == nil || len(*dac.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dac DiagnosticAnalysisCollection) hasNextLink() bool { + return dac.NextLink != nil && len(*dac.NextLink) != 0 +} + +// diagnosticAnalysisCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dac DiagnosticAnalysisCollection) diagnosticAnalysisCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !dac.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dac.NextLink))) +} + +// DiagnosticAnalysisCollectionPage contains a page of AnalysisDefinition values. +type DiagnosticAnalysisCollectionPage struct { + fn func(context.Context, DiagnosticAnalysisCollection) (DiagnosticAnalysisCollection, error) + dac DiagnosticAnalysisCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DiagnosticAnalysisCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticAnalysisCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dac) + if err != nil { + return err + } + page.dac = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DiagnosticAnalysisCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DiagnosticAnalysisCollectionPage) NotDone() bool { + return !page.dac.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DiagnosticAnalysisCollectionPage) Response() DiagnosticAnalysisCollection { + return page.dac +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DiagnosticAnalysisCollectionPage) Values() []AnalysisDefinition { + if page.dac.IsEmpty() { + return nil + } + return *page.dac.Value +} + +// Creates a new instance of the DiagnosticAnalysisCollectionPage type. +func NewDiagnosticAnalysisCollectionPage(cur DiagnosticAnalysisCollection, getNextPage func(context.Context, DiagnosticAnalysisCollection) (DiagnosticAnalysisCollection, error)) DiagnosticAnalysisCollectionPage { + return DiagnosticAnalysisCollectionPage{ + fn: getNextPage, + dac: cur, + } +} + +// DiagnosticAnalysisProperties diagnosticAnalysis resource specific properties +type DiagnosticAnalysisProperties struct { + // StartTime - Start time of the period + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - End time of the period + EndTime *date.Time `json:"endTime,omitempty"` + // AbnormalTimePeriods - List of time periods. + AbnormalTimePeriods *[]AbnormalTimePeriod `json:"abnormalTimePeriods,omitempty"` + // Payload - Data by each detector + Payload *[]AnalysisData `json:"payload,omitempty"` + // NonCorrelatedDetectors - Data by each detector for detectors that did not corelate + NonCorrelatedDetectors *[]DetectorDefinition `json:"nonCorrelatedDetectors,omitempty"` +} + +// DiagnosticCategory class representing detector definition +type DiagnosticCategory struct { + autorest.Response `json:"-"` + // DiagnosticCategoryProperties - DiagnosticCategory resource specific properties + *DiagnosticCategoryProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiagnosticCategory. +func (dc DiagnosticCategory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dc.DiagnosticCategoryProperties != nil { + objectMap["properties"] = dc.DiagnosticCategoryProperties + } + if dc.Kind != nil { + objectMap["kind"] = dc.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DiagnosticCategory struct. +func (dc *DiagnosticCategory) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var diagnosticCategoryProperties DiagnosticCategoryProperties + err = json.Unmarshal(*v, &diagnosticCategoryProperties) + if err != nil { + return err + } + dc.DiagnosticCategoryProperties = &diagnosticCategoryProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dc.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + dc.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dc.Type = &typeVar + } + } + } + + return nil +} + +// DiagnosticCategoryCollection collection of Diagnostic Categories +type DiagnosticCategoryCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]DiagnosticCategory `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiagnosticCategoryCollection. +func (dcc DiagnosticCategoryCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcc.Value != nil { + objectMap["value"] = dcc.Value + } + return json.Marshal(objectMap) +} + +// DiagnosticCategoryCollectionIterator provides access to a complete listing of DiagnosticCategory values. +type DiagnosticCategoryCollectionIterator struct { + i int + page DiagnosticCategoryCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DiagnosticCategoryCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticCategoryCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DiagnosticCategoryCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DiagnosticCategoryCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DiagnosticCategoryCollectionIterator) Response() DiagnosticCategoryCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DiagnosticCategoryCollectionIterator) Value() DiagnosticCategory { + if !iter.page.NotDone() { + return DiagnosticCategory{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DiagnosticCategoryCollectionIterator type. +func NewDiagnosticCategoryCollectionIterator(page DiagnosticCategoryCollectionPage) DiagnosticCategoryCollectionIterator { + return DiagnosticCategoryCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dcc DiagnosticCategoryCollection) IsEmpty() bool { + return dcc.Value == nil || len(*dcc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dcc DiagnosticCategoryCollection) hasNextLink() bool { + return dcc.NextLink != nil && len(*dcc.NextLink) != 0 +} + +// diagnosticCategoryCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dcc DiagnosticCategoryCollection) diagnosticCategoryCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !dcc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dcc.NextLink))) +} + +// DiagnosticCategoryCollectionPage contains a page of DiagnosticCategory values. +type DiagnosticCategoryCollectionPage struct { + fn func(context.Context, DiagnosticCategoryCollection) (DiagnosticCategoryCollection, error) + dcc DiagnosticCategoryCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DiagnosticCategoryCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticCategoryCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dcc) + if err != nil { + return err + } + page.dcc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DiagnosticCategoryCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DiagnosticCategoryCollectionPage) NotDone() bool { + return !page.dcc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DiagnosticCategoryCollectionPage) Response() DiagnosticCategoryCollection { + return page.dcc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DiagnosticCategoryCollectionPage) Values() []DiagnosticCategory { + if page.dcc.IsEmpty() { + return nil + } + return *page.dcc.Value +} + +// Creates a new instance of the DiagnosticCategoryCollectionPage type. +func NewDiagnosticCategoryCollectionPage(cur DiagnosticCategoryCollection, getNextPage func(context.Context, DiagnosticCategoryCollection) (DiagnosticCategoryCollection, error)) DiagnosticCategoryCollectionPage { + return DiagnosticCategoryCollectionPage{ + fn: getNextPage, + dcc: cur, + } +} + +// DiagnosticCategoryProperties diagnosticCategory resource specific properties +type DiagnosticCategoryProperties struct { + // Description - READ-ONLY; Description of the diagnostic category + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiagnosticCategoryProperties. +func (dc DiagnosticCategoryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DiagnosticData set of data with rendering instructions +type DiagnosticData struct { + // Table - Data in table form + Table *DataTableResponseObject `json:"table,omitempty"` + // RenderingProperties - Properties that describe how the table should be rendered + RenderingProperties *Rendering `json:"renderingProperties,omitempty"` +} + +// DiagnosticDetectorCollection collection of Diagnostic Detectors +type DiagnosticDetectorCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]DetectorDefinitionResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiagnosticDetectorCollection. +func (ddc DiagnosticDetectorCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ddc.Value != nil { + objectMap["value"] = ddc.Value + } + return json.Marshal(objectMap) +} + +// DiagnosticDetectorCollectionIterator provides access to a complete listing of DetectorDefinitionResource +// values. +type DiagnosticDetectorCollectionIterator struct { + i int + page DiagnosticDetectorCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DiagnosticDetectorCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticDetectorCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DiagnosticDetectorCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DiagnosticDetectorCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DiagnosticDetectorCollectionIterator) Response() DiagnosticDetectorCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DiagnosticDetectorCollectionIterator) Value() DetectorDefinitionResource { + if !iter.page.NotDone() { + return DetectorDefinitionResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DiagnosticDetectorCollectionIterator type. +func NewDiagnosticDetectorCollectionIterator(page DiagnosticDetectorCollectionPage) DiagnosticDetectorCollectionIterator { + return DiagnosticDetectorCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ddc DiagnosticDetectorCollection) IsEmpty() bool { + return ddc.Value == nil || len(*ddc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ddc DiagnosticDetectorCollection) hasNextLink() bool { + return ddc.NextLink != nil && len(*ddc.NextLink) != 0 +} + +// diagnosticDetectorCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ddc DiagnosticDetectorCollection) diagnosticDetectorCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !ddc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ddc.NextLink))) +} + +// DiagnosticDetectorCollectionPage contains a page of DetectorDefinitionResource values. +type DiagnosticDetectorCollectionPage struct { + fn func(context.Context, DiagnosticDetectorCollection) (DiagnosticDetectorCollection, error) + ddc DiagnosticDetectorCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DiagnosticDetectorCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticDetectorCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ddc) + if err != nil { + return err + } + page.ddc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DiagnosticDetectorCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DiagnosticDetectorCollectionPage) NotDone() bool { + return !page.ddc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DiagnosticDetectorCollectionPage) Response() DiagnosticDetectorCollection { + return page.ddc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DiagnosticDetectorCollectionPage) Values() []DetectorDefinitionResource { + if page.ddc.IsEmpty() { + return nil + } + return *page.ddc.Value +} + +// Creates a new instance of the DiagnosticDetectorCollectionPage type. +func NewDiagnosticDetectorCollectionPage(cur DiagnosticDetectorCollection, getNextPage func(context.Context, DiagnosticDetectorCollection) (DiagnosticDetectorCollection, error)) DiagnosticDetectorCollectionPage { + return DiagnosticDetectorCollectionPage{ + fn: getNextPage, + ddc: cur, + } +} + +// DiagnosticDetectorResponse class representing Response from Diagnostic Detectors +type DiagnosticDetectorResponse struct { + autorest.Response `json:"-"` + // DiagnosticDetectorResponseProperties - DiagnosticDetectorResponse resource specific properties + *DiagnosticDetectorResponseProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiagnosticDetectorResponse. +func (ddr DiagnosticDetectorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ddr.DiagnosticDetectorResponseProperties != nil { + objectMap["properties"] = ddr.DiagnosticDetectorResponseProperties + } + if ddr.Kind != nil { + objectMap["kind"] = ddr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DiagnosticDetectorResponse struct. +func (ddr *DiagnosticDetectorResponse) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var diagnosticDetectorResponseProperties DiagnosticDetectorResponseProperties + err = json.Unmarshal(*v, &diagnosticDetectorResponseProperties) + if err != nil { + return err + } + ddr.DiagnosticDetectorResponseProperties = &diagnosticDetectorResponseProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ddr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ddr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ddr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ddr.Type = &typeVar + } + } + } + + return nil +} + +// DiagnosticDetectorResponseProperties diagnosticDetectorResponse resource specific properties +type DiagnosticDetectorResponseProperties struct { + // StartTime - Start time of the period + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - End time of the period + EndTime *date.Time `json:"endTime,omitempty"` + // IssueDetected - Flag representing Issue was detected. + IssueDetected *bool `json:"issueDetected,omitempty"` + // DetectorDefinition - Detector's definition + DetectorDefinition *DetectorDefinition `json:"detectorDefinition,omitempty"` + // Metrics - Metrics provided by the detector + Metrics *[]DiagnosticMetricSet `json:"metrics,omitempty"` + // AbnormalTimePeriods - List of Correlated events found by the detector + AbnormalTimePeriods *[]DetectorAbnormalTimePeriod `json:"abnormalTimePeriods,omitempty"` + // Data - Additional Data that detector wants to send. + Data *[][]NameValuePair `json:"data,omitempty"` + // ResponseMetaData - Meta Data + ResponseMetaData *ResponseMetaData `json:"responseMetaData,omitempty"` +} + +// DiagnosticMetricSample class representing Diagnostic Metric +type DiagnosticMetricSample struct { + // Timestamp - Time at which metric is measured + Timestamp *date.Time `json:"timestamp,omitempty"` + // RoleInstance - Role Instance. Null if this counter is not per instance + // This is returned and should be whichever instance name we desire to be returned + // i.e. CPU and Memory return RDWORKERNAME (LargeDed..._IN_0) + // where RDWORKERNAME is Machine name below and RoleInstance name in parenthesis + RoleInstance *string `json:"roleInstance,omitempty"` + // Total - Total value of the metric. If multiple measurements are made this will have sum of all. + Total *float64 `json:"total,omitempty"` + // Maximum - Maximum of the metric sampled during the time period + Maximum *float64 `json:"maximum,omitempty"` + // Minimum - Minimum of the metric sampled during the time period + Minimum *float64 `json:"minimum,omitempty"` + // IsAggregated - Whether the values are aggregates across all workers or not + IsAggregated *bool `json:"isAggregated,omitempty"` +} + +// DiagnosticMetricSet class representing Diagnostic Metric information +type DiagnosticMetricSet struct { + // Name - Name of the metric + Name *string `json:"name,omitempty"` + // Unit - Metric's unit + Unit *string `json:"unit,omitempty"` + // StartTime - Start time of the period + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - End time of the period + EndTime *date.Time `json:"endTime,omitempty"` + // TimeGrain - Presented time grain. Supported grains at the moment are PT1M, PT1H, P1D + TimeGrain *string `json:"timeGrain,omitempty"` + // Values - Collection of metric values for the selected period based on the {Microsoft.Web.Hosting.Administration.DiagnosticMetricSet.TimeGrain} + Values *[]DiagnosticMetricSample `json:"values,omitempty"` +} + +// Dimension dimension of a resource metric. For e.g. instance specific HTTP requests for a web app, +// where instance name is dimension of the metric HTTP request +type Dimension struct { + Name *string `json:"name,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + InternalName *string `json:"internalName,omitempty"` + ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` +} + +// Domain information about a domain. +type Domain struct { + autorest.Response `json:"-"` + // DomainProperties - Domain resource specific properties + *DomainProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Location - Resource Location. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Domain. +func (d Domain) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.DomainProperties != nil { + objectMap["properties"] = d.DomainProperties + } + if d.Kind != nil { + objectMap["kind"] = d.Kind + } + if d.Location != nil { + objectMap["location"] = d.Location + } + if d.Tags != nil { + objectMap["tags"] = d.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Domain struct. +func (d *Domain) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var domainProperties DomainProperties + err = json.Unmarshal(*v, &domainProperties) + if err != nil { + return err + } + d.DomainProperties = &domainProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + d.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + d.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + d.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + d.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + d.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + d.Tags = tags + } + } + } + + return nil +} + +// DomainAvailabilityCheckResult domain availability check result. +type DomainAvailabilityCheckResult struct { + autorest.Response `json:"-"` + // Name - Name of the domain. + Name *string `json:"name,omitempty"` + // Available - true if domain can be purchased using CreateDomain API; otherwise, false. + Available *bool `json:"available,omitempty"` + // DomainType - Valid values are Regular domain: Azure will charge the full price of domain registration, SoftDeleted: Purchasing this domain will simply restore it and this operation will not cost anything. Possible values include: 'DomainTypeRegular', 'DomainTypeSoftDeleted' + DomainType DomainType `json:"domainType,omitempty"` +} + +// DomainCollection collection of domains. +type DomainCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]Domain `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DomainCollection. +func (dc DomainCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dc.Value != nil { + objectMap["value"] = dc.Value + } + return json.Marshal(objectMap) +} + +// DomainCollectionIterator provides access to a complete listing of Domain values. +type DomainCollectionIterator struct { + i int + page DomainCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DomainCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DomainCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DomainCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DomainCollectionIterator) Response() DomainCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DomainCollectionIterator) Value() Domain { + if !iter.page.NotDone() { + return Domain{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DomainCollectionIterator type. +func NewDomainCollectionIterator(page DomainCollectionPage) DomainCollectionIterator { + return DomainCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dc DomainCollection) IsEmpty() bool { + return dc.Value == nil || len(*dc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dc DomainCollection) hasNextLink() bool { + return dc.NextLink != nil && len(*dc.NextLink) != 0 +} + +// domainCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dc DomainCollection) domainCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !dc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dc.NextLink))) +} + +// DomainCollectionPage contains a page of Domain values. +type DomainCollectionPage struct { + fn func(context.Context, DomainCollection) (DomainCollection, error) + dc DomainCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DomainCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dc) + if err != nil { + return err + } + page.dc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DomainCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DomainCollectionPage) NotDone() bool { + return !page.dc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DomainCollectionPage) Response() DomainCollection { + return page.dc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DomainCollectionPage) Values() []Domain { + if page.dc.IsEmpty() { + return nil + } + return *page.dc.Value +} + +// Creates a new instance of the DomainCollectionPage type. +func NewDomainCollectionPage(cur DomainCollection, getNextPage func(context.Context, DomainCollection) (DomainCollection, error)) DomainCollectionPage { + return DomainCollectionPage{ + fn: getNextPage, + dc: cur, + } +} + +// DomainControlCenterSsoRequest single sign-on request information for domain management. +type DomainControlCenterSsoRequest struct { + autorest.Response `json:"-"` + // URL - READ-ONLY; URL where the single sign-on request is to be made. + URL *string `json:"url,omitempty"` + // PostParameterKey - READ-ONLY; Post parameter key. + PostParameterKey *string `json:"postParameterKey,omitempty"` + // PostParameterValue - READ-ONLY; Post parameter value. Client should use 'application/x-www-form-urlencoded' encoding for this value. + PostParameterValue *string `json:"postParameterValue,omitempty"` +} + +// MarshalJSON is the custom marshaler for DomainControlCenterSsoRequest. +func (dccsr DomainControlCenterSsoRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DomainOwnershipIdentifier domain ownership Identifier. +type DomainOwnershipIdentifier struct { + autorest.Response `json:"-"` + // DomainOwnershipIdentifierProperties - DomainOwnershipIdentifier resource specific properties + *DomainOwnershipIdentifierProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DomainOwnershipIdentifier. +func (doi DomainOwnershipIdentifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if doi.DomainOwnershipIdentifierProperties != nil { + objectMap["properties"] = doi.DomainOwnershipIdentifierProperties + } + if doi.Kind != nil { + objectMap["kind"] = doi.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DomainOwnershipIdentifier struct. +func (doi *DomainOwnershipIdentifier) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var domainOwnershipIdentifierProperties DomainOwnershipIdentifierProperties + err = json.Unmarshal(*v, &domainOwnershipIdentifierProperties) + if err != nil { + return err + } + doi.DomainOwnershipIdentifierProperties = &domainOwnershipIdentifierProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + doi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + doi.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + doi.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + doi.Type = &typeVar + } + } + } + + return nil +} + +// DomainOwnershipIdentifierCollection collection of domain ownership identifiers. +type DomainOwnershipIdentifierCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]DomainOwnershipIdentifier `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DomainOwnershipIdentifierCollection. +func (doic DomainOwnershipIdentifierCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if doic.Value != nil { + objectMap["value"] = doic.Value + } + return json.Marshal(objectMap) +} + +// DomainOwnershipIdentifierCollectionIterator provides access to a complete listing of +// DomainOwnershipIdentifier values. +type DomainOwnershipIdentifierCollectionIterator struct { + i int + page DomainOwnershipIdentifierCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DomainOwnershipIdentifierCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainOwnershipIdentifierCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DomainOwnershipIdentifierCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DomainOwnershipIdentifierCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DomainOwnershipIdentifierCollectionIterator) Response() DomainOwnershipIdentifierCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DomainOwnershipIdentifierCollectionIterator) Value() DomainOwnershipIdentifier { + if !iter.page.NotDone() { + return DomainOwnershipIdentifier{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DomainOwnershipIdentifierCollectionIterator type. +func NewDomainOwnershipIdentifierCollectionIterator(page DomainOwnershipIdentifierCollectionPage) DomainOwnershipIdentifierCollectionIterator { + return DomainOwnershipIdentifierCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (doic DomainOwnershipIdentifierCollection) IsEmpty() bool { + return doic.Value == nil || len(*doic.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (doic DomainOwnershipIdentifierCollection) hasNextLink() bool { + return doic.NextLink != nil && len(*doic.NextLink) != 0 +} + +// domainOwnershipIdentifierCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (doic DomainOwnershipIdentifierCollection) domainOwnershipIdentifierCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !doic.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(doic.NextLink))) +} + +// DomainOwnershipIdentifierCollectionPage contains a page of DomainOwnershipIdentifier values. +type DomainOwnershipIdentifierCollectionPage struct { + fn func(context.Context, DomainOwnershipIdentifierCollection) (DomainOwnershipIdentifierCollection, error) + doic DomainOwnershipIdentifierCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DomainOwnershipIdentifierCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainOwnershipIdentifierCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.doic) + if err != nil { + return err + } + page.doic = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DomainOwnershipIdentifierCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DomainOwnershipIdentifierCollectionPage) NotDone() bool { + return !page.doic.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DomainOwnershipIdentifierCollectionPage) Response() DomainOwnershipIdentifierCollection { + return page.doic +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DomainOwnershipIdentifierCollectionPage) Values() []DomainOwnershipIdentifier { + if page.doic.IsEmpty() { + return nil + } + return *page.doic.Value +} + +// Creates a new instance of the DomainOwnershipIdentifierCollectionPage type. +func NewDomainOwnershipIdentifierCollectionPage(cur DomainOwnershipIdentifierCollection, getNextPage func(context.Context, DomainOwnershipIdentifierCollection) (DomainOwnershipIdentifierCollection, error)) DomainOwnershipIdentifierCollectionPage { + return DomainOwnershipIdentifierCollectionPage{ + fn: getNextPage, + doic: cur, + } +} + +// DomainOwnershipIdentifierProperties domainOwnershipIdentifier resource specific properties +type DomainOwnershipIdentifierProperties struct { + // OwnershipID - Ownership Id. + OwnershipID *string `json:"ownershipId,omitempty"` +} + +// DomainPatchResource ARM resource for a domain. +type DomainPatchResource struct { + // DomainPatchResourceProperties - DomainPatchResource resource specific properties + *DomainPatchResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DomainPatchResource. +func (dpr DomainPatchResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dpr.DomainPatchResourceProperties != nil { + objectMap["properties"] = dpr.DomainPatchResourceProperties + } + if dpr.Kind != nil { + objectMap["kind"] = dpr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DomainPatchResource struct. +func (dpr *DomainPatchResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var domainPatchResourceProperties DomainPatchResourceProperties + err = json.Unmarshal(*v, &domainPatchResourceProperties) + if err != nil { + return err + } + dpr.DomainPatchResourceProperties = &domainPatchResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dpr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dpr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + dpr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dpr.Type = &typeVar + } + } + } + + return nil +} + +// DomainPatchResourceProperties domainPatchResource resource specific properties +type DomainPatchResourceProperties struct { + // ContactAdmin - Administrative contact. + ContactAdmin *Contact `json:"contactAdmin,omitempty"` + // ContactBilling - Billing contact. + ContactBilling *Contact `json:"contactBilling,omitempty"` + // ContactRegistrant - Registrant contact. + ContactRegistrant *Contact `json:"contactRegistrant,omitempty"` + // ContactTech - Technical contact. + ContactTech *Contact `json:"contactTech,omitempty"` + // RegistrationStatus - READ-ONLY; Domain registration status. Possible values include: 'DomainStatusActive', 'DomainStatusAwaiting', 'DomainStatusCancelled', 'DomainStatusConfiscated', 'DomainStatusDisabled', 'DomainStatusExcluded', 'DomainStatusExpired', 'DomainStatusFailed', 'DomainStatusHeld', 'DomainStatusLocked', 'DomainStatusParked', 'DomainStatusPending', 'DomainStatusReserved', 'DomainStatusReverted', 'DomainStatusSuspended', 'DomainStatusTransferred', 'DomainStatusUnknown', 'DomainStatusUnlocked', 'DomainStatusUnparked', 'DomainStatusUpdated', 'DomainStatusJSONConverterFailed' + RegistrationStatus DomainStatus `json:"registrationStatus,omitempty"` + // ProvisioningState - READ-ONLY; Domain provisioning state. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateInProgress', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // NameServers - READ-ONLY; Name servers. + NameServers *[]string `json:"nameServers,omitempty"` + // Privacy - true if domain privacy is enabled for this domain; otherwise, false. + Privacy *bool `json:"privacy,omitempty"` + // CreatedTime - READ-ONLY; Domain creation timestamp. + CreatedTime *date.Time `json:"createdTime,omitempty"` + // ExpirationTime - READ-ONLY; Domain expiration timestamp. + ExpirationTime *date.Time `json:"expirationTime,omitempty"` + // LastRenewedTime - READ-ONLY; Timestamp when the domain was renewed last time. + LastRenewedTime *date.Time `json:"lastRenewedTime,omitempty"` + // AutoRenew - true if the domain should be automatically renewed; otherwise, false. + AutoRenew *bool `json:"autoRenew,omitempty"` + // ReadyForDNSRecordManagement - READ-ONLY; true if Azure can assign this domain to App Service apps; otherwise, false. This value will be true if domain registration status is active and + // it is hosted on name servers Azure has programmatic access to. + ReadyForDNSRecordManagement *bool `json:"readyForDnsRecordManagement,omitempty"` + // ManagedHostNames - READ-ONLY; All hostnames derived from the domain and assigned to Azure resources. + ManagedHostNames *[]HostName `json:"managedHostNames,omitempty"` + // Consent - Legal agreement consent. + Consent *DomainPurchaseConsent `json:"consent,omitempty"` + // DomainNotRenewableReasons - READ-ONLY; Reasons why domain is not renewable. + DomainNotRenewableReasons *[]string `json:"domainNotRenewableReasons,omitempty"` + // DNSType - Current DNS type. Possible values include: 'DNSTypeAzureDNS', 'DNSTypeDefaultDomainRegistrarDNS' + DNSType DNSType `json:"dnsType,omitempty"` + // DNSZoneID - Azure DNS Zone to use + DNSZoneID *string `json:"dnsZoneId,omitempty"` + // TargetDNSType - Target DNS type (would be used for migration). Possible values include: 'DNSTypeAzureDNS', 'DNSTypeDefaultDomainRegistrarDNS' + TargetDNSType DNSType `json:"targetDnsType,omitempty"` + AuthCode *string `json:"authCode,omitempty"` +} + +// MarshalJSON is the custom marshaler for DomainPatchResourceProperties. +func (dpr DomainPatchResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dpr.ContactAdmin != nil { + objectMap["contactAdmin"] = dpr.ContactAdmin + } + if dpr.ContactBilling != nil { + objectMap["contactBilling"] = dpr.ContactBilling + } + if dpr.ContactRegistrant != nil { + objectMap["contactRegistrant"] = dpr.ContactRegistrant + } + if dpr.ContactTech != nil { + objectMap["contactTech"] = dpr.ContactTech + } + if dpr.Privacy != nil { + objectMap["privacy"] = dpr.Privacy + } + if dpr.AutoRenew != nil { + objectMap["autoRenew"] = dpr.AutoRenew + } + if dpr.Consent != nil { + objectMap["consent"] = dpr.Consent + } + if dpr.DNSType != "" { + objectMap["dnsType"] = dpr.DNSType + } + if dpr.DNSZoneID != nil { + objectMap["dnsZoneId"] = dpr.DNSZoneID + } + if dpr.TargetDNSType != "" { + objectMap["targetDnsType"] = dpr.TargetDNSType + } + if dpr.AuthCode != nil { + objectMap["authCode"] = dpr.AuthCode + } + return json.Marshal(objectMap) +} + +// DomainProperties domain resource specific properties +type DomainProperties struct { + // ContactAdmin - Administrative contact. + ContactAdmin *Contact `json:"contactAdmin,omitempty"` + // ContactBilling - Billing contact. + ContactBilling *Contact `json:"contactBilling,omitempty"` + // ContactRegistrant - Registrant contact. + ContactRegistrant *Contact `json:"contactRegistrant,omitempty"` + // ContactTech - Technical contact. + ContactTech *Contact `json:"contactTech,omitempty"` + // RegistrationStatus - READ-ONLY; Domain registration status. Possible values include: 'DomainStatusActive', 'DomainStatusAwaiting', 'DomainStatusCancelled', 'DomainStatusConfiscated', 'DomainStatusDisabled', 'DomainStatusExcluded', 'DomainStatusExpired', 'DomainStatusFailed', 'DomainStatusHeld', 'DomainStatusLocked', 'DomainStatusParked', 'DomainStatusPending', 'DomainStatusReserved', 'DomainStatusReverted', 'DomainStatusSuspended', 'DomainStatusTransferred', 'DomainStatusUnknown', 'DomainStatusUnlocked', 'DomainStatusUnparked', 'DomainStatusUpdated', 'DomainStatusJSONConverterFailed' + RegistrationStatus DomainStatus `json:"registrationStatus,omitempty"` + // ProvisioningState - READ-ONLY; Domain provisioning state. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateInProgress', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // NameServers - READ-ONLY; Name servers. + NameServers *[]string `json:"nameServers,omitempty"` + // Privacy - true if domain privacy is enabled for this domain; otherwise, false. + Privacy *bool `json:"privacy,omitempty"` + // CreatedTime - READ-ONLY; Domain creation timestamp. + CreatedTime *date.Time `json:"createdTime,omitempty"` + // ExpirationTime - READ-ONLY; Domain expiration timestamp. + ExpirationTime *date.Time `json:"expirationTime,omitempty"` + // LastRenewedTime - READ-ONLY; Timestamp when the domain was renewed last time. + LastRenewedTime *date.Time `json:"lastRenewedTime,omitempty"` + // AutoRenew - true if the domain should be automatically renewed; otherwise, false. + AutoRenew *bool `json:"autoRenew,omitempty"` + // ReadyForDNSRecordManagement - READ-ONLY; true if Azure can assign this domain to App Service apps; otherwise, false. This value will be true if domain registration status is active and + // it is hosted on name servers Azure has programmatic access to. + ReadyForDNSRecordManagement *bool `json:"readyForDnsRecordManagement,omitempty"` + // ManagedHostNames - READ-ONLY; All hostnames derived from the domain and assigned to Azure resources. + ManagedHostNames *[]HostName `json:"managedHostNames,omitempty"` + // Consent - Legal agreement consent. + Consent *DomainPurchaseConsent `json:"consent,omitempty"` + // DomainNotRenewableReasons - READ-ONLY; Reasons why domain is not renewable. + DomainNotRenewableReasons *[]string `json:"domainNotRenewableReasons,omitempty"` + // DNSType - Current DNS type. Possible values include: 'DNSTypeAzureDNS', 'DNSTypeDefaultDomainRegistrarDNS' + DNSType DNSType `json:"dnsType,omitempty"` + // DNSZoneID - Azure DNS Zone to use + DNSZoneID *string `json:"dnsZoneId,omitempty"` + // TargetDNSType - Target DNS type (would be used for migration). Possible values include: 'DNSTypeAzureDNS', 'DNSTypeDefaultDomainRegistrarDNS' + TargetDNSType DNSType `json:"targetDnsType,omitempty"` + AuthCode *string `json:"authCode,omitempty"` +} + +// MarshalJSON is the custom marshaler for DomainProperties. +func (d DomainProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.ContactAdmin != nil { + objectMap["contactAdmin"] = d.ContactAdmin + } + if d.ContactBilling != nil { + objectMap["contactBilling"] = d.ContactBilling + } + if d.ContactRegistrant != nil { + objectMap["contactRegistrant"] = d.ContactRegistrant + } + if d.ContactTech != nil { + objectMap["contactTech"] = d.ContactTech + } + if d.Privacy != nil { + objectMap["privacy"] = d.Privacy + } + if d.AutoRenew != nil { + objectMap["autoRenew"] = d.AutoRenew + } + if d.Consent != nil { + objectMap["consent"] = d.Consent + } + if d.DNSType != "" { + objectMap["dnsType"] = d.DNSType + } + if d.DNSZoneID != nil { + objectMap["dnsZoneId"] = d.DNSZoneID + } + if d.TargetDNSType != "" { + objectMap["targetDnsType"] = d.TargetDNSType + } + if d.AuthCode != nil { + objectMap["authCode"] = d.AuthCode + } + return json.Marshal(objectMap) +} + +// DomainPurchaseConsent domain purchase consent object, representing acceptance of applicable legal +// agreements. +type DomainPurchaseConsent struct { + // AgreementKeys - List of applicable legal agreement keys. This list can be retrieved using ListLegalAgreements API under TopLevelDomain resource. + AgreementKeys *[]string `json:"agreementKeys,omitempty"` + // AgreedBy - Client IP address. + AgreedBy *string `json:"agreedBy,omitempty"` + // AgreedAt - Timestamp when the agreements were accepted. + AgreedAt *date.Time `json:"agreedAt,omitempty"` +} + +// DomainRecommendationSearchParameters domain recommendation search parameters. +type DomainRecommendationSearchParameters struct { + // Keywords - Keywords to be used for generating domain recommendations. + Keywords *string `json:"keywords,omitempty"` + // MaxDomainRecommendations - Maximum number of recommendations. + MaxDomainRecommendations *int32 `json:"maxDomainRecommendations,omitempty"` +} + +// DomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DomainsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DomainsClient) (Domain, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DomainsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DomainsCreateOrUpdateFuture.Result. +func (future *DomainsCreateOrUpdateFuture) result(client DomainsClient) (d Domain, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + d.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.DomainsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.CreateOrUpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return +} + +// EnabledConfig enabled configuration. +type EnabledConfig struct { + // Enabled - True if configuration is enabled, false if it is disabled and null if configuration is not set. + Enabled *bool `json:"enabled,omitempty"` +} + +// EndpointDependency a domain name that a service is reached at, including details of the current +// connection status. +type EndpointDependency struct { + // DomainName - The domain name of the dependency. + DomainName *string `json:"domainName,omitempty"` + // EndpointDetails - The IP Addresses and Ports used when connecting to DomainName. + EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` +} + +// EndpointDetail current TCP connectivity information from the App Service Environment to a single +// endpoint. +type EndpointDetail struct { + // IPAddress - An IP Address that Domain Name currently resolves to. + IPAddress *string `json:"ipAddress,omitempty"` + // Port - The port an endpoint is connected to. + Port *int32 `json:"port,omitempty"` + // Latency - The time in milliseconds it takes for a TCP connection to be created from the App Service Environment to this IpAddress at this Port. + Latency *float64 `json:"latency,omitempty"` + // IsAccessible - Whether it is possible to create a TCP connection from the App Service Environment to this IpAddress at this Port. + IsAccessible *bool `json:"isAccessible,omitempty"` +} + +// EnvironmentVar container App container environment variable. +type EnvironmentVar struct { + // Name - Environment variable name. + Name *string `json:"name,omitempty"` + // Value - Non-secret environment variable value. + Value *string `json:"value,omitempty"` + // SecretRef - Name of the Container App secret from which to pull the environment variable value. + SecretRef *string `json:"secretRef,omitempty"` +} + +// ErrorEntity body of the error response returned from the API. +type ErrorEntity struct { + // ExtendedCode - Type of error. + ExtendedCode *string `json:"extendedCode,omitempty"` + // MessageTemplate - Message template. + MessageTemplate *string `json:"messageTemplate,omitempty"` + // Parameters - Parameters for the template. + Parameters *[]string `json:"parameters,omitempty"` + // InnerErrors - Inner errors. + InnerErrors *[]ErrorEntity `json:"innerErrors,omitempty"` + // Details - Error Details. + Details *[]ErrorEntity `json:"details,omitempty"` + // Target - The error target. + Target *string `json:"target,omitempty"` + // Code - Basic error code. + Code *string `json:"code,omitempty"` + // Message - Any details of the error. + Message *string `json:"message,omitempty"` +} + +// Experiments routing rules in production experiments. +type Experiments struct { + // RampUpRules - List of ramp-up rules. + RampUpRules *[]RampUpRule `json:"rampUpRules,omitempty"` +} + +// ExtendedLocation extended Location. +type ExtendedLocation struct { + // Name - Name of extended location. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of extended location. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtendedLocation. +func (el ExtendedLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if el.Name != nil { + objectMap["name"] = el.Name + } + return json.Marshal(objectMap) +} + +// Facebook the configuration settings of the Facebook provider. +type Facebook struct { + // Enabled - false if the Facebook provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + // Registration - The configuration settings of the app registration for the Facebook provider. + Registration *AppRegistration `json:"registration,omitempty"` + // GraphAPIVersion - The version of the Facebook api to be used while logging in. + GraphAPIVersion *string `json:"graphApiVersion,omitempty"` + // Login - The configuration settings of the login flow. + Login *LoginScopes `json:"login,omitempty"` +} + +// FileSystemApplicationLogsConfig application logs to file system configuration. +type FileSystemApplicationLogsConfig struct { + // Level - Log level. Possible values include: 'LogLevelOff', 'LogLevelVerbose', 'LogLevelInformation', 'LogLevelWarning', 'LogLevelError' + Level LogLevel `json:"level,omitempty"` +} + +// FileSystemHTTPLogsConfig http logs to file system configuration. +type FileSystemHTTPLogsConfig struct { + // RetentionInMb - Maximum size in megabytes that http log files can use. + // When reached old log files will be removed to make space for new ones. + // Value can range between 25 and 100. + RetentionInMb *int32 `json:"retentionInMb,omitempty"` + // RetentionInDays - Retention in days. + // Remove files older than X days. + // 0 or lower means no retention. + RetentionInDays *int32 `json:"retentionInDays,omitempty"` + // Enabled - True if configuration is enabled, false if it is disabled and null if configuration is not set. + Enabled *bool `json:"enabled,omitempty"` +} + +// FileSystemTokenStore the configuration settings of the storage of the tokens if a file system is used. +type FileSystemTokenStore struct { + // Directory - The directory in which the tokens will be stored. + Directory *string `json:"directory,omitempty"` +} + +// ForwardProxy the configuration settings of a forward proxy used to make the requests. +type ForwardProxy struct { + // Convention - The convention used to determine the url of the request made. Possible values include: 'ForwardProxyConventionNoProxy', 'ForwardProxyConventionStandard', 'ForwardProxyConventionCustom' + Convention ForwardProxyConvention `json:"convention,omitempty"` + // CustomHostHeaderName - The name of the header containing the host of the request. + CustomHostHeaderName *string `json:"customHostHeaderName,omitempty"` + // CustomProtoHeaderName - The name of the header containing the scheme of the request. + CustomProtoHeaderName *string `json:"customProtoHeaderName,omitempty"` +} + +// FrontEndConfiguration ... +type FrontEndConfiguration struct { + // Kind - Possible values include: 'FrontEndServiceTypeNodePort', 'FrontEndServiceTypeLoadBalancer' + Kind FrontEndServiceType `json:"kind,omitempty"` +} + +// FunctionAppMajorVersion function App stack major version. +type FunctionAppMajorVersion struct { + // DisplayText - READ-ONLY; Function App stack major version (display only). + DisplayText *string `json:"displayText,omitempty"` + // Value - READ-ONLY; Function App stack major version name. + Value *string `json:"value,omitempty"` + // MinorVersions - READ-ONLY; Minor versions associated with the major version. + MinorVersions *[]FunctionAppMinorVersion `json:"minorVersions,omitempty"` +} + +// MarshalJSON is the custom marshaler for FunctionAppMajorVersion. +func (famv FunctionAppMajorVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FunctionAppMinorVersion function App stack minor version. +type FunctionAppMinorVersion struct { + // DisplayText - READ-ONLY; Function App stack (display only). + DisplayText *string `json:"displayText,omitempty"` + // Value - READ-ONLY; Function App stack name. + Value *string `json:"value,omitempty"` + // StackSettings - READ-ONLY; Settings associated with the minor version. + StackSettings *FunctionAppRuntimes `json:"stackSettings,omitempty"` +} + +// MarshalJSON is the custom marshaler for FunctionAppMinorVersion. +func (famv FunctionAppMinorVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FunctionAppRuntimes function App stack runtimes. +type FunctionAppRuntimes struct { + // LinuxRuntimeSettings - READ-ONLY; Linux-specific settings associated with the minor version. + LinuxRuntimeSettings *FunctionAppRuntimeSettings `json:"linuxRuntimeSettings,omitempty"` + // WindowsRuntimeSettings - READ-ONLY; Windows-specific settings associated with the minor version. + WindowsRuntimeSettings *FunctionAppRuntimeSettings `json:"windowsRuntimeSettings,omitempty"` +} + +// MarshalJSON is the custom marshaler for FunctionAppRuntimes. +func (far FunctionAppRuntimes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FunctionAppRuntimeSettings function App runtime settings. +type FunctionAppRuntimeSettings struct { + // RuntimeVersion - READ-ONLY; Function App stack minor version (runtime only). + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + // RemoteDebuggingSupported - READ-ONLY; true if remote debugging is supported for the stack; otherwise, false. + RemoteDebuggingSupported *bool `json:"remoteDebuggingSupported,omitempty"` + // AppInsightsSettings - READ-ONLY; Application Insights settings associated with the minor version. + AppInsightsSettings *AppInsightsWebAppStackSettings `json:"appInsightsSettings,omitempty"` + // GitHubActionSettings - READ-ONLY; GitHub Actions settings associated with the minor version. + GitHubActionSettings *GitHubActionWebAppStackSettings `json:"gitHubActionSettings,omitempty"` + // AppSettingsDictionary - READ-ONLY; Application settings associated with the minor version. + AppSettingsDictionary map[string]*string `json:"appSettingsDictionary"` + // SiteConfigPropertiesDictionary - READ-ONLY; Configuration settings associated with the minor version. + SiteConfigPropertiesDictionary *SiteConfigPropertiesDictionary `json:"siteConfigPropertiesDictionary,omitempty"` + // SupportedFunctionsExtensionVersions - READ-ONLY; List of supported Functions extension versions. + SupportedFunctionsExtensionVersions *[]string `json:"supportedFunctionsExtensionVersions,omitempty"` + // IsPreview - READ-ONLY; true if the stack is in preview; otherwise, false. + IsPreview *bool `json:"isPreview,omitempty"` + // IsDeprecated - READ-ONLY; true if the stack is deprecated; otherwise, false. + IsDeprecated *bool `json:"isDeprecated,omitempty"` + // IsHidden - READ-ONLY; true if the stack should be hidden; otherwise, false. + IsHidden *bool `json:"isHidden,omitempty"` + // EndOfLifeDate - READ-ONLY; End-of-life date for the minor version. + EndOfLifeDate *date.Time `json:"endOfLifeDate,omitempty"` + // IsAutoUpdate - READ-ONLY; true if the stack version is auto-updated; otherwise, false. + IsAutoUpdate *bool `json:"isAutoUpdate,omitempty"` + // IsEarlyAccess - READ-ONLY; true if the minor version is early-access; otherwise, false. + IsEarlyAccess *bool `json:"isEarlyAccess,omitempty"` + // IsDefault - READ-ONLY; true if the minor version the default; otherwise, false. + IsDefault *bool `json:"isDefault,omitempty"` +} + +// MarshalJSON is the custom marshaler for FunctionAppRuntimeSettings. +func (fars FunctionAppRuntimeSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FunctionAppStack function App Stack. +type FunctionAppStack struct { + // Location - READ-ONLY; Function App stack location. + Location *string `json:"location,omitempty"` + // FunctionAppStackProperties - FunctionAppStack resource specific properties + *FunctionAppStackProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for FunctionAppStack. +func (fas FunctionAppStack) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fas.FunctionAppStackProperties != nil { + objectMap["properties"] = fas.FunctionAppStackProperties + } + if fas.Kind != nil { + objectMap["kind"] = fas.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FunctionAppStack struct. +func (fas *FunctionAppStack) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + fas.Location = &location + } + case "properties": + if v != nil { + var functionAppStackProperties FunctionAppStackProperties + err = json.Unmarshal(*v, &functionAppStackProperties) + if err != nil { + return err + } + fas.FunctionAppStackProperties = &functionAppStackProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fas.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fas.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + fas.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fas.Type = &typeVar + } + } + } + + return nil +} + +// FunctionAppStackCollection collection of Function app Stacks +type FunctionAppStackCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]FunctionAppStack `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for FunctionAppStackCollection. +func (fasc FunctionAppStackCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fasc.Value != nil { + objectMap["value"] = fasc.Value + } + return json.Marshal(objectMap) +} + +// FunctionAppStackCollectionIterator provides access to a complete listing of FunctionAppStack values. +type FunctionAppStackCollectionIterator struct { + i int + page FunctionAppStackCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *FunctionAppStackCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FunctionAppStackCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *FunctionAppStackCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FunctionAppStackCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter FunctionAppStackCollectionIterator) Response() FunctionAppStackCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter FunctionAppStackCollectionIterator) Value() FunctionAppStack { + if !iter.page.NotDone() { + return FunctionAppStack{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FunctionAppStackCollectionIterator type. +func NewFunctionAppStackCollectionIterator(page FunctionAppStackCollectionPage) FunctionAppStackCollectionIterator { + return FunctionAppStackCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (fasc FunctionAppStackCollection) IsEmpty() bool { + return fasc.Value == nil || len(*fasc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (fasc FunctionAppStackCollection) hasNextLink() bool { + return fasc.NextLink != nil && len(*fasc.NextLink) != 0 +} + +// functionAppStackCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (fasc FunctionAppStackCollection) functionAppStackCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !fasc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(fasc.NextLink))) +} + +// FunctionAppStackCollectionPage contains a page of FunctionAppStack values. +type FunctionAppStackCollectionPage struct { + fn func(context.Context, FunctionAppStackCollection) (FunctionAppStackCollection, error) + fasc FunctionAppStackCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *FunctionAppStackCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FunctionAppStackCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.fasc) + if err != nil { + return err + } + page.fasc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *FunctionAppStackCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FunctionAppStackCollectionPage) NotDone() bool { + return !page.fasc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FunctionAppStackCollectionPage) Response() FunctionAppStackCollection { + return page.fasc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FunctionAppStackCollectionPage) Values() []FunctionAppStack { + if page.fasc.IsEmpty() { + return nil + } + return *page.fasc.Value +} + +// Creates a new instance of the FunctionAppStackCollectionPage type. +func NewFunctionAppStackCollectionPage(cur FunctionAppStackCollection, getNextPage func(context.Context, FunctionAppStackCollection) (FunctionAppStackCollection, error)) FunctionAppStackCollectionPage { + return FunctionAppStackCollectionPage{ + fn: getNextPage, + fasc: cur, + } +} + +// FunctionAppStackProperties functionAppStack resource specific properties +type FunctionAppStackProperties struct { + // DisplayText - READ-ONLY; Function App stack (display only). + DisplayText *string `json:"displayText,omitempty"` + // Value - READ-ONLY; Function App stack name. + Value *string `json:"value,omitempty"` + // MajorVersions - READ-ONLY; List of major versions available. + MajorVersions *[]FunctionAppMajorVersion `json:"majorVersions,omitempty"` + // PreferredOs - READ-ONLY; Function App stack preferred OS. Possible values include: 'StackPreferredOsWindows', 'StackPreferredOsLinux' + PreferredOs StackPreferredOs `json:"preferredOs,omitempty"` +} + +// MarshalJSON is the custom marshaler for FunctionAppStackProperties. +func (fas FunctionAppStackProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FunctionEnvelope function information. +type FunctionEnvelope struct { + autorest.Response `json:"-"` + // FunctionEnvelopeProperties - FunctionEnvelope resource specific properties + *FunctionEnvelopeProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for FunctionEnvelope. +func (fe FunctionEnvelope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fe.FunctionEnvelopeProperties != nil { + objectMap["properties"] = fe.FunctionEnvelopeProperties + } + if fe.Kind != nil { + objectMap["kind"] = fe.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FunctionEnvelope struct. +func (fe *FunctionEnvelope) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var functionEnvelopeProperties FunctionEnvelopeProperties + err = json.Unmarshal(*v, &functionEnvelopeProperties) + if err != nil { + return err + } + fe.FunctionEnvelopeProperties = &functionEnvelopeProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fe.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fe.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + fe.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fe.Type = &typeVar + } + } + } + + return nil +} + +// FunctionEnvelopeCollection collection of Kudu function information elements. +type FunctionEnvelopeCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]FunctionEnvelope `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for FunctionEnvelopeCollection. +func (fec FunctionEnvelopeCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fec.Value != nil { + objectMap["value"] = fec.Value + } + return json.Marshal(objectMap) +} + +// FunctionEnvelopeCollectionIterator provides access to a complete listing of FunctionEnvelope values. +type FunctionEnvelopeCollectionIterator struct { + i int + page FunctionEnvelopeCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *FunctionEnvelopeCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FunctionEnvelopeCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *FunctionEnvelopeCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FunctionEnvelopeCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter FunctionEnvelopeCollectionIterator) Response() FunctionEnvelopeCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter FunctionEnvelopeCollectionIterator) Value() FunctionEnvelope { + if !iter.page.NotDone() { + return FunctionEnvelope{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FunctionEnvelopeCollectionIterator type. +func NewFunctionEnvelopeCollectionIterator(page FunctionEnvelopeCollectionPage) FunctionEnvelopeCollectionIterator { + return FunctionEnvelopeCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (fec FunctionEnvelopeCollection) IsEmpty() bool { + return fec.Value == nil || len(*fec.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (fec FunctionEnvelopeCollection) hasNextLink() bool { + return fec.NextLink != nil && len(*fec.NextLink) != 0 +} + +// functionEnvelopeCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (fec FunctionEnvelopeCollection) functionEnvelopeCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !fec.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(fec.NextLink))) +} + +// FunctionEnvelopeCollectionPage contains a page of FunctionEnvelope values. +type FunctionEnvelopeCollectionPage struct { + fn func(context.Context, FunctionEnvelopeCollection) (FunctionEnvelopeCollection, error) + fec FunctionEnvelopeCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *FunctionEnvelopeCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FunctionEnvelopeCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.fec) + if err != nil { + return err + } + page.fec = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *FunctionEnvelopeCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FunctionEnvelopeCollectionPage) NotDone() bool { + return !page.fec.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FunctionEnvelopeCollectionPage) Response() FunctionEnvelopeCollection { + return page.fec +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FunctionEnvelopeCollectionPage) Values() []FunctionEnvelope { + if page.fec.IsEmpty() { + return nil + } + return *page.fec.Value +} + +// Creates a new instance of the FunctionEnvelopeCollectionPage type. +func NewFunctionEnvelopeCollectionPage(cur FunctionEnvelopeCollection, getNextPage func(context.Context, FunctionEnvelopeCollection) (FunctionEnvelopeCollection, error)) FunctionEnvelopeCollectionPage { + return FunctionEnvelopeCollectionPage{ + fn: getNextPage, + fec: cur, + } +} + +// FunctionEnvelopeProperties functionEnvelope resource specific properties +type FunctionEnvelopeProperties struct { + // FunctionAppID - Function App ID. + FunctionAppID *string `json:"function_app_id,omitempty"` + // ScriptRootPathHref - Script root path URI. + ScriptRootPathHref *string `json:"script_root_path_href,omitempty"` + // ScriptHref - Script URI. + ScriptHref *string `json:"script_href,omitempty"` + // ConfigHref - Config URI. + ConfigHref *string `json:"config_href,omitempty"` + // TestDataHref - Test data URI. + TestDataHref *string `json:"test_data_href,omitempty"` + // SecretsFileHref - Secrets file URI. + SecretsFileHref *string `json:"secrets_file_href,omitempty"` + // Href - Function URI. + Href *string `json:"href,omitempty"` + // Config - Config information. + Config interface{} `json:"config,omitempty"` + // Files - File list. + Files map[string]*string `json:"files"` + // TestData - Test data used when testing via the Azure Portal. + TestData *string `json:"test_data,omitempty"` + // InvokeURLTemplate - The invocation URL + InvokeURLTemplate *string `json:"invoke_url_template,omitempty"` + // Language - The function language + Language *string `json:"language,omitempty"` + // IsDisabled - Gets or sets a value indicating whether the function is disabled + IsDisabled *bool `json:"isDisabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for FunctionEnvelopeProperties. +func (fe FunctionEnvelopeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fe.FunctionAppID != nil { + objectMap["function_app_id"] = fe.FunctionAppID + } + if fe.ScriptRootPathHref != nil { + objectMap["script_root_path_href"] = fe.ScriptRootPathHref + } + if fe.ScriptHref != nil { + objectMap["script_href"] = fe.ScriptHref + } + if fe.ConfigHref != nil { + objectMap["config_href"] = fe.ConfigHref + } + if fe.TestDataHref != nil { + objectMap["test_data_href"] = fe.TestDataHref + } + if fe.SecretsFileHref != nil { + objectMap["secrets_file_href"] = fe.SecretsFileHref + } + if fe.Href != nil { + objectMap["href"] = fe.Href + } + if fe.Config != nil { + objectMap["config"] = fe.Config + } + if fe.Files != nil { + objectMap["files"] = fe.Files + } + if fe.TestData != nil { + objectMap["test_data"] = fe.TestData + } + if fe.InvokeURLTemplate != nil { + objectMap["invoke_url_template"] = fe.InvokeURLTemplate + } + if fe.Language != nil { + objectMap["language"] = fe.Language + } + if fe.IsDisabled != nil { + objectMap["isDisabled"] = fe.IsDisabled + } + return json.Marshal(objectMap) +} + +// FunctionSecrets function secrets. +type FunctionSecrets struct { + autorest.Response `json:"-"` + // Key - Secret key. + Key *string `json:"key,omitempty"` + // TriggerURL - Trigger URL. + TriggerURL *string `json:"trigger_url,omitempty"` +} + +// GeoRegion geographical region. +type GeoRegion struct { + // GeoRegionProperties - GeoRegion resource specific properties + *GeoRegionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for GeoRegion. +func (gr GeoRegion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gr.GeoRegionProperties != nil { + objectMap["properties"] = gr.GeoRegionProperties + } + if gr.Kind != nil { + objectMap["kind"] = gr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for GeoRegion struct. +func (gr *GeoRegion) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var geoRegionProperties GeoRegionProperties + err = json.Unmarshal(*v, &geoRegionProperties) + if err != nil { + return err + } + gr.GeoRegionProperties = &geoRegionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + gr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + gr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + gr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + gr.Type = &typeVar + } + } + } + + return nil +} + +// GeoRegionCollection collection of geographical regions. +type GeoRegionCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]GeoRegion `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for GeoRegionCollection. +func (grc GeoRegionCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if grc.Value != nil { + objectMap["value"] = grc.Value + } + return json.Marshal(objectMap) +} + +// GeoRegionCollectionIterator provides access to a complete listing of GeoRegion values. +type GeoRegionCollectionIterator struct { + i int + page GeoRegionCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *GeoRegionCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GeoRegionCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *GeoRegionCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter GeoRegionCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter GeoRegionCollectionIterator) Response() GeoRegionCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter GeoRegionCollectionIterator) Value() GeoRegion { + if !iter.page.NotDone() { + return GeoRegion{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the GeoRegionCollectionIterator type. +func NewGeoRegionCollectionIterator(page GeoRegionCollectionPage) GeoRegionCollectionIterator { + return GeoRegionCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (grc GeoRegionCollection) IsEmpty() bool { + return grc.Value == nil || len(*grc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (grc GeoRegionCollection) hasNextLink() bool { + return grc.NextLink != nil && len(*grc.NextLink) != 0 +} + +// geoRegionCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (grc GeoRegionCollection) geoRegionCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !grc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(grc.NextLink))) +} + +// GeoRegionCollectionPage contains a page of GeoRegion values. +type GeoRegionCollectionPage struct { + fn func(context.Context, GeoRegionCollection) (GeoRegionCollection, error) + grc GeoRegionCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *GeoRegionCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GeoRegionCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.grc) + if err != nil { + return err + } + page.grc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *GeoRegionCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page GeoRegionCollectionPage) NotDone() bool { + return !page.grc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page GeoRegionCollectionPage) Response() GeoRegionCollection { + return page.grc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page GeoRegionCollectionPage) Values() []GeoRegion { + if page.grc.IsEmpty() { + return nil + } + return *page.grc.Value +} + +// Creates a new instance of the GeoRegionCollectionPage type. +func NewGeoRegionCollectionPage(cur GeoRegionCollection, getNextPage func(context.Context, GeoRegionCollection) (GeoRegionCollection, error)) GeoRegionCollectionPage { + return GeoRegionCollectionPage{ + fn: getNextPage, + grc: cur, + } +} + +// GeoRegionProperties geoRegion resource specific properties +type GeoRegionProperties struct { + // Description - READ-ONLY; Region description. + Description *string `json:"description,omitempty"` + // DisplayName - READ-ONLY; Display name for region. + DisplayName *string `json:"displayName,omitempty"` + // OrgDomain - READ-ONLY; Display name for region. + OrgDomain *string `json:"orgDomain,omitempty"` +} + +// MarshalJSON is the custom marshaler for GeoRegionProperties. +func (gr GeoRegionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// GitHub the configuration settings of the GitHub provider. +type GitHub struct { + // Enabled - false if the GitHub provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + // Registration - The configuration settings of the app registration for the GitHub provider. + Registration *ClientRegistration `json:"registration,omitempty"` + // Login - The configuration settings of the login flow. + Login *LoginScopes `json:"login,omitempty"` +} + +// GitHubActionCodeConfiguration the GitHub action code configuration. +type GitHubActionCodeConfiguration struct { + // RuntimeStack - Runtime stack is used to determine the workflow file content for code base apps. + RuntimeStack *string `json:"runtimeStack,omitempty"` + // RuntimeVersion - Runtime version is used to determine what build version to set in the workflow file. + RuntimeVersion *string `json:"runtimeVersion,omitempty"` +} + +// GitHubActionConfiguration the GitHub action configuration. +type GitHubActionConfiguration struct { + // CodeConfiguration - GitHub Action code configuration. + CodeConfiguration *GitHubActionCodeConfiguration `json:"codeConfiguration,omitempty"` + // ContainerConfiguration - GitHub Action container configuration. + ContainerConfiguration *GitHubActionContainerConfiguration `json:"containerConfiguration,omitempty"` + // IsLinux - This will help determine the workflow configuration to select. + IsLinux *bool `json:"isLinux,omitempty"` + // GenerateWorkflowFile - Workflow option to determine whether the workflow file should be generated and written to the repository. + GenerateWorkflowFile *bool `json:"generateWorkflowFile,omitempty"` +} + +// GitHubActionContainerConfiguration the GitHub action container configuration. +type GitHubActionContainerConfiguration struct { + // ServerURL - The server URL for the container registry where the build will be hosted. + ServerURL *string `json:"serverUrl,omitempty"` + // ImageName - The image name for the build. + ImageName *string `json:"imageName,omitempty"` + // Username - The username used to upload the image to the container registry. + Username *string `json:"username,omitempty"` + // Password - The password used to upload the image to the container registry. + Password *string `json:"password,omitempty"` +} + +// GitHubActionWebAppStackSettings gitHub Actions Web App stack settings. +type GitHubActionWebAppStackSettings struct { + // IsSupported - READ-ONLY; true if GitHub Actions is supported for the stack; otherwise, false. + IsSupported *bool `json:"isSupported,omitempty"` + // SupportedVersion - READ-ONLY; The minor version that is supported for GitHub Actions. + SupportedVersion *string `json:"supportedVersion,omitempty"` +} + +// MarshalJSON is the custom marshaler for GitHubActionWebAppStackSettings. +func (ghawass GitHubActionWebAppStackSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// GlobalCsmSkuDescription a Global SKU Description. +type GlobalCsmSkuDescription struct { + // Name - Name of the resource SKU. + Name *string `json:"name,omitempty"` + // Tier - Service Tier of the resource SKU. + Tier *string `json:"tier,omitempty"` + // Size - Size specifier of the resource SKU. + Size *string `json:"size,omitempty"` + // Family - Family code of the resource SKU. + Family *string `json:"family,omitempty"` + // Capacity - Min, max, and default scale values of the SKU. + Capacity *SkuCapacity `json:"capacity,omitempty"` + // Locations - Locations of the SKU. + Locations *[]string `json:"locations,omitempty"` + // Capabilities - Capabilities of the SKU, e.g., is traffic manager enabled? + Capabilities *[]Capability `json:"capabilities,omitempty"` +} + +// GlobalValidation the configuration settings that determines the validation flow of users using App +// Service Authentication/Authorization. +type GlobalValidation struct { + // RequireAuthentication - true if the authentication flow is required any request is made; otherwise, false. + RequireAuthentication *bool `json:"requireAuthentication,omitempty"` + // UnauthenticatedClientAction - The action to take when an unauthenticated client attempts to access the app. Possible values include: 'UnauthenticatedClientActionV2RedirectToLoginPage', 'UnauthenticatedClientActionV2AllowAnonymous', 'UnauthenticatedClientActionV2Return401', 'UnauthenticatedClientActionV2Return403' + UnauthenticatedClientAction UnauthenticatedClientActionV2 `json:"unauthenticatedClientAction,omitempty"` + // RedirectToProvider - The default authentication provider to use when multiple providers are configured. + // This setting is only needed if multiple providers are configured and the unauthenticated client + // action is set to "RedirectToLoginPage". + RedirectToProvider *string `json:"redirectToProvider,omitempty"` + // ExcludedPaths - The paths for which unauthenticated flow would not be redirected to the login page. + ExcludedPaths *[]string `json:"excludedPaths,omitempty"` +} + +// Google the configuration settings of the Google provider. +type Google struct { + // Enabled - false if the Google provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + // Registration - The configuration settings of the app registration for the Google provider. + Registration *ClientRegistration `json:"registration,omitempty"` + // Login - The configuration settings of the login flow. + Login *LoginScopes `json:"login,omitempty"` + // Validation - The configuration settings of the Azure Active Directory token validation flow. + Validation *AllowedAudiencesValidation `json:"validation,omitempty"` +} + +// HandlerMapping the IIS handler mappings used to define which handler processes HTTP requests with +// certain extension. +// For example, it is used to configure php-cgi.exe process to handle all HTTP requests with *.php +// extension. +type HandlerMapping struct { + // Extension - Requests with this extension will be handled using the specified FastCGI application. + Extension *string `json:"extension,omitempty"` + // ScriptProcessor - The absolute path to the FastCGI application. + ScriptProcessor *string `json:"scriptProcessor,omitempty"` + // Arguments - Command-line arguments to be passed to the script processor. + Arguments *string `json:"arguments,omitempty"` +} + +// HostingEnvironmentDeploymentInfo information needed to create resources on an App Service Environment. +type HostingEnvironmentDeploymentInfo struct { + // Name - Name of the App Service Environment. + Name *string `json:"name,omitempty"` + // Location - Location of the App Service Environment. + Location *string `json:"location,omitempty"` +} + +// HostingEnvironmentDiagnostics diagnostics for an App Service Environment. +type HostingEnvironmentDiagnostics struct { + autorest.Response `json:"-"` + // Name - Name/identifier of the diagnostics. + Name *string `json:"name,omitempty"` + // DiagnosticsOutput - Diagnostics output. + DiagnosticsOutput *string `json:"diagnosticsOutput,omitempty"` +} + +// HostingEnvironmentProfile specification for an App Service Environment to use for this resource. +type HostingEnvironmentProfile struct { + // ID - Resource ID of the App Service Environment. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the App Service Environment. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type of the App Service Environment. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for HostingEnvironmentProfile. +func (hep HostingEnvironmentProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hep.ID != nil { + objectMap["id"] = hep.ID + } + return json.Marshal(objectMap) +} + +// HostKeys functions host level keys. +type HostKeys struct { + autorest.Response `json:"-"` + // MasterKey - Secret key. + MasterKey *string `json:"masterKey,omitempty"` + // FunctionKeys - Host level function keys. + FunctionKeys map[string]*string `json:"functionKeys"` + // SystemKeys - System keys. + SystemKeys map[string]*string `json:"systemKeys"` +} + +// MarshalJSON is the custom marshaler for HostKeys. +func (hk HostKeys) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hk.MasterKey != nil { + objectMap["masterKey"] = hk.MasterKey + } + if hk.FunctionKeys != nil { + objectMap["functionKeys"] = hk.FunctionKeys + } + if hk.SystemKeys != nil { + objectMap["systemKeys"] = hk.SystemKeys + } + return json.Marshal(objectMap) +} + +// HostName details of a hostname derived from a domain. +type HostName struct { + // Name - Name of the hostname. + Name *string `json:"name,omitempty"` + // SiteNames - List of apps the hostname is assigned to. This list will have more than one app only if the hostname is pointing to a Traffic Manager. + SiteNames *[]string `json:"siteNames,omitempty"` + // AzureResourceName - Name of the Azure resource the hostname is assigned to. If it is assigned to a Traffic Manager then it will be the Traffic Manager name otherwise it will be the app name. + AzureResourceName *string `json:"azureResourceName,omitempty"` + // AzureResourceType - Type of the Azure resource the hostname is assigned to. Possible values include: 'AzureResourceTypeWebsite', 'AzureResourceTypeTrafficManager' + AzureResourceType AzureResourceType `json:"azureResourceType,omitempty"` + // CustomHostNameDNSRecordType - Type of the DNS record. Possible values include: 'CustomHostNameDNSRecordTypeCName', 'CustomHostNameDNSRecordTypeA' + CustomHostNameDNSRecordType CustomHostNameDNSRecordType `json:"customHostNameDnsRecordType,omitempty"` + // HostNameType - Type of the hostname. Possible values include: 'HostNameTypeVerified', 'HostNameTypeManaged' + HostNameType HostNameType `json:"hostNameType,omitempty"` +} + +// HostNameBinding a hostname binding object. +type HostNameBinding struct { + autorest.Response `json:"-"` + // HostNameBindingProperties - HostNameBinding resource specific properties + *HostNameBindingProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for HostNameBinding. +func (hnb HostNameBinding) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hnb.HostNameBindingProperties != nil { + objectMap["properties"] = hnb.HostNameBindingProperties + } + if hnb.Kind != nil { + objectMap["kind"] = hnb.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for HostNameBinding struct. +func (hnb *HostNameBinding) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var hostNameBindingProperties HostNameBindingProperties + err = json.Unmarshal(*v, &hostNameBindingProperties) + if err != nil { + return err + } + hnb.HostNameBindingProperties = &hostNameBindingProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + hnb.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + hnb.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + hnb.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + hnb.Type = &typeVar + } + } + } + + return nil +} + +// HostNameBindingCollection collection of hostname bindings. +type HostNameBindingCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]HostNameBinding `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for HostNameBindingCollection. +func (hnbc HostNameBindingCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hnbc.Value != nil { + objectMap["value"] = hnbc.Value + } + return json.Marshal(objectMap) +} + +// HostNameBindingCollectionIterator provides access to a complete listing of HostNameBinding values. +type HostNameBindingCollectionIterator struct { + i int + page HostNameBindingCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *HostNameBindingCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HostNameBindingCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *HostNameBindingCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter HostNameBindingCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter HostNameBindingCollectionIterator) Response() HostNameBindingCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter HostNameBindingCollectionIterator) Value() HostNameBinding { + if !iter.page.NotDone() { + return HostNameBinding{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the HostNameBindingCollectionIterator type. +func NewHostNameBindingCollectionIterator(page HostNameBindingCollectionPage) HostNameBindingCollectionIterator { + return HostNameBindingCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (hnbc HostNameBindingCollection) IsEmpty() bool { + return hnbc.Value == nil || len(*hnbc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (hnbc HostNameBindingCollection) hasNextLink() bool { + return hnbc.NextLink != nil && len(*hnbc.NextLink) != 0 +} + +// hostNameBindingCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (hnbc HostNameBindingCollection) hostNameBindingCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !hnbc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(hnbc.NextLink))) +} + +// HostNameBindingCollectionPage contains a page of HostNameBinding values. +type HostNameBindingCollectionPage struct { + fn func(context.Context, HostNameBindingCollection) (HostNameBindingCollection, error) + hnbc HostNameBindingCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *HostNameBindingCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HostNameBindingCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.hnbc) + if err != nil { + return err + } + page.hnbc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *HostNameBindingCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page HostNameBindingCollectionPage) NotDone() bool { + return !page.hnbc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page HostNameBindingCollectionPage) Response() HostNameBindingCollection { + return page.hnbc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page HostNameBindingCollectionPage) Values() []HostNameBinding { + if page.hnbc.IsEmpty() { + return nil + } + return *page.hnbc.Value +} + +// Creates a new instance of the HostNameBindingCollectionPage type. +func NewHostNameBindingCollectionPage(cur HostNameBindingCollection, getNextPage func(context.Context, HostNameBindingCollection) (HostNameBindingCollection, error)) HostNameBindingCollectionPage { + return HostNameBindingCollectionPage{ + fn: getNextPage, + hnbc: cur, + } +} + +// HostNameBindingProperties hostNameBinding resource specific properties +type HostNameBindingProperties struct { + // SiteName - App Service app name. + SiteName *string `json:"siteName,omitempty"` + // DomainID - Fully qualified ARM domain resource URI. + DomainID *string `json:"domainId,omitempty"` + // AzureResourceName - Azure resource name. + AzureResourceName *string `json:"azureResourceName,omitempty"` + // AzureResourceType - Azure resource type. Possible values include: 'AzureResourceTypeWebsite', 'AzureResourceTypeTrafficManager' + AzureResourceType AzureResourceType `json:"azureResourceType,omitempty"` + // CustomHostNameDNSRecordType - Custom DNS record type. Possible values include: 'CustomHostNameDNSRecordTypeCName', 'CustomHostNameDNSRecordTypeA' + CustomHostNameDNSRecordType CustomHostNameDNSRecordType `json:"customHostNameDnsRecordType,omitempty"` + // HostNameType - Hostname type. Possible values include: 'HostNameTypeVerified', 'HostNameTypeManaged' + HostNameType HostNameType `json:"hostNameType,omitempty"` + // SslState - SSL type. Possible values include: 'SslStateDisabled', 'SslStateSniEnabled', 'SslStateIPBasedEnabled' + SslState SslState `json:"sslState,omitempty"` + // Thumbprint - SSL certificate thumbprint + Thumbprint *string `json:"thumbprint,omitempty"` + // VirtualIP - READ-ONLY; Virtual IP address assigned to the hostname if IP based SSL is enabled. + VirtualIP *string `json:"virtualIP,omitempty"` +} + +// MarshalJSON is the custom marshaler for HostNameBindingProperties. +func (hnb HostNameBindingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hnb.SiteName != nil { + objectMap["siteName"] = hnb.SiteName + } + if hnb.DomainID != nil { + objectMap["domainId"] = hnb.DomainID + } + if hnb.AzureResourceName != nil { + objectMap["azureResourceName"] = hnb.AzureResourceName + } + if hnb.AzureResourceType != "" { + objectMap["azureResourceType"] = hnb.AzureResourceType + } + if hnb.CustomHostNameDNSRecordType != "" { + objectMap["customHostNameDnsRecordType"] = hnb.CustomHostNameDNSRecordType + } + if hnb.HostNameType != "" { + objectMap["hostNameType"] = hnb.HostNameType + } + if hnb.SslState != "" { + objectMap["sslState"] = hnb.SslState + } + if hnb.Thumbprint != nil { + objectMap["thumbprint"] = hnb.Thumbprint + } + return json.Marshal(objectMap) +} + +// HostNameSslState SSL-enabled hostname. +type HostNameSslState struct { + // Name - Hostname. + Name *string `json:"name,omitempty"` + // SslState - SSL type. Possible values include: 'SslStateDisabled', 'SslStateSniEnabled', 'SslStateIPBasedEnabled' + SslState SslState `json:"sslState,omitempty"` + // VirtualIP - Virtual IP address assigned to the hostname if IP based SSL is enabled. + VirtualIP *string `json:"virtualIP,omitempty"` + // Thumbprint - SSL certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` + // ToUpdate - Set to true to update existing hostname. + ToUpdate *bool `json:"toUpdate,omitempty"` + // HostType - Indicates whether the hostname is a standard or repository hostname. Possible values include: 'HostTypeStandard', 'HostTypeRepository' + HostType HostType `json:"hostType,omitempty"` +} + +// HTTPLogsConfig http logs configuration. +type HTTPLogsConfig struct { + // FileSystem - Http logs to file system configuration. + FileSystem *FileSystemHTTPLogsConfig `json:"fileSystem,omitempty"` + // AzureBlobStorage - Http logs to azure blob storage configuration. + AzureBlobStorage *AzureBlobStorageHTTPLogsConfig `json:"azureBlobStorage,omitempty"` +} + +// HTTPScaleRule container App container Custom scaling rule. +type HTTPScaleRule struct { + // Metadata - Metadata properties to describe http scale rule. + Metadata map[string]*string `json:"metadata"` + // Auth - Authentication secrets for the custom scale rule. + Auth *[]ScaleRuleAuth `json:"auth,omitempty"` +} + +// MarshalJSON is the custom marshaler for HTTPScaleRule. +func (hsr HTTPScaleRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hsr.Metadata != nil { + objectMap["metadata"] = hsr.Metadata + } + if hsr.Auth != nil { + objectMap["auth"] = hsr.Auth + } + return json.Marshal(objectMap) +} + +// HTTPSettings the configuration settings of the HTTP requests for authentication and authorization +// requests made against App Service Authentication/Authorization. +type HTTPSettings struct { + // RequireHTTPS - false if the authentication/authorization responses not having the HTTPS scheme are permissible; otherwise, true. + RequireHTTPS *bool `json:"requireHttps,omitempty"` + // Routes - The configuration settings of the paths HTTP requests. + Routes *HTTPSettingsRoutes `json:"routes,omitempty"` + // ForwardProxy - The configuration settings of a forward proxy used to make the requests. + ForwardProxy *ForwardProxy `json:"forwardProxy,omitempty"` +} + +// HTTPSettingsRoutes the configuration settings of the paths HTTP requests. +type HTTPSettingsRoutes struct { + // APIPrefix - The prefix that should precede all the authentication/authorization paths. + APIPrefix *string `json:"apiPrefix,omitempty"` +} + +// HybridConnection hybrid Connection contract. This is used to configure a Hybrid Connection. +type HybridConnection struct { + autorest.Response `json:"-"` + // HybridConnectionProperties - HybridConnection resource specific properties + *HybridConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for HybridConnection. +func (hc HybridConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hc.HybridConnectionProperties != nil { + objectMap["properties"] = hc.HybridConnectionProperties + } + if hc.Kind != nil { + objectMap["kind"] = hc.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for HybridConnection struct. +func (hc *HybridConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var hybridConnectionProperties HybridConnectionProperties + err = json.Unmarshal(*v, &hybridConnectionProperties) + if err != nil { + return err + } + hc.HybridConnectionProperties = &hybridConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + hc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + hc.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + hc.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + hc.Type = &typeVar + } + } + } + + return nil +} + +// HybridConnectionCollection collection of hostname bindings. +type HybridConnectionCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]HybridConnection `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for HybridConnectionCollection. +func (hcc HybridConnectionCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hcc.Value != nil { + objectMap["value"] = hcc.Value + } + return json.Marshal(objectMap) +} + +// HybridConnectionCollectionIterator provides access to a complete listing of HybridConnection values. +type HybridConnectionCollectionIterator struct { + i int + page HybridConnectionCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *HybridConnectionCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HybridConnectionCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *HybridConnectionCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter HybridConnectionCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter HybridConnectionCollectionIterator) Response() HybridConnectionCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter HybridConnectionCollectionIterator) Value() HybridConnection { + if !iter.page.NotDone() { + return HybridConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the HybridConnectionCollectionIterator type. +func NewHybridConnectionCollectionIterator(page HybridConnectionCollectionPage) HybridConnectionCollectionIterator { + return HybridConnectionCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (hcc HybridConnectionCollection) IsEmpty() bool { + return hcc.Value == nil || len(*hcc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (hcc HybridConnectionCollection) hasNextLink() bool { + return hcc.NextLink != nil && len(*hcc.NextLink) != 0 +} + +// hybridConnectionCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (hcc HybridConnectionCollection) hybridConnectionCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !hcc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(hcc.NextLink))) +} + +// HybridConnectionCollectionPage contains a page of HybridConnection values. +type HybridConnectionCollectionPage struct { + fn func(context.Context, HybridConnectionCollection) (HybridConnectionCollection, error) + hcc HybridConnectionCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *HybridConnectionCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HybridConnectionCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.hcc) + if err != nil { + return err + } + page.hcc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *HybridConnectionCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page HybridConnectionCollectionPage) NotDone() bool { + return !page.hcc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page HybridConnectionCollectionPage) Response() HybridConnectionCollection { + return page.hcc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page HybridConnectionCollectionPage) Values() []HybridConnection { + if page.hcc.IsEmpty() { + return nil + } + return *page.hcc.Value +} + +// Creates a new instance of the HybridConnectionCollectionPage type. +func NewHybridConnectionCollectionPage(cur HybridConnectionCollection, getNextPage func(context.Context, HybridConnectionCollection) (HybridConnectionCollection, error)) HybridConnectionCollectionPage { + return HybridConnectionCollectionPage{ + fn: getNextPage, + hcc: cur, + } +} + +// HybridConnectionKey hybrid Connection key contract. This has the send key name and value for a Hybrid +// Connection. +type HybridConnectionKey struct { + autorest.Response `json:"-"` + // HybridConnectionKeyProperties - HybridConnectionKey resource specific properties + *HybridConnectionKeyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for HybridConnectionKey. +func (hck HybridConnectionKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hck.HybridConnectionKeyProperties != nil { + objectMap["properties"] = hck.HybridConnectionKeyProperties + } + if hck.Kind != nil { + objectMap["kind"] = hck.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for HybridConnectionKey struct. +func (hck *HybridConnectionKey) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var hybridConnectionKeyProperties HybridConnectionKeyProperties + err = json.Unmarshal(*v, &hybridConnectionKeyProperties) + if err != nil { + return err + } + hck.HybridConnectionKeyProperties = &hybridConnectionKeyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + hck.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + hck.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + hck.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + hck.Type = &typeVar + } + } + } + + return nil +} + +// HybridConnectionKeyProperties hybridConnectionKey resource specific properties +type HybridConnectionKeyProperties struct { + // SendKeyName - READ-ONLY; The name of the send key. + SendKeyName *string `json:"sendKeyName,omitempty"` + // SendKeyValue - READ-ONLY; The value of the send key. + SendKeyValue *string `json:"sendKeyValue,omitempty"` +} + +// MarshalJSON is the custom marshaler for HybridConnectionKeyProperties. +func (hck HybridConnectionKeyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// HybridConnectionLimits hybrid Connection limits contract. This is used to return the plan limits of +// Hybrid Connections. +type HybridConnectionLimits struct { + autorest.Response `json:"-"` + // HybridConnectionLimitsProperties - HybridConnectionLimits resource specific properties + *HybridConnectionLimitsProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for HybridConnectionLimits. +func (hcl HybridConnectionLimits) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hcl.HybridConnectionLimitsProperties != nil { + objectMap["properties"] = hcl.HybridConnectionLimitsProperties + } + if hcl.Kind != nil { + objectMap["kind"] = hcl.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for HybridConnectionLimits struct. +func (hcl *HybridConnectionLimits) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var hybridConnectionLimitsProperties HybridConnectionLimitsProperties + err = json.Unmarshal(*v, &hybridConnectionLimitsProperties) + if err != nil { + return err + } + hcl.HybridConnectionLimitsProperties = &hybridConnectionLimitsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + hcl.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + hcl.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + hcl.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + hcl.Type = &typeVar + } + } + } + + return nil +} + +// HybridConnectionLimitsProperties hybridConnectionLimits resource specific properties +type HybridConnectionLimitsProperties struct { + // Current - READ-ONLY; The current number of Hybrid Connections. + Current *int32 `json:"current,omitempty"` + // Maximum - READ-ONLY; The maximum number of Hybrid Connections allowed. + Maximum *int32 `json:"maximum,omitempty"` +} + +// MarshalJSON is the custom marshaler for HybridConnectionLimitsProperties. +func (hcl HybridConnectionLimitsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// HybridConnectionProperties hybridConnection resource specific properties +type HybridConnectionProperties struct { + // ServiceBusNamespace - The name of the Service Bus namespace. + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + // RelayName - The name of the Service Bus relay. + RelayName *string `json:"relayName,omitempty"` + // RelayArmURI - The ARM URI to the Service Bus relay. + RelayArmURI *string `json:"relayArmUri,omitempty"` + // Hostname - The hostname of the endpoint. + Hostname *string `json:"hostname,omitempty"` + // Port - The port of the endpoint. + Port *int32 `json:"port,omitempty"` + // SendKeyName - The name of the Service Bus key which has Send permissions. This is used to authenticate to Service Bus. + SendKeyName *string `json:"sendKeyName,omitempty"` + // SendKeyValue - The value of the Service Bus key. This is used to authenticate to Service Bus. In ARM this key will not be returned + // normally, use the POST /listKeys API instead. + SendKeyValue *string `json:"sendKeyValue,omitempty"` + // ServiceBusSuffix - The suffix for the service bus endpoint. By default this is .servicebus.windows.net + ServiceBusSuffix *string `json:"serviceBusSuffix,omitempty"` +} + +// Identifier a domain specific resource identifier. +type Identifier struct { + autorest.Response `json:"-"` + // IdentifierProperties - Identifier resource specific properties + *IdentifierProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Identifier. +func (i Identifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.IdentifierProperties != nil { + objectMap["properties"] = i.IdentifierProperties + } + if i.Kind != nil { + objectMap["kind"] = i.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Identifier struct. +func (i *Identifier) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var identifierProperties IdentifierProperties + err = json.Unmarshal(*v, &identifierProperties) + if err != nil { + return err + } + i.IdentifierProperties = &identifierProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + i.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + i.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + i.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + i.Type = &typeVar + } + } + } + + return nil +} + +// IdentifierCollection collection of identifiers. +type IdentifierCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]Identifier `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for IdentifierCollection. +func (ic IdentifierCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ic.Value != nil { + objectMap["value"] = ic.Value + } + return json.Marshal(objectMap) +} + +// IdentifierCollectionIterator provides access to a complete listing of Identifier values. +type IdentifierCollectionIterator struct { + i int + page IdentifierCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *IdentifierCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IdentifierCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *IdentifierCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter IdentifierCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter IdentifierCollectionIterator) Response() IdentifierCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter IdentifierCollectionIterator) Value() Identifier { + if !iter.page.NotDone() { + return Identifier{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the IdentifierCollectionIterator type. +func NewIdentifierCollectionIterator(page IdentifierCollectionPage) IdentifierCollectionIterator { + return IdentifierCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ic IdentifierCollection) IsEmpty() bool { + return ic.Value == nil || len(*ic.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ic IdentifierCollection) hasNextLink() bool { + return ic.NextLink != nil && len(*ic.NextLink) != 0 +} + +// identifierCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ic IdentifierCollection) identifierCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !ic.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ic.NextLink))) +} + +// IdentifierCollectionPage contains a page of Identifier values. +type IdentifierCollectionPage struct { + fn func(context.Context, IdentifierCollection) (IdentifierCollection, error) + ic IdentifierCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *IdentifierCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IdentifierCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ic) + if err != nil { + return err + } + page.ic = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *IdentifierCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IdentifierCollectionPage) NotDone() bool { + return !page.ic.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IdentifierCollectionPage) Response() IdentifierCollection { + return page.ic +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IdentifierCollectionPage) Values() []Identifier { + if page.ic.IsEmpty() { + return nil + } + return *page.ic.Value +} + +// Creates a new instance of the IdentifierCollectionPage type. +func NewIdentifierCollectionPage(cur IdentifierCollection, getNextPage func(context.Context, IdentifierCollection) (IdentifierCollection, error)) IdentifierCollectionPage { + return IdentifierCollectionPage{ + fn: getNextPage, + ic: cur, + } +} + +// IdentifierProperties identifier resource specific properties +type IdentifierProperties struct { + // Value - String representation of the identity. + Value *string `json:"id,omitempty"` +} + +// IdentityProviders the configuration settings of each of the identity providers used to configure App +// Service Authentication/Authorization. +type IdentityProviders struct { + // AzureActiveDirectory - The configuration settings of the Azure Active directory provider. + AzureActiveDirectory *AzureActiveDirectory `json:"azureActiveDirectory,omitempty"` + // Facebook - The configuration settings of the Facebook provider. + Facebook *Facebook `json:"facebook,omitempty"` + // GitHub - The configuration settings of the GitHub provider. + GitHub *GitHub `json:"gitHub,omitempty"` + // Google - The configuration settings of the Google provider. + Google *Google `json:"google,omitempty"` + // LegacyMicrosoftAccount - The configuration settings of the legacy Microsoft Account provider. + LegacyMicrosoftAccount *LegacyMicrosoftAccount `json:"legacyMicrosoftAccount,omitempty"` + // Twitter - The configuration settings of the Twitter provider. + Twitter *Twitter `json:"twitter,omitempty"` + // Apple - The configuration settings of the Apple provider. + Apple *Apple `json:"apple,omitempty"` + // AzureStaticWebApps - The configuration settings of the Azure Static Web Apps provider. + AzureStaticWebApps *AzureStaticWebApps `json:"azureStaticWebApps,omitempty"` + // CustomOpenIDConnectProviders - The map of the name of the alias of each custom Open ID Connect provider to the + // configuration settings of the custom Open ID Connect provider. + CustomOpenIDConnectProviders map[string]*CustomOpenIDConnectProvider `json:"customOpenIdConnectProviders"` +} + +// MarshalJSON is the custom marshaler for IdentityProviders. +func (IP IdentityProviders) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if IP.AzureActiveDirectory != nil { + objectMap["azureActiveDirectory"] = IP.AzureActiveDirectory + } + if IP.Facebook != nil { + objectMap["facebook"] = IP.Facebook + } + if IP.GitHub != nil { + objectMap["gitHub"] = IP.GitHub + } + if IP.Google != nil { + objectMap["google"] = IP.Google + } + if IP.LegacyMicrosoftAccount != nil { + objectMap["legacyMicrosoftAccount"] = IP.LegacyMicrosoftAccount + } + if IP.Twitter != nil { + objectMap["twitter"] = IP.Twitter + } + if IP.Apple != nil { + objectMap["apple"] = IP.Apple + } + if IP.AzureStaticWebApps != nil { + objectMap["azureStaticWebApps"] = IP.AzureStaticWebApps + } + if IP.CustomOpenIDConnectProviders != nil { + objectMap["customOpenIdConnectProviders"] = IP.CustomOpenIDConnectProviders + } + return json.Marshal(objectMap) +} + +// InboundEnvironmentEndpoint the IP Addresses and Ports that require inbound network access to and within +// the subnet of the App Service Environment. +type InboundEnvironmentEndpoint struct { + // Description - Short text describing the purpose of the network traffic. + Description *string `json:"description,omitempty"` + // Endpoints - The IP addresses that network traffic will originate from in cidr notation. + Endpoints *[]string `json:"endpoints,omitempty"` + // Ports - The ports that network traffic will arrive to the App Service Environment at. + Ports *[]string `json:"ports,omitempty"` +} + +// InboundEnvironmentEndpointCollection collection of Inbound Environment Endpoints +type InboundEnvironmentEndpointCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]InboundEnvironmentEndpoint `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundEnvironmentEndpointCollection. +func (ieec InboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ieec.Value != nil { + objectMap["value"] = ieec.Value + } + return json.Marshal(objectMap) +} + +// InboundEnvironmentEndpointCollectionIterator provides access to a complete listing of +// InboundEnvironmentEndpoint values. +type InboundEnvironmentEndpointCollectionIterator struct { + i int + page InboundEnvironmentEndpointCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *InboundEnvironmentEndpointCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InboundEnvironmentEndpointCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *InboundEnvironmentEndpointCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter InboundEnvironmentEndpointCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter InboundEnvironmentEndpointCollectionIterator) Response() InboundEnvironmentEndpointCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter InboundEnvironmentEndpointCollectionIterator) Value() InboundEnvironmentEndpoint { + if !iter.page.NotDone() { + return InboundEnvironmentEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the InboundEnvironmentEndpointCollectionIterator type. +func NewInboundEnvironmentEndpointCollectionIterator(page InboundEnvironmentEndpointCollectionPage) InboundEnvironmentEndpointCollectionIterator { + return InboundEnvironmentEndpointCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ieec InboundEnvironmentEndpointCollection) IsEmpty() bool { + return ieec.Value == nil || len(*ieec.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ieec InboundEnvironmentEndpointCollection) hasNextLink() bool { + return ieec.NextLink != nil && len(*ieec.NextLink) != 0 +} + +// inboundEnvironmentEndpointCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ieec InboundEnvironmentEndpointCollection) inboundEnvironmentEndpointCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !ieec.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ieec.NextLink))) +} + +// InboundEnvironmentEndpointCollectionPage contains a page of InboundEnvironmentEndpoint values. +type InboundEnvironmentEndpointCollectionPage struct { + fn func(context.Context, InboundEnvironmentEndpointCollection) (InboundEnvironmentEndpointCollection, error) + ieec InboundEnvironmentEndpointCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *InboundEnvironmentEndpointCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InboundEnvironmentEndpointCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ieec) + if err != nil { + return err + } + page.ieec = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *InboundEnvironmentEndpointCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page InboundEnvironmentEndpointCollectionPage) NotDone() bool { + return !page.ieec.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page InboundEnvironmentEndpointCollectionPage) Response() InboundEnvironmentEndpointCollection { + return page.ieec +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page InboundEnvironmentEndpointCollectionPage) Values() []InboundEnvironmentEndpoint { + if page.ieec.IsEmpty() { + return nil + } + return *page.ieec.Value +} + +// Creates a new instance of the InboundEnvironmentEndpointCollectionPage type. +func NewInboundEnvironmentEndpointCollectionPage(cur InboundEnvironmentEndpointCollection, getNextPage func(context.Context, InboundEnvironmentEndpointCollection) (InboundEnvironmentEndpointCollection, error)) InboundEnvironmentEndpointCollectionPage { + return InboundEnvironmentEndpointCollectionPage{ + fn: getNextPage, + ieec: cur, + } +} + +// Ingress container App Ingress configuration. +type Ingress struct { + // Fqdn - READ-ONLY; Hostname. + Fqdn *string `json:"fqdn,omitempty"` + // External - Bool indicating if app exposes an external http endpoint + External *bool `json:"external,omitempty"` + // TargetPort - Target Port in containers for traffic from ingress + TargetPort *int32 `json:"targetPort,omitempty"` + // Transport - Ingress transport protocol. Possible values include: 'IngressTransportMethodAuto', 'IngressTransportMethodHTTP', 'IngressTransportMethodHTTP2' + Transport IngressTransportMethod `json:"transport,omitempty"` + Traffic *[]TrafficWeight `json:"traffic,omitempty"` + // AllowInsecure - Bool indicating if HTTP connections to is allowed. If set to false HTTP connections are automatically redirected to HTTPS connections + AllowInsecure *bool `json:"allowInsecure,omitempty"` +} + +// MarshalJSON is the custom marshaler for Ingress. +func (i Ingress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.External != nil { + objectMap["external"] = i.External + } + if i.TargetPort != nil { + objectMap["targetPort"] = i.TargetPort + } + if i.Transport != "" { + objectMap["transport"] = i.Transport + } + if i.Traffic != nil { + objectMap["traffic"] = i.Traffic + } + if i.AllowInsecure != nil { + objectMap["allowInsecure"] = i.AllowInsecure + } + return json.Marshal(objectMap) +} + +// IPSecurityRestriction IP security restriction on an app. +type IPSecurityRestriction struct { + // IPAddress - IP address the security restriction is valid for. + // It can be in form of pure ipv4 address (required SubnetMask property) or + // CIDR notation such as ipv4/mask (leading bit match). For CIDR, + // SubnetMask property must not be specified. + IPAddress *string `json:"ipAddress,omitempty"` + // SubnetMask - Subnet mask for the range of IP addresses the restriction is valid for. + SubnetMask *string `json:"subnetMask,omitempty"` + // VnetSubnetResourceID - Virtual network resource id + VnetSubnetResourceID *string `json:"vnetSubnetResourceId,omitempty"` + // VnetTrafficTag - (internal) Vnet traffic tag + VnetTrafficTag *int32 `json:"vnetTrafficTag,omitempty"` + // SubnetTrafficTag - (internal) Subnet traffic tag + SubnetTrafficTag *int32 `json:"subnetTrafficTag,omitempty"` + // Action - Allow or Deny access for this IP range. + Action *string `json:"action,omitempty"` + // Tag - Defines what this IP filter will be used for. This is to support IP filtering on proxies. Possible values include: 'IPFilterTagDefault', 'IPFilterTagXffProxy', 'IPFilterTagServiceTag' + Tag IPFilterTag `json:"tag,omitempty"` + // Priority - Priority of IP restriction rule. + Priority *int32 `json:"priority,omitempty"` + // Name - IP restriction rule name. + Name *string `json:"name,omitempty"` + // Description - IP restriction rule description. + Description *string `json:"description,omitempty"` + // Headers - IP restriction rule headers. + // X-Forwarded-Host (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host#Examples). + // The matching logic is .. + // - If the property is null or empty (default), all hosts(or lack of) are allowed. + // - A value is compared using ordinal-ignore-case (excluding port number). + // - Subdomain wildcards are permitted but don't match the root domain. For example, *.contoso.com matches the subdomain foo.contoso.com + // but not the root domain contoso.com or multi-level foo.bar.contoso.com + // - Unicode host names are allowed but are converted to Punycode for matching. + // X-Forwarded-For (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For#Examples). + // The matching logic is .. + // - If the property is null or empty (default), any forwarded-for chains (or lack of) are allowed. + // - If any address (excluding port number) in the chain (comma separated) matches the CIDR defined by the property. + // X-Azure-FDID and X-FD-HealthProbe. + // The matching logic is exact match. + Headers map[string][]string `json:"headers"` +} + +// MarshalJSON is the custom marshaler for IPSecurityRestriction. +func (isr IPSecurityRestriction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if isr.IPAddress != nil { + objectMap["ipAddress"] = isr.IPAddress + } + if isr.SubnetMask != nil { + objectMap["subnetMask"] = isr.SubnetMask + } + if isr.VnetSubnetResourceID != nil { + objectMap["vnetSubnetResourceId"] = isr.VnetSubnetResourceID + } + if isr.VnetTrafficTag != nil { + objectMap["vnetTrafficTag"] = isr.VnetTrafficTag + } + if isr.SubnetTrafficTag != nil { + objectMap["subnetTrafficTag"] = isr.SubnetTrafficTag + } + if isr.Action != nil { + objectMap["action"] = isr.Action + } + if isr.Tag != "" { + objectMap["tag"] = isr.Tag + } + if isr.Priority != nil { + objectMap["priority"] = isr.Priority + } + if isr.Name != nil { + objectMap["name"] = isr.Name + } + if isr.Description != nil { + objectMap["description"] = isr.Description + } + if isr.Headers != nil { + objectMap["headers"] = isr.Headers + } + return json.Marshal(objectMap) +} + +// Job web Job Information. +type Job struct { + autorest.Response `json:"-"` + // JobProperties - WebJob resource specific properties + *JobProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Job. +func (j Job) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if j.JobProperties != nil { + objectMap["properties"] = j.JobProperties + } + if j.Kind != nil { + objectMap["kind"] = j.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Job struct. +func (j *Job) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var jobProperties JobProperties + err = json.Unmarshal(*v, &jobProperties) + if err != nil { + return err + } + j.JobProperties = &jobProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + j.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + j.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + j.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + j.Type = &typeVar + } + } + } + + return nil +} + +// JobCollection collection of Kudu web job information elements. +type JobCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]Job `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for JobCollection. +func (jc JobCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if jc.Value != nil { + objectMap["value"] = jc.Value + } + return json.Marshal(objectMap) +} + +// JobCollectionIterator provides access to a complete listing of Job values. +type JobCollectionIterator struct { + i int + page JobCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *JobCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *JobCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter JobCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter JobCollectionIterator) Response() JobCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter JobCollectionIterator) Value() Job { + if !iter.page.NotDone() { + return Job{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the JobCollectionIterator type. +func NewJobCollectionIterator(page JobCollectionPage) JobCollectionIterator { + return JobCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (jc JobCollection) IsEmpty() bool { + return jc.Value == nil || len(*jc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (jc JobCollection) hasNextLink() bool { + return jc.NextLink != nil && len(*jc.NextLink) != 0 +} + +// jobCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (jc JobCollection) jobCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !jc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(jc.NextLink))) +} + +// JobCollectionPage contains a page of Job values. +type JobCollectionPage struct { + fn func(context.Context, JobCollection) (JobCollection, error) + jc JobCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *JobCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.jc) + if err != nil { + return err + } + page.jc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *JobCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page JobCollectionPage) NotDone() bool { + return !page.jc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page JobCollectionPage) Response() JobCollection { + return page.jc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page JobCollectionPage) Values() []Job { + if page.jc.IsEmpty() { + return nil + } + return *page.jc.Value +} + +// Creates a new instance of the JobCollectionPage type. +func NewJobCollectionPage(cur JobCollection, getNextPage func(context.Context, JobCollection) (JobCollection, error)) JobCollectionPage { + return JobCollectionPage{ + fn: getNextPage, + jc: cur, + } +} + +// JobProperties webJob resource specific properties +type JobProperties struct { + // RunCommand - Run command. + RunCommand *string `json:"run_command,omitempty"` + // URL - Job URL. + URL *string `json:"url,omitempty"` + // ExtraInfoURL - Extra Info URL. + ExtraInfoURL *string `json:"extra_info_url,omitempty"` + // WebJobType - Job type. Possible values include: 'JobTypeContinuous', 'JobTypeTriggered' + WebJobType JobType `json:"web_job_type,omitempty"` + // Error - Error information. + Error *string `json:"error,omitempty"` + // UsingSdk - Using SDK? + UsingSdk *bool `json:"using_sdk,omitempty"` + // Settings - Job settings. + Settings map[string]interface{} `json:"settings"` +} + +// MarshalJSON is the custom marshaler for JobProperties. +func (j JobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if j.RunCommand != nil { + objectMap["run_command"] = j.RunCommand + } + if j.URL != nil { + objectMap["url"] = j.URL + } + if j.ExtraInfoURL != nil { + objectMap["extra_info_url"] = j.ExtraInfoURL + } + if j.WebJobType != "" { + objectMap["web_job_type"] = j.WebJobType + } + if j.Error != nil { + objectMap["error"] = j.Error + } + if j.UsingSdk != nil { + objectMap["using_sdk"] = j.UsingSdk + } + if j.Settings != nil { + objectMap["settings"] = j.Settings + } + return json.Marshal(objectMap) +} + +// JwtClaimChecks the configuration settings of the checks that should be made while validating the JWT +// Claims. +type JwtClaimChecks struct { + // AllowedGroups - The list of the allowed groups. + AllowedGroups *[]string `json:"allowedGroups,omitempty"` + // AllowedClientApplications - The list of the allowed client applications. + AllowedClientApplications *[]string `json:"allowedClientApplications,omitempty"` +} + +// KeyInfo function key info. +type KeyInfo struct { + autorest.Response `json:"-"` + // Name - Key name + Name *string `json:"name,omitempty"` + // Value - Key value + Value *string `json:"value,omitempty"` +} + +// KeyValuePairStringObject ... +type KeyValuePairStringObject struct { + // Key - READ-ONLY + Key *string `json:"key,omitempty"` + // Value - READ-ONLY + Value interface{} `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for KeyValuePairStringObject. +func (kvpSo KeyValuePairStringObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// KubeEnvironment a Kubernetes cluster specialized for web workloads by Azure App Service +type KubeEnvironment struct { + autorest.Response `json:"-"` + // KubeEnvironmentProperties - KubeEnvironment resource specific properties + *KubeEnvironmentProperties `json:"properties,omitempty"` + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Location - Resource Location. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for KubeEnvironment. +func (ke KubeEnvironment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ke.KubeEnvironmentProperties != nil { + objectMap["properties"] = ke.KubeEnvironmentProperties + } + if ke.ExtendedLocation != nil { + objectMap["extendedLocation"] = ke.ExtendedLocation + } + if ke.Kind != nil { + objectMap["kind"] = ke.Kind + } + if ke.Location != nil { + objectMap["location"] = ke.Location + } + if ke.Tags != nil { + objectMap["tags"] = ke.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for KubeEnvironment struct. +func (ke *KubeEnvironment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var kubeEnvironmentProperties KubeEnvironmentProperties + err = json.Unmarshal(*v, &kubeEnvironmentProperties) + if err != nil { + return err + } + ke.KubeEnvironmentProperties = &kubeEnvironmentProperties + } + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + ke.ExtendedLocation = &extendedLocation + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ke.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ke.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ke.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ke.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ke.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ke.Tags = tags + } + } + } + + return nil +} + +// KubeEnvironmentCollection collection of Kubernetes Environments +type KubeEnvironmentCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]KubeEnvironment `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for KubeEnvironmentCollection. +func (kec KubeEnvironmentCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kec.Value != nil { + objectMap["value"] = kec.Value + } + return json.Marshal(objectMap) +} + +// KubeEnvironmentCollectionIterator provides access to a complete listing of KubeEnvironment values. +type KubeEnvironmentCollectionIterator struct { + i int + page KubeEnvironmentCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *KubeEnvironmentCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KubeEnvironmentCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *KubeEnvironmentCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter KubeEnvironmentCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter KubeEnvironmentCollectionIterator) Response() KubeEnvironmentCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter KubeEnvironmentCollectionIterator) Value() KubeEnvironment { + if !iter.page.NotDone() { + return KubeEnvironment{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the KubeEnvironmentCollectionIterator type. +func NewKubeEnvironmentCollectionIterator(page KubeEnvironmentCollectionPage) KubeEnvironmentCollectionIterator { + return KubeEnvironmentCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (kec KubeEnvironmentCollection) IsEmpty() bool { + return kec.Value == nil || len(*kec.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (kec KubeEnvironmentCollection) hasNextLink() bool { + return kec.NextLink != nil && len(*kec.NextLink) != 0 +} + +// kubeEnvironmentCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (kec KubeEnvironmentCollection) kubeEnvironmentCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !kec.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(kec.NextLink))) +} + +// KubeEnvironmentCollectionPage contains a page of KubeEnvironment values. +type KubeEnvironmentCollectionPage struct { + fn func(context.Context, KubeEnvironmentCollection) (KubeEnvironmentCollection, error) + kec KubeEnvironmentCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *KubeEnvironmentCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KubeEnvironmentCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.kec) + if err != nil { + return err + } + page.kec = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *KubeEnvironmentCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page KubeEnvironmentCollectionPage) NotDone() bool { + return !page.kec.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page KubeEnvironmentCollectionPage) Response() KubeEnvironmentCollection { + return page.kec +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page KubeEnvironmentCollectionPage) Values() []KubeEnvironment { + if page.kec.IsEmpty() { + return nil + } + return *page.kec.Value +} + +// Creates a new instance of the KubeEnvironmentCollectionPage type. +func NewKubeEnvironmentCollectionPage(cur KubeEnvironmentCollection, getNextPage func(context.Context, KubeEnvironmentCollection) (KubeEnvironmentCollection, error)) KubeEnvironmentCollectionPage { + return KubeEnvironmentCollectionPage{ + fn: getNextPage, + kec: cur, + } +} + +// KubeEnvironmentPatchResource ARM resource for a KubeEnvironment when patching +type KubeEnvironmentPatchResource struct { + // KubeEnvironmentPatchResourceProperties - KubeEnvironmentPatchResource resource specific properties + *KubeEnvironmentPatchResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for KubeEnvironmentPatchResource. +func (kepr KubeEnvironmentPatchResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kepr.KubeEnvironmentPatchResourceProperties != nil { + objectMap["properties"] = kepr.KubeEnvironmentPatchResourceProperties + } + if kepr.Kind != nil { + objectMap["kind"] = kepr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for KubeEnvironmentPatchResource struct. +func (kepr *KubeEnvironmentPatchResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var kubeEnvironmentPatchResourceProperties KubeEnvironmentPatchResourceProperties + err = json.Unmarshal(*v, &kubeEnvironmentPatchResourceProperties) + if err != nil { + return err + } + kepr.KubeEnvironmentPatchResourceProperties = &kubeEnvironmentPatchResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + kepr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + kepr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + kepr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + kepr.Type = &typeVar + } + } + } + + return nil +} + +// KubeEnvironmentPatchResourceProperties kubeEnvironmentPatchResource resource specific properties +type KubeEnvironmentPatchResourceProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the Kubernetes Environment. Possible values include: 'KubeEnvironmentProvisioningStateSucceeded', 'KubeEnvironmentProvisioningStateFailed', 'KubeEnvironmentProvisioningStateCanceled', 'KubeEnvironmentProvisioningStateWaiting', 'KubeEnvironmentProvisioningStateInitializationInProgress', 'KubeEnvironmentProvisioningStateInfrastructureSetupInProgress', 'KubeEnvironmentProvisioningStateInfrastructureSetupComplete', 'KubeEnvironmentProvisioningStateScheduledForDelete', 'KubeEnvironmentProvisioningStateUpgradeRequested', 'KubeEnvironmentProvisioningStateUpgradeFailed' + ProvisioningState KubeEnvironmentProvisioningState `json:"provisioningState,omitempty"` + // DeploymentErrors - READ-ONLY; Any errors that occurred during deployment or deployment validation + DeploymentErrors *string `json:"deploymentErrors,omitempty"` + // InternalLoadBalancerEnabled - Only visible within Vnet/Subnet + InternalLoadBalancerEnabled *bool `json:"internalLoadBalancerEnabled,omitempty"` + // DefaultDomain - READ-ONLY; Default Domain Name for the cluster + DefaultDomain *string `json:"defaultDomain,omitempty"` + // StaticIP - Static IP of the KubeEnvironment + StaticIP *string `json:"staticIp,omitempty"` + // ArcConfiguration - Cluster configuration which determines the ARC cluster + // components types. Eg: Choosing between BuildService kind, + // FrontEnd Service ArtifactsStorageType etc. + ArcConfiguration *ArcConfiguration `json:"arcConfiguration,omitempty"` + // AppLogsConfiguration - Cluster configuration which enables the log daemon to export + // app logs to a destination. Currently only "log-analytics" is + // supported + AppLogsConfiguration *AppLogsConfiguration `json:"appLogsConfiguration,omitempty"` + // ContainerAppsConfiguration - Cluster configuration for Container Apps Environments to configure Dapr Instrumentation Key and VNET Configuration + ContainerAppsConfiguration *ContainerAppsConfiguration `json:"containerAppsConfiguration,omitempty"` + AksResourceID *string `json:"aksResourceID,omitempty"` +} + +// MarshalJSON is the custom marshaler for KubeEnvironmentPatchResourceProperties. +func (kepr KubeEnvironmentPatchResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kepr.InternalLoadBalancerEnabled != nil { + objectMap["internalLoadBalancerEnabled"] = kepr.InternalLoadBalancerEnabled + } + if kepr.StaticIP != nil { + objectMap["staticIp"] = kepr.StaticIP + } + if kepr.ArcConfiguration != nil { + objectMap["arcConfiguration"] = kepr.ArcConfiguration + } + if kepr.AppLogsConfiguration != nil { + objectMap["appLogsConfiguration"] = kepr.AppLogsConfiguration + } + if kepr.ContainerAppsConfiguration != nil { + objectMap["containerAppsConfiguration"] = kepr.ContainerAppsConfiguration + } + if kepr.AksResourceID != nil { + objectMap["aksResourceID"] = kepr.AksResourceID + } + return json.Marshal(objectMap) +} + +// KubeEnvironmentProfile specification for a Kubernetes Environment to use for this resource. +type KubeEnvironmentProfile struct { + // ID - Resource ID of the Kubernetes Environment. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the Kubernetes Environment. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type of the Kubernetes Environment. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for KubeEnvironmentProfile. +func (kep KubeEnvironmentProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kep.ID != nil { + objectMap["id"] = kep.ID + } + return json.Marshal(objectMap) +} + +// KubeEnvironmentProperties kubeEnvironment resource specific properties +type KubeEnvironmentProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the Kubernetes Environment. Possible values include: 'KubeEnvironmentProvisioningStateSucceeded', 'KubeEnvironmentProvisioningStateFailed', 'KubeEnvironmentProvisioningStateCanceled', 'KubeEnvironmentProvisioningStateWaiting', 'KubeEnvironmentProvisioningStateInitializationInProgress', 'KubeEnvironmentProvisioningStateInfrastructureSetupInProgress', 'KubeEnvironmentProvisioningStateInfrastructureSetupComplete', 'KubeEnvironmentProvisioningStateScheduledForDelete', 'KubeEnvironmentProvisioningStateUpgradeRequested', 'KubeEnvironmentProvisioningStateUpgradeFailed' + ProvisioningState KubeEnvironmentProvisioningState `json:"provisioningState,omitempty"` + // DeploymentErrors - READ-ONLY; Any errors that occurred during deployment or deployment validation + DeploymentErrors *string `json:"deploymentErrors,omitempty"` + // InternalLoadBalancerEnabled - Only visible within Vnet/Subnet + InternalLoadBalancerEnabled *bool `json:"internalLoadBalancerEnabled,omitempty"` + // DefaultDomain - READ-ONLY; Default Domain Name for the cluster + DefaultDomain *string `json:"defaultDomain,omitempty"` + // StaticIP - Static IP of the KubeEnvironment + StaticIP *string `json:"staticIp,omitempty"` + // EnvironmentType - Type of Kubernetes Environment. Only supported for Container App Environments with value as Managed + EnvironmentType *string `json:"environmentType,omitempty"` + // ArcConfiguration - Cluster configuration which determines the ARC cluster + // components types. Eg: Choosing between BuildService kind, + // FrontEnd Service ArtifactsStorageType etc. + ArcConfiguration *ArcConfiguration `json:"arcConfiguration,omitempty"` + // AppLogsConfiguration - Cluster configuration which enables the log daemon to export + // app logs to a destination. Currently only "log-analytics" is + // supported + AppLogsConfiguration *AppLogsConfiguration `json:"appLogsConfiguration,omitempty"` + // ContainerAppsConfiguration - Cluster configuration for Container Apps Environments to configure Dapr Instrumentation Key and VNET Configuration + ContainerAppsConfiguration *ContainerAppsConfiguration `json:"containerAppsConfiguration,omitempty"` + AksResourceID *string `json:"aksResourceID,omitempty"` +} + +// MarshalJSON is the custom marshaler for KubeEnvironmentProperties. +func (ke KubeEnvironmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ke.InternalLoadBalancerEnabled != nil { + objectMap["internalLoadBalancerEnabled"] = ke.InternalLoadBalancerEnabled + } + if ke.StaticIP != nil { + objectMap["staticIp"] = ke.StaticIP + } + if ke.EnvironmentType != nil { + objectMap["environmentType"] = ke.EnvironmentType + } + if ke.ArcConfiguration != nil { + objectMap["arcConfiguration"] = ke.ArcConfiguration + } + if ke.AppLogsConfiguration != nil { + objectMap["appLogsConfiguration"] = ke.AppLogsConfiguration + } + if ke.ContainerAppsConfiguration != nil { + objectMap["containerAppsConfiguration"] = ke.ContainerAppsConfiguration + } + if ke.AksResourceID != nil { + objectMap["aksResourceID"] = ke.AksResourceID + } + return json.Marshal(objectMap) +} + +// KubeEnvironmentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type KubeEnvironmentsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(KubeEnvironmentsClient) (KubeEnvironment, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *KubeEnvironmentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for KubeEnvironmentsCreateOrUpdateFuture.Result. +func (future *KubeEnvironmentsCreateOrUpdateFuture) result(client KubeEnvironmentsClient) (ke KubeEnvironment, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ke.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.KubeEnvironmentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ke.Response.Response, err = future.GetResult(sender); err == nil && ke.Response.Response.StatusCode != http.StatusNoContent { + ke, err = client.CreateOrUpdateResponder(ke.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsCreateOrUpdateFuture", "Result", ke.Response.Response, "Failure responding to request") + } + } + return +} + +// KubeEnvironmentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type KubeEnvironmentsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(KubeEnvironmentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *KubeEnvironmentsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for KubeEnvironmentsDeleteFuture.Result. +func (future *KubeEnvironmentsDeleteFuture) result(client KubeEnvironmentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.KubeEnvironmentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.KubeEnvironmentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// LegacyMicrosoftAccount the configuration settings of the legacy Microsoft Account provider. +type LegacyMicrosoftAccount struct { + // Enabled - false if the legacy Microsoft Account provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + // Registration - The configuration settings of the app registration for the legacy Microsoft Account provider. + Registration *ClientRegistration `json:"registration,omitempty"` + // Login - The configuration settings of the login flow. + Login *LoginScopes `json:"login,omitempty"` + // Validation - The configuration settings of the legacy Microsoft Account provider token validation flow. + Validation *AllowedAudiencesValidation `json:"validation,omitempty"` +} + +// LinuxJavaContainerSettings linux Java Container settings. +type LinuxJavaContainerSettings struct { + // Java11Runtime - READ-ONLY; Java 11 version (runtime only). + Java11Runtime *string `json:"java11Runtime,omitempty"` + // Java8Runtime - READ-ONLY; Java 8 version (runtime only). + Java8Runtime *string `json:"java8Runtime,omitempty"` + // IsPreview - READ-ONLY; true if the stack is in preview; otherwise, false. + IsPreview *bool `json:"isPreview,omitempty"` + // IsDeprecated - READ-ONLY; true if the stack is deprecated; otherwise, false. + IsDeprecated *bool `json:"isDeprecated,omitempty"` + // IsHidden - READ-ONLY; true if the stack should be hidden; otherwise, false. + IsHidden *bool `json:"isHidden,omitempty"` + // EndOfLifeDate - READ-ONLY; End-of-life date for the minor version. + EndOfLifeDate *date.Time `json:"endOfLifeDate,omitempty"` + // IsAutoUpdate - READ-ONLY; true if the stack version is auto-updated; otherwise, false. + IsAutoUpdate *bool `json:"isAutoUpdate,omitempty"` + // IsEarlyAccess - READ-ONLY; true if the minor version is early-access; otherwise, false. + IsEarlyAccess *bool `json:"isEarlyAccess,omitempty"` +} + +// MarshalJSON is the custom marshaler for LinuxJavaContainerSettings. +func (ljcs LinuxJavaContainerSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ListCapability ... +type ListCapability struct { + autorest.Response `json:"-"` + Value *[]Capability `json:"value,omitempty"` +} + +// ListCertificateEmail ... +type ListCertificateEmail struct { + autorest.Response `json:"-"` + Value *[]CertificateEmail `json:"value,omitempty"` +} + +// ListCertificateOrderAction ... +type ListCertificateOrderAction struct { + autorest.Response `json:"-"` + Value *[]CertificateOrderAction `json:"value,omitempty"` +} + +// ListHostingEnvironmentDiagnostics ... +type ListHostingEnvironmentDiagnostics struct { + autorest.Response `json:"-"` + Value *[]HostingEnvironmentDiagnostics `json:"value,omitempty"` +} + +// ListNetworkTrace ... +type ListNetworkTrace struct { + autorest.Response `json:"-"` + Value *[]NetworkTrace `json:"value,omitempty"` +} + +// ListOperation ... +type ListOperation struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` +} + +// ListSnapshot ... +type ListSnapshot struct { + autorest.Response `json:"-"` + Value *[]Snapshot `json:"value,omitempty"` +} + +// ListVnetInfoResource ... +type ListVnetInfoResource struct { + autorest.Response `json:"-"` + Value *[]VnetInfoResource `json:"value,omitempty"` +} + +// ListVnetRoute ... +type ListVnetRoute struct { + autorest.Response `json:"-"` + Value *[]VnetRoute `json:"value,omitempty"` +} + +// LocalizableString localizable string object containing the name and a localized value. +type LocalizableString struct { + // Value - Non-localized name. + Value *string `json:"value,omitempty"` + // LocalizedValue - Localized name. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// LogAnalyticsConfiguration ... +type LogAnalyticsConfiguration struct { + CustomerID *string `json:"customerId,omitempty"` + SharedKey *string `json:"sharedKey,omitempty"` +} + +// Login the configuration settings of the login flow of users using App Service +// Authentication/Authorization. +type Login struct { + // Routes - The routes that specify the endpoints used for login and logout requests. + Routes *LoginRoutes `json:"routes,omitempty"` + // TokenStore - The configuration settings of the token store. + TokenStore *TokenStore `json:"tokenStore,omitempty"` + // PreserveURLFragmentsForLogins - true if the fragments from the request are preserved after the login request is made; otherwise, false. + PreserveURLFragmentsForLogins *bool `json:"preserveUrlFragmentsForLogins,omitempty"` + // AllowedExternalRedirectUrls - External URLs that can be redirected to as part of logging in or logging out of the app. Note that the query string part of the URL is ignored. + // This is an advanced setting typically only needed by Windows Store application backends. + // Note that URLs within the current domain are always implicitly allowed. + AllowedExternalRedirectUrls *[]string `json:"allowedExternalRedirectUrls,omitempty"` + // CookieExpiration - The configuration settings of the session cookie's expiration. + CookieExpiration *CookieExpiration `json:"cookieExpiration,omitempty"` + // Nonce - The configuration settings of the nonce used in the login flow. + Nonce *Nonce `json:"nonce,omitempty"` +} + +// LoginRoutes the routes that specify the endpoints used for login and logout requests. +type LoginRoutes struct { + // LogoutEndpoint - The endpoint at which a logout request should be made. + LogoutEndpoint *string `json:"logoutEndpoint,omitempty"` +} + +// LoginScopes the configuration settings of the login flow, including the scopes that should be requested. +type LoginScopes struct { + // Scopes - A list of the scopes that should be requested while authenticating. + Scopes *[]string `json:"scopes,omitempty"` +} + +// LogSpecification log Definition of a single resource metric. +type LogSpecification struct { + Name *string `json:"name,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + BlobDuration *string `json:"blobDuration,omitempty"` + LogFilterPattern *string `json:"logFilterPattern,omitempty"` +} + +// ManagedServiceIdentity managed service identity. +type ManagedServiceIdentity struct { + // Type - Type of managed service identity. Possible values include: 'ManagedServiceIdentityTypeSystemAssigned', 'ManagedServiceIdentityTypeUserAssigned', 'ManagedServiceIdentityTypeSystemAssignedUserAssigned', 'ManagedServiceIdentityTypeNone' + Type ManagedServiceIdentityType `json:"type,omitempty"` + // TenantID - READ-ONLY; Tenant of managed service identity. + TenantID *string `json:"tenantId,omitempty"` + // PrincipalID - READ-ONLY; Principal Id of managed service identity. + PrincipalID *string `json:"principalId,omitempty"` + // UserAssignedIdentities - The list of user assigned identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} + UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ManagedServiceIdentity. +func (msi ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if msi.Type != "" { + objectMap["type"] = msi.Type + } + if msi.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = msi.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// MetricAvailability retention policy of a resource metric. +type MetricAvailability struct { + TimeGrain *string `json:"timeGrain,omitempty"` + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// MetricSpecification definition of a single resource metric. +type MetricSpecification struct { + Name *string `json:"name,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + DisplayDescription *string `json:"displayDescription,omitempty"` + Unit *string `json:"unit,omitempty"` + AggregationType *string `json:"aggregationType,omitempty"` + SupportsInstanceLevelAggregation *bool `json:"supportsInstanceLevelAggregation,omitempty"` + EnableRegionalMdmAccount *bool `json:"enableRegionalMdmAccount,omitempty"` + SourceMdmAccount *string `json:"sourceMdmAccount,omitempty"` + SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` + MetricFilterPattern *string `json:"metricFilterPattern,omitempty"` + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + IsInternal *bool `json:"isInternal,omitempty"` + Dimensions *[]Dimension `json:"dimensions,omitempty"` + Category *string `json:"category,omitempty"` + Availabilities *[]MetricAvailability `json:"availabilities,omitempty"` + SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` + SupportedAggregationTypes *[]string `json:"supportedAggregationTypes,omitempty"` +} + +// MigrateMySQLRequest mySQL migration request. +type MigrateMySQLRequest struct { + // MigrateMySQLRequestProperties - MigrateMySqlRequest resource specific properties + *MigrateMySQLRequestProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrateMySQLRequest. +func (mmsr MigrateMySQLRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mmsr.MigrateMySQLRequestProperties != nil { + objectMap["properties"] = mmsr.MigrateMySQLRequestProperties + } + if mmsr.Kind != nil { + objectMap["kind"] = mmsr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MigrateMySQLRequest struct. +func (mmsr *MigrateMySQLRequest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var migrateMySQLRequestProperties MigrateMySQLRequestProperties + err = json.Unmarshal(*v, &migrateMySQLRequestProperties) + if err != nil { + return err + } + mmsr.MigrateMySQLRequestProperties = &migrateMySQLRequestProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mmsr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mmsr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mmsr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mmsr.Type = &typeVar + } + } + } + + return nil +} + +// MigrateMySQLRequestProperties migrateMySqlRequest resource specific properties +type MigrateMySQLRequestProperties struct { + // ConnectionString - Connection string to the remote MySQL database. + ConnectionString *string `json:"connectionString,omitempty"` + // MigrationType - The type of migration operation to be done. Possible values include: 'MySQLMigrationTypeLocalToRemote', 'MySQLMigrationTypeRemoteToLocal' + MigrationType MySQLMigrationType `json:"migrationType,omitempty"` +} + +// MigrateMySQLStatus mySQL migration status. +type MigrateMySQLStatus struct { + autorest.Response `json:"-"` + // MigrateMySQLStatusProperties - MigrateMySqlStatus resource specific properties + *MigrateMySQLStatusProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrateMySQLStatus. +func (mmss MigrateMySQLStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mmss.MigrateMySQLStatusProperties != nil { + objectMap["properties"] = mmss.MigrateMySQLStatusProperties + } + if mmss.Kind != nil { + objectMap["kind"] = mmss.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MigrateMySQLStatus struct. +func (mmss *MigrateMySQLStatus) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var migrateMySQLStatusProperties MigrateMySQLStatusProperties + err = json.Unmarshal(*v, &migrateMySQLStatusProperties) + if err != nil { + return err + } + mmss.MigrateMySQLStatusProperties = &migrateMySQLStatusProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mmss.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mmss.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mmss.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mmss.Type = &typeVar + } + } + } + + return nil +} + +// MigrateMySQLStatusProperties migrateMySqlStatus resource specific properties +type MigrateMySQLStatusProperties struct { + // MigrationOperationStatus - READ-ONLY; Status of the migration task. Possible values include: 'OperationStatusInProgress', 'OperationStatusFailed', 'OperationStatusSucceeded', 'OperationStatusTimedOut', 'OperationStatusCreated' + MigrationOperationStatus OperationStatus `json:"migrationOperationStatus,omitempty"` + // OperationID - READ-ONLY; Operation ID for the migration task. + OperationID *string `json:"operationId,omitempty"` + // LocalMySQLEnabled - READ-ONLY; True if the web app has in app MySql enabled + LocalMySQLEnabled *bool `json:"localMySqlEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrateMySQLStatusProperties. +func (mmss MigrateMySQLStatusProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// MSDeploy mSDeploy ARM PUT information +type MSDeploy struct { + // MSDeployCore - Core resource properties + *MSDeployCore `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MSDeploy. +func (md MSDeploy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if md.MSDeployCore != nil { + objectMap["properties"] = md.MSDeployCore + } + if md.Kind != nil { + objectMap["kind"] = md.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MSDeploy struct. +func (md *MSDeploy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mSDeployCore MSDeployCore + err = json.Unmarshal(*v, &mSDeployCore) + if err != nil { + return err + } + md.MSDeployCore = &mSDeployCore + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + md.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + md.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + md.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + md.Type = &typeVar + } + } + } + + return nil +} + +// MSDeployCore mSDeploy ARM PUT core information +type MSDeployCore struct { + // PackageURI - Package URI + PackageURI *string `json:"packageUri,omitempty"` + // ConnectionString - SQL Connection String + ConnectionString *string `json:"connectionString,omitempty"` + // DbType - Database Type + DbType *string `json:"dbType,omitempty"` + // SetParametersXMLFileURI - URI of MSDeploy Parameters file. Must not be set if SetParameters is used. + SetParametersXMLFileURI *string `json:"setParametersXmlFileUri,omitempty"` + // SetParameters - MSDeploy Parameters. Must not be set if SetParametersXmlFileUri is used. + SetParameters map[string]*string `json:"setParameters"` + // SkipAppData - Controls whether the MSDeploy operation skips the App_Data directory. + // If set to true, the existing App_Data directory on the destination + // will not be deleted, and any App_Data directory in the source will be ignored. + // Setting is false by default. + SkipAppData *bool `json:"skipAppData,omitempty"` + // AppOffline - Sets the AppOffline rule while the MSDeploy operation executes. + // Setting is false by default. + AppOffline *bool `json:"appOffline,omitempty"` +} + +// MarshalJSON is the custom marshaler for MSDeployCore. +func (mdc MSDeployCore) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mdc.PackageURI != nil { + objectMap["packageUri"] = mdc.PackageURI + } + if mdc.ConnectionString != nil { + objectMap["connectionString"] = mdc.ConnectionString + } + if mdc.DbType != nil { + objectMap["dbType"] = mdc.DbType + } + if mdc.SetParametersXMLFileURI != nil { + objectMap["setParametersXmlFileUri"] = mdc.SetParametersXMLFileURI + } + if mdc.SetParameters != nil { + objectMap["setParameters"] = mdc.SetParameters + } + if mdc.SkipAppData != nil { + objectMap["skipAppData"] = mdc.SkipAppData + } + if mdc.AppOffline != nil { + objectMap["appOffline"] = mdc.AppOffline + } + return json.Marshal(objectMap) +} + +// MSDeployLog mSDeploy log +type MSDeployLog struct { + autorest.Response `json:"-"` + // MSDeployLogProperties - MSDeployLog resource specific properties + *MSDeployLogProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MSDeployLog. +func (mdl MSDeployLog) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mdl.MSDeployLogProperties != nil { + objectMap["properties"] = mdl.MSDeployLogProperties + } + if mdl.Kind != nil { + objectMap["kind"] = mdl.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MSDeployLog struct. +func (mdl *MSDeployLog) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mSDeployLogProperties MSDeployLogProperties + err = json.Unmarshal(*v, &mSDeployLogProperties) + if err != nil { + return err + } + mdl.MSDeployLogProperties = &mSDeployLogProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mdl.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mdl.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mdl.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mdl.Type = &typeVar + } + } + } + + return nil +} + +// MSDeployLogEntry mSDeploy log entry +type MSDeployLogEntry struct { + // Time - READ-ONLY; Timestamp of log entry + Time *date.Time `json:"time,omitempty"` + // Type - READ-ONLY; Log entry type. Possible values include: 'MSDeployLogEntryTypeMessage', 'MSDeployLogEntryTypeWarning', 'MSDeployLogEntryTypeError' + Type MSDeployLogEntryType `json:"type,omitempty"` + // Message - READ-ONLY; Log entry message + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for MSDeployLogEntry. +func (mdle MSDeployLogEntry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// MSDeployLogProperties mSDeployLog resource specific properties +type MSDeployLogProperties struct { + // Entries - READ-ONLY; List of log entry messages + Entries *[]MSDeployLogEntry `json:"entries,omitempty"` +} + +// MarshalJSON is the custom marshaler for MSDeployLogProperties. +func (mdl MSDeployLogProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// MSDeployStatus mSDeploy ARM response +type MSDeployStatus struct { + autorest.Response `json:"-"` + // MSDeployStatusProperties - MSDeployStatus resource specific properties + *MSDeployStatusProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MSDeployStatus. +func (mds MSDeployStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mds.MSDeployStatusProperties != nil { + objectMap["properties"] = mds.MSDeployStatusProperties + } + if mds.Kind != nil { + objectMap["kind"] = mds.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MSDeployStatus struct. +func (mds *MSDeployStatus) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mSDeployStatusProperties MSDeployStatusProperties + err = json.Unmarshal(*v, &mSDeployStatusProperties) + if err != nil { + return err + } + mds.MSDeployStatusProperties = &mSDeployStatusProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mds.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mds.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mds.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mds.Type = &typeVar + } + } + } + + return nil +} + +// MSDeployStatusProperties mSDeployStatus resource specific properties +type MSDeployStatusProperties struct { + // Deployer - READ-ONLY; Username of deployer + Deployer *string `json:"deployer,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state. Possible values include: 'MSDeployProvisioningStateAccepted', 'MSDeployProvisioningStateRunning', 'MSDeployProvisioningStateSucceeded', 'MSDeployProvisioningStateFailed', 'MSDeployProvisioningStateCanceled' + ProvisioningState MSDeployProvisioningState `json:"provisioningState,omitempty"` + // StartTime - READ-ONLY; Start time of deploy operation + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - READ-ONLY; End time of deploy operation + EndTime *date.Time `json:"endTime,omitempty"` + // Complete - READ-ONLY; Whether the deployment operation has completed + Complete *bool `json:"complete,omitempty"` +} + +// MarshalJSON is the custom marshaler for MSDeployStatusProperties. +func (mds MSDeployStatusProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// NameIdentifier identifies an object. +type NameIdentifier struct { + // Name - Name of the object. + Name *string `json:"name,omitempty"` +} + +// NameIdentifierCollection collection of domain name identifiers. +type NameIdentifierCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]NameIdentifier `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for NameIdentifierCollection. +func (nic NameIdentifierCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if nic.Value != nil { + objectMap["value"] = nic.Value + } + return json.Marshal(objectMap) +} + +// NameIdentifierCollectionIterator provides access to a complete listing of NameIdentifier values. +type NameIdentifierCollectionIterator struct { + i int + page NameIdentifierCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *NameIdentifierCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NameIdentifierCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *NameIdentifierCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter NameIdentifierCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter NameIdentifierCollectionIterator) Response() NameIdentifierCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter NameIdentifierCollectionIterator) Value() NameIdentifier { + if !iter.page.NotDone() { + return NameIdentifier{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the NameIdentifierCollectionIterator type. +func NewNameIdentifierCollectionIterator(page NameIdentifierCollectionPage) NameIdentifierCollectionIterator { + return NameIdentifierCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (nic NameIdentifierCollection) IsEmpty() bool { + return nic.Value == nil || len(*nic.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (nic NameIdentifierCollection) hasNextLink() bool { + return nic.NextLink != nil && len(*nic.NextLink) != 0 +} + +// nameIdentifierCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (nic NameIdentifierCollection) nameIdentifierCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !nic.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(nic.NextLink))) +} + +// NameIdentifierCollectionPage contains a page of NameIdentifier values. +type NameIdentifierCollectionPage struct { + fn func(context.Context, NameIdentifierCollection) (NameIdentifierCollection, error) + nic NameIdentifierCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *NameIdentifierCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NameIdentifierCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.nic) + if err != nil { + return err + } + page.nic = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *NameIdentifierCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page NameIdentifierCollectionPage) NotDone() bool { + return !page.nic.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page NameIdentifierCollectionPage) Response() NameIdentifierCollection { + return page.nic +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page NameIdentifierCollectionPage) Values() []NameIdentifier { + if page.nic.IsEmpty() { + return nil + } + return *page.nic.Value +} + +// Creates a new instance of the NameIdentifierCollectionPage type. +func NewNameIdentifierCollectionPage(cur NameIdentifierCollection, getNextPage func(context.Context, NameIdentifierCollection) (NameIdentifierCollection, error)) NameIdentifierCollectionPage { + return NameIdentifierCollectionPage{ + fn: getNextPage, + nic: cur, + } +} + +// NameValuePair name value pair. +type NameValuePair struct { + // Name - Pair name. + Name *string `json:"name,omitempty"` + // Value - Pair value. + Value *string `json:"value,omitempty"` +} + +// NetworkFeatures full view of network features for an app (presently VNET integration and Hybrid +// Connections). +type NetworkFeatures struct { + autorest.Response `json:"-"` + // NetworkFeaturesProperties - NetworkFeatures resource specific properties + *NetworkFeaturesProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetworkFeatures. +func (nf NetworkFeatures) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if nf.NetworkFeaturesProperties != nil { + objectMap["properties"] = nf.NetworkFeaturesProperties + } + if nf.Kind != nil { + objectMap["kind"] = nf.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for NetworkFeatures struct. +func (nf *NetworkFeatures) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var networkFeaturesProperties NetworkFeaturesProperties + err = json.Unmarshal(*v, &networkFeaturesProperties) + if err != nil { + return err + } + nf.NetworkFeaturesProperties = &networkFeaturesProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + nf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + nf.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + nf.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + nf.Type = &typeVar + } + } + } + + return nil +} + +// NetworkFeaturesProperties networkFeatures resource specific properties +type NetworkFeaturesProperties struct { + // VirtualNetworkName - READ-ONLY; The Virtual Network name. + VirtualNetworkName *string `json:"virtualNetworkName,omitempty"` + // VirtualNetworkConnection - READ-ONLY; The Virtual Network summary view. + VirtualNetworkConnection *VnetInfo `json:"virtualNetworkConnection,omitempty"` + // HybridConnections - READ-ONLY; The Hybrid Connections summary view. + HybridConnections *[]RelayServiceConnectionEntity `json:"hybridConnections,omitempty"` + // HybridConnectionsV2 - READ-ONLY; The Hybrid Connection V2 (Service Bus) view. + HybridConnectionsV2 *[]HybridConnection `json:"hybridConnectionsV2,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetworkFeaturesProperties. +func (nf NetworkFeaturesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// NetworkTrace network trace +type NetworkTrace struct { + // Path - Local file path for the captured network trace file. + Path *string `json:"path,omitempty"` + // Status - Current status of the network trace operation, same as Operation.Status (InProgress/Succeeded/Failed). + Status *string `json:"status,omitempty"` + // Message - Detailed message of a network trace operation, e.g. error message in case of failure. + Message *string `json:"message,omitempty"` +} + +// Nonce the configuration settings of the nonce used in the login flow. +type Nonce struct { + // ValidateNonce - false if the nonce should not be validated while completing the login flow; otherwise, true. + ValidateNonce *bool `json:"validateNonce,omitempty"` + // NonceExpirationInterval - The time after the request is made when the nonce should expire. + NonceExpirationInterval *string `json:"nonceExpirationInterval,omitempty"` +} + +// OpenIDConnectClientCredential the authentication client credentials of the custom Open ID Connect +// provider. +type OpenIDConnectClientCredential struct { + // Method - The method that should be used to authenticate the user. Possible values include: 'ClientCredentialMethodClientSecretPost' + Method ClientCredentialMethod `json:"method,omitempty"` + // ClientSecretSettingName - The app setting that contains the client secret for the custom Open ID Connect provider. + ClientSecretSettingName *string `json:"clientSecretSettingName,omitempty"` +} + +// OpenIDConnectConfig the configuration settings of the endpoints used for the custom Open ID Connect +// provider. +type OpenIDConnectConfig struct { + // AuthorizationEndpoint - The endpoint to be used to make an authorization request. + AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` + // TokenEndpoint - The endpoint to be used to request a token. + TokenEndpoint *string `json:"tokenEndpoint,omitempty"` + // Issuer - The endpoint that issues the token. + Issuer *string `json:"issuer,omitempty"` + // CertificationURI - The endpoint that provides the keys necessary to validate the token. + CertificationURI *string `json:"certificationUri,omitempty"` + // WellKnownOpenIDConfiguration - The endpoint that contains all the configuration endpoints for the provider. + WellKnownOpenIDConfiguration *string `json:"wellKnownOpenIdConfiguration,omitempty"` +} + +// OpenIDConnectLogin the configuration settings of the login flow of the custom Open ID Connect provider. +type OpenIDConnectLogin struct { + // NameClaimType - The name of the claim that contains the users name. + NameClaimType *string `json:"nameClaimType,omitempty"` + // Scopes - A list of the scopes that should be requested while authenticating. + Scopes *[]string `json:"scopes,omitempty"` +} + +// OpenIDConnectRegistration the configuration settings of the app registration for the custom Open ID +// Connect provider. +type OpenIDConnectRegistration struct { + // ClientID - The client id of the custom Open ID Connect provider. + ClientID *string `json:"clientId,omitempty"` + // ClientCredential - The authentication credentials of the custom Open ID Connect provider. + ClientCredential *OpenIDConnectClientCredential `json:"clientCredential,omitempty"` + // OpenIDConnectConfiguration - The configuration settings of the endpoints used for the custom Open ID Connect provider. + OpenIDConnectConfiguration *OpenIDConnectConfig `json:"openIdConnectConfiguration,omitempty"` +} + +// Operation an operation on a resource. +type Operation struct { + autorest.Response `json:"-"` + // ID - Operation ID. + ID *string `json:"id,omitempty"` + // Name - Operation name. + Name *string `json:"name,omitempty"` + // Status - The current status of the operation. Possible values include: 'OperationStatusInProgress', 'OperationStatusFailed', 'OperationStatusSucceeded', 'OperationStatusTimedOut', 'OperationStatusCreated' + Status OperationStatus `json:"status,omitempty"` + // Errors - Any errors associate with the operation. + Errors *[]ErrorEntity `json:"errors,omitempty"` + // CreatedTime - Time when operation has started. + CreatedTime *date.Time `json:"createdTime,omitempty"` + // ModifiedTime - Time when operation has been updated. + ModifiedTime *date.Time `json:"modifiedTime,omitempty"` + // ExpirationTime - Time when operation will expire. + ExpirationTime *date.Time `json:"expirationTime,omitempty"` + // GeoMasterOperationID - Applicable only for stamp operation ids. + GeoMasterOperationID *uuid.UUID `json:"geoMasterOperationId,omitempty"` +} + +// OutboundEnvironmentEndpoint endpoints accessed for a common purpose that the App Service Environment +// requires outbound network access to. +type OutboundEnvironmentEndpoint struct { + // Category - The type of service accessed by the App Service Environment, e.g., Azure Storage, Azure SQL Database, and Azure Active Directory. + Category *string `json:"category,omitempty"` + // Endpoints - The endpoints that the App Service Environment reaches the service at. + Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` +} + +// OutboundEnvironmentEndpointCollection collection of Outbound Environment Endpoints +type OutboundEnvironmentEndpointCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]OutboundEnvironmentEndpoint `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutboundEnvironmentEndpointCollection. +func (oeec OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oeec.Value != nil { + objectMap["value"] = oeec.Value + } + return json.Marshal(objectMap) +} + +// OutboundEnvironmentEndpointCollectionIterator provides access to a complete listing of +// OutboundEnvironmentEndpoint values. +type OutboundEnvironmentEndpointCollectionIterator struct { + i int + page OutboundEnvironmentEndpointCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OutboundEnvironmentEndpointCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OutboundEnvironmentEndpointCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OutboundEnvironmentEndpointCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OutboundEnvironmentEndpointCollectionIterator) Response() OutboundEnvironmentEndpointCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OutboundEnvironmentEndpointCollectionIterator) Value() OutboundEnvironmentEndpoint { + if !iter.page.NotDone() { + return OutboundEnvironmentEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OutboundEnvironmentEndpointCollectionIterator type. +func NewOutboundEnvironmentEndpointCollectionIterator(page OutboundEnvironmentEndpointCollectionPage) OutboundEnvironmentEndpointCollectionIterator { + return OutboundEnvironmentEndpointCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (oeec OutboundEnvironmentEndpointCollection) IsEmpty() bool { + return oeec.Value == nil || len(*oeec.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (oeec OutboundEnvironmentEndpointCollection) hasNextLink() bool { + return oeec.NextLink != nil && len(*oeec.NextLink) != 0 +} + +// outboundEnvironmentEndpointCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (oeec OutboundEnvironmentEndpointCollection) outboundEnvironmentEndpointCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !oeec.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(oeec.NextLink))) +} + +// OutboundEnvironmentEndpointCollectionPage contains a page of OutboundEnvironmentEndpoint values. +type OutboundEnvironmentEndpointCollectionPage struct { + fn func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error) + oeec OutboundEnvironmentEndpointCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OutboundEnvironmentEndpointCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.oeec) + if err != nil { + return err + } + page.oeec = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OutboundEnvironmentEndpointCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OutboundEnvironmentEndpointCollectionPage) NotDone() bool { + return !page.oeec.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OutboundEnvironmentEndpointCollectionPage) Response() OutboundEnvironmentEndpointCollection { + return page.oeec +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OutboundEnvironmentEndpointCollectionPage) Values() []OutboundEnvironmentEndpoint { + if page.oeec.IsEmpty() { + return nil + } + return *page.oeec.Value +} + +// Creates a new instance of the OutboundEnvironmentEndpointCollectionPage type. +func NewOutboundEnvironmentEndpointCollectionPage(cur OutboundEnvironmentEndpointCollection, getNextPage func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error)) OutboundEnvironmentEndpointCollectionPage { + return OutboundEnvironmentEndpointCollectionPage{ + fn: getNextPage, + oeec: cur, + } +} + +// PerfMonCounterCollection collection of performance monitor counters. +type PerfMonCounterCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]PerfMonResponse `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PerfMonCounterCollection. +func (pmcc PerfMonCounterCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pmcc.Value != nil { + objectMap["value"] = pmcc.Value + } + return json.Marshal(objectMap) +} + +// PerfMonCounterCollectionIterator provides access to a complete listing of PerfMonResponse values. +type PerfMonCounterCollectionIterator struct { + i int + page PerfMonCounterCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PerfMonCounterCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PerfMonCounterCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PerfMonCounterCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PerfMonCounterCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PerfMonCounterCollectionIterator) Response() PerfMonCounterCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PerfMonCounterCollectionIterator) Value() PerfMonResponse { + if !iter.page.NotDone() { + return PerfMonResponse{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PerfMonCounterCollectionIterator type. +func NewPerfMonCounterCollectionIterator(page PerfMonCounterCollectionPage) PerfMonCounterCollectionIterator { + return PerfMonCounterCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pmcc PerfMonCounterCollection) IsEmpty() bool { + return pmcc.Value == nil || len(*pmcc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pmcc PerfMonCounterCollection) hasNextLink() bool { + return pmcc.NextLink != nil && len(*pmcc.NextLink) != 0 +} + +// perfMonCounterCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pmcc PerfMonCounterCollection) perfMonCounterCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !pmcc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pmcc.NextLink))) +} + +// PerfMonCounterCollectionPage contains a page of PerfMonResponse values. +type PerfMonCounterCollectionPage struct { + fn func(context.Context, PerfMonCounterCollection) (PerfMonCounterCollection, error) + pmcc PerfMonCounterCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PerfMonCounterCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PerfMonCounterCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pmcc) + if err != nil { + return err + } + page.pmcc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PerfMonCounterCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PerfMonCounterCollectionPage) NotDone() bool { + return !page.pmcc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PerfMonCounterCollectionPage) Response() PerfMonCounterCollection { + return page.pmcc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PerfMonCounterCollectionPage) Values() []PerfMonResponse { + if page.pmcc.IsEmpty() { + return nil + } + return *page.pmcc.Value +} + +// Creates a new instance of the PerfMonCounterCollectionPage type. +func NewPerfMonCounterCollectionPage(cur PerfMonCounterCollection, getNextPage func(context.Context, PerfMonCounterCollection) (PerfMonCounterCollection, error)) PerfMonCounterCollectionPage { + return PerfMonCounterCollectionPage{ + fn: getNextPage, + pmcc: cur, + } +} + +// PerfMonResponse performance monitor API response. +type PerfMonResponse struct { + // Code - The response code. + Code *string `json:"code,omitempty"` + // Message - The message. + Message *string `json:"message,omitempty"` + // Data - The performance monitor counters. + Data *PerfMonSet `json:"data,omitempty"` +} + +// PerfMonSample performance monitor sample in a set. +type PerfMonSample struct { + // Time - Point in time for which counter was measured. + Time *date.Time `json:"time,omitempty"` + // InstanceName - Name of the server on which the measurement is made. + InstanceName *string `json:"instanceName,omitempty"` + // Value - Value of counter at a certain time. + Value *float64 `json:"value,omitempty"` +} + +// PerfMonSet metric information. +type PerfMonSet struct { + // Name - Unique key name of the counter. + Name *string `json:"name,omitempty"` + // StartTime - Start time of the period. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - End time of the period. + EndTime *date.Time `json:"endTime,omitempty"` + // TimeGrain - Presented time grain. + TimeGrain *string `json:"timeGrain,omitempty"` + // Values - Collection of workers that are active during this time. + Values *[]PerfMonSample `json:"values,omitempty"` +} + +// PremierAddOn premier add-on. +type PremierAddOn struct { + autorest.Response `json:"-"` + // PremierAddOnProperties - PremierAddOn resource specific properties + *PremierAddOnProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Location - Resource Location. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PremierAddOn. +func (pao PremierAddOn) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pao.PremierAddOnProperties != nil { + objectMap["properties"] = pao.PremierAddOnProperties + } + if pao.Kind != nil { + objectMap["kind"] = pao.Kind + } + if pao.Location != nil { + objectMap["location"] = pao.Location + } + if pao.Tags != nil { + objectMap["tags"] = pao.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PremierAddOn struct. +func (pao *PremierAddOn) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var premierAddOnProperties PremierAddOnProperties + err = json.Unmarshal(*v, &premierAddOnProperties) + if err != nil { + return err + } + pao.PremierAddOnProperties = &premierAddOnProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pao.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pao.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + pao.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pao.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pao.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pao.Tags = tags + } + } + } + + return nil +} + +// PremierAddOnOffer premier add-on offer. +type PremierAddOnOffer struct { + // PremierAddOnOfferProperties - PremierAddOnOffer resource specific properties + *PremierAddOnOfferProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PremierAddOnOffer. +func (paoo PremierAddOnOffer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if paoo.PremierAddOnOfferProperties != nil { + objectMap["properties"] = paoo.PremierAddOnOfferProperties + } + if paoo.Kind != nil { + objectMap["kind"] = paoo.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PremierAddOnOffer struct. +func (paoo *PremierAddOnOffer) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var premierAddOnOfferProperties PremierAddOnOfferProperties + err = json.Unmarshal(*v, &premierAddOnOfferProperties) + if err != nil { + return err + } + paoo.PremierAddOnOfferProperties = &premierAddOnOfferProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + paoo.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + paoo.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + paoo.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + paoo.Type = &typeVar + } + } + } + + return nil +} + +// PremierAddOnOfferCollection collection of premier add-on offers. +type PremierAddOnOfferCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]PremierAddOnOffer `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PremierAddOnOfferCollection. +func (paooc PremierAddOnOfferCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if paooc.Value != nil { + objectMap["value"] = paooc.Value + } + return json.Marshal(objectMap) +} + +// PremierAddOnOfferCollectionIterator provides access to a complete listing of PremierAddOnOffer values. +type PremierAddOnOfferCollectionIterator struct { + i int + page PremierAddOnOfferCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PremierAddOnOfferCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PremierAddOnOfferCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PremierAddOnOfferCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PremierAddOnOfferCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PremierAddOnOfferCollectionIterator) Response() PremierAddOnOfferCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PremierAddOnOfferCollectionIterator) Value() PremierAddOnOffer { + if !iter.page.NotDone() { + return PremierAddOnOffer{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PremierAddOnOfferCollectionIterator type. +func NewPremierAddOnOfferCollectionIterator(page PremierAddOnOfferCollectionPage) PremierAddOnOfferCollectionIterator { + return PremierAddOnOfferCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (paooc PremierAddOnOfferCollection) IsEmpty() bool { + return paooc.Value == nil || len(*paooc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (paooc PremierAddOnOfferCollection) hasNextLink() bool { + return paooc.NextLink != nil && len(*paooc.NextLink) != 0 +} + +// premierAddOnOfferCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (paooc PremierAddOnOfferCollection) premierAddOnOfferCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !paooc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(paooc.NextLink))) +} + +// PremierAddOnOfferCollectionPage contains a page of PremierAddOnOffer values. +type PremierAddOnOfferCollectionPage struct { + fn func(context.Context, PremierAddOnOfferCollection) (PremierAddOnOfferCollection, error) + paooc PremierAddOnOfferCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PremierAddOnOfferCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PremierAddOnOfferCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.paooc) + if err != nil { + return err + } + page.paooc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PremierAddOnOfferCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PremierAddOnOfferCollectionPage) NotDone() bool { + return !page.paooc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PremierAddOnOfferCollectionPage) Response() PremierAddOnOfferCollection { + return page.paooc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PremierAddOnOfferCollectionPage) Values() []PremierAddOnOffer { + if page.paooc.IsEmpty() { + return nil + } + return *page.paooc.Value +} + +// Creates a new instance of the PremierAddOnOfferCollectionPage type. +func NewPremierAddOnOfferCollectionPage(cur PremierAddOnOfferCollection, getNextPage func(context.Context, PremierAddOnOfferCollection) (PremierAddOnOfferCollection, error)) PremierAddOnOfferCollectionPage { + return PremierAddOnOfferCollectionPage{ + fn: getNextPage, + paooc: cur, + } +} + +// PremierAddOnOfferProperties premierAddOnOffer resource specific properties +type PremierAddOnOfferProperties struct { + // Sku - Premier add on SKU. + Sku *string `json:"sku,omitempty"` + // Product - Premier add on offer Product. + Product *string `json:"product,omitempty"` + // Vendor - Premier add on offer Vendor. + Vendor *string `json:"vendor,omitempty"` + // PromoCodeRequired - true if promotion code is required; otherwise, false. + PromoCodeRequired *bool `json:"promoCodeRequired,omitempty"` + // Quota - Premier add on offer Quota. + Quota *int32 `json:"quota,omitempty"` + // WebHostingPlanRestrictions - App Service plans this offer is restricted to. Possible values include: 'AppServicePlanRestrictionsNone', 'AppServicePlanRestrictionsFree', 'AppServicePlanRestrictionsShared', 'AppServicePlanRestrictionsBasic', 'AppServicePlanRestrictionsStandard', 'AppServicePlanRestrictionsPremium' + WebHostingPlanRestrictions AppServicePlanRestrictions `json:"webHostingPlanRestrictions,omitempty"` + // PrivacyPolicyURL - Privacy policy URL. + PrivacyPolicyURL *string `json:"privacyPolicyUrl,omitempty"` + // LegalTermsURL - Legal terms URL. + LegalTermsURL *string `json:"legalTermsUrl,omitempty"` + // MarketplacePublisher - Marketplace publisher. + MarketplacePublisher *string `json:"marketplacePublisher,omitempty"` + // MarketplaceOffer - Marketplace offer. + MarketplaceOffer *string `json:"marketplaceOffer,omitempty"` +} + +// PremierAddOnPatchResource ARM resource for a PremierAddOn. +type PremierAddOnPatchResource struct { + // PremierAddOnPatchResourceProperties - PremierAddOnPatchResource resource specific properties + *PremierAddOnPatchResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PremierAddOnPatchResource. +func (paopr PremierAddOnPatchResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if paopr.PremierAddOnPatchResourceProperties != nil { + objectMap["properties"] = paopr.PremierAddOnPatchResourceProperties + } + if paopr.Kind != nil { + objectMap["kind"] = paopr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PremierAddOnPatchResource struct. +func (paopr *PremierAddOnPatchResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var premierAddOnPatchResourceProperties PremierAddOnPatchResourceProperties + err = json.Unmarshal(*v, &premierAddOnPatchResourceProperties) + if err != nil { + return err + } + paopr.PremierAddOnPatchResourceProperties = &premierAddOnPatchResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + paopr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + paopr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + paopr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + paopr.Type = &typeVar + } + } + } + + return nil +} + +// PremierAddOnPatchResourceProperties premierAddOnPatchResource resource specific properties +type PremierAddOnPatchResourceProperties struct { + // Sku - Premier add on SKU. + Sku *string `json:"sku,omitempty"` + // Product - Premier add on Product. + Product *string `json:"product,omitempty"` + // Vendor - Premier add on Vendor. + Vendor *string `json:"vendor,omitempty"` + // MarketplacePublisher - Premier add on Marketplace publisher. + MarketplacePublisher *string `json:"marketplacePublisher,omitempty"` + // MarketplaceOffer - Premier add on Marketplace offer. + MarketplaceOffer *string `json:"marketplaceOffer,omitempty"` +} + +// PremierAddOnProperties premierAddOn resource specific properties +type PremierAddOnProperties struct { + // Sku - Premier add on SKU. + Sku *string `json:"sku,omitempty"` + // Product - Premier add on Product. + Product *string `json:"product,omitempty"` + // Vendor - Premier add on Vendor. + Vendor *string `json:"vendor,omitempty"` + // MarketplacePublisher - Premier add on Marketplace publisher. + MarketplacePublisher *string `json:"marketplacePublisher,omitempty"` + // MarketplaceOffer - Premier add on Marketplace offer. + MarketplaceOffer *string `json:"marketplaceOffer,omitempty"` +} + +// PrivateAccess description of the parameters of Private Access for a Web Site. +type PrivateAccess struct { + autorest.Response `json:"-"` + // PrivateAccessProperties - PrivateAccess resource specific properties + *PrivateAccessProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateAccess. +func (pa PrivateAccess) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pa.PrivateAccessProperties != nil { + objectMap["properties"] = pa.PrivateAccessProperties + } + if pa.Kind != nil { + objectMap["kind"] = pa.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateAccess struct. +func (pa *PrivateAccess) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateAccessProperties PrivateAccessProperties + err = json.Unmarshal(*v, &privateAccessProperties) + if err != nil { + return err + } + pa.PrivateAccessProperties = &privateAccessProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pa.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + pa.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pa.Type = &typeVar + } + } + } + + return nil +} + +// PrivateAccessProperties privateAccess resource specific properties +type PrivateAccessProperties struct { + // Enabled - Whether private access is enabled or not. + Enabled *bool `json:"enabled,omitempty"` + // VirtualNetworks - The Virtual Networks (and subnets) allowed to access the site privately. + VirtualNetworks *[]PrivateAccessVirtualNetwork `json:"virtualNetworks,omitempty"` +} + +// PrivateAccessSubnet description of a Virtual Network subnet that is useable for private site access. +type PrivateAccessSubnet struct { + // Name - The name of the subnet. + Name *string `json:"name,omitempty"` + // Key - The key (ID) of the subnet. + Key *int32 `json:"key,omitempty"` +} + +// PrivateAccessVirtualNetwork description of a Virtual Network that is useable for private site access. +type PrivateAccessVirtualNetwork struct { + // Name - The name of the Virtual Network. + Name *string `json:"name,omitempty"` + // Key - The key (ID) of the Virtual Network. + Key *int32 `json:"key,omitempty"` + // ResourceID - The ARM uri of the Virtual Network + ResourceID *string `json:"resourceId,omitempty"` + // Subnets - A List of subnets that access is allowed to on this Virtual Network. An empty array (but not null) is interpreted to mean that all subnets are allowed within this Virtual Network. + Subnets *[]PrivateAccessSubnet `json:"subnets,omitempty"` +} + +// PrivateEndpointConnectionCollection ... +type PrivateEndpointConnectionCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]RemotePrivateEndpointConnectionARMResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionCollection. +func (pecc PrivateEndpointConnectionCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pecc.Value != nil { + objectMap["value"] = pecc.Value + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionCollectionIterator provides access to a complete listing of +// RemotePrivateEndpointConnectionARMResource values. +type PrivateEndpointConnectionCollectionIterator struct { + i int + page PrivateEndpointConnectionCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateEndpointConnectionCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateEndpointConnectionCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateEndpointConnectionCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateEndpointConnectionCollectionIterator) Response() PrivateEndpointConnectionCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateEndpointConnectionCollectionIterator) Value() RemotePrivateEndpointConnectionARMResource { + if !iter.page.NotDone() { + return RemotePrivateEndpointConnectionARMResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateEndpointConnectionCollectionIterator type. +func NewPrivateEndpointConnectionCollectionIterator(page PrivateEndpointConnectionCollectionPage) PrivateEndpointConnectionCollectionIterator { + return PrivateEndpointConnectionCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pecc PrivateEndpointConnectionCollection) IsEmpty() bool { + return pecc.Value == nil || len(*pecc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pecc PrivateEndpointConnectionCollection) hasNextLink() bool { + return pecc.NextLink != nil && len(*pecc.NextLink) != 0 +} + +// privateEndpointConnectionCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pecc PrivateEndpointConnectionCollection) privateEndpointConnectionCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !pecc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pecc.NextLink))) +} + +// PrivateEndpointConnectionCollectionPage contains a page of RemotePrivateEndpointConnectionARMResource +// values. +type PrivateEndpointConnectionCollectionPage struct { + fn func(context.Context, PrivateEndpointConnectionCollection) (PrivateEndpointConnectionCollection, error) + pecc PrivateEndpointConnectionCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateEndpointConnectionCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pecc) + if err != nil { + return err + } + page.pecc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateEndpointConnectionCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateEndpointConnectionCollectionPage) NotDone() bool { + return !page.pecc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateEndpointConnectionCollectionPage) Response() PrivateEndpointConnectionCollection { + return page.pecc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateEndpointConnectionCollectionPage) Values() []RemotePrivateEndpointConnectionARMResource { + if page.pecc.IsEmpty() { + return nil + } + return *page.pecc.Value +} + +// Creates a new instance of the PrivateEndpointConnectionCollectionPage type. +func NewPrivateEndpointConnectionCollectionPage(cur PrivateEndpointConnectionCollection, getNextPage func(context.Context, PrivateEndpointConnectionCollection) (PrivateEndpointConnectionCollection, error)) PrivateEndpointConnectionCollectionPage { + return PrivateEndpointConnectionCollectionPage{ + fn: getNextPage, + pecc: cur, + } +} + +// PrivateLinkConnectionApprovalRequest a request to approve or reject a private endpoint connection +type PrivateLinkConnectionApprovalRequest struct { + PrivateLinkServiceConnectionState *PrivateLinkConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} + +// PrivateLinkConnectionApprovalRequestResource private Endpoint Connection Approval ARM resource. +type PrivateLinkConnectionApprovalRequestResource struct { + // PrivateLinkConnectionApprovalRequest - Core resource properties + *PrivateLinkConnectionApprovalRequest `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkConnectionApprovalRequestResource. +func (plcarr PrivateLinkConnectionApprovalRequestResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plcarr.PrivateLinkConnectionApprovalRequest != nil { + objectMap["properties"] = plcarr.PrivateLinkConnectionApprovalRequest + } + if plcarr.Kind != nil { + objectMap["kind"] = plcarr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkConnectionApprovalRequestResource struct. +func (plcarr *PrivateLinkConnectionApprovalRequestResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkConnectionApprovalRequest PrivateLinkConnectionApprovalRequest + err = json.Unmarshal(*v, &privateLinkConnectionApprovalRequest) + if err != nil { + return err + } + plcarr.PrivateLinkConnectionApprovalRequest = &privateLinkConnectionApprovalRequest + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plcarr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plcarr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + plcarr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plcarr.Type = &typeVar + } + } + } + + return nil +} + +// PrivateLinkConnectionState the state of a private link connection +type PrivateLinkConnectionState struct { + // Status - Status of a private link connection + Status *string `json:"status,omitempty"` + // Description - Description of a private link connection + Description *string `json:"description,omitempty"` + // ActionsRequired - ActionsRequired for a private link connection + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// PrivateLinkResource a private link resource +type PrivateLinkResource struct { + ID *string `json:"id,omitempty"` + // Name - Name of a private link resource + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + // Properties - Properties of a private link resource + Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` +} + +// PrivateLinkResourceProperties properties of a private link resource +type PrivateLinkResourceProperties struct { + // GroupID - READ-ONLY; GroupId of a private link resource + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - READ-ONLY; RequiredMembers of a private link resource + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - READ-ONLY; RequiredZoneNames of a private link resource + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. +func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateLinkResourcesWrapper wrapper for a collection of private link resources +type PrivateLinkResourcesWrapper struct { + autorest.Response `json:"-"` + Value *[]PrivateLinkResource `json:"value,omitempty"` +} + +// ProcessInfo process Information. +type ProcessInfo struct { + autorest.Response `json:"-"` + // ProcessInfoProperties - ProcessInfo resource specific properties + *ProcessInfoProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProcessInfo. +func (pi ProcessInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pi.ProcessInfoProperties != nil { + objectMap["properties"] = pi.ProcessInfoProperties + } + if pi.Kind != nil { + objectMap["kind"] = pi.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ProcessInfo struct. +func (pi *ProcessInfo) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var processInfoProperties ProcessInfoProperties + err = json.Unmarshal(*v, &processInfoProperties) + if err != nil { + return err + } + pi.ProcessInfoProperties = &processInfoProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pi.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + pi.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pi.Type = &typeVar + } + } + } + + return nil +} + +// ProcessInfoCollection collection of Kudu process information elements. +type ProcessInfoCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]ProcessInfo `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProcessInfoCollection. +func (pic ProcessInfoCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pic.Value != nil { + objectMap["value"] = pic.Value + } + return json.Marshal(objectMap) +} + +// ProcessInfoCollectionIterator provides access to a complete listing of ProcessInfo values. +type ProcessInfoCollectionIterator struct { + i int + page ProcessInfoCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ProcessInfoCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProcessInfoCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ProcessInfoCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ProcessInfoCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ProcessInfoCollectionIterator) Response() ProcessInfoCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ProcessInfoCollectionIterator) Value() ProcessInfo { + if !iter.page.NotDone() { + return ProcessInfo{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ProcessInfoCollectionIterator type. +func NewProcessInfoCollectionIterator(page ProcessInfoCollectionPage) ProcessInfoCollectionIterator { + return ProcessInfoCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pic ProcessInfoCollection) IsEmpty() bool { + return pic.Value == nil || len(*pic.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pic ProcessInfoCollection) hasNextLink() bool { + return pic.NextLink != nil && len(*pic.NextLink) != 0 +} + +// processInfoCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pic ProcessInfoCollection) processInfoCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !pic.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pic.NextLink))) +} + +// ProcessInfoCollectionPage contains a page of ProcessInfo values. +type ProcessInfoCollectionPage struct { + fn func(context.Context, ProcessInfoCollection) (ProcessInfoCollection, error) + pic ProcessInfoCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ProcessInfoCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProcessInfoCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pic) + if err != nil { + return err + } + page.pic = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ProcessInfoCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ProcessInfoCollectionPage) NotDone() bool { + return !page.pic.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ProcessInfoCollectionPage) Response() ProcessInfoCollection { + return page.pic +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ProcessInfoCollectionPage) Values() []ProcessInfo { + if page.pic.IsEmpty() { + return nil + } + return *page.pic.Value +} + +// Creates a new instance of the ProcessInfoCollectionPage type. +func NewProcessInfoCollectionPage(cur ProcessInfoCollection, getNextPage func(context.Context, ProcessInfoCollection) (ProcessInfoCollection, error)) ProcessInfoCollectionPage { + return ProcessInfoCollectionPage{ + fn: getNextPage, + pic: cur, + } +} + +// ProcessInfoProperties processInfo resource specific properties +type ProcessInfoProperties struct { + // Identifier - READ-ONLY; ARM Identifier for deployment. + Identifier *int32 `json:"identifier,omitempty"` + // DeploymentName - Deployment name. + DeploymentName *string `json:"deployment_name,omitempty"` + // Href - HRef URI. + Href *string `json:"href,omitempty"` + // Minidump - Minidump URI. + Minidump *string `json:"minidump,omitempty"` + // IsProfileRunning - Is profile running? + IsProfileRunning *bool `json:"is_profile_running,omitempty"` + // IsIisProfileRunning - Is the IIS Profile running? + IsIisProfileRunning *bool `json:"is_iis_profile_running,omitempty"` + // IisProfileTimeoutInSeconds - IIS Profile timeout (seconds). + IisProfileTimeoutInSeconds *float64 `json:"iis_profile_timeout_in_seconds,omitempty"` + // Parent - Parent process. + Parent *string `json:"parent,omitempty"` + // Children - Child process list. + Children *[]string `json:"children,omitempty"` + // Threads - Thread list. + Threads *[]ProcessThreadInfo `json:"threads,omitempty"` + // OpenFileHandles - List of open files. + OpenFileHandles *[]string `json:"open_file_handles,omitempty"` + // Modules - List of modules. + Modules *[]ProcessModuleInfo `json:"modules,omitempty"` + // FileName - File name of this process. + FileName *string `json:"file_name,omitempty"` + // CommandLine - Command line. + CommandLine *string `json:"command_line,omitempty"` + // UserName - User name. + UserName *string `json:"user_name,omitempty"` + // HandleCount - Handle count. + HandleCount *int32 `json:"handle_count,omitempty"` + // ModuleCount - Module count. + ModuleCount *int32 `json:"module_count,omitempty"` + // ThreadCount - Thread count. + ThreadCount *int32 `json:"thread_count,omitempty"` + // StartTime - Start time. + StartTime *date.Time `json:"start_time,omitempty"` + // TotalCPUTime - Total CPU time. + TotalCPUTime *string `json:"total_cpu_time,omitempty"` + // UserCPUTime - User CPU time. + UserCPUTime *string `json:"user_cpu_time,omitempty"` + // PrivilegedCPUTime - Privileged CPU time. + PrivilegedCPUTime *string `json:"privileged_cpu_time,omitempty"` + // WorkingSet - Working set. + WorkingSet *int64 `json:"working_set,omitempty"` + // PeakWorkingSet - Peak working set. + PeakWorkingSet *int64 `json:"peak_working_set,omitempty"` + // PrivateMemory - Private memory size. + PrivateMemory *int64 `json:"private_memory,omitempty"` + // VirtualMemory - Virtual memory size. + VirtualMemory *int64 `json:"virtual_memory,omitempty"` + // PeakVirtualMemory - Peak virtual memory usage. + PeakVirtualMemory *int64 `json:"peak_virtual_memory,omitempty"` + // PagedSystemMemory - Paged system memory. + PagedSystemMemory *int64 `json:"paged_system_memory,omitempty"` + // NonPagedSystemMemory - Non-paged system memory. + NonPagedSystemMemory *int64 `json:"non_paged_system_memory,omitempty"` + // PagedMemory - Paged memory. + PagedMemory *int64 `json:"paged_memory,omitempty"` + // PeakPagedMemory - Peak paged memory. + PeakPagedMemory *int64 `json:"peak_paged_memory,omitempty"` + // TimeStamp - Time stamp. + TimeStamp *date.Time `json:"time_stamp,omitempty"` + // EnvironmentVariables - List of environment variables. + EnvironmentVariables map[string]*string `json:"environment_variables"` + // IsScmSite - Is this the SCM site? + IsScmSite *bool `json:"is_scm_site,omitempty"` + // IsWebjob - Is this a Web Job? + IsWebjob *bool `json:"is_webjob,omitempty"` + // Description - Description of process. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProcessInfoProperties. +func (pi ProcessInfoProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pi.DeploymentName != nil { + objectMap["deployment_name"] = pi.DeploymentName + } + if pi.Href != nil { + objectMap["href"] = pi.Href + } + if pi.Minidump != nil { + objectMap["minidump"] = pi.Minidump + } + if pi.IsProfileRunning != nil { + objectMap["is_profile_running"] = pi.IsProfileRunning + } + if pi.IsIisProfileRunning != nil { + objectMap["is_iis_profile_running"] = pi.IsIisProfileRunning + } + if pi.IisProfileTimeoutInSeconds != nil { + objectMap["iis_profile_timeout_in_seconds"] = pi.IisProfileTimeoutInSeconds + } + if pi.Parent != nil { + objectMap["parent"] = pi.Parent + } + if pi.Children != nil { + objectMap["children"] = pi.Children + } + if pi.Threads != nil { + objectMap["threads"] = pi.Threads + } + if pi.OpenFileHandles != nil { + objectMap["open_file_handles"] = pi.OpenFileHandles + } + if pi.Modules != nil { + objectMap["modules"] = pi.Modules + } + if pi.FileName != nil { + objectMap["file_name"] = pi.FileName + } + if pi.CommandLine != nil { + objectMap["command_line"] = pi.CommandLine + } + if pi.UserName != nil { + objectMap["user_name"] = pi.UserName + } + if pi.HandleCount != nil { + objectMap["handle_count"] = pi.HandleCount + } + if pi.ModuleCount != nil { + objectMap["module_count"] = pi.ModuleCount + } + if pi.ThreadCount != nil { + objectMap["thread_count"] = pi.ThreadCount + } + if pi.StartTime != nil { + objectMap["start_time"] = pi.StartTime + } + if pi.TotalCPUTime != nil { + objectMap["total_cpu_time"] = pi.TotalCPUTime + } + if pi.UserCPUTime != nil { + objectMap["user_cpu_time"] = pi.UserCPUTime + } + if pi.PrivilegedCPUTime != nil { + objectMap["privileged_cpu_time"] = pi.PrivilegedCPUTime + } + if pi.WorkingSet != nil { + objectMap["working_set"] = pi.WorkingSet + } + if pi.PeakWorkingSet != nil { + objectMap["peak_working_set"] = pi.PeakWorkingSet + } + if pi.PrivateMemory != nil { + objectMap["private_memory"] = pi.PrivateMemory + } + if pi.VirtualMemory != nil { + objectMap["virtual_memory"] = pi.VirtualMemory + } + if pi.PeakVirtualMemory != nil { + objectMap["peak_virtual_memory"] = pi.PeakVirtualMemory + } + if pi.PagedSystemMemory != nil { + objectMap["paged_system_memory"] = pi.PagedSystemMemory + } + if pi.NonPagedSystemMemory != nil { + objectMap["non_paged_system_memory"] = pi.NonPagedSystemMemory + } + if pi.PagedMemory != nil { + objectMap["paged_memory"] = pi.PagedMemory + } + if pi.PeakPagedMemory != nil { + objectMap["peak_paged_memory"] = pi.PeakPagedMemory + } + if pi.TimeStamp != nil { + objectMap["time_stamp"] = pi.TimeStamp + } + if pi.EnvironmentVariables != nil { + objectMap["environment_variables"] = pi.EnvironmentVariables + } + if pi.IsScmSite != nil { + objectMap["is_scm_site"] = pi.IsScmSite + } + if pi.IsWebjob != nil { + objectMap["is_webjob"] = pi.IsWebjob + } + if pi.Description != nil { + objectMap["description"] = pi.Description + } + return json.Marshal(objectMap) +} + +// ProcessModuleInfo process Module Information. +type ProcessModuleInfo struct { + autorest.Response `json:"-"` + // ProcessModuleInfoProperties - ProcessModuleInfo resource specific properties + *ProcessModuleInfoProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProcessModuleInfo. +func (pmi ProcessModuleInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pmi.ProcessModuleInfoProperties != nil { + objectMap["properties"] = pmi.ProcessModuleInfoProperties + } + if pmi.Kind != nil { + objectMap["kind"] = pmi.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ProcessModuleInfo struct. +func (pmi *ProcessModuleInfo) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var processModuleInfoProperties ProcessModuleInfoProperties + err = json.Unmarshal(*v, &processModuleInfoProperties) + if err != nil { + return err + } + pmi.ProcessModuleInfoProperties = &processModuleInfoProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pmi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pmi.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + pmi.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pmi.Type = &typeVar + } + } + } + + return nil +} + +// ProcessModuleInfoCollection collection of Kudu thread information elements. +type ProcessModuleInfoCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]ProcessModuleInfo `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProcessModuleInfoCollection. +func (pmic ProcessModuleInfoCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pmic.Value != nil { + objectMap["value"] = pmic.Value + } + return json.Marshal(objectMap) +} + +// ProcessModuleInfoCollectionIterator provides access to a complete listing of ProcessModuleInfo values. +type ProcessModuleInfoCollectionIterator struct { + i int + page ProcessModuleInfoCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ProcessModuleInfoCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProcessModuleInfoCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ProcessModuleInfoCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ProcessModuleInfoCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ProcessModuleInfoCollectionIterator) Response() ProcessModuleInfoCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ProcessModuleInfoCollectionIterator) Value() ProcessModuleInfo { + if !iter.page.NotDone() { + return ProcessModuleInfo{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ProcessModuleInfoCollectionIterator type. +func NewProcessModuleInfoCollectionIterator(page ProcessModuleInfoCollectionPage) ProcessModuleInfoCollectionIterator { + return ProcessModuleInfoCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pmic ProcessModuleInfoCollection) IsEmpty() bool { + return pmic.Value == nil || len(*pmic.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pmic ProcessModuleInfoCollection) hasNextLink() bool { + return pmic.NextLink != nil && len(*pmic.NextLink) != 0 +} + +// processModuleInfoCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pmic ProcessModuleInfoCollection) processModuleInfoCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !pmic.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pmic.NextLink))) +} + +// ProcessModuleInfoCollectionPage contains a page of ProcessModuleInfo values. +type ProcessModuleInfoCollectionPage struct { + fn func(context.Context, ProcessModuleInfoCollection) (ProcessModuleInfoCollection, error) + pmic ProcessModuleInfoCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ProcessModuleInfoCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProcessModuleInfoCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pmic) + if err != nil { + return err + } + page.pmic = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ProcessModuleInfoCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ProcessModuleInfoCollectionPage) NotDone() bool { + return !page.pmic.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ProcessModuleInfoCollectionPage) Response() ProcessModuleInfoCollection { + return page.pmic +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ProcessModuleInfoCollectionPage) Values() []ProcessModuleInfo { + if page.pmic.IsEmpty() { + return nil + } + return *page.pmic.Value +} + +// Creates a new instance of the ProcessModuleInfoCollectionPage type. +func NewProcessModuleInfoCollectionPage(cur ProcessModuleInfoCollection, getNextPage func(context.Context, ProcessModuleInfoCollection) (ProcessModuleInfoCollection, error)) ProcessModuleInfoCollectionPage { + return ProcessModuleInfoCollectionPage{ + fn: getNextPage, + pmic: cur, + } +} + +// ProcessModuleInfoProperties processModuleInfo resource specific properties +type ProcessModuleInfoProperties struct { + // BaseAddress - Base address. Used as module identifier in ARM resource URI. + BaseAddress *string `json:"base_address,omitempty"` + // FileName - File name. + FileName *string `json:"file_name,omitempty"` + // Href - HRef URI. + Href *string `json:"href,omitempty"` + // FilePath - File path. + FilePath *string `json:"file_path,omitempty"` + // ModuleMemorySize - Module memory size. + ModuleMemorySize *int32 `json:"module_memory_size,omitempty"` + // FileVersion - File version. + FileVersion *string `json:"file_version,omitempty"` + // FileDescription - File description. + FileDescription *string `json:"file_description,omitempty"` + // Product - Product name. + Product *string `json:"product,omitempty"` + // ProductVersion - Product version. + ProductVersion *string `json:"product_version,omitempty"` + // IsDebug - Is debug? + IsDebug *bool `json:"is_debug,omitempty"` + // Language - Module language (locale). + Language *string `json:"language,omitempty"` +} + +// ProcessThreadInfo process Thread Information. +type ProcessThreadInfo struct { + // ProcessThreadInfoProperties - ProcessThreadInfo resource specific properties + *ProcessThreadInfoProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProcessThreadInfo. +func (pti ProcessThreadInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pti.ProcessThreadInfoProperties != nil { + objectMap["properties"] = pti.ProcessThreadInfoProperties + } + if pti.Kind != nil { + objectMap["kind"] = pti.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ProcessThreadInfo struct. +func (pti *ProcessThreadInfo) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var processThreadInfoProperties ProcessThreadInfoProperties + err = json.Unmarshal(*v, &processThreadInfoProperties) + if err != nil { + return err + } + pti.ProcessThreadInfoProperties = &processThreadInfoProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pti.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pti.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + pti.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pti.Type = &typeVar + } + } + } + + return nil +} + +// ProcessThreadInfoCollection collection of Kudu thread information elements. +type ProcessThreadInfoCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]ProcessThreadInfo `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProcessThreadInfoCollection. +func (ptic ProcessThreadInfoCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ptic.Value != nil { + objectMap["value"] = ptic.Value + } + return json.Marshal(objectMap) +} + +// ProcessThreadInfoCollectionIterator provides access to a complete listing of ProcessThreadInfo values. +type ProcessThreadInfoCollectionIterator struct { + i int + page ProcessThreadInfoCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ProcessThreadInfoCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProcessThreadInfoCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ProcessThreadInfoCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ProcessThreadInfoCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ProcessThreadInfoCollectionIterator) Response() ProcessThreadInfoCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ProcessThreadInfoCollectionIterator) Value() ProcessThreadInfo { + if !iter.page.NotDone() { + return ProcessThreadInfo{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ProcessThreadInfoCollectionIterator type. +func NewProcessThreadInfoCollectionIterator(page ProcessThreadInfoCollectionPage) ProcessThreadInfoCollectionIterator { + return ProcessThreadInfoCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ptic ProcessThreadInfoCollection) IsEmpty() bool { + return ptic.Value == nil || len(*ptic.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ptic ProcessThreadInfoCollection) hasNextLink() bool { + return ptic.NextLink != nil && len(*ptic.NextLink) != 0 +} + +// processThreadInfoCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ptic ProcessThreadInfoCollection) processThreadInfoCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !ptic.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ptic.NextLink))) +} + +// ProcessThreadInfoCollectionPage contains a page of ProcessThreadInfo values. +type ProcessThreadInfoCollectionPage struct { + fn func(context.Context, ProcessThreadInfoCollection) (ProcessThreadInfoCollection, error) + ptic ProcessThreadInfoCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ProcessThreadInfoCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProcessThreadInfoCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ptic) + if err != nil { + return err + } + page.ptic = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ProcessThreadInfoCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ProcessThreadInfoCollectionPage) NotDone() bool { + return !page.ptic.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ProcessThreadInfoCollectionPage) Response() ProcessThreadInfoCollection { + return page.ptic +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ProcessThreadInfoCollectionPage) Values() []ProcessThreadInfo { + if page.ptic.IsEmpty() { + return nil + } + return *page.ptic.Value +} + +// Creates a new instance of the ProcessThreadInfoCollectionPage type. +func NewProcessThreadInfoCollectionPage(cur ProcessThreadInfoCollection, getNextPage func(context.Context, ProcessThreadInfoCollection) (ProcessThreadInfoCollection, error)) ProcessThreadInfoCollectionPage { + return ProcessThreadInfoCollectionPage{ + fn: getNextPage, + ptic: cur, + } +} + +// ProcessThreadInfoProperties processThreadInfo resource specific properties +type ProcessThreadInfoProperties struct { + // Identifier - READ-ONLY; Site extension ID. + Identifier *int32 `json:"identifier,omitempty"` + // Href - HRef URI. + Href *string `json:"href,omitempty"` + // Process - Process URI. + Process *string `json:"process,omitempty"` + // StartAddress - Start address. + StartAddress *string `json:"start_address,omitempty"` + // CurrentPriority - Current thread priority. + CurrentPriority *int32 `json:"current_priority,omitempty"` + // PriorityLevel - Thread priority level. + PriorityLevel *string `json:"priority_level,omitempty"` + // BasePriority - Base priority. + BasePriority *int32 `json:"base_priority,omitempty"` + // StartTime - Start time. + StartTime *date.Time `json:"start_time,omitempty"` + // TotalProcessorTime - Total processor time. + TotalProcessorTime *string `json:"total_processor_time,omitempty"` + // UserProcessorTime - User processor time. + UserProcessorTime *string `json:"user_processor_time,omitempty"` + // State - Thread state. + State *string `json:"state,omitempty"` + // WaitReason - Wait reason. + WaitReason *string `json:"wait_reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProcessThreadInfoProperties. +func (pti ProcessThreadInfoProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pti.Href != nil { + objectMap["href"] = pti.Href + } + if pti.Process != nil { + objectMap["process"] = pti.Process + } + if pti.StartAddress != nil { + objectMap["start_address"] = pti.StartAddress + } + if pti.CurrentPriority != nil { + objectMap["current_priority"] = pti.CurrentPriority + } + if pti.PriorityLevel != nil { + objectMap["priority_level"] = pti.PriorityLevel + } + if pti.BasePriority != nil { + objectMap["base_priority"] = pti.BasePriority + } + if pti.StartTime != nil { + objectMap["start_time"] = pti.StartTime + } + if pti.TotalProcessorTime != nil { + objectMap["total_processor_time"] = pti.TotalProcessorTime + } + if pti.UserProcessorTime != nil { + objectMap["user_processor_time"] = pti.UserProcessorTime + } + if pti.State != nil { + objectMap["state"] = pti.State + } + if pti.WaitReason != nil { + objectMap["wait_reason"] = pti.WaitReason + } + return json.Marshal(objectMap) +} + +// ProxyOnlyResource azure proxy only resource. This resource is not tracked by Azure Resource Manager. +type ProxyOnlyResource struct { + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyOnlyResource. +func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if por.Kind != nil { + objectMap["kind"] = por.Kind + } + return json.Marshal(objectMap) +} + +// PublicCertificate public certificate object +type PublicCertificate struct { + autorest.Response `json:"-"` + // PublicCertificateProperties - PublicCertificate resource specific properties + *PublicCertificateProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PublicCertificate. +func (pc PublicCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pc.PublicCertificateProperties != nil { + objectMap["properties"] = pc.PublicCertificateProperties + } + if pc.Kind != nil { + objectMap["kind"] = pc.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PublicCertificate struct. +func (pc *PublicCertificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var publicCertificateProperties PublicCertificateProperties + err = json.Unmarshal(*v, &publicCertificateProperties) + if err != nil { + return err + } + pc.PublicCertificateProperties = &publicCertificateProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pc.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + pc.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pc.Type = &typeVar + } + } + } + + return nil +} + +// PublicCertificateCollection collection of public certificates +type PublicCertificateCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]PublicCertificate `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PublicCertificateCollection. +func (pcc PublicCertificateCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pcc.Value != nil { + objectMap["value"] = pcc.Value + } + return json.Marshal(objectMap) +} + +// PublicCertificateCollectionIterator provides access to a complete listing of PublicCertificate values. +type PublicCertificateCollectionIterator struct { + i int + page PublicCertificateCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PublicCertificateCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicCertificateCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PublicCertificateCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PublicCertificateCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PublicCertificateCollectionIterator) Response() PublicCertificateCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PublicCertificateCollectionIterator) Value() PublicCertificate { + if !iter.page.NotDone() { + return PublicCertificate{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PublicCertificateCollectionIterator type. +func NewPublicCertificateCollectionIterator(page PublicCertificateCollectionPage) PublicCertificateCollectionIterator { + return PublicCertificateCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pcc PublicCertificateCollection) IsEmpty() bool { + return pcc.Value == nil || len(*pcc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pcc PublicCertificateCollection) hasNextLink() bool { + return pcc.NextLink != nil && len(*pcc.NextLink) != 0 +} + +// publicCertificateCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pcc PublicCertificateCollection) publicCertificateCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !pcc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pcc.NextLink))) +} + +// PublicCertificateCollectionPage contains a page of PublicCertificate values. +type PublicCertificateCollectionPage struct { + fn func(context.Context, PublicCertificateCollection) (PublicCertificateCollection, error) + pcc PublicCertificateCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PublicCertificateCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicCertificateCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pcc) + if err != nil { + return err + } + page.pcc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PublicCertificateCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PublicCertificateCollectionPage) NotDone() bool { + return !page.pcc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PublicCertificateCollectionPage) Response() PublicCertificateCollection { + return page.pcc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PublicCertificateCollectionPage) Values() []PublicCertificate { + if page.pcc.IsEmpty() { + return nil + } + return *page.pcc.Value +} + +// Creates a new instance of the PublicCertificateCollectionPage type. +func NewPublicCertificateCollectionPage(cur PublicCertificateCollection, getNextPage func(context.Context, PublicCertificateCollection) (PublicCertificateCollection, error)) PublicCertificateCollectionPage { + return PublicCertificateCollectionPage{ + fn: getNextPage, + pcc: cur, + } +} + +// PublicCertificateProperties publicCertificate resource specific properties +type PublicCertificateProperties struct { + // Blob - Public Certificate byte array + Blob *[]byte `json:"blob,omitempty"` + // PublicCertificateLocation - Public Certificate Location. Possible values include: 'PublicCertificateLocationCurrentUserMy', 'PublicCertificateLocationLocalMachineMy', 'PublicCertificateLocationUnknown' + PublicCertificateLocation PublicCertificateLocation `json:"publicCertificateLocation,omitempty"` + // Thumbprint - READ-ONLY; Certificate Thumbprint + Thumbprint *string `json:"thumbprint,omitempty"` +} + +// MarshalJSON is the custom marshaler for PublicCertificateProperties. +func (pc PublicCertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pc.Blob != nil { + objectMap["blob"] = pc.Blob + } + if pc.PublicCertificateLocation != "" { + objectMap["publicCertificateLocation"] = pc.PublicCertificateLocation + } + return json.Marshal(objectMap) +} + +// PublishingCredentialsPoliciesCollection publishing Credentials Policies entity collection ARM resource. +type PublishingCredentialsPoliciesCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]CsmPublishingCredentialsPoliciesEntity `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PublishingCredentialsPoliciesCollection. +func (pcpc PublishingCredentialsPoliciesCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pcpc.Value != nil { + objectMap["value"] = pcpc.Value + } + return json.Marshal(objectMap) +} + +// PublishingCredentialsPoliciesCollectionIterator provides access to a complete listing of +// CsmPublishingCredentialsPoliciesEntity values. +type PublishingCredentialsPoliciesCollectionIterator struct { + i int + page PublishingCredentialsPoliciesCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PublishingCredentialsPoliciesCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublishingCredentialsPoliciesCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PublishingCredentialsPoliciesCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PublishingCredentialsPoliciesCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PublishingCredentialsPoliciesCollectionIterator) Response() PublishingCredentialsPoliciesCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PublishingCredentialsPoliciesCollectionIterator) Value() CsmPublishingCredentialsPoliciesEntity { + if !iter.page.NotDone() { + return CsmPublishingCredentialsPoliciesEntity{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PublishingCredentialsPoliciesCollectionIterator type. +func NewPublishingCredentialsPoliciesCollectionIterator(page PublishingCredentialsPoliciesCollectionPage) PublishingCredentialsPoliciesCollectionIterator { + return PublishingCredentialsPoliciesCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pcpc PublishingCredentialsPoliciesCollection) IsEmpty() bool { + return pcpc.Value == nil || len(*pcpc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pcpc PublishingCredentialsPoliciesCollection) hasNextLink() bool { + return pcpc.NextLink != nil && len(*pcpc.NextLink) != 0 +} + +// publishingCredentialsPoliciesCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pcpc PublishingCredentialsPoliciesCollection) publishingCredentialsPoliciesCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !pcpc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pcpc.NextLink))) +} + +// PublishingCredentialsPoliciesCollectionPage contains a page of CsmPublishingCredentialsPoliciesEntity +// values. +type PublishingCredentialsPoliciesCollectionPage struct { + fn func(context.Context, PublishingCredentialsPoliciesCollection) (PublishingCredentialsPoliciesCollection, error) + pcpc PublishingCredentialsPoliciesCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PublishingCredentialsPoliciesCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublishingCredentialsPoliciesCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pcpc) + if err != nil { + return err + } + page.pcpc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PublishingCredentialsPoliciesCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PublishingCredentialsPoliciesCollectionPage) NotDone() bool { + return !page.pcpc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PublishingCredentialsPoliciesCollectionPage) Response() PublishingCredentialsPoliciesCollection { + return page.pcpc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PublishingCredentialsPoliciesCollectionPage) Values() []CsmPublishingCredentialsPoliciesEntity { + if page.pcpc.IsEmpty() { + return nil + } + return *page.pcpc.Value +} + +// Creates a new instance of the PublishingCredentialsPoliciesCollectionPage type. +func NewPublishingCredentialsPoliciesCollectionPage(cur PublishingCredentialsPoliciesCollection, getNextPage func(context.Context, PublishingCredentialsPoliciesCollection) (PublishingCredentialsPoliciesCollection, error)) PublishingCredentialsPoliciesCollectionPage { + return PublishingCredentialsPoliciesCollectionPage{ + fn: getNextPage, + pcpc: cur, + } +} + +// PushSettings push settings for the App. +type PushSettings struct { + autorest.Response `json:"-"` + // PushSettingsProperties - PushSettings resource specific properties + *PushSettingsProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PushSettings. +func (ps PushSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ps.PushSettingsProperties != nil { + objectMap["properties"] = ps.PushSettingsProperties + } + if ps.Kind != nil { + objectMap["kind"] = ps.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PushSettings struct. +func (ps *PushSettings) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var pushSettingsProperties PushSettingsProperties + err = json.Unmarshal(*v, &pushSettingsProperties) + if err != nil { + return err + } + ps.PushSettingsProperties = &pushSettingsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ps.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ps.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ps.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ps.Type = &typeVar + } + } + } + + return nil +} + +// PushSettingsProperties pushSettings resource specific properties +type PushSettingsProperties struct { + // IsPushEnabled - Gets or sets a flag indicating whether the Push endpoint is enabled. + IsPushEnabled *bool `json:"isPushEnabled,omitempty"` + // TagWhitelistJSON - Gets or sets a JSON string containing a list of tags that are whitelisted for use by the push registration endpoint. + TagWhitelistJSON *string `json:"tagWhitelistJson,omitempty"` + // TagsRequiringAuth - Gets or sets a JSON string containing a list of tags that require user authentication to be used in the push registration endpoint. + // Tags can consist of alphanumeric characters and the following: + // '_', '@', '#', '.', ':', '-'. + // Validation should be performed at the PushRequestHandler. + TagsRequiringAuth *string `json:"tagsRequiringAuth,omitempty"` + // DynamicTagsJSON - Gets or sets a JSON string containing a list of dynamic tags that will be evaluated from user claims in the push registration endpoint. + DynamicTagsJSON *string `json:"dynamicTagsJson,omitempty"` +} + +// QueryUtterancesResult result for utterances query. +type QueryUtterancesResult struct { + // SampleUtterance - A sample utterance. + SampleUtterance *SampleUtterance `json:"sampleUtterance,omitempty"` + // Score - Score of a sample utterance. + Score *float64 `json:"score,omitempty"` +} + +// QueryUtterancesResults suggested utterances where the detector can be applicable +type QueryUtterancesResults struct { + // Query - Search Query. + Query *string `json:"query,omitempty"` + // Results - Array of utterance results for search query. + Results *[]QueryUtterancesResult `json:"results,omitempty"` +} + +// QueueScaleRule container App container Azure Queue based scaling rule. +type QueueScaleRule struct { + // QueueName - Queue name. + QueueName *string `json:"queueName,omitempty"` + // QueueLength - Queue length. + QueueLength *int32 `json:"queueLength,omitempty"` + // Auth - Authentication secrets for the queue scale rule. + Auth *[]ScaleRuleAuth `json:"auth,omitempty"` +} + +// RampUpRule routing rules for ramp up testing. This rule allows to redirect static traffic % to a slot or +// to gradually change routing % based on performance. +type RampUpRule struct { + // ActionHostName - Hostname of a slot to which the traffic will be redirected if decided to. E.g. myapp-stage.azurewebsites.net. + ActionHostName *string `json:"actionHostName,omitempty"` + // ReroutePercentage - Percentage of the traffic which will be redirected to ActionHostName. + ReroutePercentage *float64 `json:"reroutePercentage,omitempty"` + // ChangeStep - In auto ramp up scenario this is the step to add/remove from ReroutePercentage until it reaches \nMinReroutePercentage or + // MaxReroutePercentage. Site metrics are checked every N minutes specified in ChangeIntervalInMinutes.\nCustom decision algorithm + // can be provided in TiPCallback site extension which URL can be specified in ChangeDecisionCallbackUrl. + ChangeStep *float64 `json:"changeStep,omitempty"` + // ChangeIntervalInMinutes - Specifies interval in minutes to reevaluate ReroutePercentage. + ChangeIntervalInMinutes *int32 `json:"changeIntervalInMinutes,omitempty"` + // MinReroutePercentage - Specifies lower boundary above which ReroutePercentage will stay. + MinReroutePercentage *float64 `json:"minReroutePercentage,omitempty"` + // MaxReroutePercentage - Specifies upper boundary below which ReroutePercentage will stay. + MaxReroutePercentage *float64 `json:"maxReroutePercentage,omitempty"` + // ChangeDecisionCallbackURL - Custom decision algorithm can be provided in TiPCallback site extension which URL can be specified. See TiPCallback site extension for the scaffold and contracts. + // https://www.siteextensions.net/packages/TiPCallback/ + ChangeDecisionCallbackURL *string `json:"changeDecisionCallbackUrl,omitempty"` + // Name - Name of the routing rule. The recommended name would be to point to the slot which will receive the traffic in the experiment. + Name *string `json:"name,omitempty"` +} + +// ReadCloser ... +type ReadCloser struct { + autorest.Response `json:"-"` + Value *io.ReadCloser `json:"value,omitempty"` +} + +// Recommendation represents a recommendation result generated by the recommendation engine. +type Recommendation struct { + // RecommendationProperties - Recommendation resource specific properties + *RecommendationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Recommendation. +func (r Recommendation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.RecommendationProperties != nil { + objectMap["properties"] = r.RecommendationProperties + } + if r.Kind != nil { + objectMap["kind"] = r.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Recommendation struct. +func (r *Recommendation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var recommendationProperties RecommendationProperties + err = json.Unmarshal(*v, &recommendationProperties) + if err != nil { + return err + } + r.RecommendationProperties = &recommendationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + r.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + r.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + r.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + r.Type = &typeVar + } + } + } + + return nil +} + +// RecommendationCollection collection of recommendations. +type RecommendationCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]Recommendation `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for RecommendationCollection. +func (rc RecommendationCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rc.Value != nil { + objectMap["value"] = rc.Value + } + return json.Marshal(objectMap) +} + +// RecommendationCollectionIterator provides access to a complete listing of Recommendation values. +type RecommendationCollectionIterator struct { + i int + page RecommendationCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RecommendationCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RecommendationCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RecommendationCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RecommendationCollectionIterator) Response() RecommendationCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RecommendationCollectionIterator) Value() Recommendation { + if !iter.page.NotDone() { + return Recommendation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RecommendationCollectionIterator type. +func NewRecommendationCollectionIterator(page RecommendationCollectionPage) RecommendationCollectionIterator { + return RecommendationCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rc RecommendationCollection) IsEmpty() bool { + return rc.Value == nil || len(*rc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rc RecommendationCollection) hasNextLink() bool { + return rc.NextLink != nil && len(*rc.NextLink) != 0 +} + +// recommendationCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rc RecommendationCollection) recommendationCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !rc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rc.NextLink))) +} + +// RecommendationCollectionPage contains a page of Recommendation values. +type RecommendationCollectionPage struct { + fn func(context.Context, RecommendationCollection) (RecommendationCollection, error) + rc RecommendationCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RecommendationCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rc) + if err != nil { + return err + } + page.rc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RecommendationCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RecommendationCollectionPage) NotDone() bool { + return !page.rc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RecommendationCollectionPage) Response() RecommendationCollection { + return page.rc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RecommendationCollectionPage) Values() []Recommendation { + if page.rc.IsEmpty() { + return nil + } + return *page.rc.Value +} + +// Creates a new instance of the RecommendationCollectionPage type. +func NewRecommendationCollectionPage(cur RecommendationCollection, getNextPage func(context.Context, RecommendationCollection) (RecommendationCollection, error)) RecommendationCollectionPage { + return RecommendationCollectionPage{ + fn: getNextPage, + rc: cur, + } +} + +// RecommendationProperties recommendation resource specific properties +type RecommendationProperties struct { + // CreationTime - Timestamp when this instance was created. + CreationTime *date.Time `json:"creationTime,omitempty"` + // RecommendationID - A GUID value that each recommendation object is associated with. + RecommendationID *uuid.UUID `json:"recommendationId,omitempty"` + // ResourceID - Full ARM resource ID string that this recommendation object is associated with. + ResourceID *string `json:"resourceId,omitempty"` + // ResourceScope - Name of a resource type this recommendation applies, e.g. Subscription, ServerFarm, Site. Possible values include: 'ResourceScopeTypeServerFarm', 'ResourceScopeTypeSubscription', 'ResourceScopeTypeWebSite' + ResourceScope ResourceScopeType `json:"resourceScope,omitempty"` + // RuleName - Unique name of the rule. + RuleName *string `json:"ruleName,omitempty"` + // DisplayName - UI friendly name of the rule (may not be unique). + DisplayName *string `json:"displayName,omitempty"` + // Message - Recommendation text. + Message *string `json:"message,omitempty"` + // Level - Level indicating how critical this recommendation can impact. Possible values include: 'NotificationLevelCritical', 'NotificationLevelWarning', 'NotificationLevelInformation', 'NotificationLevelNonUrgentSuggestion' + Level NotificationLevel `json:"level,omitempty"` + // Channels - List of channels that this recommendation can apply. Possible values include: 'ChannelsNotification', 'ChannelsAPI', 'ChannelsEmail', 'ChannelsWebhook', 'ChannelsAll' + Channels Channels `json:"channels,omitempty"` + // CategoryTags - READ-ONLY; The list of category tags that this recommendation belongs to. + CategoryTags *[]string `json:"categoryTags,omitempty"` + // ActionName - Name of action recommended by this object. + ActionName *string `json:"actionName,omitempty"` + // Enabled - True if this recommendation is still valid (i.e. "actionable"). False if it is invalid. + Enabled *int32 `json:"enabled,omitempty"` + // States - The list of states of this recommendation. If it's null then it should be considered "Active". + States *[]string `json:"states,omitempty"` + // StartTime - The beginning time in UTC of a range that the recommendation refers to. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - The end time in UTC of a range that the recommendation refers to. + EndTime *date.Time `json:"endTime,omitempty"` + // NextNotificationTime - When to notify this recommendation next in UTC. Null means that this will never be notified anymore. + NextNotificationTime *date.Time `json:"nextNotificationTime,omitempty"` + // NotificationExpirationTime - Date and time in UTC when this notification expires. + NotificationExpirationTime *date.Time `json:"notificationExpirationTime,omitempty"` + // NotifiedTime - Last timestamp in UTC this instance was actually notified. Null means that this recommendation hasn't been notified yet. + NotifiedTime *date.Time `json:"notifiedTime,omitempty"` + // Score - A metric value measured by the rule. + Score *float64 `json:"score,omitempty"` + // IsDynamic - True if this is associated with a dynamically added rule + IsDynamic *bool `json:"isDynamic,omitempty"` + // ExtensionName - Extension name of the portal if exists. + ExtensionName *string `json:"extensionName,omitempty"` + // BladeName - Deep link to a blade on the portal. + BladeName *string `json:"bladeName,omitempty"` + // ForwardLink - Forward link to an external document associated with the rule. + ForwardLink *string `json:"forwardLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for RecommendationProperties. +func (r RecommendationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.CreationTime != nil { + objectMap["creationTime"] = r.CreationTime + } + if r.RecommendationID != nil { + objectMap["recommendationId"] = r.RecommendationID + } + if r.ResourceID != nil { + objectMap["resourceId"] = r.ResourceID + } + if r.ResourceScope != "" { + objectMap["resourceScope"] = r.ResourceScope + } + if r.RuleName != nil { + objectMap["ruleName"] = r.RuleName + } + if r.DisplayName != nil { + objectMap["displayName"] = r.DisplayName + } + if r.Message != nil { + objectMap["message"] = r.Message + } + if r.Level != "" { + objectMap["level"] = r.Level + } + if r.Channels != "" { + objectMap["channels"] = r.Channels + } + if r.ActionName != nil { + objectMap["actionName"] = r.ActionName + } + if r.Enabled != nil { + objectMap["enabled"] = r.Enabled + } + if r.States != nil { + objectMap["states"] = r.States + } + if r.StartTime != nil { + objectMap["startTime"] = r.StartTime + } + if r.EndTime != nil { + objectMap["endTime"] = r.EndTime + } + if r.NextNotificationTime != nil { + objectMap["nextNotificationTime"] = r.NextNotificationTime + } + if r.NotificationExpirationTime != nil { + objectMap["notificationExpirationTime"] = r.NotificationExpirationTime + } + if r.NotifiedTime != nil { + objectMap["notifiedTime"] = r.NotifiedTime + } + if r.Score != nil { + objectMap["score"] = r.Score + } + if r.IsDynamic != nil { + objectMap["isDynamic"] = r.IsDynamic + } + if r.ExtensionName != nil { + objectMap["extensionName"] = r.ExtensionName + } + if r.BladeName != nil { + objectMap["bladeName"] = r.BladeName + } + if r.ForwardLink != nil { + objectMap["forwardLink"] = r.ForwardLink + } + return json.Marshal(objectMap) +} + +// RecommendationRule represents a recommendation rule that the recommendation engine can perform. +type RecommendationRule struct { + autorest.Response `json:"-"` + // RecommendationRuleProperties - RecommendationRule resource specific properties + *RecommendationRuleProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RecommendationRule. +func (rr RecommendationRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rr.RecommendationRuleProperties != nil { + objectMap["properties"] = rr.RecommendationRuleProperties + } + if rr.Kind != nil { + objectMap["kind"] = rr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RecommendationRule struct. +func (rr *RecommendationRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var recommendationRuleProperties RecommendationRuleProperties + err = json.Unmarshal(*v, &recommendationRuleProperties) + if err != nil { + return err + } + rr.RecommendationRuleProperties = &recommendationRuleProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rr.Type = &typeVar + } + } + } + + return nil +} + +// RecommendationRuleProperties recommendationRule resource specific properties +type RecommendationRuleProperties struct { + // RecommendationName - Unique name of the rule. + RecommendationName *string `json:"recommendationName,omitempty"` + // DisplayName - UI friendly name of the rule. + DisplayName *string `json:"displayName,omitempty"` + // Message - Localized name of the rule (Good for UI). + Message *string `json:"message,omitempty"` + // RecommendationID - Recommendation ID of an associated recommendation object tied to the rule, if exists. + // If such an object doesn't exist, it is set to null. + RecommendationID *uuid.UUID `json:"recommendationId,omitempty"` + // Description - Localized detailed description of the rule. + Description *string `json:"description,omitempty"` + // ActionName - Name of action that is recommended by this rule in string. + ActionName *string `json:"actionName,omitempty"` + // Level - Level of impact indicating how critical this rule is. Possible values include: 'NotificationLevelCritical', 'NotificationLevelWarning', 'NotificationLevelInformation', 'NotificationLevelNonUrgentSuggestion' + Level NotificationLevel `json:"level,omitempty"` + // Channels - List of available channels that this rule applies. Possible values include: 'ChannelsNotification', 'ChannelsAPI', 'ChannelsEmail', 'ChannelsWebhook', 'ChannelsAll' + Channels Channels `json:"channels,omitempty"` + // CategoryTags - READ-ONLY; The list of category tags that this recommendation rule belongs to. + CategoryTags *[]string `json:"categoryTags,omitempty"` + // IsDynamic - True if this is associated with a dynamically added rule + IsDynamic *bool `json:"isDynamic,omitempty"` + // ExtensionName - Extension name of the portal if exists. Applicable to dynamic rule only. + ExtensionName *string `json:"extensionName,omitempty"` + // BladeName - Deep link to a blade on the portal. Applicable to dynamic rule only. + BladeName *string `json:"bladeName,omitempty"` + // ForwardLink - Forward link to an external document associated with the rule. Applicable to dynamic rule only. + ForwardLink *string `json:"forwardLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for RecommendationRuleProperties. +func (rr RecommendationRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rr.RecommendationName != nil { + objectMap["recommendationName"] = rr.RecommendationName + } + if rr.DisplayName != nil { + objectMap["displayName"] = rr.DisplayName + } + if rr.Message != nil { + objectMap["message"] = rr.Message + } + if rr.RecommendationID != nil { + objectMap["recommendationId"] = rr.RecommendationID + } + if rr.Description != nil { + objectMap["description"] = rr.Description + } + if rr.ActionName != nil { + objectMap["actionName"] = rr.ActionName + } + if rr.Level != "" { + objectMap["level"] = rr.Level + } + if rr.Channels != "" { + objectMap["channels"] = rr.Channels + } + if rr.IsDynamic != nil { + objectMap["isDynamic"] = rr.IsDynamic + } + if rr.ExtensionName != nil { + objectMap["extensionName"] = rr.ExtensionName + } + if rr.BladeName != nil { + objectMap["bladeName"] = rr.BladeName + } + if rr.ForwardLink != nil { + objectMap["forwardLink"] = rr.ForwardLink + } + return json.Marshal(objectMap) +} + +// RegistryCredentials container App Private Registry +type RegistryCredentials struct { + // Server - Container Registry Server + Server *string `json:"server,omitempty"` + // Username - Container Registry Username + Username *string `json:"username,omitempty"` + // PasswordSecretRef - The name of the Secret that contains the registry login password + PasswordSecretRef *string `json:"passwordSecretRef,omitempty"` +} + +// ReissueCertificateOrderRequest class representing certificate reissue request. +type ReissueCertificateOrderRequest struct { + // ReissueCertificateOrderRequestProperties - ReissueCertificateOrderRequest resource specific properties + *ReissueCertificateOrderRequestProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ReissueCertificateOrderRequest. +func (rcor ReissueCertificateOrderRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rcor.ReissueCertificateOrderRequestProperties != nil { + objectMap["properties"] = rcor.ReissueCertificateOrderRequestProperties + } + if rcor.Kind != nil { + objectMap["kind"] = rcor.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ReissueCertificateOrderRequest struct. +func (rcor *ReissueCertificateOrderRequest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var reissueCertificateOrderRequestProperties ReissueCertificateOrderRequestProperties + err = json.Unmarshal(*v, &reissueCertificateOrderRequestProperties) + if err != nil { + return err + } + rcor.ReissueCertificateOrderRequestProperties = &reissueCertificateOrderRequestProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rcor.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rcor.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rcor.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rcor.Type = &typeVar + } + } + } + + return nil +} + +// ReissueCertificateOrderRequestProperties reissueCertificateOrderRequest resource specific properties +type ReissueCertificateOrderRequestProperties struct { + // KeySize - Certificate Key Size. + KeySize *int32 `json:"keySize,omitempty"` + // DelayExistingRevokeInHours - Delay in hours to revoke existing certificate after the new certificate is issued. + DelayExistingRevokeInHours *int32 `json:"delayExistingRevokeInHours,omitempty"` + // Csr - Csr to be used for re-key operation. + Csr *string `json:"csr,omitempty"` + // IsPrivateKeyExternal - Should we change the ASC type (from managed private key to external private key and vice versa). + IsPrivateKeyExternal *bool `json:"isPrivateKeyExternal,omitempty"` +} + +// RelayServiceConnectionEntity hybrid Connection for an App Service app. +type RelayServiceConnectionEntity struct { + autorest.Response `json:"-"` + // RelayServiceConnectionEntityProperties - RelayServiceConnectionEntity resource specific properties + *RelayServiceConnectionEntityProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RelayServiceConnectionEntity. +func (rsce RelayServiceConnectionEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rsce.RelayServiceConnectionEntityProperties != nil { + objectMap["properties"] = rsce.RelayServiceConnectionEntityProperties + } + if rsce.Kind != nil { + objectMap["kind"] = rsce.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RelayServiceConnectionEntity struct. +func (rsce *RelayServiceConnectionEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var relayServiceConnectionEntityProperties RelayServiceConnectionEntityProperties + err = json.Unmarshal(*v, &relayServiceConnectionEntityProperties) + if err != nil { + return err + } + rsce.RelayServiceConnectionEntityProperties = &relayServiceConnectionEntityProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rsce.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rsce.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rsce.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rsce.Type = &typeVar + } + } + } + + return nil +} + +// RelayServiceConnectionEntityProperties relayServiceConnectionEntity resource specific properties +type RelayServiceConnectionEntityProperties struct { + EntityName *string `json:"entityName,omitempty"` + EntityConnectionString *string `json:"entityConnectionString,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + ResourceConnectionString *string `json:"resourceConnectionString,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Port *int32 `json:"port,omitempty"` + BiztalkURI *string `json:"biztalkUri,omitempty"` +} + +// RemotePrivateEndpointConnection a remote private endpoint connection +type RemotePrivateEndpointConnection struct { + // RemotePrivateEndpointConnectionProperties - RemotePrivateEndpointConnection resource specific properties + *RemotePrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RemotePrivateEndpointConnection. +func (rpec RemotePrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpec.RemotePrivateEndpointConnectionProperties != nil { + objectMap["properties"] = rpec.RemotePrivateEndpointConnectionProperties + } + if rpec.Kind != nil { + objectMap["kind"] = rpec.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RemotePrivateEndpointConnection struct. +func (rpec *RemotePrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var remotePrivateEndpointConnectionProperties RemotePrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &remotePrivateEndpointConnectionProperties) + if err != nil { + return err + } + rpec.RemotePrivateEndpointConnectionProperties = &remotePrivateEndpointConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rpec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rpec.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rpec.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rpec.Type = &typeVar + } + } + } + + return nil +} + +// RemotePrivateEndpointConnectionARMResource remote Private Endpoint Connection ARM resource. +type RemotePrivateEndpointConnectionARMResource struct { + autorest.Response `json:"-"` + // RemotePrivateEndpointConnectionARMResourceProperties - RemotePrivateEndpointConnectionARMResource resource specific properties + *RemotePrivateEndpointConnectionARMResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RemotePrivateEndpointConnectionARMResource. +func (rpecar RemotePrivateEndpointConnectionARMResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpecar.RemotePrivateEndpointConnectionARMResourceProperties != nil { + objectMap["properties"] = rpecar.RemotePrivateEndpointConnectionARMResourceProperties + } + if rpecar.Kind != nil { + objectMap["kind"] = rpecar.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RemotePrivateEndpointConnectionARMResource struct. +func (rpecar *RemotePrivateEndpointConnectionARMResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var remotePrivateEndpointConnectionARMResourceProperties RemotePrivateEndpointConnectionARMResourceProperties + err = json.Unmarshal(*v, &remotePrivateEndpointConnectionARMResourceProperties) + if err != nil { + return err + } + rpecar.RemotePrivateEndpointConnectionARMResourceProperties = &remotePrivateEndpointConnectionARMResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rpecar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rpecar.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rpecar.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rpecar.Type = &typeVar + } + } + } + + return nil +} + +// RemotePrivateEndpointConnectionARMResourceProperties remotePrivateEndpointConnectionARMResource resource +// specific properties +type RemotePrivateEndpointConnectionARMResourceProperties struct { + // ProvisioningState - READ-ONLY + ProvisioningState *string `json:"provisioningState,omitempty"` + // PrivateEndpoint - PrivateEndpoint of a remote private endpoint connection + PrivateEndpoint *ArmIDWrapper `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // IPAddresses - Private IPAddresses mapped to the remote private endpoint + IPAddresses *[]string `json:"ipAddresses,omitempty"` +} + +// MarshalJSON is the custom marshaler for RemotePrivateEndpointConnectionARMResourceProperties. +func (rpecar RemotePrivateEndpointConnectionARMResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpecar.PrivateEndpoint != nil { + objectMap["privateEndpoint"] = rpecar.PrivateEndpoint + } + if rpecar.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = rpecar.PrivateLinkServiceConnectionState + } + if rpecar.IPAddresses != nil { + objectMap["ipAddresses"] = rpecar.IPAddresses + } + return json.Marshal(objectMap) +} + +// RemotePrivateEndpointConnectionProperties remotePrivateEndpointConnection resource specific properties +type RemotePrivateEndpointConnectionProperties struct { + // ProvisioningState - READ-ONLY + ProvisioningState *string `json:"provisioningState,omitempty"` + // PrivateEndpoint - PrivateEndpoint of a remote private endpoint connection + PrivateEndpoint *ArmIDWrapper `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // IPAddresses - Private IPAddresses mapped to the remote private endpoint + IPAddresses *[]string `json:"ipAddresses,omitempty"` +} + +// MarshalJSON is the custom marshaler for RemotePrivateEndpointConnectionProperties. +func (rpec RemotePrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpec.PrivateEndpoint != nil { + objectMap["privateEndpoint"] = rpec.PrivateEndpoint + } + if rpec.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = rpec.PrivateLinkServiceConnectionState + } + if rpec.IPAddresses != nil { + objectMap["ipAddresses"] = rpec.IPAddresses + } + return json.Marshal(objectMap) +} + +// Rendering instructions for rendering the data +type Rendering struct { + // Type - Rendering Type. Possible values include: 'RenderingTypeNoGraph', 'RenderingTypeTable', 'RenderingTypeTimeSeries', 'RenderingTypeTimeSeriesPerInstance', 'RenderingTypePieChart', 'RenderingTypeDataSummary', 'RenderingTypeEmail', 'RenderingTypeInsights', 'RenderingTypeDynamicInsight', 'RenderingTypeMarkdown', 'RenderingTypeDetector', 'RenderingTypeDropDown', 'RenderingTypeCard', 'RenderingTypeSolution', 'RenderingTypeGuage', 'RenderingTypeForm', 'RenderingTypeChangeSets', 'RenderingTypeChangeAnalysisOnboarding', 'RenderingTypeChangesView', 'RenderingTypeAppInsight', 'RenderingTypeDependencyGraph', 'RenderingTypeDownTime', 'RenderingTypeSummaryCard', 'RenderingTypeSearchComponent', 'RenderingTypeAppInsightEnablement' + Type RenderingType `json:"type,omitempty"` + // Title - Title of data + Title *string `json:"title,omitempty"` + // Description - Description of the data that will help it be interpreted + Description *string `json:"description,omitempty"` +} + +// RenewCertificateOrderRequest class representing certificate renew request. +type RenewCertificateOrderRequest struct { + // RenewCertificateOrderRequestProperties - RenewCertificateOrderRequest resource specific properties + *RenewCertificateOrderRequestProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RenewCertificateOrderRequest. +func (rcor RenewCertificateOrderRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rcor.RenewCertificateOrderRequestProperties != nil { + objectMap["properties"] = rcor.RenewCertificateOrderRequestProperties + } + if rcor.Kind != nil { + objectMap["kind"] = rcor.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RenewCertificateOrderRequest struct. +func (rcor *RenewCertificateOrderRequest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var renewCertificateOrderRequestProperties RenewCertificateOrderRequestProperties + err = json.Unmarshal(*v, &renewCertificateOrderRequestProperties) + if err != nil { + return err + } + rcor.RenewCertificateOrderRequestProperties = &renewCertificateOrderRequestProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rcor.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rcor.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rcor.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rcor.Type = &typeVar + } + } + } + + return nil +} + +// RenewCertificateOrderRequestProperties renewCertificateOrderRequest resource specific properties +type RenewCertificateOrderRequestProperties struct { + // KeySize - Certificate Key Size. + KeySize *int32 `json:"keySize,omitempty"` + // Csr - Csr to be used for re-key operation. + Csr *string `json:"csr,omitempty"` + // IsPrivateKeyExternal - Should we change the ASC type (from managed private key to external private key and vice versa). + IsPrivateKeyExternal *bool `json:"isPrivateKeyExternal,omitempty"` +} + +// RequestsBasedTrigger trigger based on total requests. +type RequestsBasedTrigger struct { + // Count - Request Count. + Count *int32 `json:"count,omitempty"` + // TimeInterval - Time interval. + TimeInterval *string `json:"timeInterval,omitempty"` +} + +// Resource azure resource. This resource is tracked in Azure Resource Manager +type Resource struct { + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Location - Resource Location. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Kind != nil { + objectMap["kind"] = r.Kind + } + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// ResourceCollection collection of resources. +type ResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]string `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceCollection. +func (rc ResourceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rc.Value != nil { + objectMap["value"] = rc.Value + } + return json.Marshal(objectMap) +} + +// ResourceCollectionIterator provides access to a complete listing of string values. +type ResourceCollectionIterator struct { + i int + page ResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceCollectionIterator) Response() ResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceCollectionIterator) Value() string { + if !iter.page.NotDone() { + return "" + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceCollectionIterator type. +func NewResourceCollectionIterator(page ResourceCollectionPage) ResourceCollectionIterator { + return ResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rc ResourceCollection) IsEmpty() bool { + return rc.Value == nil || len(*rc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rc ResourceCollection) hasNextLink() bool { + return rc.NextLink != nil && len(*rc.NextLink) != 0 +} + +// resourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rc ResourceCollection) resourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !rc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rc.NextLink))) +} + +// ResourceCollectionPage contains a page of string values. +type ResourceCollectionPage struct { + fn func(context.Context, ResourceCollection) (ResourceCollection, error) + rc ResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rc) + if err != nil { + return err + } + page.rc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceCollectionPage) NotDone() bool { + return !page.rc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceCollectionPage) Response() ResourceCollection { + return page.rc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceCollectionPage) Values() []string { + if page.rc.IsEmpty() { + return nil + } + return *page.rc.Value +} + +// Creates a new instance of the ResourceCollectionPage type. +func NewResourceCollectionPage(cur ResourceCollection, getNextPage func(context.Context, ResourceCollection) (ResourceCollection, error)) ResourceCollectionPage { + return ResourceCollectionPage{ + fn: getNextPage, + rc: cur, + } +} + +// ResourceHealthMetadata used for getting ResourceHealthCheck settings. +type ResourceHealthMetadata struct { + autorest.Response `json:"-"` + // ResourceHealthMetadataProperties - ResourceHealthMetadata resource specific properties + *ResourceHealthMetadataProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceHealthMetadata. +func (rhm ResourceHealthMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rhm.ResourceHealthMetadataProperties != nil { + objectMap["properties"] = rhm.ResourceHealthMetadataProperties + } + if rhm.Kind != nil { + objectMap["kind"] = rhm.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ResourceHealthMetadata struct. +func (rhm *ResourceHealthMetadata) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var resourceHealthMetadataProperties ResourceHealthMetadataProperties + err = json.Unmarshal(*v, &resourceHealthMetadataProperties) + if err != nil { + return err + } + rhm.ResourceHealthMetadataProperties = &resourceHealthMetadataProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rhm.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rhm.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rhm.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rhm.Type = &typeVar + } + } + } + + return nil +} + +// ResourceHealthMetadataCollection collection of resource health metadata. +type ResourceHealthMetadataCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]ResourceHealthMetadata `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceHealthMetadataCollection. +func (rhmc ResourceHealthMetadataCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rhmc.Value != nil { + objectMap["value"] = rhmc.Value + } + return json.Marshal(objectMap) +} + +// ResourceHealthMetadataCollectionIterator provides access to a complete listing of ResourceHealthMetadata +// values. +type ResourceHealthMetadataCollectionIterator struct { + i int + page ResourceHealthMetadataCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceHealthMetadataCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceHealthMetadataCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceHealthMetadataCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceHealthMetadataCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceHealthMetadataCollectionIterator) Response() ResourceHealthMetadataCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceHealthMetadataCollectionIterator) Value() ResourceHealthMetadata { + if !iter.page.NotDone() { + return ResourceHealthMetadata{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceHealthMetadataCollectionIterator type. +func NewResourceHealthMetadataCollectionIterator(page ResourceHealthMetadataCollectionPage) ResourceHealthMetadataCollectionIterator { + return ResourceHealthMetadataCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rhmc ResourceHealthMetadataCollection) IsEmpty() bool { + return rhmc.Value == nil || len(*rhmc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rhmc ResourceHealthMetadataCollection) hasNextLink() bool { + return rhmc.NextLink != nil && len(*rhmc.NextLink) != 0 +} + +// resourceHealthMetadataCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rhmc ResourceHealthMetadataCollection) resourceHealthMetadataCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !rhmc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rhmc.NextLink))) +} + +// ResourceHealthMetadataCollectionPage contains a page of ResourceHealthMetadata values. +type ResourceHealthMetadataCollectionPage struct { + fn func(context.Context, ResourceHealthMetadataCollection) (ResourceHealthMetadataCollection, error) + rhmc ResourceHealthMetadataCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceHealthMetadataCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceHealthMetadataCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rhmc) + if err != nil { + return err + } + page.rhmc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceHealthMetadataCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceHealthMetadataCollectionPage) NotDone() bool { + return !page.rhmc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceHealthMetadataCollectionPage) Response() ResourceHealthMetadataCollection { + return page.rhmc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceHealthMetadataCollectionPage) Values() []ResourceHealthMetadata { + if page.rhmc.IsEmpty() { + return nil + } + return *page.rhmc.Value +} + +// Creates a new instance of the ResourceHealthMetadataCollectionPage type. +func NewResourceHealthMetadataCollectionPage(cur ResourceHealthMetadataCollection, getNextPage func(context.Context, ResourceHealthMetadataCollection) (ResourceHealthMetadataCollection, error)) ResourceHealthMetadataCollectionPage { + return ResourceHealthMetadataCollectionPage{ + fn: getNextPage, + rhmc: cur, + } +} + +// ResourceHealthMetadataProperties resourceHealthMetadata resource specific properties +type ResourceHealthMetadataProperties struct { + // Category - The category that the resource matches in the RHC Policy File + Category *string `json:"category,omitempty"` + // SignalAvailability - Is there a health signal for the resource + SignalAvailability *bool `json:"signalAvailability,omitempty"` +} + +// ResourceMetricAvailability metrics availability and retention. +type ResourceMetricAvailability struct { + // TimeGrain - READ-ONLY; Time grain . + TimeGrain *string `json:"timeGrain,omitempty"` + // Retention - READ-ONLY; Retention period for the current time grain. + Retention *string `json:"retention,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceMetricAvailability. +func (rma ResourceMetricAvailability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceMetricDefinition metadata for the metrics. +type ResourceMetricDefinition struct { + // ResourceMetricDefinitionProperties - ResourceMetricDefinition resource specific properties + *ResourceMetricDefinitionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceMetricDefinition. +func (rmd ResourceMetricDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmd.ResourceMetricDefinitionProperties != nil { + objectMap["properties"] = rmd.ResourceMetricDefinitionProperties + } + if rmd.Kind != nil { + objectMap["kind"] = rmd.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ResourceMetricDefinition struct. +func (rmd *ResourceMetricDefinition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var resourceMetricDefinitionProperties ResourceMetricDefinitionProperties + err = json.Unmarshal(*v, &resourceMetricDefinitionProperties) + if err != nil { + return err + } + rmd.ResourceMetricDefinitionProperties = &resourceMetricDefinitionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rmd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rmd.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rmd.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rmd.Type = &typeVar + } + } + } + + return nil +} + +// ResourceMetricDefinitionCollection collection of metric definitions. +type ResourceMetricDefinitionCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]ResourceMetricDefinition `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceMetricDefinitionCollection. +func (rmdc ResourceMetricDefinitionCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmdc.Value != nil { + objectMap["value"] = rmdc.Value + } + return json.Marshal(objectMap) +} + +// ResourceMetricDefinitionCollectionIterator provides access to a complete listing of +// ResourceMetricDefinition values. +type ResourceMetricDefinitionCollectionIterator struct { + i int + page ResourceMetricDefinitionCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceMetricDefinitionCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceMetricDefinitionCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceMetricDefinitionCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceMetricDefinitionCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceMetricDefinitionCollectionIterator) Response() ResourceMetricDefinitionCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceMetricDefinitionCollectionIterator) Value() ResourceMetricDefinition { + if !iter.page.NotDone() { + return ResourceMetricDefinition{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceMetricDefinitionCollectionIterator type. +func NewResourceMetricDefinitionCollectionIterator(page ResourceMetricDefinitionCollectionPage) ResourceMetricDefinitionCollectionIterator { + return ResourceMetricDefinitionCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rmdc ResourceMetricDefinitionCollection) IsEmpty() bool { + return rmdc.Value == nil || len(*rmdc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rmdc ResourceMetricDefinitionCollection) hasNextLink() bool { + return rmdc.NextLink != nil && len(*rmdc.NextLink) != 0 +} + +// resourceMetricDefinitionCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rmdc ResourceMetricDefinitionCollection) resourceMetricDefinitionCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !rmdc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rmdc.NextLink))) +} + +// ResourceMetricDefinitionCollectionPage contains a page of ResourceMetricDefinition values. +type ResourceMetricDefinitionCollectionPage struct { + fn func(context.Context, ResourceMetricDefinitionCollection) (ResourceMetricDefinitionCollection, error) + rmdc ResourceMetricDefinitionCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceMetricDefinitionCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceMetricDefinitionCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rmdc) + if err != nil { + return err + } + page.rmdc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceMetricDefinitionCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceMetricDefinitionCollectionPage) NotDone() bool { + return !page.rmdc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceMetricDefinitionCollectionPage) Response() ResourceMetricDefinitionCollection { + return page.rmdc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceMetricDefinitionCollectionPage) Values() []ResourceMetricDefinition { + if page.rmdc.IsEmpty() { + return nil + } + return *page.rmdc.Value +} + +// Creates a new instance of the ResourceMetricDefinitionCollectionPage type. +func NewResourceMetricDefinitionCollectionPage(cur ResourceMetricDefinitionCollection, getNextPage func(context.Context, ResourceMetricDefinitionCollection) (ResourceMetricDefinitionCollection, error)) ResourceMetricDefinitionCollectionPage { + return ResourceMetricDefinitionCollectionPage{ + fn: getNextPage, + rmdc: cur, + } +} + +// ResourceMetricDefinitionProperties resourceMetricDefinition resource specific properties +type ResourceMetricDefinitionProperties struct { + // Unit - READ-ONLY; Unit of the metric. + Unit *string `json:"unit,omitempty"` + // PrimaryAggregationType - READ-ONLY; Primary aggregation type. + PrimaryAggregationType *string `json:"primaryAggregationType,omitempty"` + // MetricAvailabilities - READ-ONLY; List of time grains supported for the metric together with retention period. + MetricAvailabilities *[]ResourceMetricAvailability `json:"metricAvailabilities,omitempty"` + // ResourceURI - READ-ONLY; Resource URI. + ResourceURI *string `json:"resourceUri,omitempty"` + // Properties - READ-ONLY; Resource metric definition properties. + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for ResourceMetricDefinitionProperties. +func (rmd ResourceMetricDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceNameAvailability information regarding availability of a resource name. +type ResourceNameAvailability struct { + autorest.Response `json:"-"` + // NameAvailable - true indicates name is valid and available. false indicates the name is invalid, unavailable, or both. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - Invalid indicates the name provided does not match Azure App Service naming requirements. AlreadyExists indicates that the name is already in use and is therefore unavailable. Possible values include: 'InAvailabilityReasonTypeInvalid', 'InAvailabilityReasonTypeAlreadyExists' + Reason InAvailabilityReasonType `json:"reason,omitempty"` + // Message - 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 resource name is already in use, and direct them to select a different name. + Message *string `json:"message,omitempty"` +} + +// ResourceNameAvailabilityRequest resource name availability request content. +type ResourceNameAvailabilityRequest struct { + // Name - Resource name to verify. + Name *string `json:"name,omitempty"` + // Type - Resource type used for verification. Possible values include: 'CheckNameResourceTypesSite', 'CheckNameResourceTypesSlot', 'CheckNameResourceTypesHostingEnvironment', 'CheckNameResourceTypesPublishingUser', 'CheckNameResourceTypesMicrosoftWebsites', 'CheckNameResourceTypesMicrosoftWebsitesslots', 'CheckNameResourceTypesMicrosoftWebhostingEnvironments', 'CheckNameResourceTypesMicrosoftWebpublishingUsers' + Type CheckNameResourceTypes `json:"type,omitempty"` + // IsFqdn - Is fully qualified domain name. + IsFqdn *bool `json:"isFqdn,omitempty"` +} + +// ResponseMessageEnvelopeRemotePrivateEndpointConnection message envelope that contains the common Azure +// resource manager properties and the resource provider specific content. +type ResponseMessageEnvelopeRemotePrivateEndpointConnection struct { + // ID - Resource Id. Typically ID is populated only for responses to GET requests. Caller is responsible for passing in this + // value for GET requests only. + // For example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupId}/providers/Microsoft.Web/sites/{sitename} + ID *string `json:"id,omitempty"` + // Name - Name of resource. + Name *string `json:"name,omitempty"` + // Type - Type of resource e.g "Microsoft.Web/sites". + Type *string `json:"type,omitempty"` + // Location - Geographical region resource belongs to e.g. SouthCentralUS, SouthEastAsia. + Location *string `json:"location,omitempty"` + // Tags - Tags associated with resource. + Tags map[string]*string `json:"tags"` + // Plan - Azure resource manager plan. + Plan *ArmPlan `json:"plan,omitempty"` + // Properties - Resource specific properties. + Properties *RemotePrivateEndpointConnection `json:"properties,omitempty"` + // Sku - SKU description of the resource. + Sku *SkuDescription `json:"sku,omitempty"` + // Status - Azure-AsyncOperation Status info. + Status *string `json:"status,omitempty"` + // Error - Azure-AsyncOperation Error info. + Error *ErrorEntity `json:"error,omitempty"` + // Identity - MSI resource + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Zones - Logical Availability Zones the service is hosted in + Zones *[]string `json:"zones,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResponseMessageEnvelopeRemotePrivateEndpointConnection. +func (rmeRpec ResponseMessageEnvelopeRemotePrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmeRpec.ID != nil { + objectMap["id"] = rmeRpec.ID + } + if rmeRpec.Name != nil { + objectMap["name"] = rmeRpec.Name + } + if rmeRpec.Type != nil { + objectMap["type"] = rmeRpec.Type + } + if rmeRpec.Location != nil { + objectMap["location"] = rmeRpec.Location + } + if rmeRpec.Tags != nil { + objectMap["tags"] = rmeRpec.Tags + } + if rmeRpec.Plan != nil { + objectMap["plan"] = rmeRpec.Plan + } + if rmeRpec.Properties != nil { + objectMap["properties"] = rmeRpec.Properties + } + if rmeRpec.Sku != nil { + objectMap["sku"] = rmeRpec.Sku + } + if rmeRpec.Status != nil { + objectMap["status"] = rmeRpec.Status + } + if rmeRpec.Error != nil { + objectMap["error"] = rmeRpec.Error + } + if rmeRpec.Identity != nil { + objectMap["identity"] = rmeRpec.Identity + } + if rmeRpec.Zones != nil { + objectMap["zones"] = rmeRpec.Zones + } + return json.Marshal(objectMap) +} + +// ResponseMetaData ... +type ResponseMetaData struct { + // DataSource - Source of the Data + DataSource *DataSource `json:"dataSource,omitempty"` +} + +// RestoreRequest description of a restore request. +type RestoreRequest struct { + autorest.Response `json:"-"` + // RestoreRequestProperties - RestoreRequest resource specific properties + *RestoreRequestProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RestoreRequest. +func (rr RestoreRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rr.RestoreRequestProperties != nil { + objectMap["properties"] = rr.RestoreRequestProperties + } + if rr.Kind != nil { + objectMap["kind"] = rr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RestoreRequest struct. +func (rr *RestoreRequest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var restoreRequestProperties RestoreRequestProperties + err = json.Unmarshal(*v, &restoreRequestProperties) + if err != nil { + return err + } + rr.RestoreRequestProperties = &restoreRequestProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rr.Type = &typeVar + } + } + } + + return nil +} + +// RestoreRequestProperties restoreRequest resource specific properties +type RestoreRequestProperties struct { + // StorageAccountURL - SAS URL to the container. + StorageAccountURL *string `json:"storageAccountUrl,omitempty"` + // BlobName - Name of a blob which contains the backup. + BlobName *string `json:"blobName,omitempty"` + // Overwrite - true if the restore operation can overwrite target app; otherwise, false. true is needed if trying to restore over an existing app. + Overwrite *bool `json:"overwrite,omitempty"` + // SiteName - Name of an app. + SiteName *string `json:"siteName,omitempty"` + // Databases - Collection of databases which should be restored. This list has to match the list of databases included in the backup. + Databases *[]DatabaseBackupSetting `json:"databases,omitempty"` + // IgnoreConflictingHostNames - Changes a logic when restoring an app with custom domains. true to remove custom domains automatically. If false, custom domains are added to + // the app's object when it is being restored, but that might fail due to conflicts during the operation. + IgnoreConflictingHostNames *bool `json:"ignoreConflictingHostNames,omitempty"` + // IgnoreDatabases - Ignore the databases and only restore the site content + IgnoreDatabases *bool `json:"ignoreDatabases,omitempty"` + // AppServicePlan - Specify app service plan that will own restored site. + AppServicePlan *string `json:"appServicePlan,omitempty"` + // OperationType - Operation type. Possible values include: 'BackupRestoreOperationTypeDefault', 'BackupRestoreOperationTypeClone', 'BackupRestoreOperationTypeRelocation', 'BackupRestoreOperationTypeSnapshot', 'BackupRestoreOperationTypeCloudFS' + OperationType BackupRestoreOperationType `json:"operationType,omitempty"` + // AdjustConnectionStrings - true if SiteConfig.ConnectionStrings should be set in new app; otherwise, false. + AdjustConnectionStrings *bool `json:"adjustConnectionStrings,omitempty"` + // HostingEnvironment - App Service Environment name, if needed (only when restoring an app to an App Service Environment). + HostingEnvironment *string `json:"hostingEnvironment,omitempty"` +} + +// Revision container App Revision. +type Revision struct { + autorest.Response `json:"-"` + // RevisionProperties - Revision resource specific properties + *RevisionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Location - Resource Location. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Revision. +func (r Revision) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.RevisionProperties != nil { + objectMap["properties"] = r.RevisionProperties + } + if r.Kind != nil { + objectMap["kind"] = r.Kind + } + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Revision struct. +func (r *Revision) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var revisionProperties RevisionProperties + err = json.Unmarshal(*v, &revisionProperties) + if err != nil { + return err + } + r.RevisionProperties = &revisionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + r.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + r.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + r.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + r.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + r.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + r.Tags = tags + } + } + } + + return nil +} + +// RevisionCollection container App Revisions collection ARM resource. +type RevisionCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]Revision `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for RevisionCollection. +func (rc RevisionCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rc.Value != nil { + objectMap["value"] = rc.Value + } + return json.Marshal(objectMap) +} + +// RevisionCollectionIterator provides access to a complete listing of Revision values. +type RevisionCollectionIterator struct { + i int + page RevisionCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RevisionCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RevisionCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RevisionCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RevisionCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RevisionCollectionIterator) Response() RevisionCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RevisionCollectionIterator) Value() Revision { + if !iter.page.NotDone() { + return Revision{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RevisionCollectionIterator type. +func NewRevisionCollectionIterator(page RevisionCollectionPage) RevisionCollectionIterator { + return RevisionCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rc RevisionCollection) IsEmpty() bool { + return rc.Value == nil || len(*rc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rc RevisionCollection) hasNextLink() bool { + return rc.NextLink != nil && len(*rc.NextLink) != 0 +} + +// revisionCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rc RevisionCollection) revisionCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !rc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rc.NextLink))) +} + +// RevisionCollectionPage contains a page of Revision values. +type RevisionCollectionPage struct { + fn func(context.Context, RevisionCollection) (RevisionCollection, error) + rc RevisionCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RevisionCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RevisionCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rc) + if err != nil { + return err + } + page.rc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RevisionCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RevisionCollectionPage) NotDone() bool { + return !page.rc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RevisionCollectionPage) Response() RevisionCollection { + return page.rc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RevisionCollectionPage) Values() []Revision { + if page.rc.IsEmpty() { + return nil + } + return *page.rc.Value +} + +// Creates a new instance of the RevisionCollectionPage type. +func NewRevisionCollectionPage(cur RevisionCollection, getNextPage func(context.Context, RevisionCollection) (RevisionCollection, error)) RevisionCollectionPage { + return RevisionCollectionPage{ + fn: getNextPage, + rc: cur, + } +} + +// RevisionProperties revision resource specific properties +type RevisionProperties struct { + // CreatedTime - READ-ONLY; Timestamp describing when the revision was created + // by controller + CreatedTime *date.Time `json:"createdTime,omitempty"` + // Fqdn - READ-ONLY; Fully qualified domain name of the revision + Fqdn *string `json:"fqdn,omitempty"` + // Template - READ-ONLY; Container App Revision Template with all possible settings and the + // defaults if user did not provide them. The defaults are populated + // as they were at the creation time + Template *Template `json:"template,omitempty"` + // Active - READ-ONLY; Boolean describing if the Revision is Active + Active *bool `json:"active,omitempty"` + // Replicas - READ-ONLY; Number of pods currently running for this revision + Replicas *int32 `json:"replicas,omitempty"` + // TrafficWeight - READ-ONLY; Traffic weight assigned to this revision + TrafficWeight *int32 `json:"trafficWeight,omitempty"` + // ProvisioningError - READ-ONLY; Optional Field - Platform Error Message + ProvisioningError *string `json:"provisioningError,omitempty"` + // HealthState - READ-ONLY; Current health State of the revision. Possible values include: 'RevisionHealthStateHealthy', 'RevisionHealthStateUnhealthy', 'RevisionHealthStateNone' + HealthState RevisionHealthState `json:"healthState,omitempty"` + // ProvisioningState - READ-ONLY; Current provisioning State of the revision. Possible values include: 'RevisionProvisioningStateProvisioning', 'RevisionProvisioningStateProvisioned', 'RevisionProvisioningStateFailed', 'RevisionProvisioningStateDeprovisioning', 'RevisionProvisioningStateDeprovisioned' + ProvisioningState RevisionProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for RevisionProperties. +func (r RevisionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SampleUtterance sample utterance. +type SampleUtterance struct { + // Text - Text attribute of sample utterance. + Text *string `json:"text,omitempty"` + // Links - Links attribute of sample utterance. + Links *[]string `json:"links,omitempty"` + // Qid - Question id of sample utterance (for stackoverflow questions titles). + Qid *string `json:"qid,omitempty"` +} + +// Scale container App scaling configurations. +type Scale struct { + // MinReplicas - Optional. Minimum number of container replicas. + MinReplicas *int32 `json:"minReplicas,omitempty"` + // MaxReplicas - Optional. Maximum number of container replicas. Defaults to 10 if not set. + MaxReplicas *int32 `json:"maxReplicas,omitempty"` + // Rules - Scaling rules. + Rules *[]ScaleRule `json:"rules,omitempty"` +} + +// ScaleRule container App container scaling rule. +type ScaleRule struct { + // Name - Scale Rule Name + Name *string `json:"name,omitempty"` + // AzureQueue - Azure Queue based scaling. + AzureQueue *QueueScaleRule `json:"azureQueue,omitempty"` + // Custom - Custom scale rule. + Custom *CustomScaleRule `json:"custom,omitempty"` + // HTTP - HTTP requests based scaling. + HTTP *HTTPScaleRule `json:"http,omitempty"` +} + +// ScaleRuleAuth auth Secrets for Container App Scale Rule +type ScaleRuleAuth struct { + // SecretRef - Name of the Container App secret from which to pull the auth params. + SecretRef *string `json:"secretRef,omitempty"` + // TriggerParameter - Trigger Parameter that uses the secret + TriggerParameter *string `json:"triggerParameter,omitempty"` +} + +// Secret container App Secret. +type Secret struct { + // Name - Secret Name. + Name *string `json:"name,omitempty"` + // Value - Secret Value. + Value *string `json:"value,omitempty"` +} + +// SecretsCollection container App Secrets Collection ARM resource. +type SecretsCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]ContainerAppSecret `json:"value,omitempty"` +} + +// ServiceSpecification resource metrics service provided by Microsoft.Insights resource provider. +type ServiceSpecification struct { + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` + LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` +} + +// SetObject ... +type SetObject struct { + autorest.Response `json:"-"` + Value interface{} `json:"value,omitempty"` +} + +// Site a web app, a mobile app backend, or an API app. +type Site struct { + autorest.Response `json:"-"` + // SiteProperties - Site resource specific properties + *SiteProperties `json:"properties,omitempty"` + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Location - Resource Location. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Site. +func (s Site) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SiteProperties != nil { + objectMap["properties"] = s.SiteProperties + } + if s.Identity != nil { + objectMap["identity"] = s.Identity + } + if s.ExtendedLocation != nil { + objectMap["extendedLocation"] = s.ExtendedLocation + } + if s.Kind != nil { + objectMap["kind"] = s.Kind + } + if s.Location != nil { + objectMap["location"] = s.Location + } + if s.Tags != nil { + objectMap["tags"] = s.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Site struct. +func (s *Site) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var siteProperties SiteProperties + err = json.Unmarshal(*v, &siteProperties) + if err != nil { + return err + } + s.SiteProperties = &siteProperties + } + case "identity": + if v != nil { + var identity ManagedServiceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + s.Identity = &identity + } + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + s.ExtendedLocation = &extendedLocation + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + s.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + s.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + s.Tags = tags + } + } + } + + return nil +} + +// SiteAuthSettings configuration settings for the Azure App Service Authentication / Authorization +// feature. +type SiteAuthSettings struct { + autorest.Response `json:"-"` + // SiteAuthSettingsProperties - SiteAuthSettings resource specific properties + *SiteAuthSettingsProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SiteAuthSettings. +func (sas SiteAuthSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sas.SiteAuthSettingsProperties != nil { + objectMap["properties"] = sas.SiteAuthSettingsProperties + } + if sas.Kind != nil { + objectMap["kind"] = sas.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SiteAuthSettings struct. +func (sas *SiteAuthSettings) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var siteAuthSettingsProperties SiteAuthSettingsProperties + err = json.Unmarshal(*v, &siteAuthSettingsProperties) + if err != nil { + return err + } + sas.SiteAuthSettingsProperties = &siteAuthSettingsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sas.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sas.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sas.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sas.Type = &typeVar + } + } + } + + return nil +} + +// SiteAuthSettingsProperties siteAuthSettings resource specific properties +type SiteAuthSettingsProperties struct { + // Enabled - true if the Authentication / Authorization feature is enabled for the current app; otherwise, false. + Enabled *bool `json:"enabled,omitempty"` + // RuntimeVersion - The RuntimeVersion of the Authentication / Authorization feature in use for the current app. + // The setting in this value can control the behavior of certain features in the Authentication / Authorization module. + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + // UnauthenticatedClientAction - The action to take when an unauthenticated client attempts to access the app. Possible values include: 'UnauthenticatedClientActionRedirectToLoginPage', 'UnauthenticatedClientActionAllowAnonymous' + UnauthenticatedClientAction UnauthenticatedClientAction `json:"unauthenticatedClientAction,omitempty"` + // TokenStoreEnabled - true to durably store platform-specific security tokens that are obtained during login flows; otherwise, false. + // The default is false. + TokenStoreEnabled *bool `json:"tokenStoreEnabled,omitempty"` + // AllowedExternalRedirectUrls - External URLs that can be redirected to as part of logging in or logging out of the app. Note that the query string part of the URL is ignored. + // This is an advanced setting typically only needed by Windows Store application backends. + // Note that URLs within the current domain are always implicitly allowed. + AllowedExternalRedirectUrls *[]string `json:"allowedExternalRedirectUrls,omitempty"` + // DefaultProvider - The default authentication provider to use when multiple providers are configured. + // This setting is only needed if multiple providers are configured and the unauthenticated client + // action is set to "RedirectToLoginPage". Possible values include: 'BuiltInAuthenticationProviderAzureActiveDirectory', 'BuiltInAuthenticationProviderFacebook', 'BuiltInAuthenticationProviderGoogle', 'BuiltInAuthenticationProviderMicrosoftAccount', 'BuiltInAuthenticationProviderTwitter', 'BuiltInAuthenticationProviderGithub' + DefaultProvider BuiltInAuthenticationProvider `json:"defaultProvider,omitempty"` + // TokenRefreshExtensionHours - The number of hours after session token expiration that a session token can be used to + // call the token refresh API. The default is 72 hours. + TokenRefreshExtensionHours *float64 `json:"tokenRefreshExtensionHours,omitempty"` + // ClientID - The Client ID of this relying party application, known as the client_id. + // This setting is required for enabling OpenID Connection authentication with Azure Active Directory or + // other 3rd party OpenID Connect providers. + // More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html + ClientID *string `json:"clientId,omitempty"` + // ClientSecret - The Client Secret of this relying party application (in Azure Active Directory, this is also referred to as the Key). + // This setting is optional. If no client secret is configured, the OpenID Connect implicit auth flow is used to authenticate end users. + // Otherwise, the OpenID Connect Authorization Code Flow is used to authenticate end users. + // More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html + ClientSecret *string `json:"clientSecret,omitempty"` + // ClientSecretSettingName - The app setting name that contains the client secret of the relying party application. + ClientSecretSettingName *string `json:"clientSecretSettingName,omitempty"` + // ClientSecretCertificateThumbprint - An alternative to the client secret, that is the thumbprint of a certificate used for signing purposes. This property acts as + // a replacement for the Client Secret. It is also optional. + ClientSecretCertificateThumbprint *string `json:"clientSecretCertificateThumbprint,omitempty"` + // Issuer - The OpenID Connect Issuer URI that represents the entity which issues access tokens for this application. + // When using Azure Active Directory, this value is the URI of the directory tenant, e.g. https://sts.windows.net/{tenant-guid}/. + // This URI is a case-sensitive identifier for the token issuer. + // More information on OpenID Connect Discovery: http://openid.net/specs/openid-connect-discovery-1_0.html + Issuer *string `json:"issuer,omitempty"` + // ValidateIssuer - Gets a value indicating whether the issuer should be a valid HTTPS url and be validated as such. + ValidateIssuer *bool `json:"validateIssuer,omitempty"` + // AllowedAudiences - Allowed audience values to consider when validating JWTs issued by + // Azure Active Directory. Note that the ClientID value is always considered an + // allowed audience, regardless of this setting. + AllowedAudiences *[]string `json:"allowedAudiences,omitempty"` + // AdditionalLoginParams - Login parameters to send to the OpenID Connect authorization endpoint when + // a user logs in. Each parameter must be in the form "key=value". + AdditionalLoginParams *[]string `json:"additionalLoginParams,omitempty"` + // AadClaimsAuthorization - Gets a JSON string containing the Azure AD Acl settings. + AadClaimsAuthorization *string `json:"aadClaimsAuthorization,omitempty"` + // GoogleClientID - The OpenID Connect Client ID for the Google web application. + // This setting is required for enabling Google Sign-In. + // Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/ + GoogleClientID *string `json:"googleClientId,omitempty"` + // GoogleClientSecret - The client secret associated with the Google web application. + // This setting is required for enabling Google Sign-In. + // Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/ + GoogleClientSecret *string `json:"googleClientSecret,omitempty"` + // GoogleClientSecretSettingName - The app setting name that contains the client secret associated with + // the Google web application. + GoogleClientSecretSettingName *string `json:"googleClientSecretSettingName,omitempty"` + // GoogleOAuthScopes - The OAuth 2.0 scopes that will be requested as part of Google Sign-In authentication. + // This setting is optional. If not specified, "openid", "profile", and "email" are used as default scopes. + // Google Sign-In documentation: https://developers.google.com/identity/sign-in/web/ + GoogleOAuthScopes *[]string `json:"googleOAuthScopes,omitempty"` + // FacebookAppID - The App ID of the Facebook app used for login. + // This setting is required for enabling Facebook Login. + // Facebook Login documentation: https://developers.facebook.com/docs/facebook-login + FacebookAppID *string `json:"facebookAppId,omitempty"` + // FacebookAppSecret - The App Secret of the Facebook app used for Facebook Login. + // This setting is required for enabling Facebook Login. + // Facebook Login documentation: https://developers.facebook.com/docs/facebook-login + FacebookAppSecret *string `json:"facebookAppSecret,omitempty"` + // FacebookAppSecretSettingName - The app setting name that contains the app secret used for Facebook Login. + FacebookAppSecretSettingName *string `json:"facebookAppSecretSettingName,omitempty"` + // FacebookOAuthScopes - The OAuth 2.0 scopes that will be requested as part of Facebook Login authentication. + // This setting is optional. + // Facebook Login documentation: https://developers.facebook.com/docs/facebook-login + FacebookOAuthScopes *[]string `json:"facebookOAuthScopes,omitempty"` + // GitHubClientID - The Client Id of the GitHub app used for login. + // This setting is required for enabling Github login + GitHubClientID *string `json:"gitHubClientId,omitempty"` + // GitHubClientSecret - The Client Secret of the GitHub app used for Github Login. + // This setting is required for enabling Github login. + GitHubClientSecret *string `json:"gitHubClientSecret,omitempty"` + // GitHubClientSecretSettingName - The app setting name that contains the client secret of the Github + // app used for GitHub Login. + GitHubClientSecretSettingName *string `json:"gitHubClientSecretSettingName,omitempty"` + // GitHubOAuthScopes - The OAuth 2.0 scopes that will be requested as part of GitHub Login authentication. + // This setting is optional + GitHubOAuthScopes *[]string `json:"gitHubOAuthScopes,omitempty"` + // TwitterConsumerKey - The OAuth 1.0a consumer key of the Twitter application used for sign-in. + // This setting is required for enabling Twitter Sign-In. + // Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + TwitterConsumerKey *string `json:"twitterConsumerKey,omitempty"` + // TwitterConsumerSecret - The OAuth 1.0a consumer secret of the Twitter application used for sign-in. + // This setting is required for enabling Twitter Sign-In. + // Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + TwitterConsumerSecret *string `json:"twitterConsumerSecret,omitempty"` + // TwitterConsumerSecretSettingName - The app setting name that contains the OAuth 1.0a consumer secret of the Twitter + // application used for sign-in. + TwitterConsumerSecretSettingName *string `json:"twitterConsumerSecretSettingName,omitempty"` + // MicrosoftAccountClientID - The OAuth 2.0 client ID that was created for the app used for authentication. + // This setting is required for enabling Microsoft Account authentication. + // Microsoft Account OAuth documentation: https://dev.onedrive.com/auth/msa_oauth.htm + MicrosoftAccountClientID *string `json:"microsoftAccountClientId,omitempty"` + // MicrosoftAccountClientSecret - The OAuth 2.0 client secret that was created for the app used for authentication. + // This setting is required for enabling Microsoft Account authentication. + // Microsoft Account OAuth documentation: https://dev.onedrive.com/auth/msa_oauth.htm + MicrosoftAccountClientSecret *string `json:"microsoftAccountClientSecret,omitempty"` + // MicrosoftAccountClientSecretSettingName - The app setting name containing the OAuth 2.0 client secret that was created for the + // app used for authentication. + MicrosoftAccountClientSecretSettingName *string `json:"microsoftAccountClientSecretSettingName,omitempty"` + // MicrosoftAccountOAuthScopes - The OAuth 2.0 scopes that will be requested as part of Microsoft Account authentication. + // This setting is optional. If not specified, "wl.basic" is used as the default scope. + // Microsoft Account Scopes and permissions documentation: https://msdn.microsoft.com/en-us/library/dn631845.aspx + MicrosoftAccountOAuthScopes *[]string `json:"microsoftAccountOAuthScopes,omitempty"` + // IsAuthFromFile - "true" if the auth config settings should be read from a file, + // "false" otherwise + IsAuthFromFile *string `json:"isAuthFromFile,omitempty"` + // AuthFilePath - The path of the config file containing auth settings. + // If the path is relative, base will the site's root directory. + AuthFilePath *string `json:"authFilePath,omitempty"` + // ConfigVersion - The ConfigVersion of the Authentication / Authorization feature in use for the current app. + // The setting in this value can control the behavior of the control plane for Authentication / Authorization. + ConfigVersion *string `json:"configVersion,omitempty"` +} + +// SiteAuthSettingsV2 configuration settings for the Azure App Service Authentication / Authorization V2 +// feature. +type SiteAuthSettingsV2 struct { + autorest.Response `json:"-"` + // SiteAuthSettingsV2Properties - SiteAuthSettingsV2 resource specific properties + *SiteAuthSettingsV2Properties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SiteAuthSettingsV2. +func (sasv SiteAuthSettingsV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sasv.SiteAuthSettingsV2Properties != nil { + objectMap["properties"] = sasv.SiteAuthSettingsV2Properties + } + if sasv.Kind != nil { + objectMap["kind"] = sasv.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SiteAuthSettingsV2 struct. +func (sasv *SiteAuthSettingsV2) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var siteAuthSettingsV2Properties SiteAuthSettingsV2Properties + err = json.Unmarshal(*v, &siteAuthSettingsV2Properties) + if err != nil { + return err + } + sasv.SiteAuthSettingsV2Properties = &siteAuthSettingsV2Properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sasv.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sasv.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sasv.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sasv.Type = &typeVar + } + } + } + + return nil +} + +// SiteAuthSettingsV2Properties siteAuthSettingsV2 resource specific properties +type SiteAuthSettingsV2Properties struct { + // Platform - The configuration settings of the platform of App Service Authentication/Authorization. + Platform *AuthPlatform `json:"platform,omitempty"` + // GlobalValidation - The configuration settings that determines the validation flow of users using App Service Authentication/Authorization. + GlobalValidation *GlobalValidation `json:"globalValidation,omitempty"` + // IdentityProviders - The configuration settings of each of the identity providers used to configure App Service Authentication/Authorization. + IdentityProviders *IdentityProviders `json:"identityProviders,omitempty"` + // Login - The configuration settings of the login flow of users using App Service Authentication/Authorization. + Login *Login `json:"login,omitempty"` + // HTTPSettings - The configuration settings of the HTTP requests for authentication and authorization requests made against App Service Authentication/Authorization. + HTTPSettings *HTTPSettings `json:"httpSettings,omitempty"` +} + +// SiteCloneability represents whether or not an app is cloneable. +type SiteCloneability struct { + autorest.Response `json:"-"` + // Result - Name of app. Possible values include: 'CloneAbilityResultCloneable', 'CloneAbilityResultPartiallyCloneable', 'CloneAbilityResultNotCloneable' + Result CloneAbilityResult `json:"result,omitempty"` + // BlockingFeatures - List of features enabled on app that prevent cloning. + BlockingFeatures *[]SiteCloneabilityCriterion `json:"blockingFeatures,omitempty"` + // UnsupportedFeatures - List of features enabled on app that are non-blocking but cannot be cloned. The app can still be cloned + // but the features in this list will not be set up on cloned app. + UnsupportedFeatures *[]SiteCloneabilityCriterion `json:"unsupportedFeatures,omitempty"` + // BlockingCharacteristics - List of blocking application characteristics. + BlockingCharacteristics *[]SiteCloneabilityCriterion `json:"blockingCharacteristics,omitempty"` +} + +// SiteCloneabilityCriterion an app cloneability criterion. +type SiteCloneabilityCriterion struct { + // Name - Name of criterion. + Name *string `json:"name,omitempty"` + // Description - Description of criterion. + Description *string `json:"description,omitempty"` +} + +// SiteConfig configuration of an App Service app. +type SiteConfig struct { + // NumberOfWorkers - Number of workers. + NumberOfWorkers *int32 `json:"numberOfWorkers,omitempty"` + // DefaultDocuments - Default documents. + DefaultDocuments *[]string `json:"defaultDocuments,omitempty"` + // NetFrameworkVersion - .NET Framework version. + NetFrameworkVersion *string `json:"netFrameworkVersion,omitempty"` + // PhpVersion - Version of PHP. + PhpVersion *string `json:"phpVersion,omitempty"` + // PythonVersion - Version of Python. + PythonVersion *string `json:"pythonVersion,omitempty"` + // NodeVersion - Version of Node.js. + NodeVersion *string `json:"nodeVersion,omitempty"` + // PowerShellVersion - Version of PowerShell. + PowerShellVersion *string `json:"powerShellVersion,omitempty"` + // LinuxFxVersion - Linux App Framework and version + LinuxFxVersion *string `json:"linuxFxVersion,omitempty"` + // WindowsFxVersion - Xenon App Framework and version + WindowsFxVersion *string `json:"windowsFxVersion,omitempty"` + // RequestTracingEnabled - true if request tracing is enabled; otherwise, false. + RequestTracingEnabled *bool `json:"requestTracingEnabled,omitempty"` + // RequestTracingExpirationTime - Request tracing expiration time. + RequestTracingExpirationTime *date.Time `json:"requestTracingExpirationTime,omitempty"` + // RemoteDebuggingEnabled - true if remote debugging is enabled; otherwise, false. + RemoteDebuggingEnabled *bool `json:"remoteDebuggingEnabled,omitempty"` + // RemoteDebuggingVersion - Remote debugging version. + RemoteDebuggingVersion *string `json:"remoteDebuggingVersion,omitempty"` + // HTTPLoggingEnabled - true if HTTP logging is enabled; otherwise, false. + HTTPLoggingEnabled *bool `json:"httpLoggingEnabled,omitempty"` + // AcrUseManagedIdentityCreds - Flag to use Managed Identity Creds for ACR pull + AcrUseManagedIdentityCreds *bool `json:"acrUseManagedIdentityCreds,omitempty"` + // AcrUserManagedIdentityID - If using user managed identity, the user managed identity ClientId + AcrUserManagedIdentityID *string `json:"acrUserManagedIdentityID,omitempty"` + // LogsDirectorySizeLimit - HTTP logs directory size limit. + LogsDirectorySizeLimit *int32 `json:"logsDirectorySizeLimit,omitempty"` + // DetailedErrorLoggingEnabled - true if detailed error logging is enabled; otherwise, false. + DetailedErrorLoggingEnabled *bool `json:"detailedErrorLoggingEnabled,omitempty"` + // PublishingUsername - Publishing user name. + PublishingUsername *string `json:"publishingUsername,omitempty"` + // AppSettings - Application settings. + AppSettings *[]NameValuePair `json:"appSettings,omitempty"` + // ConnectionStrings - Connection strings. + ConnectionStrings *[]ConnStringInfo `json:"connectionStrings,omitempty"` + // MachineKey - READ-ONLY; Site MachineKey. + MachineKey *SiteMachineKey `json:"machineKey,omitempty"` + // HandlerMappings - Handler mappings. + HandlerMappings *[]HandlerMapping `json:"handlerMappings,omitempty"` + // DocumentRoot - Document root. + DocumentRoot *string `json:"documentRoot,omitempty"` + // ScmType - SCM type. Possible values include: 'ScmTypeNone', 'ScmTypeDropbox', 'ScmTypeTfs', 'ScmTypeLocalGit', 'ScmTypeGitHub', 'ScmTypeCodePlexGit', 'ScmTypeCodePlexHg', 'ScmTypeBitbucketGit', 'ScmTypeBitbucketHg', 'ScmTypeExternalGit', 'ScmTypeExternalHg', 'ScmTypeOneDrive', 'ScmTypeVSO', 'ScmTypeVSTSRM' + ScmType ScmType `json:"scmType,omitempty"` + // Use32BitWorkerProcess - true to use 32-bit worker process; otherwise, false. + Use32BitWorkerProcess *bool `json:"use32BitWorkerProcess,omitempty"` + // WebSocketsEnabled - true if WebSocket is enabled; otherwise, false. + WebSocketsEnabled *bool `json:"webSocketsEnabled,omitempty"` + // AlwaysOn - true if Always On is enabled; otherwise, false. + AlwaysOn *bool `json:"alwaysOn,omitempty"` + // JavaVersion - Java version. + JavaVersion *string `json:"javaVersion,omitempty"` + // JavaContainer - Java container. + JavaContainer *string `json:"javaContainer,omitempty"` + // JavaContainerVersion - Java container version. + JavaContainerVersion *string `json:"javaContainerVersion,omitempty"` + // AppCommandLine - App command line to launch. + AppCommandLine *string `json:"appCommandLine,omitempty"` + // ManagedPipelineMode - Managed pipeline mode. Possible values include: 'ManagedPipelineModeIntegrated', 'ManagedPipelineModeClassic' + ManagedPipelineMode ManagedPipelineMode `json:"managedPipelineMode,omitempty"` + // VirtualApplications - Virtual applications. + VirtualApplications *[]VirtualApplication `json:"virtualApplications,omitempty"` + // LoadBalancing - Site load balancing. Possible values include: 'SiteLoadBalancingWeightedRoundRobin', 'SiteLoadBalancingLeastRequests', 'SiteLoadBalancingLeastResponseTime', 'SiteLoadBalancingWeightedTotalTraffic', 'SiteLoadBalancingRequestHash', 'SiteLoadBalancingPerSiteRoundRobin' + LoadBalancing SiteLoadBalancing `json:"loadBalancing,omitempty"` + // Experiments - This is work around for polymorphic types. + Experiments *Experiments `json:"experiments,omitempty"` + // Limits - Site limits. + Limits *SiteLimits `json:"limits,omitempty"` + // AutoHealEnabled - true if Auto Heal is enabled; otherwise, false. + AutoHealEnabled *bool `json:"autoHealEnabled,omitempty"` + // AutoHealRules - Auto Heal rules. + AutoHealRules *AutoHealRules `json:"autoHealRules,omitempty"` + // TracingOptions - Tracing options. + TracingOptions *string `json:"tracingOptions,omitempty"` + // VnetName - Virtual Network name. + VnetName *string `json:"vnetName,omitempty"` + // VnetRouteAllEnabled - Virtual Network Route All enabled. This causes all outbound traffic to have Virtual Network Security Groups and User Defined Routes applied. + VnetRouteAllEnabled *bool `json:"vnetRouteAllEnabled,omitempty"` + // VnetPrivatePortsCount - The number of private ports assigned to this app. These will be assigned dynamically on runtime. + VnetPrivatePortsCount *int32 `json:"vnetPrivatePortsCount,omitempty"` + // Cors - Cross-Origin Resource Sharing (CORS) settings. + Cors *CorsSettings `json:"cors,omitempty"` + // Push - Push endpoint settings. + Push *PushSettings `json:"push,omitempty"` + // APIDefinition - Information about the formal API definition for the app. + APIDefinition *APIDefinitionInfo `json:"apiDefinition,omitempty"` + // APIManagementConfig - Azure API management settings linked to the app. + APIManagementConfig *APIManagementConfig `json:"apiManagementConfig,omitempty"` + // AutoSwapSlotName - Auto-swap slot name. + AutoSwapSlotName *string `json:"autoSwapSlotName,omitempty"` + // LocalMySQLEnabled - true to enable local MySQL; otherwise, false. + LocalMySQLEnabled *bool `json:"localMySqlEnabled,omitempty"` + // ManagedServiceIdentityID - Managed Service Identity Id + ManagedServiceIdentityID *int32 `json:"managedServiceIdentityId,omitempty"` + // XManagedServiceIdentityID - Explicit Managed Service Identity Id + XManagedServiceIdentityID *int32 `json:"xManagedServiceIdentityId,omitempty"` + // KeyVaultReferenceIdentity - Identity to use for Key Vault Reference authentication. + KeyVaultReferenceIdentity *string `json:"keyVaultReferenceIdentity,omitempty"` + // IPSecurityRestrictions - IP security restrictions for main. + IPSecurityRestrictions *[]IPSecurityRestriction `json:"ipSecurityRestrictions,omitempty"` + // ScmIPSecurityRestrictions - IP security restrictions for scm. + ScmIPSecurityRestrictions *[]IPSecurityRestriction `json:"scmIpSecurityRestrictions,omitempty"` + // ScmIPSecurityRestrictionsUseMain - IP security restrictions for scm to use main. + ScmIPSecurityRestrictionsUseMain *bool `json:"scmIpSecurityRestrictionsUseMain,omitempty"` + // HTTP20Enabled - Http20Enabled: configures a web site to allow clients to connect over http2.0 + HTTP20Enabled *bool `json:"http20Enabled,omitempty"` + // MinTLSVersion - MinTlsVersion: configures the minimum version of TLS required for SSL requests. Possible values include: 'SupportedTLSVersionsOneFullStopZero', 'SupportedTLSVersionsOneFullStopOne', 'SupportedTLSVersionsOneFullStopTwo' + MinTLSVersion SupportedTLSVersions `json:"minTlsVersion,omitempty"` + // ScmMinTLSVersion - ScmMinTlsVersion: configures the minimum version of TLS required for SSL requests for SCM site. Possible values include: 'SupportedTLSVersionsOneFullStopZero', 'SupportedTLSVersionsOneFullStopOne', 'SupportedTLSVersionsOneFullStopTwo' + ScmMinTLSVersion SupportedTLSVersions `json:"scmMinTlsVersion,omitempty"` + // FtpsState - State of FTP / FTPS service. Possible values include: 'FtpsStateAllAllowed', 'FtpsStateFtpsOnly', 'FtpsStateDisabled' + FtpsState FtpsState `json:"ftpsState,omitempty"` + // PreWarmedInstanceCount - Number of preWarmed instances. + // This setting only applies to the Consumption and Elastic Plans + PreWarmedInstanceCount *int32 `json:"preWarmedInstanceCount,omitempty"` + // FunctionAppScaleLimit - Maximum number of workers that a site can scale out to. + // This setting only applies to the Consumption and Elastic Premium Plans + FunctionAppScaleLimit *int32 `json:"functionAppScaleLimit,omitempty"` + // HealthCheckPath - Health check path + HealthCheckPath *string `json:"healthCheckPath,omitempty"` + // FunctionsRuntimeScaleMonitoringEnabled - Gets or sets a value indicating whether functions runtime scale monitoring is enabled. When enabled, + // the ScaleController will not monitor event sources directly, but will instead call to the + // runtime to get scale status. + FunctionsRuntimeScaleMonitoringEnabled *bool `json:"functionsRuntimeScaleMonitoringEnabled,omitempty"` + // WebsiteTimeZone - Sets the time zone a site uses for generating timestamps. Compatible with Linux and Windows App Service. Setting the WEBSITE_TIME_ZONE app setting takes precedence over this config. For Linux, expects tz database values https://www.iana.org/time-zones (for a quick reference see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). For Windows, expects one of the time zones listed under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones + WebsiteTimeZone *string `json:"websiteTimeZone,omitempty"` + // MinimumElasticInstanceCount - Number of minimum instance count for a site + // This setting only applies to the Elastic Plans + MinimumElasticInstanceCount *int32 `json:"minimumElasticInstanceCount,omitempty"` + // AzureStorageAccounts - List of Azure Storage Accounts. + AzureStorageAccounts map[string]*AzureStorageInfoValue `json:"azureStorageAccounts"` + // PublicNetworkAccess - Property to allow or block all public traffic. + PublicNetworkAccess *string `json:"publicNetworkAccess,omitempty"` +} + +// MarshalJSON is the custom marshaler for SiteConfig. +func (sc SiteConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sc.NumberOfWorkers != nil { + objectMap["numberOfWorkers"] = sc.NumberOfWorkers + } + if sc.DefaultDocuments != nil { + objectMap["defaultDocuments"] = sc.DefaultDocuments + } + if sc.NetFrameworkVersion != nil { + objectMap["netFrameworkVersion"] = sc.NetFrameworkVersion + } + if sc.PhpVersion != nil { + objectMap["phpVersion"] = sc.PhpVersion + } + if sc.PythonVersion != nil { + objectMap["pythonVersion"] = sc.PythonVersion + } + if sc.NodeVersion != nil { + objectMap["nodeVersion"] = sc.NodeVersion + } + if sc.PowerShellVersion != nil { + objectMap["powerShellVersion"] = sc.PowerShellVersion + } + if sc.LinuxFxVersion != nil { + objectMap["linuxFxVersion"] = sc.LinuxFxVersion + } + if sc.WindowsFxVersion != nil { + objectMap["windowsFxVersion"] = sc.WindowsFxVersion + } + if sc.RequestTracingEnabled != nil { + objectMap["requestTracingEnabled"] = sc.RequestTracingEnabled + } + if sc.RequestTracingExpirationTime != nil { + objectMap["requestTracingExpirationTime"] = sc.RequestTracingExpirationTime + } + if sc.RemoteDebuggingEnabled != nil { + objectMap["remoteDebuggingEnabled"] = sc.RemoteDebuggingEnabled + } + if sc.RemoteDebuggingVersion != nil { + objectMap["remoteDebuggingVersion"] = sc.RemoteDebuggingVersion + } + if sc.HTTPLoggingEnabled != nil { + objectMap["httpLoggingEnabled"] = sc.HTTPLoggingEnabled + } + if sc.AcrUseManagedIdentityCreds != nil { + objectMap["acrUseManagedIdentityCreds"] = sc.AcrUseManagedIdentityCreds + } + if sc.AcrUserManagedIdentityID != nil { + objectMap["acrUserManagedIdentityID"] = sc.AcrUserManagedIdentityID + } + if sc.LogsDirectorySizeLimit != nil { + objectMap["logsDirectorySizeLimit"] = sc.LogsDirectorySizeLimit + } + if sc.DetailedErrorLoggingEnabled != nil { + objectMap["detailedErrorLoggingEnabled"] = sc.DetailedErrorLoggingEnabled + } + if sc.PublishingUsername != nil { + objectMap["publishingUsername"] = sc.PublishingUsername + } + if sc.AppSettings != nil { + objectMap["appSettings"] = sc.AppSettings + } + if sc.ConnectionStrings != nil { + objectMap["connectionStrings"] = sc.ConnectionStrings + } + if sc.HandlerMappings != nil { + objectMap["handlerMappings"] = sc.HandlerMappings + } + if sc.DocumentRoot != nil { + objectMap["documentRoot"] = sc.DocumentRoot + } + if sc.ScmType != "" { + objectMap["scmType"] = sc.ScmType + } + if sc.Use32BitWorkerProcess != nil { + objectMap["use32BitWorkerProcess"] = sc.Use32BitWorkerProcess + } + if sc.WebSocketsEnabled != nil { + objectMap["webSocketsEnabled"] = sc.WebSocketsEnabled + } + if sc.AlwaysOn != nil { + objectMap["alwaysOn"] = sc.AlwaysOn + } + if sc.JavaVersion != nil { + objectMap["javaVersion"] = sc.JavaVersion + } + if sc.JavaContainer != nil { + objectMap["javaContainer"] = sc.JavaContainer + } + if sc.JavaContainerVersion != nil { + objectMap["javaContainerVersion"] = sc.JavaContainerVersion + } + if sc.AppCommandLine != nil { + objectMap["appCommandLine"] = sc.AppCommandLine + } + if sc.ManagedPipelineMode != "" { + objectMap["managedPipelineMode"] = sc.ManagedPipelineMode + } + if sc.VirtualApplications != nil { + objectMap["virtualApplications"] = sc.VirtualApplications + } + if sc.LoadBalancing != "" { + objectMap["loadBalancing"] = sc.LoadBalancing + } + if sc.Experiments != nil { + objectMap["experiments"] = sc.Experiments + } + if sc.Limits != nil { + objectMap["limits"] = sc.Limits + } + if sc.AutoHealEnabled != nil { + objectMap["autoHealEnabled"] = sc.AutoHealEnabled + } + if sc.AutoHealRules != nil { + objectMap["autoHealRules"] = sc.AutoHealRules + } + if sc.TracingOptions != nil { + objectMap["tracingOptions"] = sc.TracingOptions + } + if sc.VnetName != nil { + objectMap["vnetName"] = sc.VnetName + } + if sc.VnetRouteAllEnabled != nil { + objectMap["vnetRouteAllEnabled"] = sc.VnetRouteAllEnabled + } + if sc.VnetPrivatePortsCount != nil { + objectMap["vnetPrivatePortsCount"] = sc.VnetPrivatePortsCount + } + if sc.Cors != nil { + objectMap["cors"] = sc.Cors + } + if sc.Push != nil { + objectMap["push"] = sc.Push + } + if sc.APIDefinition != nil { + objectMap["apiDefinition"] = sc.APIDefinition + } + if sc.APIManagementConfig != nil { + objectMap["apiManagementConfig"] = sc.APIManagementConfig + } + if sc.AutoSwapSlotName != nil { + objectMap["autoSwapSlotName"] = sc.AutoSwapSlotName + } + if sc.LocalMySQLEnabled != nil { + objectMap["localMySqlEnabled"] = sc.LocalMySQLEnabled + } + if sc.ManagedServiceIdentityID != nil { + objectMap["managedServiceIdentityId"] = sc.ManagedServiceIdentityID + } + if sc.XManagedServiceIdentityID != nil { + objectMap["xManagedServiceIdentityId"] = sc.XManagedServiceIdentityID + } + if sc.KeyVaultReferenceIdentity != nil { + objectMap["keyVaultReferenceIdentity"] = sc.KeyVaultReferenceIdentity + } + if sc.IPSecurityRestrictions != nil { + objectMap["ipSecurityRestrictions"] = sc.IPSecurityRestrictions + } + if sc.ScmIPSecurityRestrictions != nil { + objectMap["scmIpSecurityRestrictions"] = sc.ScmIPSecurityRestrictions + } + if sc.ScmIPSecurityRestrictionsUseMain != nil { + objectMap["scmIpSecurityRestrictionsUseMain"] = sc.ScmIPSecurityRestrictionsUseMain + } + if sc.HTTP20Enabled != nil { + objectMap["http20Enabled"] = sc.HTTP20Enabled + } + if sc.MinTLSVersion != "" { + objectMap["minTlsVersion"] = sc.MinTLSVersion + } + if sc.ScmMinTLSVersion != "" { + objectMap["scmMinTlsVersion"] = sc.ScmMinTLSVersion + } + if sc.FtpsState != "" { + objectMap["ftpsState"] = sc.FtpsState + } + if sc.PreWarmedInstanceCount != nil { + objectMap["preWarmedInstanceCount"] = sc.PreWarmedInstanceCount + } + if sc.FunctionAppScaleLimit != nil { + objectMap["functionAppScaleLimit"] = sc.FunctionAppScaleLimit + } + if sc.HealthCheckPath != nil { + objectMap["healthCheckPath"] = sc.HealthCheckPath + } + if sc.FunctionsRuntimeScaleMonitoringEnabled != nil { + objectMap["functionsRuntimeScaleMonitoringEnabled"] = sc.FunctionsRuntimeScaleMonitoringEnabled + } + if sc.WebsiteTimeZone != nil { + objectMap["websiteTimeZone"] = sc.WebsiteTimeZone + } + if sc.MinimumElasticInstanceCount != nil { + objectMap["minimumElasticInstanceCount"] = sc.MinimumElasticInstanceCount + } + if sc.AzureStorageAccounts != nil { + objectMap["azureStorageAccounts"] = sc.AzureStorageAccounts + } + if sc.PublicNetworkAccess != nil { + objectMap["publicNetworkAccess"] = sc.PublicNetworkAccess + } + return json.Marshal(objectMap) +} + +// SiteConfigPropertiesDictionary site config properties dictionary. +type SiteConfigPropertiesDictionary struct { + // Use32BitWorkerProcess - READ-ONLY; true if use32BitWorkerProcess should be set to true for the stack; otherwise, false. + Use32BitWorkerProcess *bool `json:"use32BitWorkerProcess,omitempty"` + // LinuxFxVersion - READ-ONLY; LinuxFxVersion configuration setting. + LinuxFxVersion *string `json:"linuxFxVersion,omitempty"` + // JavaVersion - READ-ONLY; JavaVersion configuration setting. + JavaVersion *string `json:"javaVersion,omitempty"` + // PowerShellVersion - READ-ONLY; PowerShellVersion configuration setting. + PowerShellVersion *string `json:"powerShellVersion,omitempty"` +} + +// MarshalJSON is the custom marshaler for SiteConfigPropertiesDictionary. +func (scpd SiteConfigPropertiesDictionary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SiteConfigResource web app configuration ARM resource. +type SiteConfigResource struct { + autorest.Response `json:"-"` + // SiteConfig - Core resource properties + *SiteConfig `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SiteConfigResource. +func (scr SiteConfigResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scr.SiteConfig != nil { + objectMap["properties"] = scr.SiteConfig + } + if scr.Kind != nil { + objectMap["kind"] = scr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SiteConfigResource struct. +func (scr *SiteConfigResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var siteConfig SiteConfig + err = json.Unmarshal(*v, &siteConfig) + if err != nil { + return err + } + scr.SiteConfig = &siteConfig + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + scr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + scr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + scr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + scr.Type = &typeVar + } + } + } + + return nil +} + +// SiteConfigResourceCollection collection of site configurations. +type SiteConfigResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]SiteConfigResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SiteConfigResourceCollection. +func (scrc SiteConfigResourceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scrc.Value != nil { + objectMap["value"] = scrc.Value + } + return json.Marshal(objectMap) +} + +// SiteConfigResourceCollectionIterator provides access to a complete listing of SiteConfigResource values. +type SiteConfigResourceCollectionIterator struct { + i int + page SiteConfigResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SiteConfigResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SiteConfigResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SiteConfigResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SiteConfigResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SiteConfigResourceCollectionIterator) Response() SiteConfigResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SiteConfigResourceCollectionIterator) Value() SiteConfigResource { + if !iter.page.NotDone() { + return SiteConfigResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SiteConfigResourceCollectionIterator type. +func NewSiteConfigResourceCollectionIterator(page SiteConfigResourceCollectionPage) SiteConfigResourceCollectionIterator { + return SiteConfigResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (scrc SiteConfigResourceCollection) IsEmpty() bool { + return scrc.Value == nil || len(*scrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (scrc SiteConfigResourceCollection) hasNextLink() bool { + return scrc.NextLink != nil && len(*scrc.NextLink) != 0 +} + +// siteConfigResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (scrc SiteConfigResourceCollection) siteConfigResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !scrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(scrc.NextLink))) +} + +// SiteConfigResourceCollectionPage contains a page of SiteConfigResource values. +type SiteConfigResourceCollectionPage struct { + fn func(context.Context, SiteConfigResourceCollection) (SiteConfigResourceCollection, error) + scrc SiteConfigResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SiteConfigResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SiteConfigResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.scrc) + if err != nil { + return err + } + page.scrc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SiteConfigResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SiteConfigResourceCollectionPage) NotDone() bool { + return !page.scrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SiteConfigResourceCollectionPage) Response() SiteConfigResourceCollection { + return page.scrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SiteConfigResourceCollectionPage) Values() []SiteConfigResource { + if page.scrc.IsEmpty() { + return nil + } + return *page.scrc.Value +} + +// Creates a new instance of the SiteConfigResourceCollectionPage type. +func NewSiteConfigResourceCollectionPage(cur SiteConfigResourceCollection, getNextPage func(context.Context, SiteConfigResourceCollection) (SiteConfigResourceCollection, error)) SiteConfigResourceCollectionPage { + return SiteConfigResourceCollectionPage{ + fn: getNextPage, + scrc: cur, + } +} + +// SiteConfigurationSnapshotInfo a snapshot of a web app configuration. +type SiteConfigurationSnapshotInfo struct { + // SiteConfigurationSnapshotInfoProperties - SiteConfigurationSnapshotInfo resource specific properties + *SiteConfigurationSnapshotInfoProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SiteConfigurationSnapshotInfo. +func (scsi SiteConfigurationSnapshotInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scsi.SiteConfigurationSnapshotInfoProperties != nil { + objectMap["properties"] = scsi.SiteConfigurationSnapshotInfoProperties + } + if scsi.Kind != nil { + objectMap["kind"] = scsi.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SiteConfigurationSnapshotInfo struct. +func (scsi *SiteConfigurationSnapshotInfo) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var siteConfigurationSnapshotInfoProperties SiteConfigurationSnapshotInfoProperties + err = json.Unmarshal(*v, &siteConfigurationSnapshotInfoProperties) + if err != nil { + return err + } + scsi.SiteConfigurationSnapshotInfoProperties = &siteConfigurationSnapshotInfoProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + scsi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + scsi.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + scsi.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + scsi.Type = &typeVar + } + } + } + + return nil +} + +// SiteConfigurationSnapshotInfoCollection collection of metadata for the app configuration snapshots that +// can be restored. +type SiteConfigurationSnapshotInfoCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]SiteConfigurationSnapshotInfo `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SiteConfigurationSnapshotInfoCollection. +func (scsic SiteConfigurationSnapshotInfoCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scsic.Value != nil { + objectMap["value"] = scsic.Value + } + return json.Marshal(objectMap) +} + +// SiteConfigurationSnapshotInfoCollectionIterator provides access to a complete listing of +// SiteConfigurationSnapshotInfo values. +type SiteConfigurationSnapshotInfoCollectionIterator struct { + i int + page SiteConfigurationSnapshotInfoCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SiteConfigurationSnapshotInfoCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SiteConfigurationSnapshotInfoCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SiteConfigurationSnapshotInfoCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SiteConfigurationSnapshotInfoCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SiteConfigurationSnapshotInfoCollectionIterator) Response() SiteConfigurationSnapshotInfoCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SiteConfigurationSnapshotInfoCollectionIterator) Value() SiteConfigurationSnapshotInfo { + if !iter.page.NotDone() { + return SiteConfigurationSnapshotInfo{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SiteConfigurationSnapshotInfoCollectionIterator type. +func NewSiteConfigurationSnapshotInfoCollectionIterator(page SiteConfigurationSnapshotInfoCollectionPage) SiteConfigurationSnapshotInfoCollectionIterator { + return SiteConfigurationSnapshotInfoCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (scsic SiteConfigurationSnapshotInfoCollection) IsEmpty() bool { + return scsic.Value == nil || len(*scsic.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (scsic SiteConfigurationSnapshotInfoCollection) hasNextLink() bool { + return scsic.NextLink != nil && len(*scsic.NextLink) != 0 +} + +// siteConfigurationSnapshotInfoCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (scsic SiteConfigurationSnapshotInfoCollection) siteConfigurationSnapshotInfoCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !scsic.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(scsic.NextLink))) +} + +// SiteConfigurationSnapshotInfoCollectionPage contains a page of SiteConfigurationSnapshotInfo values. +type SiteConfigurationSnapshotInfoCollectionPage struct { + fn func(context.Context, SiteConfigurationSnapshotInfoCollection) (SiteConfigurationSnapshotInfoCollection, error) + scsic SiteConfigurationSnapshotInfoCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SiteConfigurationSnapshotInfoCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SiteConfigurationSnapshotInfoCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.scsic) + if err != nil { + return err + } + page.scsic = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SiteConfigurationSnapshotInfoCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SiteConfigurationSnapshotInfoCollectionPage) NotDone() bool { + return !page.scsic.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SiteConfigurationSnapshotInfoCollectionPage) Response() SiteConfigurationSnapshotInfoCollection { + return page.scsic +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SiteConfigurationSnapshotInfoCollectionPage) Values() []SiteConfigurationSnapshotInfo { + if page.scsic.IsEmpty() { + return nil + } + return *page.scsic.Value +} + +// Creates a new instance of the SiteConfigurationSnapshotInfoCollectionPage type. +func NewSiteConfigurationSnapshotInfoCollectionPage(cur SiteConfigurationSnapshotInfoCollection, getNextPage func(context.Context, SiteConfigurationSnapshotInfoCollection) (SiteConfigurationSnapshotInfoCollection, error)) SiteConfigurationSnapshotInfoCollectionPage { + return SiteConfigurationSnapshotInfoCollectionPage{ + fn: getNextPage, + scsic: cur, + } +} + +// SiteConfigurationSnapshotInfoProperties siteConfigurationSnapshotInfo resource specific properties +type SiteConfigurationSnapshotInfoProperties struct { + // Time - READ-ONLY; The time the snapshot was taken. + Time *date.Time `json:"time,omitempty"` + // SnapshotID - READ-ONLY; The id of the snapshot + SnapshotID *int32 `json:"snapshotId,omitempty"` +} + +// MarshalJSON is the custom marshaler for SiteConfigurationSnapshotInfoProperties. +func (scsi SiteConfigurationSnapshotInfoProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SiteExtensionInfo site Extension Information. +type SiteExtensionInfo struct { + autorest.Response `json:"-"` + // SiteExtensionInfoProperties - SiteExtensionInfo resource specific properties + *SiteExtensionInfoProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SiteExtensionInfo. +func (sei SiteExtensionInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sei.SiteExtensionInfoProperties != nil { + objectMap["properties"] = sei.SiteExtensionInfoProperties + } + if sei.Kind != nil { + objectMap["kind"] = sei.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SiteExtensionInfo struct. +func (sei *SiteExtensionInfo) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var siteExtensionInfoProperties SiteExtensionInfoProperties + err = json.Unmarshal(*v, &siteExtensionInfoProperties) + if err != nil { + return err + } + sei.SiteExtensionInfoProperties = &siteExtensionInfoProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sei.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sei.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sei.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sei.Type = &typeVar + } + } + } + + return nil +} + +// SiteExtensionInfoCollection collection of Kudu site extension information elements. +type SiteExtensionInfoCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]SiteExtensionInfo `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SiteExtensionInfoCollection. +func (seic SiteExtensionInfoCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if seic.Value != nil { + objectMap["value"] = seic.Value + } + return json.Marshal(objectMap) +} + +// SiteExtensionInfoCollectionIterator provides access to a complete listing of SiteExtensionInfo values. +type SiteExtensionInfoCollectionIterator struct { + i int + page SiteExtensionInfoCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SiteExtensionInfoCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SiteExtensionInfoCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SiteExtensionInfoCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SiteExtensionInfoCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SiteExtensionInfoCollectionIterator) Response() SiteExtensionInfoCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SiteExtensionInfoCollectionIterator) Value() SiteExtensionInfo { + if !iter.page.NotDone() { + return SiteExtensionInfo{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SiteExtensionInfoCollectionIterator type. +func NewSiteExtensionInfoCollectionIterator(page SiteExtensionInfoCollectionPage) SiteExtensionInfoCollectionIterator { + return SiteExtensionInfoCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (seic SiteExtensionInfoCollection) IsEmpty() bool { + return seic.Value == nil || len(*seic.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (seic SiteExtensionInfoCollection) hasNextLink() bool { + return seic.NextLink != nil && len(*seic.NextLink) != 0 +} + +// siteExtensionInfoCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (seic SiteExtensionInfoCollection) siteExtensionInfoCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !seic.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(seic.NextLink))) +} + +// SiteExtensionInfoCollectionPage contains a page of SiteExtensionInfo values. +type SiteExtensionInfoCollectionPage struct { + fn func(context.Context, SiteExtensionInfoCollection) (SiteExtensionInfoCollection, error) + seic SiteExtensionInfoCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SiteExtensionInfoCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SiteExtensionInfoCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.seic) + if err != nil { + return err + } + page.seic = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SiteExtensionInfoCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SiteExtensionInfoCollectionPage) NotDone() bool { + return !page.seic.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SiteExtensionInfoCollectionPage) Response() SiteExtensionInfoCollection { + return page.seic +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SiteExtensionInfoCollectionPage) Values() []SiteExtensionInfo { + if page.seic.IsEmpty() { + return nil + } + return *page.seic.Value +} + +// Creates a new instance of the SiteExtensionInfoCollectionPage type. +func NewSiteExtensionInfoCollectionPage(cur SiteExtensionInfoCollection, getNextPage func(context.Context, SiteExtensionInfoCollection) (SiteExtensionInfoCollection, error)) SiteExtensionInfoCollectionPage { + return SiteExtensionInfoCollectionPage{ + fn: getNextPage, + seic: cur, + } +} + +// SiteExtensionInfoProperties siteExtensionInfo resource specific properties +type SiteExtensionInfoProperties struct { + // ExtensionID - Site extension ID. + ExtensionID *string `json:"extension_id,omitempty"` + Title *string `json:"title,omitempty"` + // ExtensionType - Site extension type. Possible values include: 'SiteExtensionTypeGallery', 'SiteExtensionTypeWebRoot' + ExtensionType SiteExtensionType `json:"extension_type,omitempty"` + // Summary - Summary description. + Summary *string `json:"summary,omitempty"` + // Description - Detailed description. + Description *string `json:"description,omitempty"` + // Version - Version information. + Version *string `json:"version,omitempty"` + // ExtensionURL - Extension URL. + ExtensionURL *string `json:"extension_url,omitempty"` + // ProjectURL - Project URL. + ProjectURL *string `json:"project_url,omitempty"` + // IconURL - Icon URL. + IconURL *string `json:"icon_url,omitempty"` + // LicenseURL - License URL. + LicenseURL *string `json:"license_url,omitempty"` + // FeedURL - Feed URL. + FeedURL *string `json:"feed_url,omitempty"` + // Authors - List of authors. + Authors *[]string `json:"authors,omitempty"` + // InstallerCommandLineParams - Installer command line parameters. + InstallerCommandLineParams *string `json:"installer_command_line_params,omitempty"` + // PublishedDateTime - Published timestamp. + PublishedDateTime *date.Time `json:"published_date_time,omitempty"` + // DownloadCount - Count of downloads. + DownloadCount *int32 `json:"download_count,omitempty"` + // LocalIsLatestVersion - true if the local version is the latest version; false otherwise. + LocalIsLatestVersion *bool `json:"local_is_latest_version,omitempty"` + // LocalPath - Local path. + LocalPath *string `json:"local_path,omitempty"` + // InstalledDateTime - Installed timestamp. + InstalledDateTime *date.Time `json:"installed_date_time,omitempty"` + // ProvisioningState - Provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // Comment - Site Extension comment. + Comment *string `json:"comment,omitempty"` +} + +// SiteInstanceStatus ... +type SiteInstanceStatus struct { + autorest.Response `json:"-"` + // SiteInstanceStatusProperties - WebSiteInstanceStatus resource specific properties + *SiteInstanceStatusProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SiteInstanceStatus. +func (sis SiteInstanceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sis.SiteInstanceStatusProperties != nil { + objectMap["properties"] = sis.SiteInstanceStatusProperties + } + if sis.Kind != nil { + objectMap["kind"] = sis.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SiteInstanceStatus struct. +func (sis *SiteInstanceStatus) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var siteInstanceStatusProperties SiteInstanceStatusProperties + err = json.Unmarshal(*v, &siteInstanceStatusProperties) + if err != nil { + return err + } + sis.SiteInstanceStatusProperties = &siteInstanceStatusProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sis.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sis.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sis.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sis.Type = &typeVar + } + } + } + + return nil +} + +// SiteInstanceStatusProperties webSiteInstanceStatus resource specific properties +type SiteInstanceStatusProperties struct { + // State - Possible values include: 'SiteRuntimeStateREADY', 'SiteRuntimeStateSTOPPED', 'SiteRuntimeStateUNKNOWN' + State SiteRuntimeState `json:"state,omitempty"` + // StatusURL - Link to the GetStatusApi in Kudu + StatusURL *string `json:"statusUrl,omitempty"` + // DetectorURL - Link to the Diagnose and Solve Portal + DetectorURL *string `json:"detectorUrl,omitempty"` + // ConsoleURL - Link to the console to web app instance + ConsoleURL *string `json:"consoleUrl,omitempty"` + // HealthCheckURL - Link to the console to web app instance + HealthCheckURL *string `json:"healthCheckUrl,omitempty"` + Containers map[string]*ContainerInfo `json:"containers"` +} + +// MarshalJSON is the custom marshaler for SiteInstanceStatusProperties. +func (sis SiteInstanceStatusProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sis.State != "" { + objectMap["state"] = sis.State + } + if sis.StatusURL != nil { + objectMap["statusUrl"] = sis.StatusURL + } + if sis.DetectorURL != nil { + objectMap["detectorUrl"] = sis.DetectorURL + } + if sis.ConsoleURL != nil { + objectMap["consoleUrl"] = sis.ConsoleURL + } + if sis.HealthCheckURL != nil { + objectMap["healthCheckUrl"] = sis.HealthCheckURL + } + if sis.Containers != nil { + objectMap["containers"] = sis.Containers + } + return json.Marshal(objectMap) +} + +// SiteLimits metric limits set on an app. +type SiteLimits struct { + // MaxPercentageCPU - Maximum allowed CPU usage percentage. + MaxPercentageCPU *float64 `json:"maxPercentageCpu,omitempty"` + // MaxMemoryInMb - Maximum allowed memory usage in MB. + MaxMemoryInMb *int64 `json:"maxMemoryInMb,omitempty"` + // MaxDiskSizeInMb - Maximum allowed disk size usage in MB. + MaxDiskSizeInMb *int64 `json:"maxDiskSizeInMb,omitempty"` +} + +// SiteLogsConfig configuration of App Service site logs. +type SiteLogsConfig struct { + autorest.Response `json:"-"` + // SiteLogsConfigProperties - SiteLogsConfig resource specific properties + *SiteLogsConfigProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SiteLogsConfig. +func (slc SiteLogsConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if slc.SiteLogsConfigProperties != nil { + objectMap["properties"] = slc.SiteLogsConfigProperties + } + if slc.Kind != nil { + objectMap["kind"] = slc.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SiteLogsConfig struct. +func (slc *SiteLogsConfig) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var siteLogsConfigProperties SiteLogsConfigProperties + err = json.Unmarshal(*v, &siteLogsConfigProperties) + if err != nil { + return err + } + slc.SiteLogsConfigProperties = &siteLogsConfigProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + slc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + slc.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + slc.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + slc.Type = &typeVar + } + } + } + + return nil +} + +// SiteLogsConfigProperties siteLogsConfig resource specific properties +type SiteLogsConfigProperties struct { + // ApplicationLogs - Application logs configuration. + ApplicationLogs *ApplicationLogsConfig `json:"applicationLogs,omitempty"` + // HTTPLogs - HTTP logs configuration. + HTTPLogs *HTTPLogsConfig `json:"httpLogs,omitempty"` + // FailedRequestsTracing - Failed requests tracing configuration. + FailedRequestsTracing *EnabledConfig `json:"failedRequestsTracing,omitempty"` + // DetailedErrorMessages - Detailed error messages configuration. + DetailedErrorMessages *EnabledConfig `json:"detailedErrorMessages,omitempty"` +} + +// SiteMachineKey machineKey of an app. +type SiteMachineKey struct { + // Validation - MachineKey validation. + Validation *string `json:"validation,omitempty"` + // ValidationKey - Validation key. + ValidationKey *string `json:"validationKey,omitempty"` + // Decryption - Algorithm used for decryption. + Decryption *string `json:"decryption,omitempty"` + // DecryptionKey - Decryption key. + DecryptionKey *string `json:"decryptionKey,omitempty"` +} + +// SitePatchResource ARM resource for a site. +type SitePatchResource struct { + // SitePatchResourceProperties - SitePatchResource resource specific properties + *SitePatchResourceProperties `json:"properties,omitempty"` + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SitePatchResource. +func (spr SitePatchResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spr.SitePatchResourceProperties != nil { + objectMap["properties"] = spr.SitePatchResourceProperties + } + if spr.Identity != nil { + objectMap["identity"] = spr.Identity + } + if spr.Kind != nil { + objectMap["kind"] = spr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SitePatchResource struct. +func (spr *SitePatchResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var sitePatchResourceProperties SitePatchResourceProperties + err = json.Unmarshal(*v, &sitePatchResourceProperties) + if err != nil { + return err + } + spr.SitePatchResourceProperties = &sitePatchResourceProperties + } + case "identity": + if v != nil { + var identity ManagedServiceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + spr.Identity = &identity + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + spr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + spr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + spr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + spr.Type = &typeVar + } + } + } + + return nil +} + +// SitePatchResourceProperties sitePatchResource resource specific properties +type SitePatchResourceProperties struct { + // State - READ-ONLY; Current state of the app. + State *string `json:"state,omitempty"` + // HostNames - READ-ONLY; Hostnames associated with the app. + HostNames *[]string `json:"hostNames,omitempty"` + // RepositorySiteName - READ-ONLY; Name of the repository site. + RepositorySiteName *string `json:"repositorySiteName,omitempty"` + // UsageState - READ-ONLY; State indicating whether the app has exceeded its quota usage. Read-only. Possible values include: 'UsageStateNormal', 'UsageStateExceeded' + UsageState UsageState `json:"usageState,omitempty"` + // Enabled - true if the app is enabled; otherwise, false. Setting this value to false disables the app (takes the app offline). + Enabled *bool `json:"enabled,omitempty"` + // EnabledHostNames - READ-ONLY; Enabled hostnames for the app.Hostnames need to be assigned (see HostNames) AND enabled. Otherwise, + // the app is not served on those hostnames. + EnabledHostNames *[]string `json:"enabledHostNames,omitempty"` + // AvailabilityState - READ-ONLY; Management information availability state for the app. Possible values include: 'SiteAvailabilityStateNormal', 'SiteAvailabilityStateLimited', 'SiteAvailabilityStateDisasterRecoveryMode' + AvailabilityState SiteAvailabilityState `json:"availabilityState,omitempty"` + // HostNameSslStates - Hostname SSL states are used to manage the SSL bindings for app's hostnames. + HostNameSslStates *[]HostNameSslState `json:"hostNameSslStates,omitempty"` + // ServerFarmID - Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". + ServerFarmID *string `json:"serverFarmId,omitempty"` + // Reserved - true if reserved; otherwise, false. + Reserved *bool `json:"reserved,omitempty"` + // IsXenon - Obsolete: Hyper-V sandbox. + IsXenon *bool `json:"isXenon,omitempty"` + // HyperV - Hyper-V sandbox. + HyperV *bool `json:"hyperV,omitempty"` + // LastModifiedTimeUtc - READ-ONLY; Last time the app was modified, in UTC. Read-only. + LastModifiedTimeUtc *date.Time `json:"lastModifiedTimeUtc,omitempty"` + // SiteConfig - Configuration of the app. + SiteConfig *SiteConfig `json:"siteConfig,omitempty"` + // TrafficManagerHostNames - READ-ONLY; Azure Traffic Manager hostnames associated with the app. Read-only. + TrafficManagerHostNames *[]string `json:"trafficManagerHostNames,omitempty"` + // ScmSiteAlsoStopped - true to stop SCM (KUDU) site when the app is stopped; otherwise, false. The default is false. + ScmSiteAlsoStopped *bool `json:"scmSiteAlsoStopped,omitempty"` + // TargetSwapSlot - READ-ONLY; Specifies which deployment slot this app will swap into. Read-only. + TargetSwapSlot *string `json:"targetSwapSlot,omitempty"` + // HostingEnvironmentProfile - App Service Environment to use for the app. + HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` + // ClientAffinityEnabled - true to enable client affinity; false to stop sending session affinity cookies, which route client requests in the same session to the same instance. Default is true. + ClientAffinityEnabled *bool `json:"clientAffinityEnabled,omitempty"` + // ClientCertEnabled - true to enable client certificate authentication (TLS mutual authentication); otherwise, false. Default is false. + ClientCertEnabled *bool `json:"clientCertEnabled,omitempty"` + // ClientCertMode - This composes with ClientCertEnabled setting. + // - ClientCertEnabled: false means ClientCert is ignored. + // - ClientCertEnabled: true and ClientCertMode: Required means ClientCert is required. + // - ClientCertEnabled: true and ClientCertMode: Optional means ClientCert is optional or accepted. Possible values include: 'ClientCertModeRequired', 'ClientCertModeOptional', 'ClientCertModeOptionalInteractiveUser' + ClientCertMode ClientCertMode `json:"clientCertMode,omitempty"` + // ClientCertExclusionPaths - client certificate authentication comma-separated exclusion paths + ClientCertExclusionPaths *string `json:"clientCertExclusionPaths,omitempty"` + // HostNamesDisabled - true to disable the public hostnames of the app; otherwise, false. + // If true, the app is only accessible via API management process. + HostNamesDisabled *bool `json:"hostNamesDisabled,omitempty"` + // CustomDomainVerificationID - Unique identifier that verifies the custom domains assigned to the app. Customer will add this id to a txt record for verification. + CustomDomainVerificationID *string `json:"customDomainVerificationId,omitempty"` + // OutboundIPAddresses - READ-ONLY; List of IP addresses that the app uses for outbound connections (e.g. database access). Includes VIPs from tenants that site can be hosted with current settings. Read-only. + OutboundIPAddresses *string `json:"outboundIpAddresses,omitempty"` + // PossibleOutboundIPAddresses - READ-ONLY; List of IP addresses that the app uses for outbound connections (e.g. database access). Includes VIPs from all tenants except dataComponent. Read-only. + PossibleOutboundIPAddresses *string `json:"possibleOutboundIpAddresses,omitempty"` + // ContainerSize - Size of the function container. + ContainerSize *int32 `json:"containerSize,omitempty"` + // DailyMemoryTimeQuota - Maximum allowed daily memory-time quota (applicable on dynamic apps only). + DailyMemoryTimeQuota *int32 `json:"dailyMemoryTimeQuota,omitempty"` + // SuspendedTill - READ-ONLY; App suspended till in case memory-time quota is exceeded. + SuspendedTill *date.Time `json:"suspendedTill,omitempty"` + // MaxNumberOfWorkers - READ-ONLY; Maximum number of workers. + // This only applies to Functions container. + MaxNumberOfWorkers *int32 `json:"maxNumberOfWorkers,omitempty"` + // CloningInfo - If specified during app creation, the app is cloned from a source app. + CloningInfo *CloningInfo `json:"cloningInfo,omitempty"` + // ResourceGroup - READ-ONLY; Name of the resource group the app belongs to. Read-only. + ResourceGroup *string `json:"resourceGroup,omitempty"` + // IsDefaultContainer - READ-ONLY; true if the app is a default container; otherwise, false. + IsDefaultContainer *bool `json:"isDefaultContainer,omitempty"` + // DefaultHostName - READ-ONLY; Default hostname of the app. Read-only. + DefaultHostName *string `json:"defaultHostName,omitempty"` + // SlotSwapStatus - READ-ONLY; Status of the last deployment slot swap operation. + SlotSwapStatus *SlotSwapStatus `json:"slotSwapStatus,omitempty"` + // HTTPSOnly - HttpsOnly: configures a web site to accept only https requests. Issues redirect for + // http requests + HTTPSOnly *bool `json:"httpsOnly,omitempty"` + // RedundancyMode - Site redundancy mode. Possible values include: 'RedundancyModeNone', 'RedundancyModeManual', 'RedundancyModeFailover', 'RedundancyModeActiveActive', 'RedundancyModeGeoRedundant' + RedundancyMode RedundancyMode `json:"redundancyMode,omitempty"` + // InProgressOperationID - READ-ONLY; Specifies an operation id if this site has a pending operation. + InProgressOperationID *uuid.UUID `json:"inProgressOperationId,omitempty"` + // StorageAccountRequired - Checks if Customer provided storage account is required + StorageAccountRequired *bool `json:"storageAccountRequired,omitempty"` + // KeyVaultReferenceIdentity - Identity to use for Key Vault Reference authentication. + KeyVaultReferenceIdentity *string `json:"keyVaultReferenceIdentity,omitempty"` + // VirtualNetworkSubnetID - Azure Resource Manager ID of the Virtual network and subnet to be joined by Regional VNET Integration. + // This must be of the form /subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName} + VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"` +} + +// MarshalJSON is the custom marshaler for SitePatchResourceProperties. +func (spr SitePatchResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spr.Enabled != nil { + objectMap["enabled"] = spr.Enabled + } + if spr.HostNameSslStates != nil { + objectMap["hostNameSslStates"] = spr.HostNameSslStates + } + if spr.ServerFarmID != nil { + objectMap["serverFarmId"] = spr.ServerFarmID + } + if spr.Reserved != nil { + objectMap["reserved"] = spr.Reserved + } + if spr.IsXenon != nil { + objectMap["isXenon"] = spr.IsXenon + } + if spr.HyperV != nil { + objectMap["hyperV"] = spr.HyperV + } + if spr.SiteConfig != nil { + objectMap["siteConfig"] = spr.SiteConfig + } + if spr.ScmSiteAlsoStopped != nil { + objectMap["scmSiteAlsoStopped"] = spr.ScmSiteAlsoStopped + } + if spr.HostingEnvironmentProfile != nil { + objectMap["hostingEnvironmentProfile"] = spr.HostingEnvironmentProfile + } + if spr.ClientAffinityEnabled != nil { + objectMap["clientAffinityEnabled"] = spr.ClientAffinityEnabled + } + if spr.ClientCertEnabled != nil { + objectMap["clientCertEnabled"] = spr.ClientCertEnabled + } + if spr.ClientCertMode != "" { + objectMap["clientCertMode"] = spr.ClientCertMode + } + if spr.ClientCertExclusionPaths != nil { + objectMap["clientCertExclusionPaths"] = spr.ClientCertExclusionPaths + } + if spr.HostNamesDisabled != nil { + objectMap["hostNamesDisabled"] = spr.HostNamesDisabled + } + if spr.CustomDomainVerificationID != nil { + objectMap["customDomainVerificationId"] = spr.CustomDomainVerificationID + } + if spr.ContainerSize != nil { + objectMap["containerSize"] = spr.ContainerSize + } + if spr.DailyMemoryTimeQuota != nil { + objectMap["dailyMemoryTimeQuota"] = spr.DailyMemoryTimeQuota + } + if spr.CloningInfo != nil { + objectMap["cloningInfo"] = spr.CloningInfo + } + if spr.HTTPSOnly != nil { + objectMap["httpsOnly"] = spr.HTTPSOnly + } + if spr.RedundancyMode != "" { + objectMap["redundancyMode"] = spr.RedundancyMode + } + if spr.StorageAccountRequired != nil { + objectMap["storageAccountRequired"] = spr.StorageAccountRequired + } + if spr.KeyVaultReferenceIdentity != nil { + objectMap["keyVaultReferenceIdentity"] = spr.KeyVaultReferenceIdentity + } + if spr.VirtualNetworkSubnetID != nil { + objectMap["virtualNetworkSubnetId"] = spr.VirtualNetworkSubnetID + } + return json.Marshal(objectMap) +} + +// SitePhpErrorLogFlag used for getting PHP error logging flag. +type SitePhpErrorLogFlag struct { + autorest.Response `json:"-"` + // SitePhpErrorLogFlagProperties - SitePhpErrorLogFlag resource specific properties + *SitePhpErrorLogFlagProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SitePhpErrorLogFlag. +func (spelf SitePhpErrorLogFlag) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spelf.SitePhpErrorLogFlagProperties != nil { + objectMap["properties"] = spelf.SitePhpErrorLogFlagProperties + } + if spelf.Kind != nil { + objectMap["kind"] = spelf.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SitePhpErrorLogFlag struct. +func (spelf *SitePhpErrorLogFlag) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var sitePhpErrorLogFlagProperties SitePhpErrorLogFlagProperties + err = json.Unmarshal(*v, &sitePhpErrorLogFlagProperties) + if err != nil { + return err + } + spelf.SitePhpErrorLogFlagProperties = &sitePhpErrorLogFlagProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + spelf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + spelf.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + spelf.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + spelf.Type = &typeVar + } + } + } + + return nil +} + +// SitePhpErrorLogFlagProperties sitePhpErrorLogFlag resource specific properties +type SitePhpErrorLogFlagProperties struct { + // LocalLogErrors - Local log_errors setting. + LocalLogErrors *string `json:"localLogErrors,omitempty"` + // MasterLogErrors - Master log_errors setting. + MasterLogErrors *string `json:"masterLogErrors,omitempty"` + // LocalLogErrorsMaxLength - Local log_errors_max_len setting. + LocalLogErrorsMaxLength *string `json:"localLogErrorsMaxLength,omitempty"` + // MasterLogErrorsMaxLength - Master log_errors_max_len setting. + MasterLogErrorsMaxLength *string `json:"masterLogErrorsMaxLength,omitempty"` +} + +// SiteProperties site resource specific properties +type SiteProperties struct { + // State - READ-ONLY; Current state of the app. + State *string `json:"state,omitempty"` + // HostNames - READ-ONLY; Hostnames associated with the app. + HostNames *[]string `json:"hostNames,omitempty"` + // RepositorySiteName - READ-ONLY; Name of the repository site. + RepositorySiteName *string `json:"repositorySiteName,omitempty"` + // UsageState - READ-ONLY; State indicating whether the app has exceeded its quota usage. Read-only. Possible values include: 'UsageStateNormal', 'UsageStateExceeded' + UsageState UsageState `json:"usageState,omitempty"` + // Enabled - true if the app is enabled; otherwise, false. Setting this value to false disables the app (takes the app offline). + Enabled *bool `json:"enabled,omitempty"` + // EnabledHostNames - READ-ONLY; Enabled hostnames for the app.Hostnames need to be assigned (see HostNames) AND enabled. Otherwise, + // the app is not served on those hostnames. + EnabledHostNames *[]string `json:"enabledHostNames,omitempty"` + // AvailabilityState - READ-ONLY; Management information availability state for the app. Possible values include: 'SiteAvailabilityStateNormal', 'SiteAvailabilityStateLimited', 'SiteAvailabilityStateDisasterRecoveryMode' + AvailabilityState SiteAvailabilityState `json:"availabilityState,omitempty"` + // HostNameSslStates - Hostname SSL states are used to manage the SSL bindings for app's hostnames. + HostNameSslStates *[]HostNameSslState `json:"hostNameSslStates,omitempty"` + // ServerFarmID - Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". + ServerFarmID *string `json:"serverFarmId,omitempty"` + // Reserved - true if reserved; otherwise, false. + Reserved *bool `json:"reserved,omitempty"` + // IsXenon - Obsolete: Hyper-V sandbox. + IsXenon *bool `json:"isXenon,omitempty"` + // HyperV - Hyper-V sandbox. + HyperV *bool `json:"hyperV,omitempty"` + // LastModifiedTimeUtc - READ-ONLY; Last time the app was modified, in UTC. Read-only. + LastModifiedTimeUtc *date.Time `json:"lastModifiedTimeUtc,omitempty"` + // SiteConfig - Configuration of the app. + SiteConfig *SiteConfig `json:"siteConfig,omitempty"` + // TrafficManagerHostNames - READ-ONLY; Azure Traffic Manager hostnames associated with the app. Read-only. + TrafficManagerHostNames *[]string `json:"trafficManagerHostNames,omitempty"` + // ScmSiteAlsoStopped - true to stop SCM (KUDU) site when the app is stopped; otherwise, false. The default is false. + ScmSiteAlsoStopped *bool `json:"scmSiteAlsoStopped,omitempty"` + // TargetSwapSlot - READ-ONLY; Specifies which deployment slot this app will swap into. Read-only. + TargetSwapSlot *string `json:"targetSwapSlot,omitempty"` + // HostingEnvironmentProfile - App Service Environment to use for the app. + HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` + // ClientAffinityEnabled - true to enable client affinity; false to stop sending session affinity cookies, which route client requests in the same session to the same instance. Default is true. + ClientAffinityEnabled *bool `json:"clientAffinityEnabled,omitempty"` + // ClientCertEnabled - true to enable client certificate authentication (TLS mutual authentication); otherwise, false. Default is false. + ClientCertEnabled *bool `json:"clientCertEnabled,omitempty"` + // ClientCertMode - This composes with ClientCertEnabled setting. + // - ClientCertEnabled: false means ClientCert is ignored. + // - ClientCertEnabled: true and ClientCertMode: Required means ClientCert is required. + // - ClientCertEnabled: true and ClientCertMode: Optional means ClientCert is optional or accepted. Possible values include: 'ClientCertModeRequired', 'ClientCertModeOptional', 'ClientCertModeOptionalInteractiveUser' + ClientCertMode ClientCertMode `json:"clientCertMode,omitempty"` + // ClientCertExclusionPaths - client certificate authentication comma-separated exclusion paths + ClientCertExclusionPaths *string `json:"clientCertExclusionPaths,omitempty"` + // HostNamesDisabled - true to disable the public hostnames of the app; otherwise, false. + // If true, the app is only accessible via API management process. + HostNamesDisabled *bool `json:"hostNamesDisabled,omitempty"` + // CustomDomainVerificationID - Unique identifier that verifies the custom domains assigned to the app. Customer will add this id to a txt record for verification. + CustomDomainVerificationID *string `json:"customDomainVerificationId,omitempty"` + // OutboundIPAddresses - READ-ONLY; List of IP addresses that the app uses for outbound connections (e.g. database access). Includes VIPs from tenants that site can be hosted with current settings. Read-only. + OutboundIPAddresses *string `json:"outboundIpAddresses,omitempty"` + // PossibleOutboundIPAddresses - READ-ONLY; List of IP addresses that the app uses for outbound connections (e.g. database access). Includes VIPs from all tenants except dataComponent. Read-only. + PossibleOutboundIPAddresses *string `json:"possibleOutboundIpAddresses,omitempty"` + // ContainerSize - Size of the function container. + ContainerSize *int32 `json:"containerSize,omitempty"` + // DailyMemoryTimeQuota - Maximum allowed daily memory-time quota (applicable on dynamic apps only). + DailyMemoryTimeQuota *int32 `json:"dailyMemoryTimeQuota,omitempty"` + // SuspendedTill - READ-ONLY; App suspended till in case memory-time quota is exceeded. + SuspendedTill *date.Time `json:"suspendedTill,omitempty"` + // MaxNumberOfWorkers - READ-ONLY; Maximum number of workers. + // This only applies to Functions container. + MaxNumberOfWorkers *int32 `json:"maxNumberOfWorkers,omitempty"` + // CloningInfo - If specified during app creation, the app is cloned from a source app. + CloningInfo *CloningInfo `json:"cloningInfo,omitempty"` + // ResourceGroup - READ-ONLY; Name of the resource group the app belongs to. Read-only. + ResourceGroup *string `json:"resourceGroup,omitempty"` + // IsDefaultContainer - READ-ONLY; true if the app is a default container; otherwise, false. + IsDefaultContainer *bool `json:"isDefaultContainer,omitempty"` + // DefaultHostName - READ-ONLY; Default hostname of the app. Read-only. + DefaultHostName *string `json:"defaultHostName,omitempty"` + // SlotSwapStatus - READ-ONLY; Status of the last deployment slot swap operation. + SlotSwapStatus *SlotSwapStatus `json:"slotSwapStatus,omitempty"` + // HTTPSOnly - HttpsOnly: configures a web site to accept only https requests. Issues redirect for + // http requests + HTTPSOnly *bool `json:"httpsOnly,omitempty"` + // RedundancyMode - Site redundancy mode. Possible values include: 'RedundancyModeNone', 'RedundancyModeManual', 'RedundancyModeFailover', 'RedundancyModeActiveActive', 'RedundancyModeGeoRedundant' + RedundancyMode RedundancyMode `json:"redundancyMode,omitempty"` + // InProgressOperationID - READ-ONLY; Specifies an operation id if this site has a pending operation. + InProgressOperationID *uuid.UUID `json:"inProgressOperationId,omitempty"` + // StorageAccountRequired - Checks if Customer provided storage account is required + StorageAccountRequired *bool `json:"storageAccountRequired,omitempty"` + // KeyVaultReferenceIdentity - Identity to use for Key Vault Reference authentication. + KeyVaultReferenceIdentity *string `json:"keyVaultReferenceIdentity,omitempty"` + // VirtualNetworkSubnetID - Azure Resource Manager ID of the Virtual network and subnet to be joined by Regional VNET Integration. + // This must be of the form /subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName} + VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"` +} + +// MarshalJSON is the custom marshaler for SiteProperties. +func (s SiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.Enabled != nil { + objectMap["enabled"] = s.Enabled + } + if s.HostNameSslStates != nil { + objectMap["hostNameSslStates"] = s.HostNameSslStates + } + if s.ServerFarmID != nil { + objectMap["serverFarmId"] = s.ServerFarmID + } + if s.Reserved != nil { + objectMap["reserved"] = s.Reserved + } + if s.IsXenon != nil { + objectMap["isXenon"] = s.IsXenon + } + if s.HyperV != nil { + objectMap["hyperV"] = s.HyperV + } + if s.SiteConfig != nil { + objectMap["siteConfig"] = s.SiteConfig + } + if s.ScmSiteAlsoStopped != nil { + objectMap["scmSiteAlsoStopped"] = s.ScmSiteAlsoStopped + } + if s.HostingEnvironmentProfile != nil { + objectMap["hostingEnvironmentProfile"] = s.HostingEnvironmentProfile + } + if s.ClientAffinityEnabled != nil { + objectMap["clientAffinityEnabled"] = s.ClientAffinityEnabled + } + if s.ClientCertEnabled != nil { + objectMap["clientCertEnabled"] = s.ClientCertEnabled + } + if s.ClientCertMode != "" { + objectMap["clientCertMode"] = s.ClientCertMode + } + if s.ClientCertExclusionPaths != nil { + objectMap["clientCertExclusionPaths"] = s.ClientCertExclusionPaths + } + if s.HostNamesDisabled != nil { + objectMap["hostNamesDisabled"] = s.HostNamesDisabled + } + if s.CustomDomainVerificationID != nil { + objectMap["customDomainVerificationId"] = s.CustomDomainVerificationID + } + if s.ContainerSize != nil { + objectMap["containerSize"] = s.ContainerSize + } + if s.DailyMemoryTimeQuota != nil { + objectMap["dailyMemoryTimeQuota"] = s.DailyMemoryTimeQuota + } + if s.CloningInfo != nil { + objectMap["cloningInfo"] = s.CloningInfo + } + if s.HTTPSOnly != nil { + objectMap["httpsOnly"] = s.HTTPSOnly + } + if s.RedundancyMode != "" { + objectMap["redundancyMode"] = s.RedundancyMode + } + if s.StorageAccountRequired != nil { + objectMap["storageAccountRequired"] = s.StorageAccountRequired + } + if s.KeyVaultReferenceIdentity != nil { + objectMap["keyVaultReferenceIdentity"] = s.KeyVaultReferenceIdentity + } + if s.VirtualNetworkSubnetID != nil { + objectMap["virtualNetworkSubnetId"] = s.VirtualNetworkSubnetID + } + return json.Marshal(objectMap) +} + +// SiteSeal site seal +type SiteSeal struct { + autorest.Response `json:"-"` + // HTML - HTML snippet + HTML *string `json:"html,omitempty"` +} + +// SiteSealRequest site seal request. +type SiteSealRequest struct { + // LightTheme - If true use the light color theme for site seal; otherwise, use the default color theme. + LightTheme *bool `json:"lightTheme,omitempty"` + // Locale - Locale of site seal. + Locale *string `json:"locale,omitempty"` +} + +// SiteSourceControl source control configuration for an app. +type SiteSourceControl struct { + autorest.Response `json:"-"` + // SiteSourceControlProperties - SiteSourceControl resource specific properties + *SiteSourceControlProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SiteSourceControl. +func (ssc SiteSourceControl) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssc.SiteSourceControlProperties != nil { + objectMap["properties"] = ssc.SiteSourceControlProperties + } + if ssc.Kind != nil { + objectMap["kind"] = ssc.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SiteSourceControl struct. +func (ssc *SiteSourceControl) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var siteSourceControlProperties SiteSourceControlProperties + err = json.Unmarshal(*v, &siteSourceControlProperties) + if err != nil { + return err + } + ssc.SiteSourceControlProperties = &siteSourceControlProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ssc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ssc.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ssc.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ssc.Type = &typeVar + } + } + } + + return nil +} + +// SiteSourceControlProperties siteSourceControl resource specific properties +type SiteSourceControlProperties struct { + // RepoURL - Repository or source control URL. + RepoURL *string `json:"repoUrl,omitempty"` + // Branch - Name of branch to use for deployment. + Branch *string `json:"branch,omitempty"` + // IsManualIntegration - true to limit to manual integration; false to enable continuous integration (which configures webhooks into online repos like GitHub). + IsManualIntegration *bool `json:"isManualIntegration,omitempty"` + // IsGitHubAction - true if this is deployed via GitHub action. + IsGitHubAction *bool `json:"isGitHubAction,omitempty"` + // DeploymentRollbackEnabled - true to enable deployment rollback; otherwise, false. + DeploymentRollbackEnabled *bool `json:"deploymentRollbackEnabled,omitempty"` + // IsMercurial - true for a Mercurial repository; false for a Git repository. + IsMercurial *bool `json:"isMercurial,omitempty"` + // GitHubActionConfiguration - If GitHub Action is selected, than the associated configuration. + GitHubActionConfiguration *GitHubActionConfiguration `json:"gitHubActionConfiguration,omitempty"` +} + +// SkuCapacity description of the App Service plan scale options. +type SkuCapacity struct { + // Minimum - Minimum number of workers for this App Service plan SKU. + Minimum *int32 `json:"minimum,omitempty"` + // Maximum - Maximum number of workers for this App Service plan SKU. + Maximum *int32 `json:"maximum,omitempty"` + // ElasticMaximum - Maximum number of Elastic workers for this App Service plan SKU. + ElasticMaximum *int32 `json:"elasticMaximum,omitempty"` + // Default - Default number of workers for this App Service plan SKU. + Default *int32 `json:"default,omitempty"` + // ScaleType - Available scale configurations for an App Service plan. + ScaleType *string `json:"scaleType,omitempty"` +} + +// SkuDescription description of a SKU for a scalable resource. +type SkuDescription struct { + // Name - Name of the resource SKU. + Name *string `json:"name,omitempty"` + // Tier - Service tier of the resource SKU. + Tier *string `json:"tier,omitempty"` + // Size - Size specifier of the resource SKU. + Size *string `json:"size,omitempty"` + // Family - Family code of the resource SKU. + Family *string `json:"family,omitempty"` + // Capacity - Current number of instances assigned to the resource. + Capacity *int32 `json:"capacity,omitempty"` + // SkuCapacity - Min, max, and default scale values of the SKU. + SkuCapacity *SkuCapacity `json:"skuCapacity,omitempty"` + // Locations - Locations of the SKU. + Locations *[]string `json:"locations,omitempty"` + // Capabilities - Capabilities of the SKU, e.g., is traffic manager enabled? + Capabilities *[]Capability `json:"capabilities,omitempty"` +} + +// SkuInfo SKU discovery information. +type SkuInfo struct { + // ResourceType - Resource type that this SKU applies to. + ResourceType *string `json:"resourceType,omitempty"` + // Sku - Name and tier of the SKU. + Sku *SkuDescription `json:"sku,omitempty"` + // Capacity - Min, max, and default scale values of the SKU. + Capacity *SkuCapacity `json:"capacity,omitempty"` +} + +// SkuInfoCollection collection of SKU information. +type SkuInfoCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]SkuInfo `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SkuInfoCollection. +func (sic SkuInfoCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sic.Value != nil { + objectMap["value"] = sic.Value + } + return json.Marshal(objectMap) +} + +// SkuInfoCollectionIterator provides access to a complete listing of SkuInfo values. +type SkuInfoCollectionIterator struct { + i int + page SkuInfoCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SkuInfoCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkuInfoCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SkuInfoCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SkuInfoCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SkuInfoCollectionIterator) Response() SkuInfoCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SkuInfoCollectionIterator) Value() SkuInfo { + if !iter.page.NotDone() { + return SkuInfo{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SkuInfoCollectionIterator type. +func NewSkuInfoCollectionIterator(page SkuInfoCollectionPage) SkuInfoCollectionIterator { + return SkuInfoCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sic SkuInfoCollection) IsEmpty() bool { + return sic.Value == nil || len(*sic.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sic SkuInfoCollection) hasNextLink() bool { + return sic.NextLink != nil && len(*sic.NextLink) != 0 +} + +// skuInfoCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sic SkuInfoCollection) skuInfoCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !sic.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sic.NextLink))) +} + +// SkuInfoCollectionPage contains a page of SkuInfo values. +type SkuInfoCollectionPage struct { + fn func(context.Context, SkuInfoCollection) (SkuInfoCollection, error) + sic SkuInfoCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SkuInfoCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkuInfoCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sic) + if err != nil { + return err + } + page.sic = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SkuInfoCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SkuInfoCollectionPage) NotDone() bool { + return !page.sic.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SkuInfoCollectionPage) Response() SkuInfoCollection { + return page.sic +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SkuInfoCollectionPage) Values() []SkuInfo { + if page.sic.IsEmpty() { + return nil + } + return *page.sic.Value +} + +// Creates a new instance of the SkuInfoCollectionPage type. +func NewSkuInfoCollectionPage(cur SkuInfoCollection, getNextPage func(context.Context, SkuInfoCollection) (SkuInfoCollection, error)) SkuInfoCollectionPage { + return SkuInfoCollectionPage{ + fn: getNextPage, + sic: cur, + } +} + +// SkuInfos collection of SKU information. +type SkuInfos struct { + autorest.Response `json:"-"` + // ResourceType - Resource type that this SKU applies to. + ResourceType *string `json:"resourceType,omitempty"` + // Skus - List of SKUs the subscription is able to use. + Skus *[]GlobalCsmSkuDescription `json:"skus,omitempty"` +} + +// SlotConfigNames names for connection strings, application settings, and external Azure storage account +// configuration +// identifiers to be marked as sticky to the deployment slot and not moved during a swap operation. +// This is valid for all deployment slots in an app. +type SlotConfigNames struct { + // ConnectionStringNames - List of connection string names. + ConnectionStringNames *[]string `json:"connectionStringNames,omitempty"` + // AppSettingNames - List of application settings names. + AppSettingNames *[]string `json:"appSettingNames,omitempty"` + // AzureStorageConfigNames - List of external Azure storage account identifiers. + AzureStorageConfigNames *[]string `json:"azureStorageConfigNames,omitempty"` +} + +// SlotConfigNamesResource slot Config names azure resource. +type SlotConfigNamesResource struct { + autorest.Response `json:"-"` + // SlotConfigNames - Core resource properties + *SlotConfigNames `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SlotConfigNamesResource. +func (scnr SlotConfigNamesResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scnr.SlotConfigNames != nil { + objectMap["properties"] = scnr.SlotConfigNames + } + if scnr.Kind != nil { + objectMap["kind"] = scnr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SlotConfigNamesResource struct. +func (scnr *SlotConfigNamesResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var slotConfigNames SlotConfigNames + err = json.Unmarshal(*v, &slotConfigNames) + if err != nil { + return err + } + scnr.SlotConfigNames = &slotConfigNames + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + scnr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + scnr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + scnr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + scnr.Type = &typeVar + } + } + } + + return nil +} + +// SlotDifference a setting difference between two deployment slots of an app. +type SlotDifference struct { + // SlotDifferenceProperties - SlotDifference resource specific properties + *SlotDifferenceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SlotDifference. +func (sd SlotDifference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sd.SlotDifferenceProperties != nil { + objectMap["properties"] = sd.SlotDifferenceProperties + } + if sd.Kind != nil { + objectMap["kind"] = sd.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SlotDifference struct. +func (sd *SlotDifference) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var slotDifferenceProperties SlotDifferenceProperties + err = json.Unmarshal(*v, &slotDifferenceProperties) + if err != nil { + return err + } + sd.SlotDifferenceProperties = &slotDifferenceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sd.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sd.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sd.Type = &typeVar + } + } + } + + return nil +} + +// SlotDifferenceCollection collection of slot differences. +type SlotDifferenceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]SlotDifference `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SlotDifferenceCollection. +func (sdc SlotDifferenceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sdc.Value != nil { + objectMap["value"] = sdc.Value + } + return json.Marshal(objectMap) +} + +// SlotDifferenceCollectionIterator provides access to a complete listing of SlotDifference values. +type SlotDifferenceCollectionIterator struct { + i int + page SlotDifferenceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SlotDifferenceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SlotDifferenceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SlotDifferenceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SlotDifferenceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SlotDifferenceCollectionIterator) Response() SlotDifferenceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SlotDifferenceCollectionIterator) Value() SlotDifference { + if !iter.page.NotDone() { + return SlotDifference{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SlotDifferenceCollectionIterator type. +func NewSlotDifferenceCollectionIterator(page SlotDifferenceCollectionPage) SlotDifferenceCollectionIterator { + return SlotDifferenceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sdc SlotDifferenceCollection) IsEmpty() bool { + return sdc.Value == nil || len(*sdc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sdc SlotDifferenceCollection) hasNextLink() bool { + return sdc.NextLink != nil && len(*sdc.NextLink) != 0 +} + +// slotDifferenceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sdc SlotDifferenceCollection) slotDifferenceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !sdc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sdc.NextLink))) +} + +// SlotDifferenceCollectionPage contains a page of SlotDifference values. +type SlotDifferenceCollectionPage struct { + fn func(context.Context, SlotDifferenceCollection) (SlotDifferenceCollection, error) + sdc SlotDifferenceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SlotDifferenceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SlotDifferenceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sdc) + if err != nil { + return err + } + page.sdc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SlotDifferenceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SlotDifferenceCollectionPage) NotDone() bool { + return !page.sdc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SlotDifferenceCollectionPage) Response() SlotDifferenceCollection { + return page.sdc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SlotDifferenceCollectionPage) Values() []SlotDifference { + if page.sdc.IsEmpty() { + return nil + } + return *page.sdc.Value +} + +// Creates a new instance of the SlotDifferenceCollectionPage type. +func NewSlotDifferenceCollectionPage(cur SlotDifferenceCollection, getNextPage func(context.Context, SlotDifferenceCollection) (SlotDifferenceCollection, error)) SlotDifferenceCollectionPage { + return SlotDifferenceCollectionPage{ + fn: getNextPage, + sdc: cur, + } +} + +// SlotDifferenceProperties slotDifference resource specific properties +type SlotDifferenceProperties struct { + // Level - READ-ONLY; Level of the difference: Information, Warning or Error. + Level *string `json:"level,omitempty"` + // SettingType - READ-ONLY; The type of the setting: General, AppSetting or ConnectionString. + SettingType *string `json:"settingType,omitempty"` + // DiffRule - READ-ONLY; Rule that describes how to process the setting difference during a slot swap. + DiffRule *string `json:"diffRule,omitempty"` + // SettingName - READ-ONLY; Name of the setting. + SettingName *string `json:"settingName,omitempty"` + // ValueInCurrentSlot - READ-ONLY; Value of the setting in the current slot. + ValueInCurrentSlot *string `json:"valueInCurrentSlot,omitempty"` + // ValueInTargetSlot - READ-ONLY; Value of the setting in the target slot. + ValueInTargetSlot *string `json:"valueInTargetSlot,omitempty"` + // Description - READ-ONLY; Description of the setting difference. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for SlotDifferenceProperties. +func (sd SlotDifferenceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SlotSwapStatus the status of the last successful slot swap operation. +type SlotSwapStatus struct { + // TimestampUtc - READ-ONLY; The time the last successful slot swap completed. + TimestampUtc *date.Time `json:"timestampUtc,omitempty"` + // SourceSlotName - READ-ONLY; The source slot of the last swap operation. + SourceSlotName *string `json:"sourceSlotName,omitempty"` + // DestinationSlotName - READ-ONLY; The destination slot of the last swap operation. + DestinationSlotName *string `json:"destinationSlotName,omitempty"` +} + +// MarshalJSON is the custom marshaler for SlotSwapStatus. +func (sss SlotSwapStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SlowRequestsBasedTrigger trigger based on request execution time. +type SlowRequestsBasedTrigger struct { + // TimeTaken - Time taken. + TimeTaken *string `json:"timeTaken,omitempty"` + // Path - Request Path. + Path *string `json:"path,omitempty"` + // Count - Request Count. + Count *int32 `json:"count,omitempty"` + // TimeInterval - Time interval. + TimeInterval *string `json:"timeInterval,omitempty"` +} + +// Snapshot a snapshot of an app. +type Snapshot struct { + // SnapshotProperties - Snapshot resource specific properties + *SnapshotProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Snapshot. +func (s Snapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SnapshotProperties != nil { + objectMap["properties"] = s.SnapshotProperties + } + if s.Kind != nil { + objectMap["kind"] = s.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Snapshot struct. +func (s *Snapshot) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var snapshotProperties SnapshotProperties + err = json.Unmarshal(*v, &snapshotProperties) + if err != nil { + return err + } + s.SnapshotProperties = &snapshotProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + s.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + } + } + + return nil +} + +// SnapshotCollection collection of snapshots which can be used to revert an app to a previous time. +type SnapshotCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]Snapshot `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotCollection. +func (sc SnapshotCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sc.Value != nil { + objectMap["value"] = sc.Value + } + return json.Marshal(objectMap) +} + +// SnapshotCollectionIterator provides access to a complete listing of Snapshot values. +type SnapshotCollectionIterator struct { + i int + page SnapshotCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SnapshotCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SnapshotCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SnapshotCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SnapshotCollectionIterator) Response() SnapshotCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SnapshotCollectionIterator) Value() Snapshot { + if !iter.page.NotDone() { + return Snapshot{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SnapshotCollectionIterator type. +func NewSnapshotCollectionIterator(page SnapshotCollectionPage) SnapshotCollectionIterator { + return SnapshotCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sc SnapshotCollection) IsEmpty() bool { + return sc.Value == nil || len(*sc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sc SnapshotCollection) hasNextLink() bool { + return sc.NextLink != nil && len(*sc.NextLink) != 0 +} + +// snapshotCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sc SnapshotCollection) snapshotCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !sc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sc.NextLink))) +} + +// SnapshotCollectionPage contains a page of Snapshot values. +type SnapshotCollectionPage struct { + fn func(context.Context, SnapshotCollection) (SnapshotCollection, error) + sc SnapshotCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SnapshotCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sc) + if err != nil { + return err + } + page.sc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SnapshotCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SnapshotCollectionPage) NotDone() bool { + return !page.sc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SnapshotCollectionPage) Response() SnapshotCollection { + return page.sc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SnapshotCollectionPage) Values() []Snapshot { + if page.sc.IsEmpty() { + return nil + } + return *page.sc.Value +} + +// Creates a new instance of the SnapshotCollectionPage type. +func NewSnapshotCollectionPage(cur SnapshotCollection, getNextPage func(context.Context, SnapshotCollection) (SnapshotCollection, error)) SnapshotCollectionPage { + return SnapshotCollectionPage{ + fn: getNextPage, + sc: cur, + } +} + +// SnapshotProperties snapshot resource specific properties +type SnapshotProperties struct { + // Time - READ-ONLY; The time the snapshot was taken. + Time *string `json:"time,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotProperties. +func (s SnapshotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SnapshotRecoverySource specifies the web app that snapshot contents will be retrieved from. +type SnapshotRecoverySource struct { + // Location - Geographical location of the source web app, e.g. SouthEastAsia, SouthCentralUS + Location *string `json:"location,omitempty"` + // ID - ARM resource ID of the source app. + // /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName} for production slots and + // /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName} for other slots. + ID *string `json:"id,omitempty"` +} + +// SnapshotRestoreRequest details about app recovery operation. +type SnapshotRestoreRequest struct { + // SnapshotRestoreRequestProperties - SnapshotRestoreRequest resource specific properties + *SnapshotRestoreRequestProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotRestoreRequest. +func (srr SnapshotRestoreRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if srr.SnapshotRestoreRequestProperties != nil { + objectMap["properties"] = srr.SnapshotRestoreRequestProperties + } + if srr.Kind != nil { + objectMap["kind"] = srr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SnapshotRestoreRequest struct. +func (srr *SnapshotRestoreRequest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var snapshotRestoreRequestProperties SnapshotRestoreRequestProperties + err = json.Unmarshal(*v, &snapshotRestoreRequestProperties) + if err != nil { + return err + } + srr.SnapshotRestoreRequestProperties = &snapshotRestoreRequestProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + srr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + srr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + srr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + srr.Type = &typeVar + } + } + } + + return nil +} + +// SnapshotRestoreRequestProperties snapshotRestoreRequest resource specific properties +type SnapshotRestoreRequestProperties struct { + // SnapshotTime - Point in time in which the app restore should be done, formatted as a DateTime string. + SnapshotTime *string `json:"snapshotTime,omitempty"` + // RecoverySource - Optional. Specifies the web app that snapshot contents will be retrieved from. + // If empty, the targeted web app will be used as the source. + RecoverySource *SnapshotRecoverySource `json:"recoverySource,omitempty"` + // Overwrite - If true the restore operation can overwrite source app; otherwise, false. + Overwrite *bool `json:"overwrite,omitempty"` + // RecoverConfiguration - If true, site configuration, in addition to content, will be reverted. + RecoverConfiguration *bool `json:"recoverConfiguration,omitempty"` + // IgnoreConflictingHostNames - If true, custom hostname conflicts will be ignored when recovering to a target web app. + // This setting is only necessary when RecoverConfiguration is enabled. + IgnoreConflictingHostNames *bool `json:"ignoreConflictingHostNames,omitempty"` + // UseDRSecondary - If true, the snapshot is retrieved from DRSecondary endpoint. + UseDRSecondary *bool `json:"useDRSecondary,omitempty"` +} + +// Solution class Representing Solution for problems detected. +type Solution struct { + // ID - Solution Id. + ID *float64 `json:"id,omitempty"` + // DisplayName - Display Name of the solution + DisplayName *string `json:"displayName,omitempty"` + // Order - Order of the solution. + Order *float64 `json:"order,omitempty"` + // Description - Description of the solution + Description *string `json:"description,omitempty"` + // Type - Type of Solution. Possible values include: 'SolutionTypeQuickSolution', 'SolutionTypeDeepInvestigation', 'SolutionTypeBestPractices' + Type SolutionType `json:"type,omitempty"` + // Data - Solution Data. + Data *[][]NameValuePair `json:"data,omitempty"` + // Metadata - Solution Metadata. + Metadata *[][]NameValuePair `json:"metadata,omitempty"` +} + +// SourceControl the source control OAuth token. +type SourceControl struct { + autorest.Response `json:"-"` + // SourceControlProperties - SourceControl resource specific properties + *SourceControlProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControl. +func (sc SourceControl) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sc.SourceControlProperties != nil { + objectMap["properties"] = sc.SourceControlProperties + } + if sc.Kind != nil { + objectMap["kind"] = sc.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SourceControl struct. +func (sc *SourceControl) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var sourceControlProperties SourceControlProperties + err = json.Unmarshal(*v, &sourceControlProperties) + if err != nil { + return err + } + sc.SourceControlProperties = &sourceControlProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sc.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sc.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sc.Type = &typeVar + } + } + } + + return nil +} + +// SourceControlCollection collection of source controls. +type SourceControlCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]SourceControl `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlCollection. +func (scc SourceControlCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.Value != nil { + objectMap["value"] = scc.Value + } + return json.Marshal(objectMap) +} + +// SourceControlCollectionIterator provides access to a complete listing of SourceControl values. +type SourceControlCollectionIterator struct { + i int + page SourceControlCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SourceControlCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SourceControlCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SourceControlCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SourceControlCollectionIterator) Response() SourceControlCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SourceControlCollectionIterator) Value() SourceControl { + if !iter.page.NotDone() { + return SourceControl{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SourceControlCollectionIterator type. +func NewSourceControlCollectionIterator(page SourceControlCollectionPage) SourceControlCollectionIterator { + return SourceControlCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (scc SourceControlCollection) IsEmpty() bool { + return scc.Value == nil || len(*scc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (scc SourceControlCollection) hasNextLink() bool { + return scc.NextLink != nil && len(*scc.NextLink) != 0 +} + +// sourceControlCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (scc SourceControlCollection) sourceControlCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !scc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(scc.NextLink))) +} + +// SourceControlCollectionPage contains a page of SourceControl values. +type SourceControlCollectionPage struct { + fn func(context.Context, SourceControlCollection) (SourceControlCollection, error) + scc SourceControlCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SourceControlCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.scc) + if err != nil { + return err + } + page.scc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SourceControlCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SourceControlCollectionPage) NotDone() bool { + return !page.scc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SourceControlCollectionPage) Response() SourceControlCollection { + return page.scc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SourceControlCollectionPage) Values() []SourceControl { + if page.scc.IsEmpty() { + return nil + } + return *page.scc.Value +} + +// Creates a new instance of the SourceControlCollectionPage type. +func NewSourceControlCollectionPage(cur SourceControlCollection, getNextPage func(context.Context, SourceControlCollection) (SourceControlCollection, error)) SourceControlCollectionPage { + return SourceControlCollectionPage{ + fn: getNextPage, + scc: cur, + } +} + +// SourceControlProperties sourceControl resource specific properties +type SourceControlProperties struct { + // Token - OAuth access token. + Token *string `json:"token,omitempty"` + // TokenSecret - OAuth access token secret. + TokenSecret *string `json:"tokenSecret,omitempty"` + // RefreshToken - OAuth refresh token. + RefreshToken *string `json:"refreshToken,omitempty"` + // ExpirationTime - OAuth token expiration. + ExpirationTime *date.Time `json:"expirationTime,omitempty"` +} + +// StackMajorVersion application stack major version. +type StackMajorVersion struct { + // DisplayVersion - Application stack major version (display only). + DisplayVersion *string `json:"displayVersion,omitempty"` + // RuntimeVersion - Application stack major version (runtime only). + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + // IsDefault - true if this is the default major version; otherwise, false. + IsDefault *bool `json:"isDefault,omitempty"` + // MinorVersions - Minor versions associated with the major version. + MinorVersions *[]StackMinorVersion `json:"minorVersions,omitempty"` + // ApplicationInsights - true if this supports Application Insights; otherwise, false. + ApplicationInsights *bool `json:"applicationInsights,omitempty"` + // IsPreview - true if this stack is in Preview, otherwise false. + IsPreview *bool `json:"isPreview,omitempty"` + // IsDeprecated - true if this stack has been deprecated, otherwise false. + IsDeprecated *bool `json:"isDeprecated,omitempty"` + // IsHidden - true if this stack should be hidden for new customers on portal, otherwise false. + IsHidden *bool `json:"isHidden,omitempty"` + // AppSettingsDictionary - + // + // + // Example: All the function apps need AppSetting: "FUNCTIONS_WORKER_RUNTIME" to be set stack name + AppSettingsDictionary map[string]interface{} `json:"appSettingsDictionary"` + // SiteConfigPropertiesDictionary - + // + // + // Example: All Linux Function Apps, need Use32BitWorkerProcess to be set to 0 + SiteConfigPropertiesDictionary map[string]interface{} `json:"siteConfigPropertiesDictionary"` +} + +// MarshalJSON is the custom marshaler for StackMajorVersion. +func (smv StackMajorVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if smv.DisplayVersion != nil { + objectMap["displayVersion"] = smv.DisplayVersion + } + if smv.RuntimeVersion != nil { + objectMap["runtimeVersion"] = smv.RuntimeVersion + } + if smv.IsDefault != nil { + objectMap["isDefault"] = smv.IsDefault + } + if smv.MinorVersions != nil { + objectMap["minorVersions"] = smv.MinorVersions + } + if smv.ApplicationInsights != nil { + objectMap["applicationInsights"] = smv.ApplicationInsights + } + if smv.IsPreview != nil { + objectMap["isPreview"] = smv.IsPreview + } + if smv.IsDeprecated != nil { + objectMap["isDeprecated"] = smv.IsDeprecated + } + if smv.IsHidden != nil { + objectMap["isHidden"] = smv.IsHidden + } + if smv.AppSettingsDictionary != nil { + objectMap["appSettingsDictionary"] = smv.AppSettingsDictionary + } + if smv.SiteConfigPropertiesDictionary != nil { + objectMap["siteConfigPropertiesDictionary"] = smv.SiteConfigPropertiesDictionary + } + return json.Marshal(objectMap) +} + +// StackMinorVersion application stack minor version. +type StackMinorVersion struct { + // DisplayVersion - Application stack minor version (display only). + DisplayVersion *string `json:"displayVersion,omitempty"` + // RuntimeVersion - Application stack minor version (runtime only). + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + // IsDefault - true if this is the default minor version; otherwise, false. + IsDefault *bool `json:"isDefault,omitempty"` + // IsRemoteDebuggingEnabled - true if this supports Remote Debugging, otherwise false. + IsRemoteDebuggingEnabled *bool `json:"isRemoteDebuggingEnabled,omitempty"` +} + +// StampCapacity stamp capacity information. +type StampCapacity struct { + // Name - Name of the stamp. + Name *string `json:"name,omitempty"` + // AvailableCapacity - Available capacity (# of machines, bytes of storage etc...). + AvailableCapacity *int64 `json:"availableCapacity,omitempty"` + // TotalCapacity - Total capacity (# of machines, bytes of storage etc...). + TotalCapacity *int64 `json:"totalCapacity,omitempty"` + // Unit - Name of the unit. + Unit *string `json:"unit,omitempty"` + // ComputeMode - Shared/dedicated workers. Possible values include: 'ComputeModeOptionsShared', 'ComputeModeOptionsDedicated', 'ComputeModeOptionsDynamic' + ComputeMode ComputeModeOptions `json:"computeMode,omitempty"` + // WorkerSize - Size of the machines. Possible values include: 'WorkerSizeOptionsSmall', 'WorkerSizeOptionsMedium', 'WorkerSizeOptionsLarge', 'WorkerSizeOptionsD1', 'WorkerSizeOptionsD2', 'WorkerSizeOptionsD3', 'WorkerSizeOptionsSmallV3', 'WorkerSizeOptionsMediumV3', 'WorkerSizeOptionsLargeV3', 'WorkerSizeOptionsNestedSmall', 'WorkerSizeOptionsNestedSmallLinux', 'WorkerSizeOptionsDefault' + WorkerSize WorkerSizeOptions `json:"workerSize,omitempty"` + // WorkerSizeID - Size ID of machines: + // 0 - Small + // 1 - Medium + // 2 - Large + WorkerSizeID *int32 `json:"workerSizeId,omitempty"` + // ExcludeFromCapacityAllocation - If true, it includes basic apps. + // Basic apps are not used for capacity allocation. + ExcludeFromCapacityAllocation *bool `json:"excludeFromCapacityAllocation,omitempty"` + // IsApplicableForAllComputeModes - true if capacity is applicable for all apps; otherwise, false. + IsApplicableForAllComputeModes *bool `json:"isApplicableForAllComputeModes,omitempty"` + // SiteMode - Shared or Dedicated. + SiteMode *string `json:"siteMode,omitempty"` + // IsLinux - Is this a linux stamp capacity + IsLinux *bool `json:"isLinux,omitempty"` +} + +// StampCapacityCollection collection of stamp capacities. +type StampCapacityCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]StampCapacity `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for StampCapacityCollection. +func (scc StampCapacityCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.Value != nil { + objectMap["value"] = scc.Value + } + return json.Marshal(objectMap) +} + +// StampCapacityCollectionIterator provides access to a complete listing of StampCapacity values. +type StampCapacityCollectionIterator struct { + i int + page StampCapacityCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *StampCapacityCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StampCapacityCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *StampCapacityCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter StampCapacityCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter StampCapacityCollectionIterator) Response() StampCapacityCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter StampCapacityCollectionIterator) Value() StampCapacity { + if !iter.page.NotDone() { + return StampCapacity{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the StampCapacityCollectionIterator type. +func NewStampCapacityCollectionIterator(page StampCapacityCollectionPage) StampCapacityCollectionIterator { + return StampCapacityCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (scc StampCapacityCollection) IsEmpty() bool { + return scc.Value == nil || len(*scc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (scc StampCapacityCollection) hasNextLink() bool { + return scc.NextLink != nil && len(*scc.NextLink) != 0 +} + +// stampCapacityCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (scc StampCapacityCollection) stampCapacityCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !scc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(scc.NextLink))) +} + +// StampCapacityCollectionPage contains a page of StampCapacity values. +type StampCapacityCollectionPage struct { + fn func(context.Context, StampCapacityCollection) (StampCapacityCollection, error) + scc StampCapacityCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *StampCapacityCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StampCapacityCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.scc) + if err != nil { + return err + } + page.scc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *StampCapacityCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page StampCapacityCollectionPage) NotDone() bool { + return !page.scc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page StampCapacityCollectionPage) Response() StampCapacityCollection { + return page.scc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page StampCapacityCollectionPage) Values() []StampCapacity { + if page.scc.IsEmpty() { + return nil + } + return *page.scc.Value +} + +// Creates a new instance of the StampCapacityCollectionPage type. +func NewStampCapacityCollectionPage(cur StampCapacityCollection, getNextPage func(context.Context, StampCapacityCollection) (StampCapacityCollection, error)) StampCapacityCollectionPage { + return StampCapacityCollectionPage{ + fn: getNextPage, + scc: cur, + } +} + +// StaticSite a static site. +type StaticSite struct { + // DefaultHostname - READ-ONLY; The default autogenerated hostname for the static site. + DefaultHostname *string `json:"defaultHostname,omitempty"` + // RepositoryURL - URL for the repository of the static site. + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // Branch - The target branch in the repository. + Branch *string `json:"branch,omitempty"` + // CustomDomains - READ-ONLY; The custom domains associated with this static site. + CustomDomains *[]string `json:"customDomains,omitempty"` + // RepositoryToken - A user's github repository token. This is used to setup the Github Actions workflow file and API secrets. + RepositoryToken *string `json:"repositoryToken,omitempty"` + // BuildProperties - Build properties to configure on the repository. + BuildProperties *StaticSiteBuildProperties `json:"buildProperties,omitempty"` + // PrivateEndpointConnections - READ-ONLY; Private endpoint connections + PrivateEndpointConnections *[]ResponseMessageEnvelopeRemotePrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // StagingEnvironmentPolicy - State indicating whether staging environments are allowed or not allowed for a static web app. Possible values include: 'StagingEnvironmentPolicyEnabled', 'StagingEnvironmentPolicyDisabled' + StagingEnvironmentPolicy StagingEnvironmentPolicy `json:"stagingEnvironmentPolicy,omitempty"` + // AllowConfigFileUpdates - false if config file is locked for this static web app; otherwise, true. + AllowConfigFileUpdates *bool `json:"allowConfigFileUpdates,omitempty"` + // TemplateProperties - Template options for generating a new repository. + TemplateProperties *StaticSiteTemplateOptions `json:"templateProperties,omitempty"` + // ContentDistributionEndpoint - READ-ONLY; The content distribution endpoint for the static site. + ContentDistributionEndpoint *string `json:"contentDistributionEndpoint,omitempty"` + // KeyVaultReferenceIdentity - READ-ONLY; Identity to use for Key Vault Reference authentication. + KeyVaultReferenceIdentity *string `json:"keyVaultReferenceIdentity,omitempty"` + // UserProvidedFunctionApps - READ-ONLY; User provided function apps registered with the static site + UserProvidedFunctionApps *[]StaticSiteUserProvidedFunctionApp `json:"userProvidedFunctionApps,omitempty"` + // Provider - The provider that submitted the last deployment to the primary environment of the static site. + Provider *string `json:"provider,omitempty"` + // EnterpriseGradeCdnStatus - State indicating the status of the enterprise grade CDN serving traffic to the static web app. Possible values include: 'EnterpriseGradeCdnStatusEnabled', 'EnterpriseGradeCdnStatusEnabling', 'EnterpriseGradeCdnStatusDisabled', 'EnterpriseGradeCdnStatusDisabling' + EnterpriseGradeCdnStatus EnterpriseGradeCdnStatus `json:"enterpriseGradeCdnStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSite. +func (ss StaticSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ss.RepositoryURL != nil { + objectMap["repositoryUrl"] = ss.RepositoryURL + } + if ss.Branch != nil { + objectMap["branch"] = ss.Branch + } + if ss.RepositoryToken != nil { + objectMap["repositoryToken"] = ss.RepositoryToken + } + if ss.BuildProperties != nil { + objectMap["buildProperties"] = ss.BuildProperties + } + if ss.StagingEnvironmentPolicy != "" { + objectMap["stagingEnvironmentPolicy"] = ss.StagingEnvironmentPolicy + } + if ss.AllowConfigFileUpdates != nil { + objectMap["allowConfigFileUpdates"] = ss.AllowConfigFileUpdates + } + if ss.TemplateProperties != nil { + objectMap["templateProperties"] = ss.TemplateProperties + } + if ss.Provider != nil { + objectMap["provider"] = ss.Provider + } + if ss.EnterpriseGradeCdnStatus != "" { + objectMap["enterpriseGradeCdnStatus"] = ss.EnterpriseGradeCdnStatus + } + return json.Marshal(objectMap) +} + +// StaticSiteARMResource static Site ARM resource. +type StaticSiteARMResource struct { + autorest.Response `json:"-"` + // StaticSite - Core resource properties + *StaticSite `json:"properties,omitempty"` + Sku *SkuDescription `json:"sku,omitempty"` + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Location - Resource Location. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for StaticSiteARMResource. +func (ssar StaticSiteARMResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssar.StaticSite != nil { + objectMap["properties"] = ssar.StaticSite + } + if ssar.Sku != nil { + objectMap["sku"] = ssar.Sku + } + if ssar.Identity != nil { + objectMap["identity"] = ssar.Identity + } + if ssar.Kind != nil { + objectMap["kind"] = ssar.Kind + } + if ssar.Location != nil { + objectMap["location"] = ssar.Location + } + if ssar.Tags != nil { + objectMap["tags"] = ssar.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticSiteARMResource struct. +func (ssar *StaticSiteARMResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticSite StaticSite + err = json.Unmarshal(*v, &staticSite) + if err != nil { + return err + } + ssar.StaticSite = &staticSite + } + case "sku": + if v != nil { + var sku SkuDescription + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + ssar.Sku = &sku + } + case "identity": + if v != nil { + var identity ManagedServiceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + ssar.Identity = &identity + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ssar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ssar.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ssar.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ssar.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ssar.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ssar.Tags = tags + } + } + } + + return nil +} + +// StaticSiteBuildARMResource static Site Build ARM resource. +type StaticSiteBuildARMResource struct { + autorest.Response `json:"-"` + // StaticSiteBuildARMResourceProperties - StaticSiteBuildARMResource resource specific properties + *StaticSiteBuildARMResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteBuildARMResource. +func (ssbar StaticSiteBuildARMResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssbar.StaticSiteBuildARMResourceProperties != nil { + objectMap["properties"] = ssbar.StaticSiteBuildARMResourceProperties + } + if ssbar.Kind != nil { + objectMap["kind"] = ssbar.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticSiteBuildARMResource struct. +func (ssbar *StaticSiteBuildARMResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticSiteBuildARMResourceProperties StaticSiteBuildARMResourceProperties + err = json.Unmarshal(*v, &staticSiteBuildARMResourceProperties) + if err != nil { + return err + } + ssbar.StaticSiteBuildARMResourceProperties = &staticSiteBuildARMResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ssbar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ssbar.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ssbar.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ssbar.Type = &typeVar + } + } + } + + return nil +} + +// StaticSiteBuildARMResourceProperties staticSiteBuildARMResource resource specific properties +type StaticSiteBuildARMResourceProperties struct { + // BuildID - READ-ONLY; An identifier for the static site build. + BuildID *string `json:"buildId,omitempty"` + // SourceBranch - READ-ONLY; The source branch. + SourceBranch *string `json:"sourceBranch,omitempty"` + // PullRequestTitle - READ-ONLY; The title of a pull request that a static site build is related to. + PullRequestTitle *string `json:"pullRequestTitle,omitempty"` + // Hostname - READ-ONLY; The hostname for a static site build. + Hostname *string `json:"hostname,omitempty"` + // CreatedTimeUtc - READ-ONLY; When this build was created. + CreatedTimeUtc *date.Time `json:"createdTimeUtc,omitempty"` + // LastUpdatedOn - READ-ONLY; When this build was updated. + LastUpdatedOn *date.Time `json:"lastUpdatedOn,omitempty"` + // Status - READ-ONLY; The status of the static site build. Possible values include: 'BuildStatusWaitingForDeployment', 'BuildStatusUploading', 'BuildStatusDeploying', 'BuildStatusReady', 'BuildStatusFailed', 'BuildStatusDeleting', 'BuildStatusDetached' + Status BuildStatus `json:"status,omitempty"` + // UserProvidedFunctionApps - READ-ONLY; User provided function apps registered with the static site build + UserProvidedFunctionApps *[]StaticSiteUserProvidedFunctionApp `json:"userProvidedFunctionApps,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteBuildARMResourceProperties. +func (ssbar StaticSiteBuildARMResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// StaticSiteBuildCollection collection of static site builds. +type StaticSiteBuildCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]StaticSiteBuildARMResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteBuildCollection. +func (ssbc StaticSiteBuildCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssbc.Value != nil { + objectMap["value"] = ssbc.Value + } + return json.Marshal(objectMap) +} + +// StaticSiteBuildCollectionIterator provides access to a complete listing of StaticSiteBuildARMResource +// values. +type StaticSiteBuildCollectionIterator struct { + i int + page StaticSiteBuildCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *StaticSiteBuildCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSiteBuildCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *StaticSiteBuildCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter StaticSiteBuildCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter StaticSiteBuildCollectionIterator) Response() StaticSiteBuildCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter StaticSiteBuildCollectionIterator) Value() StaticSiteBuildARMResource { + if !iter.page.NotDone() { + return StaticSiteBuildARMResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the StaticSiteBuildCollectionIterator type. +func NewStaticSiteBuildCollectionIterator(page StaticSiteBuildCollectionPage) StaticSiteBuildCollectionIterator { + return StaticSiteBuildCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ssbc StaticSiteBuildCollection) IsEmpty() bool { + return ssbc.Value == nil || len(*ssbc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ssbc StaticSiteBuildCollection) hasNextLink() bool { + return ssbc.NextLink != nil && len(*ssbc.NextLink) != 0 +} + +// staticSiteBuildCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ssbc StaticSiteBuildCollection) staticSiteBuildCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !ssbc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ssbc.NextLink))) +} + +// StaticSiteBuildCollectionPage contains a page of StaticSiteBuildARMResource values. +type StaticSiteBuildCollectionPage struct { + fn func(context.Context, StaticSiteBuildCollection) (StaticSiteBuildCollection, error) + ssbc StaticSiteBuildCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *StaticSiteBuildCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSiteBuildCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ssbc) + if err != nil { + return err + } + page.ssbc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *StaticSiteBuildCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page StaticSiteBuildCollectionPage) NotDone() bool { + return !page.ssbc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page StaticSiteBuildCollectionPage) Response() StaticSiteBuildCollection { + return page.ssbc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page StaticSiteBuildCollectionPage) Values() []StaticSiteBuildARMResource { + if page.ssbc.IsEmpty() { + return nil + } + return *page.ssbc.Value +} + +// Creates a new instance of the StaticSiteBuildCollectionPage type. +func NewStaticSiteBuildCollectionPage(cur StaticSiteBuildCollection, getNextPage func(context.Context, StaticSiteBuildCollection) (StaticSiteBuildCollection, error)) StaticSiteBuildCollectionPage { + return StaticSiteBuildCollectionPage{ + fn: getNextPage, + ssbc: cur, + } +} + +// StaticSiteBuildProperties build properties for the static site. +type StaticSiteBuildProperties struct { + // AppLocation - The path to the app code within the repository. + AppLocation *string `json:"appLocation,omitempty"` + // APILocation - The path to the api code within the repository. + APILocation *string `json:"apiLocation,omitempty"` + // AppArtifactLocation - Deprecated: The path of the app artifacts after building (deprecated in favor of OutputLocation) + AppArtifactLocation *string `json:"appArtifactLocation,omitempty"` + // OutputLocation - The output path of the app after building. + OutputLocation *string `json:"outputLocation,omitempty"` + // AppBuildCommand - A custom command to run during deployment of the static content application. + AppBuildCommand *string `json:"appBuildCommand,omitempty"` + // APIBuildCommand - A custom command to run during deployment of the Azure Functions API application. + APIBuildCommand *string `json:"apiBuildCommand,omitempty"` + // SkipGithubActionWorkflowGeneration - Skip Github Action workflow generation. + SkipGithubActionWorkflowGeneration *bool `json:"skipGithubActionWorkflowGeneration,omitempty"` + // GithubActionSecretNameOverride - Github Action secret name override. + GithubActionSecretNameOverride *string `json:"githubActionSecretNameOverride,omitempty"` +} + +// StaticSiteCollection collection of static sites. +type StaticSiteCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]StaticSiteARMResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteCollection. +func (ssc StaticSiteCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssc.Value != nil { + objectMap["value"] = ssc.Value + } + return json.Marshal(objectMap) +} + +// StaticSiteCollectionIterator provides access to a complete listing of StaticSiteARMResource values. +type StaticSiteCollectionIterator struct { + i int + page StaticSiteCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *StaticSiteCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSiteCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *StaticSiteCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter StaticSiteCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter StaticSiteCollectionIterator) Response() StaticSiteCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter StaticSiteCollectionIterator) Value() StaticSiteARMResource { + if !iter.page.NotDone() { + return StaticSiteARMResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the StaticSiteCollectionIterator type. +func NewStaticSiteCollectionIterator(page StaticSiteCollectionPage) StaticSiteCollectionIterator { + return StaticSiteCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ssc StaticSiteCollection) IsEmpty() bool { + return ssc.Value == nil || len(*ssc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ssc StaticSiteCollection) hasNextLink() bool { + return ssc.NextLink != nil && len(*ssc.NextLink) != 0 +} + +// staticSiteCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ssc StaticSiteCollection) staticSiteCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !ssc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ssc.NextLink))) +} + +// StaticSiteCollectionPage contains a page of StaticSiteARMResource values. +type StaticSiteCollectionPage struct { + fn func(context.Context, StaticSiteCollection) (StaticSiteCollection, error) + ssc StaticSiteCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *StaticSiteCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSiteCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ssc) + if err != nil { + return err + } + page.ssc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *StaticSiteCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page StaticSiteCollectionPage) NotDone() bool { + return !page.ssc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page StaticSiteCollectionPage) Response() StaticSiteCollection { + return page.ssc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page StaticSiteCollectionPage) Values() []StaticSiteARMResource { + if page.ssc.IsEmpty() { + return nil + } + return *page.ssc.Value +} + +// Creates a new instance of the StaticSiteCollectionPage type. +func NewStaticSiteCollectionPage(cur StaticSiteCollection, getNextPage func(context.Context, StaticSiteCollection) (StaticSiteCollection, error)) StaticSiteCollectionPage { + return StaticSiteCollectionPage{ + fn: getNextPage, + ssc: cur, + } +} + +// StaticSiteCustomDomainOverviewARMResource static Site Custom Domain Overview ARM resource. +type StaticSiteCustomDomainOverviewARMResource struct { + autorest.Response `json:"-"` + // StaticSiteCustomDomainOverviewARMResourceProperties - StaticSiteCustomDomainOverviewARMResource resource specific properties + *StaticSiteCustomDomainOverviewARMResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteCustomDomainOverviewARMResource. +func (sscdoar StaticSiteCustomDomainOverviewARMResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sscdoar.StaticSiteCustomDomainOverviewARMResourceProperties != nil { + objectMap["properties"] = sscdoar.StaticSiteCustomDomainOverviewARMResourceProperties + } + if sscdoar.Kind != nil { + objectMap["kind"] = sscdoar.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticSiteCustomDomainOverviewARMResource struct. +func (sscdoar *StaticSiteCustomDomainOverviewARMResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticSiteCustomDomainOverviewARMResourceProperties StaticSiteCustomDomainOverviewARMResourceProperties + err = json.Unmarshal(*v, &staticSiteCustomDomainOverviewARMResourceProperties) + if err != nil { + return err + } + sscdoar.StaticSiteCustomDomainOverviewARMResourceProperties = &staticSiteCustomDomainOverviewARMResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sscdoar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sscdoar.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sscdoar.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sscdoar.Type = &typeVar + } + } + } + + return nil +} + +// StaticSiteCustomDomainOverviewARMResourceProperties staticSiteCustomDomainOverviewARMResource resource +// specific properties +type StaticSiteCustomDomainOverviewARMResourceProperties struct { + // DomainName - READ-ONLY; The domain name for the static site custom domain. + DomainName *string `json:"domainName,omitempty"` + // CreatedOn - READ-ONLY; The date and time on which the custom domain was created for the static site. + CreatedOn *date.Time `json:"createdOn,omitempty"` + // Status - READ-ONLY; The status of the custom domain. Possible values include: 'CustomDomainStatusRetrievingValidationToken', 'CustomDomainStatusValidating', 'CustomDomainStatusAdding', 'CustomDomainStatusReady', 'CustomDomainStatusFailed', 'CustomDomainStatusDeleting' + Status CustomDomainStatus `json:"status,omitempty"` + // ValidationToken - READ-ONLY; The TXT record validation token + ValidationToken *string `json:"validationToken,omitempty"` + // ErrorMessage - READ-ONLY + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteCustomDomainOverviewARMResourceProperties. +func (sscdoar StaticSiteCustomDomainOverviewARMResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// StaticSiteCustomDomainOverviewCollection collection of static site custom domains. +type StaticSiteCustomDomainOverviewCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]StaticSiteCustomDomainOverviewARMResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteCustomDomainOverviewCollection. +func (sscdoc StaticSiteCustomDomainOverviewCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sscdoc.Value != nil { + objectMap["value"] = sscdoc.Value + } + return json.Marshal(objectMap) +} + +// StaticSiteCustomDomainOverviewCollectionIterator provides access to a complete listing of +// StaticSiteCustomDomainOverviewARMResource values. +type StaticSiteCustomDomainOverviewCollectionIterator struct { + i int + page StaticSiteCustomDomainOverviewCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *StaticSiteCustomDomainOverviewCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSiteCustomDomainOverviewCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *StaticSiteCustomDomainOverviewCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter StaticSiteCustomDomainOverviewCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter StaticSiteCustomDomainOverviewCollectionIterator) Response() StaticSiteCustomDomainOverviewCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter StaticSiteCustomDomainOverviewCollectionIterator) Value() StaticSiteCustomDomainOverviewARMResource { + if !iter.page.NotDone() { + return StaticSiteCustomDomainOverviewARMResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the StaticSiteCustomDomainOverviewCollectionIterator type. +func NewStaticSiteCustomDomainOverviewCollectionIterator(page StaticSiteCustomDomainOverviewCollectionPage) StaticSiteCustomDomainOverviewCollectionIterator { + return StaticSiteCustomDomainOverviewCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sscdoc StaticSiteCustomDomainOverviewCollection) IsEmpty() bool { + return sscdoc.Value == nil || len(*sscdoc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sscdoc StaticSiteCustomDomainOverviewCollection) hasNextLink() bool { + return sscdoc.NextLink != nil && len(*sscdoc.NextLink) != 0 +} + +// staticSiteCustomDomainOverviewCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sscdoc StaticSiteCustomDomainOverviewCollection) staticSiteCustomDomainOverviewCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !sscdoc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sscdoc.NextLink))) +} + +// StaticSiteCustomDomainOverviewCollectionPage contains a page of +// StaticSiteCustomDomainOverviewARMResource values. +type StaticSiteCustomDomainOverviewCollectionPage struct { + fn func(context.Context, StaticSiteCustomDomainOverviewCollection) (StaticSiteCustomDomainOverviewCollection, error) + sscdoc StaticSiteCustomDomainOverviewCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *StaticSiteCustomDomainOverviewCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSiteCustomDomainOverviewCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sscdoc) + if err != nil { + return err + } + page.sscdoc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *StaticSiteCustomDomainOverviewCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page StaticSiteCustomDomainOverviewCollectionPage) NotDone() bool { + return !page.sscdoc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page StaticSiteCustomDomainOverviewCollectionPage) Response() StaticSiteCustomDomainOverviewCollection { + return page.sscdoc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page StaticSiteCustomDomainOverviewCollectionPage) Values() []StaticSiteCustomDomainOverviewARMResource { + if page.sscdoc.IsEmpty() { + return nil + } + return *page.sscdoc.Value +} + +// Creates a new instance of the StaticSiteCustomDomainOverviewCollectionPage type. +func NewStaticSiteCustomDomainOverviewCollectionPage(cur StaticSiteCustomDomainOverviewCollection, getNextPage func(context.Context, StaticSiteCustomDomainOverviewCollection) (StaticSiteCustomDomainOverviewCollection, error)) StaticSiteCustomDomainOverviewCollectionPage { + return StaticSiteCustomDomainOverviewCollectionPage{ + fn: getNextPage, + sscdoc: cur, + } +} + +// StaticSiteCustomDomainRequestPropertiesARMResource static Site Custom Domain Request Properties ARM +// resource. +type StaticSiteCustomDomainRequestPropertiesARMResource struct { + // StaticSiteCustomDomainRequestPropertiesARMResourceProperties - StaticSiteCustomDomainRequestPropertiesARMResource resource specific properties + *StaticSiteCustomDomainRequestPropertiesARMResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteCustomDomainRequestPropertiesARMResource. +func (sscdrpar StaticSiteCustomDomainRequestPropertiesARMResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sscdrpar.StaticSiteCustomDomainRequestPropertiesARMResourceProperties != nil { + objectMap["properties"] = sscdrpar.StaticSiteCustomDomainRequestPropertiesARMResourceProperties + } + if sscdrpar.Kind != nil { + objectMap["kind"] = sscdrpar.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticSiteCustomDomainRequestPropertiesARMResource struct. +func (sscdrpar *StaticSiteCustomDomainRequestPropertiesARMResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticSiteCustomDomainRequestPropertiesARMResourceProperties StaticSiteCustomDomainRequestPropertiesARMResourceProperties + err = json.Unmarshal(*v, &staticSiteCustomDomainRequestPropertiesARMResourceProperties) + if err != nil { + return err + } + sscdrpar.StaticSiteCustomDomainRequestPropertiesARMResourceProperties = &staticSiteCustomDomainRequestPropertiesARMResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sscdrpar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sscdrpar.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sscdrpar.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sscdrpar.Type = &typeVar + } + } + } + + return nil +} + +// StaticSiteCustomDomainRequestPropertiesARMResourceProperties +// staticSiteCustomDomainRequestPropertiesARMResource resource specific properties +type StaticSiteCustomDomainRequestPropertiesARMResourceProperties struct { + // ValidationMethod - Validation method for adding a custom domain + ValidationMethod *string `json:"validationMethod,omitempty"` +} + +// StaticSiteFunctionOverviewARMResource static Site Function Overview ARM resource. +type StaticSiteFunctionOverviewARMResource struct { + // StaticSiteFunctionOverviewARMResourceProperties - StaticSiteFunctionOverviewARMResource resource specific properties + *StaticSiteFunctionOverviewARMResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteFunctionOverviewARMResource. +func (ssfoar StaticSiteFunctionOverviewARMResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssfoar.StaticSiteFunctionOverviewARMResourceProperties != nil { + objectMap["properties"] = ssfoar.StaticSiteFunctionOverviewARMResourceProperties + } + if ssfoar.Kind != nil { + objectMap["kind"] = ssfoar.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticSiteFunctionOverviewARMResource struct. +func (ssfoar *StaticSiteFunctionOverviewARMResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticSiteFunctionOverviewARMResourceProperties StaticSiteFunctionOverviewARMResourceProperties + err = json.Unmarshal(*v, &staticSiteFunctionOverviewARMResourceProperties) + if err != nil { + return err + } + ssfoar.StaticSiteFunctionOverviewARMResourceProperties = &staticSiteFunctionOverviewARMResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ssfoar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ssfoar.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ssfoar.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ssfoar.Type = &typeVar + } + } + } + + return nil +} + +// StaticSiteFunctionOverviewARMResourceProperties staticSiteFunctionOverviewARMResource resource specific +// properties +type StaticSiteFunctionOverviewARMResourceProperties struct { + // FunctionName - READ-ONLY; The name for the function + FunctionName *string `json:"functionName,omitempty"` + // TriggerType - READ-ONLY; The trigger type of the function. Possible values include: 'TriggerTypesHTTPTrigger', 'TriggerTypesUnknown' + TriggerType TriggerTypes `json:"triggerType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteFunctionOverviewARMResourceProperties. +func (ssfoar StaticSiteFunctionOverviewARMResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// StaticSiteFunctionOverviewCollection collection of static site functions. +type StaticSiteFunctionOverviewCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]StaticSiteFunctionOverviewARMResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteFunctionOverviewCollection. +func (ssfoc StaticSiteFunctionOverviewCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssfoc.Value != nil { + objectMap["value"] = ssfoc.Value + } + return json.Marshal(objectMap) +} + +// StaticSiteFunctionOverviewCollectionIterator provides access to a complete listing of +// StaticSiteFunctionOverviewARMResource values. +type StaticSiteFunctionOverviewCollectionIterator struct { + i int + page StaticSiteFunctionOverviewCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *StaticSiteFunctionOverviewCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSiteFunctionOverviewCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *StaticSiteFunctionOverviewCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter StaticSiteFunctionOverviewCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter StaticSiteFunctionOverviewCollectionIterator) Response() StaticSiteFunctionOverviewCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter StaticSiteFunctionOverviewCollectionIterator) Value() StaticSiteFunctionOverviewARMResource { + if !iter.page.NotDone() { + return StaticSiteFunctionOverviewARMResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the StaticSiteFunctionOverviewCollectionIterator type. +func NewStaticSiteFunctionOverviewCollectionIterator(page StaticSiteFunctionOverviewCollectionPage) StaticSiteFunctionOverviewCollectionIterator { + return StaticSiteFunctionOverviewCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ssfoc StaticSiteFunctionOverviewCollection) IsEmpty() bool { + return ssfoc.Value == nil || len(*ssfoc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ssfoc StaticSiteFunctionOverviewCollection) hasNextLink() bool { + return ssfoc.NextLink != nil && len(*ssfoc.NextLink) != 0 +} + +// staticSiteFunctionOverviewCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ssfoc StaticSiteFunctionOverviewCollection) staticSiteFunctionOverviewCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !ssfoc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ssfoc.NextLink))) +} + +// StaticSiteFunctionOverviewCollectionPage contains a page of StaticSiteFunctionOverviewARMResource +// values. +type StaticSiteFunctionOverviewCollectionPage struct { + fn func(context.Context, StaticSiteFunctionOverviewCollection) (StaticSiteFunctionOverviewCollection, error) + ssfoc StaticSiteFunctionOverviewCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *StaticSiteFunctionOverviewCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSiteFunctionOverviewCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ssfoc) + if err != nil { + return err + } + page.ssfoc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *StaticSiteFunctionOverviewCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page StaticSiteFunctionOverviewCollectionPage) NotDone() bool { + return !page.ssfoc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page StaticSiteFunctionOverviewCollectionPage) Response() StaticSiteFunctionOverviewCollection { + return page.ssfoc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page StaticSiteFunctionOverviewCollectionPage) Values() []StaticSiteFunctionOverviewARMResource { + if page.ssfoc.IsEmpty() { + return nil + } + return *page.ssfoc.Value +} + +// Creates a new instance of the StaticSiteFunctionOverviewCollectionPage type. +func NewStaticSiteFunctionOverviewCollectionPage(cur StaticSiteFunctionOverviewCollection, getNextPage func(context.Context, StaticSiteFunctionOverviewCollection) (StaticSiteFunctionOverviewCollection, error)) StaticSiteFunctionOverviewCollectionPage { + return StaticSiteFunctionOverviewCollectionPage{ + fn: getNextPage, + ssfoc: cur, + } +} + +// StaticSitePatchResource ARM resource for a static site when patching +type StaticSitePatchResource struct { + // StaticSite - Core resource properties + *StaticSite `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSitePatchResource. +func (sspr StaticSitePatchResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sspr.StaticSite != nil { + objectMap["properties"] = sspr.StaticSite + } + if sspr.Kind != nil { + objectMap["kind"] = sspr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticSitePatchResource struct. +func (sspr *StaticSitePatchResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticSite StaticSite + err = json.Unmarshal(*v, &staticSite) + if err != nil { + return err + } + sspr.StaticSite = &staticSite + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sspr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sspr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sspr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sspr.Type = &typeVar + } + } + } + + return nil +} + +// StaticSiteResetPropertiesARMResource static Site Reset Properties ARM resource. +type StaticSiteResetPropertiesARMResource struct { + // StaticSiteResetPropertiesARMResourceProperties - StaticSiteResetPropertiesARMResource resource specific properties + *StaticSiteResetPropertiesARMResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteResetPropertiesARMResource. +func (ssrpar StaticSiteResetPropertiesARMResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssrpar.StaticSiteResetPropertiesARMResourceProperties != nil { + objectMap["properties"] = ssrpar.StaticSiteResetPropertiesARMResourceProperties + } + if ssrpar.Kind != nil { + objectMap["kind"] = ssrpar.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticSiteResetPropertiesARMResource struct. +func (ssrpar *StaticSiteResetPropertiesARMResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticSiteResetPropertiesARMResourceProperties StaticSiteResetPropertiesARMResourceProperties + err = json.Unmarshal(*v, &staticSiteResetPropertiesARMResourceProperties) + if err != nil { + return err + } + ssrpar.StaticSiteResetPropertiesARMResourceProperties = &staticSiteResetPropertiesARMResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ssrpar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ssrpar.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ssrpar.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ssrpar.Type = &typeVar + } + } + } + + return nil +} + +// StaticSiteResetPropertiesARMResourceProperties staticSiteResetPropertiesARMResource resource specific +// properties +type StaticSiteResetPropertiesARMResourceProperties struct { + // RepositoryToken - The token which proves admin privileges to the repository. + RepositoryToken *string `json:"repositoryToken,omitempty"` + // ShouldUpdateRepository - Determines whether the repository should be updated with the new properties. + ShouldUpdateRepository *bool `json:"shouldUpdateRepository,omitempty"` +} + +// StaticSitesApproveOrRejectPrivateEndpointConnectionFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type StaticSitesApproveOrRejectPrivateEndpointConnectionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StaticSitesClient) (RemotePrivateEndpointConnectionARMResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StaticSitesApproveOrRejectPrivateEndpointConnectionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StaticSitesApproveOrRejectPrivateEndpointConnectionFuture.Result. +func (future *StaticSitesApproveOrRejectPrivateEndpointConnectionFuture) result(client StaticSitesClient) (rpecar RemotePrivateEndpointConnectionARMResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesApproveOrRejectPrivateEndpointConnectionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rpecar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.StaticSitesApproveOrRejectPrivateEndpointConnectionFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rpecar.Response.Response, err = future.GetResult(sender); err == nil && rpecar.Response.Response.StatusCode != http.StatusNoContent { + rpecar, err = client.ApproveOrRejectPrivateEndpointConnectionResponder(rpecar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesApproveOrRejectPrivateEndpointConnectionFuture", "Result", rpecar.Response.Response, "Failure responding to request") + } + } + return +} + +// StaticSitesCreateOrUpdateStaticSiteCustomDomainFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type StaticSitesCreateOrUpdateStaticSiteCustomDomainFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StaticSitesClient) (StaticSiteCustomDomainOverviewARMResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StaticSitesCreateOrUpdateStaticSiteCustomDomainFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StaticSitesCreateOrUpdateStaticSiteCustomDomainFuture.Result. +func (future *StaticSitesCreateOrUpdateStaticSiteCustomDomainFuture) result(client StaticSitesClient) (sscdoar StaticSiteCustomDomainOverviewARMResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesCreateOrUpdateStaticSiteCustomDomainFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sscdoar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.StaticSitesCreateOrUpdateStaticSiteCustomDomainFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sscdoar.Response.Response, err = future.GetResult(sender); err == nil && sscdoar.Response.Response.StatusCode != http.StatusNoContent { + sscdoar, err = client.CreateOrUpdateStaticSiteCustomDomainResponder(sscdoar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesCreateOrUpdateStaticSiteCustomDomainFuture", "Result", sscdoar.Response.Response, "Failure responding to request") + } + } + return +} + +// StaticSitesCreateOrUpdateStaticSiteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type StaticSitesCreateOrUpdateStaticSiteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StaticSitesClient) (StaticSiteARMResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StaticSitesCreateOrUpdateStaticSiteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StaticSitesCreateOrUpdateStaticSiteFuture.Result. +func (future *StaticSitesCreateOrUpdateStaticSiteFuture) result(client StaticSitesClient) (ssar StaticSiteARMResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesCreateOrUpdateStaticSiteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ssar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.StaticSitesCreateOrUpdateStaticSiteFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ssar.Response.Response, err = future.GetResult(sender); err == nil && ssar.Response.Response.StatusCode != http.StatusNoContent { + ssar, err = client.CreateOrUpdateStaticSiteResponder(ssar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesCreateOrUpdateStaticSiteFuture", "Result", ssar.Response.Response, "Failure responding to request") + } + } + return +} + +// StaticSitesCreateZipDeploymentForStaticSiteBuildFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type StaticSitesCreateZipDeploymentForStaticSiteBuildFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StaticSitesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StaticSitesCreateZipDeploymentForStaticSiteBuildFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StaticSitesCreateZipDeploymentForStaticSiteBuildFuture.Result. +func (future *StaticSitesCreateZipDeploymentForStaticSiteBuildFuture) result(client StaticSitesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesCreateZipDeploymentForStaticSiteBuildFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.StaticSitesCreateZipDeploymentForStaticSiteBuildFuture") + return + } + ar.Response = future.Response() + return +} + +// StaticSitesCreateZipDeploymentForStaticSiteFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type StaticSitesCreateZipDeploymentForStaticSiteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StaticSitesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StaticSitesCreateZipDeploymentForStaticSiteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StaticSitesCreateZipDeploymentForStaticSiteFuture.Result. +func (future *StaticSitesCreateZipDeploymentForStaticSiteFuture) result(client StaticSitesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesCreateZipDeploymentForStaticSiteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.StaticSitesCreateZipDeploymentForStaticSiteFuture") + return + } + ar.Response = future.Response() + return +} + +// StaticSitesDeletePrivateEndpointConnectionFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type StaticSitesDeletePrivateEndpointConnectionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StaticSitesClient) (SetObject, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StaticSitesDeletePrivateEndpointConnectionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StaticSitesDeletePrivateEndpointConnectionFuture.Result. +func (future *StaticSitesDeletePrivateEndpointConnectionFuture) result(client StaticSitesClient) (so SetObject, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesDeletePrivateEndpointConnectionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + so.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.StaticSitesDeletePrivateEndpointConnectionFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { + so, err = client.DeletePrivateEndpointConnectionResponder(so.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesDeletePrivateEndpointConnectionFuture", "Result", so.Response.Response, "Failure responding to request") + } + } + return +} + +// StaticSitesDeleteStaticSiteBuildFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type StaticSitesDeleteStaticSiteBuildFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StaticSitesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StaticSitesDeleteStaticSiteBuildFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StaticSitesDeleteStaticSiteBuildFuture.Result. +func (future *StaticSitesDeleteStaticSiteBuildFuture) result(client StaticSitesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesDeleteStaticSiteBuildFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.StaticSitesDeleteStaticSiteBuildFuture") + return + } + ar.Response = future.Response() + return +} + +// StaticSitesDeleteStaticSiteCustomDomainFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type StaticSitesDeleteStaticSiteCustomDomainFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StaticSitesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StaticSitesDeleteStaticSiteCustomDomainFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StaticSitesDeleteStaticSiteCustomDomainFuture.Result. +func (future *StaticSitesDeleteStaticSiteCustomDomainFuture) result(client StaticSitesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesDeleteStaticSiteCustomDomainFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.StaticSitesDeleteStaticSiteCustomDomainFuture") + return + } + ar.Response = future.Response() + return +} + +// StaticSitesDeleteStaticSiteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type StaticSitesDeleteStaticSiteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StaticSitesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StaticSitesDeleteStaticSiteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StaticSitesDeleteStaticSiteFuture.Result. +func (future *StaticSitesDeleteStaticSiteFuture) result(client StaticSitesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesDeleteStaticSiteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.StaticSitesDeleteStaticSiteFuture") + return + } + ar.Response = future.Response() + return +} + +// StaticSitesDetachStaticSiteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type StaticSitesDetachStaticSiteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StaticSitesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StaticSitesDetachStaticSiteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StaticSitesDetachStaticSiteFuture.Result. +func (future *StaticSitesDetachStaticSiteFuture) result(client StaticSitesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesDetachStaticSiteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.StaticSitesDetachStaticSiteFuture") + return + } + ar.Response = future.Response() + return +} + +// StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteBuildFuture an abstraction for monitoring and +// retrieving the results of a long-running operation. +type StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteBuildFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StaticSitesClient) (StaticSiteUserProvidedFunctionAppARMResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteBuildFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteBuildFuture.Result. +func (future *StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteBuildFuture) result(client StaticSitesClient) (ssupfaar StaticSiteUserProvidedFunctionAppARMResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteBuildFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ssupfaar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteBuildFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ssupfaar.Response.Response, err = future.GetResult(sender); err == nil && ssupfaar.Response.Response.StatusCode != http.StatusNoContent { + ssupfaar, err = client.RegisterUserProvidedFunctionAppWithStaticSiteBuildResponder(ssupfaar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteBuildFuture", "Result", ssupfaar.Response.Response, "Failure responding to request") + } + } + return +} + +// StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteFuture an abstraction for monitoring and +// retrieving the results of a long-running operation. +type StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StaticSitesClient) (StaticSiteUserProvidedFunctionAppARMResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteFuture.Result. +func (future *StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteFuture) result(client StaticSitesClient) (ssupfaar StaticSiteUserProvidedFunctionAppARMResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ssupfaar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ssupfaar.Response.Response, err = future.GetResult(sender); err == nil && ssupfaar.Response.Response.StatusCode != http.StatusNoContent { + ssupfaar, err = client.RegisterUserProvidedFunctionAppWithStaticSiteResponder(ssupfaar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteFuture", "Result", ssupfaar.Response.Response, "Failure responding to request") + } + } + return +} + +// StaticSitesValidateCustomDomainCanBeAddedToStaticSiteFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type StaticSitesValidateCustomDomainCanBeAddedToStaticSiteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StaticSitesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StaticSitesValidateCustomDomainCanBeAddedToStaticSiteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StaticSitesValidateCustomDomainCanBeAddedToStaticSiteFuture.Result. +func (future *StaticSitesValidateCustomDomainCanBeAddedToStaticSiteFuture) result(client StaticSitesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesValidateCustomDomainCanBeAddedToStaticSiteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("web.StaticSitesValidateCustomDomainCanBeAddedToStaticSiteFuture") + return + } + ar.Response = future.Response() + return +} + +// StaticSitesWorkflowPreview preview for the Static Site Workflow to be generated +type StaticSitesWorkflowPreview struct { + autorest.Response `json:"-"` + // StaticSitesWorkflowPreviewProperties - StaticSitesWorkflowPreview resource specific properties + *StaticSitesWorkflowPreviewProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSitesWorkflowPreview. +func (sswp StaticSitesWorkflowPreview) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sswp.StaticSitesWorkflowPreviewProperties != nil { + objectMap["properties"] = sswp.StaticSitesWorkflowPreviewProperties + } + if sswp.Kind != nil { + objectMap["kind"] = sswp.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticSitesWorkflowPreview struct. +func (sswp *StaticSitesWorkflowPreview) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticSitesWorkflowPreviewProperties StaticSitesWorkflowPreviewProperties + err = json.Unmarshal(*v, &staticSitesWorkflowPreviewProperties) + if err != nil { + return err + } + sswp.StaticSitesWorkflowPreviewProperties = &staticSitesWorkflowPreviewProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sswp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sswp.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sswp.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sswp.Type = &typeVar + } + } + } + + return nil +} + +// StaticSitesWorkflowPreviewProperties staticSitesWorkflowPreview resource specific properties +type StaticSitesWorkflowPreviewProperties struct { + // Path - READ-ONLY; The path for the workflow file to be generated + Path *string `json:"path,omitempty"` + // Contents - READ-ONLY; The contents for the workflow file to be generated + Contents *string `json:"contents,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSitesWorkflowPreviewProperties. +func (sswp StaticSitesWorkflowPreviewProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// StaticSitesWorkflowPreviewRequest request entity for previewing the Static Site workflow +type StaticSitesWorkflowPreviewRequest struct { + // StaticSitesWorkflowPreviewRequestProperties - StaticSitesWorkflowPreviewRequest resource specific properties + *StaticSitesWorkflowPreviewRequestProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSitesWorkflowPreviewRequest. +func (sswpr StaticSitesWorkflowPreviewRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sswpr.StaticSitesWorkflowPreviewRequestProperties != nil { + objectMap["properties"] = sswpr.StaticSitesWorkflowPreviewRequestProperties + } + if sswpr.Kind != nil { + objectMap["kind"] = sswpr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticSitesWorkflowPreviewRequest struct. +func (sswpr *StaticSitesWorkflowPreviewRequest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticSitesWorkflowPreviewRequestProperties StaticSitesWorkflowPreviewRequestProperties + err = json.Unmarshal(*v, &staticSitesWorkflowPreviewRequestProperties) + if err != nil { + return err + } + sswpr.StaticSitesWorkflowPreviewRequestProperties = &staticSitesWorkflowPreviewRequestProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sswpr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sswpr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sswpr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sswpr.Type = &typeVar + } + } + } + + return nil +} + +// StaticSitesWorkflowPreviewRequestProperties staticSitesWorkflowPreviewRequest resource specific +// properties +type StaticSitesWorkflowPreviewRequestProperties struct { + // RepositoryURL - URL for the repository of the static site. + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // Branch - The target branch in the repository. + Branch *string `json:"branch,omitempty"` + // BuildProperties - Build properties to configure on the repository. + BuildProperties *StaticSiteBuildProperties `json:"buildProperties,omitempty"` +} + +// StaticSiteTemplateOptions template Options for the static site. +type StaticSiteTemplateOptions struct { + // TemplateRepositoryURL - URL of the template repository. The newly generated repository will be based on this one. + TemplateRepositoryURL *string `json:"templateRepositoryUrl,omitempty"` + // Owner - Owner of the newly generated repository. + Owner *string `json:"owner,omitempty"` + // RepositoryName - Name of the newly generated repository. + RepositoryName *string `json:"repositoryName,omitempty"` + // Description - Description of the newly generated repository. + Description *string `json:"description,omitempty"` + // IsPrivate - Whether or not the newly generated repository is a private repository. Defaults to false (i.e. public). + IsPrivate *bool `json:"isPrivate,omitempty"` +} + +// StaticSiteUserARMResource static Site User ARM resource. +type StaticSiteUserARMResource struct { + autorest.Response `json:"-"` + // StaticSiteUserARMResourceProperties - StaticSiteUserARMResource resource specific properties + *StaticSiteUserARMResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteUserARMResource. +func (ssuar StaticSiteUserARMResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssuar.StaticSiteUserARMResourceProperties != nil { + objectMap["properties"] = ssuar.StaticSiteUserARMResourceProperties + } + if ssuar.Kind != nil { + objectMap["kind"] = ssuar.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticSiteUserARMResource struct. +func (ssuar *StaticSiteUserARMResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticSiteUserARMResourceProperties StaticSiteUserARMResourceProperties + err = json.Unmarshal(*v, &staticSiteUserARMResourceProperties) + if err != nil { + return err + } + ssuar.StaticSiteUserARMResourceProperties = &staticSiteUserARMResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ssuar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ssuar.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ssuar.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ssuar.Type = &typeVar + } + } + } + + return nil +} + +// StaticSiteUserARMResourceProperties staticSiteUserARMResource resource specific properties +type StaticSiteUserARMResourceProperties struct { + // Provider - READ-ONLY; The identity provider for the static site user. + Provider *string `json:"provider,omitempty"` + // UserID - READ-ONLY; The user id for the static site user. + UserID *string `json:"userId,omitempty"` + // DisplayName - READ-ONLY; The display name for the static site user. + DisplayName *string `json:"displayName,omitempty"` + // Roles - The roles for the static site user, in free-form string format + Roles *string `json:"roles,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteUserARMResourceProperties. +func (ssuar StaticSiteUserARMResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssuar.Roles != nil { + objectMap["roles"] = ssuar.Roles + } + return json.Marshal(objectMap) +} + +// StaticSiteUserCollection collection of static site custom users. +type StaticSiteUserCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]StaticSiteUserARMResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteUserCollection. +func (ssuc StaticSiteUserCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssuc.Value != nil { + objectMap["value"] = ssuc.Value + } + return json.Marshal(objectMap) +} + +// StaticSiteUserCollectionIterator provides access to a complete listing of StaticSiteUserARMResource +// values. +type StaticSiteUserCollectionIterator struct { + i int + page StaticSiteUserCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *StaticSiteUserCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSiteUserCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *StaticSiteUserCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter StaticSiteUserCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter StaticSiteUserCollectionIterator) Response() StaticSiteUserCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter StaticSiteUserCollectionIterator) Value() StaticSiteUserARMResource { + if !iter.page.NotDone() { + return StaticSiteUserARMResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the StaticSiteUserCollectionIterator type. +func NewStaticSiteUserCollectionIterator(page StaticSiteUserCollectionPage) StaticSiteUserCollectionIterator { + return StaticSiteUserCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ssuc StaticSiteUserCollection) IsEmpty() bool { + return ssuc.Value == nil || len(*ssuc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ssuc StaticSiteUserCollection) hasNextLink() bool { + return ssuc.NextLink != nil && len(*ssuc.NextLink) != 0 +} + +// staticSiteUserCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ssuc StaticSiteUserCollection) staticSiteUserCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !ssuc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ssuc.NextLink))) +} + +// StaticSiteUserCollectionPage contains a page of StaticSiteUserARMResource values. +type StaticSiteUserCollectionPage struct { + fn func(context.Context, StaticSiteUserCollection) (StaticSiteUserCollection, error) + ssuc StaticSiteUserCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *StaticSiteUserCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSiteUserCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ssuc) + if err != nil { + return err + } + page.ssuc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *StaticSiteUserCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page StaticSiteUserCollectionPage) NotDone() bool { + return !page.ssuc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page StaticSiteUserCollectionPage) Response() StaticSiteUserCollection { + return page.ssuc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page StaticSiteUserCollectionPage) Values() []StaticSiteUserARMResource { + if page.ssuc.IsEmpty() { + return nil + } + return *page.ssuc.Value +} + +// Creates a new instance of the StaticSiteUserCollectionPage type. +func NewStaticSiteUserCollectionPage(cur StaticSiteUserCollection, getNextPage func(context.Context, StaticSiteUserCollection) (StaticSiteUserCollection, error)) StaticSiteUserCollectionPage { + return StaticSiteUserCollectionPage{ + fn: getNextPage, + ssuc: cur, + } +} + +// StaticSiteUserInvitationRequestResource static sites user roles invitation resource. +type StaticSiteUserInvitationRequestResource struct { + // StaticSiteUserInvitationRequestResourceProperties - StaticSiteUserInvitationRequestResource resource specific properties + *StaticSiteUserInvitationRequestResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteUserInvitationRequestResource. +func (ssuirr StaticSiteUserInvitationRequestResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssuirr.StaticSiteUserInvitationRequestResourceProperties != nil { + objectMap["properties"] = ssuirr.StaticSiteUserInvitationRequestResourceProperties + } + if ssuirr.Kind != nil { + objectMap["kind"] = ssuirr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticSiteUserInvitationRequestResource struct. +func (ssuirr *StaticSiteUserInvitationRequestResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticSiteUserInvitationRequestResourceProperties StaticSiteUserInvitationRequestResourceProperties + err = json.Unmarshal(*v, &staticSiteUserInvitationRequestResourceProperties) + if err != nil { + return err + } + ssuirr.StaticSiteUserInvitationRequestResourceProperties = &staticSiteUserInvitationRequestResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ssuirr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ssuirr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ssuirr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ssuirr.Type = &typeVar + } + } + } + + return nil +} + +// StaticSiteUserInvitationRequestResourceProperties staticSiteUserInvitationRequestResource resource +// specific properties +type StaticSiteUserInvitationRequestResourceProperties struct { + // Domain - The domain name for the static site custom domain. + Domain *string `json:"domain,omitempty"` + // Provider - The identity provider for the static site user. + Provider *string `json:"provider,omitempty"` + // UserDetails - The user id for the static site user. + UserDetails *string `json:"userDetails,omitempty"` + // Roles - The roles for the static site user, in free-form string format + Roles *string `json:"roles,omitempty"` + // NumHoursToExpiration - The number of hours the sas token stays valid + NumHoursToExpiration *int32 `json:"numHoursToExpiration,omitempty"` +} + +// StaticSiteUserInvitationResponseResource static sites user roles invitation link resource. +type StaticSiteUserInvitationResponseResource struct { + autorest.Response `json:"-"` + // StaticSiteUserInvitationResponseResourceProperties - StaticSiteUserInvitationResponseResource resource specific properties + *StaticSiteUserInvitationResponseResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteUserInvitationResponseResource. +func (ssuirr StaticSiteUserInvitationResponseResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssuirr.StaticSiteUserInvitationResponseResourceProperties != nil { + objectMap["properties"] = ssuirr.StaticSiteUserInvitationResponseResourceProperties + } + if ssuirr.Kind != nil { + objectMap["kind"] = ssuirr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticSiteUserInvitationResponseResource struct. +func (ssuirr *StaticSiteUserInvitationResponseResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticSiteUserInvitationResponseResourceProperties StaticSiteUserInvitationResponseResourceProperties + err = json.Unmarshal(*v, &staticSiteUserInvitationResponseResourceProperties) + if err != nil { + return err + } + ssuirr.StaticSiteUserInvitationResponseResourceProperties = &staticSiteUserInvitationResponseResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ssuirr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ssuirr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ssuirr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ssuirr.Type = &typeVar + } + } + } + + return nil +} + +// StaticSiteUserInvitationResponseResourceProperties staticSiteUserInvitationResponseResource resource +// specific properties +type StaticSiteUserInvitationResponseResourceProperties struct { + // ExpiresOn - READ-ONLY; The expiration time of the invitation + ExpiresOn *date.Time `json:"expiresOn,omitempty"` + // InvitationURL - READ-ONLY; The url for the invitation link + InvitationURL *string `json:"invitationUrl,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteUserInvitationResponseResourceProperties. +func (ssuirr StaticSiteUserInvitationResponseResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// StaticSiteUserProvidedFunctionApp a static site user provided function. +type StaticSiteUserProvidedFunctionApp struct { + // StaticSiteUserProvidedFunctionAppProperties - StaticSiteUserProvidedFunctionApp resource specific properties + *StaticSiteUserProvidedFunctionAppProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteUserProvidedFunctionApp. +func (ssupfa StaticSiteUserProvidedFunctionApp) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssupfa.StaticSiteUserProvidedFunctionAppProperties != nil { + objectMap["properties"] = ssupfa.StaticSiteUserProvidedFunctionAppProperties + } + if ssupfa.Kind != nil { + objectMap["kind"] = ssupfa.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticSiteUserProvidedFunctionApp struct. +func (ssupfa *StaticSiteUserProvidedFunctionApp) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticSiteUserProvidedFunctionAppProperties StaticSiteUserProvidedFunctionAppProperties + err = json.Unmarshal(*v, &staticSiteUserProvidedFunctionAppProperties) + if err != nil { + return err + } + ssupfa.StaticSiteUserProvidedFunctionAppProperties = &staticSiteUserProvidedFunctionAppProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ssupfa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ssupfa.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ssupfa.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ssupfa.Type = &typeVar + } + } + } + + return nil +} + +// StaticSiteUserProvidedFunctionAppARMResource static Site User Provided Function App ARM resource. +type StaticSiteUserProvidedFunctionAppARMResource struct { + autorest.Response `json:"-"` + // StaticSiteUserProvidedFunctionAppARMResourceProperties - StaticSiteUserProvidedFunctionAppARMResource resource specific properties + *StaticSiteUserProvidedFunctionAppARMResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteUserProvidedFunctionAppARMResource. +func (ssupfaar StaticSiteUserProvidedFunctionAppARMResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssupfaar.StaticSiteUserProvidedFunctionAppARMResourceProperties != nil { + objectMap["properties"] = ssupfaar.StaticSiteUserProvidedFunctionAppARMResourceProperties + } + if ssupfaar.Kind != nil { + objectMap["kind"] = ssupfaar.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticSiteUserProvidedFunctionAppARMResource struct. +func (ssupfaar *StaticSiteUserProvidedFunctionAppARMResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticSiteUserProvidedFunctionAppARMResourceProperties StaticSiteUserProvidedFunctionAppARMResourceProperties + err = json.Unmarshal(*v, &staticSiteUserProvidedFunctionAppARMResourceProperties) + if err != nil { + return err + } + ssupfaar.StaticSiteUserProvidedFunctionAppARMResourceProperties = &staticSiteUserProvidedFunctionAppARMResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ssupfaar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ssupfaar.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ssupfaar.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ssupfaar.Type = &typeVar + } + } + } + + return nil +} + +// StaticSiteUserProvidedFunctionAppARMResourceProperties staticSiteUserProvidedFunctionAppARMResource +// resource specific properties +type StaticSiteUserProvidedFunctionAppARMResourceProperties struct { + // FunctionAppResourceID - The resource id of the function app registered with the static site + FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` + // FunctionAppRegion - The region of the function app registered with the static site + FunctionAppRegion *string `json:"functionAppRegion,omitempty"` + // CreatedOn - READ-ONLY; The date and time on which the function app was registered with the static site. + CreatedOn *date.Time `json:"createdOn,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteUserProvidedFunctionAppARMResourceProperties. +func (ssupfaar StaticSiteUserProvidedFunctionAppARMResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssupfaar.FunctionAppResourceID != nil { + objectMap["functionAppResourceId"] = ssupfaar.FunctionAppResourceID + } + if ssupfaar.FunctionAppRegion != nil { + objectMap["functionAppRegion"] = ssupfaar.FunctionAppRegion + } + return json.Marshal(objectMap) +} + +// StaticSiteUserProvidedFunctionAppProperties staticSiteUserProvidedFunctionApp resource specific +// properties +type StaticSiteUserProvidedFunctionAppProperties struct { + // FunctionAppResourceID - The resource id of the function app registered with the static site + FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` + // FunctionAppRegion - The region of the function app registered with the static site + FunctionAppRegion *string `json:"functionAppRegion,omitempty"` + // CreatedOn - READ-ONLY; The date and time on which the function app was registered with the static site. + CreatedOn *date.Time `json:"createdOn,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteUserProvidedFunctionAppProperties. +func (ssupfa StaticSiteUserProvidedFunctionAppProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssupfa.FunctionAppResourceID != nil { + objectMap["functionAppResourceId"] = ssupfa.FunctionAppResourceID + } + if ssupfa.FunctionAppRegion != nil { + objectMap["functionAppRegion"] = ssupfa.FunctionAppRegion + } + return json.Marshal(objectMap) +} + +// StaticSiteUserProvidedFunctionAppsCollection collection of static site user provided function apps. +type StaticSiteUserProvidedFunctionAppsCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]StaticSiteUserProvidedFunctionAppARMResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteUserProvidedFunctionAppsCollection. +func (ssupfac StaticSiteUserProvidedFunctionAppsCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssupfac.Value != nil { + objectMap["value"] = ssupfac.Value + } + return json.Marshal(objectMap) +} + +// StaticSiteUserProvidedFunctionAppsCollectionIterator provides access to a complete listing of +// StaticSiteUserProvidedFunctionAppARMResource values. +type StaticSiteUserProvidedFunctionAppsCollectionIterator struct { + i int + page StaticSiteUserProvidedFunctionAppsCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *StaticSiteUserProvidedFunctionAppsCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSiteUserProvidedFunctionAppsCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *StaticSiteUserProvidedFunctionAppsCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter StaticSiteUserProvidedFunctionAppsCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter StaticSiteUserProvidedFunctionAppsCollectionIterator) Response() StaticSiteUserProvidedFunctionAppsCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter StaticSiteUserProvidedFunctionAppsCollectionIterator) Value() StaticSiteUserProvidedFunctionAppARMResource { + if !iter.page.NotDone() { + return StaticSiteUserProvidedFunctionAppARMResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the StaticSiteUserProvidedFunctionAppsCollectionIterator type. +func NewStaticSiteUserProvidedFunctionAppsCollectionIterator(page StaticSiteUserProvidedFunctionAppsCollectionPage) StaticSiteUserProvidedFunctionAppsCollectionIterator { + return StaticSiteUserProvidedFunctionAppsCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ssupfac StaticSiteUserProvidedFunctionAppsCollection) IsEmpty() bool { + return ssupfac.Value == nil || len(*ssupfac.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ssupfac StaticSiteUserProvidedFunctionAppsCollection) hasNextLink() bool { + return ssupfac.NextLink != nil && len(*ssupfac.NextLink) != 0 +} + +// staticSiteUserProvidedFunctionAppsCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ssupfac StaticSiteUserProvidedFunctionAppsCollection) staticSiteUserProvidedFunctionAppsCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !ssupfac.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ssupfac.NextLink))) +} + +// StaticSiteUserProvidedFunctionAppsCollectionPage contains a page of +// StaticSiteUserProvidedFunctionAppARMResource values. +type StaticSiteUserProvidedFunctionAppsCollectionPage struct { + fn func(context.Context, StaticSiteUserProvidedFunctionAppsCollection) (StaticSiteUserProvidedFunctionAppsCollection, error) + ssupfac StaticSiteUserProvidedFunctionAppsCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *StaticSiteUserProvidedFunctionAppsCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSiteUserProvidedFunctionAppsCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ssupfac) + if err != nil { + return err + } + page.ssupfac = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *StaticSiteUserProvidedFunctionAppsCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page StaticSiteUserProvidedFunctionAppsCollectionPage) NotDone() bool { + return !page.ssupfac.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page StaticSiteUserProvidedFunctionAppsCollectionPage) Response() StaticSiteUserProvidedFunctionAppsCollection { + return page.ssupfac +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page StaticSiteUserProvidedFunctionAppsCollectionPage) Values() []StaticSiteUserProvidedFunctionAppARMResource { + if page.ssupfac.IsEmpty() { + return nil + } + return *page.ssupfac.Value +} + +// Creates a new instance of the StaticSiteUserProvidedFunctionAppsCollectionPage type. +func NewStaticSiteUserProvidedFunctionAppsCollectionPage(cur StaticSiteUserProvidedFunctionAppsCollection, getNextPage func(context.Context, StaticSiteUserProvidedFunctionAppsCollection) (StaticSiteUserProvidedFunctionAppsCollection, error)) StaticSiteUserProvidedFunctionAppsCollectionPage { + return StaticSiteUserProvidedFunctionAppsCollectionPage{ + fn: getNextPage, + ssupfac: cur, + } +} + +// StaticSiteZipDeployment a static site zip deployment. +type StaticSiteZipDeployment struct { + // AppZipURL - URL for the zipped app content + AppZipURL *string `json:"appZipUrl,omitempty"` + // APIZipURL - URL for the zipped api content + APIZipURL *string `json:"apiZipUrl,omitempty"` + // DeploymentTitle - A title to label the deployment + DeploymentTitle *string `json:"deploymentTitle,omitempty"` + // Provider - The provider submitting this deployment + Provider *string `json:"provider,omitempty"` + // FunctionLanguage - The language of the api content, if it exists + FunctionLanguage *string `json:"functionLanguage,omitempty"` +} + +// StaticSiteZipDeploymentARMResource static site zip deployment ARM resource. +type StaticSiteZipDeploymentARMResource struct { + // StaticSiteZipDeployment - Core resource properties + *StaticSiteZipDeployment `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticSiteZipDeploymentARMResource. +func (sszdar StaticSiteZipDeploymentARMResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sszdar.StaticSiteZipDeployment != nil { + objectMap["properties"] = sszdar.StaticSiteZipDeployment + } + if sszdar.Kind != nil { + objectMap["kind"] = sszdar.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticSiteZipDeploymentARMResource struct. +func (sszdar *StaticSiteZipDeploymentARMResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticSiteZipDeployment StaticSiteZipDeployment + err = json.Unmarshal(*v, &staticSiteZipDeployment) + if err != nil { + return err + } + sszdar.StaticSiteZipDeployment = &staticSiteZipDeployment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sszdar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sszdar.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sszdar.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sszdar.Type = &typeVar + } + } + } + + return nil +} + +// Status identify the status of the most severe insight generated by the detector. +type Status struct { + // Message - Descriptive message. + Message *string `json:"message,omitempty"` + // StatusID - Level of the most severe insight generated by the detector. Possible values include: 'InsightStatusCritical', 'InsightStatusWarning', 'InsightStatusInfo', 'InsightStatusSuccess', 'InsightStatusNone' + StatusID InsightStatus `json:"statusId,omitempty"` +} + +// StatusCodesBasedTrigger trigger based on status code. +type StatusCodesBasedTrigger struct { + // Status - HTTP status code. + Status *int32 `json:"status,omitempty"` + // SubStatus - Request Sub Status. + SubStatus *int32 `json:"subStatus,omitempty"` + // Win32Status - Win32 error code. + Win32Status *int32 `json:"win32Status,omitempty"` + // Count - Request Count. + Count *int32 `json:"count,omitempty"` + // TimeInterval - Time interval. + TimeInterval *string `json:"timeInterval,omitempty"` + // Path - Request Path + Path *string `json:"path,omitempty"` +} + +// StatusCodesRangeBasedTrigger trigger based on range of status codes. +type StatusCodesRangeBasedTrigger struct { + // StatusCodes - HTTP status code. + StatusCodes *string `json:"statusCodes,omitempty"` + Path *string `json:"path,omitempty"` + // Count - Request Count. + Count *int32 `json:"count,omitempty"` + // TimeInterval - Time interval. + TimeInterval *string `json:"timeInterval,omitempty"` +} + +// StorageMigrationOptions options for app content migration. +type StorageMigrationOptions struct { + // StorageMigrationOptionsProperties - StorageMigrationOptions resource specific properties + *StorageMigrationOptionsProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageMigrationOptions. +func (smo StorageMigrationOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if smo.StorageMigrationOptionsProperties != nil { + objectMap["properties"] = smo.StorageMigrationOptionsProperties + } + if smo.Kind != nil { + objectMap["kind"] = smo.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StorageMigrationOptions struct. +func (smo *StorageMigrationOptions) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var storageMigrationOptionsProperties StorageMigrationOptionsProperties + err = json.Unmarshal(*v, &storageMigrationOptionsProperties) + if err != nil { + return err + } + smo.StorageMigrationOptionsProperties = &storageMigrationOptionsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + smo.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + smo.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + smo.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + smo.Type = &typeVar + } + } + } + + return nil +} + +// StorageMigrationOptionsProperties storageMigrationOptions resource specific properties +type StorageMigrationOptionsProperties struct { + // AzurefilesConnectionString - AzureFiles connection string. + AzurefilesConnectionString *string `json:"azurefilesConnectionString,omitempty"` + // AzurefilesShare - AzureFiles share. + AzurefilesShare *string `json:"azurefilesShare,omitempty"` + // SwitchSiteAfterMigration - trueif the app should be switched over; otherwise, false. + SwitchSiteAfterMigration *bool `json:"switchSiteAfterMigration,omitempty"` + // BlockWriteAccessToSite - true if the app should be read only during copy operation; otherwise, false. + BlockWriteAccessToSite *bool `json:"blockWriteAccessToSite,omitempty"` +} + +// StorageMigrationResponse response for a migration of app content request. +type StorageMigrationResponse struct { + autorest.Response `json:"-"` + // StorageMigrationResponseProperties - StorageMigrationResponse resource specific properties + *StorageMigrationResponseProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageMigrationResponse. +func (smr StorageMigrationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if smr.StorageMigrationResponseProperties != nil { + objectMap["properties"] = smr.StorageMigrationResponseProperties + } + if smr.Kind != nil { + objectMap["kind"] = smr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StorageMigrationResponse struct. +func (smr *StorageMigrationResponse) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var storageMigrationResponseProperties StorageMigrationResponseProperties + err = json.Unmarshal(*v, &storageMigrationResponseProperties) + if err != nil { + return err + } + smr.StorageMigrationResponseProperties = &storageMigrationResponseProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + smr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + smr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + smr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + smr.Type = &typeVar + } + } + } + + return nil +} + +// StorageMigrationResponseProperties storageMigrationResponse resource specific properties +type StorageMigrationResponseProperties struct { + // OperationID - READ-ONLY; When server starts the migration process, it will return an operation ID identifying that particular migration operation. + OperationID *string `json:"operationId,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageMigrationResponseProperties. +func (smr StorageMigrationResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// String ... +type String struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` +} + +// StringDictionary string dictionary resource. +type StringDictionary struct { + autorest.Response `json:"-"` + // Properties - Settings. + Properties map[string]*string `json:"properties"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StringDictionary. +func (sd StringDictionary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sd.Properties != nil { + objectMap["properties"] = sd.Properties + } + if sd.Kind != nil { + objectMap["kind"] = sd.Kind + } + return json.Marshal(objectMap) +} + +// StringList string list resource. +type StringList struct { + autorest.Response `json:"-"` + // Properties - List of string resources. + Properties *[]string `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StringList. +func (sl StringList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sl.Properties != nil { + objectMap["properties"] = sl.Properties + } + if sl.Kind != nil { + objectMap["kind"] = sl.Kind + } + return json.Marshal(objectMap) +} + +// SupportTopic defines a unique Support Topic +type SupportTopic struct { + // ID - READ-ONLY; Support Topic Id + ID *string `json:"id,omitempty"` + // PesID - READ-ONLY; Unique resource Id + PesID *string `json:"pesId,omitempty"` +} + +// MarshalJSON is the custom marshaler for SupportTopic. +func (st SupportTopic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SwiftVirtualNetwork swift Virtual Network Contract. This is used to enable the new Swift way of doing +// virtual network integration. +type SwiftVirtualNetwork struct { + autorest.Response `json:"-"` + // SwiftVirtualNetworkProperties - SwiftVirtualNetwork resource specific properties + *SwiftVirtualNetworkProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SwiftVirtualNetwork. +func (svn SwiftVirtualNetwork) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if svn.SwiftVirtualNetworkProperties != nil { + objectMap["properties"] = svn.SwiftVirtualNetworkProperties + } + if svn.Kind != nil { + objectMap["kind"] = svn.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SwiftVirtualNetwork struct. +func (svn *SwiftVirtualNetwork) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var swiftVirtualNetworkProperties SwiftVirtualNetworkProperties + err = json.Unmarshal(*v, &swiftVirtualNetworkProperties) + if err != nil { + return err + } + svn.SwiftVirtualNetworkProperties = &swiftVirtualNetworkProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + svn.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + svn.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + svn.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + svn.Type = &typeVar + } + } + } + + return nil +} + +// SwiftVirtualNetworkProperties swiftVirtualNetwork resource specific properties +type SwiftVirtualNetworkProperties struct { + // SubnetResourceID - The Virtual Network subnet's resource ID. This is the subnet that this Web App will join. This subnet must have a delegation to Microsoft.Web/serverFarms defined first. + SubnetResourceID *string `json:"subnetResourceId,omitempty"` + // SwiftSupported - A flag that specifies if the scale unit this Web App is on supports Swift integration. + SwiftSupported *bool `json:"swiftSupported,omitempty"` +} + +// Template container App versioned application definition. +// Defines the desired state of an immutable revision. +// Any changes to this section Will result in a new revision being created +type Template struct { + // RevisionSuffix - User friendly suffix that is appended to the revision name + RevisionSuffix *string `json:"revisionSuffix,omitempty"` + // Containers - List of container definitions for the Container App. + Containers *[]Container `json:"containers,omitempty"` + // Scale - Scaling properties for the Container App. + Scale *Scale `json:"scale,omitempty"` + // Dapr - Dapr configuration for the Container App. + Dapr *Dapr `json:"dapr,omitempty"` +} + +// TldLegalAgreement legal agreement for a top level domain. +type TldLegalAgreement struct { + // AgreementKey - Unique identifier for the agreement. + AgreementKey *string `json:"agreementKey,omitempty"` + // Title - Agreement title. + Title *string `json:"title,omitempty"` + // Content - Agreement details. + Content *string `json:"content,omitempty"` + // URL - URL where a copy of the agreement details is hosted. + URL *string `json:"url,omitempty"` +} + +// TldLegalAgreementCollection collection of top-level domain legal agreements. +type TldLegalAgreementCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]TldLegalAgreement `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for TldLegalAgreementCollection. +func (tlac TldLegalAgreementCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tlac.Value != nil { + objectMap["value"] = tlac.Value + } + return json.Marshal(objectMap) +} + +// TldLegalAgreementCollectionIterator provides access to a complete listing of TldLegalAgreement values. +type TldLegalAgreementCollectionIterator struct { + i int + page TldLegalAgreementCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *TldLegalAgreementCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TldLegalAgreementCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *TldLegalAgreementCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TldLegalAgreementCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter TldLegalAgreementCollectionIterator) Response() TldLegalAgreementCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter TldLegalAgreementCollectionIterator) Value() TldLegalAgreement { + if !iter.page.NotDone() { + return TldLegalAgreement{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the TldLegalAgreementCollectionIterator type. +func NewTldLegalAgreementCollectionIterator(page TldLegalAgreementCollectionPage) TldLegalAgreementCollectionIterator { + return TldLegalAgreementCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (tlac TldLegalAgreementCollection) IsEmpty() bool { + return tlac.Value == nil || len(*tlac.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (tlac TldLegalAgreementCollection) hasNextLink() bool { + return tlac.NextLink != nil && len(*tlac.NextLink) != 0 +} + +// tldLegalAgreementCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (tlac TldLegalAgreementCollection) tldLegalAgreementCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !tlac.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(tlac.NextLink))) +} + +// TldLegalAgreementCollectionPage contains a page of TldLegalAgreement values. +type TldLegalAgreementCollectionPage struct { + fn func(context.Context, TldLegalAgreementCollection) (TldLegalAgreementCollection, error) + tlac TldLegalAgreementCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *TldLegalAgreementCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TldLegalAgreementCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.tlac) + if err != nil { + return err + } + page.tlac = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *TldLegalAgreementCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TldLegalAgreementCollectionPage) NotDone() bool { + return !page.tlac.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TldLegalAgreementCollectionPage) Response() TldLegalAgreementCollection { + return page.tlac +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TldLegalAgreementCollectionPage) Values() []TldLegalAgreement { + if page.tlac.IsEmpty() { + return nil + } + return *page.tlac.Value +} + +// Creates a new instance of the TldLegalAgreementCollectionPage type. +func NewTldLegalAgreementCollectionPage(cur TldLegalAgreementCollection, getNextPage func(context.Context, TldLegalAgreementCollection) (TldLegalAgreementCollection, error)) TldLegalAgreementCollectionPage { + return TldLegalAgreementCollectionPage{ + fn: getNextPage, + tlac: cur, + } +} + +// TokenStore the configuration settings of the token store. +type TokenStore struct { + // Enabled - true to durably store platform-specific security tokens that are obtained during login flows; otherwise, false. + // The default is false. + Enabled *bool `json:"enabled,omitempty"` + // TokenRefreshExtensionHours - The number of hours after session token expiration that a session token can be used to + // call the token refresh API. The default is 72 hours. + TokenRefreshExtensionHours *float64 `json:"tokenRefreshExtensionHours,omitempty"` + // FileSystem - The configuration settings of the storage of the tokens if a file system is used. + FileSystem *FileSystemTokenStore `json:"fileSystem,omitempty"` + // AzureBlobStorage - The configuration settings of the storage of the tokens if blob storage is used. + AzureBlobStorage *BlobStorageTokenStore `json:"azureBlobStorage,omitempty"` +} + +// TopLevelDomain a top level domain object. +type TopLevelDomain struct { + autorest.Response `json:"-"` + // TopLevelDomainProperties - TopLevelDomain resource specific properties + *TopLevelDomainProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TopLevelDomain. +func (tld TopLevelDomain) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tld.TopLevelDomainProperties != nil { + objectMap["properties"] = tld.TopLevelDomainProperties + } + if tld.Kind != nil { + objectMap["kind"] = tld.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TopLevelDomain struct. +func (tld *TopLevelDomain) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var topLevelDomainProperties TopLevelDomainProperties + err = json.Unmarshal(*v, &topLevelDomainProperties) + if err != nil { + return err + } + tld.TopLevelDomainProperties = &topLevelDomainProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + tld.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + tld.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + tld.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + tld.Type = &typeVar + } + } + } + + return nil +} + +// TopLevelDomainAgreementOption options for retrieving the list of top level domain legal agreements. +type TopLevelDomainAgreementOption struct { + // IncludePrivacy - If true, then the list of agreements will include agreements for domain privacy as well; otherwise, false. + IncludePrivacy *bool `json:"includePrivacy,omitempty"` + // ForTransfer - If true, then the list of agreements will include agreements for domain transfer as well; otherwise, false. + ForTransfer *bool `json:"forTransfer,omitempty"` +} + +// TopLevelDomainCollection collection of Top-level domains. +type TopLevelDomainCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]TopLevelDomain `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for TopLevelDomainCollection. +func (tldc TopLevelDomainCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tldc.Value != nil { + objectMap["value"] = tldc.Value + } + return json.Marshal(objectMap) +} + +// TopLevelDomainCollectionIterator provides access to a complete listing of TopLevelDomain values. +type TopLevelDomainCollectionIterator struct { + i int + page TopLevelDomainCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *TopLevelDomainCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopLevelDomainCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *TopLevelDomainCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TopLevelDomainCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter TopLevelDomainCollectionIterator) Response() TopLevelDomainCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter TopLevelDomainCollectionIterator) Value() TopLevelDomain { + if !iter.page.NotDone() { + return TopLevelDomain{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the TopLevelDomainCollectionIterator type. +func NewTopLevelDomainCollectionIterator(page TopLevelDomainCollectionPage) TopLevelDomainCollectionIterator { + return TopLevelDomainCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (tldc TopLevelDomainCollection) IsEmpty() bool { + return tldc.Value == nil || len(*tldc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (tldc TopLevelDomainCollection) hasNextLink() bool { + return tldc.NextLink != nil && len(*tldc.NextLink) != 0 +} + +// topLevelDomainCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (tldc TopLevelDomainCollection) topLevelDomainCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !tldc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(tldc.NextLink))) +} + +// TopLevelDomainCollectionPage contains a page of TopLevelDomain values. +type TopLevelDomainCollectionPage struct { + fn func(context.Context, TopLevelDomainCollection) (TopLevelDomainCollection, error) + tldc TopLevelDomainCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *TopLevelDomainCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopLevelDomainCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.tldc) + if err != nil { + return err + } + page.tldc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *TopLevelDomainCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TopLevelDomainCollectionPage) NotDone() bool { + return !page.tldc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TopLevelDomainCollectionPage) Response() TopLevelDomainCollection { + return page.tldc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TopLevelDomainCollectionPage) Values() []TopLevelDomain { + if page.tldc.IsEmpty() { + return nil + } + return *page.tldc.Value +} + +// Creates a new instance of the TopLevelDomainCollectionPage type. +func NewTopLevelDomainCollectionPage(cur TopLevelDomainCollection, getNextPage func(context.Context, TopLevelDomainCollection) (TopLevelDomainCollection, error)) TopLevelDomainCollectionPage { + return TopLevelDomainCollectionPage{ + fn: getNextPage, + tldc: cur, + } +} + +// TopLevelDomainProperties topLevelDomain resource specific properties +type TopLevelDomainProperties struct { + // Privacy - If true, then the top level domain supports domain privacy; otherwise, false. + Privacy *bool `json:"privacy,omitempty"` +} + +// TrafficWeight traffic weight assigned to a revision +type TrafficWeight struct { + // RevisionName - Name of a revision + RevisionName *string `json:"revisionName,omitempty"` + // Weight - Traffic weight assigned to a revision + Weight *int32 `json:"weight,omitempty"` + // LatestRevision - Indicates that the traffic weight belongs to a latest stable revision + LatestRevision *bool `json:"latestRevision,omitempty"` +} + +// TriggeredJobHistory triggered Web Job History. List of Triggered Web Job Run Information elements. +type TriggeredJobHistory struct { + autorest.Response `json:"-"` + // TriggeredJobHistoryProperties - TriggeredJobHistory resource specific properties + *TriggeredJobHistoryProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TriggeredJobHistory. +func (tjh TriggeredJobHistory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tjh.TriggeredJobHistoryProperties != nil { + objectMap["properties"] = tjh.TriggeredJobHistoryProperties + } + if tjh.Kind != nil { + objectMap["kind"] = tjh.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TriggeredJobHistory struct. +func (tjh *TriggeredJobHistory) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var triggeredJobHistoryProperties TriggeredJobHistoryProperties + err = json.Unmarshal(*v, &triggeredJobHistoryProperties) + if err != nil { + return err + } + tjh.TriggeredJobHistoryProperties = &triggeredJobHistoryProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + tjh.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + tjh.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + tjh.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + tjh.Type = &typeVar + } + } + } + + return nil +} + +// TriggeredJobHistoryCollection collection of Kudu continuous web job information elements. +type TriggeredJobHistoryCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]TriggeredJobHistory `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for TriggeredJobHistoryCollection. +func (tjhc TriggeredJobHistoryCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tjhc.Value != nil { + objectMap["value"] = tjhc.Value + } + return json.Marshal(objectMap) +} + +// TriggeredJobHistoryCollectionIterator provides access to a complete listing of TriggeredJobHistory +// values. +type TriggeredJobHistoryCollectionIterator struct { + i int + page TriggeredJobHistoryCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *TriggeredJobHistoryCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TriggeredJobHistoryCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *TriggeredJobHistoryCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TriggeredJobHistoryCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter TriggeredJobHistoryCollectionIterator) Response() TriggeredJobHistoryCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter TriggeredJobHistoryCollectionIterator) Value() TriggeredJobHistory { + if !iter.page.NotDone() { + return TriggeredJobHistory{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the TriggeredJobHistoryCollectionIterator type. +func NewTriggeredJobHistoryCollectionIterator(page TriggeredJobHistoryCollectionPage) TriggeredJobHistoryCollectionIterator { + return TriggeredJobHistoryCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (tjhc TriggeredJobHistoryCollection) IsEmpty() bool { + return tjhc.Value == nil || len(*tjhc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (tjhc TriggeredJobHistoryCollection) hasNextLink() bool { + return tjhc.NextLink != nil && len(*tjhc.NextLink) != 0 +} + +// triggeredJobHistoryCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (tjhc TriggeredJobHistoryCollection) triggeredJobHistoryCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !tjhc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(tjhc.NextLink))) +} + +// TriggeredJobHistoryCollectionPage contains a page of TriggeredJobHistory values. +type TriggeredJobHistoryCollectionPage struct { + fn func(context.Context, TriggeredJobHistoryCollection) (TriggeredJobHistoryCollection, error) + tjhc TriggeredJobHistoryCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *TriggeredJobHistoryCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TriggeredJobHistoryCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.tjhc) + if err != nil { + return err + } + page.tjhc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *TriggeredJobHistoryCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TriggeredJobHistoryCollectionPage) NotDone() bool { + return !page.tjhc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TriggeredJobHistoryCollectionPage) Response() TriggeredJobHistoryCollection { + return page.tjhc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TriggeredJobHistoryCollectionPage) Values() []TriggeredJobHistory { + if page.tjhc.IsEmpty() { + return nil + } + return *page.tjhc.Value +} + +// Creates a new instance of the TriggeredJobHistoryCollectionPage type. +func NewTriggeredJobHistoryCollectionPage(cur TriggeredJobHistoryCollection, getNextPage func(context.Context, TriggeredJobHistoryCollection) (TriggeredJobHistoryCollection, error)) TriggeredJobHistoryCollectionPage { + return TriggeredJobHistoryCollectionPage{ + fn: getNextPage, + tjhc: cur, + } +} + +// TriggeredJobHistoryProperties triggeredJobHistory resource specific properties +type TriggeredJobHistoryProperties struct { + // Runs - List of triggered web job runs. + Runs *[]TriggeredJobRun `json:"runs,omitempty"` +} + +// TriggeredJobRun triggered Web Job Run Information. +type TriggeredJobRun struct { + // WebJobID - Job ID. + WebJobID *string `json:"web_job_id,omitempty"` + // WebJobName - Job name. + WebJobName *string `json:"web_job_name,omitempty"` + // Status - Job status. Possible values include: 'TriggeredWebJobStatusSuccess', 'TriggeredWebJobStatusFailed', 'TriggeredWebJobStatusError' + Status TriggeredWebJobStatus `json:"status,omitempty"` + // StartTime - Start time. + StartTime *date.Time `json:"start_time,omitempty"` + // EndTime - End time. + EndTime *date.Time `json:"end_time,omitempty"` + // Duration - Job duration. + Duration *string `json:"duration,omitempty"` + // OutputURL - Output URL. + OutputURL *string `json:"output_url,omitempty"` + // ErrorURL - Error URL. + ErrorURL *string `json:"error_url,omitempty"` + // URL - Job URL. + URL *string `json:"url,omitempty"` + // JobName - Job name. + JobName *string `json:"job_name,omitempty"` + // Trigger - Job trigger. + Trigger *string `json:"trigger,omitempty"` +} + +// TriggeredWebJob triggered Web Job Information. +type TriggeredWebJob struct { + autorest.Response `json:"-"` + // TriggeredWebJobProperties - TriggeredWebJob resource specific properties + *TriggeredWebJobProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TriggeredWebJob. +func (twj TriggeredWebJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if twj.TriggeredWebJobProperties != nil { + objectMap["properties"] = twj.TriggeredWebJobProperties + } + if twj.Kind != nil { + objectMap["kind"] = twj.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TriggeredWebJob struct. +func (twj *TriggeredWebJob) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var triggeredWebJobProperties TriggeredWebJobProperties + err = json.Unmarshal(*v, &triggeredWebJobProperties) + if err != nil { + return err + } + twj.TriggeredWebJobProperties = &triggeredWebJobProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + twj.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + twj.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + twj.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + twj.Type = &typeVar + } + } + } + + return nil +} + +// TriggeredWebJobCollection collection of Kudu continuous web job information elements. +type TriggeredWebJobCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]TriggeredWebJob `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for TriggeredWebJobCollection. +func (twjc TriggeredWebJobCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if twjc.Value != nil { + objectMap["value"] = twjc.Value + } + return json.Marshal(objectMap) +} + +// TriggeredWebJobCollectionIterator provides access to a complete listing of TriggeredWebJob values. +type TriggeredWebJobCollectionIterator struct { + i int + page TriggeredWebJobCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *TriggeredWebJobCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TriggeredWebJobCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *TriggeredWebJobCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TriggeredWebJobCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter TriggeredWebJobCollectionIterator) Response() TriggeredWebJobCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter TriggeredWebJobCollectionIterator) Value() TriggeredWebJob { + if !iter.page.NotDone() { + return TriggeredWebJob{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the TriggeredWebJobCollectionIterator type. +func NewTriggeredWebJobCollectionIterator(page TriggeredWebJobCollectionPage) TriggeredWebJobCollectionIterator { + return TriggeredWebJobCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (twjc TriggeredWebJobCollection) IsEmpty() bool { + return twjc.Value == nil || len(*twjc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (twjc TriggeredWebJobCollection) hasNextLink() bool { + return twjc.NextLink != nil && len(*twjc.NextLink) != 0 +} + +// triggeredWebJobCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (twjc TriggeredWebJobCollection) triggeredWebJobCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !twjc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(twjc.NextLink))) +} + +// TriggeredWebJobCollectionPage contains a page of TriggeredWebJob values. +type TriggeredWebJobCollectionPage struct { + fn func(context.Context, TriggeredWebJobCollection) (TriggeredWebJobCollection, error) + twjc TriggeredWebJobCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *TriggeredWebJobCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TriggeredWebJobCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.twjc) + if err != nil { + return err + } + page.twjc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *TriggeredWebJobCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TriggeredWebJobCollectionPage) NotDone() bool { + return !page.twjc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TriggeredWebJobCollectionPage) Response() TriggeredWebJobCollection { + return page.twjc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TriggeredWebJobCollectionPage) Values() []TriggeredWebJob { + if page.twjc.IsEmpty() { + return nil + } + return *page.twjc.Value +} + +// Creates a new instance of the TriggeredWebJobCollectionPage type. +func NewTriggeredWebJobCollectionPage(cur TriggeredWebJobCollection, getNextPage func(context.Context, TriggeredWebJobCollection) (TriggeredWebJobCollection, error)) TriggeredWebJobCollectionPage { + return TriggeredWebJobCollectionPage{ + fn: getNextPage, + twjc: cur, + } +} + +// TriggeredWebJobProperties triggeredWebJob resource specific properties +type TriggeredWebJobProperties struct { + // LatestRun - Latest job run information. + LatestRun *TriggeredJobRun `json:"latest_run,omitempty"` + // HistoryURL - History URL. + HistoryURL *string `json:"history_url,omitempty"` + // SchedulerLogsURL - Scheduler Logs URL. + SchedulerLogsURL *string `json:"scheduler_logs_url,omitempty"` + // RunCommand - Run command. + RunCommand *string `json:"run_command,omitempty"` + // URL - Job URL. + URL *string `json:"url,omitempty"` + // ExtraInfoURL - Extra Info URL. + ExtraInfoURL *string `json:"extra_info_url,omitempty"` + // WebJobType - Job type. Possible values include: 'JobTypeContinuous', 'JobTypeTriggered' + WebJobType JobType `json:"web_job_type,omitempty"` + // Error - Error information. + Error *string `json:"error,omitempty"` + // UsingSdk - Using SDK? + UsingSdk *bool `json:"using_sdk,omitempty"` + // Settings - Job settings. + Settings map[string]interface{} `json:"settings"` +} + +// MarshalJSON is the custom marshaler for TriggeredWebJobProperties. +func (twj TriggeredWebJobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if twj.LatestRun != nil { + objectMap["latest_run"] = twj.LatestRun + } + if twj.HistoryURL != nil { + objectMap["history_url"] = twj.HistoryURL + } + if twj.SchedulerLogsURL != nil { + objectMap["scheduler_logs_url"] = twj.SchedulerLogsURL + } + if twj.RunCommand != nil { + objectMap["run_command"] = twj.RunCommand + } + if twj.URL != nil { + objectMap["url"] = twj.URL + } + if twj.ExtraInfoURL != nil { + objectMap["extra_info_url"] = twj.ExtraInfoURL + } + if twj.WebJobType != "" { + objectMap["web_job_type"] = twj.WebJobType + } + if twj.Error != nil { + objectMap["error"] = twj.Error + } + if twj.UsingSdk != nil { + objectMap["using_sdk"] = twj.UsingSdk + } + if twj.Settings != nil { + objectMap["settings"] = twj.Settings + } + return json.Marshal(objectMap) +} + +// Twitter the configuration settings of the Twitter provider. +type Twitter struct { + // Enabled - false if the Twitter provider should not be enabled despite the set registration; otherwise, true. + Enabled *bool `json:"enabled,omitempty"` + // Registration - The configuration settings of the app registration for the Twitter provider. + Registration *TwitterRegistration `json:"registration,omitempty"` +} + +// TwitterRegistration the configuration settings of the app registration for the Twitter provider. +type TwitterRegistration struct { + // ConsumerKey - The OAuth 1.0a consumer key of the Twitter application used for sign-in. + // This setting is required for enabling Twitter Sign-In. + // Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in + ConsumerKey *string `json:"consumerKey,omitempty"` + // ConsumerSecretSettingName - The app setting name that contains the OAuth 1.0a consumer secret of the Twitter + // application used for sign-in. + ConsumerSecretSettingName *string `json:"consumerSecretSettingName,omitempty"` +} + +// Usage usage of the quota resource. +type Usage struct { + // UsageProperties - Usage resource specific properties + *UsageProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Usage. +func (u Usage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if u.UsageProperties != nil { + objectMap["properties"] = u.UsageProperties + } + if u.Kind != nil { + objectMap["kind"] = u.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Usage struct. +func (u *Usage) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var usageProperties UsageProperties + err = json.Unmarshal(*v, &usageProperties) + if err != nil { + return err + } + u.UsageProperties = &usageProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + u.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + u.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + u.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + u.Type = &typeVar + } + } + } + + return nil +} + +// UsageCollection collection of usages. +type UsageCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]Usage `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for UsageCollection. +func (uc UsageCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if uc.Value != nil { + objectMap["value"] = uc.Value + } + return json.Marshal(objectMap) +} + +// UsageCollectionIterator provides access to a complete listing of Usage values. +type UsageCollectionIterator struct { + i int + page UsageCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *UsageCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsageCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *UsageCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter UsageCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter UsageCollectionIterator) Response() UsageCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter UsageCollectionIterator) Value() Usage { + if !iter.page.NotDone() { + return Usage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the UsageCollectionIterator type. +func NewUsageCollectionIterator(page UsageCollectionPage) UsageCollectionIterator { + return UsageCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (uc UsageCollection) IsEmpty() bool { + return uc.Value == nil || len(*uc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (uc UsageCollection) hasNextLink() bool { + return uc.NextLink != nil && len(*uc.NextLink) != 0 +} + +// usageCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (uc UsageCollection) usageCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !uc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(uc.NextLink))) +} + +// UsageCollectionPage contains a page of Usage values. +type UsageCollectionPage struct { + fn func(context.Context, UsageCollection) (UsageCollection, error) + uc UsageCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *UsageCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsageCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.uc) + if err != nil { + return err + } + page.uc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *UsageCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page UsageCollectionPage) NotDone() bool { + return !page.uc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page UsageCollectionPage) Response() UsageCollection { + return page.uc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page UsageCollectionPage) Values() []Usage { + if page.uc.IsEmpty() { + return nil + } + return *page.uc.Value +} + +// Creates a new instance of the UsageCollectionPage type. +func NewUsageCollectionPage(cur UsageCollection, getNextPage func(context.Context, UsageCollection) (UsageCollection, error)) UsageCollectionPage { + return UsageCollectionPage{ + fn: getNextPage, + uc: cur, + } +} + +// UsageProperties usage resource specific properties +type UsageProperties struct { + // DisplayName - READ-ONLY; Friendly name shown in the UI. + DisplayName *string `json:"displayName,omitempty"` + // ResourceName - READ-ONLY; Name of the quota resource. + ResourceName *string `json:"resourceName,omitempty"` + // Unit - READ-ONLY; Units of measurement for the quota resource. + Unit *string `json:"unit,omitempty"` + // CurrentValue - READ-ONLY; The current value of the resource counter. + CurrentValue *int64 `json:"currentValue,omitempty"` + // Limit - READ-ONLY; The resource limit. + Limit *int64 `json:"limit,omitempty"` + // NextResetTime - READ-ONLY; Next reset time for the resource counter. + NextResetTime *date.Time `json:"nextResetTime,omitempty"` + // ComputeMode - READ-ONLY; Compute mode used for this usage. Possible values include: 'ComputeModeOptionsShared', 'ComputeModeOptionsDedicated', 'ComputeModeOptionsDynamic' + ComputeMode ComputeModeOptions `json:"computeMode,omitempty"` + // SiteMode - READ-ONLY; Site mode used for this usage. + SiteMode *string `json:"siteMode,omitempty"` +} + +// MarshalJSON is the custom marshaler for UsageProperties. +func (u UsageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// User user credentials used for publishing activity. +type User struct { + autorest.Response `json:"-"` + // UserProperties - User resource specific properties + *UserProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for User. +func (u User) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if u.UserProperties != nil { + objectMap["properties"] = u.UserProperties + } + if u.Kind != nil { + objectMap["kind"] = u.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for User struct. +func (u *User) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var userProperties UserProperties + err = json.Unmarshal(*v, &userProperties) + if err != nil { + return err + } + u.UserProperties = &userProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + u.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + u.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + u.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + u.Type = &typeVar + } + } + } + + return nil +} + +// UserAssignedIdentity user Assigned identity. +type UserAssignedIdentity struct { + // PrincipalID - READ-ONLY; Principal Id of user assigned identity + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; Client Id of user assigned identity + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserAssignedIdentity. +func (uai UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UserProperties user resource specific properties +type UserProperties struct { + // PublishingUserName - Username used for publishing. + PublishingUserName *string `json:"publishingUserName,omitempty"` + // PublishingPassword - Password used for publishing. + PublishingPassword *string `json:"publishingPassword,omitempty"` + // PublishingPasswordHash - Password hash used for publishing. + PublishingPasswordHash *string `json:"publishingPasswordHash,omitempty"` + // PublishingPasswordHashSalt - Password hash salt used for publishing. + PublishingPasswordHashSalt *string `json:"publishingPasswordHashSalt,omitempty"` + // ScmURI - Url of SCM site. + ScmURI *string `json:"scmUri,omitempty"` +} + +// ValidateProperties app properties used for validation. +type ValidateProperties struct { + // ServerFarmID - ARM resource ID of an App Service plan that would host the app. + ServerFarmID *string `json:"serverFarmId,omitempty"` + // SkuName - Name of the target SKU for the App Service plan. + SkuName *string `json:"skuName,omitempty"` + // NeedLinuxWorkers - true if App Service plan is for Linux workers; otherwise, false. + NeedLinuxWorkers *bool `json:"needLinuxWorkers,omitempty"` + // IsSpot - true if App Service plan is for Spot instances; otherwise, false. + IsSpot *bool `json:"isSpot,omitempty"` + // Capacity - Target capacity of the App Service plan (number of VMs). + Capacity *int32 `json:"capacity,omitempty"` + // HostingEnvironment - Name of App Service Environment where app or App Service plan should be created. + HostingEnvironment *string `json:"hostingEnvironment,omitempty"` + // IsXenon - true if App Service plan is running as a windows container + IsXenon *bool `json:"isXenon,omitempty"` + // ContainerRegistryBaseURL - Base URL of the container registry + ContainerRegistryBaseURL *string `json:"containerRegistryBaseUrl,omitempty"` + // ContainerRegistryUsername - Username for to access the container registry + ContainerRegistryUsername *string `json:"containerRegistryUsername,omitempty"` + // ContainerRegistryPassword - Password for to access the container registry + ContainerRegistryPassword *string `json:"containerRegistryPassword,omitempty"` + // ContainerImageRepository - Repository name (image name) + ContainerImageRepository *string `json:"containerImageRepository,omitempty"` + // ContainerImageTag - Image tag + ContainerImageTag *string `json:"containerImageTag,omitempty"` + // ContainerImagePlatform - Platform (windows or linux) + ContainerImagePlatform *string `json:"containerImagePlatform,omitempty"` + // AppServiceEnvironment - App Service Environment Properties + AppServiceEnvironment *AppServiceEnvironment `json:"appServiceEnvironment,omitempty"` +} + +// ValidateRequest resource validation request content. +type ValidateRequest struct { + // Name - Resource name to verify. + Name *string `json:"name,omitempty"` + // Type - Resource type used for verification. Possible values include: 'ValidateResourceTypesServerFarm', 'ValidateResourceTypesSite', 'ValidateResourceTypesMicrosoftWebhostingEnvironments' + Type ValidateResourceTypes `json:"type,omitempty"` + // Location - Expected location of the resource. + Location *string `json:"location,omitempty"` + // ValidateProperties - Properties of the resource to validate. + *ValidateProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ValidateRequest. +func (vr ValidateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vr.Name != nil { + objectMap["name"] = vr.Name + } + if vr.Type != "" { + objectMap["type"] = vr.Type + } + if vr.Location != nil { + objectMap["location"] = vr.Location + } + if vr.ValidateProperties != nil { + objectMap["properties"] = vr.ValidateProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ValidateRequest struct. +func (vr *ValidateRequest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vr.Name = &name + } + case "type": + if v != nil { + var typeVar ValidateResourceTypes + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vr.Type = typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vr.Location = &location + } + case "properties": + if v != nil { + var validateProperties ValidateProperties + err = json.Unmarshal(*v, &validateProperties) + if err != nil { + return err + } + vr.ValidateProperties = &validateProperties + } + } + } + + return nil +} + +// ValidateResponse describes the result of resource validation. +type ValidateResponse struct { + autorest.Response `json:"-"` + // Status - Result of validation. + Status *string `json:"status,omitempty"` + // Error - Error details for the case when validation fails. + Error *ValidateResponseError `json:"error,omitempty"` +} + +// ValidateResponseError error details for when validation fails. +type ValidateResponseError struct { + // Code - Validation error code. + Code *string `json:"code,omitempty"` + // Message - Validation error message. + Message *string `json:"message,omitempty"` +} + +// VirtualApplication virtual application in an app. +type VirtualApplication struct { + // VirtualPath - Virtual path. + VirtualPath *string `json:"virtualPath,omitempty"` + // PhysicalPath - Physical path. + PhysicalPath *string `json:"physicalPath,omitempty"` + // PreloadEnabled - true if preloading is enabled; otherwise, false. + PreloadEnabled *bool `json:"preloadEnabled,omitempty"` + // VirtualDirectories - Virtual directories for virtual application. + VirtualDirectories *[]VirtualDirectory `json:"virtualDirectories,omitempty"` +} + +// VirtualDirectory directory for virtual application. +type VirtualDirectory struct { + // VirtualPath - Path to virtual application. + VirtualPath *string `json:"virtualPath,omitempty"` + // PhysicalPath - Physical path. + PhysicalPath *string `json:"physicalPath,omitempty"` +} + +// VirtualIPMapping virtual IP mapping. +type VirtualIPMapping struct { + // VirtualIP - Virtual IP address. + VirtualIP *string `json:"virtualIP,omitempty"` + // InternalHTTPPort - Internal HTTP port. + InternalHTTPPort *int32 `json:"internalHttpPort,omitempty"` + // InternalHTTPSPort - Internal HTTPS port. + InternalHTTPSPort *int32 `json:"internalHttpsPort,omitempty"` + // InUse - Is virtual IP mapping in use. + InUse *bool `json:"inUse,omitempty"` + // ServiceName - name of the service that virtual IP is assigned to + ServiceName *string `json:"serviceName,omitempty"` +} + +// VirtualNetworkProfile specification for using a Virtual Network. +type VirtualNetworkProfile struct { + // ID - Resource id of the Virtual Network. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the Virtual Network (read-only). + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type of the Virtual Network (read-only). + Type *string `json:"type,omitempty"` + // Subnet - Subnet within the Virtual Network. + Subnet *string `json:"subnet,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkProfile. +func (vnp VirtualNetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnp.ID != nil { + objectMap["id"] = vnp.ID + } + if vnp.Subnet != nil { + objectMap["subnet"] = vnp.Subnet + } + return json.Marshal(objectMap) +} + +// VnetGateway the Virtual Network gateway contract. This is used to give the Virtual Network gateway +// access to the VPN package. +type VnetGateway struct { + autorest.Response `json:"-"` + // VnetGatewayProperties - VnetGateway resource specific properties + *VnetGatewayProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VnetGateway. +func (vg VnetGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vg.VnetGatewayProperties != nil { + objectMap["properties"] = vg.VnetGatewayProperties + } + if vg.Kind != nil { + objectMap["kind"] = vg.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VnetGateway struct. +func (vg *VnetGateway) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vnetGatewayProperties VnetGatewayProperties + err = json.Unmarshal(*v, &vnetGatewayProperties) + if err != nil { + return err + } + vg.VnetGatewayProperties = &vnetGatewayProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vg.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + vg.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vg.Type = &typeVar + } + } + } + + return nil +} + +// VnetGatewayProperties vnetGateway resource specific properties +type VnetGatewayProperties struct { + // VnetName - The Virtual Network name. + VnetName *string `json:"vnetName,omitempty"` + // VpnPackageURI - The URI where the VPN package can be downloaded. + VpnPackageURI *string `json:"vpnPackageUri,omitempty"` +} + +// VnetInfo virtual Network information contract. +type VnetInfo struct { + // VnetResourceID - The Virtual Network's resource ID. + VnetResourceID *string `json:"vnetResourceId,omitempty"` + // CertThumbprint - READ-ONLY; The client certificate thumbprint. + CertThumbprint *string `json:"certThumbprint,omitempty"` + // CertBlob - A certificate file (.cer) blob containing the public key of the private key used to authenticate a + // Point-To-Site VPN connection. + CertBlob *string `json:"certBlob,omitempty"` + // Routes - READ-ONLY; The routes that this Virtual Network connection uses. + Routes *[]VnetRoute `json:"routes,omitempty"` + // ResyncRequired - READ-ONLY; true if a resync is required; otherwise, false. + ResyncRequired *bool `json:"resyncRequired,omitempty"` + // DNSServers - DNS servers to be used by this Virtual Network. This should be a comma-separated list of IP addresses. + DNSServers *string `json:"dnsServers,omitempty"` + // IsSwift - Flag that is used to denote if this is VNET injection + IsSwift *bool `json:"isSwift,omitempty"` +} + +// MarshalJSON is the custom marshaler for VnetInfo. +func (vi VnetInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vi.VnetResourceID != nil { + objectMap["vnetResourceId"] = vi.VnetResourceID + } + if vi.CertBlob != nil { + objectMap["certBlob"] = vi.CertBlob + } + if vi.DNSServers != nil { + objectMap["dnsServers"] = vi.DNSServers + } + if vi.IsSwift != nil { + objectMap["isSwift"] = vi.IsSwift + } + return json.Marshal(objectMap) +} + +// VnetInfoResource virtual Network information ARM resource. +type VnetInfoResource struct { + autorest.Response `json:"-"` + // VnetInfo - Core resource properties + *VnetInfo `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VnetInfoResource. +func (vir VnetInfoResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vir.VnetInfo != nil { + objectMap["properties"] = vir.VnetInfo + } + if vir.Kind != nil { + objectMap["kind"] = vir.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VnetInfoResource struct. +func (vir *VnetInfoResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vnetInfo VnetInfo + err = json.Unmarshal(*v, &vnetInfo) + if err != nil { + return err + } + vir.VnetInfo = &vnetInfo + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vir.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vir.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + vir.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vir.Type = &typeVar + } + } + } + + return nil +} + +// VnetParameters the required set of inputs to validate a VNET +type VnetParameters struct { + // VnetParametersProperties - VnetParameters resource specific properties + *VnetParametersProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VnetParameters. +func (vp VnetParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vp.VnetParametersProperties != nil { + objectMap["properties"] = vp.VnetParametersProperties + } + if vp.Kind != nil { + objectMap["kind"] = vp.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VnetParameters struct. +func (vp *VnetParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vnetParametersProperties VnetParametersProperties + err = json.Unmarshal(*v, &vnetParametersProperties) + if err != nil { + return err + } + vp.VnetParametersProperties = &vnetParametersProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vp.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + vp.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vp.Type = &typeVar + } + } + } + + return nil +} + +// VnetParametersProperties vnetParameters resource specific properties +type VnetParametersProperties struct { + // VnetResourceGroup - The Resource Group of the VNET to be validated + VnetResourceGroup *string `json:"vnetResourceGroup,omitempty"` + // VnetName - The name of the VNET to be validated + VnetName *string `json:"vnetName,omitempty"` + // VnetSubnetName - The subnet name to be validated + VnetSubnetName *string `json:"vnetSubnetName,omitempty"` + // SubnetResourceID - The ARM Resource ID of the subnet to validate + SubnetResourceID *string `json:"subnetResourceId,omitempty"` +} + +// VnetRoute virtual Network route contract used to pass routing information for a Virtual Network. +type VnetRoute struct { + autorest.Response `json:"-"` + // VnetRouteProperties - VnetRoute resource specific properties + *VnetRouteProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VnetRoute. +func (vr VnetRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vr.VnetRouteProperties != nil { + objectMap["properties"] = vr.VnetRouteProperties + } + if vr.Kind != nil { + objectMap["kind"] = vr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VnetRoute struct. +func (vr *VnetRoute) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vnetRouteProperties VnetRouteProperties + err = json.Unmarshal(*v, &vnetRouteProperties) + if err != nil { + return err + } + vr.VnetRouteProperties = &vnetRouteProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + vr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vr.Type = &typeVar + } + } + } + + return nil +} + +// VnetRouteProperties vnetRoute resource specific properties +type VnetRouteProperties struct { + // StartAddress - The starting address for this route. This may also include a CIDR notation, in which case the end address must not be specified. + StartAddress *string `json:"startAddress,omitempty"` + // EndAddress - The ending address for this route. If the start address is specified in CIDR notation, this must be omitted. + EndAddress *string `json:"endAddress,omitempty"` + // RouteType - The type of route this is: + // DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 + // INHERITED - Routes inherited from the real Virtual Network routes + // STATIC - Static route set on the app only + // These values will be used for syncing an app's routes with those from a Virtual Network. Possible values include: 'RouteTypeDEFAULT', 'RouteTypeINHERITED', 'RouteTypeSTATIC' + RouteType RouteType `json:"routeType,omitempty"` +} + +// VnetValidationFailureDetails a class that describes the reason for a validation failure. +type VnetValidationFailureDetails struct { + autorest.Response `json:"-"` + // VnetValidationFailureDetailsProperties - VnetValidationFailureDetails resource specific properties + *VnetValidationFailureDetailsProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VnetValidationFailureDetails. +func (vvfd VnetValidationFailureDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vvfd.VnetValidationFailureDetailsProperties != nil { + objectMap["properties"] = vvfd.VnetValidationFailureDetailsProperties + } + if vvfd.Kind != nil { + objectMap["kind"] = vvfd.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VnetValidationFailureDetails struct. +func (vvfd *VnetValidationFailureDetails) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vnetValidationFailureDetailsProperties VnetValidationFailureDetailsProperties + err = json.Unmarshal(*v, &vnetValidationFailureDetailsProperties) + if err != nil { + return err + } + vvfd.VnetValidationFailureDetailsProperties = &vnetValidationFailureDetailsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vvfd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vvfd.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + vvfd.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vvfd.Type = &typeVar + } + } + } + + return nil +} + +// VnetValidationFailureDetailsProperties vnetValidationFailureDetails resource specific properties +type VnetValidationFailureDetailsProperties struct { + // Message - Text describing the validation outcome. + Message *string `json:"message,omitempty"` + // Failed - A flag describing whether or not validation failed. + Failed *bool `json:"failed,omitempty"` + // FailedTests - A list of tests that failed in the validation. + FailedTests *[]VnetValidationTestFailure `json:"failedTests,omitempty"` + // Warnings - A list of warnings generated during validation. + Warnings *[]VnetValidationTestFailure `json:"warnings,omitempty"` +} + +// VnetValidationTestFailure a class that describes a test that failed during NSG and UDR validation. +type VnetValidationTestFailure struct { + // VnetValidationTestFailureProperties - VnetValidationTestFailure resource specific properties + *VnetValidationTestFailureProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VnetValidationTestFailure. +func (vvtf VnetValidationTestFailure) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vvtf.VnetValidationTestFailureProperties != nil { + objectMap["properties"] = vvtf.VnetValidationTestFailureProperties + } + if vvtf.Kind != nil { + objectMap["kind"] = vvtf.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VnetValidationTestFailure struct. +func (vvtf *VnetValidationTestFailure) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vnetValidationTestFailureProperties VnetValidationTestFailureProperties + err = json.Unmarshal(*v, &vnetValidationTestFailureProperties) + if err != nil { + return err + } + vvtf.VnetValidationTestFailureProperties = &vnetValidationTestFailureProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vvtf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vvtf.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + vvtf.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vvtf.Type = &typeVar + } + } + } + + return nil +} + +// VnetValidationTestFailureProperties vnetValidationTestFailure resource specific properties +type VnetValidationTestFailureProperties struct { + // TestName - The name of the test that failed. + TestName *string `json:"testName,omitempty"` + // Details - The details of what caused the failure, e.g. the blocking rule name, etc. + Details *string `json:"details,omitempty"` +} + +// WindowsJavaContainerSettings windows Java Container settings. +type WindowsJavaContainerSettings struct { + // JavaContainer - READ-ONLY; Java container (runtime only). + JavaContainer *string `json:"javaContainer,omitempty"` + // JavaContainerVersion - READ-ONLY; Java container version (runtime only). + JavaContainerVersion *string `json:"javaContainerVersion,omitempty"` + // IsPreview - READ-ONLY; true if the stack is in preview; otherwise, false. + IsPreview *bool `json:"isPreview,omitempty"` + // IsDeprecated - READ-ONLY; true if the stack is deprecated; otherwise, false. + IsDeprecated *bool `json:"isDeprecated,omitempty"` + // IsHidden - READ-ONLY; true if the stack should be hidden; otherwise, false. + IsHidden *bool `json:"isHidden,omitempty"` + // EndOfLifeDate - READ-ONLY; End-of-life date for the minor version. + EndOfLifeDate *date.Time `json:"endOfLifeDate,omitempty"` + // IsAutoUpdate - READ-ONLY; true if the stack version is auto-updated; otherwise, false. + IsAutoUpdate *bool `json:"isAutoUpdate,omitempty"` + // IsEarlyAccess - READ-ONLY; true if the minor version is early-access; otherwise, false. + IsEarlyAccess *bool `json:"isEarlyAccess,omitempty"` +} + +// MarshalJSON is the custom marshaler for WindowsJavaContainerSettings. +func (wjcs WindowsJavaContainerSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// WorkerPool worker pool of an App Service Environment. +type WorkerPool struct { + // WorkerSizeID - Worker size ID for referencing this worker pool. + WorkerSizeID *int32 `json:"workerSizeId,omitempty"` + // ComputeMode - Shared or dedicated app hosting. Possible values include: 'ComputeModeOptionsShared', 'ComputeModeOptionsDedicated', 'ComputeModeOptionsDynamic' + ComputeMode ComputeModeOptions `json:"computeMode,omitempty"` + // WorkerSize - VM size of the worker pool instances. + WorkerSize *string `json:"workerSize,omitempty"` + // WorkerCount - Number of instances in the worker pool. + WorkerCount *int32 `json:"workerCount,omitempty"` + // InstanceNames - READ-ONLY; Names of all instances in the worker pool (read only). + InstanceNames *[]string `json:"instanceNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkerPool. +func (wp WorkerPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wp.WorkerSizeID != nil { + objectMap["workerSizeId"] = wp.WorkerSizeID + } + if wp.ComputeMode != "" { + objectMap["computeMode"] = wp.ComputeMode + } + if wp.WorkerSize != nil { + objectMap["workerSize"] = wp.WorkerSize + } + if wp.WorkerCount != nil { + objectMap["workerCount"] = wp.WorkerCount + } + return json.Marshal(objectMap) +} + +// WorkerPoolCollection collection of worker pools. +type WorkerPoolCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]WorkerPoolResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkerPoolCollection. +func (wpc WorkerPoolCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wpc.Value != nil { + objectMap["value"] = wpc.Value + } + return json.Marshal(objectMap) +} + +// WorkerPoolCollectionIterator provides access to a complete listing of WorkerPoolResource values. +type WorkerPoolCollectionIterator struct { + i int + page WorkerPoolCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *WorkerPoolCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkerPoolCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *WorkerPoolCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WorkerPoolCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter WorkerPoolCollectionIterator) Response() WorkerPoolCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter WorkerPoolCollectionIterator) Value() WorkerPoolResource { + if !iter.page.NotDone() { + return WorkerPoolResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WorkerPoolCollectionIterator type. +func NewWorkerPoolCollectionIterator(page WorkerPoolCollectionPage) WorkerPoolCollectionIterator { + return WorkerPoolCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wpc WorkerPoolCollection) IsEmpty() bool { + return wpc.Value == nil || len(*wpc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wpc WorkerPoolCollection) hasNextLink() bool { + return wpc.NextLink != nil && len(*wpc.NextLink) != 0 +} + +// workerPoolCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wpc WorkerPoolCollection) workerPoolCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !wpc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wpc.NextLink))) +} + +// WorkerPoolCollectionPage contains a page of WorkerPoolResource values. +type WorkerPoolCollectionPage struct { + fn func(context.Context, WorkerPoolCollection) (WorkerPoolCollection, error) + wpc WorkerPoolCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *WorkerPoolCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkerPoolCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.wpc) + if err != nil { + return err + } + page.wpc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *WorkerPoolCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WorkerPoolCollectionPage) NotDone() bool { + return !page.wpc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WorkerPoolCollectionPage) Response() WorkerPoolCollection { + return page.wpc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WorkerPoolCollectionPage) Values() []WorkerPoolResource { + if page.wpc.IsEmpty() { + return nil + } + return *page.wpc.Value +} + +// Creates a new instance of the WorkerPoolCollectionPage type. +func NewWorkerPoolCollectionPage(cur WorkerPoolCollection, getNextPage func(context.Context, WorkerPoolCollection) (WorkerPoolCollection, error)) WorkerPoolCollectionPage { + return WorkerPoolCollectionPage{ + fn: getNextPage, + wpc: cur, + } +} + +// WorkerPoolResource worker pool of an App Service Environment ARM resource. +type WorkerPoolResource struct { + autorest.Response `json:"-"` + // WorkerPool - Core resource properties + *WorkerPool `json:"properties,omitempty"` + Sku *SkuDescription `json:"sku,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkerPoolResource. +func (wpr WorkerPoolResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wpr.WorkerPool != nil { + objectMap["properties"] = wpr.WorkerPool + } + if wpr.Sku != nil { + objectMap["sku"] = wpr.Sku + } + if wpr.Kind != nil { + objectMap["kind"] = wpr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WorkerPoolResource struct. +func (wpr *WorkerPoolResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var workerPool WorkerPool + err = json.Unmarshal(*v, &workerPool) + if err != nil { + return err + } + wpr.WorkerPool = &workerPool + } + case "sku": + if v != nil { + var sku SkuDescription + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + wpr.Sku = &sku + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + wpr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + wpr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + wpr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + wpr.Type = &typeVar + } + } + } + + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/provider.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/provider.go new file mode 100644 index 000000000000..2628f62ea344 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/provider.go @@ -0,0 +1,836 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ProviderClient is the webSite Management Client +type ProviderClient struct { + BaseClient +} + +// NewProviderClient creates an instance of the ProviderClient client. +func NewProviderClient(subscriptionID string) ProviderClient { + return NewProviderClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProviderClientWithBaseURI creates an instance of the ProviderClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewProviderClientWithBaseURI(baseURI string, subscriptionID string) ProviderClient { + return ProviderClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetAvailableStacks description for Get available application frameworks and their versions +func (client ProviderClient) GetAvailableStacks(ctx context.Context, osTypeSelected string) (result ApplicationStackCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderClient.GetAvailableStacks") + defer func() { + sc := -1 + if result.asc.Response.Response != nil { + sc = result.asc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.getAvailableStacksNextResults + req, err := client.GetAvailableStacksPreparer(ctx, osTypeSelected) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacks", nil, "Failure preparing request") + return + } + + resp, err := client.GetAvailableStacksSender(req) + if err != nil { + result.asc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacks", resp, "Failure sending request") + return + } + + result.asc, err = client.GetAvailableStacksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacks", resp, "Failure responding to request") + return + } + if result.asc.hasNextLink() && result.asc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetAvailableStacksPreparer prepares the GetAvailableStacks request. +func (client ProviderClient) GetAvailableStacksPreparer(ctx context.Context, osTypeSelected string) (*http.Request, error) { + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(osTypeSelected)) > 0 { + queryParameters["osTypeSelected"] = autorest.Encode("query", osTypeSelected) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Web/availableStacks"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAvailableStacksSender sends the GetAvailableStacks request. The method will close the +// http.Response Body if it receives an error. +func (client ProviderClient) GetAvailableStacksSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetAvailableStacksResponder handles the response to the GetAvailableStacks request. The method always +// closes the http.Response Body. +func (client ProviderClient) GetAvailableStacksResponder(resp *http.Response) (result ApplicationStackCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getAvailableStacksNextResults retrieves the next set of results, if any. +func (client ProviderClient) getAvailableStacksNextResults(ctx context.Context, lastResults ApplicationStackCollection) (result ApplicationStackCollection, err error) { + req, err := lastResults.applicationStackCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ProviderClient", "getAvailableStacksNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetAvailableStacksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ProviderClient", "getAvailableStacksNextResults", resp, "Failure sending next results request") + } + result, err = client.GetAvailableStacksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "getAvailableStacksNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetAvailableStacksComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProviderClient) GetAvailableStacksComplete(ctx context.Context, osTypeSelected string) (result ApplicationStackCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderClient.GetAvailableStacks") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetAvailableStacks(ctx, osTypeSelected) + return +} + +// GetAvailableStacksOnPrem description for Get available application frameworks and their versions +func (client ProviderClient) GetAvailableStacksOnPrem(ctx context.Context, osTypeSelected string) (result ApplicationStackCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderClient.GetAvailableStacksOnPrem") + defer func() { + sc := -1 + if result.asc.Response.Response != nil { + sc = result.asc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.getAvailableStacksOnPremNextResults + req, err := client.GetAvailableStacksOnPremPreparer(ctx, osTypeSelected) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacksOnPrem", nil, "Failure preparing request") + return + } + + resp, err := client.GetAvailableStacksOnPremSender(req) + if err != nil { + result.asc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacksOnPrem", resp, "Failure sending request") + return + } + + result.asc, err = client.GetAvailableStacksOnPremResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacksOnPrem", resp, "Failure responding to request") + return + } + if result.asc.hasNextLink() && result.asc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetAvailableStacksOnPremPreparer prepares the GetAvailableStacksOnPrem request. +func (client ProviderClient) GetAvailableStacksOnPremPreparer(ctx context.Context, osTypeSelected string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(osTypeSelected)) > 0 { + queryParameters["osTypeSelected"] = autorest.Encode("query", osTypeSelected) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAvailableStacksOnPremSender sends the GetAvailableStacksOnPrem request. The method will close the +// http.Response Body if it receives an error. +func (client ProviderClient) GetAvailableStacksOnPremSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAvailableStacksOnPremResponder handles the response to the GetAvailableStacksOnPrem request. The method always +// closes the http.Response Body. +func (client ProviderClient) GetAvailableStacksOnPremResponder(resp *http.Response) (result ApplicationStackCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getAvailableStacksOnPremNextResults retrieves the next set of results, if any. +func (client ProviderClient) getAvailableStacksOnPremNextResults(ctx context.Context, lastResults ApplicationStackCollection) (result ApplicationStackCollection, err error) { + req, err := lastResults.applicationStackCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ProviderClient", "getAvailableStacksOnPremNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetAvailableStacksOnPremSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ProviderClient", "getAvailableStacksOnPremNextResults", resp, "Failure sending next results request") + } + result, err = client.GetAvailableStacksOnPremResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "getAvailableStacksOnPremNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetAvailableStacksOnPremComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProviderClient) GetAvailableStacksOnPremComplete(ctx context.Context, osTypeSelected string) (result ApplicationStackCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderClient.GetAvailableStacksOnPrem") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetAvailableStacksOnPrem(ctx, osTypeSelected) + return +} + +// GetFunctionAppStacks description for Get available Function app frameworks and their versions +// Parameters: +// stackOsType - stack OS Type +func (client ProviderClient) GetFunctionAppStacks(ctx context.Context, stackOsType string) (result FunctionAppStackCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderClient.GetFunctionAppStacks") + defer func() { + sc := -1 + if result.fasc.Response.Response != nil { + sc = result.fasc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.getFunctionAppStacksNextResults + req, err := client.GetFunctionAppStacksPreparer(ctx, stackOsType) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetFunctionAppStacks", nil, "Failure preparing request") + return + } + + resp, err := client.GetFunctionAppStacksSender(req) + if err != nil { + result.fasc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetFunctionAppStacks", resp, "Failure sending request") + return + } + + result.fasc, err = client.GetFunctionAppStacksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetFunctionAppStacks", resp, "Failure responding to request") + return + } + if result.fasc.hasNextLink() && result.fasc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetFunctionAppStacksPreparer prepares the GetFunctionAppStacks request. +func (client ProviderClient) GetFunctionAppStacksPreparer(ctx context.Context, stackOsType string) (*http.Request, error) { + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(stackOsType)) > 0 { + queryParameters["stackOsType"] = autorest.Encode("query", stackOsType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Web/functionAppStacks"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetFunctionAppStacksSender sends the GetFunctionAppStacks request. The method will close the +// http.Response Body if it receives an error. +func (client ProviderClient) GetFunctionAppStacksSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetFunctionAppStacksResponder handles the response to the GetFunctionAppStacks request. The method always +// closes the http.Response Body. +func (client ProviderClient) GetFunctionAppStacksResponder(resp *http.Response) (result FunctionAppStackCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getFunctionAppStacksNextResults retrieves the next set of results, if any. +func (client ProviderClient) getFunctionAppStacksNextResults(ctx context.Context, lastResults FunctionAppStackCollection) (result FunctionAppStackCollection, err error) { + req, err := lastResults.functionAppStackCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ProviderClient", "getFunctionAppStacksNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetFunctionAppStacksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ProviderClient", "getFunctionAppStacksNextResults", resp, "Failure sending next results request") + } + result, err = client.GetFunctionAppStacksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "getFunctionAppStacksNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetFunctionAppStacksComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProviderClient) GetFunctionAppStacksComplete(ctx context.Context, stackOsType string) (result FunctionAppStackCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderClient.GetFunctionAppStacks") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetFunctionAppStacks(ctx, stackOsType) + return +} + +// GetFunctionAppStacksForLocation description for Get available Function app frameworks and their versions for +// location +// Parameters: +// location - function App stack location. +// stackOsType - stack OS Type +func (client ProviderClient) GetFunctionAppStacksForLocation(ctx context.Context, location string, stackOsType string) (result FunctionAppStackCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderClient.GetFunctionAppStacksForLocation") + defer func() { + sc := -1 + if result.fasc.Response.Response != nil { + sc = result.fasc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.getFunctionAppStacksForLocationNextResults + req, err := client.GetFunctionAppStacksForLocationPreparer(ctx, location, stackOsType) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetFunctionAppStacksForLocation", nil, "Failure preparing request") + return + } + + resp, err := client.GetFunctionAppStacksForLocationSender(req) + if err != nil { + result.fasc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetFunctionAppStacksForLocation", resp, "Failure sending request") + return + } + + result.fasc, err = client.GetFunctionAppStacksForLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetFunctionAppStacksForLocation", resp, "Failure responding to request") + return + } + if result.fasc.hasNextLink() && result.fasc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetFunctionAppStacksForLocationPreparer prepares the GetFunctionAppStacksForLocation request. +func (client ProviderClient) GetFunctionAppStacksForLocationPreparer(ctx context.Context, location string, stackOsType string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(stackOsType)) > 0 { + queryParameters["stackOsType"] = autorest.Encode("query", stackOsType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Web/locations/{location}/functionAppStacks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetFunctionAppStacksForLocationSender sends the GetFunctionAppStacksForLocation request. The method will close the +// http.Response Body if it receives an error. +func (client ProviderClient) GetFunctionAppStacksForLocationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetFunctionAppStacksForLocationResponder handles the response to the GetFunctionAppStacksForLocation request. The method always +// closes the http.Response Body. +func (client ProviderClient) GetFunctionAppStacksForLocationResponder(resp *http.Response) (result FunctionAppStackCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getFunctionAppStacksForLocationNextResults retrieves the next set of results, if any. +func (client ProviderClient) getFunctionAppStacksForLocationNextResults(ctx context.Context, lastResults FunctionAppStackCollection) (result FunctionAppStackCollection, err error) { + req, err := lastResults.functionAppStackCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ProviderClient", "getFunctionAppStacksForLocationNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetFunctionAppStacksForLocationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ProviderClient", "getFunctionAppStacksForLocationNextResults", resp, "Failure sending next results request") + } + result, err = client.GetFunctionAppStacksForLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "getFunctionAppStacksForLocationNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetFunctionAppStacksForLocationComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProviderClient) GetFunctionAppStacksForLocationComplete(ctx context.Context, location string, stackOsType string) (result FunctionAppStackCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderClient.GetFunctionAppStacksForLocation") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetFunctionAppStacksForLocation(ctx, location, stackOsType) + return +} + +// GetWebAppStacks description for Get available Web app frameworks and their versions +// Parameters: +// stackOsType - stack OS Type +func (client ProviderClient) GetWebAppStacks(ctx context.Context, stackOsType string) (result AppStackCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderClient.GetWebAppStacks") + defer func() { + sc := -1 + if result.asc.Response.Response != nil { + sc = result.asc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.getWebAppStacksNextResults + req, err := client.GetWebAppStacksPreparer(ctx, stackOsType) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetWebAppStacks", nil, "Failure preparing request") + return + } + + resp, err := client.GetWebAppStacksSender(req) + if err != nil { + result.asc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetWebAppStacks", resp, "Failure sending request") + return + } + + result.asc, err = client.GetWebAppStacksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetWebAppStacks", resp, "Failure responding to request") + return + } + if result.asc.hasNextLink() && result.asc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetWebAppStacksPreparer prepares the GetWebAppStacks request. +func (client ProviderClient) GetWebAppStacksPreparer(ctx context.Context, stackOsType string) (*http.Request, error) { + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(stackOsType)) > 0 { + queryParameters["stackOsType"] = autorest.Encode("query", stackOsType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Web/webAppStacks"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetWebAppStacksSender sends the GetWebAppStacks request. The method will close the +// http.Response Body if it receives an error. +func (client ProviderClient) GetWebAppStacksSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetWebAppStacksResponder handles the response to the GetWebAppStacks request. The method always +// closes the http.Response Body. +func (client ProviderClient) GetWebAppStacksResponder(resp *http.Response) (result AppStackCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getWebAppStacksNextResults retrieves the next set of results, if any. +func (client ProviderClient) getWebAppStacksNextResults(ctx context.Context, lastResults AppStackCollection) (result AppStackCollection, err error) { + req, err := lastResults.appStackCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ProviderClient", "getWebAppStacksNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetWebAppStacksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ProviderClient", "getWebAppStacksNextResults", resp, "Failure sending next results request") + } + result, err = client.GetWebAppStacksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "getWebAppStacksNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetWebAppStacksComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProviderClient) GetWebAppStacksComplete(ctx context.Context, stackOsType string) (result AppStackCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderClient.GetWebAppStacks") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetWebAppStacks(ctx, stackOsType) + return +} + +// GetWebAppStacksForLocation description for Get available Web app frameworks and their versions for location +// Parameters: +// location - web App stack location. +// stackOsType - stack OS Type +func (client ProviderClient) GetWebAppStacksForLocation(ctx context.Context, location string, stackOsType string) (result AppStackCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderClient.GetWebAppStacksForLocation") + defer func() { + sc := -1 + if result.asc.Response.Response != nil { + sc = result.asc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.getWebAppStacksForLocationNextResults + req, err := client.GetWebAppStacksForLocationPreparer(ctx, location, stackOsType) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetWebAppStacksForLocation", nil, "Failure preparing request") + return + } + + resp, err := client.GetWebAppStacksForLocationSender(req) + if err != nil { + result.asc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetWebAppStacksForLocation", resp, "Failure sending request") + return + } + + result.asc, err = client.GetWebAppStacksForLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetWebAppStacksForLocation", resp, "Failure responding to request") + return + } + if result.asc.hasNextLink() && result.asc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetWebAppStacksForLocationPreparer prepares the GetWebAppStacksForLocation request. +func (client ProviderClient) GetWebAppStacksForLocationPreparer(ctx context.Context, location string, stackOsType string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(stackOsType)) > 0 { + queryParameters["stackOsType"] = autorest.Encode("query", stackOsType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Web/locations/{location}/webAppStacks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetWebAppStacksForLocationSender sends the GetWebAppStacksForLocation request. The method will close the +// http.Response Body if it receives an error. +func (client ProviderClient) GetWebAppStacksForLocationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetWebAppStacksForLocationResponder handles the response to the GetWebAppStacksForLocation request. The method always +// closes the http.Response Body. +func (client ProviderClient) GetWebAppStacksForLocationResponder(resp *http.Response) (result AppStackCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getWebAppStacksForLocationNextResults retrieves the next set of results, if any. +func (client ProviderClient) getWebAppStacksForLocationNextResults(ctx context.Context, lastResults AppStackCollection) (result AppStackCollection, err error) { + req, err := lastResults.appStackCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ProviderClient", "getWebAppStacksForLocationNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetWebAppStacksForLocationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ProviderClient", "getWebAppStacksForLocationNextResults", resp, "Failure sending next results request") + } + result, err = client.GetWebAppStacksForLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "getWebAppStacksForLocationNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetWebAppStacksForLocationComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProviderClient) GetWebAppStacksForLocationComplete(ctx context.Context, location string, stackOsType string) (result AppStackCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderClient.GetWebAppStacksForLocation") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetWebAppStacksForLocation(ctx, location, stackOsType) + return +} + +// ListOperations description for Gets all available operations for the Microsoft.Web resource provider. Also exposes +// resource metric definitions +func (client ProviderClient) ListOperations(ctx context.Context) (result CsmOperationCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderClient.ListOperations") + defer func() { + sc := -1 + if result.coc.Response.Response != nil { + sc = result.coc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listOperationsNextResults + req, err := client.ListOperationsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "ListOperations", nil, "Failure preparing request") + return + } + + resp, err := client.ListOperationsSender(req) + if err != nil { + result.coc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ProviderClient", "ListOperations", resp, "Failure sending request") + return + } + + result.coc, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "ListOperations", resp, "Failure responding to request") + return + } + if result.coc.hasNextLink() && result.coc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListOperationsPreparer prepares the ListOperations request. +func (client ProviderClient) ListOperationsPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Web/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListOperationsSender sends the ListOperations request. The method will close the +// http.Response Body if it receives an error. +func (client ProviderClient) ListOperationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListOperationsResponder handles the response to the ListOperations request. The method always +// closes the http.Response Body. +func (client ProviderClient) ListOperationsResponder(resp *http.Response) (result CsmOperationCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listOperationsNextResults retrieves the next set of results, if any. +func (client ProviderClient) listOperationsNextResults(ctx context.Context, lastResults CsmOperationCollection) (result CsmOperationCollection, err error) { + req, err := lastResults.csmOperationCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ProviderClient", "listOperationsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ProviderClient", "listOperationsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "listOperationsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListOperationsComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProviderClient) ListOperationsComplete(ctx context.Context) (result CsmOperationCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderClient.ListOperations") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListOperations(ctx) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/recommendations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/recommendations.go new file mode 100644 index 000000000000..ba4db5822305 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/recommendations.go @@ -0,0 +1,1543 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RecommendationsClient is the webSite Management Client +type RecommendationsClient struct { + BaseClient +} + +// NewRecommendationsClient creates an instance of the RecommendationsClient client. +func NewRecommendationsClient(subscriptionID string) RecommendationsClient { + return NewRecommendationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRecommendationsClientWithBaseURI creates an instance of the RecommendationsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewRecommendationsClientWithBaseURI(baseURI string, subscriptionID string) RecommendationsClient { + return RecommendationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// DisableAllForHostingEnvironment description for Disable all recommendations for an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// environmentName - name of the app. +func (client RecommendationsClient) DisableAllForHostingEnvironment(ctx context.Context, resourceGroupName string, environmentName string, hostingEnvironmentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.DisableAllForHostingEnvironment") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.RecommendationsClient", "DisableAllForHostingEnvironment", err.Error()) + } + + req, err := client.DisableAllForHostingEnvironmentPreparer(ctx, resourceGroupName, environmentName, hostingEnvironmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForHostingEnvironment", nil, "Failure preparing request") + return + } + + resp, err := client.DisableAllForHostingEnvironmentSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForHostingEnvironment", resp, "Failure sending request") + return + } + + result, err = client.DisableAllForHostingEnvironmentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForHostingEnvironment", resp, "Failure responding to request") + return + } + + return +} + +// DisableAllForHostingEnvironmentPreparer prepares the DisableAllForHostingEnvironment request. +func (client RecommendationsClient) DisableAllForHostingEnvironmentPreparer(ctx context.Context, resourceGroupName string, environmentName string, hostingEnvironmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostingEnvironmentName": autorest.Encode("path", hostingEnvironmentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "environmentName": autorest.Encode("query", environmentName), + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/disable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableAllForHostingEnvironmentSender sends the DisableAllForHostingEnvironment request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) DisableAllForHostingEnvironmentSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DisableAllForHostingEnvironmentResponder handles the response to the DisableAllForHostingEnvironment request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) DisableAllForHostingEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DisableAllForWebApp description for Disable all recommendations for an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - name of the app. +func (client RecommendationsClient) DisableAllForWebApp(ctx context.Context, resourceGroupName string, siteName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.DisableAllForWebApp") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.RecommendationsClient", "DisableAllForWebApp", err.Error()) + } + + req, err := client.DisableAllForWebAppPreparer(ctx, resourceGroupName, siteName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForWebApp", nil, "Failure preparing request") + return + } + + resp, err := client.DisableAllForWebAppSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForWebApp", resp, "Failure sending request") + return + } + + result, err = client.DisableAllForWebAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForWebApp", resp, "Failure responding to request") + return + } + + return +} + +// DisableAllForWebAppPreparer prepares the DisableAllForWebApp request. +func (client RecommendationsClient) DisableAllForWebAppPreparer(ctx context.Context, resourceGroupName string, siteName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/disable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableAllForWebAppSender sends the DisableAllForWebApp request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) DisableAllForWebAppSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DisableAllForWebAppResponder handles the response to the DisableAllForWebApp request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) DisableAllForWebAppResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DisableRecommendationForHostingEnvironment description for Disables the specific rule for a web site permanently. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// environmentName - site name +// name - rule name +func (client RecommendationsClient) DisableRecommendationForHostingEnvironment(ctx context.Context, resourceGroupName string, environmentName string, name string, hostingEnvironmentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.DisableRecommendationForHostingEnvironment") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.RecommendationsClient", "DisableRecommendationForHostingEnvironment", err.Error()) + } + + req, err := client.DisableRecommendationForHostingEnvironmentPreparer(ctx, resourceGroupName, environmentName, name, hostingEnvironmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForHostingEnvironment", nil, "Failure preparing request") + return + } + + resp, err := client.DisableRecommendationForHostingEnvironmentSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForHostingEnvironment", resp, "Failure sending request") + return + } + + result, err = client.DisableRecommendationForHostingEnvironmentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForHostingEnvironment", resp, "Failure responding to request") + return + } + + return +} + +// DisableRecommendationForHostingEnvironmentPreparer prepares the DisableRecommendationForHostingEnvironment request. +func (client RecommendationsClient) DisableRecommendationForHostingEnvironmentPreparer(ctx context.Context, resourceGroupName string, environmentName string, name string, hostingEnvironmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostingEnvironmentName": autorest.Encode("path", hostingEnvironmentName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "environmentName": autorest.Encode("query", environmentName), + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}/disable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableRecommendationForHostingEnvironmentSender sends the DisableRecommendationForHostingEnvironment request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) DisableRecommendationForHostingEnvironmentSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DisableRecommendationForHostingEnvironmentResponder handles the response to the DisableRecommendationForHostingEnvironment request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) DisableRecommendationForHostingEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DisableRecommendationForSite description for Disables the specific rule for a web site permanently. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - site name +// name - rule name +func (client RecommendationsClient) DisableRecommendationForSite(ctx context.Context, resourceGroupName string, siteName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.DisableRecommendationForSite") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.RecommendationsClient", "DisableRecommendationForSite", err.Error()) + } + + req, err := client.DisableRecommendationForSitePreparer(ctx, resourceGroupName, siteName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForSite", nil, "Failure preparing request") + return + } + + resp, err := client.DisableRecommendationForSiteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForSite", resp, "Failure sending request") + return + } + + result, err = client.DisableRecommendationForSiteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForSite", resp, "Failure responding to request") + return + } + + return +} + +// DisableRecommendationForSitePreparer prepares the DisableRecommendationForSite request. +func (client RecommendationsClient) DisableRecommendationForSitePreparer(ctx context.Context, resourceGroupName string, siteName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}/disable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableRecommendationForSiteSender sends the DisableRecommendationForSite request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) DisableRecommendationForSiteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DisableRecommendationForSiteResponder handles the response to the DisableRecommendationForSite request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) DisableRecommendationForSiteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DisableRecommendationForSubscription description for Disables the specified rule so it will not apply to a +// subscription in the future. +// Parameters: +// name - rule name +func (client RecommendationsClient) DisableRecommendationForSubscription(ctx context.Context, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.DisableRecommendationForSubscription") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DisableRecommendationForSubscriptionPreparer(ctx, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForSubscription", nil, "Failure preparing request") + return + } + + resp, err := client.DisableRecommendationForSubscriptionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForSubscription", resp, "Failure sending request") + return + } + + result, err = client.DisableRecommendationForSubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableRecommendationForSubscription", resp, "Failure responding to request") + return + } + + return +} + +// DisableRecommendationForSubscriptionPreparer prepares the DisableRecommendationForSubscription request. +func (client RecommendationsClient) DisableRecommendationForSubscriptionPreparer(ctx context.Context, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableRecommendationForSubscriptionSender sends the DisableRecommendationForSubscription request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) DisableRecommendationForSubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DisableRecommendationForSubscriptionResponder handles the response to the DisableRecommendationForSubscription request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) DisableRecommendationForSubscriptionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetRuleDetailsByHostingEnvironment description for Get a recommendation rule for an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// hostingEnvironmentName - name of the hosting environment. +// name - name of the recommendation. +// updateSeen - specify true to update the last-seen timestamp of the recommendation object. +// recommendationID - the GUID of the recommendation object if you query an expired one. You don't need to +// specify it to query an active entry. +func (client RecommendationsClient) GetRuleDetailsByHostingEnvironment(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, name string, updateSeen *bool, recommendationID string) (result RecommendationRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.GetRuleDetailsByHostingEnvironment") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.RecommendationsClient", "GetRuleDetailsByHostingEnvironment", err.Error()) + } + + req, err := client.GetRuleDetailsByHostingEnvironmentPreparer(ctx, resourceGroupName, hostingEnvironmentName, name, updateSeen, recommendationID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByHostingEnvironment", nil, "Failure preparing request") + return + } + + resp, err := client.GetRuleDetailsByHostingEnvironmentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByHostingEnvironment", resp, "Failure sending request") + return + } + + result, err = client.GetRuleDetailsByHostingEnvironmentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByHostingEnvironment", resp, "Failure responding to request") + return + } + + return +} + +// GetRuleDetailsByHostingEnvironmentPreparer prepares the GetRuleDetailsByHostingEnvironment request. +func (client RecommendationsClient) GetRuleDetailsByHostingEnvironmentPreparer(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, name string, updateSeen *bool, recommendationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostingEnvironmentName": autorest.Encode("path", hostingEnvironmentName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if updateSeen != nil { + queryParameters["updateSeen"] = autorest.Encode("query", *updateSeen) + } + if len(recommendationID) > 0 { + queryParameters["recommendationId"] = autorest.Encode("query", recommendationID) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetRuleDetailsByHostingEnvironmentSender sends the GetRuleDetailsByHostingEnvironment request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) GetRuleDetailsByHostingEnvironmentSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetRuleDetailsByHostingEnvironmentResponder handles the response to the GetRuleDetailsByHostingEnvironment request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) GetRuleDetailsByHostingEnvironmentResponder(resp *http.Response) (result RecommendationRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRuleDetailsByWebApp description for Get a recommendation rule for an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - name of the app. +// name - name of the recommendation. +// updateSeen - specify true to update the last-seen timestamp of the recommendation object. +// recommendationID - the GUID of the recommendation object if you query an expired one. You don't need to +// specify it to query an active entry. +func (client RecommendationsClient) GetRuleDetailsByWebApp(ctx context.Context, resourceGroupName string, siteName string, name string, updateSeen *bool, recommendationID string) (result RecommendationRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.GetRuleDetailsByWebApp") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.RecommendationsClient", "GetRuleDetailsByWebApp", err.Error()) + } + + req, err := client.GetRuleDetailsByWebAppPreparer(ctx, resourceGroupName, siteName, name, updateSeen, recommendationID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp", nil, "Failure preparing request") + return + } + + resp, err := client.GetRuleDetailsByWebAppSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp", resp, "Failure sending request") + return + } + + result, err = client.GetRuleDetailsByWebAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp", resp, "Failure responding to request") + return + } + + return +} + +// GetRuleDetailsByWebAppPreparer prepares the GetRuleDetailsByWebApp request. +func (client RecommendationsClient) GetRuleDetailsByWebAppPreparer(ctx context.Context, resourceGroupName string, siteName string, name string, updateSeen *bool, recommendationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if updateSeen != nil { + queryParameters["updateSeen"] = autorest.Encode("query", *updateSeen) + } + if len(recommendationID) > 0 { + queryParameters["recommendationId"] = autorest.Encode("query", recommendationID) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetRuleDetailsByWebAppSender sends the GetRuleDetailsByWebApp request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) GetRuleDetailsByWebAppSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetRuleDetailsByWebAppResponder handles the response to the GetRuleDetailsByWebApp request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) GetRuleDetailsByWebAppResponder(resp *http.Response) (result RecommendationRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List description for List all recommendations for a subscription. +// Parameters: +// featured - specify true to return only the most critical recommendations. The default is +// false, which returns all recommendations. +// filter - filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or channel eq +// 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq +// duration'[PT1H|PT1M|P1D] +func (client RecommendationsClient) List(ctx context.Context, featured *bool, filter string) (result RecommendationCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.List") + defer func() { + sc := -1 + if result.rc.Response.Response != nil { + sc = result.rc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, featured, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "List", resp, "Failure sending request") + return + } + + result.rc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "List", resp, "Failure responding to request") + return + } + if result.rc.hasNextLink() && result.rc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client RecommendationsClient) ListPreparer(ctx context.Context, featured *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if featured != nil { + queryParameters["featured"] = autorest.Encode("query", *featured) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) ListResponder(resp *http.Response) (result RecommendationCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client RecommendationsClient) listNextResults(ctx context.Context, lastResults RecommendationCollection) (result RecommendationCollection, err error) { + req, err := lastResults.recommendationCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client RecommendationsClient) ListComplete(ctx context.Context, featured *bool, filter string) (result RecommendationCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, featured, filter) + return +} + +// ListHistoryForHostingEnvironment description for Get past recommendations for an app, optionally specified by the +// time range. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// hostingEnvironmentName - name of the hosting environment. +// expiredOnly - specify false to return all recommendations. The default is true, +// which returns only expired recommendations. +// filter - filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or channel eq +// 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq +// duration'[PT1H|PT1M|P1D] +func (client RecommendationsClient) ListHistoryForHostingEnvironment(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, expiredOnly *bool, filter string) (result RecommendationCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListHistoryForHostingEnvironment") + defer func() { + sc := -1 + if result.rc.Response.Response != nil { + sc = result.rc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.RecommendationsClient", "ListHistoryForHostingEnvironment", err.Error()) + } + + result.fn = client.listHistoryForHostingEnvironmentNextResults + req, err := client.ListHistoryForHostingEnvironmentPreparer(ctx, resourceGroupName, hostingEnvironmentName, expiredOnly, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForHostingEnvironment", nil, "Failure preparing request") + return + } + + resp, err := client.ListHistoryForHostingEnvironmentSender(req) + if err != nil { + result.rc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForHostingEnvironment", resp, "Failure sending request") + return + } + + result.rc, err = client.ListHistoryForHostingEnvironmentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForHostingEnvironment", resp, "Failure responding to request") + return + } + if result.rc.hasNextLink() && result.rc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListHistoryForHostingEnvironmentPreparer prepares the ListHistoryForHostingEnvironment request. +func (client RecommendationsClient) ListHistoryForHostingEnvironmentPreparer(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, expiredOnly *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostingEnvironmentName": autorest.Encode("path", hostingEnvironmentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if expiredOnly != nil { + queryParameters["expiredOnly"] = autorest.Encode("query", *expiredOnly) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendationHistory", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHistoryForHostingEnvironmentSender sends the ListHistoryForHostingEnvironment request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) ListHistoryForHostingEnvironmentSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListHistoryForHostingEnvironmentResponder handles the response to the ListHistoryForHostingEnvironment request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) ListHistoryForHostingEnvironmentResponder(resp *http.Response) (result RecommendationCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listHistoryForHostingEnvironmentNextResults retrieves the next set of results, if any. +func (client RecommendationsClient) listHistoryForHostingEnvironmentNextResults(ctx context.Context, lastResults RecommendationCollection) (result RecommendationCollection, err error) { + req, err := lastResults.recommendationCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listHistoryForHostingEnvironmentNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListHistoryForHostingEnvironmentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listHistoryForHostingEnvironmentNextResults", resp, "Failure sending next results request") + } + result, err = client.ListHistoryForHostingEnvironmentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "listHistoryForHostingEnvironmentNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListHistoryForHostingEnvironmentComplete enumerates all values, automatically crossing page boundaries as required. +func (client RecommendationsClient) ListHistoryForHostingEnvironmentComplete(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, expiredOnly *bool, filter string) (result RecommendationCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListHistoryForHostingEnvironment") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListHistoryForHostingEnvironment(ctx, resourceGroupName, hostingEnvironmentName, expiredOnly, filter) + return +} + +// ListHistoryForWebApp description for Get past recommendations for an app, optionally specified by the time range. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - name of the app. +// expiredOnly - specify false to return all recommendations. The default is true, +// which returns only expired recommendations. +// filter - filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or channel eq +// 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq +// duration'[PT1H|PT1M|P1D] +func (client RecommendationsClient) ListHistoryForWebApp(ctx context.Context, resourceGroupName string, siteName string, expiredOnly *bool, filter string) (result RecommendationCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListHistoryForWebApp") + defer func() { + sc := -1 + if result.rc.Response.Response != nil { + sc = result.rc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.RecommendationsClient", "ListHistoryForWebApp", err.Error()) + } + + result.fn = client.listHistoryForWebAppNextResults + req, err := client.ListHistoryForWebAppPreparer(ctx, resourceGroupName, siteName, expiredOnly, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForWebApp", nil, "Failure preparing request") + return + } + + resp, err := client.ListHistoryForWebAppSender(req) + if err != nil { + result.rc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForWebApp", resp, "Failure sending request") + return + } + + result.rc, err = client.ListHistoryForWebAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForWebApp", resp, "Failure responding to request") + return + } + if result.rc.hasNextLink() && result.rc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListHistoryForWebAppPreparer prepares the ListHistoryForWebApp request. +func (client RecommendationsClient) ListHistoryForWebAppPreparer(ctx context.Context, resourceGroupName string, siteName string, expiredOnly *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if expiredOnly != nil { + queryParameters["expiredOnly"] = autorest.Encode("query", *expiredOnly) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendationHistory", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHistoryForWebAppSender sends the ListHistoryForWebApp request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) ListHistoryForWebAppSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListHistoryForWebAppResponder handles the response to the ListHistoryForWebApp request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) ListHistoryForWebAppResponder(resp *http.Response) (result RecommendationCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listHistoryForWebAppNextResults retrieves the next set of results, if any. +func (client RecommendationsClient) listHistoryForWebAppNextResults(ctx context.Context, lastResults RecommendationCollection) (result RecommendationCollection, err error) { + req, err := lastResults.recommendationCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listHistoryForWebAppNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListHistoryForWebAppSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listHistoryForWebAppNextResults", resp, "Failure sending next results request") + } + result, err = client.ListHistoryForWebAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "listHistoryForWebAppNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListHistoryForWebAppComplete enumerates all values, automatically crossing page boundaries as required. +func (client RecommendationsClient) ListHistoryForWebAppComplete(ctx context.Context, resourceGroupName string, siteName string, expiredOnly *bool, filter string) (result RecommendationCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListHistoryForWebApp") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListHistoryForWebApp(ctx, resourceGroupName, siteName, expiredOnly, filter) + return +} + +// ListRecommendedRulesForHostingEnvironment description for Get all recommendations for a hosting environment. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// hostingEnvironmentName - name of the app. +// featured - specify true to return only the most critical recommendations. The default is +// false, which returns all recommendations. +// filter - return only channels specified in the filter. Filter is specified by using OData syntax. Example: +// $filter=channel eq 'Api' or channel eq 'Notification' +func (client RecommendationsClient) ListRecommendedRulesForHostingEnvironment(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, featured *bool, filter string) (result RecommendationCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListRecommendedRulesForHostingEnvironment") + defer func() { + sc := -1 + if result.rc.Response.Response != nil { + sc = result.rc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.RecommendationsClient", "ListRecommendedRulesForHostingEnvironment", err.Error()) + } + + result.fn = client.listRecommendedRulesForHostingEnvironmentNextResults + req, err := client.ListRecommendedRulesForHostingEnvironmentPreparer(ctx, resourceGroupName, hostingEnvironmentName, featured, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForHostingEnvironment", nil, "Failure preparing request") + return + } + + resp, err := client.ListRecommendedRulesForHostingEnvironmentSender(req) + if err != nil { + result.rc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForHostingEnvironment", resp, "Failure sending request") + return + } + + result.rc, err = client.ListRecommendedRulesForHostingEnvironmentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForHostingEnvironment", resp, "Failure responding to request") + return + } + if result.rc.hasNextLink() && result.rc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListRecommendedRulesForHostingEnvironmentPreparer prepares the ListRecommendedRulesForHostingEnvironment request. +func (client RecommendationsClient) ListRecommendedRulesForHostingEnvironmentPreparer(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, featured *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostingEnvironmentName": autorest.Encode("path", hostingEnvironmentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if featured != nil { + queryParameters["featured"] = autorest.Encode("query", *featured) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRecommendedRulesForHostingEnvironmentSender sends the ListRecommendedRulesForHostingEnvironment request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) ListRecommendedRulesForHostingEnvironmentSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListRecommendedRulesForHostingEnvironmentResponder handles the response to the ListRecommendedRulesForHostingEnvironment request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) ListRecommendedRulesForHostingEnvironmentResponder(resp *http.Response) (result RecommendationCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listRecommendedRulesForHostingEnvironmentNextResults retrieves the next set of results, if any. +func (client RecommendationsClient) listRecommendedRulesForHostingEnvironmentNextResults(ctx context.Context, lastResults RecommendationCollection) (result RecommendationCollection, err error) { + req, err := lastResults.recommendationCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listRecommendedRulesForHostingEnvironmentNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListRecommendedRulesForHostingEnvironmentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listRecommendedRulesForHostingEnvironmentNextResults", resp, "Failure sending next results request") + } + result, err = client.ListRecommendedRulesForHostingEnvironmentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "listRecommendedRulesForHostingEnvironmentNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListRecommendedRulesForHostingEnvironmentComplete enumerates all values, automatically crossing page boundaries as required. +func (client RecommendationsClient) ListRecommendedRulesForHostingEnvironmentComplete(ctx context.Context, resourceGroupName string, hostingEnvironmentName string, featured *bool, filter string) (result RecommendationCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListRecommendedRulesForHostingEnvironment") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListRecommendedRulesForHostingEnvironment(ctx, resourceGroupName, hostingEnvironmentName, featured, filter) + return +} + +// ListRecommendedRulesForWebApp description for Get all recommendations for an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - name of the app. +// featured - specify true to return only the most critical recommendations. The default is +// false, which returns all recommendations. +// filter - return only channels specified in the filter. Filter is specified by using OData syntax. Example: +// $filter=channel eq 'Api' or channel eq 'Notification' +func (client RecommendationsClient) ListRecommendedRulesForWebApp(ctx context.Context, resourceGroupName string, siteName string, featured *bool, filter string) (result RecommendationCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListRecommendedRulesForWebApp") + defer func() { + sc := -1 + if result.rc.Response.Response != nil { + sc = result.rc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.RecommendationsClient", "ListRecommendedRulesForWebApp", err.Error()) + } + + result.fn = client.listRecommendedRulesForWebAppNextResults + req, err := client.ListRecommendedRulesForWebAppPreparer(ctx, resourceGroupName, siteName, featured, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp", nil, "Failure preparing request") + return + } + + resp, err := client.ListRecommendedRulesForWebAppSender(req) + if err != nil { + result.rc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp", resp, "Failure sending request") + return + } + + result.rc, err = client.ListRecommendedRulesForWebAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp", resp, "Failure responding to request") + return + } + if result.rc.hasNextLink() && result.rc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListRecommendedRulesForWebAppPreparer prepares the ListRecommendedRulesForWebApp request. +func (client RecommendationsClient) ListRecommendedRulesForWebAppPreparer(ctx context.Context, resourceGroupName string, siteName string, featured *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if featured != nil { + queryParameters["featured"] = autorest.Encode("query", *featured) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRecommendedRulesForWebAppSender sends the ListRecommendedRulesForWebApp request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) ListRecommendedRulesForWebAppSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListRecommendedRulesForWebAppResponder handles the response to the ListRecommendedRulesForWebApp request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) ListRecommendedRulesForWebAppResponder(resp *http.Response) (result RecommendationCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listRecommendedRulesForWebAppNextResults retrieves the next set of results, if any. +func (client RecommendationsClient) listRecommendedRulesForWebAppNextResults(ctx context.Context, lastResults RecommendationCollection) (result RecommendationCollection, err error) { + req, err := lastResults.recommendationCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listRecommendedRulesForWebAppNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListRecommendedRulesForWebAppSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.RecommendationsClient", "listRecommendedRulesForWebAppNextResults", resp, "Failure sending next results request") + } + result, err = client.ListRecommendedRulesForWebAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "listRecommendedRulesForWebAppNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListRecommendedRulesForWebAppComplete enumerates all values, automatically crossing page boundaries as required. +func (client RecommendationsClient) ListRecommendedRulesForWebAppComplete(ctx context.Context, resourceGroupName string, siteName string, featured *bool, filter string) (result RecommendationCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ListRecommendedRulesForWebApp") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListRecommendedRulesForWebApp(ctx, resourceGroupName, siteName, featured, filter) + return +} + +// ResetAllFilters description for Reset all recommendation opt-out settings for a subscription. +func (client RecommendationsClient) ResetAllFilters(ctx context.Context) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ResetAllFilters") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ResetAllFiltersPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFilters", nil, "Failure preparing request") + return + } + + resp, err := client.ResetAllFiltersSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFilters", resp, "Failure sending request") + return + } + + result, err = client.ResetAllFiltersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFilters", resp, "Failure responding to request") + return + } + + return +} + +// ResetAllFiltersPreparer prepares the ResetAllFilters request. +func (client RecommendationsClient) ResetAllFiltersPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetAllFiltersSender sends the ResetAllFilters request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) ResetAllFiltersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ResetAllFiltersResponder handles the response to the ResetAllFilters request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) ResetAllFiltersResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResetAllFiltersForHostingEnvironment description for Reset all recommendation opt-out settings for an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// environmentName - name of the app. +func (client RecommendationsClient) ResetAllFiltersForHostingEnvironment(ctx context.Context, resourceGroupName string, environmentName string, hostingEnvironmentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ResetAllFiltersForHostingEnvironment") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.RecommendationsClient", "ResetAllFiltersForHostingEnvironment", err.Error()) + } + + req, err := client.ResetAllFiltersForHostingEnvironmentPreparer(ctx, resourceGroupName, environmentName, hostingEnvironmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForHostingEnvironment", nil, "Failure preparing request") + return + } + + resp, err := client.ResetAllFiltersForHostingEnvironmentSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForHostingEnvironment", resp, "Failure sending request") + return + } + + result, err = client.ResetAllFiltersForHostingEnvironmentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForHostingEnvironment", resp, "Failure responding to request") + return + } + + return +} + +// ResetAllFiltersForHostingEnvironmentPreparer prepares the ResetAllFiltersForHostingEnvironment request. +func (client RecommendationsClient) ResetAllFiltersForHostingEnvironmentPreparer(ctx context.Context, resourceGroupName string, environmentName string, hostingEnvironmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostingEnvironmentName": autorest.Encode("path", hostingEnvironmentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "environmentName": autorest.Encode("query", environmentName), + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/reset", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetAllFiltersForHostingEnvironmentSender sends the ResetAllFiltersForHostingEnvironment request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) ResetAllFiltersForHostingEnvironmentSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ResetAllFiltersForHostingEnvironmentResponder handles the response to the ResetAllFiltersForHostingEnvironment request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) ResetAllFiltersForHostingEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResetAllFiltersForWebApp description for Reset all recommendation opt-out settings for an app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// siteName - name of the app. +func (client RecommendationsClient) ResetAllFiltersForWebApp(ctx context.Context, resourceGroupName string, siteName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationsClient.ResetAllFiltersForWebApp") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.RecommendationsClient", "ResetAllFiltersForWebApp", err.Error()) + } + + req, err := client.ResetAllFiltersForWebAppPreparer(ctx, resourceGroupName, siteName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp", nil, "Failure preparing request") + return + } + + resp, err := client.ResetAllFiltersForWebAppSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp", resp, "Failure sending request") + return + } + + result, err = client.ResetAllFiltersForWebAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp", resp, "Failure responding to request") + return + } + + return +} + +// ResetAllFiltersForWebAppPreparer prepares the ResetAllFiltersForWebApp request. +func (client RecommendationsClient) ResetAllFiltersForWebAppPreparer(ctx context.Context, resourceGroupName string, siteName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/reset", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetAllFiltersForWebAppSender sends the ResetAllFiltersForWebApp request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) ResetAllFiltersForWebAppSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ResetAllFiltersForWebAppResponder handles the response to the ResetAllFiltersForWebApp request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) ResetAllFiltersForWebAppResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/resourcehealthmetadata.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/resourcehealthmetadata.go new file mode 100644 index 000000000000..ab5b103ac541 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/resourcehealthmetadata.go @@ -0,0 +1,695 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ResourceHealthMetadataClient is the webSite Management Client +type ResourceHealthMetadataClient struct { + BaseClient +} + +// NewResourceHealthMetadataClient creates an instance of the ResourceHealthMetadataClient client. +func NewResourceHealthMetadataClient(subscriptionID string) ResourceHealthMetadataClient { + return NewResourceHealthMetadataClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResourceHealthMetadataClientWithBaseURI creates an instance of the ResourceHealthMetadataClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewResourceHealthMetadataClientWithBaseURI(baseURI string, subscriptionID string) ResourceHealthMetadataClient { + return ResourceHealthMetadataClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetBySite description for Gets the category of ResourceHealthMetadata to use for the given site +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app +func (client ResourceHealthMetadataClient) GetBySite(ctx context.Context, resourceGroupName string, name string) (result ResourceHealthMetadata, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceHealthMetadataClient.GetBySite") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.ResourceHealthMetadataClient", "GetBySite", err.Error()) + } + + req, err := client.GetBySitePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "GetBySite", nil, "Failure preparing request") + return + } + + resp, err := client.GetBySiteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "GetBySite", resp, "Failure sending request") + return + } + + result, err = client.GetBySiteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "GetBySite", resp, "Failure responding to request") + return + } + + return +} + +// GetBySitePreparer prepares the GetBySite request. +func (client ResourceHealthMetadataClient) GetBySitePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBySiteSender sends the GetBySite request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceHealthMetadataClient) GetBySiteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBySiteResponder handles the response to the GetBySite request. The method always +// closes the http.Response Body. +func (client ResourceHealthMetadataClient) GetBySiteResponder(resp *http.Response) (result ResourceHealthMetadata, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBySiteSlot description for Gets the category of ResourceHealthMetadata to use for the given site +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app +// slot - name of web app slot. If not specified then will default to production slot. +func (client ResourceHealthMetadataClient) GetBySiteSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result ResourceHealthMetadata, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceHealthMetadataClient.GetBySiteSlot") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.ResourceHealthMetadataClient", "GetBySiteSlot", err.Error()) + } + + req, err := client.GetBySiteSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "GetBySiteSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetBySiteSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "GetBySiteSlot", resp, "Failure sending request") + return + } + + result, err = client.GetBySiteSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "GetBySiteSlot", resp, "Failure responding to request") + return + } + + return +} + +// GetBySiteSlotPreparer prepares the GetBySiteSlot request. +func (client ResourceHealthMetadataClient) GetBySiteSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBySiteSlotSender sends the GetBySiteSlot request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceHealthMetadataClient) GetBySiteSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBySiteSlotResponder handles the response to the GetBySiteSlot request. The method always +// closes the http.Response Body. +func (client ResourceHealthMetadataClient) GetBySiteSlotResponder(resp *http.Response) (result ResourceHealthMetadata, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List description for List all ResourceHealthMetadata for all sites in the subscription. +func (client ResourceHealthMetadataClient) List(ctx context.Context) (result ResourceHealthMetadataCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceHealthMetadataClient.List") + defer func() { + sc := -1 + if result.rhmc.Response.Response != nil { + sc = result.rhmc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rhmc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "List", resp, "Failure sending request") + return + } + + result.rhmc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "List", resp, "Failure responding to request") + return + } + if result.rhmc.hasNextLink() && result.rhmc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ResourceHealthMetadataClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceHealthMetadataClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ResourceHealthMetadataClient) ListResponder(resp *http.Response) (result ResourceHealthMetadataCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ResourceHealthMetadataClient) listNextResults(ctx context.Context, lastResults ResourceHealthMetadataCollection) (result ResourceHealthMetadataCollection, err error) { + req, err := lastResults.resourceHealthMetadataCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ResourceHealthMetadataClient) ListComplete(ctx context.Context) (result ResourceHealthMetadataCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceHealthMetadataClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup description for List all ResourceHealthMetadata for all sites in the resource group in the +// subscription. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +func (client ResourceHealthMetadataClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ResourceHealthMetadataCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceHealthMetadataClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.rhmc.Response.Response != nil { + sc = result.rhmc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.ResourceHealthMetadataClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.rhmc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.rhmc, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.rhmc.hasNextLink() && result.rhmc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ResourceHealthMetadataClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceHealthMetadataClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ResourceHealthMetadataClient) ListByResourceGroupResponder(resp *http.Response) (result ResourceHealthMetadataCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ResourceHealthMetadataClient) listByResourceGroupNextResults(ctx context.Context, lastResults ResourceHealthMetadataCollection) (result ResourceHealthMetadataCollection, err error) { + req, err := lastResults.resourceHealthMetadataCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ResourceHealthMetadataClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ResourceHealthMetadataCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceHealthMetadataClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySite description for Gets the category of ResourceHealthMetadata to use for the given site as a collection +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +func (client ResourceHealthMetadataClient) ListBySite(ctx context.Context, resourceGroupName string, name string) (result ResourceHealthMetadataCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceHealthMetadataClient.ListBySite") + defer func() { + sc := -1 + if result.rhmc.Response.Response != nil { + sc = result.rhmc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.ResourceHealthMetadataClient", "ListBySite", err.Error()) + } + + result.fn = client.listBySiteNextResults + req, err := client.ListBySitePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListBySite", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySiteSender(req) + if err != nil { + result.rhmc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListBySite", resp, "Failure sending request") + return + } + + result.rhmc, err = client.ListBySiteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListBySite", resp, "Failure responding to request") + return + } + if result.rhmc.hasNextLink() && result.rhmc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySitePreparer prepares the ListBySite request. +func (client ResourceHealthMetadataClient) ListBySitePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySiteSender sends the ListBySite request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceHealthMetadataClient) ListBySiteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySiteResponder handles the response to the ListBySite request. The method always +// closes the http.Response Body. +func (client ResourceHealthMetadataClient) ListBySiteResponder(resp *http.Response) (result ResourceHealthMetadataCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySiteNextResults retrieves the next set of results, if any. +func (client ResourceHealthMetadataClient) listBySiteNextResults(ctx context.Context, lastResults ResourceHealthMetadataCollection) (result ResourceHealthMetadataCollection, err error) { + req, err := lastResults.resourceHealthMetadataCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listBySiteNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySiteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listBySiteNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySiteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listBySiteNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySiteComplete enumerates all values, automatically crossing page boundaries as required. +func (client ResourceHealthMetadataClient) ListBySiteComplete(ctx context.Context, resourceGroupName string, name string) (result ResourceHealthMetadataCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceHealthMetadataClient.ListBySite") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySite(ctx, resourceGroupName, name) + return +} + +// ListBySiteSlot description for Gets the category of ResourceHealthMetadata to use for the given site as a collection +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// slot - name of web app slot. If not specified then will default to production slot. +func (client ResourceHealthMetadataClient) ListBySiteSlot(ctx context.Context, resourceGroupName string, name string, slot string) (result ResourceHealthMetadataCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceHealthMetadataClient.ListBySiteSlot") + defer func() { + sc := -1 + if result.rhmc.Response.Response != nil { + sc = result.rhmc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.ResourceHealthMetadataClient", "ListBySiteSlot", err.Error()) + } + + result.fn = client.listBySiteSlotNextResults + req, err := client.ListBySiteSlotPreparer(ctx, resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListBySiteSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySiteSlotSender(req) + if err != nil { + result.rhmc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListBySiteSlot", resp, "Failure sending request") + return + } + + result.rhmc, err = client.ListBySiteSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "ListBySiteSlot", resp, "Failure responding to request") + return + } + if result.rhmc.hasNextLink() && result.rhmc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySiteSlotPreparer prepares the ListBySiteSlot request. +func (client ResourceHealthMetadataClient) ListBySiteSlotPreparer(ctx context.Context, resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySiteSlotSender sends the ListBySiteSlot request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceHealthMetadataClient) ListBySiteSlotSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySiteSlotResponder handles the response to the ListBySiteSlot request. The method always +// closes the http.Response Body. +func (client ResourceHealthMetadataClient) ListBySiteSlotResponder(resp *http.Response) (result ResourceHealthMetadataCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySiteSlotNextResults retrieves the next set of results, if any. +func (client ResourceHealthMetadataClient) listBySiteSlotNextResults(ctx context.Context, lastResults ResourceHealthMetadataCollection) (result ResourceHealthMetadataCollection, err error) { + req, err := lastResults.resourceHealthMetadataCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listBySiteSlotNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySiteSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listBySiteSlotNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySiteSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ResourceHealthMetadataClient", "listBySiteSlotNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySiteSlotComplete enumerates all values, automatically crossing page boundaries as required. +func (client ResourceHealthMetadataClient) ListBySiteSlotComplete(ctx context.Context, resourceGroupName string, name string, slot string) (result ResourceHealthMetadataCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceHealthMetadataClient.ListBySiteSlot") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySiteSlot(ctx, resourceGroupName, name, slot) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/staticsites.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/staticsites.go new file mode 100644 index 000000000000..1019f5b91c9d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/staticsites.go @@ -0,0 +1,4631 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// StaticSitesClient is the webSite Management Client +type StaticSitesClient struct { + BaseClient +} + +// NewStaticSitesClient creates an instance of the StaticSitesClient client. +func NewStaticSitesClient(subscriptionID string) StaticSitesClient { + return NewStaticSitesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewStaticSitesClientWithBaseURI creates an instance of the StaticSitesClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewStaticSitesClientWithBaseURI(baseURI string, subscriptionID string) StaticSitesClient { + return StaticSitesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ApproveOrRejectPrivateEndpointConnection description for Approves or rejects a private endpoint connection +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// privateEndpointConnectionName - name of the private endpoint connection. +// privateEndpointWrapper - request body. +func (client StaticSitesClient) ApproveOrRejectPrivateEndpointConnection(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, privateEndpointWrapper PrivateLinkConnectionApprovalRequestResource) (result StaticSitesApproveOrRejectPrivateEndpointConnectionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ApproveOrRejectPrivateEndpointConnection") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "ApproveOrRejectPrivateEndpointConnection", err.Error()) + } + + req, err := client.ApproveOrRejectPrivateEndpointConnectionPreparer(ctx, resourceGroupName, name, privateEndpointConnectionName, privateEndpointWrapper) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ApproveOrRejectPrivateEndpointConnection", nil, "Failure preparing request") + return + } + + result, err = client.ApproveOrRejectPrivateEndpointConnectionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ApproveOrRejectPrivateEndpointConnection", result.Response(), "Failure sending request") + return + } + + return +} + +// ApproveOrRejectPrivateEndpointConnectionPreparer prepares the ApproveOrRejectPrivateEndpointConnection request. +func (client StaticSitesClient) ApproveOrRejectPrivateEndpointConnectionPreparer(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, privateEndpointWrapper PrivateLinkConnectionApprovalRequestResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(privateEndpointWrapper), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ApproveOrRejectPrivateEndpointConnectionSender sends the ApproveOrRejectPrivateEndpointConnection request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) ApproveOrRejectPrivateEndpointConnectionSender(req *http.Request) (future StaticSitesApproveOrRejectPrivateEndpointConnectionFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ApproveOrRejectPrivateEndpointConnectionResponder handles the response to the ApproveOrRejectPrivateEndpointConnection request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) ApproveOrRejectPrivateEndpointConnectionResponder(resp *http.Response) (result RemotePrivateEndpointConnectionARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateStaticSite description for Creates a new static site in an existing resource group, or updates an +// existing static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site to create or update. +// staticSiteEnvelope - a JSON representation of the staticsite properties. See example. +func (client StaticSitesClient) CreateOrUpdateStaticSite(ctx context.Context, resourceGroupName string, name string, staticSiteEnvelope StaticSiteARMResource) (result StaticSitesCreateOrUpdateStaticSiteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.CreateOrUpdateStaticSite") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "CreateOrUpdateStaticSite", err.Error()) + } + + req, err := client.CreateOrUpdateStaticSitePreparer(ctx, resourceGroupName, name, staticSiteEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSite", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateStaticSiteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSite", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdateStaticSitePreparer prepares the CreateOrUpdateStaticSite request. +func (client StaticSitesClient) CreateOrUpdateStaticSitePreparer(ctx context.Context, resourceGroupName string, name string, staticSiteEnvelope StaticSiteARMResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}", pathParameters), + autorest.WithJSON(staticSiteEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateStaticSiteSender sends the CreateOrUpdateStaticSite request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) CreateOrUpdateStaticSiteSender(req *http.Request) (future StaticSitesCreateOrUpdateStaticSiteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateStaticSiteResponder handles the response to the CreateOrUpdateStaticSite request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) CreateOrUpdateStaticSiteResponder(resp *http.Response) (result StaticSiteARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateStaticSiteAppSettings description for Creates or updates the app settings of a static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// appSettings - the dictionary containing the static site app settings to update. +func (client StaticSitesClient) CreateOrUpdateStaticSiteAppSettings(ctx context.Context, resourceGroupName string, name string, appSettings StringDictionary) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.CreateOrUpdateStaticSiteAppSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "CreateOrUpdateStaticSiteAppSettings", err.Error()) + } + + req, err := client.CreateOrUpdateStaticSiteAppSettingsPreparer(ctx, resourceGroupName, name, appSettings) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSiteAppSettings", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateStaticSiteAppSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSiteAppSettings", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateStaticSiteAppSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSiteAppSettings", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateStaticSiteAppSettingsPreparer prepares the CreateOrUpdateStaticSiteAppSettings request. +func (client StaticSitesClient) CreateOrUpdateStaticSiteAppSettingsPreparer(ctx context.Context, resourceGroupName string, name string, appSettings StringDictionary) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/config/appsettings", pathParameters), + autorest.WithJSON(appSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateStaticSiteAppSettingsSender sends the CreateOrUpdateStaticSiteAppSettings request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) CreateOrUpdateStaticSiteAppSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateStaticSiteAppSettingsResponder handles the response to the CreateOrUpdateStaticSiteAppSettings request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) CreateOrUpdateStaticSiteAppSettingsResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateStaticSiteBuildAppSettings description for Creates or updates the app settings of a static site build. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// environmentName - the stage site identifier. +// appSettings - the dictionary containing the static site app settings to update. +func (client StaticSitesClient) CreateOrUpdateStaticSiteBuildAppSettings(ctx context.Context, resourceGroupName string, name string, environmentName string, appSettings StringDictionary) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.CreateOrUpdateStaticSiteBuildAppSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "CreateOrUpdateStaticSiteBuildAppSettings", err.Error()) + } + + req, err := client.CreateOrUpdateStaticSiteBuildAppSettingsPreparer(ctx, resourceGroupName, name, environmentName, appSettings) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSiteBuildAppSettings", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateStaticSiteBuildAppSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSiteBuildAppSettings", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateStaticSiteBuildAppSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSiteBuildAppSettings", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateStaticSiteBuildAppSettingsPreparer prepares the CreateOrUpdateStaticSiteBuildAppSettings request. +func (client StaticSitesClient) CreateOrUpdateStaticSiteBuildAppSettingsPreparer(ctx context.Context, resourceGroupName string, name string, environmentName string, appSettings StringDictionary) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}/config/appsettings", pathParameters), + autorest.WithJSON(appSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateStaticSiteBuildAppSettingsSender sends the CreateOrUpdateStaticSiteBuildAppSettings request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) CreateOrUpdateStaticSiteBuildAppSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateStaticSiteBuildAppSettingsResponder handles the response to the CreateOrUpdateStaticSiteBuildAppSettings request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) CreateOrUpdateStaticSiteBuildAppSettingsResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateStaticSiteBuildFunctionAppSettings description for Creates or updates the function app settings of a +// static site build. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// environmentName - the stage site identifier. +// appSettings - the dictionary containing the static site function app settings to update. +func (client StaticSitesClient) CreateOrUpdateStaticSiteBuildFunctionAppSettings(ctx context.Context, resourceGroupName string, name string, environmentName string, appSettings StringDictionary) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.CreateOrUpdateStaticSiteBuildFunctionAppSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "CreateOrUpdateStaticSiteBuildFunctionAppSettings", err.Error()) + } + + req, err := client.CreateOrUpdateStaticSiteBuildFunctionAppSettingsPreparer(ctx, resourceGroupName, name, environmentName, appSettings) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSiteBuildFunctionAppSettings", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateStaticSiteBuildFunctionAppSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSiteBuildFunctionAppSettings", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateStaticSiteBuildFunctionAppSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSiteBuildFunctionAppSettings", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateStaticSiteBuildFunctionAppSettingsPreparer prepares the CreateOrUpdateStaticSiteBuildFunctionAppSettings request. +func (client StaticSitesClient) CreateOrUpdateStaticSiteBuildFunctionAppSettingsPreparer(ctx context.Context, resourceGroupName string, name string, environmentName string, appSettings StringDictionary) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}/config/functionappsettings", pathParameters), + autorest.WithJSON(appSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateStaticSiteBuildFunctionAppSettingsSender sends the CreateOrUpdateStaticSiteBuildFunctionAppSettings request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) CreateOrUpdateStaticSiteBuildFunctionAppSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateStaticSiteBuildFunctionAppSettingsResponder handles the response to the CreateOrUpdateStaticSiteBuildFunctionAppSettings request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) CreateOrUpdateStaticSiteBuildFunctionAppSettingsResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateStaticSiteCustomDomain description for Creates a new static site custom domain in an existing resource +// group and static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// domainName - the custom domain to create. +// staticSiteCustomDomainRequestPropertiesEnvelope - a JSON representation of the static site custom domain +// request properties. See example. +func (client StaticSitesClient) CreateOrUpdateStaticSiteCustomDomain(ctx context.Context, resourceGroupName string, name string, domainName string, staticSiteCustomDomainRequestPropertiesEnvelope StaticSiteCustomDomainRequestPropertiesARMResource) (result StaticSitesCreateOrUpdateStaticSiteCustomDomainFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.CreateOrUpdateStaticSiteCustomDomain") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "CreateOrUpdateStaticSiteCustomDomain", err.Error()) + } + + req, err := client.CreateOrUpdateStaticSiteCustomDomainPreparer(ctx, resourceGroupName, name, domainName, staticSiteCustomDomainRequestPropertiesEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSiteCustomDomain", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateStaticSiteCustomDomainSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSiteCustomDomain", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdateStaticSiteCustomDomainPreparer prepares the CreateOrUpdateStaticSiteCustomDomain request. +func (client StaticSitesClient) CreateOrUpdateStaticSiteCustomDomainPreparer(ctx context.Context, resourceGroupName string, name string, domainName string, staticSiteCustomDomainRequestPropertiesEnvelope StaticSiteCustomDomainRequestPropertiesARMResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName}", pathParameters), + autorest.WithJSON(staticSiteCustomDomainRequestPropertiesEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateStaticSiteCustomDomainSender sends the CreateOrUpdateStaticSiteCustomDomain request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) CreateOrUpdateStaticSiteCustomDomainSender(req *http.Request) (future StaticSitesCreateOrUpdateStaticSiteCustomDomainFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateStaticSiteCustomDomainResponder handles the response to the CreateOrUpdateStaticSiteCustomDomain request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) CreateOrUpdateStaticSiteCustomDomainResponder(resp *http.Response) (result StaticSiteCustomDomainOverviewARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateStaticSiteFunctionAppSettings description for Creates or updates the function app settings of a static +// site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// appSettings - the dictionary containing the static site function app settings to update. +func (client StaticSitesClient) CreateOrUpdateStaticSiteFunctionAppSettings(ctx context.Context, resourceGroupName string, name string, appSettings StringDictionary) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.CreateOrUpdateStaticSiteFunctionAppSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "CreateOrUpdateStaticSiteFunctionAppSettings", err.Error()) + } + + req, err := client.CreateOrUpdateStaticSiteFunctionAppSettingsPreparer(ctx, resourceGroupName, name, appSettings) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSiteFunctionAppSettings", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateStaticSiteFunctionAppSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSiteFunctionAppSettings", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateStaticSiteFunctionAppSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateOrUpdateStaticSiteFunctionAppSettings", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateStaticSiteFunctionAppSettingsPreparer prepares the CreateOrUpdateStaticSiteFunctionAppSettings request. +func (client StaticSitesClient) CreateOrUpdateStaticSiteFunctionAppSettingsPreparer(ctx context.Context, resourceGroupName string, name string, appSettings StringDictionary) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/config/functionappsettings", pathParameters), + autorest.WithJSON(appSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateStaticSiteFunctionAppSettingsSender sends the CreateOrUpdateStaticSiteFunctionAppSettings request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) CreateOrUpdateStaticSiteFunctionAppSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateStaticSiteFunctionAppSettingsResponder handles the response to the CreateOrUpdateStaticSiteFunctionAppSettings request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) CreateOrUpdateStaticSiteFunctionAppSettingsResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateUserRolesInvitationLink description for Creates an invitation link for a user with the role +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +func (client StaticSitesClient) CreateUserRolesInvitationLink(ctx context.Context, resourceGroupName string, name string, staticSiteUserRolesInvitationEnvelope StaticSiteUserInvitationRequestResource) (result StaticSiteUserInvitationResponseResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.CreateUserRolesInvitationLink") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "CreateUserRolesInvitationLink", err.Error()) + } + + req, err := client.CreateUserRolesInvitationLinkPreparer(ctx, resourceGroupName, name, staticSiteUserRolesInvitationEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateUserRolesInvitationLink", nil, "Failure preparing request") + return + } + + resp, err := client.CreateUserRolesInvitationLinkSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateUserRolesInvitationLink", resp, "Failure sending request") + return + } + + result, err = client.CreateUserRolesInvitationLinkResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateUserRolesInvitationLink", resp, "Failure responding to request") + return + } + + return +} + +// CreateUserRolesInvitationLinkPreparer prepares the CreateUserRolesInvitationLink request. +func (client StaticSitesClient) CreateUserRolesInvitationLinkPreparer(ctx context.Context, resourceGroupName string, name string, staticSiteUserRolesInvitationEnvelope StaticSiteUserInvitationRequestResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/createUserInvitation", pathParameters), + autorest.WithJSON(staticSiteUserRolesInvitationEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateUserRolesInvitationLinkSender sends the CreateUserRolesInvitationLink request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) CreateUserRolesInvitationLinkSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateUserRolesInvitationLinkResponder handles the response to the CreateUserRolesInvitationLink request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) CreateUserRolesInvitationLinkResponder(resp *http.Response) (result StaticSiteUserInvitationResponseResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateZipDeploymentForStaticSite description for Deploys zipped content to a static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// staticSiteZipDeploymentEnvelope - a JSON representation of the StaticSiteZipDeployment properties. See +// example. +func (client StaticSitesClient) CreateZipDeploymentForStaticSite(ctx context.Context, resourceGroupName string, name string, staticSiteZipDeploymentEnvelope StaticSiteZipDeploymentARMResource) (result StaticSitesCreateZipDeploymentForStaticSiteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.CreateZipDeploymentForStaticSite") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "CreateZipDeploymentForStaticSite", err.Error()) + } + + req, err := client.CreateZipDeploymentForStaticSitePreparer(ctx, resourceGroupName, name, staticSiteZipDeploymentEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateZipDeploymentForStaticSite", nil, "Failure preparing request") + return + } + + result, err = client.CreateZipDeploymentForStaticSiteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateZipDeploymentForStaticSite", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateZipDeploymentForStaticSitePreparer prepares the CreateZipDeploymentForStaticSite request. +func (client StaticSitesClient) CreateZipDeploymentForStaticSitePreparer(ctx context.Context, resourceGroupName string, name string, staticSiteZipDeploymentEnvelope StaticSiteZipDeploymentARMResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/zipdeploy", pathParameters), + autorest.WithJSON(staticSiteZipDeploymentEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateZipDeploymentForStaticSiteSender sends the CreateZipDeploymentForStaticSite request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) CreateZipDeploymentForStaticSiteSender(req *http.Request) (future StaticSitesCreateZipDeploymentForStaticSiteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateZipDeploymentForStaticSiteResponder handles the response to the CreateZipDeploymentForStaticSite request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) CreateZipDeploymentForStaticSiteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateZipDeploymentForStaticSiteBuild description for Deploys zipped content to a specific environment of a static +// site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// environmentName - name of the environment. +// staticSiteZipDeploymentEnvelope - a JSON representation of the StaticSiteZipDeployment properties. See +// example. +func (client StaticSitesClient) CreateZipDeploymentForStaticSiteBuild(ctx context.Context, resourceGroupName string, name string, environmentName string, staticSiteZipDeploymentEnvelope StaticSiteZipDeploymentARMResource) (result StaticSitesCreateZipDeploymentForStaticSiteBuildFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.CreateZipDeploymentForStaticSiteBuild") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "CreateZipDeploymentForStaticSiteBuild", err.Error()) + } + + req, err := client.CreateZipDeploymentForStaticSiteBuildPreparer(ctx, resourceGroupName, name, environmentName, staticSiteZipDeploymentEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateZipDeploymentForStaticSiteBuild", nil, "Failure preparing request") + return + } + + result, err = client.CreateZipDeploymentForStaticSiteBuildSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "CreateZipDeploymentForStaticSiteBuild", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateZipDeploymentForStaticSiteBuildPreparer prepares the CreateZipDeploymentForStaticSiteBuild request. +func (client StaticSitesClient) CreateZipDeploymentForStaticSiteBuildPreparer(ctx context.Context, resourceGroupName string, name string, environmentName string, staticSiteZipDeploymentEnvelope StaticSiteZipDeploymentARMResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}/zipdeploy", pathParameters), + autorest.WithJSON(staticSiteZipDeploymentEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateZipDeploymentForStaticSiteBuildSender sends the CreateZipDeploymentForStaticSiteBuild request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) CreateZipDeploymentForStaticSiteBuildSender(req *http.Request) (future StaticSitesCreateZipDeploymentForStaticSiteBuildFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateZipDeploymentForStaticSiteBuildResponder handles the response to the CreateZipDeploymentForStaticSiteBuild request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) CreateZipDeploymentForStaticSiteBuildResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeletePrivateEndpointConnection description for Deletes a private endpoint connection +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// privateEndpointConnectionName - name of the private endpoint connection. +func (client StaticSitesClient) DeletePrivateEndpointConnection(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (result StaticSitesDeletePrivateEndpointConnectionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.DeletePrivateEndpointConnection") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "DeletePrivateEndpointConnection", err.Error()) + } + + req, err := client.DeletePrivateEndpointConnectionPreparer(ctx, resourceGroupName, name, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DeletePrivateEndpointConnection", nil, "Failure preparing request") + return + } + + result, err = client.DeletePrivateEndpointConnectionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DeletePrivateEndpointConnection", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePrivateEndpointConnectionPreparer prepares the DeletePrivateEndpointConnection request. +func (client StaticSitesClient) DeletePrivateEndpointConnectionPreparer(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePrivateEndpointConnectionSender sends the DeletePrivateEndpointConnection request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) DeletePrivateEndpointConnectionSender(req *http.Request) (future StaticSitesDeletePrivateEndpointConnectionFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeletePrivateEndpointConnectionResponder handles the response to the DeletePrivateEndpointConnection request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) DeletePrivateEndpointConnectionResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteStaticSite description for Deletes a static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site to delete. +func (client StaticSitesClient) DeleteStaticSite(ctx context.Context, resourceGroupName string, name string) (result StaticSitesDeleteStaticSiteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.DeleteStaticSite") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "DeleteStaticSite", err.Error()) + } + + req, err := client.DeleteStaticSitePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DeleteStaticSite", nil, "Failure preparing request") + return + } + + result, err = client.DeleteStaticSiteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DeleteStaticSite", result.Response(), "Failure sending request") + return + } + + return +} + +// DeleteStaticSitePreparer prepares the DeleteStaticSite request. +func (client StaticSitesClient) DeleteStaticSitePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteStaticSiteSender sends the DeleteStaticSite request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) DeleteStaticSiteSender(req *http.Request) (future StaticSitesDeleteStaticSiteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteStaticSiteResponder handles the response to the DeleteStaticSite request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) DeleteStaticSiteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteStaticSiteBuild description for Deletes a static site build. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// environmentName - the stage site identifier. +func (client StaticSitesClient) DeleteStaticSiteBuild(ctx context.Context, resourceGroupName string, name string, environmentName string) (result StaticSitesDeleteStaticSiteBuildFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.DeleteStaticSiteBuild") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "DeleteStaticSiteBuild", err.Error()) + } + + req, err := client.DeleteStaticSiteBuildPreparer(ctx, resourceGroupName, name, environmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DeleteStaticSiteBuild", nil, "Failure preparing request") + return + } + + result, err = client.DeleteStaticSiteBuildSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DeleteStaticSiteBuild", result.Response(), "Failure sending request") + return + } + + return +} + +// DeleteStaticSiteBuildPreparer prepares the DeleteStaticSiteBuild request. +func (client StaticSitesClient) DeleteStaticSiteBuildPreparer(ctx context.Context, resourceGroupName string, name string, environmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteStaticSiteBuildSender sends the DeleteStaticSiteBuild request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) DeleteStaticSiteBuildSender(req *http.Request) (future StaticSitesDeleteStaticSiteBuildFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteStaticSiteBuildResponder handles the response to the DeleteStaticSiteBuild request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) DeleteStaticSiteBuildResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteStaticSiteCustomDomain description for Deletes a custom domain. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// domainName - the custom domain to delete. +func (client StaticSitesClient) DeleteStaticSiteCustomDomain(ctx context.Context, resourceGroupName string, name string, domainName string) (result StaticSitesDeleteStaticSiteCustomDomainFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.DeleteStaticSiteCustomDomain") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "DeleteStaticSiteCustomDomain", err.Error()) + } + + req, err := client.DeleteStaticSiteCustomDomainPreparer(ctx, resourceGroupName, name, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DeleteStaticSiteCustomDomain", nil, "Failure preparing request") + return + } + + result, err = client.DeleteStaticSiteCustomDomainSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DeleteStaticSiteCustomDomain", result.Response(), "Failure sending request") + return + } + + return +} + +// DeleteStaticSiteCustomDomainPreparer prepares the DeleteStaticSiteCustomDomain request. +func (client StaticSitesClient) DeleteStaticSiteCustomDomainPreparer(ctx context.Context, resourceGroupName string, name string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteStaticSiteCustomDomainSender sends the DeleteStaticSiteCustomDomain request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) DeleteStaticSiteCustomDomainSender(req *http.Request) (future StaticSitesDeleteStaticSiteCustomDomainFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteStaticSiteCustomDomainResponder handles the response to the DeleteStaticSiteCustomDomain request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) DeleteStaticSiteCustomDomainResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteStaticSiteUser description for Deletes the user entry from the static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the staticsite. +// authprovider - the auth provider for this user. +// userid - the user id of the user. +func (client StaticSitesClient) DeleteStaticSiteUser(ctx context.Context, resourceGroupName string, name string, authprovider string, userid string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.DeleteStaticSiteUser") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "DeleteStaticSiteUser", err.Error()) + } + + req, err := client.DeleteStaticSiteUserPreparer(ctx, resourceGroupName, name, authprovider, userid) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DeleteStaticSiteUser", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteStaticSiteUserSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DeleteStaticSiteUser", resp, "Failure sending request") + return + } + + result, err = client.DeleteStaticSiteUserResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DeleteStaticSiteUser", resp, "Failure responding to request") + return + } + + return +} + +// DeleteStaticSiteUserPreparer prepares the DeleteStaticSiteUser request. +func (client StaticSitesClient) DeleteStaticSiteUserPreparer(ctx context.Context, resourceGroupName string, name string, authprovider string, userid string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authprovider": autorest.Encode("path", authprovider), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userid": autorest.Encode("path", userid), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/authproviders/{authprovider}/users/{userid}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteStaticSiteUserSender sends the DeleteStaticSiteUser request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) DeleteStaticSiteUserSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteStaticSiteUserResponder handles the response to the DeleteStaticSiteUser request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) DeleteStaticSiteUserResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DetachStaticSite description for Detaches a static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site to detach. +func (client StaticSitesClient) DetachStaticSite(ctx context.Context, resourceGroupName string, name string) (result StaticSitesDetachStaticSiteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.DetachStaticSite") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "DetachStaticSite", err.Error()) + } + + req, err := client.DetachStaticSitePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DetachStaticSite", nil, "Failure preparing request") + return + } + + result, err = client.DetachStaticSiteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DetachStaticSite", result.Response(), "Failure sending request") + return + } + + return +} + +// DetachStaticSitePreparer prepares the DetachStaticSite request. +func (client StaticSitesClient) DetachStaticSitePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/detach", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetachStaticSiteSender sends the DetachStaticSite request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) DetachStaticSiteSender(req *http.Request) (future StaticSitesDetachStaticSiteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DetachStaticSiteResponder handles the response to the DetachStaticSite request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) DetachStaticSiteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DetachUserProvidedFunctionAppFromStaticSite description for Detach the user provided function app from the static +// site +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// functionAppName - name of the function app registered with the static site. +func (client StaticSitesClient) DetachUserProvidedFunctionAppFromStaticSite(ctx context.Context, resourceGroupName string, name string, functionAppName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.DetachUserProvidedFunctionAppFromStaticSite") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "DetachUserProvidedFunctionAppFromStaticSite", err.Error()) + } + + req, err := client.DetachUserProvidedFunctionAppFromStaticSitePreparer(ctx, resourceGroupName, name, functionAppName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DetachUserProvidedFunctionAppFromStaticSite", nil, "Failure preparing request") + return + } + + resp, err := client.DetachUserProvidedFunctionAppFromStaticSiteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DetachUserProvidedFunctionAppFromStaticSite", resp, "Failure sending request") + return + } + + result, err = client.DetachUserProvidedFunctionAppFromStaticSiteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DetachUserProvidedFunctionAppFromStaticSite", resp, "Failure responding to request") + return + } + + return +} + +// DetachUserProvidedFunctionAppFromStaticSitePreparer prepares the DetachUserProvidedFunctionAppFromStaticSite request. +func (client StaticSitesClient) DetachUserProvidedFunctionAppFromStaticSitePreparer(ctx context.Context, resourceGroupName string, name string, functionAppName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionAppName": autorest.Encode("path", functionAppName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/userProvidedFunctionApps/{functionAppName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetachUserProvidedFunctionAppFromStaticSiteSender sends the DetachUserProvidedFunctionAppFromStaticSite request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) DetachUserProvidedFunctionAppFromStaticSiteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DetachUserProvidedFunctionAppFromStaticSiteResponder handles the response to the DetachUserProvidedFunctionAppFromStaticSite request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) DetachUserProvidedFunctionAppFromStaticSiteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DetachUserProvidedFunctionAppFromStaticSiteBuild description for Detach the user provided function app from the +// static site build +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// environmentName - the stage site identifier. +// functionAppName - name of the function app registered with the static site build. +func (client StaticSitesClient) DetachUserProvidedFunctionAppFromStaticSiteBuild(ctx context.Context, resourceGroupName string, name string, environmentName string, functionAppName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.DetachUserProvidedFunctionAppFromStaticSiteBuild") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "DetachUserProvidedFunctionAppFromStaticSiteBuild", err.Error()) + } + + req, err := client.DetachUserProvidedFunctionAppFromStaticSiteBuildPreparer(ctx, resourceGroupName, name, environmentName, functionAppName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DetachUserProvidedFunctionAppFromStaticSiteBuild", nil, "Failure preparing request") + return + } + + resp, err := client.DetachUserProvidedFunctionAppFromStaticSiteBuildSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DetachUserProvidedFunctionAppFromStaticSiteBuild", resp, "Failure sending request") + return + } + + result, err = client.DetachUserProvidedFunctionAppFromStaticSiteBuildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "DetachUserProvidedFunctionAppFromStaticSiteBuild", resp, "Failure responding to request") + return + } + + return +} + +// DetachUserProvidedFunctionAppFromStaticSiteBuildPreparer prepares the DetachUserProvidedFunctionAppFromStaticSiteBuild request. +func (client StaticSitesClient) DetachUserProvidedFunctionAppFromStaticSiteBuildPreparer(ctx context.Context, resourceGroupName string, name string, environmentName string, functionAppName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "functionAppName": autorest.Encode("path", functionAppName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}/userProvidedFunctionApps/{functionAppName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetachUserProvidedFunctionAppFromStaticSiteBuildSender sends the DetachUserProvidedFunctionAppFromStaticSiteBuild request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) DetachUserProvidedFunctionAppFromStaticSiteBuildSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DetachUserProvidedFunctionAppFromStaticSiteBuildResponder handles the response to the DetachUserProvidedFunctionAppFromStaticSiteBuild request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) DetachUserProvidedFunctionAppFromStaticSiteBuildResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetPrivateEndpointConnection description for Gets a private endpoint connection +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// privateEndpointConnectionName - name of the private endpoint connection. +func (client StaticSitesClient) GetPrivateEndpointConnection(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (result RemotePrivateEndpointConnectionARMResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetPrivateEndpointConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "GetPrivateEndpointConnection", err.Error()) + } + + req, err := client.GetPrivateEndpointConnectionPreparer(ctx, resourceGroupName, name, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetPrivateEndpointConnection", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateEndpointConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetPrivateEndpointConnection", resp, "Failure sending request") + return + } + + result, err = client.GetPrivateEndpointConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetPrivateEndpointConnection", resp, "Failure responding to request") + return + } + + return +} + +// GetPrivateEndpointConnectionPreparer prepares the GetPrivateEndpointConnection request. +func (client StaticSitesClient) GetPrivateEndpointConnectionPreparer(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateEndpointConnectionSender sends the GetPrivateEndpointConnection request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) GetPrivateEndpointConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateEndpointConnectionResponder handles the response to the GetPrivateEndpointConnection request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) GetPrivateEndpointConnectionResponder(resp *http.Response) (result RemotePrivateEndpointConnectionARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPrivateEndpointConnectionList description for Gets the list of private endpoint connections associated with a +// static site +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +func (client StaticSitesClient) GetPrivateEndpointConnectionList(ctx context.Context, resourceGroupName string, name string) (result PrivateEndpointConnectionCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetPrivateEndpointConnectionList") + defer func() { + sc := -1 + if result.pecc.Response.Response != nil { + sc = result.pecc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "GetPrivateEndpointConnectionList", err.Error()) + } + + result.fn = client.getPrivateEndpointConnectionListNextResults + req, err := client.GetPrivateEndpointConnectionListPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetPrivateEndpointConnectionList", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateEndpointConnectionListSender(req) + if err != nil { + result.pecc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetPrivateEndpointConnectionList", resp, "Failure sending request") + return + } + + result.pecc, err = client.GetPrivateEndpointConnectionListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetPrivateEndpointConnectionList", resp, "Failure responding to request") + return + } + if result.pecc.hasNextLink() && result.pecc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetPrivateEndpointConnectionListPreparer prepares the GetPrivateEndpointConnectionList request. +func (client StaticSitesClient) GetPrivateEndpointConnectionListPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateEndpointConnectionListSender sends the GetPrivateEndpointConnectionList request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) GetPrivateEndpointConnectionListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateEndpointConnectionListResponder handles the response to the GetPrivateEndpointConnectionList request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) GetPrivateEndpointConnectionListResponder(resp *http.Response) (result PrivateEndpointConnectionCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getPrivateEndpointConnectionListNextResults retrieves the next set of results, if any. +func (client StaticSitesClient) getPrivateEndpointConnectionListNextResults(ctx context.Context, lastResults PrivateEndpointConnectionCollection) (result PrivateEndpointConnectionCollection, err error) { + req, err := lastResults.privateEndpointConnectionCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "getPrivateEndpointConnectionListNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetPrivateEndpointConnectionListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "getPrivateEndpointConnectionListNextResults", resp, "Failure sending next results request") + } + result, err = client.GetPrivateEndpointConnectionListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "getPrivateEndpointConnectionListNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetPrivateEndpointConnectionListComplete enumerates all values, automatically crossing page boundaries as required. +func (client StaticSitesClient) GetPrivateEndpointConnectionListComplete(ctx context.Context, resourceGroupName string, name string) (result PrivateEndpointConnectionCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetPrivateEndpointConnectionList") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetPrivateEndpointConnectionList(ctx, resourceGroupName, name) + return +} + +// GetPrivateLinkResources description for Gets the private link resources +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the site. +func (client StaticSitesClient) GetPrivateLinkResources(ctx context.Context, resourceGroupName string, name string) (result PrivateLinkResourcesWrapper, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetPrivateLinkResources") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "GetPrivateLinkResources", err.Error()) + } + + req, err := client.GetPrivateLinkResourcesPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetPrivateLinkResources", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateLinkResourcesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetPrivateLinkResources", resp, "Failure sending request") + return + } + + result, err = client.GetPrivateLinkResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetPrivateLinkResources", resp, "Failure responding to request") + return + } + + return +} + +// GetPrivateLinkResourcesPreparer prepares the GetPrivateLinkResources request. +func (client StaticSitesClient) GetPrivateLinkResourcesPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateLinkResourcesSender sends the GetPrivateLinkResources request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) GetPrivateLinkResourcesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateLinkResourcesResponder handles the response to the GetPrivateLinkResources request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) GetPrivateLinkResourcesResponder(resp *http.Response) (result PrivateLinkResourcesWrapper, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetStaticSite description for Gets the details of a static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +func (client StaticSitesClient) GetStaticSite(ctx context.Context, resourceGroupName string, name string) (result StaticSiteARMResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetStaticSite") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "GetStaticSite", err.Error()) + } + + req, err := client.GetStaticSitePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetStaticSite", nil, "Failure preparing request") + return + } + + resp, err := client.GetStaticSiteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetStaticSite", resp, "Failure sending request") + return + } + + result, err = client.GetStaticSiteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetStaticSite", resp, "Failure responding to request") + return + } + + return +} + +// GetStaticSitePreparer prepares the GetStaticSite request. +func (client StaticSitesClient) GetStaticSitePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetStaticSiteSender sends the GetStaticSite request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) GetStaticSiteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetStaticSiteResponder handles the response to the GetStaticSite request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) GetStaticSiteResponder(resp *http.Response) (result StaticSiteARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetStaticSiteBuild description for Gets the details of a static site build. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// environmentName - the stage site identifier. +func (client StaticSitesClient) GetStaticSiteBuild(ctx context.Context, resourceGroupName string, name string, environmentName string) (result StaticSiteBuildARMResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetStaticSiteBuild") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "GetStaticSiteBuild", err.Error()) + } + + req, err := client.GetStaticSiteBuildPreparer(ctx, resourceGroupName, name, environmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetStaticSiteBuild", nil, "Failure preparing request") + return + } + + resp, err := client.GetStaticSiteBuildSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetStaticSiteBuild", resp, "Failure sending request") + return + } + + result, err = client.GetStaticSiteBuildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetStaticSiteBuild", resp, "Failure responding to request") + return + } + + return +} + +// GetStaticSiteBuildPreparer prepares the GetStaticSiteBuild request. +func (client StaticSitesClient) GetStaticSiteBuildPreparer(ctx context.Context, resourceGroupName string, name string, environmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetStaticSiteBuildSender sends the GetStaticSiteBuild request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) GetStaticSiteBuildSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetStaticSiteBuildResponder handles the response to the GetStaticSiteBuild request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) GetStaticSiteBuildResponder(resp *http.Response) (result StaticSiteBuildARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetStaticSiteBuilds description for Gets all static site builds for a particular static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +func (client StaticSitesClient) GetStaticSiteBuilds(ctx context.Context, resourceGroupName string, name string) (result StaticSiteBuildCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetStaticSiteBuilds") + defer func() { + sc := -1 + if result.ssbc.Response.Response != nil { + sc = result.ssbc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "GetStaticSiteBuilds", err.Error()) + } + + result.fn = client.getStaticSiteBuildsNextResults + req, err := client.GetStaticSiteBuildsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetStaticSiteBuilds", nil, "Failure preparing request") + return + } + + resp, err := client.GetStaticSiteBuildsSender(req) + if err != nil { + result.ssbc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetStaticSiteBuilds", resp, "Failure sending request") + return + } + + result.ssbc, err = client.GetStaticSiteBuildsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetStaticSiteBuilds", resp, "Failure responding to request") + return + } + if result.ssbc.hasNextLink() && result.ssbc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetStaticSiteBuildsPreparer prepares the GetStaticSiteBuilds request. +func (client StaticSitesClient) GetStaticSiteBuildsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetStaticSiteBuildsSender sends the GetStaticSiteBuilds request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) GetStaticSiteBuildsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetStaticSiteBuildsResponder handles the response to the GetStaticSiteBuilds request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) GetStaticSiteBuildsResponder(resp *http.Response) (result StaticSiteBuildCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getStaticSiteBuildsNextResults retrieves the next set of results, if any. +func (client StaticSitesClient) getStaticSiteBuildsNextResults(ctx context.Context, lastResults StaticSiteBuildCollection) (result StaticSiteBuildCollection, err error) { + req, err := lastResults.staticSiteBuildCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "getStaticSiteBuildsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetStaticSiteBuildsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "getStaticSiteBuildsNextResults", resp, "Failure sending next results request") + } + result, err = client.GetStaticSiteBuildsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "getStaticSiteBuildsNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetStaticSiteBuildsComplete enumerates all values, automatically crossing page boundaries as required. +func (client StaticSitesClient) GetStaticSiteBuildsComplete(ctx context.Context, resourceGroupName string, name string) (result StaticSiteBuildCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetStaticSiteBuilds") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetStaticSiteBuilds(ctx, resourceGroupName, name) + return +} + +// GetStaticSiteCustomDomain description for Gets an existing custom domain for a particular static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site resource to search in. +// domainName - the custom domain name. +func (client StaticSitesClient) GetStaticSiteCustomDomain(ctx context.Context, resourceGroupName string, name string, domainName string) (result StaticSiteCustomDomainOverviewARMResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetStaticSiteCustomDomain") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "GetStaticSiteCustomDomain", err.Error()) + } + + req, err := client.GetStaticSiteCustomDomainPreparer(ctx, resourceGroupName, name, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetStaticSiteCustomDomain", nil, "Failure preparing request") + return + } + + resp, err := client.GetStaticSiteCustomDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetStaticSiteCustomDomain", resp, "Failure sending request") + return + } + + result, err = client.GetStaticSiteCustomDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetStaticSiteCustomDomain", resp, "Failure responding to request") + return + } + + return +} + +// GetStaticSiteCustomDomainPreparer prepares the GetStaticSiteCustomDomain request. +func (client StaticSitesClient) GetStaticSiteCustomDomainPreparer(ctx context.Context, resourceGroupName string, name string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetStaticSiteCustomDomainSender sends the GetStaticSiteCustomDomain request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) GetStaticSiteCustomDomainSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetStaticSiteCustomDomainResponder handles the response to the GetStaticSiteCustomDomain request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) GetStaticSiteCustomDomainResponder(resp *http.Response) (result StaticSiteCustomDomainOverviewARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetStaticSitesByResourceGroup description for Gets all static sites in the specified resource group. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +func (client StaticSitesClient) GetStaticSitesByResourceGroup(ctx context.Context, resourceGroupName string) (result StaticSiteCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetStaticSitesByResourceGroup") + defer func() { + sc := -1 + if result.ssc.Response.Response != nil { + sc = result.ssc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "GetStaticSitesByResourceGroup", err.Error()) + } + + result.fn = client.getStaticSitesByResourceGroupNextResults + req, err := client.GetStaticSitesByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetStaticSitesByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.GetStaticSitesByResourceGroupSender(req) + if err != nil { + result.ssc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetStaticSitesByResourceGroup", resp, "Failure sending request") + return + } + + result.ssc, err = client.GetStaticSitesByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetStaticSitesByResourceGroup", resp, "Failure responding to request") + return + } + if result.ssc.hasNextLink() && result.ssc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetStaticSitesByResourceGroupPreparer prepares the GetStaticSitesByResourceGroup request. +func (client StaticSitesClient) GetStaticSitesByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetStaticSitesByResourceGroupSender sends the GetStaticSitesByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) GetStaticSitesByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetStaticSitesByResourceGroupResponder handles the response to the GetStaticSitesByResourceGroup request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) GetStaticSitesByResourceGroupResponder(resp *http.Response) (result StaticSiteCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getStaticSitesByResourceGroupNextResults retrieves the next set of results, if any. +func (client StaticSitesClient) getStaticSitesByResourceGroupNextResults(ctx context.Context, lastResults StaticSiteCollection) (result StaticSiteCollection, err error) { + req, err := lastResults.staticSiteCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "getStaticSitesByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetStaticSitesByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "getStaticSitesByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.GetStaticSitesByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "getStaticSitesByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetStaticSitesByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client StaticSitesClient) GetStaticSitesByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result StaticSiteCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetStaticSitesByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetStaticSitesByResourceGroup(ctx, resourceGroupName) + return +} + +// GetUserProvidedFunctionAppForStaticSite description for Gets the details of the user provided function app +// registered with a static site +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// functionAppName - name of the function app registered with the static site. +func (client StaticSitesClient) GetUserProvidedFunctionAppForStaticSite(ctx context.Context, resourceGroupName string, name string, functionAppName string) (result StaticSiteUserProvidedFunctionAppARMResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetUserProvidedFunctionAppForStaticSite") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "GetUserProvidedFunctionAppForStaticSite", err.Error()) + } + + req, err := client.GetUserProvidedFunctionAppForStaticSitePreparer(ctx, resourceGroupName, name, functionAppName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetUserProvidedFunctionAppForStaticSite", nil, "Failure preparing request") + return + } + + resp, err := client.GetUserProvidedFunctionAppForStaticSiteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetUserProvidedFunctionAppForStaticSite", resp, "Failure sending request") + return + } + + result, err = client.GetUserProvidedFunctionAppForStaticSiteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetUserProvidedFunctionAppForStaticSite", resp, "Failure responding to request") + return + } + + return +} + +// GetUserProvidedFunctionAppForStaticSitePreparer prepares the GetUserProvidedFunctionAppForStaticSite request. +func (client StaticSitesClient) GetUserProvidedFunctionAppForStaticSitePreparer(ctx context.Context, resourceGroupName string, name string, functionAppName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionAppName": autorest.Encode("path", functionAppName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/userProvidedFunctionApps/{functionAppName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetUserProvidedFunctionAppForStaticSiteSender sends the GetUserProvidedFunctionAppForStaticSite request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) GetUserProvidedFunctionAppForStaticSiteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetUserProvidedFunctionAppForStaticSiteResponder handles the response to the GetUserProvidedFunctionAppForStaticSite request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) GetUserProvidedFunctionAppForStaticSiteResponder(resp *http.Response) (result StaticSiteUserProvidedFunctionAppARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetUserProvidedFunctionAppForStaticSiteBuild description for Gets the details of the user provided function app +// registered with a static site build +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// environmentName - the stage site identifier. +// functionAppName - name of the function app registered with the static site build. +func (client StaticSitesClient) GetUserProvidedFunctionAppForStaticSiteBuild(ctx context.Context, resourceGroupName string, name string, environmentName string, functionAppName string) (result StaticSiteUserProvidedFunctionAppARMResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetUserProvidedFunctionAppForStaticSiteBuild") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "GetUserProvidedFunctionAppForStaticSiteBuild", err.Error()) + } + + req, err := client.GetUserProvidedFunctionAppForStaticSiteBuildPreparer(ctx, resourceGroupName, name, environmentName, functionAppName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetUserProvidedFunctionAppForStaticSiteBuild", nil, "Failure preparing request") + return + } + + resp, err := client.GetUserProvidedFunctionAppForStaticSiteBuildSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetUserProvidedFunctionAppForStaticSiteBuild", resp, "Failure sending request") + return + } + + result, err = client.GetUserProvidedFunctionAppForStaticSiteBuildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetUserProvidedFunctionAppForStaticSiteBuild", resp, "Failure responding to request") + return + } + + return +} + +// GetUserProvidedFunctionAppForStaticSiteBuildPreparer prepares the GetUserProvidedFunctionAppForStaticSiteBuild request. +func (client StaticSitesClient) GetUserProvidedFunctionAppForStaticSiteBuildPreparer(ctx context.Context, resourceGroupName string, name string, environmentName string, functionAppName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "functionAppName": autorest.Encode("path", functionAppName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}/userProvidedFunctionApps/{functionAppName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetUserProvidedFunctionAppForStaticSiteBuildSender sends the GetUserProvidedFunctionAppForStaticSiteBuild request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) GetUserProvidedFunctionAppForStaticSiteBuildSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetUserProvidedFunctionAppForStaticSiteBuildResponder handles the response to the GetUserProvidedFunctionAppForStaticSiteBuild request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) GetUserProvidedFunctionAppForStaticSiteBuildResponder(resp *http.Response) (result StaticSiteUserProvidedFunctionAppARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetUserProvidedFunctionAppsForStaticSite description for Gets the details of the user provided function apps +// registered with a static site +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +func (client StaticSitesClient) GetUserProvidedFunctionAppsForStaticSite(ctx context.Context, resourceGroupName string, name string) (result StaticSiteUserProvidedFunctionAppsCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetUserProvidedFunctionAppsForStaticSite") + defer func() { + sc := -1 + if result.ssupfac.Response.Response != nil { + sc = result.ssupfac.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "GetUserProvidedFunctionAppsForStaticSite", err.Error()) + } + + result.fn = client.getUserProvidedFunctionAppsForStaticSiteNextResults + req, err := client.GetUserProvidedFunctionAppsForStaticSitePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetUserProvidedFunctionAppsForStaticSite", nil, "Failure preparing request") + return + } + + resp, err := client.GetUserProvidedFunctionAppsForStaticSiteSender(req) + if err != nil { + result.ssupfac.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetUserProvidedFunctionAppsForStaticSite", resp, "Failure sending request") + return + } + + result.ssupfac, err = client.GetUserProvidedFunctionAppsForStaticSiteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetUserProvidedFunctionAppsForStaticSite", resp, "Failure responding to request") + return + } + if result.ssupfac.hasNextLink() && result.ssupfac.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetUserProvidedFunctionAppsForStaticSitePreparer prepares the GetUserProvidedFunctionAppsForStaticSite request. +func (client StaticSitesClient) GetUserProvidedFunctionAppsForStaticSitePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/userProvidedFunctionApps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetUserProvidedFunctionAppsForStaticSiteSender sends the GetUserProvidedFunctionAppsForStaticSite request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) GetUserProvidedFunctionAppsForStaticSiteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetUserProvidedFunctionAppsForStaticSiteResponder handles the response to the GetUserProvidedFunctionAppsForStaticSite request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) GetUserProvidedFunctionAppsForStaticSiteResponder(resp *http.Response) (result StaticSiteUserProvidedFunctionAppsCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getUserProvidedFunctionAppsForStaticSiteNextResults retrieves the next set of results, if any. +func (client StaticSitesClient) getUserProvidedFunctionAppsForStaticSiteNextResults(ctx context.Context, lastResults StaticSiteUserProvidedFunctionAppsCollection) (result StaticSiteUserProvidedFunctionAppsCollection, err error) { + req, err := lastResults.staticSiteUserProvidedFunctionAppsCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "getUserProvidedFunctionAppsForStaticSiteNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetUserProvidedFunctionAppsForStaticSiteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "getUserProvidedFunctionAppsForStaticSiteNextResults", resp, "Failure sending next results request") + } + result, err = client.GetUserProvidedFunctionAppsForStaticSiteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "getUserProvidedFunctionAppsForStaticSiteNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetUserProvidedFunctionAppsForStaticSiteComplete enumerates all values, automatically crossing page boundaries as required. +func (client StaticSitesClient) GetUserProvidedFunctionAppsForStaticSiteComplete(ctx context.Context, resourceGroupName string, name string) (result StaticSiteUserProvidedFunctionAppsCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetUserProvidedFunctionAppsForStaticSite") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetUserProvidedFunctionAppsForStaticSite(ctx, resourceGroupName, name) + return +} + +// GetUserProvidedFunctionAppsForStaticSiteBuild description for Gets the details of the user provided function apps +// registered with a static site build +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// environmentName - the stage site identifier. +func (client StaticSitesClient) GetUserProvidedFunctionAppsForStaticSiteBuild(ctx context.Context, resourceGroupName string, name string, environmentName string) (result StaticSiteUserProvidedFunctionAppsCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetUserProvidedFunctionAppsForStaticSiteBuild") + defer func() { + sc := -1 + if result.ssupfac.Response.Response != nil { + sc = result.ssupfac.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "GetUserProvidedFunctionAppsForStaticSiteBuild", err.Error()) + } + + result.fn = client.getUserProvidedFunctionAppsForStaticSiteBuildNextResults + req, err := client.GetUserProvidedFunctionAppsForStaticSiteBuildPreparer(ctx, resourceGroupName, name, environmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetUserProvidedFunctionAppsForStaticSiteBuild", nil, "Failure preparing request") + return + } + + resp, err := client.GetUserProvidedFunctionAppsForStaticSiteBuildSender(req) + if err != nil { + result.ssupfac.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetUserProvidedFunctionAppsForStaticSiteBuild", resp, "Failure sending request") + return + } + + result.ssupfac, err = client.GetUserProvidedFunctionAppsForStaticSiteBuildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "GetUserProvidedFunctionAppsForStaticSiteBuild", resp, "Failure responding to request") + return + } + if result.ssupfac.hasNextLink() && result.ssupfac.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetUserProvidedFunctionAppsForStaticSiteBuildPreparer prepares the GetUserProvidedFunctionAppsForStaticSiteBuild request. +func (client StaticSitesClient) GetUserProvidedFunctionAppsForStaticSiteBuildPreparer(ctx context.Context, resourceGroupName string, name string, environmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}/userProvidedFunctionApps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetUserProvidedFunctionAppsForStaticSiteBuildSender sends the GetUserProvidedFunctionAppsForStaticSiteBuild request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) GetUserProvidedFunctionAppsForStaticSiteBuildSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetUserProvidedFunctionAppsForStaticSiteBuildResponder handles the response to the GetUserProvidedFunctionAppsForStaticSiteBuild request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) GetUserProvidedFunctionAppsForStaticSiteBuildResponder(resp *http.Response) (result StaticSiteUserProvidedFunctionAppsCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getUserProvidedFunctionAppsForStaticSiteBuildNextResults retrieves the next set of results, if any. +func (client StaticSitesClient) getUserProvidedFunctionAppsForStaticSiteBuildNextResults(ctx context.Context, lastResults StaticSiteUserProvidedFunctionAppsCollection) (result StaticSiteUserProvidedFunctionAppsCollection, err error) { + req, err := lastResults.staticSiteUserProvidedFunctionAppsCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "getUserProvidedFunctionAppsForStaticSiteBuildNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetUserProvidedFunctionAppsForStaticSiteBuildSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "getUserProvidedFunctionAppsForStaticSiteBuildNextResults", resp, "Failure sending next results request") + } + result, err = client.GetUserProvidedFunctionAppsForStaticSiteBuildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "getUserProvidedFunctionAppsForStaticSiteBuildNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetUserProvidedFunctionAppsForStaticSiteBuildComplete enumerates all values, automatically crossing page boundaries as required. +func (client StaticSitesClient) GetUserProvidedFunctionAppsForStaticSiteBuildComplete(ctx context.Context, resourceGroupName string, name string, environmentName string) (result StaticSiteUserProvidedFunctionAppsCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.GetUserProvidedFunctionAppsForStaticSiteBuild") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetUserProvidedFunctionAppsForStaticSiteBuild(ctx, resourceGroupName, name, environmentName) + return +} + +// List description for Get all Static Sites for a subscription. +func (client StaticSitesClient) List(ctx context.Context) (result StaticSiteCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.List") + defer func() { + sc := -1 + if result.ssc.Response.Response != nil { + sc = result.ssc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ssc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "List", resp, "Failure sending request") + return + } + + result.ssc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "List", resp, "Failure responding to request") + return + } + if result.ssc.hasNextLink() && result.ssc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client StaticSitesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/staticSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) ListResponder(resp *http.Response) (result StaticSiteCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client StaticSitesClient) listNextResults(ctx context.Context, lastResults StaticSiteCollection) (result StaticSiteCollection, err error) { + req, err := lastResults.staticSiteCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client StaticSitesClient) ListComplete(ctx context.Context) (result StaticSiteCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListStaticSiteAppSettings description for Gets the application settings of a static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +func (client StaticSitesClient) ListStaticSiteAppSettings(ctx context.Context, resourceGroupName string, name string) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ListStaticSiteAppSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "ListStaticSiteAppSettings", err.Error()) + } + + req, err := client.ListStaticSiteAppSettingsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteAppSettings", nil, "Failure preparing request") + return + } + + resp, err := client.ListStaticSiteAppSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteAppSettings", resp, "Failure sending request") + return + } + + result, err = client.ListStaticSiteAppSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteAppSettings", resp, "Failure responding to request") + return + } + + return +} + +// ListStaticSiteAppSettingsPreparer prepares the ListStaticSiteAppSettings request. +func (client StaticSitesClient) ListStaticSiteAppSettingsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/listAppSettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListStaticSiteAppSettingsSender sends the ListStaticSiteAppSettings request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) ListStaticSiteAppSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListStaticSiteAppSettingsResponder handles the response to the ListStaticSiteAppSettings request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) ListStaticSiteAppSettingsResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListStaticSiteBuildAppSettings description for Gets the application settings of a static site build. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// environmentName - the stage site identifier. +func (client StaticSitesClient) ListStaticSiteBuildAppSettings(ctx context.Context, resourceGroupName string, name string, environmentName string) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ListStaticSiteBuildAppSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "ListStaticSiteBuildAppSettings", err.Error()) + } + + req, err := client.ListStaticSiteBuildAppSettingsPreparer(ctx, resourceGroupName, name, environmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteBuildAppSettings", nil, "Failure preparing request") + return + } + + resp, err := client.ListStaticSiteBuildAppSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteBuildAppSettings", resp, "Failure sending request") + return + } + + result, err = client.ListStaticSiteBuildAppSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteBuildAppSettings", resp, "Failure responding to request") + return + } + + return +} + +// ListStaticSiteBuildAppSettingsPreparer prepares the ListStaticSiteBuildAppSettings request. +func (client StaticSitesClient) ListStaticSiteBuildAppSettingsPreparer(ctx context.Context, resourceGroupName string, name string, environmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}/listAppSettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListStaticSiteBuildAppSettingsSender sends the ListStaticSiteBuildAppSettings request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) ListStaticSiteBuildAppSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListStaticSiteBuildAppSettingsResponder handles the response to the ListStaticSiteBuildAppSettings request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) ListStaticSiteBuildAppSettingsResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListStaticSiteBuildFunctionAppSettings description for Gets the application settings of a static site build. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// environmentName - the stage site identifier. +func (client StaticSitesClient) ListStaticSiteBuildFunctionAppSettings(ctx context.Context, resourceGroupName string, name string, environmentName string) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ListStaticSiteBuildFunctionAppSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "ListStaticSiteBuildFunctionAppSettings", err.Error()) + } + + req, err := client.ListStaticSiteBuildFunctionAppSettingsPreparer(ctx, resourceGroupName, name, environmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteBuildFunctionAppSettings", nil, "Failure preparing request") + return + } + + resp, err := client.ListStaticSiteBuildFunctionAppSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteBuildFunctionAppSettings", resp, "Failure sending request") + return + } + + result, err = client.ListStaticSiteBuildFunctionAppSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteBuildFunctionAppSettings", resp, "Failure responding to request") + return + } + + return +} + +// ListStaticSiteBuildFunctionAppSettingsPreparer prepares the ListStaticSiteBuildFunctionAppSettings request. +func (client StaticSitesClient) ListStaticSiteBuildFunctionAppSettingsPreparer(ctx context.Context, resourceGroupName string, name string, environmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}/listFunctionAppSettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListStaticSiteBuildFunctionAppSettingsSender sends the ListStaticSiteBuildFunctionAppSettings request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) ListStaticSiteBuildFunctionAppSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListStaticSiteBuildFunctionAppSettingsResponder handles the response to the ListStaticSiteBuildFunctionAppSettings request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) ListStaticSiteBuildFunctionAppSettingsResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListStaticSiteBuildFunctions description for Gets the functions of a particular static site build. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// environmentName - the stage site identifier. +func (client StaticSitesClient) ListStaticSiteBuildFunctions(ctx context.Context, resourceGroupName string, name string, environmentName string) (result StaticSiteFunctionOverviewCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ListStaticSiteBuildFunctions") + defer func() { + sc := -1 + if result.ssfoc.Response.Response != nil { + sc = result.ssfoc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "ListStaticSiteBuildFunctions", err.Error()) + } + + result.fn = client.listStaticSiteBuildFunctionsNextResults + req, err := client.ListStaticSiteBuildFunctionsPreparer(ctx, resourceGroupName, name, environmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteBuildFunctions", nil, "Failure preparing request") + return + } + + resp, err := client.ListStaticSiteBuildFunctionsSender(req) + if err != nil { + result.ssfoc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteBuildFunctions", resp, "Failure sending request") + return + } + + result.ssfoc, err = client.ListStaticSiteBuildFunctionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteBuildFunctions", resp, "Failure responding to request") + return + } + if result.ssfoc.hasNextLink() && result.ssfoc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListStaticSiteBuildFunctionsPreparer prepares the ListStaticSiteBuildFunctions request. +func (client StaticSitesClient) ListStaticSiteBuildFunctionsPreparer(ctx context.Context, resourceGroupName string, name string, environmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}/functions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListStaticSiteBuildFunctionsSender sends the ListStaticSiteBuildFunctions request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) ListStaticSiteBuildFunctionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListStaticSiteBuildFunctionsResponder handles the response to the ListStaticSiteBuildFunctions request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) ListStaticSiteBuildFunctionsResponder(resp *http.Response) (result StaticSiteFunctionOverviewCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listStaticSiteBuildFunctionsNextResults retrieves the next set of results, if any. +func (client StaticSitesClient) listStaticSiteBuildFunctionsNextResults(ctx context.Context, lastResults StaticSiteFunctionOverviewCollection) (result StaticSiteFunctionOverviewCollection, err error) { + req, err := lastResults.staticSiteFunctionOverviewCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "listStaticSiteBuildFunctionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListStaticSiteBuildFunctionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "listStaticSiteBuildFunctionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListStaticSiteBuildFunctionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "listStaticSiteBuildFunctionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListStaticSiteBuildFunctionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client StaticSitesClient) ListStaticSiteBuildFunctionsComplete(ctx context.Context, resourceGroupName string, name string, environmentName string) (result StaticSiteFunctionOverviewCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ListStaticSiteBuildFunctions") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListStaticSiteBuildFunctions(ctx, resourceGroupName, name, environmentName) + return +} + +// ListStaticSiteConfiguredRoles description for Lists the roles configured for the static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +func (client StaticSitesClient) ListStaticSiteConfiguredRoles(ctx context.Context, resourceGroupName string, name string) (result StringList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ListStaticSiteConfiguredRoles") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "ListStaticSiteConfiguredRoles", err.Error()) + } + + req, err := client.ListStaticSiteConfiguredRolesPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteConfiguredRoles", nil, "Failure preparing request") + return + } + + resp, err := client.ListStaticSiteConfiguredRolesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteConfiguredRoles", resp, "Failure sending request") + return + } + + result, err = client.ListStaticSiteConfiguredRolesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteConfiguredRoles", resp, "Failure responding to request") + return + } + + return +} + +// ListStaticSiteConfiguredRolesPreparer prepares the ListStaticSiteConfiguredRoles request. +func (client StaticSitesClient) ListStaticSiteConfiguredRolesPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/listConfiguredRoles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListStaticSiteConfiguredRolesSender sends the ListStaticSiteConfiguredRoles request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) ListStaticSiteConfiguredRolesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListStaticSiteConfiguredRolesResponder handles the response to the ListStaticSiteConfiguredRoles request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) ListStaticSiteConfiguredRolesResponder(resp *http.Response) (result StringList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListStaticSiteCustomDomains description for Gets all static site custom domains for a particular static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site resource to search in. +func (client StaticSitesClient) ListStaticSiteCustomDomains(ctx context.Context, resourceGroupName string, name string) (result StaticSiteCustomDomainOverviewCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ListStaticSiteCustomDomains") + defer func() { + sc := -1 + if result.sscdoc.Response.Response != nil { + sc = result.sscdoc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "ListStaticSiteCustomDomains", err.Error()) + } + + result.fn = client.listStaticSiteCustomDomainsNextResults + req, err := client.ListStaticSiteCustomDomainsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteCustomDomains", nil, "Failure preparing request") + return + } + + resp, err := client.ListStaticSiteCustomDomainsSender(req) + if err != nil { + result.sscdoc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteCustomDomains", resp, "Failure sending request") + return + } + + result.sscdoc, err = client.ListStaticSiteCustomDomainsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteCustomDomains", resp, "Failure responding to request") + return + } + if result.sscdoc.hasNextLink() && result.sscdoc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListStaticSiteCustomDomainsPreparer prepares the ListStaticSiteCustomDomains request. +func (client StaticSitesClient) ListStaticSiteCustomDomainsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListStaticSiteCustomDomainsSender sends the ListStaticSiteCustomDomains request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) ListStaticSiteCustomDomainsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListStaticSiteCustomDomainsResponder handles the response to the ListStaticSiteCustomDomains request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) ListStaticSiteCustomDomainsResponder(resp *http.Response) (result StaticSiteCustomDomainOverviewCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listStaticSiteCustomDomainsNextResults retrieves the next set of results, if any. +func (client StaticSitesClient) listStaticSiteCustomDomainsNextResults(ctx context.Context, lastResults StaticSiteCustomDomainOverviewCollection) (result StaticSiteCustomDomainOverviewCollection, err error) { + req, err := lastResults.staticSiteCustomDomainOverviewCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "listStaticSiteCustomDomainsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListStaticSiteCustomDomainsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "listStaticSiteCustomDomainsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListStaticSiteCustomDomainsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "listStaticSiteCustomDomainsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListStaticSiteCustomDomainsComplete enumerates all values, automatically crossing page boundaries as required. +func (client StaticSitesClient) ListStaticSiteCustomDomainsComplete(ctx context.Context, resourceGroupName string, name string) (result StaticSiteCustomDomainOverviewCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ListStaticSiteCustomDomains") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListStaticSiteCustomDomains(ctx, resourceGroupName, name) + return +} + +// ListStaticSiteFunctionAppSettings description for Gets the application settings of a static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +func (client StaticSitesClient) ListStaticSiteFunctionAppSettings(ctx context.Context, resourceGroupName string, name string) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ListStaticSiteFunctionAppSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "ListStaticSiteFunctionAppSettings", err.Error()) + } + + req, err := client.ListStaticSiteFunctionAppSettingsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteFunctionAppSettings", nil, "Failure preparing request") + return + } + + resp, err := client.ListStaticSiteFunctionAppSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteFunctionAppSettings", resp, "Failure sending request") + return + } + + result, err = client.ListStaticSiteFunctionAppSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteFunctionAppSettings", resp, "Failure responding to request") + return + } + + return +} + +// ListStaticSiteFunctionAppSettingsPreparer prepares the ListStaticSiteFunctionAppSettings request. +func (client StaticSitesClient) ListStaticSiteFunctionAppSettingsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/listFunctionAppSettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListStaticSiteFunctionAppSettingsSender sends the ListStaticSiteFunctionAppSettings request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) ListStaticSiteFunctionAppSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListStaticSiteFunctionAppSettingsResponder handles the response to the ListStaticSiteFunctionAppSettings request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) ListStaticSiteFunctionAppSettingsResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListStaticSiteFunctions description for Gets the functions of a static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +func (client StaticSitesClient) ListStaticSiteFunctions(ctx context.Context, resourceGroupName string, name string) (result StaticSiteFunctionOverviewCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ListStaticSiteFunctions") + defer func() { + sc := -1 + if result.ssfoc.Response.Response != nil { + sc = result.ssfoc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "ListStaticSiteFunctions", err.Error()) + } + + result.fn = client.listStaticSiteFunctionsNextResults + req, err := client.ListStaticSiteFunctionsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteFunctions", nil, "Failure preparing request") + return + } + + resp, err := client.ListStaticSiteFunctionsSender(req) + if err != nil { + result.ssfoc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteFunctions", resp, "Failure sending request") + return + } + + result.ssfoc, err = client.ListStaticSiteFunctionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteFunctions", resp, "Failure responding to request") + return + } + if result.ssfoc.hasNextLink() && result.ssfoc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListStaticSiteFunctionsPreparer prepares the ListStaticSiteFunctions request. +func (client StaticSitesClient) ListStaticSiteFunctionsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/functions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListStaticSiteFunctionsSender sends the ListStaticSiteFunctions request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) ListStaticSiteFunctionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListStaticSiteFunctionsResponder handles the response to the ListStaticSiteFunctions request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) ListStaticSiteFunctionsResponder(resp *http.Response) (result StaticSiteFunctionOverviewCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listStaticSiteFunctionsNextResults retrieves the next set of results, if any. +func (client StaticSitesClient) listStaticSiteFunctionsNextResults(ctx context.Context, lastResults StaticSiteFunctionOverviewCollection) (result StaticSiteFunctionOverviewCollection, err error) { + req, err := lastResults.staticSiteFunctionOverviewCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "listStaticSiteFunctionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListStaticSiteFunctionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "listStaticSiteFunctionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListStaticSiteFunctionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "listStaticSiteFunctionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListStaticSiteFunctionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client StaticSitesClient) ListStaticSiteFunctionsComplete(ctx context.Context, resourceGroupName string, name string) (result StaticSiteFunctionOverviewCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ListStaticSiteFunctions") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListStaticSiteFunctions(ctx, resourceGroupName, name) + return +} + +// ListStaticSiteSecrets description for Lists the secrets for an existing static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +func (client StaticSitesClient) ListStaticSiteSecrets(ctx context.Context, resourceGroupName string, name string) (result StringDictionary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ListStaticSiteSecrets") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "ListStaticSiteSecrets", err.Error()) + } + + req, err := client.ListStaticSiteSecretsPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteSecrets", nil, "Failure preparing request") + return + } + + resp, err := client.ListStaticSiteSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteSecrets", resp, "Failure sending request") + return + } + + result, err = client.ListStaticSiteSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteSecrets", resp, "Failure responding to request") + return + } + + return +} + +// ListStaticSiteSecretsPreparer prepares the ListStaticSiteSecrets request. +func (client StaticSitesClient) ListStaticSiteSecretsPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/listSecrets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListStaticSiteSecretsSender sends the ListStaticSiteSecrets request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) ListStaticSiteSecretsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListStaticSiteSecretsResponder handles the response to the ListStaticSiteSecrets request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) ListStaticSiteSecretsResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListStaticSiteUsers description for Gets the list of users of a static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// authprovider - the auth provider for the users. +func (client StaticSitesClient) ListStaticSiteUsers(ctx context.Context, resourceGroupName string, name string, authprovider string) (result StaticSiteUserCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ListStaticSiteUsers") + defer func() { + sc := -1 + if result.ssuc.Response.Response != nil { + sc = result.ssuc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "ListStaticSiteUsers", err.Error()) + } + + result.fn = client.listStaticSiteUsersNextResults + req, err := client.ListStaticSiteUsersPreparer(ctx, resourceGroupName, name, authprovider) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteUsers", nil, "Failure preparing request") + return + } + + resp, err := client.ListStaticSiteUsersSender(req) + if err != nil { + result.ssuc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteUsers", resp, "Failure sending request") + return + } + + result.ssuc, err = client.ListStaticSiteUsersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ListStaticSiteUsers", resp, "Failure responding to request") + return + } + if result.ssuc.hasNextLink() && result.ssuc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListStaticSiteUsersPreparer prepares the ListStaticSiteUsers request. +func (client StaticSitesClient) ListStaticSiteUsersPreparer(ctx context.Context, resourceGroupName string, name string, authprovider string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authprovider": autorest.Encode("path", authprovider), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/authproviders/{authprovider}/listUsers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListStaticSiteUsersSender sends the ListStaticSiteUsers request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) ListStaticSiteUsersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListStaticSiteUsersResponder handles the response to the ListStaticSiteUsers request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) ListStaticSiteUsersResponder(resp *http.Response) (result StaticSiteUserCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listStaticSiteUsersNextResults retrieves the next set of results, if any. +func (client StaticSitesClient) listStaticSiteUsersNextResults(ctx context.Context, lastResults StaticSiteUserCollection) (result StaticSiteUserCollection, err error) { + req, err := lastResults.staticSiteUserCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "listStaticSiteUsersNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListStaticSiteUsersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.StaticSitesClient", "listStaticSiteUsersNextResults", resp, "Failure sending next results request") + } + result, err = client.ListStaticSiteUsersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "listStaticSiteUsersNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListStaticSiteUsersComplete enumerates all values, automatically crossing page boundaries as required. +func (client StaticSitesClient) ListStaticSiteUsersComplete(ctx context.Context, resourceGroupName string, name string, authprovider string) (result StaticSiteUserCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ListStaticSiteUsers") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListStaticSiteUsers(ctx, resourceGroupName, name, authprovider) + return +} + +// PreviewWorkflow description for Generates a preview workflow file for the static site +// Parameters: +// location - location where you plan to create the static site. +// staticSitesWorkflowPreviewRequest - a JSON representation of the StaticSitesWorkflowPreviewRequest +// properties. See example. +func (client StaticSitesClient) PreviewWorkflow(ctx context.Context, location string, staticSitesWorkflowPreviewRequest StaticSitesWorkflowPreviewRequest) (result StaticSitesWorkflowPreview, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.PreviewWorkflow") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PreviewWorkflowPreparer(ctx, location, staticSitesWorkflowPreviewRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "PreviewWorkflow", nil, "Failure preparing request") + return + } + + resp, err := client.PreviewWorkflowSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "PreviewWorkflow", resp, "Failure sending request") + return + } + + result, err = client.PreviewWorkflowResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "PreviewWorkflow", resp, "Failure responding to request") + return + } + + return +} + +// PreviewWorkflowPreparer prepares the PreviewWorkflow request. +func (client StaticSitesClient) PreviewWorkflowPreparer(ctx context.Context, location string, staticSitesWorkflowPreviewRequest StaticSitesWorkflowPreviewRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/previewStaticSiteWorkflowFile", pathParameters), + autorest.WithJSON(staticSitesWorkflowPreviewRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PreviewWorkflowSender sends the PreviewWorkflow request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) PreviewWorkflowSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PreviewWorkflowResponder handles the response to the PreviewWorkflow request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) PreviewWorkflowResponder(resp *http.Response) (result StaticSitesWorkflowPreview, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegisterUserProvidedFunctionAppWithStaticSite description for Register a user provided function app with a static +// site +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// functionAppName - name of the function app to register with the static site. +// staticSiteUserProvidedFunctionEnvelope - a JSON representation of the user provided function app properties. +// See example. +// isForced - specify true to force the update of the auth configuration on the function app even +// if an AzureStaticWebApps provider is already configured on the function app. The default is +// false. +func (client StaticSitesClient) RegisterUserProvidedFunctionAppWithStaticSite(ctx context.Context, resourceGroupName string, name string, functionAppName string, staticSiteUserProvidedFunctionEnvelope StaticSiteUserProvidedFunctionAppARMResource, isForced *bool) (result StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.RegisterUserProvidedFunctionAppWithStaticSite") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "RegisterUserProvidedFunctionAppWithStaticSite", err.Error()) + } + + req, err := client.RegisterUserProvidedFunctionAppWithStaticSitePreparer(ctx, resourceGroupName, name, functionAppName, staticSiteUserProvidedFunctionEnvelope, isForced) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "RegisterUserProvidedFunctionAppWithStaticSite", nil, "Failure preparing request") + return + } + + result, err = client.RegisterUserProvidedFunctionAppWithStaticSiteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "RegisterUserProvidedFunctionAppWithStaticSite", result.Response(), "Failure sending request") + return + } + + return +} + +// RegisterUserProvidedFunctionAppWithStaticSitePreparer prepares the RegisterUserProvidedFunctionAppWithStaticSite request. +func (client StaticSitesClient) RegisterUserProvidedFunctionAppWithStaticSitePreparer(ctx context.Context, resourceGroupName string, name string, functionAppName string, staticSiteUserProvidedFunctionEnvelope StaticSiteUserProvidedFunctionAppARMResource, isForced *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionAppName": autorest.Encode("path", functionAppName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if isForced != nil { + queryParameters["isForced"] = autorest.Encode("query", *isForced) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/userProvidedFunctionApps/{functionAppName}", pathParameters), + autorest.WithJSON(staticSiteUserProvidedFunctionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegisterUserProvidedFunctionAppWithStaticSiteSender sends the RegisterUserProvidedFunctionAppWithStaticSite request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) RegisterUserProvidedFunctionAppWithStaticSiteSender(req *http.Request) (future StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RegisterUserProvidedFunctionAppWithStaticSiteResponder handles the response to the RegisterUserProvidedFunctionAppWithStaticSite request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) RegisterUserProvidedFunctionAppWithStaticSiteResponder(resp *http.Response) (result StaticSiteUserProvidedFunctionAppARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegisterUserProvidedFunctionAppWithStaticSiteBuild description for Register a user provided function app with a +// static site build +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// environmentName - the stage site identifier. +// functionAppName - name of the function app to register with the static site build. +// staticSiteUserProvidedFunctionEnvelope - a JSON representation of the user provided function app properties. +// See example. +// isForced - specify true to force the update of the auth configuration on the function app even +// if an AzureStaticWebApps provider is already configured on the function app. The default is +// false. +func (client StaticSitesClient) RegisterUserProvidedFunctionAppWithStaticSiteBuild(ctx context.Context, resourceGroupName string, name string, environmentName string, functionAppName string, staticSiteUserProvidedFunctionEnvelope StaticSiteUserProvidedFunctionAppARMResource, isForced *bool) (result StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteBuildFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.RegisterUserProvidedFunctionAppWithStaticSiteBuild") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "RegisterUserProvidedFunctionAppWithStaticSiteBuild", err.Error()) + } + + req, err := client.RegisterUserProvidedFunctionAppWithStaticSiteBuildPreparer(ctx, resourceGroupName, name, environmentName, functionAppName, staticSiteUserProvidedFunctionEnvelope, isForced) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "RegisterUserProvidedFunctionAppWithStaticSiteBuild", nil, "Failure preparing request") + return + } + + result, err = client.RegisterUserProvidedFunctionAppWithStaticSiteBuildSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "RegisterUserProvidedFunctionAppWithStaticSiteBuild", result.Response(), "Failure sending request") + return + } + + return +} + +// RegisterUserProvidedFunctionAppWithStaticSiteBuildPreparer prepares the RegisterUserProvidedFunctionAppWithStaticSiteBuild request. +func (client StaticSitesClient) RegisterUserProvidedFunctionAppWithStaticSiteBuildPreparer(ctx context.Context, resourceGroupName string, name string, environmentName string, functionAppName string, staticSiteUserProvidedFunctionEnvelope StaticSiteUserProvidedFunctionAppARMResource, isForced *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "functionAppName": autorest.Encode("path", functionAppName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if isForced != nil { + queryParameters["isForced"] = autorest.Encode("query", *isForced) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}/userProvidedFunctionApps/{functionAppName}", pathParameters), + autorest.WithJSON(staticSiteUserProvidedFunctionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegisterUserProvidedFunctionAppWithStaticSiteBuildSender sends the RegisterUserProvidedFunctionAppWithStaticSiteBuild request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) RegisterUserProvidedFunctionAppWithStaticSiteBuildSender(req *http.Request) (future StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteBuildFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RegisterUserProvidedFunctionAppWithStaticSiteBuildResponder handles the response to the RegisterUserProvidedFunctionAppWithStaticSiteBuild request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) RegisterUserProvidedFunctionAppWithStaticSiteBuildResponder(resp *http.Response) (result StaticSiteUserProvidedFunctionAppARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ResetStaticSiteAPIKey description for Resets the api key for an existing static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +func (client StaticSitesClient) ResetStaticSiteAPIKey(ctx context.Context, resourceGroupName string, name string, resetPropertiesEnvelope StaticSiteResetPropertiesARMResource) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ResetStaticSiteAPIKey") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "ResetStaticSiteAPIKey", err.Error()) + } + + req, err := client.ResetStaticSiteAPIKeyPreparer(ctx, resourceGroupName, name, resetPropertiesEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ResetStaticSiteAPIKey", nil, "Failure preparing request") + return + } + + resp, err := client.ResetStaticSiteAPIKeySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ResetStaticSiteAPIKey", resp, "Failure sending request") + return + } + + result, err = client.ResetStaticSiteAPIKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ResetStaticSiteAPIKey", resp, "Failure responding to request") + return + } + + return +} + +// ResetStaticSiteAPIKeyPreparer prepares the ResetStaticSiteAPIKey request. +func (client StaticSitesClient) ResetStaticSiteAPIKeyPreparer(ctx context.Context, resourceGroupName string, name string, resetPropertiesEnvelope StaticSiteResetPropertiesARMResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/resetapikey", pathParameters), + autorest.WithJSON(resetPropertiesEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetStaticSiteAPIKeySender sends the ResetStaticSiteAPIKey request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) ResetStaticSiteAPIKeySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ResetStaticSiteAPIKeyResponder handles the response to the ResetStaticSiteAPIKey request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) ResetStaticSiteAPIKeyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdateStaticSite description for Creates a new static site in an existing resource group, or updates an existing +// static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site to create or update. +// staticSiteEnvelope - a JSON representation of the staticsite properties. See example. +func (client StaticSitesClient) UpdateStaticSite(ctx context.Context, resourceGroupName string, name string, staticSiteEnvelope StaticSitePatchResource) (result StaticSiteARMResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.UpdateStaticSite") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "UpdateStaticSite", err.Error()) + } + + req, err := client.UpdateStaticSitePreparer(ctx, resourceGroupName, name, staticSiteEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "UpdateStaticSite", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateStaticSiteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "UpdateStaticSite", resp, "Failure sending request") + return + } + + result, err = client.UpdateStaticSiteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "UpdateStaticSite", resp, "Failure responding to request") + return + } + + return +} + +// UpdateStaticSitePreparer prepares the UpdateStaticSite request. +func (client StaticSitesClient) UpdateStaticSitePreparer(ctx context.Context, resourceGroupName string, name string, staticSiteEnvelope StaticSitePatchResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}", pathParameters), + autorest.WithJSON(staticSiteEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateStaticSiteSender sends the UpdateStaticSite request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) UpdateStaticSiteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateStaticSiteResponder handles the response to the UpdateStaticSite request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) UpdateStaticSiteResponder(resp *http.Response) (result StaticSiteARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateStaticSiteUser description for Updates a user entry with the listed roles +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// authprovider - the auth provider for this user. +// userid - the user id of the user. +// staticSiteUserEnvelope - a JSON representation of the StaticSiteUser properties. See example. +func (client StaticSitesClient) UpdateStaticSiteUser(ctx context.Context, resourceGroupName string, name string, authprovider string, userid string, staticSiteUserEnvelope StaticSiteUserARMResource) (result StaticSiteUserARMResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.UpdateStaticSiteUser") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "UpdateStaticSiteUser", err.Error()) + } + + req, err := client.UpdateStaticSiteUserPreparer(ctx, resourceGroupName, name, authprovider, userid, staticSiteUserEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "UpdateStaticSiteUser", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateStaticSiteUserSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "UpdateStaticSiteUser", resp, "Failure sending request") + return + } + + result, err = client.UpdateStaticSiteUserResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "UpdateStaticSiteUser", resp, "Failure responding to request") + return + } + + return +} + +// UpdateStaticSiteUserPreparer prepares the UpdateStaticSiteUser request. +func (client StaticSitesClient) UpdateStaticSiteUserPreparer(ctx context.Context, resourceGroupName string, name string, authprovider string, userid string, staticSiteUserEnvelope StaticSiteUserARMResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authprovider": autorest.Encode("path", authprovider), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userid": autorest.Encode("path", userid), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/authproviders/{authprovider}/users/{userid}", pathParameters), + autorest.WithJSON(staticSiteUserEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateStaticSiteUserSender sends the UpdateStaticSiteUser request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) UpdateStaticSiteUserSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateStaticSiteUserResponder handles the response to the UpdateStaticSiteUser request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) UpdateStaticSiteUserResponder(resp *http.Response) (result StaticSiteUserARMResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateCustomDomainCanBeAddedToStaticSite description for Validates a particular custom domain can be added to a +// static site. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of the static site. +// domainName - the custom domain to validate. +// staticSiteCustomDomainRequestPropertiesEnvelope - a JSON representation of the static site custom domain +// request properties. See example. +func (client StaticSitesClient) ValidateCustomDomainCanBeAddedToStaticSite(ctx context.Context, resourceGroupName string, name string, domainName string, staticSiteCustomDomainRequestPropertiesEnvelope StaticSiteCustomDomainRequestPropertiesARMResource) (result StaticSitesValidateCustomDomainCanBeAddedToStaticSiteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticSitesClient.ValidateCustomDomainCanBeAddedToStaticSite") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.StaticSitesClient", "ValidateCustomDomainCanBeAddedToStaticSite", err.Error()) + } + + req, err := client.ValidateCustomDomainCanBeAddedToStaticSitePreparer(ctx, resourceGroupName, name, domainName, staticSiteCustomDomainRequestPropertiesEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ValidateCustomDomainCanBeAddedToStaticSite", nil, "Failure preparing request") + return + } + + result, err = client.ValidateCustomDomainCanBeAddedToStaticSiteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.StaticSitesClient", "ValidateCustomDomainCanBeAddedToStaticSite", result.Response(), "Failure sending request") + return + } + + return +} + +// ValidateCustomDomainCanBeAddedToStaticSitePreparer prepares the ValidateCustomDomainCanBeAddedToStaticSite request. +func (client StaticSitesClient) ValidateCustomDomainCanBeAddedToStaticSitePreparer(ctx context.Context, resourceGroupName string, name string, domainName string, staticSiteCustomDomainRequestPropertiesEnvelope StaticSiteCustomDomainRequestPropertiesARMResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName}/validate", pathParameters), + autorest.WithJSON(staticSiteCustomDomainRequestPropertiesEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateCustomDomainCanBeAddedToStaticSiteSender sends the ValidateCustomDomainCanBeAddedToStaticSite request. The method will close the +// http.Response Body if it receives an error. +func (client StaticSitesClient) ValidateCustomDomainCanBeAddedToStaticSiteSender(req *http.Request) (future StaticSitesValidateCustomDomainCanBeAddedToStaticSiteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ValidateCustomDomainCanBeAddedToStaticSiteResponder handles the response to the ValidateCustomDomainCanBeAddedToStaticSite request. The method always +// closes the http.Response Body. +func (client StaticSitesClient) ValidateCustomDomainCanBeAddedToStaticSiteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/topleveldomains.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/topleveldomains.go new file mode 100644 index 000000000000..5572d05bb119 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/topleveldomains.go @@ -0,0 +1,337 @@ +package web + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// TopLevelDomainsClient is the webSite Management Client +type TopLevelDomainsClient struct { + BaseClient +} + +// NewTopLevelDomainsClient creates an instance of the TopLevelDomainsClient client. +func NewTopLevelDomainsClient(subscriptionID string) TopLevelDomainsClient { + return NewTopLevelDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTopLevelDomainsClientWithBaseURI creates an instance of the TopLevelDomainsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewTopLevelDomainsClientWithBaseURI(baseURI string, subscriptionID string) TopLevelDomainsClient { + return TopLevelDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get description for Get details of a top-level domain. +// Parameters: +// name - name of the top-level domain. +func (client TopLevelDomainsClient) Get(ctx context.Context, name string) (result TopLevelDomain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopLevelDomainsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client TopLevelDomainsClient) GetPreparer(ctx context.Context, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TopLevelDomainsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TopLevelDomainsClient) GetResponder(resp *http.Response) (result TopLevelDomain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List description for Get all top-level domains supported for registration. +func (client TopLevelDomainsClient) List(ctx context.Context) (result TopLevelDomainCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopLevelDomainsClient.List") + defer func() { + sc := -1 + if result.tldc.Response.Response != nil { + sc = result.tldc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.tldc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", resp, "Failure sending request") + return + } + + result.tldc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", resp, "Failure responding to request") + return + } + if result.tldc.hasNextLink() && result.tldc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client TopLevelDomainsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client TopLevelDomainsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client TopLevelDomainsClient) ListResponder(resp *http.Response) (result TopLevelDomainCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client TopLevelDomainsClient) listNextResults(ctx context.Context, lastResults TopLevelDomainCollection) (result TopLevelDomainCollection, err error) { + req, err := lastResults.topLevelDomainCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TopLevelDomainsClient) ListComplete(ctx context.Context) (result TopLevelDomainCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopLevelDomainsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListAgreements description for Gets all legal agreements that user needs to accept before purchasing a domain. +// Parameters: +// name - name of the top-level domain. +// agreementOption - domain agreement options. +func (client TopLevelDomainsClient) ListAgreements(ctx context.Context, name string, agreementOption TopLevelDomainAgreementOption) (result TldLegalAgreementCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopLevelDomainsClient.ListAgreements") + defer func() { + sc := -1 + if result.tlac.Response.Response != nil { + sc = result.tlac.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAgreementsNextResults + req, err := client.ListAgreementsPreparer(ctx, name, agreementOption) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", nil, "Failure preparing request") + return + } + + resp, err := client.ListAgreementsSender(req) + if err != nil { + result.tlac.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", resp, "Failure sending request") + return + } + + result.tlac, err = client.ListAgreementsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", resp, "Failure responding to request") + return + } + if result.tlac.hasNextLink() && result.tlac.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAgreementsPreparer prepares the ListAgreements request. +func (client TopLevelDomainsClient) ListAgreementsPreparer(ctx context.Context, name string, agreementOption TopLevelDomainAgreementOption) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}/listAgreements", pathParameters), + autorest.WithJSON(agreementOption), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAgreementsSender sends the ListAgreements request. The method will close the +// http.Response Body if it receives an error. +func (client TopLevelDomainsClient) ListAgreementsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAgreementsResponder handles the response to the ListAgreements request. The method always +// closes the http.Response Body. +func (client TopLevelDomainsClient) ListAgreementsResponder(resp *http.Response) (result TldLegalAgreementCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAgreementsNextResults retrieves the next set of results, if any. +func (client TopLevelDomainsClient) listAgreementsNextResults(ctx context.Context, lastResults TldLegalAgreementCollection) (result TldLegalAgreementCollection, err error) { + req, err := lastResults.tldLegalAgreementCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "listAgreementsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAgreementsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "listAgreementsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAgreementsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "listAgreementsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAgreementsComplete enumerates all values, automatically crossing page boundaries as required. +func (client TopLevelDomainsClient) ListAgreementsComplete(ctx context.Context, name string, agreementOption TopLevelDomainAgreementOption) (result TldLegalAgreementCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopLevelDomainsClient.ListAgreements") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAgreements(ctx, name, agreementOption) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/version.go new file mode 100644 index 000000000000..9324c4eed99c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web/version.go @@ -0,0 +1,19 @@ +package web + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " web/2021-03-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/README.md b/vendor/github.com/Azure/go-autorest/autorest/adal/README.md index fec416a9c415..b11eb07884b0 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/README.md +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/README.md @@ -1,3 +1,5 @@ +# NOTE: This module will go out of support by March 31, 2023. For authenticating with Azure AD, use module [azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity) instead. For help migrating from `adal` to `azidentiy` please consult the [migration guide](https://aka.ms/azsdk/go/identity/migration). General information about the retirement of this and other legacy modules can be found [here](https://azure.microsoft.com/updates/support-for-azure-sdk-libraries-that-do-not-conform-to-our-current-azure-sdk-guidelines-will-be-retired-as-of-31-march-2023/). + # Azure Active Directory authentication for Go This is a standalone package for authenticating with Azure Active @@ -18,7 +20,7 @@ go get -u github.com/Azure/go-autorest/autorest/adal ## Usage -An Active Directory application is required in order to use this library. An application can be registered in the [Azure Portal](https://portal.azure.com/) by following these [guidelines](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-integrating-applications) or using the [Azure CLI](https://github.com/Azure/azure-cli). +An Active Directory application is required in order to use this library. An application can be registered in the [Azure Portal](https://portal.azure.com/) by following these [guidelines](https://docs.microsoft.com/azure/active-directory/develop/active-directory-integrating-applications) or using the [Azure CLI](https://github.com/Azure/azure-cli). ### Register an Azure AD Application with secret @@ -88,7 +90,7 @@ An Active Directory application is required in order to use this library. An app ### Grant the necessary permissions Azure relies on a Role-Based Access Control (RBAC) model to manage the access to resources at a fine-grained -level. There is a set of [pre-defined roles](https://docs.microsoft.com/en-us/azure/active-directory/role-based-access-built-in-roles) +level. There is a set of [pre-defined roles](https://docs.microsoft.com/azure/active-directory/role-based-access-built-in-roles) which can be assigned to a service principal of an Azure AD application depending of your needs. ``` @@ -104,7 +106,7 @@ It is also possible to define custom role definitions. az role definition create --role-definition role-definition.json ``` -* Check [custom roles](https://docs.microsoft.com/en-us/azure/active-directory/role-based-access-control-custom-roles) for more details regarding the content of `role-definition.json` file. +* Check [custom roles](https://docs.microsoft.com/azure/active-directory/role-based-access-control-custom-roles) for more details regarding the content of `role-definition.json` file. ### Acquire Access Token diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/token.go b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go index 310be07ec335..c90209a9484a 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/token.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go @@ -177,7 +177,7 @@ func (t Token) WillExpireIn(d time.Duration) bool { return !t.Expires().After(time.Now().Add(d)) } -//OAuthToken return the current access token +// OAuthToken return the current access token func (t *Token) OAuthToken() string { return t.AccessToken } @@ -365,6 +365,25 @@ func (secret ServicePrincipalAuthorizationCodeSecret) MarshalJSON() ([]byte, err }) } +// ServicePrincipalFederatedSecret implements ServicePrincipalSecret for Federated JWTs. +type ServicePrincipalFederatedSecret struct { + jwt string +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. +// It will populate the form submitted during OAuth Token Acquisition using a JWT signed by an OIDC issuer. +func (secret *ServicePrincipalFederatedSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + + v.Set("client_assertion", secret.jwt) + v.Set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer") + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (secret ServicePrincipalFederatedSecret) MarshalJSON() ([]byte, error) { + return nil, errors.New("marshalling ServicePrincipalFederatedSecret is not supported") +} + // ServicePrincipalToken encapsulates a Token created for a Service Principal. type ServicePrincipalToken struct { inner servicePrincipalToken @@ -419,6 +438,8 @@ func (spt *ServicePrincipalToken) UnmarshalJSON(data []byte) error { spt.inner.Secret = &ServicePrincipalUsernamePasswordSecret{} case "ServicePrincipalAuthorizationCodeSecret": spt.inner.Secret = &ServicePrincipalAuthorizationCodeSecret{} + case "ServicePrincipalFederatedSecret": + return errors.New("unmarshalling ServicePrincipalFederatedSecret is not supported") default: return fmt.Errorf("unrecognized token type '%s'", secret["type"]) } @@ -665,6 +686,31 @@ func NewServicePrincipalTokenFromAuthorizationCode(oauthConfig OAuthConfig, clie ) } +// NewServicePrincipalTokenFromFederatedToken creates a ServicePrincipalToken from the supplied federated OIDC JWT. +func NewServicePrincipalTokenFromFederatedToken(oauthConfig OAuthConfig, clientID string, jwt string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + if err := validateOAuthConfig(oauthConfig); err != nil { + return nil, err + } + if err := validateStringParam(clientID, "clientID"); err != nil { + return nil, err + } + if err := validateStringParam(resource, "resource"); err != nil { + return nil, err + } + if jwt == "" { + return nil, fmt.Errorf("parameter 'jwt' cannot be empty") + } + return NewServicePrincipalTokenWithSecret( + oauthConfig, + clientID, + resource, + &ServicePrincipalFederatedSecret{ + jwt: jwt, + }, + callbacks..., + ) +} + type msiType int const ( @@ -1058,8 +1104,8 @@ func (spt *ServicePrincipalToken) refreshInternal(ctx context.Context, resource // AAD returns expires_in as a string, ADFS returns it as an int ExpiresIn json.Number `json:"expires_in"` - // expires_on can be in two formats, a UTC time stamp or the number of seconds. - ExpiresOn string `json:"expires_on"` + // expires_on can be in three formats, a UTC time stamp, or the number of seconds as a string *or* int. + ExpiresOn interface{} `json:"expires_on"` NotBefore json.Number `json:"not_before"` Resource string `json:"resource"` @@ -1072,7 +1118,7 @@ func (spt *ServicePrincipalToken) refreshInternal(ctx context.Context, resource } expiresOn := json.Number("") // ADFS doesn't include the expires_on field - if token.ExpiresOn != "" { + if token.ExpiresOn != nil { if expiresOn, err = parseExpiresOn(token.ExpiresOn); err != nil { return newTokenRefreshError(fmt.Sprintf("adal: failed to parse expires_on: %v value '%s'", err, token.ExpiresOn), resp) } @@ -1089,18 +1135,27 @@ func (spt *ServicePrincipalToken) refreshInternal(ctx context.Context, resource } // converts expires_on to the number of seconds -func parseExpiresOn(s string) (json.Number, error) { - // convert the expiration date to the number of seconds from now +func parseExpiresOn(s interface{}) (json.Number, error) { + // the JSON unmarshaler treats JSON numbers unmarshaled into an interface{} as float64 + asFloat64, ok := s.(float64) + if ok { + // this is the number of seconds as int case + return json.Number(strconv.FormatInt(int64(asFloat64), 10)), nil + } + asStr, ok := s.(string) + if !ok { + return "", fmt.Errorf("unexpected expires_on type %T", s) + } + // convert the expiration date to the number of seconds from the unix epoch timeToDuration := func(t time.Time) json.Number { - dur := t.Sub(time.Now().UTC()) - return json.Number(strconv.FormatInt(int64(dur.Round(time.Second).Seconds()), 10)) + return json.Number(strconv.FormatInt(t.UTC().Unix(), 10)) } - if _, err := strconv.ParseInt(s, 10, 64); err == nil { + if _, err := json.Number(asStr).Int64(); err == nil { // this is the number of seconds case, no conversion required - return json.Number(s), nil - } else if eo, err := time.Parse(expiresOnDateFormatPM, s); err == nil { + return json.Number(asStr), nil + } else if eo, err := time.Parse(expiresOnDateFormatPM, asStr); err == nil { return timeToDuration(eo), nil - } else if eo, err := time.Parse(expiresOnDateFormat, s); err == nil { + } else if eo, err := time.Parse(expiresOnDateFormat, asStr); err == nil { return timeToDuration(eo), nil } else { // unknown format @@ -1317,12 +1372,25 @@ func NewMultiTenantServicePrincipalTokenFromCertificate(multiTenantCfg MultiTena // MSIAvailable returns true if the MSI endpoint is available for authentication. func MSIAvailable(ctx context.Context, s Sender) bool { + msiType, _, err := getMSIType() + + if err != nil { + return false + } + + if msiType != msiTypeIMDS { + return true + } + if s == nil { s = sender() } + resp, err := getMSIEndpoint(ctx, s) + if err == nil { resp.Body.Close() } + return err == nil } diff --git a/vendor/github.com/apparentlymart/go-cidr/LICENSE b/vendor/github.com/apparentlymart/go-cidr/LICENSE deleted file mode 100644 index 21253788607b..000000000000 --- a/vendor/github.com/apparentlymart/go-cidr/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2015 Martin Atkins - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/apparentlymart/go-cidr/cidr/cidr.go b/vendor/github.com/apparentlymart/go-cidr/cidr/cidr.go deleted file mode 100644 index 20823af04110..000000000000 --- a/vendor/github.com/apparentlymart/go-cidr/cidr/cidr.go +++ /dev/null @@ -1,236 +0,0 @@ -// Package cidr is a collection of assorted utilities for computing -// network and host addresses within network ranges. -// -// It expects a CIDR-type address structure where addresses are divided into -// some number of prefix bits representing the network and then the remaining -// suffix bits represent the host. -// -// For example, it can help to calculate addresses for sub-networks of a -// parent network, or to calculate host addresses within a particular prefix. -// -// At present this package is prioritizing simplicity of implementation and -// de-prioritizing speed and memory usage. Thus caution is advised before -// using this package in performance-critical applications or hot codepaths. -// Patches to improve the speed and memory usage may be accepted as long as -// they do not result in a significant increase in code complexity. -package cidr - -import ( - "fmt" - "math/big" - "net" -) - -// Subnet takes a parent CIDR range and creates a subnet within it -// with the given number of additional prefix bits and the given -// network number. -// -// For example, 10.3.0.0/16, extended by 8 bits, with a network number -// of 5, becomes 10.3.5.0/24 . -func Subnet(base *net.IPNet, newBits int, num int) (*net.IPNet, error) { - return SubnetBig(base, newBits, big.NewInt(int64(num))) -} - -// SubnetBig takes a parent CIDR range and creates a subnet within it with the -// given number of additional prefix bits and the given network number. It -// differs from Subnet in that it takes a *big.Int for the num, instead of an int. -// -// For example, 10.3.0.0/16, extended by 8 bits, with a network number of 5, -// becomes 10.3.5.0/24 . -func SubnetBig(base *net.IPNet, newBits int, num *big.Int) (*net.IPNet, error) { - ip := base.IP - mask := base.Mask - - parentLen, addrLen := mask.Size() - newPrefixLen := parentLen + newBits - - if newPrefixLen > addrLen { - return nil, fmt.Errorf("insufficient address space to extend prefix of %d by %d", parentLen, newBits) - } - - maxNetNum := uint64(1< maxNetNum { - return nil, fmt.Errorf("prefix extension of %d does not accommodate a subnet numbered %d", newBits, num) - } - - return &net.IPNet{ - IP: insertNumIntoIP(ip, num, newPrefixLen), - Mask: net.CIDRMask(newPrefixLen, addrLen), - }, nil -} - -// Host takes a parent CIDR range and turns it into a host IP address with the -// given host number. -// -// For example, 10.3.0.0/16 with a host number of 2 gives 10.3.0.2. -func Host(base *net.IPNet, num int) (net.IP, error) { - return HostBig(base, big.NewInt(int64(num))) -} - -// HostBig takes a parent CIDR range and turns it into a host IP address with -// the given host number. It differs from Host in that it takes a *big.Int for -// the num, instead of an int. -// -// For example, 10.3.0.0/16 with a host number of 2 gives 10.3.0.2. -func HostBig(base *net.IPNet, num *big.Int) (net.IP, error) { - ip := base.IP - mask := base.Mask - - parentLen, addrLen := mask.Size() - hostLen := addrLen - parentLen - - maxHostNum := big.NewInt(int64(1)) - maxHostNum.Lsh(maxHostNum, uint(hostLen)) - maxHostNum.Sub(maxHostNum, big.NewInt(1)) - - numUint64 := big.NewInt(int64(num.Uint64())) - if num.Cmp(big.NewInt(0)) == -1 { - numUint64.Neg(num) - numUint64.Sub(numUint64, big.NewInt(int64(1))) - num.Sub(maxHostNum, numUint64) - } - - if numUint64.Cmp(maxHostNum) == 1 { - return nil, fmt.Errorf("prefix of %d does not accommodate a host numbered %d", parentLen, num) - } - var bitlength int - if ip.To4() != nil { - bitlength = 32 - } else { - bitlength = 128 - } - return insertNumIntoIP(ip, num, bitlength), nil -} - -// AddressRange returns the first and last addresses in the given CIDR range. -func AddressRange(network *net.IPNet) (net.IP, net.IP) { - // the first IP is easy - firstIP := network.IP - - // the last IP is the network address OR NOT the mask address - prefixLen, bits := network.Mask.Size() - if prefixLen == bits { - // Easy! - // But make sure that our two slices are distinct, since they - // would be in all other cases. - lastIP := make([]byte, len(firstIP)) - copy(lastIP, firstIP) - return firstIP, lastIP - } - - firstIPInt, bits := ipToInt(firstIP) - hostLen := uint(bits) - uint(prefixLen) - lastIPInt := big.NewInt(1) - lastIPInt.Lsh(lastIPInt, hostLen) - lastIPInt.Sub(lastIPInt, big.NewInt(1)) - lastIPInt.Or(lastIPInt, firstIPInt) - - return firstIP, intToIP(lastIPInt, bits) -} - -// AddressCount returns the number of distinct host addresses within the given -// CIDR range. -// -// Since the result is a uint64, this function returns meaningful information -// only for IPv4 ranges and IPv6 ranges with a prefix size of at least 65. -func AddressCount(network *net.IPNet) uint64 { - prefixLen, bits := network.Mask.Size() - return 1 << (uint64(bits) - uint64(prefixLen)) -} - -//VerifyNoOverlap takes a list subnets and supernet (CIDRBlock) and verifies -//none of the subnets overlap and all subnets are in the supernet -//it returns an error if any of those conditions are not satisfied -func VerifyNoOverlap(subnets []*net.IPNet, CIDRBlock *net.IPNet) error { - firstLastIP := make([][]net.IP, len(subnets)) - for i, s := range subnets { - first, last := AddressRange(s) - firstLastIP[i] = []net.IP{first, last} - } - for i, s := range subnets { - if !CIDRBlock.Contains(firstLastIP[i][0]) || !CIDRBlock.Contains(firstLastIP[i][1]) { - return fmt.Errorf("%s does not fully contain %s", CIDRBlock.String(), s.String()) - } - for j := 0; j < len(subnets); j++ { - if i == j { - continue - } - - first := firstLastIP[j][0] - last := firstLastIP[j][1] - if s.Contains(first) || s.Contains(last) { - return fmt.Errorf("%s overlaps with %s", subnets[j].String(), s.String()) - } - } - } - return nil -} - -// PreviousSubnet returns the subnet of the desired mask in the IP space -// just lower than the start of IPNet provided. If the IP space rolls over -// then the second return value is true -func PreviousSubnet(network *net.IPNet, prefixLen int) (*net.IPNet, bool) { - startIP := checkIPv4(network.IP) - previousIP := make(net.IP, len(startIP)) - copy(previousIP, startIP) - cMask := net.CIDRMask(prefixLen, 8*len(previousIP)) - previousIP = Dec(previousIP) - previous := &net.IPNet{IP: previousIP.Mask(cMask), Mask: cMask} - if startIP.Equal(net.IPv4zero) || startIP.Equal(net.IPv6zero) { - return previous, true - } - return previous, false -} - -// NextSubnet returns the next available subnet of the desired mask size -// starting for the maximum IP of the offset subnet -// If the IP exceeds the maxium IP then the second return value is true -func NextSubnet(network *net.IPNet, prefixLen int) (*net.IPNet, bool) { - _, currentLast := AddressRange(network) - mask := net.CIDRMask(prefixLen, 8*len(currentLast)) - currentSubnet := &net.IPNet{IP: currentLast.Mask(mask), Mask: mask} - _, last := AddressRange(currentSubnet) - last = Inc(last) - next := &net.IPNet{IP: last.Mask(mask), Mask: mask} - if last.Equal(net.IPv4zero) || last.Equal(net.IPv6zero) { - return next, true - } - return next, false -} - -//Inc increases the IP by one this returns a new []byte for the IP -func Inc(IP net.IP) net.IP { - IP = checkIPv4(IP) - incIP := make([]byte, len(IP)) - copy(incIP, IP) - for j := len(incIP) - 1; j >= 0; j-- { - incIP[j]++ - if incIP[j] > 0 { - break - } - } - return incIP -} - -//Dec decreases the IP by one this returns a new []byte for the IP -func Dec(IP net.IP) net.IP { - IP = checkIPv4(IP) - decIP := make([]byte, len(IP)) - copy(decIP, IP) - decIP = checkIPv4(decIP) - for j := len(decIP) - 1; j >= 0; j-- { - decIP[j]-- - if decIP[j] < 255 { - break - } - } - return decIP -} - -func checkIPv4(ip net.IP) net.IP { - // Go for some reason allocs IPv6len for IPv4 so we have to correct it - if v4 := ip.To4(); v4 != nil { - return v4 - } - return ip -} diff --git a/vendor/github.com/apparentlymart/go-cidr/cidr/wrangling.go b/vendor/github.com/apparentlymart/go-cidr/cidr/wrangling.go deleted file mode 100644 index e5e6a2cf91a1..000000000000 --- a/vendor/github.com/apparentlymart/go-cidr/cidr/wrangling.go +++ /dev/null @@ -1,37 +0,0 @@ -package cidr - -import ( - "fmt" - "math/big" - "net" -) - -func ipToInt(ip net.IP) (*big.Int, int) { - val := &big.Int{} - val.SetBytes([]byte(ip)) - if len(ip) == net.IPv4len { - return val, 32 - } else if len(ip) == net.IPv6len { - return val, 128 - } else { - panic(fmt.Errorf("Unsupported address length %d", len(ip))) - } -} - -func intToIP(ipInt *big.Int, bits int) net.IP { - ipBytes := ipInt.Bytes() - ret := make([]byte, bits/8) - // Pack our IP bytes into the end of the return array, - // since big.Int.Bytes() removes front zero padding. - for i := 1; i <= len(ipBytes); i++ { - ret[len(ret)-i] = ipBytes[len(ipBytes)-i] - } - return net.IP(ret) -} - -func insertNumIntoIP(ip net.IP, bigNum *big.Int, prefixLen int) net.IP { - ipInt, totalBits := ipToInt(ip) - bigNum.Lsh(bigNum, uint(totalBits-prefixLen)) - ipInt.Or(ipInt, bigNum) - return intToIP(ipInt, totalBits) -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/README.md b/vendor/github.com/golang-jwt/jwt/v4/README.md index 01b21646e015..30f2f2a6f70c 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/README.md +++ b/vendor/github.com/golang-jwt/jwt/v4/README.md @@ -36,24 +36,39 @@ The part in the middle is the interesting bit. It's called the Claims and conta This library supports the parsing and verification as well as the generation and signing of JWTs. Current supported signing algorithms are HMAC SHA, RSA, RSA-PSS, and ECDSA, though hooks are present for adding your own. +## Installation Guidelines + +1. To install the jwt package, you first need to have [Go](https://go.dev/doc/install) installed, then you can use the command below to add `jwt-go` as a dependency in your Go program. + +```sh +go get -u github.com/golang-jwt/jwt/v4 +``` + +2. Import it in your code: + +```go +import "github.com/golang-jwt/jwt/v4" +``` + ## Examples -See [the project documentation](https://pkg.go.dev/github.com/golang-jwt/jwt) for examples of usage: +See [the project documentation](https://pkg.go.dev/github.com/golang-jwt/jwt/v4) for examples of usage: -* [Simple example of parsing and validating a token](https://pkg.go.dev/github.com/golang-jwt/jwt#example-Parse-Hmac) -* [Simple example of building and signing a token](https://pkg.go.dev/github.com/golang-jwt/jwt#example-New-Hmac) -* [Directory of Examples](https://pkg.go.dev/github.com/golang-jwt/jwt#pkg-examples) +* [Simple example of parsing and validating a token](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#example-Parse-Hmac) +* [Simple example of building and signing a token](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#example-New-Hmac) +* [Directory of Examples](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#pkg-examples) ## Extensions -This library publishes all the necessary components for adding your own signing methods. Simply implement the `SigningMethod` interface and register a factory method using `RegisterSigningMethod`. +This library publishes all the necessary components for adding your own signing methods or key functions. Simply implement the `SigningMethod` interface and register a factory method using `RegisterSigningMethod` or provide a `jwt.Keyfunc`. -A common use case would be integrating with different 3rd party signature providers, like key management services from various cloud providers or Hardware Security Modules (HSMs). +A common use case would be integrating with different 3rd party signature providers, like key management services from various cloud providers or Hardware Security Modules (HSMs) or to implement additional standards. -| Extension | Purpose | Repo | -|-----------|----------------------------------------------------------------------------------------------|--------------------------------------------| -| GCP | Integrates with multiple Google Cloud Platform signing tools (AppEngine, IAM API, Cloud KMS) | https://github.com/someone1/gcp-jwt-go | -| AWS | Integrates with AWS Key Management Service, KMS | https://github.com/matelang/jwt-go-aws-kms | +| Extension | Purpose | Repo | +| --------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------ | +| GCP | Integrates with multiple Google Cloud Platform signing tools (AppEngine, IAM API, Cloud KMS) | https://github.com/someone1/gcp-jwt-go | +| AWS | Integrates with AWS Key Management Service, KMS | https://github.com/matelang/jwt-go-aws-kms | +| JWKS | Provides support for JWKS ([RFC 7517](https://datatracker.ietf.org/doc/html/rfc7517)) as a `jwt.Keyfunc` | https://github.com/MicahParks/keyfunc | *Disclaimer*: Unless otherwise specified, these integrations are maintained by third parties and should not be considered as a primary offer by any of the mentioned cloud providers @@ -81,7 +96,7 @@ A token is simply a JSON object that is signed by its author. this tells you exa * The author of the token was in the possession of the signing secret * The data has not been modified since it was signed -It's important to know that JWT does not provide encryption, which means anyone who has access to the token can read its contents. If you need to protect (encrypt) the data, there is a companion spec, `JWE`, that provides this functionality. JWE is currently outside the scope of this library. +It's important to know that JWT does not provide encryption, which means anyone who has access to the token can read its contents. If you need to protect (encrypt) the data, there is a companion spec, `JWE`, that provides this functionality. The companion project https://github.com/golang-jwt/jwe aims at a (very) experimental implementation of the JWE standard. ### Choosing a Signing Method @@ -95,10 +110,10 @@ Asymmetric signing methods, such as RSA, use different keys for signing and veri Each signing method expects a different object type for its signing keys. See the package documentation for details. Here are the most common ones: -* The [HMAC signing method](https://pkg.go.dev/github.com/golang-jwt/jwt#SigningMethodHMAC) (`HS256`,`HS384`,`HS512`) expect `[]byte` values for signing and validation -* The [RSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt#SigningMethodRSA) (`RS256`,`RS384`,`RS512`) expect `*rsa.PrivateKey` for signing and `*rsa.PublicKey` for validation -* The [ECDSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt#SigningMethodECDSA) (`ES256`,`ES384`,`ES512`) expect `*ecdsa.PrivateKey` for signing and `*ecdsa.PublicKey` for validation -* The [EdDSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt#SigningMethodEd25519) (`Ed25519`) expect `ed25519.PrivateKey` for signing and `ed25519.PublicKey` for validation +* The [HMAC signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodHMAC) (`HS256`,`HS384`,`HS512`) expect `[]byte` values for signing and validation +* The [RSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodRSA) (`RS256`,`RS384`,`RS512`) expect `*rsa.PrivateKey` for signing and `*rsa.PublicKey` for validation +* The [ECDSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodECDSA) (`ES256`,`ES384`,`ES512`) expect `*ecdsa.PrivateKey` for signing and `*ecdsa.PublicKey` for validation +* The [EdDSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodEd25519) (`Ed25519`) expect `ed25519.PrivateKey` for signing and `ed25519.PublicKey` for validation ### JWT and OAuth @@ -116,7 +131,7 @@ This library uses descriptive error messages whenever possible. If you are not g ## More -Documentation can be found [on pkg.go.dev](https://pkg.go.dev/github.com/golang-jwt/jwt). +Documentation can be found [on pkg.go.dev](https://pkg.go.dev/github.com/golang-jwt/jwt/v4). The command line utility included in this project (cmd/jwt) provides a straightforward example of token creation and parsing as well as a useful tool for debugging your own integration. You'll also find several implementation examples in the documentation. diff --git a/vendor/github.com/golang-jwt/jwt/v4/SECURITY.md b/vendor/github.com/golang-jwt/jwt/v4/SECURITY.md new file mode 100644 index 000000000000..b08402c3427f --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v4/SECURITY.md @@ -0,0 +1,19 @@ +# Security Policy + +## Supported Versions + +As of February 2022 (and until this document is updated), the latest version `v4` is supported. + +## Reporting a Vulnerability + +If you think you found a vulnerability, and even if you are not sure, please report it to jwt-go-security@googlegroups.com or one of the other [golang-jwt maintainers](https://github.com/orgs/golang-jwt/people). Please try be explicit, describe steps to reproduce the security issue with code example(s). + +You will receive a response within a timely manner. If the issue is confirmed, we will do our best to release a patch as soon as possible given the complexity of the problem. + +## Public Discussions + +Please avoid publicly discussing a potential security vulnerability. + +Let's take this offline and find a solution first, this limits the potential impact as much as possible. + +We appreciate your help! diff --git a/vendor/github.com/golang-jwt/jwt/v4/claims.go b/vendor/github.com/golang-jwt/jwt/v4/claims.go index 9d95cad2bf27..364cec8773cd 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/claims.go +++ b/vendor/github.com/golang-jwt/jwt/v4/claims.go @@ -265,9 +265,5 @@ func verifyIss(iss string, cmp string, required bool) bool { if iss == "" { return !required } - if subtle.ConstantTimeCompare([]byte(iss), []byte(cmp)) != 0 { - return true - } else { - return false - } + return subtle.ConstantTimeCompare([]byte(iss), []byte(cmp)) != 0 } diff --git a/vendor/github.com/golang-jwt/jwt/v4/parser.go b/vendor/github.com/golang-jwt/jwt/v4/parser.go index 2f61a69d7fcb..c0a6f6927917 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/parser.go +++ b/vendor/github.com/golang-jwt/jwt/v4/parser.go @@ -42,6 +42,13 @@ func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) { return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc) } +// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object implementing the Claims +// interface. This provides default values which can be overridden and allows a caller to use their own type, rather +// than the default MapClaims implementation of Claims. +// +// Note: If you provide a custom claim implementation that embeds one of the standard claims (such as RegisteredClaims), +// make sure that a) you either embed a non-pointer version of the claims or b) if you are using a pointer, allocate the +// proper memory for it before passing in the overall claims, otherwise you might run into a panic. func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) { token, parts, err := p.ParseUnverified(tokenString, claims) if err != nil { diff --git a/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go b/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go index 5a8502feb34b..4fd6f9e610b0 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go +++ b/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go @@ -1,3 +1,4 @@ +//go:build go1.4 // +build go1.4 package jwt diff --git a/vendor/github.com/golang-jwt/jwt/v4/token.go b/vendor/github.com/golang-jwt/jwt/v4/token.go index 09b4cde5aebd..71e909ea6538 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/token.go +++ b/vendor/github.com/golang-jwt/jwt/v4/token.go @@ -7,7 +7,6 @@ import ( "time" ) - // DecodePaddingAllowed will switch the codec used for decoding JWTs respectively. Note that the JWS RFC7515 // states that the tokens will utilize a Base64url encoding with no padding. Unfortunately, some implementations // of JWT are producing non-standard tokens, and thus require support for decoding. Note that this is a global @@ -100,6 +99,11 @@ func Parse(tokenString string, keyFunc Keyfunc, options ...ParserOption) (*Token return NewParser(options...).Parse(tokenString, keyFunc) } +// ParseWithClaims is a shortcut for NewParser().ParseWithClaims(). +// +// Note: If you provide a custom claim implementation that embeds one of the standard claims (such as RegisteredClaims), +// make sure that a) you either embed a non-pointer version of the claims or b) if you are using a pointer, allocate the +// proper memory for it before passing in the overall claims, otherwise you might run into a panic. func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc, options ...ParserOption) (*Token, error) { return NewParser(options...).ParseWithClaims(tokenString, claims, keyFunc) } diff --git a/vendor/github.com/golang-jwt/jwt/v4/types.go b/vendor/github.com/golang-jwt/jwt/v4/types.go index 2c647fd2e6d2..ac8e140eb119 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/types.go +++ b/vendor/github.com/golang-jwt/jwt/v4/types.go @@ -53,9 +53,23 @@ func (date NumericDate) MarshalJSON() (b []byte, err error) { if TimePrecision < time.Second { prec = int(math.Log10(float64(time.Second) / float64(TimePrecision))) } - f := float64(date.Truncate(TimePrecision).UnixNano()) / float64(time.Second) - - return []byte(strconv.FormatFloat(f, 'f', prec, 64)), nil + truncatedDate := date.Truncate(TimePrecision) + + // For very large timestamps, UnixNano would overflow an int64, but this + // function requires nanosecond level precision, so we have to use the + // following technique to get round the issue: + // 1. Take the normal unix timestamp to form the whole number part of the + // output, + // 2. Take the result of the Nanosecond function, which retuns the offset + // within the second of the particular unix time instance, to form the + // decimal part of the output + // 3. Concatenate them to produce the final result + seconds := strconv.FormatInt(truncatedDate.Unix(), 10) + nanosecondsOffset := strconv.FormatFloat(float64(truncatedDate.Nanosecond())/float64(time.Second), 'f', prec, 64) + + output := append([]byte(seconds), []byte(nanosecondsOffset)[1:]...) + + return output, nil } // UnmarshalJSON is an implementation of the json.RawMessage interface and deserializses a diff --git a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method.go b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method.go index dc8e90fbd0aa..0b5f05435542 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package authentication import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_azure_cli_token.go b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_azure_cli_token.go index 6ec47d395840..91f810245208 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_azure_cli_token.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_azure_cli_token.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package authentication import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_azure_cli_token_multi_tenant.go b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_azure_cli_token_multi_tenant.go index 4b2245700eb9..c867331c34c5 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_azure_cli_token_multi_tenant.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_azure_cli_token_multi_tenant.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package authentication import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_client_cert.go b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_client_cert.go index 843457b21424..6a537ede9835 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_client_cert.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_client_cert.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package authentication import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_client_secret.go b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_client_secret.go index a7bc16020f5f..491a8ca6f1bd 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_client_secret.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_client_secret.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package authentication import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_client_secret_multi_tenant.go b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_client_secret_multi_tenant.go index 702976627a95..53e2e6b12e3e 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_client_secret_multi_tenant.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_client_secret_multi_tenant.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package authentication import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_msi.go b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_msi.go index c6ca3070fd0d..22f80ad6b234 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_msi.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_msi.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package authentication import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_oidc.go b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_oidc.go index 9f67922c31cf..ac3edb8d32d4 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_oidc.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/authentication/auth_method_oidc.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package authentication import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/authentication/azure_cli_profile_multi_tenant.go b/vendor/github.com/hashicorp/go-azure-helpers/authentication/azure_cli_profile_multi_tenant.go index 78cf454ada8b..ef8409cef6de 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/authentication/azure_cli_profile_multi_tenant.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/authentication/azure_cli_profile_multi_tenant.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package authentication import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/authentication/azure_cli_profile_multi_tenant_population.go b/vendor/github.com/hashicorp/go-azure-helpers/authentication/azure_cli_profile_multi_tenant_population.go index 570a762bf0ef..78c39904f0d3 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/authentication/azure_cli_profile_multi_tenant_population.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/authentication/azure_cli_profile_multi_tenant_population.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package authentication import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/authentication/azure_sp_objectid.go b/vendor/github.com/hashicorp/go-azure-helpers/authentication/azure_sp_objectid.go index b5cebac095e1..67484a1eff1f 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/authentication/azure_sp_objectid.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/authentication/azure_sp_objectid.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package authentication import ( @@ -199,11 +202,12 @@ func objectIdFromMsGraph(ctx context.Context, c *Config) (*string, error) { return nil, fmt.Errorf("unexpected Service Principal query result, was nil") } - if len(*result) != 1 || (*result)[0].ID == nil { + if len(*result) != 1 || (*result)[0].ID() == nil { return nil, fmt.Errorf("unexpected Service Principal query result: %+v", *result) } - return (*result)[0].ID, nil + val := (*result)[0] + return val.ID(), nil } func hamiltonRequestLogger(req *http.Request) (*http.Request, error) { diff --git a/vendor/github.com/hashicorp/go-azure-helpers/authentication/builder.go b/vendor/github.com/hashicorp/go-azure-helpers/authentication/builder.go index 55cb6bd7b626..643f5e6d14ee 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/authentication/builder.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/authentication/builder.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package authentication import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/authentication/config.go b/vendor/github.com/hashicorp/go-azure-helpers/authentication/config.go index cda3a1fb93d2..013a726c8966 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/authentication/config.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/authentication/config.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package authentication import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/authentication/environment.go b/vendor/github.com/hashicorp/go-azure-helpers/authentication/environment.go index fe0a53806680..cca46dff748f 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/authentication/environment.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/authentication/environment.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package authentication import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/lang/dates/parse.go b/vendor/github.com/hashicorp/go-azure-helpers/lang/dates/parse.go index 02b8ab85976b..f1fbf22bd952 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/lang/dates/parse.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/lang/dates/parse.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package dates import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/lang/pointer/from.go b/vendor/github.com/hashicorp/go-azure-helpers/lang/pointer/from.go index e0067ffb2c04..15931af36164 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/lang/pointer/from.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/lang/pointer/from.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package pointer // FromBool turns a boolean into a pointer to a boolean diff --git a/vendor/github.com/hashicorp/go-azure-helpers/lang/pointer/generic.go b/vendor/github.com/hashicorp/go-azure-helpers/lang/pointer/generic.go index 61ec94ee1675..0598a9e99b90 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/lang/pointer/generic.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/lang/pointer/generic.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package pointer // From is a generic function that returns the value of a pointer diff --git a/vendor/github.com/hashicorp/go-azure-helpers/lang/pointer/to.go b/vendor/github.com/hashicorp/go-azure-helpers/lang/pointer/to.go index 7f607dc20010..861c1978f537 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/lang/pointer/to.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/lang/pointer/to.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package pointer // ToBool turns a pointer to a bool into a bool, returning the default value for a bool if it's nil diff --git a/vendor/github.com/hashicorp/go-azure-helpers/lang/response/response.go b/vendor/github.com/hashicorp/go-azure-helpers/lang/response/response.go index 74495589d8bc..1fdaaeb08df6 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/lang/response/response.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/lang/response/response.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package response import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/polling/poller.go b/vendor/github.com/hashicorp/go-azure-helpers/polling/poller.go index d08c4889e02a..fca47a5daa0a 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/polling/poller.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/polling/poller.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package polling import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/cloud_services_ip_configuration.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/cloud_services_ip_configuration.go index c7044a5585ee..3d65ec80f352 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/cloud_services_ip_configuration.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/cloud_services_ip_configuration.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/cloud_services_public_ip.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/cloud_services_public_ip.go index 6f07aa560619..ff4c6eb4bdc7 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/cloud_services_public_ip.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/cloud_services_public_ip.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/express_route_circuit_peering.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/express_route_circuit_peering.go index 4af2439cfd9b..87dac48e9d98 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/express_route_circuit_peering.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/express_route_circuit_peering.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/hyperv_site_job.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/hyperv_site_job.go new file mode 100644 index 000000000000..3c8f1cf55218 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/hyperv_site_job.go @@ -0,0 +1,137 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = HyperVSiteJobId{} + +// HyperVSiteJobId is a struct representing the Resource ID for a Hyper V Site Job +type HyperVSiteJobId struct { + SubscriptionId string + ResourceGroupName string + HyperVSiteName string + JobName string +} + +// NewHyperVSiteJobID returns a new HyperVSiteJobId struct +func NewHyperVSiteJobID(subscriptionId string, resourceGroupName string, hyperVSiteName string, jobName string) HyperVSiteJobId { + return HyperVSiteJobId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + HyperVSiteName: hyperVSiteName, + JobName: jobName, + } +} + +// ParseHyperVSiteJobID parses 'input' into a HyperVSiteJobId +func ParseHyperVSiteJobID(input string) (*HyperVSiteJobId, error) { + parser := resourceids.NewParserFromResourceIdType(HyperVSiteJobId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HyperVSiteJobId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { + return nil, fmt.Errorf("the segment 'hyperVSiteName' was not found in the resource id %q", input) + } + + if id.JobName, ok = parsed.Parsed["jobName"]; !ok { + return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseHyperVSiteJobIDInsensitively parses 'input' case-insensitively into a HyperVSiteJobId +// note: this method should only be used for API response data and not user input +func ParseHyperVSiteJobIDInsensitively(input string) (*HyperVSiteJobId, error) { + parser := resourceids.NewParserFromResourceIdType(HyperVSiteJobId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HyperVSiteJobId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { + return nil, fmt.Errorf("the segment 'hyperVSiteName' was not found in the resource id %q", input) + } + + if id.JobName, ok = parsed.Parsed["jobName"]; !ok { + return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateHyperVSiteJobID checks that 'input' can be parsed as a Hyper V Site Job ID +func ValidateHyperVSiteJobID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseHyperVSiteJobID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Hyper V Site Job ID +func (id HyperVSiteJobId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OffAzure/hyperVSites/%s/jobs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.HyperVSiteName, id.JobName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Hyper V Site Job ID +func (id HyperVSiteJobId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftOffAzure", "Microsoft.OffAzure", "Microsoft.OffAzure"), + resourceids.StaticSegment("staticHyperVSites", "hyperVSites", "hyperVSites"), + resourceids.UserSpecifiedSegment("hyperVSiteName", "hyperVSiteValue"), + resourceids.StaticSegment("staticJobs", "jobs", "jobs"), + resourceids.UserSpecifiedSegment("jobName", "jobNameValue"), + } +} + +// String returns a human-readable description of this Hyper V Site Job ID +func (id HyperVSiteJobId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Hyper V Site Name: %q", id.HyperVSiteName), + fmt.Sprintf("Job Name: %q", id.JobName), + } + return fmt.Sprintf("Hyper V Site Job (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/hyperv_site_machine.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/hyperv_site_machine.go new file mode 100644 index 000000000000..1e9205ce34a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/hyperv_site_machine.go @@ -0,0 +1,137 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = HyperVSiteMachineId{} + +// HyperVSiteMachineId is a struct representing the Resource ID for a Hyper V Site Machine +type HyperVSiteMachineId struct { + SubscriptionId string + ResourceGroupName string + HyperVSiteName string + MachineName string +} + +// NewHyperVSiteMachineID returns a new HyperVSiteMachineId struct +func NewHyperVSiteMachineID(subscriptionId string, resourceGroupName string, hyperVSiteName string, machineName string) HyperVSiteMachineId { + return HyperVSiteMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + HyperVSiteName: hyperVSiteName, + MachineName: machineName, + } +} + +// ParseHyperVSiteMachineID parses 'input' into a HyperVSiteMachineId +func ParseHyperVSiteMachineID(input string) (*HyperVSiteMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(HyperVSiteMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HyperVSiteMachineId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { + return nil, fmt.Errorf("the segment 'hyperVSiteName' was not found in the resource id %q", input) + } + + if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { + return nil, fmt.Errorf("the segment 'machineName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseHyperVSiteMachineIDInsensitively parses 'input' case-insensitively into a HyperVSiteMachineId +// note: this method should only be used for API response data and not user input +func ParseHyperVSiteMachineIDInsensitively(input string) (*HyperVSiteMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(HyperVSiteMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HyperVSiteMachineId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { + return nil, fmt.Errorf("the segment 'hyperVSiteName' was not found in the resource id %q", input) + } + + if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { + return nil, fmt.Errorf("the segment 'machineName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateHyperVSiteMachineID checks that 'input' can be parsed as a Hyper V Site Machine ID +func ValidateHyperVSiteMachineID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseHyperVSiteMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Hyper V Site Machine ID +func (id HyperVSiteMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OffAzure/hyperVSites/%s/machines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.HyperVSiteName, id.MachineName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Hyper V Site Machine ID +func (id HyperVSiteMachineId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftOffAzure", "Microsoft.OffAzure", "Microsoft.OffAzure"), + resourceids.StaticSegment("staticHyperVSites", "hyperVSites", "hyperVSites"), + resourceids.UserSpecifiedSegment("hyperVSiteName", "hyperVSiteValue"), + resourceids.StaticSegment("staticMachines", "machines", "machines"), + resourceids.UserSpecifiedSegment("machineName", "machineValue"), + } +} + +// String returns a human-readable description of this Hyper V Site Machine ID +func (id HyperVSiteMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Hyper V Site Name: %q", id.HyperVSiteName), + fmt.Sprintf("Machine Name: %q", id.MachineName), + } + return fmt.Sprintf("Hyper V Site Machine (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/hyperv_site_runasaccount.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/hyperv_site_runasaccount.go new file mode 100644 index 000000000000..19a2956d2b0d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/hyperv_site_runasaccount.go @@ -0,0 +1,137 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = HyperVSiteRunAsAccountId{} + +// HyperVSiteRunAsAccountId is a struct representing the Resource ID for a Hyper V Site Run As Account +type HyperVSiteRunAsAccountId struct { + SubscriptionId string + ResourceGroupName string + HyperVSiteName string + RunAsAccountName string +} + +// NewHyperVSiteRunAsAccountID returns a new HyperVSiteRunAsAccountId struct +func NewHyperVSiteRunAsAccountID(subscriptionId string, resourceGroupName string, hyperVSiteName string, runAsAccountName string) HyperVSiteRunAsAccountId { + return HyperVSiteRunAsAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + HyperVSiteName: hyperVSiteName, + RunAsAccountName: runAsAccountName, + } +} + +// ParseHyperVSiteRunAsAccountID parses 'input' into a HyperVSiteRunAsAccountId +func ParseHyperVSiteRunAsAccountID(input string) (*HyperVSiteRunAsAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(HyperVSiteRunAsAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HyperVSiteRunAsAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { + return nil, fmt.Errorf("the segment 'hyperVSiteName' was not found in the resource id %q", input) + } + + if id.RunAsAccountName, ok = parsed.Parsed["runAsAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'runAsAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseHyperVSiteRunAsAccountIDInsensitively parses 'input' case-insensitively into a HyperVSiteRunAsAccountId +// note: this method should only be used for API response data and not user input +func ParseHyperVSiteRunAsAccountIDInsensitively(input string) (*HyperVSiteRunAsAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(HyperVSiteRunAsAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HyperVSiteRunAsAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { + return nil, fmt.Errorf("the segment 'hyperVSiteName' was not found in the resource id %q", input) + } + + if id.RunAsAccountName, ok = parsed.Parsed["runAsAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'runAsAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateHyperVSiteRunAsAccountID checks that 'input' can be parsed as a Hyper V Site Run As Account ID +func ValidateHyperVSiteRunAsAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseHyperVSiteRunAsAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Hyper V Site Run As Account ID +func (id HyperVSiteRunAsAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OffAzure/hyperVSites/%s/runAsAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.HyperVSiteName, id.RunAsAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Hyper V Site Run As Account ID +func (id HyperVSiteRunAsAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftOffAzure", "Microsoft.OffAzure", "Microsoft.OffAzure"), + resourceids.StaticSegment("staticHyperVSites", "hyperVSites", "hyperVSites"), + resourceids.UserSpecifiedSegment("hyperVSiteName", "hyperVSiteValue"), + resourceids.StaticSegment("staticRunAsAccounts", "runAsAccounts", "runAsAccounts"), + resourceids.UserSpecifiedSegment("runAsAccountName", "runAsAccountNameValue"), + } +} + +// String returns a human-readable description of this Hyper V Site RunAsAccount ID +func (id HyperVSiteRunAsAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Hyper V Site Name: %q", id.HyperVSiteName), + fmt.Sprintf("Run As Account Name: %q", id.RunAsAccountName), + } + return fmt.Sprintf("Hyper V Site Run As Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/management_group.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/management_group.go index 6ac466559443..85b9078c4f54 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/management_group.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/management_group.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/network_interface.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/network_interface.go index 9160e851f71e..586fcb9301e3 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/network_interface.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/network_interface.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/network_interface_ip_configuration.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/network_interface_ip_configuration.go index 2b5df85d41d6..3c87e07d37da 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/network_interface_ip_configuration.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/network_interface_ip_configuration.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/provisioning_service.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/provisioning_service.go index a9b4598a40af..a19f98ca370c 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/provisioning_service.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/provisioning_service.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/public_ip_address.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/public_ip_address.go index 2c8016ff36a4..d1f05beba0f7 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/public_ip_address.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/public_ip_address.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/resource_group.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/resource_group.go index a0d4dd9b6d36..688affedae8f 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/resource_group.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/resource_group.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/scope.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/scope.go index 16fa1c2258f5..a68c87ba0ad7 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/scope.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/scope.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/subscription.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/subscription.go index 6309d72bbbcb..2b1b141d152a 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/subscription.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/subscription.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/user_assigned_identity.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/user_assigned_identity.go index 55f28bf8f40b..e770693e3f6a 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/user_assigned_identity.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/user_assigned_identity.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( @@ -11,17 +14,17 @@ var _ resourceids.ResourceId = UserAssignedIdentityId{} // UserAssignedIdentityId is a struct representing the Resource ID for a User Assigned Identity type UserAssignedIdentityId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string + SubscriptionId string + ResourceGroupName string + UserAssignedIdentityName string } // NewUserAssignedIdentityID returns a new UserAssignedIdentityId struct -func NewUserAssignedIdentityID(subscriptionId string, resourceGroupName string, resourceName string) UserAssignedIdentityId { +func NewUserAssignedIdentityID(subscriptionId string, resourceGroupName string, userAssignedIdentityName string) UserAssignedIdentityId { return UserAssignedIdentityId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + UserAssignedIdentityName: userAssignedIdentityName, } } @@ -44,8 +47,8 @@ func ParseUserAssignedIdentityID(input string) (*UserAssignedIdentityId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.UserAssignedIdentityName, ok = parsed.Parsed["userAssignedIdentityName"]; !ok { + return nil, fmt.Errorf("the segment 'userAssignedIdentityName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +74,8 @@ func ParseUserAssignedIdentityIDInsensitively(input string) (*UserAssignedIdenti return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.UserAssignedIdentityName, ok = parsed.Parsed["userAssignedIdentityName"]; !ok { + return nil, fmt.Errorf("the segment 'userAssignedIdentityName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +99,7 @@ func ValidateUserAssignedIdentityID(input interface{}, key string) (warnings []s // ID returns the formatted User Assigned Identity ID func (id UserAssignedIdentityId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ManagedIdentity/userAssignedIdentities/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.UserAssignedIdentityName) } // Segments returns a slice of Resource ID Segments which comprise this User Assigned Identity ID @@ -109,7 +112,7 @@ func (id UserAssignedIdentityId) Segments() []resourceids.Segment { resourceids.StaticSegment("providers", "providers", "providers"), resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.ManagedIdentity", "Microsoft.ManagedIdentity"), resourceids.StaticSegment("userAssignedIdentities", "userAssignedIdentities", "userAssignedIdentities"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("userAssignedIdentityName", "userAssignedIdentityValue"), } } @@ -118,7 +121,7 @@ func (id UserAssignedIdentityId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Name: %q", id.UserAssignedIdentityName), } return fmt.Sprintf("User Assigned Identity (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_hub_bgp_connection.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_hub_bgp_connection.go index 1ecdea809181..7304b7e59961 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_hub_bgp_connection.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_hub_bgp_connection.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_hub_ip_configuration.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_hub_ip_configuration.go index 90682f882e0f..9b98938c60fd 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_hub_ip_configuration.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_hub_ip_configuration.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_ip_configuration.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_ip_configuration.go index 2ab313644c75..2b60f8611644 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_ip_configuration.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_ip_configuration.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_network_interface.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_network_interface.go index 818ec1598522..b097c60d8c2d 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_network_interface.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_network_interface.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_public_ip_address.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_public_ip_address.go index 681265bfdb3e..08bd4332c55b 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_public_ip_address.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_public_ip_address.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_router_peering.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_router_peering.go index ff560fbef6a8..015bf682773e 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_router_peering.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_router_peering.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_wan_p2s_vpn_gateway.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_wan_p2s_vpn_gateway.go index eda9a876307f..b410e13bc35b 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_wan_p2s_vpn_gateway.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_wan_p2s_vpn_gateway.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vmware_site_job.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vmware_site_job.go new file mode 100644 index 000000000000..6b02a27b7676 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vmware_site_job.go @@ -0,0 +1,137 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VMwareSiteJobId{} + +// VMwareSiteJobId is a struct representing the Resource ID for a VMware Site Job +type VMwareSiteJobId struct { + SubscriptionId string + ResourceGroupName string + VMwareSiteName string + JobName string +} + +// NewVMwareSiteJobID returns a new VMwareSiteJobId struct +func NewVMwareSiteJobID(subscriptionId string, resourceGroupName string, vmwareSiteName string, jobName string) VMwareSiteJobId { + return VMwareSiteJobId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VMwareSiteName: vmwareSiteName, + JobName: jobName, + } +} + +// ParseVMwareSiteJobID parses 'input' into a VMwareSiteJobId +func ParseVMwareSiteJobID(input string) (*VMwareSiteJobId, error) { + parser := resourceids.NewParserFromResourceIdType(VMwareSiteJobId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VMwareSiteJobId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VMwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { + return nil, fmt.Errorf("the segment 'vmwareSiteName' was not found in the resource id %q", input) + } + + if id.JobName, ok = parsed.Parsed["jobName"]; !ok { + return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVMwareSiteJobIDInsensitively parses 'input' case-insensitively into a VMwareSiteJobId +// note: this method should only be used for API response data and not user input +func ParseVMwareSiteJobIDInsensitively(input string) (*VMwareSiteJobId, error) { + parser := resourceids.NewParserFromResourceIdType(VMwareSiteJobId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VMwareSiteJobId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VMwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { + return nil, fmt.Errorf("the segment 'vmwareSiteName' was not found in the resource id %q", input) + } + + if id.JobName, ok = parsed.Parsed["jobName"]; !ok { + return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVMwareSiteJobID checks that 'input' can be parsed as a VMware Site Job ID +func ValidateVMwareSiteJobID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVMwareSiteJobID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted VMware Site Job ID +func (id VMwareSiteJobId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OffAzure/vmwareSites/%s/jobs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VMwareSiteName, id.JobName) +} + +// Segments returns a slice of Resource ID Segments which comprise this VMware Site Job ID +func (id VMwareSiteJobId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftOffAzure", "Microsoft.OffAzure", "Microsoft.OffAzure"), + resourceids.StaticSegment("staticVMwareSites", "vmwareSites", "vmwareSites"), + resourceids.UserSpecifiedSegment("vmwareSiteName", "vmwareSiteNameValue"), + resourceids.StaticSegment("staticJobs", "jobs", "jobs"), + resourceids.UserSpecifiedSegment("jobName", "jobNameValue"), + } +} + +// String returns a human-readable description of this VMware Site Job ID +func (id VMwareSiteJobId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("VMware Site Name: %q", id.VMwareSiteName), + fmt.Sprintf("Job Name: %q", id.JobName), + } + return fmt.Sprintf("VMware Site Job (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vmware_site_machine.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vmware_site_machine.go new file mode 100644 index 000000000000..57897933157f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vmware_site_machine.go @@ -0,0 +1,137 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VMwareSiteMachineId{} + +// VMwareSiteMachineId is a struct representing the Resource ID for a VMware Site Machine +type VMwareSiteMachineId struct { + SubscriptionId string + ResourceGroupName string + VMwareSiteName string + MachineName string +} + +// NewVMwareSiteMachineID returns a new VMwareSiteMachineId struct +func NewVMwareSiteMachineID(subscriptionId string, resourceGroupName string, vmwareSiteName string, machineName string) VMwareSiteMachineId { + return VMwareSiteMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VMwareSiteName: vmwareSiteName, + MachineName: machineName, + } +} + +// ParseVMwareSiteMachineID parses 'input' into a VMwareSiteMachineId +func ParseVMwareSiteMachineID(input string) (*VMwareSiteMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(VMwareSiteMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VMwareSiteMachineId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VMwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { + return nil, fmt.Errorf("the segment 'vmwareSiteName' was not found in the resource id %q", input) + } + + if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { + return nil, fmt.Errorf("the segment 'machineName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVMwareSiteMachineIDInsensitively parses 'input' case-insensitively into a VMwareSiteMachineId +// note: this method should only be used for API response data and not user input +func ParseVMwareSiteMachineIDInsensitively(input string) (*VMwareSiteMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(VMwareSiteMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VMwareSiteMachineId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VMwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { + return nil, fmt.Errorf("the segment 'vmwareSiteName' was not found in the resource id %q", input) + } + + if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { + return nil, fmt.Errorf("the segment 'machineName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVMwareSiteMachineID checks that 'input' can be parsed as a VMware Site Machine ID +func ValidateVMwareSiteMachineID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVMwareSiteMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted VMware Site Machine ID +func (id VMwareSiteMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OffAzure/vmwareSites/%s/machines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VMwareSiteName, id.MachineName) +} + +// Segments returns a slice of Resource ID Segments which comprise this VMware Site Machine ID +func (id VMwareSiteMachineId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftOffAzure", "Microsoft.OffAzure", "Microsoft.OffAzure"), + resourceids.StaticSegment("staticVMwareSites", "vmwareSites", "vmwareSites"), + resourceids.UserSpecifiedSegment("vmwareSiteName", "vmwareSiteNameValue"), + resourceids.StaticSegment("staticMachines", "machines", "machines"), + resourceids.UserSpecifiedSegment("machineName", "machineValue"), + } +} + +// String returns a human-readable description of this VMware Site Machine ID +func (id VMwareSiteMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("VMware Site Name: %q", id.VMwareSiteName), + fmt.Sprintf("Machine Name: %q", id.MachineName), + } + return fmt.Sprintf("VMware Site Machine (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vmware_site_runasaccount.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vmware_site_runasaccount.go new file mode 100644 index 000000000000..16be086e7686 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vmware_site_runasaccount.go @@ -0,0 +1,137 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VMwareSiteRunAsAccountId{} + +// VMwareSiteRunAsAccountId is a struct representing the Resource ID for a VMware Site Run As Account +type VMwareSiteRunAsAccountId struct { + SubscriptionId string + ResourceGroupName string + VMwareSiteName string + RunAsAccountName string +} + +// NewVMwareSiteRunAsAccountID returns a new VMwareSiteRunAsAccountId struct +func NewVMwareSiteRunAsAccountID(subscriptionId string, resourceGroupName string, vmwareSiteName string, runAsAccountName string) VMwareSiteRunAsAccountId { + return VMwareSiteRunAsAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VMwareSiteName: vmwareSiteName, + RunAsAccountName: runAsAccountName, + } +} + +// ParseVMwareSiteRunAsAccountID parses 'input' into a VMwareSiteRunAsAccountId +func ParseVMwareSiteRunAsAccountID(input string) (*VMwareSiteRunAsAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(VMwareSiteRunAsAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VMwareSiteRunAsAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VMwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { + return nil, fmt.Errorf("the segment 'vmwareSiteName' was not found in the resource id %q", input) + } + + if id.RunAsAccountName, ok = parsed.Parsed["runAsAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'runAsAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVMwareSiteRunAsAccountIDInsensitively parses 'input' case-insensitively into a VMwareSiteRunAsAccountId +// note: this method should only be used for API response data and not user input +func ParseVMwareSiteRunAsAccountIDInsensitively(input string) (*VMwareSiteRunAsAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(VMwareSiteRunAsAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VMwareSiteRunAsAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VMwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { + return nil, fmt.Errorf("the segment 'vmwareSiteName' was not found in the resource id %q", input) + } + + if id.RunAsAccountName, ok = parsed.Parsed["runAsAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'runAsAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVMwareSiteRunAsAccountID checks that 'input' can be parsed as a VMware Site Run As Account ID +func ValidateVMwareSiteRunAsAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVMwareSiteRunAsAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted VMware Site Run As Account ID +func (id VMwareSiteRunAsAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OffAzure/vmwareSites/%s/runAsAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VMwareSiteName, id.RunAsAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this VMware Site Run As Account ID +func (id VMwareSiteRunAsAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftOffAzure", "Microsoft.OffAzure", "Microsoft.OffAzure"), + resourceids.StaticSegment("staticVMwareSites", "vmwareSites", "vmwareSites"), + resourceids.UserSpecifiedSegment("vmwareSiteName", "vmwareSiteValue"), + resourceids.StaticSegment("staticRunAsAccounts", "runAsAccounts", "runAsAccounts"), + resourceids.UserSpecifiedSegment("runAsAccountName", "runAsAccountNameValue"), + } +} + +// String returns a human-readable description of this VMware Site RunAsAccount ID +func (id VMwareSiteRunAsAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("VMware Site Name: %q", id.VMwareSiteName), + fmt.Sprintf("Run As Account Name: %q", id.RunAsAccountName), + } + return fmt.Sprintf("VMware Site Run As Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vpn_connection.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vpn_connection.go index 41f7126fcdec..d2a6d09ea633 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vpn_connection.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vpn_connection.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/edge_zone.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/edge_zone.go index fecff8549dc9..cd9b8715f2a0 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/edge_zone.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/edge_zone.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonschema import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_system.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_system.go index 700a025b55ca..e9c2d2336b7a 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_system.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_system.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonschema import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_system_or_user.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_system_or_user.go index cd0c87fca4f8..98c10ac5fed8 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_system_or_user.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_system_or_user.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonschema import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_system_user.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_system_user.go index 775de9916e2a..1904fe50cdbb 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_system_user.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_system_user.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonschema import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_user.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_user.go index 9d4caf817750..d9b528d588a3 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_user.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/identity_user.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonschema import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/location.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/location.go index 2369c8919767..77829d358071 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/location.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/location.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonschema import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/resource_group_name.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/resource_group_name.go index 624cb4b8f77c..a31349848630 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/resource_group_name.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/resource_group_name.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonschema import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/resource_id_reference.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/resource_id_reference.go index 31727e71be2d..208465b17126 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/resource_id_reference.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/resource_id_reference.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonschema import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/tags.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/tags.go index fa2ede504e00..7fc36da3526a 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/tags.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/tags.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonschema import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/zone.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/zone.go index cdd38a8d83ce..f2678bb90fc1 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/zone.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/zone.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonschema import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/zones.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/zones.go index b99f5a153a74..aba7274924e9 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/zones.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema/zones.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonschema import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones/model.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones/model.go index f1326f089265..3ce7fdea33ae 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones/model.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones/model.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package edgezones import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones/normalize.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones/normalize.go index 531f992a890b..e529e0c3b1a1 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones/normalize.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones/normalize.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package edgezones import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones/schema.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones/schema.go index 3883074d0e14..526b70e4f375 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones/schema.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones/schema.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package edgezones import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/constants.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/constants.go index 449d44703a1d..65891e3ea462 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/constants.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/constants.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package identity import "strings" diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_list.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_list.go index c20bba824adb..f4bc9aeb2f7e 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_list.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_list.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package identity import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_map.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_map.go index b0db27d13a5f..899a63e70ae7 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_map.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_map.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package identity import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/model.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/model.go index 4ce333357c4f..41e41ca0f761 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/model.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/model.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package identity import "encoding/json" diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_list.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_list.go index 090e056bbb16..2e3be7b87f75 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_list.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_list.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package identity import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_map.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_map.go index 27704de5172e..821362a66b0d 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_map.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_map.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package identity import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_assigned.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_assigned.go index 5bcd7742d823..0d46c174638e 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_assigned.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_assigned.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package identity import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_list.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_list.go index c1b631d63213..08548b1dcdd4 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_list.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_list.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package identity import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_map.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_map.go index 8db3adc88c68..2d43bf059fa9 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_map.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_map.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package identity import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/tfschema_model.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/tfschema_model.go index f787fec169f2..8f304bc0d95a 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/tfschema_model.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/tfschema_model.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package identity type ModelUserAssigned struct { diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_list.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_list.go index b3aeb0354243..47222e6f1af5 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_list.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_list.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package identity import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_map.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_map.go index 34cbe87fc31f..1bd392efa7e5 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_map.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_map.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package identity import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/normalize.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/normalize.go index dd420edfb2fb..f53613d75b0e 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/normalize.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/normalize.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package location import "strings" diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/schema.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/schema.go index 499c3f33640a..88ed13c13b2d 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/schema.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/schema.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package location import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/supported.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/supported.go index 3d92c0bded7e..2ead914879f0 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/supported.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/supported.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package location import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/supported_azure.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/supported_azure.go index a102f3298c24..efde394f98e8 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/supported_azure.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/supported_azure.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package location import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/validation.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/validation.go index 3abc93d7c0a9..b8fe40ebd7fd 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/validation.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/location/validation.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package location import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups/validate.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups/validate.go index 4eef55161f04..0665f4dc589a 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups/validate.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups/validate.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resourcegroups import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/ids.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/ids.go index a72756f85fd0..f17907e24f14 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/ids.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/ids.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resourceids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/interface.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/interface.go index 3189f1181181..3bf3ae1e3e08 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/interface.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/interface.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resourceids type ResourceId interface { diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/old.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/old.go index f3dc7418f42e..b167029f3cd5 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/old.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/old.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resourceids // Id defines a type for a ResourceId of some kind diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/parse.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/parse.go index 609e825bdedf..a27dfa747c03 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/parse.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids/parse.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resourceids import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata/model.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata/model.go index fd5d7f03407f..930a41ee454f 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata/model.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata/model.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package systemdata import "encoding/json" diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/tags/expand.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/tags/expand.go index c745f55e4129..4d65cc70d03b 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/tags/expand.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/tags/expand.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package tags // Expand transforms the input Tags to a `*map[string]string` diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/tags/flatten.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/tags/flatten.go index 0acb5311697d..5e9558541909 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/tags/flatten.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/tags/flatten.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package tags import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/tags/validate.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/tags/validate.go index 768779cd445f..099a0cd72894 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/tags/validate.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/tags/validate.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package tags import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/zones/expand.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/zones/expand.go index a3df9670edda..b4cc5151cbca 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/zones/expand.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/zones/expand.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package zones func Expand(input []string) Schema { diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/zones/flatten.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/zones/flatten.go index b141e50be2e0..892f88507cc2 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/zones/flatten.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/zones/flatten.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package zones func Flatten(input *Schema) []string { diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/zones/schema.go b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/zones/schema.go index 27fe05ae67b0..11dbd35569b0 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/zones/schema.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/zones/schema.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package zones type Schema = []string diff --git a/vendor/github.com/hashicorp/go-azure-helpers/resourceproviders/registration.go b/vendor/github.com/hashicorp/go-azure-helpers/resourceproviders/registration.go index c9c6230f2803..85b825e1de3a 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/resourceproviders/registration.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/resourceproviders/registration.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resourceproviders import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/sender/sender.go b/vendor/github.com/hashicorp/go-azure-helpers/sender/sender.go index d1017ad3e9c7..719a3a42899d 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/sender/sender.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/sender/sender.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package sender import ( diff --git a/vendor/github.com/hashicorp/go-azure-helpers/storage/sas_token.go b/vendor/github.com/hashicorp/go-azure-helpers/storage/sas_token.go index 80e228a77ec5..438c28501e8d 100644 --- a/vendor/github.com/hashicorp/go-azure-helpers/storage/sas_token.go +++ b/vendor/github.com/hashicorp/go-azure-helpers/storage/sas_token.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package storage import ( diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/README.md index c2205c1141cf..8173b464d904 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := alertprocessingrules.NewActionRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "alertProcessingRuleValue") +id := alertprocessingrules.NewActionRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "actionRuleValue") payload := alertprocessingrules.AlertProcessingRule{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := alertprocessingrules.NewActionRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "alertProcessingRuleValue") +id := alertprocessingrules.NewActionRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "actionRuleValue") read, err := client.AlertProcessingRulesDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := alertprocessingrules.NewActionRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "alertProcessingRuleValue") +id := alertprocessingrules.NewActionRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "actionRuleValue") read, err := client.AlertProcessingRulesGetByName(ctx, id) if err != nil { @@ -111,7 +111,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := alertprocessingrules.NewActionRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "alertProcessingRuleValue") +id := alertprocessingrules.NewActionRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "actionRuleValue") payload := alertprocessingrules.PatchObject{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/id_actionrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/id_actionrule.go index d8e50977f9d6..f67c4b691644 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/id_actionrule.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/id_actionrule.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = ActionRuleId{} // ActionRuleId is a struct representing the Resource ID for a Action Rule type ActionRuleId struct { - SubscriptionId string - ResourceGroupName string - AlertProcessingRuleName string + SubscriptionId string + ResourceGroupName string + ActionRuleName string } // NewActionRuleID returns a new ActionRuleId struct -func NewActionRuleID(subscriptionId string, resourceGroupName string, alertProcessingRuleName string) ActionRuleId { +func NewActionRuleID(subscriptionId string, resourceGroupName string, actionRuleName string) ActionRuleId { return ActionRuleId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AlertProcessingRuleName: alertProcessingRuleName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ActionRuleName: actionRuleName, } } @@ -44,8 +44,8 @@ func ParseActionRuleID(input string) (*ActionRuleId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AlertProcessingRuleName, ok = parsed.Parsed["alertProcessingRuleName"]; !ok { - return nil, fmt.Errorf("the segment 'alertProcessingRuleName' was not found in the resource id %q", input) + if id.ActionRuleName, ok = parsed.Parsed["actionRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'actionRuleName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseActionRuleIDInsensitively(input string) (*ActionRuleId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AlertProcessingRuleName, ok = parsed.Parsed["alertProcessingRuleName"]; !ok { - return nil, fmt.Errorf("the segment 'alertProcessingRuleName' was not found in the resource id %q", input) + if id.ActionRuleName, ok = parsed.Parsed["actionRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'actionRuleName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateActionRuleID(input interface{}, key string) (warnings []string, err // ID returns the formatted Action Rule ID func (id ActionRuleId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AlertsManagement/actionRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AlertProcessingRuleName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ActionRuleName) } // Segments returns a slice of Resource ID Segments which comprise this Action Rule ID @@ -109,7 +109,7 @@ func (id ActionRuleId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftAlertsManagement", "Microsoft.AlertsManagement", "Microsoft.AlertsManagement"), resourceids.StaticSegment("staticActionRules", "actionRules", "actionRules"), - resourceids.UserSpecifiedSegment("alertProcessingRuleName", "alertProcessingRuleValue"), + resourceids.UserSpecifiedSegment("actionRuleName", "actionRuleValue"), } } @@ -118,7 +118,7 @@ func (id ActionRuleId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Alert Processing Rule Name: %q", id.AlertProcessingRuleName), + fmt.Sprintf("Action Rule Name: %q", id.ActionRuleName), } return fmt.Sprintf("Action Rule (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/id_location.go index 28c592f876ce..00a0c1bbdadd 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/id_location.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/id_location.go @@ -12,14 +12,14 @@ var _ resourceids.ResourceId = LocationId{} // LocationId is a struct representing the Resource ID for a Location type LocationId struct { SubscriptionId string - Location string + LocationName string } // NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { +func NewLocationID(subscriptionId string, locationName string) LocationId { return LocationId{ SubscriptionId: subscriptionId, - Location: location, + LocationName: locationName, } } @@ -38,8 +38,8 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.AnalysisServices/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } // Segments returns a slice of Resource ID Segments which comprise this Location ID @@ -97,7 +97,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftAnalysisServices", "Microsoft.AnalysisServices", "Microsoft.AnalysisServices"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), } } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { func (id LocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), } return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/README.md index 90bbe40e7645..ce7db12c8f7e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configStoreValue") +id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configurationStoreValue") payload := configurationstores.ConfigurationStore{ // ... @@ -41,7 +41,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configStoreValue") +id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configurationStoreValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configStoreValue") +id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configurationStoreValue") read, err := client.Get(ctx, id) if err != nil { @@ -103,7 +103,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configStoreValue") +id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configurationStoreValue") // alternatively `client.ListKeys(ctx, id)` can be used to do batched pagination items, err := client.ListKeysComplete(ctx, id) @@ -120,7 +120,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configStoreValue") +id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configurationStoreValue") payload := configurationstores.RegenerateKeyParameters{ // ... @@ -141,7 +141,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configStoreValue") +id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configurationStoreValue") payload := configurationstores.ConfigurationStoreUpdateParameters{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/id_configurationstore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/id_configurationstore.go index 5e9fc5e6977b..0ada5af4e867 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/id_configurationstore.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/id_configurationstore.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = ConfigurationStoreId{} // ConfigurationStoreId is a struct representing the Resource ID for a Configuration Store type ConfigurationStoreId struct { - SubscriptionId string - ResourceGroupName string - ConfigStoreName string + SubscriptionId string + ResourceGroupName string + ConfigurationStoreName string } // NewConfigurationStoreID returns a new ConfigurationStoreId struct -func NewConfigurationStoreID(subscriptionId string, resourceGroupName string, configStoreName string) ConfigurationStoreId { +func NewConfigurationStoreID(subscriptionId string, resourceGroupName string, configurationStoreName string) ConfigurationStoreId { return ConfigurationStoreId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ConfigStoreName: configStoreName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ConfigurationStoreName: configurationStoreName, } } @@ -44,8 +44,8 @@ func ParseConfigurationStoreID(input string) (*ConfigurationStoreId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ConfigStoreName, ok = parsed.Parsed["configStoreName"]; !ok { - return nil, fmt.Errorf("the segment 'configStoreName' was not found in the resource id %q", input) + if id.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { + return nil, fmt.Errorf("the segment 'configurationStoreName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseConfigurationStoreIDInsensitively(input string) (*ConfigurationStoreId return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ConfigStoreName, ok = parsed.Parsed["configStoreName"]; !ok { - return nil, fmt.Errorf("the segment 'configStoreName' was not found in the resource id %q", input) + if id.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { + return nil, fmt.Errorf("the segment 'configurationStoreName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateConfigurationStoreID(input interface{}, key string) (warnings []str // ID returns the formatted Configuration Store ID func (id ConfigurationStoreId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppConfiguration/configurationStores/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ConfigStoreName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ConfigurationStoreName) } // Segments returns a slice of Resource ID Segments which comprise this Configuration Store ID @@ -109,7 +109,7 @@ func (id ConfigurationStoreId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftAppConfiguration", "Microsoft.AppConfiguration", "Microsoft.AppConfiguration"), resourceids.StaticSegment("staticConfigurationStores", "configurationStores", "configurationStores"), - resourceids.UserSpecifiedSegment("configStoreName", "configStoreValue"), + resourceids.UserSpecifiedSegment("configurationStoreName", "configurationStoreValue"), } } @@ -118,7 +118,7 @@ func (id ConfigurationStoreId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Config Store Name: %q", id.ConfigStoreName), + fmt.Sprintf("Configuration Store Name: %q", id.ConfigurationStoreName), } return fmt.Sprintf("Configuration Store (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/deletedconfigurationstores/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/deletedconfigurationstores/README.md index a1510e0fef1a..e35f26f41807 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/deletedconfigurationstores/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/deletedconfigurationstores/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := deletedconfigurationstores.NewDeletedConfigurationStoreID("12345678-1234-9876-4563-123456789012", "locationValue", "configStoreValue") +id := deletedconfigurationstores.NewDeletedConfigurationStoreID("12345678-1234-9876-4563-123456789012", "locationValue", "deletedConfigurationStoreValue") read, err := client.ConfigurationStoresGetDeleted(ctx, id) if err != nil { @@ -57,7 +57,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := deletedconfigurationstores.NewDeletedConfigurationStoreID("12345678-1234-9876-4563-123456789012", "locationValue", "configStoreValue") +id := deletedconfigurationstores.NewDeletedConfigurationStoreID("12345678-1234-9876-4563-123456789012", "locationValue", "deletedConfigurationStoreValue") if err := client.ConfigurationStoresPurgeDeletedThenPoll(ctx, id); err != nil { // handle the error diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/deletedconfigurationstores/id_deletedconfigurationstore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/deletedconfigurationstores/id_deletedconfigurationstore.go index 8f7826976782..40a508d8d29c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/deletedconfigurationstores/id_deletedconfigurationstore.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/deletedconfigurationstores/id_deletedconfigurationstore.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = DeletedConfigurationStoreId{} // DeletedConfigurationStoreId is a struct representing the Resource ID for a Deleted Configuration Store type DeletedConfigurationStoreId struct { - SubscriptionId string - Location string - ConfigStoreName string + SubscriptionId string + LocationName string + DeletedConfigurationStoreName string } // NewDeletedConfigurationStoreID returns a new DeletedConfigurationStoreId struct -func NewDeletedConfigurationStoreID(subscriptionId string, location string, configStoreName string) DeletedConfigurationStoreId { +func NewDeletedConfigurationStoreID(subscriptionId string, locationName string, deletedConfigurationStoreName string) DeletedConfigurationStoreId { return DeletedConfigurationStoreId{ - SubscriptionId: subscriptionId, - Location: location, - ConfigStoreName: configStoreName, + SubscriptionId: subscriptionId, + LocationName: locationName, + DeletedConfigurationStoreName: deletedConfigurationStoreName, } } @@ -40,12 +40,12 @@ func ParseDeletedConfigurationStoreID(input string) (*DeletedConfigurationStoreI return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } - if id.ConfigStoreName, ok = parsed.Parsed["configStoreName"]; !ok { - return nil, fmt.Errorf("the segment 'configStoreName' was not found in the resource id %q", input) + if id.DeletedConfigurationStoreName, ok = parsed.Parsed["deletedConfigurationStoreName"]; !ok { + return nil, fmt.Errorf("the segment 'deletedConfigurationStoreName' was not found in the resource id %q", input) } return &id, nil @@ -67,12 +67,12 @@ func ParseDeletedConfigurationStoreIDInsensitively(input string) (*DeletedConfig return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } - if id.ConfigStoreName, ok = parsed.Parsed["configStoreName"]; !ok { - return nil, fmt.Errorf("the segment 'configStoreName' was not found in the resource id %q", input) + if id.DeletedConfigurationStoreName, ok = parsed.Parsed["deletedConfigurationStoreName"]; !ok { + return nil, fmt.Errorf("the segment 'deletedConfigurationStoreName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateDeletedConfigurationStoreID(input interface{}, key string) (warning // ID returns the formatted Deleted Configuration Store ID func (id DeletedConfigurationStoreId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.AppConfiguration/locations/%s/deletedConfigurationStores/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location, id.ConfigStoreName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.DeletedConfigurationStoreName) } // Segments returns a slice of Resource ID Segments which comprise this Deleted Configuration Store ID @@ -107,9 +107,9 @@ func (id DeletedConfigurationStoreId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftAppConfiguration", "Microsoft.AppConfiguration", "Microsoft.AppConfiguration"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), resourceids.StaticSegment("staticDeletedConfigurationStores", "deletedConfigurationStores", "deletedConfigurationStores"), - resourceids.UserSpecifiedSegment("configStoreName", "configStoreValue"), + resourceids.UserSpecifiedSegment("deletedConfigurationStoreName", "deletedConfigurationStoreValue"), } } @@ -117,8 +117,8 @@ func (id DeletedConfigurationStoreId) Segments() []resourceids.Segment { func (id DeletedConfigurationStoreId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), - fmt.Sprintf("Config Store Name: %q", id.ConfigStoreName), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Deleted Configuration Store Name: %q", id.DeletedConfigurationStoreName), } return fmt.Sprintf("Deleted Configuration Store (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/README.md index d05230442193..2d2720d57fa6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := workbooktemplatesapis.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := workbooktemplatesapis.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workbookTemplateValue") payload := workbooktemplatesapis.WorkbookTemplate{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := workbooktemplatesapis.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := workbooktemplatesapis.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workbookTemplateValue") read, err := client.WorkbookTemplatesDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := workbooktemplatesapis.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := workbooktemplatesapis.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workbookTemplateValue") read, err := client.WorkbookTemplatesGet(ctx, id) if err != nil { @@ -93,7 +93,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := workbooktemplatesapis.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := workbooktemplatesapis.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workbookTemplateValue") payload := workbooktemplatesapis.WorkbookTemplateUpdateParameters{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/id_workbooktemplate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/id_workbooktemplate.go index 42058833c610..025e2b449833 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/id_workbooktemplate.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/id_workbooktemplate.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = WorkbookTemplateId{} // WorkbookTemplateId is a struct representing the Resource ID for a Workbook Template type WorkbookTemplateId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string + SubscriptionId string + ResourceGroupName string + WorkbookTemplateName string } // NewWorkbookTemplateID returns a new WorkbookTemplateId struct -func NewWorkbookTemplateID(subscriptionId string, resourceGroupName string, resourceName string) WorkbookTemplateId { +func NewWorkbookTemplateID(subscriptionId string, resourceGroupName string, workbookTemplateName string) WorkbookTemplateId { return WorkbookTemplateId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkbookTemplateName: workbookTemplateName, } } @@ -44,8 +44,8 @@ func ParseWorkbookTemplateID(input string) (*WorkbookTemplateId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.WorkbookTemplateName, ok = parsed.Parsed["workbookTemplateName"]; !ok { + return nil, fmt.Errorf("the segment 'workbookTemplateName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseWorkbookTemplateIDInsensitively(input string) (*WorkbookTemplateId, er return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.WorkbookTemplateName, ok = parsed.Parsed["workbookTemplateName"]; !ok { + return nil, fmt.Errorf("the segment 'workbookTemplateName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateWorkbookTemplateID(input interface{}, key string) (warnings []strin // ID returns the formatted Workbook Template ID func (id WorkbookTemplateId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/workbookTemplates/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkbookTemplateName) } // Segments returns a slice of Resource ID Segments which comprise this Workbook Template ID @@ -109,7 +109,7 @@ func (id WorkbookTemplateId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), resourceids.StaticSegment("staticWorkbookTemplates", "workbookTemplates", "workbookTemplates"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("workbookTemplateName", "workbookTemplateValue"), } } @@ -118,7 +118,7 @@ func (id WorkbookTemplateId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Workbook Template Name: %q", id.WorkbookTemplateName), } return fmt.Sprintf("Workbook Template (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/README.md index f3698e6dbfe1..bdccd2cb809c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := workbooksapis.NewWorkbookID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := workbooksapis.NewWorkbookID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workbookValue") payload := workbooksapis.Workbook{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := workbooksapis.NewWorkbookID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := workbooksapis.NewWorkbookID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workbookValue") read, err := client.WorkbooksDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := workbooksapis.NewWorkbookID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := workbooksapis.NewWorkbookID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workbookValue") read, err := client.WorkbooksGet(ctx, id, workbooksapis.DefaultWorkbooksGetOperationOptions()) if err != nil { @@ -111,7 +111,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := workbooksapis.NewRevisionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "revisionIdValue") +id := workbooksapis.NewRevisionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workbookValue", "revisionIdValue") read, err := client.WorkbooksRevisionGet(ctx, id) if err != nil { @@ -127,7 +127,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := workbooksapis.NewWorkbookID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := workbooksapis.NewWorkbookID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workbookValue") // alternatively `client.WorkbooksRevisionsList(ctx, id)` can be used to do batched pagination items, err := client.WorkbooksRevisionsListComplete(ctx, id) @@ -144,7 +144,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := workbooksapis.NewWorkbookID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := workbooksapis.NewWorkbookID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workbookValue") payload := workbooksapis.WorkbookUpdateParameters{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_revision.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_revision.go index 4556cfaec710..dc1183a77c36 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_revision.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_revision.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = RevisionId{} type RevisionId struct { SubscriptionId string ResourceGroupName string - ResourceName string + WorkbookName string RevisionId string } // NewRevisionID returns a new RevisionId struct -func NewRevisionID(subscriptionId string, resourceGroupName string, resourceName string, revisionId string) RevisionId { +func NewRevisionID(subscriptionId string, resourceGroupName string, workbookName string, revisionId string) RevisionId { return RevisionId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + WorkbookName: workbookName, RevisionId: revisionId, } } @@ -46,8 +46,8 @@ func ParseRevisionID(input string) (*RevisionId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.WorkbookName, ok = parsed.Parsed["workbookName"]; !ok { + return nil, fmt.Errorf("the segment 'workbookName' was not found in the resource id %q", input) } if id.RevisionId, ok = parsed.Parsed["revisionId"]; !ok { @@ -77,8 +77,8 @@ func ParseRevisionIDInsensitively(input string) (*RevisionId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.WorkbookName, ok = parsed.Parsed["workbookName"]; !ok { + return nil, fmt.Errorf("the segment 'workbookName' was not found in the resource id %q", input) } if id.RevisionId, ok = parsed.Parsed["revisionId"]; !ok { @@ -106,7 +106,7 @@ func ValidateRevisionID(input interface{}, key string) (warnings []string, error // ID returns the formatted Revision ID func (id RevisionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/workbooks/%s/revisions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.RevisionId) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkbookName, id.RevisionId) } // Segments returns a slice of Resource ID Segments which comprise this Revision ID @@ -119,7 +119,7 @@ func (id RevisionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), resourceids.StaticSegment("staticWorkbooks", "workbooks", "workbooks"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("workbookName", "workbookValue"), resourceids.StaticSegment("staticRevisions", "revisions", "revisions"), resourceids.UserSpecifiedSegment("revisionId", "revisionIdValue"), } @@ -130,7 +130,7 @@ func (id RevisionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Workbook Name: %q", id.WorkbookName), fmt.Sprintf("Revision: %q", id.RevisionId), } return fmt.Sprintf("Revision (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_workbook.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_workbook.go index 78b322bb80ed..cd6974712985 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_workbook.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_workbook.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = WorkbookId{} type WorkbookId struct { SubscriptionId string ResourceGroupName string - ResourceName string + WorkbookName string } // NewWorkbookID returns a new WorkbookId struct -func NewWorkbookID(subscriptionId string, resourceGroupName string, resourceName string) WorkbookId { +func NewWorkbookID(subscriptionId string, resourceGroupName string, workbookName string) WorkbookId { return WorkbookId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + WorkbookName: workbookName, } } @@ -44,8 +44,8 @@ func ParseWorkbookID(input string) (*WorkbookId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.WorkbookName, ok = parsed.Parsed["workbookName"]; !ok { + return nil, fmt.Errorf("the segment 'workbookName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseWorkbookIDInsensitively(input string) (*WorkbookId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.WorkbookName, ok = parsed.Parsed["workbookName"]; !ok { + return nil, fmt.Errorf("the segment 'workbookName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateWorkbookID(input interface{}, key string) (warnings []string, error // ID returns the formatted Workbook ID func (id WorkbookId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/workbooks/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkbookName) } // Segments returns a slice of Resource ID Segments which comprise this Workbook ID @@ -109,7 +109,7 @@ func (id WorkbookId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), resourceids.StaticSegment("staticWorkbooks", "workbooks", "workbooks"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("workbookName", "workbookValue"), } } @@ -118,7 +118,7 @@ func (id WorkbookId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Workbook Name: %q", id.WorkbookName), } return fmt.Sprintf("Workbook (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-06-15/webtestsapis/model_webtestpropertiesvalidationrules.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-06-15/webtestsapis/model_webtestpropertiesvalidationrules.go index 04f09c8356a8..333805a2ff41 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-06-15/webtestsapis/model_webtestpropertiesvalidationrules.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-06-15/webtestsapis/model_webtestpropertiesvalidationrules.go @@ -6,7 +6,7 @@ package webtestsapis type WebTestPropertiesValidationRules struct { ContentValidation *WebTestPropertiesValidationRulesContentValidation `json:"ContentValidation,omitempty"` ExpectedHTTPStatusCode *int64 `json:"ExpectedHttpStatusCode,omitempty"` - IgnoreHTTPSStatusCode *bool `json:"IgnoreHttpsStatusCode,omitempty"` + IgnoreHTTPStatusCode *bool `json:"IgnoreHttpStatusCode,omitempty"` SSLCertRemainingLifetimeCheck *int64 `json:"SSLCertRemainingLifetimeCheck,omitempty"` SSLCheck *bool `json:"SSLCheck,omitempty"` } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/README.md index 359a8777cefb..53395e77eb40 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := attestationproviders.NewAttestationProvidersID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue") +id := attestationproviders.NewAttestationProvidersID("12345678-1234-9876-4563-123456789012", "example-resource-group", "attestationProviderValue") payload := attestationproviders.AttestationServiceCreationParams{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := attestationproviders.NewAttestationProvidersID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue") +id := attestationproviders.NewAttestationProvidersID("12345678-1234-9876-4563-123456789012", "example-resource-group", "attestationProviderValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := attestationproviders.NewAttestationProvidersID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue") +id := attestationproviders.NewAttestationProvidersID("12345678-1234-9876-4563-123456789012", "example-resource-group", "attestationProviderValue") read, err := client.Get(ctx, id) if err != nil { @@ -141,7 +141,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := attestationproviders.NewAttestationProvidersID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue") +id := attestationproviders.NewAttestationProvidersID("12345678-1234-9876-4563-123456789012", "example-resource-group", "attestationProviderValue") payload := attestationproviders.AttestationServicePatchParams{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/id_attestationproviders.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/id_attestationproviders.go index 60a8ff50d08d..29a8ccbeda18 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/id_attestationproviders.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/id_attestationproviders.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = AttestationProvidersId{} // AttestationProvidersId is a struct representing the Resource ID for a Attestation Providers type AttestationProvidersId struct { - SubscriptionId string - ResourceGroupName string - ProviderName string + SubscriptionId string + ResourceGroupName string + AttestationProviderName string } // NewAttestationProvidersID returns a new AttestationProvidersId struct -func NewAttestationProvidersID(subscriptionId string, resourceGroupName string, providerName string) AttestationProvidersId { +func NewAttestationProvidersID(subscriptionId string, resourceGroupName string, attestationProviderName string) AttestationProvidersId { return AttestationProvidersId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ProviderName: providerName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AttestationProviderName: attestationProviderName, } } @@ -44,8 +44,8 @@ func ParseAttestationProvidersID(input string) (*AttestationProvidersId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, fmt.Errorf("the segment 'providerName' was not found in the resource id %q", input) + if id.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { + return nil, fmt.Errorf("the segment 'attestationProviderName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseAttestationProvidersIDInsensitively(input string) (*AttestationProvide return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, fmt.Errorf("the segment 'providerName' was not found in the resource id %q", input) + if id.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { + return nil, fmt.Errorf("the segment 'attestationProviderName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateAttestationProvidersID(input interface{}, key string) (warnings []s // ID returns the formatted Attestation Providers ID func (id AttestationProvidersId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Attestation/attestationProviders/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProviderName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AttestationProviderName) } // Segments returns a slice of Resource ID Segments which comprise this Attestation Providers ID @@ -109,7 +109,7 @@ func (id AttestationProvidersId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftAttestation", "Microsoft.Attestation", "Microsoft.Attestation"), resourceids.StaticSegment("staticAttestationProviders", "attestationProviders", "attestationProviders"), - resourceids.UserSpecifiedSegment("providerName", "providerValue"), + resourceids.UserSpecifiedSegment("attestationProviderName", "attestationProviderValue"), } } @@ -118,7 +118,7 @@ func (id AttestationProvidersId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Provider Name: %q", id.ProviderName), + fmt.Sprintf("Attestation Provider Name: %q", id.AttestationProviderName), } return fmt.Sprintf("Attestation Providers (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/id_location.go index d61bc587cf70..bb3465bfb23e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/id_location.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/id_location.go @@ -12,14 +12,14 @@ var _ resourceids.ResourceId = LocationId{} // LocationId is a struct representing the Resource ID for a Location type LocationId struct { SubscriptionId string - Location string + LocationName string } // NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { +func NewLocationID(subscriptionId string, locationName string) LocationId { return LocationId{ SubscriptionId: subscriptionId, - Location: location, + LocationName: locationName, } } @@ -38,8 +38,8 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.Attestation/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } // Segments returns a slice of Resource ID Segments which comprise this Location ID @@ -97,7 +97,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftAttestation", "Microsoft.Attestation", "Microsoft.Attestation"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), } } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { func (id LocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), } return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/README.md deleted file mode 100644 index 818ca8a343f8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/README.md +++ /dev/null @@ -1,124 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters` Documentation - -The `clusters` SDK allows for interaction with the Azure Resource Manager Service `azurestackhci` (API Version `2022-09-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters" -``` - - -### Client Initialization - -```go -client := clusters.NewClustersClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `ClustersClient.Create` - -```go -ctx := context.TODO() -id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") - -payload := clusters.Cluster{ - // ... -} - - -read, err := client.Create(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `ClustersClient.Delete` - -```go -ctx := context.TODO() -id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `ClustersClient.Get` - -```go -ctx := context.TODO() -id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `ClustersClient.ListByResourceGroup` - -```go -ctx := context.TODO() -id := clusters.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") - -// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination -items, err := client.ListByResourceGroupComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `ClustersClient.ListBySubscription` - -```go -ctx := context.TODO() -id := clusters.NewSubscriptionID("12345678-1234-9876-4563-123456789012") - -// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination -items, err := client.ListBySubscriptionComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `ClustersClient.Update` - -```go -ctx := context.TODO() -id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") - -payload := clusters.ClusterPatch{ - // ... -} - - -read, err := client.Update(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/constants.go deleted file mode 100644 index 2982289470e7..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/constants.go +++ /dev/null @@ -1,251 +0,0 @@ -package clusters - -import "strings" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ClusterNodeType string - -const ( - ClusterNodeTypeFirstParty ClusterNodeType = "FirstParty" - ClusterNodeTypeThirdParty ClusterNodeType = "ThirdParty" -) - -func PossibleValuesForClusterNodeType() []string { - return []string{ - string(ClusterNodeTypeFirstParty), - string(ClusterNodeTypeThirdParty), - } -} - -func parseClusterNodeType(input string) (*ClusterNodeType, error) { - vals := map[string]ClusterNodeType{ - "firstparty": ClusterNodeTypeFirstParty, - "thirdparty": ClusterNodeTypeThirdParty, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ClusterNodeType(input) - return &out, nil -} - -type DiagnosticLevel string - -const ( - DiagnosticLevelBasic DiagnosticLevel = "Basic" - DiagnosticLevelEnhanced DiagnosticLevel = "Enhanced" - DiagnosticLevelOff DiagnosticLevel = "Off" -) - -func PossibleValuesForDiagnosticLevel() []string { - return []string{ - string(DiagnosticLevelBasic), - string(DiagnosticLevelEnhanced), - string(DiagnosticLevelOff), - } -} - -func parseDiagnosticLevel(input string) (*DiagnosticLevel, error) { - vals := map[string]DiagnosticLevel{ - "basic": DiagnosticLevelBasic, - "enhanced": DiagnosticLevelEnhanced, - "off": DiagnosticLevelOff, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DiagnosticLevel(input) - return &out, nil -} - -type ImdsAttestation string - -const ( - ImdsAttestationDisabled ImdsAttestation = "Disabled" - ImdsAttestationEnabled ImdsAttestation = "Enabled" -) - -func PossibleValuesForImdsAttestation() []string { - return []string{ - string(ImdsAttestationDisabled), - string(ImdsAttestationEnabled), - } -} - -func parseImdsAttestation(input string) (*ImdsAttestation, error) { - vals := map[string]ImdsAttestation{ - "disabled": ImdsAttestationDisabled, - "enabled": ImdsAttestationEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ImdsAttestation(input) - return &out, nil -} - -type ProvisioningState string - -const ( - ProvisioningStateAccepted ProvisioningState = "Accepted" - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateProvisioning ProvisioningState = "Provisioning" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -func PossibleValuesForProvisioningState() []string { - return []string{ - string(ProvisioningStateAccepted), - string(ProvisioningStateCanceled), - string(ProvisioningStateFailed), - string(ProvisioningStateProvisioning), - string(ProvisioningStateSucceeded), - } -} - -func parseProvisioningState(input string) (*ProvisioningState, error) { - vals := map[string]ProvisioningState{ - "accepted": ProvisioningStateAccepted, - "canceled": ProvisioningStateCanceled, - "failed": ProvisioningStateFailed, - "provisioning": ProvisioningStateProvisioning, - "succeeded": ProvisioningStateSucceeded, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProvisioningState(input) - return &out, nil -} - -type SoftwareAssuranceIntent string - -const ( - SoftwareAssuranceIntentDisable SoftwareAssuranceIntent = "Disable" - SoftwareAssuranceIntentEnable SoftwareAssuranceIntent = "Enable" -) - -func PossibleValuesForSoftwareAssuranceIntent() []string { - return []string{ - string(SoftwareAssuranceIntentDisable), - string(SoftwareAssuranceIntentEnable), - } -} - -func parseSoftwareAssuranceIntent(input string) (*SoftwareAssuranceIntent, error) { - vals := map[string]SoftwareAssuranceIntent{ - "disable": SoftwareAssuranceIntentDisable, - "enable": SoftwareAssuranceIntentEnable, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SoftwareAssuranceIntent(input) - return &out, nil -} - -type SoftwareAssuranceStatus string - -const ( - SoftwareAssuranceStatusDisabled SoftwareAssuranceStatus = "Disabled" - SoftwareAssuranceStatusEnabled SoftwareAssuranceStatus = "Enabled" -) - -func PossibleValuesForSoftwareAssuranceStatus() []string { - return []string{ - string(SoftwareAssuranceStatusDisabled), - string(SoftwareAssuranceStatusEnabled), - } -} - -func parseSoftwareAssuranceStatus(input string) (*SoftwareAssuranceStatus, error) { - vals := map[string]SoftwareAssuranceStatus{ - "disabled": SoftwareAssuranceStatusDisabled, - "enabled": SoftwareAssuranceStatusEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SoftwareAssuranceStatus(input) - return &out, nil -} - -type Status string - -const ( - StatusConnectedRecently Status = "ConnectedRecently" - StatusDisconnected Status = "Disconnected" - StatusError Status = "Error" - StatusNotConnectedRecently Status = "NotConnectedRecently" - StatusNotYetRegistered Status = "NotYetRegistered" -) - -func PossibleValuesForStatus() []string { - return []string{ - string(StatusConnectedRecently), - string(StatusDisconnected), - string(StatusError), - string(StatusNotConnectedRecently), - string(StatusNotYetRegistered), - } -} - -func parseStatus(input string) (*Status, error) { - vals := map[string]Status{ - "connectedrecently": StatusConnectedRecently, - "disconnected": StatusDisconnected, - "error": StatusError, - "notconnectedrecently": StatusNotConnectedRecently, - "notyetregistered": StatusNotYetRegistered, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Status(input) - return &out, nil -} - -type WindowsServerSubscription string - -const ( - WindowsServerSubscriptionDisabled WindowsServerSubscription = "Disabled" - WindowsServerSubscriptionEnabled WindowsServerSubscription = "Enabled" -) - -func PossibleValuesForWindowsServerSubscription() []string { - return []string{ - string(WindowsServerSubscriptionDisabled), - string(WindowsServerSubscriptionEnabled), - } -} - -func parseWindowsServerSubscription(input string) (*WindowsServerSubscription, error) { - vals := map[string]WindowsServerSubscription{ - "disabled": WindowsServerSubscriptionDisabled, - "enabled": WindowsServerSubscriptionEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := WindowsServerSubscription(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_cluster.go deleted file mode 100644 index e551e3f2e598..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_cluster.go +++ /dev/null @@ -1,18 +0,0 @@ -package clusters - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Cluster struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *ClusterProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusternode.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusternode.go deleted file mode 100644 index bc4609f5f95d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusternode.go +++ /dev/null @@ -1,19 +0,0 @@ -package clusters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ClusterNode struct { - CoreCount *float64 `json:"coreCount,omitempty"` - Id *float64 `json:"id,omitempty"` - Manufacturer *string `json:"manufacturer,omitempty"` - MemoryInGiB *float64 `json:"memoryInGiB,omitempty"` - Model *string `json:"model,omitempty"` - Name *string `json:"name,omitempty"` - NodeType *ClusterNodeType `json:"nodeType,omitempty"` - OsDisplayVersion *string `json:"osDisplayVersion,omitempty"` - OsName *string `json:"osName,omitempty"` - OsVersion *string `json:"osVersion,omitempty"` - SerialNumber *string `json:"serialNumber,omitempty"` - WindowsServerSubscription *WindowsServerSubscription `json:"windowsServerSubscription,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusterpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusterpatch.go deleted file mode 100644 index 3010eb06ebe2..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusterpatch.go +++ /dev/null @@ -1,9 +0,0 @@ -package clusters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ClusterPatch struct { - Properties *ClusterPatchProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusterproperties.go deleted file mode 100644 index 7e0441818344..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusterproperties.go +++ /dev/null @@ -1,66 +0,0 @@ -package clusters - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ClusterProperties struct { - AadApplicationObjectId *string `json:"aadApplicationObjectId,omitempty"` - AadClientId *string `json:"aadClientId,omitempty"` - AadServicePrincipalObjectId *string `json:"aadServicePrincipalObjectId,omitempty"` - AadTenantId *string `json:"aadTenantId,omitempty"` - BillingModel *string `json:"billingModel,omitempty"` - CloudId *string `json:"cloudId,omitempty"` - CloudManagementEndpoint *string `json:"cloudManagementEndpoint,omitempty"` - DesiredProperties *ClusterDesiredProperties `json:"desiredProperties,omitempty"` - LastBillingTimestamp *string `json:"lastBillingTimestamp,omitempty"` - LastSyncTimestamp *string `json:"lastSyncTimestamp,omitempty"` - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` - RegistrationTimestamp *string `json:"registrationTimestamp,omitempty"` - ReportedProperties *ClusterReportedProperties `json:"reportedProperties,omitempty"` - ServiceEndpoint *string `json:"serviceEndpoint,omitempty"` - SoftwareAssuranceProperties *SoftwareAssuranceProperties `json:"softwareAssuranceProperties,omitempty"` - Status *Status `json:"status,omitempty"` - TrialDaysRemaining *float64 `json:"trialDaysRemaining,omitempty"` -} - -func (o *ClusterProperties) GetLastBillingTimestampAsTime() (*time.Time, error) { - if o.LastBillingTimestamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastBillingTimestamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *ClusterProperties) SetLastBillingTimestampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastBillingTimestamp = &formatted -} - -func (o *ClusterProperties) GetLastSyncTimestampAsTime() (*time.Time, error) { - if o.LastSyncTimestamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastSyncTimestamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *ClusterProperties) SetLastSyncTimestampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastSyncTimestamp = &formatted -} - -func (o *ClusterProperties) GetRegistrationTimestampAsTime() (*time.Time, error) { - if o.RegistrationTimestamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.RegistrationTimestamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *ClusterProperties) SetRegistrationTimestampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.RegistrationTimestamp = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusterreportedproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusterreportedproperties.go deleted file mode 100644 index 0d6082239959..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusterreportedproperties.go +++ /dev/null @@ -1,32 +0,0 @@ -package clusters - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ClusterReportedProperties struct { - ClusterId *string `json:"clusterId,omitempty"` - ClusterName *string `json:"clusterName,omitempty"` - ClusterVersion *string `json:"clusterVersion,omitempty"` - DiagnosticLevel *DiagnosticLevel `json:"diagnosticLevel,omitempty"` - ImdsAttestation *ImdsAttestation `json:"imdsAttestation,omitempty"` - LastUpdated *string `json:"lastUpdated,omitempty"` - Nodes *[]ClusterNode `json:"nodes,omitempty"` -} - -func (o *ClusterReportedProperties) GetLastUpdatedAsTime() (*time.Time, error) { - if o.LastUpdated == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastUpdated, "2006-01-02T15:04:05Z07:00") -} - -func (o *ClusterReportedProperties) SetLastUpdatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastUpdated = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/version.go deleted file mode 100644 index 678030a7b455..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package clusters - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/clusters/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/README.md new file mode 100644 index 000000000000..cb0ff45c829c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/README.md @@ -0,0 +1,135 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings` Documentation + +The `arcsettings` SDK allows for interaction with the Azure Resource Manager Service `azurestackhci` (API Version `2022-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings" +``` + + +### Client Initialization + +```go +client := arcsettings.NewArcSettingsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ArcSettingsClient.ArcSettingsCreate` + +```go +ctx := context.TODO() +id := arcsettings.NewArcSettingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "arcSettingValue") + +payload := arcsettings.ArcSetting{ + // ... +} + + +read, err := client.ArcSettingsCreate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ArcSettingsClient.ArcSettingsDelete` + +```go +ctx := context.TODO() +id := arcsettings.NewArcSettingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "arcSettingValue") + +if err := client.ArcSettingsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ArcSettingsClient.ArcSettingsGet` + +```go +ctx := context.TODO() +id := arcsettings.NewArcSettingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "arcSettingValue") + +read, err := client.ArcSettingsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ArcSettingsClient.ArcSettingsListByCluster` + +```go +ctx := context.TODO() +id := arcsettings.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +// alternatively `client.ArcSettingsListByCluster(ctx, id)` can be used to do batched pagination +items, err := client.ArcSettingsListByClusterComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ArcSettingsClient.ArcSettingsUpdate` + +```go +ctx := context.TODO() +id := arcsettings.NewArcSettingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "arcSettingValue") + +payload := arcsettings.ArcSettingsPatch{ + // ... +} + + +read, err := client.ArcSettingsUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ArcSettingsClient.CreateIdentity` + +```go +ctx := context.TODO() +id := arcsettings.NewArcSettingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "arcSettingValue") + +if err := client.CreateIdentityThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ArcSettingsClient.GeneratePassword` + +```go +ctx := context.TODO() +id := arcsettings.NewArcSettingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "arcSettingValue") + +read, err := client.GeneratePassword(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/client.go new file mode 100644 index 000000000000..7fdf8fa74edc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/client.go @@ -0,0 +1,18 @@ +package arcsettings + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArcSettingsClient struct { + Client autorest.Client + baseUri string +} + +func NewArcSettingsClientWithBaseURI(endpoint string) ArcSettingsClient { + return ArcSettingsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/constants.go new file mode 100644 index 000000000000..cb8db8384030 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/constants.go @@ -0,0 +1,234 @@ +package arcsettings + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArcSettingAggregateState string + +const ( + ArcSettingAggregateStateAccepted ArcSettingAggregateState = "Accepted" + ArcSettingAggregateStateCanceled ArcSettingAggregateState = "Canceled" + ArcSettingAggregateStateConnected ArcSettingAggregateState = "Connected" + ArcSettingAggregateStateCreating ArcSettingAggregateState = "Creating" + ArcSettingAggregateStateDeleted ArcSettingAggregateState = "Deleted" + ArcSettingAggregateStateDeleting ArcSettingAggregateState = "Deleting" + ArcSettingAggregateStateDisableInProgress ArcSettingAggregateState = "DisableInProgress" + ArcSettingAggregateStateDisconnected ArcSettingAggregateState = "Disconnected" + ArcSettingAggregateStateError ArcSettingAggregateState = "Error" + ArcSettingAggregateStateFailed ArcSettingAggregateState = "Failed" + ArcSettingAggregateStateInProgress ArcSettingAggregateState = "InProgress" + ArcSettingAggregateStateMoving ArcSettingAggregateState = "Moving" + ArcSettingAggregateStateNotSpecified ArcSettingAggregateState = "NotSpecified" + ArcSettingAggregateStatePartiallyConnected ArcSettingAggregateState = "PartiallyConnected" + ArcSettingAggregateStatePartiallySucceeded ArcSettingAggregateState = "PartiallySucceeded" + ArcSettingAggregateStateProvisioning ArcSettingAggregateState = "Provisioning" + ArcSettingAggregateStateSucceeded ArcSettingAggregateState = "Succeeded" + ArcSettingAggregateStateUpdating ArcSettingAggregateState = "Updating" +) + +func PossibleValuesForArcSettingAggregateState() []string { + return []string{ + string(ArcSettingAggregateStateAccepted), + string(ArcSettingAggregateStateCanceled), + string(ArcSettingAggregateStateConnected), + string(ArcSettingAggregateStateCreating), + string(ArcSettingAggregateStateDeleted), + string(ArcSettingAggregateStateDeleting), + string(ArcSettingAggregateStateDisableInProgress), + string(ArcSettingAggregateStateDisconnected), + string(ArcSettingAggregateStateError), + string(ArcSettingAggregateStateFailed), + string(ArcSettingAggregateStateInProgress), + string(ArcSettingAggregateStateMoving), + string(ArcSettingAggregateStateNotSpecified), + string(ArcSettingAggregateStatePartiallyConnected), + string(ArcSettingAggregateStatePartiallySucceeded), + string(ArcSettingAggregateStateProvisioning), + string(ArcSettingAggregateStateSucceeded), + string(ArcSettingAggregateStateUpdating), + } +} + +func parseArcSettingAggregateState(input string) (*ArcSettingAggregateState, error) { + vals := map[string]ArcSettingAggregateState{ + "accepted": ArcSettingAggregateStateAccepted, + "canceled": ArcSettingAggregateStateCanceled, + "connected": ArcSettingAggregateStateConnected, + "creating": ArcSettingAggregateStateCreating, + "deleted": ArcSettingAggregateStateDeleted, + "deleting": ArcSettingAggregateStateDeleting, + "disableinprogress": ArcSettingAggregateStateDisableInProgress, + "disconnected": ArcSettingAggregateStateDisconnected, + "error": ArcSettingAggregateStateError, + "failed": ArcSettingAggregateStateFailed, + "inprogress": ArcSettingAggregateStateInProgress, + "moving": ArcSettingAggregateStateMoving, + "notspecified": ArcSettingAggregateStateNotSpecified, + "partiallyconnected": ArcSettingAggregateStatePartiallyConnected, + "partiallysucceeded": ArcSettingAggregateStatePartiallySucceeded, + "provisioning": ArcSettingAggregateStateProvisioning, + "succeeded": ArcSettingAggregateStateSucceeded, + "updating": ArcSettingAggregateStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ArcSettingAggregateState(input) + return &out, nil +} + +type NodeArcState string + +const ( + NodeArcStateAccepted NodeArcState = "Accepted" + NodeArcStateCanceled NodeArcState = "Canceled" + NodeArcStateConnected NodeArcState = "Connected" + NodeArcStateCreating NodeArcState = "Creating" + NodeArcStateDeleted NodeArcState = "Deleted" + NodeArcStateDeleting NodeArcState = "Deleting" + NodeArcStateDisableInProgress NodeArcState = "DisableInProgress" + NodeArcStateDisconnected NodeArcState = "Disconnected" + NodeArcStateError NodeArcState = "Error" + NodeArcStateFailed NodeArcState = "Failed" + NodeArcStateInProgress NodeArcState = "InProgress" + NodeArcStateMoving NodeArcState = "Moving" + NodeArcStateNotSpecified NodeArcState = "NotSpecified" + NodeArcStatePartiallyConnected NodeArcState = "PartiallyConnected" + NodeArcStatePartiallySucceeded NodeArcState = "PartiallySucceeded" + NodeArcStateProvisioning NodeArcState = "Provisioning" + NodeArcStateSucceeded NodeArcState = "Succeeded" + NodeArcStateUpdating NodeArcState = "Updating" +) + +func PossibleValuesForNodeArcState() []string { + return []string{ + string(NodeArcStateAccepted), + string(NodeArcStateCanceled), + string(NodeArcStateConnected), + string(NodeArcStateCreating), + string(NodeArcStateDeleted), + string(NodeArcStateDeleting), + string(NodeArcStateDisableInProgress), + string(NodeArcStateDisconnected), + string(NodeArcStateError), + string(NodeArcStateFailed), + string(NodeArcStateInProgress), + string(NodeArcStateMoving), + string(NodeArcStateNotSpecified), + string(NodeArcStatePartiallyConnected), + string(NodeArcStatePartiallySucceeded), + string(NodeArcStateProvisioning), + string(NodeArcStateSucceeded), + string(NodeArcStateUpdating), + } +} + +func parseNodeArcState(input string) (*NodeArcState, error) { + vals := map[string]NodeArcState{ + "accepted": NodeArcStateAccepted, + "canceled": NodeArcStateCanceled, + "connected": NodeArcStateConnected, + "creating": NodeArcStateCreating, + "deleted": NodeArcStateDeleted, + "deleting": NodeArcStateDeleting, + "disableinprogress": NodeArcStateDisableInProgress, + "disconnected": NodeArcStateDisconnected, + "error": NodeArcStateError, + "failed": NodeArcStateFailed, + "inprogress": NodeArcStateInProgress, + "moving": NodeArcStateMoving, + "notspecified": NodeArcStateNotSpecified, + "partiallyconnected": NodeArcStatePartiallyConnected, + "partiallysucceeded": NodeArcStatePartiallySucceeded, + "provisioning": NodeArcStateProvisioning, + "succeeded": NodeArcStateSucceeded, + "updating": NodeArcStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NodeArcState(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateConnected ProvisioningState = "Connected" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateDisableInProgress ProvisioningState = "DisableInProgress" + ProvisioningStateDisconnected ProvisioningState = "Disconnected" + ProvisioningStateError ProvisioningState = "Error" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateInProgress ProvisioningState = "InProgress" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + ProvisioningStatePartiallyConnected ProvisioningState = "PartiallyConnected" + ProvisioningStatePartiallySucceeded ProvisioningState = "PartiallySucceeded" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateConnected), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateDisableInProgress), + string(ProvisioningStateDisconnected), + string(ProvisioningStateError), + string(ProvisioningStateFailed), + string(ProvisioningStateInProgress), + string(ProvisioningStateMoving), + string(ProvisioningStateNotSpecified), + string(ProvisioningStatePartiallyConnected), + string(ProvisioningStatePartiallySucceeded), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "connected": ProvisioningStateConnected, + "creating": ProvisioningStateCreating, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "disableinprogress": ProvisioningStateDisableInProgress, + "disconnected": ProvisioningStateDisconnected, + "error": ProvisioningStateError, + "failed": ProvisioningStateFailed, + "inprogress": ProvisioningStateInProgress, + "moving": ProvisioningStateMoving, + "notspecified": ProvisioningStateNotSpecified, + "partiallyconnected": ProvisioningStatePartiallyConnected, + "partiallysucceeded": ProvisioningStatePartiallySucceeded, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/id_arcsetting.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/id_arcsetting.go new file mode 100644 index 000000000000..2690164375ff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/id_arcsetting.go @@ -0,0 +1,137 @@ +package arcsettings + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ArcSettingId{} + +// ArcSettingId is a struct representing the Resource ID for a Arc Setting +type ArcSettingId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + ArcSettingName string +} + +// NewArcSettingID returns a new ArcSettingId struct +func NewArcSettingID(subscriptionId string, resourceGroupName string, clusterName string, arcSettingName string) ArcSettingId { + return ArcSettingId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + ArcSettingName: arcSettingName, + } +} + +// ParseArcSettingID parses 'input' into a ArcSettingId +func ParseArcSettingID(input string) (*ArcSettingId, error) { + parser := resourceids.NewParserFromResourceIdType(ArcSettingId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ArcSettingId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { + return nil, fmt.Errorf("the segment 'arcSettingName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseArcSettingIDInsensitively parses 'input' case-insensitively into a ArcSettingId +// note: this method should only be used for API response data and not user input +func ParseArcSettingIDInsensitively(input string) (*ArcSettingId, error) { + parser := resourceids.NewParserFromResourceIdType(ArcSettingId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ArcSettingId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { + return nil, fmt.Errorf("the segment 'arcSettingName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateArcSettingID checks that 'input' can be parsed as a Arc Setting ID +func ValidateArcSettingID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseArcSettingID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Arc Setting ID +func (id ArcSettingId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s/arcSettings/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.ArcSettingName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Arc Setting ID +func (id ArcSettingId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticArcSettings", "arcSettings", "arcSettings"), + resourceids.UserSpecifiedSegment("arcSettingName", "arcSettingValue"), + } +} + +// String returns a human-readable description of this Arc Setting ID +func (id ArcSettingId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Arc Setting Name: %q", id.ArcSettingName), + } + return fmt.Sprintf("Arc Setting (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/id_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/id_cluster.go new file mode 100644 index 000000000000..b250ac009efa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/id_cluster.go @@ -0,0 +1,124 @@ +package arcsettings + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ClusterId{} + +// ClusterId is a struct representing the Resource ID for a Cluster +type ClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewClusterID returns a new ClusterId struct +func NewClusterID(subscriptionId string, resourceGroupName string, clusterName string) ClusterId { + return ClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseClusterID parses 'input' into a ClusterId +func ParseClusterID(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseClusterIDInsensitively parses 'input' case-insensitively into a ClusterId +// note: this method should only be used for API response data and not user input +func ParseClusterIDInsensitively(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateClusterID checks that 'input' can be parsed as a Cluster ID +func ValidateClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cluster ID +func (id ClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cluster ID +func (id ClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Cluster ID +func (id ClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_arcsettingscreate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_arcsettingscreate_autorest.go new file mode 100644 index 000000000000..fe19adab1ae6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_arcsettingscreate_autorest.go @@ -0,0 +1,69 @@ +package arcsettings + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArcSettingsCreateOperationResponse struct { + HttpResponse *http.Response + Model *ArcSetting +} + +// ArcSettingsCreate ... +func (c ArcSettingsClient) ArcSettingsCreate(ctx context.Context, id ArcSettingId, input ArcSetting) (result ArcSettingsCreateOperationResponse, err error) { + req, err := c.preparerForArcSettingsCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsCreate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsCreate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForArcSettingsCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsCreate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForArcSettingsCreate prepares the ArcSettingsCreate request. +func (c ArcSettingsClient) preparerForArcSettingsCreate(ctx context.Context, id ArcSettingId, input ArcSetting) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForArcSettingsCreate handles the response to the ArcSettingsCreate request. The method always +// closes the http.Response Body. +func (c ArcSettingsClient) responderForArcSettingsCreate(resp *http.Response) (result ArcSettingsCreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_arcsettingsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_arcsettingsdelete_autorest.go new file mode 100644 index 000000000000..44900d47353c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_arcsettingsdelete_autorest.go @@ -0,0 +1,78 @@ +package arcsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArcSettingsDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ArcSettingsDelete ... +func (c ArcSettingsClient) ArcSettingsDelete(ctx context.Context, id ArcSettingId) (result ArcSettingsDeleteOperationResponse, err error) { + req, err := c.preparerForArcSettingsDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForArcSettingsDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ArcSettingsDeleteThenPoll performs ArcSettingsDelete then polls until it's completed +func (c ArcSettingsClient) ArcSettingsDeleteThenPoll(ctx context.Context, id ArcSettingId) error { + result, err := c.ArcSettingsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ArcSettingsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ArcSettingsDelete: %+v", err) + } + + return nil +} + +// preparerForArcSettingsDelete prepares the ArcSettingsDelete request. +func (c ArcSettingsClient) preparerForArcSettingsDelete(ctx context.Context, id ArcSettingId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForArcSettingsDelete sends the ArcSettingsDelete request. The method will close the +// http.Response Body if it receives an error. +func (c ArcSettingsClient) senderForArcSettingsDelete(ctx context.Context, req *http.Request) (future ArcSettingsDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_arcsettingsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_arcsettingsget_autorest.go new file mode 100644 index 000000000000..ca7cbc15b5cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_arcsettingsget_autorest.go @@ -0,0 +1,68 @@ +package arcsettings + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArcSettingsGetOperationResponse struct { + HttpResponse *http.Response + Model *ArcSetting +} + +// ArcSettingsGet ... +func (c ArcSettingsClient) ArcSettingsGet(ctx context.Context, id ArcSettingId) (result ArcSettingsGetOperationResponse, err error) { + req, err := c.preparerForArcSettingsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForArcSettingsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForArcSettingsGet prepares the ArcSettingsGet request. +func (c ArcSettingsClient) preparerForArcSettingsGet(ctx context.Context, id ArcSettingId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForArcSettingsGet handles the response to the ArcSettingsGet request. The method always +// closes the http.Response Body. +func (c ArcSettingsClient) responderForArcSettingsGet(resp *http.Response) (result ArcSettingsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_arcsettingslistbycluster_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_arcsettingslistbycluster_autorest.go new file mode 100644 index 000000000000..02102cd04683 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_arcsettingslistbycluster_autorest.go @@ -0,0 +1,186 @@ +package arcsettings + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArcSettingsListByClusterOperationResponse struct { + HttpResponse *http.Response + Model *[]ArcSetting + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ArcSettingsListByClusterOperationResponse, error) +} + +type ArcSettingsListByClusterCompleteResult struct { + Items []ArcSetting +} + +func (r ArcSettingsListByClusterOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ArcSettingsListByClusterOperationResponse) LoadMore(ctx context.Context) (resp ArcSettingsListByClusterOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ArcSettingsListByCluster ... +func (c ArcSettingsClient) ArcSettingsListByCluster(ctx context.Context, id ClusterId) (resp ArcSettingsListByClusterOperationResponse, err error) { + req, err := c.preparerForArcSettingsListByCluster(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsListByCluster", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsListByCluster", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForArcSettingsListByCluster(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsListByCluster", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForArcSettingsListByCluster prepares the ArcSettingsListByCluster request. +func (c ArcSettingsClient) preparerForArcSettingsListByCluster(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/arcSettings", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForArcSettingsListByClusterWithNextLink prepares the ArcSettingsListByCluster request with the given nextLink token. +func (c ArcSettingsClient) preparerForArcSettingsListByClusterWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForArcSettingsListByCluster handles the response to the ArcSettingsListByCluster request. The method always +// closes the http.Response Body. +func (c ArcSettingsClient) responderForArcSettingsListByCluster(resp *http.Response) (result ArcSettingsListByClusterOperationResponse, err error) { + type page struct { + Values []ArcSetting `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ArcSettingsListByClusterOperationResponse, err error) { + req, err := c.preparerForArcSettingsListByClusterWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsListByCluster", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsListByCluster", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForArcSettingsListByCluster(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsListByCluster", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ArcSettingsListByClusterComplete retrieves all of the results into a single object +func (c ArcSettingsClient) ArcSettingsListByClusterComplete(ctx context.Context, id ClusterId) (ArcSettingsListByClusterCompleteResult, error) { + return c.ArcSettingsListByClusterCompleteMatchingPredicate(ctx, id, ArcSettingOperationPredicate{}) +} + +// ArcSettingsListByClusterCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ArcSettingsClient) ArcSettingsListByClusterCompleteMatchingPredicate(ctx context.Context, id ClusterId, predicate ArcSettingOperationPredicate) (resp ArcSettingsListByClusterCompleteResult, err error) { + items := make([]ArcSetting, 0) + + page, err := c.ArcSettingsListByCluster(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ArcSettingsListByClusterCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_arcsettingsupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_arcsettingsupdate_autorest.go new file mode 100644 index 000000000000..3ef8a015898e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_arcsettingsupdate_autorest.go @@ -0,0 +1,69 @@ +package arcsettings + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArcSettingsUpdateOperationResponse struct { + HttpResponse *http.Response + Model *ArcSetting +} + +// ArcSettingsUpdate ... +func (c ArcSettingsClient) ArcSettingsUpdate(ctx context.Context, id ArcSettingId, input ArcSettingsPatch) (result ArcSettingsUpdateOperationResponse, err error) { + req, err := c.preparerForArcSettingsUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForArcSettingsUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "ArcSettingsUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForArcSettingsUpdate prepares the ArcSettingsUpdate request. +func (c ArcSettingsClient) preparerForArcSettingsUpdate(ctx context.Context, id ArcSettingId, input ArcSettingsPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForArcSettingsUpdate handles the response to the ArcSettingsUpdate request. The method always +// closes the http.Response Body. +func (c ArcSettingsClient) responderForArcSettingsUpdate(resp *http.Response) (result ArcSettingsUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_createidentity_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_createidentity_autorest.go new file mode 100644 index 000000000000..9949c468791b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_createidentity_autorest.go @@ -0,0 +1,78 @@ +package arcsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateIdentityOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateIdentity ... +func (c ArcSettingsClient) CreateIdentity(ctx context.Context, id ArcSettingId) (result CreateIdentityOperationResponse, err error) { + req, err := c.preparerForCreateIdentity(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "CreateIdentity", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateIdentity(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "CreateIdentity", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateIdentityThenPoll performs CreateIdentity then polls until it's completed +func (c ArcSettingsClient) CreateIdentityThenPoll(ctx context.Context, id ArcSettingId) error { + result, err := c.CreateIdentity(ctx, id) + if err != nil { + return fmt.Errorf("performing CreateIdentity: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateIdentity: %+v", err) + } + + return nil +} + +// preparerForCreateIdentity prepares the CreateIdentity request. +func (c ArcSettingsClient) preparerForCreateIdentity(ctx context.Context, id ArcSettingId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/createArcIdentity", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateIdentity sends the CreateIdentity request. The method will close the +// http.Response Body if it receives an error. +func (c ArcSettingsClient) senderForCreateIdentity(ctx context.Context, req *http.Request) (future CreateIdentityOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_generatepassword_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_generatepassword_autorest.go new file mode 100644 index 000000000000..6a109c7d8db2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/method_generatepassword_autorest.go @@ -0,0 +1,69 @@ +package arcsettings + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GeneratePasswordOperationResponse struct { + HttpResponse *http.Response + Model *PasswordCredential +} + +// GeneratePassword ... +func (c ArcSettingsClient) GeneratePassword(ctx context.Context, id ArcSettingId) (result GeneratePasswordOperationResponse, err error) { + req, err := c.preparerForGeneratePassword(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "GeneratePassword", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "GeneratePassword", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGeneratePassword(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "arcsettings.ArcSettingsClient", "GeneratePassword", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGeneratePassword prepares the GeneratePassword request. +func (c ArcSettingsClient) preparerForGeneratePassword(ctx context.Context, id ArcSettingId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/generatePassword", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGeneratePassword handles the response to the GeneratePassword request. The method always +// closes the http.Response Body. +func (c ArcSettingsClient) responderForGeneratePassword(resp *http.Response) (result GeneratePasswordOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcidentityresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcidentityresponse.go new file mode 100644 index 000000000000..08d1275ea504 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcidentityresponse.go @@ -0,0 +1,8 @@ +package arcsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArcIdentityResponse struct { + Properties *ArcIdentityResponseProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcidentityresponseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcidentityresponseproperties.go new file mode 100644 index 000000000000..4e33abb10de7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcidentityresponseproperties.go @@ -0,0 +1,11 @@ +package arcsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArcIdentityResponseProperties struct { + ArcApplicationClientId *string `json:"arcApplicationClientId,omitempty"` + ArcApplicationObjectId *string `json:"arcApplicationObjectId,omitempty"` + ArcApplicationTenantId *string `json:"arcApplicationTenantId,omitempty"` + ArcServicePrincipalObjectId *string `json:"arcServicePrincipalObjectId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcsetting.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcsetting.go new file mode 100644 index 000000000000..792133291a2f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcsetting.go @@ -0,0 +1,16 @@ +package arcsettings + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArcSetting struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ArcSettingProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcsettingproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcsettingproperties.go new file mode 100644 index 000000000000..7190cf1eeeef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcsettingproperties.go @@ -0,0 +1,16 @@ +package arcsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArcSettingProperties struct { + AggregateState *ArcSettingAggregateState `json:"aggregateState,omitempty"` + ArcApplicationClientId *string `json:"arcApplicationClientId,omitempty"` + ArcApplicationObjectId *string `json:"arcApplicationObjectId,omitempty"` + ArcApplicationTenantId *string `json:"arcApplicationTenantId,omitempty"` + ArcInstanceResourceGroup *string `json:"arcInstanceResourceGroup,omitempty"` + ArcServicePrincipalObjectId *string `json:"arcServicePrincipalObjectId,omitempty"` + ConnectivityProperties *interface{} `json:"connectivityProperties,omitempty"` + PerNodeDetails *[]PerNodeState `json:"perNodeDetails,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcsettingspatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcsettingspatch.go new file mode 100644 index 000000000000..ff9c88a36643 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcsettingspatch.go @@ -0,0 +1,9 @@ +package arcsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArcSettingsPatch struct { + Properties *ArcSettingsPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcsettingspatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcsettingspatchproperties.go new file mode 100644 index 000000000000..7a806bba4904 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_arcsettingspatchproperties.go @@ -0,0 +1,8 @@ +package arcsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArcSettingsPatchProperties struct { + ConnectivityProperties *interface{} `json:"connectivityProperties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_passwordcredential.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_passwordcredential.go new file mode 100644 index 000000000000..cf56a2624c08 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_passwordcredential.go @@ -0,0 +1,41 @@ +package arcsettings + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PasswordCredential struct { + EndDateTime *string `json:"endDateTime,omitempty"` + KeyId *string `json:"keyId,omitempty"` + SecretText *string `json:"secretText,omitempty"` + StartDateTime *string `json:"startDateTime,omitempty"` +} + +func (o *PasswordCredential) GetEndDateTimeAsTime() (*time.Time, error) { + if o.EndDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *PasswordCredential) SetEndDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndDateTime = &formatted +} + +func (o *PasswordCredential) GetStartDateTimeAsTime() (*time.Time, error) { + if o.StartDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *PasswordCredential) SetStartDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartDateTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_pernodestate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_pernodestate.go new file mode 100644 index 000000000000..22f862fc3577 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/model_pernodestate.go @@ -0,0 +1,10 @@ +package arcsettings + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PerNodeState struct { + ArcInstance *string `json:"arcInstance,omitempty"` + Name *string `json:"name,omitempty"` + State *NodeArcState `json:"state,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/predicates.go new file mode 100644 index 000000000000..e983bf60efdf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/predicates.go @@ -0,0 +1,24 @@ +package arcsettings + +type ArcSettingOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ArcSettingOperationPredicate) Matches(input ArcSetting) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/version.go new file mode 100644 index 000000000000..bf2a7fcc811f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings/version.go @@ -0,0 +1,12 @@ +package arcsettings + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/arcsettings/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/client.go new file mode 100644 index 000000000000..343685c7eb8f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/client.go @@ -0,0 +1,74 @@ +package v2022_12_01 + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings" + "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster" + "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions" + "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers" + "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers" + "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses" + "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns" + "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates" + "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries" +) + +type Client struct { + ArcSettings *arcsettings.ArcSettingsClient + Cluster *cluster.ClusterClient + Clusters *clusters.ClustersClient + Extensions *extensions.ExtensionsClient + Offers *offers.OffersClient + Publishers *publishers.PublishersClient + Skuses *skuses.SkusesClient + UpdateRuns *updateruns.UpdateRunsClient + UpdateSummaries *updatesummaries.UpdateSummariesClient + Updates *updates.UpdatesClient +} + +func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { + + arcSettingsClient := arcsettings.NewArcSettingsClientWithBaseURI(endpoint) + configureAuthFunc(&arcSettingsClient.Client) + + clusterClient := cluster.NewClusterClientWithBaseURI(endpoint) + configureAuthFunc(&clusterClient.Client) + + clustersClient := clusters.NewClustersClientWithBaseURI(endpoint) + configureAuthFunc(&clustersClient.Client) + + extensionsClient := extensions.NewExtensionsClientWithBaseURI(endpoint) + configureAuthFunc(&extensionsClient.Client) + + offersClient := offers.NewOffersClientWithBaseURI(endpoint) + configureAuthFunc(&offersClient.Client) + + publishersClient := publishers.NewPublishersClientWithBaseURI(endpoint) + configureAuthFunc(&publishersClient.Client) + + skusesClient := skuses.NewSkusesClientWithBaseURI(endpoint) + configureAuthFunc(&skusesClient.Client) + + updateRunsClient := updateruns.NewUpdateRunsClientWithBaseURI(endpoint) + configureAuthFunc(&updateRunsClient.Client) + + updateSummariesClient := updatesummaries.NewUpdateSummariesClientWithBaseURI(endpoint) + configureAuthFunc(&updateSummariesClient.Client) + + updatesClient := updates.NewUpdatesClientWithBaseURI(endpoint) + configureAuthFunc(&updatesClient.Client) + + return Client{ + ArcSettings: &arcSettingsClient, + Cluster: &clusterClient, + Clusters: &clustersClient, + Extensions: &extensionsClient, + Offers: &offersClient, + Publishers: &publishersClient, + Skuses: &skusesClient, + UpdateRuns: &updateRunsClient, + UpdateSummaries: &updateSummariesClient, + Updates: &updatesClient, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/README.md new file mode 100644 index 000000000000..ce4f97396c45 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/README.md @@ -0,0 +1,66 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster` Documentation + +The `cluster` SDK allows for interaction with the Azure Resource Manager Service `azurestackhci` (API Version `2022-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster" +``` + + +### Client Initialization + +```go +client := cluster.NewClusterClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ClusterClient.CreateIdentity` + +```go +ctx := context.TODO() +id := cluster.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +if err := client.CreateIdentityThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClusterClient.ExtendSoftwareAssuranceBenefit` + +```go +ctx := context.TODO() +id := cluster.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := cluster.SoftwareAssuranceChangeRequest{ + // ... +} + + +if err := client.ExtendSoftwareAssuranceBenefitThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClusterClient.UploadCertificate` + +```go +ctx := context.TODO() +id := cluster.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := cluster.UploadCertificateRequest{ + // ... +} + + +if err := client.UploadCertificateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/client.go new file mode 100644 index 000000000000..d3c96cfed0b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/client.go @@ -0,0 +1,18 @@ +package cluster + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterClient struct { + Client autorest.Client + baseUri string +} + +func NewClusterClientWithBaseURI(endpoint string) ClusterClient { + return ClusterClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/constants.go new file mode 100644 index 000000000000..88de64b20f62 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/constants.go @@ -0,0 +1,290 @@ +package cluster + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterNodeType string + +const ( + ClusterNodeTypeFirstParty ClusterNodeType = "FirstParty" + ClusterNodeTypeThirdParty ClusterNodeType = "ThirdParty" +) + +func PossibleValuesForClusterNodeType() []string { + return []string{ + string(ClusterNodeTypeFirstParty), + string(ClusterNodeTypeThirdParty), + } +} + +func parseClusterNodeType(input string) (*ClusterNodeType, error) { + vals := map[string]ClusterNodeType{ + "firstparty": ClusterNodeTypeFirstParty, + "thirdparty": ClusterNodeTypeThirdParty, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterNodeType(input) + return &out, nil +} + +type DiagnosticLevel string + +const ( + DiagnosticLevelBasic DiagnosticLevel = "Basic" + DiagnosticLevelEnhanced DiagnosticLevel = "Enhanced" + DiagnosticLevelOff DiagnosticLevel = "Off" +) + +func PossibleValuesForDiagnosticLevel() []string { + return []string{ + string(DiagnosticLevelBasic), + string(DiagnosticLevelEnhanced), + string(DiagnosticLevelOff), + } +} + +func parseDiagnosticLevel(input string) (*DiagnosticLevel, error) { + vals := map[string]DiagnosticLevel{ + "basic": DiagnosticLevelBasic, + "enhanced": DiagnosticLevelEnhanced, + "off": DiagnosticLevelOff, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiagnosticLevel(input) + return &out, nil +} + +type ImdsAttestation string + +const ( + ImdsAttestationDisabled ImdsAttestation = "Disabled" + ImdsAttestationEnabled ImdsAttestation = "Enabled" +) + +func PossibleValuesForImdsAttestation() []string { + return []string{ + string(ImdsAttestationDisabled), + string(ImdsAttestationEnabled), + } +} + +func parseImdsAttestation(input string) (*ImdsAttestation, error) { + vals := map[string]ImdsAttestation{ + "disabled": ImdsAttestationDisabled, + "enabled": ImdsAttestationEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ImdsAttestation(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateConnected ProvisioningState = "Connected" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateDisableInProgress ProvisioningState = "DisableInProgress" + ProvisioningStateDisconnected ProvisioningState = "Disconnected" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateInProgress ProvisioningState = "InProgress" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + ProvisioningStatePartiallyConnected ProvisioningState = "PartiallyConnected" + ProvisioningStatePartiallySucceeded ProvisioningState = "PartiallySucceeded" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateConnected), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateDisableInProgress), + string(ProvisioningStateDisconnected), + string(ProvisioningStateFailed), + string(ProvisioningStateInProgress), + string(ProvisioningStateMoving), + string(ProvisioningStateNotSpecified), + string(ProvisioningStatePartiallyConnected), + string(ProvisioningStatePartiallySucceeded), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "connected": ProvisioningStateConnected, + "creating": ProvisioningStateCreating, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "disableinprogress": ProvisioningStateDisableInProgress, + "disconnected": ProvisioningStateDisconnected, + "failed": ProvisioningStateFailed, + "inprogress": ProvisioningStateInProgress, + "moving": ProvisioningStateMoving, + "notspecified": ProvisioningStateNotSpecified, + "partiallyconnected": ProvisioningStatePartiallyConnected, + "partiallysucceeded": ProvisioningStatePartiallySucceeded, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type SoftwareAssuranceIntent string + +const ( + SoftwareAssuranceIntentDisable SoftwareAssuranceIntent = "Disable" + SoftwareAssuranceIntentEnable SoftwareAssuranceIntent = "Enable" +) + +func PossibleValuesForSoftwareAssuranceIntent() []string { + return []string{ + string(SoftwareAssuranceIntentDisable), + string(SoftwareAssuranceIntentEnable), + } +} + +func parseSoftwareAssuranceIntent(input string) (*SoftwareAssuranceIntent, error) { + vals := map[string]SoftwareAssuranceIntent{ + "disable": SoftwareAssuranceIntentDisable, + "enable": SoftwareAssuranceIntentEnable, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SoftwareAssuranceIntent(input) + return &out, nil +} + +type SoftwareAssuranceStatus string + +const ( + SoftwareAssuranceStatusDisabled SoftwareAssuranceStatus = "Disabled" + SoftwareAssuranceStatusEnabled SoftwareAssuranceStatus = "Enabled" +) + +func PossibleValuesForSoftwareAssuranceStatus() []string { + return []string{ + string(SoftwareAssuranceStatusDisabled), + string(SoftwareAssuranceStatusEnabled), + } +} + +func parseSoftwareAssuranceStatus(input string) (*SoftwareAssuranceStatus, error) { + vals := map[string]SoftwareAssuranceStatus{ + "disabled": SoftwareAssuranceStatusDisabled, + "enabled": SoftwareAssuranceStatusEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SoftwareAssuranceStatus(input) + return &out, nil +} + +type Status string + +const ( + StatusConnectedRecently Status = "ConnectedRecently" + StatusDisconnected Status = "Disconnected" + StatusError Status = "Error" + StatusNotConnectedRecently Status = "NotConnectedRecently" + StatusNotSpecified Status = "NotSpecified" + StatusNotYetRegistered Status = "NotYetRegistered" +) + +func PossibleValuesForStatus() []string { + return []string{ + string(StatusConnectedRecently), + string(StatusDisconnected), + string(StatusError), + string(StatusNotConnectedRecently), + string(StatusNotSpecified), + string(StatusNotYetRegistered), + } +} + +func parseStatus(input string) (*Status, error) { + vals := map[string]Status{ + "connectedrecently": StatusConnectedRecently, + "disconnected": StatusDisconnected, + "error": StatusError, + "notconnectedrecently": StatusNotConnectedRecently, + "notspecified": StatusNotSpecified, + "notyetregistered": StatusNotYetRegistered, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} + +type WindowsServerSubscription string + +const ( + WindowsServerSubscriptionDisabled WindowsServerSubscription = "Disabled" + WindowsServerSubscriptionEnabled WindowsServerSubscription = "Enabled" +) + +func PossibleValuesForWindowsServerSubscription() []string { + return []string{ + string(WindowsServerSubscriptionDisabled), + string(WindowsServerSubscriptionEnabled), + } +} + +func parseWindowsServerSubscription(input string) (*WindowsServerSubscription, error) { + vals := map[string]WindowsServerSubscription{ + "disabled": WindowsServerSubscriptionDisabled, + "enabled": WindowsServerSubscriptionEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsServerSubscription(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/id_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/id_cluster.go new file mode 100644 index 000000000000..bc5679bcc3b0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/id_cluster.go @@ -0,0 +1,124 @@ +package cluster + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ClusterId{} + +// ClusterId is a struct representing the Resource ID for a Cluster +type ClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewClusterID returns a new ClusterId struct +func NewClusterID(subscriptionId string, resourceGroupName string, clusterName string) ClusterId { + return ClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseClusterID parses 'input' into a ClusterId +func ParseClusterID(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseClusterIDInsensitively parses 'input' case-insensitively into a ClusterId +// note: this method should only be used for API response data and not user input +func ParseClusterIDInsensitively(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateClusterID checks that 'input' can be parsed as a Cluster ID +func ValidateClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cluster ID +func (id ClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cluster ID +func (id ClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Cluster ID +func (id ClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/method_createidentity_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/method_createidentity_autorest.go new file mode 100644 index 000000000000..eefa883e7342 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/method_createidentity_autorest.go @@ -0,0 +1,78 @@ +package cluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateIdentityOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateIdentity ... +func (c ClusterClient) CreateIdentity(ctx context.Context, id ClusterId) (result CreateIdentityOperationResponse, err error) { + req, err := c.preparerForCreateIdentity(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "CreateIdentity", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateIdentity(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "CreateIdentity", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateIdentityThenPoll performs CreateIdentity then polls until it's completed +func (c ClusterClient) CreateIdentityThenPoll(ctx context.Context, id ClusterId) error { + result, err := c.CreateIdentity(ctx, id) + if err != nil { + return fmt.Errorf("performing CreateIdentity: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateIdentity: %+v", err) + } + + return nil +} + +// preparerForCreateIdentity prepares the CreateIdentity request. +func (c ClusterClient) preparerForCreateIdentity(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/createClusterIdentity", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateIdentity sends the CreateIdentity request. The method will close the +// http.Response Body if it receives an error. +func (c ClusterClient) senderForCreateIdentity(ctx context.Context, req *http.Request) (future CreateIdentityOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/method_extendsoftwareassurancebenefit_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/method_extendsoftwareassurancebenefit_autorest.go new file mode 100644 index 000000000000..3c75d3729b23 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/method_extendsoftwareassurancebenefit_autorest.go @@ -0,0 +1,79 @@ +package cluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtendSoftwareAssuranceBenefitOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ExtendSoftwareAssuranceBenefit ... +func (c ClusterClient) ExtendSoftwareAssuranceBenefit(ctx context.Context, id ClusterId, input SoftwareAssuranceChangeRequest) (result ExtendSoftwareAssuranceBenefitOperationResponse, err error) { + req, err := c.preparerForExtendSoftwareAssuranceBenefit(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "ExtendSoftwareAssuranceBenefit", nil, "Failure preparing request") + return + } + + result, err = c.senderForExtendSoftwareAssuranceBenefit(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "ExtendSoftwareAssuranceBenefit", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ExtendSoftwareAssuranceBenefitThenPoll performs ExtendSoftwareAssuranceBenefit then polls until it's completed +func (c ClusterClient) ExtendSoftwareAssuranceBenefitThenPoll(ctx context.Context, id ClusterId, input SoftwareAssuranceChangeRequest) error { + result, err := c.ExtendSoftwareAssuranceBenefit(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ExtendSoftwareAssuranceBenefit: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ExtendSoftwareAssuranceBenefit: %+v", err) + } + + return nil +} + +// preparerForExtendSoftwareAssuranceBenefit prepares the ExtendSoftwareAssuranceBenefit request. +func (c ClusterClient) preparerForExtendSoftwareAssuranceBenefit(ctx context.Context, id ClusterId, input SoftwareAssuranceChangeRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/extendSoftwareAssuranceBenefit", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForExtendSoftwareAssuranceBenefit sends the ExtendSoftwareAssuranceBenefit request. The method will close the +// http.Response Body if it receives an error. +func (c ClusterClient) senderForExtendSoftwareAssuranceBenefit(ctx context.Context, req *http.Request) (future ExtendSoftwareAssuranceBenefitOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/method_uploadcertificate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/method_uploadcertificate_autorest.go new file mode 100644 index 000000000000..3a667f1bb768 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/method_uploadcertificate_autorest.go @@ -0,0 +1,79 @@ +package cluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UploadCertificateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// UploadCertificate ... +func (c ClusterClient) UploadCertificate(ctx context.Context, id ClusterId, input UploadCertificateRequest) (result UploadCertificateOperationResponse, err error) { + req, err := c.preparerForUploadCertificate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "UploadCertificate", nil, "Failure preparing request") + return + } + + result, err = c.senderForUploadCertificate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "UploadCertificate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UploadCertificateThenPoll performs UploadCertificate then polls until it's completed +func (c ClusterClient) UploadCertificateThenPoll(ctx context.Context, id ClusterId, input UploadCertificateRequest) error { + result, err := c.UploadCertificate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing UploadCertificate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after UploadCertificate: %+v", err) + } + + return nil +} + +// preparerForUploadCertificate prepares the UploadCertificate request. +func (c ClusterClient) preparerForUploadCertificate(ctx context.Context, id ClusterId, input UploadCertificateRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/uploadCertificate", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUploadCertificate sends the UploadCertificate request. The method will close the +// http.Response Body if it receives an error. +func (c ClusterClient) senderForUploadCertificate(ctx context.Context, req *http.Request) (future UploadCertificateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_cluster.go new file mode 100644 index 000000000000..e41f174485bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_cluster.go @@ -0,0 +1,20 @@ +package cluster + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Cluster struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ClusterProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusterdesiredproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusterdesiredproperties.go new file mode 100644 index 000000000000..7ff21e52a48e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusterdesiredproperties.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterDesiredProperties struct { + DiagnosticLevel *DiagnosticLevel `json:"diagnosticLevel,omitempty"` + WindowsServerSubscription *WindowsServerSubscription `json:"windowsServerSubscription,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusteridentityresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusteridentityresponse.go new file mode 100644 index 000000000000..7e64cb4e35a9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusteridentityresponse.go @@ -0,0 +1,8 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterIdentityResponse struct { + Properties *ClusterIdentityResponseProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusteridentityresponseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusteridentityresponseproperties.go new file mode 100644 index 000000000000..1ba7404ca107 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusteridentityresponseproperties.go @@ -0,0 +1,11 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterIdentityResponseProperties struct { + AadApplicationObjectId *string `json:"aadApplicationObjectId,omitempty"` + AadClientId *string `json:"aadClientId,omitempty"` + AadServicePrincipalObjectId *string `json:"aadServicePrincipalObjectId,omitempty"` + AadTenantId *string `json:"aadTenantId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusternode.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusternode.go new file mode 100644 index 000000000000..ef782dac176c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusternode.go @@ -0,0 +1,20 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterNode struct { + CoreCount *float64 `json:"coreCount,omitempty"` + EhcResourceId *string `json:"ehcResourceId,omitempty"` + Id *float64 `json:"id,omitempty"` + Manufacturer *string `json:"manufacturer,omitempty"` + MemoryInGiB *float64 `json:"memoryInGiB,omitempty"` + Model *string `json:"model,omitempty"` + Name *string `json:"name,omitempty"` + NodeType *ClusterNodeType `json:"nodeType,omitempty"` + OsDisplayVersion *string `json:"osDisplayVersion,omitempty"` + OsName *string `json:"osName,omitempty"` + OsVersion *string `json:"osVersion,omitempty"` + SerialNumber *string `json:"serialNumber,omitempty"` + WindowsServerSubscription *WindowsServerSubscription `json:"windowsServerSubscription,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusterproperties.go new file mode 100644 index 000000000000..89dac820451e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusterproperties.go @@ -0,0 +1,67 @@ +package cluster + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterProperties struct { + AadApplicationObjectId *string `json:"aadApplicationObjectId,omitempty"` + AadClientId *string `json:"aadClientId,omitempty"` + AadServicePrincipalObjectId *string `json:"aadServicePrincipalObjectId,omitempty"` + AadTenantId *string `json:"aadTenantId,omitempty"` + BillingModel *string `json:"billingModel,omitempty"` + CloudId *string `json:"cloudId,omitempty"` + CloudManagementEndpoint *string `json:"cloudManagementEndpoint,omitempty"` + DesiredProperties *ClusterDesiredProperties `json:"desiredProperties,omitempty"` + LastBillingTimestamp *string `json:"lastBillingTimestamp,omitempty"` + LastSyncTimestamp *string `json:"lastSyncTimestamp,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RegistrationTimestamp *string `json:"registrationTimestamp,omitempty"` + ReportedProperties *ClusterReportedProperties `json:"reportedProperties,omitempty"` + ResourceProviderObjectId *string `json:"resourceProviderObjectId,omitempty"` + ServiceEndpoint *string `json:"serviceEndpoint,omitempty"` + SoftwareAssuranceProperties *SoftwareAssuranceProperties `json:"softwareAssuranceProperties,omitempty"` + Status *Status `json:"status,omitempty"` + TrialDaysRemaining *float64 `json:"trialDaysRemaining,omitempty"` +} + +func (o *ClusterProperties) GetLastBillingTimestampAsTime() (*time.Time, error) { + if o.LastBillingTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastBillingTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterProperties) SetLastBillingTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastBillingTimestamp = &formatted +} + +func (o *ClusterProperties) GetLastSyncTimestampAsTime() (*time.Time, error) { + if o.LastSyncTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastSyncTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterProperties) SetLastSyncTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastSyncTimestamp = &formatted +} + +func (o *ClusterProperties) GetRegistrationTimestampAsTime() (*time.Time, error) { + if o.RegistrationTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.RegistrationTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterProperties) SetRegistrationTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.RegistrationTimestamp = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusterreportedproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusterreportedproperties.go new file mode 100644 index 000000000000..428d42f4f7c6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_clusterreportedproperties.go @@ -0,0 +1,33 @@ +package cluster + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterReportedProperties struct { + ClusterId *string `json:"clusterId,omitempty"` + ClusterName *string `json:"clusterName,omitempty"` + ClusterVersion *string `json:"clusterVersion,omitempty"` + DiagnosticLevel *DiagnosticLevel `json:"diagnosticLevel,omitempty"` + ImdsAttestation *ImdsAttestation `json:"imdsAttestation,omitempty"` + LastUpdated *string `json:"lastUpdated,omitempty"` + Nodes *[]ClusterNode `json:"nodes,omitempty"` + SupportedCapabilities *[]string `json:"supportedCapabilities,omitempty"` +} + +func (o *ClusterReportedProperties) GetLastUpdatedAsTime() (*time.Time, error) { + if o.LastUpdated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdated, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterReportedProperties) SetLastUpdatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdated = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_rawcertificatedata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_rawcertificatedata.go new file mode 100644 index 000000000000..d2a4c0aa21f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_rawcertificatedata.go @@ -0,0 +1,8 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RawCertificateData struct { + Certificates *[]string `json:"certificates,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_softwareassurancechangerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_softwareassurancechangerequest.go new file mode 100644 index 000000000000..61ed38159fe4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_softwareassurancechangerequest.go @@ -0,0 +1,8 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SoftwareAssuranceChangeRequest struct { + Properties *SoftwareAssuranceChangeRequestProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_softwareassurancechangerequestproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_softwareassurancechangerequestproperties.go new file mode 100644 index 000000000000..b7dd0dcb80c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_softwareassurancechangerequestproperties.go @@ -0,0 +1,8 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SoftwareAssuranceChangeRequestProperties struct { + SoftwareAssuranceIntent *SoftwareAssuranceIntent `json:"softwareAssuranceIntent,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_softwareassuranceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_softwareassuranceproperties.go new file mode 100644 index 000000000000..671a0e62dee4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_softwareassuranceproperties.go @@ -0,0 +1,28 @@ +package cluster + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SoftwareAssuranceProperties struct { + LastUpdated *string `json:"lastUpdated,omitempty"` + SoftwareAssuranceIntent *SoftwareAssuranceIntent `json:"softwareAssuranceIntent,omitempty"` + SoftwareAssuranceStatus *SoftwareAssuranceStatus `json:"softwareAssuranceStatus,omitempty"` +} + +func (o *SoftwareAssuranceProperties) GetLastUpdatedAsTime() (*time.Time, error) { + if o.LastUpdated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdated, "2006-01-02T15:04:05Z07:00") +} + +func (o *SoftwareAssuranceProperties) SetLastUpdatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdated = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_uploadcertificaterequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_uploadcertificaterequest.go new file mode 100644 index 000000000000..fc979a96d246 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/model_uploadcertificaterequest.go @@ -0,0 +1,8 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UploadCertificateRequest struct { + Properties *RawCertificateData `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/version.go new file mode 100644 index 000000000000..711d257a3a46 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster/version.go @@ -0,0 +1,12 @@ +package cluster + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/cluster/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/README.md new file mode 100644 index 000000000000..1134c08e82dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/README.md @@ -0,0 +1,124 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters` Documentation + +The `clusters` SDK allows for interaction with the Azure Resource Manager Service `azurestackhci` (API Version `2022-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters" +``` + + +### Client Initialization + +```go +client := clusters.NewClustersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ClustersClient.Create` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := clusters.Cluster{ + // ... +} + + +read, err := client.Create(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClustersClient.Delete` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClustersClient.Get` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClustersClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := clusters.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ClustersClient.ListBySubscription` + +```go +ctx := context.TODO() +id := clusters.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ClustersClient.Update` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := clusters.ClusterPatch{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/constants.go new file mode 100644 index 000000000000..9b1079efa01d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/constants.go @@ -0,0 +1,290 @@ +package clusters + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterNodeType string + +const ( + ClusterNodeTypeFirstParty ClusterNodeType = "FirstParty" + ClusterNodeTypeThirdParty ClusterNodeType = "ThirdParty" +) + +func PossibleValuesForClusterNodeType() []string { + return []string{ + string(ClusterNodeTypeFirstParty), + string(ClusterNodeTypeThirdParty), + } +} + +func parseClusterNodeType(input string) (*ClusterNodeType, error) { + vals := map[string]ClusterNodeType{ + "firstparty": ClusterNodeTypeFirstParty, + "thirdparty": ClusterNodeTypeThirdParty, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterNodeType(input) + return &out, nil +} + +type DiagnosticLevel string + +const ( + DiagnosticLevelBasic DiagnosticLevel = "Basic" + DiagnosticLevelEnhanced DiagnosticLevel = "Enhanced" + DiagnosticLevelOff DiagnosticLevel = "Off" +) + +func PossibleValuesForDiagnosticLevel() []string { + return []string{ + string(DiagnosticLevelBasic), + string(DiagnosticLevelEnhanced), + string(DiagnosticLevelOff), + } +} + +func parseDiagnosticLevel(input string) (*DiagnosticLevel, error) { + vals := map[string]DiagnosticLevel{ + "basic": DiagnosticLevelBasic, + "enhanced": DiagnosticLevelEnhanced, + "off": DiagnosticLevelOff, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiagnosticLevel(input) + return &out, nil +} + +type ImdsAttestation string + +const ( + ImdsAttestationDisabled ImdsAttestation = "Disabled" + ImdsAttestationEnabled ImdsAttestation = "Enabled" +) + +func PossibleValuesForImdsAttestation() []string { + return []string{ + string(ImdsAttestationDisabled), + string(ImdsAttestationEnabled), + } +} + +func parseImdsAttestation(input string) (*ImdsAttestation, error) { + vals := map[string]ImdsAttestation{ + "disabled": ImdsAttestationDisabled, + "enabled": ImdsAttestationEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ImdsAttestation(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateConnected ProvisioningState = "Connected" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateDisableInProgress ProvisioningState = "DisableInProgress" + ProvisioningStateDisconnected ProvisioningState = "Disconnected" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateInProgress ProvisioningState = "InProgress" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + ProvisioningStatePartiallyConnected ProvisioningState = "PartiallyConnected" + ProvisioningStatePartiallySucceeded ProvisioningState = "PartiallySucceeded" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateConnected), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateDisableInProgress), + string(ProvisioningStateDisconnected), + string(ProvisioningStateFailed), + string(ProvisioningStateInProgress), + string(ProvisioningStateMoving), + string(ProvisioningStateNotSpecified), + string(ProvisioningStatePartiallyConnected), + string(ProvisioningStatePartiallySucceeded), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "connected": ProvisioningStateConnected, + "creating": ProvisioningStateCreating, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "disableinprogress": ProvisioningStateDisableInProgress, + "disconnected": ProvisioningStateDisconnected, + "failed": ProvisioningStateFailed, + "inprogress": ProvisioningStateInProgress, + "moving": ProvisioningStateMoving, + "notspecified": ProvisioningStateNotSpecified, + "partiallyconnected": ProvisioningStatePartiallyConnected, + "partiallysucceeded": ProvisioningStatePartiallySucceeded, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type SoftwareAssuranceIntent string + +const ( + SoftwareAssuranceIntentDisable SoftwareAssuranceIntent = "Disable" + SoftwareAssuranceIntentEnable SoftwareAssuranceIntent = "Enable" +) + +func PossibleValuesForSoftwareAssuranceIntent() []string { + return []string{ + string(SoftwareAssuranceIntentDisable), + string(SoftwareAssuranceIntentEnable), + } +} + +func parseSoftwareAssuranceIntent(input string) (*SoftwareAssuranceIntent, error) { + vals := map[string]SoftwareAssuranceIntent{ + "disable": SoftwareAssuranceIntentDisable, + "enable": SoftwareAssuranceIntentEnable, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SoftwareAssuranceIntent(input) + return &out, nil +} + +type SoftwareAssuranceStatus string + +const ( + SoftwareAssuranceStatusDisabled SoftwareAssuranceStatus = "Disabled" + SoftwareAssuranceStatusEnabled SoftwareAssuranceStatus = "Enabled" +) + +func PossibleValuesForSoftwareAssuranceStatus() []string { + return []string{ + string(SoftwareAssuranceStatusDisabled), + string(SoftwareAssuranceStatusEnabled), + } +} + +func parseSoftwareAssuranceStatus(input string) (*SoftwareAssuranceStatus, error) { + vals := map[string]SoftwareAssuranceStatus{ + "disabled": SoftwareAssuranceStatusDisabled, + "enabled": SoftwareAssuranceStatusEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SoftwareAssuranceStatus(input) + return &out, nil +} + +type Status string + +const ( + StatusConnectedRecently Status = "ConnectedRecently" + StatusDisconnected Status = "Disconnected" + StatusError Status = "Error" + StatusNotConnectedRecently Status = "NotConnectedRecently" + StatusNotSpecified Status = "NotSpecified" + StatusNotYetRegistered Status = "NotYetRegistered" +) + +func PossibleValuesForStatus() []string { + return []string{ + string(StatusConnectedRecently), + string(StatusDisconnected), + string(StatusError), + string(StatusNotConnectedRecently), + string(StatusNotSpecified), + string(StatusNotYetRegistered), + } +} + +func parseStatus(input string) (*Status, error) { + vals := map[string]Status{ + "connectedrecently": StatusConnectedRecently, + "disconnected": StatusDisconnected, + "error": StatusError, + "notconnectedrecently": StatusNotConnectedRecently, + "notspecified": StatusNotSpecified, + "notyetregistered": StatusNotYetRegistered, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} + +type WindowsServerSubscription string + +const ( + WindowsServerSubscriptionDisabled WindowsServerSubscription = "Disabled" + WindowsServerSubscriptionEnabled WindowsServerSubscription = "Enabled" +) + +func PossibleValuesForWindowsServerSubscription() []string { + return []string{ + string(WindowsServerSubscriptionDisabled), + string(WindowsServerSubscriptionEnabled), + } +} + +func parseWindowsServerSubscription(input string) (*WindowsServerSubscription, error) { + vals := map[string]WindowsServerSubscription{ + "disabled": WindowsServerSubscriptionDisabled, + "enabled": WindowsServerSubscriptionEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsServerSubscription(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/id_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/id_cluster.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/id_cluster.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/id_cluster.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/method_create_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/method_create_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/method_create_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/method_delete_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/method_delete_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/method_delete_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/method_get_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/method_get_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/method_get_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/method_listbyresourcegroup_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/method_listbyresourcegroup_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/method_listbyresourcegroup_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/method_listbysubscription_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/method_listbysubscription_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/method_listbysubscription_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/method_update_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/method_update_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/method_update_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_cluster.go new file mode 100644 index 000000000000..d5b851dff01a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_cluster.go @@ -0,0 +1,20 @@ +package clusters + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Cluster struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ClusterProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusterdesiredproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusterdesiredproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusterdesiredproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusterdesiredproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusternode.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusternode.go new file mode 100644 index 000000000000..437ee906fb98 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusternode.go @@ -0,0 +1,20 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterNode struct { + CoreCount *float64 `json:"coreCount,omitempty"` + EhcResourceId *string `json:"ehcResourceId,omitempty"` + Id *float64 `json:"id,omitempty"` + Manufacturer *string `json:"manufacturer,omitempty"` + MemoryInGiB *float64 `json:"memoryInGiB,omitempty"` + Model *string `json:"model,omitempty"` + Name *string `json:"name,omitempty"` + NodeType *ClusterNodeType `json:"nodeType,omitempty"` + OsDisplayVersion *string `json:"osDisplayVersion,omitempty"` + OsName *string `json:"osName,omitempty"` + OsVersion *string `json:"osVersion,omitempty"` + SerialNumber *string `json:"serialNumber,omitempty"` + WindowsServerSubscription *WindowsServerSubscription `json:"windowsServerSubscription,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusterpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusterpatch.go new file mode 100644 index 000000000000..5f0c8dc17eb2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusterpatch.go @@ -0,0 +1,14 @@ +package clusters + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterPatch struct { + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Properties *ClusterPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusterpatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusterpatchproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_clusterpatchproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusterpatchproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusterproperties.go new file mode 100644 index 000000000000..7f786526665b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusterproperties.go @@ -0,0 +1,67 @@ +package clusters + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterProperties struct { + AadApplicationObjectId *string `json:"aadApplicationObjectId,omitempty"` + AadClientId *string `json:"aadClientId,omitempty"` + AadServicePrincipalObjectId *string `json:"aadServicePrincipalObjectId,omitempty"` + AadTenantId *string `json:"aadTenantId,omitempty"` + BillingModel *string `json:"billingModel,omitempty"` + CloudId *string `json:"cloudId,omitempty"` + CloudManagementEndpoint *string `json:"cloudManagementEndpoint,omitempty"` + DesiredProperties *ClusterDesiredProperties `json:"desiredProperties,omitempty"` + LastBillingTimestamp *string `json:"lastBillingTimestamp,omitempty"` + LastSyncTimestamp *string `json:"lastSyncTimestamp,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RegistrationTimestamp *string `json:"registrationTimestamp,omitempty"` + ReportedProperties *ClusterReportedProperties `json:"reportedProperties,omitempty"` + ResourceProviderObjectId *string `json:"resourceProviderObjectId,omitempty"` + ServiceEndpoint *string `json:"serviceEndpoint,omitempty"` + SoftwareAssuranceProperties *SoftwareAssuranceProperties `json:"softwareAssuranceProperties,omitempty"` + Status *Status `json:"status,omitempty"` + TrialDaysRemaining *float64 `json:"trialDaysRemaining,omitempty"` +} + +func (o *ClusterProperties) GetLastBillingTimestampAsTime() (*time.Time, error) { + if o.LastBillingTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastBillingTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterProperties) SetLastBillingTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastBillingTimestamp = &formatted +} + +func (o *ClusterProperties) GetLastSyncTimestampAsTime() (*time.Time, error) { + if o.LastSyncTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastSyncTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterProperties) SetLastSyncTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastSyncTimestamp = &formatted +} + +func (o *ClusterProperties) GetRegistrationTimestampAsTime() (*time.Time, error) { + if o.RegistrationTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.RegistrationTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterProperties) SetRegistrationTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.RegistrationTimestamp = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusterreportedproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusterreportedproperties.go new file mode 100644 index 000000000000..460f97cbc61c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_clusterreportedproperties.go @@ -0,0 +1,33 @@ +package clusters + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterReportedProperties struct { + ClusterId *string `json:"clusterId,omitempty"` + ClusterName *string `json:"clusterName,omitempty"` + ClusterVersion *string `json:"clusterVersion,omitempty"` + DiagnosticLevel *DiagnosticLevel `json:"diagnosticLevel,omitempty"` + ImdsAttestation *ImdsAttestation `json:"imdsAttestation,omitempty"` + LastUpdated *string `json:"lastUpdated,omitempty"` + Nodes *[]ClusterNode `json:"nodes,omitempty"` + SupportedCapabilities *[]string `json:"supportedCapabilities,omitempty"` +} + +func (o *ClusterReportedProperties) GetLastUpdatedAsTime() (*time.Time, error) { + if o.LastUpdated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdated, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterReportedProperties) SetLastUpdatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdated = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_softwareassuranceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_softwareassuranceproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/model_softwareassuranceproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/model_softwareassuranceproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/version.go new file mode 100644 index 000000000000..3b6ef352851e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters/version.go @@ -0,0 +1,12 @@ +package clusters + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/clusters/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/README.md new file mode 100644 index 000000000000..a6b8267a519c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions` Documentation + +The `extensions` SDK allows for interaction with the Azure Resource Manager Service `azurestackhci` (API Version `2022-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions" +``` + + +### Client Initialization + +```go +client := extensions.NewExtensionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ExtensionsClient.ExtensionsCreate` + +```go +ctx := context.TODO() +id := extensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "arcSettingValue", "extensionValue") + +payload := extensions.Extension{ + // ... +} + + +if err := client.ExtensionsCreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ExtensionsClient.ExtensionsDelete` + +```go +ctx := context.TODO() +id := extensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "arcSettingValue", "extensionValue") + +if err := client.ExtensionsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ExtensionsClient.ExtensionsGet` + +```go +ctx := context.TODO() +id := extensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "arcSettingValue", "extensionValue") + +read, err := client.ExtensionsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ExtensionsClient.ExtensionsListByArcSetting` + +```go +ctx := context.TODO() +id := extensions.NewArcSettingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "arcSettingValue") + +// alternatively `client.ExtensionsListByArcSetting(ctx, id)` can be used to do batched pagination +items, err := client.ExtensionsListByArcSettingComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ExtensionsClient.ExtensionsUpdate` + +```go +ctx := context.TODO() +id := extensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "arcSettingValue", "extensionValue") + +payload := extensions.Extension{ + // ... +} + + +if err := client.ExtensionsUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/client.go new file mode 100644 index 000000000000..6ae91d69535b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/client.go @@ -0,0 +1,18 @@ +package extensions + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtensionsClient struct { + Client autorest.Client + baseUri string +} + +func NewExtensionsClientWithBaseURI(endpoint string) ExtensionsClient { + return ExtensionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/constants.go new file mode 100644 index 000000000000..fc8a6c809569 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/constants.go @@ -0,0 +1,225 @@ +package extensions + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtensionAggregateState string + +const ( + ExtensionAggregateStateAccepted ExtensionAggregateState = "Accepted" + ExtensionAggregateStateCanceled ExtensionAggregateState = "Canceled" + ExtensionAggregateStateConnected ExtensionAggregateState = "Connected" + ExtensionAggregateStateCreating ExtensionAggregateState = "Creating" + ExtensionAggregateStateDeleted ExtensionAggregateState = "Deleted" + ExtensionAggregateStateDeleting ExtensionAggregateState = "Deleting" + ExtensionAggregateStateDisconnected ExtensionAggregateState = "Disconnected" + ExtensionAggregateStateError ExtensionAggregateState = "Error" + ExtensionAggregateStateFailed ExtensionAggregateState = "Failed" + ExtensionAggregateStateInProgress ExtensionAggregateState = "InProgress" + ExtensionAggregateStateMoving ExtensionAggregateState = "Moving" + ExtensionAggregateStateNotSpecified ExtensionAggregateState = "NotSpecified" + ExtensionAggregateStatePartiallyConnected ExtensionAggregateState = "PartiallyConnected" + ExtensionAggregateStatePartiallySucceeded ExtensionAggregateState = "PartiallySucceeded" + ExtensionAggregateStateProvisioning ExtensionAggregateState = "Provisioning" + ExtensionAggregateStateSucceeded ExtensionAggregateState = "Succeeded" + ExtensionAggregateStateUpdating ExtensionAggregateState = "Updating" +) + +func PossibleValuesForExtensionAggregateState() []string { + return []string{ + string(ExtensionAggregateStateAccepted), + string(ExtensionAggregateStateCanceled), + string(ExtensionAggregateStateConnected), + string(ExtensionAggregateStateCreating), + string(ExtensionAggregateStateDeleted), + string(ExtensionAggregateStateDeleting), + string(ExtensionAggregateStateDisconnected), + string(ExtensionAggregateStateError), + string(ExtensionAggregateStateFailed), + string(ExtensionAggregateStateInProgress), + string(ExtensionAggregateStateMoving), + string(ExtensionAggregateStateNotSpecified), + string(ExtensionAggregateStatePartiallyConnected), + string(ExtensionAggregateStatePartiallySucceeded), + string(ExtensionAggregateStateProvisioning), + string(ExtensionAggregateStateSucceeded), + string(ExtensionAggregateStateUpdating), + } +} + +func parseExtensionAggregateState(input string) (*ExtensionAggregateState, error) { + vals := map[string]ExtensionAggregateState{ + "accepted": ExtensionAggregateStateAccepted, + "canceled": ExtensionAggregateStateCanceled, + "connected": ExtensionAggregateStateConnected, + "creating": ExtensionAggregateStateCreating, + "deleted": ExtensionAggregateStateDeleted, + "deleting": ExtensionAggregateStateDeleting, + "disconnected": ExtensionAggregateStateDisconnected, + "error": ExtensionAggregateStateError, + "failed": ExtensionAggregateStateFailed, + "inprogress": ExtensionAggregateStateInProgress, + "moving": ExtensionAggregateStateMoving, + "notspecified": ExtensionAggregateStateNotSpecified, + "partiallyconnected": ExtensionAggregateStatePartiallyConnected, + "partiallysucceeded": ExtensionAggregateStatePartiallySucceeded, + "provisioning": ExtensionAggregateStateProvisioning, + "succeeded": ExtensionAggregateStateSucceeded, + "updating": ExtensionAggregateStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExtensionAggregateState(input) + return &out, nil +} + +type NodeExtensionState string + +const ( + NodeExtensionStateAccepted NodeExtensionState = "Accepted" + NodeExtensionStateCanceled NodeExtensionState = "Canceled" + NodeExtensionStateConnected NodeExtensionState = "Connected" + NodeExtensionStateCreating NodeExtensionState = "Creating" + NodeExtensionStateDeleted NodeExtensionState = "Deleted" + NodeExtensionStateDeleting NodeExtensionState = "Deleting" + NodeExtensionStateDisconnected NodeExtensionState = "Disconnected" + NodeExtensionStateError NodeExtensionState = "Error" + NodeExtensionStateFailed NodeExtensionState = "Failed" + NodeExtensionStateInProgress NodeExtensionState = "InProgress" + NodeExtensionStateMoving NodeExtensionState = "Moving" + NodeExtensionStateNotSpecified NodeExtensionState = "NotSpecified" + NodeExtensionStatePartiallyConnected NodeExtensionState = "PartiallyConnected" + NodeExtensionStatePartiallySucceeded NodeExtensionState = "PartiallySucceeded" + NodeExtensionStateProvisioning NodeExtensionState = "Provisioning" + NodeExtensionStateSucceeded NodeExtensionState = "Succeeded" + NodeExtensionStateUpdating NodeExtensionState = "Updating" +) + +func PossibleValuesForNodeExtensionState() []string { + return []string{ + string(NodeExtensionStateAccepted), + string(NodeExtensionStateCanceled), + string(NodeExtensionStateConnected), + string(NodeExtensionStateCreating), + string(NodeExtensionStateDeleted), + string(NodeExtensionStateDeleting), + string(NodeExtensionStateDisconnected), + string(NodeExtensionStateError), + string(NodeExtensionStateFailed), + string(NodeExtensionStateInProgress), + string(NodeExtensionStateMoving), + string(NodeExtensionStateNotSpecified), + string(NodeExtensionStatePartiallyConnected), + string(NodeExtensionStatePartiallySucceeded), + string(NodeExtensionStateProvisioning), + string(NodeExtensionStateSucceeded), + string(NodeExtensionStateUpdating), + } +} + +func parseNodeExtensionState(input string) (*NodeExtensionState, error) { + vals := map[string]NodeExtensionState{ + "accepted": NodeExtensionStateAccepted, + "canceled": NodeExtensionStateCanceled, + "connected": NodeExtensionStateConnected, + "creating": NodeExtensionStateCreating, + "deleted": NodeExtensionStateDeleted, + "deleting": NodeExtensionStateDeleting, + "disconnected": NodeExtensionStateDisconnected, + "error": NodeExtensionStateError, + "failed": NodeExtensionStateFailed, + "inprogress": NodeExtensionStateInProgress, + "moving": NodeExtensionStateMoving, + "notspecified": NodeExtensionStateNotSpecified, + "partiallyconnected": NodeExtensionStatePartiallyConnected, + "partiallysucceeded": NodeExtensionStatePartiallySucceeded, + "provisioning": NodeExtensionStateProvisioning, + "succeeded": NodeExtensionStateSucceeded, + "updating": NodeExtensionStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NodeExtensionState(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateConnected ProvisioningState = "Connected" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateDisconnected ProvisioningState = "Disconnected" + ProvisioningStateError ProvisioningState = "Error" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateInProgress ProvisioningState = "InProgress" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + ProvisioningStatePartiallyConnected ProvisioningState = "PartiallyConnected" + ProvisioningStatePartiallySucceeded ProvisioningState = "PartiallySucceeded" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateConnected), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateDisconnected), + string(ProvisioningStateError), + string(ProvisioningStateFailed), + string(ProvisioningStateInProgress), + string(ProvisioningStateMoving), + string(ProvisioningStateNotSpecified), + string(ProvisioningStatePartiallyConnected), + string(ProvisioningStatePartiallySucceeded), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "connected": ProvisioningStateConnected, + "creating": ProvisioningStateCreating, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "disconnected": ProvisioningStateDisconnected, + "error": ProvisioningStateError, + "failed": ProvisioningStateFailed, + "inprogress": ProvisioningStateInProgress, + "moving": ProvisioningStateMoving, + "notspecified": ProvisioningStateNotSpecified, + "partiallyconnected": ProvisioningStatePartiallyConnected, + "partiallysucceeded": ProvisioningStatePartiallySucceeded, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/id_arcsetting.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/id_arcsetting.go new file mode 100644 index 000000000000..06a660739818 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/id_arcsetting.go @@ -0,0 +1,137 @@ +package extensions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ArcSettingId{} + +// ArcSettingId is a struct representing the Resource ID for a Arc Setting +type ArcSettingId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + ArcSettingName string +} + +// NewArcSettingID returns a new ArcSettingId struct +func NewArcSettingID(subscriptionId string, resourceGroupName string, clusterName string, arcSettingName string) ArcSettingId { + return ArcSettingId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + ArcSettingName: arcSettingName, + } +} + +// ParseArcSettingID parses 'input' into a ArcSettingId +func ParseArcSettingID(input string) (*ArcSettingId, error) { + parser := resourceids.NewParserFromResourceIdType(ArcSettingId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ArcSettingId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { + return nil, fmt.Errorf("the segment 'arcSettingName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseArcSettingIDInsensitively parses 'input' case-insensitively into a ArcSettingId +// note: this method should only be used for API response data and not user input +func ParseArcSettingIDInsensitively(input string) (*ArcSettingId, error) { + parser := resourceids.NewParserFromResourceIdType(ArcSettingId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ArcSettingId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { + return nil, fmt.Errorf("the segment 'arcSettingName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateArcSettingID checks that 'input' can be parsed as a Arc Setting ID +func ValidateArcSettingID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseArcSettingID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Arc Setting ID +func (id ArcSettingId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s/arcSettings/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.ArcSettingName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Arc Setting ID +func (id ArcSettingId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticArcSettings", "arcSettings", "arcSettings"), + resourceids.UserSpecifiedSegment("arcSettingName", "arcSettingValue"), + } +} + +// String returns a human-readable description of this Arc Setting ID +func (id ArcSettingId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Arc Setting Name: %q", id.ArcSettingName), + } + return fmt.Sprintf("Arc Setting (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/id_extension.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/id_extension.go new file mode 100644 index 000000000000..c4c64c7b654b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/id_extension.go @@ -0,0 +1,150 @@ +package extensions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ExtensionId{} + +// ExtensionId is a struct representing the Resource ID for a Extension +type ExtensionId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + ArcSettingName string + ExtensionName string +} + +// NewExtensionID returns a new ExtensionId struct +func NewExtensionID(subscriptionId string, resourceGroupName string, clusterName string, arcSettingName string, extensionName string) ExtensionId { + return ExtensionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + ArcSettingName: arcSettingName, + ExtensionName: extensionName, + } +} + +// ParseExtensionID parses 'input' into a ExtensionId +func ParseExtensionID(input string) (*ExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(ExtensionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ExtensionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { + return nil, fmt.Errorf("the segment 'arcSettingName' was not found in the resource id %q", input) + } + + if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { + return nil, fmt.Errorf("the segment 'extensionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseExtensionIDInsensitively parses 'input' case-insensitively into a ExtensionId +// note: this method should only be used for API response data and not user input +func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(ExtensionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ExtensionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { + return nil, fmt.Errorf("the segment 'arcSettingName' was not found in the resource id %q", input) + } + + if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { + return nil, fmt.Errorf("the segment 'extensionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateExtensionID checks that 'input' can be parsed as a Extension ID +func ValidateExtensionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseExtensionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Extension ID +func (id ExtensionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s/arcSettings/%s/extensions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.ArcSettingName, id.ExtensionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Extension ID +func (id ExtensionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticArcSettings", "arcSettings", "arcSettings"), + resourceids.UserSpecifiedSegment("arcSettingName", "arcSettingValue"), + resourceids.StaticSegment("staticExtensions", "extensions", "extensions"), + resourceids.UserSpecifiedSegment("extensionName", "extensionValue"), + } +} + +// String returns a human-readable description of this Extension ID +func (id ExtensionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Arc Setting Name: %q", id.ArcSettingName), + fmt.Sprintf("Extension Name: %q", id.ExtensionName), + } + return fmt.Sprintf("Extension (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/method_extensionscreate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/method_extensionscreate_autorest.go new file mode 100644 index 000000000000..38536cec3565 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/method_extensionscreate_autorest.go @@ -0,0 +1,79 @@ +package extensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtensionsCreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ExtensionsCreate ... +func (c ExtensionsClient) ExtensionsCreate(ctx context.Context, id ExtensionId, input Extension) (result ExtensionsCreateOperationResponse, err error) { + req, err := c.preparerForExtensionsCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "extensions.ExtensionsClient", "ExtensionsCreate", nil, "Failure preparing request") + return + } + + result, err = c.senderForExtensionsCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "extensions.ExtensionsClient", "ExtensionsCreate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ExtensionsCreateThenPoll performs ExtensionsCreate then polls until it's completed +func (c ExtensionsClient) ExtensionsCreateThenPoll(ctx context.Context, id ExtensionId, input Extension) error { + result, err := c.ExtensionsCreate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ExtensionsCreate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ExtensionsCreate: %+v", err) + } + + return nil +} + +// preparerForExtensionsCreate prepares the ExtensionsCreate request. +func (c ExtensionsClient) preparerForExtensionsCreate(ctx context.Context, id ExtensionId, input Extension) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForExtensionsCreate sends the ExtensionsCreate request. The method will close the +// http.Response Body if it receives an error. +func (c ExtensionsClient) senderForExtensionsCreate(ctx context.Context, req *http.Request) (future ExtensionsCreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/method_extensionsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/method_extensionsdelete_autorest.go new file mode 100644 index 000000000000..5f3f3df88b25 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/method_extensionsdelete_autorest.go @@ -0,0 +1,78 @@ +package extensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtensionsDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ExtensionsDelete ... +func (c ExtensionsClient) ExtensionsDelete(ctx context.Context, id ExtensionId) (result ExtensionsDeleteOperationResponse, err error) { + req, err := c.preparerForExtensionsDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "extensions.ExtensionsClient", "ExtensionsDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForExtensionsDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "extensions.ExtensionsClient", "ExtensionsDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ExtensionsDeleteThenPoll performs ExtensionsDelete then polls until it's completed +func (c ExtensionsClient) ExtensionsDeleteThenPoll(ctx context.Context, id ExtensionId) error { + result, err := c.ExtensionsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ExtensionsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ExtensionsDelete: %+v", err) + } + + return nil +} + +// preparerForExtensionsDelete prepares the ExtensionsDelete request. +func (c ExtensionsClient) preparerForExtensionsDelete(ctx context.Context, id ExtensionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForExtensionsDelete sends the ExtensionsDelete request. The method will close the +// http.Response Body if it receives an error. +func (c ExtensionsClient) senderForExtensionsDelete(ctx context.Context, req *http.Request) (future ExtensionsDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/method_extensionsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/method_extensionsget_autorest.go new file mode 100644 index 000000000000..d0712670e619 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/method_extensionsget_autorest.go @@ -0,0 +1,68 @@ +package extensions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtensionsGetOperationResponse struct { + HttpResponse *http.Response + Model *Extension +} + +// ExtensionsGet ... +func (c ExtensionsClient) ExtensionsGet(ctx context.Context, id ExtensionId) (result ExtensionsGetOperationResponse, err error) { + req, err := c.preparerForExtensionsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "extensions.ExtensionsClient", "ExtensionsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "extensions.ExtensionsClient", "ExtensionsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForExtensionsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "extensions.ExtensionsClient", "ExtensionsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForExtensionsGet prepares the ExtensionsGet request. +func (c ExtensionsClient) preparerForExtensionsGet(ctx context.Context, id ExtensionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForExtensionsGet handles the response to the ExtensionsGet request. The method always +// closes the http.Response Body. +func (c ExtensionsClient) responderForExtensionsGet(resp *http.Response) (result ExtensionsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/method_extensionslistbyarcsetting_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/method_extensionslistbyarcsetting_autorest.go new file mode 100644 index 000000000000..ee295930db15 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/method_extensionslistbyarcsetting_autorest.go @@ -0,0 +1,186 @@ +package extensions + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtensionsListByArcSettingOperationResponse struct { + HttpResponse *http.Response + Model *[]Extension + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ExtensionsListByArcSettingOperationResponse, error) +} + +type ExtensionsListByArcSettingCompleteResult struct { + Items []Extension +} + +func (r ExtensionsListByArcSettingOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ExtensionsListByArcSettingOperationResponse) LoadMore(ctx context.Context) (resp ExtensionsListByArcSettingOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ExtensionsListByArcSetting ... +func (c ExtensionsClient) ExtensionsListByArcSetting(ctx context.Context, id ArcSettingId) (resp ExtensionsListByArcSettingOperationResponse, err error) { + req, err := c.preparerForExtensionsListByArcSetting(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "extensions.ExtensionsClient", "ExtensionsListByArcSetting", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "extensions.ExtensionsClient", "ExtensionsListByArcSetting", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForExtensionsListByArcSetting(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "extensions.ExtensionsClient", "ExtensionsListByArcSetting", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForExtensionsListByArcSetting prepares the ExtensionsListByArcSetting request. +func (c ExtensionsClient) preparerForExtensionsListByArcSetting(ctx context.Context, id ArcSettingId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/extensions", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForExtensionsListByArcSettingWithNextLink prepares the ExtensionsListByArcSetting request with the given nextLink token. +func (c ExtensionsClient) preparerForExtensionsListByArcSettingWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForExtensionsListByArcSetting handles the response to the ExtensionsListByArcSetting request. The method always +// closes the http.Response Body. +func (c ExtensionsClient) responderForExtensionsListByArcSetting(resp *http.Response) (result ExtensionsListByArcSettingOperationResponse, err error) { + type page struct { + Values []Extension `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ExtensionsListByArcSettingOperationResponse, err error) { + req, err := c.preparerForExtensionsListByArcSettingWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "extensions.ExtensionsClient", "ExtensionsListByArcSetting", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "extensions.ExtensionsClient", "ExtensionsListByArcSetting", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForExtensionsListByArcSetting(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "extensions.ExtensionsClient", "ExtensionsListByArcSetting", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ExtensionsListByArcSettingComplete retrieves all of the results into a single object +func (c ExtensionsClient) ExtensionsListByArcSettingComplete(ctx context.Context, id ArcSettingId) (ExtensionsListByArcSettingCompleteResult, error) { + return c.ExtensionsListByArcSettingCompleteMatchingPredicate(ctx, id, ExtensionOperationPredicate{}) +} + +// ExtensionsListByArcSettingCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ExtensionsClient) ExtensionsListByArcSettingCompleteMatchingPredicate(ctx context.Context, id ArcSettingId, predicate ExtensionOperationPredicate) (resp ExtensionsListByArcSettingCompleteResult, err error) { + items := make([]Extension, 0) + + page, err := c.ExtensionsListByArcSetting(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ExtensionsListByArcSettingCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/method_extensionsupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/method_extensionsupdate_autorest.go new file mode 100644 index 000000000000..3d87dfbf8909 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/method_extensionsupdate_autorest.go @@ -0,0 +1,79 @@ +package extensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtensionsUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ExtensionsUpdate ... +func (c ExtensionsClient) ExtensionsUpdate(ctx context.Context, id ExtensionId, input Extension) (result ExtensionsUpdateOperationResponse, err error) { + req, err := c.preparerForExtensionsUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "extensions.ExtensionsClient", "ExtensionsUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForExtensionsUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "extensions.ExtensionsClient", "ExtensionsUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ExtensionsUpdateThenPoll performs ExtensionsUpdate then polls until it's completed +func (c ExtensionsClient) ExtensionsUpdateThenPoll(ctx context.Context, id ExtensionId, input Extension) error { + result, err := c.ExtensionsUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ExtensionsUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ExtensionsUpdate: %+v", err) + } + + return nil +} + +// preparerForExtensionsUpdate prepares the ExtensionsUpdate request. +func (c ExtensionsClient) preparerForExtensionsUpdate(ctx context.Context, id ExtensionId, input Extension) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForExtensionsUpdate sends the ExtensionsUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ExtensionsClient) senderForExtensionsUpdate(ctx context.Context, req *http.Request) (future ExtensionsUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/model_extension.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/model_extension.go new file mode 100644 index 000000000000..7979b4827b54 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/model_extension.go @@ -0,0 +1,16 @@ +package extensions + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Extension struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ExtensionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/model_extensionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/model_extensionparameters.go new file mode 100644 index 000000000000..b267acba8cc1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/model_extensionparameters.go @@ -0,0 +1,15 @@ +package extensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtensionParameters struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/model_extensionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/model_extensionproperties.go new file mode 100644 index 000000000000..51c694021d5c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/model_extensionproperties.go @@ -0,0 +1,11 @@ +package extensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtensionProperties struct { + AggregateState *ExtensionAggregateState `json:"aggregateState,omitempty"` + ExtensionParameters *ExtensionParameters `json:"extensionParameters,omitempty"` + PerNodeExtensionDetails *[]PerNodeExtensionState `json:"perNodeExtensionDetails,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/model_pernodeextensionstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/model_pernodeextensionstate.go new file mode 100644 index 000000000000..d4f8a06ad454 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/model_pernodeextensionstate.go @@ -0,0 +1,10 @@ +package extensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PerNodeExtensionState struct { + Extension *string `json:"extension,omitempty"` + Name *string `json:"name,omitempty"` + State *NodeExtensionState `json:"state,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/predicates.go new file mode 100644 index 000000000000..3a9a0c845a52 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/predicates.go @@ -0,0 +1,24 @@ +package extensions + +type ExtensionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ExtensionOperationPredicate) Matches(input Extension) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/version.go new file mode 100644 index 000000000000..327f1e456acc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions/version.go @@ -0,0 +1,12 @@ +package extensions + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/extensions/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/README.md new file mode 100644 index 000000000000..3e8dcf319d60 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/README.md @@ -0,0 +1,70 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers` Documentation + +The `offers` SDK allows for interaction with the Azure Resource Manager Service `azurestackhci` (API Version `2022-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers" +``` + + +### Client Initialization + +```go +client := offers.NewOffersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `OffersClient.OffersGet` + +```go +ctx := context.TODO() +id := offers.NewOfferID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "publisherValue", "offerValue") + +read, err := client.OffersGet(ctx, id, offers.DefaultOffersGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `OffersClient.OffersListByCluster` + +```go +ctx := context.TODO() +id := offers.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +// alternatively `client.OffersListByCluster(ctx, id, offers.DefaultOffersListByClusterOperationOptions())` can be used to do batched pagination +items, err := client.OffersListByClusterComplete(ctx, id, offers.DefaultOffersListByClusterOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `OffersClient.OffersListByPublisher` + +```go +ctx := context.TODO() +id := offers.NewPublisherID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "publisherValue") + +// alternatively `client.OffersListByPublisher(ctx, id, offers.DefaultOffersListByPublisherOperationOptions())` can be used to do batched pagination +items, err := client.OffersListByPublisherComplete(ctx, id, offers.DefaultOffersListByPublisherOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/client.go new file mode 100644 index 000000000000..8d555d91c2cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/client.go @@ -0,0 +1,18 @@ +package offers + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OffersClient struct { + Client autorest.Client + baseUri string +} + +func NewOffersClientWithBaseURI(endpoint string) OffersClient { + return OffersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/id_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/id_cluster.go new file mode 100644 index 000000000000..3eb3dfb6f919 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/id_cluster.go @@ -0,0 +1,124 @@ +package offers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ClusterId{} + +// ClusterId is a struct representing the Resource ID for a Cluster +type ClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewClusterID returns a new ClusterId struct +func NewClusterID(subscriptionId string, resourceGroupName string, clusterName string) ClusterId { + return ClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseClusterID parses 'input' into a ClusterId +func ParseClusterID(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseClusterIDInsensitively parses 'input' case-insensitively into a ClusterId +// note: this method should only be used for API response data and not user input +func ParseClusterIDInsensitively(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateClusterID checks that 'input' can be parsed as a Cluster ID +func ValidateClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cluster ID +func (id ClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cluster ID +func (id ClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Cluster ID +func (id ClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/id_offer.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/id_offer.go new file mode 100644 index 000000000000..df52ee954101 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/id_offer.go @@ -0,0 +1,150 @@ +package offers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = OfferId{} + +// OfferId is a struct representing the Resource ID for a Offer +type OfferId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + PublisherName string + OfferName string +} + +// NewOfferID returns a new OfferId struct +func NewOfferID(subscriptionId string, resourceGroupName string, clusterName string, publisherName string, offerName string) OfferId { + return OfferId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + PublisherName: publisherName, + OfferName: offerName, + } +} + +// ParseOfferID parses 'input' into a OfferId +func ParseOfferID(input string) (*OfferId, error) { + parser := resourceids.NewParserFromResourceIdType(OfferId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OfferId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { + return nil, fmt.Errorf("the segment 'publisherName' was not found in the resource id %q", input) + } + + if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { + return nil, fmt.Errorf("the segment 'offerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseOfferIDInsensitively parses 'input' case-insensitively into a OfferId +// note: this method should only be used for API response data and not user input +func ParseOfferIDInsensitively(input string) (*OfferId, error) { + parser := resourceids.NewParserFromResourceIdType(OfferId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OfferId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { + return nil, fmt.Errorf("the segment 'publisherName' was not found in the resource id %q", input) + } + + if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { + return nil, fmt.Errorf("the segment 'offerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateOfferID checks that 'input' can be parsed as a Offer ID +func ValidateOfferID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseOfferID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Offer ID +func (id OfferId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s/publishers/%s/offers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.PublisherName, id.OfferName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Offer ID +func (id OfferId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherValue"), + resourceids.StaticSegment("staticOffers", "offers", "offers"), + resourceids.UserSpecifiedSegment("offerName", "offerValue"), + } +} + +// String returns a human-readable description of this Offer ID +func (id OfferId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Offer Name: %q", id.OfferName), + } + return fmt.Sprintf("Offer (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/id_publisher.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/id_publisher.go new file mode 100644 index 000000000000..437876e96e30 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/id_publisher.go @@ -0,0 +1,137 @@ +package offers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PublisherId{} + +// PublisherId is a struct representing the Resource ID for a Publisher +type PublisherId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + PublisherName string +} + +// NewPublisherID returns a new PublisherId struct +func NewPublisherID(subscriptionId string, resourceGroupName string, clusterName string, publisherName string) PublisherId { + return PublisherId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + PublisherName: publisherName, + } +} + +// ParsePublisherID parses 'input' into a PublisherId +func ParsePublisherID(input string) (*PublisherId, error) { + parser := resourceids.NewParserFromResourceIdType(PublisherId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PublisherId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { + return nil, fmt.Errorf("the segment 'publisherName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePublisherIDInsensitively parses 'input' case-insensitively into a PublisherId +// note: this method should only be used for API response data and not user input +func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { + parser := resourceids.NewParserFromResourceIdType(PublisherId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PublisherId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { + return nil, fmt.Errorf("the segment 'publisherName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePublisherID checks that 'input' can be parsed as a Publisher ID +func ValidatePublisherID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePublisherID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Publisher ID +func (id PublisherId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s/publishers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.PublisherName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Publisher ID +func (id PublisherId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherValue"), + } +} + +// String returns a human-readable description of this Publisher ID +func (id PublisherId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + } + return fmt.Sprintf("Publisher (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/method_offersget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/method_offersget_autorest.go new file mode 100644 index 000000000000..87606b3b2e0e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/method_offersget_autorest.go @@ -0,0 +1,97 @@ +package offers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OffersGetOperationResponse struct { + HttpResponse *http.Response + Model *Offer +} + +type OffersGetOperationOptions struct { + Expand *string +} + +func DefaultOffersGetOperationOptions() OffersGetOperationOptions { + return OffersGetOperationOptions{} +} + +func (o OffersGetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o OffersGetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// OffersGet ... +func (c OffersClient) OffersGet(ctx context.Context, id OfferId, options OffersGetOperationOptions) (result OffersGetOperationResponse, err error) { + req, err := c.preparerForOffersGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "offers.OffersClient", "OffersGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "offers.OffersClient", "OffersGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForOffersGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "offers.OffersClient", "OffersGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForOffersGet prepares the OffersGet request. +func (c OffersClient) preparerForOffersGet(ctx context.Context, id OfferId, options OffersGetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForOffersGet handles the response to the OffersGet request. The method always +// closes the http.Response Body. +func (c OffersClient) responderForOffersGet(resp *http.Response) (result OffersGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/method_offerslistbycluster_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/method_offerslistbycluster_autorest.go new file mode 100644 index 000000000000..bb037c1919b4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/method_offerslistbycluster_autorest.go @@ -0,0 +1,215 @@ +package offers + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OffersListByClusterOperationResponse struct { + HttpResponse *http.Response + Model *[]Offer + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (OffersListByClusterOperationResponse, error) +} + +type OffersListByClusterCompleteResult struct { + Items []Offer +} + +func (r OffersListByClusterOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r OffersListByClusterOperationResponse) LoadMore(ctx context.Context) (resp OffersListByClusterOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type OffersListByClusterOperationOptions struct { + Expand *string +} + +func DefaultOffersListByClusterOperationOptions() OffersListByClusterOperationOptions { + return OffersListByClusterOperationOptions{} +} + +func (o OffersListByClusterOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o OffersListByClusterOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// OffersListByCluster ... +func (c OffersClient) OffersListByCluster(ctx context.Context, id ClusterId, options OffersListByClusterOperationOptions) (resp OffersListByClusterOperationResponse, err error) { + req, err := c.preparerForOffersListByCluster(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "offers.OffersClient", "OffersListByCluster", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "offers.OffersClient", "OffersListByCluster", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForOffersListByCluster(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "offers.OffersClient", "OffersListByCluster", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForOffersListByCluster prepares the OffersListByCluster request. +func (c OffersClient) preparerForOffersListByCluster(ctx context.Context, id ClusterId, options OffersListByClusterOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/offers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForOffersListByClusterWithNextLink prepares the OffersListByCluster request with the given nextLink token. +func (c OffersClient) preparerForOffersListByClusterWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForOffersListByCluster handles the response to the OffersListByCluster request. The method always +// closes the http.Response Body. +func (c OffersClient) responderForOffersListByCluster(resp *http.Response) (result OffersListByClusterOperationResponse, err error) { + type page struct { + Values []Offer `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result OffersListByClusterOperationResponse, err error) { + req, err := c.preparerForOffersListByClusterWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "offers.OffersClient", "OffersListByCluster", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "offers.OffersClient", "OffersListByCluster", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForOffersListByCluster(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "offers.OffersClient", "OffersListByCluster", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// OffersListByClusterComplete retrieves all of the results into a single object +func (c OffersClient) OffersListByClusterComplete(ctx context.Context, id ClusterId, options OffersListByClusterOperationOptions) (OffersListByClusterCompleteResult, error) { + return c.OffersListByClusterCompleteMatchingPredicate(ctx, id, options, OfferOperationPredicate{}) +} + +// OffersListByClusterCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c OffersClient) OffersListByClusterCompleteMatchingPredicate(ctx context.Context, id ClusterId, options OffersListByClusterOperationOptions, predicate OfferOperationPredicate) (resp OffersListByClusterCompleteResult, err error) { + items := make([]Offer, 0) + + page, err := c.OffersListByCluster(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := OffersListByClusterCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/method_offerslistbypublisher_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/method_offerslistbypublisher_autorest.go new file mode 100644 index 000000000000..38f890e555c5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/method_offerslistbypublisher_autorest.go @@ -0,0 +1,215 @@ +package offers + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OffersListByPublisherOperationResponse struct { + HttpResponse *http.Response + Model *[]Offer + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (OffersListByPublisherOperationResponse, error) +} + +type OffersListByPublisherCompleteResult struct { + Items []Offer +} + +func (r OffersListByPublisherOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r OffersListByPublisherOperationResponse) LoadMore(ctx context.Context) (resp OffersListByPublisherOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type OffersListByPublisherOperationOptions struct { + Expand *string +} + +func DefaultOffersListByPublisherOperationOptions() OffersListByPublisherOperationOptions { + return OffersListByPublisherOperationOptions{} +} + +func (o OffersListByPublisherOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o OffersListByPublisherOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// OffersListByPublisher ... +func (c OffersClient) OffersListByPublisher(ctx context.Context, id PublisherId, options OffersListByPublisherOperationOptions) (resp OffersListByPublisherOperationResponse, err error) { + req, err := c.preparerForOffersListByPublisher(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "offers.OffersClient", "OffersListByPublisher", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "offers.OffersClient", "OffersListByPublisher", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForOffersListByPublisher(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "offers.OffersClient", "OffersListByPublisher", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForOffersListByPublisher prepares the OffersListByPublisher request. +func (c OffersClient) preparerForOffersListByPublisher(ctx context.Context, id PublisherId, options OffersListByPublisherOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/offers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForOffersListByPublisherWithNextLink prepares the OffersListByPublisher request with the given nextLink token. +func (c OffersClient) preparerForOffersListByPublisherWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForOffersListByPublisher handles the response to the OffersListByPublisher request. The method always +// closes the http.Response Body. +func (c OffersClient) responderForOffersListByPublisher(resp *http.Response) (result OffersListByPublisherOperationResponse, err error) { + type page struct { + Values []Offer `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result OffersListByPublisherOperationResponse, err error) { + req, err := c.preparerForOffersListByPublisherWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "offers.OffersClient", "OffersListByPublisher", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "offers.OffersClient", "OffersListByPublisher", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForOffersListByPublisher(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "offers.OffersClient", "OffersListByPublisher", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// OffersListByPublisherComplete retrieves all of the results into a single object +func (c OffersClient) OffersListByPublisherComplete(ctx context.Context, id PublisherId, options OffersListByPublisherOperationOptions) (OffersListByPublisherCompleteResult, error) { + return c.OffersListByPublisherCompleteMatchingPredicate(ctx, id, options, OfferOperationPredicate{}) +} + +// OffersListByPublisherCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c OffersClient) OffersListByPublisherCompleteMatchingPredicate(ctx context.Context, id PublisherId, options OffersListByPublisherOperationOptions, predicate OfferOperationPredicate) (resp OffersListByPublisherCompleteResult, err error) { + items := make([]Offer, 0) + + page, err := c.OffersListByPublisher(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := OffersListByPublisherCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/model_offer.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/model_offer.go new file mode 100644 index 000000000000..e2c246d643b2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/model_offer.go @@ -0,0 +1,16 @@ +package offers + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Offer struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *OfferProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/model_offerproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/model_offerproperties.go new file mode 100644 index 000000000000..a53c23229aad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/model_offerproperties.go @@ -0,0 +1,12 @@ +package offers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OfferProperties struct { + Content *string `json:"content,omitempty"` + ContentVersion *string `json:"contentVersion,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + PublisherId *string `json:"publisherId,omitempty"` + SkuMappings *[]SkuMappings `json:"skuMappings,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/model_skumappings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/model_skumappings.go new file mode 100644 index 000000000000..a2c8233a1218 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/model_skumappings.go @@ -0,0 +1,10 @@ +package offers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuMappings struct { + CatalogPlanId *string `json:"catalogPlanId,omitempty"` + MarketplaceSkuId *string `json:"marketplaceSkuId,omitempty"` + MarketplaceSkuVersions *[]string `json:"marketplaceSkuVersions,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/predicates.go new file mode 100644 index 000000000000..28637c7c72d5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/predicates.go @@ -0,0 +1,24 @@ +package offers + +type OfferOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p OfferOperationPredicate) Matches(input Offer) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/version.go new file mode 100644 index 000000000000..af3f22513d8e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers/version.go @@ -0,0 +1,12 @@ +package offers + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/offers/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/README.md new file mode 100644 index 000000000000..09128c32e4db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers` Documentation + +The `publishers` SDK allows for interaction with the Azure Resource Manager Service `azurestackhci` (API Version `2022-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers" +``` + + +### Client Initialization + +```go +client := publishers.NewPublishersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PublishersClient.PublishersGet` + +```go +ctx := context.TODO() +id := publishers.NewPublisherID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "publisherValue") + +read, err := client.PublishersGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PublishersClient.PublishersListByCluster` + +```go +ctx := context.TODO() +id := publishers.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +// alternatively `client.PublishersListByCluster(ctx, id)` can be used to do batched pagination +items, err := client.PublishersListByClusterComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/client.go new file mode 100644 index 000000000000..c12edf93c644 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/client.go @@ -0,0 +1,18 @@ +package publishers + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublishersClient struct { + Client autorest.Client + baseUri string +} + +func NewPublishersClientWithBaseURI(endpoint string) PublishersClient { + return PublishersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/id_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/id_cluster.go new file mode 100644 index 000000000000..05fa5664de14 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/id_cluster.go @@ -0,0 +1,124 @@ +package publishers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ClusterId{} + +// ClusterId is a struct representing the Resource ID for a Cluster +type ClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewClusterID returns a new ClusterId struct +func NewClusterID(subscriptionId string, resourceGroupName string, clusterName string) ClusterId { + return ClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseClusterID parses 'input' into a ClusterId +func ParseClusterID(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseClusterIDInsensitively parses 'input' case-insensitively into a ClusterId +// note: this method should only be used for API response data and not user input +func ParseClusterIDInsensitively(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateClusterID checks that 'input' can be parsed as a Cluster ID +func ValidateClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cluster ID +func (id ClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cluster ID +func (id ClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Cluster ID +func (id ClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/id_publisher.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/id_publisher.go new file mode 100644 index 000000000000..524a2ad86091 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/id_publisher.go @@ -0,0 +1,137 @@ +package publishers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PublisherId{} + +// PublisherId is a struct representing the Resource ID for a Publisher +type PublisherId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + PublisherName string +} + +// NewPublisherID returns a new PublisherId struct +func NewPublisherID(subscriptionId string, resourceGroupName string, clusterName string, publisherName string) PublisherId { + return PublisherId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + PublisherName: publisherName, + } +} + +// ParsePublisherID parses 'input' into a PublisherId +func ParsePublisherID(input string) (*PublisherId, error) { + parser := resourceids.NewParserFromResourceIdType(PublisherId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PublisherId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { + return nil, fmt.Errorf("the segment 'publisherName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePublisherIDInsensitively parses 'input' case-insensitively into a PublisherId +// note: this method should only be used for API response data and not user input +func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { + parser := resourceids.NewParserFromResourceIdType(PublisherId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PublisherId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { + return nil, fmt.Errorf("the segment 'publisherName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePublisherID checks that 'input' can be parsed as a Publisher ID +func ValidatePublisherID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePublisherID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Publisher ID +func (id PublisherId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s/publishers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.PublisherName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Publisher ID +func (id PublisherId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherValue"), + } +} + +// String returns a human-readable description of this Publisher ID +func (id PublisherId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + } + return fmt.Sprintf("Publisher (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/method_publishersget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/method_publishersget_autorest.go new file mode 100644 index 000000000000..9e6fd2e7ce34 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/method_publishersget_autorest.go @@ -0,0 +1,68 @@ +package publishers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublishersGetOperationResponse struct { + HttpResponse *http.Response + Model *Publisher +} + +// PublishersGet ... +func (c PublishersClient) PublishersGet(ctx context.Context, id PublisherId) (result PublishersGetOperationResponse, err error) { + req, err := c.preparerForPublishersGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "publishers.PublishersClient", "PublishersGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "publishers.PublishersClient", "PublishersGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPublishersGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "publishers.PublishersClient", "PublishersGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPublishersGet prepares the PublishersGet request. +func (c PublishersClient) preparerForPublishersGet(ctx context.Context, id PublisherId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPublishersGet handles the response to the PublishersGet request. The method always +// closes the http.Response Body. +func (c PublishersClient) responderForPublishersGet(resp *http.Response) (result PublishersGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/method_publisherslistbycluster_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/method_publisherslistbycluster_autorest.go new file mode 100644 index 000000000000..339158b25e8e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/method_publisherslistbycluster_autorest.go @@ -0,0 +1,186 @@ +package publishers + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublishersListByClusterOperationResponse struct { + HttpResponse *http.Response + Model *[]Publisher + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (PublishersListByClusterOperationResponse, error) +} + +type PublishersListByClusterCompleteResult struct { + Items []Publisher +} + +func (r PublishersListByClusterOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r PublishersListByClusterOperationResponse) LoadMore(ctx context.Context) (resp PublishersListByClusterOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// PublishersListByCluster ... +func (c PublishersClient) PublishersListByCluster(ctx context.Context, id ClusterId) (resp PublishersListByClusterOperationResponse, err error) { + req, err := c.preparerForPublishersListByCluster(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "publishers.PublishersClient", "PublishersListByCluster", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "publishers.PublishersClient", "PublishersListByCluster", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForPublishersListByCluster(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "publishers.PublishersClient", "PublishersListByCluster", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForPublishersListByCluster prepares the PublishersListByCluster request. +func (c PublishersClient) preparerForPublishersListByCluster(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/publishers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForPublishersListByClusterWithNextLink prepares the PublishersListByCluster request with the given nextLink token. +func (c PublishersClient) preparerForPublishersListByClusterWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPublishersListByCluster handles the response to the PublishersListByCluster request. The method always +// closes the http.Response Body. +func (c PublishersClient) responderForPublishersListByCluster(resp *http.Response) (result PublishersListByClusterOperationResponse, err error) { + type page struct { + Values []Publisher `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result PublishersListByClusterOperationResponse, err error) { + req, err := c.preparerForPublishersListByClusterWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "publishers.PublishersClient", "PublishersListByCluster", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "publishers.PublishersClient", "PublishersListByCluster", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPublishersListByCluster(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "publishers.PublishersClient", "PublishersListByCluster", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// PublishersListByClusterComplete retrieves all of the results into a single object +func (c PublishersClient) PublishersListByClusterComplete(ctx context.Context, id ClusterId) (PublishersListByClusterCompleteResult, error) { + return c.PublishersListByClusterCompleteMatchingPredicate(ctx, id, PublisherOperationPredicate{}) +} + +// PublishersListByClusterCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PublishersClient) PublishersListByClusterCompleteMatchingPredicate(ctx context.Context, id ClusterId, predicate PublisherOperationPredicate) (resp PublishersListByClusterCompleteResult, err error) { + items := make([]Publisher, 0) + + page, err := c.PublishersListByCluster(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := PublishersListByClusterCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/model_publisher.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/model_publisher.go new file mode 100644 index 000000000000..70fef995140f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/model_publisher.go @@ -0,0 +1,16 @@ +package publishers + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Publisher struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PublisherProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/model_publisherproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/model_publisherproperties.go new file mode 100644 index 000000000000..7aa30888f266 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/model_publisherproperties.go @@ -0,0 +1,8 @@ +package publishers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublisherProperties struct { + ProvisioningState *string `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/predicates.go new file mode 100644 index 000000000000..2e92a1367dab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/predicates.go @@ -0,0 +1,24 @@ +package publishers + +type PublisherOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p PublisherOperationPredicate) Matches(input Publisher) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/version.go new file mode 100644 index 000000000000..59a3abe6cb9c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers/version.go @@ -0,0 +1,12 @@ +package publishers + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/publishers/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/README.md new file mode 100644 index 000000000000..b80cdc0b1f86 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses` Documentation + +The `skuses` SDK allows for interaction with the Azure Resource Manager Service `azurestackhci` (API Version `2022-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses" +``` + + +### Client Initialization + +```go +client := skuses.NewSkusesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SkusesClient.SkusGet` + +```go +ctx := context.TODO() +id := skuses.NewSkuID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "publisherValue", "offerValue", "skuValue") + +read, err := client.SkusGet(ctx, id, skuses.DefaultSkusGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SkusesClient.SkusListByOffer` + +```go +ctx := context.TODO() +id := skuses.NewOfferID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "publisherValue", "offerValue") + +// alternatively `client.SkusListByOffer(ctx, id, skuses.DefaultSkusListByOfferOperationOptions())` can be used to do batched pagination +items, err := client.SkusListByOfferComplete(ctx, id, skuses.DefaultSkusListByOfferOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/client.go new file mode 100644 index 000000000000..62de152414d1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/client.go @@ -0,0 +1,18 @@ +package skuses + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkusesClient struct { + Client autorest.Client + baseUri string +} + +func NewSkusesClientWithBaseURI(endpoint string) SkusesClient { + return SkusesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/id_offer.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/id_offer.go new file mode 100644 index 000000000000..658f247e59fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/id_offer.go @@ -0,0 +1,150 @@ +package skuses + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = OfferId{} + +// OfferId is a struct representing the Resource ID for a Offer +type OfferId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + PublisherName string + OfferName string +} + +// NewOfferID returns a new OfferId struct +func NewOfferID(subscriptionId string, resourceGroupName string, clusterName string, publisherName string, offerName string) OfferId { + return OfferId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + PublisherName: publisherName, + OfferName: offerName, + } +} + +// ParseOfferID parses 'input' into a OfferId +func ParseOfferID(input string) (*OfferId, error) { + parser := resourceids.NewParserFromResourceIdType(OfferId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OfferId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { + return nil, fmt.Errorf("the segment 'publisherName' was not found in the resource id %q", input) + } + + if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { + return nil, fmt.Errorf("the segment 'offerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseOfferIDInsensitively parses 'input' case-insensitively into a OfferId +// note: this method should only be used for API response data and not user input +func ParseOfferIDInsensitively(input string) (*OfferId, error) { + parser := resourceids.NewParserFromResourceIdType(OfferId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OfferId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { + return nil, fmt.Errorf("the segment 'publisherName' was not found in the resource id %q", input) + } + + if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { + return nil, fmt.Errorf("the segment 'offerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateOfferID checks that 'input' can be parsed as a Offer ID +func ValidateOfferID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseOfferID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Offer ID +func (id OfferId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s/publishers/%s/offers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.PublisherName, id.OfferName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Offer ID +func (id OfferId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherValue"), + resourceids.StaticSegment("staticOffers", "offers", "offers"), + resourceids.UserSpecifiedSegment("offerName", "offerValue"), + } +} + +// String returns a human-readable description of this Offer ID +func (id OfferId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Offer Name: %q", id.OfferName), + } + return fmt.Sprintf("Offer (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/id_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/id_sku.go new file mode 100644 index 000000000000..5bcb085dd02a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/id_sku.go @@ -0,0 +1,163 @@ +package skuses + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SkuId{} + +// SkuId is a struct representing the Resource ID for a Sku +type SkuId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + PublisherName string + OfferName string + SkuName string +} + +// NewSkuID returns a new SkuId struct +func NewSkuID(subscriptionId string, resourceGroupName string, clusterName string, publisherName string, offerName string, skuName string) SkuId { + return SkuId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + PublisherName: publisherName, + OfferName: offerName, + SkuName: skuName, + } +} + +// ParseSkuID parses 'input' into a SkuId +func ParseSkuID(input string) (*SkuId, error) { + parser := resourceids.NewParserFromResourceIdType(SkuId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SkuId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { + return nil, fmt.Errorf("the segment 'publisherName' was not found in the resource id %q", input) + } + + if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { + return nil, fmt.Errorf("the segment 'offerName' was not found in the resource id %q", input) + } + + if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { + return nil, fmt.Errorf("the segment 'skuName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSkuIDInsensitively parses 'input' case-insensitively into a SkuId +// note: this method should only be used for API response data and not user input +func ParseSkuIDInsensitively(input string) (*SkuId, error) { + parser := resourceids.NewParserFromResourceIdType(SkuId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SkuId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { + return nil, fmt.Errorf("the segment 'publisherName' was not found in the resource id %q", input) + } + + if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { + return nil, fmt.Errorf("the segment 'offerName' was not found in the resource id %q", input) + } + + if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { + return nil, fmt.Errorf("the segment 'skuName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSkuID checks that 'input' can be parsed as a Sku ID +func ValidateSkuID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSkuID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sku ID +func (id SkuId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s/publishers/%s/offers/%s/skus/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.PublisherName, id.OfferName, id.SkuName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sku ID +func (id SkuId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherValue"), + resourceids.StaticSegment("staticOffers", "offers", "offers"), + resourceids.UserSpecifiedSegment("offerName", "offerValue"), + resourceids.StaticSegment("staticSkus", "skus", "skus"), + resourceids.UserSpecifiedSegment("skuName", "skuValue"), + } +} + +// String returns a human-readable description of this Sku ID +func (id SkuId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Offer Name: %q", id.OfferName), + fmt.Sprintf("Sku Name: %q", id.SkuName), + } + return fmt.Sprintf("Sku (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/method_skusget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/method_skusget_autorest.go new file mode 100644 index 000000000000..271ecfcaaf15 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/method_skusget_autorest.go @@ -0,0 +1,97 @@ +package skuses + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkusGetOperationResponse struct { + HttpResponse *http.Response + Model *Sku +} + +type SkusGetOperationOptions struct { + Expand *string +} + +func DefaultSkusGetOperationOptions() SkusGetOperationOptions { + return SkusGetOperationOptions{} +} + +func (o SkusGetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o SkusGetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// SkusGet ... +func (c SkusesClient) SkusGet(ctx context.Context, id SkuId, options SkusGetOperationOptions) (result SkusGetOperationResponse, err error) { + req, err := c.preparerForSkusGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "skuses.SkusesClient", "SkusGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "skuses.SkusesClient", "SkusGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSkusGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "skuses.SkusesClient", "SkusGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSkusGet prepares the SkusGet request. +func (c SkusesClient) preparerForSkusGet(ctx context.Context, id SkuId, options SkusGetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSkusGet handles the response to the SkusGet request. The method always +// closes the http.Response Body. +func (c SkusesClient) responderForSkusGet(resp *http.Response) (result SkusGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/method_skuslistbyoffer_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/method_skuslistbyoffer_autorest.go new file mode 100644 index 000000000000..71489692907d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/method_skuslistbyoffer_autorest.go @@ -0,0 +1,215 @@ +package skuses + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkusListByOfferOperationResponse struct { + HttpResponse *http.Response + Model *[]Sku + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (SkusListByOfferOperationResponse, error) +} + +type SkusListByOfferCompleteResult struct { + Items []Sku +} + +func (r SkusListByOfferOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r SkusListByOfferOperationResponse) LoadMore(ctx context.Context) (resp SkusListByOfferOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type SkusListByOfferOperationOptions struct { + Expand *string +} + +func DefaultSkusListByOfferOperationOptions() SkusListByOfferOperationOptions { + return SkusListByOfferOperationOptions{} +} + +func (o SkusListByOfferOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o SkusListByOfferOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// SkusListByOffer ... +func (c SkusesClient) SkusListByOffer(ctx context.Context, id OfferId, options SkusListByOfferOperationOptions) (resp SkusListByOfferOperationResponse, err error) { + req, err := c.preparerForSkusListByOffer(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "skuses.SkusesClient", "SkusListByOffer", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "skuses.SkusesClient", "SkusListByOffer", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForSkusListByOffer(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "skuses.SkusesClient", "SkusListByOffer", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForSkusListByOffer prepares the SkusListByOffer request. +func (c SkusesClient) preparerForSkusListByOffer(ctx context.Context, id OfferId, options SkusListByOfferOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/skus", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForSkusListByOfferWithNextLink prepares the SkusListByOffer request with the given nextLink token. +func (c SkusesClient) preparerForSkusListByOfferWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSkusListByOffer handles the response to the SkusListByOffer request. The method always +// closes the http.Response Body. +func (c SkusesClient) responderForSkusListByOffer(resp *http.Response) (result SkusListByOfferOperationResponse, err error) { + type page struct { + Values []Sku `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result SkusListByOfferOperationResponse, err error) { + req, err := c.preparerForSkusListByOfferWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "skuses.SkusesClient", "SkusListByOffer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "skuses.SkusesClient", "SkusListByOffer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSkusListByOffer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "skuses.SkusesClient", "SkusListByOffer", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// SkusListByOfferComplete retrieves all of the results into a single object +func (c SkusesClient) SkusListByOfferComplete(ctx context.Context, id OfferId, options SkusListByOfferOperationOptions) (SkusListByOfferCompleteResult, error) { + return c.SkusListByOfferCompleteMatchingPredicate(ctx, id, options, SkuOperationPredicate{}) +} + +// SkusListByOfferCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SkusesClient) SkusListByOfferCompleteMatchingPredicate(ctx context.Context, id OfferId, options SkusListByOfferOperationOptions, predicate SkuOperationPredicate) (resp SkusListByOfferCompleteResult, err error) { + items := make([]Sku, 0) + + page, err := c.SkusListByOffer(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := SkusListByOfferCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/model_sku.go new file mode 100644 index 000000000000..cef2062f1bb2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/model_sku.go @@ -0,0 +1,16 @@ +package skuses + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SkuProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/model_skumappings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/model_skumappings.go new file mode 100644 index 000000000000..fd05acdaf7d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/model_skumappings.go @@ -0,0 +1,10 @@ +package skuses + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuMappings struct { + CatalogPlanId *string `json:"catalogPlanId,omitempty"` + MarketplaceSkuId *string `json:"marketplaceSkuId,omitempty"` + MarketplaceSkuVersions *[]string `json:"marketplaceSkuVersions,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/model_skuproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/model_skuproperties.go new file mode 100644 index 000000000000..bc60d0aec34f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/model_skuproperties.go @@ -0,0 +1,13 @@ +package skuses + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuProperties struct { + Content *string `json:"content,omitempty"` + ContentVersion *string `json:"contentVersion,omitempty"` + OfferId *string `json:"offerId,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + PublisherId *string `json:"publisherId,omitempty"` + SkuMappings *[]SkuMappings `json:"skuMappings,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/predicates.go new file mode 100644 index 000000000000..0f706c1239e8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/predicates.go @@ -0,0 +1,24 @@ +package skuses + +type SkuOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SkuOperationPredicate) Matches(input Sku) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/version.go new file mode 100644 index 000000000000..cfbf9c053bf2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses/version.go @@ -0,0 +1,12 @@ +package skuses + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/skuses/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/README.md new file mode 100644 index 000000000000..60dd69ddaaad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/README.md @@ -0,0 +1,86 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns` Documentation + +The `updateruns` SDK allows for interaction with the Azure Resource Manager Service `azurestackhci` (API Version `2022-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns" +``` + + +### Client Initialization + +```go +client := updateruns.NewUpdateRunsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `UpdateRunsClient.UpdateRunsDelete` + +```go +ctx := context.TODO() +id := updateruns.NewUpdateRunID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "updateValue", "updateRunValue") + +if err := client.UpdateRunsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `UpdateRunsClient.UpdateRunsGet` + +```go +ctx := context.TODO() +id := updateruns.NewUpdateRunID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "updateValue", "updateRunValue") + +read, err := client.UpdateRunsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `UpdateRunsClient.UpdateRunsList` + +```go +ctx := context.TODO() +id := updateruns.NewUpdateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "updateValue") + +// alternatively `client.UpdateRunsList(ctx, id)` can be used to do batched pagination +items, err := client.UpdateRunsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `UpdateRunsClient.UpdateRunsPut` + +```go +ctx := context.TODO() +id := updateruns.NewUpdateRunID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "updateValue", "updateRunValue") + +payload := updateruns.UpdateRun{ + // ... +} + + +read, err := client.UpdateRunsPut(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/client.go new file mode 100644 index 000000000000..c96c9b6c0e26 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/client.go @@ -0,0 +1,18 @@ +package updateruns + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateRunsClient struct { + Client autorest.Client + baseUri string +} + +func NewUpdateRunsClientWithBaseURI(endpoint string) UpdateRunsClient { + return UpdateRunsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/constants.go new file mode 100644 index 000000000000..bba773f1adbd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/constants.go @@ -0,0 +1,77 @@ +package updateruns + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type UpdateRunPropertiesState string + +const ( + UpdateRunPropertiesStateFailed UpdateRunPropertiesState = "Failed" + UpdateRunPropertiesStateInProgress UpdateRunPropertiesState = "InProgress" + UpdateRunPropertiesStateSucceeded UpdateRunPropertiesState = "Succeeded" + UpdateRunPropertiesStateUnknown UpdateRunPropertiesState = "Unknown" +) + +func PossibleValuesForUpdateRunPropertiesState() []string { + return []string{ + string(UpdateRunPropertiesStateFailed), + string(UpdateRunPropertiesStateInProgress), + string(UpdateRunPropertiesStateSucceeded), + string(UpdateRunPropertiesStateUnknown), + } +} + +func parseUpdateRunPropertiesState(input string) (*UpdateRunPropertiesState, error) { + vals := map[string]UpdateRunPropertiesState{ + "failed": UpdateRunPropertiesStateFailed, + "inprogress": UpdateRunPropertiesStateInProgress, + "succeeded": UpdateRunPropertiesStateSucceeded, + "unknown": UpdateRunPropertiesStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpdateRunPropertiesState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/id_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/id_update.go new file mode 100644 index 000000000000..aaeda389d565 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/id_update.go @@ -0,0 +1,137 @@ +package updateruns + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = UpdateId{} + +// UpdateId is a struct representing the Resource ID for a Update +type UpdateId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + UpdateName string +} + +// NewUpdateID returns a new UpdateId struct +func NewUpdateID(subscriptionId string, resourceGroupName string, clusterName string, updateName string) UpdateId { + return UpdateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + UpdateName: updateName, + } +} + +// ParseUpdateID parses 'input' into a UpdateId +func ParseUpdateID(input string) (*UpdateId, error) { + parser := resourceids.NewParserFromResourceIdType(UpdateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := UpdateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { + return nil, fmt.Errorf("the segment 'updateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseUpdateIDInsensitively parses 'input' case-insensitively into a UpdateId +// note: this method should only be used for API response data and not user input +func ParseUpdateIDInsensitively(input string) (*UpdateId, error) { + parser := resourceids.NewParserFromResourceIdType(UpdateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := UpdateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { + return nil, fmt.Errorf("the segment 'updateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateUpdateID checks that 'input' can be parsed as a Update ID +func ValidateUpdateID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseUpdateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Update ID +func (id UpdateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s/updates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.UpdateName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Update ID +func (id UpdateId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticUpdates", "updates", "updates"), + resourceids.UserSpecifiedSegment("updateName", "updateValue"), + } +} + +// String returns a human-readable description of this Update ID +func (id UpdateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Update Name: %q", id.UpdateName), + } + return fmt.Sprintf("Update (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/id_updaterun.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/id_updaterun.go new file mode 100644 index 000000000000..f1ad9dcae72d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/id_updaterun.go @@ -0,0 +1,150 @@ +package updateruns + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = UpdateRunId{} + +// UpdateRunId is a struct representing the Resource ID for a Update Run +type UpdateRunId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + UpdateName string + UpdateRunName string +} + +// NewUpdateRunID returns a new UpdateRunId struct +func NewUpdateRunID(subscriptionId string, resourceGroupName string, clusterName string, updateName string, updateRunName string) UpdateRunId { + return UpdateRunId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + UpdateName: updateName, + UpdateRunName: updateRunName, + } +} + +// ParseUpdateRunID parses 'input' into a UpdateRunId +func ParseUpdateRunID(input string) (*UpdateRunId, error) { + parser := resourceids.NewParserFromResourceIdType(UpdateRunId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := UpdateRunId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { + return nil, fmt.Errorf("the segment 'updateName' was not found in the resource id %q", input) + } + + if id.UpdateRunName, ok = parsed.Parsed["updateRunName"]; !ok { + return nil, fmt.Errorf("the segment 'updateRunName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseUpdateRunIDInsensitively parses 'input' case-insensitively into a UpdateRunId +// note: this method should only be used for API response data and not user input +func ParseUpdateRunIDInsensitively(input string) (*UpdateRunId, error) { + parser := resourceids.NewParserFromResourceIdType(UpdateRunId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := UpdateRunId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { + return nil, fmt.Errorf("the segment 'updateName' was not found in the resource id %q", input) + } + + if id.UpdateRunName, ok = parsed.Parsed["updateRunName"]; !ok { + return nil, fmt.Errorf("the segment 'updateRunName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateUpdateRunID checks that 'input' can be parsed as a Update Run ID +func ValidateUpdateRunID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseUpdateRunID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Update Run ID +func (id UpdateRunId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s/updates/%s/updateRuns/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.UpdateName, id.UpdateRunName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Update Run ID +func (id UpdateRunId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticUpdates", "updates", "updates"), + resourceids.UserSpecifiedSegment("updateName", "updateValue"), + resourceids.StaticSegment("staticUpdateRuns", "updateRuns", "updateRuns"), + resourceids.UserSpecifiedSegment("updateRunName", "updateRunValue"), + } +} + +// String returns a human-readable description of this Update Run ID +func (id UpdateRunId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Update Name: %q", id.UpdateName), + fmt.Sprintf("Update Run Name: %q", id.UpdateRunName), + } + return fmt.Sprintf("Update Run (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/method_updaterunsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/method_updaterunsdelete_autorest.go new file mode 100644 index 000000000000..a32da0aae0e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/method_updaterunsdelete_autorest.go @@ -0,0 +1,78 @@ +package updateruns + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateRunsDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// UpdateRunsDelete ... +func (c UpdateRunsClient) UpdateRunsDelete(ctx context.Context, id UpdateRunId) (result UpdateRunsDeleteOperationResponse, err error) { + req, err := c.preparerForUpdateRunsDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "UpdateRunsDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdateRunsDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "UpdateRunsDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateRunsDeleteThenPoll performs UpdateRunsDelete then polls until it's completed +func (c UpdateRunsClient) UpdateRunsDeleteThenPoll(ctx context.Context, id UpdateRunId) error { + result, err := c.UpdateRunsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing UpdateRunsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after UpdateRunsDelete: %+v", err) + } + + return nil +} + +// preparerForUpdateRunsDelete prepares the UpdateRunsDelete request. +func (c UpdateRunsClient) preparerForUpdateRunsDelete(ctx context.Context, id UpdateRunId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdateRunsDelete sends the UpdateRunsDelete request. The method will close the +// http.Response Body if it receives an error. +func (c UpdateRunsClient) senderForUpdateRunsDelete(ctx context.Context, req *http.Request) (future UpdateRunsDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/method_updaterunsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/method_updaterunsget_autorest.go new file mode 100644 index 000000000000..dad4e6e93094 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/method_updaterunsget_autorest.go @@ -0,0 +1,68 @@ +package updateruns + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateRunsGetOperationResponse struct { + HttpResponse *http.Response + Model *UpdateRun +} + +// UpdateRunsGet ... +func (c UpdateRunsClient) UpdateRunsGet(ctx context.Context, id UpdateRunId) (result UpdateRunsGetOperationResponse, err error) { + req, err := c.preparerForUpdateRunsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "UpdateRunsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "UpdateRunsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdateRunsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "UpdateRunsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdateRunsGet prepares the UpdateRunsGet request. +func (c UpdateRunsClient) preparerForUpdateRunsGet(ctx context.Context, id UpdateRunId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdateRunsGet handles the response to the UpdateRunsGet request. The method always +// closes the http.Response Body. +func (c UpdateRunsClient) responderForUpdateRunsGet(resp *http.Response) (result UpdateRunsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/method_updaterunslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/method_updaterunslist_autorest.go new file mode 100644 index 000000000000..be38ab0c19f7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/method_updaterunslist_autorest.go @@ -0,0 +1,186 @@ +package updateruns + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateRunsListOperationResponse struct { + HttpResponse *http.Response + Model *[]UpdateRun + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (UpdateRunsListOperationResponse, error) +} + +type UpdateRunsListCompleteResult struct { + Items []UpdateRun +} + +func (r UpdateRunsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r UpdateRunsListOperationResponse) LoadMore(ctx context.Context) (resp UpdateRunsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// UpdateRunsList ... +func (c UpdateRunsClient) UpdateRunsList(ctx context.Context, id UpdateId) (resp UpdateRunsListOperationResponse, err error) { + req, err := c.preparerForUpdateRunsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "UpdateRunsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "UpdateRunsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForUpdateRunsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "UpdateRunsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForUpdateRunsList prepares the UpdateRunsList request. +func (c UpdateRunsClient) preparerForUpdateRunsList(ctx context.Context, id UpdateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/updateRuns", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForUpdateRunsListWithNextLink prepares the UpdateRunsList request with the given nextLink token. +func (c UpdateRunsClient) preparerForUpdateRunsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdateRunsList handles the response to the UpdateRunsList request. The method always +// closes the http.Response Body. +func (c UpdateRunsClient) responderForUpdateRunsList(resp *http.Response) (result UpdateRunsListOperationResponse, err error) { + type page struct { + Values []UpdateRun `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result UpdateRunsListOperationResponse, err error) { + req, err := c.preparerForUpdateRunsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "UpdateRunsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "UpdateRunsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdateRunsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "UpdateRunsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// UpdateRunsListComplete retrieves all of the results into a single object +func (c UpdateRunsClient) UpdateRunsListComplete(ctx context.Context, id UpdateId) (UpdateRunsListCompleteResult, error) { + return c.UpdateRunsListCompleteMatchingPredicate(ctx, id, UpdateRunOperationPredicate{}) +} + +// UpdateRunsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c UpdateRunsClient) UpdateRunsListCompleteMatchingPredicate(ctx context.Context, id UpdateId, predicate UpdateRunOperationPredicate) (resp UpdateRunsListCompleteResult, err error) { + items := make([]UpdateRun, 0) + + page, err := c.UpdateRunsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := UpdateRunsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/method_updaterunsput_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/method_updaterunsput_autorest.go new file mode 100644 index 000000000000..0caec4ca82c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/method_updaterunsput_autorest.go @@ -0,0 +1,69 @@ +package updateruns + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateRunsPutOperationResponse struct { + HttpResponse *http.Response + Model *UpdateRun +} + +// UpdateRunsPut ... +func (c UpdateRunsClient) UpdateRunsPut(ctx context.Context, id UpdateRunId, input UpdateRun) (result UpdateRunsPutOperationResponse, err error) { + req, err := c.preparerForUpdateRunsPut(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "UpdateRunsPut", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "UpdateRunsPut", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdateRunsPut(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "UpdateRunsPut", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdateRunsPut prepares the UpdateRunsPut request. +func (c UpdateRunsClient) preparerForUpdateRunsPut(ctx context.Context, id UpdateRunId, input UpdateRun) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdateRunsPut handles the response to the UpdateRunsPut request. The method always +// closes the http.Response Body. +func (c UpdateRunsClient) responderForUpdateRunsPut(resp *http.Response) (result UpdateRunsPutOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/model_step.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/model_step.go new file mode 100644 index 000000000000..ece5d6573428 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/model_step.go @@ -0,0 +1,57 @@ +package updateruns + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Step struct { + Description *string `json:"description,omitempty"` + EndTimeUtc *string `json:"endTimeUtc,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + LastUpdatedTimeUtc *string `json:"lastUpdatedTimeUtc,omitempty"` + Name *string `json:"name,omitempty"` + StartTimeUtc *string `json:"startTimeUtc,omitempty"` + Status *string `json:"status,omitempty"` + Steps *[]Step `json:"steps,omitempty"` +} + +func (o *Step) GetEndTimeUtcAsTime() (*time.Time, error) { + if o.EndTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *Step) SetEndTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTimeUtc = &formatted +} + +func (o *Step) GetLastUpdatedTimeUtcAsTime() (*time.Time, error) { + if o.LastUpdatedTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdatedTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *Step) SetLastUpdatedTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdatedTimeUtc = &formatted +} + +func (o *Step) GetStartTimeUtcAsTime() (*time.Time, error) { + if o.StartTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *Step) SetStartTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTimeUtc = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/model_updaterun.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/model_updaterun.go new file mode 100644 index 000000000000..d8fbe7ca6b7a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/model_updaterun.go @@ -0,0 +1,17 @@ +package updateruns + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateRun struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *UpdateRunProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/model_updaterunproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/model_updaterunproperties.go new file mode 100644 index 000000000000..a2500945de0e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/model_updaterunproperties.go @@ -0,0 +1,43 @@ +package updateruns + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateRunProperties struct { + Duration *string `json:"duration,omitempty"` + LastUpdatedTime *string `json:"lastUpdatedTime,omitempty"` + Progress *Step `json:"progress,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + State *UpdateRunPropertiesState `json:"state,omitempty"` + TimeStarted *string `json:"timeStarted,omitempty"` +} + +func (o *UpdateRunProperties) GetLastUpdatedTimeAsTime() (*time.Time, error) { + if o.LastUpdatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpdateRunProperties) SetLastUpdatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdatedTime = &formatted +} + +func (o *UpdateRunProperties) GetTimeStartedAsTime() (*time.Time, error) { + if o.TimeStarted == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeStarted, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpdateRunProperties) SetTimeStartedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeStarted = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/predicates.go new file mode 100644 index 000000000000..b9c9aeec16df --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/predicates.go @@ -0,0 +1,29 @@ +package updateruns + +type UpdateRunOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p UpdateRunOperationPredicate) Matches(input UpdateRun) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/version.go new file mode 100644 index 000000000000..85a63a5fe783 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns/version.go @@ -0,0 +1,12 @@ +package updateruns + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/updateruns/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/README.md new file mode 100644 index 000000000000..2b3aa2043584 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/README.md @@ -0,0 +1,98 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates` Documentation + +The `updates` SDK allows for interaction with the Azure Resource Manager Service `azurestackhci` (API Version `2022-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates" +``` + + +### Client Initialization + +```go +client := updates.NewUpdatesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `UpdatesClient.UpdatesDelete` + +```go +ctx := context.TODO() +id := updates.NewUpdateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "updateValue") + +if err := client.UpdatesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `UpdatesClient.UpdatesGet` + +```go +ctx := context.TODO() +id := updates.NewUpdateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "updateValue") + +read, err := client.UpdatesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `UpdatesClient.UpdatesList` + +```go +ctx := context.TODO() +id := updates.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +// alternatively `client.UpdatesList(ctx, id)` can be used to do batched pagination +items, err := client.UpdatesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `UpdatesClient.UpdatesPost` + +```go +ctx := context.TODO() +id := updates.NewUpdateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "updateValue") + +if err := client.UpdatesPostThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `UpdatesClient.UpdatesPut` + +```go +ctx := context.TODO() +id := updates.NewUpdateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "updateValue") + +payload := updates.Update{ + // ... +} + + +read, err := client.UpdatesPut(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/client.go new file mode 100644 index 000000000000..61fab0101cc5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/client.go @@ -0,0 +1,18 @@ +package updates + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdatesClient struct { + Client autorest.Client + baseUri string +} + +func NewUpdatesClientWithBaseURI(endpoint string) UpdatesClient { + return UpdatesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/constants.go new file mode 100644 index 000000000000..c62bf85896e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/constants.go @@ -0,0 +1,286 @@ +package updates + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilityType string + +const ( + AvailabilityTypeLocal AvailabilityType = "Local" + AvailabilityTypeNotify AvailabilityType = "Notify" + AvailabilityTypeOnline AvailabilityType = "Online" +) + +func PossibleValuesForAvailabilityType() []string { + return []string{ + string(AvailabilityTypeLocal), + string(AvailabilityTypeNotify), + string(AvailabilityTypeOnline), + } +} + +func parseAvailabilityType(input string) (*AvailabilityType, error) { + vals := map[string]AvailabilityType{ + "local": AvailabilityTypeLocal, + "notify": AvailabilityTypeNotify, + "online": AvailabilityTypeOnline, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AvailabilityType(input) + return &out, nil +} + +type HealthState string + +const ( + HealthStateError HealthState = "Error" + HealthStateFailure HealthState = "Failure" + HealthStateInProgress HealthState = "InProgress" + HealthStateSuccess HealthState = "Success" + HealthStateUnknown HealthState = "Unknown" + HealthStateWarning HealthState = "Warning" +) + +func PossibleValuesForHealthState() []string { + return []string{ + string(HealthStateError), + string(HealthStateFailure), + string(HealthStateInProgress), + string(HealthStateSuccess), + string(HealthStateUnknown), + string(HealthStateWarning), + } +} + +func parseHealthState(input string) (*HealthState, error) { + vals := map[string]HealthState{ + "error": HealthStateError, + "failure": HealthStateFailure, + "inprogress": HealthStateInProgress, + "success": HealthStateSuccess, + "unknown": HealthStateUnknown, + "warning": HealthStateWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HealthState(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type RebootRequirement string + +const ( + RebootRequirementFalse RebootRequirement = "False" + RebootRequirementTrue RebootRequirement = "True" + RebootRequirementUnknown RebootRequirement = "Unknown" +) + +func PossibleValuesForRebootRequirement() []string { + return []string{ + string(RebootRequirementFalse), + string(RebootRequirementTrue), + string(RebootRequirementUnknown), + } +} + +func parseRebootRequirement(input string) (*RebootRequirement, error) { + vals := map[string]RebootRequirement{ + "false": RebootRequirementFalse, + "true": RebootRequirementTrue, + "unknown": RebootRequirementUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RebootRequirement(input) + return &out, nil +} + +type Severity string + +const ( + SeverityCritical Severity = "Critical" + SeverityHidden Severity = "Hidden" + SeverityInformational Severity = "Informational" + SeverityWarning Severity = "Warning" +) + +func PossibleValuesForSeverity() []string { + return []string{ + string(SeverityCritical), + string(SeverityHidden), + string(SeverityInformational), + string(SeverityWarning), + } +} + +func parseSeverity(input string) (*Severity, error) { + vals := map[string]Severity{ + "critical": SeverityCritical, + "hidden": SeverityHidden, + "informational": SeverityInformational, + "warning": SeverityWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Severity(input) + return &out, nil +} + +type State string + +const ( + StateDownloadFailed State = "DownloadFailed" + StateDownloading State = "Downloading" + StateHasPrerequisite State = "HasPrerequisite" + StateHealthCheckFailed State = "HealthCheckFailed" + StateHealthChecking State = "HealthChecking" + StateInstallationFailed State = "InstallationFailed" + StateInstalled State = "Installed" + StateInstalling State = "Installing" + StateInvalid State = "Invalid" + StateNotApplicableBecauseAnotherUpdateIsInProgress State = "NotApplicableBecauseAnotherUpdateIsInProgress" + StateObsolete State = "Obsolete" + StatePreparationFailed State = "PreparationFailed" + StatePreparing State = "Preparing" + StateReady State = "Ready" + StateReadyToInstall State = "ReadyToInstall" + StateRecalled State = "Recalled" + StateScanFailed State = "ScanFailed" + StateScanInProgress State = "ScanInProgress" +) + +func PossibleValuesForState() []string { + return []string{ + string(StateDownloadFailed), + string(StateDownloading), + string(StateHasPrerequisite), + string(StateHealthCheckFailed), + string(StateHealthChecking), + string(StateInstallationFailed), + string(StateInstalled), + string(StateInstalling), + string(StateInvalid), + string(StateNotApplicableBecauseAnotherUpdateIsInProgress), + string(StateObsolete), + string(StatePreparationFailed), + string(StatePreparing), + string(StateReady), + string(StateReadyToInstall), + string(StateRecalled), + string(StateScanFailed), + string(StateScanInProgress), + } +} + +func parseState(input string) (*State, error) { + vals := map[string]State{ + "downloadfailed": StateDownloadFailed, + "downloading": StateDownloading, + "hasprerequisite": StateHasPrerequisite, + "healthcheckfailed": StateHealthCheckFailed, + "healthchecking": StateHealthChecking, + "installationfailed": StateInstallationFailed, + "installed": StateInstalled, + "installing": StateInstalling, + "invalid": StateInvalid, + "notapplicablebecauseanotherupdateisinprogress": StateNotApplicableBecauseAnotherUpdateIsInProgress, + "obsolete": StateObsolete, + "preparationfailed": StatePreparationFailed, + "preparing": StatePreparing, + "ready": StateReady, + "readytoinstall": StateReadyToInstall, + "recalled": StateRecalled, + "scanfailed": StateScanFailed, + "scaninprogress": StateScanInProgress, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := State(input) + return &out, nil +} + +type Status string + +const ( + StatusFailed Status = "Failed" + StatusInProgress Status = "InProgress" + StatusSucceeded Status = "Succeeded" +) + +func PossibleValuesForStatus() []string { + return []string{ + string(StatusFailed), + string(StatusInProgress), + string(StatusSucceeded), + } +} + +func parseStatus(input string) (*Status, error) { + vals := map[string]Status{ + "failed": StatusFailed, + "inprogress": StatusInProgress, + "succeeded": StatusSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/id_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/id_cluster.go new file mode 100644 index 000000000000..4b4bd1176e1a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/id_cluster.go @@ -0,0 +1,124 @@ +package updates + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ClusterId{} + +// ClusterId is a struct representing the Resource ID for a Cluster +type ClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewClusterID returns a new ClusterId struct +func NewClusterID(subscriptionId string, resourceGroupName string, clusterName string) ClusterId { + return ClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseClusterID parses 'input' into a ClusterId +func ParseClusterID(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseClusterIDInsensitively parses 'input' case-insensitively into a ClusterId +// note: this method should only be used for API response data and not user input +func ParseClusterIDInsensitively(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateClusterID checks that 'input' can be parsed as a Cluster ID +func ValidateClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cluster ID +func (id ClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cluster ID +func (id ClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Cluster ID +func (id ClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/id_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/id_update.go new file mode 100644 index 000000000000..4fd81f5a69d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/id_update.go @@ -0,0 +1,137 @@ +package updates + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = UpdateId{} + +// UpdateId is a struct representing the Resource ID for a Update +type UpdateId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + UpdateName string +} + +// NewUpdateID returns a new UpdateId struct +func NewUpdateID(subscriptionId string, resourceGroupName string, clusterName string, updateName string) UpdateId { + return UpdateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + UpdateName: updateName, + } +} + +// ParseUpdateID parses 'input' into a UpdateId +func ParseUpdateID(input string) (*UpdateId, error) { + parser := resourceids.NewParserFromResourceIdType(UpdateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := UpdateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { + return nil, fmt.Errorf("the segment 'updateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseUpdateIDInsensitively parses 'input' case-insensitively into a UpdateId +// note: this method should only be used for API response data and not user input +func ParseUpdateIDInsensitively(input string) (*UpdateId, error) { + parser := resourceids.NewParserFromResourceIdType(UpdateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := UpdateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { + return nil, fmt.Errorf("the segment 'updateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateUpdateID checks that 'input' can be parsed as a Update ID +func ValidateUpdateID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseUpdateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Update ID +func (id UpdateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s/updates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.UpdateName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Update ID +func (id UpdateId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticUpdates", "updates", "updates"), + resourceids.UserSpecifiedSegment("updateName", "updateValue"), + } +} + +// String returns a human-readable description of this Update ID +func (id UpdateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Update Name: %q", id.UpdateName), + } + return fmt.Sprintf("Update (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/method_updatesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/method_updatesdelete_autorest.go new file mode 100644 index 000000000000..5228a160ed6f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/method_updatesdelete_autorest.go @@ -0,0 +1,78 @@ +package updates + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdatesDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// UpdatesDelete ... +func (c UpdatesClient) UpdatesDelete(ctx context.Context, id UpdateId) (result UpdatesDeleteOperationResponse, err error) { + req, err := c.preparerForUpdatesDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdatesDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdatesDeleteThenPoll performs UpdatesDelete then polls until it's completed +func (c UpdatesClient) UpdatesDeleteThenPoll(ctx context.Context, id UpdateId) error { + result, err := c.UpdatesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing UpdatesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after UpdatesDelete: %+v", err) + } + + return nil +} + +// preparerForUpdatesDelete prepares the UpdatesDelete request. +func (c UpdatesClient) preparerForUpdatesDelete(ctx context.Context, id UpdateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdatesDelete sends the UpdatesDelete request. The method will close the +// http.Response Body if it receives an error. +func (c UpdatesClient) senderForUpdatesDelete(ctx context.Context, req *http.Request) (future UpdatesDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/method_updatesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/method_updatesget_autorest.go new file mode 100644 index 000000000000..b5d92cb22cab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/method_updatesget_autorest.go @@ -0,0 +1,68 @@ +package updates + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdatesGetOperationResponse struct { + HttpResponse *http.Response + Model *Update +} + +// UpdatesGet ... +func (c UpdatesClient) UpdatesGet(ctx context.Context, id UpdateId) (result UpdatesGetOperationResponse, err error) { + req, err := c.preparerForUpdatesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdatesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdatesGet prepares the UpdatesGet request. +func (c UpdatesClient) preparerForUpdatesGet(ctx context.Context, id UpdateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdatesGet handles the response to the UpdatesGet request. The method always +// closes the http.Response Body. +func (c UpdatesClient) responderForUpdatesGet(resp *http.Response) (result UpdatesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/method_updateslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/method_updateslist_autorest.go new file mode 100644 index 000000000000..1a908e72461b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/method_updateslist_autorest.go @@ -0,0 +1,186 @@ +package updates + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdatesListOperationResponse struct { + HttpResponse *http.Response + Model *[]Update + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (UpdatesListOperationResponse, error) +} + +type UpdatesListCompleteResult struct { + Items []Update +} + +func (r UpdatesListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r UpdatesListOperationResponse) LoadMore(ctx context.Context) (resp UpdatesListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// UpdatesList ... +func (c UpdatesClient) UpdatesList(ctx context.Context, id ClusterId) (resp UpdatesListOperationResponse, err error) { + req, err := c.preparerForUpdatesList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForUpdatesList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForUpdatesList prepares the UpdatesList request. +func (c UpdatesClient) preparerForUpdatesList(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/updates", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForUpdatesListWithNextLink prepares the UpdatesList request with the given nextLink token. +func (c UpdatesClient) preparerForUpdatesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdatesList handles the response to the UpdatesList request. The method always +// closes the http.Response Body. +func (c UpdatesClient) responderForUpdatesList(resp *http.Response) (result UpdatesListOperationResponse, err error) { + type page struct { + Values []Update `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result UpdatesListOperationResponse, err error) { + req, err := c.preparerForUpdatesListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdatesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// UpdatesListComplete retrieves all of the results into a single object +func (c UpdatesClient) UpdatesListComplete(ctx context.Context, id ClusterId) (UpdatesListCompleteResult, error) { + return c.UpdatesListCompleteMatchingPredicate(ctx, id, UpdateOperationPredicate{}) +} + +// UpdatesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c UpdatesClient) UpdatesListCompleteMatchingPredicate(ctx context.Context, id ClusterId, predicate UpdateOperationPredicate) (resp UpdatesListCompleteResult, err error) { + items := make([]Update, 0) + + page, err := c.UpdatesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := UpdatesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/method_updatespost_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/method_updatespost_autorest.go new file mode 100644 index 000000000000..9915746d4f6d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/method_updatespost_autorest.go @@ -0,0 +1,78 @@ +package updates + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdatesPostOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// UpdatesPost ... +func (c UpdatesClient) UpdatesPost(ctx context.Context, id UpdateId) (result UpdatesPostOperationResponse, err error) { + req, err := c.preparerForUpdatesPost(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesPost", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdatesPost(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesPost", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdatesPostThenPoll performs UpdatesPost then polls until it's completed +func (c UpdatesClient) UpdatesPostThenPoll(ctx context.Context, id UpdateId) error { + result, err := c.UpdatesPost(ctx, id) + if err != nil { + return fmt.Errorf("performing UpdatesPost: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after UpdatesPost: %+v", err) + } + + return nil +} + +// preparerForUpdatesPost prepares the UpdatesPost request. +func (c UpdatesClient) preparerForUpdatesPost(ctx context.Context, id UpdateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/apply", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdatesPost sends the UpdatesPost request. The method will close the +// http.Response Body if it receives an error. +func (c UpdatesClient) senderForUpdatesPost(ctx context.Context, req *http.Request) (future UpdatesPostOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/method_updatesput_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/method_updatesput_autorest.go new file mode 100644 index 000000000000..88371421eae2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/method_updatesput_autorest.go @@ -0,0 +1,69 @@ +package updates + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdatesPutOperationResponse struct { + HttpResponse *http.Response + Model *Update +} + +// UpdatesPut ... +func (c UpdatesClient) UpdatesPut(ctx context.Context, id UpdateId, input Update) (result UpdatesPutOperationResponse, err error) { + req, err := c.preparerForUpdatesPut(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesPut", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesPut", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdatesPut(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "updates.UpdatesClient", "UpdatesPut", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdatesPut prepares the UpdatesPut request. +func (c UpdatesClient) preparerForUpdatesPut(ctx context.Context, id UpdateId, input Update) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdatesPut handles the response to the UpdatesPut request. The method always +// closes the http.Response Body. +func (c UpdatesClient) responderForUpdatesPut(resp *http.Response) (result UpdatesPutOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_packageversioninfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_packageversioninfo.go new file mode 100644 index 000000000000..2376b23ed11b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_packageversioninfo.go @@ -0,0 +1,28 @@ +package updates + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PackageVersionInfo struct { + LastUpdated *string `json:"lastUpdated,omitempty"` + PackageType *string `json:"packageType,omitempty"` + Version *string `json:"version,omitempty"` +} + +func (o *PackageVersionInfo) GetLastUpdatedAsTime() (*time.Time, error) { + if o.LastUpdated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdated, "2006-01-02T15:04:05Z07:00") +} + +func (o *PackageVersionInfo) SetLastUpdatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdated = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_precheckresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_precheckresult.go new file mode 100644 index 000000000000..22b924a1d10d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_precheckresult.go @@ -0,0 +1,37 @@ +package updates + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrecheckResult struct { + AdditionalData *string `json:"additionalData,omitempty"` + Description *string `json:"description,omitempty"` + HealthCheckSource *string `json:"healthCheckSource,omitempty"` + Name *string `json:"name,omitempty"` + Remediation *string `json:"remediation,omitempty"` + Severity *Severity `json:"severity,omitempty"` + Status *Status `json:"status,omitempty"` + Tags *PrecheckResultTags `json:"tags,omitempty"` + TargetResourceID *string `json:"targetResourceID,omitempty"` + TargetResourceName *string `json:"targetResourceName,omitempty"` + Timestamp *string `json:"timestamp,omitempty"` + Title *string `json:"title,omitempty"` +} + +func (o *PrecheckResult) GetTimestampAsTime() (*time.Time, error) { + if o.Timestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Timestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *PrecheckResult) SetTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Timestamp = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_precheckresulttags.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_precheckresulttags.go new file mode 100644 index 000000000000..eac41de78dca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_precheckresulttags.go @@ -0,0 +1,9 @@ +package updates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrecheckResultTags struct { + Key *string `json:"key,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_update.go new file mode 100644 index 000000000000..c5722f69cb2b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_update.go @@ -0,0 +1,17 @@ +package updates + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Update struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *UpdateProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_updateprerequisite.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_updateprerequisite.go new file mode 100644 index 000000000000..42904efc5917 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_updateprerequisite.go @@ -0,0 +1,10 @@ +package updates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdatePrerequisite struct { + PackageName *string `json:"packageName,omitempty"` + UpdateType *string `json:"updateType,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_updateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_updateproperties.go new file mode 100644 index 000000000000..7c2ffff7e51d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_updateproperties.go @@ -0,0 +1,57 @@ +package updates + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateProperties struct { + AdditionalProperties *string `json:"additionalProperties,omitempty"` + AvailabilityType *AvailabilityType `json:"availabilityType,omitempty"` + ComponentVersions *[]PackageVersionInfo `json:"componentVersions,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + HealthCheckDate *string `json:"healthCheckDate,omitempty"` + HealthCheckResult *[]PrecheckResult `json:"healthCheckResult,omitempty"` + HealthState *HealthState `json:"healthState,omitempty"` + InstalledDate *string `json:"installedDate,omitempty"` + PackagePath *string `json:"packagePath,omitempty"` + PackageSizeInMb *float64 `json:"packageSizeInMb,omitempty"` + PackageType *string `json:"packageType,omitempty"` + Prerequisites *[]UpdatePrerequisite `json:"prerequisites,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + RebootRequired *RebootRequirement `json:"rebootRequired,omitempty"` + ReleaseLink *string `json:"releaseLink,omitempty"` + State *State `json:"state,omitempty"` + UpdateStateProperties *UpdateStateProperties `json:"updateStateProperties,omitempty"` + Version *string `json:"version,omitempty"` +} + +func (o *UpdateProperties) GetHealthCheckDateAsTime() (*time.Time, error) { + if o.HealthCheckDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.HealthCheckDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpdateProperties) SetHealthCheckDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.HealthCheckDate = &formatted +} + +func (o *UpdateProperties) GetInstalledDateAsTime() (*time.Time, error) { + if o.InstalledDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.InstalledDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpdateProperties) SetInstalledDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.InstalledDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_updatestateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_updatestateproperties.go new file mode 100644 index 000000000000..4a17ca955a88 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/model_updatestateproperties.go @@ -0,0 +1,9 @@ +package updates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateStateProperties struct { + NotifyMessage *string `json:"notifyMessage,omitempty"` + ProgressPercentage *float64 `json:"progressPercentage,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/predicates.go new file mode 100644 index 000000000000..8c6c194cfefd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/predicates.go @@ -0,0 +1,29 @@ +package updates + +type UpdateOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p UpdateOperationPredicate) Matches(input Update) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/version.go new file mode 100644 index 000000000000..95bec21f207e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates/version.go @@ -0,0 +1,12 @@ +package updates + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/updates/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/README.md new file mode 100644 index 000000000000..31cf00fba960 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/README.md @@ -0,0 +1,86 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries` Documentation + +The `updatesummaries` SDK allows for interaction with the Azure Resource Manager Service `azurestackhci` (API Version `2022-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries" +``` + + +### Client Initialization + +```go +client := updatesummaries.NewUpdateSummariesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `UpdateSummariesClient.UpdateSummariesDelete` + +```go +ctx := context.TODO() +id := updatesummaries.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +if err := client.UpdateSummariesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `UpdateSummariesClient.UpdateSummariesGet` + +```go +ctx := context.TODO() +id := updatesummaries.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.UpdateSummariesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `UpdateSummariesClient.UpdateSummariesList` + +```go +ctx := context.TODO() +id := updatesummaries.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +// alternatively `client.UpdateSummariesList(ctx, id)` can be used to do batched pagination +items, err := client.UpdateSummariesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `UpdateSummariesClient.UpdateSummariesPut` + +```go +ctx := context.TODO() +id := updatesummaries.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := updatesummaries.UpdateSummaries{ + // ... +} + + +read, err := client.UpdateSummariesPut(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/client.go new file mode 100644 index 000000000000..cd28fca9de3c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/client.go @@ -0,0 +1,18 @@ +package updatesummaries + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateSummariesClient struct { + Client autorest.Client + baseUri string +} + +func NewUpdateSummariesClientWithBaseURI(endpoint string) UpdateSummariesClient { + return UpdateSummariesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/constants.go new file mode 100644 index 000000000000..47b391d45866 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/constants.go @@ -0,0 +1,194 @@ +package updatesummaries + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HealthState string + +const ( + HealthStateError HealthState = "Error" + HealthStateFailure HealthState = "Failure" + HealthStateInProgress HealthState = "InProgress" + HealthStateSuccess HealthState = "Success" + HealthStateUnknown HealthState = "Unknown" + HealthStateWarning HealthState = "Warning" +) + +func PossibleValuesForHealthState() []string { + return []string{ + string(HealthStateError), + string(HealthStateFailure), + string(HealthStateInProgress), + string(HealthStateSuccess), + string(HealthStateUnknown), + string(HealthStateWarning), + } +} + +func parseHealthState(input string) (*HealthState, error) { + vals := map[string]HealthState{ + "error": HealthStateError, + "failure": HealthStateFailure, + "inprogress": HealthStateInProgress, + "success": HealthStateSuccess, + "unknown": HealthStateUnknown, + "warning": HealthStateWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HealthState(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type Severity string + +const ( + SeverityCritical Severity = "Critical" + SeverityHidden Severity = "Hidden" + SeverityInformational Severity = "Informational" + SeverityWarning Severity = "Warning" +) + +func PossibleValuesForSeverity() []string { + return []string{ + string(SeverityCritical), + string(SeverityHidden), + string(SeverityInformational), + string(SeverityWarning), + } +} + +func parseSeverity(input string) (*Severity, error) { + vals := map[string]Severity{ + "critical": SeverityCritical, + "hidden": SeverityHidden, + "informational": SeverityInformational, + "warning": SeverityWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Severity(input) + return &out, nil +} + +type Status string + +const ( + StatusFailed Status = "Failed" + StatusInProgress Status = "InProgress" + StatusSucceeded Status = "Succeeded" +) + +func PossibleValuesForStatus() []string { + return []string{ + string(StatusFailed), + string(StatusInProgress), + string(StatusSucceeded), + } +} + +func parseStatus(input string) (*Status, error) { + vals := map[string]Status{ + "failed": StatusFailed, + "inprogress": StatusInProgress, + "succeeded": StatusSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} + +type UpdateSummariesPropertiesState string + +const ( + UpdateSummariesPropertiesStateAppliedSuccessfully UpdateSummariesPropertiesState = "AppliedSuccessfully" + UpdateSummariesPropertiesStateNeedsAttention UpdateSummariesPropertiesState = "NeedsAttention" + UpdateSummariesPropertiesStatePreparationFailed UpdateSummariesPropertiesState = "PreparationFailed" + UpdateSummariesPropertiesStatePreparationInProgress UpdateSummariesPropertiesState = "PreparationInProgress" + UpdateSummariesPropertiesStateUnknown UpdateSummariesPropertiesState = "Unknown" + UpdateSummariesPropertiesStateUpdateAvailable UpdateSummariesPropertiesState = "UpdateAvailable" + UpdateSummariesPropertiesStateUpdateFailed UpdateSummariesPropertiesState = "UpdateFailed" + UpdateSummariesPropertiesStateUpdateInProgress UpdateSummariesPropertiesState = "UpdateInProgress" +) + +func PossibleValuesForUpdateSummariesPropertiesState() []string { + return []string{ + string(UpdateSummariesPropertiesStateAppliedSuccessfully), + string(UpdateSummariesPropertiesStateNeedsAttention), + string(UpdateSummariesPropertiesStatePreparationFailed), + string(UpdateSummariesPropertiesStatePreparationInProgress), + string(UpdateSummariesPropertiesStateUnknown), + string(UpdateSummariesPropertiesStateUpdateAvailable), + string(UpdateSummariesPropertiesStateUpdateFailed), + string(UpdateSummariesPropertiesStateUpdateInProgress), + } +} + +func parseUpdateSummariesPropertiesState(input string) (*UpdateSummariesPropertiesState, error) { + vals := map[string]UpdateSummariesPropertiesState{ + "appliedsuccessfully": UpdateSummariesPropertiesStateAppliedSuccessfully, + "needsattention": UpdateSummariesPropertiesStateNeedsAttention, + "preparationfailed": UpdateSummariesPropertiesStatePreparationFailed, + "preparationinprogress": UpdateSummariesPropertiesStatePreparationInProgress, + "unknown": UpdateSummariesPropertiesStateUnknown, + "updateavailable": UpdateSummariesPropertiesStateUpdateAvailable, + "updatefailed": UpdateSummariesPropertiesStateUpdateFailed, + "updateinprogress": UpdateSummariesPropertiesStateUpdateInProgress, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpdateSummariesPropertiesState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/id_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/id_cluster.go new file mode 100644 index 000000000000..ca0f1f5f5a14 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/id_cluster.go @@ -0,0 +1,124 @@ +package updatesummaries + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ClusterId{} + +// ClusterId is a struct representing the Resource ID for a Cluster +type ClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewClusterID returns a new ClusterId struct +func NewClusterID(subscriptionId string, resourceGroupName string, clusterName string) ClusterId { + return ClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseClusterID parses 'input' into a ClusterId +func ParseClusterID(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseClusterIDInsensitively parses 'input' case-insensitively into a ClusterId +// note: this method should only be used for API response data and not user input +func ParseClusterIDInsensitively(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateClusterID checks that 'input' can be parsed as a Cluster ID +func ValidateClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cluster ID +func (id ClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cluster ID +func (id ClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Cluster ID +func (id ClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/method_updatesummariesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/method_updatesummariesdelete_autorest.go new file mode 100644 index 000000000000..3da551dc2f40 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/method_updatesummariesdelete_autorest.go @@ -0,0 +1,78 @@ +package updatesummaries + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateSummariesDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// UpdateSummariesDelete ... +func (c UpdateSummariesClient) UpdateSummariesDelete(ctx context.Context, id ClusterId) (result UpdateSummariesDeleteOperationResponse, err error) { + req, err := c.preparerForUpdateSummariesDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "updatesummaries.UpdateSummariesClient", "UpdateSummariesDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdateSummariesDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "updatesummaries.UpdateSummariesClient", "UpdateSummariesDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateSummariesDeleteThenPoll performs UpdateSummariesDelete then polls until it's completed +func (c UpdateSummariesClient) UpdateSummariesDeleteThenPoll(ctx context.Context, id ClusterId) error { + result, err := c.UpdateSummariesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing UpdateSummariesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after UpdateSummariesDelete: %+v", err) + } + + return nil +} + +// preparerForUpdateSummariesDelete prepares the UpdateSummariesDelete request. +func (c UpdateSummariesClient) preparerForUpdateSummariesDelete(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/updateSummaries/default", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdateSummariesDelete sends the UpdateSummariesDelete request. The method will close the +// http.Response Body if it receives an error. +func (c UpdateSummariesClient) senderForUpdateSummariesDelete(ctx context.Context, req *http.Request) (future UpdateSummariesDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/method_updatesummariesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/method_updatesummariesget_autorest.go new file mode 100644 index 000000000000..34293f63822f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/method_updatesummariesget_autorest.go @@ -0,0 +1,69 @@ +package updatesummaries + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateSummariesGetOperationResponse struct { + HttpResponse *http.Response + Model *UpdateSummaries +} + +// UpdateSummariesGet ... +func (c UpdateSummariesClient) UpdateSummariesGet(ctx context.Context, id ClusterId) (result UpdateSummariesGetOperationResponse, err error) { + req, err := c.preparerForUpdateSummariesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "updatesummaries.UpdateSummariesClient", "UpdateSummariesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "updatesummaries.UpdateSummariesClient", "UpdateSummariesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdateSummariesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "updatesummaries.UpdateSummariesClient", "UpdateSummariesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdateSummariesGet prepares the UpdateSummariesGet request. +func (c UpdateSummariesClient) preparerForUpdateSummariesGet(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/updateSummaries/default", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdateSummariesGet handles the response to the UpdateSummariesGet request. The method always +// closes the http.Response Body. +func (c UpdateSummariesClient) responderForUpdateSummariesGet(resp *http.Response) (result UpdateSummariesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/method_updatesummarieslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/method_updatesummarieslist_autorest.go new file mode 100644 index 000000000000..ba4ef01553cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/method_updatesummarieslist_autorest.go @@ -0,0 +1,186 @@ +package updatesummaries + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateSummariesListOperationResponse struct { + HttpResponse *http.Response + Model *[]UpdateSummaries + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (UpdateSummariesListOperationResponse, error) +} + +type UpdateSummariesListCompleteResult struct { + Items []UpdateSummaries +} + +func (r UpdateSummariesListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r UpdateSummariesListOperationResponse) LoadMore(ctx context.Context) (resp UpdateSummariesListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// UpdateSummariesList ... +func (c UpdateSummariesClient) UpdateSummariesList(ctx context.Context, id ClusterId) (resp UpdateSummariesListOperationResponse, err error) { + req, err := c.preparerForUpdateSummariesList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "updatesummaries.UpdateSummariesClient", "UpdateSummariesList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "updatesummaries.UpdateSummariesClient", "UpdateSummariesList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForUpdateSummariesList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "updatesummaries.UpdateSummariesClient", "UpdateSummariesList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForUpdateSummariesList prepares the UpdateSummariesList request. +func (c UpdateSummariesClient) preparerForUpdateSummariesList(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/updateSummaries", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForUpdateSummariesListWithNextLink prepares the UpdateSummariesList request with the given nextLink token. +func (c UpdateSummariesClient) preparerForUpdateSummariesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdateSummariesList handles the response to the UpdateSummariesList request. The method always +// closes the http.Response Body. +func (c UpdateSummariesClient) responderForUpdateSummariesList(resp *http.Response) (result UpdateSummariesListOperationResponse, err error) { + type page struct { + Values []UpdateSummaries `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result UpdateSummariesListOperationResponse, err error) { + req, err := c.preparerForUpdateSummariesListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "updatesummaries.UpdateSummariesClient", "UpdateSummariesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "updatesummaries.UpdateSummariesClient", "UpdateSummariesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdateSummariesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "updatesummaries.UpdateSummariesClient", "UpdateSummariesList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// UpdateSummariesListComplete retrieves all of the results into a single object +func (c UpdateSummariesClient) UpdateSummariesListComplete(ctx context.Context, id ClusterId) (UpdateSummariesListCompleteResult, error) { + return c.UpdateSummariesListCompleteMatchingPredicate(ctx, id, UpdateSummariesOperationPredicate{}) +} + +// UpdateSummariesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c UpdateSummariesClient) UpdateSummariesListCompleteMatchingPredicate(ctx context.Context, id ClusterId, predicate UpdateSummariesOperationPredicate) (resp UpdateSummariesListCompleteResult, err error) { + items := make([]UpdateSummaries, 0) + + page, err := c.UpdateSummariesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := UpdateSummariesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/method_updatesummariesput_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/method_updatesummariesput_autorest.go new file mode 100644 index 000000000000..5bda4d5d8ce2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/method_updatesummariesput_autorest.go @@ -0,0 +1,70 @@ +package updatesummaries + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateSummariesPutOperationResponse struct { + HttpResponse *http.Response + Model *UpdateSummaries +} + +// UpdateSummariesPut ... +func (c UpdateSummariesClient) UpdateSummariesPut(ctx context.Context, id ClusterId, input UpdateSummaries) (result UpdateSummariesPutOperationResponse, err error) { + req, err := c.preparerForUpdateSummariesPut(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "updatesummaries.UpdateSummariesClient", "UpdateSummariesPut", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "updatesummaries.UpdateSummariesClient", "UpdateSummariesPut", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdateSummariesPut(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "updatesummaries.UpdateSummariesClient", "UpdateSummariesPut", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdateSummariesPut prepares the UpdateSummariesPut request. +func (c UpdateSummariesClient) preparerForUpdateSummariesPut(ctx context.Context, id ClusterId, input UpdateSummaries) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/updateSummaries/default", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdateSummariesPut handles the response to the UpdateSummariesPut request. The method always +// closes the http.Response Body. +func (c UpdateSummariesClient) responderForUpdateSummariesPut(resp *http.Response) (result UpdateSummariesPutOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/model_packageversioninfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/model_packageversioninfo.go new file mode 100644 index 000000000000..33735a824523 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/model_packageversioninfo.go @@ -0,0 +1,28 @@ +package updatesummaries + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PackageVersionInfo struct { + LastUpdated *string `json:"lastUpdated,omitempty"` + PackageType *string `json:"packageType,omitempty"` + Version *string `json:"version,omitempty"` +} + +func (o *PackageVersionInfo) GetLastUpdatedAsTime() (*time.Time, error) { + if o.LastUpdated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdated, "2006-01-02T15:04:05Z07:00") +} + +func (o *PackageVersionInfo) SetLastUpdatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdated = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/model_precheckresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/model_precheckresult.go new file mode 100644 index 000000000000..877f1918f9ee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/model_precheckresult.go @@ -0,0 +1,37 @@ +package updatesummaries + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrecheckResult struct { + AdditionalData *string `json:"additionalData,omitempty"` + Description *string `json:"description,omitempty"` + HealthCheckSource *string `json:"healthCheckSource,omitempty"` + Name *string `json:"name,omitempty"` + Remediation *string `json:"remediation,omitempty"` + Severity *Severity `json:"severity,omitempty"` + Status *Status `json:"status,omitempty"` + Tags *PrecheckResultTags `json:"tags,omitempty"` + TargetResourceID *string `json:"targetResourceID,omitempty"` + TargetResourceName *string `json:"targetResourceName,omitempty"` + Timestamp *string `json:"timestamp,omitempty"` + Title *string `json:"title,omitempty"` +} + +func (o *PrecheckResult) GetTimestampAsTime() (*time.Time, error) { + if o.Timestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Timestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *PrecheckResult) SetTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Timestamp = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/model_precheckresulttags.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/model_precheckresulttags.go new file mode 100644 index 000000000000..4dffe374f28f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/model_precheckresulttags.go @@ -0,0 +1,9 @@ +package updatesummaries + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrecheckResultTags struct { + Key *string `json:"key,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/model_updatesummaries.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/model_updatesummaries.go new file mode 100644 index 000000000000..2c73541f2ed1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/model_updatesummaries.go @@ -0,0 +1,17 @@ +package updatesummaries + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateSummaries struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *UpdateSummariesProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/model_updatesummariesproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/model_updatesummariesproperties.go new file mode 100644 index 000000000000..f6a0a7b44414 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/model_updatesummariesproperties.go @@ -0,0 +1,60 @@ +package updatesummaries + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateSummariesProperties struct { + CurrentVersion *string `json:"currentVersion,omitempty"` + HardwareModel *string `json:"hardwareModel,omitempty"` + HealthCheckDate *string `json:"healthCheckDate,omitempty"` + HealthCheckResult *[]PrecheckResult `json:"healthCheckResult,omitempty"` + HealthState *HealthState `json:"healthState,omitempty"` + LastChecked *string `json:"lastChecked,omitempty"` + LastUpdated *string `json:"lastUpdated,omitempty"` + OemFamily *string `json:"oemFamily,omitempty"` + PackageVersions *[]PackageVersionInfo `json:"packageVersions,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + State *UpdateSummariesPropertiesState `json:"state,omitempty"` +} + +func (o *UpdateSummariesProperties) GetHealthCheckDateAsTime() (*time.Time, error) { + if o.HealthCheckDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.HealthCheckDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpdateSummariesProperties) SetHealthCheckDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.HealthCheckDate = &formatted +} + +func (o *UpdateSummariesProperties) GetLastCheckedAsTime() (*time.Time, error) { + if o.LastChecked == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastChecked, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpdateSummariesProperties) SetLastCheckedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastChecked = &formatted +} + +func (o *UpdateSummariesProperties) GetLastUpdatedAsTime() (*time.Time, error) { + if o.LastUpdated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdated, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpdateSummariesProperties) SetLastUpdatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdated = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/predicates.go new file mode 100644 index 000000000000..28bc9ee36e99 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/predicates.go @@ -0,0 +1,29 @@ +package updatesummaries + +type UpdateSummariesOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p UpdateSummariesOperationPredicate) Matches(input UpdateSummaries) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/version.go new file mode 100644 index 000000000000..f89a6ed12ddf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries/version.go @@ -0,0 +1,12 @@ +package updatesummaries + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/updatesummaries/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/README.md new file mode 100644 index 000000000000..55051b3286be --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application` Documentation + +The `application` SDK allows for interaction with the Azure Resource Manager Service `batch` (API Version `2022-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application" +``` + + +### Client Initialization + +```go +client := application.NewApplicationClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApplicationClient.Create` + +```go +ctx := context.TODO() +id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "applicationValue") + +payload := application.Application{ + // ... +} + + +read, err := client.Create(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationClient.Delete` + +```go +ctx := context.TODO() +id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "applicationValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationClient.Get` + +```go +ctx := context.TODO() +id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "applicationValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationClient.List` + +```go +ctx := context.TODO() +id := application.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +// alternatively `client.List(ctx, id, application.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, application.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ApplicationClient.Update` + +```go +ctx := context.TODO() +id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "applicationValue") + +payload := application.Application{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/client.go new file mode 100644 index 000000000000..56913082b955 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/client.go @@ -0,0 +1,18 @@ +package application + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationClient struct { + Client autorest.Client + baseUri string +} + +func NewApplicationClientWithBaseURI(endpoint string) ApplicationClient { + return ApplicationClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/id_application.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/id_application.go new file mode 100644 index 000000000000..904987a7d919 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/id_application.go @@ -0,0 +1,137 @@ +package application + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ApplicationId{} + +// ApplicationId is a struct representing the Resource ID for a Application +type ApplicationId struct { + SubscriptionId string + ResourceGroupName string + BatchAccountName string + ApplicationName string +} + +// NewApplicationID returns a new ApplicationId struct +func NewApplicationID(subscriptionId string, resourceGroupName string, batchAccountName string, applicationName string) ApplicationId { + return ApplicationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + BatchAccountName: batchAccountName, + ApplicationName: applicationName, + } +} + +// ParseApplicationID parses 'input' into a ApplicationId +func ParseApplicationID(input string) (*ApplicationId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseApplicationIDInsensitively parses 'input' case-insensitively into a ApplicationId +// note: this method should only be used for API response data and not user input +func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateApplicationID checks that 'input' can be parsed as a Application ID +func ValidateApplicationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApplicationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application ID +func (id ApplicationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s/applications/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BatchAccountName, id.ApplicationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application ID +func (id ApplicationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftBatch", "Microsoft.Batch", "Microsoft.Batch"), + resourceids.StaticSegment("staticBatchAccounts", "batchAccounts", "batchAccounts"), + resourceids.UserSpecifiedSegment("batchAccountName", "batchAccountValue"), + resourceids.StaticSegment("staticApplications", "applications", "applications"), + resourceids.UserSpecifiedSegment("applicationName", "applicationValue"), + } +} + +// String returns a human-readable description of this Application ID +func (id ApplicationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Batch Account Name: %q", id.BatchAccountName), + fmt.Sprintf("Application Name: %q", id.ApplicationName), + } + return fmt.Sprintf("Application (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/id_batchaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/id_batchaccount.go new file mode 100644 index 000000000000..1fb2186c8bd6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/id_batchaccount.go @@ -0,0 +1,124 @@ +package application + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = BatchAccountId{} + +// BatchAccountId is a struct representing the Resource ID for a Batch Account +type BatchAccountId struct { + SubscriptionId string + ResourceGroupName string + BatchAccountName string +} + +// NewBatchAccountID returns a new BatchAccountId struct +func NewBatchAccountID(subscriptionId string, resourceGroupName string, batchAccountName string) BatchAccountId { + return BatchAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + BatchAccountName: batchAccountName, + } +} + +// ParseBatchAccountID parses 'input' into a BatchAccountId +func ParseBatchAccountID(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseBatchAccountIDInsensitively parses 'input' case-insensitively into a BatchAccountId +// note: this method should only be used for API response data and not user input +func ParseBatchAccountIDInsensitively(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateBatchAccountID checks that 'input' can be parsed as a Batch Account ID +func ValidateBatchAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseBatchAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Batch Account ID +func (id BatchAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BatchAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Batch Account ID +func (id BatchAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftBatch", "Microsoft.Batch", "Microsoft.Batch"), + resourceids.StaticSegment("staticBatchAccounts", "batchAccounts", "batchAccounts"), + resourceids.UserSpecifiedSegment("batchAccountName", "batchAccountValue"), + } +} + +// String returns a human-readable description of this Batch Account ID +func (id BatchAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Batch Account Name: %q", id.BatchAccountName), + } + return fmt.Sprintf("Batch Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_create_autorest.go new file mode 100644 index 000000000000..e0cc35d33083 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_create_autorest.go @@ -0,0 +1,69 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *Application +} + +// Create ... +func (c ApplicationClient) Create(ctx context.Context, id ApplicationId, input Application) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c ApplicationClient) preparerForCreate(ctx context.Context, id ApplicationId, input Application) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_delete_autorest.go new file mode 100644 index 000000000000..3adfaf68b49b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_delete_autorest.go @@ -0,0 +1,66 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ApplicationClient) Delete(ctx context.Context, id ApplicationId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ApplicationClient) preparerForDelete(ctx context.Context, id ApplicationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_get_autorest.go new file mode 100644 index 000000000000..694243403a5e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_get_autorest.go @@ -0,0 +1,68 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Application +} + +// Get ... +func (c ApplicationClient) Get(ctx context.Context, id ApplicationId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ApplicationClient) preparerForGet(ctx context.Context, id ApplicationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_list_autorest.go new file mode 100644 index 000000000000..1bea9a0fafb2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_list_autorest.go @@ -0,0 +1,215 @@ +package application + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Application + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Application +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Maxresults *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Maxresults != nil { + out["maxresults"] = *o.Maxresults + } + + return out +} + +// List ... +func (c ApplicationClient) List(ctx context.Context, id BatchAccountId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c ApplicationClient) preparerForList(ctx context.Context, id BatchAccountId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/applications", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c ApplicationClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Application `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c ApplicationClient) ListComplete(ctx context.Context, id BatchAccountId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, ApplicationOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ApplicationClient) ListCompleteMatchingPredicate(ctx context.Context, id BatchAccountId, options ListOperationOptions, predicate ApplicationOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Application, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_update_autorest.go new file mode 100644 index 000000000000..3b89577a8510 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/method_update_autorest.go @@ -0,0 +1,69 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Application +} + +// Update ... +func (c ApplicationClient) Update(ctx context.Context, id ApplicationId, input Application) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ApplicationClient) preparerForUpdate(ctx context.Context, id ApplicationId, input Application) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/model_application.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/model_application.go new file mode 100644 index 000000000000..0d89670c2c76 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/model_application.go @@ -0,0 +1,12 @@ +package application + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Application struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ApplicationProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/model_applicationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/model_applicationproperties.go new file mode 100644 index 000000000000..976af8379d80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/model_applicationproperties.go @@ -0,0 +1,10 @@ +package application + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationProperties struct { + AllowUpdates *bool `json:"allowUpdates,omitempty"` + DefaultVersion *string `json:"defaultVersion,omitempty"` + DisplayName *string `json:"displayName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/predicates.go new file mode 100644 index 000000000000..33ea31cd0443 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/predicates.go @@ -0,0 +1,29 @@ +package application + +type ApplicationOperationPredicate struct { + Etag *string + Id *string + Name *string + Type *string +} + +func (p ApplicationOperationPredicate) Matches(input Application) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/version.go new file mode 100644 index 000000000000..e6a7ea3aa947 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application/version.go @@ -0,0 +1,12 @@ +package application + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/application/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/README.md new file mode 100644 index 000000000000..39602788bb85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/README.md @@ -0,0 +1,190 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount` Documentation + +The `batchaccount` SDK allows for interaction with the Azure Resource Manager Service `batch` (API Version `2022-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount" +``` + + +### Client Initialization + +```go +client := batchaccount.NewBatchAccountClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `BatchAccountClient.Create` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +payload := batchaccount.BatchAccountCreateParameters{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BatchAccountClient.Delete` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `BatchAccountClient.Get` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BatchAccountClient.GetKeys` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +read, err := client.GetKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BatchAccountClient.List` + +```go +ctx := context.TODO() +id := batchaccount.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BatchAccountClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := batchaccount.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BatchAccountClient.ListOutboundNetworkDependenciesEndpoints` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +// alternatively `client.ListOutboundNetworkDependenciesEndpoints(ctx, id)` can be used to do batched pagination +items, err := client.ListOutboundNetworkDependenciesEndpointsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BatchAccountClient.RegenerateKey` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +payload := batchaccount.BatchAccountRegenerateKeyParameters{ + // ... +} + + +read, err := client.RegenerateKey(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BatchAccountClient.SynchronizeAutoStorageKeys` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +read, err := client.SynchronizeAutoStorageKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BatchAccountClient.Update` + +```go +ctx := context.TODO() +id := batchaccount.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +payload := batchaccount.BatchAccountUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/client.go new file mode 100644 index 000000000000..3fbf007c1478 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/client.go @@ -0,0 +1,18 @@ +package batchaccount + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountClient struct { + Client autorest.Client + baseUri string +} + +func NewBatchAccountClientWithBaseURI(endpoint string) BatchAccountClient { + return BatchAccountClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/constants.go new file mode 100644 index 000000000000..e19d93bf49e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/constants.go @@ -0,0 +1,282 @@ +package batchaccount + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountKeyType string + +const ( + AccountKeyTypePrimary AccountKeyType = "Primary" + AccountKeyTypeSecondary AccountKeyType = "Secondary" +) + +func PossibleValuesForAccountKeyType() []string { + return []string{ + string(AccountKeyTypePrimary), + string(AccountKeyTypeSecondary), + } +} + +func parseAccountKeyType(input string) (*AccountKeyType, error) { + vals := map[string]AccountKeyType{ + "primary": AccountKeyTypePrimary, + "secondary": AccountKeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccountKeyType(input) + return &out, nil +} + +type AuthenticationMode string + +const ( + AuthenticationModeAAD AuthenticationMode = "AAD" + AuthenticationModeSharedKey AuthenticationMode = "SharedKey" + AuthenticationModeTaskAuthenticationToken AuthenticationMode = "TaskAuthenticationToken" +) + +func PossibleValuesForAuthenticationMode() []string { + return []string{ + string(AuthenticationModeAAD), + string(AuthenticationModeSharedKey), + string(AuthenticationModeTaskAuthenticationToken), + } +} + +func parseAuthenticationMode(input string) (*AuthenticationMode, error) { + vals := map[string]AuthenticationMode{ + "aad": AuthenticationModeAAD, + "sharedkey": AuthenticationModeSharedKey, + "taskauthenticationtoken": AuthenticationModeTaskAuthenticationToken, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AuthenticationMode(input) + return &out, nil +} + +type AutoStorageAuthenticationMode string + +const ( + AutoStorageAuthenticationModeBatchAccountManagedIdentity AutoStorageAuthenticationMode = "BatchAccountManagedIdentity" + AutoStorageAuthenticationModeStorageKeys AutoStorageAuthenticationMode = "StorageKeys" +) + +func PossibleValuesForAutoStorageAuthenticationMode() []string { + return []string{ + string(AutoStorageAuthenticationModeBatchAccountManagedIdentity), + string(AutoStorageAuthenticationModeStorageKeys), + } +} + +func parseAutoStorageAuthenticationMode(input string) (*AutoStorageAuthenticationMode, error) { + vals := map[string]AutoStorageAuthenticationMode{ + "batchaccountmanagedidentity": AutoStorageAuthenticationModeBatchAccountManagedIdentity, + "storagekeys": AutoStorageAuthenticationModeStorageKeys, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutoStorageAuthenticationMode(input) + return &out, nil +} + +type KeySource string + +const ( + KeySourceMicrosoftPointBatch KeySource = "Microsoft.Batch" + KeySourceMicrosoftPointKeyVault KeySource = "Microsoft.KeyVault" +) + +func PossibleValuesForKeySource() []string { + return []string{ + string(KeySourceMicrosoftPointBatch), + string(KeySourceMicrosoftPointKeyVault), + } +} + +func parseKeySource(input string) (*KeySource, error) { + vals := map[string]KeySource{ + "microsoft.batch": KeySourceMicrosoftPointBatch, + "microsoft.keyvault": KeySourceMicrosoftPointKeyVault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeySource(input) + return &out, nil +} + +type PoolAllocationMode string + +const ( + PoolAllocationModeBatchService PoolAllocationMode = "BatchService" + PoolAllocationModeUserSubscription PoolAllocationMode = "UserSubscription" +) + +func PossibleValuesForPoolAllocationMode() []string { + return []string{ + string(PoolAllocationModeBatchService), + string(PoolAllocationModeUserSubscription), + } +} + +func parsePoolAllocationMode(input string) (*PoolAllocationMode, error) { + vals := map[string]PoolAllocationMode{ + "batchservice": PoolAllocationModeBatchService, + "usersubscription": PoolAllocationModeUserSubscription, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PoolAllocationMode(input) + return &out, nil +} + +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" + PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + string(PrivateEndpointConnectionProvisioningStateUpdating), + } +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + "updating": PrivateEndpointConnectionProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStatus string + +const ( + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkServiceConnectionStatus() []string { + return []string{ + string(PrivateLinkServiceConnectionStatusApproved), + string(PrivateLinkServiceConnectionStatusDisconnected), + string(PrivateLinkServiceConnectionStatusPending), + string(PrivateLinkServiceConnectionStatusRejected), + } +} + +func parsePrivateLinkServiceConnectionStatus(input string) (*PrivateLinkServiceConnectionStatus, error) { + vals := map[string]PrivateLinkServiceConnectionStatus{ + "approved": PrivateLinkServiceConnectionStatusApproved, + "disconnected": PrivateLinkServiceConnectionStatusDisconnected, + "pending": PrivateLinkServiceConnectionStatusPending, + "rejected": PrivateLinkServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCancelled ProvisioningState = "Cancelled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateInvalid ProvisioningState = "Invalid" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCancelled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateInvalid), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "cancelled": ProvisioningStateCancelled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "invalid": ProvisioningStateInvalid, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type PublicNetworkAccessType string + +const ( + PublicNetworkAccessTypeDisabled PublicNetworkAccessType = "Disabled" + PublicNetworkAccessTypeEnabled PublicNetworkAccessType = "Enabled" +) + +func PossibleValuesForPublicNetworkAccessType() []string { + return []string{ + string(PublicNetworkAccessTypeDisabled), + string(PublicNetworkAccessTypeEnabled), + } +} + +func parsePublicNetworkAccessType(input string) (*PublicNetworkAccessType, error) { + vals := map[string]PublicNetworkAccessType{ + "disabled": PublicNetworkAccessTypeDisabled, + "enabled": PublicNetworkAccessTypeEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccessType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/id_batchaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/id_batchaccount.go new file mode 100644 index 000000000000..1d84b5df5317 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/id_batchaccount.go @@ -0,0 +1,124 @@ +package batchaccount + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = BatchAccountId{} + +// BatchAccountId is a struct representing the Resource ID for a Batch Account +type BatchAccountId struct { + SubscriptionId string + ResourceGroupName string + BatchAccountName string +} + +// NewBatchAccountID returns a new BatchAccountId struct +func NewBatchAccountID(subscriptionId string, resourceGroupName string, batchAccountName string) BatchAccountId { + return BatchAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + BatchAccountName: batchAccountName, + } +} + +// ParseBatchAccountID parses 'input' into a BatchAccountId +func ParseBatchAccountID(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseBatchAccountIDInsensitively parses 'input' case-insensitively into a BatchAccountId +// note: this method should only be used for API response data and not user input +func ParseBatchAccountIDInsensitively(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateBatchAccountID checks that 'input' can be parsed as a Batch Account ID +func ValidateBatchAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseBatchAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Batch Account ID +func (id BatchAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BatchAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Batch Account ID +func (id BatchAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftBatch", "Microsoft.Batch", "Microsoft.Batch"), + resourceids.StaticSegment("staticBatchAccounts", "batchAccounts", "batchAccounts"), + resourceids.UserSpecifiedSegment("batchAccountName", "batchAccountValue"), + } +} + +// String returns a human-readable description of this Batch Account ID +func (id BatchAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Batch Account Name: %q", id.BatchAccountName), + } + return fmt.Sprintf("Batch Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_create_autorest.go new file mode 100644 index 000000000000..7ed7eef0c6ca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_create_autorest.go @@ -0,0 +1,79 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c BatchAccountClient) Create(ctx context.Context, id BatchAccountId, input BatchAccountCreateParameters) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c BatchAccountClient) CreateThenPoll(ctx context.Context, id BatchAccountId, input BatchAccountCreateParameters) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c BatchAccountClient) preparerForCreate(ctx context.Context, id BatchAccountId, input BatchAccountCreateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c BatchAccountClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_delete_autorest.go new file mode 100644 index 000000000000..31f92f2877ed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_delete_autorest.go @@ -0,0 +1,78 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c BatchAccountClient) Delete(ctx context.Context, id BatchAccountId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c BatchAccountClient) DeleteThenPoll(ctx context.Context, id BatchAccountId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c BatchAccountClient) preparerForDelete(ctx context.Context, id BatchAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c BatchAccountClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_get_autorest.go new file mode 100644 index 000000000000..020c1fd7006b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_get_autorest.go @@ -0,0 +1,68 @@ +package batchaccount + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *BatchAccount +} + +// Get ... +func (c BatchAccountClient) Get(ctx context.Context, id BatchAccountId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c BatchAccountClient) preparerForGet(ctx context.Context, id BatchAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_getkeys_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_getkeys_autorest.go new file mode 100644 index 000000000000..32847126b3e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_getkeys_autorest.go @@ -0,0 +1,69 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetKeysOperationResponse struct { + HttpResponse *http.Response + Model *BatchAccountKeys +} + +// GetKeys ... +func (c BatchAccountClient) GetKeys(ctx context.Context, id BatchAccountId) (result GetKeysOperationResponse, err error) { + req, err := c.preparerForGetKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "GetKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "GetKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "GetKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetKeys prepares the GetKeys request. +func (c BatchAccountClient) preparerForGetKeys(ctx context.Context, id BatchAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetKeys handles the response to the GetKeys request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForGetKeys(resp *http.Response) (result GetKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_list_autorest.go new file mode 100644 index 000000000000..01aa422def4e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_list_autorest.go @@ -0,0 +1,187 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]BatchAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []BatchAccount +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c BatchAccountClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c BatchAccountClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Batch/batchAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c BatchAccountClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []BatchAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c BatchAccountClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, BatchAccountOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BatchAccountClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate BatchAccountOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]BatchAccount, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..84e3e857b30d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]BatchAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []BatchAccount +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c BatchAccountClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c BatchAccountClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Batch/batchAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c BatchAccountClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []BatchAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c BatchAccountClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, BatchAccountOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BatchAccountClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate BatchAccountOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]BatchAccount, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_listoutboundnetworkdependenciesendpoints_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_listoutboundnetworkdependenciesendpoints_autorest.go new file mode 100644 index 000000000000..2ebbe34da94f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_listoutboundnetworkdependenciesendpoints_autorest.go @@ -0,0 +1,186 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOutboundNetworkDependenciesEndpointsOperationResponse struct { + HttpResponse *http.Response + Model *[]OutboundEnvironmentEndpoint + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOutboundNetworkDependenciesEndpointsOperationResponse, error) +} + +type ListOutboundNetworkDependenciesEndpointsCompleteResult struct { + Items []OutboundEnvironmentEndpoint +} + +func (r ListOutboundNetworkDependenciesEndpointsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOutboundNetworkDependenciesEndpointsOperationResponse) LoadMore(ctx context.Context) (resp ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListOutboundNetworkDependenciesEndpoints ... +func (c BatchAccountClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, id BatchAccountId) (resp ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + req, err := c.preparerForListOutboundNetworkDependenciesEndpoints(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListOutboundNetworkDependenciesEndpoints(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListOutboundNetworkDependenciesEndpoints prepares the ListOutboundNetworkDependenciesEndpoints request. +func (c BatchAccountClient) preparerForListOutboundNetworkDependenciesEndpoints(ctx context.Context, id BatchAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/outboundNetworkDependenciesEndpoints", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListOutboundNetworkDependenciesEndpointsWithNextLink prepares the ListOutboundNetworkDependenciesEndpoints request with the given nextLink token. +func (c BatchAccountClient) preparerForListOutboundNetworkDependenciesEndpointsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListOutboundNetworkDependenciesEndpoints handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForListOutboundNetworkDependenciesEndpoints(resp *http.Response) (result ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + type page struct { + Values []OutboundEnvironmentEndpoint `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + req, err := c.preparerForListOutboundNetworkDependenciesEndpointsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListOutboundNetworkDependenciesEndpoints(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "ListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListOutboundNetworkDependenciesEndpointsComplete retrieves all of the results into a single object +func (c BatchAccountClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, id BatchAccountId) (ListOutboundNetworkDependenciesEndpointsCompleteResult, error) { + return c.ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx, id, OutboundEnvironmentEndpointOperationPredicate{}) +} + +// ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BatchAccountClient) ListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx context.Context, id BatchAccountId, predicate OutboundEnvironmentEndpointOperationPredicate) (resp ListOutboundNetworkDependenciesEndpointsCompleteResult, err error) { + items := make([]OutboundEnvironmentEndpoint, 0) + + page, err := c.ListOutboundNetworkDependenciesEndpoints(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListOutboundNetworkDependenciesEndpointsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_regeneratekey_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_regeneratekey_autorest.go new file mode 100644 index 000000000000..ac0b56ea6a10 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_regeneratekey_autorest.go @@ -0,0 +1,70 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyOperationResponse struct { + HttpResponse *http.Response + Model *BatchAccountKeys +} + +// RegenerateKey ... +func (c BatchAccountClient) RegenerateKey(ctx context.Context, id BatchAccountId, input BatchAccountRegenerateKeyParameters) (result RegenerateKeyOperationResponse, err error) { + req, err := c.preparerForRegenerateKey(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "RegenerateKey", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRegenerateKey(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "RegenerateKey", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRegenerateKey prepares the RegenerateKey request. +func (c BatchAccountClient) preparerForRegenerateKey(ctx context.Context, id BatchAccountId, input BatchAccountRegenerateKeyParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKeys", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRegenerateKey handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForRegenerateKey(resp *http.Response) (result RegenerateKeyOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_synchronizeautostoragekeys_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_synchronizeautostoragekeys_autorest.go new file mode 100644 index 000000000000..511175d63a2f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_synchronizeautostoragekeys_autorest.go @@ -0,0 +1,67 @@ +package batchaccount + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SynchronizeAutoStorageKeysOperationResponse struct { + HttpResponse *http.Response +} + +// SynchronizeAutoStorageKeys ... +func (c BatchAccountClient) SynchronizeAutoStorageKeys(ctx context.Context, id BatchAccountId) (result SynchronizeAutoStorageKeysOperationResponse, err error) { + req, err := c.preparerForSynchronizeAutoStorageKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "SynchronizeAutoStorageKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "SynchronizeAutoStorageKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSynchronizeAutoStorageKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "SynchronizeAutoStorageKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSynchronizeAutoStorageKeys prepares the SynchronizeAutoStorageKeys request. +func (c BatchAccountClient) preparerForSynchronizeAutoStorageKeys(ctx context.Context, id BatchAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/syncAutoStorageKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSynchronizeAutoStorageKeys handles the response to the SynchronizeAutoStorageKeys request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForSynchronizeAutoStorageKeys(resp *http.Response) (result SynchronizeAutoStorageKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_update_autorest.go new file mode 100644 index 000000000000..1b8c38994eb5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/method_update_autorest.go @@ -0,0 +1,69 @@ +package batchaccount + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *BatchAccount +} + +// Update ... +func (c BatchAccountClient) Update(ctx context.Context, id BatchAccountId, input BatchAccountUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "batchaccount.BatchAccountClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c BatchAccountClient) preparerForUpdate(ctx context.Context, id BatchAccountId, input BatchAccountUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c BatchAccountClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_autostoragebaseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_autostoragebaseproperties.go new file mode 100644 index 000000000000..9eedd3fe954b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_autostoragebaseproperties.go @@ -0,0 +1,10 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutoStorageBaseProperties struct { + AuthenticationMode *AutoStorageAuthenticationMode `json:"authenticationMode,omitempty"` + NodeIdentityReference *ComputeNodeIdentityReference `json:"nodeIdentityReference,omitempty"` + StorageAccountId *string `json:"storageAccountId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_autostorageproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_autostorageproperties.go new file mode 100644 index 000000000000..a0da8c8ba396 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_autostorageproperties.go @@ -0,0 +1,26 @@ +package batchaccount + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutoStorageProperties struct { + AuthenticationMode *AutoStorageAuthenticationMode `json:"authenticationMode,omitempty"` + LastKeySync string `json:"lastKeySync"` + NodeIdentityReference *ComputeNodeIdentityReference `json:"nodeIdentityReference,omitempty"` + StorageAccountId string `json:"storageAccountId"` +} + +func (o *AutoStorageProperties) GetLastKeySyncAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.LastKeySync, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutoStorageProperties) SetLastKeySyncAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastKeySync = formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccount.go new file mode 100644 index 000000000000..aa017d4a2434 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccount.go @@ -0,0 +1,18 @@ +package batchaccount + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccount struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemOrUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BatchAccountProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountcreateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountcreateparameters.go new file mode 100644 index 000000000000..d4f973e727a9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountcreateparameters.go @@ -0,0 +1,15 @@ +package batchaccount + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountCreateParameters struct { + Identity *identity.SystemOrUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Properties *BatchAccountCreateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountcreateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountcreateproperties.go new file mode 100644 index 000000000000..87fd212ccba1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountcreateproperties.go @@ -0,0 +1,13 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountCreateProperties struct { + AllowedAuthenticationModes *[]AuthenticationMode `json:"allowedAuthenticationModes,omitempty"` + AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` + Encryption *EncryptionProperties `json:"encryption,omitempty"` + KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` + PoolAllocationMode *PoolAllocationMode `json:"poolAllocationMode,omitempty"` + PublicNetworkAccess *PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountkeys.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountkeys.go new file mode 100644 index 000000000000..791eda711d81 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountkeys.go @@ -0,0 +1,10 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountKeys struct { + AccountName *string `json:"accountName,omitempty"` + Primary *string `json:"primary,omitempty"` + Secondary *string `json:"secondary,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountproperties.go new file mode 100644 index 000000000000..cbbfd212e931 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountproperties.go @@ -0,0 +1,22 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountProperties struct { + AccountEndpoint *string `json:"accountEndpoint,omitempty"` + ActiveJobAndJobScheduleQuota *int64 `json:"activeJobAndJobScheduleQuota,omitempty"` + AllowedAuthenticationModes *[]AuthenticationMode `json:"allowedAuthenticationModes,omitempty"` + AutoStorage *AutoStorageProperties `json:"autoStorage,omitempty"` + DedicatedCoreQuota *int64 `json:"dedicatedCoreQuota,omitempty"` + DedicatedCoreQuotaPerVMFamily *[]VirtualMachineFamilyCoreQuota `json:"dedicatedCoreQuotaPerVMFamily,omitempty"` + DedicatedCoreQuotaPerVMFamilyEnforced *bool `json:"dedicatedCoreQuotaPerVMFamilyEnforced,omitempty"` + Encryption *EncryptionProperties `json:"encryption,omitempty"` + KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` + LowPriorityCoreQuota *int64 `json:"lowPriorityCoreQuota,omitempty"` + PoolAllocationMode *PoolAllocationMode `json:"poolAllocationMode,omitempty"` + PoolQuota *int64 `json:"poolQuota,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountregeneratekeyparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountregeneratekeyparameters.go new file mode 100644 index 000000000000..1eea03ff5f24 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountregeneratekeyparameters.go @@ -0,0 +1,8 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountRegenerateKeyParameters struct { + KeyName AccountKeyType `json:"keyName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountupdateparameters.go new file mode 100644 index 000000000000..90422490141a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountupdateparameters.go @@ -0,0 +1,14 @@ +package batchaccount + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountUpdateParameters struct { + Identity *identity.SystemOrUserAssignedMap `json:"identity,omitempty"` + Properties *BatchAccountUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountupdateproperties.go new file mode 100644 index 000000000000..becd3f6fd645 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_batchaccountupdateproperties.go @@ -0,0 +1,10 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchAccountUpdateProperties struct { + AllowedAuthenticationModes *[]AuthenticationMode `json:"allowedAuthenticationModes,omitempty"` + AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` + Encryption *EncryptionProperties `json:"encryption,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_computenodeidentityreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_computenodeidentityreference.go new file mode 100644 index 000000000000..99f063c16b7c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_computenodeidentityreference.go @@ -0,0 +1,8 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComputeNodeIdentityReference struct { + ResourceId *string `json:"resourceId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_encryptionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_encryptionproperties.go new file mode 100644 index 000000000000..018f83c27e56 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_encryptionproperties.go @@ -0,0 +1,9 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionProperties struct { + KeySource *KeySource `json:"keySource,omitempty"` + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_endpointdependency.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_endpointdependency.go new file mode 100644 index 000000000000..2b0ee92ad27b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_endpointdependency.go @@ -0,0 +1,10 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointDependency struct { + Description *string `json:"description,omitempty"` + DomainName *string `json:"domainName,omitempty"` + EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_endpointdetail.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_endpointdetail.go new file mode 100644 index 000000000000..521a439d6be8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_endpointdetail.go @@ -0,0 +1,8 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointDetail struct { + Port *int64 `json:"port,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_keyvaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_keyvaultproperties.go new file mode 100644 index 000000000000..b11e9e9ec8c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_keyvaultproperties.go @@ -0,0 +1,8 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultProperties struct { + KeyIdentifier *string `json:"keyIdentifier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_keyvaultreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_keyvaultreference.go new file mode 100644 index 000000000000..e3d275bac71e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_keyvaultreference.go @@ -0,0 +1,9 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultReference struct { + Id string `json:"id"` + Url string `json:"url"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_outboundenvironmentendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_outboundenvironmentendpoint.go new file mode 100644 index 000000000000..b0d7c922f54e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_outboundenvironmentendpoint.go @@ -0,0 +1,9 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OutboundEnvironmentEndpoint struct { + Category *string `json:"category,omitempty"` + Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpoint.go new file mode 100644 index 000000000000..e60387e8f83e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpoint.go @@ -0,0 +1,8 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpointconnection.go new file mode 100644 index 000000000000..282e17657399 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpointconnection.go @@ -0,0 +1,12 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpointconnectionproperties.go new file mode 100644 index 000000000000..1b197a8f0937 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privatelinkserviceconnectionstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privatelinkserviceconnectionstate.go new file mode 100644 index 000000000000..72ec30f7c334 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionRequired *string `json:"actionRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status PrivateLinkServiceConnectionStatus `json:"status"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_virtualmachinefamilycorequota.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_virtualmachinefamilycorequota.go new file mode 100644 index 000000000000..f1812c2636ee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/model_virtualmachinefamilycorequota.go @@ -0,0 +1,9 @@ +package batchaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineFamilyCoreQuota struct { + CoreQuota *int64 `json:"coreQuota,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/predicates.go new file mode 100644 index 000000000000..075bc68a9c9c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/predicates.go @@ -0,0 +1,42 @@ +package batchaccount + +type BatchAccountOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p BatchAccountOperationPredicate) Matches(input BatchAccount) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type OutboundEnvironmentEndpointOperationPredicate struct { + Category *string +} + +func (p OutboundEnvironmentEndpointOperationPredicate) Matches(input OutboundEnvironmentEndpoint) bool { + + if p.Category != nil && (input.Category == nil && *p.Category != *input.Category) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/version.go new file mode 100644 index 000000000000..4366c5c0ebdf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount/version.go @@ -0,0 +1,12 @@ +package batchaccount + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/batchaccount/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/README.md new file mode 100644 index 000000000000..dcb4e42ddcdc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/README.md @@ -0,0 +1,123 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate` Documentation + +The `certificate` SDK allows for interaction with the Azure Resource Manager Service `batch` (API Version `2022-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate" +``` + + +### Client Initialization + +```go +client := certificate.NewCertificateClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CertificateClient.CancelDeletion` + +```go +ctx := context.TODO() +id := certificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "certificateValue") + +read, err := client.CancelDeletion(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CertificateClient.Create` + +```go +ctx := context.TODO() +id := certificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "certificateValue") + +payload := certificate.CertificateCreateOrUpdateParameters{ + // ... +} + + +read, err := client.Create(ctx, id, payload, certificate.DefaultCreateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CertificateClient.Delete` + +```go +ctx := context.TODO() +id := certificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "certificateValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CertificateClient.Get` + +```go +ctx := context.TODO() +id := certificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "certificateValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CertificateClient.ListByBatchAccount` + +```go +ctx := context.TODO() +id := certificate.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +// alternatively `client.ListByBatchAccount(ctx, id, certificate.DefaultListByBatchAccountOperationOptions())` can be used to do batched pagination +items, err := client.ListByBatchAccountComplete(ctx, id, certificate.DefaultListByBatchAccountOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CertificateClient.Update` + +```go +ctx := context.TODO() +id := certificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "certificateValue") + +payload := certificate.CertificateCreateOrUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload, certificate.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/client.go new file mode 100644 index 000000000000..f304bfc665dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/client.go @@ -0,0 +1,18 @@ +package certificate + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateClient struct { + Client autorest.Client + baseUri string +} + +func NewCertificateClientWithBaseURI(endpoint string) CertificateClient { + return CertificateClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/constants.go new file mode 100644 index 000000000000..0eb06a7c5bed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/constants.go @@ -0,0 +1,65 @@ +package certificate + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateFormat string + +const ( + CertificateFormatCer CertificateFormat = "Cer" + CertificateFormatPfx CertificateFormat = "Pfx" +) + +func PossibleValuesForCertificateFormat() []string { + return []string{ + string(CertificateFormatCer), + string(CertificateFormatPfx), + } +} + +func parseCertificateFormat(input string) (*CertificateFormat, error) { + vals := map[string]CertificateFormat{ + "cer": CertificateFormatCer, + "pfx": CertificateFormatPfx, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CertificateFormat(input) + return &out, nil +} + +type CertificateProvisioningState string + +const ( + CertificateProvisioningStateDeleting CertificateProvisioningState = "Deleting" + CertificateProvisioningStateFailed CertificateProvisioningState = "Failed" + CertificateProvisioningStateSucceeded CertificateProvisioningState = "Succeeded" +) + +func PossibleValuesForCertificateProvisioningState() []string { + return []string{ + string(CertificateProvisioningStateDeleting), + string(CertificateProvisioningStateFailed), + string(CertificateProvisioningStateSucceeded), + } +} + +func parseCertificateProvisioningState(input string) (*CertificateProvisioningState, error) { + vals := map[string]CertificateProvisioningState{ + "deleting": CertificateProvisioningStateDeleting, + "failed": CertificateProvisioningStateFailed, + "succeeded": CertificateProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CertificateProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/id_batchaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/id_batchaccount.go new file mode 100644 index 000000000000..2c717ddb98f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/id_batchaccount.go @@ -0,0 +1,124 @@ +package certificate + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = BatchAccountId{} + +// BatchAccountId is a struct representing the Resource ID for a Batch Account +type BatchAccountId struct { + SubscriptionId string + ResourceGroupName string + BatchAccountName string +} + +// NewBatchAccountID returns a new BatchAccountId struct +func NewBatchAccountID(subscriptionId string, resourceGroupName string, batchAccountName string) BatchAccountId { + return BatchAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + BatchAccountName: batchAccountName, + } +} + +// ParseBatchAccountID parses 'input' into a BatchAccountId +func ParseBatchAccountID(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseBatchAccountIDInsensitively parses 'input' case-insensitively into a BatchAccountId +// note: this method should only be used for API response data and not user input +func ParseBatchAccountIDInsensitively(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateBatchAccountID checks that 'input' can be parsed as a Batch Account ID +func ValidateBatchAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseBatchAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Batch Account ID +func (id BatchAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BatchAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Batch Account ID +func (id BatchAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftBatch", "Microsoft.Batch", "Microsoft.Batch"), + resourceids.StaticSegment("staticBatchAccounts", "batchAccounts", "batchAccounts"), + resourceids.UserSpecifiedSegment("batchAccountName", "batchAccountValue"), + } +} + +// String returns a human-readable description of this Batch Account ID +func (id BatchAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Batch Account Name: %q", id.BatchAccountName), + } + return fmt.Sprintf("Batch Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/id_certificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/id_certificate.go new file mode 100644 index 000000000000..73ccd308ef9d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/id_certificate.go @@ -0,0 +1,137 @@ +package certificate + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = CertificateId{} + +// CertificateId is a struct representing the Resource ID for a Certificate +type CertificateId struct { + SubscriptionId string + ResourceGroupName string + BatchAccountName string + CertificateName string +} + +// NewCertificateID returns a new CertificateId struct +func NewCertificateID(subscriptionId string, resourceGroupName string, batchAccountName string, certificateName string) CertificateId { + return CertificateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + BatchAccountName: batchAccountName, + CertificateName: certificateName, + } +} + +// ParseCertificateID parses 'input' into a CertificateId +func ParseCertificateID(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(CertificateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CertificateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { + return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseCertificateIDInsensitively parses 'input' case-insensitively into a CertificateId +// note: this method should only be used for API response data and not user input +func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(CertificateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CertificateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { + return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateCertificateID checks that 'input' can be parsed as a Certificate ID +func ValidateCertificateID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCertificateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Certificate ID +func (id CertificateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s/certificates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BatchAccountName, id.CertificateName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Certificate ID +func (id CertificateId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftBatch", "Microsoft.Batch", "Microsoft.Batch"), + resourceids.StaticSegment("staticBatchAccounts", "batchAccounts", "batchAccounts"), + resourceids.UserSpecifiedSegment("batchAccountName", "batchAccountValue"), + resourceids.StaticSegment("staticCertificates", "certificates", "certificates"), + resourceids.UserSpecifiedSegment("certificateName", "certificateValue"), + } +} + +// String returns a human-readable description of this Certificate ID +func (id CertificateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Batch Account Name: %q", id.BatchAccountName), + fmt.Sprintf("Certificate Name: %q", id.CertificateName), + } + return fmt.Sprintf("Certificate (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_canceldeletion_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_canceldeletion_autorest.go new file mode 100644 index 000000000000..e2662040d629 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_canceldeletion_autorest.go @@ -0,0 +1,69 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CancelDeletionOperationResponse struct { + HttpResponse *http.Response + Model *Certificate +} + +// CancelDeletion ... +func (c CertificateClient) CancelDeletion(ctx context.Context, id CertificateId) (result CancelDeletionOperationResponse, err error) { + req, err := c.preparerForCancelDeletion(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "CancelDeletion", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "CancelDeletion", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCancelDeletion(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "CancelDeletion", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCancelDeletion prepares the CancelDeletion request. +func (c CertificateClient) preparerForCancelDeletion(ctx context.Context, id CertificateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/cancelDelete", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCancelDeletion handles the response to the CancelDeletion request. The method always +// closes the http.Response Body. +func (c CertificateClient) responderForCancelDeletion(resp *http.Response) (result CancelDeletionOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_create_autorest.go new file mode 100644 index 000000000000..1ed47e24c77c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_create_autorest.go @@ -0,0 +1,103 @@ +package certificate + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *Certificate +} + +type CreateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOperationOptions() CreateOperationOptions { + return CreateOperationOptions{} +} + +func (o CreateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + if o.IfNoneMatch != nil { + out["If-None-Match"] = *o.IfNoneMatch + } + + return out +} + +func (o CreateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Create ... +func (c CertificateClient) Create(ctx context.Context, id CertificateId, input CertificateCreateOrUpdateParameters, options CreateOperationOptions) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c CertificateClient) preparerForCreate(ctx context.Context, id CertificateId, input CertificateCreateOrUpdateParameters, options CreateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c CertificateClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_delete_autorest.go new file mode 100644 index 000000000000..7df2c763a7fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_delete_autorest.go @@ -0,0 +1,78 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c CertificateClient) Delete(ctx context.Context, id CertificateId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c CertificateClient) DeleteThenPoll(ctx context.Context, id CertificateId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c CertificateClient) preparerForDelete(ctx context.Context, id CertificateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c CertificateClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_get_autorest.go new file mode 100644 index 000000000000..450bf969bbe7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_get_autorest.go @@ -0,0 +1,68 @@ +package certificate + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Certificate +} + +// Get ... +func (c CertificateClient) Get(ctx context.Context, id CertificateId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c CertificateClient) preparerForGet(ctx context.Context, id CertificateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c CertificateClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_listbybatchaccount_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_listbybatchaccount_autorest.go new file mode 100644 index 000000000000..792381d217a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_listbybatchaccount_autorest.go @@ -0,0 +1,225 @@ +package certificate + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByBatchAccountOperationResponse struct { + HttpResponse *http.Response + Model *[]Certificate + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByBatchAccountOperationResponse, error) +} + +type ListByBatchAccountCompleteResult struct { + Items []Certificate +} + +func (r ListByBatchAccountOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByBatchAccountOperationResponse) LoadMore(ctx context.Context) (resp ListByBatchAccountOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByBatchAccountOperationOptions struct { + Filter *string + Maxresults *int64 + Select *string +} + +func DefaultListByBatchAccountOperationOptions() ListByBatchAccountOperationOptions { + return ListByBatchAccountOperationOptions{} +} + +func (o ListByBatchAccountOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByBatchAccountOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Maxresults != nil { + out["maxresults"] = *o.Maxresults + } + + if o.Select != nil { + out["$select"] = *o.Select + } + + return out +} + +// ListByBatchAccount ... +func (c CertificateClient) ListByBatchAccount(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions) (resp ListByBatchAccountOperationResponse, err error) { + req, err := c.preparerForListByBatchAccount(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByBatchAccount", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByBatchAccount(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByBatchAccount", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByBatchAccount prepares the ListByBatchAccount request. +func (c CertificateClient) preparerForListByBatchAccount(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/certificates", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByBatchAccountWithNextLink prepares the ListByBatchAccount request with the given nextLink token. +func (c CertificateClient) preparerForListByBatchAccountWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByBatchAccount handles the response to the ListByBatchAccount request. The method always +// closes the http.Response Body. +func (c CertificateClient) responderForListByBatchAccount(resp *http.Response) (result ListByBatchAccountOperationResponse, err error) { + type page struct { + Values []Certificate `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByBatchAccountOperationResponse, err error) { + req, err := c.preparerForListByBatchAccountWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByBatchAccount", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByBatchAccount(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "ListByBatchAccount", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByBatchAccountComplete retrieves all of the results into a single object +func (c CertificateClient) ListByBatchAccountComplete(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions) (ListByBatchAccountCompleteResult, error) { + return c.ListByBatchAccountCompleteMatchingPredicate(ctx, id, options, CertificateOperationPredicate{}) +} + +// ListByBatchAccountCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c CertificateClient) ListByBatchAccountCompleteMatchingPredicate(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions, predicate CertificateOperationPredicate) (resp ListByBatchAccountCompleteResult, err error) { + items := make([]Certificate, 0) + + page, err := c.ListByBatchAccount(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByBatchAccountCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_update_autorest.go new file mode 100644 index 000000000000..5bcbc4cad348 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/method_update_autorest.go @@ -0,0 +1,98 @@ +package certificate + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Certificate +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Update ... +func (c CertificateClient) Update(ctx context.Context, id CertificateId, input CertificateCreateOrUpdateParameters, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificate.CertificateClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c CertificateClient) preparerForUpdate(ctx context.Context, id CertificateId, input CertificateCreateOrUpdateParameters, options UpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c CertificateClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificate.go new file mode 100644 index 000000000000..5218b0449e6a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificate.go @@ -0,0 +1,12 @@ +package certificate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Certificate struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *CertificateProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificatecreateorupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificatecreateorupdateparameters.go new file mode 100644 index 000000000000..1d50bc058ad7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificatecreateorupdateparameters.go @@ -0,0 +1,12 @@ +package certificate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateCreateOrUpdateParameters struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *CertificateCreateOrUpdateProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificatecreateorupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificatecreateorupdateproperties.go new file mode 100644 index 000000000000..5af96095ec4d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificatecreateorupdateproperties.go @@ -0,0 +1,12 @@ +package certificate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateCreateOrUpdateProperties struct { + Data string `json:"data"` + Format *CertificateFormat `json:"format,omitempty"` + Password *string `json:"password,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificateproperties.go new file mode 100644 index 000000000000..01b0c5dc1279 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_certificateproperties.go @@ -0,0 +1,46 @@ +package certificate + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateProperties struct { + DeleteCertificateError *DeleteCertificateError `json:"deleteCertificateError,omitempty"` + Format *CertificateFormat `json:"format,omitempty"` + PreviousProvisioningState *CertificateProvisioningState `json:"previousProvisioningState,omitempty"` + PreviousProvisioningStateTransitionTime *string `json:"previousProvisioningStateTransitionTime,omitempty"` + ProvisioningState *CertificateProvisioningState `json:"provisioningState,omitempty"` + ProvisioningStateTransitionTime *string `json:"provisioningStateTransitionTime,omitempty"` + PublicData *string `json:"publicData,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` +} + +func (o *CertificateProperties) GetPreviousProvisioningStateTransitionTimeAsTime() (*time.Time, error) { + if o.PreviousProvisioningStateTransitionTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PreviousProvisioningStateTransitionTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *CertificateProperties) SetPreviousProvisioningStateTransitionTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PreviousProvisioningStateTransitionTime = &formatted +} + +func (o *CertificateProperties) GetProvisioningStateTransitionTimeAsTime() (*time.Time, error) { + if o.ProvisioningStateTransitionTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ProvisioningStateTransitionTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *CertificateProperties) SetProvisioningStateTransitionTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ProvisioningStateTransitionTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_deletecertificateerror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_deletecertificateerror.go new file mode 100644 index 000000000000..1e12424fff41 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/model_deletecertificateerror.go @@ -0,0 +1,11 @@ +package certificate + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteCertificateError struct { + Code string `json:"code"` + Details *[]DeleteCertificateError `json:"details,omitempty"` + Message string `json:"message"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/predicates.go new file mode 100644 index 000000000000..9ba6c8179248 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/predicates.go @@ -0,0 +1,29 @@ +package certificate + +type CertificateOperationPredicate struct { + Etag *string + Id *string + Name *string + Type *string +} + +func (p CertificateOperationPredicate) Matches(input Certificate) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/version.go new file mode 100644 index 000000000000..a3082d8db622 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate/version.go @@ -0,0 +1,12 @@ +package certificate + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/certificate/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/README.md new file mode 100644 index 000000000000..d6582233c32b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/README.md @@ -0,0 +1,139 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool` Documentation + +The `pool` SDK allows for interaction with the Azure Resource Manager Service `batch` (API Version `2022-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool" +``` + + +### Client Initialization + +```go +client := pool.NewPoolClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PoolClient.Create` + +```go +ctx := context.TODO() +id := pool.NewPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "poolValue") + +payload := pool.Pool{ + // ... +} + + +read, err := client.Create(ctx, id, payload, pool.DefaultCreateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PoolClient.Delete` + +```go +ctx := context.TODO() +id := pool.NewPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "poolValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `PoolClient.DisableAutoScale` + +```go +ctx := context.TODO() +id := pool.NewPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "poolValue") + +read, err := client.DisableAutoScale(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PoolClient.Get` + +```go +ctx := context.TODO() +id := pool.NewPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "poolValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PoolClient.ListByBatchAccount` + +```go +ctx := context.TODO() +id := pool.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") + +// alternatively `client.ListByBatchAccount(ctx, id, pool.DefaultListByBatchAccountOperationOptions())` can be used to do batched pagination +items, err := client.ListByBatchAccountComplete(ctx, id, pool.DefaultListByBatchAccountOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `PoolClient.StopResize` + +```go +ctx := context.TODO() +id := pool.NewPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "poolValue") + +read, err := client.StopResize(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PoolClient.Update` + +```go +ctx := context.TODO() +id := pool.NewPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "poolValue") + +payload := pool.Pool{ + // ... +} + + +read, err := client.Update(ctx, id, payload, pool.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/client.go new file mode 100644 index 000000000000..f08365830970 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/client.go @@ -0,0 +1,18 @@ +package pool + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolClient struct { + Client autorest.Client + baseUri string +} + +func NewPoolClientWithBaseURI(endpoint string) PoolClient { + return PoolClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/constants.go new file mode 100644 index 000000000000..5936d3c1716e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/constants.go @@ -0,0 +1,606 @@ +package pool + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AllocationState string + +const ( + AllocationStateResizing AllocationState = "Resizing" + AllocationStateSteady AllocationState = "Steady" + AllocationStateStopping AllocationState = "Stopping" +) + +func PossibleValuesForAllocationState() []string { + return []string{ + string(AllocationStateResizing), + string(AllocationStateSteady), + string(AllocationStateStopping), + } +} + +func parseAllocationState(input string) (*AllocationState, error) { + vals := map[string]AllocationState{ + "resizing": AllocationStateResizing, + "steady": AllocationStateSteady, + "stopping": AllocationStateStopping, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AllocationState(input) + return &out, nil +} + +type AutoUserScope string + +const ( + AutoUserScopePool AutoUserScope = "Pool" + AutoUserScopeTask AutoUserScope = "Task" +) + +func PossibleValuesForAutoUserScope() []string { + return []string{ + string(AutoUserScopePool), + string(AutoUserScopeTask), + } +} + +func parseAutoUserScope(input string) (*AutoUserScope, error) { + vals := map[string]AutoUserScope{ + "pool": AutoUserScopePool, + "task": AutoUserScopeTask, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutoUserScope(input) + return &out, nil +} + +type CachingType string + +const ( + CachingTypeNone CachingType = "None" + CachingTypeReadOnly CachingType = "ReadOnly" + CachingTypeReadWrite CachingType = "ReadWrite" +) + +func PossibleValuesForCachingType() []string { + return []string{ + string(CachingTypeNone), + string(CachingTypeReadOnly), + string(CachingTypeReadWrite), + } +} + +func parseCachingType(input string) (*CachingType, error) { + vals := map[string]CachingType{ + "none": CachingTypeNone, + "readonly": CachingTypeReadOnly, + "readwrite": CachingTypeReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CachingType(input) + return &out, nil +} + +type CertificateStoreLocation string + +const ( + CertificateStoreLocationCurrentUser CertificateStoreLocation = "CurrentUser" + CertificateStoreLocationLocalMachine CertificateStoreLocation = "LocalMachine" +) + +func PossibleValuesForCertificateStoreLocation() []string { + return []string{ + string(CertificateStoreLocationCurrentUser), + string(CertificateStoreLocationLocalMachine), + } +} + +func parseCertificateStoreLocation(input string) (*CertificateStoreLocation, error) { + vals := map[string]CertificateStoreLocation{ + "currentuser": CertificateStoreLocationCurrentUser, + "localmachine": CertificateStoreLocationLocalMachine, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CertificateStoreLocation(input) + return &out, nil +} + +type CertificateVisibility string + +const ( + CertificateVisibilityRemoteUser CertificateVisibility = "RemoteUser" + CertificateVisibilityStartTask CertificateVisibility = "StartTask" + CertificateVisibilityTask CertificateVisibility = "Task" +) + +func PossibleValuesForCertificateVisibility() []string { + return []string{ + string(CertificateVisibilityRemoteUser), + string(CertificateVisibilityStartTask), + string(CertificateVisibilityTask), + } +} + +func parseCertificateVisibility(input string) (*CertificateVisibility, error) { + vals := map[string]CertificateVisibility{ + "remoteuser": CertificateVisibilityRemoteUser, + "starttask": CertificateVisibilityStartTask, + "task": CertificateVisibilityTask, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CertificateVisibility(input) + return &out, nil +} + +type ComputeNodeDeallocationOption string + +const ( + ComputeNodeDeallocationOptionRequeue ComputeNodeDeallocationOption = "Requeue" + ComputeNodeDeallocationOptionRetainedData ComputeNodeDeallocationOption = "RetainedData" + ComputeNodeDeallocationOptionTaskCompletion ComputeNodeDeallocationOption = "TaskCompletion" + ComputeNodeDeallocationOptionTerminate ComputeNodeDeallocationOption = "Terminate" +) + +func PossibleValuesForComputeNodeDeallocationOption() []string { + return []string{ + string(ComputeNodeDeallocationOptionRequeue), + string(ComputeNodeDeallocationOptionRetainedData), + string(ComputeNodeDeallocationOptionTaskCompletion), + string(ComputeNodeDeallocationOptionTerminate), + } +} + +func parseComputeNodeDeallocationOption(input string) (*ComputeNodeDeallocationOption, error) { + vals := map[string]ComputeNodeDeallocationOption{ + "requeue": ComputeNodeDeallocationOptionRequeue, + "retaineddata": ComputeNodeDeallocationOptionRetainedData, + "taskcompletion": ComputeNodeDeallocationOptionTaskCompletion, + "terminate": ComputeNodeDeallocationOptionTerminate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComputeNodeDeallocationOption(input) + return &out, nil +} + +type ComputeNodeFillType string + +const ( + ComputeNodeFillTypePack ComputeNodeFillType = "Pack" + ComputeNodeFillTypeSpread ComputeNodeFillType = "Spread" +) + +func PossibleValuesForComputeNodeFillType() []string { + return []string{ + string(ComputeNodeFillTypePack), + string(ComputeNodeFillTypeSpread), + } +} + +func parseComputeNodeFillType(input string) (*ComputeNodeFillType, error) { + vals := map[string]ComputeNodeFillType{ + "pack": ComputeNodeFillTypePack, + "spread": ComputeNodeFillTypeSpread, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComputeNodeFillType(input) + return &out, nil +} + +type ContainerType string + +const ( + ContainerTypeDockerCompatible ContainerType = "DockerCompatible" +) + +func PossibleValuesForContainerType() []string { + return []string{ + string(ContainerTypeDockerCompatible), + } +} + +func parseContainerType(input string) (*ContainerType, error) { + vals := map[string]ContainerType{ + "dockercompatible": ContainerTypeDockerCompatible, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerType(input) + return &out, nil +} + +type ContainerWorkingDirectory string + +const ( + ContainerWorkingDirectoryContainerImageDefault ContainerWorkingDirectory = "ContainerImageDefault" + ContainerWorkingDirectoryTaskWorkingDirectory ContainerWorkingDirectory = "TaskWorkingDirectory" +) + +func PossibleValuesForContainerWorkingDirectory() []string { + return []string{ + string(ContainerWorkingDirectoryContainerImageDefault), + string(ContainerWorkingDirectoryTaskWorkingDirectory), + } +} + +func parseContainerWorkingDirectory(input string) (*ContainerWorkingDirectory, error) { + vals := map[string]ContainerWorkingDirectory{ + "containerimagedefault": ContainerWorkingDirectoryContainerImageDefault, + "taskworkingdirectory": ContainerWorkingDirectoryTaskWorkingDirectory, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerWorkingDirectory(input) + return &out, nil +} + +type DiffDiskPlacement string + +const ( + DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk" +) + +func PossibleValuesForDiffDiskPlacement() []string { + return []string{ + string(DiffDiskPlacementCacheDisk), + } +} + +func parseDiffDiskPlacement(input string) (*DiffDiskPlacement, error) { + vals := map[string]DiffDiskPlacement{ + "cachedisk": DiffDiskPlacementCacheDisk, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskPlacement(input) + return &out, nil +} + +type DiskEncryptionTarget string + +const ( + DiskEncryptionTargetOsDisk DiskEncryptionTarget = "OsDisk" + DiskEncryptionTargetTemporaryDisk DiskEncryptionTarget = "TemporaryDisk" +) + +func PossibleValuesForDiskEncryptionTarget() []string { + return []string{ + string(DiskEncryptionTargetOsDisk), + string(DiskEncryptionTargetTemporaryDisk), + } +} + +func parseDiskEncryptionTarget(input string) (*DiskEncryptionTarget, error) { + vals := map[string]DiskEncryptionTarget{ + "osdisk": DiskEncryptionTargetOsDisk, + "temporarydisk": DiskEncryptionTargetTemporaryDisk, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskEncryptionTarget(input) + return &out, nil +} + +type DynamicVNetAssignmentScope string + +const ( + DynamicVNetAssignmentScopeJob DynamicVNetAssignmentScope = "job" + DynamicVNetAssignmentScopeNone DynamicVNetAssignmentScope = "none" +) + +func PossibleValuesForDynamicVNetAssignmentScope() []string { + return []string{ + string(DynamicVNetAssignmentScopeJob), + string(DynamicVNetAssignmentScopeNone), + } +} + +func parseDynamicVNetAssignmentScope(input string) (*DynamicVNetAssignmentScope, error) { + vals := map[string]DynamicVNetAssignmentScope{ + "job": DynamicVNetAssignmentScopeJob, + "none": DynamicVNetAssignmentScopeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DynamicVNetAssignmentScope(input) + return &out, nil +} + +type ElevationLevel string + +const ( + ElevationLevelAdmin ElevationLevel = "Admin" + ElevationLevelNonAdmin ElevationLevel = "NonAdmin" +) + +func PossibleValuesForElevationLevel() []string { + return []string{ + string(ElevationLevelAdmin), + string(ElevationLevelNonAdmin), + } +} + +func parseElevationLevel(input string) (*ElevationLevel, error) { + vals := map[string]ElevationLevel{ + "admin": ElevationLevelAdmin, + "nonadmin": ElevationLevelNonAdmin, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ElevationLevel(input) + return &out, nil +} + +type IPAddressProvisioningType string + +const ( + IPAddressProvisioningTypeBatchManaged IPAddressProvisioningType = "BatchManaged" + IPAddressProvisioningTypeNoPublicIPAddresses IPAddressProvisioningType = "NoPublicIPAddresses" + IPAddressProvisioningTypeUserManaged IPAddressProvisioningType = "UserManaged" +) + +func PossibleValuesForIPAddressProvisioningType() []string { + return []string{ + string(IPAddressProvisioningTypeBatchManaged), + string(IPAddressProvisioningTypeNoPublicIPAddresses), + string(IPAddressProvisioningTypeUserManaged), + } +} + +func parseIPAddressProvisioningType(input string) (*IPAddressProvisioningType, error) { + vals := map[string]IPAddressProvisioningType{ + "batchmanaged": IPAddressProvisioningTypeBatchManaged, + "nopublicipaddresses": IPAddressProvisioningTypeNoPublicIPAddresses, + "usermanaged": IPAddressProvisioningTypeUserManaged, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IPAddressProvisioningType(input) + return &out, nil +} + +type InboundEndpointProtocol string + +const ( + InboundEndpointProtocolTCP InboundEndpointProtocol = "TCP" + InboundEndpointProtocolUDP InboundEndpointProtocol = "UDP" +) + +func PossibleValuesForInboundEndpointProtocol() []string { + return []string{ + string(InboundEndpointProtocolTCP), + string(InboundEndpointProtocolUDP), + } +} + +func parseInboundEndpointProtocol(input string) (*InboundEndpointProtocol, error) { + vals := map[string]InboundEndpointProtocol{ + "tcp": InboundEndpointProtocolTCP, + "udp": InboundEndpointProtocolUDP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InboundEndpointProtocol(input) + return &out, nil +} + +type InterNodeCommunicationState string + +const ( + InterNodeCommunicationStateDisabled InterNodeCommunicationState = "Disabled" + InterNodeCommunicationStateEnabled InterNodeCommunicationState = "Enabled" +) + +func PossibleValuesForInterNodeCommunicationState() []string { + return []string{ + string(InterNodeCommunicationStateDisabled), + string(InterNodeCommunicationStateEnabled), + } +} + +func parseInterNodeCommunicationState(input string) (*InterNodeCommunicationState, error) { + vals := map[string]InterNodeCommunicationState{ + "disabled": InterNodeCommunicationStateDisabled, + "enabled": InterNodeCommunicationStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InterNodeCommunicationState(input) + return &out, nil +} + +type LoginMode string + +const ( + LoginModeBatch LoginMode = "Batch" + LoginModeInteractive LoginMode = "Interactive" +) + +func PossibleValuesForLoginMode() []string { + return []string{ + string(LoginModeBatch), + string(LoginModeInteractive), + } +} + +func parseLoginMode(input string) (*LoginMode, error) { + vals := map[string]LoginMode{ + "batch": LoginModeBatch, + "interactive": LoginModeInteractive, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LoginMode(input) + return &out, nil +} + +type NetworkSecurityGroupRuleAccess string + +const ( + NetworkSecurityGroupRuleAccessAllow NetworkSecurityGroupRuleAccess = "Allow" + NetworkSecurityGroupRuleAccessDeny NetworkSecurityGroupRuleAccess = "Deny" +) + +func PossibleValuesForNetworkSecurityGroupRuleAccess() []string { + return []string{ + string(NetworkSecurityGroupRuleAccessAllow), + string(NetworkSecurityGroupRuleAccessDeny), + } +} + +func parseNetworkSecurityGroupRuleAccess(input string) (*NetworkSecurityGroupRuleAccess, error) { + vals := map[string]NetworkSecurityGroupRuleAccess{ + "allow": NetworkSecurityGroupRuleAccessAllow, + "deny": NetworkSecurityGroupRuleAccessDeny, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkSecurityGroupRuleAccess(input) + return &out, nil +} + +type NodePlacementPolicyType string + +const ( + NodePlacementPolicyTypeRegional NodePlacementPolicyType = "Regional" + NodePlacementPolicyTypeZonal NodePlacementPolicyType = "Zonal" +) + +func PossibleValuesForNodePlacementPolicyType() []string { + return []string{ + string(NodePlacementPolicyTypeRegional), + string(NodePlacementPolicyTypeZonal), + } +} + +func parseNodePlacementPolicyType(input string) (*NodePlacementPolicyType, error) { + vals := map[string]NodePlacementPolicyType{ + "regional": NodePlacementPolicyTypeRegional, + "zonal": NodePlacementPolicyTypeZonal, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NodePlacementPolicyType(input) + return &out, nil +} + +type PoolProvisioningState string + +const ( + PoolProvisioningStateDeleting PoolProvisioningState = "Deleting" + PoolProvisioningStateSucceeded PoolProvisioningState = "Succeeded" +) + +func PossibleValuesForPoolProvisioningState() []string { + return []string{ + string(PoolProvisioningStateDeleting), + string(PoolProvisioningStateSucceeded), + } +} + +func parsePoolProvisioningState(input string) (*PoolProvisioningState, error) { + vals := map[string]PoolProvisioningState{ + "deleting": PoolProvisioningStateDeleting, + "succeeded": PoolProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PoolProvisioningState(input) + return &out, nil +} + +type StorageAccountType string + +const ( + StorageAccountTypePremiumLRS StorageAccountType = "Premium_LRS" + StorageAccountTypeStandardLRS StorageAccountType = "Standard_LRS" +) + +func PossibleValuesForStorageAccountType() []string { + return []string{ + string(StorageAccountTypePremiumLRS), + string(StorageAccountTypeStandardLRS), + } +} + +func parseStorageAccountType(input string) (*StorageAccountType, error) { + vals := map[string]StorageAccountType{ + "premium_lrs": StorageAccountTypePremiumLRS, + "standard_lrs": StorageAccountTypeStandardLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAccountType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/id_batchaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/id_batchaccount.go new file mode 100644 index 000000000000..be3fb1cc16ec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/id_batchaccount.go @@ -0,0 +1,124 @@ +package pool + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = BatchAccountId{} + +// BatchAccountId is a struct representing the Resource ID for a Batch Account +type BatchAccountId struct { + SubscriptionId string + ResourceGroupName string + BatchAccountName string +} + +// NewBatchAccountID returns a new BatchAccountId struct +func NewBatchAccountID(subscriptionId string, resourceGroupName string, batchAccountName string) BatchAccountId { + return BatchAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + BatchAccountName: batchAccountName, + } +} + +// ParseBatchAccountID parses 'input' into a BatchAccountId +func ParseBatchAccountID(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseBatchAccountIDInsensitively parses 'input' case-insensitively into a BatchAccountId +// note: this method should only be used for API response data and not user input +func ParseBatchAccountIDInsensitively(input string) (*BatchAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateBatchAccountID checks that 'input' can be parsed as a Batch Account ID +func ValidateBatchAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseBatchAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Batch Account ID +func (id BatchAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BatchAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Batch Account ID +func (id BatchAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftBatch", "Microsoft.Batch", "Microsoft.Batch"), + resourceids.StaticSegment("staticBatchAccounts", "batchAccounts", "batchAccounts"), + resourceids.UserSpecifiedSegment("batchAccountName", "batchAccountValue"), + } +} + +// String returns a human-readable description of this Batch Account ID +func (id BatchAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Batch Account Name: %q", id.BatchAccountName), + } + return fmt.Sprintf("Batch Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/id_pool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/id_pool.go new file mode 100644 index 000000000000..1567aa05f751 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/id_pool.go @@ -0,0 +1,137 @@ +package pool + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PoolId{} + +// PoolId is a struct representing the Resource ID for a Pool +type PoolId struct { + SubscriptionId string + ResourceGroupName string + BatchAccountName string + PoolName string +} + +// NewPoolID returns a new PoolId struct +func NewPoolID(subscriptionId string, resourceGroupName string, batchAccountName string, poolName string) PoolId { + return PoolId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + BatchAccountName: batchAccountName, + PoolName: poolName, + } +} + +// ParsePoolID parses 'input' into a PoolId +func ParsePoolID(input string) (*PoolId, error) { + parser := resourceids.NewParserFromResourceIdType(PoolId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePoolIDInsensitively parses 'input' case-insensitively into a PoolId +// note: this method should only be used for API response data and not user input +func ParsePoolIDInsensitively(input string) (*PoolId, error) { + parser := resourceids.NewParserFromResourceIdType(PoolId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'batchAccountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePoolID checks that 'input' can be parsed as a Pool ID +func ValidatePoolID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePoolID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Pool ID +func (id PoolId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s/pools/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BatchAccountName, id.PoolName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Pool ID +func (id PoolId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftBatch", "Microsoft.Batch", "Microsoft.Batch"), + resourceids.StaticSegment("staticBatchAccounts", "batchAccounts", "batchAccounts"), + resourceids.UserSpecifiedSegment("batchAccountName", "batchAccountValue"), + resourceids.StaticSegment("staticPools", "pools", "pools"), + resourceids.UserSpecifiedSegment("poolName", "poolValue"), + } +} + +// String returns a human-readable description of this Pool ID +func (id PoolId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Batch Account Name: %q", id.BatchAccountName), + fmt.Sprintf("Pool Name: %q", id.PoolName), + } + return fmt.Sprintf("Pool (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_create_autorest.go new file mode 100644 index 000000000000..9f553c3cc133 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_create_autorest.go @@ -0,0 +1,103 @@ +package pool + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *Pool +} + +type CreateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOperationOptions() CreateOperationOptions { + return CreateOperationOptions{} +} + +func (o CreateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + if o.IfNoneMatch != nil { + out["If-None-Match"] = *o.IfNoneMatch + } + + return out +} + +func (o CreateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Create ... +func (c PoolClient) Create(ctx context.Context, id PoolId, input Pool, options CreateOperationOptions) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c PoolClient) preparerForCreate(ctx context.Context, id PoolId, input Pool, options CreateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c PoolClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_delete_autorest.go new file mode 100644 index 000000000000..4043ec1eecda --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_delete_autorest.go @@ -0,0 +1,78 @@ +package pool + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c PoolClient) Delete(ctx context.Context, id PoolId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c PoolClient) DeleteThenPoll(ctx context.Context, id PoolId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c PoolClient) preparerForDelete(ctx context.Context, id PoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c PoolClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_disableautoscale_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_disableautoscale_autorest.go new file mode 100644 index 000000000000..05985dc08ab0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_disableautoscale_autorest.go @@ -0,0 +1,69 @@ +package pool + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DisableAutoScaleOperationResponse struct { + HttpResponse *http.Response + Model *Pool +} + +// DisableAutoScale ... +func (c PoolClient) DisableAutoScale(ctx context.Context, id PoolId) (result DisableAutoScaleOperationResponse, err error) { + req, err := c.preparerForDisableAutoScale(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "DisableAutoScale", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "DisableAutoScale", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDisableAutoScale(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "DisableAutoScale", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDisableAutoScale prepares the DisableAutoScale request. +func (c PoolClient) preparerForDisableAutoScale(ctx context.Context, id PoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/disableAutoScale", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDisableAutoScale handles the response to the DisableAutoScale request. The method always +// closes the http.Response Body. +func (c PoolClient) responderForDisableAutoScale(resp *http.Response) (result DisableAutoScaleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_get_autorest.go new file mode 100644 index 000000000000..0c85a615dcf4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_get_autorest.go @@ -0,0 +1,68 @@ +package pool + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Pool +} + +// Get ... +func (c PoolClient) Get(ctx context.Context, id PoolId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c PoolClient) preparerForGet(ctx context.Context, id PoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c PoolClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_listbybatchaccount_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_listbybatchaccount_autorest.go new file mode 100644 index 000000000000..d0f631d73113 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_listbybatchaccount_autorest.go @@ -0,0 +1,225 @@ +package pool + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByBatchAccountOperationResponse struct { + HttpResponse *http.Response + Model *[]Pool + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByBatchAccountOperationResponse, error) +} + +type ListByBatchAccountCompleteResult struct { + Items []Pool +} + +func (r ListByBatchAccountOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByBatchAccountOperationResponse) LoadMore(ctx context.Context) (resp ListByBatchAccountOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByBatchAccountOperationOptions struct { + Filter *string + Maxresults *int64 + Select *string +} + +func DefaultListByBatchAccountOperationOptions() ListByBatchAccountOperationOptions { + return ListByBatchAccountOperationOptions{} +} + +func (o ListByBatchAccountOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByBatchAccountOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Maxresults != nil { + out["maxresults"] = *o.Maxresults + } + + if o.Select != nil { + out["$select"] = *o.Select + } + + return out +} + +// ListByBatchAccount ... +func (c PoolClient) ListByBatchAccount(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions) (resp ListByBatchAccountOperationResponse, err error) { + req, err := c.preparerForListByBatchAccount(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "ListByBatchAccount", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByBatchAccount(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "ListByBatchAccount", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByBatchAccount prepares the ListByBatchAccount request. +func (c PoolClient) preparerForListByBatchAccount(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/pools", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByBatchAccountWithNextLink prepares the ListByBatchAccount request with the given nextLink token. +func (c PoolClient) preparerForListByBatchAccountWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByBatchAccount handles the response to the ListByBatchAccount request. The method always +// closes the http.Response Body. +func (c PoolClient) responderForListByBatchAccount(resp *http.Response) (result ListByBatchAccountOperationResponse, err error) { + type page struct { + Values []Pool `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByBatchAccountOperationResponse, err error) { + req, err := c.preparerForListByBatchAccountWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "ListByBatchAccount", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByBatchAccount(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "ListByBatchAccount", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByBatchAccountComplete retrieves all of the results into a single object +func (c PoolClient) ListByBatchAccountComplete(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions) (ListByBatchAccountCompleteResult, error) { + return c.ListByBatchAccountCompleteMatchingPredicate(ctx, id, options, PoolOperationPredicate{}) +} + +// ListByBatchAccountCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PoolClient) ListByBatchAccountCompleteMatchingPredicate(ctx context.Context, id BatchAccountId, options ListByBatchAccountOperationOptions, predicate PoolOperationPredicate) (resp ListByBatchAccountCompleteResult, err error) { + items := make([]Pool, 0) + + page, err := c.ListByBatchAccount(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByBatchAccountCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_stopresize_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_stopresize_autorest.go new file mode 100644 index 000000000000..80d05b20333d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_stopresize_autorest.go @@ -0,0 +1,69 @@ +package pool + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopResizeOperationResponse struct { + HttpResponse *http.Response + Model *Pool +} + +// StopResize ... +func (c PoolClient) StopResize(ctx context.Context, id PoolId) (result StopResizeOperationResponse, err error) { + req, err := c.preparerForStopResize(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "StopResize", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "StopResize", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForStopResize(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "StopResize", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForStopResize prepares the StopResize request. +func (c PoolClient) preparerForStopResize(ctx context.Context, id PoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/stopResize", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForStopResize handles the response to the StopResize request. The method always +// closes the http.Response Body. +func (c PoolClient) responderForStopResize(resp *http.Response) (result StopResizeOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_update_autorest.go new file mode 100644 index 000000000000..cdf84d869545 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/method_update_autorest.go @@ -0,0 +1,98 @@ +package pool + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Pool +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Update ... +func (c PoolClient) Update(ctx context.Context, id PoolId, input Pool, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "pool.PoolClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c PoolClient) preparerForUpdate(ctx context.Context, id PoolId, input Pool, options UpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c PoolClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_applicationpackagereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_applicationpackagereference.go new file mode 100644 index 000000000000..cee391669f2d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_applicationpackagereference.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationPackageReference struct { + Id string `json:"id"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalerun.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalerun.go new file mode 100644 index 000000000000..a7fc04343423 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalerun.go @@ -0,0 +1,25 @@ +package pool + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutoScaleRun struct { + Error *AutoScaleRunError `json:"error,omitempty"` + EvaluationTime string `json:"evaluationTime"` + Results *string `json:"results,omitempty"` +} + +func (o *AutoScaleRun) GetEvaluationTimeAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.EvaluationTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutoScaleRun) SetEvaluationTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EvaluationTime = formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalerunerror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalerunerror.go new file mode 100644 index 000000000000..48fe86695c2d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalerunerror.go @@ -0,0 +1,10 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutoScaleRunError struct { + Code string `json:"code"` + Details *[]AutoScaleRunError `json:"details,omitempty"` + Message string `json:"message"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalesettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalesettings.go new file mode 100644 index 000000000000..86d2808d4e4a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autoscalesettings.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutoScaleSettings struct { + EvaluationInterval *string `json:"evaluationInterval,omitempty"` + Formula string `json:"formula"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autouserspecification.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autouserspecification.go new file mode 100644 index 000000000000..4486ae5c6622 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_autouserspecification.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutoUserSpecification struct { + ElevationLevel *ElevationLevel `json:"elevationLevel,omitempty"` + Scope *AutoUserScope `json:"scope,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_azureblobfilesystemconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_azureblobfilesystemconfiguration.go new file mode 100644 index 000000000000..67efe0937db4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_azureblobfilesystemconfiguration.go @@ -0,0 +1,14 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureBlobFileSystemConfiguration struct { + AccountKey *string `json:"accountKey,omitempty"` + AccountName string `json:"accountName"` + BlobfuseOptions *string `json:"blobfuseOptions,omitempty"` + ContainerName string `json:"containerName"` + IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` + RelativeMountPath string `json:"relativeMountPath"` + SasKey *string `json:"sasKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_azurefileshareconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_azurefileshareconfiguration.go new file mode 100644 index 000000000000..910a385e4b86 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_azurefileshareconfiguration.go @@ -0,0 +1,12 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureFileShareConfiguration struct { + AccountKey string `json:"accountKey"` + AccountName string `json:"accountName"` + AzureFileUrl string `json:"azureFileUrl"` + MountOptions *string `json:"mountOptions,omitempty"` + RelativeMountPath string `json:"relativeMountPath"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_certificatereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_certificatereference.go new file mode 100644 index 000000000000..d764ddbb7b9c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_certificatereference.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateReference struct { + Id string `json:"id"` + StoreLocation *CertificateStoreLocation `json:"storeLocation,omitempty"` + StoreName *string `json:"storeName,omitempty"` + Visibility *[]CertificateVisibility `json:"visibility,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_cifsmountconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_cifsmountconfiguration.go new file mode 100644 index 000000000000..0674799c4338 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_cifsmountconfiguration.go @@ -0,0 +1,12 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CIFSMountConfiguration struct { + MountOptions *string `json:"mountOptions,omitempty"` + Password string `json:"password"` + RelativeMountPath string `json:"relativeMountPath"` + Source string `json:"source"` + Username string `json:"username"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_cloudserviceconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_cloudserviceconfiguration.go new file mode 100644 index 000000000000..79a293aaf9c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_cloudserviceconfiguration.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudServiceConfiguration struct { + OsFamily string `json:"osFamily"` + OsVersion *string `json:"osVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_computenodeidentityreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_computenodeidentityreference.go new file mode 100644 index 000000000000..5d061039b761 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_computenodeidentityreference.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComputeNodeIdentityReference struct { + ResourceId *string `json:"resourceId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_containerconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_containerconfiguration.go new file mode 100644 index 000000000000..976a955be924 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_containerconfiguration.go @@ -0,0 +1,10 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerConfiguration struct { + ContainerImageNames *[]string `json:"containerImageNames,omitempty"` + ContainerRegistries *[]ContainerRegistry `json:"containerRegistries,omitempty"` + Type ContainerType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_containerregistry.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_containerregistry.go new file mode 100644 index 000000000000..cc4b521ecad4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_containerregistry.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerRegistry struct { + IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` + Password *string `json:"password,omitempty"` + RegistryServer *string `json:"registryServer,omitempty"` + Username *string `json:"username,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_datadisk.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_datadisk.go new file mode 100644 index 000000000000..8daa4484cbe1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_datadisk.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDisk struct { + Caching *CachingType `json:"caching,omitempty"` + DiskSizeGB int64 `json:"diskSizeGB"` + Lun int64 `json:"lun"` + StorageAccountType *StorageAccountType `json:"storageAccountType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_deploymentconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_deploymentconfiguration.go new file mode 100644 index 000000000000..281f83d139e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_deploymentconfiguration.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeploymentConfiguration struct { + CloudServiceConfiguration *CloudServiceConfiguration `json:"cloudServiceConfiguration,omitempty"` + VirtualMachineConfiguration *VirtualMachineConfiguration `json:"virtualMachineConfiguration,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_diffdisksettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_diffdisksettings.go new file mode 100644 index 000000000000..4a6b0aabfb27 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_diffdisksettings.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiffDiskSettings struct { + Placement *DiffDiskPlacement `json:"placement,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_diskencryptionconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_diskencryptionconfiguration.go new file mode 100644 index 000000000000..b25a376a8cd7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_diskencryptionconfiguration.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskEncryptionConfiguration struct { + Targets *[]DiskEncryptionTarget `json:"targets,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_environmentsetting.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_environmentsetting.go new file mode 100644 index 000000000000..6248e4aee953 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_environmentsetting.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnvironmentSetting struct { + Name string `json:"name"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_fixedscalesettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_fixedscalesettings.go new file mode 100644 index 000000000000..291d31fac894 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_fixedscalesettings.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FixedScaleSettings struct { + NodeDeallocationOption *ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` + ResizeTimeout *string `json:"resizeTimeout,omitempty"` + TargetDedicatedNodes *int64 `json:"targetDedicatedNodes,omitempty"` + TargetLowPriorityNodes *int64 `json:"targetLowPriorityNodes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_imagereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_imagereference.go new file mode 100644 index 000000000000..a0f7751f75f7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_imagereference.go @@ -0,0 +1,12 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageReference struct { + Id *string `json:"id,omitempty"` + Offer *string `json:"offer,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Sku *string `json:"sku,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_inboundnatpool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_inboundnatpool.go new file mode 100644 index 000000000000..317ae85fa22d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_inboundnatpool.go @@ -0,0 +1,13 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InboundNatPool struct { + BackendPort int64 `json:"backendPort"` + FrontendPortRangeEnd int64 `json:"frontendPortRangeEnd"` + FrontendPortRangeStart int64 `json:"frontendPortRangeStart"` + Name string `json:"name"` + NetworkSecurityGroupRules *[]NetworkSecurityGroupRule `json:"networkSecurityGroupRules,omitempty"` + Protocol InboundEndpointProtocol `json:"protocol"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_linuxuserconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_linuxuserconfiguration.go new file mode 100644 index 000000000000..60148fc3cf40 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_linuxuserconfiguration.go @@ -0,0 +1,10 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxUserConfiguration struct { + Gid *int64 `json:"gid,omitempty"` + SshPrivateKey *string `json:"sshPrivateKey,omitempty"` + Uid *int64 `json:"uid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_metadataitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_metadataitem.go new file mode 100644 index 000000000000..88e584f88289 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_metadataitem.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MetadataItem struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_mountconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_mountconfiguration.go new file mode 100644 index 000000000000..699e78d963f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_mountconfiguration.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MountConfiguration struct { + AzureBlobFileSystemConfiguration *AzureBlobFileSystemConfiguration `json:"azureBlobFileSystemConfiguration,omitempty"` + AzureFileShareConfiguration *AzureFileShareConfiguration `json:"azureFileShareConfiguration,omitempty"` + CifsMountConfiguration *CIFSMountConfiguration `json:"cifsMountConfiguration,omitempty"` + NfsMountConfiguration *NFSMountConfiguration `json:"nfsMountConfiguration,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_networkconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_networkconfiguration.go new file mode 100644 index 000000000000..d168a8e09601 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_networkconfiguration.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkConfiguration struct { + DynamicVNetAssignmentScope *DynamicVNetAssignmentScope `json:"dynamicVNetAssignmentScope,omitempty"` + EndpointConfiguration *PoolEndpointConfiguration `json:"endpointConfiguration,omitempty"` + PublicIPAddressConfiguration *PublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + SubnetId *string `json:"subnetId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_networksecuritygrouprule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_networksecuritygrouprule.go new file mode 100644 index 000000000000..5b3416320869 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_networksecuritygrouprule.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkSecurityGroupRule struct { + Access NetworkSecurityGroupRuleAccess `json:"access"` + Priority int64 `json:"priority"` + SourceAddressPrefix string `json:"sourceAddressPrefix"` + SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_nfsmountconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_nfsmountconfiguration.go new file mode 100644 index 000000000000..7b4bac563c54 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_nfsmountconfiguration.go @@ -0,0 +1,10 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NFSMountConfiguration struct { + MountOptions *string `json:"mountOptions,omitempty"` + RelativeMountPath string `json:"relativeMountPath"` + Source string `json:"source"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_nodeplacementconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_nodeplacementconfiguration.go new file mode 100644 index 000000000000..5b3284e1b91a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_nodeplacementconfiguration.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NodePlacementConfiguration struct { + Policy *NodePlacementPolicyType `json:"policy,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_osdisk.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_osdisk.go new file mode 100644 index 000000000000..684e70a79be7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_osdisk.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSDisk struct { + EphemeralOSDiskSettings *DiffDiskSettings `json:"ephemeralOSDiskSettings,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_pool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_pool.go new file mode 100644 index 000000000000..99a23f134df7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_pool.go @@ -0,0 +1,17 @@ +package pool + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Pool struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.UserAssignedMap `json:"identity,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PoolProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_poolendpointconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_poolendpointconfiguration.go new file mode 100644 index 000000000000..bb6db6ef74c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_poolendpointconfiguration.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolEndpointConfiguration struct { + InboundNatPools []InboundNatPool `json:"inboundNatPools"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_poolproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_poolproperties.go new file mode 100644 index 000000000000..62a6368e2981 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_poolproperties.go @@ -0,0 +1,86 @@ +package pool + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolProperties struct { + AllocationState *AllocationState `json:"allocationState,omitempty"` + AllocationStateTransitionTime *string `json:"allocationStateTransitionTime,omitempty"` + ApplicationLicenses *[]string `json:"applicationLicenses,omitempty"` + ApplicationPackages *[]ApplicationPackageReference `json:"applicationPackages,omitempty"` + AutoScaleRun *AutoScaleRun `json:"autoScaleRun,omitempty"` + Certificates *[]CertificateReference `json:"certificates,omitempty"` + CreationTime *string `json:"creationTime,omitempty"` + CurrentDedicatedNodes *int64 `json:"currentDedicatedNodes,omitempty"` + CurrentLowPriorityNodes *int64 `json:"currentLowPriorityNodes,omitempty"` + DeploymentConfiguration *DeploymentConfiguration `json:"deploymentConfiguration,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + InterNodeCommunication *InterNodeCommunicationState `json:"interNodeCommunication,omitempty"` + LastModified *string `json:"lastModified,omitempty"` + Metadata *[]MetadataItem `json:"metadata,omitempty"` + MountConfiguration *[]MountConfiguration `json:"mountConfiguration,omitempty"` + NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"` + ProvisioningState *PoolProvisioningState `json:"provisioningState,omitempty"` + ProvisioningStateTransitionTime *string `json:"provisioningStateTransitionTime,omitempty"` + ResizeOperationStatus *ResizeOperationStatus `json:"resizeOperationStatus,omitempty"` + ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` + StartTask *StartTask `json:"startTask,omitempty"` + TaskSchedulingPolicy *TaskSchedulingPolicy `json:"taskSchedulingPolicy,omitempty"` + TaskSlotsPerNode *int64 `json:"taskSlotsPerNode,omitempty"` + UserAccounts *[]UserAccount `json:"userAccounts,omitempty"` + VMSize *string `json:"vmSize,omitempty"` +} + +func (o *PoolProperties) GetAllocationStateTransitionTimeAsTime() (*time.Time, error) { + if o.AllocationStateTransitionTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.AllocationStateTransitionTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *PoolProperties) SetAllocationStateTransitionTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.AllocationStateTransitionTime = &formatted +} + +func (o *PoolProperties) GetCreationTimeAsTime() (*time.Time, error) { + if o.CreationTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreationTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *PoolProperties) SetCreationTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreationTime = &formatted +} + +func (o *PoolProperties) GetLastModifiedAsTime() (*time.Time, error) { + if o.LastModified == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModified, "2006-01-02T15:04:05Z07:00") +} + +func (o *PoolProperties) SetLastModifiedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModified = &formatted +} + +func (o *PoolProperties) GetProvisioningStateTransitionTimeAsTime() (*time.Time, error) { + if o.ProvisioningStateTransitionTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ProvisioningStateTransitionTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *PoolProperties) SetProvisioningStateTransitionTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ProvisioningStateTransitionTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_publicipaddressconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_publicipaddressconfiguration.go new file mode 100644 index 000000000000..99001d0826f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_publicipaddressconfiguration.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublicIPAddressConfiguration struct { + IPAddressIds *[]string `json:"ipAddressIds,omitempty"` + Provision *IPAddressProvisioningType `json:"provision,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resizeerror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resizeerror.go new file mode 100644 index 000000000000..9b6eee87fdce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resizeerror.go @@ -0,0 +1,10 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResizeError struct { + Code string `json:"code"` + Details *[]ResizeError `json:"details,omitempty"` + Message string `json:"message"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resizeoperationstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resizeoperationstatus.go new file mode 100644 index 000000000000..b4ac9148d0ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resizeoperationstatus.go @@ -0,0 +1,31 @@ +package pool + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResizeOperationStatus struct { + Errors *[]ResizeError `json:"errors,omitempty"` + NodeDeallocationOption *ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` + ResizeTimeout *string `json:"resizeTimeout,omitempty"` + StartTime *string `json:"startTime,omitempty"` + TargetDedicatedNodes *int64 `json:"targetDedicatedNodes,omitempty"` + TargetLowPriorityNodes *int64 `json:"targetLowPriorityNodes,omitempty"` +} + +func (o *ResizeOperationStatus) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ResizeOperationStatus) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resourcefile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resourcefile.go new file mode 100644 index 000000000000..9eddccfb1ede --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_resourcefile.go @@ -0,0 +1,14 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceFile struct { + AutoStorageContainerName *string `json:"autoStorageContainerName,omitempty"` + BlobPrefix *string `json:"blobPrefix,omitempty"` + FileMode *string `json:"fileMode,omitempty"` + FilePath *string `json:"filePath,omitempty"` + HTTPUrl *string `json:"httpUrl,omitempty"` + IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` + StorageContainerUrl *string `json:"storageContainerUrl,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_scalesettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_scalesettings.go new file mode 100644 index 000000000000..afed1acf1962 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_scalesettings.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScaleSettings struct { + AutoScale *AutoScaleSettings `json:"autoScale,omitempty"` + FixedScale *FixedScaleSettings `json:"fixedScale,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_starttask.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_starttask.go new file mode 100644 index 000000000000..6846c81fcb7f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_starttask.go @@ -0,0 +1,14 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StartTask struct { + CommandLine *string `json:"commandLine,omitempty"` + ContainerSettings *TaskContainerSettings `json:"containerSettings,omitempty"` + EnvironmentSettings *[]EnvironmentSetting `json:"environmentSettings,omitempty"` + MaxTaskRetryCount *int64 `json:"maxTaskRetryCount,omitempty"` + ResourceFiles *[]ResourceFile `json:"resourceFiles,omitempty"` + UserIdentity *UserIdentity `json:"userIdentity,omitempty"` + WaitForSuccess *bool `json:"waitForSuccess,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_taskcontainersettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_taskcontainersettings.go new file mode 100644 index 000000000000..36ba77fadaef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_taskcontainersettings.go @@ -0,0 +1,11 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TaskContainerSettings struct { + ContainerRunOptions *string `json:"containerRunOptions,omitempty"` + ImageName string `json:"imageName"` + Registry *ContainerRegistry `json:"registry,omitempty"` + WorkingDirectory *ContainerWorkingDirectory `json:"workingDirectory,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_taskschedulingpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_taskschedulingpolicy.go new file mode 100644 index 000000000000..ad42b99fa048 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_taskschedulingpolicy.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TaskSchedulingPolicy struct { + NodeFillType ComputeNodeFillType `json:"nodeFillType"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_useraccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_useraccount.go new file mode 100644 index 000000000000..e22af08ada54 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_useraccount.go @@ -0,0 +1,12 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserAccount struct { + ElevationLevel *ElevationLevel `json:"elevationLevel,omitempty"` + LinuxUserConfiguration *LinuxUserConfiguration `json:"linuxUserConfiguration,omitempty"` + Name string `json:"name"` + Password string `json:"password"` + WindowsUserConfiguration *WindowsUserConfiguration `json:"windowsUserConfiguration,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_useridentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_useridentity.go new file mode 100644 index 000000000000..89ef2a53df9a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_useridentity.go @@ -0,0 +1,9 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserIdentity struct { + AutoUser *AutoUserSpecification `json:"autoUser,omitempty"` + UserName *string `json:"userName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_virtualmachineconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_virtualmachineconfiguration.go new file mode 100644 index 000000000000..400299687e95 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_virtualmachineconfiguration.go @@ -0,0 +1,17 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineConfiguration struct { + ContainerConfiguration *ContainerConfiguration `json:"containerConfiguration,omitempty"` + DataDisks *[]DataDisk `json:"dataDisks,omitempty"` + DiskEncryptionConfiguration *DiskEncryptionConfiguration `json:"diskEncryptionConfiguration,omitempty"` + Extensions *[]VmExtension `json:"extensions,omitempty"` + ImageReference ImageReference `json:"imageReference"` + LicenseType *string `json:"licenseType,omitempty"` + NodeAgentSkuId string `json:"nodeAgentSkuId"` + NodePlacementConfiguration *NodePlacementConfiguration `json:"nodePlacementConfiguration,omitempty"` + OsDisk *OSDisk `json:"osDisk,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_vmextension.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_vmextension.go new file mode 100644 index 000000000000..d6ebfb722262 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_vmextension.go @@ -0,0 +1,15 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VmExtension struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + Name string `json:"name"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + Publisher string `json:"publisher"` + Settings *interface{} `json:"settings,omitempty"` + Type string `json:"type"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_windowsconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_windowsconfiguration.go new file mode 100644 index 000000000000..f3f44236405e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_windowsconfiguration.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsConfiguration struct { + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_windowsuserconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_windowsuserconfiguration.go new file mode 100644 index 000000000000..f977e22b75a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/model_windowsuserconfiguration.go @@ -0,0 +1,8 @@ +package pool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsUserConfiguration struct { + LoginMode *LoginMode `json:"loginMode,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/predicates.go new file mode 100644 index 000000000000..6cf6b55ad296 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/predicates.go @@ -0,0 +1,29 @@ +package pool + +type PoolOperationPredicate struct { + Etag *string + Id *string + Name *string + Type *string +} + +func (p PoolOperationPredicate) Matches(input Pool) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/version.go new file mode 100644 index 000000000000..d55c9a892b61 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool/version.go @@ -0,0 +1,12 @@ +package pool + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/pool/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/cognitiveservicesaccounts/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/cognitiveservicesaccounts/README.md index d135712eaa5c..1545e3bd8852 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/cognitiveservicesaccounts/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/cognitiveservicesaccounts/README.md @@ -248,7 +248,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cognitiveservicesaccounts.NewDeletedAccountID("12345678-1234-9876-4563-123456789012", "locationValue", "example-resource-group", "accountValue") +id := cognitiveservicesaccounts.NewDeletedAccountID("12345678-1234-9876-4563-123456789012", "locationValue", "example-resource-group", "deletedAccountValue") read, err := client.DeletedAccountsGet(ctx, id) if err != nil { @@ -281,7 +281,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := cognitiveservicesaccounts.NewDeletedAccountID("12345678-1234-9876-4563-123456789012", "locationValue", "example-resource-group", "accountValue") +id := cognitiveservicesaccounts.NewDeletedAccountID("12345678-1234-9876-4563-123456789012", "locationValue", "example-resource-group", "deletedAccountValue") if err := client.DeletedAccountsPurgeThenPoll(ctx, id); err != nil { // handle the error diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/cognitiveservicesaccounts/id_deletedaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/cognitiveservicesaccounts/id_deletedaccount.go index a4b9b279e2d3..775b35ddad15 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/cognitiveservicesaccounts/id_deletedaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/cognitiveservicesaccounts/id_deletedaccount.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = DeletedAccountId{} // DeletedAccountId is a struct representing the Resource ID for a Deleted Account type DeletedAccountId struct { - SubscriptionId string - Location string - ResourceGroupName string - AccountName string + SubscriptionId string + LocationName string + ResourceGroupName string + DeletedAccountName string } // NewDeletedAccountID returns a new DeletedAccountId struct -func NewDeletedAccountID(subscriptionId string, location string, resourceGroupName string, accountName string) DeletedAccountId { +func NewDeletedAccountID(subscriptionId string, locationName string, resourceGroupName string, deletedAccountName string) DeletedAccountId { return DeletedAccountId{ - SubscriptionId: subscriptionId, - Location: location, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + LocationName: locationName, + ResourceGroupName: resourceGroupName, + DeletedAccountName: deletedAccountName, } } @@ -42,16 +42,16 @@ func ParseDeletedAccountID(input string) (*DeletedAccountId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DeletedAccountName, ok = parsed.Parsed["deletedAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'deletedAccountName' was not found in the resource id %q", input) } return &id, nil @@ -73,16 +73,16 @@ func ParseDeletedAccountIDInsensitively(input string) (*DeletedAccountId, error) return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DeletedAccountName, ok = parsed.Parsed["deletedAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'deletedAccountName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateDeletedAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Deleted Account ID func (id DeletedAccountId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.CognitiveServices/locations/%s/resourceGroups/%s/deletedAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.ResourceGroupName, id.DeletedAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Deleted Account ID @@ -117,11 +117,11 @@ func (id DeletedAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftCognitiveServices", "Microsoft.CognitiveServices", "Microsoft.CognitiveServices"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), resourceids.StaticSegment("staticDeletedAccounts", "deletedAccounts", "deletedAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("deletedAccountName", "deletedAccountValue"), } } @@ -129,9 +129,9 @@ func (id DeletedAccountId) Segments() []resourceids.Segment { func (id DeletedAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Deleted Account Name: %q", id.DeletedAccountName), } return fmt.Sprintf("Deleted Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/cognitiveservicesaccounts/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/cognitiveservicesaccounts/id_location.go index b37f22375c3e..9dd0b9c65d1d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/cognitiveservicesaccounts/id_location.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/cognitiveservicesaccounts/id_location.go @@ -12,14 +12,14 @@ var _ resourceids.ResourceId = LocationId{} // LocationId is a struct representing the Resource ID for a Location type LocationId struct { SubscriptionId string - Location string + LocationName string } // NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { +func NewLocationID(subscriptionId string, locationName string) LocationId { return LocationId{ SubscriptionId: subscriptionId, - Location: location, + LocationName: locationName, } } @@ -38,8 +38,8 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.CognitiveServices/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } // Segments returns a slice of Resource ID Segments which comprise this Location ID @@ -97,7 +97,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftCognitiveServices", "Microsoft.CognitiveServices", "Microsoft.CognitiveServices"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), } } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { func (id LocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), } return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/virtualmachines/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/virtualmachines/id_location.go index ba3de5184716..4185076e6feb 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/virtualmachines/id_location.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/virtualmachines/id_location.go @@ -12,14 +12,14 @@ var _ resourceids.ResourceId = LocationId{} // LocationId is a struct representing the Resource ID for a Location type LocationId struct { SubscriptionId string - Location string + LocationName string } // NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { +func NewLocationID(subscriptionId string, locationName string) LocationId { return LocationId{ SubscriptionId: subscriptionId, - Location: location, + LocationName: locationName, } } @@ -38,8 +38,8 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } // Segments returns a slice of Resource ID Segments which comprise this Location ID @@ -97,7 +97,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), } } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { func (id LocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), } return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-01/virtualmachines/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-01/virtualmachines/id_location.go index ba3de5184716..4185076e6feb 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-01/virtualmachines/id_location.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-01/virtualmachines/id_location.go @@ -12,14 +12,14 @@ var _ resourceids.ResourceId = LocationId{} // LocationId is a struct representing the Resource ID for a Location type LocationId struct { SubscriptionId string - Location string + LocationName string } // NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { +func NewLocationID(subscriptionId string, locationName string) LocationId { return LocationId{ SubscriptionId: subscriptionId, - Location: location, + LocationName: locationName, } } @@ -38,8 +38,8 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } // Segments returns a slice of Resource ID Segments which comprise this Location ID @@ -97,7 +97,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), } } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { func (id LocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), } return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/README.md new file mode 100644 index 000000000000..2babae42ce65 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates` Documentation + +The `certificates` SDK allows for interaction with the Azure Resource Manager Service `containerapps` (API Version `2022-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates" +``` + + +### Client Initialization + +```go +client := certificates.NewCertificatesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CertificatesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := certificates.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue", "certificateValue") + +payload := certificates.Certificate{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CertificatesClient.Delete` + +```go +ctx := context.TODO() +id := certificates.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue", "certificateValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CertificatesClient.Get` + +```go +ctx := context.TODO() +id := certificates.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue", "certificateValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CertificatesClient.List` + +```go +ctx := context.TODO() +id := certificates.NewManagedEnvironmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CertificatesClient.Update` + +```go +ctx := context.TODO() +id := certificates.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue", "certificateValue") + +payload := certificates.CertificatePatch{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/client.go new file mode 100644 index 000000000000..76fe67c326ee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/client.go @@ -0,0 +1,18 @@ +package certificates + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificatesClient struct { + Client autorest.Client + baseUri string +} + +func NewCertificatesClientWithBaseURI(endpoint string) CertificatesClient { + return CertificatesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/constants.go new file mode 100644 index 000000000000..ae97cad71348 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/constants.go @@ -0,0 +1,43 @@ +package certificates + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateProvisioningState string + +const ( + CertificateProvisioningStateCanceled CertificateProvisioningState = "Canceled" + CertificateProvisioningStateDeleteFailed CertificateProvisioningState = "DeleteFailed" + CertificateProvisioningStateFailed CertificateProvisioningState = "Failed" + CertificateProvisioningStatePending CertificateProvisioningState = "Pending" + CertificateProvisioningStateSucceeded CertificateProvisioningState = "Succeeded" +) + +func PossibleValuesForCertificateProvisioningState() []string { + return []string{ + string(CertificateProvisioningStateCanceled), + string(CertificateProvisioningStateDeleteFailed), + string(CertificateProvisioningStateFailed), + string(CertificateProvisioningStatePending), + string(CertificateProvisioningStateSucceeded), + } +} + +func parseCertificateProvisioningState(input string) (*CertificateProvisioningState, error) { + vals := map[string]CertificateProvisioningState{ + "canceled": CertificateProvisioningStateCanceled, + "deletefailed": CertificateProvisioningStateDeleteFailed, + "failed": CertificateProvisioningStateFailed, + "pending": CertificateProvisioningStatePending, + "succeeded": CertificateProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CertificateProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/id_certificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/id_certificate.go new file mode 100644 index 000000000000..b8b1c2049b9f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/id_certificate.go @@ -0,0 +1,137 @@ +package certificates + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = CertificateId{} + +// CertificateId is a struct representing the Resource ID for a Certificate +type CertificateId struct { + SubscriptionId string + ResourceGroupName string + ManagedEnvironmentName string + CertificateName string +} + +// NewCertificateID returns a new CertificateId struct +func NewCertificateID(subscriptionId string, resourceGroupName string, managedEnvironmentName string, certificateName string) CertificateId { + return CertificateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedEnvironmentName: managedEnvironmentName, + CertificateName: certificateName, + } +} + +// ParseCertificateID parses 'input' into a CertificateId +func ParseCertificateID(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(CertificateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CertificateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { + return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseCertificateIDInsensitively parses 'input' case-insensitively into a CertificateId +// note: this method should only be used for API response data and not user input +func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(CertificateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CertificateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { + return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateCertificateID checks that 'input' can be parsed as a Certificate ID +func ValidateCertificateID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCertificateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Certificate ID +func (id CertificateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.App/managedEnvironments/%s/certificates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedEnvironmentName, id.CertificateName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Certificate ID +func (id CertificateId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApp", "Microsoft.App", "Microsoft.App"), + resourceids.StaticSegment("staticManagedEnvironments", "managedEnvironments", "managedEnvironments"), + resourceids.UserSpecifiedSegment("managedEnvironmentName", "managedEnvironmentValue"), + resourceids.StaticSegment("staticCertificates", "certificates", "certificates"), + resourceids.UserSpecifiedSegment("certificateName", "certificateValue"), + } +} + +// String returns a human-readable description of this Certificate ID +func (id CertificateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Managed Environment Name: %q", id.ManagedEnvironmentName), + fmt.Sprintf("Certificate Name: %q", id.CertificateName), + } + return fmt.Sprintf("Certificate (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/id_managedenvironment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/id_managedenvironment.go new file mode 100644 index 000000000000..c3bdadf593d0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/id_managedenvironment.go @@ -0,0 +1,124 @@ +package certificates + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ManagedEnvironmentId{} + +// ManagedEnvironmentId is a struct representing the Resource ID for a Managed Environment +type ManagedEnvironmentId struct { + SubscriptionId string + ResourceGroupName string + ManagedEnvironmentName string +} + +// NewManagedEnvironmentID returns a new ManagedEnvironmentId struct +func NewManagedEnvironmentID(subscriptionId string, resourceGroupName string, managedEnvironmentName string) ManagedEnvironmentId { + return ManagedEnvironmentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedEnvironmentName: managedEnvironmentName, + } +} + +// ParseManagedEnvironmentID parses 'input' into a ManagedEnvironmentId +func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagedEnvironmentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagedEnvironmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseManagedEnvironmentIDInsensitively parses 'input' case-insensitively into a ManagedEnvironmentId +// note: this method should only be used for API response data and not user input +func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagedEnvironmentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagedEnvironmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID +func ValidateManagedEnvironmentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseManagedEnvironmentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Managed Environment ID +func (id ManagedEnvironmentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.App/managedEnvironments/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedEnvironmentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Managed Environment ID +func (id ManagedEnvironmentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApp", "Microsoft.App", "Microsoft.App"), + resourceids.StaticSegment("staticManagedEnvironments", "managedEnvironments", "managedEnvironments"), + resourceids.UserSpecifiedSegment("managedEnvironmentName", "managedEnvironmentValue"), + } +} + +// String returns a human-readable description of this Managed Environment ID +func (id ManagedEnvironmentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Managed Environment Name: %q", id.ManagedEnvironmentName), + } + return fmt.Sprintf("Managed Environment (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/method_createorupdate_autorest.go new file mode 100644 index 000000000000..c304251281a7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package certificates + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Certificate +} + +// CreateOrUpdate ... +func (c CertificatesClient) CreateOrUpdate(ctx context.Context, id CertificateId, input Certificate) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c CertificatesClient) preparerForCreateOrUpdate(ctx context.Context, id CertificateId, input Certificate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c CertificatesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/method_delete_autorest.go new file mode 100644 index 000000000000..9784a5478d22 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/method_delete_autorest.go @@ -0,0 +1,66 @@ +package certificates + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c CertificatesClient) Delete(ctx context.Context, id CertificateId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c CertificatesClient) preparerForDelete(ctx context.Context, id CertificateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c CertificatesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/method_get_autorest.go new file mode 100644 index 000000000000..c30e94b1ad98 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/method_get_autorest.go @@ -0,0 +1,68 @@ +package certificates + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Certificate +} + +// Get ... +func (c CertificatesClient) Get(ctx context.Context, id CertificateId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c CertificatesClient) preparerForGet(ctx context.Context, id CertificateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c CertificatesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/method_list_autorest.go new file mode 100644 index 000000000000..8ebd49bf1339 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/method_list_autorest.go @@ -0,0 +1,186 @@ +package certificates + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Certificate + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Certificate +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c CertificatesClient) List(ctx context.Context, id ManagedEnvironmentId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c CertificatesClient) preparerForList(ctx context.Context, id ManagedEnvironmentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/certificates", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c CertificatesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c CertificatesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Certificate `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c CertificatesClient) ListComplete(ctx context.Context, id ManagedEnvironmentId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, CertificateOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c CertificatesClient) ListCompleteMatchingPredicate(ctx context.Context, id ManagedEnvironmentId, predicate CertificateOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Certificate, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/method_update_autorest.go new file mode 100644 index 000000000000..80ca047dcaf4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/method_update_autorest.go @@ -0,0 +1,69 @@ +package certificates + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Certificate +} + +// Update ... +func (c CertificatesClient) Update(ctx context.Context, id CertificateId, input CertificatePatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "certificates.CertificatesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c CertificatesClient) preparerForUpdate(ctx context.Context, id CertificateId, input CertificatePatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c CertificatesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/model_certificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/model_certificate.go new file mode 100644 index 000000000000..9d2ab626ff95 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/model_certificate.go @@ -0,0 +1,18 @@ +package certificates + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Certificate struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *CertificateProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/model_certificatepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/model_certificatepatch.go new file mode 100644 index 000000000000..8fb7a984a1bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/model_certificatepatch.go @@ -0,0 +1,8 @@ +package certificates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificatePatch struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/model_certificateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/model_certificateproperties.go new file mode 100644 index 000000000000..f9b83d5882ea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/model_certificateproperties.go @@ -0,0 +1,47 @@ +package certificates + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateProperties struct { + ExpirationDate *string `json:"expirationDate,omitempty"` + IssueDate *string `json:"issueDate,omitempty"` + Issuer *string `json:"issuer,omitempty"` + Password *string `json:"password,omitempty"` + ProvisioningState *CertificateProvisioningState `json:"provisioningState,omitempty"` + PublicKeyHash *string `json:"publicKeyHash,omitempty"` + SubjectName *string `json:"subjectName,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + Valid *bool `json:"valid,omitempty"` + Value *string `json:"value,omitempty"` +} + +func (o *CertificateProperties) GetExpirationDateAsTime() (*time.Time, error) { + if o.ExpirationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ExpirationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *CertificateProperties) SetExpirationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationDate = &formatted +} + +func (o *CertificateProperties) GetIssueDateAsTime() (*time.Time, error) { + if o.IssueDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.IssueDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *CertificateProperties) SetIssueDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.IssueDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/predicates.go new file mode 100644 index 000000000000..91f80d120dea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/predicates.go @@ -0,0 +1,29 @@ +package certificates + +type CertificateOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CertificateOperationPredicate) Matches(input Certificate) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/version.go new file mode 100644 index 000000000000..1cfd42892bf4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates/version.go @@ -0,0 +1,12 @@ +package certificates + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/certificates/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/README.md new file mode 100644 index 000000000000..a88845f76c16 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/README.md @@ -0,0 +1,148 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps` Documentation + +The `containerapps` SDK allows for interaction with the Azure Resource Manager Service `containerapps` (API Version `2022-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps" +``` + + +### Client Initialization + +```go +client := containerapps.NewContainerAppsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ContainerAppsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := containerapps.NewContainerAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerAppValue") + +payload := containerapps.ContainerApp{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerAppsClient.Delete` + +```go +ctx := context.TODO() +id := containerapps.NewContainerAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerAppValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerAppsClient.Get` + +```go +ctx := context.TODO() +id := containerapps.NewContainerAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerAppValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerAppsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := containerapps.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerAppsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := containerapps.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerAppsClient.ListCustomHostNameAnalysis` + +```go +ctx := context.TODO() +id := containerapps.NewContainerAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerAppValue") + +read, err := client.ListCustomHostNameAnalysis(ctx, id, containerapps.DefaultListCustomHostNameAnalysisOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerAppsClient.ListSecrets` + +```go +ctx := context.TODO() +id := containerapps.NewContainerAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerAppValue") + +read, err := client.ListSecrets(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerAppsClient.Update` + +```go +ctx := context.TODO() +id := containerapps.NewContainerAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerAppValue") + +payload := containerapps.ContainerApp{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/client.go new file mode 100644 index 000000000000..a0d5c49ca4ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/client.go @@ -0,0 +1,18 @@ +package containerapps + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerAppsClient struct { + Client autorest.Client + baseUri string +} + +func NewContainerAppsClientWithBaseURI(endpoint string) ContainerAppsClient { + return ContainerAppsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/constants.go new file mode 100644 index 000000000000..72596fcfc937 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/constants.go @@ -0,0 +1,276 @@ +package containerapps + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActiveRevisionsMode string + +const ( + ActiveRevisionsModeMultiple ActiveRevisionsMode = "Multiple" + ActiveRevisionsModeSingle ActiveRevisionsMode = "Single" +) + +func PossibleValuesForActiveRevisionsMode() []string { + return []string{ + string(ActiveRevisionsModeMultiple), + string(ActiveRevisionsModeSingle), + } +} + +func parseActiveRevisionsMode(input string) (*ActiveRevisionsMode, error) { + vals := map[string]ActiveRevisionsMode{ + "multiple": ActiveRevisionsModeMultiple, + "single": ActiveRevisionsModeSingle, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ActiveRevisionsMode(input) + return &out, nil +} + +type AppProtocol string + +const ( + AppProtocolGrpc AppProtocol = "grpc" + AppProtocolHTTP AppProtocol = "http" +) + +func PossibleValuesForAppProtocol() []string { + return []string{ + string(AppProtocolGrpc), + string(AppProtocolHTTP), + } +} + +func parseAppProtocol(input string) (*AppProtocol, error) { + vals := map[string]AppProtocol{ + "grpc": AppProtocolGrpc, + "http": AppProtocolHTTP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AppProtocol(input) + return &out, nil +} + +type BindingType string + +const ( + BindingTypeDisabled BindingType = "Disabled" + BindingTypeSniEnabled BindingType = "SniEnabled" +) + +func PossibleValuesForBindingType() []string { + return []string{ + string(BindingTypeDisabled), + string(BindingTypeSniEnabled), + } +} + +func parseBindingType(input string) (*BindingType, error) { + vals := map[string]BindingType{ + "disabled": BindingTypeDisabled, + "snienabled": BindingTypeSniEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BindingType(input) + return &out, nil +} + +type ContainerAppProvisioningState string + +const ( + ContainerAppProvisioningStateCanceled ContainerAppProvisioningState = "Canceled" + ContainerAppProvisioningStateDeleting ContainerAppProvisioningState = "Deleting" + ContainerAppProvisioningStateFailed ContainerAppProvisioningState = "Failed" + ContainerAppProvisioningStateInProgress ContainerAppProvisioningState = "InProgress" + ContainerAppProvisioningStateSucceeded ContainerAppProvisioningState = "Succeeded" +) + +func PossibleValuesForContainerAppProvisioningState() []string { + return []string{ + string(ContainerAppProvisioningStateCanceled), + string(ContainerAppProvisioningStateDeleting), + string(ContainerAppProvisioningStateFailed), + string(ContainerAppProvisioningStateInProgress), + string(ContainerAppProvisioningStateSucceeded), + } +} + +func parseContainerAppProvisioningState(input string) (*ContainerAppProvisioningState, error) { + vals := map[string]ContainerAppProvisioningState{ + "canceled": ContainerAppProvisioningStateCanceled, + "deleting": ContainerAppProvisioningStateDeleting, + "failed": ContainerAppProvisioningStateFailed, + "inprogress": ContainerAppProvisioningStateInProgress, + "succeeded": ContainerAppProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerAppProvisioningState(input) + return &out, nil +} + +type DnsVerificationTestResult string + +const ( + DnsVerificationTestResultFailed DnsVerificationTestResult = "Failed" + DnsVerificationTestResultPassed DnsVerificationTestResult = "Passed" + DnsVerificationTestResultSkipped DnsVerificationTestResult = "Skipped" +) + +func PossibleValuesForDnsVerificationTestResult() []string { + return []string{ + string(DnsVerificationTestResultFailed), + string(DnsVerificationTestResultPassed), + string(DnsVerificationTestResultSkipped), + } +} + +func parseDnsVerificationTestResult(input string) (*DnsVerificationTestResult, error) { + vals := map[string]DnsVerificationTestResult{ + "failed": DnsVerificationTestResultFailed, + "passed": DnsVerificationTestResultPassed, + "skipped": DnsVerificationTestResultSkipped, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DnsVerificationTestResult(input) + return &out, nil +} + +type IngressTransportMethod string + +const ( + IngressTransportMethodAuto IngressTransportMethod = "auto" + IngressTransportMethodHTTP IngressTransportMethod = "http" + IngressTransportMethodHTTPTwo IngressTransportMethod = "http2" +) + +func PossibleValuesForIngressTransportMethod() []string { + return []string{ + string(IngressTransportMethodAuto), + string(IngressTransportMethodHTTP), + string(IngressTransportMethodHTTPTwo), + } +} + +func parseIngressTransportMethod(input string) (*IngressTransportMethod, error) { + vals := map[string]IngressTransportMethod{ + "auto": IngressTransportMethodAuto, + "http": IngressTransportMethodHTTP, + "http2": IngressTransportMethodHTTPTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IngressTransportMethod(input) + return &out, nil +} + +type Scheme string + +const ( + SchemeHTTP Scheme = "HTTP" + SchemeHTTPS Scheme = "HTTPS" +) + +func PossibleValuesForScheme() []string { + return []string{ + string(SchemeHTTP), + string(SchemeHTTPS), + } +} + +func parseScheme(input string) (*Scheme, error) { + vals := map[string]Scheme{ + "http": SchemeHTTP, + "https": SchemeHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Scheme(input) + return &out, nil +} + +type StorageType string + +const ( + StorageTypeAzureFile StorageType = "AzureFile" + StorageTypeEmptyDir StorageType = "EmptyDir" +) + +func PossibleValuesForStorageType() []string { + return []string{ + string(StorageTypeAzureFile), + string(StorageTypeEmptyDir), + } +} + +func parseStorageType(input string) (*StorageType, error) { + vals := map[string]StorageType{ + "azurefile": StorageTypeAzureFile, + "emptydir": StorageTypeEmptyDir, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageType(input) + return &out, nil +} + +type Type string + +const ( + TypeLiveness Type = "Liveness" + TypeReadiness Type = "Readiness" + TypeStartup Type = "Startup" +) + +func PossibleValuesForType() []string { + return []string{ + string(TypeLiveness), + string(TypeReadiness), + string(TypeStartup), + } +} + +func parseType(input string) (*Type, error) { + vals := map[string]Type{ + "liveness": TypeLiveness, + "readiness": TypeReadiness, + "startup": TypeStartup, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Type(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/id_containerapp.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/id_containerapp.go new file mode 100644 index 000000000000..85732f8a6c4e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/id_containerapp.go @@ -0,0 +1,124 @@ +package containerapps + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ContainerAppId{} + +// ContainerAppId is a struct representing the Resource ID for a Container App +type ContainerAppId struct { + SubscriptionId string + ResourceGroupName string + ContainerAppName string +} + +// NewContainerAppID returns a new ContainerAppId struct +func NewContainerAppID(subscriptionId string, resourceGroupName string, containerAppName string) ContainerAppId { + return ContainerAppId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ContainerAppName: containerAppName, + } +} + +// ParseContainerAppID parses 'input' into a ContainerAppId +func ParseContainerAppID(input string) (*ContainerAppId, error) { + parser := resourceids.NewParserFromResourceIdType(ContainerAppId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ContainerAppId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { + return nil, fmt.Errorf("the segment 'containerAppName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseContainerAppIDInsensitively parses 'input' case-insensitively into a ContainerAppId +// note: this method should only be used for API response data and not user input +func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { + parser := resourceids.NewParserFromResourceIdType(ContainerAppId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ContainerAppId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { + return nil, fmt.Errorf("the segment 'containerAppName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateContainerAppID checks that 'input' can be parsed as a Container App ID +func ValidateContainerAppID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseContainerAppID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Container App ID +func (id ContainerAppId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.App/containerApps/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ContainerAppName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Container App ID +func (id ContainerAppId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApp", "Microsoft.App", "Microsoft.App"), + resourceids.StaticSegment("staticContainerApps", "containerApps", "containerApps"), + resourceids.UserSpecifiedSegment("containerAppName", "containerAppValue"), + } +} + +// String returns a human-readable description of this Container App ID +func (id ContainerAppId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Container App Name: %q", id.ContainerAppName), + } + return fmt.Sprintf("Container App (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_createorupdate_autorest.go new file mode 100644 index 000000000000..ca3fb36a086a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package containerapps + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c ContainerAppsClient) CreateOrUpdate(ctx context.Context, id ContainerAppId, input ContainerApp) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ContainerAppsClient) CreateOrUpdateThenPoll(ctx context.Context, id ContainerAppId, input ContainerApp) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ContainerAppsClient) preparerForCreateOrUpdate(ctx context.Context, id ContainerAppId, input ContainerApp) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ContainerAppsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_delete_autorest.go new file mode 100644 index 000000000000..01dc274c213b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_delete_autorest.go @@ -0,0 +1,78 @@ +package containerapps + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ContainerAppsClient) Delete(ctx context.Context, id ContainerAppId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ContainerAppsClient) DeleteThenPoll(ctx context.Context, id ContainerAppId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ContainerAppsClient) preparerForDelete(ctx context.Context, id ContainerAppId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ContainerAppsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_get_autorest.go new file mode 100644 index 000000000000..e9d8bf4cd559 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_get_autorest.go @@ -0,0 +1,68 @@ +package containerapps + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ContainerApp +} + +// Get ... +func (c ContainerAppsClient) Get(ctx context.Context, id ContainerAppId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ContainerAppsClient) preparerForGet(ctx context.Context, id ContainerAppId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ContainerAppsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..172e783a6a4b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package containerapps + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]ContainerApp + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []ContainerApp +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c ContainerAppsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ContainerAppsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.App/containerApps", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c ContainerAppsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ContainerAppsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []ContainerApp `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c ContainerAppsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ContainerAppOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ContainerAppsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ContainerAppOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]ContainerApp, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_listbysubscription_autorest.go new file mode 100644 index 000000000000..b8fae13b1434 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package containerapps + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]ContainerApp + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []ContainerApp +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c ContainerAppsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c ContainerAppsClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.App/containerApps", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c ContainerAppsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c ContainerAppsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []ContainerApp `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c ContainerAppsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ContainerAppOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ContainerAppsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ContainerAppOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]ContainerApp, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_listcustomhostnameanalysis_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_listcustomhostnameanalysis_autorest.go new file mode 100644 index 000000000000..399d555e6810 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_listcustomhostnameanalysis_autorest.go @@ -0,0 +1,98 @@ +package containerapps + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListCustomHostNameAnalysisOperationResponse struct { + HttpResponse *http.Response + Model *CustomHostnameAnalysisResult +} + +type ListCustomHostNameAnalysisOperationOptions struct { + CustomHostname *string +} + +func DefaultListCustomHostNameAnalysisOperationOptions() ListCustomHostNameAnalysisOperationOptions { + return ListCustomHostNameAnalysisOperationOptions{} +} + +func (o ListCustomHostNameAnalysisOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListCustomHostNameAnalysisOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.CustomHostname != nil { + out["customHostname"] = *o.CustomHostname + } + + return out +} + +// ListCustomHostNameAnalysis ... +func (c ContainerAppsClient) ListCustomHostNameAnalysis(ctx context.Context, id ContainerAppId, options ListCustomHostNameAnalysisOperationOptions) (result ListCustomHostNameAnalysisOperationResponse, err error) { + req, err := c.preparerForListCustomHostNameAnalysis(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListCustomHostNameAnalysis", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListCustomHostNameAnalysis", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListCustomHostNameAnalysis(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListCustomHostNameAnalysis", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListCustomHostNameAnalysis prepares the ListCustomHostNameAnalysis request. +func (c ContainerAppsClient) preparerForListCustomHostNameAnalysis(ctx context.Context, id ContainerAppId, options ListCustomHostNameAnalysisOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/listCustomHostNameAnalysis", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListCustomHostNameAnalysis handles the response to the ListCustomHostNameAnalysis request. The method always +// closes the http.Response Body. +func (c ContainerAppsClient) responderForListCustomHostNameAnalysis(resp *http.Response) (result ListCustomHostNameAnalysisOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_listsecrets_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_listsecrets_autorest.go new file mode 100644 index 000000000000..c6ad38b777c2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_listsecrets_autorest.go @@ -0,0 +1,69 @@ +package containerapps + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + Model *SecretsCollection +} + +// ListSecrets ... +func (c ContainerAppsClient) ListSecrets(ctx context.Context, id ContainerAppId) (result ListSecretsOperationResponse, err error) { + req, err := c.preparerForListSecrets(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListSecrets", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListSecrets", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListSecrets(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "ListSecrets", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListSecrets prepares the ListSecrets request. +func (c ContainerAppsClient) preparerForListSecrets(ctx context.Context, id ContainerAppId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listSecrets", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListSecrets handles the response to the ListSecrets request. The method always +// closes the http.Response Body. +func (c ContainerAppsClient) responderForListSecrets(resp *http.Response) (result ListSecretsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_update_autorest.go new file mode 100644 index 000000000000..f0726346ea12 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/method_update_autorest.go @@ -0,0 +1,79 @@ +package containerapps + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c ContainerAppsClient) Update(ctx context.Context, id ContainerAppId, input ContainerApp) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerapps.ContainerAppsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ContainerAppsClient) UpdateThenPoll(ctx context.Context, id ContainerAppId, input ContainerApp) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c ContainerAppsClient) preparerForUpdate(ctx context.Context, id ContainerAppId, input ContainerApp) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c ContainerAppsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_configuration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_configuration.go new file mode 100644 index 000000000000..4522d21ae9bc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_configuration.go @@ -0,0 +1,12 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Configuration struct { + ActiveRevisionsMode *ActiveRevisionsMode `json:"activeRevisionsMode,omitempty"` + Dapr *Dapr `json:"dapr,omitempty"` + Ingress *Ingress `json:"ingress,omitempty"` + Registries *[]RegistryCredentials `json:"registries,omitempty"` + Secrets *[]Secret `json:"secrets,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_container.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_container.go new file mode 100644 index 000000000000..eacb62148fd5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_container.go @@ -0,0 +1,15 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Container struct { + Args *[]string `json:"args,omitempty"` + Command *[]string `json:"command,omitempty"` + Env *[]EnvironmentVar `json:"env,omitempty"` + Image *string `json:"image,omitempty"` + Name *string `json:"name,omitempty"` + Probes *[]ContainerAppProbe `json:"probes,omitempty"` + Resources *ContainerResources `json:"resources,omitempty"` + VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerapp.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerapp.go new file mode 100644 index 000000000000..23a9510e0bb5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerapp.go @@ -0,0 +1,20 @@ +package containerapps + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerApp struct { + Id *string `json:"id,omitempty"` + Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ContainerAppProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappprobe.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappprobe.go new file mode 100644 index 000000000000..a704b4ab897e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappprobe.go @@ -0,0 +1,16 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerAppProbe struct { + FailureThreshold *int64 `json:"failureThreshold,omitempty"` + HTTPGet *ContainerAppProbeHTTPGet `json:"httpGet,omitempty"` + InitialDelaySeconds *int64 `json:"initialDelaySeconds,omitempty"` + PeriodSeconds *int64 `json:"periodSeconds,omitempty"` + SuccessThreshold *int64 `json:"successThreshold,omitempty"` + TcpSocket *ContainerAppProbeTcpSocket `json:"tcpSocket,omitempty"` + TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"` + TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty"` + Type *Type `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappprobehttpget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappprobehttpget.go new file mode 100644 index 000000000000..7f78b0e62719 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappprobehttpget.go @@ -0,0 +1,12 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerAppProbeHTTPGet struct { + HTTPHeaders *[]ContainerAppProbeHTTPGetHTTPHeadersInlined `json:"httpHeaders,omitempty"` + Host *string `json:"host,omitempty"` + Path *string `json:"path,omitempty"` + Port int64 `json:"port"` + Scheme *Scheme `json:"scheme,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappprobehttpgethttpheadersinlined.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappprobehttpgethttpheadersinlined.go new file mode 100644 index 000000000000..d97ce91ffab4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappprobehttpgethttpheadersinlined.go @@ -0,0 +1,9 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerAppProbeHTTPGetHTTPHeadersInlined struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappprobetcpsocket.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappprobetcpsocket.go new file mode 100644 index 000000000000..94d442c5fdd7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappprobetcpsocket.go @@ -0,0 +1,9 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerAppProbeTcpSocket struct { + Host *string `json:"host,omitempty"` + Port int64 `json:"port"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappproperties.go new file mode 100644 index 000000000000..883c2d42cd44 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappproperties.go @@ -0,0 +1,15 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerAppProperties struct { + Configuration *Configuration `json:"configuration,omitempty"` + CustomDomainVerificationId *string `json:"customDomainVerificationId,omitempty"` + LatestRevisionFqdn *string `json:"latestRevisionFqdn,omitempty"` + LatestRevisionName *string `json:"latestRevisionName,omitempty"` + ManagedEnvironmentId *string `json:"managedEnvironmentId,omitempty"` + OutboundIPAddresses *[]string `json:"outboundIpAddresses,omitempty"` + ProvisioningState *ContainerAppProvisioningState `json:"provisioningState,omitempty"` + Template *Template `json:"template,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappsecret.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappsecret.go new file mode 100644 index 000000000000..a2ca83f001b0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerappsecret.go @@ -0,0 +1,9 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerAppSecret struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerresources.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerresources.go new file mode 100644 index 000000000000..3d55e9ef4224 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_containerresources.go @@ -0,0 +1,10 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerResources struct { + Cpu *float64 `json:"cpu,omitempty"` + EphemeralStorage *string `json:"ephemeralStorage,omitempty"` + Memory *string `json:"memory,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customdomain.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customdomain.go new file mode 100644 index 000000000000..aeab69111fc9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customdomain.go @@ -0,0 +1,10 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomDomain struct { + BindingType *BindingType `json:"bindingType,omitempty"` + CertificateId *string `json:"certificateId,omitempty"` + Name string `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customhostnameanalysisresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customhostnameanalysisresult.go new file mode 100644 index 000000000000..e6108a841480 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customhostnameanalysisresult.go @@ -0,0 +1,19 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomHostnameAnalysisResult struct { + ARecords *[]string `json:"aRecords,omitempty"` + AlternateCNameRecords *[]string `json:"alternateCNameRecords,omitempty"` + AlternateTxtRecords *[]string `json:"alternateTxtRecords,omitempty"` + CNameRecords *[]string `json:"cNameRecords,omitempty"` + ConflictWithEnvironmentCustomDomain *bool `json:"conflictWithEnvironmentCustomDomain,omitempty"` + ConflictingContainerAppResourceId *string `json:"conflictingContainerAppResourceId,omitempty"` + CustomDomainVerificationFailureInfo *CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo `json:"customDomainVerificationFailureInfo,omitempty"` + CustomDomainVerificationTest *DnsVerificationTestResult `json:"customDomainVerificationTest,omitempty"` + HasConflictOnManagedEnvironment *bool `json:"hasConflictOnManagedEnvironment,omitempty"` + HostName *string `json:"hostName,omitempty"` + IsHostnameAlreadyVerified *bool `json:"isHostnameAlreadyVerified,omitempty"` + TxtRecords *[]string `json:"txtRecords,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customhostnameanalysisresultcustomdomainverificationfailureinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customhostnameanalysisresultcustomdomainverificationfailureinfo.go new file mode 100644 index 000000000000..490a78264ab3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customhostnameanalysisresultcustomdomainverificationfailureinfo.go @@ -0,0 +1,11 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo struct { + Code *string `json:"code,omitempty"` + Details *[]CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsInlined `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customhostnameanalysisresultcustomdomainverificationfailureinfodetailsinlined.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customhostnameanalysisresultcustomdomainverificationfailureinfodetailsinlined.go new file mode 100644 index 000000000000..1a9643ffafab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customhostnameanalysisresultcustomdomainverificationfailureinfodetailsinlined.go @@ -0,0 +1,10 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsInlined struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customscalerule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customscalerule.go new file mode 100644 index 000000000000..6b51d48a3e26 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_customscalerule.go @@ -0,0 +1,10 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomScaleRule struct { + Auth *[]ScaleRuleAuth `json:"auth,omitempty"` + Metadata *map[string]string `json:"metadata,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_dapr.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_dapr.go new file mode 100644 index 000000000000..666f11e6b10d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_dapr.go @@ -0,0 +1,11 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Dapr struct { + AppId *string `json:"appId,omitempty"` + AppPort *int64 `json:"appPort,omitempty"` + AppProtocol *AppProtocol `json:"appProtocol,omitempty"` + Enabled *bool `json:"enabled,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_environmentvar.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_environmentvar.go new file mode 100644 index 000000000000..e25ec6c8bc89 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_environmentvar.go @@ -0,0 +1,10 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnvironmentVar struct { + Name *string `json:"name,omitempty"` + SecretRef *string `json:"secretRef,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_httpscalerule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_httpscalerule.go new file mode 100644 index 000000000000..429b7ee23031 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_httpscalerule.go @@ -0,0 +1,9 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HTTPScaleRule struct { + Auth *[]ScaleRuleAuth `json:"auth,omitempty"` + Metadata *map[string]string `json:"metadata,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_ingress.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_ingress.go new file mode 100644 index 000000000000..18f6f703dd8b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_ingress.go @@ -0,0 +1,14 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Ingress struct { + AllowInsecure *bool `json:"allowInsecure,omitempty"` + CustomDomains *[]CustomDomain `json:"customDomains,omitempty"` + External *bool `json:"external,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` + TargetPort *int64 `json:"targetPort,omitempty"` + Traffic *[]TrafficWeight `json:"traffic,omitempty"` + Transport *IngressTransportMethod `json:"transport,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_queuescalerule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_queuescalerule.go new file mode 100644 index 000000000000..b8cbc96d3a0e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_queuescalerule.go @@ -0,0 +1,10 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueueScaleRule struct { + Auth *[]ScaleRuleAuth `json:"auth,omitempty"` + QueueLength *int64 `json:"queueLength,omitempty"` + QueueName *string `json:"queueName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_registrycredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_registrycredentials.go new file mode 100644 index 000000000000..bab9a7f8a4c0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_registrycredentials.go @@ -0,0 +1,11 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegistryCredentials struct { + Identity *string `json:"identity,omitempty"` + PasswordSecretRef *string `json:"passwordSecretRef,omitempty"` + Server *string `json:"server,omitempty"` + Username *string `json:"username,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_scale.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_scale.go new file mode 100644 index 000000000000..a8f54d89b3fa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_scale.go @@ -0,0 +1,10 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Scale struct { + MaxReplicas *int64 `json:"maxReplicas,omitempty"` + MinReplicas *int64 `json:"minReplicas,omitempty"` + Rules *[]ScaleRule `json:"rules,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_scalerule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_scalerule.go new file mode 100644 index 000000000000..4fc431004612 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_scalerule.go @@ -0,0 +1,11 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScaleRule struct { + AzureQueue *QueueScaleRule `json:"azureQueue,omitempty"` + Custom *CustomScaleRule `json:"custom,omitempty"` + HTTP *HTTPScaleRule `json:"http,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_scaleruleauth.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_scaleruleauth.go new file mode 100644 index 000000000000..46e5a92ad03a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_scaleruleauth.go @@ -0,0 +1,9 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScaleRuleAuth struct { + SecretRef *string `json:"secretRef,omitempty"` + TriggerParameter *string `json:"triggerParameter,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_secret.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_secret.go new file mode 100644 index 000000000000..172aa1e71e0c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_secret.go @@ -0,0 +1,9 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Secret struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_secretscollection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_secretscollection.go new file mode 100644 index 000000000000..5244f0aabe7d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_secretscollection.go @@ -0,0 +1,8 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecretsCollection struct { + Value []ContainerAppSecret `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_template.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_template.go new file mode 100644 index 000000000000..866a7d6cec0d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_template.go @@ -0,0 +1,11 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Template struct { + Containers *[]Container `json:"containers,omitempty"` + RevisionSuffix *string `json:"revisionSuffix,omitempty"` + Scale *Scale `json:"scale,omitempty"` + Volumes *[]Volume `json:"volumes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_trafficweight.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_trafficweight.go new file mode 100644 index 000000000000..63d06f5fdcb8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_trafficweight.go @@ -0,0 +1,11 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TrafficWeight struct { + Label *string `json:"label,omitempty"` + LatestRevision *bool `json:"latestRevision,omitempty"` + RevisionName *string `json:"revisionName,omitempty"` + Weight *int64 `json:"weight,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_volume.go new file mode 100644 index 000000000000..6bc10f6a829d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_volume.go @@ -0,0 +1,10 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Volume struct { + Name *string `json:"name,omitempty"` + StorageName *string `json:"storageName,omitempty"` + StorageType *StorageType `json:"storageType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_volumemount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_volumemount.go new file mode 100644 index 000000000000..06e860defd67 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/model_volumemount.go @@ -0,0 +1,9 @@ +package containerapps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumeMount struct { + MountPath *string `json:"mountPath,omitempty"` + VolumeName *string `json:"volumeName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/predicates.go new file mode 100644 index 000000000000..cbc1d8e53b59 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/predicates.go @@ -0,0 +1,29 @@ +package containerapps + +type ContainerAppOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ContainerAppOperationPredicate) Matches(input ContainerApp) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/version.go new file mode 100644 index 000000000000..b76ce8f07974 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps/version.go @@ -0,0 +1,12 @@ +package containerapps + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/containerapps/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/README.md new file mode 100644 index 000000000000..72a9d7a55012 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/README.md @@ -0,0 +1,101 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions` Documentation + +The `containerappsrevisions` SDK allows for interaction with the Azure Resource Manager Service `containerapps` (API Version `2022-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions" +``` + + +### Client Initialization + +```go +client := containerappsrevisions.NewContainerAppsRevisionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ContainerAppsRevisionsClient.ActivateRevision` + +```go +ctx := context.TODO() +id := containerappsrevisions.NewRevisionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerAppValue", "revisionValue") + +read, err := client.ActivateRevision(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerAppsRevisionsClient.DeactivateRevision` + +```go +ctx := context.TODO() +id := containerappsrevisions.NewRevisionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerAppValue", "revisionValue") + +read, err := client.DeactivateRevision(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerAppsRevisionsClient.GetRevision` + +```go +ctx := context.TODO() +id := containerappsrevisions.NewRevisionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerAppValue", "revisionValue") + +read, err := client.GetRevision(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerAppsRevisionsClient.ListRevisions` + +```go +ctx := context.TODO() +id := containerappsrevisions.NewContainerAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerAppValue") + +// alternatively `client.ListRevisions(ctx, id, containerappsrevisions.DefaultListRevisionsOperationOptions())` can be used to do batched pagination +items, err := client.ListRevisionsComplete(ctx, id, containerappsrevisions.DefaultListRevisionsOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerAppsRevisionsClient.RestartRevision` + +```go +ctx := context.TODO() +id := containerappsrevisions.NewRevisionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerAppValue", "revisionValue") + +read, err := client.RestartRevision(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/client.go new file mode 100644 index 000000000000..68c18534395e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/client.go @@ -0,0 +1,18 @@ +package containerappsrevisions + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerAppsRevisionsClient struct { + Client autorest.Client + baseUri string +} + +func NewContainerAppsRevisionsClientWithBaseURI(endpoint string) ContainerAppsRevisionsClient { + return ContainerAppsRevisionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/constants.go new file mode 100644 index 000000000000..9493b0c859ee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/constants.go @@ -0,0 +1,161 @@ +package containerappsrevisions + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RevisionHealthState string + +const ( + RevisionHealthStateHealthy RevisionHealthState = "Healthy" + RevisionHealthStateNone RevisionHealthState = "None" + RevisionHealthStateUnhealthy RevisionHealthState = "Unhealthy" +) + +func PossibleValuesForRevisionHealthState() []string { + return []string{ + string(RevisionHealthStateHealthy), + string(RevisionHealthStateNone), + string(RevisionHealthStateUnhealthy), + } +} + +func parseRevisionHealthState(input string) (*RevisionHealthState, error) { + vals := map[string]RevisionHealthState{ + "healthy": RevisionHealthStateHealthy, + "none": RevisionHealthStateNone, + "unhealthy": RevisionHealthStateUnhealthy, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RevisionHealthState(input) + return &out, nil +} + +type RevisionProvisioningState string + +const ( + RevisionProvisioningStateDeprovisioned RevisionProvisioningState = "Deprovisioned" + RevisionProvisioningStateDeprovisioning RevisionProvisioningState = "Deprovisioning" + RevisionProvisioningStateFailed RevisionProvisioningState = "Failed" + RevisionProvisioningStateProvisioned RevisionProvisioningState = "Provisioned" + RevisionProvisioningStateProvisioning RevisionProvisioningState = "Provisioning" +) + +func PossibleValuesForRevisionProvisioningState() []string { + return []string{ + string(RevisionProvisioningStateDeprovisioned), + string(RevisionProvisioningStateDeprovisioning), + string(RevisionProvisioningStateFailed), + string(RevisionProvisioningStateProvisioned), + string(RevisionProvisioningStateProvisioning), + } +} + +func parseRevisionProvisioningState(input string) (*RevisionProvisioningState, error) { + vals := map[string]RevisionProvisioningState{ + "deprovisioned": RevisionProvisioningStateDeprovisioned, + "deprovisioning": RevisionProvisioningStateDeprovisioning, + "failed": RevisionProvisioningStateFailed, + "provisioned": RevisionProvisioningStateProvisioned, + "provisioning": RevisionProvisioningStateProvisioning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RevisionProvisioningState(input) + return &out, nil +} + +type Scheme string + +const ( + SchemeHTTP Scheme = "HTTP" + SchemeHTTPS Scheme = "HTTPS" +) + +func PossibleValuesForScheme() []string { + return []string{ + string(SchemeHTTP), + string(SchemeHTTPS), + } +} + +func parseScheme(input string) (*Scheme, error) { + vals := map[string]Scheme{ + "http": SchemeHTTP, + "https": SchemeHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Scheme(input) + return &out, nil +} + +type StorageType string + +const ( + StorageTypeAzureFile StorageType = "AzureFile" + StorageTypeEmptyDir StorageType = "EmptyDir" +) + +func PossibleValuesForStorageType() []string { + return []string{ + string(StorageTypeAzureFile), + string(StorageTypeEmptyDir), + } +} + +func parseStorageType(input string) (*StorageType, error) { + vals := map[string]StorageType{ + "azurefile": StorageTypeAzureFile, + "emptydir": StorageTypeEmptyDir, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageType(input) + return &out, nil +} + +type Type string + +const ( + TypeLiveness Type = "Liveness" + TypeReadiness Type = "Readiness" + TypeStartup Type = "Startup" +) + +func PossibleValuesForType() []string { + return []string{ + string(TypeLiveness), + string(TypeReadiness), + string(TypeStartup), + } +} + +func parseType(input string) (*Type, error) { + vals := map[string]Type{ + "liveness": TypeLiveness, + "readiness": TypeReadiness, + "startup": TypeStartup, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Type(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/id_containerapp.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/id_containerapp.go new file mode 100644 index 000000000000..df6c7ec7f229 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/id_containerapp.go @@ -0,0 +1,124 @@ +package containerappsrevisions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ContainerAppId{} + +// ContainerAppId is a struct representing the Resource ID for a Container App +type ContainerAppId struct { + SubscriptionId string + ResourceGroupName string + ContainerAppName string +} + +// NewContainerAppID returns a new ContainerAppId struct +func NewContainerAppID(subscriptionId string, resourceGroupName string, containerAppName string) ContainerAppId { + return ContainerAppId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ContainerAppName: containerAppName, + } +} + +// ParseContainerAppID parses 'input' into a ContainerAppId +func ParseContainerAppID(input string) (*ContainerAppId, error) { + parser := resourceids.NewParserFromResourceIdType(ContainerAppId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ContainerAppId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { + return nil, fmt.Errorf("the segment 'containerAppName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseContainerAppIDInsensitively parses 'input' case-insensitively into a ContainerAppId +// note: this method should only be used for API response data and not user input +func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { + parser := resourceids.NewParserFromResourceIdType(ContainerAppId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ContainerAppId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { + return nil, fmt.Errorf("the segment 'containerAppName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateContainerAppID checks that 'input' can be parsed as a Container App ID +func ValidateContainerAppID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseContainerAppID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Container App ID +func (id ContainerAppId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.App/containerApps/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ContainerAppName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Container App ID +func (id ContainerAppId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApp", "Microsoft.App", "Microsoft.App"), + resourceids.StaticSegment("staticContainerApps", "containerApps", "containerApps"), + resourceids.UserSpecifiedSegment("containerAppName", "containerAppValue"), + } +} + +// String returns a human-readable description of this Container App ID +func (id ContainerAppId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Container App Name: %q", id.ContainerAppName), + } + return fmt.Sprintf("Container App (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/id_revision.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/id_revision.go new file mode 100644 index 000000000000..4fd66f446393 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/id_revision.go @@ -0,0 +1,137 @@ +package containerappsrevisions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RevisionId{} + +// RevisionId is a struct representing the Resource ID for a Revision +type RevisionId struct { + SubscriptionId string + ResourceGroupName string + ContainerAppName string + RevisionName string +} + +// NewRevisionID returns a new RevisionId struct +func NewRevisionID(subscriptionId string, resourceGroupName string, containerAppName string, revisionName string) RevisionId { + return RevisionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ContainerAppName: containerAppName, + RevisionName: revisionName, + } +} + +// ParseRevisionID parses 'input' into a RevisionId +func ParseRevisionID(input string) (*RevisionId, error) { + parser := resourceids.NewParserFromResourceIdType(RevisionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RevisionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { + return nil, fmt.Errorf("the segment 'containerAppName' was not found in the resource id %q", input) + } + + if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { + return nil, fmt.Errorf("the segment 'revisionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRevisionIDInsensitively parses 'input' case-insensitively into a RevisionId +// note: this method should only be used for API response data and not user input +func ParseRevisionIDInsensitively(input string) (*RevisionId, error) { + parser := resourceids.NewParserFromResourceIdType(RevisionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RevisionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { + return nil, fmt.Errorf("the segment 'containerAppName' was not found in the resource id %q", input) + } + + if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { + return nil, fmt.Errorf("the segment 'revisionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRevisionID checks that 'input' can be parsed as a Revision ID +func ValidateRevisionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRevisionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Revision ID +func (id RevisionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.App/containerApps/%s/revisions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ContainerAppName, id.RevisionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Revision ID +func (id RevisionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApp", "Microsoft.App", "Microsoft.App"), + resourceids.StaticSegment("staticContainerApps", "containerApps", "containerApps"), + resourceids.UserSpecifiedSegment("containerAppName", "containerAppValue"), + resourceids.StaticSegment("staticRevisions", "revisions", "revisions"), + resourceids.UserSpecifiedSegment("revisionName", "revisionValue"), + } +} + +// String returns a human-readable description of this Revision ID +func (id RevisionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Container App Name: %q", id.ContainerAppName), + fmt.Sprintf("Revision Name: %q", id.RevisionName), + } + return fmt.Sprintf("Revision (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/method_activaterevision_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/method_activaterevision_autorest.go new file mode 100644 index 000000000000..7d6701a4a3e3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/method_activaterevision_autorest.go @@ -0,0 +1,67 @@ +package containerappsrevisions + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActivateRevisionOperationResponse struct { + HttpResponse *http.Response +} + +// ActivateRevision ... +func (c ContainerAppsRevisionsClient) ActivateRevision(ctx context.Context, id RevisionId) (result ActivateRevisionOperationResponse, err error) { + req, err := c.preparerForActivateRevision(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "ActivateRevision", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "ActivateRevision", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForActivateRevision(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "ActivateRevision", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForActivateRevision prepares the ActivateRevision request. +func (c ContainerAppsRevisionsClient) preparerForActivateRevision(ctx context.Context, id RevisionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/activate", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForActivateRevision handles the response to the ActivateRevision request. The method always +// closes the http.Response Body. +func (c ContainerAppsRevisionsClient) responderForActivateRevision(resp *http.Response) (result ActivateRevisionOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/method_deactivaterevision_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/method_deactivaterevision_autorest.go new file mode 100644 index 000000000000..821d34b2851f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/method_deactivaterevision_autorest.go @@ -0,0 +1,67 @@ +package containerappsrevisions + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeactivateRevisionOperationResponse struct { + HttpResponse *http.Response +} + +// DeactivateRevision ... +func (c ContainerAppsRevisionsClient) DeactivateRevision(ctx context.Context, id RevisionId) (result DeactivateRevisionOperationResponse, err error) { + req, err := c.preparerForDeactivateRevision(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "DeactivateRevision", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "DeactivateRevision", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDeactivateRevision(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "DeactivateRevision", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDeactivateRevision prepares the DeactivateRevision request. +func (c ContainerAppsRevisionsClient) preparerForDeactivateRevision(ctx context.Context, id RevisionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/deactivate", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDeactivateRevision handles the response to the DeactivateRevision request. The method always +// closes the http.Response Body. +func (c ContainerAppsRevisionsClient) responderForDeactivateRevision(resp *http.Response) (result DeactivateRevisionOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/method_getrevision_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/method_getrevision_autorest.go new file mode 100644 index 000000000000..9cc457910e0f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/method_getrevision_autorest.go @@ -0,0 +1,68 @@ +package containerappsrevisions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetRevisionOperationResponse struct { + HttpResponse *http.Response + Model *Revision +} + +// GetRevision ... +func (c ContainerAppsRevisionsClient) GetRevision(ctx context.Context, id RevisionId) (result GetRevisionOperationResponse, err error) { + req, err := c.preparerForGetRevision(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "GetRevision", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "GetRevision", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetRevision(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "GetRevision", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetRevision prepares the GetRevision request. +func (c ContainerAppsRevisionsClient) preparerForGetRevision(ctx context.Context, id RevisionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetRevision handles the response to the GetRevision request. The method always +// closes the http.Response Body. +func (c ContainerAppsRevisionsClient) responderForGetRevision(resp *http.Response) (result GetRevisionOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/method_listrevisions_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/method_listrevisions_autorest.go new file mode 100644 index 000000000000..a9d76316c2b6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/method_listrevisions_autorest.go @@ -0,0 +1,215 @@ +package containerappsrevisions + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListRevisionsOperationResponse struct { + HttpResponse *http.Response + Model *[]Revision + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListRevisionsOperationResponse, error) +} + +type ListRevisionsCompleteResult struct { + Items []Revision +} + +func (r ListRevisionsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListRevisionsOperationResponse) LoadMore(ctx context.Context) (resp ListRevisionsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListRevisionsOperationOptions struct { + Filter *string +} + +func DefaultListRevisionsOperationOptions() ListRevisionsOperationOptions { + return ListRevisionsOperationOptions{} +} + +func (o ListRevisionsOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListRevisionsOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// ListRevisions ... +func (c ContainerAppsRevisionsClient) ListRevisions(ctx context.Context, id ContainerAppId, options ListRevisionsOperationOptions) (resp ListRevisionsOperationResponse, err error) { + req, err := c.preparerForListRevisions(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "ListRevisions", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "ListRevisions", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListRevisions(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "ListRevisions", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListRevisions prepares the ListRevisions request. +func (c ContainerAppsRevisionsClient) preparerForListRevisions(ctx context.Context, id ContainerAppId, options ListRevisionsOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/revisions", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListRevisionsWithNextLink prepares the ListRevisions request with the given nextLink token. +func (c ContainerAppsRevisionsClient) preparerForListRevisionsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListRevisions handles the response to the ListRevisions request. The method always +// closes the http.Response Body. +func (c ContainerAppsRevisionsClient) responderForListRevisions(resp *http.Response) (result ListRevisionsOperationResponse, err error) { + type page struct { + Values []Revision `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListRevisionsOperationResponse, err error) { + req, err := c.preparerForListRevisionsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "ListRevisions", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "ListRevisions", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListRevisions(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "ListRevisions", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListRevisionsComplete retrieves all of the results into a single object +func (c ContainerAppsRevisionsClient) ListRevisionsComplete(ctx context.Context, id ContainerAppId, options ListRevisionsOperationOptions) (ListRevisionsCompleteResult, error) { + return c.ListRevisionsCompleteMatchingPredicate(ctx, id, options, RevisionOperationPredicate{}) +} + +// ListRevisionsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ContainerAppsRevisionsClient) ListRevisionsCompleteMatchingPredicate(ctx context.Context, id ContainerAppId, options ListRevisionsOperationOptions, predicate RevisionOperationPredicate) (resp ListRevisionsCompleteResult, err error) { + items := make([]Revision, 0) + + page, err := c.ListRevisions(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListRevisionsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/method_restartrevision_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/method_restartrevision_autorest.go new file mode 100644 index 000000000000..d1d7bb6594c9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/method_restartrevision_autorest.go @@ -0,0 +1,67 @@ +package containerappsrevisions + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestartRevisionOperationResponse struct { + HttpResponse *http.Response +} + +// RestartRevision ... +func (c ContainerAppsRevisionsClient) RestartRevision(ctx context.Context, id RevisionId) (result RestartRevisionOperationResponse, err error) { + req, err := c.preparerForRestartRevision(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "RestartRevision", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "RestartRevision", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRestartRevision(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerappsrevisions.ContainerAppsRevisionsClient", "RestartRevision", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRestartRevision prepares the RestartRevision request. +func (c ContainerAppsRevisionsClient) preparerForRestartRevision(ctx context.Context, id RevisionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/restart", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRestartRevision handles the response to the RestartRevision request. The method always +// closes the http.Response Body. +func (c ContainerAppsRevisionsClient) responderForRestartRevision(resp *http.Response) (result RestartRevisionOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_container.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_container.go new file mode 100644 index 000000000000..7f1c19ea4b78 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_container.go @@ -0,0 +1,15 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Container struct { + Args *[]string `json:"args,omitempty"` + Command *[]string `json:"command,omitempty"` + Env *[]EnvironmentVar `json:"env,omitempty"` + Image *string `json:"image,omitempty"` + Name *string `json:"name,omitempty"` + Probes *[]ContainerAppProbe `json:"probes,omitempty"` + Resources *ContainerResources `json:"resources,omitempty"` + VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_containerappprobe.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_containerappprobe.go new file mode 100644 index 000000000000..4ce8a07dffbc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_containerappprobe.go @@ -0,0 +1,16 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerAppProbe struct { + FailureThreshold *int64 `json:"failureThreshold,omitempty"` + HTTPGet *ContainerAppProbeHTTPGet `json:"httpGet,omitempty"` + InitialDelaySeconds *int64 `json:"initialDelaySeconds,omitempty"` + PeriodSeconds *int64 `json:"periodSeconds,omitempty"` + SuccessThreshold *int64 `json:"successThreshold,omitempty"` + TcpSocket *ContainerAppProbeTcpSocket `json:"tcpSocket,omitempty"` + TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"` + TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty"` + Type *Type `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_containerappprobehttpget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_containerappprobehttpget.go new file mode 100644 index 000000000000..d52a1cf5da38 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_containerappprobehttpget.go @@ -0,0 +1,12 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerAppProbeHTTPGet struct { + HTTPHeaders *[]ContainerAppProbeHTTPGetHTTPHeadersInlined `json:"httpHeaders,omitempty"` + Host *string `json:"host,omitempty"` + Path *string `json:"path,omitempty"` + Port int64 `json:"port"` + Scheme *Scheme `json:"scheme,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_containerappprobehttpgethttpheadersinlined.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_containerappprobehttpgethttpheadersinlined.go new file mode 100644 index 000000000000..d1917e04cf01 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_containerappprobehttpgethttpheadersinlined.go @@ -0,0 +1,9 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerAppProbeHTTPGetHTTPHeadersInlined struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_containerappprobetcpsocket.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_containerappprobetcpsocket.go new file mode 100644 index 000000000000..c751a9f613ac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_containerappprobetcpsocket.go @@ -0,0 +1,9 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerAppProbeTcpSocket struct { + Host *string `json:"host,omitempty"` + Port int64 `json:"port"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_containerresources.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_containerresources.go new file mode 100644 index 000000000000..3e3de8997a99 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_containerresources.go @@ -0,0 +1,10 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerResources struct { + Cpu *float64 `json:"cpu,omitempty"` + EphemeralStorage *string `json:"ephemeralStorage,omitempty"` + Memory *string `json:"memory,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_customscalerule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_customscalerule.go new file mode 100644 index 000000000000..601fb82b559a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_customscalerule.go @@ -0,0 +1,10 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomScaleRule struct { + Auth *[]ScaleRuleAuth `json:"auth,omitempty"` + Metadata *map[string]string `json:"metadata,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_environmentvar.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_environmentvar.go new file mode 100644 index 000000000000..1b4d78fc7ed1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_environmentvar.go @@ -0,0 +1,10 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnvironmentVar struct { + Name *string `json:"name,omitempty"` + SecretRef *string `json:"secretRef,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_httpscalerule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_httpscalerule.go new file mode 100644 index 000000000000..17656fa59087 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_httpscalerule.go @@ -0,0 +1,9 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HTTPScaleRule struct { + Auth *[]ScaleRuleAuth `json:"auth,omitempty"` + Metadata *map[string]string `json:"metadata,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_queuescalerule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_queuescalerule.go new file mode 100644 index 000000000000..016cc1788976 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_queuescalerule.go @@ -0,0 +1,10 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueueScaleRule struct { + Auth *[]ScaleRuleAuth `json:"auth,omitempty"` + QueueLength *int64 `json:"queueLength,omitempty"` + QueueName *string `json:"queueName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_revision.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_revision.go new file mode 100644 index 000000000000..3b31b4ca6910 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_revision.go @@ -0,0 +1,16 @@ +package containerappsrevisions + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Revision struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RevisionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_revisionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_revisionproperties.go new file mode 100644 index 000000000000..60753fcac96a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_revisionproperties.go @@ -0,0 +1,34 @@ +package containerappsrevisions + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RevisionProperties struct { + Active *bool `json:"active,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` + HealthState *RevisionHealthState `json:"healthState,omitempty"` + ProvisioningError *string `json:"provisioningError,omitempty"` + ProvisioningState *RevisionProvisioningState `json:"provisioningState,omitempty"` + Replicas *int64 `json:"replicas,omitempty"` + Template *Template `json:"template,omitempty"` + TrafficWeight *int64 `json:"trafficWeight,omitempty"` +} + +func (o *RevisionProperties) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RevisionProperties) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_scale.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_scale.go new file mode 100644 index 000000000000..f6e99c4b779e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_scale.go @@ -0,0 +1,10 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Scale struct { + MaxReplicas *int64 `json:"maxReplicas,omitempty"` + MinReplicas *int64 `json:"minReplicas,omitempty"` + Rules *[]ScaleRule `json:"rules,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_scalerule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_scalerule.go new file mode 100644 index 000000000000..4bcd2c4a29e3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_scalerule.go @@ -0,0 +1,11 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScaleRule struct { + AzureQueue *QueueScaleRule `json:"azureQueue,omitempty"` + Custom *CustomScaleRule `json:"custom,omitempty"` + HTTP *HTTPScaleRule `json:"http,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_scaleruleauth.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_scaleruleauth.go new file mode 100644 index 000000000000..2135985725ad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_scaleruleauth.go @@ -0,0 +1,9 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScaleRuleAuth struct { + SecretRef *string `json:"secretRef,omitempty"` + TriggerParameter *string `json:"triggerParameter,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_template.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_template.go new file mode 100644 index 000000000000..ecf3d02a34f7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_template.go @@ -0,0 +1,11 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Template struct { + Containers *[]Container `json:"containers,omitempty"` + RevisionSuffix *string `json:"revisionSuffix,omitempty"` + Scale *Scale `json:"scale,omitempty"` + Volumes *[]Volume `json:"volumes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_volume.go new file mode 100644 index 000000000000..0ba0817465fa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_volume.go @@ -0,0 +1,10 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Volume struct { + Name *string `json:"name,omitempty"` + StorageName *string `json:"storageName,omitempty"` + StorageType *StorageType `json:"storageType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_volumemount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_volumemount.go new file mode 100644 index 000000000000..1098dfc541f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/model_volumemount.go @@ -0,0 +1,9 @@ +package containerappsrevisions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumeMount struct { + MountPath *string `json:"mountPath,omitempty"` + VolumeName *string `json:"volumeName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/predicates.go new file mode 100644 index 000000000000..d16f007fc9f7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/predicates.go @@ -0,0 +1,24 @@ +package containerappsrevisions + +type RevisionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p RevisionOperationPredicate) Matches(input Revision) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/version.go new file mode 100644 index 000000000000..bc818eafe498 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions/version.go @@ -0,0 +1,12 @@ +package containerappsrevisions + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/containerappsrevisions/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/README.md new file mode 100644 index 000000000000..b3ff41d48e78 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/README.md @@ -0,0 +1,106 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents` Documentation + +The `daprcomponents` SDK allows for interaction with the Azure Resource Manager Service `containerapps` (API Version `2022-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents" +``` + + +### Client Initialization + +```go +client := daprcomponents.NewDaprComponentsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DaprComponentsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := daprcomponents.NewDaprComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue", "daprComponentValue") + +payload := daprcomponents.DaprComponent{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DaprComponentsClient.Delete` + +```go +ctx := context.TODO() +id := daprcomponents.NewDaprComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue", "daprComponentValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DaprComponentsClient.Get` + +```go +ctx := context.TODO() +id := daprcomponents.NewDaprComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue", "daprComponentValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DaprComponentsClient.List` + +```go +ctx := context.TODO() +id := daprcomponents.NewManagedEnvironmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DaprComponentsClient.ListSecrets` + +```go +ctx := context.TODO() +id := daprcomponents.NewDaprComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue", "daprComponentValue") + +read, err := client.ListSecrets(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/client.go new file mode 100644 index 000000000000..4d49b8459652 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/client.go @@ -0,0 +1,18 @@ +package daprcomponents + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DaprComponentsClient struct { + Client autorest.Client + baseUri string +} + +func NewDaprComponentsClientWithBaseURI(endpoint string) DaprComponentsClient { + return DaprComponentsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/id_daprcomponent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/id_daprcomponent.go new file mode 100644 index 000000000000..83fdf15a282d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/id_daprcomponent.go @@ -0,0 +1,137 @@ +package daprcomponents + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DaprComponentId{} + +// DaprComponentId is a struct representing the Resource ID for a Dapr Component +type DaprComponentId struct { + SubscriptionId string + ResourceGroupName string + ManagedEnvironmentName string + DaprComponentName string +} + +// NewDaprComponentID returns a new DaprComponentId struct +func NewDaprComponentID(subscriptionId string, resourceGroupName string, managedEnvironmentName string, daprComponentName string) DaprComponentId { + return DaprComponentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedEnvironmentName: managedEnvironmentName, + DaprComponentName: daprComponentName, + } +} + +// ParseDaprComponentID parses 'input' into a DaprComponentId +func ParseDaprComponentID(input string) (*DaprComponentId, error) { + parser := resourceids.NewParserFromResourceIdType(DaprComponentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DaprComponentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + if id.DaprComponentName, ok = parsed.Parsed["daprComponentName"]; !ok { + return nil, fmt.Errorf("the segment 'daprComponentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDaprComponentIDInsensitively parses 'input' case-insensitively into a DaprComponentId +// note: this method should only be used for API response data and not user input +func ParseDaprComponentIDInsensitively(input string) (*DaprComponentId, error) { + parser := resourceids.NewParserFromResourceIdType(DaprComponentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DaprComponentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + if id.DaprComponentName, ok = parsed.Parsed["daprComponentName"]; !ok { + return nil, fmt.Errorf("the segment 'daprComponentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDaprComponentID checks that 'input' can be parsed as a Dapr Component ID +func ValidateDaprComponentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDaprComponentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Dapr Component ID +func (id DaprComponentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.App/managedEnvironments/%s/daprComponents/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedEnvironmentName, id.DaprComponentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Dapr Component ID +func (id DaprComponentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApp", "Microsoft.App", "Microsoft.App"), + resourceids.StaticSegment("staticManagedEnvironments", "managedEnvironments", "managedEnvironments"), + resourceids.UserSpecifiedSegment("managedEnvironmentName", "managedEnvironmentValue"), + resourceids.StaticSegment("staticDaprComponents", "daprComponents", "daprComponents"), + resourceids.UserSpecifiedSegment("daprComponentName", "daprComponentValue"), + } +} + +// String returns a human-readable description of this Dapr Component ID +func (id DaprComponentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Managed Environment Name: %q", id.ManagedEnvironmentName), + fmt.Sprintf("Dapr Component Name: %q", id.DaprComponentName), + } + return fmt.Sprintf("Dapr Component (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/id_managedenvironment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/id_managedenvironment.go new file mode 100644 index 000000000000..c3acf4afec12 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/id_managedenvironment.go @@ -0,0 +1,124 @@ +package daprcomponents + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ManagedEnvironmentId{} + +// ManagedEnvironmentId is a struct representing the Resource ID for a Managed Environment +type ManagedEnvironmentId struct { + SubscriptionId string + ResourceGroupName string + ManagedEnvironmentName string +} + +// NewManagedEnvironmentID returns a new ManagedEnvironmentId struct +func NewManagedEnvironmentID(subscriptionId string, resourceGroupName string, managedEnvironmentName string) ManagedEnvironmentId { + return ManagedEnvironmentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedEnvironmentName: managedEnvironmentName, + } +} + +// ParseManagedEnvironmentID parses 'input' into a ManagedEnvironmentId +func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagedEnvironmentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagedEnvironmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseManagedEnvironmentIDInsensitively parses 'input' case-insensitively into a ManagedEnvironmentId +// note: this method should only be used for API response data and not user input +func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagedEnvironmentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagedEnvironmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID +func ValidateManagedEnvironmentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseManagedEnvironmentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Managed Environment ID +func (id ManagedEnvironmentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.App/managedEnvironments/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedEnvironmentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Managed Environment ID +func (id ManagedEnvironmentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApp", "Microsoft.App", "Microsoft.App"), + resourceids.StaticSegment("staticManagedEnvironments", "managedEnvironments", "managedEnvironments"), + resourceids.UserSpecifiedSegment("managedEnvironmentName", "managedEnvironmentValue"), + } +} + +// String returns a human-readable description of this Managed Environment ID +func (id ManagedEnvironmentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Managed Environment Name: %q", id.ManagedEnvironmentName), + } + return fmt.Sprintf("Managed Environment (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/method_createorupdate_autorest.go new file mode 100644 index 000000000000..9d9b1001b9a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package daprcomponents + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *DaprComponent +} + +// CreateOrUpdate ... +func (c DaprComponentsClient) CreateOrUpdate(ctx context.Context, id DaprComponentId, input DaprComponent) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c DaprComponentsClient) preparerForCreateOrUpdate(ctx context.Context, id DaprComponentId, input DaprComponent) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c DaprComponentsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/method_delete_autorest.go new file mode 100644 index 000000000000..f155125b2704 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/method_delete_autorest.go @@ -0,0 +1,66 @@ +package daprcomponents + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c DaprComponentsClient) Delete(ctx context.Context, id DaprComponentId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c DaprComponentsClient) preparerForDelete(ctx context.Context, id DaprComponentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c DaprComponentsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/method_get_autorest.go new file mode 100644 index 000000000000..ab0d90df9537 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/method_get_autorest.go @@ -0,0 +1,68 @@ +package daprcomponents + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *DaprComponent +} + +// Get ... +func (c DaprComponentsClient) Get(ctx context.Context, id DaprComponentId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DaprComponentsClient) preparerForGet(ctx context.Context, id DaprComponentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DaprComponentsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/method_list_autorest.go new file mode 100644 index 000000000000..849c9adef81a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/method_list_autorest.go @@ -0,0 +1,186 @@ +package daprcomponents + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]DaprComponent + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []DaprComponent +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c DaprComponentsClient) List(ctx context.Context, id ManagedEnvironmentId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c DaprComponentsClient) preparerForList(ctx context.Context, id ManagedEnvironmentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/daprComponents", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c DaprComponentsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c DaprComponentsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []DaprComponent `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c DaprComponentsClient) ListComplete(ctx context.Context, id ManagedEnvironmentId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, DaprComponentOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DaprComponentsClient) ListCompleteMatchingPredicate(ctx context.Context, id ManagedEnvironmentId, predicate DaprComponentOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]DaprComponent, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/method_listsecrets_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/method_listsecrets_autorest.go new file mode 100644 index 000000000000..b4a0d1e9aba4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/method_listsecrets_autorest.go @@ -0,0 +1,69 @@ +package daprcomponents + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + Model *DaprSecretsCollection +} + +// ListSecrets ... +func (c DaprComponentsClient) ListSecrets(ctx context.Context, id DaprComponentId) (result ListSecretsOperationResponse, err error) { + req, err := c.preparerForListSecrets(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "ListSecrets", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "ListSecrets", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListSecrets(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "daprcomponents.DaprComponentsClient", "ListSecrets", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListSecrets prepares the ListSecrets request. +func (c DaprComponentsClient) preparerForListSecrets(ctx context.Context, id DaprComponentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listSecrets", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListSecrets handles the response to the ListSecrets request. The method always +// closes the http.Response Body. +func (c DaprComponentsClient) responderForListSecrets(resp *http.Response) (result ListSecretsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_daprcomponent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_daprcomponent.go new file mode 100644 index 000000000000..bb4b6f41c32b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_daprcomponent.go @@ -0,0 +1,16 @@ +package daprcomponents + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DaprComponent struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DaprComponentProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_daprcomponentproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_daprcomponentproperties.go new file mode 100644 index 000000000000..d7a9fb1d6acf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_daprcomponentproperties.go @@ -0,0 +1,14 @@ +package daprcomponents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DaprComponentProperties struct { + ComponentType *string `json:"componentType,omitempty"` + IgnoreErrors *bool `json:"ignoreErrors,omitempty"` + InitTimeout *string `json:"initTimeout,omitempty"` + Metadata *[]DaprMetadata `json:"metadata,omitempty"` + Scopes *[]string `json:"scopes,omitempty"` + Secrets *[]Secret `json:"secrets,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_daprmetadata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_daprmetadata.go new file mode 100644 index 000000000000..8b82e1749b45 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_daprmetadata.go @@ -0,0 +1,10 @@ +package daprcomponents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DaprMetadata struct { + Name *string `json:"name,omitempty"` + SecretRef *string `json:"secretRef,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_daprsecret.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_daprsecret.go new file mode 100644 index 000000000000..82ce596575c4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_daprsecret.go @@ -0,0 +1,9 @@ +package daprcomponents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DaprSecret struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_daprsecretscollection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_daprsecretscollection.go new file mode 100644 index 000000000000..0f52a6c5f300 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_daprsecretscollection.go @@ -0,0 +1,8 @@ +package daprcomponents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DaprSecretsCollection struct { + Value []DaprSecret `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_secret.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_secret.go new file mode 100644 index 000000000000..8a23d9f334e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/model_secret.go @@ -0,0 +1,9 @@ +package daprcomponents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Secret struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/predicates.go new file mode 100644 index 000000000000..f6563004d37c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/predicates.go @@ -0,0 +1,24 @@ +package daprcomponents + +type DaprComponentOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DaprComponentOperationPredicate) Matches(input DaprComponent) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/version.go new file mode 100644 index 000000000000..95e019e9fea9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents/version.go @@ -0,0 +1,12 @@ +package daprcomponents + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/daprcomponents/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/README.md new file mode 100644 index 000000000000..9700fc39cc51 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/README.md @@ -0,0 +1,228 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments` Documentation + +The `managedenvironments` SDK allows for interaction with the Azure Resource Manager Service `containerapps` (API Version `2022-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments" +``` + + +### Client Initialization + +```go +client := managedenvironments.NewManagedEnvironmentsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ManagedEnvironmentsClient.CertificatesCreateOrUpdate` + +```go +ctx := context.TODO() +id := managedenvironments.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue", "certificateValue") + +payload := managedenvironments.Certificate{ + // ... +} + + +read, err := client.CertificatesCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedEnvironmentsClient.CertificatesDelete` + +```go +ctx := context.TODO() +id := managedenvironments.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue", "certificateValue") + +read, err := client.CertificatesDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedEnvironmentsClient.CertificatesGet` + +```go +ctx := context.TODO() +id := managedenvironments.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue", "certificateValue") + +read, err := client.CertificatesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedEnvironmentsClient.CertificatesList` + +```go +ctx := context.TODO() +id := managedenvironments.NewManagedEnvironmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue") + +// alternatively `client.CertificatesList(ctx, id)` can be used to do batched pagination +items, err := client.CertificatesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ManagedEnvironmentsClient.CertificatesUpdate` + +```go +ctx := context.TODO() +id := managedenvironments.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue", "certificateValue") + +payload := managedenvironments.CertificatePatch{ + // ... +} + + +read, err := client.CertificatesUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedEnvironmentsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := managedenvironments.NewManagedEnvironmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue") + +payload := managedenvironments.ManagedEnvironment{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ManagedEnvironmentsClient.Delete` + +```go +ctx := context.TODO() +id := managedenvironments.NewManagedEnvironmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ManagedEnvironmentsClient.Get` + +```go +ctx := context.TODO() +id := managedenvironments.NewManagedEnvironmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedEnvironmentsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := managedenvironments.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ManagedEnvironmentsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := managedenvironments.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ManagedEnvironmentsClient.NamespacesCheckNameAvailability` + +```go +ctx := context.TODO() +id := managedenvironments.NewManagedEnvironmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue") + +payload := managedenvironments.CheckNameAvailabilityRequest{ + // ... +} + + +read, err := client.NamespacesCheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedEnvironmentsClient.Update` + +```go +ctx := context.TODO() +id := managedenvironments.NewManagedEnvironmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue") + +payload := managedenvironments.ManagedEnvironment{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/client.go new file mode 100644 index 000000000000..108266c5c80d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/client.go @@ -0,0 +1,18 @@ +package managedenvironments + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedEnvironmentsClient struct { + Client autorest.Client + baseUri string +} + +func NewManagedEnvironmentsClientWithBaseURI(endpoint string) ManagedEnvironmentsClient { + return ManagedEnvironmentsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/constants.go new file mode 100644 index 000000000000..066bda49bd2b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/constants.go @@ -0,0 +1,123 @@ +package managedenvironments + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateProvisioningState string + +const ( + CertificateProvisioningStateCanceled CertificateProvisioningState = "Canceled" + CertificateProvisioningStateDeleteFailed CertificateProvisioningState = "DeleteFailed" + CertificateProvisioningStateFailed CertificateProvisioningState = "Failed" + CertificateProvisioningStatePending CertificateProvisioningState = "Pending" + CertificateProvisioningStateSucceeded CertificateProvisioningState = "Succeeded" +) + +func PossibleValuesForCertificateProvisioningState() []string { + return []string{ + string(CertificateProvisioningStateCanceled), + string(CertificateProvisioningStateDeleteFailed), + string(CertificateProvisioningStateFailed), + string(CertificateProvisioningStatePending), + string(CertificateProvisioningStateSucceeded), + } +} + +func parseCertificateProvisioningState(input string) (*CertificateProvisioningState, error) { + vals := map[string]CertificateProvisioningState{ + "canceled": CertificateProvisioningStateCanceled, + "deletefailed": CertificateProvisioningStateDeleteFailed, + "failed": CertificateProvisioningStateFailed, + "pending": CertificateProvisioningStatePending, + "succeeded": CertificateProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CertificateProvisioningState(input) + return &out, nil +} + +type CheckNameAvailabilityReason string + +const ( + CheckNameAvailabilityReasonAlreadyExists CheckNameAvailabilityReason = "AlreadyExists" + CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" +) + +func PossibleValuesForCheckNameAvailabilityReason() []string { + return []string{ + string(CheckNameAvailabilityReasonAlreadyExists), + string(CheckNameAvailabilityReasonInvalid), + } +} + +func parseCheckNameAvailabilityReason(input string) (*CheckNameAvailabilityReason, error) { + vals := map[string]CheckNameAvailabilityReason{ + "alreadyexists": CheckNameAvailabilityReasonAlreadyExists, + "invalid": CheckNameAvailabilityReasonInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CheckNameAvailabilityReason(input) + return &out, nil +} + +type EnvironmentProvisioningState string + +const ( + EnvironmentProvisioningStateCanceled EnvironmentProvisioningState = "Canceled" + EnvironmentProvisioningStateFailed EnvironmentProvisioningState = "Failed" + EnvironmentProvisioningStateInfrastructureSetupComplete EnvironmentProvisioningState = "InfrastructureSetupComplete" + EnvironmentProvisioningStateInfrastructureSetupInProgress EnvironmentProvisioningState = "InfrastructureSetupInProgress" + EnvironmentProvisioningStateInitializationInProgress EnvironmentProvisioningState = "InitializationInProgress" + EnvironmentProvisioningStateScheduledForDelete EnvironmentProvisioningState = "ScheduledForDelete" + EnvironmentProvisioningStateSucceeded EnvironmentProvisioningState = "Succeeded" + EnvironmentProvisioningStateUpgradeFailed EnvironmentProvisioningState = "UpgradeFailed" + EnvironmentProvisioningStateUpgradeRequested EnvironmentProvisioningState = "UpgradeRequested" + EnvironmentProvisioningStateWaiting EnvironmentProvisioningState = "Waiting" +) + +func PossibleValuesForEnvironmentProvisioningState() []string { + return []string{ + string(EnvironmentProvisioningStateCanceled), + string(EnvironmentProvisioningStateFailed), + string(EnvironmentProvisioningStateInfrastructureSetupComplete), + string(EnvironmentProvisioningStateInfrastructureSetupInProgress), + string(EnvironmentProvisioningStateInitializationInProgress), + string(EnvironmentProvisioningStateScheduledForDelete), + string(EnvironmentProvisioningStateSucceeded), + string(EnvironmentProvisioningStateUpgradeFailed), + string(EnvironmentProvisioningStateUpgradeRequested), + string(EnvironmentProvisioningStateWaiting), + } +} + +func parseEnvironmentProvisioningState(input string) (*EnvironmentProvisioningState, error) { + vals := map[string]EnvironmentProvisioningState{ + "canceled": EnvironmentProvisioningStateCanceled, + "failed": EnvironmentProvisioningStateFailed, + "infrastructuresetupcomplete": EnvironmentProvisioningStateInfrastructureSetupComplete, + "infrastructuresetupinprogress": EnvironmentProvisioningStateInfrastructureSetupInProgress, + "initializationinprogress": EnvironmentProvisioningStateInitializationInProgress, + "scheduledfordelete": EnvironmentProvisioningStateScheduledForDelete, + "succeeded": EnvironmentProvisioningStateSucceeded, + "upgradefailed": EnvironmentProvisioningStateUpgradeFailed, + "upgraderequested": EnvironmentProvisioningStateUpgradeRequested, + "waiting": EnvironmentProvisioningStateWaiting, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnvironmentProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/id_certificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/id_certificate.go new file mode 100644 index 000000000000..e493941847b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/id_certificate.go @@ -0,0 +1,137 @@ +package managedenvironments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = CertificateId{} + +// CertificateId is a struct representing the Resource ID for a Certificate +type CertificateId struct { + SubscriptionId string + ResourceGroupName string + ManagedEnvironmentName string + CertificateName string +} + +// NewCertificateID returns a new CertificateId struct +func NewCertificateID(subscriptionId string, resourceGroupName string, managedEnvironmentName string, certificateName string) CertificateId { + return CertificateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedEnvironmentName: managedEnvironmentName, + CertificateName: certificateName, + } +} + +// ParseCertificateID parses 'input' into a CertificateId +func ParseCertificateID(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(CertificateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CertificateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { + return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseCertificateIDInsensitively parses 'input' case-insensitively into a CertificateId +// note: this method should only be used for API response data and not user input +func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(CertificateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CertificateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { + return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateCertificateID checks that 'input' can be parsed as a Certificate ID +func ValidateCertificateID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCertificateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Certificate ID +func (id CertificateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.App/managedEnvironments/%s/certificates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedEnvironmentName, id.CertificateName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Certificate ID +func (id CertificateId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApp", "Microsoft.App", "Microsoft.App"), + resourceids.StaticSegment("staticManagedEnvironments", "managedEnvironments", "managedEnvironments"), + resourceids.UserSpecifiedSegment("managedEnvironmentName", "managedEnvironmentValue"), + resourceids.StaticSegment("staticCertificates", "certificates", "certificates"), + resourceids.UserSpecifiedSegment("certificateName", "certificateValue"), + } +} + +// String returns a human-readable description of this Certificate ID +func (id CertificateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Managed Environment Name: %q", id.ManagedEnvironmentName), + fmt.Sprintf("Certificate Name: %q", id.CertificateName), + } + return fmt.Sprintf("Certificate (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/id_managedenvironment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/id_managedenvironment.go new file mode 100644 index 000000000000..9edf6e7f8e41 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/id_managedenvironment.go @@ -0,0 +1,124 @@ +package managedenvironments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ManagedEnvironmentId{} + +// ManagedEnvironmentId is a struct representing the Resource ID for a Managed Environment +type ManagedEnvironmentId struct { + SubscriptionId string + ResourceGroupName string + ManagedEnvironmentName string +} + +// NewManagedEnvironmentID returns a new ManagedEnvironmentId struct +func NewManagedEnvironmentID(subscriptionId string, resourceGroupName string, managedEnvironmentName string) ManagedEnvironmentId { + return ManagedEnvironmentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedEnvironmentName: managedEnvironmentName, + } +} + +// ParseManagedEnvironmentID parses 'input' into a ManagedEnvironmentId +func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagedEnvironmentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagedEnvironmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseManagedEnvironmentIDInsensitively parses 'input' case-insensitively into a ManagedEnvironmentId +// note: this method should only be used for API response data and not user input +func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagedEnvironmentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagedEnvironmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID +func ValidateManagedEnvironmentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseManagedEnvironmentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Managed Environment ID +func (id ManagedEnvironmentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.App/managedEnvironments/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedEnvironmentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Managed Environment ID +func (id ManagedEnvironmentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApp", "Microsoft.App", "Microsoft.App"), + resourceids.StaticSegment("staticManagedEnvironments", "managedEnvironments", "managedEnvironments"), + resourceids.UserSpecifiedSegment("managedEnvironmentName", "managedEnvironmentValue"), + } +} + +// String returns a human-readable description of this Managed Environment ID +func (id ManagedEnvironmentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Managed Environment Name: %q", id.ManagedEnvironmentName), + } + return fmt.Sprintf("Managed Environment (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_certificatescreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_certificatescreateorupdate_autorest.go new file mode 100644 index 000000000000..d9ec76b6dfa0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_certificatescreateorupdate_autorest.go @@ -0,0 +1,69 @@ +package managedenvironments + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificatesCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Certificate +} + +// CertificatesCreateOrUpdate ... +func (c ManagedEnvironmentsClient) CertificatesCreateOrUpdate(ctx context.Context, id CertificateId, input Certificate) (result CertificatesCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCertificatesCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesCreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCertificatesCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesCreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCertificatesCreateOrUpdate prepares the CertificatesCreateOrUpdate request. +func (c ManagedEnvironmentsClient) preparerForCertificatesCreateOrUpdate(ctx context.Context, id CertificateId, input Certificate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCertificatesCreateOrUpdate handles the response to the CertificatesCreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ManagedEnvironmentsClient) responderForCertificatesCreateOrUpdate(resp *http.Response) (result CertificatesCreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_certificatesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_certificatesdelete_autorest.go new file mode 100644 index 000000000000..331db48e9a51 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_certificatesdelete_autorest.go @@ -0,0 +1,66 @@ +package managedenvironments + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificatesDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// CertificatesDelete ... +func (c ManagedEnvironmentsClient) CertificatesDelete(ctx context.Context, id CertificateId) (result CertificatesDeleteOperationResponse, err error) { + req, err := c.preparerForCertificatesDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCertificatesDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCertificatesDelete prepares the CertificatesDelete request. +func (c ManagedEnvironmentsClient) preparerForCertificatesDelete(ctx context.Context, id CertificateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCertificatesDelete handles the response to the CertificatesDelete request. The method always +// closes the http.Response Body. +func (c ManagedEnvironmentsClient) responderForCertificatesDelete(resp *http.Response) (result CertificatesDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_certificatesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_certificatesget_autorest.go new file mode 100644 index 000000000000..429ede14d531 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_certificatesget_autorest.go @@ -0,0 +1,68 @@ +package managedenvironments + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificatesGetOperationResponse struct { + HttpResponse *http.Response + Model *Certificate +} + +// CertificatesGet ... +func (c ManagedEnvironmentsClient) CertificatesGet(ctx context.Context, id CertificateId) (result CertificatesGetOperationResponse, err error) { + req, err := c.preparerForCertificatesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCertificatesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCertificatesGet prepares the CertificatesGet request. +func (c ManagedEnvironmentsClient) preparerForCertificatesGet(ctx context.Context, id CertificateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCertificatesGet handles the response to the CertificatesGet request. The method always +// closes the http.Response Body. +func (c ManagedEnvironmentsClient) responderForCertificatesGet(resp *http.Response) (result CertificatesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_certificateslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_certificateslist_autorest.go new file mode 100644 index 000000000000..2b9d85f7f4e5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_certificateslist_autorest.go @@ -0,0 +1,186 @@ +package managedenvironments + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificatesListOperationResponse struct { + HttpResponse *http.Response + Model *[]Certificate + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (CertificatesListOperationResponse, error) +} + +type CertificatesListCompleteResult struct { + Items []Certificate +} + +func (r CertificatesListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r CertificatesListOperationResponse) LoadMore(ctx context.Context) (resp CertificatesListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// CertificatesList ... +func (c ManagedEnvironmentsClient) CertificatesList(ctx context.Context, id ManagedEnvironmentId) (resp CertificatesListOperationResponse, err error) { + req, err := c.preparerForCertificatesList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForCertificatesList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForCertificatesList prepares the CertificatesList request. +func (c ManagedEnvironmentsClient) preparerForCertificatesList(ctx context.Context, id ManagedEnvironmentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/certificates", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForCertificatesListWithNextLink prepares the CertificatesList request with the given nextLink token. +func (c ManagedEnvironmentsClient) preparerForCertificatesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCertificatesList handles the response to the CertificatesList request. The method always +// closes the http.Response Body. +func (c ManagedEnvironmentsClient) responderForCertificatesList(resp *http.Response) (result CertificatesListOperationResponse, err error) { + type page struct { + Values []Certificate `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result CertificatesListOperationResponse, err error) { + req, err := c.preparerForCertificatesListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCertificatesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// CertificatesListComplete retrieves all of the results into a single object +func (c ManagedEnvironmentsClient) CertificatesListComplete(ctx context.Context, id ManagedEnvironmentId) (CertificatesListCompleteResult, error) { + return c.CertificatesListCompleteMatchingPredicate(ctx, id, CertificateOperationPredicate{}) +} + +// CertificatesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ManagedEnvironmentsClient) CertificatesListCompleteMatchingPredicate(ctx context.Context, id ManagedEnvironmentId, predicate CertificateOperationPredicate) (resp CertificatesListCompleteResult, err error) { + items := make([]Certificate, 0) + + page, err := c.CertificatesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := CertificatesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_certificatesupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_certificatesupdate_autorest.go new file mode 100644 index 000000000000..b61915318e5e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_certificatesupdate_autorest.go @@ -0,0 +1,69 @@ +package managedenvironments + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificatesUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Certificate +} + +// CertificatesUpdate ... +func (c ManagedEnvironmentsClient) CertificatesUpdate(ctx context.Context, id CertificateId, input CertificatePatch) (result CertificatesUpdateOperationResponse, err error) { + req, err := c.preparerForCertificatesUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCertificatesUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CertificatesUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCertificatesUpdate prepares the CertificatesUpdate request. +func (c ManagedEnvironmentsClient) preparerForCertificatesUpdate(ctx context.Context, id CertificateId, input CertificatePatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCertificatesUpdate handles the response to the CertificatesUpdate request. The method always +// closes the http.Response Body. +func (c ManagedEnvironmentsClient) responderForCertificatesUpdate(resp *http.Response) (result CertificatesUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_createorupdate_autorest.go new file mode 100644 index 000000000000..e084082a3006 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package managedenvironments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c ManagedEnvironmentsClient) CreateOrUpdate(ctx context.Context, id ManagedEnvironmentId, input ManagedEnvironment) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ManagedEnvironmentsClient) CreateOrUpdateThenPoll(ctx context.Context, id ManagedEnvironmentId, input ManagedEnvironment) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ManagedEnvironmentsClient) preparerForCreateOrUpdate(ctx context.Context, id ManagedEnvironmentId, input ManagedEnvironment) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ManagedEnvironmentsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_delete_autorest.go new file mode 100644 index 000000000000..ee6f65f0729e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_delete_autorest.go @@ -0,0 +1,78 @@ +package managedenvironments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ManagedEnvironmentsClient) Delete(ctx context.Context, id ManagedEnvironmentId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ManagedEnvironmentsClient) DeleteThenPoll(ctx context.Context, id ManagedEnvironmentId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ManagedEnvironmentsClient) preparerForDelete(ctx context.Context, id ManagedEnvironmentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ManagedEnvironmentsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_get_autorest.go new file mode 100644 index 000000000000..2796015d3a42 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_get_autorest.go @@ -0,0 +1,68 @@ +package managedenvironments + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ManagedEnvironment +} + +// Get ... +func (c ManagedEnvironmentsClient) Get(ctx context.Context, id ManagedEnvironmentId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ManagedEnvironmentsClient) preparerForGet(ctx context.Context, id ManagedEnvironmentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ManagedEnvironmentsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..f93a4a2e35db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package managedenvironments + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]ManagedEnvironment + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []ManagedEnvironment +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c ManagedEnvironmentsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ManagedEnvironmentsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.App/managedEnvironments", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c ManagedEnvironmentsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ManagedEnvironmentsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []ManagedEnvironment `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c ManagedEnvironmentsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ManagedEnvironmentOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ManagedEnvironmentsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ManagedEnvironmentOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]ManagedEnvironment, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_listbysubscription_autorest.go new file mode 100644 index 000000000000..cedf78377f36 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package managedenvironments + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]ManagedEnvironment + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []ManagedEnvironment +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c ManagedEnvironmentsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c ManagedEnvironmentsClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.App/managedEnvironments", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c ManagedEnvironmentsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c ManagedEnvironmentsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []ManagedEnvironment `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c ManagedEnvironmentsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ManagedEnvironmentOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ManagedEnvironmentsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ManagedEnvironmentOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]ManagedEnvironment, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_namespaceschecknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_namespaceschecknameavailability_autorest.go new file mode 100644 index 000000000000..d29a4ef6ee5b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_namespaceschecknameavailability_autorest.go @@ -0,0 +1,70 @@ +package managedenvironments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesCheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameAvailabilityResponse +} + +// NamespacesCheckNameAvailability ... +func (c ManagedEnvironmentsClient) NamespacesCheckNameAvailability(ctx context.Context, id ManagedEnvironmentId, input CheckNameAvailabilityRequest) (result NamespacesCheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForNamespacesCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "NamespacesCheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "NamespacesCheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForNamespacesCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "NamespacesCheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForNamespacesCheckNameAvailability prepares the NamespacesCheckNameAvailability request. +func (c ManagedEnvironmentsClient) preparerForNamespacesCheckNameAvailability(ctx context.Context, id ManagedEnvironmentId, input CheckNameAvailabilityRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForNamespacesCheckNameAvailability handles the response to the NamespacesCheckNameAvailability request. The method always +// closes the http.Response Body. +func (c ManagedEnvironmentsClient) responderForNamespacesCheckNameAvailability(resp *http.Response) (result NamespacesCheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_update_autorest.go new file mode 100644 index 000000000000..5ffc9b51baa5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/method_update_autorest.go @@ -0,0 +1,79 @@ +package managedenvironments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c ManagedEnvironmentsClient) Update(ctx context.Context, id ManagedEnvironmentId, input ManagedEnvironment) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironments.ManagedEnvironmentsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ManagedEnvironmentsClient) UpdateThenPoll(ctx context.Context, id ManagedEnvironmentId, input ManagedEnvironment) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c ManagedEnvironmentsClient) preparerForUpdate(ctx context.Context, id ManagedEnvironmentId, input ManagedEnvironment) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c ManagedEnvironmentsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_applogsconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_applogsconfiguration.go new file mode 100644 index 000000000000..abdf9f786578 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_applogsconfiguration.go @@ -0,0 +1,9 @@ +package managedenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AppLogsConfiguration struct { + Destination *string `json:"destination,omitempty"` + LogAnalyticsConfiguration *LogAnalyticsConfiguration `json:"logAnalyticsConfiguration,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_certificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_certificate.go new file mode 100644 index 000000000000..484fed38c234 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_certificate.go @@ -0,0 +1,18 @@ +package managedenvironments + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Certificate struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *CertificateProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_certificatepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_certificatepatch.go new file mode 100644 index 000000000000..2dac1ee3ef33 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_certificatepatch.go @@ -0,0 +1,8 @@ +package managedenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificatePatch struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_certificateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_certificateproperties.go new file mode 100644 index 000000000000..d6cde77952bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_certificateproperties.go @@ -0,0 +1,47 @@ +package managedenvironments + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateProperties struct { + ExpirationDate *string `json:"expirationDate,omitempty"` + IssueDate *string `json:"issueDate,omitempty"` + Issuer *string `json:"issuer,omitempty"` + Password *string `json:"password,omitempty"` + ProvisioningState *CertificateProvisioningState `json:"provisioningState,omitempty"` + PublicKeyHash *string `json:"publicKeyHash,omitempty"` + SubjectName *string `json:"subjectName,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + Valid *bool `json:"valid,omitempty"` + Value *string `json:"value,omitempty"` +} + +func (o *CertificateProperties) GetExpirationDateAsTime() (*time.Time, error) { + if o.ExpirationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ExpirationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *CertificateProperties) SetExpirationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationDate = &formatted +} + +func (o *CertificateProperties) GetIssueDateAsTime() (*time.Time, error) { + if o.IssueDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.IssueDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *CertificateProperties) SetIssueDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.IssueDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_checknameavailabilityrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_checknameavailabilityrequest.go new file mode 100644 index 000000000000..d294561f4e0d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_checknameavailabilityrequest.go @@ -0,0 +1,9 @@ +package managedenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityRequest struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_checknameavailabilityresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_checknameavailabilityresponse.go new file mode 100644 index 000000000000..4543ac719ef5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_checknameavailabilityresponse.go @@ -0,0 +1,10 @@ +package managedenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityResponse struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *CheckNameAvailabilityReason `json:"reason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_loganalyticsconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_loganalyticsconfiguration.go new file mode 100644 index 000000000000..f521fb6729d5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_loganalyticsconfiguration.go @@ -0,0 +1,9 @@ +package managedenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogAnalyticsConfiguration struct { + CustomerId *string `json:"customerId,omitempty"` + SharedKey *string `json:"sharedKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_managedenvironment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_managedenvironment.go new file mode 100644 index 000000000000..a62721d9740c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_managedenvironment.go @@ -0,0 +1,18 @@ +package managedenvironments + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedEnvironment struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ManagedEnvironmentProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_managedenvironmentproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_managedenvironmentproperties.go new file mode 100644 index 000000000000..813ce767ba85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_managedenvironmentproperties.go @@ -0,0 +1,16 @@ +package managedenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedEnvironmentProperties struct { + AppLogsConfiguration *AppLogsConfiguration `json:"appLogsConfiguration,omitempty"` + DaprAIConnectionString *string `json:"daprAIConnectionString,omitempty"` + DaprAIInstrumentationKey *string `json:"daprAIInstrumentationKey,omitempty"` + DefaultDomain *string `json:"defaultDomain,omitempty"` + DeploymentErrors *string `json:"deploymentErrors,omitempty"` + ProvisioningState *EnvironmentProvisioningState `json:"provisioningState,omitempty"` + StaticIP *string `json:"staticIp,omitempty"` + VnetConfiguration *VnetConfiguration `json:"vnetConfiguration,omitempty"` + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_vnetconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_vnetconfiguration.go new file mode 100644 index 000000000000..1cb11fc88149 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/model_vnetconfiguration.go @@ -0,0 +1,13 @@ +package managedenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VnetConfiguration struct { + DockerBridgeCidr *string `json:"dockerBridgeCidr,omitempty"` + InfrastructureSubnetId *string `json:"infrastructureSubnetId,omitempty"` + Internal *bool `json:"internal,omitempty"` + PlatformReservedCidr *string `json:"platformReservedCidr,omitempty"` + PlatformReservedDnsIP *string `json:"platformReservedDnsIP,omitempty"` + RuntimeSubnetId *string `json:"runtimeSubnetId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/predicates.go new file mode 100644 index 000000000000..4f6b398b1fc2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/predicates.go @@ -0,0 +1,57 @@ +package managedenvironments + +type CertificateOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CertificateOperationPredicate) Matches(input Certificate) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type ManagedEnvironmentOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ManagedEnvironmentOperationPredicate) Matches(input ManagedEnvironment) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/version.go new file mode 100644 index 000000000000..1aa6d02f9748 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments/version.go @@ -0,0 +1,12 @@ +package managedenvironments + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/managedenvironments/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/README.md new file mode 100644 index 000000000000..25185f6fff18 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/README.md @@ -0,0 +1,89 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages` Documentation + +The `managedenvironmentsstorages` SDK allows for interaction with the Azure Resource Manager Service `containerapps` (API Version `2022-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages" +``` + + +### Client Initialization + +```go +client := managedenvironmentsstorages.NewManagedEnvironmentsStoragesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ManagedEnvironmentsStoragesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := managedenvironmentsstorages.NewStorageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue", "storageValue") + +payload := managedenvironmentsstorages.ManagedEnvironmentStorage{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedEnvironmentsStoragesClient.Delete` + +```go +ctx := context.TODO() +id := managedenvironmentsstorages.NewStorageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue", "storageValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedEnvironmentsStoragesClient.Get` + +```go +ctx := context.TODO() +id := managedenvironmentsstorages.NewStorageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue", "storageValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedEnvironmentsStoragesClient.List` + +```go +ctx := context.TODO() +id := managedenvironmentsstorages.NewManagedEnvironmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedEnvironmentValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/client.go new file mode 100644 index 000000000000..4b778666a051 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/client.go @@ -0,0 +1,18 @@ +package managedenvironmentsstorages + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedEnvironmentsStoragesClient struct { + Client autorest.Client + baseUri string +} + +func NewManagedEnvironmentsStoragesClientWithBaseURI(endpoint string) ManagedEnvironmentsStoragesClient { + return ManagedEnvironmentsStoragesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/constants.go new file mode 100644 index 000000000000..d611e4b1d421 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/constants.go @@ -0,0 +1,34 @@ +package managedenvironmentsstorages + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessMode string + +const ( + AccessModeReadOnly AccessMode = "ReadOnly" + AccessModeReadWrite AccessMode = "ReadWrite" +) + +func PossibleValuesForAccessMode() []string { + return []string{ + string(AccessModeReadOnly), + string(AccessModeReadWrite), + } +} + +func parseAccessMode(input string) (*AccessMode, error) { + vals := map[string]AccessMode{ + "readonly": AccessModeReadOnly, + "readwrite": AccessModeReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessMode(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/id_managedenvironment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/id_managedenvironment.go new file mode 100644 index 000000000000..feab0ecb65b4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/id_managedenvironment.go @@ -0,0 +1,124 @@ +package managedenvironmentsstorages + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ManagedEnvironmentId{} + +// ManagedEnvironmentId is a struct representing the Resource ID for a Managed Environment +type ManagedEnvironmentId struct { + SubscriptionId string + ResourceGroupName string + ManagedEnvironmentName string +} + +// NewManagedEnvironmentID returns a new ManagedEnvironmentId struct +func NewManagedEnvironmentID(subscriptionId string, resourceGroupName string, managedEnvironmentName string) ManagedEnvironmentId { + return ManagedEnvironmentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedEnvironmentName: managedEnvironmentName, + } +} + +// ParseManagedEnvironmentID parses 'input' into a ManagedEnvironmentId +func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagedEnvironmentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagedEnvironmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseManagedEnvironmentIDInsensitively parses 'input' case-insensitively into a ManagedEnvironmentId +// note: this method should only be used for API response data and not user input +func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagedEnvironmentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagedEnvironmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID +func ValidateManagedEnvironmentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseManagedEnvironmentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Managed Environment ID +func (id ManagedEnvironmentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.App/managedEnvironments/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedEnvironmentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Managed Environment ID +func (id ManagedEnvironmentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApp", "Microsoft.App", "Microsoft.App"), + resourceids.StaticSegment("staticManagedEnvironments", "managedEnvironments", "managedEnvironments"), + resourceids.UserSpecifiedSegment("managedEnvironmentName", "managedEnvironmentValue"), + } +} + +// String returns a human-readable description of this Managed Environment ID +func (id ManagedEnvironmentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Managed Environment Name: %q", id.ManagedEnvironmentName), + } + return fmt.Sprintf("Managed Environment (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/id_storage.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/id_storage.go new file mode 100644 index 000000000000..4de32cc51c92 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/id_storage.go @@ -0,0 +1,137 @@ +package managedenvironmentsstorages + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = StorageId{} + +// StorageId is a struct representing the Resource ID for a Storage +type StorageId struct { + SubscriptionId string + ResourceGroupName string + ManagedEnvironmentName string + StorageName string +} + +// NewStorageID returns a new StorageId struct +func NewStorageID(subscriptionId string, resourceGroupName string, managedEnvironmentName string, storageName string) StorageId { + return StorageId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedEnvironmentName: managedEnvironmentName, + StorageName: storageName, + } +} + +// ParseStorageID parses 'input' into a StorageId +func ParseStorageID(input string) (*StorageId, error) { + parser := resourceids.NewParserFromResourceIdType(StorageId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := StorageId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { + return nil, fmt.Errorf("the segment 'storageName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseStorageIDInsensitively parses 'input' case-insensitively into a StorageId +// note: this method should only be used for API response data and not user input +func ParseStorageIDInsensitively(input string) (*StorageId, error) { + parser := resourceids.NewParserFromResourceIdType(StorageId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := StorageId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'managedEnvironmentName' was not found in the resource id %q", input) + } + + if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { + return nil, fmt.Errorf("the segment 'storageName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateStorageID checks that 'input' can be parsed as a Storage ID +func ValidateStorageID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseStorageID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Storage ID +func (id StorageId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.App/managedEnvironments/%s/storages/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedEnvironmentName, id.StorageName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Storage ID +func (id StorageId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftApp", "Microsoft.App", "Microsoft.App"), + resourceids.StaticSegment("staticManagedEnvironments", "managedEnvironments", "managedEnvironments"), + resourceids.UserSpecifiedSegment("managedEnvironmentName", "managedEnvironmentValue"), + resourceids.StaticSegment("staticStorages", "storages", "storages"), + resourceids.UserSpecifiedSegment("storageName", "storageValue"), + } +} + +// String returns a human-readable description of this Storage ID +func (id StorageId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Managed Environment Name: %q", id.ManagedEnvironmentName), + fmt.Sprintf("Storage Name: %q", id.StorageName), + } + return fmt.Sprintf("Storage (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/method_createorupdate_autorest.go new file mode 100644 index 000000000000..91bf3d025039 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package managedenvironmentsstorages + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *ManagedEnvironmentStorage +} + +// CreateOrUpdate ... +func (c ManagedEnvironmentsStoragesClient) CreateOrUpdate(ctx context.Context, id StorageId, input ManagedEnvironmentStorage) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironmentsstorages.ManagedEnvironmentsStoragesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironmentsstorages.ManagedEnvironmentsStoragesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironmentsstorages.ManagedEnvironmentsStoragesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ManagedEnvironmentsStoragesClient) preparerForCreateOrUpdate(ctx context.Context, id StorageId, input ManagedEnvironmentStorage) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ManagedEnvironmentsStoragesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/method_delete_autorest.go new file mode 100644 index 000000000000..0880c2fdc939 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/method_delete_autorest.go @@ -0,0 +1,66 @@ +package managedenvironmentsstorages + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ManagedEnvironmentsStoragesClient) Delete(ctx context.Context, id StorageId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironmentsstorages.ManagedEnvironmentsStoragesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironmentsstorages.ManagedEnvironmentsStoragesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironmentsstorages.ManagedEnvironmentsStoragesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ManagedEnvironmentsStoragesClient) preparerForDelete(ctx context.Context, id StorageId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ManagedEnvironmentsStoragesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/method_get_autorest.go new file mode 100644 index 000000000000..a4b3cbf04dd4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/method_get_autorest.go @@ -0,0 +1,68 @@ +package managedenvironmentsstorages + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ManagedEnvironmentStorage +} + +// Get ... +func (c ManagedEnvironmentsStoragesClient) Get(ctx context.Context, id StorageId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironmentsstorages.ManagedEnvironmentsStoragesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironmentsstorages.ManagedEnvironmentsStoragesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironmentsstorages.ManagedEnvironmentsStoragesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ManagedEnvironmentsStoragesClient) preparerForGet(ctx context.Context, id StorageId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ManagedEnvironmentsStoragesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/method_list_autorest.go new file mode 100644 index 000000000000..d51c2366965b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/method_list_autorest.go @@ -0,0 +1,69 @@ +package managedenvironmentsstorages + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *ManagedEnvironmentStoragesCollection +} + +// List ... +func (c ManagedEnvironmentsStoragesClient) List(ctx context.Context, id ManagedEnvironmentId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironmentsstorages.ManagedEnvironmentsStoragesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironmentsstorages.ManagedEnvironmentsStoragesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedenvironmentsstorages.ManagedEnvironmentsStoragesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c ManagedEnvironmentsStoragesClient) preparerForList(ctx context.Context, id ManagedEnvironmentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/storages", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ManagedEnvironmentsStoragesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/model_azurefileproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/model_azurefileproperties.go new file mode 100644 index 000000000000..e7a33554e850 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/model_azurefileproperties.go @@ -0,0 +1,11 @@ +package managedenvironmentsstorages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureFileProperties struct { + AccessMode *AccessMode `json:"accessMode,omitempty"` + AccountKey *string `json:"accountKey,omitempty"` + AccountName *string `json:"accountName,omitempty"` + ShareName *string `json:"shareName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/model_managedenvironmentstorage.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/model_managedenvironmentstorage.go new file mode 100644 index 000000000000..3bc1545fd92b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/model_managedenvironmentstorage.go @@ -0,0 +1,16 @@ +package managedenvironmentsstorages + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedEnvironmentStorage struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ManagedEnvironmentStorageProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/model_managedenvironmentstorageproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/model_managedenvironmentstorageproperties.go new file mode 100644 index 000000000000..45fe17a07dc4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/model_managedenvironmentstorageproperties.go @@ -0,0 +1,8 @@ +package managedenvironmentsstorages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedEnvironmentStorageProperties struct { + AzureFile *AzureFileProperties `json:"azureFile,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/model_managedenvironmentstoragescollection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/model_managedenvironmentstoragescollection.go new file mode 100644 index 000000000000..9e26cae077c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/model_managedenvironmentstoragescollection.go @@ -0,0 +1,8 @@ +package managedenvironmentsstorages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedEnvironmentStoragesCollection struct { + Value []ManagedEnvironmentStorage `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/version.go new file mode 100644 index 000000000000..fa52a4869555 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/version.go @@ -0,0 +1,12 @@ +package managedenvironmentsstorages + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/managedenvironmentsstorages/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-10-01/containerinstance/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-10-01/containerinstance/id_location.go index a1f453fb23fb..23b7f3babf7b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-10-01/containerinstance/id_location.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-10-01/containerinstance/id_location.go @@ -12,14 +12,14 @@ var _ resourceids.ResourceId = LocationId{} // LocationId is a struct representing the Resource ID for a Location type LocationId struct { SubscriptionId string - Location string + LocationName string } // NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { +func NewLocationID(subscriptionId string, locationName string) LocationId { return LocationId{ SubscriptionId: subscriptionId, - Location: location, + LocationName: locationName, } } @@ -38,8 +38,8 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.ContainerInstance/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } // Segments returns a slice of Resource ID Segments which comprise this Location ID @@ -97,7 +97,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerInstance", "Microsoft.ContainerInstance", "Microsoft.ContainerInstance"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), } } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { func (id LocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), } return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/README.md new file mode 100644 index 000000000000..0930a3f061dd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/README.md @@ -0,0 +1,36 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices` Documentation + +The `containerservices` SDK allows for interaction with the Azure Resource Manager Service `containerservice` (API Version `2019-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices" +``` + + +### Client Initialization + +```go +client := containerservices.NewContainerServicesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ContainerServicesClient.ListOrchestrators` + +```go +ctx := context.TODO() +id := containerservices.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +read, err := client.ListOrchestrators(ctx, id, containerservices.DefaultListOrchestratorsOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/client.go new file mode 100644 index 000000000000..5b5e29cecb06 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/client.go @@ -0,0 +1,18 @@ +package containerservices + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerServicesClient struct { + Client autorest.Client + baseUri string +} + +func NewContainerServicesClientWithBaseURI(endpoint string) ContainerServicesClient { + return ContainerServicesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/id_location.go similarity index 93% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/id_location.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/id_location.go index 5060f1c3c199..7f52bb382809 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/id_location.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/id_location.go @@ -1,4 +1,4 @@ -package accounts +package containerservices import ( "fmt" @@ -85,7 +85,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.Media/locations/%s" + fmtString := "/subscriptions/%s/providers/Microsoft.ContainerService/locations/%s" return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } @@ -95,7 +95,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), + resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticLocations", "locations", "locations"), resourceids.UserSpecifiedSegment("locationName", "locationValue"), } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/method_listorchestrators_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/method_listorchestrators_autorest.go new file mode 100644 index 000000000000..88eef13a3db9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/method_listorchestrators_autorest.go @@ -0,0 +1,98 @@ +package containerservices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOrchestratorsOperationResponse struct { + HttpResponse *http.Response + Model *OrchestratorVersionProfileListResult +} + +type ListOrchestratorsOperationOptions struct { + ResourceType *string +} + +func DefaultListOrchestratorsOperationOptions() ListOrchestratorsOperationOptions { + return ListOrchestratorsOperationOptions{} +} + +func (o ListOrchestratorsOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOrchestratorsOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.ResourceType != nil { + out["resource-type"] = *o.ResourceType + } + + return out +} + +// ListOrchestrators ... +func (c ContainerServicesClient) ListOrchestrators(ctx context.Context, id LocationId, options ListOrchestratorsOperationOptions) (result ListOrchestratorsOperationResponse, err error) { + req, err := c.preparerForListOrchestrators(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservices.ContainerServicesClient", "ListOrchestrators", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservices.ContainerServicesClient", "ListOrchestrators", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListOrchestrators(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservices.ContainerServicesClient", "ListOrchestrators", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListOrchestrators prepares the ListOrchestrators request. +func (c ContainerServicesClient) preparerForListOrchestrators(ctx context.Context, id LocationId, options ListOrchestratorsOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/orchestrators", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListOrchestrators handles the response to the ListOrchestrators request. The method always +// closes the http.Response Body. +func (c ContainerServicesClient) responderForListOrchestrators(resp *http.Response) (result ListOrchestratorsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/model_orchestratorprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/model_orchestratorprofile.go new file mode 100644 index 000000000000..b73c2b956820 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/model_orchestratorprofile.go @@ -0,0 +1,10 @@ +package containerservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OrchestratorProfile struct { + IsPreview *bool `json:"isPreview,omitempty"` + OrchestratorType *string `json:"orchestratorType,omitempty"` + OrchestratorVersion string `json:"orchestratorVersion"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/model_orchestratorversionprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/model_orchestratorversionprofile.go new file mode 100644 index 000000000000..053d4f0fad49 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/model_orchestratorversionprofile.go @@ -0,0 +1,12 @@ +package containerservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OrchestratorVersionProfile struct { + Default *bool `json:"default,omitempty"` + IsPreview *bool `json:"isPreview,omitempty"` + OrchestratorType string `json:"orchestratorType"` + OrchestratorVersion string `json:"orchestratorVersion"` + Upgrades *[]OrchestratorProfile `json:"upgrades,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/model_orchestratorversionprofilelistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/model_orchestratorversionprofilelistresult.go new file mode 100644 index 000000000000..970830130f0e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/model_orchestratorversionprofilelistresult.go @@ -0,0 +1,11 @@ +package containerservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OrchestratorVersionProfileListResult struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties OrchestratorVersionProfileProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/model_orchestratorversionprofileproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/model_orchestratorversionprofileproperties.go new file mode 100644 index 000000000000..153c0075a97a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/model_orchestratorversionprofileproperties.go @@ -0,0 +1,8 @@ +package containerservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OrchestratorVersionProfileProperties struct { + Orchestrators []OrchestratorVersionProfile `json:"orchestrators"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/version.go new file mode 100644 index 000000000000..b89b4c90531e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices/version.go @@ -0,0 +1,12 @@ +package containerservices + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/containerservices/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/README.md index e342d4f30fcd..68dcc8d6d366 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := agentpools.NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "agentPoolValue") +id := agentpools.NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "agentPoolValue") read, err := client.AbortLatestOperation(ctx, id) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := agentpools.NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "agentPoolValue") +id := agentpools.NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "agentPoolValue") payload := agentpools.AgentPool{ // ... @@ -57,7 +57,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := agentpools.NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "agentPoolValue") +id := agentpools.NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "agentPoolValue") if err := client.DeleteThenPoll(ctx, id, agentpools.DefaultDeleteOperationOptions()); err != nil { // handle the error @@ -69,7 +69,7 @@ if err := client.DeleteThenPoll(ctx, id, agentpools.DefaultDeleteOperationOption ```go ctx := context.TODO() -id := agentpools.NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "agentPoolValue") +id := agentpools.NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "agentPoolValue") read, err := client.Get(ctx, id) if err != nil { @@ -85,7 +85,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := agentpools.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := agentpools.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") read, err := client.GetAvailableAgentPoolVersions(ctx, id) if err != nil { @@ -101,7 +101,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := agentpools.NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "agentPoolValue") +id := agentpools.NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "agentPoolValue") read, err := client.GetUpgradeProfile(ctx, id) if err != nil { @@ -117,7 +117,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := agentpools.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := agentpools.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) @@ -134,7 +134,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := agentpools.NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "agentPoolValue") +id := agentpools.NewAgentPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "agentPoolValue") if err := client.UpgradeNodeImageVersionThenPoll(ctx, id); err != nil { // handle the error diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/id_agentpool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/id_agentpool.go index 3044009866e5..ab680fc13dc6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/id_agentpool.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/id_agentpool.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = AgentPoolId{} // AgentPoolId is a struct representing the Resource ID for a Agent Pool type AgentPoolId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - AgentPoolName string + SubscriptionId string + ResourceGroupName string + ManagedClusterName string + AgentPoolName string } // NewAgentPoolID returns a new AgentPoolId struct -func NewAgentPoolID(subscriptionId string, resourceGroupName string, resourceName string, agentPoolName string) AgentPoolId { +func NewAgentPoolID(subscriptionId string, resourceGroupName string, managedClusterName string, agentPoolName string) AgentPoolId { return AgentPoolId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - AgentPoolName: agentPoolName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedClusterName: managedClusterName, + AgentPoolName: agentPoolName, } } @@ -46,8 +46,8 @@ func ParseAgentPoolID(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { @@ -77,8 +77,8 @@ func ParseAgentPoolIDInsensitively(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { @@ -106,7 +106,7 @@ func ValidateAgentPoolID(input interface{}, key string) (warnings []string, erro // ID returns the formatted Agent Pool ID func (id AgentPoolId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/managedClusters/%s/agentPools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.AgentPoolName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, id.AgentPoolName) } // Segments returns a slice of Resource ID Segments which comprise this Agent Pool ID @@ -119,7 +119,7 @@ func (id AgentPoolId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), resourceids.StaticSegment("staticAgentPools", "agentPools", "agentPools"), resourceids.UserSpecifiedSegment("agentPoolName", "agentPoolValue"), } @@ -130,7 +130,7 @@ func (id AgentPoolId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), fmt.Sprintf("Agent Pool Name: %q", id.AgentPoolName), } return fmt.Sprintf("Agent Pool (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/id_managedcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/id_managedcluster.go index 340433c0fa8e..9cc2c9ea44ea 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/id_managedcluster.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools/id_managedcluster.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = ManagedClusterId{} // ManagedClusterId is a struct representing the Resource ID for a Managed Cluster type ManagedClusterId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string + SubscriptionId string + ResourceGroupName string + ManagedClusterName string } // NewManagedClusterID returns a new ManagedClusterId struct -func NewManagedClusterID(subscriptionId string, resourceGroupName string, resourceName string) ManagedClusterId { +func NewManagedClusterID(subscriptionId string, resourceGroupName string, managedClusterName string) ManagedClusterId { return ManagedClusterId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedClusterName: managedClusterName, } } @@ -44,8 +44,8 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateManagedClusterID(input interface{}, key string) (warnings []string, // ID returns the formatted Managed Cluster ID func (id ManagedClusterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/managedClusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName) } // Segments returns a slice of Resource ID Segments which comprise this Managed Cluster ID @@ -109,7 +109,7 @@ func (id ManagedClusterId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), } } @@ -118,7 +118,7 @@ func (id ManagedClusterId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), } return fmt.Sprintf("Managed Cluster (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/README.md index 20afb91f1da1..792b0d242268 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := fleetmembers.NewMemberID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue", "fleetMemberValue") +id := fleetmembers.NewMemberID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue", "memberValue") payload := fleetmembers.FleetMember{ // ... @@ -41,7 +41,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload, fleetmembers.DefaultCr ```go ctx := context.TODO() -id := fleetmembers.NewMemberID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue", "fleetMemberValue") +id := fleetmembers.NewMemberID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue", "memberValue") if err := client.DeleteThenPoll(ctx, id, fleetmembers.DefaultDeleteOperationOptions()); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id, fleetmembers.DefaultDeleteOperationOpti ```go ctx := context.TODO() -id := fleetmembers.NewMemberID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue", "fleetMemberValue") +id := fleetmembers.NewMemberID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue", "memberValue") read, err := client.Get(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/id_member.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/id_member.go index 8653abbdc402..4245baf62efc 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/id_member.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers/id_member.go @@ -14,16 +14,16 @@ type MemberId struct { SubscriptionId string ResourceGroupName string FleetName string - FleetMemberName string + MemberName string } // NewMemberID returns a new MemberId struct -func NewMemberID(subscriptionId string, resourceGroupName string, fleetName string, fleetMemberName string) MemberId { +func NewMemberID(subscriptionId string, resourceGroupName string, fleetName string, memberName string) MemberId { return MemberId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, FleetName: fleetName, - FleetMemberName: fleetMemberName, + MemberName: memberName, } } @@ -50,8 +50,8 @@ func ParseMemberID(input string) (*MemberId, error) { return nil, fmt.Errorf("the segment 'fleetName' was not found in the resource id %q", input) } - if id.FleetMemberName, ok = parsed.Parsed["fleetMemberName"]; !ok { - return nil, fmt.Errorf("the segment 'fleetMemberName' was not found in the resource id %q", input) + if id.MemberName, ok = parsed.Parsed["memberName"]; !ok { + return nil, fmt.Errorf("the segment 'memberName' was not found in the resource id %q", input) } return &id, nil @@ -81,8 +81,8 @@ func ParseMemberIDInsensitively(input string) (*MemberId, error) { return nil, fmt.Errorf("the segment 'fleetName' was not found in the resource id %q", input) } - if id.FleetMemberName, ok = parsed.Parsed["fleetMemberName"]; !ok { - return nil, fmt.Errorf("the segment 'fleetMemberName' was not found in the resource id %q", input) + if id.MemberName, ok = parsed.Parsed["memberName"]; !ok { + return nil, fmt.Errorf("the segment 'memberName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateMemberID(input interface{}, key string) (warnings []string, errors // ID returns the formatted Member ID func (id MemberId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/fleets/%s/members/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FleetName, id.FleetMemberName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FleetName, id.MemberName) } // Segments returns a slice of Resource ID Segments which comprise this Member ID @@ -121,7 +121,7 @@ func (id MemberId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticFleets", "fleets", "fleets"), resourceids.UserSpecifiedSegment("fleetName", "fleetValue"), resourceids.StaticSegment("staticMembers", "members", "members"), - resourceids.UserSpecifiedSegment("fleetMemberName", "fleetMemberValue"), + resourceids.UserSpecifiedSegment("memberName", "memberValue"), } } @@ -131,7 +131,7 @@ func (id MemberId) String() string { fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Fleet Name: %q", id.FleetName), - fmt.Sprintf("Fleet Member Name: %q", id.FleetMemberName), + fmt.Sprintf("Member Name: %q", id.MemberName), } return fmt.Sprintf("Member (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/README.md index 21b93474b7e6..478498355da1 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "configValue") +id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "maintenanceConfigurationValue") payload := maintenanceconfigurations.MaintenanceConfiguration{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "configValue") +id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "maintenanceConfigurationValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "configValue") +id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "maintenanceConfigurationValue") read, err := client.Get(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := maintenanceconfigurations.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := maintenanceconfigurations.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") // alternatively `client.ListByManagedCluster(ctx, id)` can be used to do batched pagination items, err := client.ListByManagedClusterComplete(ctx, id) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go index 62a222b92b41..1f3bd791c6b4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = MaintenanceConfigurationId{} // MaintenanceConfigurationId is a struct representing the Resource ID for a Maintenance Configuration type MaintenanceConfigurationId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - ConfigName string + SubscriptionId string + ResourceGroupName string + ManagedClusterName string + MaintenanceConfigurationName string } // NewMaintenanceConfigurationID returns a new MaintenanceConfigurationId struct -func NewMaintenanceConfigurationID(subscriptionId string, resourceGroupName string, resourceName string, configName string) MaintenanceConfigurationId { +func NewMaintenanceConfigurationID(subscriptionId string, resourceGroupName string, managedClusterName string, maintenanceConfigurationName string) MaintenanceConfigurationId { return MaintenanceConfigurationId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - ConfigName: configName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedClusterName: managedClusterName, + MaintenanceConfigurationName: maintenanceConfigurationName, } } @@ -46,12 +46,12 @@ func ParseMaintenanceConfigurationID(input string) (*MaintenanceConfigurationId, return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } - if id.ConfigName, ok = parsed.Parsed["configName"]; !ok { - return nil, fmt.Errorf("the segment 'configName' was not found in the resource id %q", input) + if id.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'maintenanceConfigurationName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseMaintenanceConfigurationIDInsensitively(input string) (*MaintenanceCon return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } - if id.ConfigName, ok = parsed.Parsed["configName"]; !ok { - return nil, fmt.Errorf("the segment 'configName' was not found in the resource id %q", input) + if id.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'maintenanceConfigurationName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateMaintenanceConfigurationID(input interface{}, key string) (warnings // ID returns the formatted Maintenance Configuration ID func (id MaintenanceConfigurationId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/managedClusters/%s/maintenanceConfigurations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.ConfigName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, id.MaintenanceConfigurationName) } // Segments returns a slice of Resource ID Segments which comprise this Maintenance Configuration ID @@ -119,9 +119,9 @@ func (id MaintenanceConfigurationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), resourceids.StaticSegment("staticMaintenanceConfigurations", "maintenanceConfigurations", "maintenanceConfigurations"), - resourceids.UserSpecifiedSegment("configName", "configValue"), + resourceids.UserSpecifiedSegment("maintenanceConfigurationName", "maintenanceConfigurationValue"), } } @@ -130,8 +130,8 @@ func (id MaintenanceConfigurationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Config Name: %q", id.ConfigName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), + fmt.Sprintf("Maintenance Configuration Name: %q", id.MaintenanceConfigurationName), } return fmt.Sprintf("Maintenance Configuration (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/id_managedcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/id_managedcluster.go index 7830f95a390c..4eae4650bb92 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/id_managedcluster.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/id_managedcluster.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = ManagedClusterId{} // ManagedClusterId is a struct representing the Resource ID for a Managed Cluster type ManagedClusterId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string + SubscriptionId string + ResourceGroupName string + ManagedClusterName string } // NewManagedClusterID returns a new ManagedClusterId struct -func NewManagedClusterID(subscriptionId string, resourceGroupName string, resourceName string) ManagedClusterId { +func NewManagedClusterID(subscriptionId string, resourceGroupName string, managedClusterName string) ManagedClusterId { return ManagedClusterId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedClusterName: managedClusterName, } } @@ -44,8 +44,8 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateManagedClusterID(input interface{}, key string) (warnings []string, // ID returns the formatted Managed Cluster ID func (id ManagedClusterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/managedClusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName) } // Segments returns a slice of Resource ID Segments which comprise this Managed Cluster ID @@ -109,7 +109,7 @@ func (id ManagedClusterId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), } } @@ -118,7 +118,7 @@ func (id ManagedClusterId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), } return fmt.Sprintf("Managed Cluster (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/README.md index 1a17e7940743..30e931da6f6d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") read, err := client.AbortLatestOperation(ctx, id) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") payload := managedclusters.ManagedCluster{ // ... @@ -57,7 +57,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") if err := client.DeleteThenPoll(ctx, id, managedclusters.DefaultDeleteOperationOptions()); err != nil { // handle the error @@ -69,7 +69,7 @@ if err := client.DeleteThenPoll(ctx, id, managedclusters.DefaultDeleteOperationO ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") read, err := client.Get(ctx, id) if err != nil { @@ -85,7 +85,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedclusters.NewAccessProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "roleValue") +id := managedclusters.NewAccessProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "accessProfileValue") read, err := client.GetAccessProfile(ctx, id) if err != nil { @@ -101,7 +101,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedclusters.NewCommandResultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "commandIdValue") +id := managedclusters.NewCommandResultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "commandIdValue") read, err := client.GetCommandResult(ctx, id) if err != nil { @@ -133,7 +133,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") read, err := client.GetUpgradeProfile(ctx, id) if err != nil { @@ -183,7 +183,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") read, err := client.ListClusterAdminCredentials(ctx, id, managedclusters.DefaultListClusterAdminCredentialsOperationOptions()) if err != nil { @@ -199,7 +199,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") read, err := client.ListClusterMonitoringUserCredentials(ctx, id, managedclusters.DefaultListClusterMonitoringUserCredentialsOperationOptions()) if err != nil { @@ -215,7 +215,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") read, err := client.ListClusterUserCredentials(ctx, id, managedclusters.DefaultListClusterUserCredentialsOperationOptions()) if err != nil { @@ -231,7 +231,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") // alternatively `client.ListOutboundNetworkDependenciesEndpoints(ctx, id)` can be used to do batched pagination items, err := client.ListOutboundNetworkDependenciesEndpointsComplete(ctx, id) @@ -248,7 +248,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") payload := managedclusters.ManagedClusterAADProfile{ // ... @@ -265,7 +265,7 @@ if err := client.ResetAADProfileThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") payload := managedclusters.ManagedClusterServicePrincipalProfile{ // ... @@ -282,7 +282,7 @@ if err := client.ResetServicePrincipalProfileThenPoll(ctx, id, payload); err != ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") if err := client.RotateClusterCertificatesThenPoll(ctx, id); err != nil { // handle the error @@ -294,7 +294,7 @@ if err := client.RotateClusterCertificatesThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") if err := client.RotateServiceAccountSigningKeysThenPoll(ctx, id); err != nil { // handle the error @@ -306,7 +306,7 @@ if err := client.RotateServiceAccountSigningKeysThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") payload := managedclusters.RunCommandRequest{ // ... @@ -323,7 +323,7 @@ if err := client.RunCommandThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") if err := client.StartThenPoll(ctx, id); err != nil { // handle the error @@ -335,7 +335,7 @@ if err := client.StartThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") if err := client.StopThenPoll(ctx, id); err != nil { // handle the error @@ -347,7 +347,7 @@ if err := client.StopThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclusters.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") payload := managedclusters.TagsObject{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_accessprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_accessprofile.go index f0566b57711f..792a18bcc883 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_accessprofile.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_accessprofile.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = AccessProfileId{} // AccessProfileId is a struct representing the Resource ID for a Access Profile type AccessProfileId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - RoleName string + SubscriptionId string + ResourceGroupName string + ManagedClusterName string + AccessProfileName string } // NewAccessProfileID returns a new AccessProfileId struct -func NewAccessProfileID(subscriptionId string, resourceGroupName string, resourceName string, roleName string) AccessProfileId { +func NewAccessProfileID(subscriptionId string, resourceGroupName string, managedClusterName string, accessProfileName string) AccessProfileId { return AccessProfileId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - RoleName: roleName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedClusterName: managedClusterName, + AccessProfileName: accessProfileName, } } @@ -46,12 +46,12 @@ func ParseAccessProfileID(input string) (*AccessProfileId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, fmt.Errorf("the segment 'roleName' was not found in the resource id %q", input) + if id.AccessProfileName, ok = parsed.Parsed["accessProfileName"]; !ok { + return nil, fmt.Errorf("the segment 'accessProfileName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseAccessProfileIDInsensitively(input string) (*AccessProfileId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, fmt.Errorf("the segment 'roleName' was not found in the resource id %q", input) + if id.AccessProfileName, ok = parsed.Parsed["accessProfileName"]; !ok { + return nil, fmt.Errorf("the segment 'accessProfileName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateAccessProfileID(input interface{}, key string) (warnings []string, // ID returns the formatted Access Profile ID func (id AccessProfileId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/managedClusters/%s/accessProfiles/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.RoleName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, id.AccessProfileName) } // Segments returns a slice of Resource ID Segments which comprise this Access Profile ID @@ -119,9 +119,9 @@ func (id AccessProfileId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), resourceids.StaticSegment("staticAccessProfiles", "accessProfiles", "accessProfiles"), - resourceids.UserSpecifiedSegment("roleName", "roleValue"), + resourceids.UserSpecifiedSegment("accessProfileName", "accessProfileValue"), } } @@ -130,8 +130,8 @@ func (id AccessProfileId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Role Name: %q", id.RoleName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), + fmt.Sprintf("Access Profile Name: %q", id.AccessProfileName), } return fmt.Sprintf("Access Profile (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_commandresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_commandresult.go index c70b4c10ed9c..2c23e6b83e7b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_commandresult.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_commandresult.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = CommandResultId{} // CommandResultId is a struct representing the Resource ID for a Command Result type CommandResultId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - CommandId string + SubscriptionId string + ResourceGroupName string + ManagedClusterName string + CommandId string } // NewCommandResultID returns a new CommandResultId struct -func NewCommandResultID(subscriptionId string, resourceGroupName string, resourceName string, commandId string) CommandResultId { +func NewCommandResultID(subscriptionId string, resourceGroupName string, managedClusterName string, commandId string) CommandResultId { return CommandResultId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - CommandId: commandId, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedClusterName: managedClusterName, + CommandId: commandId, } } @@ -46,8 +46,8 @@ func ParseCommandResultID(input string) (*CommandResultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { @@ -77,8 +77,8 @@ func ParseCommandResultIDInsensitively(input string) (*CommandResultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { @@ -106,7 +106,7 @@ func ValidateCommandResultID(input interface{}, key string) (warnings []string, // ID returns the formatted Command Result ID func (id CommandResultId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/managedClusters/%s/commandResults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.CommandId) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, id.CommandId) } // Segments returns a slice of Resource ID Segments which comprise this Command Result ID @@ -119,7 +119,7 @@ func (id CommandResultId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), resourceids.StaticSegment("staticCommandResults", "commandResults", "commandResults"), resourceids.UserSpecifiedSegment("commandId", "commandIdValue"), } @@ -130,7 +130,7 @@ func (id CommandResultId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), fmt.Sprintf("Command: %q", id.CommandId), } return fmt.Sprintf("Command Result (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_location.go index 63ae042c8a87..93b5f5e52c0f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_location.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_location.go @@ -12,14 +12,14 @@ var _ resourceids.ResourceId = LocationId{} // LocationId is a struct representing the Resource ID for a Location type LocationId struct { SubscriptionId string - Location string + LocationName string } // NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { +func NewLocationID(subscriptionId string, locationName string) LocationId { return LocationId{ SubscriptionId: subscriptionId, - Location: location, + LocationName: locationName, } } @@ -38,8 +38,8 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.ContainerService/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } // Segments returns a slice of Resource ID Segments which comprise this Location ID @@ -97,7 +97,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), } } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { func (id LocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), } return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_managedcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_managedcluster.go index 524f6fc5fe70..43f45c4d844d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_managedcluster.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_managedcluster.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = ManagedClusterId{} // ManagedClusterId is a struct representing the Resource ID for a Managed Cluster type ManagedClusterId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string + SubscriptionId string + ResourceGroupName string + ManagedClusterName string } // NewManagedClusterID returns a new ManagedClusterId struct -func NewManagedClusterID(subscriptionId string, resourceGroupName string, resourceName string) ManagedClusterId { +func NewManagedClusterID(subscriptionId string, resourceGroupName string, managedClusterName string) ManagedClusterId { return ManagedClusterId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedClusterName: managedClusterName, } } @@ -44,8 +44,8 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateManagedClusterID(input interface{}, key string) (warnings []string, // ID returns the formatted Managed Cluster ID func (id ManagedClusterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/managedClusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName) } // Segments returns a slice of Resource ID Segments which comprise this Managed Cluster ID @@ -109,7 +109,7 @@ func (id ManagedClusterId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), } } @@ -118,7 +118,7 @@ func (id ManagedClusterId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), } return fmt.Sprintf("Managed Cluster (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/README.md index d2791607a72e..672e734afe68 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := managedclustersnapshots.NewManagedClusterSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclustersnapshots.NewManagedClusterSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterSnapshotValue") payload := managedclustersnapshots.ManagedClusterSnapshot{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedclustersnapshots.NewManagedClusterSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclustersnapshots.NewManagedClusterSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterSnapshotValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedclustersnapshots.NewManagedClusterSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclustersnapshots.NewManagedClusterSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterSnapshotValue") read, err := client.Get(ctx, id) if err != nil { @@ -111,7 +111,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := managedclustersnapshots.NewManagedClusterSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedclustersnapshots.NewManagedClusterSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterSnapshotValue") payload := managedclustersnapshots.TagsObject{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/id_managedclustersnapshot.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/id_managedclustersnapshot.go index 2902f96dcf73..08ddae8b3673 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/id_managedclustersnapshot.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/id_managedclustersnapshot.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = ManagedClusterSnapshotId{} // ManagedClusterSnapshotId is a struct representing the Resource ID for a Managed Cluster Snapshot type ManagedClusterSnapshotId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string + SubscriptionId string + ResourceGroupName string + ManagedClusterSnapshotName string } // NewManagedClusterSnapshotID returns a new ManagedClusterSnapshotId struct -func NewManagedClusterSnapshotID(subscriptionId string, resourceGroupName string, resourceName string) ManagedClusterSnapshotId { +func NewManagedClusterSnapshotID(subscriptionId string, resourceGroupName string, managedClusterSnapshotName string) ManagedClusterSnapshotId { return ManagedClusterSnapshotId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedClusterSnapshotName: managedClusterSnapshotName, } } @@ -44,8 +44,8 @@ func ParseManagedClusterSnapshotID(input string) (*ManagedClusterSnapshotId, err return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterSnapshotName, ok = parsed.Parsed["managedClusterSnapshotName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterSnapshotName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseManagedClusterSnapshotIDInsensitively(input string) (*ManagedClusterSn return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterSnapshotName, ok = parsed.Parsed["managedClusterSnapshotName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterSnapshotName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateManagedClusterSnapshotID(input interface{}, key string) (warnings [ // ID returns the formatted Managed Cluster Snapshot ID func (id ManagedClusterSnapshotId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/managedClusterSnapshots/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterSnapshotName) } // Segments returns a slice of Resource ID Segments which comprise this Managed Cluster Snapshot ID @@ -109,7 +109,7 @@ func (id ManagedClusterSnapshotId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticManagedClusterSnapshots", "managedClusterSnapshots", "managedClusterSnapshots"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("managedClusterSnapshotName", "managedClusterSnapshotValue"), } } @@ -118,7 +118,7 @@ func (id ManagedClusterSnapshotId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Managed Cluster Snapshot Name: %q", id.ManagedClusterSnapshotName), } return fmt.Sprintf("Managed Cluster Snapshot (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/README.md index b03207b6aab1..678513d94465 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue") +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "privateEndpointConnectionValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -36,7 +36,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue") +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "privateEndpointConnectionValue") read, err := client.Get(ctx, id) if err != nil { @@ -52,7 +52,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := privateendpointconnections.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := privateendpointconnections.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") read, err := client.List(ctx, id) if err != nil { @@ -68,7 +68,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue") +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "privateEndpointConnectionValue") payload := privateendpointconnections.PrivateEndpointConnection{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/id_managedcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/id_managedcluster.go index 3c54ab8cd435..1c85aaf19c6d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/id_managedcluster.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/id_managedcluster.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = ManagedClusterId{} // ManagedClusterId is a struct representing the Resource ID for a Managed Cluster type ManagedClusterId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string + SubscriptionId string + ResourceGroupName string + ManagedClusterName string } // NewManagedClusterID returns a new ManagedClusterId struct -func NewManagedClusterID(subscriptionId string, resourceGroupName string, resourceName string) ManagedClusterId { +func NewManagedClusterID(subscriptionId string, resourceGroupName string, managedClusterName string) ManagedClusterId { return ManagedClusterId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedClusterName: managedClusterName, } } @@ -44,8 +44,8 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateManagedClusterID(input interface{}, key string) (warnings []string, // ID returns the formatted Managed Cluster ID func (id ManagedClusterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/managedClusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName) } // Segments returns a slice of Resource ID Segments which comprise this Managed Cluster ID @@ -109,7 +109,7 @@ func (id ManagedClusterId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), } } @@ -118,7 +118,7 @@ func (id ManagedClusterId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), } return fmt.Sprintf("Managed Cluster (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/id_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/id_privateendpointconnection.go index 95deb401243c..b5aec1fb6ba8 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/id_privateendpointconnection.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/id_privateendpointconnection.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = PrivateEndpointConnectionId{} type PrivateEndpointConnectionId struct { SubscriptionId string ResourceGroupName string - ResourceName string + ManagedClusterName string PrivateEndpointConnectionName string } // NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct -func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, resourceName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, managedClusterName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { return PrivateEndpointConnectionId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + ManagedClusterName: managedClusterName, PrivateEndpointConnectionName: privateEndpointConnectionName, } } @@ -46,8 +46,8 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { @@ -77,8 +77,8 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { @@ -106,7 +106,7 @@ func ValidatePrivateEndpointConnectionID(input interface{}, key string) (warning // ID returns the formatted Private Endpoint Connection ID func (id PrivateEndpointConnectionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/managedClusters/%s/privateEndpointConnections/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.PrivateEndpointConnectionName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, id.PrivateEndpointConnectionName) } // Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID @@ -119,7 +119,7 @@ func (id PrivateEndpointConnectionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionValue"), } @@ -130,7 +130,7 @@ func (id PrivateEndpointConnectionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), } return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/README.md index a9e832433418..e392202628cd 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := privatelinkresources.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := privatelinkresources.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") read, err := client.List(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/id_managedcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/id_managedcluster.go index 7136fe8c25e1..4e5bca0e8739 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/id_managedcluster.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/privatelinkresources/id_managedcluster.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = ManagedClusterId{} // ManagedClusterId is a struct representing the Resource ID for a Managed Cluster type ManagedClusterId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string + SubscriptionId string + ResourceGroupName string + ManagedClusterName string } // NewManagedClusterID returns a new ManagedClusterId struct -func NewManagedClusterID(subscriptionId string, resourceGroupName string, resourceName string) ManagedClusterId { +func NewManagedClusterID(subscriptionId string, resourceGroupName string, managedClusterName string) ManagedClusterId { return ManagedClusterId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedClusterName: managedClusterName, } } @@ -44,8 +44,8 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateManagedClusterID(input interface{}, key string) (warnings []string, // ID returns the formatted Managed Cluster ID func (id ManagedClusterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/managedClusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName) } // Segments returns a slice of Resource ID Segments which comprise this Managed Cluster ID @@ -109,7 +109,7 @@ func (id ManagedClusterId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), } } @@ -118,7 +118,7 @@ func (id ManagedClusterId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), } return fmt.Sprintf("Managed Cluster (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/README.md index d350d324214e..48acd1582dff 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := resolveprivatelinkserviceid.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := resolveprivatelinkserviceid.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") payload := resolveprivatelinkserviceid.PrivateLinkResource{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/id_managedcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/id_managedcluster.go index a6f351410c0c..b4912f13e59e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/id_managedcluster.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/resolveprivatelinkserviceid/id_managedcluster.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = ManagedClusterId{} // ManagedClusterId is a struct representing the Resource ID for a Managed Cluster type ManagedClusterId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string + SubscriptionId string + ResourceGroupName string + ManagedClusterName string } // NewManagedClusterID returns a new ManagedClusterId struct -func NewManagedClusterID(subscriptionId string, resourceGroupName string, resourceName string) ManagedClusterId { +func NewManagedClusterID(subscriptionId string, resourceGroupName string, managedClusterName string) ManagedClusterId { return ManagedClusterId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedClusterName: managedClusterName, } } @@ -44,8 +44,8 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateManagedClusterID(input interface{}, key string) (warnings []string, // ID returns the formatted Managed Cluster ID func (id ManagedClusterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/managedClusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName) } // Segments returns a slice of Resource ID Segments which comprise this Managed Cluster ID @@ -109,7 +109,7 @@ func (id ManagedClusterId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), } } @@ -118,7 +118,7 @@ func (id ManagedClusterId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), } return fmt.Sprintf("Managed Cluster (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/README.md index 5cc5c5d2b321..3317ad04812c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "snapshotValue") payload := snapshots.Snapshot{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "snapshotValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "snapshotValue") read, err := client.Get(ctx, id) if err != nil { @@ -111,7 +111,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "snapshotValue") payload := snapshots.TagsObject{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/id_snapshot.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/id_snapshot.go index 2c9a7cb3e0bf..9022f8cf2b96 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/id_snapshot.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/snapshots/id_snapshot.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = SnapshotId{} type SnapshotId struct { SubscriptionId string ResourceGroupName string - ResourceName string + SnapshotName string } // NewSnapshotID returns a new SnapshotId struct -func NewSnapshotID(subscriptionId string, resourceGroupName string, resourceName string) SnapshotId { +func NewSnapshotID(subscriptionId string, resourceGroupName string, snapshotName string) SnapshotId { return SnapshotId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SnapshotName: snapshotName, } } @@ -44,8 +44,8 @@ func ParseSnapshotID(input string) (*SnapshotId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { + return nil, fmt.Errorf("the segment 'snapshotName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { + return nil, fmt.Errorf("the segment 'snapshotName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateSnapshotID(input interface{}, key string) (warnings []string, error // ID returns the formatted Snapshot ID func (id SnapshotId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/snapshots/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SnapshotName) } // Segments returns a slice of Resource ID Segments which comprise this Snapshot ID @@ -109,7 +109,7 @@ func (id SnapshotId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticSnapshots", "snapshots", "snapshots"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("snapshotName", "snapshotValue"), } } @@ -118,7 +118,7 @@ func (id SnapshotId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Snapshot Name: %q", id.SnapshotName), } return fmt.Sprintf("Snapshot (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/README.md index c7cd9612bedd..2936af00ebb4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := trustedaccess.NewTrustedAccessRoleBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "trustedAccessRoleBindingValue") +id := trustedaccess.NewTrustedAccessRoleBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "trustedAccessRoleBindingValue") payload := trustedaccess.TrustedAccessRoleBinding{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := trustedaccess.NewTrustedAccessRoleBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "trustedAccessRoleBindingValue") +id := trustedaccess.NewTrustedAccessRoleBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "trustedAccessRoleBindingValue") read, err := client.RoleBindingsDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := trustedaccess.NewTrustedAccessRoleBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "trustedAccessRoleBindingValue") +id := trustedaccess.NewTrustedAccessRoleBindingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "trustedAccessRoleBindingValue") read, err := client.RoleBindingsGet(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := trustedaccess.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := trustedaccess.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") // alternatively `client.RoleBindingsList(ctx, id)` can be used to do batched pagination items, err := client.RoleBindingsListComplete(ctx, id) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_location.go index e89f27e7870c..f9f07135056c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_location.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_location.go @@ -12,14 +12,14 @@ var _ resourceids.ResourceId = LocationId{} // LocationId is a struct representing the Resource ID for a Location type LocationId struct { SubscriptionId string - Location string + LocationName string } // NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { +func NewLocationID(subscriptionId string, locationName string) LocationId { return LocationId{ SubscriptionId: subscriptionId, - Location: location, + LocationName: locationName, } } @@ -38,8 +38,8 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.ContainerService/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } // Segments returns a slice of Resource ID Segments which comprise this Location ID @@ -97,7 +97,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), } } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { func (id LocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), } return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_managedcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_managedcluster.go index 72e10d19246c..f0944902bb77 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_managedcluster.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_managedcluster.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = ManagedClusterId{} // ManagedClusterId is a struct representing the Resource ID for a Managed Cluster type ManagedClusterId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string + SubscriptionId string + ResourceGroupName string + ManagedClusterName string } // NewManagedClusterID returns a new ManagedClusterId struct -func NewManagedClusterID(subscriptionId string, resourceGroupName string, resourceName string) ManagedClusterId { +func NewManagedClusterID(subscriptionId string, resourceGroupName string, managedClusterName string) ManagedClusterId { return ManagedClusterId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedClusterName: managedClusterName, } } @@ -44,8 +44,8 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateManagedClusterID(input interface{}, key string) (warnings []string, // ID returns the formatted Managed Cluster ID func (id ManagedClusterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/managedClusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName) } // Segments returns a slice of Resource ID Segments which comprise this Managed Cluster ID @@ -109,7 +109,7 @@ func (id ManagedClusterId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), } } @@ -118,7 +118,7 @@ func (id ManagedClusterId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), } return fmt.Sprintf("Managed Cluster (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_trustedaccessrolebinding.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_trustedaccessrolebinding.go index a529af13bb04..321c11c36346 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_trustedaccessrolebinding.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_trustedaccessrolebinding.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = TrustedAccessRoleBindingId{} type TrustedAccessRoleBindingId struct { SubscriptionId string ResourceGroupName string - ResourceName string + ManagedClusterName string TrustedAccessRoleBindingName string } // NewTrustedAccessRoleBindingID returns a new TrustedAccessRoleBindingId struct -func NewTrustedAccessRoleBindingID(subscriptionId string, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string) TrustedAccessRoleBindingId { +func NewTrustedAccessRoleBindingID(subscriptionId string, resourceGroupName string, managedClusterName string, trustedAccessRoleBindingName string) TrustedAccessRoleBindingId { return TrustedAccessRoleBindingId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + ManagedClusterName: managedClusterName, TrustedAccessRoleBindingName: trustedAccessRoleBindingName, } } @@ -46,8 +46,8 @@ func ParseTrustedAccessRoleBindingID(input string) (*TrustedAccessRoleBindingId, return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } if id.TrustedAccessRoleBindingName, ok = parsed.Parsed["trustedAccessRoleBindingName"]; !ok { @@ -77,8 +77,8 @@ func ParseTrustedAccessRoleBindingIDInsensitively(input string) (*TrustedAccessR return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } if id.TrustedAccessRoleBindingName, ok = parsed.Parsed["trustedAccessRoleBindingName"]; !ok { @@ -106,7 +106,7 @@ func ValidateTrustedAccessRoleBindingID(input interface{}, key string) (warnings // ID returns the formatted Trusted Access Role Binding ID func (id TrustedAccessRoleBindingId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/managedClusters/%s/trustedAccessRoleBindings/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.TrustedAccessRoleBindingName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, id.TrustedAccessRoleBindingName) } // Segments returns a slice of Resource ID Segments which comprise this Trusted Access Role Binding ID @@ -119,7 +119,7 @@ func (id TrustedAccessRoleBindingId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), resourceids.StaticSegment("staticTrustedAccessRoleBindings", "trustedAccessRoleBindings", "trustedAccessRoleBindings"), resourceids.UserSpecifiedSegment("trustedAccessRoleBindingName", "trustedAccessRoleBindingValue"), } @@ -130,7 +130,7 @@ func (id TrustedAccessRoleBindingId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), fmt.Sprintf("Trusted Access Role Binding Name: %q", id.TrustedAccessRoleBindingName), } return fmt.Sprintf("Trusted Access Role Binding (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/README.md index 250738166321..579fb2c6fb82 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "keyspaceValue") +id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "cassandraKeyspaceValue") payload := cosmosdb.CassandraKeyspaceCreateUpdateParameters{ // ... @@ -41,7 +41,7 @@ if err := client.CassandraResourcesCreateUpdateCassandraKeyspaceThenPoll(ctx, id ```go ctx := context.TODO() -id := cosmosdb.NewCassandraKeyspaceTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "keyspaceValue", "tableValue") +id := cosmosdb.NewCassandraKeyspaceTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "cassandraKeyspaceValue", "tableValue") payload := cosmosdb.CassandraTableCreateUpdateParameters{ // ... @@ -58,7 +58,7 @@ if err := client.CassandraResourcesCreateUpdateCassandraTableThenPoll(ctx, id, p ```go ctx := context.TODO() -id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "keyspaceValue") +id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "cassandraKeyspaceValue") if err := client.CassandraResourcesDeleteCassandraKeyspaceThenPoll(ctx, id); err != nil { // handle the error @@ -70,7 +70,7 @@ if err := client.CassandraResourcesDeleteCassandraKeyspaceThenPoll(ctx, id); err ```go ctx := context.TODO() -id := cosmosdb.NewCassandraKeyspaceTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "keyspaceValue", "tableValue") +id := cosmosdb.NewCassandraKeyspaceTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "cassandraKeyspaceValue", "tableValue") if err := client.CassandraResourcesDeleteCassandraTableThenPoll(ctx, id); err != nil { // handle the error @@ -82,7 +82,7 @@ if err := client.CassandraResourcesDeleteCassandraTableThenPoll(ctx, id); err != ```go ctx := context.TODO() -id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "keyspaceValue") +id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "cassandraKeyspaceValue") read, err := client.CassandraResourcesGetCassandraKeyspace(ctx, id) if err != nil { @@ -98,7 +98,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "keyspaceValue") +id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "cassandraKeyspaceValue") read, err := client.CassandraResourcesGetCassandraKeyspaceThroughput(ctx, id) if err != nil { @@ -114,7 +114,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewCassandraKeyspaceTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "keyspaceValue", "tableValue") +id := cosmosdb.NewCassandraKeyspaceTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "cassandraKeyspaceValue", "tableValue") read, err := client.CassandraResourcesGetCassandraTable(ctx, id) if err != nil { @@ -130,7 +130,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewCassandraKeyspaceTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "keyspaceValue", "tableValue") +id := cosmosdb.NewCassandraKeyspaceTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "cassandraKeyspaceValue", "tableValue") read, err := client.CassandraResourcesGetCassandraTableThroughput(ctx, id) if err != nil { @@ -146,7 +146,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") read, err := client.CassandraResourcesListCassandraKeyspaces(ctx, id) if err != nil { @@ -162,7 +162,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "keyspaceValue") +id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "cassandraKeyspaceValue") read, err := client.CassandraResourcesListCassandraTables(ctx, id) if err != nil { @@ -178,7 +178,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "keyspaceValue") +id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "cassandraKeyspaceValue") if err := client.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleThenPoll(ctx, id); err != nil { // handle the error @@ -190,7 +190,7 @@ if err := client.CassandraResourcesMigrateCassandraKeyspaceToAutoscaleThenPoll(c ```go ctx := context.TODO() -id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "keyspaceValue") +id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "cassandraKeyspaceValue") if err := client.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputThenPoll(ctx, id); err != nil { // handle the error @@ -202,7 +202,7 @@ if err := client.CassandraResourcesMigrateCassandraKeyspaceToManualThroughputThe ```go ctx := context.TODO() -id := cosmosdb.NewCassandraKeyspaceTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "keyspaceValue", "tableValue") +id := cosmosdb.NewCassandraKeyspaceTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "cassandraKeyspaceValue", "tableValue") if err := client.CassandraResourcesMigrateCassandraTableToAutoscaleThenPoll(ctx, id); err != nil { // handle the error @@ -214,7 +214,7 @@ if err := client.CassandraResourcesMigrateCassandraTableToAutoscaleThenPoll(ctx, ```go ctx := context.TODO() -id := cosmosdb.NewCassandraKeyspaceTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "keyspaceValue", "tableValue") +id := cosmosdb.NewCassandraKeyspaceTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "cassandraKeyspaceValue", "tableValue") if err := client.CassandraResourcesMigrateCassandraTableToManualThroughputThenPoll(ctx, id); err != nil { // handle the error @@ -226,7 +226,7 @@ if err := client.CassandraResourcesMigrateCassandraTableToManualThroughputThenPo ```go ctx := context.TODO() -id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "keyspaceValue") +id := cosmosdb.NewCassandraKeyspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "cassandraKeyspaceValue") payload := cosmosdb.ThroughputSettingsUpdateParameters{ // ... @@ -243,7 +243,7 @@ if err := client.CassandraResourcesUpdateCassandraKeyspaceThroughputThenPoll(ctx ```go ctx := context.TODO() -id := cosmosdb.NewCassandraKeyspaceTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "keyspaceValue", "tableValue") +id := cosmosdb.NewCassandraKeyspaceTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "cassandraKeyspaceValue", "tableValue") payload := cosmosdb.ThroughputSettingsUpdateParameters{ // ... @@ -260,7 +260,7 @@ if err := client.CassandraResourcesUpdateCassandraTableThroughputThenPoll(ctx, i ```go ctx := context.TODO() -id := cosmosdb.NewCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseRidValue", "collectionRidValue") +id := cosmosdb.NewCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "databaseValue", "collectionValue") read, err := client.CollectionListMetricDefinitions(ctx, id) if err != nil { @@ -276,7 +276,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseRidValue", "collectionRidValue") +id := cosmosdb.NewCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "databaseValue", "collectionValue") read, err := client.CollectionListMetrics(ctx, id, cosmosdb.DefaultCollectionListMetricsOperationOptions()) if err != nil { @@ -292,7 +292,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseRidValue", "collectionRidValue") +id := cosmosdb.NewCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "databaseValue", "collectionValue") read, err := client.CollectionListUsages(ctx, id, cosmosdb.DefaultCollectionListUsagesOperationOptions()) if err != nil { @@ -308,7 +308,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseRidValue", "collectionRidValue") +id := cosmosdb.NewCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "databaseValue", "collectionValue") read, err := client.CollectionPartitionListMetrics(ctx, id, cosmosdb.DefaultCollectionPartitionListMetricsOperationOptions()) if err != nil { @@ -324,7 +324,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseRidValue", "collectionRidValue") +id := cosmosdb.NewCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "databaseValue", "collectionValue") read, err := client.CollectionPartitionListUsages(ctx, id, cosmosdb.DefaultCollectionPartitionListUsagesOperationOptions()) if err != nil { @@ -340,7 +340,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "regionValue", "databaseRidValue", "collectionRidValue") +id := cosmosdb.NewDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "regionValue", "databaseValue", "collectionValue") read, err := client.CollectionPartitionRegionListMetrics(ctx, id, cosmosdb.DefaultCollectionPartitionRegionListMetricsOperationOptions()) if err != nil { @@ -356,7 +356,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "regionValue", "databaseRidValue", "collectionRidValue") +id := cosmosdb.NewDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "regionValue", "databaseValue", "collectionValue") read, err := client.CollectionRegionListMetrics(ctx, id, cosmosdb.DefaultCollectionRegionListMetricsOperationOptions()) if err != nil { @@ -372,7 +372,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewRegionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "regionValue") +id := cosmosdb.NewRegionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "regionValue") read, err := client.DatabaseAccountRegionListMetrics(ctx, id, cosmosdb.DefaultDatabaseAccountRegionListMetricsOperationOptions()) if err != nil { @@ -388,7 +388,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountNameID("accountValue") +id := cosmosdb.NewDatabaseAccountNameID("databaseAccountNameValue") read, err := client.DatabaseAccountsCheckNameExists(ctx, id) if err != nil { @@ -404,7 +404,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") payload := cosmosdb.DatabaseAccountCreateUpdateParameters{ // ... @@ -421,7 +421,7 @@ if err := client.DatabaseAccountsCreateOrUpdateThenPoll(ctx, id, payload); err ! ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") if err := client.DatabaseAccountsDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -433,7 +433,7 @@ if err := client.DatabaseAccountsDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") payload := cosmosdb.FailoverPolicies{ // ... @@ -450,7 +450,7 @@ if err := client.DatabaseAccountsFailoverPriorityChangeThenPoll(ctx, id, payload ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") read, err := client.DatabaseAccountsGet(ctx, id) if err != nil { @@ -466,7 +466,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") read, err := client.DatabaseAccountsGetReadOnlyKeys(ctx, id) if err != nil { @@ -514,7 +514,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") read, err := client.DatabaseAccountsListConnectionStrings(ctx, id) if err != nil { @@ -530,7 +530,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") read, err := client.DatabaseAccountsListKeys(ctx, id) if err != nil { @@ -546,7 +546,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") read, err := client.DatabaseAccountsListMetricDefinitions(ctx, id) if err != nil { @@ -562,7 +562,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") read, err := client.DatabaseAccountsListMetrics(ctx, id, cosmosdb.DefaultDatabaseAccountsListMetricsOperationOptions()) if err != nil { @@ -578,7 +578,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") read, err := client.DatabaseAccountsListReadOnlyKeys(ctx, id) if err != nil { @@ -594,7 +594,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") read, err := client.DatabaseAccountsListUsages(ctx, id, cosmosdb.DefaultDatabaseAccountsListUsagesOperationOptions()) if err != nil { @@ -610,7 +610,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") payload := cosmosdb.RegionForOnlineOffline{ // ... @@ -627,7 +627,7 @@ if err := client.DatabaseAccountsOfflineRegionThenPoll(ctx, id, payload); err != ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") payload := cosmosdb.RegionForOnlineOffline{ // ... @@ -644,7 +644,7 @@ if err := client.DatabaseAccountsOnlineRegionThenPoll(ctx, id, payload); err != ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") payload := cosmosdb.DatabaseAccountRegenerateKeyParameters{ // ... @@ -661,7 +661,7 @@ if err := client.DatabaseAccountsRegenerateKeyThenPoll(ctx, id, payload); err != ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") payload := cosmosdb.DatabaseAccountUpdateParameters{ // ... @@ -678,7 +678,7 @@ if err := client.DatabaseAccountsUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseRidValue") +id := cosmosdb.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "databaseValue") read, err := client.DatabaseListMetricDefinitions(ctx, id) if err != nil { @@ -694,7 +694,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseRidValue") +id := cosmosdb.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "databaseValue") read, err := client.DatabaseListMetrics(ctx, id, cosmosdb.DefaultDatabaseListMetricsOperationOptions()) if err != nil { @@ -710,7 +710,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseRidValue") +id := cosmosdb.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "databaseValue") read, err := client.DatabaseListUsages(ctx, id, cosmosdb.DefaultDatabaseListUsagesOperationOptions()) if err != nil { @@ -726,7 +726,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "gremlinDatabaseValue") payload := cosmosdb.GremlinDatabaseCreateUpdateParameters{ // ... @@ -743,7 +743,7 @@ if err := client.GremlinResourcesCreateUpdateGremlinDatabaseThenPoll(ctx, id, pa ```go ctx := context.TODO() -id := cosmosdb.NewGraphID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "graphValue") +id := cosmosdb.NewGraphID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "gremlinDatabaseValue", "graphValue") payload := cosmosdb.GremlinGraphCreateUpdateParameters{ // ... @@ -760,7 +760,7 @@ if err := client.GremlinResourcesCreateUpdateGremlinGraphThenPoll(ctx, id, paylo ```go ctx := context.TODO() -id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "gremlinDatabaseValue") if err := client.GremlinResourcesDeleteGremlinDatabaseThenPoll(ctx, id); err != nil { // handle the error @@ -772,7 +772,7 @@ if err := client.GremlinResourcesDeleteGremlinDatabaseThenPoll(ctx, id); err != ```go ctx := context.TODO() -id := cosmosdb.NewGraphID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "graphValue") +id := cosmosdb.NewGraphID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "gremlinDatabaseValue", "graphValue") if err := client.GremlinResourcesDeleteGremlinGraphThenPoll(ctx, id); err != nil { // handle the error @@ -784,7 +784,7 @@ if err := client.GremlinResourcesDeleteGremlinGraphThenPoll(ctx, id); err != nil ```go ctx := context.TODO() -id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "gremlinDatabaseValue") read, err := client.GremlinResourcesGetGremlinDatabase(ctx, id) if err != nil { @@ -800,7 +800,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "gremlinDatabaseValue") read, err := client.GremlinResourcesGetGremlinDatabaseThroughput(ctx, id) if err != nil { @@ -816,7 +816,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewGraphID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "graphValue") +id := cosmosdb.NewGraphID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "gremlinDatabaseValue", "graphValue") read, err := client.GremlinResourcesGetGremlinGraph(ctx, id) if err != nil { @@ -832,7 +832,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewGraphID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "graphValue") +id := cosmosdb.NewGraphID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "gremlinDatabaseValue", "graphValue") read, err := client.GremlinResourcesGetGremlinGraphThroughput(ctx, id) if err != nil { @@ -848,7 +848,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") read, err := client.GremlinResourcesListGremlinDatabases(ctx, id) if err != nil { @@ -864,7 +864,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "gremlinDatabaseValue") read, err := client.GremlinResourcesListGremlinGraphs(ctx, id) if err != nil { @@ -880,7 +880,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "gremlinDatabaseValue") if err := client.GremlinResourcesMigrateGremlinDatabaseToAutoscaleThenPoll(ctx, id); err != nil { // handle the error @@ -892,7 +892,7 @@ if err := client.GremlinResourcesMigrateGremlinDatabaseToAutoscaleThenPoll(ctx, ```go ctx := context.TODO() -id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "gremlinDatabaseValue") if err := client.GremlinResourcesMigrateGremlinDatabaseToManualThroughputThenPoll(ctx, id); err != nil { // handle the error @@ -904,7 +904,7 @@ if err := client.GremlinResourcesMigrateGremlinDatabaseToManualThroughputThenPol ```go ctx := context.TODO() -id := cosmosdb.NewGraphID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "graphValue") +id := cosmosdb.NewGraphID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "gremlinDatabaseValue", "graphValue") if err := client.GremlinResourcesMigrateGremlinGraphToAutoscaleThenPoll(ctx, id); err != nil { // handle the error @@ -916,7 +916,7 @@ if err := client.GremlinResourcesMigrateGremlinGraphToAutoscaleThenPoll(ctx, id) ```go ctx := context.TODO() -id := cosmosdb.NewGraphID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "graphValue") +id := cosmosdb.NewGraphID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "gremlinDatabaseValue", "graphValue") if err := client.GremlinResourcesMigrateGremlinGraphToManualThroughputThenPoll(ctx, id); err != nil { // handle the error @@ -928,7 +928,7 @@ if err := client.GremlinResourcesMigrateGremlinGraphToManualThroughputThenPoll(c ```go ctx := context.TODO() -id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewGremlinDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "gremlinDatabaseValue") payload := cosmosdb.ThroughputSettingsUpdateParameters{ // ... @@ -945,7 +945,7 @@ if err := client.GremlinResourcesUpdateGremlinDatabaseThroughputThenPoll(ctx, id ```go ctx := context.TODO() -id := cosmosdb.NewGraphID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "graphValue") +id := cosmosdb.NewGraphID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "gremlinDatabaseValue", "graphValue") payload := cosmosdb.ThroughputSettingsUpdateParameters{ // ... @@ -994,7 +994,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewMongodbDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "collectionValue") +id := cosmosdb.NewMongodbDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "mongodbDatabaseValue", "collectionValue") payload := cosmosdb.MongoDBCollectionCreateUpdateParameters{ // ... @@ -1011,7 +1011,7 @@ if err := client.MongoDBResourcesCreateUpdateMongoDBCollectionThenPoll(ctx, id, ```go ctx := context.TODO() -id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "mongodbDatabaseValue") payload := cosmosdb.MongoDBDatabaseCreateUpdateParameters{ // ... @@ -1028,7 +1028,7 @@ if err := client.MongoDBResourcesCreateUpdateMongoDBDatabaseThenPoll(ctx, id, pa ```go ctx := context.TODO() -id := cosmosdb.NewMongodbDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "collectionValue") +id := cosmosdb.NewMongodbDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "mongodbDatabaseValue", "collectionValue") if err := client.MongoDBResourcesDeleteMongoDBCollectionThenPoll(ctx, id); err != nil { // handle the error @@ -1040,7 +1040,7 @@ if err := client.MongoDBResourcesDeleteMongoDBCollectionThenPoll(ctx, id); err ! ```go ctx := context.TODO() -id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "mongodbDatabaseValue") if err := client.MongoDBResourcesDeleteMongoDBDatabaseThenPoll(ctx, id); err != nil { // handle the error @@ -1052,7 +1052,7 @@ if err := client.MongoDBResourcesDeleteMongoDBDatabaseThenPoll(ctx, id); err != ```go ctx := context.TODO() -id := cosmosdb.NewMongodbDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "collectionValue") +id := cosmosdb.NewMongodbDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "mongodbDatabaseValue", "collectionValue") read, err := client.MongoDBResourcesGetMongoDBCollection(ctx, id) if err != nil { @@ -1068,7 +1068,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewMongodbDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "collectionValue") +id := cosmosdb.NewMongodbDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "mongodbDatabaseValue", "collectionValue") read, err := client.MongoDBResourcesGetMongoDBCollectionThroughput(ctx, id) if err != nil { @@ -1084,7 +1084,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "mongodbDatabaseValue") read, err := client.MongoDBResourcesGetMongoDBDatabase(ctx, id) if err != nil { @@ -1100,7 +1100,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "mongodbDatabaseValue") read, err := client.MongoDBResourcesGetMongoDBDatabaseThroughput(ctx, id) if err != nil { @@ -1116,7 +1116,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "mongodbDatabaseValue") read, err := client.MongoDBResourcesListMongoDBCollections(ctx, id) if err != nil { @@ -1132,7 +1132,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") read, err := client.MongoDBResourcesListMongoDBDatabases(ctx, id) if err != nil { @@ -1148,7 +1148,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewMongodbDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "collectionValue") +id := cosmosdb.NewMongodbDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "mongodbDatabaseValue", "collectionValue") if err := client.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleThenPoll(ctx, id); err != nil { // handle the error @@ -1160,7 +1160,7 @@ if err := client.MongoDBResourcesMigrateMongoDBCollectionToAutoscaleThenPoll(ctx ```go ctx := context.TODO() -id := cosmosdb.NewMongodbDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "collectionValue") +id := cosmosdb.NewMongodbDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "mongodbDatabaseValue", "collectionValue") if err := client.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputThenPoll(ctx, id); err != nil { // handle the error @@ -1172,7 +1172,7 @@ if err := client.MongoDBResourcesMigrateMongoDBCollectionToManualThroughputThenP ```go ctx := context.TODO() -id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "mongodbDatabaseValue") if err := client.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleThenPoll(ctx, id); err != nil { // handle the error @@ -1184,7 +1184,7 @@ if err := client.MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleThenPoll(ctx, ```go ctx := context.TODO() -id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "mongodbDatabaseValue") if err := client.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputThenPoll(ctx, id); err != nil { // handle the error @@ -1196,7 +1196,7 @@ if err := client.MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputThenPol ```go ctx := context.TODO() -id := cosmosdb.NewMongodbDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "collectionValue") +id := cosmosdb.NewMongodbDatabaseCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "mongodbDatabaseValue", "collectionValue") payload := cosmosdb.ThroughputSettingsUpdateParameters{ // ... @@ -1213,7 +1213,7 @@ if err := client.MongoDBResourcesUpdateMongoDBCollectionThroughputThenPoll(ctx, ```go ctx := context.TODO() -id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewMongodbDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "mongodbDatabaseValue") payload := cosmosdb.ThroughputSettingsUpdateParameters{ // ... @@ -1230,7 +1230,7 @@ if err := client.MongoDBResourcesUpdateMongoDBDatabaseThroughputThenPoll(ctx, id ```go ctx := context.TODO() -id := cosmosdb.NewPartitionKeyRangeIdID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseRidValue", "collectionRidValue", "partitionKeyRangeIdValue") +id := cosmosdb.NewPartitionKeyRangeIdID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "databaseValue", "collectionValue", "partitionKeyRangeIdValue") read, err := client.PartitionKeyRangeIdListMetrics(ctx, id, cosmosdb.DefaultPartitionKeyRangeIdListMetricsOperationOptions()) if err != nil { @@ -1246,7 +1246,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewCollectionPartitionKeyRangeIdID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "regionValue", "databaseRidValue", "collectionRidValue", "partitionKeyRangeIdValue") +id := cosmosdb.NewCollectionPartitionKeyRangeIdID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "regionValue", "databaseValue", "collectionValue", "partitionKeyRangeIdValue") read, err := client.PartitionKeyRangeIdRegionListMetrics(ctx, id, cosmosdb.DefaultPartitionKeyRangeIdRegionListMetricsOperationOptions()) if err != nil { @@ -1262,7 +1262,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") read, err := client.PercentileListMetrics(ctx, id, cosmosdb.DefaultPercentileListMetricsOperationOptions()) if err != nil { @@ -1278,7 +1278,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewSourceRegionTargetRegionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "sourceRegionValue", "targetRegionValue") +id := cosmosdb.NewSourceRegionTargetRegionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sourceRegionValue", "targetRegionValue") read, err := client.PercentileSourceTargetListMetrics(ctx, id, cosmosdb.DefaultPercentileSourceTargetListMetricsOperationOptions()) if err != nil { @@ -1294,7 +1294,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewTargetRegionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "targetRegionValue") +id := cosmosdb.NewTargetRegionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "targetRegionValue") read, err := client.PercentileTargetListMetrics(ctx, id, cosmosdb.DefaultPercentileTargetListMetricsOperationOptions()) if err != nil { @@ -1310,7 +1310,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue") +id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue") payload := cosmosdb.SqlContainerCreateUpdateParameters{ // ... @@ -1327,7 +1327,7 @@ if err := client.SqlResourcesCreateUpdateSqlContainerThenPoll(ctx, id, payload); ```go ctx := context.TODO() -id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue") payload := cosmosdb.SqlDatabaseCreateUpdateParameters{ // ... @@ -1344,7 +1344,7 @@ if err := client.SqlResourcesCreateUpdateSqlDatabaseThenPoll(ctx, id, payload); ```go ctx := context.TODO() -id := cosmosdb.NewStoredProcedureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue", "storedProcedureValue") +id := cosmosdb.NewStoredProcedureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue", "storedProcedureValue") payload := cosmosdb.SqlStoredProcedureCreateUpdateParameters{ // ... @@ -1361,7 +1361,7 @@ if err := client.SqlResourcesCreateUpdateSqlStoredProcedureThenPoll(ctx, id, pay ```go ctx := context.TODO() -id := cosmosdb.NewTriggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue", "triggerValue") +id := cosmosdb.NewTriggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue", "triggerValue") payload := cosmosdb.SqlTriggerCreateUpdateParameters{ // ... @@ -1378,7 +1378,7 @@ if err := client.SqlResourcesCreateUpdateSqlTriggerThenPoll(ctx, id, payload); e ```go ctx := context.TODO() -id := cosmosdb.NewUserDefinedFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue", "userDefinedFunctionValue") +id := cosmosdb.NewUserDefinedFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue", "userDefinedFunctionValue") payload := cosmosdb.SqlUserDefinedFunctionCreateUpdateParameters{ // ... @@ -1395,7 +1395,7 @@ if err := client.SqlResourcesCreateUpdateSqlUserDefinedFunctionThenPoll(ctx, id, ```go ctx := context.TODO() -id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue") +id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue") if err := client.SqlResourcesDeleteSqlContainerThenPoll(ctx, id); err != nil { // handle the error @@ -1407,7 +1407,7 @@ if err := client.SqlResourcesDeleteSqlContainerThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue") if err := client.SqlResourcesDeleteSqlDatabaseThenPoll(ctx, id); err != nil { // handle the error @@ -1419,7 +1419,7 @@ if err := client.SqlResourcesDeleteSqlDatabaseThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := cosmosdb.NewStoredProcedureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue", "storedProcedureValue") +id := cosmosdb.NewStoredProcedureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue", "storedProcedureValue") if err := client.SqlResourcesDeleteSqlStoredProcedureThenPoll(ctx, id); err != nil { // handle the error @@ -1431,7 +1431,7 @@ if err := client.SqlResourcesDeleteSqlStoredProcedureThenPoll(ctx, id); err != n ```go ctx := context.TODO() -id := cosmosdb.NewTriggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue", "triggerValue") +id := cosmosdb.NewTriggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue", "triggerValue") if err := client.SqlResourcesDeleteSqlTriggerThenPoll(ctx, id); err != nil { // handle the error @@ -1443,7 +1443,7 @@ if err := client.SqlResourcesDeleteSqlTriggerThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := cosmosdb.NewUserDefinedFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue", "userDefinedFunctionValue") +id := cosmosdb.NewUserDefinedFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue", "userDefinedFunctionValue") if err := client.SqlResourcesDeleteSqlUserDefinedFunctionThenPoll(ctx, id); err != nil { // handle the error @@ -1455,7 +1455,7 @@ if err := client.SqlResourcesDeleteSqlUserDefinedFunctionThenPoll(ctx, id); err ```go ctx := context.TODO() -id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue") +id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue") read, err := client.SqlResourcesGetSqlContainer(ctx, id) if err != nil { @@ -1471,7 +1471,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue") +id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue") read, err := client.SqlResourcesGetSqlContainerThroughput(ctx, id) if err != nil { @@ -1487,7 +1487,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue") read, err := client.SqlResourcesGetSqlDatabase(ctx, id) if err != nil { @@ -1503,7 +1503,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue") read, err := client.SqlResourcesGetSqlDatabaseThroughput(ctx, id) if err != nil { @@ -1519,7 +1519,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewStoredProcedureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue", "storedProcedureValue") +id := cosmosdb.NewStoredProcedureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue", "storedProcedureValue") read, err := client.SqlResourcesGetSqlStoredProcedure(ctx, id) if err != nil { @@ -1535,7 +1535,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewTriggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue", "triggerValue") +id := cosmosdb.NewTriggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue", "triggerValue") read, err := client.SqlResourcesGetSqlTrigger(ctx, id) if err != nil { @@ -1551,7 +1551,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewUserDefinedFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue", "userDefinedFunctionValue") +id := cosmosdb.NewUserDefinedFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue", "userDefinedFunctionValue") read, err := client.SqlResourcesGetSqlUserDefinedFunction(ctx, id) if err != nil { @@ -1567,7 +1567,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue") read, err := client.SqlResourcesListSqlContainers(ctx, id) if err != nil { @@ -1583,7 +1583,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") read, err := client.SqlResourcesListSqlDatabases(ctx, id) if err != nil { @@ -1599,7 +1599,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue") +id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue") read, err := client.SqlResourcesListSqlStoredProcedures(ctx, id) if err != nil { @@ -1615,7 +1615,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue") +id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue") read, err := client.SqlResourcesListSqlTriggers(ctx, id) if err != nil { @@ -1631,7 +1631,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue") +id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue") read, err := client.SqlResourcesListSqlUserDefinedFunctions(ctx, id) if err != nil { @@ -1647,7 +1647,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue") +id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue") if err := client.SqlResourcesMigrateSqlContainerToAutoscaleThenPoll(ctx, id); err != nil { // handle the error @@ -1659,7 +1659,7 @@ if err := client.SqlResourcesMigrateSqlContainerToAutoscaleThenPoll(ctx, id); er ```go ctx := context.TODO() -id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue") +id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue") if err := client.SqlResourcesMigrateSqlContainerToManualThroughputThenPoll(ctx, id); err != nil { // handle the error @@ -1671,7 +1671,7 @@ if err := client.SqlResourcesMigrateSqlContainerToManualThroughputThenPoll(ctx, ```go ctx := context.TODO() -id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue") if err := client.SqlResourcesMigrateSqlDatabaseToAutoscaleThenPoll(ctx, id); err != nil { // handle the error @@ -1683,7 +1683,7 @@ if err := client.SqlResourcesMigrateSqlDatabaseToAutoscaleThenPoll(ctx, id); err ```go ctx := context.TODO() -id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue") if err := client.SqlResourcesMigrateSqlDatabaseToManualThroughputThenPoll(ctx, id); err != nil { // handle the error @@ -1695,7 +1695,7 @@ if err := client.SqlResourcesMigrateSqlDatabaseToManualThroughputThenPoll(ctx, i ```go ctx := context.TODO() -id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue", "containerValue") +id := cosmosdb.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue", "containerValue") payload := cosmosdb.ThroughputSettingsUpdateParameters{ // ... @@ -1712,7 +1712,7 @@ if err := client.SqlResourcesUpdateSqlContainerThroughputThenPoll(ctx, id, paylo ```go ctx := context.TODO() -id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "databaseValue") +id := cosmosdb.NewSqlDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "sqlDatabaseValue") payload := cosmosdb.ThroughputSettingsUpdateParameters{ // ... @@ -1729,7 +1729,7 @@ if err := client.SqlResourcesUpdateSqlDatabaseThroughputThenPoll(ctx, id, payloa ```go ctx := context.TODO() -id := cosmosdb.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "tableValue") +id := cosmosdb.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "tableValue") payload := cosmosdb.TableCreateUpdateParameters{ // ... @@ -1746,7 +1746,7 @@ if err := client.TableResourcesCreateUpdateTableThenPoll(ctx, id, payload); err ```go ctx := context.TODO() -id := cosmosdb.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "tableValue") +id := cosmosdb.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "tableValue") if err := client.TableResourcesDeleteTableThenPoll(ctx, id); err != nil { // handle the error @@ -1758,7 +1758,7 @@ if err := client.TableResourcesDeleteTableThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := cosmosdb.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "tableValue") +id := cosmosdb.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "tableValue") read, err := client.TableResourcesGetTable(ctx, id) if err != nil { @@ -1774,7 +1774,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "tableValue") +id := cosmosdb.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "tableValue") read, err := client.TableResourcesGetTableThroughput(ctx, id) if err != nil { @@ -1790,7 +1790,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := cosmosdb.NewDatabaseAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue") read, err := client.TableResourcesListTables(ctx, id) if err != nil { @@ -1806,7 +1806,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := cosmosdb.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "tableValue") +id := cosmosdb.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "tableValue") if err := client.TableResourcesMigrateTableToAutoscaleThenPoll(ctx, id); err != nil { // handle the error @@ -1818,7 +1818,7 @@ if err := client.TableResourcesMigrateTableToAutoscaleThenPoll(ctx, id); err != ```go ctx := context.TODO() -id := cosmosdb.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "tableValue") +id := cosmosdb.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "tableValue") if err := client.TableResourcesMigrateTableToManualThroughputThenPoll(ctx, id); err != nil { // handle the error @@ -1830,7 +1830,7 @@ if err := client.TableResourcesMigrateTableToManualThroughputThenPoll(ctx, id); ```go ctx := context.TODO() -id := cosmosdb.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "tableValue") +id := cosmosdb.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "tableValue") payload := cosmosdb.ThroughputSettingsUpdateParameters{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspace.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspace.go index 577988f31fbe..522920221bfc 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspace.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspace.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = CassandraKeyspaceId{} // CassandraKeyspaceId is a struct representing the Resource ID for a Cassandra Keyspace type CassandraKeyspaceId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - KeyspaceName string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + CassandraKeyspaceName string } // NewCassandraKeyspaceID returns a new CassandraKeyspaceId struct -func NewCassandraKeyspaceID(subscriptionId string, resourceGroupName string, accountName string, keyspaceName string) CassandraKeyspaceId { +func NewCassandraKeyspaceID(subscriptionId string, resourceGroupName string, databaseAccountName string, cassandraKeyspaceName string) CassandraKeyspaceId { return CassandraKeyspaceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - KeyspaceName: keyspaceName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + CassandraKeyspaceName: cassandraKeyspaceName, } } @@ -46,12 +46,12 @@ func ParseCassandraKeyspaceID(input string) (*CassandraKeyspaceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.KeyspaceName, ok = parsed.Parsed["keyspaceName"]; !ok { - return nil, fmt.Errorf("the segment 'keyspaceName' was not found in the resource id %q", input) + if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'cassandraKeyspaceName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseCassandraKeyspaceIDInsensitively(input string) (*CassandraKeyspaceId, return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.KeyspaceName, ok = parsed.Parsed["keyspaceName"]; !ok { - return nil, fmt.Errorf("the segment 'keyspaceName' was not found in the resource id %q", input) + if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'cassandraKeyspaceName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateCassandraKeyspaceID(input interface{}, key string) (warnings []stri // ID returns the formatted Cassandra Keyspace ID func (id CassandraKeyspaceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/cassandraKeyspaces/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.KeyspaceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.CassandraKeyspaceName) } // Segments returns a slice of Resource ID Segments which comprise this Cassandra Keyspace ID @@ -119,9 +119,9 @@ func (id CassandraKeyspaceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticCassandraKeyspaces", "cassandraKeyspaces", "cassandraKeyspaces"), - resourceids.UserSpecifiedSegment("keyspaceName", "keyspaceValue"), + resourceids.UserSpecifiedSegment("cassandraKeyspaceName", "cassandraKeyspaceValue"), } } @@ -130,8 +130,8 @@ func (id CassandraKeyspaceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Keyspace Name: %q", id.KeyspaceName), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Cassandra Keyspace Name: %q", id.CassandraKeyspaceName), } return fmt.Sprintf("Cassandra Keyspace (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspacetable.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspacetable.go index cad5f837f067..c0a854ea4b81 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspacetable.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspacetable.go @@ -11,21 +11,21 @@ var _ resourceids.ResourceId = CassandraKeyspaceTableId{} // CassandraKeyspaceTableId is a struct representing the Resource ID for a Cassandra Keyspace Table type CassandraKeyspaceTableId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - KeyspaceName string - TableName string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + CassandraKeyspaceName string + TableName string } // NewCassandraKeyspaceTableID returns a new CassandraKeyspaceTableId struct -func NewCassandraKeyspaceTableID(subscriptionId string, resourceGroupName string, accountName string, keyspaceName string, tableName string) CassandraKeyspaceTableId { +func NewCassandraKeyspaceTableID(subscriptionId string, resourceGroupName string, databaseAccountName string, cassandraKeyspaceName string, tableName string) CassandraKeyspaceTableId { return CassandraKeyspaceTableId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - KeyspaceName: keyspaceName, - TableName: tableName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + CassandraKeyspaceName: cassandraKeyspaceName, + TableName: tableName, } } @@ -48,12 +48,12 @@ func ParseCassandraKeyspaceTableID(input string) (*CassandraKeyspaceTableId, err return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.KeyspaceName, ok = parsed.Parsed["keyspaceName"]; !ok { - return nil, fmt.Errorf("the segment 'keyspaceName' was not found in the resource id %q", input) + if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'cassandraKeyspaceName' was not found in the resource id %q", input) } if id.TableName, ok = parsed.Parsed["tableName"]; !ok { @@ -83,12 +83,12 @@ func ParseCassandraKeyspaceTableIDInsensitively(input string) (*CassandraKeyspac return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.KeyspaceName, ok = parsed.Parsed["keyspaceName"]; !ok { - return nil, fmt.Errorf("the segment 'keyspaceName' was not found in the resource id %q", input) + if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'cassandraKeyspaceName' was not found in the resource id %q", input) } if id.TableName, ok = parsed.Parsed["tableName"]; !ok { @@ -116,7 +116,7 @@ func ValidateCassandraKeyspaceTableID(input interface{}, key string) (warnings [ // ID returns the formatted Cassandra Keyspace Table ID func (id CassandraKeyspaceTableId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/cassandraKeyspaces/%s/tables/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.KeyspaceName, id.TableName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.CassandraKeyspaceName, id.TableName) } // Segments returns a slice of Resource ID Segments which comprise this Cassandra Keyspace Table ID @@ -129,9 +129,9 @@ func (id CassandraKeyspaceTableId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticCassandraKeyspaces", "cassandraKeyspaces", "cassandraKeyspaces"), - resourceids.UserSpecifiedSegment("keyspaceName", "keyspaceValue"), + resourceids.UserSpecifiedSegment("cassandraKeyspaceName", "cassandraKeyspaceValue"), resourceids.StaticSegment("staticTables", "tables", "tables"), resourceids.UserSpecifiedSegment("tableName", "tableValue"), } @@ -142,8 +142,8 @@ func (id CassandraKeyspaceTableId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Keyspace Name: %q", id.KeyspaceName), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Cassandra Keyspace Name: %q", id.CassandraKeyspaceName), fmt.Sprintf("Table Name: %q", id.TableName), } return fmt.Sprintf("Cassandra Keyspace Table (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collection.go index 253d4d682fe9..ba02a91fc1f9 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collection.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collection.go @@ -11,21 +11,21 @@ var _ resourceids.ResourceId = CollectionId{} // CollectionId is a struct representing the Resource ID for a Collection type CollectionId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - DatabaseRid string - CollectionRid string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + DatabaseName string + CollectionName string } // NewCollectionID returns a new CollectionId struct -func NewCollectionID(subscriptionId string, resourceGroupName string, accountName string, databaseRid string, collectionRid string) CollectionId { +func NewCollectionID(subscriptionId string, resourceGroupName string, databaseAccountName string, databaseName string, collectionName string) CollectionId { return CollectionId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - DatabaseRid: databaseRid, - CollectionRid: collectionRid, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + DatabaseName: databaseName, + CollectionName: collectionName, } } @@ -48,16 +48,16 @@ func ParseCollectionID(input string) (*CollectionId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseRid, ok = parsed.Parsed["databaseRid"]; !ok { - return nil, fmt.Errorf("the segment 'databaseRid' was not found in the resource id %q", input) + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) } - if id.CollectionRid, ok = parsed.Parsed["collectionRid"]; !ok { - return nil, fmt.Errorf("the segment 'collectionRid' was not found in the resource id %q", input) + if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { + return nil, fmt.Errorf("the segment 'collectionName' was not found in the resource id %q", input) } return &id, nil @@ -83,16 +83,16 @@ func ParseCollectionIDInsensitively(input string) (*CollectionId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseRid, ok = parsed.Parsed["databaseRid"]; !ok { - return nil, fmt.Errorf("the segment 'databaseRid' was not found in the resource id %q", input) + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) } - if id.CollectionRid, ok = parsed.Parsed["collectionRid"]; !ok { - return nil, fmt.Errorf("the segment 'collectionRid' was not found in the resource id %q", input) + if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { + return nil, fmt.Errorf("the segment 'collectionName' was not found in the resource id %q", input) } return &id, nil @@ -116,7 +116,7 @@ func ValidateCollectionID(input interface{}, key string) (warnings []string, err // ID returns the formatted Collection ID func (id CollectionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/databases/%s/collections/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.DatabaseRid, id.CollectionRid) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.DatabaseName, id.CollectionName) } // Segments returns a slice of Resource ID Segments which comprise this Collection ID @@ -129,11 +129,11 @@ func (id CollectionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticDatabases", "databases", "databases"), - resourceids.UserSpecifiedSegment("databaseRid", "databaseRidValue"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), resourceids.StaticSegment("staticCollections", "collections", "collections"), - resourceids.UserSpecifiedSegment("collectionRid", "collectionRidValue"), + resourceids.UserSpecifiedSegment("collectionName", "collectionValue"), } } @@ -142,9 +142,9 @@ func (id CollectionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Database Rid: %q", id.DatabaseRid), - fmt.Sprintf("Collection Rid: %q", id.CollectionRid), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Collection Name: %q", id.CollectionName), } return fmt.Sprintf("Collection (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collectionpartitionkeyrangeid.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collectionpartitionkeyrangeid.go index e6882a7ea5fa..6736a4511a03 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collectionpartitionkeyrangeid.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collectionpartitionkeyrangeid.go @@ -13,22 +13,22 @@ var _ resourceids.ResourceId = CollectionPartitionKeyRangeIdId{} type CollectionPartitionKeyRangeIdId struct { SubscriptionId string ResourceGroupName string - AccountName string - Region string - DatabaseRid string - CollectionRid string + DatabaseAccountName string + RegionName string + DatabaseName string + CollectionName string PartitionKeyRangeId string } // NewCollectionPartitionKeyRangeIdID returns a new CollectionPartitionKeyRangeIdId struct -func NewCollectionPartitionKeyRangeIdID(subscriptionId string, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeId string) CollectionPartitionKeyRangeIdId { +func NewCollectionPartitionKeyRangeIdID(subscriptionId string, resourceGroupName string, databaseAccountName string, regionName string, databaseName string, collectionName string, partitionKeyRangeId string) CollectionPartitionKeyRangeIdId { return CollectionPartitionKeyRangeIdId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, - Region: region, - DatabaseRid: databaseRid, - CollectionRid: collectionRid, + DatabaseAccountName: databaseAccountName, + RegionName: regionName, + DatabaseName: databaseName, + CollectionName: collectionName, PartitionKeyRangeId: partitionKeyRangeId, } } @@ -52,20 +52,20 @@ func ParseCollectionPartitionKeyRangeIdID(input string) (*CollectionPartitionKey return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.Region, ok = parsed.Parsed["region"]; !ok { - return nil, fmt.Errorf("the segment 'region' was not found in the resource id %q", input) + if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { + return nil, fmt.Errorf("the segment 'regionName' was not found in the resource id %q", input) } - if id.DatabaseRid, ok = parsed.Parsed["databaseRid"]; !ok { - return nil, fmt.Errorf("the segment 'databaseRid' was not found in the resource id %q", input) + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) } - if id.CollectionRid, ok = parsed.Parsed["collectionRid"]; !ok { - return nil, fmt.Errorf("the segment 'collectionRid' was not found in the resource id %q", input) + if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { + return nil, fmt.Errorf("the segment 'collectionName' was not found in the resource id %q", input) } if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { @@ -95,20 +95,20 @@ func ParseCollectionPartitionKeyRangeIdIDInsensitively(input string) (*Collectio return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.Region, ok = parsed.Parsed["region"]; !ok { - return nil, fmt.Errorf("the segment 'region' was not found in the resource id %q", input) + if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { + return nil, fmt.Errorf("the segment 'regionName' was not found in the resource id %q", input) } - if id.DatabaseRid, ok = parsed.Parsed["databaseRid"]; !ok { - return nil, fmt.Errorf("the segment 'databaseRid' was not found in the resource id %q", input) + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) } - if id.CollectionRid, ok = parsed.Parsed["collectionRid"]; !ok { - return nil, fmt.Errorf("the segment 'collectionRid' was not found in the resource id %q", input) + if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { + return nil, fmt.Errorf("the segment 'collectionName' was not found in the resource id %q", input) } if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { @@ -136,7 +136,7 @@ func ValidateCollectionPartitionKeyRangeIdID(input interface{}, key string) (war // ID returns the formatted Collection Partition Key Range Id ID func (id CollectionPartitionKeyRangeIdId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/region/%s/databases/%s/collections/%s/partitionKeyRangeId/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.Region, id.DatabaseRid, id.CollectionRid, id.PartitionKeyRangeId) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.RegionName, id.DatabaseName, id.CollectionName, id.PartitionKeyRangeId) } // Segments returns a slice of Resource ID Segments which comprise this Collection Partition Key Range Id ID @@ -149,13 +149,13 @@ func (id CollectionPartitionKeyRangeIdId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticRegion", "region", "region"), - resourceids.UserSpecifiedSegment("region", "regionValue"), + resourceids.UserSpecifiedSegment("regionName", "regionValue"), resourceids.StaticSegment("staticDatabases", "databases", "databases"), - resourceids.UserSpecifiedSegment("databaseRid", "databaseRidValue"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), resourceids.StaticSegment("staticCollections", "collections", "collections"), - resourceids.UserSpecifiedSegment("collectionRid", "collectionRidValue"), + resourceids.UserSpecifiedSegment("collectionName", "collectionValue"), resourceids.StaticSegment("staticPartitionKeyRangeId", "partitionKeyRangeId", "partitionKeyRangeId"), resourceids.UserSpecifiedSegment("partitionKeyRangeId", "partitionKeyRangeIdValue"), } @@ -166,10 +166,10 @@ func (id CollectionPartitionKeyRangeIdId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Region: %q", id.Region), - fmt.Sprintf("Database Rid: %q", id.DatabaseRid), - fmt.Sprintf("Collection Rid: %q", id.CollectionRid), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Region Name: %q", id.RegionName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Collection Name: %q", id.CollectionName), fmt.Sprintf("Partition Key Range: %q", id.PartitionKeyRangeId), } return fmt.Sprintf("Collection Partition Key Range Id (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_container.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_container.go index 192c644cd24a..526818e1c395 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_container.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_container.go @@ -11,21 +11,21 @@ var _ resourceids.ResourceId = ContainerId{} // ContainerId is a struct representing the Resource ID for a Container type ContainerId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - DatabaseName string - ContainerName string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + SqlDatabaseName string + ContainerName string } // NewContainerID returns a new ContainerId struct -func NewContainerID(subscriptionId string, resourceGroupName string, accountName string, databaseName string, containerName string) ContainerId { +func NewContainerID(subscriptionId string, resourceGroupName string, databaseAccountName string, sqlDatabaseName string, containerName string) ContainerId { return ContainerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - DatabaseName: databaseName, - ContainerName: containerName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + SqlDatabaseName: sqlDatabaseName, + ContainerName: containerName, } } @@ -48,12 +48,12 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'sqlDatabaseName' was not found in the resource id %q", input) } if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { @@ -83,12 +83,12 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'sqlDatabaseName' was not found in the resource id %q", input) } if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { @@ -116,7 +116,7 @@ func ValidateContainerID(input interface{}, key string) (warnings []string, erro // ID returns the formatted Container ID func (id ContainerId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/sqlDatabases/%s/containers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.DatabaseName, id.ContainerName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.SqlDatabaseName, id.ContainerName) } // Segments returns a slice of Resource ID Segments which comprise this Container ID @@ -129,9 +129,9 @@ func (id ContainerId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticSqlDatabases", "sqlDatabases", "sqlDatabases"), - resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + resourceids.UserSpecifiedSegment("sqlDatabaseName", "sqlDatabaseValue"), resourceids.StaticSegment("staticContainers", "containers", "containers"), resourceids.UserSpecifiedSegment("containerName", "containerValue"), } @@ -142,8 +142,8 @@ func (id ContainerId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Sql Database Name: %q", id.SqlDatabaseName), fmt.Sprintf("Container Name: %q", id.ContainerName), } return fmt.Sprintf("Container (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_database.go index 95de25f4b6dc..6536c35292ae 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_database.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_database.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = DatabaseId{} // DatabaseId is a struct representing the Resource ID for a Database type DatabaseId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - DatabaseRid string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + DatabaseName string } // NewDatabaseID returns a new DatabaseId struct -func NewDatabaseID(subscriptionId string, resourceGroupName string, accountName string, databaseRid string) DatabaseId { +func NewDatabaseID(subscriptionId string, resourceGroupName string, databaseAccountName string, databaseName string) DatabaseId { return DatabaseId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - DatabaseRid: databaseRid, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + DatabaseName: databaseName, } } @@ -46,12 +46,12 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseRid, ok = parsed.Parsed["databaseRid"]; !ok { - return nil, fmt.Errorf("the segment 'databaseRid' was not found in the resource id %q", input) + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseRid, ok = parsed.Parsed["databaseRid"]; !ok { - return nil, fmt.Errorf("the segment 'databaseRid' was not found in the resource id %q", input) + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateDatabaseID(input interface{}, key string) (warnings []string, error // ID returns the formatted Database ID func (id DatabaseId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/databases/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.DatabaseRid) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.DatabaseName) } // Segments returns a slice of Resource ID Segments which comprise this Database ID @@ -119,9 +119,9 @@ func (id DatabaseId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticDatabases", "databases", "databases"), - resourceids.UserSpecifiedSegment("databaseRid", "databaseRidValue"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), } } @@ -130,8 +130,8 @@ func (id DatabaseId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Database Rid: %q", id.DatabaseRid), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), } return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccount.go index 950eb71e0872..089bf5b1e19e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = DatabaseAccountId{} // DatabaseAccountId is a struct representing the Resource ID for a Database Account type DatabaseAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string } // NewDatabaseAccountID returns a new DatabaseAccountId struct -func NewDatabaseAccountID(subscriptionId string, resourceGroupName string, accountName string) DatabaseAccountId { +func NewDatabaseAccountID(subscriptionId string, resourceGroupName string, databaseAccountName string) DatabaseAccountId { return DatabaseAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, } } @@ -44,8 +44,8 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateDatabaseAccountID(input interface{}, key string) (warnings []string // ID returns the formatted Database Account ID func (id DatabaseAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Database Account ID @@ -109,7 +109,7 @@ func (id DatabaseAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), } } @@ -118,7 +118,7 @@ func (id DatabaseAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), } return fmt.Sprintf("Database Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccountname.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccountname.go index d99d681f2f07..f160616b6332 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccountname.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccountname.go @@ -11,13 +11,13 @@ var _ resourceids.ResourceId = DatabaseAccountNameId{} // DatabaseAccountNameId is a struct representing the Resource ID for a Database Account Name type DatabaseAccountNameId struct { - AccountName string + DatabaseAccountNameName string } // NewDatabaseAccountNameID returns a new DatabaseAccountNameId struct -func NewDatabaseAccountNameID(accountName string) DatabaseAccountNameId { +func NewDatabaseAccountNameID(databaseAccountNameName string) DatabaseAccountNameId { return DatabaseAccountNameId{ - AccountName: accountName, + DatabaseAccountNameName: databaseAccountNameName, } } @@ -32,8 +32,8 @@ func ParseDatabaseAccountNameID(input string) (*DatabaseAccountNameId, error) { var ok bool id := DatabaseAccountNameId{} - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountNameName, ok = parsed.Parsed["databaseAccountNameName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountNameName' was not found in the resource id %q", input) } return &id, nil @@ -51,8 +51,8 @@ func ParseDatabaseAccountNameIDInsensitively(input string) (*DatabaseAccountName var ok bool id := DatabaseAccountNameId{} - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountNameName, ok = parsed.Parsed["databaseAccountNameName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountNameName' was not found in the resource id %q", input) } return &id, nil @@ -76,7 +76,7 @@ func ValidateDatabaseAccountNameID(input interface{}, key string) (warnings []st // ID returns the formatted Database Account Name ID func (id DatabaseAccountNameId) ID() string { fmtString := "/providers/Microsoft.DocumentDB/databaseAccountNames/%s" - return fmt.Sprintf(fmtString, id.AccountName) + return fmt.Sprintf(fmtString, id.DatabaseAccountNameName) } // Segments returns a slice of Resource ID Segments which comprise this Database Account Name ID @@ -85,14 +85,14 @@ func (id DatabaseAccountNameId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccountNames", "databaseAccountNames", "databaseAccountNames"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountNameName", "databaseAccountNameValue"), } } // String returns a human-readable description of this Database Account Name ID func (id DatabaseAccountNameId) String() string { components := []string{ - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Database Account Name Name: %q", id.DatabaseAccountNameName), } return fmt.Sprintf("Database Account Name (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databasecollection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databasecollection.go index 8816f3457168..1929cb78a4f6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databasecollection.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databasecollection.go @@ -11,23 +11,23 @@ var _ resourceids.ResourceId = DatabaseCollectionId{} // DatabaseCollectionId is a struct representing the Resource ID for a Database Collection type DatabaseCollectionId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - Region string - DatabaseRid string - CollectionRid string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + RegionName string + DatabaseName string + CollectionName string } // NewDatabaseCollectionID returns a new DatabaseCollectionId struct -func NewDatabaseCollectionID(subscriptionId string, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string) DatabaseCollectionId { +func NewDatabaseCollectionID(subscriptionId string, resourceGroupName string, databaseAccountName string, regionName string, databaseName string, collectionName string) DatabaseCollectionId { return DatabaseCollectionId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - Region: region, - DatabaseRid: databaseRid, - CollectionRid: collectionRid, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + RegionName: regionName, + DatabaseName: databaseName, + CollectionName: collectionName, } } @@ -50,20 +50,20 @@ func ParseDatabaseCollectionID(input string) (*DatabaseCollectionId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.Region, ok = parsed.Parsed["region"]; !ok { - return nil, fmt.Errorf("the segment 'region' was not found in the resource id %q", input) + if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { + return nil, fmt.Errorf("the segment 'regionName' was not found in the resource id %q", input) } - if id.DatabaseRid, ok = parsed.Parsed["databaseRid"]; !ok { - return nil, fmt.Errorf("the segment 'databaseRid' was not found in the resource id %q", input) + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) } - if id.CollectionRid, ok = parsed.Parsed["collectionRid"]; !ok { - return nil, fmt.Errorf("the segment 'collectionRid' was not found in the resource id %q", input) + if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { + return nil, fmt.Errorf("the segment 'collectionName' was not found in the resource id %q", input) } return &id, nil @@ -89,20 +89,20 @@ func ParseDatabaseCollectionIDInsensitively(input string) (*DatabaseCollectionId return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.Region, ok = parsed.Parsed["region"]; !ok { - return nil, fmt.Errorf("the segment 'region' was not found in the resource id %q", input) + if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { + return nil, fmt.Errorf("the segment 'regionName' was not found in the resource id %q", input) } - if id.DatabaseRid, ok = parsed.Parsed["databaseRid"]; !ok { - return nil, fmt.Errorf("the segment 'databaseRid' was not found in the resource id %q", input) + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) } - if id.CollectionRid, ok = parsed.Parsed["collectionRid"]; !ok { - return nil, fmt.Errorf("the segment 'collectionRid' was not found in the resource id %q", input) + if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { + return nil, fmt.Errorf("the segment 'collectionName' was not found in the resource id %q", input) } return &id, nil @@ -126,7 +126,7 @@ func ValidateDatabaseCollectionID(input interface{}, key string) (warnings []str // ID returns the formatted Database Collection ID func (id DatabaseCollectionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/region/%s/databases/%s/collections/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.Region, id.DatabaseRid, id.CollectionRid) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.RegionName, id.DatabaseName, id.CollectionName) } // Segments returns a slice of Resource ID Segments which comprise this Database Collection ID @@ -139,13 +139,13 @@ func (id DatabaseCollectionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticRegion", "region", "region"), - resourceids.UserSpecifiedSegment("region", "regionValue"), + resourceids.UserSpecifiedSegment("regionName", "regionValue"), resourceids.StaticSegment("staticDatabases", "databases", "databases"), - resourceids.UserSpecifiedSegment("databaseRid", "databaseRidValue"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), resourceids.StaticSegment("staticCollections", "collections", "collections"), - resourceids.UserSpecifiedSegment("collectionRid", "collectionRidValue"), + resourceids.UserSpecifiedSegment("collectionName", "collectionValue"), } } @@ -154,10 +154,10 @@ func (id DatabaseCollectionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Region: %q", id.Region), - fmt.Sprintf("Database Rid: %q", id.DatabaseRid), - fmt.Sprintf("Collection Rid: %q", id.CollectionRid), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Region Name: %q", id.RegionName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Collection Name: %q", id.CollectionName), } return fmt.Sprintf("Database Collection (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_graph.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_graph.go index 807388a11a74..4b7858714802 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_graph.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_graph.go @@ -11,21 +11,21 @@ var _ resourceids.ResourceId = GraphId{} // GraphId is a struct representing the Resource ID for a Graph type GraphId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - DatabaseName string - GraphName string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + GremlinDatabaseName string + GraphName string } // NewGraphID returns a new GraphId struct -func NewGraphID(subscriptionId string, resourceGroupName string, accountName string, databaseName string, graphName string) GraphId { +func NewGraphID(subscriptionId string, resourceGroupName string, databaseAccountName string, gremlinDatabaseName string, graphName string) GraphId { return GraphId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - DatabaseName: databaseName, - GraphName: graphName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + GremlinDatabaseName: gremlinDatabaseName, + GraphName: graphName, } } @@ -48,12 +48,12 @@ func ParseGraphID(input string) (*GraphId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'gremlinDatabaseName' was not found in the resource id %q", input) } if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { @@ -83,12 +83,12 @@ func ParseGraphIDInsensitively(input string) (*GraphId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'gremlinDatabaseName' was not found in the resource id %q", input) } if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { @@ -116,7 +116,7 @@ func ValidateGraphID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Graph ID func (id GraphId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/gremlinDatabases/%s/graphs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.DatabaseName, id.GraphName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.GremlinDatabaseName, id.GraphName) } // Segments returns a slice of Resource ID Segments which comprise this Graph ID @@ -129,9 +129,9 @@ func (id GraphId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticGremlinDatabases", "gremlinDatabases", "gremlinDatabases"), - resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + resourceids.UserSpecifiedSegment("gremlinDatabaseName", "gremlinDatabaseValue"), resourceids.StaticSegment("staticGraphs", "graphs", "graphs"), resourceids.UserSpecifiedSegment("graphName", "graphValue"), } @@ -142,8 +142,8 @@ func (id GraphId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Gremlin Database Name: %q", id.GremlinDatabaseName), fmt.Sprintf("Graph Name: %q", id.GraphName), } return fmt.Sprintf("Graph (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_gremlindatabase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_gremlindatabase.go index 0237128014d5..71c73f9996f5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_gremlindatabase.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_gremlindatabase.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = GremlinDatabaseId{} // GremlinDatabaseId is a struct representing the Resource ID for a Gremlin Database type GremlinDatabaseId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - DatabaseName string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + GremlinDatabaseName string } // NewGremlinDatabaseID returns a new GremlinDatabaseId struct -func NewGremlinDatabaseID(subscriptionId string, resourceGroupName string, accountName string, databaseName string) GremlinDatabaseId { +func NewGremlinDatabaseID(subscriptionId string, resourceGroupName string, databaseAccountName string, gremlinDatabaseName string) GremlinDatabaseId { return GremlinDatabaseId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - DatabaseName: databaseName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + GremlinDatabaseName: gremlinDatabaseName, } } @@ -46,12 +46,12 @@ func ParseGremlinDatabaseID(input string) (*GremlinDatabaseId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'gremlinDatabaseName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseGremlinDatabaseIDInsensitively(input string) (*GremlinDatabaseId, erro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'gremlinDatabaseName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateGremlinDatabaseID(input interface{}, key string) (warnings []string // ID returns the formatted Gremlin Database ID func (id GremlinDatabaseId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/gremlinDatabases/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.DatabaseName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.GremlinDatabaseName) } // Segments returns a slice of Resource ID Segments which comprise this Gremlin Database ID @@ -119,9 +119,9 @@ func (id GremlinDatabaseId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticGremlinDatabases", "gremlinDatabases", "gremlinDatabases"), - resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + resourceids.UserSpecifiedSegment("gremlinDatabaseName", "gremlinDatabaseValue"), } } @@ -130,8 +130,8 @@ func (id GremlinDatabaseId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Gremlin Database Name: %q", id.GremlinDatabaseName), } return fmt.Sprintf("Gremlin Database (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_location.go index b23979f25f89..13ab94826927 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_location.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_location.go @@ -12,14 +12,14 @@ var _ resourceids.ResourceId = LocationId{} // LocationId is a struct representing the Resource ID for a Location type LocationId struct { SubscriptionId string - Location string + LocationName string } // NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { +func NewLocationID(subscriptionId string, locationName string) LocationId { return LocationId{ SubscriptionId: subscriptionId, - Location: location, + LocationName: locationName, } } @@ -38,8 +38,8 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.DocumentDB/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } // Segments returns a slice of Resource ID Segments which comprise this Location ID @@ -97,7 +97,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), } } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { func (id LocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), } return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabase.go index 75ec2bb41dd2..d9b1785cfc3f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabase.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabase.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = MongodbDatabaseId{} // MongodbDatabaseId is a struct representing the Resource ID for a Mongodb Database type MongodbDatabaseId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - DatabaseName string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + MongodbDatabaseName string } // NewMongodbDatabaseID returns a new MongodbDatabaseId struct -func NewMongodbDatabaseID(subscriptionId string, resourceGroupName string, accountName string, databaseName string) MongodbDatabaseId { +func NewMongodbDatabaseID(subscriptionId string, resourceGroupName string, databaseAccountName string, mongodbDatabaseName string) MongodbDatabaseId { return MongodbDatabaseId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - DatabaseName: databaseName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + MongodbDatabaseName: mongodbDatabaseName, } } @@ -46,12 +46,12 @@ func ParseMongodbDatabaseID(input string) (*MongodbDatabaseId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'mongodbDatabaseName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseMongodbDatabaseIDInsensitively(input string) (*MongodbDatabaseId, erro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'mongodbDatabaseName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateMongodbDatabaseID(input interface{}, key string) (warnings []string // ID returns the formatted Mongodb Database ID func (id MongodbDatabaseId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/mongodbDatabases/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.DatabaseName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.MongodbDatabaseName) } // Segments returns a slice of Resource ID Segments which comprise this Mongodb Database ID @@ -119,9 +119,9 @@ func (id MongodbDatabaseId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticMongodbDatabases", "mongodbDatabases", "mongodbDatabases"), - resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + resourceids.UserSpecifiedSegment("mongodbDatabaseName", "mongodbDatabaseValue"), } } @@ -130,8 +130,8 @@ func (id MongodbDatabaseId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Mongodb Database Name: %q", id.MongodbDatabaseName), } return fmt.Sprintf("Mongodb Database (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabasecollection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabasecollection.go index 4e3060809b53..83fdddd41d7b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabasecollection.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabasecollection.go @@ -11,21 +11,21 @@ var _ resourceids.ResourceId = MongodbDatabaseCollectionId{} // MongodbDatabaseCollectionId is a struct representing the Resource ID for a Mongodb Database Collection type MongodbDatabaseCollectionId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - DatabaseName string - CollectionName string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + MongodbDatabaseName string + CollectionName string } // NewMongodbDatabaseCollectionID returns a new MongodbDatabaseCollectionId struct -func NewMongodbDatabaseCollectionID(subscriptionId string, resourceGroupName string, accountName string, databaseName string, collectionName string) MongodbDatabaseCollectionId { +func NewMongodbDatabaseCollectionID(subscriptionId string, resourceGroupName string, databaseAccountName string, mongodbDatabaseName string, collectionName string) MongodbDatabaseCollectionId { return MongodbDatabaseCollectionId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - DatabaseName: databaseName, - CollectionName: collectionName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + MongodbDatabaseName: mongodbDatabaseName, + CollectionName: collectionName, } } @@ -48,12 +48,12 @@ func ParseMongodbDatabaseCollectionID(input string) (*MongodbDatabaseCollectionI return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'mongodbDatabaseName' was not found in the resource id %q", input) } if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { @@ -83,12 +83,12 @@ func ParseMongodbDatabaseCollectionIDInsensitively(input string) (*MongodbDataba return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'mongodbDatabaseName' was not found in the resource id %q", input) } if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { @@ -116,7 +116,7 @@ func ValidateMongodbDatabaseCollectionID(input interface{}, key string) (warning // ID returns the formatted Mongodb Database Collection ID func (id MongodbDatabaseCollectionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/mongodbDatabases/%s/collections/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.DatabaseName, id.CollectionName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.MongodbDatabaseName, id.CollectionName) } // Segments returns a slice of Resource ID Segments which comprise this Mongodb Database Collection ID @@ -129,9 +129,9 @@ func (id MongodbDatabaseCollectionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticMongodbDatabases", "mongodbDatabases", "mongodbDatabases"), - resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + resourceids.UserSpecifiedSegment("mongodbDatabaseName", "mongodbDatabaseValue"), resourceids.StaticSegment("staticCollections", "collections", "collections"), resourceids.UserSpecifiedSegment("collectionName", "collectionValue"), } @@ -142,8 +142,8 @@ func (id MongodbDatabaseCollectionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Mongodb Database Name: %q", id.MongodbDatabaseName), fmt.Sprintf("Collection Name: %q", id.CollectionName), } return fmt.Sprintf("Mongodb Database Collection (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_partitionkeyrangeid.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_partitionkeyrangeid.go index 81a92a61a2c2..a90f6617b2b4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_partitionkeyrangeid.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_partitionkeyrangeid.go @@ -13,20 +13,20 @@ var _ resourceids.ResourceId = PartitionKeyRangeIdId{} type PartitionKeyRangeIdId struct { SubscriptionId string ResourceGroupName string - AccountName string - DatabaseRid string - CollectionRid string + DatabaseAccountName string + DatabaseName string + CollectionName string PartitionKeyRangeId string } // NewPartitionKeyRangeIdID returns a new PartitionKeyRangeIdId struct -func NewPartitionKeyRangeIdID(subscriptionId string, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeId string) PartitionKeyRangeIdId { +func NewPartitionKeyRangeIdID(subscriptionId string, resourceGroupName string, databaseAccountName string, databaseName string, collectionName string, partitionKeyRangeId string) PartitionKeyRangeIdId { return PartitionKeyRangeIdId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, - DatabaseRid: databaseRid, - CollectionRid: collectionRid, + DatabaseAccountName: databaseAccountName, + DatabaseName: databaseName, + CollectionName: collectionName, PartitionKeyRangeId: partitionKeyRangeId, } } @@ -50,16 +50,16 @@ func ParsePartitionKeyRangeIdID(input string) (*PartitionKeyRangeIdId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseRid, ok = parsed.Parsed["databaseRid"]; !ok { - return nil, fmt.Errorf("the segment 'databaseRid' was not found in the resource id %q", input) + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) } - if id.CollectionRid, ok = parsed.Parsed["collectionRid"]; !ok { - return nil, fmt.Errorf("the segment 'collectionRid' was not found in the resource id %q", input) + if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { + return nil, fmt.Errorf("the segment 'collectionName' was not found in the resource id %q", input) } if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { @@ -89,16 +89,16 @@ func ParsePartitionKeyRangeIdIDInsensitively(input string) (*PartitionKeyRangeId return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseRid, ok = parsed.Parsed["databaseRid"]; !ok { - return nil, fmt.Errorf("the segment 'databaseRid' was not found in the resource id %q", input) + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) } - if id.CollectionRid, ok = parsed.Parsed["collectionRid"]; !ok { - return nil, fmt.Errorf("the segment 'collectionRid' was not found in the resource id %q", input) + if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { + return nil, fmt.Errorf("the segment 'collectionName' was not found in the resource id %q", input) } if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { @@ -126,7 +126,7 @@ func ValidatePartitionKeyRangeIdID(input interface{}, key string) (warnings []st // ID returns the formatted Partition Key Range Id ID func (id PartitionKeyRangeIdId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/databases/%s/collections/%s/partitionKeyRangeId/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.DatabaseRid, id.CollectionRid, id.PartitionKeyRangeId) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.DatabaseName, id.CollectionName, id.PartitionKeyRangeId) } // Segments returns a slice of Resource ID Segments which comprise this Partition Key Range Id ID @@ -139,11 +139,11 @@ func (id PartitionKeyRangeIdId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticDatabases", "databases", "databases"), - resourceids.UserSpecifiedSegment("databaseRid", "databaseRidValue"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), resourceids.StaticSegment("staticCollections", "collections", "collections"), - resourceids.UserSpecifiedSegment("collectionRid", "collectionRidValue"), + resourceids.UserSpecifiedSegment("collectionName", "collectionValue"), resourceids.StaticSegment("staticPartitionKeyRangeId", "partitionKeyRangeId", "partitionKeyRangeId"), resourceids.UserSpecifiedSegment("partitionKeyRangeId", "partitionKeyRangeIdValue"), } @@ -154,9 +154,9 @@ func (id PartitionKeyRangeIdId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Database Rid: %q", id.DatabaseRid), - fmt.Sprintf("Collection Rid: %q", id.CollectionRid), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Collection Name: %q", id.CollectionName), fmt.Sprintf("Partition Key Range: %q", id.PartitionKeyRangeId), } return fmt.Sprintf("Partition Key Range Id (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_region.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_region.go index 2881dd1326ce..db804902e473 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_region.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_region.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = RegionId{} // RegionId is a struct representing the Resource ID for a Region type RegionId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - Region string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + RegionName string } // NewRegionID returns a new RegionId struct -func NewRegionID(subscriptionId string, resourceGroupName string, accountName string, region string) RegionId { +func NewRegionID(subscriptionId string, resourceGroupName string, databaseAccountName string, regionName string) RegionId { return RegionId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - Region: region, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + RegionName: regionName, } } @@ -46,12 +46,12 @@ func ParseRegionID(input string) (*RegionId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.Region, ok = parsed.Parsed["region"]; !ok { - return nil, fmt.Errorf("the segment 'region' was not found in the resource id %q", input) + if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { + return nil, fmt.Errorf("the segment 'regionName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseRegionIDInsensitively(input string) (*RegionId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.Region, ok = parsed.Parsed["region"]; !ok { - return nil, fmt.Errorf("the segment 'region' was not found in the resource id %q", input) + if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { + return nil, fmt.Errorf("the segment 'regionName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateRegionID(input interface{}, key string) (warnings []string, errors // ID returns the formatted Region ID func (id RegionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/region/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.Region) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.RegionName) } // Segments returns a slice of Resource ID Segments which comprise this Region ID @@ -119,9 +119,9 @@ func (id RegionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticRegion", "region", "region"), - resourceids.UserSpecifiedSegment("region", "regionValue"), + resourceids.UserSpecifiedSegment("regionName", "regionValue"), } } @@ -130,8 +130,8 @@ func (id RegionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Region: %q", id.Region), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Region Name: %q", id.RegionName), } return fmt.Sprintf("Region (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sourceregiontargetregion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sourceregiontargetregion.go index 357ba45fc5f1..3d0e8709ad52 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sourceregiontargetregion.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sourceregiontargetregion.go @@ -11,21 +11,21 @@ var _ resourceids.ResourceId = SourceRegionTargetRegionId{} // SourceRegionTargetRegionId is a struct representing the Resource ID for a Source Region Target Region type SourceRegionTargetRegionId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - SourceRegion string - TargetRegion string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + SourceRegionName string + TargetRegionName string } // NewSourceRegionTargetRegionID returns a new SourceRegionTargetRegionId struct -func NewSourceRegionTargetRegionID(subscriptionId string, resourceGroupName string, accountName string, sourceRegion string, targetRegion string) SourceRegionTargetRegionId { +func NewSourceRegionTargetRegionID(subscriptionId string, resourceGroupName string, databaseAccountName string, sourceRegionName string, targetRegionName string) SourceRegionTargetRegionId { return SourceRegionTargetRegionId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - SourceRegion: sourceRegion, - TargetRegion: targetRegion, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + SourceRegionName: sourceRegionName, + TargetRegionName: targetRegionName, } } @@ -48,16 +48,16 @@ func ParseSourceRegionTargetRegionID(input string) (*SourceRegionTargetRegionId, return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.SourceRegion, ok = parsed.Parsed["sourceRegion"]; !ok { - return nil, fmt.Errorf("the segment 'sourceRegion' was not found in the resource id %q", input) + if id.SourceRegionName, ok = parsed.Parsed["sourceRegionName"]; !ok { + return nil, fmt.Errorf("the segment 'sourceRegionName' was not found in the resource id %q", input) } - if id.TargetRegion, ok = parsed.Parsed["targetRegion"]; !ok { - return nil, fmt.Errorf("the segment 'targetRegion' was not found in the resource id %q", input) + if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { + return nil, fmt.Errorf("the segment 'targetRegionName' was not found in the resource id %q", input) } return &id, nil @@ -83,16 +83,16 @@ func ParseSourceRegionTargetRegionIDInsensitively(input string) (*SourceRegionTa return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.SourceRegion, ok = parsed.Parsed["sourceRegion"]; !ok { - return nil, fmt.Errorf("the segment 'sourceRegion' was not found in the resource id %q", input) + if id.SourceRegionName, ok = parsed.Parsed["sourceRegionName"]; !ok { + return nil, fmt.Errorf("the segment 'sourceRegionName' was not found in the resource id %q", input) } - if id.TargetRegion, ok = parsed.Parsed["targetRegion"]; !ok { - return nil, fmt.Errorf("the segment 'targetRegion' was not found in the resource id %q", input) + if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { + return nil, fmt.Errorf("the segment 'targetRegionName' was not found in the resource id %q", input) } return &id, nil @@ -116,7 +116,7 @@ func ValidateSourceRegionTargetRegionID(input interface{}, key string) (warnings // ID returns the formatted Source Region Target Region ID func (id SourceRegionTargetRegionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/sourceRegion/%s/targetRegion/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.SourceRegion, id.TargetRegion) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.SourceRegionName, id.TargetRegionName) } // Segments returns a slice of Resource ID Segments which comprise this Source Region Target Region ID @@ -129,11 +129,11 @@ func (id SourceRegionTargetRegionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticSourceRegion", "sourceRegion", "sourceRegion"), - resourceids.UserSpecifiedSegment("sourceRegion", "sourceRegionValue"), + resourceids.UserSpecifiedSegment("sourceRegionName", "sourceRegionValue"), resourceids.StaticSegment("staticTargetRegion", "targetRegion", "targetRegion"), - resourceids.UserSpecifiedSegment("targetRegion", "targetRegionValue"), + resourceids.UserSpecifiedSegment("targetRegionName", "targetRegionValue"), } } @@ -142,9 +142,9 @@ func (id SourceRegionTargetRegionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Source Region: %q", id.SourceRegion), - fmt.Sprintf("Target Region: %q", id.TargetRegion), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Source Region Name: %q", id.SourceRegionName), + fmt.Sprintf("Target Region Name: %q", id.TargetRegionName), } return fmt.Sprintf("Source Region Target Region (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sqldatabase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sqldatabase.go index 1120d6105610..39504bfd1816 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sqldatabase.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sqldatabase.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = SqlDatabaseId{} // SqlDatabaseId is a struct representing the Resource ID for a Sql Database type SqlDatabaseId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - DatabaseName string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + SqlDatabaseName string } // NewSqlDatabaseID returns a new SqlDatabaseId struct -func NewSqlDatabaseID(subscriptionId string, resourceGroupName string, accountName string, databaseName string) SqlDatabaseId { +func NewSqlDatabaseID(subscriptionId string, resourceGroupName string, databaseAccountName string, sqlDatabaseName string) SqlDatabaseId { return SqlDatabaseId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - DatabaseName: databaseName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + SqlDatabaseName: sqlDatabaseName, } } @@ -46,12 +46,12 @@ func ParseSqlDatabaseID(input string) (*SqlDatabaseId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'sqlDatabaseName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseSqlDatabaseIDInsensitively(input string) (*SqlDatabaseId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'sqlDatabaseName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateSqlDatabaseID(input interface{}, key string) (warnings []string, er // ID returns the formatted Sql Database ID func (id SqlDatabaseId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/sqlDatabases/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.DatabaseName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.SqlDatabaseName) } // Segments returns a slice of Resource ID Segments which comprise this Sql Database ID @@ -119,9 +119,9 @@ func (id SqlDatabaseId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticSqlDatabases", "sqlDatabases", "sqlDatabases"), - resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + resourceids.UserSpecifiedSegment("sqlDatabaseName", "sqlDatabaseValue"), } } @@ -130,8 +130,8 @@ func (id SqlDatabaseId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Sql Database Name: %q", id.SqlDatabaseName), } return fmt.Sprintf("Sql Database (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_storedprocedure.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_storedprocedure.go index f63a03fdc0d8..2e865a28ccab 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_storedprocedure.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_storedprocedure.go @@ -13,19 +13,19 @@ var _ resourceids.ResourceId = StoredProcedureId{} type StoredProcedureId struct { SubscriptionId string ResourceGroupName string - AccountName string - DatabaseName string + DatabaseAccountName string + SqlDatabaseName string ContainerName string StoredProcedureName string } // NewStoredProcedureID returns a new StoredProcedureId struct -func NewStoredProcedureID(subscriptionId string, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) StoredProcedureId { +func NewStoredProcedureID(subscriptionId string, resourceGroupName string, databaseAccountName string, sqlDatabaseName string, containerName string, storedProcedureName string) StoredProcedureId { return StoredProcedureId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, - DatabaseName: databaseName, + DatabaseAccountName: databaseAccountName, + SqlDatabaseName: sqlDatabaseName, ContainerName: containerName, StoredProcedureName: storedProcedureName, } @@ -50,12 +50,12 @@ func ParseStoredProcedureID(input string) (*StoredProcedureId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'sqlDatabaseName' was not found in the resource id %q", input) } if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { @@ -89,12 +89,12 @@ func ParseStoredProcedureIDInsensitively(input string) (*StoredProcedureId, erro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'sqlDatabaseName' was not found in the resource id %q", input) } if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { @@ -126,7 +126,7 @@ func ValidateStoredProcedureID(input interface{}, key string) (warnings []string // ID returns the formatted Stored Procedure ID func (id StoredProcedureId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/sqlDatabases/%s/containers/%s/storedProcedures/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.DatabaseName, id.ContainerName, id.StoredProcedureName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.SqlDatabaseName, id.ContainerName, id.StoredProcedureName) } // Segments returns a slice of Resource ID Segments which comprise this Stored Procedure ID @@ -139,9 +139,9 @@ func (id StoredProcedureId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticSqlDatabases", "sqlDatabases", "sqlDatabases"), - resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + resourceids.UserSpecifiedSegment("sqlDatabaseName", "sqlDatabaseValue"), resourceids.StaticSegment("staticContainers", "containers", "containers"), resourceids.UserSpecifiedSegment("containerName", "containerValue"), resourceids.StaticSegment("staticStoredProcedures", "storedProcedures", "storedProcedures"), @@ -154,8 +154,8 @@ func (id StoredProcedureId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Sql Database Name: %q", id.SqlDatabaseName), fmt.Sprintf("Container Name: %q", id.ContainerName), fmt.Sprintf("Stored Procedure Name: %q", id.StoredProcedureName), } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_table.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_table.go index ba2e04c92580..e29414ab8aaa 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_table.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_table.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = TableId{} // TableId is a struct representing the Resource ID for a Table type TableId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - TableName string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + TableName string } // NewTableID returns a new TableId struct -func NewTableID(subscriptionId string, resourceGroupName string, accountName string, tableName string) TableId { +func NewTableID(subscriptionId string, resourceGroupName string, databaseAccountName string, tableName string) TableId { return TableId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - TableName: tableName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + TableName: tableName, } } @@ -46,8 +46,8 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } if id.TableName, ok = parsed.Parsed["tableName"]; !ok { @@ -77,8 +77,8 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } if id.TableName, ok = parsed.Parsed["tableName"]; !ok { @@ -106,7 +106,7 @@ func ValidateTableID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Table ID func (id TableId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/tables/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.TableName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.TableName) } // Segments returns a slice of Resource ID Segments which comprise this Table ID @@ -119,7 +119,7 @@ func (id TableId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticTables", "tables", "tables"), resourceids.UserSpecifiedSegment("tableName", "tableValue"), } @@ -130,7 +130,7 @@ func (id TableId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), fmt.Sprintf("Table Name: %q", id.TableName), } return fmt.Sprintf("Table (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_targetregion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_targetregion.go index 098eb18ee501..d25a2782bfc5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_targetregion.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_targetregion.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = TargetRegionId{} // TargetRegionId is a struct representing the Resource ID for a Target Region type TargetRegionId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - TargetRegion string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + TargetRegionName string } // NewTargetRegionID returns a new TargetRegionId struct -func NewTargetRegionID(subscriptionId string, resourceGroupName string, accountName string, targetRegion string) TargetRegionId { +func NewTargetRegionID(subscriptionId string, resourceGroupName string, databaseAccountName string, targetRegionName string) TargetRegionId { return TargetRegionId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - TargetRegion: targetRegion, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + TargetRegionName: targetRegionName, } } @@ -46,12 +46,12 @@ func ParseTargetRegionID(input string) (*TargetRegionId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.TargetRegion, ok = parsed.Parsed["targetRegion"]; !ok { - return nil, fmt.Errorf("the segment 'targetRegion' was not found in the resource id %q", input) + if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { + return nil, fmt.Errorf("the segment 'targetRegionName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseTargetRegionIDInsensitively(input string) (*TargetRegionId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.TargetRegion, ok = parsed.Parsed["targetRegion"]; !ok { - return nil, fmt.Errorf("the segment 'targetRegion' was not found in the resource id %q", input) + if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { + return nil, fmt.Errorf("the segment 'targetRegionName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateTargetRegionID(input interface{}, key string) (warnings []string, e // ID returns the formatted Target Region ID func (id TargetRegionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/targetRegion/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.TargetRegion) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.TargetRegionName) } // Segments returns a slice of Resource ID Segments which comprise this Target Region ID @@ -119,9 +119,9 @@ func (id TargetRegionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticTargetRegion", "targetRegion", "targetRegion"), - resourceids.UserSpecifiedSegment("targetRegion", "targetRegionValue"), + resourceids.UserSpecifiedSegment("targetRegionName", "targetRegionValue"), } } @@ -130,8 +130,8 @@ func (id TargetRegionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Target Region: %q", id.TargetRegion), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Target Region Name: %q", id.TargetRegionName), } return fmt.Sprintf("Target Region (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_trigger.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_trigger.go index f3392f7be431..8db9ccfef9ec 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_trigger.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_trigger.go @@ -11,23 +11,23 @@ var _ resourceids.ResourceId = TriggerId{} // TriggerId is a struct representing the Resource ID for a Trigger type TriggerId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - DatabaseName string - ContainerName string - TriggerName string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + SqlDatabaseName string + ContainerName string + TriggerName string } // NewTriggerID returns a new TriggerId struct -func NewTriggerID(subscriptionId string, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) TriggerId { +func NewTriggerID(subscriptionId string, resourceGroupName string, databaseAccountName string, sqlDatabaseName string, containerName string, triggerName string) TriggerId { return TriggerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - DatabaseName: databaseName, - ContainerName: containerName, - TriggerName: triggerName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + SqlDatabaseName: sqlDatabaseName, + ContainerName: containerName, + TriggerName: triggerName, } } @@ -50,12 +50,12 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'sqlDatabaseName' was not found in the resource id %q", input) } if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { @@ -89,12 +89,12 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'sqlDatabaseName' was not found in the resource id %q", input) } if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { @@ -126,7 +126,7 @@ func ValidateTriggerID(input interface{}, key string) (warnings []string, errors // ID returns the formatted Trigger ID func (id TriggerId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/sqlDatabases/%s/containers/%s/triggers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.DatabaseName, id.ContainerName, id.TriggerName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.SqlDatabaseName, id.ContainerName, id.TriggerName) } // Segments returns a slice of Resource ID Segments which comprise this Trigger ID @@ -139,9 +139,9 @@ func (id TriggerId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticSqlDatabases", "sqlDatabases", "sqlDatabases"), - resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + resourceids.UserSpecifiedSegment("sqlDatabaseName", "sqlDatabaseValue"), resourceids.StaticSegment("staticContainers", "containers", "containers"), resourceids.UserSpecifiedSegment("containerName", "containerValue"), resourceids.StaticSegment("staticTriggers", "triggers", "triggers"), @@ -154,8 +154,8 @@ func (id TriggerId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Sql Database Name: %q", id.SqlDatabaseName), fmt.Sprintf("Container Name: %q", id.ContainerName), fmt.Sprintf("Trigger Name: %q", id.TriggerName), } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_userdefinedfunction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_userdefinedfunction.go index 64be7b976a23..5f1092316d53 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_userdefinedfunction.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_userdefinedfunction.go @@ -13,19 +13,19 @@ var _ resourceids.ResourceId = UserDefinedFunctionId{} type UserDefinedFunctionId struct { SubscriptionId string ResourceGroupName string - AccountName string - DatabaseName string + DatabaseAccountName string + SqlDatabaseName string ContainerName string UserDefinedFunctionName string } // NewUserDefinedFunctionID returns a new UserDefinedFunctionId struct -func NewUserDefinedFunctionID(subscriptionId string, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) UserDefinedFunctionId { +func NewUserDefinedFunctionID(subscriptionId string, resourceGroupName string, databaseAccountName string, sqlDatabaseName string, containerName string, userDefinedFunctionName string) UserDefinedFunctionId { return UserDefinedFunctionId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, - DatabaseName: databaseName, + DatabaseAccountName: databaseAccountName, + SqlDatabaseName: sqlDatabaseName, ContainerName: containerName, UserDefinedFunctionName: userDefinedFunctionName, } @@ -50,12 +50,12 @@ func ParseUserDefinedFunctionID(input string) (*UserDefinedFunctionId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'sqlDatabaseName' was not found in the resource id %q", input) } if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { @@ -89,12 +89,12 @@ func ParseUserDefinedFunctionIDInsensitively(input string) (*UserDefinedFunction return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { + return nil, fmt.Errorf("the segment 'sqlDatabaseName' was not found in the resource id %q", input) } if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { @@ -126,7 +126,7 @@ func ValidateUserDefinedFunctionID(input interface{}, key string) (warnings []st // ID returns the formatted User Defined Function ID func (id UserDefinedFunctionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/sqlDatabases/%s/containers/%s/userDefinedFunctions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.DatabaseName, id.ContainerName, id.UserDefinedFunctionName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.SqlDatabaseName, id.ContainerName, id.UserDefinedFunctionName) } // Segments returns a slice of Resource ID Segments which comprise this User Defined Function ID @@ -139,9 +139,9 @@ func (id UserDefinedFunctionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticSqlDatabases", "sqlDatabases", "sqlDatabases"), - resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + resourceids.UserSpecifiedSegment("sqlDatabaseName", "sqlDatabaseValue"), resourceids.StaticSegment("staticContainers", "containers", "containers"), resourceids.UserSpecifiedSegment("containerName", "containerValue"), resourceids.StaticSegment("staticUserDefinedFunctions", "userDefinedFunctions", "userDefinedFunctions"), @@ -154,8 +154,8 @@ func (id UserDefinedFunctionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), + fmt.Sprintf("Sql Database Name: %q", id.SqlDatabaseName), fmt.Sprintf("Container Name: %q", id.ContainerName), fmt.Sprintf("User Defined Function Name: %q", id.UserDefinedFunctionName), } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/managedcassandras/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/managedcassandras/README.md index 4da759b13b59..c2d361c87c6c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/managedcassandras/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/managedcassandras/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cassandraClusterValue") payload := managedcassandras.ClusterResource{ // ... @@ -41,7 +41,7 @@ if err := client.CassandraClustersCreateUpdateThenPoll(ctx, id, payload); err != ```go ctx := context.TODO() -id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cassandraClusterValue") if err := client.CassandraClustersDeallocateThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.CassandraClustersDeallocateThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cassandraClusterValue") if err := client.CassandraClustersDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -65,7 +65,7 @@ if err := client.CassandraClustersDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cassandraClusterValue") read, err := client.CassandraClustersGet(ctx, id) if err != nil { @@ -81,7 +81,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cassandraClusterValue") payload := managedcassandras.CommandPostBody{ // ... @@ -130,7 +130,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cassandraClusterValue") if err := client.CassandraClustersStartThenPoll(ctx, id); err != nil { // handle the error @@ -142,7 +142,7 @@ if err := client.CassandraClustersStartThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cassandraClusterValue") read, err := client.CassandraClustersStatus(ctx, id) if err != nil { @@ -158,7 +158,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cassandraClusterValue") payload := managedcassandras.ClusterResource{ // ... @@ -175,7 +175,7 @@ if err := client.CassandraClustersUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := managedcassandras.NewDataCenterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "dataCenterValue") +id := managedcassandras.NewDataCenterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cassandraClusterValue", "dataCenterValue") payload := managedcassandras.DataCenterResource{ // ... @@ -192,7 +192,7 @@ if err := client.CassandraDataCentersCreateUpdateThenPoll(ctx, id, payload); err ```go ctx := context.TODO() -id := managedcassandras.NewDataCenterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "dataCenterValue") +id := managedcassandras.NewDataCenterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cassandraClusterValue", "dataCenterValue") if err := client.CassandraDataCentersDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -204,7 +204,7 @@ if err := client.CassandraDataCentersDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := managedcassandras.NewDataCenterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "dataCenterValue") +id := managedcassandras.NewDataCenterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cassandraClusterValue", "dataCenterValue") read, err := client.CassandraDataCentersGet(ctx, id) if err != nil { @@ -220,7 +220,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := managedcassandras.NewCassandraClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cassandraClusterValue") read, err := client.CassandraDataCentersList(ctx, id) if err != nil { @@ -236,7 +236,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedcassandras.NewDataCenterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "dataCenterValue") +id := managedcassandras.NewDataCenterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cassandraClusterValue", "dataCenterValue") payload := managedcassandras.DataCenterResource{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_cassandracluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_cassandracluster.go index d12d7d492ed8..eb1e52d2af9a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_cassandracluster.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_cassandracluster.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = CassandraClusterId{} // CassandraClusterId is a struct representing the Resource ID for a Cassandra Cluster type CassandraClusterId struct { - SubscriptionId string - ResourceGroupName string - ClusterName string + SubscriptionId string + ResourceGroupName string + CassandraClusterName string } // NewCassandraClusterID returns a new CassandraClusterId struct -func NewCassandraClusterID(subscriptionId string, resourceGroupName string, clusterName string) CassandraClusterId { +func NewCassandraClusterID(subscriptionId string, resourceGroupName string, cassandraClusterName string) CassandraClusterId { return CassandraClusterId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ClusterName: clusterName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CassandraClusterName: cassandraClusterName, } } @@ -44,8 +44,8 @@ func ParseCassandraClusterID(input string) (*CassandraClusterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'cassandraClusterName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseCassandraClusterIDInsensitively(input string) (*CassandraClusterId, er return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'cassandraClusterName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateCassandraClusterID(input interface{}, key string) (warnings []strin // ID returns the formatted Cassandra Cluster ID func (id CassandraClusterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/cassandraClusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CassandraClusterName) } // Segments returns a slice of Resource ID Segments which comprise this Cassandra Cluster ID @@ -109,7 +109,7 @@ func (id CassandraClusterId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticCassandraClusters", "cassandraClusters", "cassandraClusters"), - resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.UserSpecifiedSegment("cassandraClusterName", "cassandraClusterValue"), } } @@ -118,7 +118,7 @@ func (id CassandraClusterId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Cassandra Cluster Name: %q", id.CassandraClusterName), } return fmt.Sprintf("Cassandra Cluster (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_datacenter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_datacenter.go index 27bdd4d8f766..1d8ed9e89131 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_datacenter.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_datacenter.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = DataCenterId{} // DataCenterId is a struct representing the Resource ID for a Data Center type DataCenterId struct { - SubscriptionId string - ResourceGroupName string - ClusterName string - DataCenterName string + SubscriptionId string + ResourceGroupName string + CassandraClusterName string + DataCenterName string } // NewDataCenterID returns a new DataCenterId struct -func NewDataCenterID(subscriptionId string, resourceGroupName string, clusterName string, dataCenterName string) DataCenterId { +func NewDataCenterID(subscriptionId string, resourceGroupName string, cassandraClusterName string, dataCenterName string) DataCenterId { return DataCenterId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ClusterName: clusterName, - DataCenterName: dataCenterName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CassandraClusterName: cassandraClusterName, + DataCenterName: dataCenterName, } } @@ -46,8 +46,8 @@ func ParseDataCenterID(input string) (*DataCenterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'cassandraClusterName' was not found in the resource id %q", input) } if id.DataCenterName, ok = parsed.Parsed["dataCenterName"]; !ok { @@ -77,8 +77,8 @@ func ParseDataCenterIDInsensitively(input string) (*DataCenterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'cassandraClusterName' was not found in the resource id %q", input) } if id.DataCenterName, ok = parsed.Parsed["dataCenterName"]; !ok { @@ -106,7 +106,7 @@ func ValidateDataCenterID(input interface{}, key string) (warnings []string, err // ID returns the formatted Data Center ID func (id DataCenterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/cassandraClusters/%s/dataCenters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.DataCenterName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CassandraClusterName, id.DataCenterName) } // Segments returns a slice of Resource ID Segments which comprise this Data Center ID @@ -119,7 +119,7 @@ func (id DataCenterId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticCassandraClusters", "cassandraClusters", "cassandraClusters"), - resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.UserSpecifiedSegment("cassandraClusterName", "cassandraClusterValue"), resourceids.StaticSegment("staticDataCenters", "dataCenters", "dataCenters"), resourceids.UserSpecifiedSegment("dataCenterName", "dataCenterValue"), } @@ -130,7 +130,7 @@ func (id DataCenterId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Cassandra Cluster Name: %q", id.CassandraClusterName), fmt.Sprintf("Data Center Name: %q", id.DataCenterName), } return fmt.Sprintf("Data Center (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/sqldedicatedgateway/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/sqldedicatedgateway/README.md index 8da009a591e7..27f403b3bc9d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/sqldedicatedgateway/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/sqldedicatedgateway/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := sqldedicatedgateway.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "serviceValue") +id := sqldedicatedgateway.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "serviceValue") payload := sqldedicatedgateway.ServiceResourceCreateUpdateParameters{ // ... @@ -41,7 +41,7 @@ if err := client.ServiceCreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := sqldedicatedgateway.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "serviceValue") +id := sqldedicatedgateway.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "serviceValue") if err := client.ServiceDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.ServiceDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := sqldedicatedgateway.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "serviceValue") +id := sqldedicatedgateway.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "databaseAccountValue", "serviceValue") read, err := client.ServiceGet(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/sqldedicatedgateway/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/sqldedicatedgateway/id_service.go index ca02d9bd8481..edf121e57e73 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/sqldedicatedgateway/id_service.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/sqldedicatedgateway/id_service.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = ServiceId{} // ServiceId is a struct representing the Resource ID for a Service type ServiceId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - ServiceName string + SubscriptionId string + ResourceGroupName string + DatabaseAccountName string + ServiceName string } // NewServiceID returns a new ServiceId struct -func NewServiceID(subscriptionId string, resourceGroupName string, accountName string, serviceName string) ServiceId { +func NewServiceID(subscriptionId string, resourceGroupName string, databaseAccountName string, serviceName string) ServiceId { return ServiceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - ServiceName: serviceName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DatabaseAccountName: databaseAccountName, + ServiceName: serviceName, } } @@ -46,8 +46,8 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { @@ -77,8 +77,8 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseAccountName' was not found in the resource id %q", input) } if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { @@ -106,7 +106,7 @@ func ValidateServiceID(input interface{}, key string) (warnings []string, errors // ID returns the formatted Service ID func (id ServiceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/services/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ServiceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.ServiceName) } // Segments returns a slice of Resource ID Segments which comprise this Service ID @@ -119,7 +119,7 @@ func (id ServiceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDocumentDB", "Microsoft.DocumentDB", "Microsoft.DocumentDB"), resourceids.StaticSegment("staticDatabaseAccounts", "databaseAccounts", "databaseAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("databaseAccountName", "databaseAccountValue"), resourceids.StaticSegment("staticServices", "services", "services"), resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), } @@ -130,7 +130,7 @@ func (id ServiceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Database Account Name: %q", id.DatabaseAccountName), fmt.Sprintf("Service Name: %q", id.ServiceName), } return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/README.md index 2c7b89ea05e1..1f6545cacd02 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/README.md @@ -65,7 +65,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := scheduledactions.NewScheduledActionID("nameValue") +id := scheduledactions.NewScheduledActionID("scheduledActionValue") payload := scheduledactions.ScheduledAction{ // ... @@ -86,7 +86,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := scheduledactions.NewScopedScheduledActionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "nameValue") +id := scheduledactions.NewScopedScheduledActionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "scheduledActionValue") payload := scheduledactions.ScheduledAction{ // ... @@ -107,7 +107,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := scheduledactions.NewScheduledActionID("nameValue") +id := scheduledactions.NewScheduledActionID("scheduledActionValue") read, err := client.Delete(ctx, id) if err != nil { @@ -123,7 +123,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := scheduledactions.NewScopedScheduledActionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "nameValue") +id := scheduledactions.NewScopedScheduledActionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "scheduledActionValue") read, err := client.DeleteByScope(ctx, id) if err != nil { @@ -139,7 +139,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := scheduledactions.NewScheduledActionID("nameValue") +id := scheduledactions.NewScheduledActionID("scheduledActionValue") read, err := client.Execute(ctx, id) if err != nil { @@ -155,7 +155,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := scheduledactions.NewScopedScheduledActionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "nameValue") +id := scheduledactions.NewScopedScheduledActionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "scheduledActionValue") read, err := client.ExecuteByScope(ctx, id) if err != nil { @@ -171,7 +171,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := scheduledactions.NewScheduledActionID("nameValue") +id := scheduledactions.NewScheduledActionID("scheduledActionValue") read, err := client.Get(ctx, id) if err != nil { @@ -187,7 +187,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := scheduledactions.NewScopedScheduledActionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "nameValue") +id := scheduledactions.NewScopedScheduledActionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "scheduledActionValue") read, err := client.GetByScope(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scheduledaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scheduledaction.go index 6de26f4a59d8..e3e2278c8531 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scheduledaction.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scheduledaction.go @@ -11,13 +11,13 @@ var _ resourceids.ResourceId = ScheduledActionId{} // ScheduledActionId is a struct representing the Resource ID for a Scheduled Action type ScheduledActionId struct { - Name string + ScheduledActionName string } // NewScheduledActionID returns a new ScheduledActionId struct -func NewScheduledActionID(name string) ScheduledActionId { +func NewScheduledActionID(scheduledActionName string) ScheduledActionId { return ScheduledActionId{ - Name: name, + ScheduledActionName: scheduledActionName, } } @@ -32,8 +32,8 @@ func ParseScheduledActionID(input string) (*ScheduledActionId, error) { var ok bool id := ScheduledActionId{} - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { + return nil, fmt.Errorf("the segment 'scheduledActionName' was not found in the resource id %q", input) } return &id, nil @@ -51,8 +51,8 @@ func ParseScheduledActionIDInsensitively(input string) (*ScheduledActionId, erro var ok bool id := ScheduledActionId{} - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { + return nil, fmt.Errorf("the segment 'scheduledActionName' was not found in the resource id %q", input) } return &id, nil @@ -76,7 +76,7 @@ func ValidateScheduledActionID(input interface{}, key string) (warnings []string // ID returns the formatted Scheduled Action ID func (id ScheduledActionId) ID() string { fmtString := "/providers/Microsoft.CostManagement/scheduledActions/%s" - return fmt.Sprintf(fmtString, id.Name) + return fmt.Sprintf(fmtString, id.ScheduledActionName) } // Segments returns a slice of Resource ID Segments which comprise this Scheduled Action ID @@ -85,14 +85,14 @@ func (id ScheduledActionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftCostManagement", "Microsoft.CostManagement", "Microsoft.CostManagement"), resourceids.StaticSegment("staticScheduledActions", "scheduledActions", "scheduledActions"), - resourceids.UserSpecifiedSegment("name", "nameValue"), + resourceids.UserSpecifiedSegment("scheduledActionName", "scheduledActionValue"), } } // String returns a human-readable description of this Scheduled Action ID func (id ScheduledActionId) String() string { components := []string{ - fmt.Sprintf("Name: %q", id.Name), + fmt.Sprintf("Scheduled Action Name: %q", id.ScheduledActionName), } return fmt.Sprintf("Scheduled Action (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scopedscheduledaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scopedscheduledaction.go index a95745e6cc76..6af3a4b12053 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scopedscheduledaction.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scopedscheduledaction.go @@ -11,15 +11,15 @@ var _ resourceids.ResourceId = ScopedScheduledActionId{} // ScopedScheduledActionId is a struct representing the Resource ID for a Scoped Scheduled Action type ScopedScheduledActionId struct { - Scope string - Name string + Scope string + ScheduledActionName string } // NewScopedScheduledActionID returns a new ScopedScheduledActionId struct -func NewScopedScheduledActionID(scope string, name string) ScopedScheduledActionId { +func NewScopedScheduledActionID(scope string, scheduledActionName string) ScopedScheduledActionId { return ScopedScheduledActionId{ - Scope: scope, - Name: name, + Scope: scope, + ScheduledActionName: scheduledActionName, } } @@ -38,8 +38,8 @@ func ParseScopedScheduledActionID(input string) (*ScopedScheduledActionId, error return nil, fmt.Errorf("the segment 'scope' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { + return nil, fmt.Errorf("the segment 'scheduledActionName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseScopedScheduledActionIDInsensitively(input string) (*ScopedScheduledAc return nil, fmt.Errorf("the segment 'scope' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { + return nil, fmt.Errorf("the segment 'scheduledActionName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateScopedScheduledActionID(input interface{}, key string) (warnings [] // ID returns the formatted Scoped Scheduled Action ID func (id ScopedScheduledActionId) ID() string { fmtString := "/%s/providers/Microsoft.CostManagement/scheduledActions/%s" - return fmt.Sprintf(fmtString, strings.TrimPrefix(id.Scope, "/"), id.Name) + return fmt.Sprintf(fmtString, strings.TrimPrefix(id.Scope, "/"), id.ScheduledActionName) } // Segments returns a slice of Resource ID Segments which comprise this Scoped Scheduled Action ID @@ -96,7 +96,7 @@ func (id ScopedScheduledActionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftCostManagement", "Microsoft.CostManagement", "Microsoft.CostManagement"), resourceids.StaticSegment("staticScheduledActions", "scheduledActions", "scheduledActions"), - resourceids.UserSpecifiedSegment("name", "nameValue"), + resourceids.UserSpecifiedSegment("scheduledActionName", "scheduledActionValue"), } } @@ -104,7 +104,7 @@ func (id ScopedScheduledActionId) Segments() []resourceids.Segment { func (id ScopedScheduledActionId) String() string { components := []string{ fmt.Sprintf("Scope: %q", id.Scope), - fmt.Sprintf("Name: %q", id.Name), + fmt.Sprintf("Scheduled Action Name: %q", id.ScheduledActionName), } return fmt.Sprintf("Scoped Scheduled Action (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2022-08-01/grafanaresource/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2022-08-01/grafanaresource/README.md index 6f2ef458cee5..a8c4cc7a8c89 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2022-08-01/grafanaresource/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2022-08-01/grafanaresource/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := grafanaresource.NewGrafanaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") +id := grafanaresource.NewGrafanaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "grafanaValue") payload := grafanaresource.ManagedGrafana{ // ... @@ -41,7 +41,7 @@ if err := client.GrafanaCreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := grafanaresource.NewGrafanaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") +id := grafanaresource.NewGrafanaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "grafanaValue") if err := client.GrafanaDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.GrafanaDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := grafanaresource.NewGrafanaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") +id := grafanaresource.NewGrafanaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "grafanaValue") read, err := client.GrafanaGet(ctx, id) if err != nil { @@ -103,7 +103,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := grafanaresource.NewGrafanaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") +id := grafanaresource.NewGrafanaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "grafanaValue") payload := grafanaresource.ManagedGrafanaUpdateParameters{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2022-08-01/grafanaresource/id_grafana.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2022-08-01/grafanaresource/id_grafana.go index c23f68127beb..9c06839ef9dd 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2022-08-01/grafanaresource/id_grafana.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2022-08-01/grafanaresource/id_grafana.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = GrafanaId{} type GrafanaId struct { SubscriptionId string ResourceGroupName string - WorkspaceName string + GrafanaName string } // NewGrafanaID returns a new GrafanaId struct -func NewGrafanaID(subscriptionId string, resourceGroupName string, workspaceName string) GrafanaId { +func NewGrafanaID(subscriptionId string, resourceGroupName string, grafanaName string) GrafanaId { return GrafanaId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - WorkspaceName: workspaceName, + GrafanaName: grafanaName, } } @@ -44,8 +44,8 @@ func ParseGrafanaID(input string) (*GrafanaId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + if id.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { + return nil, fmt.Errorf("the segment 'grafanaName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseGrafanaIDInsensitively(input string) (*GrafanaId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + if id.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { + return nil, fmt.Errorf("the segment 'grafanaName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateGrafanaID(input interface{}, key string) (warnings []string, errors // ID returns the formatted Grafana ID func (id GrafanaId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Dashboard/grafana/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.GrafanaName) } // Segments returns a slice of Resource ID Segments which comprise this Grafana ID @@ -109,7 +109,7 @@ func (id GrafanaId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDashboard", "Microsoft.Dashboard", "Microsoft.Dashboard"), resourceids.StaticSegment("staticGrafana", "grafana", "grafana"), - resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"), + resourceids.UserSpecifiedSegment("grafanaName", "grafanaValue"), } } @@ -118,7 +118,7 @@ func (id GrafanaId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + fmt.Sprintf("Grafana Name: %q", id.GrafanaName), } return fmt.Sprintf("Grafana (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/README.md new file mode 100644 index 000000000000..18b123b6df2e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/README.md @@ -0,0 +1,279 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices` Documentation + +The `devices` SDK allows for interaction with the Azure Resource Manager Service `databoxedge` (API Version `2020-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices" +``` + + +### Client Initialization + +```go +client := devices.NewDevicesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DevicesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := devices.NewDataBoxEdgeDeviceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataBoxEdgeDeviceValue") + +payload := devices.DataBoxEdgeDevice{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DevicesClient.CreateOrUpdateSecuritySettings` + +```go +ctx := context.TODO() +id := devices.NewDataBoxEdgeDeviceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataBoxEdgeDeviceValue") + +payload := devices.SecuritySettings{ + // ... +} + + +if err := client.CreateOrUpdateSecuritySettingsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DevicesClient.Delete` + +```go +ctx := context.TODO() +id := devices.NewDataBoxEdgeDeviceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataBoxEdgeDeviceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DevicesClient.DownloadUpdates` + +```go +ctx := context.TODO() +id := devices.NewDataBoxEdgeDeviceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataBoxEdgeDeviceValue") + +if err := client.DownloadUpdatesThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DevicesClient.GenerateCertificate` + +```go +ctx := context.TODO() +id := devices.NewDataBoxEdgeDeviceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataBoxEdgeDeviceValue") + +read, err := client.GenerateCertificate(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DevicesClient.Get` + +```go +ctx := context.TODO() +id := devices.NewDataBoxEdgeDeviceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataBoxEdgeDeviceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DevicesClient.GetExtendedInformation` + +```go +ctx := context.TODO() +id := devices.NewDataBoxEdgeDeviceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataBoxEdgeDeviceValue") + +read, err := client.GetExtendedInformation(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DevicesClient.GetNetworkSettings` + +```go +ctx := context.TODO() +id := devices.NewDataBoxEdgeDeviceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataBoxEdgeDeviceValue") + +read, err := client.GetNetworkSettings(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DevicesClient.GetUpdateSummary` + +```go +ctx := context.TODO() +id := devices.NewDataBoxEdgeDeviceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataBoxEdgeDeviceValue") + +read, err := client.GetUpdateSummary(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DevicesClient.InstallUpdates` + +```go +ctx := context.TODO() +id := devices.NewDataBoxEdgeDeviceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataBoxEdgeDeviceValue") + +if err := client.InstallUpdatesThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DevicesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := devices.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id, devices.DefaultListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id, devices.DefaultListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DevicesClient.ListBySubscription` + +```go +ctx := context.TODO() +id := devices.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id, devices.DefaultListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id, devices.DefaultListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DevicesClient.ScanForUpdates` + +```go +ctx := context.TODO() +id := devices.NewDataBoxEdgeDeviceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataBoxEdgeDeviceValue") + +if err := client.ScanForUpdatesThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DevicesClient.Update` + +```go +ctx := context.TODO() +id := devices.NewDataBoxEdgeDeviceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataBoxEdgeDeviceValue") + +payload := devices.DataBoxEdgeDevicePatch{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DevicesClient.UpdateExtendedInformation` + +```go +ctx := context.TODO() +id := devices.NewDataBoxEdgeDeviceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataBoxEdgeDeviceValue") + +payload := devices.DataBoxEdgeDeviceExtendedInfoPatch{ + // ... +} + + +read, err := client.UpdateExtendedInformation(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DevicesClient.UploadCertificate` + +```go +ctx := context.TODO() +id := devices.NewDataBoxEdgeDeviceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataBoxEdgeDeviceValue") + +payload := devices.UploadCertificateRequest{ + // ... +} + + +read, err := client.UploadCertificate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/client.go new file mode 100644 index 000000000000..826aa3d578b2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/client.go @@ -0,0 +1,18 @@ +package devices + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DevicesClient struct { + Client autorest.Client + baseUri string +} + +func NewDevicesClientWithBaseURI(endpoint string) DevicesClient { + return DevicesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/constants.go new file mode 100644 index 000000000000..b0d745fa1e8c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/constants.go @@ -0,0 +1,636 @@ +package devices + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthenticationType string + +const ( + AuthenticationTypeAzureActiveDirectory AuthenticationType = "AzureActiveDirectory" + AuthenticationTypeInvalid AuthenticationType = "Invalid" +) + +func PossibleValuesForAuthenticationType() []string { + return []string{ + string(AuthenticationTypeAzureActiveDirectory), + string(AuthenticationTypeInvalid), + } +} + +func parseAuthenticationType(input string) (*AuthenticationType, error) { + vals := map[string]AuthenticationType{ + "azureactivedirectory": AuthenticationTypeAzureActiveDirectory, + "invalid": AuthenticationTypeInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AuthenticationType(input) + return &out, nil +} + +type DataBoxEdgeDeviceKind string + +const ( + DataBoxEdgeDeviceKindAzureDataBoxGateway DataBoxEdgeDeviceKind = "AzureDataBoxGateway" + DataBoxEdgeDeviceKindAzureModularDataCentre DataBoxEdgeDeviceKind = "AzureModularDataCentre" + DataBoxEdgeDeviceKindAzureStackEdge DataBoxEdgeDeviceKind = "AzureStackEdge" + DataBoxEdgeDeviceKindAzureStackHub DataBoxEdgeDeviceKind = "AzureStackHub" +) + +func PossibleValuesForDataBoxEdgeDeviceKind() []string { + return []string{ + string(DataBoxEdgeDeviceKindAzureDataBoxGateway), + string(DataBoxEdgeDeviceKindAzureModularDataCentre), + string(DataBoxEdgeDeviceKindAzureStackEdge), + string(DataBoxEdgeDeviceKindAzureStackHub), + } +} + +func parseDataBoxEdgeDeviceKind(input string) (*DataBoxEdgeDeviceKind, error) { + vals := map[string]DataBoxEdgeDeviceKind{ + "azuredataboxgateway": DataBoxEdgeDeviceKindAzureDataBoxGateway, + "azuremodulardatacentre": DataBoxEdgeDeviceKindAzureModularDataCentre, + "azurestackedge": DataBoxEdgeDeviceKindAzureStackEdge, + "azurestackhub": DataBoxEdgeDeviceKindAzureStackHub, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DataBoxEdgeDeviceKind(input) + return &out, nil +} + +type DataBoxEdgeDeviceStatus string + +const ( + DataBoxEdgeDeviceStatusDisconnected DataBoxEdgeDeviceStatus = "Disconnected" + DataBoxEdgeDeviceStatusMaintenance DataBoxEdgeDeviceStatus = "Maintenance" + DataBoxEdgeDeviceStatusNeedsAttention DataBoxEdgeDeviceStatus = "NeedsAttention" + DataBoxEdgeDeviceStatusOffline DataBoxEdgeDeviceStatus = "Offline" + DataBoxEdgeDeviceStatusOnline DataBoxEdgeDeviceStatus = "Online" + DataBoxEdgeDeviceStatusPartiallyDisconnected DataBoxEdgeDeviceStatus = "PartiallyDisconnected" + DataBoxEdgeDeviceStatusReadyToSetup DataBoxEdgeDeviceStatus = "ReadyToSetup" +) + +func PossibleValuesForDataBoxEdgeDeviceStatus() []string { + return []string{ + string(DataBoxEdgeDeviceStatusDisconnected), + string(DataBoxEdgeDeviceStatusMaintenance), + string(DataBoxEdgeDeviceStatusNeedsAttention), + string(DataBoxEdgeDeviceStatusOffline), + string(DataBoxEdgeDeviceStatusOnline), + string(DataBoxEdgeDeviceStatusPartiallyDisconnected), + string(DataBoxEdgeDeviceStatusReadyToSetup), + } +} + +func parseDataBoxEdgeDeviceStatus(input string) (*DataBoxEdgeDeviceStatus, error) { + vals := map[string]DataBoxEdgeDeviceStatus{ + "disconnected": DataBoxEdgeDeviceStatusDisconnected, + "maintenance": DataBoxEdgeDeviceStatusMaintenance, + "needsattention": DataBoxEdgeDeviceStatusNeedsAttention, + "offline": DataBoxEdgeDeviceStatusOffline, + "online": DataBoxEdgeDeviceStatusOnline, + "partiallydisconnected": DataBoxEdgeDeviceStatusPartiallyDisconnected, + "readytosetup": DataBoxEdgeDeviceStatusReadyToSetup, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DataBoxEdgeDeviceStatus(input) + return &out, nil +} + +type DeviceType string + +const ( + DeviceTypeDataBoxEdgeDevice DeviceType = "DataBoxEdgeDevice" +) + +func PossibleValuesForDeviceType() []string { + return []string{ + string(DeviceTypeDataBoxEdgeDevice), + } +} + +func parseDeviceType(input string) (*DeviceType, error) { + vals := map[string]DeviceType{ + "databoxedgedevice": DeviceTypeDataBoxEdgeDevice, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeviceType(input) + return &out, nil +} + +type EncryptionAlgorithm string + +const ( + EncryptionAlgorithmAESTwoFiveSix EncryptionAlgorithm = "AES256" + EncryptionAlgorithmNone EncryptionAlgorithm = "None" + EncryptionAlgorithmRSAESPKCSOneVOneFive EncryptionAlgorithm = "RSAES_PKCS1_v_1_5" +) + +func PossibleValuesForEncryptionAlgorithm() []string { + return []string{ + string(EncryptionAlgorithmAESTwoFiveSix), + string(EncryptionAlgorithmNone), + string(EncryptionAlgorithmRSAESPKCSOneVOneFive), + } +} + +func parseEncryptionAlgorithm(input string) (*EncryptionAlgorithm, error) { + vals := map[string]EncryptionAlgorithm{ + "aes256": EncryptionAlgorithmAESTwoFiveSix, + "none": EncryptionAlgorithmNone, + "rsaes_pkcs1_v_1_5": EncryptionAlgorithmRSAESPKCSOneVOneFive, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EncryptionAlgorithm(input) + return &out, nil +} + +type InstallRebootBehavior string + +const ( + InstallRebootBehaviorNeverReboots InstallRebootBehavior = "NeverReboots" + InstallRebootBehaviorRequestReboot InstallRebootBehavior = "RequestReboot" + InstallRebootBehaviorRequiresReboot InstallRebootBehavior = "RequiresReboot" +) + +func PossibleValuesForInstallRebootBehavior() []string { + return []string{ + string(InstallRebootBehaviorNeverReboots), + string(InstallRebootBehaviorRequestReboot), + string(InstallRebootBehaviorRequiresReboot), + } +} + +func parseInstallRebootBehavior(input string) (*InstallRebootBehavior, error) { + vals := map[string]InstallRebootBehavior{ + "neverreboots": InstallRebootBehaviorNeverReboots, + "requestreboot": InstallRebootBehaviorRequestReboot, + "requiresreboot": InstallRebootBehaviorRequiresReboot, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InstallRebootBehavior(input) + return &out, nil +} + +type KeyVaultSyncStatus string + +const ( + KeyVaultSyncStatusKeyVaultNotConfigured KeyVaultSyncStatus = "KeyVaultNotConfigured" + KeyVaultSyncStatusKeyVaultSyncFailed KeyVaultSyncStatus = "KeyVaultSyncFailed" + KeyVaultSyncStatusKeyVaultSyncPending KeyVaultSyncStatus = "KeyVaultSyncPending" + KeyVaultSyncStatusKeyVaultSynced KeyVaultSyncStatus = "KeyVaultSynced" + KeyVaultSyncStatusKeyVaultSyncing KeyVaultSyncStatus = "KeyVaultSyncing" +) + +func PossibleValuesForKeyVaultSyncStatus() []string { + return []string{ + string(KeyVaultSyncStatusKeyVaultNotConfigured), + string(KeyVaultSyncStatusKeyVaultSyncFailed), + string(KeyVaultSyncStatusKeyVaultSyncPending), + string(KeyVaultSyncStatusKeyVaultSynced), + string(KeyVaultSyncStatusKeyVaultSyncing), + } +} + +func parseKeyVaultSyncStatus(input string) (*KeyVaultSyncStatus, error) { + vals := map[string]KeyVaultSyncStatus{ + "keyvaultnotconfigured": KeyVaultSyncStatusKeyVaultNotConfigured, + "keyvaultsyncfailed": KeyVaultSyncStatusKeyVaultSyncFailed, + "keyvaultsyncpending": KeyVaultSyncStatusKeyVaultSyncPending, + "keyvaultsynced": KeyVaultSyncStatusKeyVaultSynced, + "keyvaultsyncing": KeyVaultSyncStatusKeyVaultSyncing, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyVaultSyncStatus(input) + return &out, nil +} + +type MsiIdentityType string + +const ( + MsiIdentityTypeNone MsiIdentityType = "None" + MsiIdentityTypeSystemAssigned MsiIdentityType = "SystemAssigned" + MsiIdentityTypeUserAssigned MsiIdentityType = "UserAssigned" +) + +func PossibleValuesForMsiIdentityType() []string { + return []string{ + string(MsiIdentityTypeNone), + string(MsiIdentityTypeSystemAssigned), + string(MsiIdentityTypeUserAssigned), + } +} + +func parseMsiIdentityType(input string) (*MsiIdentityType, error) { + vals := map[string]MsiIdentityType{ + "none": MsiIdentityTypeNone, + "systemassigned": MsiIdentityTypeSystemAssigned, + "userassigned": MsiIdentityTypeUserAssigned, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MsiIdentityType(input) + return &out, nil +} + +type NetworkAdapterDHCPStatus string + +const ( + NetworkAdapterDHCPStatusDisabled NetworkAdapterDHCPStatus = "Disabled" + NetworkAdapterDHCPStatusEnabled NetworkAdapterDHCPStatus = "Enabled" +) + +func PossibleValuesForNetworkAdapterDHCPStatus() []string { + return []string{ + string(NetworkAdapterDHCPStatusDisabled), + string(NetworkAdapterDHCPStatusEnabled), + } +} + +func parseNetworkAdapterDHCPStatus(input string) (*NetworkAdapterDHCPStatus, error) { + vals := map[string]NetworkAdapterDHCPStatus{ + "disabled": NetworkAdapterDHCPStatusDisabled, + "enabled": NetworkAdapterDHCPStatusEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkAdapterDHCPStatus(input) + return &out, nil +} + +type NetworkAdapterRDMAStatus string + +const ( + NetworkAdapterRDMAStatusCapable NetworkAdapterRDMAStatus = "Capable" + NetworkAdapterRDMAStatusIncapable NetworkAdapterRDMAStatus = "Incapable" +) + +func PossibleValuesForNetworkAdapterRDMAStatus() []string { + return []string{ + string(NetworkAdapterRDMAStatusCapable), + string(NetworkAdapterRDMAStatusIncapable), + } +} + +func parseNetworkAdapterRDMAStatus(input string) (*NetworkAdapterRDMAStatus, error) { + vals := map[string]NetworkAdapterRDMAStatus{ + "capable": NetworkAdapterRDMAStatusCapable, + "incapable": NetworkAdapterRDMAStatusIncapable, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkAdapterRDMAStatus(input) + return &out, nil +} + +type NetworkAdapterStatus string + +const ( + NetworkAdapterStatusActive NetworkAdapterStatus = "Active" + NetworkAdapterStatusInactive NetworkAdapterStatus = "Inactive" +) + +func PossibleValuesForNetworkAdapterStatus() []string { + return []string{ + string(NetworkAdapterStatusActive), + string(NetworkAdapterStatusInactive), + } +} + +func parseNetworkAdapterStatus(input string) (*NetworkAdapterStatus, error) { + vals := map[string]NetworkAdapterStatus{ + "active": NetworkAdapterStatusActive, + "inactive": NetworkAdapterStatusInactive, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkAdapterStatus(input) + return &out, nil +} + +type NetworkGroup string + +const ( + NetworkGroupNonRDMA NetworkGroup = "NonRDMA" + NetworkGroupNone NetworkGroup = "None" + NetworkGroupRDMA NetworkGroup = "RDMA" +) + +func PossibleValuesForNetworkGroup() []string { + return []string{ + string(NetworkGroupNonRDMA), + string(NetworkGroupNone), + string(NetworkGroupRDMA), + } +} + +func parseNetworkGroup(input string) (*NetworkGroup, error) { + vals := map[string]NetworkGroup{ + "nonrdma": NetworkGroupNonRDMA, + "none": NetworkGroupNone, + "rdma": NetworkGroupRDMA, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkGroup(input) + return &out, nil +} + +type ResourceMoveStatus string + +const ( + ResourceMoveStatusNone ResourceMoveStatus = "None" + ResourceMoveStatusResourceMoveFailed ResourceMoveStatus = "ResourceMoveFailed" + ResourceMoveStatusResourceMoveInProgress ResourceMoveStatus = "ResourceMoveInProgress" +) + +func PossibleValuesForResourceMoveStatus() []string { + return []string{ + string(ResourceMoveStatusNone), + string(ResourceMoveStatusResourceMoveFailed), + string(ResourceMoveStatusResourceMoveInProgress), + } +} + +func parseResourceMoveStatus(input string) (*ResourceMoveStatus, error) { + vals := map[string]ResourceMoveStatus{ + "none": ResourceMoveStatusNone, + "resourcemovefailed": ResourceMoveStatusResourceMoveFailed, + "resourcemoveinprogress": ResourceMoveStatusResourceMoveInProgress, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceMoveStatus(input) + return &out, nil +} + +type RoleTypes string + +const ( + RoleTypesASA RoleTypes = "ASA" + RoleTypesCloudEdgeManagement RoleTypes = "CloudEdgeManagement" + RoleTypesCognitive RoleTypes = "Cognitive" + RoleTypesFunctions RoleTypes = "Functions" + RoleTypesIOT RoleTypes = "IOT" + RoleTypesKubernetes RoleTypes = "Kubernetes" + RoleTypesMEC RoleTypes = "MEC" +) + +func PossibleValuesForRoleTypes() []string { + return []string{ + string(RoleTypesASA), + string(RoleTypesCloudEdgeManagement), + string(RoleTypesCognitive), + string(RoleTypesFunctions), + string(RoleTypesIOT), + string(RoleTypesKubernetes), + string(RoleTypesMEC), + } +} + +func parseRoleTypes(input string) (*RoleTypes, error) { + vals := map[string]RoleTypes{ + "asa": RoleTypesASA, + "cloudedgemanagement": RoleTypesCloudEdgeManagement, + "cognitive": RoleTypesCognitive, + "functions": RoleTypesFunctions, + "iot": RoleTypesIOT, + "kubernetes": RoleTypesKubernetes, + "mec": RoleTypesMEC, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RoleTypes(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameEdge SkuName = "Edge" + SkuNameEdgeMRMini SkuName = "EdgeMR_Mini" + SkuNameEdgePBase SkuName = "EdgeP_Base" + SkuNameEdgePHigh SkuName = "EdgeP_High" + SkuNameEdgePRBase SkuName = "EdgePR_Base" + SkuNameEdgePRBaseUPS SkuName = "EdgePR_Base_UPS" + SkuNameGPU SkuName = "GPU" + SkuNameGateway SkuName = "Gateway" + SkuNameRCALarge SkuName = "RCA_Large" + SkuNameRCASmall SkuName = "RCA_Small" + SkuNameRDC SkuName = "RDC" + SkuNameTCALarge SkuName = "TCA_Large" + SkuNameTCASmall SkuName = "TCA_Small" + SkuNameTDC SkuName = "TDC" + SkuNameTEAFourNodeHeater SkuName = "TEA_4Node_Heater" + SkuNameTEAFourNodeUPSHeater SkuName = "TEA_4Node_UPS_Heater" + SkuNameTEAOneNode SkuName = "TEA_1Node" + SkuNameTEAOneNodeHeater SkuName = "TEA_1Node_Heater" + SkuNameTEAOneNodeUPS SkuName = "TEA_1Node_UPS" + SkuNameTEAOneNodeUPSHeater SkuName = "TEA_1Node_UPS_Heater" + SkuNameTMA SkuName = "TMA" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameEdge), + string(SkuNameEdgeMRMini), + string(SkuNameEdgePBase), + string(SkuNameEdgePHigh), + string(SkuNameEdgePRBase), + string(SkuNameEdgePRBaseUPS), + string(SkuNameGPU), + string(SkuNameGateway), + string(SkuNameRCALarge), + string(SkuNameRCASmall), + string(SkuNameRDC), + string(SkuNameTCALarge), + string(SkuNameTCASmall), + string(SkuNameTDC), + string(SkuNameTEAFourNodeHeater), + string(SkuNameTEAFourNodeUPSHeater), + string(SkuNameTEAOneNode), + string(SkuNameTEAOneNodeHeater), + string(SkuNameTEAOneNodeUPS), + string(SkuNameTEAOneNodeUPSHeater), + string(SkuNameTMA), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "edge": SkuNameEdge, + "edgemr_mini": SkuNameEdgeMRMini, + "edgep_base": SkuNameEdgePBase, + "edgep_high": SkuNameEdgePHigh, + "edgepr_base": SkuNameEdgePRBase, + "edgepr_base_ups": SkuNameEdgePRBaseUPS, + "gpu": SkuNameGPU, + "gateway": SkuNameGateway, + "rca_large": SkuNameRCALarge, + "rca_small": SkuNameRCASmall, + "rdc": SkuNameRDC, + "tca_large": SkuNameTCALarge, + "tca_small": SkuNameTCASmall, + "tdc": SkuNameTDC, + "tea_4node_heater": SkuNameTEAFourNodeHeater, + "tea_4node_ups_heater": SkuNameTEAFourNodeUPSHeater, + "tea_1node": SkuNameTEAOneNode, + "tea_1node_heater": SkuNameTEAOneNodeHeater, + "tea_1node_ups": SkuNameTEAOneNodeUPS, + "tea_1node_ups_heater": SkuNameTEAOneNodeUPSHeater, + "tma": SkuNameTMA, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} + +type SubscriptionState string + +const ( + SubscriptionStateDeleted SubscriptionState = "Deleted" + SubscriptionStateRegistered SubscriptionState = "Registered" + SubscriptionStateSuspended SubscriptionState = "Suspended" + SubscriptionStateUnregistered SubscriptionState = "Unregistered" + SubscriptionStateWarned SubscriptionState = "Warned" +) + +func PossibleValuesForSubscriptionState() []string { + return []string{ + string(SubscriptionStateDeleted), + string(SubscriptionStateRegistered), + string(SubscriptionStateSuspended), + string(SubscriptionStateUnregistered), + string(SubscriptionStateWarned), + } +} + +func parseSubscriptionState(input string) (*SubscriptionState, error) { + vals := map[string]SubscriptionState{ + "deleted": SubscriptionStateDeleted, + "registered": SubscriptionStateRegistered, + "suspended": SubscriptionStateSuspended, + "unregistered": SubscriptionStateUnregistered, + "warned": SubscriptionStateWarned, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SubscriptionState(input) + return &out, nil +} + +type UpdateOperation string + +const ( + UpdateOperationDownload UpdateOperation = "Download" + UpdateOperationInstall UpdateOperation = "Install" + UpdateOperationNone UpdateOperation = "None" + UpdateOperationScan UpdateOperation = "Scan" +) + +func PossibleValuesForUpdateOperation() []string { + return []string{ + string(UpdateOperationDownload), + string(UpdateOperationInstall), + string(UpdateOperationNone), + string(UpdateOperationScan), + } +} + +func parseUpdateOperation(input string) (*UpdateOperation, error) { + vals := map[string]UpdateOperation{ + "download": UpdateOperationDownload, + "install": UpdateOperationInstall, + "none": UpdateOperationNone, + "scan": UpdateOperationScan, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpdateOperation(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/id_databoxedgedevice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/id_databoxedgedevice.go new file mode 100644 index 000000000000..8bada0ba5719 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/id_databoxedgedevice.go @@ -0,0 +1,124 @@ +package devices + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DataBoxEdgeDeviceId{} + +// DataBoxEdgeDeviceId is a struct representing the Resource ID for a Data Box Edge Device +type DataBoxEdgeDeviceId struct { + SubscriptionId string + ResourceGroupName string + DataBoxEdgeDeviceName string +} + +// NewDataBoxEdgeDeviceID returns a new DataBoxEdgeDeviceId struct +func NewDataBoxEdgeDeviceID(subscriptionId string, resourceGroupName string, dataBoxEdgeDeviceName string) DataBoxEdgeDeviceId { + return DataBoxEdgeDeviceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DataBoxEdgeDeviceName: dataBoxEdgeDeviceName, + } +} + +// ParseDataBoxEdgeDeviceID parses 'input' into a DataBoxEdgeDeviceId +func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { + parser := resourceids.NewParserFromResourceIdType(DataBoxEdgeDeviceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DataBoxEdgeDeviceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { + return nil, fmt.Errorf("the segment 'dataBoxEdgeDeviceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDataBoxEdgeDeviceIDInsensitively parses 'input' case-insensitively into a DataBoxEdgeDeviceId +// note: this method should only be used for API response data and not user input +func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, error) { + parser := resourceids.NewParserFromResourceIdType(DataBoxEdgeDeviceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DataBoxEdgeDeviceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { + return nil, fmt.Errorf("the segment 'dataBoxEdgeDeviceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID +func ValidateDataBoxEdgeDeviceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDataBoxEdgeDeviceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Data Box Edge Device ID +func (id DataBoxEdgeDeviceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DataBoxEdgeDeviceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Data Box Edge Device ID +func (id DataBoxEdgeDeviceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataBoxEdge", "Microsoft.DataBoxEdge", "Microsoft.DataBoxEdge"), + resourceids.StaticSegment("staticDataBoxEdgeDevices", "dataBoxEdgeDevices", "dataBoxEdgeDevices"), + resourceids.UserSpecifiedSegment("dataBoxEdgeDeviceName", "dataBoxEdgeDeviceValue"), + } +} + +// String returns a human-readable description of this Data Box Edge Device ID +func (id DataBoxEdgeDeviceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Data Box Edge Device Name: %q", id.DataBoxEdgeDeviceName), + } + return fmt.Sprintf("Data Box Edge Device (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_createorupdate_autorest.go new file mode 100644 index 000000000000..5f796e884fd8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package devices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c DevicesClient) CreateOrUpdate(ctx context.Context, id DataBoxEdgeDeviceId, input DataBoxEdgeDevice) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c DevicesClient) CreateOrUpdateThenPoll(ctx context.Context, id DataBoxEdgeDeviceId, input DataBoxEdgeDevice) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c DevicesClient) preparerForCreateOrUpdate(ctx context.Context, id DataBoxEdgeDeviceId, input DataBoxEdgeDevice) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c DevicesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_createorupdatesecuritysettings_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_createorupdatesecuritysettings_autorest.go new file mode 100644 index 000000000000..f6c16330e22c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_createorupdatesecuritysettings_autorest.go @@ -0,0 +1,79 @@ +package devices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateSecuritySettingsOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdateSecuritySettings ... +func (c DevicesClient) CreateOrUpdateSecuritySettings(ctx context.Context, id DataBoxEdgeDeviceId, input SecuritySettings) (result CreateOrUpdateSecuritySettingsOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdateSecuritySettings(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "CreateOrUpdateSecuritySettings", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdateSecuritySettings(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "CreateOrUpdateSecuritySettings", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateSecuritySettingsThenPoll performs CreateOrUpdateSecuritySettings then polls until it's completed +func (c DevicesClient) CreateOrUpdateSecuritySettingsThenPoll(ctx context.Context, id DataBoxEdgeDeviceId, input SecuritySettings) error { + result, err := c.CreateOrUpdateSecuritySettings(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdateSecuritySettings: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdateSecuritySettings: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdateSecuritySettings prepares the CreateOrUpdateSecuritySettings request. +func (c DevicesClient) preparerForCreateOrUpdateSecuritySettings(ctx context.Context, id DataBoxEdgeDeviceId, input SecuritySettings) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/securitySettings/default/update", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdateSecuritySettings sends the CreateOrUpdateSecuritySettings request. The method will close the +// http.Response Body if it receives an error. +func (c DevicesClient) senderForCreateOrUpdateSecuritySettings(ctx context.Context, req *http.Request) (future CreateOrUpdateSecuritySettingsOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_delete_autorest.go new file mode 100644 index 000000000000..5a3f7f443826 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_delete_autorest.go @@ -0,0 +1,78 @@ +package devices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c DevicesClient) Delete(ctx context.Context, id DataBoxEdgeDeviceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DevicesClient) DeleteThenPoll(ctx context.Context, id DataBoxEdgeDeviceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c DevicesClient) preparerForDelete(ctx context.Context, id DataBoxEdgeDeviceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c DevicesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_downloadupdates_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_downloadupdates_autorest.go new file mode 100644 index 000000000000..3b93e29cc873 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_downloadupdates_autorest.go @@ -0,0 +1,78 @@ +package devices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DownloadUpdatesOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DownloadUpdates ... +func (c DevicesClient) DownloadUpdates(ctx context.Context, id DataBoxEdgeDeviceId) (result DownloadUpdatesOperationResponse, err error) { + req, err := c.preparerForDownloadUpdates(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "DownloadUpdates", nil, "Failure preparing request") + return + } + + result, err = c.senderForDownloadUpdates(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "DownloadUpdates", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DownloadUpdatesThenPoll performs DownloadUpdates then polls until it's completed +func (c DevicesClient) DownloadUpdatesThenPoll(ctx context.Context, id DataBoxEdgeDeviceId) error { + result, err := c.DownloadUpdates(ctx, id) + if err != nil { + return fmt.Errorf("performing DownloadUpdates: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DownloadUpdates: %+v", err) + } + + return nil +} + +// preparerForDownloadUpdates prepares the DownloadUpdates request. +func (c DevicesClient) preparerForDownloadUpdates(ctx context.Context, id DataBoxEdgeDeviceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/downloadUpdates", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDownloadUpdates sends the DownloadUpdates request. The method will close the +// http.Response Body if it receives an error. +func (c DevicesClient) senderForDownloadUpdates(ctx context.Context, req *http.Request) (future DownloadUpdatesOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_generatecertificate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_generatecertificate_autorest.go new file mode 100644 index 000000000000..30fcffc6d248 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_generatecertificate_autorest.go @@ -0,0 +1,69 @@ +package devices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GenerateCertificateOperationResponse struct { + HttpResponse *http.Response + Model *GenerateCertResponse +} + +// GenerateCertificate ... +func (c DevicesClient) GenerateCertificate(ctx context.Context, id DataBoxEdgeDeviceId) (result GenerateCertificateOperationResponse, err error) { + req, err := c.preparerForGenerateCertificate(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "GenerateCertificate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "GenerateCertificate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGenerateCertificate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "GenerateCertificate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGenerateCertificate prepares the GenerateCertificate request. +func (c DevicesClient) preparerForGenerateCertificate(ctx context.Context, id DataBoxEdgeDeviceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/generateCertificate", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGenerateCertificate handles the response to the GenerateCertificate request. The method always +// closes the http.Response Body. +func (c DevicesClient) responderForGenerateCertificate(resp *http.Response) (result GenerateCertificateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_get_autorest.go new file mode 100644 index 000000000000..d34b27527c8e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_get_autorest.go @@ -0,0 +1,68 @@ +package devices + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *DataBoxEdgeDevice +} + +// Get ... +func (c DevicesClient) Get(ctx context.Context, id DataBoxEdgeDeviceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DevicesClient) preparerForGet(ctx context.Context, id DataBoxEdgeDeviceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DevicesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_getextendedinformation_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_getextendedinformation_autorest.go new file mode 100644 index 000000000000..372a3c497720 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_getextendedinformation_autorest.go @@ -0,0 +1,69 @@ +package devices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetExtendedInformationOperationResponse struct { + HttpResponse *http.Response + Model *DataBoxEdgeDeviceExtendedInfo +} + +// GetExtendedInformation ... +func (c DevicesClient) GetExtendedInformation(ctx context.Context, id DataBoxEdgeDeviceId) (result GetExtendedInformationOperationResponse, err error) { + req, err := c.preparerForGetExtendedInformation(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "GetExtendedInformation", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "GetExtendedInformation", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetExtendedInformation(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "GetExtendedInformation", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetExtendedInformation prepares the GetExtendedInformation request. +func (c DevicesClient) preparerForGetExtendedInformation(ctx context.Context, id DataBoxEdgeDeviceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/getExtendedInformation", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetExtendedInformation handles the response to the GetExtendedInformation request. The method always +// closes the http.Response Body. +func (c DevicesClient) responderForGetExtendedInformation(resp *http.Response) (result GetExtendedInformationOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_getnetworksettings_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_getnetworksettings_autorest.go new file mode 100644 index 000000000000..24ca3c85f68b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_getnetworksettings_autorest.go @@ -0,0 +1,69 @@ +package devices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetNetworkSettingsOperationResponse struct { + HttpResponse *http.Response + Model *NetworkSettings +} + +// GetNetworkSettings ... +func (c DevicesClient) GetNetworkSettings(ctx context.Context, id DataBoxEdgeDeviceId) (result GetNetworkSettingsOperationResponse, err error) { + req, err := c.preparerForGetNetworkSettings(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "GetNetworkSettings", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "GetNetworkSettings", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetNetworkSettings(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "GetNetworkSettings", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetNetworkSettings prepares the GetNetworkSettings request. +func (c DevicesClient) preparerForGetNetworkSettings(ctx context.Context, id DataBoxEdgeDeviceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/networkSettings/default", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetNetworkSettings handles the response to the GetNetworkSettings request. The method always +// closes the http.Response Body. +func (c DevicesClient) responderForGetNetworkSettings(resp *http.Response) (result GetNetworkSettingsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_getupdatesummary_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_getupdatesummary_autorest.go new file mode 100644 index 000000000000..7dc56e38d2dd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_getupdatesummary_autorest.go @@ -0,0 +1,69 @@ +package devices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetUpdateSummaryOperationResponse struct { + HttpResponse *http.Response + Model *UpdateSummary +} + +// GetUpdateSummary ... +func (c DevicesClient) GetUpdateSummary(ctx context.Context, id DataBoxEdgeDeviceId) (result GetUpdateSummaryOperationResponse, err error) { + req, err := c.preparerForGetUpdateSummary(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "GetUpdateSummary", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "GetUpdateSummary", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetUpdateSummary(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "GetUpdateSummary", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetUpdateSummary prepares the GetUpdateSummary request. +func (c DevicesClient) preparerForGetUpdateSummary(ctx context.Context, id DataBoxEdgeDeviceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/updateSummary/default", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetUpdateSummary handles the response to the GetUpdateSummary request. The method always +// closes the http.Response Body. +func (c DevicesClient) responderForGetUpdateSummary(resp *http.Response) (result GetUpdateSummaryOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_installupdates_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_installupdates_autorest.go new file mode 100644 index 000000000000..fc7f017162eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_installupdates_autorest.go @@ -0,0 +1,78 @@ +package devices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstallUpdatesOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// InstallUpdates ... +func (c DevicesClient) InstallUpdates(ctx context.Context, id DataBoxEdgeDeviceId) (result InstallUpdatesOperationResponse, err error) { + req, err := c.preparerForInstallUpdates(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "InstallUpdates", nil, "Failure preparing request") + return + } + + result, err = c.senderForInstallUpdates(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "InstallUpdates", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// InstallUpdatesThenPoll performs InstallUpdates then polls until it's completed +func (c DevicesClient) InstallUpdatesThenPoll(ctx context.Context, id DataBoxEdgeDeviceId) error { + result, err := c.InstallUpdates(ctx, id) + if err != nil { + return fmt.Errorf("performing InstallUpdates: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after InstallUpdates: %+v", err) + } + + return nil +} + +// preparerForInstallUpdates prepares the InstallUpdates request. +func (c DevicesClient) preparerForInstallUpdates(ctx context.Context, id DataBoxEdgeDeviceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/installUpdates", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForInstallUpdates sends the InstallUpdates request. The method will close the +// http.Response Body if it receives an error. +func (c DevicesClient) senderForInstallUpdates(ctx context.Context, req *http.Request) (future InstallUpdatesOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..68d9bf2d387e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_listbyresourcegroup_autorest.go @@ -0,0 +1,216 @@ +package devices + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]DataBoxEdgeDevice + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []DataBoxEdgeDevice +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByResourceGroupOperationOptions struct { + Expand *string +} + +func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { + return ListByResourceGroupOperationOptions{} +} + +func (o ListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// ListByResourceGroup ... +func (c DevicesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c DevicesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c DevicesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c DevicesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []DataBoxEdgeDevice `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c DevicesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, DataBoxEdgeDeviceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DevicesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate DataBoxEdgeDeviceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]DataBoxEdgeDevice, 0) + + page, err := c.ListByResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_listbysubscription_autorest.go new file mode 100644 index 000000000000..2b8f3b5974d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_listbysubscription_autorest.go @@ -0,0 +1,216 @@ +package devices + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]DataBoxEdgeDevice + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []DataBoxEdgeDevice +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListBySubscriptionOperationOptions struct { + Expand *string +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// ListBySubscription ... +func (c DevicesClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c DevicesClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c DevicesClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c DevicesClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []DataBoxEdgeDevice `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c DevicesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, DataBoxEdgeDeviceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DevicesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions, predicate DataBoxEdgeDeviceOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]DataBoxEdgeDevice, 0) + + page, err := c.ListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_scanforupdates_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_scanforupdates_autorest.go new file mode 100644 index 000000000000..598d063669fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_scanforupdates_autorest.go @@ -0,0 +1,78 @@ +package devices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScanForUpdatesOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ScanForUpdates ... +func (c DevicesClient) ScanForUpdates(ctx context.Context, id DataBoxEdgeDeviceId) (result ScanForUpdatesOperationResponse, err error) { + req, err := c.preparerForScanForUpdates(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "ScanForUpdates", nil, "Failure preparing request") + return + } + + result, err = c.senderForScanForUpdates(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "ScanForUpdates", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ScanForUpdatesThenPoll performs ScanForUpdates then polls until it's completed +func (c DevicesClient) ScanForUpdatesThenPoll(ctx context.Context, id DataBoxEdgeDeviceId) error { + result, err := c.ScanForUpdates(ctx, id) + if err != nil { + return fmt.Errorf("performing ScanForUpdates: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ScanForUpdates: %+v", err) + } + + return nil +} + +// preparerForScanForUpdates prepares the ScanForUpdates request. +func (c DevicesClient) preparerForScanForUpdates(ctx context.Context, id DataBoxEdgeDeviceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/scanForUpdates", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForScanForUpdates sends the ScanForUpdates request. The method will close the +// http.Response Body if it receives an error. +func (c DevicesClient) senderForScanForUpdates(ctx context.Context, req *http.Request) (future ScanForUpdatesOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_update_autorest.go new file mode 100644 index 000000000000..aba7ee2d2976 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_update_autorest.go @@ -0,0 +1,69 @@ +package devices + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *DataBoxEdgeDevice +} + +// Update ... +func (c DevicesClient) Update(ctx context.Context, id DataBoxEdgeDeviceId, input DataBoxEdgeDevicePatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c DevicesClient) preparerForUpdate(ctx context.Context, id DataBoxEdgeDeviceId, input DataBoxEdgeDevicePatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c DevicesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_updateextendedinformation_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_updateextendedinformation_autorest.go new file mode 100644 index 000000000000..10d3b954e678 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_updateextendedinformation_autorest.go @@ -0,0 +1,70 @@ +package devices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateExtendedInformationOperationResponse struct { + HttpResponse *http.Response + Model *DataBoxEdgeDeviceExtendedInfo +} + +// UpdateExtendedInformation ... +func (c DevicesClient) UpdateExtendedInformation(ctx context.Context, id DataBoxEdgeDeviceId, input DataBoxEdgeDeviceExtendedInfoPatch) (result UpdateExtendedInformationOperationResponse, err error) { + req, err := c.preparerForUpdateExtendedInformation(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "UpdateExtendedInformation", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "UpdateExtendedInformation", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdateExtendedInformation(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "UpdateExtendedInformation", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdateExtendedInformation prepares the UpdateExtendedInformation request. +func (c DevicesClient) preparerForUpdateExtendedInformation(ctx context.Context, id DataBoxEdgeDeviceId, input DataBoxEdgeDeviceExtendedInfoPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/updateExtendedInformation", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdateExtendedInformation handles the response to the UpdateExtendedInformation request. The method always +// closes the http.Response Body. +func (c DevicesClient) responderForUpdateExtendedInformation(resp *http.Response) (result UpdateExtendedInformationOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_uploadcertificate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_uploadcertificate_autorest.go new file mode 100644 index 000000000000..9bb8df890b0f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/method_uploadcertificate_autorest.go @@ -0,0 +1,70 @@ +package devices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UploadCertificateOperationResponse struct { + HttpResponse *http.Response + Model *UploadCertificateResponse +} + +// UploadCertificate ... +func (c DevicesClient) UploadCertificate(ctx context.Context, id DataBoxEdgeDeviceId, input UploadCertificateRequest) (result UploadCertificateOperationResponse, err error) { + req, err := c.preparerForUploadCertificate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "UploadCertificate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "UploadCertificate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUploadCertificate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "devices.DevicesClient", "UploadCertificate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUploadCertificate prepares the UploadCertificate request. +func (c DevicesClient) preparerForUploadCertificate(ctx context.Context, id DataBoxEdgeDeviceId, input UploadCertificateRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/uploadCertificate", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUploadCertificate handles the response to the UploadCertificate request. The method always +// closes the http.Response Body. +func (c DevicesClient) responderForUploadCertificate(resp *http.Response) (result UploadCertificateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_asymmetricencryptedsecret.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_asymmetricencryptedsecret.go new file mode 100644 index 000000000000..d1ec0525b0b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_asymmetricencryptedsecret.go @@ -0,0 +1,10 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AsymmetricEncryptedSecret struct { + EncryptionAlgorithm EncryptionAlgorithm `json:"encryptionAlgorithm"` + EncryptionCertThumbprint *string `json:"encryptionCertThumbprint,omitempty"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedevice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedevice.go new file mode 100644 index 000000000000..99a68326f8b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedevice.go @@ -0,0 +1,22 @@ +package devices + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataBoxEdgeDevice struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *ResourceIdentity `json:"identity,omitempty"` + Kind *DataBoxEdgeDeviceKind `json:"kind,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *DataBoxEdgeDeviceProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedeviceextendedinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedeviceextendedinfo.go new file mode 100644 index 000000000000..6c49a4b30ec3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedeviceextendedinfo.go @@ -0,0 +1,11 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataBoxEdgeDeviceExtendedInfo struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DataBoxEdgeDeviceExtendedInfoProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedeviceextendedinfopatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedeviceextendedinfopatch.go new file mode 100644 index 000000000000..2c17a01f3220 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedeviceextendedinfopatch.go @@ -0,0 +1,12 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataBoxEdgeDeviceExtendedInfoPatch struct { + ChannelIntegrityKeyName *string `json:"channelIntegrityKeyName,omitempty"` + ChannelIntegrityKeyVersion *string `json:"channelIntegrityKeyVersion,omitempty"` + ClientSecretStoreId *string `json:"clientSecretStoreId,omitempty"` + ClientSecretStoreUrl *string `json:"clientSecretStoreUrl,omitempty"` + SyncStatus *KeyVaultSyncStatus `json:"syncStatus,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedeviceextendedinfoproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedeviceextendedinfoproperties.go new file mode 100644 index 000000000000..44f775a0bb24 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedeviceextendedinfoproperties.go @@ -0,0 +1,16 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataBoxEdgeDeviceExtendedInfoProperties struct { + ChannelIntegrityKeyName *string `json:"channelIntegrityKeyName,omitempty"` + ChannelIntegrityKeyVersion *string `json:"channelIntegrityKeyVersion,omitempty"` + ClientSecretStoreId *string `json:"clientSecretStoreId,omitempty"` + ClientSecretStoreUrl *string `json:"clientSecretStoreUrl,omitempty"` + DeviceSecrets *DeviceSecrets `json:"deviceSecrets,omitempty"` + EncryptionKey *string `json:"encryptionKey,omitempty"` + EncryptionKeyThumbprint *string `json:"encryptionKeyThumbprint,omitempty"` + KeyVaultSyncStatus *KeyVaultSyncStatus `json:"keyVaultSyncStatus,omitempty"` + ResourceKey *string `json:"resourceKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedevicepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedevicepatch.go new file mode 100644 index 000000000000..c28e38455d14 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedevicepatch.go @@ -0,0 +1,10 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataBoxEdgeDevicePatch struct { + Identity *ResourceIdentity `json:"identity,omitempty"` + Properties *DataBoxEdgeDevicePropertiesPatch `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedeviceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedeviceproperties.go new file mode 100644 index 000000000000..34d90011d171 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedeviceproperties.go @@ -0,0 +1,23 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataBoxEdgeDeviceProperties struct { + ConfiguredRoleTypes *[]RoleTypes `json:"configuredRoleTypes,omitempty"` + Culture *string `json:"culture,omitempty"` + DataBoxEdgeDeviceStatus *DataBoxEdgeDeviceStatus `json:"dataBoxEdgeDeviceStatus,omitempty"` + Description *string `json:"description,omitempty"` + DeviceHcsVersion *string `json:"deviceHcsVersion,omitempty"` + DeviceLocalCapacity *int64 `json:"deviceLocalCapacity,omitempty"` + DeviceModel *string `json:"deviceModel,omitempty"` + DeviceSoftwareVersion *string `json:"deviceSoftwareVersion,omitempty"` + DeviceType *DeviceType `json:"deviceType,omitempty"` + EdgeProfile *EdgeProfile `json:"edgeProfile,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + ModelDescription *string `json:"modelDescription,omitempty"` + NodeCount *int64 `json:"nodeCount,omitempty"` + ResourceMoveDetails *ResourceMoveDetails `json:"resourceMoveDetails,omitempty"` + SerialNumber *string `json:"serialNumber,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedevicepropertiespatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedevicepropertiespatch.go new file mode 100644 index 000000000000..0a6ff9151c5e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_databoxedgedevicepropertiespatch.go @@ -0,0 +1,8 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataBoxEdgeDevicePropertiesPatch struct { + EdgeProfile *EdgeProfilePatch `json:"edgeProfile,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_devicesecrets.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_devicesecrets.go new file mode 100644 index 000000000000..fc73c4f745d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_devicesecrets.go @@ -0,0 +1,15 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeviceSecrets struct { + BmcDefaultUserPassword *Secret `json:"bmcDefaultUserPassword,omitempty"` + HcsDataVolumeBitLockerExternalKey *Secret `json:"hcsDataVolumeBitLockerExternalKey,omitempty"` + HcsInternalVolumeBitLockerExternalKey *Secret `json:"hcsInternalVolumeBitLockerExternalKey,omitempty"` + RotateKeyForDataVolumeBitlocker *Secret `json:"rotateKeyForDataVolumeBitlocker,omitempty"` + RotateKeysForSedDrivesSerialized *Secret `json:"rotateKeysForSedDrivesSerialized,omitempty"` + SedEncryptionExternalKey *Secret `json:"sedEncryptionExternalKey,omitempty"` + SedEncryptionExternalKeyId *Secret `json:"sedEncryptionExternalKeyId,omitempty"` + SystemVolumeBitLockerRecoveryKey *Secret `json:"systemVolumeBitLockerRecoveryKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_edgeprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_edgeprofile.go new file mode 100644 index 000000000000..792b2c13ab7f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_edgeprofile.go @@ -0,0 +1,8 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdgeProfile struct { + Subscription *EdgeProfileSubscription `json:"subscription,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_edgeprofilepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_edgeprofilepatch.go new file mode 100644 index 000000000000..f32376df4cf3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_edgeprofilepatch.go @@ -0,0 +1,8 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdgeProfilePatch struct { + Subscription *EdgeProfileSubscriptionPatch `json:"subscription,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_edgeprofilesubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_edgeprofilesubscription.go new file mode 100644 index 000000000000..a474ef8ec365 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_edgeprofilesubscription.go @@ -0,0 +1,13 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdgeProfileSubscription struct { + Id *string `json:"id,omitempty"` + Properties *SubscriptionProperties `json:"properties,omitempty"` + RegistrationDate *string `json:"registrationDate,omitempty"` + RegistrationId *string `json:"registrationId,omitempty"` + State *SubscriptionState `json:"state,omitempty"` + SubscriptionId *string `json:"subscriptionId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_edgeprofilesubscriptionpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_edgeprofilesubscriptionpatch.go new file mode 100644 index 000000000000..27ef0dbe3fd1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_edgeprofilesubscriptionpatch.go @@ -0,0 +1,8 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdgeProfileSubscriptionPatch struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_generatecertresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_generatecertresponse.go new file mode 100644 index 000000000000..b35f03fef404 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_generatecertresponse.go @@ -0,0 +1,10 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GenerateCertResponse struct { + ExpiryTimeInUTC *string `json:"expiryTimeInUTC,omitempty"` + PrivateKey *string `json:"privateKey,omitempty"` + PublicKey *string `json:"publicKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_ipv4config.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_ipv4config.go new file mode 100644 index 000000000000..6b0bb05e7ea2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_ipv4config.go @@ -0,0 +1,10 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IPv4Config struct { + Gateway *string `json:"gateway,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + Subnet *string `json:"subnet,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_ipv6config.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_ipv6config.go new file mode 100644 index 000000000000..990814d1599c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_ipv6config.go @@ -0,0 +1,10 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IPv6Config struct { + Gateway *string `json:"gateway,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + PrefixLength *int64 `json:"prefixLength,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_networkadapter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_networkadapter.go new file mode 100644 index 000000000000..2c7ac403d8cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_networkadapter.go @@ -0,0 +1,22 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkAdapter struct { + AdapterId *string `json:"adapterId,omitempty"` + AdapterPosition *NetworkAdapterPosition `json:"adapterPosition,omitempty"` + DhcpStatus *NetworkAdapterDHCPStatus `json:"dhcpStatus,omitempty"` + DnsServers *[]string `json:"dnsServers,omitempty"` + IPv4Configuration *IPv4Config `json:"ipv4Configuration,omitempty"` + IPv6Configuration *IPv6Config `json:"ipv6Configuration,omitempty"` + IPv6LinkLocalAddress *string `json:"ipv6LinkLocalAddress,omitempty"` + Index *int64 `json:"index,omitempty"` + Label *string `json:"label,omitempty"` + LinkSpeed *int64 `json:"linkSpeed,omitempty"` + MacAddress *string `json:"macAddress,omitempty"` + NetworkAdapterName *string `json:"networkAdapterName,omitempty"` + NodeId *string `json:"nodeId,omitempty"` + RdmaStatus *NetworkAdapterRDMAStatus `json:"rdmaStatus,omitempty"` + Status *NetworkAdapterStatus `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_networkadapterposition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_networkadapterposition.go new file mode 100644 index 000000000000..4be1ed65b706 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_networkadapterposition.go @@ -0,0 +1,9 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkAdapterPosition struct { + NetworkGroup *NetworkGroup `json:"networkGroup,omitempty"` + Port *int64 `json:"port,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_networksettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_networksettings.go new file mode 100644 index 000000000000..b0beabbe36de --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_networksettings.go @@ -0,0 +1,11 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkSettings struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *NetworkSettingsProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_networksettingsproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_networksettingsproperties.go new file mode 100644 index 000000000000..3f9a67bd49cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_networksettingsproperties.go @@ -0,0 +1,8 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkSettingsProperties struct { + NetworkAdapters *[]NetworkAdapter `json:"networkAdapters,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_rawcertificatedata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_rawcertificatedata.go new file mode 100644 index 000000000000..60057de1e3a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_rawcertificatedata.go @@ -0,0 +1,9 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RawCertificateData struct { + AuthenticationType *AuthenticationType `json:"authenticationType,omitempty"` + Certificate string `json:"certificate"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_resourceidentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_resourceidentity.go new file mode 100644 index 000000000000..370288e28363 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_resourceidentity.go @@ -0,0 +1,10 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceIdentity struct { + PrincipalId *string `json:"principalId,omitempty"` + TenantId *string `json:"tenantId,omitempty"` + Type *MsiIdentityType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_resourcemovedetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_resourcemovedetails.go new file mode 100644 index 000000000000..9b55ef6e42b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_resourcemovedetails.go @@ -0,0 +1,27 @@ +package devices + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceMoveDetails struct { + OperationInProgress *ResourceMoveStatus `json:"operationInProgress,omitempty"` + OperationInProgressLockTimeoutInUTC *string `json:"operationInProgressLockTimeoutInUTC,omitempty"` +} + +func (o *ResourceMoveDetails) GetOperationInProgressLockTimeoutInUTCAsTime() (*time.Time, error) { + if o.OperationInProgressLockTimeoutInUTC == nil { + return nil, nil + } + return dates.ParseAsFormat(o.OperationInProgressLockTimeoutInUTC, "2006-01-02T15:04:05Z07:00") +} + +func (o *ResourceMoveDetails) SetOperationInProgressLockTimeoutInUTCAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.OperationInProgressLockTimeoutInUTC = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_secret.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_secret.go new file mode 100644 index 000000000000..236b469ccac7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_secret.go @@ -0,0 +1,9 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Secret struct { + EncryptedSecret *AsymmetricEncryptedSecret `json:"encryptedSecret,omitempty"` + KeyVaultId *string `json:"keyVaultId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_securitysettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_securitysettings.go new file mode 100644 index 000000000000..905d207dc472 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_securitysettings.go @@ -0,0 +1,11 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecuritySettings struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties SecuritySettingsProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_securitysettingsproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_securitysettingsproperties.go new file mode 100644 index 000000000000..928df627bfa6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_securitysettingsproperties.go @@ -0,0 +1,8 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecuritySettingsProperties struct { + DeviceAdminPassword AsymmetricEncryptedSecret `json:"deviceAdminPassword"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_sku.go new file mode 100644 index 000000000000..a463a6ccdd85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_sku.go @@ -0,0 +1,9 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name *SkuName `json:"name,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_subscriptionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_subscriptionproperties.go new file mode 100644 index 000000000000..b0509965ae86 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_subscriptionproperties.go @@ -0,0 +1,12 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionProperties struct { + LocationPlacementId *string `json:"locationPlacementId,omitempty"` + QuotaId *string `json:"quotaId,omitempty"` + RegisteredFeatures *[]SubscriptionRegisteredFeatures `json:"registeredFeatures,omitempty"` + SerializedDetails *string `json:"serializedDetails,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_subscriptionregisteredfeatures.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_subscriptionregisteredfeatures.go new file mode 100644 index 000000000000..40309fd9a2c5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_subscriptionregisteredfeatures.go @@ -0,0 +1,9 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionRegisteredFeatures struct { + Name *string `json:"name,omitempty"` + State *string `json:"state,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_updatesummary.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_updatesummary.go new file mode 100644 index 000000000000..9b4494c340a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_updatesummary.go @@ -0,0 +1,11 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateSummary struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *UpdateSummaryProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_updatesummaryproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_updatesummaryproperties.go new file mode 100644 index 000000000000..a58bcefe7ffc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_updatesummaryproperties.go @@ -0,0 +1,102 @@ +package devices + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateSummaryProperties struct { + DeviceLastScannedDateTime *string `json:"deviceLastScannedDateTime,omitempty"` + DeviceVersionNumber *string `json:"deviceVersionNumber,omitempty"` + FriendlyDeviceVersionName *string `json:"friendlyDeviceVersionName,omitempty"` + InProgressDownloadJobId *string `json:"inProgressDownloadJobId,omitempty"` + InProgressDownloadJobStartedDateTime *string `json:"inProgressDownloadJobStartedDateTime,omitempty"` + InProgressInstallJobId *string `json:"inProgressInstallJobId,omitempty"` + InProgressInstallJobStartedDateTime *string `json:"inProgressInstallJobStartedDateTime,omitempty"` + LastCompletedDownloadJobDateTime *string `json:"lastCompletedDownloadJobDateTime,omitempty"` + LastCompletedInstallJobDateTime *string `json:"lastCompletedInstallJobDateTime,omitempty"` + LastCompletedScanJobDateTime *string `json:"lastCompletedScanJobDateTime,omitempty"` + OngoingUpdateOperation *UpdateOperation `json:"ongoingUpdateOperation,omitempty"` + RebootBehavior *InstallRebootBehavior `json:"rebootBehavior,omitempty"` + TotalNumberOfUpdatesAvailable *int64 `json:"totalNumberOfUpdatesAvailable,omitempty"` + TotalNumberOfUpdatesPendingDownload *int64 `json:"totalNumberOfUpdatesPendingDownload,omitempty"` + TotalNumberOfUpdatesPendingInstall *int64 `json:"totalNumberOfUpdatesPendingInstall,omitempty"` + TotalUpdateSizeInBytes *float64 `json:"totalUpdateSizeInBytes,omitempty"` + UpdateTitles *[]string `json:"updateTitles,omitempty"` +} + +func (o *UpdateSummaryProperties) GetDeviceLastScannedDateTimeAsTime() (*time.Time, error) { + if o.DeviceLastScannedDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.DeviceLastScannedDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpdateSummaryProperties) SetDeviceLastScannedDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.DeviceLastScannedDateTime = &formatted +} + +func (o *UpdateSummaryProperties) GetInProgressDownloadJobStartedDateTimeAsTime() (*time.Time, error) { + if o.InProgressDownloadJobStartedDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.InProgressDownloadJobStartedDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpdateSummaryProperties) SetInProgressDownloadJobStartedDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.InProgressDownloadJobStartedDateTime = &formatted +} + +func (o *UpdateSummaryProperties) GetInProgressInstallJobStartedDateTimeAsTime() (*time.Time, error) { + if o.InProgressInstallJobStartedDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.InProgressInstallJobStartedDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpdateSummaryProperties) SetInProgressInstallJobStartedDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.InProgressInstallJobStartedDateTime = &formatted +} + +func (o *UpdateSummaryProperties) GetLastCompletedDownloadJobDateTimeAsTime() (*time.Time, error) { + if o.LastCompletedDownloadJobDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastCompletedDownloadJobDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpdateSummaryProperties) SetLastCompletedDownloadJobDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastCompletedDownloadJobDateTime = &formatted +} + +func (o *UpdateSummaryProperties) GetLastCompletedInstallJobDateTimeAsTime() (*time.Time, error) { + if o.LastCompletedInstallJobDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastCompletedInstallJobDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpdateSummaryProperties) SetLastCompletedInstallJobDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastCompletedInstallJobDateTime = &formatted +} + +func (o *UpdateSummaryProperties) GetLastCompletedScanJobDateTimeAsTime() (*time.Time, error) { + if o.LastCompletedScanJobDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastCompletedScanJobDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpdateSummaryProperties) SetLastCompletedScanJobDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastCompletedScanJobDateTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_uploadcertificaterequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_uploadcertificaterequest.go new file mode 100644 index 000000000000..8d691dff98d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_uploadcertificaterequest.go @@ -0,0 +1,8 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UploadCertificateRequest struct { + Properties RawCertificateData `json:"properties"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_uploadcertificateresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_uploadcertificateresponse.go new file mode 100644 index 000000000000..1b1155a1e4b4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/model_uploadcertificateresponse.go @@ -0,0 +1,15 @@ +package devices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UploadCertificateResponse struct { + AadAudience *string `json:"aadAudience,omitempty"` + AadAuthority *string `json:"aadAuthority,omitempty"` + AadTenantId *string `json:"aadTenantId,omitempty"` + AuthType *AuthenticationType `json:"authType,omitempty"` + AzureManagementEndpointAudience *string `json:"azureManagementEndpointAudience,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` + ServicePrincipalClientId *string `json:"servicePrincipalClientId,omitempty"` + ServicePrincipalObjectId *string `json:"servicePrincipalObjectId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/predicates.go new file mode 100644 index 000000000000..22a79ea9e36c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/predicates.go @@ -0,0 +1,34 @@ +package devices + +type DataBoxEdgeDeviceOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p DataBoxEdgeDeviceOperationPredicate) Matches(input DataBoxEdgeDevice) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/version.go new file mode 100644 index 000000000000..d27ea7cc30db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices/version.go @@ -0,0 +1,12 @@ +package devices + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/devices/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/accessconnector/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/accessconnector/README.md index 5c5ee0dbbfd5..d1b7a697d4cc 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/accessconnector/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/accessconnector/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "connectorValue") +id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accessConnectorValue") payload := accessconnector.AccessConnector{ // ... @@ -41,7 +41,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "connectorValue") +id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accessConnectorValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "connectorValue") +id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accessConnectorValue") read, err := client.Get(ctx, id) if err != nil { @@ -103,7 +103,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "connectorValue") +id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accessConnectorValue") payload := accessconnector.AccessConnectorUpdate{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/accessconnector/id_accessconnector.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/accessconnector/id_accessconnector.go index 9f2375851465..e1aa81865e4e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/accessconnector/id_accessconnector.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/accessconnector/id_accessconnector.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = AccessConnectorId{} // AccessConnectorId is a struct representing the Resource ID for a Access Connector type AccessConnectorId struct { - SubscriptionId string - ResourceGroupName string - ConnectorName string + SubscriptionId string + ResourceGroupName string + AccessConnectorName string } // NewAccessConnectorID returns a new AccessConnectorId struct -func NewAccessConnectorID(subscriptionId string, resourceGroupName string, connectorName string) AccessConnectorId { +func NewAccessConnectorID(subscriptionId string, resourceGroupName string, accessConnectorName string) AccessConnectorId { return AccessConnectorId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ConnectorName: connectorName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccessConnectorName: accessConnectorName, } } @@ -44,8 +44,8 @@ func ParseAccessConnectorID(input string) (*AccessConnectorId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ConnectorName, ok = parsed.Parsed["connectorName"]; !ok { - return nil, fmt.Errorf("the segment 'connectorName' was not found in the resource id %q", input) + if id.AccessConnectorName, ok = parsed.Parsed["accessConnectorName"]; !ok { + return nil, fmt.Errorf("the segment 'accessConnectorName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseAccessConnectorIDInsensitively(input string) (*AccessConnectorId, erro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ConnectorName, ok = parsed.Parsed["connectorName"]; !ok { - return nil, fmt.Errorf("the segment 'connectorName' was not found in the resource id %q", input) + if id.AccessConnectorName, ok = parsed.Parsed["accessConnectorName"]; !ok { + return nil, fmt.Errorf("the segment 'accessConnectorName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateAccessConnectorID(input interface{}, key string) (warnings []string // ID returns the formatted Access Connector ID func (id AccessConnectorId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/accessConnectors/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ConnectorName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccessConnectorName) } // Segments returns a slice of Resource ID Segments which comprise this Access Connector ID @@ -109,7 +109,7 @@ func (id AccessConnectorId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDatabricks", "Microsoft.Databricks", "Microsoft.Databricks"), resourceids.StaticSegment("staticAccessConnectors", "accessConnectors", "accessConnectors"), - resourceids.UserSpecifiedSegment("connectorName", "connectorValue"), + resourceids.UserSpecifiedSegment("accessConnectorName", "accessConnectorValue"), } } @@ -118,7 +118,7 @@ func (id AccessConnectorId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Connector Name: %q", id.ConnectorName), + fmt.Sprintf("Access Connector Name: %q", id.AccessConnectorName), } return fmt.Sprintf("Access Connector (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/README.md new file mode 100644 index 000000000000..eefc0fa3be54 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces` Documentation + +The `workspaces` SDK allows for interaction with the Azure Resource Manager Service `databricks` (API Version `2023-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces" +``` + + +### Client Initialization + +```go +client := workspaces.NewWorkspacesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `WorkspacesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +payload := workspaces.Workspace{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `WorkspacesClient.Delete` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `WorkspacesClient.Get` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := workspaces.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WorkspacesClient.ListBySubscription` + +```go +ctx := context.TODO() +id := workspaces.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WorkspacesClient.Update` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +payload := workspaces.WorkspaceUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/client.go new file mode 100644 index 000000000000..02d022fa85e3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/client.go @@ -0,0 +1,18 @@ +package workspaces + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacesClient struct { + Client autorest.Client + baseUri string +} + +func NewWorkspacesClientWithBaseURI(endpoint string) WorkspacesClient { + return WorkspacesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/constants.go new file mode 100644 index 000000000000..130ad6fbf3d5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/constants.go @@ -0,0 +1,275 @@ +package workspaces + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomParameterType string + +const ( + CustomParameterTypeBool CustomParameterType = "Bool" + CustomParameterTypeObject CustomParameterType = "Object" + CustomParameterTypeString CustomParameterType = "String" +) + +func PossibleValuesForCustomParameterType() []string { + return []string{ + string(CustomParameterTypeBool), + string(CustomParameterTypeObject), + string(CustomParameterTypeString), + } +} + +func parseCustomParameterType(input string) (*CustomParameterType, error) { + vals := map[string]CustomParameterType{ + "bool": CustomParameterTypeBool, + "object": CustomParameterTypeObject, + "string": CustomParameterTypeString, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CustomParameterType(input) + return &out, nil +} + +type EncryptionKeySource string + +const ( + EncryptionKeySourceMicrosoftPointKeyvault EncryptionKeySource = "Microsoft.Keyvault" +) + +func PossibleValuesForEncryptionKeySource() []string { + return []string{ + string(EncryptionKeySourceMicrosoftPointKeyvault), + } +} + +func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { + vals := map[string]EncryptionKeySource{ + "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyvault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EncryptionKeySource(input) + return &out, nil +} + +type KeySource string + +const ( + KeySourceDefault KeySource = "Default" + KeySourceMicrosoftPointKeyvault KeySource = "Microsoft.Keyvault" +) + +func PossibleValuesForKeySource() []string { + return []string{ + string(KeySourceDefault), + string(KeySourceMicrosoftPointKeyvault), + } +} + +func parseKeySource(input string) (*KeySource, error) { + vals := map[string]KeySource{ + "default": KeySourceDefault, + "microsoft.keyvault": KeySourceMicrosoftPointKeyvault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeySource(input) + return &out, nil +} + +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" + PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + string(PrivateEndpointConnectionProvisioningStateUpdating), + } +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + "updating": PrivateEndpointConnectionProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStatus string + +const ( + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkServiceConnectionStatus() []string { + return []string{ + string(PrivateLinkServiceConnectionStatusApproved), + string(PrivateLinkServiceConnectionStatusDisconnected), + string(PrivateLinkServiceConnectionStatusPending), + string(PrivateLinkServiceConnectionStatusRejected), + } +} + +func parsePrivateLinkServiceConnectionStatus(input string) (*PrivateLinkServiceConnectionStatus, error) { + vals := map[string]PrivateLinkServiceConnectionStatus{ + "approved": PrivateLinkServiceConnectionStatusApproved, + "disconnected": PrivateLinkServiceConnectionStatusDisconnected, + "pending": PrivateLinkServiceConnectionStatusPending, + "rejected": PrivateLinkServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateReady ProvisioningState = "Ready" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateReady), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "created": ProvisioningStateCreated, + "creating": ProvisioningStateCreating, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "ready": ProvisioningStateReady, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} + +type RequiredNsgRules string + +const ( + RequiredNsgRulesAllRules RequiredNsgRules = "AllRules" + RequiredNsgRulesNoAzureDatabricksRules RequiredNsgRules = "NoAzureDatabricksRules" + RequiredNsgRulesNoAzureServiceRules RequiredNsgRules = "NoAzureServiceRules" +) + +func PossibleValuesForRequiredNsgRules() []string { + return []string{ + string(RequiredNsgRulesAllRules), + string(RequiredNsgRulesNoAzureDatabricksRules), + string(RequiredNsgRulesNoAzureServiceRules), + } +} + +func parseRequiredNsgRules(input string) (*RequiredNsgRules, error) { + vals := map[string]RequiredNsgRules{ + "allrules": RequiredNsgRulesAllRules, + "noazuredatabricksrules": RequiredNsgRulesNoAzureDatabricksRules, + "noazureservicerules": RequiredNsgRulesNoAzureServiceRules, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RequiredNsgRules(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/id_workspace.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/id_workspace.go new file mode 100644 index 000000000000..7225328c81aa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/id_workspace.go @@ -0,0 +1,124 @@ +package workspaces + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = WorkspaceId{} + +// WorkspaceId is a struct representing the Resource ID for a Workspace +type WorkspaceId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string +} + +// NewWorkspaceID returns a new WorkspaceId struct +func NewWorkspaceID(subscriptionId string, resourceGroupName string, workspaceName string) WorkspaceId { + return WorkspaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + } +} + +// ParseWorkspaceID parses 'input' into a WorkspaceId +func ParseWorkspaceID(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkspaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseWorkspaceIDInsensitively parses 'input' case-insensitively into a WorkspaceId +// note: this method should only be used for API response data and not user input +func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkspaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID +func ValidateWorkspaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workspace ID +func (id WorkspaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/workspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workspace ID +func (id WorkspaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDatabricks", "Microsoft.Databricks", "Microsoft.Databricks"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"), + } +} + +// String returns a human-readable description of this Workspace ID +func (id WorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + } + return fmt.Sprintf("Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_createorupdate_autorest.go new file mode 100644 index 000000000000..7e742b0f05f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c WorkspacesClient) CreateOrUpdate(ctx context.Context, id WorkspaceId, input Workspace) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c WorkspacesClient) CreateOrUpdateThenPoll(ctx context.Context, id WorkspaceId, input Workspace) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c WorkspacesClient) preparerForCreateOrUpdate(ctx context.Context, id WorkspaceId, input Workspace) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c WorkspacesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_delete_autorest.go new file mode 100644 index 000000000000..3475fce1278b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_delete_autorest.go @@ -0,0 +1,78 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c WorkspacesClient) Delete(ctx context.Context, id WorkspaceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c WorkspacesClient) DeleteThenPoll(ctx context.Context, id WorkspaceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c WorkspacesClient) preparerForDelete(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c WorkspacesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_get_autorest.go new file mode 100644 index 000000000000..c16924832e34 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_get_autorest.go @@ -0,0 +1,68 @@ +package workspaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Workspace +} + +// Get ... +func (c WorkspacesClient) Get(ctx context.Context, id WorkspaceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c WorkspacesClient) preparerForGet(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..d0a813176128 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Workspace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Workspace +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c WorkspacesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c WorkspacesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Databricks/workspaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c WorkspacesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Workspace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c WorkspacesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, WorkspaceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkspacesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate WorkspaceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Workspace, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_listbysubscription_autorest.go new file mode 100644 index 000000000000..418bad379f48 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Workspace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []Workspace +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c WorkspacesClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c WorkspacesClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Databricks/workspaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c WorkspacesClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Workspace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c WorkspacesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, WorkspaceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkspacesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate WorkspaceOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]Workspace, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_update_autorest.go new file mode 100644 index 000000000000..1bff4b670d16 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/method_update_autorest.go @@ -0,0 +1,79 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c WorkspacesClient) Update(ctx context.Context, id WorkspaceId, input WorkspaceUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c WorkspacesClient) UpdateThenPoll(ctx context.Context, id WorkspaceId, input WorkspaceUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c WorkspacesClient) preparerForUpdate(ctx context.Context, id WorkspaceId, input WorkspaceUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c WorkspacesClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_createdby.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_createdby.go new file mode 100644 index 000000000000..fa06a35a393b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_createdby.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreatedBy struct { + ApplicationId *string `json:"applicationId,omitempty"` + Oid *string `json:"oid,omitempty"` + Puid *string `json:"puid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_encryption.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_encryption.go new file mode 100644 index 000000000000..3d37fddd7e5f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_encryption.go @@ -0,0 +1,11 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Encryption struct { + KeyName *string `json:"KeyName,omitempty"` + KeySource *KeySource `json:"keySource,omitempty"` + Keyvaulturi *string `json:"keyvaulturi,omitempty"` + Keyversion *string `json:"keyversion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_encryptionentitiesdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_encryptionentitiesdefinition.go new file mode 100644 index 000000000000..df2cae1410b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_encryptionentitiesdefinition.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionEntitiesDefinition struct { + ManagedDisk *ManagedDiskEncryption `json:"managedDisk,omitempty"` + ManagedServices *EncryptionV2 `json:"managedServices,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_encryptionv2.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_encryptionv2.go new file mode 100644 index 000000000000..1569f86ef50e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_encryptionv2.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionV2 struct { + KeySource EncryptionKeySource `json:"keySource"` + KeyVaultProperties *EncryptionV2KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_encryptionv2keyvaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_encryptionv2keyvaultproperties.go new file mode 100644 index 000000000000..86adbd8c6a54 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_encryptionv2keyvaultproperties.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionV2KeyVaultProperties struct { + KeyName string `json:"keyName"` + KeyVaultUri string `json:"keyVaultUri"` + KeyVersion string `json:"keyVersion"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_manageddiskencryption.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_manageddiskencryption.go new file mode 100644 index 000000000000..0374f44bdc39 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_manageddiskencryption.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedDiskEncryption struct { + KeySource EncryptionKeySource `json:"keySource"` + KeyVaultProperties ManagedDiskEncryptionKeyVaultProperties `json:"keyVaultProperties"` + RotationToLatestKeyVersionEnabled *bool `json:"rotationToLatestKeyVersionEnabled,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_manageddiskencryptionkeyvaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_manageddiskencryptionkeyvaultproperties.go new file mode 100644 index 000000000000..a82d0ea2aa4c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_manageddiskencryptionkeyvaultproperties.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedDiskEncryptionKeyVaultProperties struct { + KeyName string `json:"keyName"` + KeyVaultUri string `json:"keyVaultUri"` + KeyVersion string `json:"keyVersion"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_managedidentityconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_managedidentityconfiguration.go new file mode 100644 index 000000000000..aeea7f937c85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_managedidentityconfiguration.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedIdentityConfiguration struct { + PrincipalId *string `json:"principalId,omitempty"` + TenantId *string `json:"tenantId,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_privateendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_privateendpoint.go new file mode 100644 index 000000000000..9f81ff8b836c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_privateendpoint.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_privateendpointconnection.go new file mode 100644 index 000000000000..aee2db4a4b3c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties PrivateEndpointConnectionProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_privateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_privateendpointconnectionproperties.go new file mode 100644 index 000000000000..f84ae62a2e00 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_privateendpointconnectionproperties.go @@ -0,0 +1,11 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + GroupIds *[]string `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_privatelinkserviceconnectionstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_privatelinkserviceconnectionstate.go new file mode 100644 index 000000000000..e56c0b779bd5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status PrivateLinkServiceConnectionStatus `json:"status"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_sku.go new file mode 100644 index 000000000000..e5316e27b309 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_sku.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name string `json:"name"` + Tier *string `json:"tier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspace.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspace.go new file mode 100644 index 000000000000..2a205ac19021 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspace.go @@ -0,0 +1,19 @@ +package workspaces + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Workspace struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties WorkspaceProperties `json:"properties"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspacecustombooleanparameter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspacecustombooleanparameter.go new file mode 100644 index 000000000000..a2e256bd2f0d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspacecustombooleanparameter.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceCustomBooleanParameter struct { + Type *CustomParameterType `json:"type,omitempty"` + Value bool `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspacecustomobjectparameter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspacecustomobjectparameter.go new file mode 100644 index 000000000000..85cfe0983914 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspacecustomobjectparameter.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceCustomObjectParameter struct { + Type *CustomParameterType `json:"type,omitempty"` + Value interface{} `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspacecustomparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspacecustomparameters.go new file mode 100644 index 000000000000..3c55d9c99e75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspacecustomparameters.go @@ -0,0 +1,23 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceCustomParameters struct { + AmlWorkspaceId *WorkspaceCustomStringParameter `json:"amlWorkspaceId,omitempty"` + CustomPrivateSubnetName *WorkspaceCustomStringParameter `json:"customPrivateSubnetName,omitempty"` + CustomPublicSubnetName *WorkspaceCustomStringParameter `json:"customPublicSubnetName,omitempty"` + CustomVirtualNetworkId *WorkspaceCustomStringParameter `json:"customVirtualNetworkId,omitempty"` + EnableNoPublicIP *WorkspaceCustomBooleanParameter `json:"enableNoPublicIp,omitempty"` + Encryption *WorkspaceEncryptionParameter `json:"encryption,omitempty"` + LoadBalancerBackendPoolName *WorkspaceCustomStringParameter `json:"loadBalancerBackendPoolName,omitempty"` + LoadBalancerId *WorkspaceCustomStringParameter `json:"loadBalancerId,omitempty"` + NatGatewayName *WorkspaceCustomStringParameter `json:"natGatewayName,omitempty"` + PrepareEncryption *WorkspaceCustomBooleanParameter `json:"prepareEncryption,omitempty"` + PublicIPName *WorkspaceCustomStringParameter `json:"publicIpName,omitempty"` + RequireInfrastructureEncryption *WorkspaceCustomBooleanParameter `json:"requireInfrastructureEncryption,omitempty"` + ResourceTags *WorkspaceCustomObjectParameter `json:"resourceTags,omitempty"` + StorageAccountName *WorkspaceCustomStringParameter `json:"storageAccountName,omitempty"` + StorageAccountSkuName *WorkspaceCustomStringParameter `json:"storageAccountSkuName,omitempty"` + VnetAddressPrefix *WorkspaceCustomStringParameter `json:"vnetAddressPrefix,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspacecustomstringparameter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspacecustomstringparameter.go new file mode 100644 index 000000000000..c983ffae968f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspacecustomstringparameter.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceCustomStringParameter struct { + Type *CustomParameterType `json:"type,omitempty"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspaceencryptionparameter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspaceencryptionparameter.go new file mode 100644 index 000000000000..551ca748c04c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspaceencryptionparameter.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceEncryptionParameter struct { + Type *CustomParameterType `json:"type,omitempty"` + Value *Encryption `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspaceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspaceproperties.go new file mode 100644 index 000000000000..f5241b4722f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspaceproperties.go @@ -0,0 +1,42 @@ +package workspaces + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceProperties struct { + Authorizations *[]WorkspaceProviderAuthorization `json:"authorizations,omitempty"` + CreatedBy *CreatedBy `json:"createdBy,omitempty"` + CreatedDateTime *string `json:"createdDateTime,omitempty"` + DiskEncryptionSetId *string `json:"diskEncryptionSetId,omitempty"` + Encryption *WorkspacePropertiesEncryption `json:"encryption,omitempty"` + ManagedDiskIdentity *ManagedIdentityConfiguration `json:"managedDiskIdentity,omitempty"` + ManagedResourceGroupId string `json:"managedResourceGroupId"` + Parameters *WorkspaceCustomParameters `json:"parameters,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + RequiredNsgRules *RequiredNsgRules `json:"requiredNsgRules,omitempty"` + StorageAccountIdentity *ManagedIdentityConfiguration `json:"storageAccountIdentity,omitempty"` + UiDefinitionUri *string `json:"uiDefinitionUri,omitempty"` + UpdatedBy *CreatedBy `json:"updatedBy,omitempty"` + WorkspaceId *string `json:"workspaceId,omitempty"` + WorkspaceUrl *string `json:"workspaceUrl,omitempty"` +} + +func (o *WorkspaceProperties) GetCreatedDateTimeAsTime() (*time.Time, error) { + if o.CreatedDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *WorkspaceProperties) SetCreatedDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedDateTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspacepropertiesencryption.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspacepropertiesencryption.go new file mode 100644 index 000000000000..ddb3625ee748 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspacepropertiesencryption.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacePropertiesEncryption struct { + Entities EncryptionEntitiesDefinition `json:"entities"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspaceproviderauthorization.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspaceproviderauthorization.go new file mode 100644 index 000000000000..98d6f732126c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspaceproviderauthorization.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceProviderAuthorization struct { + PrincipalId string `json:"principalId"` + RoleDefinitionId string `json:"roleDefinitionId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspaceupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspaceupdate.go new file mode 100644 index 000000000000..079a43eda11b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/model_workspaceupdate.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceUpdate struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/predicates.go new file mode 100644 index 000000000000..aed808b5b33d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/predicates.go @@ -0,0 +1,29 @@ +package workspaces + +type WorkspaceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p WorkspaceOperationPredicate) Matches(input Workspace) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/version.go new file mode 100644 index 000000000000..bff8e584cadf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces/version.go @@ -0,0 +1,12 @@ +package workspaces + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-02-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/workspaces/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/README.md new file mode 100644 index 000000000000..393c704ba32a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/README.md @@ -0,0 +1,58 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements` Documentation + +The `agreements` SDK allows for interaction with the Azure Resource Manager Service `datadog` (API Version `2021-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements" +``` + + +### Client Initialization + +```go +client := agreements.NewAgreementsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AgreementsClient.MarketplaceAgreementsCreateOrUpdate` + +```go +ctx := context.TODO() +id := agreements.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := agreements.DatadogAgreementResource{ + // ... +} + + +read, err := client.MarketplaceAgreementsCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AgreementsClient.MarketplaceAgreementsList` + +```go +ctx := context.TODO() +id := agreements.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.MarketplaceAgreementsList(ctx, id)` can be used to do batched pagination +items, err := client.MarketplaceAgreementsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/client.go new file mode 100644 index 000000000000..052391ce2574 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/client.go @@ -0,0 +1,18 @@ +package agreements + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AgreementsClient struct { + Client autorest.Client + baseUri string +} + +func NewAgreementsClientWithBaseURI(endpoint string) AgreementsClient { + return AgreementsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/method_marketplaceagreementscreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/method_marketplaceagreementscreateorupdate_autorest.go new file mode 100644 index 000000000000..927fbd62dd1b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/method_marketplaceagreementscreateorupdate_autorest.go @@ -0,0 +1,71 @@ +package agreements + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MarketplaceAgreementsCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *DatadogAgreementResource +} + +// MarketplaceAgreementsCreateOrUpdate ... +func (c AgreementsClient) MarketplaceAgreementsCreateOrUpdate(ctx context.Context, id commonids.SubscriptionId, input DatadogAgreementResource) (result MarketplaceAgreementsCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForMarketplaceAgreementsCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "agreements.AgreementsClient", "MarketplaceAgreementsCreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "agreements.AgreementsClient", "MarketplaceAgreementsCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForMarketplaceAgreementsCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "agreements.AgreementsClient", "MarketplaceAgreementsCreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForMarketplaceAgreementsCreateOrUpdate prepares the MarketplaceAgreementsCreateOrUpdate request. +func (c AgreementsClient) preparerForMarketplaceAgreementsCreateOrUpdate(ctx context.Context, id commonids.SubscriptionId, input DatadogAgreementResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Datadog/agreements/default", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForMarketplaceAgreementsCreateOrUpdate handles the response to the MarketplaceAgreementsCreateOrUpdate request. The method always +// closes the http.Response Body. +func (c AgreementsClient) responderForMarketplaceAgreementsCreateOrUpdate(resp *http.Response) (result MarketplaceAgreementsCreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/method_marketplaceagreementslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/method_marketplaceagreementslist_autorest.go new file mode 100644 index 000000000000..7d51a4157b43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/method_marketplaceagreementslist_autorest.go @@ -0,0 +1,187 @@ +package agreements + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MarketplaceAgreementsListOperationResponse struct { + HttpResponse *http.Response + Model *[]DatadogAgreementResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (MarketplaceAgreementsListOperationResponse, error) +} + +type MarketplaceAgreementsListCompleteResult struct { + Items []DatadogAgreementResource +} + +func (r MarketplaceAgreementsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r MarketplaceAgreementsListOperationResponse) LoadMore(ctx context.Context) (resp MarketplaceAgreementsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// MarketplaceAgreementsList ... +func (c AgreementsClient) MarketplaceAgreementsList(ctx context.Context, id commonids.SubscriptionId) (resp MarketplaceAgreementsListOperationResponse, err error) { + req, err := c.preparerForMarketplaceAgreementsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "agreements.AgreementsClient", "MarketplaceAgreementsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "agreements.AgreementsClient", "MarketplaceAgreementsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForMarketplaceAgreementsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "agreements.AgreementsClient", "MarketplaceAgreementsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForMarketplaceAgreementsList prepares the MarketplaceAgreementsList request. +func (c AgreementsClient) preparerForMarketplaceAgreementsList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Datadog/agreements", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForMarketplaceAgreementsListWithNextLink prepares the MarketplaceAgreementsList request with the given nextLink token. +func (c AgreementsClient) preparerForMarketplaceAgreementsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForMarketplaceAgreementsList handles the response to the MarketplaceAgreementsList request. The method always +// closes the http.Response Body. +func (c AgreementsClient) responderForMarketplaceAgreementsList(resp *http.Response) (result MarketplaceAgreementsListOperationResponse, err error) { + type page struct { + Values []DatadogAgreementResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result MarketplaceAgreementsListOperationResponse, err error) { + req, err := c.preparerForMarketplaceAgreementsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "agreements.AgreementsClient", "MarketplaceAgreementsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "agreements.AgreementsClient", "MarketplaceAgreementsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForMarketplaceAgreementsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "agreements.AgreementsClient", "MarketplaceAgreementsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// MarketplaceAgreementsListComplete retrieves all of the results into a single object +func (c AgreementsClient) MarketplaceAgreementsListComplete(ctx context.Context, id commonids.SubscriptionId) (MarketplaceAgreementsListCompleteResult, error) { + return c.MarketplaceAgreementsListCompleteMatchingPredicate(ctx, id, DatadogAgreementResourceOperationPredicate{}) +} + +// MarketplaceAgreementsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AgreementsClient) MarketplaceAgreementsListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DatadogAgreementResourceOperationPredicate) (resp MarketplaceAgreementsListCompleteResult, err error) { + items := make([]DatadogAgreementResource, 0) + + page, err := c.MarketplaceAgreementsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := MarketplaceAgreementsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/model_datadogagreementproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/model_datadogagreementproperties.go new file mode 100644 index 000000000000..d4a9321c3a2a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/model_datadogagreementproperties.go @@ -0,0 +1,33 @@ +package agreements + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatadogAgreementProperties struct { + Accepted *bool `json:"accepted,omitempty"` + LicenseTextLink *string `json:"licenseTextLink,omitempty"` + Plan *string `json:"plan,omitempty"` + PrivacyPolicyLink *string `json:"privacyPolicyLink,omitempty"` + Product *string `json:"product,omitempty"` + Publisher *string `json:"publisher,omitempty"` + RetrieveDatetime *string `json:"retrieveDatetime,omitempty"` + Signature *string `json:"signature,omitempty"` +} + +func (o *DatadogAgreementProperties) GetRetrieveDatetimeAsTime() (*time.Time, error) { + if o.RetrieveDatetime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.RetrieveDatetime, "2006-01-02T15:04:05Z07:00") +} + +func (o *DatadogAgreementProperties) SetRetrieveDatetimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.RetrieveDatetime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/model_datadogagreementresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/model_datadogagreementresource.go new file mode 100644 index 000000000000..955594e4a90c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/model_datadogagreementresource.go @@ -0,0 +1,16 @@ +package agreements + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatadogAgreementResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DatadogAgreementProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/predicates.go new file mode 100644 index 000000000000..2fe9da04ae3f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/predicates.go @@ -0,0 +1,24 @@ +package agreements + +type DatadogAgreementResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DatadogAgreementResourceOperationPredicate) Matches(input DatadogAgreementResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/version.go new file mode 100644 index 000000000000..5fa9fe63de10 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements/version.go @@ -0,0 +1,12 @@ +package agreements + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/agreements/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/README.md new file mode 100644 index 000000000000..ff9ff00d393a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/README.md @@ -0,0 +1,74 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey` Documentation + +The `apikey` SDK allows for interaction with the Azure Resource Manager Service `datadog` (API Version `2021-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey" +``` + + +### Client Initialization + +```go +client := apikey.NewApiKeyClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApiKeyClient.MonitorsGetDefaultKey` + +```go +ctx := context.TODO() +id := apikey.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +read, err := client.MonitorsGetDefaultKey(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApiKeyClient.MonitorsListApiKeys` + +```go +ctx := context.TODO() +id := apikey.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +// alternatively `client.MonitorsListApiKeys(ctx, id)` can be used to do batched pagination +items, err := client.MonitorsListApiKeysComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ApiKeyClient.MonitorsSetDefaultKey` + +```go +ctx := context.TODO() +id := apikey.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +payload := apikey.DatadogApiKey{ + // ... +} + + +read, err := client.MonitorsSetDefaultKey(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/client.go new file mode 100644 index 000000000000..09152e050dbb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/client.go @@ -0,0 +1,18 @@ +package apikey + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiKeyClient struct { + Client autorest.Client + baseUri string +} + +func NewApiKeyClientWithBaseURI(endpoint string) ApiKeyClient { + return ApiKeyClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/id_monitor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/id_monitor.go new file mode 100644 index 000000000000..82bc40b8a3a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/id_monitor.go @@ -0,0 +1,124 @@ +package apikey + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = MonitorId{} + +// MonitorId is a struct representing the Resource ID for a Monitor +type MonitorId struct { + SubscriptionId string + ResourceGroupName string + MonitorName string +} + +// NewMonitorID returns a new MonitorId struct +func NewMonitorID(subscriptionId string, resourceGroupName string, monitorName string) MonitorId { + return MonitorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MonitorName: monitorName, + } +} + +// ParseMonitorID parses 'input' into a MonitorId +func ParseMonitorID(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseMonitorIDInsensitively parses 'input' case-insensitively into a MonitorId +// note: this method should only be used for API response data and not user input +func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateMonitorID checks that 'input' can be parsed as a Monitor ID +func ValidateMonitorID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseMonitorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Monitor ID +func (id MonitorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Datadog/monitors/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Monitor ID +func (id MonitorId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDatadog", "Microsoft.Datadog", "Microsoft.Datadog"), + resourceids.StaticSegment("staticMonitors", "monitors", "monitors"), + resourceids.UserSpecifiedSegment("monitorName", "monitorValue"), + } +} + +// String returns a human-readable description of this Monitor ID +func (id MonitorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Monitor Name: %q", id.MonitorName), + } + return fmt.Sprintf("Monitor (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/method_monitorsgetdefaultkey_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/method_monitorsgetdefaultkey_autorest.go new file mode 100644 index 000000000000..7620f301d09f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/method_monitorsgetdefaultkey_autorest.go @@ -0,0 +1,69 @@ +package apikey + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsGetDefaultKeyOperationResponse struct { + HttpResponse *http.Response + Model *DatadogApiKey +} + +// MonitorsGetDefaultKey ... +func (c ApiKeyClient) MonitorsGetDefaultKey(ctx context.Context, id MonitorId) (result MonitorsGetDefaultKeyOperationResponse, err error) { + req, err := c.preparerForMonitorsGetDefaultKey(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "apikey.ApiKeyClient", "MonitorsGetDefaultKey", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "apikey.ApiKeyClient", "MonitorsGetDefaultKey", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForMonitorsGetDefaultKey(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "apikey.ApiKeyClient", "MonitorsGetDefaultKey", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForMonitorsGetDefaultKey prepares the MonitorsGetDefaultKey request. +func (c ApiKeyClient) preparerForMonitorsGetDefaultKey(ctx context.Context, id MonitorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/getDefaultKey", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForMonitorsGetDefaultKey handles the response to the MonitorsGetDefaultKey request. The method always +// closes the http.Response Body. +func (c ApiKeyClient) responderForMonitorsGetDefaultKey(resp *http.Response) (result MonitorsGetDefaultKeyOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/method_monitorslistapikeys_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/method_monitorslistapikeys_autorest.go new file mode 100644 index 000000000000..637d71c36e53 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/method_monitorslistapikeys_autorest.go @@ -0,0 +1,186 @@ +package apikey + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsListApiKeysOperationResponse struct { + HttpResponse *http.Response + Model *[]DatadogApiKey + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (MonitorsListApiKeysOperationResponse, error) +} + +type MonitorsListApiKeysCompleteResult struct { + Items []DatadogApiKey +} + +func (r MonitorsListApiKeysOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r MonitorsListApiKeysOperationResponse) LoadMore(ctx context.Context) (resp MonitorsListApiKeysOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// MonitorsListApiKeys ... +func (c ApiKeyClient) MonitorsListApiKeys(ctx context.Context, id MonitorId) (resp MonitorsListApiKeysOperationResponse, err error) { + req, err := c.preparerForMonitorsListApiKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "apikey.ApiKeyClient", "MonitorsListApiKeys", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "apikey.ApiKeyClient", "MonitorsListApiKeys", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForMonitorsListApiKeys(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "apikey.ApiKeyClient", "MonitorsListApiKeys", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForMonitorsListApiKeys prepares the MonitorsListApiKeys request. +func (c ApiKeyClient) preparerForMonitorsListApiKeys(ctx context.Context, id MonitorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listApiKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForMonitorsListApiKeysWithNextLink prepares the MonitorsListApiKeys request with the given nextLink token. +func (c ApiKeyClient) preparerForMonitorsListApiKeysWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForMonitorsListApiKeys handles the response to the MonitorsListApiKeys request. The method always +// closes the http.Response Body. +func (c ApiKeyClient) responderForMonitorsListApiKeys(resp *http.Response) (result MonitorsListApiKeysOperationResponse, err error) { + type page struct { + Values []DatadogApiKey `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result MonitorsListApiKeysOperationResponse, err error) { + req, err := c.preparerForMonitorsListApiKeysWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "apikey.ApiKeyClient", "MonitorsListApiKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "apikey.ApiKeyClient", "MonitorsListApiKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForMonitorsListApiKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "apikey.ApiKeyClient", "MonitorsListApiKeys", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// MonitorsListApiKeysComplete retrieves all of the results into a single object +func (c ApiKeyClient) MonitorsListApiKeysComplete(ctx context.Context, id MonitorId) (MonitorsListApiKeysCompleteResult, error) { + return c.MonitorsListApiKeysCompleteMatchingPredicate(ctx, id, DatadogApiKeyOperationPredicate{}) +} + +// MonitorsListApiKeysCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ApiKeyClient) MonitorsListApiKeysCompleteMatchingPredicate(ctx context.Context, id MonitorId, predicate DatadogApiKeyOperationPredicate) (resp MonitorsListApiKeysCompleteResult, err error) { + items := make([]DatadogApiKey, 0) + + page, err := c.MonitorsListApiKeys(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := MonitorsListApiKeysCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/method_monitorssetdefaultkey_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/method_monitorssetdefaultkey_autorest.go new file mode 100644 index 000000000000..8c95d009f1b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/method_monitorssetdefaultkey_autorest.go @@ -0,0 +1,68 @@ +package apikey + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsSetDefaultKeyOperationResponse struct { + HttpResponse *http.Response +} + +// MonitorsSetDefaultKey ... +func (c ApiKeyClient) MonitorsSetDefaultKey(ctx context.Context, id MonitorId, input DatadogApiKey) (result MonitorsSetDefaultKeyOperationResponse, err error) { + req, err := c.preparerForMonitorsSetDefaultKey(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "apikey.ApiKeyClient", "MonitorsSetDefaultKey", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "apikey.ApiKeyClient", "MonitorsSetDefaultKey", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForMonitorsSetDefaultKey(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "apikey.ApiKeyClient", "MonitorsSetDefaultKey", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForMonitorsSetDefaultKey prepares the MonitorsSetDefaultKey request. +func (c ApiKeyClient) preparerForMonitorsSetDefaultKey(ctx context.Context, id MonitorId, input DatadogApiKey) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/setDefaultKey", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForMonitorsSetDefaultKey handles the response to the MonitorsSetDefaultKey request. The method always +// closes the http.Response Body. +func (c ApiKeyClient) responderForMonitorsSetDefaultKey(resp *http.Response) (result MonitorsSetDefaultKeyOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/model_datadogapikey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/model_datadogapikey.go new file mode 100644 index 000000000000..5ce9113e22c8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/model_datadogapikey.go @@ -0,0 +1,11 @@ +package apikey + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatadogApiKey struct { + Created *string `json:"created,omitempty"` + CreatedBy *string `json:"createdBy,omitempty"` + Key string `json:"key"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/predicates.go new file mode 100644 index 000000000000..556b13bc0d66 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/predicates.go @@ -0,0 +1,29 @@ +package apikey + +type DatadogApiKeyOperationPredicate struct { + Created *string + CreatedBy *string + Key *string + Name *string +} + +func (p DatadogApiKeyOperationPredicate) Matches(input DatadogApiKey) bool { + + if p.Created != nil && (input.Created == nil && *p.Created != *input.Created) { + return false + } + + if p.CreatedBy != nil && (input.CreatedBy == nil && *p.CreatedBy != *input.CreatedBy) { + return false + } + + if p.Key != nil && *p.Key != input.Key { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/version.go new file mode 100644 index 000000000000..0cd56849d756 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey/version.go @@ -0,0 +1,12 @@ +package apikey + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/apikey/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/client.go new file mode 100644 index 000000000000..2dc68c59daf2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/client.go @@ -0,0 +1,68 @@ +package v2021_03_01 + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules" + "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon" +) + +type Client struct { + Agreements *agreements.AgreementsClient + ApiKey *apikey.ApiKeyClient + Hosts *hosts.HostsClient + LinkedResources *linkedresources.LinkedResourcesClient + MonitoredResources *monitoredresources.MonitoredResourcesClient + MonitorsResource *monitorsresource.MonitorsResourceClient + RefreshSetPasswordLink *refreshsetpasswordlink.RefreshSetPasswordLinkClient + Rules *rules.RulesClient + SingleSignOn *singlesignon.SingleSignOnClient +} + +func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { + + agreementsClient := agreements.NewAgreementsClientWithBaseURI(endpoint) + configureAuthFunc(&agreementsClient.Client) + + apiKeyClient := apikey.NewApiKeyClientWithBaseURI(endpoint) + configureAuthFunc(&apiKeyClient.Client) + + hostsClient := hosts.NewHostsClientWithBaseURI(endpoint) + configureAuthFunc(&hostsClient.Client) + + linkedResourcesClient := linkedresources.NewLinkedResourcesClientWithBaseURI(endpoint) + configureAuthFunc(&linkedResourcesClient.Client) + + monitoredResourcesClient := monitoredresources.NewMonitoredResourcesClientWithBaseURI(endpoint) + configureAuthFunc(&monitoredResourcesClient.Client) + + monitorsResourceClient := monitorsresource.NewMonitorsResourceClientWithBaseURI(endpoint) + configureAuthFunc(&monitorsResourceClient.Client) + + refreshSetPasswordLinkClient := refreshsetpasswordlink.NewRefreshSetPasswordLinkClientWithBaseURI(endpoint) + configureAuthFunc(&refreshSetPasswordLinkClient.Client) + + rulesClient := rules.NewRulesClientWithBaseURI(endpoint) + configureAuthFunc(&rulesClient.Client) + + singleSignOnClient := singlesignon.NewSingleSignOnClientWithBaseURI(endpoint) + configureAuthFunc(&singleSignOnClient.Client) + + return Client{ + Agreements: &agreementsClient, + ApiKey: &apiKeyClient, + Hosts: &hostsClient, + LinkedResources: &linkedResourcesClient, + MonitoredResources: &monitoredResourcesClient, + MonitorsResource: &monitorsResourceClient, + RefreshSetPasswordLink: &refreshSetPasswordLinkClient, + Rules: &rulesClient, + SingleSignOn: &singleSignOnClient, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/README.md new file mode 100644 index 000000000000..ed3fbc5189cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/README.md @@ -0,0 +1,37 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts` Documentation + +The `hosts` SDK allows for interaction with the Azure Resource Manager Service `datadog` (API Version `2021-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts" +``` + + +### Client Initialization + +```go +client := hosts.NewHostsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `HostsClient.MonitorsListHosts` + +```go +ctx := context.TODO() +id := hosts.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +// alternatively `client.MonitorsListHosts(ctx, id)` can be used to do batched pagination +items, err := client.MonitorsListHostsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/client.go new file mode 100644 index 000000000000..1b3c92f98e39 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/client.go @@ -0,0 +1,18 @@ +package hosts + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostsClient struct { + Client autorest.Client + baseUri string +} + +func NewHostsClientWithBaseURI(endpoint string) HostsClient { + return HostsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/id_monitor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/id_monitor.go new file mode 100644 index 000000000000..ea1e1b8b45fa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/id_monitor.go @@ -0,0 +1,124 @@ +package hosts + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = MonitorId{} + +// MonitorId is a struct representing the Resource ID for a Monitor +type MonitorId struct { + SubscriptionId string + ResourceGroupName string + MonitorName string +} + +// NewMonitorID returns a new MonitorId struct +func NewMonitorID(subscriptionId string, resourceGroupName string, monitorName string) MonitorId { + return MonitorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MonitorName: monitorName, + } +} + +// ParseMonitorID parses 'input' into a MonitorId +func ParseMonitorID(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseMonitorIDInsensitively parses 'input' case-insensitively into a MonitorId +// note: this method should only be used for API response data and not user input +func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateMonitorID checks that 'input' can be parsed as a Monitor ID +func ValidateMonitorID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseMonitorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Monitor ID +func (id MonitorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Datadog/monitors/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Monitor ID +func (id MonitorId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDatadog", "Microsoft.Datadog", "Microsoft.Datadog"), + resourceids.StaticSegment("staticMonitors", "monitors", "monitors"), + resourceids.UserSpecifiedSegment("monitorName", "monitorValue"), + } +} + +// String returns a human-readable description of this Monitor ID +func (id MonitorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Monitor Name: %q", id.MonitorName), + } + return fmt.Sprintf("Monitor (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/method_monitorslisthosts_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/method_monitorslisthosts_autorest.go new file mode 100644 index 000000000000..7307cf3e8d16 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/method_monitorslisthosts_autorest.go @@ -0,0 +1,186 @@ +package hosts + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsListHostsOperationResponse struct { + HttpResponse *http.Response + Model *[]DatadogHost + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (MonitorsListHostsOperationResponse, error) +} + +type MonitorsListHostsCompleteResult struct { + Items []DatadogHost +} + +func (r MonitorsListHostsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r MonitorsListHostsOperationResponse) LoadMore(ctx context.Context) (resp MonitorsListHostsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// MonitorsListHosts ... +func (c HostsClient) MonitorsListHosts(ctx context.Context, id MonitorId) (resp MonitorsListHostsOperationResponse, err error) { + req, err := c.preparerForMonitorsListHosts(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hosts.HostsClient", "MonitorsListHosts", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hosts.HostsClient", "MonitorsListHosts", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForMonitorsListHosts(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hosts.HostsClient", "MonitorsListHosts", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForMonitorsListHosts prepares the MonitorsListHosts request. +func (c HostsClient) preparerForMonitorsListHosts(ctx context.Context, id MonitorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listHosts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForMonitorsListHostsWithNextLink prepares the MonitorsListHosts request with the given nextLink token. +func (c HostsClient) preparerForMonitorsListHostsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForMonitorsListHosts handles the response to the MonitorsListHosts request. The method always +// closes the http.Response Body. +func (c HostsClient) responderForMonitorsListHosts(resp *http.Response) (result MonitorsListHostsOperationResponse, err error) { + type page struct { + Values []DatadogHost `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result MonitorsListHostsOperationResponse, err error) { + req, err := c.preparerForMonitorsListHostsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "hosts.HostsClient", "MonitorsListHosts", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hosts.HostsClient", "MonitorsListHosts", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForMonitorsListHosts(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hosts.HostsClient", "MonitorsListHosts", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// MonitorsListHostsComplete retrieves all of the results into a single object +func (c HostsClient) MonitorsListHostsComplete(ctx context.Context, id MonitorId) (MonitorsListHostsCompleteResult, error) { + return c.MonitorsListHostsCompleteMatchingPredicate(ctx, id, DatadogHostOperationPredicate{}) +} + +// MonitorsListHostsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c HostsClient) MonitorsListHostsCompleteMatchingPredicate(ctx context.Context, id MonitorId, predicate DatadogHostOperationPredicate) (resp MonitorsListHostsCompleteResult, err error) { + items := make([]DatadogHost, 0) + + page, err := c.MonitorsListHosts(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := MonitorsListHostsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/model_datadoghost.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/model_datadoghost.go new file mode 100644 index 000000000000..7cec2bbdda30 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/model_datadoghost.go @@ -0,0 +1,11 @@ +package hosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatadogHost struct { + Aliases *[]string `json:"aliases,omitempty"` + Apps *[]string `json:"apps,omitempty"` + Meta *DatadogHostMetadata `json:"meta,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/model_datadoghostmetadata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/model_datadoghostmetadata.go new file mode 100644 index 000000000000..8c1d9694e189 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/model_datadoghostmetadata.go @@ -0,0 +1,10 @@ +package hosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatadogHostMetadata struct { + AgentVersion *string `json:"agentVersion,omitempty"` + InstallMethod *DatadogInstallMethod `json:"installMethod,omitempty"` + LogsAgent *DatadogLogsAgent `json:"logsAgent,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/model_datadoginstallmethod.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/model_datadoginstallmethod.go new file mode 100644 index 000000000000..3e7aa3a85497 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/model_datadoginstallmethod.go @@ -0,0 +1,10 @@ +package hosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatadogInstallMethod struct { + InstallerVersion *string `json:"installerVersion,omitempty"` + Tool *string `json:"tool,omitempty"` + ToolVersion *string `json:"toolVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/model_datadoglogsagent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/model_datadoglogsagent.go new file mode 100644 index 000000000000..6da8fd76eeb3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/model_datadoglogsagent.go @@ -0,0 +1,8 @@ +package hosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatadogLogsAgent struct { + Transport *string `json:"transport,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/predicates.go new file mode 100644 index 000000000000..29cfaaa37b3e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/predicates.go @@ -0,0 +1,14 @@ +package hosts + +type DatadogHostOperationPredicate struct { + Name *string +} + +func (p DatadogHostOperationPredicate) Matches(input DatadogHost) bool { + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/version.go new file mode 100644 index 000000000000..25bf521dbae4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts/version.go @@ -0,0 +1,12 @@ +package hosts + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/hosts/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/README.md new file mode 100644 index 000000000000..e8bbd35345e0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/README.md @@ -0,0 +1,37 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources` Documentation + +The `linkedresources` SDK allows for interaction with the Azure Resource Manager Service `datadog` (API Version `2021-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources" +``` + + +### Client Initialization + +```go +client := linkedresources.NewLinkedResourcesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `LinkedResourcesClient.MonitorsListLinkedResources` + +```go +ctx := context.TODO() +id := linkedresources.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +// alternatively `client.MonitorsListLinkedResources(ctx, id)` can be used to do batched pagination +items, err := client.MonitorsListLinkedResourcesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/client.go new file mode 100644 index 000000000000..4b6222a9d84f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/client.go @@ -0,0 +1,18 @@ +package linkedresources + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkedResourcesClient struct { + Client autorest.Client + baseUri string +} + +func NewLinkedResourcesClientWithBaseURI(endpoint string) LinkedResourcesClient { + return LinkedResourcesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/id_monitor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/id_monitor.go new file mode 100644 index 000000000000..abcb1a977638 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/id_monitor.go @@ -0,0 +1,124 @@ +package linkedresources + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = MonitorId{} + +// MonitorId is a struct representing the Resource ID for a Monitor +type MonitorId struct { + SubscriptionId string + ResourceGroupName string + MonitorName string +} + +// NewMonitorID returns a new MonitorId struct +func NewMonitorID(subscriptionId string, resourceGroupName string, monitorName string) MonitorId { + return MonitorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MonitorName: monitorName, + } +} + +// ParseMonitorID parses 'input' into a MonitorId +func ParseMonitorID(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseMonitorIDInsensitively parses 'input' case-insensitively into a MonitorId +// note: this method should only be used for API response data and not user input +func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateMonitorID checks that 'input' can be parsed as a Monitor ID +func ValidateMonitorID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseMonitorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Monitor ID +func (id MonitorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Datadog/monitors/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Monitor ID +func (id MonitorId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDatadog", "Microsoft.Datadog", "Microsoft.Datadog"), + resourceids.StaticSegment("staticMonitors", "monitors", "monitors"), + resourceids.UserSpecifiedSegment("monitorName", "monitorValue"), + } +} + +// String returns a human-readable description of this Monitor ID +func (id MonitorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Monitor Name: %q", id.MonitorName), + } + return fmt.Sprintf("Monitor (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/method_monitorslistlinkedresources_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/method_monitorslistlinkedresources_autorest.go new file mode 100644 index 000000000000..e5408e59844c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/method_monitorslistlinkedresources_autorest.go @@ -0,0 +1,186 @@ +package linkedresources + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsListLinkedResourcesOperationResponse struct { + HttpResponse *http.Response + Model *[]LinkedResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (MonitorsListLinkedResourcesOperationResponse, error) +} + +type MonitorsListLinkedResourcesCompleteResult struct { + Items []LinkedResource +} + +func (r MonitorsListLinkedResourcesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r MonitorsListLinkedResourcesOperationResponse) LoadMore(ctx context.Context) (resp MonitorsListLinkedResourcesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// MonitorsListLinkedResources ... +func (c LinkedResourcesClient) MonitorsListLinkedResources(ctx context.Context, id MonitorId) (resp MonitorsListLinkedResourcesOperationResponse, err error) { + req, err := c.preparerForMonitorsListLinkedResources(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "linkedresources.LinkedResourcesClient", "MonitorsListLinkedResources", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "linkedresources.LinkedResourcesClient", "MonitorsListLinkedResources", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForMonitorsListLinkedResources(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "linkedresources.LinkedResourcesClient", "MonitorsListLinkedResources", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForMonitorsListLinkedResources prepares the MonitorsListLinkedResources request. +func (c LinkedResourcesClient) preparerForMonitorsListLinkedResources(ctx context.Context, id MonitorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listLinkedResources", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForMonitorsListLinkedResourcesWithNextLink prepares the MonitorsListLinkedResources request with the given nextLink token. +func (c LinkedResourcesClient) preparerForMonitorsListLinkedResourcesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForMonitorsListLinkedResources handles the response to the MonitorsListLinkedResources request. The method always +// closes the http.Response Body. +func (c LinkedResourcesClient) responderForMonitorsListLinkedResources(resp *http.Response) (result MonitorsListLinkedResourcesOperationResponse, err error) { + type page struct { + Values []LinkedResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result MonitorsListLinkedResourcesOperationResponse, err error) { + req, err := c.preparerForMonitorsListLinkedResourcesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "linkedresources.LinkedResourcesClient", "MonitorsListLinkedResources", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "linkedresources.LinkedResourcesClient", "MonitorsListLinkedResources", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForMonitorsListLinkedResources(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "linkedresources.LinkedResourcesClient", "MonitorsListLinkedResources", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// MonitorsListLinkedResourcesComplete retrieves all of the results into a single object +func (c LinkedResourcesClient) MonitorsListLinkedResourcesComplete(ctx context.Context, id MonitorId) (MonitorsListLinkedResourcesCompleteResult, error) { + return c.MonitorsListLinkedResourcesCompleteMatchingPredicate(ctx, id, LinkedResourceOperationPredicate{}) +} + +// MonitorsListLinkedResourcesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c LinkedResourcesClient) MonitorsListLinkedResourcesCompleteMatchingPredicate(ctx context.Context, id MonitorId, predicate LinkedResourceOperationPredicate) (resp MonitorsListLinkedResourcesCompleteResult, err error) { + items := make([]LinkedResource, 0) + + page, err := c.MonitorsListLinkedResources(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := MonitorsListLinkedResourcesCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/model_linkedresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/model_linkedresource.go new file mode 100644 index 000000000000..d1309c767106 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/model_linkedresource.go @@ -0,0 +1,8 @@ +package linkedresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkedResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/predicates.go new file mode 100644 index 000000000000..be3ae7a997cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/predicates.go @@ -0,0 +1,14 @@ +package linkedresources + +type LinkedResourceOperationPredicate struct { + Id *string +} + +func (p LinkedResourceOperationPredicate) Matches(input LinkedResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/version.go new file mode 100644 index 000000000000..0c8113d2b5be --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources/version.go @@ -0,0 +1,12 @@ +package linkedresources + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/linkedresources/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/README.md new file mode 100644 index 000000000000..9efc2cdc6c4f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/README.md @@ -0,0 +1,37 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources` Documentation + +The `monitoredresources` SDK allows for interaction with the Azure Resource Manager Service `datadog` (API Version `2021-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources" +``` + + +### Client Initialization + +```go +client := monitoredresources.NewMonitoredResourcesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `MonitoredResourcesClient.MonitorsListMonitoredResources` + +```go +ctx := context.TODO() +id := monitoredresources.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +// alternatively `client.MonitorsListMonitoredResources(ctx, id)` can be used to do batched pagination +items, err := client.MonitorsListMonitoredResourcesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/client.go new file mode 100644 index 000000000000..4e5537c6910c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/client.go @@ -0,0 +1,18 @@ +package monitoredresources + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoredResourcesClient struct { + Client autorest.Client + baseUri string +} + +func NewMonitoredResourcesClientWithBaseURI(endpoint string) MonitoredResourcesClient { + return MonitoredResourcesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/id_monitor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/id_monitor.go new file mode 100644 index 000000000000..153a2e9be299 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/id_monitor.go @@ -0,0 +1,124 @@ +package monitoredresources + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = MonitorId{} + +// MonitorId is a struct representing the Resource ID for a Monitor +type MonitorId struct { + SubscriptionId string + ResourceGroupName string + MonitorName string +} + +// NewMonitorID returns a new MonitorId struct +func NewMonitorID(subscriptionId string, resourceGroupName string, monitorName string) MonitorId { + return MonitorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MonitorName: monitorName, + } +} + +// ParseMonitorID parses 'input' into a MonitorId +func ParseMonitorID(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseMonitorIDInsensitively parses 'input' case-insensitively into a MonitorId +// note: this method should only be used for API response data and not user input +func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateMonitorID checks that 'input' can be parsed as a Monitor ID +func ValidateMonitorID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseMonitorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Monitor ID +func (id MonitorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Datadog/monitors/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Monitor ID +func (id MonitorId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDatadog", "Microsoft.Datadog", "Microsoft.Datadog"), + resourceids.StaticSegment("staticMonitors", "monitors", "monitors"), + resourceids.UserSpecifiedSegment("monitorName", "monitorValue"), + } +} + +// String returns a human-readable description of this Monitor ID +func (id MonitorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Monitor Name: %q", id.MonitorName), + } + return fmt.Sprintf("Monitor (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/method_monitorslistmonitoredresources_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/method_monitorslistmonitoredresources_autorest.go new file mode 100644 index 000000000000..20c9dfcd77bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/method_monitorslistmonitoredresources_autorest.go @@ -0,0 +1,186 @@ +package monitoredresources + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsListMonitoredResourcesOperationResponse struct { + HttpResponse *http.Response + Model *[]MonitoredResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (MonitorsListMonitoredResourcesOperationResponse, error) +} + +type MonitorsListMonitoredResourcesCompleteResult struct { + Items []MonitoredResource +} + +func (r MonitorsListMonitoredResourcesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r MonitorsListMonitoredResourcesOperationResponse) LoadMore(ctx context.Context) (resp MonitorsListMonitoredResourcesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// MonitorsListMonitoredResources ... +func (c MonitoredResourcesClient) MonitorsListMonitoredResources(ctx context.Context, id MonitorId) (resp MonitorsListMonitoredResourcesOperationResponse, err error) { + req, err := c.preparerForMonitorsListMonitoredResources(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "monitoredresources.MonitoredResourcesClient", "MonitorsListMonitoredResources", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "monitoredresources.MonitoredResourcesClient", "MonitorsListMonitoredResources", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForMonitorsListMonitoredResources(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "monitoredresources.MonitoredResourcesClient", "MonitorsListMonitoredResources", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForMonitorsListMonitoredResources prepares the MonitorsListMonitoredResources request. +func (c MonitoredResourcesClient) preparerForMonitorsListMonitoredResources(ctx context.Context, id MonitorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listMonitoredResources", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForMonitorsListMonitoredResourcesWithNextLink prepares the MonitorsListMonitoredResources request with the given nextLink token. +func (c MonitoredResourcesClient) preparerForMonitorsListMonitoredResourcesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForMonitorsListMonitoredResources handles the response to the MonitorsListMonitoredResources request. The method always +// closes the http.Response Body. +func (c MonitoredResourcesClient) responderForMonitorsListMonitoredResources(resp *http.Response) (result MonitorsListMonitoredResourcesOperationResponse, err error) { + type page struct { + Values []MonitoredResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result MonitorsListMonitoredResourcesOperationResponse, err error) { + req, err := c.preparerForMonitorsListMonitoredResourcesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "monitoredresources.MonitoredResourcesClient", "MonitorsListMonitoredResources", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "monitoredresources.MonitoredResourcesClient", "MonitorsListMonitoredResources", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForMonitorsListMonitoredResources(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "monitoredresources.MonitoredResourcesClient", "MonitorsListMonitoredResources", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// MonitorsListMonitoredResourcesComplete retrieves all of the results into a single object +func (c MonitoredResourcesClient) MonitorsListMonitoredResourcesComplete(ctx context.Context, id MonitorId) (MonitorsListMonitoredResourcesCompleteResult, error) { + return c.MonitorsListMonitoredResourcesCompleteMatchingPredicate(ctx, id, MonitoredResourceOperationPredicate{}) +} + +// MonitorsListMonitoredResourcesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c MonitoredResourcesClient) MonitorsListMonitoredResourcesCompleteMatchingPredicate(ctx context.Context, id MonitorId, predicate MonitoredResourceOperationPredicate) (resp MonitorsListMonitoredResourcesCompleteResult, err error) { + items := make([]MonitoredResource, 0) + + page, err := c.MonitorsListMonitoredResources(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := MonitorsListMonitoredResourcesCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/model_monitoredresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/model_monitoredresource.go new file mode 100644 index 000000000000..b6f7df3c210a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/model_monitoredresource.go @@ -0,0 +1,12 @@ +package monitoredresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoredResource struct { + Id *string `json:"id,omitempty"` + ReasonForLogsStatus *string `json:"reasonForLogsStatus,omitempty"` + ReasonForMetricsStatus *string `json:"reasonForMetricsStatus,omitempty"` + SendingLogs *bool `json:"sendingLogs,omitempty"` + SendingMetrics *bool `json:"sendingMetrics,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/predicates.go new file mode 100644 index 000000000000..5827b387d6f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/predicates.go @@ -0,0 +1,34 @@ +package monitoredresources + +type MonitoredResourceOperationPredicate struct { + Id *string + ReasonForLogsStatus *string + ReasonForMetricsStatus *string + SendingLogs *bool + SendingMetrics *bool +} + +func (p MonitoredResourceOperationPredicate) Matches(input MonitoredResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.ReasonForLogsStatus != nil && (input.ReasonForLogsStatus == nil && *p.ReasonForLogsStatus != *input.ReasonForLogsStatus) { + return false + } + + if p.ReasonForMetricsStatus != nil && (input.ReasonForMetricsStatus == nil && *p.ReasonForMetricsStatus != *input.ReasonForMetricsStatus) { + return false + } + + if p.SendingLogs != nil && (input.SendingLogs == nil && *p.SendingLogs != *input.SendingLogs) { + return false + } + + if p.SendingMetrics != nil && (input.SendingMetrics == nil && *p.SendingMetrics != *input.SendingMetrics) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/version.go new file mode 100644 index 000000000000..b631fbd65d51 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources/version.go @@ -0,0 +1,12 @@ +package monitoredresources + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/monitoredresources/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/README.md new file mode 100644 index 000000000000..e85fd08826d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource` Documentation + +The `monitorsresource` SDK allows for interaction with the Azure Resource Manager Service `datadog` (API Version `2021-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource" +``` + + +### Client Initialization + +```go +client := monitorsresource.NewMonitorsResourceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `MonitorsResourceClient.MonitorsCreate` + +```go +ctx := context.TODO() +id := monitorsresource.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +payload := monitorsresource.DatadogMonitorResource{ + // ... +} + + +if err := client.MonitorsCreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `MonitorsResourceClient.MonitorsDelete` + +```go +ctx := context.TODO() +id := monitorsresource.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +if err := client.MonitorsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `MonitorsResourceClient.MonitorsGet` + +```go +ctx := context.TODO() +id := monitorsresource.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +read, err := client.MonitorsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `MonitorsResourceClient.MonitorsList` + +```go +ctx := context.TODO() +id := monitorsresource.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.MonitorsList(ctx, id)` can be used to do batched pagination +items, err := client.MonitorsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `MonitorsResourceClient.MonitorsListByResourceGroup` + +```go +ctx := context.TODO() +id := monitorsresource.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.MonitorsListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.MonitorsListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `MonitorsResourceClient.MonitorsUpdate` + +```go +ctx := context.TODO() +id := monitorsresource.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +payload := monitorsresource.DatadogMonitorResourceUpdateParameters{ + // ... +} + + +if err := client.MonitorsUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/client.go new file mode 100644 index 000000000000..48e2515201a3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/client.go @@ -0,0 +1,18 @@ +package monitorsresource + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsResourceClient struct { + Client autorest.Client + baseUri string +} + +func NewMonitorsResourceClientWithBaseURI(endpoint string) MonitorsResourceClient { + return MonitorsResourceClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/constants.go new file mode 100644 index 000000000000..d4ea2cd44b76 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/constants.go @@ -0,0 +1,173 @@ +package monitorsresource + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LiftrResourceCategories string + +const ( + LiftrResourceCategoriesMonitorLogs LiftrResourceCategories = "MonitorLogs" + LiftrResourceCategoriesUnknown LiftrResourceCategories = "Unknown" +) + +func PossibleValuesForLiftrResourceCategories() []string { + return []string{ + string(LiftrResourceCategoriesMonitorLogs), + string(LiftrResourceCategoriesUnknown), + } +} + +func parseLiftrResourceCategories(input string) (*LiftrResourceCategories, error) { + vals := map[string]LiftrResourceCategories{ + "monitorlogs": LiftrResourceCategoriesMonitorLogs, + "unknown": LiftrResourceCategoriesUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LiftrResourceCategories(input) + return &out, nil +} + +type ManagedIdentityTypes string + +const ( + ManagedIdentityTypesSystemAssigned ManagedIdentityTypes = "SystemAssigned" + ManagedIdentityTypesUserAssigned ManagedIdentityTypes = "UserAssigned" +) + +func PossibleValuesForManagedIdentityTypes() []string { + return []string{ + string(ManagedIdentityTypesSystemAssigned), + string(ManagedIdentityTypesUserAssigned), + } +} + +func parseManagedIdentityTypes(input string) (*ManagedIdentityTypes, error) { + vals := map[string]ManagedIdentityTypes{ + "systemassigned": ManagedIdentityTypesSystemAssigned, + "userassigned": ManagedIdentityTypesUserAssigned, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ManagedIdentityTypes(input) + return &out, nil +} + +type MarketplaceSubscriptionStatus string + +const ( + MarketplaceSubscriptionStatusActive MarketplaceSubscriptionStatus = "Active" + MarketplaceSubscriptionStatusProvisioning MarketplaceSubscriptionStatus = "Provisioning" + MarketplaceSubscriptionStatusSuspended MarketplaceSubscriptionStatus = "Suspended" + MarketplaceSubscriptionStatusUnsubscribed MarketplaceSubscriptionStatus = "Unsubscribed" +) + +func PossibleValuesForMarketplaceSubscriptionStatus() []string { + return []string{ + string(MarketplaceSubscriptionStatusActive), + string(MarketplaceSubscriptionStatusProvisioning), + string(MarketplaceSubscriptionStatusSuspended), + string(MarketplaceSubscriptionStatusUnsubscribed), + } +} + +func parseMarketplaceSubscriptionStatus(input string) (*MarketplaceSubscriptionStatus, error) { + vals := map[string]MarketplaceSubscriptionStatus{ + "active": MarketplaceSubscriptionStatusActive, + "provisioning": MarketplaceSubscriptionStatusProvisioning, + "suspended": MarketplaceSubscriptionStatusSuspended, + "unsubscribed": MarketplaceSubscriptionStatusUnsubscribed, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MarketplaceSubscriptionStatus(input) + return &out, nil +} + +type MonitoringStatus string + +const ( + MonitoringStatusDisabled MonitoringStatus = "Disabled" + MonitoringStatusEnabled MonitoringStatus = "Enabled" +) + +func PossibleValuesForMonitoringStatus() []string { + return []string{ + string(MonitoringStatusDisabled), + string(MonitoringStatusEnabled), + } +} + +func parseMonitoringStatus(input string) (*MonitoringStatus, error) { + vals := map[string]MonitoringStatus{ + "disabled": MonitoringStatusDisabled, + "enabled": MonitoringStatusEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MonitoringStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateNotSpecified), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "notspecified": ProvisioningStateNotSpecified, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/id_monitor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/id_monitor.go new file mode 100644 index 000000000000..ccf90fa1ff58 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/id_monitor.go @@ -0,0 +1,124 @@ +package monitorsresource + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = MonitorId{} + +// MonitorId is a struct representing the Resource ID for a Monitor +type MonitorId struct { + SubscriptionId string + ResourceGroupName string + MonitorName string +} + +// NewMonitorID returns a new MonitorId struct +func NewMonitorID(subscriptionId string, resourceGroupName string, monitorName string) MonitorId { + return MonitorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MonitorName: monitorName, + } +} + +// ParseMonitorID parses 'input' into a MonitorId +func ParseMonitorID(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseMonitorIDInsensitively parses 'input' case-insensitively into a MonitorId +// note: this method should only be used for API response data and not user input +func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateMonitorID checks that 'input' can be parsed as a Monitor ID +func ValidateMonitorID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseMonitorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Monitor ID +func (id MonitorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Datadog/monitors/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Monitor ID +func (id MonitorId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDatadog", "Microsoft.Datadog", "Microsoft.Datadog"), + resourceids.StaticSegment("staticMonitors", "monitors", "monitors"), + resourceids.UserSpecifiedSegment("monitorName", "monitorValue"), + } +} + +// String returns a human-readable description of this Monitor ID +func (id MonitorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Monitor Name: %q", id.MonitorName), + } + return fmt.Sprintf("Monitor (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorscreate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorscreate_autorest.go new file mode 100644 index 000000000000..3524387e72bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorscreate_autorest.go @@ -0,0 +1,79 @@ +package monitorsresource + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsCreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// MonitorsCreate ... +func (c MonitorsResourceClient) MonitorsCreate(ctx context.Context, id MonitorId, input DatadogMonitorResource) (result MonitorsCreateOperationResponse, err error) { + req, err := c.preparerForMonitorsCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsCreate", nil, "Failure preparing request") + return + } + + result, err = c.senderForMonitorsCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsCreate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// MonitorsCreateThenPoll performs MonitorsCreate then polls until it's completed +func (c MonitorsResourceClient) MonitorsCreateThenPoll(ctx context.Context, id MonitorId, input DatadogMonitorResource) error { + result, err := c.MonitorsCreate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing MonitorsCreate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after MonitorsCreate: %+v", err) + } + + return nil +} + +// preparerForMonitorsCreate prepares the MonitorsCreate request. +func (c MonitorsResourceClient) preparerForMonitorsCreate(ctx context.Context, id MonitorId, input DatadogMonitorResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForMonitorsCreate sends the MonitorsCreate request. The method will close the +// http.Response Body if it receives an error. +func (c MonitorsResourceClient) senderForMonitorsCreate(ctx context.Context, req *http.Request) (future MonitorsCreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorsdelete_autorest.go new file mode 100644 index 000000000000..8b68d78fe69f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorsdelete_autorest.go @@ -0,0 +1,78 @@ +package monitorsresource + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// MonitorsDelete ... +func (c MonitorsResourceClient) MonitorsDelete(ctx context.Context, id MonitorId) (result MonitorsDeleteOperationResponse, err error) { + req, err := c.preparerForMonitorsDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForMonitorsDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// MonitorsDeleteThenPoll performs MonitorsDelete then polls until it's completed +func (c MonitorsResourceClient) MonitorsDeleteThenPoll(ctx context.Context, id MonitorId) error { + result, err := c.MonitorsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing MonitorsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after MonitorsDelete: %+v", err) + } + + return nil +} + +// preparerForMonitorsDelete prepares the MonitorsDelete request. +func (c MonitorsResourceClient) preparerForMonitorsDelete(ctx context.Context, id MonitorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForMonitorsDelete sends the MonitorsDelete request. The method will close the +// http.Response Body if it receives an error. +func (c MonitorsResourceClient) senderForMonitorsDelete(ctx context.Context, req *http.Request) (future MonitorsDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorsget_autorest.go new file mode 100644 index 000000000000..76736761e23f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorsget_autorest.go @@ -0,0 +1,68 @@ +package monitorsresource + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsGetOperationResponse struct { + HttpResponse *http.Response + Model *DatadogMonitorResource +} + +// MonitorsGet ... +func (c MonitorsResourceClient) MonitorsGet(ctx context.Context, id MonitorId) (result MonitorsGetOperationResponse, err error) { + req, err := c.preparerForMonitorsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForMonitorsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForMonitorsGet prepares the MonitorsGet request. +func (c MonitorsResourceClient) preparerForMonitorsGet(ctx context.Context, id MonitorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForMonitorsGet handles the response to the MonitorsGet request. The method always +// closes the http.Response Body. +func (c MonitorsResourceClient) responderForMonitorsGet(resp *http.Response) (result MonitorsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorslist_autorest.go new file mode 100644 index 000000000000..0296d3e2dc05 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorslist_autorest.go @@ -0,0 +1,187 @@ +package monitorsresource + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsListOperationResponse struct { + HttpResponse *http.Response + Model *[]DatadogMonitorResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (MonitorsListOperationResponse, error) +} + +type MonitorsListCompleteResult struct { + Items []DatadogMonitorResource +} + +func (r MonitorsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r MonitorsListOperationResponse) LoadMore(ctx context.Context) (resp MonitorsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// MonitorsList ... +func (c MonitorsResourceClient) MonitorsList(ctx context.Context, id commonids.SubscriptionId) (resp MonitorsListOperationResponse, err error) { + req, err := c.preparerForMonitorsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForMonitorsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForMonitorsList prepares the MonitorsList request. +func (c MonitorsResourceClient) preparerForMonitorsList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Datadog/monitors", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForMonitorsListWithNextLink prepares the MonitorsList request with the given nextLink token. +func (c MonitorsResourceClient) preparerForMonitorsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForMonitorsList handles the response to the MonitorsList request. The method always +// closes the http.Response Body. +func (c MonitorsResourceClient) responderForMonitorsList(resp *http.Response) (result MonitorsListOperationResponse, err error) { + type page struct { + Values []DatadogMonitorResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result MonitorsListOperationResponse, err error) { + req, err := c.preparerForMonitorsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForMonitorsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// MonitorsListComplete retrieves all of the results into a single object +func (c MonitorsResourceClient) MonitorsListComplete(ctx context.Context, id commonids.SubscriptionId) (MonitorsListCompleteResult, error) { + return c.MonitorsListCompleteMatchingPredicate(ctx, id, DatadogMonitorResourceOperationPredicate{}) +} + +// MonitorsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c MonitorsResourceClient) MonitorsListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DatadogMonitorResourceOperationPredicate) (resp MonitorsListCompleteResult, err error) { + items := make([]DatadogMonitorResource, 0) + + page, err := c.MonitorsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := MonitorsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorslistbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorslistbyresourcegroup_autorest.go new file mode 100644 index 000000000000..3b7fb03041b6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorslistbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package monitorsresource + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]DatadogMonitorResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (MonitorsListByResourceGroupOperationResponse, error) +} + +type MonitorsListByResourceGroupCompleteResult struct { + Items []DatadogMonitorResource +} + +func (r MonitorsListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r MonitorsListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp MonitorsListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// MonitorsListByResourceGroup ... +func (c MonitorsResourceClient) MonitorsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp MonitorsListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForMonitorsListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForMonitorsListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForMonitorsListByResourceGroup prepares the MonitorsListByResourceGroup request. +func (c MonitorsResourceClient) preparerForMonitorsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Datadog/monitors", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForMonitorsListByResourceGroupWithNextLink prepares the MonitorsListByResourceGroup request with the given nextLink token. +func (c MonitorsResourceClient) preparerForMonitorsListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForMonitorsListByResourceGroup handles the response to the MonitorsListByResourceGroup request. The method always +// closes the http.Response Body. +func (c MonitorsResourceClient) responderForMonitorsListByResourceGroup(resp *http.Response) (result MonitorsListByResourceGroupOperationResponse, err error) { + type page struct { + Values []DatadogMonitorResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result MonitorsListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForMonitorsListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForMonitorsListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// MonitorsListByResourceGroupComplete retrieves all of the results into a single object +func (c MonitorsResourceClient) MonitorsListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (MonitorsListByResourceGroupCompleteResult, error) { + return c.MonitorsListByResourceGroupCompleteMatchingPredicate(ctx, id, DatadogMonitorResourceOperationPredicate{}) +} + +// MonitorsListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c MonitorsResourceClient) MonitorsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate DatadogMonitorResourceOperationPredicate) (resp MonitorsListByResourceGroupCompleteResult, err error) { + items := make([]DatadogMonitorResource, 0) + + page, err := c.MonitorsListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := MonitorsListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorsupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorsupdate_autorest.go new file mode 100644 index 000000000000..aa3df546f31d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/method_monitorsupdate_autorest.go @@ -0,0 +1,79 @@ +package monitorsresource + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// MonitorsUpdate ... +func (c MonitorsResourceClient) MonitorsUpdate(ctx context.Context, id MonitorId, input DatadogMonitorResourceUpdateParameters) (result MonitorsUpdateOperationResponse, err error) { + req, err := c.preparerForMonitorsUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForMonitorsUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "monitorsresource.MonitorsResourceClient", "MonitorsUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// MonitorsUpdateThenPoll performs MonitorsUpdate then polls until it's completed +func (c MonitorsResourceClient) MonitorsUpdateThenPoll(ctx context.Context, id MonitorId, input DatadogMonitorResourceUpdateParameters) error { + result, err := c.MonitorsUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing MonitorsUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after MonitorsUpdate: %+v", err) + } + + return nil +} + +// preparerForMonitorsUpdate prepares the MonitorsUpdate request. +func (c MonitorsResourceClient) preparerForMonitorsUpdate(ctx context.Context, id MonitorId, input DatadogMonitorResourceUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForMonitorsUpdate sends the MonitorsUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c MonitorsResourceClient) senderForMonitorsUpdate(ctx context.Context, req *http.Request) (future MonitorsUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_datadogmonitorresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_datadogmonitorresource.go new file mode 100644 index 000000000000..b70ac52c8fda --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_datadogmonitorresource.go @@ -0,0 +1,20 @@ +package monitorsresource + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatadogMonitorResource struct { + Id *string `json:"id,omitempty"` + Identity *IdentityProperties `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *MonitorProperties `json:"properties,omitempty"` + Sku *ResourceSku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_datadogmonitorresourceupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_datadogmonitorresourceupdateparameters.go new file mode 100644 index 000000000000..f775abd0f2d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_datadogmonitorresourceupdateparameters.go @@ -0,0 +1,10 @@ +package monitorsresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatadogMonitorResourceUpdateParameters struct { + Properties *MonitorUpdateProperties `json:"properties,omitempty"` + Sku *ResourceSku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_datadogorganizationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_datadogorganizationproperties.go new file mode 100644 index 000000000000..f1a0490258d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_datadogorganizationproperties.go @@ -0,0 +1,15 @@ +package monitorsresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatadogOrganizationProperties struct { + ApiKey *string `json:"apiKey,omitempty"` + ApplicationKey *string `json:"applicationKey,omitempty"` + EnterpriseAppId *string `json:"enterpriseAppId,omitempty"` + Id *string `json:"id,omitempty"` + LinkingAuthCode *string `json:"linkingAuthCode,omitempty"` + LinkingClientId *string `json:"linkingClientId,omitempty"` + Name *string `json:"name,omitempty"` + RedirectUri *string `json:"redirectUri,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_identityproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_identityproperties.go new file mode 100644 index 000000000000..dacb58bfc75e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_identityproperties.go @@ -0,0 +1,10 @@ +package monitorsresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IdentityProperties struct { + PrincipalId *string `json:"principalId,omitempty"` + TenantId *string `json:"tenantId,omitempty"` + Type *ManagedIdentityTypes `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_monitorproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_monitorproperties.go new file mode 100644 index 000000000000..81899cc5ed40 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_monitorproperties.go @@ -0,0 +1,14 @@ +package monitorsresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorProperties struct { + DatadogOrganizationProperties *DatadogOrganizationProperties `json:"datadogOrganizationProperties,omitempty"` + LiftrResourceCategory *LiftrResourceCategories `json:"liftrResourceCategory,omitempty"` + LiftrResourcePreference *int64 `json:"liftrResourcePreference,omitempty"` + MarketplaceSubscriptionStatus *MarketplaceSubscriptionStatus `json:"marketplaceSubscriptionStatus,omitempty"` + MonitoringStatus *MonitoringStatus `json:"monitoringStatus,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + UserInfo *UserInfo `json:"userInfo,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_monitorupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_monitorupdateproperties.go new file mode 100644 index 000000000000..1250354816ad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_monitorupdateproperties.go @@ -0,0 +1,8 @@ +package monitorsresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorUpdateProperties struct { + MonitoringStatus *MonitoringStatus `json:"monitoringStatus,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_resourcesku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_resourcesku.go new file mode 100644 index 000000000000..9344eedf0688 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_resourcesku.go @@ -0,0 +1,8 @@ +package monitorsresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSku struct { + Name string `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_userinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_userinfo.go new file mode 100644 index 000000000000..b61d14dac6d7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/model_userinfo.go @@ -0,0 +1,10 @@ +package monitorsresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInfo struct { + EmailAddress *string `json:"emailAddress,omitempty"` + Name *string `json:"name,omitempty"` + PhoneNumber *string `json:"phoneNumber,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/predicates.go new file mode 100644 index 000000000000..df45e0607d85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/predicates.go @@ -0,0 +1,29 @@ +package monitorsresource + +type DatadogMonitorResourceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p DatadogMonitorResourceOperationPredicate) Matches(input DatadogMonitorResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/version.go new file mode 100644 index 000000000000..71b9e8ba5422 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource/version.go @@ -0,0 +1,12 @@ +package monitorsresource + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/monitorsresource/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/README.md new file mode 100644 index 000000000000..9fa7c636182d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/README.md @@ -0,0 +1,36 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink` Documentation + +The `refreshsetpasswordlink` SDK allows for interaction with the Azure Resource Manager Service `datadog` (API Version `2021-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink" +``` + + +### Client Initialization + +```go +client := refreshsetpasswordlink.NewRefreshSetPasswordLinkClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RefreshSetPasswordLinkClient.MonitorsRefreshSetPasswordLink` + +```go +ctx := context.TODO() +id := refreshsetpasswordlink.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +read, err := client.MonitorsRefreshSetPasswordLink(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/client.go new file mode 100644 index 000000000000..c428baf61bed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/client.go @@ -0,0 +1,18 @@ +package refreshsetpasswordlink + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RefreshSetPasswordLinkClient struct { + Client autorest.Client + baseUri string +} + +func NewRefreshSetPasswordLinkClientWithBaseURI(endpoint string) RefreshSetPasswordLinkClient { + return RefreshSetPasswordLinkClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/id_monitor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/id_monitor.go new file mode 100644 index 000000000000..245f0ce75090 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/id_monitor.go @@ -0,0 +1,124 @@ +package refreshsetpasswordlink + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = MonitorId{} + +// MonitorId is a struct representing the Resource ID for a Monitor +type MonitorId struct { + SubscriptionId string + ResourceGroupName string + MonitorName string +} + +// NewMonitorID returns a new MonitorId struct +func NewMonitorID(subscriptionId string, resourceGroupName string, monitorName string) MonitorId { + return MonitorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MonitorName: monitorName, + } +} + +// ParseMonitorID parses 'input' into a MonitorId +func ParseMonitorID(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseMonitorIDInsensitively parses 'input' case-insensitively into a MonitorId +// note: this method should only be used for API response data and not user input +func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateMonitorID checks that 'input' can be parsed as a Monitor ID +func ValidateMonitorID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseMonitorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Monitor ID +func (id MonitorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Datadog/monitors/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Monitor ID +func (id MonitorId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDatadog", "Microsoft.Datadog", "Microsoft.Datadog"), + resourceids.StaticSegment("staticMonitors", "monitors", "monitors"), + resourceids.UserSpecifiedSegment("monitorName", "monitorValue"), + } +} + +// String returns a human-readable description of this Monitor ID +func (id MonitorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Monitor Name: %q", id.MonitorName), + } + return fmt.Sprintf("Monitor (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/method_monitorsrefreshsetpasswordlink_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/method_monitorsrefreshsetpasswordlink_autorest.go new file mode 100644 index 000000000000..17dbcab6c166 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/method_monitorsrefreshsetpasswordlink_autorest.go @@ -0,0 +1,69 @@ +package refreshsetpasswordlink + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsRefreshSetPasswordLinkOperationResponse struct { + HttpResponse *http.Response + Model *DatadogSetPasswordLink +} + +// MonitorsRefreshSetPasswordLink ... +func (c RefreshSetPasswordLinkClient) MonitorsRefreshSetPasswordLink(ctx context.Context, id MonitorId) (result MonitorsRefreshSetPasswordLinkOperationResponse, err error) { + req, err := c.preparerForMonitorsRefreshSetPasswordLink(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "refreshsetpasswordlink.RefreshSetPasswordLinkClient", "MonitorsRefreshSetPasswordLink", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "refreshsetpasswordlink.RefreshSetPasswordLinkClient", "MonitorsRefreshSetPasswordLink", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForMonitorsRefreshSetPasswordLink(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "refreshsetpasswordlink.RefreshSetPasswordLinkClient", "MonitorsRefreshSetPasswordLink", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForMonitorsRefreshSetPasswordLink prepares the MonitorsRefreshSetPasswordLink request. +func (c RefreshSetPasswordLinkClient) preparerForMonitorsRefreshSetPasswordLink(ctx context.Context, id MonitorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/refreshSetPasswordLink", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForMonitorsRefreshSetPasswordLink handles the response to the MonitorsRefreshSetPasswordLink request. The method always +// closes the http.Response Body. +func (c RefreshSetPasswordLinkClient) responderForMonitorsRefreshSetPasswordLink(resp *http.Response) (result MonitorsRefreshSetPasswordLinkOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/model_datadogsetpasswordlink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/model_datadogsetpasswordlink.go new file mode 100644 index 000000000000..c1fa0c22482d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/model_datadogsetpasswordlink.go @@ -0,0 +1,8 @@ +package refreshsetpasswordlink + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatadogSetPasswordLink struct { + SetPasswordLink *string `json:"setPasswordLink,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/version.go new file mode 100644 index 000000000000..98842ce0c5e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/version.go @@ -0,0 +1,12 @@ +package refreshsetpasswordlink + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/refreshsetpasswordlink/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/README.md new file mode 100644 index 000000000000..8cddfe9f70ea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/README.md @@ -0,0 +1,74 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules` Documentation + +The `rules` SDK allows for interaction with the Azure Resource Manager Service `datadog` (API Version `2021-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules" +``` + + +### Client Initialization + +```go +client := rules.NewRulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RulesClient.TagRulesCreateOrUpdate` + +```go +ctx := context.TODO() +id := rules.NewTagRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "tagRuleValue") + +payload := rules.MonitoringTagRules{ + // ... +} + + +read, err := client.TagRulesCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RulesClient.TagRulesGet` + +```go +ctx := context.TODO() +id := rules.NewTagRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "tagRuleValue") + +read, err := client.TagRulesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RulesClient.TagRulesList` + +```go +ctx := context.TODO() +id := rules.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +// alternatively `client.TagRulesList(ctx, id)` can be used to do batched pagination +items, err := client.TagRulesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/client.go new file mode 100644 index 000000000000..7e1e300eef3c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/client.go @@ -0,0 +1,18 @@ +package rules + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RulesClient struct { + Client autorest.Client + baseUri string +} + +func NewRulesClientWithBaseURI(endpoint string) RulesClient { + return RulesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/constants.go new file mode 100644 index 000000000000..84ef6717b848 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/constants.go @@ -0,0 +1,83 @@ +package rules + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateNotSpecified), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "notspecified": ProvisioningStateNotSpecified, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type TagAction string + +const ( + TagActionExclude TagAction = "Exclude" + TagActionInclude TagAction = "Include" +) + +func PossibleValuesForTagAction() []string { + return []string{ + string(TagActionExclude), + string(TagActionInclude), + } +} + +func parseTagAction(input string) (*TagAction, error) { + vals := map[string]TagAction{ + "exclude": TagActionExclude, + "include": TagActionInclude, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TagAction(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/id_monitor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/id_monitor.go new file mode 100644 index 000000000000..f5abcc605237 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/id_monitor.go @@ -0,0 +1,124 @@ +package rules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = MonitorId{} + +// MonitorId is a struct representing the Resource ID for a Monitor +type MonitorId struct { + SubscriptionId string + ResourceGroupName string + MonitorName string +} + +// NewMonitorID returns a new MonitorId struct +func NewMonitorID(subscriptionId string, resourceGroupName string, monitorName string) MonitorId { + return MonitorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MonitorName: monitorName, + } +} + +// ParseMonitorID parses 'input' into a MonitorId +func ParseMonitorID(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseMonitorIDInsensitively parses 'input' case-insensitively into a MonitorId +// note: this method should only be used for API response data and not user input +func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateMonitorID checks that 'input' can be parsed as a Monitor ID +func ValidateMonitorID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseMonitorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Monitor ID +func (id MonitorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Datadog/monitors/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Monitor ID +func (id MonitorId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDatadog", "Microsoft.Datadog", "Microsoft.Datadog"), + resourceids.StaticSegment("staticMonitors", "monitors", "monitors"), + resourceids.UserSpecifiedSegment("monitorName", "monitorValue"), + } +} + +// String returns a human-readable description of this Monitor ID +func (id MonitorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Monitor Name: %q", id.MonitorName), + } + return fmt.Sprintf("Monitor (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/id_tagrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/id_tagrule.go new file mode 100644 index 000000000000..3031de73ea2c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/id_tagrule.go @@ -0,0 +1,137 @@ +package rules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = TagRuleId{} + +// TagRuleId is a struct representing the Resource ID for a Tag Rule +type TagRuleId struct { + SubscriptionId string + ResourceGroupName string + MonitorName string + TagRuleName string +} + +// NewTagRuleID returns a new TagRuleId struct +func NewTagRuleID(subscriptionId string, resourceGroupName string, monitorName string, tagRuleName string) TagRuleId { + return TagRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MonitorName: monitorName, + TagRuleName: tagRuleName, + } +} + +// ParseTagRuleID parses 'input' into a TagRuleId +func ParseTagRuleID(input string) (*TagRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(TagRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TagRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'tagRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseTagRuleIDInsensitively parses 'input' case-insensitively into a TagRuleId +// note: this method should only be used for API response data and not user input +func ParseTagRuleIDInsensitively(input string) (*TagRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(TagRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TagRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'tagRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateTagRuleID checks that 'input' can be parsed as a Tag Rule ID +func ValidateTagRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseTagRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Tag Rule ID +func (id TagRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Datadog/monitors/%s/tagRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName, id.TagRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Tag Rule ID +func (id TagRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDatadog", "Microsoft.Datadog", "Microsoft.Datadog"), + resourceids.StaticSegment("staticMonitors", "monitors", "monitors"), + resourceids.UserSpecifiedSegment("monitorName", "monitorValue"), + resourceids.StaticSegment("staticTagRules", "tagRules", "tagRules"), + resourceids.UserSpecifiedSegment("tagRuleName", "tagRuleValue"), + } +} + +// String returns a human-readable description of this Tag Rule ID +func (id TagRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Monitor Name: %q", id.MonitorName), + fmt.Sprintf("Tag Rule Name: %q", id.TagRuleName), + } + return fmt.Sprintf("Tag Rule (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/method_tagrulescreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/method_tagrulescreateorupdate_autorest.go new file mode 100644 index 000000000000..04fa47ada9d5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/method_tagrulescreateorupdate_autorest.go @@ -0,0 +1,69 @@ +package rules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagRulesCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *MonitoringTagRules +} + +// TagRulesCreateOrUpdate ... +func (c RulesClient) TagRulesCreateOrUpdate(ctx context.Context, id TagRuleId, input MonitoringTagRules) (result TagRulesCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForTagRulesCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "TagRulesCreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "TagRulesCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForTagRulesCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "TagRulesCreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForTagRulesCreateOrUpdate prepares the TagRulesCreateOrUpdate request. +func (c RulesClient) preparerForTagRulesCreateOrUpdate(ctx context.Context, id TagRuleId, input MonitoringTagRules) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForTagRulesCreateOrUpdate handles the response to the TagRulesCreateOrUpdate request. The method always +// closes the http.Response Body. +func (c RulesClient) responderForTagRulesCreateOrUpdate(resp *http.Response) (result TagRulesCreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/method_tagrulesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/method_tagrulesget_autorest.go new file mode 100644 index 000000000000..379e59b6c8e0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/method_tagrulesget_autorest.go @@ -0,0 +1,68 @@ +package rules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagRulesGetOperationResponse struct { + HttpResponse *http.Response + Model *MonitoringTagRules +} + +// TagRulesGet ... +func (c RulesClient) TagRulesGet(ctx context.Context, id TagRuleId) (result TagRulesGetOperationResponse, err error) { + req, err := c.preparerForTagRulesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "TagRulesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "TagRulesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForTagRulesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "TagRulesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForTagRulesGet prepares the TagRulesGet request. +func (c RulesClient) preparerForTagRulesGet(ctx context.Context, id TagRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForTagRulesGet handles the response to the TagRulesGet request. The method always +// closes the http.Response Body. +func (c RulesClient) responderForTagRulesGet(resp *http.Response) (result TagRulesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/method_tagruleslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/method_tagruleslist_autorest.go new file mode 100644 index 000000000000..6f2cbc36fc4c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/method_tagruleslist_autorest.go @@ -0,0 +1,186 @@ +package rules + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagRulesListOperationResponse struct { + HttpResponse *http.Response + Model *[]MonitoringTagRules + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (TagRulesListOperationResponse, error) +} + +type TagRulesListCompleteResult struct { + Items []MonitoringTagRules +} + +func (r TagRulesListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r TagRulesListOperationResponse) LoadMore(ctx context.Context) (resp TagRulesListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// TagRulesList ... +func (c RulesClient) TagRulesList(ctx context.Context, id MonitorId) (resp TagRulesListOperationResponse, err error) { + req, err := c.preparerForTagRulesList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "TagRulesList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "TagRulesList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForTagRulesList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "TagRulesList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForTagRulesList prepares the TagRulesList request. +func (c RulesClient) preparerForTagRulesList(ctx context.Context, id MonitorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/tagRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForTagRulesListWithNextLink prepares the TagRulesList request with the given nextLink token. +func (c RulesClient) preparerForTagRulesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForTagRulesList handles the response to the TagRulesList request. The method always +// closes the http.Response Body. +func (c RulesClient) responderForTagRulesList(resp *http.Response) (result TagRulesListOperationResponse, err error) { + type page struct { + Values []MonitoringTagRules `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result TagRulesListOperationResponse, err error) { + req, err := c.preparerForTagRulesListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "TagRulesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "TagRulesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForTagRulesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "TagRulesList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// TagRulesListComplete retrieves all of the results into a single object +func (c RulesClient) TagRulesListComplete(ctx context.Context, id MonitorId) (TagRulesListCompleteResult, error) { + return c.TagRulesListCompleteMatchingPredicate(ctx, id, MonitoringTagRulesOperationPredicate{}) +} + +// TagRulesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RulesClient) TagRulesListCompleteMatchingPredicate(ctx context.Context, id MonitorId, predicate MonitoringTagRulesOperationPredicate) (resp TagRulesListCompleteResult, err error) { + items := make([]MonitoringTagRules, 0) + + page, err := c.TagRulesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := TagRulesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/model_filteringtag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/model_filteringtag.go new file mode 100644 index 000000000000..e3a860d7a44b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/model_filteringtag.go @@ -0,0 +1,10 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FilteringTag struct { + Action *TagAction `json:"action,omitempty"` + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/model_logrules.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/model_logrules.go new file mode 100644 index 000000000000..092bd8ff1831 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/model_logrules.go @@ -0,0 +1,11 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogRules struct { + FilteringTags *[]FilteringTag `json:"filteringTags,omitempty"` + SendAadLogs *bool `json:"sendAadLogs,omitempty"` + SendResourceLogs *bool `json:"sendResourceLogs,omitempty"` + SendSubscriptionLogs *bool `json:"sendSubscriptionLogs,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/model_metricrules.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/model_metricrules.go new file mode 100644 index 000000000000..76e4a907e22d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/model_metricrules.go @@ -0,0 +1,8 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MetricRules struct { + FilteringTags *[]FilteringTag `json:"filteringTags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/model_monitoringtagrules.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/model_monitoringtagrules.go new file mode 100644 index 000000000000..fa5d37875844 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/model_monitoringtagrules.go @@ -0,0 +1,16 @@ +package rules + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoringTagRules struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *MonitoringTagRulesProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/model_monitoringtagrulesproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/model_monitoringtagrulesproperties.go new file mode 100644 index 000000000000..000d27abeff3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/model_monitoringtagrulesproperties.go @@ -0,0 +1,10 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoringTagRulesProperties struct { + LogRules *LogRules `json:"logRules,omitempty"` + MetricRules *MetricRules `json:"metricRules,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/predicates.go new file mode 100644 index 000000000000..7b4b95e3c7e3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/predicates.go @@ -0,0 +1,24 @@ +package rules + +type MonitoringTagRulesOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p MonitoringTagRulesOperationPredicate) Matches(input MonitoringTagRules) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/version.go new file mode 100644 index 000000000000..9cc99e8fb4d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules/version.go @@ -0,0 +1,12 @@ +package rules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/rules/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/README.md new file mode 100644 index 000000000000..25a97346eaaf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/README.md @@ -0,0 +1,70 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon` Documentation + +The `singlesignon` SDK allows for interaction with the Azure Resource Manager Service `datadog` (API Version `2021-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon" +``` + + +### Client Initialization + +```go +client := singlesignon.NewSingleSignOnClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SingleSignOnClient.ConfigurationsCreateOrUpdate` + +```go +ctx := context.TODO() +id := singlesignon.NewSingleSignOnConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "singleSignOnConfigurationValue") + +payload := singlesignon.DatadogSingleSignOnResource{ + // ... +} + + +if err := client.ConfigurationsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SingleSignOnClient.ConfigurationsGet` + +```go +ctx := context.TODO() +id := singlesignon.NewSingleSignOnConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "singleSignOnConfigurationValue") + +read, err := client.ConfigurationsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SingleSignOnClient.ConfigurationsList` + +```go +ctx := context.TODO() +id := singlesignon.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +// alternatively `client.ConfigurationsList(ctx, id)` can be used to do batched pagination +items, err := client.ConfigurationsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/client.go new file mode 100644 index 000000000000..9dcdb271cfdf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/client.go @@ -0,0 +1,18 @@ +package singlesignon + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SingleSignOnClient struct { + Client autorest.Client + baseUri string +} + +func NewSingleSignOnClientWithBaseURI(endpoint string) SingleSignOnClient { + return SingleSignOnClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/constants.go new file mode 100644 index 000000000000..1459b69070bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/constants.go @@ -0,0 +1,89 @@ +package singlesignon + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateNotSpecified), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "notspecified": ProvisioningStateNotSpecified, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type SingleSignOnStates string + +const ( + SingleSignOnStatesDisable SingleSignOnStates = "Disable" + SingleSignOnStatesEnable SingleSignOnStates = "Enable" + SingleSignOnStatesExisting SingleSignOnStates = "Existing" + SingleSignOnStatesInitial SingleSignOnStates = "Initial" +) + +func PossibleValuesForSingleSignOnStates() []string { + return []string{ + string(SingleSignOnStatesDisable), + string(SingleSignOnStatesEnable), + string(SingleSignOnStatesExisting), + string(SingleSignOnStatesInitial), + } +} + +func parseSingleSignOnStates(input string) (*SingleSignOnStates, error) { + vals := map[string]SingleSignOnStates{ + "disable": SingleSignOnStatesDisable, + "enable": SingleSignOnStatesEnable, + "existing": SingleSignOnStatesExisting, + "initial": SingleSignOnStatesInitial, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SingleSignOnStates(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/id_monitor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/id_monitor.go new file mode 100644 index 000000000000..8069a6cd9333 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/id_monitor.go @@ -0,0 +1,124 @@ +package singlesignon + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = MonitorId{} + +// MonitorId is a struct representing the Resource ID for a Monitor +type MonitorId struct { + SubscriptionId string + ResourceGroupName string + MonitorName string +} + +// NewMonitorID returns a new MonitorId struct +func NewMonitorID(subscriptionId string, resourceGroupName string, monitorName string) MonitorId { + return MonitorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MonitorName: monitorName, + } +} + +// ParseMonitorID parses 'input' into a MonitorId +func ParseMonitorID(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseMonitorIDInsensitively parses 'input' case-insensitively into a MonitorId +// note: this method should only be used for API response data and not user input +func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { + parser := resourceids.NewParserFromResourceIdType(MonitorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MonitorId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateMonitorID checks that 'input' can be parsed as a Monitor ID +func ValidateMonitorID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseMonitorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Monitor ID +func (id MonitorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Datadog/monitors/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Monitor ID +func (id MonitorId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDatadog", "Microsoft.Datadog", "Microsoft.Datadog"), + resourceids.StaticSegment("staticMonitors", "monitors", "monitors"), + resourceids.UserSpecifiedSegment("monitorName", "monitorValue"), + } +} + +// String returns a human-readable description of this Monitor ID +func (id MonitorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Monitor Name: %q", id.MonitorName), + } + return fmt.Sprintf("Monitor (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/id_singlesignonconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/id_singlesignonconfiguration.go new file mode 100644 index 000000000000..3cd2784652a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/id_singlesignonconfiguration.go @@ -0,0 +1,137 @@ +package singlesignon + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SingleSignOnConfigurationId{} + +// SingleSignOnConfigurationId is a struct representing the Resource ID for a Single Sign On Configuration +type SingleSignOnConfigurationId struct { + SubscriptionId string + ResourceGroupName string + MonitorName string + SingleSignOnConfigurationName string +} + +// NewSingleSignOnConfigurationID returns a new SingleSignOnConfigurationId struct +func NewSingleSignOnConfigurationID(subscriptionId string, resourceGroupName string, monitorName string, singleSignOnConfigurationName string) SingleSignOnConfigurationId { + return SingleSignOnConfigurationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MonitorName: monitorName, + SingleSignOnConfigurationName: singleSignOnConfigurationName, + } +} + +// ParseSingleSignOnConfigurationID parses 'input' into a SingleSignOnConfigurationId +func ParseSingleSignOnConfigurationID(input string) (*SingleSignOnConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(SingleSignOnConfigurationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SingleSignOnConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + if id.SingleSignOnConfigurationName, ok = parsed.Parsed["singleSignOnConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'singleSignOnConfigurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSingleSignOnConfigurationIDInsensitively parses 'input' case-insensitively into a SingleSignOnConfigurationId +// note: this method should only be used for API response data and not user input +func ParseSingleSignOnConfigurationIDInsensitively(input string) (*SingleSignOnConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(SingleSignOnConfigurationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SingleSignOnConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { + return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) + } + + if id.SingleSignOnConfigurationName, ok = parsed.Parsed["singleSignOnConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'singleSignOnConfigurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSingleSignOnConfigurationID checks that 'input' can be parsed as a Single Sign On Configuration ID +func ValidateSingleSignOnConfigurationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSingleSignOnConfigurationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Single Sign On Configuration ID +func (id SingleSignOnConfigurationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Datadog/monitors/%s/singleSignOnConfigurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName, id.SingleSignOnConfigurationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Single Sign On Configuration ID +func (id SingleSignOnConfigurationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDatadog", "Microsoft.Datadog", "Microsoft.Datadog"), + resourceids.StaticSegment("staticMonitors", "monitors", "monitors"), + resourceids.UserSpecifiedSegment("monitorName", "monitorValue"), + resourceids.StaticSegment("staticSingleSignOnConfigurations", "singleSignOnConfigurations", "singleSignOnConfigurations"), + resourceids.UserSpecifiedSegment("singleSignOnConfigurationName", "singleSignOnConfigurationValue"), + } +} + +// String returns a human-readable description of this Single Sign On Configuration ID +func (id SingleSignOnConfigurationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Monitor Name: %q", id.MonitorName), + fmt.Sprintf("Single Sign On Configuration Name: %q", id.SingleSignOnConfigurationName), + } + return fmt.Sprintf("Single Sign On Configuration (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/method_configurationscreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/method_configurationscreateorupdate_autorest.go new file mode 100644 index 000000000000..6fc4f22a9a87 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/method_configurationscreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package singlesignon + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationsCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ConfigurationsCreateOrUpdate ... +func (c SingleSignOnClient) ConfigurationsCreateOrUpdate(ctx context.Context, id SingleSignOnConfigurationId, input DatadogSingleSignOnResource) (result ConfigurationsCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForConfigurationsCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "singlesignon.SingleSignOnClient", "ConfigurationsCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForConfigurationsCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "singlesignon.SingleSignOnClient", "ConfigurationsCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ConfigurationsCreateOrUpdateThenPoll performs ConfigurationsCreateOrUpdate then polls until it's completed +func (c SingleSignOnClient) ConfigurationsCreateOrUpdateThenPoll(ctx context.Context, id SingleSignOnConfigurationId, input DatadogSingleSignOnResource) error { + result, err := c.ConfigurationsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ConfigurationsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ConfigurationsCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForConfigurationsCreateOrUpdate prepares the ConfigurationsCreateOrUpdate request. +func (c SingleSignOnClient) preparerForConfigurationsCreateOrUpdate(ctx context.Context, id SingleSignOnConfigurationId, input DatadogSingleSignOnResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForConfigurationsCreateOrUpdate sends the ConfigurationsCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c SingleSignOnClient) senderForConfigurationsCreateOrUpdate(ctx context.Context, req *http.Request) (future ConfigurationsCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/method_configurationsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/method_configurationsget_autorest.go new file mode 100644 index 000000000000..91edecfd35f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/method_configurationsget_autorest.go @@ -0,0 +1,68 @@ +package singlesignon + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationsGetOperationResponse struct { + HttpResponse *http.Response + Model *DatadogSingleSignOnResource +} + +// ConfigurationsGet ... +func (c SingleSignOnClient) ConfigurationsGet(ctx context.Context, id SingleSignOnConfigurationId) (result ConfigurationsGetOperationResponse, err error) { + req, err := c.preparerForConfigurationsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "singlesignon.SingleSignOnClient", "ConfigurationsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "singlesignon.SingleSignOnClient", "ConfigurationsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForConfigurationsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "singlesignon.SingleSignOnClient", "ConfigurationsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForConfigurationsGet prepares the ConfigurationsGet request. +func (c SingleSignOnClient) preparerForConfigurationsGet(ctx context.Context, id SingleSignOnConfigurationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForConfigurationsGet handles the response to the ConfigurationsGet request. The method always +// closes the http.Response Body. +func (c SingleSignOnClient) responderForConfigurationsGet(resp *http.Response) (result ConfigurationsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/method_configurationslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/method_configurationslist_autorest.go new file mode 100644 index 000000000000..520e3b5e14a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/method_configurationslist_autorest.go @@ -0,0 +1,186 @@ +package singlesignon + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationsListOperationResponse struct { + HttpResponse *http.Response + Model *[]DatadogSingleSignOnResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ConfigurationsListOperationResponse, error) +} + +type ConfigurationsListCompleteResult struct { + Items []DatadogSingleSignOnResource +} + +func (r ConfigurationsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ConfigurationsListOperationResponse) LoadMore(ctx context.Context) (resp ConfigurationsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ConfigurationsList ... +func (c SingleSignOnClient) ConfigurationsList(ctx context.Context, id MonitorId) (resp ConfigurationsListOperationResponse, err error) { + req, err := c.preparerForConfigurationsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "singlesignon.SingleSignOnClient", "ConfigurationsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "singlesignon.SingleSignOnClient", "ConfigurationsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForConfigurationsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "singlesignon.SingleSignOnClient", "ConfigurationsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForConfigurationsList prepares the ConfigurationsList request. +func (c SingleSignOnClient) preparerForConfigurationsList(ctx context.Context, id MonitorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/singleSignOnConfigurations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForConfigurationsListWithNextLink prepares the ConfigurationsList request with the given nextLink token. +func (c SingleSignOnClient) preparerForConfigurationsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForConfigurationsList handles the response to the ConfigurationsList request. The method always +// closes the http.Response Body. +func (c SingleSignOnClient) responderForConfigurationsList(resp *http.Response) (result ConfigurationsListOperationResponse, err error) { + type page struct { + Values []DatadogSingleSignOnResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ConfigurationsListOperationResponse, err error) { + req, err := c.preparerForConfigurationsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "singlesignon.SingleSignOnClient", "ConfigurationsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "singlesignon.SingleSignOnClient", "ConfigurationsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForConfigurationsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "singlesignon.SingleSignOnClient", "ConfigurationsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ConfigurationsListComplete retrieves all of the results into a single object +func (c SingleSignOnClient) ConfigurationsListComplete(ctx context.Context, id MonitorId) (ConfigurationsListCompleteResult, error) { + return c.ConfigurationsListCompleteMatchingPredicate(ctx, id, DatadogSingleSignOnResourceOperationPredicate{}) +} + +// ConfigurationsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SingleSignOnClient) ConfigurationsListCompleteMatchingPredicate(ctx context.Context, id MonitorId, predicate DatadogSingleSignOnResourceOperationPredicate) (resp ConfigurationsListCompleteResult, err error) { + items := make([]DatadogSingleSignOnResource, 0) + + page, err := c.ConfigurationsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ConfigurationsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/model_datadogsinglesignonproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/model_datadogsinglesignonproperties.go new file mode 100644 index 000000000000..106a6b056aca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/model_datadogsinglesignonproperties.go @@ -0,0 +1,11 @@ +package singlesignon + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatadogSingleSignOnProperties struct { + EnterpriseAppId *string `json:"enterpriseAppId,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + SingleSignOnState *SingleSignOnStates `json:"singleSignOnState,omitempty"` + SingleSignOnUrl *string `json:"singleSignOnUrl,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/model_datadogsinglesignonresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/model_datadogsinglesignonresource.go new file mode 100644 index 000000000000..8285ab578951 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/model_datadogsinglesignonresource.go @@ -0,0 +1,16 @@ +package singlesignon + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatadogSingleSignOnResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DatadogSingleSignOnProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/predicates.go new file mode 100644 index 000000000000..4e766acb6037 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/predicates.go @@ -0,0 +1,24 @@ +package singlesignon + +type DatadogSingleSignOnResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DatadogSingleSignOnResourceOperationPredicate) Matches(input DatadogSingleSignOnResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/version.go new file mode 100644 index 000000000000..00596ebe6838 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon/version.go @@ -0,0 +1,12 @@ +package singlesignon + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/singlesignon/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/README.md new file mode 100644 index 000000000000..c24a8ae16ccc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource` Documentation + +The `projectresource` SDK allows for interaction with the Azure Resource Manager Service `datamigration` (API Version `2018-04-19`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource" +``` + + +### Client Initialization + +```go +client := projectresource.NewProjectResourceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ProjectResourceClient.ProjectsCreateOrUpdate` + +```go +ctx := context.TODO() +id := projectresource.NewProjectID("12345678-1234-9876-4563-123456789012", "resourceGroupValue", "serviceValue", "projectValue") + +payload := projectresource.Project{ + // ... +} + + +read, err := client.ProjectsCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProjectResourceClient.ProjectsDelete` + +```go +ctx := context.TODO() +id := projectresource.NewProjectID("12345678-1234-9876-4563-123456789012", "resourceGroupValue", "serviceValue", "projectValue") + +read, err := client.ProjectsDelete(ctx, id, projectresource.DefaultProjectsDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProjectResourceClient.ProjectsGet` + +```go +ctx := context.TODO() +id := projectresource.NewProjectID("12345678-1234-9876-4563-123456789012", "resourceGroupValue", "serviceValue", "projectValue") + +read, err := client.ProjectsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProjectResourceClient.ProjectsListByResourceGroup` + +```go +ctx := context.TODO() +id := projectresource.NewServiceID("12345678-1234-9876-4563-123456789012", "resourceGroupValue", "serviceValue") + +// alternatively `client.ProjectsListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ProjectsListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ProjectResourceClient.ProjectsUpdate` + +```go +ctx := context.TODO() +id := projectresource.NewProjectID("12345678-1234-9876-4563-123456789012", "resourceGroupValue", "serviceValue", "projectValue") + +payload := projectresource.Project{ + // ... +} + + +read, err := client.ProjectsUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/client.go new file mode 100644 index 000000000000..cedbc4f0f6e0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/client.go @@ -0,0 +1,18 @@ +package projectresource + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProjectResourceClient struct { + Client autorest.Client + baseUri string +} + +func NewProjectResourceClientWithBaseURI(endpoint string) ProjectResourceClient { + return ProjectResourceClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/constants.go new file mode 100644 index 000000000000..3395ffa44363 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/constants.go @@ -0,0 +1,90 @@ +package projectresource + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProjectProvisioningState string + +const ( + ProjectProvisioningStateDeleting ProjectProvisioningState = "Deleting" + ProjectProvisioningStateSucceeded ProjectProvisioningState = "Succeeded" +) + +func PossibleValuesForProjectProvisioningState() []string { + return []string{ + string(ProjectProvisioningStateDeleting), + string(ProjectProvisioningStateSucceeded), + } +} + +func parseProjectProvisioningState(input string) (*ProjectProvisioningState, error) { + vals := map[string]ProjectProvisioningState{ + "deleting": ProjectProvisioningStateDeleting, + "succeeded": ProjectProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProjectProvisioningState(input) + return &out, nil +} + +type ProjectSourcePlatform string + +const ( + ProjectSourcePlatformSQL ProjectSourcePlatform = "SQL" + ProjectSourcePlatformUnknown ProjectSourcePlatform = "Unknown" +) + +func PossibleValuesForProjectSourcePlatform() []string { + return []string{ + string(ProjectSourcePlatformSQL), + string(ProjectSourcePlatformUnknown), + } +} + +func parseProjectSourcePlatform(input string) (*ProjectSourcePlatform, error) { + vals := map[string]ProjectSourcePlatform{ + "sql": ProjectSourcePlatformSQL, + "unknown": ProjectSourcePlatformUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProjectSourcePlatform(input) + return &out, nil +} + +type ProjectTargetPlatform string + +const ( + ProjectTargetPlatformSQLDB ProjectTargetPlatform = "SQLDB" + ProjectTargetPlatformUnknown ProjectTargetPlatform = "Unknown" +) + +func PossibleValuesForProjectTargetPlatform() []string { + return []string{ + string(ProjectTargetPlatformSQLDB), + string(ProjectTargetPlatformUnknown), + } +} + +func parseProjectTargetPlatform(input string) (*ProjectTargetPlatform, error) { + vals := map[string]ProjectTargetPlatform{ + "sqldb": ProjectTargetPlatformSQLDB, + "unknown": ProjectTargetPlatformUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProjectTargetPlatform(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/id_project.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/id_project.go new file mode 100644 index 000000000000..f897acd64bf9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/id_project.go @@ -0,0 +1,137 @@ +package projectresource + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ProjectId{} + +// ProjectId is a struct representing the Resource ID for a Project +type ProjectId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ProjectName string +} + +// NewProjectID returns a new ProjectId struct +func NewProjectID(subscriptionId string, resourceGroupName string, serviceName string, projectName string) ProjectId { + return ProjectId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ProjectName: projectName, + } +} + +// ParseProjectID parses 'input' into a ProjectId +func ParseProjectID(input string) (*ProjectId, error) { + parser := resourceids.NewParserFromResourceIdType(ProjectId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProjectId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, fmt.Errorf("the segment 'serviceName' was not found in the resource id %q", input) + } + + if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { + return nil, fmt.Errorf("the segment 'projectName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseProjectIDInsensitively parses 'input' case-insensitively into a ProjectId +// note: this method should only be used for API response data and not user input +func ParseProjectIDInsensitively(input string) (*ProjectId, error) { + parser := resourceids.NewParserFromResourceIdType(ProjectId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProjectId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, fmt.Errorf("the segment 'serviceName' was not found in the resource id %q", input) + } + + if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { + return nil, fmt.Errorf("the segment 'projectName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateProjectID checks that 'input' can be parsed as a Project ID +func ValidateProjectID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProjectID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Project ID +func (id ProjectId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataMigration/services/%s/projects/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ProjectName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Project ID +func (id ProjectId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.UserSpecifiedSegment("resourceGroupName", "resourceGroupValue"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataMigration", "Microsoft.DataMigration", "Microsoft.DataMigration"), + resourceids.StaticSegment("staticServices", "services", "services"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticProjects", "projects", "projects"), + resourceids.UserSpecifiedSegment("projectName", "projectValue"), + } +} + +// String returns a human-readable description of this Project ID +func (id ProjectId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Project Name: %q", id.ProjectName), + } + return fmt.Sprintf("Project (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/id_service.go new file mode 100644 index 000000000000..82a2aba37d95 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/id_service.go @@ -0,0 +1,124 @@ +package projectresource + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, fmt.Errorf("the segment 'serviceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, fmt.Errorf("the segment 'serviceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataMigration/services/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.UserSpecifiedSegment("resourceGroupName", "resourceGroupValue"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataMigration", "Microsoft.DataMigration", "Microsoft.DataMigration"), + resourceids.StaticSegment("staticServices", "services", "services"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/method_projectscreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/method_projectscreateorupdate_autorest.go new file mode 100644 index 000000000000..27401f2aa374 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/method_projectscreateorupdate_autorest.go @@ -0,0 +1,69 @@ +package projectresource + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProjectsCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Project +} + +// ProjectsCreateOrUpdate ... +func (c ProjectResourceClient) ProjectsCreateOrUpdate(ctx context.Context, id ProjectId, input Project) (result ProjectsCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForProjectsCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsCreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForProjectsCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsCreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForProjectsCreateOrUpdate prepares the ProjectsCreateOrUpdate request. +func (c ProjectResourceClient) preparerForProjectsCreateOrUpdate(ctx context.Context, id ProjectId, input Project) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForProjectsCreateOrUpdate handles the response to the ProjectsCreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ProjectResourceClient) responderForProjectsCreateOrUpdate(resp *http.Response) (result ProjectsCreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/method_projectsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/method_projectsdelete_autorest.go new file mode 100644 index 000000000000..56aa2827f1ba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/method_projectsdelete_autorest.go @@ -0,0 +1,95 @@ +package projectresource + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProjectsDeleteOperationResponse struct { + HttpResponse *http.Response +} + +type ProjectsDeleteOperationOptions struct { + DeleteRunningTasks *bool +} + +func DefaultProjectsDeleteOperationOptions() ProjectsDeleteOperationOptions { + return ProjectsDeleteOperationOptions{} +} + +func (o ProjectsDeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ProjectsDeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.DeleteRunningTasks != nil { + out["deleteRunningTasks"] = *o.DeleteRunningTasks + } + + return out +} + +// ProjectsDelete ... +func (c ProjectResourceClient) ProjectsDelete(ctx context.Context, id ProjectId, options ProjectsDeleteOperationOptions) (result ProjectsDeleteOperationResponse, err error) { + req, err := c.preparerForProjectsDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForProjectsDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForProjectsDelete prepares the ProjectsDelete request. +func (c ProjectResourceClient) preparerForProjectsDelete(ctx context.Context, id ProjectId, options ProjectsDeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForProjectsDelete handles the response to the ProjectsDelete request. The method always +// closes the http.Response Body. +func (c ProjectResourceClient) responderForProjectsDelete(resp *http.Response) (result ProjectsDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/method_projectsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/method_projectsget_autorest.go new file mode 100644 index 000000000000..0e0d04707b8b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/method_projectsget_autorest.go @@ -0,0 +1,68 @@ +package projectresource + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProjectsGetOperationResponse struct { + HttpResponse *http.Response + Model *Project +} + +// ProjectsGet ... +func (c ProjectResourceClient) ProjectsGet(ctx context.Context, id ProjectId) (result ProjectsGetOperationResponse, err error) { + req, err := c.preparerForProjectsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForProjectsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForProjectsGet prepares the ProjectsGet request. +func (c ProjectResourceClient) preparerForProjectsGet(ctx context.Context, id ProjectId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForProjectsGet handles the response to the ProjectsGet request. The method always +// closes the http.Response Body. +func (c ProjectResourceClient) responderForProjectsGet(resp *http.Response) (result ProjectsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/method_projectslistbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/method_projectslistbyresourcegroup_autorest.go new file mode 100644 index 000000000000..1bd76e9232f5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/method_projectslistbyresourcegroup_autorest.go @@ -0,0 +1,186 @@ +package projectresource + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProjectsListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Project + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ProjectsListByResourceGroupOperationResponse, error) +} + +type ProjectsListByResourceGroupCompleteResult struct { + Items []Project +} + +func (r ProjectsListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ProjectsListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ProjectsListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ProjectsListByResourceGroup ... +func (c ProjectResourceClient) ProjectsListByResourceGroup(ctx context.Context, id ServiceId) (resp ProjectsListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForProjectsListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForProjectsListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForProjectsListByResourceGroup prepares the ProjectsListByResourceGroup request. +func (c ProjectResourceClient) preparerForProjectsListByResourceGroup(ctx context.Context, id ServiceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/projects", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForProjectsListByResourceGroupWithNextLink prepares the ProjectsListByResourceGroup request with the given nextLink token. +func (c ProjectResourceClient) preparerForProjectsListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForProjectsListByResourceGroup handles the response to the ProjectsListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ProjectResourceClient) responderForProjectsListByResourceGroup(resp *http.Response) (result ProjectsListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Project `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ProjectsListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForProjectsListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForProjectsListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ProjectsListByResourceGroupComplete retrieves all of the results into a single object +func (c ProjectResourceClient) ProjectsListByResourceGroupComplete(ctx context.Context, id ServiceId) (ProjectsListByResourceGroupCompleteResult, error) { + return c.ProjectsListByResourceGroupCompleteMatchingPredicate(ctx, id, ProjectOperationPredicate{}) +} + +// ProjectsListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ProjectResourceClient) ProjectsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate ProjectOperationPredicate) (resp ProjectsListByResourceGroupCompleteResult, err error) { + items := make([]Project, 0) + + page, err := c.ProjectsListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ProjectsListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/method_projectsupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/method_projectsupdate_autorest.go new file mode 100644 index 000000000000..a2e2b3ac806e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/method_projectsupdate_autorest.go @@ -0,0 +1,69 @@ +package projectresource + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProjectsUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Project +} + +// ProjectsUpdate ... +func (c ProjectResourceClient) ProjectsUpdate(ctx context.Context, id ProjectId, input Project) (result ProjectsUpdateOperationResponse, err error) { + req, err := c.preparerForProjectsUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForProjectsUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "projectresource.ProjectResourceClient", "ProjectsUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForProjectsUpdate prepares the ProjectsUpdate request. +func (c ProjectResourceClient) preparerForProjectsUpdate(ctx context.Context, id ProjectId, input Project) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForProjectsUpdate handles the response to the ProjectsUpdate request. The method always +// closes the http.Response Body. +func (c ProjectResourceClient) responderForProjectsUpdate(resp *http.Response) (result ProjectsUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/model_connectioninfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/model_connectioninfo.go new file mode 100644 index 000000000000..63f80a0c09a7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/model_connectioninfo.go @@ -0,0 +1,10 @@ +package projectresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectionInfo struct { + Password *string `json:"password,omitempty"` + Type string `json:"type"` + UserName *string `json:"userName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/model_databaseinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/model_databaseinfo.go new file mode 100644 index 000000000000..3c6987ed6701 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/model_databaseinfo.go @@ -0,0 +1,8 @@ +package projectresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseInfo struct { + SourceDatabaseName string `json:"sourceDatabaseName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/model_project.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/model_project.go new file mode 100644 index 000000000000..a683e6652f11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/model_project.go @@ -0,0 +1,13 @@ +package projectresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Project struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ProjectProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/model_projectproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/model_projectproperties.go new file mode 100644 index 000000000000..6a63778da1ad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/model_projectproperties.go @@ -0,0 +1,32 @@ +package projectresource + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProjectProperties struct { + CreationTime *string `json:"creationTime,omitempty"` + DatabasesInfo *[]DatabaseInfo `json:"databasesInfo,omitempty"` + ProvisioningState *ProjectProvisioningState `json:"provisioningState,omitempty"` + SourceConnectionInfo *ConnectionInfo `json:"sourceConnectionInfo,omitempty"` + SourcePlatform ProjectSourcePlatform `json:"sourcePlatform"` + TargetConnectionInfo *ConnectionInfo `json:"targetConnectionInfo,omitempty"` + TargetPlatform ProjectTargetPlatform `json:"targetPlatform"` +} + +func (o *ProjectProperties) GetCreationTimeAsTime() (*time.Time, error) { + if o.CreationTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreationTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ProjectProperties) SetCreationTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreationTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/predicates.go new file mode 100644 index 000000000000..b2f13623979f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/predicates.go @@ -0,0 +1,29 @@ +package projectresource + +type ProjectOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ProjectOperationPredicate) Matches(input Project) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/version.go new file mode 100644 index 000000000000..79d19c463ff8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource/version.go @@ -0,0 +1,12 @@ +package projectresource + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-04-19" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/projectresource/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/README.md new file mode 100644 index 000000000000..0e5888175f3a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/README.md @@ -0,0 +1,190 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource` Documentation + +The `serviceresource` SDK allows for interaction with the Azure Resource Manager Service `datamigration` (API Version `2018-04-19`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource" +``` + + +### Client Initialization + +```go +client := serviceresource.NewServiceResourceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServiceResourceClient.ServicesCheckStatus` + +```go +ctx := context.TODO() +id := serviceresource.NewServiceID("12345678-1234-9876-4563-123456789012", "resourceGroupValue", "serviceValue") + +read, err := client.ServicesCheckStatus(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServiceResourceClient.ServicesCreateOrUpdate` + +```go +ctx := context.TODO() +id := serviceresource.NewServiceID("12345678-1234-9876-4563-123456789012", "resourceGroupValue", "serviceValue") + +payload := serviceresource.DataMigrationService{ + // ... +} + + +if err := client.ServicesCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServiceResourceClient.ServicesDelete` + +```go +ctx := context.TODO() +id := serviceresource.NewServiceID("12345678-1234-9876-4563-123456789012", "resourceGroupValue", "serviceValue") + +if err := client.ServicesDeleteThenPoll(ctx, id, serviceresource.DefaultServicesDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServiceResourceClient.ServicesGet` + +```go +ctx := context.TODO() +id := serviceresource.NewServiceID("12345678-1234-9876-4563-123456789012", "resourceGroupValue", "serviceValue") + +read, err := client.ServicesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServiceResourceClient.ServicesList` + +```go +ctx := context.TODO() +id := serviceresource.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ServicesList(ctx, id)` can be used to do batched pagination +items, err := client.ServicesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ServiceResourceClient.ServicesListByResourceGroup` + +```go +ctx := context.TODO() +id := serviceresource.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "resourceGroupValue") + +// alternatively `client.ServicesListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ServicesListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ServiceResourceClient.ServicesListSkus` + +```go +ctx := context.TODO() +id := serviceresource.NewServiceID("12345678-1234-9876-4563-123456789012", "resourceGroupValue", "serviceValue") + +// alternatively `client.ServicesListSkus(ctx, id)` can be used to do batched pagination +items, err := client.ServicesListSkusComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ServiceResourceClient.ServicesStart` + +```go +ctx := context.TODO() +id := serviceresource.NewServiceID("12345678-1234-9876-4563-123456789012", "resourceGroupValue", "serviceValue") + +if err := client.ServicesStartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServiceResourceClient.ServicesStop` + +```go +ctx := context.TODO() +id := serviceresource.NewServiceID("12345678-1234-9876-4563-123456789012", "resourceGroupValue", "serviceValue") + +if err := client.ServicesStopThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServiceResourceClient.ServicesUpdate` + +```go +ctx := context.TODO() +id := serviceresource.NewServiceID("12345678-1234-9876-4563-123456789012", "resourceGroupValue", "serviceValue") + +payload := serviceresource.DataMigrationService{ + // ... +} + + +if err := client.ServicesUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServiceResourceClient.TasksList` + +```go +ctx := context.TODO() +id := serviceresource.NewProjectID("12345678-1234-9876-4563-123456789012", "resourceGroupValue", "serviceValue", "projectValue") + +// alternatively `client.TasksList(ctx, id, serviceresource.DefaultTasksListOperationOptions())` can be used to do batched pagination +items, err := client.TasksListComplete(ctx, id, serviceresource.DefaultTasksListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/client.go new file mode 100644 index 000000000000..206d5e35e013 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/client.go @@ -0,0 +1,18 @@ +package serviceresource + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceResourceClient struct { + Client autorest.Client + baseUri string +} + +func NewServiceResourceClientWithBaseURI(endpoint string) ServiceResourceClient { + return ServiceResourceClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/constants.go new file mode 100644 index 000000000000..9092db14795a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/constants.go @@ -0,0 +1,172 @@ +package serviceresource + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CommandState string + +const ( + CommandStateAccepted CommandState = "Accepted" + CommandStateFailed CommandState = "Failed" + CommandStateRunning CommandState = "Running" + CommandStateSucceeded CommandState = "Succeeded" + CommandStateUnknown CommandState = "Unknown" +) + +func PossibleValuesForCommandState() []string { + return []string{ + string(CommandStateAccepted), + string(CommandStateFailed), + string(CommandStateRunning), + string(CommandStateSucceeded), + string(CommandStateUnknown), + } +} + +func parseCommandState(input string) (*CommandState, error) { + vals := map[string]CommandState{ + "accepted": CommandStateAccepted, + "failed": CommandStateFailed, + "running": CommandStateRunning, + "succeeded": CommandStateSucceeded, + "unknown": CommandStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CommandState(input) + return &out, nil +} + +type ServiceProvisioningState string + +const ( + ServiceProvisioningStateAccepted ServiceProvisioningState = "Accepted" + ServiceProvisioningStateDeleting ServiceProvisioningState = "Deleting" + ServiceProvisioningStateDeploying ServiceProvisioningState = "Deploying" + ServiceProvisioningStateFailed ServiceProvisioningState = "Failed" + ServiceProvisioningStateFailedToStart ServiceProvisioningState = "FailedToStart" + ServiceProvisioningStateFailedToStop ServiceProvisioningState = "FailedToStop" + ServiceProvisioningStateStarting ServiceProvisioningState = "Starting" + ServiceProvisioningStateStopped ServiceProvisioningState = "Stopped" + ServiceProvisioningStateStopping ServiceProvisioningState = "Stopping" + ServiceProvisioningStateSucceeded ServiceProvisioningState = "Succeeded" +) + +func PossibleValuesForServiceProvisioningState() []string { + return []string{ + string(ServiceProvisioningStateAccepted), + string(ServiceProvisioningStateDeleting), + string(ServiceProvisioningStateDeploying), + string(ServiceProvisioningStateFailed), + string(ServiceProvisioningStateFailedToStart), + string(ServiceProvisioningStateFailedToStop), + string(ServiceProvisioningStateStarting), + string(ServiceProvisioningStateStopped), + string(ServiceProvisioningStateStopping), + string(ServiceProvisioningStateSucceeded), + } +} + +func parseServiceProvisioningState(input string) (*ServiceProvisioningState, error) { + vals := map[string]ServiceProvisioningState{ + "accepted": ServiceProvisioningStateAccepted, + "deleting": ServiceProvisioningStateDeleting, + "deploying": ServiceProvisioningStateDeploying, + "failed": ServiceProvisioningStateFailed, + "failedtostart": ServiceProvisioningStateFailedToStart, + "failedtostop": ServiceProvisioningStateFailedToStop, + "starting": ServiceProvisioningStateStarting, + "stopped": ServiceProvisioningStateStopped, + "stopping": ServiceProvisioningStateStopping, + "succeeded": ServiceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServiceProvisioningState(input) + return &out, nil +} + +type ServiceScalability string + +const ( + ServiceScalabilityAutomatic ServiceScalability = "automatic" + ServiceScalabilityManual ServiceScalability = "manual" + ServiceScalabilityNone ServiceScalability = "none" +) + +func PossibleValuesForServiceScalability() []string { + return []string{ + string(ServiceScalabilityAutomatic), + string(ServiceScalabilityManual), + string(ServiceScalabilityNone), + } +} + +func parseServiceScalability(input string) (*ServiceScalability, error) { + vals := map[string]ServiceScalability{ + "automatic": ServiceScalabilityAutomatic, + "manual": ServiceScalabilityManual, + "none": ServiceScalabilityNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServiceScalability(input) + return &out, nil +} + +type TaskState string + +const ( + TaskStateCanceled TaskState = "Canceled" + TaskStateFailed TaskState = "Failed" + TaskStateFailedInputValidation TaskState = "FailedInputValidation" + TaskStateFaulted TaskState = "Faulted" + TaskStateQueued TaskState = "Queued" + TaskStateRunning TaskState = "Running" + TaskStateSucceeded TaskState = "Succeeded" + TaskStateUnknown TaskState = "Unknown" +) + +func PossibleValuesForTaskState() []string { + return []string{ + string(TaskStateCanceled), + string(TaskStateFailed), + string(TaskStateFailedInputValidation), + string(TaskStateFaulted), + string(TaskStateQueued), + string(TaskStateRunning), + string(TaskStateSucceeded), + string(TaskStateUnknown), + } +} + +func parseTaskState(input string) (*TaskState, error) { + vals := map[string]TaskState{ + "canceled": TaskStateCanceled, + "failed": TaskStateFailed, + "failedinputvalidation": TaskStateFailedInputValidation, + "faulted": TaskStateFaulted, + "queued": TaskStateQueued, + "running": TaskStateRunning, + "succeeded": TaskStateSucceeded, + "unknown": TaskStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TaskState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/id_project.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/id_project.go new file mode 100644 index 000000000000..e7fd5999c652 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/id_project.go @@ -0,0 +1,137 @@ +package serviceresource + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ProjectId{} + +// ProjectId is a struct representing the Resource ID for a Project +type ProjectId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string + ProjectName string +} + +// NewProjectID returns a new ProjectId struct +func NewProjectID(subscriptionId string, resourceGroupName string, serviceName string, projectName string) ProjectId { + return ProjectId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + ProjectName: projectName, + } +} + +// ParseProjectID parses 'input' into a ProjectId +func ParseProjectID(input string) (*ProjectId, error) { + parser := resourceids.NewParserFromResourceIdType(ProjectId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProjectId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, fmt.Errorf("the segment 'serviceName' was not found in the resource id %q", input) + } + + if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { + return nil, fmt.Errorf("the segment 'projectName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseProjectIDInsensitively parses 'input' case-insensitively into a ProjectId +// note: this method should only be used for API response data and not user input +func ParseProjectIDInsensitively(input string) (*ProjectId, error) { + parser := resourceids.NewParserFromResourceIdType(ProjectId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProjectId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, fmt.Errorf("the segment 'serviceName' was not found in the resource id %q", input) + } + + if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { + return nil, fmt.Errorf("the segment 'projectName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateProjectID checks that 'input' can be parsed as a Project ID +func ValidateProjectID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProjectID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Project ID +func (id ProjectId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataMigration/services/%s/projects/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName, id.ProjectName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Project ID +func (id ProjectId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.UserSpecifiedSegment("resourceGroupName", "resourceGroupValue"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataMigration", "Microsoft.DataMigration", "Microsoft.DataMigration"), + resourceids.StaticSegment("staticServices", "services", "services"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + resourceids.StaticSegment("staticProjects", "projects", "projects"), + resourceids.UserSpecifiedSegment("projectName", "projectValue"), + } +} + +// String returns a human-readable description of this Project ID +func (id ProjectId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + fmt.Sprintf("Project Name: %q", id.ProjectName), + } + return fmt.Sprintf("Project (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/id_resourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/id_resourcegroup.go new file mode 100644 index 000000000000..5a8c38ec2ee2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/id_resourcegroup.go @@ -0,0 +1,109 @@ +package serviceresource + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ResourceGroupId{} + +// ResourceGroupId is a struct representing the Resource ID for a Resource Group +type ResourceGroupId struct { + SubscriptionId string + ResourceGroupName string +} + +// NewResourceGroupID returns a new ResourceGroupId struct +func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { + return ResourceGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + } +} + +// ParseResourceGroupID parses 'input' into a ResourceGroupId +func ParseResourceGroupID(input string) (*ResourceGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ResourceGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId +// note: this method should only be used for API response data and not user input +func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ResourceGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID +func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseResourceGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Resource Group ID +func (id ResourceGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID +func (id ResourceGroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.UserSpecifiedSegment("resourceGroupName", "resourceGroupValue"), + } +} + +// String returns a human-readable description of this Resource Group ID +func (id ResourceGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + } + return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/id_service.go new file mode 100644 index 000000000000..ff6856cc0b36 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/id_service.go @@ -0,0 +1,124 @@ +package serviceresource + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, fmt.Errorf("the segment 'serviceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, fmt.Errorf("the segment 'serviceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataMigration/services/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.UserSpecifiedSegment("resourceGroupName", "resourceGroupValue"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataMigration", "Microsoft.DataMigration", "Microsoft.DataMigration"), + resourceids.StaticSegment("staticServices", "services", "services"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicescheckstatus_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicescheckstatus_autorest.go new file mode 100644 index 000000000000..acb4ef901ba1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicescheckstatus_autorest.go @@ -0,0 +1,69 @@ +package serviceresource + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesCheckStatusOperationResponse struct { + HttpResponse *http.Response + Model *DataMigrationServiceStatusResponse +} + +// ServicesCheckStatus ... +func (c ServiceResourceClient) ServicesCheckStatus(ctx context.Context, id ServiceId) (result ServicesCheckStatusOperationResponse, err error) { + req, err := c.preparerForServicesCheckStatus(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesCheckStatus", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesCheckStatus", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForServicesCheckStatus(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesCheckStatus", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForServicesCheckStatus prepares the ServicesCheckStatus request. +func (c ServiceResourceClient) preparerForServicesCheckStatus(ctx context.Context, id ServiceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/checkStatus", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForServicesCheckStatus handles the response to the ServicesCheckStatus request. The method always +// closes the http.Response Body. +func (c ServiceResourceClient) responderForServicesCheckStatus(resp *http.Response) (result ServicesCheckStatusOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicescreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicescreateorupdate_autorest.go new file mode 100644 index 000000000000..2404222f5db1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicescreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package serviceresource + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ServicesCreateOrUpdate ... +func (c ServiceResourceClient) ServicesCreateOrUpdate(ctx context.Context, id ServiceId, input DataMigrationService) (result ServicesCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForServicesCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForServicesCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ServicesCreateOrUpdateThenPoll performs ServicesCreateOrUpdate then polls until it's completed +func (c ServiceResourceClient) ServicesCreateOrUpdateThenPoll(ctx context.Context, id ServiceId, input DataMigrationService) error { + result, err := c.ServicesCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ServicesCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ServicesCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForServicesCreateOrUpdate prepares the ServicesCreateOrUpdate request. +func (c ServiceResourceClient) preparerForServicesCreateOrUpdate(ctx context.Context, id ServiceId, input DataMigrationService) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForServicesCreateOrUpdate sends the ServicesCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ServiceResourceClient) senderForServicesCreateOrUpdate(ctx context.Context, req *http.Request) (future ServicesCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicesdelete_autorest.go new file mode 100644 index 000000000000..504d77eaefba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicesdelete_autorest.go @@ -0,0 +1,107 @@ +package serviceresource + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type ServicesDeleteOperationOptions struct { + DeleteRunningTasks *bool +} + +func DefaultServicesDeleteOperationOptions() ServicesDeleteOperationOptions { + return ServicesDeleteOperationOptions{} +} + +func (o ServicesDeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ServicesDeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.DeleteRunningTasks != nil { + out["deleteRunningTasks"] = *o.DeleteRunningTasks + } + + return out +} + +// ServicesDelete ... +func (c ServiceResourceClient) ServicesDelete(ctx context.Context, id ServiceId, options ServicesDeleteOperationOptions) (result ServicesDeleteOperationResponse, err error) { + req, err := c.preparerForServicesDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForServicesDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ServicesDeleteThenPoll performs ServicesDelete then polls until it's completed +func (c ServiceResourceClient) ServicesDeleteThenPoll(ctx context.Context, id ServiceId, options ServicesDeleteOperationOptions) error { + result, err := c.ServicesDelete(ctx, id, options) + if err != nil { + return fmt.Errorf("performing ServicesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ServicesDelete: %+v", err) + } + + return nil +} + +// preparerForServicesDelete prepares the ServicesDelete request. +func (c ServiceResourceClient) preparerForServicesDelete(ctx context.Context, id ServiceId, options ServicesDeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForServicesDelete sends the ServicesDelete request. The method will close the +// http.Response Body if it receives an error. +func (c ServiceResourceClient) senderForServicesDelete(ctx context.Context, req *http.Request) (future ServicesDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicesget_autorest.go new file mode 100644 index 000000000000..91b43b53b3a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicesget_autorest.go @@ -0,0 +1,68 @@ +package serviceresource + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesGetOperationResponse struct { + HttpResponse *http.Response + Model *DataMigrationService +} + +// ServicesGet ... +func (c ServiceResourceClient) ServicesGet(ctx context.Context, id ServiceId) (result ServicesGetOperationResponse, err error) { + req, err := c.preparerForServicesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForServicesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForServicesGet prepares the ServicesGet request. +func (c ServiceResourceClient) preparerForServicesGet(ctx context.Context, id ServiceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForServicesGet handles the response to the ServicesGet request. The method always +// closes the http.Response Body. +func (c ServiceResourceClient) responderForServicesGet(resp *http.Response) (result ServicesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_serviceslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_serviceslist_autorest.go new file mode 100644 index 000000000000..997df11a1db8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_serviceslist_autorest.go @@ -0,0 +1,187 @@ +package serviceresource + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesListOperationResponse struct { + HttpResponse *http.Response + Model *[]DataMigrationService + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ServicesListOperationResponse, error) +} + +type ServicesListCompleteResult struct { + Items []DataMigrationService +} + +func (r ServicesListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ServicesListOperationResponse) LoadMore(ctx context.Context) (resp ServicesListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ServicesList ... +func (c ServiceResourceClient) ServicesList(ctx context.Context, id commonids.SubscriptionId) (resp ServicesListOperationResponse, err error) { + req, err := c.preparerForServicesList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForServicesList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForServicesList prepares the ServicesList request. +func (c ServiceResourceClient) preparerForServicesList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DataMigration/services", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForServicesListWithNextLink prepares the ServicesList request with the given nextLink token. +func (c ServiceResourceClient) preparerForServicesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForServicesList handles the response to the ServicesList request. The method always +// closes the http.Response Body. +func (c ServiceResourceClient) responderForServicesList(resp *http.Response) (result ServicesListOperationResponse, err error) { + type page struct { + Values []DataMigrationService `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ServicesListOperationResponse, err error) { + req, err := c.preparerForServicesListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForServicesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ServicesListComplete retrieves all of the results into a single object +func (c ServiceResourceClient) ServicesListComplete(ctx context.Context, id commonids.SubscriptionId) (ServicesListCompleteResult, error) { + return c.ServicesListCompleteMatchingPredicate(ctx, id, DataMigrationServiceOperationPredicate{}) +} + +// ServicesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ServiceResourceClient) ServicesListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DataMigrationServiceOperationPredicate) (resp ServicesListCompleteResult, err error) { + items := make([]DataMigrationService, 0) + + page, err := c.ServicesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ServicesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_serviceslistbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_serviceslistbyresourcegroup_autorest.go new file mode 100644 index 000000000000..56f8d42c1128 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_serviceslistbyresourcegroup_autorest.go @@ -0,0 +1,186 @@ +package serviceresource + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]DataMigrationService + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ServicesListByResourceGroupOperationResponse, error) +} + +type ServicesListByResourceGroupCompleteResult struct { + Items []DataMigrationService +} + +func (r ServicesListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ServicesListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ServicesListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ServicesListByResourceGroup ... +func (c ServiceResourceClient) ServicesListByResourceGroup(ctx context.Context, id ResourceGroupId) (resp ServicesListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForServicesListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForServicesListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForServicesListByResourceGroup prepares the ServicesListByResourceGroup request. +func (c ServiceResourceClient) preparerForServicesListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DataMigration/services", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForServicesListByResourceGroupWithNextLink prepares the ServicesListByResourceGroup request with the given nextLink token. +func (c ServiceResourceClient) preparerForServicesListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForServicesListByResourceGroup handles the response to the ServicesListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ServiceResourceClient) responderForServicesListByResourceGroup(resp *http.Response) (result ServicesListByResourceGroupOperationResponse, err error) { + type page struct { + Values []DataMigrationService `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ServicesListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForServicesListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForServicesListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ServicesListByResourceGroupComplete retrieves all of the results into a single object +func (c ServiceResourceClient) ServicesListByResourceGroupComplete(ctx context.Context, id ResourceGroupId) (ServicesListByResourceGroupCompleteResult, error) { + return c.ServicesListByResourceGroupCompleteMatchingPredicate(ctx, id, DataMigrationServiceOperationPredicate{}) +} + +// ServicesListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ServiceResourceClient) ServicesListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate DataMigrationServiceOperationPredicate) (resp ServicesListByResourceGroupCompleteResult, err error) { + items := make([]DataMigrationService, 0) + + page, err := c.ServicesListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ServicesListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_serviceslistskus_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_serviceslistskus_autorest.go new file mode 100644 index 000000000000..487412539681 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_serviceslistskus_autorest.go @@ -0,0 +1,186 @@ +package serviceresource + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesListSkusOperationResponse struct { + HttpResponse *http.Response + Model *[]AvailableServiceSku + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ServicesListSkusOperationResponse, error) +} + +type ServicesListSkusCompleteResult struct { + Items []AvailableServiceSku +} + +func (r ServicesListSkusOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ServicesListSkusOperationResponse) LoadMore(ctx context.Context) (resp ServicesListSkusOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ServicesListSkus ... +func (c ServiceResourceClient) ServicesListSkus(ctx context.Context, id ServiceId) (resp ServicesListSkusOperationResponse, err error) { + req, err := c.preparerForServicesListSkus(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesListSkus", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesListSkus", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForServicesListSkus(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesListSkus", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForServicesListSkus prepares the ServicesListSkus request. +func (c ServiceResourceClient) preparerForServicesListSkus(ctx context.Context, id ServiceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/skus", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForServicesListSkusWithNextLink prepares the ServicesListSkus request with the given nextLink token. +func (c ServiceResourceClient) preparerForServicesListSkusWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForServicesListSkus handles the response to the ServicesListSkus request. The method always +// closes the http.Response Body. +func (c ServiceResourceClient) responderForServicesListSkus(resp *http.Response) (result ServicesListSkusOperationResponse, err error) { + type page struct { + Values []AvailableServiceSku `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ServicesListSkusOperationResponse, err error) { + req, err := c.preparerForServicesListSkusWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesListSkus", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesListSkus", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForServicesListSkus(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesListSkus", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ServicesListSkusComplete retrieves all of the results into a single object +func (c ServiceResourceClient) ServicesListSkusComplete(ctx context.Context, id ServiceId) (ServicesListSkusCompleteResult, error) { + return c.ServicesListSkusCompleteMatchingPredicate(ctx, id, AvailableServiceSkuOperationPredicate{}) +} + +// ServicesListSkusCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ServiceResourceClient) ServicesListSkusCompleteMatchingPredicate(ctx context.Context, id ServiceId, predicate AvailableServiceSkuOperationPredicate) (resp ServicesListSkusCompleteResult, err error) { + items := make([]AvailableServiceSku, 0) + + page, err := c.ServicesListSkus(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ServicesListSkusCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicesstart_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicesstart_autorest.go new file mode 100644 index 000000000000..d731aed68ecb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicesstart_autorest.go @@ -0,0 +1,78 @@ +package serviceresource + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesStartOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ServicesStart ... +func (c ServiceResourceClient) ServicesStart(ctx context.Context, id ServiceId) (result ServicesStartOperationResponse, err error) { + req, err := c.preparerForServicesStart(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesStart", nil, "Failure preparing request") + return + } + + result, err = c.senderForServicesStart(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesStart", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ServicesStartThenPoll performs ServicesStart then polls until it's completed +func (c ServiceResourceClient) ServicesStartThenPoll(ctx context.Context, id ServiceId) error { + result, err := c.ServicesStart(ctx, id) + if err != nil { + return fmt.Errorf("performing ServicesStart: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ServicesStart: %+v", err) + } + + return nil +} + +// preparerForServicesStart prepares the ServicesStart request. +func (c ServiceResourceClient) preparerForServicesStart(ctx context.Context, id ServiceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/start", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForServicesStart sends the ServicesStart request. The method will close the +// http.Response Body if it receives an error. +func (c ServiceResourceClient) senderForServicesStart(ctx context.Context, req *http.Request) (future ServicesStartOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicesstop_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicesstop_autorest.go new file mode 100644 index 000000000000..c961aa496359 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicesstop_autorest.go @@ -0,0 +1,78 @@ +package serviceresource + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesStopOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ServicesStop ... +func (c ServiceResourceClient) ServicesStop(ctx context.Context, id ServiceId) (result ServicesStopOperationResponse, err error) { + req, err := c.preparerForServicesStop(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesStop", nil, "Failure preparing request") + return + } + + result, err = c.senderForServicesStop(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesStop", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ServicesStopThenPoll performs ServicesStop then polls until it's completed +func (c ServiceResourceClient) ServicesStopThenPoll(ctx context.Context, id ServiceId) error { + result, err := c.ServicesStop(ctx, id) + if err != nil { + return fmt.Errorf("performing ServicesStop: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ServicesStop: %+v", err) + } + + return nil +} + +// preparerForServicesStop prepares the ServicesStop request. +func (c ServiceResourceClient) preparerForServicesStop(ctx context.Context, id ServiceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/stop", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForServicesStop sends the ServicesStop request. The method will close the +// http.Response Body if it receives an error. +func (c ServiceResourceClient) senderForServicesStop(ctx context.Context, req *http.Request) (future ServicesStopOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicesupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicesupdate_autorest.go new file mode 100644 index 000000000000..8c8fea551bdd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_servicesupdate_autorest.go @@ -0,0 +1,79 @@ +package serviceresource + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicesUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ServicesUpdate ... +func (c ServiceResourceClient) ServicesUpdate(ctx context.Context, id ServiceId, input DataMigrationService) (result ServicesUpdateOperationResponse, err error) { + req, err := c.preparerForServicesUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForServicesUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "ServicesUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ServicesUpdateThenPoll performs ServicesUpdate then polls until it's completed +func (c ServiceResourceClient) ServicesUpdateThenPoll(ctx context.Context, id ServiceId, input DataMigrationService) error { + result, err := c.ServicesUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ServicesUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ServicesUpdate: %+v", err) + } + + return nil +} + +// preparerForServicesUpdate prepares the ServicesUpdate request. +func (c ServiceResourceClient) preparerForServicesUpdate(ctx context.Context, id ServiceId, input DataMigrationService) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForServicesUpdate sends the ServicesUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ServiceResourceClient) senderForServicesUpdate(ctx context.Context, req *http.Request) (future ServicesUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_taskslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_taskslist_autorest.go new file mode 100644 index 000000000000..693c8f0f4164 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/method_taskslist_autorest.go @@ -0,0 +1,215 @@ +package serviceresource + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TasksListOperationResponse struct { + HttpResponse *http.Response + Model *[]ProjectTask + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (TasksListOperationResponse, error) +} + +type TasksListCompleteResult struct { + Items []ProjectTask +} + +func (r TasksListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r TasksListOperationResponse) LoadMore(ctx context.Context) (resp TasksListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type TasksListOperationOptions struct { + TaskType *string +} + +func DefaultTasksListOperationOptions() TasksListOperationOptions { + return TasksListOperationOptions{} +} + +func (o TasksListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o TasksListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.TaskType != nil { + out["taskType"] = *o.TaskType + } + + return out +} + +// TasksList ... +func (c ServiceResourceClient) TasksList(ctx context.Context, id ProjectId, options TasksListOperationOptions) (resp TasksListOperationResponse, err error) { + req, err := c.preparerForTasksList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "TasksList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "TasksList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForTasksList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "TasksList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForTasksList prepares the TasksList request. +func (c ServiceResourceClient) preparerForTasksList(ctx context.Context, id ProjectId, options TasksListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/tasks", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForTasksListWithNextLink prepares the TasksList request with the given nextLink token. +func (c ServiceResourceClient) preparerForTasksListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForTasksList handles the response to the TasksList request. The method always +// closes the http.Response Body. +func (c ServiceResourceClient) responderForTasksList(resp *http.Response) (result TasksListOperationResponse, err error) { + type page struct { + Values []ProjectTask `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result TasksListOperationResponse, err error) { + req, err := c.preparerForTasksListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "TasksList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "TasksList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForTasksList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serviceresource.ServiceResourceClient", "TasksList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// TasksListComplete retrieves all of the results into a single object +func (c ServiceResourceClient) TasksListComplete(ctx context.Context, id ProjectId, options TasksListOperationOptions) (TasksListCompleteResult, error) { + return c.TasksListCompleteMatchingPredicate(ctx, id, options, ProjectTaskOperationPredicate{}) +} + +// TasksListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ServiceResourceClient) TasksListCompleteMatchingPredicate(ctx context.Context, id ProjectId, options TasksListOperationOptions, predicate ProjectTaskOperationPredicate) (resp TasksListCompleteResult, err error) { + items := make([]ProjectTask, 0) + + page, err := c.TasksList(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := TasksListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_availableservicesku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_availableservicesku.go new file mode 100644 index 000000000000..7fc9caf07929 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_availableservicesku.go @@ -0,0 +1,10 @@ +package serviceresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailableServiceSku struct { + Capacity *AvailableServiceSkuCapacity `json:"capacity,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + Sku *AvailableServiceSkuSku `json:"sku,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_availableserviceskucapacity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_availableserviceskucapacity.go new file mode 100644 index 000000000000..7b2aafe00d08 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_availableserviceskucapacity.go @@ -0,0 +1,11 @@ +package serviceresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailableServiceSkuCapacity struct { + Default *int64 `json:"default,omitempty"` + Maximum *int64 `json:"maximum,omitempty"` + Minimum *int64 `json:"minimum,omitempty"` + ScaleType *ServiceScalability `json:"scaleType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_availableserviceskusku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_availableserviceskusku.go new file mode 100644 index 000000000000..d40ccab7bafb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_availableserviceskusku.go @@ -0,0 +1,11 @@ +package serviceresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailableServiceSkuSku struct { + Family *string `json:"family,omitempty"` + Name *string `json:"name,omitempty"` + Size *string `json:"size,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_commandproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_commandproperties.go new file mode 100644 index 000000000000..7285e39656fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_commandproperties.go @@ -0,0 +1,10 @@ +package serviceresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CommandProperties struct { + CommandType string `json:"commandType"` + Errors *[]ODataError `json:"errors,omitempty"` + State *CommandState `json:"state,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_datamigrationservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_datamigrationservice.go new file mode 100644 index 000000000000..dad011b248f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_datamigrationservice.go @@ -0,0 +1,16 @@ +package serviceresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataMigrationService struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Kind *string `json:"kind,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *DataMigrationServiceProperties `json:"properties,omitempty"` + Sku *ServiceSku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_datamigrationserviceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_datamigrationserviceproperties.go new file mode 100644 index 000000000000..3acef1029418 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_datamigrationserviceproperties.go @@ -0,0 +1,10 @@ +package serviceresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataMigrationServiceProperties struct { + ProvisioningState *ServiceProvisioningState `json:"provisioningState,omitempty"` + PublicKey *string `json:"publicKey,omitempty"` + VirtualSubnetId string `json:"virtualSubnetId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_datamigrationservicestatusresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_datamigrationservicestatusresponse.go new file mode 100644 index 000000000000..20eec183c1cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_datamigrationservicestatusresponse.go @@ -0,0 +1,11 @@ +package serviceresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataMigrationServiceStatusResponse struct { + AgentVersion *string `json:"agentVersion,omitempty"` + Status *string `json:"status,omitempty"` + SupportedTaskTypes *[]string `json:"supportedTaskTypes,omitempty"` + VMSize *string `json:"vmSize,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_odataerror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_odataerror.go new file mode 100644 index 000000000000..6cee64cdc750 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_odataerror.go @@ -0,0 +1,10 @@ +package serviceresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ODataError struct { + Code *string `json:"code,omitempty"` + Details *[]ODataError `json:"details,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_projecttask.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_projecttask.go new file mode 100644 index 000000000000..5bfe05144a3e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_projecttask.go @@ -0,0 +1,12 @@ +package serviceresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProjectTask struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ProjectTaskProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_projecttaskproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_projecttaskproperties.go new file mode 100644 index 000000000000..ee9af00dfc17 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_projecttaskproperties.go @@ -0,0 +1,11 @@ +package serviceresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProjectTaskProperties struct { + Commands *[]CommandProperties `json:"commands,omitempty"` + Errors *[]ODataError `json:"errors,omitempty"` + State *TaskState `json:"state,omitempty"` + TaskType string `json:"taskType"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_servicesku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_servicesku.go new file mode 100644 index 000000000000..b384ff13edc7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/model_servicesku.go @@ -0,0 +1,12 @@ +package serviceresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceSku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name *string `json:"name,omitempty"` + Size *string `json:"size,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/predicates.go new file mode 100644 index 000000000000..e8197c4a4497 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/predicates.go @@ -0,0 +1,80 @@ +package serviceresource + +type AvailableServiceSkuOperationPredicate struct { + ResourceType *string +} + +func (p AvailableServiceSkuOperationPredicate) Matches(input AvailableServiceSku) bool { + + if p.ResourceType != nil && (input.ResourceType == nil && *p.ResourceType != *input.ResourceType) { + return false + } + + return true +} + +type DataMigrationServiceOperationPredicate struct { + Etag *string + Id *string + Kind *string + Location *string + Name *string + Type *string +} + +func (p DataMigrationServiceOperationPredicate) Matches(input DataMigrationService) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && (input.Kind == nil && *p.Kind != *input.Kind) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type ProjectTaskOperationPredicate struct { + Etag *string + Id *string + Name *string + Type *string +} + +func (p ProjectTaskOperationPredicate) Matches(input ProjectTask) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/version.go new file mode 100644 index 000000000000..0b34147d4646 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource/version.go @@ -0,0 +1,12 @@ +package serviceresource + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-04-19" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/serviceresource/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/README.md index 6d057b71db5e..0575ce8d2b92 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue") payload := backupinstances.TriggerBackupRequest{ // ... @@ -41,7 +41,7 @@ if err := client.AdhocBackupThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue") payload := backupinstances.BackupInstanceResource{ // ... @@ -58,7 +58,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -70,7 +70,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue") read, err := client.Get(ctx, id) if err != nil { @@ -86,7 +86,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := backupinstances.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") +id := backupinstances.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) @@ -103,7 +103,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue") if err := client.ResumeBackupsThenPoll(ctx, id); err != nil { // handle the error @@ -115,7 +115,7 @@ if err := client.ResumeBackupsThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue") if err := client.ResumeProtectionThenPoll(ctx, id); err != nil { // handle the error @@ -127,7 +127,7 @@ if err := client.ResumeProtectionThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue") if err := client.StopProtectionThenPoll(ctx, id); err != nil { // handle the error @@ -139,7 +139,7 @@ if err := client.StopProtectionThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue") if err := client.SuspendBackupsThenPoll(ctx, id); err != nil { // handle the error @@ -151,7 +151,7 @@ if err := client.SuspendBackupsThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue") payload := backupinstances.SyncBackupInstanceRequest{ // ... @@ -168,7 +168,7 @@ if err := client.SyncBackupInstanceThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue") payload := backupinstances.AzureBackupRehydrationRequest{ // ... @@ -185,7 +185,7 @@ if err := client.TriggerRehydrateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue") payload := backupinstances.AzureBackupRestoreRequest{ // ... @@ -202,7 +202,7 @@ if err := client.TriggerRestoreThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := backupinstances.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") +id := backupinstances.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue") payload := backupinstances.ValidateForBackupRequest{ // ... @@ -219,7 +219,7 @@ if err := client.ValidateForBackupThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupInstanceValue") payload := backupinstances.ValidateRestoreRequestObject{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupinstance.go index d7b8818dea5a..83634050fdde 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupinstance.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupinstance.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = BackupInstanceId{} type BackupInstanceId struct { SubscriptionId string ResourceGroupName string - VaultName string + BackupVaultName string BackupInstanceName string } // NewBackupInstanceID returns a new BackupInstanceId struct -func NewBackupInstanceID(subscriptionId string, resourceGroupName string, vaultName string, backupInstanceName string) BackupInstanceId { +func NewBackupInstanceID(subscriptionId string, resourceGroupName string, backupVaultName string, backupInstanceName string) BackupInstanceId { return BackupInstanceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - VaultName: vaultName, + BackupVaultName: backupVaultName, BackupInstanceName: backupInstanceName, } } @@ -46,8 +46,8 @@ func ParseBackupInstanceID(input string) (*BackupInstanceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { + return nil, fmt.Errorf("the segment 'backupVaultName' was not found in the resource id %q", input) } if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { @@ -77,8 +77,8 @@ func ParseBackupInstanceIDInsensitively(input string) (*BackupInstanceId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { + return nil, fmt.Errorf("the segment 'backupVaultName' was not found in the resource id %q", input) } if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { @@ -106,7 +106,7 @@ func ValidateBackupInstanceID(input interface{}, key string) (warnings []string, // ID returns the formatted Backup Instance ID func (id BackupInstanceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/backupVaults/%s/backupInstances/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.BackupInstanceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BackupVaultName, id.BackupInstanceName) } // Segments returns a slice of Resource ID Segments which comprise this Backup Instance ID @@ -119,7 +119,7 @@ func (id BackupInstanceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + resourceids.UserSpecifiedSegment("backupVaultName", "backupVaultValue"), resourceids.StaticSegment("staticBackupInstances", "backupInstances", "backupInstances"), resourceids.UserSpecifiedSegment("backupInstanceName", "backupInstanceValue"), } @@ -130,7 +130,7 @@ func (id BackupInstanceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Backup Vault Name: %q", id.BackupVaultName), fmt.Sprintf("Backup Instance Name: %q", id.BackupInstanceName), } return fmt.Sprintf("Backup Instance (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupvault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupvault.go index 3e60f3f7bb3e..3d44e22cf232 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupvault.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupvault.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = BackupVaultId{} type BackupVaultId struct { SubscriptionId string ResourceGroupName string - VaultName string + BackupVaultName string } // NewBackupVaultID returns a new BackupVaultId struct -func NewBackupVaultID(subscriptionId string, resourceGroupName string, vaultName string) BackupVaultId { +func NewBackupVaultID(subscriptionId string, resourceGroupName string, backupVaultName string) BackupVaultId { return BackupVaultId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - VaultName: vaultName, + BackupVaultName: backupVaultName, } } @@ -44,8 +44,8 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { + return nil, fmt.Errorf("the segment 'backupVaultName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { + return nil, fmt.Errorf("the segment 'backupVaultName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateBackupVaultID(input interface{}, key string) (warnings []string, er // ID returns the formatted Backup Vault ID func (id BackupVaultId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/backupVaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BackupVaultName) } // Segments returns a slice of Resource ID Segments which comprise this Backup Vault ID @@ -109,7 +109,7 @@ func (id BackupVaultId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + resourceids.UserSpecifiedSegment("backupVaultName", "backupVaultValue"), } } @@ -118,7 +118,7 @@ func (id BackupVaultId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Backup Vault Name: %q", id.BackupVaultName), } return fmt.Sprintf("Backup Vault (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/README.md index ce9e7a31c06e..58e2443288c2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := backuppolicies.NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupPolicyValue") +id := backuppolicies.NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupPolicyValue") payload := backuppolicies.BaseBackupPolicyResource{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := backuppolicies.NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupPolicyValue") +id := backuppolicies.NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupPolicyValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := backuppolicies.NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupPolicyValue") +id := backuppolicies.NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue", "backupPolicyValue") read, err := client.Get(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := backuppolicies.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") +id := backuppolicies.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backuppolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backuppolicy.go index 1a303f4b5dce..7b7f399c8cf1 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backuppolicy.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backuppolicy.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = BackupPolicyId{} type BackupPolicyId struct { SubscriptionId string ResourceGroupName string - VaultName string + BackupVaultName string BackupPolicyName string } // NewBackupPolicyID returns a new BackupPolicyId struct -func NewBackupPolicyID(subscriptionId string, resourceGroupName string, vaultName string, backupPolicyName string) BackupPolicyId { +func NewBackupPolicyID(subscriptionId string, resourceGroupName string, backupVaultName string, backupPolicyName string) BackupPolicyId { return BackupPolicyId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - VaultName: vaultName, + BackupVaultName: backupVaultName, BackupPolicyName: backupPolicyName, } } @@ -46,8 +46,8 @@ func ParseBackupPolicyID(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { + return nil, fmt.Errorf("the segment 'backupVaultName' was not found in the resource id %q", input) } if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { @@ -77,8 +77,8 @@ func ParseBackupPolicyIDInsensitively(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { + return nil, fmt.Errorf("the segment 'backupVaultName' was not found in the resource id %q", input) } if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { @@ -106,7 +106,7 @@ func ValidateBackupPolicyID(input interface{}, key string) (warnings []string, e // ID returns the formatted Backup Policy ID func (id BackupPolicyId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/backupVaults/%s/backupPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.BackupPolicyName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BackupVaultName, id.BackupPolicyName) } // Segments returns a slice of Resource ID Segments which comprise this Backup Policy ID @@ -119,7 +119,7 @@ func (id BackupPolicyId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + resourceids.UserSpecifiedSegment("backupVaultName", "backupVaultValue"), resourceids.StaticSegment("staticBackupPolicies", "backupPolicies", "backupPolicies"), resourceids.UserSpecifiedSegment("backupPolicyName", "backupPolicyValue"), } @@ -130,7 +130,7 @@ func (id BackupPolicyId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Backup Vault Name: %q", id.BackupVaultName), fmt.Sprintf("Backup Policy Name: %q", id.BackupPolicyName), } return fmt.Sprintf("Backup Policy (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backupvault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backupvault.go index 17954d3b4e9f..ecbea5dc310a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backupvault.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backupvault.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = BackupVaultId{} type BackupVaultId struct { SubscriptionId string ResourceGroupName string - VaultName string + BackupVaultName string } // NewBackupVaultID returns a new BackupVaultId struct -func NewBackupVaultID(subscriptionId string, resourceGroupName string, vaultName string) BackupVaultId { +func NewBackupVaultID(subscriptionId string, resourceGroupName string, backupVaultName string) BackupVaultId { return BackupVaultId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - VaultName: vaultName, + BackupVaultName: backupVaultName, } } @@ -44,8 +44,8 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { + return nil, fmt.Errorf("the segment 'backupVaultName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { + return nil, fmt.Errorf("the segment 'backupVaultName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateBackupVaultID(input interface{}, key string) (warnings []string, er // ID returns the formatted Backup Vault ID func (id BackupVaultId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/backupVaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BackupVaultName) } // Segments returns a slice of Resource ID Segments which comprise this Backup Vault ID @@ -109,7 +109,7 @@ func (id BackupVaultId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + resourceids.UserSpecifiedSegment("backupVaultName", "backupVaultValue"), } } @@ -118,7 +118,7 @@ func (id BackupVaultId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Backup Vault Name: %q", id.BackupVaultName), } return fmt.Sprintf("Backup Vault (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/README.md index 33daba0721e3..455aff5be839 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/README.md @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") +id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue") payload := backupvaults.BackupVaultResource{ // ... @@ -62,7 +62,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") +id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue") read, err := client.Delete(ctx, id) if err != nil { @@ -78,7 +78,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") +id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue") read, err := client.Get(ctx, id) if err != nil { @@ -128,7 +128,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") +id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "backupVaultValue") payload := backupvaults.PatchResourceRequestInput{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/id_backupvault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/id_backupvault.go index 47da3421eb5b..f772cce9f584 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/id_backupvault.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/id_backupvault.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = BackupVaultId{} type BackupVaultId struct { SubscriptionId string ResourceGroupName string - VaultName string + BackupVaultName string } // NewBackupVaultID returns a new BackupVaultId struct -func NewBackupVaultID(subscriptionId string, resourceGroupName string, vaultName string) BackupVaultId { +func NewBackupVaultID(subscriptionId string, resourceGroupName string, backupVaultName string) BackupVaultId { return BackupVaultId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - VaultName: vaultName, + BackupVaultName: backupVaultName, } } @@ -44,8 +44,8 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { + return nil, fmt.Errorf("the segment 'backupVaultName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { + return nil, fmt.Errorf("the segment 'backupVaultName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateBackupVaultID(input interface{}, key string) (warnings []string, er // ID returns the formatted Backup Vault ID func (id BackupVaultId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/backupVaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BackupVaultName) } // Segments returns a slice of Resource ID Segments which comprise this Backup Vault ID @@ -109,7 +109,7 @@ func (id BackupVaultId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + resourceids.UserSpecifiedSegment("backupVaultName", "backupVaultValue"), } } @@ -118,7 +118,7 @@ func (id BackupVaultId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Backup Vault Name: %q", id.BackupVaultName), } return fmt.Sprintf("Backup Vault (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/id_providerlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/id_providerlocation.go index 861193b45c8e..97a0c984d873 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/id_providerlocation.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/id_providerlocation.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = ProviderLocationId{} type ProviderLocationId struct { SubscriptionId string ResourceGroupName string - Location string + LocationName string } // NewProviderLocationID returns a new ProviderLocationId struct -func NewProviderLocationID(subscriptionId string, resourceGroupName string, location string) ProviderLocationId { +func NewProviderLocationID(subscriptionId string, resourceGroupName string, locationName string) ProviderLocationId { return ProviderLocationId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - Location: location, + LocationName: locationName, } } @@ -44,8 +44,8 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateProviderLocationID(input interface{}, key string) (warnings []strin // ID returns the formatted Provider Location ID func (id ProviderLocationId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.Location) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.LocationName) } // Segments returns a slice of Resource ID Segments which comprise this Provider Location ID @@ -109,7 +109,7 @@ func (id ProviderLocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), } } @@ -118,7 +118,7 @@ func (id ProviderLocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), } return fmt.Sprintf("Provider Location (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/README.md index 603f4cf287b5..d443f1183e44 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue") read, err := client.Delete(ctx, id) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue") read, err := client.Get(ctx, id) if err != nil { @@ -56,7 +56,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue") // alternatively `client.GetBackupSecurityPINRequestsObjects(ctx, id)` can be used to do batched pagination items, err := client.GetBackupSecurityPINRequestsObjectsComplete(ctx, id) @@ -73,7 +73,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := resourceguards.NewGetBackupSecurityPINRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue", "requestValue") +id := resourceguards.NewGetBackupSecurityPINRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue", "getBackupSecurityPINRequestValue") read, err := client.GetDefaultBackupSecurityPINRequestsObject(ctx, id) if err != nil { @@ -89,7 +89,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := resourceguards.NewDeleteProtectedItemRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue", "requestValue") +id := resourceguards.NewDeleteProtectedItemRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue", "deleteProtectedItemRequestValue") read, err := client.GetDefaultDeleteProtectedItemRequestsObject(ctx, id) if err != nil { @@ -105,7 +105,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := resourceguards.NewDeleteResourceGuardProxyRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue", "requestValue") +id := resourceguards.NewDeleteResourceGuardProxyRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue", "deleteResourceGuardProxyRequestValue") read, err := client.GetDefaultDeleteResourceGuardProxyRequestsObject(ctx, id) if err != nil { @@ -121,7 +121,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := resourceguards.NewDisableSoftDeleteRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue", "requestValue") +id := resourceguards.NewDisableSoftDeleteRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue", "disableSoftDeleteRequestValue") read, err := client.GetDefaultDisableSoftDeleteRequestsObject(ctx, id) if err != nil { @@ -137,7 +137,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := resourceguards.NewUpdateProtectedItemRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue", "requestValue") +id := resourceguards.NewUpdateProtectedItemRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue", "updateProtectedItemRequestValue") read, err := client.GetDefaultUpdateProtectedItemRequestsObject(ctx, id) if err != nil { @@ -153,7 +153,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := resourceguards.NewUpdateProtectionPolicyRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue", "requestValue") +id := resourceguards.NewUpdateProtectionPolicyRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue", "updateProtectionPolicyRequestValue") read, err := client.GetDefaultUpdateProtectionPolicyRequestsObject(ctx, id) if err != nil { @@ -169,7 +169,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue") // alternatively `client.GetDeleteProtectedItemRequestsObjects(ctx, id)` can be used to do batched pagination items, err := client.GetDeleteProtectedItemRequestsObjectsComplete(ctx, id) @@ -186,7 +186,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue") // alternatively `client.GetDeleteResourceGuardProxyRequestsObjects(ctx, id)` can be used to do batched pagination items, err := client.GetDeleteResourceGuardProxyRequestsObjectsComplete(ctx, id) @@ -203,7 +203,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue") // alternatively `client.GetDisableSoftDeleteRequestsObjects(ctx, id)` can be used to do batched pagination items, err := client.GetDisableSoftDeleteRequestsObjectsComplete(ctx, id) @@ -254,7 +254,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue") // alternatively `client.GetUpdateProtectedItemRequestsObjects(ctx, id)` can be used to do batched pagination items, err := client.GetUpdateProtectedItemRequestsObjectsComplete(ctx, id) @@ -271,7 +271,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue") // alternatively `client.GetUpdateProtectionPolicyRequestsObjects(ctx, id)` can be used to do batched pagination items, err := client.GetUpdateProtectionPolicyRequestsObjectsComplete(ctx, id) @@ -288,7 +288,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue") payload := resourceguards.PatchResourceRequestInput{ // ... @@ -309,7 +309,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardValue") payload := resourceguards.ResourceGuardResource{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteprotecteditemrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteprotecteditemrequest.go index 8cd76f04ac22..387181b627d1 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteprotecteditemrequest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteprotecteditemrequest.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = DeleteProtectedItemRequestId{} // DeleteProtectedItemRequestId is a struct representing the Resource ID for a Delete Protected Item Request type DeleteProtectedItemRequestId struct { - SubscriptionId string - ResourceGroupName string - ResourceGuardsName string - RequestName string + SubscriptionId string + ResourceGroupName string + ResourceGuardName string + DeleteProtectedItemRequestName string } // NewDeleteProtectedItemRequestID returns a new DeleteProtectedItemRequestId struct -func NewDeleteProtectedItemRequestID(subscriptionId string, resourceGroupName string, resourceGuardsName string, requestName string) DeleteProtectedItemRequestId { +func NewDeleteProtectedItemRequestID(subscriptionId string, resourceGroupName string, resourceGuardName string, deleteProtectedItemRequestName string) DeleteProtectedItemRequestId { return DeleteProtectedItemRequestId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceGuardsName: resourceGuardsName, - RequestName: requestName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceGuardName: resourceGuardName, + DeleteProtectedItemRequestName: deleteProtectedItemRequestName, } } @@ -46,12 +46,12 @@ func ParseDeleteProtectedItemRequestID(input string) (*DeleteProtectedItemReques return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardName' was not found in the resource id %q", input) } - if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { - return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + if id.DeleteProtectedItemRequestName, ok = parsed.Parsed["deleteProtectedItemRequestName"]; !ok { + return nil, fmt.Errorf("the segment 'deleteProtectedItemRequestName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseDeleteProtectedItemRequestIDInsensitively(input string) (*DeleteProtec return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardName' was not found in the resource id %q", input) } - if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { - return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + if id.DeleteProtectedItemRequestName, ok = parsed.Parsed["deleteProtectedItemRequestName"]; !ok { + return nil, fmt.Errorf("the segment 'deleteProtectedItemRequestName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateDeleteProtectedItemRequestID(input interface{}, key string) (warnin // ID returns the formatted Delete Protected Item Request ID func (id DeleteProtectedItemRequestId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/resourceGuards/%s/deleteProtectedItemRequests/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardsName, id.RequestName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardName, id.DeleteProtectedItemRequestName) } // Segments returns a slice of Resource ID Segments which comprise this Delete Protected Item Request ID @@ -119,9 +119,9 @@ func (id DeleteProtectedItemRequestId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), resourceids.StaticSegment("staticResourceGuards", "resourceGuards", "resourceGuards"), - resourceids.UserSpecifiedSegment("resourceGuardsName", "resourceGuardsValue"), + resourceids.UserSpecifiedSegment("resourceGuardName", "resourceGuardValue"), resourceids.StaticSegment("staticDeleteProtectedItemRequests", "deleteProtectedItemRequests", "deleteProtectedItemRequests"), - resourceids.UserSpecifiedSegment("requestName", "requestValue"), + resourceids.UserSpecifiedSegment("deleteProtectedItemRequestName", "deleteProtectedItemRequestValue"), } } @@ -130,8 +130,8 @@ func (id DeleteProtectedItemRequestId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Guards Name: %q", id.ResourceGuardsName), - fmt.Sprintf("Request Name: %q", id.RequestName), + fmt.Sprintf("Resource Guard Name: %q", id.ResourceGuardName), + fmt.Sprintf("Delete Protected Item Request Name: %q", id.DeleteProtectedItemRequestName), } return fmt.Sprintf("Delete Protected Item Request (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteresourceguardproxyrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteresourceguardproxyrequest.go index ce7801a7f778..432b8cc82c65 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteresourceguardproxyrequest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteresourceguardproxyrequest.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = DeleteResourceGuardProxyRequestId{} // DeleteResourceGuardProxyRequestId is a struct representing the Resource ID for a Delete Resource Guard Proxy Request type DeleteResourceGuardProxyRequestId struct { - SubscriptionId string - ResourceGroupName string - ResourceGuardsName string - RequestName string + SubscriptionId string + ResourceGroupName string + ResourceGuardName string + DeleteResourceGuardProxyRequestName string } // NewDeleteResourceGuardProxyRequestID returns a new DeleteResourceGuardProxyRequestId struct -func NewDeleteResourceGuardProxyRequestID(subscriptionId string, resourceGroupName string, resourceGuardsName string, requestName string) DeleteResourceGuardProxyRequestId { +func NewDeleteResourceGuardProxyRequestID(subscriptionId string, resourceGroupName string, resourceGuardName string, deleteResourceGuardProxyRequestName string) DeleteResourceGuardProxyRequestId { return DeleteResourceGuardProxyRequestId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceGuardsName: resourceGuardsName, - RequestName: requestName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceGuardName: resourceGuardName, + DeleteResourceGuardProxyRequestName: deleteResourceGuardProxyRequestName, } } @@ -46,12 +46,12 @@ func ParseDeleteResourceGuardProxyRequestID(input string) (*DeleteResourceGuardP return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardName' was not found in the resource id %q", input) } - if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { - return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + if id.DeleteResourceGuardProxyRequestName, ok = parsed.Parsed["deleteResourceGuardProxyRequestName"]; !ok { + return nil, fmt.Errorf("the segment 'deleteResourceGuardProxyRequestName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseDeleteResourceGuardProxyRequestIDInsensitively(input string) (*DeleteR return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardName' was not found in the resource id %q", input) } - if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { - return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + if id.DeleteResourceGuardProxyRequestName, ok = parsed.Parsed["deleteResourceGuardProxyRequestName"]; !ok { + return nil, fmt.Errorf("the segment 'deleteResourceGuardProxyRequestName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateDeleteResourceGuardProxyRequestID(input interface{}, key string) (w // ID returns the formatted Delete Resource Guard Proxy Request ID func (id DeleteResourceGuardProxyRequestId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/resourceGuards/%s/deleteResourceGuardProxyRequests/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardsName, id.RequestName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardName, id.DeleteResourceGuardProxyRequestName) } // Segments returns a slice of Resource ID Segments which comprise this Delete Resource Guard Proxy Request ID @@ -119,9 +119,9 @@ func (id DeleteResourceGuardProxyRequestId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), resourceids.StaticSegment("staticResourceGuards", "resourceGuards", "resourceGuards"), - resourceids.UserSpecifiedSegment("resourceGuardsName", "resourceGuardsValue"), + resourceids.UserSpecifiedSegment("resourceGuardName", "resourceGuardValue"), resourceids.StaticSegment("staticDeleteResourceGuardProxyRequests", "deleteResourceGuardProxyRequests", "deleteResourceGuardProxyRequests"), - resourceids.UserSpecifiedSegment("requestName", "requestValue"), + resourceids.UserSpecifiedSegment("deleteResourceGuardProxyRequestName", "deleteResourceGuardProxyRequestValue"), } } @@ -130,8 +130,8 @@ func (id DeleteResourceGuardProxyRequestId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Guards Name: %q", id.ResourceGuardsName), - fmt.Sprintf("Request Name: %q", id.RequestName), + fmt.Sprintf("Resource Guard Name: %q", id.ResourceGuardName), + fmt.Sprintf("Delete Resource Guard Proxy Request Name: %q", id.DeleteResourceGuardProxyRequestName), } return fmt.Sprintf("Delete Resource Guard Proxy Request (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_disablesoftdeleterequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_disablesoftdeleterequest.go index 4fda5f44fafe..75883641da0b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_disablesoftdeleterequest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_disablesoftdeleterequest.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = DisableSoftDeleteRequestId{} // DisableSoftDeleteRequestId is a struct representing the Resource ID for a Disable Soft Delete Request type DisableSoftDeleteRequestId struct { - SubscriptionId string - ResourceGroupName string - ResourceGuardsName string - RequestName string + SubscriptionId string + ResourceGroupName string + ResourceGuardName string + DisableSoftDeleteRequestName string } // NewDisableSoftDeleteRequestID returns a new DisableSoftDeleteRequestId struct -func NewDisableSoftDeleteRequestID(subscriptionId string, resourceGroupName string, resourceGuardsName string, requestName string) DisableSoftDeleteRequestId { +func NewDisableSoftDeleteRequestID(subscriptionId string, resourceGroupName string, resourceGuardName string, disableSoftDeleteRequestName string) DisableSoftDeleteRequestId { return DisableSoftDeleteRequestId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceGuardsName: resourceGuardsName, - RequestName: requestName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceGuardName: resourceGuardName, + DisableSoftDeleteRequestName: disableSoftDeleteRequestName, } } @@ -46,12 +46,12 @@ func ParseDisableSoftDeleteRequestID(input string) (*DisableSoftDeleteRequestId, return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardName' was not found in the resource id %q", input) } - if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { - return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + if id.DisableSoftDeleteRequestName, ok = parsed.Parsed["disableSoftDeleteRequestName"]; !ok { + return nil, fmt.Errorf("the segment 'disableSoftDeleteRequestName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseDisableSoftDeleteRequestIDInsensitively(input string) (*DisableSoftDel return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardName' was not found in the resource id %q", input) } - if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { - return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + if id.DisableSoftDeleteRequestName, ok = parsed.Parsed["disableSoftDeleteRequestName"]; !ok { + return nil, fmt.Errorf("the segment 'disableSoftDeleteRequestName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateDisableSoftDeleteRequestID(input interface{}, key string) (warnings // ID returns the formatted Disable Soft Delete Request ID func (id DisableSoftDeleteRequestId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/resourceGuards/%s/disableSoftDeleteRequests/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardsName, id.RequestName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardName, id.DisableSoftDeleteRequestName) } // Segments returns a slice of Resource ID Segments which comprise this Disable Soft Delete Request ID @@ -119,9 +119,9 @@ func (id DisableSoftDeleteRequestId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), resourceids.StaticSegment("staticResourceGuards", "resourceGuards", "resourceGuards"), - resourceids.UserSpecifiedSegment("resourceGuardsName", "resourceGuardsValue"), + resourceids.UserSpecifiedSegment("resourceGuardName", "resourceGuardValue"), resourceids.StaticSegment("staticDisableSoftDeleteRequests", "disableSoftDeleteRequests", "disableSoftDeleteRequests"), - resourceids.UserSpecifiedSegment("requestName", "requestValue"), + resourceids.UserSpecifiedSegment("disableSoftDeleteRequestName", "disableSoftDeleteRequestValue"), } } @@ -130,8 +130,8 @@ func (id DisableSoftDeleteRequestId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Guards Name: %q", id.ResourceGuardsName), - fmt.Sprintf("Request Name: %q", id.RequestName), + fmt.Sprintf("Resource Guard Name: %q", id.ResourceGuardName), + fmt.Sprintf("Disable Soft Delete Request Name: %q", id.DisableSoftDeleteRequestName), } return fmt.Sprintf("Disable Soft Delete Request (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_getbackupsecuritypinrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_getbackupsecuritypinrequest.go index 23703f2e2d37..a6efccd3c220 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_getbackupsecuritypinrequest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_getbackupsecuritypinrequest.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = GetBackupSecurityPINRequestId{} // GetBackupSecurityPINRequestId is a struct representing the Resource ID for a Get Backup Security P I N Request type GetBackupSecurityPINRequestId struct { - SubscriptionId string - ResourceGroupName string - ResourceGuardsName string - RequestName string + SubscriptionId string + ResourceGroupName string + ResourceGuardName string + GetBackupSecurityPINRequestName string } // NewGetBackupSecurityPINRequestID returns a new GetBackupSecurityPINRequestId struct -func NewGetBackupSecurityPINRequestID(subscriptionId string, resourceGroupName string, resourceGuardsName string, requestName string) GetBackupSecurityPINRequestId { +func NewGetBackupSecurityPINRequestID(subscriptionId string, resourceGroupName string, resourceGuardName string, getBackupSecurityPINRequestName string) GetBackupSecurityPINRequestId { return GetBackupSecurityPINRequestId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceGuardsName: resourceGuardsName, - RequestName: requestName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceGuardName: resourceGuardName, + GetBackupSecurityPINRequestName: getBackupSecurityPINRequestName, } } @@ -46,12 +46,12 @@ func ParseGetBackupSecurityPINRequestID(input string) (*GetBackupSecurityPINRequ return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardName' was not found in the resource id %q", input) } - if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { - return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + if id.GetBackupSecurityPINRequestName, ok = parsed.Parsed["getBackupSecurityPINRequestName"]; !ok { + return nil, fmt.Errorf("the segment 'getBackupSecurityPINRequestName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseGetBackupSecurityPINRequestIDInsensitively(input string) (*GetBackupSe return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardName' was not found in the resource id %q", input) } - if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { - return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + if id.GetBackupSecurityPINRequestName, ok = parsed.Parsed["getBackupSecurityPINRequestName"]; !ok { + return nil, fmt.Errorf("the segment 'getBackupSecurityPINRequestName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateGetBackupSecurityPINRequestID(input interface{}, key string) (warni // ID returns the formatted Get Backup Security P I N Request ID func (id GetBackupSecurityPINRequestId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/resourceGuards/%s/getBackupSecurityPINRequests/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardsName, id.RequestName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardName, id.GetBackupSecurityPINRequestName) } // Segments returns a slice of Resource ID Segments which comprise this Get Backup Security P I N Request ID @@ -119,9 +119,9 @@ func (id GetBackupSecurityPINRequestId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), resourceids.StaticSegment("staticResourceGuards", "resourceGuards", "resourceGuards"), - resourceids.UserSpecifiedSegment("resourceGuardsName", "resourceGuardsValue"), + resourceids.UserSpecifiedSegment("resourceGuardName", "resourceGuardValue"), resourceids.StaticSegment("staticGetBackupSecurityPINRequests", "getBackupSecurityPINRequests", "getBackupSecurityPINRequests"), - resourceids.UserSpecifiedSegment("requestName", "requestValue"), + resourceids.UserSpecifiedSegment("getBackupSecurityPINRequestName", "getBackupSecurityPINRequestValue"), } } @@ -130,8 +130,8 @@ func (id GetBackupSecurityPINRequestId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Guards Name: %q", id.ResourceGuardsName), - fmt.Sprintf("Request Name: %q", id.RequestName), + fmt.Sprintf("Resource Guard Name: %q", id.ResourceGuardName), + fmt.Sprintf("Get Backup Security P I N Request Name: %q", id.GetBackupSecurityPINRequestName), } return fmt.Sprintf("Get Backup Security P I N Request (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_resourceguard.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_resourceguard.go index bf161f3aeb94..3235bc1b98ee 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_resourceguard.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_resourceguard.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = ResourceGuardId{} // ResourceGuardId is a struct representing the Resource ID for a Resource Guard type ResourceGuardId struct { - SubscriptionId string - ResourceGroupName string - ResourceGuardsName string + SubscriptionId string + ResourceGroupName string + ResourceGuardName string } // NewResourceGuardID returns a new ResourceGuardId struct -func NewResourceGuardID(subscriptionId string, resourceGroupName string, resourceGuardsName string) ResourceGuardId { +func NewResourceGuardID(subscriptionId string, resourceGroupName string, resourceGuardName string) ResourceGuardId { return ResourceGuardId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceGuardsName: resourceGuardsName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceGuardName: resourceGuardName, } } @@ -44,8 +44,8 @@ func ParseResourceGuardID(input string) (*ResourceGuardId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseResourceGuardIDInsensitively(input string) (*ResourceGuardId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateResourceGuardID(input interface{}, key string) (warnings []string, // ID returns the formatted Resource Guard ID func (id ResourceGuardId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/resourceGuards/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardsName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardName) } // Segments returns a slice of Resource ID Segments which comprise this Resource Guard ID @@ -109,7 +109,7 @@ func (id ResourceGuardId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), resourceids.StaticSegment("staticResourceGuards", "resourceGuards", "resourceGuards"), - resourceids.UserSpecifiedSegment("resourceGuardsName", "resourceGuardsValue"), + resourceids.UserSpecifiedSegment("resourceGuardName", "resourceGuardValue"), } } @@ -118,7 +118,7 @@ func (id ResourceGuardId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Guards Name: %q", id.ResourceGuardsName), + fmt.Sprintf("Resource Guard Name: %q", id.ResourceGuardName), } return fmt.Sprintf("Resource Guard (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotecteditemrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotecteditemrequest.go index 6ca7f837c6e3..e9fce41b2807 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotecteditemrequest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotecteditemrequest.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = UpdateProtectedItemRequestId{} // UpdateProtectedItemRequestId is a struct representing the Resource ID for a Update Protected Item Request type UpdateProtectedItemRequestId struct { - SubscriptionId string - ResourceGroupName string - ResourceGuardsName string - RequestName string + SubscriptionId string + ResourceGroupName string + ResourceGuardName string + UpdateProtectedItemRequestName string } // NewUpdateProtectedItemRequestID returns a new UpdateProtectedItemRequestId struct -func NewUpdateProtectedItemRequestID(subscriptionId string, resourceGroupName string, resourceGuardsName string, requestName string) UpdateProtectedItemRequestId { +func NewUpdateProtectedItemRequestID(subscriptionId string, resourceGroupName string, resourceGuardName string, updateProtectedItemRequestName string) UpdateProtectedItemRequestId { return UpdateProtectedItemRequestId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceGuardsName: resourceGuardsName, - RequestName: requestName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceGuardName: resourceGuardName, + UpdateProtectedItemRequestName: updateProtectedItemRequestName, } } @@ -46,12 +46,12 @@ func ParseUpdateProtectedItemRequestID(input string) (*UpdateProtectedItemReques return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardName' was not found in the resource id %q", input) } - if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { - return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + if id.UpdateProtectedItemRequestName, ok = parsed.Parsed["updateProtectedItemRequestName"]; !ok { + return nil, fmt.Errorf("the segment 'updateProtectedItemRequestName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseUpdateProtectedItemRequestIDInsensitively(input string) (*UpdateProtec return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardName' was not found in the resource id %q", input) } - if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { - return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + if id.UpdateProtectedItemRequestName, ok = parsed.Parsed["updateProtectedItemRequestName"]; !ok { + return nil, fmt.Errorf("the segment 'updateProtectedItemRequestName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateUpdateProtectedItemRequestID(input interface{}, key string) (warnin // ID returns the formatted Update Protected Item Request ID func (id UpdateProtectedItemRequestId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/resourceGuards/%s/updateProtectedItemRequests/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardsName, id.RequestName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardName, id.UpdateProtectedItemRequestName) } // Segments returns a slice of Resource ID Segments which comprise this Update Protected Item Request ID @@ -119,9 +119,9 @@ func (id UpdateProtectedItemRequestId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), resourceids.StaticSegment("staticResourceGuards", "resourceGuards", "resourceGuards"), - resourceids.UserSpecifiedSegment("resourceGuardsName", "resourceGuardsValue"), + resourceids.UserSpecifiedSegment("resourceGuardName", "resourceGuardValue"), resourceids.StaticSegment("staticUpdateProtectedItemRequests", "updateProtectedItemRequests", "updateProtectedItemRequests"), - resourceids.UserSpecifiedSegment("requestName", "requestValue"), + resourceids.UserSpecifiedSegment("updateProtectedItemRequestName", "updateProtectedItemRequestValue"), } } @@ -130,8 +130,8 @@ func (id UpdateProtectedItemRequestId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Guards Name: %q", id.ResourceGuardsName), - fmt.Sprintf("Request Name: %q", id.RequestName), + fmt.Sprintf("Resource Guard Name: %q", id.ResourceGuardName), + fmt.Sprintf("Update Protected Item Request Name: %q", id.UpdateProtectedItemRequestName), } return fmt.Sprintf("Update Protected Item Request (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotectionpolicyrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotectionpolicyrequest.go index 62d21b46b552..4516800690d4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotectionpolicyrequest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotectionpolicyrequest.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = UpdateProtectionPolicyRequestId{} // UpdateProtectionPolicyRequestId is a struct representing the Resource ID for a Update Protection Policy Request type UpdateProtectionPolicyRequestId struct { - SubscriptionId string - ResourceGroupName string - ResourceGuardsName string - RequestName string + SubscriptionId string + ResourceGroupName string + ResourceGuardName string + UpdateProtectionPolicyRequestName string } // NewUpdateProtectionPolicyRequestID returns a new UpdateProtectionPolicyRequestId struct -func NewUpdateProtectionPolicyRequestID(subscriptionId string, resourceGroupName string, resourceGuardsName string, requestName string) UpdateProtectionPolicyRequestId { +func NewUpdateProtectionPolicyRequestID(subscriptionId string, resourceGroupName string, resourceGuardName string, updateProtectionPolicyRequestName string) UpdateProtectionPolicyRequestId { return UpdateProtectionPolicyRequestId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceGuardsName: resourceGuardsName, - RequestName: requestName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceGuardName: resourceGuardName, + UpdateProtectionPolicyRequestName: updateProtectionPolicyRequestName, } } @@ -46,12 +46,12 @@ func ParseUpdateProtectionPolicyRequestID(input string) (*UpdateProtectionPolicy return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardName' was not found in the resource id %q", input) } - if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { - return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + if id.UpdateProtectionPolicyRequestName, ok = parsed.Parsed["updateProtectionPolicyRequestName"]; !ok { + return nil, fmt.Errorf("the segment 'updateProtectionPolicyRequestName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseUpdateProtectionPolicyRequestIDInsensitively(input string) (*UpdatePro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardName' was not found in the resource id %q", input) } - if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { - return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + if id.UpdateProtectionPolicyRequestName, ok = parsed.Parsed["updateProtectionPolicyRequestName"]; !ok { + return nil, fmt.Errorf("the segment 'updateProtectionPolicyRequestName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateUpdateProtectionPolicyRequestID(input interface{}, key string) (war // ID returns the formatted Update Protection Policy Request ID func (id UpdateProtectionPolicyRequestId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/resourceGuards/%s/updateProtectionPolicyRequests/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardsName, id.RequestName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardName, id.UpdateProtectionPolicyRequestName) } // Segments returns a slice of Resource ID Segments which comprise this Update Protection Policy Request ID @@ -119,9 +119,9 @@ func (id UpdateProtectionPolicyRequestId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), resourceids.StaticSegment("staticResourceGuards", "resourceGuards", "resourceGuards"), - resourceids.UserSpecifiedSegment("resourceGuardsName", "resourceGuardsValue"), + resourceids.UserSpecifiedSegment("resourceGuardName", "resourceGuardValue"), resourceids.StaticSegment("staticUpdateProtectionPolicyRequests", "updateProtectionPolicyRequests", "updateProtectionPolicyRequests"), - resourceids.UserSpecifiedSegment("requestName", "requestValue"), + resourceids.UserSpecifiedSegment("updateProtectionPolicyRequestName", "updateProtectionPolicyRequestValue"), } } @@ -130,8 +130,8 @@ func (id UpdateProtectionPolicyRequestId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Guards Name: %q", id.ResourceGuardsName), - fmt.Sprintf("Request Name: %q", id.RequestName), + fmt.Sprintf("Resource Guard Name: %q", id.ResourceGuardName), + fmt.Sprintf("Update Protection Policy Request Name: %q", id.UpdateProtectionPolicyRequestName), } return fmt.Sprintf("Update Protection Policy Request (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/README.md new file mode 100644 index 000000000000..af96b76dd43d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/README.md @@ -0,0 +1,120 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account` Documentation + +The `account` SDK allows for interaction with the Azure Resource Manager Service `datashare` (API Version `2019-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account" +``` + + +### Client Initialization + +```go +client := account.NewAccountClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AccountClient.Create` + +```go +ctx := context.TODO() +id := account.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := account.Account{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AccountClient.Delete` + +```go +ctx := context.TODO() +id := account.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AccountClient.Get` + +```go +ctx := context.TODO() +id := account.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AccountClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := account.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AccountClient.ListBySubscription` + +```go +ctx := context.TODO() +id := account.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AccountClient.Update` + +```go +ctx := context.TODO() +id := account.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := account.AccountUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/client.go new file mode 100644 index 000000000000..576c4858107f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/client.go @@ -0,0 +1,18 @@ +package account + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountClient struct { + Client autorest.Client + baseUri string +} + +func NewAccountClientWithBaseURI(endpoint string) AccountClient { + return AccountClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/constants.go new file mode 100644 index 000000000000..03ce999d45b9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/constants.go @@ -0,0 +1,83 @@ +package account + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type Status string + +const ( + StatusAccepted Status = "Accepted" + StatusCanceled Status = "Canceled" + StatusFailed Status = "Failed" + StatusInProgress Status = "InProgress" + StatusSucceeded Status = "Succeeded" + StatusTransientFailure Status = "TransientFailure" +) + +func PossibleValuesForStatus() []string { + return []string{ + string(StatusAccepted), + string(StatusCanceled), + string(StatusFailed), + string(StatusInProgress), + string(StatusSucceeded), + string(StatusTransientFailure), + } +} + +func parseStatus(input string) (*Status, error) { + vals := map[string]Status{ + "accepted": StatusAccepted, + "canceled": StatusCanceled, + "failed": StatusFailed, + "inprogress": StatusInProgress, + "succeeded": StatusSucceeded, + "transientfailure": StatusTransientFailure, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/id_account.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/id_account.go new file mode 100644 index 000000000000..1ed95935b7e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/id_account.go @@ -0,0 +1,124 @@ +package account + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AccountId{} + +// AccountId is a struct representing the Resource ID for a Account +type AccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewAccountID returns a new AccountId struct +func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { + return AccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseAccountID parses 'input' into a AccountId +func ParseAccountID(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId +// note: this method should only be used for API response data and not user input +func ParseAccountIDInsensitively(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAccountID checks that 'input' can be parsed as a Account ID +func ValidateAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Account ID +func (id AccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataShare/accounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Account ID +func (id AccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataShare", "Microsoft.DataShare", "Microsoft.DataShare"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Account ID +func (id AccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_create_autorest.go new file mode 100644 index 000000000000..333abd0953ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_create_autorest.go @@ -0,0 +1,79 @@ +package account + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c AccountClient) Create(ctx context.Context, id AccountId, input Account) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c AccountClient) CreateThenPoll(ctx context.Context, id AccountId, input Account) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c AccountClient) preparerForCreate(ctx context.Context, id AccountId, input Account) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c AccountClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_delete_autorest.go new file mode 100644 index 000000000000..43aad84a7cc5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_delete_autorest.go @@ -0,0 +1,78 @@ +package account + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c AccountClient) Delete(ctx context.Context, id AccountId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c AccountClient) DeleteThenPoll(ctx context.Context, id AccountId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c AccountClient) preparerForDelete(ctx context.Context, id AccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c AccountClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_get_autorest.go new file mode 100644 index 000000000000..19da9f998f3e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_get_autorest.go @@ -0,0 +1,68 @@ +package account + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Account +} + +// Get ... +func (c AccountClient) Get(ctx context.Context, id AccountId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c AccountClient) preparerForGet(ctx context.Context, id AccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c AccountClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..2745e81ab6f7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package account + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Account + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Account +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c AccountClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c AccountClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DataShare/accounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c AccountClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c AccountClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Account `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c AccountClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, AccountOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AccountClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate AccountOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Account, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_listbysubscription_autorest.go new file mode 100644 index 000000000000..4192c83fe4f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package account + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Account + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []Account +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c AccountClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c AccountClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DataShare/accounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c AccountClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c AccountClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Account `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c AccountClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, AccountOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AccountClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate AccountOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]Account, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_update_autorest.go new file mode 100644 index 000000000000..a2e797065b1a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/method_update_autorest.go @@ -0,0 +1,69 @@ +package account + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Account +} + +// Update ... +func (c AccountClient) Update(ctx context.Context, id AccountId, input AccountUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c AccountClient) preparerForUpdate(ctx context.Context, id AccountId, input AccountUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c AccountClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/model_account.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/model_account.go new file mode 100644 index 000000000000..34f20c2ad878 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/model_account.go @@ -0,0 +1,18 @@ +package account + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Account struct { + Id *string `json:"id,omitempty"` + Identity identity.SystemAssigned `json:"identity"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AccountProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/model_accountproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/model_accountproperties.go new file mode 100644 index 000000000000..41a465b82e57 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/model_accountproperties.go @@ -0,0 +1,29 @@ +package account + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountProperties struct { + CreatedAt *string `json:"createdAt,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + UserEmail *string `json:"userEmail,omitempty"` + UserName *string `json:"userName,omitempty"` +} + +func (o *AccountProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *AccountProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/model_accountupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/model_accountupdateparameters.go new file mode 100644 index 000000000000..a056576b6a76 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/model_accountupdateparameters.go @@ -0,0 +1,8 @@ +package account + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountUpdateParameters struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/model_datashareerrorinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/model_datashareerrorinfo.go new file mode 100644 index 000000000000..ea9308f059aa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/model_datashareerrorinfo.go @@ -0,0 +1,11 @@ +package account + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataShareErrorInfo struct { + Code string `json:"code"` + Details *[]DataShareErrorInfo `json:"details,omitempty"` + Message string `json:"message"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/model_operationresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/model_operationresponse.go new file mode 100644 index 000000000000..afc2d8497074 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/model_operationresponse.go @@ -0,0 +1,41 @@ +package account + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OperationResponse struct { + EndTime *string `json:"endTime,omitempty"` + Error *DataShareErrorInfo `json:"error,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status Status `json:"status"` +} + +func (o *OperationResponse) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationResponse) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *OperationResponse) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationResponse) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/predicates.go new file mode 100644 index 000000000000..03af56e26c45 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/predicates.go @@ -0,0 +1,29 @@ +package account + +type AccountOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p AccountOperationPredicate) Matches(input Account) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/version.go new file mode 100644 index 000000000000..ceae4cb3a055 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account/version.go @@ -0,0 +1,12 @@ +package account + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/account/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/README.md new file mode 100644 index 000000000000..e6d75823f621 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/README.md @@ -0,0 +1,86 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset` Documentation + +The `dataset` SDK allows for interaction with the Azure Resource Manager Service `datashare` (API Version `2019-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset" +``` + + +### Client Initialization + +```go +client := dataset.NewDataSetClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DataSetClient.Create` + +```go +ctx := context.TODO() +id := dataset.NewDataSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue", "dataSetValue") + +payload := dataset.DataSet{ + // ... +} + + +read, err := client.Create(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DataSetClient.Delete` + +```go +ctx := context.TODO() +id := dataset.NewDataSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue", "dataSetValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DataSetClient.Get` + +```go +ctx := context.TODO() +id := dataset.NewDataSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue", "dataSetValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DataSetClient.ListByShare` + +```go +ctx := context.TODO() +id := dataset.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue") + +// alternatively `client.ListByShare(ctx, id, dataset.DefaultListByShareOperationOptions())` can be used to do batched pagination +items, err := client.ListByShareComplete(ctx, id, dataset.DefaultListByShareOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/client.go new file mode 100644 index 000000000000..be32ac16c05b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/client.go @@ -0,0 +1,18 @@ +package dataset + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataSetClient struct { + Client autorest.Client + baseUri string +} + +func NewDataSetClientWithBaseURI(endpoint string) DataSetClient { + return DataSetClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/constants.go new file mode 100644 index 000000000000..eda548c66db8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/constants.go @@ -0,0 +1,101 @@ +package dataset + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataSetKind string + +const ( + DataSetKindAdlsGenOneFile DataSetKind = "AdlsGen1File" + DataSetKindAdlsGenOneFolder DataSetKind = "AdlsGen1Folder" + DataSetKindAdlsGenTwoFile DataSetKind = "AdlsGen2File" + DataSetKindAdlsGenTwoFileSystem DataSetKind = "AdlsGen2FileSystem" + DataSetKindAdlsGenTwoFolder DataSetKind = "AdlsGen2Folder" + DataSetKindBlob DataSetKind = "Blob" + DataSetKindBlobFolder DataSetKind = "BlobFolder" + DataSetKindContainer DataSetKind = "Container" + DataSetKindKustoCluster DataSetKind = "KustoCluster" + DataSetKindKustoDatabase DataSetKind = "KustoDatabase" + DataSetKindSqlDBTable DataSetKind = "SqlDBTable" + DataSetKindSqlDWTable DataSetKind = "SqlDWTable" +) + +func PossibleValuesForDataSetKind() []string { + return []string{ + string(DataSetKindAdlsGenOneFile), + string(DataSetKindAdlsGenOneFolder), + string(DataSetKindAdlsGenTwoFile), + string(DataSetKindAdlsGenTwoFileSystem), + string(DataSetKindAdlsGenTwoFolder), + string(DataSetKindBlob), + string(DataSetKindBlobFolder), + string(DataSetKindContainer), + string(DataSetKindKustoCluster), + string(DataSetKindKustoDatabase), + string(DataSetKindSqlDBTable), + string(DataSetKindSqlDWTable), + } +} + +func parseDataSetKind(input string) (*DataSetKind, error) { + vals := map[string]DataSetKind{ + "adlsgen1file": DataSetKindAdlsGenOneFile, + "adlsgen1folder": DataSetKindAdlsGenOneFolder, + "adlsgen2file": DataSetKindAdlsGenTwoFile, + "adlsgen2filesystem": DataSetKindAdlsGenTwoFileSystem, + "adlsgen2folder": DataSetKindAdlsGenTwoFolder, + "blob": DataSetKindBlob, + "blobfolder": DataSetKindBlobFolder, + "container": DataSetKindContainer, + "kustocluster": DataSetKindKustoCluster, + "kustodatabase": DataSetKindKustoDatabase, + "sqldbtable": DataSetKindSqlDBTable, + "sqldwtable": DataSetKindSqlDWTable, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DataSetKind(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/id_dataset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/id_dataset.go new file mode 100644 index 000000000000..b3fa8714afcb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/id_dataset.go @@ -0,0 +1,150 @@ +package dataset + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DataSetId{} + +// DataSetId is a struct representing the Resource ID for a Data Set +type DataSetId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + ShareName string + DataSetName string +} + +// NewDataSetID returns a new DataSetId struct +func NewDataSetID(subscriptionId string, resourceGroupName string, accountName string, shareName string, dataSetName string) DataSetId { + return DataSetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + ShareName: shareName, + DataSetName: dataSetName, + } +} + +// ParseDataSetID parses 'input' into a DataSetId +func ParseDataSetID(input string) (*DataSetId, error) { + parser := resourceids.NewParserFromResourceIdType(DataSetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DataSetId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { + return nil, fmt.Errorf("the segment 'shareName' was not found in the resource id %q", input) + } + + if id.DataSetName, ok = parsed.Parsed["dataSetName"]; !ok { + return nil, fmt.Errorf("the segment 'dataSetName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDataSetIDInsensitively parses 'input' case-insensitively into a DataSetId +// note: this method should only be used for API response data and not user input +func ParseDataSetIDInsensitively(input string) (*DataSetId, error) { + parser := resourceids.NewParserFromResourceIdType(DataSetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DataSetId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { + return nil, fmt.Errorf("the segment 'shareName' was not found in the resource id %q", input) + } + + if id.DataSetName, ok = parsed.Parsed["dataSetName"]; !ok { + return nil, fmt.Errorf("the segment 'dataSetName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDataSetID checks that 'input' can be parsed as a Data Set ID +func ValidateDataSetID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDataSetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Data Set ID +func (id DataSetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataShare/accounts/%s/shares/%s/dataSets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName, id.DataSetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Data Set ID +func (id DataSetId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataShare", "Microsoft.DataShare", "Microsoft.DataShare"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticShares", "shares", "shares"), + resourceids.UserSpecifiedSegment("shareName", "shareValue"), + resourceids.StaticSegment("staticDataSets", "dataSets", "dataSets"), + resourceids.UserSpecifiedSegment("dataSetName", "dataSetValue"), + } +} + +// String returns a human-readable description of this Data Set ID +func (id DataSetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Share Name: %q", id.ShareName), + fmt.Sprintf("Data Set Name: %q", id.DataSetName), + } + return fmt.Sprintf("Data Set (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/id_share.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/id_share.go new file mode 100644 index 000000000000..dcc832168ed4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/id_share.go @@ -0,0 +1,137 @@ +package dataset + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ShareId{} + +// ShareId is a struct representing the Resource ID for a Share +type ShareId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + ShareName string +} + +// NewShareID returns a new ShareId struct +func NewShareID(subscriptionId string, resourceGroupName string, accountName string, shareName string) ShareId { + return ShareId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + ShareName: shareName, + } +} + +// ParseShareID parses 'input' into a ShareId +func ParseShareID(input string) (*ShareId, error) { + parser := resourceids.NewParserFromResourceIdType(ShareId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ShareId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { + return nil, fmt.Errorf("the segment 'shareName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseShareIDInsensitively parses 'input' case-insensitively into a ShareId +// note: this method should only be used for API response data and not user input +func ParseShareIDInsensitively(input string) (*ShareId, error) { + parser := resourceids.NewParserFromResourceIdType(ShareId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ShareId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { + return nil, fmt.Errorf("the segment 'shareName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateShareID checks that 'input' can be parsed as a Share ID +func ValidateShareID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseShareID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Share ID +func (id ShareId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataShare/accounts/%s/shares/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Share ID +func (id ShareId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataShare", "Microsoft.DataShare", "Microsoft.DataShare"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticShares", "shares", "shares"), + resourceids.UserSpecifiedSegment("shareName", "shareValue"), + } +} + +// String returns a human-readable description of this Share ID +func (id ShareId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Share Name: %q", id.ShareName), + } + return fmt.Sprintf("Share (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/method_create_autorest.go new file mode 100644 index 000000000000..5dab53df3de4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/method_create_autorest.go @@ -0,0 +1,75 @@ +package dataset + +import ( + "context" + "encoding/json" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *DataSet +} + +// Create ... +func (c DataSetClient) Create(ctx context.Context, id DataSetId, input DataSet) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dataset.DataSetClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dataset.DataSetClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dataset.DataSetClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c DataSetClient) preparerForCreate(ctx context.Context, id DataSetId, input DataSet) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c DataSetClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + var respObj json.RawMessage + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + model, err := unmarshalDataSetImplementation(respObj) + if err != nil { + return + } + result.Model = &model + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/method_delete_autorest.go new file mode 100644 index 000000000000..508b523411db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/method_delete_autorest.go @@ -0,0 +1,78 @@ +package dataset + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c DataSetClient) Delete(ctx context.Context, id DataSetId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dataset.DataSetClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "dataset.DataSetClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DataSetClient) DeleteThenPoll(ctx context.Context, id DataSetId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c DataSetClient) preparerForDelete(ctx context.Context, id DataSetId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c DataSetClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/method_get_autorest.go new file mode 100644 index 000000000000..85c66bee7109 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/method_get_autorest.go @@ -0,0 +1,74 @@ +package dataset + +import ( + "context" + "encoding/json" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *DataSet +} + +// Get ... +func (c DataSetClient) Get(ctx context.Context, id DataSetId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dataset.DataSetClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dataset.DataSetClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dataset.DataSetClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DataSetClient) preparerForGet(ctx context.Context, id DataSetId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DataSetClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + var respObj json.RawMessage + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + model, err := unmarshalDataSetImplementation(respObj) + if err != nil { + return + } + result.Model = &model + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/method_listbyshare_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/method_listbyshare_autorest.go new file mode 100644 index 000000000000..f03dcb1555a1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/method_listbyshare_autorest.go @@ -0,0 +1,230 @@ +package dataset + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByShareOperationResponse struct { + HttpResponse *http.Response + Model *[]DataSet + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByShareOperationResponse, error) +} + +type ListByShareCompleteResult struct { + Items []DataSet +} + +func (r ListByShareOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByShareOperationResponse) LoadMore(ctx context.Context) (resp ListByShareOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByShareOperationOptions struct { + Filter *string + Orderby *string +} + +func DefaultListByShareOperationOptions() ListByShareOperationOptions { + return ListByShareOperationOptions{} +} + +func (o ListByShareOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByShareOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Orderby != nil { + out["$orderby"] = *o.Orderby + } + + return out +} + +// ListByShare ... +func (c DataSetClient) ListByShare(ctx context.Context, id ShareId, options ListByShareOperationOptions) (resp ListByShareOperationResponse, err error) { + req, err := c.preparerForListByShare(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "dataset.DataSetClient", "ListByShare", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dataset.DataSetClient", "ListByShare", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByShare(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dataset.DataSetClient", "ListByShare", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByShare prepares the ListByShare request. +func (c DataSetClient) preparerForListByShare(ctx context.Context, id ShareId, options ListByShareOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/dataSets", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByShareWithNextLink prepares the ListByShare request with the given nextLink token. +func (c DataSetClient) preparerForListByShareWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByShare handles the response to the ListByShare request. The method always +// closes the http.Response Body. +func (c DataSetClient) responderForListByShare(resp *http.Response) (result ListByShareOperationResponse, err error) { + type page struct { + Values []json.RawMessage `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + temp := make([]DataSet, 0) + for i, v := range respObj.Values { + val, err := unmarshalDataSetImplementation(v) + if err != nil { + err = fmt.Errorf("unmarshalling item %d for DataSet (%q): %+v", i, v, err) + return result, err + } + temp = append(temp, val) + } + result.Model = &temp + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByShareOperationResponse, err error) { + req, err := c.preparerForListByShareWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "dataset.DataSetClient", "ListByShare", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dataset.DataSetClient", "ListByShare", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByShare(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dataset.DataSetClient", "ListByShare", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByShareComplete retrieves all of the results into a single object +func (c DataSetClient) ListByShareComplete(ctx context.Context, id ShareId, options ListByShareOperationOptions) (ListByShareCompleteResult, error) { + return c.ListByShareCompleteMatchingPredicate(ctx, id, options, DataSetOperationPredicate{}) +} + +// ListByShareCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DataSetClient) ListByShareCompleteMatchingPredicate(ctx context.Context, id ShareId, options ListByShareOperationOptions, predicate DataSetOperationPredicate) (resp ListByShareCompleteResult, err error) { + items := make([]DataSet, 0) + + page, err := c.ListByShare(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByShareCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen1filedataset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen1filedataset.go new file mode 100644 index 000000000000..f5e09903ee48 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen1filedataset.go @@ -0,0 +1,44 @@ +package dataset + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataSet = ADLSGen1FileDataSet{} + +type ADLSGen1FileDataSet struct { + Properties ADLSGen1FileProperties `json:"properties"` + + // Fields inherited from DataSet + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = ADLSGen1FileDataSet{} + +func (s ADLSGen1FileDataSet) MarshalJSON() ([]byte, error) { + type wrapper ADLSGen1FileDataSet + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ADLSGen1FileDataSet: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ADLSGen1FileDataSet: %+v", err) + } + decoded["kind"] = "AdlsGen1File" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ADLSGen1FileDataSet: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen1fileproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen1fileproperties.go new file mode 100644 index 000000000000..f833062a92f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen1fileproperties.go @@ -0,0 +1,13 @@ +package dataset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ADLSGen1FileProperties struct { + AccountName string `json:"accountName"` + DataSetId *string `json:"dataSetId,omitempty"` + FileName string `json:"fileName"` + FolderPath string `json:"folderPath"` + ResourceGroup string `json:"resourceGroup"` + SubscriptionId string `json:"subscriptionId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen1folderdataset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen1folderdataset.go new file mode 100644 index 000000000000..6be08cf392a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen1folderdataset.go @@ -0,0 +1,44 @@ +package dataset + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataSet = ADLSGen1FolderDataSet{} + +type ADLSGen1FolderDataSet struct { + Properties ADLSGen1FolderProperties `json:"properties"` + + // Fields inherited from DataSet + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = ADLSGen1FolderDataSet{} + +func (s ADLSGen1FolderDataSet) MarshalJSON() ([]byte, error) { + type wrapper ADLSGen1FolderDataSet + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ADLSGen1FolderDataSet: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ADLSGen1FolderDataSet: %+v", err) + } + decoded["kind"] = "AdlsGen1Folder" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ADLSGen1FolderDataSet: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen1folderproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen1folderproperties.go new file mode 100644 index 000000000000..9ec364dc774f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen1folderproperties.go @@ -0,0 +1,12 @@ +package dataset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ADLSGen1FolderProperties struct { + AccountName string `json:"accountName"` + DataSetId *string `json:"dataSetId,omitempty"` + FolderPath string `json:"folderPath"` + ResourceGroup string `json:"resourceGroup"` + SubscriptionId string `json:"subscriptionId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2filedataset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2filedataset.go new file mode 100644 index 000000000000..d51cce78f580 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2filedataset.go @@ -0,0 +1,44 @@ +package dataset + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataSet = ADLSGen2FileDataSet{} + +type ADLSGen2FileDataSet struct { + Properties ADLSGen2FileProperties `json:"properties"` + + // Fields inherited from DataSet + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = ADLSGen2FileDataSet{} + +func (s ADLSGen2FileDataSet) MarshalJSON() ([]byte, error) { + type wrapper ADLSGen2FileDataSet + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ADLSGen2FileDataSet: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ADLSGen2FileDataSet: %+v", err) + } + decoded["kind"] = "AdlsGen2File" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ADLSGen2FileDataSet: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2fileproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2fileproperties.go new file mode 100644 index 000000000000..df2fb661de79 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2fileproperties.go @@ -0,0 +1,13 @@ +package dataset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ADLSGen2FileProperties struct { + DataSetId *string `json:"dataSetId,omitempty"` + FilePath string `json:"filePath"` + FileSystem string `json:"fileSystem"` + ResourceGroup string `json:"resourceGroup"` + StorageAccountName string `json:"storageAccountName"` + SubscriptionId string `json:"subscriptionId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2filesystemdataset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2filesystemdataset.go new file mode 100644 index 000000000000..527d9d38791d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2filesystemdataset.go @@ -0,0 +1,44 @@ +package dataset + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataSet = ADLSGen2FileSystemDataSet{} + +type ADLSGen2FileSystemDataSet struct { + Properties ADLSGen2FileSystemProperties `json:"properties"` + + // Fields inherited from DataSet + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = ADLSGen2FileSystemDataSet{} + +func (s ADLSGen2FileSystemDataSet) MarshalJSON() ([]byte, error) { + type wrapper ADLSGen2FileSystemDataSet + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ADLSGen2FileSystemDataSet: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ADLSGen2FileSystemDataSet: %+v", err) + } + decoded["kind"] = "AdlsGen2FileSystem" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ADLSGen2FileSystemDataSet: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2filesystemproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2filesystemproperties.go new file mode 100644 index 000000000000..724e2f49fe1a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2filesystemproperties.go @@ -0,0 +1,12 @@ +package dataset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ADLSGen2FileSystemProperties struct { + DataSetId *string `json:"dataSetId,omitempty"` + FileSystem string `json:"fileSystem"` + ResourceGroup string `json:"resourceGroup"` + StorageAccountName string `json:"storageAccountName"` + SubscriptionId string `json:"subscriptionId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2folderdataset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2folderdataset.go new file mode 100644 index 000000000000..bbd0eb960d66 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2folderdataset.go @@ -0,0 +1,44 @@ +package dataset + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataSet = ADLSGen2FolderDataSet{} + +type ADLSGen2FolderDataSet struct { + Properties ADLSGen2FolderProperties `json:"properties"` + + // Fields inherited from DataSet + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = ADLSGen2FolderDataSet{} + +func (s ADLSGen2FolderDataSet) MarshalJSON() ([]byte, error) { + type wrapper ADLSGen2FolderDataSet + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ADLSGen2FolderDataSet: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ADLSGen2FolderDataSet: %+v", err) + } + decoded["kind"] = "AdlsGen2Folder" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ADLSGen2FolderDataSet: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2folderproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2folderproperties.go new file mode 100644 index 000000000000..af5b78ae9453 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_adlsgen2folderproperties.go @@ -0,0 +1,13 @@ +package dataset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ADLSGen2FolderProperties struct { + DataSetId *string `json:"dataSetId,omitempty"` + FileSystem string `json:"fileSystem"` + FolderPath string `json:"folderPath"` + ResourceGroup string `json:"resourceGroup"` + StorageAccountName string `json:"storageAccountName"` + SubscriptionId string `json:"subscriptionId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobcontainerdataset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobcontainerdataset.go new file mode 100644 index 000000000000..1e24d2f28490 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobcontainerdataset.go @@ -0,0 +1,44 @@ +package dataset + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataSet = BlobContainerDataSet{} + +type BlobContainerDataSet struct { + Properties BlobContainerProperties `json:"properties"` + + // Fields inherited from DataSet + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = BlobContainerDataSet{} + +func (s BlobContainerDataSet) MarshalJSON() ([]byte, error) { + type wrapper BlobContainerDataSet + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling BlobContainerDataSet: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling BlobContainerDataSet: %+v", err) + } + decoded["kind"] = "Container" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling BlobContainerDataSet: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobcontainerproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobcontainerproperties.go new file mode 100644 index 000000000000..1a7855d9b9d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobcontainerproperties.go @@ -0,0 +1,12 @@ +package dataset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BlobContainerProperties struct { + ContainerName string `json:"containerName"` + DataSetId *string `json:"dataSetId,omitempty"` + ResourceGroup string `json:"resourceGroup"` + StorageAccountName string `json:"storageAccountName"` + SubscriptionId string `json:"subscriptionId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobdataset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobdataset.go new file mode 100644 index 000000000000..b26fb8f16aac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobdataset.go @@ -0,0 +1,44 @@ +package dataset + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataSet = BlobDataSet{} + +type BlobDataSet struct { + Properties BlobProperties `json:"properties"` + + // Fields inherited from DataSet + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = BlobDataSet{} + +func (s BlobDataSet) MarshalJSON() ([]byte, error) { + type wrapper BlobDataSet + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling BlobDataSet: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling BlobDataSet: %+v", err) + } + decoded["kind"] = "Blob" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling BlobDataSet: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobfolderdataset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobfolderdataset.go new file mode 100644 index 000000000000..4ab5a200c42e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobfolderdataset.go @@ -0,0 +1,44 @@ +package dataset + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataSet = BlobFolderDataSet{} + +type BlobFolderDataSet struct { + Properties BlobFolderProperties `json:"properties"` + + // Fields inherited from DataSet + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = BlobFolderDataSet{} + +func (s BlobFolderDataSet) MarshalJSON() ([]byte, error) { + type wrapper BlobFolderDataSet + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling BlobFolderDataSet: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling BlobFolderDataSet: %+v", err) + } + decoded["kind"] = "BlobFolder" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling BlobFolderDataSet: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobfolderproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobfolderproperties.go new file mode 100644 index 000000000000..491003b64ae5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobfolderproperties.go @@ -0,0 +1,13 @@ +package dataset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BlobFolderProperties struct { + ContainerName string `json:"containerName"` + DataSetId *string `json:"dataSetId,omitempty"` + Prefix string `json:"prefix"` + ResourceGroup string `json:"resourceGroup"` + StorageAccountName string `json:"storageAccountName"` + SubscriptionId string `json:"subscriptionId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobproperties.go new file mode 100644 index 000000000000..28ff28e1f007 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_blobproperties.go @@ -0,0 +1,13 @@ +package dataset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BlobProperties struct { + ContainerName string `json:"containerName"` + DataSetId *string `json:"dataSetId,omitempty"` + FilePath string `json:"filePath"` + ResourceGroup string `json:"resourceGroup"` + StorageAccountName string `json:"storageAccountName"` + SubscriptionId string `json:"subscriptionId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_dataset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_dataset.go new file mode 100644 index 000000000000..04c25889b6a8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_dataset.go @@ -0,0 +1,136 @@ +package dataset + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataSet interface { +} + +func unmarshalDataSetImplementation(input []byte) (DataSet, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling DataSet into map[string]interface: %+v", err) + } + + value, ok := temp["kind"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "AdlsGen1File") { + var out ADLSGen1FileDataSet + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ADLSGen1FileDataSet: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "AdlsGen1Folder") { + var out ADLSGen1FolderDataSet + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ADLSGen1FolderDataSet: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "AdlsGen2File") { + var out ADLSGen2FileDataSet + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ADLSGen2FileDataSet: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "AdlsGen2FileSystem") { + var out ADLSGen2FileSystemDataSet + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ADLSGen2FileSystemDataSet: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "AdlsGen2Folder") { + var out ADLSGen2FolderDataSet + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ADLSGen2FolderDataSet: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Container") { + var out BlobContainerDataSet + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into BlobContainerDataSet: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Blob") { + var out BlobDataSet + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into BlobDataSet: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "BlobFolder") { + var out BlobFolderDataSet + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into BlobFolderDataSet: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "KustoCluster") { + var out KustoClusterDataSet + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into KustoClusterDataSet: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "KustoDatabase") { + var out KustoDatabaseDataSet + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into KustoDatabaseDataSet: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "SqlDBTable") { + var out SqlDBTableDataSet + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SqlDBTableDataSet: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "SqlDWTable") { + var out SqlDWTableDataSet + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SqlDWTableDataSet: %+v", err) + } + return out, nil + } + + type RawDataSetImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawDataSetImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_kustoclusterdataset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_kustoclusterdataset.go new file mode 100644 index 000000000000..5383c37db97c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_kustoclusterdataset.go @@ -0,0 +1,44 @@ +package dataset + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataSet = KustoClusterDataSet{} + +type KustoClusterDataSet struct { + Properties KustoClusterDataSetProperties `json:"properties"` + + // Fields inherited from DataSet + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = KustoClusterDataSet{} + +func (s KustoClusterDataSet) MarshalJSON() ([]byte, error) { + type wrapper KustoClusterDataSet + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling KustoClusterDataSet: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling KustoClusterDataSet: %+v", err) + } + decoded["kind"] = "KustoCluster" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling KustoClusterDataSet: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_kustoclusterdatasetproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_kustoclusterdatasetproperties.go new file mode 100644 index 000000000000..0aba6de4b952 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_kustoclusterdatasetproperties.go @@ -0,0 +1,11 @@ +package dataset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KustoClusterDataSetProperties struct { + DataSetId *string `json:"dataSetId,omitempty"` + KustoClusterResourceId string `json:"kustoClusterResourceId"` + Location *string `json:"location,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_kustodatabasedataset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_kustodatabasedataset.go new file mode 100644 index 000000000000..9d7c00754d71 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_kustodatabasedataset.go @@ -0,0 +1,44 @@ +package dataset + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataSet = KustoDatabaseDataSet{} + +type KustoDatabaseDataSet struct { + Properties KustoDatabaseDataSetProperties `json:"properties"` + + // Fields inherited from DataSet + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = KustoDatabaseDataSet{} + +func (s KustoDatabaseDataSet) MarshalJSON() ([]byte, error) { + type wrapper KustoDatabaseDataSet + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling KustoDatabaseDataSet: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling KustoDatabaseDataSet: %+v", err) + } + decoded["kind"] = "KustoDatabase" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling KustoDatabaseDataSet: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_kustodatabasedatasetproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_kustodatabasedatasetproperties.go new file mode 100644 index 000000000000..ced03b9b40c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_kustodatabasedatasetproperties.go @@ -0,0 +1,11 @@ +package dataset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KustoDatabaseDataSetProperties struct { + DataSetId *string `json:"dataSetId,omitempty"` + KustoDatabaseResourceId string `json:"kustoDatabaseResourceId"` + Location *string `json:"location,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_sqldbtabledataset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_sqldbtabledataset.go new file mode 100644 index 000000000000..4dc4e4bbd88c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_sqldbtabledataset.go @@ -0,0 +1,44 @@ +package dataset + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataSet = SqlDBTableDataSet{} + +type SqlDBTableDataSet struct { + Properties *SqlDBTableProperties `json:"properties,omitempty"` + + // Fields inherited from DataSet + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = SqlDBTableDataSet{} + +func (s SqlDBTableDataSet) MarshalJSON() ([]byte, error) { + type wrapper SqlDBTableDataSet + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SqlDBTableDataSet: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SqlDBTableDataSet: %+v", err) + } + decoded["kind"] = "SqlDBTable" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SqlDBTableDataSet: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_sqldbtableproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_sqldbtableproperties.go new file mode 100644 index 000000000000..f80377a6a3b0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_sqldbtableproperties.go @@ -0,0 +1,12 @@ +package dataset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SqlDBTableProperties struct { + DataSetId *string `json:"dataSetId,omitempty"` + DatabaseName string `json:"databaseName"` + SchemaName string `json:"schemaName"` + SqlServerResourceId string `json:"sqlServerResourceId"` + TableName string `json:"tableName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_sqldwtabledataset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_sqldwtabledataset.go new file mode 100644 index 000000000000..f9b8a87f5a2f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_sqldwtabledataset.go @@ -0,0 +1,44 @@ +package dataset + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataSet = SqlDWTableDataSet{} + +type SqlDWTableDataSet struct { + Properties *SqlDWTableProperties `json:"properties,omitempty"` + + // Fields inherited from DataSet + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = SqlDWTableDataSet{} + +func (s SqlDWTableDataSet) MarshalJSON() ([]byte, error) { + type wrapper SqlDWTableDataSet + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SqlDWTableDataSet: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SqlDWTableDataSet: %+v", err) + } + decoded["kind"] = "SqlDWTable" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SqlDWTableDataSet: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_sqldwtableproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_sqldwtableproperties.go new file mode 100644 index 000000000000..b722ed4d2c60 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/model_sqldwtableproperties.go @@ -0,0 +1,12 @@ +package dataset + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SqlDWTableProperties struct { + DataSetId *string `json:"dataSetId,omitempty"` + DataWarehouseName string `json:"dataWarehouseName"` + SchemaName string `json:"schemaName"` + SqlServerResourceId string `json:"sqlServerResourceId"` + TableName string `json:"tableName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/predicates.go new file mode 100644 index 000000000000..143b0558def0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/predicates.go @@ -0,0 +1,9 @@ +package dataset + +type DataSetOperationPredicate struct { +} + +func (p DataSetOperationPredicate) Matches(input DataSet) bool { + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/version.go new file mode 100644 index 000000000000..63478e818f61 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset/version.go @@ -0,0 +1,12 @@ +package dataset + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/dataset/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/README.md new file mode 100644 index 000000000000..f7c387a9d423 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/README.md @@ -0,0 +1,186 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share` Documentation + +The `share` SDK allows for interaction with the Azure Resource Manager Service `datashare` (API Version `2019-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share" +``` + + +### Client Initialization + +```go +client := share.NewShareClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ShareClient.Create` + +```go +ctx := context.TODO() +id := share.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue") + +payload := share.Share{ + // ... +} + + +read, err := client.Create(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ShareClient.Delete` + +```go +ctx := context.TODO() +id := share.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ShareClient.Get` + +```go +ctx := context.TODO() +id := share.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ShareClient.ListByAccount` + +```go +ctx := context.TODO() +id := share.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +// alternatively `client.ListByAccount(ctx, id, share.DefaultListByAccountOperationOptions())` can be used to do batched pagination +items, err := client.ListByAccountComplete(ctx, id, share.DefaultListByAccountOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ShareClient.ListSynchronizationDetails` + +```go +ctx := context.TODO() +id := share.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue") + +payload := share.ShareSynchronization{ + // ... +} + + +// alternatively `client.ListSynchronizationDetails(ctx, id, payload, share.DefaultListSynchronizationDetailsOperationOptions())` can be used to do batched pagination +items, err := client.ListSynchronizationDetailsComplete(ctx, id, payload, share.DefaultListSynchronizationDetailsOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ShareClient.ListSynchronizations` + +```go +ctx := context.TODO() +id := share.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue") + +// alternatively `client.ListSynchronizations(ctx, id, share.DefaultListSynchronizationsOperationOptions())` can be used to do batched pagination +items, err := client.ListSynchronizationsComplete(ctx, id, share.DefaultListSynchronizationsOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ShareClient.ProviderShareSubscriptionsGetByShare` + +```go +ctx := context.TODO() +id := share.NewProviderShareSubscriptionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue", "providerShareSubscriptionIdValue") + +read, err := client.ProviderShareSubscriptionsGetByShare(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ShareClient.ProviderShareSubscriptionsListByShare` + +```go +ctx := context.TODO() +id := share.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue") + +// alternatively `client.ProviderShareSubscriptionsListByShare(ctx, id)` can be used to do batched pagination +items, err := client.ProviderShareSubscriptionsListByShareComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ShareClient.ProviderShareSubscriptionsReinstate` + +```go +ctx := context.TODO() +id := share.NewProviderShareSubscriptionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue", "providerShareSubscriptionIdValue") + +read, err := client.ProviderShareSubscriptionsReinstate(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ShareClient.ProviderShareSubscriptionsRevoke` + +```go +ctx := context.TODO() +id := share.NewProviderShareSubscriptionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue", "providerShareSubscriptionIdValue") + +if err := client.ProviderShareSubscriptionsRevokeThenPoll(ctx, id); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/client.go new file mode 100644 index 000000000000..68d742c54b68 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/client.go @@ -0,0 +1,18 @@ +package share + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ShareClient struct { + Client autorest.Client + baseUri string +} + +func NewShareClientWithBaseURI(endpoint string) ShareClient { + return ShareClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/constants.go new file mode 100644 index 000000000000..b847ecd2c069 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/constants.go @@ -0,0 +1,231 @@ +package share + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataSetType string + +const ( + DataSetTypeAdlsGenOneFile DataSetType = "AdlsGen1File" + DataSetTypeAdlsGenOneFolder DataSetType = "AdlsGen1Folder" + DataSetTypeAdlsGenTwoFile DataSetType = "AdlsGen2File" + DataSetTypeAdlsGenTwoFileSystem DataSetType = "AdlsGen2FileSystem" + DataSetTypeAdlsGenTwoFolder DataSetType = "AdlsGen2Folder" + DataSetTypeBlob DataSetType = "Blob" + DataSetTypeBlobFolder DataSetType = "BlobFolder" + DataSetTypeContainer DataSetType = "Container" + DataSetTypeKustoCluster DataSetType = "KustoCluster" + DataSetTypeKustoDatabase DataSetType = "KustoDatabase" + DataSetTypeSqlDBTable DataSetType = "SqlDBTable" + DataSetTypeSqlDWTable DataSetType = "SqlDWTable" +) + +func PossibleValuesForDataSetType() []string { + return []string{ + string(DataSetTypeAdlsGenOneFile), + string(DataSetTypeAdlsGenOneFolder), + string(DataSetTypeAdlsGenTwoFile), + string(DataSetTypeAdlsGenTwoFileSystem), + string(DataSetTypeAdlsGenTwoFolder), + string(DataSetTypeBlob), + string(DataSetTypeBlobFolder), + string(DataSetTypeContainer), + string(DataSetTypeKustoCluster), + string(DataSetTypeKustoDatabase), + string(DataSetTypeSqlDBTable), + string(DataSetTypeSqlDWTable), + } +} + +func parseDataSetType(input string) (*DataSetType, error) { + vals := map[string]DataSetType{ + "adlsgen1file": DataSetTypeAdlsGenOneFile, + "adlsgen1folder": DataSetTypeAdlsGenOneFolder, + "adlsgen2file": DataSetTypeAdlsGenTwoFile, + "adlsgen2filesystem": DataSetTypeAdlsGenTwoFileSystem, + "adlsgen2folder": DataSetTypeAdlsGenTwoFolder, + "blob": DataSetTypeBlob, + "blobfolder": DataSetTypeBlobFolder, + "container": DataSetTypeContainer, + "kustocluster": DataSetTypeKustoCluster, + "kustodatabase": DataSetTypeKustoDatabase, + "sqldbtable": DataSetTypeSqlDBTable, + "sqldwtable": DataSetTypeSqlDWTable, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DataSetType(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type ShareKind string + +const ( + ShareKindCopyBased ShareKind = "CopyBased" + ShareKindInPlace ShareKind = "InPlace" +) + +func PossibleValuesForShareKind() []string { + return []string{ + string(ShareKindCopyBased), + string(ShareKindInPlace), + } +} + +func parseShareKind(input string) (*ShareKind, error) { + vals := map[string]ShareKind{ + "copybased": ShareKindCopyBased, + "inplace": ShareKindInPlace, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ShareKind(input) + return &out, nil +} + +type ShareSubscriptionStatus string + +const ( + ShareSubscriptionStatusActive ShareSubscriptionStatus = "Active" + ShareSubscriptionStatusRevoked ShareSubscriptionStatus = "Revoked" + ShareSubscriptionStatusRevoking ShareSubscriptionStatus = "Revoking" + ShareSubscriptionStatusSourceDeleted ShareSubscriptionStatus = "SourceDeleted" +) + +func PossibleValuesForShareSubscriptionStatus() []string { + return []string{ + string(ShareSubscriptionStatusActive), + string(ShareSubscriptionStatusRevoked), + string(ShareSubscriptionStatusRevoking), + string(ShareSubscriptionStatusSourceDeleted), + } +} + +func parseShareSubscriptionStatus(input string) (*ShareSubscriptionStatus, error) { + vals := map[string]ShareSubscriptionStatus{ + "active": ShareSubscriptionStatusActive, + "revoked": ShareSubscriptionStatusRevoked, + "revoking": ShareSubscriptionStatusRevoking, + "sourcedeleted": ShareSubscriptionStatusSourceDeleted, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ShareSubscriptionStatus(input) + return &out, nil +} + +type Status string + +const ( + StatusAccepted Status = "Accepted" + StatusCanceled Status = "Canceled" + StatusFailed Status = "Failed" + StatusInProgress Status = "InProgress" + StatusSucceeded Status = "Succeeded" + StatusTransientFailure Status = "TransientFailure" +) + +func PossibleValuesForStatus() []string { + return []string{ + string(StatusAccepted), + string(StatusCanceled), + string(StatusFailed), + string(StatusInProgress), + string(StatusSucceeded), + string(StatusTransientFailure), + } +} + +func parseStatus(input string) (*Status, error) { + vals := map[string]Status{ + "accepted": StatusAccepted, + "canceled": StatusCanceled, + "failed": StatusFailed, + "inprogress": StatusInProgress, + "succeeded": StatusSucceeded, + "transientfailure": StatusTransientFailure, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} + +type SynchronizationMode string + +const ( + SynchronizationModeFullSync SynchronizationMode = "FullSync" + SynchronizationModeIncremental SynchronizationMode = "Incremental" +) + +func PossibleValuesForSynchronizationMode() []string { + return []string{ + string(SynchronizationModeFullSync), + string(SynchronizationModeIncremental), + } +} + +func parseSynchronizationMode(input string) (*SynchronizationMode, error) { + vals := map[string]SynchronizationMode{ + "fullsync": SynchronizationModeFullSync, + "incremental": SynchronizationModeIncremental, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SynchronizationMode(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/id_account.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/id_account.go new file mode 100644 index 000000000000..b653ac5803e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/id_account.go @@ -0,0 +1,124 @@ +package share + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AccountId{} + +// AccountId is a struct representing the Resource ID for a Account +type AccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewAccountID returns a new AccountId struct +func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { + return AccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseAccountID parses 'input' into a AccountId +func ParseAccountID(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId +// note: this method should only be used for API response data and not user input +func ParseAccountIDInsensitively(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAccountID checks that 'input' can be parsed as a Account ID +func ValidateAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Account ID +func (id AccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataShare/accounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Account ID +func (id AccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataShare", "Microsoft.DataShare", "Microsoft.DataShare"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Account ID +func (id AccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/id_providersharesubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/id_providersharesubscription.go new file mode 100644 index 000000000000..938724a43fda --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/id_providersharesubscription.go @@ -0,0 +1,150 @@ +package share + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ProviderShareSubscriptionId{} + +// ProviderShareSubscriptionId is a struct representing the Resource ID for a Provider Share Subscription +type ProviderShareSubscriptionId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + ShareName string + ProviderShareSubscriptionId string +} + +// NewProviderShareSubscriptionID returns a new ProviderShareSubscriptionId struct +func NewProviderShareSubscriptionID(subscriptionId string, resourceGroupName string, accountName string, shareName string, providerShareSubscriptionId string) ProviderShareSubscriptionId { + return ProviderShareSubscriptionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + ShareName: shareName, + ProviderShareSubscriptionId: providerShareSubscriptionId, + } +} + +// ParseProviderShareSubscriptionID parses 'input' into a ProviderShareSubscriptionId +func ParseProviderShareSubscriptionID(input string) (*ProviderShareSubscriptionId, error) { + parser := resourceids.NewParserFromResourceIdType(ProviderShareSubscriptionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProviderShareSubscriptionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { + return nil, fmt.Errorf("the segment 'shareName' was not found in the resource id %q", input) + } + + if id.ProviderShareSubscriptionId, ok = parsed.Parsed["providerShareSubscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'providerShareSubscriptionId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseProviderShareSubscriptionIDInsensitively parses 'input' case-insensitively into a ProviderShareSubscriptionId +// note: this method should only be used for API response data and not user input +func ParseProviderShareSubscriptionIDInsensitively(input string) (*ProviderShareSubscriptionId, error) { + parser := resourceids.NewParserFromResourceIdType(ProviderShareSubscriptionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProviderShareSubscriptionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { + return nil, fmt.Errorf("the segment 'shareName' was not found in the resource id %q", input) + } + + if id.ProviderShareSubscriptionId, ok = parsed.Parsed["providerShareSubscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'providerShareSubscriptionId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateProviderShareSubscriptionID checks that 'input' can be parsed as a Provider Share Subscription ID +func ValidateProviderShareSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProviderShareSubscriptionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Provider Share Subscription ID +func (id ProviderShareSubscriptionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataShare/accounts/%s/shares/%s/providerShareSubscriptions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName, id.ProviderShareSubscriptionId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Provider Share Subscription ID +func (id ProviderShareSubscriptionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataShare", "Microsoft.DataShare", "Microsoft.DataShare"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticShares", "shares", "shares"), + resourceids.UserSpecifiedSegment("shareName", "shareValue"), + resourceids.StaticSegment("staticProviderShareSubscriptions", "providerShareSubscriptions", "providerShareSubscriptions"), + resourceids.UserSpecifiedSegment("providerShareSubscriptionId", "providerShareSubscriptionIdValue"), + } +} + +// String returns a human-readable description of this Provider Share Subscription ID +func (id ProviderShareSubscriptionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Share Name: %q", id.ShareName), + fmt.Sprintf("Provider Share Subscription: %q", id.ProviderShareSubscriptionId), + } + return fmt.Sprintf("Provider Share Subscription (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/id_share.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/id_share.go new file mode 100644 index 000000000000..940616506cf3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/id_share.go @@ -0,0 +1,137 @@ +package share + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ShareId{} + +// ShareId is a struct representing the Resource ID for a Share +type ShareId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + ShareName string +} + +// NewShareID returns a new ShareId struct +func NewShareID(subscriptionId string, resourceGroupName string, accountName string, shareName string) ShareId { + return ShareId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + ShareName: shareName, + } +} + +// ParseShareID parses 'input' into a ShareId +func ParseShareID(input string) (*ShareId, error) { + parser := resourceids.NewParserFromResourceIdType(ShareId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ShareId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { + return nil, fmt.Errorf("the segment 'shareName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseShareIDInsensitively parses 'input' case-insensitively into a ShareId +// note: this method should only be used for API response data and not user input +func ParseShareIDInsensitively(input string) (*ShareId, error) { + parser := resourceids.NewParserFromResourceIdType(ShareId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ShareId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { + return nil, fmt.Errorf("the segment 'shareName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateShareID checks that 'input' can be parsed as a Share ID +func ValidateShareID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseShareID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Share ID +func (id ShareId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataShare/accounts/%s/shares/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Share ID +func (id ShareId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataShare", "Microsoft.DataShare", "Microsoft.DataShare"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticShares", "shares", "shares"), + resourceids.UserSpecifiedSegment("shareName", "shareValue"), + } +} + +// String returns a human-readable description of this Share ID +func (id ShareId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Share Name: %q", id.ShareName), + } + return fmt.Sprintf("Share (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_create_autorest.go new file mode 100644 index 000000000000..0b8dda22e768 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_create_autorest.go @@ -0,0 +1,69 @@ +package share + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *Share +} + +// Create ... +func (c ShareClient) Create(ctx context.Context, id ShareId, input Share) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c ShareClient) preparerForCreate(ctx context.Context, id ShareId, input Share) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c ShareClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_delete_autorest.go new file mode 100644 index 000000000000..4f992a6de166 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_delete_autorest.go @@ -0,0 +1,78 @@ +package share + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ShareClient) Delete(ctx context.Context, id ShareId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ShareClient) DeleteThenPoll(ctx context.Context, id ShareId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ShareClient) preparerForDelete(ctx context.Context, id ShareId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ShareClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_get_autorest.go new file mode 100644 index 000000000000..760fc7ea753b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_get_autorest.go @@ -0,0 +1,68 @@ +package share + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Share +} + +// Get ... +func (c ShareClient) Get(ctx context.Context, id ShareId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ShareClient) preparerForGet(ctx context.Context, id ShareId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ShareClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_listbyaccount_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_listbyaccount_autorest.go new file mode 100644 index 000000000000..11a9d841f57e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_listbyaccount_autorest.go @@ -0,0 +1,220 @@ +package share + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByAccountOperationResponse struct { + HttpResponse *http.Response + Model *[]Share + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByAccountOperationResponse, error) +} + +type ListByAccountCompleteResult struct { + Items []Share +} + +func (r ListByAccountOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByAccountOperationResponse) LoadMore(ctx context.Context) (resp ListByAccountOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByAccountOperationOptions struct { + Filter *string + Orderby *string +} + +func DefaultListByAccountOperationOptions() ListByAccountOperationOptions { + return ListByAccountOperationOptions{} +} + +func (o ListByAccountOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByAccountOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Orderby != nil { + out["$orderby"] = *o.Orderby + } + + return out +} + +// ListByAccount ... +func (c ShareClient) ListByAccount(ctx context.Context, id AccountId, options ListByAccountOperationOptions) (resp ListByAccountOperationResponse, err error) { + req, err := c.preparerForListByAccount(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListByAccount", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListByAccount", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByAccount(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListByAccount", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByAccount prepares the ListByAccount request. +func (c ShareClient) preparerForListByAccount(ctx context.Context, id AccountId, options ListByAccountOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/shares", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByAccountWithNextLink prepares the ListByAccount request with the given nextLink token. +func (c ShareClient) preparerForListByAccountWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByAccount handles the response to the ListByAccount request. The method always +// closes the http.Response Body. +func (c ShareClient) responderForListByAccount(resp *http.Response) (result ListByAccountOperationResponse, err error) { + type page struct { + Values []Share `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByAccountOperationResponse, err error) { + req, err := c.preparerForListByAccountWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListByAccount", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListByAccount", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByAccount(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListByAccount", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByAccountComplete retrieves all of the results into a single object +func (c ShareClient) ListByAccountComplete(ctx context.Context, id AccountId, options ListByAccountOperationOptions) (ListByAccountCompleteResult, error) { + return c.ListByAccountCompleteMatchingPredicate(ctx, id, options, ShareOperationPredicate{}) +} + +// ListByAccountCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ShareClient) ListByAccountCompleteMatchingPredicate(ctx context.Context, id AccountId, options ListByAccountOperationOptions, predicate ShareOperationPredicate) (resp ListByAccountCompleteResult, err error) { + items := make([]Share, 0) + + page, err := c.ListByAccount(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByAccountCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_listsynchronizationdetails_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_listsynchronizationdetails_autorest.go new file mode 100644 index 000000000000..dd667d2edb26 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_listsynchronizationdetails_autorest.go @@ -0,0 +1,221 @@ +package share + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSynchronizationDetailsOperationResponse struct { + HttpResponse *http.Response + Model *[]SynchronizationDetails + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListSynchronizationDetailsOperationResponse, error) +} + +type ListSynchronizationDetailsCompleteResult struct { + Items []SynchronizationDetails +} + +func (r ListSynchronizationDetailsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListSynchronizationDetailsOperationResponse) LoadMore(ctx context.Context) (resp ListSynchronizationDetailsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListSynchronizationDetailsOperationOptions struct { + Filter *string + Orderby *string +} + +func DefaultListSynchronizationDetailsOperationOptions() ListSynchronizationDetailsOperationOptions { + return ListSynchronizationDetailsOperationOptions{} +} + +func (o ListSynchronizationDetailsOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListSynchronizationDetailsOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Orderby != nil { + out["$orderby"] = *o.Orderby + } + + return out +} + +// ListSynchronizationDetails ... +func (c ShareClient) ListSynchronizationDetails(ctx context.Context, id ShareId, input ShareSynchronization, options ListSynchronizationDetailsOperationOptions) (resp ListSynchronizationDetailsOperationResponse, err error) { + req, err := c.preparerForListSynchronizationDetails(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListSynchronizationDetails", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListSynchronizationDetails", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListSynchronizationDetails(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListSynchronizationDetails", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListSynchronizationDetails prepares the ListSynchronizationDetails request. +func (c ShareClient) preparerForListSynchronizationDetails(ctx context.Context, id ShareId, input ShareSynchronization, options ListSynchronizationDetailsOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/listSynchronizationDetails", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListSynchronizationDetailsWithNextLink prepares the ListSynchronizationDetails request with the given nextLink token. +func (c ShareClient) preparerForListSynchronizationDetailsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListSynchronizationDetails handles the response to the ListSynchronizationDetails request. The method always +// closes the http.Response Body. +func (c ShareClient) responderForListSynchronizationDetails(resp *http.Response) (result ListSynchronizationDetailsOperationResponse, err error) { + type page struct { + Values []SynchronizationDetails `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListSynchronizationDetailsOperationResponse, err error) { + req, err := c.preparerForListSynchronizationDetailsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListSynchronizationDetails", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListSynchronizationDetails", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListSynchronizationDetails(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListSynchronizationDetails", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListSynchronizationDetailsComplete retrieves all of the results into a single object +func (c ShareClient) ListSynchronizationDetailsComplete(ctx context.Context, id ShareId, input ShareSynchronization, options ListSynchronizationDetailsOperationOptions) (ListSynchronizationDetailsCompleteResult, error) { + return c.ListSynchronizationDetailsCompleteMatchingPredicate(ctx, id, input, options, SynchronizationDetailsOperationPredicate{}) +} + +// ListSynchronizationDetailsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ShareClient) ListSynchronizationDetailsCompleteMatchingPredicate(ctx context.Context, id ShareId, input ShareSynchronization, options ListSynchronizationDetailsOperationOptions, predicate SynchronizationDetailsOperationPredicate) (resp ListSynchronizationDetailsCompleteResult, err error) { + items := make([]SynchronizationDetails, 0) + + page, err := c.ListSynchronizationDetails(ctx, id, input, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListSynchronizationDetailsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_listsynchronizations_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_listsynchronizations_autorest.go new file mode 100644 index 000000000000..6d8af4765452 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_listsynchronizations_autorest.go @@ -0,0 +1,220 @@ +package share + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSynchronizationsOperationResponse struct { + HttpResponse *http.Response + Model *[]ShareSynchronization + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListSynchronizationsOperationResponse, error) +} + +type ListSynchronizationsCompleteResult struct { + Items []ShareSynchronization +} + +func (r ListSynchronizationsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListSynchronizationsOperationResponse) LoadMore(ctx context.Context) (resp ListSynchronizationsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListSynchronizationsOperationOptions struct { + Filter *string + Orderby *string +} + +func DefaultListSynchronizationsOperationOptions() ListSynchronizationsOperationOptions { + return ListSynchronizationsOperationOptions{} +} + +func (o ListSynchronizationsOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListSynchronizationsOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Orderby != nil { + out["$orderby"] = *o.Orderby + } + + return out +} + +// ListSynchronizations ... +func (c ShareClient) ListSynchronizations(ctx context.Context, id ShareId, options ListSynchronizationsOperationOptions) (resp ListSynchronizationsOperationResponse, err error) { + req, err := c.preparerForListSynchronizations(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListSynchronizations", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListSynchronizations", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListSynchronizations(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListSynchronizations", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListSynchronizations prepares the ListSynchronizations request. +func (c ShareClient) preparerForListSynchronizations(ctx context.Context, id ShareId, options ListSynchronizationsOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/listSynchronizations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListSynchronizationsWithNextLink prepares the ListSynchronizations request with the given nextLink token. +func (c ShareClient) preparerForListSynchronizationsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListSynchronizations handles the response to the ListSynchronizations request. The method always +// closes the http.Response Body. +func (c ShareClient) responderForListSynchronizations(resp *http.Response) (result ListSynchronizationsOperationResponse, err error) { + type page struct { + Values []ShareSynchronization `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListSynchronizationsOperationResponse, err error) { + req, err := c.preparerForListSynchronizationsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListSynchronizations", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListSynchronizations", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListSynchronizations(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ListSynchronizations", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListSynchronizationsComplete retrieves all of the results into a single object +func (c ShareClient) ListSynchronizationsComplete(ctx context.Context, id ShareId, options ListSynchronizationsOperationOptions) (ListSynchronizationsCompleteResult, error) { + return c.ListSynchronizationsCompleteMatchingPredicate(ctx, id, options, ShareSynchronizationOperationPredicate{}) +} + +// ListSynchronizationsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ShareClient) ListSynchronizationsCompleteMatchingPredicate(ctx context.Context, id ShareId, options ListSynchronizationsOperationOptions, predicate ShareSynchronizationOperationPredicate) (resp ListSynchronizationsCompleteResult, err error) { + items := make([]ShareSynchronization, 0) + + page, err := c.ListSynchronizations(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListSynchronizationsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_providersharesubscriptionsgetbyshare_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_providersharesubscriptionsgetbyshare_autorest.go new file mode 100644 index 000000000000..8b8499ebee6b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_providersharesubscriptionsgetbyshare_autorest.go @@ -0,0 +1,68 @@ +package share + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProviderShareSubscriptionsGetByShareOperationResponse struct { + HttpResponse *http.Response + Model *ProviderShareSubscription +} + +// ProviderShareSubscriptionsGetByShare ... +func (c ShareClient) ProviderShareSubscriptionsGetByShare(ctx context.Context, id ProviderShareSubscriptionId) (result ProviderShareSubscriptionsGetByShareOperationResponse, err error) { + req, err := c.preparerForProviderShareSubscriptionsGetByShare(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ProviderShareSubscriptionsGetByShare", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ProviderShareSubscriptionsGetByShare", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForProviderShareSubscriptionsGetByShare(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ProviderShareSubscriptionsGetByShare", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForProviderShareSubscriptionsGetByShare prepares the ProviderShareSubscriptionsGetByShare request. +func (c ShareClient) preparerForProviderShareSubscriptionsGetByShare(ctx context.Context, id ProviderShareSubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForProviderShareSubscriptionsGetByShare handles the response to the ProviderShareSubscriptionsGetByShare request. The method always +// closes the http.Response Body. +func (c ShareClient) responderForProviderShareSubscriptionsGetByShare(resp *http.Response) (result ProviderShareSubscriptionsGetByShareOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_providersharesubscriptionslistbyshare_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_providersharesubscriptionslistbyshare_autorest.go new file mode 100644 index 000000000000..870f7615c4d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_providersharesubscriptionslistbyshare_autorest.go @@ -0,0 +1,186 @@ +package share + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProviderShareSubscriptionsListByShareOperationResponse struct { + HttpResponse *http.Response + Model *[]ProviderShareSubscription + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ProviderShareSubscriptionsListByShareOperationResponse, error) +} + +type ProviderShareSubscriptionsListByShareCompleteResult struct { + Items []ProviderShareSubscription +} + +func (r ProviderShareSubscriptionsListByShareOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ProviderShareSubscriptionsListByShareOperationResponse) LoadMore(ctx context.Context) (resp ProviderShareSubscriptionsListByShareOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ProviderShareSubscriptionsListByShare ... +func (c ShareClient) ProviderShareSubscriptionsListByShare(ctx context.Context, id ShareId) (resp ProviderShareSubscriptionsListByShareOperationResponse, err error) { + req, err := c.preparerForProviderShareSubscriptionsListByShare(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ProviderShareSubscriptionsListByShare", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ProviderShareSubscriptionsListByShare", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForProviderShareSubscriptionsListByShare(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ProviderShareSubscriptionsListByShare", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForProviderShareSubscriptionsListByShare prepares the ProviderShareSubscriptionsListByShare request. +func (c ShareClient) preparerForProviderShareSubscriptionsListByShare(ctx context.Context, id ShareId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providerShareSubscriptions", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForProviderShareSubscriptionsListByShareWithNextLink prepares the ProviderShareSubscriptionsListByShare request with the given nextLink token. +func (c ShareClient) preparerForProviderShareSubscriptionsListByShareWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForProviderShareSubscriptionsListByShare handles the response to the ProviderShareSubscriptionsListByShare request. The method always +// closes the http.Response Body. +func (c ShareClient) responderForProviderShareSubscriptionsListByShare(resp *http.Response) (result ProviderShareSubscriptionsListByShareOperationResponse, err error) { + type page struct { + Values []ProviderShareSubscription `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ProviderShareSubscriptionsListByShareOperationResponse, err error) { + req, err := c.preparerForProviderShareSubscriptionsListByShareWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ProviderShareSubscriptionsListByShare", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ProviderShareSubscriptionsListByShare", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForProviderShareSubscriptionsListByShare(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ProviderShareSubscriptionsListByShare", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ProviderShareSubscriptionsListByShareComplete retrieves all of the results into a single object +func (c ShareClient) ProviderShareSubscriptionsListByShareComplete(ctx context.Context, id ShareId) (ProviderShareSubscriptionsListByShareCompleteResult, error) { + return c.ProviderShareSubscriptionsListByShareCompleteMatchingPredicate(ctx, id, ProviderShareSubscriptionOperationPredicate{}) +} + +// ProviderShareSubscriptionsListByShareCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ShareClient) ProviderShareSubscriptionsListByShareCompleteMatchingPredicate(ctx context.Context, id ShareId, predicate ProviderShareSubscriptionOperationPredicate) (resp ProviderShareSubscriptionsListByShareCompleteResult, err error) { + items := make([]ProviderShareSubscription, 0) + + page, err := c.ProviderShareSubscriptionsListByShare(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ProviderShareSubscriptionsListByShareCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_providersharesubscriptionsreinstate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_providersharesubscriptionsreinstate_autorest.go new file mode 100644 index 000000000000..1084a7d3fbce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_providersharesubscriptionsreinstate_autorest.go @@ -0,0 +1,69 @@ +package share + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProviderShareSubscriptionsReinstateOperationResponse struct { + HttpResponse *http.Response + Model *ProviderShareSubscription +} + +// ProviderShareSubscriptionsReinstate ... +func (c ShareClient) ProviderShareSubscriptionsReinstate(ctx context.Context, id ProviderShareSubscriptionId) (result ProviderShareSubscriptionsReinstateOperationResponse, err error) { + req, err := c.preparerForProviderShareSubscriptionsReinstate(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ProviderShareSubscriptionsReinstate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ProviderShareSubscriptionsReinstate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForProviderShareSubscriptionsReinstate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ProviderShareSubscriptionsReinstate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForProviderShareSubscriptionsReinstate prepares the ProviderShareSubscriptionsReinstate request. +func (c ShareClient) preparerForProviderShareSubscriptionsReinstate(ctx context.Context, id ProviderShareSubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/reinstate", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForProviderShareSubscriptionsReinstate handles the response to the ProviderShareSubscriptionsReinstate request. The method always +// closes the http.Response Body. +func (c ShareClient) responderForProviderShareSubscriptionsReinstate(resp *http.Response) (result ProviderShareSubscriptionsReinstateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_providersharesubscriptionsrevoke_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_providersharesubscriptionsrevoke_autorest.go new file mode 100644 index 000000000000..4e4e5ea0b283 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/method_providersharesubscriptionsrevoke_autorest.go @@ -0,0 +1,78 @@ +package share + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProviderShareSubscriptionsRevokeOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ProviderShareSubscriptionsRevoke ... +func (c ShareClient) ProviderShareSubscriptionsRevoke(ctx context.Context, id ProviderShareSubscriptionId) (result ProviderShareSubscriptionsRevokeOperationResponse, err error) { + req, err := c.preparerForProviderShareSubscriptionsRevoke(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ProviderShareSubscriptionsRevoke", nil, "Failure preparing request") + return + } + + result, err = c.senderForProviderShareSubscriptionsRevoke(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "share.ShareClient", "ProviderShareSubscriptionsRevoke", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ProviderShareSubscriptionsRevokeThenPoll performs ProviderShareSubscriptionsRevoke then polls until it's completed +func (c ShareClient) ProviderShareSubscriptionsRevokeThenPoll(ctx context.Context, id ProviderShareSubscriptionId) error { + result, err := c.ProviderShareSubscriptionsRevoke(ctx, id) + if err != nil { + return fmt.Errorf("performing ProviderShareSubscriptionsRevoke: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ProviderShareSubscriptionsRevoke: %+v", err) + } + + return nil +} + +// preparerForProviderShareSubscriptionsRevoke prepares the ProviderShareSubscriptionsRevoke request. +func (c ShareClient) preparerForProviderShareSubscriptionsRevoke(ctx context.Context, id ProviderShareSubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/revoke", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForProviderShareSubscriptionsRevoke sends the ProviderShareSubscriptionsRevoke request. The method will close the +// http.Response Body if it receives an error. +func (c ShareClient) senderForProviderShareSubscriptionsRevoke(ctx context.Context, req *http.Request) (future ProviderShareSubscriptionsRevokeOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_datashareerrorinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_datashareerrorinfo.go new file mode 100644 index 000000000000..04713a068b75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_datashareerrorinfo.go @@ -0,0 +1,11 @@ +package share + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataShareErrorInfo struct { + Code string `json:"code"` + Details *[]DataShareErrorInfo `json:"details,omitempty"` + Message string `json:"message"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_operationresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_operationresponse.go new file mode 100644 index 000000000000..0899575769a8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_operationresponse.go @@ -0,0 +1,41 @@ +package share + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OperationResponse struct { + EndTime *string `json:"endTime,omitempty"` + Error *DataShareErrorInfo `json:"error,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status Status `json:"status"` +} + +func (o *OperationResponse) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationResponse) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *OperationResponse) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationResponse) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_providersharesubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_providersharesubscription.go new file mode 100644 index 000000000000..8722c68eb354 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_providersharesubscription.go @@ -0,0 +1,11 @@ +package share + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProviderShareSubscription struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ProviderShareSubscriptionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_providersharesubscriptionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_providersharesubscriptionproperties.go new file mode 100644 index 000000000000..a5fc5ef50275 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_providersharesubscriptionproperties.go @@ -0,0 +1,46 @@ +package share + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProviderShareSubscriptionProperties struct { + ConsumerEmail *string `json:"consumerEmail,omitempty"` + ConsumerName *string `json:"consumerName,omitempty"` + ConsumerTenantName *string `json:"consumerTenantName,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + ProviderEmail *string `json:"providerEmail,omitempty"` + ProviderName *string `json:"providerName,omitempty"` + ShareSubscriptionObjectId *string `json:"shareSubscriptionObjectId,omitempty"` + ShareSubscriptionStatus *ShareSubscriptionStatus `json:"shareSubscriptionStatus,omitempty"` + SharedAt *string `json:"sharedAt,omitempty"` +} + +func (o *ProviderShareSubscriptionProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *ProviderShareSubscriptionProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *ProviderShareSubscriptionProperties) GetSharedAtAsTime() (*time.Time, error) { + if o.SharedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.SharedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *ProviderShareSubscriptionProperties) SetSharedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.SharedAt = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_share.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_share.go new file mode 100644 index 000000000000..4586b5d649cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_share.go @@ -0,0 +1,11 @@ +package share + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Share struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ShareProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_shareproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_shareproperties.go new file mode 100644 index 000000000000..4acfaffc2164 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_shareproperties.go @@ -0,0 +1,32 @@ +package share + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ShareProperties struct { + CreatedAt *string `json:"createdAt,omitempty"` + Description *string `json:"description,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + ShareKind *ShareKind `json:"shareKind,omitempty"` + Terms *string `json:"terms,omitempty"` + UserEmail *string `json:"userEmail,omitempty"` + UserName *string `json:"userName,omitempty"` +} + +func (o *ShareProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *ShareProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_sharesynchronization.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_sharesynchronization.go new file mode 100644 index 000000000000..bfe78af86a14 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_sharesynchronization.go @@ -0,0 +1,47 @@ +package share + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ShareSynchronization struct { + ConsumerEmail *string `json:"consumerEmail,omitempty"` + ConsumerName *string `json:"consumerName,omitempty"` + ConsumerTenantName *string `json:"consumerTenantName,omitempty"` + DurationMs *int64 `json:"durationMs,omitempty"` + EndTime *string `json:"endTime,omitempty"` + Message *string `json:"message,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *string `json:"status,omitempty"` + SynchronizationId *string `json:"synchronizationId,omitempty"` + SynchronizationMode *SynchronizationMode `json:"synchronizationMode,omitempty"` +} + +func (o *ShareSynchronization) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ShareSynchronization) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *ShareSynchronization) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ShareSynchronization) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_synchronizationdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_synchronizationdetails.go new file mode 100644 index 000000000000..e1d680257fbb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/model_synchronizationdetails.go @@ -0,0 +1,52 @@ +package share + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SynchronizationDetails struct { + DataSetId *string `json:"dataSetId,omitempty"` + DataSetType *DataSetType `json:"dataSetType,omitempty"` + DurationMs *int64 `json:"durationMs,omitempty"` + EndTime *string `json:"endTime,omitempty"` + FilesRead *int64 `json:"filesRead,omitempty"` + FilesWritten *int64 `json:"filesWritten,omitempty"` + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + RowsCopied *int64 `json:"rowsCopied,omitempty"` + RowsRead *int64 `json:"rowsRead,omitempty"` + SizeRead *int64 `json:"sizeRead,omitempty"` + SizeWritten *int64 `json:"sizeWritten,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *string `json:"status,omitempty"` + VCore *int64 `json:"vCore,omitempty"` +} + +func (o *SynchronizationDetails) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *SynchronizationDetails) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *SynchronizationDetails) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *SynchronizationDetails) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/predicates.go new file mode 100644 index 000000000000..c86820571373 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/predicates.go @@ -0,0 +1,178 @@ +package share + +type ProviderShareSubscriptionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ProviderShareSubscriptionOperationPredicate) Matches(input ProviderShareSubscription) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type ShareOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ShareOperationPredicate) Matches(input Share) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type ShareSynchronizationOperationPredicate struct { + ConsumerEmail *string + ConsumerName *string + ConsumerTenantName *string + DurationMs *int64 + EndTime *string + Message *string + StartTime *string + Status *string + SynchronizationId *string +} + +func (p ShareSynchronizationOperationPredicate) Matches(input ShareSynchronization) bool { + + if p.ConsumerEmail != nil && (input.ConsumerEmail == nil && *p.ConsumerEmail != *input.ConsumerEmail) { + return false + } + + if p.ConsumerName != nil && (input.ConsumerName == nil && *p.ConsumerName != *input.ConsumerName) { + return false + } + + if p.ConsumerTenantName != nil && (input.ConsumerTenantName == nil && *p.ConsumerTenantName != *input.ConsumerTenantName) { + return false + } + + if p.DurationMs != nil && (input.DurationMs == nil && *p.DurationMs != *input.DurationMs) { + return false + } + + if p.EndTime != nil && (input.EndTime == nil && *p.EndTime != *input.EndTime) { + return false + } + + if p.Message != nil && (input.Message == nil && *p.Message != *input.Message) { + return false + } + + if p.StartTime != nil && (input.StartTime == nil && *p.StartTime != *input.StartTime) { + return false + } + + if p.Status != nil && (input.Status == nil && *p.Status != *input.Status) { + return false + } + + if p.SynchronizationId != nil && (input.SynchronizationId == nil && *p.SynchronizationId != *input.SynchronizationId) { + return false + } + + return true +} + +type SynchronizationDetailsOperationPredicate struct { + DataSetId *string + DurationMs *int64 + EndTime *string + FilesRead *int64 + FilesWritten *int64 + Message *string + Name *string + RowsCopied *int64 + RowsRead *int64 + SizeRead *int64 + SizeWritten *int64 + StartTime *string + Status *string + VCore *int64 +} + +func (p SynchronizationDetailsOperationPredicate) Matches(input SynchronizationDetails) bool { + + if p.DataSetId != nil && (input.DataSetId == nil && *p.DataSetId != *input.DataSetId) { + return false + } + + if p.DurationMs != nil && (input.DurationMs == nil && *p.DurationMs != *input.DurationMs) { + return false + } + + if p.EndTime != nil && (input.EndTime == nil && *p.EndTime != *input.EndTime) { + return false + } + + if p.FilesRead != nil && (input.FilesRead == nil && *p.FilesRead != *input.FilesRead) { + return false + } + + if p.FilesWritten != nil && (input.FilesWritten == nil && *p.FilesWritten != *input.FilesWritten) { + return false + } + + if p.Message != nil && (input.Message == nil && *p.Message != *input.Message) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.RowsCopied != nil && (input.RowsCopied == nil && *p.RowsCopied != *input.RowsCopied) { + return false + } + + if p.RowsRead != nil && (input.RowsRead == nil && *p.RowsRead != *input.RowsRead) { + return false + } + + if p.SizeRead != nil && (input.SizeRead == nil && *p.SizeRead != *input.SizeRead) { + return false + } + + if p.SizeWritten != nil && (input.SizeWritten == nil && *p.SizeWritten != *input.SizeWritten) { + return false + } + + if p.StartTime != nil && (input.StartTime == nil && *p.StartTime != *input.StartTime) { + return false + } + + if p.Status != nil && (input.Status == nil && *p.Status != *input.Status) { + return false + } + + if p.VCore != nil && (input.VCore == nil && *p.VCore != *input.VCore) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/version.go new file mode 100644 index 000000000000..240f56a7a4db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share/version.go @@ -0,0 +1,12 @@ +package share + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/share/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/README.md new file mode 100644 index 000000000000..effbba5d10dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/README.md @@ -0,0 +1,86 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting` Documentation + +The `synchronizationsetting` SDK allows for interaction with the Azure Resource Manager Service `datashare` (API Version `2019-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting" +``` + + +### Client Initialization + +```go +client := synchronizationsetting.NewSynchronizationSettingClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SynchronizationSettingClient.Create` + +```go +ctx := context.TODO() +id := synchronizationsetting.NewSynchronizationSettingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue", "synchronizationSettingValue") + +payload := synchronizationsetting.SynchronizationSetting{ + // ... +} + + +read, err := client.Create(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SynchronizationSettingClient.Delete` + +```go +ctx := context.TODO() +id := synchronizationsetting.NewSynchronizationSettingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue", "synchronizationSettingValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SynchronizationSettingClient.Get` + +```go +ctx := context.TODO() +id := synchronizationsetting.NewSynchronizationSettingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue", "synchronizationSettingValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SynchronizationSettingClient.ListByShare` + +```go +ctx := context.TODO() +id := synchronizationsetting.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue") + +// alternatively `client.ListByShare(ctx, id)` can be used to do batched pagination +items, err := client.ListByShareComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/client.go new file mode 100644 index 000000000000..19a0c33b0639 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/client.go @@ -0,0 +1,18 @@ +package synchronizationsetting + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SynchronizationSettingClient struct { + Client autorest.Client + baseUri string +} + +func NewSynchronizationSettingClientWithBaseURI(endpoint string) SynchronizationSettingClient { + return SynchronizationSettingClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/constants.go new file mode 100644 index 000000000000..7d7e55fc7159 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/constants.go @@ -0,0 +1,136 @@ +package synchronizationsetting + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type RecurrenceInterval string + +const ( + RecurrenceIntervalDay RecurrenceInterval = "Day" + RecurrenceIntervalHour RecurrenceInterval = "Hour" +) + +func PossibleValuesForRecurrenceInterval() []string { + return []string{ + string(RecurrenceIntervalDay), + string(RecurrenceIntervalHour), + } +} + +func parseRecurrenceInterval(input string) (*RecurrenceInterval, error) { + vals := map[string]RecurrenceInterval{ + "day": RecurrenceIntervalDay, + "hour": RecurrenceIntervalHour, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RecurrenceInterval(input) + return &out, nil +} + +type Status string + +const ( + StatusAccepted Status = "Accepted" + StatusCanceled Status = "Canceled" + StatusFailed Status = "Failed" + StatusInProgress Status = "InProgress" + StatusSucceeded Status = "Succeeded" + StatusTransientFailure Status = "TransientFailure" +) + +func PossibleValuesForStatus() []string { + return []string{ + string(StatusAccepted), + string(StatusCanceled), + string(StatusFailed), + string(StatusInProgress), + string(StatusSucceeded), + string(StatusTransientFailure), + } +} + +func parseStatus(input string) (*Status, error) { + vals := map[string]Status{ + "accepted": StatusAccepted, + "canceled": StatusCanceled, + "failed": StatusFailed, + "inprogress": StatusInProgress, + "succeeded": StatusSucceeded, + "transientfailure": StatusTransientFailure, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} + +type SynchronizationSettingKind string + +const ( + SynchronizationSettingKindScheduleBased SynchronizationSettingKind = "ScheduleBased" +) + +func PossibleValuesForSynchronizationSettingKind() []string { + return []string{ + string(SynchronizationSettingKindScheduleBased), + } +} + +func parseSynchronizationSettingKind(input string) (*SynchronizationSettingKind, error) { + vals := map[string]SynchronizationSettingKind{ + "schedulebased": SynchronizationSettingKindScheduleBased, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SynchronizationSettingKind(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/id_share.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/id_share.go new file mode 100644 index 000000000000..8907a618e4ac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/id_share.go @@ -0,0 +1,137 @@ +package synchronizationsetting + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ShareId{} + +// ShareId is a struct representing the Resource ID for a Share +type ShareId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + ShareName string +} + +// NewShareID returns a new ShareId struct +func NewShareID(subscriptionId string, resourceGroupName string, accountName string, shareName string) ShareId { + return ShareId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + ShareName: shareName, + } +} + +// ParseShareID parses 'input' into a ShareId +func ParseShareID(input string) (*ShareId, error) { + parser := resourceids.NewParserFromResourceIdType(ShareId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ShareId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { + return nil, fmt.Errorf("the segment 'shareName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseShareIDInsensitively parses 'input' case-insensitively into a ShareId +// note: this method should only be used for API response data and not user input +func ParseShareIDInsensitively(input string) (*ShareId, error) { + parser := resourceids.NewParserFromResourceIdType(ShareId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ShareId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { + return nil, fmt.Errorf("the segment 'shareName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateShareID checks that 'input' can be parsed as a Share ID +func ValidateShareID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseShareID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Share ID +func (id ShareId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataShare/accounts/%s/shares/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Share ID +func (id ShareId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataShare", "Microsoft.DataShare", "Microsoft.DataShare"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticShares", "shares", "shares"), + resourceids.UserSpecifiedSegment("shareName", "shareValue"), + } +} + +// String returns a human-readable description of this Share ID +func (id ShareId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Share Name: %q", id.ShareName), + } + return fmt.Sprintf("Share (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/id_synchronizationsetting.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/id_synchronizationsetting.go new file mode 100644 index 000000000000..db6ac6c926bc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/id_synchronizationsetting.go @@ -0,0 +1,150 @@ +package synchronizationsetting + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SynchronizationSettingId{} + +// SynchronizationSettingId is a struct representing the Resource ID for a Synchronization Setting +type SynchronizationSettingId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + ShareName string + SynchronizationSettingName string +} + +// NewSynchronizationSettingID returns a new SynchronizationSettingId struct +func NewSynchronizationSettingID(subscriptionId string, resourceGroupName string, accountName string, shareName string, synchronizationSettingName string) SynchronizationSettingId { + return SynchronizationSettingId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + ShareName: shareName, + SynchronizationSettingName: synchronizationSettingName, + } +} + +// ParseSynchronizationSettingID parses 'input' into a SynchronizationSettingId +func ParseSynchronizationSettingID(input string) (*SynchronizationSettingId, error) { + parser := resourceids.NewParserFromResourceIdType(SynchronizationSettingId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SynchronizationSettingId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { + return nil, fmt.Errorf("the segment 'shareName' was not found in the resource id %q", input) + } + + if id.SynchronizationSettingName, ok = parsed.Parsed["synchronizationSettingName"]; !ok { + return nil, fmt.Errorf("the segment 'synchronizationSettingName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSynchronizationSettingIDInsensitively parses 'input' case-insensitively into a SynchronizationSettingId +// note: this method should only be used for API response data and not user input +func ParseSynchronizationSettingIDInsensitively(input string) (*SynchronizationSettingId, error) { + parser := resourceids.NewParserFromResourceIdType(SynchronizationSettingId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SynchronizationSettingId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { + return nil, fmt.Errorf("the segment 'shareName' was not found in the resource id %q", input) + } + + if id.SynchronizationSettingName, ok = parsed.Parsed["synchronizationSettingName"]; !ok { + return nil, fmt.Errorf("the segment 'synchronizationSettingName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSynchronizationSettingID checks that 'input' can be parsed as a Synchronization Setting ID +func ValidateSynchronizationSettingID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSynchronizationSettingID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Synchronization Setting ID +func (id SynchronizationSettingId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataShare/accounts/%s/shares/%s/synchronizationSettings/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName, id.SynchronizationSettingName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Synchronization Setting ID +func (id SynchronizationSettingId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataShare", "Microsoft.DataShare", "Microsoft.DataShare"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticShares", "shares", "shares"), + resourceids.UserSpecifiedSegment("shareName", "shareValue"), + resourceids.StaticSegment("staticSynchronizationSettings", "synchronizationSettings", "synchronizationSettings"), + resourceids.UserSpecifiedSegment("synchronizationSettingName", "synchronizationSettingValue"), + } +} + +// String returns a human-readable description of this Synchronization Setting ID +func (id SynchronizationSettingId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Share Name: %q", id.ShareName), + fmt.Sprintf("Synchronization Setting Name: %q", id.SynchronizationSettingName), + } + return fmt.Sprintf("Synchronization Setting (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/method_create_autorest.go new file mode 100644 index 000000000000..fa7c55ea2429 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/method_create_autorest.go @@ -0,0 +1,75 @@ +package synchronizationsetting + +import ( + "context" + "encoding/json" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *SynchronizationSetting +} + +// Create ... +func (c SynchronizationSettingClient) Create(ctx context.Context, id SynchronizationSettingId, input SynchronizationSetting) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "synchronizationsetting.SynchronizationSettingClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "synchronizationsetting.SynchronizationSettingClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "synchronizationsetting.SynchronizationSettingClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c SynchronizationSettingClient) preparerForCreate(ctx context.Context, id SynchronizationSettingId, input SynchronizationSetting) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c SynchronizationSettingClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + var respObj json.RawMessage + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + model, err := unmarshalSynchronizationSettingImplementation(respObj) + if err != nil { + return + } + result.Model = &model + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/method_delete_autorest.go new file mode 100644 index 000000000000..46cc97064a18 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/method_delete_autorest.go @@ -0,0 +1,78 @@ +package synchronizationsetting + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c SynchronizationSettingClient) Delete(ctx context.Context, id SynchronizationSettingId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "synchronizationsetting.SynchronizationSettingClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "synchronizationsetting.SynchronizationSettingClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c SynchronizationSettingClient) DeleteThenPoll(ctx context.Context, id SynchronizationSettingId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c SynchronizationSettingClient) preparerForDelete(ctx context.Context, id SynchronizationSettingId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c SynchronizationSettingClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/method_get_autorest.go new file mode 100644 index 000000000000..0b40228b4dd1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/method_get_autorest.go @@ -0,0 +1,74 @@ +package synchronizationsetting + +import ( + "context" + "encoding/json" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *SynchronizationSetting +} + +// Get ... +func (c SynchronizationSettingClient) Get(ctx context.Context, id SynchronizationSettingId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "synchronizationsetting.SynchronizationSettingClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "synchronizationsetting.SynchronizationSettingClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "synchronizationsetting.SynchronizationSettingClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c SynchronizationSettingClient) preparerForGet(ctx context.Context, id SynchronizationSettingId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c SynchronizationSettingClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + var respObj json.RawMessage + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + model, err := unmarshalSynchronizationSettingImplementation(respObj) + if err != nil { + return + } + result.Model = &model + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/method_listbyshare_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/method_listbyshare_autorest.go new file mode 100644 index 000000000000..f4ebf4c9e374 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/method_listbyshare_autorest.go @@ -0,0 +1,196 @@ +package synchronizationsetting + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByShareOperationResponse struct { + HttpResponse *http.Response + Model *[]SynchronizationSetting + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByShareOperationResponse, error) +} + +type ListByShareCompleteResult struct { + Items []SynchronizationSetting +} + +func (r ListByShareOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByShareOperationResponse) LoadMore(ctx context.Context) (resp ListByShareOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByShare ... +func (c SynchronizationSettingClient) ListByShare(ctx context.Context, id ShareId) (resp ListByShareOperationResponse, err error) { + req, err := c.preparerForListByShare(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "synchronizationsetting.SynchronizationSettingClient", "ListByShare", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "synchronizationsetting.SynchronizationSettingClient", "ListByShare", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByShare(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "synchronizationsetting.SynchronizationSettingClient", "ListByShare", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByShare prepares the ListByShare request. +func (c SynchronizationSettingClient) preparerForListByShare(ctx context.Context, id ShareId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/synchronizationSettings", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByShareWithNextLink prepares the ListByShare request with the given nextLink token. +func (c SynchronizationSettingClient) preparerForListByShareWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByShare handles the response to the ListByShare request. The method always +// closes the http.Response Body. +func (c SynchronizationSettingClient) responderForListByShare(resp *http.Response) (result ListByShareOperationResponse, err error) { + type page struct { + Values []json.RawMessage `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + temp := make([]SynchronizationSetting, 0) + for i, v := range respObj.Values { + val, err := unmarshalSynchronizationSettingImplementation(v) + if err != nil { + err = fmt.Errorf("unmarshalling item %d for SynchronizationSetting (%q): %+v", i, v, err) + return result, err + } + temp = append(temp, val) + } + result.Model = &temp + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByShareOperationResponse, err error) { + req, err := c.preparerForListByShareWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "synchronizationsetting.SynchronizationSettingClient", "ListByShare", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "synchronizationsetting.SynchronizationSettingClient", "ListByShare", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByShare(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "synchronizationsetting.SynchronizationSettingClient", "ListByShare", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByShareComplete retrieves all of the results into a single object +func (c SynchronizationSettingClient) ListByShareComplete(ctx context.Context, id ShareId) (ListByShareCompleteResult, error) { + return c.ListByShareCompleteMatchingPredicate(ctx, id, SynchronizationSettingOperationPredicate{}) +} + +// ListByShareCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SynchronizationSettingClient) ListByShareCompleteMatchingPredicate(ctx context.Context, id ShareId, predicate SynchronizationSettingOperationPredicate) (resp ListByShareCompleteResult, err error) { + items := make([]SynchronizationSetting, 0) + + page, err := c.ListByShare(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByShareCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/model_datashareerrorinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/model_datashareerrorinfo.go new file mode 100644 index 000000000000..ec3a27eb1e3b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/model_datashareerrorinfo.go @@ -0,0 +1,11 @@ +package synchronizationsetting + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataShareErrorInfo struct { + Code string `json:"code"` + Details *[]DataShareErrorInfo `json:"details,omitempty"` + Message string `json:"message"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/model_operationresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/model_operationresponse.go new file mode 100644 index 000000000000..150d8419c02d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/model_operationresponse.go @@ -0,0 +1,41 @@ +package synchronizationsetting + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OperationResponse struct { + EndTime *string `json:"endTime,omitempty"` + Error *DataShareErrorInfo `json:"error,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status Status `json:"status"` +} + +func (o *OperationResponse) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationResponse) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *OperationResponse) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationResponse) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/model_scheduledsynchronizationsetting.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/model_scheduledsynchronizationsetting.go new file mode 100644 index 000000000000..6a0a42d4229f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/model_scheduledsynchronizationsetting.go @@ -0,0 +1,44 @@ +package synchronizationsetting + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SynchronizationSetting = ScheduledSynchronizationSetting{} + +type ScheduledSynchronizationSetting struct { + Properties ScheduledSynchronizationSettingProperties `json:"properties"` + + // Fields inherited from SynchronizationSetting + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = ScheduledSynchronizationSetting{} + +func (s ScheduledSynchronizationSetting) MarshalJSON() ([]byte, error) { + type wrapper ScheduledSynchronizationSetting + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ScheduledSynchronizationSetting: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ScheduledSynchronizationSetting: %+v", err) + } + decoded["kind"] = "ScheduleBased" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ScheduledSynchronizationSetting: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/model_scheduledsynchronizationsettingproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/model_scheduledsynchronizationsettingproperties.go new file mode 100644 index 000000000000..88e75e455f55 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/model_scheduledsynchronizationsettingproperties.go @@ -0,0 +1,39 @@ +package synchronizationsetting + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledSynchronizationSettingProperties struct { + CreatedAt *string `json:"createdAt,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RecurrenceInterval RecurrenceInterval `json:"recurrenceInterval"` + SynchronizationTime string `json:"synchronizationTime"` + UserName *string `json:"userName,omitempty"` +} + +func (o *ScheduledSynchronizationSettingProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *ScheduledSynchronizationSettingProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *ScheduledSynchronizationSettingProperties) GetSynchronizationTimeAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.SynchronizationTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ScheduledSynchronizationSettingProperties) SetSynchronizationTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.SynchronizationTime = formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/model_synchronizationsetting.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/model_synchronizationsetting.go new file mode 100644 index 000000000000..417968e49810 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/model_synchronizationsetting.go @@ -0,0 +1,48 @@ +package synchronizationsetting + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SynchronizationSetting interface { +} + +func unmarshalSynchronizationSettingImplementation(input []byte) (SynchronizationSetting, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling SynchronizationSetting into map[string]interface: %+v", err) + } + + value, ok := temp["kind"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "ScheduleBased") { + var out ScheduledSynchronizationSetting + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ScheduledSynchronizationSetting: %+v", err) + } + return out, nil + } + + type RawSynchronizationSettingImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawSynchronizationSettingImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/predicates.go new file mode 100644 index 000000000000..ce7925d526a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/predicates.go @@ -0,0 +1,9 @@ +package synchronizationsetting + +type SynchronizationSettingOperationPredicate struct { +} + +func (p SynchronizationSettingOperationPredicate) Matches(input SynchronizationSetting) bool { + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/version.go new file mode 100644 index 000000000000..194b89c91413 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting/version.go @@ -0,0 +1,12 @@ +package synchronizationsetting + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/synchronizationsetting/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/README.md index 5b1fe82e50bc..ea2e0335ca0f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/README.md @@ -62,7 +62,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := iotdpsresource.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue") +id := iotdpsresource.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "provisioningServiceValue", "privateEndpointConnectionValue") payload := iotdpsresource.PrivateEndpointConnection{ // ... @@ -91,7 +91,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := iotdpsresource.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue") +id := iotdpsresource.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "provisioningServiceValue", "privateEndpointConnectionValue") if err := client.DeletePrivateEndpointConnectionThenPoll(ctx, id); err != nil { // handle the error @@ -119,7 +119,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := iotdpsresource.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue") +id := iotdpsresource.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "provisioningServiceValue", "privateEndpointConnectionValue") read, err := client.GetPrivateEndpointConnection(ctx, id) if err != nil { @@ -135,7 +135,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := iotdpsresource.NewPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "groupIdValue") +id := iotdpsresource.NewPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "provisioningServiceValue", "groupIdValue") read, err := client.GetPrivateLinkResources(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privateendpointconnection.go index 0b65b970feb8..b8a79dfab2e4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privateendpointconnection.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privateendpointconnection.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = PrivateEndpointConnectionId{} type PrivateEndpointConnectionId struct { SubscriptionId string ResourceGroupName string - ResourceName string + ProvisioningServiceName string PrivateEndpointConnectionName string } // NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct -func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, resourceName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, provisioningServiceName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { return PrivateEndpointConnectionId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + ProvisioningServiceName: provisioningServiceName, PrivateEndpointConnectionName: privateEndpointConnectionName, } } @@ -46,8 +46,8 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'provisioningServiceName' was not found in the resource id %q", input) } if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { @@ -77,8 +77,8 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'provisioningServiceName' was not found in the resource id %q", input) } if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { @@ -106,7 +106,7 @@ func ValidatePrivateEndpointConnectionID(input interface{}, key string) (warning // ID returns the formatted Private Endpoint Connection ID func (id PrivateEndpointConnectionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Devices/provisioningServices/%s/privateEndpointConnections/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.PrivateEndpointConnectionName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProvisioningServiceName, id.PrivateEndpointConnectionName) } // Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID @@ -119,7 +119,7 @@ func (id PrivateEndpointConnectionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDevices", "Microsoft.Devices", "Microsoft.Devices"), resourceids.StaticSegment("staticProvisioningServices", "provisioningServices", "provisioningServices"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("provisioningServiceName", "provisioningServiceValue"), resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionValue"), } @@ -130,7 +130,7 @@ func (id PrivateEndpointConnectionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Provisioning Service Name: %q", id.ProvisioningServiceName), fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), } return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privatelinkresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privatelinkresource.go index 048609f2e488..350b8bae9210 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privatelinkresource.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privatelinkresource.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = PrivateLinkResourceId{} // PrivateLinkResourceId is a struct representing the Resource ID for a Private Link Resource type PrivateLinkResourceId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - GroupId string + SubscriptionId string + ResourceGroupName string + ProvisioningServiceName string + GroupId string } // NewPrivateLinkResourceID returns a new PrivateLinkResourceId struct -func NewPrivateLinkResourceID(subscriptionId string, resourceGroupName string, resourceName string, groupId string) PrivateLinkResourceId { +func NewPrivateLinkResourceID(subscriptionId string, resourceGroupName string, provisioningServiceName string, groupId string) PrivateLinkResourceId { return PrivateLinkResourceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - GroupId: groupId, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProvisioningServiceName: provisioningServiceName, + GroupId: groupId, } } @@ -46,8 +46,8 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'provisioningServiceName' was not found in the resource id %q", input) } if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { @@ -77,8 +77,8 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'provisioningServiceName' was not found in the resource id %q", input) } if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { @@ -106,7 +106,7 @@ func ValidatePrivateLinkResourceID(input interface{}, key string) (warnings []st // ID returns the formatted Private Link Resource ID func (id PrivateLinkResourceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Devices/provisioningServices/%s/privateLinkResources/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.GroupId) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProvisioningServiceName, id.GroupId) } // Segments returns a slice of Resource ID Segments which comprise this Private Link Resource ID @@ -119,7 +119,7 @@ func (id PrivateLinkResourceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDevices", "Microsoft.Devices", "Microsoft.Devices"), resourceids.StaticSegment("staticProvisioningServices", "provisioningServices", "provisioningServices"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("provisioningServiceName", "provisioningServiceValue"), resourceids.StaticSegment("staticPrivateLinkResources", "privateLinkResources", "privateLinkResources"), resourceids.UserSpecifiedSegment("groupId", "groupIdValue"), } @@ -130,7 +130,7 @@ func (id PrivateLinkResourceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Provisioning Service Name: %q", id.ProvisioningServiceName), fmt.Sprintf("Group: %q", id.GroupId), } return fmt.Sprintf("Private Link Resource (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/README.md new file mode 100644 index 000000000000..43a8d97c0e2c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/README.md @@ -0,0 +1,157 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules` Documentation + +The `globalschedules` SDK allows for interaction with the Azure Resource Manager Service `devtestlab` (API Version `2018-09-15`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules" +``` + + +### Client Initialization + +```go +client := globalschedules.NewGlobalSchedulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `GlobalSchedulesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := globalschedules.NewScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scheduleValue") + +payload := globalschedules.Schedule{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GlobalSchedulesClient.Delete` + +```go +ctx := context.TODO() +id := globalschedules.NewScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scheduleValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GlobalSchedulesClient.Execute` + +```go +ctx := context.TODO() +id := globalschedules.NewScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scheduleValue") + +if err := client.ExecuteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `GlobalSchedulesClient.Get` + +```go +ctx := context.TODO() +id := globalschedules.NewScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scheduleValue") + +read, err := client.Get(ctx, id, globalschedules.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GlobalSchedulesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := globalschedules.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id, globalschedules.DefaultListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id, globalschedules.DefaultListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `GlobalSchedulesClient.ListBySubscription` + +```go +ctx := context.TODO() +id := globalschedules.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id, globalschedules.DefaultListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id, globalschedules.DefaultListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `GlobalSchedulesClient.Retarget` + +```go +ctx := context.TODO() +id := globalschedules.NewScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scheduleValue") + +payload := globalschedules.RetargetScheduleProperties{ + // ... +} + + +if err := client.RetargetThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `GlobalSchedulesClient.Update` + +```go +ctx := context.TODO() +id := globalschedules.NewScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scheduleValue") + +payload := globalschedules.UpdateResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/client.go new file mode 100644 index 000000000000..8339d85249fe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/client.go @@ -0,0 +1,18 @@ +package globalschedules + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GlobalSchedulesClient struct { + Client autorest.Client + baseUri string +} + +func NewGlobalSchedulesClientWithBaseURI(endpoint string) GlobalSchedulesClient { + return GlobalSchedulesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/constants.go new file mode 100644 index 000000000000..d05e0b582e69 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/constants.go @@ -0,0 +1,34 @@ +package globalschedules + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnableStatus string + +const ( + EnableStatusDisabled EnableStatus = "Disabled" + EnableStatusEnabled EnableStatus = "Enabled" +) + +func PossibleValuesForEnableStatus() []string { + return []string{ + string(EnableStatusDisabled), + string(EnableStatusEnabled), + } +} + +func parseEnableStatus(input string) (*EnableStatus, error) { + vals := map[string]EnableStatus{ + "disabled": EnableStatusDisabled, + "enabled": EnableStatusEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnableStatus(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/id_schedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/id_schedule.go new file mode 100644 index 000000000000..00dc2850b224 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/id_schedule.go @@ -0,0 +1,124 @@ +package globalschedules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ScheduleId{} + +// ScheduleId is a struct representing the Resource ID for a Schedule +type ScheduleId struct { + SubscriptionId string + ResourceGroupName string + ScheduleName string +} + +// NewScheduleID returns a new ScheduleId struct +func NewScheduleID(subscriptionId string, resourceGroupName string, scheduleName string) ScheduleId { + return ScheduleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ScheduleName: scheduleName, + } +} + +// ParseScheduleID parses 'input' into a ScheduleId +func ParseScheduleID(input string) (*ScheduleId, error) { + parser := resourceids.NewParserFromResourceIdType(ScheduleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScheduleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { + return nil, fmt.Errorf("the segment 'scheduleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseScheduleIDInsensitively parses 'input' case-insensitively into a ScheduleId +// note: this method should only be used for API response data and not user input +func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { + parser := resourceids.NewParserFromResourceIdType(ScheduleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScheduleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { + return nil, fmt.Errorf("the segment 'scheduleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateScheduleID checks that 'input' can be parsed as a Schedule ID +func ValidateScheduleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseScheduleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Schedule ID +func (id ScheduleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/schedules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ScheduleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Schedule ID +func (id ScheduleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDevTestLab", "Microsoft.DevTestLab", "Microsoft.DevTestLab"), + resourceids.StaticSegment("staticSchedules", "schedules", "schedules"), + resourceids.UserSpecifiedSegment("scheduleName", "scheduleValue"), + } +} + +// String returns a human-readable description of this Schedule ID +func (id ScheduleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Schedule Name: %q", id.ScheduleName), + } + return fmt.Sprintf("Schedule (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_createorupdate_autorest.go new file mode 100644 index 000000000000..e07486c88861 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package globalschedules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Schedule +} + +// CreateOrUpdate ... +func (c GlobalSchedulesClient) CreateOrUpdate(ctx context.Context, id ScheduleId, input Schedule) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c GlobalSchedulesClient) preparerForCreateOrUpdate(ctx context.Context, id ScheduleId, input Schedule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c GlobalSchedulesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_delete_autorest.go new file mode 100644 index 000000000000..c554742311cf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_delete_autorest.go @@ -0,0 +1,66 @@ +package globalschedules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c GlobalSchedulesClient) Delete(ctx context.Context, id ScheduleId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c GlobalSchedulesClient) preparerForDelete(ctx context.Context, id ScheduleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c GlobalSchedulesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_execute_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_execute_autorest.go new file mode 100644 index 000000000000..47f44e09d7f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_execute_autorest.go @@ -0,0 +1,78 @@ +package globalschedules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExecuteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Execute ... +func (c GlobalSchedulesClient) Execute(ctx context.Context, id ScheduleId) (result ExecuteOperationResponse, err error) { + req, err := c.preparerForExecute(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "Execute", nil, "Failure preparing request") + return + } + + result, err = c.senderForExecute(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "Execute", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ExecuteThenPoll performs Execute then polls until it's completed +func (c GlobalSchedulesClient) ExecuteThenPoll(ctx context.Context, id ScheduleId) error { + result, err := c.Execute(ctx, id) + if err != nil { + return fmt.Errorf("performing Execute: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Execute: %+v", err) + } + + return nil +} + +// preparerForExecute prepares the Execute request. +func (c GlobalSchedulesClient) preparerForExecute(ctx context.Context, id ScheduleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/execute", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForExecute sends the Execute request. The method will close the +// http.Response Body if it receives an error. +func (c GlobalSchedulesClient) senderForExecute(ctx context.Context, req *http.Request) (future ExecuteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_get_autorest.go new file mode 100644 index 000000000000..cdc7b27b99fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_get_autorest.go @@ -0,0 +1,97 @@ +package globalschedules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Schedule +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// Get ... +func (c GlobalSchedulesClient) Get(ctx context.Context, id ScheduleId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c GlobalSchedulesClient) preparerForGet(ctx context.Context, id ScheduleId, options GetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c GlobalSchedulesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..f4f309b85692 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_listbyresourcegroup_autorest.go @@ -0,0 +1,231 @@ +package globalschedules + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Schedule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Schedule +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByResourceGroupOperationOptions struct { + Expand *string + Filter *string + Orderby *string + Top *int64 +} + +func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { + return ListByResourceGroupOperationOptions{} +} + +func (o ListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Orderby != nil { + out["$orderby"] = *o.Orderby + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListByResourceGroup ... +func (c GlobalSchedulesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c GlobalSchedulesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DevTestLab/schedules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c GlobalSchedulesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c GlobalSchedulesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Schedule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c GlobalSchedulesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, ScheduleOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c GlobalSchedulesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate ScheduleOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Schedule, 0) + + page, err := c.ListByResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_listbysubscription_autorest.go new file mode 100644 index 000000000000..e6a4c1bb031f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_listbysubscription_autorest.go @@ -0,0 +1,231 @@ +package globalschedules + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Schedule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []Schedule +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListBySubscriptionOperationOptions struct { + Expand *string + Filter *string + Orderby *string + Top *int64 +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Orderby != nil { + out["$orderby"] = *o.Orderby + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListBySubscription ... +func (c GlobalSchedulesClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c GlobalSchedulesClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DevTestLab/schedules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c GlobalSchedulesClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c GlobalSchedulesClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Schedule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c GlobalSchedulesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, ScheduleOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c GlobalSchedulesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions, predicate ScheduleOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]Schedule, 0) + + page, err := c.ListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_retarget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_retarget_autorest.go new file mode 100644 index 000000000000..8865e61eb504 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_retarget_autorest.go @@ -0,0 +1,79 @@ +package globalschedules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RetargetOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Retarget ... +func (c GlobalSchedulesClient) Retarget(ctx context.Context, id ScheduleId, input RetargetScheduleProperties) (result RetargetOperationResponse, err error) { + req, err := c.preparerForRetarget(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "Retarget", nil, "Failure preparing request") + return + } + + result, err = c.senderForRetarget(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "Retarget", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// RetargetThenPoll performs Retarget then polls until it's completed +func (c GlobalSchedulesClient) RetargetThenPoll(ctx context.Context, id ScheduleId, input RetargetScheduleProperties) error { + result, err := c.Retarget(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Retarget: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Retarget: %+v", err) + } + + return nil +} + +// preparerForRetarget prepares the Retarget request. +func (c GlobalSchedulesClient) preparerForRetarget(ctx context.Context, id ScheduleId, input RetargetScheduleProperties) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/retarget", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForRetarget sends the Retarget request. The method will close the +// http.Response Body if it receives an error. +func (c GlobalSchedulesClient) senderForRetarget(ctx context.Context, req *http.Request) (future RetargetOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_update_autorest.go new file mode 100644 index 000000000000..957fc8430af5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/method_update_autorest.go @@ -0,0 +1,69 @@ +package globalschedules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Schedule +} + +// Update ... +func (c GlobalSchedulesClient) Update(ctx context.Context, id ScheduleId, input UpdateResource) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "globalschedules.GlobalSchedulesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c GlobalSchedulesClient) preparerForUpdate(ctx context.Context, id ScheduleId, input UpdateResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c GlobalSchedulesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_daydetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_daydetails.go new file mode 100644 index 000000000000..82954dc14b9a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_daydetails.go @@ -0,0 +1,8 @@ +package globalschedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DayDetails struct { + Time *string `json:"time,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_hourdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_hourdetails.go new file mode 100644 index 000000000000..fcb2e0e01344 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_hourdetails.go @@ -0,0 +1,8 @@ +package globalschedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HourDetails struct { + Minute *int64 `json:"minute,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_notificationsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_notificationsettings.go new file mode 100644 index 000000000000..b9842a66f7ba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_notificationsettings.go @@ -0,0 +1,12 @@ +package globalschedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationSettings struct { + EmailRecipient *string `json:"emailRecipient,omitempty"` + NotificationLocale *string `json:"notificationLocale,omitempty"` + Status *EnableStatus `json:"status,omitempty"` + TimeInMinutes *int64 `json:"timeInMinutes,omitempty"` + WebhookUrl *string `json:"webhookUrl,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_retargetscheduleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_retargetscheduleproperties.go new file mode 100644 index 000000000000..6775d9b37cc0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_retargetscheduleproperties.go @@ -0,0 +1,9 @@ +package globalschedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RetargetScheduleProperties struct { + CurrentResourceId *string `json:"currentResourceId,omitempty"` + TargetResourceId *string `json:"targetResourceId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_schedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_schedule.go new file mode 100644 index 000000000000..b68169bb62ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_schedule.go @@ -0,0 +1,13 @@ +package globalschedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Schedule struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ScheduleProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_scheduleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_scheduleproperties.go new file mode 100644 index 000000000000..e27c2731ba56 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_scheduleproperties.go @@ -0,0 +1,36 @@ +package globalschedules + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleProperties struct { + CreatedDate *string `json:"createdDate,omitempty"` + DailyRecurrence *DayDetails `json:"dailyRecurrence,omitempty"` + HourlyRecurrence *HourDetails `json:"hourlyRecurrence,omitempty"` + NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Status *EnableStatus `json:"status,omitempty"` + TargetResourceId *string `json:"targetResourceId,omitempty"` + TaskType *string `json:"taskType,omitempty"` + TimeZoneId *string `json:"timeZoneId,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` + WeeklyRecurrence *WeekDetails `json:"weeklyRecurrence,omitempty"` +} + +func (o *ScheduleProperties) GetCreatedDateAsTime() (*time.Time, error) { + if o.CreatedDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ScheduleProperties) SetCreatedDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_updateresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_updateresource.go new file mode 100644 index 000000000000..9cb9460da507 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_updateresource.go @@ -0,0 +1,8 @@ +package globalschedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateResource struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_weekdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_weekdetails.go new file mode 100644 index 000000000000..db5b27685977 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/model_weekdetails.go @@ -0,0 +1,9 @@ +package globalschedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WeekDetails struct { + Time *string `json:"time,omitempty"` + Weekdays *[]string `json:"weekdays,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/predicates.go new file mode 100644 index 000000000000..497d34fd8e64 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/predicates.go @@ -0,0 +1,29 @@ +package globalschedules + +type ScheduleOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ScheduleOperationPredicate) Matches(input Schedule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/version.go new file mode 100644 index 000000000000..23c34b84f6e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules/version.go @@ -0,0 +1,12 @@ +package globalschedules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-09-15" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/globalschedules/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/README.md new file mode 100644 index 000000000000..6d6be1655144 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/README.md @@ -0,0 +1,221 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs` Documentation + +The `labs` SDK allows for interaction with the Azure Resource Manager Service `devtestlab` (API Version `2018-09-15`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs" +``` + + +### Client Initialization + +```go +client := labs.NewLabsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `LabsClient.ClaimAnyVM` + +```go +ctx := context.TODO() +id := labs.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue") + +if err := client.ClaimAnyVMThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `LabsClient.CreateEnvironment` + +```go +ctx := context.TODO() +id := labs.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue") + +payload := labs.LabVirtualMachineCreationParameter{ + // ... +} + + +if err := client.CreateEnvironmentThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `LabsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := labs.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue") + +payload := labs.Lab{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `LabsClient.Delete` + +```go +ctx := context.TODO() +id := labs.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `LabsClient.ExportResourceUsage` + +```go +ctx := context.TODO() +id := labs.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue") + +payload := labs.ExportResourceUsageParameters{ + // ... +} + + +if err := client.ExportResourceUsageThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `LabsClient.GenerateUploadUri` + +```go +ctx := context.TODO() +id := labs.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue") + +payload := labs.GenerateUploadUriParameter{ + // ... +} + + +read, err := client.GenerateUploadUri(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `LabsClient.Get` + +```go +ctx := context.TODO() +id := labs.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue") + +read, err := client.Get(ctx, id, labs.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `LabsClient.ImportVirtualMachine` + +```go +ctx := context.TODO() +id := labs.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue") + +payload := labs.ImportLabVirtualMachineRequest{ + // ... +} + + +if err := client.ImportVirtualMachineThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `LabsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := labs.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id, labs.DefaultListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id, labs.DefaultListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `LabsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := labs.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id, labs.DefaultListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id, labs.DefaultListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `LabsClient.ListVhds` + +```go +ctx := context.TODO() +id := labs.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue") + +// alternatively `client.ListVhds(ctx, id)` can be used to do batched pagination +items, err := client.ListVhdsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `LabsClient.Update` + +```go +ctx := context.TODO() +id := labs.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue") + +payload := labs.UpdateResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/client.go new file mode 100644 index 000000000000..58f6a6a12995 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/client.go @@ -0,0 +1,18 @@ +package labs + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LabsClient struct { + Client autorest.Client + baseUri string +} + +func NewLabsClientWithBaseURI(endpoint string) LabsClient { + return LabsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/constants.go new file mode 100644 index 000000000000..39cf1db436d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/constants.go @@ -0,0 +1,180 @@ +package labs + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnableStatus string + +const ( + EnableStatusDisabled EnableStatus = "Disabled" + EnableStatusEnabled EnableStatus = "Enabled" +) + +func PossibleValuesForEnableStatus() []string { + return []string{ + string(EnableStatusDisabled), + string(EnableStatusEnabled), + } +} + +func parseEnableStatus(input string) (*EnableStatus, error) { + vals := map[string]EnableStatus{ + "disabled": EnableStatusDisabled, + "enabled": EnableStatusEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnableStatus(input) + return &out, nil +} + +type EnvironmentPermission string + +const ( + EnvironmentPermissionContributor EnvironmentPermission = "Contributor" + EnvironmentPermissionReader EnvironmentPermission = "Reader" +) + +func PossibleValuesForEnvironmentPermission() []string { + return []string{ + string(EnvironmentPermissionContributor), + string(EnvironmentPermissionReader), + } +} + +func parseEnvironmentPermission(input string) (*EnvironmentPermission, error) { + vals := map[string]EnvironmentPermission{ + "contributor": EnvironmentPermissionContributor, + "reader": EnvironmentPermissionReader, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnvironmentPermission(input) + return &out, nil +} + +type HostCachingOptions string + +const ( + HostCachingOptionsNone HostCachingOptions = "None" + HostCachingOptionsReadOnly HostCachingOptions = "ReadOnly" + HostCachingOptionsReadWrite HostCachingOptions = "ReadWrite" +) + +func PossibleValuesForHostCachingOptions() []string { + return []string{ + string(HostCachingOptionsNone), + string(HostCachingOptionsReadOnly), + string(HostCachingOptionsReadWrite), + } +} + +func parseHostCachingOptions(input string) (*HostCachingOptions, error) { + vals := map[string]HostCachingOptions{ + "none": HostCachingOptionsNone, + "readonly": HostCachingOptionsReadOnly, + "readwrite": HostCachingOptionsReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HostCachingOptions(input) + return &out, nil +} + +type PremiumDataDisk string + +const ( + PremiumDataDiskDisabled PremiumDataDisk = "Disabled" + PremiumDataDiskEnabled PremiumDataDisk = "Enabled" +) + +func PossibleValuesForPremiumDataDisk() []string { + return []string{ + string(PremiumDataDiskDisabled), + string(PremiumDataDiskEnabled), + } +} + +func parsePremiumDataDisk(input string) (*PremiumDataDisk, error) { + vals := map[string]PremiumDataDisk{ + "disabled": PremiumDataDiskDisabled, + "enabled": PremiumDataDiskEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PremiumDataDisk(input) + return &out, nil +} + +type StorageType string + +const ( + StorageTypePremium StorageType = "Premium" + StorageTypeStandard StorageType = "Standard" + StorageTypeStandardSSD StorageType = "StandardSSD" +) + +func PossibleValuesForStorageType() []string { + return []string{ + string(StorageTypePremium), + string(StorageTypeStandard), + string(StorageTypeStandardSSD), + } +} + +func parseStorageType(input string) (*StorageType, error) { + vals := map[string]StorageType{ + "premium": StorageTypePremium, + "standard": StorageTypeStandard, + "standardssd": StorageTypeStandardSSD, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageType(input) + return &out, nil +} + +type TransportProtocol string + +const ( + TransportProtocolTcp TransportProtocol = "Tcp" + TransportProtocolUdp TransportProtocol = "Udp" +) + +func PossibleValuesForTransportProtocol() []string { + return []string{ + string(TransportProtocolTcp), + string(TransportProtocolUdp), + } +} + +func parseTransportProtocol(input string) (*TransportProtocol, error) { + vals := map[string]TransportProtocol{ + "tcp": TransportProtocolTcp, + "udp": TransportProtocolUdp, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TransportProtocol(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/id_lab.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/id_lab.go new file mode 100644 index 000000000000..60a82b31252e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/id_lab.go @@ -0,0 +1,124 @@ +package labs + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LabId{} + +// LabId is a struct representing the Resource ID for a Lab +type LabId struct { + SubscriptionId string + ResourceGroupName string + LabName string +} + +// NewLabID returns a new LabId struct +func NewLabID(subscriptionId string, resourceGroupName string, labName string) LabId { + return LabId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + LabName: labName, + } +} + +// ParseLabID parses 'input' into a LabId +func ParseLabID(input string) (*LabId, error) { + parser := resourceids.NewParserFromResourceIdType(LabId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LabId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLabIDInsensitively parses 'input' case-insensitively into a LabId +// note: this method should only be used for API response data and not user input +func ParseLabIDInsensitively(input string) (*LabId, error) { + parser := resourceids.NewParserFromResourceIdType(LabId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LabId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLabID checks that 'input' can be parsed as a Lab ID +func ValidateLabID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLabID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Lab ID +func (id LabId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.LabName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Lab ID +func (id LabId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDevTestLab", "Microsoft.DevTestLab", "Microsoft.DevTestLab"), + resourceids.StaticSegment("staticLabs", "labs", "labs"), + resourceids.UserSpecifiedSegment("labName", "labValue"), + } +} + +// String returns a human-readable description of this Lab ID +func (id LabId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Lab Name: %q", id.LabName), + } + return fmt.Sprintf("Lab (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_claimanyvm_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_claimanyvm_autorest.go new file mode 100644 index 000000000000..239f1e4ea38d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_claimanyvm_autorest.go @@ -0,0 +1,78 @@ +package labs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClaimAnyVMOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ClaimAnyVM ... +func (c LabsClient) ClaimAnyVM(ctx context.Context, id LabId) (result ClaimAnyVMOperationResponse, err error) { + req, err := c.preparerForClaimAnyVM(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ClaimAnyVM", nil, "Failure preparing request") + return + } + + result, err = c.senderForClaimAnyVM(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ClaimAnyVM", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ClaimAnyVMThenPoll performs ClaimAnyVM then polls until it's completed +func (c LabsClient) ClaimAnyVMThenPoll(ctx context.Context, id LabId) error { + result, err := c.ClaimAnyVM(ctx, id) + if err != nil { + return fmt.Errorf("performing ClaimAnyVM: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ClaimAnyVM: %+v", err) + } + + return nil +} + +// preparerForClaimAnyVM prepares the ClaimAnyVM request. +func (c LabsClient) preparerForClaimAnyVM(ctx context.Context, id LabId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/claimAnyVm", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForClaimAnyVM sends the ClaimAnyVM request. The method will close the +// http.Response Body if it receives an error. +func (c LabsClient) senderForClaimAnyVM(ctx context.Context, req *http.Request) (future ClaimAnyVMOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_createenvironment_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_createenvironment_autorest.go new file mode 100644 index 000000000000..0b58773256d1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_createenvironment_autorest.go @@ -0,0 +1,79 @@ +package labs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateEnvironmentOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateEnvironment ... +func (c LabsClient) CreateEnvironment(ctx context.Context, id LabId, input LabVirtualMachineCreationParameter) (result CreateEnvironmentOperationResponse, err error) { + req, err := c.preparerForCreateEnvironment(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "CreateEnvironment", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateEnvironment(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "CreateEnvironment", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateEnvironmentThenPoll performs CreateEnvironment then polls until it's completed +func (c LabsClient) CreateEnvironmentThenPoll(ctx context.Context, id LabId, input LabVirtualMachineCreationParameter) error { + result, err := c.CreateEnvironment(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateEnvironment: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateEnvironment: %+v", err) + } + + return nil +} + +// preparerForCreateEnvironment prepares the CreateEnvironment request. +func (c LabsClient) preparerForCreateEnvironment(ctx context.Context, id LabId, input LabVirtualMachineCreationParameter) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/createEnvironment", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateEnvironment sends the CreateEnvironment request. The method will close the +// http.Response Body if it receives an error. +func (c LabsClient) senderForCreateEnvironment(ctx context.Context, req *http.Request) (future CreateEnvironmentOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_createorupdate_autorest.go new file mode 100644 index 000000000000..9dd00af20a10 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package labs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c LabsClient) CreateOrUpdate(ctx context.Context, id LabId, input Lab) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c LabsClient) CreateOrUpdateThenPoll(ctx context.Context, id LabId, input Lab) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c LabsClient) preparerForCreateOrUpdate(ctx context.Context, id LabId, input Lab) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c LabsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_delete_autorest.go new file mode 100644 index 000000000000..6d40b8375cff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_delete_autorest.go @@ -0,0 +1,78 @@ +package labs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c LabsClient) Delete(ctx context.Context, id LabId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c LabsClient) DeleteThenPoll(ctx context.Context, id LabId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c LabsClient) preparerForDelete(ctx context.Context, id LabId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c LabsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_exportresourceusage_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_exportresourceusage_autorest.go new file mode 100644 index 000000000000..d482eb7e52f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_exportresourceusage_autorest.go @@ -0,0 +1,79 @@ +package labs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportResourceUsageOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ExportResourceUsage ... +func (c LabsClient) ExportResourceUsage(ctx context.Context, id LabId, input ExportResourceUsageParameters) (result ExportResourceUsageOperationResponse, err error) { + req, err := c.preparerForExportResourceUsage(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ExportResourceUsage", nil, "Failure preparing request") + return + } + + result, err = c.senderForExportResourceUsage(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ExportResourceUsage", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ExportResourceUsageThenPoll performs ExportResourceUsage then polls until it's completed +func (c LabsClient) ExportResourceUsageThenPoll(ctx context.Context, id LabId, input ExportResourceUsageParameters) error { + result, err := c.ExportResourceUsage(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ExportResourceUsage: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ExportResourceUsage: %+v", err) + } + + return nil +} + +// preparerForExportResourceUsage prepares the ExportResourceUsage request. +func (c LabsClient) preparerForExportResourceUsage(ctx context.Context, id LabId, input ExportResourceUsageParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/exportResourceUsage", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForExportResourceUsage sends the ExportResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (c LabsClient) senderForExportResourceUsage(ctx context.Context, req *http.Request) (future ExportResourceUsageOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_generateuploaduri_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_generateuploaduri_autorest.go new file mode 100644 index 000000000000..dd8b0fa0a3ab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_generateuploaduri_autorest.go @@ -0,0 +1,70 @@ +package labs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GenerateUploadUriOperationResponse struct { + HttpResponse *http.Response + Model *GenerateUploadUriResponse +} + +// GenerateUploadUri ... +func (c LabsClient) GenerateUploadUri(ctx context.Context, id LabId, input GenerateUploadUriParameter) (result GenerateUploadUriOperationResponse, err error) { + req, err := c.preparerForGenerateUploadUri(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "GenerateUploadUri", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "GenerateUploadUri", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGenerateUploadUri(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "GenerateUploadUri", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGenerateUploadUri prepares the GenerateUploadUri request. +func (c LabsClient) preparerForGenerateUploadUri(ctx context.Context, id LabId, input GenerateUploadUriParameter) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/generateUploadUri", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGenerateUploadUri handles the response to the GenerateUploadUri request. The method always +// closes the http.Response Body. +func (c LabsClient) responderForGenerateUploadUri(resp *http.Response) (result GenerateUploadUriOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_get_autorest.go new file mode 100644 index 000000000000..a50da9fcdf09 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_get_autorest.go @@ -0,0 +1,97 @@ +package labs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Lab +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// Get ... +func (c LabsClient) Get(ctx context.Context, id LabId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c LabsClient) preparerForGet(ctx context.Context, id LabId, options GetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c LabsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_importvirtualmachine_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_importvirtualmachine_autorest.go new file mode 100644 index 000000000000..15c87d58f083 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_importvirtualmachine_autorest.go @@ -0,0 +1,79 @@ +package labs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImportVirtualMachineOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ImportVirtualMachine ... +func (c LabsClient) ImportVirtualMachine(ctx context.Context, id LabId, input ImportLabVirtualMachineRequest) (result ImportVirtualMachineOperationResponse, err error) { + req, err := c.preparerForImportVirtualMachine(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ImportVirtualMachine", nil, "Failure preparing request") + return + } + + result, err = c.senderForImportVirtualMachine(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ImportVirtualMachine", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ImportVirtualMachineThenPoll performs ImportVirtualMachine then polls until it's completed +func (c LabsClient) ImportVirtualMachineThenPoll(ctx context.Context, id LabId, input ImportLabVirtualMachineRequest) error { + result, err := c.ImportVirtualMachine(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ImportVirtualMachine: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ImportVirtualMachine: %+v", err) + } + + return nil +} + +// preparerForImportVirtualMachine prepares the ImportVirtualMachine request. +func (c LabsClient) preparerForImportVirtualMachine(ctx context.Context, id LabId, input ImportLabVirtualMachineRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/importVirtualMachine", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForImportVirtualMachine sends the ImportVirtualMachine request. The method will close the +// http.Response Body if it receives an error. +func (c LabsClient) senderForImportVirtualMachine(ctx context.Context, req *http.Request) (future ImportVirtualMachineOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..eb5da8ac7a09 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_listbyresourcegroup_autorest.go @@ -0,0 +1,231 @@ +package labs + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Lab + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Lab +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByResourceGroupOperationOptions struct { + Expand *string + Filter *string + Orderby *string + Top *int64 +} + +func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { + return ListByResourceGroupOperationOptions{} +} + +func (o ListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Orderby != nil { + out["$orderby"] = *o.Orderby + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListByResourceGroup ... +func (c LabsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c LabsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DevTestLab/labs", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c LabsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c LabsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Lab `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c LabsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, LabOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c LabsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate LabOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Lab, 0) + + page, err := c.ListByResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_listbysubscription_autorest.go new file mode 100644 index 000000000000..4b4b8319c95c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_listbysubscription_autorest.go @@ -0,0 +1,231 @@ +package labs + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Lab + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []Lab +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListBySubscriptionOperationOptions struct { + Expand *string + Filter *string + Orderby *string + Top *int64 +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Orderby != nil { + out["$orderby"] = *o.Orderby + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListBySubscription ... +func (c LabsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c LabsClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DevTestLab/labs", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c LabsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c LabsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Lab `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c LabsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, LabOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c LabsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions, predicate LabOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]Lab, 0) + + page, err := c.ListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_listvhds_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_listvhds_autorest.go new file mode 100644 index 000000000000..a8f5c6d4caf4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_listvhds_autorest.go @@ -0,0 +1,186 @@ +package labs + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListVhdsOperationResponse struct { + HttpResponse *http.Response + Model *[]LabVhd + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListVhdsOperationResponse, error) +} + +type ListVhdsCompleteResult struct { + Items []LabVhd +} + +func (r ListVhdsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListVhdsOperationResponse) LoadMore(ctx context.Context) (resp ListVhdsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListVhds ... +func (c LabsClient) ListVhds(ctx context.Context, id LabId) (resp ListVhdsOperationResponse, err error) { + req, err := c.preparerForListVhds(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListVhds", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListVhds", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListVhds(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListVhds", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListVhds prepares the ListVhds request. +func (c LabsClient) preparerForListVhds(ctx context.Context, id LabId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listVhds", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListVhdsWithNextLink prepares the ListVhds request with the given nextLink token. +func (c LabsClient) preparerForListVhdsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListVhds handles the response to the ListVhds request. The method always +// closes the http.Response Body. +func (c LabsClient) responderForListVhds(resp *http.Response) (result ListVhdsOperationResponse, err error) { + type page struct { + Values []LabVhd `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListVhdsOperationResponse, err error) { + req, err := c.preparerForListVhdsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListVhds", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListVhds", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListVhds(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "ListVhds", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListVhdsComplete retrieves all of the results into a single object +func (c LabsClient) ListVhdsComplete(ctx context.Context, id LabId) (ListVhdsCompleteResult, error) { + return c.ListVhdsCompleteMatchingPredicate(ctx, id, LabVhdOperationPredicate{}) +} + +// ListVhdsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c LabsClient) ListVhdsCompleteMatchingPredicate(ctx context.Context, id LabId, predicate LabVhdOperationPredicate) (resp ListVhdsCompleteResult, err error) { + items := make([]LabVhd, 0) + + page, err := c.ListVhds(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListVhdsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_update_autorest.go new file mode 100644 index 000000000000..46144bf0d7c9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/method_update_autorest.go @@ -0,0 +1,69 @@ +package labs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Lab +} + +// Update ... +func (c LabsClient) Update(ctx context.Context, id LabId, input UpdateResource) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "labs.LabsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c LabsClient) preparerForUpdate(ctx context.Context, id LabId, input UpdateResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c LabsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_artifactinstallproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_artifactinstallproperties.go new file mode 100644 index 000000000000..02066fafba98 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_artifactinstallproperties.go @@ -0,0 +1,32 @@ +package labs + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArtifactInstallProperties struct { + ArtifactId *string `json:"artifactId,omitempty"` + ArtifactTitle *string `json:"artifactTitle,omitempty"` + DeploymentStatusMessage *string `json:"deploymentStatusMessage,omitempty"` + InstallTime *string `json:"installTime,omitempty"` + Parameters *[]ArtifactParameterProperties `json:"parameters,omitempty"` + Status *string `json:"status,omitempty"` + VMExtensionStatusMessage *string `json:"vmExtensionStatusMessage,omitempty"` +} + +func (o *ArtifactInstallProperties) GetInstallTimeAsTime() (*time.Time, error) { + if o.InstallTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.InstallTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ArtifactInstallProperties) SetInstallTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.InstallTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_artifactparameterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_artifactparameterproperties.go new file mode 100644 index 000000000000..56a9843d8438 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_artifactparameterproperties.go @@ -0,0 +1,9 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArtifactParameterProperties struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_attachnewdatadiskoptions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_attachnewdatadiskoptions.go new file mode 100644 index 000000000000..4c0b9b74e77a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_attachnewdatadiskoptions.go @@ -0,0 +1,10 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttachNewDataDiskOptions struct { + DiskName *string `json:"diskName,omitempty"` + DiskSizeGiB *int64 `json:"diskSizeGiB,omitempty"` + DiskType *StorageType `json:"diskType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_bulkcreationparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_bulkcreationparameters.go new file mode 100644 index 000000000000..baac79852050 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_bulkcreationparameters.go @@ -0,0 +1,8 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BulkCreationParameters struct { + InstanceCount *int64 `json:"instanceCount,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_datadiskproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_datadiskproperties.go new file mode 100644 index 000000000000..591b7a65514b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_datadiskproperties.go @@ -0,0 +1,10 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDiskProperties struct { + AttachNewDataDiskOptions *AttachNewDataDiskOptions `json:"attachNewDataDiskOptions,omitempty"` + ExistingLabDiskId *string `json:"existingLabDiskId,omitempty"` + HostCaching *HostCachingOptions `json:"hostCaching,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_daydetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_daydetails.go new file mode 100644 index 000000000000..f7963232bc31 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_daydetails.go @@ -0,0 +1,8 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DayDetails struct { + Time *string `json:"time,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_exportresourceusageparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_exportresourceusageparameters.go new file mode 100644 index 000000000000..071e5d366bff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_exportresourceusageparameters.go @@ -0,0 +1,27 @@ +package labs + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportResourceUsageParameters struct { + BlobStorageAbsoluteSasUri *string `json:"blobStorageAbsoluteSasUri,omitempty"` + UsageStartDate *string `json:"usageStartDate,omitempty"` +} + +func (o *ExportResourceUsageParameters) GetUsageStartDateAsTime() (*time.Time, error) { + if o.UsageStartDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UsageStartDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExportResourceUsageParameters) SetUsageStartDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UsageStartDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_galleryimagereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_galleryimagereference.go new file mode 100644 index 000000000000..451e681be7e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_galleryimagereference.go @@ -0,0 +1,12 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GalleryImageReference struct { + Offer *string `json:"offer,omitempty"` + OsType *string `json:"osType,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Sku *string `json:"sku,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_generateuploaduriparameter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_generateuploaduriparameter.go new file mode 100644 index 000000000000..2496c6575ee7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_generateuploaduriparameter.go @@ -0,0 +1,8 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GenerateUploadUriParameter struct { + BlobName *string `json:"blobName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_generateuploaduriresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_generateuploaduriresponse.go new file mode 100644 index 000000000000..224cfe860598 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_generateuploaduriresponse.go @@ -0,0 +1,8 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GenerateUploadUriResponse struct { + UploadUri *string `json:"uploadUri,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_hourdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_hourdetails.go new file mode 100644 index 000000000000..ed1734534ab9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_hourdetails.go @@ -0,0 +1,8 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HourDetails struct { + Minute *int64 `json:"minute,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_importlabvirtualmachinerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_importlabvirtualmachinerequest.go new file mode 100644 index 000000000000..64bf3131e3c8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_importlabvirtualmachinerequest.go @@ -0,0 +1,9 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImportLabVirtualMachineRequest struct { + DestinationVirtualMachineName *string `json:"destinationVirtualMachineName,omitempty"` + SourceVirtualMachineResourceId *string `json:"sourceVirtualMachineResourceId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_inboundnatrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_inboundnatrule.go new file mode 100644 index 000000000000..8d355937d0fe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_inboundnatrule.go @@ -0,0 +1,10 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InboundNatRule struct { + BackendPort *int64 `json:"backendPort,omitempty"` + FrontendPort *int64 `json:"frontendPort,omitempty"` + TransportProtocol *TransportProtocol `json:"transportProtocol,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_lab.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_lab.go new file mode 100644 index 000000000000..837e154033d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_lab.go @@ -0,0 +1,13 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Lab struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *LabProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labannouncementproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labannouncementproperties.go new file mode 100644 index 000000000000..3d523152b186 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labannouncementproperties.go @@ -0,0 +1,32 @@ +package labs + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LabAnnouncementProperties struct { + Enabled *EnableStatus `json:"enabled,omitempty"` + ExpirationDate *string `json:"expirationDate,omitempty"` + Expired *bool `json:"expired,omitempty"` + Markdown *string `json:"markdown,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Title *string `json:"title,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +func (o *LabAnnouncementProperties) GetExpirationDateAsTime() (*time.Time, error) { + if o.ExpirationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ExpirationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *LabAnnouncementProperties) SetExpirationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labproperties.go new file mode 100644 index 000000000000..004f58b65cba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labproperties.go @@ -0,0 +1,45 @@ +package labs + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LabProperties struct { + Announcement *LabAnnouncementProperties `json:"announcement,omitempty"` + ArtifactsStorageAccount *string `json:"artifactsStorageAccount,omitempty"` + CreatedDate *string `json:"createdDate,omitempty"` + DefaultPremiumStorageAccount *string `json:"defaultPremiumStorageAccount,omitempty"` + DefaultStorageAccount *string `json:"defaultStorageAccount,omitempty"` + EnvironmentPermission *EnvironmentPermission `json:"environmentPermission,omitempty"` + ExtendedProperties *map[string]string `json:"extendedProperties,omitempty"` + LabStorageType *StorageType `json:"labStorageType,omitempty"` + LoadBalancerId *string `json:"loadBalancerId,omitempty"` + MandatoryArtifactsResourceIdsLinux *[]string `json:"mandatoryArtifactsResourceIdsLinux,omitempty"` + MandatoryArtifactsResourceIdsWindows *[]string `json:"mandatoryArtifactsResourceIdsWindows,omitempty"` + NetworkSecurityGroupId *string `json:"networkSecurityGroupId,omitempty"` + PremiumDataDiskStorageAccount *string `json:"premiumDataDiskStorageAccount,omitempty"` + PremiumDataDisks *PremiumDataDisk `json:"premiumDataDisks,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + PublicIPId *string `json:"publicIpId,omitempty"` + Support *LabSupportProperties `json:"support,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` + VMCreationResourceGroup *string `json:"vmCreationResourceGroup,omitempty"` + VaultName *string `json:"vaultName,omitempty"` +} + +func (o *LabProperties) GetCreatedDateAsTime() (*time.Time, error) { + if o.CreatedDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *LabProperties) SetCreatedDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labsupportproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labsupportproperties.go new file mode 100644 index 000000000000..afce3f63d120 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labsupportproperties.go @@ -0,0 +1,9 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LabSupportProperties struct { + Enabled *EnableStatus `json:"enabled,omitempty"` + Markdown *string `json:"markdown,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labvhd.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labvhd.go new file mode 100644 index 000000000000..0644041c6c2b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labvhd.go @@ -0,0 +1,8 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LabVhd struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labvirtualmachinecreationparameter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labvirtualmachinecreationparameter.go new file mode 100644 index 000000000000..68e97e253a8c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labvirtualmachinecreationparameter.go @@ -0,0 +1,11 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LabVirtualMachineCreationParameter struct { + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *LabVirtualMachineCreationParameterProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labvirtualmachinecreationparameterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labvirtualmachinecreationparameterproperties.go new file mode 100644 index 000000000000..4cf75b1d470e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_labvirtualmachinecreationparameterproperties.go @@ -0,0 +1,61 @@ +package labs + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LabVirtualMachineCreationParameterProperties struct { + AllowClaim *bool `json:"allowClaim,omitempty"` + Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"` + BulkCreationParameters *BulkCreationParameters `json:"bulkCreationParameters,omitempty"` + CreatedDate *string `json:"createdDate,omitempty"` + CustomImageId *string `json:"customImageId,omitempty"` + DataDiskParameters *[]DataDiskProperties `json:"dataDiskParameters,omitempty"` + DisallowPublicIPAddress *bool `json:"disallowPublicIpAddress,omitempty"` + EnvironmentId *string `json:"environmentId,omitempty"` + ExpirationDate *string `json:"expirationDate,omitempty"` + GalleryImageReference *GalleryImageReference `json:"galleryImageReference,omitempty"` + IsAuthenticationWithSshKey *bool `json:"isAuthenticationWithSshKey,omitempty"` + LabSubnetName *string `json:"labSubnetName,omitempty"` + LabVirtualNetworkId *string `json:"labVirtualNetworkId,omitempty"` + NetworkInterface *NetworkInterfaceProperties `json:"networkInterface,omitempty"` + Notes *string `json:"notes,omitempty"` + OwnerObjectId *string `json:"ownerObjectId,omitempty"` + OwnerUserPrincipalName *string `json:"ownerUserPrincipalName,omitempty"` + Password *string `json:"password,omitempty"` + PlanId *string `json:"planId,omitempty"` + ScheduleParameters *[]ScheduleCreationParameter `json:"scheduleParameters,omitempty"` + Size *string `json:"size,omitempty"` + SshKey *string `json:"sshKey,omitempty"` + StorageType *string `json:"storageType,omitempty"` + UserName *string `json:"userName,omitempty"` +} + +func (o *LabVirtualMachineCreationParameterProperties) GetCreatedDateAsTime() (*time.Time, error) { + if o.CreatedDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *LabVirtualMachineCreationParameterProperties) SetCreatedDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedDate = &formatted +} + +func (o *LabVirtualMachineCreationParameterProperties) GetExpirationDateAsTime() (*time.Time, error) { + if o.ExpirationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ExpirationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *LabVirtualMachineCreationParameterProperties) SetExpirationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_networkinterfaceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_networkinterfaceproperties.go new file mode 100644 index 000000000000..f254b59ab3f7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_networkinterfaceproperties.go @@ -0,0 +1,16 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterfaceProperties struct { + DnsName *string `json:"dnsName,omitempty"` + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + PublicIPAddressId *string `json:"publicIpAddressId,omitempty"` + RdpAuthority *string `json:"rdpAuthority,omitempty"` + SharedPublicIPAddressConfiguration *SharedPublicIPAddressConfiguration `json:"sharedPublicIpAddressConfiguration,omitempty"` + SshAuthority *string `json:"sshAuthority,omitempty"` + SubnetId *string `json:"subnetId,omitempty"` + VirtualNetworkId *string `json:"virtualNetworkId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_notificationsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_notificationsettings.go new file mode 100644 index 000000000000..46e45c6853c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_notificationsettings.go @@ -0,0 +1,12 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationSettings struct { + EmailRecipient *string `json:"emailRecipient,omitempty"` + NotificationLocale *string `json:"notificationLocale,omitempty"` + Status *EnableStatus `json:"status,omitempty"` + TimeInMinutes *int64 `json:"timeInMinutes,omitempty"` + WebhookUrl *string `json:"webhookUrl,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_schedulecreationparameter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_schedulecreationparameter.go new file mode 100644 index 000000000000..1db2aad47479 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_schedulecreationparameter.go @@ -0,0 +1,11 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleCreationParameter struct { + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ScheduleCreationParameterProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_schedulecreationparameterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_schedulecreationparameterproperties.go new file mode 100644 index 000000000000..a3894caf52a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_schedulecreationparameterproperties.go @@ -0,0 +1,15 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleCreationParameterProperties struct { + DailyRecurrence *DayDetails `json:"dailyRecurrence,omitempty"` + HourlyRecurrence *HourDetails `json:"hourlyRecurrence,omitempty"` + NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` + Status *EnableStatus `json:"status,omitempty"` + TargetResourceId *string `json:"targetResourceId,omitempty"` + TaskType *string `json:"taskType,omitempty"` + TimeZoneId *string `json:"timeZoneId,omitempty"` + WeeklyRecurrence *WeekDetails `json:"weeklyRecurrence,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_sharedpublicipaddressconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_sharedpublicipaddressconfiguration.go new file mode 100644 index 000000000000..636d5d66ad80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_sharedpublicipaddressconfiguration.go @@ -0,0 +1,8 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedPublicIPAddressConfiguration struct { + InboundNatRules *[]InboundNatRule `json:"inboundNatRules,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_updateresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_updateresource.go new file mode 100644 index 000000000000..14a2d69299ea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_updateresource.go @@ -0,0 +1,8 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateResource struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_weekdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_weekdetails.go new file mode 100644 index 000000000000..1af47566fbb9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/model_weekdetails.go @@ -0,0 +1,9 @@ +package labs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WeekDetails struct { + Time *string `json:"time,omitempty"` + Weekdays *[]string `json:"weekdays,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/predicates.go new file mode 100644 index 000000000000..2edae6f940bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/predicates.go @@ -0,0 +1,42 @@ +package labs + +type LabOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p LabOperationPredicate) Matches(input Lab) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type LabVhdOperationPredicate struct { + Id *string +} + +func (p LabVhdOperationPredicate) Matches(input LabVhd) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/version.go new file mode 100644 index 000000000000..1b30b0db761f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs/version.go @@ -0,0 +1,12 @@ +package labs + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-09-15" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/labs/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/README.md new file mode 100644 index 000000000000..d773bfb76ab6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies` Documentation + +The `policies` SDK allows for interaction with the Azure Resource Manager Service `devtestlab` (API Version `2018-09-15`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies" +``` + + +### Client Initialization + +```go +client := policies.NewPoliciesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PoliciesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := policies.NewPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "policySetValue", "policyValue") + +payload := policies.Policy{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PoliciesClient.Delete` + +```go +ctx := context.TODO() +id := policies.NewPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "policySetValue", "policyValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PoliciesClient.Get` + +```go +ctx := context.TODO() +id := policies.NewPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "policySetValue", "policyValue") + +read, err := client.Get(ctx, id, policies.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PoliciesClient.List` + +```go +ctx := context.TODO() +id := policies.NewPolicySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "policySetValue") + +// alternatively `client.List(ctx, id, policies.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, policies.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `PoliciesClient.Update` + +```go +ctx := context.TODO() +id := policies.NewPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "policySetValue", "policyValue") + +payload := policies.UpdateResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/client.go new file mode 100644 index 000000000000..6addaf7d1b18 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/client.go @@ -0,0 +1,18 @@ +package policies + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoliciesClient struct { + Client autorest.Client + baseUri string +} + +func NewPoliciesClientWithBaseURI(endpoint string) PoliciesClient { + return PoliciesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/constants.go new file mode 100644 index 000000000000..1d81e9d81a7c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/constants.go @@ -0,0 +1,114 @@ +package policies + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyEvaluatorType string + +const ( + PolicyEvaluatorTypeAllowedValuesPolicy PolicyEvaluatorType = "AllowedValuesPolicy" + PolicyEvaluatorTypeMaxValuePolicy PolicyEvaluatorType = "MaxValuePolicy" +) + +func PossibleValuesForPolicyEvaluatorType() []string { + return []string{ + string(PolicyEvaluatorTypeAllowedValuesPolicy), + string(PolicyEvaluatorTypeMaxValuePolicy), + } +} + +func parsePolicyEvaluatorType(input string) (*PolicyEvaluatorType, error) { + vals := map[string]PolicyEvaluatorType{ + "allowedvaluespolicy": PolicyEvaluatorTypeAllowedValuesPolicy, + "maxvaluepolicy": PolicyEvaluatorTypeMaxValuePolicy, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyEvaluatorType(input) + return &out, nil +} + +type PolicyFactName string + +const ( + PolicyFactNameEnvironmentTemplate PolicyFactName = "EnvironmentTemplate" + PolicyFactNameGalleryImage PolicyFactName = "GalleryImage" + PolicyFactNameLabPremiumVMCount PolicyFactName = "LabPremiumVmCount" + PolicyFactNameLabTargetCost PolicyFactName = "LabTargetCost" + PolicyFactNameLabVMCount PolicyFactName = "LabVmCount" + PolicyFactNameLabVMSize PolicyFactName = "LabVmSize" + PolicyFactNameScheduleEditPermission PolicyFactName = "ScheduleEditPermission" + PolicyFactNameUserOwnedLabPremiumVMCount PolicyFactName = "UserOwnedLabPremiumVmCount" + PolicyFactNameUserOwnedLabVMCount PolicyFactName = "UserOwnedLabVmCount" + PolicyFactNameUserOwnedLabVMCountInSubnet PolicyFactName = "UserOwnedLabVmCountInSubnet" +) + +func PossibleValuesForPolicyFactName() []string { + return []string{ + string(PolicyFactNameEnvironmentTemplate), + string(PolicyFactNameGalleryImage), + string(PolicyFactNameLabPremiumVMCount), + string(PolicyFactNameLabTargetCost), + string(PolicyFactNameLabVMCount), + string(PolicyFactNameLabVMSize), + string(PolicyFactNameScheduleEditPermission), + string(PolicyFactNameUserOwnedLabPremiumVMCount), + string(PolicyFactNameUserOwnedLabVMCount), + string(PolicyFactNameUserOwnedLabVMCountInSubnet), + } +} + +func parsePolicyFactName(input string) (*PolicyFactName, error) { + vals := map[string]PolicyFactName{ + "environmenttemplate": PolicyFactNameEnvironmentTemplate, + "galleryimage": PolicyFactNameGalleryImage, + "labpremiumvmcount": PolicyFactNameLabPremiumVMCount, + "labtargetcost": PolicyFactNameLabTargetCost, + "labvmcount": PolicyFactNameLabVMCount, + "labvmsize": PolicyFactNameLabVMSize, + "scheduleeditpermission": PolicyFactNameScheduleEditPermission, + "userownedlabpremiumvmcount": PolicyFactNameUserOwnedLabPremiumVMCount, + "userownedlabvmcount": PolicyFactNameUserOwnedLabVMCount, + "userownedlabvmcountinsubnet": PolicyFactNameUserOwnedLabVMCountInSubnet, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyFactName(input) + return &out, nil +} + +type PolicyStatus string + +const ( + PolicyStatusDisabled PolicyStatus = "Disabled" + PolicyStatusEnabled PolicyStatus = "Enabled" +) + +func PossibleValuesForPolicyStatus() []string { + return []string{ + string(PolicyStatusDisabled), + string(PolicyStatusEnabled), + } +} + +func parsePolicyStatus(input string) (*PolicyStatus, error) { + vals := map[string]PolicyStatus{ + "disabled": PolicyStatusDisabled, + "enabled": PolicyStatusEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyStatus(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/id_policy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/id_policy.go new file mode 100644 index 000000000000..72209f0023f7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/id_policy.go @@ -0,0 +1,150 @@ +package policies + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PolicyId{} + +// PolicyId is a struct representing the Resource ID for a Policy +type PolicyId struct { + SubscriptionId string + ResourceGroupName string + LabName string + PolicySetName string + PolicyName string +} + +// NewPolicyID returns a new PolicyId struct +func NewPolicyID(subscriptionId string, resourceGroupName string, labName string, policySetName string, policyName string) PolicyId { + return PolicyId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + LabName: labName, + PolicySetName: policySetName, + PolicyName: policyName, + } +} + +// ParsePolicyID parses 'input' into a PolicyId +func ParsePolicyID(input string) (*PolicyId, error) { + parser := resourceids.NewParserFromResourceIdType(PolicyId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PolicyId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + if id.PolicySetName, ok = parsed.Parsed["policySetName"]; !ok { + return nil, fmt.Errorf("the segment 'policySetName' was not found in the resource id %q", input) + } + + if id.PolicyName, ok = parsed.Parsed["policyName"]; !ok { + return nil, fmt.Errorf("the segment 'policyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePolicyIDInsensitively parses 'input' case-insensitively into a PolicyId +// note: this method should only be used for API response data and not user input +func ParsePolicyIDInsensitively(input string) (*PolicyId, error) { + parser := resourceids.NewParserFromResourceIdType(PolicyId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PolicyId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + if id.PolicySetName, ok = parsed.Parsed["policySetName"]; !ok { + return nil, fmt.Errorf("the segment 'policySetName' was not found in the resource id %q", input) + } + + if id.PolicyName, ok = parsed.Parsed["policyName"]; !ok { + return nil, fmt.Errorf("the segment 'policyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePolicyID checks that 'input' can be parsed as a Policy ID +func ValidatePolicyID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePolicyID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Policy ID +func (id PolicyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s/policySets/%s/policies/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.LabName, id.PolicySetName, id.PolicyName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Policy ID +func (id PolicyId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDevTestLab", "Microsoft.DevTestLab", "Microsoft.DevTestLab"), + resourceids.StaticSegment("staticLabs", "labs", "labs"), + resourceids.UserSpecifiedSegment("labName", "labValue"), + resourceids.StaticSegment("staticPolicySets", "policySets", "policySets"), + resourceids.UserSpecifiedSegment("policySetName", "policySetValue"), + resourceids.StaticSegment("staticPolicies", "policies", "policies"), + resourceids.UserSpecifiedSegment("policyName", "policyValue"), + } +} + +// String returns a human-readable description of this Policy ID +func (id PolicyId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Lab Name: %q", id.LabName), + fmt.Sprintf("Policy Set Name: %q", id.PolicySetName), + fmt.Sprintf("Policy Name: %q", id.PolicyName), + } + return fmt.Sprintf("Policy (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/id_policyset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/id_policyset.go new file mode 100644 index 000000000000..b95563b061c2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/id_policyset.go @@ -0,0 +1,137 @@ +package policies + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PolicySetId{} + +// PolicySetId is a struct representing the Resource ID for a Policy Set +type PolicySetId struct { + SubscriptionId string + ResourceGroupName string + LabName string + PolicySetName string +} + +// NewPolicySetID returns a new PolicySetId struct +func NewPolicySetID(subscriptionId string, resourceGroupName string, labName string, policySetName string) PolicySetId { + return PolicySetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + LabName: labName, + PolicySetName: policySetName, + } +} + +// ParsePolicySetID parses 'input' into a PolicySetId +func ParsePolicySetID(input string) (*PolicySetId, error) { + parser := resourceids.NewParserFromResourceIdType(PolicySetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PolicySetId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + if id.PolicySetName, ok = parsed.Parsed["policySetName"]; !ok { + return nil, fmt.Errorf("the segment 'policySetName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePolicySetIDInsensitively parses 'input' case-insensitively into a PolicySetId +// note: this method should only be used for API response data and not user input +func ParsePolicySetIDInsensitively(input string) (*PolicySetId, error) { + parser := resourceids.NewParserFromResourceIdType(PolicySetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PolicySetId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + if id.PolicySetName, ok = parsed.Parsed["policySetName"]; !ok { + return nil, fmt.Errorf("the segment 'policySetName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePolicySetID checks that 'input' can be parsed as a Policy Set ID +func ValidatePolicySetID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePolicySetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Policy Set ID +func (id PolicySetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s/policySets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.LabName, id.PolicySetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Policy Set ID +func (id PolicySetId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDevTestLab", "Microsoft.DevTestLab", "Microsoft.DevTestLab"), + resourceids.StaticSegment("staticLabs", "labs", "labs"), + resourceids.UserSpecifiedSegment("labName", "labValue"), + resourceids.StaticSegment("staticPolicySets", "policySets", "policySets"), + resourceids.UserSpecifiedSegment("policySetName", "policySetValue"), + } +} + +// String returns a human-readable description of this Policy Set ID +func (id PolicySetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Lab Name: %q", id.LabName), + fmt.Sprintf("Policy Set Name: %q", id.PolicySetName), + } + return fmt.Sprintf("Policy Set (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/method_createorupdate_autorest.go new file mode 100644 index 000000000000..efec1c25e103 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package policies + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Policy +} + +// CreateOrUpdate ... +func (c PoliciesClient) CreateOrUpdate(ctx context.Context, id PolicyId, input Policy) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c PoliciesClient) preparerForCreateOrUpdate(ctx context.Context, id PolicyId, input Policy) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c PoliciesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/method_delete_autorest.go new file mode 100644 index 000000000000..486b7f02e35a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/method_delete_autorest.go @@ -0,0 +1,66 @@ +package policies + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c PoliciesClient) Delete(ctx context.Context, id PolicyId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c PoliciesClient) preparerForDelete(ctx context.Context, id PolicyId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c PoliciesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/method_get_autorest.go new file mode 100644 index 000000000000..fb63a353ad70 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/method_get_autorest.go @@ -0,0 +1,97 @@ +package policies + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Policy +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// Get ... +func (c PoliciesClient) Get(ctx context.Context, id PolicyId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c PoliciesClient) preparerForGet(ctx context.Context, id PolicyId, options GetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c PoliciesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/method_list_autorest.go new file mode 100644 index 000000000000..89116204fcd0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/method_list_autorest.go @@ -0,0 +1,230 @@ +package policies + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Policy + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Policy +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Expand *string + Filter *string + Orderby *string + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Orderby != nil { + out["$orderby"] = *o.Orderby + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c PoliciesClient) List(ctx context.Context, id PolicySetId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c PoliciesClient) preparerForList(ctx context.Context, id PolicySetId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/policies", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c PoliciesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c PoliciesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Policy `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c PoliciesClient) ListComplete(ctx context.Context, id PolicySetId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, PolicyOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PoliciesClient) ListCompleteMatchingPredicate(ctx context.Context, id PolicySetId, options ListOperationOptions, predicate PolicyOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Policy, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/method_update_autorest.go new file mode 100644 index 000000000000..c178e9b1b8af --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/method_update_autorest.go @@ -0,0 +1,69 @@ +package policies + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Policy +} + +// Update ... +func (c PoliciesClient) Update(ctx context.Context, id PolicyId, input UpdateResource) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "policies.PoliciesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c PoliciesClient) preparerForUpdate(ctx context.Context, id PolicyId, input UpdateResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c PoliciesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/model_policy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/model_policy.go new file mode 100644 index 000000000000..91132ec17ac7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/model_policy.go @@ -0,0 +1,13 @@ +package policies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Policy struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties PolicyProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/model_policyproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/model_policyproperties.go new file mode 100644 index 000000000000..94eeb77914b4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/model_policyproperties.go @@ -0,0 +1,34 @@ +package policies + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyProperties struct { + CreatedDate *string `json:"createdDate,omitempty"` + Description *string `json:"description,omitempty"` + EvaluatorType *PolicyEvaluatorType `json:"evaluatorType,omitempty"` + FactData *string `json:"factData,omitempty"` + FactName *PolicyFactName `json:"factName,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Status *PolicyStatus `json:"status,omitempty"` + Threshold *string `json:"threshold,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +func (o *PolicyProperties) GetCreatedDateAsTime() (*time.Time, error) { + if o.CreatedDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *PolicyProperties) SetCreatedDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/model_updateresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/model_updateresource.go new file mode 100644 index 000000000000..f362d9f324df --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/model_updateresource.go @@ -0,0 +1,8 @@ +package policies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateResource struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/predicates.go new file mode 100644 index 000000000000..de095ed6199b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/predicates.go @@ -0,0 +1,29 @@ +package policies + +type PolicyOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p PolicyOperationPredicate) Matches(input Policy) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/version.go new file mode 100644 index 000000000000..202eae233936 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies/version.go @@ -0,0 +1,12 @@ +package policies + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-09-15" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/policies/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/README.md new file mode 100644 index 000000000000..19e566dfb4ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/README.md @@ -0,0 +1,140 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules` Documentation + +The `schedules` SDK allows for interaction with the Azure Resource Manager Service `devtestlab` (API Version `2018-09-15`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules" +``` + + +### Client Initialization + +```go +client := schedules.NewSchedulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SchedulesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := schedules.NewLabScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "scheduleValue") + +payload := schedules.Schedule{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SchedulesClient.Delete` + +```go +ctx := context.TODO() +id := schedules.NewLabScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "scheduleValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SchedulesClient.Execute` + +```go +ctx := context.TODO() +id := schedules.NewLabScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "scheduleValue") + +if err := client.ExecuteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SchedulesClient.Get` + +```go +ctx := context.TODO() +id := schedules.NewLabScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "scheduleValue") + +read, err := client.Get(ctx, id, schedules.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SchedulesClient.List` + +```go +ctx := context.TODO() +id := schedules.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue") + +// alternatively `client.List(ctx, id, schedules.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, schedules.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SchedulesClient.ListApplicable` + +```go +ctx := context.TODO() +id := schedules.NewLabScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "scheduleValue") + +// alternatively `client.ListApplicable(ctx, id)` can be used to do batched pagination +items, err := client.ListApplicableComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SchedulesClient.Update` + +```go +ctx := context.TODO() +id := schedules.NewLabScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "scheduleValue") + +payload := schedules.UpdateResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/client.go new file mode 100644 index 000000000000..ccdff379ab7a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/client.go @@ -0,0 +1,18 @@ +package schedules + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchedulesClient struct { + Client autorest.Client + baseUri string +} + +func NewSchedulesClientWithBaseURI(endpoint string) SchedulesClient { + return SchedulesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/constants.go new file mode 100644 index 000000000000..310e768a9396 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/constants.go @@ -0,0 +1,34 @@ +package schedules + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnableStatus string + +const ( + EnableStatusDisabled EnableStatus = "Disabled" + EnableStatusEnabled EnableStatus = "Enabled" +) + +func PossibleValuesForEnableStatus() []string { + return []string{ + string(EnableStatusDisabled), + string(EnableStatusEnabled), + } +} + +func parseEnableStatus(input string) (*EnableStatus, error) { + vals := map[string]EnableStatus{ + "disabled": EnableStatusDisabled, + "enabled": EnableStatusEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnableStatus(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/id_lab.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/id_lab.go new file mode 100644 index 000000000000..d118f2a5a928 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/id_lab.go @@ -0,0 +1,124 @@ +package schedules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LabId{} + +// LabId is a struct representing the Resource ID for a Lab +type LabId struct { + SubscriptionId string + ResourceGroupName string + LabName string +} + +// NewLabID returns a new LabId struct +func NewLabID(subscriptionId string, resourceGroupName string, labName string) LabId { + return LabId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + LabName: labName, + } +} + +// ParseLabID parses 'input' into a LabId +func ParseLabID(input string) (*LabId, error) { + parser := resourceids.NewParserFromResourceIdType(LabId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LabId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLabIDInsensitively parses 'input' case-insensitively into a LabId +// note: this method should only be used for API response data and not user input +func ParseLabIDInsensitively(input string) (*LabId, error) { + parser := resourceids.NewParserFromResourceIdType(LabId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LabId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLabID checks that 'input' can be parsed as a Lab ID +func ValidateLabID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLabID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Lab ID +func (id LabId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.LabName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Lab ID +func (id LabId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDevTestLab", "Microsoft.DevTestLab", "Microsoft.DevTestLab"), + resourceids.StaticSegment("staticLabs", "labs", "labs"), + resourceids.UserSpecifiedSegment("labName", "labValue"), + } +} + +// String returns a human-readable description of this Lab ID +func (id LabId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Lab Name: %q", id.LabName), + } + return fmt.Sprintf("Lab (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/id_labschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/id_labschedule.go new file mode 100644 index 000000000000..3b8870946451 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/id_labschedule.go @@ -0,0 +1,137 @@ +package schedules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LabScheduleId{} + +// LabScheduleId is a struct representing the Resource ID for a Lab Schedule +type LabScheduleId struct { + SubscriptionId string + ResourceGroupName string + LabName string + ScheduleName string +} + +// NewLabScheduleID returns a new LabScheduleId struct +func NewLabScheduleID(subscriptionId string, resourceGroupName string, labName string, scheduleName string) LabScheduleId { + return LabScheduleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + LabName: labName, + ScheduleName: scheduleName, + } +} + +// ParseLabScheduleID parses 'input' into a LabScheduleId +func ParseLabScheduleID(input string) (*LabScheduleId, error) { + parser := resourceids.NewParserFromResourceIdType(LabScheduleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LabScheduleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { + return nil, fmt.Errorf("the segment 'scheduleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLabScheduleIDInsensitively parses 'input' case-insensitively into a LabScheduleId +// note: this method should only be used for API response data and not user input +func ParseLabScheduleIDInsensitively(input string) (*LabScheduleId, error) { + parser := resourceids.NewParserFromResourceIdType(LabScheduleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LabScheduleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { + return nil, fmt.Errorf("the segment 'scheduleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLabScheduleID checks that 'input' can be parsed as a Lab Schedule ID +func ValidateLabScheduleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLabScheduleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Lab Schedule ID +func (id LabScheduleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s/schedules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.LabName, id.ScheduleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Lab Schedule ID +func (id LabScheduleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDevTestLab", "Microsoft.DevTestLab", "Microsoft.DevTestLab"), + resourceids.StaticSegment("staticLabs", "labs", "labs"), + resourceids.UserSpecifiedSegment("labName", "labValue"), + resourceids.StaticSegment("staticSchedules", "schedules", "schedules"), + resourceids.UserSpecifiedSegment("scheduleName", "scheduleValue"), + } +} + +// String returns a human-readable description of this Lab Schedule ID +func (id LabScheduleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Lab Name: %q", id.LabName), + fmt.Sprintf("Schedule Name: %q", id.ScheduleName), + } + return fmt.Sprintf("Lab Schedule (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_createorupdate_autorest.go new file mode 100644 index 000000000000..dfa0231d65d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package schedules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Schedule +} + +// CreateOrUpdate ... +func (c SchedulesClient) CreateOrUpdate(ctx context.Context, id LabScheduleId, input Schedule) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c SchedulesClient) preparerForCreateOrUpdate(ctx context.Context, id LabScheduleId, input Schedule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c SchedulesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_delete_autorest.go new file mode 100644 index 000000000000..3620b2d7c6c8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_delete_autorest.go @@ -0,0 +1,66 @@ +package schedules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c SchedulesClient) Delete(ctx context.Context, id LabScheduleId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c SchedulesClient) preparerForDelete(ctx context.Context, id LabScheduleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c SchedulesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_execute_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_execute_autorest.go new file mode 100644 index 000000000000..515e1b11a9c9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_execute_autorest.go @@ -0,0 +1,78 @@ +package schedules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExecuteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Execute ... +func (c SchedulesClient) Execute(ctx context.Context, id LabScheduleId) (result ExecuteOperationResponse, err error) { + req, err := c.preparerForExecute(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "Execute", nil, "Failure preparing request") + return + } + + result, err = c.senderForExecute(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "Execute", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ExecuteThenPoll performs Execute then polls until it's completed +func (c SchedulesClient) ExecuteThenPoll(ctx context.Context, id LabScheduleId) error { + result, err := c.Execute(ctx, id) + if err != nil { + return fmt.Errorf("performing Execute: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Execute: %+v", err) + } + + return nil +} + +// preparerForExecute prepares the Execute request. +func (c SchedulesClient) preparerForExecute(ctx context.Context, id LabScheduleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/execute", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForExecute sends the Execute request. The method will close the +// http.Response Body if it receives an error. +func (c SchedulesClient) senderForExecute(ctx context.Context, req *http.Request) (future ExecuteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_get_autorest.go new file mode 100644 index 000000000000..e4d5a62dfbbd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_get_autorest.go @@ -0,0 +1,97 @@ +package schedules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Schedule +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// Get ... +func (c SchedulesClient) Get(ctx context.Context, id LabScheduleId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c SchedulesClient) preparerForGet(ctx context.Context, id LabScheduleId, options GetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c SchedulesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_list_autorest.go new file mode 100644 index 000000000000..4c64d5746b85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_list_autorest.go @@ -0,0 +1,230 @@ +package schedules + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Schedule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Schedule +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Expand *string + Filter *string + Orderby *string + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Orderby != nil { + out["$orderby"] = *o.Orderby + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c SchedulesClient) List(ctx context.Context, id LabId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c SchedulesClient) preparerForList(ctx context.Context, id LabId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/schedules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c SchedulesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c SchedulesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Schedule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c SchedulesClient) ListComplete(ctx context.Context, id LabId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, ScheduleOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SchedulesClient) ListCompleteMatchingPredicate(ctx context.Context, id LabId, options ListOperationOptions, predicate ScheduleOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Schedule, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_listapplicable_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_listapplicable_autorest.go new file mode 100644 index 000000000000..a02fb6057737 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_listapplicable_autorest.go @@ -0,0 +1,186 @@ +package schedules + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListApplicableOperationResponse struct { + HttpResponse *http.Response + Model *[]Schedule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListApplicableOperationResponse, error) +} + +type ListApplicableCompleteResult struct { + Items []Schedule +} + +func (r ListApplicableOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListApplicableOperationResponse) LoadMore(ctx context.Context) (resp ListApplicableOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListApplicable ... +func (c SchedulesClient) ListApplicable(ctx context.Context, id LabScheduleId) (resp ListApplicableOperationResponse, err error) { + req, err := c.preparerForListApplicable(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "ListApplicable", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "ListApplicable", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListApplicable(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "ListApplicable", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListApplicable prepares the ListApplicable request. +func (c SchedulesClient) preparerForListApplicable(ctx context.Context, id LabScheduleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listApplicable", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListApplicableWithNextLink prepares the ListApplicable request with the given nextLink token. +func (c SchedulesClient) preparerForListApplicableWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListApplicable handles the response to the ListApplicable request. The method always +// closes the http.Response Body. +func (c SchedulesClient) responderForListApplicable(resp *http.Response) (result ListApplicableOperationResponse, err error) { + type page struct { + Values []Schedule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListApplicableOperationResponse, err error) { + req, err := c.preparerForListApplicableWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "ListApplicable", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "ListApplicable", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListApplicable(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "ListApplicable", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListApplicableComplete retrieves all of the results into a single object +func (c SchedulesClient) ListApplicableComplete(ctx context.Context, id LabScheduleId) (ListApplicableCompleteResult, error) { + return c.ListApplicableCompleteMatchingPredicate(ctx, id, ScheduleOperationPredicate{}) +} + +// ListApplicableCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SchedulesClient) ListApplicableCompleteMatchingPredicate(ctx context.Context, id LabScheduleId, predicate ScheduleOperationPredicate) (resp ListApplicableCompleteResult, err error) { + items := make([]Schedule, 0) + + page, err := c.ListApplicable(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListApplicableCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_update_autorest.go new file mode 100644 index 000000000000..ffb32a33ab1a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/method_update_autorest.go @@ -0,0 +1,69 @@ +package schedules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Schedule +} + +// Update ... +func (c SchedulesClient) Update(ctx context.Context, id LabScheduleId, input UpdateResource) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schedules.SchedulesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c SchedulesClient) preparerForUpdate(ctx context.Context, id LabScheduleId, input UpdateResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c SchedulesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_daydetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_daydetails.go new file mode 100644 index 000000000000..1011ab5956a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_daydetails.go @@ -0,0 +1,8 @@ +package schedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DayDetails struct { + Time *string `json:"time,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_hourdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_hourdetails.go new file mode 100644 index 000000000000..373693d1feea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_hourdetails.go @@ -0,0 +1,8 @@ +package schedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HourDetails struct { + Minute *int64 `json:"minute,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_notificationsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_notificationsettings.go new file mode 100644 index 000000000000..7f7a26ac7047 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_notificationsettings.go @@ -0,0 +1,12 @@ +package schedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationSettings struct { + EmailRecipient *string `json:"emailRecipient,omitempty"` + NotificationLocale *string `json:"notificationLocale,omitempty"` + Status *EnableStatus `json:"status,omitempty"` + TimeInMinutes *int64 `json:"timeInMinutes,omitempty"` + WebhookUrl *string `json:"webhookUrl,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_schedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_schedule.go new file mode 100644 index 000000000000..e67b57fdb817 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_schedule.go @@ -0,0 +1,13 @@ +package schedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Schedule struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ScheduleProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_scheduleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_scheduleproperties.go new file mode 100644 index 000000000000..0671bd44eb5b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_scheduleproperties.go @@ -0,0 +1,36 @@ +package schedules + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleProperties struct { + CreatedDate *string `json:"createdDate,omitempty"` + DailyRecurrence *DayDetails `json:"dailyRecurrence,omitempty"` + HourlyRecurrence *HourDetails `json:"hourlyRecurrence,omitempty"` + NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Status *EnableStatus `json:"status,omitempty"` + TargetResourceId *string `json:"targetResourceId,omitempty"` + TaskType *string `json:"taskType,omitempty"` + TimeZoneId *string `json:"timeZoneId,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` + WeeklyRecurrence *WeekDetails `json:"weeklyRecurrence,omitempty"` +} + +func (o *ScheduleProperties) GetCreatedDateAsTime() (*time.Time, error) { + if o.CreatedDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ScheduleProperties) SetCreatedDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_updateresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_updateresource.go new file mode 100644 index 000000000000..460a7a004ab2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_updateresource.go @@ -0,0 +1,8 @@ +package schedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateResource struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_weekdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_weekdetails.go new file mode 100644 index 000000000000..c1fb5091a8e3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/model_weekdetails.go @@ -0,0 +1,9 @@ +package schedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WeekDetails struct { + Time *string `json:"time,omitempty"` + Weekdays *[]string `json:"weekdays,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/predicates.go new file mode 100644 index 000000000000..57811f5a85fc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/predicates.go @@ -0,0 +1,29 @@ +package schedules + +type ScheduleOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ScheduleOperationPredicate) Matches(input Schedule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/version.go new file mode 100644 index 000000000000..1455add5ff96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules/version.go @@ -0,0 +1,12 @@ +package schedules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-09-15" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/schedules/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/README.md new file mode 100644 index 000000000000..de49926dd036 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/README.md @@ -0,0 +1,287 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines` Documentation + +The `virtualmachines` SDK allows for interaction with the Azure Resource Manager Service `devtestlab` (API Version `2018-09-15`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines" +``` + + +### Client Initialization + +```go +client := virtualmachines.NewVirtualMachinesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachinesClient.AddDataDisk` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +payload := virtualmachines.DataDiskProperties{ + // ... +} + + +if err := client.AddDataDiskThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.ApplyArtifacts` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +payload := virtualmachines.ApplyArtifactsRequest{ + // ... +} + + +if err := client.ApplyArtifactsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Claim` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +if err := client.ClaimThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +payload := virtualmachines.LabVirtualMachine{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.DetachDataDisk` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +payload := virtualmachines.DetachDataDiskProperties{ + // ... +} + + +if err := client.DetachDataDiskThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Get` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +read, err := client.Get(ctx, id, virtualmachines.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachinesClient.GetRdpFileContents` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +read, err := client.GetRdpFileContents(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachinesClient.List` + +```go +ctx := context.TODO() +id := virtualmachines.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue") + +// alternatively `client.List(ctx, id, virtualmachines.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, virtualmachines.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachinesClient.ListApplicableSchedules` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +read, err := client.ListApplicableSchedules(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachinesClient.Redeploy` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +if err := client.RedeployThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Resize` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +payload := virtualmachines.ResizeLabVirtualMachineProperties{ + // ... +} + + +if err := client.ResizeThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Restart` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +if err := client.RestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Start` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +if err := client.StartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Stop` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +if err := client.StopThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.TransferDisks` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +if err := client.TransferDisksThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.UnClaim` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +if err := client.UnClaimThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Update` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualMachineValue") + +payload := virtualmachines.UpdateResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/client.go new file mode 100644 index 000000000000..2ddc768cf5d0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/client.go @@ -0,0 +1,18 @@ +package virtualmachines + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinesClient struct { + Client autorest.Client + baseUri string +} + +func NewVirtualMachinesClientWithBaseURI(endpoint string) VirtualMachinesClient { + return VirtualMachinesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/constants.go new file mode 100644 index 000000000000..0c6b7a4afdf9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/constants.go @@ -0,0 +1,155 @@ +package virtualmachines + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnableStatus string + +const ( + EnableStatusDisabled EnableStatus = "Disabled" + EnableStatusEnabled EnableStatus = "Enabled" +) + +func PossibleValuesForEnableStatus() []string { + return []string{ + string(EnableStatusDisabled), + string(EnableStatusEnabled), + } +} + +func parseEnableStatus(input string) (*EnableStatus, error) { + vals := map[string]EnableStatus{ + "disabled": EnableStatusDisabled, + "enabled": EnableStatusEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnableStatus(input) + return &out, nil +} + +type HostCachingOptions string + +const ( + HostCachingOptionsNone HostCachingOptions = "None" + HostCachingOptionsReadOnly HostCachingOptions = "ReadOnly" + HostCachingOptionsReadWrite HostCachingOptions = "ReadWrite" +) + +func PossibleValuesForHostCachingOptions() []string { + return []string{ + string(HostCachingOptionsNone), + string(HostCachingOptionsReadOnly), + string(HostCachingOptionsReadWrite), + } +} + +func parseHostCachingOptions(input string) (*HostCachingOptions, error) { + vals := map[string]HostCachingOptions{ + "none": HostCachingOptionsNone, + "readonly": HostCachingOptionsReadOnly, + "readwrite": HostCachingOptionsReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HostCachingOptions(input) + return &out, nil +} + +type StorageType string + +const ( + StorageTypePremium StorageType = "Premium" + StorageTypeStandard StorageType = "Standard" + StorageTypeStandardSSD StorageType = "StandardSSD" +) + +func PossibleValuesForStorageType() []string { + return []string{ + string(StorageTypePremium), + string(StorageTypeStandard), + string(StorageTypeStandardSSD), + } +} + +func parseStorageType(input string) (*StorageType, error) { + vals := map[string]StorageType{ + "premium": StorageTypePremium, + "standard": StorageTypeStandard, + "standardssd": StorageTypeStandardSSD, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageType(input) + return &out, nil +} + +type TransportProtocol string + +const ( + TransportProtocolTcp TransportProtocol = "Tcp" + TransportProtocolUdp TransportProtocol = "Udp" +) + +func PossibleValuesForTransportProtocol() []string { + return []string{ + string(TransportProtocolTcp), + string(TransportProtocolUdp), + } +} + +func parseTransportProtocol(input string) (*TransportProtocol, error) { + vals := map[string]TransportProtocol{ + "tcp": TransportProtocolTcp, + "udp": TransportProtocolUdp, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TransportProtocol(input) + return &out, nil +} + +type VirtualMachineCreationSource string + +const ( + VirtualMachineCreationSourceFromCustomImage VirtualMachineCreationSource = "FromCustomImage" + VirtualMachineCreationSourceFromGalleryImage VirtualMachineCreationSource = "FromGalleryImage" + VirtualMachineCreationSourceFromSharedGalleryImage VirtualMachineCreationSource = "FromSharedGalleryImage" +) + +func PossibleValuesForVirtualMachineCreationSource() []string { + return []string{ + string(VirtualMachineCreationSourceFromCustomImage), + string(VirtualMachineCreationSourceFromGalleryImage), + string(VirtualMachineCreationSourceFromSharedGalleryImage), + } +} + +func parseVirtualMachineCreationSource(input string) (*VirtualMachineCreationSource, error) { + vals := map[string]VirtualMachineCreationSource{ + "fromcustomimage": VirtualMachineCreationSourceFromCustomImage, + "fromgalleryimage": VirtualMachineCreationSourceFromGalleryImage, + "fromsharedgalleryimage": VirtualMachineCreationSourceFromSharedGalleryImage, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineCreationSource(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/id_lab.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/id_lab.go new file mode 100644 index 000000000000..920edc08e750 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/id_lab.go @@ -0,0 +1,124 @@ +package virtualmachines + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LabId{} + +// LabId is a struct representing the Resource ID for a Lab +type LabId struct { + SubscriptionId string + ResourceGroupName string + LabName string +} + +// NewLabID returns a new LabId struct +func NewLabID(subscriptionId string, resourceGroupName string, labName string) LabId { + return LabId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + LabName: labName, + } +} + +// ParseLabID parses 'input' into a LabId +func ParseLabID(input string) (*LabId, error) { + parser := resourceids.NewParserFromResourceIdType(LabId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LabId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLabIDInsensitively parses 'input' case-insensitively into a LabId +// note: this method should only be used for API response data and not user input +func ParseLabIDInsensitively(input string) (*LabId, error) { + parser := resourceids.NewParserFromResourceIdType(LabId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LabId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLabID checks that 'input' can be parsed as a Lab ID +func ValidateLabID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLabID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Lab ID +func (id LabId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.LabName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Lab ID +func (id LabId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDevTestLab", "Microsoft.DevTestLab", "Microsoft.DevTestLab"), + resourceids.StaticSegment("staticLabs", "labs", "labs"), + resourceids.UserSpecifiedSegment("labName", "labValue"), + } +} + +// String returns a human-readable description of this Lab ID +func (id LabId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Lab Name: %q", id.LabName), + } + return fmt.Sprintf("Lab (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/id_virtualmachine.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/id_virtualmachine.go new file mode 100644 index 000000000000..5aa1ecc141b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/id_virtualmachine.go @@ -0,0 +1,137 @@ +package virtualmachines + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VirtualMachineId{} + +// VirtualMachineId is a struct representing the Resource ID for a Virtual Machine +type VirtualMachineId struct { + SubscriptionId string + ResourceGroupName string + LabName string + VirtualMachineName string +} + +// NewVirtualMachineID returns a new VirtualMachineId struct +func NewVirtualMachineID(subscriptionId string, resourceGroupName string, labName string, virtualMachineName string) VirtualMachineId { + return VirtualMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + LabName: labName, + VirtualMachineName: virtualMachineName, + } +} + +// ParseVirtualMachineID parses 'input' into a VirtualMachineId +func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualMachineId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualMachineName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVirtualMachineIDInsensitively parses 'input' case-insensitively into a VirtualMachineId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualMachineId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualMachineName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID +func ValidateVirtualMachineID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVirtualMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine ID +func (id VirtualMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s/virtualMachines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.LabName, id.VirtualMachineName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine ID +func (id VirtualMachineId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDevTestLab", "Microsoft.DevTestLab", "Microsoft.DevTestLab"), + resourceids.StaticSegment("staticLabs", "labs", "labs"), + resourceids.UserSpecifiedSegment("labName", "labValue"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineName", "virtualMachineValue"), + } +} + +// String returns a human-readable description of this Virtual Machine ID +func (id VirtualMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Lab Name: %q", id.LabName), + fmt.Sprintf("Virtual Machine Name: %q", id.VirtualMachineName), + } + return fmt.Sprintf("Virtual Machine (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_adddatadisk_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_adddatadisk_autorest.go new file mode 100644 index 000000000000..ba5f15667c7d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_adddatadisk_autorest.go @@ -0,0 +1,79 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AddDataDiskOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// AddDataDisk ... +func (c VirtualMachinesClient) AddDataDisk(ctx context.Context, id VirtualMachineId, input DataDiskProperties) (result AddDataDiskOperationResponse, err error) { + req, err := c.preparerForAddDataDisk(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "AddDataDisk", nil, "Failure preparing request") + return + } + + result, err = c.senderForAddDataDisk(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "AddDataDisk", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// AddDataDiskThenPoll performs AddDataDisk then polls until it's completed +func (c VirtualMachinesClient) AddDataDiskThenPoll(ctx context.Context, id VirtualMachineId, input DataDiskProperties) error { + result, err := c.AddDataDisk(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AddDataDisk: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after AddDataDisk: %+v", err) + } + + return nil +} + +// preparerForAddDataDisk prepares the AddDataDisk request. +func (c VirtualMachinesClient) preparerForAddDataDisk(ctx context.Context, id VirtualMachineId, input DataDiskProperties) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/addDataDisk", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForAddDataDisk sends the AddDataDisk request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualMachinesClient) senderForAddDataDisk(ctx context.Context, req *http.Request) (future AddDataDiskOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_applyartifacts_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_applyartifacts_autorest.go new file mode 100644 index 000000000000..cf93ee940808 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_applyartifacts_autorest.go @@ -0,0 +1,79 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplyArtifactsOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ApplyArtifacts ... +func (c VirtualMachinesClient) ApplyArtifacts(ctx context.Context, id VirtualMachineId, input ApplyArtifactsRequest) (result ApplyArtifactsOperationResponse, err error) { + req, err := c.preparerForApplyArtifacts(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "ApplyArtifacts", nil, "Failure preparing request") + return + } + + result, err = c.senderForApplyArtifacts(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "ApplyArtifacts", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ApplyArtifactsThenPoll performs ApplyArtifacts then polls until it's completed +func (c VirtualMachinesClient) ApplyArtifactsThenPoll(ctx context.Context, id VirtualMachineId, input ApplyArtifactsRequest) error { + result, err := c.ApplyArtifacts(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ApplyArtifacts: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ApplyArtifacts: %+v", err) + } + + return nil +} + +// preparerForApplyArtifacts prepares the ApplyArtifacts request. +func (c VirtualMachinesClient) preparerForApplyArtifacts(ctx context.Context, id VirtualMachineId, input ApplyArtifactsRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/applyArtifacts", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForApplyArtifacts sends the ApplyArtifacts request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualMachinesClient) senderForApplyArtifacts(ctx context.Context, req *http.Request) (future ApplyArtifactsOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_claim_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_claim_autorest.go new file mode 100644 index 000000000000..7ce12d94ad8d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_claim_autorest.go @@ -0,0 +1,78 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClaimOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Claim ... +func (c VirtualMachinesClient) Claim(ctx context.Context, id VirtualMachineId) (result ClaimOperationResponse, err error) { + req, err := c.preparerForClaim(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Claim", nil, "Failure preparing request") + return + } + + result, err = c.senderForClaim(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Claim", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ClaimThenPoll performs Claim then polls until it's completed +func (c VirtualMachinesClient) ClaimThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.Claim(ctx, id) + if err != nil { + return fmt.Errorf("performing Claim: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Claim: %+v", err) + } + + return nil +} + +// preparerForClaim prepares the Claim request. +func (c VirtualMachinesClient) preparerForClaim(ctx context.Context, id VirtualMachineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/claim", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForClaim sends the Claim request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualMachinesClient) senderForClaim(ctx context.Context, req *http.Request) (future ClaimOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_createorupdate_autorest.go new file mode 100644 index 000000000000..732576ed1d39 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c VirtualMachinesClient) CreateOrUpdate(ctx context.Context, id VirtualMachineId, input LabVirtualMachine) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VirtualMachinesClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualMachineId, input LabVirtualMachine) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c VirtualMachinesClient) preparerForCreateOrUpdate(ctx context.Context, id VirtualMachineId, input LabVirtualMachine) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualMachinesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_delete_autorest.go new file mode 100644 index 000000000000..b6e203a29492 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_delete_autorest.go @@ -0,0 +1,78 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c VirtualMachinesClient) Delete(ctx context.Context, id VirtualMachineId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualMachinesClient) DeleteThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c VirtualMachinesClient) preparerForDelete(ctx context.Context, id VirtualMachineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualMachinesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_detachdatadisk_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_detachdatadisk_autorest.go new file mode 100644 index 000000000000..b3556d05752c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_detachdatadisk_autorest.go @@ -0,0 +1,79 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DetachDataDiskOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DetachDataDisk ... +func (c VirtualMachinesClient) DetachDataDisk(ctx context.Context, id VirtualMachineId, input DetachDataDiskProperties) (result DetachDataDiskOperationResponse, err error) { + req, err := c.preparerForDetachDataDisk(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "DetachDataDisk", nil, "Failure preparing request") + return + } + + result, err = c.senderForDetachDataDisk(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "DetachDataDisk", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DetachDataDiskThenPoll performs DetachDataDisk then polls until it's completed +func (c VirtualMachinesClient) DetachDataDiskThenPoll(ctx context.Context, id VirtualMachineId, input DetachDataDiskProperties) error { + result, err := c.DetachDataDisk(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DetachDataDisk: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DetachDataDisk: %+v", err) + } + + return nil +} + +// preparerForDetachDataDisk prepares the DetachDataDisk request. +func (c VirtualMachinesClient) preparerForDetachDataDisk(ctx context.Context, id VirtualMachineId, input DetachDataDiskProperties) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/detachDataDisk", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDetachDataDisk sends the DetachDataDisk request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualMachinesClient) senderForDetachDataDisk(ctx context.Context, req *http.Request) (future DetachDataDiskOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_get_autorest.go new file mode 100644 index 000000000000..ca47ba9364af --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_get_autorest.go @@ -0,0 +1,97 @@ +package virtualmachines + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *LabVirtualMachine +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// Get ... +func (c VirtualMachinesClient) Get(ctx context.Context, id VirtualMachineId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c VirtualMachinesClient) preparerForGet(ctx context.Context, id VirtualMachineId, options GetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c VirtualMachinesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_getrdpfilecontents_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_getrdpfilecontents_autorest.go new file mode 100644 index 000000000000..913d892ddab4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_getrdpfilecontents_autorest.go @@ -0,0 +1,69 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetRdpFileContentsOperationResponse struct { + HttpResponse *http.Response + Model *RdpConnection +} + +// GetRdpFileContents ... +func (c VirtualMachinesClient) GetRdpFileContents(ctx context.Context, id VirtualMachineId) (result GetRdpFileContentsOperationResponse, err error) { + req, err := c.preparerForGetRdpFileContents(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "GetRdpFileContents", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "GetRdpFileContents", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetRdpFileContents(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "GetRdpFileContents", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetRdpFileContents prepares the GetRdpFileContents request. +func (c VirtualMachinesClient) preparerForGetRdpFileContents(ctx context.Context, id VirtualMachineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/getRdpFileContents", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetRdpFileContents handles the response to the GetRdpFileContents request. The method always +// closes the http.Response Body. +func (c VirtualMachinesClient) responderForGetRdpFileContents(resp *http.Response) (result GetRdpFileContentsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_list_autorest.go new file mode 100644 index 000000000000..228b8bc3bd2d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_list_autorest.go @@ -0,0 +1,230 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]LabVirtualMachine + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []LabVirtualMachine +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Expand *string + Filter *string + Orderby *string + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Orderby != nil { + out["$orderby"] = *o.Orderby + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c VirtualMachinesClient) List(ctx context.Context, id LabId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c VirtualMachinesClient) preparerForList(ctx context.Context, id LabId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/virtualMachines", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c VirtualMachinesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c VirtualMachinesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []LabVirtualMachine `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c VirtualMachinesClient) ListComplete(ctx context.Context, id LabId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, LabVirtualMachineOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c VirtualMachinesClient) ListCompleteMatchingPredicate(ctx context.Context, id LabId, options ListOperationOptions, predicate LabVirtualMachineOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]LabVirtualMachine, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_listapplicableschedules_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_listapplicableschedules_autorest.go new file mode 100644 index 000000000000..6a9378b5dba1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_listapplicableschedules_autorest.go @@ -0,0 +1,69 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListApplicableSchedulesOperationResponse struct { + HttpResponse *http.Response + Model *ApplicableSchedule +} + +// ListApplicableSchedules ... +func (c VirtualMachinesClient) ListApplicableSchedules(ctx context.Context, id VirtualMachineId) (result ListApplicableSchedulesOperationResponse, err error) { + req, err := c.preparerForListApplicableSchedules(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "ListApplicableSchedules", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "ListApplicableSchedules", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListApplicableSchedules(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "ListApplicableSchedules", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListApplicableSchedules prepares the ListApplicableSchedules request. +func (c VirtualMachinesClient) preparerForListApplicableSchedules(ctx context.Context, id VirtualMachineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listApplicableSchedules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListApplicableSchedules handles the response to the ListApplicableSchedules request. The method always +// closes the http.Response Body. +func (c VirtualMachinesClient) responderForListApplicableSchedules(resp *http.Response) (result ListApplicableSchedulesOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_redeploy_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_redeploy_autorest.go new file mode 100644 index 000000000000..e9b4f65613d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_redeploy_autorest.go @@ -0,0 +1,78 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedeployOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Redeploy ... +func (c VirtualMachinesClient) Redeploy(ctx context.Context, id VirtualMachineId) (result RedeployOperationResponse, err error) { + req, err := c.preparerForRedeploy(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Redeploy", nil, "Failure preparing request") + return + } + + result, err = c.senderForRedeploy(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Redeploy", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// RedeployThenPoll performs Redeploy then polls until it's completed +func (c VirtualMachinesClient) RedeployThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.Redeploy(ctx, id) + if err != nil { + return fmt.Errorf("performing Redeploy: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Redeploy: %+v", err) + } + + return nil +} + +// preparerForRedeploy prepares the Redeploy request. +func (c VirtualMachinesClient) preparerForRedeploy(ctx context.Context, id VirtualMachineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/redeploy", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForRedeploy sends the Redeploy request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualMachinesClient) senderForRedeploy(ctx context.Context, req *http.Request) (future RedeployOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_resize_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_resize_autorest.go new file mode 100644 index 000000000000..f4e7adea355c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_resize_autorest.go @@ -0,0 +1,79 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResizeOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Resize ... +func (c VirtualMachinesClient) Resize(ctx context.Context, id VirtualMachineId, input ResizeLabVirtualMachineProperties) (result ResizeOperationResponse, err error) { + req, err := c.preparerForResize(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Resize", nil, "Failure preparing request") + return + } + + result, err = c.senderForResize(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Resize", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ResizeThenPoll performs Resize then polls until it's completed +func (c VirtualMachinesClient) ResizeThenPoll(ctx context.Context, id VirtualMachineId, input ResizeLabVirtualMachineProperties) error { + result, err := c.Resize(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Resize: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Resize: %+v", err) + } + + return nil +} + +// preparerForResize prepares the Resize request. +func (c VirtualMachinesClient) preparerForResize(ctx context.Context, id VirtualMachineId, input ResizeLabVirtualMachineProperties) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/resize", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForResize sends the Resize request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualMachinesClient) senderForResize(ctx context.Context, req *http.Request) (future ResizeOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_restart_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_restart_autorest.go new file mode 100644 index 000000000000..7079cdb212f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_restart_autorest.go @@ -0,0 +1,78 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestartOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Restart ... +func (c VirtualMachinesClient) Restart(ctx context.Context, id VirtualMachineId) (result RestartOperationResponse, err error) { + req, err := c.preparerForRestart(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Restart", nil, "Failure preparing request") + return + } + + result, err = c.senderForRestart(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Restart", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// RestartThenPoll performs Restart then polls until it's completed +func (c VirtualMachinesClient) RestartThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.Restart(ctx, id) + if err != nil { + return fmt.Errorf("performing Restart: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Restart: %+v", err) + } + + return nil +} + +// preparerForRestart prepares the Restart request. +func (c VirtualMachinesClient) preparerForRestart(ctx context.Context, id VirtualMachineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/restart", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForRestart sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualMachinesClient) senderForRestart(ctx context.Context, req *http.Request) (future RestartOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_start_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_start_autorest.go new file mode 100644 index 000000000000..51a690e51fe5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_start_autorest.go @@ -0,0 +1,78 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StartOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Start ... +func (c VirtualMachinesClient) Start(ctx context.Context, id VirtualMachineId) (result StartOperationResponse, err error) { + req, err := c.preparerForStart(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Start", nil, "Failure preparing request") + return + } + + result, err = c.senderForStart(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Start", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// StartThenPoll performs Start then polls until it's completed +func (c VirtualMachinesClient) StartThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.Start(ctx, id) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} + +// preparerForStart prepares the Start request. +func (c VirtualMachinesClient) preparerForStart(ctx context.Context, id VirtualMachineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/start", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForStart sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualMachinesClient) senderForStart(ctx context.Context, req *http.Request) (future StartOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_stop_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_stop_autorest.go new file mode 100644 index 000000000000..41aac4cadf6a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_stop_autorest.go @@ -0,0 +1,78 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Stop ... +func (c VirtualMachinesClient) Stop(ctx context.Context, id VirtualMachineId) (result StopOperationResponse, err error) { + req, err := c.preparerForStop(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = c.senderForStop(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Stop", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// StopThenPoll performs Stop then polls until it's completed +func (c VirtualMachinesClient) StopThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.Stop(ctx, id) + if err != nil { + return fmt.Errorf("performing Stop: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Stop: %+v", err) + } + + return nil +} + +// preparerForStop prepares the Stop request. +func (c VirtualMachinesClient) preparerForStop(ctx context.Context, id VirtualMachineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/stop", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForStop sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualMachinesClient) senderForStop(ctx context.Context, req *http.Request) (future StopOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_transferdisks_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_transferdisks_autorest.go new file mode 100644 index 000000000000..ca618135fe4d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_transferdisks_autorest.go @@ -0,0 +1,78 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TransferDisksOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// TransferDisks ... +func (c VirtualMachinesClient) TransferDisks(ctx context.Context, id VirtualMachineId) (result TransferDisksOperationResponse, err error) { + req, err := c.preparerForTransferDisks(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "TransferDisks", nil, "Failure preparing request") + return + } + + result, err = c.senderForTransferDisks(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "TransferDisks", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// TransferDisksThenPoll performs TransferDisks then polls until it's completed +func (c VirtualMachinesClient) TransferDisksThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.TransferDisks(ctx, id) + if err != nil { + return fmt.Errorf("performing TransferDisks: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after TransferDisks: %+v", err) + } + + return nil +} + +// preparerForTransferDisks prepares the TransferDisks request. +func (c VirtualMachinesClient) preparerForTransferDisks(ctx context.Context, id VirtualMachineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/transferDisks", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForTransferDisks sends the TransferDisks request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualMachinesClient) senderForTransferDisks(ctx context.Context, req *http.Request) (future TransferDisksOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_unclaim_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_unclaim_autorest.go new file mode 100644 index 000000000000..60546e7134e0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_unclaim_autorest.go @@ -0,0 +1,78 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UnClaimOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// UnClaim ... +func (c VirtualMachinesClient) UnClaim(ctx context.Context, id VirtualMachineId) (result UnClaimOperationResponse, err error) { + req, err := c.preparerForUnClaim(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "UnClaim", nil, "Failure preparing request") + return + } + + result, err = c.senderForUnClaim(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "UnClaim", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UnClaimThenPoll performs UnClaim then polls until it's completed +func (c VirtualMachinesClient) UnClaimThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.UnClaim(ctx, id) + if err != nil { + return fmt.Errorf("performing UnClaim: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after UnClaim: %+v", err) + } + + return nil +} + +// preparerForUnClaim prepares the UnClaim request. +func (c VirtualMachinesClient) preparerForUnClaim(ctx context.Context, id VirtualMachineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/unClaim", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUnClaim sends the UnClaim request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualMachinesClient) senderForUnClaim(ctx context.Context, req *http.Request) (future UnClaimOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_update_autorest.go new file mode 100644 index 000000000000..1681495c3e3a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/method_update_autorest.go @@ -0,0 +1,69 @@ +package virtualmachines + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *LabVirtualMachine +} + +// Update ... +func (c VirtualMachinesClient) Update(ctx context.Context, id VirtualMachineId, input UpdateResource) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachines.VirtualMachinesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c VirtualMachinesClient) preparerForUpdate(ctx context.Context, id VirtualMachineId, input UpdateResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c VirtualMachinesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_applicableschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_applicableschedule.go new file mode 100644 index 000000000000..01cd186db7f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_applicableschedule.go @@ -0,0 +1,13 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicableSchedule struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ApplicableScheduleProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_applicablescheduleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_applicablescheduleproperties.go new file mode 100644 index 000000000000..6419365e93f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_applicablescheduleproperties.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicableScheduleProperties struct { + LabVMsShutdown *Schedule `json:"labVmsShutdown,omitempty"` + LabVMsStartup *Schedule `json:"labVmsStartup,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_applyartifactsrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_applyartifactsrequest.go new file mode 100644 index 000000000000..1f4120a771d0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_applyartifactsrequest.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplyArtifactsRequest struct { + Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_artifactdeploymentstatusproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_artifactdeploymentstatusproperties.go new file mode 100644 index 000000000000..d7922280bf7c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_artifactdeploymentstatusproperties.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArtifactDeploymentStatusProperties struct { + ArtifactsApplied *int64 `json:"artifactsApplied,omitempty"` + DeploymentStatus *string `json:"deploymentStatus,omitempty"` + TotalArtifacts *int64 `json:"totalArtifacts,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_artifactinstallproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_artifactinstallproperties.go new file mode 100644 index 000000000000..8c171fc83d2e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_artifactinstallproperties.go @@ -0,0 +1,32 @@ +package virtualmachines + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArtifactInstallProperties struct { + ArtifactId *string `json:"artifactId,omitempty"` + ArtifactTitle *string `json:"artifactTitle,omitempty"` + DeploymentStatusMessage *string `json:"deploymentStatusMessage,omitempty"` + InstallTime *string `json:"installTime,omitempty"` + Parameters *[]ArtifactParameterProperties `json:"parameters,omitempty"` + Status *string `json:"status,omitempty"` + VMExtensionStatusMessage *string `json:"vmExtensionStatusMessage,omitempty"` +} + +func (o *ArtifactInstallProperties) GetInstallTimeAsTime() (*time.Time, error) { + if o.InstallTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.InstallTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ArtifactInstallProperties) SetInstallTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.InstallTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_artifactparameterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_artifactparameterproperties.go new file mode 100644 index 000000000000..f65cae702f3f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_artifactparameterproperties.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArtifactParameterProperties struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_attachnewdatadiskoptions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_attachnewdatadiskoptions.go new file mode 100644 index 000000000000..ea38266f4cf5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_attachnewdatadiskoptions.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttachNewDataDiskOptions struct { + DiskName *string `json:"diskName,omitempty"` + DiskSizeGiB *int64 `json:"diskSizeGiB,omitempty"` + DiskType *StorageType `json:"diskType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_computedatadisk.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_computedatadisk.go new file mode 100644 index 000000000000..f85181bc2b09 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_computedatadisk.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComputeDataDisk struct { + DiskSizeGiB *int64 `json:"diskSizeGiB,omitempty"` + DiskUri *string `json:"diskUri,omitempty"` + ManagedDiskId *string `json:"managedDiskId,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_computevminstanceviewstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_computevminstanceviewstatus.go new file mode 100644 index 000000000000..82032b845d27 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_computevminstanceviewstatus.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComputeVMInstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_computevmproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_computevmproperties.go new file mode 100644 index 000000000000..d45559486b35 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_computevmproperties.go @@ -0,0 +1,14 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComputeVMProperties struct { + DataDiskIds *[]string `json:"dataDiskIds,omitempty"` + DataDisks *[]ComputeDataDisk `json:"dataDisks,omitempty"` + NetworkInterfaceId *string `json:"networkInterfaceId,omitempty"` + OsDiskId *string `json:"osDiskId,omitempty"` + OsType *string `json:"osType,omitempty"` + Statuses *[]ComputeVMInstanceViewStatus `json:"statuses,omitempty"` + VMSize *string `json:"vmSize,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_datadiskproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_datadiskproperties.go new file mode 100644 index 000000000000..9f4a153345eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_datadiskproperties.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDiskProperties struct { + AttachNewDataDiskOptions *AttachNewDataDiskOptions `json:"attachNewDataDiskOptions,omitempty"` + ExistingLabDiskId *string `json:"existingLabDiskId,omitempty"` + HostCaching *HostCachingOptions `json:"hostCaching,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_daydetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_daydetails.go new file mode 100644 index 000000000000..21aa22f521e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_daydetails.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DayDetails struct { + Time *string `json:"time,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_detachdatadiskproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_detachdatadiskproperties.go new file mode 100644 index 000000000000..1abf6efe6d79 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_detachdatadiskproperties.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DetachDataDiskProperties struct { + ExistingLabDiskId *string `json:"existingLabDiskId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_galleryimagereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_galleryimagereference.go new file mode 100644 index 000000000000..56c616e50c84 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_galleryimagereference.go @@ -0,0 +1,12 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GalleryImageReference struct { + Offer *string `json:"offer,omitempty"` + OsType *string `json:"osType,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Sku *string `json:"sku,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_hourdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_hourdetails.go new file mode 100644 index 000000000000..2231541d95b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_hourdetails.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HourDetails struct { + Minute *int64 `json:"minute,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_inboundnatrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_inboundnatrule.go new file mode 100644 index 000000000000..fcaf4c41e2f7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_inboundnatrule.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InboundNatRule struct { + BackendPort *int64 `json:"backendPort,omitempty"` + FrontendPort *int64 `json:"frontendPort,omitempty"` + TransportProtocol *TransportProtocol `json:"transportProtocol,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_labvirtualmachine.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_labvirtualmachine.go new file mode 100644 index 000000000000..1bf95c6bb73c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_labvirtualmachine.go @@ -0,0 +1,13 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LabVirtualMachine struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties LabVirtualMachineProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_labvirtualmachineproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_labvirtualmachineproperties.go new file mode 100644 index 000000000000..cd261c6a1a85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_labvirtualmachineproperties.go @@ -0,0 +1,72 @@ +package virtualmachines + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LabVirtualMachineProperties struct { + AllowClaim *bool `json:"allowClaim,omitempty"` + ApplicableSchedule *ApplicableSchedule `json:"applicableSchedule,omitempty"` + ArtifactDeploymentStatus *ArtifactDeploymentStatusProperties `json:"artifactDeploymentStatus,omitempty"` + Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"` + ComputeId *string `json:"computeId,omitempty"` + ComputeVM *ComputeVMProperties `json:"computeVm,omitempty"` + CreatedByUser *string `json:"createdByUser,omitempty"` + CreatedByUserId *string `json:"createdByUserId,omitempty"` + CreatedDate *string `json:"createdDate,omitempty"` + CustomImageId *string `json:"customImageId,omitempty"` + DataDiskParameters *[]DataDiskProperties `json:"dataDiskParameters,omitempty"` + DisallowPublicIPAddress *bool `json:"disallowPublicIpAddress,omitempty"` + EnvironmentId *string `json:"environmentId,omitempty"` + ExpirationDate *string `json:"expirationDate,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` + GalleryImageReference *GalleryImageReference `json:"galleryImageReference,omitempty"` + IsAuthenticationWithSshKey *bool `json:"isAuthenticationWithSshKey,omitempty"` + LabSubnetName *string `json:"labSubnetName,omitempty"` + LabVirtualNetworkId *string `json:"labVirtualNetworkId,omitempty"` + LastKnownPowerState *string `json:"lastKnownPowerState,omitempty"` + NetworkInterface *NetworkInterfaceProperties `json:"networkInterface,omitempty"` + Notes *string `json:"notes,omitempty"` + OsType *string `json:"osType,omitempty"` + OwnerObjectId *string `json:"ownerObjectId,omitempty"` + OwnerUserPrincipalName *string `json:"ownerUserPrincipalName,omitempty"` + Password *string `json:"password,omitempty"` + PlanId *string `json:"planId,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ScheduleParameters *[]ScheduleCreationParameter `json:"scheduleParameters,omitempty"` + Size *string `json:"size,omitempty"` + SshKey *string `json:"sshKey,omitempty"` + StorageType *string `json:"storageType,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` + UserName *string `json:"userName,omitempty"` + VirtualMachineCreationSource *VirtualMachineCreationSource `json:"virtualMachineCreationSource,omitempty"` +} + +func (o *LabVirtualMachineProperties) GetCreatedDateAsTime() (*time.Time, error) { + if o.CreatedDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *LabVirtualMachineProperties) SetCreatedDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedDate = &formatted +} + +func (o *LabVirtualMachineProperties) GetExpirationDateAsTime() (*time.Time, error) { + if o.ExpirationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ExpirationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *LabVirtualMachineProperties) SetExpirationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_networkinterfaceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_networkinterfaceproperties.go new file mode 100644 index 000000000000..0689f09bc075 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_networkinterfaceproperties.go @@ -0,0 +1,16 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterfaceProperties struct { + DnsName *string `json:"dnsName,omitempty"` + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + PublicIPAddressId *string `json:"publicIpAddressId,omitempty"` + RdpAuthority *string `json:"rdpAuthority,omitempty"` + SharedPublicIPAddressConfiguration *SharedPublicIPAddressConfiguration `json:"sharedPublicIpAddressConfiguration,omitempty"` + SshAuthority *string `json:"sshAuthority,omitempty"` + SubnetId *string `json:"subnetId,omitempty"` + VirtualNetworkId *string `json:"virtualNetworkId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_notificationsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_notificationsettings.go new file mode 100644 index 000000000000..684bfe30ec5a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_notificationsettings.go @@ -0,0 +1,12 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationSettings struct { + EmailRecipient *string `json:"emailRecipient,omitempty"` + NotificationLocale *string `json:"notificationLocale,omitempty"` + Status *EnableStatus `json:"status,omitempty"` + TimeInMinutes *int64 `json:"timeInMinutes,omitempty"` + WebhookUrl *string `json:"webhookUrl,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_rdpconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_rdpconnection.go new file mode 100644 index 000000000000..055c96c90c42 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_rdpconnection.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RdpConnection struct { + Contents *string `json:"contents,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_resizelabvirtualmachineproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_resizelabvirtualmachineproperties.go new file mode 100644 index 000000000000..8a6291dec0df --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_resizelabvirtualmachineproperties.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResizeLabVirtualMachineProperties struct { + Size *string `json:"size,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_schedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_schedule.go new file mode 100644 index 000000000000..b9cc2f97adf5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_schedule.go @@ -0,0 +1,13 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Schedule struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ScheduleProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_schedulecreationparameter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_schedulecreationparameter.go new file mode 100644 index 000000000000..ffc6963bb1eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_schedulecreationparameter.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleCreationParameter struct { + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ScheduleCreationParameterProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_schedulecreationparameterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_schedulecreationparameterproperties.go new file mode 100644 index 000000000000..d5973ec2aeb0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_schedulecreationparameterproperties.go @@ -0,0 +1,15 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleCreationParameterProperties struct { + DailyRecurrence *DayDetails `json:"dailyRecurrence,omitempty"` + HourlyRecurrence *HourDetails `json:"hourlyRecurrence,omitempty"` + NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` + Status *EnableStatus `json:"status,omitempty"` + TargetResourceId *string `json:"targetResourceId,omitempty"` + TaskType *string `json:"taskType,omitempty"` + TimeZoneId *string `json:"timeZoneId,omitempty"` + WeeklyRecurrence *WeekDetails `json:"weeklyRecurrence,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_scheduleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_scheduleproperties.go new file mode 100644 index 000000000000..2205485feb5a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_scheduleproperties.go @@ -0,0 +1,36 @@ +package virtualmachines + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleProperties struct { + CreatedDate *string `json:"createdDate,omitempty"` + DailyRecurrence *DayDetails `json:"dailyRecurrence,omitempty"` + HourlyRecurrence *HourDetails `json:"hourlyRecurrence,omitempty"` + NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Status *EnableStatus `json:"status,omitempty"` + TargetResourceId *string `json:"targetResourceId,omitempty"` + TaskType *string `json:"taskType,omitempty"` + TimeZoneId *string `json:"timeZoneId,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` + WeeklyRecurrence *WeekDetails `json:"weeklyRecurrence,omitempty"` +} + +func (o *ScheduleProperties) GetCreatedDateAsTime() (*time.Time, error) { + if o.CreatedDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ScheduleProperties) SetCreatedDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_sharedpublicipaddressconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_sharedpublicipaddressconfiguration.go new file mode 100644 index 000000000000..68e4cf88b5f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_sharedpublicipaddressconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedPublicIPAddressConfiguration struct { + InboundNatRules *[]InboundNatRule `json:"inboundNatRules,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_updateresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_updateresource.go new file mode 100644 index 000000000000..964e7dc4c2fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_updateresource.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateResource struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_weekdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_weekdetails.go new file mode 100644 index 000000000000..9b544e1e358b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/model_weekdetails.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WeekDetails struct { + Time *string `json:"time,omitempty"` + Weekdays *[]string `json:"weekdays,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/predicates.go new file mode 100644 index 000000000000..137796ecf5ec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/predicates.go @@ -0,0 +1,29 @@ +package virtualmachines + +type LabVirtualMachineOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p LabVirtualMachineOperationPredicate) Matches(input LabVirtualMachine) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/version.go new file mode 100644 index 000000000000..06c8127876ee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines/version.go @@ -0,0 +1,12 @@ +package virtualmachines + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-09-15" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/virtualmachines/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/README.md new file mode 100644 index 000000000000..ed6e3b6baf10 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/README.md @@ -0,0 +1,103 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks` Documentation + +The `virtualnetworks` SDK allows for interaction with the Azure Resource Manager Service `devtestlab` (API Version `2018-09-15`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks" +``` + + +### Client Initialization + +```go +client := virtualnetworks.NewVirtualNetworksClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualNetworksClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualNetworkValue") + +payload := virtualnetworks.VirtualNetwork{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworksClient.Delete` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualNetworkValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworksClient.Get` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualNetworkValue") + +read, err := client.Get(ctx, id, virtualnetworks.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualNetworksClient.List` + +```go +ctx := context.TODO() +id := virtualnetworks.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue") + +// alternatively `client.List(ctx, id, virtualnetworks.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, virtualnetworks.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualNetworksClient.Update` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "virtualNetworkValue") + +payload := virtualnetworks.UpdateResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/client.go new file mode 100644 index 000000000000..3dea42d32722 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/client.go @@ -0,0 +1,18 @@ +package virtualnetworks + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworksClient struct { + Client autorest.Client + baseUri string +} + +func NewVirtualNetworksClientWithBaseURI(endpoint string) VirtualNetworksClient { + return VirtualNetworksClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/constants.go new file mode 100644 index 000000000000..58642a63b0eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/constants.go @@ -0,0 +1,65 @@ +package virtualnetworks + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TransportProtocol string + +const ( + TransportProtocolTcp TransportProtocol = "Tcp" + TransportProtocolUdp TransportProtocol = "Udp" +) + +func PossibleValuesForTransportProtocol() []string { + return []string{ + string(TransportProtocolTcp), + string(TransportProtocolUdp), + } +} + +func parseTransportProtocol(input string) (*TransportProtocol, error) { + vals := map[string]TransportProtocol{ + "tcp": TransportProtocolTcp, + "udp": TransportProtocolUdp, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TransportProtocol(input) + return &out, nil +} + +type UsagePermissionType string + +const ( + UsagePermissionTypeAllow UsagePermissionType = "Allow" + UsagePermissionTypeDefault UsagePermissionType = "Default" + UsagePermissionTypeDeny UsagePermissionType = "Deny" +) + +func PossibleValuesForUsagePermissionType() []string { + return []string{ + string(UsagePermissionTypeAllow), + string(UsagePermissionTypeDefault), + string(UsagePermissionTypeDeny), + } +} + +func parseUsagePermissionType(input string) (*UsagePermissionType, error) { + vals := map[string]UsagePermissionType{ + "allow": UsagePermissionTypeAllow, + "default": UsagePermissionTypeDefault, + "deny": UsagePermissionTypeDeny, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UsagePermissionType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/id_lab.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/id_lab.go new file mode 100644 index 000000000000..ab0d0ea444fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/id_lab.go @@ -0,0 +1,124 @@ +package virtualnetworks + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LabId{} + +// LabId is a struct representing the Resource ID for a Lab +type LabId struct { + SubscriptionId string + ResourceGroupName string + LabName string +} + +// NewLabID returns a new LabId struct +func NewLabID(subscriptionId string, resourceGroupName string, labName string) LabId { + return LabId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + LabName: labName, + } +} + +// ParseLabID parses 'input' into a LabId +func ParseLabID(input string) (*LabId, error) { + parser := resourceids.NewParserFromResourceIdType(LabId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LabId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLabIDInsensitively parses 'input' case-insensitively into a LabId +// note: this method should only be used for API response data and not user input +func ParseLabIDInsensitively(input string) (*LabId, error) { + parser := resourceids.NewParserFromResourceIdType(LabId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LabId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLabID checks that 'input' can be parsed as a Lab ID +func ValidateLabID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLabID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Lab ID +func (id LabId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.LabName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Lab ID +func (id LabId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDevTestLab", "Microsoft.DevTestLab", "Microsoft.DevTestLab"), + resourceids.StaticSegment("staticLabs", "labs", "labs"), + resourceids.UserSpecifiedSegment("labName", "labValue"), + } +} + +// String returns a human-readable description of this Lab ID +func (id LabId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Lab Name: %q", id.LabName), + } + return fmt.Sprintf("Lab (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/id_virtualnetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/id_virtualnetwork.go new file mode 100644 index 000000000000..8b80961837c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/id_virtualnetwork.go @@ -0,0 +1,137 @@ +package virtualnetworks + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VirtualNetworkId{} + +// VirtualNetworkId is a struct representing the Resource ID for a Virtual Network +type VirtualNetworkId struct { + SubscriptionId string + ResourceGroupName string + LabName string + VirtualNetworkName string +} + +// NewVirtualNetworkID returns a new VirtualNetworkId struct +func NewVirtualNetworkID(subscriptionId string, resourceGroupName string, labName string, virtualNetworkName string) VirtualNetworkId { + return VirtualNetworkId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + LabName: labName, + VirtualNetworkName: virtualNetworkName, + } +} + +// ParseVirtualNetworkID parses 'input' into a VirtualNetworkId +func ParseVirtualNetworkID(input string) (*VirtualNetworkId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualNetworkId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualNetworkId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + if id.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualNetworkName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVirtualNetworkIDInsensitively parses 'input' case-insensitively into a VirtualNetworkId +// note: this method should only be used for API response data and not user input +func ParseVirtualNetworkIDInsensitively(input string) (*VirtualNetworkId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualNetworkId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualNetworkId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + if id.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualNetworkName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVirtualNetworkID checks that 'input' can be parsed as a Virtual Network ID +func ValidateVirtualNetworkID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVirtualNetworkID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Network ID +func (id VirtualNetworkId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DevTestLab/labs/%s/virtualNetworks/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.LabName, id.VirtualNetworkName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Network ID +func (id VirtualNetworkId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDevTestLab", "Microsoft.DevTestLab", "Microsoft.DevTestLab"), + resourceids.StaticSegment("staticLabs", "labs", "labs"), + resourceids.UserSpecifiedSegment("labName", "labValue"), + resourceids.StaticSegment("staticVirtualNetworks", "virtualNetworks", "virtualNetworks"), + resourceids.UserSpecifiedSegment("virtualNetworkName", "virtualNetworkValue"), + } +} + +// String returns a human-readable description of this Virtual Network ID +func (id VirtualNetworkId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Lab Name: %q", id.LabName), + fmt.Sprintf("Virtual Network Name: %q", id.VirtualNetworkName), + } + return fmt.Sprintf("Virtual Network (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/method_createorupdate_autorest.go new file mode 100644 index 000000000000..eafb00ddbff0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package virtualnetworks + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c VirtualNetworksClient) CreateOrUpdate(ctx context.Context, id VirtualNetworkId, input VirtualNetwork) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VirtualNetworksClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualNetworkId, input VirtualNetwork) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c VirtualNetworksClient) preparerForCreateOrUpdate(ctx context.Context, id VirtualNetworkId, input VirtualNetwork) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualNetworksClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/method_delete_autorest.go new file mode 100644 index 000000000000..5ffe04999ffd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/method_delete_autorest.go @@ -0,0 +1,78 @@ +package virtualnetworks + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c VirtualNetworksClient) Delete(ctx context.Context, id VirtualNetworkId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualNetworksClient) DeleteThenPoll(ctx context.Context, id VirtualNetworkId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c VirtualNetworksClient) preparerForDelete(ctx context.Context, id VirtualNetworkId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualNetworksClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/method_get_autorest.go new file mode 100644 index 000000000000..94269a952cfd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/method_get_autorest.go @@ -0,0 +1,97 @@ +package virtualnetworks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *VirtualNetwork +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// Get ... +func (c VirtualNetworksClient) Get(ctx context.Context, id VirtualNetworkId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c VirtualNetworksClient) preparerForGet(ctx context.Context, id VirtualNetworkId, options GetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c VirtualNetworksClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/method_list_autorest.go new file mode 100644 index 000000000000..062e4e56e822 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/method_list_autorest.go @@ -0,0 +1,230 @@ +package virtualnetworks + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]VirtualNetwork + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []VirtualNetwork +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Expand *string + Filter *string + Orderby *string + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Orderby != nil { + out["$orderby"] = *o.Orderby + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c VirtualNetworksClient) List(ctx context.Context, id LabId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c VirtualNetworksClient) preparerForList(ctx context.Context, id LabId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/virtualNetworks", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c VirtualNetworksClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c VirtualNetworksClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []VirtualNetwork `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c VirtualNetworksClient) ListComplete(ctx context.Context, id LabId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, VirtualNetworkOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c VirtualNetworksClient) ListCompleteMatchingPredicate(ctx context.Context, id LabId, options ListOperationOptions, predicate VirtualNetworkOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]VirtualNetwork, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/method_update_autorest.go new file mode 100644 index 000000000000..0a162b054e9b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/method_update_autorest.go @@ -0,0 +1,69 @@ +package virtualnetworks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *VirtualNetwork +} + +// Update ... +func (c VirtualNetworksClient) Update(ctx context.Context, id VirtualNetworkId, input UpdateResource) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworks.VirtualNetworksClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c VirtualNetworksClient) preparerForUpdate(ctx context.Context, id VirtualNetworkId, input UpdateResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c VirtualNetworksClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_externalsubnet.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_externalsubnet.go new file mode 100644 index 000000000000..f925871b985a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_externalsubnet.go @@ -0,0 +1,9 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExternalSubnet struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_port.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_port.go new file mode 100644 index 000000000000..af242078e260 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_port.go @@ -0,0 +1,9 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Port struct { + BackendPort *int64 `json:"backendPort,omitempty"` + TransportProtocol *TransportProtocol `json:"transportProtocol,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_subnet.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_subnet.go new file mode 100644 index 000000000000..b6531c8d8dae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_subnet.go @@ -0,0 +1,10 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Subnet struct { + AllowPublicIP *UsagePermissionType `json:"allowPublicIp,omitempty"` + LabSubnetName *string `json:"labSubnetName,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_subnetoverride.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_subnetoverride.go new file mode 100644 index 000000000000..51e787842dea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_subnetoverride.go @@ -0,0 +1,13 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubnetOverride struct { + LabSubnetName *string `json:"labSubnetName,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` + SharedPublicIPAddressConfiguration *SubnetSharedPublicIPAddressConfiguration `json:"sharedPublicIpAddressConfiguration,omitempty"` + UseInVMCreationPermission *UsagePermissionType `json:"useInVmCreationPermission,omitempty"` + UsePublicIPAddressPermission *UsagePermissionType `json:"usePublicIpAddressPermission,omitempty"` + VirtualNetworkPoolName *string `json:"virtualNetworkPoolName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_subnetsharedpublicipaddressconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_subnetsharedpublicipaddressconfiguration.go new file mode 100644 index 000000000000..2ef3d7e825e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_subnetsharedpublicipaddressconfiguration.go @@ -0,0 +1,8 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubnetSharedPublicIPAddressConfiguration struct { + AllowedPorts *[]Port `json:"allowedPorts,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_updateresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_updateresource.go new file mode 100644 index 000000000000..dd43046b3edd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_updateresource.go @@ -0,0 +1,8 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateResource struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_virtualnetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_virtualnetwork.go new file mode 100644 index 000000000000..b5effa8c3e36 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_virtualnetwork.go @@ -0,0 +1,13 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetwork struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualNetworkProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_virtualnetworkproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_virtualnetworkproperties.go new file mode 100644 index 000000000000..b289577d67a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/model_virtualnetworkproperties.go @@ -0,0 +1,33 @@ +package virtualnetworks + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkProperties struct { + AllowedSubnets *[]Subnet `json:"allowedSubnets,omitempty"` + CreatedDate *string `json:"createdDate,omitempty"` + Description *string `json:"description,omitempty"` + ExternalProviderResourceId *string `json:"externalProviderResourceId,omitempty"` + ExternalSubnets *[]ExternalSubnet `json:"externalSubnets,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + SubnetOverrides *[]SubnetOverride `json:"subnetOverrides,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +func (o *VirtualNetworkProperties) GetCreatedDateAsTime() (*time.Time, error) { + if o.CreatedDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualNetworkProperties) SetCreatedDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/predicates.go new file mode 100644 index 000000000000..d5c60b49dc09 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/predicates.go @@ -0,0 +1,29 @@ +package virtualnetworks + +type VirtualNetworkOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p VirtualNetworkOperationPredicate) Matches(input VirtualNetwork) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/version.go new file mode 100644 index 000000000000..97df3a33087e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks/version.go @@ -0,0 +1,12 @@ +package virtualnetworks + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-09-15" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/virtualnetworks/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/README.md new file mode 100644 index 000000000000..45001d666cf4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance` Documentation + +The `digitaltwinsinstance` SDK allows for interaction with the Azure Resource Manager Service `digitaltwins` (API Version `2020-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance" +``` + + +### Client Initialization + +```go +client := digitaltwinsinstance.NewDigitalTwinsInstanceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DigitalTwinsInstanceClient.DigitalTwinsCreateOrUpdate` + +```go +ctx := context.TODO() +id := digitaltwinsinstance.NewDigitalTwinsInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "digitalTwinsInstanceValue") + +payload := digitaltwinsinstance.DigitalTwinsDescription{ + // ... +} + + +if err := client.DigitalTwinsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DigitalTwinsInstanceClient.DigitalTwinsDelete` + +```go +ctx := context.TODO() +id := digitaltwinsinstance.NewDigitalTwinsInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "digitalTwinsInstanceValue") + +if err := client.DigitalTwinsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DigitalTwinsInstanceClient.DigitalTwinsGet` + +```go +ctx := context.TODO() +id := digitaltwinsinstance.NewDigitalTwinsInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "digitalTwinsInstanceValue") + +read, err := client.DigitalTwinsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DigitalTwinsInstanceClient.DigitalTwinsList` + +```go +ctx := context.TODO() +id := digitaltwinsinstance.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.DigitalTwinsList(ctx, id)` can be used to do batched pagination +items, err := client.DigitalTwinsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DigitalTwinsInstanceClient.DigitalTwinsListByResourceGroup` + +```go +ctx := context.TODO() +id := digitaltwinsinstance.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.DigitalTwinsListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.DigitalTwinsListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DigitalTwinsInstanceClient.DigitalTwinsUpdate` + +```go +ctx := context.TODO() +id := digitaltwinsinstance.NewDigitalTwinsInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "digitalTwinsInstanceValue") + +payload := digitaltwinsinstance.DigitalTwinsPatchDescription{ + // ... +} + + +if err := client.DigitalTwinsUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/client.go new file mode 100644 index 000000000000..74a7483e36e5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/client.go @@ -0,0 +1,18 @@ +package digitaltwinsinstance + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsInstanceClient struct { + Client autorest.Client + baseUri string +} + +func NewDigitalTwinsInstanceClientWithBaseURI(endpoint string) DigitalTwinsInstanceClient { + return DigitalTwinsInstanceClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/constants.go new file mode 100644 index 000000000000..7d55c1c6ec16 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/constants.go @@ -0,0 +1,157 @@ +package digitaltwinsinstance + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectionPropertiesProvisioningState string + +const ( + ConnectionPropertiesProvisioningStateApproved ConnectionPropertiesProvisioningState = "Approved" + ConnectionPropertiesProvisioningStateDisconnected ConnectionPropertiesProvisioningState = "Disconnected" + ConnectionPropertiesProvisioningStatePending ConnectionPropertiesProvisioningState = "Pending" + ConnectionPropertiesProvisioningStateRejected ConnectionPropertiesProvisioningState = "Rejected" +) + +func PossibleValuesForConnectionPropertiesProvisioningState() []string { + return []string{ + string(ConnectionPropertiesProvisioningStateApproved), + string(ConnectionPropertiesProvisioningStateDisconnected), + string(ConnectionPropertiesProvisioningStatePending), + string(ConnectionPropertiesProvisioningStateRejected), + } +} + +func parseConnectionPropertiesProvisioningState(input string) (*ConnectionPropertiesProvisioningState, error) { + vals := map[string]ConnectionPropertiesProvisioningState{ + "approved": ConnectionPropertiesProvisioningStateApproved, + "disconnected": ConnectionPropertiesProvisioningStateDisconnected, + "pending": ConnectionPropertiesProvisioningStatePending, + "rejected": ConnectionPropertiesProvisioningStateRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConnectionPropertiesProvisioningState(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStatus string + +const ( + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkServiceConnectionStatus() []string { + return []string{ + string(PrivateLinkServiceConnectionStatusApproved), + string(PrivateLinkServiceConnectionStatusDisconnected), + string(PrivateLinkServiceConnectionStatusPending), + string(PrivateLinkServiceConnectionStatusRejected), + } +} + +func parsePrivateLinkServiceConnectionStatus(input string) (*PrivateLinkServiceConnectionStatus, error) { + vals := map[string]PrivateLinkServiceConnectionStatus{ + "approved": PrivateLinkServiceConnectionStatusApproved, + "disconnected": PrivateLinkServiceConnectionStatusDisconnected, + "pending": PrivateLinkServiceConnectionStatusPending, + "rejected": PrivateLinkServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateRestoring ProvisioningState = "Restoring" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateSuspending ProvisioningState = "Suspending" + ProvisioningStateUpdating ProvisioningState = "Updating" + ProvisioningStateWarning ProvisioningState = "Warning" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateProvisioning), + string(ProvisioningStateRestoring), + string(ProvisioningStateSucceeded), + string(ProvisioningStateSuspending), + string(ProvisioningStateUpdating), + string(ProvisioningStateWarning), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "provisioning": ProvisioningStateProvisioning, + "restoring": ProvisioningStateRestoring, + "succeeded": ProvisioningStateSucceeded, + "suspending": ProvisioningStateSuspending, + "updating": ProvisioningStateUpdating, + "warning": ProvisioningStateWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/id_digitaltwinsinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/id_digitaltwinsinstance.go new file mode 100644 index 000000000000..00153101554f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/id_digitaltwinsinstance.go @@ -0,0 +1,124 @@ +package digitaltwinsinstance + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DigitalTwinsInstanceId{} + +// DigitalTwinsInstanceId is a struct representing the Resource ID for a Digital Twins Instance +type DigitalTwinsInstanceId struct { + SubscriptionId string + ResourceGroupName string + DigitalTwinsInstanceName string +} + +// NewDigitalTwinsInstanceID returns a new DigitalTwinsInstanceId struct +func NewDigitalTwinsInstanceID(subscriptionId string, resourceGroupName string, digitalTwinsInstanceName string) DigitalTwinsInstanceId { + return DigitalTwinsInstanceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DigitalTwinsInstanceName: digitalTwinsInstanceName, + } +} + +// ParseDigitalTwinsInstanceID parses 'input' into a DigitalTwinsInstanceId +func ParseDigitalTwinsInstanceID(input string) (*DigitalTwinsInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(DigitalTwinsInstanceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DigitalTwinsInstanceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'digitalTwinsInstanceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDigitalTwinsInstanceIDInsensitively parses 'input' case-insensitively into a DigitalTwinsInstanceId +// note: this method should only be used for API response data and not user input +func ParseDigitalTwinsInstanceIDInsensitively(input string) (*DigitalTwinsInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(DigitalTwinsInstanceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DigitalTwinsInstanceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'digitalTwinsInstanceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDigitalTwinsInstanceID checks that 'input' can be parsed as a Digital Twins Instance ID +func ValidateDigitalTwinsInstanceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDigitalTwinsInstanceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Digital Twins Instance ID +func (id DigitalTwinsInstanceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DigitalTwins/digitalTwinsInstances/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DigitalTwinsInstanceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Digital Twins Instance ID +func (id DigitalTwinsInstanceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDigitalTwins", "Microsoft.DigitalTwins", "Microsoft.DigitalTwins"), + resourceids.StaticSegment("staticDigitalTwinsInstances", "digitalTwinsInstances", "digitalTwinsInstances"), + resourceids.UserSpecifiedSegment("digitalTwinsInstanceName", "digitalTwinsInstanceValue"), + } +} + +// String returns a human-readable description of this Digital Twins Instance ID +func (id DigitalTwinsInstanceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Digital Twins Instance Name: %q", id.DigitalTwinsInstanceName), + } + return fmt.Sprintf("Digital Twins Instance (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinscreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinscreateorupdate_autorest.go new file mode 100644 index 000000000000..fd4b372977ea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinscreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package digitaltwinsinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DigitalTwinsCreateOrUpdate ... +func (c DigitalTwinsInstanceClient) DigitalTwinsCreateOrUpdate(ctx context.Context, id DigitalTwinsInstanceId, input DigitalTwinsDescription) (result DigitalTwinsCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForDigitalTwinsCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForDigitalTwinsCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DigitalTwinsCreateOrUpdateThenPoll performs DigitalTwinsCreateOrUpdate then polls until it's completed +func (c DigitalTwinsInstanceClient) DigitalTwinsCreateOrUpdateThenPoll(ctx context.Context, id DigitalTwinsInstanceId, input DigitalTwinsDescription) error { + result, err := c.DigitalTwinsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DigitalTwinsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DigitalTwinsCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForDigitalTwinsCreateOrUpdate prepares the DigitalTwinsCreateOrUpdate request. +func (c DigitalTwinsInstanceClient) preparerForDigitalTwinsCreateOrUpdate(ctx context.Context, id DigitalTwinsInstanceId, input DigitalTwinsDescription) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDigitalTwinsCreateOrUpdate sends the DigitalTwinsCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c DigitalTwinsInstanceClient) senderForDigitalTwinsCreateOrUpdate(ctx context.Context, req *http.Request) (future DigitalTwinsCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinsdelete_autorest.go new file mode 100644 index 000000000000..e932769cf2f5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinsdelete_autorest.go @@ -0,0 +1,78 @@ +package digitaltwinsinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DigitalTwinsDelete ... +func (c DigitalTwinsInstanceClient) DigitalTwinsDelete(ctx context.Context, id DigitalTwinsInstanceId) (result DigitalTwinsDeleteOperationResponse, err error) { + req, err := c.preparerForDigitalTwinsDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDigitalTwinsDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DigitalTwinsDeleteThenPoll performs DigitalTwinsDelete then polls until it's completed +func (c DigitalTwinsInstanceClient) DigitalTwinsDeleteThenPoll(ctx context.Context, id DigitalTwinsInstanceId) error { + result, err := c.DigitalTwinsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing DigitalTwinsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DigitalTwinsDelete: %+v", err) + } + + return nil +} + +// preparerForDigitalTwinsDelete prepares the DigitalTwinsDelete request. +func (c DigitalTwinsInstanceClient) preparerForDigitalTwinsDelete(ctx context.Context, id DigitalTwinsInstanceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDigitalTwinsDelete sends the DigitalTwinsDelete request. The method will close the +// http.Response Body if it receives an error. +func (c DigitalTwinsInstanceClient) senderForDigitalTwinsDelete(ctx context.Context, req *http.Request) (future DigitalTwinsDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinsget_autorest.go new file mode 100644 index 000000000000..7768d36d9c3e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinsget_autorest.go @@ -0,0 +1,68 @@ +package digitaltwinsinstance + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsGetOperationResponse struct { + HttpResponse *http.Response + Model *DigitalTwinsDescription +} + +// DigitalTwinsGet ... +func (c DigitalTwinsInstanceClient) DigitalTwinsGet(ctx context.Context, id DigitalTwinsInstanceId) (result DigitalTwinsGetOperationResponse, err error) { + req, err := c.preparerForDigitalTwinsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDigitalTwinsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDigitalTwinsGet prepares the DigitalTwinsGet request. +func (c DigitalTwinsInstanceClient) preparerForDigitalTwinsGet(ctx context.Context, id DigitalTwinsInstanceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDigitalTwinsGet handles the response to the DigitalTwinsGet request. The method always +// closes the http.Response Body. +func (c DigitalTwinsInstanceClient) responderForDigitalTwinsGet(resp *http.Response) (result DigitalTwinsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinslist_autorest.go new file mode 100644 index 000000000000..4ebd1d3a076a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinslist_autorest.go @@ -0,0 +1,187 @@ +package digitaltwinsinstance + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsListOperationResponse struct { + HttpResponse *http.Response + Model *[]DigitalTwinsDescription + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (DigitalTwinsListOperationResponse, error) +} + +type DigitalTwinsListCompleteResult struct { + Items []DigitalTwinsDescription +} + +func (r DigitalTwinsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r DigitalTwinsListOperationResponse) LoadMore(ctx context.Context) (resp DigitalTwinsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// DigitalTwinsList ... +func (c DigitalTwinsInstanceClient) DigitalTwinsList(ctx context.Context, id commonids.SubscriptionId) (resp DigitalTwinsListOperationResponse, err error) { + req, err := c.preparerForDigitalTwinsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForDigitalTwinsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForDigitalTwinsList prepares the DigitalTwinsList request. +func (c DigitalTwinsInstanceClient) preparerForDigitalTwinsList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DigitalTwins/digitalTwinsInstances", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForDigitalTwinsListWithNextLink prepares the DigitalTwinsList request with the given nextLink token. +func (c DigitalTwinsInstanceClient) preparerForDigitalTwinsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDigitalTwinsList handles the response to the DigitalTwinsList request. The method always +// closes the http.Response Body. +func (c DigitalTwinsInstanceClient) responderForDigitalTwinsList(resp *http.Response) (result DigitalTwinsListOperationResponse, err error) { + type page struct { + Values []DigitalTwinsDescription `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result DigitalTwinsListOperationResponse, err error) { + req, err := c.preparerForDigitalTwinsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDigitalTwinsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// DigitalTwinsListComplete retrieves all of the results into a single object +func (c DigitalTwinsInstanceClient) DigitalTwinsListComplete(ctx context.Context, id commonids.SubscriptionId) (DigitalTwinsListCompleteResult, error) { + return c.DigitalTwinsListCompleteMatchingPredicate(ctx, id, DigitalTwinsDescriptionOperationPredicate{}) +} + +// DigitalTwinsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DigitalTwinsInstanceClient) DigitalTwinsListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DigitalTwinsDescriptionOperationPredicate) (resp DigitalTwinsListCompleteResult, err error) { + items := make([]DigitalTwinsDescription, 0) + + page, err := c.DigitalTwinsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := DigitalTwinsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinslistbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinslistbyresourcegroup_autorest.go new file mode 100644 index 000000000000..34c1fdc82c75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinslistbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package digitaltwinsinstance + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]DigitalTwinsDescription + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (DigitalTwinsListByResourceGroupOperationResponse, error) +} + +type DigitalTwinsListByResourceGroupCompleteResult struct { + Items []DigitalTwinsDescription +} + +func (r DigitalTwinsListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r DigitalTwinsListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp DigitalTwinsListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// DigitalTwinsListByResourceGroup ... +func (c DigitalTwinsInstanceClient) DigitalTwinsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp DigitalTwinsListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForDigitalTwinsListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForDigitalTwinsListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForDigitalTwinsListByResourceGroup prepares the DigitalTwinsListByResourceGroup request. +func (c DigitalTwinsInstanceClient) preparerForDigitalTwinsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DigitalTwins/digitalTwinsInstances", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForDigitalTwinsListByResourceGroupWithNextLink prepares the DigitalTwinsListByResourceGroup request with the given nextLink token. +func (c DigitalTwinsInstanceClient) preparerForDigitalTwinsListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDigitalTwinsListByResourceGroup handles the response to the DigitalTwinsListByResourceGroup request. The method always +// closes the http.Response Body. +func (c DigitalTwinsInstanceClient) responderForDigitalTwinsListByResourceGroup(resp *http.Response) (result DigitalTwinsListByResourceGroupOperationResponse, err error) { + type page struct { + Values []DigitalTwinsDescription `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result DigitalTwinsListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForDigitalTwinsListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDigitalTwinsListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// DigitalTwinsListByResourceGroupComplete retrieves all of the results into a single object +func (c DigitalTwinsInstanceClient) DigitalTwinsListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (DigitalTwinsListByResourceGroupCompleteResult, error) { + return c.DigitalTwinsListByResourceGroupCompleteMatchingPredicate(ctx, id, DigitalTwinsDescriptionOperationPredicate{}) +} + +// DigitalTwinsListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DigitalTwinsInstanceClient) DigitalTwinsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate DigitalTwinsDescriptionOperationPredicate) (resp DigitalTwinsListByResourceGroupCompleteResult, err error) { + items := make([]DigitalTwinsDescription, 0) + + page, err := c.DigitalTwinsListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := DigitalTwinsListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinsupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinsupdate_autorest.go new file mode 100644 index 000000000000..6689cb9fd70f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/method_digitaltwinsupdate_autorest.go @@ -0,0 +1,79 @@ +package digitaltwinsinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DigitalTwinsUpdate ... +func (c DigitalTwinsInstanceClient) DigitalTwinsUpdate(ctx context.Context, id DigitalTwinsInstanceId, input DigitalTwinsPatchDescription) (result DigitalTwinsUpdateOperationResponse, err error) { + req, err := c.preparerForDigitalTwinsUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForDigitalTwinsUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwinsinstance.DigitalTwinsInstanceClient", "DigitalTwinsUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DigitalTwinsUpdateThenPoll performs DigitalTwinsUpdate then polls until it's completed +func (c DigitalTwinsInstanceClient) DigitalTwinsUpdateThenPoll(ctx context.Context, id DigitalTwinsInstanceId, input DigitalTwinsPatchDescription) error { + result, err := c.DigitalTwinsUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DigitalTwinsUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DigitalTwinsUpdate: %+v", err) + } + + return nil +} + +// preparerForDigitalTwinsUpdate prepares the DigitalTwinsUpdate request. +func (c DigitalTwinsInstanceClient) preparerForDigitalTwinsUpdate(ctx context.Context, id DigitalTwinsInstanceId, input DigitalTwinsPatchDescription) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDigitalTwinsUpdate sends the DigitalTwinsUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c DigitalTwinsInstanceClient) senderForDigitalTwinsUpdate(ctx context.Context, req *http.Request) (future DigitalTwinsUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_connectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_connectionproperties.go new file mode 100644 index 000000000000..098c06628fbb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_connectionproperties.go @@ -0,0 +1,11 @@ +package digitaltwinsinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectionProperties struct { + GroupIds *[]string `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *ConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *ConnectionPropertiesProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_connectionstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_connectionstate.go new file mode 100644 index 000000000000..468893bff656 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_connectionstate.go @@ -0,0 +1,10 @@ +package digitaltwinsinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description string `json:"description"` + Status PrivateLinkServiceConnectionStatus `json:"status"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_digitaltwinsdescription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_digitaltwinsdescription.go new file mode 100644 index 000000000000..5d2b5a2e1540 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_digitaltwinsdescription.go @@ -0,0 +1,18 @@ +package digitaltwinsinstance + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsDescription struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *DigitalTwinsProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_digitaltwinspatchdescription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_digitaltwinspatchdescription.go new file mode 100644 index 000000000000..569c3c60b232 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_digitaltwinspatchdescription.go @@ -0,0 +1,14 @@ +package digitaltwinsinstance + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsPatchDescription struct { + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Properties *DigitalTwinsPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_digitaltwinspatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_digitaltwinspatchproperties.go new file mode 100644 index 000000000000..6c8fab48bd4a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_digitaltwinspatchproperties.go @@ -0,0 +1,8 @@ +package digitaltwinsinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsPatchProperties struct { + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_digitaltwinsproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_digitaltwinsproperties.go new file mode 100644 index 000000000000..be4859644546 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_digitaltwinsproperties.go @@ -0,0 +1,43 @@ +package digitaltwinsinstance + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsProperties struct { + CreatedTime *string `json:"createdTime,omitempty"` + HostName *string `json:"hostName,omitempty"` + LastUpdatedTime *string `json:"lastUpdatedTime,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +} + +func (o *DigitalTwinsProperties) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *DigitalTwinsProperties) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} + +func (o *DigitalTwinsProperties) GetLastUpdatedTimeAsTime() (*time.Time, error) { + if o.LastUpdatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *DigitalTwinsProperties) SetLastUpdatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdatedTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_privateendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_privateendpoint.go new file mode 100644 index 000000000000..ad5b3041d063 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_privateendpoint.go @@ -0,0 +1,8 @@ +package digitaltwinsinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_privateendpointconnection.go new file mode 100644 index 000000000000..9527eba53d93 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package digitaltwinsinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties ConnectionProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/predicates.go new file mode 100644 index 000000000000..991f78b69f43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/predicates.go @@ -0,0 +1,29 @@ +package digitaltwinsinstance + +type DigitalTwinsDescriptionOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p DigitalTwinsDescriptionOperationPredicate) Matches(input DigitalTwinsDescription) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/version.go new file mode 100644 index 000000000000..ad5fbe31a826 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance/version.go @@ -0,0 +1,12 @@ +package digitaltwinsinstance + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/digitaltwinsinstance/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/README.md new file mode 100644 index 000000000000..ec749d221b02 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints` Documentation + +The `endpoints` SDK allows for interaction with the Azure Resource Manager Service `digitaltwins` (API Version `2020-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints" +``` + + +### Client Initialization + +```go +client := endpoints.NewEndpointsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `EndpointsClient.DigitalTwinsEndpointCreateOrUpdate` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "digitalTwinsInstanceValue", "endpointValue") + +payload := endpoints.DigitalTwinsEndpointResource{ + // ... +} + + +if err := client.DigitalTwinsEndpointCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `EndpointsClient.DigitalTwinsEndpointDelete` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "digitalTwinsInstanceValue", "endpointValue") + +if err := client.DigitalTwinsEndpointDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `EndpointsClient.DigitalTwinsEndpointGet` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "digitalTwinsInstanceValue", "endpointValue") + +read, err := client.DigitalTwinsEndpointGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EndpointsClient.DigitalTwinsEndpointList` + +```go +ctx := context.TODO() +id := endpoints.NewDigitalTwinsInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "digitalTwinsInstanceValue") + +// alternatively `client.DigitalTwinsEndpointList(ctx, id)` can be used to do batched pagination +items, err := client.DigitalTwinsEndpointListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/client.go new file mode 100644 index 000000000000..6c305c6e8ca7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/client.go @@ -0,0 +1,18 @@ +package endpoints + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointsClient struct { + Client autorest.Client + baseUri string +} + +func NewEndpointsClientWithBaseURI(endpoint string) EndpointsClient { + return EndpointsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/constants.go new file mode 100644 index 000000000000..d21189e00822 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/constants.go @@ -0,0 +1,120 @@ +package endpoints + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthenticationType string + +const ( + AuthenticationTypeIdentityBased AuthenticationType = "IdentityBased" + AuthenticationTypeKeyBased AuthenticationType = "KeyBased" +) + +func PossibleValuesForAuthenticationType() []string { + return []string{ + string(AuthenticationTypeIdentityBased), + string(AuthenticationTypeKeyBased), + } +} + +func parseAuthenticationType(input string) (*AuthenticationType, error) { + vals := map[string]AuthenticationType{ + "identitybased": AuthenticationTypeIdentityBased, + "keybased": AuthenticationTypeKeyBased, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AuthenticationType(input) + return &out, nil +} + +type EndpointProvisioningState string + +const ( + EndpointProvisioningStateCanceled EndpointProvisioningState = "Canceled" + EndpointProvisioningStateDeleted EndpointProvisioningState = "Deleted" + EndpointProvisioningStateDeleting EndpointProvisioningState = "Deleting" + EndpointProvisioningStateDisabled EndpointProvisioningState = "Disabled" + EndpointProvisioningStateFailed EndpointProvisioningState = "Failed" + EndpointProvisioningStateMoving EndpointProvisioningState = "Moving" + EndpointProvisioningStateProvisioning EndpointProvisioningState = "Provisioning" + EndpointProvisioningStateRestoring EndpointProvisioningState = "Restoring" + EndpointProvisioningStateSucceeded EndpointProvisioningState = "Succeeded" + EndpointProvisioningStateSuspending EndpointProvisioningState = "Suspending" + EndpointProvisioningStateWarning EndpointProvisioningState = "Warning" +) + +func PossibleValuesForEndpointProvisioningState() []string { + return []string{ + string(EndpointProvisioningStateCanceled), + string(EndpointProvisioningStateDeleted), + string(EndpointProvisioningStateDeleting), + string(EndpointProvisioningStateDisabled), + string(EndpointProvisioningStateFailed), + string(EndpointProvisioningStateMoving), + string(EndpointProvisioningStateProvisioning), + string(EndpointProvisioningStateRestoring), + string(EndpointProvisioningStateSucceeded), + string(EndpointProvisioningStateSuspending), + string(EndpointProvisioningStateWarning), + } +} + +func parseEndpointProvisioningState(input string) (*EndpointProvisioningState, error) { + vals := map[string]EndpointProvisioningState{ + "canceled": EndpointProvisioningStateCanceled, + "deleted": EndpointProvisioningStateDeleted, + "deleting": EndpointProvisioningStateDeleting, + "disabled": EndpointProvisioningStateDisabled, + "failed": EndpointProvisioningStateFailed, + "moving": EndpointProvisioningStateMoving, + "provisioning": EndpointProvisioningStateProvisioning, + "restoring": EndpointProvisioningStateRestoring, + "succeeded": EndpointProvisioningStateSucceeded, + "suspending": EndpointProvisioningStateSuspending, + "warning": EndpointProvisioningStateWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EndpointProvisioningState(input) + return &out, nil +} + +type EndpointType string + +const ( + EndpointTypeEventGrid EndpointType = "EventGrid" + EndpointTypeEventHub EndpointType = "EventHub" + EndpointTypeServiceBus EndpointType = "ServiceBus" +) + +func PossibleValuesForEndpointType() []string { + return []string{ + string(EndpointTypeEventGrid), + string(EndpointTypeEventHub), + string(EndpointTypeServiceBus), + } +} + +func parseEndpointType(input string) (*EndpointType, error) { + vals := map[string]EndpointType{ + "eventgrid": EndpointTypeEventGrid, + "eventhub": EndpointTypeEventHub, + "servicebus": EndpointTypeServiceBus, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EndpointType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/id_digitaltwinsinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/id_digitaltwinsinstance.go new file mode 100644 index 000000000000..6246cac5114a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/id_digitaltwinsinstance.go @@ -0,0 +1,124 @@ +package endpoints + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DigitalTwinsInstanceId{} + +// DigitalTwinsInstanceId is a struct representing the Resource ID for a Digital Twins Instance +type DigitalTwinsInstanceId struct { + SubscriptionId string + ResourceGroupName string + DigitalTwinsInstanceName string +} + +// NewDigitalTwinsInstanceID returns a new DigitalTwinsInstanceId struct +func NewDigitalTwinsInstanceID(subscriptionId string, resourceGroupName string, digitalTwinsInstanceName string) DigitalTwinsInstanceId { + return DigitalTwinsInstanceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DigitalTwinsInstanceName: digitalTwinsInstanceName, + } +} + +// ParseDigitalTwinsInstanceID parses 'input' into a DigitalTwinsInstanceId +func ParseDigitalTwinsInstanceID(input string) (*DigitalTwinsInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(DigitalTwinsInstanceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DigitalTwinsInstanceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'digitalTwinsInstanceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDigitalTwinsInstanceIDInsensitively parses 'input' case-insensitively into a DigitalTwinsInstanceId +// note: this method should only be used for API response data and not user input +func ParseDigitalTwinsInstanceIDInsensitively(input string) (*DigitalTwinsInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(DigitalTwinsInstanceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DigitalTwinsInstanceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'digitalTwinsInstanceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDigitalTwinsInstanceID checks that 'input' can be parsed as a Digital Twins Instance ID +func ValidateDigitalTwinsInstanceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDigitalTwinsInstanceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Digital Twins Instance ID +func (id DigitalTwinsInstanceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DigitalTwins/digitalTwinsInstances/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DigitalTwinsInstanceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Digital Twins Instance ID +func (id DigitalTwinsInstanceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDigitalTwins", "Microsoft.DigitalTwins", "Microsoft.DigitalTwins"), + resourceids.StaticSegment("staticDigitalTwinsInstances", "digitalTwinsInstances", "digitalTwinsInstances"), + resourceids.UserSpecifiedSegment("digitalTwinsInstanceName", "digitalTwinsInstanceValue"), + } +} + +// String returns a human-readable description of this Digital Twins Instance ID +func (id DigitalTwinsInstanceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Digital Twins Instance Name: %q", id.DigitalTwinsInstanceName), + } + return fmt.Sprintf("Digital Twins Instance (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/id_endpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/id_endpoint.go new file mode 100644 index 000000000000..70ffa1cf8854 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/id_endpoint.go @@ -0,0 +1,137 @@ +package endpoints + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = EndpointId{} + +// EndpointId is a struct representing the Resource ID for a Endpoint +type EndpointId struct { + SubscriptionId string + ResourceGroupName string + DigitalTwinsInstanceName string + EndpointName string +} + +// NewEndpointID returns a new EndpointId struct +func NewEndpointID(subscriptionId string, resourceGroupName string, digitalTwinsInstanceName string, endpointName string) EndpointId { + return EndpointId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DigitalTwinsInstanceName: digitalTwinsInstanceName, + EndpointName: endpointName, + } +} + +// ParseEndpointID parses 'input' into a EndpointId +func ParseEndpointID(input string) (*EndpointId, error) { + parser := resourceids.NewParserFromResourceIdType(EndpointId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := EndpointId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'digitalTwinsInstanceName' was not found in the resource id %q", input) + } + + if id.EndpointName, ok = parsed.Parsed["endpointName"]; !ok { + return nil, fmt.Errorf("the segment 'endpointName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseEndpointIDInsensitively parses 'input' case-insensitively into a EndpointId +// note: this method should only be used for API response data and not user input +func ParseEndpointIDInsensitively(input string) (*EndpointId, error) { + parser := resourceids.NewParserFromResourceIdType(EndpointId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := EndpointId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'digitalTwinsInstanceName' was not found in the resource id %q", input) + } + + if id.EndpointName, ok = parsed.Parsed["endpointName"]; !ok { + return nil, fmt.Errorf("the segment 'endpointName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateEndpointID checks that 'input' can be parsed as a Endpoint ID +func ValidateEndpointID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseEndpointID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Endpoint ID +func (id EndpointId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DigitalTwins/digitalTwinsInstances/%s/endpoints/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DigitalTwinsInstanceName, id.EndpointName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Endpoint ID +func (id EndpointId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDigitalTwins", "Microsoft.DigitalTwins", "Microsoft.DigitalTwins"), + resourceids.StaticSegment("staticDigitalTwinsInstances", "digitalTwinsInstances", "digitalTwinsInstances"), + resourceids.UserSpecifiedSegment("digitalTwinsInstanceName", "digitalTwinsInstanceValue"), + resourceids.StaticSegment("staticEndpoints", "endpoints", "endpoints"), + resourceids.UserSpecifiedSegment("endpointName", "endpointValue"), + } +} + +// String returns a human-readable description of this Endpoint ID +func (id EndpointId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Digital Twins Instance Name: %q", id.DigitalTwinsInstanceName), + fmt.Sprintf("Endpoint Name: %q", id.EndpointName), + } + return fmt.Sprintf("Endpoint (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/method_digitaltwinsendpointcreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/method_digitaltwinsendpointcreateorupdate_autorest.go new file mode 100644 index 000000000000..68eb02ceda3c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/method_digitaltwinsendpointcreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package endpoints + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsEndpointCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DigitalTwinsEndpointCreateOrUpdate ... +func (c EndpointsClient) DigitalTwinsEndpointCreateOrUpdate(ctx context.Context, id EndpointId, input DigitalTwinsEndpointResource) (result DigitalTwinsEndpointCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForDigitalTwinsEndpointCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "DigitalTwinsEndpointCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForDigitalTwinsEndpointCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "DigitalTwinsEndpointCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DigitalTwinsEndpointCreateOrUpdateThenPoll performs DigitalTwinsEndpointCreateOrUpdate then polls until it's completed +func (c EndpointsClient) DigitalTwinsEndpointCreateOrUpdateThenPoll(ctx context.Context, id EndpointId, input DigitalTwinsEndpointResource) error { + result, err := c.DigitalTwinsEndpointCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DigitalTwinsEndpointCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DigitalTwinsEndpointCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForDigitalTwinsEndpointCreateOrUpdate prepares the DigitalTwinsEndpointCreateOrUpdate request. +func (c EndpointsClient) preparerForDigitalTwinsEndpointCreateOrUpdate(ctx context.Context, id EndpointId, input DigitalTwinsEndpointResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDigitalTwinsEndpointCreateOrUpdate sends the DigitalTwinsEndpointCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c EndpointsClient) senderForDigitalTwinsEndpointCreateOrUpdate(ctx context.Context, req *http.Request) (future DigitalTwinsEndpointCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/method_digitaltwinsendpointdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/method_digitaltwinsendpointdelete_autorest.go new file mode 100644 index 000000000000..4c6005000c06 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/method_digitaltwinsendpointdelete_autorest.go @@ -0,0 +1,78 @@ +package endpoints + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsEndpointDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DigitalTwinsEndpointDelete ... +func (c EndpointsClient) DigitalTwinsEndpointDelete(ctx context.Context, id EndpointId) (result DigitalTwinsEndpointDeleteOperationResponse, err error) { + req, err := c.preparerForDigitalTwinsEndpointDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "DigitalTwinsEndpointDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDigitalTwinsEndpointDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "DigitalTwinsEndpointDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DigitalTwinsEndpointDeleteThenPoll performs DigitalTwinsEndpointDelete then polls until it's completed +func (c EndpointsClient) DigitalTwinsEndpointDeleteThenPoll(ctx context.Context, id EndpointId) error { + result, err := c.DigitalTwinsEndpointDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing DigitalTwinsEndpointDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DigitalTwinsEndpointDelete: %+v", err) + } + + return nil +} + +// preparerForDigitalTwinsEndpointDelete prepares the DigitalTwinsEndpointDelete request. +func (c EndpointsClient) preparerForDigitalTwinsEndpointDelete(ctx context.Context, id EndpointId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDigitalTwinsEndpointDelete sends the DigitalTwinsEndpointDelete request. The method will close the +// http.Response Body if it receives an error. +func (c EndpointsClient) senderForDigitalTwinsEndpointDelete(ctx context.Context, req *http.Request) (future DigitalTwinsEndpointDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/method_digitaltwinsendpointget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/method_digitaltwinsendpointget_autorest.go new file mode 100644 index 000000000000..19404bc254bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/method_digitaltwinsendpointget_autorest.go @@ -0,0 +1,68 @@ +package endpoints + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsEndpointGetOperationResponse struct { + HttpResponse *http.Response + Model *DigitalTwinsEndpointResource +} + +// DigitalTwinsEndpointGet ... +func (c EndpointsClient) DigitalTwinsEndpointGet(ctx context.Context, id EndpointId) (result DigitalTwinsEndpointGetOperationResponse, err error) { + req, err := c.preparerForDigitalTwinsEndpointGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "DigitalTwinsEndpointGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "DigitalTwinsEndpointGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDigitalTwinsEndpointGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "DigitalTwinsEndpointGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDigitalTwinsEndpointGet prepares the DigitalTwinsEndpointGet request. +func (c EndpointsClient) preparerForDigitalTwinsEndpointGet(ctx context.Context, id EndpointId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDigitalTwinsEndpointGet handles the response to the DigitalTwinsEndpointGet request. The method always +// closes the http.Response Body. +func (c EndpointsClient) responderForDigitalTwinsEndpointGet(resp *http.Response) (result DigitalTwinsEndpointGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/method_digitaltwinsendpointlist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/method_digitaltwinsendpointlist_autorest.go new file mode 100644 index 000000000000..f8348f56ef25 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/method_digitaltwinsendpointlist_autorest.go @@ -0,0 +1,186 @@ +package endpoints + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsEndpointListOperationResponse struct { + HttpResponse *http.Response + Model *[]DigitalTwinsEndpointResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (DigitalTwinsEndpointListOperationResponse, error) +} + +type DigitalTwinsEndpointListCompleteResult struct { + Items []DigitalTwinsEndpointResource +} + +func (r DigitalTwinsEndpointListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r DigitalTwinsEndpointListOperationResponse) LoadMore(ctx context.Context) (resp DigitalTwinsEndpointListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// DigitalTwinsEndpointList ... +func (c EndpointsClient) DigitalTwinsEndpointList(ctx context.Context, id DigitalTwinsInstanceId) (resp DigitalTwinsEndpointListOperationResponse, err error) { + req, err := c.preparerForDigitalTwinsEndpointList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "DigitalTwinsEndpointList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "DigitalTwinsEndpointList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForDigitalTwinsEndpointList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "DigitalTwinsEndpointList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForDigitalTwinsEndpointList prepares the DigitalTwinsEndpointList request. +func (c EndpointsClient) preparerForDigitalTwinsEndpointList(ctx context.Context, id DigitalTwinsInstanceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/endpoints", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForDigitalTwinsEndpointListWithNextLink prepares the DigitalTwinsEndpointList request with the given nextLink token. +func (c EndpointsClient) preparerForDigitalTwinsEndpointListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDigitalTwinsEndpointList handles the response to the DigitalTwinsEndpointList request. The method always +// closes the http.Response Body. +func (c EndpointsClient) responderForDigitalTwinsEndpointList(resp *http.Response) (result DigitalTwinsEndpointListOperationResponse, err error) { + type page struct { + Values []DigitalTwinsEndpointResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result DigitalTwinsEndpointListOperationResponse, err error) { + req, err := c.preparerForDigitalTwinsEndpointListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "DigitalTwinsEndpointList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "DigitalTwinsEndpointList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDigitalTwinsEndpointList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "DigitalTwinsEndpointList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// DigitalTwinsEndpointListComplete retrieves all of the results into a single object +func (c EndpointsClient) DigitalTwinsEndpointListComplete(ctx context.Context, id DigitalTwinsInstanceId) (DigitalTwinsEndpointListCompleteResult, error) { + return c.DigitalTwinsEndpointListCompleteMatchingPredicate(ctx, id, DigitalTwinsEndpointResourceOperationPredicate{}) +} + +// DigitalTwinsEndpointListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c EndpointsClient) DigitalTwinsEndpointListCompleteMatchingPredicate(ctx context.Context, id DigitalTwinsInstanceId, predicate DigitalTwinsEndpointResourceOperationPredicate) (resp DigitalTwinsEndpointListCompleteResult, err error) { + items := make([]DigitalTwinsEndpointResource, 0) + + page, err := c.DigitalTwinsEndpointList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := DigitalTwinsEndpointListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/model_digitaltwinsendpointresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/model_digitaltwinsendpointresource.go new file mode 100644 index 000000000000..3c5c362315b4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/model_digitaltwinsendpointresource.go @@ -0,0 +1,44 @@ +package endpoints + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsEndpointResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties DigitalTwinsEndpointResourceProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} + +var _ json.Unmarshaler = &DigitalTwinsEndpointResource{} + +func (s *DigitalTwinsEndpointResource) UnmarshalJSON(bytes []byte) error { + type alias DigitalTwinsEndpointResource + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into DigitalTwinsEndpointResource: %+v", err) + } + + s.Id = decoded.Id + s.Name = decoded.Name + s.Type = decoded.Type + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling DigitalTwinsEndpointResource into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["properties"]; ok { + impl, err := unmarshalDigitalTwinsEndpointResourcePropertiesImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Properties' for 'DigitalTwinsEndpointResource': %+v", err) + } + s.Properties = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/model_digitaltwinsendpointresourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/model_digitaltwinsendpointresourceproperties.go new file mode 100644 index 000000000000..7b376b639f0c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/model_digitaltwinsendpointresourceproperties.go @@ -0,0 +1,64 @@ +package endpoints + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DigitalTwinsEndpointResourceProperties interface { +} + +func unmarshalDigitalTwinsEndpointResourcePropertiesImplementation(input []byte) (DigitalTwinsEndpointResourceProperties, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling DigitalTwinsEndpointResourceProperties into map[string]interface: %+v", err) + } + + value, ok := temp["endpointType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "EventGrid") { + var out EventGrid + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into EventGrid: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "EventHub") { + var out EventHub + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into EventHub: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ServiceBus") { + var out ServiceBus + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServiceBus: %+v", err) + } + return out, nil + } + + type RawDigitalTwinsEndpointResourcePropertiesImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawDigitalTwinsEndpointResourcePropertiesImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/model_eventgrid.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/model_eventgrid.go new file mode 100644 index 000000000000..764ea278370f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/model_eventgrid.go @@ -0,0 +1,63 @@ +package endpoints + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DigitalTwinsEndpointResourceProperties = EventGrid{} + +type EventGrid struct { + AccessKey1 *string `json:"accessKey1,omitempty"` + AccessKey2 *string `json:"accessKey2,omitempty"` + TopicEndpoint *string `json:"TopicEndpoint,omitempty"` + + // Fields inherited from DigitalTwinsEndpointResourceProperties + AuthenticationType *AuthenticationType `json:"authenticationType,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` + DeadLetterSecret *string `json:"deadLetterSecret,omitempty"` + DeadLetterUri *string `json:"deadLetterUri,omitempty"` + ProvisioningState *EndpointProvisioningState `json:"provisioningState,omitempty"` +} + +func (o *EventGrid) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *EventGrid) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} + +var _ json.Marshaler = EventGrid{} + +func (s EventGrid) MarshalJSON() ([]byte, error) { + type wrapper EventGrid + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling EventGrid: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling EventGrid: %+v", err) + } + decoded["endpointType"] = "EventGrid" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling EventGrid: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/model_eventhub.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/model_eventhub.go new file mode 100644 index 000000000000..8c8a4e99e259 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/model_eventhub.go @@ -0,0 +1,64 @@ +package endpoints + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DigitalTwinsEndpointResourceProperties = EventHub{} + +type EventHub struct { + ConnectionStringPrimaryKey *string `json:"connectionStringPrimaryKey,omitempty"` + ConnectionStringSecondaryKey *string `json:"connectionStringSecondaryKey,omitempty"` + EndpointUri *string `json:"endpointUri,omitempty"` + EntityPath *string `json:"entityPath,omitempty"` + + // Fields inherited from DigitalTwinsEndpointResourceProperties + AuthenticationType *AuthenticationType `json:"authenticationType,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` + DeadLetterSecret *string `json:"deadLetterSecret,omitempty"` + DeadLetterUri *string `json:"deadLetterUri,omitempty"` + ProvisioningState *EndpointProvisioningState `json:"provisioningState,omitempty"` +} + +func (o *EventHub) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *EventHub) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} + +var _ json.Marshaler = EventHub{} + +func (s EventHub) MarshalJSON() ([]byte, error) { + type wrapper EventHub + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling EventHub: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling EventHub: %+v", err) + } + decoded["endpointType"] = "EventHub" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling EventHub: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/model_servicebus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/model_servicebus.go new file mode 100644 index 000000000000..ef47b978b74f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/model_servicebus.go @@ -0,0 +1,64 @@ +package endpoints + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DigitalTwinsEndpointResourceProperties = ServiceBus{} + +type ServiceBus struct { + EndpointUri *string `json:"endpointUri,omitempty"` + EntityPath *string `json:"entityPath,omitempty"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + + // Fields inherited from DigitalTwinsEndpointResourceProperties + AuthenticationType *AuthenticationType `json:"authenticationType,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` + DeadLetterSecret *string `json:"deadLetterSecret,omitempty"` + DeadLetterUri *string `json:"deadLetterUri,omitempty"` + ProvisioningState *EndpointProvisioningState `json:"provisioningState,omitempty"` +} + +func (o *ServiceBus) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ServiceBus) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} + +var _ json.Marshaler = ServiceBus{} + +func (s ServiceBus) MarshalJSON() ([]byte, error) { + type wrapper ServiceBus + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServiceBus: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServiceBus: %+v", err) + } + decoded["endpointType"] = "ServiceBus" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServiceBus: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/predicates.go new file mode 100644 index 000000000000..42635690d563 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/predicates.go @@ -0,0 +1,24 @@ +package endpoints + +type DigitalTwinsEndpointResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DigitalTwinsEndpointResourceOperationPredicate) Matches(input DigitalTwinsEndpointResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/version.go new file mode 100644 index 000000000000..6d9face18bc7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints/version.go @@ -0,0 +1,12 @@ +package endpoints + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/endpoints/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/README.md index 68d6fc87ba7e..65c9a9a19de6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := timeseriesdatabaseconnections.NewTimeSeriesDatabaseConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "timeSeriesDatabaseConnectionValue") +id := timeseriesdatabaseconnections.NewTimeSeriesDatabaseConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "digitalTwinsInstanceValue", "timeSeriesDatabaseConnectionValue") payload := timeseriesdatabaseconnections.TimeSeriesDatabaseConnection{ // ... @@ -41,7 +41,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := timeseriesdatabaseconnections.NewTimeSeriesDatabaseConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "timeSeriesDatabaseConnectionValue") +id := timeseriesdatabaseconnections.NewTimeSeriesDatabaseConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "digitalTwinsInstanceValue", "timeSeriesDatabaseConnectionValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := timeseriesdatabaseconnections.NewTimeSeriesDatabaseConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "timeSeriesDatabaseConnectionValue") +id := timeseriesdatabaseconnections.NewTimeSeriesDatabaseConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "digitalTwinsInstanceValue", "timeSeriesDatabaseConnectionValue") read, err := client.Get(ctx, id) if err != nil { @@ -69,7 +69,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := timeseriesdatabaseconnections.NewDigitalTwinsInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := timeseriesdatabaseconnections.NewDigitalTwinsInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "digitalTwinsInstanceValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/id_digitaltwinsinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/id_digitaltwinsinstance.go index 63c1810a19ec..a3dece422757 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/id_digitaltwinsinstance.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/id_digitaltwinsinstance.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = DigitalTwinsInstanceId{} // DigitalTwinsInstanceId is a struct representing the Resource ID for a Digital Twins Instance type DigitalTwinsInstanceId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string + SubscriptionId string + ResourceGroupName string + DigitalTwinsInstanceName string } // NewDigitalTwinsInstanceID returns a new DigitalTwinsInstanceId struct -func NewDigitalTwinsInstanceID(subscriptionId string, resourceGroupName string, resourceName string) DigitalTwinsInstanceId { +func NewDigitalTwinsInstanceID(subscriptionId string, resourceGroupName string, digitalTwinsInstanceName string) DigitalTwinsInstanceId { return DigitalTwinsInstanceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DigitalTwinsInstanceName: digitalTwinsInstanceName, } } @@ -44,8 +44,8 @@ func ParseDigitalTwinsInstanceID(input string) (*DigitalTwinsInstanceId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'digitalTwinsInstanceName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseDigitalTwinsInstanceIDInsensitively(input string) (*DigitalTwinsInstan return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'digitalTwinsInstanceName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateDigitalTwinsInstanceID(input interface{}, key string) (warnings []s // ID returns the formatted Digital Twins Instance ID func (id DigitalTwinsInstanceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DigitalTwins/digitalTwinsInstances/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DigitalTwinsInstanceName) } // Segments returns a slice of Resource ID Segments which comprise this Digital Twins Instance ID @@ -109,7 +109,7 @@ func (id DigitalTwinsInstanceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDigitalTwins", "Microsoft.DigitalTwins", "Microsoft.DigitalTwins"), resourceids.StaticSegment("staticDigitalTwinsInstances", "digitalTwinsInstances", "digitalTwinsInstances"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("digitalTwinsInstanceName", "digitalTwinsInstanceValue"), } } @@ -118,7 +118,7 @@ func (id DigitalTwinsInstanceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Digital Twins Instance Name: %q", id.DigitalTwinsInstanceName), } return fmt.Sprintf("Digital Twins Instance (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/id_timeseriesdatabaseconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/id_timeseriesdatabaseconnection.go index 6280b2164cfc..945503ad6cb9 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/id_timeseriesdatabaseconnection.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections/id_timeseriesdatabaseconnection.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = TimeSeriesDatabaseConnectionId{} type TimeSeriesDatabaseConnectionId struct { SubscriptionId string ResourceGroupName string - ResourceName string + DigitalTwinsInstanceName string TimeSeriesDatabaseConnectionName string } // NewTimeSeriesDatabaseConnectionID returns a new TimeSeriesDatabaseConnectionId struct -func NewTimeSeriesDatabaseConnectionID(subscriptionId string, resourceGroupName string, resourceName string, timeSeriesDatabaseConnectionName string) TimeSeriesDatabaseConnectionId { +func NewTimeSeriesDatabaseConnectionID(subscriptionId string, resourceGroupName string, digitalTwinsInstanceName string, timeSeriesDatabaseConnectionName string) TimeSeriesDatabaseConnectionId { return TimeSeriesDatabaseConnectionId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + DigitalTwinsInstanceName: digitalTwinsInstanceName, TimeSeriesDatabaseConnectionName: timeSeriesDatabaseConnectionName, } } @@ -46,8 +46,8 @@ func ParseTimeSeriesDatabaseConnectionID(input string) (*TimeSeriesDatabaseConne return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'digitalTwinsInstanceName' was not found in the resource id %q", input) } if id.TimeSeriesDatabaseConnectionName, ok = parsed.Parsed["timeSeriesDatabaseConnectionName"]; !ok { @@ -77,8 +77,8 @@ func ParseTimeSeriesDatabaseConnectionIDInsensitively(input string) (*TimeSeries return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'digitalTwinsInstanceName' was not found in the resource id %q", input) } if id.TimeSeriesDatabaseConnectionName, ok = parsed.Parsed["timeSeriesDatabaseConnectionName"]; !ok { @@ -106,7 +106,7 @@ func ValidateTimeSeriesDatabaseConnectionID(input interface{}, key string) (warn // ID returns the formatted Time Series Database Connection ID func (id TimeSeriesDatabaseConnectionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DigitalTwins/digitalTwinsInstances/%s/timeSeriesDatabaseConnections/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.TimeSeriesDatabaseConnectionName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DigitalTwinsInstanceName, id.TimeSeriesDatabaseConnectionName) } // Segments returns a slice of Resource ID Segments which comprise this Time Series Database Connection ID @@ -119,7 +119,7 @@ func (id TimeSeriesDatabaseConnectionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDigitalTwins", "Microsoft.DigitalTwins", "Microsoft.DigitalTwins"), resourceids.StaticSegment("staticDigitalTwinsInstances", "digitalTwinsInstances", "digitalTwinsInstances"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("digitalTwinsInstanceName", "digitalTwinsInstanceValue"), resourceids.StaticSegment("staticTimeSeriesDatabaseConnections", "timeSeriesDatabaseConnections", "timeSeriesDatabaseConnections"), resourceids.UserSpecifiedSegment("timeSeriesDatabaseConnectionName", "timeSeriesDatabaseConnectionValue"), } @@ -130,7 +130,7 @@ func (id TimeSeriesDatabaseConnectionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Digital Twins Instance Name: %q", id.DigitalTwinsInstanceName), fmt.Sprintf("Time Series Database Connection Name: %q", id.TimeSeriesDatabaseConnectionName), } return fmt.Sprintf("Time Series Database Connection (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/README.md index 9f4dd1a28150..99f2fceade27 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue", "A", "relativeRecordSetValue") +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneValue", "A", "relativeRecordSetValue") payload := recordsets.RecordSet{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue", "A", "relativeRecordSetValue") +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneValue", "A", "relativeRecordSetValue") read, err := client.Delete(ctx, id, recordsets.DefaultDeleteOperationOptions()) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue", "A", "relativeRecordSetValue") +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneValue", "A", "relativeRecordSetValue") read, err := client.Get(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := recordsets.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue") +id := recordsets.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneValue") // alternatively `client.ListAllByDnsZone(ctx, id, recordsets.DefaultListAllByDnsZoneOperationOptions())` can be used to do batched pagination items, err := client.ListAllByDnsZoneComplete(ctx, id, recordsets.DefaultListAllByDnsZoneOperationOptions()) @@ -94,7 +94,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := recordsets.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue") +id := recordsets.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneValue") // alternatively `client.ListByDnsZone(ctx, id, recordsets.DefaultListByDnsZoneOperationOptions())` can be used to do batched pagination items, err := client.ListByDnsZoneComplete(ctx, id, recordsets.DefaultListByDnsZoneOperationOptions()) @@ -111,7 +111,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := recordsets.NewZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue", "A") +id := recordsets.NewZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneValue", "A") // alternatively `client.ListByType(ctx, id, recordsets.DefaultListByTypeOperationOptions())` can be used to do batched pagination items, err := client.ListByTypeComplete(ctx, id, recordsets.DefaultListByTypeOperationOptions()) @@ -128,7 +128,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue", "A", "relativeRecordSetValue") +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneValue", "A", "relativeRecordSetValue") payload := recordsets.RecordSet{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_dnszone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_dnszone.go index 106e7a4319c2..4fbb4c9d1eae 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_dnszone.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_dnszone.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = DnsZoneId{} type DnsZoneId struct { SubscriptionId string ResourceGroupName string - ZoneName string + DnsZoneName string } // NewDnsZoneID returns a new DnsZoneId struct -func NewDnsZoneID(subscriptionId string, resourceGroupName string, zoneName string) DnsZoneId { +func NewDnsZoneID(subscriptionId string, resourceGroupName string, dnsZoneName string) DnsZoneId { return DnsZoneId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ZoneName: zoneName, + DnsZoneName: dnsZoneName, } } @@ -44,8 +44,8 @@ func ParseDnsZoneID(input string) (*DnsZoneId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { - return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + if id.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'dnsZoneName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseDnsZoneIDInsensitively(input string) (*DnsZoneId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { - return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + if id.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'dnsZoneName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateDnsZoneID(input interface{}, key string) (warnings []string, errors // ID returns the formatted Dns Zone ID func (id DnsZoneId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnsZones/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ZoneName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DnsZoneName) } // Segments returns a slice of Resource ID Segments which comprise this Dns Zone ID @@ -109,7 +109,7 @@ func (id DnsZoneId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), resourceids.StaticSegment("staticDnsZones", "dnsZones", "dnsZones"), - resourceids.UserSpecifiedSegment("zoneName", "zoneValue"), + resourceids.UserSpecifiedSegment("dnsZoneName", "dnsZoneValue"), } } @@ -118,7 +118,7 @@ func (id DnsZoneId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Zone Name: %q", id.ZoneName), + fmt.Sprintf("Dns Zone Name: %q", id.DnsZoneName), } return fmt.Sprintf("Dns Zone (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_recordtype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_recordtype.go index 8b8a6ca07bda..4167b5b02184 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_recordtype.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_recordtype.go @@ -13,17 +13,17 @@ var _ resourceids.ResourceId = RecordTypeId{} type RecordTypeId struct { SubscriptionId string ResourceGroupName string - ZoneName string + DnsZoneName string RecordType RecordType RelativeRecordSetName string } // NewRecordTypeID returns a new RecordTypeId struct -func NewRecordTypeID(subscriptionId string, resourceGroupName string, zoneName string, recordType RecordType, relativeRecordSetName string) RecordTypeId { +func NewRecordTypeID(subscriptionId string, resourceGroupName string, dnsZoneName string, recordType RecordType, relativeRecordSetName string) RecordTypeId { return RecordTypeId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ZoneName: zoneName, + DnsZoneName: dnsZoneName, RecordType: recordType, RelativeRecordSetName: relativeRecordSetName, } @@ -48,8 +48,8 @@ func ParseRecordTypeID(input string) (*RecordTypeId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { - return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + if id.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'dnsZoneName' was not found in the resource id %q", input) } if v, ok := parsed.Parsed["recordType"]; true { @@ -91,8 +91,8 @@ func ParseRecordTypeIDInsensitively(input string) (*RecordTypeId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { - return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + if id.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'dnsZoneName' was not found in the resource id %q", input) } if v, ok := parsed.Parsed["recordType"]; true { @@ -132,7 +132,7 @@ func ValidateRecordTypeID(input interface{}, key string) (warnings []string, err // ID returns the formatted Record Type ID func (id RecordTypeId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnsZones/%s/%s/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ZoneName, string(id.RecordType), id.RelativeRecordSetName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DnsZoneName, string(id.RecordType), id.RelativeRecordSetName) } // Segments returns a slice of Resource ID Segments which comprise this Record Type ID @@ -145,7 +145,7 @@ func (id RecordTypeId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), resourceids.StaticSegment("staticDnsZones", "dnsZones", "dnsZones"), - resourceids.UserSpecifiedSegment("zoneName", "zoneValue"), + resourceids.UserSpecifiedSegment("dnsZoneName", "dnsZoneValue"), resourceids.ConstantSegment("recordType", PossibleValuesForRecordType(), "A"), resourceids.UserSpecifiedSegment("relativeRecordSetName", "relativeRecordSetValue"), } @@ -156,7 +156,7 @@ func (id RecordTypeId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Zone Name: %q", id.ZoneName), + fmt.Sprintf("Dns Zone Name: %q", id.DnsZoneName), fmt.Sprintf("Record Type: %q", string(id.RecordType)), fmt.Sprintf("Relative Record Set Name: %q", id.RelativeRecordSetName), } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_zone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_zone.go index 17d92e82ceb4..5a682b2b4af7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_zone.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_zone.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = ZoneId{} type ZoneId struct { SubscriptionId string ResourceGroupName string - ZoneName string + DnsZoneName string RecordType RecordType } // NewZoneID returns a new ZoneId struct -func NewZoneID(subscriptionId string, resourceGroupName string, zoneName string, recordType RecordType) ZoneId { +func NewZoneID(subscriptionId string, resourceGroupName string, dnsZoneName string, recordType RecordType) ZoneId { return ZoneId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ZoneName: zoneName, + DnsZoneName: dnsZoneName, RecordType: recordType, } } @@ -46,8 +46,8 @@ func ParseZoneID(input string) (*ZoneId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { - return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + if id.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'dnsZoneName' was not found in the resource id %q", input) } if v, ok := parsed.Parsed["recordType"]; true { @@ -85,8 +85,8 @@ func ParseZoneIDInsensitively(input string) (*ZoneId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { - return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + if id.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'dnsZoneName' was not found in the resource id %q", input) } if v, ok := parsed.Parsed["recordType"]; true { @@ -122,7 +122,7 @@ func ValidateZoneID(input interface{}, key string) (warnings []string, errors [] // ID returns the formatted Zone ID func (id ZoneId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnsZones/%s/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ZoneName, string(id.RecordType)) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DnsZoneName, string(id.RecordType)) } // Segments returns a slice of Resource ID Segments which comprise this Zone ID @@ -135,7 +135,7 @@ func (id ZoneId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), resourceids.StaticSegment("staticDnsZones", "dnsZones", "dnsZones"), - resourceids.UserSpecifiedSegment("zoneName", "zoneValue"), + resourceids.UserSpecifiedSegment("dnsZoneName", "dnsZoneValue"), resourceids.ConstantSegment("recordType", PossibleValuesForRecordType(), "A"), } } @@ -145,7 +145,7 @@ func (id ZoneId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Zone Name: %q", id.ZoneName), + fmt.Sprintf("Dns Zone Name: %q", id.DnsZoneName), fmt.Sprintf("Record Type: %q", string(id.RecordType)), } return fmt.Sprintf("Zone (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/README.md index 3fad79a0b70f..29f757e9a0b8 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue") +id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneValue") payload := zones.Zone{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue") +id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneValue") if err := client.DeleteThenPoll(ctx, id, zones.DefaultDeleteOperationOptions()); err != nil { // handle the error @@ -57,7 +57,7 @@ if err := client.DeleteThenPoll(ctx, id, zones.DefaultDeleteOperationOptions()); ```go ctx := context.TODO() -id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue") +id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneValue") read, err := client.Get(ctx, id) if err != nil { @@ -107,7 +107,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue") +id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dnsZoneValue") payload := zones.ZoneUpdate{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/id_dnszone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/id_dnszone.go index cde7778f9a2f..7de670aeb752 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/id_dnszone.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/id_dnszone.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = DnsZoneId{} type DnsZoneId struct { SubscriptionId string ResourceGroupName string - ZoneName string + DnsZoneName string } // NewDnsZoneID returns a new DnsZoneId struct -func NewDnsZoneID(subscriptionId string, resourceGroupName string, zoneName string) DnsZoneId { +func NewDnsZoneID(subscriptionId string, resourceGroupName string, dnsZoneName string) DnsZoneId { return DnsZoneId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ZoneName: zoneName, + DnsZoneName: dnsZoneName, } } @@ -44,8 +44,8 @@ func ParseDnsZoneID(input string) (*DnsZoneId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { - return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + if id.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'dnsZoneName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseDnsZoneIDInsensitively(input string) (*DnsZoneId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { - return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + if id.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'dnsZoneName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateDnsZoneID(input interface{}, key string) (warnings []string, errors // ID returns the formatted Dns Zone ID func (id DnsZoneId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnsZones/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ZoneName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DnsZoneName) } // Segments returns a slice of Resource ID Segments which comprise this Dns Zone ID @@ -109,7 +109,7 @@ func (id DnsZoneId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), resourceids.StaticSegment("staticDnsZones", "dnsZones", "dnsZones"), - resourceids.UserSpecifiedSegment("zoneName", "zoneValue"), + resourceids.UserSpecifiedSegment("dnsZoneName", "dnsZoneValue"), } } @@ -118,7 +118,7 @@ func (id DnsZoneId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Zone Name: %q", id.ZoneName), + fmt.Sprintf("Dns Zone Name: %q", id.DnsZoneName), } return fmt.Sprintf("Dns Zone (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/README.md index 5de2943dc505..75fe173aab7c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := rules.NewTagRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "ruleSetValue") +id := rules.NewTagRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "tagRuleValue") payload := rules.MonitoringTagRules{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := rules.NewTagRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "ruleSetValue") +id := rules.NewTagRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "tagRuleValue") if err := client.TagRulesDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -57,7 +57,7 @@ if err := client.TagRulesDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := rules.NewTagRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "ruleSetValue") +id := rules.NewTagRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "tagRuleValue") read, err := client.TagRulesGet(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/id_tagrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/id_tagrule.go index d7176bac76d8..db6529b48dff 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/id_tagrule.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/id_tagrule.go @@ -14,16 +14,16 @@ type TagRuleId struct { SubscriptionId string ResourceGroupName string MonitorName string - RuleSetName string + TagRuleName string } // NewTagRuleID returns a new TagRuleId struct -func NewTagRuleID(subscriptionId string, resourceGroupName string, monitorName string, ruleSetName string) TagRuleId { +func NewTagRuleID(subscriptionId string, resourceGroupName string, monitorName string, tagRuleName string) TagRuleId { return TagRuleId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, MonitorName: monitorName, - RuleSetName: ruleSetName, + TagRuleName: tagRuleName, } } @@ -50,8 +50,8 @@ func ParseTagRuleID(input string) (*TagRuleId, error) { return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) } - if id.RuleSetName, ok = parsed.Parsed["ruleSetName"]; !ok { - return nil, fmt.Errorf("the segment 'ruleSetName' was not found in the resource id %q", input) + if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'tagRuleName' was not found in the resource id %q", input) } return &id, nil @@ -81,8 +81,8 @@ func ParseTagRuleIDInsensitively(input string) (*TagRuleId, error) { return nil, fmt.Errorf("the segment 'monitorName' was not found in the resource id %q", input) } - if id.RuleSetName, ok = parsed.Parsed["ruleSetName"]; !ok { - return nil, fmt.Errorf("the segment 'ruleSetName' was not found in the resource id %q", input) + if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'tagRuleName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateTagRuleID(input interface{}, key string) (warnings []string, errors // ID returns the formatted Tag Rule ID func (id TagRuleId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Elastic/monitors/%s/tagRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName, id.RuleSetName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MonitorName, id.TagRuleName) } // Segments returns a slice of Resource ID Segments which comprise this Tag Rule ID @@ -121,7 +121,7 @@ func (id TagRuleId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticMonitors", "monitors", "monitors"), resourceids.UserSpecifiedSegment("monitorName", "monitorValue"), resourceids.StaticSegment("staticTagRules", "tagRules", "tagRules"), - resourceids.UserSpecifiedSegment("ruleSetName", "ruleSetValue"), + resourceids.UserSpecifiedSegment("tagRuleName", "tagRuleValue"), } } @@ -131,7 +131,7 @@ func (id TagRuleId) String() string { fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Monitor Name: %q", id.MonitorName), - fmt.Sprintf("Rule Set Name: %q", id.RuleSetName), + fmt.Sprintf("Tag Rule Name: %q", id.TagRuleName), } return fmt.Sprintf("Tag Rule (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/README.md index af56440ddcf9..12828dc9f5b4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := authorizationruleseventhubs.NewEventhubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "authorizationRuleValue") +id := authorizationruleseventhubs.NewEventhubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventhubValue", "authorizationRuleValue") payload := authorizationruleseventhubs.AuthorizationRule{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := authorizationruleseventhubs.NewEventhubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue") +id := authorizationruleseventhubs.NewEventhubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventhubValue") // alternatively `client.EventHubsListAuthorizationRules(ctx, id)` can be used to do batched pagination items, err := client.EventHubsListAuthorizationRulesComplete(ctx, id) @@ -62,7 +62,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := authorizationruleseventhubs.NewEventhubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "authorizationRuleValue") +id := authorizationruleseventhubs.NewEventhubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventhubValue", "authorizationRuleValue") read, err := client.EventHubsListKeys(ctx, id) if err != nil { @@ -78,7 +78,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := authorizationruleseventhubs.NewEventhubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "authorizationRuleValue") +id := authorizationruleseventhubs.NewEventhubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventhubValue", "authorizationRuleValue") payload := authorizationruleseventhubs.RegenerateAccessKeyParameters{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhub.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhub.go index acff04d06b07..f29474e332e5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhub.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhub.go @@ -14,16 +14,16 @@ type EventhubId struct { SubscriptionId string ResourceGroupName string NamespaceName string - EventHubName string + EventhubName string } // NewEventhubID returns a new EventhubId struct -func NewEventhubID(subscriptionId string, resourceGroupName string, namespaceName string, eventHubName string) EventhubId { +func NewEventhubID(subscriptionId string, resourceGroupName string, namespaceName string, eventhubName string) EventhubId { return EventhubId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, NamespaceName: namespaceName, - EventHubName: eventHubName, + EventhubName: eventhubName, } } @@ -50,8 +50,8 @@ func ParseEventhubID(input string) (*EventhubId, error) { return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.EventHubName, ok = parsed.Parsed["eventHubName"]; !ok { - return nil, fmt.Errorf("the segment 'eventHubName' was not found in the resource id %q", input) + if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { + return nil, fmt.Errorf("the segment 'eventhubName' was not found in the resource id %q", input) } return &id, nil @@ -81,8 +81,8 @@ func ParseEventhubIDInsensitively(input string) (*EventhubId, error) { return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.EventHubName, ok = parsed.Parsed["eventHubName"]; !ok { - return nil, fmt.Errorf("the segment 'eventHubName' was not found in the resource id %q", input) + if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { + return nil, fmt.Errorf("the segment 'eventhubName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateEventhubID(input interface{}, key string) (warnings []string, error // ID returns the formatted Eventhub ID func (id EventhubId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventHub/namespaces/%s/eventhubs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventHubName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventhubName) } // Segments returns a slice of Resource ID Segments which comprise this Eventhub ID @@ -121,7 +121,7 @@ func (id EventhubId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), resourceids.StaticSegment("staticEventhubs", "eventhubs", "eventhubs"), - resourceids.UserSpecifiedSegment("eventHubName", "eventHubValue"), + resourceids.UserSpecifiedSegment("eventhubName", "eventhubValue"), } } @@ -131,7 +131,7 @@ func (id EventhubId) String() string { fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Namespace Name: %q", id.NamespaceName), - fmt.Sprintf("Event Hub Name: %q", id.EventHubName), + fmt.Sprintf("Eventhub Name: %q", id.EventhubName), } return fmt.Sprintf("Eventhub (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go index d43aaadceb3b..6162a3799f36 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go @@ -14,17 +14,17 @@ type EventhubAuthorizationRuleId struct { SubscriptionId string ResourceGroupName string NamespaceName string - EventHubName string + EventhubName string AuthorizationRuleName string } // NewEventhubAuthorizationRuleID returns a new EventhubAuthorizationRuleId struct -func NewEventhubAuthorizationRuleID(subscriptionId string, resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) EventhubAuthorizationRuleId { +func NewEventhubAuthorizationRuleID(subscriptionId string, resourceGroupName string, namespaceName string, eventhubName string, authorizationRuleName string) EventhubAuthorizationRuleId { return EventhubAuthorizationRuleId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, NamespaceName: namespaceName, - EventHubName: eventHubName, + EventhubName: eventhubName, AuthorizationRuleName: authorizationRuleName, } } @@ -52,8 +52,8 @@ func ParseEventhubAuthorizationRuleID(input string) (*EventhubAuthorizationRuleI return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.EventHubName, ok = parsed.Parsed["eventHubName"]; !ok { - return nil, fmt.Errorf("the segment 'eventHubName' was not found in the resource id %q", input) + if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { + return nil, fmt.Errorf("the segment 'eventhubName' was not found in the resource id %q", input) } if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { @@ -87,8 +87,8 @@ func ParseEventhubAuthorizationRuleIDInsensitively(input string) (*EventhubAutho return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.EventHubName, ok = parsed.Parsed["eventHubName"]; !ok { - return nil, fmt.Errorf("the segment 'eventHubName' was not found in the resource id %q", input) + if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { + return nil, fmt.Errorf("the segment 'eventhubName' was not found in the resource id %q", input) } if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { @@ -116,7 +116,7 @@ func ValidateEventhubAuthorizationRuleID(input interface{}, key string) (warning // ID returns the formatted Eventhub Authorization Rule ID func (id EventhubAuthorizationRuleId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventHub/namespaces/%s/eventhubs/%s/authorizationRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventHubName, id.AuthorizationRuleName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventhubName, id.AuthorizationRuleName) } // Segments returns a slice of Resource ID Segments which comprise this Eventhub Authorization Rule ID @@ -131,7 +131,7 @@ func (id EventhubAuthorizationRuleId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), resourceids.StaticSegment("staticEventhubs", "eventhubs", "eventhubs"), - resourceids.UserSpecifiedSegment("eventHubName", "eventHubValue"), + resourceids.UserSpecifiedSegment("eventhubName", "eventhubValue"), resourceids.StaticSegment("staticAuthorizationRules", "authorizationRules", "authorizationRules"), resourceids.UserSpecifiedSegment("authorizationRuleName", "authorizationRuleValue"), } @@ -143,7 +143,7 @@ func (id EventhubAuthorizationRuleId) String() string { fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Namespace Name: %q", id.NamespaceName), - fmt.Sprintf("Event Hub Name: %q", id.EventHubName), + fmt.Sprintf("Eventhub Name: %q", id.EventhubName), fmt.Sprintf("Authorization Rule Name: %q", id.AuthorizationRuleName), } return fmt.Sprintf("Eventhub Authorization Rule (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/README.md index 645874f172a8..d7e5b405dd36 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := consumergroups.NewConsumerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "consumerGroupValue") +id := consumergroups.NewConsumerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventhubValue", "consumerGroupValue") payload := consumergroups.ConsumerGroup{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := consumergroups.NewConsumerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "consumerGroupValue") +id := consumergroups.NewConsumerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventhubValue", "consumerGroupValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := consumergroups.NewConsumerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "consumerGroupValue") +id := consumergroups.NewConsumerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventhubValue", "consumerGroupValue") read, err := client.Get(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := consumergroups.NewEventhubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue") +id := consumergroups.NewEventhubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventhubValue") // alternatively `client.ListByEventHub(ctx, id, consumergroups.DefaultListByEventHubOperationOptions())` can be used to do batched pagination items, err := client.ListByEventHubComplete(ctx, id, consumergroups.DefaultListByEventHubOperationOptions()) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/id_consumergroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/id_consumergroup.go index 9b0ec2324403..d30212c81a3b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/id_consumergroup.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/id_consumergroup.go @@ -14,17 +14,17 @@ type ConsumerGroupId struct { SubscriptionId string ResourceGroupName string NamespaceName string - EventHubName string + EventhubName string ConsumerGroupName string } // NewConsumerGroupID returns a new ConsumerGroupId struct -func NewConsumerGroupID(subscriptionId string, resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) ConsumerGroupId { +func NewConsumerGroupID(subscriptionId string, resourceGroupName string, namespaceName string, eventhubName string, consumerGroupName string) ConsumerGroupId { return ConsumerGroupId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, NamespaceName: namespaceName, - EventHubName: eventHubName, + EventhubName: eventhubName, ConsumerGroupName: consumerGroupName, } } @@ -52,8 +52,8 @@ func ParseConsumerGroupID(input string) (*ConsumerGroupId, error) { return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.EventHubName, ok = parsed.Parsed["eventHubName"]; !ok { - return nil, fmt.Errorf("the segment 'eventHubName' was not found in the resource id %q", input) + if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { + return nil, fmt.Errorf("the segment 'eventhubName' was not found in the resource id %q", input) } if id.ConsumerGroupName, ok = parsed.Parsed["consumerGroupName"]; !ok { @@ -87,8 +87,8 @@ func ParseConsumerGroupIDInsensitively(input string) (*ConsumerGroupId, error) { return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.EventHubName, ok = parsed.Parsed["eventHubName"]; !ok { - return nil, fmt.Errorf("the segment 'eventHubName' was not found in the resource id %q", input) + if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { + return nil, fmt.Errorf("the segment 'eventhubName' was not found in the resource id %q", input) } if id.ConsumerGroupName, ok = parsed.Parsed["consumerGroupName"]; !ok { @@ -116,7 +116,7 @@ func ValidateConsumerGroupID(input interface{}, key string) (warnings []string, // ID returns the formatted Consumer Group ID func (id ConsumerGroupId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventHub/namespaces/%s/eventhubs/%s/consumerGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventHubName, id.ConsumerGroupName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventhubName, id.ConsumerGroupName) } // Segments returns a slice of Resource ID Segments which comprise this Consumer Group ID @@ -131,7 +131,7 @@ func (id ConsumerGroupId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), resourceids.StaticSegment("staticEventhubs", "eventhubs", "eventhubs"), - resourceids.UserSpecifiedSegment("eventHubName", "eventHubValue"), + resourceids.UserSpecifiedSegment("eventhubName", "eventhubValue"), resourceids.StaticSegment("staticConsumerGroups", "consumerGroups", "consumerGroups"), resourceids.UserSpecifiedSegment("consumerGroupName", "consumerGroupValue"), } @@ -143,7 +143,7 @@ func (id ConsumerGroupId) String() string { fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Namespace Name: %q", id.NamespaceName), - fmt.Sprintf("Event Hub Name: %q", id.EventHubName), + fmt.Sprintf("Eventhub Name: %q", id.EventhubName), fmt.Sprintf("Consumer Group Name: %q", id.ConsumerGroupName), } return fmt.Sprintf("Consumer Group (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/id_eventhub.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/id_eventhub.go index c0613963a6c5..ab7525116279 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/id_eventhub.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/id_eventhub.go @@ -14,16 +14,16 @@ type EventhubId struct { SubscriptionId string ResourceGroupName string NamespaceName string - EventHubName string + EventhubName string } // NewEventhubID returns a new EventhubId struct -func NewEventhubID(subscriptionId string, resourceGroupName string, namespaceName string, eventHubName string) EventhubId { +func NewEventhubID(subscriptionId string, resourceGroupName string, namespaceName string, eventhubName string) EventhubId { return EventhubId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, NamespaceName: namespaceName, - EventHubName: eventHubName, + EventhubName: eventhubName, } } @@ -50,8 +50,8 @@ func ParseEventhubID(input string) (*EventhubId, error) { return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.EventHubName, ok = parsed.Parsed["eventHubName"]; !ok { - return nil, fmt.Errorf("the segment 'eventHubName' was not found in the resource id %q", input) + if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { + return nil, fmt.Errorf("the segment 'eventhubName' was not found in the resource id %q", input) } return &id, nil @@ -81,8 +81,8 @@ func ParseEventhubIDInsensitively(input string) (*EventhubId, error) { return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.EventHubName, ok = parsed.Parsed["eventHubName"]; !ok { - return nil, fmt.Errorf("the segment 'eventHubName' was not found in the resource id %q", input) + if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { + return nil, fmt.Errorf("the segment 'eventhubName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateEventhubID(input interface{}, key string) (warnings []string, error // ID returns the formatted Eventhub ID func (id EventhubId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventHub/namespaces/%s/eventhubs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventHubName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventhubName) } // Segments returns a slice of Resource ID Segments which comprise this Eventhub ID @@ -121,7 +121,7 @@ func (id EventhubId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), resourceids.StaticSegment("staticEventhubs", "eventhubs", "eventhubs"), - resourceids.UserSpecifiedSegment("eventHubName", "eventHubValue"), + resourceids.UserSpecifiedSegment("eventhubName", "eventhubValue"), } } @@ -131,7 +131,7 @@ func (id EventhubId) String() string { fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Namespace Name: %q", id.NamespaceName), - fmt.Sprintf("Event Hub Name: %q", id.EventHubName), + fmt.Sprintf("Eventhub Name: %q", id.EventhubName), } return fmt.Sprintf("Eventhub (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/README.md index e66d26198b6b..a3e4321690d0 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "disasterRecoveryConfigValue") read, err := client.BreakPairing(ctx, id) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "disasterRecoveryConfigValue") payload := disasterrecoveryconfigs.ArmDisasterRecovery{ // ... @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "disasterRecoveryConfigValue") read, err := client.Delete(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "disasterRecoveryConfigValue") read, err := client.FailOver(ctx, id) if err != nil { @@ -93,7 +93,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "disasterRecoveryConfigValue") read, err := client.Get(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go index ad109682b0ee..fc17d3aa10d2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = DisasterRecoveryConfigId{} // DisasterRecoveryConfigId is a struct representing the Resource ID for a Disaster Recovery Config type DisasterRecoveryConfigId struct { - SubscriptionId string - ResourceGroupName string - NamespaceName string - Alias string + SubscriptionId string + ResourceGroupName string + NamespaceName string + DisasterRecoveryConfigName string } // NewDisasterRecoveryConfigID returns a new DisasterRecoveryConfigId struct -func NewDisasterRecoveryConfigID(subscriptionId string, resourceGroupName string, namespaceName string, alias string) DisasterRecoveryConfigId { +func NewDisasterRecoveryConfigID(subscriptionId string, resourceGroupName string, namespaceName string, disasterRecoveryConfigName string) DisasterRecoveryConfigId { return DisasterRecoveryConfigId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NamespaceName: namespaceName, - Alias: alias, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + DisasterRecoveryConfigName: disasterRecoveryConfigName, } } @@ -50,8 +50,8 @@ func ParseDisasterRecoveryConfigID(input string) (*DisasterRecoveryConfigId, err return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.Alias, ok = parsed.Parsed["alias"]; !ok { - return nil, fmt.Errorf("the segment 'alias' was not found in the resource id %q", input) + if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { + return nil, fmt.Errorf("the segment 'disasterRecoveryConfigName' was not found in the resource id %q", input) } return &id, nil @@ -81,8 +81,8 @@ func ParseDisasterRecoveryConfigIDInsensitively(input string) (*DisasterRecovery return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.Alias, ok = parsed.Parsed["alias"]; !ok { - return nil, fmt.Errorf("the segment 'alias' was not found in the resource id %q", input) + if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { + return nil, fmt.Errorf("the segment 'disasterRecoveryConfigName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateDisasterRecoveryConfigID(input interface{}, key string) (warnings [ // ID returns the formatted Disaster Recovery Config ID func (id DisasterRecoveryConfigId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventHub/namespaces/%s/disasterRecoveryConfigs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.Alias) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.DisasterRecoveryConfigName) } // Segments returns a slice of Resource ID Segments which comprise this Disaster Recovery Config ID @@ -121,7 +121,7 @@ func (id DisasterRecoveryConfigId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), resourceids.StaticSegment("staticDisasterRecoveryConfigs", "disasterRecoveryConfigs", "disasterRecoveryConfigs"), - resourceids.UserSpecifiedSegment("alias", "aliasValue"), + resourceids.UserSpecifiedSegment("disasterRecoveryConfigName", "disasterRecoveryConfigValue"), } } @@ -131,7 +131,7 @@ func (id DisasterRecoveryConfigId) String() string { fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Namespace Name: %q", id.NamespaceName), - fmt.Sprintf("Alias: %q", id.Alias), + fmt.Sprintf("Disaster Recovery Config Name: %q", id.DisasterRecoveryConfigName), } return fmt.Sprintf("Disaster Recovery Config (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/README.md index 536d4cc86351..1dbaa3108174 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := eventhubs.NewEventhubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue") +id := eventhubs.NewEventhubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventhubValue") payload := eventhubs.Eventhub{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := eventhubs.NewEventhubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue") +id := eventhubs.NewEventhubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventhubValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := eventhubs.NewEventhubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "authorizationRuleValue") +id := eventhubs.NewEventhubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventhubValue", "authorizationRuleValue") read, err := client.DeleteAuthorizationRule(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := eventhubs.NewEventhubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue") +id := eventhubs.NewEventhubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventhubValue") read, err := client.Get(ctx, id) if err != nil { @@ -93,7 +93,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := eventhubs.NewEventhubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "authorizationRuleValue") +id := eventhubs.NewEventhubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventhubValue", "authorizationRuleValue") read, err := client.GetAuthorizationRule(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhub.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhub.go index 665ab9cc1234..22f3450bf0e0 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhub.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhub.go @@ -14,16 +14,16 @@ type EventhubId struct { SubscriptionId string ResourceGroupName string NamespaceName string - EventHubName string + EventhubName string } // NewEventhubID returns a new EventhubId struct -func NewEventhubID(subscriptionId string, resourceGroupName string, namespaceName string, eventHubName string) EventhubId { +func NewEventhubID(subscriptionId string, resourceGroupName string, namespaceName string, eventhubName string) EventhubId { return EventhubId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, NamespaceName: namespaceName, - EventHubName: eventHubName, + EventhubName: eventhubName, } } @@ -50,8 +50,8 @@ func ParseEventhubID(input string) (*EventhubId, error) { return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.EventHubName, ok = parsed.Parsed["eventHubName"]; !ok { - return nil, fmt.Errorf("the segment 'eventHubName' was not found in the resource id %q", input) + if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { + return nil, fmt.Errorf("the segment 'eventhubName' was not found in the resource id %q", input) } return &id, nil @@ -81,8 +81,8 @@ func ParseEventhubIDInsensitively(input string) (*EventhubId, error) { return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.EventHubName, ok = parsed.Parsed["eventHubName"]; !ok { - return nil, fmt.Errorf("the segment 'eventHubName' was not found in the resource id %q", input) + if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { + return nil, fmt.Errorf("the segment 'eventhubName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateEventhubID(input interface{}, key string) (warnings []string, error // ID returns the formatted Eventhub ID func (id EventhubId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventHub/namespaces/%s/eventhubs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventHubName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventhubName) } // Segments returns a slice of Resource ID Segments which comprise this Eventhub ID @@ -121,7 +121,7 @@ func (id EventhubId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), resourceids.StaticSegment("staticEventhubs", "eventhubs", "eventhubs"), - resourceids.UserSpecifiedSegment("eventHubName", "eventHubValue"), + resourceids.UserSpecifiedSegment("eventhubName", "eventhubValue"), } } @@ -131,7 +131,7 @@ func (id EventhubId) String() string { fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Namespace Name: %q", id.NamespaceName), - fmt.Sprintf("Event Hub Name: %q", id.EventHubName), + fmt.Sprintf("Eventhub Name: %q", id.EventhubName), } return fmt.Sprintf("Eventhub (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhubauthorizationrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhubauthorizationrule.go index 0aaa6901e14f..7b088c45184c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhubauthorizationrule.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhubauthorizationrule.go @@ -14,17 +14,17 @@ type EventhubAuthorizationRuleId struct { SubscriptionId string ResourceGroupName string NamespaceName string - EventHubName string + EventhubName string AuthorizationRuleName string } // NewEventhubAuthorizationRuleID returns a new EventhubAuthorizationRuleId struct -func NewEventhubAuthorizationRuleID(subscriptionId string, resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) EventhubAuthorizationRuleId { +func NewEventhubAuthorizationRuleID(subscriptionId string, resourceGroupName string, namespaceName string, eventhubName string, authorizationRuleName string) EventhubAuthorizationRuleId { return EventhubAuthorizationRuleId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, NamespaceName: namespaceName, - EventHubName: eventHubName, + EventhubName: eventhubName, AuthorizationRuleName: authorizationRuleName, } } @@ -52,8 +52,8 @@ func ParseEventhubAuthorizationRuleID(input string) (*EventhubAuthorizationRuleI return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.EventHubName, ok = parsed.Parsed["eventHubName"]; !ok { - return nil, fmt.Errorf("the segment 'eventHubName' was not found in the resource id %q", input) + if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { + return nil, fmt.Errorf("the segment 'eventhubName' was not found in the resource id %q", input) } if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { @@ -87,8 +87,8 @@ func ParseEventhubAuthorizationRuleIDInsensitively(input string) (*EventhubAutho return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.EventHubName, ok = parsed.Parsed["eventHubName"]; !ok { - return nil, fmt.Errorf("the segment 'eventHubName' was not found in the resource id %q", input) + if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { + return nil, fmt.Errorf("the segment 'eventhubName' was not found in the resource id %q", input) } if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { @@ -116,7 +116,7 @@ func ValidateEventhubAuthorizationRuleID(input interface{}, key string) (warning // ID returns the formatted Eventhub Authorization Rule ID func (id EventhubAuthorizationRuleId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventHub/namespaces/%s/eventhubs/%s/authorizationRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventHubName, id.AuthorizationRuleName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.EventhubName, id.AuthorizationRuleName) } // Segments returns a slice of Resource ID Segments which comprise this Eventhub Authorization Rule ID @@ -131,7 +131,7 @@ func (id EventhubAuthorizationRuleId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), resourceids.StaticSegment("staticEventhubs", "eventhubs", "eventhubs"), - resourceids.UserSpecifiedSegment("eventHubName", "eventHubValue"), + resourceids.UserSpecifiedSegment("eventhubName", "eventhubValue"), resourceids.StaticSegment("staticAuthorizationRules", "authorizationRules", "authorizationRules"), resourceids.UserSpecifiedSegment("authorizationRuleName", "authorizationRuleValue"), } @@ -143,7 +143,7 @@ func (id EventhubAuthorizationRuleId) String() string { fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Namespace Name: %q", id.NamespaceName), - fmt.Sprintf("Event Hub Name: %q", id.EventHubName), + fmt.Sprintf("Eventhub Name: %q", id.EventhubName), fmt.Sprintf("Authorization Rule Name: %q", id.AuthorizationRuleName), } return fmt.Sprintf("Eventhub Authorization Rule (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/README.md new file mode 100644 index 000000000000..ffce3aee11bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies` Documentation + +The `webapplicationfirewallpolicies` SDK allows for interaction with the Azure Resource Manager Service `frontdoor` (API Version `2020-04-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies" +``` + + +### Client Initialization + +```go +client := webapplicationfirewallpolicies.NewWebApplicationFirewallPoliciesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `WebApplicationFirewallPoliciesClient.PoliciesCreateOrUpdate` + +```go +ctx := context.TODO() +id := webapplicationfirewallpolicies.NewFrontDoorWebApplicationFirewallPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorWebApplicationFirewallPolicyValue") + +payload := webapplicationfirewallpolicies.WebApplicationFirewallPolicy{ + // ... +} + + +if err := client.PoliciesCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `WebApplicationFirewallPoliciesClient.PoliciesDelete` + +```go +ctx := context.TODO() +id := webapplicationfirewallpolicies.NewFrontDoorWebApplicationFirewallPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorWebApplicationFirewallPolicyValue") + +if err := client.PoliciesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `WebApplicationFirewallPoliciesClient.PoliciesGet` + +```go +ctx := context.TODO() +id := webapplicationfirewallpolicies.NewFrontDoorWebApplicationFirewallPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorWebApplicationFirewallPolicyValue") + +read, err := client.PoliciesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WebApplicationFirewallPoliciesClient.PoliciesList` + +```go +ctx := context.TODO() +id := webapplicationfirewallpolicies.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.PoliciesList(ctx, id)` can be used to do batched pagination +items, err := client.PoliciesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/client.go new file mode 100644 index 000000000000..490f50430c43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/client.go @@ -0,0 +1,18 @@ +package webapplicationfirewallpolicies + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WebApplicationFirewallPoliciesClient struct { + Client autorest.Client + baseUri string +} + +func NewWebApplicationFirewallPoliciesClientWithBaseURI(endpoint string) WebApplicationFirewallPoliciesClient { + return WebApplicationFirewallPoliciesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/constants.go new file mode 100644 index 000000000000..8d9e4d211218 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/constants.go @@ -0,0 +1,438 @@ +package webapplicationfirewallpolicies + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActionType string + +const ( + ActionTypeAllow ActionType = "Allow" + ActionTypeBlock ActionType = "Block" + ActionTypeLog ActionType = "Log" + ActionTypeRedirect ActionType = "Redirect" +) + +func PossibleValuesForActionType() []string { + return []string{ + string(ActionTypeAllow), + string(ActionTypeBlock), + string(ActionTypeLog), + string(ActionTypeRedirect), + } +} + +func parseActionType(input string) (*ActionType, error) { + vals := map[string]ActionType{ + "allow": ActionTypeAllow, + "block": ActionTypeBlock, + "log": ActionTypeLog, + "redirect": ActionTypeRedirect, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ActionType(input) + return &out, nil +} + +type CustomRuleEnabledState string + +const ( + CustomRuleEnabledStateDisabled CustomRuleEnabledState = "Disabled" + CustomRuleEnabledStateEnabled CustomRuleEnabledState = "Enabled" +) + +func PossibleValuesForCustomRuleEnabledState() []string { + return []string{ + string(CustomRuleEnabledStateDisabled), + string(CustomRuleEnabledStateEnabled), + } +} + +func parseCustomRuleEnabledState(input string) (*CustomRuleEnabledState, error) { + vals := map[string]CustomRuleEnabledState{ + "disabled": CustomRuleEnabledStateDisabled, + "enabled": CustomRuleEnabledStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CustomRuleEnabledState(input) + return &out, nil +} + +type ManagedRuleEnabledState string + +const ( + ManagedRuleEnabledStateDisabled ManagedRuleEnabledState = "Disabled" + ManagedRuleEnabledStateEnabled ManagedRuleEnabledState = "Enabled" +) + +func PossibleValuesForManagedRuleEnabledState() []string { + return []string{ + string(ManagedRuleEnabledStateDisabled), + string(ManagedRuleEnabledStateEnabled), + } +} + +func parseManagedRuleEnabledState(input string) (*ManagedRuleEnabledState, error) { + vals := map[string]ManagedRuleEnabledState{ + "disabled": ManagedRuleEnabledStateDisabled, + "enabled": ManagedRuleEnabledStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ManagedRuleEnabledState(input) + return &out, nil +} + +type ManagedRuleExclusionMatchVariable string + +const ( + ManagedRuleExclusionMatchVariableQueryStringArgNames ManagedRuleExclusionMatchVariable = "QueryStringArgNames" + ManagedRuleExclusionMatchVariableRequestBodyPostArgNames ManagedRuleExclusionMatchVariable = "RequestBodyPostArgNames" + ManagedRuleExclusionMatchVariableRequestCookieNames ManagedRuleExclusionMatchVariable = "RequestCookieNames" + ManagedRuleExclusionMatchVariableRequestHeaderNames ManagedRuleExclusionMatchVariable = "RequestHeaderNames" +) + +func PossibleValuesForManagedRuleExclusionMatchVariable() []string { + return []string{ + string(ManagedRuleExclusionMatchVariableQueryStringArgNames), + string(ManagedRuleExclusionMatchVariableRequestBodyPostArgNames), + string(ManagedRuleExclusionMatchVariableRequestCookieNames), + string(ManagedRuleExclusionMatchVariableRequestHeaderNames), + } +} + +func parseManagedRuleExclusionMatchVariable(input string) (*ManagedRuleExclusionMatchVariable, error) { + vals := map[string]ManagedRuleExclusionMatchVariable{ + "querystringargnames": ManagedRuleExclusionMatchVariableQueryStringArgNames, + "requestbodypostargnames": ManagedRuleExclusionMatchVariableRequestBodyPostArgNames, + "requestcookienames": ManagedRuleExclusionMatchVariableRequestCookieNames, + "requestheadernames": ManagedRuleExclusionMatchVariableRequestHeaderNames, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ManagedRuleExclusionMatchVariable(input) + return &out, nil +} + +type ManagedRuleExclusionSelectorMatchOperator string + +const ( + ManagedRuleExclusionSelectorMatchOperatorContains ManagedRuleExclusionSelectorMatchOperator = "Contains" + ManagedRuleExclusionSelectorMatchOperatorEndsWith ManagedRuleExclusionSelectorMatchOperator = "EndsWith" + ManagedRuleExclusionSelectorMatchOperatorEquals ManagedRuleExclusionSelectorMatchOperator = "Equals" + ManagedRuleExclusionSelectorMatchOperatorEqualsAny ManagedRuleExclusionSelectorMatchOperator = "EqualsAny" + ManagedRuleExclusionSelectorMatchOperatorStartsWith ManagedRuleExclusionSelectorMatchOperator = "StartsWith" +) + +func PossibleValuesForManagedRuleExclusionSelectorMatchOperator() []string { + return []string{ + string(ManagedRuleExclusionSelectorMatchOperatorContains), + string(ManagedRuleExclusionSelectorMatchOperatorEndsWith), + string(ManagedRuleExclusionSelectorMatchOperatorEquals), + string(ManagedRuleExclusionSelectorMatchOperatorEqualsAny), + string(ManagedRuleExclusionSelectorMatchOperatorStartsWith), + } +} + +func parseManagedRuleExclusionSelectorMatchOperator(input string) (*ManagedRuleExclusionSelectorMatchOperator, error) { + vals := map[string]ManagedRuleExclusionSelectorMatchOperator{ + "contains": ManagedRuleExclusionSelectorMatchOperatorContains, + "endswith": ManagedRuleExclusionSelectorMatchOperatorEndsWith, + "equals": ManagedRuleExclusionSelectorMatchOperatorEquals, + "equalsany": ManagedRuleExclusionSelectorMatchOperatorEqualsAny, + "startswith": ManagedRuleExclusionSelectorMatchOperatorStartsWith, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ManagedRuleExclusionSelectorMatchOperator(input) + return &out, nil +} + +type MatchVariable string + +const ( + MatchVariableCookies MatchVariable = "Cookies" + MatchVariablePostArgs MatchVariable = "PostArgs" + MatchVariableQueryString MatchVariable = "QueryString" + MatchVariableRemoteAddr MatchVariable = "RemoteAddr" + MatchVariableRequestBody MatchVariable = "RequestBody" + MatchVariableRequestHeader MatchVariable = "RequestHeader" + MatchVariableRequestMethod MatchVariable = "RequestMethod" + MatchVariableRequestUri MatchVariable = "RequestUri" + MatchVariableSocketAddr MatchVariable = "SocketAddr" +) + +func PossibleValuesForMatchVariable() []string { + return []string{ + string(MatchVariableCookies), + string(MatchVariablePostArgs), + string(MatchVariableQueryString), + string(MatchVariableRemoteAddr), + string(MatchVariableRequestBody), + string(MatchVariableRequestHeader), + string(MatchVariableRequestMethod), + string(MatchVariableRequestUri), + string(MatchVariableSocketAddr), + } +} + +func parseMatchVariable(input string) (*MatchVariable, error) { + vals := map[string]MatchVariable{ + "cookies": MatchVariableCookies, + "postargs": MatchVariablePostArgs, + "querystring": MatchVariableQueryString, + "remoteaddr": MatchVariableRemoteAddr, + "requestbody": MatchVariableRequestBody, + "requestheader": MatchVariableRequestHeader, + "requestmethod": MatchVariableRequestMethod, + "requesturi": MatchVariableRequestUri, + "socketaddr": MatchVariableSocketAddr, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MatchVariable(input) + return &out, nil +} + +type Operator string + +const ( + OperatorAny Operator = "Any" + OperatorBeginsWith Operator = "BeginsWith" + OperatorContains Operator = "Contains" + OperatorEndsWith Operator = "EndsWith" + OperatorEqual Operator = "Equal" + OperatorGeoMatch Operator = "GeoMatch" + OperatorGreaterThan Operator = "GreaterThan" + OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" + OperatorIPMatch Operator = "IPMatch" + OperatorLessThan Operator = "LessThan" + OperatorLessThanOrEqual Operator = "LessThanOrEqual" + OperatorRegEx Operator = "RegEx" +) + +func PossibleValuesForOperator() []string { + return []string{ + string(OperatorAny), + string(OperatorBeginsWith), + string(OperatorContains), + string(OperatorEndsWith), + string(OperatorEqual), + string(OperatorGeoMatch), + string(OperatorGreaterThan), + string(OperatorGreaterThanOrEqual), + string(OperatorIPMatch), + string(OperatorLessThan), + string(OperatorLessThanOrEqual), + string(OperatorRegEx), + } +} + +func parseOperator(input string) (*Operator, error) { + vals := map[string]Operator{ + "any": OperatorAny, + "beginswith": OperatorBeginsWith, + "contains": OperatorContains, + "endswith": OperatorEndsWith, + "equal": OperatorEqual, + "geomatch": OperatorGeoMatch, + "greaterthan": OperatorGreaterThan, + "greaterthanorequal": OperatorGreaterThanOrEqual, + "ipmatch": OperatorIPMatch, + "lessthan": OperatorLessThan, + "lessthanorequal": OperatorLessThanOrEqual, + "regex": OperatorRegEx, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Operator(input) + return &out, nil +} + +type PolicyEnabledState string + +const ( + PolicyEnabledStateDisabled PolicyEnabledState = "Disabled" + PolicyEnabledStateEnabled PolicyEnabledState = "Enabled" +) + +func PossibleValuesForPolicyEnabledState() []string { + return []string{ + string(PolicyEnabledStateDisabled), + string(PolicyEnabledStateEnabled), + } +} + +func parsePolicyEnabledState(input string) (*PolicyEnabledState, error) { + vals := map[string]PolicyEnabledState{ + "disabled": PolicyEnabledStateDisabled, + "enabled": PolicyEnabledStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyEnabledState(input) + return &out, nil +} + +type PolicyMode string + +const ( + PolicyModeDetection PolicyMode = "Detection" + PolicyModePrevention PolicyMode = "Prevention" +) + +func PossibleValuesForPolicyMode() []string { + return []string{ + string(PolicyModeDetection), + string(PolicyModePrevention), + } +} + +func parsePolicyMode(input string) (*PolicyMode, error) { + vals := map[string]PolicyMode{ + "detection": PolicyModeDetection, + "prevention": PolicyModePrevention, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyMode(input) + return &out, nil +} + +type PolicyResourceState string + +const ( + PolicyResourceStateCreating PolicyResourceState = "Creating" + PolicyResourceStateDeleting PolicyResourceState = "Deleting" + PolicyResourceStateDisabled PolicyResourceState = "Disabled" + PolicyResourceStateDisabling PolicyResourceState = "Disabling" + PolicyResourceStateEnabled PolicyResourceState = "Enabled" + PolicyResourceStateEnabling PolicyResourceState = "Enabling" +) + +func PossibleValuesForPolicyResourceState() []string { + return []string{ + string(PolicyResourceStateCreating), + string(PolicyResourceStateDeleting), + string(PolicyResourceStateDisabled), + string(PolicyResourceStateDisabling), + string(PolicyResourceStateEnabled), + string(PolicyResourceStateEnabling), + } +} + +func parsePolicyResourceState(input string) (*PolicyResourceState, error) { + vals := map[string]PolicyResourceState{ + "creating": PolicyResourceStateCreating, + "deleting": PolicyResourceStateDeleting, + "disabled": PolicyResourceStateDisabled, + "disabling": PolicyResourceStateDisabling, + "enabled": PolicyResourceStateEnabled, + "enabling": PolicyResourceStateEnabling, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PolicyResourceState(input) + return &out, nil +} + +type RuleType string + +const ( + RuleTypeMatchRule RuleType = "MatchRule" + RuleTypeRateLimitRule RuleType = "RateLimitRule" +) + +func PossibleValuesForRuleType() []string { + return []string{ + string(RuleTypeMatchRule), + string(RuleTypeRateLimitRule), + } +} + +func parseRuleType(input string) (*RuleType, error) { + vals := map[string]RuleType{ + "matchrule": RuleTypeMatchRule, + "ratelimitrule": RuleTypeRateLimitRule, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RuleType(input) + return &out, nil +} + +type TransformType string + +const ( + TransformTypeLowercase TransformType = "Lowercase" + TransformTypeRemoveNulls TransformType = "RemoveNulls" + TransformTypeTrim TransformType = "Trim" + TransformTypeUppercase TransformType = "Uppercase" + TransformTypeUrlDecode TransformType = "UrlDecode" + TransformTypeUrlEncode TransformType = "UrlEncode" +) + +func PossibleValuesForTransformType() []string { + return []string{ + string(TransformTypeLowercase), + string(TransformTypeRemoveNulls), + string(TransformTypeTrim), + string(TransformTypeUppercase), + string(TransformTypeUrlDecode), + string(TransformTypeUrlEncode), + } +} + +func parseTransformType(input string) (*TransformType, error) { + vals := map[string]TransformType{ + "lowercase": TransformTypeLowercase, + "removenulls": TransformTypeRemoveNulls, + "trim": TransformTypeTrim, + "uppercase": TransformTypeUppercase, + "urldecode": TransformTypeUrlDecode, + "urlencode": TransformTypeUrlEncode, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TransformType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicy.go new file mode 100644 index 000000000000..e933c49c72f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicy.go @@ -0,0 +1,124 @@ +package webapplicationfirewallpolicies + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FrontDoorWebApplicationFirewallPolicyId{} + +// FrontDoorWebApplicationFirewallPolicyId is a struct representing the Resource ID for a Front Door Web Application Firewall Policy +type FrontDoorWebApplicationFirewallPolicyId struct { + SubscriptionId string + ResourceGroupName string + FrontDoorWebApplicationFirewallPolicyName string +} + +// NewFrontDoorWebApplicationFirewallPolicyID returns a new FrontDoorWebApplicationFirewallPolicyId struct +func NewFrontDoorWebApplicationFirewallPolicyID(subscriptionId string, resourceGroupName string, frontDoorWebApplicationFirewallPolicyName string) FrontDoorWebApplicationFirewallPolicyId { + return FrontDoorWebApplicationFirewallPolicyId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FrontDoorWebApplicationFirewallPolicyName: frontDoorWebApplicationFirewallPolicyName, + } +} + +// ParseFrontDoorWebApplicationFirewallPolicyID parses 'input' into a FrontDoorWebApplicationFirewallPolicyId +func ParseFrontDoorWebApplicationFirewallPolicyID(input string) (*FrontDoorWebApplicationFirewallPolicyId, error) { + parser := resourceids.NewParserFromResourceIdType(FrontDoorWebApplicationFirewallPolicyId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FrontDoorWebApplicationFirewallPolicyId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.FrontDoorWebApplicationFirewallPolicyName, ok = parsed.Parsed["frontDoorWebApplicationFirewallPolicyName"]; !ok { + return nil, fmt.Errorf("the segment 'frontDoorWebApplicationFirewallPolicyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFrontDoorWebApplicationFirewallPolicyIDInsensitively parses 'input' case-insensitively into a FrontDoorWebApplicationFirewallPolicyId +// note: this method should only be used for API response data and not user input +func ParseFrontDoorWebApplicationFirewallPolicyIDInsensitively(input string) (*FrontDoorWebApplicationFirewallPolicyId, error) { + parser := resourceids.NewParserFromResourceIdType(FrontDoorWebApplicationFirewallPolicyId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FrontDoorWebApplicationFirewallPolicyId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.FrontDoorWebApplicationFirewallPolicyName, ok = parsed.Parsed["frontDoorWebApplicationFirewallPolicyName"]; !ok { + return nil, fmt.Errorf("the segment 'frontDoorWebApplicationFirewallPolicyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFrontDoorWebApplicationFirewallPolicyID checks that 'input' can be parsed as a Front Door Web Application Firewall Policy ID +func ValidateFrontDoorWebApplicationFirewallPolicyID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFrontDoorWebApplicationFirewallPolicyID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Front Door Web Application Firewall Policy ID +func (id FrontDoorWebApplicationFirewallPolicyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FrontDoorWebApplicationFirewallPolicyName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Front Door Web Application Firewall Policy ID +func (id FrontDoorWebApplicationFirewallPolicyId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("staticFrontDoorWebApplicationFirewallPolicies", "frontDoorWebApplicationFirewallPolicies", "frontDoorWebApplicationFirewallPolicies"), + resourceids.UserSpecifiedSegment("frontDoorWebApplicationFirewallPolicyName", "frontDoorWebApplicationFirewallPolicyValue"), + } +} + +// String returns a human-readable description of this Front Door Web Application Firewall Policy ID +func (id FrontDoorWebApplicationFirewallPolicyId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Front Door Web Application Firewall Policy Name: %q", id.FrontDoorWebApplicationFirewallPolicyName), + } + return fmt.Sprintf("Front Door Web Application Firewall Policy (%s)", strings.Join(components, "\n")) +} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/method_policiescreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/method_policiescreateorupdate_autorest.go similarity index 81% rename from internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/method_policiescreateorupdate_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/method_policiescreateorupdate_autorest.go index a9ecb2ed63db..ded02c45fd27 100644 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/method_policiescreateorupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/method_policiescreateorupdate_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type PoliciesCreateOrUpdateResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoliciesCreateOrUpdateOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // PoliciesCreateOrUpdate ... -func (c WebApplicationFirewallPoliciesClient) PoliciesCreateOrUpdate(ctx context.Context, id FrontDoorWebApplicationFirewallPoliciesId, input WebApplicationFirewallPolicy) (result PoliciesCreateOrUpdateResponse, err error) { +func (c WebApplicationFirewallPoliciesClient) PoliciesCreateOrUpdate(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId, input WebApplicationFirewallPolicy) (result PoliciesCreateOrUpdateOperationResponse, err error) { req, err := c.preparerForPoliciesCreateOrUpdate(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesCreateOrUpdate", nil, "Failure preparing request") @@ -33,7 +36,7 @@ func (c WebApplicationFirewallPoliciesClient) PoliciesCreateOrUpdate(ctx context } // PoliciesCreateOrUpdateThenPoll performs PoliciesCreateOrUpdate then polls until it's completed -func (c WebApplicationFirewallPoliciesClient) PoliciesCreateOrUpdateThenPoll(ctx context.Context, id FrontDoorWebApplicationFirewallPoliciesId, input WebApplicationFirewallPolicy) error { +func (c WebApplicationFirewallPoliciesClient) PoliciesCreateOrUpdateThenPoll(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId, input WebApplicationFirewallPolicy) error { result, err := c.PoliciesCreateOrUpdate(ctx, id, input) if err != nil { return fmt.Errorf("performing PoliciesCreateOrUpdate: %+v", err) @@ -47,7 +50,7 @@ func (c WebApplicationFirewallPoliciesClient) PoliciesCreateOrUpdateThenPoll(ctx } // preparerForPoliciesCreateOrUpdate prepares the PoliciesCreateOrUpdate request. -func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesCreateOrUpdate(ctx context.Context, id FrontDoorWebApplicationFirewallPoliciesId, input WebApplicationFirewallPolicy) (*http.Request, error) { +func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesCreateOrUpdate(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId, input WebApplicationFirewallPolicy) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -64,12 +67,13 @@ func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesCreateOrUpdate( // senderForPoliciesCreateOrUpdate sends the PoliciesCreateOrUpdate request. The method will close the // http.Response Body if it receives an error. -func (c WebApplicationFirewallPoliciesClient) senderForPoliciesCreateOrUpdate(ctx context.Context, req *http.Request) (future PoliciesCreateOrUpdateResponse, err error) { +func (c WebApplicationFirewallPoliciesClient) senderForPoliciesCreateOrUpdate(ctx context.Context, req *http.Request) (future PoliciesCreateOrUpdateOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/method_policiesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/method_policiesdelete_autorest.go similarity index 82% rename from internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/method_policiesdelete_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/method_policiesdelete_autorest.go index a952be337474..bc80949a54aa 100644 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/method_policiesdelete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/method_policiesdelete_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type PoliciesDeleteResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoliciesDeleteOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // PoliciesDelete ... -func (c WebApplicationFirewallPoliciesClient) PoliciesDelete(ctx context.Context, id FrontDoorWebApplicationFirewallPoliciesId) (result PoliciesDeleteResponse, err error) { +func (c WebApplicationFirewallPoliciesClient) PoliciesDelete(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId) (result PoliciesDeleteOperationResponse, err error) { req, err := c.preparerForPoliciesDelete(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesDelete", nil, "Failure preparing request") @@ -33,7 +36,7 @@ func (c WebApplicationFirewallPoliciesClient) PoliciesDelete(ctx context.Context } // PoliciesDeleteThenPoll performs PoliciesDelete then polls until it's completed -func (c WebApplicationFirewallPoliciesClient) PoliciesDeleteThenPoll(ctx context.Context, id FrontDoorWebApplicationFirewallPoliciesId) error { +func (c WebApplicationFirewallPoliciesClient) PoliciesDeleteThenPoll(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId) error { result, err := c.PoliciesDelete(ctx, id) if err != nil { return fmt.Errorf("performing PoliciesDelete: %+v", err) @@ -47,7 +50,7 @@ func (c WebApplicationFirewallPoliciesClient) PoliciesDeleteThenPoll(ctx context } // preparerForPoliciesDelete prepares the PoliciesDelete request. -func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesDelete(ctx context.Context, id FrontDoorWebApplicationFirewallPoliciesId) (*http.Request, error) { +func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesDelete(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -63,12 +66,13 @@ func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesDelete(ctx cont // senderForPoliciesDelete sends the PoliciesDelete request. The method will close the // http.Response Body if it receives an error. -func (c WebApplicationFirewallPoliciesClient) senderForPoliciesDelete(ctx context.Context, req *http.Request) (future PoliciesDeleteResponse, err error) { +func (c WebApplicationFirewallPoliciesClient) senderForPoliciesDelete(ctx context.Context, req *http.Request) (future PoliciesDeleteOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/method_policiesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/method_policiesget_autorest.go similarity index 83% rename from internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/method_policiesget_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/method_policiesget_autorest.go index 8a100862a213..c1fa84824e4c 100644 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/method_policiesget_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/method_policiesget_autorest.go @@ -8,13 +8,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type PoliciesGetResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoliciesGetOperationResponse struct { HttpResponse *http.Response Model *WebApplicationFirewallPolicy } // PoliciesGet ... -func (c WebApplicationFirewallPoliciesClient) PoliciesGet(ctx context.Context, id FrontDoorWebApplicationFirewallPoliciesId) (result PoliciesGetResponse, err error) { +func (c WebApplicationFirewallPoliciesClient) PoliciesGet(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId) (result PoliciesGetOperationResponse, err error) { req, err := c.preparerForPoliciesGet(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesGet", nil, "Failure preparing request") @@ -37,7 +40,7 @@ func (c WebApplicationFirewallPoliciesClient) PoliciesGet(ctx context.Context, i } // preparerForPoliciesGet prepares the PoliciesGet request. -func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesGet(ctx context.Context, id FrontDoorWebApplicationFirewallPoliciesId) (*http.Request, error) { +func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesGet(ctx context.Context, id FrontDoorWebApplicationFirewallPolicyId) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -53,12 +56,13 @@ func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesGet(ctx context // responderForPoliciesGet handles the response to the PoliciesGet request. The method always // closes the http.Response Body. -func (c WebApplicationFirewallPoliciesClient) responderForPoliciesGet(resp *http.Response) (result PoliciesGetResponse, err error) { +func (c WebApplicationFirewallPoliciesClient) responderForPoliciesGet(resp *http.Response) (result PoliciesGetOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/method_policieslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/method_policieslist_autorest.go similarity index 83% rename from internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/method_policieslist_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/method_policieslist_autorest.go index e810868cc963..45a893e1f6af 100644 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/method_policieslist_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/method_policieslist_autorest.go @@ -8,25 +8,29 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" ) -type PoliciesListResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoliciesListOperationResponse struct { HttpResponse *http.Response Model *[]WebApplicationFirewallPolicy nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (PoliciesListResponse, error) + nextPageFunc func(ctx context.Context, nextLink string) (PoliciesListOperationResponse, error) } type PoliciesListCompleteResult struct { Items []WebApplicationFirewallPolicy } -func (r PoliciesListResponse) HasMore() bool { +func (r PoliciesListOperationResponse) HasMore() bool { return r.nextLink != nil } -func (r PoliciesListResponse) LoadMore(ctx context.Context) (resp PoliciesListResponse, err error) { +func (r PoliciesListOperationResponse) LoadMore(ctx context.Context) (resp PoliciesListOperationResponse, err error) { if !r.HasMore() { err = fmt.Errorf("no more pages returned") return @@ -35,7 +39,7 @@ func (r PoliciesListResponse) LoadMore(ctx context.Context) (resp PoliciesListRe } // PoliciesList ... -func (c WebApplicationFirewallPoliciesClient) PoliciesList(ctx context.Context, id ResourceGroupId) (resp PoliciesListResponse, err error) { +func (c WebApplicationFirewallPoliciesClient) PoliciesList(ctx context.Context, id commonids.ResourceGroupId) (resp PoliciesListOperationResponse, err error) { req, err := c.preparerForPoliciesList(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesList", nil, "Failure preparing request") @@ -56,52 +60,8 @@ func (c WebApplicationFirewallPoliciesClient) PoliciesList(ctx context.Context, return } -// PoliciesListComplete retrieves all of the results into a single object -func (c WebApplicationFirewallPoliciesClient) PoliciesListComplete(ctx context.Context, id ResourceGroupId) (PoliciesListCompleteResult, error) { - return c.PoliciesListCompleteMatchingPredicate(ctx, id, WebApplicationFirewallPolicyPredicate{}) -} - -// PoliciesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c WebApplicationFirewallPoliciesClient) PoliciesListCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate WebApplicationFirewallPolicyPredicate) (resp PoliciesListCompleteResult, err error) { - items := make([]WebApplicationFirewallPolicy, 0) - - page, err := c.PoliciesList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := PoliciesListCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForPoliciesList prepares the PoliciesList request. -func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesList(ctx context.Context, id ResourceGroupId) (*http.Request, error) { +func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesList(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -142,7 +102,7 @@ func (c WebApplicationFirewallPoliciesClient) preparerForPoliciesListWithNextLin // responderForPoliciesList handles the response to the PoliciesList request. The method always // closes the http.Response Body. -func (c WebApplicationFirewallPoliciesClient) responderForPoliciesList(resp *http.Response) (result PoliciesListResponse, err error) { +func (c WebApplicationFirewallPoliciesClient) responderForPoliciesList(resp *http.Response) (result PoliciesListOperationResponse, err error) { type page struct { Values []WebApplicationFirewallPolicy `json:"value"` NextLink *string `json:"nextLink"` @@ -157,7 +117,7 @@ func (c WebApplicationFirewallPoliciesClient) responderForPoliciesList(resp *htt result.Model = &respObj.Values result.nextLink = respObj.NextLink if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result PoliciesListResponse, err error) { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result PoliciesListOperationResponse, err error) { req, err := c.preparerForPoliciesListWithNextLink(ctx, nextLink) if err != nil { err = autorest.NewErrorWithError(err, "webapplicationfirewallpolicies.WebApplicationFirewallPoliciesClient", "PoliciesList", nil, "Failure preparing request") @@ -181,3 +141,47 @@ func (c WebApplicationFirewallPoliciesClient) responderForPoliciesList(resp *htt } return } + +// PoliciesListComplete retrieves all of the results into a single object +func (c WebApplicationFirewallPoliciesClient) PoliciesListComplete(ctx context.Context, id commonids.ResourceGroupId) (PoliciesListCompleteResult, error) { + return c.PoliciesListCompleteMatchingPredicate(ctx, id, WebApplicationFirewallPolicyOperationPredicate{}) +} + +// PoliciesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WebApplicationFirewallPoliciesClient) PoliciesListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate WebApplicationFirewallPolicyOperationPredicate) (resp PoliciesListCompleteResult, err error) { + items := make([]WebApplicationFirewallPolicy, 0) + + page, err := c.PoliciesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := PoliciesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_customrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_customrule.go similarity index 81% rename from internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_customrule.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_customrule.go index a8b43b1ef93a..f183c588c180 100644 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_customrule.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_customrule.go @@ -1,5 +1,8 @@ package webapplicationfirewallpolicies +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type CustomRule struct { Action ActionType `json:"action"` EnabledState *CustomRuleEnabledState `json:"enabledState,omitempty"` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_customrulelist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_customrulelist.go new file mode 100644 index 000000000000..4af1175aedfa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_customrulelist.go @@ -0,0 +1,8 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomRuleList struct { + Rules *[]CustomRule `json:"rules,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_frontendendpointlink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_frontendendpointlink.go new file mode 100644 index 000000000000..4912c45c4479 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_frontendendpointlink.go @@ -0,0 +1,8 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontendEndpointLink struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_managedruleexclusion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_managedruleexclusion.go new file mode 100644 index 000000000000..61fe93748f11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_managedruleexclusion.go @@ -0,0 +1,10 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedRuleExclusion struct { + MatchVariable ManagedRuleExclusionMatchVariable `json:"matchVariable"` + Selector string `json:"selector"` + SelectorMatchOperator ManagedRuleExclusionSelectorMatchOperator `json:"selectorMatchOperator"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_managedrulegroupoverride.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_managedrulegroupoverride.go new file mode 100644 index 000000000000..b6fb2b34e9e0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_managedrulegroupoverride.go @@ -0,0 +1,10 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedRuleGroupOverride struct { + Exclusions *[]ManagedRuleExclusion `json:"exclusions,omitempty"` + RuleGroupName string `json:"ruleGroupName"` + Rules *[]ManagedRuleOverride `json:"rules,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_managedruleoverride.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_managedruleoverride.go new file mode 100644 index 000000000000..0161ef1d4614 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_managedruleoverride.go @@ -0,0 +1,11 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedRuleOverride struct { + Action *ActionType `json:"action,omitempty"` + EnabledState *ManagedRuleEnabledState `json:"enabledState,omitempty"` + Exclusions *[]ManagedRuleExclusion `json:"exclusions,omitempty"` + RuleId string `json:"ruleId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_managedruleset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_managedruleset.go new file mode 100644 index 000000000000..5610cdb75145 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_managedruleset.go @@ -0,0 +1,11 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedRuleSet struct { + Exclusions *[]ManagedRuleExclusion `json:"exclusions,omitempty"` + RuleGroupOverrides *[]ManagedRuleGroupOverride `json:"ruleGroupOverrides,omitempty"` + RuleSetType string `json:"ruleSetType"` + RuleSetVersion string `json:"ruleSetVersion"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_managedrulesetlist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_managedrulesetlist.go new file mode 100644 index 000000000000..f15de67cc0c2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_managedrulesetlist.go @@ -0,0 +1,8 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedRuleSetList struct { + ManagedRuleSets *[]ManagedRuleSet `json:"managedRuleSets,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_matchcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_matchcondition.go new file mode 100644 index 000000000000..b39cb7d4f89b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_matchcondition.go @@ -0,0 +1,13 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MatchCondition struct { + MatchValue []string `json:"matchValue"` + MatchVariable MatchVariable `json:"matchVariable"` + NegateCondition *bool `json:"negateCondition,omitempty"` + Operator Operator `json:"operator"` + Selector *string `json:"selector,omitempty"` + Transforms *[]TransformType `json:"transforms,omitempty"` +} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_policysettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_policysettings.go similarity index 76% rename from internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_policysettings.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_policysettings.go index 5b256d8189a8..54081f9511a3 100644 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_policysettings.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_policysettings.go @@ -1,5 +1,8 @@ package webapplicationfirewallpolicies +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type PolicySettings struct { CustomBlockResponseBody *string `json:"customBlockResponseBody,omitempty"` CustomBlockResponseStatusCode *int64 `json:"customBlockResponseStatusCode,omitempty"` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_routingrulelink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_routingrulelink.go new file mode 100644 index 000000000000..4f63c00b70ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_routingrulelink.go @@ -0,0 +1,8 @@ +package webapplicationfirewallpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RoutingRuleLink struct { + Id *string `json:"id,omitempty"` +} diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicy.go similarity index 79% rename from internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicy.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicy.go index f1fd34ee9801..3dbc2fde0b97 100644 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicy.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicy.go @@ -1,5 +1,8 @@ package webapplicationfirewallpolicies +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type WebApplicationFirewallPolicy struct { Etag *string `json:"etag,omitempty"` Id *string `json:"id,omitempty"` diff --git a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicyproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicyproperties.go similarity index 80% rename from internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicyproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicyproperties.go index a8eaa8a5d83f..fb8f97a84cb9 100644 --- a/internal/services/frontdoor/sdk/2020-04-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicyproperties.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/model_webapplicationfirewallpolicyproperties.go @@ -1,5 +1,8 @@ package webapplicationfirewallpolicies +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type WebApplicationFirewallPolicyProperties struct { CustomRules *CustomRuleList `json:"customRules,omitempty"` FrontendEndpointLinks *[]FrontendEndpointLink `json:"frontendEndpointLinks,omitempty"` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/predicates.go new file mode 100644 index 000000000000..ee3711866dfe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/predicates.go @@ -0,0 +1,34 @@ +package webapplicationfirewallpolicies + +type WebApplicationFirewallPolicyOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p WebApplicationFirewallPolicyOperationPredicate) Matches(input WebApplicationFirewallPolicy) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/version.go new file mode 100644 index 000000000000..c984baf093ad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/version.go @@ -0,0 +1,12 @@ +package webapplicationfirewallpolicies + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/webapplicationfirewallpolicies/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/README.md new file mode 100644 index 000000000000..0014949f1498 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/README.md @@ -0,0 +1,261 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors` Documentation + +The `frontdoors` SDK allows for interaction with the Azure Resource Manager Service `frontdoor` (API Version `2020-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors" +``` + + +### Client Initialization + +```go +client := frontdoors.NewFrontDoorsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `FrontDoorsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := frontdoors.NewFrontDoorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue") + +payload := frontdoors.FrontDoor{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `FrontDoorsClient.Delete` + +```go +ctx := context.TODO() +id := frontdoors.NewFrontDoorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `FrontDoorsClient.EndpointsPurgeContent` + +```go +ctx := context.TODO() +id := frontdoors.NewFrontDoorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue") + +payload := frontdoors.PurgeParameters{ + // ... +} + + +if err := client.EndpointsPurgeContentThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `FrontDoorsClient.FrontendEndpointsDisableHTTPS` + +```go +ctx := context.TODO() +id := frontdoors.NewFrontendEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue", "frontendEndpointValue") + +if err := client.FrontendEndpointsDisableHTTPSThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `FrontDoorsClient.FrontendEndpointsEnableHTTPS` + +```go +ctx := context.TODO() +id := frontdoors.NewFrontendEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue", "frontendEndpointValue") + +payload := frontdoors.CustomHTTPSConfiguration{ + // ... +} + + +if err := client.FrontendEndpointsEnableHTTPSThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `FrontDoorsClient.FrontendEndpointsGet` + +```go +ctx := context.TODO() +id := frontdoors.NewFrontendEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue", "frontendEndpointValue") + +read, err := client.FrontendEndpointsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FrontDoorsClient.FrontendEndpointsListByFrontDoor` + +```go +ctx := context.TODO() +id := frontdoors.NewFrontDoorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue") + +// alternatively `client.FrontendEndpointsListByFrontDoor(ctx, id)` can be used to do batched pagination +items, err := client.FrontendEndpointsListByFrontDoorComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `FrontDoorsClient.Get` + +```go +ctx := context.TODO() +id := frontdoors.NewFrontDoorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FrontDoorsClient.List` + +```go +ctx := context.TODO() +id := frontdoors.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `FrontDoorsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := frontdoors.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `FrontDoorsClient.RulesEnginesCreateOrUpdate` + +```go +ctx := context.TODO() +id := frontdoors.NewRulesEngineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue", "rulesEngineValue") + +payload := frontdoors.RulesEngine{ + // ... +} + + +if err := client.RulesEnginesCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `FrontDoorsClient.RulesEnginesDelete` + +```go +ctx := context.TODO() +id := frontdoors.NewRulesEngineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue", "rulesEngineValue") + +if err := client.RulesEnginesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `FrontDoorsClient.RulesEnginesGet` + +```go +ctx := context.TODO() +id := frontdoors.NewRulesEngineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue", "rulesEngineValue") + +read, err := client.RulesEnginesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FrontDoorsClient.RulesEnginesListByFrontDoor` + +```go +ctx := context.TODO() +id := frontdoors.NewFrontDoorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue") + +// alternatively `client.RulesEnginesListByFrontDoor(ctx, id)` can be used to do batched pagination +items, err := client.RulesEnginesListByFrontDoorComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `FrontDoorsClient.ValidateCustomDomain` + +```go +ctx := context.TODO() +id := frontdoors.NewFrontDoorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "frontDoorValue") + +payload := frontdoors.ValidateCustomDomainInput{ + // ... +} + + +read, err := client.ValidateCustomDomain(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/client.go new file mode 100644 index 000000000000..028d6a33b816 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/client.go @@ -0,0 +1,18 @@ +package frontdoors + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontDoorsClient struct { + Client autorest.Client + baseUri string +} + +func NewFrontDoorsClientWithBaseURI(endpoint string) FrontDoorsClient { + return FrontDoorsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/constants.go new file mode 100644 index 000000000000..0e93ac2ded14 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/constants.go @@ -0,0 +1,872 @@ +package frontdoors + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendEnabledState string + +const ( + BackendEnabledStateDisabled BackendEnabledState = "Disabled" + BackendEnabledStateEnabled BackendEnabledState = "Enabled" +) + +func PossibleValuesForBackendEnabledState() []string { + return []string{ + string(BackendEnabledStateDisabled), + string(BackendEnabledStateEnabled), + } +} + +func parseBackendEnabledState(input string) (*BackendEnabledState, error) { + vals := map[string]BackendEnabledState{ + "disabled": BackendEnabledStateDisabled, + "enabled": BackendEnabledStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BackendEnabledState(input) + return &out, nil +} + +type CustomHTTPSProvisioningState string + +const ( + CustomHTTPSProvisioningStateDisabled CustomHTTPSProvisioningState = "Disabled" + CustomHTTPSProvisioningStateDisabling CustomHTTPSProvisioningState = "Disabling" + CustomHTTPSProvisioningStateEnabled CustomHTTPSProvisioningState = "Enabled" + CustomHTTPSProvisioningStateEnabling CustomHTTPSProvisioningState = "Enabling" + CustomHTTPSProvisioningStateFailed CustomHTTPSProvisioningState = "Failed" +) + +func PossibleValuesForCustomHTTPSProvisioningState() []string { + return []string{ + string(CustomHTTPSProvisioningStateDisabled), + string(CustomHTTPSProvisioningStateDisabling), + string(CustomHTTPSProvisioningStateEnabled), + string(CustomHTTPSProvisioningStateEnabling), + string(CustomHTTPSProvisioningStateFailed), + } +} + +func parseCustomHTTPSProvisioningState(input string) (*CustomHTTPSProvisioningState, error) { + vals := map[string]CustomHTTPSProvisioningState{ + "disabled": CustomHTTPSProvisioningStateDisabled, + "disabling": CustomHTTPSProvisioningStateDisabling, + "enabled": CustomHTTPSProvisioningStateEnabled, + "enabling": CustomHTTPSProvisioningStateEnabling, + "failed": CustomHTTPSProvisioningStateFailed, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CustomHTTPSProvisioningState(input) + return &out, nil +} + +type CustomHTTPSProvisioningSubstate string + +const ( + CustomHTTPSProvisioningSubstateCertificateDeleted CustomHTTPSProvisioningSubstate = "CertificateDeleted" + CustomHTTPSProvisioningSubstateCertificateDeployed CustomHTTPSProvisioningSubstate = "CertificateDeployed" + CustomHTTPSProvisioningSubstateDeletingCertificate CustomHTTPSProvisioningSubstate = "DeletingCertificate" + CustomHTTPSProvisioningSubstateDeployingCertificate CustomHTTPSProvisioningSubstate = "DeployingCertificate" + CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestApproved" + CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestRejected" + CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestTimedOut" + CustomHTTPSProvisioningSubstateIssuingCertificate CustomHTTPSProvisioningSubstate = "IssuingCertificate" + CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval CustomHTTPSProvisioningSubstate = "PendingDomainControlValidationREquestApproval" + CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest CustomHTTPSProvisioningSubstate = "SubmittingDomainControlValidationRequest" +) + +func PossibleValuesForCustomHTTPSProvisioningSubstate() []string { + return []string{ + string(CustomHTTPSProvisioningSubstateCertificateDeleted), + string(CustomHTTPSProvisioningSubstateCertificateDeployed), + string(CustomHTTPSProvisioningSubstateDeletingCertificate), + string(CustomHTTPSProvisioningSubstateDeployingCertificate), + string(CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved), + string(CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected), + string(CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut), + string(CustomHTTPSProvisioningSubstateIssuingCertificate), + string(CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval), + string(CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest), + } +} + +func parseCustomHTTPSProvisioningSubstate(input string) (*CustomHTTPSProvisioningSubstate, error) { + vals := map[string]CustomHTTPSProvisioningSubstate{ + "certificatedeleted": CustomHTTPSProvisioningSubstateCertificateDeleted, + "certificatedeployed": CustomHTTPSProvisioningSubstateCertificateDeployed, + "deletingcertificate": CustomHTTPSProvisioningSubstateDeletingCertificate, + "deployingcertificate": CustomHTTPSProvisioningSubstateDeployingCertificate, + "domaincontrolvalidationrequestapproved": CustomHTTPSProvisioningSubstateDomainControlValidationRequestApproved, + "domaincontrolvalidationrequestrejected": CustomHTTPSProvisioningSubstateDomainControlValidationRequestRejected, + "domaincontrolvalidationrequesttimedout": CustomHTTPSProvisioningSubstateDomainControlValidationRequestTimedOut, + "issuingcertificate": CustomHTTPSProvisioningSubstateIssuingCertificate, + "pendingdomaincontrolvalidationrequestapproval": CustomHTTPSProvisioningSubstatePendingDomainControlValidationREquestApproval, + "submittingdomaincontrolvalidationrequest": CustomHTTPSProvisioningSubstateSubmittingDomainControlValidationRequest, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CustomHTTPSProvisioningSubstate(input) + return &out, nil +} + +type DynamicCompressionEnabled string + +const ( + DynamicCompressionEnabledDisabled DynamicCompressionEnabled = "Disabled" + DynamicCompressionEnabledEnabled DynamicCompressionEnabled = "Enabled" +) + +func PossibleValuesForDynamicCompressionEnabled() []string { + return []string{ + string(DynamicCompressionEnabledDisabled), + string(DynamicCompressionEnabledEnabled), + } +} + +func parseDynamicCompressionEnabled(input string) (*DynamicCompressionEnabled, error) { + vals := map[string]DynamicCompressionEnabled{ + "disabled": DynamicCompressionEnabledDisabled, + "enabled": DynamicCompressionEnabledEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DynamicCompressionEnabled(input) + return &out, nil +} + +type EnforceCertificateNameCheckEnabledState string + +const ( + EnforceCertificateNameCheckEnabledStateDisabled EnforceCertificateNameCheckEnabledState = "Disabled" + EnforceCertificateNameCheckEnabledStateEnabled EnforceCertificateNameCheckEnabledState = "Enabled" +) + +func PossibleValuesForEnforceCertificateNameCheckEnabledState() []string { + return []string{ + string(EnforceCertificateNameCheckEnabledStateDisabled), + string(EnforceCertificateNameCheckEnabledStateEnabled), + } +} + +func parseEnforceCertificateNameCheckEnabledState(input string) (*EnforceCertificateNameCheckEnabledState, error) { + vals := map[string]EnforceCertificateNameCheckEnabledState{ + "disabled": EnforceCertificateNameCheckEnabledStateDisabled, + "enabled": EnforceCertificateNameCheckEnabledStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnforceCertificateNameCheckEnabledState(input) + return &out, nil +} + +type FrontDoorCertificateSource string + +const ( + FrontDoorCertificateSourceAzureKeyVault FrontDoorCertificateSource = "AzureKeyVault" + FrontDoorCertificateSourceFrontDoor FrontDoorCertificateSource = "FrontDoor" +) + +func PossibleValuesForFrontDoorCertificateSource() []string { + return []string{ + string(FrontDoorCertificateSourceAzureKeyVault), + string(FrontDoorCertificateSourceFrontDoor), + } +} + +func parseFrontDoorCertificateSource(input string) (*FrontDoorCertificateSource, error) { + vals := map[string]FrontDoorCertificateSource{ + "azurekeyvault": FrontDoorCertificateSourceAzureKeyVault, + "frontdoor": FrontDoorCertificateSourceFrontDoor, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FrontDoorCertificateSource(input) + return &out, nil +} + +type FrontDoorCertificateType string + +const ( + FrontDoorCertificateTypeDedicated FrontDoorCertificateType = "Dedicated" +) + +func PossibleValuesForFrontDoorCertificateType() []string { + return []string{ + string(FrontDoorCertificateTypeDedicated), + } +} + +func parseFrontDoorCertificateType(input string) (*FrontDoorCertificateType, error) { + vals := map[string]FrontDoorCertificateType{ + "dedicated": FrontDoorCertificateTypeDedicated, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FrontDoorCertificateType(input) + return &out, nil +} + +type FrontDoorEnabledState string + +const ( + FrontDoorEnabledStateDisabled FrontDoorEnabledState = "Disabled" + FrontDoorEnabledStateEnabled FrontDoorEnabledState = "Enabled" +) + +func PossibleValuesForFrontDoorEnabledState() []string { + return []string{ + string(FrontDoorEnabledStateDisabled), + string(FrontDoorEnabledStateEnabled), + } +} + +func parseFrontDoorEnabledState(input string) (*FrontDoorEnabledState, error) { + vals := map[string]FrontDoorEnabledState{ + "disabled": FrontDoorEnabledStateDisabled, + "enabled": FrontDoorEnabledStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FrontDoorEnabledState(input) + return &out, nil +} + +type FrontDoorForwardingProtocol string + +const ( + FrontDoorForwardingProtocolHTTPOnly FrontDoorForwardingProtocol = "HttpOnly" + FrontDoorForwardingProtocolHTTPSOnly FrontDoorForwardingProtocol = "HttpsOnly" + FrontDoorForwardingProtocolMatchRequest FrontDoorForwardingProtocol = "MatchRequest" +) + +func PossibleValuesForFrontDoorForwardingProtocol() []string { + return []string{ + string(FrontDoorForwardingProtocolHTTPOnly), + string(FrontDoorForwardingProtocolHTTPSOnly), + string(FrontDoorForwardingProtocolMatchRequest), + } +} + +func parseFrontDoorForwardingProtocol(input string) (*FrontDoorForwardingProtocol, error) { + vals := map[string]FrontDoorForwardingProtocol{ + "httponly": FrontDoorForwardingProtocolHTTPOnly, + "httpsonly": FrontDoorForwardingProtocolHTTPSOnly, + "matchrequest": FrontDoorForwardingProtocolMatchRequest, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FrontDoorForwardingProtocol(input) + return &out, nil +} + +type FrontDoorHealthProbeMethod string + +const ( + FrontDoorHealthProbeMethodGET FrontDoorHealthProbeMethod = "GET" + FrontDoorHealthProbeMethodHEAD FrontDoorHealthProbeMethod = "HEAD" +) + +func PossibleValuesForFrontDoorHealthProbeMethod() []string { + return []string{ + string(FrontDoorHealthProbeMethodGET), + string(FrontDoorHealthProbeMethodHEAD), + } +} + +func parseFrontDoorHealthProbeMethod(input string) (*FrontDoorHealthProbeMethod, error) { + vals := map[string]FrontDoorHealthProbeMethod{ + "get": FrontDoorHealthProbeMethodGET, + "head": FrontDoorHealthProbeMethodHEAD, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FrontDoorHealthProbeMethod(input) + return &out, nil +} + +type FrontDoorProtocol string + +const ( + FrontDoorProtocolHTTP FrontDoorProtocol = "Http" + FrontDoorProtocolHTTPS FrontDoorProtocol = "Https" +) + +func PossibleValuesForFrontDoorProtocol() []string { + return []string{ + string(FrontDoorProtocolHTTP), + string(FrontDoorProtocolHTTPS), + } +} + +func parseFrontDoorProtocol(input string) (*FrontDoorProtocol, error) { + vals := map[string]FrontDoorProtocol{ + "http": FrontDoorProtocolHTTP, + "https": FrontDoorProtocolHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FrontDoorProtocol(input) + return &out, nil +} + +type FrontDoorQuery string + +const ( + FrontDoorQueryStripAll FrontDoorQuery = "StripAll" + FrontDoorQueryStripAllExcept FrontDoorQuery = "StripAllExcept" + FrontDoorQueryStripNone FrontDoorQuery = "StripNone" + FrontDoorQueryStripOnly FrontDoorQuery = "StripOnly" +) + +func PossibleValuesForFrontDoorQuery() []string { + return []string{ + string(FrontDoorQueryStripAll), + string(FrontDoorQueryStripAllExcept), + string(FrontDoorQueryStripNone), + string(FrontDoorQueryStripOnly), + } +} + +func parseFrontDoorQuery(input string) (*FrontDoorQuery, error) { + vals := map[string]FrontDoorQuery{ + "stripall": FrontDoorQueryStripAll, + "stripallexcept": FrontDoorQueryStripAllExcept, + "stripnone": FrontDoorQueryStripNone, + "striponly": FrontDoorQueryStripOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FrontDoorQuery(input) + return &out, nil +} + +type FrontDoorRedirectProtocol string + +const ( + FrontDoorRedirectProtocolHTTPOnly FrontDoorRedirectProtocol = "HttpOnly" + FrontDoorRedirectProtocolHTTPSOnly FrontDoorRedirectProtocol = "HttpsOnly" + FrontDoorRedirectProtocolMatchRequest FrontDoorRedirectProtocol = "MatchRequest" +) + +func PossibleValuesForFrontDoorRedirectProtocol() []string { + return []string{ + string(FrontDoorRedirectProtocolHTTPOnly), + string(FrontDoorRedirectProtocolHTTPSOnly), + string(FrontDoorRedirectProtocolMatchRequest), + } +} + +func parseFrontDoorRedirectProtocol(input string) (*FrontDoorRedirectProtocol, error) { + vals := map[string]FrontDoorRedirectProtocol{ + "httponly": FrontDoorRedirectProtocolHTTPOnly, + "httpsonly": FrontDoorRedirectProtocolHTTPSOnly, + "matchrequest": FrontDoorRedirectProtocolMatchRequest, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FrontDoorRedirectProtocol(input) + return &out, nil +} + +type FrontDoorRedirectType string + +const ( + FrontDoorRedirectTypeFound FrontDoorRedirectType = "Found" + FrontDoorRedirectTypeMoved FrontDoorRedirectType = "Moved" + FrontDoorRedirectTypePermanentRedirect FrontDoorRedirectType = "PermanentRedirect" + FrontDoorRedirectTypeTemporaryRedirect FrontDoorRedirectType = "TemporaryRedirect" +) + +func PossibleValuesForFrontDoorRedirectType() []string { + return []string{ + string(FrontDoorRedirectTypeFound), + string(FrontDoorRedirectTypeMoved), + string(FrontDoorRedirectTypePermanentRedirect), + string(FrontDoorRedirectTypeTemporaryRedirect), + } +} + +func parseFrontDoorRedirectType(input string) (*FrontDoorRedirectType, error) { + vals := map[string]FrontDoorRedirectType{ + "found": FrontDoorRedirectTypeFound, + "moved": FrontDoorRedirectTypeMoved, + "permanentredirect": FrontDoorRedirectTypePermanentRedirect, + "temporaryredirect": FrontDoorRedirectTypeTemporaryRedirect, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FrontDoorRedirectType(input) + return &out, nil +} + +type FrontDoorResourceState string + +const ( + FrontDoorResourceStateCreating FrontDoorResourceState = "Creating" + FrontDoorResourceStateDeleting FrontDoorResourceState = "Deleting" + FrontDoorResourceStateDisabled FrontDoorResourceState = "Disabled" + FrontDoorResourceStateDisabling FrontDoorResourceState = "Disabling" + FrontDoorResourceStateEnabled FrontDoorResourceState = "Enabled" + FrontDoorResourceStateEnabling FrontDoorResourceState = "Enabling" +) + +func PossibleValuesForFrontDoorResourceState() []string { + return []string{ + string(FrontDoorResourceStateCreating), + string(FrontDoorResourceStateDeleting), + string(FrontDoorResourceStateDisabled), + string(FrontDoorResourceStateDisabling), + string(FrontDoorResourceStateEnabled), + string(FrontDoorResourceStateEnabling), + } +} + +func parseFrontDoorResourceState(input string) (*FrontDoorResourceState, error) { + vals := map[string]FrontDoorResourceState{ + "creating": FrontDoorResourceStateCreating, + "deleting": FrontDoorResourceStateDeleting, + "disabled": FrontDoorResourceStateDisabled, + "disabling": FrontDoorResourceStateDisabling, + "enabled": FrontDoorResourceStateEnabled, + "enabling": FrontDoorResourceStateEnabling, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FrontDoorResourceState(input) + return &out, nil +} + +type FrontDoorTlsProtocolType string + +const ( + FrontDoorTlsProtocolTypeServerNameIndication FrontDoorTlsProtocolType = "ServerNameIndication" +) + +func PossibleValuesForFrontDoorTlsProtocolType() []string { + return []string{ + string(FrontDoorTlsProtocolTypeServerNameIndication), + } +} + +func parseFrontDoorTlsProtocolType(input string) (*FrontDoorTlsProtocolType, error) { + vals := map[string]FrontDoorTlsProtocolType{ + "servernameindication": FrontDoorTlsProtocolTypeServerNameIndication, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FrontDoorTlsProtocolType(input) + return &out, nil +} + +type HeaderActionType string + +const ( + HeaderActionTypeAppend HeaderActionType = "Append" + HeaderActionTypeDelete HeaderActionType = "Delete" + HeaderActionTypeOverwrite HeaderActionType = "Overwrite" +) + +func PossibleValuesForHeaderActionType() []string { + return []string{ + string(HeaderActionTypeAppend), + string(HeaderActionTypeDelete), + string(HeaderActionTypeOverwrite), + } +} + +func parseHeaderActionType(input string) (*HeaderActionType, error) { + vals := map[string]HeaderActionType{ + "append": HeaderActionTypeAppend, + "delete": HeaderActionTypeDelete, + "overwrite": HeaderActionTypeOverwrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HeaderActionType(input) + return &out, nil +} + +type HealthProbeEnabled string + +const ( + HealthProbeEnabledDisabled HealthProbeEnabled = "Disabled" + HealthProbeEnabledEnabled HealthProbeEnabled = "Enabled" +) + +func PossibleValuesForHealthProbeEnabled() []string { + return []string{ + string(HealthProbeEnabledDisabled), + string(HealthProbeEnabledEnabled), + } +} + +func parseHealthProbeEnabled(input string) (*HealthProbeEnabled, error) { + vals := map[string]HealthProbeEnabled{ + "disabled": HealthProbeEnabledDisabled, + "enabled": HealthProbeEnabledEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HealthProbeEnabled(input) + return &out, nil +} + +type MatchProcessingBehavior string + +const ( + MatchProcessingBehaviorContinue MatchProcessingBehavior = "Continue" + MatchProcessingBehaviorStop MatchProcessingBehavior = "Stop" +) + +func PossibleValuesForMatchProcessingBehavior() []string { + return []string{ + string(MatchProcessingBehaviorContinue), + string(MatchProcessingBehaviorStop), + } +} + +func parseMatchProcessingBehavior(input string) (*MatchProcessingBehavior, error) { + vals := map[string]MatchProcessingBehavior{ + "continue": MatchProcessingBehaviorContinue, + "stop": MatchProcessingBehaviorStop, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MatchProcessingBehavior(input) + return &out, nil +} + +type MinimumTLSVersion string + +const ( + MinimumTLSVersionOnePointTwo MinimumTLSVersion = "1.2" + MinimumTLSVersionOnePointZero MinimumTLSVersion = "1.0" +) + +func PossibleValuesForMinimumTLSVersion() []string { + return []string{ + string(MinimumTLSVersionOnePointTwo), + string(MinimumTLSVersionOnePointZero), + } +} + +func parseMinimumTLSVersion(input string) (*MinimumTLSVersion, error) { + vals := map[string]MinimumTLSVersion{ + "1.2": MinimumTLSVersionOnePointTwo, + "1.0": MinimumTLSVersionOnePointZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MinimumTLSVersion(input) + return &out, nil +} + +type PrivateEndpointStatus string + +const ( + PrivateEndpointStatusApproved PrivateEndpointStatus = "Approved" + PrivateEndpointStatusDisconnected PrivateEndpointStatus = "Disconnected" + PrivateEndpointStatusPending PrivateEndpointStatus = "Pending" + PrivateEndpointStatusRejected PrivateEndpointStatus = "Rejected" + PrivateEndpointStatusTimeout PrivateEndpointStatus = "Timeout" +) + +func PossibleValuesForPrivateEndpointStatus() []string { + return []string{ + string(PrivateEndpointStatusApproved), + string(PrivateEndpointStatusDisconnected), + string(PrivateEndpointStatusPending), + string(PrivateEndpointStatusRejected), + string(PrivateEndpointStatusTimeout), + } +} + +func parsePrivateEndpointStatus(input string) (*PrivateEndpointStatus, error) { + vals := map[string]PrivateEndpointStatus{ + "approved": PrivateEndpointStatusApproved, + "disconnected": PrivateEndpointStatusDisconnected, + "pending": PrivateEndpointStatusPending, + "rejected": PrivateEndpointStatusRejected, + "timeout": PrivateEndpointStatusTimeout, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointStatus(input) + return &out, nil +} + +type RoutingRuleEnabledState string + +const ( + RoutingRuleEnabledStateDisabled RoutingRuleEnabledState = "Disabled" + RoutingRuleEnabledStateEnabled RoutingRuleEnabledState = "Enabled" +) + +func PossibleValuesForRoutingRuleEnabledState() []string { + return []string{ + string(RoutingRuleEnabledStateDisabled), + string(RoutingRuleEnabledStateEnabled), + } +} + +func parseRoutingRuleEnabledState(input string) (*RoutingRuleEnabledState, error) { + vals := map[string]RoutingRuleEnabledState{ + "disabled": RoutingRuleEnabledStateDisabled, + "enabled": RoutingRuleEnabledStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RoutingRuleEnabledState(input) + return &out, nil +} + +type RulesEngineMatchVariable string + +const ( + RulesEngineMatchVariableIsMobile RulesEngineMatchVariable = "IsMobile" + RulesEngineMatchVariablePostArgs RulesEngineMatchVariable = "PostArgs" + RulesEngineMatchVariableQueryString RulesEngineMatchVariable = "QueryString" + RulesEngineMatchVariableRemoteAddr RulesEngineMatchVariable = "RemoteAddr" + RulesEngineMatchVariableRequestBody RulesEngineMatchVariable = "RequestBody" + RulesEngineMatchVariableRequestFilename RulesEngineMatchVariable = "RequestFilename" + RulesEngineMatchVariableRequestFilenameExtension RulesEngineMatchVariable = "RequestFilenameExtension" + RulesEngineMatchVariableRequestHeader RulesEngineMatchVariable = "RequestHeader" + RulesEngineMatchVariableRequestMethod RulesEngineMatchVariable = "RequestMethod" + RulesEngineMatchVariableRequestPath RulesEngineMatchVariable = "RequestPath" + RulesEngineMatchVariableRequestScheme RulesEngineMatchVariable = "RequestScheme" + RulesEngineMatchVariableRequestUri RulesEngineMatchVariable = "RequestUri" +) + +func PossibleValuesForRulesEngineMatchVariable() []string { + return []string{ + string(RulesEngineMatchVariableIsMobile), + string(RulesEngineMatchVariablePostArgs), + string(RulesEngineMatchVariableQueryString), + string(RulesEngineMatchVariableRemoteAddr), + string(RulesEngineMatchVariableRequestBody), + string(RulesEngineMatchVariableRequestFilename), + string(RulesEngineMatchVariableRequestFilenameExtension), + string(RulesEngineMatchVariableRequestHeader), + string(RulesEngineMatchVariableRequestMethod), + string(RulesEngineMatchVariableRequestPath), + string(RulesEngineMatchVariableRequestScheme), + string(RulesEngineMatchVariableRequestUri), + } +} + +func parseRulesEngineMatchVariable(input string) (*RulesEngineMatchVariable, error) { + vals := map[string]RulesEngineMatchVariable{ + "ismobile": RulesEngineMatchVariableIsMobile, + "postargs": RulesEngineMatchVariablePostArgs, + "querystring": RulesEngineMatchVariableQueryString, + "remoteaddr": RulesEngineMatchVariableRemoteAddr, + "requestbody": RulesEngineMatchVariableRequestBody, + "requestfilename": RulesEngineMatchVariableRequestFilename, + "requestfilenameextension": RulesEngineMatchVariableRequestFilenameExtension, + "requestheader": RulesEngineMatchVariableRequestHeader, + "requestmethod": RulesEngineMatchVariableRequestMethod, + "requestpath": RulesEngineMatchVariableRequestPath, + "requestscheme": RulesEngineMatchVariableRequestScheme, + "requesturi": RulesEngineMatchVariableRequestUri, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RulesEngineMatchVariable(input) + return &out, nil +} + +type RulesEngineOperator string + +const ( + RulesEngineOperatorAny RulesEngineOperator = "Any" + RulesEngineOperatorBeginsWith RulesEngineOperator = "BeginsWith" + RulesEngineOperatorContains RulesEngineOperator = "Contains" + RulesEngineOperatorEndsWith RulesEngineOperator = "EndsWith" + RulesEngineOperatorEqual RulesEngineOperator = "Equal" + RulesEngineOperatorGeoMatch RulesEngineOperator = "GeoMatch" + RulesEngineOperatorGreaterThan RulesEngineOperator = "GreaterThan" + RulesEngineOperatorGreaterThanOrEqual RulesEngineOperator = "GreaterThanOrEqual" + RulesEngineOperatorIPMatch RulesEngineOperator = "IPMatch" + RulesEngineOperatorLessThan RulesEngineOperator = "LessThan" + RulesEngineOperatorLessThanOrEqual RulesEngineOperator = "LessThanOrEqual" +) + +func PossibleValuesForRulesEngineOperator() []string { + return []string{ + string(RulesEngineOperatorAny), + string(RulesEngineOperatorBeginsWith), + string(RulesEngineOperatorContains), + string(RulesEngineOperatorEndsWith), + string(RulesEngineOperatorEqual), + string(RulesEngineOperatorGeoMatch), + string(RulesEngineOperatorGreaterThan), + string(RulesEngineOperatorGreaterThanOrEqual), + string(RulesEngineOperatorIPMatch), + string(RulesEngineOperatorLessThan), + string(RulesEngineOperatorLessThanOrEqual), + } +} + +func parseRulesEngineOperator(input string) (*RulesEngineOperator, error) { + vals := map[string]RulesEngineOperator{ + "any": RulesEngineOperatorAny, + "beginswith": RulesEngineOperatorBeginsWith, + "contains": RulesEngineOperatorContains, + "endswith": RulesEngineOperatorEndsWith, + "equal": RulesEngineOperatorEqual, + "geomatch": RulesEngineOperatorGeoMatch, + "greaterthan": RulesEngineOperatorGreaterThan, + "greaterthanorequal": RulesEngineOperatorGreaterThanOrEqual, + "ipmatch": RulesEngineOperatorIPMatch, + "lessthan": RulesEngineOperatorLessThan, + "lessthanorequal": RulesEngineOperatorLessThanOrEqual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RulesEngineOperator(input) + return &out, nil +} + +type SessionAffinityEnabledState string + +const ( + SessionAffinityEnabledStateDisabled SessionAffinityEnabledState = "Disabled" + SessionAffinityEnabledStateEnabled SessionAffinityEnabledState = "Enabled" +) + +func PossibleValuesForSessionAffinityEnabledState() []string { + return []string{ + string(SessionAffinityEnabledStateDisabled), + string(SessionAffinityEnabledStateEnabled), + } +} + +func parseSessionAffinityEnabledState(input string) (*SessionAffinityEnabledState, error) { + vals := map[string]SessionAffinityEnabledState{ + "disabled": SessionAffinityEnabledStateDisabled, + "enabled": SessionAffinityEnabledStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SessionAffinityEnabledState(input) + return &out, nil +} + +type Transform string + +const ( + TransformLowercase Transform = "Lowercase" + TransformRemoveNulls Transform = "RemoveNulls" + TransformTrim Transform = "Trim" + TransformUppercase Transform = "Uppercase" + TransformUrlDecode Transform = "UrlDecode" + TransformUrlEncode Transform = "UrlEncode" +) + +func PossibleValuesForTransform() []string { + return []string{ + string(TransformLowercase), + string(TransformRemoveNulls), + string(TransformTrim), + string(TransformUppercase), + string(TransformUrlDecode), + string(TransformUrlEncode), + } +} + +func parseTransform(input string) (*Transform, error) { + vals := map[string]Transform{ + "lowercase": TransformLowercase, + "removenulls": TransformRemoveNulls, + "trim": TransformTrim, + "uppercase": TransformUppercase, + "urldecode": TransformUrlDecode, + "urlencode": TransformUrlEncode, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Transform(input) + return &out, nil +} diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_frontdoor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/id_frontdoor.go similarity index 100% rename from internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_frontdoor.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/id_frontdoor.go diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_frontendendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/id_frontendendpoint.go similarity index 100% rename from internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_frontendendpoint.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/id_frontendendpoint.go diff --git a/internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_rulesengine.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/id_rulesengine.go similarity index 100% rename from internal/services/frontdoor/sdk/2020-04-01/frontdoors/id_rulesengine.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/id_rulesengine.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_createorupdate_autorest.go new file mode 100644 index 000000000000..6467ea2d11f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package frontdoors + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c FrontDoorsClient) CreateOrUpdate(ctx context.Context, id FrontDoorId, input FrontDoor) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c FrontDoorsClient) CreateOrUpdateThenPoll(ctx context.Context, id FrontDoorId, input FrontDoor) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c FrontDoorsClient) preparerForCreateOrUpdate(ctx context.Context, id FrontDoorId, input FrontDoor) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c FrontDoorsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_delete_autorest.go new file mode 100644 index 000000000000..e1a02486b8bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_delete_autorest.go @@ -0,0 +1,78 @@ +package frontdoors + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c FrontDoorsClient) Delete(ctx context.Context, id FrontDoorId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c FrontDoorsClient) DeleteThenPoll(ctx context.Context, id FrontDoorId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c FrontDoorsClient) preparerForDelete(ctx context.Context, id FrontDoorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c FrontDoorsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_endpointspurgecontent_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_endpointspurgecontent_autorest.go new file mode 100644 index 000000000000..05d5588ff512 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_endpointspurgecontent_autorest.go @@ -0,0 +1,79 @@ +package frontdoors + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointsPurgeContentOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// EndpointsPurgeContent ... +func (c FrontDoorsClient) EndpointsPurgeContent(ctx context.Context, id FrontDoorId, input PurgeParameters) (result EndpointsPurgeContentOperationResponse, err error) { + req, err := c.preparerForEndpointsPurgeContent(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "EndpointsPurgeContent", nil, "Failure preparing request") + return + } + + result, err = c.senderForEndpointsPurgeContent(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "EndpointsPurgeContent", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// EndpointsPurgeContentThenPoll performs EndpointsPurgeContent then polls until it's completed +func (c FrontDoorsClient) EndpointsPurgeContentThenPoll(ctx context.Context, id FrontDoorId, input PurgeParameters) error { + result, err := c.EndpointsPurgeContent(ctx, id, input) + if err != nil { + return fmt.Errorf("performing EndpointsPurgeContent: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after EndpointsPurgeContent: %+v", err) + } + + return nil +} + +// preparerForEndpointsPurgeContent prepares the EndpointsPurgeContent request. +func (c FrontDoorsClient) preparerForEndpointsPurgeContent(ctx context.Context, id FrontDoorId, input PurgeParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/purge", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForEndpointsPurgeContent sends the EndpointsPurgeContent request. The method will close the +// http.Response Body if it receives an error. +func (c FrontDoorsClient) senderForEndpointsPurgeContent(ctx context.Context, req *http.Request) (future EndpointsPurgeContentOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_frontendendpointsdisablehttps_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_frontendendpointsdisablehttps_autorest.go new file mode 100644 index 000000000000..5446f66a0ec2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_frontendendpointsdisablehttps_autorest.go @@ -0,0 +1,78 @@ +package frontdoors + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontendEndpointsDisableHTTPSOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// FrontendEndpointsDisableHTTPS ... +func (c FrontDoorsClient) FrontendEndpointsDisableHTTPS(ctx context.Context, id FrontendEndpointId) (result FrontendEndpointsDisableHTTPSOperationResponse, err error) { + req, err := c.preparerForFrontendEndpointsDisableHTTPS(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsDisableHTTPS", nil, "Failure preparing request") + return + } + + result, err = c.senderForFrontendEndpointsDisableHTTPS(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsDisableHTTPS", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// FrontendEndpointsDisableHTTPSThenPoll performs FrontendEndpointsDisableHTTPS then polls until it's completed +func (c FrontDoorsClient) FrontendEndpointsDisableHTTPSThenPoll(ctx context.Context, id FrontendEndpointId) error { + result, err := c.FrontendEndpointsDisableHTTPS(ctx, id) + if err != nil { + return fmt.Errorf("performing FrontendEndpointsDisableHTTPS: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after FrontendEndpointsDisableHTTPS: %+v", err) + } + + return nil +} + +// preparerForFrontendEndpointsDisableHTTPS prepares the FrontendEndpointsDisableHTTPS request. +func (c FrontDoorsClient) preparerForFrontendEndpointsDisableHTTPS(ctx context.Context, id FrontendEndpointId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/disableHttps", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForFrontendEndpointsDisableHTTPS sends the FrontendEndpointsDisableHTTPS request. The method will close the +// http.Response Body if it receives an error. +func (c FrontDoorsClient) senderForFrontendEndpointsDisableHTTPS(ctx context.Context, req *http.Request) (future FrontendEndpointsDisableHTTPSOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_frontendendpointsenablehttps_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_frontendendpointsenablehttps_autorest.go new file mode 100644 index 000000000000..e50f97c867ef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_frontendendpointsenablehttps_autorest.go @@ -0,0 +1,79 @@ +package frontdoors + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontendEndpointsEnableHTTPSOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// FrontendEndpointsEnableHTTPS ... +func (c FrontDoorsClient) FrontendEndpointsEnableHTTPS(ctx context.Context, id FrontendEndpointId, input CustomHTTPSConfiguration) (result FrontendEndpointsEnableHTTPSOperationResponse, err error) { + req, err := c.preparerForFrontendEndpointsEnableHTTPS(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsEnableHTTPS", nil, "Failure preparing request") + return + } + + result, err = c.senderForFrontendEndpointsEnableHTTPS(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsEnableHTTPS", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// FrontendEndpointsEnableHTTPSThenPoll performs FrontendEndpointsEnableHTTPS then polls until it's completed +func (c FrontDoorsClient) FrontendEndpointsEnableHTTPSThenPoll(ctx context.Context, id FrontendEndpointId, input CustomHTTPSConfiguration) error { + result, err := c.FrontendEndpointsEnableHTTPS(ctx, id, input) + if err != nil { + return fmt.Errorf("performing FrontendEndpointsEnableHTTPS: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after FrontendEndpointsEnableHTTPS: %+v", err) + } + + return nil +} + +// preparerForFrontendEndpointsEnableHTTPS prepares the FrontendEndpointsEnableHTTPS request. +func (c FrontDoorsClient) preparerForFrontendEndpointsEnableHTTPS(ctx context.Context, id FrontendEndpointId, input CustomHTTPSConfiguration) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/enableHttps", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForFrontendEndpointsEnableHTTPS sends the FrontendEndpointsEnableHTTPS request. The method will close the +// http.Response Body if it receives an error. +func (c FrontDoorsClient) senderForFrontendEndpointsEnableHTTPS(ctx context.Context, req *http.Request) (future FrontendEndpointsEnableHTTPSOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_frontendendpointsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_frontendendpointsget_autorest.go new file mode 100644 index 000000000000..effb059059da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_frontendendpointsget_autorest.go @@ -0,0 +1,68 @@ +package frontdoors + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontendEndpointsGetOperationResponse struct { + HttpResponse *http.Response + Model *FrontendEndpoint +} + +// FrontendEndpointsGet ... +func (c FrontDoorsClient) FrontendEndpointsGet(ctx context.Context, id FrontendEndpointId) (result FrontendEndpointsGetOperationResponse, err error) { + req, err := c.preparerForFrontendEndpointsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForFrontendEndpointsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForFrontendEndpointsGet prepares the FrontendEndpointsGet request. +func (c FrontDoorsClient) preparerForFrontendEndpointsGet(ctx context.Context, id FrontendEndpointId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForFrontendEndpointsGet handles the response to the FrontendEndpointsGet request. The method always +// closes the http.Response Body. +func (c FrontDoorsClient) responderForFrontendEndpointsGet(resp *http.Response) (result FrontendEndpointsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_frontendendpointslistbyfrontdoor_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_frontendendpointslistbyfrontdoor_autorest.go new file mode 100644 index 000000000000..c8935d1443ba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_frontendendpointslistbyfrontdoor_autorest.go @@ -0,0 +1,186 @@ +package frontdoors + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontendEndpointsListByFrontDoorOperationResponse struct { + HttpResponse *http.Response + Model *[]FrontendEndpoint + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (FrontendEndpointsListByFrontDoorOperationResponse, error) +} + +type FrontendEndpointsListByFrontDoorCompleteResult struct { + Items []FrontendEndpoint +} + +func (r FrontendEndpointsListByFrontDoorOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r FrontendEndpointsListByFrontDoorOperationResponse) LoadMore(ctx context.Context) (resp FrontendEndpointsListByFrontDoorOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// FrontendEndpointsListByFrontDoor ... +func (c FrontDoorsClient) FrontendEndpointsListByFrontDoor(ctx context.Context, id FrontDoorId) (resp FrontendEndpointsListByFrontDoorOperationResponse, err error) { + req, err := c.preparerForFrontendEndpointsListByFrontDoor(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForFrontendEndpointsListByFrontDoor(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForFrontendEndpointsListByFrontDoor prepares the FrontendEndpointsListByFrontDoor request. +func (c FrontDoorsClient) preparerForFrontendEndpointsListByFrontDoor(ctx context.Context, id FrontDoorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/frontendEndpoints", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForFrontendEndpointsListByFrontDoorWithNextLink prepares the FrontendEndpointsListByFrontDoor request with the given nextLink token. +func (c FrontDoorsClient) preparerForFrontendEndpointsListByFrontDoorWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForFrontendEndpointsListByFrontDoor handles the response to the FrontendEndpointsListByFrontDoor request. The method always +// closes the http.Response Body. +func (c FrontDoorsClient) responderForFrontendEndpointsListByFrontDoor(resp *http.Response) (result FrontendEndpointsListByFrontDoorOperationResponse, err error) { + type page struct { + Values []FrontendEndpoint `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result FrontendEndpointsListByFrontDoorOperationResponse, err error) { + req, err := c.preparerForFrontendEndpointsListByFrontDoorWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForFrontendEndpointsListByFrontDoor(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "FrontendEndpointsListByFrontDoor", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// FrontendEndpointsListByFrontDoorComplete retrieves all of the results into a single object +func (c FrontDoorsClient) FrontendEndpointsListByFrontDoorComplete(ctx context.Context, id FrontDoorId) (FrontendEndpointsListByFrontDoorCompleteResult, error) { + return c.FrontendEndpointsListByFrontDoorCompleteMatchingPredicate(ctx, id, FrontendEndpointOperationPredicate{}) +} + +// FrontendEndpointsListByFrontDoorCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c FrontDoorsClient) FrontendEndpointsListByFrontDoorCompleteMatchingPredicate(ctx context.Context, id FrontDoorId, predicate FrontendEndpointOperationPredicate) (resp FrontendEndpointsListByFrontDoorCompleteResult, err error) { + items := make([]FrontendEndpoint, 0) + + page, err := c.FrontendEndpointsListByFrontDoor(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := FrontendEndpointsListByFrontDoorCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_get_autorest.go new file mode 100644 index 000000000000..b043bb7b7fdf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_get_autorest.go @@ -0,0 +1,68 @@ +package frontdoors + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *FrontDoor +} + +// Get ... +func (c FrontDoorsClient) Get(ctx context.Context, id FrontDoorId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c FrontDoorsClient) preparerForGet(ctx context.Context, id FrontDoorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c FrontDoorsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_list_autorest.go new file mode 100644 index 000000000000..026cf210bcae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_list_autorest.go @@ -0,0 +1,187 @@ +package frontdoors + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]FrontDoor + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []FrontDoor +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c FrontDoorsClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c FrontDoorsClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/frontDoors", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c FrontDoorsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c FrontDoorsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []FrontDoor `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c FrontDoorsClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, FrontDoorOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c FrontDoorsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate FrontDoorOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]FrontDoor, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..b5d837122a77 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package frontdoors + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]FrontDoor + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []FrontDoor +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c FrontDoorsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c FrontDoorsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/frontDoors", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c FrontDoorsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c FrontDoorsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []FrontDoor `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c FrontDoorsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, FrontDoorOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c FrontDoorsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate FrontDoorOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]FrontDoor, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_rulesenginescreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_rulesenginescreateorupdate_autorest.go new file mode 100644 index 000000000000..24e315525a4a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_rulesenginescreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package frontdoors + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RulesEnginesCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// RulesEnginesCreateOrUpdate ... +func (c FrontDoorsClient) RulesEnginesCreateOrUpdate(ctx context.Context, id RulesEngineId, input RulesEngine) (result RulesEnginesCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForRulesEnginesCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForRulesEnginesCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// RulesEnginesCreateOrUpdateThenPoll performs RulesEnginesCreateOrUpdate then polls until it's completed +func (c FrontDoorsClient) RulesEnginesCreateOrUpdateThenPoll(ctx context.Context, id RulesEngineId, input RulesEngine) error { + result, err := c.RulesEnginesCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RulesEnginesCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after RulesEnginesCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForRulesEnginesCreateOrUpdate prepares the RulesEnginesCreateOrUpdate request. +func (c FrontDoorsClient) preparerForRulesEnginesCreateOrUpdate(ctx context.Context, id RulesEngineId, input RulesEngine) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForRulesEnginesCreateOrUpdate sends the RulesEnginesCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c FrontDoorsClient) senderForRulesEnginesCreateOrUpdate(ctx context.Context, req *http.Request) (future RulesEnginesCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_rulesenginesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_rulesenginesdelete_autorest.go new file mode 100644 index 000000000000..07d20df7801c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_rulesenginesdelete_autorest.go @@ -0,0 +1,78 @@ +package frontdoors + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RulesEnginesDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// RulesEnginesDelete ... +func (c FrontDoorsClient) RulesEnginesDelete(ctx context.Context, id RulesEngineId) (result RulesEnginesDeleteOperationResponse, err error) { + req, err := c.preparerForRulesEnginesDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForRulesEnginesDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// RulesEnginesDeleteThenPoll performs RulesEnginesDelete then polls until it's completed +func (c FrontDoorsClient) RulesEnginesDeleteThenPoll(ctx context.Context, id RulesEngineId) error { + result, err := c.RulesEnginesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing RulesEnginesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after RulesEnginesDelete: %+v", err) + } + + return nil +} + +// preparerForRulesEnginesDelete prepares the RulesEnginesDelete request. +func (c FrontDoorsClient) preparerForRulesEnginesDelete(ctx context.Context, id RulesEngineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForRulesEnginesDelete sends the RulesEnginesDelete request. The method will close the +// http.Response Body if it receives an error. +func (c FrontDoorsClient) senderForRulesEnginesDelete(ctx context.Context, req *http.Request) (future RulesEnginesDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_rulesenginesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_rulesenginesget_autorest.go new file mode 100644 index 000000000000..ce2ff3ebfa43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_rulesenginesget_autorest.go @@ -0,0 +1,68 @@ +package frontdoors + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RulesEnginesGetOperationResponse struct { + HttpResponse *http.Response + Model *RulesEngine +} + +// RulesEnginesGet ... +func (c FrontDoorsClient) RulesEnginesGet(ctx context.Context, id RulesEngineId) (result RulesEnginesGetOperationResponse, err error) { + req, err := c.preparerForRulesEnginesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRulesEnginesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRulesEnginesGet prepares the RulesEnginesGet request. +func (c FrontDoorsClient) preparerForRulesEnginesGet(ctx context.Context, id RulesEngineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRulesEnginesGet handles the response to the RulesEnginesGet request. The method always +// closes the http.Response Body. +func (c FrontDoorsClient) responderForRulesEnginesGet(resp *http.Response) (result RulesEnginesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_rulesengineslistbyfrontdoor_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_rulesengineslistbyfrontdoor_autorest.go new file mode 100644 index 000000000000..87cfd6fbdf0a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_rulesengineslistbyfrontdoor_autorest.go @@ -0,0 +1,186 @@ +package frontdoors + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RulesEnginesListByFrontDoorOperationResponse struct { + HttpResponse *http.Response + Model *[]RulesEngine + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (RulesEnginesListByFrontDoorOperationResponse, error) +} + +type RulesEnginesListByFrontDoorCompleteResult struct { + Items []RulesEngine +} + +func (r RulesEnginesListByFrontDoorOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r RulesEnginesListByFrontDoorOperationResponse) LoadMore(ctx context.Context) (resp RulesEnginesListByFrontDoorOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// RulesEnginesListByFrontDoor ... +func (c FrontDoorsClient) RulesEnginesListByFrontDoor(ctx context.Context, id FrontDoorId) (resp RulesEnginesListByFrontDoorOperationResponse, err error) { + req, err := c.preparerForRulesEnginesListByFrontDoor(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForRulesEnginesListByFrontDoor(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForRulesEnginesListByFrontDoor prepares the RulesEnginesListByFrontDoor request. +func (c FrontDoorsClient) preparerForRulesEnginesListByFrontDoor(ctx context.Context, id FrontDoorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/rulesEngines", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForRulesEnginesListByFrontDoorWithNextLink prepares the RulesEnginesListByFrontDoor request with the given nextLink token. +func (c FrontDoorsClient) preparerForRulesEnginesListByFrontDoorWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRulesEnginesListByFrontDoor handles the response to the RulesEnginesListByFrontDoor request. The method always +// closes the http.Response Body. +func (c FrontDoorsClient) responderForRulesEnginesListByFrontDoor(resp *http.Response) (result RulesEnginesListByFrontDoorOperationResponse, err error) { + type page struct { + Values []RulesEngine `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result RulesEnginesListByFrontDoorOperationResponse, err error) { + req, err := c.preparerForRulesEnginesListByFrontDoorWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRulesEnginesListByFrontDoor(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "RulesEnginesListByFrontDoor", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// RulesEnginesListByFrontDoorComplete retrieves all of the results into a single object +func (c FrontDoorsClient) RulesEnginesListByFrontDoorComplete(ctx context.Context, id FrontDoorId) (RulesEnginesListByFrontDoorCompleteResult, error) { + return c.RulesEnginesListByFrontDoorCompleteMatchingPredicate(ctx, id, RulesEngineOperationPredicate{}) +} + +// RulesEnginesListByFrontDoorCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c FrontDoorsClient) RulesEnginesListByFrontDoorCompleteMatchingPredicate(ctx context.Context, id FrontDoorId, predicate RulesEngineOperationPredicate) (resp RulesEnginesListByFrontDoorCompleteResult, err error) { + items := make([]RulesEngine, 0) + + page, err := c.RulesEnginesListByFrontDoor(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := RulesEnginesListByFrontDoorCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_validatecustomdomain_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_validatecustomdomain_autorest.go new file mode 100644 index 000000000000..2972575a1df2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/method_validatecustomdomain_autorest.go @@ -0,0 +1,70 @@ +package frontdoors + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateCustomDomainOperationResponse struct { + HttpResponse *http.Response + Model *ValidateCustomDomainOutput +} + +// ValidateCustomDomain ... +func (c FrontDoorsClient) ValidateCustomDomain(ctx context.Context, id FrontDoorId, input ValidateCustomDomainInput) (result ValidateCustomDomainOperationResponse, err error) { + req, err := c.preparerForValidateCustomDomain(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ValidateCustomDomain", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ValidateCustomDomain", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForValidateCustomDomain(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "frontdoors.FrontDoorsClient", "ValidateCustomDomain", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForValidateCustomDomain prepares the ValidateCustomDomain request. +func (c FrontDoorsClient) preparerForValidateCustomDomain(ctx context.Context, id FrontDoorId, input ValidateCustomDomainInput) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/validateCustomDomain", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForValidateCustomDomain handles the response to the ValidateCustomDomain request. The method always +// closes the http.Response Body. +func (c FrontDoorsClient) responderForValidateCustomDomain(resp *http.Response) (result ValidateCustomDomainOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_backend.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_backend.go new file mode 100644 index 000000000000..0e1f2baf6c24 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_backend.go @@ -0,0 +1,19 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Backend struct { + Address *string `json:"address,omitempty"` + BackendHostHeader *string `json:"backendHostHeader,omitempty"` + EnabledState *BackendEnabledState `json:"enabledState,omitempty"` + HTTPPort *int64 `json:"httpPort,omitempty"` + HTTPSPort *int64 `json:"httpsPort,omitempty"` + Priority *int64 `json:"priority,omitempty"` + PrivateEndpointStatus *PrivateEndpointStatus `json:"privateEndpointStatus,omitempty"` + PrivateLinkAlias *string `json:"privateLinkAlias,omitempty"` + PrivateLinkApprovalMessage *string `json:"privateLinkApprovalMessage,omitempty"` + PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"` + PrivateLinkResourceId *string `json:"privateLinkResourceId,omitempty"` + Weight *int64 `json:"weight,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_backendpool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_backendpool.go new file mode 100644 index 000000000000..5f33eeecdb89 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_backendpool.go @@ -0,0 +1,11 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendPool struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BackendPoolProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_backendpoolproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_backendpoolproperties.go new file mode 100644 index 000000000000..d09f5f8b635a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_backendpoolproperties.go @@ -0,0 +1,11 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendPoolProperties struct { + Backends *[]Backend `json:"backends,omitempty"` + HealthProbeSettings *SubResource `json:"healthProbeSettings,omitempty"` + LoadBalancingSettings *SubResource `json:"loadBalancingSettings,omitempty"` + ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_backendpoolssettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_backendpoolssettings.go new file mode 100644 index 000000000000..a7611e6e318f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_backendpoolssettings.go @@ -0,0 +1,9 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackendPoolsSettings struct { + EnforceCertificateNameCheck *EnforceCertificateNameCheckEnabledState `json:"enforceCertificateNameCheck,omitempty"` + SendRecvTimeoutSeconds *int64 `json:"sendRecvTimeoutSeconds,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_cacheconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_cacheconfiguration.go new file mode 100644 index 000000000000..0a1c95343a8d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_cacheconfiguration.go @@ -0,0 +1,11 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CacheConfiguration struct { + CacheDuration *string `json:"cacheDuration,omitempty"` + DynamicCompression *DynamicCompressionEnabled `json:"dynamicCompression,omitempty"` + QueryParameterStripDirective *FrontDoorQuery `json:"queryParameterStripDirective,omitempty"` + QueryParameters *string `json:"queryParameters,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_customhttpsconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_customhttpsconfiguration.go new file mode 100644 index 000000000000..8e2a25a1d373 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_customhttpsconfiguration.go @@ -0,0 +1,12 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomHTTPSConfiguration struct { + CertificateSource FrontDoorCertificateSource `json:"certificateSource"` + FrontDoorCertificateSourceParameters *FrontDoorCertificateSourceParameters `json:"frontDoorCertificateSourceParameters,omitempty"` + KeyVaultCertificateSourceParameters *KeyVaultCertificateSourceParameters `json:"keyVaultCertificateSourceParameters,omitempty"` + MinimumTlsVersion MinimumTLSVersion `json:"minimumTlsVersion"` + ProtocolType FrontDoorTlsProtocolType `json:"protocolType"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_forwardingconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_forwardingconfiguration.go new file mode 100644 index 000000000000..858e6e8fc0dd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_forwardingconfiguration.go @@ -0,0 +1,44 @@ +package frontdoors + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ RouteConfiguration = ForwardingConfiguration{} + +type ForwardingConfiguration struct { + BackendPool *SubResource `json:"backendPool,omitempty"` + CacheConfiguration *CacheConfiguration `json:"cacheConfiguration,omitempty"` + CustomForwardingPath *string `json:"customForwardingPath,omitempty"` + ForwardingProtocol *FrontDoorForwardingProtocol `json:"forwardingProtocol,omitempty"` + + // Fields inherited from RouteConfiguration +} + +var _ json.Marshaler = ForwardingConfiguration{} + +func (s ForwardingConfiguration) MarshalJSON() ([]byte, error) { + type wrapper ForwardingConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ForwardingConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ForwardingConfiguration: %+v", err) + } + decoded["@odata.type"] = "#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ForwardingConfiguration: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontdoor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontdoor.go new file mode 100644 index 000000000000..48ae5fc35e24 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontdoor.go @@ -0,0 +1,13 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontDoor struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *FrontDoorProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontdoorcertificatesourceparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontdoorcertificatesourceparameters.go new file mode 100644 index 000000000000..fcbd368164d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontdoorcertificatesourceparameters.go @@ -0,0 +1,8 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontDoorCertificateSourceParameters struct { + CertificateType *FrontDoorCertificateType `json:"certificateType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontdoorproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontdoorproperties.go new file mode 100644 index 000000000000..617831498654 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontdoorproperties.go @@ -0,0 +1,20 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontDoorProperties struct { + BackendPools *[]BackendPool `json:"backendPools,omitempty"` + BackendPoolsSettings *BackendPoolsSettings `json:"backendPoolsSettings,omitempty"` + Cname *string `json:"cname,omitempty"` + EnabledState *FrontDoorEnabledState `json:"enabledState,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + FrontdoorId *string `json:"frontdoorId,omitempty"` + FrontendEndpoints *[]FrontendEndpoint `json:"frontendEndpoints,omitempty"` + HealthProbeSettings *[]HealthProbeSettingsModel `json:"healthProbeSettings,omitempty"` + LoadBalancingSettings *[]LoadBalancingSettingsModel `json:"loadBalancingSettings,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` + RoutingRules *[]RoutingRule `json:"routingRules,omitempty"` + RulesEngines *[]RulesEngine `json:"rulesEngines,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontendendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontendendpoint.go new file mode 100644 index 000000000000..ff260ac26a67 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontendendpoint.go @@ -0,0 +1,11 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontendEndpoint struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *FrontendEndpointProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontendendpointproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontendendpointproperties.go new file mode 100644 index 000000000000..f274c81c2a7f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontendendpointproperties.go @@ -0,0 +1,15 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontendEndpointProperties struct { + CustomHTTPSConfiguration *CustomHTTPSConfiguration `json:"customHttpsConfiguration,omitempty"` + CustomHTTPSProvisioningState *CustomHTTPSProvisioningState `json:"customHttpsProvisioningState,omitempty"` + CustomHTTPSProvisioningSubstate *CustomHTTPSProvisioningSubstate `json:"customHttpsProvisioningSubstate,omitempty"` + HostName *string `json:"hostName,omitempty"` + ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` + SessionAffinityEnabledState *SessionAffinityEnabledState `json:"sessionAffinityEnabledState,omitempty"` + SessionAffinityTtlSeconds *int64 `json:"sessionAffinityTtlSeconds,omitempty"` + WebApplicationFirewallPolicyLink *FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontendendpointupdateparameterswebapplicationfirewallpolicylink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontendendpointupdateparameterswebapplicationfirewallpolicylink.go new file mode 100644 index 000000000000..95410260339e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_frontendendpointupdateparameterswebapplicationfirewallpolicylink.go @@ -0,0 +1,8 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_headeraction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_headeraction.go new file mode 100644 index 000000000000..2fa2009157b8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_headeraction.go @@ -0,0 +1,10 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HeaderAction struct { + HeaderActionType HeaderActionType `json:"headerActionType"` + HeaderName string `json:"headerName"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_healthprobesettingsmodel.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_healthprobesettingsmodel.go new file mode 100644 index 000000000000..5a3ffad9d762 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_healthprobesettingsmodel.go @@ -0,0 +1,11 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HealthProbeSettingsModel struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *HealthProbeSettingsProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_healthprobesettingsproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_healthprobesettingsproperties.go new file mode 100644 index 000000000000..0123aea87256 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_healthprobesettingsproperties.go @@ -0,0 +1,13 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HealthProbeSettingsProperties struct { + EnabledState *HealthProbeEnabled `json:"enabledState,omitempty"` + HealthProbeMethod *FrontDoorHealthProbeMethod `json:"healthProbeMethod,omitempty"` + IntervalInSeconds *int64 `json:"intervalInSeconds,omitempty"` + Path *string `json:"path,omitempty"` + Protocol *FrontDoorProtocol `json:"protocol,omitempty"` + ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_keyvaultcertificatesourceparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_keyvaultcertificatesourceparameters.go new file mode 100644 index 000000000000..024869583d2e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_keyvaultcertificatesourceparameters.go @@ -0,0 +1,10 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultCertificateSourceParameters struct { + SecretName *string `json:"secretName,omitempty"` + SecretVersion *string `json:"secretVersion,omitempty"` + Vault *KeyVaultCertificateSourceParametersVault `json:"vault,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_keyvaultcertificatesourceparametersvault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_keyvaultcertificatesourceparametersvault.go new file mode 100644 index 000000000000..a561436adf37 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_keyvaultcertificatesourceparametersvault.go @@ -0,0 +1,8 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultCertificateSourceParametersVault struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_loadbalancingsettingsmodel.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_loadbalancingsettingsmodel.go new file mode 100644 index 000000000000..abe54df73983 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_loadbalancingsettingsmodel.go @@ -0,0 +1,11 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadBalancingSettingsModel struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *LoadBalancingSettingsProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_loadbalancingsettingsproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_loadbalancingsettingsproperties.go new file mode 100644 index 000000000000..a28338fe24ac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_loadbalancingsettingsproperties.go @@ -0,0 +1,11 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadBalancingSettingsProperties struct { + AdditionalLatencyMilliseconds *int64 `json:"additionalLatencyMilliseconds,omitempty"` + ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` + SampleSize *int64 `json:"sampleSize,omitempty"` + SuccessfulSamplesRequired *int64 `json:"successfulSamplesRequired,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_purgeparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_purgeparameters.go new file mode 100644 index 000000000000..6ff020b16a40 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_purgeparameters.go @@ -0,0 +1,8 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PurgeParameters struct { + ContentPaths []string `json:"contentPaths"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_redirectconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_redirectconfiguration.go new file mode 100644 index 000000000000..78e9991c0202 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_redirectconfiguration.go @@ -0,0 +1,46 @@ +package frontdoors + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ RouteConfiguration = RedirectConfiguration{} + +type RedirectConfiguration struct { + CustomFragment *string `json:"customFragment,omitempty"` + CustomHost *string `json:"customHost,omitempty"` + CustomPath *string `json:"customPath,omitempty"` + CustomQueryString *string `json:"customQueryString,omitempty"` + RedirectProtocol *FrontDoorRedirectProtocol `json:"redirectProtocol,omitempty"` + RedirectType *FrontDoorRedirectType `json:"redirectType,omitempty"` + + // Fields inherited from RouteConfiguration +} + +var _ json.Marshaler = RedirectConfiguration{} + +func (s RedirectConfiguration) MarshalJSON() ([]byte, error) { + type wrapper RedirectConfiguration + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling RedirectConfiguration: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling RedirectConfiguration: %+v", err) + } + decoded["@odata.type"] = "#Microsoft.Azure.FrontDoor.Models.FrontdoorRedirectConfiguration" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling RedirectConfiguration: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_routeconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_routeconfiguration.go new file mode 100644 index 000000000000..1634b9cda768 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_routeconfiguration.go @@ -0,0 +1,56 @@ +package frontdoors + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RouteConfiguration interface { +} + +func unmarshalRouteConfigurationImplementation(input []byte) (RouteConfiguration, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling RouteConfiguration into map[string]interface: %+v", err) + } + + value, ok := temp["@odata.type"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration") { + var out ForwardingConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ForwardingConfiguration: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "#Microsoft.Azure.FrontDoor.Models.FrontdoorRedirectConfiguration") { + var out RedirectConfiguration + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into RedirectConfiguration: %+v", err) + } + return out, nil + } + + type RawRouteConfigurationImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawRouteConfigurationImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_routingrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_routingrule.go new file mode 100644 index 000000000000..22d9cbc95213 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_routingrule.go @@ -0,0 +1,11 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RoutingRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RoutingRuleProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_routingruleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_routingruleproperties.go new file mode 100644 index 000000000000..cd1c1e3ef45f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_routingruleproperties.go @@ -0,0 +1,52 @@ +package frontdoors + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RoutingRuleProperties struct { + AcceptedProtocols *[]FrontDoorProtocol `json:"acceptedProtocols,omitempty"` + EnabledState *RoutingRuleEnabledState `json:"enabledState,omitempty"` + FrontendEndpoints *[]SubResource `json:"frontendEndpoints,omitempty"` + PatternsToMatch *[]string `json:"patternsToMatch,omitempty"` + ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` + RouteConfiguration RouteConfiguration `json:"routeConfiguration"` + RulesEngine *SubResource `json:"rulesEngine,omitempty"` + WebApplicationFirewallPolicyLink *RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink `json:"webApplicationFirewallPolicyLink,omitempty"` +} + +var _ json.Unmarshaler = &RoutingRuleProperties{} + +func (s *RoutingRuleProperties) UnmarshalJSON(bytes []byte) error { + type alias RoutingRuleProperties + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into RoutingRuleProperties: %+v", err) + } + + s.AcceptedProtocols = decoded.AcceptedProtocols + s.EnabledState = decoded.EnabledState + s.FrontendEndpoints = decoded.FrontendEndpoints + s.PatternsToMatch = decoded.PatternsToMatch + s.ResourceState = decoded.ResourceState + s.RulesEngine = decoded.RulesEngine + s.WebApplicationFirewallPolicyLink = decoded.WebApplicationFirewallPolicyLink + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling RoutingRuleProperties into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["routeConfiguration"]; ok { + impl, err := unmarshalRouteConfigurationImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'RouteConfiguration' for 'RoutingRuleProperties': %+v", err) + } + s.RouteConfiguration = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_routingruleupdateparameterswebapplicationfirewallpolicylink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_routingruleupdateparameterswebapplicationfirewallpolicylink.go new file mode 100644 index 000000000000..637b9d5c6897 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_routingruleupdateparameterswebapplicationfirewallpolicylink.go @@ -0,0 +1,8 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RoutingRuleUpdateParametersWebApplicationFirewallPolicyLink struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_rulesengine.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_rulesengine.go new file mode 100644 index 000000000000..98087edd7431 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_rulesengine.go @@ -0,0 +1,11 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RulesEngine struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RulesEngineProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_rulesengineaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_rulesengineaction.go new file mode 100644 index 000000000000..382ac7083fc2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_rulesengineaction.go @@ -0,0 +1,42 @@ +package frontdoors + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RulesEngineAction struct { + RequestHeaderActions *[]HeaderAction `json:"requestHeaderActions,omitempty"` + ResponseHeaderActions *[]HeaderAction `json:"responseHeaderActions,omitempty"` + RouteConfigurationOverride RouteConfiguration `json:"routeConfigurationOverride"` +} + +var _ json.Unmarshaler = &RulesEngineAction{} + +func (s *RulesEngineAction) UnmarshalJSON(bytes []byte) error { + type alias RulesEngineAction + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into RulesEngineAction: %+v", err) + } + + s.RequestHeaderActions = decoded.RequestHeaderActions + s.ResponseHeaderActions = decoded.ResponseHeaderActions + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling RulesEngineAction into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["routeConfigurationOverride"]; ok { + impl, err := unmarshalRouteConfigurationImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'RouteConfigurationOverride' for 'RulesEngineAction': %+v", err) + } + s.RouteConfigurationOverride = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_rulesenginematchcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_rulesenginematchcondition.go new file mode 100644 index 000000000000..e722453503b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_rulesenginematchcondition.go @@ -0,0 +1,13 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RulesEngineMatchCondition struct { + NegateCondition *bool `json:"negateCondition,omitempty"` + RulesEngineMatchValue []string `json:"rulesEngineMatchValue"` + RulesEngineMatchVariable RulesEngineMatchVariable `json:"rulesEngineMatchVariable"` + RulesEngineOperator RulesEngineOperator `json:"rulesEngineOperator"` + Selector *string `json:"selector,omitempty"` + Transforms *[]Transform `json:"transforms,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_rulesengineproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_rulesengineproperties.go new file mode 100644 index 000000000000..ec548ded127c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_rulesengineproperties.go @@ -0,0 +1,9 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RulesEngineProperties struct { + ResourceState *FrontDoorResourceState `json:"resourceState,omitempty"` + Rules *[]RulesEngineRule `json:"rules,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_rulesenginerule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_rulesenginerule.go new file mode 100644 index 000000000000..f93e1948af69 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_rulesenginerule.go @@ -0,0 +1,12 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RulesEngineRule struct { + Action RulesEngineAction `json:"action"` + MatchConditions *[]RulesEngineMatchCondition `json:"matchConditions,omitempty"` + MatchProcessingBehavior *MatchProcessingBehavior `json:"matchProcessingBehavior,omitempty"` + Name string `json:"name"` + Priority int64 `json:"priority"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_subresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_subresource.go new file mode 100644 index 000000000000..772f8ff7d712 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_subresource.go @@ -0,0 +1,8 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_validatecustomdomaininput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_validatecustomdomaininput.go new file mode 100644 index 000000000000..139a77a1b4bc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_validatecustomdomaininput.go @@ -0,0 +1,8 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateCustomDomainInput struct { + HostName string `json:"hostName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_validatecustomdomainoutput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_validatecustomdomainoutput.go new file mode 100644 index 000000000000..6aeb0dcbd72f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_validatecustomdomainoutput.go @@ -0,0 +1,10 @@ +package frontdoors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateCustomDomainOutput struct { + CustomDomainValidated *bool `json:"customDomainValidated,omitempty"` + Message *string `json:"message,omitempty"` + Reason *string `json:"reason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/predicates.go new file mode 100644 index 000000000000..1186104d84ee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/predicates.go @@ -0,0 +1,75 @@ +package frontdoors + +type FrontDoorOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p FrontDoorOperationPredicate) Matches(input FrontDoor) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type FrontendEndpointOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p FrontendEndpointOperationPredicate) Matches(input FrontendEndpoint) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type RulesEngineOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p RulesEngineOperationPredicate) Matches(input RulesEngine) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/version.go new file mode 100644 index 000000000000..5d48a1072d21 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/version.go @@ -0,0 +1,12 @@ +package frontdoors + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/frontdoors/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/README.md index 2b50bf702989..b9e137ebf833 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nameValue") +id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedHSMValue") payload := dedicatedhsms.DedicatedHsm{ // ... @@ -41,7 +41,7 @@ if err := client.DedicatedHsmCreateOrUpdateThenPoll(ctx, id, payload); err != ni ```go ctx := context.TODO() -id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nameValue") +id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedHSMValue") if err := client.DedicatedHsmDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DedicatedHsmDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nameValue") +id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedHSMValue") read, err := client.DedicatedHsmGet(ctx, id) if err != nil { @@ -103,7 +103,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nameValue") +id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedHSMValue") // alternatively `client.DedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx, id)` can be used to do batched pagination items, err := client.DedicatedHsmListOutboundNetworkDependenciesEndpointsComplete(ctx, id) @@ -120,7 +120,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nameValue") +id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedHSMValue") payload := dedicatedhsms.DedicatedHsmPatchParameters{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/id_dedicatedhsm.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/id_dedicatedhsm.go index 04dc52c63568..11f054ce582b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/id_dedicatedhsm.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/id_dedicatedhsm.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = DedicatedHSMId{} type DedicatedHSMId struct { SubscriptionId string ResourceGroupName string - Name string + DedicatedHSMName string } // NewDedicatedHSMID returns a new DedicatedHSMId struct -func NewDedicatedHSMID(subscriptionId string, resourceGroupName string, name string) DedicatedHSMId { +func NewDedicatedHSMID(subscriptionId string, resourceGroupName string, dedicatedHSMName string) DedicatedHSMId { return DedicatedHSMId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - Name: name, + DedicatedHSMName: dedicatedHSMName, } } @@ -44,8 +44,8 @@ func ParseDedicatedHSMID(input string) (*DedicatedHSMId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.DedicatedHSMName, ok = parsed.Parsed["dedicatedHSMName"]; !ok { + return nil, fmt.Errorf("the segment 'dedicatedHSMName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseDedicatedHSMIDInsensitively(input string) (*DedicatedHSMId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.DedicatedHSMName, ok = parsed.Parsed["dedicatedHSMName"]; !ok { + return nil, fmt.Errorf("the segment 'dedicatedHSMName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateDedicatedHSMID(input interface{}, key string) (warnings []string, e // ID returns the formatted Dedicated H S M ID func (id DedicatedHSMId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.Name) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DedicatedHSMName) } // Segments returns a slice of Resource ID Segments which comprise this Dedicated H S M ID @@ -109,7 +109,7 @@ func (id DedicatedHSMId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftHardwareSecurityModules", "Microsoft.HardwareSecurityModules", "Microsoft.HardwareSecurityModules"), resourceids.StaticSegment("staticDedicatedHSMs", "dedicatedHSMs", "dedicatedHSMs"), - resourceids.UserSpecifiedSegment("name", "nameValue"), + resourceids.UserSpecifiedSegment("dedicatedHSMName", "dedicatedHSMValue"), } } @@ -118,7 +118,7 @@ func (id DedicatedHSMId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Name: %q", id.Name), + fmt.Sprintf("Dedicated H S M Name: %q", id.DedicatedHSMName), } return fmt.Sprintf("Dedicated H S M (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2020-12-08/healthbots/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2020-12-08/healthbots/README.md index 57bdaa86af6a..956087b716fe 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2020-12-08/healthbots/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2020-12-08/healthbots/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := healthbots.NewHealthBotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "botValue") +id := healthbots.NewHealthBotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "healthBotValue") payload := healthbots.HealthBot{ // ... @@ -41,7 +41,7 @@ if err := client.BotsCreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := healthbots.NewHealthBotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "botValue") +id := healthbots.NewHealthBotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "healthBotValue") if err := client.BotsDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.BotsDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := healthbots.NewHealthBotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "botValue") +id := healthbots.NewHealthBotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "healthBotValue") read, err := client.BotsGet(ctx, id) if err != nil { @@ -103,7 +103,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := healthbots.NewHealthBotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "botValue") +id := healthbots.NewHealthBotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "healthBotValue") payload := healthbots.HealthBotUpdateParameters{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2020-12-08/healthbots/id_healthbot.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2020-12-08/healthbots/id_healthbot.go index daf206800521..5845775b00d1 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2020-12-08/healthbots/id_healthbot.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2020-12-08/healthbots/id_healthbot.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = HealthBotId{} type HealthBotId struct { SubscriptionId string ResourceGroupName string - BotName string + HealthBotName string } // NewHealthBotID returns a new HealthBotId struct -func NewHealthBotID(subscriptionId string, resourceGroupName string, botName string) HealthBotId { +func NewHealthBotID(subscriptionId string, resourceGroupName string, healthBotName string) HealthBotId { return HealthBotId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - BotName: botName, + HealthBotName: healthBotName, } } @@ -44,8 +44,8 @@ func ParseHealthBotID(input string) (*HealthBotId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.BotName, ok = parsed.Parsed["botName"]; !ok { - return nil, fmt.Errorf("the segment 'botName' was not found in the resource id %q", input) + if id.HealthBotName, ok = parsed.Parsed["healthBotName"]; !ok { + return nil, fmt.Errorf("the segment 'healthBotName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseHealthBotIDInsensitively(input string) (*HealthBotId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.BotName, ok = parsed.Parsed["botName"]; !ok { - return nil, fmt.Errorf("the segment 'botName' was not found in the resource id %q", input) + if id.HealthBotName, ok = parsed.Parsed["healthBotName"]; !ok { + return nil, fmt.Errorf("the segment 'healthBotName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateHealthBotID(input interface{}, key string) (warnings []string, erro // ID returns the formatted Health Bot ID func (id HealthBotId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.HealthBot/healthBots/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BotName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.HealthBotName) } // Segments returns a slice of Resource ID Segments which comprise this Health Bot ID @@ -109,7 +109,7 @@ func (id HealthBotId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftHealthBot", "Microsoft.HealthBot", "Microsoft.HealthBot"), resourceids.StaticSegment("staticHealthBots", "healthBots", "healthBots"), - resourceids.UserSpecifiedSegment("botName", "botValue"), + resourceids.UserSpecifiedSegment("healthBotName", "healthBotValue"), } } @@ -118,7 +118,7 @@ func (id HealthBotId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Bot Name: %q", id.BotName), + fmt.Sprintf("Health Bot Name: %q", id.HealthBotName), } return fmt.Sprintf("Health Bot (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/README.md new file mode 100644 index 000000000000..7d44ddcd14e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions` Documentation + +The `machineextensions` SDK allows for interaction with the Azure Resource Manager Service `hybridcompute` (API Version `2022-03-10`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions" +``` + + +### Client Initialization + +```go +client := machineextensions.NewMachineExtensionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `MachineExtensionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := machineextensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "machineValue", "extensionValue") + +payload := machineextensions.MachineExtension{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `MachineExtensionsClient.Delete` + +```go +ctx := context.TODO() +id := machineextensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "machineValue", "extensionValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `MachineExtensionsClient.Get` + +```go +ctx := context.TODO() +id := machineextensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "machineValue", "extensionValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `MachineExtensionsClient.List` + +```go +ctx := context.TODO() +id := machineextensions.NewMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "machineValue") + +// alternatively `client.List(ctx, id, machineextensions.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, machineextensions.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `MachineExtensionsClient.Update` + +```go +ctx := context.TODO() +id := machineextensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "machineValue", "extensionValue") + +payload := machineextensions.MachineExtensionUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/client.go new file mode 100644 index 000000000000..c75183a06370 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/client.go @@ -0,0 +1,18 @@ +package machineextensions + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MachineExtensionsClient struct { + Client autorest.Client + baseUri string +} + +func NewMachineExtensionsClientWithBaseURI(endpoint string) MachineExtensionsClient { + return MachineExtensionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/constants.go new file mode 100644 index 000000000000..7addbad5798d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/constants.go @@ -0,0 +1,37 @@ +package machineextensions + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/id_extension.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/id_extension.go new file mode 100644 index 000000000000..0e109342998f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/id_extension.go @@ -0,0 +1,137 @@ +package machineextensions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ExtensionId{} + +// ExtensionId is a struct representing the Resource ID for a Extension +type ExtensionId struct { + SubscriptionId string + ResourceGroupName string + MachineName string + ExtensionName string +} + +// NewExtensionID returns a new ExtensionId struct +func NewExtensionID(subscriptionId string, resourceGroupName string, machineName string, extensionName string) ExtensionId { + return ExtensionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MachineName: machineName, + ExtensionName: extensionName, + } +} + +// ParseExtensionID parses 'input' into a ExtensionId +func ParseExtensionID(input string) (*ExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(ExtensionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ExtensionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { + return nil, fmt.Errorf("the segment 'machineName' was not found in the resource id %q", input) + } + + if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { + return nil, fmt.Errorf("the segment 'extensionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseExtensionIDInsensitively parses 'input' case-insensitively into a ExtensionId +// note: this method should only be used for API response data and not user input +func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(ExtensionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ExtensionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { + return nil, fmt.Errorf("the segment 'machineName' was not found in the resource id %q", input) + } + + if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { + return nil, fmt.Errorf("the segment 'extensionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateExtensionID checks that 'input' can be parsed as a Extension ID +func ValidateExtensionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseExtensionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Extension ID +func (id ExtensionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.HybridCompute/machines/%s/extensions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MachineName, id.ExtensionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Extension ID +func (id ExtensionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftHybridCompute", "Microsoft.HybridCompute", "Microsoft.HybridCompute"), + resourceids.StaticSegment("staticMachines", "machines", "machines"), + resourceids.UserSpecifiedSegment("machineName", "machineValue"), + resourceids.StaticSegment("staticExtensions", "extensions", "extensions"), + resourceids.UserSpecifiedSegment("extensionName", "extensionValue"), + } +} + +// String returns a human-readable description of this Extension ID +func (id ExtensionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Machine Name: %q", id.MachineName), + fmt.Sprintf("Extension Name: %q", id.ExtensionName), + } + return fmt.Sprintf("Extension (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/id_machine.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/id_machine.go new file mode 100644 index 000000000000..5f0018cd87e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/id_machine.go @@ -0,0 +1,124 @@ +package machineextensions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = MachineId{} + +// MachineId is a struct representing the Resource ID for a Machine +type MachineId struct { + SubscriptionId string + ResourceGroupName string + MachineName string +} + +// NewMachineID returns a new MachineId struct +func NewMachineID(subscriptionId string, resourceGroupName string, machineName string) MachineId { + return MachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MachineName: machineName, + } +} + +// ParseMachineID parses 'input' into a MachineId +func ParseMachineID(input string) (*MachineId, error) { + parser := resourceids.NewParserFromResourceIdType(MachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MachineId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { + return nil, fmt.Errorf("the segment 'machineName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseMachineIDInsensitively parses 'input' case-insensitively into a MachineId +// note: this method should only be used for API response data and not user input +func ParseMachineIDInsensitively(input string) (*MachineId, error) { + parser := resourceids.NewParserFromResourceIdType(MachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MachineId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { + return nil, fmt.Errorf("the segment 'machineName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateMachineID checks that 'input' can be parsed as a Machine ID +func ValidateMachineID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Machine ID +func (id MachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.HybridCompute/machines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MachineName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Machine ID +func (id MachineId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftHybridCompute", "Microsoft.HybridCompute", "Microsoft.HybridCompute"), + resourceids.StaticSegment("staticMachines", "machines", "machines"), + resourceids.UserSpecifiedSegment("machineName", "machineValue"), + } +} + +// String returns a human-readable description of this Machine ID +func (id MachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Machine Name: %q", id.MachineName), + } + return fmt.Sprintf("Machine (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/method_createorupdate_autorest.go new file mode 100644 index 000000000000..bedfc9d4aaa7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package machineextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c MachineExtensionsClient) CreateOrUpdate(ctx context.Context, id ExtensionId, input MachineExtension) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c MachineExtensionsClient) CreateOrUpdateThenPoll(ctx context.Context, id ExtensionId, input MachineExtension) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c MachineExtensionsClient) preparerForCreateOrUpdate(ctx context.Context, id ExtensionId, input MachineExtension) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c MachineExtensionsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/method_delete_autorest.go new file mode 100644 index 000000000000..7eb2b1846855 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/method_delete_autorest.go @@ -0,0 +1,78 @@ +package machineextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c MachineExtensionsClient) Delete(ctx context.Context, id ExtensionId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c MachineExtensionsClient) DeleteThenPoll(ctx context.Context, id ExtensionId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c MachineExtensionsClient) preparerForDelete(ctx context.Context, id ExtensionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c MachineExtensionsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/method_get_autorest.go new file mode 100644 index 000000000000..8dc93ee55e10 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/method_get_autorest.go @@ -0,0 +1,68 @@ +package machineextensions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *MachineExtension +} + +// Get ... +func (c MachineExtensionsClient) Get(ctx context.Context, id ExtensionId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c MachineExtensionsClient) preparerForGet(ctx context.Context, id ExtensionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c MachineExtensionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/method_list_autorest.go new file mode 100644 index 000000000000..f53cea7a2ea3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/method_list_autorest.go @@ -0,0 +1,215 @@ +package machineextensions + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]MachineExtension + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []MachineExtension +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Expand *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// List ... +func (c MachineExtensionsClient) List(ctx context.Context, id MachineId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c MachineExtensionsClient) preparerForList(ctx context.Context, id MachineId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/extensions", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c MachineExtensionsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c MachineExtensionsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []MachineExtension `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c MachineExtensionsClient) ListComplete(ctx context.Context, id MachineId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, MachineExtensionOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c MachineExtensionsClient) ListCompleteMatchingPredicate(ctx context.Context, id MachineId, options ListOperationOptions, predicate MachineExtensionOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]MachineExtension, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/method_update_autorest.go new file mode 100644 index 000000000000..9e7279edd2ac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/method_update_autorest.go @@ -0,0 +1,79 @@ +package machineextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c MachineExtensionsClient) Update(ctx context.Context, id ExtensionId, input MachineExtensionUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "machineextensions.MachineExtensionsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c MachineExtensionsClient) UpdateThenPoll(ctx context.Context, id ExtensionId, input MachineExtensionUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c MachineExtensionsClient) preparerForUpdate(ctx context.Context, id ExtensionId, input MachineExtensionUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c MachineExtensionsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextension.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextension.go new file mode 100644 index 000000000000..c763dea91cab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextension.go @@ -0,0 +1,18 @@ +package machineextensions + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MachineExtension struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *MachineExtensionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextensioninstanceview.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextensioninstanceview.go new file mode 100644 index 000000000000..b97af53820a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextensioninstanceview.go @@ -0,0 +1,11 @@ +package machineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MachineExtensionInstanceView struct { + Name *string `json:"name,omitempty"` + Status *MachineExtensionInstanceViewStatus `json:"status,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextensioninstanceviewstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextensioninstanceviewstatus.go new file mode 100644 index 000000000000..74e73c501827 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextensioninstanceviewstatus.go @@ -0,0 +1,30 @@ +package machineextensions + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MachineExtensionInstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *MachineExtensionInstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *MachineExtensionInstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextensionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextensionproperties.go new file mode 100644 index 000000000000..d8f4dd106ea9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextensionproperties.go @@ -0,0 +1,17 @@ +package machineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MachineExtensionProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + InstanceView *MachineExtensionInstanceView `json:"instanceView,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextensionupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextensionupdate.go new file mode 100644 index 000000000000..a1a0b788156a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextensionupdate.go @@ -0,0 +1,9 @@ +package machineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MachineExtensionUpdate struct { + Properties *MachineExtensionUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextensionupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextensionupdateproperties.go new file mode 100644 index 000000000000..30d8c96f07c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/model_machineextensionupdateproperties.go @@ -0,0 +1,14 @@ +package machineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MachineExtensionUpdateProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/predicates.go new file mode 100644 index 000000000000..04c219398100 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/predicates.go @@ -0,0 +1,29 @@ +package machineextensions + +type MachineExtensionOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p MachineExtensionOperationPredicate) Matches(input MachineExtension) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/version.go new file mode 100644 index 000000000000..121ec8f8ad3c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions/version.go @@ -0,0 +1,12 @@ +package machineextensions + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-03-10" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/machineextensions/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/README.md new file mode 100644 index 000000000000..51f077c9c637 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines` Documentation + +The `machines` SDK allows for interaction with the Azure Resource Manager Service `hybridcompute` (API Version `2022-03-10`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines" +``` + + +### Client Initialization + +```go +client := machines.NewMachinesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `MachinesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := machines.NewMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "machineValue") + +payload := machines.Machine{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `MachinesClient.Delete` + +```go +ctx := context.TODO() +id := machines.NewMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "machineValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `MachinesClient.Get` + +```go +ctx := context.TODO() +id := machines.NewMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "machineValue") + +read, err := client.Get(ctx, id, machines.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `MachinesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := machines.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `MachinesClient.ListBySubscription` + +```go +ctx := context.TODO() +id := machines.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `MachinesClient.Update` + +```go +ctx := context.TODO() +id := machines.NewMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "machineValue") + +payload := machines.MachineUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/client.go new file mode 100644 index 000000000000..9ef1f74b8a52 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/client.go @@ -0,0 +1,18 @@ +package machines + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MachinesClient struct { + Client autorest.Client + baseUri string +} + +func NewMachinesClientWithBaseURI(endpoint string) MachinesClient { + return MachinesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/constants.go new file mode 100644 index 000000000000..a50d13739a76 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/constants.go @@ -0,0 +1,155 @@ +package machines + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssessmentModeTypes string + +const ( + AssessmentModeTypesAutomaticByPlatform AssessmentModeTypes = "AutomaticByPlatform" + AssessmentModeTypesImageDefault AssessmentModeTypes = "ImageDefault" +) + +func PossibleValuesForAssessmentModeTypes() []string { + return []string{ + string(AssessmentModeTypesAutomaticByPlatform), + string(AssessmentModeTypesImageDefault), + } +} + +func parseAssessmentModeTypes(input string) (*AssessmentModeTypes, error) { + vals := map[string]AssessmentModeTypes{ + "automaticbyplatform": AssessmentModeTypesAutomaticByPlatform, + "imagedefault": AssessmentModeTypesImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AssessmentModeTypes(input) + return &out, nil +} + +type InstanceViewTypes string + +const ( + InstanceViewTypesInstanceView InstanceViewTypes = "instanceView" +) + +func PossibleValuesForInstanceViewTypes() []string { + return []string{ + string(InstanceViewTypesInstanceView), + } +} + +func parseInstanceViewTypes(input string) (*InstanceViewTypes, error) { + vals := map[string]InstanceViewTypes{ + "instanceview": InstanceViewTypesInstanceView, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InstanceViewTypes(input) + return &out, nil +} + +type PatchModeTypes string + +const ( + PatchModeTypesAutomaticByOS PatchModeTypes = "AutomaticByOS" + PatchModeTypesAutomaticByPlatform PatchModeTypes = "AutomaticByPlatform" + PatchModeTypesImageDefault PatchModeTypes = "ImageDefault" + PatchModeTypesManual PatchModeTypes = "Manual" +) + +func PossibleValuesForPatchModeTypes() []string { + return []string{ + string(PatchModeTypesAutomaticByOS), + string(PatchModeTypesAutomaticByPlatform), + string(PatchModeTypesImageDefault), + string(PatchModeTypesManual), + } +} + +func parsePatchModeTypes(input string) (*PatchModeTypes, error) { + vals := map[string]PatchModeTypes{ + "automaticbyos": PatchModeTypesAutomaticByOS, + "automaticbyplatform": PatchModeTypesAutomaticByPlatform, + "imagedefault": PatchModeTypesImageDefault, + "manual": PatchModeTypesManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PatchModeTypes(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} + +type StatusTypes string + +const ( + StatusTypesConnected StatusTypes = "Connected" + StatusTypesDisconnected StatusTypes = "Disconnected" + StatusTypesError StatusTypes = "Error" +) + +func PossibleValuesForStatusTypes() []string { + return []string{ + string(StatusTypesConnected), + string(StatusTypesDisconnected), + string(StatusTypesError), + } +} + +func parseStatusTypes(input string) (*StatusTypes, error) { + vals := map[string]StatusTypes{ + "connected": StatusTypesConnected, + "disconnected": StatusTypesDisconnected, + "error": StatusTypesError, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusTypes(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/id_machine.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/id_machine.go new file mode 100644 index 000000000000..6596b74842d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/id_machine.go @@ -0,0 +1,124 @@ +package machines + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = MachineId{} + +// MachineId is a struct representing the Resource ID for a Machine +type MachineId struct { + SubscriptionId string + ResourceGroupName string + MachineName string +} + +// NewMachineID returns a new MachineId struct +func NewMachineID(subscriptionId string, resourceGroupName string, machineName string) MachineId { + return MachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MachineName: machineName, + } +} + +// ParseMachineID parses 'input' into a MachineId +func ParseMachineID(input string) (*MachineId, error) { + parser := resourceids.NewParserFromResourceIdType(MachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MachineId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { + return nil, fmt.Errorf("the segment 'machineName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseMachineIDInsensitively parses 'input' case-insensitively into a MachineId +// note: this method should only be used for API response data and not user input +func ParseMachineIDInsensitively(input string) (*MachineId, error) { + parser := resourceids.NewParserFromResourceIdType(MachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MachineId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { + return nil, fmt.Errorf("the segment 'machineName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateMachineID checks that 'input' can be parsed as a Machine ID +func ValidateMachineID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Machine ID +func (id MachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.HybridCompute/machines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MachineName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Machine ID +func (id MachineId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftHybridCompute", "Microsoft.HybridCompute", "Microsoft.HybridCompute"), + resourceids.StaticSegment("staticMachines", "machines", "machines"), + resourceids.UserSpecifiedSegment("machineName", "machineValue"), + } +} + +// String returns a human-readable description of this Machine ID +func (id MachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Machine Name: %q", id.MachineName), + } + return fmt.Sprintf("Machine (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_createorupdate_autorest.go new file mode 100644 index 000000000000..65c8756bf30d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package machines + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Machine +} + +// CreateOrUpdate ... +func (c MachinesClient) CreateOrUpdate(ctx context.Context, id MachineId, input Machine) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c MachinesClient) preparerForCreateOrUpdate(ctx context.Context, id MachineId, input Machine) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c MachinesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_delete_autorest.go new file mode 100644 index 000000000000..a68df6b858ef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_delete_autorest.go @@ -0,0 +1,66 @@ +package machines + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c MachinesClient) Delete(ctx context.Context, id MachineId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c MachinesClient) preparerForDelete(ctx context.Context, id MachineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c MachinesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_get_autorest.go new file mode 100644 index 000000000000..14056e65351e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_get_autorest.go @@ -0,0 +1,97 @@ +package machines + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Machine +} + +type GetOperationOptions struct { + Expand *InstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// Get ... +func (c MachinesClient) Get(ctx context.Context, id MachineId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c MachinesClient) preparerForGet(ctx context.Context, id MachineId, options GetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c MachinesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..4bb7051278c4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package machines + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Machine + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Machine +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c MachinesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c MachinesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.HybridCompute/machines", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c MachinesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c MachinesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Machine `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c MachinesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, MachineOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c MachinesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate MachineOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Machine, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_listbysubscription_autorest.go new file mode 100644 index 000000000000..4b626c9ea8ed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package machines + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Machine + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []Machine +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c MachinesClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c MachinesClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.HybridCompute/machines", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c MachinesClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c MachinesClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Machine `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c MachinesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, MachineOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c MachinesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate MachineOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]Machine, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_update_autorest.go new file mode 100644 index 000000000000..6181a4e8e4f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/method_update_autorest.go @@ -0,0 +1,69 @@ +package machines + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Machine +} + +// Update ... +func (c MachinesClient) Update(ctx context.Context, id MachineId, input MachineUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "machines.MachinesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c MachinesClient) preparerForUpdate(ctx context.Context, id MachineId, input MachineUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c MachinesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_agentconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_agentconfiguration.go new file mode 100644 index 000000000000..7b4069f14032 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_agentconfiguration.go @@ -0,0 +1,14 @@ +package machines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AgentConfiguration struct { + ExtensionsAllowList *[]ConfigurationExtension `json:"extensionsAllowList,omitempty"` + ExtensionsBlockList *[]ConfigurationExtension `json:"extensionsBlockList,omitempty"` + ExtensionsEnabled *string `json:"extensionsEnabled,omitempty"` + GuestConfigurationEnabled *string `json:"guestConfigurationEnabled,omitempty"` + IncomingConnectionsPorts *[]string `json:"incomingConnectionsPorts,omitempty"` + ProxyBypass *[]string `json:"proxyBypass,omitempty"` + ProxyUrl *string `json:"proxyUrl,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_cloudmetadata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_cloudmetadata.go new file mode 100644 index 000000000000..292947aca13b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_cloudmetadata.go @@ -0,0 +1,8 @@ +package machines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudMetadata struct { + Provider *string `json:"provider,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_configurationextension.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_configurationextension.go new file mode 100644 index 000000000000..a15e10a01a8c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_configurationextension.go @@ -0,0 +1,9 @@ +package machines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationExtension struct { + Publisher *string `json:"publisher,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_erroradditionalinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_erroradditionalinfo.go new file mode 100644 index 000000000000..b43823d85d24 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_erroradditionalinfo.go @@ -0,0 +1,9 @@ +package machines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_errordetail.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_errordetail.go new file mode 100644 index 000000000000..a76af384f03a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_errordetail.go @@ -0,0 +1,12 @@ +package machines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorDetail struct { + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_locationdata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_locationdata.go new file mode 100644 index 000000000000..5d8341e5cca0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_locationdata.go @@ -0,0 +1,11 @@ +package machines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LocationData struct { + City *string `json:"city,omitempty"` + CountryOrRegion *string `json:"countryOrRegion,omitempty"` + District *string `json:"district,omitempty"` + Name string `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machine.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machine.go new file mode 100644 index 000000000000..f776fa759908 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machine.go @@ -0,0 +1,20 @@ +package machines + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Machine struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *MachineProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machineextensioninstanceview.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machineextensioninstanceview.go new file mode 100644 index 000000000000..a1154818910c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machineextensioninstanceview.go @@ -0,0 +1,11 @@ +package machines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MachineExtensionInstanceView struct { + Name *string `json:"name,omitempty"` + Status *MachineExtensionInstanceViewStatus `json:"status,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machineextensioninstanceviewstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machineextensioninstanceviewstatus.go new file mode 100644 index 000000000000..42ea89ad402e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machineextensioninstanceviewstatus.go @@ -0,0 +1,30 @@ +package machines + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MachineExtensionInstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *MachineExtensionInstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *MachineExtensionInstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machineproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machineproperties.go new file mode 100644 index 000000000000..bceb897d4d1e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machineproperties.go @@ -0,0 +1,52 @@ +package machines + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MachineProperties struct { + AdFqdn *string `json:"adFqdn,omitempty"` + AgentConfiguration *AgentConfiguration `json:"agentConfiguration,omitempty"` + AgentVersion *string `json:"agentVersion,omitempty"` + ClientPublicKey *string `json:"clientPublicKey,omitempty"` + CloudMetadata *CloudMetadata `json:"cloudMetadata,omitempty"` + DetectedProperties *map[string]string `json:"detectedProperties,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + DnsFqdn *string `json:"dnsFqdn,omitempty"` + DomainName *string `json:"domainName,omitempty"` + ErrorDetails *[]ErrorDetail `json:"errorDetails,omitempty"` + Extensions *[]MachineExtensionInstanceView `json:"extensions,omitempty"` + LastStatusChange *string `json:"lastStatusChange,omitempty"` + LocationData *LocationData `json:"locationData,omitempty"` + MachineFqdn *string `json:"machineFqdn,omitempty"` + MssqlDiscovered *string `json:"mssqlDiscovered,omitempty"` + OsName *string `json:"osName,omitempty"` + OsProfile *OSProfile `json:"osProfile,omitempty"` + OsSku *string `json:"osSku,omitempty"` + OsType *string `json:"osType,omitempty"` + OsVersion *string `json:"osVersion,omitempty"` + ParentClusterResourceId *string `json:"parentClusterResourceId,omitempty"` + PrivateLinkScopeResourceId *string `json:"privateLinkScopeResourceId,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ServiceStatuses *ServiceStatuses `json:"serviceStatuses,omitempty"` + Status *StatusTypes `json:"status,omitempty"` + VMId *string `json:"vmId,omitempty"` + VMUuid *string `json:"vmUuid,omitempty"` +} + +func (o *MachineProperties) GetLastStatusChangeAsTime() (*time.Time, error) { + if o.LastStatusChange == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastStatusChange, "2006-01-02T15:04:05Z07:00") +} + +func (o *MachineProperties) SetLastStatusChangeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastStatusChange = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machineupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machineupdate.go new file mode 100644 index 000000000000..f1b94de3b311 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machineupdate.go @@ -0,0 +1,14 @@ +package machines + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MachineUpdate struct { + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Properties *MachineUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machineupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machineupdateproperties.go new file mode 100644 index 000000000000..58317bdf9c27 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_machineupdateproperties.go @@ -0,0 +1,12 @@ +package machines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MachineUpdateProperties struct { + CloudMetadata *CloudMetadata `json:"cloudMetadata,omitempty"` + LocationData *LocationData `json:"locationData,omitempty"` + OsProfile *OSProfile `json:"osProfile,omitempty"` + ParentClusterResourceId *string `json:"parentClusterResourceId,omitempty"` + PrivateLinkScopeResourceId *string `json:"privateLinkScopeResourceId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_osprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_osprofile.go new file mode 100644 index 000000000000..997d70b8aec6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_osprofile.go @@ -0,0 +1,10 @@ +package machines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfile struct { + ComputerName *string `json:"computerName,omitempty"` + LinuxConfiguration *OSProfileLinuxConfiguration `json:"linuxConfiguration,omitempty"` + WindowsConfiguration *OSProfileWindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_osprofilelinuxconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_osprofilelinuxconfiguration.go new file mode 100644 index 000000000000..560fd9133db9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_osprofilelinuxconfiguration.go @@ -0,0 +1,8 @@ +package machines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfileLinuxConfiguration struct { + PatchSettings *PatchSettings `json:"patchSettings,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_osprofilewindowsconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_osprofilewindowsconfiguration.go new file mode 100644 index 000000000000..309f073367a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_osprofilewindowsconfiguration.go @@ -0,0 +1,8 @@ +package machines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfileWindowsConfiguration struct { + PatchSettings *PatchSettings `json:"patchSettings,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_patchsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_patchsettings.go new file mode 100644 index 000000000000..d74275f4c0db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_patchsettings.go @@ -0,0 +1,9 @@ +package machines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSettings struct { + AssessmentMode *AssessmentModeTypes `json:"assessmentMode,omitempty"` + PatchMode *PatchModeTypes `json:"patchMode,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_servicestatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_servicestatus.go new file mode 100644 index 000000000000..8cde424d92a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_servicestatus.go @@ -0,0 +1,9 @@ +package machines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceStatus struct { + StartupType *string `json:"startupType,omitempty"` + Status *string `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_servicestatuses.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_servicestatuses.go new file mode 100644 index 000000000000..aff2a8351b06 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/model_servicestatuses.go @@ -0,0 +1,9 @@ +package machines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceStatuses struct { + ExtensionService *ServiceStatus `json:"extensionService,omitempty"` + GuestConfigurationService *ServiceStatus `json:"guestConfigurationService,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/predicates.go new file mode 100644 index 000000000000..006c60728b3d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/predicates.go @@ -0,0 +1,29 @@ +package machines + +type MachineOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p MachineOperationPredicate) Matches(input Machine) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/version.go new file mode 100644 index 000000000000..cd7295761fcd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines/version.go @@ -0,0 +1,12 @@ +package machines + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-03-10" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/machines/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/README.md new file mode 100644 index 000000000000..d79df4d686d6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections` Documentation + +The `privateendpointconnections` SDK allows for interaction with the Azure Resource Manager Service `hybridcompute` (API Version `2022-03-10`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections" +``` + + +### Client Initialization + +```go +client := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateLinkScopeValue", "privateEndpointConnectionValue") + +payload := privateendpointconnections.PrivateEndpointConnection{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Delete` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateLinkScopeValue", "privateEndpointConnectionValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Get` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateLinkScopeValue", "privateEndpointConnectionValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.ListByPrivateLinkScope` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewProviderPrivateLinkScopeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateLinkScopeValue") + +// alternatively `client.ListByPrivateLinkScope(ctx, id)` can be used to do batched pagination +items, err := client.ListByPrivateLinkScopeComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/client.go new file mode 100644 index 000000000000..1de584406fe4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/client.go @@ -0,0 +1,18 @@ +package privateendpointconnections + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionsClient struct { + Client autorest.Client + baseUri string +} + +func NewPrivateEndpointConnectionsClientWithBaseURI(endpoint string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/id_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/id_privateendpointconnection.go new file mode 100644 index 000000000000..462ada33a4c8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/id_privateendpointconnection.go @@ -0,0 +1,137 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PrivateEndpointConnectionId{} + +// PrivateEndpointConnectionId is a struct representing the Resource ID for a Private Endpoint Connection +type PrivateEndpointConnectionId struct { + SubscriptionId string + ResourceGroupName string + PrivateLinkScopeName string + PrivateEndpointConnectionName string +} + +// NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, privateLinkScopeName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { + return PrivateEndpointConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + PrivateLinkScopeName: privateLinkScopeName, + PrivateEndpointConnectionName: privateEndpointConnectionName, + } +} + +// ParsePrivateEndpointConnectionID parses 'input' into a PrivateEndpointConnectionId +func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateEndpointConnectionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { + return nil, fmt.Errorf("the segment 'privateLinkScopeName' was not found in the resource id %q", input) + } + + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePrivateEndpointConnectionIDInsensitively parses 'input' case-insensitively into a PrivateEndpointConnectionId +// note: this method should only be used for API response data and not user input +func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateEndpointConnectionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { + return nil, fmt.Errorf("the segment 'privateLinkScopeName' was not found in the resource id %q", input) + } + + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID +func ValidatePrivateEndpointConnectionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePrivateEndpointConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.HybridCompute/privateLinkScopes/%s/privateEndpointConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateLinkScopeName, id.PrivateEndpointConnectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftHybridCompute", "Microsoft.HybridCompute", "Microsoft.HybridCompute"), + resourceids.StaticSegment("staticPrivateLinkScopes", "privateLinkScopes", "privateLinkScopes"), + resourceids.UserSpecifiedSegment("privateLinkScopeName", "privateLinkScopeValue"), + resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), + resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionValue"), + } +} + +// String returns a human-readable description of this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Private Link Scope Name: %q", id.PrivateLinkScopeName), + fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), + } + return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/id_providerprivatelinkscope.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/id_providerprivatelinkscope.go new file mode 100644 index 000000000000..5e1120013ffc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/id_providerprivatelinkscope.go @@ -0,0 +1,124 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ProviderPrivateLinkScopeId{} + +// ProviderPrivateLinkScopeId is a struct representing the Resource ID for a Provider Private Link Scope +type ProviderPrivateLinkScopeId struct { + SubscriptionId string + ResourceGroupName string + PrivateLinkScopeName string +} + +// NewProviderPrivateLinkScopeID returns a new ProviderPrivateLinkScopeId struct +func NewProviderPrivateLinkScopeID(subscriptionId string, resourceGroupName string, privateLinkScopeName string) ProviderPrivateLinkScopeId { + return ProviderPrivateLinkScopeId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + PrivateLinkScopeName: privateLinkScopeName, + } +} + +// ParseProviderPrivateLinkScopeID parses 'input' into a ProviderPrivateLinkScopeId +func ParseProviderPrivateLinkScopeID(input string) (*ProviderPrivateLinkScopeId, error) { + parser := resourceids.NewParserFromResourceIdType(ProviderPrivateLinkScopeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProviderPrivateLinkScopeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { + return nil, fmt.Errorf("the segment 'privateLinkScopeName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseProviderPrivateLinkScopeIDInsensitively parses 'input' case-insensitively into a ProviderPrivateLinkScopeId +// note: this method should only be used for API response data and not user input +func ParseProviderPrivateLinkScopeIDInsensitively(input string) (*ProviderPrivateLinkScopeId, error) { + parser := resourceids.NewParserFromResourceIdType(ProviderPrivateLinkScopeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProviderPrivateLinkScopeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { + return nil, fmt.Errorf("the segment 'privateLinkScopeName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateProviderPrivateLinkScopeID checks that 'input' can be parsed as a Provider Private Link Scope ID +func ValidateProviderPrivateLinkScopeID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProviderPrivateLinkScopeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Provider Private Link Scope ID +func (id ProviderPrivateLinkScopeId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.HybridCompute/privateLinkScopes/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateLinkScopeName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Provider Private Link Scope ID +func (id ProviderPrivateLinkScopeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftHybridCompute", "Microsoft.HybridCompute", "Microsoft.HybridCompute"), + resourceids.StaticSegment("staticPrivateLinkScopes", "privateLinkScopes", "privateLinkScopes"), + resourceids.UserSpecifiedSegment("privateLinkScopeName", "privateLinkScopeValue"), + } +} + +// String returns a human-readable description of this Provider Private Link Scope ID +func (id ProviderPrivateLinkScopeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Private Link Scope Name: %q", id.PrivateLinkScopeName), + } + return fmt.Sprintf("Provider Private Link Scope (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/method_createorupdate_autorest.go new file mode 100644 index 000000000000..08aac1fbfa75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c PrivateEndpointConnectionsClient) CreateOrUpdateThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c PrivateEndpointConnectionsClient) preparerForCreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateEndpointConnectionsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/method_delete_autorest.go new file mode 100644 index 000000000000..ef4fd3d8e664 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/method_delete_autorest.go @@ -0,0 +1,78 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c PrivateEndpointConnectionsClient) Delete(ctx context.Context, id PrivateEndpointConnectionId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c PrivateEndpointConnectionsClient) DeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c PrivateEndpointConnectionsClient) preparerForDelete(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateEndpointConnectionsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/method_get_autorest.go new file mode 100644 index 000000000000..44bbdcb8f0bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/method_get_autorest.go @@ -0,0 +1,68 @@ +package privateendpointconnections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *PrivateEndpointConnection +} + +// Get ... +func (c PrivateEndpointConnectionsClient) Get(ctx context.Context, id PrivateEndpointConnectionId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c PrivateEndpointConnectionsClient) preparerForGet(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/method_listbyprivatelinkscope_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/method_listbyprivatelinkscope_autorest.go new file mode 100644 index 000000000000..cf15facc9bcf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/method_listbyprivatelinkscope_autorest.go @@ -0,0 +1,186 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByPrivateLinkScopeOperationResponse struct { + HttpResponse *http.Response + Model *[]PrivateEndpointConnection + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByPrivateLinkScopeOperationResponse, error) +} + +type ListByPrivateLinkScopeCompleteResult struct { + Items []PrivateEndpointConnection +} + +func (r ListByPrivateLinkScopeOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByPrivateLinkScopeOperationResponse) LoadMore(ctx context.Context) (resp ListByPrivateLinkScopeOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByPrivateLinkScope ... +func (c PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx context.Context, id ProviderPrivateLinkScopeId) (resp ListByPrivateLinkScopeOperationResponse, err error) { + req, err := c.preparerForListByPrivateLinkScope(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByPrivateLinkScope(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByPrivateLinkScope prepares the ListByPrivateLinkScope request. +func (c PrivateEndpointConnectionsClient) preparerForListByPrivateLinkScope(ctx context.Context, id ProviderPrivateLinkScopeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/privateEndpointConnections", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByPrivateLinkScopeWithNextLink prepares the ListByPrivateLinkScope request with the given nextLink token. +func (c PrivateEndpointConnectionsClient) preparerForListByPrivateLinkScopeWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByPrivateLinkScope handles the response to the ListByPrivateLinkScope request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionsClient) responderForListByPrivateLinkScope(resp *http.Response) (result ListByPrivateLinkScopeOperationResponse, err error) { + type page struct { + Values []PrivateEndpointConnection `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByPrivateLinkScopeOperationResponse, err error) { + req, err := c.preparerForListByPrivateLinkScopeWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByPrivateLinkScope(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByPrivateLinkScopeComplete retrieves all of the results into a single object +func (c PrivateEndpointConnectionsClient) ListByPrivateLinkScopeComplete(ctx context.Context, id ProviderPrivateLinkScopeId) (ListByPrivateLinkScopeCompleteResult, error) { + return c.ListByPrivateLinkScopeCompleteMatchingPredicate(ctx, id, PrivateEndpointConnectionOperationPredicate{}) +} + +// ListByPrivateLinkScopeCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PrivateEndpointConnectionsClient) ListByPrivateLinkScopeCompleteMatchingPredicate(ctx context.Context, id ProviderPrivateLinkScopeId, predicate PrivateEndpointConnectionOperationPredicate) (resp ListByPrivateLinkScopeCompleteResult, err error) { + items := make([]PrivateEndpointConnection, 0) + + page, err := c.ListByPrivateLinkScope(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByPrivateLinkScopeCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/model_privateendpointconnection.go new file mode 100644 index 000000000000..977fe056fe33 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/model_privateendpointconnection.go @@ -0,0 +1,16 @@ +package privateendpointconnections + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/model_privateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/model_privateendpointconnectionproperties.go new file mode 100644 index 000000000000..948cf6c47dcc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/model_privateendpointconnectionproperties.go @@ -0,0 +1,11 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + GroupIds *[]string `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/model_privateendpointproperty.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/model_privateendpointproperty.go new file mode 100644 index 000000000000..b0b0ff184829 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/model_privateendpointproperty.go @@ -0,0 +1,8 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointProperty struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/model_privatelinkserviceconnectionstateproperty.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/model_privatelinkserviceconnectionstateproperty.go new file mode 100644 index 000000000000..ba250769d7a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/model_privatelinkserviceconnectionstateproperty.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionStateProperty struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description string `json:"description"` + Status string `json:"status"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/predicates.go new file mode 100644 index 000000000000..1e847cf7d766 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/predicates.go @@ -0,0 +1,24 @@ +package privateendpointconnections + +type PrivateEndpointConnectionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p PrivateEndpointConnectionOperationPredicate) Matches(input PrivateEndpointConnection) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/version.go new file mode 100644 index 000000000000..9b2c75d03e0f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections/version.go @@ -0,0 +1,12 @@ +package privateendpointconnections + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-03-10" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/privateendpointconnections/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionruleassociations/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionruleassociations/README.md index 49f499c985a6..9b33bfd9adc2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionruleassociations/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionruleassociations/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := datacollectionruleassociations.NewScopedDataCollectionRuleAssociationID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "associationValue") +id := datacollectionruleassociations.NewScopedDataCollectionRuleAssociationID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "dataCollectionRuleAssociationValue") payload := datacollectionruleassociations.DataCollectionRuleAssociationProxyOnlyResource{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := datacollectionruleassociations.NewScopedDataCollectionRuleAssociationID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "associationValue") +id := datacollectionruleassociations.NewScopedDataCollectionRuleAssociationID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "dataCollectionRuleAssociationValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := datacollectionruleassociations.NewScopedDataCollectionRuleAssociationID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "associationValue") +id := datacollectionruleassociations.NewScopedDataCollectionRuleAssociationID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "dataCollectionRuleAssociationValue") read, err := client.Get(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionruleassociations/id_scopeddatacollectionruleassociation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionruleassociations/id_scopeddatacollectionruleassociation.go index 97caef9f0d62..582ab53e7a8b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionruleassociations/id_scopeddatacollectionruleassociation.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionruleassociations/id_scopeddatacollectionruleassociation.go @@ -11,15 +11,15 @@ var _ resourceids.ResourceId = ScopedDataCollectionRuleAssociationId{} // ScopedDataCollectionRuleAssociationId is a struct representing the Resource ID for a Scoped Data Collection Rule Association type ScopedDataCollectionRuleAssociationId struct { - ResourceUri string - AssociationName string + ResourceUri string + DataCollectionRuleAssociationName string } // NewScopedDataCollectionRuleAssociationID returns a new ScopedDataCollectionRuleAssociationId struct -func NewScopedDataCollectionRuleAssociationID(resourceUri string, associationName string) ScopedDataCollectionRuleAssociationId { +func NewScopedDataCollectionRuleAssociationID(resourceUri string, dataCollectionRuleAssociationName string) ScopedDataCollectionRuleAssociationId { return ScopedDataCollectionRuleAssociationId{ - ResourceUri: resourceUri, - AssociationName: associationName, + ResourceUri: resourceUri, + DataCollectionRuleAssociationName: dataCollectionRuleAssociationName, } } @@ -38,8 +38,8 @@ func ParseScopedDataCollectionRuleAssociationID(input string) (*ScopedDataCollec return nil, fmt.Errorf("the segment 'resourceUri' was not found in the resource id %q", input) } - if id.AssociationName, ok = parsed.Parsed["associationName"]; !ok { - return nil, fmt.Errorf("the segment 'associationName' was not found in the resource id %q", input) + if id.DataCollectionRuleAssociationName, ok = parsed.Parsed["dataCollectionRuleAssociationName"]; !ok { + return nil, fmt.Errorf("the segment 'dataCollectionRuleAssociationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseScopedDataCollectionRuleAssociationIDInsensitively(input string) (*Sco return nil, fmt.Errorf("the segment 'resourceUri' was not found in the resource id %q", input) } - if id.AssociationName, ok = parsed.Parsed["associationName"]; !ok { - return nil, fmt.Errorf("the segment 'associationName' was not found in the resource id %q", input) + if id.DataCollectionRuleAssociationName, ok = parsed.Parsed["dataCollectionRuleAssociationName"]; !ok { + return nil, fmt.Errorf("the segment 'dataCollectionRuleAssociationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateScopedDataCollectionRuleAssociationID(input interface{}, key string // ID returns the formatted Scoped Data Collection Rule Association ID func (id ScopedDataCollectionRuleAssociationId) ID() string { fmtString := "/%s/providers/Microsoft.Insights/dataCollectionRuleAssociations/%s" - return fmt.Sprintf(fmtString, strings.TrimPrefix(id.ResourceUri, "/"), id.AssociationName) + return fmt.Sprintf(fmtString, strings.TrimPrefix(id.ResourceUri, "/"), id.DataCollectionRuleAssociationName) } // Segments returns a slice of Resource ID Segments which comprise this Scoped Data Collection Rule Association ID @@ -96,7 +96,7 @@ func (id ScopedDataCollectionRuleAssociationId) Segments() []resourceids.Segment resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), resourceids.StaticSegment("staticDataCollectionRuleAssociations", "dataCollectionRuleAssociations", "dataCollectionRuleAssociations"), - resourceids.UserSpecifiedSegment("associationName", "associationValue"), + resourceids.UserSpecifiedSegment("dataCollectionRuleAssociationName", "dataCollectionRuleAssociationValue"), } } @@ -104,7 +104,7 @@ func (id ScopedDataCollectionRuleAssociationId) Segments() []resourceids.Segment func (id ScopedDataCollectionRuleAssociationId) String() string { components := []string{ fmt.Sprintf("Resource Uri: %q", id.ResourceUri), - fmt.Sprintf("Association Name: %q", id.AssociationName), + fmt.Sprintf("Data Collection Rule Association Name: %q", id.DataCollectionRuleAssociationName), } return fmt.Sprintf("Scoped Data Collection Rule Association (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettings/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettings/README.md index 2b11c6fd03ad..748fa343e865 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettings/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettings/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := diagnosticsettings.NewScopedDiagnosticSettingID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "nameValue") +id := diagnosticsettings.NewScopedDiagnosticSettingID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "diagnosticSettingValue") payload := diagnosticsettings.DiagnosticSettingsResource{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := diagnosticsettings.NewScopedDiagnosticSettingID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "nameValue") +id := diagnosticsettings.NewScopedDiagnosticSettingID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "diagnosticSettingValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := diagnosticsettings.NewScopedDiagnosticSettingID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "nameValue") +id := diagnosticsettings.NewScopedDiagnosticSettingID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "diagnosticSettingValue") read, err := client.Get(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettings/id_scopeddiagnosticsetting.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettings/id_scopeddiagnosticsetting.go index a53e722bad9d..8ec8914dc28a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettings/id_scopeddiagnosticsetting.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettings/id_scopeddiagnosticsetting.go @@ -11,15 +11,15 @@ var _ resourceids.ResourceId = ScopedDiagnosticSettingId{} // ScopedDiagnosticSettingId is a struct representing the Resource ID for a Scoped Diagnostic Setting type ScopedDiagnosticSettingId struct { - ResourceUri string - Name string + ResourceUri string + DiagnosticSettingName string } // NewScopedDiagnosticSettingID returns a new ScopedDiagnosticSettingId struct -func NewScopedDiagnosticSettingID(resourceUri string, name string) ScopedDiagnosticSettingId { +func NewScopedDiagnosticSettingID(resourceUri string, diagnosticSettingName string) ScopedDiagnosticSettingId { return ScopedDiagnosticSettingId{ - ResourceUri: resourceUri, - Name: name, + ResourceUri: resourceUri, + DiagnosticSettingName: diagnosticSettingName, } } @@ -38,8 +38,8 @@ func ParseScopedDiagnosticSettingID(input string) (*ScopedDiagnosticSettingId, e return nil, fmt.Errorf("the segment 'resourceUri' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.DiagnosticSettingName, ok = parsed.Parsed["diagnosticSettingName"]; !ok { + return nil, fmt.Errorf("the segment 'diagnosticSettingName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseScopedDiagnosticSettingIDInsensitively(input string) (*ScopedDiagnosti return nil, fmt.Errorf("the segment 'resourceUri' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.DiagnosticSettingName, ok = parsed.Parsed["diagnosticSettingName"]; !ok { + return nil, fmt.Errorf("the segment 'diagnosticSettingName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateScopedDiagnosticSettingID(input interface{}, key string) (warnings // ID returns the formatted Scoped Diagnostic Setting ID func (id ScopedDiagnosticSettingId) ID() string { fmtString := "/%s/providers/Microsoft.Insights/diagnosticSettings/%s" - return fmt.Sprintf(fmtString, strings.TrimPrefix(id.ResourceUri, "/"), id.Name) + return fmt.Sprintf(fmtString, strings.TrimPrefix(id.ResourceUri, "/"), id.DiagnosticSettingName) } // Segments returns a slice of Resource ID Segments which comprise this Scoped Diagnostic Setting ID @@ -96,7 +96,7 @@ func (id ScopedDiagnosticSettingId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), resourceids.StaticSegment("staticDiagnosticSettings", "diagnosticSettings", "diagnosticSettings"), - resourceids.UserSpecifiedSegment("name", "nameValue"), + resourceids.UserSpecifiedSegment("diagnosticSettingName", "diagnosticSettingValue"), } } @@ -104,7 +104,7 @@ func (id ScopedDiagnosticSettingId) Segments() []resourceids.Segment { func (id ScopedDiagnosticSettingId) String() string { components := []string{ fmt.Sprintf("Resource Uri: %q", id.ResourceUri), - fmt.Sprintf("Name: %q", id.Name), + fmt.Sprintf("Diagnostic Setting Name: %q", id.DiagnosticSettingName), } return fmt.Sprintf("Scoped Diagnostic Setting (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettingscategories/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettingscategories/README.md index 9ace59975a71..ef63d9833a67 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettingscategories/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettingscategories/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := diagnosticsettingscategories.NewScopedDiagnosticSettingsCategoryID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "nameValue") +id := diagnosticsettingscategories.NewScopedDiagnosticSettingsCategoryID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "diagnosticSettingsCategoryValue") read, err := client.DiagnosticSettingsCategoryGet(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettingscategories/id_scopeddiagnosticsettingscategory.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettingscategories/id_scopeddiagnosticsettingscategory.go index 3bb2e52f88e9..87c2a458efe5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettingscategories/id_scopeddiagnosticsettingscategory.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettingscategories/id_scopeddiagnosticsettingscategory.go @@ -11,15 +11,15 @@ var _ resourceids.ResourceId = ScopedDiagnosticSettingsCategoryId{} // ScopedDiagnosticSettingsCategoryId is a struct representing the Resource ID for a Scoped Diagnostic Settings Category type ScopedDiagnosticSettingsCategoryId struct { - ResourceUri string - Name string + ResourceUri string + DiagnosticSettingsCategoryName string } // NewScopedDiagnosticSettingsCategoryID returns a new ScopedDiagnosticSettingsCategoryId struct -func NewScopedDiagnosticSettingsCategoryID(resourceUri string, name string) ScopedDiagnosticSettingsCategoryId { +func NewScopedDiagnosticSettingsCategoryID(resourceUri string, diagnosticSettingsCategoryName string) ScopedDiagnosticSettingsCategoryId { return ScopedDiagnosticSettingsCategoryId{ - ResourceUri: resourceUri, - Name: name, + ResourceUri: resourceUri, + DiagnosticSettingsCategoryName: diagnosticSettingsCategoryName, } } @@ -38,8 +38,8 @@ func ParseScopedDiagnosticSettingsCategoryID(input string) (*ScopedDiagnosticSet return nil, fmt.Errorf("the segment 'resourceUri' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.DiagnosticSettingsCategoryName, ok = parsed.Parsed["diagnosticSettingsCategoryName"]; !ok { + return nil, fmt.Errorf("the segment 'diagnosticSettingsCategoryName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseScopedDiagnosticSettingsCategoryIDInsensitively(input string) (*Scoped return nil, fmt.Errorf("the segment 'resourceUri' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.DiagnosticSettingsCategoryName, ok = parsed.Parsed["diagnosticSettingsCategoryName"]; !ok { + return nil, fmt.Errorf("the segment 'diagnosticSettingsCategoryName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateScopedDiagnosticSettingsCategoryID(input interface{}, key string) ( // ID returns the formatted Scoped Diagnostic Settings Category ID func (id ScopedDiagnosticSettingsCategoryId) ID() string { fmtString := "/%s/providers/Microsoft.Insights/diagnosticSettingsCategories/%s" - return fmt.Sprintf(fmtString, strings.TrimPrefix(id.ResourceUri, "/"), id.Name) + return fmt.Sprintf(fmtString, strings.TrimPrefix(id.ResourceUri, "/"), id.DiagnosticSettingsCategoryName) } // Segments returns a slice of Resource ID Segments which comprise this Scoped Diagnostic Settings Category ID @@ -96,7 +96,7 @@ func (id ScopedDiagnosticSettingsCategoryId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), resourceids.StaticSegment("staticDiagnosticSettingsCategories", "diagnosticSettingsCategories", "diagnosticSettingsCategories"), - resourceids.UserSpecifiedSegment("name", "nameValue"), + resourceids.UserSpecifiedSegment("diagnosticSettingsCategoryName", "diagnosticSettingsCategoryValue"), } } @@ -104,7 +104,7 @@ func (id ScopedDiagnosticSettingsCategoryId) Segments() []resourceids.Segment { func (id ScopedDiagnosticSettingsCategoryId) String() string { components := []string{ fmt.Sprintf("Resource Uri: %q", id.ResourceUri), - fmt.Sprintf("Name: %q", id.Name), + fmt.Sprintf("Diagnostic Settings Category Name: %q", id.DiagnosticSettingsCategoryName), } return fmt.Sprintf("Scoped Diagnostic Settings Category (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-08-01/scheduledqueryrules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-08-01/scheduledqueryrules/README.md index a7ec22c0fb5e..bf96e4ecd4ea 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-08-01/scheduledqueryrules/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-08-01/scheduledqueryrules/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := scheduledqueryrules.NewScheduledQueryRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ruleValue") +id := scheduledqueryrules.NewScheduledQueryRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scheduledQueryRuleValue") payload := scheduledqueryrules.ScheduledQueryRuleResource{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := scheduledqueryrules.NewScheduledQueryRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ruleValue") +id := scheduledqueryrules.NewScheduledQueryRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scheduledQueryRuleValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := scheduledqueryrules.NewScheduledQueryRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ruleValue") +id := scheduledqueryrules.NewScheduledQueryRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scheduledQueryRuleValue") read, err := client.Get(ctx, id) if err != nil { @@ -111,7 +111,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := scheduledqueryrules.NewScheduledQueryRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ruleValue") +id := scheduledqueryrules.NewScheduledQueryRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scheduledQueryRuleValue") payload := scheduledqueryrules.ScheduledQueryRuleResourcePatch{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-08-01/scheduledqueryrules/id_scheduledqueryrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-08-01/scheduledqueryrules/id_scheduledqueryrule.go index 8248679b4271..5c4a5148b6fa 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-08-01/scheduledqueryrules/id_scheduledqueryrule.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-08-01/scheduledqueryrules/id_scheduledqueryrule.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = ScheduledQueryRuleId{} // ScheduledQueryRuleId is a struct representing the Resource ID for a Scheduled Query Rule type ScheduledQueryRuleId struct { - SubscriptionId string - ResourceGroupName string - RuleName string + SubscriptionId string + ResourceGroupName string + ScheduledQueryRuleName string } // NewScheduledQueryRuleID returns a new ScheduledQueryRuleId struct -func NewScheduledQueryRuleID(subscriptionId string, resourceGroupName string, ruleName string) ScheduledQueryRuleId { +func NewScheduledQueryRuleID(subscriptionId string, resourceGroupName string, scheduledQueryRuleName string) ScheduledQueryRuleId { return ScheduledQueryRuleId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - RuleName: ruleName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ScheduledQueryRuleName: scheduledQueryRuleName, } } @@ -44,8 +44,8 @@ func ParseScheduledQueryRuleID(input string) (*ScheduledQueryRuleId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, fmt.Errorf("the segment 'ruleName' was not found in the resource id %q", input) + if id.ScheduledQueryRuleName, ok = parsed.Parsed["scheduledQueryRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'scheduledQueryRuleName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseScheduledQueryRuleIDInsensitively(input string) (*ScheduledQueryRuleId return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, fmt.Errorf("the segment 'ruleName' was not found in the resource id %q", input) + if id.ScheduledQueryRuleName, ok = parsed.Parsed["scheduledQueryRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'scheduledQueryRuleName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateScheduledQueryRuleID(input interface{}, key string) (warnings []str // ID returns the formatted Scheduled Query Rule ID func (id ScheduledQueryRuleId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/scheduledQueryRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RuleName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ScheduledQueryRuleName) } // Segments returns a slice of Resource ID Segments which comprise this Scheduled Query Rule ID @@ -109,7 +109,7 @@ func (id ScheduledQueryRuleId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), resourceids.StaticSegment("staticScheduledQueryRules", "scheduledQueryRules", "scheduledQueryRules"), - resourceids.UserSpecifiedSegment("ruleName", "ruleValue"), + resourceids.UserSpecifiedSegment("scheduledQueryRuleName", "scheduledQueryRuleValue"), } } @@ -118,7 +118,7 @@ func (id ScheduledQueryRuleId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Rule Name: %q", id.RuleName), + fmt.Sprintf("Scheduled Query Rule Name: %q", id.ScheduledQueryRuleName), } return fmt.Sprintf("Scheduled Query Rule (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/README.md index 6dc59f815d48..02970109fb8f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/README.md @@ -66,7 +66,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := apps.NewIotAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := apps.NewIotAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "iotAppValue") payload := apps.App{ // ... @@ -83,7 +83,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := apps.NewIotAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := apps.NewIotAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "iotAppValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -95,7 +95,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := apps.NewIotAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := apps.NewIotAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "iotAppValue") read, err := client.Get(ctx, id) if err != nil { @@ -162,7 +162,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := apps.NewIotAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := apps.NewIotAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "iotAppValue") payload := apps.AppPatch{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/id_iotapp.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/id_iotapp.go index 41ee28a8735c..d05ddf47d69d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/id_iotapp.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/id_iotapp.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = IotAppId{} type IotAppId struct { SubscriptionId string ResourceGroupName string - ResourceName string + IotAppName string } // NewIotAppID returns a new IotAppId struct -func NewIotAppID(subscriptionId string, resourceGroupName string, resourceName string) IotAppId { +func NewIotAppID(subscriptionId string, resourceGroupName string, iotAppName string) IotAppId { return IotAppId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + IotAppName: iotAppName, } } @@ -44,8 +44,8 @@ func ParseIotAppID(input string) (*IotAppId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.IotAppName, ok = parsed.Parsed["iotAppName"]; !ok { + return nil, fmt.Errorf("the segment 'iotAppName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseIotAppIDInsensitively(input string) (*IotAppId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.IotAppName, ok = parsed.Parsed["iotAppName"]; !ok { + return nil, fmt.Errorf("the segment 'iotAppName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateIotAppID(input interface{}, key string) (warnings []string, errors // ID returns the formatted Iot App ID func (id IotAppId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.IoTCentral/iotApps/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IotAppName) } // Segments returns a slice of Resource ID Segments which comprise this Iot App ID @@ -109,7 +109,7 @@ func (id IotAppId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftIoTCentral", "Microsoft.IoTCentral", "Microsoft.IoTCentral"), resourceids.StaticSegment("staticIotApps", "iotApps", "iotApps"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("iotAppName", "iotAppValue"), } } @@ -118,7 +118,7 @@ func (id IotAppId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Iot App Name: %q", id.IotAppName), } return fmt.Sprintf("Iot App (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-07-07/clusters/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-07-07/clusters/id_location.go index 650d35129887..ae3cfc43d228 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-07-07/clusters/id_location.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-07-07/clusters/id_location.go @@ -12,14 +12,14 @@ var _ resourceids.ResourceId = LocationId{} // LocationId is a struct representing the Resource ID for a Location type LocationId struct { SubscriptionId string - Location string + LocationName string } // NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { +func NewLocationID(subscriptionId string, locationName string) LocationId { return LocationId{ SubscriptionId: subscriptionId, - Location: location, + LocationName: locationName, } } @@ -38,8 +38,8 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.Kusto/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } // Segments returns a slice of Resource ID Segments which comprise this Location ID @@ -97,7 +97,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), } } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { func (id LocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), } return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/README.md new file mode 100644 index 000000000000..743d95e64113 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/README.md @@ -0,0 +1,107 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule` Documentation + +The `schedule` SDK allows for interaction with the Azure Resource Manager Service `labservices` (API Version `2022-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule" +``` + + +### Client Initialization + +```go +client := schedule.NewScheduleClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ScheduleClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := schedule.NewScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "scheduleValue") + +payload := schedule.Schedule{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ScheduleClient.Delete` + +```go +ctx := context.TODO() +id := schedule.NewScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "scheduleValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ScheduleClient.Get` + +```go +ctx := context.TODO() +id := schedule.NewScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "scheduleValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ScheduleClient.ListByLab` + +```go +ctx := context.TODO() +id := schedule.NewLabID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue") + +// alternatively `client.ListByLab(ctx, id)` can be used to do batched pagination +items, err := client.ListByLabComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ScheduleClient.Update` + +```go +ctx := context.TODO() +id := schedule.NewScheduleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "labValue", "scheduleValue") + +payload := schedule.ScheduleUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/client.go new file mode 100644 index 000000000000..11f1d41c8c54 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/client.go @@ -0,0 +1,18 @@ +package schedule + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleClient struct { + Client autorest.Client + baseUri string +} + +func NewScheduleClientWithBaseURI(endpoint string) ScheduleClient { + return ScheduleClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/constants.go new file mode 100644 index 000000000000..1c6b42124e43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/constants.go @@ -0,0 +1,117 @@ +package schedule + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateLocked ProvisioningState = "Locked" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateLocked), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "locked": ProvisioningStateLocked, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type RecurrenceFrequency string + +const ( + RecurrenceFrequencyDaily RecurrenceFrequency = "Daily" + RecurrenceFrequencyWeekly RecurrenceFrequency = "Weekly" +) + +func PossibleValuesForRecurrenceFrequency() []string { + return []string{ + string(RecurrenceFrequencyDaily), + string(RecurrenceFrequencyWeekly), + } +} + +func parseRecurrenceFrequency(input string) (*RecurrenceFrequency, error) { + vals := map[string]RecurrenceFrequency{ + "daily": RecurrenceFrequencyDaily, + "weekly": RecurrenceFrequencyWeekly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RecurrenceFrequency(input) + return &out, nil +} + +type WeekDay string + +const ( + WeekDayFriday WeekDay = "Friday" + WeekDayMonday WeekDay = "Monday" + WeekDaySaturday WeekDay = "Saturday" + WeekDaySunday WeekDay = "Sunday" + WeekDayThursday WeekDay = "Thursday" + WeekDayTuesday WeekDay = "Tuesday" + WeekDayWednesday WeekDay = "Wednesday" +) + +func PossibleValuesForWeekDay() []string { + return []string{ + string(WeekDayFriday), + string(WeekDayMonday), + string(WeekDaySaturday), + string(WeekDaySunday), + string(WeekDayThursday), + string(WeekDayTuesday), + string(WeekDayWednesday), + } +} + +func parseWeekDay(input string) (*WeekDay, error) { + vals := map[string]WeekDay{ + "friday": WeekDayFriday, + "monday": WeekDayMonday, + "saturday": WeekDaySaturday, + "sunday": WeekDaySunday, + "thursday": WeekDayThursday, + "tuesday": WeekDayTuesday, + "wednesday": WeekDayWednesday, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WeekDay(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/id_lab.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/id_lab.go new file mode 100644 index 000000000000..14c9394200a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/id_lab.go @@ -0,0 +1,124 @@ +package schedule + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LabId{} + +// LabId is a struct representing the Resource ID for a Lab +type LabId struct { + SubscriptionId string + ResourceGroupName string + LabName string +} + +// NewLabID returns a new LabId struct +func NewLabID(subscriptionId string, resourceGroupName string, labName string) LabId { + return LabId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + LabName: labName, + } +} + +// ParseLabID parses 'input' into a LabId +func ParseLabID(input string) (*LabId, error) { + parser := resourceids.NewParserFromResourceIdType(LabId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LabId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLabIDInsensitively parses 'input' case-insensitively into a LabId +// note: this method should only be used for API response data and not user input +func ParseLabIDInsensitively(input string) (*LabId, error) { + parser := resourceids.NewParserFromResourceIdType(LabId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LabId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLabID checks that 'input' can be parsed as a Lab ID +func ValidateLabID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLabID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Lab ID +func (id LabId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.LabServices/labs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.LabName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Lab ID +func (id LabId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLabServices", "Microsoft.LabServices", "Microsoft.LabServices"), + resourceids.StaticSegment("staticLabs", "labs", "labs"), + resourceids.UserSpecifiedSegment("labName", "labValue"), + } +} + +// String returns a human-readable description of this Lab ID +func (id LabId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Lab Name: %q", id.LabName), + } + return fmt.Sprintf("Lab (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/id_schedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/id_schedule.go new file mode 100644 index 000000000000..4a1a64f73afa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/id_schedule.go @@ -0,0 +1,137 @@ +package schedule + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ScheduleId{} + +// ScheduleId is a struct representing the Resource ID for a Schedule +type ScheduleId struct { + SubscriptionId string + ResourceGroupName string + LabName string + ScheduleName string +} + +// NewScheduleID returns a new ScheduleId struct +func NewScheduleID(subscriptionId string, resourceGroupName string, labName string, scheduleName string) ScheduleId { + return ScheduleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + LabName: labName, + ScheduleName: scheduleName, + } +} + +// ParseScheduleID parses 'input' into a ScheduleId +func ParseScheduleID(input string) (*ScheduleId, error) { + parser := resourceids.NewParserFromResourceIdType(ScheduleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScheduleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { + return nil, fmt.Errorf("the segment 'scheduleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseScheduleIDInsensitively parses 'input' case-insensitively into a ScheduleId +// note: this method should only be used for API response data and not user input +func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { + parser := resourceids.NewParserFromResourceIdType(ScheduleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScheduleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LabName, ok = parsed.Parsed["labName"]; !ok { + return nil, fmt.Errorf("the segment 'labName' was not found in the resource id %q", input) + } + + if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { + return nil, fmt.Errorf("the segment 'scheduleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateScheduleID checks that 'input' can be parsed as a Schedule ID +func ValidateScheduleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseScheduleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Schedule ID +func (id ScheduleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.LabServices/labs/%s/schedules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.LabName, id.ScheduleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Schedule ID +func (id ScheduleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLabServices", "Microsoft.LabServices", "Microsoft.LabServices"), + resourceids.StaticSegment("staticLabs", "labs", "labs"), + resourceids.UserSpecifiedSegment("labName", "labValue"), + resourceids.StaticSegment("staticSchedules", "schedules", "schedules"), + resourceids.UserSpecifiedSegment("scheduleName", "scheduleValue"), + } +} + +// String returns a human-readable description of this Schedule ID +func (id ScheduleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Lab Name: %q", id.LabName), + fmt.Sprintf("Schedule Name: %q", id.ScheduleName), + } + return fmt.Sprintf("Schedule (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/method_createorupdate_autorest.go new file mode 100644 index 000000000000..0c0f70ae5a96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package schedule + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Schedule +} + +// CreateOrUpdate ... +func (c ScheduleClient) CreateOrUpdate(ctx context.Context, id ScheduleId, input Schedule) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ScheduleClient) preparerForCreateOrUpdate(ctx context.Context, id ScheduleId, input Schedule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ScheduleClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/method_delete_autorest.go new file mode 100644 index 000000000000..3c3904466881 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/method_delete_autorest.go @@ -0,0 +1,78 @@ +package schedule + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ScheduleClient) Delete(ctx context.Context, id ScheduleId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ScheduleClient) DeleteThenPoll(ctx context.Context, id ScheduleId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ScheduleClient) preparerForDelete(ctx context.Context, id ScheduleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ScheduleClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/method_get_autorest.go new file mode 100644 index 000000000000..46cd9742cf37 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/method_get_autorest.go @@ -0,0 +1,68 @@ +package schedule + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Schedule +} + +// Get ... +func (c ScheduleClient) Get(ctx context.Context, id ScheduleId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ScheduleClient) preparerForGet(ctx context.Context, id ScheduleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ScheduleClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/method_listbylab_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/method_listbylab_autorest.go new file mode 100644 index 000000000000..fa3dfe3094bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/method_listbylab_autorest.go @@ -0,0 +1,186 @@ +package schedule + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByLabOperationResponse struct { + HttpResponse *http.Response + Model *[]Schedule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByLabOperationResponse, error) +} + +type ListByLabCompleteResult struct { + Items []Schedule +} + +func (r ListByLabOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByLabOperationResponse) LoadMore(ctx context.Context) (resp ListByLabOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByLab ... +func (c ScheduleClient) ListByLab(ctx context.Context, id LabId) (resp ListByLabOperationResponse, err error) { + req, err := c.preparerForListByLab(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "ListByLab", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "ListByLab", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByLab(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "ListByLab", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByLab prepares the ListByLab request. +func (c ScheduleClient) preparerForListByLab(ctx context.Context, id LabId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/schedules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByLabWithNextLink prepares the ListByLab request with the given nextLink token. +func (c ScheduleClient) preparerForListByLabWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByLab handles the response to the ListByLab request. The method always +// closes the http.Response Body. +func (c ScheduleClient) responderForListByLab(resp *http.Response) (result ListByLabOperationResponse, err error) { + type page struct { + Values []Schedule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByLabOperationResponse, err error) { + req, err := c.preparerForListByLabWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "ListByLab", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "ListByLab", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByLab(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "ListByLab", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByLabComplete retrieves all of the results into a single object +func (c ScheduleClient) ListByLabComplete(ctx context.Context, id LabId) (ListByLabCompleteResult, error) { + return c.ListByLabCompleteMatchingPredicate(ctx, id, ScheduleOperationPredicate{}) +} + +// ListByLabCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ScheduleClient) ListByLabCompleteMatchingPredicate(ctx context.Context, id LabId, predicate ScheduleOperationPredicate) (resp ListByLabCompleteResult, err error) { + items := make([]Schedule, 0) + + page, err := c.ListByLab(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByLabCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/method_update_autorest.go new file mode 100644 index 000000000000..cb3710f71391 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/method_update_autorest.go @@ -0,0 +1,69 @@ +package schedule + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Schedule +} + +// Update ... +func (c ScheduleClient) Update(ctx context.Context, id ScheduleId, input ScheduleUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schedule.ScheduleClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ScheduleClient) preparerForUpdate(ctx context.Context, id ScheduleId, input ScheduleUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ScheduleClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/model_recurrencepattern.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/model_recurrencepattern.go new file mode 100644 index 000000000000..b5f375906fe4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/model_recurrencepattern.go @@ -0,0 +1,26 @@ +package schedule + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecurrencePattern struct { + ExpirationDate string `json:"expirationDate"` + Frequency RecurrenceFrequency `json:"frequency"` + Interval *int64 `json:"interval,omitempty"` + WeekDays *[]WeekDay `json:"weekDays,omitempty"` +} + +func (o *RecurrencePattern) GetExpirationDateAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.ExpirationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *RecurrencePattern) SetExpirationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationDate = formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/model_schedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/model_schedule.go new file mode 100644 index 000000000000..810453634f1d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/model_schedule.go @@ -0,0 +1,16 @@ +package schedule + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Schedule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties ScheduleProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/model_scheduleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/model_scheduleproperties.go new file mode 100644 index 000000000000..de698b227bd0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/model_scheduleproperties.go @@ -0,0 +1,40 @@ +package schedule + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleProperties struct { + Notes *string `json:"notes,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RecurrencePattern *RecurrencePattern `json:"recurrencePattern,omitempty"` + StartAt *string `json:"startAt,omitempty"` + StopAt string `json:"stopAt"` + TimeZoneId string `json:"timeZoneId"` +} + +func (o *ScheduleProperties) GetStartAtAsTime() (*time.Time, error) { + if o.StartAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *ScheduleProperties) SetStartAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartAt = &formatted +} + +func (o *ScheduleProperties) GetStopAtAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.StopAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *ScheduleProperties) SetStopAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StopAt = formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/model_scheduleupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/model_scheduleupdate.go new file mode 100644 index 000000000000..57030b33d881 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/model_scheduleupdate.go @@ -0,0 +1,8 @@ +package schedule + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleUpdate struct { + Properties *ScheduleUpdateProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/model_scheduleupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/model_scheduleupdateproperties.go new file mode 100644 index 000000000000..3878a8e4f38b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/model_scheduleupdateproperties.go @@ -0,0 +1,42 @@ +package schedule + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleUpdateProperties struct { + Notes *string `json:"notes,omitempty"` + RecurrencePattern *RecurrencePattern `json:"recurrencePattern,omitempty"` + StartAt *string `json:"startAt,omitempty"` + StopAt *string `json:"stopAt,omitempty"` + TimeZoneId *string `json:"timeZoneId,omitempty"` +} + +func (o *ScheduleUpdateProperties) GetStartAtAsTime() (*time.Time, error) { + if o.StartAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *ScheduleUpdateProperties) SetStartAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartAt = &formatted +} + +func (o *ScheduleUpdateProperties) GetStopAtAsTime() (*time.Time, error) { + if o.StopAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StopAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *ScheduleUpdateProperties) SetStopAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StopAt = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/predicates.go new file mode 100644 index 000000000000..41f6d3ed25ba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/predicates.go @@ -0,0 +1,24 @@ +package schedule + +type ScheduleOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ScheduleOperationPredicate) Matches(input Schedule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/version.go new file mode 100644 index 000000000000..2c94464c64c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule/version.go @@ -0,0 +1,12 @@ +package schedule + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/schedule/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/README.md new file mode 100644 index 000000000000..46938743c9db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements` Documentation + +The `integrationaccountagreements` SDK allows for interaction with the Azure Resource Manager Service `logic` (API Version `2019-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements" +``` + + +### Client Initialization + +```go +client := integrationaccountagreements.NewIntegrationAccountAgreementsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `IntegrationAccountAgreementsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := integrationaccountagreements.NewAgreementID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "agreementValue") + +payload := integrationaccountagreements.IntegrationAccountAgreement{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountAgreementsClient.Delete` + +```go +ctx := context.TODO() +id := integrationaccountagreements.NewAgreementID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "agreementValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountAgreementsClient.Get` + +```go +ctx := context.TODO() +id := integrationaccountagreements.NewAgreementID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "agreementValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountAgreementsClient.List` + +```go +ctx := context.TODO() +id := integrationaccountagreements.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +// alternatively `client.List(ctx, id, integrationaccountagreements.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, integrationaccountagreements.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `IntegrationAccountAgreementsClient.ListContentCallbackUrl` + +```go +ctx := context.TODO() +id := integrationaccountagreements.NewAgreementID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "agreementValue") + +payload := integrationaccountagreements.GetCallbackUrlParameters{ + // ... +} + + +read, err := client.ListContentCallbackUrl(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/client.go new file mode 100644 index 000000000000..e8ab61376e74 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/client.go @@ -0,0 +1,18 @@ +package integrationaccountagreements + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountAgreementsClient struct { + Client autorest.Client + baseUri string +} + +func NewIntegrationAccountAgreementsClientWithBaseURI(endpoint string) IntegrationAccountAgreementsClient { + return IntegrationAccountAgreementsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/constants.go new file mode 100644 index 000000000000..3d80c637771a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/constants.go @@ -0,0 +1,533 @@ +package integrationaccountagreements + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AgreementType string + +const ( + AgreementTypeASTwo AgreementType = "AS2" + AgreementTypeEdifact AgreementType = "Edifact" + AgreementTypeNotSpecified AgreementType = "NotSpecified" + AgreementTypeXOneTwo AgreementType = "X12" +) + +func PossibleValuesForAgreementType() []string { + return []string{ + string(AgreementTypeASTwo), + string(AgreementTypeEdifact), + string(AgreementTypeNotSpecified), + string(AgreementTypeXOneTwo), + } +} + +func parseAgreementType(input string) (*AgreementType, error) { + vals := map[string]AgreementType{ + "as2": AgreementTypeASTwo, + "edifact": AgreementTypeEdifact, + "notspecified": AgreementTypeNotSpecified, + "x12": AgreementTypeXOneTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AgreementType(input) + return &out, nil +} + +type EdifactCharacterSet string + +const ( + EdifactCharacterSetKECA EdifactCharacterSet = "KECA" + EdifactCharacterSetNotSpecified EdifactCharacterSet = "NotSpecified" + EdifactCharacterSetUNOA EdifactCharacterSet = "UNOA" + EdifactCharacterSetUNOB EdifactCharacterSet = "UNOB" + EdifactCharacterSetUNOC EdifactCharacterSet = "UNOC" + EdifactCharacterSetUNOD EdifactCharacterSet = "UNOD" + EdifactCharacterSetUNOE EdifactCharacterSet = "UNOE" + EdifactCharacterSetUNOF EdifactCharacterSet = "UNOF" + EdifactCharacterSetUNOG EdifactCharacterSet = "UNOG" + EdifactCharacterSetUNOH EdifactCharacterSet = "UNOH" + EdifactCharacterSetUNOI EdifactCharacterSet = "UNOI" + EdifactCharacterSetUNOJ EdifactCharacterSet = "UNOJ" + EdifactCharacterSetUNOK EdifactCharacterSet = "UNOK" + EdifactCharacterSetUNOX EdifactCharacterSet = "UNOX" + EdifactCharacterSetUNOY EdifactCharacterSet = "UNOY" +) + +func PossibleValuesForEdifactCharacterSet() []string { + return []string{ + string(EdifactCharacterSetKECA), + string(EdifactCharacterSetNotSpecified), + string(EdifactCharacterSetUNOA), + string(EdifactCharacterSetUNOB), + string(EdifactCharacterSetUNOC), + string(EdifactCharacterSetUNOD), + string(EdifactCharacterSetUNOE), + string(EdifactCharacterSetUNOF), + string(EdifactCharacterSetUNOG), + string(EdifactCharacterSetUNOH), + string(EdifactCharacterSetUNOI), + string(EdifactCharacterSetUNOJ), + string(EdifactCharacterSetUNOK), + string(EdifactCharacterSetUNOX), + string(EdifactCharacterSetUNOY), + } +} + +func parseEdifactCharacterSet(input string) (*EdifactCharacterSet, error) { + vals := map[string]EdifactCharacterSet{ + "keca": EdifactCharacterSetKECA, + "notspecified": EdifactCharacterSetNotSpecified, + "unoa": EdifactCharacterSetUNOA, + "unob": EdifactCharacterSetUNOB, + "unoc": EdifactCharacterSetUNOC, + "unod": EdifactCharacterSetUNOD, + "unoe": EdifactCharacterSetUNOE, + "unof": EdifactCharacterSetUNOF, + "unog": EdifactCharacterSetUNOG, + "unoh": EdifactCharacterSetUNOH, + "unoi": EdifactCharacterSetUNOI, + "unoj": EdifactCharacterSetUNOJ, + "unok": EdifactCharacterSetUNOK, + "unox": EdifactCharacterSetUNOX, + "unoy": EdifactCharacterSetUNOY, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EdifactCharacterSet(input) + return &out, nil +} + +type EdifactDecimalIndicator string + +const ( + EdifactDecimalIndicatorComma EdifactDecimalIndicator = "Comma" + EdifactDecimalIndicatorDecimal EdifactDecimalIndicator = "Decimal" + EdifactDecimalIndicatorNotSpecified EdifactDecimalIndicator = "NotSpecified" +) + +func PossibleValuesForEdifactDecimalIndicator() []string { + return []string{ + string(EdifactDecimalIndicatorComma), + string(EdifactDecimalIndicatorDecimal), + string(EdifactDecimalIndicatorNotSpecified), + } +} + +func parseEdifactDecimalIndicator(input string) (*EdifactDecimalIndicator, error) { + vals := map[string]EdifactDecimalIndicator{ + "comma": EdifactDecimalIndicatorComma, + "decimal": EdifactDecimalIndicatorDecimal, + "notspecified": EdifactDecimalIndicatorNotSpecified, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EdifactDecimalIndicator(input) + return &out, nil +} + +type EncryptionAlgorithm string + +const ( + EncryptionAlgorithmAESOneNineTwo EncryptionAlgorithm = "AES192" + EncryptionAlgorithmAESOneTwoEight EncryptionAlgorithm = "AES128" + EncryptionAlgorithmAESTwoFiveSix EncryptionAlgorithm = "AES256" + EncryptionAlgorithmDESThree EncryptionAlgorithm = "DES3" + EncryptionAlgorithmNone EncryptionAlgorithm = "None" + EncryptionAlgorithmNotSpecified EncryptionAlgorithm = "NotSpecified" + EncryptionAlgorithmRCTwo EncryptionAlgorithm = "RC2" +) + +func PossibleValuesForEncryptionAlgorithm() []string { + return []string{ + string(EncryptionAlgorithmAESOneNineTwo), + string(EncryptionAlgorithmAESOneTwoEight), + string(EncryptionAlgorithmAESTwoFiveSix), + string(EncryptionAlgorithmDESThree), + string(EncryptionAlgorithmNone), + string(EncryptionAlgorithmNotSpecified), + string(EncryptionAlgorithmRCTwo), + } +} + +func parseEncryptionAlgorithm(input string) (*EncryptionAlgorithm, error) { + vals := map[string]EncryptionAlgorithm{ + "aes192": EncryptionAlgorithmAESOneNineTwo, + "aes128": EncryptionAlgorithmAESOneTwoEight, + "aes256": EncryptionAlgorithmAESTwoFiveSix, + "des3": EncryptionAlgorithmDESThree, + "none": EncryptionAlgorithmNone, + "notspecified": EncryptionAlgorithmNotSpecified, + "rc2": EncryptionAlgorithmRCTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EncryptionAlgorithm(input) + return &out, nil +} + +type HashingAlgorithm string + +const ( + HashingAlgorithmMDFive HashingAlgorithm = "MD5" + HashingAlgorithmNone HashingAlgorithm = "None" + HashingAlgorithmNotSpecified HashingAlgorithm = "NotSpecified" + HashingAlgorithmSHAOne HashingAlgorithm = "SHA1" + HashingAlgorithmSHATwoFiveOneTwo HashingAlgorithm = "SHA2512" + HashingAlgorithmSHATwoThreeEightFour HashingAlgorithm = "SHA2384" + HashingAlgorithmSHATwoTwoFiveSix HashingAlgorithm = "SHA2256" +) + +func PossibleValuesForHashingAlgorithm() []string { + return []string{ + string(HashingAlgorithmMDFive), + string(HashingAlgorithmNone), + string(HashingAlgorithmNotSpecified), + string(HashingAlgorithmSHAOne), + string(HashingAlgorithmSHATwoFiveOneTwo), + string(HashingAlgorithmSHATwoThreeEightFour), + string(HashingAlgorithmSHATwoTwoFiveSix), + } +} + +func parseHashingAlgorithm(input string) (*HashingAlgorithm, error) { + vals := map[string]HashingAlgorithm{ + "md5": HashingAlgorithmMDFive, + "none": HashingAlgorithmNone, + "notspecified": HashingAlgorithmNotSpecified, + "sha1": HashingAlgorithmSHAOne, + "sha2512": HashingAlgorithmSHATwoFiveOneTwo, + "sha2384": HashingAlgorithmSHATwoThreeEightFour, + "sha2256": HashingAlgorithmSHATwoTwoFiveSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HashingAlgorithm(input) + return &out, nil +} + +type KeyType string + +const ( + KeyTypeNotSpecified KeyType = "NotSpecified" + KeyTypePrimary KeyType = "Primary" + KeyTypeSecondary KeyType = "Secondary" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypeNotSpecified), + string(KeyTypePrimary), + string(KeyTypeSecondary), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "notspecified": KeyTypeNotSpecified, + "primary": KeyTypePrimary, + "secondary": KeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} + +type MessageFilterType string + +const ( + MessageFilterTypeExclude MessageFilterType = "Exclude" + MessageFilterTypeInclude MessageFilterType = "Include" + MessageFilterTypeNotSpecified MessageFilterType = "NotSpecified" +) + +func PossibleValuesForMessageFilterType() []string { + return []string{ + string(MessageFilterTypeExclude), + string(MessageFilterTypeInclude), + string(MessageFilterTypeNotSpecified), + } +} + +func parseMessageFilterType(input string) (*MessageFilterType, error) { + vals := map[string]MessageFilterType{ + "exclude": MessageFilterTypeExclude, + "include": MessageFilterTypeInclude, + "notspecified": MessageFilterTypeNotSpecified, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MessageFilterType(input) + return &out, nil +} + +type SegmentTerminatorSuffix string + +const ( + SegmentTerminatorSuffixCR SegmentTerminatorSuffix = "CR" + SegmentTerminatorSuffixCRLF SegmentTerminatorSuffix = "CRLF" + SegmentTerminatorSuffixLF SegmentTerminatorSuffix = "LF" + SegmentTerminatorSuffixNone SegmentTerminatorSuffix = "None" + SegmentTerminatorSuffixNotSpecified SegmentTerminatorSuffix = "NotSpecified" +) + +func PossibleValuesForSegmentTerminatorSuffix() []string { + return []string{ + string(SegmentTerminatorSuffixCR), + string(SegmentTerminatorSuffixCRLF), + string(SegmentTerminatorSuffixLF), + string(SegmentTerminatorSuffixNone), + string(SegmentTerminatorSuffixNotSpecified), + } +} + +func parseSegmentTerminatorSuffix(input string) (*SegmentTerminatorSuffix, error) { + vals := map[string]SegmentTerminatorSuffix{ + "cr": SegmentTerminatorSuffixCR, + "crlf": SegmentTerminatorSuffixCRLF, + "lf": SegmentTerminatorSuffixLF, + "none": SegmentTerminatorSuffixNone, + "notspecified": SegmentTerminatorSuffixNotSpecified, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SegmentTerminatorSuffix(input) + return &out, nil +} + +type SigningAlgorithm string + +const ( + SigningAlgorithmDefault SigningAlgorithm = "Default" + SigningAlgorithmNotSpecified SigningAlgorithm = "NotSpecified" + SigningAlgorithmSHAOne SigningAlgorithm = "SHA1" + SigningAlgorithmSHATwoFiveOneTwo SigningAlgorithm = "SHA2512" + SigningAlgorithmSHATwoThreeEightFour SigningAlgorithm = "SHA2384" + SigningAlgorithmSHATwoTwoFiveSix SigningAlgorithm = "SHA2256" +) + +func PossibleValuesForSigningAlgorithm() []string { + return []string{ + string(SigningAlgorithmDefault), + string(SigningAlgorithmNotSpecified), + string(SigningAlgorithmSHAOne), + string(SigningAlgorithmSHATwoFiveOneTwo), + string(SigningAlgorithmSHATwoThreeEightFour), + string(SigningAlgorithmSHATwoTwoFiveSix), + } +} + +func parseSigningAlgorithm(input string) (*SigningAlgorithm, error) { + vals := map[string]SigningAlgorithm{ + "default": SigningAlgorithmDefault, + "notspecified": SigningAlgorithmNotSpecified, + "sha1": SigningAlgorithmSHAOne, + "sha2512": SigningAlgorithmSHATwoFiveOneTwo, + "sha2384": SigningAlgorithmSHATwoThreeEightFour, + "sha2256": SigningAlgorithmSHATwoTwoFiveSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SigningAlgorithm(input) + return &out, nil +} + +type TrailingSeparatorPolicy string + +const ( + TrailingSeparatorPolicyMandatory TrailingSeparatorPolicy = "Mandatory" + TrailingSeparatorPolicyNotAllowed TrailingSeparatorPolicy = "NotAllowed" + TrailingSeparatorPolicyNotSpecified TrailingSeparatorPolicy = "NotSpecified" + TrailingSeparatorPolicyOptional TrailingSeparatorPolicy = "Optional" +) + +func PossibleValuesForTrailingSeparatorPolicy() []string { + return []string{ + string(TrailingSeparatorPolicyMandatory), + string(TrailingSeparatorPolicyNotAllowed), + string(TrailingSeparatorPolicyNotSpecified), + string(TrailingSeparatorPolicyOptional), + } +} + +func parseTrailingSeparatorPolicy(input string) (*TrailingSeparatorPolicy, error) { + vals := map[string]TrailingSeparatorPolicy{ + "mandatory": TrailingSeparatorPolicyMandatory, + "notallowed": TrailingSeparatorPolicyNotAllowed, + "notspecified": TrailingSeparatorPolicyNotSpecified, + "optional": TrailingSeparatorPolicyOptional, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TrailingSeparatorPolicy(input) + return &out, nil +} + +type UsageIndicator string + +const ( + UsageIndicatorInformation UsageIndicator = "Information" + UsageIndicatorNotSpecified UsageIndicator = "NotSpecified" + UsageIndicatorProduction UsageIndicator = "Production" + UsageIndicatorTest UsageIndicator = "Test" +) + +func PossibleValuesForUsageIndicator() []string { + return []string{ + string(UsageIndicatorInformation), + string(UsageIndicatorNotSpecified), + string(UsageIndicatorProduction), + string(UsageIndicatorTest), + } +} + +func parseUsageIndicator(input string) (*UsageIndicator, error) { + vals := map[string]UsageIndicator{ + "information": UsageIndicatorInformation, + "notspecified": UsageIndicatorNotSpecified, + "production": UsageIndicatorProduction, + "test": UsageIndicatorTest, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UsageIndicator(input) + return &out, nil +} + +type X12CharacterSet string + +const ( + X12CharacterSetBasic X12CharacterSet = "Basic" + X12CharacterSetExtended X12CharacterSet = "Extended" + X12CharacterSetNotSpecified X12CharacterSet = "NotSpecified" + X12CharacterSetUTFEight X12CharacterSet = "UTF8" +) + +func PossibleValuesForX12CharacterSet() []string { + return []string{ + string(X12CharacterSetBasic), + string(X12CharacterSetExtended), + string(X12CharacterSetNotSpecified), + string(X12CharacterSetUTFEight), + } +} + +func parseX12CharacterSet(input string) (*X12CharacterSet, error) { + vals := map[string]X12CharacterSet{ + "basic": X12CharacterSetBasic, + "extended": X12CharacterSetExtended, + "notspecified": X12CharacterSetNotSpecified, + "utf8": X12CharacterSetUTFEight, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := X12CharacterSet(input) + return &out, nil +} + +type X12DateFormat string + +const ( + X12DateFormatCCYYMMDD X12DateFormat = "CCYYMMDD" + X12DateFormatNotSpecified X12DateFormat = "NotSpecified" + X12DateFormatYYMMDD X12DateFormat = "YYMMDD" +) + +func PossibleValuesForX12DateFormat() []string { + return []string{ + string(X12DateFormatCCYYMMDD), + string(X12DateFormatNotSpecified), + string(X12DateFormatYYMMDD), + } +} + +func parseX12DateFormat(input string) (*X12DateFormat, error) { + vals := map[string]X12DateFormat{ + "ccyymmdd": X12DateFormatCCYYMMDD, + "notspecified": X12DateFormatNotSpecified, + "yymmdd": X12DateFormatYYMMDD, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := X12DateFormat(input) + return &out, nil +} + +type X12TimeFormat string + +const ( + X12TimeFormatHHMM X12TimeFormat = "HHMM" + X12TimeFormatHHMMSS X12TimeFormat = "HHMMSS" + X12TimeFormatHHMMSSd X12TimeFormat = "HHMMSSd" + X12TimeFormatHHMMSSdd X12TimeFormat = "HHMMSSdd" + X12TimeFormatNotSpecified X12TimeFormat = "NotSpecified" +) + +func PossibleValuesForX12TimeFormat() []string { + return []string{ + string(X12TimeFormatHHMM), + string(X12TimeFormatHHMMSS), + string(X12TimeFormatHHMMSSd), + string(X12TimeFormatHHMMSSdd), + string(X12TimeFormatNotSpecified), + } +} + +func parseX12TimeFormat(input string) (*X12TimeFormat, error) { + vals := map[string]X12TimeFormat{ + "hhmm": X12TimeFormatHHMM, + "hhmmss": X12TimeFormatHHMMSS, + "hhmmssd": X12TimeFormatHHMMSSd, + "hhmmssdd": X12TimeFormatHHMMSSdd, + "notspecified": X12TimeFormatNotSpecified, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := X12TimeFormat(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/id_agreement.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/id_agreement.go new file mode 100644 index 000000000000..faeaf6c905de --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/id_agreement.go @@ -0,0 +1,137 @@ +package integrationaccountagreements + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AgreementId{} + +// AgreementId is a struct representing the Resource ID for a Agreement +type AgreementId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string + AgreementName string +} + +// NewAgreementID returns a new AgreementId struct +func NewAgreementID(subscriptionId string, resourceGroupName string, integrationAccountName string, agreementName string) AgreementId { + return AgreementId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + AgreementName: agreementName, + } +} + +// ParseAgreementID parses 'input' into a AgreementId +func ParseAgreementID(input string) (*AgreementId, error) { + parser := resourceids.NewParserFromResourceIdType(AgreementId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AgreementId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.AgreementName, ok = parsed.Parsed["agreementName"]; !ok { + return nil, fmt.Errorf("the segment 'agreementName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAgreementIDInsensitively parses 'input' case-insensitively into a AgreementId +// note: this method should only be used for API response data and not user input +func ParseAgreementIDInsensitively(input string) (*AgreementId, error) { + parser := resourceids.NewParserFromResourceIdType(AgreementId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AgreementId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.AgreementName, ok = parsed.Parsed["agreementName"]; !ok { + return nil, fmt.Errorf("the segment 'agreementName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAgreementID checks that 'input' can be parsed as a Agreement ID +func ValidateAgreementID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAgreementID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Agreement ID +func (id AgreementId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/agreements/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName, id.AgreementName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Agreement ID +func (id AgreementId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + resourceids.StaticSegment("staticAgreements", "agreements", "agreements"), + resourceids.UserSpecifiedSegment("agreementName", "agreementValue"), + } +} + +// String returns a human-readable description of this Agreement ID +func (id AgreementId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + fmt.Sprintf("Agreement Name: %q", id.AgreementName), + } + return fmt.Sprintf("Agreement (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/id_integrationaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/id_integrationaccount.go new file mode 100644 index 000000000000..0bc84a2f2482 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/id_integrationaccount.go @@ -0,0 +1,124 @@ +package integrationaccountagreements + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = IntegrationAccountId{} + +// IntegrationAccountId is a struct representing the Resource ID for a Integration Account +type IntegrationAccountId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string +} + +// NewIntegrationAccountID returns a new IntegrationAccountId struct +func NewIntegrationAccountID(subscriptionId string, resourceGroupName string, integrationAccountName string) IntegrationAccountId { + return IntegrationAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + } +} + +// ParseIntegrationAccountID parses 'input' into a IntegrationAccountId +func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseIntegrationAccountIDInsensitively parses 'input' case-insensitively into a IntegrationAccountId +// note: this method should only be used for API response data and not user input +func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID +func ValidateIntegrationAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseIntegrationAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Integration Account ID +func (id IntegrationAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Integration Account ID +func (id IntegrationAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + } +} + +// String returns a human-readable description of this Integration Account ID +func (id IntegrationAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + } + return fmt.Sprintf("Integration Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/method_createorupdate_autorest.go new file mode 100644 index 000000000000..47e17dc00432 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package integrationaccountagreements + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccountAgreement +} + +// CreateOrUpdate ... +func (c IntegrationAccountAgreementsClient) CreateOrUpdate(ctx context.Context, id AgreementId, input IntegrationAccountAgreement) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c IntegrationAccountAgreementsClient) preparerForCreateOrUpdate(ctx context.Context, id AgreementId, input IntegrationAccountAgreement) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c IntegrationAccountAgreementsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/method_delete_autorest.go new file mode 100644 index 000000000000..2c01cbae90e8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/method_delete_autorest.go @@ -0,0 +1,66 @@ +package integrationaccountagreements + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c IntegrationAccountAgreementsClient) Delete(ctx context.Context, id AgreementId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c IntegrationAccountAgreementsClient) preparerForDelete(ctx context.Context, id AgreementId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c IntegrationAccountAgreementsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/method_get_autorest.go new file mode 100644 index 000000000000..c70198069f5d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/method_get_autorest.go @@ -0,0 +1,68 @@ +package integrationaccountagreements + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccountAgreement +} + +// Get ... +func (c IntegrationAccountAgreementsClient) Get(ctx context.Context, id AgreementId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c IntegrationAccountAgreementsClient) preparerForGet(ctx context.Context, id AgreementId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c IntegrationAccountAgreementsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/method_list_autorest.go new file mode 100644 index 000000000000..78077364130a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/method_list_autorest.go @@ -0,0 +1,220 @@ +package integrationaccountagreements + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]IntegrationAccountAgreement + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []IntegrationAccountAgreement +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Filter *string + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c IntegrationAccountAgreementsClient) List(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c IntegrationAccountAgreementsClient) preparerForList(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/agreements", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c IntegrationAccountAgreementsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c IntegrationAccountAgreementsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []IntegrationAccountAgreement `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c IntegrationAccountAgreementsClient) ListComplete(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, IntegrationAccountAgreementOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c IntegrationAccountAgreementsClient) ListCompleteMatchingPredicate(ctx context.Context, id IntegrationAccountId, options ListOperationOptions, predicate IntegrationAccountAgreementOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]IntegrationAccountAgreement, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/method_listcontentcallbackurl_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/method_listcontentcallbackurl_autorest.go new file mode 100644 index 000000000000..251f92b63a14 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/method_listcontentcallbackurl_autorest.go @@ -0,0 +1,70 @@ +package integrationaccountagreements + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListContentCallbackUrlOperationResponse struct { + HttpResponse *http.Response + Model *WorkflowTriggerCallbackUrl +} + +// ListContentCallbackUrl ... +func (c IntegrationAccountAgreementsClient) ListContentCallbackUrl(ctx context.Context, id AgreementId, input GetCallbackUrlParameters) (result ListContentCallbackUrlOperationResponse, err error) { + req, err := c.preparerForListContentCallbackUrl(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "ListContentCallbackUrl", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "ListContentCallbackUrl", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListContentCallbackUrl(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountagreements.IntegrationAccountAgreementsClient", "ListContentCallbackUrl", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListContentCallbackUrl prepares the ListContentCallbackUrl request. +func (c IntegrationAccountAgreementsClient) preparerForListContentCallbackUrl(ctx context.Context, id AgreementId, input GetCallbackUrlParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listContentCallbackUrl", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListContentCallbackUrl handles the response to the ListContentCallbackUrl request. The method always +// closes the http.Response Body. +func (c IntegrationAccountAgreementsClient) responderForListContentCallbackUrl(resp *http.Response) (result ListContentCallbackUrlOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_agreementcontent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_agreementcontent.go new file mode 100644 index 000000000000..a08e8f51f67a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_agreementcontent.go @@ -0,0 +1,10 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AgreementContent struct { + AS2 *AS2AgreementContent `json:"aS2,omitempty"` + Edifact *EdifactAgreementContent `json:"edifact,omitempty"` + X12 *X12AgreementContent `json:"x12,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2acknowledgementconnectionsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2acknowledgementconnectionsettings.go new file mode 100644 index 000000000000..a4dcda57240c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2acknowledgementconnectionsettings.go @@ -0,0 +1,11 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AS2AcknowledgementConnectionSettings struct { + IgnoreCertificateNameMismatch bool `json:"ignoreCertificateNameMismatch"` + KeepHTTPConnectionAlive bool `json:"keepHttpConnectionAlive"` + SupportHTTPStatusCodeContinue bool `json:"supportHttpStatusCodeContinue"` + UnfoldHTTPHeaders bool `json:"unfoldHttpHeaders"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2agreementcontent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2agreementcontent.go new file mode 100644 index 000000000000..49d8094d5c65 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2agreementcontent.go @@ -0,0 +1,9 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AS2AgreementContent struct { + ReceiveAgreement AS2OneWayAgreement `json:"receiveAgreement"` + SendAgreement AS2OneWayAgreement `json:"sendAgreement"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2envelopesettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2envelopesettings.go new file mode 100644 index 000000000000..0c9a5594ebc0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2envelopesettings.go @@ -0,0 +1,12 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AS2EnvelopeSettings struct { + AutogenerateFileName bool `json:"autogenerateFileName"` + FileNameTemplate string `json:"fileNameTemplate"` + MessageContentType string `json:"messageContentType"` + SuspendMessageOnFileNameGenerationError bool `json:"suspendMessageOnFileNameGenerationError"` + TransmitFileNameInMimeHeader bool `json:"transmitFileNameInMimeHeader"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2errorsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2errorsettings.go new file mode 100644 index 000000000000..f0d0cb1cf5b8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2errorsettings.go @@ -0,0 +1,9 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AS2ErrorSettings struct { + ResendIfMDNNotReceived bool `json:"resendIfMDNNotReceived"` + SuspendDuplicateMessage bool `json:"suspendDuplicateMessage"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2mdnsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2mdnsettings.go new file mode 100644 index 000000000000..0ac7377dac05 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2mdnsettings.go @@ -0,0 +1,16 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AS2MdnSettings struct { + DispositionNotificationTo *string `json:"dispositionNotificationTo,omitempty"` + MdnText *string `json:"mdnText,omitempty"` + MicHashingAlgorithm HashingAlgorithm `json:"micHashingAlgorithm"` + NeedMDN bool `json:"needMDN"` + ReceiptDeliveryUrl *string `json:"receiptDeliveryUrl,omitempty"` + SendInboundMDNToMessageBox bool `json:"sendInboundMDNToMessageBox"` + SendMDNAsynchronously bool `json:"sendMDNAsynchronously"` + SignMDN bool `json:"signMDN"` + SignOutboundMDNIfOptional bool `json:"signOutboundMDNIfOptional"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2messageconnectionsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2messageconnectionsettings.go new file mode 100644 index 000000000000..844677e169c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2messageconnectionsettings.go @@ -0,0 +1,11 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AS2MessageConnectionSettings struct { + IgnoreCertificateNameMismatch bool `json:"ignoreCertificateNameMismatch"` + KeepHTTPConnectionAlive bool `json:"keepHttpConnectionAlive"` + SupportHTTPStatusCodeContinue bool `json:"supportHttpStatusCodeContinue"` + UnfoldHTTPHeaders bool `json:"unfoldHttpHeaders"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2onewayagreement.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2onewayagreement.go new file mode 100644 index 000000000000..1c1852d06725 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2onewayagreement.go @@ -0,0 +1,10 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AS2OneWayAgreement struct { + ProtocolSettings AS2ProtocolSettings `json:"protocolSettings"` + ReceiverBusinessIdentity BusinessIdentity `json:"receiverBusinessIdentity"` + SenderBusinessIdentity BusinessIdentity `json:"senderBusinessIdentity"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2protocolsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2protocolsettings.go new file mode 100644 index 000000000000..e5d78407290b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2protocolsettings.go @@ -0,0 +1,14 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AS2ProtocolSettings struct { + AcknowledgementConnectionSettings AS2AcknowledgementConnectionSettings `json:"acknowledgementConnectionSettings"` + EnvelopeSettings AS2EnvelopeSettings `json:"envelopeSettings"` + ErrorSettings AS2ErrorSettings `json:"errorSettings"` + MdnSettings AS2MdnSettings `json:"mdnSettings"` + MessageConnectionSettings AS2MessageConnectionSettings `json:"messageConnectionSettings"` + SecuritySettings AS2SecuritySettings `json:"securitySettings"` + ValidationSettings AS2ValidationSettings `json:"validationSettings"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2securitysettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2securitysettings.go new file mode 100644 index 000000000000..82c959e3a2b6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2securitysettings.go @@ -0,0 +1,17 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AS2SecuritySettings struct { + EnableNRRForInboundDecodedMessages bool `json:"enableNRRForInboundDecodedMessages"` + EnableNRRForInboundEncodedMessages bool `json:"enableNRRForInboundEncodedMessages"` + EnableNRRForInboundMDN bool `json:"enableNRRForInboundMDN"` + EnableNRRForOutboundDecodedMessages bool `json:"enableNRRForOutboundDecodedMessages"` + EnableNRRForOutboundEncodedMessages bool `json:"enableNRRForOutboundEncodedMessages"` + EnableNRRForOutboundMDN bool `json:"enableNRRForOutboundMDN"` + EncryptionCertificateName *string `json:"encryptionCertificateName,omitempty"` + OverrideGroupSigningCertificate bool `json:"overrideGroupSigningCertificate"` + Sha2AlgorithmFormat *string `json:"sha2AlgorithmFormat,omitempty"` + SigningCertificateName *string `json:"signingCertificateName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2validationsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2validationsettings.go new file mode 100644 index 000000000000..7c7a3fdca921 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_as2validationsettings.go @@ -0,0 +1,17 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AS2ValidationSettings struct { + CheckCertificateRevocationListOnReceive bool `json:"checkCertificateRevocationListOnReceive"` + CheckCertificateRevocationListOnSend bool `json:"checkCertificateRevocationListOnSend"` + CheckDuplicateMessage bool `json:"checkDuplicateMessage"` + CompressMessage bool `json:"compressMessage"` + EncryptMessage bool `json:"encryptMessage"` + EncryptionAlgorithm EncryptionAlgorithm `json:"encryptionAlgorithm"` + InterchangeDuplicatesValidityDays int64 `json:"interchangeDuplicatesValidityDays"` + OverrideMessageProperties bool `json:"overrideMessageProperties"` + SignMessage bool `json:"signMessage"` + SigningAlgorithm *SigningAlgorithm `json:"signingAlgorithm,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_businessidentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_businessidentity.go new file mode 100644 index 000000000000..db1f838d5e7f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_businessidentity.go @@ -0,0 +1,9 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BusinessIdentity struct { + Qualifier string `json:"qualifier"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactacknowledgementsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactacknowledgementsettings.go new file mode 100644 index 000000000000..d2b386ce2202 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactacknowledgementsettings.go @@ -0,0 +1,18 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdifactAcknowledgementSettings struct { + AcknowledgementControlNumberLowerBound int64 `json:"acknowledgementControlNumberLowerBound"` + AcknowledgementControlNumberPrefix *string `json:"acknowledgementControlNumberPrefix,omitempty"` + AcknowledgementControlNumberSuffix *string `json:"acknowledgementControlNumberSuffix,omitempty"` + AcknowledgementControlNumberUpperBound int64 `json:"acknowledgementControlNumberUpperBound"` + BatchFunctionalAcknowledgements bool `json:"batchFunctionalAcknowledgements"` + BatchTechnicalAcknowledgements bool `json:"batchTechnicalAcknowledgements"` + NeedFunctionalAcknowledgement bool `json:"needFunctionalAcknowledgement"` + NeedLoopForValidMessages bool `json:"needLoopForValidMessages"` + NeedTechnicalAcknowledgement bool `json:"needTechnicalAcknowledgement"` + RolloverAcknowledgementControlNumber bool `json:"rolloverAcknowledgementControlNumber"` + SendSynchronousAcknowledgement bool `json:"sendSynchronousAcknowledgement"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactagreementcontent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactagreementcontent.go new file mode 100644 index 000000000000..727856b2e5dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactagreementcontent.go @@ -0,0 +1,9 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdifactAgreementContent struct { + ReceiveAgreement EdifactOneWayAgreement `json:"receiveAgreement"` + SendAgreement EdifactOneWayAgreement `json:"sendAgreement"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactdelimiteroverride.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactdelimiteroverride.go new file mode 100644 index 000000000000..d03c1859f2a3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactdelimiteroverride.go @@ -0,0 +1,19 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdifactDelimiterOverride struct { + ComponentSeparator int64 `json:"componentSeparator"` + DataElementSeparator int64 `json:"dataElementSeparator"` + DecimalPointIndicator EdifactDecimalIndicator `json:"decimalPointIndicator"` + MessageAssociationAssignedCode *string `json:"messageAssociationAssignedCode,omitempty"` + MessageId *string `json:"messageId,omitempty"` + MessageRelease *string `json:"messageRelease,omitempty"` + MessageVersion *string `json:"messageVersion,omitempty"` + ReleaseIndicator int64 `json:"releaseIndicator"` + RepetitionSeparator int64 `json:"repetitionSeparator"` + SegmentTerminator int64 `json:"segmentTerminator"` + SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix"` + TargetNamespace *string `json:"targetNamespace,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactenvelopeoverride.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactenvelopeoverride.go new file mode 100644 index 000000000000..817edefd5207 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactenvelopeoverride.go @@ -0,0 +1,22 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdifactEnvelopeOverride struct { + ApplicationPassword *string `json:"applicationPassword,omitempty"` + AssociationAssignedCode *string `json:"associationAssignedCode,omitempty"` + ControllingAgencyCode *string `json:"controllingAgencyCode,omitempty"` + FunctionalGroupId *string `json:"functionalGroupId,omitempty"` + GroupHeaderMessageRelease *string `json:"groupHeaderMessageRelease,omitempty"` + GroupHeaderMessageVersion *string `json:"groupHeaderMessageVersion,omitempty"` + MessageAssociationAssignedCode *string `json:"messageAssociationAssignedCode,omitempty"` + MessageId *string `json:"messageId,omitempty"` + MessageRelease *string `json:"messageRelease,omitempty"` + MessageVersion *string `json:"messageVersion,omitempty"` + ReceiverApplicationId *string `json:"receiverApplicationId,omitempty"` + ReceiverApplicationQualifier *string `json:"receiverApplicationQualifier,omitempty"` + SenderApplicationId *string `json:"senderApplicationId,omitempty"` + SenderApplicationQualifier *string `json:"senderApplicationQualifier,omitempty"` + TargetNamespace *string `json:"targetNamespace,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactenvelopesettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactenvelopesettings.go new file mode 100644 index 000000000000..6850c4407d82 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactenvelopesettings.go @@ -0,0 +1,48 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdifactEnvelopeSettings struct { + ApplicationReferenceId *string `json:"applicationReferenceId,omitempty"` + ApplyDelimiterStringAdvice bool `json:"applyDelimiterStringAdvice"` + CommunicationAgreementId *string `json:"communicationAgreementId,omitempty"` + CreateGroupingSegments bool `json:"createGroupingSegments"` + EnableDefaultGroupHeaders bool `json:"enableDefaultGroupHeaders"` + FunctionalGroupId *string `json:"functionalGroupId,omitempty"` + GroupApplicationPassword *string `json:"groupApplicationPassword,omitempty"` + GroupApplicationReceiverId *string `json:"groupApplicationReceiverId,omitempty"` + GroupApplicationReceiverQualifier *string `json:"groupApplicationReceiverQualifier,omitempty"` + GroupApplicationSenderId *string `json:"groupApplicationSenderId,omitempty"` + GroupApplicationSenderQualifier *string `json:"groupApplicationSenderQualifier,omitempty"` + GroupAssociationAssignedCode *string `json:"groupAssociationAssignedCode,omitempty"` + GroupControlNumberLowerBound int64 `json:"groupControlNumberLowerBound"` + GroupControlNumberPrefix *string `json:"groupControlNumberPrefix,omitempty"` + GroupControlNumberSuffix *string `json:"groupControlNumberSuffix,omitempty"` + GroupControlNumberUpperBound int64 `json:"groupControlNumberUpperBound"` + GroupControllingAgencyCode *string `json:"groupControllingAgencyCode,omitempty"` + GroupMessageRelease *string `json:"groupMessageRelease,omitempty"` + GroupMessageVersion *string `json:"groupMessageVersion,omitempty"` + InterchangeControlNumberLowerBound int64 `json:"interchangeControlNumberLowerBound"` + InterchangeControlNumberPrefix *string `json:"interchangeControlNumberPrefix,omitempty"` + InterchangeControlNumberSuffix *string `json:"interchangeControlNumberSuffix,omitempty"` + InterchangeControlNumberUpperBound int64 `json:"interchangeControlNumberUpperBound"` + IsTestInterchange bool `json:"isTestInterchange"` + OverwriteExistingTransactionSetControlNumber bool `json:"overwriteExistingTransactionSetControlNumber"` + ProcessingPriorityCode *string `json:"processingPriorityCode,omitempty"` + ReceiverInternalIdentification *string `json:"receiverInternalIdentification,omitempty"` + ReceiverInternalSubIdentification *string `json:"receiverInternalSubIdentification,omitempty"` + ReceiverReverseRoutingAddress *string `json:"receiverReverseRoutingAddress,omitempty"` + RecipientReferencePasswordQualifier *string `json:"recipientReferencePasswordQualifier,omitempty"` + RecipientReferencePasswordValue *string `json:"recipientReferencePasswordValue,omitempty"` + RolloverGroupControlNumber bool `json:"rolloverGroupControlNumber"` + RolloverInterchangeControlNumber bool `json:"rolloverInterchangeControlNumber"` + RolloverTransactionSetControlNumber bool `json:"rolloverTransactionSetControlNumber"` + SenderInternalIdentification *string `json:"senderInternalIdentification,omitempty"` + SenderInternalSubIdentification *string `json:"senderInternalSubIdentification,omitempty"` + SenderReverseRoutingAddress *string `json:"senderReverseRoutingAddress,omitempty"` + TransactionSetControlNumberLowerBound int64 `json:"transactionSetControlNumberLowerBound"` + TransactionSetControlNumberPrefix *string `json:"transactionSetControlNumberPrefix,omitempty"` + TransactionSetControlNumberSuffix *string `json:"transactionSetControlNumberSuffix,omitempty"` + TransactionSetControlNumberUpperBound int64 `json:"transactionSetControlNumberUpperBound"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactframingsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactframingsettings.go new file mode 100644 index 000000000000..444cbe1e790c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactframingsettings.go @@ -0,0 +1,18 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdifactFramingSettings struct { + CharacterEncoding *string `json:"characterEncoding,omitempty"` + CharacterSet EdifactCharacterSet `json:"characterSet"` + ComponentSeparator int64 `json:"componentSeparator"` + DataElementSeparator int64 `json:"dataElementSeparator"` + DecimalPointIndicator EdifactDecimalIndicator `json:"decimalPointIndicator"` + ProtocolVersion int64 `json:"protocolVersion"` + ReleaseIndicator int64 `json:"releaseIndicator"` + RepetitionSeparator int64 `json:"repetitionSeparator"` + SegmentTerminator int64 `json:"segmentTerminator"` + SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix"` + ServiceCodeListDirectoryVersion *string `json:"serviceCodeListDirectoryVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactmessagefilter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactmessagefilter.go new file mode 100644 index 000000000000..b8cd0baadbc0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactmessagefilter.go @@ -0,0 +1,8 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdifactMessageFilter struct { + MessageFilterType MessageFilterType `json:"messageFilterType"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactmessageidentifier.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactmessageidentifier.go new file mode 100644 index 000000000000..b1937a3208fc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactmessageidentifier.go @@ -0,0 +1,8 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdifactMessageIdentifier struct { + MessageId string `json:"messageId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactonewayagreement.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactonewayagreement.go new file mode 100644 index 000000000000..2cb2d19536fc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactonewayagreement.go @@ -0,0 +1,10 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdifactOneWayAgreement struct { + ProtocolSettings EdifactProtocolSettings `json:"protocolSettings"` + ReceiverBusinessIdentity BusinessIdentity `json:"receiverBusinessIdentity"` + SenderBusinessIdentity BusinessIdentity `json:"senderBusinessIdentity"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactprocessingsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactprocessingsettings.go new file mode 100644 index 000000000000..1111c98a9232 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactprocessingsettings.go @@ -0,0 +1,12 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdifactProcessingSettings struct { + CreateEmptyXmlTagsForTrailingSeparators bool `json:"createEmptyXmlTagsForTrailingSeparators"` + MaskSecurityInfo bool `json:"maskSecurityInfo"` + PreserveInterchange bool `json:"preserveInterchange"` + SuspendInterchangeOnError bool `json:"suspendInterchangeOnError"` + UseDotAsDecimalSeparator bool `json:"useDotAsDecimalSeparator"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactprotocolsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactprotocolsettings.go new file mode 100644 index 000000000000..ef2851931bd8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactprotocolsettings.go @@ -0,0 +1,18 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdifactProtocolSettings struct { + AcknowledgementSettings EdifactAcknowledgementSettings `json:"acknowledgementSettings"` + EdifactDelimiterOverrides *[]EdifactDelimiterOverride `json:"edifactDelimiterOverrides,omitempty"` + EnvelopeOverrides *[]EdifactEnvelopeOverride `json:"envelopeOverrides,omitempty"` + EnvelopeSettings EdifactEnvelopeSettings `json:"envelopeSettings"` + FramingSettings EdifactFramingSettings `json:"framingSettings"` + MessageFilter EdifactMessageFilter `json:"messageFilter"` + MessageFilterList *[]EdifactMessageIdentifier `json:"messageFilterList,omitempty"` + ProcessingSettings EdifactProcessingSettings `json:"processingSettings"` + SchemaReferences []EdifactSchemaReference `json:"schemaReferences"` + ValidationOverrides *[]EdifactValidationOverride `json:"validationOverrides,omitempty"` + ValidationSettings EdifactValidationSettings `json:"validationSettings"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactschemareference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactschemareference.go new file mode 100644 index 000000000000..a5b5f00553e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactschemareference.go @@ -0,0 +1,14 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdifactSchemaReference struct { + AssociationAssignedCode *string `json:"associationAssignedCode,omitempty"` + MessageId string `json:"messageId"` + MessageRelease string `json:"messageRelease"` + MessageVersion string `json:"messageVersion"` + SchemaName string `json:"schemaName"` + SenderApplicationId *string `json:"senderApplicationId,omitempty"` + SenderApplicationQualifier *string `json:"senderApplicationQualifier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactvalidationoverride.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactvalidationoverride.go new file mode 100644 index 000000000000..10ccf3eb72da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactvalidationoverride.go @@ -0,0 +1,14 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdifactValidationOverride struct { + AllowLeadingAndTrailingSpacesAndZeroes bool `json:"allowLeadingAndTrailingSpacesAndZeroes"` + EnforceCharacterSet bool `json:"enforceCharacterSet"` + MessageId string `json:"messageId"` + TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy"` + TrimLeadingAndTrailingSpacesAndZeroes bool `json:"trimLeadingAndTrailingSpacesAndZeroes"` + ValidateEDITypes bool `json:"validateEDITypes"` + ValidateXSDTypes bool `json:"validateXSDTypes"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactvalidationsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactvalidationsettings.go new file mode 100644 index 000000000000..d2a4be5652eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_edifactvalidationsettings.go @@ -0,0 +1,17 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdifactValidationSettings struct { + AllowLeadingAndTrailingSpacesAndZeroes bool `json:"allowLeadingAndTrailingSpacesAndZeroes"` + CheckDuplicateGroupControlNumber bool `json:"checkDuplicateGroupControlNumber"` + CheckDuplicateInterchangeControlNumber bool `json:"checkDuplicateInterchangeControlNumber"` + CheckDuplicateTransactionSetControlNumber bool `json:"checkDuplicateTransactionSetControlNumber"` + InterchangeControlNumberValidityDays int64 `json:"interchangeControlNumberValidityDays"` + TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy"` + TrimLeadingAndTrailingSpacesAndZeroes bool `json:"trimLeadingAndTrailingSpacesAndZeroes"` + ValidateCharacterSet bool `json:"validateCharacterSet"` + ValidateEDITypes bool `json:"validateEDITypes"` + ValidateXSDTypes bool `json:"validateXSDTypes"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_getcallbackurlparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_getcallbackurlparameters.go new file mode 100644 index 000000000000..5b772da75a41 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_getcallbackurlparameters.go @@ -0,0 +1,27 @@ +package integrationaccountagreements + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetCallbackUrlParameters struct { + KeyType *KeyType `json:"keyType,omitempty"` + NotAfter *string `json:"notAfter,omitempty"` +} + +func (o *GetCallbackUrlParameters) GetNotAfterAsTime() (*time.Time, error) { + if o.NotAfter == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NotAfter, "2006-01-02T15:04:05Z07:00") +} + +func (o *GetCallbackUrlParameters) SetNotAfterAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NotAfter = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_integrationaccountagreement.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_integrationaccountagreement.go new file mode 100644 index 000000000000..4472b6f588db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_integrationaccountagreement.go @@ -0,0 +1,13 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountAgreement struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties IntegrationAccountAgreementProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_integrationaccountagreementproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_integrationaccountagreementproperties.go new file mode 100644 index 000000000000..57e820849c3c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_integrationaccountagreementproperties.go @@ -0,0 +1,46 @@ +package integrationaccountagreements + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountAgreementProperties struct { + AgreementType AgreementType `json:"agreementType"` + ChangedTime *string `json:"changedTime,omitempty"` + Content AgreementContent `json:"content"` + CreatedTime *string `json:"createdTime,omitempty"` + GuestIdentity BusinessIdentity `json:"guestIdentity"` + GuestPartner string `json:"guestPartner"` + HostIdentity BusinessIdentity `json:"hostIdentity"` + HostPartner string `json:"hostPartner"` + Metadata *interface{} `json:"metadata,omitempty"` +} + +func (o *IntegrationAccountAgreementProperties) GetChangedTimeAsTime() (*time.Time, error) { + if o.ChangedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ChangedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *IntegrationAccountAgreementProperties) SetChangedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ChangedTime = &formatted +} + +func (o *IntegrationAccountAgreementProperties) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *IntegrationAccountAgreementProperties) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_workflowtriggercallbackurl.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_workflowtriggercallbackurl.go new file mode 100644 index 000000000000..1897157aa739 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_workflowtriggercallbackurl.go @@ -0,0 +1,13 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerCallbackUrl struct { + BasePath *string `json:"basePath,omitempty"` + Method *string `json:"method,omitempty"` + Queries *WorkflowTriggerListCallbackUrlQueries `json:"queries,omitempty"` + RelativePath *string `json:"relativePath,omitempty"` + RelativePathParameters *[]string `json:"relativePathParameters,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_workflowtriggerlistcallbackurlqueries.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_workflowtriggerlistcallbackurlqueries.go new file mode 100644 index 000000000000..04992a50c853 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_workflowtriggerlistcallbackurlqueries.go @@ -0,0 +1,12 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerListCallbackUrlQueries struct { + ApiVersion *string `json:"api-version,omitempty"` + Se *string `json:"se,omitempty"` + Sig *string `json:"sig,omitempty"` + Sp *string `json:"sp,omitempty"` + Sv *string `json:"sv,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12acknowledgementsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12acknowledgementsettings.go new file mode 100644 index 000000000000..5d0dd631ddaa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12acknowledgementsettings.go @@ -0,0 +1,22 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X12AcknowledgementSettings struct { + AcknowledgementControlNumberLowerBound int64 `json:"acknowledgementControlNumberLowerBound"` + AcknowledgementControlNumberPrefix *string `json:"acknowledgementControlNumberPrefix,omitempty"` + AcknowledgementControlNumberSuffix *string `json:"acknowledgementControlNumberSuffix,omitempty"` + AcknowledgementControlNumberUpperBound int64 `json:"acknowledgementControlNumberUpperBound"` + BatchFunctionalAcknowledgements bool `json:"batchFunctionalAcknowledgements"` + BatchImplementationAcknowledgements bool `json:"batchImplementationAcknowledgements"` + BatchTechnicalAcknowledgements bool `json:"batchTechnicalAcknowledgements"` + FunctionalAcknowledgementVersion *string `json:"functionalAcknowledgementVersion,omitempty"` + ImplementationAcknowledgementVersion *string `json:"implementationAcknowledgementVersion,omitempty"` + NeedFunctionalAcknowledgement bool `json:"needFunctionalAcknowledgement"` + NeedImplementationAcknowledgement bool `json:"needImplementationAcknowledgement"` + NeedLoopForValidMessages bool `json:"needLoopForValidMessages"` + NeedTechnicalAcknowledgement bool `json:"needTechnicalAcknowledgement"` + RolloverAcknowledgementControlNumber bool `json:"rolloverAcknowledgementControlNumber"` + SendSynchronousAcknowledgement bool `json:"sendSynchronousAcknowledgement"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12agreementcontent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12agreementcontent.go new file mode 100644 index 000000000000..7afb76021c46 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12agreementcontent.go @@ -0,0 +1,9 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X12AgreementContent struct { + ReceiveAgreement X12OneWayAgreement `json:"receiveAgreement"` + SendAgreement X12OneWayAgreement `json:"sendAgreement"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12delimiteroverrides.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12delimiteroverrides.go new file mode 100644 index 000000000000..17b6eeddf957 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12delimiteroverrides.go @@ -0,0 +1,16 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X12DelimiterOverrides struct { + ComponentSeparator int64 `json:"componentSeparator"` + DataElementSeparator int64 `json:"dataElementSeparator"` + MessageId *string `json:"messageId,omitempty"` + ProtocolVersion *string `json:"protocolVersion,omitempty"` + ReplaceCharacter int64 `json:"replaceCharacter"` + ReplaceSeparatorsInPayload bool `json:"replaceSeparatorsInPayload"` + SegmentTerminator int64 `json:"segmentTerminator"` + SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix"` + TargetNamespace *string `json:"targetNamespace,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12envelopeoverride.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12envelopeoverride.go new file mode 100644 index 000000000000..b41093706b6c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12envelopeoverride.go @@ -0,0 +1,17 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X12EnvelopeOverride struct { + DateFormat X12DateFormat `json:"dateFormat"` + FunctionalIdentifierCode *string `json:"functionalIdentifierCode,omitempty"` + HeaderVersion string `json:"headerVersion"` + MessageId string `json:"messageId"` + ProtocolVersion string `json:"protocolVersion"` + ReceiverApplicationId string `json:"receiverApplicationId"` + ResponsibleAgencyCode string `json:"responsibleAgencyCode"` + SenderApplicationId string `json:"senderApplicationId"` + TargetNamespace string `json:"targetNamespace"` + TimeFormat X12TimeFormat `json:"timeFormat"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12envelopesettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12envelopesettings.go new file mode 100644 index 000000000000..93c54717857f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12envelopesettings.go @@ -0,0 +1,31 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X12EnvelopeSettings struct { + ControlStandardsId int64 `json:"controlStandardsId"` + ControlVersionNumber string `json:"controlVersionNumber"` + EnableDefaultGroupHeaders bool `json:"enableDefaultGroupHeaders"` + FunctionalGroupId *string `json:"functionalGroupId,omitempty"` + GroupControlNumberLowerBound int64 `json:"groupControlNumberLowerBound"` + GroupControlNumberUpperBound int64 `json:"groupControlNumberUpperBound"` + GroupHeaderAgencyCode string `json:"groupHeaderAgencyCode"` + GroupHeaderDateFormat X12DateFormat `json:"groupHeaderDateFormat"` + GroupHeaderTimeFormat X12TimeFormat `json:"groupHeaderTimeFormat"` + GroupHeaderVersion string `json:"groupHeaderVersion"` + InterchangeControlNumberLowerBound int64 `json:"interchangeControlNumberLowerBound"` + InterchangeControlNumberUpperBound int64 `json:"interchangeControlNumberUpperBound"` + OverwriteExistingTransactionSetControlNumber bool `json:"overwriteExistingTransactionSetControlNumber"` + ReceiverApplicationId string `json:"receiverApplicationId"` + RolloverGroupControlNumber bool `json:"rolloverGroupControlNumber"` + RolloverInterchangeControlNumber bool `json:"rolloverInterchangeControlNumber"` + RolloverTransactionSetControlNumber bool `json:"rolloverTransactionSetControlNumber"` + SenderApplicationId string `json:"senderApplicationId"` + TransactionSetControlNumberLowerBound int64 `json:"transactionSetControlNumberLowerBound"` + TransactionSetControlNumberPrefix *string `json:"transactionSetControlNumberPrefix,omitempty"` + TransactionSetControlNumberSuffix *string `json:"transactionSetControlNumberSuffix,omitempty"` + TransactionSetControlNumberUpperBound int64 `json:"transactionSetControlNumberUpperBound"` + UsageIndicator UsageIndicator `json:"usageIndicator"` + UseControlStandardsIdAsRepetitionCharacter bool `json:"useControlStandardsIdAsRepetitionCharacter"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12framingsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12framingsettings.go new file mode 100644 index 000000000000..28e0c4c23423 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12framingsettings.go @@ -0,0 +1,14 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X12FramingSettings struct { + CharacterSet X12CharacterSet `json:"characterSet"` + ComponentSeparator int64 `json:"componentSeparator"` + DataElementSeparator int64 `json:"dataElementSeparator"` + ReplaceCharacter int64 `json:"replaceCharacter"` + ReplaceSeparatorsInPayload bool `json:"replaceSeparatorsInPayload"` + SegmentTerminator int64 `json:"segmentTerminator"` + SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12messagefilter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12messagefilter.go new file mode 100644 index 000000000000..1bf03a3e4f71 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12messagefilter.go @@ -0,0 +1,8 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X12MessageFilter struct { + MessageFilterType MessageFilterType `json:"messageFilterType"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12messageidentifier.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12messageidentifier.go new file mode 100644 index 000000000000..7e5995709e9e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12messageidentifier.go @@ -0,0 +1,8 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X12MessageIdentifier struct { + MessageId string `json:"messageId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12onewayagreement.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12onewayagreement.go new file mode 100644 index 000000000000..8db59c6e0893 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12onewayagreement.go @@ -0,0 +1,10 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X12OneWayAgreement struct { + ProtocolSettings X12ProtocolSettings `json:"protocolSettings"` + ReceiverBusinessIdentity BusinessIdentity `json:"receiverBusinessIdentity"` + SenderBusinessIdentity BusinessIdentity `json:"senderBusinessIdentity"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12processingsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12processingsettings.go new file mode 100644 index 000000000000..9ff46d7a3b22 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12processingsettings.go @@ -0,0 +1,13 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X12ProcessingSettings struct { + ConvertImpliedDecimal bool `json:"convertImpliedDecimal"` + CreateEmptyXmlTagsForTrailingSeparators bool `json:"createEmptyXmlTagsForTrailingSeparators"` + MaskSecurityInfo bool `json:"maskSecurityInfo"` + PreserveInterchange bool `json:"preserveInterchange"` + SuspendInterchangeOnError bool `json:"suspendInterchangeOnError"` + UseDotAsDecimalSeparator bool `json:"useDotAsDecimalSeparator"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12protocolsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12protocolsettings.go new file mode 100644 index 000000000000..003f675198bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12protocolsettings.go @@ -0,0 +1,19 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X12ProtocolSettings struct { + AcknowledgementSettings X12AcknowledgementSettings `json:"acknowledgementSettings"` + EnvelopeOverrides *[]X12EnvelopeOverride `json:"envelopeOverrides,omitempty"` + EnvelopeSettings X12EnvelopeSettings `json:"envelopeSettings"` + FramingSettings X12FramingSettings `json:"framingSettings"` + MessageFilter X12MessageFilter `json:"messageFilter"` + MessageFilterList *[]X12MessageIdentifier `json:"messageFilterList,omitempty"` + ProcessingSettings X12ProcessingSettings `json:"processingSettings"` + SchemaReferences []X12SchemaReference `json:"schemaReferences"` + SecuritySettings X12SecuritySettings `json:"securitySettings"` + ValidationOverrides *[]X12ValidationOverride `json:"validationOverrides,omitempty"` + ValidationSettings X12ValidationSettings `json:"validationSettings"` + X12DelimiterOverrides *[]X12DelimiterOverrides `json:"x12DelimiterOverrides,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12schemareference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12schemareference.go new file mode 100644 index 000000000000..fae7346dcc8c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12schemareference.go @@ -0,0 +1,11 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X12SchemaReference struct { + MessageId string `json:"messageId"` + SchemaName string `json:"schemaName"` + SchemaVersion string `json:"schemaVersion"` + SenderApplicationId *string `json:"senderApplicationId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12securitysettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12securitysettings.go new file mode 100644 index 000000000000..09bbdf906bef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12securitysettings.go @@ -0,0 +1,11 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X12SecuritySettings struct { + AuthorizationQualifier string `json:"authorizationQualifier"` + AuthorizationValue *string `json:"authorizationValue,omitempty"` + PasswordValue *string `json:"passwordValue,omitempty"` + SecurityQualifier string `json:"securityQualifier"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12validationoverride.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12validationoverride.go new file mode 100644 index 000000000000..cc98632a0bff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12validationoverride.go @@ -0,0 +1,14 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X12ValidationOverride struct { + AllowLeadingAndTrailingSpacesAndZeroes bool `json:"allowLeadingAndTrailingSpacesAndZeroes"` + MessageId string `json:"messageId"` + TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy"` + TrimLeadingAndTrailingSpacesAndZeroes bool `json:"trimLeadingAndTrailingSpacesAndZeroes"` + ValidateCharacterSet bool `json:"validateCharacterSet"` + ValidateEDITypes bool `json:"validateEDITypes"` + ValidateXSDTypes bool `json:"validateXSDTypes"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12validationsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12validationsettings.go new file mode 100644 index 000000000000..cc7a7aa493e2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/model_x12validationsettings.go @@ -0,0 +1,17 @@ +package integrationaccountagreements + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type X12ValidationSettings struct { + AllowLeadingAndTrailingSpacesAndZeroes bool `json:"allowLeadingAndTrailingSpacesAndZeroes"` + CheckDuplicateGroupControlNumber bool `json:"checkDuplicateGroupControlNumber"` + CheckDuplicateInterchangeControlNumber bool `json:"checkDuplicateInterchangeControlNumber"` + CheckDuplicateTransactionSetControlNumber bool `json:"checkDuplicateTransactionSetControlNumber"` + InterchangeControlNumberValidityDays int64 `json:"interchangeControlNumberValidityDays"` + TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy"` + TrimLeadingAndTrailingSpacesAndZeroes bool `json:"trimLeadingAndTrailingSpacesAndZeroes"` + ValidateCharacterSet bool `json:"validateCharacterSet"` + ValidateEDITypes bool `json:"validateEDITypes"` + ValidateXSDTypes bool `json:"validateXSDTypes"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/predicates.go new file mode 100644 index 000000000000..b87b9518b4b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/predicates.go @@ -0,0 +1,29 @@ +package integrationaccountagreements + +type IntegrationAccountAgreementOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p IntegrationAccountAgreementOperationPredicate) Matches(input IntegrationAccountAgreement) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/version.go new file mode 100644 index 000000000000..633c4c0db031 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements/version.go @@ -0,0 +1,12 @@ +package integrationaccountagreements + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/integrationaccountagreements/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/README.md new file mode 100644 index 000000000000..137bb343ce3d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/README.md @@ -0,0 +1,105 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies` Documentation + +The `integrationaccountassemblies` SDK allows for interaction with the Azure Resource Manager Service `logic` (API Version `2019-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies" +``` + + +### Client Initialization + +```go +client := integrationaccountassemblies.NewIntegrationAccountAssembliesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `IntegrationAccountAssembliesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := integrationaccountassemblies.NewAssemblyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "assemblyValue") + +payload := integrationaccountassemblies.AssemblyDefinition{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountAssembliesClient.Delete` + +```go +ctx := context.TODO() +id := integrationaccountassemblies.NewAssemblyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "assemblyValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountAssembliesClient.Get` + +```go +ctx := context.TODO() +id := integrationaccountassemblies.NewAssemblyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "assemblyValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountAssembliesClient.List` + +```go +ctx := context.TODO() +id := integrationaccountassemblies.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountAssembliesClient.ListContentCallbackUrl` + +```go +ctx := context.TODO() +id := integrationaccountassemblies.NewAssemblyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "assemblyValue") + +read, err := client.ListContentCallbackUrl(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/client.go new file mode 100644 index 000000000000..7eeaa03c50ff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/client.go @@ -0,0 +1,18 @@ +package integrationaccountassemblies + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountAssembliesClient struct { + Client autorest.Client + baseUri string +} + +func NewIntegrationAccountAssembliesClientWithBaseURI(endpoint string) IntegrationAccountAssembliesClient { + return IntegrationAccountAssembliesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/id_assembly.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/id_assembly.go new file mode 100644 index 000000000000..28c5e4d07afa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/id_assembly.go @@ -0,0 +1,137 @@ +package integrationaccountassemblies + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AssemblyId{} + +// AssemblyId is a struct representing the Resource ID for a Assembly +type AssemblyId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string + AssemblyName string +} + +// NewAssemblyID returns a new AssemblyId struct +func NewAssemblyID(subscriptionId string, resourceGroupName string, integrationAccountName string, assemblyName string) AssemblyId { + return AssemblyId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + AssemblyName: assemblyName, + } +} + +// ParseAssemblyID parses 'input' into a AssemblyId +func ParseAssemblyID(input string) (*AssemblyId, error) { + parser := resourceids.NewParserFromResourceIdType(AssemblyId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AssemblyId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.AssemblyName, ok = parsed.Parsed["assemblyName"]; !ok { + return nil, fmt.Errorf("the segment 'assemblyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAssemblyIDInsensitively parses 'input' case-insensitively into a AssemblyId +// note: this method should only be used for API response data and not user input +func ParseAssemblyIDInsensitively(input string) (*AssemblyId, error) { + parser := resourceids.NewParserFromResourceIdType(AssemblyId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AssemblyId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.AssemblyName, ok = parsed.Parsed["assemblyName"]; !ok { + return nil, fmt.Errorf("the segment 'assemblyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAssemblyID checks that 'input' can be parsed as a Assembly ID +func ValidateAssemblyID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAssemblyID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Assembly ID +func (id AssemblyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/assemblies/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName, id.AssemblyName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Assembly ID +func (id AssemblyId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + resourceids.StaticSegment("staticAssemblies", "assemblies", "assemblies"), + resourceids.UserSpecifiedSegment("assemblyName", "assemblyValue"), + } +} + +// String returns a human-readable description of this Assembly ID +func (id AssemblyId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + fmt.Sprintf("Assembly Name: %q", id.AssemblyName), + } + return fmt.Sprintf("Assembly (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/id_integrationaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/id_integrationaccount.go new file mode 100644 index 000000000000..32d7aa139acc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/id_integrationaccount.go @@ -0,0 +1,124 @@ +package integrationaccountassemblies + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = IntegrationAccountId{} + +// IntegrationAccountId is a struct representing the Resource ID for a Integration Account +type IntegrationAccountId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string +} + +// NewIntegrationAccountID returns a new IntegrationAccountId struct +func NewIntegrationAccountID(subscriptionId string, resourceGroupName string, integrationAccountName string) IntegrationAccountId { + return IntegrationAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + } +} + +// ParseIntegrationAccountID parses 'input' into a IntegrationAccountId +func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseIntegrationAccountIDInsensitively parses 'input' case-insensitively into a IntegrationAccountId +// note: this method should only be used for API response data and not user input +func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID +func ValidateIntegrationAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseIntegrationAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Integration Account ID +func (id IntegrationAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Integration Account ID +func (id IntegrationAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + } +} + +// String returns a human-readable description of this Integration Account ID +func (id IntegrationAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + } + return fmt.Sprintf("Integration Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/method_createorupdate_autorest.go new file mode 100644 index 000000000000..077233bcffe9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package integrationaccountassemblies + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *AssemblyDefinition +} + +// CreateOrUpdate ... +func (c IntegrationAccountAssembliesClient) CreateOrUpdate(ctx context.Context, id AssemblyId, input AssemblyDefinition) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountassemblies.IntegrationAccountAssembliesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountassemblies.IntegrationAccountAssembliesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountassemblies.IntegrationAccountAssembliesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c IntegrationAccountAssembliesClient) preparerForCreateOrUpdate(ctx context.Context, id AssemblyId, input AssemblyDefinition) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c IntegrationAccountAssembliesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/method_delete_autorest.go new file mode 100644 index 000000000000..acd75dd4b596 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/method_delete_autorest.go @@ -0,0 +1,66 @@ +package integrationaccountassemblies + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c IntegrationAccountAssembliesClient) Delete(ctx context.Context, id AssemblyId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountassemblies.IntegrationAccountAssembliesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountassemblies.IntegrationAccountAssembliesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountassemblies.IntegrationAccountAssembliesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c IntegrationAccountAssembliesClient) preparerForDelete(ctx context.Context, id AssemblyId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c IntegrationAccountAssembliesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/method_get_autorest.go new file mode 100644 index 000000000000..8e36965c953e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/method_get_autorest.go @@ -0,0 +1,68 @@ +package integrationaccountassemblies + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *AssemblyDefinition +} + +// Get ... +func (c IntegrationAccountAssembliesClient) Get(ctx context.Context, id AssemblyId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountassemblies.IntegrationAccountAssembliesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountassemblies.IntegrationAccountAssembliesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountassemblies.IntegrationAccountAssembliesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c IntegrationAccountAssembliesClient) preparerForGet(ctx context.Context, id AssemblyId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c IntegrationAccountAssembliesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/method_list_autorest.go new file mode 100644 index 000000000000..7aee8f95fd7c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/method_list_autorest.go @@ -0,0 +1,69 @@ +package integrationaccountassemblies + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *AssemblyCollection +} + +// List ... +func (c IntegrationAccountAssembliesClient) List(ctx context.Context, id IntegrationAccountId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountassemblies.IntegrationAccountAssembliesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountassemblies.IntegrationAccountAssembliesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountassemblies.IntegrationAccountAssembliesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c IntegrationAccountAssembliesClient) preparerForList(ctx context.Context, id IntegrationAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/assemblies", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c IntegrationAccountAssembliesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/method_listcontentcallbackurl_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/method_listcontentcallbackurl_autorest.go new file mode 100644 index 000000000000..8153bd0d352e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/method_listcontentcallbackurl_autorest.go @@ -0,0 +1,69 @@ +package integrationaccountassemblies + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListContentCallbackUrlOperationResponse struct { + HttpResponse *http.Response + Model *WorkflowTriggerCallbackUrl +} + +// ListContentCallbackUrl ... +func (c IntegrationAccountAssembliesClient) ListContentCallbackUrl(ctx context.Context, id AssemblyId) (result ListContentCallbackUrlOperationResponse, err error) { + req, err := c.preparerForListContentCallbackUrl(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountassemblies.IntegrationAccountAssembliesClient", "ListContentCallbackUrl", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountassemblies.IntegrationAccountAssembliesClient", "ListContentCallbackUrl", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListContentCallbackUrl(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountassemblies.IntegrationAccountAssembliesClient", "ListContentCallbackUrl", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListContentCallbackUrl prepares the ListContentCallbackUrl request. +func (c IntegrationAccountAssembliesClient) preparerForListContentCallbackUrl(ctx context.Context, id AssemblyId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listContentCallbackUrl", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListContentCallbackUrl handles the response to the ListContentCallbackUrl request. The method always +// closes the http.Response Body. +func (c IntegrationAccountAssembliesClient) responderForListContentCallbackUrl(resp *http.Response) (result ListContentCallbackUrlOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_assemblycollection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_assemblycollection.go new file mode 100644 index 000000000000..e94abbd2ff37 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_assemblycollection.go @@ -0,0 +1,8 @@ +package integrationaccountassemblies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssemblyCollection struct { + Value *[]AssemblyDefinition `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_assemblydefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_assemblydefinition.go new file mode 100644 index 000000000000..97bfea9de899 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_assemblydefinition.go @@ -0,0 +1,13 @@ +package integrationaccountassemblies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssemblyDefinition struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties AssemblyProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_assemblyproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_assemblyproperties.go new file mode 100644 index 000000000000..7064838c448f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_assemblyproperties.go @@ -0,0 +1,47 @@ +package integrationaccountassemblies + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssemblyProperties struct { + AssemblyCulture *string `json:"assemblyCulture,omitempty"` + AssemblyName string `json:"assemblyName"` + AssemblyPublicKeyToken *string `json:"assemblyPublicKeyToken,omitempty"` + AssemblyVersion *string `json:"assemblyVersion,omitempty"` + ChangedTime *string `json:"changedTime,omitempty"` + Content *interface{} `json:"content,omitempty"` + ContentLink *ContentLink `json:"contentLink,omitempty"` + ContentType *string `json:"contentType,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` + Metadata *interface{} `json:"metadata,omitempty"` +} + +func (o *AssemblyProperties) GetChangedTimeAsTime() (*time.Time, error) { + if o.ChangedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ChangedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *AssemblyProperties) SetChangedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ChangedTime = &formatted +} + +func (o *AssemblyProperties) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *AssemblyProperties) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_contenthash.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_contenthash.go new file mode 100644 index 000000000000..f5598bcd1519 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_contenthash.go @@ -0,0 +1,9 @@ +package integrationaccountassemblies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentHash struct { + Algorithm *string `json:"algorithm,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_contentlink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_contentlink.go new file mode 100644 index 000000000000..516c7200620b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_contentlink.go @@ -0,0 +1,12 @@ +package integrationaccountassemblies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentLink struct { + ContentHash *ContentHash `json:"contentHash,omitempty"` + ContentSize *int64 `json:"contentSize,omitempty"` + ContentVersion *string `json:"contentVersion,omitempty"` + Metadata *interface{} `json:"metadata,omitempty"` + Uri *string `json:"uri,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_workflowtriggercallbackurl.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_workflowtriggercallbackurl.go new file mode 100644 index 000000000000..c1b7488ead9f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_workflowtriggercallbackurl.go @@ -0,0 +1,13 @@ +package integrationaccountassemblies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerCallbackUrl struct { + BasePath *string `json:"basePath,omitempty"` + Method *string `json:"method,omitempty"` + Queries *WorkflowTriggerListCallbackUrlQueries `json:"queries,omitempty"` + RelativePath *string `json:"relativePath,omitempty"` + RelativePathParameters *[]string `json:"relativePathParameters,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_workflowtriggerlistcallbackurlqueries.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_workflowtriggerlistcallbackurlqueries.go new file mode 100644 index 000000000000..38befad8a55b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/model_workflowtriggerlistcallbackurlqueries.go @@ -0,0 +1,12 @@ +package integrationaccountassemblies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerListCallbackUrlQueries struct { + ApiVersion *string `json:"api-version,omitempty"` + Se *string `json:"se,omitempty"` + Sig *string `json:"sig,omitempty"` + Sp *string `json:"sp,omitempty"` + Sv *string `json:"sv,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/version.go new file mode 100644 index 000000000000..690ff257ba03 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies/version.go @@ -0,0 +1,12 @@ +package integrationaccountassemblies + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/integrationaccountassemblies/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/README.md new file mode 100644 index 000000000000..737acb22d0e4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/README.md @@ -0,0 +1,89 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations` Documentation + +The `integrationaccountbatchconfigurations` SDK allows for interaction with the Azure Resource Manager Service `logic` (API Version `2019-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations" +``` + + +### Client Initialization + +```go +client := integrationaccountbatchconfigurations.NewIntegrationAccountBatchConfigurationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `IntegrationAccountBatchConfigurationsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := integrationaccountbatchconfigurations.NewBatchConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "batchConfigurationValue") + +payload := integrationaccountbatchconfigurations.BatchConfiguration{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountBatchConfigurationsClient.Delete` + +```go +ctx := context.TODO() +id := integrationaccountbatchconfigurations.NewBatchConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "batchConfigurationValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountBatchConfigurationsClient.Get` + +```go +ctx := context.TODO() +id := integrationaccountbatchconfigurations.NewBatchConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "batchConfigurationValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountBatchConfigurationsClient.List` + +```go +ctx := context.TODO() +id := integrationaccountbatchconfigurations.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/client.go new file mode 100644 index 000000000000..3c5a2d9fbc38 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/client.go @@ -0,0 +1,18 @@ +package integrationaccountbatchconfigurations + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountBatchConfigurationsClient struct { + Client autorest.Client + baseUri string +} + +func NewIntegrationAccountBatchConfigurationsClientWithBaseURI(endpoint string) IntegrationAccountBatchConfigurationsClient { + return IntegrationAccountBatchConfigurationsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/constants.go new file mode 100644 index 000000000000..8542ee7731ad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/constants.go @@ -0,0 +1,138 @@ +package integrationaccountbatchconfigurations + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DayOfWeek string + +const ( + DayOfWeekFriday DayOfWeek = "Friday" + DayOfWeekMonday DayOfWeek = "Monday" + DayOfWeekSaturday DayOfWeek = "Saturday" + DayOfWeekSunday DayOfWeek = "Sunday" + DayOfWeekThursday DayOfWeek = "Thursday" + DayOfWeekTuesday DayOfWeek = "Tuesday" + DayOfWeekWednesday DayOfWeek = "Wednesday" +) + +func PossibleValuesForDayOfWeek() []string { + return []string{ + string(DayOfWeekFriday), + string(DayOfWeekMonday), + string(DayOfWeekSaturday), + string(DayOfWeekSunday), + string(DayOfWeekThursday), + string(DayOfWeekTuesday), + string(DayOfWeekWednesday), + } +} + +func parseDayOfWeek(input string) (*DayOfWeek, error) { + vals := map[string]DayOfWeek{ + "friday": DayOfWeekFriday, + "monday": DayOfWeekMonday, + "saturday": DayOfWeekSaturday, + "sunday": DayOfWeekSunday, + "thursday": DayOfWeekThursday, + "tuesday": DayOfWeekTuesday, + "wednesday": DayOfWeekWednesday, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DayOfWeek(input) + return &out, nil +} + +type DaysOfWeek string + +const ( + DaysOfWeekFriday DaysOfWeek = "Friday" + DaysOfWeekMonday DaysOfWeek = "Monday" + DaysOfWeekSaturday DaysOfWeek = "Saturday" + DaysOfWeekSunday DaysOfWeek = "Sunday" + DaysOfWeekThursday DaysOfWeek = "Thursday" + DaysOfWeekTuesday DaysOfWeek = "Tuesday" + DaysOfWeekWednesday DaysOfWeek = "Wednesday" +) + +func PossibleValuesForDaysOfWeek() []string { + return []string{ + string(DaysOfWeekFriday), + string(DaysOfWeekMonday), + string(DaysOfWeekSaturday), + string(DaysOfWeekSunday), + string(DaysOfWeekThursday), + string(DaysOfWeekTuesday), + string(DaysOfWeekWednesday), + } +} + +func parseDaysOfWeek(input string) (*DaysOfWeek, error) { + vals := map[string]DaysOfWeek{ + "friday": DaysOfWeekFriday, + "monday": DaysOfWeekMonday, + "saturday": DaysOfWeekSaturday, + "sunday": DaysOfWeekSunday, + "thursday": DaysOfWeekThursday, + "tuesday": DaysOfWeekTuesday, + "wednesday": DaysOfWeekWednesday, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DaysOfWeek(input) + return &out, nil +} + +type RecurrenceFrequency string + +const ( + RecurrenceFrequencyDay RecurrenceFrequency = "Day" + RecurrenceFrequencyHour RecurrenceFrequency = "Hour" + RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" + RecurrenceFrequencyMonth RecurrenceFrequency = "Month" + RecurrenceFrequencyNotSpecified RecurrenceFrequency = "NotSpecified" + RecurrenceFrequencySecond RecurrenceFrequency = "Second" + RecurrenceFrequencyWeek RecurrenceFrequency = "Week" + RecurrenceFrequencyYear RecurrenceFrequency = "Year" +) + +func PossibleValuesForRecurrenceFrequency() []string { + return []string{ + string(RecurrenceFrequencyDay), + string(RecurrenceFrequencyHour), + string(RecurrenceFrequencyMinute), + string(RecurrenceFrequencyMonth), + string(RecurrenceFrequencyNotSpecified), + string(RecurrenceFrequencySecond), + string(RecurrenceFrequencyWeek), + string(RecurrenceFrequencyYear), + } +} + +func parseRecurrenceFrequency(input string) (*RecurrenceFrequency, error) { + vals := map[string]RecurrenceFrequency{ + "day": RecurrenceFrequencyDay, + "hour": RecurrenceFrequencyHour, + "minute": RecurrenceFrequencyMinute, + "month": RecurrenceFrequencyMonth, + "notspecified": RecurrenceFrequencyNotSpecified, + "second": RecurrenceFrequencySecond, + "week": RecurrenceFrequencyWeek, + "year": RecurrenceFrequencyYear, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RecurrenceFrequency(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/id_batchconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/id_batchconfiguration.go new file mode 100644 index 000000000000..3e7ed9d5222c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/id_batchconfiguration.go @@ -0,0 +1,137 @@ +package integrationaccountbatchconfigurations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = BatchConfigurationId{} + +// BatchConfigurationId is a struct representing the Resource ID for a Batch Configuration +type BatchConfigurationId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string + BatchConfigurationName string +} + +// NewBatchConfigurationID returns a new BatchConfigurationId struct +func NewBatchConfigurationID(subscriptionId string, resourceGroupName string, integrationAccountName string, batchConfigurationName string) BatchConfigurationId { + return BatchConfigurationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + BatchConfigurationName: batchConfigurationName, + } +} + +// ParseBatchConfigurationID parses 'input' into a BatchConfigurationId +func ParseBatchConfigurationID(input string) (*BatchConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchConfigurationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.BatchConfigurationName, ok = parsed.Parsed["batchConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'batchConfigurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseBatchConfigurationIDInsensitively parses 'input' case-insensitively into a BatchConfigurationId +// note: this method should only be used for API response data and not user input +func ParseBatchConfigurationIDInsensitively(input string) (*BatchConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(BatchConfigurationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BatchConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.BatchConfigurationName, ok = parsed.Parsed["batchConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'batchConfigurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateBatchConfigurationID checks that 'input' can be parsed as a Batch Configuration ID +func ValidateBatchConfigurationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseBatchConfigurationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Batch Configuration ID +func (id BatchConfigurationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/batchConfigurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName, id.BatchConfigurationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Batch Configuration ID +func (id BatchConfigurationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + resourceids.StaticSegment("staticBatchConfigurations", "batchConfigurations", "batchConfigurations"), + resourceids.UserSpecifiedSegment("batchConfigurationName", "batchConfigurationValue"), + } +} + +// String returns a human-readable description of this Batch Configuration ID +func (id BatchConfigurationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + fmt.Sprintf("Batch Configuration Name: %q", id.BatchConfigurationName), + } + return fmt.Sprintf("Batch Configuration (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/id_integrationaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/id_integrationaccount.go new file mode 100644 index 000000000000..3ffe054c672b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/id_integrationaccount.go @@ -0,0 +1,124 @@ +package integrationaccountbatchconfigurations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = IntegrationAccountId{} + +// IntegrationAccountId is a struct representing the Resource ID for a Integration Account +type IntegrationAccountId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string +} + +// NewIntegrationAccountID returns a new IntegrationAccountId struct +func NewIntegrationAccountID(subscriptionId string, resourceGroupName string, integrationAccountName string) IntegrationAccountId { + return IntegrationAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + } +} + +// ParseIntegrationAccountID parses 'input' into a IntegrationAccountId +func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseIntegrationAccountIDInsensitively parses 'input' case-insensitively into a IntegrationAccountId +// note: this method should only be used for API response data and not user input +func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID +func ValidateIntegrationAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseIntegrationAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Integration Account ID +func (id IntegrationAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Integration Account ID +func (id IntegrationAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + } +} + +// String returns a human-readable description of this Integration Account ID +func (id IntegrationAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + } + return fmt.Sprintf("Integration Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/method_createorupdate_autorest.go new file mode 100644 index 000000000000..8641d50256d0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package integrationaccountbatchconfigurations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *BatchConfiguration +} + +// CreateOrUpdate ... +func (c IntegrationAccountBatchConfigurationsClient) CreateOrUpdate(ctx context.Context, id BatchConfigurationId, input BatchConfiguration) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountbatchconfigurations.IntegrationAccountBatchConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountbatchconfigurations.IntegrationAccountBatchConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountbatchconfigurations.IntegrationAccountBatchConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c IntegrationAccountBatchConfigurationsClient) preparerForCreateOrUpdate(ctx context.Context, id BatchConfigurationId, input BatchConfiguration) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c IntegrationAccountBatchConfigurationsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/method_delete_autorest.go new file mode 100644 index 000000000000..bdb37e1ae4da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/method_delete_autorest.go @@ -0,0 +1,66 @@ +package integrationaccountbatchconfigurations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c IntegrationAccountBatchConfigurationsClient) Delete(ctx context.Context, id BatchConfigurationId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountbatchconfigurations.IntegrationAccountBatchConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountbatchconfigurations.IntegrationAccountBatchConfigurationsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountbatchconfigurations.IntegrationAccountBatchConfigurationsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c IntegrationAccountBatchConfigurationsClient) preparerForDelete(ctx context.Context, id BatchConfigurationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c IntegrationAccountBatchConfigurationsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/method_get_autorest.go new file mode 100644 index 000000000000..eeccecf04b66 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/method_get_autorest.go @@ -0,0 +1,68 @@ +package integrationaccountbatchconfigurations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *BatchConfiguration +} + +// Get ... +func (c IntegrationAccountBatchConfigurationsClient) Get(ctx context.Context, id BatchConfigurationId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountbatchconfigurations.IntegrationAccountBatchConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountbatchconfigurations.IntegrationAccountBatchConfigurationsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountbatchconfigurations.IntegrationAccountBatchConfigurationsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c IntegrationAccountBatchConfigurationsClient) preparerForGet(ctx context.Context, id BatchConfigurationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c IntegrationAccountBatchConfigurationsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/method_list_autorest.go new file mode 100644 index 000000000000..451330341766 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/method_list_autorest.go @@ -0,0 +1,69 @@ +package integrationaccountbatchconfigurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *BatchConfigurationCollection +} + +// List ... +func (c IntegrationAccountBatchConfigurationsClient) List(ctx context.Context, id IntegrationAccountId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountbatchconfigurations.IntegrationAccountBatchConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountbatchconfigurations.IntegrationAccountBatchConfigurationsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountbatchconfigurations.IntegrationAccountBatchConfigurationsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c IntegrationAccountBatchConfigurationsClient) preparerForList(ctx context.Context, id IntegrationAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/batchConfigurations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c IntegrationAccountBatchConfigurationsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_batchconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_batchconfiguration.go new file mode 100644 index 000000000000..b0c2e415d6df --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_batchconfiguration.go @@ -0,0 +1,13 @@ +package integrationaccountbatchconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchConfiguration struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties BatchConfigurationProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_batchconfigurationcollection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_batchconfigurationcollection.go new file mode 100644 index 000000000000..fb05955f0898 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_batchconfigurationcollection.go @@ -0,0 +1,8 @@ +package integrationaccountbatchconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchConfigurationCollection struct { + Value *[]BatchConfiguration `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_batchconfigurationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_batchconfigurationproperties.go new file mode 100644 index 000000000000..7bb4c3555976 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_batchconfigurationproperties.go @@ -0,0 +1,42 @@ +package integrationaccountbatchconfigurations + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchConfigurationProperties struct { + BatchGroupName string `json:"batchGroupName"` + ChangedTime *string `json:"changedTime,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` + Metadata *interface{} `json:"metadata,omitempty"` + ReleaseCriteria BatchReleaseCriteria `json:"releaseCriteria"` +} + +func (o *BatchConfigurationProperties) GetChangedTimeAsTime() (*time.Time, error) { + if o.ChangedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ChangedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *BatchConfigurationProperties) SetChangedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ChangedTime = &formatted +} + +func (o *BatchConfigurationProperties) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *BatchConfigurationProperties) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_batchreleasecriteria.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_batchreleasecriteria.go new file mode 100644 index 000000000000..3eb3335e2a11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_batchreleasecriteria.go @@ -0,0 +1,10 @@ +package integrationaccountbatchconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BatchReleaseCriteria struct { + BatchSize *int64 `json:"batchSize,omitempty"` + MessageCount *int64 `json:"messageCount,omitempty"` + Recurrence *WorkflowTriggerRecurrence `json:"recurrence,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_recurrenceschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_recurrenceschedule.go new file mode 100644 index 000000000000..6ae33fb1da4b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_recurrenceschedule.go @@ -0,0 +1,12 @@ +package integrationaccountbatchconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecurrenceSchedule struct { + Hours *[]int64 `json:"hours,omitempty"` + Minutes *[]int64 `json:"minutes,omitempty"` + MonthDays *[]int64 `json:"monthDays,omitempty"` + MonthlyOccurrences *[]RecurrenceScheduleOccurrence `json:"monthlyOccurrences,omitempty"` + WeekDays *[]DaysOfWeek `json:"weekDays,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_recurrencescheduleoccurrence.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_recurrencescheduleoccurrence.go new file mode 100644 index 000000000000..662d07f9f2c4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_recurrencescheduleoccurrence.go @@ -0,0 +1,9 @@ +package integrationaccountbatchconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecurrenceScheduleOccurrence struct { + Day *DayOfWeek `json:"day,omitempty"` + Occurrence *int64 `json:"occurrence,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_workflowtriggerrecurrence.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_workflowtriggerrecurrence.go new file mode 100644 index 000000000000..a0d944f7ce78 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/model_workflowtriggerrecurrence.go @@ -0,0 +1,13 @@ +package integrationaccountbatchconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerRecurrence struct { + EndTime *string `json:"endTime,omitempty"` + Frequency *RecurrenceFrequency `json:"frequency,omitempty"` + Interval *int64 `json:"interval,omitempty"` + Schedule *RecurrenceSchedule `json:"schedule,omitempty"` + StartTime *string `json:"startTime,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/version.go new file mode 100644 index 000000000000..c564172c92e4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/version.go @@ -0,0 +1,12 @@ +package integrationaccountbatchconfigurations + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/integrationaccountbatchconfigurations/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/README.md new file mode 100644 index 000000000000..fe4cb0beed90 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates` Documentation + +The `integrationaccountcertificates` SDK allows for interaction with the Azure Resource Manager Service `logic` (API Version `2019-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates" +``` + + +### Client Initialization + +```go +client := integrationaccountcertificates.NewIntegrationAccountCertificatesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `IntegrationAccountCertificatesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := integrationaccountcertificates.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "certificateValue") + +payload := integrationaccountcertificates.IntegrationAccountCertificate{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountCertificatesClient.Delete` + +```go +ctx := context.TODO() +id := integrationaccountcertificates.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "certificateValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountCertificatesClient.Get` + +```go +ctx := context.TODO() +id := integrationaccountcertificates.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "certificateValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountCertificatesClient.List` + +```go +ctx := context.TODO() +id := integrationaccountcertificates.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +// alternatively `client.List(ctx, id, integrationaccountcertificates.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, integrationaccountcertificates.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/client.go new file mode 100644 index 000000000000..2dede1287dc9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/client.go @@ -0,0 +1,18 @@ +package integrationaccountcertificates + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountCertificatesClient struct { + Client autorest.Client + baseUri string +} + +func NewIntegrationAccountCertificatesClientWithBaseURI(endpoint string) IntegrationAccountCertificatesClient { + return IntegrationAccountCertificatesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/id_certificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/id_certificate.go new file mode 100644 index 000000000000..92b753df3786 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/id_certificate.go @@ -0,0 +1,137 @@ +package integrationaccountcertificates + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = CertificateId{} + +// CertificateId is a struct representing the Resource ID for a Certificate +type CertificateId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string + CertificateName string +} + +// NewCertificateID returns a new CertificateId struct +func NewCertificateID(subscriptionId string, resourceGroupName string, integrationAccountName string, certificateName string) CertificateId { + return CertificateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + CertificateName: certificateName, + } +} + +// ParseCertificateID parses 'input' into a CertificateId +func ParseCertificateID(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(CertificateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CertificateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { + return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseCertificateIDInsensitively parses 'input' case-insensitively into a CertificateId +// note: this method should only be used for API response data and not user input +func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(CertificateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CertificateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { + return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateCertificateID checks that 'input' can be parsed as a Certificate ID +func ValidateCertificateID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCertificateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Certificate ID +func (id CertificateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/certificates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName, id.CertificateName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Certificate ID +func (id CertificateId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + resourceids.StaticSegment("staticCertificates", "certificates", "certificates"), + resourceids.UserSpecifiedSegment("certificateName", "certificateValue"), + } +} + +// String returns a human-readable description of this Certificate ID +func (id CertificateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + fmt.Sprintf("Certificate Name: %q", id.CertificateName), + } + return fmt.Sprintf("Certificate (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/id_integrationaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/id_integrationaccount.go new file mode 100644 index 000000000000..23aa542ef6f7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/id_integrationaccount.go @@ -0,0 +1,124 @@ +package integrationaccountcertificates + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = IntegrationAccountId{} + +// IntegrationAccountId is a struct representing the Resource ID for a Integration Account +type IntegrationAccountId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string +} + +// NewIntegrationAccountID returns a new IntegrationAccountId struct +func NewIntegrationAccountID(subscriptionId string, resourceGroupName string, integrationAccountName string) IntegrationAccountId { + return IntegrationAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + } +} + +// ParseIntegrationAccountID parses 'input' into a IntegrationAccountId +func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseIntegrationAccountIDInsensitively parses 'input' case-insensitively into a IntegrationAccountId +// note: this method should only be used for API response data and not user input +func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID +func ValidateIntegrationAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseIntegrationAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Integration Account ID +func (id IntegrationAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Integration Account ID +func (id IntegrationAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + } +} + +// String returns a human-readable description of this Integration Account ID +func (id IntegrationAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + } + return fmt.Sprintf("Integration Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/method_createorupdate_autorest.go new file mode 100644 index 000000000000..dbd71dc9da25 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package integrationaccountcertificates + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccountCertificate +} + +// CreateOrUpdate ... +func (c IntegrationAccountCertificatesClient) CreateOrUpdate(ctx context.Context, id CertificateId, input IntegrationAccountCertificate) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountcertificates.IntegrationAccountCertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountcertificates.IntegrationAccountCertificatesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountcertificates.IntegrationAccountCertificatesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c IntegrationAccountCertificatesClient) preparerForCreateOrUpdate(ctx context.Context, id CertificateId, input IntegrationAccountCertificate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c IntegrationAccountCertificatesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/method_delete_autorest.go new file mode 100644 index 000000000000..60496331dc4a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/method_delete_autorest.go @@ -0,0 +1,66 @@ +package integrationaccountcertificates + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c IntegrationAccountCertificatesClient) Delete(ctx context.Context, id CertificateId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountcertificates.IntegrationAccountCertificatesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountcertificates.IntegrationAccountCertificatesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountcertificates.IntegrationAccountCertificatesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c IntegrationAccountCertificatesClient) preparerForDelete(ctx context.Context, id CertificateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c IntegrationAccountCertificatesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/method_get_autorest.go new file mode 100644 index 000000000000..aaf14d2e5d0f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/method_get_autorest.go @@ -0,0 +1,68 @@ +package integrationaccountcertificates + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccountCertificate +} + +// Get ... +func (c IntegrationAccountCertificatesClient) Get(ctx context.Context, id CertificateId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountcertificates.IntegrationAccountCertificatesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountcertificates.IntegrationAccountCertificatesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountcertificates.IntegrationAccountCertificatesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c IntegrationAccountCertificatesClient) preparerForGet(ctx context.Context, id CertificateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c IntegrationAccountCertificatesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/method_list_autorest.go new file mode 100644 index 000000000000..898ecc16486d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/method_list_autorest.go @@ -0,0 +1,215 @@ +package integrationaccountcertificates + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]IntegrationAccountCertificate + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []IntegrationAccountCertificate +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c IntegrationAccountCertificatesClient) List(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountcertificates.IntegrationAccountCertificatesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountcertificates.IntegrationAccountCertificatesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountcertificates.IntegrationAccountCertificatesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c IntegrationAccountCertificatesClient) preparerForList(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/certificates", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c IntegrationAccountCertificatesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c IntegrationAccountCertificatesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []IntegrationAccountCertificate `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountcertificates.IntegrationAccountCertificatesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountcertificates.IntegrationAccountCertificatesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountcertificates.IntegrationAccountCertificatesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c IntegrationAccountCertificatesClient) ListComplete(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, IntegrationAccountCertificateOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c IntegrationAccountCertificatesClient) ListCompleteMatchingPredicate(ctx context.Context, id IntegrationAccountId, options ListOperationOptions, predicate IntegrationAccountCertificateOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]IntegrationAccountCertificate, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/model_integrationaccountcertificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/model_integrationaccountcertificate.go new file mode 100644 index 000000000000..c705b27ebd32 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/model_integrationaccountcertificate.go @@ -0,0 +1,13 @@ +package integrationaccountcertificates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountCertificate struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties IntegrationAccountCertificateProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/model_integrationaccountcertificateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/model_integrationaccountcertificateproperties.go new file mode 100644 index 000000000000..4459c3147025 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/model_integrationaccountcertificateproperties.go @@ -0,0 +1,42 @@ +package integrationaccountcertificates + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountCertificateProperties struct { + ChangedTime *string `json:"changedTime,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` + Key *KeyVaultKeyReference `json:"key,omitempty"` + Metadata *interface{} `json:"metadata,omitempty"` + PublicCertificate *string `json:"publicCertificate,omitempty"` +} + +func (o *IntegrationAccountCertificateProperties) GetChangedTimeAsTime() (*time.Time, error) { + if o.ChangedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ChangedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *IntegrationAccountCertificateProperties) SetChangedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ChangedTime = &formatted +} + +func (o *IntegrationAccountCertificateProperties) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *IntegrationAccountCertificateProperties) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/model_keyvaultkeyreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/model_keyvaultkeyreference.go new file mode 100644 index 000000000000..9c31f60c106e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/model_keyvaultkeyreference.go @@ -0,0 +1,10 @@ +package integrationaccountcertificates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultKeyReference struct { + KeyName string `json:"keyName"` + KeyVault KeyVaultKeyReferenceKeyVault `json:"keyVault"` + KeyVersion *string `json:"keyVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/model_keyvaultkeyreferencekeyvault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/model_keyvaultkeyreferencekeyvault.go new file mode 100644 index 000000000000..9e70468f37b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/model_keyvaultkeyreferencekeyvault.go @@ -0,0 +1,10 @@ +package integrationaccountcertificates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultKeyReferenceKeyVault struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/predicates.go new file mode 100644 index 000000000000..adb1686316d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/predicates.go @@ -0,0 +1,29 @@ +package integrationaccountcertificates + +type IntegrationAccountCertificateOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p IntegrationAccountCertificateOperationPredicate) Matches(input IntegrationAccountCertificate) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/version.go new file mode 100644 index 000000000000..463b6cce545a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates/version.go @@ -0,0 +1,12 @@ +package integrationaccountcertificates + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/integrationaccountcertificates/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/README.md new file mode 100644 index 000000000000..8c5b5fe05c3c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps` Documentation + +The `integrationaccountmaps` SDK allows for interaction with the Azure Resource Manager Service `logic` (API Version `2019-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps" +``` + + +### Client Initialization + +```go +client := integrationaccountmaps.NewIntegrationAccountMapsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `IntegrationAccountMapsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := integrationaccountmaps.NewMapID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "mapValue") + +payload := integrationaccountmaps.IntegrationAccountMap{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountMapsClient.Delete` + +```go +ctx := context.TODO() +id := integrationaccountmaps.NewMapID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "mapValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountMapsClient.Get` + +```go +ctx := context.TODO() +id := integrationaccountmaps.NewMapID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "mapValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountMapsClient.List` + +```go +ctx := context.TODO() +id := integrationaccountmaps.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +// alternatively `client.List(ctx, id, integrationaccountmaps.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, integrationaccountmaps.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `IntegrationAccountMapsClient.ListContentCallbackUrl` + +```go +ctx := context.TODO() +id := integrationaccountmaps.NewMapID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "mapValue") + +payload := integrationaccountmaps.GetCallbackUrlParameters{ + // ... +} + + +read, err := client.ListContentCallbackUrl(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/client.go new file mode 100644 index 000000000000..21fb3bffd9b0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/client.go @@ -0,0 +1,18 @@ +package integrationaccountmaps + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountMapsClient struct { + Client autorest.Client + baseUri string +} + +func NewIntegrationAccountMapsClientWithBaseURI(endpoint string) IntegrationAccountMapsClient { + return IntegrationAccountMapsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/constants.go new file mode 100644 index 000000000000..fa9f7bb2ba84 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/constants.go @@ -0,0 +1,74 @@ +package integrationaccountmaps + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyType string + +const ( + KeyTypeNotSpecified KeyType = "NotSpecified" + KeyTypePrimary KeyType = "Primary" + KeyTypeSecondary KeyType = "Secondary" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypeNotSpecified), + string(KeyTypePrimary), + string(KeyTypeSecondary), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "notspecified": KeyTypeNotSpecified, + "primary": KeyTypePrimary, + "secondary": KeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} + +type MapType string + +const ( + MapTypeLiquid MapType = "Liquid" + MapTypeNotSpecified MapType = "NotSpecified" + MapTypeXslt MapType = "Xslt" + MapTypeXsltThreeZero MapType = "Xslt30" + MapTypeXsltTwoZero MapType = "Xslt20" +) + +func PossibleValuesForMapType() []string { + return []string{ + string(MapTypeLiquid), + string(MapTypeNotSpecified), + string(MapTypeXslt), + string(MapTypeXsltThreeZero), + string(MapTypeXsltTwoZero), + } +} + +func parseMapType(input string) (*MapType, error) { + vals := map[string]MapType{ + "liquid": MapTypeLiquid, + "notspecified": MapTypeNotSpecified, + "xslt": MapTypeXslt, + "xslt30": MapTypeXsltThreeZero, + "xslt20": MapTypeXsltTwoZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MapType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/id_integrationaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/id_integrationaccount.go new file mode 100644 index 000000000000..609e19701d5b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/id_integrationaccount.go @@ -0,0 +1,124 @@ +package integrationaccountmaps + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = IntegrationAccountId{} + +// IntegrationAccountId is a struct representing the Resource ID for a Integration Account +type IntegrationAccountId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string +} + +// NewIntegrationAccountID returns a new IntegrationAccountId struct +func NewIntegrationAccountID(subscriptionId string, resourceGroupName string, integrationAccountName string) IntegrationAccountId { + return IntegrationAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + } +} + +// ParseIntegrationAccountID parses 'input' into a IntegrationAccountId +func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseIntegrationAccountIDInsensitively parses 'input' case-insensitively into a IntegrationAccountId +// note: this method should only be used for API response data and not user input +func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID +func ValidateIntegrationAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseIntegrationAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Integration Account ID +func (id IntegrationAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Integration Account ID +func (id IntegrationAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + } +} + +// String returns a human-readable description of this Integration Account ID +func (id IntegrationAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + } + return fmt.Sprintf("Integration Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/id_map.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/id_map.go new file mode 100644 index 000000000000..ff871f898a68 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/id_map.go @@ -0,0 +1,137 @@ +package integrationaccountmaps + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = MapId{} + +// MapId is a struct representing the Resource ID for a Map +type MapId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string + MapName string +} + +// NewMapID returns a new MapId struct +func NewMapID(subscriptionId string, resourceGroupName string, integrationAccountName string, mapName string) MapId { + return MapId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + MapName: mapName, + } +} + +// ParseMapID parses 'input' into a MapId +func ParseMapID(input string) (*MapId, error) { + parser := resourceids.NewParserFromResourceIdType(MapId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MapId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.MapName, ok = parsed.Parsed["mapName"]; !ok { + return nil, fmt.Errorf("the segment 'mapName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseMapIDInsensitively parses 'input' case-insensitively into a MapId +// note: this method should only be used for API response data and not user input +func ParseMapIDInsensitively(input string) (*MapId, error) { + parser := resourceids.NewParserFromResourceIdType(MapId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MapId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.MapName, ok = parsed.Parsed["mapName"]; !ok { + return nil, fmt.Errorf("the segment 'mapName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateMapID checks that 'input' can be parsed as a Map ID +func ValidateMapID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseMapID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Map ID +func (id MapId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/maps/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName, id.MapName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Map ID +func (id MapId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + resourceids.StaticSegment("staticMaps", "maps", "maps"), + resourceids.UserSpecifiedSegment("mapName", "mapValue"), + } +} + +// String returns a human-readable description of this Map ID +func (id MapId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + fmt.Sprintf("Map Name: %q", id.MapName), + } + return fmt.Sprintf("Map (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/method_createorupdate_autorest.go new file mode 100644 index 000000000000..3a05c3329584 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package integrationaccountmaps + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccountMap +} + +// CreateOrUpdate ... +func (c IntegrationAccountMapsClient) CreateOrUpdate(ctx context.Context, id MapId, input IntegrationAccountMap) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c IntegrationAccountMapsClient) preparerForCreateOrUpdate(ctx context.Context, id MapId, input IntegrationAccountMap) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c IntegrationAccountMapsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/method_delete_autorest.go new file mode 100644 index 000000000000..6687a8e31952 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/method_delete_autorest.go @@ -0,0 +1,66 @@ +package integrationaccountmaps + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c IntegrationAccountMapsClient) Delete(ctx context.Context, id MapId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c IntegrationAccountMapsClient) preparerForDelete(ctx context.Context, id MapId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c IntegrationAccountMapsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/method_get_autorest.go new file mode 100644 index 000000000000..e5cb5fb9897d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/method_get_autorest.go @@ -0,0 +1,68 @@ +package integrationaccountmaps + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccountMap +} + +// Get ... +func (c IntegrationAccountMapsClient) Get(ctx context.Context, id MapId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c IntegrationAccountMapsClient) preparerForGet(ctx context.Context, id MapId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c IntegrationAccountMapsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/method_list_autorest.go new file mode 100644 index 000000000000..2373aa96ae30 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/method_list_autorest.go @@ -0,0 +1,220 @@ +package integrationaccountmaps + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]IntegrationAccountMap + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []IntegrationAccountMap +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Filter *string + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c IntegrationAccountMapsClient) List(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c IntegrationAccountMapsClient) preparerForList(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/maps", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c IntegrationAccountMapsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c IntegrationAccountMapsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []IntegrationAccountMap `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c IntegrationAccountMapsClient) ListComplete(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, IntegrationAccountMapOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c IntegrationAccountMapsClient) ListCompleteMatchingPredicate(ctx context.Context, id IntegrationAccountId, options ListOperationOptions, predicate IntegrationAccountMapOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]IntegrationAccountMap, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/method_listcontentcallbackurl_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/method_listcontentcallbackurl_autorest.go new file mode 100644 index 000000000000..f4c32ffe6c8e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/method_listcontentcallbackurl_autorest.go @@ -0,0 +1,70 @@ +package integrationaccountmaps + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListContentCallbackUrlOperationResponse struct { + HttpResponse *http.Response + Model *WorkflowTriggerCallbackUrl +} + +// ListContentCallbackUrl ... +func (c IntegrationAccountMapsClient) ListContentCallbackUrl(ctx context.Context, id MapId, input GetCallbackUrlParameters) (result ListContentCallbackUrlOperationResponse, err error) { + req, err := c.preparerForListContentCallbackUrl(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "ListContentCallbackUrl", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "ListContentCallbackUrl", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListContentCallbackUrl(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountmaps.IntegrationAccountMapsClient", "ListContentCallbackUrl", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListContentCallbackUrl prepares the ListContentCallbackUrl request. +func (c IntegrationAccountMapsClient) preparerForListContentCallbackUrl(ctx context.Context, id MapId, input GetCallbackUrlParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listContentCallbackUrl", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListContentCallbackUrl handles the response to the ListContentCallbackUrl request. The method always +// closes the http.Response Body. +func (c IntegrationAccountMapsClient) responderForListContentCallbackUrl(resp *http.Response) (result ListContentCallbackUrlOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_contenthash.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_contenthash.go new file mode 100644 index 000000000000..48677dd723d6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_contenthash.go @@ -0,0 +1,9 @@ +package integrationaccountmaps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentHash struct { + Algorithm *string `json:"algorithm,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_contentlink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_contentlink.go new file mode 100644 index 000000000000..2af05f43638d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_contentlink.go @@ -0,0 +1,12 @@ +package integrationaccountmaps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentLink struct { + ContentHash *ContentHash `json:"contentHash,omitempty"` + ContentSize *int64 `json:"contentSize,omitempty"` + ContentVersion *string `json:"contentVersion,omitempty"` + Metadata *interface{} `json:"metadata,omitempty"` + Uri *string `json:"uri,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_getcallbackurlparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_getcallbackurlparameters.go new file mode 100644 index 000000000000..3458f2415ccd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_getcallbackurlparameters.go @@ -0,0 +1,27 @@ +package integrationaccountmaps + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetCallbackUrlParameters struct { + KeyType *KeyType `json:"keyType,omitempty"` + NotAfter *string `json:"notAfter,omitempty"` +} + +func (o *GetCallbackUrlParameters) GetNotAfterAsTime() (*time.Time, error) { + if o.NotAfter == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NotAfter, "2006-01-02T15:04:05Z07:00") +} + +func (o *GetCallbackUrlParameters) SetNotAfterAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NotAfter = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_integrationaccountmap.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_integrationaccountmap.go new file mode 100644 index 000000000000..8939921424fc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_integrationaccountmap.go @@ -0,0 +1,13 @@ +package integrationaccountmaps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountMap struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties IntegrationAccountMapProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_integrationaccountmapproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_integrationaccountmapproperties.go new file mode 100644 index 000000000000..6517165e0eea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_integrationaccountmapproperties.go @@ -0,0 +1,45 @@ +package integrationaccountmaps + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountMapProperties struct { + ChangedTime *string `json:"changedTime,omitempty"` + Content *string `json:"content,omitempty"` + ContentLink *ContentLink `json:"contentLink,omitempty"` + ContentType *string `json:"contentType,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` + MapType MapType `json:"mapType"` + Metadata *interface{} `json:"metadata,omitempty"` + ParametersSchema *IntegrationAccountMapPropertiesParametersSchema `json:"parametersSchema,omitempty"` +} + +func (o *IntegrationAccountMapProperties) GetChangedTimeAsTime() (*time.Time, error) { + if o.ChangedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ChangedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *IntegrationAccountMapProperties) SetChangedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ChangedTime = &formatted +} + +func (o *IntegrationAccountMapProperties) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *IntegrationAccountMapProperties) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_integrationaccountmappropertiesparametersschema.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_integrationaccountmappropertiesparametersschema.go new file mode 100644 index 000000000000..bc2cab012b63 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_integrationaccountmappropertiesparametersschema.go @@ -0,0 +1,8 @@ +package integrationaccountmaps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountMapPropertiesParametersSchema struct { + Ref *string `json:"ref,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_workflowtriggercallbackurl.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_workflowtriggercallbackurl.go new file mode 100644 index 000000000000..64706937cad4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_workflowtriggercallbackurl.go @@ -0,0 +1,13 @@ +package integrationaccountmaps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerCallbackUrl struct { + BasePath *string `json:"basePath,omitempty"` + Method *string `json:"method,omitempty"` + Queries *WorkflowTriggerListCallbackUrlQueries `json:"queries,omitempty"` + RelativePath *string `json:"relativePath,omitempty"` + RelativePathParameters *[]string `json:"relativePathParameters,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_workflowtriggerlistcallbackurlqueries.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_workflowtriggerlistcallbackurlqueries.go new file mode 100644 index 000000000000..d776410c0569 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/model_workflowtriggerlistcallbackurlqueries.go @@ -0,0 +1,12 @@ +package integrationaccountmaps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerListCallbackUrlQueries struct { + ApiVersion *string `json:"api-version,omitempty"` + Se *string `json:"se,omitempty"` + Sig *string `json:"sig,omitempty"` + Sp *string `json:"sp,omitempty"` + Sv *string `json:"sv,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/predicates.go new file mode 100644 index 000000000000..6daadbbf97e5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/predicates.go @@ -0,0 +1,29 @@ +package integrationaccountmaps + +type IntegrationAccountMapOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p IntegrationAccountMapOperationPredicate) Matches(input IntegrationAccountMap) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/version.go new file mode 100644 index 000000000000..a8d445f94391 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps/version.go @@ -0,0 +1,12 @@ +package integrationaccountmaps + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/integrationaccountmaps/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/README.md new file mode 100644 index 000000000000..3c5c68d3f24e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners` Documentation + +The `integrationaccountpartners` SDK allows for interaction with the Azure Resource Manager Service `logic` (API Version `2019-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners" +``` + + +### Client Initialization + +```go +client := integrationaccountpartners.NewIntegrationAccountPartnersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `IntegrationAccountPartnersClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := integrationaccountpartners.NewPartnerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "partnerValue") + +payload := integrationaccountpartners.IntegrationAccountPartner{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountPartnersClient.Delete` + +```go +ctx := context.TODO() +id := integrationaccountpartners.NewPartnerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "partnerValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountPartnersClient.Get` + +```go +ctx := context.TODO() +id := integrationaccountpartners.NewPartnerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "partnerValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountPartnersClient.List` + +```go +ctx := context.TODO() +id := integrationaccountpartners.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +// alternatively `client.List(ctx, id, integrationaccountpartners.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, integrationaccountpartners.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `IntegrationAccountPartnersClient.ListContentCallbackUrl` + +```go +ctx := context.TODO() +id := integrationaccountpartners.NewPartnerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "partnerValue") + +payload := integrationaccountpartners.GetCallbackUrlParameters{ + // ... +} + + +read, err := client.ListContentCallbackUrl(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/client.go new file mode 100644 index 000000000000..1fbaff6716f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/client.go @@ -0,0 +1,18 @@ +package integrationaccountpartners + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountPartnersClient struct { + Client autorest.Client + baseUri string +} + +func NewIntegrationAccountPartnersClientWithBaseURI(endpoint string) IntegrationAccountPartnersClient { + return IntegrationAccountPartnersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/constants.go new file mode 100644 index 000000000000..2e580c247fab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/constants.go @@ -0,0 +1,65 @@ +package integrationaccountpartners + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyType string + +const ( + KeyTypeNotSpecified KeyType = "NotSpecified" + KeyTypePrimary KeyType = "Primary" + KeyTypeSecondary KeyType = "Secondary" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypeNotSpecified), + string(KeyTypePrimary), + string(KeyTypeSecondary), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "notspecified": KeyTypeNotSpecified, + "primary": KeyTypePrimary, + "secondary": KeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} + +type PartnerType string + +const ( + PartnerTypeBTwoB PartnerType = "B2B" + PartnerTypeNotSpecified PartnerType = "NotSpecified" +) + +func PossibleValuesForPartnerType() []string { + return []string{ + string(PartnerTypeBTwoB), + string(PartnerTypeNotSpecified), + } +} + +func parsePartnerType(input string) (*PartnerType, error) { + vals := map[string]PartnerType{ + "b2b": PartnerTypeBTwoB, + "notspecified": PartnerTypeNotSpecified, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PartnerType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/id_integrationaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/id_integrationaccount.go new file mode 100644 index 000000000000..ac3a9c85ebd2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/id_integrationaccount.go @@ -0,0 +1,124 @@ +package integrationaccountpartners + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = IntegrationAccountId{} + +// IntegrationAccountId is a struct representing the Resource ID for a Integration Account +type IntegrationAccountId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string +} + +// NewIntegrationAccountID returns a new IntegrationAccountId struct +func NewIntegrationAccountID(subscriptionId string, resourceGroupName string, integrationAccountName string) IntegrationAccountId { + return IntegrationAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + } +} + +// ParseIntegrationAccountID parses 'input' into a IntegrationAccountId +func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseIntegrationAccountIDInsensitively parses 'input' case-insensitively into a IntegrationAccountId +// note: this method should only be used for API response data and not user input +func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID +func ValidateIntegrationAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseIntegrationAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Integration Account ID +func (id IntegrationAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Integration Account ID +func (id IntegrationAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + } +} + +// String returns a human-readable description of this Integration Account ID +func (id IntegrationAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + } + return fmt.Sprintf("Integration Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/id_partner.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/id_partner.go new file mode 100644 index 000000000000..b08ed06b94bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/id_partner.go @@ -0,0 +1,137 @@ +package integrationaccountpartners + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PartnerId{} + +// PartnerId is a struct representing the Resource ID for a Partner +type PartnerId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string + PartnerName string +} + +// NewPartnerID returns a new PartnerId struct +func NewPartnerID(subscriptionId string, resourceGroupName string, integrationAccountName string, partnerName string) PartnerId { + return PartnerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + PartnerName: partnerName, + } +} + +// ParsePartnerID parses 'input' into a PartnerId +func ParsePartnerID(input string) (*PartnerId, error) { + parser := resourceids.NewParserFromResourceIdType(PartnerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PartnerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.PartnerName, ok = parsed.Parsed["partnerName"]; !ok { + return nil, fmt.Errorf("the segment 'partnerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePartnerIDInsensitively parses 'input' case-insensitively into a PartnerId +// note: this method should only be used for API response data and not user input +func ParsePartnerIDInsensitively(input string) (*PartnerId, error) { + parser := resourceids.NewParserFromResourceIdType(PartnerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PartnerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.PartnerName, ok = parsed.Parsed["partnerName"]; !ok { + return nil, fmt.Errorf("the segment 'partnerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePartnerID checks that 'input' can be parsed as a Partner ID +func ValidatePartnerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePartnerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Partner ID +func (id PartnerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/partners/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName, id.PartnerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Partner ID +func (id PartnerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + resourceids.StaticSegment("staticPartners", "partners", "partners"), + resourceids.UserSpecifiedSegment("partnerName", "partnerValue"), + } +} + +// String returns a human-readable description of this Partner ID +func (id PartnerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + fmt.Sprintf("Partner Name: %q", id.PartnerName), + } + return fmt.Sprintf("Partner (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/method_createorupdate_autorest.go new file mode 100644 index 000000000000..ea062ebc9457 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package integrationaccountpartners + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccountPartner +} + +// CreateOrUpdate ... +func (c IntegrationAccountPartnersClient) CreateOrUpdate(ctx context.Context, id PartnerId, input IntegrationAccountPartner) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c IntegrationAccountPartnersClient) preparerForCreateOrUpdate(ctx context.Context, id PartnerId, input IntegrationAccountPartner) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c IntegrationAccountPartnersClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/method_delete_autorest.go new file mode 100644 index 000000000000..62728bdf5c33 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/method_delete_autorest.go @@ -0,0 +1,66 @@ +package integrationaccountpartners + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c IntegrationAccountPartnersClient) Delete(ctx context.Context, id PartnerId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c IntegrationAccountPartnersClient) preparerForDelete(ctx context.Context, id PartnerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c IntegrationAccountPartnersClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/method_get_autorest.go new file mode 100644 index 000000000000..dc4c53ef180b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/method_get_autorest.go @@ -0,0 +1,68 @@ +package integrationaccountpartners + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccountPartner +} + +// Get ... +func (c IntegrationAccountPartnersClient) Get(ctx context.Context, id PartnerId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c IntegrationAccountPartnersClient) preparerForGet(ctx context.Context, id PartnerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c IntegrationAccountPartnersClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/method_list_autorest.go new file mode 100644 index 000000000000..a1418f4e59b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/method_list_autorest.go @@ -0,0 +1,220 @@ +package integrationaccountpartners + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]IntegrationAccountPartner + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []IntegrationAccountPartner +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Filter *string + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c IntegrationAccountPartnersClient) List(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c IntegrationAccountPartnersClient) preparerForList(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/partners", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c IntegrationAccountPartnersClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c IntegrationAccountPartnersClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []IntegrationAccountPartner `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c IntegrationAccountPartnersClient) ListComplete(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, IntegrationAccountPartnerOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c IntegrationAccountPartnersClient) ListCompleteMatchingPredicate(ctx context.Context, id IntegrationAccountId, options ListOperationOptions, predicate IntegrationAccountPartnerOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]IntegrationAccountPartner, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/method_listcontentcallbackurl_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/method_listcontentcallbackurl_autorest.go new file mode 100644 index 000000000000..110231414eec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/method_listcontentcallbackurl_autorest.go @@ -0,0 +1,70 @@ +package integrationaccountpartners + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListContentCallbackUrlOperationResponse struct { + HttpResponse *http.Response + Model *WorkflowTriggerCallbackUrl +} + +// ListContentCallbackUrl ... +func (c IntegrationAccountPartnersClient) ListContentCallbackUrl(ctx context.Context, id PartnerId, input GetCallbackUrlParameters) (result ListContentCallbackUrlOperationResponse, err error) { + req, err := c.preparerForListContentCallbackUrl(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "ListContentCallbackUrl", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "ListContentCallbackUrl", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListContentCallbackUrl(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountpartners.IntegrationAccountPartnersClient", "ListContentCallbackUrl", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListContentCallbackUrl prepares the ListContentCallbackUrl request. +func (c IntegrationAccountPartnersClient) preparerForListContentCallbackUrl(ctx context.Context, id PartnerId, input GetCallbackUrlParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listContentCallbackUrl", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListContentCallbackUrl handles the response to the ListContentCallbackUrl request. The method always +// closes the http.Response Body. +func (c IntegrationAccountPartnersClient) responderForListContentCallbackUrl(resp *http.Response) (result ListContentCallbackUrlOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_b2bpartnercontent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_b2bpartnercontent.go new file mode 100644 index 000000000000..cefca97d2272 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_b2bpartnercontent.go @@ -0,0 +1,8 @@ +package integrationaccountpartners + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type B2BPartnerContent struct { + BusinessIdentities *[]BusinessIdentity `json:"businessIdentities,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_businessidentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_businessidentity.go new file mode 100644 index 000000000000..aead972193ff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_businessidentity.go @@ -0,0 +1,9 @@ +package integrationaccountpartners + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BusinessIdentity struct { + Qualifier string `json:"qualifier"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_getcallbackurlparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_getcallbackurlparameters.go new file mode 100644 index 000000000000..7369a99dd662 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_getcallbackurlparameters.go @@ -0,0 +1,27 @@ +package integrationaccountpartners + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetCallbackUrlParameters struct { + KeyType *KeyType `json:"keyType,omitempty"` + NotAfter *string `json:"notAfter,omitempty"` +} + +func (o *GetCallbackUrlParameters) GetNotAfterAsTime() (*time.Time, error) { + if o.NotAfter == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NotAfter, "2006-01-02T15:04:05Z07:00") +} + +func (o *GetCallbackUrlParameters) SetNotAfterAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NotAfter = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_integrationaccountpartner.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_integrationaccountpartner.go new file mode 100644 index 000000000000..d1b7cb8151ee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_integrationaccountpartner.go @@ -0,0 +1,13 @@ +package integrationaccountpartners + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountPartner struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties IntegrationAccountPartnerProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_integrationaccountpartnerproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_integrationaccountpartnerproperties.go new file mode 100644 index 000000000000..f1e4ee6c2707 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_integrationaccountpartnerproperties.go @@ -0,0 +1,42 @@ +package integrationaccountpartners + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountPartnerProperties struct { + ChangedTime *string `json:"changedTime,omitempty"` + Content PartnerContent `json:"content"` + CreatedTime *string `json:"createdTime,omitempty"` + Metadata *interface{} `json:"metadata,omitempty"` + PartnerType PartnerType `json:"partnerType"` +} + +func (o *IntegrationAccountPartnerProperties) GetChangedTimeAsTime() (*time.Time, error) { + if o.ChangedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ChangedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *IntegrationAccountPartnerProperties) SetChangedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ChangedTime = &formatted +} + +func (o *IntegrationAccountPartnerProperties) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *IntegrationAccountPartnerProperties) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_partnercontent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_partnercontent.go new file mode 100644 index 000000000000..4fa31c4c71ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_partnercontent.go @@ -0,0 +1,8 @@ +package integrationaccountpartners + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PartnerContent struct { + B2b *B2BPartnerContent `json:"b2b,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_workflowtriggercallbackurl.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_workflowtriggercallbackurl.go new file mode 100644 index 000000000000..b3fa6182db11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_workflowtriggercallbackurl.go @@ -0,0 +1,13 @@ +package integrationaccountpartners + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerCallbackUrl struct { + BasePath *string `json:"basePath,omitempty"` + Method *string `json:"method,omitempty"` + Queries *WorkflowTriggerListCallbackUrlQueries `json:"queries,omitempty"` + RelativePath *string `json:"relativePath,omitempty"` + RelativePathParameters *[]string `json:"relativePathParameters,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_workflowtriggerlistcallbackurlqueries.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_workflowtriggerlistcallbackurlqueries.go new file mode 100644 index 000000000000..fcbfbfd6b22d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/model_workflowtriggerlistcallbackurlqueries.go @@ -0,0 +1,12 @@ +package integrationaccountpartners + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerListCallbackUrlQueries struct { + ApiVersion *string `json:"api-version,omitempty"` + Se *string `json:"se,omitempty"` + Sig *string `json:"sig,omitempty"` + Sp *string `json:"sp,omitempty"` + Sv *string `json:"sv,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/predicates.go new file mode 100644 index 000000000000..60f56a09ed81 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/predicates.go @@ -0,0 +1,29 @@ +package integrationaccountpartners + +type IntegrationAccountPartnerOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p IntegrationAccountPartnerOperationPredicate) Matches(input IntegrationAccountPartner) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/version.go new file mode 100644 index 000000000000..e35739db53f3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners/version.go @@ -0,0 +1,12 @@ +package integrationaccountpartners + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/integrationaccountpartners/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/README.md new file mode 100644 index 000000000000..ad9bdbb6408f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/README.md @@ -0,0 +1,212 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts` Documentation + +The `integrationaccounts` SDK allows for interaction with the Azure Resource Manager Service `logic` (API Version `2019-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts" +``` + + +### Client Initialization + +```go +client := integrationaccounts.NewIntegrationAccountsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `IntegrationAccountsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := integrationaccounts.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +payload := integrationaccounts.IntegrationAccount{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountsClient.Delete` + +```go +ctx := context.TODO() +id := integrationaccounts.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountsClient.Get` + +```go +ctx := context.TODO() +id := integrationaccounts.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := integrationaccounts.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id, integrationaccounts.DefaultListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id, integrationaccounts.DefaultListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `IntegrationAccountsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := integrationaccounts.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id, integrationaccounts.DefaultListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id, integrationaccounts.DefaultListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `IntegrationAccountsClient.ListCallbackUrl` + +```go +ctx := context.TODO() +id := integrationaccounts.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +payload := integrationaccounts.GetCallbackUrlParameters{ + // ... +} + + +read, err := client.ListCallbackUrl(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountsClient.ListKeyVaultKeys` + +```go +ctx := context.TODO() +id := integrationaccounts.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +payload := integrationaccounts.ListKeyVaultKeysDefinition{ + // ... +} + + +read, err := client.ListKeyVaultKeys(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountsClient.LogTrackingEvents` + +```go +ctx := context.TODO() +id := integrationaccounts.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +payload := integrationaccounts.TrackingEventsDefinition{ + // ... +} + + +read, err := client.LogTrackingEvents(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountsClient.RegenerateAccessKey` + +```go +ctx := context.TODO() +id := integrationaccounts.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +payload := integrationaccounts.RegenerateActionParameter{ + // ... +} + + +read, err := client.RegenerateAccessKey(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountsClient.Update` + +```go +ctx := context.TODO() +id := integrationaccounts.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +payload := integrationaccounts.IntegrationAccount{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/client.go new file mode 100644 index 000000000000..e4906893775d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/client.go @@ -0,0 +1,18 @@ +package integrationaccounts + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountsClient struct { + Client autorest.Client + baseUri string +} + +func NewIntegrationAccountsClientWithBaseURI(endpoint string) IntegrationAccountsClient { + return IntegrationAccountsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/constants.go new file mode 100644 index 000000000000..f499c67ceaeb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/constants.go @@ -0,0 +1,249 @@ +package integrationaccounts + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventLevel string + +const ( + EventLevelCritical EventLevel = "Critical" + EventLevelError EventLevel = "Error" + EventLevelInformational EventLevel = "Informational" + EventLevelLogAlways EventLevel = "LogAlways" + EventLevelVerbose EventLevel = "Verbose" + EventLevelWarning EventLevel = "Warning" +) + +func PossibleValuesForEventLevel() []string { + return []string{ + string(EventLevelCritical), + string(EventLevelError), + string(EventLevelInformational), + string(EventLevelLogAlways), + string(EventLevelVerbose), + string(EventLevelWarning), + } +} + +func parseEventLevel(input string) (*EventLevel, error) { + vals := map[string]EventLevel{ + "critical": EventLevelCritical, + "error": EventLevelError, + "informational": EventLevelInformational, + "logalways": EventLevelLogAlways, + "verbose": EventLevelVerbose, + "warning": EventLevelWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EventLevel(input) + return &out, nil +} + +type IntegrationAccountSkuName string + +const ( + IntegrationAccountSkuNameBasic IntegrationAccountSkuName = "Basic" + IntegrationAccountSkuNameFree IntegrationAccountSkuName = "Free" + IntegrationAccountSkuNameNotSpecified IntegrationAccountSkuName = "NotSpecified" + IntegrationAccountSkuNameStandard IntegrationAccountSkuName = "Standard" +) + +func PossibleValuesForIntegrationAccountSkuName() []string { + return []string{ + string(IntegrationAccountSkuNameBasic), + string(IntegrationAccountSkuNameFree), + string(IntegrationAccountSkuNameNotSpecified), + string(IntegrationAccountSkuNameStandard), + } +} + +func parseIntegrationAccountSkuName(input string) (*IntegrationAccountSkuName, error) { + vals := map[string]IntegrationAccountSkuName{ + "basic": IntegrationAccountSkuNameBasic, + "free": IntegrationAccountSkuNameFree, + "notspecified": IntegrationAccountSkuNameNotSpecified, + "standard": IntegrationAccountSkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IntegrationAccountSkuName(input) + return &out, nil +} + +type KeyType string + +const ( + KeyTypeNotSpecified KeyType = "NotSpecified" + KeyTypePrimary KeyType = "Primary" + KeyTypeSecondary KeyType = "Secondary" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypeNotSpecified), + string(KeyTypePrimary), + string(KeyTypeSecondary), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "notspecified": KeyTypeNotSpecified, + "primary": KeyTypePrimary, + "secondary": KeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} + +type TrackEventsOperationOptions string + +const ( + TrackEventsOperationOptionsDisableSourceInfoEnrich TrackEventsOperationOptions = "DisableSourceInfoEnrich" + TrackEventsOperationOptionsNone TrackEventsOperationOptions = "None" +) + +func PossibleValuesForTrackEventsOperationOptions() []string { + return []string{ + string(TrackEventsOperationOptionsDisableSourceInfoEnrich), + string(TrackEventsOperationOptionsNone), + } +} + +func parseTrackEventsOperationOptions(input string) (*TrackEventsOperationOptions, error) { + vals := map[string]TrackEventsOperationOptions{ + "disablesourceinfoenrich": TrackEventsOperationOptionsDisableSourceInfoEnrich, + "none": TrackEventsOperationOptionsNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TrackEventsOperationOptions(input) + return &out, nil +} + +type TrackingRecordType string + +const ( + TrackingRecordTypeASTwoMDN TrackingRecordType = "AS2MDN" + TrackingRecordTypeASTwoMessage TrackingRecordType = "AS2Message" + TrackingRecordTypeCustom TrackingRecordType = "Custom" + TrackingRecordTypeEdifactFunctionalGroup TrackingRecordType = "EdifactFunctionalGroup" + TrackingRecordTypeEdifactFunctionalGroupAcknowledgment TrackingRecordType = "EdifactFunctionalGroupAcknowledgment" + TrackingRecordTypeEdifactInterchange TrackingRecordType = "EdifactInterchange" + TrackingRecordTypeEdifactInterchangeAcknowledgment TrackingRecordType = "EdifactInterchangeAcknowledgment" + TrackingRecordTypeEdifactTransactionSet TrackingRecordType = "EdifactTransactionSet" + TrackingRecordTypeEdifactTransactionSetAcknowledgment TrackingRecordType = "EdifactTransactionSetAcknowledgment" + TrackingRecordTypeNotSpecified TrackingRecordType = "NotSpecified" + TrackingRecordTypeXOneTwoFunctionalGroup TrackingRecordType = "X12FunctionalGroup" + TrackingRecordTypeXOneTwoFunctionalGroupAcknowledgment TrackingRecordType = "X12FunctionalGroupAcknowledgment" + TrackingRecordTypeXOneTwoInterchange TrackingRecordType = "X12Interchange" + TrackingRecordTypeXOneTwoInterchangeAcknowledgment TrackingRecordType = "X12InterchangeAcknowledgment" + TrackingRecordTypeXOneTwoTransactionSet TrackingRecordType = "X12TransactionSet" + TrackingRecordTypeXOneTwoTransactionSetAcknowledgment TrackingRecordType = "X12TransactionSetAcknowledgment" +) + +func PossibleValuesForTrackingRecordType() []string { + return []string{ + string(TrackingRecordTypeASTwoMDN), + string(TrackingRecordTypeASTwoMessage), + string(TrackingRecordTypeCustom), + string(TrackingRecordTypeEdifactFunctionalGroup), + string(TrackingRecordTypeEdifactFunctionalGroupAcknowledgment), + string(TrackingRecordTypeEdifactInterchange), + string(TrackingRecordTypeEdifactInterchangeAcknowledgment), + string(TrackingRecordTypeEdifactTransactionSet), + string(TrackingRecordTypeEdifactTransactionSetAcknowledgment), + string(TrackingRecordTypeNotSpecified), + string(TrackingRecordTypeXOneTwoFunctionalGroup), + string(TrackingRecordTypeXOneTwoFunctionalGroupAcknowledgment), + string(TrackingRecordTypeXOneTwoInterchange), + string(TrackingRecordTypeXOneTwoInterchangeAcknowledgment), + string(TrackingRecordTypeXOneTwoTransactionSet), + string(TrackingRecordTypeXOneTwoTransactionSetAcknowledgment), + } +} + +func parseTrackingRecordType(input string) (*TrackingRecordType, error) { + vals := map[string]TrackingRecordType{ + "as2mdn": TrackingRecordTypeASTwoMDN, + "as2message": TrackingRecordTypeASTwoMessage, + "custom": TrackingRecordTypeCustom, + "edifactfunctionalgroup": TrackingRecordTypeEdifactFunctionalGroup, + "edifactfunctionalgroupacknowledgment": TrackingRecordTypeEdifactFunctionalGroupAcknowledgment, + "edifactinterchange": TrackingRecordTypeEdifactInterchange, + "edifactinterchangeacknowledgment": TrackingRecordTypeEdifactInterchangeAcknowledgment, + "edifacttransactionset": TrackingRecordTypeEdifactTransactionSet, + "edifacttransactionsetacknowledgment": TrackingRecordTypeEdifactTransactionSetAcknowledgment, + "notspecified": TrackingRecordTypeNotSpecified, + "x12functionalgroup": TrackingRecordTypeXOneTwoFunctionalGroup, + "x12functionalgroupacknowledgment": TrackingRecordTypeXOneTwoFunctionalGroupAcknowledgment, + "x12interchange": TrackingRecordTypeXOneTwoInterchange, + "x12interchangeacknowledgment": TrackingRecordTypeXOneTwoInterchangeAcknowledgment, + "x12transactionset": TrackingRecordTypeXOneTwoTransactionSet, + "x12transactionsetacknowledgment": TrackingRecordTypeXOneTwoTransactionSetAcknowledgment, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TrackingRecordType(input) + return &out, nil +} + +type WorkflowState string + +const ( + WorkflowStateCompleted WorkflowState = "Completed" + WorkflowStateDeleted WorkflowState = "Deleted" + WorkflowStateDisabled WorkflowState = "Disabled" + WorkflowStateEnabled WorkflowState = "Enabled" + WorkflowStateNotSpecified WorkflowState = "NotSpecified" + WorkflowStateSuspended WorkflowState = "Suspended" +) + +func PossibleValuesForWorkflowState() []string { + return []string{ + string(WorkflowStateCompleted), + string(WorkflowStateDeleted), + string(WorkflowStateDisabled), + string(WorkflowStateEnabled), + string(WorkflowStateNotSpecified), + string(WorkflowStateSuspended), + } +} + +func parseWorkflowState(input string) (*WorkflowState, error) { + vals := map[string]WorkflowState{ + "completed": WorkflowStateCompleted, + "deleted": WorkflowStateDeleted, + "disabled": WorkflowStateDisabled, + "enabled": WorkflowStateEnabled, + "notspecified": WorkflowStateNotSpecified, + "suspended": WorkflowStateSuspended, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkflowState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/id_integrationaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/id_integrationaccount.go new file mode 100644 index 000000000000..e323ae97a23e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/id_integrationaccount.go @@ -0,0 +1,124 @@ +package integrationaccounts + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = IntegrationAccountId{} + +// IntegrationAccountId is a struct representing the Resource ID for a Integration Account +type IntegrationAccountId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string +} + +// NewIntegrationAccountID returns a new IntegrationAccountId struct +func NewIntegrationAccountID(subscriptionId string, resourceGroupName string, integrationAccountName string) IntegrationAccountId { + return IntegrationAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + } +} + +// ParseIntegrationAccountID parses 'input' into a IntegrationAccountId +func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseIntegrationAccountIDInsensitively parses 'input' case-insensitively into a IntegrationAccountId +// note: this method should only be used for API response data and not user input +func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID +func ValidateIntegrationAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseIntegrationAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Integration Account ID +func (id IntegrationAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Integration Account ID +func (id IntegrationAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + } +} + +// String returns a human-readable description of this Integration Account ID +func (id IntegrationAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + } + return fmt.Sprintf("Integration Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_createorupdate_autorest.go new file mode 100644 index 000000000000..41439c525f02 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package integrationaccounts + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccount +} + +// CreateOrUpdate ... +func (c IntegrationAccountsClient) CreateOrUpdate(ctx context.Context, id IntegrationAccountId, input IntegrationAccount) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c IntegrationAccountsClient) preparerForCreateOrUpdate(ctx context.Context, id IntegrationAccountId, input IntegrationAccount) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c IntegrationAccountsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_delete_autorest.go new file mode 100644 index 000000000000..321d37549327 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_delete_autorest.go @@ -0,0 +1,66 @@ +package integrationaccounts + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c IntegrationAccountsClient) Delete(ctx context.Context, id IntegrationAccountId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c IntegrationAccountsClient) preparerForDelete(ctx context.Context, id IntegrationAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c IntegrationAccountsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_get_autorest.go new file mode 100644 index 000000000000..36785c60689c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_get_autorest.go @@ -0,0 +1,68 @@ +package integrationaccounts + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccount +} + +// Get ... +func (c IntegrationAccountsClient) Get(ctx context.Context, id IntegrationAccountId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c IntegrationAccountsClient) preparerForGet(ctx context.Context, id IntegrationAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c IntegrationAccountsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..bfe807683bde --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_listbyresourcegroup_autorest.go @@ -0,0 +1,216 @@ +package integrationaccounts + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]IntegrationAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []IntegrationAccount +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByResourceGroupOperationOptions struct { + Top *int64 +} + +func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { + return ListByResourceGroupOperationOptions{} +} + +func (o ListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListByResourceGroup ... +func (c IntegrationAccountsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c IntegrationAccountsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Logic/integrationAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c IntegrationAccountsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c IntegrationAccountsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []IntegrationAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c IntegrationAccountsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, IntegrationAccountOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c IntegrationAccountsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate IntegrationAccountOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]IntegrationAccount, 0) + + page, err := c.ListByResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_listbysubscription_autorest.go new file mode 100644 index 000000000000..0968ac9bf4dd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_listbysubscription_autorest.go @@ -0,0 +1,216 @@ +package integrationaccounts + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]IntegrationAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []IntegrationAccount +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListBySubscriptionOperationOptions struct { + Top *int64 +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListBySubscription ... +func (c IntegrationAccountsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c IntegrationAccountsClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Logic/integrationAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c IntegrationAccountsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c IntegrationAccountsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []IntegrationAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c IntegrationAccountsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, IntegrationAccountOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c IntegrationAccountsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions, predicate IntegrationAccountOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]IntegrationAccount, 0) + + page, err := c.ListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_listcallbackurl_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_listcallbackurl_autorest.go new file mode 100644 index 000000000000..b49580e64d50 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_listcallbackurl_autorest.go @@ -0,0 +1,70 @@ +package integrationaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListCallbackUrlOperationResponse struct { + HttpResponse *http.Response + Model *CallbackUrl +} + +// ListCallbackUrl ... +func (c IntegrationAccountsClient) ListCallbackUrl(ctx context.Context, id IntegrationAccountId, input GetCallbackUrlParameters) (result ListCallbackUrlOperationResponse, err error) { + req, err := c.preparerForListCallbackUrl(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListCallbackUrl", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListCallbackUrl", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListCallbackUrl(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListCallbackUrl", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListCallbackUrl prepares the ListCallbackUrl request. +func (c IntegrationAccountsClient) preparerForListCallbackUrl(ctx context.Context, id IntegrationAccountId, input GetCallbackUrlParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listCallbackUrl", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListCallbackUrl handles the response to the ListCallbackUrl request. The method always +// closes the http.Response Body. +func (c IntegrationAccountsClient) responderForListCallbackUrl(resp *http.Response) (result ListCallbackUrlOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_listkeyvaultkeys_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_listkeyvaultkeys_autorest.go new file mode 100644 index 000000000000..4a06f34c7fc8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_listkeyvaultkeys_autorest.go @@ -0,0 +1,70 @@ +package integrationaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeyVaultKeysOperationResponse struct { + HttpResponse *http.Response + Model *KeyVaultKeyCollection +} + +// ListKeyVaultKeys ... +func (c IntegrationAccountsClient) ListKeyVaultKeys(ctx context.Context, id IntegrationAccountId, input ListKeyVaultKeysDefinition) (result ListKeyVaultKeysOperationResponse, err error) { + req, err := c.preparerForListKeyVaultKeys(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListKeyVaultKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListKeyVaultKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListKeyVaultKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "ListKeyVaultKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListKeyVaultKeys prepares the ListKeyVaultKeys request. +func (c IntegrationAccountsClient) preparerForListKeyVaultKeys(ctx context.Context, id IntegrationAccountId, input ListKeyVaultKeysDefinition) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeyVaultKeys", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListKeyVaultKeys handles the response to the ListKeyVaultKeys request. The method always +// closes the http.Response Body. +func (c IntegrationAccountsClient) responderForListKeyVaultKeys(resp *http.Response) (result ListKeyVaultKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_logtrackingevents_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_logtrackingevents_autorest.go new file mode 100644 index 000000000000..5960fcd8a253 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_logtrackingevents_autorest.go @@ -0,0 +1,68 @@ +package integrationaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogTrackingEventsOperationResponse struct { + HttpResponse *http.Response +} + +// LogTrackingEvents ... +func (c IntegrationAccountsClient) LogTrackingEvents(ctx context.Context, id IntegrationAccountId, input TrackingEventsDefinition) (result LogTrackingEventsOperationResponse, err error) { + req, err := c.preparerForLogTrackingEvents(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "LogTrackingEvents", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "LogTrackingEvents", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForLogTrackingEvents(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "LogTrackingEvents", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForLogTrackingEvents prepares the LogTrackingEvents request. +func (c IntegrationAccountsClient) preparerForLogTrackingEvents(ctx context.Context, id IntegrationAccountId, input TrackingEventsDefinition) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/logTrackingEvents", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForLogTrackingEvents handles the response to the LogTrackingEvents request. The method always +// closes the http.Response Body. +func (c IntegrationAccountsClient) responderForLogTrackingEvents(resp *http.Response) (result LogTrackingEventsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_regenerateaccesskey_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_regenerateaccesskey_autorest.go new file mode 100644 index 000000000000..412971cbc35d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_regenerateaccesskey_autorest.go @@ -0,0 +1,70 @@ +package integrationaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateAccessKeyOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccount +} + +// RegenerateAccessKey ... +func (c IntegrationAccountsClient) RegenerateAccessKey(ctx context.Context, id IntegrationAccountId, input RegenerateActionParameter) (result RegenerateAccessKeyOperationResponse, err error) { + req, err := c.preparerForRegenerateAccessKey(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "RegenerateAccessKey", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "RegenerateAccessKey", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRegenerateAccessKey(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "RegenerateAccessKey", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRegenerateAccessKey prepares the RegenerateAccessKey request. +func (c IntegrationAccountsClient) preparerForRegenerateAccessKey(ctx context.Context, id IntegrationAccountId, input RegenerateActionParameter) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateAccessKey", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRegenerateAccessKey handles the response to the RegenerateAccessKey request. The method always +// closes the http.Response Body. +func (c IntegrationAccountsClient) responderForRegenerateAccessKey(resp *http.Response) (result RegenerateAccessKeyOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_update_autorest.go new file mode 100644 index 000000000000..07c837f609e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/method_update_autorest.go @@ -0,0 +1,69 @@ +package integrationaccounts + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccount +} + +// Update ... +func (c IntegrationAccountsClient) Update(ctx context.Context, id IntegrationAccountId, input IntegrationAccount) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccounts.IntegrationAccountsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c IntegrationAccountsClient) preparerForUpdate(ctx context.Context, id IntegrationAccountId, input IntegrationAccount) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c IntegrationAccountsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_callbackurl.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_callbackurl.go new file mode 100644 index 000000000000..3e1767321aa3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_callbackurl.go @@ -0,0 +1,8 @@ +package integrationaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CallbackUrl struct { + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_getcallbackurlparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_getcallbackurlparameters.go new file mode 100644 index 000000000000..1bc7b988576a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_getcallbackurlparameters.go @@ -0,0 +1,27 @@ +package integrationaccounts + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetCallbackUrlParameters struct { + KeyType *KeyType `json:"keyType,omitempty"` + NotAfter *string `json:"notAfter,omitempty"` +} + +func (o *GetCallbackUrlParameters) GetNotAfterAsTime() (*time.Time, error) { + if o.NotAfter == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NotAfter, "2006-01-02T15:04:05Z07:00") +} + +func (o *GetCallbackUrlParameters) SetNotAfterAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NotAfter = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_integrationaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_integrationaccount.go new file mode 100644 index 000000000000..276c11848504 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_integrationaccount.go @@ -0,0 +1,14 @@ +package integrationaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccount struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *IntegrationAccountProperties `json:"properties,omitempty"` + Sku *IntegrationAccountSku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_integrationaccountproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_integrationaccountproperties.go new file mode 100644 index 000000000000..d07deca3d843 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_integrationaccountproperties.go @@ -0,0 +1,9 @@ +package integrationaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountProperties struct { + IntegrationServiceEnvironment *ResourceReference `json:"integrationServiceEnvironment,omitempty"` + State *WorkflowState `json:"state,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_integrationaccountsku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_integrationaccountsku.go new file mode 100644 index 000000000000..9a0b8b53dfbb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_integrationaccountsku.go @@ -0,0 +1,8 @@ +package integrationaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountSku struct { + Name IntegrationAccountSkuName `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_keyvaultkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_keyvaultkey.go new file mode 100644 index 000000000000..38874020d8c4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_keyvaultkey.go @@ -0,0 +1,9 @@ +package integrationaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultKey struct { + Attributes *KeyVaultKeyAttributes `json:"attributes,omitempty"` + Kid *string `json:"kid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_keyvaultkeyattributes.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_keyvaultkeyattributes.go new file mode 100644 index 000000000000..a16539dface0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_keyvaultkeyattributes.go @@ -0,0 +1,10 @@ +package integrationaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultKeyAttributes struct { + Created *int64 `json:"created,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Updated *int64 `json:"updated,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_keyvaultkeycollection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_keyvaultkeycollection.go new file mode 100644 index 000000000000..a1200b1766b9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_keyvaultkeycollection.go @@ -0,0 +1,9 @@ +package integrationaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultKeyCollection struct { + SkipToken *string `json:"skipToken,omitempty"` + Value *[]KeyVaultKey `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_keyvaultreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_keyvaultreference.go new file mode 100644 index 000000000000..bf68e6626886 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_keyvaultreference.go @@ -0,0 +1,10 @@ +package integrationaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultReference struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_listkeyvaultkeysdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_listkeyvaultkeysdefinition.go new file mode 100644 index 000000000000..6bd16b92249c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_listkeyvaultkeysdefinition.go @@ -0,0 +1,9 @@ +package integrationaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeyVaultKeysDefinition struct { + KeyVault KeyVaultReference `json:"keyVault"` + SkipToken *string `json:"skipToken,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_regenerateactionparameter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_regenerateactionparameter.go new file mode 100644 index 000000000000..d9fe07a539bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_regenerateactionparameter.go @@ -0,0 +1,8 @@ +package integrationaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateActionParameter struct { + KeyType *KeyType `json:"keyType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_resourcereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_resourcereference.go new file mode 100644 index 000000000000..8f8c6e3c54e0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_resourcereference.go @@ -0,0 +1,10 @@ +package integrationaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceReference struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_trackingevent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_trackingevent.go new file mode 100644 index 000000000000..61de64289b3f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_trackingevent.go @@ -0,0 +1,27 @@ +package integrationaccounts + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TrackingEvent struct { + Error *TrackingEventErrorInfo `json:"error,omitempty"` + EventLevel EventLevel `json:"eventLevel"` + EventTime string `json:"eventTime"` + Record *interface{} `json:"record,omitempty"` + RecordType TrackingRecordType `json:"recordType"` +} + +func (o *TrackingEvent) GetEventTimeAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.EventTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *TrackingEvent) SetEventTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EventTime = formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_trackingeventerrorinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_trackingeventerrorinfo.go new file mode 100644 index 000000000000..9f0769f538bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_trackingeventerrorinfo.go @@ -0,0 +1,9 @@ +package integrationaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TrackingEventErrorInfo struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_trackingeventsdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_trackingeventsdefinition.go new file mode 100644 index 000000000000..a93215976f47 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/model_trackingeventsdefinition.go @@ -0,0 +1,10 @@ +package integrationaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TrackingEventsDefinition struct { + Events []TrackingEvent `json:"events"` + SourceType string `json:"sourceType"` + TrackEventsOptions *TrackEventsOperationOptions `json:"trackEventsOptions,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/predicates.go new file mode 100644 index 000000000000..39c8e826856f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/predicates.go @@ -0,0 +1,29 @@ +package integrationaccounts + +type IntegrationAccountOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p IntegrationAccountOperationPredicate) Matches(input IntegrationAccount) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/version.go new file mode 100644 index 000000000000..e7e61e35e6da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts/version.go @@ -0,0 +1,12 @@ +package integrationaccounts + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/integrationaccounts/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/README.md new file mode 100644 index 000000000000..6b246446c4eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas` Documentation + +The `integrationaccountschemas` SDK allows for interaction with the Azure Resource Manager Service `logic` (API Version `2019-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas" +``` + + +### Client Initialization + +```go +client := integrationaccountschemas.NewIntegrationAccountSchemasClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `IntegrationAccountSchemasClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := integrationaccountschemas.NewSchemaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "schemaValue") + +payload := integrationaccountschemas.IntegrationAccountSchema{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountSchemasClient.Delete` + +```go +ctx := context.TODO() +id := integrationaccountschemas.NewSchemaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "schemaValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountSchemasClient.Get` + +```go +ctx := context.TODO() +id := integrationaccountschemas.NewSchemaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "schemaValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountSchemasClient.List` + +```go +ctx := context.TODO() +id := integrationaccountschemas.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +// alternatively `client.List(ctx, id, integrationaccountschemas.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, integrationaccountschemas.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `IntegrationAccountSchemasClient.ListContentCallbackUrl` + +```go +ctx := context.TODO() +id := integrationaccountschemas.NewSchemaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "schemaValue") + +payload := integrationaccountschemas.GetCallbackUrlParameters{ + // ... +} + + +read, err := client.ListContentCallbackUrl(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/client.go new file mode 100644 index 000000000000..9e92a1614ed0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/client.go @@ -0,0 +1,18 @@ +package integrationaccountschemas + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountSchemasClient struct { + Client autorest.Client + baseUri string +} + +func NewIntegrationAccountSchemasClientWithBaseURI(endpoint string) IntegrationAccountSchemasClient { + return IntegrationAccountSchemasClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/constants.go new file mode 100644 index 000000000000..094b9f3491f3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/constants.go @@ -0,0 +1,65 @@ +package integrationaccountschemas + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyType string + +const ( + KeyTypeNotSpecified KeyType = "NotSpecified" + KeyTypePrimary KeyType = "Primary" + KeyTypeSecondary KeyType = "Secondary" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypeNotSpecified), + string(KeyTypePrimary), + string(KeyTypeSecondary), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "notspecified": KeyTypeNotSpecified, + "primary": KeyTypePrimary, + "secondary": KeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} + +type SchemaType string + +const ( + SchemaTypeNotSpecified SchemaType = "NotSpecified" + SchemaTypeXml SchemaType = "Xml" +) + +func PossibleValuesForSchemaType() []string { + return []string{ + string(SchemaTypeNotSpecified), + string(SchemaTypeXml), + } +} + +func parseSchemaType(input string) (*SchemaType, error) { + vals := map[string]SchemaType{ + "notspecified": SchemaTypeNotSpecified, + "xml": SchemaTypeXml, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SchemaType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/id_integrationaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/id_integrationaccount.go new file mode 100644 index 000000000000..5cda0b4254d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/id_integrationaccount.go @@ -0,0 +1,124 @@ +package integrationaccountschemas + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = IntegrationAccountId{} + +// IntegrationAccountId is a struct representing the Resource ID for a Integration Account +type IntegrationAccountId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string +} + +// NewIntegrationAccountID returns a new IntegrationAccountId struct +func NewIntegrationAccountID(subscriptionId string, resourceGroupName string, integrationAccountName string) IntegrationAccountId { + return IntegrationAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + } +} + +// ParseIntegrationAccountID parses 'input' into a IntegrationAccountId +func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseIntegrationAccountIDInsensitively parses 'input' case-insensitively into a IntegrationAccountId +// note: this method should only be used for API response data and not user input +func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID +func ValidateIntegrationAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseIntegrationAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Integration Account ID +func (id IntegrationAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Integration Account ID +func (id IntegrationAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + } +} + +// String returns a human-readable description of this Integration Account ID +func (id IntegrationAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + } + return fmt.Sprintf("Integration Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/id_schema.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/id_schema.go new file mode 100644 index 000000000000..8dad5ddb39fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/id_schema.go @@ -0,0 +1,137 @@ +package integrationaccountschemas + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SchemaId{} + +// SchemaId is a struct representing the Resource ID for a Schema +type SchemaId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string + SchemaName string +} + +// NewSchemaID returns a new SchemaId struct +func NewSchemaID(subscriptionId string, resourceGroupName string, integrationAccountName string, schemaName string) SchemaId { + return SchemaId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + SchemaName: schemaName, + } +} + +// ParseSchemaID parses 'input' into a SchemaId +func ParseSchemaID(input string) (*SchemaId, error) { + parser := resourceids.NewParserFromResourceIdType(SchemaId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SchemaId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { + return nil, fmt.Errorf("the segment 'schemaName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSchemaIDInsensitively parses 'input' case-insensitively into a SchemaId +// note: this method should only be used for API response data and not user input +func ParseSchemaIDInsensitively(input string) (*SchemaId, error) { + parser := resourceids.NewParserFromResourceIdType(SchemaId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SchemaId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { + return nil, fmt.Errorf("the segment 'schemaName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSchemaID checks that 'input' can be parsed as a Schema ID +func ValidateSchemaID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSchemaID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Schema ID +func (id SchemaId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/schemas/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName, id.SchemaName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Schema ID +func (id SchemaId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + resourceids.StaticSegment("staticSchemas", "schemas", "schemas"), + resourceids.UserSpecifiedSegment("schemaName", "schemaValue"), + } +} + +// String returns a human-readable description of this Schema ID +func (id SchemaId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + fmt.Sprintf("Schema Name: %q", id.SchemaName), + } + return fmt.Sprintf("Schema (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/method_createorupdate_autorest.go new file mode 100644 index 000000000000..408a5ac3c5f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package integrationaccountschemas + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccountSchema +} + +// CreateOrUpdate ... +func (c IntegrationAccountSchemasClient) CreateOrUpdate(ctx context.Context, id SchemaId, input IntegrationAccountSchema) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c IntegrationAccountSchemasClient) preparerForCreateOrUpdate(ctx context.Context, id SchemaId, input IntegrationAccountSchema) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c IntegrationAccountSchemasClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/method_delete_autorest.go new file mode 100644 index 000000000000..24064e7de55a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/method_delete_autorest.go @@ -0,0 +1,66 @@ +package integrationaccountschemas + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c IntegrationAccountSchemasClient) Delete(ctx context.Context, id SchemaId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c IntegrationAccountSchemasClient) preparerForDelete(ctx context.Context, id SchemaId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c IntegrationAccountSchemasClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/method_get_autorest.go new file mode 100644 index 000000000000..559561bbb7ac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/method_get_autorest.go @@ -0,0 +1,68 @@ +package integrationaccountschemas + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccountSchema +} + +// Get ... +func (c IntegrationAccountSchemasClient) Get(ctx context.Context, id SchemaId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c IntegrationAccountSchemasClient) preparerForGet(ctx context.Context, id SchemaId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c IntegrationAccountSchemasClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/method_list_autorest.go new file mode 100644 index 000000000000..73ce2299c348 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/method_list_autorest.go @@ -0,0 +1,220 @@ +package integrationaccountschemas + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]IntegrationAccountSchema + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []IntegrationAccountSchema +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Filter *string + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c IntegrationAccountSchemasClient) List(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c IntegrationAccountSchemasClient) preparerForList(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/schemas", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c IntegrationAccountSchemasClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c IntegrationAccountSchemasClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []IntegrationAccountSchema `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c IntegrationAccountSchemasClient) ListComplete(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, IntegrationAccountSchemaOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c IntegrationAccountSchemasClient) ListCompleteMatchingPredicate(ctx context.Context, id IntegrationAccountId, options ListOperationOptions, predicate IntegrationAccountSchemaOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]IntegrationAccountSchema, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/method_listcontentcallbackurl_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/method_listcontentcallbackurl_autorest.go new file mode 100644 index 000000000000..096f121c83f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/method_listcontentcallbackurl_autorest.go @@ -0,0 +1,70 @@ +package integrationaccountschemas + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListContentCallbackUrlOperationResponse struct { + HttpResponse *http.Response + Model *WorkflowTriggerCallbackUrl +} + +// ListContentCallbackUrl ... +func (c IntegrationAccountSchemasClient) ListContentCallbackUrl(ctx context.Context, id SchemaId, input GetCallbackUrlParameters) (result ListContentCallbackUrlOperationResponse, err error) { + req, err := c.preparerForListContentCallbackUrl(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "ListContentCallbackUrl", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "ListContentCallbackUrl", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListContentCallbackUrl(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountschemas.IntegrationAccountSchemasClient", "ListContentCallbackUrl", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListContentCallbackUrl prepares the ListContentCallbackUrl request. +func (c IntegrationAccountSchemasClient) preparerForListContentCallbackUrl(ctx context.Context, id SchemaId, input GetCallbackUrlParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listContentCallbackUrl", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListContentCallbackUrl handles the response to the ListContentCallbackUrl request. The method always +// closes the http.Response Body. +func (c IntegrationAccountSchemasClient) responderForListContentCallbackUrl(resp *http.Response) (result ListContentCallbackUrlOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_contenthash.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_contenthash.go new file mode 100644 index 000000000000..e8b9a267ead5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_contenthash.go @@ -0,0 +1,9 @@ +package integrationaccountschemas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentHash struct { + Algorithm *string `json:"algorithm,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_contentlink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_contentlink.go new file mode 100644 index 000000000000..2d637d03ecd7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_contentlink.go @@ -0,0 +1,12 @@ +package integrationaccountschemas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentLink struct { + ContentHash *ContentHash `json:"contentHash,omitempty"` + ContentSize *int64 `json:"contentSize,omitempty"` + ContentVersion *string `json:"contentVersion,omitempty"` + Metadata *interface{} `json:"metadata,omitempty"` + Uri *string `json:"uri,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_getcallbackurlparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_getcallbackurlparameters.go new file mode 100644 index 000000000000..4e4b75dd9b43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_getcallbackurlparameters.go @@ -0,0 +1,27 @@ +package integrationaccountschemas + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetCallbackUrlParameters struct { + KeyType *KeyType `json:"keyType,omitempty"` + NotAfter *string `json:"notAfter,omitempty"` +} + +func (o *GetCallbackUrlParameters) GetNotAfterAsTime() (*time.Time, error) { + if o.NotAfter == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NotAfter, "2006-01-02T15:04:05Z07:00") +} + +func (o *GetCallbackUrlParameters) SetNotAfterAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NotAfter = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_integrationaccountschema.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_integrationaccountschema.go new file mode 100644 index 000000000000..a7a568adfd82 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_integrationaccountschema.go @@ -0,0 +1,13 @@ +package integrationaccountschemas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountSchema struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties IntegrationAccountSchemaProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_integrationaccountschemaproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_integrationaccountschemaproperties.go new file mode 100644 index 000000000000..25e1acb00812 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_integrationaccountschemaproperties.go @@ -0,0 +1,47 @@ +package integrationaccountschemas + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountSchemaProperties struct { + ChangedTime *string `json:"changedTime,omitempty"` + Content *string `json:"content,omitempty"` + ContentLink *ContentLink `json:"contentLink,omitempty"` + ContentType *string `json:"contentType,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` + DocumentName *string `json:"documentName,omitempty"` + FileName *string `json:"fileName,omitempty"` + Metadata *interface{} `json:"metadata,omitempty"` + SchemaType SchemaType `json:"schemaType"` + TargetNamespace *string `json:"targetNamespace,omitempty"` +} + +func (o *IntegrationAccountSchemaProperties) GetChangedTimeAsTime() (*time.Time, error) { + if o.ChangedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ChangedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *IntegrationAccountSchemaProperties) SetChangedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ChangedTime = &formatted +} + +func (o *IntegrationAccountSchemaProperties) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *IntegrationAccountSchemaProperties) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_workflowtriggercallbackurl.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_workflowtriggercallbackurl.go new file mode 100644 index 000000000000..a9f9a98cd796 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_workflowtriggercallbackurl.go @@ -0,0 +1,13 @@ +package integrationaccountschemas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerCallbackUrl struct { + BasePath *string `json:"basePath,omitempty"` + Method *string `json:"method,omitempty"` + Queries *WorkflowTriggerListCallbackUrlQueries `json:"queries,omitempty"` + RelativePath *string `json:"relativePath,omitempty"` + RelativePathParameters *[]string `json:"relativePathParameters,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_workflowtriggerlistcallbackurlqueries.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_workflowtriggerlistcallbackurlqueries.go new file mode 100644 index 000000000000..19504960051a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/model_workflowtriggerlistcallbackurlqueries.go @@ -0,0 +1,12 @@ +package integrationaccountschemas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerListCallbackUrlQueries struct { + ApiVersion *string `json:"api-version,omitempty"` + Se *string `json:"se,omitempty"` + Sig *string `json:"sig,omitempty"` + Sp *string `json:"sp,omitempty"` + Sv *string `json:"sv,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/predicates.go new file mode 100644 index 000000000000..218b6a645da7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/predicates.go @@ -0,0 +1,29 @@ +package integrationaccountschemas + +type IntegrationAccountSchemaOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p IntegrationAccountSchemaOperationPredicate) Matches(input IntegrationAccountSchema) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/version.go new file mode 100644 index 000000000000..5aa266b3ac17 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas/version.go @@ -0,0 +1,12 @@ +package integrationaccountschemas + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/integrationaccountschemas/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/README.md new file mode 100644 index 000000000000..e00cd5b6fbce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions` Documentation + +The `integrationaccountsessions` SDK allows for interaction with the Azure Resource Manager Service `logic` (API Version `2019-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions" +``` + + +### Client Initialization + +```go +client := integrationaccountsessions.NewIntegrationAccountSessionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `IntegrationAccountSessionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := integrationaccountsessions.NewSessionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "sessionValue") + +payload := integrationaccountsessions.IntegrationAccountSession{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountSessionsClient.Delete` + +```go +ctx := context.TODO() +id := integrationaccountsessions.NewSessionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "sessionValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountSessionsClient.Get` + +```go +ctx := context.TODO() +id := integrationaccountsessions.NewSessionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue", "sessionValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationAccountSessionsClient.List` + +```go +ctx := context.TODO() +id := integrationaccountsessions.NewIntegrationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationAccountValue") + +// alternatively `client.List(ctx, id, integrationaccountsessions.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, integrationaccountsessions.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/client.go new file mode 100644 index 000000000000..5c691a90ea66 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/client.go @@ -0,0 +1,18 @@ +package integrationaccountsessions + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountSessionsClient struct { + Client autorest.Client + baseUri string +} + +func NewIntegrationAccountSessionsClientWithBaseURI(endpoint string) IntegrationAccountSessionsClient { + return IntegrationAccountSessionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/id_integrationaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/id_integrationaccount.go new file mode 100644 index 000000000000..6d684a719192 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/id_integrationaccount.go @@ -0,0 +1,124 @@ +package integrationaccountsessions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = IntegrationAccountId{} + +// IntegrationAccountId is a struct representing the Resource ID for a Integration Account +type IntegrationAccountId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string +} + +// NewIntegrationAccountID returns a new IntegrationAccountId struct +func NewIntegrationAccountID(subscriptionId string, resourceGroupName string, integrationAccountName string) IntegrationAccountId { + return IntegrationAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + } +} + +// ParseIntegrationAccountID parses 'input' into a IntegrationAccountId +func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseIntegrationAccountIDInsensitively parses 'input' case-insensitively into a IntegrationAccountId +// note: this method should only be used for API response data and not user input +func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID +func ValidateIntegrationAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseIntegrationAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Integration Account ID +func (id IntegrationAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Integration Account ID +func (id IntegrationAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + } +} + +// String returns a human-readable description of this Integration Account ID +func (id IntegrationAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + } + return fmt.Sprintf("Integration Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/id_session.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/id_session.go new file mode 100644 index 000000000000..c7dbd512386b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/id_session.go @@ -0,0 +1,137 @@ +package integrationaccountsessions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SessionId{} + +// SessionId is a struct representing the Resource ID for a Session +type SessionId struct { + SubscriptionId string + ResourceGroupName string + IntegrationAccountName string + SessionName string +} + +// NewSessionID returns a new SessionId struct +func NewSessionID(subscriptionId string, resourceGroupName string, integrationAccountName string, sessionName string) SessionId { + return SessionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + IntegrationAccountName: integrationAccountName, + SessionName: sessionName, + } +} + +// ParseSessionID parses 'input' into a SessionId +func ParseSessionID(input string) (*SessionId, error) { + parser := resourceids.NewParserFromResourceIdType(SessionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SessionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.SessionName, ok = parsed.Parsed["sessionName"]; !ok { + return nil, fmt.Errorf("the segment 'sessionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSessionIDInsensitively parses 'input' case-insensitively into a SessionId +// note: this method should only be used for API response data and not user input +func ParseSessionIDInsensitively(input string) (*SessionId, error) { + parser := resourceids.NewParserFromResourceIdType(SessionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SessionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationAccountName' was not found in the resource id %q", input) + } + + if id.SessionName, ok = parsed.Parsed["sessionName"]; !ok { + return nil, fmt.Errorf("the segment 'sessionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSessionID checks that 'input' can be parsed as a Session ID +func ValidateSessionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSessionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Session ID +func (id SessionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationAccounts/%s/sessions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.IntegrationAccountName, id.SessionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Session ID +func (id SessionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationAccounts", "integrationAccounts", "integrationAccounts"), + resourceids.UserSpecifiedSegment("integrationAccountName", "integrationAccountValue"), + resourceids.StaticSegment("staticSessions", "sessions", "sessions"), + resourceids.UserSpecifiedSegment("sessionName", "sessionValue"), + } +} + +// String returns a human-readable description of this Session ID +func (id SessionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Integration Account Name: %q", id.IntegrationAccountName), + fmt.Sprintf("Session Name: %q", id.SessionName), + } + return fmt.Sprintf("Session (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/method_createorupdate_autorest.go new file mode 100644 index 000000000000..2f207004d9e8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package integrationaccountsessions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccountSession +} + +// CreateOrUpdate ... +func (c IntegrationAccountSessionsClient) CreateOrUpdate(ctx context.Context, id SessionId, input IntegrationAccountSession) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountsessions.IntegrationAccountSessionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountsessions.IntegrationAccountSessionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountsessions.IntegrationAccountSessionsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c IntegrationAccountSessionsClient) preparerForCreateOrUpdate(ctx context.Context, id SessionId, input IntegrationAccountSession) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c IntegrationAccountSessionsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/method_delete_autorest.go new file mode 100644 index 000000000000..03693506957b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/method_delete_autorest.go @@ -0,0 +1,66 @@ +package integrationaccountsessions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c IntegrationAccountSessionsClient) Delete(ctx context.Context, id SessionId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountsessions.IntegrationAccountSessionsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountsessions.IntegrationAccountSessionsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountsessions.IntegrationAccountSessionsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c IntegrationAccountSessionsClient) preparerForDelete(ctx context.Context, id SessionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c IntegrationAccountSessionsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/method_get_autorest.go new file mode 100644 index 000000000000..ac9e1ba9a25b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/method_get_autorest.go @@ -0,0 +1,68 @@ +package integrationaccountsessions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationAccountSession +} + +// Get ... +func (c IntegrationAccountSessionsClient) Get(ctx context.Context, id SessionId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountsessions.IntegrationAccountSessionsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountsessions.IntegrationAccountSessionsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountsessions.IntegrationAccountSessionsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c IntegrationAccountSessionsClient) preparerForGet(ctx context.Context, id SessionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c IntegrationAccountSessionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/method_list_autorest.go new file mode 100644 index 000000000000..3b87ce237f28 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/method_list_autorest.go @@ -0,0 +1,220 @@ +package integrationaccountsessions + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]IntegrationAccountSession + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []IntegrationAccountSession +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Filter *string + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c IntegrationAccountSessionsClient) List(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountsessions.IntegrationAccountSessionsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountsessions.IntegrationAccountSessionsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountsessions.IntegrationAccountSessionsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c IntegrationAccountSessionsClient) preparerForList(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/sessions", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c IntegrationAccountSessionsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c IntegrationAccountSessionsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []IntegrationAccountSession `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountsessions.IntegrationAccountSessionsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountsessions.IntegrationAccountSessionsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationaccountsessions.IntegrationAccountSessionsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c IntegrationAccountSessionsClient) ListComplete(ctx context.Context, id IntegrationAccountId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, IntegrationAccountSessionOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c IntegrationAccountSessionsClient) ListCompleteMatchingPredicate(ctx context.Context, id IntegrationAccountId, options ListOperationOptions, predicate IntegrationAccountSessionOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]IntegrationAccountSession, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/model_integrationaccountsession.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/model_integrationaccountsession.go new file mode 100644 index 000000000000..15723868d8ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/model_integrationaccountsession.go @@ -0,0 +1,13 @@ +package integrationaccountsessions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountSession struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties IntegrationAccountSessionProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/model_integrationaccountsessionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/model_integrationaccountsessionproperties.go new file mode 100644 index 000000000000..3b6bc3194cf5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/model_integrationaccountsessionproperties.go @@ -0,0 +1,40 @@ +package integrationaccountsessions + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationAccountSessionProperties struct { + ChangedTime *string `json:"changedTime,omitempty"` + Content *interface{} `json:"content,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` +} + +func (o *IntegrationAccountSessionProperties) GetChangedTimeAsTime() (*time.Time, error) { + if o.ChangedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ChangedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *IntegrationAccountSessionProperties) SetChangedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ChangedTime = &formatted +} + +func (o *IntegrationAccountSessionProperties) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *IntegrationAccountSessionProperties) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/predicates.go new file mode 100644 index 000000000000..8e70e42c7f9c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/predicates.go @@ -0,0 +1,29 @@ +package integrationaccountsessions + +type IntegrationAccountSessionOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p IntegrationAccountSessionOperationPredicate) Matches(input IntegrationAccountSession) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/version.go new file mode 100644 index 000000000000..606685d6c5f3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions/version.go @@ -0,0 +1,12 @@ +package integrationaccountsessions + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/integrationaccountsessions/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/README.md new file mode 100644 index 000000000000..04c9cf7d6cea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/README.md @@ -0,0 +1,120 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments` Documentation + +The `integrationserviceenvironments` SDK allows for interaction with the Azure Resource Manager Service `logic` (API Version `2019-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments" +``` + + +### Client Initialization + +```go +client := integrationserviceenvironments.NewIntegrationServiceEnvironmentsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `IntegrationServiceEnvironmentsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := integrationserviceenvironments.NewIntegrationServiceEnvironmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationServiceEnvironmentValue") + +payload := integrationserviceenvironments.IntegrationServiceEnvironment{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `IntegrationServiceEnvironmentsClient.Delete` + +```go +ctx := context.TODO() +id := integrationserviceenvironments.NewIntegrationServiceEnvironmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationServiceEnvironmentValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationServiceEnvironmentsClient.Get` + +```go +ctx := context.TODO() +id := integrationserviceenvironments.NewIntegrationServiceEnvironmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationServiceEnvironmentValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `IntegrationServiceEnvironmentsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := integrationserviceenvironments.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id, integrationserviceenvironments.DefaultListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id, integrationserviceenvironments.DefaultListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `IntegrationServiceEnvironmentsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := integrationserviceenvironments.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id, integrationserviceenvironments.DefaultListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id, integrationserviceenvironments.DefaultListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `IntegrationServiceEnvironmentsClient.Update` + +```go +ctx := context.TODO() +id := integrationserviceenvironments.NewIntegrationServiceEnvironmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "integrationServiceEnvironmentValue") + +payload := integrationserviceenvironments.IntegrationServiceEnvironment{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/client.go new file mode 100644 index 000000000000..921d0f631b95 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/client.go @@ -0,0 +1,18 @@ +package integrationserviceenvironments + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationServiceEnvironmentsClient struct { + Client autorest.Client + baseUri string +} + +func NewIntegrationServiceEnvironmentsClientWithBaseURI(endpoint string) IntegrationServiceEnvironmentsClient { + return IntegrationServiceEnvironmentsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/constants.go new file mode 100644 index 000000000000..2570ccfd8430 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/constants.go @@ -0,0 +1,196 @@ +package integrationserviceenvironments + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationServiceEnvironmentAccessEndpointType string + +const ( + IntegrationServiceEnvironmentAccessEndpointTypeExternal IntegrationServiceEnvironmentAccessEndpointType = "External" + IntegrationServiceEnvironmentAccessEndpointTypeInternal IntegrationServiceEnvironmentAccessEndpointType = "Internal" + IntegrationServiceEnvironmentAccessEndpointTypeNotSpecified IntegrationServiceEnvironmentAccessEndpointType = "NotSpecified" +) + +func PossibleValuesForIntegrationServiceEnvironmentAccessEndpointType() []string { + return []string{ + string(IntegrationServiceEnvironmentAccessEndpointTypeExternal), + string(IntegrationServiceEnvironmentAccessEndpointTypeInternal), + string(IntegrationServiceEnvironmentAccessEndpointTypeNotSpecified), + } +} + +func parseIntegrationServiceEnvironmentAccessEndpointType(input string) (*IntegrationServiceEnvironmentAccessEndpointType, error) { + vals := map[string]IntegrationServiceEnvironmentAccessEndpointType{ + "external": IntegrationServiceEnvironmentAccessEndpointTypeExternal, + "internal": IntegrationServiceEnvironmentAccessEndpointTypeInternal, + "notspecified": IntegrationServiceEnvironmentAccessEndpointTypeNotSpecified, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IntegrationServiceEnvironmentAccessEndpointType(input) + return &out, nil +} + +type IntegrationServiceEnvironmentSkuName string + +const ( + IntegrationServiceEnvironmentSkuNameDeveloper IntegrationServiceEnvironmentSkuName = "Developer" + IntegrationServiceEnvironmentSkuNameNotSpecified IntegrationServiceEnvironmentSkuName = "NotSpecified" + IntegrationServiceEnvironmentSkuNamePremium IntegrationServiceEnvironmentSkuName = "Premium" +) + +func PossibleValuesForIntegrationServiceEnvironmentSkuName() []string { + return []string{ + string(IntegrationServiceEnvironmentSkuNameDeveloper), + string(IntegrationServiceEnvironmentSkuNameNotSpecified), + string(IntegrationServiceEnvironmentSkuNamePremium), + } +} + +func parseIntegrationServiceEnvironmentSkuName(input string) (*IntegrationServiceEnvironmentSkuName, error) { + vals := map[string]IntegrationServiceEnvironmentSkuName{ + "developer": IntegrationServiceEnvironmentSkuNameDeveloper, + "notspecified": IntegrationServiceEnvironmentSkuNameNotSpecified, + "premium": IntegrationServiceEnvironmentSkuNamePremium, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IntegrationServiceEnvironmentSkuName(input) + return &out, nil +} + +type WorkflowProvisioningState string + +const ( + WorkflowProvisioningStateAccepted WorkflowProvisioningState = "Accepted" + WorkflowProvisioningStateCanceled WorkflowProvisioningState = "Canceled" + WorkflowProvisioningStateCompleted WorkflowProvisioningState = "Completed" + WorkflowProvisioningStateCreated WorkflowProvisioningState = "Created" + WorkflowProvisioningStateCreating WorkflowProvisioningState = "Creating" + WorkflowProvisioningStateDeleted WorkflowProvisioningState = "Deleted" + WorkflowProvisioningStateDeleting WorkflowProvisioningState = "Deleting" + WorkflowProvisioningStateFailed WorkflowProvisioningState = "Failed" + WorkflowProvisioningStateInProgress WorkflowProvisioningState = "InProgress" + WorkflowProvisioningStateMoving WorkflowProvisioningState = "Moving" + WorkflowProvisioningStateNotSpecified WorkflowProvisioningState = "NotSpecified" + WorkflowProvisioningStatePending WorkflowProvisioningState = "Pending" + WorkflowProvisioningStateReady WorkflowProvisioningState = "Ready" + WorkflowProvisioningStateRegistered WorkflowProvisioningState = "Registered" + WorkflowProvisioningStateRegistering WorkflowProvisioningState = "Registering" + WorkflowProvisioningStateRenewing WorkflowProvisioningState = "Renewing" + WorkflowProvisioningStateRunning WorkflowProvisioningState = "Running" + WorkflowProvisioningStateSucceeded WorkflowProvisioningState = "Succeeded" + WorkflowProvisioningStateUnregistered WorkflowProvisioningState = "Unregistered" + WorkflowProvisioningStateUnregistering WorkflowProvisioningState = "Unregistering" + WorkflowProvisioningStateUpdating WorkflowProvisioningState = "Updating" + WorkflowProvisioningStateWaiting WorkflowProvisioningState = "Waiting" +) + +func PossibleValuesForWorkflowProvisioningState() []string { + return []string{ + string(WorkflowProvisioningStateAccepted), + string(WorkflowProvisioningStateCanceled), + string(WorkflowProvisioningStateCompleted), + string(WorkflowProvisioningStateCreated), + string(WorkflowProvisioningStateCreating), + string(WorkflowProvisioningStateDeleted), + string(WorkflowProvisioningStateDeleting), + string(WorkflowProvisioningStateFailed), + string(WorkflowProvisioningStateInProgress), + string(WorkflowProvisioningStateMoving), + string(WorkflowProvisioningStateNotSpecified), + string(WorkflowProvisioningStatePending), + string(WorkflowProvisioningStateReady), + string(WorkflowProvisioningStateRegistered), + string(WorkflowProvisioningStateRegistering), + string(WorkflowProvisioningStateRenewing), + string(WorkflowProvisioningStateRunning), + string(WorkflowProvisioningStateSucceeded), + string(WorkflowProvisioningStateUnregistered), + string(WorkflowProvisioningStateUnregistering), + string(WorkflowProvisioningStateUpdating), + string(WorkflowProvisioningStateWaiting), + } +} + +func parseWorkflowProvisioningState(input string) (*WorkflowProvisioningState, error) { + vals := map[string]WorkflowProvisioningState{ + "accepted": WorkflowProvisioningStateAccepted, + "canceled": WorkflowProvisioningStateCanceled, + "completed": WorkflowProvisioningStateCompleted, + "created": WorkflowProvisioningStateCreated, + "creating": WorkflowProvisioningStateCreating, + "deleted": WorkflowProvisioningStateDeleted, + "deleting": WorkflowProvisioningStateDeleting, + "failed": WorkflowProvisioningStateFailed, + "inprogress": WorkflowProvisioningStateInProgress, + "moving": WorkflowProvisioningStateMoving, + "notspecified": WorkflowProvisioningStateNotSpecified, + "pending": WorkflowProvisioningStatePending, + "ready": WorkflowProvisioningStateReady, + "registered": WorkflowProvisioningStateRegistered, + "registering": WorkflowProvisioningStateRegistering, + "renewing": WorkflowProvisioningStateRenewing, + "running": WorkflowProvisioningStateRunning, + "succeeded": WorkflowProvisioningStateSucceeded, + "unregistered": WorkflowProvisioningStateUnregistered, + "unregistering": WorkflowProvisioningStateUnregistering, + "updating": WorkflowProvisioningStateUpdating, + "waiting": WorkflowProvisioningStateWaiting, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkflowProvisioningState(input) + return &out, nil +} + +type WorkflowState string + +const ( + WorkflowStateCompleted WorkflowState = "Completed" + WorkflowStateDeleted WorkflowState = "Deleted" + WorkflowStateDisabled WorkflowState = "Disabled" + WorkflowStateEnabled WorkflowState = "Enabled" + WorkflowStateNotSpecified WorkflowState = "NotSpecified" + WorkflowStateSuspended WorkflowState = "Suspended" +) + +func PossibleValuesForWorkflowState() []string { + return []string{ + string(WorkflowStateCompleted), + string(WorkflowStateDeleted), + string(WorkflowStateDisabled), + string(WorkflowStateEnabled), + string(WorkflowStateNotSpecified), + string(WorkflowStateSuspended), + } +} + +func parseWorkflowState(input string) (*WorkflowState, error) { + vals := map[string]WorkflowState{ + "completed": WorkflowStateCompleted, + "deleted": WorkflowStateDeleted, + "disabled": WorkflowStateDisabled, + "enabled": WorkflowStateEnabled, + "notspecified": WorkflowStateNotSpecified, + "suspended": WorkflowStateSuspended, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkflowState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/id_integrationserviceenvironment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/id_integrationserviceenvironment.go new file mode 100644 index 000000000000..900eab4a2b1c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/id_integrationserviceenvironment.go @@ -0,0 +1,124 @@ +package integrationserviceenvironments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = IntegrationServiceEnvironmentId{} + +// IntegrationServiceEnvironmentId is a struct representing the Resource ID for a Integration Service Environment +type IntegrationServiceEnvironmentId struct { + SubscriptionId string + ResourceGroup string + IntegrationServiceEnvironmentName string +} + +// NewIntegrationServiceEnvironmentID returns a new IntegrationServiceEnvironmentId struct +func NewIntegrationServiceEnvironmentID(subscriptionId string, resourceGroup string, integrationServiceEnvironmentName string) IntegrationServiceEnvironmentId { + return IntegrationServiceEnvironmentId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + IntegrationServiceEnvironmentName: integrationServiceEnvironmentName, + } +} + +// ParseIntegrationServiceEnvironmentID parses 'input' into a IntegrationServiceEnvironmentId +func ParseIntegrationServiceEnvironmentID(input string) (*IntegrationServiceEnvironmentId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationServiceEnvironmentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationServiceEnvironmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationServiceEnvironmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseIntegrationServiceEnvironmentIDInsensitively parses 'input' case-insensitively into a IntegrationServiceEnvironmentId +// note: this method should only be used for API response data and not user input +func ParseIntegrationServiceEnvironmentIDInsensitively(input string) (*IntegrationServiceEnvironmentId, error) { + parser := resourceids.NewParserFromResourceIdType(IntegrationServiceEnvironmentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntegrationServiceEnvironmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { + return nil, fmt.Errorf("the segment 'integrationServiceEnvironmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateIntegrationServiceEnvironmentID checks that 'input' can be parsed as a Integration Service Environment ID +func ValidateIntegrationServiceEnvironmentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseIntegrationServiceEnvironmentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Integration Service Environment ID +func (id IntegrationServiceEnvironmentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/integrationServiceEnvironments/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.IntegrationServiceEnvironmentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Integration Service Environment ID +func (id IntegrationServiceEnvironmentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticIntegrationServiceEnvironments", "integrationServiceEnvironments", "integrationServiceEnvironments"), + resourceids.UserSpecifiedSegment("integrationServiceEnvironmentName", "integrationServiceEnvironmentValue"), + } +} + +// String returns a human-readable description of this Integration Service Environment ID +func (id IntegrationServiceEnvironmentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Integration Service Environment Name: %q", id.IntegrationServiceEnvironmentName), + } + return fmt.Sprintf("Integration Service Environment (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_createorupdate_autorest.go new file mode 100644 index 000000000000..2b68d550df68 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package integrationserviceenvironments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c IntegrationServiceEnvironmentsClient) CreateOrUpdate(ctx context.Context, id IntegrationServiceEnvironmentId, input IntegrationServiceEnvironment) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c IntegrationServiceEnvironmentsClient) CreateOrUpdateThenPoll(ctx context.Context, id IntegrationServiceEnvironmentId, input IntegrationServiceEnvironment) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c IntegrationServiceEnvironmentsClient) preparerForCreateOrUpdate(ctx context.Context, id IntegrationServiceEnvironmentId, input IntegrationServiceEnvironment) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c IntegrationServiceEnvironmentsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_delete_autorest.go new file mode 100644 index 000000000000..d3381ec2ad7c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_delete_autorest.go @@ -0,0 +1,66 @@ +package integrationserviceenvironments + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c IntegrationServiceEnvironmentsClient) Delete(ctx context.Context, id IntegrationServiceEnvironmentId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c IntegrationServiceEnvironmentsClient) preparerForDelete(ctx context.Context, id IntegrationServiceEnvironmentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c IntegrationServiceEnvironmentsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_get_autorest.go new file mode 100644 index 000000000000..222756f79103 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_get_autorest.go @@ -0,0 +1,68 @@ +package integrationserviceenvironments + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *IntegrationServiceEnvironment +} + +// Get ... +func (c IntegrationServiceEnvironmentsClient) Get(ctx context.Context, id IntegrationServiceEnvironmentId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c IntegrationServiceEnvironmentsClient) preparerForGet(ctx context.Context, id IntegrationServiceEnvironmentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c IntegrationServiceEnvironmentsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..d7a1de33171b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_listbyresourcegroup_autorest.go @@ -0,0 +1,216 @@ +package integrationserviceenvironments + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]IntegrationServiceEnvironment + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []IntegrationServiceEnvironment +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByResourceGroupOperationOptions struct { + Top *int64 +} + +func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { + return ListByResourceGroupOperationOptions{} +} + +func (o ListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListByResourceGroup ... +func (c IntegrationServiceEnvironmentsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c IntegrationServiceEnvironmentsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Logic/integrationServiceEnvironments", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c IntegrationServiceEnvironmentsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c IntegrationServiceEnvironmentsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []IntegrationServiceEnvironment `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c IntegrationServiceEnvironmentsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, IntegrationServiceEnvironmentOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c IntegrationServiceEnvironmentsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate IntegrationServiceEnvironmentOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]IntegrationServiceEnvironment, 0) + + page, err := c.ListByResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_listbysubscription_autorest.go new file mode 100644 index 000000000000..06535d48c65a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_listbysubscription_autorest.go @@ -0,0 +1,216 @@ +package integrationserviceenvironments + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]IntegrationServiceEnvironment + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []IntegrationServiceEnvironment +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListBySubscriptionOperationOptions struct { + Top *int64 +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListBySubscription ... +func (c IntegrationServiceEnvironmentsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c IntegrationServiceEnvironmentsClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Logic/integrationServiceEnvironments", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c IntegrationServiceEnvironmentsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c IntegrationServiceEnvironmentsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []IntegrationServiceEnvironment `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c IntegrationServiceEnvironmentsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, IntegrationServiceEnvironmentOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c IntegrationServiceEnvironmentsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions, predicate IntegrationServiceEnvironmentOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]IntegrationServiceEnvironment, 0) + + page, err := c.ListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_update_autorest.go new file mode 100644 index 000000000000..ef8dbaccd621 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/method_update_autorest.go @@ -0,0 +1,79 @@ +package integrationserviceenvironments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c IntegrationServiceEnvironmentsClient) Update(ctx context.Context, id IntegrationServiceEnvironmentId, input IntegrationServiceEnvironment) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "integrationserviceenvironments.IntegrationServiceEnvironmentsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c IntegrationServiceEnvironmentsClient) UpdateThenPoll(ctx context.Context, id IntegrationServiceEnvironmentId, input IntegrationServiceEnvironment) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c IntegrationServiceEnvironmentsClient) preparerForUpdate(ctx context.Context, id IntegrationServiceEnvironmentId, input IntegrationServiceEnvironment) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c IntegrationServiceEnvironmentsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_flowendpoints.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_flowendpoints.go new file mode 100644 index 000000000000..d2be2e867bc0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_flowendpoints.go @@ -0,0 +1,9 @@ +package integrationserviceenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FlowEndpoints struct { + AccessEndpointIPAddresses *[]IPAddress `json:"accessEndpointIpAddresses,omitempty"` + OutgoingIPAddresses *[]IPAddress `json:"outgoingIpAddresses,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_flowendpointsconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_flowendpointsconfiguration.go new file mode 100644 index 000000000000..c3d9a072304d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_flowendpointsconfiguration.go @@ -0,0 +1,9 @@ +package integrationserviceenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FlowEndpointsConfiguration struct { + Connector *FlowEndpoints `json:"connector,omitempty"` + Workflow *FlowEndpoints `json:"workflow,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironmenencryptionconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironmenencryptionconfiguration.go new file mode 100644 index 000000000000..82f8272cbdba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironmenencryptionconfiguration.go @@ -0,0 +1,8 @@ +package integrationserviceenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationServiceEnvironmenEncryptionConfiguration struct { + EncryptionKeyReference *IntegrationServiceEnvironmenEncryptionKeyReference `json:"encryptionKeyReference,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironmenencryptionkeyreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironmenencryptionkeyreference.go new file mode 100644 index 000000000000..dad4929c7f18 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironmenencryptionkeyreference.go @@ -0,0 +1,10 @@ +package integrationserviceenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationServiceEnvironmenEncryptionKeyReference struct { + KeyName *string `json:"keyName,omitempty"` + KeyVault *ResourceReference `json:"keyVault,omitempty"` + KeyVersion *string `json:"keyVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironment.go new file mode 100644 index 000000000000..0a33ed6d5d3f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironment.go @@ -0,0 +1,19 @@ +package integrationserviceenvironments + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationServiceEnvironment struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemOrUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *IntegrationServiceEnvironmentProperties `json:"properties,omitempty"` + Sku *IntegrationServiceEnvironmentSku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironmentaccessendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironmentaccessendpoint.go new file mode 100644 index 000000000000..9d399c1829d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironmentaccessendpoint.go @@ -0,0 +1,8 @@ +package integrationserviceenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationServiceEnvironmentAccessEndpoint struct { + Type *IntegrationServiceEnvironmentAccessEndpointType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironmentproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironmentproperties.go new file mode 100644 index 000000000000..8f713affcb74 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironmentproperties.go @@ -0,0 +1,13 @@ +package integrationserviceenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationServiceEnvironmentProperties struct { + EncryptionConfiguration *IntegrationServiceEnvironmenEncryptionConfiguration `json:"encryptionConfiguration,omitempty"` + EndpointsConfiguration *FlowEndpointsConfiguration `json:"endpointsConfiguration,omitempty"` + IntegrationServiceEnvironmentId *string `json:"integrationServiceEnvironmentId,omitempty"` + NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"` + ProvisioningState *WorkflowProvisioningState `json:"provisioningState,omitempty"` + State *WorkflowState `json:"state,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironmentsku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironmentsku.go new file mode 100644 index 000000000000..b8a0a034889c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_integrationserviceenvironmentsku.go @@ -0,0 +1,9 @@ +package integrationserviceenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntegrationServiceEnvironmentSku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *IntegrationServiceEnvironmentSkuName `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_ipaddress.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_ipaddress.go new file mode 100644 index 000000000000..d8e6574769ac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_ipaddress.go @@ -0,0 +1,8 @@ +package integrationserviceenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IPAddress struct { + Address *string `json:"address,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_networkconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_networkconfiguration.go new file mode 100644 index 000000000000..766634d11034 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_networkconfiguration.go @@ -0,0 +1,10 @@ +package integrationserviceenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkConfiguration struct { + AccessEndpoint *IntegrationServiceEnvironmentAccessEndpoint `json:"accessEndpoint,omitempty"` + Subnets *[]ResourceReference `json:"subnets,omitempty"` + VirtualNetworkAddressSpace *string `json:"virtualNetworkAddressSpace,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_resourcereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_resourcereference.go new file mode 100644 index 000000000000..719b4ba21e65 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/model_resourcereference.go @@ -0,0 +1,10 @@ +package integrationserviceenvironments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceReference struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/predicates.go new file mode 100644 index 000000000000..d4380f995398 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/predicates.go @@ -0,0 +1,29 @@ +package integrationserviceenvironments + +type IntegrationServiceEnvironmentOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p IntegrationServiceEnvironmentOperationPredicate) Matches(input IntegrationServiceEnvironment) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/version.go new file mode 100644 index 000000000000..49bc6ae0f868 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments/version.go @@ -0,0 +1,12 @@ +package integrationserviceenvironments + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/integrationserviceenvironments/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/README.md new file mode 100644 index 000000000000..88f0856d9f54 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/README.md @@ -0,0 +1,215 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions` Documentation + +The `workflowrunactions` SDK allows for interaction with the Azure Resource Manager Service `logic` (API Version `2019-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions" +``` + + +### Client Initialization + +```go +client := workflowrunactions.NewWorkflowRunActionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `WorkflowRunActionsClient.CopeRepetitionsGet` + +```go +ctx := context.TODO() +id := workflowrunactions.NewScopeRepetitionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "runValue", "actionValue", "scopeRepetitionValue") + +read, err := client.CopeRepetitionsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowRunActionsClient.CopeRepetitionsList` + +```go +ctx := context.TODO() +id := workflowrunactions.NewActionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "runValue", "actionValue") + +read, err := client.CopeRepetitionsList(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowRunActionsClient.Get` + +```go +ctx := context.TODO() +id := workflowrunactions.NewActionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "runValue", "actionValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowRunActionsClient.List` + +```go +ctx := context.TODO() +id := workflowrunactions.NewRunID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "runValue") + +// alternatively `client.List(ctx, id, workflowrunactions.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, workflowrunactions.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WorkflowRunActionsClient.ListExpressionTraces` + +```go +ctx := context.TODO() +id := workflowrunactions.NewActionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "runValue", "actionValue") + +read, err := client.ListExpressionTraces(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowRunActionsClient.WorkflowRunActionRepetitionsGet` + +```go +ctx := context.TODO() +id := workflowrunactions.NewRepetitionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "runValue", "actionValue", "repetitionValue") + +read, err := client.WorkflowRunActionRepetitionsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowRunActionsClient.WorkflowRunActionRepetitionsList` + +```go +ctx := context.TODO() +id := workflowrunactions.NewActionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "runValue", "actionValue") + +read, err := client.WorkflowRunActionRepetitionsList(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowRunActionsClient.WorkflowRunActionRepetitionsListExpressionTraces` + +```go +ctx := context.TODO() +id := workflowrunactions.NewRepetitionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "runValue", "actionValue", "repetitionValue") + +read, err := client.WorkflowRunActionRepetitionsListExpressionTraces(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowRunActionsClient.WorkflowRunActionRepetitionsRequestHistoriesGet` + +```go +ctx := context.TODO() +id := workflowrunactions.NewRepetitionRequestHistoryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "runValue", "actionValue", "repetitionValue", "requestHistoryValue") + +read, err := client.WorkflowRunActionRepetitionsRequestHistoriesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowRunActionsClient.WorkflowRunActionRepetitionsRequestHistoriesList` + +```go +ctx := context.TODO() +id := workflowrunactions.NewRepetitionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "runValue", "actionValue", "repetitionValue") + +// alternatively `client.WorkflowRunActionRepetitionsRequestHistoriesList(ctx, id)` can be used to do batched pagination +items, err := client.WorkflowRunActionRepetitionsRequestHistoriesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WorkflowRunActionsClient.WorkflowRunActionRequestHistoriesGet` + +```go +ctx := context.TODO() +id := workflowrunactions.NewRequestHistoryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "runValue", "actionValue", "requestHistoryValue") + +read, err := client.WorkflowRunActionRequestHistoriesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowRunActionsClient.WorkflowRunActionRequestHistoriesList` + +```go +ctx := context.TODO() +id := workflowrunactions.NewActionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "runValue", "actionValue") + +// alternatively `client.WorkflowRunActionRequestHistoriesList(ctx, id)` can be used to do batched pagination +items, err := client.WorkflowRunActionRequestHistoriesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/client.go new file mode 100644 index 000000000000..4be56ad82df2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/client.go @@ -0,0 +1,18 @@ +package workflowrunactions + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowRunActionsClient struct { + Client autorest.Client + baseUri string +} + +func NewWorkflowRunActionsClientWithBaseURI(endpoint string) WorkflowRunActionsClient { + return WorkflowRunActionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/constants.go new file mode 100644 index 000000000000..2b85ab65c47b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/constants.go @@ -0,0 +1,67 @@ +package workflowrunactions + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowStatus string + +const ( + WorkflowStatusAborted WorkflowStatus = "Aborted" + WorkflowStatusCancelled WorkflowStatus = "Cancelled" + WorkflowStatusFailed WorkflowStatus = "Failed" + WorkflowStatusFaulted WorkflowStatus = "Faulted" + WorkflowStatusIgnored WorkflowStatus = "Ignored" + WorkflowStatusNotSpecified WorkflowStatus = "NotSpecified" + WorkflowStatusPaused WorkflowStatus = "Paused" + WorkflowStatusRunning WorkflowStatus = "Running" + WorkflowStatusSkipped WorkflowStatus = "Skipped" + WorkflowStatusSucceeded WorkflowStatus = "Succeeded" + WorkflowStatusSuspended WorkflowStatus = "Suspended" + WorkflowStatusTimedOut WorkflowStatus = "TimedOut" + WorkflowStatusWaiting WorkflowStatus = "Waiting" +) + +func PossibleValuesForWorkflowStatus() []string { + return []string{ + string(WorkflowStatusAborted), + string(WorkflowStatusCancelled), + string(WorkflowStatusFailed), + string(WorkflowStatusFaulted), + string(WorkflowStatusIgnored), + string(WorkflowStatusNotSpecified), + string(WorkflowStatusPaused), + string(WorkflowStatusRunning), + string(WorkflowStatusSkipped), + string(WorkflowStatusSucceeded), + string(WorkflowStatusSuspended), + string(WorkflowStatusTimedOut), + string(WorkflowStatusWaiting), + } +} + +func parseWorkflowStatus(input string) (*WorkflowStatus, error) { + vals := map[string]WorkflowStatus{ + "aborted": WorkflowStatusAborted, + "cancelled": WorkflowStatusCancelled, + "failed": WorkflowStatusFailed, + "faulted": WorkflowStatusFaulted, + "ignored": WorkflowStatusIgnored, + "notspecified": WorkflowStatusNotSpecified, + "paused": WorkflowStatusPaused, + "running": WorkflowStatusRunning, + "skipped": WorkflowStatusSkipped, + "succeeded": WorkflowStatusSucceeded, + "suspended": WorkflowStatusSuspended, + "timedout": WorkflowStatusTimedOut, + "waiting": WorkflowStatusWaiting, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkflowStatus(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_action.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_action.go new file mode 100644 index 000000000000..eddd5c047b95 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_action.go @@ -0,0 +1,150 @@ +package workflowrunactions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ActionId{} + +// ActionId is a struct representing the Resource ID for a Action +type ActionId struct { + SubscriptionId string + ResourceGroupName string + WorkflowName string + RunName string + ActionName string +} + +// NewActionID returns a new ActionId struct +func NewActionID(subscriptionId string, resourceGroupName string, workflowName string, runName string, actionName string) ActionId { + return ActionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkflowName: workflowName, + RunName: runName, + ActionName: actionName, + } +} + +// ParseActionID parses 'input' into a ActionId +func ParseActionID(input string) (*ActionId, error) { + parser := resourceids.NewParserFromResourceIdType(ActionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ActionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.RunName, ok = parsed.Parsed["runName"]; !ok { + return nil, fmt.Errorf("the segment 'runName' was not found in the resource id %q", input) + } + + if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { + return nil, fmt.Errorf("the segment 'actionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseActionIDInsensitively parses 'input' case-insensitively into a ActionId +// note: this method should only be used for API response data and not user input +func ParseActionIDInsensitively(input string) (*ActionId, error) { + parser := resourceids.NewParserFromResourceIdType(ActionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ActionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.RunName, ok = parsed.Parsed["runName"]; !ok { + return nil, fmt.Errorf("the segment 'runName' was not found in the resource id %q", input) + } + + if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { + return nil, fmt.Errorf("the segment 'actionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateActionID checks that 'input' can be parsed as a Action ID +func ValidateActionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseActionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Action ID +func (id ActionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/workflows/%s/runs/%s/actions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkflowName, id.RunName, id.ActionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Action ID +func (id ActionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticWorkflows", "workflows", "workflows"), + resourceids.UserSpecifiedSegment("workflowName", "workflowValue"), + resourceids.StaticSegment("staticRuns", "runs", "runs"), + resourceids.UserSpecifiedSegment("runName", "runValue"), + resourceids.StaticSegment("staticActions", "actions", "actions"), + resourceids.UserSpecifiedSegment("actionName", "actionValue"), + } +} + +// String returns a human-readable description of this Action ID +func (id ActionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workflow Name: %q", id.WorkflowName), + fmt.Sprintf("Run Name: %q", id.RunName), + fmt.Sprintf("Action Name: %q", id.ActionName), + } + return fmt.Sprintf("Action (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_repetition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_repetition.go new file mode 100644 index 000000000000..4cc66d650934 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_repetition.go @@ -0,0 +1,163 @@ +package workflowrunactions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RepetitionId{} + +// RepetitionId is a struct representing the Resource ID for a Repetition +type RepetitionId struct { + SubscriptionId string + ResourceGroupName string + WorkflowName string + RunName string + ActionName string + RepetitionName string +} + +// NewRepetitionID returns a new RepetitionId struct +func NewRepetitionID(subscriptionId string, resourceGroupName string, workflowName string, runName string, actionName string, repetitionName string) RepetitionId { + return RepetitionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkflowName: workflowName, + RunName: runName, + ActionName: actionName, + RepetitionName: repetitionName, + } +} + +// ParseRepetitionID parses 'input' into a RepetitionId +func ParseRepetitionID(input string) (*RepetitionId, error) { + parser := resourceids.NewParserFromResourceIdType(RepetitionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RepetitionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.RunName, ok = parsed.Parsed["runName"]; !ok { + return nil, fmt.Errorf("the segment 'runName' was not found in the resource id %q", input) + } + + if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { + return nil, fmt.Errorf("the segment 'actionName' was not found in the resource id %q", input) + } + + if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { + return nil, fmt.Errorf("the segment 'repetitionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRepetitionIDInsensitively parses 'input' case-insensitively into a RepetitionId +// note: this method should only be used for API response data and not user input +func ParseRepetitionIDInsensitively(input string) (*RepetitionId, error) { + parser := resourceids.NewParserFromResourceIdType(RepetitionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RepetitionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.RunName, ok = parsed.Parsed["runName"]; !ok { + return nil, fmt.Errorf("the segment 'runName' was not found in the resource id %q", input) + } + + if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { + return nil, fmt.Errorf("the segment 'actionName' was not found in the resource id %q", input) + } + + if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { + return nil, fmt.Errorf("the segment 'repetitionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRepetitionID checks that 'input' can be parsed as a Repetition ID +func ValidateRepetitionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRepetitionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Repetition ID +func (id RepetitionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/workflows/%s/runs/%s/actions/%s/repetitions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkflowName, id.RunName, id.ActionName, id.RepetitionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Repetition ID +func (id RepetitionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticWorkflows", "workflows", "workflows"), + resourceids.UserSpecifiedSegment("workflowName", "workflowValue"), + resourceids.StaticSegment("staticRuns", "runs", "runs"), + resourceids.UserSpecifiedSegment("runName", "runValue"), + resourceids.StaticSegment("staticActions", "actions", "actions"), + resourceids.UserSpecifiedSegment("actionName", "actionValue"), + resourceids.StaticSegment("staticRepetitions", "repetitions", "repetitions"), + resourceids.UserSpecifiedSegment("repetitionName", "repetitionValue"), + } +} + +// String returns a human-readable description of this Repetition ID +func (id RepetitionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workflow Name: %q", id.WorkflowName), + fmt.Sprintf("Run Name: %q", id.RunName), + fmt.Sprintf("Action Name: %q", id.ActionName), + fmt.Sprintf("Repetition Name: %q", id.RepetitionName), + } + return fmt.Sprintf("Repetition (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_repetitionrequesthistory.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_repetitionrequesthistory.go new file mode 100644 index 000000000000..b23ed6dafc43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_repetitionrequesthistory.go @@ -0,0 +1,176 @@ +package workflowrunactions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RepetitionRequestHistoryId{} + +// RepetitionRequestHistoryId is a struct representing the Resource ID for a Repetition Request History +type RepetitionRequestHistoryId struct { + SubscriptionId string + ResourceGroupName string + WorkflowName string + RunName string + ActionName string + RepetitionName string + RequestHistoryName string +} + +// NewRepetitionRequestHistoryID returns a new RepetitionRequestHistoryId struct +func NewRepetitionRequestHistoryID(subscriptionId string, resourceGroupName string, workflowName string, runName string, actionName string, repetitionName string, requestHistoryName string) RepetitionRequestHistoryId { + return RepetitionRequestHistoryId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkflowName: workflowName, + RunName: runName, + ActionName: actionName, + RepetitionName: repetitionName, + RequestHistoryName: requestHistoryName, + } +} + +// ParseRepetitionRequestHistoryID parses 'input' into a RepetitionRequestHistoryId +func ParseRepetitionRequestHistoryID(input string) (*RepetitionRequestHistoryId, error) { + parser := resourceids.NewParserFromResourceIdType(RepetitionRequestHistoryId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RepetitionRequestHistoryId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.RunName, ok = parsed.Parsed["runName"]; !ok { + return nil, fmt.Errorf("the segment 'runName' was not found in the resource id %q", input) + } + + if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { + return nil, fmt.Errorf("the segment 'actionName' was not found in the resource id %q", input) + } + + if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { + return nil, fmt.Errorf("the segment 'repetitionName' was not found in the resource id %q", input) + } + + if id.RequestHistoryName, ok = parsed.Parsed["requestHistoryName"]; !ok { + return nil, fmt.Errorf("the segment 'requestHistoryName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRepetitionRequestHistoryIDInsensitively parses 'input' case-insensitively into a RepetitionRequestHistoryId +// note: this method should only be used for API response data and not user input +func ParseRepetitionRequestHistoryIDInsensitively(input string) (*RepetitionRequestHistoryId, error) { + parser := resourceids.NewParserFromResourceIdType(RepetitionRequestHistoryId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RepetitionRequestHistoryId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.RunName, ok = parsed.Parsed["runName"]; !ok { + return nil, fmt.Errorf("the segment 'runName' was not found in the resource id %q", input) + } + + if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { + return nil, fmt.Errorf("the segment 'actionName' was not found in the resource id %q", input) + } + + if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { + return nil, fmt.Errorf("the segment 'repetitionName' was not found in the resource id %q", input) + } + + if id.RequestHistoryName, ok = parsed.Parsed["requestHistoryName"]; !ok { + return nil, fmt.Errorf("the segment 'requestHistoryName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRepetitionRequestHistoryID checks that 'input' can be parsed as a Repetition Request History ID +func ValidateRepetitionRequestHistoryID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRepetitionRequestHistoryID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Repetition Request History ID +func (id RepetitionRequestHistoryId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/workflows/%s/runs/%s/actions/%s/repetitions/%s/requestHistories/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkflowName, id.RunName, id.ActionName, id.RepetitionName, id.RequestHistoryName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Repetition Request History ID +func (id RepetitionRequestHistoryId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticWorkflows", "workflows", "workflows"), + resourceids.UserSpecifiedSegment("workflowName", "workflowValue"), + resourceids.StaticSegment("staticRuns", "runs", "runs"), + resourceids.UserSpecifiedSegment("runName", "runValue"), + resourceids.StaticSegment("staticActions", "actions", "actions"), + resourceids.UserSpecifiedSegment("actionName", "actionValue"), + resourceids.StaticSegment("staticRepetitions", "repetitions", "repetitions"), + resourceids.UserSpecifiedSegment("repetitionName", "repetitionValue"), + resourceids.StaticSegment("staticRequestHistories", "requestHistories", "requestHistories"), + resourceids.UserSpecifiedSegment("requestHistoryName", "requestHistoryValue"), + } +} + +// String returns a human-readable description of this Repetition Request History ID +func (id RepetitionRequestHistoryId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workflow Name: %q", id.WorkflowName), + fmt.Sprintf("Run Name: %q", id.RunName), + fmt.Sprintf("Action Name: %q", id.ActionName), + fmt.Sprintf("Repetition Name: %q", id.RepetitionName), + fmt.Sprintf("Request History Name: %q", id.RequestHistoryName), + } + return fmt.Sprintf("Repetition Request History (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_requesthistory.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_requesthistory.go new file mode 100644 index 000000000000..f8a38ccc5768 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_requesthistory.go @@ -0,0 +1,163 @@ +package workflowrunactions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RequestHistoryId{} + +// RequestHistoryId is a struct representing the Resource ID for a Request History +type RequestHistoryId struct { + SubscriptionId string + ResourceGroupName string + WorkflowName string + RunName string + ActionName string + RequestHistoryName string +} + +// NewRequestHistoryID returns a new RequestHistoryId struct +func NewRequestHistoryID(subscriptionId string, resourceGroupName string, workflowName string, runName string, actionName string, requestHistoryName string) RequestHistoryId { + return RequestHistoryId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkflowName: workflowName, + RunName: runName, + ActionName: actionName, + RequestHistoryName: requestHistoryName, + } +} + +// ParseRequestHistoryID parses 'input' into a RequestHistoryId +func ParseRequestHistoryID(input string) (*RequestHistoryId, error) { + parser := resourceids.NewParserFromResourceIdType(RequestHistoryId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RequestHistoryId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.RunName, ok = parsed.Parsed["runName"]; !ok { + return nil, fmt.Errorf("the segment 'runName' was not found in the resource id %q", input) + } + + if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { + return nil, fmt.Errorf("the segment 'actionName' was not found in the resource id %q", input) + } + + if id.RequestHistoryName, ok = parsed.Parsed["requestHistoryName"]; !ok { + return nil, fmt.Errorf("the segment 'requestHistoryName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRequestHistoryIDInsensitively parses 'input' case-insensitively into a RequestHistoryId +// note: this method should only be used for API response data and not user input +func ParseRequestHistoryIDInsensitively(input string) (*RequestHistoryId, error) { + parser := resourceids.NewParserFromResourceIdType(RequestHistoryId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RequestHistoryId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.RunName, ok = parsed.Parsed["runName"]; !ok { + return nil, fmt.Errorf("the segment 'runName' was not found in the resource id %q", input) + } + + if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { + return nil, fmt.Errorf("the segment 'actionName' was not found in the resource id %q", input) + } + + if id.RequestHistoryName, ok = parsed.Parsed["requestHistoryName"]; !ok { + return nil, fmt.Errorf("the segment 'requestHistoryName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRequestHistoryID checks that 'input' can be parsed as a Request History ID +func ValidateRequestHistoryID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRequestHistoryID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Request History ID +func (id RequestHistoryId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/workflows/%s/runs/%s/actions/%s/requestHistories/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkflowName, id.RunName, id.ActionName, id.RequestHistoryName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Request History ID +func (id RequestHistoryId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticWorkflows", "workflows", "workflows"), + resourceids.UserSpecifiedSegment("workflowName", "workflowValue"), + resourceids.StaticSegment("staticRuns", "runs", "runs"), + resourceids.UserSpecifiedSegment("runName", "runValue"), + resourceids.StaticSegment("staticActions", "actions", "actions"), + resourceids.UserSpecifiedSegment("actionName", "actionValue"), + resourceids.StaticSegment("staticRequestHistories", "requestHistories", "requestHistories"), + resourceids.UserSpecifiedSegment("requestHistoryName", "requestHistoryValue"), + } +} + +// String returns a human-readable description of this Request History ID +func (id RequestHistoryId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workflow Name: %q", id.WorkflowName), + fmt.Sprintf("Run Name: %q", id.RunName), + fmt.Sprintf("Action Name: %q", id.ActionName), + fmt.Sprintf("Request History Name: %q", id.RequestHistoryName), + } + return fmt.Sprintf("Request History (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_run.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_run.go new file mode 100644 index 000000000000..5be87b31a792 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_run.go @@ -0,0 +1,137 @@ +package workflowrunactions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RunId{} + +// RunId is a struct representing the Resource ID for a Run +type RunId struct { + SubscriptionId string + ResourceGroupName string + WorkflowName string + RunName string +} + +// NewRunID returns a new RunId struct +func NewRunID(subscriptionId string, resourceGroupName string, workflowName string, runName string) RunId { + return RunId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkflowName: workflowName, + RunName: runName, + } +} + +// ParseRunID parses 'input' into a RunId +func ParseRunID(input string) (*RunId, error) { + parser := resourceids.NewParserFromResourceIdType(RunId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RunId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.RunName, ok = parsed.Parsed["runName"]; !ok { + return nil, fmt.Errorf("the segment 'runName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRunIDInsensitively parses 'input' case-insensitively into a RunId +// note: this method should only be used for API response data and not user input +func ParseRunIDInsensitively(input string) (*RunId, error) { + parser := resourceids.NewParserFromResourceIdType(RunId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RunId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.RunName, ok = parsed.Parsed["runName"]; !ok { + return nil, fmt.Errorf("the segment 'runName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRunID checks that 'input' can be parsed as a Run ID +func ValidateRunID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRunID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Run ID +func (id RunId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/workflows/%s/runs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkflowName, id.RunName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Run ID +func (id RunId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticWorkflows", "workflows", "workflows"), + resourceids.UserSpecifiedSegment("workflowName", "workflowValue"), + resourceids.StaticSegment("staticRuns", "runs", "runs"), + resourceids.UserSpecifiedSegment("runName", "runValue"), + } +} + +// String returns a human-readable description of this Run ID +func (id RunId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workflow Name: %q", id.WorkflowName), + fmt.Sprintf("Run Name: %q", id.RunName), + } + return fmt.Sprintf("Run (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_scoperepetition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_scoperepetition.go new file mode 100644 index 000000000000..48d2f7f43f6a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/id_scoperepetition.go @@ -0,0 +1,163 @@ +package workflowrunactions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ScopeRepetitionId{} + +// ScopeRepetitionId is a struct representing the Resource ID for a Scope Repetition +type ScopeRepetitionId struct { + SubscriptionId string + ResourceGroupName string + WorkflowName string + RunName string + ActionName string + ScopeRepetitionName string +} + +// NewScopeRepetitionID returns a new ScopeRepetitionId struct +func NewScopeRepetitionID(subscriptionId string, resourceGroupName string, workflowName string, runName string, actionName string, scopeRepetitionName string) ScopeRepetitionId { + return ScopeRepetitionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkflowName: workflowName, + RunName: runName, + ActionName: actionName, + ScopeRepetitionName: scopeRepetitionName, + } +} + +// ParseScopeRepetitionID parses 'input' into a ScopeRepetitionId +func ParseScopeRepetitionID(input string) (*ScopeRepetitionId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopeRepetitionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopeRepetitionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.RunName, ok = parsed.Parsed["runName"]; !ok { + return nil, fmt.Errorf("the segment 'runName' was not found in the resource id %q", input) + } + + if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { + return nil, fmt.Errorf("the segment 'actionName' was not found in the resource id %q", input) + } + + if id.ScopeRepetitionName, ok = parsed.Parsed["scopeRepetitionName"]; !ok { + return nil, fmt.Errorf("the segment 'scopeRepetitionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseScopeRepetitionIDInsensitively parses 'input' case-insensitively into a ScopeRepetitionId +// note: this method should only be used for API response data and not user input +func ParseScopeRepetitionIDInsensitively(input string) (*ScopeRepetitionId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopeRepetitionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopeRepetitionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.RunName, ok = parsed.Parsed["runName"]; !ok { + return nil, fmt.Errorf("the segment 'runName' was not found in the resource id %q", input) + } + + if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { + return nil, fmt.Errorf("the segment 'actionName' was not found in the resource id %q", input) + } + + if id.ScopeRepetitionName, ok = parsed.Parsed["scopeRepetitionName"]; !ok { + return nil, fmt.Errorf("the segment 'scopeRepetitionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateScopeRepetitionID checks that 'input' can be parsed as a Scope Repetition ID +func ValidateScopeRepetitionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseScopeRepetitionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scope Repetition ID +func (id ScopeRepetitionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/workflows/%s/runs/%s/actions/%s/scopeRepetitions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkflowName, id.RunName, id.ActionName, id.ScopeRepetitionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scope Repetition ID +func (id ScopeRepetitionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticWorkflows", "workflows", "workflows"), + resourceids.UserSpecifiedSegment("workflowName", "workflowValue"), + resourceids.StaticSegment("staticRuns", "runs", "runs"), + resourceids.UserSpecifiedSegment("runName", "runValue"), + resourceids.StaticSegment("staticActions", "actions", "actions"), + resourceids.UserSpecifiedSegment("actionName", "actionValue"), + resourceids.StaticSegment("staticScopeRepetitions", "scopeRepetitions", "scopeRepetitions"), + resourceids.UserSpecifiedSegment("scopeRepetitionName", "scopeRepetitionValue"), + } +} + +// String returns a human-readable description of this Scope Repetition ID +func (id ScopeRepetitionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workflow Name: %q", id.WorkflowName), + fmt.Sprintf("Run Name: %q", id.RunName), + fmt.Sprintf("Action Name: %q", id.ActionName), + fmt.Sprintf("Scope Repetition Name: %q", id.ScopeRepetitionName), + } + return fmt.Sprintf("Scope Repetition (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_coperepetitionsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_coperepetitionsget_autorest.go new file mode 100644 index 000000000000..608ad25cf8ed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_coperepetitionsget_autorest.go @@ -0,0 +1,68 @@ +package workflowrunactions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CopeRepetitionsGetOperationResponse struct { + HttpResponse *http.Response + Model *WorkflowRunActionRepetitionDefinition +} + +// CopeRepetitionsGet ... +func (c WorkflowRunActionsClient) CopeRepetitionsGet(ctx context.Context, id ScopeRepetitionId) (result CopeRepetitionsGetOperationResponse, err error) { + req, err := c.preparerForCopeRepetitionsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "CopeRepetitionsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "CopeRepetitionsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCopeRepetitionsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "CopeRepetitionsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCopeRepetitionsGet prepares the CopeRepetitionsGet request. +func (c WorkflowRunActionsClient) preparerForCopeRepetitionsGet(ctx context.Context, id ScopeRepetitionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCopeRepetitionsGet handles the response to the CopeRepetitionsGet request. The method always +// closes the http.Response Body. +func (c WorkflowRunActionsClient) responderForCopeRepetitionsGet(resp *http.Response) (result CopeRepetitionsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_coperepetitionslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_coperepetitionslist_autorest.go new file mode 100644 index 000000000000..21aceda782bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_coperepetitionslist_autorest.go @@ -0,0 +1,69 @@ +package workflowrunactions + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CopeRepetitionsListOperationResponse struct { + HttpResponse *http.Response + Model *WorkflowRunActionRepetitionDefinitionCollection +} + +// CopeRepetitionsList ... +func (c WorkflowRunActionsClient) CopeRepetitionsList(ctx context.Context, id ActionId) (result CopeRepetitionsListOperationResponse, err error) { + req, err := c.preparerForCopeRepetitionsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "CopeRepetitionsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "CopeRepetitionsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCopeRepetitionsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "CopeRepetitionsList", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCopeRepetitionsList prepares the CopeRepetitionsList request. +func (c WorkflowRunActionsClient) preparerForCopeRepetitionsList(ctx context.Context, id ActionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/scopeRepetitions", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCopeRepetitionsList handles the response to the CopeRepetitionsList request. The method always +// closes the http.Response Body. +func (c WorkflowRunActionsClient) responderForCopeRepetitionsList(resp *http.Response) (result CopeRepetitionsListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_get_autorest.go new file mode 100644 index 000000000000..5033bc3a79e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_get_autorest.go @@ -0,0 +1,68 @@ +package workflowrunactions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *WorkflowRunAction +} + +// Get ... +func (c WorkflowRunActionsClient) Get(ctx context.Context, id ActionId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c WorkflowRunActionsClient) preparerForGet(ctx context.Context, id ActionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c WorkflowRunActionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_list_autorest.go new file mode 100644 index 000000000000..3aabe40f9ae5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_list_autorest.go @@ -0,0 +1,220 @@ +package workflowrunactions + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]WorkflowRunAction + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []WorkflowRunAction +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Filter *string + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c WorkflowRunActionsClient) List(ctx context.Context, id RunId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c WorkflowRunActionsClient) preparerForList(ctx context.Context, id RunId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/actions", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c WorkflowRunActionsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c WorkflowRunActionsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []WorkflowRunAction `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c WorkflowRunActionsClient) ListComplete(ctx context.Context, id RunId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, WorkflowRunActionOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkflowRunActionsClient) ListCompleteMatchingPredicate(ctx context.Context, id RunId, options ListOperationOptions, predicate WorkflowRunActionOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]WorkflowRunAction, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_listexpressiontraces_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_listexpressiontraces_autorest.go new file mode 100644 index 000000000000..b0eb05063890 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_listexpressiontraces_autorest.go @@ -0,0 +1,69 @@ +package workflowrunactions + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListExpressionTracesOperationResponse struct { + HttpResponse *http.Response + Model *ExpressionTraces +} + +// ListExpressionTraces ... +func (c WorkflowRunActionsClient) ListExpressionTraces(ctx context.Context, id ActionId) (result ListExpressionTracesOperationResponse, err error) { + req, err := c.preparerForListExpressionTraces(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "ListExpressionTraces", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "ListExpressionTraces", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListExpressionTraces(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "ListExpressionTraces", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListExpressionTraces prepares the ListExpressionTraces request. +func (c WorkflowRunActionsClient) preparerForListExpressionTraces(ctx context.Context, id ActionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listExpressionTraces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListExpressionTraces handles the response to the ListExpressionTraces request. The method always +// closes the http.Response Body. +func (c WorkflowRunActionsClient) responderForListExpressionTraces(resp *http.Response) (result ListExpressionTracesOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrepetitionsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrepetitionsget_autorest.go new file mode 100644 index 000000000000..1fc34e96d81b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrepetitionsget_autorest.go @@ -0,0 +1,68 @@ +package workflowrunactions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowRunActionRepetitionsGetOperationResponse struct { + HttpResponse *http.Response + Model *WorkflowRunActionRepetitionDefinition +} + +// WorkflowRunActionRepetitionsGet ... +func (c WorkflowRunActionsClient) WorkflowRunActionRepetitionsGet(ctx context.Context, id RepetitionId) (result WorkflowRunActionRepetitionsGetOperationResponse, err error) { + req, err := c.preparerForWorkflowRunActionRepetitionsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkflowRunActionRepetitionsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkflowRunActionRepetitionsGet prepares the WorkflowRunActionRepetitionsGet request. +func (c WorkflowRunActionsClient) preparerForWorkflowRunActionRepetitionsGet(ctx context.Context, id RepetitionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkflowRunActionRepetitionsGet handles the response to the WorkflowRunActionRepetitionsGet request. The method always +// closes the http.Response Body. +func (c WorkflowRunActionsClient) responderForWorkflowRunActionRepetitionsGet(resp *http.Response) (result WorkflowRunActionRepetitionsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrepetitionslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrepetitionslist_autorest.go new file mode 100644 index 000000000000..2cb8f431c8ec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrepetitionslist_autorest.go @@ -0,0 +1,69 @@ +package workflowrunactions + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowRunActionRepetitionsListOperationResponse struct { + HttpResponse *http.Response + Model *WorkflowRunActionRepetitionDefinitionCollection +} + +// WorkflowRunActionRepetitionsList ... +func (c WorkflowRunActionsClient) WorkflowRunActionRepetitionsList(ctx context.Context, id ActionId) (result WorkflowRunActionRepetitionsListOperationResponse, err error) { + req, err := c.preparerForWorkflowRunActionRepetitionsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkflowRunActionRepetitionsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsList", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkflowRunActionRepetitionsList prepares the WorkflowRunActionRepetitionsList request. +func (c WorkflowRunActionsClient) preparerForWorkflowRunActionRepetitionsList(ctx context.Context, id ActionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/repetitions", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkflowRunActionRepetitionsList handles the response to the WorkflowRunActionRepetitionsList request. The method always +// closes the http.Response Body. +func (c WorkflowRunActionsClient) responderForWorkflowRunActionRepetitionsList(resp *http.Response) (result WorkflowRunActionRepetitionsListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrepetitionslistexpressiontraces_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrepetitionslistexpressiontraces_autorest.go new file mode 100644 index 000000000000..13fac59a5eed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrepetitionslistexpressiontraces_autorest.go @@ -0,0 +1,69 @@ +package workflowrunactions + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowRunActionRepetitionsListExpressionTracesOperationResponse struct { + HttpResponse *http.Response + Model *ExpressionTraces +} + +// WorkflowRunActionRepetitionsListExpressionTraces ... +func (c WorkflowRunActionsClient) WorkflowRunActionRepetitionsListExpressionTraces(ctx context.Context, id RepetitionId) (result WorkflowRunActionRepetitionsListExpressionTracesOperationResponse, err error) { + req, err := c.preparerForWorkflowRunActionRepetitionsListExpressionTraces(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsListExpressionTraces", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsListExpressionTraces", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkflowRunActionRepetitionsListExpressionTraces(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsListExpressionTraces", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkflowRunActionRepetitionsListExpressionTraces prepares the WorkflowRunActionRepetitionsListExpressionTraces request. +func (c WorkflowRunActionsClient) preparerForWorkflowRunActionRepetitionsListExpressionTraces(ctx context.Context, id RepetitionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listExpressionTraces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkflowRunActionRepetitionsListExpressionTraces handles the response to the WorkflowRunActionRepetitionsListExpressionTraces request. The method always +// closes the http.Response Body. +func (c WorkflowRunActionsClient) responderForWorkflowRunActionRepetitionsListExpressionTraces(resp *http.Response) (result WorkflowRunActionRepetitionsListExpressionTracesOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrepetitionsrequesthistoriesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrepetitionsrequesthistoriesget_autorest.go new file mode 100644 index 000000000000..4417161780e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrepetitionsrequesthistoriesget_autorest.go @@ -0,0 +1,68 @@ +package workflowrunactions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowRunActionRepetitionsRequestHistoriesGetOperationResponse struct { + HttpResponse *http.Response + Model *RequestHistory +} + +// WorkflowRunActionRepetitionsRequestHistoriesGet ... +func (c WorkflowRunActionsClient) WorkflowRunActionRepetitionsRequestHistoriesGet(ctx context.Context, id RepetitionRequestHistoryId) (result WorkflowRunActionRepetitionsRequestHistoriesGetOperationResponse, err error) { + req, err := c.preparerForWorkflowRunActionRepetitionsRequestHistoriesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsRequestHistoriesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsRequestHistoriesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkflowRunActionRepetitionsRequestHistoriesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsRequestHistoriesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkflowRunActionRepetitionsRequestHistoriesGet prepares the WorkflowRunActionRepetitionsRequestHistoriesGet request. +func (c WorkflowRunActionsClient) preparerForWorkflowRunActionRepetitionsRequestHistoriesGet(ctx context.Context, id RepetitionRequestHistoryId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkflowRunActionRepetitionsRequestHistoriesGet handles the response to the WorkflowRunActionRepetitionsRequestHistoriesGet request. The method always +// closes the http.Response Body. +func (c WorkflowRunActionsClient) responderForWorkflowRunActionRepetitionsRequestHistoriesGet(resp *http.Response) (result WorkflowRunActionRepetitionsRequestHistoriesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrepetitionsrequesthistorieslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrepetitionsrequesthistorieslist_autorest.go new file mode 100644 index 000000000000..e33fe5ae49cf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrepetitionsrequesthistorieslist_autorest.go @@ -0,0 +1,186 @@ +package workflowrunactions + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowRunActionRepetitionsRequestHistoriesListOperationResponse struct { + HttpResponse *http.Response + Model *[]RequestHistory + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (WorkflowRunActionRepetitionsRequestHistoriesListOperationResponse, error) +} + +type WorkflowRunActionRepetitionsRequestHistoriesListCompleteResult struct { + Items []RequestHistory +} + +func (r WorkflowRunActionRepetitionsRequestHistoriesListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r WorkflowRunActionRepetitionsRequestHistoriesListOperationResponse) LoadMore(ctx context.Context) (resp WorkflowRunActionRepetitionsRequestHistoriesListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// WorkflowRunActionRepetitionsRequestHistoriesList ... +func (c WorkflowRunActionsClient) WorkflowRunActionRepetitionsRequestHistoriesList(ctx context.Context, id RepetitionId) (resp WorkflowRunActionRepetitionsRequestHistoriesListOperationResponse, err error) { + req, err := c.preparerForWorkflowRunActionRepetitionsRequestHistoriesList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsRequestHistoriesList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsRequestHistoriesList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForWorkflowRunActionRepetitionsRequestHistoriesList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsRequestHistoriesList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForWorkflowRunActionRepetitionsRequestHistoriesList prepares the WorkflowRunActionRepetitionsRequestHistoriesList request. +func (c WorkflowRunActionsClient) preparerForWorkflowRunActionRepetitionsRequestHistoriesList(ctx context.Context, id RepetitionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/requestHistories", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForWorkflowRunActionRepetitionsRequestHistoriesListWithNextLink prepares the WorkflowRunActionRepetitionsRequestHistoriesList request with the given nextLink token. +func (c WorkflowRunActionsClient) preparerForWorkflowRunActionRepetitionsRequestHistoriesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkflowRunActionRepetitionsRequestHistoriesList handles the response to the WorkflowRunActionRepetitionsRequestHistoriesList request. The method always +// closes the http.Response Body. +func (c WorkflowRunActionsClient) responderForWorkflowRunActionRepetitionsRequestHistoriesList(resp *http.Response) (result WorkflowRunActionRepetitionsRequestHistoriesListOperationResponse, err error) { + type page struct { + Values []RequestHistory `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result WorkflowRunActionRepetitionsRequestHistoriesListOperationResponse, err error) { + req, err := c.preparerForWorkflowRunActionRepetitionsRequestHistoriesListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsRequestHistoriesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsRequestHistoriesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkflowRunActionRepetitionsRequestHistoriesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRepetitionsRequestHistoriesList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// WorkflowRunActionRepetitionsRequestHistoriesListComplete retrieves all of the results into a single object +func (c WorkflowRunActionsClient) WorkflowRunActionRepetitionsRequestHistoriesListComplete(ctx context.Context, id RepetitionId) (WorkflowRunActionRepetitionsRequestHistoriesListCompleteResult, error) { + return c.WorkflowRunActionRepetitionsRequestHistoriesListCompleteMatchingPredicate(ctx, id, RequestHistoryOperationPredicate{}) +} + +// WorkflowRunActionRepetitionsRequestHistoriesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkflowRunActionsClient) WorkflowRunActionRepetitionsRequestHistoriesListCompleteMatchingPredicate(ctx context.Context, id RepetitionId, predicate RequestHistoryOperationPredicate) (resp WorkflowRunActionRepetitionsRequestHistoriesListCompleteResult, err error) { + items := make([]RequestHistory, 0) + + page, err := c.WorkflowRunActionRepetitionsRequestHistoriesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := WorkflowRunActionRepetitionsRequestHistoriesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrequesthistoriesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrequesthistoriesget_autorest.go new file mode 100644 index 000000000000..7760caca78be --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrequesthistoriesget_autorest.go @@ -0,0 +1,68 @@ +package workflowrunactions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowRunActionRequestHistoriesGetOperationResponse struct { + HttpResponse *http.Response + Model *RequestHistory +} + +// WorkflowRunActionRequestHistoriesGet ... +func (c WorkflowRunActionsClient) WorkflowRunActionRequestHistoriesGet(ctx context.Context, id RequestHistoryId) (result WorkflowRunActionRequestHistoriesGetOperationResponse, err error) { + req, err := c.preparerForWorkflowRunActionRequestHistoriesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRequestHistoriesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRequestHistoriesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkflowRunActionRequestHistoriesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRequestHistoriesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkflowRunActionRequestHistoriesGet prepares the WorkflowRunActionRequestHistoriesGet request. +func (c WorkflowRunActionsClient) preparerForWorkflowRunActionRequestHistoriesGet(ctx context.Context, id RequestHistoryId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkflowRunActionRequestHistoriesGet handles the response to the WorkflowRunActionRequestHistoriesGet request. The method always +// closes the http.Response Body. +func (c WorkflowRunActionsClient) responderForWorkflowRunActionRequestHistoriesGet(resp *http.Response) (result WorkflowRunActionRequestHistoriesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrequesthistorieslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrequesthistorieslist_autorest.go new file mode 100644 index 000000000000..63c4c23fa010 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/method_workflowrunactionrequesthistorieslist_autorest.go @@ -0,0 +1,186 @@ +package workflowrunactions + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowRunActionRequestHistoriesListOperationResponse struct { + HttpResponse *http.Response + Model *[]RequestHistory + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (WorkflowRunActionRequestHistoriesListOperationResponse, error) +} + +type WorkflowRunActionRequestHistoriesListCompleteResult struct { + Items []RequestHistory +} + +func (r WorkflowRunActionRequestHistoriesListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r WorkflowRunActionRequestHistoriesListOperationResponse) LoadMore(ctx context.Context) (resp WorkflowRunActionRequestHistoriesListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// WorkflowRunActionRequestHistoriesList ... +func (c WorkflowRunActionsClient) WorkflowRunActionRequestHistoriesList(ctx context.Context, id ActionId) (resp WorkflowRunActionRequestHistoriesListOperationResponse, err error) { + req, err := c.preparerForWorkflowRunActionRequestHistoriesList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRequestHistoriesList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRequestHistoriesList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForWorkflowRunActionRequestHistoriesList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRequestHistoriesList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForWorkflowRunActionRequestHistoriesList prepares the WorkflowRunActionRequestHistoriesList request. +func (c WorkflowRunActionsClient) preparerForWorkflowRunActionRequestHistoriesList(ctx context.Context, id ActionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/requestHistories", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForWorkflowRunActionRequestHistoriesListWithNextLink prepares the WorkflowRunActionRequestHistoriesList request with the given nextLink token. +func (c WorkflowRunActionsClient) preparerForWorkflowRunActionRequestHistoriesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkflowRunActionRequestHistoriesList handles the response to the WorkflowRunActionRequestHistoriesList request. The method always +// closes the http.Response Body. +func (c WorkflowRunActionsClient) responderForWorkflowRunActionRequestHistoriesList(resp *http.Response) (result WorkflowRunActionRequestHistoriesListOperationResponse, err error) { + type page struct { + Values []RequestHistory `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result WorkflowRunActionRequestHistoriesListOperationResponse, err error) { + req, err := c.preparerForWorkflowRunActionRequestHistoriesListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRequestHistoriesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRequestHistoriesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkflowRunActionRequestHistoriesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowrunactions.WorkflowRunActionsClient", "WorkflowRunActionRequestHistoriesList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// WorkflowRunActionRequestHistoriesListComplete retrieves all of the results into a single object +func (c WorkflowRunActionsClient) WorkflowRunActionRequestHistoriesListComplete(ctx context.Context, id ActionId) (WorkflowRunActionRequestHistoriesListCompleteResult, error) { + return c.WorkflowRunActionRequestHistoriesListCompleteMatchingPredicate(ctx, id, RequestHistoryOperationPredicate{}) +} + +// WorkflowRunActionRequestHistoriesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkflowRunActionsClient) WorkflowRunActionRequestHistoriesListCompleteMatchingPredicate(ctx context.Context, id ActionId, predicate RequestHistoryOperationPredicate) (resp WorkflowRunActionRequestHistoriesListCompleteResult, err error) { + items := make([]RequestHistory, 0) + + page, err := c.WorkflowRunActionRequestHistoriesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := WorkflowRunActionRequestHistoriesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_azureresourceerrorinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_azureresourceerrorinfo.go new file mode 100644 index 000000000000..59c3c304adb5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_azureresourceerrorinfo.go @@ -0,0 +1,10 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureResourceErrorInfo struct { + Code string `json:"code"` + Details *[]AzureResourceErrorInfo `json:"details,omitempty"` + Message string `json:"message"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_contenthash.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_contenthash.go new file mode 100644 index 000000000000..3c0011433bc6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_contenthash.go @@ -0,0 +1,9 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentHash struct { + Algorithm *string `json:"algorithm,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_contentlink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_contentlink.go new file mode 100644 index 000000000000..bd3dc0e8dbcd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_contentlink.go @@ -0,0 +1,12 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContentLink struct { + ContentHash *ContentHash `json:"contentHash,omitempty"` + ContentSize *int64 `json:"contentSize,omitempty"` + ContentVersion *string `json:"contentVersion,omitempty"` + Metadata *interface{} `json:"metadata,omitempty"` + Uri *string `json:"uri,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_errorproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_errorproperties.go new file mode 100644 index 000000000000..0c17755bd62b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_errorproperties.go @@ -0,0 +1,9 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorProperties struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_errorresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_errorresponse.go new file mode 100644 index 000000000000..9856e5afdda7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_errorresponse.go @@ -0,0 +1,8 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorResponse struct { + Error *ErrorProperties `json:"error,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_expression.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_expression.go new file mode 100644 index 000000000000..a7689b2d49e4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_expression.go @@ -0,0 +1,11 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Expression struct { + Error *AzureResourceErrorInfo `json:"error,omitempty"` + Subexpressions *[]Expression `json:"subexpressions,omitempty"` + Text *string `json:"text,omitempty"` + Value *interface{} `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_expressionroot.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_expressionroot.go new file mode 100644 index 000000000000..29e8bb99a418 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_expressionroot.go @@ -0,0 +1,12 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExpressionRoot struct { + Error *AzureResourceErrorInfo `json:"error,omitempty"` + Path *string `json:"path,omitempty"` + Subexpressions *[]Expression `json:"subexpressions,omitempty"` + Text *string `json:"text,omitempty"` + Value *interface{} `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_expressiontraces.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_expressiontraces.go new file mode 100644 index 000000000000..f6d2b9b080e3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_expressiontraces.go @@ -0,0 +1,8 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExpressionTraces struct { + Inputs *[]ExpressionRoot `json:"inputs,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_repetitionindex.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_repetitionindex.go new file mode 100644 index 000000000000..ba809fd07414 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_repetitionindex.go @@ -0,0 +1,9 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RepetitionIndex struct { + ItemIndex int64 `json:"itemIndex"` + ScopeName *string `json:"scopeName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_request.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_request.go new file mode 100644 index 000000000000..1ced5675ea2c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_request.go @@ -0,0 +1,10 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Request struct { + Headers *interface{} `json:"headers,omitempty"` + Method *string `json:"method,omitempty"` + Uri *string `json:"uri,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_requesthistory.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_requesthistory.go new file mode 100644 index 000000000000..61e48b714f3a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_requesthistory.go @@ -0,0 +1,13 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RequestHistory struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RequestHistoryProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_requesthistoryproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_requesthistoryproperties.go new file mode 100644 index 000000000000..86fd91ff9e06 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_requesthistoryproperties.go @@ -0,0 +1,41 @@ +package workflowrunactions + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RequestHistoryProperties struct { + EndTime *string `json:"endTime,omitempty"` + Request *Request `json:"request,omitempty"` + Response *Response `json:"response,omitempty"` + StartTime *string `json:"startTime,omitempty"` +} + +func (o *RequestHistoryProperties) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RequestHistoryProperties) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *RequestHistoryProperties) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RequestHistoryProperties) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_response.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_response.go new file mode 100644 index 000000000000..2697b1a5aabc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_response.go @@ -0,0 +1,10 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Response struct { + BodyLink *ContentLink `json:"bodyLink,omitempty"` + Headers *interface{} `json:"headers,omitempty"` + StatusCode *int64 `json:"statusCode,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_retryhistory.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_retryhistory.go new file mode 100644 index 000000000000..372ab23d01f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_retryhistory.go @@ -0,0 +1,43 @@ +package workflowrunactions + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RetryHistory struct { + ClientRequestId *string `json:"clientRequestId,omitempty"` + Code *string `json:"code,omitempty"` + EndTime *string `json:"endTime,omitempty"` + Error *ErrorResponse `json:"error,omitempty"` + ServiceRequestId *string `json:"serviceRequestId,omitempty"` + StartTime *string `json:"startTime,omitempty"` +} + +func (o *RetryHistory) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RetryHistory) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *RetryHistory) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RetryHistory) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_runactioncorrelation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_runactioncorrelation.go new file mode 100644 index 000000000000..dc7976ccc37c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_runactioncorrelation.go @@ -0,0 +1,10 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunActionCorrelation struct { + ActionTrackingId *string `json:"actionTrackingId,omitempty"` + ClientKeywords *[]string `json:"clientKeywords,omitempty"` + ClientTrackingId *string `json:"clientTrackingId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_workflowrunaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_workflowrunaction.go new file mode 100644 index 000000000000..443cf266c769 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_workflowrunaction.go @@ -0,0 +1,11 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowRunAction struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *WorkflowRunActionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_workflowrunactionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_workflowrunactionproperties.go new file mode 100644 index 000000000000..515fd157766e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_workflowrunactionproperties.go @@ -0,0 +1,48 @@ +package workflowrunactions + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowRunActionProperties struct { + Code *string `json:"code,omitempty"` + Correlation *RunActionCorrelation `json:"correlation,omitempty"` + EndTime *string `json:"endTime,omitempty"` + Error *interface{} `json:"error,omitempty"` + InputsLink *ContentLink `json:"inputsLink,omitempty"` + OutputsLink *ContentLink `json:"outputsLink,omitempty"` + RetryHistory *[]RetryHistory `json:"retryHistory,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *WorkflowStatus `json:"status,omitempty"` + TrackedProperties *interface{} `json:"trackedProperties,omitempty"` + TrackingId *string `json:"trackingId,omitempty"` +} + +func (o *WorkflowRunActionProperties) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *WorkflowRunActionProperties) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *WorkflowRunActionProperties) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *WorkflowRunActionProperties) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_workflowrunactionrepetitiondefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_workflowrunactionrepetitiondefinition.go new file mode 100644 index 000000000000..6705564dcf35 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_workflowrunactionrepetitiondefinition.go @@ -0,0 +1,13 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowRunActionRepetitionDefinition struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties WorkflowRunActionRepetitionProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_workflowrunactionrepetitiondefinitioncollection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_workflowrunactionrepetitiondefinitioncollection.go new file mode 100644 index 000000000000..b2608d188dd9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_workflowrunactionrepetitiondefinitioncollection.go @@ -0,0 +1,9 @@ +package workflowrunactions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowRunActionRepetitionDefinitionCollection struct { + NextLink *string `json:"nextLink,omitempty"` + Value *[]WorkflowRunActionRepetitionDefinition `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_workflowrunactionrepetitionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_workflowrunactionrepetitionproperties.go new file mode 100644 index 000000000000..759c33c60094 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/model_workflowrunactionrepetitionproperties.go @@ -0,0 +1,52 @@ +package workflowrunactions + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowRunActionRepetitionProperties struct { + Code *string `json:"code,omitempty"` + Correlation *RunActionCorrelation `json:"correlation,omitempty"` + EndTime *string `json:"endTime,omitempty"` + Error *interface{} `json:"error,omitempty"` + Inputs *interface{} `json:"inputs,omitempty"` + InputsLink *ContentLink `json:"inputsLink,omitempty"` + IterationCount *int64 `json:"iterationCount,omitempty"` + Outputs *interface{} `json:"outputs,omitempty"` + OutputsLink *ContentLink `json:"outputsLink,omitempty"` + RepetitionIndexes *[]RepetitionIndex `json:"repetitionIndexes,omitempty"` + RetryHistory *[]RetryHistory `json:"retryHistory,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *WorkflowStatus `json:"status,omitempty"` + TrackedProperties *interface{} `json:"trackedProperties,omitempty"` + TrackingId *string `json:"trackingId,omitempty"` +} + +func (o *WorkflowRunActionRepetitionProperties) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *WorkflowRunActionRepetitionProperties) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *WorkflowRunActionRepetitionProperties) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *WorkflowRunActionRepetitionProperties) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/predicates.go new file mode 100644 index 000000000000..93ca875c4e0c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/predicates.go @@ -0,0 +1,52 @@ +package workflowrunactions + +type RequestHistoryOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p RequestHistoryOperationPredicate) Matches(input RequestHistory) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type WorkflowRunActionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p WorkflowRunActionOperationPredicate) Matches(input WorkflowRunAction) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/version.go new file mode 100644 index 000000000000..83177937c88f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions/version.go @@ -0,0 +1,12 @@ +package workflowrunactions + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/workflowrunactions/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/README.md new file mode 100644 index 000000000000..4626b0cc0681 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/README.md @@ -0,0 +1,293 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows` Documentation + +The `workflows` SDK allows for interaction with the Azure Resource Manager Service `logic` (API Version `2019-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows" +``` + + +### Client Initialization + +```go +client := workflows.NewWorkflowsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `WorkflowsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := workflows.NewWorkflowID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue") + +payload := workflows.Workflow{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowsClient.Delete` + +```go +ctx := context.TODO() +id := workflows.NewWorkflowID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowsClient.Disable` + +```go +ctx := context.TODO() +id := workflows.NewWorkflowID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue") + +read, err := client.Disable(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowsClient.Enable` + +```go +ctx := context.TODO() +id := workflows.NewWorkflowID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue") + +read, err := client.Enable(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowsClient.GenerateUpgradedDefinition` + +```go +ctx := context.TODO() +id := workflows.NewWorkflowID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue") + +payload := workflows.GenerateUpgradedDefinitionParameters{ + // ... +} + + +read, err := client.GenerateUpgradedDefinition(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowsClient.Get` + +```go +ctx := context.TODO() +id := workflows.NewWorkflowID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := workflows.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id, workflows.DefaultListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id, workflows.DefaultListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WorkflowsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := workflows.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id, workflows.DefaultListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id, workflows.DefaultListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WorkflowsClient.ListCallbackUrl` + +```go +ctx := context.TODO() +id := workflows.NewWorkflowID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue") + +payload := workflows.GetCallbackUrlParameters{ + // ... +} + + +read, err := client.ListCallbackUrl(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowsClient.ListSwagger` + +```go +ctx := context.TODO() +id := workflows.NewWorkflowID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue") + +read, err := client.ListSwagger(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowsClient.Move` + +```go +ctx := context.TODO() +id := workflows.NewWorkflowID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue") + +payload := workflows.WorkflowReference{ + // ... +} + + +if err := client.MoveThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `WorkflowsClient.RegenerateAccessKey` + +```go +ctx := context.TODO() +id := workflows.NewWorkflowID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue") + +payload := workflows.RegenerateActionParameter{ + // ... +} + + +read, err := client.RegenerateAccessKey(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowsClient.Update` + +```go +ctx := context.TODO() +id := workflows.NewWorkflowID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue") + +read, err := client.Update(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowsClient.ValidateByLocation` + +```go +ctx := context.TODO() +id := workflows.NewLocationWorkflowID("12345678-1234-9876-4563-123456789012", "example-resource-group", "locationValue", "workflowValue") + +payload := workflows.Workflow{ + // ... +} + + +read, err := client.ValidateByLocation(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowsClient.ValidateByResourceGroup` + +```go +ctx := context.TODO() +id := workflows.NewWorkflowID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue") + +payload := workflows.Workflow{ + // ... +} + + +read, err := client.ValidateByResourceGroup(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/client.go new file mode 100644 index 000000000000..664f452829cf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/client.go @@ -0,0 +1,18 @@ +package workflows + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowsClient struct { + Client autorest.Client + baseUri string +} + +func NewWorkflowsClientWithBaseURI(endpoint string) WorkflowsClient { + return WorkflowsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/constants.go new file mode 100644 index 000000000000..22274e5ee30c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/constants.go @@ -0,0 +1,279 @@ +package workflows + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyType string + +const ( + KeyTypeNotSpecified KeyType = "NotSpecified" + KeyTypePrimary KeyType = "Primary" + KeyTypeSecondary KeyType = "Secondary" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypeNotSpecified), + string(KeyTypePrimary), + string(KeyTypeSecondary), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "notspecified": KeyTypeNotSpecified, + "primary": KeyTypePrimary, + "secondary": KeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} + +type OpenAuthenticationProviderType string + +const ( + OpenAuthenticationProviderTypeAAD OpenAuthenticationProviderType = "AAD" +) + +func PossibleValuesForOpenAuthenticationProviderType() []string { + return []string{ + string(OpenAuthenticationProviderTypeAAD), + } +} + +func parseOpenAuthenticationProviderType(input string) (*OpenAuthenticationProviderType, error) { + vals := map[string]OpenAuthenticationProviderType{ + "aad": OpenAuthenticationProviderTypeAAD, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OpenAuthenticationProviderType(input) + return &out, nil +} + +type ParameterType string + +const ( + ParameterTypeArray ParameterType = "Array" + ParameterTypeBool ParameterType = "Bool" + ParameterTypeFloat ParameterType = "Float" + ParameterTypeInt ParameterType = "Int" + ParameterTypeNotSpecified ParameterType = "NotSpecified" + ParameterTypeObject ParameterType = "Object" + ParameterTypeSecureObject ParameterType = "SecureObject" + ParameterTypeSecureString ParameterType = "SecureString" + ParameterTypeString ParameterType = "String" +) + +func PossibleValuesForParameterType() []string { + return []string{ + string(ParameterTypeArray), + string(ParameterTypeBool), + string(ParameterTypeFloat), + string(ParameterTypeInt), + string(ParameterTypeNotSpecified), + string(ParameterTypeObject), + string(ParameterTypeSecureObject), + string(ParameterTypeSecureString), + string(ParameterTypeString), + } +} + +func parseParameterType(input string) (*ParameterType, error) { + vals := map[string]ParameterType{ + "array": ParameterTypeArray, + "bool": ParameterTypeBool, + "float": ParameterTypeFloat, + "int": ParameterTypeInt, + "notspecified": ParameterTypeNotSpecified, + "object": ParameterTypeObject, + "secureobject": ParameterTypeSecureObject, + "securestring": ParameterTypeSecureString, + "string": ParameterTypeString, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ParameterType(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameBasic SkuName = "Basic" + SkuNameFree SkuName = "Free" + SkuNameNotSpecified SkuName = "NotSpecified" + SkuNamePremium SkuName = "Premium" + SkuNameShared SkuName = "Shared" + SkuNameStandard SkuName = "Standard" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameBasic), + string(SkuNameFree), + string(SkuNameNotSpecified), + string(SkuNamePremium), + string(SkuNameShared), + string(SkuNameStandard), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "basic": SkuNameBasic, + "free": SkuNameFree, + "notspecified": SkuNameNotSpecified, + "premium": SkuNamePremium, + "shared": SkuNameShared, + "standard": SkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} + +type WorkflowProvisioningState string + +const ( + WorkflowProvisioningStateAccepted WorkflowProvisioningState = "Accepted" + WorkflowProvisioningStateCanceled WorkflowProvisioningState = "Canceled" + WorkflowProvisioningStateCompleted WorkflowProvisioningState = "Completed" + WorkflowProvisioningStateCreated WorkflowProvisioningState = "Created" + WorkflowProvisioningStateCreating WorkflowProvisioningState = "Creating" + WorkflowProvisioningStateDeleted WorkflowProvisioningState = "Deleted" + WorkflowProvisioningStateDeleting WorkflowProvisioningState = "Deleting" + WorkflowProvisioningStateFailed WorkflowProvisioningState = "Failed" + WorkflowProvisioningStateInProgress WorkflowProvisioningState = "InProgress" + WorkflowProvisioningStateMoving WorkflowProvisioningState = "Moving" + WorkflowProvisioningStateNotSpecified WorkflowProvisioningState = "NotSpecified" + WorkflowProvisioningStatePending WorkflowProvisioningState = "Pending" + WorkflowProvisioningStateReady WorkflowProvisioningState = "Ready" + WorkflowProvisioningStateRegistered WorkflowProvisioningState = "Registered" + WorkflowProvisioningStateRegistering WorkflowProvisioningState = "Registering" + WorkflowProvisioningStateRenewing WorkflowProvisioningState = "Renewing" + WorkflowProvisioningStateRunning WorkflowProvisioningState = "Running" + WorkflowProvisioningStateSucceeded WorkflowProvisioningState = "Succeeded" + WorkflowProvisioningStateUnregistered WorkflowProvisioningState = "Unregistered" + WorkflowProvisioningStateUnregistering WorkflowProvisioningState = "Unregistering" + WorkflowProvisioningStateUpdating WorkflowProvisioningState = "Updating" + WorkflowProvisioningStateWaiting WorkflowProvisioningState = "Waiting" +) + +func PossibleValuesForWorkflowProvisioningState() []string { + return []string{ + string(WorkflowProvisioningStateAccepted), + string(WorkflowProvisioningStateCanceled), + string(WorkflowProvisioningStateCompleted), + string(WorkflowProvisioningStateCreated), + string(WorkflowProvisioningStateCreating), + string(WorkflowProvisioningStateDeleted), + string(WorkflowProvisioningStateDeleting), + string(WorkflowProvisioningStateFailed), + string(WorkflowProvisioningStateInProgress), + string(WorkflowProvisioningStateMoving), + string(WorkflowProvisioningStateNotSpecified), + string(WorkflowProvisioningStatePending), + string(WorkflowProvisioningStateReady), + string(WorkflowProvisioningStateRegistered), + string(WorkflowProvisioningStateRegistering), + string(WorkflowProvisioningStateRenewing), + string(WorkflowProvisioningStateRunning), + string(WorkflowProvisioningStateSucceeded), + string(WorkflowProvisioningStateUnregistered), + string(WorkflowProvisioningStateUnregistering), + string(WorkflowProvisioningStateUpdating), + string(WorkflowProvisioningStateWaiting), + } +} + +func parseWorkflowProvisioningState(input string) (*WorkflowProvisioningState, error) { + vals := map[string]WorkflowProvisioningState{ + "accepted": WorkflowProvisioningStateAccepted, + "canceled": WorkflowProvisioningStateCanceled, + "completed": WorkflowProvisioningStateCompleted, + "created": WorkflowProvisioningStateCreated, + "creating": WorkflowProvisioningStateCreating, + "deleted": WorkflowProvisioningStateDeleted, + "deleting": WorkflowProvisioningStateDeleting, + "failed": WorkflowProvisioningStateFailed, + "inprogress": WorkflowProvisioningStateInProgress, + "moving": WorkflowProvisioningStateMoving, + "notspecified": WorkflowProvisioningStateNotSpecified, + "pending": WorkflowProvisioningStatePending, + "ready": WorkflowProvisioningStateReady, + "registered": WorkflowProvisioningStateRegistered, + "registering": WorkflowProvisioningStateRegistering, + "renewing": WorkflowProvisioningStateRenewing, + "running": WorkflowProvisioningStateRunning, + "succeeded": WorkflowProvisioningStateSucceeded, + "unregistered": WorkflowProvisioningStateUnregistered, + "unregistering": WorkflowProvisioningStateUnregistering, + "updating": WorkflowProvisioningStateUpdating, + "waiting": WorkflowProvisioningStateWaiting, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkflowProvisioningState(input) + return &out, nil +} + +type WorkflowState string + +const ( + WorkflowStateCompleted WorkflowState = "Completed" + WorkflowStateDeleted WorkflowState = "Deleted" + WorkflowStateDisabled WorkflowState = "Disabled" + WorkflowStateEnabled WorkflowState = "Enabled" + WorkflowStateNotSpecified WorkflowState = "NotSpecified" + WorkflowStateSuspended WorkflowState = "Suspended" +) + +func PossibleValuesForWorkflowState() []string { + return []string{ + string(WorkflowStateCompleted), + string(WorkflowStateDeleted), + string(WorkflowStateDisabled), + string(WorkflowStateEnabled), + string(WorkflowStateNotSpecified), + string(WorkflowStateSuspended), + } +} + +func parseWorkflowState(input string) (*WorkflowState, error) { + vals := map[string]WorkflowState{ + "completed": WorkflowStateCompleted, + "deleted": WorkflowStateDeleted, + "disabled": WorkflowStateDisabled, + "enabled": WorkflowStateEnabled, + "notspecified": WorkflowStateNotSpecified, + "suspended": WorkflowStateSuspended, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkflowState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/id_locationworkflow.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/id_locationworkflow.go new file mode 100644 index 000000000000..e863bb2542a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/id_locationworkflow.go @@ -0,0 +1,137 @@ +package workflows + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LocationWorkflowId{} + +// LocationWorkflowId is a struct representing the Resource ID for a Location Workflow +type LocationWorkflowId struct { + SubscriptionId string + ResourceGroupName string + LocationName string + WorkflowName string +} + +// NewLocationWorkflowID returns a new LocationWorkflowId struct +func NewLocationWorkflowID(subscriptionId string, resourceGroupName string, locationName string, workflowName string) LocationWorkflowId { + return LocationWorkflowId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + LocationName: locationName, + WorkflowName: workflowName, + } +} + +// ParseLocationWorkflowID parses 'input' into a LocationWorkflowId +func ParseLocationWorkflowID(input string) (*LocationWorkflowId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationWorkflowId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationWorkflowId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLocationWorkflowIDInsensitively parses 'input' case-insensitively into a LocationWorkflowId +// note: this method should only be used for API response data and not user input +func ParseLocationWorkflowIDInsensitively(input string) (*LocationWorkflowId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationWorkflowId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationWorkflowId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLocationWorkflowID checks that 'input' can be parsed as a Location Workflow ID +func ValidateLocationWorkflowID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationWorkflowID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location Workflow ID +func (id LocationWorkflowId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/locations/%s/workflows/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.LocationName, id.WorkflowName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location Workflow ID +func (id LocationWorkflowId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), + resourceids.StaticSegment("staticWorkflows", "workflows", "workflows"), + resourceids.UserSpecifiedSegment("workflowName", "workflowValue"), + } +} + +// String returns a human-readable description of this Location Workflow ID +func (id LocationWorkflowId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Workflow Name: %q", id.WorkflowName), + } + return fmt.Sprintf("Location Workflow (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/id_workflow.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/id_workflow.go new file mode 100644 index 000000000000..6d9a92c194e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/id_workflow.go @@ -0,0 +1,124 @@ +package workflows + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = WorkflowId{} + +// WorkflowId is a struct representing the Resource ID for a Workflow +type WorkflowId struct { + SubscriptionId string + ResourceGroupName string + WorkflowName string +} + +// NewWorkflowID returns a new WorkflowId struct +func NewWorkflowID(subscriptionId string, resourceGroupName string, workflowName string) WorkflowId { + return WorkflowId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkflowName: workflowName, + } +} + +// ParseWorkflowID parses 'input' into a WorkflowId +func ParseWorkflowID(input string) (*WorkflowId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkflowId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkflowId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseWorkflowIDInsensitively parses 'input' case-insensitively into a WorkflowId +// note: this method should only be used for API response data and not user input +func ParseWorkflowIDInsensitively(input string) (*WorkflowId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkflowId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkflowId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateWorkflowID checks that 'input' can be parsed as a Workflow ID +func ValidateWorkflowID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseWorkflowID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workflow ID +func (id WorkflowId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/workflows/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkflowName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workflow ID +func (id WorkflowId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticWorkflows", "workflows", "workflows"), + resourceids.UserSpecifiedSegment("workflowName", "workflowValue"), + } +} + +// String returns a human-readable description of this Workflow ID +func (id WorkflowId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workflow Name: %q", id.WorkflowName), + } + return fmt.Sprintf("Workflow (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_createorupdate_autorest.go new file mode 100644 index 000000000000..92336ba2b96f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package workflows + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Workflow +} + +// CreateOrUpdate ... +func (c WorkflowsClient) CreateOrUpdate(ctx context.Context, id WorkflowId, input Workflow) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c WorkflowsClient) preparerForCreateOrUpdate(ctx context.Context, id WorkflowId, input Workflow) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c WorkflowsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_delete_autorest.go new file mode 100644 index 000000000000..68459e432ca9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_delete_autorest.go @@ -0,0 +1,66 @@ +package workflows + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c WorkflowsClient) Delete(ctx context.Context, id WorkflowId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c WorkflowsClient) preparerForDelete(ctx context.Context, id WorkflowId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c WorkflowsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_disable_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_disable_autorest.go new file mode 100644 index 000000000000..f90b58f92f38 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_disable_autorest.go @@ -0,0 +1,67 @@ +package workflows + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DisableOperationResponse struct { + HttpResponse *http.Response +} + +// Disable ... +func (c WorkflowsClient) Disable(ctx context.Context, id WorkflowId) (result DisableOperationResponse, err error) { + req, err := c.preparerForDisable(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Disable", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Disable", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDisable(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Disable", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDisable prepares the Disable request. +func (c WorkflowsClient) preparerForDisable(ctx context.Context, id WorkflowId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/disable", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDisable handles the response to the Disable request. The method always +// closes the http.Response Body. +func (c WorkflowsClient) responderForDisable(resp *http.Response) (result DisableOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_enable_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_enable_autorest.go new file mode 100644 index 000000000000..e0e3edcc660a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_enable_autorest.go @@ -0,0 +1,67 @@ +package workflows + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnableOperationResponse struct { + HttpResponse *http.Response +} + +// Enable ... +func (c WorkflowsClient) Enable(ctx context.Context, id WorkflowId) (result EnableOperationResponse, err error) { + req, err := c.preparerForEnable(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Enable", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Enable", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForEnable(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Enable", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForEnable prepares the Enable request. +func (c WorkflowsClient) preparerForEnable(ctx context.Context, id WorkflowId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/enable", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForEnable handles the response to the Enable request. The method always +// closes the http.Response Body. +func (c WorkflowsClient) responderForEnable(resp *http.Response) (result EnableOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_generateupgradeddefinition_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_generateupgradeddefinition_autorest.go new file mode 100644 index 000000000000..e1426562383e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_generateupgradeddefinition_autorest.go @@ -0,0 +1,70 @@ +package workflows + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GenerateUpgradedDefinitionOperationResponse struct { + HttpResponse *http.Response + Model *interface{} +} + +// GenerateUpgradedDefinition ... +func (c WorkflowsClient) GenerateUpgradedDefinition(ctx context.Context, id WorkflowId, input GenerateUpgradedDefinitionParameters) (result GenerateUpgradedDefinitionOperationResponse, err error) { + req, err := c.preparerForGenerateUpgradedDefinition(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "GenerateUpgradedDefinition", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "GenerateUpgradedDefinition", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGenerateUpgradedDefinition(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "GenerateUpgradedDefinition", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGenerateUpgradedDefinition prepares the GenerateUpgradedDefinition request. +func (c WorkflowsClient) preparerForGenerateUpgradedDefinition(ctx context.Context, id WorkflowId, input GenerateUpgradedDefinitionParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/generateUpgradedDefinition", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGenerateUpgradedDefinition handles the response to the GenerateUpgradedDefinition request. The method always +// closes the http.Response Body. +func (c WorkflowsClient) responderForGenerateUpgradedDefinition(resp *http.Response) (result GenerateUpgradedDefinitionOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_get_autorest.go new file mode 100644 index 000000000000..ea4ca1978e60 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_get_autorest.go @@ -0,0 +1,68 @@ +package workflows + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Workflow +} + +// Get ... +func (c WorkflowsClient) Get(ctx context.Context, id WorkflowId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c WorkflowsClient) preparerForGet(ctx context.Context, id WorkflowId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c WorkflowsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..8ef6f8f7dfde --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_listbyresourcegroup_autorest.go @@ -0,0 +1,221 @@ +package workflows + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Workflow + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Workflow +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByResourceGroupOperationOptions struct { + Filter *string + Top *int64 +} + +func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { + return ListByResourceGroupOperationOptions{} +} + +func (o ListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListByResourceGroup ... +func (c WorkflowsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c WorkflowsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Logic/workflows", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c WorkflowsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c WorkflowsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Workflow `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c WorkflowsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, WorkflowOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkflowsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate WorkflowOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Workflow, 0) + + page, err := c.ListByResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_listbysubscription_autorest.go new file mode 100644 index 000000000000..950780ea2d37 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_listbysubscription_autorest.go @@ -0,0 +1,221 @@ +package workflows + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Workflow + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []Workflow +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListBySubscriptionOperationOptions struct { + Filter *string + Top *int64 +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListBySubscription ... +func (c WorkflowsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c WorkflowsClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Logic/workflows", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c WorkflowsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c WorkflowsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Workflow `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c WorkflowsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, WorkflowOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkflowsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions, predicate WorkflowOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]Workflow, 0) + + page, err := c.ListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_listcallbackurl_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_listcallbackurl_autorest.go new file mode 100644 index 000000000000..9f8d0afe5b81 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_listcallbackurl_autorest.go @@ -0,0 +1,70 @@ +package workflows + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListCallbackUrlOperationResponse struct { + HttpResponse *http.Response + Model *WorkflowTriggerCallbackUrl +} + +// ListCallbackUrl ... +func (c WorkflowsClient) ListCallbackUrl(ctx context.Context, id WorkflowId, input GetCallbackUrlParameters) (result ListCallbackUrlOperationResponse, err error) { + req, err := c.preparerForListCallbackUrl(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListCallbackUrl", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListCallbackUrl", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListCallbackUrl(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListCallbackUrl", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListCallbackUrl prepares the ListCallbackUrl request. +func (c WorkflowsClient) preparerForListCallbackUrl(ctx context.Context, id WorkflowId, input GetCallbackUrlParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listCallbackUrl", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListCallbackUrl handles the response to the ListCallbackUrl request. The method always +// closes the http.Response Body. +func (c WorkflowsClient) responderForListCallbackUrl(resp *http.Response) (result ListCallbackUrlOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_listswagger_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_listswagger_autorest.go new file mode 100644 index 000000000000..fc88858b73a9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_listswagger_autorest.go @@ -0,0 +1,69 @@ +package workflows + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSwaggerOperationResponse struct { + HttpResponse *http.Response + Model *interface{} +} + +// ListSwagger ... +func (c WorkflowsClient) ListSwagger(ctx context.Context, id WorkflowId) (result ListSwaggerOperationResponse, err error) { + req, err := c.preparerForListSwagger(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListSwagger", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListSwagger", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListSwagger(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ListSwagger", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListSwagger prepares the ListSwagger request. +func (c WorkflowsClient) preparerForListSwagger(ctx context.Context, id WorkflowId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listSwagger", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListSwagger handles the response to the ListSwagger request. The method always +// closes the http.Response Body. +func (c WorkflowsClient) responderForListSwagger(resp *http.Response) (result ListSwaggerOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_move_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_move_autorest.go new file mode 100644 index 000000000000..341b8b4d5b35 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_move_autorest.go @@ -0,0 +1,79 @@ +package workflows + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MoveOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Move ... +func (c WorkflowsClient) Move(ctx context.Context, id WorkflowId, input WorkflowReference) (result MoveOperationResponse, err error) { + req, err := c.preparerForMove(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Move", nil, "Failure preparing request") + return + } + + result, err = c.senderForMove(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Move", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// MoveThenPoll performs Move then polls until it's completed +func (c WorkflowsClient) MoveThenPoll(ctx context.Context, id WorkflowId, input WorkflowReference) error { + result, err := c.Move(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Move: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Move: %+v", err) + } + + return nil +} + +// preparerForMove prepares the Move request. +func (c WorkflowsClient) preparerForMove(ctx context.Context, id WorkflowId, input WorkflowReference) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/move", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForMove sends the Move request. The method will close the +// http.Response Body if it receives an error. +func (c WorkflowsClient) senderForMove(ctx context.Context, req *http.Request) (future MoveOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_regenerateaccesskey_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_regenerateaccesskey_autorest.go new file mode 100644 index 000000000000..3402ade6efd4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_regenerateaccesskey_autorest.go @@ -0,0 +1,68 @@ +package workflows + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateAccessKeyOperationResponse struct { + HttpResponse *http.Response +} + +// RegenerateAccessKey ... +func (c WorkflowsClient) RegenerateAccessKey(ctx context.Context, id WorkflowId, input RegenerateActionParameter) (result RegenerateAccessKeyOperationResponse, err error) { + req, err := c.preparerForRegenerateAccessKey(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "RegenerateAccessKey", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "RegenerateAccessKey", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRegenerateAccessKey(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "RegenerateAccessKey", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRegenerateAccessKey prepares the RegenerateAccessKey request. +func (c WorkflowsClient) preparerForRegenerateAccessKey(ctx context.Context, id WorkflowId, input RegenerateActionParameter) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateAccessKey", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRegenerateAccessKey handles the response to the RegenerateAccessKey request. The method always +// closes the http.Response Body. +func (c WorkflowsClient) responderForRegenerateAccessKey(resp *http.Response) (result RegenerateAccessKeyOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_update_autorest.go new file mode 100644 index 000000000000..b6cec9827309 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_update_autorest.go @@ -0,0 +1,68 @@ +package workflows + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Workflow +} + +// Update ... +func (c WorkflowsClient) Update(ctx context.Context, id WorkflowId) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c WorkflowsClient) preparerForUpdate(ctx context.Context, id WorkflowId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c WorkflowsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_validatebylocation_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_validatebylocation_autorest.go new file mode 100644 index 000000000000..d7c51c01c433 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_validatebylocation_autorest.go @@ -0,0 +1,68 @@ +package workflows + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateByLocationOperationResponse struct { + HttpResponse *http.Response +} + +// ValidateByLocation ... +func (c WorkflowsClient) ValidateByLocation(ctx context.Context, id LocationWorkflowId, input Workflow) (result ValidateByLocationOperationResponse, err error) { + req, err := c.preparerForValidateByLocation(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ValidateByLocation", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ValidateByLocation", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForValidateByLocation(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ValidateByLocation", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForValidateByLocation prepares the ValidateByLocation request. +func (c WorkflowsClient) preparerForValidateByLocation(ctx context.Context, id LocationWorkflowId, input Workflow) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/validate", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForValidateByLocation handles the response to the ValidateByLocation request. The method always +// closes the http.Response Body. +func (c WorkflowsClient) responderForValidateByLocation(resp *http.Response) (result ValidateByLocationOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_validatebyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_validatebyresourcegroup_autorest.go new file mode 100644 index 000000000000..947e7ac96308 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/method_validatebyresourcegroup_autorest.go @@ -0,0 +1,68 @@ +package workflows + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateByResourceGroupOperationResponse struct { + HttpResponse *http.Response +} + +// ValidateByResourceGroup ... +func (c WorkflowsClient) ValidateByResourceGroup(ctx context.Context, id WorkflowId, input Workflow) (result ValidateByResourceGroupOperationResponse, err error) { + req, err := c.preparerForValidateByResourceGroup(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ValidateByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ValidateByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForValidateByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflows.WorkflowsClient", "ValidateByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForValidateByResourceGroup prepares the ValidateByResourceGroup request. +func (c WorkflowsClient) preparerForValidateByResourceGroup(ctx context.Context, id WorkflowId, input Workflow) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/validate", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForValidateByResourceGroup handles the response to the ValidateByResourceGroup request. The method always +// closes the http.Response Body. +func (c WorkflowsClient) responderForValidateByResourceGroup(resp *http.Response) (result ValidateByResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_flowaccesscontrolconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_flowaccesscontrolconfiguration.go new file mode 100644 index 000000000000..e110c491fc29 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_flowaccesscontrolconfiguration.go @@ -0,0 +1,11 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FlowAccessControlConfiguration struct { + Actions *FlowAccessControlConfigurationPolicy `json:"actions,omitempty"` + Contents *FlowAccessControlConfigurationPolicy `json:"contents,omitempty"` + Triggers *FlowAccessControlConfigurationPolicy `json:"triggers,omitempty"` + WorkflowManagement *FlowAccessControlConfigurationPolicy `json:"workflowManagement,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_flowaccesscontrolconfigurationpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_flowaccesscontrolconfigurationpolicy.go new file mode 100644 index 000000000000..e14581b5ddcc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_flowaccesscontrolconfigurationpolicy.go @@ -0,0 +1,9 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FlowAccessControlConfigurationPolicy struct { + AllowedCallerIPAddresses *[]IPAddressRange `json:"allowedCallerIpAddresses,omitempty"` + OpenAuthenticationPolicies *OpenAuthenticationAccessPolicies `json:"openAuthenticationPolicies,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_flowendpoints.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_flowendpoints.go new file mode 100644 index 000000000000..ab677222e7a7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_flowendpoints.go @@ -0,0 +1,9 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FlowEndpoints struct { + AccessEndpointIPAddresses *[]IPAddress `json:"accessEndpointIpAddresses,omitempty"` + OutgoingIPAddresses *[]IPAddress `json:"outgoingIpAddresses,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_flowendpointsconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_flowendpointsconfiguration.go new file mode 100644 index 000000000000..19393db48abe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_flowendpointsconfiguration.go @@ -0,0 +1,9 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FlowEndpointsConfiguration struct { + Connector *FlowEndpoints `json:"connector,omitempty"` + Workflow *FlowEndpoints `json:"workflow,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_generateupgradeddefinitionparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_generateupgradeddefinitionparameters.go new file mode 100644 index 000000000000..25c53e5e5ee0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_generateupgradeddefinitionparameters.go @@ -0,0 +1,8 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GenerateUpgradedDefinitionParameters struct { + TargetSchemaVersion *string `json:"targetSchemaVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_getcallbackurlparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_getcallbackurlparameters.go new file mode 100644 index 000000000000..13ebb143331c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_getcallbackurlparameters.go @@ -0,0 +1,27 @@ +package workflows + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetCallbackUrlParameters struct { + KeyType *KeyType `json:"keyType,omitempty"` + NotAfter *string `json:"notAfter,omitempty"` +} + +func (o *GetCallbackUrlParameters) GetNotAfterAsTime() (*time.Time, error) { + if o.NotAfter == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NotAfter, "2006-01-02T15:04:05Z07:00") +} + +func (o *GetCallbackUrlParameters) SetNotAfterAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NotAfter = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_ipaddress.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_ipaddress.go new file mode 100644 index 000000000000..0d10e34c4f83 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_ipaddress.go @@ -0,0 +1,8 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IPAddress struct { + Address *string `json:"address,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_ipaddressrange.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_ipaddressrange.go new file mode 100644 index 000000000000..347495131a89 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_ipaddressrange.go @@ -0,0 +1,8 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IPAddressRange struct { + AddressRange *string `json:"addressRange,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_openauthenticationaccesspolicies.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_openauthenticationaccesspolicies.go new file mode 100644 index 000000000000..a4b8fac59707 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_openauthenticationaccesspolicies.go @@ -0,0 +1,8 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OpenAuthenticationAccessPolicies struct { + Policies *map[string]OpenAuthenticationAccessPolicy `json:"policies,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_openauthenticationaccesspolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_openauthenticationaccesspolicy.go new file mode 100644 index 000000000000..cf1295967192 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_openauthenticationaccesspolicy.go @@ -0,0 +1,9 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OpenAuthenticationAccessPolicy struct { + Claims *[]OpenAuthenticationPolicyClaim `json:"claims,omitempty"` + Type *OpenAuthenticationProviderType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_openauthenticationpolicyclaim.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_openauthenticationpolicyclaim.go new file mode 100644 index 000000000000..3ab50a9ca9bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_openauthenticationpolicyclaim.go @@ -0,0 +1,9 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OpenAuthenticationPolicyClaim struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_regenerateactionparameter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_regenerateactionparameter.go new file mode 100644 index 000000000000..a01c112c1c1e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_regenerateactionparameter.go @@ -0,0 +1,8 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateActionParameter struct { + KeyType *KeyType `json:"keyType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_resourcereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_resourcereference.go new file mode 100644 index 000000000000..8541ecad8634 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_resourcereference.go @@ -0,0 +1,10 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceReference struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_sku.go new file mode 100644 index 000000000000..a9e1220dbc77 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_sku.go @@ -0,0 +1,9 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name SkuName `json:"name"` + Plan *ResourceReference `json:"plan,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflow.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflow.go new file mode 100644 index 000000000000..6e88e130edda --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflow.go @@ -0,0 +1,18 @@ +package workflows + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Workflow struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemOrUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *WorkflowProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflowparameter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflowparameter.go new file mode 100644 index 000000000000..c79cf198562e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflowparameter.go @@ -0,0 +1,11 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowParameter struct { + Description *string `json:"description,omitempty"` + Metadata *interface{} `json:"metadata,omitempty"` + Type *ParameterType `json:"type,omitempty"` + Value *interface{} `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflowproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflowproperties.go new file mode 100644 index 000000000000..9ef10ae99712 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflowproperties.go @@ -0,0 +1,50 @@ +package workflows + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowProperties struct { + AccessControl *FlowAccessControlConfiguration `json:"accessControl,omitempty"` + AccessEndpoint *string `json:"accessEndpoint,omitempty"` + ChangedTime *string `json:"changedTime,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` + Definition *interface{} `json:"definition,omitempty"` + EndpointsConfiguration *FlowEndpointsConfiguration `json:"endpointsConfiguration,omitempty"` + IntegrationAccount *ResourceReference `json:"integrationAccount,omitempty"` + IntegrationServiceEnvironment *ResourceReference `json:"integrationServiceEnvironment,omitempty"` + Parameters *map[string]WorkflowParameter `json:"parameters,omitempty"` + ProvisioningState *WorkflowProvisioningState `json:"provisioningState,omitempty"` + Sku *Sku `json:"sku,omitempty"` + State *WorkflowState `json:"state,omitempty"` + Version *string `json:"version,omitempty"` +} + +func (o *WorkflowProperties) GetChangedTimeAsTime() (*time.Time, error) { + if o.ChangedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ChangedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *WorkflowProperties) SetChangedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ChangedTime = &formatted +} + +func (o *WorkflowProperties) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *WorkflowProperties) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflowreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflowreference.go new file mode 100644 index 000000000000..d0fab9bab989 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflowreference.go @@ -0,0 +1,10 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowReference struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflowtriggercallbackurl.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflowtriggercallbackurl.go new file mode 100644 index 000000000000..4b5d876494ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflowtriggercallbackurl.go @@ -0,0 +1,13 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerCallbackUrl struct { + BasePath *string `json:"basePath,omitempty"` + Method *string `json:"method,omitempty"` + Queries *WorkflowTriggerListCallbackUrlQueries `json:"queries,omitempty"` + RelativePath *string `json:"relativePath,omitempty"` + RelativePathParameters *[]string `json:"relativePathParameters,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflowtriggerlistcallbackurlqueries.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflowtriggerlistcallbackurlqueries.go new file mode 100644 index 000000000000..b79c9069d948 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/model_workflowtriggerlistcallbackurlqueries.go @@ -0,0 +1,12 @@ +package workflows + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerListCallbackUrlQueries struct { + ApiVersion *string `json:"api-version,omitempty"` + Se *string `json:"se,omitempty"` + Sig *string `json:"sig,omitempty"` + Sp *string `json:"sp,omitempty"` + Sv *string `json:"sv,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/predicates.go new file mode 100644 index 000000000000..d6c10518766a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/predicates.go @@ -0,0 +1,29 @@ +package workflows + +type WorkflowOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p WorkflowOperationPredicate) Matches(input Workflow) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/version.go new file mode 100644 index 000000000000..8658baf6a6f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows/version.go @@ -0,0 +1,12 @@ +package workflows + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/workflows/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/README.md new file mode 100644 index 000000000000..55f3a38ed7aa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/README.md @@ -0,0 +1,159 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers` Documentation + +The `workflowtriggers` SDK allows for interaction with the Azure Resource Manager Service `logic` (API Version `2019-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers" +``` + + +### Client Initialization + +```go +client := workflowtriggers.NewWorkflowTriggersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `WorkflowTriggersClient.Get` + +```go +ctx := context.TODO() +id := workflowtriggers.NewTriggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "triggerValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowTriggersClient.GetSchemaJson` + +```go +ctx := context.TODO() +id := workflowtriggers.NewTriggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "triggerValue") + +read, err := client.GetSchemaJson(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowTriggersClient.List` + +```go +ctx := context.TODO() +id := workflowtriggers.NewWorkflowID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue") + +// alternatively `client.List(ctx, id, workflowtriggers.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, workflowtriggers.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WorkflowTriggersClient.ListCallbackUrl` + +```go +ctx := context.TODO() +id := workflowtriggers.NewTriggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "triggerValue") + +read, err := client.ListCallbackUrl(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowTriggersClient.Reset` + +```go +ctx := context.TODO() +id := workflowtriggers.NewTriggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "triggerValue") + +read, err := client.Reset(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowTriggersClient.Run` + +```go +ctx := context.TODO() +id := workflowtriggers.NewTriggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "triggerValue") + +read, err := client.Run(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowTriggersClient.SetState` + +```go +ctx := context.TODO() +id := workflowtriggers.NewTriggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "triggerValue") + +payload := workflowtriggers.SetTriggerStateActionDefinition{ + // ... +} + + +read, err := client.SetState(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkflowTriggersClient.WorkflowVersionTriggersListCallbackUrl` + +```go +ctx := context.TODO() +id := workflowtriggers.NewVersionTriggerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workflowValue", "versionIdValue", "triggerValue") + +payload := workflowtriggers.GetCallbackUrlParameters{ + // ... +} + + +read, err := client.WorkflowVersionTriggersListCallbackUrl(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/client.go new file mode 100644 index 000000000000..09e2d07ce68e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/client.go @@ -0,0 +1,18 @@ +package workflowtriggers + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggersClient struct { + Client autorest.Client + baseUri string +} + +func NewWorkflowTriggersClientWithBaseURI(endpoint string) WorkflowTriggersClient { + return WorkflowTriggersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/constants.go new file mode 100644 index 000000000000..739ac07566de --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/constants.go @@ -0,0 +1,346 @@ +package workflowtriggers + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DayOfWeek string + +const ( + DayOfWeekFriday DayOfWeek = "Friday" + DayOfWeekMonday DayOfWeek = "Monday" + DayOfWeekSaturday DayOfWeek = "Saturday" + DayOfWeekSunday DayOfWeek = "Sunday" + DayOfWeekThursday DayOfWeek = "Thursday" + DayOfWeekTuesday DayOfWeek = "Tuesday" + DayOfWeekWednesday DayOfWeek = "Wednesday" +) + +func PossibleValuesForDayOfWeek() []string { + return []string{ + string(DayOfWeekFriday), + string(DayOfWeekMonday), + string(DayOfWeekSaturday), + string(DayOfWeekSunday), + string(DayOfWeekThursday), + string(DayOfWeekTuesday), + string(DayOfWeekWednesday), + } +} + +func parseDayOfWeek(input string) (*DayOfWeek, error) { + vals := map[string]DayOfWeek{ + "friday": DayOfWeekFriday, + "monday": DayOfWeekMonday, + "saturday": DayOfWeekSaturday, + "sunday": DayOfWeekSunday, + "thursday": DayOfWeekThursday, + "tuesday": DayOfWeekTuesday, + "wednesday": DayOfWeekWednesday, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DayOfWeek(input) + return &out, nil +} + +type DaysOfWeek string + +const ( + DaysOfWeekFriday DaysOfWeek = "Friday" + DaysOfWeekMonday DaysOfWeek = "Monday" + DaysOfWeekSaturday DaysOfWeek = "Saturday" + DaysOfWeekSunday DaysOfWeek = "Sunday" + DaysOfWeekThursday DaysOfWeek = "Thursday" + DaysOfWeekTuesday DaysOfWeek = "Tuesday" + DaysOfWeekWednesday DaysOfWeek = "Wednesday" +) + +func PossibleValuesForDaysOfWeek() []string { + return []string{ + string(DaysOfWeekFriday), + string(DaysOfWeekMonday), + string(DaysOfWeekSaturday), + string(DaysOfWeekSunday), + string(DaysOfWeekThursday), + string(DaysOfWeekTuesday), + string(DaysOfWeekWednesday), + } +} + +func parseDaysOfWeek(input string) (*DaysOfWeek, error) { + vals := map[string]DaysOfWeek{ + "friday": DaysOfWeekFriday, + "monday": DaysOfWeekMonday, + "saturday": DaysOfWeekSaturday, + "sunday": DaysOfWeekSunday, + "thursday": DaysOfWeekThursday, + "tuesday": DaysOfWeekTuesday, + "wednesday": DaysOfWeekWednesday, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DaysOfWeek(input) + return &out, nil +} + +type KeyType string + +const ( + KeyTypeNotSpecified KeyType = "NotSpecified" + KeyTypePrimary KeyType = "Primary" + KeyTypeSecondary KeyType = "Secondary" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypeNotSpecified), + string(KeyTypePrimary), + string(KeyTypeSecondary), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "notspecified": KeyTypeNotSpecified, + "primary": KeyTypePrimary, + "secondary": KeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} + +type RecurrenceFrequency string + +const ( + RecurrenceFrequencyDay RecurrenceFrequency = "Day" + RecurrenceFrequencyHour RecurrenceFrequency = "Hour" + RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" + RecurrenceFrequencyMonth RecurrenceFrequency = "Month" + RecurrenceFrequencyNotSpecified RecurrenceFrequency = "NotSpecified" + RecurrenceFrequencySecond RecurrenceFrequency = "Second" + RecurrenceFrequencyWeek RecurrenceFrequency = "Week" + RecurrenceFrequencyYear RecurrenceFrequency = "Year" +) + +func PossibleValuesForRecurrenceFrequency() []string { + return []string{ + string(RecurrenceFrequencyDay), + string(RecurrenceFrequencyHour), + string(RecurrenceFrequencyMinute), + string(RecurrenceFrequencyMonth), + string(RecurrenceFrequencyNotSpecified), + string(RecurrenceFrequencySecond), + string(RecurrenceFrequencyWeek), + string(RecurrenceFrequencyYear), + } +} + +func parseRecurrenceFrequency(input string) (*RecurrenceFrequency, error) { + vals := map[string]RecurrenceFrequency{ + "day": RecurrenceFrequencyDay, + "hour": RecurrenceFrequencyHour, + "minute": RecurrenceFrequencyMinute, + "month": RecurrenceFrequencyMonth, + "notspecified": RecurrenceFrequencyNotSpecified, + "second": RecurrenceFrequencySecond, + "week": RecurrenceFrequencyWeek, + "year": RecurrenceFrequencyYear, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RecurrenceFrequency(input) + return &out, nil +} + +type WorkflowState string + +const ( + WorkflowStateCompleted WorkflowState = "Completed" + WorkflowStateDeleted WorkflowState = "Deleted" + WorkflowStateDisabled WorkflowState = "Disabled" + WorkflowStateEnabled WorkflowState = "Enabled" + WorkflowStateNotSpecified WorkflowState = "NotSpecified" + WorkflowStateSuspended WorkflowState = "Suspended" +) + +func PossibleValuesForWorkflowState() []string { + return []string{ + string(WorkflowStateCompleted), + string(WorkflowStateDeleted), + string(WorkflowStateDisabled), + string(WorkflowStateEnabled), + string(WorkflowStateNotSpecified), + string(WorkflowStateSuspended), + } +} + +func parseWorkflowState(input string) (*WorkflowState, error) { + vals := map[string]WorkflowState{ + "completed": WorkflowStateCompleted, + "deleted": WorkflowStateDeleted, + "disabled": WorkflowStateDisabled, + "enabled": WorkflowStateEnabled, + "notspecified": WorkflowStateNotSpecified, + "suspended": WorkflowStateSuspended, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkflowState(input) + return &out, nil +} + +type WorkflowStatus string + +const ( + WorkflowStatusAborted WorkflowStatus = "Aborted" + WorkflowStatusCancelled WorkflowStatus = "Cancelled" + WorkflowStatusFailed WorkflowStatus = "Failed" + WorkflowStatusFaulted WorkflowStatus = "Faulted" + WorkflowStatusIgnored WorkflowStatus = "Ignored" + WorkflowStatusNotSpecified WorkflowStatus = "NotSpecified" + WorkflowStatusPaused WorkflowStatus = "Paused" + WorkflowStatusRunning WorkflowStatus = "Running" + WorkflowStatusSkipped WorkflowStatus = "Skipped" + WorkflowStatusSucceeded WorkflowStatus = "Succeeded" + WorkflowStatusSuspended WorkflowStatus = "Suspended" + WorkflowStatusTimedOut WorkflowStatus = "TimedOut" + WorkflowStatusWaiting WorkflowStatus = "Waiting" +) + +func PossibleValuesForWorkflowStatus() []string { + return []string{ + string(WorkflowStatusAborted), + string(WorkflowStatusCancelled), + string(WorkflowStatusFailed), + string(WorkflowStatusFaulted), + string(WorkflowStatusIgnored), + string(WorkflowStatusNotSpecified), + string(WorkflowStatusPaused), + string(WorkflowStatusRunning), + string(WorkflowStatusSkipped), + string(WorkflowStatusSucceeded), + string(WorkflowStatusSuspended), + string(WorkflowStatusTimedOut), + string(WorkflowStatusWaiting), + } +} + +func parseWorkflowStatus(input string) (*WorkflowStatus, error) { + vals := map[string]WorkflowStatus{ + "aborted": WorkflowStatusAborted, + "cancelled": WorkflowStatusCancelled, + "failed": WorkflowStatusFailed, + "faulted": WorkflowStatusFaulted, + "ignored": WorkflowStatusIgnored, + "notspecified": WorkflowStatusNotSpecified, + "paused": WorkflowStatusPaused, + "running": WorkflowStatusRunning, + "skipped": WorkflowStatusSkipped, + "succeeded": WorkflowStatusSucceeded, + "suspended": WorkflowStatusSuspended, + "timedout": WorkflowStatusTimedOut, + "waiting": WorkflowStatusWaiting, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkflowStatus(input) + return &out, nil +} + +type WorkflowTriggerProvisioningState string + +const ( + WorkflowTriggerProvisioningStateAccepted WorkflowTriggerProvisioningState = "Accepted" + WorkflowTriggerProvisioningStateCanceled WorkflowTriggerProvisioningState = "Canceled" + WorkflowTriggerProvisioningStateCompleted WorkflowTriggerProvisioningState = "Completed" + WorkflowTriggerProvisioningStateCreated WorkflowTriggerProvisioningState = "Created" + WorkflowTriggerProvisioningStateCreating WorkflowTriggerProvisioningState = "Creating" + WorkflowTriggerProvisioningStateDeleted WorkflowTriggerProvisioningState = "Deleted" + WorkflowTriggerProvisioningStateDeleting WorkflowTriggerProvisioningState = "Deleting" + WorkflowTriggerProvisioningStateFailed WorkflowTriggerProvisioningState = "Failed" + WorkflowTriggerProvisioningStateMoving WorkflowTriggerProvisioningState = "Moving" + WorkflowTriggerProvisioningStateNotSpecified WorkflowTriggerProvisioningState = "NotSpecified" + WorkflowTriggerProvisioningStateReady WorkflowTriggerProvisioningState = "Ready" + WorkflowTriggerProvisioningStateRegistered WorkflowTriggerProvisioningState = "Registered" + WorkflowTriggerProvisioningStateRegistering WorkflowTriggerProvisioningState = "Registering" + WorkflowTriggerProvisioningStateRunning WorkflowTriggerProvisioningState = "Running" + WorkflowTriggerProvisioningStateSucceeded WorkflowTriggerProvisioningState = "Succeeded" + WorkflowTriggerProvisioningStateUnregistered WorkflowTriggerProvisioningState = "Unregistered" + WorkflowTriggerProvisioningStateUnregistering WorkflowTriggerProvisioningState = "Unregistering" + WorkflowTriggerProvisioningStateUpdating WorkflowTriggerProvisioningState = "Updating" +) + +func PossibleValuesForWorkflowTriggerProvisioningState() []string { + return []string{ + string(WorkflowTriggerProvisioningStateAccepted), + string(WorkflowTriggerProvisioningStateCanceled), + string(WorkflowTriggerProvisioningStateCompleted), + string(WorkflowTriggerProvisioningStateCreated), + string(WorkflowTriggerProvisioningStateCreating), + string(WorkflowTriggerProvisioningStateDeleted), + string(WorkflowTriggerProvisioningStateDeleting), + string(WorkflowTriggerProvisioningStateFailed), + string(WorkflowTriggerProvisioningStateMoving), + string(WorkflowTriggerProvisioningStateNotSpecified), + string(WorkflowTriggerProvisioningStateReady), + string(WorkflowTriggerProvisioningStateRegistered), + string(WorkflowTriggerProvisioningStateRegistering), + string(WorkflowTriggerProvisioningStateRunning), + string(WorkflowTriggerProvisioningStateSucceeded), + string(WorkflowTriggerProvisioningStateUnregistered), + string(WorkflowTriggerProvisioningStateUnregistering), + string(WorkflowTriggerProvisioningStateUpdating), + } +} + +func parseWorkflowTriggerProvisioningState(input string) (*WorkflowTriggerProvisioningState, error) { + vals := map[string]WorkflowTriggerProvisioningState{ + "accepted": WorkflowTriggerProvisioningStateAccepted, + "canceled": WorkflowTriggerProvisioningStateCanceled, + "completed": WorkflowTriggerProvisioningStateCompleted, + "created": WorkflowTriggerProvisioningStateCreated, + "creating": WorkflowTriggerProvisioningStateCreating, + "deleted": WorkflowTriggerProvisioningStateDeleted, + "deleting": WorkflowTriggerProvisioningStateDeleting, + "failed": WorkflowTriggerProvisioningStateFailed, + "moving": WorkflowTriggerProvisioningStateMoving, + "notspecified": WorkflowTriggerProvisioningStateNotSpecified, + "ready": WorkflowTriggerProvisioningStateReady, + "registered": WorkflowTriggerProvisioningStateRegistered, + "registering": WorkflowTriggerProvisioningStateRegistering, + "running": WorkflowTriggerProvisioningStateRunning, + "succeeded": WorkflowTriggerProvisioningStateSucceeded, + "unregistered": WorkflowTriggerProvisioningStateUnregistered, + "unregistering": WorkflowTriggerProvisioningStateUnregistering, + "updating": WorkflowTriggerProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkflowTriggerProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/id_trigger.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/id_trigger.go new file mode 100644 index 000000000000..cb3bb5795a43 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/id_trigger.go @@ -0,0 +1,137 @@ +package workflowtriggers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = TriggerId{} + +// TriggerId is a struct representing the Resource ID for a Trigger +type TriggerId struct { + SubscriptionId string + ResourceGroupName string + WorkflowName string + TriggerName string +} + +// NewTriggerID returns a new TriggerId struct +func NewTriggerID(subscriptionId string, resourceGroupName string, workflowName string, triggerName string) TriggerId { + return TriggerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkflowName: workflowName, + TriggerName: triggerName, + } +} + +// ParseTriggerID parses 'input' into a TriggerId +func ParseTriggerID(input string) (*TriggerId, error) { + parser := resourceids.NewParserFromResourceIdType(TriggerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TriggerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { + return nil, fmt.Errorf("the segment 'triggerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseTriggerIDInsensitively parses 'input' case-insensitively into a TriggerId +// note: this method should only be used for API response data and not user input +func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { + parser := resourceids.NewParserFromResourceIdType(TriggerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TriggerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { + return nil, fmt.Errorf("the segment 'triggerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateTriggerID checks that 'input' can be parsed as a Trigger ID +func ValidateTriggerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseTriggerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Trigger ID +func (id TriggerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/workflows/%s/triggers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkflowName, id.TriggerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Trigger ID +func (id TriggerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticWorkflows", "workflows", "workflows"), + resourceids.UserSpecifiedSegment("workflowName", "workflowValue"), + resourceids.StaticSegment("staticTriggers", "triggers", "triggers"), + resourceids.UserSpecifiedSegment("triggerName", "triggerValue"), + } +} + +// String returns a human-readable description of this Trigger ID +func (id TriggerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workflow Name: %q", id.WorkflowName), + fmt.Sprintf("Trigger Name: %q", id.TriggerName), + } + return fmt.Sprintf("Trigger (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/id_versiontrigger.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/id_versiontrigger.go new file mode 100644 index 000000000000..58e6dc618e0e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/id_versiontrigger.go @@ -0,0 +1,150 @@ +package workflowtriggers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VersionTriggerId{} + +// VersionTriggerId is a struct representing the Resource ID for a Version Trigger +type VersionTriggerId struct { + SubscriptionId string + ResourceGroupName string + WorkflowName string + VersionId string + TriggerName string +} + +// NewVersionTriggerID returns a new VersionTriggerId struct +func NewVersionTriggerID(subscriptionId string, resourceGroupName string, workflowName string, versionId string, triggerName string) VersionTriggerId { + return VersionTriggerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkflowName: workflowName, + VersionId: versionId, + TriggerName: triggerName, + } +} + +// ParseVersionTriggerID parses 'input' into a VersionTriggerId +func ParseVersionTriggerID(input string) (*VersionTriggerId, error) { + parser := resourceids.NewParserFromResourceIdType(VersionTriggerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VersionTriggerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { + return nil, fmt.Errorf("the segment 'versionId' was not found in the resource id %q", input) + } + + if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { + return nil, fmt.Errorf("the segment 'triggerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVersionTriggerIDInsensitively parses 'input' case-insensitively into a VersionTriggerId +// note: this method should only be used for API response data and not user input +func ParseVersionTriggerIDInsensitively(input string) (*VersionTriggerId, error) { + parser := resourceids.NewParserFromResourceIdType(VersionTriggerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VersionTriggerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { + return nil, fmt.Errorf("the segment 'versionId' was not found in the resource id %q", input) + } + + if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { + return nil, fmt.Errorf("the segment 'triggerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVersionTriggerID checks that 'input' can be parsed as a Version Trigger ID +func ValidateVersionTriggerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVersionTriggerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Version Trigger ID +func (id VersionTriggerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/workflows/%s/versions/%s/triggers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkflowName, id.VersionId, id.TriggerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Version Trigger ID +func (id VersionTriggerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticWorkflows", "workflows", "workflows"), + resourceids.UserSpecifiedSegment("workflowName", "workflowValue"), + resourceids.StaticSegment("staticVersions", "versions", "versions"), + resourceids.UserSpecifiedSegment("versionId", "versionIdValue"), + resourceids.StaticSegment("staticTriggers", "triggers", "triggers"), + resourceids.UserSpecifiedSegment("triggerName", "triggerValue"), + } +} + +// String returns a human-readable description of this Version Trigger ID +func (id VersionTriggerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workflow Name: %q", id.WorkflowName), + fmt.Sprintf("Version: %q", id.VersionId), + fmt.Sprintf("Trigger Name: %q", id.TriggerName), + } + return fmt.Sprintf("Version Trigger (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/id_workflow.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/id_workflow.go new file mode 100644 index 000000000000..de1703eec544 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/id_workflow.go @@ -0,0 +1,124 @@ +package workflowtriggers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = WorkflowId{} + +// WorkflowId is a struct representing the Resource ID for a Workflow +type WorkflowId struct { + SubscriptionId string + ResourceGroupName string + WorkflowName string +} + +// NewWorkflowID returns a new WorkflowId struct +func NewWorkflowID(subscriptionId string, resourceGroupName string, workflowName string) WorkflowId { + return WorkflowId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkflowName: workflowName, + } +} + +// ParseWorkflowID parses 'input' into a WorkflowId +func ParseWorkflowID(input string) (*WorkflowId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkflowId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkflowId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseWorkflowIDInsensitively parses 'input' case-insensitively into a WorkflowId +// note: this method should only be used for API response data and not user input +func ParseWorkflowIDInsensitively(input string) (*WorkflowId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkflowId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkflowId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { + return nil, fmt.Errorf("the segment 'workflowName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateWorkflowID checks that 'input' can be parsed as a Workflow ID +func ValidateWorkflowID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseWorkflowID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workflow ID +func (id WorkflowId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logic/workflows/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkflowName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workflow ID +func (id WorkflowId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLogic", "Microsoft.Logic", "Microsoft.Logic"), + resourceids.StaticSegment("staticWorkflows", "workflows", "workflows"), + resourceids.UserSpecifiedSegment("workflowName", "workflowValue"), + } +} + +// String returns a human-readable description of this Workflow ID +func (id WorkflowId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workflow Name: %q", id.WorkflowName), + } + return fmt.Sprintf("Workflow (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_get_autorest.go new file mode 100644 index 000000000000..4a2655a974e5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_get_autorest.go @@ -0,0 +1,68 @@ +package workflowtriggers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *WorkflowTrigger +} + +// Get ... +func (c WorkflowTriggersClient) Get(ctx context.Context, id TriggerId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c WorkflowTriggersClient) preparerForGet(ctx context.Context, id TriggerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c WorkflowTriggersClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_getschemajson_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_getschemajson_autorest.go new file mode 100644 index 000000000000..9c8ea932113c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_getschemajson_autorest.go @@ -0,0 +1,69 @@ +package workflowtriggers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetSchemaJsonOperationResponse struct { + HttpResponse *http.Response + Model *JsonSchema +} + +// GetSchemaJson ... +func (c WorkflowTriggersClient) GetSchemaJson(ctx context.Context, id TriggerId) (result GetSchemaJsonOperationResponse, err error) { + req, err := c.preparerForGetSchemaJson(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "GetSchemaJson", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "GetSchemaJson", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetSchemaJson(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "GetSchemaJson", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetSchemaJson prepares the GetSchemaJson request. +func (c WorkflowTriggersClient) preparerForGetSchemaJson(ctx context.Context, id TriggerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/schemas/json", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetSchemaJson handles the response to the GetSchemaJson request. The method always +// closes the http.Response Body. +func (c WorkflowTriggersClient) responderForGetSchemaJson(resp *http.Response) (result GetSchemaJsonOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_list_autorest.go new file mode 100644 index 000000000000..6fb0d033905c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_list_autorest.go @@ -0,0 +1,220 @@ +package workflowtriggers + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]WorkflowTrigger + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []WorkflowTrigger +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Filter *string + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c WorkflowTriggersClient) List(ctx context.Context, id WorkflowId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c WorkflowTriggersClient) preparerForList(ctx context.Context, id WorkflowId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/triggers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c WorkflowTriggersClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c WorkflowTriggersClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []WorkflowTrigger `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c WorkflowTriggersClient) ListComplete(ctx context.Context, id WorkflowId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, WorkflowTriggerOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkflowTriggersClient) ListCompleteMatchingPredicate(ctx context.Context, id WorkflowId, options ListOperationOptions, predicate WorkflowTriggerOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]WorkflowTrigger, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_listcallbackurl_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_listcallbackurl_autorest.go new file mode 100644 index 000000000000..0f7e30a34eb6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_listcallbackurl_autorest.go @@ -0,0 +1,69 @@ +package workflowtriggers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListCallbackUrlOperationResponse struct { + HttpResponse *http.Response + Model *WorkflowTriggerCallbackUrl +} + +// ListCallbackUrl ... +func (c WorkflowTriggersClient) ListCallbackUrl(ctx context.Context, id TriggerId) (result ListCallbackUrlOperationResponse, err error) { + req, err := c.preparerForListCallbackUrl(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "ListCallbackUrl", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "ListCallbackUrl", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListCallbackUrl(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "ListCallbackUrl", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListCallbackUrl prepares the ListCallbackUrl request. +func (c WorkflowTriggersClient) preparerForListCallbackUrl(ctx context.Context, id TriggerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listCallbackUrl", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListCallbackUrl handles the response to the ListCallbackUrl request. The method always +// closes the http.Response Body. +func (c WorkflowTriggersClient) responderForListCallbackUrl(resp *http.Response) (result ListCallbackUrlOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_reset_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_reset_autorest.go new file mode 100644 index 000000000000..29cb6d229c83 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_reset_autorest.go @@ -0,0 +1,67 @@ +package workflowtriggers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResetOperationResponse struct { + HttpResponse *http.Response +} + +// Reset ... +func (c WorkflowTriggersClient) Reset(ctx context.Context, id TriggerId) (result ResetOperationResponse, err error) { + req, err := c.preparerForReset(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "Reset", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "Reset", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForReset(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "Reset", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForReset prepares the Reset request. +func (c WorkflowTriggersClient) preparerForReset(ctx context.Context, id TriggerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/reset", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForReset handles the response to the Reset request. The method always +// closes the http.Response Body. +func (c WorkflowTriggersClient) responderForReset(resp *http.Response) (result ResetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_run_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_run_autorest.go new file mode 100644 index 000000000000..02bb0bbcebe9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_run_autorest.go @@ -0,0 +1,67 @@ +package workflowtriggers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunOperationResponse struct { + HttpResponse *http.Response +} + +// Run ... +func (c WorkflowTriggersClient) Run(ctx context.Context, id TriggerId) (result RunOperationResponse, err error) { + req, err := c.preparerForRun(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "Run", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "Run", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRun(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "Run", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRun prepares the Run request. +func (c WorkflowTriggersClient) preparerForRun(ctx context.Context, id TriggerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/run", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRun handles the response to the Run request. The method always +// closes the http.Response Body. +func (c WorkflowTriggersClient) responderForRun(resp *http.Response) (result RunOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_setstate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_setstate_autorest.go new file mode 100644 index 000000000000..133d57458848 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_setstate_autorest.go @@ -0,0 +1,68 @@ +package workflowtriggers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SetStateOperationResponse struct { + HttpResponse *http.Response +} + +// SetState ... +func (c WorkflowTriggersClient) SetState(ctx context.Context, id TriggerId, input SetTriggerStateActionDefinition) (result SetStateOperationResponse, err error) { + req, err := c.preparerForSetState(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "SetState", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "SetState", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSetState(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "SetState", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSetState prepares the SetState request. +func (c WorkflowTriggersClient) preparerForSetState(ctx context.Context, id TriggerId, input SetTriggerStateActionDefinition) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/setState", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSetState handles the response to the SetState request. The method always +// closes the http.Response Body. +func (c WorkflowTriggersClient) responderForSetState(resp *http.Response) (result SetStateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_workflowversiontriggerslistcallbackurl_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_workflowversiontriggerslistcallbackurl_autorest.go new file mode 100644 index 000000000000..edbf5b1a3f44 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/method_workflowversiontriggerslistcallbackurl_autorest.go @@ -0,0 +1,70 @@ +package workflowtriggers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowVersionTriggersListCallbackUrlOperationResponse struct { + HttpResponse *http.Response + Model *WorkflowTriggerCallbackUrl +} + +// WorkflowVersionTriggersListCallbackUrl ... +func (c WorkflowTriggersClient) WorkflowVersionTriggersListCallbackUrl(ctx context.Context, id VersionTriggerId, input GetCallbackUrlParameters) (result WorkflowVersionTriggersListCallbackUrlOperationResponse, err error) { + req, err := c.preparerForWorkflowVersionTriggersListCallbackUrl(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "WorkflowVersionTriggersListCallbackUrl", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "WorkflowVersionTriggersListCallbackUrl", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkflowVersionTriggersListCallbackUrl(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workflowtriggers.WorkflowTriggersClient", "WorkflowVersionTriggersListCallbackUrl", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkflowVersionTriggersListCallbackUrl prepares the WorkflowVersionTriggersListCallbackUrl request. +func (c WorkflowTriggersClient) preparerForWorkflowVersionTriggersListCallbackUrl(ctx context.Context, id VersionTriggerId, input GetCallbackUrlParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listCallbackUrl", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkflowVersionTriggersListCallbackUrl handles the response to the WorkflowVersionTriggersListCallbackUrl request. The method always +// closes the http.Response Body. +func (c WorkflowTriggersClient) responderForWorkflowVersionTriggersListCallbackUrl(resp *http.Response) (result WorkflowVersionTriggersListCallbackUrlOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_getcallbackurlparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_getcallbackurlparameters.go new file mode 100644 index 000000000000..8614e9abf176 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_getcallbackurlparameters.go @@ -0,0 +1,27 @@ +package workflowtriggers + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetCallbackUrlParameters struct { + KeyType *KeyType `json:"keyType,omitempty"` + NotAfter *string `json:"notAfter,omitempty"` +} + +func (o *GetCallbackUrlParameters) GetNotAfterAsTime() (*time.Time, error) { + if o.NotAfter == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NotAfter, "2006-01-02T15:04:05Z07:00") +} + +func (o *GetCallbackUrlParameters) SetNotAfterAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NotAfter = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_jsonschema.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_jsonschema.go new file mode 100644 index 000000000000..9dbec86f7579 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_jsonschema.go @@ -0,0 +1,9 @@ +package workflowtriggers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type JsonSchema struct { + Content *string `json:"content,omitempty"` + Title *string `json:"title,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_recurrenceschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_recurrenceschedule.go new file mode 100644 index 000000000000..7ea8413d4cd9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_recurrenceschedule.go @@ -0,0 +1,12 @@ +package workflowtriggers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecurrenceSchedule struct { + Hours *[]int64 `json:"hours,omitempty"` + Minutes *[]int64 `json:"minutes,omitempty"` + MonthDays *[]int64 `json:"monthDays,omitempty"` + MonthlyOccurrences *[]RecurrenceScheduleOccurrence `json:"monthlyOccurrences,omitempty"` + WeekDays *[]DaysOfWeek `json:"weekDays,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_recurrencescheduleoccurrence.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_recurrencescheduleoccurrence.go new file mode 100644 index 000000000000..39f417c38d7d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_recurrencescheduleoccurrence.go @@ -0,0 +1,9 @@ +package workflowtriggers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecurrenceScheduleOccurrence struct { + Day *DayOfWeek `json:"day,omitempty"` + Occurrence *int64 `json:"occurrence,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_resourcereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_resourcereference.go new file mode 100644 index 000000000000..f96ba2e28a0a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_resourcereference.go @@ -0,0 +1,10 @@ +package workflowtriggers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceReference struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_settriggerstateactiondefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_settriggerstateactiondefinition.go new file mode 100644 index 000000000000..00003151a90c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_settriggerstateactiondefinition.go @@ -0,0 +1,8 @@ +package workflowtriggers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SetTriggerStateActionDefinition struct { + Source WorkflowTriggerReference `json:"source"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtrigger.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtrigger.go new file mode 100644 index 000000000000..b2502e9f9c42 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtrigger.go @@ -0,0 +1,11 @@ +package workflowtriggers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTrigger struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *WorkflowTriggerProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtriggercallbackurl.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtriggercallbackurl.go new file mode 100644 index 000000000000..fd5a9082bd7d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtriggercallbackurl.go @@ -0,0 +1,13 @@ +package workflowtriggers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerCallbackUrl struct { + BasePath *string `json:"basePath,omitempty"` + Method *string `json:"method,omitempty"` + Queries *WorkflowTriggerListCallbackUrlQueries `json:"queries,omitempty"` + RelativePath *string `json:"relativePath,omitempty"` + RelativePathParameters *[]string `json:"relativePathParameters,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtriggerlistcallbackurlqueries.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtriggerlistcallbackurlqueries.go new file mode 100644 index 000000000000..cc3b231968b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtriggerlistcallbackurlqueries.go @@ -0,0 +1,12 @@ +package workflowtriggers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerListCallbackUrlQueries struct { + ApiVersion *string `json:"api-version,omitempty"` + Se *string `json:"se,omitempty"` + Sig *string `json:"sig,omitempty"` + Sp *string `json:"sp,omitempty"` + Sv *string `json:"sv,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtriggerproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtriggerproperties.go new file mode 100644 index 000000000000..b860a57a39ca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtriggerproperties.go @@ -0,0 +1,70 @@ +package workflowtriggers + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerProperties struct { + ChangedTime *string `json:"changedTime,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` + LastExecutionTime *string `json:"lastExecutionTime,omitempty"` + NextExecutionTime *string `json:"nextExecutionTime,omitempty"` + ProvisioningState *WorkflowTriggerProvisioningState `json:"provisioningState,omitempty"` + Recurrence *WorkflowTriggerRecurrence `json:"recurrence,omitempty"` + State *WorkflowState `json:"state,omitempty"` + Status *WorkflowStatus `json:"status,omitempty"` + Workflow *ResourceReference `json:"workflow,omitempty"` +} + +func (o *WorkflowTriggerProperties) GetChangedTimeAsTime() (*time.Time, error) { + if o.ChangedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ChangedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *WorkflowTriggerProperties) SetChangedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ChangedTime = &formatted +} + +func (o *WorkflowTriggerProperties) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *WorkflowTriggerProperties) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} + +func (o *WorkflowTriggerProperties) GetLastExecutionTimeAsTime() (*time.Time, error) { + if o.LastExecutionTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastExecutionTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *WorkflowTriggerProperties) SetLastExecutionTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastExecutionTime = &formatted +} + +func (o *WorkflowTriggerProperties) GetNextExecutionTimeAsTime() (*time.Time, error) { + if o.NextExecutionTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NextExecutionTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *WorkflowTriggerProperties) SetNextExecutionTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NextExecutionTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtriggerrecurrence.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtriggerrecurrence.go new file mode 100644 index 000000000000..ec9873b45184 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtriggerrecurrence.go @@ -0,0 +1,13 @@ +package workflowtriggers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerRecurrence struct { + EndTime *string `json:"endTime,omitempty"` + Frequency *RecurrenceFrequency `json:"frequency,omitempty"` + Interval *int64 `json:"interval,omitempty"` + Schedule *RecurrenceSchedule `json:"schedule,omitempty"` + StartTime *string `json:"startTime,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtriggerreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtriggerreference.go new file mode 100644 index 000000000000..7f6891935505 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/model_workflowtriggerreference.go @@ -0,0 +1,12 @@ +package workflowtriggers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkflowTriggerReference struct { + FlowName *string `json:"flowName,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + TriggerName *string `json:"triggerName,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/predicates.go new file mode 100644 index 000000000000..5526a8e07bd1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/predicates.go @@ -0,0 +1,24 @@ +package workflowtriggers + +type WorkflowTriggerOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p WorkflowTriggerOperationPredicate) Matches(input WorkflowTrigger) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/version.go new file mode 100644 index 000000000000..1045dd9e4740 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers/version.go @@ -0,0 +1,12 @@ +package workflowtriggers + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/workflowtriggers/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/README.md new file mode 100644 index 000000000000..dd42413dd3d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/README.md @@ -0,0 +1,106 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore` Documentation + +The `datastore` SDK allows for interaction with the Azure Resource Manager Service `machinelearningservices` (API Version `2022-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore" +``` + + +### Client Initialization + +```go +client := datastore.NewDatastoreClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DatastoreClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := datastore.NewDataStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "dataStoreValue") + +payload := datastore.DatastoreResource{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, datastore.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatastoreClient.Delete` + +```go +ctx := context.TODO() +id := datastore.NewDataStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "dataStoreValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatastoreClient.Get` + +```go +ctx := context.TODO() +id := datastore.NewDataStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "dataStoreValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatastoreClient.List` + +```go +ctx := context.TODO() +id := datastore.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +// alternatively `client.List(ctx, id, datastore.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, datastore.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DatastoreClient.ListSecrets` + +```go +ctx := context.TODO() +id := datastore.NewDataStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "dataStoreValue") + +read, err := client.ListSecrets(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/client.go new file mode 100644 index 000000000000..60a84514389b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/client.go @@ -0,0 +1,18 @@ +package datastore + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatastoreClient struct { + Client autorest.Client + baseUri string +} + +func NewDatastoreClientWithBaseURI(endpoint string) DatastoreClient { + return DatastoreClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/constants.go new file mode 100644 index 000000000000..791a12fd4947 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/constants.go @@ -0,0 +1,142 @@ +package datastore + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CredentialsType string + +const ( + CredentialsTypeAccountKey CredentialsType = "AccountKey" + CredentialsTypeCertificate CredentialsType = "Certificate" + CredentialsTypeNone CredentialsType = "None" + CredentialsTypeSas CredentialsType = "Sas" + CredentialsTypeServicePrincipal CredentialsType = "ServicePrincipal" +) + +func PossibleValuesForCredentialsType() []string { + return []string{ + string(CredentialsTypeAccountKey), + string(CredentialsTypeCertificate), + string(CredentialsTypeNone), + string(CredentialsTypeSas), + string(CredentialsTypeServicePrincipal), + } +} + +func parseCredentialsType(input string) (*CredentialsType, error) { + vals := map[string]CredentialsType{ + "accountkey": CredentialsTypeAccountKey, + "certificate": CredentialsTypeCertificate, + "none": CredentialsTypeNone, + "sas": CredentialsTypeSas, + "serviceprincipal": CredentialsTypeServicePrincipal, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CredentialsType(input) + return &out, nil +} + +type DatastoreType string + +const ( + DatastoreTypeAzureBlob DatastoreType = "AzureBlob" + DatastoreTypeAzureDataLakeGenOne DatastoreType = "AzureDataLakeGen1" + DatastoreTypeAzureDataLakeGenTwo DatastoreType = "AzureDataLakeGen2" + DatastoreTypeAzureFile DatastoreType = "AzureFile" +) + +func PossibleValuesForDatastoreType() []string { + return []string{ + string(DatastoreTypeAzureBlob), + string(DatastoreTypeAzureDataLakeGenOne), + string(DatastoreTypeAzureDataLakeGenTwo), + string(DatastoreTypeAzureFile), + } +} + +func parseDatastoreType(input string) (*DatastoreType, error) { + vals := map[string]DatastoreType{ + "azureblob": DatastoreTypeAzureBlob, + "azuredatalakegen1": DatastoreTypeAzureDataLakeGenOne, + "azuredatalakegen2": DatastoreTypeAzureDataLakeGenTwo, + "azurefile": DatastoreTypeAzureFile, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DatastoreType(input) + return &out, nil +} + +type SecretsType string + +const ( + SecretsTypeAccountKey SecretsType = "AccountKey" + SecretsTypeCertificate SecretsType = "Certificate" + SecretsTypeSas SecretsType = "Sas" + SecretsTypeServicePrincipal SecretsType = "ServicePrincipal" +) + +func PossibleValuesForSecretsType() []string { + return []string{ + string(SecretsTypeAccountKey), + string(SecretsTypeCertificate), + string(SecretsTypeSas), + string(SecretsTypeServicePrincipal), + } +} + +func parseSecretsType(input string) (*SecretsType, error) { + vals := map[string]SecretsType{ + "accountkey": SecretsTypeAccountKey, + "certificate": SecretsTypeCertificate, + "sas": SecretsTypeSas, + "serviceprincipal": SecretsTypeServicePrincipal, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecretsType(input) + return &out, nil +} + +type ServiceDataAccessAuthIdentity string + +const ( + ServiceDataAccessAuthIdentityNone ServiceDataAccessAuthIdentity = "None" + ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity ServiceDataAccessAuthIdentity = "WorkspaceSystemAssignedIdentity" + ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity ServiceDataAccessAuthIdentity = "WorkspaceUserAssignedIdentity" +) + +func PossibleValuesForServiceDataAccessAuthIdentity() []string { + return []string{ + string(ServiceDataAccessAuthIdentityNone), + string(ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity), + string(ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity), + } +} + +func parseServiceDataAccessAuthIdentity(input string) (*ServiceDataAccessAuthIdentity, error) { + vals := map[string]ServiceDataAccessAuthIdentity{ + "none": ServiceDataAccessAuthIdentityNone, + "workspacesystemassignedidentity": ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity, + "workspaceuserassignedidentity": ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServiceDataAccessAuthIdentity(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/id_datastore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/id_datastore.go new file mode 100644 index 000000000000..242a0fa5ae7c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/id_datastore.go @@ -0,0 +1,137 @@ +package datastore + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DataStoreId{} + +// DataStoreId is a struct representing the Resource ID for a Data Store +type DataStoreId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string + DataStoreName string +} + +// NewDataStoreID returns a new DataStoreId struct +func NewDataStoreID(subscriptionId string, resourceGroupName string, workspaceName string, dataStoreName string) DataStoreId { + return DataStoreId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + DataStoreName: dataStoreName, + } +} + +// ParseDataStoreID parses 'input' into a DataStoreId +func ParseDataStoreID(input string) (*DataStoreId, error) { + parser := resourceids.NewParserFromResourceIdType(DataStoreId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DataStoreId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { + return nil, fmt.Errorf("the segment 'dataStoreName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDataStoreIDInsensitively parses 'input' case-insensitively into a DataStoreId +// note: this method should only be used for API response data and not user input +func ParseDataStoreIDInsensitively(input string) (*DataStoreId, error) { + parser := resourceids.NewParserFromResourceIdType(DataStoreId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DataStoreId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { + return nil, fmt.Errorf("the segment 'dataStoreName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDataStoreID checks that 'input' can be parsed as a Data Store ID +func ValidateDataStoreID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDataStoreID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Data Store ID +func (id DataStoreId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.MachineLearningServices/workspaces/%s/dataStores/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName, id.DataStoreName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Data Store ID +func (id DataStoreId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMachineLearningServices", "Microsoft.MachineLearningServices", "Microsoft.MachineLearningServices"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"), + resourceids.StaticSegment("staticDataStores", "dataStores", "dataStores"), + resourceids.UserSpecifiedSegment("dataStoreName", "dataStoreValue"), + } +} + +// String returns a human-readable description of this Data Store ID +func (id DataStoreId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + fmt.Sprintf("Data Store Name: %q", id.DataStoreName), + } + return fmt.Sprintf("Data Store (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/id_workspace.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/id_workspace.go new file mode 100644 index 000000000000..f81c21e0c9ec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/id_workspace.go @@ -0,0 +1,124 @@ +package datastore + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = WorkspaceId{} + +// WorkspaceId is a struct representing the Resource ID for a Workspace +type WorkspaceId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string +} + +// NewWorkspaceID returns a new WorkspaceId struct +func NewWorkspaceID(subscriptionId string, resourceGroupName string, workspaceName string) WorkspaceId { + return WorkspaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + } +} + +// ParseWorkspaceID parses 'input' into a WorkspaceId +func ParseWorkspaceID(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkspaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseWorkspaceIDInsensitively parses 'input' case-insensitively into a WorkspaceId +// note: this method should only be used for API response data and not user input +func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkspaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID +func ValidateWorkspaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workspace ID +func (id WorkspaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.MachineLearningServices/workspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workspace ID +func (id WorkspaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMachineLearningServices", "Microsoft.MachineLearningServices", "Microsoft.MachineLearningServices"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"), + } +} + +// String returns a human-readable description of this Workspace ID +func (id WorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + } + return fmt.Sprintf("Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/method_createorupdate_autorest.go new file mode 100644 index 000000000000..58eeec74bcad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/method_createorupdate_autorest.go @@ -0,0 +1,98 @@ +package datastore + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *DatastoreResource +} + +type CreateOrUpdateOperationOptions struct { + SkipValidation *bool +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.SkipValidation != nil { + out["skipValidation"] = *o.SkipValidation + } + + return out +} + +// CreateOrUpdate ... +func (c DatastoreClient) CreateOrUpdate(ctx context.Context, id DataStoreId, input DatastoreResource, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c DatastoreClient) preparerForCreateOrUpdate(ctx context.Context, id DataStoreId, input DatastoreResource, options CreateOrUpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c DatastoreClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/method_delete_autorest.go new file mode 100644 index 000000000000..83997bda34da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/method_delete_autorest.go @@ -0,0 +1,66 @@ +package datastore + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c DatastoreClient) Delete(ctx context.Context, id DataStoreId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c DatastoreClient) preparerForDelete(ctx context.Context, id DataStoreId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c DatastoreClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/method_get_autorest.go new file mode 100644 index 000000000000..a1da4291afc5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/method_get_autorest.go @@ -0,0 +1,68 @@ +package datastore + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *DatastoreResource +} + +// Get ... +func (c DatastoreClient) Get(ctx context.Context, id DataStoreId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DatastoreClient) preparerForGet(ctx context.Context, id DataStoreId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DatastoreClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/method_list_autorest.go new file mode 100644 index 000000000000..57617d9d22d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/method_list_autorest.go @@ -0,0 +1,245 @@ +package datastore + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]DatastoreResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []DatastoreResource +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Count *int64 + IsDefault *bool + Names *[]string + OrderBy *string + OrderByAsc *bool + SearchText *string + Skip *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Count != nil { + out["count"] = *o.Count + } + + if o.IsDefault != nil { + out["isDefault"] = *o.IsDefault + } + + if o.Names != nil { + out["names"] = *o.Names + } + + if o.OrderBy != nil { + out["orderBy"] = *o.OrderBy + } + + if o.OrderByAsc != nil { + out["orderByAsc"] = *o.OrderByAsc + } + + if o.SearchText != nil { + out["searchText"] = *o.SearchText + } + + if o.Skip != nil { + out["$skip"] = *o.Skip + } + + return out +} + +// List ... +func (c DatastoreClient) List(ctx context.Context, id WorkspaceId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c DatastoreClient) preparerForList(ctx context.Context, id WorkspaceId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/dataStores", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c DatastoreClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c DatastoreClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []DatastoreResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c DatastoreClient) ListComplete(ctx context.Context, id WorkspaceId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, DatastoreResourceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DatastoreClient) ListCompleteMatchingPredicate(ctx context.Context, id WorkspaceId, options ListOperationOptions, predicate DatastoreResourceOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]DatastoreResource, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/method_listsecrets_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/method_listsecrets_autorest.go new file mode 100644 index 000000000000..55816b4084b9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/method_listsecrets_autorest.go @@ -0,0 +1,75 @@ +package datastore + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSecretsOperationResponse struct { + HttpResponse *http.Response + Model *DatastoreSecrets +} + +// ListSecrets ... +func (c DatastoreClient) ListSecrets(ctx context.Context, id DataStoreId) (result ListSecretsOperationResponse, err error) { + req, err := c.preparerForListSecrets(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "ListSecrets", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "ListSecrets", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListSecrets(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datastore.DatastoreClient", "ListSecrets", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListSecrets prepares the ListSecrets request. +func (c DatastoreClient) preparerForListSecrets(ctx context.Context, id DataStoreId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listSecrets", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListSecrets handles the response to the ListSecrets request. The method always +// closes the http.Response Body. +func (c DatastoreClient) responderForListSecrets(resp *http.Response) (result ListSecretsOperationResponse, err error) { + var respObj json.RawMessage + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + model, err := unmarshalDatastoreSecretsImplementation(respObj) + if err != nil { + return + } + result.Model = &model + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_accountkeydatastorecredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_accountkeydatastorecredentials.go new file mode 100644 index 000000000000..fc315ccb9ed5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_accountkeydatastorecredentials.go @@ -0,0 +1,60 @@ +package datastore + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DatastoreCredentials = AccountKeyDatastoreCredentials{} + +type AccountKeyDatastoreCredentials struct { + Secrets DatastoreSecrets `json:"secrets"` + + // Fields inherited from DatastoreCredentials +} + +var _ json.Marshaler = AccountKeyDatastoreCredentials{} + +func (s AccountKeyDatastoreCredentials) MarshalJSON() ([]byte, error) { + type wrapper AccountKeyDatastoreCredentials + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AccountKeyDatastoreCredentials: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AccountKeyDatastoreCredentials: %+v", err) + } + decoded["credentialsType"] = "AccountKey" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AccountKeyDatastoreCredentials: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &AccountKeyDatastoreCredentials{} + +func (s *AccountKeyDatastoreCredentials) UnmarshalJSON(bytes []byte) error { + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AccountKeyDatastoreCredentials into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["secrets"]; ok { + impl, err := unmarshalDatastoreSecretsImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Secrets' for 'AccountKeyDatastoreCredentials': %+v", err) + } + s.Secrets = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_accountkeydatastoresecrets.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_accountkeydatastoresecrets.go new file mode 100644 index 000000000000..c6cba7a7cff4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_accountkeydatastoresecrets.go @@ -0,0 +1,41 @@ +package datastore + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DatastoreSecrets = AccountKeyDatastoreSecrets{} + +type AccountKeyDatastoreSecrets struct { + Key *string `json:"key,omitempty"` + + // Fields inherited from DatastoreSecrets +} + +var _ json.Marshaler = AccountKeyDatastoreSecrets{} + +func (s AccountKeyDatastoreSecrets) MarshalJSON() ([]byte, error) { + type wrapper AccountKeyDatastoreSecrets + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AccountKeyDatastoreSecrets: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AccountKeyDatastoreSecrets: %+v", err) + } + decoded["secretsType"] = "AccountKey" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AccountKeyDatastoreSecrets: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_azureblobdatastore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_azureblobdatastore.go new file mode 100644 index 000000000000..dac9a23e6395 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_azureblobdatastore.go @@ -0,0 +1,84 @@ +package datastore + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ Datastore = AzureBlobDatastore{} + +type AzureBlobDatastore struct { + AccountName *string `json:"accountName,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` + Protocol *string `json:"protocol,omitempty"` + ServiceDataAccessAuthIdentity *ServiceDataAccessAuthIdentity `json:"serviceDataAccessAuthIdentity,omitempty"` + + // Fields inherited from Datastore + Credentials DatastoreCredentials `json:"credentials"` + Description *string `json:"description,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` + Properties *map[string]string `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} + +var _ json.Marshaler = AzureBlobDatastore{} + +func (s AzureBlobDatastore) MarshalJSON() ([]byte, error) { + type wrapper AzureBlobDatastore + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AzureBlobDatastore: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AzureBlobDatastore: %+v", err) + } + decoded["datastoreType"] = "AzureBlob" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AzureBlobDatastore: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &AzureBlobDatastore{} + +func (s *AzureBlobDatastore) UnmarshalJSON(bytes []byte) error { + type alias AzureBlobDatastore + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into AzureBlobDatastore: %+v", err) + } + + s.AccountName = decoded.AccountName + s.ContainerName = decoded.ContainerName + s.Description = decoded.Description + s.Endpoint = decoded.Endpoint + s.IsDefault = decoded.IsDefault + s.Properties = decoded.Properties + s.Protocol = decoded.Protocol + s.ServiceDataAccessAuthIdentity = decoded.ServiceDataAccessAuthIdentity + s.Tags = decoded.Tags + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AzureBlobDatastore into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["credentials"]; ok { + impl, err := unmarshalDatastoreCredentialsImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Credentials' for 'AzureBlobDatastore': %+v", err) + } + s.Credentials = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_azuredatalakegen1datastore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_azuredatalakegen1datastore.go new file mode 100644 index 000000000000..d7102beac8ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_azuredatalakegen1datastore.go @@ -0,0 +1,78 @@ +package datastore + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ Datastore = AzureDataLakeGen1Datastore{} + +type AzureDataLakeGen1Datastore struct { + ServiceDataAccessAuthIdentity *ServiceDataAccessAuthIdentity `json:"serviceDataAccessAuthIdentity,omitempty"` + StoreName string `json:"storeName"` + + // Fields inherited from Datastore + Credentials DatastoreCredentials `json:"credentials"` + Description *string `json:"description,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` + Properties *map[string]string `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} + +var _ json.Marshaler = AzureDataLakeGen1Datastore{} + +func (s AzureDataLakeGen1Datastore) MarshalJSON() ([]byte, error) { + type wrapper AzureDataLakeGen1Datastore + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AzureDataLakeGen1Datastore: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AzureDataLakeGen1Datastore: %+v", err) + } + decoded["datastoreType"] = "AzureDataLakeGen1" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AzureDataLakeGen1Datastore: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &AzureDataLakeGen1Datastore{} + +func (s *AzureDataLakeGen1Datastore) UnmarshalJSON(bytes []byte) error { + type alias AzureDataLakeGen1Datastore + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into AzureDataLakeGen1Datastore: %+v", err) + } + + s.Description = decoded.Description + s.IsDefault = decoded.IsDefault + s.Properties = decoded.Properties + s.ServiceDataAccessAuthIdentity = decoded.ServiceDataAccessAuthIdentity + s.StoreName = decoded.StoreName + s.Tags = decoded.Tags + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AzureDataLakeGen1Datastore into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["credentials"]; ok { + impl, err := unmarshalDatastoreCredentialsImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Credentials' for 'AzureDataLakeGen1Datastore': %+v", err) + } + s.Credentials = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_azuredatalakegen2datastore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_azuredatalakegen2datastore.go new file mode 100644 index 000000000000..644d633d96b7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_azuredatalakegen2datastore.go @@ -0,0 +1,84 @@ +package datastore + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ Datastore = AzureDataLakeGen2Datastore{} + +type AzureDataLakeGen2Datastore struct { + AccountName string `json:"accountName"` + Endpoint *string `json:"endpoint,omitempty"` + Filesystem string `json:"filesystem"` + Protocol *string `json:"protocol,omitempty"` + ServiceDataAccessAuthIdentity *ServiceDataAccessAuthIdentity `json:"serviceDataAccessAuthIdentity,omitempty"` + + // Fields inherited from Datastore + Credentials DatastoreCredentials `json:"credentials"` + Description *string `json:"description,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` + Properties *map[string]string `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} + +var _ json.Marshaler = AzureDataLakeGen2Datastore{} + +func (s AzureDataLakeGen2Datastore) MarshalJSON() ([]byte, error) { + type wrapper AzureDataLakeGen2Datastore + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AzureDataLakeGen2Datastore: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AzureDataLakeGen2Datastore: %+v", err) + } + decoded["datastoreType"] = "AzureDataLakeGen2" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AzureDataLakeGen2Datastore: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &AzureDataLakeGen2Datastore{} + +func (s *AzureDataLakeGen2Datastore) UnmarshalJSON(bytes []byte) error { + type alias AzureDataLakeGen2Datastore + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into AzureDataLakeGen2Datastore: %+v", err) + } + + s.AccountName = decoded.AccountName + s.Description = decoded.Description + s.Endpoint = decoded.Endpoint + s.Filesystem = decoded.Filesystem + s.IsDefault = decoded.IsDefault + s.Properties = decoded.Properties + s.Protocol = decoded.Protocol + s.ServiceDataAccessAuthIdentity = decoded.ServiceDataAccessAuthIdentity + s.Tags = decoded.Tags + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AzureDataLakeGen2Datastore into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["credentials"]; ok { + impl, err := unmarshalDatastoreCredentialsImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Credentials' for 'AzureDataLakeGen2Datastore': %+v", err) + } + s.Credentials = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_azurefiledatastore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_azurefiledatastore.go new file mode 100644 index 000000000000..efbfe501256f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_azurefiledatastore.go @@ -0,0 +1,84 @@ +package datastore + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ Datastore = AzureFileDatastore{} + +type AzureFileDatastore struct { + AccountName string `json:"accountName"` + Endpoint *string `json:"endpoint,omitempty"` + FileShareName string `json:"fileShareName"` + Protocol *string `json:"protocol,omitempty"` + ServiceDataAccessAuthIdentity *ServiceDataAccessAuthIdentity `json:"serviceDataAccessAuthIdentity,omitempty"` + + // Fields inherited from Datastore + Credentials DatastoreCredentials `json:"credentials"` + Description *string `json:"description,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` + Properties *map[string]string `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} + +var _ json.Marshaler = AzureFileDatastore{} + +func (s AzureFileDatastore) MarshalJSON() ([]byte, error) { + type wrapper AzureFileDatastore + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AzureFileDatastore: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AzureFileDatastore: %+v", err) + } + decoded["datastoreType"] = "AzureFile" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AzureFileDatastore: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &AzureFileDatastore{} + +func (s *AzureFileDatastore) UnmarshalJSON(bytes []byte) error { + type alias AzureFileDatastore + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into AzureFileDatastore: %+v", err) + } + + s.AccountName = decoded.AccountName + s.Description = decoded.Description + s.Endpoint = decoded.Endpoint + s.FileShareName = decoded.FileShareName + s.IsDefault = decoded.IsDefault + s.Properties = decoded.Properties + s.Protocol = decoded.Protocol + s.ServiceDataAccessAuthIdentity = decoded.ServiceDataAccessAuthIdentity + s.Tags = decoded.Tags + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AzureFileDatastore into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["credentials"]; ok { + impl, err := unmarshalDatastoreCredentialsImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Credentials' for 'AzureFileDatastore': %+v", err) + } + s.Credentials = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_certificatedatastorecredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_certificatedatastorecredentials.go new file mode 100644 index 000000000000..f51e1962dfb4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_certificatedatastorecredentials.go @@ -0,0 +1,76 @@ +package datastore + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DatastoreCredentials = CertificateDatastoreCredentials{} + +type CertificateDatastoreCredentials struct { + AuthorityUrl *string `json:"authorityUrl,omitempty"` + ClientId string `json:"clientId"` + ResourceUrl *string `json:"resourceUrl,omitempty"` + Secrets DatastoreSecrets `json:"secrets"` + TenantId string `json:"tenantId"` + Thumbprint string `json:"thumbprint"` + + // Fields inherited from DatastoreCredentials +} + +var _ json.Marshaler = CertificateDatastoreCredentials{} + +func (s CertificateDatastoreCredentials) MarshalJSON() ([]byte, error) { + type wrapper CertificateDatastoreCredentials + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling CertificateDatastoreCredentials: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling CertificateDatastoreCredentials: %+v", err) + } + decoded["credentialsType"] = "Certificate" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling CertificateDatastoreCredentials: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &CertificateDatastoreCredentials{} + +func (s *CertificateDatastoreCredentials) UnmarshalJSON(bytes []byte) error { + type alias CertificateDatastoreCredentials + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into CertificateDatastoreCredentials: %+v", err) + } + + s.AuthorityUrl = decoded.AuthorityUrl + s.ClientId = decoded.ClientId + s.ResourceUrl = decoded.ResourceUrl + s.TenantId = decoded.TenantId + s.Thumbprint = decoded.Thumbprint + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling CertificateDatastoreCredentials into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["secrets"]; ok { + impl, err := unmarshalDatastoreSecretsImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Secrets' for 'CertificateDatastoreCredentials': %+v", err) + } + s.Secrets = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_certificatedatastoresecrets.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_certificatedatastoresecrets.go new file mode 100644 index 000000000000..d56034ae15cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_certificatedatastoresecrets.go @@ -0,0 +1,41 @@ +package datastore + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DatastoreSecrets = CertificateDatastoreSecrets{} + +type CertificateDatastoreSecrets struct { + Certificate *string `json:"certificate,omitempty"` + + // Fields inherited from DatastoreSecrets +} + +var _ json.Marshaler = CertificateDatastoreSecrets{} + +func (s CertificateDatastoreSecrets) MarshalJSON() ([]byte, error) { + type wrapper CertificateDatastoreSecrets + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling CertificateDatastoreSecrets: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling CertificateDatastoreSecrets: %+v", err) + } + decoded["secretsType"] = "Certificate" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling CertificateDatastoreSecrets: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_datastore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_datastore.go new file mode 100644 index 000000000000..1313aa7184c0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_datastore.go @@ -0,0 +1,72 @@ +package datastore + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Datastore interface { +} + +func unmarshalDatastoreImplementation(input []byte) (Datastore, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling Datastore into map[string]interface: %+v", err) + } + + value, ok := temp["datastoreType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "AzureBlob") { + var out AzureBlobDatastore + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AzureBlobDatastore: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "AzureDataLakeGen1") { + var out AzureDataLakeGen1Datastore + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AzureDataLakeGen1Datastore: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "AzureDataLakeGen2") { + var out AzureDataLakeGen2Datastore + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AzureDataLakeGen2Datastore: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "AzureFile") { + var out AzureFileDatastore + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AzureFileDatastore: %+v", err) + } + return out, nil + } + + type RawDatastoreImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawDatastoreImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_datastorecredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_datastorecredentials.go new file mode 100644 index 000000000000..e42245d15035 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_datastorecredentials.go @@ -0,0 +1,80 @@ +package datastore + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatastoreCredentials interface { +} + +func unmarshalDatastoreCredentialsImplementation(input []byte) (DatastoreCredentials, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling DatastoreCredentials into map[string]interface: %+v", err) + } + + value, ok := temp["credentialsType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "AccountKey") { + var out AccountKeyDatastoreCredentials + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AccountKeyDatastoreCredentials: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Certificate") { + var out CertificateDatastoreCredentials + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into CertificateDatastoreCredentials: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "None") { + var out NoneDatastoreCredentials + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into NoneDatastoreCredentials: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Sas") { + var out SasDatastoreCredentials + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SasDatastoreCredentials: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ServicePrincipal") { + var out ServicePrincipalDatastoreCredentials + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServicePrincipalDatastoreCredentials: %+v", err) + } + return out, nil + } + + type RawDatastoreCredentialsImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawDatastoreCredentialsImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_datastoreresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_datastoreresource.go new file mode 100644 index 000000000000..31ea1d51fe74 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_datastoreresource.go @@ -0,0 +1,48 @@ +package datastore + +import ( + "encoding/json" + "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatastoreResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties Datastore `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Unmarshaler = &DatastoreResource{} + +func (s *DatastoreResource) UnmarshalJSON(bytes []byte) error { + type alias DatastoreResource + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into DatastoreResource: %+v", err) + } + + s.Id = decoded.Id + s.Name = decoded.Name + s.SystemData = decoded.SystemData + s.Type = decoded.Type + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling DatastoreResource into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["properties"]; ok { + impl, err := unmarshalDatastoreImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Properties' for 'DatastoreResource': %+v", err) + } + s.Properties = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_datastoresecrets.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_datastoresecrets.go new file mode 100644 index 000000000000..4abc05c2fc95 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_datastoresecrets.go @@ -0,0 +1,72 @@ +package datastore + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatastoreSecrets interface { +} + +func unmarshalDatastoreSecretsImplementation(input []byte) (DatastoreSecrets, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling DatastoreSecrets into map[string]interface: %+v", err) + } + + value, ok := temp["secretsType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "AccountKey") { + var out AccountKeyDatastoreSecrets + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AccountKeyDatastoreSecrets: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Certificate") { + var out CertificateDatastoreSecrets + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into CertificateDatastoreSecrets: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Sas") { + var out SasDatastoreSecrets + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SasDatastoreSecrets: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ServicePrincipal") { + var out ServicePrincipalDatastoreSecrets + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServicePrincipalDatastoreSecrets: %+v", err) + } + return out, nil + } + + type RawDatastoreSecretsImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawDatastoreSecretsImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_nonedatastorecredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_nonedatastorecredentials.go new file mode 100644 index 000000000000..26499e05a90d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_nonedatastorecredentials.go @@ -0,0 +1,40 @@ +package datastore + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DatastoreCredentials = NoneDatastoreCredentials{} + +type NoneDatastoreCredentials struct { + + // Fields inherited from DatastoreCredentials +} + +var _ json.Marshaler = NoneDatastoreCredentials{} + +func (s NoneDatastoreCredentials) MarshalJSON() ([]byte, error) { + type wrapper NoneDatastoreCredentials + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling NoneDatastoreCredentials: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling NoneDatastoreCredentials: %+v", err) + } + decoded["credentialsType"] = "None" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling NoneDatastoreCredentials: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_sasdatastorecredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_sasdatastorecredentials.go new file mode 100644 index 000000000000..73efe6458b40 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_sasdatastorecredentials.go @@ -0,0 +1,60 @@ +package datastore + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DatastoreCredentials = SasDatastoreCredentials{} + +type SasDatastoreCredentials struct { + Secrets DatastoreSecrets `json:"secrets"` + + // Fields inherited from DatastoreCredentials +} + +var _ json.Marshaler = SasDatastoreCredentials{} + +func (s SasDatastoreCredentials) MarshalJSON() ([]byte, error) { + type wrapper SasDatastoreCredentials + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SasDatastoreCredentials: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SasDatastoreCredentials: %+v", err) + } + decoded["credentialsType"] = "Sas" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SasDatastoreCredentials: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &SasDatastoreCredentials{} + +func (s *SasDatastoreCredentials) UnmarshalJSON(bytes []byte) error { + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling SasDatastoreCredentials into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["secrets"]; ok { + impl, err := unmarshalDatastoreSecretsImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Secrets' for 'SasDatastoreCredentials': %+v", err) + } + s.Secrets = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_sasdatastoresecrets.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_sasdatastoresecrets.go new file mode 100644 index 000000000000..f99c98f83712 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_sasdatastoresecrets.go @@ -0,0 +1,41 @@ +package datastore + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DatastoreSecrets = SasDatastoreSecrets{} + +type SasDatastoreSecrets struct { + SasToken *string `json:"sasToken,omitempty"` + + // Fields inherited from DatastoreSecrets +} + +var _ json.Marshaler = SasDatastoreSecrets{} + +func (s SasDatastoreSecrets) MarshalJSON() ([]byte, error) { + type wrapper SasDatastoreSecrets + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SasDatastoreSecrets: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SasDatastoreSecrets: %+v", err) + } + decoded["secretsType"] = "Sas" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SasDatastoreSecrets: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_serviceprincipaldatastorecredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_serviceprincipaldatastorecredentials.go new file mode 100644 index 000000000000..174520697ae5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_serviceprincipaldatastorecredentials.go @@ -0,0 +1,74 @@ +package datastore + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DatastoreCredentials = ServicePrincipalDatastoreCredentials{} + +type ServicePrincipalDatastoreCredentials struct { + AuthorityUrl *string `json:"authorityUrl,omitempty"` + ClientId string `json:"clientId"` + ResourceUrl *string `json:"resourceUrl,omitempty"` + Secrets DatastoreSecrets `json:"secrets"` + TenantId string `json:"tenantId"` + + // Fields inherited from DatastoreCredentials +} + +var _ json.Marshaler = ServicePrincipalDatastoreCredentials{} + +func (s ServicePrincipalDatastoreCredentials) MarshalJSON() ([]byte, error) { + type wrapper ServicePrincipalDatastoreCredentials + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServicePrincipalDatastoreCredentials: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServicePrincipalDatastoreCredentials: %+v", err) + } + decoded["credentialsType"] = "ServicePrincipal" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServicePrincipalDatastoreCredentials: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &ServicePrincipalDatastoreCredentials{} + +func (s *ServicePrincipalDatastoreCredentials) UnmarshalJSON(bytes []byte) error { + type alias ServicePrincipalDatastoreCredentials + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into ServicePrincipalDatastoreCredentials: %+v", err) + } + + s.AuthorityUrl = decoded.AuthorityUrl + s.ClientId = decoded.ClientId + s.ResourceUrl = decoded.ResourceUrl + s.TenantId = decoded.TenantId + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling ServicePrincipalDatastoreCredentials into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["secrets"]; ok { + impl, err := unmarshalDatastoreSecretsImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Secrets' for 'ServicePrincipalDatastoreCredentials': %+v", err) + } + s.Secrets = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_serviceprincipaldatastoresecrets.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_serviceprincipaldatastoresecrets.go new file mode 100644 index 000000000000..d2466b0f1dae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/model_serviceprincipaldatastoresecrets.go @@ -0,0 +1,41 @@ +package datastore + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DatastoreSecrets = ServicePrincipalDatastoreSecrets{} + +type ServicePrincipalDatastoreSecrets struct { + ClientSecret *string `json:"clientSecret,omitempty"` + + // Fields inherited from DatastoreSecrets +} + +var _ json.Marshaler = ServicePrincipalDatastoreSecrets{} + +func (s ServicePrincipalDatastoreSecrets) MarshalJSON() ([]byte, error) { + type wrapper ServicePrincipalDatastoreSecrets + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServicePrincipalDatastoreSecrets: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServicePrincipalDatastoreSecrets: %+v", err) + } + decoded["secretsType"] = "ServicePrincipal" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServicePrincipalDatastoreSecrets: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/predicates.go new file mode 100644 index 000000000000..05b6e2f85ad3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/predicates.go @@ -0,0 +1,24 @@ +package datastore + +type DatastoreResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DatastoreResourceOperationPredicate) Matches(input DatastoreResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/version.go new file mode 100644 index 000000000000..8202e881c899 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore/version.go @@ -0,0 +1,12 @@ +package datastore + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/datastore/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/method_computelistkeys_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/method_computelistkeys_autorest.go index 44452c47ef7e..df237095c7aa 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/method_computelistkeys_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/method_computelistkeys_autorest.go @@ -2,8 +2,8 @@ package machinelearningcomputes import ( "context" + "encoding/json" "fmt" - "io/ioutil" "net/http" "github.com/Azure/go-autorest/autorest" @@ -59,16 +59,14 @@ func (c MachineLearningComputesClient) preparerForComputeListKeys(ctx context.Co // responderForComputeListKeys handles the response to the ComputeListKeys request. The method always // closes the http.Response Body. func (c MachineLearningComputesClient) responderForComputeListKeys(resp *http.Response) (result ComputeListKeysOperationResponse, err error) { + var respObj json.RawMessage err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), autorest.ByClosing()) result.HttpResponse = resp - b, err := ioutil.ReadAll(resp.Body) - if err != nil { - return result, fmt.Errorf("reading response body for ComputeSecrets: %+v", err) - } - model, err := unmarshalComputeSecretsImplementation(b) + model, err := unmarshalComputeSecretsImplementation(respObj) if err != nil { return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/README.md index 89e9a616ebcb..41f891ed3256 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "maintenanceConfigurationValue") payload := maintenanceconfigurations.MaintenanceConfiguration{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "maintenanceConfigurationValue") read, err := client.Delete(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "maintenanceConfigurationValue") read, err := client.Get(ctx, id) if err != nil { @@ -109,7 +109,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "maintenanceConfigurationValue") payload := maintenanceconfigurations.MaintenanceConfiguration{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/id_maintenanceconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/id_maintenanceconfiguration.go index 26f59b7c5373..97a7cbb8ec1f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/id_maintenanceconfiguration.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/id_maintenanceconfiguration.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = MaintenanceConfigurationId{} // MaintenanceConfigurationId is a struct representing the Resource ID for a Maintenance Configuration type MaintenanceConfigurationId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string + SubscriptionId string + ResourceGroupName string + MaintenanceConfigurationName string } // NewMaintenanceConfigurationID returns a new MaintenanceConfigurationId struct -func NewMaintenanceConfigurationID(subscriptionId string, resourceGroupName string, resourceName string) MaintenanceConfigurationId { +func NewMaintenanceConfigurationID(subscriptionId string, resourceGroupName string, maintenanceConfigurationName string) MaintenanceConfigurationId { return MaintenanceConfigurationId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MaintenanceConfigurationName: maintenanceConfigurationName, } } @@ -44,8 +44,8 @@ func ParseMaintenanceConfigurationID(input string) (*MaintenanceConfigurationId, return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'maintenanceConfigurationName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseMaintenanceConfigurationIDInsensitively(input string) (*MaintenanceCon return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'maintenanceConfigurationName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateMaintenanceConfigurationID(input interface{}, key string) (warnings // ID returns the formatted Maintenance Configuration ID func (id MaintenanceConfigurationId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Maintenance/maintenanceConfigurations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MaintenanceConfigurationName) } // Segments returns a slice of Resource ID Segments which comprise this Maintenance Configuration ID @@ -109,7 +109,7 @@ func (id MaintenanceConfigurationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMaintenance", "Microsoft.Maintenance", "Microsoft.Maintenance"), resourceids.StaticSegment("staticMaintenanceConfigurations", "maintenanceConfigurations", "maintenanceConfigurations"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("maintenanceConfigurationName", "maintenanceConfigurationValue"), } } @@ -118,7 +118,7 @@ func (id MaintenanceConfigurationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Maintenance Configuration Name: %q", id.MaintenanceConfigurationName), } return fmt.Sprintf("Maintenance Configuration (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/README.md index 304a19eed42d..ae8e287a56f0 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := publicmaintenanceconfigurations.NewPublicMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "resourceValue") +id := publicmaintenanceconfigurations.NewPublicMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "publicMaintenanceConfigurationValue") read, err := client.Get(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go index 598ea7f1a237..0bbb1863aa8a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go @@ -11,15 +11,15 @@ var _ resourceids.ResourceId = PublicMaintenanceConfigurationId{} // PublicMaintenanceConfigurationId is a struct representing the Resource ID for a Public Maintenance Configuration type PublicMaintenanceConfigurationId struct { - SubscriptionId string - ResourceName string + SubscriptionId string + PublicMaintenanceConfigurationName string } // NewPublicMaintenanceConfigurationID returns a new PublicMaintenanceConfigurationId struct -func NewPublicMaintenanceConfigurationID(subscriptionId string, resourceName string) PublicMaintenanceConfigurationId { +func NewPublicMaintenanceConfigurationID(subscriptionId string, publicMaintenanceConfigurationName string) PublicMaintenanceConfigurationId { return PublicMaintenanceConfigurationId{ - SubscriptionId: subscriptionId, - ResourceName: resourceName, + SubscriptionId: subscriptionId, + PublicMaintenanceConfigurationName: publicMaintenanceConfigurationName, } } @@ -38,8 +38,8 @@ func ParsePublicMaintenanceConfigurationID(input string) (*PublicMaintenanceConf return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.PublicMaintenanceConfigurationName, ok = parsed.Parsed["publicMaintenanceConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'publicMaintenanceConfigurationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParsePublicMaintenanceConfigurationIDInsensitively(input string) (*PublicMa return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.PublicMaintenanceConfigurationName, ok = parsed.Parsed["publicMaintenanceConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'publicMaintenanceConfigurationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidatePublicMaintenanceConfigurationID(input interface{}, key string) (wa // ID returns the formatted Public Maintenance Configuration ID func (id PublicMaintenanceConfigurationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.PublicMaintenanceConfigurationName) } // Segments returns a slice of Resource ID Segments which comprise this Public Maintenance Configuration ID @@ -97,7 +97,7 @@ func (id PublicMaintenanceConfigurationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMaintenance", "Microsoft.Maintenance", "Microsoft.Maintenance"), resourceids.StaticSegment("staticPublicMaintenanceConfigurations", "publicMaintenanceConfigurations", "publicMaintenanceConfigurations"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("publicMaintenanceConfigurationName", "publicMaintenanceConfigurationValue"), } } @@ -105,7 +105,7 @@ func (id PublicMaintenanceConfigurationId) Segments() []resourceids.Segment { func (id PublicMaintenanceConfigurationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Public Maintenance Configuration Name: %q", id.PublicMaintenanceConfigurationName), } return fmt.Sprintf("Public Maintenance Configuration (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2022-01-31-preview/managedidentities/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2022-01-31-preview/managedidentities/README.md index 87c7fb6e5873..67d3064e6dfa 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2022-01-31-preview/managedidentities/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2022-01-31-preview/managedidentities/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := managedidentities.NewFederatedIdentityCredentialID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "federatedIdentityCredentialResourceValue") +id := managedidentities.NewFederatedIdentityCredentialID("12345678-1234-9876-4563-123456789012", "example-resource-group", "userAssignedIdentityValue", "federatedIdentityCredentialValue") payload := managedidentities.FederatedIdentityCredential{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedidentities.NewFederatedIdentityCredentialID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "federatedIdentityCredentialResourceValue") +id := managedidentities.NewFederatedIdentityCredentialID("12345678-1234-9876-4563-123456789012", "example-resource-group", "userAssignedIdentityValue", "federatedIdentityCredentialValue") read, err := client.FederatedIdentityCredentialsDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedidentities.NewFederatedIdentityCredentialID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "federatedIdentityCredentialResourceValue") +id := managedidentities.NewFederatedIdentityCredentialID("12345678-1234-9876-4563-123456789012", "example-resource-group", "userAssignedIdentityValue", "federatedIdentityCredentialValue") read, err := client.FederatedIdentityCredentialsGet(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "userAssignedIdentityValue") // alternatively `client.FederatedIdentityCredentialsList(ctx, id, managedidentities.DefaultFederatedIdentityCredentialsListOperationOptions())` can be used to do batched pagination items, err := client.FederatedIdentityCredentialsListComplete(ctx, id, managedidentities.DefaultFederatedIdentityCredentialsListOperationOptions()) @@ -110,7 +110,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "userAssignedIdentityValue") payload := managedidentities.Identity{ // ... @@ -131,7 +131,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "userAssignedIdentityValue") read, err := client.UserAssignedIdentitiesDelete(ctx, id) if err != nil { @@ -147,7 +147,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "userAssignedIdentityValue") read, err := client.UserAssignedIdentitiesGet(ctx, id) if err != nil { @@ -163,7 +163,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "userAssignedIdentityValue") // alternatively `client.UserAssignedIdentitiesListAssociatedResources(ctx, id, managedidentities.DefaultUserAssignedIdentitiesListAssociatedResourcesOperationOptions())` can be used to do batched pagination items, err := client.UserAssignedIdentitiesListAssociatedResourcesComplete(ctx, id, managedidentities.DefaultUserAssignedIdentitiesListAssociatedResourcesOperationOptions()) @@ -214,7 +214,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "userAssignedIdentityValue") payload := managedidentities.IdentityUpdate{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2022-01-31-preview/managedidentities/id_federatedidentitycredential.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2022-01-31-preview/managedidentities/id_federatedidentitycredential.go index 506307c7ad20..59e5f6a0824e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2022-01-31-preview/managedidentities/id_federatedidentitycredential.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2022-01-31-preview/managedidentities/id_federatedidentitycredential.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = FederatedIdentityCredentialId{} // FederatedIdentityCredentialId is a struct representing the Resource ID for a Federated Identity Credential type FederatedIdentityCredentialId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - FederatedIdentityCredentialResourceName string + SubscriptionId string + ResourceGroupName string + UserAssignedIdentityName string + FederatedIdentityCredentialName string } // NewFederatedIdentityCredentialID returns a new FederatedIdentityCredentialId struct -func NewFederatedIdentityCredentialID(subscriptionId string, resourceGroupName string, resourceName string, federatedIdentityCredentialResourceName string) FederatedIdentityCredentialId { +func NewFederatedIdentityCredentialID(subscriptionId string, resourceGroupName string, userAssignedIdentityName string, federatedIdentityCredentialName string) FederatedIdentityCredentialId { return FederatedIdentityCredentialId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - FederatedIdentityCredentialResourceName: federatedIdentityCredentialResourceName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + UserAssignedIdentityName: userAssignedIdentityName, + FederatedIdentityCredentialName: federatedIdentityCredentialName, } } @@ -46,12 +46,12 @@ func ParseFederatedIdentityCredentialID(input string) (*FederatedIdentityCredent return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.UserAssignedIdentityName, ok = parsed.Parsed["userAssignedIdentityName"]; !ok { + return nil, fmt.Errorf("the segment 'userAssignedIdentityName' was not found in the resource id %q", input) } - if id.FederatedIdentityCredentialResourceName, ok = parsed.Parsed["federatedIdentityCredentialResourceName"]; !ok { - return nil, fmt.Errorf("the segment 'federatedIdentityCredentialResourceName' was not found in the resource id %q", input) + if id.FederatedIdentityCredentialName, ok = parsed.Parsed["federatedIdentityCredentialName"]; !ok { + return nil, fmt.Errorf("the segment 'federatedIdentityCredentialName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseFederatedIdentityCredentialIDInsensitively(input string) (*FederatedId return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.UserAssignedIdentityName, ok = parsed.Parsed["userAssignedIdentityName"]; !ok { + return nil, fmt.Errorf("the segment 'userAssignedIdentityName' was not found in the resource id %q", input) } - if id.FederatedIdentityCredentialResourceName, ok = parsed.Parsed["federatedIdentityCredentialResourceName"]; !ok { - return nil, fmt.Errorf("the segment 'federatedIdentityCredentialResourceName' was not found in the resource id %q", input) + if id.FederatedIdentityCredentialName, ok = parsed.Parsed["federatedIdentityCredentialName"]; !ok { + return nil, fmt.Errorf("the segment 'federatedIdentityCredentialName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateFederatedIdentityCredentialID(input interface{}, key string) (warni // ID returns the formatted Federated Identity Credential ID func (id FederatedIdentityCredentialId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ManagedIdentity/userAssignedIdentities/%s/federatedIdentityCredentials/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.FederatedIdentityCredentialResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.UserAssignedIdentityName, id.FederatedIdentityCredentialName) } // Segments returns a slice of Resource ID Segments which comprise this Federated Identity Credential ID @@ -119,9 +119,9 @@ func (id FederatedIdentityCredentialId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftManagedIdentity", "Microsoft.ManagedIdentity", "Microsoft.ManagedIdentity"), resourceids.StaticSegment("staticUserAssignedIdentities", "userAssignedIdentities", "userAssignedIdentities"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("userAssignedIdentityName", "userAssignedIdentityValue"), resourceids.StaticSegment("staticFederatedIdentityCredentials", "federatedIdentityCredentials", "federatedIdentityCredentials"), - resourceids.UserSpecifiedSegment("federatedIdentityCredentialResourceName", "federatedIdentityCredentialResourceValue"), + resourceids.UserSpecifiedSegment("federatedIdentityCredentialName", "federatedIdentityCredentialValue"), } } @@ -130,8 +130,8 @@ func (id FederatedIdentityCredentialId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Federated Identity Credential Resource Name: %q", id.FederatedIdentityCredentialResourceName), + fmt.Sprintf("User Assigned Identity Name: %q", id.UserAssignedIdentityName), + fmt.Sprintf("Federated Identity Credential Name: %q", id.FederatedIdentityCredentialName), } return fmt.Sprintf("Federated Identity Credential (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/README.md deleted file mode 100644 index 218a994794b9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/README.md +++ /dev/null @@ -1,111 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters` Documentation - -The `accountfilters` SDK allows for interaction with the Azure Resource Manager Service `media` (API Version `2020-05-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters" -``` - - -### Client Initialization - -```go -client := accountfilters.NewAccountFiltersClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `AccountFiltersClient.AccountFiltersCreateOrUpdate` - -```go -ctx := context.TODO() -id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "filterValue") - -payload := accountfilters.AccountFilter{ - // ... -} - - -read, err := client.AccountFiltersCreateOrUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountFiltersClient.AccountFiltersDelete` - -```go -ctx := context.TODO() -id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "filterValue") - -read, err := client.AccountFiltersDelete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountFiltersClient.AccountFiltersGet` - -```go -ctx := context.TODO() -id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "filterValue") - -read, err := client.AccountFiltersGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountFiltersClient.AccountFiltersList` - -```go -ctx := context.TODO() -id := accountfilters.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -// alternatively `client.AccountFiltersList(ctx, id)` can be used to do batched pagination -items, err := client.AccountFiltersListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `AccountFiltersClient.AccountFiltersUpdate` - -```go -ctx := context.TODO() -id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "filterValue") - -payload := accountfilters.AccountFilter{ - // ... -} - - -read, err := client.AccountFiltersUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/client.go deleted file mode 100644 index 5e041095dd7d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package accountfilters - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountFiltersClient struct { - Client autorest.Client - baseUri string -} - -func NewAccountFiltersClientWithBaseURI(endpoint string) AccountFiltersClient { - return AccountFiltersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/constants.go deleted file mode 100644 index 8dd03ce1df0b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/constants.go +++ /dev/null @@ -1,74 +0,0 @@ -package accountfilters - -import "strings" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type FilterTrackPropertyCompareOperation string - -const ( - FilterTrackPropertyCompareOperationEqual FilterTrackPropertyCompareOperation = "Equal" - FilterTrackPropertyCompareOperationNotEqual FilterTrackPropertyCompareOperation = "NotEqual" -) - -func PossibleValuesForFilterTrackPropertyCompareOperation() []string { - return []string{ - string(FilterTrackPropertyCompareOperationEqual), - string(FilterTrackPropertyCompareOperationNotEqual), - } -} - -func parseFilterTrackPropertyCompareOperation(input string) (*FilterTrackPropertyCompareOperation, error) { - vals := map[string]FilterTrackPropertyCompareOperation{ - "equal": FilterTrackPropertyCompareOperationEqual, - "notequal": FilterTrackPropertyCompareOperationNotEqual, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FilterTrackPropertyCompareOperation(input) - return &out, nil -} - -type FilterTrackPropertyType string - -const ( - FilterTrackPropertyTypeBitrate FilterTrackPropertyType = "Bitrate" - FilterTrackPropertyTypeFourCC FilterTrackPropertyType = "FourCC" - FilterTrackPropertyTypeLanguage FilterTrackPropertyType = "Language" - FilterTrackPropertyTypeName FilterTrackPropertyType = "Name" - FilterTrackPropertyTypeType FilterTrackPropertyType = "Type" - FilterTrackPropertyTypeUnknown FilterTrackPropertyType = "Unknown" -) - -func PossibleValuesForFilterTrackPropertyType() []string { - return []string{ - string(FilterTrackPropertyTypeBitrate), - string(FilterTrackPropertyTypeFourCC), - string(FilterTrackPropertyTypeLanguage), - string(FilterTrackPropertyTypeName), - string(FilterTrackPropertyTypeType), - string(FilterTrackPropertyTypeUnknown), - } -} - -func parseFilterTrackPropertyType(input string) (*FilterTrackPropertyType, error) { - vals := map[string]FilterTrackPropertyType{ - "bitrate": FilterTrackPropertyTypeBitrate, - "fourcc": FilterTrackPropertyTypeFourCC, - "language": FilterTrackPropertyTypeLanguage, - "name": FilterTrackPropertyTypeName, - "type": FilterTrackPropertyTypeType, - "unknown": FilterTrackPropertyTypeUnknown, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FilterTrackPropertyType(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/id_accountfilter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/id_accountfilter.go deleted file mode 100644 index 30c106c73d5c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/id_accountfilter.go +++ /dev/null @@ -1,137 +0,0 @@ -package accountfilters - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = AccountFilterId{} - -// AccountFilterId is a struct representing the Resource ID for a Account Filter -type AccountFilterId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - FilterName string -} - -// NewAccountFilterID returns a new AccountFilterId struct -func NewAccountFilterID(subscriptionId string, resourceGroupName string, accountName string, filterName string) AccountFilterId { - return AccountFilterId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - FilterName: filterName, - } -} - -// ParseAccountFilterID parses 'input' into a AccountFilterId -func ParseAccountFilterID(input string) (*AccountFilterId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountFilterId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AccountFilterId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.FilterName, ok = parsed.Parsed["filterName"]; !ok { - return nil, fmt.Errorf("the segment 'filterName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseAccountFilterIDInsensitively parses 'input' case-insensitively into a AccountFilterId -// note: this method should only be used for API response data and not user input -func ParseAccountFilterIDInsensitively(input string) (*AccountFilterId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountFilterId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AccountFilterId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.FilterName, ok = parsed.Parsed["filterName"]; !ok { - return nil, fmt.Errorf("the segment 'filterName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateAccountFilterID checks that 'input' can be parsed as a Account Filter ID -func ValidateAccountFilterID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseAccountFilterID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Account Filter ID -func (id AccountFilterId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/accountFilters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.FilterName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Account Filter ID -func (id AccountFilterId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticAccountFilters", "accountFilters", "accountFilters"), - resourceids.UserSpecifiedSegment("filterName", "filterValue"), - } -} - -// String returns a human-readable description of this Account Filter ID -func (id AccountFilterId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Filter Name: %q", id.FilterName), - } - return fmt.Sprintf("Account Filter (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/id_mediaservice.go deleted file mode 100644 index df615056343f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/id_mediaservice.go +++ /dev/null @@ -1,124 +0,0 @@ -package accountfilters - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = MediaServiceId{} - -// MediaServiceId is a struct representing the Resource ID for a Media Service -type MediaServiceId struct { - SubscriptionId string - ResourceGroupName string - AccountName string -} - -// NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { - return MediaServiceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - } -} - -// ParseMediaServiceID parses 'input' into a MediaServiceId -func ParseMediaServiceID(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseMediaServiceIDInsensitively parses 'input' case-insensitively into a MediaServiceId -// note: this method should only be used for API response data and not user input -func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID -func ValidateMediaServiceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseMediaServiceID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Media Service ID -func (id MediaServiceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Media Service ID -func (id MediaServiceId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - } -} - -// String returns a human-readable description of this Media Service ID -func (id MediaServiceId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - } - return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/method_accountfilterscreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/method_accountfilterscreateorupdate_autorest.go deleted file mode 100644 index 3bec2771a02e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/method_accountfilterscreateorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package accountfilters - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountFiltersCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *AccountFilter -} - -// AccountFiltersCreateOrUpdate ... -func (c AccountFiltersClient) AccountFiltersCreateOrUpdate(ctx context.Context, id AccountFilterId, input AccountFilter) (result AccountFiltersCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForAccountFiltersCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAccountFiltersCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAccountFiltersCreateOrUpdate prepares the AccountFiltersCreateOrUpdate request. -func (c AccountFiltersClient) preparerForAccountFiltersCreateOrUpdate(ctx context.Context, id AccountFilterId, input AccountFilter) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAccountFiltersCreateOrUpdate handles the response to the AccountFiltersCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c AccountFiltersClient) responderForAccountFiltersCreateOrUpdate(resp *http.Response) (result AccountFiltersCreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/method_accountfiltersdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/method_accountfiltersdelete_autorest.go deleted file mode 100644 index 45684a72736c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/method_accountfiltersdelete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package accountfilters - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountFiltersDeleteOperationResponse struct { - HttpResponse *http.Response -} - -// AccountFiltersDelete ... -func (c AccountFiltersClient) AccountFiltersDelete(ctx context.Context, id AccountFilterId) (result AccountFiltersDeleteOperationResponse, err error) { - req, err := c.preparerForAccountFiltersDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAccountFiltersDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAccountFiltersDelete prepares the AccountFiltersDelete request. -func (c AccountFiltersClient) preparerForAccountFiltersDelete(ctx context.Context, id AccountFilterId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAccountFiltersDelete handles the response to the AccountFiltersDelete request. The method always -// closes the http.Response Body. -func (c AccountFiltersClient) responderForAccountFiltersDelete(resp *http.Response) (result AccountFiltersDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/method_accountfiltersget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/method_accountfiltersget_autorest.go deleted file mode 100644 index f8e73d95b3d5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/method_accountfiltersget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package accountfilters - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountFiltersGetOperationResponse struct { - HttpResponse *http.Response - Model *AccountFilter -} - -// AccountFiltersGet ... -func (c AccountFiltersClient) AccountFiltersGet(ctx context.Context, id AccountFilterId) (result AccountFiltersGetOperationResponse, err error) { - req, err := c.preparerForAccountFiltersGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAccountFiltersGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAccountFiltersGet prepares the AccountFiltersGet request. -func (c AccountFiltersClient) preparerForAccountFiltersGet(ctx context.Context, id AccountFilterId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAccountFiltersGet handles the response to the AccountFiltersGet request. The method always -// closes the http.Response Body. -func (c AccountFiltersClient) responderForAccountFiltersGet(resp *http.Response) (result AccountFiltersGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/method_accountfilterslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/method_accountfilterslist_autorest.go deleted file mode 100644 index 7afc16cbf9b7..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/method_accountfilterslist_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package accountfilters - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountFiltersListOperationResponse struct { - HttpResponse *http.Response - Model *[]AccountFilter - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (AccountFiltersListOperationResponse, error) -} - -type AccountFiltersListCompleteResult struct { - Items []AccountFilter -} - -func (r AccountFiltersListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r AccountFiltersListOperationResponse) LoadMore(ctx context.Context) (resp AccountFiltersListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// AccountFiltersList ... -func (c AccountFiltersClient) AccountFiltersList(ctx context.Context, id MediaServiceId) (resp AccountFiltersListOperationResponse, err error) { - req, err := c.preparerForAccountFiltersList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForAccountFiltersList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForAccountFiltersList prepares the AccountFiltersList request. -func (c AccountFiltersClient) preparerForAccountFiltersList(ctx context.Context, id MediaServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/accountFilters", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForAccountFiltersListWithNextLink prepares the AccountFiltersList request with the given nextLink token. -func (c AccountFiltersClient) preparerForAccountFiltersListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAccountFiltersList handles the response to the AccountFiltersList request. The method always -// closes the http.Response Body. -func (c AccountFiltersClient) responderForAccountFiltersList(resp *http.Response) (result AccountFiltersListOperationResponse, err error) { - type page struct { - Values []AccountFilter `json:"value"` - NextLink *string `json:"@odata.nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result AccountFiltersListOperationResponse, err error) { - req, err := c.preparerForAccountFiltersListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAccountFiltersList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// AccountFiltersListComplete retrieves all of the results into a single object -func (c AccountFiltersClient) AccountFiltersListComplete(ctx context.Context, id MediaServiceId) (AccountFiltersListCompleteResult, error) { - return c.AccountFiltersListCompleteMatchingPredicate(ctx, id, AccountFilterOperationPredicate{}) -} - -// AccountFiltersListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AccountFiltersClient) AccountFiltersListCompleteMatchingPredicate(ctx context.Context, id MediaServiceId, predicate AccountFilterOperationPredicate) (resp AccountFiltersListCompleteResult, err error) { - items := make([]AccountFilter, 0) - - page, err := c.AccountFiltersList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := AccountFiltersListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/method_accountfiltersupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/method_accountfiltersupdate_autorest.go deleted file mode 100644 index f04a6cc8d9e5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/method_accountfiltersupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package accountfilters - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountFiltersUpdateOperationResponse struct { - HttpResponse *http.Response - Model *AccountFilter -} - -// AccountFiltersUpdate ... -func (c AccountFiltersClient) AccountFiltersUpdate(ctx context.Context, id AccountFilterId, input AccountFilter) (result AccountFiltersUpdateOperationResponse, err error) { - req, err := c.preparerForAccountFiltersUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAccountFiltersUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accountfilters.AccountFiltersClient", "AccountFiltersUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAccountFiltersUpdate prepares the AccountFiltersUpdate request. -func (c AccountFiltersClient) preparerForAccountFiltersUpdate(ctx context.Context, id AccountFilterId, input AccountFilter) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAccountFiltersUpdate handles the response to the AccountFiltersUpdate request. The method always -// closes the http.Response Body. -func (c AccountFiltersClient) responderForAccountFiltersUpdate(resp *http.Response) (result AccountFiltersUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_accountfilter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_accountfilter.go deleted file mode 100644 index 5f99540d26e8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_accountfilter.go +++ /dev/null @@ -1,16 +0,0 @@ -package accountfilters - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountFilter struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *MediaFilterProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_filtertrackpropertycondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_filtertrackpropertycondition.go deleted file mode 100644 index ecfd372cc9cc..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_filtertrackpropertycondition.go +++ /dev/null @@ -1,10 +0,0 @@ -package accountfilters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type FilterTrackPropertyCondition struct { - Operation FilterTrackPropertyCompareOperation `json:"operation"` - Property FilterTrackPropertyType `json:"property"` - Value string `json:"value"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_filtertrackselection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_filtertrackselection.go deleted file mode 100644 index d80799ed2c0f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_filtertrackselection.go +++ /dev/null @@ -1,8 +0,0 @@ -package accountfilters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type FilterTrackSelection struct { - TrackSelections []FilterTrackPropertyCondition `json:"trackSelections"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_firstquality.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_firstquality.go deleted file mode 100644 index c4854fd56969..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_firstquality.go +++ /dev/null @@ -1,8 +0,0 @@ -package accountfilters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type FirstQuality struct { - Bitrate int64 `json:"bitrate"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_mediafilterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_mediafilterproperties.go deleted file mode 100644 index 70be94a28728..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_mediafilterproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package accountfilters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MediaFilterProperties struct { - FirstQuality *FirstQuality `json:"firstQuality,omitempty"` - PresentationTimeRange *PresentationTimeRange `json:"presentationTimeRange,omitempty"` - Tracks *[]FilterTrackSelection `json:"tracks,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_presentationtimerange.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_presentationtimerange.go deleted file mode 100644 index f36ec8315716..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/model_presentationtimerange.go +++ /dev/null @@ -1,13 +0,0 @@ -package accountfilters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PresentationTimeRange struct { - EndTimestamp *int64 `json:"endTimestamp,omitempty"` - ForceEndTimestamp *bool `json:"forceEndTimestamp,omitempty"` - LiveBackoffDuration *int64 `json:"liveBackoffDuration,omitempty"` - PresentationWindowDuration *int64 `json:"presentationWindowDuration,omitempty"` - StartTimestamp *int64 `json:"startTimestamp,omitempty"` - Timescale *int64 `json:"timescale,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/predicates.go deleted file mode 100644 index ad92fefc81af..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/predicates.go +++ /dev/null @@ -1,24 +0,0 @@ -package accountfilters - -type AccountFilterOperationPredicate struct { - Id *string - Name *string - Type *string -} - -func (p AccountFilterOperationPredicate) Matches(input AccountFilter) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/version.go deleted file mode 100644 index d9e58d88e3a1..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package accountfilters - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2020-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/accountfilters/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/README.md deleted file mode 100644 index d7947bbaf8db..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/README.md +++ /dev/null @@ -1,308 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts` Documentation - -The `accounts` SDK allows for interaction with the Azure Resource Manager Service `media` (API Version `2020-05-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts" -``` - - -### Client Initialization - -```go -client := accounts.NewAccountsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `AccountsClient.LocationsCheckNameAvailability` - -```go -ctx := context.TODO() -id := accounts.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -payload := accounts.CheckNameAvailabilityInput{ - // ... -} - - -read, err := client.LocationsCheckNameAvailability(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountsClient.MediaservicesCreateOrUpdate` - -```go -ctx := context.TODO() -id := accounts.NewProviderMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -payload := accounts.MediaService{ - // ... -} - - -read, err := client.MediaservicesCreateOrUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountsClient.MediaservicesDelete` - -```go -ctx := context.TODO() -id := accounts.NewProviderMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -read, err := client.MediaservicesDelete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountsClient.MediaservicesGet` - -```go -ctx := context.TODO() -id := accounts.NewProviderMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -read, err := client.MediaservicesGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountsClient.MediaservicesGetBySubscription` - -```go -ctx := context.TODO() -id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "accountValue") - -read, err := client.MediaservicesGetBySubscription(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountsClient.MediaservicesList` - -```go -ctx := context.TODO() -id := accounts.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") - -// alternatively `client.MediaservicesList(ctx, id)` can be used to do batched pagination -items, err := client.MediaservicesListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `AccountsClient.MediaservicesListBySubscription` - -```go -ctx := context.TODO() -id := accounts.NewSubscriptionID("12345678-1234-9876-4563-123456789012") - -// alternatively `client.MediaservicesListBySubscription(ctx, id)` can be used to do batched pagination -items, err := client.MediaservicesListBySubscriptionComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `AccountsClient.MediaservicesListEdgePolicies` - -```go -ctx := context.TODO() -id := accounts.NewProviderMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -payload := accounts.ListEdgePoliciesInput{ - // ... -} - - -read, err := client.MediaservicesListEdgePolicies(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountsClient.MediaservicesSyncStorageKeys` - -```go -ctx := context.TODO() -id := accounts.NewProviderMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -payload := accounts.SyncStorageKeysInput{ - // ... -} - - -read, err := client.MediaservicesSyncStorageKeys(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountsClient.MediaservicesUpdate` - -```go -ctx := context.TODO() -id := accounts.NewProviderMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -payload := accounts.MediaService{ - // ... -} - - -read, err := client.MediaservicesUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountsClient.PrivateEndpointConnectionsCreateOrUpdate` - -```go -ctx := context.TODO() -id := accounts.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "nameValue") - -payload := accounts.PrivateEndpointConnection{ - // ... -} - - -read, err := client.PrivateEndpointConnectionsCreateOrUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountsClient.PrivateEndpointConnectionsDelete` - -```go -ctx := context.TODO() -id := accounts.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "nameValue") - -read, err := client.PrivateEndpointConnectionsDelete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountsClient.PrivateEndpointConnectionsGet` - -```go -ctx := context.TODO() -id := accounts.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "nameValue") - -read, err := client.PrivateEndpointConnectionsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountsClient.PrivateEndpointConnectionsList` - -```go -ctx := context.TODO() -id := accounts.NewProviderMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -read, err := client.PrivateEndpointConnectionsList(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountsClient.PrivateLinkResourcesGet` - -```go -ctx := context.TODO() -id := accounts.NewPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "nameValue") - -read, err := client.PrivateLinkResourcesGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AccountsClient.PrivateLinkResourcesList` - -```go -ctx := context.TODO() -id := accounts.NewProviderMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -read, err := client.PrivateLinkResourcesList(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/client.go deleted file mode 100644 index edcf2d80f353..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package accounts - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountsClient struct { - Client autorest.Client - baseUri string -} - -func NewAccountsClientWithBaseURI(endpoint string) AccountsClient { - return AccountsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/constants.go deleted file mode 100644 index 3768d9533457..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/constants.go +++ /dev/null @@ -1,155 +0,0 @@ -package accounts - -import "strings" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountEncryptionKeyType string - -const ( - AccountEncryptionKeyTypeCustomerKey AccountEncryptionKeyType = "CustomerKey" - AccountEncryptionKeyTypeSystemKey AccountEncryptionKeyType = "SystemKey" -) - -func PossibleValuesForAccountEncryptionKeyType() []string { - return []string{ - string(AccountEncryptionKeyTypeCustomerKey), - string(AccountEncryptionKeyTypeSystemKey), - } -} - -func parseAccountEncryptionKeyType(input string) (*AccountEncryptionKeyType, error) { - vals := map[string]AccountEncryptionKeyType{ - "customerkey": AccountEncryptionKeyTypeCustomerKey, - "systemkey": AccountEncryptionKeyTypeSystemKey, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccountEncryptionKeyType(input) - return &out, nil -} - -type PrivateEndpointConnectionProvisioningState string - -const ( - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" -) - -func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { - return []string{ - string(PrivateEndpointConnectionProvisioningStateCreating), - string(PrivateEndpointConnectionProvisioningStateDeleting), - string(PrivateEndpointConnectionProvisioningStateFailed), - string(PrivateEndpointConnectionProvisioningStateSucceeded), - } -} - -func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { - vals := map[string]PrivateEndpointConnectionProvisioningState{ - "creating": PrivateEndpointConnectionProvisioningStateCreating, - "deleting": PrivateEndpointConnectionProvisioningStateDeleting, - "failed": PrivateEndpointConnectionProvisioningStateFailed, - "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PrivateEndpointConnectionProvisioningState(input) - return &out, nil -} - -type PrivateEndpointServiceConnectionStatus string - -const ( - PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" - PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" -) - -func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { - return []string{ - string(PrivateEndpointServiceConnectionStatusApproved), - string(PrivateEndpointServiceConnectionStatusPending), - string(PrivateEndpointServiceConnectionStatusRejected), - } -} - -func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { - vals := map[string]PrivateEndpointServiceConnectionStatus{ - "approved": PrivateEndpointServiceConnectionStatusApproved, - "pending": PrivateEndpointServiceConnectionStatusPending, - "rejected": PrivateEndpointServiceConnectionStatusRejected, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PrivateEndpointServiceConnectionStatus(input) - return &out, nil -} - -type StorageAccountType string - -const ( - StorageAccountTypePrimary StorageAccountType = "Primary" - StorageAccountTypeSecondary StorageAccountType = "Secondary" -) - -func PossibleValuesForStorageAccountType() []string { - return []string{ - string(StorageAccountTypePrimary), - string(StorageAccountTypeSecondary), - } -} - -func parseStorageAccountType(input string) (*StorageAccountType, error) { - vals := map[string]StorageAccountType{ - "primary": StorageAccountTypePrimary, - "secondary": StorageAccountTypeSecondary, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := StorageAccountType(input) - return &out, nil -} - -type StorageAuthentication string - -const ( - StorageAuthenticationManagedIdentity StorageAuthentication = "ManagedIdentity" - StorageAuthenticationSystem StorageAuthentication = "System" -) - -func PossibleValuesForStorageAuthentication() []string { - return []string{ - string(StorageAuthenticationManagedIdentity), - string(StorageAuthenticationSystem), - } -} - -func parseStorageAuthentication(input string) (*StorageAuthentication, error) { - vals := map[string]StorageAuthentication{ - "managedidentity": StorageAuthenticationManagedIdentity, - "system": StorageAuthenticationSystem, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := StorageAuthentication(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/id_mediaservice.go deleted file mode 100644 index 591efe37c737..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/id_mediaservice.go +++ /dev/null @@ -1,111 +0,0 @@ -package accounts - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = MediaServiceId{} - -// MediaServiceId is a struct representing the Resource ID for a Media Service -type MediaServiceId struct { - SubscriptionId string - AccountName string -} - -// NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, accountName string) MediaServiceId { - return MediaServiceId{ - SubscriptionId: subscriptionId, - AccountName: accountName, - } -} - -// ParseMediaServiceID parses 'input' into a MediaServiceId -func ParseMediaServiceID(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseMediaServiceIDInsensitively parses 'input' case-insensitively into a MediaServiceId -// note: this method should only be used for API response data and not user input -func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID -func ValidateMediaServiceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseMediaServiceID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Media Service ID -func (id MediaServiceId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.AccountName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Media Service ID -func (id MediaServiceId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - } -} - -// String returns a human-readable description of this Media Service ID -func (id MediaServiceId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Account Name: %q", id.AccountName), - } - return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/id_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/id_privateendpointconnection.go deleted file mode 100644 index 829f99616f0a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/id_privateendpointconnection.go +++ /dev/null @@ -1,137 +0,0 @@ -package accounts - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = PrivateEndpointConnectionId{} - -// PrivateEndpointConnectionId is a struct representing the Resource ID for a Private Endpoint Connection -type PrivateEndpointConnectionId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - Name string -} - -// NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct -func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, accountName string, name string) PrivateEndpointConnectionId { - return PrivateEndpointConnectionId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - Name: name, - } -} - -// ParsePrivateEndpointConnectionID parses 'input' into a PrivateEndpointConnectionId -func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionId, error) { - parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := PrivateEndpointConnectionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParsePrivateEndpointConnectionIDInsensitively parses 'input' case-insensitively into a PrivateEndpointConnectionId -// note: this method should only be used for API response data and not user input -func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpointConnectionId, error) { - parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := PrivateEndpointConnectionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID -func ValidatePrivateEndpointConnectionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParsePrivateEndpointConnectionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Private Endpoint Connection ID -func (id PrivateEndpointConnectionId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/privateEndpointConnections/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.Name) -} - -// Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID -func (id PrivateEndpointConnectionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), - resourceids.UserSpecifiedSegment("name", "nameValue"), - } -} - -// String returns a human-readable description of this Private Endpoint Connection ID -func (id PrivateEndpointConnectionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Name: %q", id.Name), - } - return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/id_privatelinkresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/id_privatelinkresource.go deleted file mode 100644 index 3c5e0da14859..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/id_privatelinkresource.go +++ /dev/null @@ -1,137 +0,0 @@ -package accounts - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = PrivateLinkResourceId{} - -// PrivateLinkResourceId is a struct representing the Resource ID for a Private Link Resource -type PrivateLinkResourceId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - Name string -} - -// NewPrivateLinkResourceID returns a new PrivateLinkResourceId struct -func NewPrivateLinkResourceID(subscriptionId string, resourceGroupName string, accountName string, name string) PrivateLinkResourceId { - return PrivateLinkResourceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - Name: name, - } -} - -// ParsePrivateLinkResourceID parses 'input' into a PrivateLinkResourceId -func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { - parser := resourceids.NewParserFromResourceIdType(PrivateLinkResourceId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := PrivateLinkResourceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParsePrivateLinkResourceIDInsensitively parses 'input' case-insensitively into a PrivateLinkResourceId -// note: this method should only be used for API response data and not user input -func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResourceId, error) { - parser := resourceids.NewParserFromResourceIdType(PrivateLinkResourceId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := PrivateLinkResourceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID -func ValidatePrivateLinkResourceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParsePrivateLinkResourceID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Private Link Resource ID -func (id PrivateLinkResourceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/privateLinkResources/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.Name) -} - -// Segments returns a slice of Resource ID Segments which comprise this Private Link Resource ID -func (id PrivateLinkResourceId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticPrivateLinkResources", "privateLinkResources", "privateLinkResources"), - resourceids.UserSpecifiedSegment("name", "nameValue"), - } -} - -// String returns a human-readable description of this Private Link Resource ID -func (id PrivateLinkResourceId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Name: %q", id.Name), - } - return fmt.Sprintf("Private Link Resource (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/id_providermediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/id_providermediaservice.go deleted file mode 100644 index 6813f562ada4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/id_providermediaservice.go +++ /dev/null @@ -1,124 +0,0 @@ -package accounts - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ProviderMediaServiceId{} - -// ProviderMediaServiceId is a struct representing the Resource ID for a Provider Media Service -type ProviderMediaServiceId struct { - SubscriptionId string - ResourceGroupName string - AccountName string -} - -// NewProviderMediaServiceID returns a new ProviderMediaServiceId struct -func NewProviderMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) ProviderMediaServiceId { - return ProviderMediaServiceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - } -} - -// ParseProviderMediaServiceID parses 'input' into a ProviderMediaServiceId -func ParseProviderMediaServiceID(input string) (*ProviderMediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(ProviderMediaServiceId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ProviderMediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseProviderMediaServiceIDInsensitively parses 'input' case-insensitively into a ProviderMediaServiceId -// note: this method should only be used for API response data and not user input -func ParseProviderMediaServiceIDInsensitively(input string) (*ProviderMediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(ProviderMediaServiceId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ProviderMediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateProviderMediaServiceID checks that 'input' can be parsed as a Provider Media Service ID -func ValidateProviderMediaServiceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseProviderMediaServiceID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Provider Media Service ID -func (id ProviderMediaServiceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Provider Media Service ID -func (id ProviderMediaServiceId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - } -} - -// String returns a human-readable description of this Provider Media Service ID -func (id ProviderMediaServiceId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - } - return fmt.Sprintf("Provider Media Service (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_locationschecknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_locationschecknameavailability_autorest.go deleted file mode 100644 index a73326352ae4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_locationschecknameavailability_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package accounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LocationsCheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - Model *EntityNameAvailabilityCheckOutput -} - -// LocationsCheckNameAvailability ... -func (c AccountsClient) LocationsCheckNameAvailability(ctx context.Context, id LocationId, input CheckNameAvailabilityInput) (result LocationsCheckNameAvailabilityOperationResponse, err error) { - req, err := c.preparerForLocationsCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "LocationsCheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "LocationsCheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForLocationsCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "LocationsCheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForLocationsCheckNameAvailability prepares the LocationsCheckNameAvailability request. -func (c AccountsClient) preparerForLocationsCheckNameAvailability(ctx context.Context, id LocationId, input CheckNameAvailabilityInput) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/checkNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForLocationsCheckNameAvailability handles the response to the LocationsCheckNameAvailability request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForLocationsCheckNameAvailability(resp *http.Response) (result LocationsCheckNameAvailabilityOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicescreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicescreateorupdate_autorest.go deleted file mode 100644 index b3a62f89a7c2..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicescreateorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package accounts - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MediaservicesCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *MediaService -} - -// MediaservicesCreateOrUpdate ... -func (c AccountsClient) MediaservicesCreateOrUpdate(ctx context.Context, id ProviderMediaServiceId, input MediaService) (result MediaservicesCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForMediaservicesCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForMediaservicesCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForMediaservicesCreateOrUpdate prepares the MediaservicesCreateOrUpdate request. -func (c AccountsClient) preparerForMediaservicesCreateOrUpdate(ctx context.Context, id ProviderMediaServiceId, input MediaService) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForMediaservicesCreateOrUpdate handles the response to the MediaservicesCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForMediaservicesCreateOrUpdate(resp *http.Response) (result MediaservicesCreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicesdelete_autorest.go deleted file mode 100644 index 7bc350f8ff5b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicesdelete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package accounts - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MediaservicesDeleteOperationResponse struct { - HttpResponse *http.Response -} - -// MediaservicesDelete ... -func (c AccountsClient) MediaservicesDelete(ctx context.Context, id ProviderMediaServiceId) (result MediaservicesDeleteOperationResponse, err error) { - req, err := c.preparerForMediaservicesDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForMediaservicesDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForMediaservicesDelete prepares the MediaservicesDelete request. -func (c AccountsClient) preparerForMediaservicesDelete(ctx context.Context, id ProviderMediaServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForMediaservicesDelete handles the response to the MediaservicesDelete request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForMediaservicesDelete(resp *http.Response) (result MediaservicesDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicesget_autorest.go deleted file mode 100644 index d7128cdf465c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicesget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package accounts - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MediaservicesGetOperationResponse struct { - HttpResponse *http.Response - Model *MediaService -} - -// MediaservicesGet ... -func (c AccountsClient) MediaservicesGet(ctx context.Context, id ProviderMediaServiceId) (result MediaservicesGetOperationResponse, err error) { - req, err := c.preparerForMediaservicesGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForMediaservicesGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForMediaservicesGet prepares the MediaservicesGet request. -func (c AccountsClient) preparerForMediaservicesGet(ctx context.Context, id ProviderMediaServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForMediaservicesGet handles the response to the MediaservicesGet request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForMediaservicesGet(resp *http.Response) (result MediaservicesGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicesgetbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicesgetbysubscription_autorest.go deleted file mode 100644 index 87015c126376..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicesgetbysubscription_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package accounts - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MediaservicesGetBySubscriptionOperationResponse struct { - HttpResponse *http.Response - Model *MediaService -} - -// MediaservicesGetBySubscription ... -func (c AccountsClient) MediaservicesGetBySubscription(ctx context.Context, id MediaServiceId) (result MediaservicesGetBySubscriptionOperationResponse, err error) { - req, err := c.preparerForMediaservicesGetBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesGetBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesGetBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForMediaservicesGetBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesGetBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForMediaservicesGetBySubscription prepares the MediaservicesGetBySubscription request. -func (c AccountsClient) preparerForMediaservicesGetBySubscription(ctx context.Context, id MediaServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForMediaservicesGetBySubscription handles the response to the MediaservicesGetBySubscription request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForMediaservicesGetBySubscription(resp *http.Response) (result MediaservicesGetBySubscriptionOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaserviceslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaserviceslist_autorest.go deleted file mode 100644 index 45adcabb761f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaserviceslist_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package accounts - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MediaservicesListOperationResponse struct { - HttpResponse *http.Response - Model *[]MediaService - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (MediaservicesListOperationResponse, error) -} - -type MediaservicesListCompleteResult struct { - Items []MediaService -} - -func (r MediaservicesListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r MediaservicesListOperationResponse) LoadMore(ctx context.Context) (resp MediaservicesListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// MediaservicesList ... -func (c AccountsClient) MediaservicesList(ctx context.Context, id commonids.ResourceGroupId) (resp MediaservicesListOperationResponse, err error) { - req, err := c.preparerForMediaservicesList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForMediaservicesList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForMediaservicesList prepares the MediaservicesList request. -func (c AccountsClient) preparerForMediaservicesList(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Media/mediaServices", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForMediaservicesListWithNextLink prepares the MediaservicesList request with the given nextLink token. -func (c AccountsClient) preparerForMediaservicesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForMediaservicesList handles the response to the MediaservicesList request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForMediaservicesList(resp *http.Response) (result MediaservicesListOperationResponse, err error) { - type page struct { - Values []MediaService `json:"value"` - NextLink *string `json:"@odata.nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result MediaservicesListOperationResponse, err error) { - req, err := c.preparerForMediaservicesListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForMediaservicesList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// MediaservicesListComplete retrieves all of the results into a single object -func (c AccountsClient) MediaservicesListComplete(ctx context.Context, id commonids.ResourceGroupId) (MediaservicesListCompleteResult, error) { - return c.MediaservicesListCompleteMatchingPredicate(ctx, id, MediaServiceOperationPredicate{}) -} - -// MediaservicesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AccountsClient) MediaservicesListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate MediaServiceOperationPredicate) (resp MediaservicesListCompleteResult, err error) { - items := make([]MediaService, 0) - - page, err := c.MediaservicesList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := MediaservicesListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaserviceslistbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaserviceslistbysubscription_autorest.go deleted file mode 100644 index 592c1b3162f0..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaserviceslistbysubscription_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package accounts - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MediaservicesListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - Model *[]MediaService - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (MediaservicesListBySubscriptionOperationResponse, error) -} - -type MediaservicesListBySubscriptionCompleteResult struct { - Items []MediaService -} - -func (r MediaservicesListBySubscriptionOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r MediaservicesListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp MediaservicesListBySubscriptionOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// MediaservicesListBySubscription ... -func (c AccountsClient) MediaservicesListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp MediaservicesListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForMediaservicesListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForMediaservicesListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForMediaservicesListBySubscription prepares the MediaservicesListBySubscription request. -func (c AccountsClient) preparerForMediaservicesListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Media/mediaServices", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForMediaservicesListBySubscriptionWithNextLink prepares the MediaservicesListBySubscription request with the given nextLink token. -func (c AccountsClient) preparerForMediaservicesListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForMediaservicesListBySubscription handles the response to the MediaservicesListBySubscription request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForMediaservicesListBySubscription(resp *http.Response) (result MediaservicesListBySubscriptionOperationResponse, err error) { - type page struct { - Values []MediaService `json:"value"` - NextLink *string `json:"@odata.nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result MediaservicesListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForMediaservicesListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForMediaservicesListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// MediaservicesListBySubscriptionComplete retrieves all of the results into a single object -func (c AccountsClient) MediaservicesListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (MediaservicesListBySubscriptionCompleteResult, error) { - return c.MediaservicesListBySubscriptionCompleteMatchingPredicate(ctx, id, MediaServiceOperationPredicate{}) -} - -// MediaservicesListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AccountsClient) MediaservicesListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate MediaServiceOperationPredicate) (resp MediaservicesListBySubscriptionCompleteResult, err error) { - items := make([]MediaService, 0) - - page, err := c.MediaservicesListBySubscription(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := MediaservicesListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaserviceslistedgepolicies_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaserviceslistedgepolicies_autorest.go deleted file mode 100644 index 8d733911a572..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaserviceslistedgepolicies_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package accounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MediaservicesListEdgePoliciesOperationResponse struct { - HttpResponse *http.Response - Model *EdgePolicies -} - -// MediaservicesListEdgePolicies ... -func (c AccountsClient) MediaservicesListEdgePolicies(ctx context.Context, id ProviderMediaServiceId, input ListEdgePoliciesInput) (result MediaservicesListEdgePoliciesOperationResponse, err error) { - req, err := c.preparerForMediaservicesListEdgePolicies(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesListEdgePolicies", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesListEdgePolicies", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForMediaservicesListEdgePolicies(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesListEdgePolicies", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForMediaservicesListEdgePolicies prepares the MediaservicesListEdgePolicies request. -func (c AccountsClient) preparerForMediaservicesListEdgePolicies(ctx context.Context, id ProviderMediaServiceId, input ListEdgePoliciesInput) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listEdgePolicies", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForMediaservicesListEdgePolicies handles the response to the MediaservicesListEdgePolicies request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForMediaservicesListEdgePolicies(resp *http.Response) (result MediaservicesListEdgePoliciesOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicessyncstoragekeys_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicessyncstoragekeys_autorest.go deleted file mode 100644 index 48fd8e7f629f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicessyncstoragekeys_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package accounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MediaservicesSyncStorageKeysOperationResponse struct { - HttpResponse *http.Response -} - -// MediaservicesSyncStorageKeys ... -func (c AccountsClient) MediaservicesSyncStorageKeys(ctx context.Context, id ProviderMediaServiceId, input SyncStorageKeysInput) (result MediaservicesSyncStorageKeysOperationResponse, err error) { - req, err := c.preparerForMediaservicesSyncStorageKeys(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesSyncStorageKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesSyncStorageKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForMediaservicesSyncStorageKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesSyncStorageKeys", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForMediaservicesSyncStorageKeys prepares the MediaservicesSyncStorageKeys request. -func (c AccountsClient) preparerForMediaservicesSyncStorageKeys(ctx context.Context, id ProviderMediaServiceId, input SyncStorageKeysInput) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/syncStorageKeys", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForMediaservicesSyncStorageKeys handles the response to the MediaservicesSyncStorageKeys request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForMediaservicesSyncStorageKeys(resp *http.Response) (result MediaservicesSyncStorageKeysOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicesupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicesupdate_autorest.go deleted file mode 100644 index efb4edebbbed..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_mediaservicesupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package accounts - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MediaservicesUpdateOperationResponse struct { - HttpResponse *http.Response - Model *MediaService -} - -// MediaservicesUpdate ... -func (c AccountsClient) MediaservicesUpdate(ctx context.Context, id ProviderMediaServiceId, input MediaService) (result MediaservicesUpdateOperationResponse, err error) { - req, err := c.preparerForMediaservicesUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForMediaservicesUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "MediaservicesUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForMediaservicesUpdate prepares the MediaservicesUpdate request. -func (c AccountsClient) preparerForMediaservicesUpdate(ctx context.Context, id ProviderMediaServiceId, input MediaService) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForMediaservicesUpdate handles the response to the MediaservicesUpdate request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForMediaservicesUpdate(resp *http.Response) (result MediaservicesUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privateendpointconnectionscreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privateendpointconnectionscreateorupdate_autorest.go deleted file mode 100644 index 9eadb86f9b34..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privateendpointconnectionscreateorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package accounts - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionsCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *PrivateEndpointConnection -} - -// PrivateEndpointConnectionsCreateOrUpdate ... -func (c AccountsClient) PrivateEndpointConnectionsCreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionsCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateEndpointConnectionsCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateEndpointConnectionsCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateEndpointConnectionsCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateEndpointConnectionsCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateEndpointConnectionsCreateOrUpdate prepares the PrivateEndpointConnectionsCreateOrUpdate request. -func (c AccountsClient) preparerForPrivateEndpointConnectionsCreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateEndpointConnectionsCreateOrUpdate handles the response to the PrivateEndpointConnectionsCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForPrivateEndpointConnectionsCreateOrUpdate(resp *http.Response) (result PrivateEndpointConnectionsCreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privateendpointconnectionsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privateendpointconnectionsdelete_autorest.go deleted file mode 100644 index 1b37407841af..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privateendpointconnectionsdelete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package accounts - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionsDeleteOperationResponse struct { - HttpResponse *http.Response -} - -// PrivateEndpointConnectionsDelete ... -func (c AccountsClient) PrivateEndpointConnectionsDelete(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionsDeleteOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionsDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateEndpointConnectionsDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateEndpointConnectionsDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateEndpointConnectionsDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateEndpointConnectionsDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateEndpointConnectionsDelete prepares the PrivateEndpointConnectionsDelete request. -func (c AccountsClient) preparerForPrivateEndpointConnectionsDelete(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateEndpointConnectionsDelete handles the response to the PrivateEndpointConnectionsDelete request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForPrivateEndpointConnectionsDelete(resp *http.Response) (result PrivateEndpointConnectionsDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privateendpointconnectionsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privateendpointconnectionsget_autorest.go deleted file mode 100644 index 26ae803596a2..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privateendpointconnectionsget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package accounts - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionsGetOperationResponse struct { - HttpResponse *http.Response - Model *PrivateEndpointConnection -} - -// PrivateEndpointConnectionsGet ... -func (c AccountsClient) PrivateEndpointConnectionsGet(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionsGetOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionsGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateEndpointConnectionsGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateEndpointConnectionsGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateEndpointConnectionsGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateEndpointConnectionsGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateEndpointConnectionsGet prepares the PrivateEndpointConnectionsGet request. -func (c AccountsClient) preparerForPrivateEndpointConnectionsGet(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateEndpointConnectionsGet handles the response to the PrivateEndpointConnectionsGet request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForPrivateEndpointConnectionsGet(resp *http.Response) (result PrivateEndpointConnectionsGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privateendpointconnectionslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privateendpointconnectionslist_autorest.go deleted file mode 100644 index 155eab769073..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privateendpointconnectionslist_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package accounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionsListOperationResponse struct { - HttpResponse *http.Response - Model *PrivateEndpointConnectionListResult -} - -// PrivateEndpointConnectionsList ... -func (c AccountsClient) PrivateEndpointConnectionsList(ctx context.Context, id ProviderMediaServiceId) (result PrivateEndpointConnectionsListOperationResponse, err error) { - req, err := c.preparerForPrivateEndpointConnectionsList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateEndpointConnectionsList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateEndpointConnectionsList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateEndpointConnectionsList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateEndpointConnectionsList", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateEndpointConnectionsList prepares the PrivateEndpointConnectionsList request. -func (c AccountsClient) preparerForPrivateEndpointConnectionsList(ctx context.Context, id ProviderMediaServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/privateEndpointConnections", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateEndpointConnectionsList handles the response to the PrivateEndpointConnectionsList request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForPrivateEndpointConnectionsList(resp *http.Response) (result PrivateEndpointConnectionsListOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privatelinkresourcesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privatelinkresourcesget_autorest.go deleted file mode 100644 index f755ef52de09..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privatelinkresourcesget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package accounts - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateLinkResourcesGetOperationResponse struct { - HttpResponse *http.Response - Model *PrivateLinkResource -} - -// PrivateLinkResourcesGet ... -func (c AccountsClient) PrivateLinkResourcesGet(ctx context.Context, id PrivateLinkResourceId) (result PrivateLinkResourcesGetOperationResponse, err error) { - req, err := c.preparerForPrivateLinkResourcesGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateLinkResourcesGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateLinkResourcesGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateLinkResourcesGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateLinkResourcesGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateLinkResourcesGet prepares the PrivateLinkResourcesGet request. -func (c AccountsClient) preparerForPrivateLinkResourcesGet(ctx context.Context, id PrivateLinkResourceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateLinkResourcesGet handles the response to the PrivateLinkResourcesGet request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForPrivateLinkResourcesGet(resp *http.Response) (result PrivateLinkResourcesGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privatelinkresourceslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privatelinkresourceslist_autorest.go deleted file mode 100644 index 4541ccb02b6e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/method_privatelinkresourceslist_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package accounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateLinkResourcesListOperationResponse struct { - HttpResponse *http.Response - Model *PrivateLinkResourceListResult -} - -// PrivateLinkResourcesList ... -func (c AccountsClient) PrivateLinkResourcesList(ctx context.Context, id ProviderMediaServiceId) (result PrivateLinkResourcesListOperationResponse, err error) { - req, err := c.preparerForPrivateLinkResourcesList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateLinkResourcesList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateLinkResourcesList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForPrivateLinkResourcesList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "PrivateLinkResourcesList", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForPrivateLinkResourcesList prepares the PrivateLinkResourcesList request. -func (c AccountsClient) preparerForPrivateLinkResourcesList(ctx context.Context, id ProviderMediaServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/privateLinkResources", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForPrivateLinkResourcesList handles the response to the PrivateLinkResourcesList request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForPrivateLinkResourcesList(resp *http.Response) (result PrivateLinkResourcesListOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_accountencryption.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_accountencryption.go deleted file mode 100644 index 464a5dae1645..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_accountencryption.go +++ /dev/null @@ -1,9 +0,0 @@ -package accounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountEncryption struct { - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` - Type AccountEncryptionKeyType `json:"type"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_checknameavailabilityinput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_checknameavailabilityinput.go deleted file mode 100644 index 707c4a0bdaba..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_checknameavailabilityinput.go +++ /dev/null @@ -1,9 +0,0 @@ -package accounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckNameAvailabilityInput struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_edgepolicies.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_edgepolicies.go deleted file mode 100644 index 1a11ba9b4748..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_edgepolicies.go +++ /dev/null @@ -1,8 +0,0 @@ -package accounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EdgePolicies struct { - UsageDataCollectionPolicy *EdgeUsageDataCollectionPolicy `json:"usageDataCollectionPolicy,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_edgeusagedatacollectionpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_edgeusagedatacollectionpolicy.go deleted file mode 100644 index f58117e0c59b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_edgeusagedatacollectionpolicy.go +++ /dev/null @@ -1,11 +0,0 @@ -package accounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EdgeUsageDataCollectionPolicy struct { - DataCollectionFrequency *string `json:"dataCollectionFrequency,omitempty"` - DataReportingFrequency *string `json:"dataReportingFrequency,omitempty"` - EventHubDetails *EdgeUsageDataEventHub `json:"eventHubDetails,omitempty"` - MaxAllowedUnreportedUsageDuration *string `json:"maxAllowedUnreportedUsageDuration,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_edgeusagedataeventhub.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_edgeusagedataeventhub.go deleted file mode 100644 index 65ac7083283a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_edgeusagedataeventhub.go +++ /dev/null @@ -1,10 +0,0 @@ -package accounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EdgeUsageDataEventHub struct { - Name *string `json:"name,omitempty"` - Namespace *string `json:"namespace,omitempty"` - Token *string `json:"token,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_entitynameavailabilitycheckoutput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_entitynameavailabilitycheckoutput.go deleted file mode 100644 index 48f4c009d58d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_entitynameavailabilitycheckoutput.go +++ /dev/null @@ -1,10 +0,0 @@ -package accounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EntityNameAvailabilityCheckOutput struct { - Message *string `json:"message,omitempty"` - NameAvailable bool `json:"nameAvailable"` - Reason *string `json:"reason,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_keyvaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_keyvaultproperties.go deleted file mode 100644 index f94833df6956..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_keyvaultproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -package accounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type KeyVaultProperties struct { - CurrentKeyIdentifier *string `json:"currentKeyIdentifier,omitempty"` - KeyIdentifier *string `json:"keyIdentifier,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_listedgepoliciesinput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_listedgepoliciesinput.go deleted file mode 100644 index accc1e3b05a7..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_listedgepoliciesinput.go +++ /dev/null @@ -1,8 +0,0 @@ -package accounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListEdgePoliciesInput struct { - DeviceId *string `json:"deviceId,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_mediaservice.go deleted file mode 100644 index 8b8a57a833fb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_mediaservice.go +++ /dev/null @@ -1,20 +0,0 @@ -package accounts - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MediaService struct { - Id *string `json:"id,omitempty"` - Identity *identity.SystemAssigned `json:"identity,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *MediaServiceProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_mediaserviceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_mediaserviceproperties.go deleted file mode 100644 index 19a3a32f94a9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_mediaserviceproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package accounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MediaServiceProperties struct { - Encryption *AccountEncryption `json:"encryption,omitempty"` - MediaServiceId *string `json:"mediaServiceId,omitempty"` - StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` - StorageAuthentication *StorageAuthentication `json:"storageAuthentication,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privateendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privateendpoint.go deleted file mode 100644 index 02b184cde738..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privateendpoint.go +++ /dev/null @@ -1,8 +0,0 @@ -package accounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpoint struct { - Id *string `json:"id,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privateendpointconnection.go deleted file mode 100644 index 133080ab8a2b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privateendpointconnection.go +++ /dev/null @@ -1,11 +0,0 @@ -package accounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnection struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privateendpointconnectionproperties.go deleted file mode 100644 index fbf3e1aa3377..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privateendpointconnectionproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package accounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionProperties struct { - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` - ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privatelinkserviceconnectionstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privatelinkserviceconnectionstate.go deleted file mode 100644 index c7ce04574ec7..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privatelinkserviceconnectionstate.go +++ /dev/null @@ -1,10 +0,0 @@ -package accounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateLinkServiceConnectionState struct { - ActionsRequired *string `json:"actionsRequired,omitempty"` - Description *string `json:"description,omitempty"` - Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_storageaccount.go deleted file mode 100644 index a7d1e58f08fa..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_storageaccount.go +++ /dev/null @@ -1,9 +0,0 @@ -package accounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StorageAccount struct { - Id *string `json:"id,omitempty"` - Type StorageAccountType `json:"type"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_syncstoragekeysinput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_syncstoragekeysinput.go deleted file mode 100644 index af87a8312839..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_syncstoragekeysinput.go +++ /dev/null @@ -1,8 +0,0 @@ -package accounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SyncStorageKeysInput struct { - Id *string `json:"id,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/predicates.go deleted file mode 100644 index 21d7064b0ec6..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/predicates.go +++ /dev/null @@ -1,29 +0,0 @@ -package accounts - -type MediaServiceOperationPredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p MediaServiceOperationPredicate) Matches(input MediaService) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/version.go deleted file mode 100644 index 625047177c44..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package accounts - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2020-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/accounts/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/README.md deleted file mode 100644 index f28ce83bdeab..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/README.md +++ /dev/null @@ -1,255 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters` Documentation - -The `assetsandassetfilters` SDK allows for interaction with the Azure Resource Manager Service `media` (API Version `2020-05-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters" -``` - - -### Client Initialization - -```go -client := assetsandassetfilters.NewAssetsAndAssetFiltersClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `AssetsAndAssetFiltersClient.AssetFiltersCreateOrUpdate` - -```go -ctx := context.TODO() -id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "filterValue") - -payload := assetsandassetfilters.AssetFilter{ - // ... -} - - -read, err := client.AssetFiltersCreateOrUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AssetsAndAssetFiltersClient.AssetFiltersDelete` - -```go -ctx := context.TODO() -id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "filterValue") - -read, err := client.AssetFiltersDelete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AssetsAndAssetFiltersClient.AssetFiltersGet` - -```go -ctx := context.TODO() -id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "filterValue") - -read, err := client.AssetFiltersGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AssetsAndAssetFiltersClient.AssetFiltersList` - -```go -ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") - -// alternatively `client.AssetFiltersList(ctx, id)` can be used to do batched pagination -items, err := client.AssetFiltersListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `AssetsAndAssetFiltersClient.AssetFiltersUpdate` - -```go -ctx := context.TODO() -id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "filterValue") - -payload := assetsandassetfilters.AssetFilter{ - // ... -} - - -read, err := client.AssetFiltersUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AssetsAndAssetFiltersClient.AssetsCreateOrUpdate` - -```go -ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") - -payload := assetsandassetfilters.Asset{ - // ... -} - - -read, err := client.AssetsCreateOrUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AssetsAndAssetFiltersClient.AssetsDelete` - -```go -ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") - -read, err := client.AssetsDelete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AssetsAndAssetFiltersClient.AssetsGet` - -```go -ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") - -read, err := client.AssetsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AssetsAndAssetFiltersClient.AssetsGetEncryptionKey` - -```go -ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") - -read, err := client.AssetsGetEncryptionKey(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AssetsAndAssetFiltersClient.AssetsList` - -```go -ctx := context.TODO() -id := assetsandassetfilters.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -// alternatively `client.AssetsList(ctx, id, assetsandassetfilters.DefaultAssetsListOperationOptions())` can be used to do batched pagination -items, err := client.AssetsListComplete(ctx, id, assetsandassetfilters.DefaultAssetsListOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `AssetsAndAssetFiltersClient.AssetsListContainerSas` - -```go -ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") - -payload := assetsandassetfilters.ListContainerSasInput{ - // ... -} - - -read, err := client.AssetsListContainerSas(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AssetsAndAssetFiltersClient.AssetsListStreamingLocators` - -```go -ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") - -read, err := client.AssetsListStreamingLocators(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AssetsAndAssetFiltersClient.AssetsUpdate` - -```go -ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") - -payload := assetsandassetfilters.Asset{ - // ... -} - - -read, err := client.AssetsUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/client.go deleted file mode 100644 index 9d09bfc90b49..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package assetsandassetfilters - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetsAndAssetFiltersClient struct { - Client autorest.Client - baseUri string -} - -func NewAssetsAndAssetFiltersClientWithBaseURI(endpoint string) AssetsAndAssetFiltersClient { - return AssetsAndAssetFiltersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/constants.go deleted file mode 100644 index c010ec3f8cf9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/constants.go +++ /dev/null @@ -1,133 +0,0 @@ -package assetsandassetfilters - -import "strings" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetContainerPermission string - -const ( - AssetContainerPermissionRead AssetContainerPermission = "Read" - AssetContainerPermissionReadWrite AssetContainerPermission = "ReadWrite" - AssetContainerPermissionReadWriteDelete AssetContainerPermission = "ReadWriteDelete" -) - -func PossibleValuesForAssetContainerPermission() []string { - return []string{ - string(AssetContainerPermissionRead), - string(AssetContainerPermissionReadWrite), - string(AssetContainerPermissionReadWriteDelete), - } -} - -func parseAssetContainerPermission(input string) (*AssetContainerPermission, error) { - vals := map[string]AssetContainerPermission{ - "read": AssetContainerPermissionRead, - "readwrite": AssetContainerPermissionReadWrite, - "readwritedelete": AssetContainerPermissionReadWriteDelete, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AssetContainerPermission(input) - return &out, nil -} - -type AssetStorageEncryptionFormat string - -const ( - AssetStorageEncryptionFormatMediaStorageClientEncryption AssetStorageEncryptionFormat = "MediaStorageClientEncryption" - AssetStorageEncryptionFormatNone AssetStorageEncryptionFormat = "None" -) - -func PossibleValuesForAssetStorageEncryptionFormat() []string { - return []string{ - string(AssetStorageEncryptionFormatMediaStorageClientEncryption), - string(AssetStorageEncryptionFormatNone), - } -} - -func parseAssetStorageEncryptionFormat(input string) (*AssetStorageEncryptionFormat, error) { - vals := map[string]AssetStorageEncryptionFormat{ - "mediastorageclientencryption": AssetStorageEncryptionFormatMediaStorageClientEncryption, - "none": AssetStorageEncryptionFormatNone, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AssetStorageEncryptionFormat(input) - return &out, nil -} - -type FilterTrackPropertyCompareOperation string - -const ( - FilterTrackPropertyCompareOperationEqual FilterTrackPropertyCompareOperation = "Equal" - FilterTrackPropertyCompareOperationNotEqual FilterTrackPropertyCompareOperation = "NotEqual" -) - -func PossibleValuesForFilterTrackPropertyCompareOperation() []string { - return []string{ - string(FilterTrackPropertyCompareOperationEqual), - string(FilterTrackPropertyCompareOperationNotEqual), - } -} - -func parseFilterTrackPropertyCompareOperation(input string) (*FilterTrackPropertyCompareOperation, error) { - vals := map[string]FilterTrackPropertyCompareOperation{ - "equal": FilterTrackPropertyCompareOperationEqual, - "notequal": FilterTrackPropertyCompareOperationNotEqual, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FilterTrackPropertyCompareOperation(input) - return &out, nil -} - -type FilterTrackPropertyType string - -const ( - FilterTrackPropertyTypeBitrate FilterTrackPropertyType = "Bitrate" - FilterTrackPropertyTypeFourCC FilterTrackPropertyType = "FourCC" - FilterTrackPropertyTypeLanguage FilterTrackPropertyType = "Language" - FilterTrackPropertyTypeName FilterTrackPropertyType = "Name" - FilterTrackPropertyTypeType FilterTrackPropertyType = "Type" - FilterTrackPropertyTypeUnknown FilterTrackPropertyType = "Unknown" -) - -func PossibleValuesForFilterTrackPropertyType() []string { - return []string{ - string(FilterTrackPropertyTypeBitrate), - string(FilterTrackPropertyTypeFourCC), - string(FilterTrackPropertyTypeLanguage), - string(FilterTrackPropertyTypeName), - string(FilterTrackPropertyTypeType), - string(FilterTrackPropertyTypeUnknown), - } -} - -func parseFilterTrackPropertyType(input string) (*FilterTrackPropertyType, error) { - vals := map[string]FilterTrackPropertyType{ - "bitrate": FilterTrackPropertyTypeBitrate, - "fourcc": FilterTrackPropertyTypeFourCC, - "language": FilterTrackPropertyTypeLanguage, - "name": FilterTrackPropertyTypeName, - "type": FilterTrackPropertyTypeType, - "unknown": FilterTrackPropertyTypeUnknown, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FilterTrackPropertyType(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/id_asset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/id_asset.go deleted file mode 100644 index c21b31a08816..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/id_asset.go +++ /dev/null @@ -1,137 +0,0 @@ -package assetsandassetfilters - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = AssetId{} - -// AssetId is a struct representing the Resource ID for a Asset -type AssetId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - AssetName string -} - -// NewAssetID returns a new AssetId struct -func NewAssetID(subscriptionId string, resourceGroupName string, accountName string, assetName string) AssetId { - return AssetId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - AssetName: assetName, - } -} - -// ParseAssetID parses 'input' into a AssetId -func ParseAssetID(input string) (*AssetId, error) { - parser := resourceids.NewParserFromResourceIdType(AssetId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AssetId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, fmt.Errorf("the segment 'assetName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseAssetIDInsensitively parses 'input' case-insensitively into a AssetId -// note: this method should only be used for API response data and not user input -func ParseAssetIDInsensitively(input string) (*AssetId, error) { - parser := resourceids.NewParserFromResourceIdType(AssetId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AssetId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, fmt.Errorf("the segment 'assetName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateAssetID checks that 'input' can be parsed as a Asset ID -func ValidateAssetID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseAssetID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Asset ID -func (id AssetId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/assets/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.AssetName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Asset ID -func (id AssetId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticAssets", "assets", "assets"), - resourceids.UserSpecifiedSegment("assetName", "assetValue"), - } -} - -// String returns a human-readable description of this Asset ID -func (id AssetId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Asset Name: %q", id.AssetName), - } - return fmt.Sprintf("Asset (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/id_assetfilter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/id_assetfilter.go deleted file mode 100644 index bfb937131a6e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/id_assetfilter.go +++ /dev/null @@ -1,150 +0,0 @@ -package assetsandassetfilters - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = AssetFilterId{} - -// AssetFilterId is a struct representing the Resource ID for a Asset Filter -type AssetFilterId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - AssetName string - FilterName string -} - -// NewAssetFilterID returns a new AssetFilterId struct -func NewAssetFilterID(subscriptionId string, resourceGroupName string, accountName string, assetName string, filterName string) AssetFilterId { - return AssetFilterId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - AssetName: assetName, - FilterName: filterName, - } -} - -// ParseAssetFilterID parses 'input' into a AssetFilterId -func ParseAssetFilterID(input string) (*AssetFilterId, error) { - parser := resourceids.NewParserFromResourceIdType(AssetFilterId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AssetFilterId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, fmt.Errorf("the segment 'assetName' was not found in the resource id %q", input) - } - - if id.FilterName, ok = parsed.Parsed["filterName"]; !ok { - return nil, fmt.Errorf("the segment 'filterName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseAssetFilterIDInsensitively parses 'input' case-insensitively into a AssetFilterId -// note: this method should only be used for API response data and not user input -func ParseAssetFilterIDInsensitively(input string) (*AssetFilterId, error) { - parser := resourceids.NewParserFromResourceIdType(AssetFilterId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AssetFilterId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, fmt.Errorf("the segment 'assetName' was not found in the resource id %q", input) - } - - if id.FilterName, ok = parsed.Parsed["filterName"]; !ok { - return nil, fmt.Errorf("the segment 'filterName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateAssetFilterID checks that 'input' can be parsed as a Asset Filter ID -func ValidateAssetFilterID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseAssetFilterID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Asset Filter ID -func (id AssetFilterId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/assets/%s/assetFilters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.AssetName, id.FilterName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Asset Filter ID -func (id AssetFilterId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticAssets", "assets", "assets"), - resourceids.UserSpecifiedSegment("assetName", "assetValue"), - resourceids.StaticSegment("staticAssetFilters", "assetFilters", "assetFilters"), - resourceids.UserSpecifiedSegment("filterName", "filterValue"), - } -} - -// String returns a human-readable description of this Asset Filter ID -func (id AssetFilterId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Asset Name: %q", id.AssetName), - fmt.Sprintf("Filter Name: %q", id.FilterName), - } - return fmt.Sprintf("Asset Filter (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/id_mediaservice.go deleted file mode 100644 index bb819030c758..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/id_mediaservice.go +++ /dev/null @@ -1,124 +0,0 @@ -package assetsandassetfilters - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = MediaServiceId{} - -// MediaServiceId is a struct representing the Resource ID for a Media Service -type MediaServiceId struct { - SubscriptionId string - ResourceGroupName string - AccountName string -} - -// NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { - return MediaServiceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - } -} - -// ParseMediaServiceID parses 'input' into a MediaServiceId -func ParseMediaServiceID(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseMediaServiceIDInsensitively parses 'input' case-insensitively into a MediaServiceId -// note: this method should only be used for API response data and not user input -func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID -func ValidateMediaServiceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseMediaServiceID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Media Service ID -func (id MediaServiceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Media Service ID -func (id MediaServiceId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - } -} - -// String returns a human-readable description of this Media Service ID -func (id MediaServiceId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - } - return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetfilterscreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetfilterscreateorupdate_autorest.go deleted file mode 100644 index 770130fe3cab..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetfilterscreateorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package assetsandassetfilters - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetFiltersCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *AssetFilter -} - -// AssetFiltersCreateOrUpdate ... -func (c AssetsAndAssetFiltersClient) AssetFiltersCreateOrUpdate(ctx context.Context, id AssetFilterId, input AssetFilter) (result AssetFiltersCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForAssetFiltersCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAssetFiltersCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAssetFiltersCreateOrUpdate prepares the AssetFiltersCreateOrUpdate request. -func (c AssetsAndAssetFiltersClient) preparerForAssetFiltersCreateOrUpdate(ctx context.Context, id AssetFilterId, input AssetFilter) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAssetFiltersCreateOrUpdate handles the response to the AssetFiltersCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c AssetsAndAssetFiltersClient) responderForAssetFiltersCreateOrUpdate(resp *http.Response) (result AssetFiltersCreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetfiltersdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetfiltersdelete_autorest.go deleted file mode 100644 index ccaa78367b6e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetfiltersdelete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package assetsandassetfilters - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetFiltersDeleteOperationResponse struct { - HttpResponse *http.Response -} - -// AssetFiltersDelete ... -func (c AssetsAndAssetFiltersClient) AssetFiltersDelete(ctx context.Context, id AssetFilterId) (result AssetFiltersDeleteOperationResponse, err error) { - req, err := c.preparerForAssetFiltersDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAssetFiltersDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAssetFiltersDelete prepares the AssetFiltersDelete request. -func (c AssetsAndAssetFiltersClient) preparerForAssetFiltersDelete(ctx context.Context, id AssetFilterId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAssetFiltersDelete handles the response to the AssetFiltersDelete request. The method always -// closes the http.Response Body. -func (c AssetsAndAssetFiltersClient) responderForAssetFiltersDelete(resp *http.Response) (result AssetFiltersDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetfiltersget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetfiltersget_autorest.go deleted file mode 100644 index 7efc3524f8c0..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetfiltersget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package assetsandassetfilters - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetFiltersGetOperationResponse struct { - HttpResponse *http.Response - Model *AssetFilter -} - -// AssetFiltersGet ... -func (c AssetsAndAssetFiltersClient) AssetFiltersGet(ctx context.Context, id AssetFilterId) (result AssetFiltersGetOperationResponse, err error) { - req, err := c.preparerForAssetFiltersGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAssetFiltersGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAssetFiltersGet prepares the AssetFiltersGet request. -func (c AssetsAndAssetFiltersClient) preparerForAssetFiltersGet(ctx context.Context, id AssetFilterId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAssetFiltersGet handles the response to the AssetFiltersGet request. The method always -// closes the http.Response Body. -func (c AssetsAndAssetFiltersClient) responderForAssetFiltersGet(resp *http.Response) (result AssetFiltersGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetfilterslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetfilterslist_autorest.go deleted file mode 100644 index a042394468d5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetfilterslist_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package assetsandassetfilters - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetFiltersListOperationResponse struct { - HttpResponse *http.Response - Model *[]AssetFilter - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (AssetFiltersListOperationResponse, error) -} - -type AssetFiltersListCompleteResult struct { - Items []AssetFilter -} - -func (r AssetFiltersListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r AssetFiltersListOperationResponse) LoadMore(ctx context.Context) (resp AssetFiltersListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// AssetFiltersList ... -func (c AssetsAndAssetFiltersClient) AssetFiltersList(ctx context.Context, id AssetId) (resp AssetFiltersListOperationResponse, err error) { - req, err := c.preparerForAssetFiltersList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForAssetFiltersList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForAssetFiltersList prepares the AssetFiltersList request. -func (c AssetsAndAssetFiltersClient) preparerForAssetFiltersList(ctx context.Context, id AssetId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/assetFilters", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForAssetFiltersListWithNextLink prepares the AssetFiltersList request with the given nextLink token. -func (c AssetsAndAssetFiltersClient) preparerForAssetFiltersListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAssetFiltersList handles the response to the AssetFiltersList request. The method always -// closes the http.Response Body. -func (c AssetsAndAssetFiltersClient) responderForAssetFiltersList(resp *http.Response) (result AssetFiltersListOperationResponse, err error) { - type page struct { - Values []AssetFilter `json:"value"` - NextLink *string `json:"@odata.nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result AssetFiltersListOperationResponse, err error) { - req, err := c.preparerForAssetFiltersListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAssetFiltersList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// AssetFiltersListComplete retrieves all of the results into a single object -func (c AssetsAndAssetFiltersClient) AssetFiltersListComplete(ctx context.Context, id AssetId) (AssetFiltersListCompleteResult, error) { - return c.AssetFiltersListCompleteMatchingPredicate(ctx, id, AssetFilterOperationPredicate{}) -} - -// AssetFiltersListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AssetsAndAssetFiltersClient) AssetFiltersListCompleteMatchingPredicate(ctx context.Context, id AssetId, predicate AssetFilterOperationPredicate) (resp AssetFiltersListCompleteResult, err error) { - items := make([]AssetFilter, 0) - - page, err := c.AssetFiltersList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := AssetFiltersListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetfiltersupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetfiltersupdate_autorest.go deleted file mode 100644 index 5ee5c4528709..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetfiltersupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package assetsandassetfilters - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetFiltersUpdateOperationResponse struct { - HttpResponse *http.Response - Model *AssetFilter -} - -// AssetFiltersUpdate ... -func (c AssetsAndAssetFiltersClient) AssetFiltersUpdate(ctx context.Context, id AssetFilterId, input AssetFilter) (result AssetFiltersUpdateOperationResponse, err error) { - req, err := c.preparerForAssetFiltersUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAssetFiltersUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetFiltersUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAssetFiltersUpdate prepares the AssetFiltersUpdate request. -func (c AssetsAndAssetFiltersClient) preparerForAssetFiltersUpdate(ctx context.Context, id AssetFilterId, input AssetFilter) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAssetFiltersUpdate handles the response to the AssetFiltersUpdate request. The method always -// closes the http.Response Body. -func (c AssetsAndAssetFiltersClient) responderForAssetFiltersUpdate(resp *http.Response) (result AssetFiltersUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetscreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetscreateorupdate_autorest.go deleted file mode 100644 index 97aab4648de8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetscreateorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package assetsandassetfilters - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetsCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *Asset -} - -// AssetsCreateOrUpdate ... -func (c AssetsAndAssetFiltersClient) AssetsCreateOrUpdate(ctx context.Context, id AssetId, input Asset) (result AssetsCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForAssetsCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAssetsCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAssetsCreateOrUpdate prepares the AssetsCreateOrUpdate request. -func (c AssetsAndAssetFiltersClient) preparerForAssetsCreateOrUpdate(ctx context.Context, id AssetId, input Asset) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAssetsCreateOrUpdate handles the response to the AssetsCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c AssetsAndAssetFiltersClient) responderForAssetsCreateOrUpdate(resp *http.Response) (result AssetsCreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetsdelete_autorest.go deleted file mode 100644 index dd0b0526ba80..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetsdelete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package assetsandassetfilters - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetsDeleteOperationResponse struct { - HttpResponse *http.Response -} - -// AssetsDelete ... -func (c AssetsAndAssetFiltersClient) AssetsDelete(ctx context.Context, id AssetId) (result AssetsDeleteOperationResponse, err error) { - req, err := c.preparerForAssetsDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAssetsDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAssetsDelete prepares the AssetsDelete request. -func (c AssetsAndAssetFiltersClient) preparerForAssetsDelete(ctx context.Context, id AssetId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAssetsDelete handles the response to the AssetsDelete request. The method always -// closes the http.Response Body. -func (c AssetsAndAssetFiltersClient) responderForAssetsDelete(resp *http.Response) (result AssetsDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetsget_autorest.go deleted file mode 100644 index 29b972bfabd8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetsget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package assetsandassetfilters - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetsGetOperationResponse struct { - HttpResponse *http.Response - Model *Asset -} - -// AssetsGet ... -func (c AssetsAndAssetFiltersClient) AssetsGet(ctx context.Context, id AssetId) (result AssetsGetOperationResponse, err error) { - req, err := c.preparerForAssetsGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAssetsGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAssetsGet prepares the AssetsGet request. -func (c AssetsAndAssetFiltersClient) preparerForAssetsGet(ctx context.Context, id AssetId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAssetsGet handles the response to the AssetsGet request. The method always -// closes the http.Response Body. -func (c AssetsAndAssetFiltersClient) responderForAssetsGet(resp *http.Response) (result AssetsGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetsgetencryptionkey_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetsgetencryptionkey_autorest.go deleted file mode 100644 index beaa8bffc5e9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetsgetencryptionkey_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package assetsandassetfilters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetsGetEncryptionKeyOperationResponse struct { - HttpResponse *http.Response - Model *StorageEncryptedAssetDecryptionData -} - -// AssetsGetEncryptionKey ... -func (c AssetsAndAssetFiltersClient) AssetsGetEncryptionKey(ctx context.Context, id AssetId) (result AssetsGetEncryptionKeyOperationResponse, err error) { - req, err := c.preparerForAssetsGetEncryptionKey(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsGetEncryptionKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsGetEncryptionKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAssetsGetEncryptionKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsGetEncryptionKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAssetsGetEncryptionKey prepares the AssetsGetEncryptionKey request. -func (c AssetsAndAssetFiltersClient) preparerForAssetsGetEncryptionKey(ctx context.Context, id AssetId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/getEncryptionKey", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAssetsGetEncryptionKey handles the response to the AssetsGetEncryptionKey request. The method always -// closes the http.Response Body. -func (c AssetsAndAssetFiltersClient) responderForAssetsGetEncryptionKey(resp *http.Response) (result AssetsGetEncryptionKeyOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetslist_autorest.go deleted file mode 100644 index bd8e1acf1058..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetslist_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package assetsandassetfilters - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetsListOperationResponse struct { - HttpResponse *http.Response - Model *[]Asset - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (AssetsListOperationResponse, error) -} - -type AssetsListCompleteResult struct { - Items []Asset -} - -func (r AssetsListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r AssetsListOperationResponse) LoadMore(ctx context.Context) (resp AssetsListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type AssetsListOperationOptions struct { - Filter *string - Orderby *string - Top *int64 -} - -func DefaultAssetsListOperationOptions() AssetsListOperationOptions { - return AssetsListOperationOptions{} -} - -func (o AssetsListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o AssetsListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// AssetsList ... -func (c AssetsAndAssetFiltersClient) AssetsList(ctx context.Context, id MediaServiceId, options AssetsListOperationOptions) (resp AssetsListOperationResponse, err error) { - req, err := c.preparerForAssetsList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForAssetsList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForAssetsList prepares the AssetsList request. -func (c AssetsAndAssetFiltersClient) preparerForAssetsList(ctx context.Context, id MediaServiceId, options AssetsListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/assets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForAssetsListWithNextLink prepares the AssetsList request with the given nextLink token. -func (c AssetsAndAssetFiltersClient) preparerForAssetsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAssetsList handles the response to the AssetsList request. The method always -// closes the http.Response Body. -func (c AssetsAndAssetFiltersClient) responderForAssetsList(resp *http.Response) (result AssetsListOperationResponse, err error) { - type page struct { - Values []Asset `json:"value"` - NextLink *string `json:"@odata.nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result AssetsListOperationResponse, err error) { - req, err := c.preparerForAssetsListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAssetsList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// AssetsListComplete retrieves all of the results into a single object -func (c AssetsAndAssetFiltersClient) AssetsListComplete(ctx context.Context, id MediaServiceId, options AssetsListOperationOptions) (AssetsListCompleteResult, error) { - return c.AssetsListCompleteMatchingPredicate(ctx, id, options, AssetOperationPredicate{}) -} - -// AssetsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AssetsAndAssetFiltersClient) AssetsListCompleteMatchingPredicate(ctx context.Context, id MediaServiceId, options AssetsListOperationOptions, predicate AssetOperationPredicate) (resp AssetsListCompleteResult, err error) { - items := make([]Asset, 0) - - page, err := c.AssetsList(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := AssetsListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetslistcontainersas_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetslistcontainersas_autorest.go deleted file mode 100644 index b557d67028a2..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetslistcontainersas_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package assetsandassetfilters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetsListContainerSasOperationResponse struct { - HttpResponse *http.Response - Model *AssetContainerSas -} - -// AssetsListContainerSas ... -func (c AssetsAndAssetFiltersClient) AssetsListContainerSas(ctx context.Context, id AssetId, input ListContainerSasInput) (result AssetsListContainerSasOperationResponse, err error) { - req, err := c.preparerForAssetsListContainerSas(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsListContainerSas", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsListContainerSas", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAssetsListContainerSas(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsListContainerSas", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAssetsListContainerSas prepares the AssetsListContainerSas request. -func (c AssetsAndAssetFiltersClient) preparerForAssetsListContainerSas(ctx context.Context, id AssetId, input ListContainerSasInput) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listContainerSas", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAssetsListContainerSas handles the response to the AssetsListContainerSas request. The method always -// closes the http.Response Body. -func (c AssetsAndAssetFiltersClient) responderForAssetsListContainerSas(resp *http.Response) (result AssetsListContainerSasOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetsliststreaminglocators_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetsliststreaminglocators_autorest.go deleted file mode 100644 index 50cda393d973..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetsliststreaminglocators_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package assetsandassetfilters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetsListStreamingLocatorsOperationResponse struct { - HttpResponse *http.Response - Model *ListStreamingLocatorsResponse -} - -// AssetsListStreamingLocators ... -func (c AssetsAndAssetFiltersClient) AssetsListStreamingLocators(ctx context.Context, id AssetId) (result AssetsListStreamingLocatorsOperationResponse, err error) { - req, err := c.preparerForAssetsListStreamingLocators(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsListStreamingLocators", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsListStreamingLocators", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAssetsListStreamingLocators(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsListStreamingLocators", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAssetsListStreamingLocators prepares the AssetsListStreamingLocators request. -func (c AssetsAndAssetFiltersClient) preparerForAssetsListStreamingLocators(ctx context.Context, id AssetId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listStreamingLocators", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAssetsListStreamingLocators handles the response to the AssetsListStreamingLocators request. The method always -// closes the http.Response Body. -func (c AssetsAndAssetFiltersClient) responderForAssetsListStreamingLocators(resp *http.Response) (result AssetsListStreamingLocatorsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetsupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetsupdate_autorest.go deleted file mode 100644 index 406afb9c5440..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/method_assetsupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package assetsandassetfilters - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetsUpdateOperationResponse struct { - HttpResponse *http.Response - Model *Asset -} - -// AssetsUpdate ... -func (c AssetsAndAssetFiltersClient) AssetsUpdate(ctx context.Context, id AssetId, input Asset) (result AssetsUpdateOperationResponse, err error) { - req, err := c.preparerForAssetsUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAssetsUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "assetsandassetfilters.AssetsAndAssetFiltersClient", "AssetsUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAssetsUpdate prepares the AssetsUpdate request. -func (c AssetsAndAssetFiltersClient) preparerForAssetsUpdate(ctx context.Context, id AssetId, input Asset) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAssetsUpdate handles the response to the AssetsUpdate request. The method always -// closes the http.Response Body. -func (c AssetsAndAssetFiltersClient) responderForAssetsUpdate(resp *http.Response) (result AssetsUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_asset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_asset.go deleted file mode 100644 index e28bbc5358de..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_asset.go +++ /dev/null @@ -1,16 +0,0 @@ -package assetsandassetfilters - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Asset struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *AssetProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_assetcontainersas.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_assetcontainersas.go deleted file mode 100644 index af36c40966d4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_assetcontainersas.go +++ /dev/null @@ -1,8 +0,0 @@ -package assetsandassetfilters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetContainerSas struct { - AssetContainerSasUrls *[]string `json:"assetContainerSasUrls,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_assetfileencryptionmetadata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_assetfileencryptionmetadata.go deleted file mode 100644 index 75b8dccb16a4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_assetfileencryptionmetadata.go +++ /dev/null @@ -1,10 +0,0 @@ -package assetsandassetfilters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetFileEncryptionMetadata struct { - AssetFileId string `json:"assetFileId"` - AssetFileName *string `json:"assetFileName,omitempty"` - InitializationVector *string `json:"initializationVector,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_assetfilter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_assetfilter.go deleted file mode 100644 index 21cd7a2e7724..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_assetfilter.go +++ /dev/null @@ -1,16 +0,0 @@ -package assetsandassetfilters - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetFilter struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *MediaFilterProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_assetproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_assetproperties.go deleted file mode 100644 index 5127047160b8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_assetproperties.go +++ /dev/null @@ -1,45 +0,0 @@ -package assetsandassetfilters - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetProperties struct { - AlternateId *string `json:"alternateId,omitempty"` - AssetId *string `json:"assetId,omitempty"` - Container *string `json:"container,omitempty"` - Created *string `json:"created,omitempty"` - Description *string `json:"description,omitempty"` - LastModified *string `json:"lastModified,omitempty"` - StorageAccountName *string `json:"storageAccountName,omitempty"` - StorageEncryptionFormat *AssetStorageEncryptionFormat `json:"storageEncryptionFormat,omitempty"` -} - -func (o *AssetProperties) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *AssetProperties) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} - -func (o *AssetProperties) GetLastModifiedAsTime() (*time.Time, error) { - if o.LastModified == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModified, "2006-01-02T15:04:05Z07:00") -} - -func (o *AssetProperties) SetLastModifiedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModified = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_assetstreaminglocator.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_assetstreaminglocator.go deleted file mode 100644 index d72048fce46e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_assetstreaminglocator.go +++ /dev/null @@ -1,57 +0,0 @@ -package assetsandassetfilters - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AssetStreamingLocator struct { - AssetName *string `json:"assetName,omitempty"` - Created *string `json:"created,omitempty"` - DefaultContentKeyPolicyName *string `json:"defaultContentKeyPolicyName,omitempty"` - EndTime *string `json:"endTime,omitempty"` - Name *string `json:"name,omitempty"` - StartTime *string `json:"startTime,omitempty"` - StreamingLocatorId *string `json:"streamingLocatorId,omitempty"` - StreamingPolicyName *string `json:"streamingPolicyName,omitempty"` -} - -func (o *AssetStreamingLocator) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *AssetStreamingLocator) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} - -func (o *AssetStreamingLocator) GetEndTimeAsTime() (*time.Time, error) { - if o.EndTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") -} - -func (o *AssetStreamingLocator) SetEndTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.EndTime = &formatted -} - -func (o *AssetStreamingLocator) GetStartTimeAsTime() (*time.Time, error) { - if o.StartTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") -} - -func (o *AssetStreamingLocator) SetStartTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.StartTime = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_filtertrackpropertycondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_filtertrackpropertycondition.go deleted file mode 100644 index cc9cd652d8bb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_filtertrackpropertycondition.go +++ /dev/null @@ -1,10 +0,0 @@ -package assetsandassetfilters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type FilterTrackPropertyCondition struct { - Operation FilterTrackPropertyCompareOperation `json:"operation"` - Property FilterTrackPropertyType `json:"property"` - Value string `json:"value"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_filtertrackselection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_filtertrackselection.go deleted file mode 100644 index a8a78cd8dd36..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_filtertrackselection.go +++ /dev/null @@ -1,8 +0,0 @@ -package assetsandassetfilters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type FilterTrackSelection struct { - TrackSelections []FilterTrackPropertyCondition `json:"trackSelections"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_firstquality.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_firstquality.go deleted file mode 100644 index f8043a2c2625..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_firstquality.go +++ /dev/null @@ -1,8 +0,0 @@ -package assetsandassetfilters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type FirstQuality struct { - Bitrate int64 `json:"bitrate"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_listcontainersasinput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_listcontainersasinput.go deleted file mode 100644 index 40c9e957818b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_listcontainersasinput.go +++ /dev/null @@ -1,27 +0,0 @@ -package assetsandassetfilters - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListContainerSasInput struct { - ExpiryTime *string `json:"expiryTime,omitempty"` - Permissions *AssetContainerPermission `json:"permissions,omitempty"` -} - -func (o *ListContainerSasInput) GetExpiryTimeAsTime() (*time.Time, error) { - if o.ExpiryTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.ExpiryTime, "2006-01-02T15:04:05Z07:00") -} - -func (o *ListContainerSasInput) SetExpiryTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ExpiryTime = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_liststreaminglocatorsresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_liststreaminglocatorsresponse.go deleted file mode 100644 index 816c7e9dc16d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_liststreaminglocatorsresponse.go +++ /dev/null @@ -1,8 +0,0 @@ -package assetsandassetfilters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListStreamingLocatorsResponse struct { - StreamingLocators *[]AssetStreamingLocator `json:"streamingLocators,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_mediafilterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_mediafilterproperties.go deleted file mode 100644 index 76f8bb211d07..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_mediafilterproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package assetsandassetfilters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MediaFilterProperties struct { - FirstQuality *FirstQuality `json:"firstQuality,omitempty"` - PresentationTimeRange *PresentationTimeRange `json:"presentationTimeRange,omitempty"` - Tracks *[]FilterTrackSelection `json:"tracks,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_presentationtimerange.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_presentationtimerange.go deleted file mode 100644 index 37c9d4fd171d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_presentationtimerange.go +++ /dev/null @@ -1,13 +0,0 @@ -package assetsandassetfilters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PresentationTimeRange struct { - EndTimestamp *int64 `json:"endTimestamp,omitempty"` - ForceEndTimestamp *bool `json:"forceEndTimestamp,omitempty"` - LiveBackoffDuration *int64 `json:"liveBackoffDuration,omitempty"` - PresentationWindowDuration *int64 `json:"presentationWindowDuration,omitempty"` - StartTimestamp *int64 `json:"startTimestamp,omitempty"` - Timescale *int64 `json:"timescale,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_storageencryptedassetdecryptiondata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_storageencryptedassetdecryptiondata.go deleted file mode 100644 index 33ae81cea0d1..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/model_storageencryptedassetdecryptiondata.go +++ /dev/null @@ -1,9 +0,0 @@ -package assetsandassetfilters - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StorageEncryptedAssetDecryptionData struct { - AssetFileEncryptionMetadata *[]AssetFileEncryptionMetadata `json:"assetFileEncryptionMetadata,omitempty"` - Key *string `json:"key,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/predicates.go deleted file mode 100644 index eb685c85dbd0..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/predicates.go +++ /dev/null @@ -1,47 +0,0 @@ -package assetsandassetfilters - -type AssetOperationPredicate struct { - Id *string - Name *string - Type *string -} - -func (p AssetOperationPredicate) Matches(input Asset) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} - -type AssetFilterOperationPredicate struct { - Id *string - Name *string - Type *string -} - -func (p AssetFilterOperationPredicate) Matches(input AssetFilter) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/version.go deleted file mode 100644 index 6b3b4506a021..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package assetsandassetfilters - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2020-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/assetsandassetfilters/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/client.go deleted file mode 100644 index 2bed4a7822e8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/client.go +++ /dev/null @@ -1,68 +0,0 @@ -package v2020_05_01 - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters" - "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts" - "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters" - "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies" - "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings" - "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents" - "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs" - "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints" - "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators" -) - -type Client struct { - AccountFilters *accountfilters.AccountFiltersClient - Accounts *accounts.AccountsClient - AssetsAndAssetFilters *assetsandassetfilters.AssetsAndAssetFiltersClient - ContentKeyPolicies *contentkeypolicies.ContentKeyPoliciesClient - Encodings *encodings.EncodingsClient - LiveEvents *liveevents.LiveEventsClient - LiveOutputs *liveoutputs.LiveOutputsClient - StreamingEndpoints *streamingendpoints.StreamingEndpointsClient - StreamingPoliciesAndStreamingLocators *streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient -} - -func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { - - accountFiltersClient := accountfilters.NewAccountFiltersClientWithBaseURI(endpoint) - configureAuthFunc(&accountFiltersClient.Client) - - accountsClient := accounts.NewAccountsClientWithBaseURI(endpoint) - configureAuthFunc(&accountsClient.Client) - - assetsAndAssetFiltersClient := assetsandassetfilters.NewAssetsAndAssetFiltersClientWithBaseURI(endpoint) - configureAuthFunc(&assetsAndAssetFiltersClient.Client) - - contentKeyPoliciesClient := contentkeypolicies.NewContentKeyPoliciesClientWithBaseURI(endpoint) - configureAuthFunc(&contentKeyPoliciesClient.Client) - - encodingsClient := encodings.NewEncodingsClientWithBaseURI(endpoint) - configureAuthFunc(&encodingsClient.Client) - - liveEventsClient := liveevents.NewLiveEventsClientWithBaseURI(endpoint) - configureAuthFunc(&liveEventsClient.Client) - - liveOutputsClient := liveoutputs.NewLiveOutputsClientWithBaseURI(endpoint) - configureAuthFunc(&liveOutputsClient.Client) - - streamingEndpointsClient := streamingendpoints.NewStreamingEndpointsClientWithBaseURI(endpoint) - configureAuthFunc(&streamingEndpointsClient.Client) - - streamingPoliciesAndStreamingLocatorsClient := streamingpoliciesandstreaminglocators.NewStreamingPoliciesAndStreamingLocatorsClientWithBaseURI(endpoint) - configureAuthFunc(&streamingPoliciesAndStreamingLocatorsClient.Client) - - return Client{ - AccountFilters: &accountFiltersClient, - Accounts: &accountsClient, - AssetsAndAssetFilters: &assetsAndAssetFiltersClient, - ContentKeyPolicies: &contentKeyPoliciesClient, - Encodings: &encodingsClient, - LiveEvents: &liveEventsClient, - LiveOutputs: &liveOutputsClient, - StreamingEndpoints: &streamingEndpointsClient, - StreamingPoliciesAndStreamingLocators: &streamingPoliciesAndStreamingLocatorsClient, - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/README.md deleted file mode 100644 index 7a55ce646b03..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/README.md +++ /dev/null @@ -1,127 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies` Documentation - -The `contentkeypolicies` SDK allows for interaction with the Azure Resource Manager Service `media` (API Version `2020-05-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies" -``` - - -### Client Initialization - -```go -client := contentkeypolicies.NewContentKeyPoliciesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `ContentKeyPoliciesClient.ContentKeyPoliciesCreateOrUpdate` - -```go -ctx := context.TODO() -id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "contentKeyPolicyValue") - -payload := contentkeypolicies.ContentKeyPolicy{ - // ... -} - - -read, err := client.ContentKeyPoliciesCreateOrUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `ContentKeyPoliciesClient.ContentKeyPoliciesDelete` - -```go -ctx := context.TODO() -id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "contentKeyPolicyValue") - -read, err := client.ContentKeyPoliciesDelete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `ContentKeyPoliciesClient.ContentKeyPoliciesGet` - -```go -ctx := context.TODO() -id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "contentKeyPolicyValue") - -read, err := client.ContentKeyPoliciesGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `ContentKeyPoliciesClient.ContentKeyPoliciesGetPolicyPropertiesWithSecrets` - -```go -ctx := context.TODO() -id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "contentKeyPolicyValue") - -read, err := client.ContentKeyPoliciesGetPolicyPropertiesWithSecrets(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `ContentKeyPoliciesClient.ContentKeyPoliciesList` - -```go -ctx := context.TODO() -id := contentkeypolicies.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -// alternatively `client.ContentKeyPoliciesList(ctx, id, contentkeypolicies.DefaultContentKeyPoliciesListOperationOptions())` can be used to do batched pagination -items, err := client.ContentKeyPoliciesListComplete(ctx, id, contentkeypolicies.DefaultContentKeyPoliciesListOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `ContentKeyPoliciesClient.ContentKeyPoliciesUpdate` - -```go -ctx := context.TODO() -id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "contentKeyPolicyValue") - -payload := contentkeypolicies.ContentKeyPolicy{ - // ... -} - - -read, err := client.ContentKeyPoliciesUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/client.go deleted file mode 100644 index 355952a3f4ae..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package contentkeypolicies - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPoliciesClient struct { - Client autorest.Client - baseUri string -} - -func NewContentKeyPoliciesClientWithBaseURI(endpoint string) ContentKeyPoliciesClient { - return ContentKeyPoliciesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/constants.go deleted file mode 100644 index 6cc36387f29f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/constants.go +++ /dev/null @@ -1,173 +0,0 @@ -package contentkeypolicies - -import "strings" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPolicyFairPlayRentalAndLeaseKeyType string - -const ( - ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeDualExpiry ContentKeyPolicyFairPlayRentalAndLeaseKeyType = "DualExpiry" - ContentKeyPolicyFairPlayRentalAndLeaseKeyTypePersistentLimited ContentKeyPolicyFairPlayRentalAndLeaseKeyType = "PersistentLimited" - ContentKeyPolicyFairPlayRentalAndLeaseKeyTypePersistentUnlimited ContentKeyPolicyFairPlayRentalAndLeaseKeyType = "PersistentUnlimited" - ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeUndefined ContentKeyPolicyFairPlayRentalAndLeaseKeyType = "Undefined" - ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeUnknown ContentKeyPolicyFairPlayRentalAndLeaseKeyType = "Unknown" -) - -func PossibleValuesForContentKeyPolicyFairPlayRentalAndLeaseKeyType() []string { - return []string{ - string(ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeDualExpiry), - string(ContentKeyPolicyFairPlayRentalAndLeaseKeyTypePersistentLimited), - string(ContentKeyPolicyFairPlayRentalAndLeaseKeyTypePersistentUnlimited), - string(ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeUndefined), - string(ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeUnknown), - } -} - -func parseContentKeyPolicyFairPlayRentalAndLeaseKeyType(input string) (*ContentKeyPolicyFairPlayRentalAndLeaseKeyType, error) { - vals := map[string]ContentKeyPolicyFairPlayRentalAndLeaseKeyType{ - "dualexpiry": ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeDualExpiry, - "persistentlimited": ContentKeyPolicyFairPlayRentalAndLeaseKeyTypePersistentLimited, - "persistentunlimited": ContentKeyPolicyFairPlayRentalAndLeaseKeyTypePersistentUnlimited, - "undefined": ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeUndefined, - "unknown": ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeUnknown, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ContentKeyPolicyFairPlayRentalAndLeaseKeyType(input) - return &out, nil -} - -type ContentKeyPolicyPlayReadyContentType string - -const ( - ContentKeyPolicyPlayReadyContentTypeUltraVioletDownload ContentKeyPolicyPlayReadyContentType = "UltraVioletDownload" - ContentKeyPolicyPlayReadyContentTypeUltraVioletStreaming ContentKeyPolicyPlayReadyContentType = "UltraVioletStreaming" - ContentKeyPolicyPlayReadyContentTypeUnknown ContentKeyPolicyPlayReadyContentType = "Unknown" - ContentKeyPolicyPlayReadyContentTypeUnspecified ContentKeyPolicyPlayReadyContentType = "Unspecified" -) - -func PossibleValuesForContentKeyPolicyPlayReadyContentType() []string { - return []string{ - string(ContentKeyPolicyPlayReadyContentTypeUltraVioletDownload), - string(ContentKeyPolicyPlayReadyContentTypeUltraVioletStreaming), - string(ContentKeyPolicyPlayReadyContentTypeUnknown), - string(ContentKeyPolicyPlayReadyContentTypeUnspecified), - } -} - -func parseContentKeyPolicyPlayReadyContentType(input string) (*ContentKeyPolicyPlayReadyContentType, error) { - vals := map[string]ContentKeyPolicyPlayReadyContentType{ - "ultravioletdownload": ContentKeyPolicyPlayReadyContentTypeUltraVioletDownload, - "ultravioletstreaming": ContentKeyPolicyPlayReadyContentTypeUltraVioletStreaming, - "unknown": ContentKeyPolicyPlayReadyContentTypeUnknown, - "unspecified": ContentKeyPolicyPlayReadyContentTypeUnspecified, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ContentKeyPolicyPlayReadyContentType(input) - return &out, nil -} - -type ContentKeyPolicyPlayReadyLicenseType string - -const ( - ContentKeyPolicyPlayReadyLicenseTypeNonPersistent ContentKeyPolicyPlayReadyLicenseType = "NonPersistent" - ContentKeyPolicyPlayReadyLicenseTypePersistent ContentKeyPolicyPlayReadyLicenseType = "Persistent" - ContentKeyPolicyPlayReadyLicenseTypeUnknown ContentKeyPolicyPlayReadyLicenseType = "Unknown" -) - -func PossibleValuesForContentKeyPolicyPlayReadyLicenseType() []string { - return []string{ - string(ContentKeyPolicyPlayReadyLicenseTypeNonPersistent), - string(ContentKeyPolicyPlayReadyLicenseTypePersistent), - string(ContentKeyPolicyPlayReadyLicenseTypeUnknown), - } -} - -func parseContentKeyPolicyPlayReadyLicenseType(input string) (*ContentKeyPolicyPlayReadyLicenseType, error) { - vals := map[string]ContentKeyPolicyPlayReadyLicenseType{ - "nonpersistent": ContentKeyPolicyPlayReadyLicenseTypeNonPersistent, - "persistent": ContentKeyPolicyPlayReadyLicenseTypePersistent, - "unknown": ContentKeyPolicyPlayReadyLicenseTypeUnknown, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ContentKeyPolicyPlayReadyLicenseType(input) - return &out, nil -} - -type ContentKeyPolicyPlayReadyUnknownOutputPassingOption string - -const ( - ContentKeyPolicyPlayReadyUnknownOutputPassingOptionAllowed ContentKeyPolicyPlayReadyUnknownOutputPassingOption = "Allowed" - ContentKeyPolicyPlayReadyUnknownOutputPassingOptionAllowedWithVideoConstriction ContentKeyPolicyPlayReadyUnknownOutputPassingOption = "AllowedWithVideoConstriction" - ContentKeyPolicyPlayReadyUnknownOutputPassingOptionNotAllowed ContentKeyPolicyPlayReadyUnknownOutputPassingOption = "NotAllowed" - ContentKeyPolicyPlayReadyUnknownOutputPassingOptionUnknown ContentKeyPolicyPlayReadyUnknownOutputPassingOption = "Unknown" -) - -func PossibleValuesForContentKeyPolicyPlayReadyUnknownOutputPassingOption() []string { - return []string{ - string(ContentKeyPolicyPlayReadyUnknownOutputPassingOptionAllowed), - string(ContentKeyPolicyPlayReadyUnknownOutputPassingOptionAllowedWithVideoConstriction), - string(ContentKeyPolicyPlayReadyUnknownOutputPassingOptionNotAllowed), - string(ContentKeyPolicyPlayReadyUnknownOutputPassingOptionUnknown), - } -} - -func parseContentKeyPolicyPlayReadyUnknownOutputPassingOption(input string) (*ContentKeyPolicyPlayReadyUnknownOutputPassingOption, error) { - vals := map[string]ContentKeyPolicyPlayReadyUnknownOutputPassingOption{ - "allowed": ContentKeyPolicyPlayReadyUnknownOutputPassingOptionAllowed, - "allowedwithvideoconstriction": ContentKeyPolicyPlayReadyUnknownOutputPassingOptionAllowedWithVideoConstriction, - "notallowed": ContentKeyPolicyPlayReadyUnknownOutputPassingOptionNotAllowed, - "unknown": ContentKeyPolicyPlayReadyUnknownOutputPassingOptionUnknown, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ContentKeyPolicyPlayReadyUnknownOutputPassingOption(input) - return &out, nil -} - -type ContentKeyPolicyRestrictionTokenType string - -const ( - ContentKeyPolicyRestrictionTokenTypeJwt ContentKeyPolicyRestrictionTokenType = "Jwt" - ContentKeyPolicyRestrictionTokenTypeSwt ContentKeyPolicyRestrictionTokenType = "Swt" - ContentKeyPolicyRestrictionTokenTypeUnknown ContentKeyPolicyRestrictionTokenType = "Unknown" -) - -func PossibleValuesForContentKeyPolicyRestrictionTokenType() []string { - return []string{ - string(ContentKeyPolicyRestrictionTokenTypeJwt), - string(ContentKeyPolicyRestrictionTokenTypeSwt), - string(ContentKeyPolicyRestrictionTokenTypeUnknown), - } -} - -func parseContentKeyPolicyRestrictionTokenType(input string) (*ContentKeyPolicyRestrictionTokenType, error) { - vals := map[string]ContentKeyPolicyRestrictionTokenType{ - "jwt": ContentKeyPolicyRestrictionTokenTypeJwt, - "swt": ContentKeyPolicyRestrictionTokenTypeSwt, - "unknown": ContentKeyPolicyRestrictionTokenTypeUnknown, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ContentKeyPolicyRestrictionTokenType(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/id_contentkeypolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/id_contentkeypolicy.go deleted file mode 100644 index 4a2d8a84d053..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/id_contentkeypolicy.go +++ /dev/null @@ -1,137 +0,0 @@ -package contentkeypolicies - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ContentKeyPolicyId{} - -// ContentKeyPolicyId is a struct representing the Resource ID for a Content Key Policy -type ContentKeyPolicyId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - ContentKeyPolicyName string -} - -// NewContentKeyPolicyID returns a new ContentKeyPolicyId struct -func NewContentKeyPolicyID(subscriptionId string, resourceGroupName string, accountName string, contentKeyPolicyName string) ContentKeyPolicyId { - return ContentKeyPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - ContentKeyPolicyName: contentKeyPolicyName, - } -} - -// ParseContentKeyPolicyID parses 'input' into a ContentKeyPolicyId -func ParseContentKeyPolicyID(input string) (*ContentKeyPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(ContentKeyPolicyId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ContentKeyPolicyId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.ContentKeyPolicyName, ok = parsed.Parsed["contentKeyPolicyName"]; !ok { - return nil, fmt.Errorf("the segment 'contentKeyPolicyName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseContentKeyPolicyIDInsensitively parses 'input' case-insensitively into a ContentKeyPolicyId -// note: this method should only be used for API response data and not user input -func ParseContentKeyPolicyIDInsensitively(input string) (*ContentKeyPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(ContentKeyPolicyId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ContentKeyPolicyId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.ContentKeyPolicyName, ok = parsed.Parsed["contentKeyPolicyName"]; !ok { - return nil, fmt.Errorf("the segment 'contentKeyPolicyName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateContentKeyPolicyID checks that 'input' can be parsed as a Content Key Policy ID -func ValidateContentKeyPolicyID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseContentKeyPolicyID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Content Key Policy ID -func (id ContentKeyPolicyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/contentKeyPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ContentKeyPolicyName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Content Key Policy ID -func (id ContentKeyPolicyId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticContentKeyPolicies", "contentKeyPolicies", "contentKeyPolicies"), - resourceids.UserSpecifiedSegment("contentKeyPolicyName", "contentKeyPolicyValue"), - } -} - -// String returns a human-readable description of this Content Key Policy ID -func (id ContentKeyPolicyId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Content Key Policy Name: %q", id.ContentKeyPolicyName), - } - return fmt.Sprintf("Content Key Policy (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/id_mediaservice.go deleted file mode 100644 index 6693615eed5b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/id_mediaservice.go +++ /dev/null @@ -1,124 +0,0 @@ -package contentkeypolicies - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = MediaServiceId{} - -// MediaServiceId is a struct representing the Resource ID for a Media Service -type MediaServiceId struct { - SubscriptionId string - ResourceGroupName string - AccountName string -} - -// NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { - return MediaServiceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - } -} - -// ParseMediaServiceID parses 'input' into a MediaServiceId -func ParseMediaServiceID(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseMediaServiceIDInsensitively parses 'input' case-insensitively into a MediaServiceId -// note: this method should only be used for API response data and not user input -func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID -func ValidateMediaServiceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseMediaServiceID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Media Service ID -func (id MediaServiceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Media Service ID -func (id MediaServiceId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - } -} - -// String returns a human-readable description of this Media Service ID -func (id MediaServiceId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - } - return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypoliciescreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypoliciescreateorupdate_autorest.go deleted file mode 100644 index 8b620275773e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypoliciescreateorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package contentkeypolicies - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPoliciesCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ContentKeyPolicy -} - -// ContentKeyPoliciesCreateOrUpdate ... -func (c ContentKeyPoliciesClient) ContentKeyPoliciesCreateOrUpdate(ctx context.Context, id ContentKeyPolicyId, input ContentKeyPolicy) (result ContentKeyPoliciesCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForContentKeyPoliciesCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentKeyPoliciesCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForContentKeyPoliciesCreateOrUpdate prepares the ContentKeyPoliciesCreateOrUpdate request. -func (c ContentKeyPoliciesClient) preparerForContentKeyPoliciesCreateOrUpdate(ctx context.Context, id ContentKeyPolicyId, input ContentKeyPolicy) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentKeyPoliciesCreateOrUpdate handles the response to the ContentKeyPoliciesCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ContentKeyPoliciesClient) responderForContentKeyPoliciesCreateOrUpdate(resp *http.Response) (result ContentKeyPoliciesCreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypoliciesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypoliciesdelete_autorest.go deleted file mode 100644 index c45e127b3d6f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypoliciesdelete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package contentkeypolicies - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPoliciesDeleteOperationResponse struct { - HttpResponse *http.Response -} - -// ContentKeyPoliciesDelete ... -func (c ContentKeyPoliciesClient) ContentKeyPoliciesDelete(ctx context.Context, id ContentKeyPolicyId) (result ContentKeyPoliciesDeleteOperationResponse, err error) { - req, err := c.preparerForContentKeyPoliciesDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentKeyPoliciesDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForContentKeyPoliciesDelete prepares the ContentKeyPoliciesDelete request. -func (c ContentKeyPoliciesClient) preparerForContentKeyPoliciesDelete(ctx context.Context, id ContentKeyPolicyId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentKeyPoliciesDelete handles the response to the ContentKeyPoliciesDelete request. The method always -// closes the http.Response Body. -func (c ContentKeyPoliciesClient) responderForContentKeyPoliciesDelete(resp *http.Response) (result ContentKeyPoliciesDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypoliciesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypoliciesget_autorest.go deleted file mode 100644 index 1b7db7abc3d2..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypoliciesget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package contentkeypolicies - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPoliciesGetOperationResponse struct { - HttpResponse *http.Response - Model *ContentKeyPolicy -} - -// ContentKeyPoliciesGet ... -func (c ContentKeyPoliciesClient) ContentKeyPoliciesGet(ctx context.Context, id ContentKeyPolicyId) (result ContentKeyPoliciesGetOperationResponse, err error) { - req, err := c.preparerForContentKeyPoliciesGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentKeyPoliciesGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForContentKeyPoliciesGet prepares the ContentKeyPoliciesGet request. -func (c ContentKeyPoliciesClient) preparerForContentKeyPoliciesGet(ctx context.Context, id ContentKeyPolicyId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentKeyPoliciesGet handles the response to the ContentKeyPoliciesGet request. The method always -// closes the http.Response Body. -func (c ContentKeyPoliciesClient) responderForContentKeyPoliciesGet(resp *http.Response) (result ContentKeyPoliciesGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypoliciesgetpolicypropertieswithsecrets_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypoliciesgetpolicypropertieswithsecrets_autorest.go deleted file mode 100644 index b868fe13b968..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypoliciesgetpolicypropertieswithsecrets_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package contentkeypolicies - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPoliciesGetPolicyPropertiesWithSecretsOperationResponse struct { - HttpResponse *http.Response - Model *ContentKeyPolicyProperties -} - -// ContentKeyPoliciesGetPolicyPropertiesWithSecrets ... -func (c ContentKeyPoliciesClient) ContentKeyPoliciesGetPolicyPropertiesWithSecrets(ctx context.Context, id ContentKeyPolicyId) (result ContentKeyPoliciesGetPolicyPropertiesWithSecretsOperationResponse, err error) { - req, err := c.preparerForContentKeyPoliciesGetPolicyPropertiesWithSecrets(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesGetPolicyPropertiesWithSecrets", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesGetPolicyPropertiesWithSecrets", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentKeyPoliciesGetPolicyPropertiesWithSecrets(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesGetPolicyPropertiesWithSecrets", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForContentKeyPoliciesGetPolicyPropertiesWithSecrets prepares the ContentKeyPoliciesGetPolicyPropertiesWithSecrets request. -func (c ContentKeyPoliciesClient) preparerForContentKeyPoliciesGetPolicyPropertiesWithSecrets(ctx context.Context, id ContentKeyPolicyId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/getPolicyPropertiesWithSecrets", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentKeyPoliciesGetPolicyPropertiesWithSecrets handles the response to the ContentKeyPoliciesGetPolicyPropertiesWithSecrets request. The method always -// closes the http.Response Body. -func (c ContentKeyPoliciesClient) responderForContentKeyPoliciesGetPolicyPropertiesWithSecrets(resp *http.Response) (result ContentKeyPoliciesGetPolicyPropertiesWithSecretsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypolicieslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypolicieslist_autorest.go deleted file mode 100644 index eedc3fa0569e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypolicieslist_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package contentkeypolicies - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPoliciesListOperationResponse struct { - HttpResponse *http.Response - Model *[]ContentKeyPolicy - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ContentKeyPoliciesListOperationResponse, error) -} - -type ContentKeyPoliciesListCompleteResult struct { - Items []ContentKeyPolicy -} - -func (r ContentKeyPoliciesListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ContentKeyPoliciesListOperationResponse) LoadMore(ctx context.Context) (resp ContentKeyPoliciesListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ContentKeyPoliciesListOperationOptions struct { - Filter *string - Orderby *string - Top *int64 -} - -func DefaultContentKeyPoliciesListOperationOptions() ContentKeyPoliciesListOperationOptions { - return ContentKeyPoliciesListOperationOptions{} -} - -func (o ContentKeyPoliciesListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ContentKeyPoliciesListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ContentKeyPoliciesList ... -func (c ContentKeyPoliciesClient) ContentKeyPoliciesList(ctx context.Context, id MediaServiceId, options ContentKeyPoliciesListOperationOptions) (resp ContentKeyPoliciesListOperationResponse, err error) { - req, err := c.preparerForContentKeyPoliciesList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForContentKeyPoliciesList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForContentKeyPoliciesList prepares the ContentKeyPoliciesList request. -func (c ContentKeyPoliciesClient) preparerForContentKeyPoliciesList(ctx context.Context, id MediaServiceId, options ContentKeyPoliciesListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/contentKeyPolicies", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForContentKeyPoliciesListWithNextLink prepares the ContentKeyPoliciesList request with the given nextLink token. -func (c ContentKeyPoliciesClient) preparerForContentKeyPoliciesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentKeyPoliciesList handles the response to the ContentKeyPoliciesList request. The method always -// closes the http.Response Body. -func (c ContentKeyPoliciesClient) responderForContentKeyPoliciesList(resp *http.Response) (result ContentKeyPoliciesListOperationResponse, err error) { - type page struct { - Values []ContentKeyPolicy `json:"value"` - NextLink *string `json:"@odata.nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ContentKeyPoliciesListOperationResponse, err error) { - req, err := c.preparerForContentKeyPoliciesListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentKeyPoliciesList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ContentKeyPoliciesListComplete retrieves all of the results into a single object -func (c ContentKeyPoliciesClient) ContentKeyPoliciesListComplete(ctx context.Context, id MediaServiceId, options ContentKeyPoliciesListOperationOptions) (ContentKeyPoliciesListCompleteResult, error) { - return c.ContentKeyPoliciesListCompleteMatchingPredicate(ctx, id, options, ContentKeyPolicyOperationPredicate{}) -} - -// ContentKeyPoliciesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ContentKeyPoliciesClient) ContentKeyPoliciesListCompleteMatchingPredicate(ctx context.Context, id MediaServiceId, options ContentKeyPoliciesListOperationOptions, predicate ContentKeyPolicyOperationPredicate) (resp ContentKeyPoliciesListCompleteResult, err error) { - items := make([]ContentKeyPolicy, 0) - - page, err := c.ContentKeyPoliciesList(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ContentKeyPoliciesListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypoliciesupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypoliciesupdate_autorest.go deleted file mode 100644 index a43fb9d27150..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/method_contentkeypoliciesupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package contentkeypolicies - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPoliciesUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ContentKeyPolicy -} - -// ContentKeyPoliciesUpdate ... -func (c ContentKeyPoliciesClient) ContentKeyPoliciesUpdate(ctx context.Context, id ContentKeyPolicyId, input ContentKeyPolicy) (result ContentKeyPoliciesUpdateOperationResponse, err error) { - req, err := c.preparerForContentKeyPoliciesUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForContentKeyPoliciesUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "contentkeypolicies.ContentKeyPoliciesClient", "ContentKeyPoliciesUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForContentKeyPoliciesUpdate prepares the ContentKeyPoliciesUpdate request. -func (c ContentKeyPoliciesClient) preparerForContentKeyPoliciesUpdate(ctx context.Context, id ContentKeyPolicyId, input ContentKeyPolicy) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForContentKeyPoliciesUpdate handles the response to the ContentKeyPoliciesUpdate request. The method always -// closes the http.Response Body. -func (c ContentKeyPoliciesClient) responderForContentKeyPoliciesUpdate(resp *http.Response) (result ContentKeyPoliciesUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicy.go deleted file mode 100644 index ddca04cc83cb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicy.go +++ /dev/null @@ -1,16 +0,0 @@ -package contentkeypolicies - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPolicy struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *ContentKeyPolicyProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyclearkeyconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyclearkeyconfiguration.go deleted file mode 100644 index 9cc26cd28e8b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyclearkeyconfiguration.go +++ /dev/null @@ -1,40 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ContentKeyPolicyConfiguration = ContentKeyPolicyClearKeyConfiguration{} - -type ContentKeyPolicyClearKeyConfiguration struct { - - // Fields inherited from ContentKeyPolicyConfiguration -} - -var _ json.Marshaler = ContentKeyPolicyClearKeyConfiguration{} - -func (s ContentKeyPolicyClearKeyConfiguration) MarshalJSON() ([]byte, error) { - type wrapper ContentKeyPolicyClearKeyConfiguration - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ContentKeyPolicyClearKeyConfiguration: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyClearKeyConfiguration: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ContentKeyPolicyClearKeyConfiguration: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyconfiguration.go deleted file mode 100644 index 42989de5c62d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyconfiguration.go +++ /dev/null @@ -1,80 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPolicyConfiguration interface { -} - -func unmarshalContentKeyPolicyConfigurationImplementation(input []byte) (ContentKeyPolicyConfiguration, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyConfiguration into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration") { - var out ContentKeyPolicyClearKeyConfiguration - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ContentKeyPolicyClearKeyConfiguration: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration") { - var out ContentKeyPolicyFairPlayConfiguration - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ContentKeyPolicyFairPlayConfiguration: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration") { - var out ContentKeyPolicyPlayReadyConfiguration - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ContentKeyPolicyPlayReadyConfiguration: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.ContentKeyPolicyUnknownConfiguration") { - var out ContentKeyPolicyUnknownConfiguration - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ContentKeyPolicyUnknownConfiguration: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration") { - var out ContentKeyPolicyWidevineConfiguration - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ContentKeyPolicyWidevineConfiguration: %+v", err) - } - return out, nil - } - - type RawContentKeyPolicyConfigurationImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawContentKeyPolicyConfigurationImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyfairplayconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyfairplayconfiguration.go deleted file mode 100644 index f7983ee301a5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyfairplayconfiguration.go +++ /dev/null @@ -1,46 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ContentKeyPolicyConfiguration = ContentKeyPolicyFairPlayConfiguration{} - -type ContentKeyPolicyFairPlayConfiguration struct { - Ask string `json:"ask"` - FairPlayPfx string `json:"fairPlayPfx"` - FairPlayPfxPassword string `json:"fairPlayPfxPassword"` - OfflineRentalConfiguration *ContentKeyPolicyFairPlayOfflineRentalConfiguration `json:"offlineRentalConfiguration,omitempty"` - RentalAndLeaseKeyType ContentKeyPolicyFairPlayRentalAndLeaseKeyType `json:"rentalAndLeaseKeyType"` - RentalDuration int64 `json:"rentalDuration"` - - // Fields inherited from ContentKeyPolicyConfiguration -} - -var _ json.Marshaler = ContentKeyPolicyFairPlayConfiguration{} - -func (s ContentKeyPolicyFairPlayConfiguration) MarshalJSON() ([]byte, error) { - type wrapper ContentKeyPolicyFairPlayConfiguration - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ContentKeyPolicyFairPlayConfiguration: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyFairPlayConfiguration: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ContentKeyPolicyFairPlayConfiguration: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyfairplayofflinerentalconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyfairplayofflinerentalconfiguration.go deleted file mode 100644 index 63337b098e7d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyfairplayofflinerentalconfiguration.go +++ /dev/null @@ -1,9 +0,0 @@ -package contentkeypolicies - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPolicyFairPlayOfflineRentalConfiguration struct { - PlaybackDurationSeconds int64 `json:"playbackDurationSeconds"` - StorageDurationSeconds int64 `json:"storageDurationSeconds"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyopenrestriction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyopenrestriction.go deleted file mode 100644 index 4a5e74404b16..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyopenrestriction.go +++ /dev/null @@ -1,40 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ContentKeyPolicyRestriction = ContentKeyPolicyOpenRestriction{} - -type ContentKeyPolicyOpenRestriction struct { - - // Fields inherited from ContentKeyPolicyRestriction -} - -var _ json.Marshaler = ContentKeyPolicyOpenRestriction{} - -func (s ContentKeyPolicyOpenRestriction) MarshalJSON() ([]byte, error) { - type wrapper ContentKeyPolicyOpenRestriction - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ContentKeyPolicyOpenRestriction: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyOpenRestriction: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyOpenRestriction" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ContentKeyPolicyOpenRestriction: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyoption.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyoption.go deleted file mode 100644 index 687ed9dd6c88..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyoption.go +++ /dev/null @@ -1,51 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPolicyOption struct { - Configuration ContentKeyPolicyConfiguration `json:"configuration"` - Name *string `json:"name,omitempty"` - PolicyOptionId *string `json:"policyOptionId,omitempty"` - Restriction ContentKeyPolicyRestriction `json:"restriction"` -} - -var _ json.Unmarshaler = &ContentKeyPolicyOption{} - -func (s *ContentKeyPolicyOption) UnmarshalJSON(bytes []byte) error { - type alias ContentKeyPolicyOption - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into ContentKeyPolicyOption: %+v", err) - } - - s.Name = decoded.Name - s.PolicyOptionId = decoded.PolicyOptionId - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling ContentKeyPolicyOption into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["configuration"]; ok { - impl, err := unmarshalContentKeyPolicyConfigurationImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'Configuration' for 'ContentKeyPolicyOption': %+v", err) - } - s.Configuration = impl - } - - if v, ok := temp["restriction"]; ok { - impl, err := unmarshalContentKeyPolicyRestrictionImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'Restriction' for 'ContentKeyPolicyOption': %+v", err) - } - s.Restriction = impl - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadyconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadyconfiguration.go deleted file mode 100644 index 3f609b4a8da4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadyconfiguration.go +++ /dev/null @@ -1,42 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ContentKeyPolicyConfiguration = ContentKeyPolicyPlayReadyConfiguration{} - -type ContentKeyPolicyPlayReadyConfiguration struct { - Licenses []ContentKeyPolicyPlayReadyLicense `json:"licenses"` - ResponseCustomData *string `json:"responseCustomData,omitempty"` - - // Fields inherited from ContentKeyPolicyConfiguration -} - -var _ json.Marshaler = ContentKeyPolicyPlayReadyConfiguration{} - -func (s ContentKeyPolicyPlayReadyConfiguration) MarshalJSON() ([]byte, error) { - type wrapper ContentKeyPolicyPlayReadyConfiguration - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ContentKeyPolicyPlayReadyConfiguration: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyPlayReadyConfiguration: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ContentKeyPolicyPlayReadyConfiguration: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadycontentencryptionkeyfromheader.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadycontentencryptionkeyfromheader.go deleted file mode 100644 index 1795b14bc22b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadycontentencryptionkeyfromheader.go +++ /dev/null @@ -1,40 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ContentKeyPolicyPlayReadyContentKeyLocation = ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader{} - -type ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader struct { - - // Fields inherited from ContentKeyPolicyPlayReadyContentKeyLocation -} - -var _ json.Marshaler = ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader{} - -func (s ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) MarshalJSON() ([]byte, error) { - type wrapper ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadycontentencryptionkeyfromkeyidentifier.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadycontentencryptionkeyfromkeyidentifier.go deleted file mode 100644 index 91ed242963b5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadycontentencryptionkeyfromkeyidentifier.go +++ /dev/null @@ -1,41 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ContentKeyPolicyPlayReadyContentKeyLocation = ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier{} - -type ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier struct { - KeyId string `json:"keyId"` - - // Fields inherited from ContentKeyPolicyPlayReadyContentKeyLocation -} - -var _ json.Marshaler = ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier{} - -func (s ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) MarshalJSON() ([]byte, error) { - type wrapper ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadycontentkeylocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadycontentkeylocation.go deleted file mode 100644 index 75a94bf4c3a8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadycontentkeylocation.go +++ /dev/null @@ -1,56 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPolicyPlayReadyContentKeyLocation interface { -} - -func unmarshalContentKeyPolicyPlayReadyContentKeyLocationImplementation(input []byte) (ContentKeyPolicyPlayReadyContentKeyLocation, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyPlayReadyContentKeyLocation into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader") { - var out ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier") { - var out ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier: %+v", err) - } - return out, nil - } - - type RawContentKeyPolicyPlayReadyContentKeyLocationImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawContentKeyPolicyPlayReadyContentKeyLocationImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadyexplicitanalogtelevisionrestriction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadyexplicitanalogtelevisionrestriction.go deleted file mode 100644 index 8720a1e96ff0..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadyexplicitanalogtelevisionrestriction.go +++ /dev/null @@ -1,9 +0,0 @@ -package contentkeypolicies - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction struct { - BestEffort bool `json:"bestEffort"` - ConfigurationData int64 `json:"configurationData"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadylicense.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadylicense.go deleted file mode 100644 index db772324208f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadylicense.go +++ /dev/null @@ -1,83 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPolicyPlayReadyLicense struct { - AllowTestDevices bool `json:"allowTestDevices"` - BeginDate *string `json:"beginDate,omitempty"` - ContentKeyLocation ContentKeyPolicyPlayReadyContentKeyLocation `json:"contentKeyLocation"` - ContentType ContentKeyPolicyPlayReadyContentType `json:"contentType"` - ExpirationDate *string `json:"expirationDate,omitempty"` - GracePeriod *string `json:"gracePeriod,omitempty"` - LicenseType ContentKeyPolicyPlayReadyLicenseType `json:"licenseType"` - PlayRight *ContentKeyPolicyPlayReadyPlayRight `json:"playRight,omitempty"` - RelativeBeginDate *string `json:"relativeBeginDate,omitempty"` - RelativeExpirationDate *string `json:"relativeExpirationDate,omitempty"` -} - -func (o *ContentKeyPolicyPlayReadyLicense) GetBeginDateAsTime() (*time.Time, error) { - if o.BeginDate == nil { - return nil, nil - } - return dates.ParseAsFormat(o.BeginDate, "2006-01-02T15:04:05Z07:00") -} - -func (o *ContentKeyPolicyPlayReadyLicense) SetBeginDateAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.BeginDate = &formatted -} - -func (o *ContentKeyPolicyPlayReadyLicense) GetExpirationDateAsTime() (*time.Time, error) { - if o.ExpirationDate == nil { - return nil, nil - } - return dates.ParseAsFormat(o.ExpirationDate, "2006-01-02T15:04:05Z07:00") -} - -func (o *ContentKeyPolicyPlayReadyLicense) SetExpirationDateAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ExpirationDate = &formatted -} - -var _ json.Unmarshaler = &ContentKeyPolicyPlayReadyLicense{} - -func (s *ContentKeyPolicyPlayReadyLicense) UnmarshalJSON(bytes []byte) error { - type alias ContentKeyPolicyPlayReadyLicense - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into ContentKeyPolicyPlayReadyLicense: %+v", err) - } - - s.AllowTestDevices = decoded.AllowTestDevices - s.BeginDate = decoded.BeginDate - s.ContentType = decoded.ContentType - s.ExpirationDate = decoded.ExpirationDate - s.GracePeriod = decoded.GracePeriod - s.LicenseType = decoded.LicenseType - s.PlayRight = decoded.PlayRight - s.RelativeBeginDate = decoded.RelativeBeginDate - s.RelativeExpirationDate = decoded.RelativeExpirationDate - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling ContentKeyPolicyPlayReadyLicense into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["contentKeyLocation"]; ok { - impl, err := unmarshalContentKeyPolicyPlayReadyContentKeyLocationImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'ContentKeyLocation' for 'ContentKeyPolicyPlayReadyLicense': %+v", err) - } - s.ContentKeyLocation = impl - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadyplayright.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadyplayright.go deleted file mode 100644 index 315378b0a22c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyplayreadyplayright.go +++ /dev/null @@ -1,20 +0,0 @@ -package contentkeypolicies - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPolicyPlayReadyPlayRight struct { - AgcAndColorStripeRestriction *int64 `json:"agcAndColorStripeRestriction,omitempty"` - AllowPassingVideoContentToUnknownOutput ContentKeyPolicyPlayReadyUnknownOutputPassingOption `json:"allowPassingVideoContentToUnknownOutput"` - AnalogVideoOpl *int64 `json:"analogVideoOpl,omitempty"` - CompressedDigitalAudioOpl *int64 `json:"compressedDigitalAudioOpl,omitempty"` - CompressedDigitalVideoOpl *int64 `json:"compressedDigitalVideoOpl,omitempty"` - DigitalVideoOnlyContentRestriction bool `json:"digitalVideoOnlyContentRestriction"` - ExplicitAnalogTelevisionOutputRestriction *ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction `json:"explicitAnalogTelevisionOutputRestriction,omitempty"` - FirstPlayExpiration *string `json:"firstPlayExpiration,omitempty"` - ImageConstraintForAnalogComponentVideoRestriction bool `json:"imageConstraintForAnalogComponentVideoRestriction"` - ImageConstraintForAnalogComputerMonitorRestriction bool `json:"imageConstraintForAnalogComputerMonitorRestriction"` - ScmsRestriction *int64 `json:"scmsRestriction,omitempty"` - UncompressedDigitalAudioOpl *int64 `json:"uncompressedDigitalAudioOpl,omitempty"` - UncompressedDigitalVideoOpl *int64 `json:"uncompressedDigitalVideoOpl,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyproperties.go deleted file mode 100644 index af3576dec79d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyproperties.go +++ /dev/null @@ -1,42 +0,0 @@ -package contentkeypolicies - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPolicyProperties struct { - Created *string `json:"created,omitempty"` - Description *string `json:"description,omitempty"` - LastModified *string `json:"lastModified,omitempty"` - Options []ContentKeyPolicyOption `json:"options"` - PolicyId *string `json:"policyId,omitempty"` -} - -func (o *ContentKeyPolicyProperties) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *ContentKeyPolicyProperties) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} - -func (o *ContentKeyPolicyProperties) GetLastModifiedAsTime() (*time.Time, error) { - if o.LastModified == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModified, "2006-01-02T15:04:05Z07:00") -} - -func (o *ContentKeyPolicyProperties) SetLastModifiedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModified = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyrestriction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyrestriction.go deleted file mode 100644 index 155776286c30..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyrestriction.go +++ /dev/null @@ -1,64 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPolicyRestriction interface { -} - -func unmarshalContentKeyPolicyRestrictionImplementation(input []byte) (ContentKeyPolicyRestriction, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyRestriction into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.ContentKeyPolicyOpenRestriction") { - var out ContentKeyPolicyOpenRestriction - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ContentKeyPolicyOpenRestriction: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.ContentKeyPolicyTokenRestriction") { - var out ContentKeyPolicyTokenRestriction - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ContentKeyPolicyTokenRestriction: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.ContentKeyPolicyUnknownRestriction") { - var out ContentKeyPolicyUnknownRestriction - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ContentKeyPolicyUnknownRestriction: %+v", err) - } - return out, nil - } - - type RawContentKeyPolicyRestrictionImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawContentKeyPolicyRestrictionImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyrestrictiontokenkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyrestrictiontokenkey.go deleted file mode 100644 index 1cf28ead243f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyrestrictiontokenkey.go +++ /dev/null @@ -1,64 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPolicyRestrictionTokenKey interface { -} - -func unmarshalContentKeyPolicyRestrictionTokenKeyImplementation(input []byte) (ContentKeyPolicyRestrictionTokenKey, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyRestrictionTokenKey into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.ContentKeyPolicyRsaTokenKey") { - var out ContentKeyPolicyRsaTokenKey - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ContentKeyPolicyRsaTokenKey: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey") { - var out ContentKeyPolicySymmetricTokenKey - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ContentKeyPolicySymmetricTokenKey: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey") { - var out ContentKeyPolicyX509CertificateTokenKey - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ContentKeyPolicyX509CertificateTokenKey: %+v", err) - } - return out, nil - } - - type RawContentKeyPolicyRestrictionTokenKeyImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawContentKeyPolicyRestrictionTokenKeyImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyrsatokenkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyrsatokenkey.go deleted file mode 100644 index 75dc037576d1..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyrsatokenkey.go +++ /dev/null @@ -1,42 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ContentKeyPolicyRestrictionTokenKey = ContentKeyPolicyRsaTokenKey{} - -type ContentKeyPolicyRsaTokenKey struct { - Exponent string `json:"exponent"` - Modulus string `json:"modulus"` - - // Fields inherited from ContentKeyPolicyRestrictionTokenKey -} - -var _ json.Marshaler = ContentKeyPolicyRsaTokenKey{} - -func (s ContentKeyPolicyRsaTokenKey) MarshalJSON() ([]byte, error) { - type wrapper ContentKeyPolicyRsaTokenKey - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ContentKeyPolicyRsaTokenKey: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyRsaTokenKey: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyRsaTokenKey" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ContentKeyPolicyRsaTokenKey: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicysymmetrictokenkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicysymmetrictokenkey.go deleted file mode 100644 index 97eab4e535d4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicysymmetrictokenkey.go +++ /dev/null @@ -1,41 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ContentKeyPolicyRestrictionTokenKey = ContentKeyPolicySymmetricTokenKey{} - -type ContentKeyPolicySymmetricTokenKey struct { - KeyValue string `json:"keyValue"` - - // Fields inherited from ContentKeyPolicyRestrictionTokenKey -} - -var _ json.Marshaler = ContentKeyPolicySymmetricTokenKey{} - -func (s ContentKeyPolicySymmetricTokenKey) MarshalJSON() ([]byte, error) { - type wrapper ContentKeyPolicySymmetricTokenKey - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ContentKeyPolicySymmetricTokenKey: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicySymmetricTokenKey: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ContentKeyPolicySymmetricTokenKey: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicytokenclaim.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicytokenclaim.go deleted file mode 100644 index 5ce3fb3f3197..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicytokenclaim.go +++ /dev/null @@ -1,9 +0,0 @@ -package contentkeypolicies - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContentKeyPolicyTokenClaim struct { - ClaimType *string `json:"claimType,omitempty"` - ClaimValue *string `json:"claimValue,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicytokenrestriction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicytokenrestriction.go deleted file mode 100644 index 6b5e417cc011..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicytokenrestriction.go +++ /dev/null @@ -1,94 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ContentKeyPolicyRestriction = ContentKeyPolicyTokenRestriction{} - -type ContentKeyPolicyTokenRestriction struct { - AlternateVerificationKeys *[]ContentKeyPolicyRestrictionTokenKey `json:"alternateVerificationKeys,omitempty"` - Audience string `json:"audience"` - Issuer string `json:"issuer"` - OpenIdConnectDiscoveryDocument *string `json:"openIdConnectDiscoveryDocument,omitempty"` - PrimaryVerificationKey ContentKeyPolicyRestrictionTokenKey `json:"primaryVerificationKey"` - RequiredClaims *[]ContentKeyPolicyTokenClaim `json:"requiredClaims,omitempty"` - RestrictionTokenType ContentKeyPolicyRestrictionTokenType `json:"restrictionTokenType"` - - // Fields inherited from ContentKeyPolicyRestriction -} - -var _ json.Marshaler = ContentKeyPolicyTokenRestriction{} - -func (s ContentKeyPolicyTokenRestriction) MarshalJSON() ([]byte, error) { - type wrapper ContentKeyPolicyTokenRestriction - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ContentKeyPolicyTokenRestriction: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyTokenRestriction: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyTokenRestriction" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ContentKeyPolicyTokenRestriction: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &ContentKeyPolicyTokenRestriction{} - -func (s *ContentKeyPolicyTokenRestriction) UnmarshalJSON(bytes []byte) error { - type alias ContentKeyPolicyTokenRestriction - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into ContentKeyPolicyTokenRestriction: %+v", err) - } - - s.Audience = decoded.Audience - s.Issuer = decoded.Issuer - s.OpenIdConnectDiscoveryDocument = decoded.OpenIdConnectDiscoveryDocument - s.RequiredClaims = decoded.RequiredClaims - s.RestrictionTokenType = decoded.RestrictionTokenType - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling ContentKeyPolicyTokenRestriction into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["alternateVerificationKeys"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling AlternateVerificationKeys into list []json.RawMessage: %+v", err) - } - - output := make([]ContentKeyPolicyRestrictionTokenKey, 0) - for i, val := range listTemp { - impl, err := unmarshalContentKeyPolicyRestrictionTokenKeyImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'AlternateVerificationKeys' for 'ContentKeyPolicyTokenRestriction': %+v", i, err) - } - output = append(output, impl) - } - s.AlternateVerificationKeys = &output - } - - if v, ok := temp["primaryVerificationKey"]; ok { - impl, err := unmarshalContentKeyPolicyRestrictionTokenKeyImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'PrimaryVerificationKey' for 'ContentKeyPolicyTokenRestriction': %+v", err) - } - s.PrimaryVerificationKey = impl - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyunknownconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyunknownconfiguration.go deleted file mode 100644 index 9683eb34e564..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyunknownconfiguration.go +++ /dev/null @@ -1,40 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ContentKeyPolicyConfiguration = ContentKeyPolicyUnknownConfiguration{} - -type ContentKeyPolicyUnknownConfiguration struct { - - // Fields inherited from ContentKeyPolicyConfiguration -} - -var _ json.Marshaler = ContentKeyPolicyUnknownConfiguration{} - -func (s ContentKeyPolicyUnknownConfiguration) MarshalJSON() ([]byte, error) { - type wrapper ContentKeyPolicyUnknownConfiguration - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ContentKeyPolicyUnknownConfiguration: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyUnknownConfiguration: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyUnknownConfiguration" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ContentKeyPolicyUnknownConfiguration: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyunknownrestriction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyunknownrestriction.go deleted file mode 100644 index a7ab64728f2f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyunknownrestriction.go +++ /dev/null @@ -1,40 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ContentKeyPolicyRestriction = ContentKeyPolicyUnknownRestriction{} - -type ContentKeyPolicyUnknownRestriction struct { - - // Fields inherited from ContentKeyPolicyRestriction -} - -var _ json.Marshaler = ContentKeyPolicyUnknownRestriction{} - -func (s ContentKeyPolicyUnknownRestriction) MarshalJSON() ([]byte, error) { - type wrapper ContentKeyPolicyUnknownRestriction - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ContentKeyPolicyUnknownRestriction: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyUnknownRestriction: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyUnknownRestriction" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ContentKeyPolicyUnknownRestriction: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicywidevineconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicywidevineconfiguration.go deleted file mode 100644 index 1a79d2879645..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicywidevineconfiguration.go +++ /dev/null @@ -1,41 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ContentKeyPolicyConfiguration = ContentKeyPolicyWidevineConfiguration{} - -type ContentKeyPolicyWidevineConfiguration struct { - WidevineTemplate string `json:"widevineTemplate"` - - // Fields inherited from ContentKeyPolicyConfiguration -} - -var _ json.Marshaler = ContentKeyPolicyWidevineConfiguration{} - -func (s ContentKeyPolicyWidevineConfiguration) MarshalJSON() ([]byte, error) { - type wrapper ContentKeyPolicyWidevineConfiguration - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ContentKeyPolicyWidevineConfiguration: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyWidevineConfiguration: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ContentKeyPolicyWidevineConfiguration: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyx509certificatetokenkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyx509certificatetokenkey.go deleted file mode 100644 index 0810b28176e1..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/model_contentkeypolicyx509certificatetokenkey.go +++ /dev/null @@ -1,41 +0,0 @@ -package contentkeypolicies - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ContentKeyPolicyRestrictionTokenKey = ContentKeyPolicyX509CertificateTokenKey{} - -type ContentKeyPolicyX509CertificateTokenKey struct { - RawBody string `json:"rawBody"` - - // Fields inherited from ContentKeyPolicyRestrictionTokenKey -} - -var _ json.Marshaler = ContentKeyPolicyX509CertificateTokenKey{} - -func (s ContentKeyPolicyX509CertificateTokenKey) MarshalJSON() ([]byte, error) { - type wrapper ContentKeyPolicyX509CertificateTokenKey - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ContentKeyPolicyX509CertificateTokenKey: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ContentKeyPolicyX509CertificateTokenKey: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ContentKeyPolicyX509CertificateTokenKey: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/predicates.go deleted file mode 100644 index d16ed09d1719..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/predicates.go +++ /dev/null @@ -1,24 +0,0 @@ -package contentkeypolicies - -type ContentKeyPolicyOperationPredicate struct { - Id *string - Name *string - Type *string -} - -func (p ContentKeyPolicyOperationPredicate) Matches(input ContentKeyPolicy) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/version.go deleted file mode 100644 index 281b480bc314..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package contentkeypolicies - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2020-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/contentkeypolicies/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/README.md deleted file mode 100644 index e4a2aa9f9060..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/README.md +++ /dev/null @@ -1,218 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings` Documentation - -The `encodings` SDK allows for interaction with the Azure Resource Manager Service `media` (API Version `2020-05-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings" -``` - - -### Client Initialization - -```go -client := encodings.NewEncodingsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `EncodingsClient.JobsCancelJob` - -```go -ctx := context.TODO() -id := encodings.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue", "jobValue") - -read, err := client.JobsCancelJob(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `EncodingsClient.JobsCreate` - -```go -ctx := context.TODO() -id := encodings.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue", "jobValue") - -payload := encodings.Job{ - // ... -} - - -read, err := client.JobsCreate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `EncodingsClient.JobsDelete` - -```go -ctx := context.TODO() -id := encodings.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue", "jobValue") - -read, err := client.JobsDelete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `EncodingsClient.JobsGet` - -```go -ctx := context.TODO() -id := encodings.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue", "jobValue") - -read, err := client.JobsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `EncodingsClient.JobsList` - -```go -ctx := context.TODO() -id := encodings.NewTransformID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue") - -// alternatively `client.JobsList(ctx, id, encodings.DefaultJobsListOperationOptions())` can be used to do batched pagination -items, err := client.JobsListComplete(ctx, id, encodings.DefaultJobsListOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `EncodingsClient.JobsUpdate` - -```go -ctx := context.TODO() -id := encodings.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue", "jobValue") - -payload := encodings.Job{ - // ... -} - - -read, err := client.JobsUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `EncodingsClient.TransformsCreateOrUpdate` - -```go -ctx := context.TODO() -id := encodings.NewTransformID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue") - -payload := encodings.Transform{ - // ... -} - - -read, err := client.TransformsCreateOrUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `EncodingsClient.TransformsDelete` - -```go -ctx := context.TODO() -id := encodings.NewTransformID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue") - -read, err := client.TransformsDelete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `EncodingsClient.TransformsGet` - -```go -ctx := context.TODO() -id := encodings.NewTransformID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue") - -read, err := client.TransformsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `EncodingsClient.TransformsList` - -```go -ctx := context.TODO() -id := encodings.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -// alternatively `client.TransformsList(ctx, id, encodings.DefaultTransformsListOperationOptions())` can be used to do batched pagination -items, err := client.TransformsListComplete(ctx, id, encodings.DefaultTransformsListOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `EncodingsClient.TransformsUpdate` - -```go -ctx := context.TODO() -id := encodings.NewTransformID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue") - -payload := encodings.Transform{ - // ... -} - - -read, err := client.TransformsUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/client.go deleted file mode 100644 index 8536e0c8a4dd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package encodings - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EncodingsClient struct { - Client autorest.Client - baseUri string -} - -func NewEncodingsClientWithBaseURI(endpoint string) EncodingsClient { - return EncodingsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/constants.go deleted file mode 100644 index 1b90081f568f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/constants.go +++ /dev/null @@ -1,908 +0,0 @@ -package encodings - -import "strings" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AacAudioProfile string - -const ( - AacAudioProfileAacLc AacAudioProfile = "AacLc" - AacAudioProfileHeAacVOne AacAudioProfile = "HeAacV1" - AacAudioProfileHeAacVTwo AacAudioProfile = "HeAacV2" -) - -func PossibleValuesForAacAudioProfile() []string { - return []string{ - string(AacAudioProfileAacLc), - string(AacAudioProfileHeAacVOne), - string(AacAudioProfileHeAacVTwo), - } -} - -func parseAacAudioProfile(input string) (*AacAudioProfile, error) { - vals := map[string]AacAudioProfile{ - "aaclc": AacAudioProfileAacLc, - "heaacv1": AacAudioProfileHeAacVOne, - "heaacv2": AacAudioProfileHeAacVTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AacAudioProfile(input) - return &out, nil -} - -type AnalysisResolution string - -const ( - AnalysisResolutionSourceResolution AnalysisResolution = "SourceResolution" - AnalysisResolutionStandardDefinition AnalysisResolution = "StandardDefinition" -) - -func PossibleValuesForAnalysisResolution() []string { - return []string{ - string(AnalysisResolutionSourceResolution), - string(AnalysisResolutionStandardDefinition), - } -} - -func parseAnalysisResolution(input string) (*AnalysisResolution, error) { - vals := map[string]AnalysisResolution{ - "sourceresolution": AnalysisResolutionSourceResolution, - "standarddefinition": AnalysisResolutionStandardDefinition, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AnalysisResolution(input) - return &out, nil -} - -type AttributeFilter string - -const ( - AttributeFilterAll AttributeFilter = "All" - AttributeFilterBottom AttributeFilter = "Bottom" - AttributeFilterTop AttributeFilter = "Top" - AttributeFilterValueEquals AttributeFilter = "ValueEquals" -) - -func PossibleValuesForAttributeFilter() []string { - return []string{ - string(AttributeFilterAll), - string(AttributeFilterBottom), - string(AttributeFilterTop), - string(AttributeFilterValueEquals), - } -} - -func parseAttributeFilter(input string) (*AttributeFilter, error) { - vals := map[string]AttributeFilter{ - "all": AttributeFilterAll, - "bottom": AttributeFilterBottom, - "top": AttributeFilterTop, - "valueequals": AttributeFilterValueEquals, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AttributeFilter(input) - return &out, nil -} - -type AudioAnalysisMode string - -const ( - AudioAnalysisModeBasic AudioAnalysisMode = "Basic" - AudioAnalysisModeStandard AudioAnalysisMode = "Standard" -) - -func PossibleValuesForAudioAnalysisMode() []string { - return []string{ - string(AudioAnalysisModeBasic), - string(AudioAnalysisModeStandard), - } -} - -func parseAudioAnalysisMode(input string) (*AudioAnalysisMode, error) { - vals := map[string]AudioAnalysisMode{ - "basic": AudioAnalysisModeBasic, - "standard": AudioAnalysisModeStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AudioAnalysisMode(input) - return &out, nil -} - -type BlurType string - -const ( - BlurTypeBlack BlurType = "Black" - BlurTypeBox BlurType = "Box" - BlurTypeHigh BlurType = "High" - BlurTypeLow BlurType = "Low" - BlurTypeMed BlurType = "Med" -) - -func PossibleValuesForBlurType() []string { - return []string{ - string(BlurTypeBlack), - string(BlurTypeBox), - string(BlurTypeHigh), - string(BlurTypeLow), - string(BlurTypeMed), - } -} - -func parseBlurType(input string) (*BlurType, error) { - vals := map[string]BlurType{ - "black": BlurTypeBlack, - "box": BlurTypeBox, - "high": BlurTypeHigh, - "low": BlurTypeLow, - "med": BlurTypeMed, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := BlurType(input) - return &out, nil -} - -type ChannelMapping string - -const ( - ChannelMappingBackLeft ChannelMapping = "BackLeft" - ChannelMappingBackRight ChannelMapping = "BackRight" - ChannelMappingCenter ChannelMapping = "Center" - ChannelMappingFrontLeft ChannelMapping = "FrontLeft" - ChannelMappingFrontRight ChannelMapping = "FrontRight" - ChannelMappingLowFrequencyEffects ChannelMapping = "LowFrequencyEffects" - ChannelMappingStereoLeft ChannelMapping = "StereoLeft" - ChannelMappingStereoRight ChannelMapping = "StereoRight" -) - -func PossibleValuesForChannelMapping() []string { - return []string{ - string(ChannelMappingBackLeft), - string(ChannelMappingBackRight), - string(ChannelMappingCenter), - string(ChannelMappingFrontLeft), - string(ChannelMappingFrontRight), - string(ChannelMappingLowFrequencyEffects), - string(ChannelMappingStereoLeft), - string(ChannelMappingStereoRight), - } -} - -func parseChannelMapping(input string) (*ChannelMapping, error) { - vals := map[string]ChannelMapping{ - "backleft": ChannelMappingBackLeft, - "backright": ChannelMappingBackRight, - "center": ChannelMappingCenter, - "frontleft": ChannelMappingFrontLeft, - "frontright": ChannelMappingFrontRight, - "lowfrequencyeffects": ChannelMappingLowFrequencyEffects, - "stereoleft": ChannelMappingStereoLeft, - "stereoright": ChannelMappingStereoRight, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ChannelMapping(input) - return &out, nil -} - -type DeinterlaceMode string - -const ( - DeinterlaceModeAutoPixelAdaptive DeinterlaceMode = "AutoPixelAdaptive" - DeinterlaceModeOff DeinterlaceMode = "Off" -) - -func PossibleValuesForDeinterlaceMode() []string { - return []string{ - string(DeinterlaceModeAutoPixelAdaptive), - string(DeinterlaceModeOff), - } -} - -func parseDeinterlaceMode(input string) (*DeinterlaceMode, error) { - vals := map[string]DeinterlaceMode{ - "autopixeladaptive": DeinterlaceModeAutoPixelAdaptive, - "off": DeinterlaceModeOff, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DeinterlaceMode(input) - return &out, nil -} - -type DeinterlaceParity string - -const ( - DeinterlaceParityAuto DeinterlaceParity = "Auto" - DeinterlaceParityBottomFieldFirst DeinterlaceParity = "BottomFieldFirst" - DeinterlaceParityTopFieldFirst DeinterlaceParity = "TopFieldFirst" -) - -func PossibleValuesForDeinterlaceParity() []string { - return []string{ - string(DeinterlaceParityAuto), - string(DeinterlaceParityBottomFieldFirst), - string(DeinterlaceParityTopFieldFirst), - } -} - -func parseDeinterlaceParity(input string) (*DeinterlaceParity, error) { - vals := map[string]DeinterlaceParity{ - "auto": DeinterlaceParityAuto, - "bottomfieldfirst": DeinterlaceParityBottomFieldFirst, - "topfieldfirst": DeinterlaceParityTopFieldFirst, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DeinterlaceParity(input) - return &out, nil -} - -type EncoderNamedPreset string - -const ( - EncoderNamedPresetAACGoodQualityAudio EncoderNamedPreset = "AACGoodQualityAudio" - EncoderNamedPresetAdaptiveStreaming EncoderNamedPreset = "AdaptiveStreaming" - EncoderNamedPresetContentAwareEncoding EncoderNamedPreset = "ContentAwareEncoding" - EncoderNamedPresetContentAwareEncodingExperimental EncoderNamedPreset = "ContentAwareEncodingExperimental" - EncoderNamedPresetCopyAllBitrateNonInterleaved EncoderNamedPreset = "CopyAllBitrateNonInterleaved" - EncoderNamedPresetHTwoSixFiveAdaptiveStreaming EncoderNamedPreset = "H265AdaptiveStreaming" - EncoderNamedPresetHTwoSixFiveContentAwareEncoding EncoderNamedPreset = "H265ContentAwareEncoding" - EncoderNamedPresetHTwoSixFiveSingleBitrateFourK EncoderNamedPreset = "H265SingleBitrate4K" - EncoderNamedPresetHTwoSixFiveSingleBitrateOneZeroEightZerop EncoderNamedPreset = "H265SingleBitrate1080p" - EncoderNamedPresetHTwoSixFiveSingleBitrateSevenTwoZerop EncoderNamedPreset = "H265SingleBitrate720p" - EncoderNamedPresetHTwoSixFourMultipleBitrateOneZeroEightZerop EncoderNamedPreset = "H264MultipleBitrate1080p" - EncoderNamedPresetHTwoSixFourMultipleBitrateSD EncoderNamedPreset = "H264MultipleBitrateSD" - EncoderNamedPresetHTwoSixFourMultipleBitrateSevenTwoZerop EncoderNamedPreset = "H264MultipleBitrate720p" - EncoderNamedPresetHTwoSixFourSingleBitrateOneZeroEightZerop EncoderNamedPreset = "H264SingleBitrate1080p" - EncoderNamedPresetHTwoSixFourSingleBitrateSD EncoderNamedPreset = "H264SingleBitrateSD" - EncoderNamedPresetHTwoSixFourSingleBitrateSevenTwoZerop EncoderNamedPreset = "H264SingleBitrate720p" -) - -func PossibleValuesForEncoderNamedPreset() []string { - return []string{ - string(EncoderNamedPresetAACGoodQualityAudio), - string(EncoderNamedPresetAdaptiveStreaming), - string(EncoderNamedPresetContentAwareEncoding), - string(EncoderNamedPresetContentAwareEncodingExperimental), - string(EncoderNamedPresetCopyAllBitrateNonInterleaved), - string(EncoderNamedPresetHTwoSixFiveAdaptiveStreaming), - string(EncoderNamedPresetHTwoSixFiveContentAwareEncoding), - string(EncoderNamedPresetHTwoSixFiveSingleBitrateFourK), - string(EncoderNamedPresetHTwoSixFiveSingleBitrateOneZeroEightZerop), - string(EncoderNamedPresetHTwoSixFiveSingleBitrateSevenTwoZerop), - string(EncoderNamedPresetHTwoSixFourMultipleBitrateOneZeroEightZerop), - string(EncoderNamedPresetHTwoSixFourMultipleBitrateSD), - string(EncoderNamedPresetHTwoSixFourMultipleBitrateSevenTwoZerop), - string(EncoderNamedPresetHTwoSixFourSingleBitrateOneZeroEightZerop), - string(EncoderNamedPresetHTwoSixFourSingleBitrateSD), - string(EncoderNamedPresetHTwoSixFourSingleBitrateSevenTwoZerop), - } -} - -func parseEncoderNamedPreset(input string) (*EncoderNamedPreset, error) { - vals := map[string]EncoderNamedPreset{ - "aacgoodqualityaudio": EncoderNamedPresetAACGoodQualityAudio, - "adaptivestreaming": EncoderNamedPresetAdaptiveStreaming, - "contentawareencoding": EncoderNamedPresetContentAwareEncoding, - "contentawareencodingexperimental": EncoderNamedPresetContentAwareEncodingExperimental, - "copyallbitratenoninterleaved": EncoderNamedPresetCopyAllBitrateNonInterleaved, - "h265adaptivestreaming": EncoderNamedPresetHTwoSixFiveAdaptiveStreaming, - "h265contentawareencoding": EncoderNamedPresetHTwoSixFiveContentAwareEncoding, - "h265singlebitrate4k": EncoderNamedPresetHTwoSixFiveSingleBitrateFourK, - "h265singlebitrate1080p": EncoderNamedPresetHTwoSixFiveSingleBitrateOneZeroEightZerop, - "h265singlebitrate720p": EncoderNamedPresetHTwoSixFiveSingleBitrateSevenTwoZerop, - "h264multiplebitrate1080p": EncoderNamedPresetHTwoSixFourMultipleBitrateOneZeroEightZerop, - "h264multiplebitratesd": EncoderNamedPresetHTwoSixFourMultipleBitrateSD, - "h264multiplebitrate720p": EncoderNamedPresetHTwoSixFourMultipleBitrateSevenTwoZerop, - "h264singlebitrate1080p": EncoderNamedPresetHTwoSixFourSingleBitrateOneZeroEightZerop, - "h264singlebitratesd": EncoderNamedPresetHTwoSixFourSingleBitrateSD, - "h264singlebitrate720p": EncoderNamedPresetHTwoSixFourSingleBitrateSevenTwoZerop, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncoderNamedPreset(input) - return &out, nil -} - -type EntropyMode string - -const ( - EntropyModeCabac EntropyMode = "Cabac" - EntropyModeCavlc EntropyMode = "Cavlc" -) - -func PossibleValuesForEntropyMode() []string { - return []string{ - string(EntropyModeCabac), - string(EntropyModeCavlc), - } -} - -func parseEntropyMode(input string) (*EntropyMode, error) { - vals := map[string]EntropyMode{ - "cabac": EntropyModeCabac, - "cavlc": EntropyModeCavlc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EntropyMode(input) - return &out, nil -} - -type FaceRedactorMode string - -const ( - FaceRedactorModeAnalyze FaceRedactorMode = "Analyze" - FaceRedactorModeCombined FaceRedactorMode = "Combined" - FaceRedactorModeRedact FaceRedactorMode = "Redact" -) - -func PossibleValuesForFaceRedactorMode() []string { - return []string{ - string(FaceRedactorModeAnalyze), - string(FaceRedactorModeCombined), - string(FaceRedactorModeRedact), - } -} - -func parseFaceRedactorMode(input string) (*FaceRedactorMode, error) { - vals := map[string]FaceRedactorMode{ - "analyze": FaceRedactorModeAnalyze, - "combined": FaceRedactorModeCombined, - "redact": FaceRedactorModeRedact, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FaceRedactorMode(input) - return &out, nil -} - -type H264Complexity string - -const ( - H264ComplexityBalanced H264Complexity = "Balanced" - H264ComplexityQuality H264Complexity = "Quality" - H264ComplexitySpeed H264Complexity = "Speed" -) - -func PossibleValuesForH264Complexity() []string { - return []string{ - string(H264ComplexityBalanced), - string(H264ComplexityQuality), - string(H264ComplexitySpeed), - } -} - -func parseH264Complexity(input string) (*H264Complexity, error) { - vals := map[string]H264Complexity{ - "balanced": H264ComplexityBalanced, - "quality": H264ComplexityQuality, - "speed": H264ComplexitySpeed, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := H264Complexity(input) - return &out, nil -} - -type H264VideoProfile string - -const ( - H264VideoProfileAuto H264VideoProfile = "Auto" - H264VideoProfileBaseline H264VideoProfile = "Baseline" - H264VideoProfileHigh H264VideoProfile = "High" - H264VideoProfileHighFourFourFour H264VideoProfile = "High444" - H264VideoProfileHighFourTwoTwo H264VideoProfile = "High422" - H264VideoProfileMain H264VideoProfile = "Main" -) - -func PossibleValuesForH264VideoProfile() []string { - return []string{ - string(H264VideoProfileAuto), - string(H264VideoProfileBaseline), - string(H264VideoProfileHigh), - string(H264VideoProfileHighFourFourFour), - string(H264VideoProfileHighFourTwoTwo), - string(H264VideoProfileMain), - } -} - -func parseH264VideoProfile(input string) (*H264VideoProfile, error) { - vals := map[string]H264VideoProfile{ - "auto": H264VideoProfileAuto, - "baseline": H264VideoProfileBaseline, - "high": H264VideoProfileHigh, - "high444": H264VideoProfileHighFourFourFour, - "high422": H264VideoProfileHighFourTwoTwo, - "main": H264VideoProfileMain, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := H264VideoProfile(input) - return &out, nil -} - -type H265Complexity string - -const ( - H265ComplexityBalanced H265Complexity = "Balanced" - H265ComplexityQuality H265Complexity = "Quality" - H265ComplexitySpeed H265Complexity = "Speed" -) - -func PossibleValuesForH265Complexity() []string { - return []string{ - string(H265ComplexityBalanced), - string(H265ComplexityQuality), - string(H265ComplexitySpeed), - } -} - -func parseH265Complexity(input string) (*H265Complexity, error) { - vals := map[string]H265Complexity{ - "balanced": H265ComplexityBalanced, - "quality": H265ComplexityQuality, - "speed": H265ComplexitySpeed, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := H265Complexity(input) - return &out, nil -} - -type H265VideoProfile string - -const ( - H265VideoProfileAuto H265VideoProfile = "Auto" - H265VideoProfileMain H265VideoProfile = "Main" -) - -func PossibleValuesForH265VideoProfile() []string { - return []string{ - string(H265VideoProfileAuto), - string(H265VideoProfileMain), - } -} - -func parseH265VideoProfile(input string) (*H265VideoProfile, error) { - vals := map[string]H265VideoProfile{ - "auto": H265VideoProfileAuto, - "main": H265VideoProfileMain, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := H265VideoProfile(input) - return &out, nil -} - -type InsightsType string - -const ( - InsightsTypeAllInsights InsightsType = "AllInsights" - InsightsTypeAudioInsightsOnly InsightsType = "AudioInsightsOnly" - InsightsTypeVideoInsightsOnly InsightsType = "VideoInsightsOnly" -) - -func PossibleValuesForInsightsType() []string { - return []string{ - string(InsightsTypeAllInsights), - string(InsightsTypeAudioInsightsOnly), - string(InsightsTypeVideoInsightsOnly), - } -} - -func parseInsightsType(input string) (*InsightsType, error) { - vals := map[string]InsightsType{ - "allinsights": InsightsTypeAllInsights, - "audioinsightsonly": InsightsTypeAudioInsightsOnly, - "videoinsightsonly": InsightsTypeVideoInsightsOnly, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := InsightsType(input) - return &out, nil -} - -type JobErrorCategory string - -const ( - JobErrorCategoryConfiguration JobErrorCategory = "Configuration" - JobErrorCategoryContent JobErrorCategory = "Content" - JobErrorCategoryDownload JobErrorCategory = "Download" - JobErrorCategoryService JobErrorCategory = "Service" - JobErrorCategoryUpload JobErrorCategory = "Upload" -) - -func PossibleValuesForJobErrorCategory() []string { - return []string{ - string(JobErrorCategoryConfiguration), - string(JobErrorCategoryContent), - string(JobErrorCategoryDownload), - string(JobErrorCategoryService), - string(JobErrorCategoryUpload), - } -} - -func parseJobErrorCategory(input string) (*JobErrorCategory, error) { - vals := map[string]JobErrorCategory{ - "configuration": JobErrorCategoryConfiguration, - "content": JobErrorCategoryContent, - "download": JobErrorCategoryDownload, - "service": JobErrorCategoryService, - "upload": JobErrorCategoryUpload, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := JobErrorCategory(input) - return &out, nil -} - -type JobErrorCode string - -const ( - JobErrorCodeConfigurationUnsupported JobErrorCode = "ConfigurationUnsupported" - JobErrorCodeContentMalformed JobErrorCode = "ContentMalformed" - JobErrorCodeContentUnsupported JobErrorCode = "ContentUnsupported" - JobErrorCodeDownloadNotAccessible JobErrorCode = "DownloadNotAccessible" - JobErrorCodeDownloadTransientError JobErrorCode = "DownloadTransientError" - JobErrorCodeServiceError JobErrorCode = "ServiceError" - JobErrorCodeServiceTransientError JobErrorCode = "ServiceTransientError" - JobErrorCodeUploadNotAccessible JobErrorCode = "UploadNotAccessible" - JobErrorCodeUploadTransientError JobErrorCode = "UploadTransientError" -) - -func PossibleValuesForJobErrorCode() []string { - return []string{ - string(JobErrorCodeConfigurationUnsupported), - string(JobErrorCodeContentMalformed), - string(JobErrorCodeContentUnsupported), - string(JobErrorCodeDownloadNotAccessible), - string(JobErrorCodeDownloadTransientError), - string(JobErrorCodeServiceError), - string(JobErrorCodeServiceTransientError), - string(JobErrorCodeUploadNotAccessible), - string(JobErrorCodeUploadTransientError), - } -} - -func parseJobErrorCode(input string) (*JobErrorCode, error) { - vals := map[string]JobErrorCode{ - "configurationunsupported": JobErrorCodeConfigurationUnsupported, - "contentmalformed": JobErrorCodeContentMalformed, - "contentunsupported": JobErrorCodeContentUnsupported, - "downloadnotaccessible": JobErrorCodeDownloadNotAccessible, - "downloadtransienterror": JobErrorCodeDownloadTransientError, - "serviceerror": JobErrorCodeServiceError, - "servicetransienterror": JobErrorCodeServiceTransientError, - "uploadnotaccessible": JobErrorCodeUploadNotAccessible, - "uploadtransienterror": JobErrorCodeUploadTransientError, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := JobErrorCode(input) - return &out, nil -} - -type JobRetry string - -const ( - JobRetryDoNotRetry JobRetry = "DoNotRetry" - JobRetryMayRetry JobRetry = "MayRetry" -) - -func PossibleValuesForJobRetry() []string { - return []string{ - string(JobRetryDoNotRetry), - string(JobRetryMayRetry), - } -} - -func parseJobRetry(input string) (*JobRetry, error) { - vals := map[string]JobRetry{ - "donotretry": JobRetryDoNotRetry, - "mayretry": JobRetryMayRetry, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := JobRetry(input) - return &out, nil -} - -type JobState string - -const ( - JobStateCanceled JobState = "Canceled" - JobStateCanceling JobState = "Canceling" - JobStateError JobState = "Error" - JobStateFinished JobState = "Finished" - JobStateProcessing JobState = "Processing" - JobStateQueued JobState = "Queued" - JobStateScheduled JobState = "Scheduled" -) - -func PossibleValuesForJobState() []string { - return []string{ - string(JobStateCanceled), - string(JobStateCanceling), - string(JobStateError), - string(JobStateFinished), - string(JobStateProcessing), - string(JobStateQueued), - string(JobStateScheduled), - } -} - -func parseJobState(input string) (*JobState, error) { - vals := map[string]JobState{ - "canceled": JobStateCanceled, - "canceling": JobStateCanceling, - "error": JobStateError, - "finished": JobStateFinished, - "processing": JobStateProcessing, - "queued": JobStateQueued, - "scheduled": JobStateScheduled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := JobState(input) - return &out, nil -} - -type OnErrorType string - -const ( - OnErrorTypeContinueJob OnErrorType = "ContinueJob" - OnErrorTypeStopProcessingJob OnErrorType = "StopProcessingJob" -) - -func PossibleValuesForOnErrorType() []string { - return []string{ - string(OnErrorTypeContinueJob), - string(OnErrorTypeStopProcessingJob), - } -} - -func parseOnErrorType(input string) (*OnErrorType, error) { - vals := map[string]OnErrorType{ - "continuejob": OnErrorTypeContinueJob, - "stopprocessingjob": OnErrorTypeStopProcessingJob, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := OnErrorType(input) - return &out, nil -} - -type Priority string - -const ( - PriorityHigh Priority = "High" - PriorityLow Priority = "Low" - PriorityNormal Priority = "Normal" -) - -func PossibleValuesForPriority() []string { - return []string{ - string(PriorityHigh), - string(PriorityLow), - string(PriorityNormal), - } -} - -func parsePriority(input string) (*Priority, error) { - vals := map[string]Priority{ - "high": PriorityHigh, - "low": PriorityLow, - "normal": PriorityNormal, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Priority(input) - return &out, nil -} - -type Rotation string - -const ( - RotationAuto Rotation = "Auto" - RotationNone Rotation = "None" - RotationRotateNineZero Rotation = "Rotate90" - RotationRotateOneEightZero Rotation = "Rotate180" - RotationRotateTwoSevenZero Rotation = "Rotate270" - RotationRotateZero Rotation = "Rotate0" -) - -func PossibleValuesForRotation() []string { - return []string{ - string(RotationAuto), - string(RotationNone), - string(RotationRotateNineZero), - string(RotationRotateOneEightZero), - string(RotationRotateTwoSevenZero), - string(RotationRotateZero), - } -} - -func parseRotation(input string) (*Rotation, error) { - vals := map[string]Rotation{ - "auto": RotationAuto, - "none": RotationNone, - "rotate90": RotationRotateNineZero, - "rotate180": RotationRotateOneEightZero, - "rotate270": RotationRotateTwoSevenZero, - "rotate0": RotationRotateZero, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Rotation(input) - return &out, nil -} - -type StretchMode string - -const ( - StretchModeAutoFit StretchMode = "AutoFit" - StretchModeAutoSize StretchMode = "AutoSize" - StretchModeNone StretchMode = "None" -) - -func PossibleValuesForStretchMode() []string { - return []string{ - string(StretchModeAutoFit), - string(StretchModeAutoSize), - string(StretchModeNone), - } -} - -func parseStretchMode(input string) (*StretchMode, error) { - vals := map[string]StretchMode{ - "autofit": StretchModeAutoFit, - "autosize": StretchModeAutoSize, - "none": StretchModeNone, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := StretchMode(input) - return &out, nil -} - -type TrackAttribute string - -const ( - TrackAttributeBitrate TrackAttribute = "Bitrate" - TrackAttributeLanguage TrackAttribute = "Language" -) - -func PossibleValuesForTrackAttribute() []string { - return []string{ - string(TrackAttributeBitrate), - string(TrackAttributeLanguage), - } -} - -func parseTrackAttribute(input string) (*TrackAttribute, error) { - vals := map[string]TrackAttribute{ - "bitrate": TrackAttributeBitrate, - "language": TrackAttributeLanguage, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := TrackAttribute(input) - return &out, nil -} - -type VideoSyncMode string - -const ( - VideoSyncModeAuto VideoSyncMode = "Auto" - VideoSyncModeCfr VideoSyncMode = "Cfr" - VideoSyncModePassthrough VideoSyncMode = "Passthrough" - VideoSyncModeVfr VideoSyncMode = "Vfr" -) - -func PossibleValuesForVideoSyncMode() []string { - return []string{ - string(VideoSyncModeAuto), - string(VideoSyncModeCfr), - string(VideoSyncModePassthrough), - string(VideoSyncModeVfr), - } -} - -func parseVideoSyncMode(input string) (*VideoSyncMode, error) { - vals := map[string]VideoSyncMode{ - "auto": VideoSyncModeAuto, - "cfr": VideoSyncModeCfr, - "passthrough": VideoSyncModePassthrough, - "vfr": VideoSyncModeVfr, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VideoSyncMode(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/id_job.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/id_job.go deleted file mode 100644 index f3d07cd33cd4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/id_job.go +++ /dev/null @@ -1,150 +0,0 @@ -package encodings - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = JobId{} - -// JobId is a struct representing the Resource ID for a Job -type JobId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - TransformName string - JobName string -} - -// NewJobID returns a new JobId struct -func NewJobID(subscriptionId string, resourceGroupName string, accountName string, transformName string, jobName string) JobId { - return JobId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - TransformName: transformName, - JobName: jobName, - } -} - -// ParseJobID parses 'input' into a JobId -func ParseJobID(input string) (*JobId, error) { - parser := resourceids.NewParserFromResourceIdType(JobId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := JobId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { - return nil, fmt.Errorf("the segment 'transformName' was not found in the resource id %q", input) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseJobIDInsensitively parses 'input' case-insensitively into a JobId -// note: this method should only be used for API response data and not user input -func ParseJobIDInsensitively(input string) (*JobId, error) { - parser := resourceids.NewParserFromResourceIdType(JobId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := JobId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { - return nil, fmt.Errorf("the segment 'transformName' was not found in the resource id %q", input) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateJobID checks that 'input' can be parsed as a Job ID -func ValidateJobID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseJobID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Job ID -func (id JobId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/transforms/%s/jobs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.TransformName, id.JobName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Job ID -func (id JobId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticTransforms", "transforms", "transforms"), - resourceids.UserSpecifiedSegment("transformName", "transformValue"), - resourceids.StaticSegment("staticJobs", "jobs", "jobs"), - resourceids.UserSpecifiedSegment("jobName", "jobValue"), - } -} - -// String returns a human-readable description of this Job ID -func (id JobId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Transform Name: %q", id.TransformName), - fmt.Sprintf("Job Name: %q", id.JobName), - } - return fmt.Sprintf("Job (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/id_mediaservice.go deleted file mode 100644 index 0e1ebdbbf08e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/id_mediaservice.go +++ /dev/null @@ -1,124 +0,0 @@ -package encodings - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = MediaServiceId{} - -// MediaServiceId is a struct representing the Resource ID for a Media Service -type MediaServiceId struct { - SubscriptionId string - ResourceGroupName string - AccountName string -} - -// NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { - return MediaServiceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - } -} - -// ParseMediaServiceID parses 'input' into a MediaServiceId -func ParseMediaServiceID(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseMediaServiceIDInsensitively parses 'input' case-insensitively into a MediaServiceId -// note: this method should only be used for API response data and not user input -func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID -func ValidateMediaServiceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseMediaServiceID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Media Service ID -func (id MediaServiceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Media Service ID -func (id MediaServiceId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - } -} - -// String returns a human-readable description of this Media Service ID -func (id MediaServiceId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - } - return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/id_transform.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/id_transform.go deleted file mode 100644 index a01df6eb7697..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/id_transform.go +++ /dev/null @@ -1,137 +0,0 @@ -package encodings - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = TransformId{} - -// TransformId is a struct representing the Resource ID for a Transform -type TransformId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - TransformName string -} - -// NewTransformID returns a new TransformId struct -func NewTransformID(subscriptionId string, resourceGroupName string, accountName string, transformName string) TransformId { - return TransformId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - TransformName: transformName, - } -} - -// ParseTransformID parses 'input' into a TransformId -func ParseTransformID(input string) (*TransformId, error) { - parser := resourceids.NewParserFromResourceIdType(TransformId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := TransformId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { - return nil, fmt.Errorf("the segment 'transformName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseTransformIDInsensitively parses 'input' case-insensitively into a TransformId -// note: this method should only be used for API response data and not user input -func ParseTransformIDInsensitively(input string) (*TransformId, error) { - parser := resourceids.NewParserFromResourceIdType(TransformId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := TransformId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { - return nil, fmt.Errorf("the segment 'transformName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateTransformID checks that 'input' can be parsed as a Transform ID -func ValidateTransformID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseTransformID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Transform ID -func (id TransformId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/transforms/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.TransformName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Transform ID -func (id TransformId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticTransforms", "transforms", "transforms"), - resourceids.UserSpecifiedSegment("transformName", "transformValue"), - } -} - -// String returns a human-readable description of this Transform ID -func (id TransformId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Transform Name: %q", id.TransformName), - } - return fmt.Sprintf("Transform (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobscanceljob_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobscanceljob_autorest.go deleted file mode 100644 index d49f2c4d6500..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobscanceljob_autorest.go +++ /dev/null @@ -1,67 +0,0 @@ -package encodings - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type JobsCancelJobOperationResponse struct { - HttpResponse *http.Response -} - -// JobsCancelJob ... -func (c EncodingsClient) JobsCancelJob(ctx context.Context, id JobId) (result JobsCancelJobOperationResponse, err error) { - req, err := c.preparerForJobsCancelJob(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsCancelJob", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsCancelJob", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForJobsCancelJob(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsCancelJob", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForJobsCancelJob prepares the JobsCancelJob request. -func (c EncodingsClient) preparerForJobsCancelJob(ctx context.Context, id JobId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/cancelJob", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForJobsCancelJob handles the response to the JobsCancelJob request. The method always -// closes the http.Response Body. -func (c EncodingsClient) responderForJobsCancelJob(resp *http.Response) (result JobsCancelJobOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobscreate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobscreate_autorest.go deleted file mode 100644 index 8821acb2b283..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobscreate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package encodings - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type JobsCreateOperationResponse struct { - HttpResponse *http.Response - Model *Job -} - -// JobsCreate ... -func (c EncodingsClient) JobsCreate(ctx context.Context, id JobId, input Job) (result JobsCreateOperationResponse, err error) { - req, err := c.preparerForJobsCreate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsCreate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsCreate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForJobsCreate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsCreate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForJobsCreate prepares the JobsCreate request. -func (c EncodingsClient) preparerForJobsCreate(ctx context.Context, id JobId, input Job) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForJobsCreate handles the response to the JobsCreate request. The method always -// closes the http.Response Body. -func (c EncodingsClient) responderForJobsCreate(resp *http.Response) (result JobsCreateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobsdelete_autorest.go deleted file mode 100644 index 64de15013ad3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobsdelete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package encodings - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type JobsDeleteOperationResponse struct { - HttpResponse *http.Response -} - -// JobsDelete ... -func (c EncodingsClient) JobsDelete(ctx context.Context, id JobId) (result JobsDeleteOperationResponse, err error) { - req, err := c.preparerForJobsDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForJobsDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForJobsDelete prepares the JobsDelete request. -func (c EncodingsClient) preparerForJobsDelete(ctx context.Context, id JobId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForJobsDelete handles the response to the JobsDelete request. The method always -// closes the http.Response Body. -func (c EncodingsClient) responderForJobsDelete(resp *http.Response) (result JobsDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobsget_autorest.go deleted file mode 100644 index 7626362c6628..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobsget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package encodings - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type JobsGetOperationResponse struct { - HttpResponse *http.Response - Model *Job -} - -// JobsGet ... -func (c EncodingsClient) JobsGet(ctx context.Context, id JobId) (result JobsGetOperationResponse, err error) { - req, err := c.preparerForJobsGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForJobsGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForJobsGet prepares the JobsGet request. -func (c EncodingsClient) preparerForJobsGet(ctx context.Context, id JobId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForJobsGet handles the response to the JobsGet request. The method always -// closes the http.Response Body. -func (c EncodingsClient) responderForJobsGet(resp *http.Response) (result JobsGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobslist_autorest.go deleted file mode 100644 index 1ebf64e2eb90..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobslist_autorest.go +++ /dev/null @@ -1,220 +0,0 @@ -package encodings - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type JobsListOperationResponse struct { - HttpResponse *http.Response - Model *[]Job - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (JobsListOperationResponse, error) -} - -type JobsListCompleteResult struct { - Items []Job -} - -func (r JobsListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r JobsListOperationResponse) LoadMore(ctx context.Context) (resp JobsListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type JobsListOperationOptions struct { - Filter *string - Orderby *string -} - -func DefaultJobsListOperationOptions() JobsListOperationOptions { - return JobsListOperationOptions{} -} - -func (o JobsListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o JobsListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - return out -} - -// JobsList ... -func (c EncodingsClient) JobsList(ctx context.Context, id TransformId, options JobsListOperationOptions) (resp JobsListOperationResponse, err error) { - req, err := c.preparerForJobsList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForJobsList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForJobsList prepares the JobsList request. -func (c EncodingsClient) preparerForJobsList(ctx context.Context, id TransformId, options JobsListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/jobs", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForJobsListWithNextLink prepares the JobsList request with the given nextLink token. -func (c EncodingsClient) preparerForJobsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForJobsList handles the response to the JobsList request. The method always -// closes the http.Response Body. -func (c EncodingsClient) responderForJobsList(resp *http.Response) (result JobsListOperationResponse, err error) { - type page struct { - Values []Job `json:"value"` - NextLink *string `json:"@odata.nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result JobsListOperationResponse, err error) { - req, err := c.preparerForJobsListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForJobsList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// JobsListComplete retrieves all of the results into a single object -func (c EncodingsClient) JobsListComplete(ctx context.Context, id TransformId, options JobsListOperationOptions) (JobsListCompleteResult, error) { - return c.JobsListCompleteMatchingPredicate(ctx, id, options, JobOperationPredicate{}) -} - -// JobsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c EncodingsClient) JobsListCompleteMatchingPredicate(ctx context.Context, id TransformId, options JobsListOperationOptions, predicate JobOperationPredicate) (resp JobsListCompleteResult, err error) { - items := make([]Job, 0) - - page, err := c.JobsList(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := JobsListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobsupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobsupdate_autorest.go deleted file mode 100644 index e333a9d98bcd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_jobsupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package encodings - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type JobsUpdateOperationResponse struct { - HttpResponse *http.Response - Model *Job -} - -// JobsUpdate ... -func (c EncodingsClient) JobsUpdate(ctx context.Context, id JobId, input Job) (result JobsUpdateOperationResponse, err error) { - req, err := c.preparerForJobsUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForJobsUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "JobsUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForJobsUpdate prepares the JobsUpdate request. -func (c EncodingsClient) preparerForJobsUpdate(ctx context.Context, id JobId, input Job) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForJobsUpdate handles the response to the JobsUpdate request. The method always -// closes the http.Response Body. -func (c EncodingsClient) responderForJobsUpdate(resp *http.Response) (result JobsUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_transformscreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_transformscreateorupdate_autorest.go deleted file mode 100644 index 019866b44efd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_transformscreateorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package encodings - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TransformsCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *Transform -} - -// TransformsCreateOrUpdate ... -func (c EncodingsClient) TransformsCreateOrUpdate(ctx context.Context, id TransformId, input Transform) (result TransformsCreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForTransformsCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTransformsCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTransformsCreateOrUpdate prepares the TransformsCreateOrUpdate request. -func (c EncodingsClient) preparerForTransformsCreateOrUpdate(ctx context.Context, id TransformId, input Transform) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTransformsCreateOrUpdate handles the response to the TransformsCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c EncodingsClient) responderForTransformsCreateOrUpdate(resp *http.Response) (result TransformsCreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_transformsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_transformsdelete_autorest.go deleted file mode 100644 index 8274e081fae4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_transformsdelete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package encodings - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TransformsDeleteOperationResponse struct { - HttpResponse *http.Response -} - -// TransformsDelete ... -func (c EncodingsClient) TransformsDelete(ctx context.Context, id TransformId) (result TransformsDeleteOperationResponse, err error) { - req, err := c.preparerForTransformsDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTransformsDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTransformsDelete prepares the TransformsDelete request. -func (c EncodingsClient) preparerForTransformsDelete(ctx context.Context, id TransformId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTransformsDelete handles the response to the TransformsDelete request. The method always -// closes the http.Response Body. -func (c EncodingsClient) responderForTransformsDelete(resp *http.Response) (result TransformsDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_transformsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_transformsget_autorest.go deleted file mode 100644 index bc26739986bc..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_transformsget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package encodings - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TransformsGetOperationResponse struct { - HttpResponse *http.Response - Model *Transform -} - -// TransformsGet ... -func (c EncodingsClient) TransformsGet(ctx context.Context, id TransformId) (result TransformsGetOperationResponse, err error) { - req, err := c.preparerForTransformsGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTransformsGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTransformsGet prepares the TransformsGet request. -func (c EncodingsClient) preparerForTransformsGet(ctx context.Context, id TransformId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTransformsGet handles the response to the TransformsGet request. The method always -// closes the http.Response Body. -func (c EncodingsClient) responderForTransformsGet(resp *http.Response) (result TransformsGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_transformslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_transformslist_autorest.go deleted file mode 100644 index 3d99c17b2a6e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_transformslist_autorest.go +++ /dev/null @@ -1,220 +0,0 @@ -package encodings - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TransformsListOperationResponse struct { - HttpResponse *http.Response - Model *[]Transform - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (TransformsListOperationResponse, error) -} - -type TransformsListCompleteResult struct { - Items []Transform -} - -func (r TransformsListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r TransformsListOperationResponse) LoadMore(ctx context.Context) (resp TransformsListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type TransformsListOperationOptions struct { - Filter *string - Orderby *string -} - -func DefaultTransformsListOperationOptions() TransformsListOperationOptions { - return TransformsListOperationOptions{} -} - -func (o TransformsListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o TransformsListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - return out -} - -// TransformsList ... -func (c EncodingsClient) TransformsList(ctx context.Context, id MediaServiceId, options TransformsListOperationOptions) (resp TransformsListOperationResponse, err error) { - req, err := c.preparerForTransformsList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForTransformsList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForTransformsList prepares the TransformsList request. -func (c EncodingsClient) preparerForTransformsList(ctx context.Context, id MediaServiceId, options TransformsListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/transforms", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForTransformsListWithNextLink prepares the TransformsList request with the given nextLink token. -func (c EncodingsClient) preparerForTransformsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTransformsList handles the response to the TransformsList request. The method always -// closes the http.Response Body. -func (c EncodingsClient) responderForTransformsList(resp *http.Response) (result TransformsListOperationResponse, err error) { - type page struct { - Values []Transform `json:"value"` - NextLink *string `json:"@odata.nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result TransformsListOperationResponse, err error) { - req, err := c.preparerForTransformsListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTransformsList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// TransformsListComplete retrieves all of the results into a single object -func (c EncodingsClient) TransformsListComplete(ctx context.Context, id MediaServiceId, options TransformsListOperationOptions) (TransformsListCompleteResult, error) { - return c.TransformsListCompleteMatchingPredicate(ctx, id, options, TransformOperationPredicate{}) -} - -// TransformsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c EncodingsClient) TransformsListCompleteMatchingPredicate(ctx context.Context, id MediaServiceId, options TransformsListOperationOptions, predicate TransformOperationPredicate) (resp TransformsListCompleteResult, err error) { - items := make([]Transform, 0) - - page, err := c.TransformsList(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := TransformsListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_transformsupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_transformsupdate_autorest.go deleted file mode 100644 index a8d95cc3b770..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/method_transformsupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package encodings - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TransformsUpdateOperationResponse struct { - HttpResponse *http.Response - Model *Transform -} - -// TransformsUpdate ... -func (c EncodingsClient) TransformsUpdate(ctx context.Context, id TransformId, input Transform) (result TransformsUpdateOperationResponse, err error) { - req, err := c.preparerForTransformsUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForTransformsUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "encodings.EncodingsClient", "TransformsUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForTransformsUpdate prepares the TransformsUpdate request. -func (c EncodingsClient) preparerForTransformsUpdate(ctx context.Context, id TransformId, input Transform) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForTransformsUpdate handles the response to the TransformsUpdate request. The method always -// closes the http.Response Body. -func (c EncodingsClient) responderForTransformsUpdate(resp *http.Response) (result TransformsUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_aacaudio.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_aacaudio.go deleted file mode 100644 index 067403385aed..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_aacaudio.go +++ /dev/null @@ -1,45 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Codec = AacAudio{} - -type AacAudio struct { - Bitrate *int64 `json:"bitrate,omitempty"` - Channels *int64 `json:"channels,omitempty"` - Profile *AacAudioProfile `json:"profile,omitempty"` - SamplingRate *int64 `json:"samplingRate,omitempty"` - - // Fields inherited from Codec - Label *string `json:"label,omitempty"` -} - -var _ json.Marshaler = AacAudio{} - -func (s AacAudio) MarshalJSON() ([]byte, error) { - type wrapper AacAudio - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AacAudio: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AacAudio: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.AacAudio" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AacAudio: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_absolutecliptime.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_absolutecliptime.go deleted file mode 100644 index e1e8cedcd10b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_absolutecliptime.go +++ /dev/null @@ -1,41 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ClipTime = AbsoluteClipTime{} - -type AbsoluteClipTime struct { - Time string `json:"time"` - - // Fields inherited from ClipTime -} - -var _ json.Marshaler = AbsoluteClipTime{} - -func (s AbsoluteClipTime) MarshalJSON() ([]byte, error) { - type wrapper AbsoluteClipTime - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AbsoluteClipTime: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AbsoluteClipTime: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.AbsoluteClipTime" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AbsoluteClipTime: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_audio.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_audio.go deleted file mode 100644 index a2007b0056c5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_audio.go +++ /dev/null @@ -1,44 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Codec = Audio{} - -type Audio struct { - Bitrate *int64 `json:"bitrate,omitempty"` - Channels *int64 `json:"channels,omitempty"` - SamplingRate *int64 `json:"samplingRate,omitempty"` - - // Fields inherited from Codec - Label *string `json:"label,omitempty"` -} - -var _ json.Marshaler = Audio{} - -func (s Audio) MarshalJSON() ([]byte, error) { - type wrapper Audio - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling Audio: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling Audio: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.Audio" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling Audio: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_audioanalyzerpreset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_audioanalyzerpreset.go deleted file mode 100644 index 45a7be9a1c1e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_audioanalyzerpreset.go +++ /dev/null @@ -1,43 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Preset = AudioAnalyzerPreset{} - -type AudioAnalyzerPreset struct { - AudioLanguage *string `json:"audioLanguage,omitempty"` - ExperimentalOptions *map[string]string `json:"experimentalOptions,omitempty"` - Mode *AudioAnalysisMode `json:"mode,omitempty"` - - // Fields inherited from Preset -} - -var _ json.Marshaler = AudioAnalyzerPreset{} - -func (s AudioAnalyzerPreset) MarshalJSON() ([]byte, error) { - type wrapper AudioAnalyzerPreset - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AudioAnalyzerPreset: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AudioAnalyzerPreset: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.AudioAnalyzerPreset" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AudioAnalyzerPreset: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_audiooverlay.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_audiooverlay.go deleted file mode 100644 index 3d21e6aeb171..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_audiooverlay.go +++ /dev/null @@ -1,46 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Overlay = AudioOverlay{} - -type AudioOverlay struct { - - // Fields inherited from Overlay - AudioGainLevel *float64 `json:"audioGainLevel,omitempty"` - End *string `json:"end,omitempty"` - FadeInDuration *string `json:"fadeInDuration,omitempty"` - FadeOutDuration *string `json:"fadeOutDuration,omitempty"` - InputLabel string `json:"inputLabel"` - Start *string `json:"start,omitempty"` -} - -var _ json.Marshaler = AudioOverlay{} - -func (s AudioOverlay) MarshalJSON() ([]byte, error) { - type wrapper AudioOverlay - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AudioOverlay: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AudioOverlay: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.AudioOverlay" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AudioOverlay: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_audiotrackdescriptor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_audiotrackdescriptor.go deleted file mode 100644 index 81990a6d7d23..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_audiotrackdescriptor.go +++ /dev/null @@ -1,41 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ TrackDescriptor = AudioTrackDescriptor{} - -type AudioTrackDescriptor struct { - ChannelMapping *ChannelMapping `json:"channelMapping,omitempty"` - - // Fields inherited from TrackDescriptor -} - -var _ json.Marshaler = AudioTrackDescriptor{} - -func (s AudioTrackDescriptor) MarshalJSON() ([]byte, error) { - type wrapper AudioTrackDescriptor - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AudioTrackDescriptor: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AudioTrackDescriptor: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.AudioTrackDescriptor" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AudioTrackDescriptor: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_builtinstandardencoderpreset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_builtinstandardencoderpreset.go deleted file mode 100644 index c6b6272a3b40..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_builtinstandardencoderpreset.go +++ /dev/null @@ -1,41 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Preset = BuiltInStandardEncoderPreset{} - -type BuiltInStandardEncoderPreset struct { - PresetName EncoderNamedPreset `json:"presetName"` - - // Fields inherited from Preset -} - -var _ json.Marshaler = BuiltInStandardEncoderPreset{} - -func (s BuiltInStandardEncoderPreset) MarshalJSON() ([]byte, error) { - type wrapper BuiltInStandardEncoderPreset - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling BuiltInStandardEncoderPreset: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling BuiltInStandardEncoderPreset: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.BuiltInStandardEncoderPreset" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling BuiltInStandardEncoderPreset: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_cliptime.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_cliptime.go deleted file mode 100644 index 603c023e1fee..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_cliptime.go +++ /dev/null @@ -1,56 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ClipTime interface { -} - -func unmarshalClipTimeImplementation(input []byte) (ClipTime, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling ClipTime into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.AbsoluteClipTime") { - var out AbsoluteClipTime - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AbsoluteClipTime: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.UtcClipTime") { - var out UtcClipTime - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into UtcClipTime: %+v", err) - } - return out, nil - } - - type RawClipTimeImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawClipTimeImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_codec.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_codec.go deleted file mode 100644 index e6b4e8d4d36d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_codec.go +++ /dev/null @@ -1,104 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Codec interface { -} - -func unmarshalCodecImplementation(input []byte) (Codec, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling Codec into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.AacAudio") { - var out AacAudio - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AacAudio: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.Audio") { - var out Audio - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into Audio: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.CopyAudio") { - var out CopyAudio - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into CopyAudio: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.CopyVideo") { - var out CopyVideo - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into CopyVideo: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.H264Video") { - var out H264Video - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into H264Video: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.H265Video") { - var out H265Video - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into H265Video: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.Image") { - var out Image - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into Image: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.Video") { - var out Video - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into Video: %+v", err) - } - return out, nil - } - - type RawCodecImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawCodecImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_copyaudio.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_copyaudio.go deleted file mode 100644 index 5d1be89597ee..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_copyaudio.go +++ /dev/null @@ -1,41 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Codec = CopyAudio{} - -type CopyAudio struct { - - // Fields inherited from Codec - Label *string `json:"label,omitempty"` -} - -var _ json.Marshaler = CopyAudio{} - -func (s CopyAudio) MarshalJSON() ([]byte, error) { - type wrapper CopyAudio - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling CopyAudio: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling CopyAudio: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.CopyAudio" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling CopyAudio: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_copyvideo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_copyvideo.go deleted file mode 100644 index 5f663b6d2bfe..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_copyvideo.go +++ /dev/null @@ -1,41 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Codec = CopyVideo{} - -type CopyVideo struct { - - // Fields inherited from Codec - Label *string `json:"label,omitempty"` -} - -var _ json.Marshaler = CopyVideo{} - -func (s CopyVideo) MarshalJSON() ([]byte, error) { - type wrapper CopyVideo - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling CopyVideo: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling CopyVideo: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.CopyVideo" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling CopyVideo: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_deinterlace.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_deinterlace.go deleted file mode 100644 index e32750ed4a71..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_deinterlace.go +++ /dev/null @@ -1,9 +0,0 @@ -package encodings - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Deinterlace struct { - Mode *DeinterlaceMode `json:"mode,omitempty"` - Parity *DeinterlaceParity `json:"parity,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_facedetectorpreset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_facedetectorpreset.go deleted file mode 100644 index b6b9b66de46c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_facedetectorpreset.go +++ /dev/null @@ -1,44 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Preset = FaceDetectorPreset{} - -type FaceDetectorPreset struct { - BlurType *BlurType `json:"blurType,omitempty"` - ExperimentalOptions *map[string]string `json:"experimentalOptions,omitempty"` - Mode *FaceRedactorMode `json:"mode,omitempty"` - Resolution *AnalysisResolution `json:"resolution,omitempty"` - - // Fields inherited from Preset -} - -var _ json.Marshaler = FaceDetectorPreset{} - -func (s FaceDetectorPreset) MarshalJSON() ([]byte, error) { - type wrapper FaceDetectorPreset - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling FaceDetectorPreset: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling FaceDetectorPreset: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.FaceDetectorPreset" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling FaceDetectorPreset: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_filters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_filters.go deleted file mode 100644 index 4e50eaa91aef..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_filters.go +++ /dev/null @@ -1,53 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Filters struct { - Crop *Rectangle `json:"crop,omitempty"` - Deinterlace *Deinterlace `json:"deinterlace,omitempty"` - Overlays *[]Overlay `json:"overlays,omitempty"` - Rotation *Rotation `json:"rotation,omitempty"` -} - -var _ json.Unmarshaler = &Filters{} - -func (s *Filters) UnmarshalJSON(bytes []byte) error { - type alias Filters - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into Filters: %+v", err) - } - - s.Crop = decoded.Crop - s.Deinterlace = decoded.Deinterlace - s.Rotation = decoded.Rotation - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling Filters into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["overlays"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling Overlays into list []json.RawMessage: %+v", err) - } - - output := make([]Overlay, 0) - for i, val := range listTemp { - impl, err := unmarshalOverlayImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'Overlays' for 'Filters': %+v", i, err) - } - output = append(output, impl) - } - s.Overlays = &output - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_format.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_format.go deleted file mode 100644 index bc756a0bb288..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_format.go +++ /dev/null @@ -1,88 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Format interface { -} - -func unmarshalFormatImplementation(input []byte) (Format, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling Format into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.ImageFormat") { - var out ImageFormat - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ImageFormat: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.JpgFormat") { - var out JpgFormat - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into JpgFormat: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.Mp4Format") { - var out Mp4Format - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into Mp4Format: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.MultiBitrateFormat") { - var out MultiBitrateFormat - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into MultiBitrateFormat: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.PngFormat") { - var out PngFormat - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into PngFormat: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.TransportStreamFormat") { - var out TransportStreamFormat - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into TransportStreamFormat: %+v", err) - } - return out, nil - } - - type RawFormatImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawFormatImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_fromallinputfile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_fromallinputfile.go deleted file mode 100644 index c1a7d3860e4b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_fromallinputfile.go +++ /dev/null @@ -1,69 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ InputDefinition = FromAllInputFile{} - -type FromAllInputFile struct { - - // Fields inherited from InputDefinition - IncludedTracks *[]TrackDescriptor `json:"includedTracks,omitempty"` -} - -var _ json.Marshaler = FromAllInputFile{} - -func (s FromAllInputFile) MarshalJSON() ([]byte, error) { - type wrapper FromAllInputFile - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling FromAllInputFile: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling FromAllInputFile: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.FromAllInputFile" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling FromAllInputFile: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &FromAllInputFile{} - -func (s *FromAllInputFile) UnmarshalJSON(bytes []byte) error { - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling FromAllInputFile into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["includedTracks"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling IncludedTracks into list []json.RawMessage: %+v", err) - } - - output := make([]TrackDescriptor, 0) - for i, val := range listTemp { - impl, err := unmarshalTrackDescriptorImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'IncludedTracks' for 'FromAllInputFile': %+v", i, err) - } - output = append(output, impl) - } - s.IncludedTracks = &output - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_fromeachinputfile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_fromeachinputfile.go deleted file mode 100644 index 02137a86e8ad..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_fromeachinputfile.go +++ /dev/null @@ -1,69 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ InputDefinition = FromEachInputFile{} - -type FromEachInputFile struct { - - // Fields inherited from InputDefinition - IncludedTracks *[]TrackDescriptor `json:"includedTracks,omitempty"` -} - -var _ json.Marshaler = FromEachInputFile{} - -func (s FromEachInputFile) MarshalJSON() ([]byte, error) { - type wrapper FromEachInputFile - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling FromEachInputFile: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling FromEachInputFile: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.FromEachInputFile" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling FromEachInputFile: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &FromEachInputFile{} - -func (s *FromEachInputFile) UnmarshalJSON(bytes []byte) error { - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling FromEachInputFile into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["includedTracks"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling IncludedTracks into list []json.RawMessage: %+v", err) - } - - output := make([]TrackDescriptor, 0) - for i, val := range listTemp { - impl, err := unmarshalTrackDescriptorImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'IncludedTracks' for 'FromEachInputFile': %+v", i, err) - } - output = append(output, impl) - } - s.IncludedTracks = &output - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_h264layer.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_h264layer.go deleted file mode 100644 index ba82bc3392e1..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_h264layer.go +++ /dev/null @@ -1,54 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Layer = H264Layer{} - -type H264Layer struct { - AdaptiveBFrame *bool `json:"adaptiveBFrame,omitempty"` - BFrames *int64 `json:"bFrames,omitempty"` - Bitrate int64 `json:"bitrate"` - BufferWindow *string `json:"bufferWindow,omitempty"` - EntropyMode *EntropyMode `json:"entropyMode,omitempty"` - FrameRate *string `json:"frameRate,omitempty"` - Level *string `json:"level,omitempty"` - MaxBitrate *int64 `json:"maxBitrate,omitempty"` - Profile *H264VideoProfile `json:"profile,omitempty"` - ReferenceFrames *int64 `json:"referenceFrames,omitempty"` - Slices *int64 `json:"slices,omitempty"` - - // Fields inherited from Layer - Height *string `json:"height,omitempty"` - Label *string `json:"label,omitempty"` - Width *string `json:"width,omitempty"` -} - -var _ json.Marshaler = H264Layer{} - -func (s H264Layer) MarshalJSON() ([]byte, error) { - type wrapper H264Layer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling H264Layer: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling H264Layer: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.H264Layer" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling H264Layer: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_h264video.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_h264video.go deleted file mode 100644 index 274ea9f8f855..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_h264video.go +++ /dev/null @@ -1,87 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Codec = H264Video{} - -type H264Video struct { - Complexity *H264Complexity `json:"complexity,omitempty"` - KeyFrameInterval *string `json:"keyFrameInterval,omitempty"` - Layers *[]Layer `json:"layers,omitempty"` - SceneChangeDetection *bool `json:"sceneChangeDetection,omitempty"` - StretchMode *StretchMode `json:"stretchMode,omitempty"` - SyncMode *VideoSyncMode `json:"syncMode,omitempty"` - - // Fields inherited from Codec - Label *string `json:"label,omitempty"` -} - -var _ json.Marshaler = H264Video{} - -func (s H264Video) MarshalJSON() ([]byte, error) { - type wrapper H264Video - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling H264Video: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling H264Video: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.H264Video" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling H264Video: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &H264Video{} - -func (s *H264Video) UnmarshalJSON(bytes []byte) error { - type alias H264Video - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into H264Video: %+v", err) - } - - s.Complexity = decoded.Complexity - s.KeyFrameInterval = decoded.KeyFrameInterval - s.Label = decoded.Label - s.SceneChangeDetection = decoded.SceneChangeDetection - s.StretchMode = decoded.StretchMode - s.SyncMode = decoded.SyncMode - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling H264Video into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["layers"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling Layers into list []json.RawMessage: %+v", err) - } - - output := make([]Layer, 0) - for i, val := range listTemp { - impl, err := unmarshalLayerImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'Layers' for 'H264Video': %+v", i, err) - } - output = append(output, impl) - } - s.Layers = &output - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_h265layer.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_h265layer.go deleted file mode 100644 index e220a0697e2e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_h265layer.go +++ /dev/null @@ -1,53 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Layer = H265Layer{} - -type H265Layer struct { - AdaptiveBFrame *bool `json:"adaptiveBFrame,omitempty"` - BFrames *int64 `json:"bFrames,omitempty"` - Bitrate int64 `json:"bitrate"` - BufferWindow *string `json:"bufferWindow,omitempty"` - FrameRate *string `json:"frameRate,omitempty"` - Level *string `json:"level,omitempty"` - MaxBitrate *int64 `json:"maxBitrate,omitempty"` - Profile *H265VideoProfile `json:"profile,omitempty"` - ReferenceFrames *int64 `json:"referenceFrames,omitempty"` - Slices *int64 `json:"slices,omitempty"` - - // Fields inherited from Layer - Height *string `json:"height,omitempty"` - Label *string `json:"label,omitempty"` - Width *string `json:"width,omitempty"` -} - -var _ json.Marshaler = H265Layer{} - -func (s H265Layer) MarshalJSON() ([]byte, error) { - type wrapper H265Layer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling H265Layer: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling H265Layer: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.H265Layer" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling H265Layer: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_h265video.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_h265video.go deleted file mode 100644 index 12634d3d480b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_h265video.go +++ /dev/null @@ -1,87 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Codec = H265Video{} - -type H265Video struct { - Complexity *H265Complexity `json:"complexity,omitempty"` - KeyFrameInterval *string `json:"keyFrameInterval,omitempty"` - Layers *[]Layer `json:"layers,omitempty"` - SceneChangeDetection *bool `json:"sceneChangeDetection,omitempty"` - StretchMode *StretchMode `json:"stretchMode,omitempty"` - SyncMode *VideoSyncMode `json:"syncMode,omitempty"` - - // Fields inherited from Codec - Label *string `json:"label,omitempty"` -} - -var _ json.Marshaler = H265Video{} - -func (s H265Video) MarshalJSON() ([]byte, error) { - type wrapper H265Video - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling H265Video: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling H265Video: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.H265Video" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling H265Video: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &H265Video{} - -func (s *H265Video) UnmarshalJSON(bytes []byte) error { - type alias H265Video - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into H265Video: %+v", err) - } - - s.Complexity = decoded.Complexity - s.KeyFrameInterval = decoded.KeyFrameInterval - s.Label = decoded.Label - s.SceneChangeDetection = decoded.SceneChangeDetection - s.StretchMode = decoded.StretchMode - s.SyncMode = decoded.SyncMode - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling H265Video into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["layers"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling Layers into list []json.RawMessage: %+v", err) - } - - output := make([]Layer, 0) - for i, val := range listTemp { - impl, err := unmarshalLayerImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'Layers' for 'H265Video': %+v", i, err) - } - output = append(output, impl) - } - s.Layers = &output - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_h265videolayer.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_h265videolayer.go deleted file mode 100644 index b5c5769a610e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_h265videolayer.go +++ /dev/null @@ -1,49 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Layer = H265VideoLayer{} - -type H265VideoLayer struct { - AdaptiveBFrame *bool `json:"adaptiveBFrame,omitempty"` - BFrames *int64 `json:"bFrames,omitempty"` - Bitrate int64 `json:"bitrate"` - FrameRate *string `json:"frameRate,omitempty"` - MaxBitrate *int64 `json:"maxBitrate,omitempty"` - Slices *int64 `json:"slices,omitempty"` - - // Fields inherited from Layer - Height *string `json:"height,omitempty"` - Label *string `json:"label,omitempty"` - Width *string `json:"width,omitempty"` -} - -var _ json.Marshaler = H265VideoLayer{} - -func (s H265VideoLayer) MarshalJSON() ([]byte, error) { - type wrapper H265VideoLayer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling H265VideoLayer: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling H265VideoLayer: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.H265VideoLayer" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling H265VideoLayer: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_image.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_image.go deleted file mode 100644 index 072a1a7537e0..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_image.go +++ /dev/null @@ -1,47 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Codec = Image{} - -type Image struct { - KeyFrameInterval *string `json:"keyFrameInterval,omitempty"` - Range *string `json:"range,omitempty"` - Start string `json:"start"` - Step *string `json:"step,omitempty"` - StretchMode *StretchMode `json:"stretchMode,omitempty"` - SyncMode *VideoSyncMode `json:"syncMode,omitempty"` - - // Fields inherited from Codec - Label *string `json:"label,omitempty"` -} - -var _ json.Marshaler = Image{} - -func (s Image) MarshalJSON() ([]byte, error) { - type wrapper Image - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling Image: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling Image: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.Image" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling Image: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_imageformat.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_imageformat.go deleted file mode 100644 index 0e390a0c6f37..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_imageformat.go +++ /dev/null @@ -1,41 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Format = ImageFormat{} - -type ImageFormat struct { - - // Fields inherited from Format - FilenamePattern string `json:"filenamePattern"` -} - -var _ json.Marshaler = ImageFormat{} - -func (s ImageFormat) MarshalJSON() ([]byte, error) { - type wrapper ImageFormat - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ImageFormat: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ImageFormat: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.ImageFormat" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ImageFormat: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_inputdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_inputdefinition.go deleted file mode 100644 index bf5faf47a4c9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_inputdefinition.go +++ /dev/null @@ -1,64 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type InputDefinition interface { -} - -func unmarshalInputDefinitionImplementation(input []byte) (InputDefinition, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling InputDefinition into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.FromAllInputFile") { - var out FromAllInputFile - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into FromAllInputFile: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.FromEachInputFile") { - var out FromEachInputFile - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into FromEachInputFile: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.InputFile") { - var out InputFile - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into InputFile: %+v", err) - } - return out, nil - } - - type RawInputDefinitionImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawInputDefinitionImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_inputfile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_inputfile.go deleted file mode 100644 index 4c3f11b6d7f9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_inputfile.go +++ /dev/null @@ -1,77 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ InputDefinition = InputFile{} - -type InputFile struct { - Filename *string `json:"filename,omitempty"` - - // Fields inherited from InputDefinition - IncludedTracks *[]TrackDescriptor `json:"includedTracks,omitempty"` -} - -var _ json.Marshaler = InputFile{} - -func (s InputFile) MarshalJSON() ([]byte, error) { - type wrapper InputFile - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling InputFile: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling InputFile: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.InputFile" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling InputFile: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &InputFile{} - -func (s *InputFile) UnmarshalJSON(bytes []byte) error { - type alias InputFile - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into InputFile: %+v", err) - } - - s.Filename = decoded.Filename - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling InputFile into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["includedTracks"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling IncludedTracks into list []json.RawMessage: %+v", err) - } - - output := make([]TrackDescriptor, 0) - for i, val := range listTemp { - impl, err := unmarshalTrackDescriptorImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'IncludedTracks' for 'InputFile': %+v", i, err) - } - output = append(output, impl) - } - s.IncludedTracks = &output - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_job.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_job.go deleted file mode 100644 index db973712dda3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_job.go +++ /dev/null @@ -1,16 +0,0 @@ -package encodings - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Job struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *JobProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_joberror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_joberror.go deleted file mode 100644 index c14b785a690b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_joberror.go +++ /dev/null @@ -1,12 +0,0 @@ -package encodings - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type JobError struct { - Category *JobErrorCategory `json:"category,omitempty"` - Code *JobErrorCode `json:"code,omitempty"` - Details *[]JobErrorDetail `json:"details,omitempty"` - Message *string `json:"message,omitempty"` - Retry *JobRetry `json:"retry,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_joberrordetail.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_joberrordetail.go deleted file mode 100644 index 80595e90276a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_joberrordetail.go +++ /dev/null @@ -1,9 +0,0 @@ -package encodings - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type JobErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinput.go deleted file mode 100644 index e44a0cf5249b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinput.go +++ /dev/null @@ -1,80 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type JobInput interface { -} - -func unmarshalJobInputImplementation(input []byte) (JobInput, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling JobInput into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.JobInputAsset") { - var out JobInputAsset - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into JobInputAsset: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.JobInputClip") { - var out JobInputClip - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into JobInputClip: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.JobInputHttp") { - var out JobInputHTTP - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into JobInputHTTP: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.JobInputSequence") { - var out JobInputSequence - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into JobInputSequence: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.JobInputs") { - var out JobInputs - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into JobInputs: %+v", err) - } - return out, nil - } - - type RawJobInputImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawJobInputImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinputasset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinputasset.go deleted file mode 100644 index 689f8282884e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinputasset.go +++ /dev/null @@ -1,99 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ JobInput = JobInputAsset{} - -type JobInputAsset struct { - AssetName string `json:"assetName"` - End ClipTime `json:"end"` - Files *[]string `json:"files,omitempty"` - InputDefinitions *[]InputDefinition `json:"inputDefinitions,omitempty"` - Label *string `json:"label,omitempty"` - Start ClipTime `json:"start"` - - // Fields inherited from JobInput -} - -var _ json.Marshaler = JobInputAsset{} - -func (s JobInputAsset) MarshalJSON() ([]byte, error) { - type wrapper JobInputAsset - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling JobInputAsset: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling JobInputAsset: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.JobInputAsset" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling JobInputAsset: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &JobInputAsset{} - -func (s *JobInputAsset) UnmarshalJSON(bytes []byte) error { - type alias JobInputAsset - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into JobInputAsset: %+v", err) - } - - s.AssetName = decoded.AssetName - s.Files = decoded.Files - s.Label = decoded.Label - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling JobInputAsset into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["end"]; ok { - impl, err := unmarshalClipTimeImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'End' for 'JobInputAsset': %+v", err) - } - s.End = impl - } - - if v, ok := temp["inputDefinitions"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling InputDefinitions into list []json.RawMessage: %+v", err) - } - - output := make([]InputDefinition, 0) - for i, val := range listTemp { - impl, err := unmarshalInputDefinitionImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'InputDefinitions' for 'JobInputAsset': %+v", i, err) - } - output = append(output, impl) - } - s.InputDefinitions = &output - } - - if v, ok := temp["start"]; ok { - impl, err := unmarshalClipTimeImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'Start' for 'JobInputAsset': %+v", err) - } - s.Start = impl - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinputclip.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinputclip.go deleted file mode 100644 index 5136c539d5b3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinputclip.go +++ /dev/null @@ -1,97 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ JobInput = JobInputClip{} - -type JobInputClip struct { - End ClipTime `json:"end"` - Files *[]string `json:"files,omitempty"` - InputDefinitions *[]InputDefinition `json:"inputDefinitions,omitempty"` - Label *string `json:"label,omitempty"` - Start ClipTime `json:"start"` - - // Fields inherited from JobInput -} - -var _ json.Marshaler = JobInputClip{} - -func (s JobInputClip) MarshalJSON() ([]byte, error) { - type wrapper JobInputClip - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling JobInputClip: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling JobInputClip: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.JobInputClip" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling JobInputClip: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &JobInputClip{} - -func (s *JobInputClip) UnmarshalJSON(bytes []byte) error { - type alias JobInputClip - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into JobInputClip: %+v", err) - } - - s.Files = decoded.Files - s.Label = decoded.Label - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling JobInputClip into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["end"]; ok { - impl, err := unmarshalClipTimeImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'End' for 'JobInputClip': %+v", err) - } - s.End = impl - } - - if v, ok := temp["inputDefinitions"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling InputDefinitions into list []json.RawMessage: %+v", err) - } - - output := make([]InputDefinition, 0) - for i, val := range listTemp { - impl, err := unmarshalInputDefinitionImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'InputDefinitions' for 'JobInputClip': %+v", i, err) - } - output = append(output, impl) - } - s.InputDefinitions = &output - } - - if v, ok := temp["start"]; ok { - impl, err := unmarshalClipTimeImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'Start' for 'JobInputClip': %+v", err) - } - s.Start = impl - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinputhttp.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinputhttp.go deleted file mode 100644 index 57beddd3fde4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinputhttp.go +++ /dev/null @@ -1,99 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ JobInput = JobInputHTTP{} - -type JobInputHTTP struct { - BaseUri *string `json:"baseUri,omitempty"` - End ClipTime `json:"end"` - Files *[]string `json:"files,omitempty"` - InputDefinitions *[]InputDefinition `json:"inputDefinitions,omitempty"` - Label *string `json:"label,omitempty"` - Start ClipTime `json:"start"` - - // Fields inherited from JobInput -} - -var _ json.Marshaler = JobInputHTTP{} - -func (s JobInputHTTP) MarshalJSON() ([]byte, error) { - type wrapper JobInputHTTP - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling JobInputHTTP: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling JobInputHTTP: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.JobInputHttp" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling JobInputHTTP: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &JobInputHTTP{} - -func (s *JobInputHTTP) UnmarshalJSON(bytes []byte) error { - type alias JobInputHTTP - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into JobInputHTTP: %+v", err) - } - - s.BaseUri = decoded.BaseUri - s.Files = decoded.Files - s.Label = decoded.Label - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling JobInputHTTP into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["end"]; ok { - impl, err := unmarshalClipTimeImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'End' for 'JobInputHTTP': %+v", err) - } - s.End = impl - } - - if v, ok := temp["inputDefinitions"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling InputDefinitions into list []json.RawMessage: %+v", err) - } - - output := make([]InputDefinition, 0) - for i, val := range listTemp { - impl, err := unmarshalInputDefinitionImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'InputDefinitions' for 'JobInputHTTP': %+v", i, err) - } - output = append(output, impl) - } - s.InputDefinitions = &output - } - - if v, ok := temp["start"]; ok { - impl, err := unmarshalClipTimeImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'Start' for 'JobInputHTTP': %+v", err) - } - s.Start = impl - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinputs.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinputs.go deleted file mode 100644 index b63a141b6e04..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinputs.go +++ /dev/null @@ -1,69 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ JobInput = JobInputs{} - -type JobInputs struct { - Inputs *[]JobInput `json:"inputs,omitempty"` - - // Fields inherited from JobInput -} - -var _ json.Marshaler = JobInputs{} - -func (s JobInputs) MarshalJSON() ([]byte, error) { - type wrapper JobInputs - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling JobInputs: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling JobInputs: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.JobInputs" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling JobInputs: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &JobInputs{} - -func (s *JobInputs) UnmarshalJSON(bytes []byte) error { - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling JobInputs into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["inputs"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling Inputs into list []json.RawMessage: %+v", err) - } - - output := make([]JobInput, 0) - for i, val := range listTemp { - impl, err := unmarshalJobInputImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'Inputs' for 'JobInputs': %+v", i, err) - } - output = append(output, impl) - } - s.Inputs = &output - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinputsequence.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinputsequence.go deleted file mode 100644 index 1d87ba0ce471..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobinputsequence.go +++ /dev/null @@ -1,69 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ JobInput = JobInputSequence{} - -type JobInputSequence struct { - Inputs *[]JobInput `json:"inputs,omitempty"` - - // Fields inherited from JobInput -} - -var _ json.Marshaler = JobInputSequence{} - -func (s JobInputSequence) MarshalJSON() ([]byte, error) { - type wrapper JobInputSequence - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling JobInputSequence: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling JobInputSequence: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.JobInputSequence" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling JobInputSequence: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &JobInputSequence{} - -func (s *JobInputSequence) UnmarshalJSON(bytes []byte) error { - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling JobInputSequence into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["inputs"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling Inputs into list []json.RawMessage: %+v", err) - } - - output := make([]JobInput, 0) - for i, val := range listTemp { - impl, err := unmarshalJobInputImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'Inputs' for 'JobInputSequence': %+v", i, err) - } - output = append(output, impl) - } - s.Inputs = &output - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_joboutput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_joboutput.go deleted file mode 100644 index 39bd27d30410..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_joboutput.go +++ /dev/null @@ -1,48 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type JobOutput interface { -} - -func unmarshalJobOutputImplementation(input []byte) (JobOutput, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling JobOutput into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.JobOutputAsset") { - var out JobOutputAsset - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into JobOutputAsset: %+v", err) - } - return out, nil - } - - type RawJobOutputImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawJobOutputImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_joboutputasset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_joboutputasset.go deleted file mode 100644 index 394018024032..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_joboutputasset.go +++ /dev/null @@ -1,74 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ JobOutput = JobOutputAsset{} - -type JobOutputAsset struct { - AssetName string `json:"assetName"` - - // Fields inherited from JobOutput - EndTime *string `json:"endTime,omitempty"` - Error *JobError `json:"error,omitempty"` - Label *string `json:"label,omitempty"` - Progress *int64 `json:"progress,omitempty"` - StartTime *string `json:"startTime,omitempty"` - State *JobState `json:"state,omitempty"` -} - -func (o *JobOutputAsset) GetEndTimeAsTime() (*time.Time, error) { - if o.EndTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") -} - -func (o *JobOutputAsset) SetEndTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.EndTime = &formatted -} - -func (o *JobOutputAsset) GetStartTimeAsTime() (*time.Time, error) { - if o.StartTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") -} - -func (o *JobOutputAsset) SetStartTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.StartTime = &formatted -} - -var _ json.Marshaler = JobOutputAsset{} - -func (s JobOutputAsset) MarshalJSON() ([]byte, error) { - type wrapper JobOutputAsset - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling JobOutputAsset: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling JobOutputAsset: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.JobOutputAsset" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling JobOutputAsset: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobproperties.go deleted file mode 100644 index d1d9fcd58d52..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jobproperties.go +++ /dev/null @@ -1,123 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type JobProperties struct { - CorrelationData *map[string]string `json:"correlationData,omitempty"` - Created *string `json:"created,omitempty"` - Description *string `json:"description,omitempty"` - EndTime *string `json:"endTime,omitempty"` - Input JobInput `json:"input"` - LastModified *string `json:"lastModified,omitempty"` - Outputs []JobOutput `json:"outputs"` - Priority *Priority `json:"priority,omitempty"` - StartTime *string `json:"startTime,omitempty"` - State *JobState `json:"state,omitempty"` -} - -func (o *JobProperties) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *JobProperties) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} - -func (o *JobProperties) GetEndTimeAsTime() (*time.Time, error) { - if o.EndTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") -} - -func (o *JobProperties) SetEndTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.EndTime = &formatted -} - -func (o *JobProperties) GetLastModifiedAsTime() (*time.Time, error) { - if o.LastModified == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModified, "2006-01-02T15:04:05Z07:00") -} - -func (o *JobProperties) SetLastModifiedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModified = &formatted -} - -func (o *JobProperties) GetStartTimeAsTime() (*time.Time, error) { - if o.StartTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") -} - -func (o *JobProperties) SetStartTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.StartTime = &formatted -} - -var _ json.Unmarshaler = &JobProperties{} - -func (s *JobProperties) UnmarshalJSON(bytes []byte) error { - type alias JobProperties - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into JobProperties: %+v", err) - } - - s.CorrelationData = decoded.CorrelationData - s.Created = decoded.Created - s.Description = decoded.Description - s.EndTime = decoded.EndTime - s.LastModified = decoded.LastModified - s.Priority = decoded.Priority - s.StartTime = decoded.StartTime - s.State = decoded.State - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling JobProperties into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["input"]; ok { - impl, err := unmarshalJobInputImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'Input' for 'JobProperties': %+v", err) - } - s.Input = impl - } - - if v, ok := temp["outputs"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling Outputs into list []json.RawMessage: %+v", err) - } - - output := make([]JobOutput, 0) - for i, val := range listTemp { - impl, err := unmarshalJobOutputImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'Outputs' for 'JobProperties': %+v", i, err) - } - output = append(output, impl) - } - s.Outputs = output - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jpgformat.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jpgformat.go deleted file mode 100644 index de3e7aba6df3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jpgformat.go +++ /dev/null @@ -1,41 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Format = JpgFormat{} - -type JpgFormat struct { - - // Fields inherited from Format - FilenamePattern string `json:"filenamePattern"` -} - -var _ json.Marshaler = JpgFormat{} - -func (s JpgFormat) MarshalJSON() ([]byte, error) { - type wrapper JpgFormat - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling JpgFormat: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling JpgFormat: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.JpgFormat" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling JpgFormat: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jpglayer.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jpglayer.go deleted file mode 100644 index 16df6ebf24af..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_jpglayer.go +++ /dev/null @@ -1,44 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Layer = JpgLayer{} - -type JpgLayer struct { - Quality *int64 `json:"quality,omitempty"` - - // Fields inherited from Layer - Height *string `json:"height,omitempty"` - Label *string `json:"label,omitempty"` - Width *string `json:"width,omitempty"` -} - -var _ json.Marshaler = JpgLayer{} - -func (s JpgLayer) MarshalJSON() ([]byte, error) { - type wrapper JpgLayer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling JpgLayer: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling JpgLayer: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.JpgLayer" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling JpgLayer: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_layer.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_layer.go deleted file mode 100644 index ab5566e3fa11..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_layer.go +++ /dev/null @@ -1,88 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Layer interface { -} - -func unmarshalLayerImplementation(input []byte) (Layer, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling Layer into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.H264Layer") { - var out H264Layer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into H264Layer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.H265Layer") { - var out H265Layer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into H265Layer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.H265VideoLayer") { - var out H265VideoLayer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into H265VideoLayer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.JpgLayer") { - var out JpgLayer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into JpgLayer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.PngLayer") { - var out PngLayer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into PngLayer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.VideoLayer") { - var out VideoLayer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into VideoLayer: %+v", err) - } - return out, nil - } - - type RawLayerImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawLayerImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_mp4format.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_mp4format.go deleted file mode 100644 index 44e41dd94921..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_mp4format.go +++ /dev/null @@ -1,42 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Format = Mp4Format{} - -type Mp4Format struct { - OutputFiles *[]OutputFile `json:"outputFiles,omitempty"` - - // Fields inherited from Format - FilenamePattern string `json:"filenamePattern"` -} - -var _ json.Marshaler = Mp4Format{} - -func (s Mp4Format) MarshalJSON() ([]byte, error) { - type wrapper Mp4Format - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling Mp4Format: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling Mp4Format: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.Mp4Format" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling Mp4Format: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_multibitrateformat.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_multibitrateformat.go deleted file mode 100644 index fec53d0e6804..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_multibitrateformat.go +++ /dev/null @@ -1,42 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Format = MultiBitrateFormat{} - -type MultiBitrateFormat struct { - OutputFiles *[]OutputFile `json:"outputFiles,omitempty"` - - // Fields inherited from Format - FilenamePattern string `json:"filenamePattern"` -} - -var _ json.Marshaler = MultiBitrateFormat{} - -func (s MultiBitrateFormat) MarshalJSON() ([]byte, error) { - type wrapper MultiBitrateFormat - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling MultiBitrateFormat: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling MultiBitrateFormat: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.MultiBitrateFormat" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling MultiBitrateFormat: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_outputfile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_outputfile.go deleted file mode 100644 index e83b5bdb27f2..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_outputfile.go +++ /dev/null @@ -1,8 +0,0 @@ -package encodings - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type OutputFile struct { - Labels []string `json:"labels"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_overlay.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_overlay.go deleted file mode 100644 index 0b3ec59cc8ac..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_overlay.go +++ /dev/null @@ -1,56 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Overlay interface { -} - -func unmarshalOverlayImplementation(input []byte) (Overlay, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling Overlay into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.AudioOverlay") { - var out AudioOverlay - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AudioOverlay: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.VideoOverlay") { - var out VideoOverlay - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into VideoOverlay: %+v", err) - } - return out, nil - } - - type RawOverlayImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawOverlayImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_pngformat.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_pngformat.go deleted file mode 100644 index e9b5216bb869..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_pngformat.go +++ /dev/null @@ -1,41 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Format = PngFormat{} - -type PngFormat struct { - - // Fields inherited from Format - FilenamePattern string `json:"filenamePattern"` -} - -var _ json.Marshaler = PngFormat{} - -func (s PngFormat) MarshalJSON() ([]byte, error) { - type wrapper PngFormat - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling PngFormat: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling PngFormat: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.PngFormat" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling PngFormat: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_pnglayer.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_pnglayer.go deleted file mode 100644 index 73748bf8fa17..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_pnglayer.go +++ /dev/null @@ -1,43 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Layer = PngLayer{} - -type PngLayer struct { - - // Fields inherited from Layer - Height *string `json:"height,omitempty"` - Label *string `json:"label,omitempty"` - Width *string `json:"width,omitempty"` -} - -var _ json.Marshaler = PngLayer{} - -func (s PngLayer) MarshalJSON() ([]byte, error) { - type wrapper PngLayer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling PngLayer: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling PngLayer: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.PngLayer" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling PngLayer: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_preset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_preset.go deleted file mode 100644 index dd860f8e9813..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_preset.go +++ /dev/null @@ -1,80 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Preset interface { -} - -func unmarshalPresetImplementation(input []byte) (Preset, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling Preset into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.AudioAnalyzerPreset") { - var out AudioAnalyzerPreset - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AudioAnalyzerPreset: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.BuiltInStandardEncoderPreset") { - var out BuiltInStandardEncoderPreset - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into BuiltInStandardEncoderPreset: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.FaceDetectorPreset") { - var out FaceDetectorPreset - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into FaceDetectorPreset: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.StandardEncoderPreset") { - var out StandardEncoderPreset - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into StandardEncoderPreset: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.VideoAnalyzerPreset") { - var out VideoAnalyzerPreset - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into VideoAnalyzerPreset: %+v", err) - } - return out, nil - } - - type RawPresetImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawPresetImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_rectangle.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_rectangle.go deleted file mode 100644 index 09b1ba538a97..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_rectangle.go +++ /dev/null @@ -1,11 +0,0 @@ -package encodings - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Rectangle struct { - Height *string `json:"height,omitempty"` - Left *string `json:"left,omitempty"` - Top *string `json:"top,omitempty"` - Width *string `json:"width,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_selectaudiotrackbyattribute.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_selectaudiotrackbyattribute.go deleted file mode 100644 index ae6bafef5035..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_selectaudiotrackbyattribute.go +++ /dev/null @@ -1,44 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ TrackDescriptor = SelectAudioTrackByAttribute{} - -type SelectAudioTrackByAttribute struct { - Attribute TrackAttribute `json:"attribute"` - ChannelMapping *ChannelMapping `json:"channelMapping,omitempty"` - Filter AttributeFilter `json:"filter"` - FilterValue *string `json:"filterValue,omitempty"` - - // Fields inherited from TrackDescriptor -} - -var _ json.Marshaler = SelectAudioTrackByAttribute{} - -func (s SelectAudioTrackByAttribute) MarshalJSON() ([]byte, error) { - type wrapper SelectAudioTrackByAttribute - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling SelectAudioTrackByAttribute: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling SelectAudioTrackByAttribute: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.SelectAudioTrackByAttribute" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling SelectAudioTrackByAttribute: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_selectaudiotrackbyid.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_selectaudiotrackbyid.go deleted file mode 100644 index e9b4587be0c3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_selectaudiotrackbyid.go +++ /dev/null @@ -1,42 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ TrackDescriptor = SelectAudioTrackById{} - -type SelectAudioTrackById struct { - ChannelMapping *ChannelMapping `json:"channelMapping,omitempty"` - TrackId int64 `json:"trackId"` - - // Fields inherited from TrackDescriptor -} - -var _ json.Marshaler = SelectAudioTrackById{} - -func (s SelectAudioTrackById) MarshalJSON() ([]byte, error) { - type wrapper SelectAudioTrackById - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling SelectAudioTrackById: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling SelectAudioTrackById: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.SelectAudioTrackById" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling SelectAudioTrackById: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_selectvideotrackbyattribute.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_selectvideotrackbyattribute.go deleted file mode 100644 index 82305909c361..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_selectvideotrackbyattribute.go +++ /dev/null @@ -1,43 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ TrackDescriptor = SelectVideoTrackByAttribute{} - -type SelectVideoTrackByAttribute struct { - Attribute TrackAttribute `json:"attribute"` - Filter AttributeFilter `json:"filter"` - FilterValue *string `json:"filterValue,omitempty"` - - // Fields inherited from TrackDescriptor -} - -var _ json.Marshaler = SelectVideoTrackByAttribute{} - -func (s SelectVideoTrackByAttribute) MarshalJSON() ([]byte, error) { - type wrapper SelectVideoTrackByAttribute - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling SelectVideoTrackByAttribute: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling SelectVideoTrackByAttribute: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.SelectVideoTrackByAttribute" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling SelectVideoTrackByAttribute: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_selectvideotrackbyid.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_selectvideotrackbyid.go deleted file mode 100644 index 4527e73336eb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_selectvideotrackbyid.go +++ /dev/null @@ -1,41 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ TrackDescriptor = SelectVideoTrackById{} - -type SelectVideoTrackById struct { - TrackId int64 `json:"trackId"` - - // Fields inherited from TrackDescriptor -} - -var _ json.Marshaler = SelectVideoTrackById{} - -func (s SelectVideoTrackById) MarshalJSON() ([]byte, error) { - type wrapper SelectVideoTrackById - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling SelectVideoTrackById: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling SelectVideoTrackById: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.SelectVideoTrackById" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling SelectVideoTrackById: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_standardencoderpreset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_standardencoderpreset.go deleted file mode 100644 index 35c5b09d1b45..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_standardencoderpreset.go +++ /dev/null @@ -1,95 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Preset = StandardEncoderPreset{} - -type StandardEncoderPreset struct { - Codecs []Codec `json:"codecs"` - Filters *Filters `json:"filters,omitempty"` - Formats []Format `json:"formats"` - - // Fields inherited from Preset -} - -var _ json.Marshaler = StandardEncoderPreset{} - -func (s StandardEncoderPreset) MarshalJSON() ([]byte, error) { - type wrapper StandardEncoderPreset - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling StandardEncoderPreset: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling StandardEncoderPreset: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.StandardEncoderPreset" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling StandardEncoderPreset: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &StandardEncoderPreset{} - -func (s *StandardEncoderPreset) UnmarshalJSON(bytes []byte) error { - type alias StandardEncoderPreset - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into StandardEncoderPreset: %+v", err) - } - - s.Filters = decoded.Filters - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling StandardEncoderPreset into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["codecs"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling Codecs into list []json.RawMessage: %+v", err) - } - - output := make([]Codec, 0) - for i, val := range listTemp { - impl, err := unmarshalCodecImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'Codecs' for 'StandardEncoderPreset': %+v", i, err) - } - output = append(output, impl) - } - s.Codecs = output - } - - if v, ok := temp["formats"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling Formats into list []json.RawMessage: %+v", err) - } - - output := make([]Format, 0) - for i, val := range listTemp { - impl, err := unmarshalFormatImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'Formats' for 'StandardEncoderPreset': %+v", i, err) - } - output = append(output, impl) - } - s.Formats = output - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_trackdescriptor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_trackdescriptor.go deleted file mode 100644 index d9a61383ca28..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_trackdescriptor.go +++ /dev/null @@ -1,88 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TrackDescriptor interface { -} - -func unmarshalTrackDescriptorImplementation(input []byte) (TrackDescriptor, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling TrackDescriptor into map[string]interface: %+v", err) - } - - value, ok := temp["@odata.type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.AudioTrackDescriptor") { - var out AudioTrackDescriptor - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AudioTrackDescriptor: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.SelectAudioTrackByAttribute") { - var out SelectAudioTrackByAttribute - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into SelectAudioTrackByAttribute: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.SelectAudioTrackById") { - var out SelectAudioTrackById - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into SelectAudioTrackById: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.SelectVideoTrackByAttribute") { - var out SelectVideoTrackByAttribute - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into SelectVideoTrackByAttribute: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.SelectVideoTrackById") { - var out SelectVideoTrackById - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into SelectVideoTrackById: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.Media.VideoTrackDescriptor") { - var out VideoTrackDescriptor - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into VideoTrackDescriptor: %+v", err) - } - return out, nil - } - - type RawTrackDescriptorImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawTrackDescriptorImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_transform.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_transform.go deleted file mode 100644 index 01cf33e34808..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_transform.go +++ /dev/null @@ -1,16 +0,0 @@ -package encodings - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Transform struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *TransformProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_transformoutput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_transformoutput.go deleted file mode 100644 index 8532442b750d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_transformoutput.go +++ /dev/null @@ -1,42 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TransformOutput struct { - OnError *OnErrorType `json:"onError,omitempty"` - Preset Preset `json:"preset"` - RelativePriority *Priority `json:"relativePriority,omitempty"` -} - -var _ json.Unmarshaler = &TransformOutput{} - -func (s *TransformOutput) UnmarshalJSON(bytes []byte) error { - type alias TransformOutput - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into TransformOutput: %+v", err) - } - - s.OnError = decoded.OnError - s.RelativePriority = decoded.RelativePriority - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling TransformOutput into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["preset"]; ok { - impl, err := unmarshalPresetImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'Preset' for 'TransformOutput': %+v", err) - } - s.Preset = impl - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_transformproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_transformproperties.go deleted file mode 100644 index 74e7048d6961..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_transformproperties.go +++ /dev/null @@ -1,41 +0,0 @@ -package encodings - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TransformProperties struct { - Created *string `json:"created,omitempty"` - Description *string `json:"description,omitempty"` - LastModified *string `json:"lastModified,omitempty"` - Outputs []TransformOutput `json:"outputs"` -} - -func (o *TransformProperties) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *TransformProperties) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} - -func (o *TransformProperties) GetLastModifiedAsTime() (*time.Time, error) { - if o.LastModified == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModified, "2006-01-02T15:04:05Z07:00") -} - -func (o *TransformProperties) SetLastModifiedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModified = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_transportstreamformat.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_transportstreamformat.go deleted file mode 100644 index 5a869925fa55..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_transportstreamformat.go +++ /dev/null @@ -1,42 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Format = TransportStreamFormat{} - -type TransportStreamFormat struct { - OutputFiles *[]OutputFile `json:"outputFiles,omitempty"` - - // Fields inherited from Format - FilenamePattern string `json:"filenamePattern"` -} - -var _ json.Marshaler = TransportStreamFormat{} - -func (s TransportStreamFormat) MarshalJSON() ([]byte, error) { - type wrapper TransportStreamFormat - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling TransportStreamFormat: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling TransportStreamFormat: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.TransportStreamFormat" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling TransportStreamFormat: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_utccliptime.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_utccliptime.go deleted file mode 100644 index 0787e406a942..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_utccliptime.go +++ /dev/null @@ -1,41 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ClipTime = UtcClipTime{} - -type UtcClipTime struct { - Time string `json:"time"` - - // Fields inherited from ClipTime -} - -var _ json.Marshaler = UtcClipTime{} - -func (s UtcClipTime) MarshalJSON() ([]byte, error) { - type wrapper UtcClipTime - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling UtcClipTime: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling UtcClipTime: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.UtcClipTime" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling UtcClipTime: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_video.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_video.go deleted file mode 100644 index 35e566481c9d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_video.go +++ /dev/null @@ -1,44 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Codec = Video{} - -type Video struct { - KeyFrameInterval *string `json:"keyFrameInterval,omitempty"` - StretchMode *StretchMode `json:"stretchMode,omitempty"` - SyncMode *VideoSyncMode `json:"syncMode,omitempty"` - - // Fields inherited from Codec - Label *string `json:"label,omitempty"` -} - -var _ json.Marshaler = Video{} - -func (s Video) MarshalJSON() ([]byte, error) { - type wrapper Video - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling Video: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling Video: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.Video" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling Video: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_videoanalyzerpreset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_videoanalyzerpreset.go deleted file mode 100644 index d98ab1914de8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_videoanalyzerpreset.go +++ /dev/null @@ -1,44 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Preset = VideoAnalyzerPreset{} - -type VideoAnalyzerPreset struct { - AudioLanguage *string `json:"audioLanguage,omitempty"` - ExperimentalOptions *map[string]string `json:"experimentalOptions,omitempty"` - InsightsToExtract *InsightsType `json:"insightsToExtract,omitempty"` - Mode *AudioAnalysisMode `json:"mode,omitempty"` - - // Fields inherited from Preset -} - -var _ json.Marshaler = VideoAnalyzerPreset{} - -func (s VideoAnalyzerPreset) MarshalJSON() ([]byte, error) { - type wrapper VideoAnalyzerPreset - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling VideoAnalyzerPreset: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling VideoAnalyzerPreset: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.VideoAnalyzerPreset" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling VideoAnalyzerPreset: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_videolayer.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_videolayer.go deleted file mode 100644 index 80a0c9b2dfea..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_videolayer.go +++ /dev/null @@ -1,49 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Layer = VideoLayer{} - -type VideoLayer struct { - AdaptiveBFrame *bool `json:"adaptiveBFrame,omitempty"` - BFrames *int64 `json:"bFrames,omitempty"` - Bitrate int64 `json:"bitrate"` - FrameRate *string `json:"frameRate,omitempty"` - MaxBitrate *int64 `json:"maxBitrate,omitempty"` - Slices *int64 `json:"slices,omitempty"` - - // Fields inherited from Layer - Height *string `json:"height,omitempty"` - Label *string `json:"label,omitempty"` - Width *string `json:"width,omitempty"` -} - -var _ json.Marshaler = VideoLayer{} - -func (s VideoLayer) MarshalJSON() ([]byte, error) { - type wrapper VideoLayer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling VideoLayer: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling VideoLayer: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.VideoLayer" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling VideoLayer: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_videooverlay.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_videooverlay.go deleted file mode 100644 index 27d0f0282567..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_videooverlay.go +++ /dev/null @@ -1,49 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ Overlay = VideoOverlay{} - -type VideoOverlay struct { - CropRectangle *Rectangle `json:"cropRectangle,omitempty"` - Opacity *float64 `json:"opacity,omitempty"` - Position *Rectangle `json:"position,omitempty"` - - // Fields inherited from Overlay - AudioGainLevel *float64 `json:"audioGainLevel,omitempty"` - End *string `json:"end,omitempty"` - FadeInDuration *string `json:"fadeInDuration,omitempty"` - FadeOutDuration *string `json:"fadeOutDuration,omitempty"` - InputLabel string `json:"inputLabel"` - Start *string `json:"start,omitempty"` -} - -var _ json.Marshaler = VideoOverlay{} - -func (s VideoOverlay) MarshalJSON() ([]byte, error) { - type wrapper VideoOverlay - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling VideoOverlay: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling VideoOverlay: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.VideoOverlay" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling VideoOverlay: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_videotrackdescriptor.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_videotrackdescriptor.go deleted file mode 100644 index ff1f690b1d0d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/model_videotrackdescriptor.go +++ /dev/null @@ -1,40 +0,0 @@ -package encodings - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ TrackDescriptor = VideoTrackDescriptor{} - -type VideoTrackDescriptor struct { - - // Fields inherited from TrackDescriptor -} - -var _ json.Marshaler = VideoTrackDescriptor{} - -func (s VideoTrackDescriptor) MarshalJSON() ([]byte, error) { - type wrapper VideoTrackDescriptor - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling VideoTrackDescriptor: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling VideoTrackDescriptor: %+v", err) - } - decoded["@odata.type"] = "#Microsoft.Media.VideoTrackDescriptor" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling VideoTrackDescriptor: %+v", err) - } - - return encoded, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/predicates.go deleted file mode 100644 index 7a44edd43761..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/predicates.go +++ /dev/null @@ -1,47 +0,0 @@ -package encodings - -type JobOperationPredicate struct { - Id *string - Name *string - Type *string -} - -func (p JobOperationPredicate) Matches(input Job) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} - -type TransformOperationPredicate struct { - Id *string - Name *string - Type *string -} - -func (p TransformOperationPredicate) Matches(input Transform) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/version.go deleted file mode 100644 index cfe48ae276ce..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package encodings - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2020-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/encodings/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/README.md deleted file mode 100644 index 59648ad175ec..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/README.md +++ /dev/null @@ -1,152 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents` Documentation - -The `liveevents` SDK allows for interaction with the Azure Resource Manager Service `media` (API Version `2020-05-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents" -``` - - -### Client Initialization - -```go -client := liveevents.NewLiveEventsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `LiveEventsClient.Allocate` - -```go -ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") - -if err := client.AllocateThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `LiveEventsClient.Create` - -```go -ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") - -payload := liveevents.LiveEvent{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload, liveevents.DefaultCreateOperationOptions()); err != nil { - // handle the error -} -``` - - -### Example Usage: `LiveEventsClient.Delete` - -```go -ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `LiveEventsClient.Get` - -```go -ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `LiveEventsClient.List` - -```go -ctx := context.TODO() -id := liveevents.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -// alternatively `client.List(ctx, id)` can be used to do batched pagination -items, err := client.ListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `LiveEventsClient.Reset` - -```go -ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") - -if err := client.ResetThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `LiveEventsClient.Start` - -```go -ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") - -if err := client.StartThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `LiveEventsClient.Stop` - -```go -ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") - -payload := liveevents.LiveEventActionInput{ - // ... -} - - -if err := client.StopThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `LiveEventsClient.Update` - -```go -ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") - -payload := liveevents.LiveEvent{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/client.go deleted file mode 100644 index 3a48113ed79d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package liveevents - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveEventsClient struct { - Client autorest.Client - baseUri string -} - -func NewLiveEventsClientWithBaseURI(endpoint string) LiveEventsClient { - return LiveEventsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/constants.go deleted file mode 100644 index c4befce65ff5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/constants.go +++ /dev/null @@ -1,167 +0,0 @@ -package liveevents - -import "strings" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveEventEncodingType string - -const ( - LiveEventEncodingTypeNone LiveEventEncodingType = "None" - LiveEventEncodingTypePremiumOneZeroEightZerop LiveEventEncodingType = "Premium1080p" - LiveEventEncodingTypeStandard LiveEventEncodingType = "Standard" -) - -func PossibleValuesForLiveEventEncodingType() []string { - return []string{ - string(LiveEventEncodingTypeNone), - string(LiveEventEncodingTypePremiumOneZeroEightZerop), - string(LiveEventEncodingTypeStandard), - } -} - -func parseLiveEventEncodingType(input string) (*LiveEventEncodingType, error) { - vals := map[string]LiveEventEncodingType{ - "none": LiveEventEncodingTypeNone, - "premium1080p": LiveEventEncodingTypePremiumOneZeroEightZerop, - "standard": LiveEventEncodingTypeStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := LiveEventEncodingType(input) - return &out, nil -} - -type LiveEventInputProtocol string - -const ( - LiveEventInputProtocolFragmentedMPFour LiveEventInputProtocol = "FragmentedMP4" - LiveEventInputProtocolRTMP LiveEventInputProtocol = "RTMP" -) - -func PossibleValuesForLiveEventInputProtocol() []string { - return []string{ - string(LiveEventInputProtocolFragmentedMPFour), - string(LiveEventInputProtocolRTMP), - } -} - -func parseLiveEventInputProtocol(input string) (*LiveEventInputProtocol, error) { - vals := map[string]LiveEventInputProtocol{ - "fragmentedmp4": LiveEventInputProtocolFragmentedMPFour, - "rtmp": LiveEventInputProtocolRTMP, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := LiveEventInputProtocol(input) - return &out, nil -} - -type LiveEventResourceState string - -const ( - LiveEventResourceStateAllocating LiveEventResourceState = "Allocating" - LiveEventResourceStateDeleting LiveEventResourceState = "Deleting" - LiveEventResourceStateRunning LiveEventResourceState = "Running" - LiveEventResourceStateStandBy LiveEventResourceState = "StandBy" - LiveEventResourceStateStarting LiveEventResourceState = "Starting" - LiveEventResourceStateStopped LiveEventResourceState = "Stopped" - LiveEventResourceStateStopping LiveEventResourceState = "Stopping" -) - -func PossibleValuesForLiveEventResourceState() []string { - return []string{ - string(LiveEventResourceStateAllocating), - string(LiveEventResourceStateDeleting), - string(LiveEventResourceStateRunning), - string(LiveEventResourceStateStandBy), - string(LiveEventResourceStateStarting), - string(LiveEventResourceStateStopped), - string(LiveEventResourceStateStopping), - } -} - -func parseLiveEventResourceState(input string) (*LiveEventResourceState, error) { - vals := map[string]LiveEventResourceState{ - "allocating": LiveEventResourceStateAllocating, - "deleting": LiveEventResourceStateDeleting, - "running": LiveEventResourceStateRunning, - "standby": LiveEventResourceStateStandBy, - "starting": LiveEventResourceStateStarting, - "stopped": LiveEventResourceStateStopped, - "stopping": LiveEventResourceStateStopping, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := LiveEventResourceState(input) - return &out, nil -} - -type StreamOptionsFlag string - -const ( - StreamOptionsFlagDefault StreamOptionsFlag = "Default" - StreamOptionsFlagLowLatency StreamOptionsFlag = "LowLatency" -) - -func PossibleValuesForStreamOptionsFlag() []string { - return []string{ - string(StreamOptionsFlagDefault), - string(StreamOptionsFlagLowLatency), - } -} - -func parseStreamOptionsFlag(input string) (*StreamOptionsFlag, error) { - vals := map[string]StreamOptionsFlag{ - "default": StreamOptionsFlagDefault, - "lowlatency": StreamOptionsFlagLowLatency, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := StreamOptionsFlag(input) - return &out, nil -} - -type StretchMode string - -const ( - StretchModeAutoFit StretchMode = "AutoFit" - StretchModeAutoSize StretchMode = "AutoSize" - StretchModeNone StretchMode = "None" -) - -func PossibleValuesForStretchMode() []string { - return []string{ - string(StretchModeAutoFit), - string(StretchModeAutoSize), - string(StretchModeNone), - } -} - -func parseStretchMode(input string) (*StretchMode, error) { - vals := map[string]StretchMode{ - "autofit": StretchModeAutoFit, - "autosize": StretchModeAutoSize, - "none": StretchModeNone, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := StretchMode(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/id_liveevent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/id_liveevent.go deleted file mode 100644 index c89799de3faa..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/id_liveevent.go +++ /dev/null @@ -1,137 +0,0 @@ -package liveevents - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = LiveEventId{} - -// LiveEventId is a struct representing the Resource ID for a Live Event -type LiveEventId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - LiveEventName string -} - -// NewLiveEventID returns a new LiveEventId struct -func NewLiveEventID(subscriptionId string, resourceGroupName string, accountName string, liveEventName string) LiveEventId { - return LiveEventId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - LiveEventName: liveEventName, - } -} - -// ParseLiveEventID parses 'input' into a LiveEventId -func ParseLiveEventID(input string) (*LiveEventId, error) { - parser := resourceids.NewParserFromResourceIdType(LiveEventId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LiveEventId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, fmt.Errorf("the segment 'liveEventName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseLiveEventIDInsensitively parses 'input' case-insensitively into a LiveEventId -// note: this method should only be used for API response data and not user input -func ParseLiveEventIDInsensitively(input string) (*LiveEventId, error) { - parser := resourceids.NewParserFromResourceIdType(LiveEventId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LiveEventId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, fmt.Errorf("the segment 'liveEventName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateLiveEventID checks that 'input' can be parsed as a Live Event ID -func ValidateLiveEventID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseLiveEventID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Live Event ID -func (id LiveEventId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/liveEvents/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.LiveEventName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Live Event ID -func (id LiveEventId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticLiveEvents", "liveEvents", "liveEvents"), - resourceids.UserSpecifiedSegment("liveEventName", "liveEventValue"), - } -} - -// String returns a human-readable description of this Live Event ID -func (id LiveEventId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Live Event Name: %q", id.LiveEventName), - } - return fmt.Sprintf("Live Event (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/id_mediaservice.go deleted file mode 100644 index 8c8c2a33c99d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/id_mediaservice.go +++ /dev/null @@ -1,124 +0,0 @@ -package liveevents - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = MediaServiceId{} - -// MediaServiceId is a struct representing the Resource ID for a Media Service -type MediaServiceId struct { - SubscriptionId string - ResourceGroupName string - AccountName string -} - -// NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { - return MediaServiceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - } -} - -// ParseMediaServiceID parses 'input' into a MediaServiceId -func ParseMediaServiceID(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseMediaServiceIDInsensitively parses 'input' case-insensitively into a MediaServiceId -// note: this method should only be used for API response data and not user input -func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID -func ValidateMediaServiceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseMediaServiceID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Media Service ID -func (id MediaServiceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Media Service ID -func (id MediaServiceId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - } -} - -// String returns a human-readable description of this Media Service ID -func (id MediaServiceId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - } - return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_allocate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_allocate_autorest.go deleted file mode 100644 index 5786b575b4c8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_allocate_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package liveevents - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AllocateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Allocate ... -func (c LiveEventsClient) Allocate(ctx context.Context, id LiveEventId) (result AllocateOperationResponse, err error) { - req, err := c.preparerForAllocate(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Allocate", nil, "Failure preparing request") - return - } - - result, err = c.senderForAllocate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Allocate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// AllocateThenPoll performs Allocate then polls until it's completed -func (c LiveEventsClient) AllocateThenPoll(ctx context.Context, id LiveEventId) error { - result, err := c.Allocate(ctx, id) - if err != nil { - return fmt.Errorf("performing Allocate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Allocate: %+v", err) - } - - return nil -} - -// preparerForAllocate prepares the Allocate request. -func (c LiveEventsClient) preparerForAllocate(ctx context.Context, id LiveEventId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/allocate", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForAllocate sends the Allocate request. The method will close the -// http.Response Body if it receives an error. -func (c LiveEventsClient) senderForAllocate(ctx context.Context, req *http.Request) (future AllocateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_create_autorest.go deleted file mode 100644 index 2922c1b63dbd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_create_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package liveevents - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type CreateOperationOptions struct { - AutoStart *bool -} - -func DefaultCreateOperationOptions() CreateOperationOptions { - return CreateOperationOptions{} -} - -func (o CreateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o CreateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.AutoStart != nil { - out["autoStart"] = *o.AutoStart - } - - return out -} - -// Create ... -func (c LiveEventsClient) Create(ctx context.Context, id LiveEventId, input LiveEvent, options CreateOperationOptions) (result CreateOperationResponse, err error) { - req, err := c.preparerForCreate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateThenPoll performs Create then polls until it's completed -func (c LiveEventsClient) CreateThenPoll(ctx context.Context, id LiveEventId, input LiveEvent, options CreateOperationOptions) error { - result, err := c.Create(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} - -// preparerForCreate prepares the Create request. -func (c LiveEventsClient) preparerForCreate(ctx context.Context, id LiveEventId, input LiveEvent, options CreateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreate sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (c LiveEventsClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_delete_autorest.go deleted file mode 100644 index cb3ff602fcf4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package liveevents - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c LiveEventsClient) Delete(ctx context.Context, id LiveEventId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c LiveEventsClient) DeleteThenPoll(ctx context.Context, id LiveEventId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c LiveEventsClient) preparerForDelete(ctx context.Context, id LiveEventId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c LiveEventsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_get_autorest.go deleted file mode 100644 index ddea7146326b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package liveevents - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *LiveEvent -} - -// Get ... -func (c LiveEventsClient) Get(ctx context.Context, id LiveEventId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c LiveEventsClient) preparerForGet(ctx context.Context, id LiveEventId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c LiveEventsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_list_autorest.go deleted file mode 100644 index 09c6921fc0cc..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_list_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package liveevents - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]LiveEvent - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []LiveEvent -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c LiveEventsClient) List(ctx context.Context, id MediaServiceId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c LiveEventsClient) preparerForList(ctx context.Context, id MediaServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/liveEvents", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c LiveEventsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c LiveEventsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []LiveEvent `json:"value"` - NextLink *string `json:"@odata.nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c LiveEventsClient) ListComplete(ctx context.Context, id MediaServiceId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, LiveEventOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c LiveEventsClient) ListCompleteMatchingPredicate(ctx context.Context, id MediaServiceId, predicate LiveEventOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]LiveEvent, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_reset_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_reset_autorest.go deleted file mode 100644 index bf19cfc863a9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_reset_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package liveevents - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ResetOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Reset ... -func (c LiveEventsClient) Reset(ctx context.Context, id LiveEventId) (result ResetOperationResponse, err error) { - req, err := c.preparerForReset(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Reset", nil, "Failure preparing request") - return - } - - result, err = c.senderForReset(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Reset", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ResetThenPoll performs Reset then polls until it's completed -func (c LiveEventsClient) ResetThenPoll(ctx context.Context, id LiveEventId) error { - result, err := c.Reset(ctx, id) - if err != nil { - return fmt.Errorf("performing Reset: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Reset: %+v", err) - } - - return nil -} - -// preparerForReset prepares the Reset request. -func (c LiveEventsClient) preparerForReset(ctx context.Context, id LiveEventId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/reset", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForReset sends the Reset request. The method will close the -// http.Response Body if it receives an error. -func (c LiveEventsClient) senderForReset(ctx context.Context, req *http.Request) (future ResetOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_start_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_start_autorest.go deleted file mode 100644 index a7466bf0c9ae..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_start_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package liveevents - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StartOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Start ... -func (c LiveEventsClient) Start(ctx context.Context, id LiveEventId) (result StartOperationResponse, err error) { - req, err := c.preparerForStart(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Start", nil, "Failure preparing request") - return - } - - result, err = c.senderForStart(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Start", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// StartThenPoll performs Start then polls until it's completed -func (c LiveEventsClient) StartThenPoll(ctx context.Context, id LiveEventId) error { - result, err := c.Start(ctx, id) - if err != nil { - return fmt.Errorf("performing Start: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Start: %+v", err) - } - - return nil -} - -// preparerForStart prepares the Start request. -func (c LiveEventsClient) preparerForStart(ctx context.Context, id LiveEventId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/start", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForStart sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (c LiveEventsClient) senderForStart(ctx context.Context, req *http.Request) (future StartOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_stop_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_stop_autorest.go deleted file mode 100644 index b49d4e054f99..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_stop_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package liveevents - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StopOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Stop ... -func (c LiveEventsClient) Stop(ctx context.Context, id LiveEventId, input LiveEventActionInput) (result StopOperationResponse, err error) { - req, err := c.preparerForStop(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = c.senderForStop(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Stop", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// StopThenPoll performs Stop then polls until it's completed -func (c LiveEventsClient) StopThenPoll(ctx context.Context, id LiveEventId, input LiveEventActionInput) error { - result, err := c.Stop(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Stop: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Stop: %+v", err) - } - - return nil -} - -// preparerForStop prepares the Stop request. -func (c LiveEventsClient) preparerForStop(ctx context.Context, id LiveEventId, input LiveEventActionInput) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/stop", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForStop sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (c LiveEventsClient) senderForStop(ctx context.Context, req *http.Request) (future StopOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_update_autorest.go deleted file mode 100644 index d9b8edccb0f8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/method_update_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package liveevents - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c LiveEventsClient) Update(ctx context.Context, id LiveEventId, input LiveEvent) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "liveevents.LiveEventsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c LiveEventsClient) UpdateThenPoll(ctx context.Context, id LiveEventId, input LiveEvent) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c LiveEventsClient) preparerForUpdate(ctx context.Context, id LiveEventId, input LiveEvent) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c LiveEventsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_crosssiteaccesspolicies.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_crosssiteaccesspolicies.go deleted file mode 100644 index 48fe3ea2391b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_crosssiteaccesspolicies.go +++ /dev/null @@ -1,9 +0,0 @@ -package liveevents - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CrossSiteAccessPolicies struct { - ClientAccessPolicy *string `json:"clientAccessPolicy,omitempty"` - CrossDomainPolicy *string `json:"crossDomainPolicy,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_ipaccesscontrol.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_ipaccesscontrol.go deleted file mode 100644 index ebabbd6e23e5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_ipaccesscontrol.go +++ /dev/null @@ -1,8 +0,0 @@ -package liveevents - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type IPAccessControl struct { - Allow *[]IPRange `json:"allow,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_iprange.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_iprange.go deleted file mode 100644 index f3baaf0ab14f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_iprange.go +++ /dev/null @@ -1,10 +0,0 @@ -package liveevents - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type IPRange struct { - Address *string `json:"address,omitempty"` - Name *string `json:"name,omitempty"` - SubnetPrefixLength *int64 `json:"subnetPrefixLength,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveevent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveevent.go deleted file mode 100644 index 4ce8a6c2cf8b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveevent.go +++ /dev/null @@ -1,18 +0,0 @@ -package liveevents - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveEvent struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *LiveEventProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventactioninput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventactioninput.go deleted file mode 100644 index 9cefd375f15d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventactioninput.go +++ /dev/null @@ -1,8 +0,0 @@ -package liveevents - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveEventActionInput struct { - RemoveOutputsOnStop *bool `json:"removeOutputsOnStop,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventencoding.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventencoding.go deleted file mode 100644 index 5b523350a398..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventencoding.go +++ /dev/null @@ -1,11 +0,0 @@ -package liveevents - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveEventEncoding struct { - EncodingType *LiveEventEncodingType `json:"encodingType,omitempty"` - KeyFrameInterval *string `json:"keyFrameInterval,omitempty"` - PresetName *string `json:"presetName,omitempty"` - StretchMode *StretchMode `json:"stretchMode,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventendpoint.go deleted file mode 100644 index 58a27757939b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventendpoint.go +++ /dev/null @@ -1,9 +0,0 @@ -package liveevents - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveEventEndpoint struct { - Protocol *string `json:"protocol,omitempty"` - Url *string `json:"url,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventinput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventinput.go deleted file mode 100644 index 0eddc34140c3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventinput.go +++ /dev/null @@ -1,12 +0,0 @@ -package liveevents - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveEventInput struct { - AccessControl *LiveEventInputAccessControl `json:"accessControl,omitempty"` - AccessToken *string `json:"accessToken,omitempty"` - Endpoints *[]LiveEventEndpoint `json:"endpoints,omitempty"` - KeyFrameIntervalDuration *string `json:"keyFrameIntervalDuration,omitempty"` - StreamingProtocol LiveEventInputProtocol `json:"streamingProtocol"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventinputaccesscontrol.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventinputaccesscontrol.go deleted file mode 100644 index 097779e37a37..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventinputaccesscontrol.go +++ /dev/null @@ -1,8 +0,0 @@ -package liveevents - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveEventInputAccessControl struct { - IP *IPAccessControl `json:"ip,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventinputtrackselection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventinputtrackselection.go deleted file mode 100644 index a5d8017c5b9e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventinputtrackselection.go +++ /dev/null @@ -1,10 +0,0 @@ -package liveevents - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveEventInputTrackSelection struct { - Operation *string `json:"operation,omitempty"` - Property *string `json:"property,omitempty"` - Value *string `json:"value,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventoutputtranscriptiontrack.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventoutputtranscriptiontrack.go deleted file mode 100644 index 76d4346a238c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventoutputtranscriptiontrack.go +++ /dev/null @@ -1,8 +0,0 @@ -package liveevents - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveEventOutputTranscriptionTrack struct { - TrackName string `json:"trackName"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventpreview.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventpreview.go deleted file mode 100644 index 29f8d0caefa8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventpreview.go +++ /dev/null @@ -1,12 +0,0 @@ -package liveevents - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveEventPreview struct { - AccessControl *LiveEventPreviewAccessControl `json:"accessControl,omitempty"` - AlternativeMediaId *string `json:"alternativeMediaId,omitempty"` - Endpoints *[]LiveEventEndpoint `json:"endpoints,omitempty"` - PreviewLocator *string `json:"previewLocator,omitempty"` - StreamingPolicyName *string `json:"streamingPolicyName,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventpreviewaccesscontrol.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventpreviewaccesscontrol.go deleted file mode 100644 index 2826ebcd7391..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventpreviewaccesscontrol.go +++ /dev/null @@ -1,8 +0,0 @@ -package liveevents - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveEventPreviewAccessControl struct { - IP *IPAccessControl `json:"ip,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventproperties.go deleted file mode 100644 index c04b10ab7a4a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventproperties.go +++ /dev/null @@ -1,50 +0,0 @@ -package liveevents - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveEventProperties struct { - Created *string `json:"created,omitempty"` - CrossSiteAccessPolicies *CrossSiteAccessPolicies `json:"crossSiteAccessPolicies,omitempty"` - Description *string `json:"description,omitempty"` - Encoding *LiveEventEncoding `json:"encoding,omitempty"` - HostnamePrefix *string `json:"hostnamePrefix,omitempty"` - Input LiveEventInput `json:"input"` - LastModified *string `json:"lastModified,omitempty"` - Preview *LiveEventPreview `json:"preview,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ResourceState *LiveEventResourceState `json:"resourceState,omitempty"` - StreamOptions *[]StreamOptionsFlag `json:"streamOptions,omitempty"` - Transcriptions *[]LiveEventTranscription `json:"transcriptions,omitempty"` - UseStaticHostname *bool `json:"useStaticHostname,omitempty"` -} - -func (o *LiveEventProperties) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *LiveEventProperties) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} - -func (o *LiveEventProperties) GetLastModifiedAsTime() (*time.Time, error) { - if o.LastModified == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModified, "2006-01-02T15:04:05Z07:00") -} - -func (o *LiveEventProperties) SetLastModifiedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModified = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventtranscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventtranscription.go deleted file mode 100644 index 0ec81c1e59c8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/model_liveeventtranscription.go +++ /dev/null @@ -1,10 +0,0 @@ -package liveevents - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveEventTranscription struct { - InputTrackSelection *[]LiveEventInputTrackSelection `json:"inputTrackSelection,omitempty"` - Language *string `json:"language,omitempty"` - OutputTranscriptionTrack *LiveEventOutputTranscriptionTrack `json:"outputTranscriptionTrack,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/predicates.go deleted file mode 100644 index e6ff9598b171..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/predicates.go +++ /dev/null @@ -1,29 +0,0 @@ -package liveevents - -type LiveEventOperationPredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p LiveEventOperationPredicate) Matches(input LiveEvent) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/version.go deleted file mode 100644 index 2a2da6037b6c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package liveevents - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2020-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/liveevents/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/README.md deleted file mode 100644 index 26571a2d6a67..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/README.md +++ /dev/null @@ -1,82 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs` Documentation - -The `liveoutputs` SDK allows for interaction with the Azure Resource Manager Service `media` (API Version `2020-05-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs" -``` - - -### Client Initialization - -```go -client := liveoutputs.NewLiveOutputsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `LiveOutputsClient.Create` - -```go -ctx := context.TODO() -id := liveoutputs.NewLiveOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue", "liveOutputValue") - -payload := liveoutputs.LiveOutput{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `LiveOutputsClient.Delete` - -```go -ctx := context.TODO() -id := liveoutputs.NewLiveOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue", "liveOutputValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `LiveOutputsClient.Get` - -```go -ctx := context.TODO() -id := liveoutputs.NewLiveOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue", "liveOutputValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `LiveOutputsClient.List` - -```go -ctx := context.TODO() -id := liveoutputs.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") - -// alternatively `client.List(ctx, id)` can be used to do batched pagination -items, err := client.ListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/client.go deleted file mode 100644 index 68b9de3ac049..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package liveoutputs - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveOutputsClient struct { - Client autorest.Client - baseUri string -} - -func NewLiveOutputsClientWithBaseURI(endpoint string) LiveOutputsClient { - return LiveOutputsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/constants.go deleted file mode 100644 index 6094e656ebb0..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/constants.go +++ /dev/null @@ -1,37 +0,0 @@ -package liveoutputs - -import "strings" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveOutputResourceState string - -const ( - LiveOutputResourceStateCreating LiveOutputResourceState = "Creating" - LiveOutputResourceStateDeleting LiveOutputResourceState = "Deleting" - LiveOutputResourceStateRunning LiveOutputResourceState = "Running" -) - -func PossibleValuesForLiveOutputResourceState() []string { - return []string{ - string(LiveOutputResourceStateCreating), - string(LiveOutputResourceStateDeleting), - string(LiveOutputResourceStateRunning), - } -} - -func parseLiveOutputResourceState(input string) (*LiveOutputResourceState, error) { - vals := map[string]LiveOutputResourceState{ - "creating": LiveOutputResourceStateCreating, - "deleting": LiveOutputResourceStateDeleting, - "running": LiveOutputResourceStateRunning, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := LiveOutputResourceState(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/id_liveevent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/id_liveevent.go deleted file mode 100644 index 9fc7e57c6d3a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/id_liveevent.go +++ /dev/null @@ -1,137 +0,0 @@ -package liveoutputs - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = LiveEventId{} - -// LiveEventId is a struct representing the Resource ID for a Live Event -type LiveEventId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - LiveEventName string -} - -// NewLiveEventID returns a new LiveEventId struct -func NewLiveEventID(subscriptionId string, resourceGroupName string, accountName string, liveEventName string) LiveEventId { - return LiveEventId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - LiveEventName: liveEventName, - } -} - -// ParseLiveEventID parses 'input' into a LiveEventId -func ParseLiveEventID(input string) (*LiveEventId, error) { - parser := resourceids.NewParserFromResourceIdType(LiveEventId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LiveEventId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, fmt.Errorf("the segment 'liveEventName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseLiveEventIDInsensitively parses 'input' case-insensitively into a LiveEventId -// note: this method should only be used for API response data and not user input -func ParseLiveEventIDInsensitively(input string) (*LiveEventId, error) { - parser := resourceids.NewParserFromResourceIdType(LiveEventId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LiveEventId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, fmt.Errorf("the segment 'liveEventName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateLiveEventID checks that 'input' can be parsed as a Live Event ID -func ValidateLiveEventID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseLiveEventID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Live Event ID -func (id LiveEventId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/liveEvents/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.LiveEventName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Live Event ID -func (id LiveEventId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticLiveEvents", "liveEvents", "liveEvents"), - resourceids.UserSpecifiedSegment("liveEventName", "liveEventValue"), - } -} - -// String returns a human-readable description of this Live Event ID -func (id LiveEventId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Live Event Name: %q", id.LiveEventName), - } - return fmt.Sprintf("Live Event (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/id_liveoutput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/id_liveoutput.go deleted file mode 100644 index ee7c371cb8b2..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/id_liveoutput.go +++ /dev/null @@ -1,150 +0,0 @@ -package liveoutputs - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = LiveOutputId{} - -// LiveOutputId is a struct representing the Resource ID for a Live Output -type LiveOutputId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - LiveEventName string - LiveOutputName string -} - -// NewLiveOutputID returns a new LiveOutputId struct -func NewLiveOutputID(subscriptionId string, resourceGroupName string, accountName string, liveEventName string, liveOutputName string) LiveOutputId { - return LiveOutputId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - LiveEventName: liveEventName, - LiveOutputName: liveOutputName, - } -} - -// ParseLiveOutputID parses 'input' into a LiveOutputId -func ParseLiveOutputID(input string) (*LiveOutputId, error) { - parser := resourceids.NewParserFromResourceIdType(LiveOutputId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LiveOutputId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, fmt.Errorf("the segment 'liveEventName' was not found in the resource id %q", input) - } - - if id.LiveOutputName, ok = parsed.Parsed["liveOutputName"]; !ok { - return nil, fmt.Errorf("the segment 'liveOutputName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseLiveOutputIDInsensitively parses 'input' case-insensitively into a LiveOutputId -// note: this method should only be used for API response data and not user input -func ParseLiveOutputIDInsensitively(input string) (*LiveOutputId, error) { - parser := resourceids.NewParserFromResourceIdType(LiveOutputId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LiveOutputId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, fmt.Errorf("the segment 'liveEventName' was not found in the resource id %q", input) - } - - if id.LiveOutputName, ok = parsed.Parsed["liveOutputName"]; !ok { - return nil, fmt.Errorf("the segment 'liveOutputName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateLiveOutputID checks that 'input' can be parsed as a Live Output ID -func ValidateLiveOutputID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseLiveOutputID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Live Output ID -func (id LiveOutputId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/liveEvents/%s/liveOutputs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.LiveEventName, id.LiveOutputName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Live Output ID -func (id LiveOutputId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticLiveEvents", "liveEvents", "liveEvents"), - resourceids.UserSpecifiedSegment("liveEventName", "liveEventValue"), - resourceids.StaticSegment("staticLiveOutputs", "liveOutputs", "liveOutputs"), - resourceids.UserSpecifiedSegment("liveOutputName", "liveOutputValue"), - } -} - -// String returns a human-readable description of this Live Output ID -func (id LiveOutputId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Live Event Name: %q", id.LiveEventName), - fmt.Sprintf("Live Output Name: %q", id.LiveOutputName), - } - return fmt.Sprintf("Live Output (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/method_create_autorest.go deleted file mode 100644 index 5e539afb25d6..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/method_create_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package liveoutputs - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Create ... -func (c LiveOutputsClient) Create(ctx context.Context, id LiveOutputId, input LiveOutput) (result CreateOperationResponse, err error) { - req, err := c.preparerForCreate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "liveoutputs.LiveOutputsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "liveoutputs.LiveOutputsClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateThenPoll performs Create then polls until it's completed -func (c LiveOutputsClient) CreateThenPoll(ctx context.Context, id LiveOutputId, input LiveOutput) error { - result, err := c.Create(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} - -// preparerForCreate prepares the Create request. -func (c LiveOutputsClient) preparerForCreate(ctx context.Context, id LiveOutputId, input LiveOutput) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreate sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (c LiveOutputsClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/method_delete_autorest.go deleted file mode 100644 index d71cf519dec0..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package liveoutputs - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c LiveOutputsClient) Delete(ctx context.Context, id LiveOutputId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "liveoutputs.LiveOutputsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "liveoutputs.LiveOutputsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c LiveOutputsClient) DeleteThenPoll(ctx context.Context, id LiveOutputId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c LiveOutputsClient) preparerForDelete(ctx context.Context, id LiveOutputId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c LiveOutputsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/method_get_autorest.go deleted file mode 100644 index fceb86b3d687..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package liveoutputs - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *LiveOutput -} - -// Get ... -func (c LiveOutputsClient) Get(ctx context.Context, id LiveOutputId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "liveoutputs.LiveOutputsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "liveoutputs.LiveOutputsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "liveoutputs.LiveOutputsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c LiveOutputsClient) preparerForGet(ctx context.Context, id LiveOutputId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c LiveOutputsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/method_list_autorest.go deleted file mode 100644 index dd3226b21e14..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/method_list_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package liveoutputs - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]LiveOutput - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []LiveOutput -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c LiveOutputsClient) List(ctx context.Context, id LiveEventId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "liveoutputs.LiveOutputsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "liveoutputs.LiveOutputsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "liveoutputs.LiveOutputsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c LiveOutputsClient) preparerForList(ctx context.Context, id LiveEventId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/liveOutputs", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c LiveOutputsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c LiveOutputsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []LiveOutput `json:"value"` - NextLink *string `json:"@odata.nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "liveoutputs.LiveOutputsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "liveoutputs.LiveOutputsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "liveoutputs.LiveOutputsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c LiveOutputsClient) ListComplete(ctx context.Context, id LiveEventId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, LiveOutputOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c LiveOutputsClient) ListCompleteMatchingPredicate(ctx context.Context, id LiveEventId, predicate LiveOutputOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]LiveOutput, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/model_hls.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/model_hls.go deleted file mode 100644 index 8eabe1959166..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/model_hls.go +++ /dev/null @@ -1,8 +0,0 @@ -package liveoutputs - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Hls struct { - FragmentsPerTsSegment *int64 `json:"fragmentsPerTsSegment,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/model_liveoutput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/model_liveoutput.go deleted file mode 100644 index be5c8c3d5c4a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/model_liveoutput.go +++ /dev/null @@ -1,11 +0,0 @@ -package liveoutputs - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveOutput struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *LiveOutputProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/model_liveoutputproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/model_liveoutputproperties.go deleted file mode 100644 index b48c674681a6..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/model_liveoutputproperties.go +++ /dev/null @@ -1,47 +0,0 @@ -package liveoutputs - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LiveOutputProperties struct { - ArchiveWindowLength string `json:"archiveWindowLength"` - AssetName string `json:"assetName"` - Created *string `json:"created,omitempty"` - Description *string `json:"description,omitempty"` - Hls *Hls `json:"hls,omitempty"` - LastModified *string `json:"lastModified,omitempty"` - ManifestName *string `json:"manifestName,omitempty"` - OutputSnapTime *int64 `json:"outputSnapTime,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ResourceState *LiveOutputResourceState `json:"resourceState,omitempty"` -} - -func (o *LiveOutputProperties) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *LiveOutputProperties) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} - -func (o *LiveOutputProperties) GetLastModifiedAsTime() (*time.Time, error) { - if o.LastModified == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModified, "2006-01-02T15:04:05Z07:00") -} - -func (o *LiveOutputProperties) SetLastModifiedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModified = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/predicates.go deleted file mode 100644 index f7c145c8dda4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/predicates.go +++ /dev/null @@ -1,24 +0,0 @@ -package liveoutputs - -type LiveOutputOperationPredicate struct { - Id *string - Name *string - Type *string -} - -func (p LiveOutputOperationPredicate) Matches(input LiveOutput) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/version.go deleted file mode 100644 index 94af07e07c82..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package liveoutputs - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2020-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/liveoutputs/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/README.md deleted file mode 100644 index b0ce9f0f3f55..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/README.md +++ /dev/null @@ -1,140 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints` Documentation - -The `streamingendpoints` SDK allows for interaction with the Azure Resource Manager Service `media` (API Version `2020-05-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints" -``` - - -### Client Initialization - -```go -client := streamingendpoints.NewStreamingEndpointsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `StreamingEndpointsClient.Create` - -```go -ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") - -payload := streamingendpoints.StreamingEndpoint{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload, streamingendpoints.DefaultCreateOperationOptions()); err != nil { - // handle the error -} -``` - - -### Example Usage: `StreamingEndpointsClient.Delete` - -```go -ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `StreamingEndpointsClient.Get` - -```go -ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `StreamingEndpointsClient.List` - -```go -ctx := context.TODO() -id := streamingendpoints.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -// alternatively `client.List(ctx, id)` can be used to do batched pagination -items, err := client.ListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `StreamingEndpointsClient.Scale` - -```go -ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") - -payload := streamingendpoints.StreamingEntityScaleUnit{ - // ... -} - - -if err := client.ScaleThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `StreamingEndpointsClient.Start` - -```go -ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") - -if err := client.StartThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `StreamingEndpointsClient.Stop` - -```go -ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") - -if err := client.StopThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `StreamingEndpointsClient.Update` - -```go -ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") - -payload := streamingendpoints.StreamingEndpoint{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/client.go deleted file mode 100644 index 9bc249849b3f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package streamingendpoints - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEndpointsClient struct { - Client autorest.Client - baseUri string -} - -func NewStreamingEndpointsClientWithBaseURI(endpoint string) StreamingEndpointsClient { - return StreamingEndpointsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/constants.go deleted file mode 100644 index 3984868942e8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/constants.go +++ /dev/null @@ -1,46 +0,0 @@ -package streamingendpoints - -import "strings" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEndpointResourceState string - -const ( - StreamingEndpointResourceStateDeleting StreamingEndpointResourceState = "Deleting" - StreamingEndpointResourceStateRunning StreamingEndpointResourceState = "Running" - StreamingEndpointResourceStateScaling StreamingEndpointResourceState = "Scaling" - StreamingEndpointResourceStateStarting StreamingEndpointResourceState = "Starting" - StreamingEndpointResourceStateStopped StreamingEndpointResourceState = "Stopped" - StreamingEndpointResourceStateStopping StreamingEndpointResourceState = "Stopping" -) - -func PossibleValuesForStreamingEndpointResourceState() []string { - return []string{ - string(StreamingEndpointResourceStateDeleting), - string(StreamingEndpointResourceStateRunning), - string(StreamingEndpointResourceStateScaling), - string(StreamingEndpointResourceStateStarting), - string(StreamingEndpointResourceStateStopped), - string(StreamingEndpointResourceStateStopping), - } -} - -func parseStreamingEndpointResourceState(input string) (*StreamingEndpointResourceState, error) { - vals := map[string]StreamingEndpointResourceState{ - "deleting": StreamingEndpointResourceStateDeleting, - "running": StreamingEndpointResourceStateRunning, - "scaling": StreamingEndpointResourceStateScaling, - "starting": StreamingEndpointResourceStateStarting, - "stopped": StreamingEndpointResourceStateStopped, - "stopping": StreamingEndpointResourceStateStopping, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := StreamingEndpointResourceState(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/id_mediaservice.go deleted file mode 100644 index 8f025a992deb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/id_mediaservice.go +++ /dev/null @@ -1,124 +0,0 @@ -package streamingendpoints - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = MediaServiceId{} - -// MediaServiceId is a struct representing the Resource ID for a Media Service -type MediaServiceId struct { - SubscriptionId string - ResourceGroupName string - AccountName string -} - -// NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { - return MediaServiceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - } -} - -// ParseMediaServiceID parses 'input' into a MediaServiceId -func ParseMediaServiceID(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseMediaServiceIDInsensitively parses 'input' case-insensitively into a MediaServiceId -// note: this method should only be used for API response data and not user input -func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID -func ValidateMediaServiceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseMediaServiceID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Media Service ID -func (id MediaServiceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Media Service ID -func (id MediaServiceId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - } -} - -// String returns a human-readable description of this Media Service ID -func (id MediaServiceId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - } - return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/id_streamingendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/id_streamingendpoint.go deleted file mode 100644 index e670dae8f131..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/id_streamingendpoint.go +++ /dev/null @@ -1,137 +0,0 @@ -package streamingendpoints - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = StreamingEndpointId{} - -// StreamingEndpointId is a struct representing the Resource ID for a Streaming Endpoint -type StreamingEndpointId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - StreamingEndpointName string -} - -// NewStreamingEndpointID returns a new StreamingEndpointId struct -func NewStreamingEndpointID(subscriptionId string, resourceGroupName string, accountName string, streamingEndpointName string) StreamingEndpointId { - return StreamingEndpointId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - StreamingEndpointName: streamingEndpointName, - } -} - -// ParseStreamingEndpointID parses 'input' into a StreamingEndpointId -func ParseStreamingEndpointID(input string) (*StreamingEndpointId, error) { - parser := resourceids.NewParserFromResourceIdType(StreamingEndpointId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := StreamingEndpointId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { - return nil, fmt.Errorf("the segment 'streamingEndpointName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseStreamingEndpointIDInsensitively parses 'input' case-insensitively into a StreamingEndpointId -// note: this method should only be used for API response data and not user input -func ParseStreamingEndpointIDInsensitively(input string) (*StreamingEndpointId, error) { - parser := resourceids.NewParserFromResourceIdType(StreamingEndpointId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := StreamingEndpointId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { - return nil, fmt.Errorf("the segment 'streamingEndpointName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateStreamingEndpointID checks that 'input' can be parsed as a Streaming Endpoint ID -func ValidateStreamingEndpointID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseStreamingEndpointID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Streaming Endpoint ID -func (id StreamingEndpointId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/streamingEndpoints/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.StreamingEndpointName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Streaming Endpoint ID -func (id StreamingEndpointId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticStreamingEndpoints", "streamingEndpoints", "streamingEndpoints"), - resourceids.UserSpecifiedSegment("streamingEndpointName", "streamingEndpointValue"), - } -} - -// String returns a human-readable description of this Streaming Endpoint ID -func (id StreamingEndpointId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Streaming Endpoint Name: %q", id.StreamingEndpointName), - } - return fmt.Sprintf("Streaming Endpoint (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_create_autorest.go deleted file mode 100644 index dcfbee8526c0..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_create_autorest.go +++ /dev/null @@ -1,108 +0,0 @@ -package streamingendpoints - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type CreateOperationOptions struct { - AutoStart *bool -} - -func DefaultCreateOperationOptions() CreateOperationOptions { - return CreateOperationOptions{} -} - -func (o CreateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o CreateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.AutoStart != nil { - out["autoStart"] = *o.AutoStart - } - - return out -} - -// Create ... -func (c StreamingEndpointsClient) Create(ctx context.Context, id StreamingEndpointId, input StreamingEndpoint, options CreateOperationOptions) (result CreateOperationResponse, err error) { - req, err := c.preparerForCreate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateThenPoll performs Create then polls until it's completed -func (c StreamingEndpointsClient) CreateThenPoll(ctx context.Context, id StreamingEndpointId, input StreamingEndpoint, options CreateOperationOptions) error { - result, err := c.Create(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} - -// preparerForCreate prepares the Create request. -func (c StreamingEndpointsClient) preparerForCreate(ctx context.Context, id StreamingEndpointId, input StreamingEndpoint, options CreateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreate sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (c StreamingEndpointsClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_delete_autorest.go deleted file mode 100644 index 77aa864d6cb7..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package streamingendpoints - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c StreamingEndpointsClient) Delete(ctx context.Context, id StreamingEndpointId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c StreamingEndpointsClient) DeleteThenPoll(ctx context.Context, id StreamingEndpointId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c StreamingEndpointsClient) preparerForDelete(ctx context.Context, id StreamingEndpointId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c StreamingEndpointsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_get_autorest.go deleted file mode 100644 index 10efc6a807be..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package streamingendpoints - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *StreamingEndpoint -} - -// Get ... -func (c StreamingEndpointsClient) Get(ctx context.Context, id StreamingEndpointId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c StreamingEndpointsClient) preparerForGet(ctx context.Context, id StreamingEndpointId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c StreamingEndpointsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_list_autorest.go deleted file mode 100644 index cb66dadcda4a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_list_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package streamingendpoints - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]StreamingEndpoint - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []StreamingEndpoint -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c StreamingEndpointsClient) List(ctx context.Context, id MediaServiceId) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c StreamingEndpointsClient) preparerForList(ctx context.Context, id MediaServiceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/streamingEndpoints", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c StreamingEndpointsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c StreamingEndpointsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []StreamingEndpoint `json:"value"` - NextLink *string `json:"@odata.nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c StreamingEndpointsClient) ListComplete(ctx context.Context, id MediaServiceId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, StreamingEndpointOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c StreamingEndpointsClient) ListCompleteMatchingPredicate(ctx context.Context, id MediaServiceId, predicate StreamingEndpointOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]StreamingEndpoint, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_scale_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_scale_autorest.go deleted file mode 100644 index f02f5f35ff53..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_scale_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package streamingendpoints - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ScaleOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Scale ... -func (c StreamingEndpointsClient) Scale(ctx context.Context, id StreamingEndpointId, input StreamingEntityScaleUnit) (result ScaleOperationResponse, err error) { - req, err := c.preparerForScale(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "Scale", nil, "Failure preparing request") - return - } - - result, err = c.senderForScale(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "Scale", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ScaleThenPoll performs Scale then polls until it's completed -func (c StreamingEndpointsClient) ScaleThenPoll(ctx context.Context, id StreamingEndpointId, input StreamingEntityScaleUnit) error { - result, err := c.Scale(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Scale: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Scale: %+v", err) - } - - return nil -} - -// preparerForScale prepares the Scale request. -func (c StreamingEndpointsClient) preparerForScale(ctx context.Context, id StreamingEndpointId, input StreamingEntityScaleUnit) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/scale", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForScale sends the Scale request. The method will close the -// http.Response Body if it receives an error. -func (c StreamingEndpointsClient) senderForScale(ctx context.Context, req *http.Request) (future ScaleOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_start_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_start_autorest.go deleted file mode 100644 index 7cdbd03356d4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_start_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package streamingendpoints - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StartOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Start ... -func (c StreamingEndpointsClient) Start(ctx context.Context, id StreamingEndpointId) (result StartOperationResponse, err error) { - req, err := c.preparerForStart(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "Start", nil, "Failure preparing request") - return - } - - result, err = c.senderForStart(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "Start", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// StartThenPoll performs Start then polls until it's completed -func (c StreamingEndpointsClient) StartThenPoll(ctx context.Context, id StreamingEndpointId) error { - result, err := c.Start(ctx, id) - if err != nil { - return fmt.Errorf("performing Start: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Start: %+v", err) - } - - return nil -} - -// preparerForStart prepares the Start request. -func (c StreamingEndpointsClient) preparerForStart(ctx context.Context, id StreamingEndpointId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/start", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForStart sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (c StreamingEndpointsClient) senderForStart(ctx context.Context, req *http.Request) (future StartOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_stop_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_stop_autorest.go deleted file mode 100644 index 5b75d2dc1efc..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_stop_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package streamingendpoints - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StopOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Stop ... -func (c StreamingEndpointsClient) Stop(ctx context.Context, id StreamingEndpointId) (result StopOperationResponse, err error) { - req, err := c.preparerForStop(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = c.senderForStop(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "Stop", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// StopThenPoll performs Stop then polls until it's completed -func (c StreamingEndpointsClient) StopThenPoll(ctx context.Context, id StreamingEndpointId) error { - result, err := c.Stop(ctx, id) - if err != nil { - return fmt.Errorf("performing Stop: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Stop: %+v", err) - } - - return nil -} - -// preparerForStop prepares the Stop request. -func (c StreamingEndpointsClient) preparerForStop(ctx context.Context, id StreamingEndpointId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/stop", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForStop sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (c StreamingEndpointsClient) senderForStop(ctx context.Context, req *http.Request) (future StopOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_akamaiaccesscontrol.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_akamaiaccesscontrol.go deleted file mode 100644 index 54db60a01f0a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_akamaiaccesscontrol.go +++ /dev/null @@ -1,8 +0,0 @@ -package streamingendpoints - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AkamaiAccessControl struct { - AkamaiSignatureHeaderAuthenticationKeyList *[]AkamaiSignatureHeaderAuthenticationKey `json:"akamaiSignatureHeaderAuthenticationKeyList,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_akamaisignatureheaderauthenticationkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_akamaisignatureheaderauthenticationkey.go deleted file mode 100644 index 32037bfa525e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_akamaisignatureheaderauthenticationkey.go +++ /dev/null @@ -1,28 +0,0 @@ -package streamingendpoints - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AkamaiSignatureHeaderAuthenticationKey struct { - Base64Key *string `json:"base64Key,omitempty"` - Expiration *string `json:"expiration,omitempty"` - Identifier *string `json:"identifier,omitempty"` -} - -func (o *AkamaiSignatureHeaderAuthenticationKey) GetExpirationAsTime() (*time.Time, error) { - if o.Expiration == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Expiration, "2006-01-02T15:04:05Z07:00") -} - -func (o *AkamaiSignatureHeaderAuthenticationKey) SetExpirationAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Expiration = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_crosssiteaccesspolicies.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_crosssiteaccesspolicies.go deleted file mode 100644 index df58bc186f2c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_crosssiteaccesspolicies.go +++ /dev/null @@ -1,9 +0,0 @@ -package streamingendpoints - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CrossSiteAccessPolicies struct { - ClientAccessPolicy *string `json:"clientAccessPolicy,omitempty"` - CrossDomainPolicy *string `json:"crossDomainPolicy,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_ipaccesscontrol.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_ipaccesscontrol.go deleted file mode 100644 index 68255bff449d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_ipaccesscontrol.go +++ /dev/null @@ -1,8 +0,0 @@ -package streamingendpoints - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type IPAccessControl struct { - Allow *[]IPRange `json:"allow,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_iprange.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_iprange.go deleted file mode 100644 index 07cfcae8c2be..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_iprange.go +++ /dev/null @@ -1,10 +0,0 @@ -package streamingendpoints - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type IPRange struct { - Address *string `json:"address,omitempty"` - Name *string `json:"name,omitempty"` - SubnetPrefixLength *int64 `json:"subnetPrefixLength,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_streamingendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_streamingendpoint.go deleted file mode 100644 index 2e7e8f301362..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_streamingendpoint.go +++ /dev/null @@ -1,18 +0,0 @@ -package streamingendpoints - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEndpoint struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *StreamingEndpointProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_streamingendpointaccesscontrol.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_streamingendpointaccesscontrol.go deleted file mode 100644 index 3620eaa8196b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_streamingendpointaccesscontrol.go +++ /dev/null @@ -1,9 +0,0 @@ -package streamingendpoints - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEndpointAccessControl struct { - Akamai *AkamaiAccessControl `json:"akamai,omitempty"` - IP *IPAccessControl `json:"ip,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_streamingendpointproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_streamingendpointproperties.go deleted file mode 100644 index 443118599035..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_streamingendpointproperties.go +++ /dev/null @@ -1,65 +0,0 @@ -package streamingendpoints - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEndpointProperties struct { - AccessControl *StreamingEndpointAccessControl `json:"accessControl,omitempty"` - AvailabilitySetName *string `json:"availabilitySetName,omitempty"` - CdnEnabled *bool `json:"cdnEnabled,omitempty"` - CdnProfile *string `json:"cdnProfile,omitempty"` - CdnProvider *string `json:"cdnProvider,omitempty"` - Created *string `json:"created,omitempty"` - CrossSiteAccessPolicies *CrossSiteAccessPolicies `json:"crossSiteAccessPolicies,omitempty"` - CustomHostNames *[]string `json:"customHostNames,omitempty"` - Description *string `json:"description,omitempty"` - FreeTrialEndTime *string `json:"freeTrialEndTime,omitempty"` - HostName *string `json:"hostName,omitempty"` - LastModified *string `json:"lastModified,omitempty"` - MaxCacheAge *int64 `json:"maxCacheAge,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ResourceState *StreamingEndpointResourceState `json:"resourceState,omitempty"` - ScaleUnits int64 `json:"scaleUnits"` -} - -func (o *StreamingEndpointProperties) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *StreamingEndpointProperties) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} - -func (o *StreamingEndpointProperties) GetFreeTrialEndTimeAsTime() (*time.Time, error) { - if o.FreeTrialEndTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.FreeTrialEndTime, "2006-01-02T15:04:05Z07:00") -} - -func (o *StreamingEndpointProperties) SetFreeTrialEndTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.FreeTrialEndTime = &formatted -} - -func (o *StreamingEndpointProperties) GetLastModifiedAsTime() (*time.Time, error) { - if o.LastModified == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModified, "2006-01-02T15:04:05Z07:00") -} - -func (o *StreamingEndpointProperties) SetLastModifiedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModified = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_streamingentityscaleunit.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_streamingentityscaleunit.go deleted file mode 100644 index 9af1883b9433..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/model_streamingentityscaleunit.go +++ /dev/null @@ -1,8 +0,0 @@ -package streamingendpoints - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEntityScaleUnit struct { - ScaleUnit *int64 `json:"scaleUnit,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/predicates.go deleted file mode 100644 index 1c0d9ee53a01..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/predicates.go +++ /dev/null @@ -1,29 +0,0 @@ -package streamingendpoints - -type StreamingEndpointOperationPredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p StreamingEndpointOperationPredicate) Matches(input StreamingEndpoint) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/version.go deleted file mode 100644 index 76ef355450eb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package streamingendpoints - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2020-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/streamingendpoints/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/README.md deleted file mode 100644 index df0ecd992d51..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/README.md +++ /dev/null @@ -1,192 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators` Documentation - -The `streamingpoliciesandstreaminglocators` SDK allows for interaction with the Azure Resource Manager Service `media` (API Version `2020-05-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators" -``` - - -### Client Initialization - -```go -client := streamingpoliciesandstreaminglocators.NewStreamingPoliciesAndStreamingLocatorsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `StreamingPoliciesAndStreamingLocatorsClient.StreamingLocatorsCreate` - -```go -ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingLocatorValue") - -payload := streamingpoliciesandstreaminglocators.StreamingLocator{ - // ... -} - - -read, err := client.StreamingLocatorsCreate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `StreamingPoliciesAndStreamingLocatorsClient.StreamingLocatorsDelete` - -```go -ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingLocatorValue") - -read, err := client.StreamingLocatorsDelete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `StreamingPoliciesAndStreamingLocatorsClient.StreamingLocatorsGet` - -```go -ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingLocatorValue") - -read, err := client.StreamingLocatorsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `StreamingPoliciesAndStreamingLocatorsClient.StreamingLocatorsList` - -```go -ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -// alternatively `client.StreamingLocatorsList(ctx, id, streamingpoliciesandstreaminglocators.DefaultStreamingLocatorsListOperationOptions())` can be used to do batched pagination -items, err := client.StreamingLocatorsListComplete(ctx, id, streamingpoliciesandstreaminglocators.DefaultStreamingLocatorsListOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `StreamingPoliciesAndStreamingLocatorsClient.StreamingLocatorsListContentKeys` - -```go -ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingLocatorValue") - -read, err := client.StreamingLocatorsListContentKeys(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `StreamingPoliciesAndStreamingLocatorsClient.StreamingLocatorsListPaths` - -```go -ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingLocatorValue") - -read, err := client.StreamingLocatorsListPaths(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `StreamingPoliciesAndStreamingLocatorsClient.StreamingPoliciesCreate` - -```go -ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingPolicyValue") - -payload := streamingpoliciesandstreaminglocators.StreamingPolicy{ - // ... -} - - -read, err := client.StreamingPoliciesCreate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `StreamingPoliciesAndStreamingLocatorsClient.StreamingPoliciesDelete` - -```go -ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingPolicyValue") - -read, err := client.StreamingPoliciesDelete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `StreamingPoliciesAndStreamingLocatorsClient.StreamingPoliciesGet` - -```go -ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingPolicyValue") - -read, err := client.StreamingPoliciesGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `StreamingPoliciesAndStreamingLocatorsClient.StreamingPoliciesList` - -```go -ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") - -// alternatively `client.StreamingPoliciesList(ctx, id, streamingpoliciesandstreaminglocators.DefaultStreamingPoliciesListOperationOptions())` can be used to do batched pagination -items, err := client.StreamingPoliciesListComplete(ctx, id, streamingpoliciesandstreaminglocators.DefaultStreamingPoliciesListOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/client.go deleted file mode 100644 index 9aab35279a2c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingPoliciesAndStreamingLocatorsClient struct { - Client autorest.Client - baseUri string -} - -func NewStreamingPoliciesAndStreamingLocatorsClientWithBaseURI(endpoint string) StreamingPoliciesAndStreamingLocatorsClient { - return StreamingPoliciesAndStreamingLocatorsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/constants.go deleted file mode 100644 index c319bdafadfe..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/constants.go +++ /dev/null @@ -1,161 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import "strings" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EncryptionScheme string - -const ( - EncryptionSchemeCommonEncryptionCbcs EncryptionScheme = "CommonEncryptionCbcs" - EncryptionSchemeCommonEncryptionCenc EncryptionScheme = "CommonEncryptionCenc" - EncryptionSchemeEnvelopeEncryption EncryptionScheme = "EnvelopeEncryption" - EncryptionSchemeNoEncryption EncryptionScheme = "NoEncryption" -) - -func PossibleValuesForEncryptionScheme() []string { - return []string{ - string(EncryptionSchemeCommonEncryptionCbcs), - string(EncryptionSchemeCommonEncryptionCenc), - string(EncryptionSchemeEnvelopeEncryption), - string(EncryptionSchemeNoEncryption), - } -} - -func parseEncryptionScheme(input string) (*EncryptionScheme, error) { - vals := map[string]EncryptionScheme{ - "commonencryptioncbcs": EncryptionSchemeCommonEncryptionCbcs, - "commonencryptioncenc": EncryptionSchemeCommonEncryptionCenc, - "envelopeencryption": EncryptionSchemeEnvelopeEncryption, - "noencryption": EncryptionSchemeNoEncryption, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionScheme(input) - return &out, nil -} - -type StreamingLocatorContentKeyType string - -const ( - StreamingLocatorContentKeyTypeCommonEncryptionCbcs StreamingLocatorContentKeyType = "CommonEncryptionCbcs" - StreamingLocatorContentKeyTypeCommonEncryptionCenc StreamingLocatorContentKeyType = "CommonEncryptionCenc" - StreamingLocatorContentKeyTypeEnvelopeEncryption StreamingLocatorContentKeyType = "EnvelopeEncryption" -) - -func PossibleValuesForStreamingLocatorContentKeyType() []string { - return []string{ - string(StreamingLocatorContentKeyTypeCommonEncryptionCbcs), - string(StreamingLocatorContentKeyTypeCommonEncryptionCenc), - string(StreamingLocatorContentKeyTypeEnvelopeEncryption), - } -} - -func parseStreamingLocatorContentKeyType(input string) (*StreamingLocatorContentKeyType, error) { - vals := map[string]StreamingLocatorContentKeyType{ - "commonencryptioncbcs": StreamingLocatorContentKeyTypeCommonEncryptionCbcs, - "commonencryptioncenc": StreamingLocatorContentKeyTypeCommonEncryptionCenc, - "envelopeencryption": StreamingLocatorContentKeyTypeEnvelopeEncryption, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := StreamingLocatorContentKeyType(input) - return &out, nil -} - -type StreamingPolicyStreamingProtocol string - -const ( - StreamingPolicyStreamingProtocolDash StreamingPolicyStreamingProtocol = "Dash" - StreamingPolicyStreamingProtocolDownload StreamingPolicyStreamingProtocol = "Download" - StreamingPolicyStreamingProtocolHls StreamingPolicyStreamingProtocol = "Hls" - StreamingPolicyStreamingProtocolSmoothStreaming StreamingPolicyStreamingProtocol = "SmoothStreaming" -) - -func PossibleValuesForStreamingPolicyStreamingProtocol() []string { - return []string{ - string(StreamingPolicyStreamingProtocolDash), - string(StreamingPolicyStreamingProtocolDownload), - string(StreamingPolicyStreamingProtocolHls), - string(StreamingPolicyStreamingProtocolSmoothStreaming), - } -} - -func parseStreamingPolicyStreamingProtocol(input string) (*StreamingPolicyStreamingProtocol, error) { - vals := map[string]StreamingPolicyStreamingProtocol{ - "dash": StreamingPolicyStreamingProtocolDash, - "download": StreamingPolicyStreamingProtocolDownload, - "hls": StreamingPolicyStreamingProtocolHls, - "smoothstreaming": StreamingPolicyStreamingProtocolSmoothStreaming, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := StreamingPolicyStreamingProtocol(input) - return &out, nil -} - -type TrackPropertyCompareOperation string - -const ( - TrackPropertyCompareOperationEqual TrackPropertyCompareOperation = "Equal" - TrackPropertyCompareOperationUnknown TrackPropertyCompareOperation = "Unknown" -) - -func PossibleValuesForTrackPropertyCompareOperation() []string { - return []string{ - string(TrackPropertyCompareOperationEqual), - string(TrackPropertyCompareOperationUnknown), - } -} - -func parseTrackPropertyCompareOperation(input string) (*TrackPropertyCompareOperation, error) { - vals := map[string]TrackPropertyCompareOperation{ - "equal": TrackPropertyCompareOperationEqual, - "unknown": TrackPropertyCompareOperationUnknown, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := TrackPropertyCompareOperation(input) - return &out, nil -} - -type TrackPropertyType string - -const ( - TrackPropertyTypeFourCC TrackPropertyType = "FourCC" - TrackPropertyTypeUnknown TrackPropertyType = "Unknown" -) - -func PossibleValuesForTrackPropertyType() []string { - return []string{ - string(TrackPropertyTypeFourCC), - string(TrackPropertyTypeUnknown), - } -} - -func parseTrackPropertyType(input string) (*TrackPropertyType, error) { - vals := map[string]TrackPropertyType{ - "fourcc": TrackPropertyTypeFourCC, - "unknown": TrackPropertyTypeUnknown, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := TrackPropertyType(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/id_mediaservice.go deleted file mode 100644 index 97964c679bd2..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/id_mediaservice.go +++ /dev/null @@ -1,124 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = MediaServiceId{} - -// MediaServiceId is a struct representing the Resource ID for a Media Service -type MediaServiceId struct { - SubscriptionId string - ResourceGroupName string - AccountName string -} - -// NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { - return MediaServiceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - } -} - -// ParseMediaServiceID parses 'input' into a MediaServiceId -func ParseMediaServiceID(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseMediaServiceIDInsensitively parses 'input' case-insensitively into a MediaServiceId -// note: this method should only be used for API response data and not user input -func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { - parser := resourceids.NewParserFromResourceIdType(MediaServiceId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := MediaServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID -func ValidateMediaServiceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseMediaServiceID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Media Service ID -func (id MediaServiceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Media Service ID -func (id MediaServiceId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - } -} - -// String returns a human-readable description of this Media Service ID -func (id MediaServiceId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - } - return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go deleted file mode 100644 index 5bc5c7f6fba1..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go +++ /dev/null @@ -1,137 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = StreamingLocatorId{} - -// StreamingLocatorId is a struct representing the Resource ID for a Streaming Locator -type StreamingLocatorId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - StreamingLocatorName string -} - -// NewStreamingLocatorID returns a new StreamingLocatorId struct -func NewStreamingLocatorID(subscriptionId string, resourceGroupName string, accountName string, streamingLocatorName string) StreamingLocatorId { - return StreamingLocatorId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - StreamingLocatorName: streamingLocatorName, - } -} - -// ParseStreamingLocatorID parses 'input' into a StreamingLocatorId -func ParseStreamingLocatorID(input string) (*StreamingLocatorId, error) { - parser := resourceids.NewParserFromResourceIdType(StreamingLocatorId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := StreamingLocatorId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.StreamingLocatorName, ok = parsed.Parsed["streamingLocatorName"]; !ok { - return nil, fmt.Errorf("the segment 'streamingLocatorName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseStreamingLocatorIDInsensitively parses 'input' case-insensitively into a StreamingLocatorId -// note: this method should only be used for API response data and not user input -func ParseStreamingLocatorIDInsensitively(input string) (*StreamingLocatorId, error) { - parser := resourceids.NewParserFromResourceIdType(StreamingLocatorId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := StreamingLocatorId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.StreamingLocatorName, ok = parsed.Parsed["streamingLocatorName"]; !ok { - return nil, fmt.Errorf("the segment 'streamingLocatorName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateStreamingLocatorID checks that 'input' can be parsed as a Streaming Locator ID -func ValidateStreamingLocatorID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseStreamingLocatorID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Streaming Locator ID -func (id StreamingLocatorId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/streamingLocators/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.StreamingLocatorName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Streaming Locator ID -func (id StreamingLocatorId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticStreamingLocators", "streamingLocators", "streamingLocators"), - resourceids.UserSpecifiedSegment("streamingLocatorName", "streamingLocatorValue"), - } -} - -// String returns a human-readable description of this Streaming Locator ID -func (id StreamingLocatorId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Streaming Locator Name: %q", id.StreamingLocatorName), - } - return fmt.Sprintf("Streaming Locator (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go deleted file mode 100644 index 3eedc295ee33..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go +++ /dev/null @@ -1,137 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = StreamingPolicyId{} - -// StreamingPolicyId is a struct representing the Resource ID for a Streaming Policy -type StreamingPolicyId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - StreamingPolicyName string -} - -// NewStreamingPolicyID returns a new StreamingPolicyId struct -func NewStreamingPolicyID(subscriptionId string, resourceGroupName string, accountName string, streamingPolicyName string) StreamingPolicyId { - return StreamingPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - StreamingPolicyName: streamingPolicyName, - } -} - -// ParseStreamingPolicyID parses 'input' into a StreamingPolicyId -func ParseStreamingPolicyID(input string) (*StreamingPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(StreamingPolicyId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := StreamingPolicyId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.StreamingPolicyName, ok = parsed.Parsed["streamingPolicyName"]; !ok { - return nil, fmt.Errorf("the segment 'streamingPolicyName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseStreamingPolicyIDInsensitively parses 'input' case-insensitively into a StreamingPolicyId -// note: this method should only be used for API response data and not user input -func ParseStreamingPolicyIDInsensitively(input string) (*StreamingPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(StreamingPolicyId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := StreamingPolicyId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.StreamingPolicyName, ok = parsed.Parsed["streamingPolicyName"]; !ok { - return nil, fmt.Errorf("the segment 'streamingPolicyName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateStreamingPolicyID checks that 'input' can be parsed as a Streaming Policy ID -func ValidateStreamingPolicyID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseStreamingPolicyID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Streaming Policy ID -func (id StreamingPolicyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/streamingPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.StreamingPolicyName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Streaming Policy ID -func (id StreamingPolicyId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticStreamingPolicies", "streamingPolicies", "streamingPolicies"), - resourceids.UserSpecifiedSegment("streamingPolicyName", "streamingPolicyValue"), - } -} - -// String returns a human-readable description of this Streaming Policy ID -func (id StreamingPolicyId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Streaming Policy Name: %q", id.StreamingPolicyName), - } - return fmt.Sprintf("Streaming Policy (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorscreate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorscreate_autorest.go deleted file mode 100644 index 22bc808ffce4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorscreate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingLocatorsCreateOperationResponse struct { - HttpResponse *http.Response - Model *StreamingLocator -} - -// StreamingLocatorsCreate ... -func (c StreamingPoliciesAndStreamingLocatorsClient) StreamingLocatorsCreate(ctx context.Context, id StreamingLocatorId, input StreamingLocator) (result StreamingLocatorsCreateOperationResponse, err error) { - req, err := c.preparerForStreamingLocatorsCreate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsCreate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsCreate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForStreamingLocatorsCreate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsCreate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForStreamingLocatorsCreate prepares the StreamingLocatorsCreate request. -func (c StreamingPoliciesAndStreamingLocatorsClient) preparerForStreamingLocatorsCreate(ctx context.Context, id StreamingLocatorId, input StreamingLocator) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForStreamingLocatorsCreate handles the response to the StreamingLocatorsCreate request. The method always -// closes the http.Response Body. -func (c StreamingPoliciesAndStreamingLocatorsClient) responderForStreamingLocatorsCreate(resp *http.Response) (result StreamingLocatorsCreateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorsdelete_autorest.go deleted file mode 100644 index f0013c1f5632..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorsdelete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingLocatorsDeleteOperationResponse struct { - HttpResponse *http.Response -} - -// StreamingLocatorsDelete ... -func (c StreamingPoliciesAndStreamingLocatorsClient) StreamingLocatorsDelete(ctx context.Context, id StreamingLocatorId) (result StreamingLocatorsDeleteOperationResponse, err error) { - req, err := c.preparerForStreamingLocatorsDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForStreamingLocatorsDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForStreamingLocatorsDelete prepares the StreamingLocatorsDelete request. -func (c StreamingPoliciesAndStreamingLocatorsClient) preparerForStreamingLocatorsDelete(ctx context.Context, id StreamingLocatorId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForStreamingLocatorsDelete handles the response to the StreamingLocatorsDelete request. The method always -// closes the http.Response Body. -func (c StreamingPoliciesAndStreamingLocatorsClient) responderForStreamingLocatorsDelete(resp *http.Response) (result StreamingLocatorsDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorsget_autorest.go deleted file mode 100644 index 9524359feaa7..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorsget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingLocatorsGetOperationResponse struct { - HttpResponse *http.Response - Model *StreamingLocator -} - -// StreamingLocatorsGet ... -func (c StreamingPoliciesAndStreamingLocatorsClient) StreamingLocatorsGet(ctx context.Context, id StreamingLocatorId) (result StreamingLocatorsGetOperationResponse, err error) { - req, err := c.preparerForStreamingLocatorsGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForStreamingLocatorsGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForStreamingLocatorsGet prepares the StreamingLocatorsGet request. -func (c StreamingPoliciesAndStreamingLocatorsClient) preparerForStreamingLocatorsGet(ctx context.Context, id StreamingLocatorId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForStreamingLocatorsGet handles the response to the StreamingLocatorsGet request. The method always -// closes the http.Response Body. -func (c StreamingPoliciesAndStreamingLocatorsClient) responderForStreamingLocatorsGet(resp *http.Response) (result StreamingLocatorsGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorslist_autorest.go deleted file mode 100644 index 425c4f241f4d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorslist_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingLocatorsListOperationResponse struct { - HttpResponse *http.Response - Model *[]StreamingLocator - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (StreamingLocatorsListOperationResponse, error) -} - -type StreamingLocatorsListCompleteResult struct { - Items []StreamingLocator -} - -func (r StreamingLocatorsListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r StreamingLocatorsListOperationResponse) LoadMore(ctx context.Context) (resp StreamingLocatorsListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type StreamingLocatorsListOperationOptions struct { - Filter *string - Orderby *string - Top *int64 -} - -func DefaultStreamingLocatorsListOperationOptions() StreamingLocatorsListOperationOptions { - return StreamingLocatorsListOperationOptions{} -} - -func (o StreamingLocatorsListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o StreamingLocatorsListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// StreamingLocatorsList ... -func (c StreamingPoliciesAndStreamingLocatorsClient) StreamingLocatorsList(ctx context.Context, id MediaServiceId, options StreamingLocatorsListOperationOptions) (resp StreamingLocatorsListOperationResponse, err error) { - req, err := c.preparerForStreamingLocatorsList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForStreamingLocatorsList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForStreamingLocatorsList prepares the StreamingLocatorsList request. -func (c StreamingPoliciesAndStreamingLocatorsClient) preparerForStreamingLocatorsList(ctx context.Context, id MediaServiceId, options StreamingLocatorsListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/streamingLocators", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForStreamingLocatorsListWithNextLink prepares the StreamingLocatorsList request with the given nextLink token. -func (c StreamingPoliciesAndStreamingLocatorsClient) preparerForStreamingLocatorsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForStreamingLocatorsList handles the response to the StreamingLocatorsList request. The method always -// closes the http.Response Body. -func (c StreamingPoliciesAndStreamingLocatorsClient) responderForStreamingLocatorsList(resp *http.Response) (result StreamingLocatorsListOperationResponse, err error) { - type page struct { - Values []StreamingLocator `json:"value"` - NextLink *string `json:"@odata.nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result StreamingLocatorsListOperationResponse, err error) { - req, err := c.preparerForStreamingLocatorsListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForStreamingLocatorsList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// StreamingLocatorsListComplete retrieves all of the results into a single object -func (c StreamingPoliciesAndStreamingLocatorsClient) StreamingLocatorsListComplete(ctx context.Context, id MediaServiceId, options StreamingLocatorsListOperationOptions) (StreamingLocatorsListCompleteResult, error) { - return c.StreamingLocatorsListCompleteMatchingPredicate(ctx, id, options, StreamingLocatorOperationPredicate{}) -} - -// StreamingLocatorsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c StreamingPoliciesAndStreamingLocatorsClient) StreamingLocatorsListCompleteMatchingPredicate(ctx context.Context, id MediaServiceId, options StreamingLocatorsListOperationOptions, predicate StreamingLocatorOperationPredicate) (resp StreamingLocatorsListCompleteResult, err error) { - items := make([]StreamingLocator, 0) - - page, err := c.StreamingLocatorsList(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := StreamingLocatorsListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorslistcontentkeys_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorslistcontentkeys_autorest.go deleted file mode 100644 index 1823f948254d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorslistcontentkeys_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingLocatorsListContentKeysOperationResponse struct { - HttpResponse *http.Response - Model *ListContentKeysResponse -} - -// StreamingLocatorsListContentKeys ... -func (c StreamingPoliciesAndStreamingLocatorsClient) StreamingLocatorsListContentKeys(ctx context.Context, id StreamingLocatorId) (result StreamingLocatorsListContentKeysOperationResponse, err error) { - req, err := c.preparerForStreamingLocatorsListContentKeys(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsListContentKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsListContentKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForStreamingLocatorsListContentKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsListContentKeys", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForStreamingLocatorsListContentKeys prepares the StreamingLocatorsListContentKeys request. -func (c StreamingPoliciesAndStreamingLocatorsClient) preparerForStreamingLocatorsListContentKeys(ctx context.Context, id StreamingLocatorId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listContentKeys", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForStreamingLocatorsListContentKeys handles the response to the StreamingLocatorsListContentKeys request. The method always -// closes the http.Response Body. -func (c StreamingPoliciesAndStreamingLocatorsClient) responderForStreamingLocatorsListContentKeys(resp *http.Response) (result StreamingLocatorsListContentKeysOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorslistpaths_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorslistpaths_autorest.go deleted file mode 100644 index b9df52f25685..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streaminglocatorslistpaths_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingLocatorsListPathsOperationResponse struct { - HttpResponse *http.Response - Model *ListPathsResponse -} - -// StreamingLocatorsListPaths ... -func (c StreamingPoliciesAndStreamingLocatorsClient) StreamingLocatorsListPaths(ctx context.Context, id StreamingLocatorId) (result StreamingLocatorsListPathsOperationResponse, err error) { - req, err := c.preparerForStreamingLocatorsListPaths(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsListPaths", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsListPaths", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForStreamingLocatorsListPaths(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingLocatorsListPaths", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForStreamingLocatorsListPaths prepares the StreamingLocatorsListPaths request. -func (c StreamingPoliciesAndStreamingLocatorsClient) preparerForStreamingLocatorsListPaths(ctx context.Context, id StreamingLocatorId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listPaths", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForStreamingLocatorsListPaths handles the response to the StreamingLocatorsListPaths request. The method always -// closes the http.Response Body. -func (c StreamingPoliciesAndStreamingLocatorsClient) responderForStreamingLocatorsListPaths(resp *http.Response) (result StreamingLocatorsListPathsOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streamingpoliciescreate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streamingpoliciescreate_autorest.go deleted file mode 100644 index cbae46457cfd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streamingpoliciescreate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingPoliciesCreateOperationResponse struct { - HttpResponse *http.Response - Model *StreamingPolicy -} - -// StreamingPoliciesCreate ... -func (c StreamingPoliciesAndStreamingLocatorsClient) StreamingPoliciesCreate(ctx context.Context, id StreamingPolicyId, input StreamingPolicy) (result StreamingPoliciesCreateOperationResponse, err error) { - req, err := c.preparerForStreamingPoliciesCreate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingPoliciesCreate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingPoliciesCreate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForStreamingPoliciesCreate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingPoliciesCreate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForStreamingPoliciesCreate prepares the StreamingPoliciesCreate request. -func (c StreamingPoliciesAndStreamingLocatorsClient) preparerForStreamingPoliciesCreate(ctx context.Context, id StreamingPolicyId, input StreamingPolicy) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForStreamingPoliciesCreate handles the response to the StreamingPoliciesCreate request. The method always -// closes the http.Response Body. -func (c StreamingPoliciesAndStreamingLocatorsClient) responderForStreamingPoliciesCreate(resp *http.Response) (result StreamingPoliciesCreateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streamingpoliciesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streamingpoliciesdelete_autorest.go deleted file mode 100644 index cb3a9ad04750..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streamingpoliciesdelete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingPoliciesDeleteOperationResponse struct { - HttpResponse *http.Response -} - -// StreamingPoliciesDelete ... -func (c StreamingPoliciesAndStreamingLocatorsClient) StreamingPoliciesDelete(ctx context.Context, id StreamingPolicyId) (result StreamingPoliciesDeleteOperationResponse, err error) { - req, err := c.preparerForStreamingPoliciesDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingPoliciesDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingPoliciesDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForStreamingPoliciesDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingPoliciesDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForStreamingPoliciesDelete prepares the StreamingPoliciesDelete request. -func (c StreamingPoliciesAndStreamingLocatorsClient) preparerForStreamingPoliciesDelete(ctx context.Context, id StreamingPolicyId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForStreamingPoliciesDelete handles the response to the StreamingPoliciesDelete request. The method always -// closes the http.Response Body. -func (c StreamingPoliciesAndStreamingLocatorsClient) responderForStreamingPoliciesDelete(resp *http.Response) (result StreamingPoliciesDeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streamingpoliciesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streamingpoliciesget_autorest.go deleted file mode 100644 index 7af2ac9158d8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streamingpoliciesget_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingPoliciesGetOperationResponse struct { - HttpResponse *http.Response - Model *StreamingPolicy -} - -// StreamingPoliciesGet ... -func (c StreamingPoliciesAndStreamingLocatorsClient) StreamingPoliciesGet(ctx context.Context, id StreamingPolicyId) (result StreamingPoliciesGetOperationResponse, err error) { - req, err := c.preparerForStreamingPoliciesGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingPoliciesGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingPoliciesGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForStreamingPoliciesGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingPoliciesGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForStreamingPoliciesGet prepares the StreamingPoliciesGet request. -func (c StreamingPoliciesAndStreamingLocatorsClient) preparerForStreamingPoliciesGet(ctx context.Context, id StreamingPolicyId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForStreamingPoliciesGet handles the response to the StreamingPoliciesGet request. The method always -// closes the http.Response Body. -func (c StreamingPoliciesAndStreamingLocatorsClient) responderForStreamingPoliciesGet(resp *http.Response) (result StreamingPoliciesGetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streamingpolicieslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streamingpolicieslist_autorest.go deleted file mode 100644 index 8b9914debfbd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/method_streamingpolicieslist_autorest.go +++ /dev/null @@ -1,225 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingPoliciesListOperationResponse struct { - HttpResponse *http.Response - Model *[]StreamingPolicy - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (StreamingPoliciesListOperationResponse, error) -} - -type StreamingPoliciesListCompleteResult struct { - Items []StreamingPolicy -} - -func (r StreamingPoliciesListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r StreamingPoliciesListOperationResponse) LoadMore(ctx context.Context) (resp StreamingPoliciesListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type StreamingPoliciesListOperationOptions struct { - Filter *string - Orderby *string - Top *int64 -} - -func DefaultStreamingPoliciesListOperationOptions() StreamingPoliciesListOperationOptions { - return StreamingPoliciesListOperationOptions{} -} - -func (o StreamingPoliciesListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o StreamingPoliciesListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// StreamingPoliciesList ... -func (c StreamingPoliciesAndStreamingLocatorsClient) StreamingPoliciesList(ctx context.Context, id MediaServiceId, options StreamingPoliciesListOperationOptions) (resp StreamingPoliciesListOperationResponse, err error) { - req, err := c.preparerForStreamingPoliciesList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingPoliciesList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingPoliciesList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForStreamingPoliciesList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingPoliciesList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForStreamingPoliciesList prepares the StreamingPoliciesList request. -func (c StreamingPoliciesAndStreamingLocatorsClient) preparerForStreamingPoliciesList(ctx context.Context, id MediaServiceId, options StreamingPoliciesListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/streamingPolicies", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForStreamingPoliciesListWithNextLink prepares the StreamingPoliciesList request with the given nextLink token. -func (c StreamingPoliciesAndStreamingLocatorsClient) preparerForStreamingPoliciesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForStreamingPoliciesList handles the response to the StreamingPoliciesList request. The method always -// closes the http.Response Body. -func (c StreamingPoliciesAndStreamingLocatorsClient) responderForStreamingPoliciesList(resp *http.Response) (result StreamingPoliciesListOperationResponse, err error) { - type page struct { - Values []StreamingPolicy `json:"value"` - NextLink *string `json:"@odata.nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result StreamingPoliciesListOperationResponse, err error) { - req, err := c.preparerForStreamingPoliciesListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingPoliciesList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingPoliciesList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForStreamingPoliciesList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient", "StreamingPoliciesList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// StreamingPoliciesListComplete retrieves all of the results into a single object -func (c StreamingPoliciesAndStreamingLocatorsClient) StreamingPoliciesListComplete(ctx context.Context, id MediaServiceId, options StreamingPoliciesListOperationOptions) (StreamingPoliciesListCompleteResult, error) { - return c.StreamingPoliciesListCompleteMatchingPredicate(ctx, id, options, StreamingPolicyOperationPredicate{}) -} - -// StreamingPoliciesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c StreamingPoliciesAndStreamingLocatorsClient) StreamingPoliciesListCompleteMatchingPredicate(ctx context.Context, id MediaServiceId, options StreamingPoliciesListOperationOptions, predicate StreamingPolicyOperationPredicate) (resp StreamingPoliciesListCompleteResult, err error) { - items := make([]StreamingPolicy, 0) - - page, err := c.StreamingPoliciesList(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := StreamingPoliciesListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_cbcsdrmconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_cbcsdrmconfiguration.go deleted file mode 100644 index ae2f7e2f7b93..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_cbcsdrmconfiguration.go +++ /dev/null @@ -1,10 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CbcsDrmConfiguration struct { - FairPlay *StreamingPolicyFairPlayConfiguration `json:"fairPlay,omitempty"` - PlayReady *StreamingPolicyPlayReadyConfiguration `json:"playReady,omitempty"` - Widevine *StreamingPolicyWidevineConfiguration `json:"widevine,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_cencdrmconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_cencdrmconfiguration.go deleted file mode 100644 index 303f7515a8ba..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_cencdrmconfiguration.go +++ /dev/null @@ -1,9 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CencDrmConfiguration struct { - PlayReady *StreamingPolicyPlayReadyConfiguration `json:"playReady,omitempty"` - Widevine *StreamingPolicyWidevineConfiguration `json:"widevine,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_commonencryptioncbcs.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_commonencryptioncbcs.go deleted file mode 100644 index 53f1c51ac43a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_commonencryptioncbcs.go +++ /dev/null @@ -1,11 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CommonEncryptionCbcs struct { - ClearTracks *[]TrackSelection `json:"clearTracks,omitempty"` - ContentKeys *StreamingPolicyContentKeys `json:"contentKeys,omitempty"` - Drm *CbcsDrmConfiguration `json:"drm,omitempty"` - EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_commonencryptioncenc.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_commonencryptioncenc.go deleted file mode 100644 index 35fc2df90b12..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_commonencryptioncenc.go +++ /dev/null @@ -1,11 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CommonEncryptionCenc struct { - ClearTracks *[]TrackSelection `json:"clearTracks,omitempty"` - ContentKeys *StreamingPolicyContentKeys `json:"contentKeys,omitempty"` - Drm *CencDrmConfiguration `json:"drm,omitempty"` - EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_defaultkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_defaultkey.go deleted file mode 100644 index 45346db27997..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_defaultkey.go +++ /dev/null @@ -1,9 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DefaultKey struct { - Label *string `json:"label,omitempty"` - PolicyName *string `json:"policyName,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_enabledprotocols.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_enabledprotocols.go deleted file mode 100644 index 6df37395ce29..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_enabledprotocols.go +++ /dev/null @@ -1,11 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EnabledProtocols struct { - Dash bool `json:"dash"` - Download bool `json:"download"` - Hls bool `json:"hls"` - SmoothStreaming bool `json:"smoothStreaming"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_envelopeencryption.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_envelopeencryption.go deleted file mode 100644 index 2d05cea4b5ab..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_envelopeencryption.go +++ /dev/null @@ -1,11 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EnvelopeEncryption struct { - ClearTracks *[]TrackSelection `json:"clearTracks,omitempty"` - ContentKeys *StreamingPolicyContentKeys `json:"contentKeys,omitempty"` - CustomKeyAcquisitionUrlTemplate *string `json:"customKeyAcquisitionUrlTemplate,omitempty"` - EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_listcontentkeysresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_listcontentkeysresponse.go deleted file mode 100644 index 9947072e63d6..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_listcontentkeysresponse.go +++ /dev/null @@ -1,8 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListContentKeysResponse struct { - ContentKeys *[]StreamingLocatorContentKey `json:"contentKeys,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_listpathsresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_listpathsresponse.go deleted file mode 100644 index dc2d9ca8c659..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_listpathsresponse.go +++ /dev/null @@ -1,9 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListPathsResponse struct { - DownloadPaths *[]string `json:"downloadPaths,omitempty"` - StreamingPaths *[]StreamingPath `json:"streamingPaths,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_noencryption.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_noencryption.go deleted file mode 100644 index e011fdc6e91c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_noencryption.go +++ /dev/null @@ -1,8 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type NoEncryption struct { - EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streaminglocator.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streaminglocator.go deleted file mode 100644 index dfba5540db69..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streaminglocator.go +++ /dev/null @@ -1,16 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingLocator struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *StreamingLocatorProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streaminglocatorcontentkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streaminglocatorcontentkey.go deleted file mode 100644 index 52c78e6e9237..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streaminglocatorcontentkey.go +++ /dev/null @@ -1,13 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingLocatorContentKey struct { - Id string `json:"id"` - LabelReferenceInStreamingPolicy *string `json:"labelReferenceInStreamingPolicy,omitempty"` - PolicyName *string `json:"policyName,omitempty"` - Tracks *[]TrackSelection `json:"tracks,omitempty"` - Type *StreamingLocatorContentKeyType `json:"type,omitempty"` - Value *string `json:"value,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streaminglocatorproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streaminglocatorproperties.go deleted file mode 100644 index e9123bd921fa..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streaminglocatorproperties.go +++ /dev/null @@ -1,59 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingLocatorProperties struct { - AlternativeMediaId *string `json:"alternativeMediaId,omitempty"` - AssetName string `json:"assetName"` - ContentKeys *[]StreamingLocatorContentKey `json:"contentKeys,omitempty"` - Created *string `json:"created,omitempty"` - DefaultContentKeyPolicyName *string `json:"defaultContentKeyPolicyName,omitempty"` - EndTime *string `json:"endTime,omitempty"` - Filters *[]string `json:"filters,omitempty"` - StartTime *string `json:"startTime,omitempty"` - StreamingLocatorId *string `json:"streamingLocatorId,omitempty"` - StreamingPolicyName string `json:"streamingPolicyName"` -} - -func (o *StreamingLocatorProperties) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *StreamingLocatorProperties) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} - -func (o *StreamingLocatorProperties) GetEndTimeAsTime() (*time.Time, error) { - if o.EndTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") -} - -func (o *StreamingLocatorProperties) SetEndTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.EndTime = &formatted -} - -func (o *StreamingLocatorProperties) GetStartTimeAsTime() (*time.Time, error) { - if o.StartTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") -} - -func (o *StreamingLocatorProperties) SetStartTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.StartTime = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpath.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpath.go deleted file mode 100644 index 72efd8a9aa27..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpath.go +++ /dev/null @@ -1,10 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingPath struct { - EncryptionScheme EncryptionScheme `json:"encryptionScheme"` - Paths *[]string `json:"paths,omitempty"` - StreamingProtocol StreamingPolicyStreamingProtocol `json:"streamingProtocol"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicy.go deleted file mode 100644 index 3dd17c801455..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicy.go +++ /dev/null @@ -1,16 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingPolicy struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *StreamingPolicyProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicycontentkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicycontentkey.go deleted file mode 100644 index 2b8ff87e7686..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicycontentkey.go +++ /dev/null @@ -1,10 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingPolicyContentKey struct { - Label *string `json:"label,omitempty"` - PolicyName *string `json:"policyName,omitempty"` - Tracks *[]TrackSelection `json:"tracks,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicycontentkeys.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicycontentkeys.go deleted file mode 100644 index 89fc35580ed8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicycontentkeys.go +++ /dev/null @@ -1,9 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingPolicyContentKeys struct { - DefaultKey *DefaultKey `json:"defaultKey,omitempty"` - KeyToTrackMappings *[]StreamingPolicyContentKey `json:"keyToTrackMappings,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicyfairplayconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicyfairplayconfiguration.go deleted file mode 100644 index 08017c68e806..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicyfairplayconfiguration.go +++ /dev/null @@ -1,9 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingPolicyFairPlayConfiguration struct { - AllowPersistentLicense bool `json:"allowPersistentLicense"` - CustomLicenseAcquisitionUrlTemplate *string `json:"customLicenseAcquisitionUrlTemplate,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicyplayreadyconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicyplayreadyconfiguration.go deleted file mode 100644 index 45d779f1602e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicyplayreadyconfiguration.go +++ /dev/null @@ -1,9 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingPolicyPlayReadyConfiguration struct { - CustomLicenseAcquisitionUrlTemplate *string `json:"customLicenseAcquisitionUrlTemplate,omitempty"` - PlayReadyCustomAttributes *string `json:"playReadyCustomAttributes,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicyproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicyproperties.go deleted file mode 100644 index 69fbe59729b5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicyproperties.go +++ /dev/null @@ -1,31 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingPolicyProperties struct { - CommonEncryptionCbcs *CommonEncryptionCbcs `json:"commonEncryptionCbcs,omitempty"` - CommonEncryptionCenc *CommonEncryptionCenc `json:"commonEncryptionCenc,omitempty"` - Created *string `json:"created,omitempty"` - DefaultContentKeyPolicyName *string `json:"defaultContentKeyPolicyName,omitempty"` - EnvelopeEncryption *EnvelopeEncryption `json:"envelopeEncryption,omitempty"` - NoEncryption *NoEncryption `json:"noEncryption,omitempty"` -} - -func (o *StreamingPolicyProperties) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *StreamingPolicyProperties) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicywidevineconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicywidevineconfiguration.go deleted file mode 100644 index 2d2ec405fb18..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_streamingpolicywidevineconfiguration.go +++ /dev/null @@ -1,8 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingPolicyWidevineConfiguration struct { - CustomLicenseAcquisitionUrlTemplate *string `json:"customLicenseAcquisitionUrlTemplate,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_trackpropertycondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_trackpropertycondition.go deleted file mode 100644 index 798b212d07ce..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_trackpropertycondition.go +++ /dev/null @@ -1,10 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TrackPropertyCondition struct { - Operation TrackPropertyCompareOperation `json:"operation"` - Property TrackPropertyType `json:"property"` - Value *string `json:"value,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_trackselection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_trackselection.go deleted file mode 100644 index be9009cc09e5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/model_trackselection.go +++ /dev/null @@ -1,8 +0,0 @@ -package streamingpoliciesandstreaminglocators - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TrackSelection struct { - TrackSelections *[]TrackPropertyCondition `json:"trackSelections,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/predicates.go deleted file mode 100644 index 54331e7e8763..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/predicates.go +++ /dev/null @@ -1,47 +0,0 @@ -package streamingpoliciesandstreaminglocators - -type StreamingLocatorOperationPredicate struct { - Id *string - Name *string - Type *string -} - -func (p StreamingLocatorOperationPredicate) Matches(input StreamingLocator) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} - -type StreamingPolicyOperationPredicate struct { - Id *string - Name *string - Type *string -} - -func (p StreamingPolicyOperationPredicate) Matches(input StreamingPolicy) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/version.go deleted file mode 100644 index d006e5a9c5ea..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package streamingpoliciesandstreaminglocators - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2020-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/streamingpoliciesandstreaminglocators/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accountfilters/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accountfilters/README.md index a1748da69d45..11a9b053d519 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accountfilters/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accountfilters/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "filterValue") +id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "accountFilterValue") payload := accountfilters.AccountFilter{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "filterValue") +id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "accountFilterValue") read, err := client.AccountFiltersDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "filterValue") +id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "accountFilterValue") read, err := client.AccountFiltersGet(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := accountfilters.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := accountfilters.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") // alternatively `client.AccountFiltersList(ctx, id)` can be used to do batched pagination items, err := client.AccountFiltersListComplete(ctx, id) @@ -94,7 +94,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "filterValue") +id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "accountFilterValue") payload := accountfilters.AccountFilter{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accountfilters/id_accountfilter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accountfilters/id_accountfilter.go index 30c106c73d5c..55c7c259c307 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accountfilters/id_accountfilter.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accountfilters/id_accountfilter.go @@ -13,17 +13,17 @@ var _ resourceids.ResourceId = AccountFilterId{} type AccountFilterId struct { SubscriptionId string ResourceGroupName string - AccountName string - FilterName string + MediaServiceName string + AccountFilterName string } // NewAccountFilterID returns a new AccountFilterId struct -func NewAccountFilterID(subscriptionId string, resourceGroupName string, accountName string, filterName string) AccountFilterId { +func NewAccountFilterID(subscriptionId string, resourceGroupName string, mediaServiceName string, accountFilterName string) AccountFilterId { return AccountFilterId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, - FilterName: filterName, + MediaServiceName: mediaServiceName, + AccountFilterName: accountFilterName, } } @@ -46,12 +46,12 @@ func ParseAccountFilterID(input string) (*AccountFilterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } - if id.FilterName, ok = parsed.Parsed["filterName"]; !ok { - return nil, fmt.Errorf("the segment 'filterName' was not found in the resource id %q", input) + if id.AccountFilterName, ok = parsed.Parsed["accountFilterName"]; !ok { + return nil, fmt.Errorf("the segment 'accountFilterName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseAccountFilterIDInsensitively(input string) (*AccountFilterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } - if id.FilterName, ok = parsed.Parsed["filterName"]; !ok { - return nil, fmt.Errorf("the segment 'filterName' was not found in the resource id %q", input) + if id.AccountFilterName, ok = parsed.Parsed["accountFilterName"]; !ok { + return nil, fmt.Errorf("the segment 'accountFilterName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateAccountFilterID(input interface{}, key string) (warnings []string, // ID returns the formatted Account Filter ID func (id AccountFilterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/accountFilters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.FilterName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.AccountFilterName) } // Segments returns a slice of Resource ID Segments which comprise this Account Filter ID @@ -119,9 +119,9 @@ func (id AccountFilterId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticAccountFilters", "accountFilters", "accountFilters"), - resourceids.UserSpecifiedSegment("filterName", "filterValue"), + resourceids.UserSpecifiedSegment("accountFilterName", "accountFilterValue"), } } @@ -130,8 +130,8 @@ func (id AccountFilterId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Filter Name: %q", id.FilterName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), + fmt.Sprintf("Account Filter Name: %q", id.AccountFilterName), } return fmt.Sprintf("Account Filter (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accountfilters/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accountfilters/id_mediaservice.go index df615056343f..2354e3c5253b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accountfilters/id_mediaservice.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accountfilters/id_mediaservice.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = MediaServiceId{} type MediaServiceId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string } // NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { +func NewMediaServiceID(subscriptionId string, resourceGroupName string, mediaServiceName string) MediaServiceId { return MediaServiceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, } } @@ -44,8 +44,8 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateMediaServiceID(input interface{}, key string) (warnings []string, e // ID returns the formatted Media Service ID func (id MediaServiceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName) } // Segments returns a slice of Resource ID Segments which comprise this Media Service ID @@ -109,7 +109,7 @@ func (id MediaServiceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), } } @@ -118,7 +118,7 @@ func (id MediaServiceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), } return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/README.md index 0b759bb3508d..8f5dbed22430 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/README.md @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") payload := accounts.MediaService{ // ... @@ -94,7 +94,7 @@ if err := client.MediaservicesCreateOrUpdateThenPoll(ctx, id, payload); err != n ```go ctx := context.TODO() -id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") read, err := client.MediaservicesDelete(ctx, id) if err != nil { @@ -110,7 +110,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") read, err := client.MediaservicesGet(ctx, id) if err != nil { @@ -160,7 +160,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") payload := accounts.ListEdgePoliciesInput{ // ... @@ -181,7 +181,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") payload := accounts.SyncStorageKeysInput{ // ... @@ -202,7 +202,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") payload := accounts.MediaServiceUpdate{ // ... @@ -219,7 +219,7 @@ if err := client.MediaservicesUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := accounts.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "nameValue") +id := accounts.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "privateEndpointConnectionValue") payload := accounts.PrivateEndpointConnection{ // ... @@ -240,7 +240,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := accounts.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "nameValue") +id := accounts.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "privateEndpointConnectionValue") read, err := client.PrivateEndpointConnectionsDelete(ctx, id) if err != nil { @@ -256,7 +256,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := accounts.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "nameValue") +id := accounts.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "privateEndpointConnectionValue") read, err := client.PrivateEndpointConnectionsGet(ctx, id) if err != nil { @@ -272,7 +272,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") read, err := client.PrivateEndpointConnectionsList(ctx, id) if err != nil { @@ -288,7 +288,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := accounts.NewPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "nameValue") +id := accounts.NewPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "privateLinkResourceValue") read, err := client.PrivateLinkResourcesGet(ctx, id) if err != nil { @@ -304,7 +304,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := accounts.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") read, err := client.PrivateLinkResourcesList(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/id_mediaservice.go index f7445a5fe4c4..01b0194d73f3 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/id_mediaservice.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/id_mediaservice.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = MediaServiceId{} type MediaServiceId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string } // NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { +func NewMediaServiceID(subscriptionId string, resourceGroupName string, mediaServiceName string) MediaServiceId { return MediaServiceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, } } @@ -44,8 +44,8 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateMediaServiceID(input interface{}, key string) (warnings []string, e // ID returns the formatted Media Service ID func (id MediaServiceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName) } // Segments returns a slice of Resource ID Segments which comprise this Media Service ID @@ -109,7 +109,7 @@ func (id MediaServiceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), } } @@ -118,7 +118,7 @@ func (id MediaServiceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), } return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/id_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/id_privateendpointconnection.go index 829f99616f0a..91ac4154975f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/id_privateendpointconnection.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/id_privateendpointconnection.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = PrivateEndpointConnectionId{} // PrivateEndpointConnectionId is a struct representing the Resource ID for a Private Endpoint Connection type PrivateEndpointConnectionId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - Name string + SubscriptionId string + ResourceGroupName string + MediaServiceName string + PrivateEndpointConnectionName string } // NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct -func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, accountName string, name string) PrivateEndpointConnectionId { +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, mediaServiceName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { return PrivateEndpointConnectionId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - Name: name, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MediaServiceName: mediaServiceName, + PrivateEndpointConnectionName: privateEndpointConnectionName, } } @@ -46,12 +46,12 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidatePrivateEndpointConnectionID(input interface{}, key string) (warning // ID returns the formatted Private Endpoint Connection ID func (id PrivateEndpointConnectionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/privateEndpointConnections/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.Name) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.PrivateEndpointConnectionName) } // Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID @@ -119,9 +119,9 @@ func (id PrivateEndpointConnectionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), - resourceids.UserSpecifiedSegment("name", "nameValue"), + resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionValue"), } } @@ -130,8 +130,8 @@ func (id PrivateEndpointConnectionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Name: %q", id.Name), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), + fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), } return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/id_privatelinkresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/id_privatelinkresource.go index 3c5e0da14859..2a2198185bbf 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/id_privatelinkresource.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts/id_privatelinkresource.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = PrivateLinkResourceId{} // PrivateLinkResourceId is a struct representing the Resource ID for a Private Link Resource type PrivateLinkResourceId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - Name string + SubscriptionId string + ResourceGroupName string + MediaServiceName string + PrivateLinkResourceName string } // NewPrivateLinkResourceID returns a new PrivateLinkResourceId struct -func NewPrivateLinkResourceID(subscriptionId string, resourceGroupName string, accountName string, name string) PrivateLinkResourceId { +func NewPrivateLinkResourceID(subscriptionId string, resourceGroupName string, mediaServiceName string, privateLinkResourceName string) PrivateLinkResourceId { return PrivateLinkResourceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - Name: name, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MediaServiceName: mediaServiceName, + PrivateLinkResourceName: privateLinkResourceName, } } @@ -46,12 +46,12 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { + return nil, fmt.Errorf("the segment 'privateLinkResourceName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { + return nil, fmt.Errorf("the segment 'privateLinkResourceName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidatePrivateLinkResourceID(input interface{}, key string) (warnings []st // ID returns the formatted Private Link Resource ID func (id PrivateLinkResourceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/privateLinkResources/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.Name) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.PrivateLinkResourceName) } // Segments returns a slice of Resource ID Segments which comprise this Private Link Resource ID @@ -119,9 +119,9 @@ func (id PrivateLinkResourceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticPrivateLinkResources", "privateLinkResources", "privateLinkResources"), - resourceids.UserSpecifiedSegment("name", "nameValue"), + resourceids.UserSpecifiedSegment("privateLinkResourceName", "privateLinkResourceValue"), } } @@ -130,8 +130,8 @@ func (id PrivateLinkResourceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Name: %q", id.Name), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), + fmt.Sprintf("Private Link Resource Name: %q", id.PrivateLinkResourceName), } return fmt.Sprintf("Private Link Resource (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/README.md index 75a74d5342ab..d93fecd494b1 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "filterValue") +id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "assetFilterValue") payload := assetsandassetfilters.AssetFilter{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "filterValue") +id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "assetFilterValue") read, err := client.AssetFiltersDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "filterValue") +id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "assetFilterValue") read, err := client.AssetFiltersGet(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") // alternatively `client.AssetFiltersList(ctx, id)` can be used to do batched pagination items, err := client.AssetFiltersListComplete(ctx, id) @@ -94,7 +94,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "filterValue") +id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "assetFilterValue") payload := assetsandassetfilters.AssetFilter{ // ... @@ -115,7 +115,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") payload := assetsandassetfilters.Asset{ // ... @@ -136,7 +136,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") read, err := client.AssetsDelete(ctx, id) if err != nil { @@ -152,7 +152,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") read, err := client.AssetsGet(ctx, id) if err != nil { @@ -168,7 +168,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") read, err := client.AssetsGetEncryptionKey(ctx, id) if err != nil { @@ -184,7 +184,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := assetsandassetfilters.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") // alternatively `client.AssetsList(ctx, id, assetsandassetfilters.DefaultAssetsListOperationOptions())` can be used to do batched pagination items, err := client.AssetsListComplete(ctx, id, assetsandassetfilters.DefaultAssetsListOperationOptions()) @@ -201,7 +201,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") payload := assetsandassetfilters.ListContainerSasInput{ // ... @@ -222,7 +222,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") read, err := client.AssetsListStreamingLocators(ctx, id) if err != nil { @@ -238,7 +238,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") payload := assetsandassetfilters.Asset{ // ... @@ -259,7 +259,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "trackValue") +id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "trackValue") payload := assetsandassetfilters.AssetTrack{ // ... @@ -276,7 +276,7 @@ if err := client.TracksCreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "trackValue") +id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "trackValue") if err := client.TracksDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -288,7 +288,7 @@ if err := client.TracksDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "trackValue") +id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "trackValue") read, err := client.TracksGet(ctx, id) if err != nil { @@ -304,7 +304,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") read, err := client.TracksList(ctx, id) if err != nil { @@ -320,7 +320,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "trackValue") +id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "trackValue") payload := assetsandassetfilters.AssetTrack{ // ... @@ -337,7 +337,7 @@ if err := client.TracksUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "trackValue") +id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "trackValue") if err := client.TracksUpdateTrackDataThenPoll(ctx, id); err != nil { // handle the error diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_asset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_asset.go index c21b31a08816..0102e8dc7313 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_asset.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_asset.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = AssetId{} type AssetId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string AssetName string } // NewAssetID returns a new AssetId struct -func NewAssetID(subscriptionId string, resourceGroupName string, accountName string, assetName string) AssetId { +func NewAssetID(subscriptionId string, resourceGroupName string, mediaServiceName string, assetName string) AssetId { return AssetId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, AssetName: assetName, } } @@ -46,8 +46,8 @@ func ParseAssetID(input string) (*AssetId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { @@ -77,8 +77,8 @@ func ParseAssetIDInsensitively(input string) (*AssetId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { @@ -106,7 +106,7 @@ func ValidateAssetID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Asset ID func (id AssetId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/assets/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.AssetName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.AssetName) } // Segments returns a slice of Resource ID Segments which comprise this Asset ID @@ -119,7 +119,7 @@ func (id AssetId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticAssets", "assets", "assets"), resourceids.UserSpecifiedSegment("assetName", "assetValue"), } @@ -130,7 +130,7 @@ func (id AssetId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Asset Name: %q", id.AssetName), } return fmt.Sprintf("Asset (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_assetfilter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_assetfilter.go index bfb937131a6e..3f230a8f82c7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_assetfilter.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_assetfilter.go @@ -13,19 +13,19 @@ var _ resourceids.ResourceId = AssetFilterId{} type AssetFilterId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string AssetName string - FilterName string + AssetFilterName string } // NewAssetFilterID returns a new AssetFilterId struct -func NewAssetFilterID(subscriptionId string, resourceGroupName string, accountName string, assetName string, filterName string) AssetFilterId { +func NewAssetFilterID(subscriptionId string, resourceGroupName string, mediaServiceName string, assetName string, assetFilterName string) AssetFilterId { return AssetFilterId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, AssetName: assetName, - FilterName: filterName, + AssetFilterName: assetFilterName, } } @@ -48,16 +48,16 @@ func ParseAssetFilterID(input string) (*AssetFilterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { return nil, fmt.Errorf("the segment 'assetName' was not found in the resource id %q", input) } - if id.FilterName, ok = parsed.Parsed["filterName"]; !ok { - return nil, fmt.Errorf("the segment 'filterName' was not found in the resource id %q", input) + if id.AssetFilterName, ok = parsed.Parsed["assetFilterName"]; !ok { + return nil, fmt.Errorf("the segment 'assetFilterName' was not found in the resource id %q", input) } return &id, nil @@ -83,16 +83,16 @@ func ParseAssetFilterIDInsensitively(input string) (*AssetFilterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { return nil, fmt.Errorf("the segment 'assetName' was not found in the resource id %q", input) } - if id.FilterName, ok = parsed.Parsed["filterName"]; !ok { - return nil, fmt.Errorf("the segment 'filterName' was not found in the resource id %q", input) + if id.AssetFilterName, ok = parsed.Parsed["assetFilterName"]; !ok { + return nil, fmt.Errorf("the segment 'assetFilterName' was not found in the resource id %q", input) } return &id, nil @@ -116,7 +116,7 @@ func ValidateAssetFilterID(input interface{}, key string) (warnings []string, er // ID returns the formatted Asset Filter ID func (id AssetFilterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/assets/%s/assetFilters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.AssetName, id.FilterName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.AssetName, id.AssetFilterName) } // Segments returns a slice of Resource ID Segments which comprise this Asset Filter ID @@ -129,11 +129,11 @@ func (id AssetFilterId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticAssets", "assets", "assets"), resourceids.UserSpecifiedSegment("assetName", "assetValue"), resourceids.StaticSegment("staticAssetFilters", "assetFilters", "assetFilters"), - resourceids.UserSpecifiedSegment("filterName", "filterValue"), + resourceids.UserSpecifiedSegment("assetFilterName", "assetFilterValue"), } } @@ -142,9 +142,9 @@ func (id AssetFilterId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Asset Name: %q", id.AssetName), - fmt.Sprintf("Filter Name: %q", id.FilterName), + fmt.Sprintf("Asset Filter Name: %q", id.AssetFilterName), } return fmt.Sprintf("Asset Filter (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_mediaservice.go index bb819030c758..03495a732374 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_mediaservice.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_mediaservice.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = MediaServiceId{} type MediaServiceId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string } // NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { +func NewMediaServiceID(subscriptionId string, resourceGroupName string, mediaServiceName string) MediaServiceId { return MediaServiceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, } } @@ -44,8 +44,8 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateMediaServiceID(input interface{}, key string) (warnings []string, e // ID returns the formatted Media Service ID func (id MediaServiceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName) } // Segments returns a slice of Resource ID Segments which comprise this Media Service ID @@ -109,7 +109,7 @@ func (id MediaServiceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), } } @@ -118,7 +118,7 @@ func (id MediaServiceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), } return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_track.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_track.go index 51caa833fb6e..192ac9625d28 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_track.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/assetsandassetfilters/id_track.go @@ -13,17 +13,17 @@ var _ resourceids.ResourceId = TrackId{} type TrackId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string AssetName string TrackName string } // NewTrackID returns a new TrackId struct -func NewTrackID(subscriptionId string, resourceGroupName string, accountName string, assetName string, trackName string) TrackId { +func NewTrackID(subscriptionId string, resourceGroupName string, mediaServiceName string, assetName string, trackName string) TrackId { return TrackId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, AssetName: assetName, TrackName: trackName, } @@ -48,8 +48,8 @@ func ParseTrackID(input string) (*TrackId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { @@ -83,8 +83,8 @@ func ParseTrackIDInsensitively(input string) (*TrackId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { @@ -116,7 +116,7 @@ func ValidateTrackID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Track ID func (id TrackId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/assets/%s/tracks/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.AssetName, id.TrackName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.AssetName, id.TrackName) } // Segments returns a slice of Resource ID Segments which comprise this Track ID @@ -129,7 +129,7 @@ func (id TrackId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticAssets", "assets", "assets"), resourceids.UserSpecifiedSegment("assetName", "assetValue"), resourceids.StaticSegment("staticTracks", "tracks", "tracks"), @@ -142,7 +142,7 @@ func (id TrackId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Asset Name: %q", id.AssetName), fmt.Sprintf("Track Name: %q", id.TrackName), } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/client.go index d3cf517ce685..5eb4d9499fc4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/client.go @@ -9,7 +9,6 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings" "github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveevents" "github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveoutputs" - "github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint" "github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints" "github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators" ) @@ -22,7 +21,6 @@ type Client struct { Encodings *encodings.EncodingsClient LiveEvents *liveevents.LiveEventsClient LiveOutputs *liveoutputs.LiveOutputsClient - StreamingEndpoint *streamingendpoint.StreamingEndpointClient StreamingEndpoints *streamingendpoints.StreamingEndpointsClient StreamingPoliciesAndStreamingLocators *streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient } @@ -50,9 +48,6 @@ func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Cl liveOutputsClient := liveoutputs.NewLiveOutputsClientWithBaseURI(endpoint) configureAuthFunc(&liveOutputsClient.Client) - streamingEndpointClient := streamingendpoint.NewStreamingEndpointClientWithBaseURI(endpoint) - configureAuthFunc(&streamingEndpointClient.Client) - streamingEndpointsClient := streamingendpoints.NewStreamingEndpointsClientWithBaseURI(endpoint) configureAuthFunc(&streamingEndpointsClient.Client) @@ -67,7 +62,6 @@ func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Cl Encodings: &encodingsClient, LiveEvents: &liveEventsClient, LiveOutputs: &liveOutputsClient, - StreamingEndpoint: &streamingEndpointClient, StreamingEndpoints: &streamingEndpointsClient, StreamingPoliciesAndStreamingLocators: &streamingPoliciesAndStreamingLocatorsClient, } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/contentkeypolicies/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/contentkeypolicies/README.md index ef90e9c5a796..b3ba48574cbb 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/contentkeypolicies/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/contentkeypolicies/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "contentKeyPolicyValue") +id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "contentKeyPolicyValue") payload := contentkeypolicies.ContentKeyPolicy{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "contentKeyPolicyValue") +id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "contentKeyPolicyValue") read, err := client.ContentKeyPoliciesDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "contentKeyPolicyValue") +id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "contentKeyPolicyValue") read, err := client.ContentKeyPoliciesGet(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "contentKeyPolicyValue") +id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "contentKeyPolicyValue") read, err := client.ContentKeyPoliciesGetPolicyPropertiesWithSecrets(ctx, id) if err != nil { @@ -93,7 +93,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := contentkeypolicies.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := contentkeypolicies.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") // alternatively `client.ContentKeyPoliciesList(ctx, id, contentkeypolicies.DefaultContentKeyPoliciesListOperationOptions())` can be used to do batched pagination items, err := client.ContentKeyPoliciesListComplete(ctx, id, contentkeypolicies.DefaultContentKeyPoliciesListOperationOptions()) @@ -110,7 +110,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "contentKeyPolicyValue") +id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "contentKeyPolicyValue") payload := contentkeypolicies.ContentKeyPolicy{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/contentkeypolicies/id_contentkeypolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/contentkeypolicies/id_contentkeypolicy.go index 4a2d8a84d053..4df3f4179d65 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/contentkeypolicies/id_contentkeypolicy.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/contentkeypolicies/id_contentkeypolicy.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = ContentKeyPolicyId{} type ContentKeyPolicyId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string ContentKeyPolicyName string } // NewContentKeyPolicyID returns a new ContentKeyPolicyId struct -func NewContentKeyPolicyID(subscriptionId string, resourceGroupName string, accountName string, contentKeyPolicyName string) ContentKeyPolicyId { +func NewContentKeyPolicyID(subscriptionId string, resourceGroupName string, mediaServiceName string, contentKeyPolicyName string) ContentKeyPolicyId { return ContentKeyPolicyId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, ContentKeyPolicyName: contentKeyPolicyName, } } @@ -46,8 +46,8 @@ func ParseContentKeyPolicyID(input string) (*ContentKeyPolicyId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.ContentKeyPolicyName, ok = parsed.Parsed["contentKeyPolicyName"]; !ok { @@ -77,8 +77,8 @@ func ParseContentKeyPolicyIDInsensitively(input string) (*ContentKeyPolicyId, er return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.ContentKeyPolicyName, ok = parsed.Parsed["contentKeyPolicyName"]; !ok { @@ -106,7 +106,7 @@ func ValidateContentKeyPolicyID(input interface{}, key string) (warnings []strin // ID returns the formatted Content Key Policy ID func (id ContentKeyPolicyId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/contentKeyPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ContentKeyPolicyName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.ContentKeyPolicyName) } // Segments returns a slice of Resource ID Segments which comprise this Content Key Policy ID @@ -119,7 +119,7 @@ func (id ContentKeyPolicyId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticContentKeyPolicies", "contentKeyPolicies", "contentKeyPolicies"), resourceids.UserSpecifiedSegment("contentKeyPolicyName", "contentKeyPolicyValue"), } @@ -130,7 +130,7 @@ func (id ContentKeyPolicyId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Content Key Policy Name: %q", id.ContentKeyPolicyName), } return fmt.Sprintf("Content Key Policy (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/contentkeypolicies/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/contentkeypolicies/id_mediaservice.go index 6693615eed5b..16c9a97afdc3 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/contentkeypolicies/id_mediaservice.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/contentkeypolicies/id_mediaservice.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = MediaServiceId{} type MediaServiceId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string } // NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { +func NewMediaServiceID(subscriptionId string, resourceGroupName string, mediaServiceName string) MediaServiceId { return MediaServiceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, } } @@ -44,8 +44,8 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateMediaServiceID(input interface{}, key string) (warnings []string, e // ID returns the formatted Media Service ID func (id MediaServiceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName) } // Segments returns a slice of Resource ID Segments which comprise this Media Service ID @@ -109,7 +109,7 @@ func (id MediaServiceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), } } @@ -118,7 +118,7 @@ func (id MediaServiceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), } return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/README.md index f2e1eb5223f5..a7ac50eafbce 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := encodings.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue", "jobValue") +id := encodings.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "transformValue", "jobValue") read, err := client.JobsCancelJob(ctx, id) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := encodings.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue", "jobValue") +id := encodings.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "transformValue", "jobValue") payload := encodings.Job{ // ... @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := encodings.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue", "jobValue") +id := encodings.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "transformValue", "jobValue") read, err := client.JobsDelete(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := encodings.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue", "jobValue") +id := encodings.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "transformValue", "jobValue") read, err := client.JobsGet(ctx, id) if err != nil { @@ -93,7 +93,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := encodings.NewTransformID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue") +id := encodings.NewTransformID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "transformValue") // alternatively `client.JobsList(ctx, id, encodings.DefaultJobsListOperationOptions())` can be used to do batched pagination items, err := client.JobsListComplete(ctx, id, encodings.DefaultJobsListOperationOptions()) @@ -110,7 +110,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := encodings.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue", "jobValue") +id := encodings.NewJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "transformValue", "jobValue") payload := encodings.Job{ // ... @@ -131,7 +131,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := encodings.NewTransformID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue") +id := encodings.NewTransformID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "transformValue") payload := encodings.Transform{ // ... @@ -152,7 +152,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := encodings.NewTransformID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue") +id := encodings.NewTransformID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "transformValue") read, err := client.TransformsDelete(ctx, id) if err != nil { @@ -168,7 +168,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := encodings.NewTransformID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue") +id := encodings.NewTransformID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "transformValue") read, err := client.TransformsGet(ctx, id) if err != nil { @@ -184,7 +184,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := encodings.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := encodings.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") // alternatively `client.TransformsList(ctx, id, encodings.DefaultTransformsListOperationOptions())` can be used to do batched pagination items, err := client.TransformsListComplete(ctx, id, encodings.DefaultTransformsListOperationOptions()) @@ -201,7 +201,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := encodings.NewTransformID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "transformValue") +id := encodings.NewTransformID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "transformValue") payload := encodings.Transform{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/id_job.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/id_job.go index f3d07cd33cd4..167b08cac4a6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/id_job.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/id_job.go @@ -13,17 +13,17 @@ var _ resourceids.ResourceId = JobId{} type JobId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string TransformName string JobName string } // NewJobID returns a new JobId struct -func NewJobID(subscriptionId string, resourceGroupName string, accountName string, transformName string, jobName string) JobId { +func NewJobID(subscriptionId string, resourceGroupName string, mediaServiceName string, transformName string, jobName string) JobId { return JobId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, TransformName: transformName, JobName: jobName, } @@ -48,8 +48,8 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { @@ -83,8 +83,8 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { @@ -116,7 +116,7 @@ func ValidateJobID(input interface{}, key string) (warnings []string, errors []e // ID returns the formatted Job ID func (id JobId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/transforms/%s/jobs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.TransformName, id.JobName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.TransformName, id.JobName) } // Segments returns a slice of Resource ID Segments which comprise this Job ID @@ -129,7 +129,7 @@ func (id JobId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticTransforms", "transforms", "transforms"), resourceids.UserSpecifiedSegment("transformName", "transformValue"), resourceids.StaticSegment("staticJobs", "jobs", "jobs"), @@ -142,7 +142,7 @@ func (id JobId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Transform Name: %q", id.TransformName), fmt.Sprintf("Job Name: %q", id.JobName), } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/id_mediaservice.go index 0e1ebdbbf08e..558eaaf1c401 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/id_mediaservice.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/id_mediaservice.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = MediaServiceId{} type MediaServiceId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string } // NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { +func NewMediaServiceID(subscriptionId string, resourceGroupName string, mediaServiceName string) MediaServiceId { return MediaServiceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, } } @@ -44,8 +44,8 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateMediaServiceID(input interface{}, key string) (warnings []string, e // ID returns the formatted Media Service ID func (id MediaServiceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName) } // Segments returns a slice of Resource ID Segments which comprise this Media Service ID @@ -109,7 +109,7 @@ func (id MediaServiceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), } } @@ -118,7 +118,7 @@ func (id MediaServiceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), } return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/id_transform.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/id_transform.go index a01df6eb7697..dc8d1dca3f89 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/id_transform.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings/id_transform.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = TransformId{} type TransformId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string TransformName string } // NewTransformID returns a new TransformId struct -func NewTransformID(subscriptionId string, resourceGroupName string, accountName string, transformName string) TransformId { +func NewTransformID(subscriptionId string, resourceGroupName string, mediaServiceName string, transformName string) TransformId { return TransformId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, TransformName: transformName, } } @@ -46,8 +46,8 @@ func ParseTransformID(input string) (*TransformId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { @@ -77,8 +77,8 @@ func ParseTransformIDInsensitively(input string) (*TransformId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { @@ -106,7 +106,7 @@ func ValidateTransformID(input interface{}, key string) (warnings []string, erro // ID returns the formatted Transform ID func (id TransformId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/transforms/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.TransformName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.TransformName) } // Segments returns a slice of Resource ID Segments which comprise this Transform ID @@ -119,7 +119,7 @@ func (id TransformId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticTransforms", "transforms", "transforms"), resourceids.UserSpecifiedSegment("transformName", "transformValue"), } @@ -130,7 +130,7 @@ func (id TransformId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Transform Name: %q", id.TransformName), } return fmt.Sprintf("Transform (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveevents/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveevents/README.md index c20e6636ec5a..7e28b05adecc 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveevents/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveevents/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") if err := client.AllocateThenPoll(ctx, id); err != nil { // handle the error @@ -36,7 +36,7 @@ if err := client.AllocateThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") payload := liveevents.LiveEvent{ // ... @@ -53,7 +53,7 @@ if err := client.CreateThenPoll(ctx, id, payload, liveevents.DefaultCreateOperat ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -65,7 +65,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") read, err := client.Get(ctx, id) if err != nil { @@ -81,7 +81,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := liveevents.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := liveevents.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) @@ -98,7 +98,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") if err := client.ResetThenPoll(ctx, id); err != nil { // handle the error @@ -110,7 +110,7 @@ if err := client.ResetThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") if err := client.StartThenPoll(ctx, id); err != nil { // handle the error @@ -122,7 +122,7 @@ if err := client.StartThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") payload := liveevents.LiveEventActionInput{ // ... @@ -139,7 +139,7 @@ if err := client.StopThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") payload := liveevents.LiveEvent{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveevents/id_liveevent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveevents/id_liveevent.go index c89799de3faa..3d228d8ae5d2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveevents/id_liveevent.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveevents/id_liveevent.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = LiveEventId{} type LiveEventId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string LiveEventName string } // NewLiveEventID returns a new LiveEventId struct -func NewLiveEventID(subscriptionId string, resourceGroupName string, accountName string, liveEventName string) LiveEventId { +func NewLiveEventID(subscriptionId string, resourceGroupName string, mediaServiceName string, liveEventName string) LiveEventId { return LiveEventId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, LiveEventName: liveEventName, } } @@ -46,8 +46,8 @@ func ParseLiveEventID(input string) (*LiveEventId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -77,8 +77,8 @@ func ParseLiveEventIDInsensitively(input string) (*LiveEventId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -106,7 +106,7 @@ func ValidateLiveEventID(input interface{}, key string) (warnings []string, erro // ID returns the formatted Live Event ID func (id LiveEventId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/liveEvents/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.LiveEventName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.LiveEventName) } // Segments returns a slice of Resource ID Segments which comprise this Live Event ID @@ -119,7 +119,7 @@ func (id LiveEventId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticLiveEvents", "liveEvents", "liveEvents"), resourceids.UserSpecifiedSegment("liveEventName", "liveEventValue"), } @@ -130,7 +130,7 @@ func (id LiveEventId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Live Event Name: %q", id.LiveEventName), } return fmt.Sprintf("Live Event (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveevents/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveevents/id_mediaservice.go index 8c8c2a33c99d..e35d784539b0 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveevents/id_mediaservice.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveevents/id_mediaservice.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = MediaServiceId{} type MediaServiceId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string } // NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { +func NewMediaServiceID(subscriptionId string, resourceGroupName string, mediaServiceName string) MediaServiceId { return MediaServiceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, } } @@ -44,8 +44,8 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateMediaServiceID(input interface{}, key string) (warnings []string, e // ID returns the formatted Media Service ID func (id MediaServiceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName) } // Segments returns a slice of Resource ID Segments which comprise this Media Service ID @@ -109,7 +109,7 @@ func (id MediaServiceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), } } @@ -118,7 +118,7 @@ func (id MediaServiceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), } return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveoutputs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveoutputs/README.md index b1e66e7279c8..0e5f61749cc1 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveoutputs/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveoutputs/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := liveoutputs.NewLiveOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue", "liveOutputValue") +id := liveoutputs.NewLiveOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue", "liveOutputValue") payload := liveoutputs.LiveOutput{ // ... @@ -41,7 +41,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := liveoutputs.NewLiveOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue", "liveOutputValue") +id := liveoutputs.NewLiveOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue", "liveOutputValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := liveoutputs.NewLiveOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue", "liveOutputValue") +id := liveoutputs.NewLiveOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue", "liveOutputValue") read, err := client.Get(ctx, id) if err != nil { @@ -69,7 +69,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := liveoutputs.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveoutputs.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveoutputs/id_liveevent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveoutputs/id_liveevent.go index 9fc7e57c6d3a..d230c62c7ac2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveoutputs/id_liveevent.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveoutputs/id_liveevent.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = LiveEventId{} type LiveEventId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string LiveEventName string } // NewLiveEventID returns a new LiveEventId struct -func NewLiveEventID(subscriptionId string, resourceGroupName string, accountName string, liveEventName string) LiveEventId { +func NewLiveEventID(subscriptionId string, resourceGroupName string, mediaServiceName string, liveEventName string) LiveEventId { return LiveEventId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, LiveEventName: liveEventName, } } @@ -46,8 +46,8 @@ func ParseLiveEventID(input string) (*LiveEventId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -77,8 +77,8 @@ func ParseLiveEventIDInsensitively(input string) (*LiveEventId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -106,7 +106,7 @@ func ValidateLiveEventID(input interface{}, key string) (warnings []string, erro // ID returns the formatted Live Event ID func (id LiveEventId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/liveEvents/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.LiveEventName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.LiveEventName) } // Segments returns a slice of Resource ID Segments which comprise this Live Event ID @@ -119,7 +119,7 @@ func (id LiveEventId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticLiveEvents", "liveEvents", "liveEvents"), resourceids.UserSpecifiedSegment("liveEventName", "liveEventValue"), } @@ -130,7 +130,7 @@ func (id LiveEventId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Live Event Name: %q", id.LiveEventName), } return fmt.Sprintf("Live Event (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveoutputs/id_liveoutput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveoutputs/id_liveoutput.go index ee7c371cb8b2..673de0f6fe63 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveoutputs/id_liveoutput.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveoutputs/id_liveoutput.go @@ -13,17 +13,17 @@ var _ resourceids.ResourceId = LiveOutputId{} type LiveOutputId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string LiveEventName string LiveOutputName string } // NewLiveOutputID returns a new LiveOutputId struct -func NewLiveOutputID(subscriptionId string, resourceGroupName string, accountName string, liveEventName string, liveOutputName string) LiveOutputId { +func NewLiveOutputID(subscriptionId string, resourceGroupName string, mediaServiceName string, liveEventName string, liveOutputName string) LiveOutputId { return LiveOutputId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, LiveEventName: liveEventName, LiveOutputName: liveOutputName, } @@ -48,8 +48,8 @@ func ParseLiveOutputID(input string) (*LiveOutputId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -83,8 +83,8 @@ func ParseLiveOutputIDInsensitively(input string) (*LiveOutputId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -116,7 +116,7 @@ func ValidateLiveOutputID(input interface{}, key string) (warnings []string, err // ID returns the formatted Live Output ID func (id LiveOutputId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/liveEvents/%s/liveOutputs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.LiveEventName, id.LiveOutputName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.LiveEventName, id.LiveOutputName) } // Segments returns a slice of Resource ID Segments which comprise this Live Output ID @@ -129,7 +129,7 @@ func (id LiveOutputId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticLiveEvents", "liveEvents", "liveEvents"), resourceids.UserSpecifiedSegment("liveEventName", "liveEventValue"), resourceids.StaticSegment("staticLiveOutputs", "liveOutputs", "liveOutputs"), @@ -142,7 +142,7 @@ func (id LiveOutputId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Live Event Name: %q", id.LiveEventName), fmt.Sprintf("Live Output Name: %q", id.LiveOutputName), } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/README.md deleted file mode 100644 index d1ff6b9296fb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint` Documentation - -The `streamingendpoint` SDK allows for interaction with the Azure Resource Manager Service `media` (API Version `2021-11-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint" -``` - - -### Client Initialization - -```go -client := streamingendpoint.NewStreamingEndpointClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `StreamingEndpointClient.Update` - -```go -ctx := context.TODO() -id := streamingendpoint.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") - -payload := streamingendpoint.StreamingEndpoint{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/client.go deleted file mode 100644 index 2d91ced79992..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package streamingendpoint - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEndpointClient struct { - Client autorest.Client - baseUri string -} - -func NewStreamingEndpointClientWithBaseURI(endpoint string) StreamingEndpointClient { - return StreamingEndpointClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/constants.go deleted file mode 100644 index 109b9cf7212c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/constants.go +++ /dev/null @@ -1,46 +0,0 @@ -package streamingendpoint - -import "strings" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEndpointResourceState string - -const ( - StreamingEndpointResourceStateDeleting StreamingEndpointResourceState = "Deleting" - StreamingEndpointResourceStateRunning StreamingEndpointResourceState = "Running" - StreamingEndpointResourceStateScaling StreamingEndpointResourceState = "Scaling" - StreamingEndpointResourceStateStarting StreamingEndpointResourceState = "Starting" - StreamingEndpointResourceStateStopped StreamingEndpointResourceState = "Stopped" - StreamingEndpointResourceStateStopping StreamingEndpointResourceState = "Stopping" -) - -func PossibleValuesForStreamingEndpointResourceState() []string { - return []string{ - string(StreamingEndpointResourceStateDeleting), - string(StreamingEndpointResourceStateRunning), - string(StreamingEndpointResourceStateScaling), - string(StreamingEndpointResourceStateStarting), - string(StreamingEndpointResourceStateStopped), - string(StreamingEndpointResourceStateStopping), - } -} - -func parseStreamingEndpointResourceState(input string) (*StreamingEndpointResourceState, error) { - vals := map[string]StreamingEndpointResourceState{ - "deleting": StreamingEndpointResourceStateDeleting, - "running": StreamingEndpointResourceStateRunning, - "scaling": StreamingEndpointResourceStateScaling, - "starting": StreamingEndpointResourceStateStarting, - "stopped": StreamingEndpointResourceStateStopped, - "stopping": StreamingEndpointResourceStateStopping, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := StreamingEndpointResourceState(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/id_streamingendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/id_streamingendpoint.go deleted file mode 100644 index c7b330ffd73e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/id_streamingendpoint.go +++ /dev/null @@ -1,137 +0,0 @@ -package streamingendpoint - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = StreamingEndpointId{} - -// StreamingEndpointId is a struct representing the Resource ID for a Streaming Endpoint -type StreamingEndpointId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - StreamingEndpointName string -} - -// NewStreamingEndpointID returns a new StreamingEndpointId struct -func NewStreamingEndpointID(subscriptionId string, resourceGroupName string, accountName string, streamingEndpointName string) StreamingEndpointId { - return StreamingEndpointId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - StreamingEndpointName: streamingEndpointName, - } -} - -// ParseStreamingEndpointID parses 'input' into a StreamingEndpointId -func ParseStreamingEndpointID(input string) (*StreamingEndpointId, error) { - parser := resourceids.NewParserFromResourceIdType(StreamingEndpointId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := StreamingEndpointId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { - return nil, fmt.Errorf("the segment 'streamingEndpointName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseStreamingEndpointIDInsensitively parses 'input' case-insensitively into a StreamingEndpointId -// note: this method should only be used for API response data and not user input -func ParseStreamingEndpointIDInsensitively(input string) (*StreamingEndpointId, error) { - parser := resourceids.NewParserFromResourceIdType(StreamingEndpointId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := StreamingEndpointId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { - return nil, fmt.Errorf("the segment 'streamingEndpointName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateStreamingEndpointID checks that 'input' can be parsed as a Streaming Endpoint ID -func ValidateStreamingEndpointID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseStreamingEndpointID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Streaming Endpoint ID -func (id StreamingEndpointId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/streamingEndpoints/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.StreamingEndpointName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Streaming Endpoint ID -func (id StreamingEndpointId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticStreamingEndpoints", "streamingEndpoints", "streamingEndpoints"), - resourceids.UserSpecifiedSegment("streamingEndpointName", "streamingEndpointValue"), - } -} - -// String returns a human-readable description of this Streaming Endpoint ID -func (id StreamingEndpointId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Streaming Endpoint Name: %q", id.StreamingEndpointName), - } - return fmt.Sprintf("Streaming Endpoint (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/method_update_autorest.go deleted file mode 100644 index 5c9d24a2112e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/method_update_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package streamingendpoint - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c StreamingEndpointClient) Update(ctx context.Context, id StreamingEndpointId, input StreamingEndpoint) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoint.StreamingEndpointClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoint.StreamingEndpointClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c StreamingEndpointClient) UpdateThenPoll(ctx context.Context, id StreamingEndpointId, input StreamingEndpoint) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c StreamingEndpointClient) preparerForUpdate(ctx context.Context, id StreamingEndpointId, input StreamingEndpoint) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c StreamingEndpointClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_akamaiaccesscontrol.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_akamaiaccesscontrol.go deleted file mode 100644 index 909094afeeae..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_akamaiaccesscontrol.go +++ /dev/null @@ -1,8 +0,0 @@ -package streamingendpoint - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AkamaiAccessControl struct { - AkamaiSignatureHeaderAuthenticationKeyList *[]AkamaiSignatureHeaderAuthenticationKey `json:"akamaiSignatureHeaderAuthenticationKeyList,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_akamaisignatureheaderauthenticationkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_akamaisignatureheaderauthenticationkey.go deleted file mode 100644 index c637fe893bc6..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_akamaisignatureheaderauthenticationkey.go +++ /dev/null @@ -1,28 +0,0 @@ -package streamingendpoint - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AkamaiSignatureHeaderAuthenticationKey struct { - Base64Key *string `json:"base64Key,omitempty"` - Expiration *string `json:"expiration,omitempty"` - Identifier *string `json:"identifier,omitempty"` -} - -func (o *AkamaiSignatureHeaderAuthenticationKey) GetExpirationAsTime() (*time.Time, error) { - if o.Expiration == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Expiration, "2006-01-02T15:04:05Z07:00") -} - -func (o *AkamaiSignatureHeaderAuthenticationKey) SetExpirationAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Expiration = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_armstreamingendpointcurrentsku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_armstreamingendpointcurrentsku.go deleted file mode 100644 index 6efda14b39ee..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_armstreamingendpointcurrentsku.go +++ /dev/null @@ -1,9 +0,0 @@ -package streamingendpoint - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ArmStreamingEndpointCurrentSku struct { - Capacity *int64 `json:"capacity,omitempty"` - Name *string `json:"name,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_crosssiteaccesspolicies.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_crosssiteaccesspolicies.go deleted file mode 100644 index a8b65db46d37..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_crosssiteaccesspolicies.go +++ /dev/null @@ -1,9 +0,0 @@ -package streamingendpoint - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CrossSiteAccessPolicies struct { - ClientAccessPolicy *string `json:"clientAccessPolicy,omitempty"` - CrossDomainPolicy *string `json:"crossDomainPolicy,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_ipaccesscontrol.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_ipaccesscontrol.go deleted file mode 100644 index 31f7b781a4dc..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_ipaccesscontrol.go +++ /dev/null @@ -1,8 +0,0 @@ -package streamingendpoint - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type IPAccessControl struct { - Allow *[]IPRange `json:"allow,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_iprange.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_iprange.go deleted file mode 100644 index 95d0a53b5cd1..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_iprange.go +++ /dev/null @@ -1,10 +0,0 @@ -package streamingendpoint - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type IPRange struct { - Address *string `json:"address,omitempty"` - Name *string `json:"name,omitempty"` - SubnetPrefixLength *int64 `json:"subnetPrefixLength,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_streamingendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_streamingendpoint.go deleted file mode 100644 index 99c1789f1f97..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_streamingendpoint.go +++ /dev/null @@ -1,19 +0,0 @@ -package streamingendpoint - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEndpoint struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *StreamingEndpointProperties `json:"properties,omitempty"` - Sku *ArmStreamingEndpointCurrentSku `json:"sku,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_streamingendpointaccesscontrol.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_streamingendpointaccesscontrol.go deleted file mode 100644 index 5460311eda23..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_streamingendpointaccesscontrol.go +++ /dev/null @@ -1,9 +0,0 @@ -package streamingendpoint - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEndpointAccessControl struct { - Akamai *AkamaiAccessControl `json:"akamai,omitempty"` - IP *IPAccessControl `json:"ip,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_streamingendpointproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_streamingendpointproperties.go deleted file mode 100644 index 52a58c941115..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/model_streamingendpointproperties.go +++ /dev/null @@ -1,65 +0,0 @@ -package streamingendpoint - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEndpointProperties struct { - AccessControl *StreamingEndpointAccessControl `json:"accessControl,omitempty"` - AvailabilitySetName *string `json:"availabilitySetName,omitempty"` - CdnEnabled *bool `json:"cdnEnabled,omitempty"` - CdnProfile *string `json:"cdnProfile,omitempty"` - CdnProvider *string `json:"cdnProvider,omitempty"` - Created *string `json:"created,omitempty"` - CrossSiteAccessPolicies *CrossSiteAccessPolicies `json:"crossSiteAccessPolicies,omitempty"` - CustomHostNames *[]string `json:"customHostNames,omitempty"` - Description *string `json:"description,omitempty"` - FreeTrialEndTime *string `json:"freeTrialEndTime,omitempty"` - HostName *string `json:"hostName,omitempty"` - LastModified *string `json:"lastModified,omitempty"` - MaxCacheAge *int64 `json:"maxCacheAge,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ResourceState *StreamingEndpointResourceState `json:"resourceState,omitempty"` - ScaleUnits int64 `json:"scaleUnits"` -} - -func (o *StreamingEndpointProperties) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *StreamingEndpointProperties) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} - -func (o *StreamingEndpointProperties) GetFreeTrialEndTimeAsTime() (*time.Time, error) { - if o.FreeTrialEndTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.FreeTrialEndTime, "2006-01-02T15:04:05Z07:00") -} - -func (o *StreamingEndpointProperties) SetFreeTrialEndTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.FreeTrialEndTime = &formatted -} - -func (o *StreamingEndpointProperties) GetLastModifiedAsTime() (*time.Time, error) { - if o.LastModified == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModified, "2006-01-02T15:04:05Z07:00") -} - -func (o *StreamingEndpointProperties) SetLastModifiedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModified = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/version.go deleted file mode 100644 index 71fe4b0584c9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package streamingendpoint - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2021-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/streamingendpoint/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints/README.md index b8f28cd0efce..1bd0157b7c31 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") payload := streamingendpoints.StreamingEndpoint{ // ... @@ -41,7 +41,7 @@ if err := client.CreateThenPoll(ctx, id, payload, streamingendpoints.DefaultCrea ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") read, err := client.Get(ctx, id) if err != nil { @@ -69,7 +69,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingendpoints.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := streamingendpoints.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) @@ -86,7 +86,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") payload := streamingendpoints.StreamingEntityScaleUnit{ // ... @@ -103,7 +103,7 @@ if err := client.ScaleThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") read, err := client.Skus(ctx, id) if err != nil { @@ -119,7 +119,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") if err := client.StartThenPoll(ctx, id); err != nil { // handle the error @@ -131,9 +131,26 @@ if err := client.StartThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") if err := client.StopThenPoll(ctx, id); err != nil { // handle the error } ``` + + +### Example Usage: `StreamingEndpointsClient.Update` + +```go +ctx := context.TODO() +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") + +payload := streamingendpoints.StreamingEndpoint{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints/id_mediaservice.go index 8f025a992deb..885d3947268f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints/id_mediaservice.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints/id_mediaservice.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = MediaServiceId{} type MediaServiceId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string } // NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { +func NewMediaServiceID(subscriptionId string, resourceGroupName string, mediaServiceName string) MediaServiceId { return MediaServiceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, } } @@ -44,8 +44,8 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateMediaServiceID(input interface{}, key string) (warnings []string, e // ID returns the formatted Media Service ID func (id MediaServiceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName) } // Segments returns a slice of Resource ID Segments which comprise this Media Service ID @@ -109,7 +109,7 @@ func (id MediaServiceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), } } @@ -118,7 +118,7 @@ func (id MediaServiceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), } return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints/id_streamingendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints/id_streamingendpoint.go index e670dae8f131..da3bbe0ad88a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints/id_streamingendpoint.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints/id_streamingendpoint.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = StreamingEndpointId{} type StreamingEndpointId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string StreamingEndpointName string } // NewStreamingEndpointID returns a new StreamingEndpointId struct -func NewStreamingEndpointID(subscriptionId string, resourceGroupName string, accountName string, streamingEndpointName string) StreamingEndpointId { +func NewStreamingEndpointID(subscriptionId string, resourceGroupName string, mediaServiceName string, streamingEndpointName string) StreamingEndpointId { return StreamingEndpointId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, StreamingEndpointName: streamingEndpointName, } } @@ -46,8 +46,8 @@ func ParseStreamingEndpointID(input string) (*StreamingEndpointId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { @@ -77,8 +77,8 @@ func ParseStreamingEndpointIDInsensitively(input string) (*StreamingEndpointId, return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { @@ -106,7 +106,7 @@ func ValidateStreamingEndpointID(input interface{}, key string) (warnings []stri // ID returns the formatted Streaming Endpoint ID func (id StreamingEndpointId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/streamingEndpoints/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.StreamingEndpointName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.StreamingEndpointName) } // Segments returns a slice of Resource ID Segments which comprise this Streaming Endpoint ID @@ -119,7 +119,7 @@ func (id StreamingEndpointId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticStreamingEndpoints", "streamingEndpoints", "streamingEndpoints"), resourceids.UserSpecifiedSegment("streamingEndpointName", "streamingEndpointValue"), } @@ -130,7 +130,7 @@ func (id StreamingEndpointId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Streaming Endpoint Name: %q", id.StreamingEndpointName), } return fmt.Sprintf("Streaming Endpoint (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints/method_update_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints/method_update_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints/method_update_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/README.md index 79469a30232b..22c24938a03f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingLocatorValue") +id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingLocatorValue") payload := streamingpoliciesandstreaminglocators.StreamingLocator{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingLocatorValue") +id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingLocatorValue") read, err := client.StreamingLocatorsDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingLocatorValue") +id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingLocatorValue") read, err := client.StreamingLocatorsGet(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := streamingpoliciesandstreaminglocators.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") // alternatively `client.StreamingLocatorsList(ctx, id, streamingpoliciesandstreaminglocators.DefaultStreamingLocatorsListOperationOptions())` can be used to do batched pagination items, err := client.StreamingLocatorsListComplete(ctx, id, streamingpoliciesandstreaminglocators.DefaultStreamingLocatorsListOperationOptions()) @@ -94,7 +94,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingLocatorValue") +id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingLocatorValue") read, err := client.StreamingLocatorsListContentKeys(ctx, id) if err != nil { @@ -110,7 +110,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingLocatorValue") +id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingLocatorValue") read, err := client.StreamingLocatorsListPaths(ctx, id) if err != nil { @@ -126,7 +126,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingPolicyValue") +id := streamingpoliciesandstreaminglocators.NewStreamingPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingPolicyValue") payload := streamingpoliciesandstreaminglocators.StreamingPolicy{ // ... @@ -147,7 +147,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingPolicyValue") +id := streamingpoliciesandstreaminglocators.NewStreamingPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingPolicyValue") read, err := client.StreamingPoliciesDelete(ctx, id) if err != nil { @@ -163,7 +163,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingPolicyValue") +id := streamingpoliciesandstreaminglocators.NewStreamingPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingPolicyValue") read, err := client.StreamingPoliciesGet(ctx, id) if err != nil { @@ -179,7 +179,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := streamingpoliciesandstreaminglocators.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") // alternatively `client.StreamingPoliciesList(ctx, id, streamingpoliciesandstreaminglocators.DefaultStreamingPoliciesListOperationOptions())` can be used to do batched pagination items, err := client.StreamingPoliciesListComplete(ctx, id, streamingpoliciesandstreaminglocators.DefaultStreamingPoliciesListOperationOptions()) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_mediaservice.go index 97964c679bd2..ba3aaa702658 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_mediaservice.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_mediaservice.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = MediaServiceId{} type MediaServiceId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string } // NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { +func NewMediaServiceID(subscriptionId string, resourceGroupName string, mediaServiceName string) MediaServiceId { return MediaServiceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, } } @@ -44,8 +44,8 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateMediaServiceID(input interface{}, key string) (warnings []string, e // ID returns the formatted Media Service ID func (id MediaServiceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName) } // Segments returns a slice of Resource ID Segments which comprise this Media Service ID @@ -109,7 +109,7 @@ func (id MediaServiceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), } } @@ -118,7 +118,7 @@ func (id MediaServiceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), } return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go index 5bc5c7f6fba1..62096fdd6f71 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = StreamingLocatorId{} type StreamingLocatorId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string StreamingLocatorName string } // NewStreamingLocatorID returns a new StreamingLocatorId struct -func NewStreamingLocatorID(subscriptionId string, resourceGroupName string, accountName string, streamingLocatorName string) StreamingLocatorId { +func NewStreamingLocatorID(subscriptionId string, resourceGroupName string, mediaServiceName string, streamingLocatorName string) StreamingLocatorId { return StreamingLocatorId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, StreamingLocatorName: streamingLocatorName, } } @@ -46,8 +46,8 @@ func ParseStreamingLocatorID(input string) (*StreamingLocatorId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.StreamingLocatorName, ok = parsed.Parsed["streamingLocatorName"]; !ok { @@ -77,8 +77,8 @@ func ParseStreamingLocatorIDInsensitively(input string) (*StreamingLocatorId, er return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.StreamingLocatorName, ok = parsed.Parsed["streamingLocatorName"]; !ok { @@ -106,7 +106,7 @@ func ValidateStreamingLocatorID(input interface{}, key string) (warnings []strin // ID returns the formatted Streaming Locator ID func (id StreamingLocatorId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/streamingLocators/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.StreamingLocatorName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.StreamingLocatorName) } // Segments returns a slice of Resource ID Segments which comprise this Streaming Locator ID @@ -119,7 +119,7 @@ func (id StreamingLocatorId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticStreamingLocators", "streamingLocators", "streamingLocators"), resourceids.UserSpecifiedSegment("streamingLocatorName", "streamingLocatorValue"), } @@ -130,7 +130,7 @@ func (id StreamingLocatorId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Streaming Locator Name: %q", id.StreamingLocatorName), } return fmt.Sprintf("Streaming Locator (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go index 3eedc295ee33..a7dfa53f75f2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = StreamingPolicyId{} type StreamingPolicyId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string StreamingPolicyName string } // NewStreamingPolicyID returns a new StreamingPolicyId struct -func NewStreamingPolicyID(subscriptionId string, resourceGroupName string, accountName string, streamingPolicyName string) StreamingPolicyId { +func NewStreamingPolicyID(subscriptionId string, resourceGroupName string, mediaServiceName string, streamingPolicyName string) StreamingPolicyId { return StreamingPolicyId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, StreamingPolicyName: streamingPolicyName, } } @@ -46,8 +46,8 @@ func ParseStreamingPolicyID(input string) (*StreamingPolicyId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.StreamingPolicyName, ok = parsed.Parsed["streamingPolicyName"]; !ok { @@ -77,8 +77,8 @@ func ParseStreamingPolicyIDInsensitively(input string) (*StreamingPolicyId, erro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.StreamingPolicyName, ok = parsed.Parsed["streamingPolicyName"]; !ok { @@ -106,7 +106,7 @@ func ValidateStreamingPolicyID(input interface{}, key string) (warnings []string // ID returns the formatted Streaming Policy ID func (id StreamingPolicyId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/streamingPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.StreamingPolicyName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.StreamingPolicyName) } // Segments returns a slice of Resource ID Segments which comprise this Streaming Policy ID @@ -119,7 +119,7 @@ func (id StreamingPolicyId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticStreamingPolicies", "streamingPolicies", "streamingPolicies"), resourceids.UserSpecifiedSegment("streamingPolicyName", "streamingPolicyValue"), } @@ -130,7 +130,7 @@ func (id StreamingPolicyId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Streaming Policy Name: %q", id.StreamingPolicyName), } return fmt.Sprintf("Streaming Policy (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/accountfilters/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/accountfilters/README.md index fafde1b3c89f..5e2f3a8d8f2e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/accountfilters/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/accountfilters/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "filterValue") +id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "accountFilterValue") payload := accountfilters.AccountFilter{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "filterValue") +id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "accountFilterValue") read, err := client.AccountFiltersDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "filterValue") +id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "accountFilterValue") read, err := client.AccountFiltersGet(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := accountfilters.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := accountfilters.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") // alternatively `client.AccountFiltersList(ctx, id)` can be used to do batched pagination items, err := client.AccountFiltersListComplete(ctx, id) @@ -94,7 +94,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "filterValue") +id := accountfilters.NewAccountFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "accountFilterValue") payload := accountfilters.AccountFilter{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/accountfilters/id_accountfilter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/accountfilters/id_accountfilter.go index 30c106c73d5c..55c7c259c307 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/accountfilters/id_accountfilter.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/accountfilters/id_accountfilter.go @@ -13,17 +13,17 @@ var _ resourceids.ResourceId = AccountFilterId{} type AccountFilterId struct { SubscriptionId string ResourceGroupName string - AccountName string - FilterName string + MediaServiceName string + AccountFilterName string } // NewAccountFilterID returns a new AccountFilterId struct -func NewAccountFilterID(subscriptionId string, resourceGroupName string, accountName string, filterName string) AccountFilterId { +func NewAccountFilterID(subscriptionId string, resourceGroupName string, mediaServiceName string, accountFilterName string) AccountFilterId { return AccountFilterId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, - FilterName: filterName, + MediaServiceName: mediaServiceName, + AccountFilterName: accountFilterName, } } @@ -46,12 +46,12 @@ func ParseAccountFilterID(input string) (*AccountFilterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } - if id.FilterName, ok = parsed.Parsed["filterName"]; !ok { - return nil, fmt.Errorf("the segment 'filterName' was not found in the resource id %q", input) + if id.AccountFilterName, ok = parsed.Parsed["accountFilterName"]; !ok { + return nil, fmt.Errorf("the segment 'accountFilterName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseAccountFilterIDInsensitively(input string) (*AccountFilterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } - if id.FilterName, ok = parsed.Parsed["filterName"]; !ok { - return nil, fmt.Errorf("the segment 'filterName' was not found in the resource id %q", input) + if id.AccountFilterName, ok = parsed.Parsed["accountFilterName"]; !ok { + return nil, fmt.Errorf("the segment 'accountFilterName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateAccountFilterID(input interface{}, key string) (warnings []string, // ID returns the formatted Account Filter ID func (id AccountFilterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/accountFilters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.FilterName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.AccountFilterName) } // Segments returns a slice of Resource ID Segments which comprise this Account Filter ID @@ -119,9 +119,9 @@ func (id AccountFilterId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticAccountFilters", "accountFilters", "accountFilters"), - resourceids.UserSpecifiedSegment("filterName", "filterValue"), + resourceids.UserSpecifiedSegment("accountFilterName", "accountFilterValue"), } } @@ -130,8 +130,8 @@ func (id AccountFilterId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Filter Name: %q", id.FilterName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), + fmt.Sprintf("Account Filter Name: %q", id.AccountFilterName), } return fmt.Sprintf("Account Filter (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/accountfilters/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/accountfilters/id_mediaservice.go index df615056343f..2354e3c5253b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/accountfilters/id_mediaservice.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/accountfilters/id_mediaservice.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = MediaServiceId{} type MediaServiceId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string } // NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { +func NewMediaServiceID(subscriptionId string, resourceGroupName string, mediaServiceName string) MediaServiceId { return MediaServiceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, } } @@ -44,8 +44,8 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateMediaServiceID(input interface{}, key string) (warnings []string, e // ID returns the formatted Media Service ID func (id MediaServiceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName) } // Segments returns a slice of Resource ID Segments which comprise this Media Service ID @@ -109,7 +109,7 @@ func (id MediaServiceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), } } @@ -118,7 +118,7 @@ func (id MediaServiceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), } return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/README.md index c7f41a352a51..ed6072c7d607 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "filterValue") +id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "assetFilterValue") payload := assetsandassetfilters.AssetFilter{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "filterValue") +id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "assetFilterValue") read, err := client.AssetFiltersDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "filterValue") +id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "assetFilterValue") read, err := client.AssetFiltersGet(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") // alternatively `client.AssetFiltersList(ctx, id)` can be used to do batched pagination items, err := client.AssetFiltersListComplete(ctx, id) @@ -94,7 +94,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "filterValue") +id := assetsandassetfilters.NewAssetFilterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "assetFilterValue") payload := assetsandassetfilters.AssetFilter{ // ... @@ -115,7 +115,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") payload := assetsandassetfilters.Asset{ // ... @@ -136,7 +136,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") read, err := client.AssetsDelete(ctx, id) if err != nil { @@ -152,7 +152,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") read, err := client.AssetsGet(ctx, id) if err != nil { @@ -168,7 +168,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") read, err := client.AssetsGetEncryptionKey(ctx, id) if err != nil { @@ -184,7 +184,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := assetsandassetfilters.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") // alternatively `client.AssetsList(ctx, id, assetsandassetfilters.DefaultAssetsListOperationOptions())` can be used to do batched pagination items, err := client.AssetsListComplete(ctx, id, assetsandassetfilters.DefaultAssetsListOperationOptions()) @@ -201,7 +201,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") payload := assetsandassetfilters.ListContainerSasInput{ // ... @@ -222,7 +222,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") read, err := client.AssetsListStreamingLocators(ctx, id) if err != nil { @@ -238,7 +238,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") payload := assetsandassetfilters.Asset{ // ... @@ -259,7 +259,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "trackValue") +id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "trackValue") payload := assetsandassetfilters.AssetTrack{ // ... @@ -276,7 +276,7 @@ if err := client.TracksCreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "trackValue") +id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "trackValue") if err := client.TracksDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -288,7 +288,7 @@ if err := client.TracksDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "trackValue") +id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "trackValue") read, err := client.TracksGet(ctx, id) if err != nil { @@ -304,7 +304,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue") +id := assetsandassetfilters.NewAssetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue") read, err := client.TracksList(ctx, id) if err != nil { @@ -320,7 +320,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "trackValue") +id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "trackValue") payload := assetsandassetfilters.AssetTrack{ // ... @@ -337,7 +337,7 @@ if err := client.TracksUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "assetValue", "trackValue") +id := assetsandassetfilters.NewTrackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "assetValue", "trackValue") if err := client.TracksUpdateTrackDataThenPoll(ctx, id); err != nil { // handle the error diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_asset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_asset.go index c21b31a08816..0102e8dc7313 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_asset.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_asset.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = AssetId{} type AssetId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string AssetName string } // NewAssetID returns a new AssetId struct -func NewAssetID(subscriptionId string, resourceGroupName string, accountName string, assetName string) AssetId { +func NewAssetID(subscriptionId string, resourceGroupName string, mediaServiceName string, assetName string) AssetId { return AssetId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, AssetName: assetName, } } @@ -46,8 +46,8 @@ func ParseAssetID(input string) (*AssetId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { @@ -77,8 +77,8 @@ func ParseAssetIDInsensitively(input string) (*AssetId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { @@ -106,7 +106,7 @@ func ValidateAssetID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Asset ID func (id AssetId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/assets/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.AssetName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.AssetName) } // Segments returns a slice of Resource ID Segments which comprise this Asset ID @@ -119,7 +119,7 @@ func (id AssetId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticAssets", "assets", "assets"), resourceids.UserSpecifiedSegment("assetName", "assetValue"), } @@ -130,7 +130,7 @@ func (id AssetId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Asset Name: %q", id.AssetName), } return fmt.Sprintf("Asset (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_assetfilter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_assetfilter.go index bfb937131a6e..3f230a8f82c7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_assetfilter.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_assetfilter.go @@ -13,19 +13,19 @@ var _ resourceids.ResourceId = AssetFilterId{} type AssetFilterId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string AssetName string - FilterName string + AssetFilterName string } // NewAssetFilterID returns a new AssetFilterId struct -func NewAssetFilterID(subscriptionId string, resourceGroupName string, accountName string, assetName string, filterName string) AssetFilterId { +func NewAssetFilterID(subscriptionId string, resourceGroupName string, mediaServiceName string, assetName string, assetFilterName string) AssetFilterId { return AssetFilterId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, AssetName: assetName, - FilterName: filterName, + AssetFilterName: assetFilterName, } } @@ -48,16 +48,16 @@ func ParseAssetFilterID(input string) (*AssetFilterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { return nil, fmt.Errorf("the segment 'assetName' was not found in the resource id %q", input) } - if id.FilterName, ok = parsed.Parsed["filterName"]; !ok { - return nil, fmt.Errorf("the segment 'filterName' was not found in the resource id %q", input) + if id.AssetFilterName, ok = parsed.Parsed["assetFilterName"]; !ok { + return nil, fmt.Errorf("the segment 'assetFilterName' was not found in the resource id %q", input) } return &id, nil @@ -83,16 +83,16 @@ func ParseAssetFilterIDInsensitively(input string) (*AssetFilterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { return nil, fmt.Errorf("the segment 'assetName' was not found in the resource id %q", input) } - if id.FilterName, ok = parsed.Parsed["filterName"]; !ok { - return nil, fmt.Errorf("the segment 'filterName' was not found in the resource id %q", input) + if id.AssetFilterName, ok = parsed.Parsed["assetFilterName"]; !ok { + return nil, fmt.Errorf("the segment 'assetFilterName' was not found in the resource id %q", input) } return &id, nil @@ -116,7 +116,7 @@ func ValidateAssetFilterID(input interface{}, key string) (warnings []string, er // ID returns the formatted Asset Filter ID func (id AssetFilterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/assets/%s/assetFilters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.AssetName, id.FilterName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.AssetName, id.AssetFilterName) } // Segments returns a slice of Resource ID Segments which comprise this Asset Filter ID @@ -129,11 +129,11 @@ func (id AssetFilterId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticAssets", "assets", "assets"), resourceids.UserSpecifiedSegment("assetName", "assetValue"), resourceids.StaticSegment("staticAssetFilters", "assetFilters", "assetFilters"), - resourceids.UserSpecifiedSegment("filterName", "filterValue"), + resourceids.UserSpecifiedSegment("assetFilterName", "assetFilterValue"), } } @@ -142,9 +142,9 @@ func (id AssetFilterId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Asset Name: %q", id.AssetName), - fmt.Sprintf("Filter Name: %q", id.FilterName), + fmt.Sprintf("Asset Filter Name: %q", id.AssetFilterName), } return fmt.Sprintf("Asset Filter (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_mediaservice.go index bb819030c758..03495a732374 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_mediaservice.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_mediaservice.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = MediaServiceId{} type MediaServiceId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string } // NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { +func NewMediaServiceID(subscriptionId string, resourceGroupName string, mediaServiceName string) MediaServiceId { return MediaServiceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, } } @@ -44,8 +44,8 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateMediaServiceID(input interface{}, key string) (warnings []string, e // ID returns the formatted Media Service ID func (id MediaServiceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName) } // Segments returns a slice of Resource ID Segments which comprise this Media Service ID @@ -109,7 +109,7 @@ func (id MediaServiceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), } } @@ -118,7 +118,7 @@ func (id MediaServiceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), } return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_track.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_track.go index 51caa833fb6e..192ac9625d28 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_track.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandassetfilters/id_track.go @@ -13,17 +13,17 @@ var _ resourceids.ResourceId = TrackId{} type TrackId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string AssetName string TrackName string } // NewTrackID returns a new TrackId struct -func NewTrackID(subscriptionId string, resourceGroupName string, accountName string, assetName string, trackName string) TrackId { +func NewTrackID(subscriptionId string, resourceGroupName string, mediaServiceName string, assetName string, trackName string) TrackId { return TrackId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, AssetName: assetName, TrackName: trackName, } @@ -48,8 +48,8 @@ func ParseTrackID(input string) (*TrackId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { @@ -83,8 +83,8 @@ func ParseTrackIDInsensitively(input string) (*TrackId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { @@ -116,7 +116,7 @@ func ValidateTrackID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Track ID func (id TrackId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/assets/%s/tracks/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.AssetName, id.TrackName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.AssetName, id.TrackName) } // Segments returns a slice of Resource ID Segments which comprise this Track ID @@ -129,7 +129,7 @@ func (id TrackId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticAssets", "assets", "assets"), resourceids.UserSpecifiedSegment("assetName", "assetValue"), resourceids.StaticSegment("staticTracks", "tracks", "tracks"), @@ -142,7 +142,7 @@ func (id TrackId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Asset Name: %q", id.AssetName), fmt.Sprintf("Track Name: %q", id.TrackName), } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/client.go index 31d35f20f571..a3ca096016fb 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/client.go @@ -7,7 +7,6 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/contentkeypolicies" "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents" "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs" - "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint" "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints" "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators" ) @@ -18,7 +17,6 @@ type Client struct { ContentKeyPolicies *contentkeypolicies.ContentKeyPoliciesClient LiveEvents *liveevents.LiveEventsClient LiveOutputs *liveoutputs.LiveOutputsClient - StreamingEndpoint *streamingendpoint.StreamingEndpointClient StreamingEndpoints *streamingendpoints.StreamingEndpointsClient StreamingPoliciesAndStreamingLocators *streamingpoliciesandstreaminglocators.StreamingPoliciesAndStreamingLocatorsClient } @@ -40,9 +38,6 @@ func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Cl liveOutputsClient := liveoutputs.NewLiveOutputsClientWithBaseURI(endpoint) configureAuthFunc(&liveOutputsClient.Client) - streamingEndpointClient := streamingendpoint.NewStreamingEndpointClientWithBaseURI(endpoint) - configureAuthFunc(&streamingEndpointClient.Client) - streamingEndpointsClient := streamingendpoints.NewStreamingEndpointsClientWithBaseURI(endpoint) configureAuthFunc(&streamingEndpointsClient.Client) @@ -55,7 +50,6 @@ func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Cl ContentKeyPolicies: &contentKeyPoliciesClient, LiveEvents: &liveEventsClient, LiveOutputs: &liveOutputsClient, - StreamingEndpoint: &streamingEndpointClient, StreamingEndpoints: &streamingEndpointsClient, StreamingPoliciesAndStreamingLocators: &streamingPoliciesAndStreamingLocatorsClient, } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/contentkeypolicies/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/contentkeypolicies/README.md index 9dccff77a22c..0b153a8164e4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/contentkeypolicies/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/contentkeypolicies/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "contentKeyPolicyValue") +id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "contentKeyPolicyValue") payload := contentkeypolicies.ContentKeyPolicy{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "contentKeyPolicyValue") +id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "contentKeyPolicyValue") read, err := client.ContentKeyPoliciesDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "contentKeyPolicyValue") +id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "contentKeyPolicyValue") read, err := client.ContentKeyPoliciesGet(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "contentKeyPolicyValue") +id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "contentKeyPolicyValue") read, err := client.ContentKeyPoliciesGetPolicyPropertiesWithSecrets(ctx, id) if err != nil { @@ -93,7 +93,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := contentkeypolicies.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := contentkeypolicies.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") // alternatively `client.ContentKeyPoliciesList(ctx, id, contentkeypolicies.DefaultContentKeyPoliciesListOperationOptions())` can be used to do batched pagination items, err := client.ContentKeyPoliciesListComplete(ctx, id, contentkeypolicies.DefaultContentKeyPoliciesListOperationOptions()) @@ -110,7 +110,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "contentKeyPolicyValue") +id := contentkeypolicies.NewContentKeyPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "contentKeyPolicyValue") payload := contentkeypolicies.ContentKeyPolicy{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/contentkeypolicies/id_contentkeypolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/contentkeypolicies/id_contentkeypolicy.go index 4a2d8a84d053..4df3f4179d65 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/contentkeypolicies/id_contentkeypolicy.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/contentkeypolicies/id_contentkeypolicy.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = ContentKeyPolicyId{} type ContentKeyPolicyId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string ContentKeyPolicyName string } // NewContentKeyPolicyID returns a new ContentKeyPolicyId struct -func NewContentKeyPolicyID(subscriptionId string, resourceGroupName string, accountName string, contentKeyPolicyName string) ContentKeyPolicyId { +func NewContentKeyPolicyID(subscriptionId string, resourceGroupName string, mediaServiceName string, contentKeyPolicyName string) ContentKeyPolicyId { return ContentKeyPolicyId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, ContentKeyPolicyName: contentKeyPolicyName, } } @@ -46,8 +46,8 @@ func ParseContentKeyPolicyID(input string) (*ContentKeyPolicyId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.ContentKeyPolicyName, ok = parsed.Parsed["contentKeyPolicyName"]; !ok { @@ -77,8 +77,8 @@ func ParseContentKeyPolicyIDInsensitively(input string) (*ContentKeyPolicyId, er return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.ContentKeyPolicyName, ok = parsed.Parsed["contentKeyPolicyName"]; !ok { @@ -106,7 +106,7 @@ func ValidateContentKeyPolicyID(input interface{}, key string) (warnings []strin // ID returns the formatted Content Key Policy ID func (id ContentKeyPolicyId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/contentKeyPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ContentKeyPolicyName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.ContentKeyPolicyName) } // Segments returns a slice of Resource ID Segments which comprise this Content Key Policy ID @@ -119,7 +119,7 @@ func (id ContentKeyPolicyId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticContentKeyPolicies", "contentKeyPolicies", "contentKeyPolicies"), resourceids.UserSpecifiedSegment("contentKeyPolicyName", "contentKeyPolicyValue"), } @@ -130,7 +130,7 @@ func (id ContentKeyPolicyId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Content Key Policy Name: %q", id.ContentKeyPolicyName), } return fmt.Sprintf("Content Key Policy (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/contentkeypolicies/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/contentkeypolicies/id_mediaservice.go index 6693615eed5b..16c9a97afdc3 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/contentkeypolicies/id_mediaservice.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/contentkeypolicies/id_mediaservice.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = MediaServiceId{} type MediaServiceId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string } // NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { +func NewMediaServiceID(subscriptionId string, resourceGroupName string, mediaServiceName string) MediaServiceId { return MediaServiceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, } } @@ -44,8 +44,8 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateMediaServiceID(input interface{}, key string) (warnings []string, e // ID returns the formatted Media Service ID func (id MediaServiceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName) } // Segments returns a slice of Resource ID Segments which comprise this Media Service ID @@ -109,7 +109,7 @@ func (id MediaServiceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), } } @@ -118,7 +118,7 @@ func (id MediaServiceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), } return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/README.md index 397b152e4064..7ca9293c8380 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") if err := client.AllocateThenPoll(ctx, id); err != nil { // handle the error @@ -36,7 +36,7 @@ if err := client.AllocateThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := liveevents.NewLiveEventOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "operationIdValue") +id := liveevents.NewLiveEventOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "operationIdValue") read, err := client.AsyncOperation(ctx, id) if err != nil { @@ -52,7 +52,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") payload := liveevents.LiveEvent{ // ... @@ -69,7 +69,7 @@ if err := client.CreateThenPoll(ctx, id, payload, liveevents.DefaultCreateOperat ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -81,7 +81,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") read, err := client.Get(ctx, id) if err != nil { @@ -97,7 +97,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := liveevents.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := liveevents.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) @@ -114,7 +114,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := liveevents.NewOperationLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue", "operationIdValue") +id := liveevents.NewOperationLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue", "operationIdValue") read, err := client.OperationLocation(ctx, id) if err != nil { @@ -130,7 +130,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") if err := client.ResetThenPoll(ctx, id); err != nil { // handle the error @@ -142,7 +142,7 @@ if err := client.ResetThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") if err := client.StartThenPoll(ctx, id); err != nil { // handle the error @@ -154,7 +154,7 @@ if err := client.StartThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") payload := liveevents.LiveEventActionInput{ // ... @@ -171,7 +171,7 @@ if err := client.StopThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveevents.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") payload := liveevents.LiveEvent{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_liveevent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_liveevent.go index c89799de3faa..3d228d8ae5d2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_liveevent.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_liveevent.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = LiveEventId{} type LiveEventId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string LiveEventName string } // NewLiveEventID returns a new LiveEventId struct -func NewLiveEventID(subscriptionId string, resourceGroupName string, accountName string, liveEventName string) LiveEventId { +func NewLiveEventID(subscriptionId string, resourceGroupName string, mediaServiceName string, liveEventName string) LiveEventId { return LiveEventId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, LiveEventName: liveEventName, } } @@ -46,8 +46,8 @@ func ParseLiveEventID(input string) (*LiveEventId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -77,8 +77,8 @@ func ParseLiveEventIDInsensitively(input string) (*LiveEventId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -106,7 +106,7 @@ func ValidateLiveEventID(input interface{}, key string) (warnings []string, erro // ID returns the formatted Live Event ID func (id LiveEventId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/liveEvents/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.LiveEventName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.LiveEventName) } // Segments returns a slice of Resource ID Segments which comprise this Live Event ID @@ -119,7 +119,7 @@ func (id LiveEventId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticLiveEvents", "liveEvents", "liveEvents"), resourceids.UserSpecifiedSegment("liveEventName", "liveEventValue"), } @@ -130,7 +130,7 @@ func (id LiveEventId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Live Event Name: %q", id.LiveEventName), } return fmt.Sprintf("Live Event (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_liveeventoperation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_liveeventoperation.go index fa47f07db922..64b687e73d7f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_liveeventoperation.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_liveeventoperation.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = LiveEventOperationId{} type LiveEventOperationId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string OperationId string } // NewLiveEventOperationID returns a new LiveEventOperationId struct -func NewLiveEventOperationID(subscriptionId string, resourceGroupName string, accountName string, operationId string) LiveEventOperationId { +func NewLiveEventOperationID(subscriptionId string, resourceGroupName string, mediaServiceName string, operationId string) LiveEventOperationId { return LiveEventOperationId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, OperationId: operationId, } } @@ -46,8 +46,8 @@ func ParseLiveEventOperationID(input string) (*LiveEventOperationId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { @@ -77,8 +77,8 @@ func ParseLiveEventOperationIDInsensitively(input string) (*LiveEventOperationId return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { @@ -106,7 +106,7 @@ func ValidateLiveEventOperationID(input interface{}, key string) (warnings []str // ID returns the formatted Live Event Operation ID func (id LiveEventOperationId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/liveEventOperations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.OperationId) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.OperationId) } // Segments returns a slice of Resource ID Segments which comprise this Live Event Operation ID @@ -119,7 +119,7 @@ func (id LiveEventOperationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticLiveEventOperations", "liveEventOperations", "liveEventOperations"), resourceids.UserSpecifiedSegment("operationId", "operationIdValue"), } @@ -130,7 +130,7 @@ func (id LiveEventOperationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Operation: %q", id.OperationId), } return fmt.Sprintf("Live Event Operation (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_mediaservice.go index 8c8c2a33c99d..e35d784539b0 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_mediaservice.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_mediaservice.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = MediaServiceId{} type MediaServiceId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string } // NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { +func NewMediaServiceID(subscriptionId string, resourceGroupName string, mediaServiceName string) MediaServiceId { return MediaServiceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, } } @@ -44,8 +44,8 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateMediaServiceID(input interface{}, key string) (warnings []string, e // ID returns the formatted Media Service ID func (id MediaServiceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName) } // Segments returns a slice of Resource ID Segments which comprise this Media Service ID @@ -109,7 +109,7 @@ func (id MediaServiceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), } } @@ -118,7 +118,7 @@ func (id MediaServiceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), } return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_operationlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_operationlocation.go index 58315b224ae3..b9d101dcbcec 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_operationlocation.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents/id_operationlocation.go @@ -13,17 +13,17 @@ var _ resourceids.ResourceId = OperationLocationId{} type OperationLocationId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string LiveEventName string OperationId string } // NewOperationLocationID returns a new OperationLocationId struct -func NewOperationLocationID(subscriptionId string, resourceGroupName string, accountName string, liveEventName string, operationId string) OperationLocationId { +func NewOperationLocationID(subscriptionId string, resourceGroupName string, mediaServiceName string, liveEventName string, operationId string) OperationLocationId { return OperationLocationId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, LiveEventName: liveEventName, OperationId: operationId, } @@ -48,8 +48,8 @@ func ParseOperationLocationID(input string) (*OperationLocationId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -83,8 +83,8 @@ func ParseOperationLocationIDInsensitively(input string) (*OperationLocationId, return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -116,7 +116,7 @@ func ValidateOperationLocationID(input interface{}, key string) (warnings []stri // ID returns the formatted Operation Location ID func (id OperationLocationId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/liveEvents/%s/operationLocations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.LiveEventName, id.OperationId) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.LiveEventName, id.OperationId) } // Segments returns a slice of Resource ID Segments which comprise this Operation Location ID @@ -129,7 +129,7 @@ func (id OperationLocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticLiveEvents", "liveEvents", "liveEvents"), resourceids.UserSpecifiedSegment("liveEventName", "liveEventValue"), resourceids.StaticSegment("staticOperationLocations", "operationLocations", "operationLocations"), @@ -142,7 +142,7 @@ func (id OperationLocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Live Event Name: %q", id.LiveEventName), fmt.Sprintf("Operation: %q", id.OperationId), } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/README.md index c7a453d0cf69..d36cba8bcf97 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := liveoutputs.NewLiveOutputOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "operationIdValue") +id := liveoutputs.NewLiveOutputOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "operationIdValue") read, err := client.AsyncOperation(ctx, id) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := liveoutputs.NewLiveOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue", "liveOutputValue") +id := liveoutputs.NewLiveOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue", "liveOutputValue") payload := liveoutputs.LiveOutput{ // ... @@ -57,7 +57,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := liveoutputs.NewLiveOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue", "liveOutputValue") +id := liveoutputs.NewLiveOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue", "liveOutputValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -69,7 +69,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := liveoutputs.NewLiveOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue", "liveOutputValue") +id := liveoutputs.NewLiveOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue", "liveOutputValue") read, err := client.Get(ctx, id) if err != nil { @@ -85,7 +85,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := liveoutputs.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue") +id := liveoutputs.NewLiveEventID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) @@ -102,7 +102,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := liveoutputs.NewLiveOutputOperationLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "liveEventValue", "liveOutputValue", "operationIdValue") +id := liveoutputs.NewLiveOutputOperationLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "liveEventValue", "liveOutputValue", "operationIdValue") read, err := client.OperationLocation(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveevent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveevent.go index 9fc7e57c6d3a..d230c62c7ac2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveevent.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveevent.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = LiveEventId{} type LiveEventId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string LiveEventName string } // NewLiveEventID returns a new LiveEventId struct -func NewLiveEventID(subscriptionId string, resourceGroupName string, accountName string, liveEventName string) LiveEventId { +func NewLiveEventID(subscriptionId string, resourceGroupName string, mediaServiceName string, liveEventName string) LiveEventId { return LiveEventId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, LiveEventName: liveEventName, } } @@ -46,8 +46,8 @@ func ParseLiveEventID(input string) (*LiveEventId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -77,8 +77,8 @@ func ParseLiveEventIDInsensitively(input string) (*LiveEventId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -106,7 +106,7 @@ func ValidateLiveEventID(input interface{}, key string) (warnings []string, erro // ID returns the formatted Live Event ID func (id LiveEventId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/liveEvents/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.LiveEventName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.LiveEventName) } // Segments returns a slice of Resource ID Segments which comprise this Live Event ID @@ -119,7 +119,7 @@ func (id LiveEventId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticLiveEvents", "liveEvents", "liveEvents"), resourceids.UserSpecifiedSegment("liveEventName", "liveEventValue"), } @@ -130,7 +130,7 @@ func (id LiveEventId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Live Event Name: %q", id.LiveEventName), } return fmt.Sprintf("Live Event (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveoutput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveoutput.go index ee7c371cb8b2..673de0f6fe63 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveoutput.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveoutput.go @@ -13,17 +13,17 @@ var _ resourceids.ResourceId = LiveOutputId{} type LiveOutputId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string LiveEventName string LiveOutputName string } // NewLiveOutputID returns a new LiveOutputId struct -func NewLiveOutputID(subscriptionId string, resourceGroupName string, accountName string, liveEventName string, liveOutputName string) LiveOutputId { +func NewLiveOutputID(subscriptionId string, resourceGroupName string, mediaServiceName string, liveEventName string, liveOutputName string) LiveOutputId { return LiveOutputId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, LiveEventName: liveEventName, LiveOutputName: liveOutputName, } @@ -48,8 +48,8 @@ func ParseLiveOutputID(input string) (*LiveOutputId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -83,8 +83,8 @@ func ParseLiveOutputIDInsensitively(input string) (*LiveOutputId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -116,7 +116,7 @@ func ValidateLiveOutputID(input interface{}, key string) (warnings []string, err // ID returns the formatted Live Output ID func (id LiveOutputId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/liveEvents/%s/liveOutputs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.LiveEventName, id.LiveOutputName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.LiveEventName, id.LiveOutputName) } // Segments returns a slice of Resource ID Segments which comprise this Live Output ID @@ -129,7 +129,7 @@ func (id LiveOutputId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticLiveEvents", "liveEvents", "liveEvents"), resourceids.UserSpecifiedSegment("liveEventName", "liveEventValue"), resourceids.StaticSegment("staticLiveOutputs", "liveOutputs", "liveOutputs"), @@ -142,7 +142,7 @@ func (id LiveOutputId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Live Event Name: %q", id.LiveEventName), fmt.Sprintf("Live Output Name: %q", id.LiveOutputName), } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveoutputoperation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveoutputoperation.go index ed10f5977373..0342474b409a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveoutputoperation.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveoutputoperation.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = LiveOutputOperationId{} type LiveOutputOperationId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string OperationId string } // NewLiveOutputOperationID returns a new LiveOutputOperationId struct -func NewLiveOutputOperationID(subscriptionId string, resourceGroupName string, accountName string, operationId string) LiveOutputOperationId { +func NewLiveOutputOperationID(subscriptionId string, resourceGroupName string, mediaServiceName string, operationId string) LiveOutputOperationId { return LiveOutputOperationId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, OperationId: operationId, } } @@ -46,8 +46,8 @@ func ParseLiveOutputOperationID(input string) (*LiveOutputOperationId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { @@ -77,8 +77,8 @@ func ParseLiveOutputOperationIDInsensitively(input string) (*LiveOutputOperation return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { @@ -106,7 +106,7 @@ func ValidateLiveOutputOperationID(input interface{}, key string) (warnings []st // ID returns the formatted Live Output Operation ID func (id LiveOutputOperationId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/liveOutputOperations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.OperationId) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.OperationId) } // Segments returns a slice of Resource ID Segments which comprise this Live Output Operation ID @@ -119,7 +119,7 @@ func (id LiveOutputOperationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticLiveOutputOperations", "liveOutputOperations", "liveOutputOperations"), resourceids.UserSpecifiedSegment("operationId", "operationIdValue"), } @@ -130,7 +130,7 @@ func (id LiveOutputOperationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Operation: %q", id.OperationId), } return fmt.Sprintf("Live Output Operation (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveoutputoperationlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveoutputoperationlocation.go index c546236349fe..dcc1649bc2a8 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveoutputoperationlocation.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs/id_liveoutputoperationlocation.go @@ -13,18 +13,18 @@ var _ resourceids.ResourceId = LiveOutputOperationLocationId{} type LiveOutputOperationLocationId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string LiveEventName string LiveOutputName string OperationId string } // NewLiveOutputOperationLocationID returns a new LiveOutputOperationLocationId struct -func NewLiveOutputOperationLocationID(subscriptionId string, resourceGroupName string, accountName string, liveEventName string, liveOutputName string, operationId string) LiveOutputOperationLocationId { +func NewLiveOutputOperationLocationID(subscriptionId string, resourceGroupName string, mediaServiceName string, liveEventName string, liveOutputName string, operationId string) LiveOutputOperationLocationId { return LiveOutputOperationLocationId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, LiveEventName: liveEventName, LiveOutputName: liveOutputName, OperationId: operationId, @@ -50,8 +50,8 @@ func ParseLiveOutputOperationLocationID(input string) (*LiveOutputOperationLocat return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -89,8 +89,8 @@ func ParseLiveOutputOperationLocationIDInsensitively(input string) (*LiveOutputO return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { @@ -126,7 +126,7 @@ func ValidateLiveOutputOperationLocationID(input interface{}, key string) (warni // ID returns the formatted Live Output Operation Location ID func (id LiveOutputOperationLocationId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/liveEvents/%s/liveOutputs/%s/operationLocations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.LiveEventName, id.LiveOutputName, id.OperationId) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.LiveEventName, id.LiveOutputName, id.OperationId) } // Segments returns a slice of Resource ID Segments which comprise this Live Output Operation Location ID @@ -139,7 +139,7 @@ func (id LiveOutputOperationLocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticLiveEvents", "liveEvents", "liveEvents"), resourceids.UserSpecifiedSegment("liveEventName", "liveEventValue"), resourceids.StaticSegment("staticLiveOutputs", "liveOutputs", "liveOutputs"), @@ -154,7 +154,7 @@ func (id LiveOutputOperationLocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Live Event Name: %q", id.LiveEventName), fmt.Sprintf("Live Output Name: %q", id.LiveOutputName), fmt.Sprintf("Operation: %q", id.OperationId), diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/README.md deleted file mode 100644 index 30aa01b0c02a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint` Documentation - -The `streamingendpoint` SDK allows for interaction with the Azure Resource Manager Service `media` (API Version `2022-08-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint" -``` - - -### Client Initialization - -```go -client := streamingendpoint.NewStreamingEndpointClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `StreamingEndpointClient.Update` - -```go -ctx := context.TODO() -id := streamingendpoint.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") - -payload := streamingendpoint.StreamingEndpoint{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/client.go deleted file mode 100644 index 2d91ced79992..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package streamingendpoint - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEndpointClient struct { - Client autorest.Client - baseUri string -} - -func NewStreamingEndpointClientWithBaseURI(endpoint string) StreamingEndpointClient { - return StreamingEndpointClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/constants.go deleted file mode 100644 index 109b9cf7212c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/constants.go +++ /dev/null @@ -1,46 +0,0 @@ -package streamingendpoint - -import "strings" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEndpointResourceState string - -const ( - StreamingEndpointResourceStateDeleting StreamingEndpointResourceState = "Deleting" - StreamingEndpointResourceStateRunning StreamingEndpointResourceState = "Running" - StreamingEndpointResourceStateScaling StreamingEndpointResourceState = "Scaling" - StreamingEndpointResourceStateStarting StreamingEndpointResourceState = "Starting" - StreamingEndpointResourceStateStopped StreamingEndpointResourceState = "Stopped" - StreamingEndpointResourceStateStopping StreamingEndpointResourceState = "Stopping" -) - -func PossibleValuesForStreamingEndpointResourceState() []string { - return []string{ - string(StreamingEndpointResourceStateDeleting), - string(StreamingEndpointResourceStateRunning), - string(StreamingEndpointResourceStateScaling), - string(StreamingEndpointResourceStateStarting), - string(StreamingEndpointResourceStateStopped), - string(StreamingEndpointResourceStateStopping), - } -} - -func parseStreamingEndpointResourceState(input string) (*StreamingEndpointResourceState, error) { - vals := map[string]StreamingEndpointResourceState{ - "deleting": StreamingEndpointResourceStateDeleting, - "running": StreamingEndpointResourceStateRunning, - "scaling": StreamingEndpointResourceStateScaling, - "starting": StreamingEndpointResourceStateStarting, - "stopped": StreamingEndpointResourceStateStopped, - "stopping": StreamingEndpointResourceStateStopping, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := StreamingEndpointResourceState(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/id_streamingendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/id_streamingendpoint.go deleted file mode 100644 index c7b330ffd73e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/id_streamingendpoint.go +++ /dev/null @@ -1,137 +0,0 @@ -package streamingendpoint - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = StreamingEndpointId{} - -// StreamingEndpointId is a struct representing the Resource ID for a Streaming Endpoint -type StreamingEndpointId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - StreamingEndpointName string -} - -// NewStreamingEndpointID returns a new StreamingEndpointId struct -func NewStreamingEndpointID(subscriptionId string, resourceGroupName string, accountName string, streamingEndpointName string) StreamingEndpointId { - return StreamingEndpointId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - StreamingEndpointName: streamingEndpointName, - } -} - -// ParseStreamingEndpointID parses 'input' into a StreamingEndpointId -func ParseStreamingEndpointID(input string) (*StreamingEndpointId, error) { - parser := resourceids.NewParserFromResourceIdType(StreamingEndpointId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := StreamingEndpointId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { - return nil, fmt.Errorf("the segment 'streamingEndpointName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseStreamingEndpointIDInsensitively parses 'input' case-insensitively into a StreamingEndpointId -// note: this method should only be used for API response data and not user input -func ParseStreamingEndpointIDInsensitively(input string) (*StreamingEndpointId, error) { - parser := resourceids.NewParserFromResourceIdType(StreamingEndpointId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := StreamingEndpointId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { - return nil, fmt.Errorf("the segment 'streamingEndpointName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateStreamingEndpointID checks that 'input' can be parsed as a Streaming Endpoint ID -func ValidateStreamingEndpointID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseStreamingEndpointID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Streaming Endpoint ID -func (id StreamingEndpointId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/streamingEndpoints/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.StreamingEndpointName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Streaming Endpoint ID -func (id StreamingEndpointId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticStreamingEndpoints", "streamingEndpoints", "streamingEndpoints"), - resourceids.UserSpecifiedSegment("streamingEndpointName", "streamingEndpointValue"), - } -} - -// String returns a human-readable description of this Streaming Endpoint ID -func (id StreamingEndpointId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Streaming Endpoint Name: %q", id.StreamingEndpointName), - } - return fmt.Sprintf("Streaming Endpoint (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/method_update_autorest.go deleted file mode 100644 index 5c9d24a2112e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/method_update_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package streamingendpoint - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c StreamingEndpointClient) Update(ctx context.Context, id StreamingEndpointId, input StreamingEndpoint) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoint.StreamingEndpointClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "streamingendpoint.StreamingEndpointClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c StreamingEndpointClient) UpdateThenPoll(ctx context.Context, id StreamingEndpointId, input StreamingEndpoint) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c StreamingEndpointClient) preparerForUpdate(ctx context.Context, id StreamingEndpointId, input StreamingEndpoint) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c StreamingEndpointClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_akamaiaccesscontrol.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_akamaiaccesscontrol.go deleted file mode 100644 index 909094afeeae..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_akamaiaccesscontrol.go +++ /dev/null @@ -1,8 +0,0 @@ -package streamingendpoint - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AkamaiAccessControl struct { - AkamaiSignatureHeaderAuthenticationKeyList *[]AkamaiSignatureHeaderAuthenticationKey `json:"akamaiSignatureHeaderAuthenticationKeyList,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_akamaisignatureheaderauthenticationkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_akamaisignatureheaderauthenticationkey.go deleted file mode 100644 index c637fe893bc6..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_akamaisignatureheaderauthenticationkey.go +++ /dev/null @@ -1,28 +0,0 @@ -package streamingendpoint - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AkamaiSignatureHeaderAuthenticationKey struct { - Base64Key *string `json:"base64Key,omitempty"` - Expiration *string `json:"expiration,omitempty"` - Identifier *string `json:"identifier,omitempty"` -} - -func (o *AkamaiSignatureHeaderAuthenticationKey) GetExpirationAsTime() (*time.Time, error) { - if o.Expiration == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Expiration, "2006-01-02T15:04:05Z07:00") -} - -func (o *AkamaiSignatureHeaderAuthenticationKey) SetExpirationAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Expiration = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_armstreamingendpointcurrentsku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_armstreamingendpointcurrentsku.go deleted file mode 100644 index 6efda14b39ee..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_armstreamingendpointcurrentsku.go +++ /dev/null @@ -1,9 +0,0 @@ -package streamingendpoint - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ArmStreamingEndpointCurrentSku struct { - Capacity *int64 `json:"capacity,omitempty"` - Name *string `json:"name,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_crosssiteaccesspolicies.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_crosssiteaccesspolicies.go deleted file mode 100644 index a8b65db46d37..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_crosssiteaccesspolicies.go +++ /dev/null @@ -1,9 +0,0 @@ -package streamingendpoint - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CrossSiteAccessPolicies struct { - ClientAccessPolicy *string `json:"clientAccessPolicy,omitempty"` - CrossDomainPolicy *string `json:"crossDomainPolicy,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_ipaccesscontrol.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_ipaccesscontrol.go deleted file mode 100644 index 31f7b781a4dc..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_ipaccesscontrol.go +++ /dev/null @@ -1,8 +0,0 @@ -package streamingendpoint - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type IPAccessControl struct { - Allow *[]IPRange `json:"allow,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_iprange.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_iprange.go deleted file mode 100644 index 95d0a53b5cd1..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_iprange.go +++ /dev/null @@ -1,10 +0,0 @@ -package streamingendpoint - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type IPRange struct { - Address *string `json:"address,omitempty"` - Name *string `json:"name,omitempty"` - SubnetPrefixLength *int64 `json:"subnetPrefixLength,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_streamingendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_streamingendpoint.go deleted file mode 100644 index 99c1789f1f97..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_streamingendpoint.go +++ /dev/null @@ -1,19 +0,0 @@ -package streamingendpoint - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEndpoint struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *StreamingEndpointProperties `json:"properties,omitempty"` - Sku *ArmStreamingEndpointCurrentSku `json:"sku,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_streamingendpointaccesscontrol.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_streamingendpointaccesscontrol.go deleted file mode 100644 index 5460311eda23..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_streamingendpointaccesscontrol.go +++ /dev/null @@ -1,9 +0,0 @@ -package streamingendpoint - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEndpointAccessControl struct { - Akamai *AkamaiAccessControl `json:"akamai,omitempty"` - IP *IPAccessControl `json:"ip,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_streamingendpointproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_streamingendpointproperties.go deleted file mode 100644 index 52a58c941115..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/model_streamingendpointproperties.go +++ /dev/null @@ -1,65 +0,0 @@ -package streamingendpoint - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StreamingEndpointProperties struct { - AccessControl *StreamingEndpointAccessControl `json:"accessControl,omitempty"` - AvailabilitySetName *string `json:"availabilitySetName,omitempty"` - CdnEnabled *bool `json:"cdnEnabled,omitempty"` - CdnProfile *string `json:"cdnProfile,omitempty"` - CdnProvider *string `json:"cdnProvider,omitempty"` - Created *string `json:"created,omitempty"` - CrossSiteAccessPolicies *CrossSiteAccessPolicies `json:"crossSiteAccessPolicies,omitempty"` - CustomHostNames *[]string `json:"customHostNames,omitempty"` - Description *string `json:"description,omitempty"` - FreeTrialEndTime *string `json:"freeTrialEndTime,omitempty"` - HostName *string `json:"hostName,omitempty"` - LastModified *string `json:"lastModified,omitempty"` - MaxCacheAge *int64 `json:"maxCacheAge,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ResourceState *StreamingEndpointResourceState `json:"resourceState,omitempty"` - ScaleUnits int64 `json:"scaleUnits"` -} - -func (o *StreamingEndpointProperties) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *StreamingEndpointProperties) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} - -func (o *StreamingEndpointProperties) GetFreeTrialEndTimeAsTime() (*time.Time, error) { - if o.FreeTrialEndTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.FreeTrialEndTime, "2006-01-02T15:04:05Z07:00") -} - -func (o *StreamingEndpointProperties) SetFreeTrialEndTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.FreeTrialEndTime = &formatted -} - -func (o *StreamingEndpointProperties) GetLastModifiedAsTime() (*time.Time, error) { - if o.LastModified == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModified, "2006-01-02T15:04:05Z07:00") -} - -func (o *StreamingEndpointProperties) SetLastModifiedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModified = &formatted -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/version.go deleted file mode 100644 index b1470d2f3f1d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package streamingendpoint - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-08-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/streamingendpoint/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/README.md index a1cbda015f81..ec45f04e8bc6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "operationIdValue") +id := streamingendpoints.NewStreamingEndpointOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "operationIdValue") read, err := client.AsyncOperation(ctx, id) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") payload := streamingendpoints.StreamingEndpoint{ // ... @@ -57,7 +57,7 @@ if err := client.CreateThenPoll(ctx, id, payload, streamingendpoints.DefaultCrea ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -69,7 +69,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") read, err := client.Get(ctx, id) if err != nil { @@ -85,7 +85,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingendpoints.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := streamingendpoints.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) @@ -102,7 +102,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointOperationLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue", "operationIdValue") +id := streamingendpoints.NewStreamingEndpointOperationLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue", "operationIdValue") read, err := client.OperationLocation(ctx, id) if err != nil { @@ -118,7 +118,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") payload := streamingendpoints.StreamingEntityScaleUnit{ // ... @@ -135,7 +135,7 @@ if err := client.ScaleThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") read, err := client.Skus(ctx, id) if err != nil { @@ -151,7 +151,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") if err := client.StartThenPoll(ctx, id); err != nil { // handle the error @@ -163,9 +163,26 @@ if err := client.StartThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingEndpointValue") +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") if err := client.StopThenPoll(ctx, id); err != nil { // handle the error } ``` + + +### Example Usage: `StreamingEndpointsClient.Update` + +```go +ctx := context.TODO() +id := streamingendpoints.NewStreamingEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingEndpointValue") + +payload := streamingendpoints.StreamingEndpoint{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_mediaservice.go index 8f025a992deb..885d3947268f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_mediaservice.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_mediaservice.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = MediaServiceId{} type MediaServiceId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string } // NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { +func NewMediaServiceID(subscriptionId string, resourceGroupName string, mediaServiceName string) MediaServiceId { return MediaServiceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, } } @@ -44,8 +44,8 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateMediaServiceID(input interface{}, key string) (warnings []string, e // ID returns the formatted Media Service ID func (id MediaServiceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName) } // Segments returns a slice of Resource ID Segments which comprise this Media Service ID @@ -109,7 +109,7 @@ func (id MediaServiceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), } } @@ -118,7 +118,7 @@ func (id MediaServiceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), } return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpoint.go index e670dae8f131..da3bbe0ad88a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpoint.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpoint.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = StreamingEndpointId{} type StreamingEndpointId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string StreamingEndpointName string } // NewStreamingEndpointID returns a new StreamingEndpointId struct -func NewStreamingEndpointID(subscriptionId string, resourceGroupName string, accountName string, streamingEndpointName string) StreamingEndpointId { +func NewStreamingEndpointID(subscriptionId string, resourceGroupName string, mediaServiceName string, streamingEndpointName string) StreamingEndpointId { return StreamingEndpointId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, StreamingEndpointName: streamingEndpointName, } } @@ -46,8 +46,8 @@ func ParseStreamingEndpointID(input string) (*StreamingEndpointId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { @@ -77,8 +77,8 @@ func ParseStreamingEndpointIDInsensitively(input string) (*StreamingEndpointId, return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { @@ -106,7 +106,7 @@ func ValidateStreamingEndpointID(input interface{}, key string) (warnings []stri // ID returns the formatted Streaming Endpoint ID func (id StreamingEndpointId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/streamingEndpoints/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.StreamingEndpointName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.StreamingEndpointName) } // Segments returns a slice of Resource ID Segments which comprise this Streaming Endpoint ID @@ -119,7 +119,7 @@ func (id StreamingEndpointId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticStreamingEndpoints", "streamingEndpoints", "streamingEndpoints"), resourceids.UserSpecifiedSegment("streamingEndpointName", "streamingEndpointValue"), } @@ -130,7 +130,7 @@ func (id StreamingEndpointId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Streaming Endpoint Name: %q", id.StreamingEndpointName), } return fmt.Sprintf("Streaming Endpoint (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpointoperation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpointoperation.go index d657a5c304b8..08528afcd423 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpointoperation.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpointoperation.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = StreamingEndpointOperationId{} type StreamingEndpointOperationId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string OperationId string } // NewStreamingEndpointOperationID returns a new StreamingEndpointOperationId struct -func NewStreamingEndpointOperationID(subscriptionId string, resourceGroupName string, accountName string, operationId string) StreamingEndpointOperationId { +func NewStreamingEndpointOperationID(subscriptionId string, resourceGroupName string, mediaServiceName string, operationId string) StreamingEndpointOperationId { return StreamingEndpointOperationId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, OperationId: operationId, } } @@ -46,8 +46,8 @@ func ParseStreamingEndpointOperationID(input string) (*StreamingEndpointOperatio return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { @@ -77,8 +77,8 @@ func ParseStreamingEndpointOperationIDInsensitively(input string) (*StreamingEnd return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { @@ -106,7 +106,7 @@ func ValidateStreamingEndpointOperationID(input interface{}, key string) (warnin // ID returns the formatted Streaming Endpoint Operation ID func (id StreamingEndpointOperationId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/streamingEndpointOperations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.OperationId) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.OperationId) } // Segments returns a slice of Resource ID Segments which comprise this Streaming Endpoint Operation ID @@ -119,7 +119,7 @@ func (id StreamingEndpointOperationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticStreamingEndpointOperations", "streamingEndpointOperations", "streamingEndpointOperations"), resourceids.UserSpecifiedSegment("operationId", "operationIdValue"), } @@ -130,7 +130,7 @@ func (id StreamingEndpointOperationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Operation: %q", id.OperationId), } return fmt.Sprintf("Streaming Endpoint Operation (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpointoperationlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpointoperationlocation.go index b4b3fd5ed96e..4d08c7eeca2b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpointoperationlocation.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpointoperationlocation.go @@ -13,17 +13,17 @@ var _ resourceids.ResourceId = StreamingEndpointOperationLocationId{} type StreamingEndpointOperationLocationId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string StreamingEndpointName string OperationId string } // NewStreamingEndpointOperationLocationID returns a new StreamingEndpointOperationLocationId struct -func NewStreamingEndpointOperationLocationID(subscriptionId string, resourceGroupName string, accountName string, streamingEndpointName string, operationId string) StreamingEndpointOperationLocationId { +func NewStreamingEndpointOperationLocationID(subscriptionId string, resourceGroupName string, mediaServiceName string, streamingEndpointName string, operationId string) StreamingEndpointOperationLocationId { return StreamingEndpointOperationLocationId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, StreamingEndpointName: streamingEndpointName, OperationId: operationId, } @@ -48,8 +48,8 @@ func ParseStreamingEndpointOperationLocationID(input string) (*StreamingEndpoint return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { @@ -83,8 +83,8 @@ func ParseStreamingEndpointOperationLocationIDInsensitively(input string) (*Stre return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { @@ -116,7 +116,7 @@ func ValidateStreamingEndpointOperationLocationID(input interface{}, key string) // ID returns the formatted Streaming Endpoint Operation Location ID func (id StreamingEndpointOperationLocationId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/streamingEndpoints/%s/operationLocations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.StreamingEndpointName, id.OperationId) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.StreamingEndpointName, id.OperationId) } // Segments returns a slice of Resource ID Segments which comprise this Streaming Endpoint Operation Location ID @@ -129,7 +129,7 @@ func (id StreamingEndpointOperationLocationId) Segments() []resourceids.Segment resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticStreamingEndpoints", "streamingEndpoints", "streamingEndpoints"), resourceids.UserSpecifiedSegment("streamingEndpointName", "streamingEndpointValue"), resourceids.StaticSegment("staticOperationLocations", "operationLocations", "operationLocations"), @@ -142,7 +142,7 @@ func (id StreamingEndpointOperationLocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Streaming Endpoint Name: %q", id.StreamingEndpointName), fmt.Sprintf("Operation: %q", id.OperationId), } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/method_update_autorest.go new file mode 100644 index 000000000000..7a29476eb7be --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints/method_update_autorest.go @@ -0,0 +1,79 @@ +package streamingendpoints + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c StreamingEndpointsClient) Update(ctx context.Context, id StreamingEndpointId, input StreamingEndpoint) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "streamingendpoints.StreamingEndpointsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c StreamingEndpointsClient) UpdateThenPoll(ctx context.Context, id StreamingEndpointId, input StreamingEndpoint) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c StreamingEndpointsClient) preparerForUpdate(ctx context.Context, id StreamingEndpointId, input StreamingEndpoint) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c StreamingEndpointsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/README.md index f6c377b011b7..7d89cec65d89 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingLocatorValue") +id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingLocatorValue") payload := streamingpoliciesandstreaminglocators.StreamingLocator{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingLocatorValue") +id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingLocatorValue") read, err := client.StreamingLocatorsDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingLocatorValue") +id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingLocatorValue") read, err := client.StreamingLocatorsGet(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := streamingpoliciesandstreaminglocators.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") // alternatively `client.StreamingLocatorsList(ctx, id, streamingpoliciesandstreaminglocators.DefaultStreamingLocatorsListOperationOptions())` can be used to do batched pagination items, err := client.StreamingLocatorsListComplete(ctx, id, streamingpoliciesandstreaminglocators.DefaultStreamingLocatorsListOperationOptions()) @@ -94,7 +94,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingLocatorValue") +id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingLocatorValue") read, err := client.StreamingLocatorsListContentKeys(ctx, id) if err != nil { @@ -110,7 +110,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingLocatorValue") +id := streamingpoliciesandstreaminglocators.NewStreamingLocatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingLocatorValue") read, err := client.StreamingLocatorsListPaths(ctx, id) if err != nil { @@ -126,7 +126,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingPolicyValue") +id := streamingpoliciesandstreaminglocators.NewStreamingPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingPolicyValue") payload := streamingpoliciesandstreaminglocators.StreamingPolicy{ // ... @@ -147,7 +147,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingPolicyValue") +id := streamingpoliciesandstreaminglocators.NewStreamingPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingPolicyValue") read, err := client.StreamingPoliciesDelete(ctx, id) if err != nil { @@ -163,7 +163,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewStreamingPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "streamingPolicyValue") +id := streamingpoliciesandstreaminglocators.NewStreamingPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue", "streamingPolicyValue") read, err := client.StreamingPoliciesGet(ctx, id) if err != nil { @@ -179,7 +179,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := streamingpoliciesandstreaminglocators.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := streamingpoliciesandstreaminglocators.NewMediaServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mediaServiceValue") // alternatively `client.StreamingPoliciesList(ctx, id, streamingpoliciesandstreaminglocators.DefaultStreamingPoliciesListOperationOptions())` can be used to do batched pagination items, err := client.StreamingPoliciesListComplete(ctx, id, streamingpoliciesandstreaminglocators.DefaultStreamingPoliciesListOperationOptions()) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_mediaservice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_mediaservice.go index 97964c679bd2..ba3aaa702658 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_mediaservice.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_mediaservice.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = MediaServiceId{} type MediaServiceId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string } // NewMediaServiceID returns a new MediaServiceId struct -func NewMediaServiceID(subscriptionId string, resourceGroupName string, accountName string) MediaServiceId { +func NewMediaServiceID(subscriptionId string, resourceGroupName string, mediaServiceName string) MediaServiceId { return MediaServiceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, } } @@ -44,8 +44,8 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateMediaServiceID(input interface{}, key string) (warnings []string, e // ID returns the formatted Media Service ID func (id MediaServiceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName) } // Segments returns a slice of Resource ID Segments which comprise this Media Service ID @@ -109,7 +109,7 @@ func (id MediaServiceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), } } @@ -118,7 +118,7 @@ func (id MediaServiceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), } return fmt.Sprintf("Media Service (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go index 5bc5c7f6fba1..62096fdd6f71 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = StreamingLocatorId{} type StreamingLocatorId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string StreamingLocatorName string } // NewStreamingLocatorID returns a new StreamingLocatorId struct -func NewStreamingLocatorID(subscriptionId string, resourceGroupName string, accountName string, streamingLocatorName string) StreamingLocatorId { +func NewStreamingLocatorID(subscriptionId string, resourceGroupName string, mediaServiceName string, streamingLocatorName string) StreamingLocatorId { return StreamingLocatorId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, StreamingLocatorName: streamingLocatorName, } } @@ -46,8 +46,8 @@ func ParseStreamingLocatorID(input string) (*StreamingLocatorId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.StreamingLocatorName, ok = parsed.Parsed["streamingLocatorName"]; !ok { @@ -77,8 +77,8 @@ func ParseStreamingLocatorIDInsensitively(input string) (*StreamingLocatorId, er return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.StreamingLocatorName, ok = parsed.Parsed["streamingLocatorName"]; !ok { @@ -106,7 +106,7 @@ func ValidateStreamingLocatorID(input interface{}, key string) (warnings []strin // ID returns the formatted Streaming Locator ID func (id StreamingLocatorId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/streamingLocators/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.StreamingLocatorName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.StreamingLocatorName) } // Segments returns a slice of Resource ID Segments which comprise this Streaming Locator ID @@ -119,7 +119,7 @@ func (id StreamingLocatorId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticStreamingLocators", "streamingLocators", "streamingLocators"), resourceids.UserSpecifiedSegment("streamingLocatorName", "streamingLocatorValue"), } @@ -130,7 +130,7 @@ func (id StreamingLocatorId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Streaming Locator Name: %q", id.StreamingLocatorName), } return fmt.Sprintf("Streaming Locator (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go index 3eedc295ee33..a7dfa53f75f2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = StreamingPolicyId{} type StreamingPolicyId struct { SubscriptionId string ResourceGroupName string - AccountName string + MediaServiceName string StreamingPolicyName string } // NewStreamingPolicyID returns a new StreamingPolicyId struct -func NewStreamingPolicyID(subscriptionId string, resourceGroupName string, accountName string, streamingPolicyName string) StreamingPolicyId { +func NewStreamingPolicyID(subscriptionId string, resourceGroupName string, mediaServiceName string, streamingPolicyName string) StreamingPolicyId { return StreamingPolicyId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + MediaServiceName: mediaServiceName, StreamingPolicyName: streamingPolicyName, } } @@ -46,8 +46,8 @@ func ParseStreamingPolicyID(input string) (*StreamingPolicyId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.StreamingPolicyName, ok = parsed.Parsed["streamingPolicyName"]; !ok { @@ -77,8 +77,8 @@ func ParseStreamingPolicyIDInsensitively(input string) (*StreamingPolicyId, erro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'mediaServiceName' was not found in the resource id %q", input) } if id.StreamingPolicyName, ok = parsed.Parsed["streamingPolicyName"]; !ok { @@ -106,7 +106,7 @@ func ValidateStreamingPolicyID(input interface{}, key string) (warnings []string // ID returns the formatted Streaming Policy ID func (id StreamingPolicyId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/mediaServices/%s/streamingPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.StreamingPolicyName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MediaServiceName, id.StreamingPolicyName) } // Segments returns a slice of Resource ID Segments which comprise this Streaming Policy ID @@ -119,7 +119,7 @@ func (id StreamingPolicyId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticMediaServices", "mediaServices", "mediaServices"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("mediaServiceName", "mediaServiceValue"), resourceids.StaticSegment("staticStreamingPolicies", "streamingPolicies", "streamingPolicies"), resourceids.UserSpecifiedSegment("streamingPolicyName", "streamingPolicyValue"), } @@ -130,7 +130,7 @@ func (id StreamingPolicyId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Media Service Name: %q", id.MediaServiceName), fmt.Sprintf("Streaming Policy Name: %q", id.StreamingPolicyName), } return fmt.Sprintf("Streaming Policy (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/README.md index d4b19da11051..146aee06f246 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := resource.NewRemoteRenderingAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := resource.NewRemoteRenderingAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "remoteRenderingAccountValue") payload := resource.RemoteRenderingAccount{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := resource.NewRemoteRenderingAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := resource.NewRemoteRenderingAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "remoteRenderingAccountValue") read, err := client.RemoteRenderingAccountsDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := resource.NewRemoteRenderingAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := resource.NewRemoteRenderingAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "remoteRenderingAccountValue") read, err := client.RemoteRenderingAccountsGet(ctx, id) if err != nil { @@ -111,7 +111,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := resource.NewRemoteRenderingAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := resource.NewRemoteRenderingAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "remoteRenderingAccountValue") payload := resource.RemoteRenderingAccount{ // ... @@ -132,7 +132,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := resource.NewSpatialAnchorsAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := resource.NewSpatialAnchorsAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "spatialAnchorsAccountValue") payload := resource.SpatialAnchorsAccount{ // ... @@ -153,7 +153,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := resource.NewSpatialAnchorsAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := resource.NewSpatialAnchorsAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "spatialAnchorsAccountValue") read, err := client.SpatialAnchorsAccountsDelete(ctx, id) if err != nil { @@ -169,7 +169,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := resource.NewSpatialAnchorsAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := resource.NewSpatialAnchorsAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "spatialAnchorsAccountValue") read, err := client.SpatialAnchorsAccountsGet(ctx, id) if err != nil { @@ -219,7 +219,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := resource.NewSpatialAnchorsAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := resource.NewSpatialAnchorsAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "spatialAnchorsAccountValue") payload := resource.SpatialAnchorsAccount{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/id_remoterenderingaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/id_remoterenderingaccount.go index a2c7ef0374a9..00506ae5f4d7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/id_remoterenderingaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/id_remoterenderingaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = RemoteRenderingAccountId{} // RemoteRenderingAccountId is a struct representing the Resource ID for a Remote Rendering Account type RemoteRenderingAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + RemoteRenderingAccountName string } // NewRemoteRenderingAccountID returns a new RemoteRenderingAccountId struct -func NewRemoteRenderingAccountID(subscriptionId string, resourceGroupName string, accountName string) RemoteRenderingAccountId { +func NewRemoteRenderingAccountID(subscriptionId string, resourceGroupName string, remoteRenderingAccountName string) RemoteRenderingAccountId { return RemoteRenderingAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RemoteRenderingAccountName: remoteRenderingAccountName, } } @@ -44,8 +44,8 @@ func ParseRemoteRenderingAccountID(input string) (*RemoteRenderingAccountId, err return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.RemoteRenderingAccountName, ok = parsed.Parsed["remoteRenderingAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'remoteRenderingAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseRemoteRenderingAccountIDInsensitively(input string) (*RemoteRenderingA return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.RemoteRenderingAccountName, ok = parsed.Parsed["remoteRenderingAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'remoteRenderingAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateRemoteRenderingAccountID(input interface{}, key string) (warnings [ // ID returns the formatted Remote Rendering Account ID func (id RemoteRenderingAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.MixedReality/remoteRenderingAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RemoteRenderingAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Remote Rendering Account ID @@ -109,7 +109,7 @@ func (id RemoteRenderingAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMixedReality", "Microsoft.MixedReality", "Microsoft.MixedReality"), resourceids.StaticSegment("staticRemoteRenderingAccounts", "remoteRenderingAccounts", "remoteRenderingAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("remoteRenderingAccountName", "remoteRenderingAccountValue"), } } @@ -118,7 +118,7 @@ func (id RemoteRenderingAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Remote Rendering Account Name: %q", id.RemoteRenderingAccountName), } return fmt.Sprintf("Remote Rendering Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/id_spatialanchorsaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/id_spatialanchorsaccount.go index bfd535bb360b..363a0923ba08 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/id_spatialanchorsaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/id_spatialanchorsaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = SpatialAnchorsAccountId{} // SpatialAnchorsAccountId is a struct representing the Resource ID for a Spatial Anchors Account type SpatialAnchorsAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + SpatialAnchorsAccountName string } // NewSpatialAnchorsAccountID returns a new SpatialAnchorsAccountId struct -func NewSpatialAnchorsAccountID(subscriptionId string, resourceGroupName string, accountName string) SpatialAnchorsAccountId { +func NewSpatialAnchorsAccountID(subscriptionId string, resourceGroupName string, spatialAnchorsAccountName string) SpatialAnchorsAccountId { return SpatialAnchorsAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SpatialAnchorsAccountName: spatialAnchorsAccountName, } } @@ -44,8 +44,8 @@ func ParseSpatialAnchorsAccountID(input string) (*SpatialAnchorsAccountId, error return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.SpatialAnchorsAccountName, ok = parsed.Parsed["spatialAnchorsAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'spatialAnchorsAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseSpatialAnchorsAccountIDInsensitively(input string) (*SpatialAnchorsAcc return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.SpatialAnchorsAccountName, ok = parsed.Parsed["spatialAnchorsAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'spatialAnchorsAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateSpatialAnchorsAccountID(input interface{}, key string) (warnings [] // ID returns the formatted Spatial Anchors Account ID func (id SpatialAnchorsAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.MixedReality/spatialAnchorsAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SpatialAnchorsAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Spatial Anchors Account ID @@ -109,7 +109,7 @@ func (id SpatialAnchorsAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMixedReality", "Microsoft.MixedReality", "Microsoft.MixedReality"), resourceids.StaticSegment("staticSpatialAnchorsAccounts", "spatialAnchorsAccounts", "spatialAnchorsAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("spatialAnchorsAccountName", "spatialAnchorsAccountValue"), } } @@ -118,7 +118,7 @@ func (id SpatialAnchorsAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Spatial Anchors Account Name: %q", id.SpatialAnchorsAccountName), } return fmt.Sprintf("Spatial Anchors Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/README.md new file mode 100644 index 000000000000..1f275c38d074 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/README.md @@ -0,0 +1,86 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork` Documentation + +The `mobilenetwork` SDK allows for interaction with the Azure Resource Manager Service `mobilenetwork` (API Version `2022-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork" +``` + + +### Client Initialization + +```go +client := mobilenetwork.NewMobileNetworkClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `MobileNetworkClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := mobilenetwork.NewMobileNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue") + +payload := mobilenetwork.MobileNetwork{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `MobileNetworkClient.Delete` + +```go +ctx := context.TODO() +id := mobilenetwork.NewMobileNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `MobileNetworkClient.Get` + +```go +ctx := context.TODO() +id := mobilenetwork.NewMobileNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `MobileNetworkClient.UpdateTags` + +```go +ctx := context.TODO() +id := mobilenetwork.NewMobileNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue") + +payload := mobilenetwork.TagsObject{ + // ... +} + + +read, err := client.UpdateTags(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/client.go new file mode 100644 index 000000000000..c1ed42a5c63a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/client.go @@ -0,0 +1,18 @@ +package mobilenetwork + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MobileNetworkClient struct { + Client autorest.Client + baseUri string +} + +func NewMobileNetworkClientWithBaseURI(endpoint string) MobileNetworkClient { + return MobileNetworkClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/constants.go new file mode 100644 index 000000000000..97c99bd8b1e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/constants.go @@ -0,0 +1,49 @@ +package mobilenetwork + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUnknown), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "unknown": ProvisioningStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/id_mobilenetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/id_mobilenetwork.go new file mode 100644 index 000000000000..e1927326f641 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/id_mobilenetwork.go @@ -0,0 +1,124 @@ +package mobilenetwork + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = MobileNetworkId{} + +// MobileNetworkId is a struct representing the Resource ID for a Mobile Network +type MobileNetworkId struct { + SubscriptionId string + ResourceGroupName string + MobileNetworkName string +} + +// NewMobileNetworkID returns a new MobileNetworkId struct +func NewMobileNetworkID(subscriptionId string, resourceGroupName string, mobileNetworkName string) MobileNetworkId { + return MobileNetworkId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MobileNetworkName: mobileNetworkName, + } +} + +// ParseMobileNetworkID parses 'input' into a MobileNetworkId +func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { + parser := resourceids.NewParserFromResourceIdType(MobileNetworkId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MobileNetworkId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'mobileNetworkName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseMobileNetworkIDInsensitively parses 'input' case-insensitively into a MobileNetworkId +// note: this method should only be used for API response data and not user input +func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { + parser := resourceids.NewParserFromResourceIdType(MobileNetworkId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MobileNetworkId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'mobileNetworkName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID +func ValidateMobileNetworkID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseMobileNetworkID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Mobile Network ID +func (id MobileNetworkId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.MobileNetwork/mobileNetworks/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MobileNetworkName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Mobile Network ID +func (id MobileNetworkId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMobileNetwork", "Microsoft.MobileNetwork", "Microsoft.MobileNetwork"), + resourceids.StaticSegment("staticMobileNetworks", "mobileNetworks", "mobileNetworks"), + resourceids.UserSpecifiedSegment("mobileNetworkName", "mobileNetworkValue"), + } +} + +// String returns a human-readable description of this Mobile Network ID +func (id MobileNetworkId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Mobile Network Name: %q", id.MobileNetworkName), + } + return fmt.Sprintf("Mobile Network (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_createorupdate_autorest.go new file mode 100644 index 000000000000..d69e66b0a0e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c MobileNetworkClient) CreateOrUpdate(ctx context.Context, id MobileNetworkId, input MobileNetwork) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c MobileNetworkClient) CreateOrUpdateThenPoll(ctx context.Context, id MobileNetworkId, input MobileNetwork) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c MobileNetworkClient) preparerForCreateOrUpdate(ctx context.Context, id MobileNetworkId, input MobileNetwork) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c MobileNetworkClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_delete_autorest.go new file mode 100644 index 000000000000..c33e569602de --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_delete_autorest.go @@ -0,0 +1,78 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c MobileNetworkClient) Delete(ctx context.Context, id MobileNetworkId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c MobileNetworkClient) DeleteThenPoll(ctx context.Context, id MobileNetworkId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c MobileNetworkClient) preparerForDelete(ctx context.Context, id MobileNetworkId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c MobileNetworkClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_get_autorest.go new file mode 100644 index 000000000000..742ba5075bc8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_get_autorest.go @@ -0,0 +1,68 @@ +package mobilenetwork + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *MobileNetwork +} + +// Get ... +func (c MobileNetworkClient) Get(ctx context.Context, id MobileNetworkId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c MobileNetworkClient) preparerForGet(ctx context.Context, id MobileNetworkId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c MobileNetworkClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_updatetags_autorest.go new file mode 100644 index 000000000000..5bf9fe4915e4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_updatetags_autorest.go @@ -0,0 +1,69 @@ +package mobilenetwork + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateTagsOperationResponse struct { + HttpResponse *http.Response + Model *MobileNetwork +} + +// UpdateTags ... +func (c MobileNetworkClient) UpdateTags(ctx context.Context, id MobileNetworkId, input TagsObject) (result UpdateTagsOperationResponse, err error) { + req, err := c.preparerForUpdateTags(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "UpdateTags", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdateTags(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "UpdateTags", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdateTags prepares the UpdateTags request. +func (c MobileNetworkClient) preparerForUpdateTags(ctx context.Context, id MobileNetworkId, input TagsObject) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdateTags handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (c MobileNetworkClient) responderForUpdateTags(resp *http.Response) (result UpdateTagsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_mobilenetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_mobilenetwork.go new file mode 100644 index 000000000000..743adf7b20e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_mobilenetwork.go @@ -0,0 +1,18 @@ +package mobilenetwork + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MobileNetwork struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties MobileNetworkPropertiesFormat `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_mobilenetworkpropertiesformat.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_mobilenetworkpropertiesformat.go new file mode 100644 index 000000000000..bf4a38fd4603 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_mobilenetworkpropertiesformat.go @@ -0,0 +1,10 @@ +package mobilenetwork + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MobileNetworkPropertiesFormat struct { + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicLandMobileNetworkIdentifier PlmnId `json:"publicLandMobileNetworkIdentifier"` + ServiceKey *string `json:"serviceKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_plmnid.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_plmnid.go new file mode 100644 index 000000000000..bdd039f41493 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_plmnid.go @@ -0,0 +1,9 @@ +package mobilenetwork + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PlmnId struct { + Mcc string `json:"mcc"` + Mnc string `json:"mnc"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_tagsobject.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_tagsobject.go new file mode 100644 index 000000000000..bac4a674a893 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_tagsobject.go @@ -0,0 +1,8 @@ +package mobilenetwork + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagsObject struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/version.go new file mode 100644 index 000000000000..3908c584409a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/version.go @@ -0,0 +1,12 @@ +package mobilenetwork + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/mobilenetwork/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/README.md new file mode 100644 index 000000000000..de4a2e78c17b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/README.md @@ -0,0 +1,86 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service` Documentation + +The `service` SDK allows for interaction with the Azure Resource Manager Service `mobilenetwork` (API Version `2022-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service" +``` + + +### Client Initialization + +```go +client := service.NewServiceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServiceClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := service.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue", "serviceValue") + +payload := service.Service{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServiceClient.Delete` + +```go +ctx := context.TODO() +id := service.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue", "serviceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServiceClient.Get` + +```go +ctx := context.TODO() +id := service.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue", "serviceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServiceClient.UpdateTags` + +```go +ctx := context.TODO() +id := service.NewServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue", "serviceValue") + +payload := service.TagsObject{ + // ... +} + + +read, err := client.UpdateTags(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/client.go new file mode 100644 index 000000000000..c0efa2f4308f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/client.go @@ -0,0 +1,18 @@ +package service + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceClient struct { + Client autorest.Client + baseUri string +} + +func NewServiceClientWithBaseURI(endpoint string) ServiceClient { + return ServiceClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/constants.go new file mode 100644 index 000000000000..5d64a5f582e0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/constants.go @@ -0,0 +1,164 @@ +package service + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PreemptionCapability string + +const ( + PreemptionCapabilityMayPreempt PreemptionCapability = "MayPreempt" + PreemptionCapabilityNotPreempt PreemptionCapability = "NotPreempt" +) + +func PossibleValuesForPreemptionCapability() []string { + return []string{ + string(PreemptionCapabilityMayPreempt), + string(PreemptionCapabilityNotPreempt), + } +} + +func parsePreemptionCapability(input string) (*PreemptionCapability, error) { + vals := map[string]PreemptionCapability{ + "maypreempt": PreemptionCapabilityMayPreempt, + "notpreempt": PreemptionCapabilityNotPreempt, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PreemptionCapability(input) + return &out, nil +} + +type PreemptionVulnerability string + +const ( + PreemptionVulnerabilityNotPreemptable PreemptionVulnerability = "NotPreemptable" + PreemptionVulnerabilityPreemptable PreemptionVulnerability = "Preemptable" +) + +func PossibleValuesForPreemptionVulnerability() []string { + return []string{ + string(PreemptionVulnerabilityNotPreemptable), + string(PreemptionVulnerabilityPreemptable), + } +} + +func parsePreemptionVulnerability(input string) (*PreemptionVulnerability, error) { + vals := map[string]PreemptionVulnerability{ + "notpreemptable": PreemptionVulnerabilityNotPreemptable, + "preemptable": PreemptionVulnerabilityPreemptable, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PreemptionVulnerability(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUnknown), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "unknown": ProvisioningStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type SdfDirection string + +const ( + SdfDirectionBidirectional SdfDirection = "Bidirectional" + SdfDirectionDownlink SdfDirection = "Downlink" + SdfDirectionUplink SdfDirection = "Uplink" +) + +func PossibleValuesForSdfDirection() []string { + return []string{ + string(SdfDirectionBidirectional), + string(SdfDirectionDownlink), + string(SdfDirectionUplink), + } +} + +func parseSdfDirection(input string) (*SdfDirection, error) { + vals := map[string]SdfDirection{ + "bidirectional": SdfDirectionBidirectional, + "downlink": SdfDirectionDownlink, + "uplink": SdfDirectionUplink, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SdfDirection(input) + return &out, nil +} + +type TrafficControlPermission string + +const ( + TrafficControlPermissionBlocked TrafficControlPermission = "Blocked" + TrafficControlPermissionEnabled TrafficControlPermission = "Enabled" +) + +func PossibleValuesForTrafficControlPermission() []string { + return []string{ + string(TrafficControlPermissionBlocked), + string(TrafficControlPermissionEnabled), + } +} + +func parseTrafficControlPermission(input string) (*TrafficControlPermission, error) { + vals := map[string]TrafficControlPermission{ + "blocked": TrafficControlPermissionBlocked, + "enabled": TrafficControlPermissionEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TrafficControlPermission(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/id_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/id_service.go new file mode 100644 index 000000000000..05fbfbf82100 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/id_service.go @@ -0,0 +1,137 @@ +package service + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServiceId{} + +// ServiceId is a struct representing the Resource ID for a Service +type ServiceId struct { + SubscriptionId string + ResourceGroupName string + MobileNetworkName string + ServiceName string +} + +// NewServiceID returns a new ServiceId struct +func NewServiceID(subscriptionId string, resourceGroupName string, mobileNetworkName string, serviceName string) ServiceId { + return ServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MobileNetworkName: mobileNetworkName, + ServiceName: serviceName, + } +} + +// ParseServiceID parses 'input' into a ServiceId +func ParseServiceID(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'mobileNetworkName' was not found in the resource id %q", input) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, fmt.Errorf("the segment 'serviceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServiceIDInsensitively parses 'input' case-insensitively into a ServiceId +// note: this method should only be used for API response data and not user input +func ParseServiceIDInsensitively(input string) (*ServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'mobileNetworkName' was not found in the resource id %q", input) + } + + if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { + return nil, fmt.Errorf("the segment 'serviceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServiceID checks that 'input' can be parsed as a Service ID +func ValidateServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Service ID +func (id ServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.MobileNetwork/mobileNetworks/%s/services/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MobileNetworkName, id.ServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Service ID +func (id ServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMobileNetwork", "Microsoft.MobileNetwork", "Microsoft.MobileNetwork"), + resourceids.StaticSegment("staticMobileNetworks", "mobileNetworks", "mobileNetworks"), + resourceids.UserSpecifiedSegment("mobileNetworkName", "mobileNetworkValue"), + resourceids.StaticSegment("staticServices", "services", "services"), + resourceids.UserSpecifiedSegment("serviceName", "serviceValue"), + } +} + +// String returns a human-readable description of this Service ID +func (id ServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Mobile Network Name: %q", id.MobileNetworkName), + fmt.Sprintf("Service Name: %q", id.ServiceName), + } + return fmt.Sprintf("Service (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/method_createorupdate_autorest.go new file mode 100644 index 000000000000..9f3891483db3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package service + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c ServiceClient) CreateOrUpdate(ctx context.Context, id ServiceId, input Service) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "service.ServiceClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "service.ServiceClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ServiceClient) CreateOrUpdateThenPoll(ctx context.Context, id ServiceId, input Service) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ServiceClient) preparerForCreateOrUpdate(ctx context.Context, id ServiceId, input Service) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ServiceClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/method_delete_autorest.go new file mode 100644 index 000000000000..d7941cd7187b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/method_delete_autorest.go @@ -0,0 +1,78 @@ +package service + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ServiceClient) Delete(ctx context.Context, id ServiceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "service.ServiceClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "service.ServiceClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ServiceClient) DeleteThenPoll(ctx context.Context, id ServiceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ServiceClient) preparerForDelete(ctx context.Context, id ServiceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ServiceClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/method_get_autorest.go new file mode 100644 index 000000000000..7d7f11ef63bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/method_get_autorest.go @@ -0,0 +1,68 @@ +package service + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Service +} + +// Get ... +func (c ServiceClient) Get(ctx context.Context, id ServiceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "service.ServiceClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "service.ServiceClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "service.ServiceClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ServiceClient) preparerForGet(ctx context.Context, id ServiceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ServiceClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/method_updatetags_autorest.go new file mode 100644 index 000000000000..2b62b5c90296 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/method_updatetags_autorest.go @@ -0,0 +1,69 @@ +package service + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateTagsOperationResponse struct { + HttpResponse *http.Response + Model *Service +} + +// UpdateTags ... +func (c ServiceClient) UpdateTags(ctx context.Context, id ServiceId, input TagsObject) (result UpdateTagsOperationResponse, err error) { + req, err := c.preparerForUpdateTags(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "service.ServiceClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "service.ServiceClient", "UpdateTags", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdateTags(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "service.ServiceClient", "UpdateTags", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdateTags prepares the UpdateTags request. +func (c ServiceClient) preparerForUpdateTags(ctx context.Context, id ServiceId, input TagsObject) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdateTags handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (c ServiceClient) responderForUpdateTags(resp *http.Response) (result UpdateTagsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_ambr.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_ambr.go new file mode 100644 index 000000000000..bb1e9df80767 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_ambr.go @@ -0,0 +1,9 @@ +package service + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Ambr struct { + Downlink string `json:"downlink"` + Uplink string `json:"uplink"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_pccruleconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_pccruleconfiguration.go new file mode 100644 index 000000000000..f15a71d7979e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_pccruleconfiguration.go @@ -0,0 +1,12 @@ +package service + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PccRuleConfiguration struct { + RuleName string `json:"ruleName"` + RulePrecedence int64 `json:"rulePrecedence"` + RuleQosPolicy *PccRuleQosPolicy `json:"ruleQosPolicy,omitempty"` + ServiceDataFlowTemplates []ServiceDataFlowTemplate `json:"serviceDataFlowTemplates"` + TrafficControl *TrafficControlPermission `json:"trafficControl,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_pccruleqospolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_pccruleqospolicy.go new file mode 100644 index 000000000000..e059d65446ef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_pccruleqospolicy.go @@ -0,0 +1,13 @@ +package service + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PccRuleQosPolicy struct { + AllocationAndRetentionPriorityLevel *int64 `json:"allocationAndRetentionPriorityLevel,omitempty"` + Fiveqi *int64 `json:"5qi,omitempty"` + GuaranteedBitRate *Ambr `json:"guaranteedBitRate,omitempty"` + MaximumBitRate Ambr `json:"maximumBitRate"` + PreemptionCapability *PreemptionCapability `json:"preemptionCapability,omitempty"` + PreemptionVulnerability *PreemptionVulnerability `json:"preemptionVulnerability,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_qospolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_qospolicy.go new file mode 100644 index 000000000000..7dd7b8335096 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_qospolicy.go @@ -0,0 +1,12 @@ +package service + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QosPolicy struct { + AllocationAndRetentionPriorityLevel *int64 `json:"allocationAndRetentionPriorityLevel,omitempty"` + Fiveqi *int64 `json:"5qi,omitempty"` + MaximumBitRate Ambr `json:"maximumBitRate"` + PreemptionCapability *PreemptionCapability `json:"preemptionCapability,omitempty"` + PreemptionVulnerability *PreemptionVulnerability `json:"preemptionVulnerability,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_service.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_service.go new file mode 100644 index 000000000000..dca0696c0027 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_service.go @@ -0,0 +1,18 @@ +package service + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Service struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties ServicePropertiesFormat `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_servicedataflowtemplate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_servicedataflowtemplate.go new file mode 100644 index 000000000000..be719de33023 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_servicedataflowtemplate.go @@ -0,0 +1,12 @@ +package service + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceDataFlowTemplate struct { + Direction SdfDirection `json:"direction"` + Ports *[]string `json:"ports,omitempty"` + Protocol []string `json:"protocol"` + RemoteIPList []string `json:"remoteIpList"` + TemplateName string `json:"templateName"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_servicepropertiesformat.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_servicepropertiesformat.go new file mode 100644 index 000000000000..aa890a8678d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_servicepropertiesformat.go @@ -0,0 +1,11 @@ +package service + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicePropertiesFormat struct { + PccRules []PccRuleConfiguration `json:"pccRules"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + ServicePrecedence int64 `json:"servicePrecedence"` + ServiceQosPolicy *QosPolicy `json:"serviceQosPolicy,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_tagsobject.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_tagsobject.go new file mode 100644 index 000000000000..b88d791c2678 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/model_tagsobject.go @@ -0,0 +1,8 @@ +package service + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagsObject struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/version.go new file mode 100644 index 000000000000..eab1ed2588f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service/version.go @@ -0,0 +1,12 @@ +package service + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/service/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/README.md new file mode 100644 index 000000000000..b471b0e9a6cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/README.md @@ -0,0 +1,86 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup` Documentation + +The `simgroup` SDK allows for interaction with the Azure Resource Manager Service `mobilenetwork` (API Version `2022-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup" +``` + + +### Client Initialization + +```go +client := simgroup.NewSIMGroupClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SIMGroupClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := simgroup.NewSimGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "simGroupValue") + +payload := simgroup.SimGroup{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SIMGroupClient.Delete` + +```go +ctx := context.TODO() +id := simgroup.NewSimGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "simGroupValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SIMGroupClient.Get` + +```go +ctx := context.TODO() +id := simgroup.NewSimGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "simGroupValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SIMGroupClient.UpdateTags` + +```go +ctx := context.TODO() +id := simgroup.NewSimGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "simGroupValue") + +payload := simgroup.TagsObject{ + // ... +} + + +read, err := client.UpdateTags(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/client.go new file mode 100644 index 000000000000..071e00794ac4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/client.go @@ -0,0 +1,18 @@ +package simgroup + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SIMGroupClient struct { + Client autorest.Client + baseUri string +} + +func NewSIMGroupClientWithBaseURI(endpoint string) SIMGroupClient { + return SIMGroupClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/constants.go new file mode 100644 index 000000000000..09914104b299 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/constants.go @@ -0,0 +1,49 @@ +package simgroup + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUnknown), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "unknown": ProvisioningStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/id_simgroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/id_simgroup.go new file mode 100644 index 000000000000..a860acc42044 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/id_simgroup.go @@ -0,0 +1,124 @@ +package simgroup + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SimGroupId{} + +// SimGroupId is a struct representing the Resource ID for a Sim Group +type SimGroupId struct { + SubscriptionId string + ResourceGroupName string + SimGroupName string +} + +// NewSimGroupID returns a new SimGroupId struct +func NewSimGroupID(subscriptionId string, resourceGroupName string, simGroupName string) SimGroupId { + return SimGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SimGroupName: simGroupName, + } +} + +// ParseSimGroupID parses 'input' into a SimGroupId +func ParseSimGroupID(input string) (*SimGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(SimGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SimGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'simGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSimGroupIDInsensitively parses 'input' case-insensitively into a SimGroupId +// note: this method should only be used for API response data and not user input +func ParseSimGroupIDInsensitively(input string) (*SimGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(SimGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SimGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'simGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSimGroupID checks that 'input' can be parsed as a Sim Group ID +func ValidateSimGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSimGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sim Group ID +func (id SimGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.MobileNetwork/simGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SimGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sim Group ID +func (id SimGroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMobileNetwork", "Microsoft.MobileNetwork", "Microsoft.MobileNetwork"), + resourceids.StaticSegment("staticSimGroups", "simGroups", "simGroups"), + resourceids.UserSpecifiedSegment("simGroupName", "simGroupValue"), + } +} + +// String returns a human-readable description of this Sim Group ID +func (id SimGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Sim Group Name: %q", id.SimGroupName), + } + return fmt.Sprintf("Sim Group (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/method_createorupdate_autorest.go new file mode 100644 index 000000000000..7960784baa25 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package simgroup + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c SIMGroupClient) CreateOrUpdate(ctx context.Context, id SimGroupId, input SimGroup) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "simgroup.SIMGroupClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "simgroup.SIMGroupClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c SIMGroupClient) CreateOrUpdateThenPoll(ctx context.Context, id SimGroupId, input SimGroup) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c SIMGroupClient) preparerForCreateOrUpdate(ctx context.Context, id SimGroupId, input SimGroup) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c SIMGroupClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/method_delete_autorest.go new file mode 100644 index 000000000000..624e17e6a8f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/method_delete_autorest.go @@ -0,0 +1,78 @@ +package simgroup + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c SIMGroupClient) Delete(ctx context.Context, id SimGroupId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "simgroup.SIMGroupClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "simgroup.SIMGroupClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c SIMGroupClient) DeleteThenPoll(ctx context.Context, id SimGroupId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c SIMGroupClient) preparerForDelete(ctx context.Context, id SimGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c SIMGroupClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/method_get_autorest.go new file mode 100644 index 000000000000..b8ce092bd268 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/method_get_autorest.go @@ -0,0 +1,68 @@ +package simgroup + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *SimGroup +} + +// Get ... +func (c SIMGroupClient) Get(ctx context.Context, id SimGroupId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "simgroup.SIMGroupClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "simgroup.SIMGroupClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "simgroup.SIMGroupClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c SIMGroupClient) preparerForGet(ctx context.Context, id SimGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c SIMGroupClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/method_updatetags_autorest.go new file mode 100644 index 000000000000..6e614f2ff851 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/method_updatetags_autorest.go @@ -0,0 +1,69 @@ +package simgroup + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateTagsOperationResponse struct { + HttpResponse *http.Response + Model *SimGroup +} + +// UpdateTags ... +func (c SIMGroupClient) UpdateTags(ctx context.Context, id SimGroupId, input TagsObject) (result UpdateTagsOperationResponse, err error) { + req, err := c.preparerForUpdateTags(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "simgroup.SIMGroupClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "simgroup.SIMGroupClient", "UpdateTags", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdateTags(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "simgroup.SIMGroupClient", "UpdateTags", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdateTags prepares the UpdateTags request. +func (c SIMGroupClient) preparerForUpdateTags(ctx context.Context, id SimGroupId, input TagsObject) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdateTags handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (c SIMGroupClient) responderForUpdateTags(resp *http.Response) (result UpdateTagsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/model_keyvaultkey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/model_keyvaultkey.go new file mode 100644 index 000000000000..679efab87d35 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/model_keyvaultkey.go @@ -0,0 +1,8 @@ +package simgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultKey struct { + KeyUrl *string `json:"keyUrl,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/model_mobilenetworkresourceid.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/model_mobilenetworkresourceid.go new file mode 100644 index 000000000000..cc19f088ff2a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/model_mobilenetworkresourceid.go @@ -0,0 +1,8 @@ +package simgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MobileNetworkResourceId struct { + Id string `json:"id"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/model_simgroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/model_simgroup.go new file mode 100644 index 000000000000..8c28a8bf398a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/model_simgroup.go @@ -0,0 +1,20 @@ +package simgroup + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SimGroup struct { + Id *string `json:"id,omitempty"` + Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties SimGroupPropertiesFormat `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/model_simgrouppropertiesformat.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/model_simgrouppropertiesformat.go new file mode 100644 index 000000000000..387aab0db0f3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/model_simgrouppropertiesformat.go @@ -0,0 +1,10 @@ +package simgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SimGroupPropertiesFormat struct { + EncryptionKey *KeyVaultKey `json:"encryptionKey,omitempty"` + MobileNetwork *MobileNetworkResourceId `json:"mobileNetwork,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/model_tagsobject.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/model_tagsobject.go new file mode 100644 index 000000000000..5db10bc8548e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/model_tagsobject.go @@ -0,0 +1,8 @@ +package simgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagsObject struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/version.go new file mode 100644 index 000000000000..7ea12388d3ad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup/version.go @@ -0,0 +1,12 @@ +package simgroup + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/simgroup/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/README.md new file mode 100644 index 000000000000..de495b510375 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/README.md @@ -0,0 +1,86 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site` Documentation + +The `site` SDK allows for interaction with the Azure Resource Manager Service `mobilenetwork` (API Version `2022-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site" +``` + + +### Client Initialization + +```go +client := site.NewSiteClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SiteClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := site.NewSiteID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue", "siteValue") + +payload := site.Site{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SiteClient.Delete` + +```go +ctx := context.TODO() +id := site.NewSiteID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue", "siteValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SiteClient.Get` + +```go +ctx := context.TODO() +id := site.NewSiteID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue", "siteValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SiteClient.UpdateTags` + +```go +ctx := context.TODO() +id := site.NewSiteID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue", "siteValue") + +payload := site.TagsObject{ + // ... +} + + +read, err := client.UpdateTags(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/client.go new file mode 100644 index 000000000000..0e5e97451cbc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/client.go @@ -0,0 +1,18 @@ +package site + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SiteClient struct { + Client autorest.Client + baseUri string +} + +func NewSiteClientWithBaseURI(endpoint string) SiteClient { + return SiteClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/constants.go new file mode 100644 index 000000000000..887b22af39bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/constants.go @@ -0,0 +1,49 @@ +package site + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUnknown), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "unknown": ProvisioningStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/id_site.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/id_site.go new file mode 100644 index 000000000000..5ac008468217 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/id_site.go @@ -0,0 +1,137 @@ +package site + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SiteId{} + +// SiteId is a struct representing the Resource ID for a Site +type SiteId struct { + SubscriptionId string + ResourceGroupName string + MobileNetworkName string + SiteName string +} + +// NewSiteID returns a new SiteId struct +func NewSiteID(subscriptionId string, resourceGroupName string, mobileNetworkName string, siteName string) SiteId { + return SiteId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MobileNetworkName: mobileNetworkName, + SiteName: siteName, + } +} + +// ParseSiteID parses 'input' into a SiteId +func ParseSiteID(input string) (*SiteId, error) { + parser := resourceids.NewParserFromResourceIdType(SiteId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SiteId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'mobileNetworkName' was not found in the resource id %q", input) + } + + if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { + return nil, fmt.Errorf("the segment 'siteName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSiteIDInsensitively parses 'input' case-insensitively into a SiteId +// note: this method should only be used for API response data and not user input +func ParseSiteIDInsensitively(input string) (*SiteId, error) { + parser := resourceids.NewParserFromResourceIdType(SiteId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SiteId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'mobileNetworkName' was not found in the resource id %q", input) + } + + if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { + return nil, fmt.Errorf("the segment 'siteName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSiteID checks that 'input' can be parsed as a Site ID +func ValidateSiteID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSiteID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Site ID +func (id SiteId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.MobileNetwork/mobileNetworks/%s/sites/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MobileNetworkName, id.SiteName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Site ID +func (id SiteId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMobileNetwork", "Microsoft.MobileNetwork", "Microsoft.MobileNetwork"), + resourceids.StaticSegment("staticMobileNetworks", "mobileNetworks", "mobileNetworks"), + resourceids.UserSpecifiedSegment("mobileNetworkName", "mobileNetworkValue"), + resourceids.StaticSegment("staticSites", "sites", "sites"), + resourceids.UserSpecifiedSegment("siteName", "siteValue"), + } +} + +// String returns a human-readable description of this Site ID +func (id SiteId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Mobile Network Name: %q", id.MobileNetworkName), + fmt.Sprintf("Site Name: %q", id.SiteName), + } + return fmt.Sprintf("Site (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/method_createorupdate_autorest.go new file mode 100644 index 000000000000..6152c3d9655b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package site + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c SiteClient) CreateOrUpdate(ctx context.Context, id SiteId, input Site) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "site.SiteClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "site.SiteClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c SiteClient) CreateOrUpdateThenPoll(ctx context.Context, id SiteId, input Site) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c SiteClient) preparerForCreateOrUpdate(ctx context.Context, id SiteId, input Site) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c SiteClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/method_delete_autorest.go new file mode 100644 index 000000000000..da8e877345e5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/method_delete_autorest.go @@ -0,0 +1,78 @@ +package site + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c SiteClient) Delete(ctx context.Context, id SiteId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "site.SiteClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "site.SiteClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c SiteClient) DeleteThenPoll(ctx context.Context, id SiteId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c SiteClient) preparerForDelete(ctx context.Context, id SiteId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c SiteClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/method_get_autorest.go new file mode 100644 index 000000000000..d2a2b639eede --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/method_get_autorest.go @@ -0,0 +1,68 @@ +package site + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Site +} + +// Get ... +func (c SiteClient) Get(ctx context.Context, id SiteId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "site.SiteClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "site.SiteClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "site.SiteClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c SiteClient) preparerForGet(ctx context.Context, id SiteId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c SiteClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/method_updatetags_autorest.go new file mode 100644 index 000000000000..5f240eff1b6a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/method_updatetags_autorest.go @@ -0,0 +1,69 @@ +package site + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateTagsOperationResponse struct { + HttpResponse *http.Response + Model *Site +} + +// UpdateTags ... +func (c SiteClient) UpdateTags(ctx context.Context, id SiteId, input TagsObject) (result UpdateTagsOperationResponse, err error) { + req, err := c.preparerForUpdateTags(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "site.SiteClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "site.SiteClient", "UpdateTags", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdateTags(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "site.SiteClient", "UpdateTags", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdateTags prepares the UpdateTags request. +func (c SiteClient) preparerForUpdateTags(ctx context.Context, id SiteId, input TagsObject) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdateTags handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (c SiteClient) responderForUpdateTags(resp *http.Response) (result UpdateTagsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/model_site.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/model_site.go new file mode 100644 index 000000000000..bd5f7fe6a7a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/model_site.go @@ -0,0 +1,18 @@ +package site + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Site struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *SitePropertiesFormat `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/model_sitepropertiesformat.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/model_sitepropertiesformat.go new file mode 100644 index 000000000000..8c4dd99fde45 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/model_sitepropertiesformat.go @@ -0,0 +1,9 @@ +package site + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SitePropertiesFormat struct { + NetworkFunctions *[]SubResource `json:"networkFunctions,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/model_subresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/model_subresource.go new file mode 100644 index 000000000000..1c27266a3117 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/model_subresource.go @@ -0,0 +1,8 @@ +package site + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id string `json:"id"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/model_tagsobject.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/model_tagsobject.go new file mode 100644 index 000000000000..75ebb164c0a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/model_tagsobject.go @@ -0,0 +1,8 @@ +package site + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagsObject struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/version.go new file mode 100644 index 000000000000..e0176d59f879 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site/version.go @@ -0,0 +1,12 @@ +package site + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/site/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/README.md new file mode 100644 index 000000000000..d90754b37bd1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/README.md @@ -0,0 +1,86 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice` Documentation + +The `slice` SDK allows for interaction with the Azure Resource Manager Service `mobilenetwork` (API Version `2022-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice" +``` + + +### Client Initialization + +```go +client := slice.NewSliceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SliceClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := slice.NewSliceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue", "sliceValue") + +payload := slice.Slice{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SliceClient.Delete` + +```go +ctx := context.TODO() +id := slice.NewSliceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue", "sliceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SliceClient.Get` + +```go +ctx := context.TODO() +id := slice.NewSliceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue", "sliceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SliceClient.UpdateTags` + +```go +ctx := context.TODO() +id := slice.NewSliceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue", "sliceValue") + +payload := slice.TagsObject{ + // ... +} + + +read, err := client.UpdateTags(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/client.go new file mode 100644 index 000000000000..524b7f437cec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/client.go @@ -0,0 +1,18 @@ +package slice + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SliceClient struct { + Client autorest.Client + baseUri string +} + +func NewSliceClientWithBaseURI(endpoint string) SliceClient { + return SliceClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/constants.go new file mode 100644 index 000000000000..b0340c1fc2b9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/constants.go @@ -0,0 +1,49 @@ +package slice + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUnknown), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "unknown": ProvisioningStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/id_slice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/id_slice.go new file mode 100644 index 000000000000..d22553e4bbfc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/id_slice.go @@ -0,0 +1,137 @@ +package slice + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SliceId{} + +// SliceId is a struct representing the Resource ID for a Slice +type SliceId struct { + SubscriptionId string + ResourceGroupName string + MobileNetworkName string + SliceName string +} + +// NewSliceID returns a new SliceId struct +func NewSliceID(subscriptionId string, resourceGroupName string, mobileNetworkName string, sliceName string) SliceId { + return SliceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MobileNetworkName: mobileNetworkName, + SliceName: sliceName, + } +} + +// ParseSliceID parses 'input' into a SliceId +func ParseSliceID(input string) (*SliceId, error) { + parser := resourceids.NewParserFromResourceIdType(SliceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SliceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'mobileNetworkName' was not found in the resource id %q", input) + } + + if id.SliceName, ok = parsed.Parsed["sliceName"]; !ok { + return nil, fmt.Errorf("the segment 'sliceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSliceIDInsensitively parses 'input' case-insensitively into a SliceId +// note: this method should only be used for API response data and not user input +func ParseSliceIDInsensitively(input string) (*SliceId, error) { + parser := resourceids.NewParserFromResourceIdType(SliceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SliceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'mobileNetworkName' was not found in the resource id %q", input) + } + + if id.SliceName, ok = parsed.Parsed["sliceName"]; !ok { + return nil, fmt.Errorf("the segment 'sliceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSliceID checks that 'input' can be parsed as a Slice ID +func ValidateSliceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSliceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Slice ID +func (id SliceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.MobileNetwork/mobileNetworks/%s/slices/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MobileNetworkName, id.SliceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Slice ID +func (id SliceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMobileNetwork", "Microsoft.MobileNetwork", "Microsoft.MobileNetwork"), + resourceids.StaticSegment("staticMobileNetworks", "mobileNetworks", "mobileNetworks"), + resourceids.UserSpecifiedSegment("mobileNetworkName", "mobileNetworkValue"), + resourceids.StaticSegment("staticSlices", "slices", "slices"), + resourceids.UserSpecifiedSegment("sliceName", "sliceValue"), + } +} + +// String returns a human-readable description of this Slice ID +func (id SliceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Mobile Network Name: %q", id.MobileNetworkName), + fmt.Sprintf("Slice Name: %q", id.SliceName), + } + return fmt.Sprintf("Slice (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/method_createorupdate_autorest.go new file mode 100644 index 000000000000..e9384e1b14f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package slice + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c SliceClient) CreateOrUpdate(ctx context.Context, id SliceId, input Slice) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "slice.SliceClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "slice.SliceClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c SliceClient) CreateOrUpdateThenPoll(ctx context.Context, id SliceId, input Slice) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c SliceClient) preparerForCreateOrUpdate(ctx context.Context, id SliceId, input Slice) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c SliceClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/method_delete_autorest.go new file mode 100644 index 000000000000..bf386c58b1ba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/method_delete_autorest.go @@ -0,0 +1,78 @@ +package slice + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c SliceClient) Delete(ctx context.Context, id SliceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "slice.SliceClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "slice.SliceClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c SliceClient) DeleteThenPoll(ctx context.Context, id SliceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c SliceClient) preparerForDelete(ctx context.Context, id SliceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c SliceClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/method_get_autorest.go new file mode 100644 index 000000000000..b2160e45a2f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/method_get_autorest.go @@ -0,0 +1,68 @@ +package slice + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Slice +} + +// Get ... +func (c SliceClient) Get(ctx context.Context, id SliceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "slice.SliceClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "slice.SliceClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "slice.SliceClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c SliceClient) preparerForGet(ctx context.Context, id SliceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c SliceClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/method_updatetags_autorest.go new file mode 100644 index 000000000000..cb933c9852d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/method_updatetags_autorest.go @@ -0,0 +1,69 @@ +package slice + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateTagsOperationResponse struct { + HttpResponse *http.Response + Model *Slice +} + +// UpdateTags ... +func (c SliceClient) UpdateTags(ctx context.Context, id SliceId, input TagsObject) (result UpdateTagsOperationResponse, err error) { + req, err := c.preparerForUpdateTags(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "slice.SliceClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "slice.SliceClient", "UpdateTags", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdateTags(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "slice.SliceClient", "UpdateTags", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdateTags prepares the UpdateTags request. +func (c SliceClient) preparerForUpdateTags(ctx context.Context, id SliceId, input TagsObject) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdateTags handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (c SliceClient) responderForUpdateTags(resp *http.Response) (result UpdateTagsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/model_slice.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/model_slice.go new file mode 100644 index 000000000000..2ea70e266090 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/model_slice.go @@ -0,0 +1,18 @@ +package slice + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Slice struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties SlicePropertiesFormat `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/model_slicepropertiesformat.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/model_slicepropertiesformat.go new file mode 100644 index 000000000000..9af74336fee4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/model_slicepropertiesformat.go @@ -0,0 +1,10 @@ +package slice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SlicePropertiesFormat struct { + Description *string `json:"description,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Snssai Snssai `json:"snssai"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/model_snssai.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/model_snssai.go new file mode 100644 index 000000000000..d52cf0ef4ff6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/model_snssai.go @@ -0,0 +1,9 @@ +package slice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Snssai struct { + Sd *string `json:"sd,omitempty"` + Sst int64 `json:"sst"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/model_tagsobject.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/model_tagsobject.go new file mode 100644 index 000000000000..a6e5718ffcda --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/model_tagsobject.go @@ -0,0 +1,8 @@ +package slice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagsObject struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/version.go new file mode 100644 index 000000000000..0c450fcd1efe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice/version.go @@ -0,0 +1,12 @@ +package slice + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/slice/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/serverfailover/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/serverfailover/id_flexibleserver.go index a72d27b0ae0c..543946f98b55 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/serverfailover/id_flexibleserver.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/serverfailover/id_flexibleserver.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = FlexibleServerId{} // FlexibleServerId is a struct representing the Resource ID for a Flexible Server type FlexibleServerId struct { - SubscriptionId string - ResourceGroupName string - ServerName string + SubscriptionId string + ResourceGroupName string + FlexibleServerName string } // NewFlexibleServerID returns a new FlexibleServerId struct -func NewFlexibleServerID(subscriptionId string, resourceGroupName string, serverName string) FlexibleServerId { +func NewFlexibleServerID(subscriptionId string, resourceGroupName string, flexibleServerName string) FlexibleServerId { return FlexibleServerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ServerName: serverName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FlexibleServerName: flexibleServerName, } } @@ -44,8 +44,8 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, // ID returns the formatted Flexible Server ID func (id FlexibleServerId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/flexibleServers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName) } // Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID @@ -109,7 +109,7 @@ func (id FlexibleServerId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), - resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.UserSpecifiedSegment("flexibleServerName", "flexibleServerValue"), } } @@ -118,7 +118,7 @@ func (id FlexibleServerId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Flexible Server Name: %q", id.FlexibleServerName), } return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/servers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/servers/README.md index 390a1b99e0a1..68a0a2d84096 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/servers/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/servers/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") +id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue") payload := servers.Server{ // ... @@ -41,7 +41,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") +id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") +id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue") read, err := client.Get(ctx, id) if err != nil { @@ -103,7 +103,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") +id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue") // alternatively `client.ReplicasListByServer(ctx, id)` can be used to do batched pagination items, err := client.ReplicasListByServerComplete(ctx, id) @@ -120,7 +120,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") +id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue") payload := servers.ServerForUpdate{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/servers/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/servers/id_flexibleserver.go index 05e4d6d55beb..cbadf9a58586 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/servers/id_flexibleserver.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/servers/id_flexibleserver.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = FlexibleServerId{} // FlexibleServerId is a struct representing the Resource ID for a Flexible Server type FlexibleServerId struct { - SubscriptionId string - ResourceGroupName string - ServerName string + SubscriptionId string + ResourceGroupName string + FlexibleServerName string } // NewFlexibleServerID returns a new FlexibleServerId struct -func NewFlexibleServerID(subscriptionId string, resourceGroupName string, serverName string) FlexibleServerId { +func NewFlexibleServerID(subscriptionId string, resourceGroupName string, flexibleServerName string) FlexibleServerId { return FlexibleServerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ServerName: serverName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FlexibleServerName: flexibleServerName, } } @@ -44,8 +44,8 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, // ID returns the formatted Flexible Server ID func (id FlexibleServerId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMySQL/flexibleServers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName) } // Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID @@ -109,7 +109,7 @@ func (id FlexibleServerId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDBforMySQL", "Microsoft.DBforMySQL", "Microsoft.DBforMySQL"), resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), - resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.UserSpecifiedSegment("flexibleServerName", "flexibleServerValue"), } } @@ -118,7 +118,7 @@ func (id FlexibleServerId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Flexible Server Name: %q", id.FlexibleServerName), } return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools/README.md index 3d58c52acfff..b0c976f00d9c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue") +id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") payload := capacitypools.CapacityPool{ // ... @@ -41,7 +41,7 @@ if err := client.PoolsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue") +id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") if err := client.PoolsDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.PoolsDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue") +id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") read, err := client.PoolsGet(ctx, id) if err != nil { @@ -69,7 +69,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := capacitypools.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := capacitypools.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") // alternatively `client.PoolsList(ctx, id)` can be used to do batched pagination items, err := client.PoolsListComplete(ctx, id) @@ -86,7 +86,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue") +id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") payload := capacitypools.CapacityPoolPatch{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool.go index a50e29408397..c459754495fe 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool.go @@ -13,17 +13,17 @@ var _ resourceids.ResourceId = CapacityPoolId{} type CapacityPoolId struct { SubscriptionId string ResourceGroupName string - AccountName string - PoolName string + NetAppAccountName string + CapacityPoolName string } // NewCapacityPoolID returns a new CapacityPoolId struct -func NewCapacityPoolID(subscriptionId string, resourceGroupName string, accountName string, poolName string) CapacityPoolId { +func NewCapacityPoolID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string) CapacityPoolId { return CapacityPoolId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, - PoolName: poolName, + NetAppAccountName: netAppAccountName, + CapacityPoolName: capacityPoolName, } } @@ -46,12 +46,12 @@ func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'capacityPoolName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'capacityPoolName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateCapacityPoolID(input interface{}, key string) (warnings []string, e // ID returns the formatted Capacity Pool ID func (id CapacityPoolId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName) } // Segments returns a slice of Resource ID Segments which comprise this Capacity Pool ID @@ -119,9 +119,9 @@ func (id CapacityPoolId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("poolName", "poolValue"), + resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), } } @@ -130,8 +130,8 @@ func (id CapacityPoolId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Pool Name: %q", id.PoolName), + fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), + fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), } return fmt.Sprintf("Capacity Pool (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount.go index 86bd7fcada46..76bb083ad94a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = NetAppAccountId{} type NetAppAccountId struct { SubscriptionId string ResourceGroupName string - AccountName string + NetAppAccountName string } // NewNetAppAccountID returns a new NetAppAccountId struct -func NewNetAppAccountID(subscriptionId string, resourceGroupName string, accountName string) NetAppAccountId { +func NewNetAppAccountID(subscriptionId string, resourceGroupName string, netAppAccountName string) NetAppAccountId { return NetAppAccountId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + NetAppAccountName: netAppAccountName, } } @@ -44,8 +44,8 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateNetAppAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Net App Account ID func (id NetAppAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Net App Account ID @@ -109,7 +109,7 @@ func (id NetAppAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), } } @@ -118,7 +118,7 @@ func (id NetAppAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), } return fmt.Sprintf("Net App Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/netappaccounts/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/netappaccounts/README.md index 0d3ea6ecc3e8..1849c21a15e9 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/netappaccounts/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/netappaccounts/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") payload := netappaccounts.NetAppAccount{ // ... @@ -41,7 +41,7 @@ if err := client.AccountsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") if err := client.AccountsDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.AccountsDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") read, err := client.AccountsGet(ctx, id) if err != nil { @@ -103,7 +103,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") if err := client.AccountsRenewCredentialsThenPoll(ctx, id); err != nil { // handle the error @@ -115,7 +115,7 @@ if err := client.AccountsRenewCredentialsThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") payload := netappaccounts.NetAppAccountPatch{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount.go index 68e53f4815fc..33f76d921816 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = NetAppAccountId{} type NetAppAccountId struct { SubscriptionId string ResourceGroupName string - AccountName string + NetAppAccountName string } // NewNetAppAccountID returns a new NetAppAccountId struct -func NewNetAppAccountID(subscriptionId string, resourceGroupName string, accountName string) NetAppAccountId { +func NewNetAppAccountID(subscriptionId string, resourceGroupName string, netAppAccountName string) NetAppAccountId { return NetAppAccountId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + NetAppAccountName: netAppAccountName, } } @@ -44,8 +44,8 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateNetAppAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Net App Account ID func (id NetAppAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Net App Account ID @@ -109,7 +109,7 @@ func (id NetAppAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), } } @@ -118,7 +118,7 @@ func (id NetAppAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), } return fmt.Sprintf("Net App Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicy/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicy/README.md index 3bbe03bafd43..e456e9d22d34 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicy/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicy/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "snapshotPolicyValue") +id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") payload := snapshotpolicy.SnapshotPolicy{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "snapshotPolicyValue") +id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") if err := client.SnapshotPoliciesDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -57,7 +57,7 @@ if err := client.SnapshotPoliciesDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "snapshotPolicyValue") +id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") read, err := client.SnapshotPoliciesGet(ctx, id) if err != nil { @@ -73,7 +73,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := snapshotpolicy.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := snapshotpolicy.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") read, err := client.SnapshotPoliciesList(ctx, id) if err != nil { @@ -89,7 +89,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "snapshotPolicyValue") +id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") payload := snapshotpolicy.SnapshotPolicyPatch{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount.go index 726c28f92e9c..3d002c9da16b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = NetAppAccountId{} type NetAppAccountId struct { SubscriptionId string ResourceGroupName string - AccountName string + NetAppAccountName string } // NewNetAppAccountID returns a new NetAppAccountId struct -func NewNetAppAccountID(subscriptionId string, resourceGroupName string, accountName string) NetAppAccountId { +func NewNetAppAccountID(subscriptionId string, resourceGroupName string, netAppAccountName string) NetAppAccountId { return NetAppAccountId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + NetAppAccountName: netAppAccountName, } } @@ -44,8 +44,8 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateNetAppAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Net App Account ID func (id NetAppAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Net App Account ID @@ -109,7 +109,7 @@ func (id NetAppAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), } } @@ -118,7 +118,7 @@ func (id NetAppAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), } return fmt.Sprintf("Net App Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy.go index 1daf40072215..b4a1ed3bf984 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = SnapshotPolicyId{} type SnapshotPolicyId struct { SubscriptionId string ResourceGroupName string - AccountName string + NetAppAccountName string SnapshotPolicyName string } // NewSnapshotPolicyID returns a new SnapshotPolicyId struct -func NewSnapshotPolicyID(subscriptionId string, resourceGroupName string, accountName string, snapshotPolicyName string) SnapshotPolicyId { +func NewSnapshotPolicyID(subscriptionId string, resourceGroupName string, netAppAccountName string, snapshotPolicyName string) SnapshotPolicyId { return SnapshotPolicyId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + NetAppAccountName: netAppAccountName, SnapshotPolicyName: snapshotPolicyName, } } @@ -46,8 +46,8 @@ func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { @@ -77,8 +77,8 @@ func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { @@ -106,7 +106,7 @@ func ValidateSnapshotPolicyID(input interface{}, key string) (warnings []string, // ID returns the formatted Snapshot Policy ID func (id SnapshotPolicyId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/snapshotPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.SnapshotPolicyName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.SnapshotPolicyName) } // Segments returns a slice of Resource ID Segments which comprise this Snapshot Policy ID @@ -119,7 +119,7 @@ func (id SnapshotPolicyId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), resourceids.StaticSegment("staticSnapshotPolicies", "snapshotPolicies", "snapshotPolicies"), resourceids.UserSpecifiedSegment("snapshotPolicyName", "snapshotPolicyValue"), } @@ -130,7 +130,7 @@ func (id SnapshotPolicyId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), fmt.Sprintf("Snapshot Policy Name: %q", id.SnapshotPolicyName), } return fmt.Sprintf("Snapshot Policy (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshots/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshots/README.md index 4a2a3aa6c0d4..5104c1a1052b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshots/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshots/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue", "snapshotValue") +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") payload := snapshots.Snapshot{ // ... @@ -41,7 +41,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue", "snapshotValue") +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue", "snapshotValue") +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") read, err := client.Get(ctx, id) if err != nil { @@ -69,7 +69,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := snapshots.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") +id := snapshots.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") read, err := client.List(ctx, id) if err != nil { @@ -85,7 +85,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue", "snapshotValue") +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") payload := snapshots.SnapshotRestoreFiles{ // ... @@ -102,7 +102,7 @@ if err := client.RestoreFilesThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue", "snapshotValue") +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") var payload interface{} if err := client.UpdateThenPoll(ctx, id, payload); err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshots/id_snapshot.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshots/id_snapshot.go index d38fb8cb8f01..e1e1fa088b6e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshots/id_snapshot.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshots/id_snapshot.go @@ -13,19 +13,19 @@ var _ resourceids.ResourceId = SnapshotId{} type SnapshotId struct { SubscriptionId string ResourceGroupName string - AccountName string - PoolName string + NetAppAccountName string + CapacityPoolName string VolumeName string SnapshotName string } // NewSnapshotID returns a new SnapshotId struct -func NewSnapshotID(subscriptionId string, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) SnapshotId { +func NewSnapshotID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, snapshotName string) SnapshotId { return SnapshotId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, - PoolName: poolName, + NetAppAccountName: netAppAccountName, + CapacityPoolName: capacityPoolName, VolumeName: volumeName, SnapshotName: snapshotName, } @@ -50,12 +50,12 @@ func ParseSnapshotID(input string) (*SnapshotId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'capacityPoolName' was not found in the resource id %q", input) } if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { @@ -89,12 +89,12 @@ func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'capacityPoolName' was not found in the resource id %q", input) } if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { @@ -126,7 +126,7 @@ func ValidateSnapshotID(input interface{}, key string) (warnings []string, error // ID returns the formatted Snapshot ID func (id SnapshotId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/snapshots/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName, id.VolumeName, id.SnapshotName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.SnapshotName) } // Segments returns a slice of Resource ID Segments which comprise this Snapshot ID @@ -139,9 +139,9 @@ func (id SnapshotId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("poolName", "poolValue"), + resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), resourceids.StaticSegment("staticSnapshots", "snapshots", "snapshots"), @@ -154,8 +154,8 @@ func (id SnapshotId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Pool Name: %q", id.PoolName), + fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), + fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), fmt.Sprintf("Volume Name: %q", id.VolumeName), fmt.Sprintf("Snapshot Name: %q", id.SnapshotName), } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshots/id_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshots/id_volume.go index c5cc73e141c7..2c57eda187af 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshots/id_volume.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshots/id_volume.go @@ -13,18 +13,18 @@ var _ resourceids.ResourceId = VolumeId{} type VolumeId struct { SubscriptionId string ResourceGroupName string - AccountName string - PoolName string + NetAppAccountName string + CapacityPoolName string VolumeName string } // NewVolumeID returns a new VolumeId struct -func NewVolumeID(subscriptionId string, resourceGroupName string, accountName string, poolName string, volumeName string) VolumeId { +func NewVolumeID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string) VolumeId { return VolumeId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, - PoolName: poolName, + NetAppAccountName: netAppAccountName, + CapacityPoolName: capacityPoolName, VolumeName: volumeName, } } @@ -48,12 +48,12 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'capacityPoolName' was not found in the resource id %q", input) } if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { @@ -83,12 +83,12 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'capacityPoolName' was not found in the resource id %q", input) } if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { @@ -116,7 +116,7 @@ func ValidateVolumeID(input interface{}, key string) (warnings []string, errors // ID returns the formatted Volume ID func (id VolumeId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName, id.VolumeName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName) } // Segments returns a slice of Resource ID Segments which comprise this Volume ID @@ -129,9 +129,9 @@ func (id VolumeId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("poolName", "poolValue"), + resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), } @@ -142,8 +142,8 @@ func (id VolumeId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Pool Name: %q", id.PoolName), + fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), + fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), fmt.Sprintf("Volume Name: %q", id.VolumeName), } return fmt.Sprintf("Volume (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumes/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumes/README.md index 95b153f55908..b28423a56113 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumes/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumes/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") +id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") payload := volumes.Volume{ // ... @@ -41,7 +41,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") +id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") if err := client.DeleteThenPoll(ctx, id, volumes.DefaultDeleteOperationOptions()); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id, volumes.DefaultDeleteOperationOptions() ```go ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") +id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") read, err := client.Get(ctx, id) if err != nil { @@ -69,7 +69,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := volumes.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue") +id := volumes.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) @@ -86,7 +86,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") +id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") payload := volumes.VolumePatch{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumes/id_capacitypool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumes/id_capacitypool.go index 06f8b4531bd9..3135c92165cf 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumes/id_capacitypool.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumes/id_capacitypool.go @@ -13,17 +13,17 @@ var _ resourceids.ResourceId = CapacityPoolId{} type CapacityPoolId struct { SubscriptionId string ResourceGroupName string - AccountName string - PoolName string + NetAppAccountName string + CapacityPoolName string } // NewCapacityPoolID returns a new CapacityPoolId struct -func NewCapacityPoolID(subscriptionId string, resourceGroupName string, accountName string, poolName string) CapacityPoolId { +func NewCapacityPoolID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string) CapacityPoolId { return CapacityPoolId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, - PoolName: poolName, + NetAppAccountName: netAppAccountName, + CapacityPoolName: capacityPoolName, } } @@ -46,12 +46,12 @@ func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'capacityPoolName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'capacityPoolName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateCapacityPoolID(input interface{}, key string) (warnings []string, e // ID returns the formatted Capacity Pool ID func (id CapacityPoolId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName) } // Segments returns a slice of Resource ID Segments which comprise this Capacity Pool ID @@ -119,9 +119,9 @@ func (id CapacityPoolId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("poolName", "poolValue"), + resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), } } @@ -130,8 +130,8 @@ func (id CapacityPoolId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Pool Name: %q", id.PoolName), + fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), + fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), } return fmt.Sprintf("Capacity Pool (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumes/id_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumes/id_volume.go index d4e93b387a44..d56d4639fd58 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumes/id_volume.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumes/id_volume.go @@ -13,18 +13,18 @@ var _ resourceids.ResourceId = VolumeId{} type VolumeId struct { SubscriptionId string ResourceGroupName string - AccountName string - PoolName string + NetAppAccountName string + CapacityPoolName string VolumeName string } // NewVolumeID returns a new VolumeId struct -func NewVolumeID(subscriptionId string, resourceGroupName string, accountName string, poolName string, volumeName string) VolumeId { +func NewVolumeID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string) VolumeId { return VolumeId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, - PoolName: poolName, + NetAppAccountName: netAppAccountName, + CapacityPoolName: capacityPoolName, VolumeName: volumeName, } } @@ -48,12 +48,12 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'capacityPoolName' was not found in the resource id %q", input) } if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { @@ -83,12 +83,12 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'capacityPoolName' was not found in the resource id %q", input) } if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { @@ -116,7 +116,7 @@ func ValidateVolumeID(input interface{}, key string) (warnings []string, errors // ID returns the formatted Volume ID func (id VolumeId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName, id.VolumeName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName) } // Segments returns a slice of Resource ID Segments which comprise this Volume ID @@ -129,9 +129,9 @@ func (id VolumeId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("poolName", "poolValue"), + resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), } @@ -142,8 +142,8 @@ func (id VolumeId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Pool Name: %q", id.PoolName), + fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), + fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), fmt.Sprintf("Volume Name: %q", id.VolumeName), } return fmt.Sprintf("Volume (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesreplication/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesreplication/README.md index 91e1f1bd4fb7..204a786e6ddd 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesreplication/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesreplication/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") payload := volumesreplication.AuthorizeRequest{ // ... @@ -41,7 +41,7 @@ if err := client.VolumesAuthorizeReplicationThenPoll(ctx, id, payload); err != n ```go ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") payload := volumesreplication.BreakReplicationRequest{ // ... @@ -58,7 +58,7 @@ if err := client.VolumesBreakReplicationThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") if err := client.VolumesDeleteReplicationThenPoll(ctx, id); err != nil { // handle the error @@ -70,7 +70,7 @@ if err := client.VolumesDeleteReplicationThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") read, err := client.VolumesListReplications(ctx, id) if err != nil { @@ -86,7 +86,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") if err := client.VolumesReInitializeReplicationThenPoll(ctx, id); err != nil { // handle the error @@ -98,7 +98,7 @@ if err := client.VolumesReInitializeReplicationThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") payload := volumesreplication.ReestablishReplicationRequest{ // ... @@ -115,7 +115,7 @@ if err := client.VolumesReestablishReplicationThenPoll(ctx, id, payload); err != ```go ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") read, err := client.VolumesReplicationStatus(ctx, id) if err != nil { @@ -131,7 +131,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") if err := client.VolumesResyncReplicationThenPoll(ctx, id); err != nil { // handle the error diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesreplication/id_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesreplication/id_volume.go index c88adaf98587..2848e3eac4d5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesreplication/id_volume.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesreplication/id_volume.go @@ -13,18 +13,18 @@ var _ resourceids.ResourceId = VolumeId{} type VolumeId struct { SubscriptionId string ResourceGroupName string - AccountName string - PoolName string + NetAppAccountName string + CapacityPoolName string VolumeName string } // NewVolumeID returns a new VolumeId struct -func NewVolumeID(subscriptionId string, resourceGroupName string, accountName string, poolName string, volumeName string) VolumeId { +func NewVolumeID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string) VolumeId { return VolumeId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, - PoolName: poolName, + NetAppAccountName: netAppAccountName, + CapacityPoolName: capacityPoolName, VolumeName: volumeName, } } @@ -48,12 +48,12 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'capacityPoolName' was not found in the resource id %q", input) } if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { @@ -83,12 +83,12 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'netAppAccountName' was not found in the resource id %q", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'capacityPoolName' was not found in the resource id %q", input) } if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { @@ -116,7 +116,7 @@ func ValidateVolumeID(input interface{}, key string) (warnings []string, errors // ID returns the formatted Volume ID func (id VolumeId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName, id.VolumeName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName) } // Segments returns a slice of Resource ID Segments which comprise this Volume ID @@ -129,9 +129,9 @@ func (id VolumeId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("poolName", "poolValue"), + resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), } @@ -142,8 +142,8 @@ func (id VolumeId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Pool Name: %q", id.PoolName), + fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), + fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), fmt.Sprintf("Volume Name: %q", id.VolumeName), } return fmt.Sprintf("Volume (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxcertificate/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxcertificate/README.md index 858d4d64b0f3..3a839aa55d24 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxcertificate/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxcertificate/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := nginxcertificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentValue", "certificateValue") +id := nginxcertificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentValue", "certificateValue") payload := nginxcertificate.NginxCertificate{ // ... @@ -41,7 +41,7 @@ if err := client.CertificatesCreateOrUpdateThenPoll(ctx, id, payload); err != ni ```go ctx := context.TODO() -id := nginxcertificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentValue", "certificateValue") +id := nginxcertificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentValue", "certificateValue") if err := client.CertificatesDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.CertificatesDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := nginxcertificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentValue", "certificateValue") +id := nginxcertificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentValue", "certificateValue") read, err := client.CertificatesGet(ctx, id) if err != nil { @@ -69,7 +69,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := nginxcertificate.NewNginxDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentValue") +id := nginxcertificate.NewNginxDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentValue") // alternatively `client.CertificatesList(ctx, id)` can be used to do batched pagination items, err := client.CertificatesListComplete(ctx, id) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxcertificate/id_certificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxcertificate/id_certificate.go index dcc77060a76a..8dcc9d7a7d9f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxcertificate/id_certificate.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxcertificate/id_certificate.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = CertificateId{} // CertificateId is a struct representing the Resource ID for a Certificate type CertificateId struct { - SubscriptionId string - ResourceGroupName string - DeploymentName string - CertificateName string + SubscriptionId string + ResourceGroupName string + NginxDeploymentName string + CertificateName string } // NewCertificateID returns a new CertificateId struct -func NewCertificateID(subscriptionId string, resourceGroupName string, deploymentName string, certificateName string) CertificateId { +func NewCertificateID(subscriptionId string, resourceGroupName string, nginxDeploymentName string, certificateName string) CertificateId { return CertificateId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - DeploymentName: deploymentName, - CertificateName: certificateName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NginxDeploymentName: nginxDeploymentName, + CertificateName: certificateName, } } @@ -46,8 +46,8 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, fmt.Errorf("the segment 'deploymentName' was not found in the resource id %q", input) + if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { + return nil, fmt.Errorf("the segment 'nginxDeploymentName' was not found in the resource id %q", input) } if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { @@ -77,8 +77,8 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, fmt.Errorf("the segment 'deploymentName' was not found in the resource id %q", input) + if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { + return nil, fmt.Errorf("the segment 'nginxDeploymentName' was not found in the resource id %q", input) } if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { @@ -106,7 +106,7 @@ func ValidateCertificateID(input interface{}, key string) (warnings []string, er // ID returns the formatted Certificate ID func (id CertificateId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Nginx.NginxPlus/nginxDeployments/%s/certificates/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DeploymentName, id.CertificateName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NginxDeploymentName, id.CertificateName) } // Segments returns a slice of Resource ID Segments which comprise this Certificate ID @@ -119,7 +119,7 @@ func (id CertificateId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticNginxNginxPlus", "Nginx.NginxPlus", "Nginx.NginxPlus"), resourceids.StaticSegment("staticNginxDeployments", "nginxDeployments", "nginxDeployments"), - resourceids.UserSpecifiedSegment("deploymentName", "deploymentValue"), + resourceids.UserSpecifiedSegment("nginxDeploymentName", "nginxDeploymentValue"), resourceids.StaticSegment("staticCertificates", "certificates", "certificates"), resourceids.UserSpecifiedSegment("certificateName", "certificateValue"), } @@ -130,7 +130,7 @@ func (id CertificateId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Deployment Name: %q", id.DeploymentName), + fmt.Sprintf("Nginx Deployment Name: %q", id.NginxDeploymentName), fmt.Sprintf("Certificate Name: %q", id.CertificateName), } return fmt.Sprintf("Certificate (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxcertificate/id_nginxdeployment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxcertificate/id_nginxdeployment.go index 2d7dc633daf5..7a65b5e358ca 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxcertificate/id_nginxdeployment.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxcertificate/id_nginxdeployment.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = NginxDeploymentId{} // NginxDeploymentId is a struct representing the Resource ID for a Nginx Deployment type NginxDeploymentId struct { - SubscriptionId string - ResourceGroupName string - DeploymentName string + SubscriptionId string + ResourceGroupName string + NginxDeploymentName string } // NewNginxDeploymentID returns a new NginxDeploymentId struct -func NewNginxDeploymentID(subscriptionId string, resourceGroupName string, deploymentName string) NginxDeploymentId { +func NewNginxDeploymentID(subscriptionId string, resourceGroupName string, nginxDeploymentName string) NginxDeploymentId { return NginxDeploymentId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - DeploymentName: deploymentName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NginxDeploymentName: nginxDeploymentName, } } @@ -44,8 +44,8 @@ func ParseNginxDeploymentID(input string) (*NginxDeploymentId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, fmt.Errorf("the segment 'deploymentName' was not found in the resource id %q", input) + if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { + return nil, fmt.Errorf("the segment 'nginxDeploymentName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseNginxDeploymentIDInsensitively(input string) (*NginxDeploymentId, erro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, fmt.Errorf("the segment 'deploymentName' was not found in the resource id %q", input) + if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { + return nil, fmt.Errorf("the segment 'nginxDeploymentName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateNginxDeploymentID(input interface{}, key string) (warnings []string // ID returns the formatted Nginx Deployment ID func (id NginxDeploymentId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Nginx.NginxPlus/nginxDeployments/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DeploymentName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NginxDeploymentName) } // Segments returns a slice of Resource ID Segments which comprise this Nginx Deployment ID @@ -109,7 +109,7 @@ func (id NginxDeploymentId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticNginxNginxPlus", "Nginx.NginxPlus", "Nginx.NginxPlus"), resourceids.StaticSegment("staticNginxDeployments", "nginxDeployments", "nginxDeployments"), - resourceids.UserSpecifiedSegment("deploymentName", "deploymentValue"), + resourceids.UserSpecifiedSegment("nginxDeploymentName", "nginxDeploymentValue"), } } @@ -118,7 +118,7 @@ func (id NginxDeploymentId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Deployment Name: %q", id.DeploymentName), + fmt.Sprintf("Nginx Deployment Name: %q", id.NginxDeploymentName), } return fmt.Sprintf("Nginx Deployment (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxconfiguration/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxconfiguration/README.md index 838686101f9f..490617aca813 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxconfiguration/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxconfiguration/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := nginxconfiguration.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentValue", "configurationValue") +id := nginxconfiguration.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentValue", "configurationValue") payload := nginxconfiguration.NginxConfiguration{ // ... @@ -41,7 +41,7 @@ if err := client.ConfigurationsCreateOrUpdateThenPoll(ctx, id, payload); err != ```go ctx := context.TODO() -id := nginxconfiguration.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentValue", "configurationValue") +id := nginxconfiguration.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentValue", "configurationValue") if err := client.ConfigurationsDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.ConfigurationsDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := nginxconfiguration.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentValue", "configurationValue") +id := nginxconfiguration.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentValue", "configurationValue") read, err := client.ConfigurationsGet(ctx, id) if err != nil { @@ -69,7 +69,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := nginxconfiguration.NewNginxDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentValue") +id := nginxconfiguration.NewNginxDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentValue") // alternatively `client.ConfigurationsList(ctx, id)` can be used to do batched pagination items, err := client.ConfigurationsListComplete(ctx, id) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxconfiguration/id_configuration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxconfiguration/id_configuration.go index 6f3dd82b8b25..e087d8a2490f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxconfiguration/id_configuration.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxconfiguration/id_configuration.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = ConfigurationId{} // ConfigurationId is a struct representing the Resource ID for a Configuration type ConfigurationId struct { - SubscriptionId string - ResourceGroupName string - DeploymentName string - ConfigurationName string + SubscriptionId string + ResourceGroupName string + NginxDeploymentName string + ConfigurationName string } // NewConfigurationID returns a new ConfigurationId struct -func NewConfigurationID(subscriptionId string, resourceGroupName string, deploymentName string, configurationName string) ConfigurationId { +func NewConfigurationID(subscriptionId string, resourceGroupName string, nginxDeploymentName string, configurationName string) ConfigurationId { return ConfigurationId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - DeploymentName: deploymentName, - ConfigurationName: configurationName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NginxDeploymentName: nginxDeploymentName, + ConfigurationName: configurationName, } } @@ -46,8 +46,8 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, fmt.Errorf("the segment 'deploymentName' was not found in the resource id %q", input) + if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { + return nil, fmt.Errorf("the segment 'nginxDeploymentName' was not found in the resource id %q", input) } if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { @@ -77,8 +77,8 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, fmt.Errorf("the segment 'deploymentName' was not found in the resource id %q", input) + if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { + return nil, fmt.Errorf("the segment 'nginxDeploymentName' was not found in the resource id %q", input) } if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { @@ -106,7 +106,7 @@ func ValidateConfigurationID(input interface{}, key string) (warnings []string, // ID returns the formatted Configuration ID func (id ConfigurationId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Nginx.NginxPlus/nginxDeployments/%s/configurations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DeploymentName, id.ConfigurationName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NginxDeploymentName, id.ConfigurationName) } // Segments returns a slice of Resource ID Segments which comprise this Configuration ID @@ -119,7 +119,7 @@ func (id ConfigurationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticNginxNginxPlus", "Nginx.NginxPlus", "Nginx.NginxPlus"), resourceids.StaticSegment("staticNginxDeployments", "nginxDeployments", "nginxDeployments"), - resourceids.UserSpecifiedSegment("deploymentName", "deploymentValue"), + resourceids.UserSpecifiedSegment("nginxDeploymentName", "nginxDeploymentValue"), resourceids.StaticSegment("staticConfigurations", "configurations", "configurations"), resourceids.UserSpecifiedSegment("configurationName", "configurationValue"), } @@ -130,7 +130,7 @@ func (id ConfigurationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Deployment Name: %q", id.DeploymentName), + fmt.Sprintf("Nginx Deployment Name: %q", id.NginxDeploymentName), fmt.Sprintf("Configuration Name: %q", id.ConfigurationName), } return fmt.Sprintf("Configuration (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxconfiguration/id_nginxdeployment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxconfiguration/id_nginxdeployment.go index 812991b0450c..54761a18b425 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxconfiguration/id_nginxdeployment.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxconfiguration/id_nginxdeployment.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = NginxDeploymentId{} // NginxDeploymentId is a struct representing the Resource ID for a Nginx Deployment type NginxDeploymentId struct { - SubscriptionId string - ResourceGroupName string - DeploymentName string + SubscriptionId string + ResourceGroupName string + NginxDeploymentName string } // NewNginxDeploymentID returns a new NginxDeploymentId struct -func NewNginxDeploymentID(subscriptionId string, resourceGroupName string, deploymentName string) NginxDeploymentId { +func NewNginxDeploymentID(subscriptionId string, resourceGroupName string, nginxDeploymentName string) NginxDeploymentId { return NginxDeploymentId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - DeploymentName: deploymentName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NginxDeploymentName: nginxDeploymentName, } } @@ -44,8 +44,8 @@ func ParseNginxDeploymentID(input string) (*NginxDeploymentId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, fmt.Errorf("the segment 'deploymentName' was not found in the resource id %q", input) + if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { + return nil, fmt.Errorf("the segment 'nginxDeploymentName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseNginxDeploymentIDInsensitively(input string) (*NginxDeploymentId, erro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, fmt.Errorf("the segment 'deploymentName' was not found in the resource id %q", input) + if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { + return nil, fmt.Errorf("the segment 'nginxDeploymentName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateNginxDeploymentID(input interface{}, key string) (warnings []string // ID returns the formatted Nginx Deployment ID func (id NginxDeploymentId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Nginx.NginxPlus/nginxDeployments/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DeploymentName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NginxDeploymentName) } // Segments returns a slice of Resource ID Segments which comprise this Nginx Deployment ID @@ -109,7 +109,7 @@ func (id NginxDeploymentId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticNginxNginxPlus", "Nginx.NginxPlus", "Nginx.NginxPlus"), resourceids.StaticSegment("staticNginxDeployments", "nginxDeployments", "nginxDeployments"), - resourceids.UserSpecifiedSegment("deploymentName", "deploymentValue"), + resourceids.UserSpecifiedSegment("nginxDeploymentName", "nginxDeploymentValue"), } } @@ -118,7 +118,7 @@ func (id NginxDeploymentId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Deployment Name: %q", id.DeploymentName), + fmt.Sprintf("Nginx Deployment Name: %q", id.NginxDeploymentName), } return fmt.Sprintf("Nginx Deployment (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxdeployment/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxdeployment/README.md index 6e120e190aa3..a930026d52c2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxdeployment/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxdeployment/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := nginxdeployment.NewNginxDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentValue") +id := nginxdeployment.NewNginxDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentValue") payload := nginxdeployment.NginxDeployment{ // ... @@ -41,7 +41,7 @@ if err := client.DeploymentsCreateOrUpdateThenPoll(ctx, id, payload); err != nil ```go ctx := context.TODO() -id := nginxdeployment.NewNginxDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentValue") +id := nginxdeployment.NewNginxDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentValue") if err := client.DeploymentsDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeploymentsDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := nginxdeployment.NewNginxDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentValue") +id := nginxdeployment.NewNginxDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentValue") read, err := client.DeploymentsGet(ctx, id) if err != nil { @@ -103,7 +103,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := nginxdeployment.NewNginxDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentValue") +id := nginxdeployment.NewNginxDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentValue") payload := nginxdeployment.NginxDeploymentUpdateParameters{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxdeployment/id_nginxdeployment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxdeployment/id_nginxdeployment.go index 2856d88a622c..8b54d70c9528 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxdeployment/id_nginxdeployment.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01/nginxdeployment/id_nginxdeployment.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = NginxDeploymentId{} // NginxDeploymentId is a struct representing the Resource ID for a Nginx Deployment type NginxDeploymentId struct { - SubscriptionId string - ResourceGroupName string - DeploymentName string + SubscriptionId string + ResourceGroupName string + NginxDeploymentName string } // NewNginxDeploymentID returns a new NginxDeploymentId struct -func NewNginxDeploymentID(subscriptionId string, resourceGroupName string, deploymentName string) NginxDeploymentId { +func NewNginxDeploymentID(subscriptionId string, resourceGroupName string, nginxDeploymentName string) NginxDeploymentId { return NginxDeploymentId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - DeploymentName: deploymentName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NginxDeploymentName: nginxDeploymentName, } } @@ -44,8 +44,8 @@ func ParseNginxDeploymentID(input string) (*NginxDeploymentId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, fmt.Errorf("the segment 'deploymentName' was not found in the resource id %q", input) + if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { + return nil, fmt.Errorf("the segment 'nginxDeploymentName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseNginxDeploymentIDInsensitively(input string) (*NginxDeploymentId, erro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, fmt.Errorf("the segment 'deploymentName' was not found in the resource id %q", input) + if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { + return nil, fmt.Errorf("the segment 'nginxDeploymentName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateNginxDeploymentID(input interface{}, key string) (warnings []string // ID returns the formatted Nginx Deployment ID func (id NginxDeploymentId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Nginx.NginxPlus/nginxDeployments/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DeploymentName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NginxDeploymentName) } // Segments returns a slice of Resource ID Segments which comprise this Nginx Deployment ID @@ -109,7 +109,7 @@ func (id NginxDeploymentId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticNginxNginxPlus", "Nginx.NginxPlus", "Nginx.NginxPlus"), resourceids.StaticSegment("staticNginxDeployments", "nginxDeployments", "nginxDeployments"), - resourceids.UserSpecifiedSegment("deploymentName", "deploymentValue"), + resourceids.UserSpecifiedSegment("nginxDeploymentName", "nginxDeploymentValue"), } } @@ -118,7 +118,7 @@ func (id NginxDeploymentId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Deployment Name: %q", id.DeploymentName), + fmt.Sprintf("Nginx Deployment Name: %q", id.NginxDeploymentName), } return fmt.Sprintf("Nginx Deployment (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypackqueries/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypackqueries/README.md index a8f6b40ea9f6..b6a4fd958a1b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypackqueries/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypackqueries/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := querypackqueries.NewQueryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "queryPackValue", "idValue") +id := querypackqueries.NewQueryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "queryPackValue", "queryValue") read, err := client.QueriesDelete(ctx, id) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := querypackqueries.NewQueryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "queryPackValue", "idValue") +id := querypackqueries.NewQueryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "queryPackValue", "queryValue") read, err := client.QueriesGet(ctx, id) if err != nil { @@ -73,7 +73,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := querypackqueries.NewQueryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "queryPackValue", "idValue") +id := querypackqueries.NewQueryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "queryPackValue", "queryValue") payload := querypackqueries.LogAnalyticsQueryPackQuery{ // ... @@ -116,7 +116,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := querypackqueries.NewQueryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "queryPackValue", "idValue") +id := querypackqueries.NewQueryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "queryPackValue", "queryValue") payload := querypackqueries.LogAnalyticsQueryPackQuery{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypackqueries/id_query.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypackqueries/id_query.go index 91d4c2e58088..8a441c770933 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypackqueries/id_query.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypackqueries/id_query.go @@ -14,16 +14,16 @@ type QueryId struct { SubscriptionId string ResourceGroupName string QueryPackName string - Id string + QueryName string } // NewQueryID returns a new QueryId struct -func NewQueryID(subscriptionId string, resourceGroupName string, queryPackName string, id string) QueryId { +func NewQueryID(subscriptionId string, resourceGroupName string, queryPackName string, queryName string) QueryId { return QueryId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, QueryPackName: queryPackName, - Id: id, + QueryName: queryName, } } @@ -50,8 +50,8 @@ func ParseQueryID(input string) (*QueryId, error) { return nil, fmt.Errorf("the segment 'queryPackName' was not found in the resource id %q", input) } - if id.Id, ok = parsed.Parsed["id"]; !ok { - return nil, fmt.Errorf("the segment 'id' was not found in the resource id %q", input) + if id.QueryName, ok = parsed.Parsed["queryName"]; !ok { + return nil, fmt.Errorf("the segment 'queryName' was not found in the resource id %q", input) } return &id, nil @@ -81,8 +81,8 @@ func ParseQueryIDInsensitively(input string) (*QueryId, error) { return nil, fmt.Errorf("the segment 'queryPackName' was not found in the resource id %q", input) } - if id.Id, ok = parsed.Parsed["id"]; !ok { - return nil, fmt.Errorf("the segment 'id' was not found in the resource id %q", input) + if id.QueryName, ok = parsed.Parsed["queryName"]; !ok { + return nil, fmt.Errorf("the segment 'queryName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateQueryID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Query ID func (id QueryId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OperationalInsights/queryPacks/%s/queries/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.QueryPackName, id.Id) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.QueryPackName, id.QueryName) } // Segments returns a slice of Resource ID Segments which comprise this Query ID @@ -121,7 +121,7 @@ func (id QueryId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticQueryPacks", "queryPacks", "queryPacks"), resourceids.UserSpecifiedSegment("queryPackName", "queryPackValue"), resourceids.StaticSegment("staticQueries", "queries", "queries"), - resourceids.UserSpecifiedSegment("id", "idValue"), + resourceids.UserSpecifiedSegment("queryName", "queryValue"), } } @@ -131,7 +131,7 @@ func (id QueryId) String() string { fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Query Pack Name: %q", id.QueryPackName), - fmt.Sprintf(": %q", id.Id), + fmt.Sprintf("Query Name: %q", id.QueryName), } return fmt.Sprintf("Query (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/storageinsights/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/storageinsights/README.md index 8729ca21aaf5..36552c7ac446 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/storageinsights/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/storageinsights/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := storageinsights.NewStorageInsightConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "storageInsightValue") +id := storageinsights.NewStorageInsightConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "storageInsightConfigValue") payload := storageinsights.StorageInsight{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := storageinsights.NewStorageInsightConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "storageInsightValue") +id := storageinsights.NewStorageInsightConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "storageInsightConfigValue") read, err := client.StorageInsightConfigsDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := storageinsights.NewStorageInsightConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "storageInsightValue") +id := storageinsights.NewStorageInsightConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "storageInsightConfigValue") read, err := client.StorageInsightConfigsGet(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/storageinsights/id_storageinsightconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/storageinsights/id_storageinsightconfig.go index c12dd8cf38a2..a87bc7aa2b5c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/storageinsights/id_storageinsightconfig.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/storageinsights/id_storageinsightconfig.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = StorageInsightConfigId{} // StorageInsightConfigId is a struct representing the Resource ID for a Storage Insight Config type StorageInsightConfigId struct { - SubscriptionId string - ResourceGroupName string - WorkspaceName string - StorageInsightName string + SubscriptionId string + ResourceGroupName string + WorkspaceName string + StorageInsightConfigName string } // NewStorageInsightConfigID returns a new StorageInsightConfigId struct -func NewStorageInsightConfigID(subscriptionId string, resourceGroupName string, workspaceName string, storageInsightName string) StorageInsightConfigId { +func NewStorageInsightConfigID(subscriptionId string, resourceGroupName string, workspaceName string, storageInsightConfigName string) StorageInsightConfigId { return StorageInsightConfigId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - WorkspaceName: workspaceName, - StorageInsightName: storageInsightName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + StorageInsightConfigName: storageInsightConfigName, } } @@ -50,8 +50,8 @@ func ParseStorageInsightConfigID(input string) (*StorageInsightConfigId, error) return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) } - if id.StorageInsightName, ok = parsed.Parsed["storageInsightName"]; !ok { - return nil, fmt.Errorf("the segment 'storageInsightName' was not found in the resource id %q", input) + if id.StorageInsightConfigName, ok = parsed.Parsed["storageInsightConfigName"]; !ok { + return nil, fmt.Errorf("the segment 'storageInsightConfigName' was not found in the resource id %q", input) } return &id, nil @@ -81,8 +81,8 @@ func ParseStorageInsightConfigIDInsensitively(input string) (*StorageInsightConf return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) } - if id.StorageInsightName, ok = parsed.Parsed["storageInsightName"]; !ok { - return nil, fmt.Errorf("the segment 'storageInsightName' was not found in the resource id %q", input) + if id.StorageInsightConfigName, ok = parsed.Parsed["storageInsightConfigName"]; !ok { + return nil, fmt.Errorf("the segment 'storageInsightConfigName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateStorageInsightConfigID(input interface{}, key string) (warnings []s // ID returns the formatted Storage Insight Config ID func (id StorageInsightConfigId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OperationalInsights/workspaces/%s/storageInsightConfigs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName, id.StorageInsightName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName, id.StorageInsightConfigName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Insight Config ID @@ -121,7 +121,7 @@ func (id StorageInsightConfigId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"), resourceids.StaticSegment("staticStorageInsightConfigs", "storageInsightConfigs", "storageInsightConfigs"), - resourceids.UserSpecifiedSegment("storageInsightName", "storageInsightValue"), + resourceids.UserSpecifiedSegment("storageInsightConfigName", "storageInsightConfigValue"), } } @@ -131,7 +131,7 @@ func (id StorageInsightConfigId) String() string { fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), - fmt.Sprintf("Storage Insight Name: %q", id.StorageInsightName), + fmt.Sprintf("Storage Insight Config Name: %q", id.StorageInsightConfigName), } return fmt.Sprintf("Storage Insight Config (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/groundstation/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/groundstation/README.md index f866e6fff1b0..da96a17d5f10 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/groundstation/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/groundstation/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := groundstation.NewAvailableGroundStationID("12345678-1234-9876-4563-123456789012", "groundStationValue") +id := groundstation.NewAvailableGroundStationID("12345678-1234-9876-4563-123456789012", "availableGroundStationValue") read, err := client.AvailableGroundStationsGet(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/groundstation/id_availablegroundstation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/groundstation/id_availablegroundstation.go index b6766542df7b..8002724d653e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/groundstation/id_availablegroundstation.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/groundstation/id_availablegroundstation.go @@ -11,15 +11,15 @@ var _ resourceids.ResourceId = AvailableGroundStationId{} // AvailableGroundStationId is a struct representing the Resource ID for a Available Ground Station type AvailableGroundStationId struct { - SubscriptionId string - GroundStationName string + SubscriptionId string + AvailableGroundStationName string } // NewAvailableGroundStationID returns a new AvailableGroundStationId struct -func NewAvailableGroundStationID(subscriptionId string, groundStationName string) AvailableGroundStationId { +func NewAvailableGroundStationID(subscriptionId string, availableGroundStationName string) AvailableGroundStationId { return AvailableGroundStationId{ - SubscriptionId: subscriptionId, - GroundStationName: groundStationName, + SubscriptionId: subscriptionId, + AvailableGroundStationName: availableGroundStationName, } } @@ -38,8 +38,8 @@ func ParseAvailableGroundStationID(input string) (*AvailableGroundStationId, err return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.GroundStationName, ok = parsed.Parsed["groundStationName"]; !ok { - return nil, fmt.Errorf("the segment 'groundStationName' was not found in the resource id %q", input) + if id.AvailableGroundStationName, ok = parsed.Parsed["availableGroundStationName"]; !ok { + return nil, fmt.Errorf("the segment 'availableGroundStationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseAvailableGroundStationIDInsensitively(input string) (*AvailableGroundS return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.GroundStationName, ok = parsed.Parsed["groundStationName"]; !ok { - return nil, fmt.Errorf("the segment 'groundStationName' was not found in the resource id %q", input) + if id.AvailableGroundStationName, ok = parsed.Parsed["availableGroundStationName"]; !ok { + return nil, fmt.Errorf("the segment 'availableGroundStationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateAvailableGroundStationID(input interface{}, key string) (warnings [ // ID returns the formatted Available Ground Station ID func (id AvailableGroundStationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.Orbital/availableGroundStations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.GroundStationName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.AvailableGroundStationName) } // Segments returns a slice of Resource ID Segments which comprise this Available Ground Station ID @@ -97,7 +97,7 @@ func (id AvailableGroundStationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftOrbital", "Microsoft.Orbital", "Microsoft.Orbital"), resourceids.StaticSegment("staticAvailableGroundStations", "availableGroundStations", "availableGroundStations"), - resourceids.UserSpecifiedSegment("groundStationName", "groundStationValue"), + resourceids.UserSpecifiedSegment("availableGroundStationName", "availableGroundStationValue"), } } @@ -105,7 +105,7 @@ func (id AvailableGroundStationId) Segments() []resourceids.Segment { func (id AvailableGroundStationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Ground Station Name: %q", id.GroundStationName), + fmt.Sprintf("Available Ground Station Name: %q", id.AvailableGroundStationName), } return fmt.Sprintf("Available Ground Station (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/README.md index 41d1f0bb0874..4e16c306e84e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := configurations.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "configurationValue") +id := configurations.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue", "configurationValue") read, err := client.Get(ctx, id) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := configurations.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") +id := configurations.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue") // alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination items, err := client.ListByServerComplete(ctx, id) @@ -57,7 +57,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := configurations.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "configurationValue") +id := configurations.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue", "configurationValue") payload := configurations.Configuration{ // ... @@ -74,7 +74,7 @@ if err := client.PutThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := configurations.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "configurationValue") +id := configurations.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue", "configurationValue") payload := configurations.Configuration{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/id_configuration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/id_configuration.go index 0381cb9c0444..1891f1355824 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/id_configuration.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/id_configuration.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = ConfigurationId{} // ConfigurationId is a struct representing the Resource ID for a Configuration type ConfigurationId struct { - SubscriptionId string - ResourceGroupName string - ServerName string - ConfigurationName string + SubscriptionId string + ResourceGroupName string + FlexibleServerName string + ConfigurationName string } // NewConfigurationID returns a new ConfigurationId struct -func NewConfigurationID(subscriptionId string, resourceGroupName string, serverName string, configurationName string) ConfigurationId { +func NewConfigurationID(subscriptionId string, resourceGroupName string, flexibleServerName string, configurationName string) ConfigurationId { return ConfigurationId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ServerName: serverName, - ConfigurationName: configurationName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FlexibleServerName: flexibleServerName, + ConfigurationName: configurationName, } } @@ -46,8 +46,8 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) } if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { @@ -77,8 +77,8 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) } if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { @@ -106,7 +106,7 @@ func ValidateConfigurationID(input interface{}, key string) (warnings []string, // ID returns the formatted Configuration ID func (id ConfigurationId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s/configurations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.ConfigurationName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName, id.ConfigurationName) } // Segments returns a slice of Resource ID Segments which comprise this Configuration ID @@ -119,7 +119,7 @@ func (id ConfigurationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), - resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.UserSpecifiedSegment("flexibleServerName", "flexibleServerValue"), resourceids.StaticSegment("staticConfigurations", "configurations", "configurations"), resourceids.UserSpecifiedSegment("configurationName", "configurationValue"), } @@ -130,7 +130,7 @@ func (id ConfigurationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Flexible Server Name: %q", id.FlexibleServerName), fmt.Sprintf("Configuration Name: %q", id.ConfigurationName), } return fmt.Sprintf("Configuration (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/id_flexibleserver.go index 34a1cb396bb1..64a4acef1345 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/id_flexibleserver.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/id_flexibleserver.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = FlexibleServerId{} // FlexibleServerId is a struct representing the Resource ID for a Flexible Server type FlexibleServerId struct { - SubscriptionId string - ResourceGroupName string - ServerName string + SubscriptionId string + ResourceGroupName string + FlexibleServerName string } // NewFlexibleServerID returns a new FlexibleServerId struct -func NewFlexibleServerID(subscriptionId string, resourceGroupName string, serverName string) FlexibleServerId { +func NewFlexibleServerID(subscriptionId string, resourceGroupName string, flexibleServerName string) FlexibleServerId { return FlexibleServerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ServerName: serverName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FlexibleServerName: flexibleServerName, } } @@ -44,8 +44,8 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, // ID returns the formatted Flexible Server ID func (id FlexibleServerId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName) } // Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID @@ -109,7 +109,7 @@ func (id FlexibleServerId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), - resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.UserSpecifiedSegment("flexibleServerName", "flexibleServerValue"), } } @@ -118,7 +118,7 @@ func (id FlexibleServerId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Flexible Server Name: %q", id.FlexibleServerName), } return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/README.md deleted file mode 100644 index ecddbc99131e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/README.md +++ /dev/null @@ -1,82 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases` Documentation - -The `databases` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2021-06-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases" -``` - - -### Client Initialization - -```go -client := databases.NewDatabasesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `DatabasesClient.Create` - -```go -ctx := context.TODO() -id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "databaseValue") - -payload := databases.Database{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `DatabasesClient.Delete` - -```go -ctx := context.TODO() -id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "databaseValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `DatabasesClient.Get` - -```go -ctx := context.TODO() -id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "databaseValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `DatabasesClient.ListByServer` - -```go -ctx := context.TODO() -id := databases.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") - -// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination -items, err := client.ListByServerComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/id_flexibleserver.go deleted file mode 100644 index 0f75b80891db..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/id_flexibleserver.go +++ /dev/null @@ -1,124 +0,0 @@ -package databases - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = FlexibleServerId{} - -// FlexibleServerId is a struct representing the Resource ID for a Flexible Server -type FlexibleServerId struct { - SubscriptionId string - ResourceGroupName string - ServerName string -} - -// NewFlexibleServerID returns a new FlexibleServerId struct -func NewFlexibleServerID(subscriptionId string, resourceGroupName string, serverName string) FlexibleServerId { - return FlexibleServerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ServerName: serverName, - } -} - -// ParseFlexibleServerID parses 'input' into a FlexibleServerId -func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { - parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FlexibleServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseFlexibleServerIDInsensitively parses 'input' case-insensitively into a FlexibleServerId -// note: this method should only be used for API response data and not user input -func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) { - parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FlexibleServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID -func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseFlexibleServerID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Flexible Server ID -func (id FlexibleServerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID -func (id FlexibleServerId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), - resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), - resourceids.UserSpecifiedSegment("serverName", "serverValue"), - } -} - -// String returns a human-readable description of this Flexible Server ID -func (id FlexibleServerId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Server Name: %q", id.ServerName), - } - return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/version.go deleted file mode 100644 index 6fa6f9e90563..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package databases - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2021-06-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/databases/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/README.md deleted file mode 100644 index bada377834b5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/README.md +++ /dev/null @@ -1,82 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules` Documentation - -The `firewallrules` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2021-06-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules" -``` - - -### Client Initialization - -```go -client := firewallrules.NewFirewallRulesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `FirewallRulesClient.CreateOrUpdate` - -```go -ctx := context.TODO() -id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "firewallRuleValue") - -payload := firewallrules.FirewallRule{ - // ... -} - - -if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `FirewallRulesClient.Delete` - -```go -ctx := context.TODO() -id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "firewallRuleValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `FirewallRulesClient.Get` - -```go -ctx := context.TODO() -id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "firewallRuleValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `FirewallRulesClient.ListByServer` - -```go -ctx := context.TODO() -id := firewallrules.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") - -// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination -items, err := client.ListByServerComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/id_firewallrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/id_firewallrule.go deleted file mode 100644 index ea7c9ca099d5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/id_firewallrule.go +++ /dev/null @@ -1,137 +0,0 @@ -package firewallrules - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = FirewallRuleId{} - -// FirewallRuleId is a struct representing the Resource ID for a Firewall Rule -type FirewallRuleId struct { - SubscriptionId string - ResourceGroupName string - ServerName string - FirewallRuleName string -} - -// NewFirewallRuleID returns a new FirewallRuleId struct -func NewFirewallRuleID(subscriptionId string, resourceGroupName string, serverName string, firewallRuleName string) FirewallRuleId { - return FirewallRuleId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ServerName: serverName, - FirewallRuleName: firewallRuleName, - } -} - -// ParseFirewallRuleID parses 'input' into a FirewallRuleId -func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { - parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FirewallRuleId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, fmt.Errorf("the segment 'firewallRuleName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseFirewallRuleIDInsensitively parses 'input' case-insensitively into a FirewallRuleId -// note: this method should only be used for API response data and not user input -func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { - parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FirewallRuleId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, fmt.Errorf("the segment 'firewallRuleName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID -func ValidateFirewallRuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseFirewallRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Firewall Rule ID -func (id FirewallRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s/firewallRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.FirewallRuleName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Firewall Rule ID -func (id FirewallRuleId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), - resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), - resourceids.UserSpecifiedSegment("serverName", "serverValue"), - resourceids.StaticSegment("staticFirewallRules", "firewallRules", "firewallRules"), - resourceids.UserSpecifiedSegment("firewallRuleName", "firewallRuleValue"), - } -} - -// String returns a human-readable description of this Firewall Rule ID -func (id FirewallRuleId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Server Name: %q", id.ServerName), - fmt.Sprintf("Firewall Rule Name: %q", id.FirewallRuleName), - } - return fmt.Sprintf("Firewall Rule (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/id_flexibleserver.go deleted file mode 100644 index 2197cda3692d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/id_flexibleserver.go +++ /dev/null @@ -1,124 +0,0 @@ -package firewallrules - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = FlexibleServerId{} - -// FlexibleServerId is a struct representing the Resource ID for a Flexible Server -type FlexibleServerId struct { - SubscriptionId string - ResourceGroupName string - ServerName string -} - -// NewFlexibleServerID returns a new FlexibleServerId struct -func NewFlexibleServerID(subscriptionId string, resourceGroupName string, serverName string) FlexibleServerId { - return FlexibleServerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ServerName: serverName, - } -} - -// ParseFlexibleServerID parses 'input' into a FlexibleServerId -func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { - parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FlexibleServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseFlexibleServerIDInsensitively parses 'input' case-insensitively into a FlexibleServerId -// note: this method should only be used for API response data and not user input -func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) { - parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FlexibleServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID -func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseFlexibleServerID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Flexible Server ID -func (id FlexibleServerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID -func (id FlexibleServerId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), - resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), - resourceids.UserSpecifiedSegment("serverName", "serverValue"), - } -} - -// String returns a human-readable description of this Flexible Server ID -func (id FlexibleServerId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Server Name: %q", id.ServerName), - } - return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/README.md index 866027bcd6ea..48b7dd87f24a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := serverrestart.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") +id := serverrestart.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue") payload := serverrestart.RestartParameter{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/id_flexibleserver.go index b0f5049b0aef..7907619c96c4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/id_flexibleserver.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/id_flexibleserver.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = FlexibleServerId{} // FlexibleServerId is a struct representing the Resource ID for a Flexible Server type FlexibleServerId struct { - SubscriptionId string - ResourceGroupName string - ServerName string + SubscriptionId string + ResourceGroupName string + FlexibleServerName string } // NewFlexibleServerID returns a new FlexibleServerId struct -func NewFlexibleServerID(subscriptionId string, resourceGroupName string, serverName string) FlexibleServerId { +func NewFlexibleServerID(subscriptionId string, resourceGroupName string, flexibleServerName string) FlexibleServerId { return FlexibleServerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ServerName: serverName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FlexibleServerName: flexibleServerName, } } @@ -44,8 +44,8 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, // ID returns the formatted Flexible Server ID func (id FlexibleServerId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName) } // Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID @@ -109,7 +109,7 @@ func (id FlexibleServerId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), - resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.UserSpecifiedSegment("flexibleServerName", "flexibleServerValue"), } } @@ -118,7 +118,7 @@ func (id FlexibleServerId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Flexible Server Name: %q", id.FlexibleServerName), } return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/README.md deleted file mode 100644 index 0417b44998b5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/README.md +++ /dev/null @@ -1,82 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators` Documentation - -The `administrators` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2022-03-08-preview`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators" -``` - - -### Client Initialization - -```go -client := administrators.NewAdministratorsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `AdministratorsClient.Create` - -```go -ctx := context.TODO() -id := administrators.NewAdministratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "objectIdValue") - -payload := administrators.ActiveDirectoryAdministratorAdd{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `AdministratorsClient.Delete` - -```go -ctx := context.TODO() -id := administrators.NewAdministratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "objectIdValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `AdministratorsClient.Get` - -```go -ctx := context.TODO() -id := administrators.NewAdministratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "objectIdValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `AdministratorsClient.ListByServer` - -```go -ctx := context.TODO() -id := administrators.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") - -// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination -items, err := client.ListByServerComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/id_flexibleserver.go deleted file mode 100644 index 3a2f3c9b7332..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/id_flexibleserver.go +++ /dev/null @@ -1,124 +0,0 @@ -package administrators - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = FlexibleServerId{} - -// FlexibleServerId is a struct representing the Resource ID for a Flexible Server -type FlexibleServerId struct { - SubscriptionId string - ResourceGroupName string - ServerName string -} - -// NewFlexibleServerID returns a new FlexibleServerId struct -func NewFlexibleServerID(subscriptionId string, resourceGroupName string, serverName string) FlexibleServerId { - return FlexibleServerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ServerName: serverName, - } -} - -// ParseFlexibleServerID parses 'input' into a FlexibleServerId -func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { - parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FlexibleServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseFlexibleServerIDInsensitively parses 'input' case-insensitively into a FlexibleServerId -// note: this method should only be used for API response data and not user input -func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) { - parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FlexibleServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID -func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseFlexibleServerID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Flexible Server ID -func (id FlexibleServerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID -func (id FlexibleServerId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), - resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), - resourceids.UserSpecifiedSegment("serverName", "serverValue"), - } -} - -// String returns a human-readable description of this Flexible Server ID -func (id FlexibleServerId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Server Name: %q", id.ServerName), - } - return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/version.go deleted file mode 100644 index 8ee5b4b78879..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package administrators - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-03-08-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/administrators/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/README.md deleted file mode 100644 index ded58afe879c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/README.md +++ /dev/null @@ -1,116 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers` Documentation - -The `servers` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2022-03-08-preview`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers" -``` - - -### Client Initialization - -```go -client := servers.NewServersClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `ServersClient.Create` - -```go -ctx := context.TODO() -id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") - -payload := servers.Server{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `ServersClient.Delete` - -```go -ctx := context.TODO() -id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `ServersClient.Get` - -```go -ctx := context.TODO() -id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `ServersClient.List` - -```go -ctx := context.TODO() -id := servers.NewSubscriptionID("12345678-1234-9876-4563-123456789012") - -// alternatively `client.List(ctx, id)` can be used to do batched pagination -items, err := client.ListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `ServersClient.ListByResourceGroup` - -```go -ctx := context.TODO() -id := servers.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") - -// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination -items, err := client.ListByResourceGroupComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `ServersClient.Update` - -```go -ctx := context.TODO() -id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") - -payload := servers.ServerForUpdate{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/constants.go deleted file mode 100644 index 574434935c0d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/constants.go +++ /dev/null @@ -1,414 +0,0 @@ -package servers - -import "strings" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ArmServerKeyType string - -const ( - ArmServerKeyTypeAzureKeyVault ArmServerKeyType = "AzureKeyVault" - ArmServerKeyTypeSystemAssigned ArmServerKeyType = "SystemAssigned" -) - -func PossibleValuesForArmServerKeyType() []string { - return []string{ - string(ArmServerKeyTypeAzureKeyVault), - string(ArmServerKeyTypeSystemAssigned), - } -} - -func parseArmServerKeyType(input string) (*ArmServerKeyType, error) { - vals := map[string]ArmServerKeyType{ - "azurekeyvault": ArmServerKeyTypeAzureKeyVault, - "systemassigned": ArmServerKeyTypeSystemAssigned, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ArmServerKeyType(input) - return &out, nil -} - -type CreateMode string - -const ( - CreateModeCreate CreateMode = "Create" - CreateModeDefault CreateMode = "Default" - CreateModeGeoRestore CreateMode = "GeoRestore" - CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" - CreateModeReplica CreateMode = "Replica" - CreateModeUpdate CreateMode = "Update" -) - -func PossibleValuesForCreateMode() []string { - return []string{ - string(CreateModeCreate), - string(CreateModeDefault), - string(CreateModeGeoRestore), - string(CreateModePointInTimeRestore), - string(CreateModeReplica), - string(CreateModeUpdate), - } -} - -func parseCreateMode(input string) (*CreateMode, error) { - vals := map[string]CreateMode{ - "create": CreateModeCreate, - "default": CreateModeDefault, - "georestore": CreateModeGeoRestore, - "pointintimerestore": CreateModePointInTimeRestore, - "replica": CreateModeReplica, - "update": CreateModeUpdate, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CreateMode(input) - return &out, nil -} - -type CreateModeForUpdate string - -const ( - CreateModeForUpdateDefault CreateModeForUpdate = "Default" - CreateModeForUpdateUpdate CreateModeForUpdate = "Update" -) - -func PossibleValuesForCreateModeForUpdate() []string { - return []string{ - string(CreateModeForUpdateDefault), - string(CreateModeForUpdateUpdate), - } -} - -func parseCreateModeForUpdate(input string) (*CreateModeForUpdate, error) { - vals := map[string]CreateModeForUpdate{ - "default": CreateModeForUpdateDefault, - "update": CreateModeForUpdateUpdate, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CreateModeForUpdate(input) - return &out, nil -} - -type GeoRedundantBackupEnum string - -const ( - GeoRedundantBackupEnumDisabled GeoRedundantBackupEnum = "Disabled" - GeoRedundantBackupEnumEnabled GeoRedundantBackupEnum = "Enabled" -) - -func PossibleValuesForGeoRedundantBackupEnum() []string { - return []string{ - string(GeoRedundantBackupEnumDisabled), - string(GeoRedundantBackupEnumEnabled), - } -} - -func parseGeoRedundantBackupEnum(input string) (*GeoRedundantBackupEnum, error) { - vals := map[string]GeoRedundantBackupEnum{ - "disabled": GeoRedundantBackupEnumDisabled, - "enabled": GeoRedundantBackupEnumEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := GeoRedundantBackupEnum(input) - return &out, nil -} - -type HighAvailabilityMode string - -const ( - HighAvailabilityModeDisabled HighAvailabilityMode = "Disabled" - HighAvailabilityModeSameZone HighAvailabilityMode = "SameZone" - HighAvailabilityModeZoneRedundant HighAvailabilityMode = "ZoneRedundant" -) - -func PossibleValuesForHighAvailabilityMode() []string { - return []string{ - string(HighAvailabilityModeDisabled), - string(HighAvailabilityModeSameZone), - string(HighAvailabilityModeZoneRedundant), - } -} - -func parseHighAvailabilityMode(input string) (*HighAvailabilityMode, error) { - vals := map[string]HighAvailabilityMode{ - "disabled": HighAvailabilityModeDisabled, - "samezone": HighAvailabilityModeSameZone, - "zoneredundant": HighAvailabilityModeZoneRedundant, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := HighAvailabilityMode(input) - return &out, nil -} - -type IdentityType string - -const ( - IdentityTypeNone IdentityType = "None" - IdentityTypeSystemAssigned IdentityType = "SystemAssigned" - IdentityTypeUserAssigned IdentityType = "UserAssigned" -) - -func PossibleValuesForIdentityType() []string { - return []string{ - string(IdentityTypeNone), - string(IdentityTypeSystemAssigned), - string(IdentityTypeUserAssigned), - } -} - -func parseIdentityType(input string) (*IdentityType, error) { - vals := map[string]IdentityType{ - "none": IdentityTypeNone, - "systemassigned": IdentityTypeSystemAssigned, - "userassigned": IdentityTypeUserAssigned, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := IdentityType(input) - return &out, nil -} - -type ReplicationRole string - -const ( - ReplicationRoleAsyncReplica ReplicationRole = "AsyncReplica" - ReplicationRoleGeoAsyncReplica ReplicationRole = "GeoAsyncReplica" - ReplicationRoleGeoSyncReplica ReplicationRole = "GeoSyncReplica" - ReplicationRoleNone ReplicationRole = "None" - ReplicationRolePrimary ReplicationRole = "Primary" - ReplicationRoleSecondary ReplicationRole = "Secondary" - ReplicationRoleSyncReplica ReplicationRole = "SyncReplica" - ReplicationRoleWalReplica ReplicationRole = "WalReplica" -) - -func PossibleValuesForReplicationRole() []string { - return []string{ - string(ReplicationRoleAsyncReplica), - string(ReplicationRoleGeoAsyncReplica), - string(ReplicationRoleGeoSyncReplica), - string(ReplicationRoleNone), - string(ReplicationRolePrimary), - string(ReplicationRoleSecondary), - string(ReplicationRoleSyncReplica), - string(ReplicationRoleWalReplica), - } -} - -func parseReplicationRole(input string) (*ReplicationRole, error) { - vals := map[string]ReplicationRole{ - "asyncreplica": ReplicationRoleAsyncReplica, - "geoasyncreplica": ReplicationRoleGeoAsyncReplica, - "geosyncreplica": ReplicationRoleGeoSyncReplica, - "none": ReplicationRoleNone, - "primary": ReplicationRolePrimary, - "secondary": ReplicationRoleSecondary, - "syncreplica": ReplicationRoleSyncReplica, - "walreplica": ReplicationRoleWalReplica, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationRole(input) - return &out, nil -} - -type ServerHAState string - -const ( - ServerHAStateCreatingStandby ServerHAState = "CreatingStandby" - ServerHAStateFailingOver ServerHAState = "FailingOver" - ServerHAStateHealthy ServerHAState = "Healthy" - ServerHAStateNotEnabled ServerHAState = "NotEnabled" - ServerHAStateRemovingStandby ServerHAState = "RemovingStandby" - ServerHAStateReplicatingData ServerHAState = "ReplicatingData" -) - -func PossibleValuesForServerHAState() []string { - return []string{ - string(ServerHAStateCreatingStandby), - string(ServerHAStateFailingOver), - string(ServerHAStateHealthy), - string(ServerHAStateNotEnabled), - string(ServerHAStateRemovingStandby), - string(ServerHAStateReplicatingData), - } -} - -func parseServerHAState(input string) (*ServerHAState, error) { - vals := map[string]ServerHAState{ - "creatingstandby": ServerHAStateCreatingStandby, - "failingover": ServerHAStateFailingOver, - "healthy": ServerHAStateHealthy, - "notenabled": ServerHAStateNotEnabled, - "removingstandby": ServerHAStateRemovingStandby, - "replicatingdata": ServerHAStateReplicatingData, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServerHAState(input) - return &out, nil -} - -type ServerPublicNetworkAccessState string - -const ( - ServerPublicNetworkAccessStateDisabled ServerPublicNetworkAccessState = "Disabled" - ServerPublicNetworkAccessStateEnabled ServerPublicNetworkAccessState = "Enabled" -) - -func PossibleValuesForServerPublicNetworkAccessState() []string { - return []string{ - string(ServerPublicNetworkAccessStateDisabled), - string(ServerPublicNetworkAccessStateEnabled), - } -} - -func parseServerPublicNetworkAccessState(input string) (*ServerPublicNetworkAccessState, error) { - vals := map[string]ServerPublicNetworkAccessState{ - "disabled": ServerPublicNetworkAccessStateDisabled, - "enabled": ServerPublicNetworkAccessStateEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServerPublicNetworkAccessState(input) - return &out, nil -} - -type ServerState string - -const ( - ServerStateDisabled ServerState = "Disabled" - ServerStateDropping ServerState = "Dropping" - ServerStateReady ServerState = "Ready" - ServerStateStarting ServerState = "Starting" - ServerStateStopped ServerState = "Stopped" - ServerStateStopping ServerState = "Stopping" - ServerStateUpdating ServerState = "Updating" -) - -func PossibleValuesForServerState() []string { - return []string{ - string(ServerStateDisabled), - string(ServerStateDropping), - string(ServerStateReady), - string(ServerStateStarting), - string(ServerStateStopped), - string(ServerStateStopping), - string(ServerStateUpdating), - } -} - -func parseServerState(input string) (*ServerState, error) { - vals := map[string]ServerState{ - "disabled": ServerStateDisabled, - "dropping": ServerStateDropping, - "ready": ServerStateReady, - "starting": ServerStateStarting, - "stopped": ServerStateStopped, - "stopping": ServerStateStopping, - "updating": ServerStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServerState(input) - return &out, nil -} - -type ServerVersion string - -const ( - ServerVersionOneFour ServerVersion = "14" - ServerVersionOneOne ServerVersion = "11" - ServerVersionOneThree ServerVersion = "13" - ServerVersionOneTwo ServerVersion = "12" -) - -func PossibleValuesForServerVersion() []string { - return []string{ - string(ServerVersionOneFour), - string(ServerVersionOneOne), - string(ServerVersionOneThree), - string(ServerVersionOneTwo), - } -} - -func parseServerVersion(input string) (*ServerVersion, error) { - vals := map[string]ServerVersion{ - "14": ServerVersionOneFour, - "11": ServerVersionOneOne, - "13": ServerVersionOneThree, - "12": ServerVersionOneTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServerVersion(input) - return &out, nil -} - -type SkuTier string - -const ( - SkuTierBurstable SkuTier = "Burstable" - SkuTierGeneralPurpose SkuTier = "GeneralPurpose" - SkuTierMemoryOptimized SkuTier = "MemoryOptimized" -) - -func PossibleValuesForSkuTier() []string { - return []string{ - string(SkuTierBurstable), - string(SkuTierGeneralPurpose), - string(SkuTierMemoryOptimized), - } -} - -func parseSkuTier(input string) (*SkuTier, error) { - vals := map[string]SkuTier{ - "burstable": SkuTierBurstable, - "generalpurpose": SkuTierGeneralPurpose, - "memoryoptimized": SkuTierMemoryOptimized, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SkuTier(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/id_flexibleserver.go deleted file mode 100644 index faf0175b6acc..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/id_flexibleserver.go +++ /dev/null @@ -1,124 +0,0 @@ -package servers - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = FlexibleServerId{} - -// FlexibleServerId is a struct representing the Resource ID for a Flexible Server -type FlexibleServerId struct { - SubscriptionId string - ResourceGroupName string - ServerName string -} - -// NewFlexibleServerID returns a new FlexibleServerId struct -func NewFlexibleServerID(subscriptionId string, resourceGroupName string, serverName string) FlexibleServerId { - return FlexibleServerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ServerName: serverName, - } -} - -// ParseFlexibleServerID parses 'input' into a FlexibleServerId -func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { - parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FlexibleServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseFlexibleServerIDInsensitively parses 'input' case-insensitively into a FlexibleServerId -// note: this method should only be used for API response data and not user input -func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) { - parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := FlexibleServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID -func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseFlexibleServerID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Flexible Server ID -func (id FlexibleServerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID -func (id FlexibleServerId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), - resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), - resourceids.UserSpecifiedSegment("serverName", "serverValue"), - } -} - -// String returns a human-readable description of this Flexible Server ID -func (id FlexibleServerId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Server Name: %q", id.ServerName), - } - return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_authconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_authconfig.go deleted file mode 100644 index 79be7f4cca04..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_authconfig.go +++ /dev/null @@ -1,10 +0,0 @@ -package servers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AuthConfig struct { - ActiveDirectoryAuthEnabled *bool `json:"activeDirectoryAuthEnabled,omitempty"` - PasswordAuthEnabled *bool `json:"passwordAuthEnabled,omitempty"` - TenantId *string `json:"tenantId,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/version.go deleted file mode 100644 index 7c5fd4c30afd..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package servers - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-03-08-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/servers/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/README.md new file mode 100644 index 000000000000..71ac11b55fbf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators` Documentation + +The `administrators` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2022-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators" +``` + + +### Client Initialization + +```go +client := administrators.NewAdministratorsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AdministratorsClient.Create` + +```go +ctx := context.TODO() +id := administrators.NewAdministratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue", "objectIdValue") + +payload := administrators.ActiveDirectoryAdministratorAdd{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AdministratorsClient.Delete` + +```go +ctx := context.TODO() +id := administrators.NewAdministratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue", "objectIdValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AdministratorsClient.Get` + +```go +ctx := context.TODO() +id := administrators.NewAdministratorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue", "objectIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AdministratorsClient.ListByServer` + +```go +ctx := context.TODO() +id := administrators.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue") + +// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination +items, err := client.ListByServerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/constants.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/constants.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/constants.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/id_administrator.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/id_administrator.go similarity index 83% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/id_administrator.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/id_administrator.go index 234cc8f8e1bf..584016d0b482 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/id_administrator.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/id_administrator.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = AdministratorId{} // AdministratorId is a struct representing the Resource ID for a Administrator type AdministratorId struct { - SubscriptionId string - ResourceGroupName string - ServerName string - ObjectId string + SubscriptionId string + ResourceGroupName string + FlexibleServerName string + ObjectId string } // NewAdministratorID returns a new AdministratorId struct -func NewAdministratorID(subscriptionId string, resourceGroupName string, serverName string, objectId string) AdministratorId { +func NewAdministratorID(subscriptionId string, resourceGroupName string, flexibleServerName string, objectId string) AdministratorId { return AdministratorId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ServerName: serverName, - ObjectId: objectId, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FlexibleServerName: flexibleServerName, + ObjectId: objectId, } } @@ -46,8 +46,8 @@ func ParseAdministratorID(input string) (*AdministratorId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) } if id.ObjectId, ok = parsed.Parsed["objectId"]; !ok { @@ -77,8 +77,8 @@ func ParseAdministratorIDInsensitively(input string) (*AdministratorId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) } if id.ObjectId, ok = parsed.Parsed["objectId"]; !ok { @@ -106,7 +106,7 @@ func ValidateAdministratorID(input interface{}, key string) (warnings []string, // ID returns the formatted Administrator ID func (id AdministratorId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s/administrators/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.ObjectId) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName, id.ObjectId) } // Segments returns a slice of Resource ID Segments which comprise this Administrator ID @@ -119,7 +119,7 @@ func (id AdministratorId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), - resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.UserSpecifiedSegment("flexibleServerName", "flexibleServerValue"), resourceids.StaticSegment("staticAdministrators", "administrators", "administrators"), resourceids.UserSpecifiedSegment("objectId", "objectIdValue"), } @@ -130,7 +130,7 @@ func (id AdministratorId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Flexible Server Name: %q", id.FlexibleServerName), fmt.Sprintf("Object: %q", id.ObjectId), } return fmt.Sprintf("Administrator (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/id_flexibleserver.go new file mode 100644 index 000000000000..ee8354e11fd3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/id_flexibleserver.go @@ -0,0 +1,124 @@ +package administrators + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FlexibleServerId{} + +// FlexibleServerId is a struct representing the Resource ID for a Flexible Server +type FlexibleServerId struct { + SubscriptionId string + ResourceGroupName string + FlexibleServerName string +} + +// NewFlexibleServerID returns a new FlexibleServerId struct +func NewFlexibleServerID(subscriptionId string, resourceGroupName string, flexibleServerName string) FlexibleServerId { + return FlexibleServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FlexibleServerName: flexibleServerName, + } +} + +// ParseFlexibleServerID parses 'input' into a FlexibleServerId +func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFlexibleServerIDInsensitively parses 'input' case-insensitively into a FlexibleServerId +// note: this method should only be used for API response data and not user input +func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID +func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFlexibleServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Flexible Server ID +func (id FlexibleServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID +func (id FlexibleServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), + resourceids.UserSpecifiedSegment("flexibleServerName", "flexibleServerValue"), + } +} + +// String returns a human-readable description of this Flexible Server ID +func (id FlexibleServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Flexible Server Name: %q", id.FlexibleServerName), + } + return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_create_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/method_create_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_create_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_delete_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/method_delete_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_delete_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_get_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/method_get_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_get_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/method_listbyserver_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_listbyserver_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/method_listbyserver_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/method_listbyserver_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/model_activedirectoryadministrator.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_activedirectoryadministrator.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/model_activedirectoryadministrator.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_activedirectoryadministrator.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/model_activedirectoryadministratoradd.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_activedirectoryadministratoradd.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/model_activedirectoryadministratoradd.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_activedirectoryadministratoradd.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/model_administratorproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_administratorproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/model_administratorproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_administratorproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/model_administratorpropertiesforadd.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_administratorpropertiesforadd.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/model_administratorpropertiesforadd.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/model_administratorpropertiesforadd.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/version.go new file mode 100644 index 000000000000..ebf756ae1fec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators/version.go @@ -0,0 +1,12 @@ +package administrators + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/administrators/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/README.md new file mode 100644 index 000000000000..7787c7963e36 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases` Documentation + +The `databases` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2022-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases" +``` + + +### Client Initialization + +```go +client := databases.NewDatabasesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DatabasesClient.Create` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue", "databaseValue") + +payload := databases.Database{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Delete` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue", "databaseValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Get` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue", "databaseValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.ListByServer` + +```go +ctx := context.TODO() +id := databases.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue") + +// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination +items, err := client.ListByServerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/id_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/id_database.go similarity index 82% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/id_database.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/id_database.go index c96e95554f46..580b8aac72e7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/id_database.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/id_database.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = DatabaseId{} // DatabaseId is a struct representing the Resource ID for a Database type DatabaseId struct { - SubscriptionId string - ResourceGroupName string - ServerName string - DatabaseName string + SubscriptionId string + ResourceGroupName string + FlexibleServerName string + DatabaseName string } // NewDatabaseID returns a new DatabaseId struct -func NewDatabaseID(subscriptionId string, resourceGroupName string, serverName string, databaseName string) DatabaseId { +func NewDatabaseID(subscriptionId string, resourceGroupName string, flexibleServerName string, databaseName string) DatabaseId { return DatabaseId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ServerName: serverName, - DatabaseName: databaseName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FlexibleServerName: flexibleServerName, + DatabaseName: databaseName, } } @@ -46,8 +46,8 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) } if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { @@ -77,8 +77,8 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) } if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { @@ -106,7 +106,7 @@ func ValidateDatabaseID(input interface{}, key string) (warnings []string, error // ID returns the formatted Database ID func (id DatabaseId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s/databases/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.DatabaseName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName, id.DatabaseName) } // Segments returns a slice of Resource ID Segments which comprise this Database ID @@ -119,7 +119,7 @@ func (id DatabaseId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), - resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.UserSpecifiedSegment("flexibleServerName", "flexibleServerValue"), resourceids.StaticSegment("staticDatabases", "databases", "databases"), resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), } @@ -130,7 +130,7 @@ func (id DatabaseId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Flexible Server Name: %q", id.FlexibleServerName), fmt.Sprintf("Database Name: %q", id.DatabaseName), } return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/id_flexibleserver.go new file mode 100644 index 000000000000..65e2a69eca6f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/id_flexibleserver.go @@ -0,0 +1,124 @@ +package databases + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FlexibleServerId{} + +// FlexibleServerId is a struct representing the Resource ID for a Flexible Server +type FlexibleServerId struct { + SubscriptionId string + ResourceGroupName string + FlexibleServerName string +} + +// NewFlexibleServerID returns a new FlexibleServerId struct +func NewFlexibleServerID(subscriptionId string, resourceGroupName string, flexibleServerName string) FlexibleServerId { + return FlexibleServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FlexibleServerName: flexibleServerName, + } +} + +// ParseFlexibleServerID parses 'input' into a FlexibleServerId +func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFlexibleServerIDInsensitively parses 'input' case-insensitively into a FlexibleServerId +// note: this method should only be used for API response data and not user input +func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID +func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFlexibleServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Flexible Server ID +func (id FlexibleServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID +func (id FlexibleServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), + resourceids.UserSpecifiedSegment("flexibleServerName", "flexibleServerValue"), + } +} + +// String returns a human-readable description of this Flexible Server ID +func (id FlexibleServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Flexible Server Name: %q", id.FlexibleServerName), + } + return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_create_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_create_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_create_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_delete_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_delete_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_delete_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_get_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_get_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_get_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_listbyserver_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_listbyserver_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_listbyserver_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/method_listbyserver_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/model_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/model_database.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/model_database.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/model_database.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/model_databaseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/model_databaseproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/model_databaseproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/model_databaseproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/version.go new file mode 100644 index 000000000000..5812c716548b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases/version.go @@ -0,0 +1,12 @@ +package databases + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/databases/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/README.md new file mode 100644 index 000000000000..9c6b89fce56b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules` Documentation + +The `firewallrules` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2022-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules" +``` + + +### Client Initialization + +```go +client := firewallrules.NewFirewallRulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `FirewallRulesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue", "firewallRuleValue") + +payload := firewallrules.FirewallRule{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `FirewallRulesClient.Delete` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue", "firewallRuleValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `FirewallRulesClient.Get` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue", "firewallRuleValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FirewallRulesClient.ListByServer` + +```go +ctx := context.TODO() +id := firewallrules.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue") + +// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination +items, err := client.ListByServerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/id_firewallrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/id_firewallrule.go new file mode 100644 index 000000000000..6b0a2d8e444d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/id_firewallrule.go @@ -0,0 +1,137 @@ +package firewallrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FirewallRuleId{} + +// FirewallRuleId is a struct representing the Resource ID for a Firewall Rule +type FirewallRuleId struct { + SubscriptionId string + ResourceGroupName string + FlexibleServerName string + FirewallRuleName string +} + +// NewFirewallRuleID returns a new FirewallRuleId struct +func NewFirewallRuleID(subscriptionId string, resourceGroupName string, flexibleServerName string, firewallRuleName string) FirewallRuleId { + return FirewallRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FlexibleServerName: flexibleServerName, + FirewallRuleName: firewallRuleName, + } +} + +// ParseFirewallRuleID parses 'input' into a FirewallRuleId +func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FirewallRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) + } + + if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'firewallRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFirewallRuleIDInsensitively parses 'input' case-insensitively into a FirewallRuleId +// note: this method should only be used for API response data and not user input +func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FirewallRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) + } + + if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'firewallRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID +func ValidateFirewallRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFirewallRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Firewall Rule ID +func (id FirewallRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s/firewallRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName, id.FirewallRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Firewall Rule ID +func (id FirewallRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), + resourceids.UserSpecifiedSegment("flexibleServerName", "flexibleServerValue"), + resourceids.StaticSegment("staticFirewallRules", "firewallRules", "firewallRules"), + resourceids.UserSpecifiedSegment("firewallRuleName", "firewallRuleValue"), + } +} + +// String returns a human-readable description of this Firewall Rule ID +func (id FirewallRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Flexible Server Name: %q", id.FlexibleServerName), + fmt.Sprintf("Firewall Rule Name: %q", id.FirewallRuleName), + } + return fmt.Sprintf("Firewall Rule (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/id_flexibleserver.go new file mode 100644 index 000000000000..f0ed819042ee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/id_flexibleserver.go @@ -0,0 +1,124 @@ +package firewallrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FlexibleServerId{} + +// FlexibleServerId is a struct representing the Resource ID for a Flexible Server +type FlexibleServerId struct { + SubscriptionId string + ResourceGroupName string + FlexibleServerName string +} + +// NewFlexibleServerID returns a new FlexibleServerId struct +func NewFlexibleServerID(subscriptionId string, resourceGroupName string, flexibleServerName string) FlexibleServerId { + return FlexibleServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FlexibleServerName: flexibleServerName, + } +} + +// ParseFlexibleServerID parses 'input' into a FlexibleServerId +func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFlexibleServerIDInsensitively parses 'input' case-insensitively into a FlexibleServerId +// note: this method should only be used for API response data and not user input +func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID +func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFlexibleServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Flexible Server ID +func (id FlexibleServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID +func (id FlexibleServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), + resourceids.UserSpecifiedSegment("flexibleServerName", "flexibleServerValue"), + } +} + +// String returns a human-readable description of this Flexible Server ID +func (id FlexibleServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Flexible Server Name: %q", id.FlexibleServerName), + } + return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_createorupdate_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_createorupdate_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_createorupdate_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_delete_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_delete_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_delete_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_get_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_get_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_get_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_listbyserver_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_listbyserver_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_listbyserver_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/method_listbyserver_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/model_firewallrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/model_firewallrule.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/model_firewallrule.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/model_firewallrule.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/model_firewallruleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/model_firewallruleproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/model_firewallruleproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/model_firewallruleproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/version.go new file mode 100644 index 000000000000..7f0b967451a9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules/version.go @@ -0,0 +1,12 @@ +package firewallrules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/firewallrules/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/README.md new file mode 100644 index 000000000000..8a35cb4e4863 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers` Documentation + +The `servers` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2022-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers" +``` + + +### Client Initialization + +```go +client := servers.NewServersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServersClient.Create` + +```go +ctx := context.TODO() +id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue") + +payload := servers.Server{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServersClient.Delete` + +```go +ctx := context.TODO() +id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServersClient.Get` + +```go +ctx := context.TODO() +id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.List` + +```go +ctx := context.TODO() +id := servers.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ServersClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := servers.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ServersClient.Update` + +```go +ctx := context.TODO() +id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "flexibleServerValue") + +payload := servers.ServerForUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/constants.go new file mode 100644 index 000000000000..c65279d03605 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/constants.go @@ -0,0 +1,470 @@ +package servers + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActiveDirectoryAuthEnum string + +const ( + ActiveDirectoryAuthEnumDisabled ActiveDirectoryAuthEnum = "Disabled" + ActiveDirectoryAuthEnumEnabled ActiveDirectoryAuthEnum = "Enabled" +) + +func PossibleValuesForActiveDirectoryAuthEnum() []string { + return []string{ + string(ActiveDirectoryAuthEnumDisabled), + string(ActiveDirectoryAuthEnumEnabled), + } +} + +func parseActiveDirectoryAuthEnum(input string) (*ActiveDirectoryAuthEnum, error) { + vals := map[string]ActiveDirectoryAuthEnum{ + "disabled": ActiveDirectoryAuthEnumDisabled, + "enabled": ActiveDirectoryAuthEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ActiveDirectoryAuthEnum(input) + return &out, nil +} + +type ArmServerKeyType string + +const ( + ArmServerKeyTypeAzureKeyVault ArmServerKeyType = "AzureKeyVault" + ArmServerKeyTypeSystemAssigned ArmServerKeyType = "SystemAssigned" +) + +func PossibleValuesForArmServerKeyType() []string { + return []string{ + string(ArmServerKeyTypeAzureKeyVault), + string(ArmServerKeyTypeSystemAssigned), + } +} + +func parseArmServerKeyType(input string) (*ArmServerKeyType, error) { + vals := map[string]ArmServerKeyType{ + "azurekeyvault": ArmServerKeyTypeAzureKeyVault, + "systemassigned": ArmServerKeyTypeSystemAssigned, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ArmServerKeyType(input) + return &out, nil +} + +type CreateMode string + +const ( + CreateModeCreate CreateMode = "Create" + CreateModeDefault CreateMode = "Default" + CreateModeGeoRestore CreateMode = "GeoRestore" + CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" + CreateModeReplica CreateMode = "Replica" + CreateModeUpdate CreateMode = "Update" +) + +func PossibleValuesForCreateMode() []string { + return []string{ + string(CreateModeCreate), + string(CreateModeDefault), + string(CreateModeGeoRestore), + string(CreateModePointInTimeRestore), + string(CreateModeReplica), + string(CreateModeUpdate), + } +} + +func parseCreateMode(input string) (*CreateMode, error) { + vals := map[string]CreateMode{ + "create": CreateModeCreate, + "default": CreateModeDefault, + "georestore": CreateModeGeoRestore, + "pointintimerestore": CreateModePointInTimeRestore, + "replica": CreateModeReplica, + "update": CreateModeUpdate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CreateMode(input) + return &out, nil +} + +type CreateModeForUpdate string + +const ( + CreateModeForUpdateDefault CreateModeForUpdate = "Default" + CreateModeForUpdateUpdate CreateModeForUpdate = "Update" +) + +func PossibleValuesForCreateModeForUpdate() []string { + return []string{ + string(CreateModeForUpdateDefault), + string(CreateModeForUpdateUpdate), + } +} + +func parseCreateModeForUpdate(input string) (*CreateModeForUpdate, error) { + vals := map[string]CreateModeForUpdate{ + "default": CreateModeForUpdateDefault, + "update": CreateModeForUpdateUpdate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CreateModeForUpdate(input) + return &out, nil +} + +type GeoRedundantBackupEnum string + +const ( + GeoRedundantBackupEnumDisabled GeoRedundantBackupEnum = "Disabled" + GeoRedundantBackupEnumEnabled GeoRedundantBackupEnum = "Enabled" +) + +func PossibleValuesForGeoRedundantBackupEnum() []string { + return []string{ + string(GeoRedundantBackupEnumDisabled), + string(GeoRedundantBackupEnumEnabled), + } +} + +func parseGeoRedundantBackupEnum(input string) (*GeoRedundantBackupEnum, error) { + vals := map[string]GeoRedundantBackupEnum{ + "disabled": GeoRedundantBackupEnumDisabled, + "enabled": GeoRedundantBackupEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GeoRedundantBackupEnum(input) + return &out, nil +} + +type HighAvailabilityMode string + +const ( + HighAvailabilityModeDisabled HighAvailabilityMode = "Disabled" + HighAvailabilityModeSameZone HighAvailabilityMode = "SameZone" + HighAvailabilityModeZoneRedundant HighAvailabilityMode = "ZoneRedundant" +) + +func PossibleValuesForHighAvailabilityMode() []string { + return []string{ + string(HighAvailabilityModeDisabled), + string(HighAvailabilityModeSameZone), + string(HighAvailabilityModeZoneRedundant), + } +} + +func parseHighAvailabilityMode(input string) (*HighAvailabilityMode, error) { + vals := map[string]HighAvailabilityMode{ + "disabled": HighAvailabilityModeDisabled, + "samezone": HighAvailabilityModeSameZone, + "zoneredundant": HighAvailabilityModeZoneRedundant, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HighAvailabilityMode(input) + return &out, nil +} + +type IdentityType string + +const ( + IdentityTypeNone IdentityType = "None" + IdentityTypeSystemAssigned IdentityType = "SystemAssigned" + IdentityTypeUserAssigned IdentityType = "UserAssigned" +) + +func PossibleValuesForIdentityType() []string { + return []string{ + string(IdentityTypeNone), + string(IdentityTypeSystemAssigned), + string(IdentityTypeUserAssigned), + } +} + +func parseIdentityType(input string) (*IdentityType, error) { + vals := map[string]IdentityType{ + "none": IdentityTypeNone, + "systemassigned": IdentityTypeSystemAssigned, + "userassigned": IdentityTypeUserAssigned, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IdentityType(input) + return &out, nil +} + +type PasswordAuthEnum string + +const ( + PasswordAuthEnumDisabled PasswordAuthEnum = "Disabled" + PasswordAuthEnumEnabled PasswordAuthEnum = "Enabled" +) + +func PossibleValuesForPasswordAuthEnum() []string { + return []string{ + string(PasswordAuthEnumDisabled), + string(PasswordAuthEnumEnabled), + } +} + +func parsePasswordAuthEnum(input string) (*PasswordAuthEnum, error) { + vals := map[string]PasswordAuthEnum{ + "disabled": PasswordAuthEnumDisabled, + "enabled": PasswordAuthEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PasswordAuthEnum(input) + return &out, nil +} + +type ReplicationRole string + +const ( + ReplicationRoleAsyncReplica ReplicationRole = "AsyncReplica" + ReplicationRoleGeoAsyncReplica ReplicationRole = "GeoAsyncReplica" + ReplicationRoleGeoSyncReplica ReplicationRole = "GeoSyncReplica" + ReplicationRoleNone ReplicationRole = "None" + ReplicationRolePrimary ReplicationRole = "Primary" + ReplicationRoleSecondary ReplicationRole = "Secondary" + ReplicationRoleSyncReplica ReplicationRole = "SyncReplica" + ReplicationRoleWalReplica ReplicationRole = "WalReplica" +) + +func PossibleValuesForReplicationRole() []string { + return []string{ + string(ReplicationRoleAsyncReplica), + string(ReplicationRoleGeoAsyncReplica), + string(ReplicationRoleGeoSyncReplica), + string(ReplicationRoleNone), + string(ReplicationRolePrimary), + string(ReplicationRoleSecondary), + string(ReplicationRoleSyncReplica), + string(ReplicationRoleWalReplica), + } +} + +func parseReplicationRole(input string) (*ReplicationRole, error) { + vals := map[string]ReplicationRole{ + "asyncreplica": ReplicationRoleAsyncReplica, + "geoasyncreplica": ReplicationRoleGeoAsyncReplica, + "geosyncreplica": ReplicationRoleGeoSyncReplica, + "none": ReplicationRoleNone, + "primary": ReplicationRolePrimary, + "secondary": ReplicationRoleSecondary, + "syncreplica": ReplicationRoleSyncReplica, + "walreplica": ReplicationRoleWalReplica, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ReplicationRole(input) + return &out, nil +} + +type ServerHAState string + +const ( + ServerHAStateCreatingStandby ServerHAState = "CreatingStandby" + ServerHAStateFailingOver ServerHAState = "FailingOver" + ServerHAStateHealthy ServerHAState = "Healthy" + ServerHAStateNotEnabled ServerHAState = "NotEnabled" + ServerHAStateRemovingStandby ServerHAState = "RemovingStandby" + ServerHAStateReplicatingData ServerHAState = "ReplicatingData" +) + +func PossibleValuesForServerHAState() []string { + return []string{ + string(ServerHAStateCreatingStandby), + string(ServerHAStateFailingOver), + string(ServerHAStateHealthy), + string(ServerHAStateNotEnabled), + string(ServerHAStateRemovingStandby), + string(ServerHAStateReplicatingData), + } +} + +func parseServerHAState(input string) (*ServerHAState, error) { + vals := map[string]ServerHAState{ + "creatingstandby": ServerHAStateCreatingStandby, + "failingover": ServerHAStateFailingOver, + "healthy": ServerHAStateHealthy, + "notenabled": ServerHAStateNotEnabled, + "removingstandby": ServerHAStateRemovingStandby, + "replicatingdata": ServerHAStateReplicatingData, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerHAState(input) + return &out, nil +} + +type ServerPublicNetworkAccessState string + +const ( + ServerPublicNetworkAccessStateDisabled ServerPublicNetworkAccessState = "Disabled" + ServerPublicNetworkAccessStateEnabled ServerPublicNetworkAccessState = "Enabled" +) + +func PossibleValuesForServerPublicNetworkAccessState() []string { + return []string{ + string(ServerPublicNetworkAccessStateDisabled), + string(ServerPublicNetworkAccessStateEnabled), + } +} + +func parseServerPublicNetworkAccessState(input string) (*ServerPublicNetworkAccessState, error) { + vals := map[string]ServerPublicNetworkAccessState{ + "disabled": ServerPublicNetworkAccessStateDisabled, + "enabled": ServerPublicNetworkAccessStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerPublicNetworkAccessState(input) + return &out, nil +} + +type ServerState string + +const ( + ServerStateDisabled ServerState = "Disabled" + ServerStateDropping ServerState = "Dropping" + ServerStateReady ServerState = "Ready" + ServerStateStarting ServerState = "Starting" + ServerStateStopped ServerState = "Stopped" + ServerStateStopping ServerState = "Stopping" + ServerStateUpdating ServerState = "Updating" +) + +func PossibleValuesForServerState() []string { + return []string{ + string(ServerStateDisabled), + string(ServerStateDropping), + string(ServerStateReady), + string(ServerStateStarting), + string(ServerStateStopped), + string(ServerStateStopping), + string(ServerStateUpdating), + } +} + +func parseServerState(input string) (*ServerState, error) { + vals := map[string]ServerState{ + "disabled": ServerStateDisabled, + "dropping": ServerStateDropping, + "ready": ServerStateReady, + "starting": ServerStateStarting, + "stopped": ServerStateStopped, + "stopping": ServerStateStopping, + "updating": ServerStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerState(input) + return &out, nil +} + +type ServerVersion string + +const ( + ServerVersionOneFour ServerVersion = "14" + ServerVersionOneOne ServerVersion = "11" + ServerVersionOneThree ServerVersion = "13" + ServerVersionOneTwo ServerVersion = "12" +) + +func PossibleValuesForServerVersion() []string { + return []string{ + string(ServerVersionOneFour), + string(ServerVersionOneOne), + string(ServerVersionOneThree), + string(ServerVersionOneTwo), + } +} + +func parseServerVersion(input string) (*ServerVersion, error) { + vals := map[string]ServerVersion{ + "14": ServerVersionOneFour, + "11": ServerVersionOneOne, + "13": ServerVersionOneThree, + "12": ServerVersionOneTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerVersion(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBurstable SkuTier = "Burstable" + SkuTierGeneralPurpose SkuTier = "GeneralPurpose" + SkuTierMemoryOptimized SkuTier = "MemoryOptimized" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBurstable), + string(SkuTierGeneralPurpose), + string(SkuTierMemoryOptimized), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "burstable": SkuTierBurstable, + "generalpurpose": SkuTierGeneralPurpose, + "memoryoptimized": SkuTierMemoryOptimized, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/id_flexibleserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/id_flexibleserver.go new file mode 100644 index 000000000000..0d97c2c923f5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/id_flexibleserver.go @@ -0,0 +1,124 @@ +package servers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FlexibleServerId{} + +// FlexibleServerId is a struct representing the Resource ID for a Flexible Server +type FlexibleServerId struct { + SubscriptionId string + ResourceGroupName string + FlexibleServerName string +} + +// NewFlexibleServerID returns a new FlexibleServerId struct +func NewFlexibleServerID(subscriptionId string, resourceGroupName string, flexibleServerName string) FlexibleServerId { + return FlexibleServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FlexibleServerName: flexibleServerName, + } +} + +// ParseFlexibleServerID parses 'input' into a FlexibleServerId +func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFlexibleServerIDInsensitively parses 'input' case-insensitively into a FlexibleServerId +// note: this method should only be used for API response data and not user input +func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { + return nil, fmt.Errorf("the segment 'flexibleServerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID +func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFlexibleServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Flexible Server ID +func (id FlexibleServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FlexibleServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID +func (id FlexibleServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), + resourceids.UserSpecifiedSegment("flexibleServerName", "flexibleServerValue"), + } +} + +// String returns a human-readable description of this Flexible Server ID +func (id FlexibleServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Flexible Server Name: %q", id.FlexibleServerName), + } + return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/method_create_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/method_create_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/method_create_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/method_delete_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/method_delete_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/method_delete_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/method_get_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/method_get_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/method_get_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/method_list_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/method_list_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/method_list_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/method_listbyresourcegroup_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/method_listbyresourcegroup_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/method_listbyresourcegroup_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/method_update_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/method_update_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/method_update_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_authconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_authconfig.go new file mode 100644 index 000000000000..82537c38df06 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_authconfig.go @@ -0,0 +1,10 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthConfig struct { + ActiveDirectoryAuth *ActiveDirectoryAuthEnum `json:"activeDirectoryAuth,omitempty"` + PasswordAuth *PasswordAuthEnum `json:"passwordAuth,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_backup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_backup.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_backup.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_backup.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_dataencryption.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_dataencryption.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_dataencryption.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_dataencryption.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_highavailability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_highavailability.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_highavailability.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_highavailability.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_maintenancewindow.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_maintenancewindow.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_maintenancewindow.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_maintenancewindow.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_network.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_network.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_network.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_network.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_server.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_server.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_server.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_server.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_serverforupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_serverforupdate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_serverforupdate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_serverforupdate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_serverproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_serverproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_serverproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_serverproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_serverpropertiesforupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_serverpropertiesforupdate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_serverpropertiesforupdate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_serverpropertiesforupdate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_sku.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_sku.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_sku.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_storage.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_storage.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_storage.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_storage.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_userassignedidentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_userassignedidentity.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_userassignedidentity.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_userassignedidentity.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_useridentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_useridentity.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/model_useridentity.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/model_useridentity.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/version.go new file mode 100644 index 000000000000..f3617dc2b189 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers/version.go @@ -0,0 +1,12 @@ +package servers + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/servers/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/README.md index b94262482b75..4f30f232e603 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/README.md @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := capacities.NewCapacityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedCapacityValue") +id := capacities.NewCapacityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityValue") payload := capacities.DedicatedCapacity{ // ... @@ -62,7 +62,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := capacities.NewCapacityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedCapacityValue") +id := capacities.NewCapacityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -74,7 +74,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := capacities.NewCapacityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedCapacityValue") +id := capacities.NewCapacityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityValue") read, err := client.GetDetails(ctx, id) if err != nil { @@ -122,7 +122,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := capacities.NewCapacityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedCapacityValue") +id := capacities.NewCapacityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityValue") read, err := client.ListSkusForCapacity(ctx, id) if err != nil { @@ -138,7 +138,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := capacities.NewCapacityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedCapacityValue") +id := capacities.NewCapacityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityValue") if err := client.ResumeThenPoll(ctx, id); err != nil { // handle the error @@ -150,7 +150,7 @@ if err := client.ResumeThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := capacities.NewCapacityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedCapacityValue") +id := capacities.NewCapacityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityValue") if err := client.SuspendThenPoll(ctx, id); err != nil { // handle the error @@ -162,7 +162,7 @@ if err := client.SuspendThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := capacities.NewCapacityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedCapacityValue") +id := capacities.NewCapacityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityValue") payload := capacities.DedicatedCapacityUpdateParameters{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/id_capacity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/id_capacity.go index 76d6000b47d4..2f27379c0ebb 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/id_capacity.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/id_capacity.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = CapacityId{} // CapacityId is a struct representing the Resource ID for a Capacity type CapacityId struct { - SubscriptionId string - ResourceGroupName string - DedicatedCapacityName string + SubscriptionId string + ResourceGroupName string + CapacityName string } // NewCapacityID returns a new CapacityId struct -func NewCapacityID(subscriptionId string, resourceGroupName string, dedicatedCapacityName string) CapacityId { +func NewCapacityID(subscriptionId string, resourceGroupName string, capacityName string) CapacityId { return CapacityId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - DedicatedCapacityName: dedicatedCapacityName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CapacityName: capacityName, } } @@ -44,8 +44,8 @@ func ParseCapacityID(input string) (*CapacityId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.DedicatedCapacityName, ok = parsed.Parsed["dedicatedCapacityName"]; !ok { - return nil, fmt.Errorf("the segment 'dedicatedCapacityName' was not found in the resource id %q", input) + if id.CapacityName, ok = parsed.Parsed["capacityName"]; !ok { + return nil, fmt.Errorf("the segment 'capacityName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseCapacityIDInsensitively(input string) (*CapacityId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.DedicatedCapacityName, ok = parsed.Parsed["dedicatedCapacityName"]; !ok { - return nil, fmt.Errorf("the segment 'dedicatedCapacityName' was not found in the resource id %q", input) + if id.CapacityName, ok = parsed.Parsed["capacityName"]; !ok { + return nil, fmt.Errorf("the segment 'capacityName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateCapacityID(input interface{}, key string) (warnings []string, error // ID returns the formatted Capacity ID func (id CapacityId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.PowerBIDedicated/capacities/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DedicatedCapacityName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CapacityName) } // Segments returns a slice of Resource ID Segments which comprise this Capacity ID @@ -109,7 +109,7 @@ func (id CapacityId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftPowerBIDedicated", "Microsoft.PowerBIDedicated", "Microsoft.PowerBIDedicated"), resourceids.StaticSegment("staticCapacities", "capacities", "capacities"), - resourceids.UserSpecifiedSegment("dedicatedCapacityName", "dedicatedCapacityValue"), + resourceids.UserSpecifiedSegment("capacityName", "capacityValue"), } } @@ -118,7 +118,7 @@ func (id CapacityId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Dedicated Capacity Name: %q", id.DedicatedCapacityName), + fmt.Sprintf("Capacity Name: %q", id.CapacityName), } return fmt.Sprintf("Capacity (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/id_location.go index 5323abb2c4ce..e226a3f01dac 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/id_location.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/id_location.go @@ -12,14 +12,14 @@ var _ resourceids.ResourceId = LocationId{} // LocationId is a struct representing the Resource ID for a Location type LocationId struct { SubscriptionId string - Location string + LocationName string } // NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { +func NewLocationID(subscriptionId string, locationName string) LocationId { return LocationId{ SubscriptionId: subscriptionId, - Location: location, + LocationName: locationName, } } @@ -38,8 +38,8 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.PowerBIDedicated/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } // Segments returns a slice of Resource ID Segments which comprise this Location ID @@ -97,7 +97,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftPowerBIDedicated", "Microsoft.PowerBIDedicated", "Microsoft.PowerBIDedicated"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), } } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { func (id LocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), } return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/README.md index 5a0ca0b97ae4..d209dbc6ab0f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := privatezones.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue") +id := privatezones.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateDnsZoneValue") payload := privatezones.PrivateZone{ // ... @@ -41,7 +41,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload, privatezones.DefaultCr ```go ctx := context.TODO() -id := privatezones.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue") +id := privatezones.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateDnsZoneValue") if err := client.DeleteThenPoll(ctx, id, privatezones.DefaultDeleteOperationOptions()); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id, privatezones.DefaultDeleteOperationOpti ```go ctx := context.TODO() -id := privatezones.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue") +id := privatezones.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateDnsZoneValue") read, err := client.Get(ctx, id) if err != nil { @@ -103,7 +103,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := privatezones.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue") +id := privatezones.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateDnsZoneValue") payload := privatezones.PrivateZone{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/id_privatednszone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/id_privatednszone.go index a1018e5d2429..886ca1e9f157 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/id_privatednszone.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/id_privatednszone.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = PrivateDnsZoneId{} // PrivateDnsZoneId is a struct representing the Resource ID for a Private Dns Zone type PrivateDnsZoneId struct { - SubscriptionId string - ResourceGroupName string - PrivateZoneName string + SubscriptionId string + ResourceGroupName string + PrivateDnsZoneName string } // NewPrivateDnsZoneID returns a new PrivateDnsZoneId struct -func NewPrivateDnsZoneID(subscriptionId string, resourceGroupName string, privateZoneName string) PrivateDnsZoneId { +func NewPrivateDnsZoneID(subscriptionId string, resourceGroupName string, privateDnsZoneName string) PrivateDnsZoneId { return PrivateDnsZoneId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - PrivateZoneName: privateZoneName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + PrivateDnsZoneName: privateDnsZoneName, } } @@ -44,8 +44,8 @@ func ParsePrivateDnsZoneID(input string) (*PrivateDnsZoneId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { - return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) + if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'privateDnsZoneName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParsePrivateDnsZoneIDInsensitively(input string) (*PrivateDnsZoneId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { - return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) + if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'privateDnsZoneName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidatePrivateDnsZoneID(input interface{}, key string) (warnings []string, // ID returns the formatted Private Dns Zone ID func (id PrivateDnsZoneId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateZoneName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateDnsZoneName) } // Segments returns a slice of Resource ID Segments which comprise this Private Dns Zone ID @@ -109,7 +109,7 @@ func (id PrivateDnsZoneId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), resourceids.StaticSegment("staticPrivateDnsZones", "privateDnsZones", "privateDnsZones"), - resourceids.UserSpecifiedSegment("privateZoneName", "privateZoneValue"), + resourceids.UserSpecifiedSegment("privateDnsZoneName", "privateDnsZoneValue"), } } @@ -118,7 +118,7 @@ func (id PrivateDnsZoneId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Private Zone Name: %q", id.PrivateZoneName), + fmt.Sprintf("Private Dns Zone Name: %q", id.PrivateDnsZoneName), } return fmt.Sprintf("Private Dns Zone (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/README.md index 95d148f6de80..b1d2448791a5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "A", "relativeRecordSetValue") +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateDnsZoneValue", "A", "relativeRecordSetValue") payload := recordsets.RecordSet{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "A", "relativeRecordSetValue") +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateDnsZoneValue", "A", "relativeRecordSetValue") read, err := client.Delete(ctx, id, recordsets.DefaultDeleteOperationOptions()) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "A", "relativeRecordSetValue") +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateDnsZoneValue", "A", "relativeRecordSetValue") read, err := client.Get(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := recordsets.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue") +id := recordsets.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateDnsZoneValue") // alternatively `client.List(ctx, id, recordsets.DefaultListOperationOptions())` can be used to do batched pagination items, err := client.ListComplete(ctx, id, recordsets.DefaultListOperationOptions()) @@ -94,7 +94,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := recordsets.NewPrivateZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "A") +id := recordsets.NewPrivateZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateDnsZoneValue", "A") // alternatively `client.ListByType(ctx, id, recordsets.DefaultListByTypeOperationOptions())` can be used to do batched pagination items, err := client.ListByTypeComplete(ctx, id, recordsets.DefaultListByTypeOperationOptions()) @@ -111,7 +111,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "A", "relativeRecordSetValue") +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateDnsZoneValue", "A", "relativeRecordSetValue") payload := recordsets.RecordSet{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_privatednszone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_privatednszone.go index 3b9d6101dd73..e02af58b859a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_privatednszone.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_privatednszone.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = PrivateDnsZoneId{} // PrivateDnsZoneId is a struct representing the Resource ID for a Private Dns Zone type PrivateDnsZoneId struct { - SubscriptionId string - ResourceGroupName string - PrivateZoneName string + SubscriptionId string + ResourceGroupName string + PrivateDnsZoneName string } // NewPrivateDnsZoneID returns a new PrivateDnsZoneId struct -func NewPrivateDnsZoneID(subscriptionId string, resourceGroupName string, privateZoneName string) PrivateDnsZoneId { +func NewPrivateDnsZoneID(subscriptionId string, resourceGroupName string, privateDnsZoneName string) PrivateDnsZoneId { return PrivateDnsZoneId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - PrivateZoneName: privateZoneName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + PrivateDnsZoneName: privateDnsZoneName, } } @@ -44,8 +44,8 @@ func ParsePrivateDnsZoneID(input string) (*PrivateDnsZoneId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { - return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) + if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'privateDnsZoneName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParsePrivateDnsZoneIDInsensitively(input string) (*PrivateDnsZoneId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { - return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) + if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'privateDnsZoneName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidatePrivateDnsZoneID(input interface{}, key string) (warnings []string, // ID returns the formatted Private Dns Zone ID func (id PrivateDnsZoneId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateZoneName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateDnsZoneName) } // Segments returns a slice of Resource ID Segments which comprise this Private Dns Zone ID @@ -109,7 +109,7 @@ func (id PrivateDnsZoneId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), resourceids.StaticSegment("staticPrivateDnsZones", "privateDnsZones", "privateDnsZones"), - resourceids.UserSpecifiedSegment("privateZoneName", "privateZoneValue"), + resourceids.UserSpecifiedSegment("privateDnsZoneName", "privateDnsZoneValue"), } } @@ -118,7 +118,7 @@ func (id PrivateDnsZoneId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Private Zone Name: %q", id.PrivateZoneName), + fmt.Sprintf("Private Dns Zone Name: %q", id.PrivateDnsZoneName), } return fmt.Sprintf("Private Dns Zone (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_privatezone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_privatezone.go index ec29176c9af3..8d77c735931e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_privatezone.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_privatezone.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = PrivateZoneId{} // PrivateZoneId is a struct representing the Resource ID for a Private Zone type PrivateZoneId struct { - SubscriptionId string - ResourceGroupName string - PrivateZoneName string - RecordType RecordType + SubscriptionId string + ResourceGroupName string + PrivateDnsZoneName string + RecordType RecordType } // NewPrivateZoneID returns a new PrivateZoneId struct -func NewPrivateZoneID(subscriptionId string, resourceGroupName string, privateZoneName string, recordType RecordType) PrivateZoneId { +func NewPrivateZoneID(subscriptionId string, resourceGroupName string, privateDnsZoneName string, recordType RecordType) PrivateZoneId { return PrivateZoneId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - PrivateZoneName: privateZoneName, - RecordType: recordType, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + PrivateDnsZoneName: privateDnsZoneName, + RecordType: recordType, } } @@ -46,8 +46,8 @@ func ParsePrivateZoneID(input string) (*PrivateZoneId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { - return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) + if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'privateDnsZoneName' was not found in the resource id %q", input) } if v, ok := parsed.Parsed["recordType"]; true { @@ -85,8 +85,8 @@ func ParsePrivateZoneIDInsensitively(input string) (*PrivateZoneId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { - return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) + if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'privateDnsZoneName' was not found in the resource id %q", input) } if v, ok := parsed.Parsed["recordType"]; true { @@ -122,7 +122,7 @@ func ValidatePrivateZoneID(input interface{}, key string) (warnings []string, er // ID returns the formatted Private Zone ID func (id PrivateZoneId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateZoneName, string(id.RecordType)) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateDnsZoneName, string(id.RecordType)) } // Segments returns a slice of Resource ID Segments which comprise this Private Zone ID @@ -135,7 +135,7 @@ func (id PrivateZoneId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), resourceids.StaticSegment("staticPrivateDnsZones", "privateDnsZones", "privateDnsZones"), - resourceids.UserSpecifiedSegment("privateZoneName", "privateZoneValue"), + resourceids.UserSpecifiedSegment("privateDnsZoneName", "privateDnsZoneValue"), resourceids.ConstantSegment("recordType", PossibleValuesForRecordType(), "A"), } } @@ -145,7 +145,7 @@ func (id PrivateZoneId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Private Zone Name: %q", id.PrivateZoneName), + fmt.Sprintf("Private Dns Zone Name: %q", id.PrivateDnsZoneName), fmt.Sprintf("Record Type: %q", string(id.RecordType)), } return fmt.Sprintf("Private Zone (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_recordtype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_recordtype.go index 8f383503c102..ef180815e6d4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_recordtype.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_recordtype.go @@ -13,17 +13,17 @@ var _ resourceids.ResourceId = RecordTypeId{} type RecordTypeId struct { SubscriptionId string ResourceGroupName string - PrivateZoneName string + PrivateDnsZoneName string RecordType RecordType RelativeRecordSetName string } // NewRecordTypeID returns a new RecordTypeId struct -func NewRecordTypeID(subscriptionId string, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string) RecordTypeId { +func NewRecordTypeID(subscriptionId string, resourceGroupName string, privateDnsZoneName string, recordType RecordType, relativeRecordSetName string) RecordTypeId { return RecordTypeId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - PrivateZoneName: privateZoneName, + PrivateDnsZoneName: privateDnsZoneName, RecordType: recordType, RelativeRecordSetName: relativeRecordSetName, } @@ -48,8 +48,8 @@ func ParseRecordTypeID(input string) (*RecordTypeId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { - return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) + if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'privateDnsZoneName' was not found in the resource id %q", input) } if v, ok := parsed.Parsed["recordType"]; true { @@ -91,8 +91,8 @@ func ParseRecordTypeIDInsensitively(input string) (*RecordTypeId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { - return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) + if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'privateDnsZoneName' was not found in the resource id %q", input) } if v, ok := parsed.Parsed["recordType"]; true { @@ -132,7 +132,7 @@ func ValidateRecordTypeID(input interface{}, key string) (warnings []string, err // ID returns the formatted Record Type ID func (id RecordTypeId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s/%s/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateZoneName, string(id.RecordType), id.RelativeRecordSetName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateDnsZoneName, string(id.RecordType), id.RelativeRecordSetName) } // Segments returns a slice of Resource ID Segments which comprise this Record Type ID @@ -145,7 +145,7 @@ func (id RecordTypeId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), resourceids.StaticSegment("staticPrivateDnsZones", "privateDnsZones", "privateDnsZones"), - resourceids.UserSpecifiedSegment("privateZoneName", "privateZoneValue"), + resourceids.UserSpecifiedSegment("privateDnsZoneName", "privateDnsZoneValue"), resourceids.ConstantSegment("recordType", PossibleValuesForRecordType(), "A"), resourceids.UserSpecifiedSegment("relativeRecordSetName", "relativeRecordSetValue"), } @@ -156,7 +156,7 @@ func (id RecordTypeId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Private Zone Name: %q", id.PrivateZoneName), + fmt.Sprintf("Private Dns Zone Name: %q", id.PrivateDnsZoneName), fmt.Sprintf("Record Type: %q", string(id.RecordType)), fmt.Sprintf("Relative Record Set Name: %q", id.RelativeRecordSetName), } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/README.md index 951aa280f8de..f5c3637d97c2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := virtualnetworklinks.NewVirtualNetworkLinkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "virtualNetworkLinkValue") +id := virtualnetworklinks.NewVirtualNetworkLinkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateDnsZoneValue", "virtualNetworkLinkValue") payload := virtualnetworklinks.VirtualNetworkLink{ // ... @@ -41,7 +41,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload, virtualnetworklinks.De ```go ctx := context.TODO() -id := virtualnetworklinks.NewVirtualNetworkLinkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "virtualNetworkLinkValue") +id := virtualnetworklinks.NewVirtualNetworkLinkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateDnsZoneValue", "virtualNetworkLinkValue") if err := client.DeleteThenPoll(ctx, id, virtualnetworklinks.DefaultDeleteOperationOptions()); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id, virtualnetworklinks.DefaultDeleteOperat ```go ctx := context.TODO() -id := virtualnetworklinks.NewVirtualNetworkLinkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "virtualNetworkLinkValue") +id := virtualnetworklinks.NewVirtualNetworkLinkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateDnsZoneValue", "virtualNetworkLinkValue") read, err := client.Get(ctx, id) if err != nil { @@ -69,7 +69,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := virtualnetworklinks.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue") +id := virtualnetworklinks.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateDnsZoneValue") // alternatively `client.List(ctx, id, virtualnetworklinks.DefaultListOperationOptions())` can be used to do batched pagination items, err := client.ListComplete(ctx, id, virtualnetworklinks.DefaultListOperationOptions()) @@ -86,7 +86,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := virtualnetworklinks.NewVirtualNetworkLinkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "virtualNetworkLinkValue") +id := virtualnetworklinks.NewVirtualNetworkLinkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateDnsZoneValue", "virtualNetworkLinkValue") payload := virtualnetworklinks.VirtualNetworkLink{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/id_privatednszone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/id_privatednszone.go index 02abc256d444..825b00056d21 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/id_privatednszone.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/id_privatednszone.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = PrivateDnsZoneId{} // PrivateDnsZoneId is a struct representing the Resource ID for a Private Dns Zone type PrivateDnsZoneId struct { - SubscriptionId string - ResourceGroupName string - PrivateZoneName string + SubscriptionId string + ResourceGroupName string + PrivateDnsZoneName string } // NewPrivateDnsZoneID returns a new PrivateDnsZoneId struct -func NewPrivateDnsZoneID(subscriptionId string, resourceGroupName string, privateZoneName string) PrivateDnsZoneId { +func NewPrivateDnsZoneID(subscriptionId string, resourceGroupName string, privateDnsZoneName string) PrivateDnsZoneId { return PrivateDnsZoneId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - PrivateZoneName: privateZoneName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + PrivateDnsZoneName: privateDnsZoneName, } } @@ -44,8 +44,8 @@ func ParsePrivateDnsZoneID(input string) (*PrivateDnsZoneId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { - return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) + if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'privateDnsZoneName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParsePrivateDnsZoneIDInsensitively(input string) (*PrivateDnsZoneId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { - return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) + if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'privateDnsZoneName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidatePrivateDnsZoneID(input interface{}, key string) (warnings []string, // ID returns the formatted Private Dns Zone ID func (id PrivateDnsZoneId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateZoneName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateDnsZoneName) } // Segments returns a slice of Resource ID Segments which comprise this Private Dns Zone ID @@ -109,7 +109,7 @@ func (id PrivateDnsZoneId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), resourceids.StaticSegment("staticPrivateDnsZones", "privateDnsZones", "privateDnsZones"), - resourceids.UserSpecifiedSegment("privateZoneName", "privateZoneValue"), + resourceids.UserSpecifiedSegment("privateDnsZoneName", "privateDnsZoneValue"), } } @@ -118,7 +118,7 @@ func (id PrivateDnsZoneId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Private Zone Name: %q", id.PrivateZoneName), + fmt.Sprintf("Private Dns Zone Name: %q", id.PrivateDnsZoneName), } return fmt.Sprintf("Private Dns Zone (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/id_virtualnetworklink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/id_virtualnetworklink.go index 192d882374ed..570420266743 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/id_virtualnetworklink.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/id_virtualnetworklink.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = VirtualNetworkLinkId{} type VirtualNetworkLinkId struct { SubscriptionId string ResourceGroupName string - PrivateZoneName string + PrivateDnsZoneName string VirtualNetworkLinkName string } // NewVirtualNetworkLinkID returns a new VirtualNetworkLinkId struct -func NewVirtualNetworkLinkID(subscriptionId string, resourceGroupName string, privateZoneName string, virtualNetworkLinkName string) VirtualNetworkLinkId { +func NewVirtualNetworkLinkID(subscriptionId string, resourceGroupName string, privateDnsZoneName string, virtualNetworkLinkName string) VirtualNetworkLinkId { return VirtualNetworkLinkId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - PrivateZoneName: privateZoneName, + PrivateDnsZoneName: privateDnsZoneName, VirtualNetworkLinkName: virtualNetworkLinkName, } } @@ -46,8 +46,8 @@ func ParseVirtualNetworkLinkID(input string) (*VirtualNetworkLinkId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { - return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) + if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'privateDnsZoneName' was not found in the resource id %q", input) } if id.VirtualNetworkLinkName, ok = parsed.Parsed["virtualNetworkLinkName"]; !ok { @@ -77,8 +77,8 @@ func ParseVirtualNetworkLinkIDInsensitively(input string) (*VirtualNetworkLinkId return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { - return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) + if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'privateDnsZoneName' was not found in the resource id %q", input) } if id.VirtualNetworkLinkName, ok = parsed.Parsed["virtualNetworkLinkName"]; !ok { @@ -106,7 +106,7 @@ func ValidateVirtualNetworkLinkID(input interface{}, key string) (warnings []str // ID returns the formatted Virtual Network Link ID func (id VirtualNetworkLinkId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s/virtualNetworkLinks/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateZoneName, id.VirtualNetworkLinkName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateDnsZoneName, id.VirtualNetworkLinkName) } // Segments returns a slice of Resource ID Segments which comprise this Virtual Network Link ID @@ -119,7 +119,7 @@ func (id VirtualNetworkLinkId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), resourceids.StaticSegment("staticPrivateDnsZones", "privateDnsZones", "privateDnsZones"), - resourceids.UserSpecifiedSegment("privateZoneName", "privateZoneValue"), + resourceids.UserSpecifiedSegment("privateDnsZoneName", "privateDnsZoneValue"), resourceids.StaticSegment("staticVirtualNetworkLinks", "virtualNetworkLinks", "virtualNetworkLinks"), resourceids.UserSpecifiedSegment("virtualNetworkLinkName", "virtualNetworkLinkValue"), } @@ -130,7 +130,7 @@ func (id VirtualNetworkLinkId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Private Zone Name: %q", id.PrivateZoneName), + fmt.Sprintf("Private Dns Zone Name: %q", id.PrivateDnsZoneName), fmt.Sprintf("Virtual Network Link Name: %q", id.VirtualNetworkLinkName), } return fmt.Sprintf("Virtual Network Link (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/README.md new file mode 100644 index 000000000000..09cb3a6cb0d1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/README.md @@ -0,0 +1,120 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults` Documentation + +The `vaults` SDK allows for interaction with the Azure Resource Manager Service `recoveryservices` (API Version `2022-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults" +``` + + +### Client Initialization + +```go +client := vaults.NewVaultsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VaultsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := vaults.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +payload := vaults.Vault{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VaultsClient.Delete` + +```go +ctx := context.TODO() +id := vaults.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VaultsClient.Get` + +```go +ctx := context.TODO() +id := vaults.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VaultsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := vaults.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VaultsClient.ListBySubscriptionId` + +```go +ctx := context.TODO() +id := vaults.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscriptionId(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionIdComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VaultsClient.Update` + +```go +ctx := context.TODO() +id := vaults.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +payload := vaults.PatchVault{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/client.go new file mode 100644 index 000000000000..6cad2ef703e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/client.go @@ -0,0 +1,18 @@ +package vaults + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultsClient struct { + Client autorest.Client + baseUri string +} + +func NewVaultsClientWithBaseURI(endpoint string) VaultsClient { + return VaultsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/constants.go new file mode 100644 index 000000000000..d7ee6c37f32e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/constants.go @@ -0,0 +1,480 @@ +package vaults + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AlertsState string + +const ( + AlertsStateDisabled AlertsState = "Disabled" + AlertsStateEnabled AlertsState = "Enabled" +) + +func PossibleValuesForAlertsState() []string { + return []string{ + string(AlertsStateDisabled), + string(AlertsStateEnabled), + } +} + +func parseAlertsState(input string) (*AlertsState, error) { + vals := map[string]AlertsState{ + "disabled": AlertsStateDisabled, + "enabled": AlertsStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AlertsState(input) + return &out, nil +} + +type BackupStorageVersion string + +const ( + BackupStorageVersionUnassigned BackupStorageVersion = "Unassigned" + BackupStorageVersionVOne BackupStorageVersion = "V1" + BackupStorageVersionVTwo BackupStorageVersion = "V2" +) + +func PossibleValuesForBackupStorageVersion() []string { + return []string{ + string(BackupStorageVersionUnassigned), + string(BackupStorageVersionVOne), + string(BackupStorageVersionVTwo), + } +} + +func parseBackupStorageVersion(input string) (*BackupStorageVersion, error) { + vals := map[string]BackupStorageVersion{ + "unassigned": BackupStorageVersionUnassigned, + "v1": BackupStorageVersionVOne, + "v2": BackupStorageVersionVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BackupStorageVersion(input) + return &out, nil +} + +type CrossRegionRestore string + +const ( + CrossRegionRestoreDisabled CrossRegionRestore = "Disabled" + CrossRegionRestoreEnabled CrossRegionRestore = "Enabled" +) + +func PossibleValuesForCrossRegionRestore() []string { + return []string{ + string(CrossRegionRestoreDisabled), + string(CrossRegionRestoreEnabled), + } +} + +func parseCrossRegionRestore(input string) (*CrossRegionRestore, error) { + vals := map[string]CrossRegionRestore{ + "disabled": CrossRegionRestoreDisabled, + "enabled": CrossRegionRestoreEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CrossRegionRestore(input) + return &out, nil +} + +type ImmutabilityState string + +const ( + ImmutabilityStateDisabled ImmutabilityState = "Disabled" + ImmutabilityStateLocked ImmutabilityState = "Locked" + ImmutabilityStateUnlocked ImmutabilityState = "Unlocked" +) + +func PossibleValuesForImmutabilityState() []string { + return []string{ + string(ImmutabilityStateDisabled), + string(ImmutabilityStateLocked), + string(ImmutabilityStateUnlocked), + } +} + +func parseImmutabilityState(input string) (*ImmutabilityState, error) { + vals := map[string]ImmutabilityState{ + "disabled": ImmutabilityStateDisabled, + "locked": ImmutabilityStateLocked, + "unlocked": ImmutabilityStateUnlocked, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ImmutabilityState(input) + return &out, nil +} + +type InfrastructureEncryptionState string + +const ( + InfrastructureEncryptionStateDisabled InfrastructureEncryptionState = "Disabled" + InfrastructureEncryptionStateEnabled InfrastructureEncryptionState = "Enabled" +) + +func PossibleValuesForInfrastructureEncryptionState() []string { + return []string{ + string(InfrastructureEncryptionStateDisabled), + string(InfrastructureEncryptionStateEnabled), + } +} + +func parseInfrastructureEncryptionState(input string) (*InfrastructureEncryptionState, error) { + vals := map[string]InfrastructureEncryptionState{ + "disabled": InfrastructureEncryptionStateDisabled, + "enabled": InfrastructureEncryptionStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InfrastructureEncryptionState(input) + return &out, nil +} + +type PrivateEndpointConnectionStatus string + +const ( + PrivateEndpointConnectionStatusApproved PrivateEndpointConnectionStatus = "Approved" + PrivateEndpointConnectionStatusDisconnected PrivateEndpointConnectionStatus = "Disconnected" + PrivateEndpointConnectionStatusPending PrivateEndpointConnectionStatus = "Pending" + PrivateEndpointConnectionStatusRejected PrivateEndpointConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointConnectionStatus() []string { + return []string{ + string(PrivateEndpointConnectionStatusApproved), + string(PrivateEndpointConnectionStatusDisconnected), + string(PrivateEndpointConnectionStatusPending), + string(PrivateEndpointConnectionStatusRejected), + } +} + +func parsePrivateEndpointConnectionStatus(input string) (*PrivateEndpointConnectionStatus, error) { + vals := map[string]PrivateEndpointConnectionStatus{ + "approved": PrivateEndpointConnectionStatusApproved, + "disconnected": PrivateEndpointConnectionStatusDisconnected, + "pending": PrivateEndpointConnectionStatusPending, + "rejected": PrivateEndpointConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStatePending ProvisioningState = "Pending" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStatePending), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "pending": ProvisioningStatePending, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} + +type ResourceMoveState string + +const ( + ResourceMoveStateCommitFailed ResourceMoveState = "CommitFailed" + ResourceMoveStateCommitTimedout ResourceMoveState = "CommitTimedout" + ResourceMoveStateCriticalFailure ResourceMoveState = "CriticalFailure" + ResourceMoveStateFailure ResourceMoveState = "Failure" + ResourceMoveStateInProgress ResourceMoveState = "InProgress" + ResourceMoveStateMoveSucceeded ResourceMoveState = "MoveSucceeded" + ResourceMoveStatePartialSuccess ResourceMoveState = "PartialSuccess" + ResourceMoveStatePrepareFailed ResourceMoveState = "PrepareFailed" + ResourceMoveStatePrepareTimedout ResourceMoveState = "PrepareTimedout" + ResourceMoveStateUnknown ResourceMoveState = "Unknown" +) + +func PossibleValuesForResourceMoveState() []string { + return []string{ + string(ResourceMoveStateCommitFailed), + string(ResourceMoveStateCommitTimedout), + string(ResourceMoveStateCriticalFailure), + string(ResourceMoveStateFailure), + string(ResourceMoveStateInProgress), + string(ResourceMoveStateMoveSucceeded), + string(ResourceMoveStatePartialSuccess), + string(ResourceMoveStatePrepareFailed), + string(ResourceMoveStatePrepareTimedout), + string(ResourceMoveStateUnknown), + } +} + +func parseResourceMoveState(input string) (*ResourceMoveState, error) { + vals := map[string]ResourceMoveState{ + "commitfailed": ResourceMoveStateCommitFailed, + "committimedout": ResourceMoveStateCommitTimedout, + "criticalfailure": ResourceMoveStateCriticalFailure, + "failure": ResourceMoveStateFailure, + "inprogress": ResourceMoveStateInProgress, + "movesucceeded": ResourceMoveStateMoveSucceeded, + "partialsuccess": ResourceMoveStatePartialSuccess, + "preparefailed": ResourceMoveStatePrepareFailed, + "preparetimedout": ResourceMoveStatePrepareTimedout, + "unknown": ResourceMoveStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceMoveState(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameRSZero SkuName = "RS0" + SkuNameStandard SkuName = "Standard" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameRSZero), + string(SkuNameStandard), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "rs0": SkuNameRSZero, + "standard": SkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} + +type StandardTierStorageRedundancy string + +const ( + StandardTierStorageRedundancyGeoRedundant StandardTierStorageRedundancy = "GeoRedundant" + StandardTierStorageRedundancyLocallyRedundant StandardTierStorageRedundancy = "LocallyRedundant" + StandardTierStorageRedundancyZoneRedundant StandardTierStorageRedundancy = "ZoneRedundant" +) + +func PossibleValuesForStandardTierStorageRedundancy() []string { + return []string{ + string(StandardTierStorageRedundancyGeoRedundant), + string(StandardTierStorageRedundancyLocallyRedundant), + string(StandardTierStorageRedundancyZoneRedundant), + } +} + +func parseStandardTierStorageRedundancy(input string) (*StandardTierStorageRedundancy, error) { + vals := map[string]StandardTierStorageRedundancy{ + "georedundant": StandardTierStorageRedundancyGeoRedundant, + "locallyredundant": StandardTierStorageRedundancyLocallyRedundant, + "zoneredundant": StandardTierStorageRedundancyZoneRedundant, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StandardTierStorageRedundancy(input) + return &out, nil +} + +type TriggerType string + +const ( + TriggerTypeForcedUpgrade TriggerType = "ForcedUpgrade" + TriggerTypeUserTriggered TriggerType = "UserTriggered" +) + +func PossibleValuesForTriggerType() []string { + return []string{ + string(TriggerTypeForcedUpgrade), + string(TriggerTypeUserTriggered), + } +} + +func parseTriggerType(input string) (*TriggerType, error) { + vals := map[string]TriggerType{ + "forcedupgrade": TriggerTypeForcedUpgrade, + "usertriggered": TriggerTypeUserTriggered, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TriggerType(input) + return &out, nil +} + +type VaultPrivateEndpointState string + +const ( + VaultPrivateEndpointStateEnabled VaultPrivateEndpointState = "Enabled" + VaultPrivateEndpointStateNone VaultPrivateEndpointState = "None" +) + +func PossibleValuesForVaultPrivateEndpointState() []string { + return []string{ + string(VaultPrivateEndpointStateEnabled), + string(VaultPrivateEndpointStateNone), + } +} + +func parseVaultPrivateEndpointState(input string) (*VaultPrivateEndpointState, error) { + vals := map[string]VaultPrivateEndpointState{ + "enabled": VaultPrivateEndpointStateEnabled, + "none": VaultPrivateEndpointStateNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VaultPrivateEndpointState(input) + return &out, nil +} + +type VaultSubResourceType string + +const ( + VaultSubResourceTypeAzureBackup VaultSubResourceType = "AzureBackup" + VaultSubResourceTypeAzureBackupSecondary VaultSubResourceType = "AzureBackup_secondary" + VaultSubResourceTypeAzureSiteRecovery VaultSubResourceType = "AzureSiteRecovery" +) + +func PossibleValuesForVaultSubResourceType() []string { + return []string{ + string(VaultSubResourceTypeAzureBackup), + string(VaultSubResourceTypeAzureBackupSecondary), + string(VaultSubResourceTypeAzureSiteRecovery), + } +} + +func parseVaultSubResourceType(input string) (*VaultSubResourceType, error) { + vals := map[string]VaultSubResourceType{ + "azurebackup": VaultSubResourceTypeAzureBackup, + "azurebackup_secondary": VaultSubResourceTypeAzureBackupSecondary, + "azuresiterecovery": VaultSubResourceTypeAzureSiteRecovery, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VaultSubResourceType(input) + return &out, nil +} + +type VaultUpgradeState string + +const ( + VaultUpgradeStateFailed VaultUpgradeState = "Failed" + VaultUpgradeStateInProgress VaultUpgradeState = "InProgress" + VaultUpgradeStateUnknown VaultUpgradeState = "Unknown" + VaultUpgradeStateUpgraded VaultUpgradeState = "Upgraded" +) + +func PossibleValuesForVaultUpgradeState() []string { + return []string{ + string(VaultUpgradeStateFailed), + string(VaultUpgradeStateInProgress), + string(VaultUpgradeStateUnknown), + string(VaultUpgradeStateUpgraded), + } +} + +func parseVaultUpgradeState(input string) (*VaultUpgradeState, error) { + vals := map[string]VaultUpgradeState{ + "failed": VaultUpgradeStateFailed, + "inprogress": VaultUpgradeStateInProgress, + "unknown": VaultUpgradeStateUnknown, + "upgraded": VaultUpgradeStateUpgraded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VaultUpgradeState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/id_vault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/id_vault.go new file mode 100644 index 000000000000..714e20b17610 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/id_vault.go @@ -0,0 +1,124 @@ +package vaults + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VaultId{} + +// VaultId is a struct representing the Resource ID for a Vault +type VaultId struct { + SubscriptionId string + ResourceGroupName string + VaultName string +} + +// NewVaultID returns a new VaultId struct +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { + return VaultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + } +} + +// ParseVaultID parses 'input' into a VaultId +func ParseVaultID(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(VaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId +// note: this method should only be used for API response data and not user input +func ParseVaultIDInsensitively(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(VaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVaultID checks that 'input' can be parsed as a Vault ID +func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Vault ID +func (id VaultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Vault ID +func (id VaultId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.StaticSegment("staticVaults", "vaults", "vaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + } +} + +// String returns a human-readable description of this Vault ID +func (id VaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + } + return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_createorupdate_autorest.go new file mode 100644 index 000000000000..42bbf10be068 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package vaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c VaultsClient) CreateOrUpdate(ctx context.Context, id VaultId, input Vault) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VaultsClient) CreateOrUpdateThenPoll(ctx context.Context, id VaultId, input Vault) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c VaultsClient) preparerForCreateOrUpdate(ctx context.Context, id VaultId, input Vault) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c VaultsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_delete_autorest.go new file mode 100644 index 000000000000..33485eecc957 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_delete_autorest.go @@ -0,0 +1,66 @@ +package vaults + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c VaultsClient) Delete(ctx context.Context, id VaultId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c VaultsClient) preparerForDelete(ctx context.Context, id VaultId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c VaultsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_get_autorest.go new file mode 100644 index 000000000000..da5616345a97 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_get_autorest.go @@ -0,0 +1,68 @@ +package vaults + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Vault +} + +// Get ... +func (c VaultsClient) Get(ctx context.Context, id VaultId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c VaultsClient) preparerForGet(ctx context.Context, id VaultId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c VaultsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..10f71d7015a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package vaults + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Vault + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Vault +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c VaultsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c VaultsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.RecoveryServices/vaults", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c VaultsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c VaultsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Vault `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c VaultsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, VaultOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c VaultsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate VaultOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Vault, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_listbysubscriptionid_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_listbysubscriptionid_autorest.go new file mode 100644 index 000000000000..755f0d1e0c3b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_listbysubscriptionid_autorest.go @@ -0,0 +1,187 @@ +package vaults + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionIdOperationResponse struct { + HttpResponse *http.Response + Model *[]Vault + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionIdOperationResponse, error) +} + +type ListBySubscriptionIdCompleteResult struct { + Items []Vault +} + +func (r ListBySubscriptionIdOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionIdOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionIdOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscriptionId ... +func (c VaultsClient) ListBySubscriptionId(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionIdOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionId(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListBySubscriptionId", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListBySubscriptionId", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscriptionId(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListBySubscriptionId", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscriptionId prepares the ListBySubscriptionId request. +func (c VaultsClient) preparerForListBySubscriptionId(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.RecoveryServices/vaults", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionIdWithNextLink prepares the ListBySubscriptionId request with the given nextLink token. +func (c VaultsClient) preparerForListBySubscriptionIdWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscriptionId handles the response to the ListBySubscriptionId request. The method always +// closes the http.Response Body. +func (c VaultsClient) responderForListBySubscriptionId(resp *http.Response) (result ListBySubscriptionIdOperationResponse, err error) { + type page struct { + Values []Vault `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionIdOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionIdWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListBySubscriptionId", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListBySubscriptionId", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscriptionId(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "ListBySubscriptionId", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionIdComplete retrieves all of the results into a single object +func (c VaultsClient) ListBySubscriptionIdComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionIdCompleteResult, error) { + return c.ListBySubscriptionIdCompleteMatchingPredicate(ctx, id, VaultOperationPredicate{}) +} + +// ListBySubscriptionIdCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c VaultsClient) ListBySubscriptionIdCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate VaultOperationPredicate) (resp ListBySubscriptionIdCompleteResult, err error) { + items := make([]Vault, 0) + + page, err := c.ListBySubscriptionId(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionIdCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_update_autorest.go new file mode 100644 index 000000000000..dee931ead0a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/method_update_autorest.go @@ -0,0 +1,79 @@ +package vaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c VaultsClient) Update(ctx context.Context, id VaultId, input PatchVault) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "vaults.VaultsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c VaultsClient) UpdateThenPoll(ctx context.Context, id VaultId, input PatchVault) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c VaultsClient) preparerForUpdate(ctx context.Context, id VaultId, input PatchVault) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c VaultsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_azuremonitoralertsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_azuremonitoralertsettings.go new file mode 100644 index 000000000000..c41bfcca5172 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_azuremonitoralertsettings.go @@ -0,0 +1,8 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureMonitorAlertSettings struct { + AlertsForAllJobFailures *AlertsState `json:"alertsForAllJobFailures,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_classicalertsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_classicalertsettings.go new file mode 100644 index 000000000000..f82f4c55b311 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_classicalertsettings.go @@ -0,0 +1,8 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClassicAlertSettings struct { + AlertsForCriticalOperations *AlertsState `json:"alertsForCriticalOperations,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_cmkkekidentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_cmkkekidentity.go new file mode 100644 index 000000000000..1e5e7be3d2db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_cmkkekidentity.go @@ -0,0 +1,9 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CmkKekIdentity struct { + UseSystemAssignedIdentity *bool `json:"useSystemAssignedIdentity,omitempty"` + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_cmkkeyvaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_cmkkeyvaultproperties.go new file mode 100644 index 000000000000..c53f530b9f5a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_cmkkeyvaultproperties.go @@ -0,0 +1,8 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CmkKeyVaultProperties struct { + KeyUri *string `json:"keyUri,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_immutabilitysettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_immutabilitysettings.go new file mode 100644 index 000000000000..f52ae97a4c38 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_immutabilitysettings.go @@ -0,0 +1,8 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImmutabilitySettings struct { + State *ImmutabilityState `json:"state,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_monitoringsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_monitoringsettings.go new file mode 100644 index 000000000000..391ede46ae21 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_monitoringsettings.go @@ -0,0 +1,9 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoringSettings struct { + AzureMonitorAlertSettings *AzureMonitorAlertSettings `json:"azureMonitorAlertSettings,omitempty"` + ClassicAlertSettings *ClassicAlertSettings `json:"classicAlertSettings,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_patchvault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_patchvault.go new file mode 100644 index 000000000000..5ffc9615bc50 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_patchvault.go @@ -0,0 +1,20 @@ +package vaults + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchVault struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VaultProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_privateendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_privateendpoint.go new file mode 100644 index 000000000000..64ce35a3d983 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_privateendpoint.go @@ -0,0 +1,8 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_privateendpointconnection.go new file mode 100644 index 000000000000..687aefc111cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + GroupIds *[]VaultSubResourceType `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_privateendpointconnectionvaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_privateendpointconnectionvaultproperties.go new file mode 100644 index 000000000000..5758db1bfa35 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_privateendpointconnectionvaultproperties.go @@ -0,0 +1,12 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionVaultProperties struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnection `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_privatelinkserviceconnectionstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_privatelinkserviceconnectionstate.go new file mode 100644 index 000000000000..b07724e0e27c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateEndpointConnectionStatus `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_securitysettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_securitysettings.go new file mode 100644 index 000000000000..1174404fe34b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_securitysettings.go @@ -0,0 +1,8 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecuritySettings struct { + ImmutabilitySettings *ImmutabilitySettings `json:"immutabilitySettings,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_sku.go new file mode 100644 index 000000000000..d89e1340ee62 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_sku.go @@ -0,0 +1,12 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *string `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name SkuName `json:"name"` + Size *string `json:"size,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_upgradedetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_upgradedetails.go new file mode 100644 index 000000000000..f5e021983ab9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_upgradedetails.go @@ -0,0 +1,58 @@ +package vaults + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpgradeDetails struct { + EndTimeUtc *string `json:"endTimeUtc,omitempty"` + LastUpdatedTimeUtc *string `json:"lastUpdatedTimeUtc,omitempty"` + Message *string `json:"message,omitempty"` + OperationId *string `json:"operationId,omitempty"` + PreviousResourceId *string `json:"previousResourceId,omitempty"` + StartTimeUtc *string `json:"startTimeUtc,omitempty"` + Status *VaultUpgradeState `json:"status,omitempty"` + TriggerType *TriggerType `json:"triggerType,omitempty"` + UpgradedResourceId *string `json:"upgradedResourceId,omitempty"` +} + +func (o *UpgradeDetails) GetEndTimeUtcAsTime() (*time.Time, error) { + if o.EndTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeDetails) SetEndTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTimeUtc = &formatted +} + +func (o *UpgradeDetails) GetLastUpdatedTimeUtcAsTime() (*time.Time, error) { + if o.LastUpdatedTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdatedTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeDetails) SetLastUpdatedTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdatedTimeUtc = &formatted +} + +func (o *UpgradeDetails) GetStartTimeUtcAsTime() (*time.Time, error) { + if o.StartTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeDetails) SetStartTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTimeUtc = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_vault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_vault.go new file mode 100644 index 000000000000..dc5d7d049c16 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_vault.go @@ -0,0 +1,22 @@ +package vaults + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Vault struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VaultProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_vaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_vaultproperties.go new file mode 100644 index 000000000000..8a41fd3830d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_vaultproperties.go @@ -0,0 +1,20 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultProperties struct { + BackupStorageVersion *BackupStorageVersion `json:"backupStorageVersion,omitempty"` + Encryption *VaultPropertiesEncryption `json:"encryption,omitempty"` + MonitoringSettings *MonitoringSettings `json:"monitoringSettings,omitempty"` + MoveDetails *VaultPropertiesMoveDetails `json:"moveDetails,omitempty"` + MoveState *ResourceMoveState `json:"moveState,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnectionVaultProperties `json:"privateEndpointConnections,omitempty"` + PrivateEndpointStateForBackup *VaultPrivateEndpointState `json:"privateEndpointStateForBackup,omitempty"` + PrivateEndpointStateForSiteRecovery *VaultPrivateEndpointState `json:"privateEndpointStateForSiteRecovery,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + RedundancySettings *VaultPropertiesRedundancySettings `json:"redundancySettings,omitempty"` + SecuritySettings *SecuritySettings `json:"securitySettings,omitempty"` + UpgradeDetails *UpgradeDetails `json:"upgradeDetails,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_vaultpropertiesencryption.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_vaultpropertiesencryption.go new file mode 100644 index 000000000000..05c6effec1de --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_vaultpropertiesencryption.go @@ -0,0 +1,10 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultPropertiesEncryption struct { + InfrastructureEncryption *InfrastructureEncryptionState `json:"infrastructureEncryption,omitempty"` + KekIdentity *CmkKekIdentity `json:"kekIdentity,omitempty"` + KeyVaultProperties *CmkKeyVaultProperties `json:"keyVaultProperties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_vaultpropertiesmovedetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_vaultpropertiesmovedetails.go new file mode 100644 index 000000000000..b65be5a06695 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_vaultpropertiesmovedetails.go @@ -0,0 +1,42 @@ +package vaults + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultPropertiesMoveDetails struct { + CompletionTimeUtc *string `json:"completionTimeUtc,omitempty"` + OperationId *string `json:"operationId,omitempty"` + SourceResourceId *string `json:"sourceResourceId,omitempty"` + StartTimeUtc *string `json:"startTimeUtc,omitempty"` + TargetResourceId *string `json:"targetResourceId,omitempty"` +} + +func (o *VaultPropertiesMoveDetails) GetCompletionTimeUtcAsTime() (*time.Time, error) { + if o.CompletionTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CompletionTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *VaultPropertiesMoveDetails) SetCompletionTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CompletionTimeUtc = &formatted +} + +func (o *VaultPropertiesMoveDetails) GetStartTimeUtcAsTime() (*time.Time, error) { + if o.StartTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *VaultPropertiesMoveDetails) SetStartTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTimeUtc = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_vaultpropertiesredundancysettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_vaultpropertiesredundancysettings.go new file mode 100644 index 000000000000..2d1174f221f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/model_vaultpropertiesredundancysettings.go @@ -0,0 +1,9 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultPropertiesRedundancySettings struct { + CrossRegionRestore *CrossRegionRestore `json:"crossRegionRestore,omitempty"` + StandardTierStorageRedundancy *StandardTierStorageRedundancy `json:"standardTierStorageRedundancy,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/predicates.go new file mode 100644 index 000000000000..baf3a35d92e2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/predicates.go @@ -0,0 +1,34 @@ +package vaults + +type VaultOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p VaultOperationPredicate) Matches(input Vault) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/version.go new file mode 100644 index 000000000000..3c996fb498a7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults/version.go @@ -0,0 +1,12 @@ +package vaults + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/vaults/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/README.md new file mode 100644 index 000000000000..f67c60f7bef1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/README.md @@ -0,0 +1,78 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr` Documentation + +The `backupresourcestorageconfigsnoncrr` SDK allows for interaction with the Azure Resource Manager Service `recoveryservicesbackup` (API Version `2021-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr" +``` + + +### Client Initialization + +```go +client := backupresourcestorageconfigsnoncrr.NewBackupResourceStorageConfigsNonCRRClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `BackupResourceStorageConfigsNonCRRClient.Get` + +```go +ctx := context.TODO() +id := backupresourcestorageconfigsnoncrr.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupResourceStorageConfigsNonCRRClient.Patch` + +```go +ctx := context.TODO() +id := backupresourcestorageconfigsnoncrr.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +payload := backupresourcestorageconfigsnoncrr.BackupResourceConfigResource{ + // ... +} + + +read, err := client.Patch(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupResourceStorageConfigsNonCRRClient.Update` + +```go +ctx := context.TODO() +id := backupresourcestorageconfigsnoncrr.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +payload := backupresourcestorageconfigsnoncrr.BackupResourceConfigResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/client.go new file mode 100644 index 000000000000..88d28c49c499 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/client.go @@ -0,0 +1,18 @@ +package backupresourcestorageconfigsnoncrr + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupResourceStorageConfigsNonCRRClient struct { + Client autorest.Client + baseUri string +} + +func NewBackupResourceStorageConfigsNonCRRClientWithBaseURI(endpoint string) BackupResourceStorageConfigsNonCRRClient { + return BackupResourceStorageConfigsNonCRRClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/constants.go new file mode 100644 index 000000000000..6ae51ba9c4a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/constants.go @@ -0,0 +1,136 @@ +package backupresourcestorageconfigsnoncrr + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedupState string + +const ( + DedupStateDisabled DedupState = "Disabled" + DedupStateEnabled DedupState = "Enabled" + DedupStateInvalid DedupState = "Invalid" +) + +func PossibleValuesForDedupState() []string { + return []string{ + string(DedupStateDisabled), + string(DedupStateEnabled), + string(DedupStateInvalid), + } +} + +func parseDedupState(input string) (*DedupState, error) { + vals := map[string]DedupState{ + "disabled": DedupStateDisabled, + "enabled": DedupStateEnabled, + "invalid": DedupStateInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DedupState(input) + return &out, nil +} + +type StorageType string + +const ( + StorageTypeGeoRedundant StorageType = "GeoRedundant" + StorageTypeInvalid StorageType = "Invalid" + StorageTypeLocallyRedundant StorageType = "LocallyRedundant" + StorageTypeReadAccessGeoZoneRedundant StorageType = "ReadAccessGeoZoneRedundant" + StorageTypeZoneRedundant StorageType = "ZoneRedundant" +) + +func PossibleValuesForStorageType() []string { + return []string{ + string(StorageTypeGeoRedundant), + string(StorageTypeInvalid), + string(StorageTypeLocallyRedundant), + string(StorageTypeReadAccessGeoZoneRedundant), + string(StorageTypeZoneRedundant), + } +} + +func parseStorageType(input string) (*StorageType, error) { + vals := map[string]StorageType{ + "georedundant": StorageTypeGeoRedundant, + "invalid": StorageTypeInvalid, + "locallyredundant": StorageTypeLocallyRedundant, + "readaccessgeozoneredundant": StorageTypeReadAccessGeoZoneRedundant, + "zoneredundant": StorageTypeZoneRedundant, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageType(input) + return &out, nil +} + +type StorageTypeState string + +const ( + StorageTypeStateInvalid StorageTypeState = "Invalid" + StorageTypeStateLocked StorageTypeState = "Locked" + StorageTypeStateUnlocked StorageTypeState = "Unlocked" +) + +func PossibleValuesForStorageTypeState() []string { + return []string{ + string(StorageTypeStateInvalid), + string(StorageTypeStateLocked), + string(StorageTypeStateUnlocked), + } +} + +func parseStorageTypeState(input string) (*StorageTypeState, error) { + vals := map[string]StorageTypeState{ + "invalid": StorageTypeStateInvalid, + "locked": StorageTypeStateLocked, + "unlocked": StorageTypeStateUnlocked, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageTypeState(input) + return &out, nil +} + +type XcoolState string + +const ( + XcoolStateDisabled XcoolState = "Disabled" + XcoolStateEnabled XcoolState = "Enabled" + XcoolStateInvalid XcoolState = "Invalid" +) + +func PossibleValuesForXcoolState() []string { + return []string{ + string(XcoolStateDisabled), + string(XcoolStateEnabled), + string(XcoolStateInvalid), + } +} + +func parseXcoolState(input string) (*XcoolState, error) { + vals := map[string]XcoolState{ + "disabled": XcoolStateDisabled, + "enabled": XcoolStateEnabled, + "invalid": XcoolStateInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := XcoolState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/id_vault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/id_vault.go new file mode 100644 index 000000000000..ae72db572866 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/id_vault.go @@ -0,0 +1,124 @@ +package backupresourcestorageconfigsnoncrr + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VaultId{} + +// VaultId is a struct representing the Resource ID for a Vault +type VaultId struct { + SubscriptionId string + ResourceGroupName string + VaultName string +} + +// NewVaultID returns a new VaultId struct +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { + return VaultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + } +} + +// ParseVaultID parses 'input' into a VaultId +func ParseVaultID(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(VaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId +// note: this method should only be used for API response data and not user input +func ParseVaultIDInsensitively(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(VaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVaultID checks that 'input' can be parsed as a Vault ID +func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Vault ID +func (id VaultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Vault ID +func (id VaultId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.StaticSegment("staticVaults", "vaults", "vaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + } +} + +// String returns a human-readable description of this Vault ID +func (id VaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + } + return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_get_autorest.go new file mode 100644 index 000000000000..dfa7631d81e4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_get_autorest.go @@ -0,0 +1,69 @@ +package backupresourcestorageconfigsnoncrr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *BackupResourceConfigResource +} + +// Get ... +func (c BackupResourceStorageConfigsNonCRRClient) Get(ctx context.Context, id VaultId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c BackupResourceStorageConfigsNonCRRClient) preparerForGet(ctx context.Context, id VaultId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupStorageConfig/vaultStorageConfig", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c BackupResourceStorageConfigsNonCRRClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_patch_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_patch_autorest.go new file mode 100644 index 000000000000..06e35a3cb44d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_patch_autorest.go @@ -0,0 +1,68 @@ +package backupresourcestorageconfigsnoncrr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchOperationResponse struct { + HttpResponse *http.Response +} + +// Patch ... +func (c BackupResourceStorageConfigsNonCRRClient) Patch(ctx context.Context, id VaultId, input BackupResourceConfigResource) (result PatchOperationResponse, err error) { + req, err := c.preparerForPatch(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Patch", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Patch", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPatch(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Patch", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPatch prepares the Patch request. +func (c BackupResourceStorageConfigsNonCRRClient) preparerForPatch(ctx context.Context, id VaultId, input BackupResourceConfigResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupStorageConfig/vaultStorageConfig", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPatch handles the response to the Patch request. The method always +// closes the http.Response Body. +func (c BackupResourceStorageConfigsNonCRRClient) responderForPatch(resp *http.Response) (result PatchOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_update_autorest.go new file mode 100644 index 000000000000..13a010ee69d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/method_update_autorest.go @@ -0,0 +1,70 @@ +package backupresourcestorageconfigsnoncrr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *BackupResourceConfigResource +} + +// Update ... +func (c BackupResourceStorageConfigsNonCRRClient) Update(ctx context.Context, id VaultId, input BackupResourceConfigResource) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c BackupResourceStorageConfigsNonCRRClient) preparerForUpdate(ctx context.Context, id VaultId, input BackupResourceConfigResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupStorageConfig/vaultStorageConfig", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c BackupResourceStorageConfigsNonCRRClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfig.go new file mode 100644 index 000000000000..69f226c0dcf6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfig.go @@ -0,0 +1,13 @@ +package backupresourcestorageconfigsnoncrr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupResourceConfig struct { + CrossRegionRestoreFlag *bool `json:"crossRegionRestoreFlag,omitempty"` + DedupState *DedupState `json:"dedupState,omitempty"` + StorageModelType *StorageType `json:"storageModelType,omitempty"` + StorageType *StorageType `json:"storageType,omitempty"` + StorageTypeState *StorageTypeState `json:"storageTypeState,omitempty"` + XcoolState *XcoolState `json:"xcoolState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfigresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfigresource.go new file mode 100644 index 000000000000..8fc2680cafb2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfigresource.go @@ -0,0 +1,14 @@ +package backupresourcestorageconfigsnoncrr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupResourceConfigResource struct { + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BackupResourceConfig `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/version.go new file mode 100644 index 000000000000..d3b59b078109 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr/version.go @@ -0,0 +1,12 @@ +package backupresourcestorageconfigsnoncrr + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/backupresourcestorageconfigsnoncrr/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/README.md new file mode 100644 index 000000000000..612482be5b68 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/README.md @@ -0,0 +1,78 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs` Documentation + +The `backupresourcevaultconfigs` SDK allows for interaction with the Azure Resource Manager Service `recoveryservicesbackup` (API Version `2021-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs" +``` + + +### Client Initialization + +```go +client := backupresourcevaultconfigs.NewBackupResourceVaultConfigsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `BackupResourceVaultConfigsClient.Get` + +```go +ctx := context.TODO() +id := backupresourcevaultconfigs.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupResourceVaultConfigsClient.Put` + +```go +ctx := context.TODO() +id := backupresourcevaultconfigs.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +payload := backupresourcevaultconfigs.BackupResourceVaultConfigResource{ + // ... +} + + +read, err := client.Put(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupResourceVaultConfigsClient.Update` + +```go +ctx := context.TODO() +id := backupresourcevaultconfigs.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +payload := backupresourcevaultconfigs.BackupResourceVaultConfigResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/client.go new file mode 100644 index 000000000000..b56d05bcc6b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/client.go @@ -0,0 +1,18 @@ +package backupresourcevaultconfigs + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupResourceVaultConfigsClient struct { + Client autorest.Client + baseUri string +} + +func NewBackupResourceVaultConfigsClientWithBaseURI(endpoint string) BackupResourceVaultConfigsClient { + return BackupResourceVaultConfigsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/constants.go new file mode 100644 index 000000000000..95d3b28e3f0b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/constants.go @@ -0,0 +1,136 @@ +package backupresourcevaultconfigs + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnhancedSecurityState string + +const ( + EnhancedSecurityStateDisabled EnhancedSecurityState = "Disabled" + EnhancedSecurityStateEnabled EnhancedSecurityState = "Enabled" + EnhancedSecurityStateInvalid EnhancedSecurityState = "Invalid" +) + +func PossibleValuesForEnhancedSecurityState() []string { + return []string{ + string(EnhancedSecurityStateDisabled), + string(EnhancedSecurityStateEnabled), + string(EnhancedSecurityStateInvalid), + } +} + +func parseEnhancedSecurityState(input string) (*EnhancedSecurityState, error) { + vals := map[string]EnhancedSecurityState{ + "disabled": EnhancedSecurityStateDisabled, + "enabled": EnhancedSecurityStateEnabled, + "invalid": EnhancedSecurityStateInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnhancedSecurityState(input) + return &out, nil +} + +type SoftDeleteFeatureState string + +const ( + SoftDeleteFeatureStateDisabled SoftDeleteFeatureState = "Disabled" + SoftDeleteFeatureStateEnabled SoftDeleteFeatureState = "Enabled" + SoftDeleteFeatureStateInvalid SoftDeleteFeatureState = "Invalid" +) + +func PossibleValuesForSoftDeleteFeatureState() []string { + return []string{ + string(SoftDeleteFeatureStateDisabled), + string(SoftDeleteFeatureStateEnabled), + string(SoftDeleteFeatureStateInvalid), + } +} + +func parseSoftDeleteFeatureState(input string) (*SoftDeleteFeatureState, error) { + vals := map[string]SoftDeleteFeatureState{ + "disabled": SoftDeleteFeatureStateDisabled, + "enabled": SoftDeleteFeatureStateEnabled, + "invalid": SoftDeleteFeatureStateInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SoftDeleteFeatureState(input) + return &out, nil +} + +type StorageType string + +const ( + StorageTypeGeoRedundant StorageType = "GeoRedundant" + StorageTypeInvalid StorageType = "Invalid" + StorageTypeLocallyRedundant StorageType = "LocallyRedundant" + StorageTypeReadAccessGeoZoneRedundant StorageType = "ReadAccessGeoZoneRedundant" + StorageTypeZoneRedundant StorageType = "ZoneRedundant" +) + +func PossibleValuesForStorageType() []string { + return []string{ + string(StorageTypeGeoRedundant), + string(StorageTypeInvalid), + string(StorageTypeLocallyRedundant), + string(StorageTypeReadAccessGeoZoneRedundant), + string(StorageTypeZoneRedundant), + } +} + +func parseStorageType(input string) (*StorageType, error) { + vals := map[string]StorageType{ + "georedundant": StorageTypeGeoRedundant, + "invalid": StorageTypeInvalid, + "locallyredundant": StorageTypeLocallyRedundant, + "readaccessgeozoneredundant": StorageTypeReadAccessGeoZoneRedundant, + "zoneredundant": StorageTypeZoneRedundant, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageType(input) + return &out, nil +} + +type StorageTypeState string + +const ( + StorageTypeStateInvalid StorageTypeState = "Invalid" + StorageTypeStateLocked StorageTypeState = "Locked" + StorageTypeStateUnlocked StorageTypeState = "Unlocked" +) + +func PossibleValuesForStorageTypeState() []string { + return []string{ + string(StorageTypeStateInvalid), + string(StorageTypeStateLocked), + string(StorageTypeStateUnlocked), + } +} + +func parseStorageTypeState(input string) (*StorageTypeState, error) { + vals := map[string]StorageTypeState{ + "invalid": StorageTypeStateInvalid, + "locked": StorageTypeStateLocked, + "unlocked": StorageTypeStateUnlocked, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageTypeState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/id_vault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/id_vault.go new file mode 100644 index 000000000000..c731debb713b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/id_vault.go @@ -0,0 +1,124 @@ +package backupresourcevaultconfigs + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VaultId{} + +// VaultId is a struct representing the Resource ID for a Vault +type VaultId struct { + SubscriptionId string + ResourceGroupName string + VaultName string +} + +// NewVaultID returns a new VaultId struct +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { + return VaultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + } +} + +// ParseVaultID parses 'input' into a VaultId +func ParseVaultID(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(VaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId +// note: this method should only be used for API response data and not user input +func ParseVaultIDInsensitively(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(VaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVaultID checks that 'input' can be parsed as a Vault ID +func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Vault ID +func (id VaultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Vault ID +func (id VaultId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.StaticSegment("staticVaults", "vaults", "vaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + } +} + +// String returns a human-readable description of this Vault ID +func (id VaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + } + return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_get_autorest.go new file mode 100644 index 000000000000..709a6190da77 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_get_autorest.go @@ -0,0 +1,69 @@ +package backupresourcevaultconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *BackupResourceVaultConfigResource +} + +// Get ... +func (c BackupResourceVaultConfigsClient) Get(ctx context.Context, id VaultId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c BackupResourceVaultConfigsClient) preparerForGet(ctx context.Context, id VaultId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupconfig/vaultconfig", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c BackupResourceVaultConfigsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_put_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_put_autorest.go new file mode 100644 index 000000000000..d7874fa3e4fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_put_autorest.go @@ -0,0 +1,70 @@ +package backupresourcevaultconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PutOperationResponse struct { + HttpResponse *http.Response + Model *BackupResourceVaultConfigResource +} + +// Put ... +func (c BackupResourceVaultConfigsClient) Put(ctx context.Context, id VaultId, input BackupResourceVaultConfigResource) (result PutOperationResponse, err error) { + req, err := c.preparerForPut(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Put", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Put", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPut(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Put", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPut prepares the Put request. +func (c BackupResourceVaultConfigsClient) preparerForPut(ctx context.Context, id VaultId, input BackupResourceVaultConfigResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupconfig/vaultconfig", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPut handles the response to the Put request. The method always +// closes the http.Response Body. +func (c BackupResourceVaultConfigsClient) responderForPut(resp *http.Response) (result PutOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_update_autorest.go new file mode 100644 index 000000000000..834657e34774 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/method_update_autorest.go @@ -0,0 +1,70 @@ +package backupresourcevaultconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *BackupResourceVaultConfigResource +} + +// Update ... +func (c BackupResourceVaultConfigsClient) Update(ctx context.Context, id VaultId, input BackupResourceVaultConfigResource) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupresourcevaultconfigs.BackupResourceVaultConfigsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c BackupResourceVaultConfigsClient) preparerForUpdate(ctx context.Context, id VaultId, input BackupResourceVaultConfigResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupconfig/vaultconfig", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c BackupResourceVaultConfigsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/model_backupresourcevaultconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/model_backupresourcevaultconfig.go new file mode 100644 index 000000000000..1e68a54676ef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/model_backupresourcevaultconfig.go @@ -0,0 +1,14 @@ +package backupresourcevaultconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupResourceVaultConfig struct { + EnhancedSecurityState *EnhancedSecurityState `json:"enhancedSecurityState,omitempty"` + IsSoftDeleteFeatureStateEditable *bool `json:"isSoftDeleteFeatureStateEditable,omitempty"` + ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` + SoftDeleteFeatureState *SoftDeleteFeatureState `json:"softDeleteFeatureState,omitempty"` + StorageModelType *StorageType `json:"storageModelType,omitempty"` + StorageType *StorageType `json:"storageType,omitempty"` + StorageTypeState *StorageTypeState `json:"storageTypeState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/model_backupresourcevaultconfigresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/model_backupresourcevaultconfigresource.go new file mode 100644 index 000000000000..9957131bbd66 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/model_backupresourcevaultconfigresource.go @@ -0,0 +1,14 @@ +package backupresourcevaultconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupResourceVaultConfigResource struct { + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BackupResourceVaultConfig `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/version.go new file mode 100644 index 000000000000..803e2b990a7a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs/version.go @@ -0,0 +1,12 @@ +package backupresourcevaultconfigs + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/backupresourcevaultconfigs/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/README.md index 3f00b752c9a7..1fb07e09e880 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue") +id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue") if err := client.CheckConsistencyThenPoll(ctx, id); err != nil { // handle the error @@ -36,7 +36,7 @@ if err := client.CheckConsistencyThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue") +id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue") payload := replicationfabrics.FabricCreationInput{ // ... @@ -53,7 +53,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue") +id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -65,7 +65,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue") +id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue") read, err := client.Get(ctx, id, replicationfabrics.DefaultGetOperationOptions()) if err != nil { @@ -81,7 +81,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := replicationfabrics.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := replicationfabrics.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) @@ -98,7 +98,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue") +id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue") if err := client.MigrateToAadThenPoll(ctx, id); err != nil { // handle the error @@ -110,7 +110,7 @@ if err := client.MigrateToAadThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue") +id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue") if err := client.PurgeThenPoll(ctx, id); err != nil { // handle the error @@ -122,7 +122,7 @@ if err := client.PurgeThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue") +id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue") payload := replicationfabrics.FailoverProcessServerRequest{ // ... @@ -139,7 +139,7 @@ if err := client.ReassociateGatewayThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue") +id := replicationfabrics.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue") payload := replicationfabrics.RenewCertificateInput{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_replicationfabric.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_replicationfabric.go index 8c1eed59023f..32d89e50f052 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_replicationfabric.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_replicationfabric.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = ReplicationFabricId{} // ReplicationFabricId is a struct representing the Resource ID for a Replication Fabric type ReplicationFabricId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - FabricName string + SubscriptionId string + ResourceGroupName string + VaultName string + ReplicationFabricName string } // NewReplicationFabricID returns a new ReplicationFabricId struct -func NewReplicationFabricID(subscriptionId string, resourceGroupName string, resourceName string, fabricName string) ReplicationFabricId { +func NewReplicationFabricID(subscriptionId string, resourceGroupName string, vaultName string, replicationFabricName string) ReplicationFabricId { return ReplicationFabricId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - FabricName: fabricName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + ReplicationFabricName: replicationFabricName, } } @@ -46,12 +46,12 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateReplicationFabricID(input interface{}, key string) (warnings []stri // ID returns the formatted Replication Fabric ID func (id ReplicationFabricId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/replicationFabrics/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.FabricName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.ReplicationFabricName) } // Segments returns a slice of Resource ID Segments which comprise this Replication Fabric ID @@ -119,9 +119,9 @@ func (id ReplicationFabricId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), resourceids.StaticSegment("staticReplicationFabrics", "replicationFabrics", "replicationFabrics"), - resourceids.UserSpecifiedSegment("fabricName", "fabricValue"), + resourceids.UserSpecifiedSegment("replicationFabricName", "replicationFabricValue"), } } @@ -130,8 +130,8 @@ func (id ReplicationFabricId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Fabric Name: %q", id.FabricName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Replication Fabric Name: %q", id.ReplicationFabricName), } return fmt.Sprintf("Replication Fabric (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_vault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_vault.go index 2e8492e776d6..288cc808be59 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_vault.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_vault.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = VaultId{} type VaultId struct { SubscriptionId string ResourceGroupName string - ResourceName string + VaultName string } // NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, resourceName string) VaultId { +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { return VaultId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + VaultName: vaultName, } } @@ -44,8 +44,8 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateVaultID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Vault ID func (id VaultId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) } // Segments returns a slice of Resource ID Segments which comprise this Vault ID @@ -109,7 +109,7 @@ func (id VaultId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), } } @@ -118,7 +118,7 @@ func (id VaultId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Vault Name: %q", id.VaultName), } return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/README.md index b47fd4e2f538..5e945736182e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := replicationnetworkmappings.NewReplicationNetworkMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "networkValue", "networkMappingValue") +id := replicationnetworkmappings.NewReplicationNetworkMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationNetworkValue", "replicationNetworkMappingValue") payload := replicationnetworkmappings.CreateNetworkMappingInput{ // ... @@ -41,7 +41,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationnetworkmappings.NewReplicationNetworkMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "networkValue", "networkMappingValue") +id := replicationnetworkmappings.NewReplicationNetworkMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationNetworkValue", "replicationNetworkMappingValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationnetworkmappings.NewReplicationNetworkMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "networkValue", "networkMappingValue") +id := replicationnetworkmappings.NewReplicationNetworkMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationNetworkValue", "replicationNetworkMappingValue") read, err := client.Get(ctx, id) if err != nil { @@ -69,7 +69,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := replicationnetworkmappings.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := replicationnetworkmappings.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) @@ -86,7 +86,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := replicationnetworkmappings.NewReplicationNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "networkValue") +id := replicationnetworkmappings.NewReplicationNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationNetworkValue") // alternatively `client.ListByReplicationNetworks(ctx, id)` can be used to do batched pagination items, err := client.ListByReplicationNetworksComplete(ctx, id) @@ -103,7 +103,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := replicationnetworkmappings.NewReplicationNetworkMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "networkValue", "networkMappingValue") +id := replicationnetworkmappings.NewReplicationNetworkMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationNetworkValue", "replicationNetworkMappingValue") payload := replicationnetworkmappings.UpdateNetworkMappingInput{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetwork.go index 2a81218828e4..f1cabbb49156 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetwork.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetwork.go @@ -11,21 +11,21 @@ var _ resourceids.ResourceId = ReplicationNetworkId{} // ReplicationNetworkId is a struct representing the Resource ID for a Replication Network type ReplicationNetworkId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - FabricName string - NetworkName string + SubscriptionId string + ResourceGroupName string + VaultName string + ReplicationFabricName string + ReplicationNetworkName string } // NewReplicationNetworkID returns a new ReplicationNetworkId struct -func NewReplicationNetworkID(subscriptionId string, resourceGroupName string, resourceName string, fabricName string, networkName string) ReplicationNetworkId { +func NewReplicationNetworkID(subscriptionId string, resourceGroupName string, vaultName string, replicationFabricName string, replicationNetworkName string) ReplicationNetworkId { return ReplicationNetworkId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - FabricName: fabricName, - NetworkName: networkName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + ReplicationFabricName: replicationFabricName, + ReplicationNetworkName: replicationNetworkName, } } @@ -48,16 +48,16 @@ func ParseReplicationNetworkID(input string) (*ReplicationNetworkId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } - if id.NetworkName, ok = parsed.Parsed["networkName"]; !ok { - return nil, fmt.Errorf("the segment 'networkName' was not found in the resource id %q", input) + if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationNetworkName' was not found in the resource id %q", input) } return &id, nil @@ -83,16 +83,16 @@ func ParseReplicationNetworkIDInsensitively(input string) (*ReplicationNetworkId return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } - if id.NetworkName, ok = parsed.Parsed["networkName"]; !ok { - return nil, fmt.Errorf("the segment 'networkName' was not found in the resource id %q", input) + if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationNetworkName' was not found in the resource id %q", input) } return &id, nil @@ -116,7 +116,7 @@ func ValidateReplicationNetworkID(input interface{}, key string) (warnings []str // ID returns the formatted Replication Network ID func (id ReplicationNetworkId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/replicationFabrics/%s/replicationNetworks/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.FabricName, id.NetworkName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.ReplicationFabricName, id.ReplicationNetworkName) } // Segments returns a slice of Resource ID Segments which comprise this Replication Network ID @@ -129,11 +129,11 @@ func (id ReplicationNetworkId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), resourceids.StaticSegment("staticReplicationFabrics", "replicationFabrics", "replicationFabrics"), - resourceids.UserSpecifiedSegment("fabricName", "fabricValue"), + resourceids.UserSpecifiedSegment("replicationFabricName", "replicationFabricValue"), resourceids.StaticSegment("staticReplicationNetworks", "replicationNetworks", "replicationNetworks"), - resourceids.UserSpecifiedSegment("networkName", "networkValue"), + resourceids.UserSpecifiedSegment("replicationNetworkName", "replicationNetworkValue"), } } @@ -142,9 +142,9 @@ func (id ReplicationNetworkId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Fabric Name: %q", id.FabricName), - fmt.Sprintf("Network Name: %q", id.NetworkName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Replication Fabric Name: %q", id.ReplicationFabricName), + fmt.Sprintf("Replication Network Name: %q", id.ReplicationNetworkName), } return fmt.Sprintf("Replication Network (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetworkmapping.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetworkmapping.go index da502394be62..334f240f61f0 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetworkmapping.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetworkmapping.go @@ -11,23 +11,23 @@ var _ resourceids.ResourceId = ReplicationNetworkMappingId{} // ReplicationNetworkMappingId is a struct representing the Resource ID for a Replication Network Mapping type ReplicationNetworkMappingId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - FabricName string - NetworkName string - NetworkMappingName string + SubscriptionId string + ResourceGroupName string + VaultName string + ReplicationFabricName string + ReplicationNetworkName string + ReplicationNetworkMappingName string } // NewReplicationNetworkMappingID returns a new ReplicationNetworkMappingId struct -func NewReplicationNetworkMappingID(subscriptionId string, resourceGroupName string, resourceName string, fabricName string, networkName string, networkMappingName string) ReplicationNetworkMappingId { +func NewReplicationNetworkMappingID(subscriptionId string, resourceGroupName string, vaultName string, replicationFabricName string, replicationNetworkName string, replicationNetworkMappingName string) ReplicationNetworkMappingId { return ReplicationNetworkMappingId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - FabricName: fabricName, - NetworkName: networkName, - NetworkMappingName: networkMappingName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + ReplicationFabricName: replicationFabricName, + ReplicationNetworkName: replicationNetworkName, + ReplicationNetworkMappingName: replicationNetworkMappingName, } } @@ -50,20 +50,20 @@ func ParseReplicationNetworkMappingID(input string) (*ReplicationNetworkMappingI return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } - if id.NetworkName, ok = parsed.Parsed["networkName"]; !ok { - return nil, fmt.Errorf("the segment 'networkName' was not found in the resource id %q", input) + if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationNetworkName' was not found in the resource id %q", input) } - if id.NetworkMappingName, ok = parsed.Parsed["networkMappingName"]; !ok { - return nil, fmt.Errorf("the segment 'networkMappingName' was not found in the resource id %q", input) + if id.ReplicationNetworkMappingName, ok = parsed.Parsed["replicationNetworkMappingName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationNetworkMappingName' was not found in the resource id %q", input) } return &id, nil @@ -89,20 +89,20 @@ func ParseReplicationNetworkMappingIDInsensitively(input string) (*ReplicationNe return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } - if id.NetworkName, ok = parsed.Parsed["networkName"]; !ok { - return nil, fmt.Errorf("the segment 'networkName' was not found in the resource id %q", input) + if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationNetworkName' was not found in the resource id %q", input) } - if id.NetworkMappingName, ok = parsed.Parsed["networkMappingName"]; !ok { - return nil, fmt.Errorf("the segment 'networkMappingName' was not found in the resource id %q", input) + if id.ReplicationNetworkMappingName, ok = parsed.Parsed["replicationNetworkMappingName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationNetworkMappingName' was not found in the resource id %q", input) } return &id, nil @@ -126,7 +126,7 @@ func ValidateReplicationNetworkMappingID(input interface{}, key string) (warning // ID returns the formatted Replication Network Mapping ID func (id ReplicationNetworkMappingId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/replicationFabrics/%s/replicationNetworks/%s/replicationNetworkMappings/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.FabricName, id.NetworkName, id.NetworkMappingName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.ReplicationFabricName, id.ReplicationNetworkName, id.ReplicationNetworkMappingName) } // Segments returns a slice of Resource ID Segments which comprise this Replication Network Mapping ID @@ -139,13 +139,13 @@ func (id ReplicationNetworkMappingId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), resourceids.StaticSegment("staticReplicationFabrics", "replicationFabrics", "replicationFabrics"), - resourceids.UserSpecifiedSegment("fabricName", "fabricValue"), + resourceids.UserSpecifiedSegment("replicationFabricName", "replicationFabricValue"), resourceids.StaticSegment("staticReplicationNetworks", "replicationNetworks", "replicationNetworks"), - resourceids.UserSpecifiedSegment("networkName", "networkValue"), + resourceids.UserSpecifiedSegment("replicationNetworkName", "replicationNetworkValue"), resourceids.StaticSegment("staticReplicationNetworkMappings", "replicationNetworkMappings", "replicationNetworkMappings"), - resourceids.UserSpecifiedSegment("networkMappingName", "networkMappingValue"), + resourceids.UserSpecifiedSegment("replicationNetworkMappingName", "replicationNetworkMappingValue"), } } @@ -154,10 +154,10 @@ func (id ReplicationNetworkMappingId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Fabric Name: %q", id.FabricName), - fmt.Sprintf("Network Name: %q", id.NetworkName), - fmt.Sprintf("Network Mapping Name: %q", id.NetworkMappingName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Replication Fabric Name: %q", id.ReplicationFabricName), + fmt.Sprintf("Replication Network Name: %q", id.ReplicationNetworkName), + fmt.Sprintf("Replication Network Mapping Name: %q", id.ReplicationNetworkMappingName), } return fmt.Sprintf("Replication Network Mapping (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_vault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_vault.go index 238e9559cfea..910ac4192b91 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_vault.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_vault.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = VaultId{} type VaultId struct { SubscriptionId string ResourceGroupName string - ResourceName string + VaultName string } // NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, resourceName string) VaultId { +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { return VaultId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + VaultName: vaultName, } } @@ -44,8 +44,8 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateVaultID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Vault ID func (id VaultId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) } // Segments returns a slice of Resource ID Segments which comprise this Vault ID @@ -109,7 +109,7 @@ func (id VaultId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), } } @@ -118,7 +118,7 @@ func (id VaultId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Vault Name: %q", id.VaultName), } return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/README.md index e5e5e933fbff..79f08863b14d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := replicationpolicies.NewReplicationPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "policyValue") +id := replicationpolicies.NewReplicationPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationPolicyValue") payload := replicationpolicies.CreatePolicyInput{ // ... @@ -41,7 +41,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationpolicies.NewReplicationPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "policyValue") +id := replicationpolicies.NewReplicationPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationPolicyValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationpolicies.NewReplicationPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "policyValue") +id := replicationpolicies.NewReplicationPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationPolicyValue") read, err := client.Get(ctx, id) if err != nil { @@ -69,7 +69,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := replicationpolicies.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := replicationpolicies.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) @@ -86,7 +86,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := replicationpolicies.NewReplicationPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "policyValue") +id := replicationpolicies.NewReplicationPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationPolicyValue") payload := replicationpolicies.UpdatePolicyInput{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_replicationpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_replicationpolicy.go index 430d0a64bf76..2875aa1e517c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_replicationpolicy.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_replicationpolicy.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = ReplicationPolicyId{} // ReplicationPolicyId is a struct representing the Resource ID for a Replication Policy type ReplicationPolicyId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - PolicyName string + SubscriptionId string + ResourceGroupName string + VaultName string + ReplicationPolicyName string } // NewReplicationPolicyID returns a new ReplicationPolicyId struct -func NewReplicationPolicyID(subscriptionId string, resourceGroupName string, resourceName string, policyName string) ReplicationPolicyId { +func NewReplicationPolicyID(subscriptionId string, resourceGroupName string, vaultName string, replicationPolicyName string) ReplicationPolicyId { return ReplicationPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - PolicyName: policyName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + ReplicationPolicyName: replicationPolicyName, } } @@ -46,12 +46,12 @@ func ParseReplicationPolicyID(input string) (*ReplicationPolicyId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.PolicyName, ok = parsed.Parsed["policyName"]; !ok { - return nil, fmt.Errorf("the segment 'policyName' was not found in the resource id %q", input) + if id.ReplicationPolicyName, ok = parsed.Parsed["replicationPolicyName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationPolicyName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseReplicationPolicyIDInsensitively(input string) (*ReplicationPolicyId, return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.PolicyName, ok = parsed.Parsed["policyName"]; !ok { - return nil, fmt.Errorf("the segment 'policyName' was not found in the resource id %q", input) + if id.ReplicationPolicyName, ok = parsed.Parsed["replicationPolicyName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationPolicyName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateReplicationPolicyID(input interface{}, key string) (warnings []stri // ID returns the formatted Replication Policy ID func (id ReplicationPolicyId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/replicationPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.PolicyName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.ReplicationPolicyName) } // Segments returns a slice of Resource ID Segments which comprise this Replication Policy ID @@ -119,9 +119,9 @@ func (id ReplicationPolicyId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), resourceids.StaticSegment("staticReplicationPolicies", "replicationPolicies", "replicationPolicies"), - resourceids.UserSpecifiedSegment("policyName", "policyValue"), + resourceids.UserSpecifiedSegment("replicationPolicyName", "replicationPolicyValue"), } } @@ -130,8 +130,8 @@ func (id ReplicationPolicyId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Policy Name: %q", id.PolicyName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Replication Policy Name: %q", id.ReplicationPolicyName), } return fmt.Sprintf("Replication Policy (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_vault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_vault.go index 3ffa68c9c07d..89363741dcb4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_vault.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_vault.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = VaultId{} type VaultId struct { SubscriptionId string ResourceGroupName string - ResourceName string + VaultName string } // NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, resourceName string) VaultId { +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { return VaultId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + VaultName: vaultName, } } @@ -44,8 +44,8 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateVaultID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Vault ID func (id VaultId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) } // Segments returns a slice of Resource ID Segments which comprise this Vault ID @@ -109,7 +109,7 @@ func (id VaultId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), } } @@ -118,7 +118,7 @@ func (id VaultId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Vault Name: %q", id.VaultName), } return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/README.md index 1d5deede3262..082404d75162 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") payload := replicationprotecteditems.AddDisksInput{ // ... @@ -41,7 +41,7 @@ if err := client.AddDisksThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") payload := replicationprotecteditems.ApplyRecoveryPointInput{ // ... @@ -58,7 +58,7 @@ if err := client.ApplyRecoveryPointThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") payload := replicationprotecteditems.EnableProtectionInput{ // ... @@ -75,7 +75,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") payload := replicationprotecteditems.DisableProtectionInput{ // ... @@ -92,7 +92,7 @@ if err := client.DeleteThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") if err := client.FailoverCancelThenPoll(ctx, id); err != nil { // handle the error @@ -104,7 +104,7 @@ if err := client.FailoverCancelThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") if err := client.FailoverCommitThenPoll(ctx, id); err != nil { // handle the error @@ -116,7 +116,7 @@ if err := client.FailoverCommitThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") read, err := client.Get(ctx, id) if err != nil { @@ -132,7 +132,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := replicationprotecteditems.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") // alternatively `client.List(ctx, id, replicationprotecteditems.DefaultListOperationOptions())` can be used to do batched pagination items, err := client.ListComplete(ctx, id, replicationprotecteditems.DefaultListOperationOptions()) @@ -149,7 +149,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectionContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue") +id := replicationprotecteditems.NewReplicationProtectionContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue") // alternatively `client.ListByReplicationProtectionContainers(ctx, id)` can be used to do batched pagination items, err := client.ListByReplicationProtectionContainersComplete(ctx, id) @@ -166,7 +166,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") payload := replicationprotecteditems.PlannedFailoverInput{ // ... @@ -183,7 +183,7 @@ if err := client.PlannedFailoverThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") if err := client.PurgeThenPoll(ctx, id); err != nil { // handle the error @@ -195,7 +195,7 @@ if err := client.PurgeThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") payload := replicationprotecteditems.RemoveDisksInput{ // ... @@ -212,7 +212,7 @@ if err := client.RemoveDisksThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") if err := client.RepairReplicationThenPoll(ctx, id); err != nil { // handle the error @@ -224,7 +224,7 @@ if err := client.RepairReplicationThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") payload := replicationprotecteditems.ReverseReplicationInput{ // ... @@ -241,7 +241,7 @@ if err := client.ReprotectThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") payload := replicationprotecteditems.ResolveHealthInput{ // ... @@ -258,7 +258,7 @@ if err := client.ResolveHealthErrorsThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") payload := replicationprotecteditems.SwitchProviderInput{ // ... @@ -275,7 +275,7 @@ if err := client.SwitchProviderThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") payload := replicationprotecteditems.TestFailoverInput{ // ... @@ -292,7 +292,7 @@ if err := client.TestFailoverThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") payload := replicationprotecteditems.TestFailoverCleanupInput{ // ... @@ -309,7 +309,7 @@ if err := client.TestFailoverCleanupThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") payload := replicationprotecteditems.UnplannedFailoverInput{ // ... @@ -326,7 +326,7 @@ if err := client.UnplannedFailoverThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") payload := replicationprotecteditems.UpdateReplicationProtectedItemInput{ // ... @@ -343,7 +343,7 @@ if err := client.UpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") payload := replicationprotecteditems.UpdateApplianceForReplicationProtectedItemInput{ // ... @@ -360,7 +360,7 @@ if err := client.UpdateApplianceThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "replicatedProtectedItemValue") +id := replicationprotecteditems.NewReplicationProtectedItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectedItemValue") payload := replicationprotecteditems.UpdateMobilityServiceRequest{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotecteditem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotecteditem.go index 39b7420a507b..cbf76622fd79 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotecteditem.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotecteditem.go @@ -11,23 +11,23 @@ var _ resourceids.ResourceId = ReplicationProtectedItemId{} // ReplicationProtectedItemId is a struct representing the Resource ID for a Replication Protected Item type ReplicationProtectedItemId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - FabricName string - ProtectionContainerName string - ReplicatedProtectedItemName string + SubscriptionId string + ResourceGroupName string + VaultName string + ReplicationFabricName string + ReplicationProtectionContainerName string + ReplicationProtectedItemName string } // NewReplicationProtectedItemID returns a new ReplicationProtectedItemId struct -func NewReplicationProtectedItemID(subscriptionId string, resourceGroupName string, resourceName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string) ReplicationProtectedItemId { +func NewReplicationProtectedItemID(subscriptionId string, resourceGroupName string, vaultName string, replicationFabricName string, replicationProtectionContainerName string, replicationProtectedItemName string) ReplicationProtectedItemId { return ReplicationProtectedItemId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - FabricName: fabricName, - ProtectionContainerName: protectionContainerName, - ReplicatedProtectedItemName: replicatedProtectedItemName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + ReplicationFabricName: replicationFabricName, + ReplicationProtectionContainerName: replicationProtectionContainerName, + ReplicationProtectedItemName: replicationProtectedItemName, } } @@ -50,20 +50,20 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, fmt.Errorf("the segment 'protectionContainerName' was not found in the resource id %q", input) + if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationProtectionContainerName' was not found in the resource id %q", input) } - if id.ReplicatedProtectedItemName, ok = parsed.Parsed["replicatedProtectedItemName"]; !ok { - return nil, fmt.Errorf("the segment 'replicatedProtectedItemName' was not found in the resource id %q", input) + if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationProtectedItemName' was not found in the resource id %q", input) } return &id, nil @@ -89,20 +89,20 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, fmt.Errorf("the segment 'protectionContainerName' was not found in the resource id %q", input) + if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationProtectionContainerName' was not found in the resource id %q", input) } - if id.ReplicatedProtectedItemName, ok = parsed.Parsed["replicatedProtectedItemName"]; !ok { - return nil, fmt.Errorf("the segment 'replicatedProtectedItemName' was not found in the resource id %q", input) + if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationProtectedItemName' was not found in the resource id %q", input) } return &id, nil @@ -126,7 +126,7 @@ func ValidateReplicationProtectedItemID(input interface{}, key string) (warnings // ID returns the formatted Replication Protected Item ID func (id ReplicationProtectedItemId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/replicationFabrics/%s/replicationProtectionContainers/%s/replicationProtectedItems/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.FabricName, id.ProtectionContainerName, id.ReplicatedProtectedItemName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.ReplicationFabricName, id.ReplicationProtectionContainerName, id.ReplicationProtectedItemName) } // Segments returns a slice of Resource ID Segments which comprise this Replication Protected Item ID @@ -139,13 +139,13 @@ func (id ReplicationProtectedItemId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), resourceids.StaticSegment("staticReplicationFabrics", "replicationFabrics", "replicationFabrics"), - resourceids.UserSpecifiedSegment("fabricName", "fabricValue"), + resourceids.UserSpecifiedSegment("replicationFabricName", "replicationFabricValue"), resourceids.StaticSegment("staticReplicationProtectionContainers", "replicationProtectionContainers", "replicationProtectionContainers"), - resourceids.UserSpecifiedSegment("protectionContainerName", "protectionContainerValue"), + resourceids.UserSpecifiedSegment("replicationProtectionContainerName", "replicationProtectionContainerValue"), resourceids.StaticSegment("staticReplicationProtectedItems", "replicationProtectedItems", "replicationProtectedItems"), - resourceids.UserSpecifiedSegment("replicatedProtectedItemName", "replicatedProtectedItemValue"), + resourceids.UserSpecifiedSegment("replicationProtectedItemName", "replicationProtectedItemValue"), } } @@ -154,10 +154,10 @@ func (id ReplicationProtectedItemId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Fabric Name: %q", id.FabricName), - fmt.Sprintf("Protection Container Name: %q", id.ProtectionContainerName), - fmt.Sprintf("Replicated Protected Item Name: %q", id.ReplicatedProtectedItemName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Replication Fabric Name: %q", id.ReplicationFabricName), + fmt.Sprintf("Replication Protection Container Name: %q", id.ReplicationProtectionContainerName), + fmt.Sprintf("Replication Protected Item Name: %q", id.ReplicationProtectedItemName), } return fmt.Sprintf("Replication Protected Item (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotectioncontainer.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotectioncontainer.go index 25bf4a476b11..ebcfcc94a953 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotectioncontainer.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotectioncontainer.go @@ -11,21 +11,21 @@ var _ resourceids.ResourceId = ReplicationProtectionContainerId{} // ReplicationProtectionContainerId is a struct representing the Resource ID for a Replication Protection Container type ReplicationProtectionContainerId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - FabricName string - ProtectionContainerName string + SubscriptionId string + ResourceGroupName string + VaultName string + ReplicationFabricName string + ReplicationProtectionContainerName string } // NewReplicationProtectionContainerID returns a new ReplicationProtectionContainerId struct -func NewReplicationProtectionContainerID(subscriptionId string, resourceGroupName string, resourceName string, fabricName string, protectionContainerName string) ReplicationProtectionContainerId { +func NewReplicationProtectionContainerID(subscriptionId string, resourceGroupName string, vaultName string, replicationFabricName string, replicationProtectionContainerName string) ReplicationProtectionContainerId { return ReplicationProtectionContainerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - FabricName: fabricName, - ProtectionContainerName: protectionContainerName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + ReplicationFabricName: replicationFabricName, + ReplicationProtectionContainerName: replicationProtectionContainerName, } } @@ -48,16 +48,16 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, fmt.Errorf("the segment 'protectionContainerName' was not found in the resource id %q", input) + if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationProtectionContainerName' was not found in the resource id %q", input) } return &id, nil @@ -83,16 +83,16 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, fmt.Errorf("the segment 'protectionContainerName' was not found in the resource id %q", input) + if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationProtectionContainerName' was not found in the resource id %q", input) } return &id, nil @@ -116,7 +116,7 @@ func ValidateReplicationProtectionContainerID(input interface{}, key string) (wa // ID returns the formatted Replication Protection Container ID func (id ReplicationProtectionContainerId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/replicationFabrics/%s/replicationProtectionContainers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.FabricName, id.ProtectionContainerName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.ReplicationFabricName, id.ReplicationProtectionContainerName) } // Segments returns a slice of Resource ID Segments which comprise this Replication Protection Container ID @@ -129,11 +129,11 @@ func (id ReplicationProtectionContainerId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), resourceids.StaticSegment("staticReplicationFabrics", "replicationFabrics", "replicationFabrics"), - resourceids.UserSpecifiedSegment("fabricName", "fabricValue"), + resourceids.UserSpecifiedSegment("replicationFabricName", "replicationFabricValue"), resourceids.StaticSegment("staticReplicationProtectionContainers", "replicationProtectionContainers", "replicationProtectionContainers"), - resourceids.UserSpecifiedSegment("protectionContainerName", "protectionContainerValue"), + resourceids.UserSpecifiedSegment("replicationProtectionContainerName", "replicationProtectionContainerValue"), } } @@ -142,9 +142,9 @@ func (id ReplicationProtectionContainerId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Fabric Name: %q", id.FabricName), - fmt.Sprintf("Protection Container Name: %q", id.ProtectionContainerName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Replication Fabric Name: %q", id.ReplicationFabricName), + fmt.Sprintf("Replication Protection Container Name: %q", id.ReplicationProtectionContainerName), } return fmt.Sprintf("Replication Protection Container (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_vault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_vault.go index 21dc356af87a..bb555e8bfa01 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_vault.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_vault.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = VaultId{} type VaultId struct { SubscriptionId string ResourceGroupName string - ResourceName string + VaultName string } // NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, resourceName string) VaultId { +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { return VaultId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + VaultName: vaultName, } } @@ -44,8 +44,8 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateVaultID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Vault ID func (id VaultId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) } // Segments returns a slice of Resource ID Segments which comprise this Vault ID @@ -109,7 +109,7 @@ func (id VaultId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), } } @@ -118,7 +118,7 @@ func (id VaultId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Vault Name: %q", id.VaultName), } return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/README.md index 98719dc98485..c224864ae7bf 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := replicationprotectioncontainermappings.NewReplicationProtectionContainerMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "mappingValue") +id := replicationprotectioncontainermappings.NewReplicationProtectionContainerMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectionContainerMappingValue") payload := replicationprotectioncontainermappings.CreateProtectionContainerMappingInput{ // ... @@ -41,7 +41,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotectioncontainermappings.NewReplicationProtectionContainerMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "mappingValue") +id := replicationprotectioncontainermappings.NewReplicationProtectionContainerMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectionContainerMappingValue") payload := replicationprotectioncontainermappings.RemoveProtectionContainerMappingInput{ // ... @@ -58,7 +58,7 @@ if err := client.DeleteThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotectioncontainermappings.NewReplicationProtectionContainerMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "mappingValue") +id := replicationprotectioncontainermappings.NewReplicationProtectionContainerMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectionContainerMappingValue") read, err := client.Get(ctx, id) if err != nil { @@ -74,7 +74,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := replicationprotectioncontainermappings.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := replicationprotectioncontainermappings.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) @@ -91,7 +91,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := replicationprotectioncontainermappings.NewReplicationProtectionContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue") +id := replicationprotectioncontainermappings.NewReplicationProtectionContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue") // alternatively `client.ListByReplicationProtectionContainers(ctx, id)` can be used to do batched pagination items, err := client.ListByReplicationProtectionContainersComplete(ctx, id) @@ -108,7 +108,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := replicationprotectioncontainermappings.NewReplicationProtectionContainerMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "mappingValue") +id := replicationprotectioncontainermappings.NewReplicationProtectionContainerMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectionContainerMappingValue") if err := client.PurgeThenPoll(ctx, id); err != nil { // handle the error @@ -120,7 +120,7 @@ if err := client.PurgeThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationprotectioncontainermappings.NewReplicationProtectionContainerMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue", "mappingValue") +id := replicationprotectioncontainermappings.NewReplicationProtectionContainerMappingID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue", "replicationProtectionContainerMappingValue") payload := replicationprotectioncontainermappings.UpdateProtectionContainerMappingInput{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go index 51edc2f0697f..3a9c690bcb5b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go @@ -11,21 +11,21 @@ var _ resourceids.ResourceId = ReplicationProtectionContainerId{} // ReplicationProtectionContainerId is a struct representing the Resource ID for a Replication Protection Container type ReplicationProtectionContainerId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - FabricName string - ProtectionContainerName string + SubscriptionId string + ResourceGroupName string + VaultName string + ReplicationFabricName string + ReplicationProtectionContainerName string } // NewReplicationProtectionContainerID returns a new ReplicationProtectionContainerId struct -func NewReplicationProtectionContainerID(subscriptionId string, resourceGroupName string, resourceName string, fabricName string, protectionContainerName string) ReplicationProtectionContainerId { +func NewReplicationProtectionContainerID(subscriptionId string, resourceGroupName string, vaultName string, replicationFabricName string, replicationProtectionContainerName string) ReplicationProtectionContainerId { return ReplicationProtectionContainerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - FabricName: fabricName, - ProtectionContainerName: protectionContainerName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + ReplicationFabricName: replicationFabricName, + ReplicationProtectionContainerName: replicationProtectionContainerName, } } @@ -48,16 +48,16 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, fmt.Errorf("the segment 'protectionContainerName' was not found in the resource id %q", input) + if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationProtectionContainerName' was not found in the resource id %q", input) } return &id, nil @@ -83,16 +83,16 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, fmt.Errorf("the segment 'protectionContainerName' was not found in the resource id %q", input) + if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationProtectionContainerName' was not found in the resource id %q", input) } return &id, nil @@ -116,7 +116,7 @@ func ValidateReplicationProtectionContainerID(input interface{}, key string) (wa // ID returns the formatted Replication Protection Container ID func (id ReplicationProtectionContainerId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/replicationFabrics/%s/replicationProtectionContainers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.FabricName, id.ProtectionContainerName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.ReplicationFabricName, id.ReplicationProtectionContainerName) } // Segments returns a slice of Resource ID Segments which comprise this Replication Protection Container ID @@ -129,11 +129,11 @@ func (id ReplicationProtectionContainerId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), resourceids.StaticSegment("staticReplicationFabrics", "replicationFabrics", "replicationFabrics"), - resourceids.UserSpecifiedSegment("fabricName", "fabricValue"), + resourceids.UserSpecifiedSegment("replicationFabricName", "replicationFabricValue"), resourceids.StaticSegment("staticReplicationProtectionContainers", "replicationProtectionContainers", "replicationProtectionContainers"), - resourceids.UserSpecifiedSegment("protectionContainerName", "protectionContainerValue"), + resourceids.UserSpecifiedSegment("replicationProtectionContainerName", "replicationProtectionContainerValue"), } } @@ -142,9 +142,9 @@ func (id ReplicationProtectionContainerId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Fabric Name: %q", id.FabricName), - fmt.Sprintf("Protection Container Name: %q", id.ProtectionContainerName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Replication Fabric Name: %q", id.ReplicationFabricName), + fmt.Sprintf("Replication Protection Container Name: %q", id.ReplicationProtectionContainerName), } return fmt.Sprintf("Replication Protection Container (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go index dcf9fc60d330..d511bbf05cf1 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go @@ -11,23 +11,23 @@ var _ resourceids.ResourceId = ReplicationProtectionContainerMappingId{} // ReplicationProtectionContainerMappingId is a struct representing the Resource ID for a Replication Protection Container Mapping type ReplicationProtectionContainerMappingId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - FabricName string - ProtectionContainerName string - MappingName string + SubscriptionId string + ResourceGroupName string + VaultName string + ReplicationFabricName string + ReplicationProtectionContainerName string + ReplicationProtectionContainerMappingName string } // NewReplicationProtectionContainerMappingID returns a new ReplicationProtectionContainerMappingId struct -func NewReplicationProtectionContainerMappingID(subscriptionId string, resourceGroupName string, resourceName string, fabricName string, protectionContainerName string, mappingName string) ReplicationProtectionContainerMappingId { +func NewReplicationProtectionContainerMappingID(subscriptionId string, resourceGroupName string, vaultName string, replicationFabricName string, replicationProtectionContainerName string, replicationProtectionContainerMappingName string) ReplicationProtectionContainerMappingId { return ReplicationProtectionContainerMappingId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - FabricName: fabricName, - ProtectionContainerName: protectionContainerName, - MappingName: mappingName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + ReplicationFabricName: replicationFabricName, + ReplicationProtectionContainerName: replicationProtectionContainerName, + ReplicationProtectionContainerMappingName: replicationProtectionContainerMappingName, } } @@ -50,20 +50,20 @@ func ParseReplicationProtectionContainerMappingID(input string) (*ReplicationPro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, fmt.Errorf("the segment 'protectionContainerName' was not found in the resource id %q", input) + if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationProtectionContainerName' was not found in the resource id %q", input) } - if id.MappingName, ok = parsed.Parsed["mappingName"]; !ok { - return nil, fmt.Errorf("the segment 'mappingName' was not found in the resource id %q", input) + if id.ReplicationProtectionContainerMappingName, ok = parsed.Parsed["replicationProtectionContainerMappingName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationProtectionContainerMappingName' was not found in the resource id %q", input) } return &id, nil @@ -89,20 +89,20 @@ func ParseReplicationProtectionContainerMappingIDInsensitively(input string) (*R return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, fmt.Errorf("the segment 'protectionContainerName' was not found in the resource id %q", input) + if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationProtectionContainerName' was not found in the resource id %q", input) } - if id.MappingName, ok = parsed.Parsed["mappingName"]; !ok { - return nil, fmt.Errorf("the segment 'mappingName' was not found in the resource id %q", input) + if id.ReplicationProtectionContainerMappingName, ok = parsed.Parsed["replicationProtectionContainerMappingName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationProtectionContainerMappingName' was not found in the resource id %q", input) } return &id, nil @@ -126,7 +126,7 @@ func ValidateReplicationProtectionContainerMappingID(input interface{}, key stri // ID returns the formatted Replication Protection Container Mapping ID func (id ReplicationProtectionContainerMappingId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/replicationFabrics/%s/replicationProtectionContainers/%s/replicationProtectionContainerMappings/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.FabricName, id.ProtectionContainerName, id.MappingName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.ReplicationFabricName, id.ReplicationProtectionContainerName, id.ReplicationProtectionContainerMappingName) } // Segments returns a slice of Resource ID Segments which comprise this Replication Protection Container Mapping ID @@ -139,13 +139,13 @@ func (id ReplicationProtectionContainerMappingId) Segments() []resourceids.Segme resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), resourceids.StaticSegment("staticReplicationFabrics", "replicationFabrics", "replicationFabrics"), - resourceids.UserSpecifiedSegment("fabricName", "fabricValue"), + resourceids.UserSpecifiedSegment("replicationFabricName", "replicationFabricValue"), resourceids.StaticSegment("staticReplicationProtectionContainers", "replicationProtectionContainers", "replicationProtectionContainers"), - resourceids.UserSpecifiedSegment("protectionContainerName", "protectionContainerValue"), + resourceids.UserSpecifiedSegment("replicationProtectionContainerName", "replicationProtectionContainerValue"), resourceids.StaticSegment("staticReplicationProtectionContainerMappings", "replicationProtectionContainerMappings", "replicationProtectionContainerMappings"), - resourceids.UserSpecifiedSegment("mappingName", "mappingValue"), + resourceids.UserSpecifiedSegment("replicationProtectionContainerMappingName", "replicationProtectionContainerMappingValue"), } } @@ -154,10 +154,10 @@ func (id ReplicationProtectionContainerMappingId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Fabric Name: %q", id.FabricName), - fmt.Sprintf("Protection Container Name: %q", id.ProtectionContainerName), - fmt.Sprintf("Mapping Name: %q", id.MappingName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Replication Fabric Name: %q", id.ReplicationFabricName), + fmt.Sprintf("Replication Protection Container Name: %q", id.ReplicationProtectionContainerName), + fmt.Sprintf("Replication Protection Container Mapping Name: %q", id.ReplicationProtectionContainerMappingName), } return fmt.Sprintf("Replication Protection Container Mapping (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_vault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_vault.go index a040c864a70c..4d86e5167f94 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_vault.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_vault.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = VaultId{} type VaultId struct { SubscriptionId string ResourceGroupName string - ResourceName string + VaultName string } // NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, resourceName string) VaultId { +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { return VaultId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + VaultName: vaultName, } } @@ -44,8 +44,8 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateVaultID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Vault ID func (id VaultId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) } // Segments returns a slice of Resource ID Segments which comprise this Vault ID @@ -109,7 +109,7 @@ func (id VaultId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), } } @@ -118,7 +118,7 @@ func (id VaultId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Vault Name: %q", id.VaultName), } return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/README.md index df7a41fe38c6..d24075d47ff0 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := replicationprotectioncontainers.NewReplicationProtectionContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue") +id := replicationprotectioncontainers.NewReplicationProtectionContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue") payload := replicationprotectioncontainers.CreateProtectionContainerInput{ // ... @@ -41,7 +41,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotectioncontainers.NewReplicationProtectionContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue") +id := replicationprotectioncontainers.NewReplicationProtectionContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationprotectioncontainers.NewReplicationProtectionContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue") +id := replicationprotectioncontainers.NewReplicationProtectionContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue") payload := replicationprotectioncontainers.DiscoverProtectableItemRequest{ // ... @@ -70,7 +70,7 @@ if err := client.DiscoverProtectableItemThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationprotectioncontainers.NewReplicationProtectionContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue") +id := replicationprotectioncontainers.NewReplicationProtectionContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue") read, err := client.Get(ctx, id) if err != nil { @@ -86,7 +86,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := replicationprotectioncontainers.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := replicationprotectioncontainers.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) @@ -103,7 +103,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := replicationprotectioncontainers.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue") +id := replicationprotectioncontainers.NewReplicationFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue") // alternatively `client.ListByReplicationFabrics(ctx, id)` can be used to do batched pagination items, err := client.ListByReplicationFabricsComplete(ctx, id) @@ -120,7 +120,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := replicationprotectioncontainers.NewReplicationProtectionContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "fabricValue", "protectionContainerValue") +id := replicationprotectioncontainers.NewReplicationProtectionContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationFabricValue", "replicationProtectionContainerValue") payload := replicationprotectioncontainers.SwitchProtectionInput{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationfabric.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationfabric.go index ac91afea4f3c..679485cb0120 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationfabric.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationfabric.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = ReplicationFabricId{} // ReplicationFabricId is a struct representing the Resource ID for a Replication Fabric type ReplicationFabricId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - FabricName string + SubscriptionId string + ResourceGroupName string + VaultName string + ReplicationFabricName string } // NewReplicationFabricID returns a new ReplicationFabricId struct -func NewReplicationFabricID(subscriptionId string, resourceGroupName string, resourceName string, fabricName string) ReplicationFabricId { +func NewReplicationFabricID(subscriptionId string, resourceGroupName string, vaultName string, replicationFabricName string) ReplicationFabricId { return ReplicationFabricId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - FabricName: fabricName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + ReplicationFabricName: replicationFabricName, } } @@ -46,12 +46,12 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateReplicationFabricID(input interface{}, key string) (warnings []stri // ID returns the formatted Replication Fabric ID func (id ReplicationFabricId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/replicationFabrics/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.FabricName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.ReplicationFabricName) } // Segments returns a slice of Resource ID Segments which comprise this Replication Fabric ID @@ -119,9 +119,9 @@ func (id ReplicationFabricId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), resourceids.StaticSegment("staticReplicationFabrics", "replicationFabrics", "replicationFabrics"), - resourceids.UserSpecifiedSegment("fabricName", "fabricValue"), + resourceids.UserSpecifiedSegment("replicationFabricName", "replicationFabricValue"), } } @@ -130,8 +130,8 @@ func (id ReplicationFabricId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Fabric Name: %q", id.FabricName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Replication Fabric Name: %q", id.ReplicationFabricName), } return fmt.Sprintf("Replication Fabric (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go index b8e9577c1a88..34883e8c64cf 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go @@ -11,21 +11,21 @@ var _ resourceids.ResourceId = ReplicationProtectionContainerId{} // ReplicationProtectionContainerId is a struct representing the Resource ID for a Replication Protection Container type ReplicationProtectionContainerId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - FabricName string - ProtectionContainerName string + SubscriptionId string + ResourceGroupName string + VaultName string + ReplicationFabricName string + ReplicationProtectionContainerName string } // NewReplicationProtectionContainerID returns a new ReplicationProtectionContainerId struct -func NewReplicationProtectionContainerID(subscriptionId string, resourceGroupName string, resourceName string, fabricName string, protectionContainerName string) ReplicationProtectionContainerId { +func NewReplicationProtectionContainerID(subscriptionId string, resourceGroupName string, vaultName string, replicationFabricName string, replicationProtectionContainerName string) ReplicationProtectionContainerId { return ReplicationProtectionContainerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - FabricName: fabricName, - ProtectionContainerName: protectionContainerName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + ReplicationFabricName: replicationFabricName, + ReplicationProtectionContainerName: replicationProtectionContainerName, } } @@ -48,16 +48,16 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, fmt.Errorf("the segment 'protectionContainerName' was not found in the resource id %q", input) + if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationProtectionContainerName' was not found in the resource id %q", input) } return &id, nil @@ -83,16 +83,16 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.FabricName, ok = parsed.Parsed["fabricName"]; !ok { - return nil, fmt.Errorf("the segment 'fabricName' was not found in the resource id %q", input) + if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationFabricName' was not found in the resource id %q", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, fmt.Errorf("the segment 'protectionContainerName' was not found in the resource id %q", input) + if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationProtectionContainerName' was not found in the resource id %q", input) } return &id, nil @@ -116,7 +116,7 @@ func ValidateReplicationProtectionContainerID(input interface{}, key string) (wa // ID returns the formatted Replication Protection Container ID func (id ReplicationProtectionContainerId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/replicationFabrics/%s/replicationProtectionContainers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.FabricName, id.ProtectionContainerName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.ReplicationFabricName, id.ReplicationProtectionContainerName) } // Segments returns a slice of Resource ID Segments which comprise this Replication Protection Container ID @@ -129,11 +129,11 @@ func (id ReplicationProtectionContainerId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), resourceids.StaticSegment("staticReplicationFabrics", "replicationFabrics", "replicationFabrics"), - resourceids.UserSpecifiedSegment("fabricName", "fabricValue"), + resourceids.UserSpecifiedSegment("replicationFabricName", "replicationFabricValue"), resourceids.StaticSegment("staticReplicationProtectionContainers", "replicationProtectionContainers", "replicationProtectionContainers"), - resourceids.UserSpecifiedSegment("protectionContainerName", "protectionContainerValue"), + resourceids.UserSpecifiedSegment("replicationProtectionContainerName", "replicationProtectionContainerValue"), } } @@ -142,9 +142,9 @@ func (id ReplicationProtectionContainerId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Fabric Name: %q", id.FabricName), - fmt.Sprintf("Protection Container Name: %q", id.ProtectionContainerName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Replication Fabric Name: %q", id.ReplicationFabricName), + fmt.Sprintf("Replication Protection Container Name: %q", id.ReplicationProtectionContainerName), } return fmt.Sprintf("Replication Protection Container (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_vault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_vault.go index c4caf26ba90c..6cea36697233 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_vault.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_vault.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = VaultId{} type VaultId struct { SubscriptionId string ResourceGroupName string - ResourceName string + VaultName string } // NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, resourceName string) VaultId { +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { return VaultId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + VaultName: vaultName, } } @@ -44,8 +44,8 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateVaultID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Vault ID func (id VaultId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) } // Segments returns a slice of Resource ID Segments which comprise this Vault ID @@ -109,7 +109,7 @@ func (id VaultId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), } } @@ -118,7 +118,7 @@ func (id VaultId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Vault Name: %q", id.VaultName), } return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/README.md index 8df5b330f535..5cc93729729f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "recoveryPlanValue") +id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationRecoveryPlanValue") payload := replicationrecoveryplans.CreateRecoveryPlanInput{ // ... @@ -41,7 +41,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "recoveryPlanValue") +id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationRecoveryPlanValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "recoveryPlanValue") +id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationRecoveryPlanValue") if err := client.FailoverCancelThenPoll(ctx, id); err != nil { // handle the error @@ -65,7 +65,7 @@ if err := client.FailoverCancelThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "recoveryPlanValue") +id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationRecoveryPlanValue") if err := client.FailoverCommitThenPoll(ctx, id); err != nil { // handle the error @@ -77,7 +77,7 @@ if err := client.FailoverCommitThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "recoveryPlanValue") +id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationRecoveryPlanValue") read, err := client.Get(ctx, id) if err != nil { @@ -93,7 +93,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := replicationrecoveryplans.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := replicationrecoveryplans.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) @@ -110,7 +110,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "recoveryPlanValue") +id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationRecoveryPlanValue") payload := replicationrecoveryplans.RecoveryPlanPlannedFailoverInput{ // ... @@ -127,7 +127,7 @@ if err := client.PlannedFailoverThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "recoveryPlanValue") +id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationRecoveryPlanValue") if err := client.ReprotectThenPoll(ctx, id); err != nil { // handle the error @@ -139,7 +139,7 @@ if err := client.ReprotectThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "recoveryPlanValue") +id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationRecoveryPlanValue") payload := replicationrecoveryplans.RecoveryPlanTestFailoverInput{ // ... @@ -156,7 +156,7 @@ if err := client.TestFailoverThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "recoveryPlanValue") +id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationRecoveryPlanValue") payload := replicationrecoveryplans.RecoveryPlanTestFailoverCleanupInput{ // ... @@ -173,7 +173,7 @@ if err := client.TestFailoverCleanupThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "recoveryPlanValue") +id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationRecoveryPlanValue") payload := replicationrecoveryplans.RecoveryPlanUnplannedFailoverInput{ // ... @@ -190,7 +190,7 @@ if err := client.UnplannedFailoverThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "recoveryPlanValue") +id := replicationrecoveryplans.NewReplicationRecoveryPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "replicationRecoveryPlanValue") payload := replicationrecoveryplans.UpdateRecoveryPlanInput{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_replicationrecoveryplan.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_replicationrecoveryplan.go index 730defc89ebc..0c1e153b24d5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_replicationrecoveryplan.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_replicationrecoveryplan.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = ReplicationRecoveryPlanId{} // ReplicationRecoveryPlanId is a struct representing the Resource ID for a Replication Recovery Plan type ReplicationRecoveryPlanId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - RecoveryPlanName string + SubscriptionId string + ResourceGroupName string + VaultName string + ReplicationRecoveryPlanName string } // NewReplicationRecoveryPlanID returns a new ReplicationRecoveryPlanId struct -func NewReplicationRecoveryPlanID(subscriptionId string, resourceGroupName string, resourceName string, recoveryPlanName string) ReplicationRecoveryPlanId { +func NewReplicationRecoveryPlanID(subscriptionId string, resourceGroupName string, vaultName string, replicationRecoveryPlanName string) ReplicationRecoveryPlanId { return ReplicationRecoveryPlanId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - RecoveryPlanName: recoveryPlanName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + ReplicationRecoveryPlanName: replicationRecoveryPlanName, } } @@ -46,12 +46,12 @@ func ParseReplicationRecoveryPlanID(input string) (*ReplicationRecoveryPlanId, e return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.RecoveryPlanName, ok = parsed.Parsed["recoveryPlanName"]; !ok { - return nil, fmt.Errorf("the segment 'recoveryPlanName' was not found in the resource id %q", input) + if id.ReplicationRecoveryPlanName, ok = parsed.Parsed["replicationRecoveryPlanName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationRecoveryPlanName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseReplicationRecoveryPlanIDInsensitively(input string) (*ReplicationReco return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } - if id.RecoveryPlanName, ok = parsed.Parsed["recoveryPlanName"]; !ok { - return nil, fmt.Errorf("the segment 'recoveryPlanName' was not found in the resource id %q", input) + if id.ReplicationRecoveryPlanName, ok = parsed.Parsed["replicationRecoveryPlanName"]; !ok { + return nil, fmt.Errorf("the segment 'replicationRecoveryPlanName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateReplicationRecoveryPlanID(input interface{}, key string) (warnings // ID returns the formatted Replication Recovery Plan ID func (id ReplicationRecoveryPlanId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/replicationRecoveryPlans/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.RecoveryPlanName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.ReplicationRecoveryPlanName) } // Segments returns a slice of Resource ID Segments which comprise this Replication Recovery Plan ID @@ -119,9 +119,9 @@ func (id ReplicationRecoveryPlanId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), resourceids.StaticSegment("staticReplicationRecoveryPlans", "replicationRecoveryPlans", "replicationRecoveryPlans"), - resourceids.UserSpecifiedSegment("recoveryPlanName", "recoveryPlanValue"), + resourceids.UserSpecifiedSegment("replicationRecoveryPlanName", "replicationRecoveryPlanValue"), } } @@ -130,8 +130,8 @@ func (id ReplicationRecoveryPlanId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Recovery Plan Name: %q", id.RecoveryPlanName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Replication Recovery Plan Name: %q", id.ReplicationRecoveryPlanName), } return fmt.Sprintf("Replication Recovery Plan (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_vault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_vault.go index 51e8eb5399a3..da7a6b63ad44 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_vault.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_vault.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = VaultId{} type VaultId struct { SubscriptionId string ResourceGroupName string - ResourceName string + VaultName string } // NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, resourceName string) VaultId { +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { return VaultId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + VaultName: vaultName, } } @@ -44,8 +44,8 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateVaultID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Vault ID func (id VaultId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) } // Segments returns a slice of Resource ID Segments which comprise this Vault ID @@ -109,7 +109,7 @@ func (id VaultId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), } } @@ -118,7 +118,7 @@ func (id VaultId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Vault Name: %q", id.VaultName), } return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/client.go new file mode 100644 index 000000000000..4cf554960a31 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/client.go @@ -0,0 +1,44 @@ +package v2021_06_01 + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources" + "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis" +) + +type Client struct { + FirewallRules *firewallrules.FirewallRulesClient + PatchSchedules *patchschedules.PatchSchedulesClient + PrivateEndpointConnections *privateendpointconnections.PrivateEndpointConnectionsClient + PrivateLinkResources *privatelinkresources.PrivateLinkResourcesClient + Redis *redis.RedisClient +} + +func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { + + firewallRulesClient := firewallrules.NewFirewallRulesClientWithBaseURI(endpoint) + configureAuthFunc(&firewallRulesClient.Client) + + patchSchedulesClient := patchschedules.NewPatchSchedulesClientWithBaseURI(endpoint) + configureAuthFunc(&patchSchedulesClient.Client) + + privateEndpointConnectionsClient := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(endpoint) + configureAuthFunc(&privateEndpointConnectionsClient.Client) + + privateLinkResourcesClient := privatelinkresources.NewPrivateLinkResourcesClientWithBaseURI(endpoint) + configureAuthFunc(&privateLinkResourcesClient.Client) + + redisClient := redis.NewRedisClientWithBaseURI(endpoint) + configureAuthFunc(&redisClient.Client) + + return Client{ + FirewallRules: &firewallRulesClient, + PatchSchedules: &patchSchedulesClient, + PrivateEndpointConnections: &privateEndpointConnectionsClient, + PrivateLinkResources: &privateLinkResourcesClient, + Redis: &redisClient, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/README.md new file mode 100644 index 000000000000..37a67eda6861 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules` Documentation + +The `firewallrules` SDK allows for interaction with the Azure Resource Manager Service `redis` (API Version `2021-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules" +``` + + +### Client Initialization + +```go +client := firewallrules.NewFirewallRulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `FirewallRulesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue", "firewallRuleValue") + +payload := firewallrules.RedisFirewallRule{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FirewallRulesClient.Delete` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue", "firewallRuleValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FirewallRulesClient.Get` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue", "firewallRuleValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FirewallRulesClient.List` + +```go +ctx := context.TODO() +id := firewallrules.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/client.go new file mode 100644 index 000000000000..ac01b0459a14 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/client.go @@ -0,0 +1,18 @@ +package firewallrules + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRulesClient struct { + Client autorest.Client + baseUri string +} + +func NewFirewallRulesClientWithBaseURI(endpoint string) FirewallRulesClient { + return FirewallRulesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/id_firewallrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/id_firewallrule.go new file mode 100644 index 000000000000..7663017249c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/id_firewallrule.go @@ -0,0 +1,137 @@ +package firewallrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FirewallRuleId{} + +// FirewallRuleId is a struct representing the Resource ID for a Firewall Rule +type FirewallRuleId struct { + SubscriptionId string + ResourceGroupName string + RedisName string + FirewallRuleName string +} + +// NewFirewallRuleID returns a new FirewallRuleId struct +func NewFirewallRuleID(subscriptionId string, resourceGroupName string, redisName string, firewallRuleName string) FirewallRuleId { + return FirewallRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisName: redisName, + FirewallRuleName: firewallRuleName, + } +} + +// ParseFirewallRuleID parses 'input' into a FirewallRuleId +func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FirewallRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'firewallRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFirewallRuleIDInsensitively parses 'input' case-insensitively into a FirewallRuleId +// note: this method should only be used for API response data and not user input +func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FirewallRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'firewallRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID +func ValidateFirewallRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFirewallRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Firewall Rule ID +func (id FirewallRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redis/%s/firewallRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisName, id.FirewallRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Firewall Rule ID +func (id FirewallRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedis", "redis", "redis"), + resourceids.UserSpecifiedSegment("redisName", "redisValue"), + resourceids.StaticSegment("staticFirewallRules", "firewallRules", "firewallRules"), + resourceids.UserSpecifiedSegment("firewallRuleName", "firewallRuleValue"), + } +} + +// String returns a human-readable description of this Firewall Rule ID +func (id FirewallRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Name: %q", id.RedisName), + fmt.Sprintf("Firewall Rule Name: %q", id.FirewallRuleName), + } + return fmt.Sprintf("Firewall Rule (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/id_redi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/id_redi.go new file mode 100644 index 000000000000..e9eeb65b7edd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/id_redi.go @@ -0,0 +1,124 @@ +package firewallrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RediId{} + +// RediId is a struct representing the Resource ID for a Redi +type RediId struct { + SubscriptionId string + ResourceGroupName string + RedisName string +} + +// NewRediID returns a new RediId struct +func NewRediID(subscriptionId string, resourceGroupName string, redisName string) RediId { + return RediId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisName: redisName, + } +} + +// ParseRediID parses 'input' into a RediId +func ParseRediID(input string) (*RediId, error) { + parser := resourceids.NewParserFromResourceIdType(RediId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RediId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRediIDInsensitively parses 'input' case-insensitively into a RediId +// note: this method should only be used for API response data and not user input +func ParseRediIDInsensitively(input string) (*RediId, error) { + parser := resourceids.NewParserFromResourceIdType(RediId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RediId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRediID checks that 'input' can be parsed as a Redi ID +func ValidateRediID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRediID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Redi ID +func (id RediId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redis/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Redi ID +func (id RediId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedis", "redis", "redis"), + resourceids.UserSpecifiedSegment("redisName", "redisValue"), + } +} + +// String returns a human-readable description of this Redi ID +func (id RediId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Name: %q", id.RedisName), + } + return fmt.Sprintf("Redi (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/method_createorupdate_autorest.go new file mode 100644 index 000000000000..d904df8e9485 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package firewallrules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *RedisFirewallRule +} + +// CreateOrUpdate ... +func (c FirewallRulesClient) CreateOrUpdate(ctx context.Context, id FirewallRuleId, input RedisFirewallRule) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c FirewallRulesClient) preparerForCreateOrUpdate(ctx context.Context, id FirewallRuleId, input RedisFirewallRule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c FirewallRulesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/method_delete_autorest.go new file mode 100644 index 000000000000..c250306a893f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/method_delete_autorest.go @@ -0,0 +1,66 @@ +package firewallrules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c FirewallRulesClient) Delete(ctx context.Context, id FirewallRuleId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c FirewallRulesClient) preparerForDelete(ctx context.Context, id FirewallRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c FirewallRulesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/method_get_autorest.go new file mode 100644 index 000000000000..6224dad211e0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/method_get_autorest.go @@ -0,0 +1,68 @@ +package firewallrules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *RedisFirewallRule +} + +// Get ... +func (c FirewallRulesClient) Get(ctx context.Context, id FirewallRuleId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c FirewallRulesClient) preparerForGet(ctx context.Context, id FirewallRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c FirewallRulesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/method_list_autorest.go new file mode 100644 index 000000000000..ad115f23a3d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/method_list_autorest.go @@ -0,0 +1,186 @@ +package firewallrules + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]RedisFirewallRule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []RedisFirewallRule +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c FirewallRulesClient) List(ctx context.Context, id RediId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c FirewallRulesClient) preparerForList(ctx context.Context, id RediId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/firewallRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c FirewallRulesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c FirewallRulesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []RedisFirewallRule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c FirewallRulesClient) ListComplete(ctx context.Context, id RediId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, RedisFirewallRuleOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c FirewallRulesClient) ListCompleteMatchingPredicate(ctx context.Context, id RediId, predicate RedisFirewallRuleOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]RedisFirewallRule, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/model_redisfirewallrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/model_redisfirewallrule.go new file mode 100644 index 000000000000..3188f87b41b8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/model_redisfirewallrule.go @@ -0,0 +1,11 @@ +package firewallrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisFirewallRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties RedisFirewallRuleProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/model_redisfirewallruleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/model_redisfirewallruleproperties.go new file mode 100644 index 000000000000..66e289c35ff2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/model_redisfirewallruleproperties.go @@ -0,0 +1,9 @@ +package firewallrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisFirewallRuleProperties struct { + EndIP string `json:"endIP"` + StartIP string `json:"startIP"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/predicates.go new file mode 100644 index 000000000000..79d26b7ae3ed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/predicates.go @@ -0,0 +1,24 @@ +package firewallrules + +type RedisFirewallRuleOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p RedisFirewallRuleOperationPredicate) Matches(input RedisFirewallRule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/version.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules/version.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/README.md new file mode 100644 index 000000000000..756597b63147 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules` Documentation + +The `patchschedules` SDK allows for interaction with the Azure Resource Manager Service `redis` (API Version `2021-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules" +``` + + +### Client Initialization + +```go +client := patchschedules.NewPatchSchedulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PatchSchedulesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := patchschedules.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +payload := patchschedules.RedisPatchSchedule{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PatchSchedulesClient.Delete` + +```go +ctx := context.TODO() +id := patchschedules.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PatchSchedulesClient.Get` + +```go +ctx := context.TODO() +id := patchschedules.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PatchSchedulesClient.ListByRedisResource` + +```go +ctx := context.TODO() +id := patchschedules.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +// alternatively `client.ListByRedisResource(ctx, id)` can be used to do batched pagination +items, err := client.ListByRedisResourceComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/client.go new file mode 100644 index 000000000000..9950c44d3c0e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/client.go @@ -0,0 +1,18 @@ +package patchschedules + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSchedulesClient struct { + Client autorest.Client + baseUri string +} + +func NewPatchSchedulesClientWithBaseURI(endpoint string) PatchSchedulesClient { + return PatchSchedulesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/constants.go new file mode 100644 index 000000000000..1bbfa711c2f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/constants.go @@ -0,0 +1,55 @@ +package patchschedules + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DayOfWeek string + +const ( + DayOfWeekEveryday DayOfWeek = "Everyday" + DayOfWeekFriday DayOfWeek = "Friday" + DayOfWeekMonday DayOfWeek = "Monday" + DayOfWeekSaturday DayOfWeek = "Saturday" + DayOfWeekSunday DayOfWeek = "Sunday" + DayOfWeekThursday DayOfWeek = "Thursday" + DayOfWeekTuesday DayOfWeek = "Tuesday" + DayOfWeekWednesday DayOfWeek = "Wednesday" + DayOfWeekWeekend DayOfWeek = "Weekend" +) + +func PossibleValuesForDayOfWeek() []string { + return []string{ + string(DayOfWeekEveryday), + string(DayOfWeekFriday), + string(DayOfWeekMonday), + string(DayOfWeekSaturday), + string(DayOfWeekSunday), + string(DayOfWeekThursday), + string(DayOfWeekTuesday), + string(DayOfWeekWednesday), + string(DayOfWeekWeekend), + } +} + +func parseDayOfWeek(input string) (*DayOfWeek, error) { + vals := map[string]DayOfWeek{ + "everyday": DayOfWeekEveryday, + "friday": DayOfWeekFriday, + "monday": DayOfWeekMonday, + "saturday": DayOfWeekSaturday, + "sunday": DayOfWeekSunday, + "thursday": DayOfWeekThursday, + "tuesday": DayOfWeekTuesday, + "wednesday": DayOfWeekWednesday, + "weekend": DayOfWeekWeekend, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DayOfWeek(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/id_redi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/id_redi.go new file mode 100644 index 000000000000..a2e7721940a9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/id_redi.go @@ -0,0 +1,124 @@ +package patchschedules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RediId{} + +// RediId is a struct representing the Resource ID for a Redi +type RediId struct { + SubscriptionId string + ResourceGroupName string + RedisName string +} + +// NewRediID returns a new RediId struct +func NewRediID(subscriptionId string, resourceGroupName string, redisName string) RediId { + return RediId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisName: redisName, + } +} + +// ParseRediID parses 'input' into a RediId +func ParseRediID(input string) (*RediId, error) { + parser := resourceids.NewParserFromResourceIdType(RediId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RediId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRediIDInsensitively parses 'input' case-insensitively into a RediId +// note: this method should only be used for API response data and not user input +func ParseRediIDInsensitively(input string) (*RediId, error) { + parser := resourceids.NewParserFromResourceIdType(RediId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RediId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRediID checks that 'input' can be parsed as a Redi ID +func ValidateRediID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRediID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Redi ID +func (id RediId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redis/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Redi ID +func (id RediId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedis", "redis", "redis"), + resourceids.UserSpecifiedSegment("redisName", "redisValue"), + } +} + +// String returns a human-readable description of this Redi ID +func (id RediId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Name: %q", id.RedisName), + } + return fmt.Sprintf("Redi (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/method_createorupdate_autorest.go new file mode 100644 index 000000000000..804d3c7d0e40 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/method_createorupdate_autorest.go @@ -0,0 +1,70 @@ +package patchschedules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *RedisPatchSchedule +} + +// CreateOrUpdate ... +func (c PatchSchedulesClient) CreateOrUpdate(ctx context.Context, id RediId, input RedisPatchSchedule) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "patchschedules.PatchSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "patchschedules.PatchSchedulesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "patchschedules.PatchSchedulesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c PatchSchedulesClient) preparerForCreateOrUpdate(ctx context.Context, id RediId, input RedisPatchSchedule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/patchSchedules/default", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c PatchSchedulesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/method_delete_autorest.go new file mode 100644 index 000000000000..f51c9818c15b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/method_delete_autorest.go @@ -0,0 +1,67 @@ +package patchschedules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c PatchSchedulesClient) Delete(ctx context.Context, id RediId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "patchschedules.PatchSchedulesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "patchschedules.PatchSchedulesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "patchschedules.PatchSchedulesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c PatchSchedulesClient) preparerForDelete(ctx context.Context, id RediId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/patchSchedules/default", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c PatchSchedulesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/method_get_autorest.go new file mode 100644 index 000000000000..77a94c710c52 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/method_get_autorest.go @@ -0,0 +1,69 @@ +package patchschedules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *RedisPatchSchedule +} + +// Get ... +func (c PatchSchedulesClient) Get(ctx context.Context, id RediId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "patchschedules.PatchSchedulesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "patchschedules.PatchSchedulesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "patchschedules.PatchSchedulesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c PatchSchedulesClient) preparerForGet(ctx context.Context, id RediId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/patchSchedules/default", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c PatchSchedulesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/method_listbyredisresource_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/method_listbyredisresource_autorest.go new file mode 100644 index 000000000000..c1549023b72c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/method_listbyredisresource_autorest.go @@ -0,0 +1,186 @@ +package patchschedules + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByRedisResourceOperationResponse struct { + HttpResponse *http.Response + Model *[]RedisPatchSchedule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByRedisResourceOperationResponse, error) +} + +type ListByRedisResourceCompleteResult struct { + Items []RedisPatchSchedule +} + +func (r ListByRedisResourceOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByRedisResourceOperationResponse) LoadMore(ctx context.Context) (resp ListByRedisResourceOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByRedisResource ... +func (c PatchSchedulesClient) ListByRedisResource(ctx context.Context, id RediId) (resp ListByRedisResourceOperationResponse, err error) { + req, err := c.preparerForListByRedisResource(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "patchschedules.PatchSchedulesClient", "ListByRedisResource", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "patchschedules.PatchSchedulesClient", "ListByRedisResource", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByRedisResource(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "patchschedules.PatchSchedulesClient", "ListByRedisResource", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByRedisResource prepares the ListByRedisResource request. +func (c PatchSchedulesClient) preparerForListByRedisResource(ctx context.Context, id RediId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/patchSchedules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByRedisResourceWithNextLink prepares the ListByRedisResource request with the given nextLink token. +func (c PatchSchedulesClient) preparerForListByRedisResourceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByRedisResource handles the response to the ListByRedisResource request. The method always +// closes the http.Response Body. +func (c PatchSchedulesClient) responderForListByRedisResource(resp *http.Response) (result ListByRedisResourceOperationResponse, err error) { + type page struct { + Values []RedisPatchSchedule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByRedisResourceOperationResponse, err error) { + req, err := c.preparerForListByRedisResourceWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "patchschedules.PatchSchedulesClient", "ListByRedisResource", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "patchschedules.PatchSchedulesClient", "ListByRedisResource", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByRedisResource(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "patchschedules.PatchSchedulesClient", "ListByRedisResource", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByRedisResourceComplete retrieves all of the results into a single object +func (c PatchSchedulesClient) ListByRedisResourceComplete(ctx context.Context, id RediId) (ListByRedisResourceCompleteResult, error) { + return c.ListByRedisResourceCompleteMatchingPredicate(ctx, id, RedisPatchScheduleOperationPredicate{}) +} + +// ListByRedisResourceCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PatchSchedulesClient) ListByRedisResourceCompleteMatchingPredicate(ctx context.Context, id RediId, predicate RedisPatchScheduleOperationPredicate) (resp ListByRedisResourceCompleteResult, err error) { + items := make([]RedisPatchSchedule, 0) + + page, err := c.ListByRedisResource(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByRedisResourceCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/model_redispatchschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/model_redispatchschedule.go new file mode 100644 index 000000000000..a1b9d61c7684 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/model_redispatchschedule.go @@ -0,0 +1,12 @@ +package patchschedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisPatchSchedule struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ScheduleEntries `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/model_scheduleentries.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/model_scheduleentries.go new file mode 100644 index 000000000000..d8f2f8f71327 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/model_scheduleentries.go @@ -0,0 +1,8 @@ +package patchschedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleEntries struct { + ScheduleEntries []ScheduleEntry `json:"scheduleEntries"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/model_scheduleentry.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/model_scheduleentry.go new file mode 100644 index 000000000000..d0c7b04586c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/model_scheduleentry.go @@ -0,0 +1,10 @@ +package patchschedules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleEntry struct { + DayOfWeek DayOfWeek `json:"dayOfWeek"` + MaintenanceWindow *string `json:"maintenanceWindow,omitempty"` + StartHourUtc int64 `json:"startHourUtc"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/predicates.go new file mode 100644 index 000000000000..ab8b41c66c77 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/predicates.go @@ -0,0 +1,29 @@ +package patchschedules + +type RedisPatchScheduleOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p RedisPatchScheduleOperationPredicate) Matches(input RedisPatchSchedule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/version.go new file mode 100644 index 000000000000..98f2c90925f5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules/version.go @@ -0,0 +1,12 @@ +package patchschedules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/patchschedules/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/README.md new file mode 100644 index 000000000000..385e64361a07 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/README.md @@ -0,0 +1,85 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections` Documentation + +The `privateendpointconnections` SDK allows for interaction with the Azure Resource Manager Service `redis` (API Version `2021-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections" +``` + + +### Client Initialization + +```go +client := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Delete` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue", "privateEndpointConnectionValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Get` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue", "privateEndpointConnectionValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.List` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Put` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue", "privateEndpointConnectionValue") + +payload := privateendpointconnections.PrivateEndpointConnection{ + // ... +} + + +if err := client.PutThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/client.go new file mode 100644 index 000000000000..1de584406fe4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/client.go @@ -0,0 +1,18 @@ +package privateendpointconnections + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionsClient struct { + Client autorest.Client + baseUri string +} + +func NewPrivateEndpointConnectionsClientWithBaseURI(endpoint string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/constants.go new file mode 100644 index 000000000000..b6aed9e880a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/constants.go @@ -0,0 +1,71 @@ +package privateendpointconnections + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + } +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { + return []string{ + string(PrivateEndpointServiceConnectionStatusApproved), + string(PrivateEndpointServiceConnectionStatusPending), + string(PrivateEndpointServiceConnectionStatusRejected), + } +} + +func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { + vals := map[string]PrivateEndpointServiceConnectionStatus{ + "approved": PrivateEndpointServiceConnectionStatusApproved, + "pending": PrivateEndpointServiceConnectionStatusPending, + "rejected": PrivateEndpointServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointServiceConnectionStatus(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/id_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/id_privateendpointconnection.go new file mode 100644 index 000000000000..2a5eaccbfe04 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/id_privateendpointconnection.go @@ -0,0 +1,137 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PrivateEndpointConnectionId{} + +// PrivateEndpointConnectionId is a struct representing the Resource ID for a Private Endpoint Connection +type PrivateEndpointConnectionId struct { + SubscriptionId string + ResourceGroupName string + RedisName string + PrivateEndpointConnectionName string +} + +// NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, redisName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { + return PrivateEndpointConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisName: redisName, + PrivateEndpointConnectionName: privateEndpointConnectionName, + } +} + +// ParsePrivateEndpointConnectionID parses 'input' into a PrivateEndpointConnectionId +func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateEndpointConnectionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePrivateEndpointConnectionIDInsensitively parses 'input' case-insensitively into a PrivateEndpointConnectionId +// note: this method should only be used for API response data and not user input +func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateEndpointConnectionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'privateEndpointConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID +func ValidatePrivateEndpointConnectionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePrivateEndpointConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redis/%s/privateEndpointConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisName, id.PrivateEndpointConnectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedis", "redis", "redis"), + resourceids.UserSpecifiedSegment("redisName", "redisValue"), + resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), + resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionValue"), + } +} + +// String returns a human-readable description of this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Name: %q", id.RedisName), + fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), + } + return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/id_redi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/id_redi.go new file mode 100644 index 000000000000..9cd76a504492 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/id_redi.go @@ -0,0 +1,124 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RediId{} + +// RediId is a struct representing the Resource ID for a Redi +type RediId struct { + SubscriptionId string + ResourceGroupName string + RedisName string +} + +// NewRediID returns a new RediId struct +func NewRediID(subscriptionId string, resourceGroupName string, redisName string) RediId { + return RediId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisName: redisName, + } +} + +// ParseRediID parses 'input' into a RediId +func ParseRediID(input string) (*RediId, error) { + parser := resourceids.NewParserFromResourceIdType(RediId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RediId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRediIDInsensitively parses 'input' case-insensitively into a RediId +// note: this method should only be used for API response data and not user input +func ParseRediIDInsensitively(input string) (*RediId, error) { + parser := resourceids.NewParserFromResourceIdType(RediId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RediId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRediID checks that 'input' can be parsed as a Redi ID +func ValidateRediID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRediID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Redi ID +func (id RediId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redis/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Redi ID +func (id RediId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedis", "redis", "redis"), + resourceids.UserSpecifiedSegment("redisName", "redisValue"), + } +} + +// String returns a human-readable description of this Redi ID +func (id RediId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Name: %q", id.RedisName), + } + return fmt.Sprintf("Redi (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/method_delete_autorest.go new file mode 100644 index 000000000000..b722e5929ec5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/method_delete_autorest.go @@ -0,0 +1,66 @@ +package privateendpointconnections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c PrivateEndpointConnectionsClient) Delete(ctx context.Context, id PrivateEndpointConnectionId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c PrivateEndpointConnectionsClient) preparerForDelete(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/method_get_autorest.go new file mode 100644 index 000000000000..44bbdcb8f0bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/method_get_autorest.go @@ -0,0 +1,68 @@ +package privateendpointconnections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *PrivateEndpointConnection +} + +// Get ... +func (c PrivateEndpointConnectionsClient) Get(ctx context.Context, id PrivateEndpointConnectionId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c PrivateEndpointConnectionsClient) preparerForGet(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/method_list_autorest.go new file mode 100644 index 000000000000..a7c7155d4dd4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/method_list_autorest.go @@ -0,0 +1,69 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *PrivateEndpointConnectionListResult +} + +// List ... +func (c PrivateEndpointConnectionsClient) List(ctx context.Context, id RediId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c PrivateEndpointConnectionsClient) preparerForList(ctx context.Context, id RediId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/privateEndpointConnections", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/method_put_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/method_put_autorest.go new file mode 100644 index 000000000000..6020f9e8b91c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/method_put_autorest.go @@ -0,0 +1,79 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PutOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Put ... +func (c PrivateEndpointConnectionsClient) Put(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result PutOperationResponse, err error) { + req, err := c.preparerForPut(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Put", nil, "Failure preparing request") + return + } + + result, err = c.senderForPut(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnections.PrivateEndpointConnectionsClient", "Put", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// PutThenPoll performs Put then polls until it's completed +func (c PrivateEndpointConnectionsClient) PutThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) error { + result, err := c.Put(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Put: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Put: %+v", err) + } + + return nil +} + +// preparerForPut prepares the Put request. +func (c PrivateEndpointConnectionsClient) preparerForPut(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForPut sends the Put request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateEndpointConnectionsClient) senderForPut(ctx context.Context, req *http.Request) (future PutOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/model_privateendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/model_privateendpoint.go new file mode 100644 index 000000000000..1bc8cf2a97c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/model_privateendpoint.go @@ -0,0 +1,8 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/model_privateendpointconnection.go new file mode 100644 index 000000000000..fde7f4db0fc0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privateendpointconnectionlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/model_privateendpointconnectionlistresult.go similarity index 88% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privateendpointconnectionlistresult.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/model_privateendpointconnectionlistresult.go index 82d2b5727e1c..92a9ecb105a6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privateendpointconnectionlistresult.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/model_privateendpointconnectionlistresult.go @@ -1,4 +1,4 @@ -package accounts +package privateendpointconnections // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/model_privateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/model_privateendpointconnectionproperties.go new file mode 100644 index 000000000000..549d255f0696 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/model_privatelinkserviceconnectionstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/model_privatelinkserviceconnectionstate.go new file mode 100644 index 000000000000..ec3f7a9f24cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/version.go new file mode 100644 index 000000000000..0d17055f179a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections/version.go @@ -0,0 +1,12 @@ +package privateendpointconnections + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/privateendpointconnections/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/README.md new file mode 100644 index 000000000000..20bd272296ee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/README.md @@ -0,0 +1,36 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources` Documentation + +The `privatelinkresources` SDK allows for interaction with the Azure Resource Manager Service `redis` (API Version `2021-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources" +``` + + +### Client Initialization + +```go +client := privatelinkresources.NewPrivateLinkResourcesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateLinkResourcesClient.ListByRedisCache` + +```go +ctx := context.TODO() +id := privatelinkresources.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +read, err := client.ListByRedisCache(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/client.go new file mode 100644 index 000000000000..5f532940700f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/client.go @@ -0,0 +1,18 @@ +package privatelinkresources + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkResourcesClient struct { + Client autorest.Client + baseUri string +} + +func NewPrivateLinkResourcesClientWithBaseURI(endpoint string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/id_redi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/id_redi.go new file mode 100644 index 000000000000..8b4ff8729660 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/id_redi.go @@ -0,0 +1,124 @@ +package privatelinkresources + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RediId{} + +// RediId is a struct representing the Resource ID for a Redi +type RediId struct { + SubscriptionId string + ResourceGroupName string + RedisName string +} + +// NewRediID returns a new RediId struct +func NewRediID(subscriptionId string, resourceGroupName string, redisName string) RediId { + return RediId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisName: redisName, + } +} + +// ParseRediID parses 'input' into a RediId +func ParseRediID(input string) (*RediId, error) { + parser := resourceids.NewParserFromResourceIdType(RediId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RediId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRediIDInsensitively parses 'input' case-insensitively into a RediId +// note: this method should only be used for API response data and not user input +func ParseRediIDInsensitively(input string) (*RediId, error) { + parser := resourceids.NewParserFromResourceIdType(RediId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RediId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRediID checks that 'input' can be parsed as a Redi ID +func ValidateRediID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRediID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Redi ID +func (id RediId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redis/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Redi ID +func (id RediId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedis", "redis", "redis"), + resourceids.UserSpecifiedSegment("redisName", "redisValue"), + } +} + +// String returns a human-readable description of this Redi ID +func (id RediId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Name: %q", id.RedisName), + } + return fmt.Sprintf("Redi (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/method_listbyrediscache_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/method_listbyrediscache_autorest.go new file mode 100644 index 000000000000..402f9f1e2490 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/method_listbyrediscache_autorest.go @@ -0,0 +1,69 @@ +package privatelinkresources + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByRedisCacheOperationResponse struct { + HttpResponse *http.Response + Model *PrivateLinkResourceListResult +} + +// ListByRedisCache ... +func (c PrivateLinkResourcesClient) ListByRedisCache(ctx context.Context, id RediId) (result ListByRedisCacheOperationResponse, err error) { + req, err := c.preparerForListByRedisCache(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privatelinkresources.PrivateLinkResourcesClient", "ListByRedisCache", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privatelinkresources.PrivateLinkResourcesClient", "ListByRedisCache", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByRedisCache(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privatelinkresources.PrivateLinkResourcesClient", "ListByRedisCache", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByRedisCache prepares the ListByRedisCache request. +func (c PrivateLinkResourcesClient) preparerForListByRedisCache(ctx context.Context, id RediId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/privateLinkResources", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByRedisCache handles the response to the ListByRedisCache request. The method always +// closes the http.Response Body. +func (c PrivateLinkResourcesClient) responderForListByRedisCache(resp *http.Response) (result ListByRedisCacheOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privatelinkresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/model_privatelinkresource.go similarity index 94% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privatelinkresource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/model_privatelinkresource.go index dc2a3eb52827..69e8ae0e57a0 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privatelinkresource.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/model_privatelinkresource.go @@ -1,4 +1,4 @@ -package accounts +package privatelinkresources // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privatelinkresourcelistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/model_privatelinkresourcelistresult.go similarity index 89% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privatelinkresourcelistresult.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/model_privatelinkresourcelistresult.go index cc200b3f03a4..fa950217c477 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privatelinkresourcelistresult.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/model_privatelinkresourcelistresult.go @@ -1,4 +1,4 @@ -package accounts +package privatelinkresources // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privatelinkresourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/model_privatelinkresourceproperties.go similarity index 93% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privatelinkresourceproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/model_privatelinkresourceproperties.go index fb7c9a24b991..3c98012cdd1e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts/model_privatelinkresourceproperties.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/model_privatelinkresourceproperties.go @@ -1,4 +1,4 @@ -package accounts +package privatelinkresources // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/version.go new file mode 100644 index 000000000000..4ee29f52669e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources/version.go @@ -0,0 +1,12 @@ +package privatelinkresources + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/privatelinkresources/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/README.md new file mode 100644 index 000000000000..f5f62f01f09a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/README.md @@ -0,0 +1,456 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis` Documentation + +The `redis` SDK allows for interaction with the Azure Resource Manager Service `redis` (API Version `2021-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis" +``` + + +### Client Initialization + +```go +client := redis.NewRedisClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RedisClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := redis.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := redis.CheckNameAvailabilityParameters{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisClient.Create` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +payload := redis.RedisCreateParameters{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisClient.Delete` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisClient.ExportData` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +payload := redis.ExportRDBParameters{ + // ... +} + + +if err := client.ExportDataThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisClient.FirewallRulesCreateOrUpdate` + +```go +ctx := context.TODO() +id := redis.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue", "firewallRuleValue") + +payload := redis.RedisFirewallRule{ + // ... +} + + +read, err := client.FirewallRulesCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisClient.FirewallRulesDelete` + +```go +ctx := context.TODO() +id := redis.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue", "firewallRuleValue") + +read, err := client.FirewallRulesDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisClient.FirewallRulesGet` + +```go +ctx := context.TODO() +id := redis.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue", "firewallRuleValue") + +read, err := client.FirewallRulesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisClient.FirewallRulesList` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +// alternatively `client.FirewallRulesList(ctx, id)` can be used to do batched pagination +items, err := client.FirewallRulesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RedisClient.ForceReboot` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +payload := redis.RedisRebootParameters{ + // ... +} + + +read, err := client.ForceReboot(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisClient.Get` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisClient.ImportData` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +payload := redis.ImportRDBParameters{ + // ... +} + + +if err := client.ImportDataThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisClient.LinkedServerCreate` + +```go +ctx := context.TODO() +id := redis.NewLinkedServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue", "linkedServerValue") + +payload := redis.RedisLinkedServerCreateParameters{ + // ... +} + + +if err := client.LinkedServerCreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisClient.LinkedServerDelete` + +```go +ctx := context.TODO() +id := redis.NewLinkedServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue", "linkedServerValue") + +read, err := client.LinkedServerDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisClient.LinkedServerGet` + +```go +ctx := context.TODO() +id := redis.NewLinkedServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue", "linkedServerValue") + +read, err := client.LinkedServerGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisClient.LinkedServerList` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +// alternatively `client.LinkedServerList(ctx, id)` can be used to do batched pagination +items, err := client.LinkedServerListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RedisClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := redis.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RedisClient.ListBySubscription` + +```go +ctx := context.TODO() +id := redis.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RedisClient.ListKeys` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +read, err := client.ListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisClient.ListUpgradeNotifications` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +// alternatively `client.ListUpgradeNotifications(ctx, id, redis.DefaultListUpgradeNotificationsOperationOptions())` can be used to do batched pagination +items, err := client.ListUpgradeNotificationsComplete(ctx, id, redis.DefaultListUpgradeNotificationsOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RedisClient.PatchSchedulesCreateOrUpdate` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +payload := redis.RedisPatchSchedule{ + // ... +} + + +read, err := client.PatchSchedulesCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisClient.PatchSchedulesDelete` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +read, err := client.PatchSchedulesDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisClient.PatchSchedulesGet` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +read, err := client.PatchSchedulesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisClient.PatchSchedulesListByRedisResource` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +// alternatively `client.PatchSchedulesListByRedisResource(ctx, id)` can be used to do batched pagination +items, err := client.PatchSchedulesListByRedisResourceComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RedisClient.RegenerateKey` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +payload := redis.RedisRegenerateKeyParameters{ + // ... +} + + +read, err := client.RegenerateKey(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisClient.Update` + +```go +ctx := context.TODO() +id := redis.NewRediID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisValue") + +payload := redis.RedisUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/client.go new file mode 100644 index 000000000000..36af1b1c1d33 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/client.go @@ -0,0 +1,18 @@ +package redis + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisClient struct { + Client autorest.Client + baseUri string +} + +func NewRedisClientWithBaseURI(endpoint string) RedisClient { + return RedisClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/constants.go new file mode 100644 index 000000000000..e594c9434c40 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/constants.go @@ -0,0 +1,383 @@ +package redis + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DayOfWeek string + +const ( + DayOfWeekEveryday DayOfWeek = "Everyday" + DayOfWeekFriday DayOfWeek = "Friday" + DayOfWeekMonday DayOfWeek = "Monday" + DayOfWeekSaturday DayOfWeek = "Saturday" + DayOfWeekSunday DayOfWeek = "Sunday" + DayOfWeekThursday DayOfWeek = "Thursday" + DayOfWeekTuesday DayOfWeek = "Tuesday" + DayOfWeekWednesday DayOfWeek = "Wednesday" + DayOfWeekWeekend DayOfWeek = "Weekend" +) + +func PossibleValuesForDayOfWeek() []string { + return []string{ + string(DayOfWeekEveryday), + string(DayOfWeekFriday), + string(DayOfWeekMonday), + string(DayOfWeekSaturday), + string(DayOfWeekSunday), + string(DayOfWeekThursday), + string(DayOfWeekTuesday), + string(DayOfWeekWednesday), + string(DayOfWeekWeekend), + } +} + +func parseDayOfWeek(input string) (*DayOfWeek, error) { + vals := map[string]DayOfWeek{ + "everyday": DayOfWeekEveryday, + "friday": DayOfWeekFriday, + "monday": DayOfWeekMonday, + "saturday": DayOfWeekSaturday, + "sunday": DayOfWeekSunday, + "thursday": DayOfWeekThursday, + "tuesday": DayOfWeekTuesday, + "wednesday": DayOfWeekWednesday, + "weekend": DayOfWeekWeekend, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DayOfWeek(input) + return &out, nil +} + +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + } +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { + return []string{ + string(PrivateEndpointServiceConnectionStatusApproved), + string(PrivateEndpointServiceConnectionStatusPending), + string(PrivateEndpointServiceConnectionStatusRejected), + } +} + +func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { + vals := map[string]PrivateEndpointServiceConnectionStatus{ + "approved": PrivateEndpointServiceConnectionStatusApproved, + "pending": PrivateEndpointServiceConnectionStatusPending, + "rejected": PrivateEndpointServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointServiceConnectionStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateDisabled ProvisioningState = "Disabled" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateLinking ProvisioningState = "Linking" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateRecoveringScaleFailure ProvisioningState = "RecoveringScaleFailure" + ProvisioningStateScaling ProvisioningState = "Scaling" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnlinking ProvisioningState = "Unlinking" + ProvisioningStateUnprovisioning ProvisioningState = "Unprovisioning" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateDisabled), + string(ProvisioningStateFailed), + string(ProvisioningStateLinking), + string(ProvisioningStateProvisioning), + string(ProvisioningStateRecoveringScaleFailure), + string(ProvisioningStateScaling), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUnlinking), + string(ProvisioningStateUnprovisioning), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "disabled": ProvisioningStateDisabled, + "failed": ProvisioningStateFailed, + "linking": ProvisioningStateLinking, + "provisioning": ProvisioningStateProvisioning, + "recoveringscalefailure": ProvisioningStateRecoveringScaleFailure, + "scaling": ProvisioningStateScaling, + "succeeded": ProvisioningStateSucceeded, + "unlinking": ProvisioningStateUnlinking, + "unprovisioning": ProvisioningStateUnprovisioning, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} + +type RebootType string + +const ( + RebootTypeAllNodes RebootType = "AllNodes" + RebootTypePrimaryNode RebootType = "PrimaryNode" + RebootTypeSecondaryNode RebootType = "SecondaryNode" +) + +func PossibleValuesForRebootType() []string { + return []string{ + string(RebootTypeAllNodes), + string(RebootTypePrimaryNode), + string(RebootTypeSecondaryNode), + } +} + +func parseRebootType(input string) (*RebootType, error) { + vals := map[string]RebootType{ + "allnodes": RebootTypeAllNodes, + "primarynode": RebootTypePrimaryNode, + "secondarynode": RebootTypeSecondaryNode, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RebootType(input) + return &out, nil +} + +type RedisKeyType string + +const ( + RedisKeyTypePrimary RedisKeyType = "Primary" + RedisKeyTypeSecondary RedisKeyType = "Secondary" +) + +func PossibleValuesForRedisKeyType() []string { + return []string{ + string(RedisKeyTypePrimary), + string(RedisKeyTypeSecondary), + } +} + +func parseRedisKeyType(input string) (*RedisKeyType, error) { + vals := map[string]RedisKeyType{ + "primary": RedisKeyTypePrimary, + "secondary": RedisKeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RedisKeyType(input) + return &out, nil +} + +type ReplicationRole string + +const ( + ReplicationRolePrimary ReplicationRole = "Primary" + ReplicationRoleSecondary ReplicationRole = "Secondary" +) + +func PossibleValuesForReplicationRole() []string { + return []string{ + string(ReplicationRolePrimary), + string(ReplicationRoleSecondary), + } +} + +func parseReplicationRole(input string) (*ReplicationRole, error) { + vals := map[string]ReplicationRole{ + "primary": ReplicationRolePrimary, + "secondary": ReplicationRoleSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ReplicationRole(input) + return &out, nil +} + +type SkuFamily string + +const ( + SkuFamilyC SkuFamily = "C" + SkuFamilyP SkuFamily = "P" +) + +func PossibleValuesForSkuFamily() []string { + return []string{ + string(SkuFamilyC), + string(SkuFamilyP), + } +} + +func parseSkuFamily(input string) (*SkuFamily, error) { + vals := map[string]SkuFamily{ + "c": SkuFamilyC, + "p": SkuFamilyP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuFamily(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameBasic SkuName = "Basic" + SkuNamePremium SkuName = "Premium" + SkuNameStandard SkuName = "Standard" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameBasic), + string(SkuNamePremium), + string(SkuNameStandard), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "basic": SkuNameBasic, + "premium": SkuNamePremium, + "standard": SkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} + +type TlsVersion string + +const ( + TlsVersionOnePointOne TlsVersion = "1.1" + TlsVersionOnePointTwo TlsVersion = "1.2" + TlsVersionOnePointZero TlsVersion = "1.0" +) + +func PossibleValuesForTlsVersion() []string { + return []string{ + string(TlsVersionOnePointOne), + string(TlsVersionOnePointTwo), + string(TlsVersionOnePointZero), + } +} + +func parseTlsVersion(input string) (*TlsVersion, error) { + vals := map[string]TlsVersion{ + "1.1": TlsVersionOnePointOne, + "1.2": TlsVersionOnePointTwo, + "1.0": TlsVersionOnePointZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TlsVersion(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/id_firewallrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/id_firewallrule.go new file mode 100644 index 000000000000..cb3ffaec4229 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/id_firewallrule.go @@ -0,0 +1,137 @@ +package redis + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FirewallRuleId{} + +// FirewallRuleId is a struct representing the Resource ID for a Firewall Rule +type FirewallRuleId struct { + SubscriptionId string + ResourceGroupName string + RedisName string + FirewallRuleName string +} + +// NewFirewallRuleID returns a new FirewallRuleId struct +func NewFirewallRuleID(subscriptionId string, resourceGroupName string, redisName string, firewallRuleName string) FirewallRuleId { + return FirewallRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisName: redisName, + FirewallRuleName: firewallRuleName, + } +} + +// ParseFirewallRuleID parses 'input' into a FirewallRuleId +func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FirewallRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'firewallRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFirewallRuleIDInsensitively parses 'input' case-insensitively into a FirewallRuleId +// note: this method should only be used for API response data and not user input +func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FirewallRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'firewallRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID +func ValidateFirewallRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFirewallRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Firewall Rule ID +func (id FirewallRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redis/%s/firewallRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisName, id.FirewallRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Firewall Rule ID +func (id FirewallRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedis", "redis", "redis"), + resourceids.UserSpecifiedSegment("redisName", "redisValue"), + resourceids.StaticSegment("staticFirewallRules", "firewallRules", "firewallRules"), + resourceids.UserSpecifiedSegment("firewallRuleName", "firewallRuleValue"), + } +} + +// String returns a human-readable description of this Firewall Rule ID +func (id FirewallRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Name: %q", id.RedisName), + fmt.Sprintf("Firewall Rule Name: %q", id.FirewallRuleName), + } + return fmt.Sprintf("Firewall Rule (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/id_linkedserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/id_linkedserver.go new file mode 100644 index 000000000000..c1fe61288d80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/id_linkedserver.go @@ -0,0 +1,137 @@ +package redis + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LinkedServerId{} + +// LinkedServerId is a struct representing the Resource ID for a Linked Server +type LinkedServerId struct { + SubscriptionId string + ResourceGroupName string + RedisName string + LinkedServerName string +} + +// NewLinkedServerID returns a new LinkedServerId struct +func NewLinkedServerID(subscriptionId string, resourceGroupName string, redisName string, linkedServerName string) LinkedServerId { + return LinkedServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisName: redisName, + LinkedServerName: linkedServerName, + } +} + +// ParseLinkedServerID parses 'input' into a LinkedServerId +func ParseLinkedServerID(input string) (*LinkedServerId, error) { + parser := resourceids.NewParserFromResourceIdType(LinkedServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LinkedServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + if id.LinkedServerName, ok = parsed.Parsed["linkedServerName"]; !ok { + return nil, fmt.Errorf("the segment 'linkedServerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLinkedServerIDInsensitively parses 'input' case-insensitively into a LinkedServerId +// note: this method should only be used for API response data and not user input +func ParseLinkedServerIDInsensitively(input string) (*LinkedServerId, error) { + parser := resourceids.NewParserFromResourceIdType(LinkedServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LinkedServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + if id.LinkedServerName, ok = parsed.Parsed["linkedServerName"]; !ok { + return nil, fmt.Errorf("the segment 'linkedServerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLinkedServerID checks that 'input' can be parsed as a Linked Server ID +func ValidateLinkedServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLinkedServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Linked Server ID +func (id LinkedServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redis/%s/linkedServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisName, id.LinkedServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Linked Server ID +func (id LinkedServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedis", "redis", "redis"), + resourceids.UserSpecifiedSegment("redisName", "redisValue"), + resourceids.StaticSegment("staticLinkedServers", "linkedServers", "linkedServers"), + resourceids.UserSpecifiedSegment("linkedServerName", "linkedServerValue"), + } +} + +// String returns a human-readable description of this Linked Server ID +func (id LinkedServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Name: %q", id.RedisName), + fmt.Sprintf("Linked Server Name: %q", id.LinkedServerName), + } + return fmt.Sprintf("Linked Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/id_redi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/id_redi.go new file mode 100644 index 000000000000..1732d8d6035d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/id_redi.go @@ -0,0 +1,124 @@ +package redis + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RediId{} + +// RediId is a struct representing the Resource ID for a Redi +type RediId struct { + SubscriptionId string + ResourceGroupName string + RedisName string +} + +// NewRediID returns a new RediId struct +func NewRediID(subscriptionId string, resourceGroupName string, redisName string) RediId { + return RediId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisName: redisName, + } +} + +// ParseRediID parses 'input' into a RediId +func ParseRediID(input string) (*RediId, error) { + parser := resourceids.NewParserFromResourceIdType(RediId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RediId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRediIDInsensitively parses 'input' case-insensitively into a RediId +// note: this method should only be used for API response data and not user input +func ParseRediIDInsensitively(input string) (*RediId, error) { + parser := resourceids.NewParserFromResourceIdType(RediId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RediId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { + return nil, fmt.Errorf("the segment 'redisName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRediID checks that 'input' can be parsed as a Redi ID +func ValidateRediID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRediID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Redi ID +func (id RediId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redis/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Redi ID +func (id RediId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedis", "redis", "redis"), + resourceids.UserSpecifiedSegment("redisName", "redisValue"), + } +} + +// String returns a human-readable description of this Redi ID +func (id RediId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Name: %q", id.RedisName), + } + return fmt.Sprintf("Redi (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_checknameavailability_autorest.go new file mode 100644 index 000000000000..f2bed614a261 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_checknameavailability_autorest.go @@ -0,0 +1,69 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response +} + +// CheckNameAvailability ... +func (c RedisClient) CheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckNameAvailabilityParameters) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c RedisClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckNameAvailabilityParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Cache/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_create_autorest.go new file mode 100644 index 000000000000..4fcccaf29194 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_create_autorest.go @@ -0,0 +1,79 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c RedisClient) Create(ctx context.Context, id RediId, input RedisCreateParameters) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c RedisClient) CreateThenPoll(ctx context.Context, id RediId, input RedisCreateParameters) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c RedisClient) preparerForCreate(ctx context.Context, id RediId, input RedisCreateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c RedisClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_delete_autorest.go new file mode 100644 index 000000000000..00ab77443843 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_delete_autorest.go @@ -0,0 +1,78 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c RedisClient) Delete(ctx context.Context, id RediId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c RedisClient) DeleteThenPoll(ctx context.Context, id RediId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c RedisClient) preparerForDelete(ctx context.Context, id RediId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c RedisClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_exportdata_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_exportdata_autorest.go new file mode 100644 index 000000000000..307523a3b891 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_exportdata_autorest.go @@ -0,0 +1,79 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportDataOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ExportData ... +func (c RedisClient) ExportData(ctx context.Context, id RediId, input ExportRDBParameters) (result ExportDataOperationResponse, err error) { + req, err := c.preparerForExportData(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ExportData", nil, "Failure preparing request") + return + } + + result, err = c.senderForExportData(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ExportData", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ExportDataThenPoll performs ExportData then polls until it's completed +func (c RedisClient) ExportDataThenPoll(ctx context.Context, id RediId, input ExportRDBParameters) error { + result, err := c.ExportData(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ExportData: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ExportData: %+v", err) + } + + return nil +} + +// preparerForExportData prepares the ExportData request. +func (c RedisClient) preparerForExportData(ctx context.Context, id RediId, input ExportRDBParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/export", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForExportData sends the ExportData request. The method will close the +// http.Response Body if it receives an error. +func (c RedisClient) senderForExportData(ctx context.Context, req *http.Request) (future ExportDataOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_firewallrulescreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_firewallrulescreateorupdate_autorest.go new file mode 100644 index 000000000000..decd047906ea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_firewallrulescreateorupdate_autorest.go @@ -0,0 +1,69 @@ +package redis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRulesCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *RedisFirewallRule +} + +// FirewallRulesCreateOrUpdate ... +func (c RedisClient) FirewallRulesCreateOrUpdate(ctx context.Context, id FirewallRuleId, input RedisFirewallRule) (result FirewallRulesCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForFirewallRulesCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "FirewallRulesCreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "FirewallRulesCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForFirewallRulesCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "FirewallRulesCreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForFirewallRulesCreateOrUpdate prepares the FirewallRulesCreateOrUpdate request. +func (c RedisClient) preparerForFirewallRulesCreateOrUpdate(ctx context.Context, id FirewallRuleId, input RedisFirewallRule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForFirewallRulesCreateOrUpdate handles the response to the FirewallRulesCreateOrUpdate request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForFirewallRulesCreateOrUpdate(resp *http.Response) (result FirewallRulesCreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_firewallrulesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_firewallrulesdelete_autorest.go new file mode 100644 index 000000000000..33379350389a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_firewallrulesdelete_autorest.go @@ -0,0 +1,66 @@ +package redis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRulesDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// FirewallRulesDelete ... +func (c RedisClient) FirewallRulesDelete(ctx context.Context, id FirewallRuleId) (result FirewallRulesDeleteOperationResponse, err error) { + req, err := c.preparerForFirewallRulesDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "FirewallRulesDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "FirewallRulesDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForFirewallRulesDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "FirewallRulesDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForFirewallRulesDelete prepares the FirewallRulesDelete request. +func (c RedisClient) preparerForFirewallRulesDelete(ctx context.Context, id FirewallRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForFirewallRulesDelete handles the response to the FirewallRulesDelete request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForFirewallRulesDelete(resp *http.Response) (result FirewallRulesDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_firewallrulesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_firewallrulesget_autorest.go new file mode 100644 index 000000000000..586eb3181ba2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_firewallrulesget_autorest.go @@ -0,0 +1,68 @@ +package redis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRulesGetOperationResponse struct { + HttpResponse *http.Response + Model *RedisFirewallRule +} + +// FirewallRulesGet ... +func (c RedisClient) FirewallRulesGet(ctx context.Context, id FirewallRuleId) (result FirewallRulesGetOperationResponse, err error) { + req, err := c.preparerForFirewallRulesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "FirewallRulesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "FirewallRulesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForFirewallRulesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "FirewallRulesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForFirewallRulesGet prepares the FirewallRulesGet request. +func (c RedisClient) preparerForFirewallRulesGet(ctx context.Context, id FirewallRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForFirewallRulesGet handles the response to the FirewallRulesGet request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForFirewallRulesGet(resp *http.Response) (result FirewallRulesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_firewallruleslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_firewallruleslist_autorest.go new file mode 100644 index 000000000000..a0bd616d3553 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_firewallruleslist_autorest.go @@ -0,0 +1,186 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRulesListOperationResponse struct { + HttpResponse *http.Response + Model *[]RedisFirewallRule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (FirewallRulesListOperationResponse, error) +} + +type FirewallRulesListCompleteResult struct { + Items []RedisFirewallRule +} + +func (r FirewallRulesListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r FirewallRulesListOperationResponse) LoadMore(ctx context.Context) (resp FirewallRulesListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// FirewallRulesList ... +func (c RedisClient) FirewallRulesList(ctx context.Context, id RediId) (resp FirewallRulesListOperationResponse, err error) { + req, err := c.preparerForFirewallRulesList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "FirewallRulesList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "FirewallRulesList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForFirewallRulesList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "FirewallRulesList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForFirewallRulesList prepares the FirewallRulesList request. +func (c RedisClient) preparerForFirewallRulesList(ctx context.Context, id RediId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/firewallRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForFirewallRulesListWithNextLink prepares the FirewallRulesList request with the given nextLink token. +func (c RedisClient) preparerForFirewallRulesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForFirewallRulesList handles the response to the FirewallRulesList request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForFirewallRulesList(resp *http.Response) (result FirewallRulesListOperationResponse, err error) { + type page struct { + Values []RedisFirewallRule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result FirewallRulesListOperationResponse, err error) { + req, err := c.preparerForFirewallRulesListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "FirewallRulesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "FirewallRulesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForFirewallRulesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "FirewallRulesList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// FirewallRulesListComplete retrieves all of the results into a single object +func (c RedisClient) FirewallRulesListComplete(ctx context.Context, id RediId) (FirewallRulesListCompleteResult, error) { + return c.FirewallRulesListCompleteMatchingPredicate(ctx, id, RedisFirewallRuleOperationPredicate{}) +} + +// FirewallRulesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RedisClient) FirewallRulesListCompleteMatchingPredicate(ctx context.Context, id RediId, predicate RedisFirewallRuleOperationPredicate) (resp FirewallRulesListCompleteResult, err error) { + items := make([]RedisFirewallRule, 0) + + page, err := c.FirewallRulesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := FirewallRulesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_forcereboot_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_forcereboot_autorest.go new file mode 100644 index 000000000000..6c5700a3cf31 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_forcereboot_autorest.go @@ -0,0 +1,70 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForceRebootOperationResponse struct { + HttpResponse *http.Response + Model *RedisForceRebootResponse +} + +// ForceReboot ... +func (c RedisClient) ForceReboot(ctx context.Context, id RediId, input RedisRebootParameters) (result ForceRebootOperationResponse, err error) { + req, err := c.preparerForForceReboot(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ForceReboot", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ForceReboot", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForForceReboot(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ForceReboot", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForForceReboot prepares the ForceReboot request. +func (c RedisClient) preparerForForceReboot(ctx context.Context, id RediId, input RedisRebootParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/forceReboot", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForForceReboot handles the response to the ForceReboot request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForForceReboot(resp *http.Response) (result ForceRebootOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_get_autorest.go new file mode 100644 index 000000000000..7c2d15404af6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_get_autorest.go @@ -0,0 +1,68 @@ +package redis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *RedisResource +} + +// Get ... +func (c RedisClient) Get(ctx context.Context, id RediId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c RedisClient) preparerForGet(ctx context.Context, id RediId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_importdata_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_importdata_autorest.go new file mode 100644 index 000000000000..73fad9183340 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_importdata_autorest.go @@ -0,0 +1,79 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImportDataOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ImportData ... +func (c RedisClient) ImportData(ctx context.Context, id RediId, input ImportRDBParameters) (result ImportDataOperationResponse, err error) { + req, err := c.preparerForImportData(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ImportData", nil, "Failure preparing request") + return + } + + result, err = c.senderForImportData(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ImportData", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ImportDataThenPoll performs ImportData then polls until it's completed +func (c RedisClient) ImportDataThenPoll(ctx context.Context, id RediId, input ImportRDBParameters) error { + result, err := c.ImportData(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ImportData: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ImportData: %+v", err) + } + + return nil +} + +// preparerForImportData prepares the ImportData request. +func (c RedisClient) preparerForImportData(ctx context.Context, id RediId, input ImportRDBParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/import", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForImportData sends the ImportData request. The method will close the +// http.Response Body if it receives an error. +func (c RedisClient) senderForImportData(ctx context.Context, req *http.Request) (future ImportDataOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_linkedservercreate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_linkedservercreate_autorest.go new file mode 100644 index 000000000000..ad5873533309 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_linkedservercreate_autorest.go @@ -0,0 +1,79 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkedServerCreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// LinkedServerCreate ... +func (c RedisClient) LinkedServerCreate(ctx context.Context, id LinkedServerId, input RedisLinkedServerCreateParameters) (result LinkedServerCreateOperationResponse, err error) { + req, err := c.preparerForLinkedServerCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "LinkedServerCreate", nil, "Failure preparing request") + return + } + + result, err = c.senderForLinkedServerCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "LinkedServerCreate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// LinkedServerCreateThenPoll performs LinkedServerCreate then polls until it's completed +func (c RedisClient) LinkedServerCreateThenPoll(ctx context.Context, id LinkedServerId, input RedisLinkedServerCreateParameters) error { + result, err := c.LinkedServerCreate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing LinkedServerCreate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after LinkedServerCreate: %+v", err) + } + + return nil +} + +// preparerForLinkedServerCreate prepares the LinkedServerCreate request. +func (c RedisClient) preparerForLinkedServerCreate(ctx context.Context, id LinkedServerId, input RedisLinkedServerCreateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForLinkedServerCreate sends the LinkedServerCreate request. The method will close the +// http.Response Body if it receives an error. +func (c RedisClient) senderForLinkedServerCreate(ctx context.Context, req *http.Request) (future LinkedServerCreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_linkedserverdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_linkedserverdelete_autorest.go new file mode 100644 index 000000000000..59d45b71397d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_linkedserverdelete_autorest.go @@ -0,0 +1,66 @@ +package redis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkedServerDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// LinkedServerDelete ... +func (c RedisClient) LinkedServerDelete(ctx context.Context, id LinkedServerId) (result LinkedServerDeleteOperationResponse, err error) { + req, err := c.preparerForLinkedServerDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "LinkedServerDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "LinkedServerDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForLinkedServerDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "LinkedServerDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForLinkedServerDelete prepares the LinkedServerDelete request. +func (c RedisClient) preparerForLinkedServerDelete(ctx context.Context, id LinkedServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForLinkedServerDelete handles the response to the LinkedServerDelete request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForLinkedServerDelete(resp *http.Response) (result LinkedServerDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_linkedserverget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_linkedserverget_autorest.go new file mode 100644 index 000000000000..2be5bab45943 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_linkedserverget_autorest.go @@ -0,0 +1,68 @@ +package redis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkedServerGetOperationResponse struct { + HttpResponse *http.Response + Model *RedisLinkedServerWithProperties +} + +// LinkedServerGet ... +func (c RedisClient) LinkedServerGet(ctx context.Context, id LinkedServerId) (result LinkedServerGetOperationResponse, err error) { + req, err := c.preparerForLinkedServerGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "LinkedServerGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "LinkedServerGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForLinkedServerGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "LinkedServerGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForLinkedServerGet prepares the LinkedServerGet request. +func (c RedisClient) preparerForLinkedServerGet(ctx context.Context, id LinkedServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForLinkedServerGet handles the response to the LinkedServerGet request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForLinkedServerGet(resp *http.Response) (result LinkedServerGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_linkedserverlist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_linkedserverlist_autorest.go new file mode 100644 index 000000000000..21d4c0fc9ed2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_linkedserverlist_autorest.go @@ -0,0 +1,186 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkedServerListOperationResponse struct { + HttpResponse *http.Response + Model *[]RedisLinkedServerWithProperties + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (LinkedServerListOperationResponse, error) +} + +type LinkedServerListCompleteResult struct { + Items []RedisLinkedServerWithProperties +} + +func (r LinkedServerListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r LinkedServerListOperationResponse) LoadMore(ctx context.Context) (resp LinkedServerListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// LinkedServerList ... +func (c RedisClient) LinkedServerList(ctx context.Context, id RediId) (resp LinkedServerListOperationResponse, err error) { + req, err := c.preparerForLinkedServerList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "LinkedServerList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "LinkedServerList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForLinkedServerList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "LinkedServerList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForLinkedServerList prepares the LinkedServerList request. +func (c RedisClient) preparerForLinkedServerList(ctx context.Context, id RediId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/linkedServers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForLinkedServerListWithNextLink prepares the LinkedServerList request with the given nextLink token. +func (c RedisClient) preparerForLinkedServerListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForLinkedServerList handles the response to the LinkedServerList request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForLinkedServerList(resp *http.Response) (result LinkedServerListOperationResponse, err error) { + type page struct { + Values []RedisLinkedServerWithProperties `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result LinkedServerListOperationResponse, err error) { + req, err := c.preparerForLinkedServerListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "LinkedServerList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "LinkedServerList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForLinkedServerList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "LinkedServerList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// LinkedServerListComplete retrieves all of the results into a single object +func (c RedisClient) LinkedServerListComplete(ctx context.Context, id RediId) (LinkedServerListCompleteResult, error) { + return c.LinkedServerListCompleteMatchingPredicate(ctx, id, RedisLinkedServerWithPropertiesOperationPredicate{}) +} + +// LinkedServerListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RedisClient) LinkedServerListCompleteMatchingPredicate(ctx context.Context, id RediId, predicate RedisLinkedServerWithPropertiesOperationPredicate) (resp LinkedServerListCompleteResult, err error) { + items := make([]RedisLinkedServerWithProperties, 0) + + page, err := c.LinkedServerList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := LinkedServerListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..5b25d2915ba0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]RedisResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []RedisResource +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c RedisClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c RedisClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Cache/redis", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c RedisClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []RedisResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c RedisClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, RedisResourceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RedisClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate RedisResourceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]RedisResource, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_listbysubscription_autorest.go new file mode 100644 index 000000000000..08103f373e30 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]RedisResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []RedisResource +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c RedisClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c RedisClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Cache/redis", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c RedisClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []RedisResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c RedisClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, RedisResourceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RedisClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate RedisResourceOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]RedisResource, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_listkeys_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_listkeys_autorest.go new file mode 100644 index 000000000000..a9da9cd6b4bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_listkeys_autorest.go @@ -0,0 +1,69 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeysOperationResponse struct { + HttpResponse *http.Response + Model *RedisAccessKeys +} + +// ListKeys ... +func (c RedisClient) ListKeys(ctx context.Context, id RediId) (result ListKeysOperationResponse, err error) { + req, err := c.preparerForListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListKeys prepares the ListKeys request. +func (c RedisClient) preparerForListKeys(ctx context.Context, id RediId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListKeys handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForListKeys(resp *http.Response) (result ListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_listupgradenotifications_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_listupgradenotifications_autorest.go new file mode 100644 index 000000000000..ed9393cbb7b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_listupgradenotifications_autorest.go @@ -0,0 +1,215 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListUpgradeNotificationsOperationResponse struct { + HttpResponse *http.Response + Model *[]UpgradeNotification + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListUpgradeNotificationsOperationResponse, error) +} + +type ListUpgradeNotificationsCompleteResult struct { + Items []UpgradeNotification +} + +func (r ListUpgradeNotificationsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListUpgradeNotificationsOperationResponse) LoadMore(ctx context.Context) (resp ListUpgradeNotificationsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListUpgradeNotificationsOperationOptions struct { + History *float64 +} + +func DefaultListUpgradeNotificationsOperationOptions() ListUpgradeNotificationsOperationOptions { + return ListUpgradeNotificationsOperationOptions{} +} + +func (o ListUpgradeNotificationsOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListUpgradeNotificationsOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.History != nil { + out["history"] = *o.History + } + + return out +} + +// ListUpgradeNotifications ... +func (c RedisClient) ListUpgradeNotifications(ctx context.Context, id RediId, options ListUpgradeNotificationsOperationOptions) (resp ListUpgradeNotificationsOperationResponse, err error) { + req, err := c.preparerForListUpgradeNotifications(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListUpgradeNotifications", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListUpgradeNotifications", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListUpgradeNotifications(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListUpgradeNotifications", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListUpgradeNotifications prepares the ListUpgradeNotifications request. +func (c RedisClient) preparerForListUpgradeNotifications(ctx context.Context, id RediId, options ListUpgradeNotificationsOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/listUpgradeNotifications", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListUpgradeNotificationsWithNextLink prepares the ListUpgradeNotifications request with the given nextLink token. +func (c RedisClient) preparerForListUpgradeNotificationsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListUpgradeNotifications handles the response to the ListUpgradeNotifications request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForListUpgradeNotifications(resp *http.Response) (result ListUpgradeNotificationsOperationResponse, err error) { + type page struct { + Values []UpgradeNotification `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListUpgradeNotificationsOperationResponse, err error) { + req, err := c.preparerForListUpgradeNotificationsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListUpgradeNotifications", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListUpgradeNotifications", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListUpgradeNotifications(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "ListUpgradeNotifications", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListUpgradeNotificationsComplete retrieves all of the results into a single object +func (c RedisClient) ListUpgradeNotificationsComplete(ctx context.Context, id RediId, options ListUpgradeNotificationsOperationOptions) (ListUpgradeNotificationsCompleteResult, error) { + return c.ListUpgradeNotificationsCompleteMatchingPredicate(ctx, id, options, UpgradeNotificationOperationPredicate{}) +} + +// ListUpgradeNotificationsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RedisClient) ListUpgradeNotificationsCompleteMatchingPredicate(ctx context.Context, id RediId, options ListUpgradeNotificationsOperationOptions, predicate UpgradeNotificationOperationPredicate) (resp ListUpgradeNotificationsCompleteResult, err error) { + items := make([]UpgradeNotification, 0) + + page, err := c.ListUpgradeNotifications(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListUpgradeNotificationsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_patchschedulescreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_patchschedulescreateorupdate_autorest.go new file mode 100644 index 000000000000..c395761a64ff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_patchschedulescreateorupdate_autorest.go @@ -0,0 +1,70 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSchedulesCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *RedisPatchSchedule +} + +// PatchSchedulesCreateOrUpdate ... +func (c RedisClient) PatchSchedulesCreateOrUpdate(ctx context.Context, id RediId, input RedisPatchSchedule) (result PatchSchedulesCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForPatchSchedulesCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "PatchSchedulesCreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "PatchSchedulesCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPatchSchedulesCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "PatchSchedulesCreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPatchSchedulesCreateOrUpdate prepares the PatchSchedulesCreateOrUpdate request. +func (c RedisClient) preparerForPatchSchedulesCreateOrUpdate(ctx context.Context, id RediId, input RedisPatchSchedule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/patchSchedules/default", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPatchSchedulesCreateOrUpdate handles the response to the PatchSchedulesCreateOrUpdate request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForPatchSchedulesCreateOrUpdate(resp *http.Response) (result PatchSchedulesCreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_patchschedulesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_patchschedulesdelete_autorest.go new file mode 100644 index 000000000000..b71432da14cf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_patchschedulesdelete_autorest.go @@ -0,0 +1,67 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSchedulesDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// PatchSchedulesDelete ... +func (c RedisClient) PatchSchedulesDelete(ctx context.Context, id RediId) (result PatchSchedulesDeleteOperationResponse, err error) { + req, err := c.preparerForPatchSchedulesDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "PatchSchedulesDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "PatchSchedulesDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPatchSchedulesDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "PatchSchedulesDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPatchSchedulesDelete prepares the PatchSchedulesDelete request. +func (c RedisClient) preparerForPatchSchedulesDelete(ctx context.Context, id RediId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/patchSchedules/default", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPatchSchedulesDelete handles the response to the PatchSchedulesDelete request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForPatchSchedulesDelete(resp *http.Response) (result PatchSchedulesDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_patchschedulesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_patchschedulesget_autorest.go new file mode 100644 index 000000000000..8604f06df69a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_patchschedulesget_autorest.go @@ -0,0 +1,69 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSchedulesGetOperationResponse struct { + HttpResponse *http.Response + Model *RedisPatchSchedule +} + +// PatchSchedulesGet ... +func (c RedisClient) PatchSchedulesGet(ctx context.Context, id RediId) (result PatchSchedulesGetOperationResponse, err error) { + req, err := c.preparerForPatchSchedulesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "PatchSchedulesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "PatchSchedulesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPatchSchedulesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "PatchSchedulesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPatchSchedulesGet prepares the PatchSchedulesGet request. +func (c RedisClient) preparerForPatchSchedulesGet(ctx context.Context, id RediId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/patchSchedules/default", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPatchSchedulesGet handles the response to the PatchSchedulesGet request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForPatchSchedulesGet(resp *http.Response) (result PatchSchedulesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_patchscheduleslistbyredisresource_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_patchscheduleslistbyredisresource_autorest.go new file mode 100644 index 000000000000..a29f4d3d5fd0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_patchscheduleslistbyredisresource_autorest.go @@ -0,0 +1,186 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSchedulesListByRedisResourceOperationResponse struct { + HttpResponse *http.Response + Model *[]RedisPatchSchedule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (PatchSchedulesListByRedisResourceOperationResponse, error) +} + +type PatchSchedulesListByRedisResourceCompleteResult struct { + Items []RedisPatchSchedule +} + +func (r PatchSchedulesListByRedisResourceOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r PatchSchedulesListByRedisResourceOperationResponse) LoadMore(ctx context.Context) (resp PatchSchedulesListByRedisResourceOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// PatchSchedulesListByRedisResource ... +func (c RedisClient) PatchSchedulesListByRedisResource(ctx context.Context, id RediId) (resp PatchSchedulesListByRedisResourceOperationResponse, err error) { + req, err := c.preparerForPatchSchedulesListByRedisResource(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "PatchSchedulesListByRedisResource", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "PatchSchedulesListByRedisResource", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForPatchSchedulesListByRedisResource(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "PatchSchedulesListByRedisResource", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForPatchSchedulesListByRedisResource prepares the PatchSchedulesListByRedisResource request. +func (c RedisClient) preparerForPatchSchedulesListByRedisResource(ctx context.Context, id RediId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/patchSchedules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForPatchSchedulesListByRedisResourceWithNextLink prepares the PatchSchedulesListByRedisResource request with the given nextLink token. +func (c RedisClient) preparerForPatchSchedulesListByRedisResourceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPatchSchedulesListByRedisResource handles the response to the PatchSchedulesListByRedisResource request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForPatchSchedulesListByRedisResource(resp *http.Response) (result PatchSchedulesListByRedisResourceOperationResponse, err error) { + type page struct { + Values []RedisPatchSchedule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result PatchSchedulesListByRedisResourceOperationResponse, err error) { + req, err := c.preparerForPatchSchedulesListByRedisResourceWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "PatchSchedulesListByRedisResource", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "PatchSchedulesListByRedisResource", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPatchSchedulesListByRedisResource(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "PatchSchedulesListByRedisResource", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// PatchSchedulesListByRedisResourceComplete retrieves all of the results into a single object +func (c RedisClient) PatchSchedulesListByRedisResourceComplete(ctx context.Context, id RediId) (PatchSchedulesListByRedisResourceCompleteResult, error) { + return c.PatchSchedulesListByRedisResourceCompleteMatchingPredicate(ctx, id, RedisPatchScheduleOperationPredicate{}) +} + +// PatchSchedulesListByRedisResourceCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RedisClient) PatchSchedulesListByRedisResourceCompleteMatchingPredicate(ctx context.Context, id RediId, predicate RedisPatchScheduleOperationPredicate) (resp PatchSchedulesListByRedisResourceCompleteResult, err error) { + items := make([]RedisPatchSchedule, 0) + + page, err := c.PatchSchedulesListByRedisResource(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := PatchSchedulesListByRedisResourceCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_regeneratekey_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_regeneratekey_autorest.go new file mode 100644 index 000000000000..043564394235 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_regeneratekey_autorest.go @@ -0,0 +1,70 @@ +package redis + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyOperationResponse struct { + HttpResponse *http.Response + Model *RedisAccessKeys +} + +// RegenerateKey ... +func (c RedisClient) RegenerateKey(ctx context.Context, id RediId, input RedisRegenerateKeyParameters) (result RegenerateKeyOperationResponse, err error) { + req, err := c.preparerForRegenerateKey(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "RegenerateKey", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRegenerateKey(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "RegenerateKey", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRegenerateKey prepares the RegenerateKey request. +func (c RedisClient) preparerForRegenerateKey(ctx context.Context, id RediId, input RedisRegenerateKeyParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKey", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRegenerateKey handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForRegenerateKey(resp *http.Response) (result RegenerateKeyOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_update_autorest.go new file mode 100644 index 000000000000..378b7a1f1c39 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/method_update_autorest.go @@ -0,0 +1,69 @@ +package redis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *RedisResource +} + +// Update ... +func (c RedisClient) Update(ctx context.Context, id RediId, input RedisUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.RedisClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c RedisClient) preparerForUpdate(ctx context.Context, id RediId, input RedisUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c RedisClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_checknameavailabilityparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_checknameavailabilityparameters.go new file mode 100644 index 000000000000..ed132a3981cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_checknameavailabilityparameters.go @@ -0,0 +1,9 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityParameters struct { + Name string `json:"name"` + Type string `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_exportrdbparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_exportrdbparameters.go new file mode 100644 index 000000000000..cff366a19baa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_exportrdbparameters.go @@ -0,0 +1,10 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportRDBParameters struct { + Container string `json:"container"` + Format *string `json:"format,omitempty"` + Prefix string `json:"prefix"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_importrdbparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_importrdbparameters.go new file mode 100644 index 000000000000..8be7995e9b59 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_importrdbparameters.go @@ -0,0 +1,9 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImportRDBParameters struct { + Files []string `json:"files"` + Format *string `json:"format,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_privateendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_privateendpoint.go new file mode 100644 index 000000000000..feae3de5d689 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_privateendpoint.go @@ -0,0 +1,8 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_privateendpointconnection.go new file mode 100644 index 000000000000..f29ef3379a41 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_privateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_privateendpointconnectionproperties.go new file mode 100644 index 000000000000..e2c073d021f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_privatelinkserviceconnectionstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_privatelinkserviceconnectionstate.go new file mode 100644 index 000000000000..e37ff7074071 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisaccesskeys.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisaccesskeys.go new file mode 100644 index 000000000000..fc3136b6cab0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisaccesskeys.go @@ -0,0 +1,9 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisAccessKeys struct { + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_rediscommonpropertiesredisconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_rediscommonpropertiesredisconfiguration.go new file mode 100644 index 000000000000..d3c31fee073f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_rediscommonpropertiesredisconfiguration.go @@ -0,0 +1,24 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisCommonPropertiesRedisConfiguration struct { + AofBackupEnabled *string `json:"aof-backup-enabled,omitempty"` + AofStorageConnectionString0 *string `json:"aof-storage-connection-string-0,omitempty"` + AofStorageConnectionString1 *string `json:"aof-storage-connection-string-1,omitempty"` + Authnotrequired *string `json:"authnotrequired,omitempty"` + Maxclients *string `json:"maxclients,omitempty"` + MaxfragmentationmemoryReserved *string `json:"maxfragmentationmemory-reserved,omitempty"` + MaxmemoryDelta *string `json:"maxmemory-delta,omitempty"` + MaxmemoryPolicy *string `json:"maxmemory-policy,omitempty"` + MaxmemoryReserved *string `json:"maxmemory-reserved,omitempty"` + NotifyKeyspaceEvents *string `json:"notify-keyspace-events,omitempty"` + PreferredDataArchiveAuthMethod *string `json:"preferred-data-archive-auth-method,omitempty"` + PreferredDataPersistenceAuthMethod *string `json:"preferred-data-persistence-auth-method,omitempty"` + RdbBackupEnabled *string `json:"rdb-backup-enabled,omitempty"` + RdbBackupFrequency *string `json:"rdb-backup-frequency,omitempty"` + RdbBackupMaxSnapshotCount *string `json:"rdb-backup-max-snapshot-count,omitempty"` + RdbStorageConnectionString *string `json:"rdb-storage-connection-string,omitempty"` + ZonalConfiguration *string `json:"zonal-configuration,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_rediscreateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_rediscreateparameters.go new file mode 100644 index 000000000000..5d9c5e9f7611 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_rediscreateparameters.go @@ -0,0 +1,17 @@ +package redis + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisCreateParameters struct { + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Properties RedisCreateProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_rediscreateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_rediscreateproperties.go new file mode 100644 index 000000000000..0ef298ce288b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_rediscreateproperties.go @@ -0,0 +1,19 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisCreateProperties struct { + EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` + MinimumTlsVersion *TlsVersion `json:"minimumTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + RedisConfiguration *RedisCommonPropertiesRedisConfiguration `json:"redisConfiguration,omitempty"` + RedisVersion *string `json:"redisVersion,omitempty"` + ReplicasPerMaster *int64 `json:"replicasPerMaster,omitempty"` + ReplicasPerPrimary *int64 `json:"replicasPerPrimary,omitempty"` + ShardCount *int64 `json:"shardCount,omitempty"` + Sku Sku `json:"sku"` + StaticIP *string `json:"staticIP,omitempty"` + SubnetId *string `json:"subnetId,omitempty"` + TenantSettings *map[string]string `json:"tenantSettings,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisfirewallrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisfirewallrule.go new file mode 100644 index 000000000000..7e290af26c48 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisfirewallrule.go @@ -0,0 +1,11 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisFirewallRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties RedisFirewallRuleProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisfirewallruleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisfirewallruleproperties.go new file mode 100644 index 000000000000..0b599eb2f75a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisfirewallruleproperties.go @@ -0,0 +1,9 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisFirewallRuleProperties struct { + EndIP string `json:"endIP"` + StartIP string `json:"startIP"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisforcerebootresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisforcerebootresponse.go new file mode 100644 index 000000000000..8108fdf0b06a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisforcerebootresponse.go @@ -0,0 +1,8 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisForceRebootResponse struct { + Message *string `json:"message,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisinstancedetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisinstancedetails.go new file mode 100644 index 000000000000..660f035ab2f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisinstancedetails.go @@ -0,0 +1,13 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisInstanceDetails struct { + IsMaster *bool `json:"isMaster,omitempty"` + IsPrimary *bool `json:"isPrimary,omitempty"` + NonSslPort *int64 `json:"nonSslPort,omitempty"` + ShardId *int64 `json:"shardId,omitempty"` + SslPort *int64 `json:"sslPort,omitempty"` + Zone *string `json:"zone,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redislinkedserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redislinkedserver.go new file mode 100644 index 000000000000..1336ebf305b6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redislinkedserver.go @@ -0,0 +1,8 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisLinkedServer struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redislinkedservercreateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redislinkedservercreateparameters.go new file mode 100644 index 000000000000..bcea5475afdb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redislinkedservercreateparameters.go @@ -0,0 +1,8 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisLinkedServerCreateParameters struct { + Properties RedisLinkedServerCreateProperties `json:"properties"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redislinkedservercreateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redislinkedservercreateproperties.go new file mode 100644 index 000000000000..6f871a65321b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redislinkedservercreateproperties.go @@ -0,0 +1,10 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisLinkedServerCreateProperties struct { + LinkedRedisCacheId string `json:"linkedRedisCacheId"` + LinkedRedisCacheLocation string `json:"linkedRedisCacheLocation"` + ServerRole ReplicationRole `json:"serverRole"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redislinkedserverproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redislinkedserverproperties.go new file mode 100644 index 000000000000..fda9bc684cba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redislinkedserverproperties.go @@ -0,0 +1,11 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisLinkedServerProperties struct { + LinkedRedisCacheId string `json:"linkedRedisCacheId"` + LinkedRedisCacheLocation string `json:"linkedRedisCacheLocation"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ServerRole ReplicationRole `json:"serverRole"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redislinkedserverwithproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redislinkedserverwithproperties.go new file mode 100644 index 000000000000..9e2f52207203 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redislinkedserverwithproperties.go @@ -0,0 +1,11 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisLinkedServerWithProperties struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RedisLinkedServerProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redispatchschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redispatchschedule.go new file mode 100644 index 000000000000..8f2e294d43bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redispatchschedule.go @@ -0,0 +1,12 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisPatchSchedule struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ScheduleEntries `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisproperties.go new file mode 100644 index 000000000000..a96036196abb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisproperties.go @@ -0,0 +1,27 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisProperties struct { + AccessKeys *RedisAccessKeys `json:"accessKeys,omitempty"` + EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` + HostName *string `json:"hostName,omitempty"` + Instances *[]RedisInstanceDetails `json:"instances,omitempty"` + LinkedServers *[]RedisLinkedServer `json:"linkedServers,omitempty"` + MinimumTlsVersion *TlsVersion `json:"minimumTlsVersion,omitempty"` + Port *int64 `json:"port,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + RedisConfiguration *RedisCommonPropertiesRedisConfiguration `json:"redisConfiguration,omitempty"` + RedisVersion *string `json:"redisVersion,omitempty"` + ReplicasPerMaster *int64 `json:"replicasPerMaster,omitempty"` + ReplicasPerPrimary *int64 `json:"replicasPerPrimary,omitempty"` + ShardCount *int64 `json:"shardCount,omitempty"` + Sku Sku `json:"sku"` + SslPort *int64 `json:"sslPort,omitempty"` + StaticIP *string `json:"staticIP,omitempty"` + SubnetId *string `json:"subnetId,omitempty"` + TenantSettings *map[string]string `json:"tenantSettings,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisrebootparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisrebootparameters.go new file mode 100644 index 000000000000..774681c97e8a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisrebootparameters.go @@ -0,0 +1,10 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisRebootParameters struct { + Ports *[]int64 `json:"ports,omitempty"` + RebootType *RebootType `json:"rebootType,omitempty"` + ShardId *int64 `json:"shardId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisregeneratekeyparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisregeneratekeyparameters.go new file mode 100644 index 000000000000..7513a779b6ac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisregeneratekeyparameters.go @@ -0,0 +1,8 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisRegenerateKeyParameters struct { + KeyType RedisKeyType `json:"keyType"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisresource.go new file mode 100644 index 000000000000..aa8085ff87f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisresource.go @@ -0,0 +1,20 @@ +package redis + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisResource struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties RedisProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisupdateparameters.go new file mode 100644 index 000000000000..75fc22ebd5fa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisupdateparameters.go @@ -0,0 +1,14 @@ +package redis + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisUpdateParameters struct { + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Properties *RedisUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisupdateproperties.go new file mode 100644 index 000000000000..e7e74932773d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_redisupdateproperties.go @@ -0,0 +1,17 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisUpdateProperties struct { + EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` + MinimumTlsVersion *TlsVersion `json:"minimumTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + RedisConfiguration *RedisCommonPropertiesRedisConfiguration `json:"redisConfiguration,omitempty"` + RedisVersion *string `json:"redisVersion,omitempty"` + ReplicasPerMaster *int64 `json:"replicasPerMaster,omitempty"` + ReplicasPerPrimary *int64 `json:"replicasPerPrimary,omitempty"` + ShardCount *int64 `json:"shardCount,omitempty"` + Sku *Sku `json:"sku,omitempty"` + TenantSettings *map[string]string `json:"tenantSettings,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_scheduleentries.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_scheduleentries.go new file mode 100644 index 000000000000..b51c737b6dce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_scheduleentries.go @@ -0,0 +1,8 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleEntries struct { + ScheduleEntries []ScheduleEntry `json:"scheduleEntries"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_scheduleentry.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_scheduleentry.go new file mode 100644 index 000000000000..5be2fd650883 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_scheduleentry.go @@ -0,0 +1,10 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduleEntry struct { + DayOfWeek DayOfWeek `json:"dayOfWeek"` + MaintenanceWindow *string `json:"maintenanceWindow,omitempty"` + StartHourUtc int64 `json:"startHourUtc"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_sku.go new file mode 100644 index 000000000000..da88aeee7041 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_sku.go @@ -0,0 +1,10 @@ +package redis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity int64 `json:"capacity"` + Family SkuFamily `json:"family"` + Name SkuName `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_upgradenotification.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_upgradenotification.go new file mode 100644 index 000000000000..418f8789093c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/model_upgradenotification.go @@ -0,0 +1,28 @@ +package redis + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpgradeNotification struct { + Name *string `json:"name,omitempty"` + Timestamp *string `json:"timestamp,omitempty"` + UpsellNotification *map[string]string `json:"upsellNotification,omitempty"` +} + +func (o *UpgradeNotification) GetTimestampAsTime() (*time.Time, error) { + if o.Timestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Timestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeNotification) SetTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Timestamp = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/predicates.go new file mode 100644 index 000000000000..9b42c80a22c6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/predicates.go @@ -0,0 +1,121 @@ +package redis + +type RedisFirewallRuleOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p RedisFirewallRuleOperationPredicate) Matches(input RedisFirewallRule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type RedisLinkedServerWithPropertiesOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p RedisLinkedServerWithPropertiesOperationPredicate) Matches(input RedisLinkedServerWithProperties) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type RedisPatchScheduleOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p RedisPatchScheduleOperationPredicate) Matches(input RedisPatchSchedule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type RedisResourceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p RedisResourceOperationPredicate) Matches(input RedisResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type UpgradeNotificationOperationPredicate struct { + Name *string + Timestamp *string +} + +func (p UpgradeNotificationOperationPredicate) Matches(input UpgradeNotification) bool { + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Timestamp != nil && (input.Timestamp == nil && *p.Timestamp != *input.Timestamp) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/version.go new file mode 100644 index 000000000000..faad986bd9a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis/version.go @@ -0,0 +1,12 @@ +package redis + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/redis/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/README.md index 03e30a41867b..dbd5fdbd30ad 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") payload := databases.Database{ // ... @@ -41,7 +41,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") payload := databases.ExportClusterParameters{ // ... @@ -70,7 +70,7 @@ if err := client.ExportThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") payload := databases.ForceUnlinkParameters{ // ... @@ -87,7 +87,7 @@ if err := client.ForceUnlinkThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") read, err := client.Get(ctx, id) if err != nil { @@ -103,7 +103,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") payload := databases.ImportClusterParameters{ // ... @@ -120,7 +120,7 @@ if err := client.ImportThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := databases.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := databases.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue") // alternatively `client.ListByCluster(ctx, id)` can be used to do batched pagination items, err := client.ListByClusterComplete(ctx, id) @@ -137,7 +137,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") read, err := client.ListKeys(ctx, id) if err != nil { @@ -153,7 +153,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") payload := databases.RegenerateKeyParameters{ // ... @@ -170,7 +170,7 @@ if err := client.RegenerateKeyThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") payload := databases.DatabaseUpdate{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/id_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/id_database.go index e58344f50094..ca4b05d0d13c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/id_database.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/id_database.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = DatabaseId{} // DatabaseId is a struct representing the Resource ID for a Database type DatabaseId struct { - SubscriptionId string - ResourceGroupName string - ClusterName string - DatabaseName string + SubscriptionId string + ResourceGroupName string + RedisEnterpriseName string + DatabaseName string } // NewDatabaseID returns a new DatabaseId struct -func NewDatabaseID(subscriptionId string, resourceGroupName string, clusterName string, databaseName string) DatabaseId { +func NewDatabaseID(subscriptionId string, resourceGroupName string, redisEnterpriseName string, databaseName string) DatabaseId { return DatabaseId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ClusterName: clusterName, - DatabaseName: databaseName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisEnterpriseName: redisEnterpriseName, + DatabaseName: databaseName, } } @@ -46,8 +46,8 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { + return nil, fmt.Errorf("the segment 'redisEnterpriseName' was not found in the resource id %q", input) } if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { @@ -77,8 +77,8 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { + return nil, fmt.Errorf("the segment 'redisEnterpriseName' was not found in the resource id %q", input) } if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { @@ -106,7 +106,7 @@ func ValidateDatabaseID(input interface{}, key string) (warnings []string, error // ID returns the formatted Database ID func (id DatabaseId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redisEnterprise/%s/databases/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.DatabaseName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName, id.DatabaseName) } // Segments returns a slice of Resource ID Segments which comprise this Database ID @@ -119,7 +119,7 @@ func (id DatabaseId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), resourceids.StaticSegment("staticRedisEnterprise", "redisEnterprise", "redisEnterprise"), - resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.UserSpecifiedSegment("redisEnterpriseName", "redisEnterpriseValue"), resourceids.StaticSegment("staticDatabases", "databases", "databases"), resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), } @@ -130,7 +130,7 @@ func (id DatabaseId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Redis Enterprise Name: %q", id.RedisEnterpriseName), fmt.Sprintf("Database Name: %q", id.DatabaseName), } return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/id_redisenterprise.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/id_redisenterprise.go index b1e6441a79ac..75e1e97db320 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/id_redisenterprise.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/id_redisenterprise.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = RedisEnterpriseId{} // RedisEnterpriseId is a struct representing the Resource ID for a Redis Enterprise type RedisEnterpriseId struct { - SubscriptionId string - ResourceGroupName string - ClusterName string + SubscriptionId string + ResourceGroupName string + RedisEnterpriseName string } // NewRedisEnterpriseID returns a new RedisEnterpriseId struct -func NewRedisEnterpriseID(subscriptionId string, resourceGroupName string, clusterName string) RedisEnterpriseId { +func NewRedisEnterpriseID(subscriptionId string, resourceGroupName string, redisEnterpriseName string) RedisEnterpriseId { return RedisEnterpriseId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ClusterName: clusterName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisEnterpriseName: redisEnterpriseName, } } @@ -44,8 +44,8 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { + return nil, fmt.Errorf("the segment 'redisEnterpriseName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { + return nil, fmt.Errorf("the segment 'redisEnterpriseName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateRedisEnterpriseID(input interface{}, key string) (warnings []string // ID returns the formatted Redis Enterprise ID func (id RedisEnterpriseId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redisEnterprise/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName) } // Segments returns a slice of Resource ID Segments which comprise this Redis Enterprise ID @@ -109,7 +109,7 @@ func (id RedisEnterpriseId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), resourceids.StaticSegment("staticRedisEnterprise", "redisEnterprise", "redisEnterprise"), - resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.UserSpecifiedSegment("redisEnterpriseName", "redisEnterpriseValue"), } } @@ -118,7 +118,7 @@ func (id RedisEnterpriseId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Redis Enterprise Name: %q", id.RedisEnterpriseName), } return fmt.Sprintf("Redis Enterprise (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/README.md index 0c4c8b17ca7a..d4e9d4eafb45 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue") payload := redisenterprise.Cluster{ // ... @@ -41,7 +41,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") payload := redisenterprise.Database{ // ... @@ -58,7 +58,7 @@ if err := client.DatabasesCreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") if err := client.DatabasesDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -70,7 +70,7 @@ if err := client.DatabasesDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") payload := redisenterprise.ExportClusterParameters{ // ... @@ -87,7 +87,7 @@ if err := client.DatabasesExportThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") payload := redisenterprise.ForceUnlinkParameters{ // ... @@ -104,7 +104,7 @@ if err := client.DatabasesForceUnlinkThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") read, err := client.DatabasesGet(ctx, id) if err != nil { @@ -120,7 +120,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") payload := redisenterprise.ImportClusterParameters{ // ... @@ -137,7 +137,7 @@ if err := client.DatabasesImportThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue") // alternatively `client.DatabasesListByCluster(ctx, id)` can be used to do batched pagination items, err := client.DatabasesListByClusterComplete(ctx, id) @@ -154,7 +154,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") read, err := client.DatabasesListKeys(ctx, id) if err != nil { @@ -170,7 +170,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") payload := redisenterprise.RegenerateKeyParameters{ // ... @@ -187,7 +187,7 @@ if err := client.DatabasesRegenerateKeyThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue", "databaseValue") payload := redisenterprise.DatabaseUpdate{ // ... @@ -204,7 +204,7 @@ if err := client.DatabasesUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -216,7 +216,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue") read, err := client.Get(ctx, id) if err != nil { @@ -266,7 +266,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseValue") payload := redisenterprise.ClusterUpdate{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_database.go index a44834a9fc21..0184dbe89000 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_database.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_database.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = DatabaseId{} // DatabaseId is a struct representing the Resource ID for a Database type DatabaseId struct { - SubscriptionId string - ResourceGroupName string - ClusterName string - DatabaseName string + SubscriptionId string + ResourceGroupName string + RedisEnterpriseName string + DatabaseName string } // NewDatabaseID returns a new DatabaseId struct -func NewDatabaseID(subscriptionId string, resourceGroupName string, clusterName string, databaseName string) DatabaseId { +func NewDatabaseID(subscriptionId string, resourceGroupName string, redisEnterpriseName string, databaseName string) DatabaseId { return DatabaseId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ClusterName: clusterName, - DatabaseName: databaseName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisEnterpriseName: redisEnterpriseName, + DatabaseName: databaseName, } } @@ -46,8 +46,8 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { + return nil, fmt.Errorf("the segment 'redisEnterpriseName' was not found in the resource id %q", input) } if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { @@ -77,8 +77,8 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { + return nil, fmt.Errorf("the segment 'redisEnterpriseName' was not found in the resource id %q", input) } if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { @@ -106,7 +106,7 @@ func ValidateDatabaseID(input interface{}, key string) (warnings []string, error // ID returns the formatted Database ID func (id DatabaseId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redisEnterprise/%s/databases/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.DatabaseName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName, id.DatabaseName) } // Segments returns a slice of Resource ID Segments which comprise this Database ID @@ -119,7 +119,7 @@ func (id DatabaseId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), resourceids.StaticSegment("staticRedisEnterprise", "redisEnterprise", "redisEnterprise"), - resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.UserSpecifiedSegment("redisEnterpriseName", "redisEnterpriseValue"), resourceids.StaticSegment("staticDatabases", "databases", "databases"), resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), } @@ -130,7 +130,7 @@ func (id DatabaseId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Redis Enterprise Name: %q", id.RedisEnterpriseName), fmt.Sprintf("Database Name: %q", id.DatabaseName), } return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_redisenterprise.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_redisenterprise.go index 64e4baba8d9c..e3d7b8985e95 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_redisenterprise.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_redisenterprise.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = RedisEnterpriseId{} // RedisEnterpriseId is a struct representing the Resource ID for a Redis Enterprise type RedisEnterpriseId struct { - SubscriptionId string - ResourceGroupName string - ClusterName string + SubscriptionId string + ResourceGroupName string + RedisEnterpriseName string } // NewRedisEnterpriseID returns a new RedisEnterpriseId struct -func NewRedisEnterpriseID(subscriptionId string, resourceGroupName string, clusterName string) RedisEnterpriseId { +func NewRedisEnterpriseID(subscriptionId string, resourceGroupName string, redisEnterpriseName string) RedisEnterpriseId { return RedisEnterpriseId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ClusterName: clusterName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisEnterpriseName: redisEnterpriseName, } } @@ -44,8 +44,8 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { + return nil, fmt.Errorf("the segment 'redisEnterpriseName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { + return nil, fmt.Errorf("the segment 'redisEnterpriseName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateRedisEnterpriseID(input interface{}, key string) (warnings []string // ID returns the formatted Redis Enterprise ID func (id RedisEnterpriseId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redisEnterprise/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName) } // Segments returns a slice of Resource ID Segments which comprise this Redis Enterprise ID @@ -109,7 +109,7 @@ func (id RedisEnterpriseId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), resourceids.StaticSegment("staticRedisEnterprise", "redisEnterprise", "redisEnterprise"), - resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.UserSpecifiedSegment("redisEnterpriseName", "redisEnterpriseValue"), } } @@ -118,7 +118,7 @@ func (id RedisEnterpriseId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Redis Enterprise Name: %q", id.RedisEnterpriseName), } return fmt.Sprintf("Redis Enterprise (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/README.md new file mode 100644 index 000000000000..718d58ae1875 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/README.md @@ -0,0 +1,300 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks` Documentation + +The `managementlocks` SDK allows for interaction with the Azure Resource Manager Service `resources` (API Version `2020-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks" +``` + + +### Client Initialization + +```go +client := managementlocks.NewManagementLocksClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ManagementLocksClient.CreateOrUpdateAtResourceGroupLevel` + +```go +ctx := context.TODO() +id := managementlocks.NewProviderLockID("12345678-1234-9876-4563-123456789012", "example-resource-group", "lockValue") + +payload := managementlocks.ManagementLockObject{ + // ... +} + + +read, err := client.CreateOrUpdateAtResourceGroupLevel(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagementLocksClient.CreateOrUpdateAtResourceLevel` + +```go +ctx := context.TODO() +id := managementlocks.NewResourceLockID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue", "parentResourcePathValue", "resourceTypeValue", "resourceValue", "lockValue") + +payload := managementlocks.ManagementLockObject{ + // ... +} + + +read, err := client.CreateOrUpdateAtResourceLevel(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagementLocksClient.CreateOrUpdateAtSubscriptionLevel` + +```go +ctx := context.TODO() +id := managementlocks.NewLockID("12345678-1234-9876-4563-123456789012", "lockValue") + +payload := managementlocks.ManagementLockObject{ + // ... +} + + +read, err := client.CreateOrUpdateAtSubscriptionLevel(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagementLocksClient.CreateOrUpdateByScope` + +```go +ctx := context.TODO() +id := managementlocks.NewScopedLockID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "lockValue") + +payload := managementlocks.ManagementLockObject{ + // ... +} + + +read, err := client.CreateOrUpdateByScope(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagementLocksClient.DeleteAtResourceGroupLevel` + +```go +ctx := context.TODO() +id := managementlocks.NewProviderLockID("12345678-1234-9876-4563-123456789012", "example-resource-group", "lockValue") + +read, err := client.DeleteAtResourceGroupLevel(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagementLocksClient.DeleteAtResourceLevel` + +```go +ctx := context.TODO() +id := managementlocks.NewResourceLockID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue", "parentResourcePathValue", "resourceTypeValue", "resourceValue", "lockValue") + +read, err := client.DeleteAtResourceLevel(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagementLocksClient.DeleteAtSubscriptionLevel` + +```go +ctx := context.TODO() +id := managementlocks.NewLockID("12345678-1234-9876-4563-123456789012", "lockValue") + +read, err := client.DeleteAtSubscriptionLevel(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagementLocksClient.DeleteByScope` + +```go +ctx := context.TODO() +id := managementlocks.NewScopedLockID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "lockValue") + +read, err := client.DeleteByScope(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagementLocksClient.GetAtResourceGroupLevel` + +```go +ctx := context.TODO() +id := managementlocks.NewProviderLockID("12345678-1234-9876-4563-123456789012", "example-resource-group", "lockValue") + +read, err := client.GetAtResourceGroupLevel(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagementLocksClient.GetAtResourceLevel` + +```go +ctx := context.TODO() +id := managementlocks.NewResourceLockID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue", "parentResourcePathValue", "resourceTypeValue", "resourceValue", "lockValue") + +read, err := client.GetAtResourceLevel(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagementLocksClient.GetAtSubscriptionLevel` + +```go +ctx := context.TODO() +id := managementlocks.NewLockID("12345678-1234-9876-4563-123456789012", "lockValue") + +read, err := client.GetAtSubscriptionLevel(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagementLocksClient.GetByScope` + +```go +ctx := context.TODO() +id := managementlocks.NewScopedLockID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "lockValue") + +read, err := client.GetByScope(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagementLocksClient.ListAtResourceGroupLevel` + +```go +ctx := context.TODO() +id := managementlocks.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListAtResourceGroupLevel(ctx, id, managementlocks.DefaultListAtResourceGroupLevelOperationOptions())` can be used to do batched pagination +items, err := client.ListAtResourceGroupLevelComplete(ctx, id, managementlocks.DefaultListAtResourceGroupLevelOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ManagementLocksClient.ListAtResourceLevel` + +```go +ctx := context.TODO() +id := managementlocks.NewResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue", "parentResourcePathValue", "resourceTypeValue", "resourceValue") + +// alternatively `client.ListAtResourceLevel(ctx, id, managementlocks.DefaultListAtResourceLevelOperationOptions())` can be used to do batched pagination +items, err := client.ListAtResourceLevelComplete(ctx, id, managementlocks.DefaultListAtResourceLevelOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ManagementLocksClient.ListAtSubscriptionLevel` + +```go +ctx := context.TODO() +id := managementlocks.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListAtSubscriptionLevel(ctx, id, managementlocks.DefaultListAtSubscriptionLevelOperationOptions())` can be used to do batched pagination +items, err := client.ListAtSubscriptionLevelComplete(ctx, id, managementlocks.DefaultListAtSubscriptionLevelOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ManagementLocksClient.ListByScope` + +```go +ctx := context.TODO() +id := managementlocks.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +// alternatively `client.ListByScope(ctx, id, managementlocks.DefaultListByScopeOperationOptions())` can be used to do batched pagination +items, err := client.ListByScopeComplete(ctx, id, managementlocks.DefaultListByScopeOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/client.go new file mode 100644 index 000000000000..c1a4a1eeb007 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/client.go @@ -0,0 +1,18 @@ +package managementlocks + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagementLocksClient struct { + Client autorest.Client + baseUri string +} + +func NewManagementLocksClientWithBaseURI(endpoint string) ManagementLocksClient { + return ManagementLocksClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/constants.go new file mode 100644 index 000000000000..b50125fc5756 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/constants.go @@ -0,0 +1,37 @@ +package managementlocks + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LockLevel string + +const ( + LockLevelCanNotDelete LockLevel = "CanNotDelete" + LockLevelNotSpecified LockLevel = "NotSpecified" + LockLevelReadOnly LockLevel = "ReadOnly" +) + +func PossibleValuesForLockLevel() []string { + return []string{ + string(LockLevelCanNotDelete), + string(LockLevelNotSpecified), + string(LockLevelReadOnly), + } +} + +func parseLockLevel(input string) (*LockLevel, error) { + vals := map[string]LockLevel{ + "cannotdelete": LockLevelCanNotDelete, + "notspecified": LockLevelNotSpecified, + "readonly": LockLevelReadOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LockLevel(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/id_lock.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/id_lock.go new file mode 100644 index 000000000000..22df14683f5a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/id_lock.go @@ -0,0 +1,111 @@ +package managementlocks + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LockId{} + +// LockId is a struct representing the Resource ID for a Lock +type LockId struct { + SubscriptionId string + LockName string +} + +// NewLockID returns a new LockId struct +func NewLockID(subscriptionId string, lockName string) LockId { + return LockId{ + SubscriptionId: subscriptionId, + LockName: lockName, + } +} + +// ParseLockID parses 'input' into a LockId +func ParseLockID(input string) (*LockId, error) { + parser := resourceids.NewParserFromResourceIdType(LockId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LockId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.LockName, ok = parsed.Parsed["lockName"]; !ok { + return nil, fmt.Errorf("the segment 'lockName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLockIDInsensitively parses 'input' case-insensitively into a LockId +// note: this method should only be used for API response data and not user input +func ParseLockIDInsensitively(input string) (*LockId, error) { + parser := resourceids.NewParserFromResourceIdType(LockId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LockId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.LockName, ok = parsed.Parsed["lockName"]; !ok { + return nil, fmt.Errorf("the segment 'lockName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLockID checks that 'input' can be parsed as a Lock ID +func ValidateLockID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLockID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Lock ID +func (id LockId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Authorization/locks/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LockName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Lock ID +func (id LockId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAuthorization", "Microsoft.Authorization", "Microsoft.Authorization"), + resourceids.StaticSegment("staticLocks", "locks", "locks"), + resourceids.UserSpecifiedSegment("lockName", "lockValue"), + } +} + +// String returns a human-readable description of this Lock ID +func (id LockId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Lock Name: %q", id.LockName), + } + return fmt.Sprintf("Lock (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/id_providerlock.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/id_providerlock.go new file mode 100644 index 000000000000..1a5a282f4f04 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/id_providerlock.go @@ -0,0 +1,124 @@ +package managementlocks + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ProviderLockId{} + +// ProviderLockId is a struct representing the Resource ID for a Provider Lock +type ProviderLockId struct { + SubscriptionId string + ResourceGroupName string + LockName string +} + +// NewProviderLockID returns a new ProviderLockId struct +func NewProviderLockID(subscriptionId string, resourceGroupName string, lockName string) ProviderLockId { + return ProviderLockId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + LockName: lockName, + } +} + +// ParseProviderLockID parses 'input' into a ProviderLockId +func ParseProviderLockID(input string) (*ProviderLockId, error) { + parser := resourceids.NewParserFromResourceIdType(ProviderLockId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProviderLockId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LockName, ok = parsed.Parsed["lockName"]; !ok { + return nil, fmt.Errorf("the segment 'lockName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseProviderLockIDInsensitively parses 'input' case-insensitively into a ProviderLockId +// note: this method should only be used for API response data and not user input +func ParseProviderLockIDInsensitively(input string) (*ProviderLockId, error) { + parser := resourceids.NewParserFromResourceIdType(ProviderLockId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProviderLockId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.LockName, ok = parsed.Parsed["lockName"]; !ok { + return nil, fmt.Errorf("the segment 'lockName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateProviderLockID checks that 'input' can be parsed as a Provider Lock ID +func ValidateProviderLockID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProviderLockID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Provider Lock ID +func (id ProviderLockId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Authorization/locks/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.LockName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Provider Lock ID +func (id ProviderLockId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAuthorization", "Microsoft.Authorization", "Microsoft.Authorization"), + resourceids.StaticSegment("staticLocks", "locks", "locks"), + resourceids.UserSpecifiedSegment("lockName", "lockValue"), + } +} + +// String returns a human-readable description of this Provider Lock ID +func (id ProviderLockId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Lock Name: %q", id.LockName), + } + return fmt.Sprintf("Provider Lock (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/id_resource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/id_resource.go new file mode 100644 index 000000000000..15cc88c74424 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/id_resource.go @@ -0,0 +1,158 @@ +package managementlocks + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ResourceId{} + +// ResourceId is a struct representing the Resource ID for a Resource +type ResourceId struct { + SubscriptionId string + ResourceGroupName string + ProviderName string + ParentResourcePath string + ResourceType string + ResourceName string +} + +// NewResourceID returns a new ResourceId struct +func NewResourceID(subscriptionId string, resourceGroupName string, providerName string, parentResourcePath string, resourceType string, resourceName string) ResourceId { + return ResourceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProviderName: providerName, + ParentResourcePath: parentResourcePath, + ResourceType: resourceType, + ResourceName: resourceName, + } +} + +// ParseResourceID parses 'input' into a ResourceId +func ParseResourceID(input string) (*ResourceId, error) { + parser := resourceids.NewParserFromResourceIdType(ResourceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ResourceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { + return nil, fmt.Errorf("the segment 'providerName' was not found in the resource id %q", input) + } + + if id.ParentResourcePath, ok = parsed.Parsed["parentResourcePath"]; !ok { + return nil, fmt.Errorf("the segment 'parentResourcePath' was not found in the resource id %q", input) + } + + if id.ResourceType, ok = parsed.Parsed["resourceType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceType' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseResourceIDInsensitively parses 'input' case-insensitively into a ResourceId +// note: this method should only be used for API response data and not user input +func ParseResourceIDInsensitively(input string) (*ResourceId, error) { + parser := resourceids.NewParserFromResourceIdType(ResourceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ResourceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { + return nil, fmt.Errorf("the segment 'providerName' was not found in the resource id %q", input) + } + + if id.ParentResourcePath, ok = parsed.Parsed["parentResourcePath"]; !ok { + return nil, fmt.Errorf("the segment 'parentResourcePath' was not found in the resource id %q", input) + } + + if id.ResourceType, ok = parsed.Parsed["resourceType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceType' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateResourceID checks that 'input' can be parsed as a Resource ID +func ValidateResourceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseResourceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Resource ID +func (id ResourceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/%s/%s/%s/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProviderName, id.ParentResourcePath, id.ResourceType, id.ResourceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Resource ID +func (id ResourceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.UserSpecifiedSegment("providerName", "providerValue"), + resourceids.UserSpecifiedSegment("parentResourcePath", "parentResourcePathValue"), + resourceids.UserSpecifiedSegment("resourceType", "resourceTypeValue"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + } +} + +// String returns a human-readable description of this Resource ID +func (id ResourceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Provider Name: %q", id.ProviderName), + fmt.Sprintf("Parent Resource Path: %q", id.ParentResourcePath), + fmt.Sprintf("Resource Type: %q", id.ResourceType), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + } + return fmt.Sprintf("Resource (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/id_resourcelock.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/id_resourcelock.go new file mode 100644 index 000000000000..38127b0a4ef2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/id_resourcelock.go @@ -0,0 +1,173 @@ +package managementlocks + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ResourceLockId{} + +// ResourceLockId is a struct representing the Resource ID for a Resource Lock +type ResourceLockId struct { + SubscriptionId string + ResourceGroupName string + ProviderName string + ParentResourcePath string + ResourceType string + ResourceName string + LockName string +} + +// NewResourceLockID returns a new ResourceLockId struct +func NewResourceLockID(subscriptionId string, resourceGroupName string, providerName string, parentResourcePath string, resourceType string, resourceName string, lockName string) ResourceLockId { + return ResourceLockId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProviderName: providerName, + ParentResourcePath: parentResourcePath, + ResourceType: resourceType, + ResourceName: resourceName, + LockName: lockName, + } +} + +// ParseResourceLockID parses 'input' into a ResourceLockId +func ParseResourceLockID(input string) (*ResourceLockId, error) { + parser := resourceids.NewParserFromResourceIdType(ResourceLockId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ResourceLockId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { + return nil, fmt.Errorf("the segment 'providerName' was not found in the resource id %q", input) + } + + if id.ParentResourcePath, ok = parsed.Parsed["parentResourcePath"]; !ok { + return nil, fmt.Errorf("the segment 'parentResourcePath' was not found in the resource id %q", input) + } + + if id.ResourceType, ok = parsed.Parsed["resourceType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceType' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + if id.LockName, ok = parsed.Parsed["lockName"]; !ok { + return nil, fmt.Errorf("the segment 'lockName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseResourceLockIDInsensitively parses 'input' case-insensitively into a ResourceLockId +// note: this method should only be used for API response data and not user input +func ParseResourceLockIDInsensitively(input string) (*ResourceLockId, error) { + parser := resourceids.NewParserFromResourceIdType(ResourceLockId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ResourceLockId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { + return nil, fmt.Errorf("the segment 'providerName' was not found in the resource id %q", input) + } + + if id.ParentResourcePath, ok = parsed.Parsed["parentResourcePath"]; !ok { + return nil, fmt.Errorf("the segment 'parentResourcePath' was not found in the resource id %q", input) + } + + if id.ResourceType, ok = parsed.Parsed["resourceType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceType' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + if id.LockName, ok = parsed.Parsed["lockName"]; !ok { + return nil, fmt.Errorf("the segment 'lockName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateResourceLockID checks that 'input' can be parsed as a Resource Lock ID +func ValidateResourceLockID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseResourceLockID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Resource Lock ID +func (id ResourceLockId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/%s/%s/%s/%s/providers/Microsoft.Authorization/locks/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProviderName, id.ParentResourcePath, id.ResourceType, id.ResourceName, id.LockName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Resource Lock ID +func (id ResourceLockId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.UserSpecifiedSegment("providerName", "providerValue"), + resourceids.UserSpecifiedSegment("parentResourcePath", "parentResourcePathValue"), + resourceids.UserSpecifiedSegment("resourceType", "resourceTypeValue"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.StaticSegment("staticProviders2", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAuthorization", "Microsoft.Authorization", "Microsoft.Authorization"), + resourceids.StaticSegment("staticLocks", "locks", "locks"), + resourceids.UserSpecifiedSegment("lockName", "lockValue"), + } +} + +// String returns a human-readable description of this Resource Lock ID +func (id ResourceLockId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Provider Name: %q", id.ProviderName), + fmt.Sprintf("Parent Resource Path: %q", id.ParentResourcePath), + fmt.Sprintf("Resource Type: %q", id.ResourceType), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Lock Name: %q", id.LockName), + } + return fmt.Sprintf("Resource Lock (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/id_scopedlock.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/id_scopedlock.go new file mode 100644 index 000000000000..9bb87a3cbfce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/id_scopedlock.go @@ -0,0 +1,110 @@ +package managementlocks + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ScopedLockId{} + +// ScopedLockId is a struct representing the Resource ID for a Scoped Lock +type ScopedLockId struct { + Scope string + LockName string +} + +// NewScopedLockID returns a new ScopedLockId struct +func NewScopedLockID(scope string, lockName string) ScopedLockId { + return ScopedLockId{ + Scope: scope, + LockName: lockName, + } +} + +// ParseScopedLockID parses 'input' into a ScopedLockId +func ParseScopedLockID(input string) (*ScopedLockId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedLockId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopedLockId{} + + if id.Scope, ok = parsed.Parsed["scope"]; !ok { + return nil, fmt.Errorf("the segment 'scope' was not found in the resource id %q", input) + } + + if id.LockName, ok = parsed.Parsed["lockName"]; !ok { + return nil, fmt.Errorf("the segment 'lockName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseScopedLockIDInsensitively parses 'input' case-insensitively into a ScopedLockId +// note: this method should only be used for API response data and not user input +func ParseScopedLockIDInsensitively(input string) (*ScopedLockId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedLockId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopedLockId{} + + if id.Scope, ok = parsed.Parsed["scope"]; !ok { + return nil, fmt.Errorf("the segment 'scope' was not found in the resource id %q", input) + } + + if id.LockName, ok = parsed.Parsed["lockName"]; !ok { + return nil, fmt.Errorf("the segment 'lockName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateScopedLockID checks that 'input' can be parsed as a Scoped Lock ID +func ValidateScopedLockID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseScopedLockID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scoped Lock ID +func (id ScopedLockId) ID() string { + fmtString := "/%s/providers/Microsoft.Authorization/locks/%s" + return fmt.Sprintf(fmtString, strings.TrimPrefix(id.Scope, "/"), id.LockName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scoped Lock ID +func (id ScopedLockId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.ScopeSegment("scope", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAuthorization", "Microsoft.Authorization", "Microsoft.Authorization"), + resourceids.StaticSegment("staticLocks", "locks", "locks"), + resourceids.UserSpecifiedSegment("lockName", "lockValue"), + } +} + +// String returns a human-readable description of this Scoped Lock ID +func (id ScopedLockId) String() string { + components := []string{ + fmt.Sprintf("Scope: %q", id.Scope), + fmt.Sprintf("Lock Name: %q", id.LockName), + } + return fmt.Sprintf("Scoped Lock (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_createorupdateatresourcegrouplevel_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_createorupdateatresourcegrouplevel_autorest.go new file mode 100644 index 000000000000..712fa4b40fa1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_createorupdateatresourcegrouplevel_autorest.go @@ -0,0 +1,69 @@ +package managementlocks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateAtResourceGroupLevelOperationResponse struct { + HttpResponse *http.Response + Model *ManagementLockObject +} + +// CreateOrUpdateAtResourceGroupLevel ... +func (c ManagementLocksClient) CreateOrUpdateAtResourceGroupLevel(ctx context.Context, id ProviderLockId, input ManagementLockObject) (result CreateOrUpdateAtResourceGroupLevelOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdateAtResourceGroupLevel(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdateAtResourceGroupLevel(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdateAtResourceGroupLevel prepares the CreateOrUpdateAtResourceGroupLevel request. +func (c ManagementLocksClient) preparerForCreateOrUpdateAtResourceGroupLevel(ctx context.Context, id ProviderLockId, input ManagementLockObject) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdateAtResourceGroupLevel handles the response to the CreateOrUpdateAtResourceGroupLevel request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForCreateOrUpdateAtResourceGroupLevel(resp *http.Response) (result CreateOrUpdateAtResourceGroupLevelOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_createorupdateatresourcelevel_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_createorupdateatresourcelevel_autorest.go new file mode 100644 index 000000000000..d9a278311901 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_createorupdateatresourcelevel_autorest.go @@ -0,0 +1,69 @@ +package managementlocks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateAtResourceLevelOperationResponse struct { + HttpResponse *http.Response + Model *ManagementLockObject +} + +// CreateOrUpdateAtResourceLevel ... +func (c ManagementLocksClient) CreateOrUpdateAtResourceLevel(ctx context.Context, id ResourceLockId, input ManagementLockObject) (result CreateOrUpdateAtResourceLevelOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdateAtResourceLevel(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "CreateOrUpdateAtResourceLevel", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "CreateOrUpdateAtResourceLevel", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdateAtResourceLevel(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "CreateOrUpdateAtResourceLevel", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdateAtResourceLevel prepares the CreateOrUpdateAtResourceLevel request. +func (c ManagementLocksClient) preparerForCreateOrUpdateAtResourceLevel(ctx context.Context, id ResourceLockId, input ManagementLockObject) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdateAtResourceLevel handles the response to the CreateOrUpdateAtResourceLevel request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForCreateOrUpdateAtResourceLevel(resp *http.Response) (result CreateOrUpdateAtResourceLevelOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_createorupdateatsubscriptionlevel_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_createorupdateatsubscriptionlevel_autorest.go new file mode 100644 index 000000000000..2bc2fd857d6e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_createorupdateatsubscriptionlevel_autorest.go @@ -0,0 +1,69 @@ +package managementlocks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateAtSubscriptionLevelOperationResponse struct { + HttpResponse *http.Response + Model *ManagementLockObject +} + +// CreateOrUpdateAtSubscriptionLevel ... +func (c ManagementLocksClient) CreateOrUpdateAtSubscriptionLevel(ctx context.Context, id LockId, input ManagementLockObject) (result CreateOrUpdateAtSubscriptionLevelOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdateAtSubscriptionLevel(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdateAtSubscriptionLevel(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdateAtSubscriptionLevel prepares the CreateOrUpdateAtSubscriptionLevel request. +func (c ManagementLocksClient) preparerForCreateOrUpdateAtSubscriptionLevel(ctx context.Context, id LockId, input ManagementLockObject) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdateAtSubscriptionLevel handles the response to the CreateOrUpdateAtSubscriptionLevel request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForCreateOrUpdateAtSubscriptionLevel(resp *http.Response) (result CreateOrUpdateAtSubscriptionLevelOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_createorupdatebyscope_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_createorupdatebyscope_autorest.go new file mode 100644 index 000000000000..9410b4e5f64b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_createorupdatebyscope_autorest.go @@ -0,0 +1,69 @@ +package managementlocks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateByScopeOperationResponse struct { + HttpResponse *http.Response + Model *ManagementLockObject +} + +// CreateOrUpdateByScope ... +func (c ManagementLocksClient) CreateOrUpdateByScope(ctx context.Context, id ScopedLockId, input ManagementLockObject) (result CreateOrUpdateByScopeOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdateByScope(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "CreateOrUpdateByScope", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "CreateOrUpdateByScope", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdateByScope(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "CreateOrUpdateByScope", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdateByScope prepares the CreateOrUpdateByScope request. +func (c ManagementLocksClient) preparerForCreateOrUpdateByScope(ctx context.Context, id ScopedLockId, input ManagementLockObject) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdateByScope handles the response to the CreateOrUpdateByScope request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForCreateOrUpdateByScope(resp *http.Response) (result CreateOrUpdateByScopeOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_deleteatresourcegrouplevel_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_deleteatresourcegrouplevel_autorest.go new file mode 100644 index 000000000000..5365e900bcf3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_deleteatresourcegrouplevel_autorest.go @@ -0,0 +1,66 @@ +package managementlocks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteAtResourceGroupLevelOperationResponse struct { + HttpResponse *http.Response +} + +// DeleteAtResourceGroupLevel ... +func (c ManagementLocksClient) DeleteAtResourceGroupLevel(ctx context.Context, id ProviderLockId) (result DeleteAtResourceGroupLevelOperationResponse, err error) { + req, err := c.preparerForDeleteAtResourceGroupLevel(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "DeleteAtResourceGroupLevel", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "DeleteAtResourceGroupLevel", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDeleteAtResourceGroupLevel(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "DeleteAtResourceGroupLevel", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDeleteAtResourceGroupLevel prepares the DeleteAtResourceGroupLevel request. +func (c ManagementLocksClient) preparerForDeleteAtResourceGroupLevel(ctx context.Context, id ProviderLockId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDeleteAtResourceGroupLevel handles the response to the DeleteAtResourceGroupLevel request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForDeleteAtResourceGroupLevel(resp *http.Response) (result DeleteAtResourceGroupLevelOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_deleteatresourcelevel_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_deleteatresourcelevel_autorest.go new file mode 100644 index 000000000000..b1648afd7032 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_deleteatresourcelevel_autorest.go @@ -0,0 +1,66 @@ +package managementlocks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteAtResourceLevelOperationResponse struct { + HttpResponse *http.Response +} + +// DeleteAtResourceLevel ... +func (c ManagementLocksClient) DeleteAtResourceLevel(ctx context.Context, id ResourceLockId) (result DeleteAtResourceLevelOperationResponse, err error) { + req, err := c.preparerForDeleteAtResourceLevel(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "DeleteAtResourceLevel", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "DeleteAtResourceLevel", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDeleteAtResourceLevel(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "DeleteAtResourceLevel", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDeleteAtResourceLevel prepares the DeleteAtResourceLevel request. +func (c ManagementLocksClient) preparerForDeleteAtResourceLevel(ctx context.Context, id ResourceLockId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDeleteAtResourceLevel handles the response to the DeleteAtResourceLevel request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForDeleteAtResourceLevel(resp *http.Response) (result DeleteAtResourceLevelOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_deleteatsubscriptionlevel_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_deleteatsubscriptionlevel_autorest.go new file mode 100644 index 000000000000..8324debca2ed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_deleteatsubscriptionlevel_autorest.go @@ -0,0 +1,66 @@ +package managementlocks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteAtSubscriptionLevelOperationResponse struct { + HttpResponse *http.Response +} + +// DeleteAtSubscriptionLevel ... +func (c ManagementLocksClient) DeleteAtSubscriptionLevel(ctx context.Context, id LockId) (result DeleteAtSubscriptionLevelOperationResponse, err error) { + req, err := c.preparerForDeleteAtSubscriptionLevel(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "DeleteAtSubscriptionLevel", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "DeleteAtSubscriptionLevel", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDeleteAtSubscriptionLevel(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "DeleteAtSubscriptionLevel", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDeleteAtSubscriptionLevel prepares the DeleteAtSubscriptionLevel request. +func (c ManagementLocksClient) preparerForDeleteAtSubscriptionLevel(ctx context.Context, id LockId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDeleteAtSubscriptionLevel handles the response to the DeleteAtSubscriptionLevel request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForDeleteAtSubscriptionLevel(resp *http.Response) (result DeleteAtSubscriptionLevelOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_deletebyscope_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_deletebyscope_autorest.go new file mode 100644 index 000000000000..493345e25afd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_deletebyscope_autorest.go @@ -0,0 +1,66 @@ +package managementlocks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteByScopeOperationResponse struct { + HttpResponse *http.Response +} + +// DeleteByScope ... +func (c ManagementLocksClient) DeleteByScope(ctx context.Context, id ScopedLockId) (result DeleteByScopeOperationResponse, err error) { + req, err := c.preparerForDeleteByScope(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "DeleteByScope", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "DeleteByScope", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDeleteByScope(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "DeleteByScope", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDeleteByScope prepares the DeleteByScope request. +func (c ManagementLocksClient) preparerForDeleteByScope(ctx context.Context, id ScopedLockId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDeleteByScope handles the response to the DeleteByScope request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForDeleteByScope(resp *http.Response) (result DeleteByScopeOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_getatresourcegrouplevel_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_getatresourcegrouplevel_autorest.go new file mode 100644 index 000000000000..b23d946a2447 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_getatresourcegrouplevel_autorest.go @@ -0,0 +1,68 @@ +package managementlocks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetAtResourceGroupLevelOperationResponse struct { + HttpResponse *http.Response + Model *ManagementLockObject +} + +// GetAtResourceGroupLevel ... +func (c ManagementLocksClient) GetAtResourceGroupLevel(ctx context.Context, id ProviderLockId) (result GetAtResourceGroupLevelOperationResponse, err error) { + req, err := c.preparerForGetAtResourceGroupLevel(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "GetAtResourceGroupLevel", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "GetAtResourceGroupLevel", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetAtResourceGroupLevel(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "GetAtResourceGroupLevel", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetAtResourceGroupLevel prepares the GetAtResourceGroupLevel request. +func (c ManagementLocksClient) preparerForGetAtResourceGroupLevel(ctx context.Context, id ProviderLockId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetAtResourceGroupLevel handles the response to the GetAtResourceGroupLevel request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForGetAtResourceGroupLevel(resp *http.Response) (result GetAtResourceGroupLevelOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_getatresourcelevel_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_getatresourcelevel_autorest.go new file mode 100644 index 000000000000..f4b4ead5bf4d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_getatresourcelevel_autorest.go @@ -0,0 +1,68 @@ +package managementlocks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetAtResourceLevelOperationResponse struct { + HttpResponse *http.Response + Model *ManagementLockObject +} + +// GetAtResourceLevel ... +func (c ManagementLocksClient) GetAtResourceLevel(ctx context.Context, id ResourceLockId) (result GetAtResourceLevelOperationResponse, err error) { + req, err := c.preparerForGetAtResourceLevel(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "GetAtResourceLevel", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "GetAtResourceLevel", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetAtResourceLevel(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "GetAtResourceLevel", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetAtResourceLevel prepares the GetAtResourceLevel request. +func (c ManagementLocksClient) preparerForGetAtResourceLevel(ctx context.Context, id ResourceLockId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetAtResourceLevel handles the response to the GetAtResourceLevel request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForGetAtResourceLevel(resp *http.Response) (result GetAtResourceLevelOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_getatsubscriptionlevel_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_getatsubscriptionlevel_autorest.go new file mode 100644 index 000000000000..6b4aea0ab046 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_getatsubscriptionlevel_autorest.go @@ -0,0 +1,68 @@ +package managementlocks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetAtSubscriptionLevelOperationResponse struct { + HttpResponse *http.Response + Model *ManagementLockObject +} + +// GetAtSubscriptionLevel ... +func (c ManagementLocksClient) GetAtSubscriptionLevel(ctx context.Context, id LockId) (result GetAtSubscriptionLevelOperationResponse, err error) { + req, err := c.preparerForGetAtSubscriptionLevel(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "GetAtSubscriptionLevel", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "GetAtSubscriptionLevel", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetAtSubscriptionLevel(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "GetAtSubscriptionLevel", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetAtSubscriptionLevel prepares the GetAtSubscriptionLevel request. +func (c ManagementLocksClient) preparerForGetAtSubscriptionLevel(ctx context.Context, id LockId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetAtSubscriptionLevel handles the response to the GetAtSubscriptionLevel request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForGetAtSubscriptionLevel(resp *http.Response) (result GetAtSubscriptionLevelOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_getbyscope_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_getbyscope_autorest.go new file mode 100644 index 000000000000..6ab44235015b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_getbyscope_autorest.go @@ -0,0 +1,68 @@ +package managementlocks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetByScopeOperationResponse struct { + HttpResponse *http.Response + Model *ManagementLockObject +} + +// GetByScope ... +func (c ManagementLocksClient) GetByScope(ctx context.Context, id ScopedLockId) (result GetByScopeOperationResponse, err error) { + req, err := c.preparerForGetByScope(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "GetByScope", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "GetByScope", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetByScope(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "GetByScope", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetByScope prepares the GetByScope request. +func (c ManagementLocksClient) preparerForGetByScope(ctx context.Context, id ScopedLockId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetByScope handles the response to the GetByScope request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForGetByScope(resp *http.Response) (result GetByScopeOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_listatresourcegrouplevel_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_listatresourcegrouplevel_autorest.go new file mode 100644 index 000000000000..c19f90ffa38e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_listatresourcegrouplevel_autorest.go @@ -0,0 +1,216 @@ +package managementlocks + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAtResourceGroupLevelOperationResponse struct { + HttpResponse *http.Response + Model *[]ManagementLockObject + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListAtResourceGroupLevelOperationResponse, error) +} + +type ListAtResourceGroupLevelCompleteResult struct { + Items []ManagementLockObject +} + +func (r ListAtResourceGroupLevelOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListAtResourceGroupLevelOperationResponse) LoadMore(ctx context.Context) (resp ListAtResourceGroupLevelOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListAtResourceGroupLevelOperationOptions struct { + Filter *string +} + +func DefaultListAtResourceGroupLevelOperationOptions() ListAtResourceGroupLevelOperationOptions { + return ListAtResourceGroupLevelOperationOptions{} +} + +func (o ListAtResourceGroupLevelOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListAtResourceGroupLevelOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// ListAtResourceGroupLevel ... +func (c ManagementLocksClient) ListAtResourceGroupLevel(ctx context.Context, id commonids.ResourceGroupId, options ListAtResourceGroupLevelOperationOptions) (resp ListAtResourceGroupLevelOperationResponse, err error) { + req, err := c.preparerForListAtResourceGroupLevel(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtResourceGroupLevel", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtResourceGroupLevel", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListAtResourceGroupLevel(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtResourceGroupLevel", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListAtResourceGroupLevel prepares the ListAtResourceGroupLevel request. +func (c ManagementLocksClient) preparerForListAtResourceGroupLevel(ctx context.Context, id commonids.ResourceGroupId, options ListAtResourceGroupLevelOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Authorization/locks", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListAtResourceGroupLevelWithNextLink prepares the ListAtResourceGroupLevel request with the given nextLink token. +func (c ManagementLocksClient) preparerForListAtResourceGroupLevelWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListAtResourceGroupLevel handles the response to the ListAtResourceGroupLevel request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForListAtResourceGroupLevel(resp *http.Response) (result ListAtResourceGroupLevelOperationResponse, err error) { + type page struct { + Values []ManagementLockObject `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListAtResourceGroupLevelOperationResponse, err error) { + req, err := c.preparerForListAtResourceGroupLevelWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtResourceGroupLevel", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtResourceGroupLevel", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListAtResourceGroupLevel(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtResourceGroupLevel", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListAtResourceGroupLevelComplete retrieves all of the results into a single object +func (c ManagementLocksClient) ListAtResourceGroupLevelComplete(ctx context.Context, id commonids.ResourceGroupId, options ListAtResourceGroupLevelOperationOptions) (ListAtResourceGroupLevelCompleteResult, error) { + return c.ListAtResourceGroupLevelCompleteMatchingPredicate(ctx, id, options, ManagementLockObjectOperationPredicate{}) +} + +// ListAtResourceGroupLevelCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ManagementLocksClient) ListAtResourceGroupLevelCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListAtResourceGroupLevelOperationOptions, predicate ManagementLockObjectOperationPredicate) (resp ListAtResourceGroupLevelCompleteResult, err error) { + items := make([]ManagementLockObject, 0) + + page, err := c.ListAtResourceGroupLevel(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListAtResourceGroupLevelCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_listatresourcelevel_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_listatresourcelevel_autorest.go new file mode 100644 index 000000000000..674c46808874 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_listatresourcelevel_autorest.go @@ -0,0 +1,215 @@ +package managementlocks + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAtResourceLevelOperationResponse struct { + HttpResponse *http.Response + Model *[]ManagementLockObject + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListAtResourceLevelOperationResponse, error) +} + +type ListAtResourceLevelCompleteResult struct { + Items []ManagementLockObject +} + +func (r ListAtResourceLevelOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListAtResourceLevelOperationResponse) LoadMore(ctx context.Context) (resp ListAtResourceLevelOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListAtResourceLevelOperationOptions struct { + Filter *string +} + +func DefaultListAtResourceLevelOperationOptions() ListAtResourceLevelOperationOptions { + return ListAtResourceLevelOperationOptions{} +} + +func (o ListAtResourceLevelOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListAtResourceLevelOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// ListAtResourceLevel ... +func (c ManagementLocksClient) ListAtResourceLevel(ctx context.Context, id ResourceId, options ListAtResourceLevelOperationOptions) (resp ListAtResourceLevelOperationResponse, err error) { + req, err := c.preparerForListAtResourceLevel(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtResourceLevel", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtResourceLevel", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListAtResourceLevel(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtResourceLevel", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListAtResourceLevel prepares the ListAtResourceLevel request. +func (c ManagementLocksClient) preparerForListAtResourceLevel(ctx context.Context, id ResourceId, options ListAtResourceLevelOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Authorization/locks", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListAtResourceLevelWithNextLink prepares the ListAtResourceLevel request with the given nextLink token. +func (c ManagementLocksClient) preparerForListAtResourceLevelWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListAtResourceLevel handles the response to the ListAtResourceLevel request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForListAtResourceLevel(resp *http.Response) (result ListAtResourceLevelOperationResponse, err error) { + type page struct { + Values []ManagementLockObject `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListAtResourceLevelOperationResponse, err error) { + req, err := c.preparerForListAtResourceLevelWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtResourceLevel", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtResourceLevel", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListAtResourceLevel(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtResourceLevel", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListAtResourceLevelComplete retrieves all of the results into a single object +func (c ManagementLocksClient) ListAtResourceLevelComplete(ctx context.Context, id ResourceId, options ListAtResourceLevelOperationOptions) (ListAtResourceLevelCompleteResult, error) { + return c.ListAtResourceLevelCompleteMatchingPredicate(ctx, id, options, ManagementLockObjectOperationPredicate{}) +} + +// ListAtResourceLevelCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ManagementLocksClient) ListAtResourceLevelCompleteMatchingPredicate(ctx context.Context, id ResourceId, options ListAtResourceLevelOperationOptions, predicate ManagementLockObjectOperationPredicate) (resp ListAtResourceLevelCompleteResult, err error) { + items := make([]ManagementLockObject, 0) + + page, err := c.ListAtResourceLevel(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListAtResourceLevelCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_listatsubscriptionlevel_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_listatsubscriptionlevel_autorest.go new file mode 100644 index 000000000000..b50549e36daf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_listatsubscriptionlevel_autorest.go @@ -0,0 +1,216 @@ +package managementlocks + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAtSubscriptionLevelOperationResponse struct { + HttpResponse *http.Response + Model *[]ManagementLockObject + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListAtSubscriptionLevelOperationResponse, error) +} + +type ListAtSubscriptionLevelCompleteResult struct { + Items []ManagementLockObject +} + +func (r ListAtSubscriptionLevelOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListAtSubscriptionLevelOperationResponse) LoadMore(ctx context.Context) (resp ListAtSubscriptionLevelOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListAtSubscriptionLevelOperationOptions struct { + Filter *string +} + +func DefaultListAtSubscriptionLevelOperationOptions() ListAtSubscriptionLevelOperationOptions { + return ListAtSubscriptionLevelOperationOptions{} +} + +func (o ListAtSubscriptionLevelOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListAtSubscriptionLevelOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// ListAtSubscriptionLevel ... +func (c ManagementLocksClient) ListAtSubscriptionLevel(ctx context.Context, id commonids.SubscriptionId, options ListAtSubscriptionLevelOperationOptions) (resp ListAtSubscriptionLevelOperationResponse, err error) { + req, err := c.preparerForListAtSubscriptionLevel(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtSubscriptionLevel", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtSubscriptionLevel", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListAtSubscriptionLevel(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtSubscriptionLevel", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListAtSubscriptionLevel prepares the ListAtSubscriptionLevel request. +func (c ManagementLocksClient) preparerForListAtSubscriptionLevel(ctx context.Context, id commonids.SubscriptionId, options ListAtSubscriptionLevelOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Authorization/locks", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListAtSubscriptionLevelWithNextLink prepares the ListAtSubscriptionLevel request with the given nextLink token. +func (c ManagementLocksClient) preparerForListAtSubscriptionLevelWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListAtSubscriptionLevel handles the response to the ListAtSubscriptionLevel request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForListAtSubscriptionLevel(resp *http.Response) (result ListAtSubscriptionLevelOperationResponse, err error) { + type page struct { + Values []ManagementLockObject `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListAtSubscriptionLevelOperationResponse, err error) { + req, err := c.preparerForListAtSubscriptionLevelWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtSubscriptionLevel", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtSubscriptionLevel", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListAtSubscriptionLevel(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListAtSubscriptionLevel", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListAtSubscriptionLevelComplete retrieves all of the results into a single object +func (c ManagementLocksClient) ListAtSubscriptionLevelComplete(ctx context.Context, id commonids.SubscriptionId, options ListAtSubscriptionLevelOperationOptions) (ListAtSubscriptionLevelCompleteResult, error) { + return c.ListAtSubscriptionLevelCompleteMatchingPredicate(ctx, id, options, ManagementLockObjectOperationPredicate{}) +} + +// ListAtSubscriptionLevelCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ManagementLocksClient) ListAtSubscriptionLevelCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListAtSubscriptionLevelOperationOptions, predicate ManagementLockObjectOperationPredicate) (resp ListAtSubscriptionLevelCompleteResult, err error) { + items := make([]ManagementLockObject, 0) + + page, err := c.ListAtSubscriptionLevel(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListAtSubscriptionLevelCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_listbyscope_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_listbyscope_autorest.go new file mode 100644 index 000000000000..83c088d91d7e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/method_listbyscope_autorest.go @@ -0,0 +1,216 @@ +package managementlocks + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByScopeOperationResponse struct { + HttpResponse *http.Response + Model *[]ManagementLockObject + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByScopeOperationResponse, error) +} + +type ListByScopeCompleteResult struct { + Items []ManagementLockObject +} + +func (r ListByScopeOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByScopeOperationResponse) LoadMore(ctx context.Context) (resp ListByScopeOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByScopeOperationOptions struct { + Filter *string +} + +func DefaultListByScopeOperationOptions() ListByScopeOperationOptions { + return ListByScopeOperationOptions{} +} + +func (o ListByScopeOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByScopeOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// ListByScope ... +func (c ManagementLocksClient) ListByScope(ctx context.Context, id commonids.ScopeId, options ListByScopeOperationOptions) (resp ListByScopeOperationResponse, err error) { + req, err := c.preparerForListByScope(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListByScope", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListByScope", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByScope(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListByScope", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByScope prepares the ListByScope request. +func (c ManagementLocksClient) preparerForListByScope(ctx context.Context, id commonids.ScopeId, options ListByScopeOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Authorization/locks", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByScopeWithNextLink prepares the ListByScope request with the given nextLink token. +func (c ManagementLocksClient) preparerForListByScopeWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByScope handles the response to the ListByScope request. The method always +// closes the http.Response Body. +func (c ManagementLocksClient) responderForListByScope(resp *http.Response) (result ListByScopeOperationResponse, err error) { + type page struct { + Values []ManagementLockObject `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByScopeOperationResponse, err error) { + req, err := c.preparerForListByScopeWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListByScope", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListByScope", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByScope(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managementlocks.ManagementLocksClient", "ListByScope", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByScopeComplete retrieves all of the results into a single object +func (c ManagementLocksClient) ListByScopeComplete(ctx context.Context, id commonids.ScopeId, options ListByScopeOperationOptions) (ListByScopeCompleteResult, error) { + return c.ListByScopeCompleteMatchingPredicate(ctx, id, options, ManagementLockObjectOperationPredicate{}) +} + +// ListByScopeCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ManagementLocksClient) ListByScopeCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, options ListByScopeOperationOptions, predicate ManagementLockObjectOperationPredicate) (resp ListByScopeCompleteResult, err error) { + items := make([]ManagementLockObject, 0) + + page, err := c.ListByScope(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByScopeCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/model_managementlockobject.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/model_managementlockobject.go new file mode 100644 index 000000000000..f2e419f69cc5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/model_managementlockobject.go @@ -0,0 +1,16 @@ +package managementlocks + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagementLockObject struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties ManagementLockProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/model_managementlockowner.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/model_managementlockowner.go new file mode 100644 index 000000000000..4e7b7388e30b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/model_managementlockowner.go @@ -0,0 +1,8 @@ +package managementlocks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagementLockOwner struct { + ApplicationId *string `json:"applicationId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/model_managementlockproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/model_managementlockproperties.go new file mode 100644 index 000000000000..e1faa42ebb39 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/model_managementlockproperties.go @@ -0,0 +1,10 @@ +package managementlocks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagementLockProperties struct { + Level LockLevel `json:"level"` + Notes *string `json:"notes,omitempty"` + Owners *[]ManagementLockOwner `json:"owners,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/predicates.go new file mode 100644 index 000000000000..7ce2a4bb00a3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/predicates.go @@ -0,0 +1,24 @@ +package managementlocks + +type ManagementLockObjectOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ManagementLockObjectOperationPredicate) Matches(input ManagementLockObject) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/version.go new file mode 100644 index 000000000000..dcaf3863847e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks/version.go @@ -0,0 +1,12 @@ +package managementlocks + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/managementlocks/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/README.md index bf288d6da178..fbef639a6997 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := deploymentscripts.NewDeploymentScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scriptValue") +id := deploymentscripts.NewDeploymentScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentScriptValue") payload := deploymentscripts.DeploymentScript{ // ... @@ -41,7 +41,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := deploymentscripts.NewDeploymentScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scriptValue") +id := deploymentscripts.NewDeploymentScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentScriptValue") read, err := client.Delete(ctx, id) if err != nil { @@ -57,7 +57,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := deploymentscripts.NewDeploymentScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scriptValue") +id := deploymentscripts.NewDeploymentScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentScriptValue") read, err := client.Get(ctx, id) if err != nil { @@ -73,7 +73,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := deploymentscripts.NewDeploymentScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scriptValue") +id := deploymentscripts.NewDeploymentScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentScriptValue") read, err := client.GetLogs(ctx, id) if err != nil { @@ -89,7 +89,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := deploymentscripts.NewDeploymentScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scriptValue") +id := deploymentscripts.NewDeploymentScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentScriptValue") read, err := client.GetLogsDefault(ctx, id, deploymentscripts.DefaultGetLogsDefaultOperationOptions()) if err != nil { @@ -139,7 +139,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := deploymentscripts.NewDeploymentScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scriptValue") +id := deploymentscripts.NewDeploymentScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "deploymentScriptValue") payload := deploymentscripts.DeploymentScriptUpdateParameter{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/id_deploymentscript.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/id_deploymentscript.go index 13f45bb6ef89..f7500f2e1af7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/id_deploymentscript.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/id_deploymentscript.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = DeploymentScriptId{} // DeploymentScriptId is a struct representing the Resource ID for a Deployment Script type DeploymentScriptId struct { - SubscriptionId string - ResourceGroupName string - ScriptName string + SubscriptionId string + ResourceGroupName string + DeploymentScriptName string } // NewDeploymentScriptID returns a new DeploymentScriptId struct -func NewDeploymentScriptID(subscriptionId string, resourceGroupName string, scriptName string) DeploymentScriptId { +func NewDeploymentScriptID(subscriptionId string, resourceGroupName string, deploymentScriptName string) DeploymentScriptId { return DeploymentScriptId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ScriptName: scriptName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DeploymentScriptName: deploymentScriptName, } } @@ -44,8 +44,8 @@ func ParseDeploymentScriptID(input string) (*DeploymentScriptId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ScriptName, ok = parsed.Parsed["scriptName"]; !ok { - return nil, fmt.Errorf("the segment 'scriptName' was not found in the resource id %q", input) + if id.DeploymentScriptName, ok = parsed.Parsed["deploymentScriptName"]; !ok { + return nil, fmt.Errorf("the segment 'deploymentScriptName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseDeploymentScriptIDInsensitively(input string) (*DeploymentScriptId, er return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ScriptName, ok = parsed.Parsed["scriptName"]; !ok { - return nil, fmt.Errorf("the segment 'scriptName' was not found in the resource id %q", input) + if id.DeploymentScriptName, ok = parsed.Parsed["deploymentScriptName"]; !ok { + return nil, fmt.Errorf("the segment 'deploymentScriptName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateDeploymentScriptID(input interface{}, key string) (warnings []strin // ID returns the formatted Deployment Script ID func (id DeploymentScriptId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Resources/deploymentScripts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ScriptName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DeploymentScriptName) } // Segments returns a slice of Resource ID Segments which comprise this Deployment Script ID @@ -109,7 +109,7 @@ func (id DeploymentScriptId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftResources", "Microsoft.Resources", "Microsoft.Resources"), resourceids.StaticSegment("staticDeploymentScripts", "deploymentScripts", "deploymentScripts"), - resourceids.UserSpecifiedSegment("scriptName", "scriptValue"), + resourceids.UserSpecifiedSegment("deploymentScriptName", "deploymentScriptValue"), } } @@ -118,7 +118,7 @@ func (id DeploymentScriptId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Script Name: %q", id.ScriptName), + fmt.Sprintf("Deployment Script Name: %q", id.DeploymentScriptName), } return fmt.Sprintf("Deployment Script (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_get_autorest.go index d8696b3e4130..95ab55cccb34 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_get_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_get_autorest.go @@ -2,8 +2,7 @@ package deploymentscripts import ( "context" - "fmt" - "io/ioutil" + "encoding/json" "net/http" "github.com/Azure/go-autorest/autorest" @@ -59,16 +58,14 @@ func (c DeploymentScriptsClient) preparerForGet(ctx context.Context, id Deployme // responderForGet handles the response to the Get request. The method always // closes the http.Response Body. func (c DeploymentScriptsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + var respObj json.RawMessage err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), autorest.ByClosing()) result.HttpResponse = resp - b, err := ioutil.ReadAll(resp.Body) - if err != nil { - return result, fmt.Errorf("reading response body for DeploymentScript: %+v", err) - } - model, err := unmarshalDeploymentScriptImplementation(b) + model, err := unmarshalDeploymentScriptImplementation(respObj) if err != nil { return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_listbyresourcegroup_autorest.go index 51fd022313d9..71df468848f3 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_listbyresourcegroup_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_listbyresourcegroup_autorest.go @@ -2,6 +2,7 @@ package deploymentscripts import ( "context" + "encoding/json" "fmt" "net/http" "net/url" @@ -104,16 +105,26 @@ func (c DeploymentScriptsClient) preparerForListByResourceGroupWithNextLink(ctx // closes the http.Response Body. func (c DeploymentScriptsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { type page struct { - Values []DeploymentScript `json:"value"` - NextLink *string `json:"nextLink"` + Values []json.RawMessage `json:"value"` + NextLink *string `json:"nextLink"` } var respObj page err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), autorest.ByClosing()) result.HttpResponse = resp - result.Model = &respObj.Values + temp := make([]DeploymentScript, 0) + for i, v := range respObj.Values { + val, err := unmarshalDeploymentScriptImplementation(v) + if err != nil { + err = fmt.Errorf("unmarshalling item %d for DeploymentScript (%q): %+v", i, v, err) + return result, err + } + temp = append(temp, val) + } + result.Model = &temp result.nextLink = respObj.NextLink if respObj.NextLink != nil { result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_listbysubscription_autorest.go index 1e62ba9ef9fc..4caaa7af6126 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_listbysubscription_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_listbysubscription_autorest.go @@ -2,6 +2,7 @@ package deploymentscripts import ( "context" + "encoding/json" "fmt" "net/http" "net/url" @@ -104,16 +105,26 @@ func (c DeploymentScriptsClient) preparerForListBySubscriptionWithNextLink(ctx c // closes the http.Response Body. func (c DeploymentScriptsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { type page struct { - Values []DeploymentScript `json:"value"` - NextLink *string `json:"nextLink"` + Values []json.RawMessage `json:"value"` + NextLink *string `json:"nextLink"` } var respObj page err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), autorest.ByClosing()) result.HttpResponse = resp - result.Model = &respObj.Values + temp := make([]DeploymentScript, 0) + for i, v := range respObj.Values { + val, err := unmarshalDeploymentScriptImplementation(v) + if err != nil { + err = fmt.Errorf("unmarshalling item %d for DeploymentScript (%q): %+v", i, v, err) + return result, err + } + temp = append(temp, val) + } + result.Model = &temp result.nextLink = respObj.NextLink if respObj.NextLink != nil { result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_update_autorest.go index 92be79bc54a9..6a96d9234710 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_update_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts/method_update_autorest.go @@ -2,8 +2,7 @@ package deploymentscripts import ( "context" - "fmt" - "io/ioutil" + "encoding/json" "net/http" "github.com/Azure/go-autorest/autorest" @@ -60,16 +59,14 @@ func (c DeploymentScriptsClient) preparerForUpdate(ctx context.Context, id Deplo // responderForUpdate handles the response to the Update request. The method always // closes the http.Response Body. func (c DeploymentScriptsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + var respObj json.RawMessage err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), autorest.ByClosing()) result.HttpResponse = resp - b, err := ioutil.ReadAll(resp.Body) - if err != nil { - return result, fmt.Errorf("reading response body for DeploymentScript: %+v", err) - } - model, err := unmarshalDeploymentScriptImplementation(b) + model, err := unmarshalDeploymentScriptImplementation(respObj) if err != nil { return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/README.md index 5e2d9375cdbe..704969deb056 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := querykeys.NewCreateQueryKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue", "nameValue") +id := querykeys.NewCreateQueryKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue", "createQueryKeyValue") read, err := client.Create(ctx, id, querykeys.DefaultCreateOperationOptions()) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := querykeys.NewDeleteQueryKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue", "keyValue") +id := querykeys.NewDeleteQueryKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue", "deleteQueryKeyValue") read, err := client.Delete(ctx, id, querykeys.DefaultDeleteOperationOptions()) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/id_createquerykey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/id_createquerykey.go index 8ed297810e4f..0eeb68100aa4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/id_createquerykey.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/id_createquerykey.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = CreateQueryKeyId{} // CreateQueryKeyId is a struct representing the Resource ID for a Create Query Key type CreateQueryKeyId struct { - SubscriptionId string - ResourceGroupName string - SearchServiceName string - Name string + SubscriptionId string + ResourceGroupName string + SearchServiceName string + CreateQueryKeyName string } // NewCreateQueryKeyID returns a new CreateQueryKeyId struct -func NewCreateQueryKeyID(subscriptionId string, resourceGroupName string, searchServiceName string, name string) CreateQueryKeyId { +func NewCreateQueryKeyID(subscriptionId string, resourceGroupName string, searchServiceName string, createQueryKeyName string) CreateQueryKeyId { return CreateQueryKeyId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - SearchServiceName: searchServiceName, - Name: name, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SearchServiceName: searchServiceName, + CreateQueryKeyName: createQueryKeyName, } } @@ -50,8 +50,8 @@ func ParseCreateQueryKeyID(input string) (*CreateQueryKeyId, error) { return nil, fmt.Errorf("the segment 'searchServiceName' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.CreateQueryKeyName, ok = parsed.Parsed["createQueryKeyName"]; !ok { + return nil, fmt.Errorf("the segment 'createQueryKeyName' was not found in the resource id %q", input) } return &id, nil @@ -81,8 +81,8 @@ func ParseCreateQueryKeyIDInsensitively(input string) (*CreateQueryKeyId, error) return nil, fmt.Errorf("the segment 'searchServiceName' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.CreateQueryKeyName, ok = parsed.Parsed["createQueryKeyName"]; !ok { + return nil, fmt.Errorf("the segment 'createQueryKeyName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateCreateQueryKeyID(input interface{}, key string) (warnings []string, // ID returns the formatted Create Query Key ID func (id CreateQueryKeyId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Search/searchServices/%s/createQueryKey/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SearchServiceName, id.Name) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SearchServiceName, id.CreateQueryKeyName) } // Segments returns a slice of Resource ID Segments which comprise this Create Query Key ID @@ -121,7 +121,7 @@ func (id CreateQueryKeyId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticSearchServices", "searchServices", "searchServices"), resourceids.UserSpecifiedSegment("searchServiceName", "searchServiceValue"), resourceids.StaticSegment("staticCreateQueryKey", "createQueryKey", "createQueryKey"), - resourceids.UserSpecifiedSegment("name", "nameValue"), + resourceids.UserSpecifiedSegment("createQueryKeyName", "createQueryKeyValue"), } } @@ -131,7 +131,7 @@ func (id CreateQueryKeyId) String() string { fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Search Service Name: %q", id.SearchServiceName), - fmt.Sprintf("Name: %q", id.Name), + fmt.Sprintf("Create Query Key Name: %q", id.CreateQueryKeyName), } return fmt.Sprintf("Create Query Key (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/id_deletequerykey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/id_deletequerykey.go index 8b640adc2bff..e32d76662d00 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/id_deletequerykey.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/id_deletequerykey.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = DeleteQueryKeyId{} // DeleteQueryKeyId is a struct representing the Resource ID for a Delete Query Key type DeleteQueryKeyId struct { - SubscriptionId string - ResourceGroupName string - SearchServiceName string - Key string + SubscriptionId string + ResourceGroupName string + SearchServiceName string + DeleteQueryKeyName string } // NewDeleteQueryKeyID returns a new DeleteQueryKeyId struct -func NewDeleteQueryKeyID(subscriptionId string, resourceGroupName string, searchServiceName string, key string) DeleteQueryKeyId { +func NewDeleteQueryKeyID(subscriptionId string, resourceGroupName string, searchServiceName string, deleteQueryKeyName string) DeleteQueryKeyId { return DeleteQueryKeyId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - SearchServiceName: searchServiceName, - Key: key, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SearchServiceName: searchServiceName, + DeleteQueryKeyName: deleteQueryKeyName, } } @@ -50,8 +50,8 @@ func ParseDeleteQueryKeyID(input string) (*DeleteQueryKeyId, error) { return nil, fmt.Errorf("the segment 'searchServiceName' was not found in the resource id %q", input) } - if id.Key, ok = parsed.Parsed["key"]; !ok { - return nil, fmt.Errorf("the segment 'key' was not found in the resource id %q", input) + if id.DeleteQueryKeyName, ok = parsed.Parsed["deleteQueryKeyName"]; !ok { + return nil, fmt.Errorf("the segment 'deleteQueryKeyName' was not found in the resource id %q", input) } return &id, nil @@ -81,8 +81,8 @@ func ParseDeleteQueryKeyIDInsensitively(input string) (*DeleteQueryKeyId, error) return nil, fmt.Errorf("the segment 'searchServiceName' was not found in the resource id %q", input) } - if id.Key, ok = parsed.Parsed["key"]; !ok { - return nil, fmt.Errorf("the segment 'key' was not found in the resource id %q", input) + if id.DeleteQueryKeyName, ok = parsed.Parsed["deleteQueryKeyName"]; !ok { + return nil, fmt.Errorf("the segment 'deleteQueryKeyName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateDeleteQueryKeyID(input interface{}, key string) (warnings []string, // ID returns the formatted Delete Query Key ID func (id DeleteQueryKeyId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Search/searchServices/%s/deleteQueryKey/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SearchServiceName, id.Key) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SearchServiceName, id.DeleteQueryKeyName) } // Segments returns a slice of Resource ID Segments which comprise this Delete Query Key ID @@ -121,7 +121,7 @@ func (id DeleteQueryKeyId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticSearchServices", "searchServices", "searchServices"), resourceids.UserSpecifiedSegment("searchServiceName", "searchServiceValue"), resourceids.StaticSegment("staticDeleteQueryKey", "deleteQueryKey", "deleteQueryKey"), - resourceids.UserSpecifiedSegment("key", "keyValue"), + resourceids.UserSpecifiedSegment("deleteQueryKeyName", "deleteQueryKeyValue"), } } @@ -131,7 +131,7 @@ func (id DeleteQueryKeyId) String() string { fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Search Service Name: %q", id.SearchServiceName), - fmt.Sprintf("Key: %q", id.Key), + fmt.Sprintf("Delete Query Key Name: %q", id.DeleteQueryKeyName), } return fmt.Sprintf("Delete Query Key (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/README.md new file mode 100644 index 000000000000..6b4ebf64ca1e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/README.md @@ -0,0 +1,89 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates` Documentation + +The `sentinelonboardingstates` SDK allows for interaction with the Azure Resource Manager Service `securityinsights` (API Version `2022-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates" +``` + + +### Client Initialization + +```go +client := sentinelonboardingstates.NewSentinelOnboardingStatesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SentinelOnboardingStatesClient.Create` + +```go +ctx := context.TODO() +id := sentinelonboardingstates.NewOnboardingStateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "onboardingStateValue") + +payload := sentinelonboardingstates.SentinelOnboardingState{ + // ... +} + + +read, err := client.Create(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SentinelOnboardingStatesClient.Delete` + +```go +ctx := context.TODO() +id := sentinelonboardingstates.NewOnboardingStateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "onboardingStateValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SentinelOnboardingStatesClient.Get` + +```go +ctx := context.TODO() +id := sentinelonboardingstates.NewOnboardingStateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "onboardingStateValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SentinelOnboardingStatesClient.List` + +```go +ctx := context.TODO() +id := sentinelonboardingstates.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/client.go new file mode 100644 index 000000000000..0ae442ba3fa2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/client.go @@ -0,0 +1,18 @@ +package sentinelonboardingstates + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SentinelOnboardingStatesClient struct { + Client autorest.Client + baseUri string +} + +func NewSentinelOnboardingStatesClientWithBaseURI(endpoint string) SentinelOnboardingStatesClient { + return SentinelOnboardingStatesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/id_onboardingstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/id_onboardingstate.go new file mode 100644 index 000000000000..e585caec90a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/id_onboardingstate.go @@ -0,0 +1,139 @@ +package sentinelonboardingstates + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = OnboardingStateId{} + +// OnboardingStateId is a struct representing the Resource ID for a Onboarding State +type OnboardingStateId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string + OnboardingStateName string +} + +// NewOnboardingStateID returns a new OnboardingStateId struct +func NewOnboardingStateID(subscriptionId string, resourceGroupName string, workspaceName string, onboardingStateName string) OnboardingStateId { + return OnboardingStateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + OnboardingStateName: onboardingStateName, + } +} + +// ParseOnboardingStateID parses 'input' into a OnboardingStateId +func ParseOnboardingStateID(input string) (*OnboardingStateId, error) { + parser := resourceids.NewParserFromResourceIdType(OnboardingStateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OnboardingStateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + if id.OnboardingStateName, ok = parsed.Parsed["onboardingStateName"]; !ok { + return nil, fmt.Errorf("the segment 'onboardingStateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseOnboardingStateIDInsensitively parses 'input' case-insensitively into a OnboardingStateId +// note: this method should only be used for API response data and not user input +func ParseOnboardingStateIDInsensitively(input string) (*OnboardingStateId, error) { + parser := resourceids.NewParserFromResourceIdType(OnboardingStateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OnboardingStateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + if id.OnboardingStateName, ok = parsed.Parsed["onboardingStateName"]; !ok { + return nil, fmt.Errorf("the segment 'onboardingStateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateOnboardingStateID checks that 'input' can be parsed as a Onboarding State ID +func ValidateOnboardingStateID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseOnboardingStateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Onboarding State ID +func (id OnboardingStateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OperationalInsights/workspaces/%s/providers/Microsoft.SecurityInsights/onboardingStates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName, id.OnboardingStateName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Onboarding State ID +func (id OnboardingStateId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftOperationalInsights", "Microsoft.OperationalInsights", "Microsoft.OperationalInsights"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"), + resourceids.StaticSegment("staticProviders2", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftSecurityInsights", "Microsoft.SecurityInsights", "Microsoft.SecurityInsights"), + resourceids.StaticSegment("staticOnboardingStates", "onboardingStates", "onboardingStates"), + resourceids.UserSpecifiedSegment("onboardingStateName", "onboardingStateValue"), + } +} + +// String returns a human-readable description of this Onboarding State ID +func (id OnboardingStateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + fmt.Sprintf("Onboarding State Name: %q", id.OnboardingStateName), + } + return fmt.Sprintf("Onboarding State (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/id_workspace.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/id_workspace.go new file mode 100644 index 000000000000..dfc01fa0b75e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/id_workspace.go @@ -0,0 +1,124 @@ +package sentinelonboardingstates + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = WorkspaceId{} + +// WorkspaceId is a struct representing the Resource ID for a Workspace +type WorkspaceId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string +} + +// NewWorkspaceID returns a new WorkspaceId struct +func NewWorkspaceID(subscriptionId string, resourceGroupName string, workspaceName string) WorkspaceId { + return WorkspaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + } +} + +// ParseWorkspaceID parses 'input' into a WorkspaceId +func ParseWorkspaceID(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkspaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseWorkspaceIDInsensitively parses 'input' case-insensitively into a WorkspaceId +// note: this method should only be used for API response data and not user input +func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkspaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID +func ValidateWorkspaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workspace ID +func (id WorkspaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OperationalInsights/workspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workspace ID +func (id WorkspaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftOperationalInsights", "Microsoft.OperationalInsights", "Microsoft.OperationalInsights"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"), + } +} + +// String returns a human-readable description of this Workspace ID +func (id WorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + } + return fmt.Sprintf("Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/method_create_autorest.go new file mode 100644 index 000000000000..9ad88e951576 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/method_create_autorest.go @@ -0,0 +1,69 @@ +package sentinelonboardingstates + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *SentinelOnboardingState +} + +// Create ... +func (c SentinelOnboardingStatesClient) Create(ctx context.Context, id OnboardingStateId, input SentinelOnboardingState) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "sentinelonboardingstates.SentinelOnboardingStatesClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sentinelonboardingstates.SentinelOnboardingStatesClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sentinelonboardingstates.SentinelOnboardingStatesClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c SentinelOnboardingStatesClient) preparerForCreate(ctx context.Context, id OnboardingStateId, input SentinelOnboardingState) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c SentinelOnboardingStatesClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/method_delete_autorest.go new file mode 100644 index 000000000000..65fa74282f75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/method_delete_autorest.go @@ -0,0 +1,66 @@ +package sentinelonboardingstates + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c SentinelOnboardingStatesClient) Delete(ctx context.Context, id OnboardingStateId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sentinelonboardingstates.SentinelOnboardingStatesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sentinelonboardingstates.SentinelOnboardingStatesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sentinelonboardingstates.SentinelOnboardingStatesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c SentinelOnboardingStatesClient) preparerForDelete(ctx context.Context, id OnboardingStateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c SentinelOnboardingStatesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/method_get_autorest.go new file mode 100644 index 000000000000..d6174a7522ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/method_get_autorest.go @@ -0,0 +1,68 @@ +package sentinelonboardingstates + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *SentinelOnboardingState +} + +// Get ... +func (c SentinelOnboardingStatesClient) Get(ctx context.Context, id OnboardingStateId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sentinelonboardingstates.SentinelOnboardingStatesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sentinelonboardingstates.SentinelOnboardingStatesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sentinelonboardingstates.SentinelOnboardingStatesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c SentinelOnboardingStatesClient) preparerForGet(ctx context.Context, id OnboardingStateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c SentinelOnboardingStatesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/method_list_autorest.go new file mode 100644 index 000000000000..6a00bb3d3fd6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/method_list_autorest.go @@ -0,0 +1,69 @@ +package sentinelonboardingstates + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *SentinelOnboardingStatesList +} + +// List ... +func (c SentinelOnboardingStatesClient) List(ctx context.Context, id WorkspaceId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sentinelonboardingstates.SentinelOnboardingStatesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sentinelonboardingstates.SentinelOnboardingStatesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sentinelonboardingstates.SentinelOnboardingStatesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c SentinelOnboardingStatesClient) preparerForList(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.SecurityInsights/onboardingStates", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c SentinelOnboardingStatesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/model_sentinelonboardingstate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/model_sentinelonboardingstate.go new file mode 100644 index 000000000000..c514c418596e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/model_sentinelonboardingstate.go @@ -0,0 +1,17 @@ +package sentinelonboardingstates + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SentinelOnboardingState struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SentinelOnboardingStateProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/model_sentinelonboardingstateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/model_sentinelonboardingstateproperties.go new file mode 100644 index 000000000000..366f9e1623d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/model_sentinelonboardingstateproperties.go @@ -0,0 +1,8 @@ +package sentinelonboardingstates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SentinelOnboardingStateProperties struct { + CustomerManagedKey *bool `json:"customerManagedKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/model_sentinelonboardingstateslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/model_sentinelonboardingstateslist.go new file mode 100644 index 000000000000..e601995e41b6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/model_sentinelonboardingstateslist.go @@ -0,0 +1,8 @@ +package sentinelonboardingstates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SentinelOnboardingStatesList struct { + Value []SentinelOnboardingState `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/version.go new file mode 100644 index 000000000000..640d5d66c5c8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/version.go @@ -0,0 +1,12 @@ +package sentinelonboardingstates + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/sentinelonboardingstates/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/README.md index 266cf8709d2e..b9067f162b8f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "disasterRecoveryConfigValue") read, err := client.BreakPairing(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "disasterRecoveryConfigValue") payload := disasterrecoveryconfigs.ArmDisasterRecovery{ // ... @@ -82,7 +82,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "disasterRecoveryConfigValue") read, err := client.Delete(ctx, id) if err != nil { @@ -98,7 +98,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "disasterRecoveryConfigValue") payload := disasterrecoveryconfigs.FailoverProperties{ // ... @@ -119,7 +119,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "disasterRecoveryConfigValue") read, err := client.Get(ctx, id) if err != nil { @@ -168,7 +168,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "disasterRecoveryConfigValue") // alternatively `client.ListAuthorizationRules(ctx, id)` can be used to do batched pagination items, err := client.ListAuthorizationRulesComplete(ctx, id) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go index 71d68d16ba30..e729b9df704b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = DisasterRecoveryConfigId{} // DisasterRecoveryConfigId is a struct representing the Resource ID for a Disaster Recovery Config type DisasterRecoveryConfigId struct { - SubscriptionId string - ResourceGroupName string - NamespaceName string - Alias string + SubscriptionId string + ResourceGroupName string + NamespaceName string + DisasterRecoveryConfigName string } // NewDisasterRecoveryConfigID returns a new DisasterRecoveryConfigId struct -func NewDisasterRecoveryConfigID(subscriptionId string, resourceGroupName string, namespaceName string, alias string) DisasterRecoveryConfigId { +func NewDisasterRecoveryConfigID(subscriptionId string, resourceGroupName string, namespaceName string, disasterRecoveryConfigName string) DisasterRecoveryConfigId { return DisasterRecoveryConfigId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NamespaceName: namespaceName, - Alias: alias, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + DisasterRecoveryConfigName: disasterRecoveryConfigName, } } @@ -50,8 +50,8 @@ func ParseDisasterRecoveryConfigID(input string) (*DisasterRecoveryConfigId, err return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.Alias, ok = parsed.Parsed["alias"]; !ok { - return nil, fmt.Errorf("the segment 'alias' was not found in the resource id %q", input) + if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { + return nil, fmt.Errorf("the segment 'disasterRecoveryConfigName' was not found in the resource id %q", input) } return &id, nil @@ -81,8 +81,8 @@ func ParseDisasterRecoveryConfigIDInsensitively(input string) (*DisasterRecovery return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) } - if id.Alias, ok = parsed.Parsed["alias"]; !ok { - return nil, fmt.Errorf("the segment 'alias' was not found in the resource id %q", input) + if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { + return nil, fmt.Errorf("the segment 'disasterRecoveryConfigName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateDisasterRecoveryConfigID(input interface{}, key string) (warnings [ // ID returns the formatted Disaster Recovery Config ID func (id DisasterRecoveryConfigId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/disasterRecoveryConfigs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.Alias) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.DisasterRecoveryConfigName) } // Segments returns a slice of Resource ID Segments which comprise this Disaster Recovery Config ID @@ -121,7 +121,7 @@ func (id DisasterRecoveryConfigId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), resourceids.StaticSegment("staticDisasterRecoveryConfigs", "disasterRecoveryConfigs", "disasterRecoveryConfigs"), - resourceids.UserSpecifiedSegment("alias", "aliasValue"), + resourceids.UserSpecifiedSegment("disasterRecoveryConfigName", "disasterRecoveryConfigValue"), } } @@ -131,7 +131,7 @@ func (id DisasterRecoveryConfigId) String() string { fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Namespace Name: %q", id.NamespaceName), - fmt.Sprintf("Alias: %q", id.Alias), + fmt.Sprintf("Disaster Recovery Config Name: %q", id.DisasterRecoveryConfigName), } return fmt.Sprintf("Disaster Recovery Config (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/README.md new file mode 100644 index 000000000000..f58ab0ab2905 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/README.md @@ -0,0 +1,118 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster` Documentation + +The `cluster` SDK allows for interaction with the Azure Resource Manager Service `servicefabric` (API Version `2021-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster" +``` + + +### Client Initialization + +```go +client := cluster.NewClusterClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ClusterClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := cluster.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := cluster.Cluster{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClusterClient.Delete` + +```go +ctx := context.TODO() +id := cluster.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClusterClient.Get` + +```go +ctx := context.TODO() +id := cluster.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClusterClient.List` + +```go +ctx := context.TODO() +id := cluster.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClusterClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := cluster.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.ListByResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClusterClient.Update` + +```go +ctx := context.TODO() +id := cluster.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := cluster.ClusterUpdateParameters{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/client.go new file mode 100644 index 000000000000..d3c96cfed0b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/client.go @@ -0,0 +1,18 @@ +package cluster + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterClient struct { + Client autorest.Client + baseUri string +} + +func NewClusterClientWithBaseURI(endpoint string) ClusterClient { + return ClusterClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/constants.go new file mode 100644 index 000000000000..235df43148d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/constants.go @@ -0,0 +1,464 @@ +package cluster + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AddOnFeatures string + +const ( + AddOnFeaturesBackupRestoreService AddOnFeatures = "BackupRestoreService" + AddOnFeaturesDnsService AddOnFeatures = "DnsService" + AddOnFeaturesRepairManager AddOnFeatures = "RepairManager" + AddOnFeaturesResourceMonitorService AddOnFeatures = "ResourceMonitorService" +) + +func PossibleValuesForAddOnFeatures() []string { + return []string{ + string(AddOnFeaturesBackupRestoreService), + string(AddOnFeaturesDnsService), + string(AddOnFeaturesRepairManager), + string(AddOnFeaturesResourceMonitorService), + } +} + +func parseAddOnFeatures(input string) (*AddOnFeatures, error) { + vals := map[string]AddOnFeatures{ + "backuprestoreservice": AddOnFeaturesBackupRestoreService, + "dnsservice": AddOnFeaturesDnsService, + "repairmanager": AddOnFeaturesRepairManager, + "resourcemonitorservice": AddOnFeaturesResourceMonitorService, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AddOnFeatures(input) + return &out, nil +} + +type ClusterState string + +const ( + ClusterStateAutoScale ClusterState = "AutoScale" + ClusterStateBaselineUpgrade ClusterState = "BaselineUpgrade" + ClusterStateDeploying ClusterState = "Deploying" + ClusterStateEnforcingClusterVersion ClusterState = "EnforcingClusterVersion" + ClusterStateReady ClusterState = "Ready" + ClusterStateUpdatingInfrastructure ClusterState = "UpdatingInfrastructure" + ClusterStateUpdatingUserCertificate ClusterState = "UpdatingUserCertificate" + ClusterStateUpdatingUserConfiguration ClusterState = "UpdatingUserConfiguration" + ClusterStateUpgradeServiceUnreachable ClusterState = "UpgradeServiceUnreachable" + ClusterStateWaitingForNodes ClusterState = "WaitingForNodes" +) + +func PossibleValuesForClusterState() []string { + return []string{ + string(ClusterStateAutoScale), + string(ClusterStateBaselineUpgrade), + string(ClusterStateDeploying), + string(ClusterStateEnforcingClusterVersion), + string(ClusterStateReady), + string(ClusterStateUpdatingInfrastructure), + string(ClusterStateUpdatingUserCertificate), + string(ClusterStateUpdatingUserConfiguration), + string(ClusterStateUpgradeServiceUnreachable), + string(ClusterStateWaitingForNodes), + } +} + +func parseClusterState(input string) (*ClusterState, error) { + vals := map[string]ClusterState{ + "autoscale": ClusterStateAutoScale, + "baselineupgrade": ClusterStateBaselineUpgrade, + "deploying": ClusterStateDeploying, + "enforcingclusterversion": ClusterStateEnforcingClusterVersion, + "ready": ClusterStateReady, + "updatinginfrastructure": ClusterStateUpdatingInfrastructure, + "updatingusercertificate": ClusterStateUpdatingUserCertificate, + "updatinguserconfiguration": ClusterStateUpdatingUserConfiguration, + "upgradeserviceunreachable": ClusterStateUpgradeServiceUnreachable, + "waitingfornodes": ClusterStateWaitingForNodes, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterState(input) + return &out, nil +} + +type ClusterUpgradeCadence string + +const ( + ClusterUpgradeCadenceWaveOne ClusterUpgradeCadence = "Wave1" + ClusterUpgradeCadenceWaveTwo ClusterUpgradeCadence = "Wave2" + ClusterUpgradeCadenceWaveZero ClusterUpgradeCadence = "Wave0" +) + +func PossibleValuesForClusterUpgradeCadence() []string { + return []string{ + string(ClusterUpgradeCadenceWaveOne), + string(ClusterUpgradeCadenceWaveTwo), + string(ClusterUpgradeCadenceWaveZero), + } +} + +func parseClusterUpgradeCadence(input string) (*ClusterUpgradeCadence, error) { + vals := map[string]ClusterUpgradeCadence{ + "wave1": ClusterUpgradeCadenceWaveOne, + "wave2": ClusterUpgradeCadenceWaveTwo, + "wave0": ClusterUpgradeCadenceWaveZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterUpgradeCadence(input) + return &out, nil +} + +type DurabilityLevel string + +const ( + DurabilityLevelBronze DurabilityLevel = "Bronze" + DurabilityLevelGold DurabilityLevel = "Gold" + DurabilityLevelSilver DurabilityLevel = "Silver" +) + +func PossibleValuesForDurabilityLevel() []string { + return []string{ + string(DurabilityLevelBronze), + string(DurabilityLevelGold), + string(DurabilityLevelSilver), + } +} + +func parseDurabilityLevel(input string) (*DurabilityLevel, error) { + vals := map[string]DurabilityLevel{ + "bronze": DurabilityLevelBronze, + "gold": DurabilityLevelGold, + "silver": DurabilityLevelSilver, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DurabilityLevel(input) + return &out, nil +} + +type Environment string + +const ( + EnvironmentLinux Environment = "Linux" + EnvironmentWindows Environment = "Windows" +) + +func PossibleValuesForEnvironment() []string { + return []string{ + string(EnvironmentLinux), + string(EnvironmentWindows), + } +} + +func parseEnvironment(input string) (*Environment, error) { + vals := map[string]Environment{ + "linux": EnvironmentLinux, + "windows": EnvironmentWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Environment(input) + return &out, nil +} + +type NotificationCategory string + +const ( + NotificationCategoryWaveProgress NotificationCategory = "WaveProgress" +) + +func PossibleValuesForNotificationCategory() []string { + return []string{ + string(NotificationCategoryWaveProgress), + } +} + +func parseNotificationCategory(input string) (*NotificationCategory, error) { + vals := map[string]NotificationCategory{ + "waveprogress": NotificationCategoryWaveProgress, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NotificationCategory(input) + return &out, nil +} + +type NotificationChannel string + +const ( + NotificationChannelEmailSubscription NotificationChannel = "EmailSubscription" + NotificationChannelEmailUser NotificationChannel = "EmailUser" +) + +func PossibleValuesForNotificationChannel() []string { + return []string{ + string(NotificationChannelEmailSubscription), + string(NotificationChannelEmailUser), + } +} + +func parseNotificationChannel(input string) (*NotificationChannel, error) { + vals := map[string]NotificationChannel{ + "emailsubscription": NotificationChannelEmailSubscription, + "emailuser": NotificationChannelEmailUser, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NotificationChannel(input) + return &out, nil +} + +type NotificationLevel string + +const ( + NotificationLevelAll NotificationLevel = "All" + NotificationLevelCritical NotificationLevel = "Critical" +) + +func PossibleValuesForNotificationLevel() []string { + return []string{ + string(NotificationLevelAll), + string(NotificationLevelCritical), + } +} + +func parseNotificationLevel(input string) (*NotificationLevel, error) { + vals := map[string]NotificationLevel{ + "all": NotificationLevelAll, + "critical": NotificationLevelCritical, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NotificationLevel(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type ReliabilityLevel string + +const ( + ReliabilityLevelBronze ReliabilityLevel = "Bronze" + ReliabilityLevelGold ReliabilityLevel = "Gold" + ReliabilityLevelNone ReliabilityLevel = "None" + ReliabilityLevelPlatinum ReliabilityLevel = "Platinum" + ReliabilityLevelSilver ReliabilityLevel = "Silver" +) + +func PossibleValuesForReliabilityLevel() []string { + return []string{ + string(ReliabilityLevelBronze), + string(ReliabilityLevelGold), + string(ReliabilityLevelNone), + string(ReliabilityLevelPlatinum), + string(ReliabilityLevelSilver), + } +} + +func parseReliabilityLevel(input string) (*ReliabilityLevel, error) { + vals := map[string]ReliabilityLevel{ + "bronze": ReliabilityLevelBronze, + "gold": ReliabilityLevelGold, + "none": ReliabilityLevelNone, + "platinum": ReliabilityLevelPlatinum, + "silver": ReliabilityLevelSilver, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ReliabilityLevel(input) + return &out, nil +} + +type SfZonalUpgradeMode string + +const ( + SfZonalUpgradeModeHierarchical SfZonalUpgradeMode = "Hierarchical" + SfZonalUpgradeModeParallel SfZonalUpgradeMode = "Parallel" +) + +func PossibleValuesForSfZonalUpgradeMode() []string { + return []string{ + string(SfZonalUpgradeModeHierarchical), + string(SfZonalUpgradeModeParallel), + } +} + +func parseSfZonalUpgradeMode(input string) (*SfZonalUpgradeMode, error) { + vals := map[string]SfZonalUpgradeMode{ + "hierarchical": SfZonalUpgradeModeHierarchical, + "parallel": SfZonalUpgradeModeParallel, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SfZonalUpgradeMode(input) + return &out, nil +} + +type UpgradeMode string + +const ( + UpgradeModeAutomatic UpgradeMode = "Automatic" + UpgradeModeManual UpgradeMode = "Manual" +) + +func PossibleValuesForUpgradeMode() []string { + return []string{ + string(UpgradeModeAutomatic), + string(UpgradeModeManual), + } +} + +func parseUpgradeMode(input string) (*UpgradeMode, error) { + vals := map[string]UpgradeMode{ + "automatic": UpgradeModeAutomatic, + "manual": UpgradeModeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpgradeMode(input) + return &out, nil +} + +type VMSSZonalUpgradeMode string + +const ( + VMSSZonalUpgradeModeHierarchical VMSSZonalUpgradeMode = "Hierarchical" + VMSSZonalUpgradeModeParallel VMSSZonalUpgradeMode = "Parallel" +) + +func PossibleValuesForVMSSZonalUpgradeMode() []string { + return []string{ + string(VMSSZonalUpgradeModeHierarchical), + string(VMSSZonalUpgradeModeParallel), + } +} + +func parseVMSSZonalUpgradeMode(input string) (*VMSSZonalUpgradeMode, error) { + vals := map[string]VMSSZonalUpgradeMode{ + "hierarchical": VMSSZonalUpgradeModeHierarchical, + "parallel": VMSSZonalUpgradeModeParallel, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VMSSZonalUpgradeMode(input) + return &out, nil +} + +type X509StoreName string + +const ( + X509StoreNameAddressBook X509StoreName = "AddressBook" + X509StoreNameAuthRoot X509StoreName = "AuthRoot" + X509StoreNameCertificateAuthority X509StoreName = "CertificateAuthority" + X509StoreNameDisallowed X509StoreName = "Disallowed" + X509StoreNameMy X509StoreName = "My" + X509StoreNameRoot X509StoreName = "Root" + X509StoreNameTrustedPeople X509StoreName = "TrustedPeople" + X509StoreNameTrustedPublisher X509StoreName = "TrustedPublisher" +) + +func PossibleValuesForX509StoreName() []string { + return []string{ + string(X509StoreNameAddressBook), + string(X509StoreNameAuthRoot), + string(X509StoreNameCertificateAuthority), + string(X509StoreNameDisallowed), + string(X509StoreNameMy), + string(X509StoreNameRoot), + string(X509StoreNameTrustedPeople), + string(X509StoreNameTrustedPublisher), + } +} + +func parseX509StoreName(input string) (*X509StoreName, error) { + vals := map[string]X509StoreName{ + "addressbook": X509StoreNameAddressBook, + "authroot": X509StoreNameAuthRoot, + "certificateauthority": X509StoreNameCertificateAuthority, + "disallowed": X509StoreNameDisallowed, + "my": X509StoreNameMy, + "root": X509StoreNameRoot, + "trustedpeople": X509StoreNameTrustedPeople, + "trustedpublisher": X509StoreNameTrustedPublisher, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := X509StoreName(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/id_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/id_cluster.go new file mode 100644 index 000000000000..3d3e22b59c29 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/id_cluster.go @@ -0,0 +1,124 @@ +package cluster + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ClusterId{} + +// ClusterId is a struct representing the Resource ID for a Cluster +type ClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewClusterID returns a new ClusterId struct +func NewClusterID(subscriptionId string, resourceGroupName string, clusterName string) ClusterId { + return ClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseClusterID parses 'input' into a ClusterId +func ParseClusterID(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseClusterIDInsensitively parses 'input' case-insensitively into a ClusterId +// note: this method should only be used for API response data and not user input +func ParseClusterIDInsensitively(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateClusterID checks that 'input' can be parsed as a Cluster ID +func ValidateClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cluster ID +func (id ClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceFabric/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cluster ID +func (id ClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceFabric", "Microsoft.ServiceFabric", "Microsoft.ServiceFabric"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Cluster ID +func (id ClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_createorupdate_autorest.go new file mode 100644 index 000000000000..47bcf5006fc9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package cluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c ClusterClient) CreateOrUpdate(ctx context.Context, id ClusterId, input Cluster) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ClusterClient) CreateOrUpdateThenPoll(ctx context.Context, id ClusterId, input Cluster) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ClusterClient) preparerForCreateOrUpdate(ctx context.Context, id ClusterId, input Cluster) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ClusterClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_delete_autorest.go new file mode 100644 index 000000000000..d8c81fb14838 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_delete_autorest.go @@ -0,0 +1,66 @@ +package cluster + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ClusterClient) Delete(ctx context.Context, id ClusterId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ClusterClient) preparerForDelete(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ClusterClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_get_autorest.go new file mode 100644 index 000000000000..227b3e2bc41a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_get_autorest.go @@ -0,0 +1,68 @@ +package cluster + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Cluster +} + +// Get ... +func (c ClusterClient) Get(ctx context.Context, id ClusterId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ClusterClient) preparerForGet(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ClusterClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_list_autorest.go new file mode 100644 index 000000000000..a7c4e3a66583 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_list_autorest.go @@ -0,0 +1,70 @@ +package cluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *ClusterListResult +} + +// List ... +func (c ClusterClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c ClusterClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ServiceFabric/clusters", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ClusterClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..280d21c7d767 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_listbyresourcegroup_autorest.go @@ -0,0 +1,70 @@ +package cluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *ClusterListResult +} + +// ListByResourceGroup ... +func (c ClusterClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ClusterClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ServiceFabric/clusters", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ClusterClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_update_autorest.go new file mode 100644 index 000000000000..04196d8a97fc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/method_update_autorest.go @@ -0,0 +1,79 @@ +package cluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c ClusterClient) Update(ctx context.Context, id ClusterId, input ClusterUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "cluster.ClusterClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ClusterClient) UpdateThenPoll(ctx context.Context, id ClusterId, input ClusterUpdateParameters) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c ClusterClient) preparerForUpdate(ctx context.Context, id ClusterId, input ClusterUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c ClusterClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationdeltahealthpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationdeltahealthpolicy.go new file mode 100644 index 000000000000..8fad19da2b7e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationdeltahealthpolicy.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationDeltaHealthPolicy struct { + DefaultServiceTypeDeltaHealthPolicy *ServiceTypeDeltaHealthPolicy `json:"defaultServiceTypeDeltaHealthPolicy,omitempty"` + ServiceTypeDeltaHealthPolicies *map[string]ServiceTypeDeltaHealthPolicy `json:"serviceTypeDeltaHealthPolicies,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationhealthpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationhealthpolicy.go new file mode 100644 index 000000000000..0fbffd54f7a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationhealthpolicy.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationHealthPolicy struct { + DefaultServiceTypeHealthPolicy *ServiceTypeHealthPolicy `json:"defaultServiceTypeHealthPolicy,omitempty"` + ServiceTypeHealthPolicies *map[string]ServiceTypeHealthPolicy `json:"serviceTypeHealthPolicies,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationtypeversionscleanuppolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationtypeversionscleanuppolicy.go new file mode 100644 index 000000000000..93c8f9e615ea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_applicationtypeversionscleanuppolicy.go @@ -0,0 +1,8 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationTypeVersionsCleanupPolicy struct { + MaxUnusedVersionsToKeep int64 `json:"maxUnusedVersionsToKeep"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_azureactivedirectory.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_azureactivedirectory.go new file mode 100644 index 000000000000..3d538dacae17 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_azureactivedirectory.go @@ -0,0 +1,10 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureActiveDirectory struct { + ClientApplication *string `json:"clientApplication,omitempty"` + ClusterApplication *string `json:"clusterApplication,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_certificatedescription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_certificatedescription.go new file mode 100644 index 000000000000..d06db35206eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_certificatedescription.go @@ -0,0 +1,10 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateDescription struct { + Thumbprint string `json:"thumbprint"` + ThumbprintSecondary *string `json:"thumbprintSecondary,omitempty"` + X509StoreName *X509StoreName `json:"x509StoreName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clientcertificatecommonname.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clientcertificatecommonname.go new file mode 100644 index 000000000000..58d105ad2276 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clientcertificatecommonname.go @@ -0,0 +1,10 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClientCertificateCommonName struct { + CertificateCommonName string `json:"certificateCommonName"` + CertificateIssuerThumbprint string `json:"certificateIssuerThumbprint"` + IsAdmin bool `json:"isAdmin"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clientcertificatethumbprint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clientcertificatethumbprint.go new file mode 100644 index 000000000000..84be23937821 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clientcertificatethumbprint.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClientCertificateThumbprint struct { + CertificateThumbprint string `json:"certificateThumbprint"` + IsAdmin bool `json:"isAdmin"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_cluster.go new file mode 100644 index 000000000000..1815abb6ff11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_cluster.go @@ -0,0 +1,15 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Cluster struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ClusterProperties `json:"properties,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterhealthpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterhealthpolicy.go new file mode 100644 index 000000000000..76c77ffbb815 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterhealthpolicy.go @@ -0,0 +1,10 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterHealthPolicy struct { + ApplicationHealthPolicies *map[string]ApplicationHealthPolicy `json:"applicationHealthPolicies,omitempty"` + MaxPercentUnhealthyApplications *int64 `json:"maxPercentUnhealthyApplications,omitempty"` + MaxPercentUnhealthyNodes *int64 `json:"maxPercentUnhealthyNodes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterlistresult.go new file mode 100644 index 000000000000..b205deaee9cc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterlistresult.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterListResult struct { + NextLink *string `json:"nextLink,omitempty"` + Value *[]Cluster `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterproperties.go new file mode 100644 index 000000000000..cb5b303f885d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterproperties.go @@ -0,0 +1,69 @@ +package cluster + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterProperties struct { + AddOnFeatures *[]AddOnFeatures `json:"addOnFeatures,omitempty"` + ApplicationTypeVersionsCleanupPolicy *ApplicationTypeVersionsCleanupPolicy `json:"applicationTypeVersionsCleanupPolicy,omitempty"` + AvailableClusterVersions *[]ClusterVersionDetails `json:"availableClusterVersions,omitempty"` + AzureActiveDirectory *AzureActiveDirectory `json:"azureActiveDirectory,omitempty"` + Certificate *CertificateDescription `json:"certificate,omitempty"` + CertificateCommonNames *ServerCertificateCommonNames `json:"certificateCommonNames,omitempty"` + ClientCertificateCommonNames *[]ClientCertificateCommonName `json:"clientCertificateCommonNames,omitempty"` + ClientCertificateThumbprints *[]ClientCertificateThumbprint `json:"clientCertificateThumbprints,omitempty"` + ClusterCodeVersion *string `json:"clusterCodeVersion,omitempty"` + ClusterEndpoint *string `json:"clusterEndpoint,omitempty"` + ClusterId *string `json:"clusterId,omitempty"` + ClusterState *ClusterState `json:"clusterState,omitempty"` + DiagnosticsStorageAccountConfig *DiagnosticsStorageAccountConfig `json:"diagnosticsStorageAccountConfig,omitempty"` + EventStoreServiceEnabled *bool `json:"eventStoreServiceEnabled,omitempty"` + FabricSettings *[]SettingsSectionDescription `json:"fabricSettings,omitempty"` + InfrastructureServiceManager *bool `json:"infrastructureServiceManager,omitempty"` + ManagementEndpoint string `json:"managementEndpoint"` + NodeTypes []NodeTypeDescription `json:"nodeTypes"` + Notifications *[]Notification `json:"notifications,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + ReliabilityLevel *ReliabilityLevel `json:"reliabilityLevel,omitempty"` + ReverseProxyCertificate *CertificateDescription `json:"reverseProxyCertificate,omitempty"` + ReverseProxyCertificateCommonNames *ServerCertificateCommonNames `json:"reverseProxyCertificateCommonNames,omitempty"` + SfZonalUpgradeMode *SfZonalUpgradeMode `json:"sfZonalUpgradeMode,omitempty"` + UpgradeDescription *ClusterUpgradePolicy `json:"upgradeDescription,omitempty"` + UpgradeMode *UpgradeMode `json:"upgradeMode,omitempty"` + UpgradePauseEndTimestampUtc *string `json:"upgradePauseEndTimestampUtc,omitempty"` + UpgradePauseStartTimestampUtc *string `json:"upgradePauseStartTimestampUtc,omitempty"` + UpgradeWave *ClusterUpgradeCadence `json:"upgradeWave,omitempty"` + VMSSZonalUpgradeMode *VMSSZonalUpgradeMode `json:"vmssZonalUpgradeMode,omitempty"` + VmImage *string `json:"vmImage,omitempty"` + WaveUpgradePaused *bool `json:"waveUpgradePaused,omitempty"` +} + +func (o *ClusterProperties) GetUpgradePauseEndTimestampUtcAsTime() (*time.Time, error) { + if o.UpgradePauseEndTimestampUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpgradePauseEndTimestampUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterProperties) SetUpgradePauseEndTimestampUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpgradePauseEndTimestampUtc = &formatted +} + +func (o *ClusterProperties) GetUpgradePauseStartTimestampUtcAsTime() (*time.Time, error) { + if o.UpgradePauseStartTimestampUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpgradePauseStartTimestampUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterProperties) SetUpgradePauseStartTimestampUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpgradePauseStartTimestampUtc = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterpropertiesupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterpropertiesupdateparameters.go new file mode 100644 index 000000000000..00f45c72dc1c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterpropertiesupdateparameters.go @@ -0,0 +1,59 @@ +package cluster + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterPropertiesUpdateParameters struct { + AddOnFeatures *[]AddOnFeatures `json:"addOnFeatures,omitempty"` + ApplicationTypeVersionsCleanupPolicy *ApplicationTypeVersionsCleanupPolicy `json:"applicationTypeVersionsCleanupPolicy,omitempty"` + Certificate *CertificateDescription `json:"certificate,omitempty"` + CertificateCommonNames *ServerCertificateCommonNames `json:"certificateCommonNames,omitempty"` + ClientCertificateCommonNames *[]ClientCertificateCommonName `json:"clientCertificateCommonNames,omitempty"` + ClientCertificateThumbprints *[]ClientCertificateThumbprint `json:"clientCertificateThumbprints,omitempty"` + ClusterCodeVersion *string `json:"clusterCodeVersion,omitempty"` + EventStoreServiceEnabled *bool `json:"eventStoreServiceEnabled,omitempty"` + FabricSettings *[]SettingsSectionDescription `json:"fabricSettings,omitempty"` + InfrastructureServiceManager *bool `json:"infrastructureServiceManager,omitempty"` + NodeTypes *[]NodeTypeDescription `json:"nodeTypes,omitempty"` + Notifications *[]Notification `json:"notifications,omitempty"` + ReliabilityLevel *ReliabilityLevel `json:"reliabilityLevel,omitempty"` + ReverseProxyCertificate *CertificateDescription `json:"reverseProxyCertificate,omitempty"` + SfZonalUpgradeMode *SfZonalUpgradeMode `json:"sfZonalUpgradeMode,omitempty"` + UpgradeDescription *ClusterUpgradePolicy `json:"upgradeDescription,omitempty"` + UpgradeMode *UpgradeMode `json:"upgradeMode,omitempty"` + UpgradePauseEndTimestampUtc *string `json:"upgradePauseEndTimestampUtc,omitempty"` + UpgradePauseStartTimestampUtc *string `json:"upgradePauseStartTimestampUtc,omitempty"` + UpgradeWave *ClusterUpgradeCadence `json:"upgradeWave,omitempty"` + VMSSZonalUpgradeMode *VMSSZonalUpgradeMode `json:"vmssZonalUpgradeMode,omitempty"` + WaveUpgradePaused *bool `json:"waveUpgradePaused,omitempty"` +} + +func (o *ClusterPropertiesUpdateParameters) GetUpgradePauseEndTimestampUtcAsTime() (*time.Time, error) { + if o.UpgradePauseEndTimestampUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpgradePauseEndTimestampUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterPropertiesUpdateParameters) SetUpgradePauseEndTimestampUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpgradePauseEndTimestampUtc = &formatted +} + +func (o *ClusterPropertiesUpdateParameters) GetUpgradePauseStartTimestampUtcAsTime() (*time.Time, error) { + if o.UpgradePauseStartTimestampUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpgradePauseStartTimestampUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterPropertiesUpdateParameters) SetUpgradePauseStartTimestampUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpgradePauseStartTimestampUtc = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupdateparameters.go new file mode 100644 index 000000000000..5b03245e7ae9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupdateparameters.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterUpdateParameters struct { + Properties *ClusterPropertiesUpdateParameters `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupgradedeltahealthpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupgradedeltahealthpolicy.go new file mode 100644 index 000000000000..da9b8496dcf9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupgradedeltahealthpolicy.go @@ -0,0 +1,11 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterUpgradeDeltaHealthPolicy struct { + ApplicationDeltaHealthPolicies *map[string]ApplicationDeltaHealthPolicy `json:"applicationDeltaHealthPolicies,omitempty"` + MaxPercentDeltaUnhealthyApplications int64 `json:"maxPercentDeltaUnhealthyApplications"` + MaxPercentDeltaUnhealthyNodes int64 `json:"maxPercentDeltaUnhealthyNodes"` + MaxPercentUpgradeDomainDeltaUnhealthyNodes int64 `json:"maxPercentUpgradeDomainDeltaUnhealthyNodes"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupgradepolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupgradepolicy.go new file mode 100644 index 000000000000..e6ab29fc41ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterupgradepolicy.go @@ -0,0 +1,16 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterUpgradePolicy struct { + DeltaHealthPolicy *ClusterUpgradeDeltaHealthPolicy `json:"deltaHealthPolicy,omitempty"` + ForceRestart *bool `json:"forceRestart,omitempty"` + HealthCheckRetryTimeout string `json:"healthCheckRetryTimeout"` + HealthCheckStableDuration string `json:"healthCheckStableDuration"` + HealthCheckWaitDuration string `json:"healthCheckWaitDuration"` + HealthPolicy ClusterHealthPolicy `json:"healthPolicy"` + UpgradeDomainTimeout string `json:"upgradeDomainTimeout"` + UpgradeReplicaSetCheckTimeout string `json:"upgradeReplicaSetCheckTimeout"` + UpgradeTimeout string `json:"upgradeTimeout"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterversiondetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterversiondetails.go new file mode 100644 index 000000000000..bbb863eb6fc9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_clusterversiondetails.go @@ -0,0 +1,10 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterVersionDetails struct { + CodeVersion *string `json:"codeVersion,omitempty"` + Environment *Environment `json:"environment,omitempty"` + SupportExpiryUtc *string `json:"supportExpiryUtc,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_diagnosticsstorageaccountconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_diagnosticsstorageaccountconfig.go new file mode 100644 index 000000000000..995b5612d80a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_diagnosticsstorageaccountconfig.go @@ -0,0 +1,13 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticsStorageAccountConfig struct { + BlobEndpoint string `json:"blobEndpoint"` + ProtectedAccountKeyName string `json:"protectedAccountKeyName"` + ProtectedAccountKeyName2 *string `json:"protectedAccountKeyName2,omitempty"` + QueueEndpoint string `json:"queueEndpoint"` + StorageAccountName string `json:"storageAccountName"` + TableEndpoint string `json:"tableEndpoint"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_endpointrangedescription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_endpointrangedescription.go new file mode 100644 index 000000000000..67c517e9c8fe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_endpointrangedescription.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointRangeDescription struct { + EndPort int64 `json:"endPort"` + StartPort int64 `json:"startPort"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_nodetypedescription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_nodetypedescription.go new file mode 100644 index 000000000000..d0da4988e795 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_nodetypedescription.go @@ -0,0 +1,20 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NodeTypeDescription struct { + ApplicationPorts *EndpointRangeDescription `json:"applicationPorts,omitempty"` + Capacities *map[string]string `json:"capacities,omitempty"` + ClientConnectionEndpointPort int64 `json:"clientConnectionEndpointPort"` + DurabilityLevel *DurabilityLevel `json:"durabilityLevel,omitempty"` + EphemeralPorts *EndpointRangeDescription `json:"ephemeralPorts,omitempty"` + HTTPGatewayEndpointPort int64 `json:"httpGatewayEndpointPort"` + IsPrimary bool `json:"isPrimary"` + IsStateless *bool `json:"isStateless,omitempty"` + MultipleAvailabilityZones *bool `json:"multipleAvailabilityZones,omitempty"` + Name string `json:"name"` + PlacementProperties *map[string]string `json:"placementProperties,omitempty"` + ReverseProxyEndpointPort *int64 `json:"reverseProxyEndpointPort,omitempty"` + VMInstanceCount int64 `json:"vmInstanceCount"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_notification.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_notification.go new file mode 100644 index 000000000000..6a82ec3e3540 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_notification.go @@ -0,0 +1,11 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Notification struct { + IsEnabled bool `json:"isEnabled"` + NotificationCategory NotificationCategory `json:"notificationCategory"` + NotificationLevel NotificationLevel `json:"notificationLevel"` + NotificationTargets []NotificationTarget `json:"notificationTargets"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_notificationtarget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_notificationtarget.go new file mode 100644 index 000000000000..1fd1edb852fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_notificationtarget.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationTarget struct { + NotificationChannel NotificationChannel `json:"notificationChannel"` + Receivers []string `json:"receivers"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servercertificatecommonname.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servercertificatecommonname.go new file mode 100644 index 000000000000..09c968ba1904 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servercertificatecommonname.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerCertificateCommonName struct { + CertificateCommonName string `json:"certificateCommonName"` + CertificateIssuerThumbprint string `json:"certificateIssuerThumbprint"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servercertificatecommonnames.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servercertificatecommonnames.go new file mode 100644 index 000000000000..2ca94786d4d0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servercertificatecommonnames.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerCertificateCommonNames struct { + CommonNames *[]ServerCertificateCommonName `json:"commonNames,omitempty"` + X509StoreName *X509StoreName `json:"x509StoreName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servicetypedeltahealthpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servicetypedeltahealthpolicy.go new file mode 100644 index 000000000000..9581ae6ced73 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servicetypedeltahealthpolicy.go @@ -0,0 +1,8 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceTypeDeltaHealthPolicy struct { + MaxPercentDeltaUnhealthyServices *int64 `json:"maxPercentDeltaUnhealthyServices,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servicetypehealthpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servicetypehealthpolicy.go new file mode 100644 index 000000000000..cdea29d7900c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_servicetypehealthpolicy.go @@ -0,0 +1,8 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceTypeHealthPolicy struct { + MaxPercentUnhealthyServices *int64 `json:"maxPercentUnhealthyServices,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_settingsparameterdescription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_settingsparameterdescription.go new file mode 100644 index 000000000000..32448081d478 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_settingsparameterdescription.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SettingsParameterDescription struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_settingssectiondescription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_settingssectiondescription.go new file mode 100644 index 000000000000..6ef9a478c34c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_settingssectiondescription.go @@ -0,0 +1,9 @@ +package cluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SettingsSectionDescription struct { + Name string `json:"name"` + Parameters []SettingsParameterDescription `json:"parameters"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_systemdata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_systemdata.go new file mode 100644 index 000000000000..6fdfc6628a58 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/model_systemdata.go @@ -0,0 +1,43 @@ +package cluster + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SystemData struct { + CreatedAt *string `json:"createdAt,omitempty"` + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByType *string `json:"createdByType,omitempty"` + LastModifiedAt *string `json:"lastModifiedAt,omitempty"` + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + LastModifiedByType *string `json:"lastModifiedByType,omitempty"` +} + +func (o *SystemData) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SystemData) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *SystemData) GetLastModifiedAtAsTime() (*time.Time, error) { + if o.LastModifiedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModifiedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SystemData) SetLastModifiedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModifiedAt = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/version.go new file mode 100644 index 000000000000..06f520be6868 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster/version.go @@ -0,0 +1,12 @@ +package cluster + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/cluster/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/README.md index 72af79eb273f..1f12cc311377 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := managedcluster.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := managedcluster.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") payload := managedcluster.ManagedCluster{ // ... @@ -41,7 +41,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := managedcluster.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := managedcluster.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := managedcluster.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := managedcluster.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") read, err := client.Get(ctx, id) if err != nil { @@ -103,7 +103,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := managedcluster.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := managedcluster.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") payload := managedcluster.ManagedClusterUpdateParameters{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/id_managedcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/id_managedcluster.go index 87f172633754..7fb1ff06531b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/id_managedcluster.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/id_managedcluster.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = ManagedClusterId{} // ManagedClusterId is a struct representing the Resource ID for a Managed Cluster type ManagedClusterId struct { - SubscriptionId string - ResourceGroupName string - ClusterName string + SubscriptionId string + ResourceGroupName string + ManagedClusterName string } // NewManagedClusterID returns a new ManagedClusterId struct -func NewManagedClusterID(subscriptionId string, resourceGroupName string, clusterName string) ManagedClusterId { +func NewManagedClusterID(subscriptionId string, resourceGroupName string, managedClusterName string) ManagedClusterId { return ManagedClusterId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ClusterName: clusterName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedClusterName: managedClusterName, } } @@ -44,8 +44,8 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateManagedClusterID(input interface{}, key string) (warnings []string, // ID returns the formatted Managed Cluster ID func (id ManagedClusterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceFabric/managedClusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName) } // Segments returns a slice of Resource ID Segments which comprise this Managed Cluster ID @@ -109,7 +109,7 @@ func (id ManagedClusterId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftServiceFabric", "Microsoft.ServiceFabric", "Microsoft.ServiceFabric"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), } } @@ -118,7 +118,7 @@ func (id ManagedClusterId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), } return fmt.Sprintf("Managed Cluster (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/README.md index cae29ca93c8a..26b58580e566 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "nodeTypeValue") +id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "nodeTypeValue") payload := nodetype.NodeType{ // ... @@ -41,7 +41,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "nodeTypeValue") +id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "nodeTypeValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "nodeTypeValue") +id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "nodeTypeValue") payload := nodetype.NodeTypeActionParameters{ // ... @@ -70,7 +70,7 @@ if err := client.DeleteNodeThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "nodeTypeValue") +id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "nodeTypeValue") read, err := client.Get(ctx, id) if err != nil { @@ -86,7 +86,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := nodetype.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") +id := nodetype.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue") // alternatively `client.ListByManagedClusters(ctx, id)` can be used to do batched pagination items, err := client.ListByManagedClustersComplete(ctx, id) @@ -103,7 +103,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "nodeTypeValue") +id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "nodeTypeValue") payload := nodetype.NodeTypeActionParameters{ // ... @@ -120,7 +120,7 @@ if err := client.ReimageThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "nodeTypeValue") +id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "nodeTypeValue") payload := nodetype.NodeTypeActionParameters{ // ... @@ -137,7 +137,7 @@ if err := client.RestartThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "nodeTypeValue") +id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "managedClusterValue", "nodeTypeValue") payload := nodetype.NodeTypeUpdateParameters{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_managedcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_managedcluster.go index df7bd340bd39..49382a37c686 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_managedcluster.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_managedcluster.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = ManagedClusterId{} // ManagedClusterId is a struct representing the Resource ID for a Managed Cluster type ManagedClusterId struct { - SubscriptionId string - ResourceGroupName string - ClusterName string + SubscriptionId string + ResourceGroupName string + ManagedClusterName string } // NewManagedClusterID returns a new ManagedClusterId struct -func NewManagedClusterID(subscriptionId string, resourceGroupName string, clusterName string) ManagedClusterId { +func NewManagedClusterID(subscriptionId string, resourceGroupName string, managedClusterName string) ManagedClusterId { return ManagedClusterId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ClusterName: clusterName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedClusterName: managedClusterName, } } @@ -44,8 +44,8 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateManagedClusterID(input interface{}, key string) (warnings []string, // ID returns the formatted Managed Cluster ID func (id ManagedClusterId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceFabric/managedClusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName) } // Segments returns a slice of Resource ID Segments which comprise this Managed Cluster ID @@ -109,7 +109,7 @@ func (id ManagedClusterId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftServiceFabric", "Microsoft.ServiceFabric", "Microsoft.ServiceFabric"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), } } @@ -118,7 +118,7 @@ func (id ManagedClusterId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), } return fmt.Sprintf("Managed Cluster (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_nodetype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_nodetype.go index f1ce2f8796c2..5a14e78fb0db 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_nodetype.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_nodetype.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = NodeTypeId{} // NodeTypeId is a struct representing the Resource ID for a Node Type type NodeTypeId struct { - SubscriptionId string - ResourceGroupName string - ClusterName string - NodeTypeName string + SubscriptionId string + ResourceGroupName string + ManagedClusterName string + NodeTypeName string } // NewNodeTypeID returns a new NodeTypeId struct -func NewNodeTypeID(subscriptionId string, resourceGroupName string, clusterName string, nodeTypeName string) NodeTypeId { +func NewNodeTypeID(subscriptionId string, resourceGroupName string, managedClusterName string, nodeTypeName string) NodeTypeId { return NodeTypeId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ClusterName: clusterName, - NodeTypeName: nodeTypeName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ManagedClusterName: managedClusterName, + NodeTypeName: nodeTypeName, } } @@ -46,8 +46,8 @@ func ParseNodeTypeID(input string) (*NodeTypeId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } if id.NodeTypeName, ok = parsed.Parsed["nodeTypeName"]; !ok { @@ -77,8 +77,8 @@ func ParseNodeTypeIDInsensitively(input string) (*NodeTypeId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { + return nil, fmt.Errorf("the segment 'managedClusterName' was not found in the resource id %q", input) } if id.NodeTypeName, ok = parsed.Parsed["nodeTypeName"]; !ok { @@ -106,7 +106,7 @@ func ValidateNodeTypeID(input interface{}, key string) (warnings []string, error // ID returns the formatted Node Type ID func (id NodeTypeId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceFabric/managedClusters/%s/nodeTypes/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.NodeTypeName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, id.NodeTypeName) } // Segments returns a slice of Resource ID Segments which comprise this Node Type ID @@ -119,7 +119,7 @@ func (id NodeTypeId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftServiceFabric", "Microsoft.ServiceFabric", "Microsoft.ServiceFabric"), resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.UserSpecifiedSegment("managedClusterName", "managedClusterValue"), resourceids.StaticSegment("staticNodeTypes", "nodeTypes", "nodeTypes"), resourceids.UserSpecifiedSegment("nodeTypeName", "nodeTypeValue"), } @@ -130,7 +130,7 @@ func (id NodeTypeId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Managed Cluster Name: %q", id.ManagedClusterName), fmt.Sprintf("Node Type Name: %q", id.NodeTypeName), } return fmt.Sprintf("Node Type (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/README.md index a44f89509287..c1d265e62f4a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/README.md @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue") payload := signalr.SignalRResource{ // ... @@ -62,7 +62,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := signalr.NewCustomCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "certificateValue") +id := signalr.NewCustomCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue", "customCertificateValue") payload := signalr.CustomCertificate{ // ... @@ -79,7 +79,7 @@ if err := client.CustomCertificatesCreateOrUpdateThenPoll(ctx, id, payload); err ```go ctx := context.TODO() -id := signalr.NewCustomCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "certificateValue") +id := signalr.NewCustomCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue", "customCertificateValue") read, err := client.CustomCertificatesDelete(ctx, id) if err != nil { @@ -95,7 +95,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := signalr.NewCustomCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "certificateValue") +id := signalr.NewCustomCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue", "customCertificateValue") read, err := client.CustomCertificatesGet(ctx, id) if err != nil { @@ -111,7 +111,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue") // alternatively `client.CustomCertificatesList(ctx, id)` can be used to do batched pagination items, err := client.CustomCertificatesListComplete(ctx, id) @@ -128,7 +128,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := signalr.NewCustomDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "nameValue") +id := signalr.NewCustomDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue", "customDomainValue") payload := signalr.CustomDomain{ // ... @@ -145,7 +145,7 @@ if err := client.CustomDomainsCreateOrUpdateThenPoll(ctx, id, payload); err != n ```go ctx := context.TODO() -id := signalr.NewCustomDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "nameValue") +id := signalr.NewCustomDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue", "customDomainValue") if err := client.CustomDomainsDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -157,7 +157,7 @@ if err := client.CustomDomainsDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := signalr.NewCustomDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "nameValue") +id := signalr.NewCustomDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue", "customDomainValue") read, err := client.CustomDomainsGet(ctx, id) if err != nil { @@ -173,7 +173,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue") // alternatively `client.CustomDomainsList(ctx, id)` can be used to do batched pagination items, err := client.CustomDomainsListComplete(ctx, id) @@ -190,7 +190,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -202,7 +202,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue") read, err := client.Get(ctx, id) if err != nil { @@ -252,7 +252,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue") read, err := client.ListKeys(ctx, id) if err != nil { @@ -268,7 +268,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue") read, err := client.ListSkus(ctx, id) if err != nil { @@ -284,7 +284,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := signalr.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue") +id := signalr.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue", "privateEndpointConnectionValue") if err := client.PrivateEndpointConnectionsDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -296,7 +296,7 @@ if err := client.PrivateEndpointConnectionsDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := signalr.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue") +id := signalr.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue", "privateEndpointConnectionValue") read, err := client.PrivateEndpointConnectionsGet(ctx, id) if err != nil { @@ -312,7 +312,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue") // alternatively `client.PrivateEndpointConnectionsList(ctx, id)` can be used to do batched pagination items, err := client.PrivateEndpointConnectionsListComplete(ctx, id) @@ -329,7 +329,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := signalr.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue") +id := signalr.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue", "privateEndpointConnectionValue") payload := signalr.PrivateEndpointConnection{ // ... @@ -350,7 +350,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue") // alternatively `client.PrivateLinkResourcesList(ctx, id)` can be used to do batched pagination items, err := client.PrivateLinkResourcesListComplete(ctx, id) @@ -367,7 +367,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue") payload := signalr.RegenerateKeyParameters{ // ... @@ -384,7 +384,7 @@ if err := client.RegenerateKeyThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue") if err := client.RestartThenPoll(ctx, id); err != nil { // handle the error @@ -396,7 +396,7 @@ if err := client.RestartThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := signalr.NewSharedPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "sharedPrivateLinkResourceValue") +id := signalr.NewSharedPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue", "sharedPrivateLinkResourceValue") payload := signalr.SharedPrivateLinkResource{ // ... @@ -413,7 +413,7 @@ if err := client.SharedPrivateLinkResourcesCreateOrUpdateThenPoll(ctx, id, paylo ```go ctx := context.TODO() -id := signalr.NewSharedPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "sharedPrivateLinkResourceValue") +id := signalr.NewSharedPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue", "sharedPrivateLinkResourceValue") if err := client.SharedPrivateLinkResourcesDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -425,7 +425,7 @@ if err := client.SharedPrivateLinkResourcesDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := signalr.NewSharedPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "sharedPrivateLinkResourceValue") +id := signalr.NewSharedPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue", "sharedPrivateLinkResourceValue") read, err := client.SharedPrivateLinkResourcesGet(ctx, id) if err != nil { @@ -441,7 +441,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue") // alternatively `client.SharedPrivateLinkResourcesList(ctx, id)` can be used to do batched pagination items, err := client.SharedPrivateLinkResourcesListComplete(ctx, id) @@ -458,7 +458,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "signalRValue") payload := signalr.SignalRResource{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_customcertificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_customcertificate.go index 1d3417f59658..442248e497ae 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_customcertificate.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_customcertificate.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = CustomCertificateId{} // CustomCertificateId is a struct representing the Resource ID for a Custom Certificate type CustomCertificateId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string - CertificateName string + SubscriptionId string + ResourceGroupName string + SignalRName string + CustomCertificateName string } // NewCustomCertificateID returns a new CustomCertificateId struct -func NewCustomCertificateID(subscriptionId string, resourceGroupName string, resourceName string, certificateName string) CustomCertificateId { +func NewCustomCertificateID(subscriptionId string, resourceGroupName string, signalRName string, customCertificateName string) CustomCertificateId { return CustomCertificateId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - CertificateName: certificateName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SignalRName: signalRName, + CustomCertificateName: customCertificateName, } } @@ -46,12 +46,12 @@ func ParseCustomCertificateID(input string) (*CustomCertificateId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { + return nil, fmt.Errorf("the segment 'signalRName' was not found in the resource id %q", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input) + if id.CustomCertificateName, ok = parsed.Parsed["customCertificateName"]; !ok { + return nil, fmt.Errorf("the segment 'customCertificateName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseCustomCertificateIDInsensitively(input string) (*CustomCertificateId, return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { + return nil, fmt.Errorf("the segment 'signalRName' was not found in the resource id %q", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input) + if id.CustomCertificateName, ok = parsed.Parsed["customCertificateName"]; !ok { + return nil, fmt.Errorf("the segment 'customCertificateName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateCustomCertificateID(input interface{}, key string) (warnings []stri // ID returns the formatted Custom Certificate ID func (id CustomCertificateId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/signalR/%s/customCertificates/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.CertificateName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SignalRName, id.CustomCertificateName) } // Segments returns a slice of Resource ID Segments which comprise this Custom Certificate ID @@ -119,9 +119,9 @@ func (id CustomCertificateId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), resourceids.StaticSegment("staticSignalR", "signalR", "signalR"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("signalRName", "signalRValue"), resourceids.StaticSegment("staticCustomCertificates", "customCertificates", "customCertificates"), - resourceids.UserSpecifiedSegment("certificateName", "certificateValue"), + resourceids.UserSpecifiedSegment("customCertificateName", "customCertificateValue"), } } @@ -130,8 +130,8 @@ func (id CustomCertificateId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Certificate Name: %q", id.CertificateName), + fmt.Sprintf("Signal R Name: %q", id.SignalRName), + fmt.Sprintf("Custom Certificate Name: %q", id.CustomCertificateName), } return fmt.Sprintf("Custom Certificate (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_customdomain.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_customdomain.go index f0b353171445..cd6a1a1a7f1b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_customdomain.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_customdomain.go @@ -13,17 +13,17 @@ var _ resourceids.ResourceId = CustomDomainId{} type CustomDomainId struct { SubscriptionId string ResourceGroupName string - ResourceName string - Name string + SignalRName string + CustomDomainName string } // NewCustomDomainID returns a new CustomDomainId struct -func NewCustomDomainID(subscriptionId string, resourceGroupName string, resourceName string, name string) CustomDomainId { +func NewCustomDomainID(subscriptionId string, resourceGroupName string, signalRName string, customDomainName string) CustomDomainId { return CustomDomainId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - Name: name, + SignalRName: signalRName, + CustomDomainName: customDomainName, } } @@ -46,12 +46,12 @@ func ParseCustomDomainID(input string) (*CustomDomainId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { + return nil, fmt.Errorf("the segment 'signalRName' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.CustomDomainName, ok = parsed.Parsed["customDomainName"]; !ok { + return nil, fmt.Errorf("the segment 'customDomainName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseCustomDomainIDInsensitively(input string) (*CustomDomainId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { + return nil, fmt.Errorf("the segment 'signalRName' was not found in the resource id %q", input) } - if id.Name, ok = parsed.Parsed["name"]; !ok { - return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + if id.CustomDomainName, ok = parsed.Parsed["customDomainName"]; !ok { + return nil, fmt.Errorf("the segment 'customDomainName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateCustomDomainID(input interface{}, key string) (warnings []string, e // ID returns the formatted Custom Domain ID func (id CustomDomainId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/signalR/%s/customDomains/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.Name) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SignalRName, id.CustomDomainName) } // Segments returns a slice of Resource ID Segments which comprise this Custom Domain ID @@ -119,9 +119,9 @@ func (id CustomDomainId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), resourceids.StaticSegment("staticSignalR", "signalR", "signalR"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("signalRName", "signalRValue"), resourceids.StaticSegment("staticCustomDomains", "customDomains", "customDomains"), - resourceids.UserSpecifiedSegment("name", "nameValue"), + resourceids.UserSpecifiedSegment("customDomainName", "customDomainValue"), } } @@ -130,8 +130,8 @@ func (id CustomDomainId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - fmt.Sprintf("Name: %q", id.Name), + fmt.Sprintf("Signal R Name: %q", id.SignalRName), + fmt.Sprintf("Custom Domain Name: %q", id.CustomDomainName), } return fmt.Sprintf("Custom Domain (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_location.go index d20f653e488e..5e20afda2eb6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_location.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_location.go @@ -12,14 +12,14 @@ var _ resourceids.ResourceId = LocationId{} // LocationId is a struct representing the Resource ID for a Location type LocationId struct { SubscriptionId string - Location string + LocationName string } // NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { +func NewLocationID(subscriptionId string, locationName string) LocationId { return LocationId{ SubscriptionId: subscriptionId, - Location: location, + LocationName: locationName, } } @@ -38,8 +38,8 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.SignalRService/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } // Segments returns a slice of Resource ID Segments which comprise this Location ID @@ -97,7 +97,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), } } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { func (id LocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), } return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_privateendpointconnection.go index c1d221118f15..fe8a2070edec 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_privateendpointconnection.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_privateendpointconnection.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = PrivateEndpointConnectionId{} type PrivateEndpointConnectionId struct { SubscriptionId string ResourceGroupName string - ResourceName string + SignalRName string PrivateEndpointConnectionName string } // NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct -func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, resourceName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, signalRName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { return PrivateEndpointConnectionId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SignalRName: signalRName, PrivateEndpointConnectionName: privateEndpointConnectionName, } } @@ -46,8 +46,8 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { + return nil, fmt.Errorf("the segment 'signalRName' was not found in the resource id %q", input) } if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { @@ -77,8 +77,8 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { + return nil, fmt.Errorf("the segment 'signalRName' was not found in the resource id %q", input) } if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { @@ -106,7 +106,7 @@ func ValidatePrivateEndpointConnectionID(input interface{}, key string) (warning // ID returns the formatted Private Endpoint Connection ID func (id PrivateEndpointConnectionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/signalR/%s/privateEndpointConnections/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.PrivateEndpointConnectionName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SignalRName, id.PrivateEndpointConnectionName) } // Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID @@ -119,7 +119,7 @@ func (id PrivateEndpointConnectionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), resourceids.StaticSegment("staticSignalR", "signalR", "signalR"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("signalRName", "signalRValue"), resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionValue"), } @@ -130,7 +130,7 @@ func (id PrivateEndpointConnectionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Signal R Name: %q", id.SignalRName), fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), } return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_sharedprivatelinkresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_sharedprivatelinkresource.go index 71f3719e21b0..10153ef0d306 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_sharedprivatelinkresource.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_sharedprivatelinkresource.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = SharedPrivateLinkResourceId{} type SharedPrivateLinkResourceId struct { SubscriptionId string ResourceGroupName string - ResourceName string + SignalRName string SharedPrivateLinkResourceName string } // NewSharedPrivateLinkResourceID returns a new SharedPrivateLinkResourceId struct -func NewSharedPrivateLinkResourceID(subscriptionId string, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string) SharedPrivateLinkResourceId { +func NewSharedPrivateLinkResourceID(subscriptionId string, resourceGroupName string, signalRName string, sharedPrivateLinkResourceName string) SharedPrivateLinkResourceId { return SharedPrivateLinkResourceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SignalRName: signalRName, SharedPrivateLinkResourceName: sharedPrivateLinkResourceName, } } @@ -46,8 +46,8 @@ func ParseSharedPrivateLinkResourceID(input string) (*SharedPrivateLinkResourceI return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { + return nil, fmt.Errorf("the segment 'signalRName' was not found in the resource id %q", input) } if id.SharedPrivateLinkResourceName, ok = parsed.Parsed["sharedPrivateLinkResourceName"]; !ok { @@ -77,8 +77,8 @@ func ParseSharedPrivateLinkResourceIDInsensitively(input string) (*SharedPrivate return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { + return nil, fmt.Errorf("the segment 'signalRName' was not found in the resource id %q", input) } if id.SharedPrivateLinkResourceName, ok = parsed.Parsed["sharedPrivateLinkResourceName"]; !ok { @@ -106,7 +106,7 @@ func ValidateSharedPrivateLinkResourceID(input interface{}, key string) (warning // ID returns the formatted Shared Private Link Resource ID func (id SharedPrivateLinkResourceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/signalR/%s/sharedPrivateLinkResources/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.SharedPrivateLinkResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SignalRName, id.SharedPrivateLinkResourceName) } // Segments returns a slice of Resource ID Segments which comprise this Shared Private Link Resource ID @@ -119,7 +119,7 @@ func (id SharedPrivateLinkResourceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), resourceids.StaticSegment("staticSignalR", "signalR", "signalR"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("signalRName", "signalRValue"), resourceids.StaticSegment("staticSharedPrivateLinkResources", "sharedPrivateLinkResources", "sharedPrivateLinkResources"), resourceids.UserSpecifiedSegment("sharedPrivateLinkResourceName", "sharedPrivateLinkResourceValue"), } @@ -130,7 +130,7 @@ func (id SharedPrivateLinkResourceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Signal R Name: %q", id.SignalRName), fmt.Sprintf("Shared Private Link Resource Name: %q", id.SharedPrivateLinkResourceName), } return fmt.Sprintf("Shared Private Link Resource (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_signalr.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_signalr.go index 93eac7234010..a375e0947256 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_signalr.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_signalr.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = SignalRId{} type SignalRId struct { SubscriptionId string ResourceGroupName string - ResourceName string + SignalRName string } // NewSignalRID returns a new SignalRId struct -func NewSignalRID(subscriptionId string, resourceGroupName string, resourceName string) SignalRId { +func NewSignalRID(subscriptionId string, resourceGroupName string, signalRName string) SignalRId { return SignalRId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + SignalRName: signalRName, } } @@ -44,8 +44,8 @@ func ParseSignalRID(input string) (*SignalRId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { + return nil, fmt.Errorf("the segment 'signalRName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseSignalRIDInsensitively(input string) (*SignalRId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { + return nil, fmt.Errorf("the segment 'signalRName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateSignalRID(input interface{}, key string) (warnings []string, errors // ID returns the formatted Signal R ID func (id SignalRId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/signalR/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SignalRName) } // Segments returns a slice of Resource ID Segments which comprise this Signal R ID @@ -109,7 +109,7 @@ func (id SignalRId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), resourceids.StaticSegment("staticSignalR", "signalR", "signalR"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("signalRName", "signalRValue"), } } @@ -118,7 +118,7 @@ func (id SignalRId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Signal R Name: %q", id.SignalRName), } return fmt.Sprintf("Signal R (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobcontainers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobcontainers/README.md index 6a41890216ef..b27b641bf476 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobcontainers/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobcontainers/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "containerValue") +id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "containerValue") payload := blobcontainers.LegalHold{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "containerValue") +id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "containerValue") payload := blobcontainers.BlobContainer{ // ... @@ -66,7 +66,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "containerValue") +id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "containerValue") payload := blobcontainers.ImmutabilityPolicy{ // ... @@ -87,7 +87,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "containerValue") +id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "containerValue") read, err := client.Delete(ctx, id) if err != nil { @@ -103,7 +103,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "containerValue") +id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "containerValue") read, err := client.DeleteImmutabilityPolicy(ctx, id, blobcontainers.DefaultDeleteImmutabilityPolicyOperationOptions()) if err != nil { @@ -119,7 +119,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "containerValue") +id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "containerValue") payload := blobcontainers.ImmutabilityPolicy{ // ... @@ -140,7 +140,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "containerValue") +id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "containerValue") read, err := client.Get(ctx, id) if err != nil { @@ -156,7 +156,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "containerValue") +id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "containerValue") read, err := client.GetImmutabilityPolicy(ctx, id, blobcontainers.DefaultGetImmutabilityPolicyOperationOptions()) if err != nil { @@ -172,7 +172,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "containerValue") +id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "containerValue") payload := blobcontainers.LeaseContainerRequest{ // ... @@ -193,7 +193,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobcontainers.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := blobcontainers.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") // alternatively `client.List(ctx, id, blobcontainers.DefaultListOperationOptions())` can be used to do batched pagination items, err := client.ListComplete(ctx, id, blobcontainers.DefaultListOperationOptions()) @@ -210,7 +210,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "containerValue") +id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "containerValue") read, err := client.LockImmutabilityPolicy(ctx, id, blobcontainers.DefaultLockImmutabilityPolicyOperationOptions()) if err != nil { @@ -226,7 +226,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "containerValue") +id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "containerValue") if err := client.ObjectLevelWormThenPoll(ctx, id); err != nil { // handle the error @@ -238,7 +238,7 @@ if err := client.ObjectLevelWormThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "containerValue") +id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "containerValue") payload := blobcontainers.LegalHold{ // ... @@ -259,7 +259,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "containerValue") +id := blobcontainers.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "containerValue") payload := blobcontainers.BlobContainer{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobcontainers/id_container.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobcontainers/id_container.go index 7de51179935e..cdb69fcd08e5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobcontainers/id_container.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobcontainers/id_container.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = ContainerId{} // ContainerId is a struct representing the Resource ID for a Container type ContainerId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - ContainerName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string + ContainerName string } // NewContainerID returns a new ContainerId struct -func NewContainerID(subscriptionId string, resourceGroupName string, accountName string, containerName string) ContainerId { +func NewContainerID(subscriptionId string, resourceGroupName string, storageAccountName string, containerName string) ContainerId { return ContainerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - ContainerName: containerName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, + ContainerName: containerName, } } @@ -46,8 +46,8 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { @@ -77,8 +77,8 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { @@ -106,7 +106,7 @@ func ValidateContainerID(input interface{}, key string) (warnings []string, erro // ID returns the formatted Container ID func (id ContainerId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s/blobServices/default/containers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ContainerName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName, id.ContainerName) } // Segments returns a slice of Resource ID Segments which comprise this Container ID @@ -119,7 +119,7 @@ func (id ContainerId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), resourceids.StaticSegment("staticBlobServices", "blobServices", "blobServices"), resourceids.StaticSegment("staticDefault", "default", "default"), resourceids.StaticSegment("staticContainers", "containers", "containers"), @@ -132,7 +132,7 @@ func (id ContainerId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), fmt.Sprintf("Container Name: %q", id.ContainerName), } return fmt.Sprintf("Container (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobcontainers/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobcontainers/id_storageaccount.go index 073ae5274abf..e1d7a88a9d7e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobcontainers/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobcontainers/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobinventorypolicies/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobinventorypolicies/README.md index 9b32c7da93ff..8bb563ca9a9a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobinventorypolicies/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobinventorypolicies/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := blobinventorypolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := blobinventorypolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") payload := blobinventorypolicies.BlobInventoryPolicy{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobinventorypolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := blobinventorypolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobinventorypolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := blobinventorypolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.Get(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobinventorypolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := blobinventorypolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.List(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobinventorypolicies/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobinventorypolicies/id_storageaccount.go index 18d6a1ab4cda..824b394a5c34 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobinventorypolicies/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobinventorypolicies/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobservice/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobservice/README.md index 5597d36988eb..70a91c151936 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobservice/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobservice/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := blobservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := blobservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.GetServiceProperties(ctx, id) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := blobservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.List(ctx, id) if err != nil { @@ -56,7 +56,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := blobservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := blobservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") payload := blobservice.BlobServiceProperties{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobservice/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobservice/id_storageaccount.go index 573d4b69b8b1..4c9070ccc22b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobservice/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/blobservice/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/deletedaccounts/id_deletedaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/deletedaccounts/id_deletedaccount.go index 11b5327878a4..470880f1d61e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/deletedaccounts/id_deletedaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/deletedaccounts/id_deletedaccount.go @@ -12,15 +12,15 @@ var _ resourceids.ResourceId = DeletedAccountId{} // DeletedAccountId is a struct representing the Resource ID for a Deleted Account type DeletedAccountId struct { SubscriptionId string - Location string + LocationName string DeletedAccountName string } // NewDeletedAccountID returns a new DeletedAccountId struct -func NewDeletedAccountID(subscriptionId string, location string, deletedAccountName string) DeletedAccountId { +func NewDeletedAccountID(subscriptionId string, locationName string, deletedAccountName string) DeletedAccountId { return DeletedAccountId{ SubscriptionId: subscriptionId, - Location: location, + LocationName: locationName, DeletedAccountName: deletedAccountName, } } @@ -40,8 +40,8 @@ func ParseDeletedAccountID(input string) (*DeletedAccountId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } if id.DeletedAccountName, ok = parsed.Parsed["deletedAccountName"]; !ok { @@ -67,8 +67,8 @@ func ParseDeletedAccountIDInsensitively(input string) (*DeletedAccountId, error) return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } if id.DeletedAccountName, ok = parsed.Parsed["deletedAccountName"]; !ok { @@ -96,7 +96,7 @@ func ValidateDeletedAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Deleted Account ID func (id DeletedAccountId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.Storage/locations/%s/deletedAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location, id.DeletedAccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.DeletedAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Deleted Account ID @@ -107,7 +107,7 @@ func (id DeletedAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), resourceids.StaticSegment("staticDeletedAccounts", "deletedAccounts", "deletedAccounts"), resourceids.UserSpecifiedSegment("deletedAccountName", "deletedAccountValue"), } @@ -117,7 +117,7 @@ func (id DeletedAccountId) Segments() []resourceids.Segment { func (id DeletedAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), fmt.Sprintf("Deleted Account Name: %q", id.DeletedAccountName), } return fmt.Sprintf("Deleted Account (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/encryptionscopes/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/encryptionscopes/README.md index e2a8903efe92..a6c976899f94 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/encryptionscopes/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/encryptionscopes/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := encryptionscopes.NewEncryptionScopeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "encryptionScopeValue") +id := encryptionscopes.NewEncryptionScopeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "encryptionScopeValue") read, err := client.Get(ctx, id) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := encryptionscopes.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := encryptionscopes.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") // alternatively `client.List(ctx, id)` can be used to do batched pagination items, err := client.ListComplete(ctx, id) @@ -57,7 +57,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := encryptionscopes.NewEncryptionScopeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "encryptionScopeValue") +id := encryptionscopes.NewEncryptionScopeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "encryptionScopeValue") payload := encryptionscopes.EncryptionScope{ // ... @@ -78,7 +78,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := encryptionscopes.NewEncryptionScopeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "encryptionScopeValue") +id := encryptionscopes.NewEncryptionScopeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "encryptionScopeValue") payload := encryptionscopes.EncryptionScope{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/encryptionscopes/id_encryptionscope.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/encryptionscopes/id_encryptionscope.go index 26a5d3629174..9341ca107c9f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/encryptionscopes/id_encryptionscope.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/encryptionscopes/id_encryptionscope.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = EncryptionScopeId{} type EncryptionScopeId struct { SubscriptionId string ResourceGroupName string - AccountName string + StorageAccountName string EncryptionScopeName string } // NewEncryptionScopeID returns a new EncryptionScopeId struct -func NewEncryptionScopeID(subscriptionId string, resourceGroupName string, accountName string, encryptionScopeName string) EncryptionScopeId { +func NewEncryptionScopeID(subscriptionId string, resourceGroupName string, storageAccountName string, encryptionScopeName string) EncryptionScopeId { return EncryptionScopeId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + StorageAccountName: storageAccountName, EncryptionScopeName: encryptionScopeName, } } @@ -46,8 +46,8 @@ func ParseEncryptionScopeID(input string) (*EncryptionScopeId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } if id.EncryptionScopeName, ok = parsed.Parsed["encryptionScopeName"]; !ok { @@ -77,8 +77,8 @@ func ParseEncryptionScopeIDInsensitively(input string) (*EncryptionScopeId, erro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } if id.EncryptionScopeName, ok = parsed.Parsed["encryptionScopeName"]; !ok { @@ -106,7 +106,7 @@ func ValidateEncryptionScopeID(input interface{}, key string) (warnings []string // ID returns the formatted Encryption Scope ID func (id EncryptionScopeId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s/encryptionScopes/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.EncryptionScopeName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName, id.EncryptionScopeName) } // Segments returns a slice of Resource ID Segments which comprise this Encryption Scope ID @@ -119,7 +119,7 @@ func (id EncryptionScopeId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), resourceids.StaticSegment("staticEncryptionScopes", "encryptionScopes", "encryptionScopes"), resourceids.UserSpecifiedSegment("encryptionScopeName", "encryptionScopeValue"), } @@ -130,7 +130,7 @@ func (id EncryptionScopeId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), fmt.Sprintf("Encryption Scope Name: %q", id.EncryptionScopeName), } return fmt.Sprintf("Encryption Scope (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/encryptionscopes/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/encryptionscopes/id_storageaccount.go index 96709d031426..77257cf86cf7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/encryptionscopes/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/encryptionscopes/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileservice/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileservice/README.md index 97d51816d0b0..d5256c133537 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileservice/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileservice/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := fileservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := fileservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.GetServiceProperties(ctx, id) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := fileservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := fileservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.List(ctx, id) if err != nil { @@ -56,7 +56,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := fileservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := fileservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") payload := fileservice.FileServiceProperties{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileservice/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileservice/id_storageaccount.go index 2e659836971c..e546c244d53d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileservice/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileservice/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileshares/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileshares/README.md index 86ca912d8b37..a960a636a8ed 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileshares/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileshares/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := fileshares.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue") +id := fileshares.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "shareValue") payload := fileshares.FileShare{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := fileshares.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue") +id := fileshares.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "shareValue") read, err := client.Delete(ctx, id, fileshares.DefaultDeleteOperationOptions()) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := fileshares.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue") +id := fileshares.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "shareValue") read, err := client.Get(ctx, id, fileshares.DefaultGetOperationOptions()) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := fileshares.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue") +id := fileshares.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "shareValue") payload := fileshares.LeaseShareRequest{ // ... @@ -98,7 +98,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := fileshares.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := fileshares.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") // alternatively `client.List(ctx, id, fileshares.DefaultListOperationOptions())` can be used to do batched pagination items, err := client.ListComplete(ctx, id, fileshares.DefaultListOperationOptions()) @@ -115,7 +115,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := fileshares.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue") +id := fileshares.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "shareValue") payload := fileshares.DeletedShare{ // ... @@ -136,7 +136,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := fileshares.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "shareValue") +id := fileshares.NewShareID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "shareValue") payload := fileshares.FileShare{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileshares/id_share.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileshares/id_share.go index 529175f70d9f..7a1f74dabd0a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileshares/id_share.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileshares/id_share.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = ShareId{} // ShareId is a struct representing the Resource ID for a Share type ShareId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - ShareName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string + ShareName string } // NewShareID returns a new ShareId struct -func NewShareID(subscriptionId string, resourceGroupName string, accountName string, shareName string) ShareId { +func NewShareID(subscriptionId string, resourceGroupName string, storageAccountName string, shareName string) ShareId { return ShareId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - ShareName: shareName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, + ShareName: shareName, } } @@ -46,8 +46,8 @@ func ParseShareID(input string) (*ShareId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { @@ -77,8 +77,8 @@ func ParseShareIDInsensitively(input string) (*ShareId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { @@ -106,7 +106,7 @@ func ValidateShareID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Share ID func (id ShareId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s/fileServices/default/shares/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ShareName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName, id.ShareName) } // Segments returns a slice of Resource ID Segments which comprise this Share ID @@ -119,7 +119,7 @@ func (id ShareId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), resourceids.StaticSegment("staticFileServices", "fileServices", "fileServices"), resourceids.StaticSegment("staticDefault", "default", "default"), resourceids.StaticSegment("staticShares", "shares", "shares"), @@ -132,7 +132,7 @@ func (id ShareId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), fmt.Sprintf("Share Name: %q", id.ShareName), } return fmt.Sprintf("Share (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileshares/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileshares/id_storageaccount.go index 08af58ab4641..f501668ad399 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileshares/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/fileshares/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/localusers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/localusers/README.md index fab56eec2594..36fe03a4bc0c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/localusers/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/localusers/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := localusers.NewLocalUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "usernameValue") +id := localusers.NewLocalUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "localUserValue") payload := localusers.LocalUser{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := localusers.NewLocalUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "usernameValue") +id := localusers.NewLocalUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "localUserValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := localusers.NewLocalUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "usernameValue") +id := localusers.NewLocalUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "localUserValue") read, err := client.Get(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := localusers.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := localusers.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.List(ctx, id) if err != nil { @@ -93,7 +93,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := localusers.NewLocalUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "usernameValue") +id := localusers.NewLocalUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "localUserValue") read, err := client.ListKeys(ctx, id) if err != nil { @@ -109,7 +109,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := localusers.NewLocalUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "usernameValue") +id := localusers.NewLocalUserID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "localUserValue") read, err := client.RegeneratePassword(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/localusers/id_localuser.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/localusers/id_localuser.go index 71f8789a8f57..654581b4d4f6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/localusers/id_localuser.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/localusers/id_localuser.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = LocalUserId{} // LocalUserId is a struct representing the Resource ID for a Local User type LocalUserId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - Username string + SubscriptionId string + ResourceGroupName string + StorageAccountName string + LocalUserName string } // NewLocalUserID returns a new LocalUserId struct -func NewLocalUserID(subscriptionId string, resourceGroupName string, accountName string, username string) LocalUserId { +func NewLocalUserID(subscriptionId string, resourceGroupName string, storageAccountName string, localUserName string) LocalUserId { return LocalUserId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - Username: username, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, + LocalUserName: localUserName, } } @@ -46,12 +46,12 @@ func ParseLocalUserID(input string) (*LocalUserId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } - if id.Username, ok = parsed.Parsed["username"]; !ok { - return nil, fmt.Errorf("the segment 'username' was not found in the resource id %q", input) + if id.LocalUserName, ok = parsed.Parsed["localUserName"]; !ok { + return nil, fmt.Errorf("the segment 'localUserName' was not found in the resource id %q", input) } return &id, nil @@ -77,12 +77,12 @@ func ParseLocalUserIDInsensitively(input string) (*LocalUserId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } - if id.Username, ok = parsed.Parsed["username"]; !ok { - return nil, fmt.Errorf("the segment 'username' was not found in the resource id %q", input) + if id.LocalUserName, ok = parsed.Parsed["localUserName"]; !ok { + return nil, fmt.Errorf("the segment 'localUserName' was not found in the resource id %q", input) } return &id, nil @@ -106,7 +106,7 @@ func ValidateLocalUserID(input interface{}, key string) (warnings []string, erro // ID returns the formatted Local User ID func (id LocalUserId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s/localUsers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.Username) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName, id.LocalUserName) } // Segments returns a slice of Resource ID Segments which comprise this Local User ID @@ -119,9 +119,9 @@ func (id LocalUserId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), resourceids.StaticSegment("staticLocalUsers", "localUsers", "localUsers"), - resourceids.UserSpecifiedSegment("username", "usernameValue"), + resourceids.UserSpecifiedSegment("localUserName", "localUserValue"), } } @@ -130,8 +130,8 @@ func (id LocalUserId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Username: %q", id.Username), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), + fmt.Sprintf("Local User Name: %q", id.LocalUserName), } return fmt.Sprintf("Local User (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/localusers/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/localusers/id_storageaccount.go index 3a7a3ea928e5..50066932db59 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/localusers/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/localusers/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/managementpolicies/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/managementpolicies/README.md index c13364958f0b..8672c63cafb9 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/managementpolicies/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/managementpolicies/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := managementpolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := managementpolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") payload := managementpolicies.ManagementPolicy{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managementpolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := managementpolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := managementpolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := managementpolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.Get(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/managementpolicies/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/managementpolicies/id_storageaccount.go index 8d7361f4ae52..aad02b78cab9 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/managementpolicies/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/managementpolicies/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/objectreplicationpolicies/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/objectreplicationpolicies/README.md index dbc544bc5cdc..bd0e2b3d8221 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/objectreplicationpolicies/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/objectreplicationpolicies/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := objectreplicationpolicies.NewObjectReplicationPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "objectReplicationPolicyIdValue") +id := objectreplicationpolicies.NewObjectReplicationPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "objectReplicationPolicyIdValue") payload := objectreplicationpolicies.ObjectReplicationPolicy{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := objectreplicationpolicies.NewObjectReplicationPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "objectReplicationPolicyIdValue") +id := objectreplicationpolicies.NewObjectReplicationPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "objectReplicationPolicyIdValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := objectreplicationpolicies.NewObjectReplicationPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "objectReplicationPolicyIdValue") +id := objectreplicationpolicies.NewObjectReplicationPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "objectReplicationPolicyIdValue") read, err := client.Get(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := objectreplicationpolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := objectreplicationpolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.List(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/objectreplicationpolicies/id_objectreplicationpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/objectreplicationpolicies/id_objectreplicationpolicy.go index 6dd0d735d915..9af383eb55b8 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/objectreplicationpolicies/id_objectreplicationpolicy.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/objectreplicationpolicies/id_objectreplicationpolicy.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = ObjectReplicationPolicyId{} type ObjectReplicationPolicyId struct { SubscriptionId string ResourceGroupName string - AccountName string + StorageAccountName string ObjectReplicationPolicyId string } // NewObjectReplicationPolicyID returns a new ObjectReplicationPolicyId struct -func NewObjectReplicationPolicyID(subscriptionId string, resourceGroupName string, accountName string, objectReplicationPolicyId string) ObjectReplicationPolicyId { +func NewObjectReplicationPolicyID(subscriptionId string, resourceGroupName string, storageAccountName string, objectReplicationPolicyId string) ObjectReplicationPolicyId { return ObjectReplicationPolicyId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + StorageAccountName: storageAccountName, ObjectReplicationPolicyId: objectReplicationPolicyId, } } @@ -46,8 +46,8 @@ func ParseObjectReplicationPolicyID(input string) (*ObjectReplicationPolicyId, e return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } if id.ObjectReplicationPolicyId, ok = parsed.Parsed["objectReplicationPolicyId"]; !ok { @@ -77,8 +77,8 @@ func ParseObjectReplicationPolicyIDInsensitively(input string) (*ObjectReplicati return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } if id.ObjectReplicationPolicyId, ok = parsed.Parsed["objectReplicationPolicyId"]; !ok { @@ -106,7 +106,7 @@ func ValidateObjectReplicationPolicyID(input interface{}, key string) (warnings // ID returns the formatted Object Replication Policy ID func (id ObjectReplicationPolicyId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s/objectReplicationPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.ObjectReplicationPolicyId) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName, id.ObjectReplicationPolicyId) } // Segments returns a slice of Resource ID Segments which comprise this Object Replication Policy ID @@ -119,7 +119,7 @@ func (id ObjectReplicationPolicyId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), resourceids.StaticSegment("staticObjectReplicationPolicies", "objectReplicationPolicies", "objectReplicationPolicies"), resourceids.UserSpecifiedSegment("objectReplicationPolicyId", "objectReplicationPolicyIdValue"), } @@ -130,7 +130,7 @@ func (id ObjectReplicationPolicyId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), fmt.Sprintf("Object Replication Policy: %q", id.ObjectReplicationPolicyId), } return fmt.Sprintf("Object Replication Policy (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/objectreplicationpolicies/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/objectreplicationpolicies/id_storageaccount.go index cba80e114277..3031dafc9254 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/objectreplicationpolicies/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/objectreplicationpolicies/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privateendpointconnections/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privateendpointconnections/README.md index 624c03a3d34d..7fe318f7ed11 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privateendpointconnections/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privateendpointconnections/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "privateEndpointConnectionValue") +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "privateEndpointConnectionValue") read, err := client.Delete(ctx, id) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "privateEndpointConnectionValue") +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "privateEndpointConnectionValue") read, err := client.Get(ctx, id) if err != nil { @@ -56,7 +56,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := privateendpointconnections.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := privateendpointconnections.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.List(ctx, id) if err != nil { @@ -72,7 +72,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "privateEndpointConnectionValue") +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "privateEndpointConnectionValue") payload := privateendpointconnections.PrivateEndpointConnection{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privateendpointconnections/id_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privateendpointconnections/id_privateendpointconnection.go index fbe24e68f6cc..4437b5fda808 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privateendpointconnections/id_privateendpointconnection.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privateendpointconnections/id_privateendpointconnection.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = PrivateEndpointConnectionId{} type PrivateEndpointConnectionId struct { SubscriptionId string ResourceGroupName string - AccountName string + StorageAccountName string PrivateEndpointConnectionName string } // NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct -func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, accountName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, storageAccountName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { return PrivateEndpointConnectionId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + StorageAccountName: storageAccountName, PrivateEndpointConnectionName: privateEndpointConnectionName, } } @@ -46,8 +46,8 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { @@ -77,8 +77,8 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { @@ -106,7 +106,7 @@ func ValidatePrivateEndpointConnectionID(input interface{}, key string) (warning // ID returns the formatted Private Endpoint Connection ID func (id PrivateEndpointConnectionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s/privateEndpointConnections/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PrivateEndpointConnectionName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName, id.PrivateEndpointConnectionName) } // Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID @@ -119,7 +119,7 @@ func (id PrivateEndpointConnectionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionValue"), } @@ -130,7 +130,7 @@ func (id PrivateEndpointConnectionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), } return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privateendpointconnections/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privateendpointconnections/id_storageaccount.go index c11220698b16..755000fa8f94 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privateendpointconnections/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privateendpointconnections/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privatelinkresources/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privatelinkresources/README.md index ca0ddd4dd92c..29a183acefee 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privatelinkresources/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privatelinkresources/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := privatelinkresources.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := privatelinkresources.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.ListByStorageAccount(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privatelinkresources/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privatelinkresources/id_storageaccount.go index 8035bd78f0ac..d131397f760d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privatelinkresources/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/privatelinkresources/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueservice/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueservice/README.md index 0c93bfd50c63..5a9d7978dfad 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueservice/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueservice/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := queueservice.NewQueueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "queueValue") +id := queueservice.NewQueueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "queueValue") payload := queueservice.StorageQueue{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := queueservice.NewQueueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "queueValue") +id := queueservice.NewQueueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "queueValue") read, err := client.QueueDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := queueservice.NewQueueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "queueValue") +id := queueservice.NewQueueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "queueValue") read, err := client.QueueGet(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := queueservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := queueservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") // alternatively `client.QueueList(ctx, id, queueservice.DefaultQueueListOperationOptions())` can be used to do batched pagination items, err := client.QueueListComplete(ctx, id, queueservice.DefaultQueueListOperationOptions()) @@ -94,7 +94,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := queueservice.NewQueueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "queueValue") +id := queueservice.NewQueueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "queueValue") payload := queueservice.StorageQueue{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueservice/id_queue.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueservice/id_queue.go index a40a634722de..cc0486833934 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueservice/id_queue.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueservice/id_queue.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = QueueId{} // QueueId is a struct representing the Resource ID for a Queue type QueueId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - QueueName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string + QueueName string } // NewQueueID returns a new QueueId struct -func NewQueueID(subscriptionId string, resourceGroupName string, accountName string, queueName string) QueueId { +func NewQueueID(subscriptionId string, resourceGroupName string, storageAccountName string, queueName string) QueueId { return QueueId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - QueueName: queueName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, + QueueName: queueName, } } @@ -46,8 +46,8 @@ func ParseQueueID(input string) (*QueueId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { @@ -77,8 +77,8 @@ func ParseQueueIDInsensitively(input string) (*QueueId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { @@ -106,7 +106,7 @@ func ValidateQueueID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Queue ID func (id QueueId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s/queueServices/default/queues/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.QueueName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName, id.QueueName) } // Segments returns a slice of Resource ID Segments which comprise this Queue ID @@ -119,7 +119,7 @@ func (id QueueId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), resourceids.StaticSegment("staticQueueServices", "queueServices", "queueServices"), resourceids.StaticSegment("staticDefault", "default", "default"), resourceids.StaticSegment("staticQueues", "queues", "queues"), @@ -132,7 +132,7 @@ func (id QueueId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), fmt.Sprintf("Queue Name: %q", id.QueueName), } return fmt.Sprintf("Queue (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueservice/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueservice/id_storageaccount.go index 0e410fbe4d64..5f01bcdcda30 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueservice/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueservice/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueserviceproperties/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueserviceproperties/README.md index 1de4e6b19b79..766735b8a76e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueserviceproperties/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueserviceproperties/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := queueserviceproperties.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := queueserviceproperties.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.QueueServicesGetServiceProperties(ctx, id) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := queueserviceproperties.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := queueserviceproperties.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.QueueServicesList(ctx, id) if err != nil { @@ -56,7 +56,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := queueserviceproperties.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := queueserviceproperties.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") payload := queueserviceproperties.QueueServiceProperties{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueserviceproperties/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueserviceproperties/id_storageaccount.go index 1a3717cacf4c..b77c86796b92 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueserviceproperties/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/queueserviceproperties/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/storageaccounts/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/storageaccounts/README.md index 2b8bf0b83e32..38977919e605 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/storageaccounts/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/storageaccounts/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") if err := client.AbortHierarchicalNamespaceMigrationThenPoll(ctx, id); err != nil { // handle the error @@ -57,7 +57,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") payload := storageaccounts.StorageAccountCreateParameters{ // ... @@ -74,7 +74,7 @@ if err := client.CreateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.Delete(ctx, id) if err != nil { @@ -90,7 +90,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") if err := client.FailoverThenPoll(ctx, id); err != nil { // handle the error @@ -102,7 +102,7 @@ if err := client.FailoverThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.GetProperties(ctx, id, storageaccounts.DefaultGetPropertiesOperationOptions()) if err != nil { @@ -118,7 +118,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") if err := client.HierarchicalNamespaceMigrationThenPoll(ctx, id, storageaccounts.DefaultHierarchicalNamespaceMigrationOperationOptions()); err != nil { // handle the error @@ -147,7 +147,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") payload := storageaccounts.AccountSasParameters{ // ... @@ -185,7 +185,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.ListKeys(ctx, id, storageaccounts.DefaultListKeysOperationOptions()) if err != nil { @@ -201,7 +201,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") payload := storageaccounts.ServiceSasParameters{ // ... @@ -222,7 +222,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") payload := storageaccounts.StorageAccountRegenerateKeyParameters{ // ... @@ -243,7 +243,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") payload := storageaccounts.BlobRestoreParameters{ // ... @@ -260,7 +260,7 @@ if err := client.RestoreBlobRangesThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.RevokeUserDelegationKeys(ctx, id) if err != nil { @@ -276,7 +276,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := storageaccounts.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") payload := storageaccounts.StorageAccountUpdateParameters{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/storageaccounts/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/storageaccounts/id_storageaccount.go index 0bc35ceeb5ed..e710659a962b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/storageaccounts/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/storageaccounts/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableservice/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableservice/README.md index 051ee8d5987d..e39f0584c332 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableservice/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableservice/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := tableservice.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "tableValue") +id := tableservice.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "tableValue") payload := tableservice.Table{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := tableservice.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "tableValue") +id := tableservice.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "tableValue") read, err := client.TableDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := tableservice.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "tableValue") +id := tableservice.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "tableValue") read, err := client.TableGet(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := tableservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := tableservice.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") // alternatively `client.TableList(ctx, id)` can be used to do batched pagination items, err := client.TableListComplete(ctx, id) @@ -94,7 +94,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := tableservice.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "tableValue") +id := tableservice.NewTableID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue", "tableValue") payload := tableservice.Table{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableservice/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableservice/id_storageaccount.go index c00d15c01f1e..839499002e10 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableservice/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableservice/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableservice/id_table.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableservice/id_table.go index 0028d3a0c34a..9fcfa87db134 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableservice/id_table.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableservice/id_table.go @@ -11,19 +11,19 @@ var _ resourceids.ResourceId = TableId{} // TableId is a struct representing the Resource ID for a Table type TableId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - TableName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string + TableName string } // NewTableID returns a new TableId struct -func NewTableID(subscriptionId string, resourceGroupName string, accountName string, tableName string) TableId { +func NewTableID(subscriptionId string, resourceGroupName string, storageAccountName string, tableName string) TableId { return TableId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - TableName: tableName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, + TableName: tableName, } } @@ -46,8 +46,8 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } if id.TableName, ok = parsed.Parsed["tableName"]; !ok { @@ -77,8 +77,8 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } if id.TableName, ok = parsed.Parsed["tableName"]; !ok { @@ -106,7 +106,7 @@ func ValidateTableID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Table ID func (id TableId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s/tableServices/default/tables/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.TableName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName, id.TableName) } // Segments returns a slice of Resource ID Segments which comprise this Table ID @@ -119,7 +119,7 @@ func (id TableId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), resourceids.StaticSegment("staticTableServices", "tableServices", "tableServices"), resourceids.StaticSegment("staticDefault", "default", "default"), resourceids.StaticSegment("staticTables", "tables", "tables"), @@ -132,7 +132,7 @@ func (id TableId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), fmt.Sprintf("Table Name: %q", id.TableName), } return fmt.Sprintf("Table (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableserviceproperties/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableserviceproperties/README.md index 0487195254cd..882e7e07c1a6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableserviceproperties/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableserviceproperties/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := tableserviceproperties.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := tableserviceproperties.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.TableServicesGetServiceProperties(ctx, id) if err != nil { @@ -40,7 +40,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := tableserviceproperties.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := tableserviceproperties.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") read, err := client.TableServicesList(ctx, id) if err != nil { @@ -56,7 +56,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := tableserviceproperties.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := tableserviceproperties.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "storageAccountValue") payload := tableserviceproperties.TableServiceProperties{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableserviceproperties/id_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableserviceproperties/id_storageaccount.go index 6db040ebcf1b..a06a125b83a9 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableserviceproperties/id_storageaccount.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/tableserviceproperties/id_storageaccount.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = StorageAccountId{} // StorageAccountId is a struct representing the Resource ID for a Storage Account type StorageAccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string + SubscriptionId string + ResourceGroupName string + StorageAccountName string } // NewStorageAccountID returns a new StorageAccountId struct -func NewStorageAccountID(subscriptionId string, resourceGroupName string, accountName string) StorageAccountId { +func NewStorageAccountID(subscriptionId string, resourceGroupName string, storageAccountName string) StorageAccountId { return StorageAccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + StorageAccountName: storageAccountName, } } @@ -44,8 +44,8 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'storageAccountName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStorageAccountID(input interface{}, key string) (warnings []string, // ID returns the formatted Storage Account ID func (id StorageAccountId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StorageAccountName) } // Segments returns a slice of Resource ID Segments which comprise this Storage Account ID @@ -109,7 +109,7 @@ func (id StorageAccountId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStorage", "Microsoft.Storage", "Microsoft.Storage"), resourceids.StaticSegment("staticStorageAccounts", "storageAccounts", "storageAccounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("storageAccountName", "storageAccountValue"), } } @@ -118,7 +118,7 @@ func (id StorageAccountId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Storage Account Name: %q", id.StorageAccountName), } return fmt.Sprintf("Storage Account (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/functions/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/functions/README.md index ef877301eaf4..16d63841ae65 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/functions/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/functions/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := functions.NewFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "functionValue") +id := functions.NewFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "functionValue") payload := functions.Function{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := functions.NewFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "functionValue") +id := functions.NewFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "functionValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := functions.NewFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "functionValue") +id := functions.NewFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "functionValue") read, err := client.Get(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := functions.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue") +id := functions.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue") // alternatively `client.ListByStreamingJob(ctx, id, functions.DefaultListByStreamingJobOperationOptions())` can be used to do batched pagination items, err := client.ListByStreamingJobComplete(ctx, id, functions.DefaultListByStreamingJobOperationOptions()) @@ -94,7 +94,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := functions.NewFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "functionValue") +id := functions.NewFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "functionValue") payload := functions.FunctionRetrieveDefaultDefinitionParameters{ // ... @@ -115,7 +115,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := functions.NewFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "functionValue") +id := functions.NewFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "functionValue") payload := functions.Function{ // ... @@ -132,7 +132,7 @@ if err := client.TestThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := functions.NewFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "functionValue") +id := functions.NewFunctionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "functionValue") payload := functions.Function{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/functions/id_function.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/functions/id_function.go index 815a51ac48e7..2d54dd61586c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/functions/id_function.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/functions/id_function.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = FunctionId{} type FunctionId struct { SubscriptionId string ResourceGroupName string - JobName string + StreamingJobName string FunctionName string } // NewFunctionID returns a new FunctionId struct -func NewFunctionID(subscriptionId string, resourceGroupName string, jobName string, functionName string) FunctionId { +func NewFunctionID(subscriptionId string, resourceGroupName string, streamingJobName string, functionName string) FunctionId { return FunctionId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - JobName: jobName, + StreamingJobName: streamingJobName, FunctionName: functionName, } } @@ -46,8 +46,8 @@ func ParseFunctionID(input string) (*FunctionId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { @@ -77,8 +77,8 @@ func ParseFunctionIDInsensitively(input string) (*FunctionId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { @@ -106,7 +106,7 @@ func ValidateFunctionID(input interface{}, key string) (warnings []string, error // ID returns the formatted Function ID func (id FunctionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.StreamAnalytics/streamingJobs/%s/functions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.JobName, id.FunctionName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StreamingJobName, id.FunctionName) } // Segments returns a slice of Resource ID Segments which comprise this Function ID @@ -119,7 +119,7 @@ func (id FunctionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStreamAnalytics", "Microsoft.StreamAnalytics", "Microsoft.StreamAnalytics"), resourceids.StaticSegment("staticStreamingJobs", "streamingJobs", "streamingJobs"), - resourceids.UserSpecifiedSegment("jobName", "jobValue"), + resourceids.UserSpecifiedSegment("streamingJobName", "streamingJobValue"), resourceids.StaticSegment("staticFunctions", "functions", "functions"), resourceids.UserSpecifiedSegment("functionName", "functionValue"), } @@ -130,7 +130,7 @@ func (id FunctionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Job Name: %q", id.JobName), + fmt.Sprintf("Streaming Job Name: %q", id.StreamingJobName), fmt.Sprintf("Function Name: %q", id.FunctionName), } return fmt.Sprintf("Function (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/functions/id_streamingjob.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/functions/id_streamingjob.go index fa26324129b1..2a2684e5b786 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/functions/id_streamingjob.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/functions/id_streamingjob.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = StreamingJobId{} type StreamingJobId struct { SubscriptionId string ResourceGroupName string - JobName string + StreamingJobName string } // NewStreamingJobID returns a new StreamingJobId struct -func NewStreamingJobID(subscriptionId string, resourceGroupName string, jobName string) StreamingJobId { +func NewStreamingJobID(subscriptionId string, resourceGroupName string, streamingJobName string) StreamingJobId { return StreamingJobId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - JobName: jobName, + StreamingJobName: streamingJobName, } } @@ -44,8 +44,8 @@ func ParseStreamingJobID(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStreamingJobIDInsensitively(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStreamingJobID(input interface{}, key string) (warnings []string, e // ID returns the formatted Streaming Job ID func (id StreamingJobId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.StreamAnalytics/streamingJobs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.JobName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StreamingJobName) } // Segments returns a slice of Resource ID Segments which comprise this Streaming Job ID @@ -109,7 +109,7 @@ func (id StreamingJobId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStreamAnalytics", "Microsoft.StreamAnalytics", "Microsoft.StreamAnalytics"), resourceids.StaticSegment("staticStreamingJobs", "streamingJobs", "streamingJobs"), - resourceids.UserSpecifiedSegment("jobName", "jobValue"), + resourceids.UserSpecifiedSegment("streamingJobName", "streamingJobValue"), } } @@ -118,7 +118,7 @@ func (id StreamingJobId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Job Name: %q", id.JobName), + fmt.Sprintf("Streaming Job Name: %q", id.StreamingJobName), } return fmt.Sprintf("Streaming Job (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/inputs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/inputs/README.md index 0fa04f027e9d..2e3a97aca698 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/inputs/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/inputs/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := inputs.NewInputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "inputValue") +id := inputs.NewInputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "inputValue") payload := inputs.Input{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := inputs.NewInputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "inputValue") +id := inputs.NewInputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "inputValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := inputs.NewInputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "inputValue") +id := inputs.NewInputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "inputValue") read, err := client.Get(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := inputs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue") +id := inputs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue") // alternatively `client.ListByStreamingJob(ctx, id, inputs.DefaultListByStreamingJobOperationOptions())` can be used to do batched pagination items, err := client.ListByStreamingJobComplete(ctx, id, inputs.DefaultListByStreamingJobOperationOptions()) @@ -94,7 +94,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := inputs.NewInputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "inputValue") +id := inputs.NewInputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "inputValue") payload := inputs.Input{ // ... @@ -111,7 +111,7 @@ if err := client.TestThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := inputs.NewInputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "inputValue") +id := inputs.NewInputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "inputValue") payload := inputs.Input{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/inputs/id_input.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/inputs/id_input.go index fef184ab6cd9..45d52231922a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/inputs/id_input.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/inputs/id_input.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = InputId{} type InputId struct { SubscriptionId string ResourceGroupName string - JobName string + StreamingJobName string InputName string } // NewInputID returns a new InputId struct -func NewInputID(subscriptionId string, resourceGroupName string, jobName string, inputName string) InputId { +func NewInputID(subscriptionId string, resourceGroupName string, streamingJobName string, inputName string) InputId { return InputId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - JobName: jobName, + StreamingJobName: streamingJobName, InputName: inputName, } } @@ -46,8 +46,8 @@ func ParseInputID(input string) (*InputId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } if id.InputName, ok = parsed.Parsed["inputName"]; !ok { @@ -77,8 +77,8 @@ func ParseInputIDInsensitively(input string) (*InputId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } if id.InputName, ok = parsed.Parsed["inputName"]; !ok { @@ -106,7 +106,7 @@ func ValidateInputID(input interface{}, key string) (warnings []string, errors [ // ID returns the formatted Input ID func (id InputId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.StreamAnalytics/streamingJobs/%s/inputs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.JobName, id.InputName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StreamingJobName, id.InputName) } // Segments returns a slice of Resource ID Segments which comprise this Input ID @@ -119,7 +119,7 @@ func (id InputId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStreamAnalytics", "Microsoft.StreamAnalytics", "Microsoft.StreamAnalytics"), resourceids.StaticSegment("staticStreamingJobs", "streamingJobs", "streamingJobs"), - resourceids.UserSpecifiedSegment("jobName", "jobValue"), + resourceids.UserSpecifiedSegment("streamingJobName", "streamingJobValue"), resourceids.StaticSegment("staticInputs", "inputs", "inputs"), resourceids.UserSpecifiedSegment("inputName", "inputValue"), } @@ -130,7 +130,7 @@ func (id InputId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Job Name: %q", id.JobName), + fmt.Sprintf("Streaming Job Name: %q", id.StreamingJobName), fmt.Sprintf("Input Name: %q", id.InputName), } return fmt.Sprintf("Input (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/inputs/id_streamingjob.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/inputs/id_streamingjob.go index 0d727b6a32fb..ec78158644a8 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/inputs/id_streamingjob.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/inputs/id_streamingjob.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = StreamingJobId{} type StreamingJobId struct { SubscriptionId string ResourceGroupName string - JobName string + StreamingJobName string } // NewStreamingJobID returns a new StreamingJobId struct -func NewStreamingJobID(subscriptionId string, resourceGroupName string, jobName string) StreamingJobId { +func NewStreamingJobID(subscriptionId string, resourceGroupName string, streamingJobName string) StreamingJobId { return StreamingJobId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - JobName: jobName, + StreamingJobName: streamingJobName, } } @@ -44,8 +44,8 @@ func ParseStreamingJobID(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStreamingJobIDInsensitively(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStreamingJobID(input interface{}, key string) (warnings []string, e // ID returns the formatted Streaming Job ID func (id StreamingJobId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.StreamAnalytics/streamingJobs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.JobName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StreamingJobName) } // Segments returns a slice of Resource ID Segments which comprise this Streaming Job ID @@ -109,7 +109,7 @@ func (id StreamingJobId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStreamAnalytics", "Microsoft.StreamAnalytics", "Microsoft.StreamAnalytics"), resourceids.StaticSegment("staticStreamingJobs", "streamingJobs", "streamingJobs"), - resourceids.UserSpecifiedSegment("jobName", "jobValue"), + resourceids.UserSpecifiedSegment("streamingJobName", "streamingJobValue"), } } @@ -118,7 +118,7 @@ func (id StreamingJobId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Job Name: %q", id.JobName), + fmt.Sprintf("Streaming Job Name: %q", id.StreamingJobName), } return fmt.Sprintf("Streaming Job (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/README.md deleted file mode 100644 index 4d6725ffc018..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/README.md +++ /dev/null @@ -1,128 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs` Documentation - -The `outputs` SDK allows for interaction with the Azure Resource Manager Service `streamanalytics` (API Version `2020-03-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs" -``` - - -### Client Initialization - -```go -client := outputs.NewOutputsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `OutputsClient.CreateOrReplace` - -```go -ctx := context.TODO() -id := outputs.NewOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "outputValue") - -payload := outputs.Output{ - // ... -} - - -read, err := client.CreateOrReplace(ctx, id, payload, outputs.DefaultCreateOrReplaceOperationOptions()) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `OutputsClient.Delete` - -```go -ctx := context.TODO() -id := outputs.NewOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "outputValue") - -read, err := client.Delete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `OutputsClient.Get` - -```go -ctx := context.TODO() -id := outputs.NewOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "outputValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `OutputsClient.ListByStreamingJob` - -```go -ctx := context.TODO() -id := outputs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue") - -// alternatively `client.ListByStreamingJob(ctx, id, outputs.DefaultListByStreamingJobOperationOptions())` can be used to do batched pagination -items, err := client.ListByStreamingJobComplete(ctx, id, outputs.DefaultListByStreamingJobOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `OutputsClient.Test` - -```go -ctx := context.TODO() -id := outputs.NewOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "outputValue") - -payload := outputs.Output{ - // ... -} - - -if err := client.TestThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `OutputsClient.Update` - -```go -ctx := context.TODO() -id := outputs.NewOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "outputValue") - -payload := outputs.Output{ - // ... -} - - -read, err := client.Update(ctx, id, payload, outputs.DefaultUpdateOperationOptions()) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/constants.go deleted file mode 100644 index d4d4105abc63..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/constants.go +++ /dev/null @@ -1,124 +0,0 @@ -package outputs - -import "strings" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AuthenticationMode string - -const ( - AuthenticationModeConnectionString AuthenticationMode = "ConnectionString" - AuthenticationModeMsi AuthenticationMode = "Msi" - AuthenticationModeUserToken AuthenticationMode = "UserToken" -) - -func PossibleValuesForAuthenticationMode() []string { - return []string{ - string(AuthenticationModeConnectionString), - string(AuthenticationModeMsi), - string(AuthenticationModeUserToken), - } -} - -func parseAuthenticationMode(input string) (*AuthenticationMode, error) { - vals := map[string]AuthenticationMode{ - "connectionstring": AuthenticationModeConnectionString, - "msi": AuthenticationModeMsi, - "usertoken": AuthenticationModeUserToken, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AuthenticationMode(input) - return &out, nil -} - -type Encoding string - -const ( - EncodingUTFEight Encoding = "UTF8" -) - -func PossibleValuesForEncoding() []string { - return []string{ - string(EncodingUTFEight), - } -} - -func parseEncoding(input string) (*Encoding, error) { - vals := map[string]Encoding{ - "utf8": EncodingUTFEight, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Encoding(input) - return &out, nil -} - -type EventSerializationType string - -const ( - EventSerializationTypeAvro EventSerializationType = "Avro" - EventSerializationTypeCsv EventSerializationType = "Csv" - EventSerializationTypeJson EventSerializationType = "Json" - EventSerializationTypeParquet EventSerializationType = "Parquet" -) - -func PossibleValuesForEventSerializationType() []string { - return []string{ - string(EventSerializationTypeAvro), - string(EventSerializationTypeCsv), - string(EventSerializationTypeJson), - string(EventSerializationTypeParquet), - } -} - -func parseEventSerializationType(input string) (*EventSerializationType, error) { - vals := map[string]EventSerializationType{ - "avro": EventSerializationTypeAvro, - "csv": EventSerializationTypeCsv, - "json": EventSerializationTypeJson, - "parquet": EventSerializationTypeParquet, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EventSerializationType(input) - return &out, nil -} - -type JsonOutputSerializationFormat string - -const ( - JsonOutputSerializationFormatArray JsonOutputSerializationFormat = "Array" - JsonOutputSerializationFormatLineSeparated JsonOutputSerializationFormat = "LineSeparated" -) - -func PossibleValuesForJsonOutputSerializationFormat() []string { - return []string{ - string(JsonOutputSerializationFormatArray), - string(JsonOutputSerializationFormatLineSeparated), - } -} - -func parseJsonOutputSerializationFormat(input string) (*JsonOutputSerializationFormat, error) { - vals := map[string]JsonOutputSerializationFormat{ - "array": JsonOutputSerializationFormatArray, - "lineseparated": JsonOutputSerializationFormatLineSeparated, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := JsonOutputSerializationFormat(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuresynapsedatasourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuresynapsedatasourceproperties.go deleted file mode 100644 index 2a1d340c529f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuresynapsedatasourceproperties.go +++ /dev/null @@ -1,12 +0,0 @@ -package outputs - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AzureSynapseDataSourceProperties struct { - Database *string `json:"database,omitempty"` - Password *string `json:"password,omitempty"` - Server *string `json:"server,omitempty"` - Table *string `json:"table,omitempty"` - User *string `json:"user,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_documentdboutputdatasourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_documentdboutputdatasourceproperties.go deleted file mode 100644 index 67b3ee033e80..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_documentdboutputdatasourceproperties.go +++ /dev/null @@ -1,13 +0,0 @@ -package outputs - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DocumentDbOutputDataSourceProperties struct { - AccountId *string `json:"accountId,omitempty"` - AccountKey *string `json:"accountKey,omitempty"` - CollectionNamePattern *string `json:"collectionNamePattern,omitempty"` - Database *string `json:"database,omitempty"` - DocumentId *string `json:"documentId,omitempty"` - PartitionKey *string `json:"partitionKey,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_outputproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_outputproperties.go deleted file mode 100644 index 90ef2eaa6fab..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_outputproperties.go +++ /dev/null @@ -1,55 +0,0 @@ -package outputs - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type OutputProperties struct { - Datasource OutputDataSource `json:"datasource"` - Diagnostics *Diagnostics `json:"diagnostics,omitempty"` - Etag *string `json:"etag,omitempty"` - Serialization Serialization `json:"serialization"` - SizeWindow *int64 `json:"sizeWindow,omitempty"` - TimeWindow *string `json:"timeWindow,omitempty"` -} - -var _ json.Unmarshaler = &OutputProperties{} - -func (s *OutputProperties) UnmarshalJSON(bytes []byte) error { - type alias OutputProperties - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into OutputProperties: %+v", err) - } - - s.Diagnostics = decoded.Diagnostics - s.Etag = decoded.Etag - s.SizeWindow = decoded.SizeWindow - s.TimeWindow = decoded.TimeWindow - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling OutputProperties into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["datasource"]; ok { - impl, err := unmarshalOutputDataSourceImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'Datasource' for 'OutputProperties': %+v", err) - } - s.Datasource = impl - } - - if v, ok := temp["serialization"]; ok { - impl, err := unmarshalSerializationImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'Serialization' for 'OutputProperties': %+v", err) - } - s.Serialization = impl - } - return nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_storageaccount.go deleted file mode 100644 index b6a549b163fe..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_storageaccount.go +++ /dev/null @@ -1,9 +0,0 @@ -package outputs - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StorageAccount struct { - AccountKey *string `json:"accountKey,omitempty"` - AccountName *string `json:"accountName,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/version.go deleted file mode 100644 index aab5a67daef9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package outputs - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2020-03-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/outputs/%s", defaultApiVersion) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/streamingjobs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/streamingjobs/README.md index f6b4179ad042..285b5bd6932b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/streamingjobs/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/streamingjobs/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := streamingjobs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue") +id := streamingjobs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue") payload := streamingjobs.StreamingJob{ // ... @@ -41,7 +41,7 @@ if err := client.CreateOrReplaceThenPoll(ctx, id, payload, streamingjobs.Default ```go ctx := context.TODO() -id := streamingjobs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue") +id := streamingjobs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := streamingjobs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue") +id := streamingjobs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue") read, err := client.Get(ctx, id, streamingjobs.DefaultGetOperationOptions()) if err != nil { @@ -103,7 +103,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := streamingjobs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue") +id := streamingjobs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue") payload := streamingjobs.ScaleStreamingJobParameters{ // ... @@ -120,7 +120,7 @@ if err := client.ScaleThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := streamingjobs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue") +id := streamingjobs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue") payload := streamingjobs.StartStreamingJobParameters{ // ... @@ -137,7 +137,7 @@ if err := client.StartThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := streamingjobs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue") +id := streamingjobs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue") if err := client.StopThenPoll(ctx, id); err != nil { // handle the error @@ -149,7 +149,7 @@ if err := client.StopThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := streamingjobs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue") +id := streamingjobs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue") payload := streamingjobs.StreamingJob{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/streamingjobs/id_streamingjob.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/streamingjobs/id_streamingjob.go index 49d9cdc05869..79c6e647d55c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/streamingjobs/id_streamingjob.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/streamingjobs/id_streamingjob.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = StreamingJobId{} type StreamingJobId struct { SubscriptionId string ResourceGroupName string - JobName string + StreamingJobName string } // NewStreamingJobID returns a new StreamingJobId struct -func NewStreamingJobID(subscriptionId string, resourceGroupName string, jobName string) StreamingJobId { +func NewStreamingJobID(subscriptionId string, resourceGroupName string, streamingJobName string) StreamingJobId { return StreamingJobId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - JobName: jobName, + StreamingJobName: streamingJobName, } } @@ -44,8 +44,8 @@ func ParseStreamingJobID(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStreamingJobIDInsensitively(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStreamingJobID(input interface{}, key string) (warnings []string, e // ID returns the formatted Streaming Job ID func (id StreamingJobId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.StreamAnalytics/streamingJobs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.JobName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StreamingJobName) } // Segments returns a slice of Resource ID Segments which comprise this Streaming Job ID @@ -109,7 +109,7 @@ func (id StreamingJobId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStreamAnalytics", "Microsoft.StreamAnalytics", "Microsoft.StreamAnalytics"), resourceids.StaticSegment("staticStreamingJobs", "streamingJobs", "streamingJobs"), - resourceids.UserSpecifiedSegment("jobName", "jobValue"), + resourceids.UserSpecifiedSegment("streamingJobName", "streamingJobValue"), } } @@ -118,7 +118,7 @@ func (id StreamingJobId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Job Name: %q", id.JobName), + fmt.Sprintf("Streaming Job Name: %q", id.StreamingJobName), } return fmt.Sprintf("Streaming Job (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/transformations/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/transformations/README.md index 0e01725a5f72..9b58d4bb98e8 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/transformations/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/transformations/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := transformations.NewTransformationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "transformationValue") +id := transformations.NewTransformationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "transformationValue") payload := transformations.Transformation{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := transformations.NewTransformationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "transformationValue") +id := transformations.NewTransformationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "transformationValue") read, err := client.Get(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := transformations.NewTransformationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "jobValue", "transformationValue") +id := transformations.NewTransformationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "transformationValue") payload := transformations.Transformation{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/transformations/id_transformation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/transformations/id_transformation.go index 19fe470b4f8e..e21b60771c7f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/transformations/id_transformation.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/transformations/id_transformation.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = TransformationId{} type TransformationId struct { SubscriptionId string ResourceGroupName string - JobName string + StreamingJobName string TransformationName string } // NewTransformationID returns a new TransformationId struct -func NewTransformationID(subscriptionId string, resourceGroupName string, jobName string, transformationName string) TransformationId { +func NewTransformationID(subscriptionId string, resourceGroupName string, streamingJobName string, transformationName string) TransformationId { return TransformationId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - JobName: jobName, + StreamingJobName: streamingJobName, TransformationName: transformationName, } } @@ -46,8 +46,8 @@ func ParseTransformationID(input string) (*TransformationId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } if id.TransformationName, ok = parsed.Parsed["transformationName"]; !ok { @@ -77,8 +77,8 @@ func ParseTransformationIDInsensitively(input string) (*TransformationId, error) return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } if id.TransformationName, ok = parsed.Parsed["transformationName"]; !ok { @@ -106,7 +106,7 @@ func ValidateTransformationID(input interface{}, key string) (warnings []string, // ID returns the formatted Transformation ID func (id TransformationId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.StreamAnalytics/streamingJobs/%s/transformations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.JobName, id.TransformationName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StreamingJobName, id.TransformationName) } // Segments returns a slice of Resource ID Segments which comprise this Transformation ID @@ -119,7 +119,7 @@ func (id TransformationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStreamAnalytics", "Microsoft.StreamAnalytics", "Microsoft.StreamAnalytics"), resourceids.StaticSegment("staticStreamingJobs", "streamingJobs", "streamingJobs"), - resourceids.UserSpecifiedSegment("jobName", "jobValue"), + resourceids.UserSpecifiedSegment("streamingJobName", "streamingJobValue"), resourceids.StaticSegment("staticTransformations", "transformations", "transformations"), resourceids.UserSpecifiedSegment("transformationName", "transformationValue"), } @@ -130,7 +130,7 @@ func (id TransformationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Job Name: %q", id.JobName), + fmt.Sprintf("Streaming Job Name: %q", id.StreamingJobName), fmt.Sprintf("Transformation Name: %q", id.TransformationName), } return fmt.Sprintf("Transformation (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/README.md new file mode 100644 index 000000000000..884128cf55ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs` Documentation + +The `outputs` SDK allows for interaction with the Azure Resource Manager Service `streamanalytics` (API Version `2021-10-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs" +``` + + +### Client Initialization + +```go +client := outputs.NewOutputsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `OutputsClient.CreateOrReplace` + +```go +ctx := context.TODO() +id := outputs.NewOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "outputValue") + +payload := outputs.Output{ + // ... +} + + +read, err := client.CreateOrReplace(ctx, id, payload, outputs.DefaultCreateOrReplaceOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `OutputsClient.Delete` + +```go +ctx := context.TODO() +id := outputs.NewOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "outputValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `OutputsClient.Get` + +```go +ctx := context.TODO() +id := outputs.NewOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "outputValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `OutputsClient.ListByStreamingJob` + +```go +ctx := context.TODO() +id := outputs.NewStreamingJobID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue") + +// alternatively `client.ListByStreamingJob(ctx, id, outputs.DefaultListByStreamingJobOperationOptions())` can be used to do batched pagination +items, err := client.ListByStreamingJobComplete(ctx, id, outputs.DefaultListByStreamingJobOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `OutputsClient.Test` + +```go +ctx := context.TODO() +id := outputs.NewOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "outputValue") + +payload := outputs.Output{ + // ... +} + + +if err := client.TestThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `OutputsClient.Update` + +```go +ctx := context.TODO() +id := outputs.NewOutputID("12345678-1234-9876-4563-123456789012", "example-resource-group", "streamingJobValue", "outputValue") + +payload := outputs.Output{ + // ... +} + + +read, err := client.Update(ctx, id, payload, outputs.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/constants.go new file mode 100644 index 000000000000..dea58756f7cf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/constants.go @@ -0,0 +1,189 @@ +package outputs + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthenticationMode string + +const ( + AuthenticationModeConnectionString AuthenticationMode = "ConnectionString" + AuthenticationModeMsi AuthenticationMode = "Msi" + AuthenticationModeUserToken AuthenticationMode = "UserToken" +) + +func PossibleValuesForAuthenticationMode() []string { + return []string{ + string(AuthenticationModeConnectionString), + string(AuthenticationModeMsi), + string(AuthenticationModeUserToken), + } +} + +func parseAuthenticationMode(input string) (*AuthenticationMode, error) { + vals := map[string]AuthenticationMode{ + "connectionstring": AuthenticationModeConnectionString, + "msi": AuthenticationModeMsi, + "usertoken": AuthenticationModeUserToken, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AuthenticationMode(input) + return &out, nil +} + +type BlobWriteMode string + +const ( + BlobWriteModeAppend BlobWriteMode = "Append" + BlobWriteModeOnce BlobWriteMode = "Once" +) + +func PossibleValuesForBlobWriteMode() []string { + return []string{ + string(BlobWriteModeAppend), + string(BlobWriteModeOnce), + } +} + +func parseBlobWriteMode(input string) (*BlobWriteMode, error) { + vals := map[string]BlobWriteMode{ + "append": BlobWriteModeAppend, + "once": BlobWriteModeOnce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BlobWriteMode(input) + return &out, nil +} + +type Encoding string + +const ( + EncodingUTFEight Encoding = "UTF8" +) + +func PossibleValuesForEncoding() []string { + return []string{ + string(EncodingUTFEight), + } +} + +func parseEncoding(input string) (*Encoding, error) { + vals := map[string]Encoding{ + "utf8": EncodingUTFEight, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Encoding(input) + return &out, nil +} + +type EventSerializationType string + +const ( + EventSerializationTypeAvro EventSerializationType = "Avro" + EventSerializationTypeCsv EventSerializationType = "Csv" + EventSerializationTypeCustomClr EventSerializationType = "CustomClr" + EventSerializationTypeDelta EventSerializationType = "Delta" + EventSerializationTypeJson EventSerializationType = "Json" + EventSerializationTypeParquet EventSerializationType = "Parquet" +) + +func PossibleValuesForEventSerializationType() []string { + return []string{ + string(EventSerializationTypeAvro), + string(EventSerializationTypeCsv), + string(EventSerializationTypeCustomClr), + string(EventSerializationTypeDelta), + string(EventSerializationTypeJson), + string(EventSerializationTypeParquet), + } +} + +func parseEventSerializationType(input string) (*EventSerializationType, error) { + vals := map[string]EventSerializationType{ + "avro": EventSerializationTypeAvro, + "csv": EventSerializationTypeCsv, + "customclr": EventSerializationTypeCustomClr, + "delta": EventSerializationTypeDelta, + "json": EventSerializationTypeJson, + "parquet": EventSerializationTypeParquet, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EventSerializationType(input) + return &out, nil +} + +type JsonOutputSerializationFormat string + +const ( + JsonOutputSerializationFormatArray JsonOutputSerializationFormat = "Array" + JsonOutputSerializationFormatLineSeparated JsonOutputSerializationFormat = "LineSeparated" +) + +func PossibleValuesForJsonOutputSerializationFormat() []string { + return []string{ + string(JsonOutputSerializationFormatArray), + string(JsonOutputSerializationFormatLineSeparated), + } +} + +func parseJsonOutputSerializationFormat(input string) (*JsonOutputSerializationFormat, error) { + vals := map[string]JsonOutputSerializationFormat{ + "array": JsonOutputSerializationFormatArray, + "lineseparated": JsonOutputSerializationFormatLineSeparated, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := JsonOutputSerializationFormat(input) + return &out, nil +} + +type OutputWatermarkMode string + +const ( + OutputWatermarkModeNone OutputWatermarkMode = "None" + OutputWatermarkModeSendCurrentPartitionWatermark OutputWatermarkMode = "SendCurrentPartitionWatermark" + OutputWatermarkModeSendLowestWatermarkAcrossPartitions OutputWatermarkMode = "SendLowestWatermarkAcrossPartitions" +) + +func PossibleValuesForOutputWatermarkMode() []string { + return []string{ + string(OutputWatermarkModeNone), + string(OutputWatermarkModeSendCurrentPartitionWatermark), + string(OutputWatermarkModeSendLowestWatermarkAcrossPartitions), + } +} + +func parseOutputWatermarkMode(input string) (*OutputWatermarkMode, error) { + vals := map[string]OutputWatermarkMode{ + "none": OutputWatermarkModeNone, + "sendcurrentpartitionwatermark": OutputWatermarkModeSendCurrentPartitionWatermark, + "sendlowestwatermarkacrosspartitions": OutputWatermarkModeSendLowestWatermarkAcrossPartitions, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OutputWatermarkMode(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/id_output.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/id_output.go similarity index 86% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/id_output.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/id_output.go index 09dcca0920f9..735f1b5bdb87 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/id_output.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/id_output.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = OutputId{} type OutputId struct { SubscriptionId string ResourceGroupName string - JobName string + StreamingJobName string OutputName string } // NewOutputID returns a new OutputId struct -func NewOutputID(subscriptionId string, resourceGroupName string, jobName string, outputName string) OutputId { +func NewOutputID(subscriptionId string, resourceGroupName string, streamingJobName string, outputName string) OutputId { return OutputId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - JobName: jobName, + StreamingJobName: streamingJobName, OutputName: outputName, } } @@ -46,8 +46,8 @@ func ParseOutputID(input string) (*OutputId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } if id.OutputName, ok = parsed.Parsed["outputName"]; !ok { @@ -77,8 +77,8 @@ func ParseOutputIDInsensitively(input string) (*OutputId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } if id.OutputName, ok = parsed.Parsed["outputName"]; !ok { @@ -106,7 +106,7 @@ func ValidateOutputID(input interface{}, key string) (warnings []string, errors // ID returns the formatted Output ID func (id OutputId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.StreamAnalytics/streamingJobs/%s/outputs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.JobName, id.OutputName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StreamingJobName, id.OutputName) } // Segments returns a slice of Resource ID Segments which comprise this Output ID @@ -119,7 +119,7 @@ func (id OutputId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStreamAnalytics", "Microsoft.StreamAnalytics", "Microsoft.StreamAnalytics"), resourceids.StaticSegment("staticStreamingJobs", "streamingJobs", "streamingJobs"), - resourceids.UserSpecifiedSegment("jobName", "jobValue"), + resourceids.UserSpecifiedSegment("streamingJobName", "streamingJobValue"), resourceids.StaticSegment("staticOutputs", "outputs", "outputs"), resourceids.UserSpecifiedSegment("outputName", "outputValue"), } @@ -130,7 +130,7 @@ func (id OutputId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Job Name: %q", id.JobName), + fmt.Sprintf("Streaming Job Name: %q", id.StreamingJobName), fmt.Sprintf("Output Name: %q", id.OutputName), } return fmt.Sprintf("Output (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/id_streamingjob.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/id_streamingjob.go similarity index 86% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/id_streamingjob.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/id_streamingjob.go index 99698a809e45..45a171fac92a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/id_streamingjob.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/id_streamingjob.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = StreamingJobId{} type StreamingJobId struct { SubscriptionId string ResourceGroupName string - JobName string + StreamingJobName string } // NewStreamingJobID returns a new StreamingJobId struct -func NewStreamingJobID(subscriptionId string, resourceGroupName string, jobName string) StreamingJobId { +func NewStreamingJobID(subscriptionId string, resourceGroupName string, streamingJobName string) StreamingJobId { return StreamingJobId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - JobName: jobName, + StreamingJobName: streamingJobName, } } @@ -44,8 +44,8 @@ func ParseStreamingJobID(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseStreamingJobIDInsensitively(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input) + if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { + return nil, fmt.Errorf("the segment 'streamingJobName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateStreamingJobID(input interface{}, key string) (warnings []string, e // ID returns the formatted Streaming Job ID func (id StreamingJobId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.StreamAnalytics/streamingJobs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.JobName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.StreamingJobName) } // Segments returns a slice of Resource ID Segments which comprise this Streaming Job ID @@ -109,7 +109,7 @@ func (id StreamingJobId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftStreamAnalytics", "Microsoft.StreamAnalytics", "Microsoft.StreamAnalytics"), resourceids.StaticSegment("staticStreamingJobs", "streamingJobs", "streamingJobs"), - resourceids.UserSpecifiedSegment("jobName", "jobValue"), + resourceids.UserSpecifiedSegment("streamingJobName", "streamingJobValue"), } } @@ -118,7 +118,7 @@ func (id StreamingJobId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Job Name: %q", id.JobName), + fmt.Sprintf("Streaming Job Name: %q", id.StreamingJobName), } return fmt.Sprintf("Streaming Job (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/method_createorreplace_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/method_createorreplace_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/method_createorreplace_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/method_createorreplace_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/method_delete_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/method_delete_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/method_delete_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/method_get_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/method_get_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/method_get_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/method_listbystreamingjob_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/method_listbystreamingjob_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/method_listbystreamingjob_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/method_listbystreamingjob_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/method_test_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/method_test_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/method_test_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/method_test_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/method_update_autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/method_update_autorest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/method_update_autorest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_avroserialization.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_avroserialization.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_avroserialization.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_avroserialization.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuredatalakestoreoutputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuredatalakestoreoutputdatasource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuredatalakestoreoutputdatasource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuredatalakestoreoutputdatasource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuredatalakestoreoutputdatasourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuredatalakestoreoutputdatasourceproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuredatalakestoreoutputdatasourceproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuredatalakestoreoutputdatasourceproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azurefunctionoutputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azurefunctionoutputdatasource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azurefunctionoutputdatasource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azurefunctionoutputdatasource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azurefunctionoutputdatasourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azurefunctionoutputdatasourceproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azurefunctionoutputdatasourceproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azurefunctionoutputdatasourceproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuresqldatabasedatasourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuresqldatabasedatasourceproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuresqldatabasedatasourceproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuresqldatabasedatasourceproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuresqldatabaseoutputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuresqldatabaseoutputdatasource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuresqldatabaseoutputdatasource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuresqldatabaseoutputdatasource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuresynapsedatasourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuresynapsedatasourceproperties.go new file mode 100644 index 000000000000..d5c08a3212ab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuresynapsedatasourceproperties.go @@ -0,0 +1,13 @@ +package outputs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureSynapseDataSourceProperties struct { + AuthenticationMode *AuthenticationMode `json:"authenticationMode,omitempty"` + Database *string `json:"database,omitempty"` + Password *string `json:"password,omitempty"` + Server *string `json:"server,omitempty"` + Table *string `json:"table,omitempty"` + User *string `json:"user,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuresynapseoutputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuresynapseoutputdatasource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuresynapseoutputdatasource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuresynapseoutputdatasource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuretableoutputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuretableoutputdatasource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuretableoutputdatasource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuretableoutputdatasource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuretableoutputdatasourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuretableoutputdatasourceproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_azuretableoutputdatasourceproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_azuretableoutputdatasourceproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_bloboutputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_bloboutputdatasource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_bloboutputdatasource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_bloboutputdatasource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_bloboutputdatasourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_bloboutputdatasourceproperties.go similarity index 90% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_bloboutputdatasourceproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_bloboutputdatasourceproperties.go index c1b92efb2385..e129d56dc28d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_bloboutputdatasourceproperties.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_bloboutputdatasourceproperties.go @@ -6,6 +6,7 @@ package outputs type BlobOutputDataSourceProperties struct { AuthenticationMode *AuthenticationMode `json:"authenticationMode,omitempty"` BlobPathPrefix *string `json:"blobPathPrefix,omitempty"` + BlobWriteMode *BlobWriteMode `json:"blobWriteMode,omitempty"` Container *string `json:"container,omitempty"` DateFormat *string `json:"dateFormat,omitempty"` PathPattern *string `json:"pathPattern,omitempty"` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_csvserialization.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_csvserialization.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_csvserialization.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_csvserialization.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_csvserializationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_csvserializationproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_csvserializationproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_csvserializationproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_customclrserialization.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_customclrserialization.go new file mode 100644 index 000000000000..99094f5ff002 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_customclrserialization.go @@ -0,0 +1,41 @@ +package outputs + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ Serialization = CustomClrSerialization{} + +type CustomClrSerialization struct { + Properties *CustomClrSerializationProperties `json:"properties,omitempty"` + + // Fields inherited from Serialization +} + +var _ json.Marshaler = CustomClrSerialization{} + +func (s CustomClrSerialization) MarshalJSON() ([]byte, error) { + type wrapper CustomClrSerialization + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling CustomClrSerialization: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling CustomClrSerialization: %+v", err) + } + decoded["type"] = "CustomClr" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling CustomClrSerialization: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_customclrserializationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_customclrserializationproperties.go new file mode 100644 index 000000000000..538a280b113b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_customclrserializationproperties.go @@ -0,0 +1,9 @@ +package outputs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomClrSerializationProperties struct { + SerializationClassName *string `json:"serializationClassName,omitempty"` + SerializationDllPath *string `json:"serializationDllPath,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_deltaserialization.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_deltaserialization.go new file mode 100644 index 000000000000..b28b6022b2af --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_deltaserialization.go @@ -0,0 +1,41 @@ +package outputs + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ Serialization = DeltaSerialization{} + +type DeltaSerialization struct { + Properties *DeltaSerializationProperties `json:"properties,omitempty"` + + // Fields inherited from Serialization +} + +var _ json.Marshaler = DeltaSerialization{} + +func (s DeltaSerialization) MarshalJSON() ([]byte, error) { + type wrapper DeltaSerialization + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DeltaSerialization: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DeltaSerialization: %+v", err) + } + decoded["type"] = "Delta" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DeltaSerialization: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_deltaserializationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_deltaserializationproperties.go new file mode 100644 index 000000000000..88271542f882 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_deltaserializationproperties.go @@ -0,0 +1,9 @@ +package outputs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeltaSerializationProperties struct { + DeltaTablePath string `json:"deltaTablePath"` + PartitionColumns *[]string `json:"partitionColumns,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_diagnosticcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_diagnosticcondition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_diagnosticcondition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_diagnosticcondition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_diagnostics.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_diagnostics.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_diagnostics.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_diagnostics.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_documentdboutputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_documentdboutputdatasource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_documentdboutputdatasource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_documentdboutputdatasource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_documentdboutputdatasourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_documentdboutputdatasourceproperties.go new file mode 100644 index 000000000000..de6d20bc1688 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_documentdboutputdatasourceproperties.go @@ -0,0 +1,14 @@ +package outputs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DocumentDbOutputDataSourceProperties struct { + AccountId *string `json:"accountId,omitempty"` + AccountKey *string `json:"accountKey,omitempty"` + AuthenticationMode *AuthenticationMode `json:"authenticationMode,omitempty"` + CollectionNamePattern *string `json:"collectionNamePattern,omitempty"` + Database *string `json:"database,omitempty"` + DocumentId *string `json:"documentId,omitempty"` + PartitionKey *string `json:"partitionKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_errorresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_errorresponse.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_errorresponse.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_errorresponse.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_eventhuboutputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_eventhuboutputdatasource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_eventhuboutputdatasource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_eventhuboutputdatasource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_eventhuboutputdatasourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_eventhuboutputdatasourceproperties.go similarity index 91% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_eventhuboutputdatasourceproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_eventhuboutputdatasourceproperties.go index 0e8342d7cd60..0dc8d0208531 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_eventhuboutputdatasourceproperties.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_eventhuboutputdatasourceproperties.go @@ -6,6 +6,7 @@ package outputs type EventHubOutputDataSourceProperties struct { AuthenticationMode *AuthenticationMode `json:"authenticationMode,omitempty"` EventHubName *string `json:"eventHubName,omitempty"` + PartitionCount *int64 `json:"partitionCount,omitempty"` PartitionKey *string `json:"partitionKey,omitempty"` PropertyColumns *[]string `json:"propertyColumns,omitempty"` ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_eventhubv2outputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_eventhubv2outputdatasource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_eventhubv2outputdatasource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_eventhubv2outputdatasource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_gatewaymessagebusoutputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_gatewaymessagebusoutputdatasource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_gatewaymessagebusoutputdatasource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_gatewaymessagebusoutputdatasource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_gatewaymessagebussourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_gatewaymessagebussourceproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_gatewaymessagebussourceproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_gatewaymessagebussourceproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_jsonserialization.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_jsonserialization.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_jsonserialization.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_jsonserialization.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_jsonserializationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_jsonserializationproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_jsonserializationproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_jsonserializationproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_lastoutputeventtimestamp.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_lastoutputeventtimestamp.go new file mode 100644 index 000000000000..2346a78e48c4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_lastoutputeventtimestamp.go @@ -0,0 +1,9 @@ +package outputs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LastOutputEventTimestamp struct { + LastOutputEventTime *string `json:"lastOutputEventTime,omitempty"` + LastUpdateTime *string `json:"lastUpdateTime,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_output.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_output.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_output.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_output.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_outputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_outputdatasource.go similarity index 89% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_outputdatasource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_outputdatasource.go index 4c43de2e458a..1cc019bcd24a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_outputdatasource.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_outputdatasource.go @@ -107,6 +107,14 @@ func unmarshalOutputDataSourceImplementation(input []byte) (OutputDataSource, er return out, nil } + if strings.EqualFold(value, "Microsoft.DBForPostgreSQL/servers/databases") { + var out PostgreSQLOutputDataSource + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into PostgreSQLOutputDataSource: %+v", err) + } + return out, nil + } + if strings.EqualFold(value, "PowerBI") { var out PowerBIOutputDataSource if err := json.Unmarshal(input, &out); err != nil { @@ -115,6 +123,14 @@ func unmarshalOutputDataSourceImplementation(input []byte) (OutputDataSource, er return out, nil } + if strings.EqualFold(value, "Raw") { + var out RawOutputDatasource + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into RawOutputDatasource: %+v", err) + } + return out, nil + } + if strings.EqualFold(value, "Microsoft.ServiceBus/Queue") { var out ServiceBusQueueOutputDataSource if err := json.Unmarshal(input, &out); err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_outputproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_outputproperties.go new file mode 100644 index 000000000000..b61db1605b39 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_outputproperties.go @@ -0,0 +1,59 @@ +package outputs + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OutputProperties struct { + Datasource OutputDataSource `json:"datasource"` + Diagnostics *Diagnostics `json:"diagnostics,omitempty"` + Etag *string `json:"etag,omitempty"` + LastOutputEventTimestamps *[]LastOutputEventTimestamp `json:"lastOutputEventTimestamps,omitempty"` + Serialization Serialization `json:"serialization"` + SizeWindow *int64 `json:"sizeWindow,omitempty"` + TimeWindow *string `json:"timeWindow,omitempty"` + WatermarkSettings *OutputWatermarkProperties `json:"watermarkSettings,omitempty"` +} + +var _ json.Unmarshaler = &OutputProperties{} + +func (s *OutputProperties) UnmarshalJSON(bytes []byte) error { + type alias OutputProperties + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into OutputProperties: %+v", err) + } + + s.Diagnostics = decoded.Diagnostics + s.Etag = decoded.Etag + s.LastOutputEventTimestamps = decoded.LastOutputEventTimestamps + s.SizeWindow = decoded.SizeWindow + s.TimeWindow = decoded.TimeWindow + s.WatermarkSettings = decoded.WatermarkSettings + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling OutputProperties into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["datasource"]; ok { + impl, err := unmarshalOutputDataSourceImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Datasource' for 'OutputProperties': %+v", err) + } + s.Datasource = impl + } + + if v, ok := temp["serialization"]; ok { + impl, err := unmarshalSerializationImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Serialization' for 'OutputProperties': %+v", err) + } + s.Serialization = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_outputwatermarkproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_outputwatermarkproperties.go new file mode 100644 index 000000000000..6e435e9bffe4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_outputwatermarkproperties.go @@ -0,0 +1,9 @@ +package outputs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OutputWatermarkProperties struct { + MaxWatermarkDifferenceAcrossPartitions *string `json:"maxWatermarkDifferenceAcrossPartitions,omitempty"` + WatermarkMode *OutputWatermarkMode `json:"watermarkMode,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_parquetserialization.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_parquetserialization.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_parquetserialization.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_parquetserialization.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_postgresqldatasourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_postgresqldatasourceproperties.go new file mode 100644 index 000000000000..53a98a754667 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_postgresqldatasourceproperties.go @@ -0,0 +1,14 @@ +package outputs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PostgreSQLDataSourceProperties struct { + AuthenticationMode *AuthenticationMode `json:"authenticationMode,omitempty"` + Database *string `json:"database,omitempty"` + MaxWriterCount *float64 `json:"maxWriterCount,omitempty"` + Password *string `json:"password,omitempty"` + Server *string `json:"server,omitempty"` + Table *string `json:"table,omitempty"` + User *string `json:"user,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_postgresqloutputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_postgresqloutputdatasource.go new file mode 100644 index 000000000000..476e5ed56a91 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_postgresqloutputdatasource.go @@ -0,0 +1,41 @@ +package outputs + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ OutputDataSource = PostgreSQLOutputDataSource{} + +type PostgreSQLOutputDataSource struct { + Properties *PostgreSQLDataSourceProperties `json:"properties,omitempty"` + + // Fields inherited from OutputDataSource +} + +var _ json.Marshaler = PostgreSQLOutputDataSource{} + +func (s PostgreSQLOutputDataSource) MarshalJSON() ([]byte, error) { + type wrapper PostgreSQLOutputDataSource + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling PostgreSQLOutputDataSource: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling PostgreSQLOutputDataSource: %+v", err) + } + decoded["type"] = "Microsoft.DBForPostgreSQL/servers/databases" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling PostgreSQLOutputDataSource: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_powerbioutputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_powerbioutputdatasource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_powerbioutputdatasource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_powerbioutputdatasource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_powerbioutputdatasourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_powerbioutputdatasourceproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_powerbioutputdatasourceproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_powerbioutputdatasourceproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_rawoutputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_rawoutputdatasource.go new file mode 100644 index 000000000000..dd59de6210cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_rawoutputdatasource.go @@ -0,0 +1,41 @@ +package outputs + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ OutputDataSource = RawOutputDatasource{} + +type RawOutputDatasource struct { + Properties *RawOutputDatasourceProperties `json:"properties,omitempty"` + + // Fields inherited from OutputDataSource +} + +var _ json.Marshaler = RawOutputDatasource{} + +func (s RawOutputDatasource) MarshalJSON() ([]byte, error) { + type wrapper RawOutputDatasource + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling RawOutputDatasource: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling RawOutputDatasource: %+v", err) + } + decoded["type"] = "Raw" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling RawOutputDatasource: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_rawoutputdatasourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_rawoutputdatasourceproperties.go new file mode 100644 index 000000000000..2e3c1bb1b883 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_rawoutputdatasourceproperties.go @@ -0,0 +1,8 @@ +package outputs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RawOutputDatasourceProperties struct { + PayloadUri *string `json:"payloadUri,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_resourceteststatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_resourceteststatus.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_resourceteststatus.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_resourceteststatus.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_serialization.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_serialization.go similarity index 78% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_serialization.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_serialization.go index 4c3a22bf0b30..56630325772f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_serialization.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_serialization.go @@ -43,6 +43,22 @@ func unmarshalSerializationImplementation(input []byte) (Serialization, error) { return out, nil } + if strings.EqualFold(value, "CustomClr") { + var out CustomClrSerialization + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into CustomClrSerialization: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Delta") { + var out DeltaSerialization + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DeltaSerialization: %+v", err) + } + return out, nil + } + if strings.EqualFold(value, "Json") { var out JsonSerialization if err := json.Unmarshal(input, &out); err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_servicebusqueueoutputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_servicebusqueueoutputdatasource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_servicebusqueueoutputdatasource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_servicebusqueueoutputdatasource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_servicebusqueueoutputdatasourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_servicebusqueueoutputdatasourceproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_servicebusqueueoutputdatasourceproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_servicebusqueueoutputdatasourceproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_servicebustopicoutputdatasource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_servicebustopicoutputdatasource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_servicebustopicoutputdatasource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_servicebustopicoutputdatasource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_servicebustopicoutputdatasourceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_servicebustopicoutputdatasourceproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/model_servicebustopicoutputdatasourceproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_servicebustopicoutputdatasourceproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_storageaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_storageaccount.go new file mode 100644 index 000000000000..fb2272b07da1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/model_storageaccount.go @@ -0,0 +1,10 @@ +package outputs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageAccount struct { + AccountKey *string `json:"accountKey,omitempty"` + AccountName *string `json:"accountName,omitempty"` + AuthenticationMode *AuthenticationMode `json:"authenticationMode,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/version.go new file mode 100644 index 000000000000..ea964723b8cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs/version.go @@ -0,0 +1,12 @@ +package outputs + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-10-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/outputs/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/README.md index c6a336922f82..0387d8e453d1 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := endpoints.NewEndpointTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue", "AzureEndpoints", "endpointValue") +id := endpoints.NewEndpointTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficManagerProfileValue", "AzureEndpoints", "endpointValue") payload := endpoints.Endpoint{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := endpoints.NewEndpointTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue", "AzureEndpoints", "endpointValue") +id := endpoints.NewEndpointTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficManagerProfileValue", "AzureEndpoints", "endpointValue") read, err := client.Delete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := endpoints.NewEndpointTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue", "AzureEndpoints", "endpointValue") +id := endpoints.NewEndpointTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficManagerProfileValue", "AzureEndpoints", "endpointValue") read, err := client.Get(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := endpoints.NewEndpointTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue", "AzureEndpoints", "endpointValue") +id := endpoints.NewEndpointTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficManagerProfileValue", "AzureEndpoints", "endpointValue") payload := endpoints.Endpoint{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/id_endpointtype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/id_endpointtype.go index d4c4f917d8ec..0c7dbe73ab7f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/id_endpointtype.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/id_endpointtype.go @@ -11,21 +11,21 @@ var _ resourceids.ResourceId = EndpointTypeId{} // EndpointTypeId is a struct representing the Resource ID for a Endpoint Type type EndpointTypeId struct { - SubscriptionId string - ResourceGroupName string - ProfileName string - EndpointType EndpointType - EndpointName string + SubscriptionId string + ResourceGroupName string + TrafficManagerProfileName string + EndpointType EndpointType + EndpointName string } // NewEndpointTypeID returns a new EndpointTypeId struct -func NewEndpointTypeID(subscriptionId string, resourceGroupName string, profileName string, endpointType EndpointType, endpointName string) EndpointTypeId { +func NewEndpointTypeID(subscriptionId string, resourceGroupName string, trafficManagerProfileName string, endpointType EndpointType, endpointName string) EndpointTypeId { return EndpointTypeId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ProfileName: profileName, - EndpointType: endpointType, - EndpointName: endpointName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + TrafficManagerProfileName: trafficManagerProfileName, + EndpointType: endpointType, + EndpointName: endpointName, } } @@ -48,8 +48,8 @@ func ParseEndpointTypeID(input string) (*EndpointTypeId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ProfileName, ok = parsed.Parsed["profileName"]; !ok { - return nil, fmt.Errorf("the segment 'profileName' was not found in the resource id %q", input) + if id.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { + return nil, fmt.Errorf("the segment 'trafficManagerProfileName' was not found in the resource id %q", input) } if v, ok := parsed.Parsed["endpointType"]; true { @@ -91,8 +91,8 @@ func ParseEndpointTypeIDInsensitively(input string) (*EndpointTypeId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ProfileName, ok = parsed.Parsed["profileName"]; !ok { - return nil, fmt.Errorf("the segment 'profileName' was not found in the resource id %q", input) + if id.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { + return nil, fmt.Errorf("the segment 'trafficManagerProfileName' was not found in the resource id %q", input) } if v, ok := parsed.Parsed["endpointType"]; true { @@ -132,7 +132,7 @@ func ValidateEndpointTypeID(input interface{}, key string) (warnings []string, e // ID returns the formatted Endpoint Type ID func (id EndpointTypeId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/trafficManagerProfiles/%s/%s/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProfileName, string(id.EndpointType), id.EndpointName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.TrafficManagerProfileName, string(id.EndpointType), id.EndpointName) } // Segments returns a slice of Resource ID Segments which comprise this Endpoint Type ID @@ -145,7 +145,7 @@ func (id EndpointTypeId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), resourceids.StaticSegment("staticTrafficManagerProfiles", "trafficManagerProfiles", "trafficManagerProfiles"), - resourceids.UserSpecifiedSegment("profileName", "profileValue"), + resourceids.UserSpecifiedSegment("trafficManagerProfileName", "trafficManagerProfileValue"), resourceids.ConstantSegment("endpointType", PossibleValuesForEndpointType(), "AzureEndpoints"), resourceids.UserSpecifiedSegment("endpointName", "endpointValue"), } @@ -156,7 +156,7 @@ func (id EndpointTypeId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Profile Name: %q", id.ProfileName), + fmt.Sprintf("Traffic Manager Profile Name: %q", id.TrafficManagerProfileName), fmt.Sprintf("Endpoint Type: %q", string(id.EndpointType)), fmt.Sprintf("Endpoint Name: %q", id.EndpointName), } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/README.md index e86d49e478c7..996b92b76f29 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/README.md @@ -44,7 +44,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := profiles.NewTrafficManagerProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue") +id := profiles.NewTrafficManagerProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficManagerProfileValue") payload := profiles.Profile{ // ... @@ -65,7 +65,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := profiles.NewTrafficManagerProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue") +id := profiles.NewTrafficManagerProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficManagerProfileValue") read, err := client.Delete(ctx, id) if err != nil { @@ -81,7 +81,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := profiles.NewTrafficManagerProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue") +id := profiles.NewTrafficManagerProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficManagerProfileValue") read, err := client.Get(ctx, id) if err != nil { @@ -129,7 +129,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := profiles.NewTrafficManagerProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue") +id := profiles.NewTrafficManagerProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficManagerProfileValue") payload := profiles.Profile{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/id_trafficmanagerprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/id_trafficmanagerprofile.go index 89a176db64cd..56be8586461f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/id_trafficmanagerprofile.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/id_trafficmanagerprofile.go @@ -11,17 +11,17 @@ var _ resourceids.ResourceId = TrafficManagerProfileId{} // TrafficManagerProfileId is a struct representing the Resource ID for a Traffic Manager Profile type TrafficManagerProfileId struct { - SubscriptionId string - ResourceGroupName string - ProfileName string + SubscriptionId string + ResourceGroupName string + TrafficManagerProfileName string } // NewTrafficManagerProfileID returns a new TrafficManagerProfileId struct -func NewTrafficManagerProfileID(subscriptionId string, resourceGroupName string, profileName string) TrafficManagerProfileId { +func NewTrafficManagerProfileID(subscriptionId string, resourceGroupName string, trafficManagerProfileName string) TrafficManagerProfileId { return TrafficManagerProfileId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ProfileName: profileName, + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + TrafficManagerProfileName: trafficManagerProfileName, } } @@ -44,8 +44,8 @@ func ParseTrafficManagerProfileID(input string) (*TrafficManagerProfileId, error return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ProfileName, ok = parsed.Parsed["profileName"]; !ok { - return nil, fmt.Errorf("the segment 'profileName' was not found in the resource id %q", input) + if id.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { + return nil, fmt.Errorf("the segment 'trafficManagerProfileName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseTrafficManagerProfileIDInsensitively(input string) (*TrafficManagerPro return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ProfileName, ok = parsed.Parsed["profileName"]; !ok { - return nil, fmt.Errorf("the segment 'profileName' was not found in the resource id %q", input) + if id.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { + return nil, fmt.Errorf("the segment 'trafficManagerProfileName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateTrafficManagerProfileID(input interface{}, key string) (warnings [] // ID returns the formatted Traffic Manager Profile ID func (id TrafficManagerProfileId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/trafficManagerProfiles/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProfileName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.TrafficManagerProfileName) } // Segments returns a slice of Resource ID Segments which comprise this Traffic Manager Profile ID @@ -109,7 +109,7 @@ func (id TrafficManagerProfileId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), resourceids.StaticSegment("staticTrafficManagerProfiles", "trafficManagerProfiles", "trafficManagerProfiles"), - resourceids.UserSpecifiedSegment("profileName", "profileValue"), + resourceids.UserSpecifiedSegment("trafficManagerProfileName", "trafficManagerProfileValue"), } } @@ -118,7 +118,7 @@ func (id TrafficManagerProfileId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Profile Name: %q", id.ProfileName), + fmt.Sprintf("Traffic Manager Profile Name: %q", id.TrafficManagerProfileName), } return fmt.Sprintf("Traffic Manager Profile (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/README.md index 8d9c12144a84..3be3cba6d333 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "edgeModuleValue") +id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerValue", "edgeModuleValue") payload := edgemodules.EdgeModuleEntity{ // ... @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "edgeModuleValue") +id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerValue", "edgeModuleValue") read, err := client.EdgeModulesDelete(ctx, id) if err != nil { @@ -61,7 +61,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "edgeModuleValue") +id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerValue", "edgeModuleValue") read, err := client.EdgeModulesGet(ctx, id) if err != nil { @@ -77,7 +77,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := edgemodules.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := edgemodules.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerValue") // alternatively `client.EdgeModulesList(ctx, id, edgemodules.DefaultEdgeModulesListOperationOptions())` can be used to do batched pagination items, err := client.EdgeModulesListComplete(ctx, id, edgemodules.DefaultEdgeModulesListOperationOptions()) @@ -94,7 +94,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "edgeModuleValue") +id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerValue", "edgeModuleValue") payload := edgemodules.ListProvisioningTokenInput{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule.go index 3b094b76bd62..4a8098657c45 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = EdgeModuleId{} type EdgeModuleId struct { SubscriptionId string ResourceGroupName string - AccountName string + VideoAnalyzerName string EdgeModuleName string } // NewEdgeModuleID returns a new EdgeModuleId struct -func NewEdgeModuleID(subscriptionId string, resourceGroupName string, accountName string, edgeModuleName string) EdgeModuleId { +func NewEdgeModuleID(subscriptionId string, resourceGroupName string, videoAnalyzerName string, edgeModuleName string) EdgeModuleId { return EdgeModuleId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + VideoAnalyzerName: videoAnalyzerName, EdgeModuleName: edgeModuleName, } } @@ -46,8 +46,8 @@ func ParseEdgeModuleID(input string) (*EdgeModuleId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { + return nil, fmt.Errorf("the segment 'videoAnalyzerName' was not found in the resource id %q", input) } if id.EdgeModuleName, ok = parsed.Parsed["edgeModuleName"]; !ok { @@ -77,8 +77,8 @@ func ParseEdgeModuleIDInsensitively(input string) (*EdgeModuleId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { + return nil, fmt.Errorf("the segment 'videoAnalyzerName' was not found in the resource id %q", input) } if id.EdgeModuleName, ok = parsed.Parsed["edgeModuleName"]; !ok { @@ -106,7 +106,7 @@ func ValidateEdgeModuleID(input interface{}, key string) (warnings []string, err // ID returns the formatted Edge Module ID func (id EdgeModuleId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s/edgeModules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.EdgeModuleName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VideoAnalyzerName, id.EdgeModuleName) } // Segments returns a slice of Resource ID Segments which comprise this Edge Module ID @@ -119,7 +119,7 @@ func (id EdgeModuleId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticVideoAnalyzers", "videoAnalyzers", "videoAnalyzers"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("videoAnalyzerName", "videoAnalyzerValue"), resourceids.StaticSegment("staticEdgeModules", "edgeModules", "edgeModules"), resourceids.UserSpecifiedSegment("edgeModuleName", "edgeModuleValue"), } @@ -130,7 +130,7 @@ func (id EdgeModuleId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Video Analyzer Name: %q", id.VideoAnalyzerName), fmt.Sprintf("Edge Module Name: %q", id.EdgeModuleName), } return fmt.Sprintf("Edge Module (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer.go index 191685e54799..3c22eb923c33 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = VideoAnalyzerId{} type VideoAnalyzerId struct { SubscriptionId string ResourceGroupName string - AccountName string + VideoAnalyzerName string } // NewVideoAnalyzerID returns a new VideoAnalyzerId struct -func NewVideoAnalyzerID(subscriptionId string, resourceGroupName string, accountName string) VideoAnalyzerId { +func NewVideoAnalyzerID(subscriptionId string, resourceGroupName string, videoAnalyzerName string) VideoAnalyzerId { return VideoAnalyzerId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + VideoAnalyzerName: videoAnalyzerName, } } @@ -44,8 +44,8 @@ func ParseVideoAnalyzerID(input string) (*VideoAnalyzerId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { + return nil, fmt.Errorf("the segment 'videoAnalyzerName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseVideoAnalyzerIDInsensitively(input string) (*VideoAnalyzerId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { + return nil, fmt.Errorf("the segment 'videoAnalyzerName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateVideoAnalyzerID(input interface{}, key string) (warnings []string, // ID returns the formatted Video Analyzer ID func (id VideoAnalyzerId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VideoAnalyzerName) } // Segments returns a slice of Resource ID Segments which comprise this Video Analyzer ID @@ -109,7 +109,7 @@ func (id VideoAnalyzerId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticVideoAnalyzers", "videoAnalyzers", "videoAnalyzers"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("videoAnalyzerName", "videoAnalyzerValue"), } } @@ -118,7 +118,7 @@ func (id VideoAnalyzerId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Video Analyzer Name: %q", id.VideoAnalyzerName), } return fmt.Sprintf("Video Analyzer (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/README.md index b460d0b5783f..5c1ae4d69b6c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/README.md @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerValue") payload := videoanalyzers.VideoAnalyzer{ // ... @@ -66,7 +66,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerValue") read, err := client.VideoAnalyzersDelete(ctx, id) if err != nil { @@ -82,7 +82,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerValue") read, err := client.VideoAnalyzersGet(ctx, id) if err != nil { @@ -130,7 +130,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerValue") payload := videoanalyzers.SyncStorageKeysInput{ // ... @@ -151,7 +151,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") +id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerValue") payload := videoanalyzers.VideoAnalyzerUpdate{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer.go index 9f86b938430e..a9109030ebaa 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = VideoAnalyzerId{} type VideoAnalyzerId struct { SubscriptionId string ResourceGroupName string - AccountName string + VideoAnalyzerName string } // NewVideoAnalyzerID returns a new VideoAnalyzerId struct -func NewVideoAnalyzerID(subscriptionId string, resourceGroupName string, accountName string) VideoAnalyzerId { +func NewVideoAnalyzerID(subscriptionId string, resourceGroupName string, videoAnalyzerName string) VideoAnalyzerId { return VideoAnalyzerId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - AccountName: accountName, + VideoAnalyzerName: videoAnalyzerName, } } @@ -44,8 +44,8 @@ func ParseVideoAnalyzerID(input string) (*VideoAnalyzerId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { + return nil, fmt.Errorf("the segment 'videoAnalyzerName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseVideoAnalyzerIDInsensitively(input string) (*VideoAnalyzerId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + if id.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { + return nil, fmt.Errorf("the segment 'videoAnalyzerName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateVideoAnalyzerID(input interface{}, key string) (warnings []string, // ID returns the formatted Video Analyzer ID func (id VideoAnalyzerId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VideoAnalyzerName) } // Segments returns a slice of Resource ID Segments which comprise this Video Analyzer ID @@ -109,7 +109,7 @@ func (id VideoAnalyzerId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), resourceids.StaticSegment("staticVideoAnalyzers", "videoAnalyzers", "videoAnalyzers"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.UserSpecifiedSegment("videoAnalyzerName", "videoAnalyzerValue"), } } @@ -118,7 +118,7 @@ func (id VideoAnalyzerId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Video Analyzer Name: %q", id.VideoAnalyzerName), } return fmt.Sprintf("Video Analyzer (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2021-12-01/datastores/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2021-12-01/datastores/README.md index e5392a2bf93f..1e5dca0c8aef 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2021-12-01/datastores/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2021-12-01/datastores/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := datastores.NewDataStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue", "clusterValue", "datastoreValue") +id := datastores.NewDataStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue", "clusterValue", "dataStoreValue") payload := datastores.Datastore{ // ... @@ -41,7 +41,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := datastores.NewDataStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue", "clusterValue", "datastoreValue") +id := datastores.NewDataStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue", "clusterValue", "dataStoreValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -53,7 +53,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := datastores.NewDataStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue", "clusterValue", "datastoreValue") +id := datastores.NewDataStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue", "clusterValue", "dataStoreValue") read, err := client.Get(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2021-12-01/datastores/id_datastore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2021-12-01/datastores/id_datastore.go index 7a4c57bec40a..6ccc8a38f8f5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2021-12-01/datastores/id_datastore.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2021-12-01/datastores/id_datastore.go @@ -15,17 +15,17 @@ type DataStoreId struct { ResourceGroupName string PrivateCloudName string ClusterName string - DatastoreName string + DataStoreName string } // NewDataStoreID returns a new DataStoreId struct -func NewDataStoreID(subscriptionId string, resourceGroupName string, privateCloudName string, clusterName string, datastoreName string) DataStoreId { +func NewDataStoreID(subscriptionId string, resourceGroupName string, privateCloudName string, clusterName string, dataStoreName string) DataStoreId { return DataStoreId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, PrivateCloudName: privateCloudName, ClusterName: clusterName, - DatastoreName: datastoreName, + DataStoreName: dataStoreName, } } @@ -56,8 +56,8 @@ func ParseDataStoreID(input string) (*DataStoreId, error) { return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) } - if id.DatastoreName, ok = parsed.Parsed["datastoreName"]; !ok { - return nil, fmt.Errorf("the segment 'datastoreName' was not found in the resource id %q", input) + if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { + return nil, fmt.Errorf("the segment 'dataStoreName' was not found in the resource id %q", input) } return &id, nil @@ -91,8 +91,8 @@ func ParseDataStoreIDInsensitively(input string) (*DataStoreId, error) { return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) } - if id.DatastoreName, ok = parsed.Parsed["datastoreName"]; !ok { - return nil, fmt.Errorf("the segment 'datastoreName' was not found in the resource id %q", input) + if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { + return nil, fmt.Errorf("the segment 'dataStoreName' was not found in the resource id %q", input) } return &id, nil @@ -116,7 +116,7 @@ func ValidateDataStoreID(input interface{}, key string) (warnings []string, erro // ID returns the formatted Data Store ID func (id DataStoreId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AVS/privateClouds/%s/clusters/%s/dataStores/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateCloudName, id.ClusterName, id.DatastoreName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateCloudName, id.ClusterName, id.DataStoreName) } // Segments returns a slice of Resource ID Segments which comprise this Data Store ID @@ -133,7 +133,7 @@ func (id DataStoreId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticClusters", "clusters", "clusters"), resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), resourceids.StaticSegment("staticDataStores", "dataStores", "dataStores"), - resourceids.UserSpecifiedSegment("datastoreName", "datastoreValue"), + resourceids.UserSpecifiedSegment("dataStoreName", "dataStoreValue"), } } @@ -144,7 +144,7 @@ func (id DataStoreId) String() string { fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Private Cloud Name: %q", id.PrivateCloudName), fmt.Sprintf("Cluster Name: %q", id.ClusterName), - fmt.Sprintf("Datastore Name: %q", id.DatastoreName), + fmt.Sprintf("Data Store Name: %q", id.DataStoreName), } return fmt.Sprintf("Data Store (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/README.md index 4f0b184c7b79..7422c534b6b9 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/README.md @@ -24,7 +24,7 @@ client.Client.Authorizer = authorizer ```go ctx := context.TODO() -id := managedapis.NewManagedApiID("12345678-1234-9876-4563-123456789012", "locationValue", "apiValue") +id := managedapis.NewManagedApiID("12345678-1234-9876-4563-123456789012", "locationValue", "managedApiValue") read, err := client.ManagedApisGet(ctx, id) if err != nil { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/id_location.go index 3ada9396582a..085ea839ff52 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/id_location.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/id_location.go @@ -12,14 +12,14 @@ var _ resourceids.ResourceId = LocationId{} // LocationId is a struct representing the Resource ID for a Location type LocationId struct { SubscriptionId string - Location string + LocationName string } // NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { +func NewLocationID(subscriptionId string, locationName string) LocationId { return LocationId{ SubscriptionId: subscriptionId, - Location: location, + LocationName: locationName, } } @@ -38,8 +38,8 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.Web/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } // Segments returns a slice of Resource ID Segments which comprise this Location ID @@ -97,7 +97,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftWeb", "Microsoft.Web", "Microsoft.Web"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), } } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { func (id LocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), } return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/id_managedapi.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/id_managedapi.go index 58de8df6fc3d..a0305dae1dd9 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/id_managedapi.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/id_managedapi.go @@ -12,16 +12,16 @@ var _ resourceids.ResourceId = ManagedApiId{} // ManagedApiId is a struct representing the Resource ID for a Managed Api type ManagedApiId struct { SubscriptionId string - Location string - ApiName string + LocationName string + ManagedApiName string } // NewManagedApiID returns a new ManagedApiId struct -func NewManagedApiID(subscriptionId string, location string, apiName string) ManagedApiId { +func NewManagedApiID(subscriptionId string, locationName string, managedApiName string) ManagedApiId { return ManagedApiId{ SubscriptionId: subscriptionId, - Location: location, - ApiName: apiName, + LocationName: locationName, + ManagedApiName: managedApiName, } } @@ -40,12 +40,12 @@ func ParseManagedApiID(input string) (*ManagedApiId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } - if id.ApiName, ok = parsed.Parsed["apiName"]; !ok { - return nil, fmt.Errorf("the segment 'apiName' was not found in the resource id %q", input) + if id.ManagedApiName, ok = parsed.Parsed["managedApiName"]; !ok { + return nil, fmt.Errorf("the segment 'managedApiName' was not found in the resource id %q", input) } return &id, nil @@ -67,12 +67,12 @@ func ParseManagedApiIDInsensitively(input string) (*ManagedApiId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } - if id.ApiName, ok = parsed.Parsed["apiName"]; !ok { - return nil, fmt.Errorf("the segment 'apiName' was not found in the resource id %q", input) + if id.ManagedApiName, ok = parsed.Parsed["managedApiName"]; !ok { + return nil, fmt.Errorf("the segment 'managedApiName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateManagedApiID(input interface{}, key string) (warnings []string, err // ID returns the formatted Managed Api ID func (id ManagedApiId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.Web/locations/%s/managedApis/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location, id.ApiName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.ManagedApiName) } // Segments returns a slice of Resource ID Segments which comprise this Managed Api ID @@ -107,9 +107,9 @@ func (id ManagedApiId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftWeb", "Microsoft.Web", "Microsoft.Web"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), resourceids.StaticSegment("staticManagedApis", "managedApis", "managedApis"), - resourceids.UserSpecifiedSegment("apiName", "apiValue"), + resourceids.UserSpecifiedSegment("managedApiName", "managedApiValue"), } } @@ -117,8 +117,8 @@ func (id ManagedApiId) Segments() []resourceids.Segment { func (id ManagedApiId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), - fmt.Sprintf("Api Name: %q", id.ApiName), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Managed Api Name: %q", id.ManagedApiName), } return fmt.Sprintf("Managed Api (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/README.md index e0bdf16b77dc..5717f7e051dd 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/README.md @@ -45,7 +45,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue") payload := webpubsub.WebPubSubResource{ // ... @@ -62,7 +62,7 @@ if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue") if err := client.DeleteThenPoll(ctx, id); err != nil { // handle the error @@ -74,7 +74,7 @@ if err := client.DeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue") read, err := client.Get(ctx, id) if err != nil { @@ -90,7 +90,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := webpubsub.NewHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "hubValue") +id := webpubsub.NewHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue", "hubValue") payload := webpubsub.WebPubSubHub{ // ... @@ -107,7 +107,7 @@ if err := client.HubsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := webpubsub.NewHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "hubValue") +id := webpubsub.NewHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue", "hubValue") if err := client.HubsDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -119,7 +119,7 @@ if err := client.HubsDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := webpubsub.NewHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "hubValue") +id := webpubsub.NewHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue", "hubValue") read, err := client.HubsGet(ctx, id) if err != nil { @@ -135,7 +135,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue") // alternatively `client.HubsList(ctx, id)` can be used to do batched pagination items, err := client.HubsListComplete(ctx, id) @@ -186,7 +186,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue") read, err := client.ListKeys(ctx, id) if err != nil { @@ -202,7 +202,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue") read, err := client.ListSkus(ctx, id) if err != nil { @@ -218,7 +218,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := webpubsub.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue") +id := webpubsub.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue", "privateEndpointConnectionValue") if err := client.PrivateEndpointConnectionsDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -230,7 +230,7 @@ if err := client.PrivateEndpointConnectionsDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := webpubsub.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue") +id := webpubsub.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue", "privateEndpointConnectionValue") read, err := client.PrivateEndpointConnectionsGet(ctx, id) if err != nil { @@ -246,7 +246,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue") // alternatively `client.PrivateEndpointConnectionsList(ctx, id)` can be used to do batched pagination items, err := client.PrivateEndpointConnectionsListComplete(ctx, id) @@ -263,7 +263,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := webpubsub.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue") +id := webpubsub.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue", "privateEndpointConnectionValue") payload := webpubsub.PrivateEndpointConnection{ // ... @@ -284,7 +284,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue") // alternatively `client.PrivateLinkResourcesList(ctx, id)` can be used to do batched pagination items, err := client.PrivateLinkResourcesListComplete(ctx, id) @@ -301,7 +301,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue") payload := webpubsub.RegenerateKeyParameters{ // ... @@ -318,7 +318,7 @@ if err := client.RegenerateKeyThenPoll(ctx, id, payload); err != nil { ```go ctx := context.TODO() -id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue") if err := client.RestartThenPoll(ctx, id); err != nil { // handle the error @@ -330,7 +330,7 @@ if err := client.RestartThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := webpubsub.NewSharedPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "sharedPrivateLinkResourceValue") +id := webpubsub.NewSharedPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue", "sharedPrivateLinkResourceValue") payload := webpubsub.SharedPrivateLinkResource{ // ... @@ -347,7 +347,7 @@ if err := client.SharedPrivateLinkResourcesCreateOrUpdateThenPoll(ctx, id, paylo ```go ctx := context.TODO() -id := webpubsub.NewSharedPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "sharedPrivateLinkResourceValue") +id := webpubsub.NewSharedPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue", "sharedPrivateLinkResourceValue") if err := client.SharedPrivateLinkResourcesDeleteThenPoll(ctx, id); err != nil { // handle the error @@ -359,7 +359,7 @@ if err := client.SharedPrivateLinkResourcesDeleteThenPoll(ctx, id); err != nil { ```go ctx := context.TODO() -id := webpubsub.NewSharedPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "sharedPrivateLinkResourceValue") +id := webpubsub.NewSharedPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue", "sharedPrivateLinkResourceValue") read, err := client.SharedPrivateLinkResourcesGet(ctx, id) if err != nil { @@ -375,7 +375,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() -id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue") // alternatively `client.SharedPrivateLinkResourcesList(ctx, id)` can be used to do batched pagination items, err := client.SharedPrivateLinkResourcesListComplete(ctx, id) @@ -392,7 +392,7 @@ for _, item := range items { ```go ctx := context.TODO() -id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +id := webpubsub.NewWebPubSubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "webPubSubValue") payload := webpubsub.WebPubSubResource{ // ... diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_hub.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_hub.go index 6bb5f9d9f49f..2f592d75326b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_hub.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_hub.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = HubId{} type HubId struct { SubscriptionId string ResourceGroupName string - ResourceName string + WebPubSubName string HubName string } // NewHubID returns a new HubId struct -func NewHubID(subscriptionId string, resourceGroupName string, resourceName string, hubName string) HubId { +func NewHubID(subscriptionId string, resourceGroupName string, webPubSubName string, hubName string) HubId { return HubId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + WebPubSubName: webPubSubName, HubName: hubName, } } @@ -46,8 +46,8 @@ func ParseHubID(input string) (*HubId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { + return nil, fmt.Errorf("the segment 'webPubSubName' was not found in the resource id %q", input) } if id.HubName, ok = parsed.Parsed["hubName"]; !ok { @@ -77,8 +77,8 @@ func ParseHubIDInsensitively(input string) (*HubId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { + return nil, fmt.Errorf("the segment 'webPubSubName' was not found in the resource id %q", input) } if id.HubName, ok = parsed.Parsed["hubName"]; !ok { @@ -106,7 +106,7 @@ func ValidateHubID(input interface{}, key string) (warnings []string, errors []e // ID returns the formatted Hub ID func (id HubId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/webPubSub/%s/hubs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.HubName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WebPubSubName, id.HubName) } // Segments returns a slice of Resource ID Segments which comprise this Hub ID @@ -119,7 +119,7 @@ func (id HubId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), resourceids.StaticSegment("staticWebPubSub", "webPubSub", "webPubSub"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("webPubSubName", "webPubSubValue"), resourceids.StaticSegment("staticHubs", "hubs", "hubs"), resourceids.UserSpecifiedSegment("hubName", "hubValue"), } @@ -130,7 +130,7 @@ func (id HubId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Web Pub Sub Name: %q", id.WebPubSubName), fmt.Sprintf("Hub Name: %q", id.HubName), } return fmt.Sprintf("Hub (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_location.go index 5d5ca0e4d3ab..e56e54ebb8a9 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_location.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_location.go @@ -12,14 +12,14 @@ var _ resourceids.ResourceId = LocationId{} // LocationId is a struct representing the Resource ID for a Location type LocationId struct { SubscriptionId string - Location string + LocationName string } // NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { +func NewLocationID(subscriptionId string, locationName string) LocationId { return LocationId{ SubscriptionId: subscriptionId, - Location: location, + LocationName: locationName, } } @@ -38,8 +38,8 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -61,8 +61,8 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) } - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) } return &id, nil @@ -86,7 +86,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { fmtString := "/subscriptions/%s/providers/Microsoft.SignalRService/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } // Segments returns a slice of Resource ID Segments which comprise this Location ID @@ -97,7 +97,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), } } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { func (id LocationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), + fmt.Sprintf("Location Name: %q", id.LocationName), } return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_privateendpointconnection.go index d20e21473bcd..f9d89ba4ad5b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_privateendpointconnection.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_privateendpointconnection.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = PrivateEndpointConnectionId{} type PrivateEndpointConnectionId struct { SubscriptionId string ResourceGroupName string - ResourceName string + WebPubSubName string PrivateEndpointConnectionName string } // NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct -func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, resourceName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, webPubSubName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { return PrivateEndpointConnectionId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + WebPubSubName: webPubSubName, PrivateEndpointConnectionName: privateEndpointConnectionName, } } @@ -46,8 +46,8 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { + return nil, fmt.Errorf("the segment 'webPubSubName' was not found in the resource id %q", input) } if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { @@ -77,8 +77,8 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { + return nil, fmt.Errorf("the segment 'webPubSubName' was not found in the resource id %q", input) } if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { @@ -106,7 +106,7 @@ func ValidatePrivateEndpointConnectionID(input interface{}, key string) (warning // ID returns the formatted Private Endpoint Connection ID func (id PrivateEndpointConnectionId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/webPubSub/%s/privateEndpointConnections/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.PrivateEndpointConnectionName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WebPubSubName, id.PrivateEndpointConnectionName) } // Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID @@ -119,7 +119,7 @@ func (id PrivateEndpointConnectionId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), resourceids.StaticSegment("staticWebPubSub", "webPubSub", "webPubSub"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("webPubSubName", "webPubSubValue"), resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionValue"), } @@ -130,7 +130,7 @@ func (id PrivateEndpointConnectionId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Web Pub Sub Name: %q", id.WebPubSubName), fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), } return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_sharedprivatelinkresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_sharedprivatelinkresource.go index 79c3416743be..65995ee4397d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_sharedprivatelinkresource.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_sharedprivatelinkresource.go @@ -13,16 +13,16 @@ var _ resourceids.ResourceId = SharedPrivateLinkResourceId{} type SharedPrivateLinkResourceId struct { SubscriptionId string ResourceGroupName string - ResourceName string + WebPubSubName string SharedPrivateLinkResourceName string } // NewSharedPrivateLinkResourceID returns a new SharedPrivateLinkResourceId struct -func NewSharedPrivateLinkResourceID(subscriptionId string, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string) SharedPrivateLinkResourceId { +func NewSharedPrivateLinkResourceID(subscriptionId string, resourceGroupName string, webPubSubName string, sharedPrivateLinkResourceName string) SharedPrivateLinkResourceId { return SharedPrivateLinkResourceId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + WebPubSubName: webPubSubName, SharedPrivateLinkResourceName: sharedPrivateLinkResourceName, } } @@ -46,8 +46,8 @@ func ParseSharedPrivateLinkResourceID(input string) (*SharedPrivateLinkResourceI return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { + return nil, fmt.Errorf("the segment 'webPubSubName' was not found in the resource id %q", input) } if id.SharedPrivateLinkResourceName, ok = parsed.Parsed["sharedPrivateLinkResourceName"]; !ok { @@ -77,8 +77,8 @@ func ParseSharedPrivateLinkResourceIDInsensitively(input string) (*SharedPrivate return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { + return nil, fmt.Errorf("the segment 'webPubSubName' was not found in the resource id %q", input) } if id.SharedPrivateLinkResourceName, ok = parsed.Parsed["sharedPrivateLinkResourceName"]; !ok { @@ -106,7 +106,7 @@ func ValidateSharedPrivateLinkResourceID(input interface{}, key string) (warning // ID returns the formatted Shared Private Link Resource ID func (id SharedPrivateLinkResourceId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/webPubSub/%s/sharedPrivateLinkResources/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.SharedPrivateLinkResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WebPubSubName, id.SharedPrivateLinkResourceName) } // Segments returns a slice of Resource ID Segments which comprise this Shared Private Link Resource ID @@ -119,7 +119,7 @@ func (id SharedPrivateLinkResourceId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), resourceids.StaticSegment("staticWebPubSub", "webPubSub", "webPubSub"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("webPubSubName", "webPubSubValue"), resourceids.StaticSegment("staticSharedPrivateLinkResources", "sharedPrivateLinkResources", "sharedPrivateLinkResources"), resourceids.UserSpecifiedSegment("sharedPrivateLinkResourceName", "sharedPrivateLinkResourceValue"), } @@ -130,7 +130,7 @@ func (id SharedPrivateLinkResourceId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Web Pub Sub Name: %q", id.WebPubSubName), fmt.Sprintf("Shared Private Link Resource Name: %q", id.SharedPrivateLinkResourceName), } return fmt.Sprintf("Shared Private Link Resource (%s)", strings.Join(components, "\n")) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_webpubsub.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_webpubsub.go index 377d9d712c4c..7ffd0c0e506c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_webpubsub.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub/id_webpubsub.go @@ -13,15 +13,15 @@ var _ resourceids.ResourceId = WebPubSubId{} type WebPubSubId struct { SubscriptionId string ResourceGroupName string - ResourceName string + WebPubSubName string } // NewWebPubSubID returns a new WebPubSubId struct -func NewWebPubSubID(subscriptionId string, resourceGroupName string, resourceName string) WebPubSubId { +func NewWebPubSubID(subscriptionId string, resourceGroupName string, webPubSubName string) WebPubSubId { return WebPubSubId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - ResourceName: resourceName, + WebPubSubName: webPubSubName, } } @@ -44,8 +44,8 @@ func ParseWebPubSubID(input string) (*WebPubSubId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { + return nil, fmt.Errorf("the segment 'webPubSubName' was not found in the resource id %q", input) } return &id, nil @@ -71,8 +71,8 @@ func ParseWebPubSubIDInsensitively(input string) (*WebPubSubId, error) { return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) } - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + if id.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { + return nil, fmt.Errorf("the segment 'webPubSubName' was not found in the resource id %q", input) } return &id, nil @@ -96,7 +96,7 @@ func ValidateWebPubSubID(input interface{}, key string) (warnings []string, erro // ID returns the formatted Web Pub Sub ID func (id WebPubSubId) ID() string { fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/webPubSub/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WebPubSubName) } // Segments returns a slice of Resource ID Segments which comprise this Web Pub Sub ID @@ -109,7 +109,7 @@ func (id WebPubSubId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticProviders", "providers", "providers"), resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), resourceids.StaticSegment("staticWebPubSub", "webPubSub", "webPubSub"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.UserSpecifiedSegment("webPubSubName", "webPubSubValue"), } } @@ -118,7 +118,7 @@ func (id WebPubSubId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Web Pub Sub Name: %q", id.WebPubSubName), } return fmt.Sprintf("Web Pub Sub (%s)", strings.Join(components, "\n")) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/README.md b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/README.md new file mode 100644 index 000000000000..e817f0ad9e0a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/README.md @@ -0,0 +1,170 @@ +# Package: `github.com/hashicorp/go-azure-sdk/sdk/auth` + +This package contains Authorizers which can be used to authenticate calls to the Azure APIs for use with `hashicorp/go-azure-sdk`. + +## Example: Authenticating using the Azure CLI + +```go +package main + +import ( + "context" + "log" + + "github.com/hashicorp/go-azure-sdk/sdk/auth" + "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +func main() { + environment := environments.Public + credentials := auth.Credentials{ + Environment: environment, + EnableAuthenticatingUsingAzureCLI: true, + } + authorizer, err := auth.NewAuthorizerFromCredentials(context.TODO(), credentials, environment.MSGraph) + if err != nil { + log.Fatalf("building authorizer from credentials: %+v", err) + } + // ... +} +``` + +## Example: Authenticating using a Client Certificate + +```go +package main + +import ( + "context" + "log" + + "github.com/hashicorp/go-azure-sdk/sdk/auth" + "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +func main() { + environment := environments.Public + credentials := auth.Credentials{ + Environment: environment, + EnableAuthenticatingUsingClientCertificate: true, + ClientCertificatePath: "/path/to/cert.pfx", + ClientCertificatePassword: "somepassword", + } + authorizer, err := auth.NewAuthorizerFromCredentials(context.TODO(), credentials, environment.MSGraph) + if err != nil { + log.Fatalf("building authorizer from credentials: %+v", err) + } + // .. +} +``` + +## Example: Authenticating using a Client Secret + +```go +import ( + "context" + "log" + + "github.com/hashicorp/go-azure-sdk/sdk/auth" + "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +func main() { + environment := environments.Public + credentials := auth.Credentials{ + Environment: environment, + EnableAuthenticatingUsingClientSecret: true, + ClientSecret: "some-secret-value", + } + authorizer, err := auth.NewAuthorizerFromCredentials(context.TODO(), credentials, environment.MSGraph) + if err != nil { + log.Fatalf("building authorizer from credentials: %+v", err) + } + // .. +} +``` + +## Example: Authenticating using a Managed Identity + +```go +package main + +import ( + "context" + "log" + + "github.com/hashicorp/go-azure-sdk/sdk/auth" + "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +func main() { + environment := environments.Public + credentials := auth.Credentials{ + Environment: environment, + EnableAuthenticatingUsingManagedIdentity: true, + } + authorizer, err := auth.NewAuthorizerFromCredentials(context.TODO(), credentials, environment.MSGraph) + if err != nil { + log.Fatalf("building authorizer from credentials: %+v", err) + } + // .. +} +``` + +## Example: Authenticating using GitHub OIDC + +```go +package main + +import ( + "context" + "log" + "os" + + "github.com/hashicorp/go-azure-sdk/sdk/auth" + "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +func main() { + environment := environments.Public + credentials := auth.Credentials{ + Environment: environment, + EnableAuthenticationUsingGitHubOIDC: true, + GitHubOIDCTokenRequestURL: os.Getenv("ACTIONS_ID_TOKEN_REQUEST_URL"), + GitHubOIDCTokenRequestToken: os.Getenv("ACTIONS_ID_TOKEN_REQUEST_TOKEN"), + } + authorizer, err := auth.NewAuthorizerFromCredentials(context.TODO(), credentials, environment.MSGraph) + if err != nil { + log.Fatalf("building authorizer from credentials: %+v", err) + } + // .. +} +``` + +## Example: Authenticating using OIDC + +```go +package main + +import ( + "context" + "log" + + "github.com/hashicorp/go-azure-sdk/sdk/auth" + "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +func main() { + environment := environments.Public + credentials := auth.Credentials{ + Environment: environment, + EnableAuthenticationUsingOIDC: true, + OIDCAssertionToken: "some-token", + } + authorizer, err := auth.NewAuthorizerFromCredentials(context.TODO(), credentials, environment.MSGraph) + if err != nil { + log.Fatalf("building authorizer from credentials: %+v", err) + } + // .. +} +``` \ No newline at end of file diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/auth.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/auth.go new file mode 100644 index 000000000000..649d35926474 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/auth.go @@ -0,0 +1,142 @@ +package auth + +import ( + "context" + "fmt" + "strings" + + "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +// NewAuthorizerFromCredentials returns a suitable Authorizer depending on what is defined in the Credentials +// Authorizers are selected for authentication methods in the following preferential order: +// - Client certificate authentication +// - Client secret authentication +// - OIDC authentication +// - GitHub OIDC authentication +// - MSI authentication +// - Azure CLI authentication +// +// Whether one of these is returned depends on whether it is enabled in the Credentials, and whether sufficient +// configuration fields are set to enable that authentication method. +// +// For client certificate authentication, specify TenantID, ClientID and ClientCertificateData / ClientCertificatePath. +// For client secret authentication, specify TenantID, ClientID and ClientSecret. +// For OIDC authentication, specify TenantID, ClientID and OIDCAssertionToken. +// For GitHub OIDC authentication, specify TenantID, ClientID, GitHubOIDCTokenRequestURL and GitHubOIDCTokenRequestToken. +// MSI authentication (if enabled) using the Azure Metadata Service is then attempted +// Azure CLI authentication (if enabled) is attempted last +// +// It's recommended to only enable the mechanisms you have configured and are known to work in the execution +// environment. If any authentication mechanism fails due to misconfiguration or some other error, the function +// will return (nil, error) and later mechanisms will not be attempted. +func NewAuthorizerFromCredentials(ctx context.Context, c Credentials, api environments.Api) (Authorizer, error) { + if c.EnableAuthenticatingUsingClientCertificate && strings.TrimSpace(c.TenantID) != "" && strings.TrimSpace(c.ClientID) != "" && (len(c.ClientCertificateData) > 0 || strings.TrimSpace(c.ClientCertificatePath) != "") { + opts := ClientCertificateAuthorizerOptions{ + Environment: c.Environment, + Api: api, + TenantId: c.TenantID, + AuxTenantIds: c.AuxiliaryTenantIDs, + ClientId: c.ClientID, + Pkcs12Data: c.ClientCertificateData, + Pkcs12Path: c.ClientCertificatePath, + Pkcs12Pass: c.ClientCertificatePassword, + } + a, err := NewClientCertificateAuthorizer(ctx, opts) + if err != nil { + return nil, fmt.Errorf("could not configure ClientCertificate Authorizer: %s", err) + } + if a != nil { + return a, nil + } + } + + if c.EnableAuthenticatingUsingClientSecret && strings.TrimSpace(c.TenantID) != "" && strings.TrimSpace(c.ClientID) != "" && strings.TrimSpace(c.ClientSecret) != "" { + opts := ClientSecretAuthorizerOptions{ + Environment: c.Environment, + Api: api, + TenantId: c.TenantID, + AuxTenantIds: c.AuxiliaryTenantIDs, + ClientId: c.ClientID, + ClientSecret: c.ClientSecret, + } + a, err := NewClientSecretAuthorizer(ctx, opts) + if err != nil { + return nil, fmt.Errorf("could not configure ClientSecret Authorizer: %s", err) + } + if a != nil { + return a, nil + } + } + + if c.EnableAuthenticationUsingOIDC && strings.TrimSpace(c.TenantID) != "" && strings.TrimSpace(c.ClientID) != "" && strings.TrimSpace(c.OIDCAssertionToken) != "" { + opts := OIDCAuthorizerOptions{ + Environment: c.Environment, + Api: api, + TenantId: c.TenantID, + AuxiliaryTenantIds: c.AuxiliaryTenantIDs, + ClientId: c.ClientID, + FederatedAssertion: c.OIDCAssertionToken, + } + a, err := NewOIDCAuthorizer(ctx, opts) + if err != nil { + return nil, fmt.Errorf("could not configure OIDC Authorizer: %s", err) + } + if a != nil { + return a, nil + } + } + + if c.EnableAuthenticationUsingGitHubOIDC && strings.TrimSpace(c.TenantID) != "" && strings.TrimSpace(c.ClientID) != "" && strings.TrimSpace(c.GitHubOIDCTokenRequestURL) != "" && strings.TrimSpace(c.GitHubOIDCTokenRequestToken) != "" { + opts := GitHubOIDCAuthorizerOptions{ + Api: api, + AuxiliaryTenantIds: c.AuxiliaryTenantIDs, + ClientId: c.TenantID, + Environment: c.Environment, + IdTokenRequestUrl: c.GitHubOIDCTokenRequestURL, + IdTokenRequestToken: c.GitHubOIDCTokenRequestToken, + TenantId: c.TenantID, + } + a, err := NewGitHubOIDCAuthorizer(context.Background(), opts) + if err != nil { + return nil, fmt.Errorf("could not configure GitHubOIDC Authorizer: %s", err) + } + if a != nil { + return a, nil + } + } + + if c.EnableAuthenticatingUsingManagedIdentity { + opts := ManagedIdentityAuthorizerOptions{ + Api: api, + ClientId: c.ClientID, + CustomManagedIdentityEndpoint: c.CustomManagedIdentityEndpoint, + } + a, err := NewManagedIdentityAuthorizer(ctx, opts) + if err != nil { + return nil, fmt.Errorf("could not configure MSI Authorizer: %s", err) + } + if a != nil { + return a, nil + } + } + + if c.EnableAuthenticatingUsingAzureCLI { + opts := AzureCliAuthorizerOptions{ + Api: api, + TenantId: c.TenantID, + } + a, err := NewAzureCliAuthorizer(ctx, opts) + if err != nil { + return nil, fmt.Errorf("could not configure AzureCli Authorizer: %s", err) + } + if a != nil { + return a, nil + } + } + + return nil, fmt.Errorf("no Authorizer could be configured, please check your configuration") +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/autorest/auth.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/autorest/auth.go new file mode 100644 index 000000000000..6b20258ca8de --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/autorest/auth.go @@ -0,0 +1,98 @@ +package autorest + +import ( + "context" + "fmt" + "net/http" + "strings" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/adal" + "github.com/hashicorp/go-azure-sdk/sdk/auth" +) + +func AutorestAuthorizer(authorizer auth.Authorizer) *Authorizer { + return &Authorizer{Authorizer: authorizer} +} + +type Authorizer struct { + auth.Authorizer +} + +// WithAuthorization implements the autorest.Authorizer interface +func (c *Authorizer) WithAuthorization() autorest.PrepareDecorator { + return func(p autorest.Preparer) autorest.Preparer { + return autorest.PreparerFunc(func(req *http.Request) (*http.Request, error) { + ctx := req.Context() + var err error + req, err = p.Prepare(req) + if err == nil { + token, err := c.Token(ctx, req) + if err != nil { + return nil, err + } + + req, err = autorest.Prepare(req, autorest.WithHeader("Authorization", fmt.Sprintf("Bearer %s", token.AccessToken))) + if err != nil { + return nil, fmt.Errorf("preparing request: %+v", err) + } + + auxTokens, err := c.AuxiliaryTokens(ctx, req) + if err != nil { + return nil, fmt.Errorf("preparing auxiliary tokens for request: %+v", err) + } + if len(auxTokens) > 0 { + auxTokenList := make([]string, 0) + for _, a := range auxTokens { + if a != nil && a.AccessToken != "" { + auxTokenList = append(auxTokenList, fmt.Sprintf("%s %s", a.TokenType, a.AccessToken)) + } + } + + if len(auxTokenList) > 0 { + return autorest.Prepare(req, autorest.WithHeader("x-ms-authorization-auxiliary", strings.Join(auxTokenList, ", "))) + } + } + + return req, nil + } + + return req, err + }) + } +} + +// BearerAuthorizerCallback is a helper that returns an *autorest.BearerAuthorizerCallback for use in data plane API clients in the Azure SDK +func (c *Authorizer) BearerAuthorizerCallback() *autorest.BearerAuthorizerCallback { + return autorest.NewBearerAuthorizerCallback(nil, func(_, resource string) (*autorest.BearerAuthorizer, error) { + token, err := c.Token(context.TODO(), &http.Request{}) + if err != nil { + return nil, fmt.Errorf("obtaining token: %v", err) + } + + return autorest.NewBearerAuthorizer(&servicePrincipalTokenWrapper{ + tokenType: "Bearer", + tokenValue: token.AccessToken, + }), nil + }) +} + +type servicePrincipalTokenWrapper struct { + tokenType string + tokenValue string +} + +func (s *servicePrincipalTokenWrapper) OAuthToken() string { + return s.tokenValue +} + +func (s *servicePrincipalTokenWrapper) Token() adal.Token { + return adal.Token{ + AccessToken: s.tokenValue, + Type: s.tokenType, + } +} + +type ServicePrincipalToken interface { + Token() adal.Token +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/azure_cli_authorizer.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/azure_cli_authorizer.go new file mode 100644 index 000000000000..5a6d87bd6684 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/azure_cli_authorizer.go @@ -0,0 +1,200 @@ +package auth + +import ( + "context" + "errors" + "fmt" + "net/http" + "os" + "strings" + + "github.com/hashicorp/go-azure-sdk/sdk/environments" + "github.com/hashicorp/go-azure-sdk/sdk/internal/azurecli" + "golang.org/x/oauth2" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureCliAuthorizerOptions struct { + // Api describes the Azure API being used + Api environments.Api + + // TenantId is the tenant to authenticate against + TenantId string + + // AuxTenantIds lists additional tenants to authenticate against, currently only + // used for Resource Manager when auxiliary tenants are needed. + // e.g. https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant + AuxTenantIds []string +} + +// NewAzureCliAuthorizer returns an Authorizer which authenticates using the Azure CLI. +func NewAzureCliAuthorizer(ctx context.Context, options AzureCliAuthorizerOptions) (Authorizer, error) { + conf, err := newAzureCliConfig(options.Api, options.TenantId, options.AuxTenantIds) + if err != nil { + return nil, err + } + return conf.TokenSource(ctx) +} + +var _ Authorizer = &AzureCliAuthorizer{} + +// AzureCliAuthorizer is an Authorizer which supports the Azure CLI. +type AzureCliAuthorizer struct { + // TenantID is the specified tenant ID, or the auto-detected tenant ID if none was specified + TenantID string + + // DefaultSubscriptionID is the default subscription, when detected + DefaultSubscriptionID string + + conf *azureCliConfig +} + +// Token returns an access token using the Azure CLI as an authentication mechanism. +func (a *AzureCliAuthorizer) Token(_ context.Context, _ *http.Request) (*oauth2.Token, error) { + if a.conf == nil { + return nil, fmt.Errorf("could not request token: conf is nil") + } + + azArgs := []string{"account", "get-access-token"} + + // verify that the Azure CLI supports MSAL - ADAL is no longer supported + err := azurecli.CheckAzVersion(azurecli.MsalVersion, nil) + if err != nil { + return nil, fmt.Errorf("checking the version of the Azure CLI: %+v", err) + } + scope, err := environments.Scope(a.conf.Api) + if err != nil { + return nil, fmt.Errorf("determining scope for %q: %+v", a.conf.Api.Name(), err) + } + azArgs = append(azArgs, "--scope", *scope) + + // Try to detect if we're running in Cloud Shell + if cloudShell := os.Getenv("AZUREPS_HOST_ENVIRONMENT"); !strings.HasPrefix(cloudShell, "cloud-shell/") { + // Seemingly not, so we'll append the tenant ID to the az args + azArgs = append(azArgs, "--tenant", a.conf.TenantID) + } + + var token azureCliToken + if err := azurecli.JSONUnmarshalAzCmd(&token, azArgs...); err != nil { + return nil, err + } + + return &oauth2.Token{ + AccessToken: token.AccessToken, + TokenType: token.TokenType, + }, nil +} + +// AuxiliaryTokens returns additional tokens for auxiliary tenant IDs, for use in multi-tenant scenarios +func (a *AzureCliAuthorizer) AuxiliaryTokens(_ context.Context, _ *http.Request) ([]*oauth2.Token, error) { + if a.conf == nil { + return nil, fmt.Errorf("could not request token: conf is nil") + } + + // Try to detect if we're running in Cloud Shell + if cloudShell := os.Getenv("AZUREPS_HOST_ENVIRONMENT"); strings.HasPrefix(cloudShell, "cloud-shell/") { + return nil, fmt.Errorf("auxiliary tokens not supported in Cloud Shell") + } + + azArgs := []string{"account", "get-access-token"} + + // verify that the Azure CLI supports MSAL - ADAL is no longer supported + err := azurecli.CheckAzVersion(AzureCliMsalVersion, nil) + if err != nil { + return nil, fmt.Errorf("checking the version of the Azure CLI: %+v", err) + } + scope, err := environments.Scope(a.conf.Api) + if err != nil { + return nil, fmt.Errorf("determining scope for %q: %+v", a.conf.Api.Name(), err) + } + azArgs = append(azArgs, "--scope", *scope) + + tokens := make([]*oauth2.Token, 0) + for _, tenantId := range a.conf.AuxiliaryTenantIDs { + argsWithTenant := append(azArgs, "--tenant", tenantId) + + var token azureCliToken + if err := azurecli.JSONUnmarshalAzCmd(&token, argsWithTenant...); err != nil { + return nil, err + } + + tokens = append(tokens, &oauth2.Token{ + AccessToken: token.AccessToken, + TokenType: token.TokenType, + }) + } + + return tokens, nil +} + +const ( + AzureCliMinimumVersion = "2.0.81" + AzureCliMsalVersion = "2.30.0" + AzureCliNextMajorVersion = "3.0.0" +) + +// azureCliConfig configures an AzureCliAuthorizer. +type azureCliConfig struct { + Api environments.Api + + // TenantID is the required tenant ID for the primary token + TenantID string + + // AuxiliaryTenantIDs is an optional list of tenant IDs for which to obtain additional tokens + AuxiliaryTenantIDs []string + + // DefaultSubscriptionID is the optional default subscription ID + DefaultSubscriptionID string +} + +// newAzureCliConfig validates the supplied tenant ID and returns a new azureCliConfig. +func newAzureCliConfig(api environments.Api, tenantId string, auxiliaryTenantIds []string) (*azureCliConfig, error) { + var err error + + // check az-cli version + nextMajor := azurecli.NextMajorVersion + if err = azurecli.CheckAzVersion(azurecli.MinimumVersion, &nextMajor); err != nil { + return nil, err + } + + // check tenant ID + tenantId, err = azurecli.CheckTenantID(tenantId) + if err != nil { + return nil, err + } + if tenantId == "" { + return nil, errors.New("invalid tenantId or unable to determine tenantId") + } + + // get the default subscription ID + subscriptionId, err := azurecli.GetDefaultSubscriptionID() + if err != nil { + return nil, err + } + + return &azureCliConfig{ + Api: api, + TenantID: tenantId, + AuxiliaryTenantIDs: auxiliaryTenantIds, + DefaultSubscriptionID: subscriptionId, + }, nil +} + +// TokenSource provides a source for obtaining access tokens using AzureCliAuthorizer. +func (c *azureCliConfig) TokenSource(ctx context.Context) (Authorizer, error) { + // Cache access tokens internally to avoid unnecessary `az` invocations + return NewCachedAuthorizer(&AzureCliAuthorizer{ + TenantID: c.TenantID, + DefaultSubscriptionID: c.DefaultSubscriptionID, + conf: c, + }) +} + +type azureCliToken struct { + AccessToken string `json:"accessToken"` + ExpiresOn string `json:"expiresOn"` + Tenant string `json:"tenant"` + TokenType string `json:"tokenType"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/cached_authorizer.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/cached_authorizer.go new file mode 100644 index 000000000000..7ec4dd76cc96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/cached_authorizer.go @@ -0,0 +1,80 @@ +package auth + +import ( + "context" + "fmt" + "net/http" + "sync" + + "golang.org/x/oauth2" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ Authorizer = &CachedAuthorizer{} + +// CachedAuthorizer caches a token until it expires, then acquires a new token from Source +type CachedAuthorizer struct { + // Source contains the underlying Authorizer for obtaining tokens + Source Authorizer + + mutex sync.RWMutex + token *oauth2.Token + auxTokens []*oauth2.Token +} + +// Token returns the current token if it's still valid, else will acquire a new token +func (c *CachedAuthorizer) Token(ctx context.Context, req *http.Request) (*oauth2.Token, error) { + c.mutex.RLock() + valid := c.token != nil && c.token.Valid() + c.mutex.RUnlock() + + if !valid { + c.mutex.Lock() + defer c.mutex.Unlock() + var err error + c.token, err = c.Source.Token(ctx, req) + if err != nil { + return nil, err + } + } + + return c.token, nil +} + +// AuxiliaryTokens returns additional tokens for auxiliary tenant IDs, for use in multi-tenant scenarios +func (c *CachedAuthorizer) AuxiliaryTokens(ctx context.Context, req *http.Request) ([]*oauth2.Token, error) { + c.mutex.RLock() + var valid bool + for _, token := range c.auxTokens { + valid = token != nil && token.Valid() + if !valid { + break + } + } + c.mutex.RUnlock() + + if !valid { + c.mutex.Lock() + defer c.mutex.Unlock() + var err error + c.auxTokens, err = c.Source.AuxiliaryTokens(ctx, req) + if err != nil { + return nil, err + } + } + + return c.auxTokens, nil +} + +// NewCachedAuthorizer returns an Authorizer that caches an access token for the duration of its validity. +// If the cached token expires, a new one is acquired and cached. +func NewCachedAuthorizer(src Authorizer) (Authorizer, error) { + if _, ok := src.(*SharedKeyAuthorizer); ok { + return nil, fmt.Errorf("internal-error: SharedKeyAuthorizer cannot be cached") + } + return &CachedAuthorizer{ + Source: src, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/client_certificate_authorizer.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/client_certificate_authorizer.go new file mode 100644 index 000000000000..48779cdbb821 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/client_certificate_authorizer.go @@ -0,0 +1,72 @@ +package auth + +import ( + "context" + "fmt" + "os" + + "github.com/hashicorp/go-azure-sdk/sdk/environments" + "golang.org/x/crypto/pkcs12" +) + +type ClientCertificateAuthorizerOptions struct { + // Environment is the Azure environment/cloud being targeted + Environment environments.Environment + + // Api describes the Azure API being used + Api environments.Api + + // TenantId is the tenant to authenticate against + TenantId string + + // AuxTenantIds lists additional tenants to authenticate against, currently only + // used for Resource Manager when auxiliary tenants are needed. + // e.g. https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant + AuxTenantIds []string + + // ClientId is the client ID used when authenticating + ClientId string + + // Pkcs12Data is the binary PKCS#12 archive data containing the certificate and private key + Pkcs12Data []byte + + // Pkcs12Path is a path to a binary PKCS#12 archive on the filesystem + Pkcs12Path string + + // Pkcs12Pass is the challenge passphrase to decrypt the PKCS#12 archive + Pkcs12Pass string +} + +// NewClientCertificateAuthorizer returns an authorizer which uses client certificate authentication. +func NewClientCertificateAuthorizer(ctx context.Context, options ClientCertificateAuthorizerOptions) (Authorizer, error) { + if len(options.Pkcs12Data) == 0 { + var err error + options.Pkcs12Data, err = os.ReadFile(options.Pkcs12Path) + if err != nil { + return nil, fmt.Errorf("could not read PKCS#12 archive at %q: %s", options.Pkcs12Path, err) + } + } + + key, cert, err := pkcs12.Decode(options.Pkcs12Data, options.Pkcs12Pass) + if err != nil { + return nil, fmt.Errorf("could not decode PKCS#12 archive: %s", err) + } + + scope, err := environments.Scope(options.Api) + if err != nil { + return nil, fmt.Errorf("determining scope for %q: %+v", options.Api.Name(), err) + } + + conf := clientCredentialsConfig{ + Environment: options.Environment, + TenantID: options.TenantId, + AuxiliaryTenantIDs: options.AuxTenantIds, + ClientID: options.ClientId, + PrivateKey: key, + Certificate: cert, + Scopes: []string{ + *scope, + }, + } + return conf.TokenSource(ctx, clientCredentialsAssertionType) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/client_credentials.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/client_credentials.go new file mode 100644 index 000000000000..a3c5eae80f70 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/client_credentials.go @@ -0,0 +1,368 @@ +package auth + +import ( + "bytes" + "context" + "crypto" + "crypto/ecdsa" + "crypto/rand" + "crypto/rsa" + "crypto/sha1" + "crypto/x509" + "encoding/base64" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + "strconv" + "strings" + "time" + + "github.com/hashicorp/go-azure-sdk/sdk/environments" + "github.com/hashicorp/go-uuid" + "golang.org/x/oauth2" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type clientCredentialsType string + +const ( + clientCredentialsAssertionType clientCredentialsType = "ClientCredentials" + clientCredentialsSecretType clientCredentialsType = "ClientSecret" +) + +// clientCredentialsConfig is the configuration for using client credentials flow. +// +// For more information see: +// https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow#get-a-token +// https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-certificate-credentials +type clientCredentialsConfig struct { + // Environment is the national cloud environment to use + Environment environments.Environment + + // TenantID is the required tenant ID for the primary token + TenantID string + + // AuxiliaryTenantIDs is an optional list of tenant IDs for which to obtain additional tokens + AuxiliaryTenantIDs []string + + // ClientID is the application's ID. + ClientID string + + // ClientSecret is the application's secret. + ClientSecret string + + // PrivateKey contains the contents of an RSA private key or the + // contents of a PEM file that contains a private key. The provided + // private key is used to sign JWT assertions. + // PEM containers with a passphrase are not supported. + // Use the following command to convert a PKCS 12 file into a PEM. + // + // $ openssl pkcs12 -in key.p12 -out key.pem -nodes + // + PrivateKey crypto.PrivateKey + + // Certificate contains the (optionally PEM encoded) X509 certificate registered + // for the application with which you are authenticating. Used when FederatedAssertion is empty. + Certificate *x509.Certificate + + // FederatedAssertion contains a JWT provided by a trusted third-party vendor + // for obtaining an access token with a federated credential. When empty, an + // assertion will be created and signed using the specified PrivateKey and Certificate + FederatedAssertion string + + // Scopes specifies a list of requested permission scopes (used for v2 tokens) + Scopes []string + + // TokenURL is the clientCredentialsToken endpoint, which overrides the default endpoint constructed from a tenant ID + TokenURL string + + // Audience optionally specifies the intended audience of the + // request. If empty, the value of TokenURL is used as the + // intended audience. + Audience string +} + +// TokenSource provides a source for obtaining access tokens using clientAssertionAuthorizer or clientSecretAuthorizer. +func (c *clientCredentialsConfig) TokenSource(_ context.Context, authType clientCredentialsType) (Authorizer, error) { + switch authType { + case clientCredentialsAssertionType: + return NewCachedAuthorizer(&clientAssertionAuthorizer{ + conf: c, + }) + case clientCredentialsSecretType: + return NewCachedAuthorizer(&clientSecretAuthorizer{ + conf: c, + }) + } + return nil, fmt.Errorf("internal-error: unimplemented authType %q", string(authType)) +} + +type clientAssertionTokenHeader struct { + Algorithm string `json:"alg"` + Type string `json:"typ"` + KeyId string `json:"kid"` +} + +func (h *clientAssertionTokenHeader) encode() (string, error) { + b, err := json.Marshal(h) + if err != nil { + return "", err + } + + return base64.RawURLEncoding.EncodeToString(b), nil +} + +type clientAssertionTokenClaims struct { + Audience string `json:"aud"` + Expiry int64 `json:"exp"` + Issuer string `json:"iss"` + JwtId string `json:"jti"` + NotBefore int64 `json:"nbf"` + Subject string `json:"sub"` +} + +func (c *clientAssertionTokenClaims) encode() (string, error) { + b, err := json.Marshal(c) + if err != nil { + return "", err + } + + return base64.RawURLEncoding.EncodeToString(b), nil +} + +type clientAssertionToken struct { + header clientAssertionTokenHeader + claims clientAssertionTokenClaims +} + +func (c *clientAssertionToken) encode(key crypto.PrivateKey) (*string, error) { + var err error + + c.claims.NotBefore = time.Now().Unix() + c.claims.Expiry = time.Now().Add(time.Hour).Unix() + c.claims.JwtId, err = uuid.GenerateUUID() + if err != nil { + return nil, err + } + + var hash = crypto.SHA256 + var sign func([]byte, []byte) ([]byte, error) + + // determine algorithm and signing function, fail for unsupported keys + if k, ok := key.(*ecdsa.PrivateKey); ok { + c.header.Algorithm = "ES256" + sign = func(data []byte, sum []byte) ([]byte, error) { + return ecdsa.SignASN1(rand.Reader, k, sum) + } + } else if k, ok := key.(*rsa.PrivateKey); ok { + c.header.Algorithm = "RS256" + sign = func(data []byte, sum []byte) ([]byte, error) { + return rsa.SignPKCS1v15(rand.Reader, k, hash, sum) + } + } else { + return nil, fmt.Errorf("unrecognized/unsupported key type: %T", key) + } + + // encode the header + hs, err := c.header.encode() + if err != nil { + return nil, err + } + + // encode the claims + cs, err := c.claims.encode() + if err != nil { + return nil, err + } + + // sign the token + ss := fmt.Sprintf("%s.%s", hs, cs) + h := hash.New() + h.Write([]byte(ss)) + sig, err := sign([]byte(ss), h.Sum(nil)) + if err != nil { + return nil, err + } + + ret := fmt.Sprintf("%s.%s", ss, base64.RawURLEncoding.EncodeToString(sig)) + return &ret, nil +} + +var _ Authorizer = &clientAssertionAuthorizer{} + +type clientAssertionAuthorizer struct { + conf *clientCredentialsConfig +} + +func (a *clientAssertionAuthorizer) assertion(tokenUrl string) (*string, error) { + keySig := sha1.Sum(a.conf.Certificate.Raw) + keyId := base64.URLEncoding.EncodeToString(keySig[:]) + + audience := a.conf.Audience + if audience == "" { + audience = tokenUrl + } + + t := clientAssertionToken{ + header: clientAssertionTokenHeader{ + Type: "JWT", + KeyId: keyId, + }, + claims: clientAssertionTokenClaims{ + Audience: audience, + Issuer: a.conf.ClientID, + Subject: a.conf.ClientID, + }, + } + assertion, err := t.encode(a.conf.PrivateKey) + if err != nil { + return nil, fmt.Errorf("clientAssertionAuthorizer: failed to encode and sign JWT assertion: %v", err) + } + + return assertion, nil +} + +func (a *clientAssertionAuthorizer) token(ctx context.Context, tokenUrl string) (*oauth2.Token, error) { + assertion := a.conf.FederatedAssertion + if assertion == "" { + a, err := a.assertion(tokenUrl) + if err != nil { + return nil, err + } + if a == nil { + return nil, fmt.Errorf("clientAssertionAuthorizer: assertion was nil") + } + assertion = *a + } + + v := url.Values{ + "client_assertion": {assertion}, + "client_assertion_type": {"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}, + "client_id": {a.conf.ClientID}, + "grant_type": {"client_credentials"}, + // NOTE: we intentionally only support v2 (MSAL) Tokens at this time since v1 (ADAL) is EOL + "scope": []string{ + strings.Join(a.conf.Scopes, " "), + }, + } + + return clientCredentialsToken(ctx, tokenUrl, &v) +} + +func (a *clientAssertionAuthorizer) Token(ctx context.Context, _ *http.Request) (*oauth2.Token, error) { + if a.conf == nil { + return nil, fmt.Errorf("could not request token: conf is nil") + } + + tokenUrl := a.conf.TokenURL + if tokenUrl == "" { + if a.conf.Environment.Authorization == nil { + return nil, fmt.Errorf("no `authorization` configuration was found for this environment") + } + tokenUrl = tokenEndpoint(*a.conf.Environment.Authorization, a.conf.TenantID) + } + + return a.token(ctx, tokenUrl) +} + +// AuxiliaryTokens returns additional tokens for auxiliary tenant IDs, for use in multi-tenant scenarios +func (a *clientAssertionAuthorizer) AuxiliaryTokens(ctx context.Context, _ *http.Request) ([]*oauth2.Token, error) { + if a.conf == nil { + return nil, fmt.Errorf("could not request token: conf is nil") + } + + tokens := make([]*oauth2.Token, 0) + + if len(a.conf.AuxiliaryTenantIDs) == 0 { + return tokens, nil + } + + for _, tenantId := range a.conf.AuxiliaryTenantIDs { + tokenUrl := a.conf.TokenURL + if tokenUrl == "" { + if a.conf.Environment.Authorization == nil { + return nil, fmt.Errorf("no `authorization` configuration was found for this environment") + } + tokenUrl = tokenEndpoint(*a.conf.Environment.Authorization, tenantId) + } + + token, err := a.token(ctx, tokenUrl) + if err != nil { + return tokens, err + } + + tokens = append(tokens, token) + } + + return tokens, nil +} + +func clientCredentialsToken(ctx context.Context, endpoint string, params *url.Values) (*oauth2.Token, error) { + req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint, bytes.NewBuffer([]byte(params.Encode()))) + if err != nil { + return nil, fmt.Errorf("clientCredentialsToken: failed to build request: %+v", err) + } + + req.Header.Set("Accept", "application/json") + req.Header.Set("Content-Type", "application/x-www-form-urlencoded") + + resp, err := http.DefaultClient.Do(req) + if err != nil { + return nil, fmt.Errorf("clientCredentialsToken: cannot request token: %v", err) + } + + defer resp.Body.Close() + body, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20)) + if err != nil { + return nil, fmt.Errorf("clientCredentialsToken: cannot parse response: %v", err) + } + + if c := resp.StatusCode; c < 200 || c > 299 { + return nil, fmt.Errorf("clientCredentialsToken: received HTTP status %d with response: %s", resp.StatusCode, body) + } + + // clientCredentialsToken response can arrive with numeric values as integers or strings :( + var tokenRes struct { + AccessToken string `json:"access_token"` + TokenType string `json:"token_type"` + IDToken string `json:"id_token"` + Resource string `json:"resource"` + Scope string `json:"scope"` + ExpiresIn interface{} `json:"expires_in"` // relative seconds from now + ExpiresOn interface{} `json:"expires_on"` // timestamp + } + if err := json.Unmarshal(body, &tokenRes); err != nil { + return nil, fmt.Errorf("clientCredentialsToken: cannot unmarshal response: %v", err) + } + + token := &oauth2.Token{ + AccessToken: tokenRes.AccessToken, + TokenType: tokenRes.TokenType, + } + var secs time.Duration + if exp, ok := tokenRes.ExpiresIn.(string); ok && exp != "" { + if v, err := strconv.Atoi(exp); err == nil { + secs = time.Duration(v) + } + } else if exp, ok := tokenRes.ExpiresIn.(int64); ok { + secs = time.Duration(exp) + } else if exp, ok := tokenRes.ExpiresIn.(float64); ok { + secs = time.Duration(exp) + } + if secs > 0 { + token.Expiry = time.Now().Add(secs * time.Second) + } + + return token, nil +} + +func tokenEndpoint(endpoint environments.Authorization, tenant string) string { + if tenant == "" { + tenant = "common" + } + return fmt.Sprintf("%s/%s/oauth2/v2.0/token", endpoint.LoginEndpoint, tenant) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/client_secret_authorizer.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/client_secret_authorizer.go new file mode 100644 index 000000000000..7908fcf49d0e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/client_secret_authorizer.go @@ -0,0 +1,130 @@ +package auth + +import ( + "context" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/hashicorp/go-azure-sdk/sdk/environments" + "golang.org/x/oauth2" +) + +type ClientSecretAuthorizerOptions struct { + // Environment is the Azure environment/cloud being targeted + Environment environments.Environment + + // Api describes the Azure API being used + Api environments.Api + + // TenantId is the tenant to authenticate against + TenantId string + + // AuxTenantIds lists additional tenants to authenticate against, currently only + // used for Resource Manager when auxiliary tenants are needed. + // e.g. https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant + AuxTenantIds []string + + // ClientId is the client ID used when authenticating + ClientId string + + // ClientSecret is the client secret used when authenticating + ClientSecret string +} + +// NewClientSecretAuthorizer returns an authorizer which uses client secret authentication. +func NewClientSecretAuthorizer(ctx context.Context, options ClientSecretAuthorizerOptions) (Authorizer, error) { + scope, err := environments.Scope(options.Api) + if err != nil { + return nil, fmt.Errorf("determining scope for %q: %+v", options.Api.Name(), err) + } + + conf := clientCredentialsConfig{ + Environment: options.Environment, + TenantID: options.TenantId, + AuxiliaryTenantIDs: options.AuxTenantIds, + ClientID: options.ClientId, + ClientSecret: options.ClientSecret, + Scopes: []string{ + *scope, + }, + } + + return conf.TokenSource(ctx, clientCredentialsSecretType) +} + +var _ Authorizer = &clientSecretAuthorizer{} + +type clientSecretAuthorizer struct { + conf *clientCredentialsConfig +} + +func (a *clientSecretAuthorizer) Token(ctx context.Context, _ *http.Request) (*oauth2.Token, error) { + if a.conf == nil { + return nil, fmt.Errorf("could not request token: conf is nil") + } + + v := url.Values{ + "client_id": {a.conf.ClientID}, + "client_secret": {a.conf.ClientSecret}, + "grant_type": {"client_credentials"}, + // NOTE: at this time we only support v2 (MSAL) Tokens since v1 (ADAL) is EOL. + "scope": []string{ + strings.Join(a.conf.Scopes, " "), + }, + } + + tokenUrl := a.conf.TokenURL + if tokenUrl == "" { + if a.conf.Environment.Authorization == nil { + return nil, fmt.Errorf("no `authorization` configuration was found for this environment") + } + tokenUrl = tokenEndpoint(*a.conf.Environment.Authorization, a.conf.TenantID) + } + + return clientCredentialsToken(ctx, tokenUrl, &v) +} + +// AuxiliaryTokens returns additional tokens for auxiliary tenant IDs, for use in multi-tenant scenarios +func (a *clientSecretAuthorizer) AuxiliaryTokens(ctx context.Context, _ *http.Request) ([]*oauth2.Token, error) { + if a.conf == nil { + return nil, fmt.Errorf("could not request token: conf is nil") + } + + tokens := make([]*oauth2.Token, 0) + + if len(a.conf.AuxiliaryTenantIDs) == 0 { + return tokens, nil + } + + for _, tenantId := range a.conf.AuxiliaryTenantIDs { + v := url.Values{ + "client_id": {a.conf.ClientID}, + "client_secret": {a.conf.ClientSecret}, + "grant_type": {"client_credentials"}, + // NOTE: at this time we only support v2 (MSAL) Tokens since v1 (ADAL) is EOL. + "scope": []string{ + // TODO: given the Request, could we use a dynamic scope? + strings.Join(a.conf.Scopes, " "), + }, + } + + tokenUrl := a.conf.TokenURL + if tokenUrl == "" { + if a.conf.Environment.Authorization == nil { + return nil, fmt.Errorf("no `authorization` configuration was found for this environment") + } + tokenUrl = tokenEndpoint(*a.conf.Environment.Authorization, tenantId) + } + + token, err := clientCredentialsToken(ctx, tokenUrl, &v) + if err != nil { + return tokens, err + } + + tokens = append(tokens, token) + } + + return tokens, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/config.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/config.go new file mode 100644 index 000000000000..58b408cedc98 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/config.go @@ -0,0 +1,55 @@ +package auth + +import ( + "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +// Credentials sets up NewAuthorizer to return an Authorizer based on the provided credentails. +type Credentials struct { + // Specifies the national cloud environment to use + Environment environments.Environment + + // AuxiliaryTenantIDs specifies the Auxiliary Tenant IDs for which to obtain tokens in a multi-tenant scenario. + AuxiliaryTenantIDs []string + // ClientID specifies the Client ID for the application used to authenticate the connection + ClientID string + // TenantID specifies the Azure Active Directory Tenant to connect to, which must be a valid UUID. + TenantID string + + // EnableAuthenticatingUsingAzureCLI specifies whether Azure CLI authentication should be checked. + EnableAuthenticatingUsingAzureCLI bool + + // EnableAuthenticatingUsingClientCertificate specifies whether Client Certificate authentication should be checked. + EnableAuthenticatingUsingClientCertificate bool + // ClientCertificateData specifies the contents of a Client Certificate PKCS#12 bundle. + ClientCertificateData []byte + // ClientCertificatePath specifies the path to a Client Certificate PKCS#12 bundle (.pfx file) + ClientCertificatePath string + // ClientCertificatePassword specifies the encryption password to unlock a Client Certificate. + ClientCertificatePassword string + + // EnableAuthenticatingUsingClientSecret specifies whether Client Secret authentication should be used. + EnableAuthenticatingUsingClientSecret bool + // ClientSecret specifies the Secret used authenticate using Client Secret authentication. + ClientSecret string + + // EnableAuthenticatingUsingManagedIdentity specifies whether Managed Identity authentication should be checked. + EnableAuthenticatingUsingManagedIdentity bool + // CustomManagedIdentityEndpoint specifies a custom endpoint which should be used for Managed Identity. + CustomManagedIdentityEndpoint string + + // Enables OIDC authentication (federated client credentials). + EnableAuthenticationUsingOIDC bool + // OIDCAssertionToken specifies the OIDC Assertion Token to authenticate using Client Credentials. + OIDCAssertionToken string + + // EnableAuthenticationUsingGitHubOIDC specifies whether GitHub OIDC + EnableAuthenticationUsingGitHubOIDC bool + // GitHubOIDCTokenRequestURL specifies the URL for GitHub's OIDC provider + GitHubOIDCTokenRequestURL string + // GitHubOIDCTokenRequestToken specifies the bearer token for the request to GitHub's OIDC provider + GitHubOIDCTokenRequestToken string +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/github_oidc_authorizer.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/github_oidc_authorizer.go new file mode 100644 index 000000000000..2068fa7244e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/github_oidc_authorizer.go @@ -0,0 +1,197 @@ +package auth + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + + "github.com/hashicorp/go-azure-sdk/sdk/environments" + "golang.org/x/oauth2" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GitHubOIDCAuthorizerOptions struct { + // Api describes the Azure API being used + Api environments.Api + + // ClientId is the client ID used when authenticating + ClientId string + + // Environment is the Azure environment/cloud being targeted + Environment environments.Environment + + // TenantId is the tenant to authenticate against + TenantId string + + // AuxiliaryTenantIds lists additional tenants to authenticate against, currently only + // used for Resource Manager when auxiliary tenants are needed. + // e.g. https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant + AuxiliaryTenantIds []string + + // IdTokenRequestUrl is the URL for the OIDC provider from which to request an ID token. + // Usually exposed via the ACTIONS_ID_TOKEN_REQUEST_URL environment variable when running in GitHub Actions + IdTokenRequestUrl string + + // IdTokenRequestToken is the bearer token for the request to the OIDC provider. + // Usually exposed via the ACTIONS_ID_TOKEN_REQUEST_TOKEN environment variable when running in GitHub Actions + IdTokenRequestToken string +} + +// NewGitHubOIDCAuthorizer returns an authorizer which acquires a client assertion from a GitHub endpoint, then uses client assertion authentication to obtain an access token. +func NewGitHubOIDCAuthorizer(ctx context.Context, options GitHubOIDCAuthorizerOptions) (Authorizer, error) { + scope, err := environments.Scope(options.Api) + if err != nil { + return nil, fmt.Errorf("determining scope for %q: %+v", options.Api.Name(), err) + } + + conf := gitHubOIDCConfig{ + Environment: options.Environment, + TenantID: options.TenantId, + AuxiliaryTenantIDs: options.AuxiliaryTenantIds, + ClientID: options.ClientId, + IDTokenRequestURL: options.IdTokenRequestUrl, + IDTokenRequestToken: options.IdTokenRequestToken, + Scopes: []string{ + *scope, + }, + } + + return conf.TokenSource(ctx) +} + +var _ Authorizer = &GitHubOIDCAuthorizer{} + +type GitHubOIDCAuthorizer struct { + conf *gitHubOIDCConfig +} + +func (a *GitHubOIDCAuthorizer) githubAssertion(ctx context.Context, _ *http.Request) (*string, error) { + req, err := http.NewRequestWithContext(ctx, http.MethodGet, a.conf.IDTokenRequestURL, http.NoBody) + if err != nil { + return nil, fmt.Errorf("githubAssertion: failed to build request: %+v", err) + } + + query, err := url.ParseQuery(req.URL.RawQuery) + if err != nil { + return nil, fmt.Errorf("githubAssertion: cannot parse URL query") + } + + if query.Get("audience") == "" { + query.Set("audience", "api://AzureADTokenExchange") + req.URL.RawQuery = query.Encode() + } + + req.Header.Set("Accept", "application/json") + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", a.conf.IDTokenRequestToken)) + req.Header.Set("Content-Type", "application/x-www-form-urlencoded") + + resp, err := http.DefaultClient.Do(req) + if err != nil { + return nil, fmt.Errorf("githubAssertion: cannot request token: %v", err) + } + + defer resp.Body.Close() + body, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20)) + if err != nil { + return nil, fmt.Errorf("githubAssertion: cannot parse response: %v", err) + } + + if c := resp.StatusCode; c < 200 || c > 299 { + return nil, fmt.Errorf("githubAssertion: received HTTP status %d with response: %s", resp.StatusCode, body) + } + + var tokenRes struct { + Count *int `json:"count"` + Value *string `json:"value"` + } + if err := json.Unmarshal(body, &tokenRes); err != nil { + return nil, fmt.Errorf("githubAssertion: cannot unmarshal response: %v", err) + } + + return tokenRes.Value, nil +} + +func (a *GitHubOIDCAuthorizer) tokenSource(ctx context.Context, req *http.Request) (Authorizer, error) { + assertion, err := a.githubAssertion(ctx, req) + if err != nil { + return nil, err + } + if assertion == nil { + return nil, fmt.Errorf("GitHubOIDCAuthorizer: nil JWT assertion received from GitHub") + } + + conf := clientCredentialsConfig{ + Environment: a.conf.Environment, + TenantID: a.conf.TenantID, + AuxiliaryTenantIDs: a.conf.AuxiliaryTenantIDs, + ClientID: a.conf.ClientID, + FederatedAssertion: *assertion, + Scopes: a.conf.Scopes, + TokenURL: a.conf.TokenURL, + Audience: a.conf.Audience, + } + + source, err := conf.TokenSource(ctx, clientCredentialsAssertionType) + if err != nil { + return nil, fmt.Errorf("GitHubOIDCAuthorizer: building Authorizer: %+v", err) + } + return source, nil +} + +func (a *GitHubOIDCAuthorizer) Token(ctx context.Context, req *http.Request) (*oauth2.Token, error) { + source, err := a.tokenSource(ctx, req) + if err != nil { + return nil, err + } + return source.Token(ctx, req) +} + +func (a *GitHubOIDCAuthorizer) AuxiliaryTokens(ctx context.Context, req *http.Request) ([]*oauth2.Token, error) { + source, err := a.tokenSource(ctx, req) + if err != nil { + return nil, err + } + return source.AuxiliaryTokens(ctx, req) +} + +type gitHubOIDCConfig struct { + // Environment is the national cloud environment to use + Environment environments.Environment + + // TenantID is the required tenant ID for the primary token + TenantID string + + // AuxiliaryTenantIDs is an optional list of tenant IDs for which to obtain additional tokens + AuxiliaryTenantIDs []string + + // ClientID is the application's ID. + ClientID string + + // IDTokenRequestURL is the URL for GitHub's OIDC provider. + IDTokenRequestURL string + + // IDTokenRequestToken is the bearer token for the request to the OIDC provider. + IDTokenRequestToken string + + // Scopes specifies a list of requested permission scopes (used for v2 tokens) + Scopes []string + + // TokenURL is the clientCredentialsToken endpoint, which overrides the default endpoint constructed from a tenant ID + TokenURL string + + // Audience optionally specifies the intended audience of the + // request. If empty, the value of TokenURL is used as the + // intended audience. + Audience string +} + +func (c *gitHubOIDCConfig) TokenSource(ctx context.Context) (Authorizer, error) { + return NewCachedAuthorizer(&GitHubOIDCAuthorizer{ + conf: c, + }) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/interface.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/interface.go new file mode 100644 index 000000000000..856d7aaf2186 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/interface.go @@ -0,0 +1,18 @@ +package auth + +import ( + "context" + "net/http" + + "golang.org/x/oauth2" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +// Authorizer is anything that can return an access token for authorizing API connections +type Authorizer interface { + Token(ctx context.Context, request *http.Request) (*oauth2.Token, error) + + AuxiliaryTokens(ctx context.Context, request *http.Request) ([]*oauth2.Token, error) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/managed_identity_authorizer.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/managed_identity_authorizer.go new file mode 100644 index 000000000000..e3a69b446dd7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/managed_identity_authorizer.go @@ -0,0 +1,193 @@ +package auth + +import ( + "context" + "encoding/json" + "fmt" + "io" + "log" + "net/http" + "net/url" + "strconv" + "time" + + "github.com/hashicorp/go-azure-sdk/sdk/environments" + "golang.org/x/oauth2" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedIdentityAuthorizerOptions struct { + // Api describes the Azure API being used + Api environments.Api + + // ClientId is the client ID used when authenticating + ClientId string + + // CustomManagedIdentityEndpoint is an optional endpoint from which to obtain an access + // token. When blank, the default is used. + CustomManagedIdentityEndpoint string +} + +// NewManagedIdentityAuthorizer returns an authorizer using a Managed Identity for authentication. +func NewManagedIdentityAuthorizer(ctx context.Context, options ManagedIdentityAuthorizerOptions) (Authorizer, error) { + resource, err := environments.Resource(options.Api) + if err != nil { + return nil, fmt.Errorf("determining resource for api %q: %+v", options.Api.Name(), err) + } + conf, err := newManagedIdentityConfig(*resource, options.ClientId, options.CustomManagedIdentityEndpoint) + if err != nil { + return nil, err + } + return conf.TokenSource(ctx) +} + +const ( + msiDefaultApiVersion = "2018-02-01" + msiDefaultEndpoint = "http://169.254.169.254/metadata/identity/oauth2/token" + msiDefaultTimeout = 10 * time.Second +) + +var _ Authorizer = &ManagedIdentityAuthorizer{} + +// ManagedIdentityAuthorizer is an Authorizer which supports managed service identity. +type ManagedIdentityAuthorizer struct { + conf *managedIdentityConfig +} + +// Token returns an access token acquired from the metadata endpoint. +func (a *ManagedIdentityAuthorizer) Token(ctx context.Context, _ *http.Request) (*oauth2.Token, error) { + if a.conf == nil { + return nil, fmt.Errorf("could not request token: conf is nil") + } + + query := url.Values{ + "api-version": []string{a.conf.MsiApiVersion}, + "resource": []string{a.conf.Resource}, + } + + if a.conf.ClientID != "" { + query["client_id"] = []string{a.conf.ClientID} + } + + url := fmt.Sprintf("%s?%s", a.conf.MsiEndpoint, query.Encode()) + + body, err := azureMetadata(ctx, url) + if err != nil { + return nil, fmt.Errorf("ManagedIdentityAuthorizer: failed to request token from metadata endpoint: %v", err) + } + + var tokenRes struct { + AccessToken string `json:"access_token"` + ClientID string `json:"client_id"` + Resource string `json:"resource"` + TokenType string `json:"token_type"` + ExpiresIn interface{} `json:"expires_in"` // relative seconds from now + ExpiresOn interface{} `json:"expires_on"` // timestamp + ExtExpiresIn interface{} `json:"ext_expires_in"` // relative seconds from now + } + if err := json.Unmarshal(body, &tokenRes); err != nil { + return nil, fmt.Errorf("ManagedIdentityAuthorizer: failed to unmarshal token: %v", err) + } + + token := &oauth2.Token{ + AccessToken: tokenRes.AccessToken, + TokenType: tokenRes.TokenType, + } + + var secs time.Duration + if exp, ok := tokenRes.ExpiresIn.(string); ok && exp != "" { + if v, err := strconv.Atoi(exp); err == nil { + secs = time.Duration(v) + } + } else if exp, ok := tokenRes.ExpiresIn.(int64); ok { + secs = time.Duration(exp) + } else if exp, ok := tokenRes.ExpiresIn.(float64); ok { + secs = time.Duration(exp) + } + if secs > 0 { + token.Expiry = time.Now().Add(secs * time.Second) + } + + return token, nil +} + +// AuxiliaryTokens returns additional tokens for auxiliary tenant IDs, for use in multi-tenant scenarios +func (a *ManagedIdentityAuthorizer) AuxiliaryTokens(_ context.Context, _ *http.Request) ([]*oauth2.Token, error) { + // auxiliary tokens are not supported with MSI authentication, so just return an empty slice + return []*oauth2.Token{}, nil +} + +// managedIdentityConfig configures an ManagedIdentityAuthorizer. +type managedIdentityConfig struct { + // ClientID is optionally used to determine which application to assume when a resource has multiple managed identities + ClientID string + + // MsiApiVersion is the API version to use when requesting a token from the metadata service + MsiApiVersion string + + // MsiEndpoint is the endpoint where the metadata service can be found + MsiEndpoint string + + // Resource is the service for which to request an access token + Resource string +} + +// newManagedIdentityConfig returns a new managedIdentityConfig with a configured metadata endpoint and resource. +// clientId and objectId can be left blank when a single managed identity is available +func newManagedIdentityConfig(resource, clientId, customManagedIdentityEndpoint string) (*managedIdentityConfig, error) { + endpoint := msiDefaultEndpoint + if customManagedIdentityEndpoint != "" { + endpoint = customManagedIdentityEndpoint + } + + return &managedIdentityConfig{ + ClientID: clientId, + Resource: resource, + MsiApiVersion: msiDefaultApiVersion, + MsiEndpoint: endpoint, + }, nil +} + +// TokenSource provides a source for obtaining access tokens using ManagedIdentityAuthorizer. +func (c *managedIdentityConfig) TokenSource(_ context.Context) (Authorizer, error) { + return NewCachedAuthorizer(&ManagedIdentityAuthorizer{ + conf: c, + }) +} + +func azureMetadata(ctx context.Context, url string) (body []byte, err error) { + ctx2, cancel := context.WithDeadline(ctx, time.Now().Add(time.Second*30)) + defer cancel() + + var req *http.Request + req, err = http.NewRequestWithContext(ctx2, http.MethodGet, url, http.NoBody) + if err != nil { + return + } + req.Header = http.Header{ + "Metadata": []string{"true"}, + } + client := &http.Client{ + Transport: http.DefaultTransport, + Timeout: msiDefaultTimeout, + } + var resp *http.Response + log.Printf("[DEBUG] Performing %s Request to %q", req.Method, url) + resp, err = client.Do(req) + if err != nil { + return + } + log.Printf("[DEBUG] Reading Body from %s %q", req.Method, url) + body, err = io.ReadAll(resp.Body) + if err != nil { + return + } + defer resp.Body.Close() + if c := resp.StatusCode; c < 200 || c > 299 { + err = fmt.Errorf("received HTTP status %d with body: %s", resp.StatusCode, body) + return + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/oidc_authorizer.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/oidc_authorizer.go new file mode 100644 index 000000000000..96005cb6191f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/oidc_authorizer.go @@ -0,0 +1,51 @@ +package auth + +import ( + "context" + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type OIDCAuthorizerOptions struct { + // Environment is the Azure environment/cloud being targeted + Environment environments.Environment + + // Api describes the Azure API being used + Api environments.Api + + // TenantId is the tenant to authenticate against + TenantId string + + // AuxiliaryTenantIds lists additional tenants to authenticate against, currently only + // used for Resource Manager when auxiliary tenants are needed. + // e.g. https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant + AuxiliaryTenantIds []string + + // ClientId is the client ID used when authenticating + ClientId string + + // FederatedAssertion is the client assertion dispensed by the OIDC provider used to verify identity during authentication + FederatedAssertion string +} + +// NewOIDCAuthorizer returns an authorizer which uses OIDC authentication (federated client credentials) +func NewOIDCAuthorizer(ctx context.Context, options OIDCAuthorizerOptions) (Authorizer, error) { + scope, err := environments.Scope(options.Api) + if err != nil { + return nil, fmt.Errorf("determining scope for %q: %+v", options.Api.Name(), err) + } + + conf := clientCredentialsConfig{ + Environment: options.Environment, + TenantID: options.TenantId, + AuxiliaryTenantIDs: options.AuxiliaryTenantIds, + ClientID: options.ClientId, + FederatedAssertion: options.FederatedAssertion, + Scopes: []string{ + *scope, + }, + } + + return conf.TokenSource(ctx, clientCredentialsAssertionType) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/shared_key_authorizer.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/shared_key_authorizer.go new file mode 100644 index 000000000000..91d650e4d155 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/auth/shared_key_authorizer.go @@ -0,0 +1,253 @@ +package auth + +import ( + "bytes" + "context" + "crypto/hmac" + "crypto/sha256" + "encoding/base64" + "fmt" + "net/http" + "net/url" + "sort" + "strings" + "time" + + "golang.org/x/oauth2" +) + +var _ Authorizer = &SharedKeyAuthorizer{} + +// SharedKeyType defines the enumeration for the various shared key types. +// See https://docs.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key for details on the shared key types. +type SharedKeyType string + +const ( + SharedKey SharedKeyType = "sharedKey" + SharedKeyTable SharedKeyType = "sharedKeyTable" +) + +type SharedKeyAuthorizer struct { + accountName string + accountKey []byte + keyType SharedKeyType +} + +func NewSharedKeyAuthorizer(accountName string, accountKey string, keyType SharedKeyType) (*SharedKeyAuthorizer, error) { + key, err := base64.StdEncoding.DecodeString(accountKey) + if err != nil { + return nil, fmt.Errorf("decoding accountKey: %+v", err) + } + return &SharedKeyAuthorizer{ + accountName: accountName, + accountKey: key, + keyType: keyType, + }, nil +} + +func (s *SharedKeyAuthorizer) Token(ctx context.Context, req *http.Request) (*oauth2.Token, error) { + key, err := buildSharedKey(s.accountName, s.accountKey, req, s.keyType) + if err != nil { + return nil, fmt.Errorf("building SharedKey for request: %+v", err) + } + return &oauth2.Token{ + TokenType: "SharedKey", + AccessToken: key, + }, nil +} + +func (s *SharedKeyAuthorizer) AuxiliaryTokens(_ context.Context, _ *http.Request) ([]*oauth2.Token, error) { + return nil, fmt.Errorf("auxiliary tokens are not supported with SharedKey authentication") +} + +// --- + +const ( + storageEmulatorAccountName string = "devstoreaccount1" + + headerContentEncoding = "Content-Encoding" + headerContentLength = "Content-Length" + headerContentMD5 = "Content-MD5" + headerContentLanguage = "Content-Language" + headerContentType = "Content-Type" + headerIfModifiedSince = "If-Modified-Since" + headerIfMatch = "If-Match" + headerIfNoneMatch = "If-None-Match" + headerIfUnmodifiedSince = "If-Unmodified-Since" + headerDate = "Date" + headerXMSDate = "X-Ms-Date" + headerRange = "Range" +) + +func buildSharedKey(accName string, accKey []byte, req *http.Request, keyType SharedKeyType) (string, error) { + canRes, err := buildCanonicalizedResource(accName, req.URL.String(), keyType) + if err != nil { + return "", err + } + + if req.Header == nil { + req.Header = http.Header{} + } + + // ensure date is set + if req.Header.Get(headerDate) == "" && req.Header.Get(headerXMSDate) == "" { + date := time.Now().UTC().Format(http.TimeFormat) + req.Header.Set(headerXMSDate, date) + } + canString, err := buildCanonicalizedString(req.Method, req.Header, canRes, keyType) + if err != nil { + return "", err + } + return createAuthorizationHeader(accName, accKey, canString), nil +} + +func buildCanonicalizedResource(accountName, uri string, keyType SharedKeyType) (string, error) { + errMsg := "buildCanonicalizedResource error: %s" + u, err := url.Parse(uri) + if err != nil { + return "", fmt.Errorf(errMsg, err.Error()) + } + + cr := bytes.NewBufferString("") + if accountName != storageEmulatorAccountName { + cr.WriteString("/") + cr.WriteString(getCanonicalizedAccountName(accountName)) + } + + if len(u.Path) > 0 { + // Any portion of the CanonicalizedResource string that is derived from + // the resource's URI should be encoded exactly as it is in the URI. + // -- https://msdn.microsoft.com/en-gb/library/azure/dd179428.aspx + cr.WriteString(u.EscapedPath()) + } else { + // a slash is required to indicate the root path + cr.WriteString("/") + } + + params, err := url.ParseQuery(u.RawQuery) + if err != nil { + return "", fmt.Errorf(errMsg, err.Error()) + } + + // See https://github.com/Azure/azure-storage-net/blob/master/Lib/Common/Core/Util/AuthenticationUtility.cs#L277 + if keyType == SharedKey { + if len(params) > 0 { + cr.WriteString("\n") + + keys := []string{} + for key := range params { + keys = append(keys, key) + } + sort.Strings(keys) + + completeParams := []string{} + for _, key := range keys { + if len(params[key]) > 1 { + sort.Strings(params[key]) + } + + completeParams = append(completeParams, fmt.Sprintf("%s:%s", key, strings.Join(params[key], ","))) + } + cr.WriteString(strings.Join(completeParams, "\n")) + } + } else { + // search for "comp" parameter, if exists then add it to canonicalizedresource + if v, ok := params["comp"]; ok { + cr.WriteString("?comp=" + v[0]) + } + } + + return string(cr.Bytes()), nil +} + +func getCanonicalizedAccountName(accountName string) string { + // since we may be trying to access a secondary storage account, we need to + // remove the -secondary part of the storage name + return strings.TrimSuffix(accountName, "-secondary") +} + +func buildCanonicalizedString(verb string, headers http.Header, canonicalizedResource string, keyType SharedKeyType) (string, error) { + contentLength := headers.Get(headerContentLength) + if contentLength == "0" { + contentLength = "" + } + date := headers.Get(headerDate) + if v := headers.Get(headerXMSDate); v != "" { + if keyType == SharedKey { + date = "" + } else { + date = v + } + } + var canString string + switch keyType { + case SharedKey: + canString = strings.Join([]string{ + verb, + headers.Get(headerContentEncoding), + headers.Get(headerContentLanguage), + contentLength, + headers.Get(headerContentMD5), + headers.Get(headerContentType), + date, + headers.Get(headerIfModifiedSince), + headers.Get(headerIfMatch), + headers.Get(headerIfNoneMatch), + headers.Get(headerIfUnmodifiedSince), + headers.Get(headerRange), + buildCanonicalizedHeader(headers), + canonicalizedResource, + }, "\n") + case SharedKeyTable: + canString = strings.Join([]string{ + verb, + headers.Get(headerContentMD5), + headers.Get(headerContentType), + date, + canonicalizedResource, + }, "\n") + default: + return "", fmt.Errorf("key type '%s' is not supported", keyType) + } + return canString, nil +} + +func buildCanonicalizedHeader(headers http.Header) string { + cm := make(map[string]string) + + for k := range headers { + headerName := strings.TrimSpace(strings.ToLower(k)) + if strings.HasPrefix(headerName, "x-ms-") { + cm[headerName] = headers.Get(k) + } + } + + if len(cm) == 0 { + return "" + } + + keys := []string{} + for key := range cm { + keys = append(keys, key) + } + + sort.Strings(keys) + + ch := bytes.NewBufferString("") + + for _, key := range keys { + ch.WriteString(key) + ch.WriteRune(':') + ch.WriteString(cm[key]) + ch.WriteRune('\n') + } + + return strings.TrimSuffix(string(ch.Bytes()), "\n") +} + +func createAuthorizationHeader(accountName string, accountKey []byte, canonicalizedString string) string { + h := hmac.New(sha256.New, accountKey) + h.Write([]byte(canonicalizedString)) + signature := base64.StdEncoding.EncodeToString(h.Sum(nil)) + return fmt.Sprintf("%s:%s", getCanonicalizedAccountName(accountName), signature) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/claims/claims.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/claims/claims.go new file mode 100644 index 000000000000..ae02e5fc5a35 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/claims/claims.go @@ -0,0 +1,52 @@ +package claims + +import ( + "encoding/base64" + "encoding/json" + "errors" + "strings" + + "golang.org/x/oauth2" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +// Claims is used to unmarshall the claims from a JWT issued by the Microsoft Identity Platform. +type Claims struct { + Audience string `json:"aud"` + Issuer string `json:"iss"` + IdentityProvider string `json:"idp"` + ObjectId string `json:"oid"` + Roles []string `json:"roles"` + Scopes string `json:"scp"` + Subject string `json:"sub"` + TenantRegionScope string `json:"tenant_region_scope"` + TenantId string `json:"tid"` + Version string `json:"ver"` + + AppDisplayName string `json:"app_displayname,omitempty"` + AppId string `json:"appid,omitempty"` + IdType string `json:"idtyp,omitempty"` +} + +// ParseClaims retrieves and parses the claims from a JWT issued by the Microsoft Identity Platform. +func ParseClaims(token *oauth2.Token) (*Claims, error) { + if token == nil { + return nil, errors.New("token is nil") + } + + jwt := strings.Split(token.AccessToken, ".") + if len(jwt) != 3 { + return nil, errors.New("unexpected token format: does not have 3 parts") + } + + payload, err := base64.RawURLEncoding.DecodeString(jwt[1]) + if err != nil { + return nil, err + } + + var claims Claims + err = json.Unmarshal(payload, &claims) + return &claims, err +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go new file mode 100644 index 000000000000..dd29e0751a18 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go @@ -0,0 +1,569 @@ +package client + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "math" + "net" + "net/http" + "net/url" + "runtime" + "strconv" + "strings" + "time" + + "github.com/hashicorp/go-azure-sdk/sdk/auth" + "github.com/hashicorp/go-azure-sdk/sdk/internal/accept" + "github.com/hashicorp/go-azure-sdk/sdk/odata" + "github.com/hashicorp/go-retryablehttp" +) + +// RetryOn404ConsistencyFailureFunc can be used to retry a request when a 404 response is received +func RetryOn404ConsistencyFailureFunc(resp *http.Response, _ *odata.OData) (bool, error) { + return resp != nil && resp.StatusCode == http.StatusNotFound, nil +} + +// RequestRetryAny wraps multiple RequestRetryFuncs and calls them in turn, returning true if any func returns true +func RequestRetryAny(retryFuncs ...RequestRetryFunc) func(resp *http.Response, o *odata.OData) (bool, error) { + return func(resp *http.Response, o *odata.OData) (retry bool, err error) { + for _, retryFunc := range retryFuncs { + if retryFunc != nil { + retry, err = retryFunc(resp, o) + if err != nil { + return + } + if retry { + return + } + } + } + return false, nil + } +} + +// RequestRetryAll wraps multiple RequestRetryFuncs and calls them in turn, only returning true if all funcs return true +func RequestRetryAll(retryFuncs ...RequestRetryFunc) func(resp *http.Response, o *odata.OData) (bool, error) { + return func(resp *http.Response, o *odata.OData) (retry bool, err error) { + for _, retryFunc := range retryFuncs { + if retryFunc != nil { + retry, err = retryFunc(resp, o) + if err != nil { + return + } + if !retry { + return + } + } + } + return true, nil + } +} + +// RetryableErrorHandler ensures that the response is returned after exhausting retries for a request +// We mustn't return an error here, or net/http will not return the response +func RetryableErrorHandler(resp *http.Response, _ error, _ int) (*http.Response, error) { + return resp, nil +} + +// Request embeds *http.Request and adds useful metadata +type Request struct { + RetryFunc RequestRetryFunc + ValidStatusCodes []int + ValidStatusFunc ValidStatusFunc + + Client BaseClient + + // Embed *http.Request so that we can send this to an *http.Client + *http.Request +} + +func (r *Request) Marshal(payload interface{}) error { + contentType := strings.ToLower(r.Header.Get("Content-Type")) + + if strings.Contains(contentType, "application/json") { + body, err := json.Marshal(payload) + if err == nil { + r.ContentLength = int64(len(body)) + r.Body = io.NopCloser(bytes.NewReader(body)) + } + return nil + } + + if strings.Contains(contentType, "application/xml") || strings.Contains(contentType, "text/xml") { + body, err := xml.Marshal(payload) + if err == nil { + r.ContentLength = int64(len(body)) + r.Body = io.NopCloser(bytes.NewReader(body)) + } + return nil + } + + if strings.Contains(contentType, "application/octet-stream") { + v, ok := payload.([]byte) + if !ok { + return fmt.Errorf("internal-error: `payload` must be []byte but got %+v", payload) + } + + r.ContentLength = int64(len(v)) + r.Body = io.NopCloser(bytes.NewReader(v)) + } + + return fmt.Errorf("internal-error: unimplemented marshal function for content type %q", contentType) +} + +func (r *Request) Execute(ctx context.Context) (*Response, error) { + return r.Client.Execute(ctx, r) +} + +func (r *Request) ExecutePaged(ctx context.Context) (*Response, error) { + return r.Client.ExecutePaged(ctx, r) +} + +func (r *Request) IsIdempotent() bool { + switch strings.ToUpper(r.Method) { + case http.MethodGet, http.MethodHead, http.MethodOptions: + return true + } + return false +} + +// Response embeds *http.Response and adds useful methods +type Response struct { + OData *odata.OData + + // Embed *http.Response + *http.Response +} + +func (r *Response) Unmarshal(model interface{}) error { + if model == nil { + return fmt.Errorf("model was nil") + } + + contentType := strings.ToLower(r.Header.Get("Content-Type")) + if contentType == "" { + // some APIs (e.g. Storage Data Plane) don't return a content type... so we'll assume from the Accept header + acc, err := accept.FromString(r.Request.Header.Get("Accept")) + if err != nil { + if preferred := acc.FirstChoice(); preferred != nil { + contentType = preferred.ContentType + } + } + if contentType == "" { + // fall back on request media type + contentType = strings.ToLower(r.Request.Header.Get("Content-Type")) + } + } + if strings.Contains(contentType, "application/json") { + // Read the response body and close it + respBody, err := io.ReadAll(r.Body) + if err != nil { + return fmt.Errorf("parsing response body: %+v", err) + } + r.Body.Close() + + // Trim away a BOM if present + respBody = bytes.TrimPrefix(respBody, []byte("\xef\xbb\xbf")) + + // Unmarshal into provided model + if err := json.Unmarshal(respBody, model); err != nil { + return fmt.Errorf("unmarshaling response body: %+v", err) + } + + // Reassign the response body as downstream code may expect it + r.Body = io.NopCloser(bytes.NewBuffer(respBody)) + } + + if strings.Contains(contentType, "application/xml") || strings.Contains(contentType, "text/xml") { + // Read the response body and close it + respBody, err := io.ReadAll(r.Body) + if err != nil { + return fmt.Errorf("could not parse response body") + } + r.Body.Close() + + // Trim away a BOM if present + respBody = bytes.TrimPrefix(respBody, []byte("\xef\xbb\xbf")) + + // Unmarshal into provided model + if err := xml.Unmarshal(respBody, model); err != nil { + return err + } + + // Reassign the response body as downstream code may expect it + r.Body = io.NopCloser(bytes.NewBuffer(respBody)) + } + + if strings.Contains(contentType, "application/octet-stream") { + if _, ok := model.([]byte); !ok { + return fmt.Errorf("internal-error: `model` must be []byte but got %+v", model) + } + + // Read the response body and close it + respBody, err := io.ReadAll(r.Body) + if err != nil { + return fmt.Errorf("could not parse response body") + } + r.Body.Close() + + // Trim away a BOM if present + respBody = bytes.TrimPrefix(respBody, []byte("\xef\xbb\xbf")) + + // copy the byte stream across + model = respBody + + // Reassign the response body as downstream code may expect it + r.Body = io.NopCloser(bytes.NewBuffer(respBody)) + } + + return nil +} + +// Client is a base client to be used by API-specific clients. It satisfies the BaseClient interface. +type Client struct { + // BaseUri is the base endpoint for this API. + BaseUri string + + // UserAgent is the HTTP user agent string to send in requests. + UserAgent string + + // CorrelationId is a custom correlation ID which can be added to requests for tracing purposes + CorrelationId string + + // Authorizer is anything that can provide an access token with which to authorize requests. + Authorizer auth.Authorizer + + // DisableRetries prevents the client from reattempting failed requests (which it does to work around eventual consistency issues). + // This does not impact handling of retries related to rate limiting, which are always performed. + DisableRetries bool + + // RequestMiddlewares is a slice of functions that are called in order before a request is sent + RequestMiddlewares *[]RequestMiddleware + + // ResponseMiddlewares is a slice of functions that are called in order before a response is parsed and returned + ResponseMiddlewares *[]ResponseMiddleware +} + +// NewClient returns a new Client configured with sensible defaults +func NewClient(baseUri string, serviceName, apiVersion string) *Client { + segments := []string{ + "Go-http-Client/1.1", + fmt.Sprintf("%s/%s", serviceName, apiVersion), + } + return &Client{ + BaseUri: baseUri, + UserAgent: fmt.Sprintf("HashiCorp/go-azure-sdk (%s)", strings.Join(segments, " ")), + } +} + +// NewRequest configures a new *Request +func (c *Client) NewRequest(ctx context.Context, input RequestOptions) (*Request, error) { + req := (&http.Request{}).WithContext(ctx) + + req.Method = input.HttpMethod + + req.Header = make(http.Header) + req.Header.Add("Content-Type", input.ContentType) + + if c.UserAgent != "" { + req.Header.Add("User-Agent", c.UserAgent) + } + if c.CorrelationId != "" { + req.Header.Add("X-Ms-Correlation-Request-Id", c.CorrelationId) + } + + path := strings.TrimPrefix(input.Path, "/") + u, err := url.ParseRequestURI(fmt.Sprintf("%s/%s", c.BaseUri, path)) + if err != nil { + return nil, err + } + + req.Host = u.Host + req.URL = u + + ret := Request{ + Client: c, + Request: req, + ValidStatusCodes: input.ExpectedStatusCodes, + } + + return &ret, nil +} + +// Execute is used by the package to send an HTTP request to the API +func (c *Client) Execute(ctx context.Context, req *Request) (*Response, error) { + if req.Request == nil { + return nil, fmt.Errorf("req.Request was nil") + } + + // at this point we're ready to send the HTTP Request, as such let's get the Authorization token + // and add that to the request + if c.Authorizer != nil { + token, err := c.Authorizer.Token(ctx, req.Request) + if err != nil { + return nil, err + } + token.SetAuthHeader(req.Request) + } + + var err error + + // Check we can read the request body and set a default empty body + var reqBody []byte + if req.Body != nil { + reqBody, err = io.ReadAll(req.Body) + if err != nil { + return nil, fmt.Errorf("reading request body: %v", err) + } + req.Body = io.NopCloser(bytes.NewBuffer(reqBody)) + req.Header.Set("Content-Length", fmt.Sprintf("%d", req.ContentLength)) + } + + // Instantiate a RetryableHttp client and configure its CheckRetry func + r := c.retryableClient(func(ctx context.Context, r *http.Response, err error) (bool, error) { + // First check for badly malformed responses + if r == nil { + if req.IsIdempotent() { + return true, nil + } + return false, fmt.Errorf("HTTP response was nil; connection may have been reset") + } + + // Eventual consistency checks + if !c.DisableRetries { + if r.StatusCode == http.StatusFailedDependency { + return true, nil + } + + o, err := odata.FromResponse(r) + if err != nil { + return false, err + } + + if f := req.RetryFunc; f != nil { + shouldRetry, err := f(r, o) + if err != nil || shouldRetry { + return shouldRetry, err + } + } + } + + // Fall back to default retry policy to handle rate limiting, server errors etc. + return retryablehttp.DefaultRetryPolicy(ctx, r, err) + }) + + // Derive an *http.Client for sending the request + client := r.StandardClient() + + // Configure any RequestMiddlewares + if c.RequestMiddlewares != nil { + for _, m := range *c.RequestMiddlewares { + r, err := m(req.Request) + if err != nil { + return nil, err + } + req.Request = r + } + } + + // Send the request + resp := &Response{} + resp.Response, err = client.Do(req.Request) + if err != nil { + return resp, err + } + if resp.Response == nil { + return resp, fmt.Errorf("HTTP response was nil; connection may have been reset") + } + + // Configure any ResponseMiddlewares + if c.ResponseMiddlewares != nil { + for _, m := range *c.ResponseMiddlewares { + r, err := m(req.Request, resp.Response) + if err != nil { + return resp, err + } + resp.Response = r + } + } + + // Extract OData from response + var o *odata.OData + resp.OData, err = odata.FromResponse(resp.Response) + if err != nil { + return resp, err + } + if resp == nil { + return resp, fmt.Errorf("nil response received") + } + + // Determine whether response status is valid + if !containsStatusCode(req.ValidStatusCodes, resp.StatusCode) { + if f := req.ValidStatusFunc; f != nil && f(resp.Response, o) { + return resp, nil + } + + // Determine suitable error text + var errText string + switch { + case o != nil && o.Error != nil && o.Error.String() != "": + errText = fmt.Sprintf("error: %s", o.Error) + + default: + defer resp.Body.Close() + + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return resp, fmt.Errorf("unexpected status %d, could not read response body", resp.StatusCode) + } + if len(respBody) == 0 { + return resp, fmt.Errorf("unexpected status %d received with no body", resp.StatusCode) + } + + errText = fmt.Sprintf("response: %s", respBody) + } + + return resp, fmt.Errorf("unexpected status %d with %s", resp.StatusCode, errText) + } + + return resp, nil +} + +// ExecutePaged automatically pages through the results of Execute +func (c *Client) ExecutePaged(ctx context.Context, req *Request) (*Response, error) { + // Perform the request + resp, err := c.Execute(ctx, req) + if err != nil { + return resp, err + } + + // Check for json content before handling pagination + contentType := strings.ToLower(resp.Header.Get("Content-Type")) + if !strings.HasPrefix(contentType, "application/json") { + return resp, fmt.Errorf("unsupported content-type %q received, only application/json is supported for paged results", contentType) + } + + // Read the response body and close it + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return resp, fmt.Errorf("could not parse response body") + } + resp.Body.Close() + + // Unmarshal firstOdata + var firstOdata odata.OData + if err := json.Unmarshal(respBody, &firstOdata); err != nil { + return resp, err + } + + firstValue, ok := firstOdata.Value.([]interface{}) + if firstOdata.NextLink == nil || firstValue == nil || !ok { + // No more pages, reassign response body and return + resp.Body = io.NopCloser(bytes.NewBuffer(respBody)) + return resp, nil + } + + // Get the next page, recursively + // TODO: may have to accommodate APIs with nonstandard paging + nextReq := req + u, err := url.Parse(string(*firstOdata.NextLink)) + if err != nil { + return resp, err + } + nextReq.URL = u + nextResp, err := c.ExecutePaged(ctx, req) + if err != nil { + return resp, err + } + + // Read the next page response body and close it + nextRespBody, err := io.ReadAll(nextResp.Body) + if err != nil { + return resp, fmt.Errorf("could not parse response body") + } + nextResp.Body.Close() + + // Unmarshal nextOdata from the next page + var nextOdata odata.OData + if err := json.Unmarshal(nextRespBody, &nextOdata); err != nil { + return nextResp, err + } + + // When next page has results, append to current page + if nextValue, ok := nextOdata.Value.([]interface{}); ok { + value := append(firstValue, nextValue...) + nextOdata.Value = &value + } + + // Marshal the entire result, along with fields from the final page + newJson, err := json.Marshal(nextOdata) + if err != nil { + return nextResp, err + } + + // Reassign the response body + resp.Body = io.NopCloser(bytes.NewBuffer(newJson)) + + return resp, nil +} + +// retryableClient instantiates a new *retryablehttp.Client having the provided checkRetry func +func (c *Client) retryableClient(checkRetry retryablehttp.CheckRetry) (r *retryablehttp.Client) { + r = retryablehttp.NewClient() + + r.Backoff = func(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration { + if resp != nil { + // Always look for Retry-After header + if s, ok := resp.Header["Retry-After"]; ok { + if sleep, err := strconv.ParseInt(s[0], 10, 64); err == nil { + return time.Second * time.Duration(sleep) + } + } + } + + // Default exponential backoff + mult := math.Pow(2, float64(attemptNum)) * float64(min) + sleep := time.Duration(mult) + if float64(sleep) != mult || sleep > max { + sleep = max + } + return sleep + } + + r.CheckRetry = checkRetry + r.ErrorHandler = RetryableErrorHandler + r.Logger = nil + + r.HTTPClient = &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { + d := &net.Dialer{Resolver: &net.Resolver{}} + return d.DialContext(ctx, network, addr) + }, + MaxIdleConns: 100, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 1 * time.Second, + ForceAttemptHTTP2: true, + MaxIdleConnsPerHost: runtime.GOMAXPROCS(0) + 1, + }, + } + + return +} + +// containsStatusCode determines whether the returned status code is in the []int of expected status codes. +func containsStatusCode(expected []int, actual int) bool { + for _, v := range expected { + if actual == v { + return true + } + } + + return false +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/interface.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/interface.go new file mode 100644 index 000000000000..78061c92286e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/interface.go @@ -0,0 +1,26 @@ +package client + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +type BaseClient interface { + Execute(ctx context.Context, req *Request) (*Response, error) + ExecutePaged(ctx context.Context, req *Request) (*Response, error) + NewRequest(ctx context.Context, input RequestOptions) (*Request, error) +} + +// RequestRetryFunc is a function that determines whether an HTTP request has failed due to eventual consistency and should be retried +type RequestRetryFunc func(*http.Response, *odata.OData) (bool, error) + +// RequestMiddleware can manipulate or log a request before it is sent +type RequestMiddleware func(*http.Request) (*http.Request, error) + +// ResponseMiddleware can manipulate or log a response before it is parsed and returned +type ResponseMiddleware func(*http.Request, *http.Response) (*http.Response, error) + +// ValidStatusFunc is a function that tests whether an HTTP response is considered valid for the particular request. +type ValidStatusFunc func(*http.Response, *odata.OData) bool diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/msgraph/client.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/msgraph/client.go new file mode 100644 index 000000000000..9e4a430749bc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/msgraph/client.go @@ -0,0 +1,91 @@ +package msgraph + +import ( + "context" + "fmt" + "net/url" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +var _ client.BaseClient = &Client{} + +type ApiVersion string + +const ( + VersionOnePointZero ApiVersion = "v1.0" + VersionBeta ApiVersion = "beta" +) + +type Client struct { + *client.Client + + // EnableRetries allows reattempting failed requests to work around eventual consistency issues + // Note that 429 responses are always handled by the base client regardless of this setting + EnableRetries bool + + // apiVersion specifies the version of the API being used, either "beta" or "v1.0" + apiVersion ApiVersion + + // tenantId is the tenant ID to use in requests + tenantId string +} + +func NewMsGraphClient(api environments.Api, apiVersion ApiVersion) (*Client, error) { + endpoint, ok := api.Endpoint() + if !ok { + return nil, fmt.Errorf("no `endpoint` was returned for this environment") + } + baseUri := fmt.Sprintf("%s/%s", *endpoint, apiVersion) + baseClient := client.NewClient(baseUri, "MicrosoftGraph", string(apiVersion)) + return &Client{ + Client: baseClient, + EnableRetries: true, + apiVersion: apiVersion, + }, nil +} + +func (c *Client) NewRequest(ctx context.Context, input client.RequestOptions) (*client.Request, error) { + if _, ok := ctx.Deadline(); !ok { + return nil, fmt.Errorf("the context used must have a deadline attached for polling purposes, but got no deadline") + } + if err := input.Validate(); err != nil { + return nil, fmt.Errorf("pre-validating request payload: %+v", err) + } + + req, err := c.Client.NewRequest(ctx, input) + if err != nil { + return nil, fmt.Errorf("building %s request: %+v", input.HttpMethod, err) + } + + req.Client = c + query := url.Values{} + + if input.OptionsObject != nil { + if h := input.OptionsObject.ToHeaders(); h != nil { + for k, v := range h.Headers() { + req.Header[k] = v + } + } + + if q := input.OptionsObject.ToQuery(); q != nil { + for k, v := range q.Values() { + // we intentionally only add one of each type + query.Del(k) + query.Add(k, v[0]) + } + } + + if o := input.OptionsObject.ToOData(); o != nil { + req.Header = o.AppendHeaders(req.Header) + query = o.AppendValues(query) + } + } + + req.URL.RawQuery = query.Encode() + //req.RetryFunc = client.RequestRetryAny(defaultRetryFunctions...) + req.ValidStatusCodes = input.ExpectedStatusCodes + + return req, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/options.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/options.go new file mode 100644 index 000000000000..048fe972111b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/options.go @@ -0,0 +1,108 @@ +package client + +import ( + "net/http" + "net/url" + + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +type Options interface { + ToHeaders() *Headers + ToOData() *odata.Query + ToQuery() *QueryParams +} + +// Headers is a representation of the HTTP headers to be sent with a Request +type Headers struct { + vals map[string]string +} + +// AppendHeader appends the http.Header values +func (h *Headers) AppendHeader(h2 http.Header) { + if h.vals == nil { + h.vals = map[string]string{} + } + for k, v := range h2 { + if len(v) > 0 { + h.vals[k] = v[0] + } + } +} + +// Append sets a single header value +func (h *Headers) Append(key, value string) { + if h.vals == nil { + h.vals = map[string]string{} + } + h.vals[key] = value +} + +// Merge copies the header values from h2, overwriting as necessary +func (h *Headers) Merge(h2 Headers) { + if h.vals == nil { + h.vals = map[string]string{} + } + if h2.vals == nil { + return + } + for k, v := range h2.vals { + h.vals[k] = v + } +} + +// Headers returns an http.Headers map containing header values +func (h *Headers) Headers() http.Header { + out := make(http.Header) + for k, v := range h.vals { + out.Add(k, v) + } + return out +} + +// QueryParams is a representation of the URL query parameters to be sent with a Request +type QueryParams struct { + vals map[string]string +} + +// AppendValues appends the url.Values values +func (q *QueryParams) AppendValues(q2 url.Values) { + if q.vals == nil { + q.vals = map[string]string{} + } + for k, v := range q2 { + if len(v) > 0 { + q.vals[k] = v[0] + } + } +} + +// Append sets a single query parameter value +func (q *QueryParams) Append(key, value string) { + if q.vals == nil { + q.vals = map[string]string{} + } + q.vals[key] = value +} + +// Merge copies the query parameter values from q2, overwriting as necessary +func (q *QueryParams) Merge(q2 Headers) { + if q.vals == nil { + q.vals = map[string]string{} + } + if q2.vals == nil { + return + } + for k, v := range q2.vals { + q.vals[k] = v + } +} + +// Values returns a url.Values map containing query parameter values +func (q *QueryParams) Values() url.Values { + va := make(url.Values) + for k, v := range q.vals { + va.Set(k, v) + } + return va +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/pollers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/pollers/README.md new file mode 100644 index 000000000000..bb0ca4eb3ff8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/pollers/README.md @@ -0,0 +1,7 @@ +# Package: `github.com/hashicorp/go-azure-sdk/sdk/client/pollers` + +This package contains both the components for Pollers, which allow an operation to be continually polled until it's either Completed, Cancelled or Failed. + +Since Pollers are specific to the API in question, this package only contains the interface each poller needs to implement. + +Specific implementations for each type of API can be found within the package for that API, for example a Poller for Long Running Operations within Azure Resource Manager can be found in `github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager`. diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/pollers/interface.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/pollers/interface.go new file mode 100644 index 000000000000..26ea74fad725 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/pollers/interface.go @@ -0,0 +1,108 @@ +package pollers + +import ( + "context" + "fmt" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "time" +) + +// PollerType allows custom pollers to be created to determine when a particular Operation has +// been Completed, Cancelled or Failed. +type PollerType interface { + // Poll performs a poll to determine whether the Operation has been Completed/Cancelled or Failed. + // Behaviourally this method should: + // 1. Perform a single poll, and assume that it will be called again after the PollInterval + // defined within the PollResult. + // 2. When the operation is still in progress, a PollResult should be returned with the Status + // `InProgress` and the next PollInterval. + // 3. When the operation is Completed, a PollResult should be returned with the Status + // `Succeeded`. + // 4. When the operation is Cancelled a PollingCancelledError should be returned. + // 5. When the operation Fails a PollingFailedError should be returned. + Poll(ctx context.Context) (*PollResult, error) +} + +type PollResult struct { + // HttpResponse is a copy of the HttpResponse returned from the API in the last request. + HttpResponse *client.Response + + // PollInterval specifies the interval until this poller should be called again. + PollInterval time.Duration + + // Status specifies the polling status of this resource at the time of the last request. + Status PollingStatus +} + +type PollingStatus string + +const ( + // PollingStatusCancelled states that the resource change has been cancelled. + PollingStatusCancelled PollingStatus = "Cancelled" + + // PollingStatusFailed states that the resource change has Failed. + PollingStatusFailed PollingStatus = "Failed" + + // PollingStatusInProgress states that the resource change is still occurring/in-progress. + PollingStatusInProgress PollingStatus = "InProgress" + + // PollingStatusSucceeded states that the resource change was successful. + PollingStatusSucceeded PollingStatus = "Succeeded" + + // PollingStatusUnknown states that the resource change state is unknown/unexpected. + PollingStatusUnknown PollingStatus = "Unknown" +) + +var _ error = PollingCancelledError{} + +// PollingCancelledError defines the that the resource change was cancelled (for example, due to a timeout). +type PollingCancelledError struct { + // HttpResponse is a copy of the HttpResponse returned from the API in the last request. + HttpResponse *client.Response + + // Message is a custom error message containing more details + Message string +} + +func (e PollingCancelledError) Error() string { + if e.Message != "" { + return fmt.Sprintf("polling was cancelled: %+v", e.Message) + } + + return fmt.Sprintf("polling was cancelled") +} + +var _ error = PollingDroppedConnectionError{} + +// PollingDroppedConnectionError defines there was a dropped connection when polling for the status. +type PollingDroppedConnectionError struct { + // Message is a custom error message containing more details + Message string +} + +func (e PollingDroppedConnectionError) Error() string { + if e.Message != "" { + return fmt.Sprintf("experienced a dropped connection when polling: %+v", e.Message) + } + + return fmt.Sprintf("experienced a dropped connection when polling") +} + +var _ error = PollingFailedError{} + +// PollingFailedError states that the resource change failed (for example due to a lack of capacity). +type PollingFailedError struct { + // HttpResponse is a copy of the HttpResponse returned from the API in the last request. + HttpResponse *client.Response + + // Message is a custom error message containing more details + Message string +} + +func (e PollingFailedError) Error() string { + if e.Message != "" { + return fmt.Sprintf("polling failed: %+v", e.Message) + } + + return fmt.Sprintf("polling failed") +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/pollers/poller.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/pollers/poller.go new file mode 100644 index 000000000000..5405f20a2ef1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/pollers/poller.go @@ -0,0 +1,209 @@ +package pollers + +import ( + "context" + "fmt" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "sync" + "time" +) + +const DefaultNumberOfDroppedConnectionsToAllow = 3 + +type Poller struct { + // initialDelayDuration specifies the duration of the initial delay when polling + // this is also used for retries should a `latestResponse` not be available, for + // example when a connection is dropped. + initialDelayDuration time.Duration + + // latestError contains the error returned from the latest poll. + latestError error + + // latestResponse contains the polling status from the latest response. + latestResponse *PollResult + + // maxNumberOfDroppedConnections specifies the maximum number of sequential dropped connections before an error is raised. + maxNumberOfDroppedConnections int + + // poller is a reference to the PollerType, for example a LongRunningOperationPoller + // which should be polled to determine the latest state. + poller PollerType +} + +func NewPoller(pollerType PollerType, initialDelayDuration time.Duration, maxNumberOfDroppedConnections int) Poller { + return Poller{ + initialDelayDuration: initialDelayDuration, + maxNumberOfDroppedConnections: maxNumberOfDroppedConnections, + poller: pollerType, + } +} + +// LatestResponse returns the latest HTTP Response returned when polling +func (p *Poller) LatestResponse() *client.Response { + if p.latestError != nil { + if v, ok := p.latestError.(PollingCancelledError); ok { + return v.HttpResponse + } + if _, ok := p.latestError.(PollingDroppedConnectionError); ok { + return nil + } + if v, ok := p.latestError.(PollingFailedError); ok { + return v.HttpResponse + } + + if p.latestError == context.DeadlineExceeded { + return nil + } + } + + if p.latestResponse == nil { + return nil + } + + return p.latestResponse.HttpResponse +} + +// LatestStatus returns the latest status returned when polling +func (p *Poller) LatestStatus() PollingStatus { + if p.latestError != nil { + if _, ok := p.latestError.(PollingCancelledError); ok { + return PollingStatusCancelled + } + if _, ok := p.latestError.(PollingDroppedConnectionError); ok { + // we could look to expose a status for this, but we likely wouldn't handle this any differently + // to it being unknown, so I (@tombuildsstuff) think this is reasonable for now? + return PollingStatusUnknown + } + if _, ok := p.latestError.(PollingFailedError); ok { + return PollingStatusFailed + } + if p.latestError == context.DeadlineExceeded { + return PollingStatusUnknown + } + } + + if p.latestResponse == nil { + return PollingStatusUnknown + } + + return p.latestResponse.Status +} + +// PollUntilDone polls until the poller determines that the operation has been completed +func (p *Poller) PollUntilDone(ctx context.Context) error { + if p.poller == nil { + return fmt.Errorf("internal-error: `poller` was nil`") + } + if _, ok := ctx.Deadline(); !ok { + return fmt.Errorf("internal-error: `ctx` should have a deadline") + } + + var wait sync.WaitGroup + wait.Add(1) + + go func() { + connectionDropCounter := 0 + retryDuration := p.initialDelayDuration + for true { + // determine the next retry duration / how long to poll for + if p.latestResponse != nil { + retryDuration = p.latestResponse.PollInterval + } + endTime := time.Now().Add(retryDuration) + select { + case <-time.After(time.Until(endTime)): + { + break + } + } + + p.latestResponse, p.latestError = p.poller.Poll(ctx) + + // first check the connection drop status + connectionHasBeenDropped := false + if p.latestResponse == nil && p.latestError == nil { + // connection drops can either have no response/error (where we have no context) + connectionHasBeenDropped = true + } else if _, ok := p.latestError.(PollingDroppedConnectionError); ok { + // or have an error with more details (e.g. server not found, connection reset etc) + connectionHasBeenDropped = true + } + if connectionHasBeenDropped { + connectionDropCounter++ + if connectionDropCounter < p.maxNumberOfDroppedConnections { + continue + } + if p.latestResponse == nil && p.latestError == nil { + // the connection was dropped, but we have no context + p.latestError = PollingDroppedConnectionError{} + break + } + } else { + connectionDropCounter = 0 + } + + if p.latestError != nil { + break + } + + if response := p.latestResponse; response != nil { + retryDuration = response.PollInterval + + done := false + switch response.Status { + // Cancelled, Dropped Connections and Failed should be raised as errors containing additional info if available + + case PollingStatusCancelled: + p.latestError = fmt.Errorf("internal-error: a polling status of `Cancelled` should be surfaced as a PollingCancelledError") + done = true + break + + case PollingStatusFailed: + p.latestError = fmt.Errorf("internal-error: a polling status of `Failed` should be surfaced as a PollingFailedError") + done = true + break + + case PollingStatusInProgress: + continue + + case PollingStatusSucceeded: + done = true + break + + default: + p.latestError = fmt.Errorf("internal-error: unimplemented polling status %q", string(response.Status)) + done = true + break + } + + if done { + break + } + } + } + wait.Done() + }() + + waitDone := make(chan struct{}, 1) + go func() { + wait.Wait() + waitDone <- struct{}{} + }() + + select { + case <-waitDone: + break + case <-ctx.Done(): + { + p.latestResponse = nil + p.latestError = ctx.Err() + return p.latestError + } + } + + if p.latestError != nil { + p.latestResponse = nil + } + + return p.latestError +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/request_options.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/request_options.go new file mode 100644 index 000000000000..7b5941178e88 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/request_options.go @@ -0,0 +1,27 @@ +package client + +import "fmt" + +type RequestOptions struct { + ContentType string + ExpectedStatusCodes []int + HttpMethod string + OptionsObject Options + Path string +} + +func (ro RequestOptions) Validate() error { + if ro.ContentType == "" { + return fmt.Errorf("missing `ContentType`") + } + if len(ro.ExpectedStatusCodes) == 0 { + return fmt.Errorf("missing `ExpectedStatusCodes`") + } + if ro.HttpMethod == "" { + return fmt.Errorf("missing `HttpMethod`") + } + if ro.Path == "" { + return fmt.Errorf("missing `Path`") + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/client.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/client.go new file mode 100644 index 000000000000..f0c158569d83 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/client.go @@ -0,0 +1,82 @@ +package resourcemanager + +import ( + "context" + "fmt" + "net/url" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +var _ client.BaseClient = &Client{} + +type Client struct { + *client.Client + + // apiVersion specifies the version of the API being used, which (by design) will be consistent across a client + // as we intentionally split out multiple API Versions into different clients, rather than using composite API + // Versions/packages which can cause confusion about which version is being used. + apiVersion string +} + +func NewResourceManagerClient(api environments.Api, serviceName, apiVersion string) (*Client, error) { + endpoint, ok := api.Endpoint() + if !ok { + return nil, fmt.Errorf("no `endpoint` was returned for this environment") + } + baseClient := client.NewClient(*endpoint, serviceName, apiVersion) + return &Client{ + Client: baseClient, + apiVersion: apiVersion, + }, nil +} + +func (c *Client) NewRequest(ctx context.Context, input client.RequestOptions) (*client.Request, error) { + if _, ok := ctx.Deadline(); !ok { + return nil, fmt.Errorf("the context used must have a deadline attached for polling purposes, but got no deadline") + } + if err := input.Validate(); err != nil { + return nil, fmt.Errorf("pre-validating request payload: %+v", err) + } + + req, err := c.Client.NewRequest(ctx, input) + if err != nil { + return nil, fmt.Errorf("building %s request: %+v", input.HttpMethod, err) + } + + req.Client = c + query := url.Values{} + + // there's a handful of cases (e.g. Network, LRO's) where we want to override this on a per-request basis via the options object + if c.apiVersion != "" { + query.Set("api-version", c.apiVersion) + } + + if input.OptionsObject != nil { + if h := input.OptionsObject.ToHeaders(); h != nil { + for k, v := range h.Headers() { + req.Header[k] = v + } + } + + if q := input.OptionsObject.ToQuery(); q != nil { + for k, v := range q.Values() { + // we intentionally only add one of each type + query.Del(k) + query.Add(k, v[0]) + } + } + + if o := input.OptionsObject.ToOData(); o != nil { + req.Header = o.AppendHeaders(req.Header) + query = o.AppendValues(query) + } + } + + req.URL.RawQuery = query.Encode() + req.RetryFunc = client.RequestRetryAny(defaultRetryFunctions...) + req.ValidStatusCodes = input.ExpectedStatusCodes + + return req, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller.go new file mode 100644 index 000000000000..70b27ce976cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller.go @@ -0,0 +1,50 @@ +package resourcemanager + +import ( + "fmt" + "net/http" + "strings" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" +) + +func PollerFromResponse(response *client.Response, client *Client) (poller pollers.Poller, err error) { + if response == nil { + return pollers.Poller{}, fmt.Errorf("no HTTP Response was returned") + } + + // If this is a LRO we should either have a 201/202 with a Polling URI header + isLroStatus := response.StatusCode == http.StatusCreated || response.StatusCode == http.StatusAccepted + lroPollingUri := pollingUriForLongRunningOperation(response) + if isLroStatus && lroPollingUri != "" { + lro, lroErr := longRunningOperationPollerFromResponse(response, client.Client) + if lroErr != nil { + err = lroErr + return pollers.Poller{}, fmt.Errorf("building long-running-operation poller: %+v", lroErr) + } + return pollers.NewPoller(lro, lro.initialRetryDuration, pollers.DefaultNumberOfDroppedConnectionsToAllow), nil + } + + // or we should be polling on the `provisioningState` of the resource + contentType := response.Header.Get("Content-Type") + if contentType == "" && response.Request != nil { + contentType = response.Request.Header.Get("Content-Type") + } + + statusCodesToCheckProvisioningState := response.StatusCode == http.StatusOK || response.StatusCode == http.StatusCreated + contentTypeMatchesForProvisioningStateCheck := strings.Contains(strings.ToLower(contentType), "application/json") + methodIsApplicable := strings.EqualFold(response.Request.Method, "PATCH") || + strings.EqualFold(response.Request.Method, "POST") || + strings.EqualFold(response.Request.Method, "PUT") + if statusCodesToCheckProvisioningState && contentTypeMatchesForProvisioningStateCheck && methodIsApplicable { + provisioningState, provisioningStateErr := provisioningStatePollerFromResponse(response, client, DefaultProvisioningStatePollingInterval) + if provisioningStateErr != nil { + err = provisioningStateErr + return pollers.Poller{}, fmt.Errorf("building provisioningState poller: %+v", provisioningStateErr) + } + return pollers.NewPoller(provisioningState, provisioningState.initialRetryDuration, pollers.DefaultNumberOfDroppedConnectionsToAllow), nil + } + + return pollers.Poller{}, fmt.Errorf("no applicable pollers were found for the response") +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_lro.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_lro.go new file mode 100644 index 000000000000..5fd837623f34 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_lro.go @@ -0,0 +1,185 @@ +package resourcemanager + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + "strconv" + "strings" + "time" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" +) + +var _ pollers.PollerType = &longRunningOperationPoller{} + +type longRunningOperationPoller struct { + client *client.Client + count int + initialRetryDuration time.Duration + originalUrl *url.URL + pollingUrl *url.URL +} + +func pollingUriForLongRunningOperation(resp *client.Response) string { + pollingUrl := resp.Header.Get(http.CanonicalHeaderKey("Azure-AsyncOperation")) + if pollingUrl == "" { + pollingUrl = resp.Header.Get("Location") + } + return pollingUrl +} + +func longRunningOperationPollerFromResponse(resp *client.Response, client *client.Client) (*longRunningOperationPoller, error) { + poller := longRunningOperationPoller{ + client: client, + initialRetryDuration: 10 * time.Second, + } + + pollingUrl := pollingUriForLongRunningOperation(resp) + if pollingUrl == "" { + return nil, fmt.Errorf("no polling URL found in response") + } + + u, err := url.Parse(pollingUrl) + if err != nil { + return nil, fmt.Errorf("invalid polling URL %q in response: %v", pollingUrl, err) + } + if !u.IsAbs() { + return nil, fmt.Errorf("invalid polling URL %q in response: URL was not absolute", pollingUrl) + } + poller.pollingUrl = u + if endpoint, err := url.Parse(string(client.BaseUri)); err == nil && u.Host != endpoint.Host { + return nil, fmt.Errorf("unsupported polling URL %q: client endpoint is different", pollingUrl) + } + + if resp.Request != nil { + poller.originalUrl = resp.Request.URL + } + + if s, ok := resp.Header["Retry-After"]; ok { + if sleep, err := strconv.ParseInt(s[0], 10, 64); err == nil { + poller.initialRetryDuration = time.Second * time.Duration(sleep) + } + } + + return &poller, nil +} + +func (p *longRunningOperationPoller) Poll(ctx context.Context) (result *pollers.PollResult, err error) { + p.count++ + + if p.pollingUrl == nil { + return nil, fmt.Errorf("internal error: cannot poll without a pollingUrl") + } + + reqOpts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + http.StatusCreated, + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodGet, + OptionsObject: nil, + Path: p.pollingUrl.Path, + } + + // TODO: port over the `api-version` header + + req, err := p.client.NewRequest(ctx, reqOpts) + if err != nil { + return nil, fmt.Errorf("building request for long-running-operation: %+v", err) + } + req.URL.RawQuery = p.pollingUrl.RawQuery + + // Custom RetryFunc to inspect the operation payload and check the status + req.RetryFunc = client.RequestRetryAny(defaultRetryFunctions...) + + result = &pollers.PollResult{} + result.HttpResponse, err = req.Execute(ctx) + if err != nil { + return nil, err + } + + if result.HttpResponse != nil { + var respBody []byte + respBody, err = io.ReadAll(result.HttpResponse.Body) + if err != nil { + err = fmt.Errorf("parsing response body: %+v", err) + return + } + result.HttpResponse.Body.Close() + + // 202's don't necessarily return a body, so there's nothing to deserialize + if result.HttpResponse.StatusCode == http.StatusAccepted { + result.Status = pollers.PollingStatusInProgress + return + } + + contentType := result.HttpResponse.Header.Get("Content-Type") + + var op operationResult + if strings.Contains(strings.ToLower(contentType), "application/json") { + if err = json.Unmarshal(respBody, &op); err != nil { + err = fmt.Errorf("unmarshalling response body: %+v", err) + return + } + } else { + return nil, fmt.Errorf("internal-error: polling support for the Content-Type %q was not implemented: %+v", contentType, err) + } + + if op.Properties.ProvisioningState == "" && op.Status == "" { + return nil, fmt.Errorf("expected either `provisioningState` or `status` to be returned from the LRO API but both were empty") + } + + // TODO: raising an error if this is Cancelled or Failed + + statuses := map[status]pollers.PollingStatus{ + statusCanceled: pollers.PollingStatusCancelled, + statusCancelled: pollers.PollingStatusCancelled, + statusFailed: pollers.PollingStatusFailed, + statusInProgress: pollers.PollingStatusInProgress, + statusSucceeded: pollers.PollingStatusSucceeded, + } + for k, v := range statuses { + if strings.EqualFold(string(op.Properties.ProvisioningState), string(k)) { + result.Status = v + return + } + if strings.EqualFold(string(op.Status), string(k)) { + result.Status = v + return + } + } + } + + return +} + +type operationResult struct { + Name *string `json:"name"` + StartTime *time.Time `json:"startTime"` + + Properties struct { + // Some APIs (such as Storage) return the Resource Representation from the LRO API, as such we need to check provisioningState + ProvisioningState status `json:"provisioningState"` + } `json:"properties"` + + // others return Status, so we check that too + Status status `json:"status"` +} + +type status string + +const ( + statusCanceled status = "Canceled" + statusCancelled status = "Cancelled" + statusFailed status = "Failed" + statusInProgress status = "InProgress" + statusSucceeded status = "Succeeded" +) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_provisioning_state.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_provisioning_state.go new file mode 100644 index 000000000000..708460cd1c87 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_provisioning_state.go @@ -0,0 +1,182 @@ +package resourcemanager + +import ( + "context" + "fmt" + "net/http" + "net/url" + "strings" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +const DefaultProvisioningStatePollingInterval = 2 * time.Second + +var _ pollers.PollerType = &provisioningStatePoller{} + +type provisioningStatePoller struct { + apiVersion string + client *Client + initialRetryDuration time.Duration + originalUri string + resourcePath string +} + +func provisioningStatePollerFromResponse(response *client.Response, client *Client, pollingInterval time.Duration) (*provisioningStatePoller, error) { + // if we've gotten to this point then we're polling against a Resource Manager resource/operation of some kind + // we next need to determine if the current URI is a Resource Manager resource, or if we should be polling on the + // resource (e.g. `/my/resource`) rather than an operation on the resource (e.g. `/my/resource/start`) + if response.Request == nil { + return nil, fmt.Errorf("request was nil") + } + originalUri := response.Request.URL.RequestURI() + if response.Request.URL == nil { + return nil, fmt.Errorf("request url was nil") + } + + // all Resource Manager operations require the `api-version` querystring + apiVersion := response.Request.URL.Query().Get("api-version") + if apiVersion == "" { + return nil, fmt.Errorf("unable to determine `api-version` from %q", originalUri) + } + + resourcePath, err := resourceManagerResourcePathFromUri(originalUri) + if err != nil { + return nil, fmt.Errorf("determining Resource Manager Resource Path from %q: %+v", originalUri, err) + } + + return &provisioningStatePoller{ + apiVersion: apiVersion, + client: client, + initialRetryDuration: pollingInterval, + originalUri: originalUri, + resourcePath: *resourcePath, + }, nil +} + +func (p *provisioningStatePoller) Poll(ctx context.Context) (*pollers.PollResult, error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: provisioningStateOptions{ + apiVersion: p.apiVersion, + }, + Path: p.resourcePath, + } + req, err := p.client.NewRequest(ctx, opts) + if err != nil { + return nil, fmt.Errorf("building request: %+v", err) + } + resp, err := p.client.Execute(ctx, req) + if err != nil { + return nil, fmt.Errorf("executing request: %+v", err) + } + if resp == nil { + return nil, pollers.PollingDroppedConnectionError{} + } + + var result provisioningStateResult + if err := resp.Unmarshal(&result); err != nil { + return nil, fmt.Errorf("unmarshaling result: %+v", err) + } + + status := "" + if string(result.Status) != "" { + status = string(result.Status) + } + if string(result.Properties.ProvisioningState) != "" { + status = string(result.Properties.ProvisioningState) + } + if status == "" { + return nil, fmt.Errorf("API didn't return either `provisioningState` or `status`") + } + + if strings.EqualFold(status, string(statusCanceled)) || strings.EqualFold(status, string(statusCancelled)) { + return nil, pollers.PollingCancelledError{ + HttpResponse: resp, + } + } + + if strings.EqualFold(status, string(statusFailed)) { + return nil, pollers.PollingFailedError{ + HttpResponse: resp, + } + } + + if strings.EqualFold(status, string(statusSucceeded)) { + return &pollers.PollResult{ + PollInterval: p.initialRetryDuration, + Status: pollers.PollingStatusSucceeded, + }, nil + } + + // some API's have unique provisioningStates (e.g. Storage Accounts has `ResolvingDns`) + // if we don't recognise it, treat it as a polling status + return &pollers.PollResult{ + PollInterval: p.initialRetryDuration, + Status: pollers.PollingStatusInProgress, + }, nil +} + +type provisioningStateResult struct { + Properties struct { + // Some API's (such as Storage) return the Resource Representation from the LRO API, as such we need to check provisioningState + ProvisioningState status `json:"provisioningState"` + } `json:"properties"` + + // others return Status, so we check that too + Status status `json:"status"` +} + +func resourceManagerResourcePathFromUri(input string) (*string, error) { + parsed, err := url.ParseRequestURI(input) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + segments := strings.Split(strings.TrimPrefix(parsed.Path, "/"), "/") + if len(segments) == 0 { + return nil, fmt.Errorf("polling uri was empty") + } + + // Resources within Resource Manager are always a matching list of key-value pairs + // however Operations against a given resource (e.g. `/start`) will be an uneven pair + // as such, if we have matching pairs, this a Resource + if len(segments)%2 != 0 { + segments = segments[0 : len(segments)-1] + parsed.Path = fmt.Sprintf("/%s", strings.Join(segments, "/")) + } + + if parsed.Path == "/" { + return nil, fmt.Errorf("expected a Resource Manager URI but got %q", parsed.Path) + } + + return pointer.To(parsed.Path), nil +} + +var _ client.Options = provisioningStateOptions{} + +type provisioningStateOptions struct { + apiVersion string +} + +func (p provisioningStateOptions) ToHeaders() *client.Headers { + return &client.Headers{} +} + +func (p provisioningStateOptions) ToOData() *odata.Query { + return &odata.Query{} +} + +func (p provisioningStateOptions) ToQuery() *client.QueryParams { + q := client.QueryParams{} + q.Append("api-version", p.apiVersion) + return &q +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/retry_policies.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/retry_policies.go new file mode 100644 index 000000000000..54914639d0a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/retry_policies.go @@ -0,0 +1,52 @@ +package resourcemanager + +import ( + "fmt" + "net/http" + "strings" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/internal/stringfmt" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// TODO: return a typed error here so that we could potentially change this error/expose this in the Provider +// TODO: the error should return the default error message shown below + +var defaultRetryFunctions = []client.RequestRetryFunc{ + // NOTE: 429 is handled by the base library + handleResourceProviderNotRegistered, +} + +func handleResourceProviderNotRegistered(r *http.Response, o *odata.OData) (bool, error) { + if o != nil && o.Error != nil && o.Error.Code != nil && strings.EqualFold(*o.Error.Code, "MissingSubscriptionRegistration") { + return false, resourceProviderNotRegisteredError(*o.Error.Message) + } + + return false, nil +} + +func resourceProviderNotRegisteredError(message string) error { + messageSplit := stringfmt.QuoteAndSplitString(">", message, 100) + return fmt.Errorf(`The Resource Provider was not registered + +Resource Providers (APIs) in Azure need to be registered before they can be used - however the Resource +Provider was not registered, and calling the API returned the following error: + +%[1]s + +The Azure Provider by default will automatically register certain Resource Providers at launch-time, +whilst it's possible to opt-out of this (which you may have done) + +Please ensure that this Resource Provider is properly registered, you can do this using the Azure CLI +for example to register the Resource Provider "Some.ResourceProvider" is registered run: + +> az provider register --namespace "Some.ResourceProvider" + +Resource Providers can take a while to register, you can check the status by running: + +> az provider show --namespace "Some.ResourceProvider" --query "registrationState" + +Once this outputs "Registered" the Resource Provider is available for use and you can re-run Terraform. +`, strings.Join(messageSplit, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/application_ids.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/application_ids.go new file mode 100644 index 000000000000..07287096e4e0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/application_ids.go @@ -0,0 +1,124 @@ +package environments + +// PublishedApis is a map containing Application IDs for well known APIs published by Microsoft. +// They can be used to acquire access tokens, but are primarily described here for easy inclusion in +// application manifests and service principal assignments. +var PublishedApis = map[string]string{ + "ApiManagement": apiManagementAppId, + "ApplicationInsights": applicationInsightsAppId, + "AttestationService": attestationServiceAppId, + "AzureAdIdentityGovernanceInsights": azureAdIdentityGovernanceInsightsAppId, + "AzureAdIntegratedApp": azureAdIntegratedAppAppId, + "AzureAdNotification": azureAdNotificationAppId, + "AzureAnalysisServices": analysisServicesAppId, + "AzureAppConfiguration": appConfigurationAppId, + "AzureAppService": appServiceAppId, + "AzureBatch": batchAppId, + "AzureContainerRegistry": containerRegistryAppId, + "AzureCosmosDb": cosmosDBAppId, + "AzureDataBricks": dataBricksAppId, + "AzureDataCatalog": dataCatalogAppId, + "AzureDataLake": dataLakeAppId, + "AzureDevOps": azureDevOpsAppId, + "AzureDigitalTwins": digitalTwinsAppId, + "AzureEventHubs": eventHubsAppId, + "AzureHdInsightCluster": hdinsightClusterAppId, + "AzureHealthcare": healthCareAppId, + "AzureIamSupportability": iamSupportabilityAppId, + "AzureImportExport": importExportAppId, + "AzureIotCentral": iotCentralAppId, + "AzureIotHubDeviceProvisioning": iotHubDeviceProvisioningAppId, + "AzureKeyVault": keyVaultAppId, + "AzureKubernetesServiceAadServer": kubernetesServiceAadServerAppId, + "AzureMaps": mapsAppId, + "AzureMediaServices": mediaServicesAppId, + "AzurePortal": portalAppId, + "AzureResourceManager": azureServiceManagementAppId, + "AzureSecurityInsights": securityInsightsAppId, + "AzureServiceBus": serviceBusAppId, + "AzureServiceDeploy": serviceDeployAppId, + "AzureSqlDatabase": sqlDatabaseAppId, + "AzureStackHciService": stackHciServiceAppId, + "AzureStorage": storageAppId, + "AzureStreamAnalytics": streamAnalyticsAppId, + "AzureSynapseGateway": synapseGatewayAppId, + "AzureSynapseStudio": synapseStudioAppId, + "AzureTimeSeriesInsights": timeSeriesInsightsAppId, + "AzureVPN": azureVPNAppId, + "Bing": bingAppId, + "BotFrameworkDevPortal": botFrameworkDevPortalAppId, + "BranchConnectWebService": branchConnectWebServiceAppId, + "CognitiveServices": cognitiveServicesAppId, + "ComputeRecommendationService": computeRecommendationServiceAppId, + "ConnectionsService": connectionsServiceAppId, + "CortanaAtWorkBingServices": cortanaAtWorkBingServicesAppId, + "CortanaAtWorkService": cortanaAtWorkServiceAppId, + "CortanaRuntimeService": cortanaRuntimeServiceAppId, + "CustomerInsights": customerInsightsAppId, + "DataMigrationService": dataMigrationsServiceAppId, + "DomainControllerServices": domainControllerServiceAppId, + "Dynamic365BusinessCentral": dynamic365BusinessCentralAppId, + "Dynamics365DataExportService": dynamics365DataExportServiceAppId, + "DynamicsCrm": dynamicsCRMAppId, + "DynamicsErp": dynamicsERPAppId, + "FlowService": flowServiceAppId, + "GraphConnectorService": graphConnectorServiceAppId, + "InformationProtectionSyncService": informationProtectionSyncServiceAppId, + "InTune": inTuneAppId, + "KustoService": kustoServiceAppId, + "KustoServiceMFA": kustoServiceMFAAppId, + "LogAnalytics": logAnalyticsAppId, + "ManagedHSM": managedHSMAppId, + "MileIqAdminCenter": mileIqAdminCenterAppId, + "MileIqDashboard": mileIqDashboardAppId, + "MileIqRestService": mileIqRestServiceAppId, + "MixedReality": mixedRealityAppId, + "Microsoft365DataAtRestEncryption": microsoft365DataAtRestEncryptionAppId, + "MicrosoftAzureCli": microsoftAzureCliAppId, + "MicrosoftGraph": microsoftGraphAppId, + "MicrosoftInvoicing": microsoftInvoicingAppId, + "MicrosoftOffice": microsoftOfficeAppId, + "MicrosoftStorageSync": microsoftStorageSyncAppId, + "MicrosoftTeams": microsoftTeamsAppId, + "MicrosoftTeamsWebClient": microsoftTeamsWebClientAppId, + "Office365Connectors": office365ConnectorsAppId, + "Office365Demeter": office365DemeterAppId, + "Office365DwEngineV2": office365DwEngineV2AppId, + "Office365ExchangeOnline": office365ExchangeOnlineAppId, + "Office365ExchangeOnlineProtection": office365ExchangeOnlineProtectionAppId, + "Office365InformationProtection": office365InformationProtectionAppId, + "Office365Management": office365ManagementAppId, + "Office365Portal": office365PortalAppId, + "Office365SharePointOnline": office365SharePointOnlineAppId, + "Office365SuiteUx": office365SuiteUxAppId, + "Office365Zoom": office365ZoomAppId, + "OfficeHome": officeHomeAppId, + "OfficeUwpPwa": officeUwpPwaAppId, + "OneNote": oneNoteAppId, + "OneProfileService": oneProfileServiceAppId, + "OssRdbms": ossRDBMSAppId, + "OssRdbmsPostgreSqlFlexibleServerAadAuthentication": ossRdbmsPostgreSqlFlexibleServerAadAuthenticationAppId, + "PeopleCardsService": peopleCardsServiceAppId, + "PolicyAdministrationService": policyAdministrationServiceAppId, + "PowerAppsRuntimeService": powerAppsRuntimeServiceAppId, + "PowerBiService": powerBiServiceAppId, + "Purview": purviewAppId, + "RightsManagementServices": rightsManagementServiceAppId, + "ServiceTrust": serviceTrustAppId, + "Signup": signupAppId, + "SkypeForBusinessOnline": skypeForBusinessOnlineAppId, + "SpeechRecognition": speechRecognitionAppId, + "Synapse": synapseAppId, + "TargetedMessagingService": targetedMessagingServiceAppId, + "TeamsServices": teamsServiceAppId, + "ThreatProtection": threatProtectionAppId, + "TrafficManager": trafficManagerAppId, + "UniversalPrint": universalPrintAppId, + "WindowsDefenderAtp": windowsDefenderAtpAppId, + "WindowsVirtualDesktop": windowsVirtualDesktopAppId, + "Yammer": yammerAppId, + + // Deprecated, remove these when APIs reach final EOL + "AzureActiveDirectoryGraph": "00000002-0000-0000-c000-000000000000", + "AzureServiceManagement": "797f4846-ba00-4fd7-ba43-dac1f8f63013", +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/azure_china.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/azure_china.go new file mode 100644 index 000000000000..f55fcb2b1082 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/azure_china.go @@ -0,0 +1,42 @@ +package environments + +const AzureChinaCloud = "China" + +func AzureChina() *Environment { + env := baseEnvironmentWithName(AzureChinaCloud) + + env.Authorization = &Authorization{ + Audiences: []string{ + "https://management.core.chinacloudapi.cn", + "https://management.chinacloudapi.cn", + }, + LoginEndpoint: "https://login.chinacloudapi.cn", + } + env.ResourceManager = ResourceManagerAPI("https://management.chinacloudapi.cn").withResourceIdentifier("https://management.chinacloudapi.cn") + env.MicrosoftGraph = MicrosoftGraphAPI("https://microsoftgraph.chinacloudapi.cn").withResourceIdentifier("https://microsoftgraph.chinacloudapi.cn") + + // DataLake, ManagedHSM and OperationalInsights are not available + env.ApiManagement = ApiManagementAPI("azure-api.cn") + env.Batch = BatchAPI("https://batch.chinacloudapi.cn").withResourceIdentifier("https://batch.chinacloudapi.cn") + env.ContainerRegistry = ContainerRegistryAPI("azurecr.cn") + env.CosmosDB = CosmosDBAPI("documents.azure.cn") + env.KeyVault = KeyVaultAPI("vault.azure.cn").withResourceIdentifier("https://vault.azure.cn") + env.MariaDB = MariaDBAPI("mariadb.database.chinacloudapi.cn").withResourceIdentifier("https://ossrdbms-aad.database.chinacloudapi.cn") + env.MySql = MySqlAPI("mysql.database.chinacloudapi.cn").withResourceIdentifier("https://ossrdbms-aad.database.chinacloudapi.cn") + env.OperationalInsights = OperationalInsightsAPI().withResourceIdentifier("https://api.loganalytics.azure.cn") + env.Postgresql = PostgresqlAPI("postgres.database.chinacloudapi.cn").withResourceIdentifier("https://ossrdbms-aad.database.chinacloudapi.cn") + env.ServiceBus = ServiceBusAPI("https://servicebus.chinacloudapi.cn", "servicebus.chinacloudapi.cn") + env.Sql = SqlAPI("database.chinacloudapi.cn").withResourceIdentifier("https://database.chinacloudapi.cn") + env.Storage = StorageAPI("core.chinacloudapi.cn").withResourceIdentifier("https://core.chinacloudapi.cn") + env.Synapse = SynapseAPI("dev.azuresynapse.azure.cn") + env.TrafficManager = TrafficManagerAPI("trafficmanager.cn") + + // @tombuildsstuff: DataLake doesn't appear to be available? + + // Managed HSM expected "H2 2023" per: + // https://azure.microsoft.com/en-gb/explore/global-infrastructure/products-by-region/?regions=china-non-regional,china-east,china-east-2,china-east-3,china-north,china-north-2,china-north-3&products=all + // presumably this'll be + // env.ManagedHSM = ManagedHSMAPI("https://managedhsm.azure.cn", "managedhsm.azure.cn") + + return &env +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/azure_gov.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/azure_gov.go new file mode 100644 index 000000000000..c6962ecb244b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/azure_gov.go @@ -0,0 +1,46 @@ +package environments + +const AzureUSGovernmentCloud = "USGovernment" + +func AzureUSGovernment() *Environment { + env := baseEnvironmentWithName(AzureUSGovernmentCloud) + + env.Authorization = &Authorization{ + Audiences: []string{ + "https://management.core.usgovcloudapi.net", + "https://management.usgovcloudapi.net", + }, + LoginEndpoint: "https://login.microsoftonline.us", + } + env.ResourceManager = ResourceManagerAPI("https://management.usgovcloudapi.net").withResourceIdentifier("https://management.usgovcloudapi.net") + env.MicrosoftGraph = MicrosoftGraphAPI("https://graph.microsoft.us").withResourceIdentifier("https://graph.microsoft.us") + + env.ApiManagement = ApiManagementAPI("azure-api.us") + env.Batch = BatchAPI("https://batch.core.usgovcloudapi.net").withResourceIdentifier("https://batch.core.usgovcloudapi.net") + env.ContainerRegistry = ContainerRegistryAPI("azurecr.us") + env.CosmosDB = CosmosDBAPI("documents.azure.us") + env.KeyVault = KeyVaultAPI("vault.usgovcloudapi.net").withResourceIdentifier("https://vault.usgovcloudapi.net") + env.ManagedHSM = ManagedHSMAPI("https://managedhsm.usgovcloudapi.net", "managedhsm.usgovcloudapi.net") + env.MariaDB = MariaDBAPI("mariadb.database.usgovcloudapi.net").withResourceIdentifier("https://ossrdbms-aad.database.usgovcloudapi.net") + env.MySql = MySqlAPI("mysql.database.usgovcloudapi.net").withResourceIdentifier("https://ossrdbms-aad.database.usgovcloudapi.net") + env.OperationalInsights = OperationalInsightsAPI().withResourceIdentifier("https://api.loganalytics.us") + env.Postgresql = PostgresqlAPI("postgres.database.usgovcloudapi.net").withResourceIdentifier("https://ossrdbms-aad.database.usgovcloudapi.net") + env.ServiceBus = ServiceBusAPI("https://servicebus.usgovcloudapi.net", "servicebus.usgovcloudapi.net") + env.Sql = SqlAPI("database.usgovcloudapi.net").withResourceIdentifier("https://database.usgovcloudapi.net") + env.Storage = StorageAPI("core.usgovcloudapi.net") + env.Synapse = SynapseAPI("dev.azuresynapse.usgovcloudapi.net").withResourceIdentifier("https://dev.azuresynapse.usgovcloudapi.net") + env.TrafficManager = TrafficManagerAPI("usgovtrafficmanager.net") + + // CDNFrontDoor doesn't appear to be available + // DataLake doesn't appear to be available + + return &env +} + +func AzureUSGovernmentL5() *Environment { + // L5 is Azure Government with a different Microsoft Graph endpoint + env := AzureUSGovernment() + env.Name = "USGovernmentL5" + env.MicrosoftGraph = MicrosoftGraphAPI("https://dod-graph.microsoft.us") + return env +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/azure_public.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/azure_public.go new file mode 100644 index 000000000000..03964e774090 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/azure_public.go @@ -0,0 +1,37 @@ +package environments + +const AzurePublicCloud = "Public" + +func AzurePublic() *Environment { + env := baseEnvironmentWithName(AzurePublicCloud) + + env.Authorization = &Authorization{ + Audiences: []string{ + "https://management.core.windows.net", + "https://management.azure.com", + }, + LoginEndpoint: "https://login.microsoftonline.com", + } + env.ResourceManager = ResourceManagerAPI("https://management.azure.com") + env.MicrosoftGraph = MicrosoftGraphAPI("https://graph.microsoft.com") + + env.ApiManagement = ApiManagementAPI("azure-api.net") + env.Batch = BatchAPI("https://batch.core.windows.net") + env.CDNFrontDoor = CDNFrontDoorAPI("azurefd.net") + env.ContainerRegistry = ContainerRegistryAPI("azurecr.io") + env.CosmosDB = CosmosDBAPI("documents.azure.com") + env.DataLake = DataLakeAPI("azuredatalakestore.net") + env.KeyVault = KeyVaultAPI("vault.azure.net") + env.ManagedHSM = ManagedHSMAPI("https://managedhsm.azure.net", "managedhsm.azure.net") + env.MariaDB = MariaDBAPI("mariadb.database.azure.com") + env.MySql = MySqlAPI("mysql.database.azure.com") + env.OperationalInsights = OperationalInsightsAPI() + env.Postgresql = PostgresqlAPI("postgres.database.azure.com") + env.ServiceBus = ServiceBusAPI("https://servicebus.windows.net", "servicebus.windows.net") + env.Sql = SqlAPI("database.windows.net") + env.Storage = StorageAPI("core.windows.net") + env.Synapse = SynapseAPI("dev.azuresynapse.net") + env.TrafficManager = TrafficManagerAPI("trafficmanager.net") + + return &env +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/azure_public_canary.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/azure_public_canary.go new file mode 100644 index 000000000000..affa631dd28c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/azure_public_canary.go @@ -0,0 +1,9 @@ +package environments + +func AzurePublicCanary() *Environment { + // Canary is Azure Public with a different Microsoft Graph endpoint + env := AzurePublic() + env.Name = "Canary" + env.MicrosoftGraph = MicrosoftGraphAPI("https://canary.graph.microsoft.com").withResourceIdentifier("https://canary.graph.microsoft.com") + return env +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/base.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/base.go new file mode 100644 index 000000000000..709ffdb63948 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/base.go @@ -0,0 +1,133 @@ +package environments + +func baseEnvironmentWithName(name string) Environment { + return Environment{ + Name: name, + + // MicrosoftGraph and ResourceManager should always be overridden + MicrosoftGraph: applicationIdOnly("MicrosoftGraph", microsoftGraphAppId), + ResourceManager: applicationIdOnly("ResourceManager", azureServiceManagementAppId), + + // The Api which are defined below are Application IDs which are common to all Environments + // to define these in one place but have these available in all Environments. + AnalysisServices: applicationIdOnly("AzureAnalysisServices", analysisServicesAppId), + ApiManagement: applicationIdOnly("ApiManagement", apiManagementAppId), + AppConfiguration: applicationIdOnly("AzureAppConfiguration", appConfigurationAppId), + AppService: applicationIdOnly("AzureAppService", appServiceAppId), + ApplicationInsights: applicationIdOnly("ApplicationInsights", applicationInsightsAppId), + Attestation: applicationIdOnly("AttestationService", attestationServiceAppId), + AzureADIdentityGovernanceInsights: applicationIdOnly("AzureAdIdentityGovernanceInsights", azureAdIdentityGovernanceInsightsAppId), + AzureADIntegratedApp: applicationIdOnly("AzureAdIntegratedApp", azureAdIntegratedAppAppId), + AzureADNotification: applicationIdOnly("AzureAdNotification", azureAdNotificationAppId), + AzureDevOps: applicationIdOnly("AzureDevOps", azureDevOpsAppId), + AzureServiceManagement: applicationIdOnly("AzureServiceManagement", azureServiceManagementAppId), + AzureVPN: applicationIdOnly("AzureVPN", azureVPNAppId), + Batch: applicationIdOnly("AzureBatch", batchAppId), + Bing: applicationIdOnly("Bing", bingAppId), + BotFrameworkDevPortal: applicationIdOnly("BotFrameworkDevPortal", botFrameworkDevPortalAppId), + BranchConnectWebService: applicationIdOnly("BranchConnectWebService", branchConnectWebServiceAppId), + CDNFrontDoor: applicationIdOnly("CDNFrontDoor", cdnFrontDoorAppId), + Cognitive: applicationIdOnly("CognitiveServices", cognitiveServicesAppId), + ComputeRecommendations: applicationIdOnly("ComputeRecommendationService", computeRecommendationServiceAppId), + Connections: applicationIdOnly("ConnectionsService", connectionsServiceAppId), + ContainerRegistry: applicationIdOnly("AzureContainerRegistry", containerRegistryAppId), + CortanaAtWork: applicationIdOnly("CortanaAtWorkService", cortanaAtWorkServiceAppId), + CortanaRuntime: applicationIdOnly("CortanaRuntimeService", cortanaRuntimeServiceAppId), + CortanaAtWorkBing: applicationIdOnly("CortanaAtWorkBingServices", cortanaAtWorkBingServicesAppId), + CosmosDB: applicationIdOnly("CosmosDB", cosmosDBAppId), + CustomerInsights: applicationIdOnly("CustomerInsights", customerInsightsAppId), + DataBricks: applicationIdOnly("AzureDataBricks", dataBricksAppId), + DataCatalog: applicationIdOnly("AzureDataCatalog", dataCatalogAppId), + DataMigrations: applicationIdOnly("DataMigrationService", dataMigrationsServiceAppId), + DataLake: applicationIdOnly("AzureDataLake", dataLakeAppId), + DigitalTwins: applicationIdOnly("AzureDigitalTwins", digitalTwinsAppId), + DomainController: applicationIdOnly("DomainControllerServices", domainControllerServiceAppId), + Dynamic365BusinessCentral: applicationIdOnly("Dynamic365BusinessCentral", dynamic365BusinessCentralAppId), + Dynamics365DataExportService: applicationIdOnly("Dynamics365DataExportService", dynamics365DataExportServiceAppId), + DynamicsCRM: applicationIdOnly("DynamicsCrm", dynamicsCRMAppId), + DynamicsERP: applicationIdOnly("DynamicsErp", dynamicsERPAppId), + EventHubs: applicationIdOnly("AzureEventHubs", eventHubsAppId), + Flow: applicationIdOnly("FlowService", flowServiceAppId), + HDInsight: applicationIdOnly("AzureHdInsightCluster", hdinsightClusterAppId), + HealthCare: applicationIdOnly("AzureHealthcare", healthCareAppId), + GraphConnector: applicationIdOnly("GraphConnectorService", graphConnectorServiceAppId), + IamSupportability: applicationIdOnly("AzureIamSupportability", iamSupportabilityAppId), + ImportExport: applicationIdOnly("AzureImportExport", importExportAppId), + InformationProtectionSyncService: applicationIdOnly("InformationProtectionSyncService", informationProtectionSyncServiceAppId), + InTune: applicationIdOnly("InTune", inTuneAppId), + IoTCentral: applicationIdOnly("AzureIotCentral", iotCentralAppId), + IoTHubDeviceProvisioning: applicationIdOnly("AzureIotHubDeviceProvisioning", iotHubDeviceProvisioningAppId), + KeyVault: applicationIdOnly("KeyVault", keyVaultAppId), + KubernetesServiceAADServer: applicationIdOnly("AzureKubernetesServiceAadServer", kubernetesServiceAadServerAppId), + Kusto: applicationIdOnly("KustoService", kustoServiceAppId), + KustoMFA: applicationIdOnly("KustoServiceMFA", kustoServiceMFAAppId), + LogAnalytics: applicationIdOnly("LogAnalytics", logAnalyticsAppId), + ManagedHSM: applicationIdOnly("ManagedHSM", managedHSMAppId), + Maps: applicationIdOnly("AzureMaps", mapsAppId), + MariaDB: applicationIdOnly("MariaDB", ossRDBMSAppId), + MediaServices: applicationIdOnly("AzureMediaServices", mediaServicesAppId), + MicrosoftAzureCli: applicationIdOnly("MicrosoftAzureCli", microsoftAzureCliAppId), + Microsoft365DataAtRestEncryption: applicationIdOnly("Microsoft365DataAtRestEncryption", microsoft365DataAtRestEncryptionAppId), + MicrosoftInvoicing: applicationIdOnly("MicrosoftInvoicing", microsoftInvoicingAppId), + MicrosoftOffice: applicationIdOnly("MicrosoftOffice", microsoftOfficeAppId), + MicrosoftStorageSync: applicationIdOnly("MicrosoftStorageSync", microsoftStorageSyncAppId), + MicrosoftTeams: applicationIdOnly("MicrosoftTeams", microsoftTeamsAppId), + MicrosoftTeamsWebClient: applicationIdOnly("MicrosoftTeamsWebClient", microsoftTeamsWebClientAppId), + MileIqAdminCenter: applicationIdOnly("MileIqAdminCenter", mileIqAdminCenterAppId), + MileIqDashboard: applicationIdOnly("MileIqDashboard", mileIqDashboardAppId), + MileIqRestService: applicationIdOnly("MileIqRestService", mileIqRestServiceAppId), + MixedReality: applicationIdOnly("MixedReality", mixedRealityAppId), + MySql: applicationIdOnly("MySql", ossRDBMSAppId), + Office365Connectors: applicationIdOnly("Office365Connectors", office365ConnectorsAppId), + Office365Demeter: applicationIdOnly("Office365Demeter", office365DemeterAppId), + Office365DwEngineV2: applicationIdOnly("Office365DwEngineV2", office365DwEngineV2AppId), + Office365ExchangeOnline: applicationIdOnly("Office365ExchangeOnline", office365ExchangeOnlineAppId), + Office365ExchangeOnlineProtection: applicationIdOnly("Office365ExchangeOnlineProtection", office365ExchangeOnlineProtectionAppId), + Office365InformationProtection: applicationIdOnly("Office365InformationProtection", office365InformationProtectionAppId), + Office365Management: applicationIdOnly("Office365Management", office365ManagementAppId), + Office365Portal: applicationIdOnly("Office365Portal", office365PortalAppId), + Office365SharePointOnline: applicationIdOnly("Office365SharePointOnline", office365SharePointOnlineAppId), + Office365SuiteUx: applicationIdOnly("Office365SuiteUx", office365SuiteUxAppId), + Office365Zoom: applicationIdOnly("Office365Zoom", office365ZoomAppId), + OfficeHome: applicationIdOnly("OfficeHome", officeHomeAppId), + OfficeUwpPwa: applicationIdOnly("OfficeUwpPwa", officeUwpPwaAppId), + OneNote: applicationIdOnly("OneNote", oneNoteAppId), + OneProfile: applicationIdOnly("OneProfileService", oneProfileServiceAppId), + OperationalInsights: applicationIdOnly("OperationalInsights", logAnalyticsAppId), + OSSRDMBS: applicationIdOnly("OssRdbms", ossRDBMSAppId), + OSSRDBMSPostgreSQLFlexibleServerAadAuthentication: applicationIdOnly("OssRdbmsPostgreSqlFlexibleServerAadAuthentication", ossRdbmsPostgreSqlFlexibleServerAadAuthenticationAppId), + PeopleCards: applicationIdOnly("PeopleCardsService", peopleCardsServiceAppId), + PolicyAdministration: applicationIdOnly("PolicyAdministrationService", policyAdministrationServiceAppId), + Portal: applicationIdOnly("AzurePortal", portalAppId), + Postgresql: applicationIdOnly("Postgresql", ossRDBMSAppId), + PowerAppsRuntime: applicationIdOnly("PowerAppsRuntime", powerAppsRuntimeServiceAppId), + PowerAppsRuntimeService: applicationIdOnly("PowerAppsRuntimeService", powerAppsRuntimeServiceAppId), + PowerBiService: applicationIdOnly("PowerBiService", powerBiServiceAppId), + Purview: applicationIdOnly("Purview", purviewAppId), + RightsManagement: applicationIdOnly("RightsManagementServices", rightsManagementServiceAppId), + SecurityInsights: applicationIdOnly("AzureSecurityInsights", securityInsightsAppId), + ServiceBus: applicationIdOnly("AzureServiceBus", serviceBusAppId), + ServiceDeploy: applicationIdOnly("AzureServiceDeploy", serviceDeployAppId), + ServiceTrust: applicationIdOnly("ServiceTrust", serviceTrustAppId), + SkypeForBusinessOnline: applicationIdOnly("SkypeForBusinessOnline", skypeForBusinessOnlineAppId), + Signup: applicationIdOnly("Signup", signupAppId), + Sql: applicationIdOnly("AzureSqlDatabase", sqlDatabaseAppId), + SpeechRecognition: applicationIdOnly("SpeechRecognition", speechRecognitionAppId), + StackHCI: applicationIdOnly("AzureStackHciService", stackHciServiceAppId), + StreamAnalytics: applicationIdOnly("AzureStreamAnalytics", streamAnalyticsAppId), + Storage: applicationIdOnly("AzureStorage", storageAppId), + StorageSync: applicationIdOnly("StorageSync", storageSyncAppId), + Synapse: applicationIdOnly("Synapse", synapseAppId), + SynapseGateway: applicationIdOnly("AzureSynapseGateway", synapseGatewayAppId), + SynapseStudio: applicationIdOnly("AzureSynapseStudio", synapseStudioAppId), + TargetedMessaging: applicationIdOnly("TargetedMessagingService", targetedMessagingServiceAppId), + Teams: applicationIdOnly("TeamsServices", teamsServiceAppId), + ThreatProtection: applicationIdOnly("ThreatProtection", threatProtectionAppId), + TimeSeriesInsights: applicationIdOnly("AzureTimeSeriesInsights", timeSeriesInsightsAppId), + TrafficManager: applicationIdOnly("TrafficManager", trafficManagerAppId), + UniversalPrint: applicationIdOnly("UniversalPrint", universalPrintAppId), + WindowsDefenderATP: applicationIdOnly("WindowsDefenderAtp", windowsDefenderAtpAppId), + WindowsVirtualDesktop: applicationIdOnly("WindowsVirtualDesktop", windowsVirtualDesktopAppId), + Yammer: applicationIdOnly("Yammer", yammerAppId), + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/constants.go new file mode 100644 index 000000000000..4e9bfa7e8aa9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/constants.go @@ -0,0 +1,117 @@ +package environments + +const analysisServicesAppId = "4ac7d521-0382-477b-b0f8-7e1d95f85ca2" +const apiManagementAppId = "8602e328-9b72-4f2d-a4ae-1387d013a2b3" +const appConfigurationAppId = "35ffadb3-7fc1-497e-b61b-381d28e744cc" +const appServiceAppId = "abfa0a7c-a6b6-4736-8310-5855508787cd" +const applicationInsightsAppId = "f5c26e74-f226-4ae8-85f0-b4af0080ac9e" +const attestationServiceAppId = "c61423b7-1d1f-430d-b444-0eee53298103" +const azureAdIdentityGovernanceInsightsAppId = "58c746b0-a0b0-4647-a8f6-12dde5981638" +const azureAdIntegratedAppAppId = "af47b99c-8954-4b45-ab68-8121157418ef" +const azureAdNotificationAppId = "fc03f97a-9db0-4627-a216-ec98ce54e018" +const azureDevOpsAppId = "499b84ac-1321-427f-aa17-267ca6975798" +const azureServiceManagementAppId = "797f4846-ba00-4fd7-ba43-dac1f8f63013" +const azureVPNAppId = "41b23e61-6c1e-4545-b367-cd054e0ed4b4" +const batchAppId = "ddbf3205-c6bd-46ae-8127-60eb93363864" +const bingAppId = "9ea1ad79-fdb6-4f9a-8bc3-2b70f96e34c7" +const botFrameworkDevPortalAppId = "f3723d34-6ff5-4ceb-a148-d99dcd2511fc" +const branchConnectWebServiceAppId = "57084ef3-d413-4087-a28f-f6f3b1ad7786" +const cdnFrontDoorAppId = "205478c0-bd83-4e1b-a9d6-db63a3e1e1c8" +const cognitiveServicesAppId = "7d312290-28c8-473c-a0ed-8e53749b6d6d" +const computeRecommendationServiceAppId = "b9a92e36-2cf8-4f4e-bcb3-9d99e00e14ab" +const connectionsServiceAppId = "b7912db9-aa33-4820-9d4f-709830fdd78f" +const containerRegistryAppId = "6a0ec4d3-30cb-4a83-91c0-ae56bc0e3d26" +const cortanaAtWorkBingServicesAppId = "22d7579f-06c2-4baa-89d2-e844486adb9d" +const cortanaAtWorkServiceAppId = "2a486b53-dbd2-49c0-a2bc-278bdfc30833" +const cortanaRuntimeServiceAppId = "81473081-50b9-469a-b9d8-303109583ecb" +const cosmosDBAppId = "a232010e-820c-4083-83bb-3ace5fc29d0b" +const customerInsightsAppId = "38c77d00-5fcb-4cce-9d93-af4738258e3c" +const dataBricksAppId = "2ff814a6-3304-4ab8-85cb-cd0e6f879c1d" +const dataCatalogAppId = "9d3e55ba-79e0-4b7c-af50-dc460b81dca1" +const dataLakeAppId = "e9f49c6b-5ce5-44c8-925d-015017e9f7ad" +const dataMigrationsServiceAppId = "a4bad4aa-bf02-4631-9f78-a64ffdba8150" +const digitalTwinsAppId = "0b07f429-9f4b-4714-9392-cc5e8e80c8b0" +const domainControllerServiceAppId = "2565bd9d-da50-47d4-8b85-4c97f669dc36" +const dynamic365BusinessCentralAppId = "996def3d-b36c-4153-8607-a6fd3c01b89f" +const dynamics365DataExportServiceAppId = "b861dbcc-a7ef-4219-a005-0e4de4ea7dcf" +const dynamicsCRMAppId = "00000007-0000-0000-c000-000000000000" +const dynamicsERPAppId = "00000015-0000-0000-c000-000000000000" +const eventHubsAppId = "80369ed6-5f11-4dd9-bef3-692475845e77" +const flowServiceAppId = "7df0a125-d3be-4c96-aa54-591f83ff541c" +const graphConnectorServiceAppId = "56c1da01-2129-48f7-9355-af6d59d42766" +const hdinsightClusterAppId = "7865c1d2-f040-46cc-875f-831a1ef6a28a" +const healthCareAppId = "4f6778d8-5aef-43dc-a1ff-b073724b9495" +const iamSupportabilityAppId = "a57aca87-cbc0-4f3c-8b9e-dc095fdc8978" +const importExportAppId = "7de4d5c5-5b32-4235-b8a9-33b34d6bcd2a" +const inTuneAppId = "c161e42e-d4df-4a3d-9b42-e7a3c31f59d4" +const informationProtectionSyncServiceAppId = "870c4f2e-85b6-4d43-bdda-6ed9a579b725" +const iotCentralAppId = "9edfcdd9-0bc5-4bd4-b287-c3afc716aac7" +const iotHubDeviceProvisioningAppId = "0cd79364-7a90-4354-9984-6e36c841418d" +const keyVaultAppId = "cfa8b339-82a2-471a-a3c9-0fc0be7a4093" +const kubernetesServiceAadServerAppId = "6dae42f8-4368-4678-94ff-3960e28e3630" +const kustoServiceAppId = "2746ea77-4702-4b45-80ca-3c97e680e8b7" +const kustoServiceMFAAppId = "725d0e77-e1fd-48f1-a295-2115457f7609" +const logAnalyticsAppId = "ca7f3f0b-7d91-482c-8e09-c5d840d0eac5" +const managedHSMAppId = "1341df96-0b28-43da-ba24-7a6ce39be816" +const mapsAppId = "ba1ea022-5807-41d5-bbeb-292c7e1cf5f6" +const mediaServicesAppId = "374b2a64-3b6b-436b-934c-b820eacca870" +const microsoft365DataAtRestEncryptionAppId = "c066d759-24ae-40e7-a56f-027002b5d3e4" +const microsoftAzureCliAppId = "04b07795-8ddb-461a-bbee-02f9e1bf7b46" +const microsoftGraphAppId = "00000003-0000-0000-c000-000000000000" +const microsoftInvoicingAppId = "b6b84568-6c01-4981-a80f-09da9a20bbed" +const microsoftOfficeAppId = "d3590ed6-52b3-4102-aeff-aad2292ab01c" +const microsoftStorageSyncAppId = "9469b9f5-6722-4481-a2b2-14ed560b706f" +const microsoftTeamsAppId = "1fec8e78-bce4-4aaf-ab1b-5451cc387264" +const microsoftTeamsWebClientAppId = "5e3ce6c0-2b1f-4285-8d4b-75ee78787346" +const mileIqAdminCenterAppId = "de096ee1-dae7-4ee1-8dd5-d88ccc473815" +const mileIqDashboardAppId = "f7069a8d-9edc-4300-b365-ae53c9627fc4" +const mileIqRestServiceAppId = "b692184e-b47f-4706-b352-84b288d2d9ee" +const mixedRealityAppId = "c7ddd9b4-5172-4e28-bd29-1e0792947d18" +const office365ConnectorsAppId = "48af08dc-f6d2-435f-b2a7-069abd99c086" +const office365DemeterAppId = "982bda36-4632-4165-a46a-9863b1bbcf7d" +const office365DwEngineV2AppId = "441509e5-a165-4363-8ee7-bcf0b7d26739" +const office365ExchangeOnlineAppId = "00000002-0000-0ff1-ce00-000000000000" +const office365ExchangeOnlineProtectionAppId = "00000007-0000-0ff1-ce00-000000000000" +const office365InformationProtectionAppId = "2f3f02c9-5679-4a5c-a605-0de55b07d135" +const office365ManagementAppId = "c5393580-f805-4401-95e8-94b7a6ef2fc2" +const office365PortalAppId = "00000006-0000-0ff1-ce00-000000000000" +const office365SharePointOnlineAppId = "00000003-0000-0ff1-ce00-000000000000" +const office365SuiteUxAppId = "4345a7b9-9a63-4910-a426-35363201d503" +const office365ZoomAppId = "0d38933a-0bbd-41ca-9ebd-28c4b5ba7cb7" +const officeHomeAppId = "4765445b-32c6-49b0-83e6-1d93765276ca" +const officeUwpPwaAppId = "0ec893e0-5785-4de6-99da-4ed124e5296c" +const oneNoteAppId = "2d4d3d8e-2be3-4bef-9f87-7875a61c29de" +const oneProfileServiceAppId = "b2cc270f-563e-4d8a-af47-f00963a71dcd" +const ossRDBMSAppId = "123cd850-d9df-40bd-94d5-c9f07b7fa203" +const ossRdbmsPostgreSqlFlexibleServerAadAuthenticationAppId = "5657e26c-cc92-45d9-bc47-9da6cfdb4ed9" +const peopleCardsServiceAppId = "394866fc-eedb-4f01-8536-3ff84b16be2a" +const policyAdministrationServiceAppId = "0469d4cd-df37-4d93-8a61-f8c75b809164" +const portalAppId = "c44b4083-3bb0-49c1-b47d-974e53cbdf3c" +const powerAppsRuntimeServiceAppId = "82f77645-8a66-4745-bcdf-9706824f9ad0" +const powerBiServiceAppId = "00000009-0000-0000-c000-000000000000" +const purviewAppId = "73c2949e-da2d-457a-9607-fcc665198967" +const rightsManagementServiceAppId = "00000012-0000-0000-c000-000000000000" +const securityInsightsAppId = "98785600-1bb7-4fb9-b9fa-19afe2c8a360" +const serviceBusAppId = "80a10ef9-8168-493d-abf9-3297c4ef6e3c" +const serviceDeployAppId = "5b306cba-9c71-49db-96c3-d17ca2379c4d" +const serviceTrustAppId = "d6fdaa33-e821-4211-83d0-cf74736489e1" +const signupAppId = "b4bddae8-ab25-483e-8670-df09b9f1d0ea" +const skypeForBusinessOnlineAppId = "00000004-0000-0ff1-ce00-000000000000" +const speechRecognitionAppId = "1a6fcee6-0816-469b-acac-fe7ef2e87b83" +const sqlDatabaseAppId = "022907d3-0f1b-48f7-badc-1ba6abab6d66" +const stackHciServiceAppId = "1322e676-dee7-41ee-a874-ac923822781c" +const storageAppId = "e406a681-f3d4-42a8-90b6-c2b029497af1" +const storageSyncAppId = "9469b9f5-6722-4481-a2b2-14ed560b706f" +const streamAnalyticsAppId = "66f1e791-7bfb-4e18-aed8-1720056421c7" +const synapseAppId = "9e09aefc-b2e5-4d19-9f74-3e3e8b11a57b" +const synapseGatewayAppId = "1ac05c7e-12d2-4605-bf9d-549d7041c6b3" +const synapseStudioAppId = "ec52d13d-2e85-410e-a89a-8c79fb6a32ac" +const targetedMessagingServiceAppId = "4c4f550b-42b2-4a16-93f9-fdb9e01bb6ed" +const teamsServiceAppId = "cc15fd57-2c6c-4117-a88c-83b1d56b4bbe" +const threatProtectionAppId = "8ee8fdad-f234-4243-8f3b-15c294843740" +const timeSeriesInsightsAppId = "120d688d-1518-4cf7-bd38-182f158850b6" +const trafficManagerAppId = "2cf9eb86-36b5-49dc-86ae-9a63135dfa8c" +const universalPrintAppId = "da9b70f6-5323-4ce6-ae5c-88dcc5082966" +const windowsDefenderAtpAppId = "fc780465-2017-40d4-a0c5-307022471b92" +const windowsVirtualDesktopAppId = "9cdead84-a844-4324-93f2-b2e6bb768d07" +const yammerAppId = "00000005-0000-0ff1-ce00-000000000000" diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/endpoint_refresh.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/endpoint_refresh.go new file mode 100644 index 000000000000..27a61dde84bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/endpoint_refresh.go @@ -0,0 +1,80 @@ +package environments + +import ( + "context" + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/internal/metadata" +) + +func (e *Environment) RefreshMetaDataFromEndpoint(ctx context.Context) error { + endpoint, ok := e.ResourceManager.Endpoint() + if !ok { + return fmt.Errorf("refreshing MetaData from Endpoint: no `ResourceManager` endpoint was defined") + } + + client := metadata.NewClientWithEndpoint(*endpoint) + config, err := client.GetMetaData(ctx, e.Name) + if err != nil { + return fmt.Errorf("retrieving MetaData from endpoint: %+v", err) + } + + if err := e.updateFromMetaData(config); err != nil { + return fmt.Errorf("updating Environment from MetaData: %+v", err) + } + + return nil +} + +func (e *Environment) updateFromMetaData(config *metadata.MetaData) error { + // Auth Endpoints + if e.Authorization == nil { + e.Authorization = &Authorization{} + } + if config.Authentication.LoginEndpoint != "" { + e.Authorization.LoginEndpoint = config.Authentication.LoginEndpoint + } + if len(config.Authentication.Audiences) > 0 { + e.Authorization.Audiences = config.Authentication.Audiences + } + if config.ResourceManagerEndpoint != "" { + e.ResourceManager = ResourceManagerAPI(config.ResourceManagerEndpoint) + } + if config.ResourceIdentifiers.MicrosoftGraph != "" { + e.MicrosoftGraph = MicrosoftGraphAPI(config.ResourceIdentifiers.MicrosoftGraph) + } + + // Dns Suffixes + if config.DnsSuffixes.FrontDoor != "" { + e.CDNFrontDoor = CDNFrontDoorAPI(config.DnsSuffixes.FrontDoor) + } + if config.DnsSuffixes.KeyVault != "" { + e.KeyVault = KeyVaultAPI(config.DnsSuffixes.KeyVault) + } + if config.DnsSuffixes.ManagedHSM != "" { + e.ManagedHSM = ManagedHSMAPI(fmt.Sprintf("https://%s", config.DnsSuffixes.ManagedHSM), config.DnsSuffixes.ManagedHSM) + } + if config.DnsSuffixes.MariaDB != "" { + e.MariaDB = MariaDBAPI(config.DnsSuffixes.MariaDB) + } + if config.DnsSuffixes.MySql != "" { + e.MySql = MySqlAPI(config.DnsSuffixes.MySql) + } + if config.DnsSuffixes.Postgresql != "" { + e.Postgresql = PostgresqlAPI(config.DnsSuffixes.Postgresql) + } + if config.DnsSuffixes.SqlServer != "" { + e.Sql = SqlAPI(config.DnsSuffixes.SqlServer) + } + if config.DnsSuffixes.Storage != "" { + e.Storage = StorageAPI(config.DnsSuffixes.Storage) + } + if config.DnsSuffixes.StorageSync != "" { + e.StorageSync = StorageSyncAPI(config.DnsSuffixes.StorageSync) + } + if config.DnsSuffixes.Synapse != "" { + e.Synapse = SynapseAPI(config.DnsSuffixes.Synapse) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/environment.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/environment.go new file mode 100644 index 000000000000..43bdd646744c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/environment.go @@ -0,0 +1,193 @@ +package environments + +import ( + "github.com/hashicorp/go-azure-helpers/lang/pointer" +) + +type Authorization struct { + Audiences []string + LoginEndpoint string +} + +type Environment struct { + Name string + + Authorization *Authorization + MicrosoftGraph Api + ResourceManager Api + + AnalysisServices Api + ApiManagement Api + AppConfiguration Api + AppService Api + ApplicationInsights Api + Attestation Api + AzureADIdentityGovernanceInsights Api + AzureADIntegratedApp Api + AzureADNotification Api + AzureDevOps Api + AzureServiceManagement Api + AzureVPN Api + Batch Api + Bing Api + BotFrameworkDevPortal Api + BranchConnectWebService Api + CDNFrontDoor Api + Cognitive Api + ComputeRecommendations Api + Connections Api + ContainerRegistry Api + CortanaAtWork Api + CortanaAtWorkBing Api + CortanaRuntime Api + CosmosDB Api + CustomerInsights Api + DataBricks Api + DataCatalog Api + DataLake Api + DataMigrations Api + DigitalTwins Api + DomainController Api + Dynamic365BusinessCentral Api + Dynamics365DataExportService Api + DynamicsCRM Api + DynamicsERP Api + EventHubs Api + Flow Api + GraphConnector Api + HDInsight Api + HealthCare Api + IamSupportability Api + ImportExport Api + InTune Api + InformationProtectionSyncService Api + IoTCentral Api + IoTHubDeviceProvisioning Api + KeyVault Api + KubernetesServiceAADServer Api + Kusto Api + KustoMFA Api + LogAnalytics Api + ManagedHSM Api + Maps Api + MariaDB Api + MediaServices Api + Microsoft365DataAtRestEncryption Api + MicrosoftAzureCli Api + MicrosoftInvoicing Api + MicrosoftOffice Api + MicrosoftStorageSync Api + MicrosoftTeams Api + MicrosoftTeamsWebClient Api + MileIqAdminCenter Api + MileIqDashboard Api + MileIqRestService Api + MixedReality Api + MySql Api + OSSRDBMSPostgreSQLFlexibleServerAadAuthentication Api + OSSRDMBS Api + Office365Connectors Api + Office365Demeter Api + Office365DwEngineV2 Api + Office365ExchangeOnline Api + Office365ExchangeOnlineProtection Api + Office365InformationProtection Api + Office365Management Api + Office365Portal Api + Office365SharePointOnline Api + Office365SuiteUx Api + Office365Zoom Api + OfficeHome Api + OfficeUwpPwa Api + OneNote Api + OneProfile Api + OperationalInsights Api + PeopleCards Api + PolicyAdministration Api + Portal Api + Postgresql Api + PowerAppsRuntime Api + PowerAppsRuntimeService Api + PowerBiService Api + Purview Api + RightsManagement Api + SecurityInsights Api + ServiceBus Api + ServiceDeploy Api + ServiceTrust Api + Signup Api + SkypeForBusinessOnline Api + SpeechRecognition Api + Sql Api + StackHCI Api + Storage Api + StorageSync Api + StreamAnalytics Api + Synapse Api + SynapseGateway Api + SynapseStudio Api + TargetedMessaging Api + Teams Api + ThreatProtection Api + TimeSeriesInsights Api + TrafficManager Api + UniversalPrint Api + WindowsDefenderATP Api + WindowsVirtualDesktop Api + Yammer Api +} + +var _ Api = &ApiEndpoint{} + +type ApiEndpoint struct { + domainSuffix *string + endpoint *string + appId *string + name string + resourceIdentifier *string +} + +func NewApiEndpoint(name, endpoint string, appId *string) *ApiEndpoint { + return &ApiEndpoint{ + appId: appId, + endpoint: pointer.To(endpoint), + name: name, + } +} + +func (e *ApiEndpoint) withResourceIdentifier(identifier string) *ApiEndpoint { + e.resourceIdentifier = pointer.To(identifier) + return e +} + +func (e *ApiEndpoint) DomainSuffix() (*string, bool) { + if e == nil { + return nil, false + } + return e.domainSuffix, e.domainSuffix != nil +} + +func (e *ApiEndpoint) Endpoint() (*string, bool) { + if e == nil { + return nil, false + } + return e.endpoint, e.endpoint != nil +} + +func (e *ApiEndpoint) AppId() (*string, bool) { + if e == nil || e.appId == nil { + return nil, false + } + return e.appId, true +} + +func (e *ApiEndpoint) Name() string { + return e.name +} + +func (e *ApiEndpoint) ResourceIdentifier() (*string, bool) { + if e == nil { + return nil, false + } + return e.resourceIdentifier, e.resourceIdentifier != nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/from_endpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/from_endpoint.go new file mode 100644 index 000000000000..8b8de00872d7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/from_endpoint.go @@ -0,0 +1,43 @@ +package environments + +import ( + "context" + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/internal/metadata" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +// FromEndpoint attempts to load an environment from the given Endpoint. +func FromEndpoint(ctx context.Context, endpoint, name string) (*Environment, error) { + env := baseEnvironmentWithName("FromEnvironment") + + client := metadata.NewClientWithEndpoint(endpoint) + config, err := client.GetMetaData(ctx, name) + if err != nil { + return nil, fmt.Errorf("retrieving metadata from endpoint %q: %+v", endpoint, err) + } + + if config.Name == "" { + return nil, fmt.Errorf("retrieving metadata from endpoint: `name` was nil") + } + env.Name = config.Name + + if config.ResourceManagerEndpoint == "" { + return nil, fmt.Errorf("retrieving metadata from endpoint: no `resourceManagerEndpoint` was returned") + } + env.ResourceManager = ResourceManagerAPI(config.ResourceManagerEndpoint) + + if config.ResourceIdentifiers.MicrosoftGraph == "" { + return nil, fmt.Errorf("retrieving metdata from endpoint: no `microsoftGraphResourceId` was returned") + } + env.MicrosoftGraph = MicrosoftGraphAPI(config.ResourceIdentifiers.MicrosoftGraph) + + if err := env.updateFromMetaData(config); err != nil { + return nil, fmt.Errorf("updating Environment from MetaData: %+v", err) + } + + return &env, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/from_name.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/from_name.go new file mode 100644 index 000000000000..1b2f11c320cf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/from_name.go @@ -0,0 +1,30 @@ +package environments + +import ( + "fmt" + "strings" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func FromName(name string) (*Environment, error) { + switch strings.ToLower(name) { + case "china": + return AzureChina(), nil + + case "canary": + return AzurePublicCanary(), nil + + case "global", "public": + return AzurePublic(), nil + + case "usgovernment", "usgovernmentl4": + return AzureUSGovernment(), nil + + case "dod", "usgovernmentl5": + return AzureUSGovernmentL5(), nil + } + + return nil, fmt.Errorf("no environment was found with the name %q", name) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/helpers.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/helpers.go new file mode 100644 index 000000000000..7f67323cd215 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/helpers.go @@ -0,0 +1,213 @@ +package environments + +import "github.com/hashicorp/go-azure-helpers/lang/pointer" + +func applicationIdOnly(name, applicationId string) Api { + return &ApiEndpoint{ + domainSuffix: nil, + endpoint: nil, + appId: pointer.To(applicationId), + name: name, + resourceIdentifier: nil, + } +} + +func ApiManagementAPI(domainSuffix string) Api { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: nil, + appId: pointer.To(apiManagementAppId), + name: "ApiManagement", + resourceIdentifier: nil, + } +} + +func BatchAPI(endpoint string) *ApiEndpoint { + return &ApiEndpoint{ + domainSuffix: nil, + endpoint: pointer.To(endpoint), + appId: pointer.To(batchAppId), + name: "Batch", + resourceIdentifier: pointer.To("https://batch.core.windows.net"), + } +} + +func CDNFrontDoorAPI(domainSuffix string) Api { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: nil, + appId: pointer.To(cdnFrontDoorAppId), + name: "CDNFrontDoor", + resourceIdentifier: nil, + } +} + +func ContainerRegistryAPI(domainSuffix string) Api { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: nil, + appId: pointer.To(containerRegistryAppId), + name: "ContainerRegistry", + resourceIdentifier: nil, + } +} + +func CosmosDBAPI(domainSuffix string) Api { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: nil, + appId: pointer.To(cosmosDBAppId), + name: "AzureCosmosDb", + resourceIdentifier: pointer.To("https://cosmos.azure.com"), + } +} + +func DataLakeAPI(domainSuffix string) Api { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: nil, + appId: pointer.To(dataLakeAppId), + name: "DataLake", + resourceIdentifier: pointer.To("https://datalake.azure.net"), + } +} + +func KeyVaultAPI(domainSuffix string) *ApiEndpoint { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: nil, + appId: pointer.To(keyVaultAppId), + name: "AzureKeyVault", + resourceIdentifier: pointer.To("https://vault.azure.net"), + } +} + +func ManagedHSMAPI(endpoint, domainSuffix string) Api { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: pointer.To(endpoint), + appId: pointer.To(managedHSMAppId), + name: "ManagedHSM", + resourceIdentifier: pointer.To("https://managedhsm.azure.net"), + } +} + +func MariaDBAPI(domainSuffix string) *ApiEndpoint { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: nil, + appId: pointer.To(ossRDBMSAppId), + name: "OssRdbms", + resourceIdentifier: pointer.To("https://ossrdbms-aad.database.windows.net"), + } +} + +func MicrosoftGraphAPI(endpoint string) *ApiEndpoint { + return &ApiEndpoint{ + domainSuffix: nil, + endpoint: pointer.To(endpoint), + appId: pointer.To(microsoftGraphAppId), + name: "MicrosoftGraph", + resourceIdentifier: pointer.To("https://graph.microsoft.com"), + } +} + +func MySqlAPI(domainSuffix string) *ApiEndpoint { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: nil, + appId: pointer.To(ossRDBMSAppId), + name: "OssRdbms", + resourceIdentifier: pointer.To("https://ossrdbms-aad.database.windows.net"), + } +} + +func OperationalInsightsAPI() *ApiEndpoint { + return &ApiEndpoint{ + domainSuffix: nil, + endpoint: nil, + appId: pointer.To(logAnalyticsAppId), + name: "OperationalInsights", + resourceIdentifier: pointer.To("https://api.loganalytics.io"), + } +} + +func PostgresqlAPI(domainSuffix string) *ApiEndpoint { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: nil, + appId: pointer.To(ossRDBMSAppId), + name: "OssRdbms", + resourceIdentifier: pointer.To("https://ossrdbms-aad.database.windows.net"), + } +} + +func ResourceManagerAPI(endpoint string) *ApiEndpoint { + return &ApiEndpoint{ + domainSuffix: nil, + endpoint: pointer.To(endpoint), + appId: pointer.To(azureServiceManagementAppId), + name: "ResourceManager", + resourceIdentifier: pointer.To("https://management.azure.com"), + } +} + +func ServiceBusAPI(endpoint, domainSuffix string) Api { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: pointer.To(endpoint), + appId: pointer.To(serviceBusAppId), + name: "ServiceBus", + resourceIdentifier: pointer.To("https://servicebus.azure.net"), + } +} + +func SqlAPI(domainSuffix string) *ApiEndpoint { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: nil, + appId: pointer.To(sqlDatabaseAppId), + name: "AzureSqlDatabase", + resourceIdentifier: pointer.To("https://database.windows.net"), + } +} + +func StorageAPI(domainSuffix string) *ApiEndpoint { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: nil, + appId: pointer.To(storageAppId), + name: "AzureStorage", + resourceIdentifier: pointer.To("https://storage.azure.com"), + } +} + +func StorageSyncAPI(domainSuffix string) Api { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: nil, + appId: pointer.To(storageSyncAppId), + name: "StorageSync", + resourceIdentifier: nil, + } +} + +func SynapseAPI(domainSuffix string) *ApiEndpoint { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: nil, + appId: pointer.To(synapseAppId), + name: "Synapse", + resourceIdentifier: pointer.To("https://dev.azuresynapse.net"), + } +} + +func TrafficManagerAPI(domainSuffix string) Api { + return &ApiEndpoint{ + domainSuffix: pointer.To(domainSuffix), + endpoint: nil, + appId: pointer.To(trafficManagerAppId), + name: "TrafficManager", + resourceIdentifier: nil, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/interfaces.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/interfaces.go new file mode 100644 index 000000000000..111728a1540f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/interfaces.go @@ -0,0 +1,9 @@ +package environments + +type Api interface { + AppId() (*string, bool) + DomainSuffix() (*string, bool) + Endpoint() (*string, bool) + Name() string + ResourceIdentifier() (*string, bool) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/scopes.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/scopes.go new file mode 100644 index 000000000000..b781f18b775c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/environments/scopes.go @@ -0,0 +1,31 @@ +package environments + +import ( + "fmt" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" +) + +func Resource(endpoint Api) (*string, error) { + resource, ok := endpoint.ResourceIdentifier() + if !ok { + return nil, fmt.Errorf("the endpoint %q doesn't define a resource identifier", endpoint.Name()) + } + + return resource, nil +} + +func Scope(endpoint Api) (*string, error) { + e, ok := endpoint.ResourceIdentifier() + if !ok { + // if this API has been defined in-line it may not have a Resource Identifier - however + // the scope will be the endpoint instead, so we can best-effort to obtain the auth token + e2, ok2 := endpoint.Endpoint() + if !ok2 { + return nil, fmt.Errorf("the endpoint %q is not supported in this Azure Environment", endpoint.Name()) + } + e = e2 + } + out := fmt.Sprintf("%s/.default", *e) + return pointer.To(out), nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/accept/accept.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/accept/accept.go new file mode 100644 index 000000000000..146140972dcd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/accept/accept.go @@ -0,0 +1,160 @@ +package accept + +import ( + "fmt" + "sort" + "strconv" + "strings" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +// Header represents an HTTP Accept header value +// See https://httpwg.org/specs/rfc9110.html#field.accept +type Header struct { + types []PreferredType +} + +func (h Header) FirstChoice() *PreferredType { + if len(h.types) == 0 { + return nil + } + return &h.types[0] +} + +func (h Header) String() string { + out := make([]string, 0) + for _, typ := range h.types { + out = append(out, fmt.Sprintf("%s", typ)) + } + return strings.Join(out, ", ") +} + +type PreferredType struct { + // ContentType is a singular media type (e.g. text/plain), or one partially containing + // wildcards (e.g. text/*), or entirely wildcards (e.g. */*) + ContentType string + + // Parameters is a map of media type parameters, e.g. charset=utf-8 + Parameters map[string]string + + // Weight is the integer-normalized quality value representing the relative weight/preference + Weight qValue +} + +func (t PreferredType) String() string { + out := []string{t.ContentType} + for p, v := range t.Parameters { + out = append(out, fmt.Sprintf("%s=%s", p, v)) + } + out = append(out, fmt.Sprintf("q=%s", t.Weight)) + + return strings.Join(out, "; ") +} + +// qValue is an integer-normalized representation of a quality value, which has a minimum value +// of 0.001, a maximum value of 1 and a maximum precision of 3 decimal places. +// See https://httpwg.org/specs/rfc9110.html#quality.values +type qValue uint16 + +func (q qValue) String() string { + return fmt.Sprintf("%d.%d", q/1000, q%1000) +} + +func FromString(in string) (Header, error) { + contentTypes := strings.Split(in, ",") + if len(contentTypes) == 0 { + return Header{}, fmt.Errorf("empty header value provided") + } + + types := make([]PreferredType, 0) + for _, typeRaw := range contentTypes { + // separate the parameters from the media type + split := strings.Split(strings.ToLower(typeRaw), ";") + if len(split) == 0 { + continue + } + + typ := PreferredType{ + ContentType: strings.TrimSpace(split[0]), + Parameters: make(map[string]string), + Weight: 1000, // default weight of 1.000 + } + + if len(split) > 1 { + params := split[1:] + for _, param := range params { + param = strings.TrimSpace(param) + + if len(param) < 3 || strings.Index(param, "=") < 1 { + return Header{}, fmt.Errorf("invalid parameter for %q: %q", typ.ContentType, param) + } + + p := strings.Split(param, "=") + if len(p) > 2 { + return Header{}, fmt.Errorf("parameter contains multiple `=` for %q: %q", typ.ContentType, param) + } + + for i, v := range p { + p[i] = strings.TrimSpace(v) + } + + // handle quality values and store other parameters in a map + switch p[0] { + case "q": + q := p[1] + + // determine whether it contains useful decimal point + pIndex := strings.Index(q, ".") + if pIndex == len(q) { + q = q[0 : len(q)-1] + pIndex = -1 + } + + if pIndex > 0 { + zIndex := len(q) + + // pad out the value to three decimal places + if zIndex-pIndex < 3 { + q = q + strings.Repeat("0", zIndex-pIndex) + zIndex = len(q) + } + + // trim any precision > 3 decimal places + if zIndex-pIndex > 4 { + zIndex = pIndex + 4 + } + + // strip out the decimal point, so we are left with thousandths + q = q[0:pIndex] + q[pIndex+1:zIndex] + } + + // convert the thousandths value to an int + weight, err := strconv.Atoi(q) + if err != nil { + return Header{}, fmt.Errorf("invalid weight for %q: %q", typ.ContentType, q) + } + + // if an integer was supplied, just multiply it for normalized value + if pIndex < 1 { + typ.Weight = qValue(weight * 1000) + } else { + typ.Weight = qValue(weight) + } + + default: + typ.Parameters[p[0]] = p[1] + } + } + } + + types = append(types, typ) + } + + sort.Slice(types, func(i, j int) bool { + return types[i].Weight > types[j].Weight + }) + + return Header{types: types}, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/azurecli/azcli.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/azurecli/azcli.go new file mode 100644 index 000000000000..f879e3f02fd6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/azurecli/azcli.go @@ -0,0 +1,128 @@ +package azurecli + +import ( + "bytes" + "encoding/json" + "fmt" + "os/exec" + "regexp" + "strings" + + "github.com/hashicorp/go-version" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +// CheckAzVersion tries to determine the version of Azure CLI in the path and checks for a compatible version +func CheckAzVersion(minVersion string, nextMajorVersion *string) error { + var cliVersion *struct { + AzureCli *string `json:"azure-cli,omitempty"` + AzureCliCore *string `json:"azure-cli-core,omitempty"` + AzureCliTelemetry *string `json:"azure-cli-telemetry,omitempty"` + Extensions *interface{} `json:"extensions,omitempty"` + } + err := JSONUnmarshalAzCmd(&cliVersion, "version") + if err != nil { + return fmt.Errorf("could not parse Azure CLI version: %v", err) + } + + if cliVersion.AzureCli == nil { + return fmt.Errorf("could not detect Azure CLI version. Please ensure you have installed Azure CLI version %s or newer", minVersion) + } + + actual, err := version.NewVersion(*cliVersion.AzureCli) + if err != nil { + return fmt.Errorf("could not parse detected Azure CLI version %q: %+v", *cliVersion.AzureCli, err) + } + + supported, err := version.NewVersion(minVersion) + if err != nil { + return fmt.Errorf("could not parse supported Azure CLI version: %+v", err) + } + + if nextMajorVersion != nil { + nextMajor, err := version.NewVersion(*nextMajorVersion) + if err != nil { + return fmt.Errorf("could not parse next major Azure CLI version: %+v", err) + } + + if nextMajor.LessThanOrEqual(actual) { + return fmt.Errorf("unsupported Azure CLI version %q detected, please install a version newer than %s but older than %s", actual, supported, nextMajor) + } + } + + if actual.LessThan(supported) { + return fmt.Errorf("unsupported Azure CLI version %q detected, please install version %s or newer and ensure the `az` command is in your path", actual, supported) + } + + return nil +} + +// GetDefaultSubscriptionID tries to determine the default subscription +func GetDefaultSubscriptionID() (string, error) { + var account struct { + SubscriptionID string `json:"id"` + } + err := JSONUnmarshalAzCmd(&account, "account", "show") + if err != nil { + return "", fmt.Errorf("obtaining subscription ID: %s", err) + } + + return account.SubscriptionID, nil +} + +// CheckTenantID validates the supplied tenant ID, and tries to determine the default tenant if a valid one is not supplied. +func CheckTenantID(tenantId string) (string, error) { + validTenantId, err := regexp.MatchString("^[a-zA-Z0-9._-]+$", tenantId) + if err != nil { + return "", fmt.Errorf("could not parse tenant ID %q: %s", tenantId, err) + } + + if !validTenantId { + var account struct { + ID string `json:"id"` + TenantID string `json:"tenantId"` + } + err := JSONUnmarshalAzCmd(&account, "account", "show") + if err != nil { + return "", fmt.Errorf("obtaining tenant ID: %s", err) + } + tenantId = account.TenantID + } + + return tenantId, nil +} + +// JSONUnmarshalAzCmd executes an Azure CLI command and unmarshalls the JSON output. +func JSONUnmarshalAzCmd(i interface{}, arg ...string) error { + var stderr bytes.Buffer + var stdout bytes.Buffer + + arg = append(arg, "-o=json") + cmd := exec.Command("az", arg...) + cmd.Stderr = &stderr + cmd.Stdout = &stdout + + if err := cmd.Start(); err != nil { + err := fmt.Errorf("launching Azure CLI: %+v", err) + if stdErrStr := stderr.String(); stdErrStr != "" { + err = fmt.Errorf("%s: %s", err, strings.TrimSpace(stdErrStr)) + } + return err + } + + if err := cmd.Wait(); err != nil { + err := fmt.Errorf("running Azure CLI: %+v", err) + if stdErrStr := stderr.String(); stdErrStr != "" { + err = fmt.Errorf("%s: %s", err, strings.TrimSpace(stdErrStr)) + } + return err + } + + if err := json.Unmarshal(stdout.Bytes(), &i); err != nil { + return fmt.Errorf("unmarshaling the output of Azure CLI: %v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/azurecli/versions.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/azurecli/versions.go new file mode 100644 index 000000000000..442dd09c7daf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/azurecli/versions.go @@ -0,0 +1,7 @@ +package azurecli + +const ( + MinimumVersion = "2.0.81" + MsalVersion = "2.30.0" + NextMajorVersion = "3.0.0" +) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/metadata/client.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/metadata/client.go new file mode 100644 index 000000000000..1e85e86efd8b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/metadata/client.go @@ -0,0 +1,204 @@ +package metadata + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "log" + "net/http" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +// NOTE: this Client cannot use the base client since it'd cause a circular reference + +type Client struct { + endpoint string +} + +func NewClientWithEndpoint(endpoint string) *Client { + return &Client{ + endpoint: endpoint, + } +} + +// GetMetaData connects to the ARM metadata service at the configured endpoint, to retrieve information about the +// current environment. Sometimes an endpoint will not support the latest schema, in such cases it will not be +// possible to configure all services but a best effort will be made to request and parse an earlier schema version. +// `name` is used when falling back to an earlier schema version where multiple environments are returned and the +// desired one must be matched by name. +func (c *Client) GetMetaData(ctx context.Context, name string) (*MetaData, error) { + metadata, err := c.getMetaDataFrom2022API(ctx, name) + if err != nil { + log.Printf("[DEBUG] Falling back to ARM Metadata version 2019-05-01 for %s", c.endpoint) + metadata, err = c.getMetaDataFrom2019API(ctx, name) + if err != nil { + return nil, fmt.Errorf("retrieving metadata from the 2022-09-01 and 2019-05-01 APIs: %+v", err) + } + } + + return &MetaData{ + Authentication: Authentication{ + Audiences: metadata.Authentication.Audiences, + LoginEndpoint: metadata.Authentication.LoginEndpoint, + IdentityProvider: metadata.Authentication.IdentityProvider, + Tenant: metadata.Authentication.Tenant, + }, + DnsSuffixes: DnsSuffixes{ + Attestation: metadata.Suffixes.AttestationEndpoint, + FrontDoor: metadata.Suffixes.AzureFrontDoorEndpointSuffix, + KeyVault: metadata.Suffixes.KeyVaultDns, + ManagedHSM: metadata.Suffixes.MhsmDns, + MariaDB: metadata.Suffixes.MariadbServerEndpoint, + MySql: metadata.Suffixes.MysqlServerEndpoint, + Postgresql: metadata.Suffixes.PostgresqlServerEndpoint, + SqlServer: metadata.Suffixes.SqlServerHostname, + Storage: metadata.Suffixes.Storage, + StorageSync: metadata.Suffixes.StorageSyncEndpointSuffix, + Synapse: metadata.Suffixes.SynapseAnalytics, + }, + Name: metadata.Name, + ResourceIdentifiers: ResourceIdentifiers{ + Attestation: normalizeResourceId(metadata.AttestationResourceId), + Batch: normalizeResourceId(metadata.Batch), + LogAnalytics: normalizeResourceId(metadata.LogAnalyticsResourceId), + Media: normalizeResourceId(metadata.Media), + MicrosoftGraph: normalizeResourceId(metadata.MicrosoftGraphResourceId), + OSSRDBMS: normalizeResourceId(metadata.OssrDbmsResourceId), + Synapse: normalizeResourceId(metadata.SynapseAnalyticsResourceId), + }, + ResourceManagerEndpoint: metadata.ResourceManager, + }, nil +} + +func (c *Client) getMetaDataFrom2022API(ctx context.Context, name string) (*metaDataResponse, error) { + client := &http.Client{ + Transport: http.DefaultTransport, + } + uri := fmt.Sprintf("%s/metadata/endpoints?api-version=2022-09-01", c.endpoint) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, uri, nil) + if err != nil { + return nil, fmt.Errorf("preparing request: %+v", err) + } + + resp, err := client.Do(req) + if err != nil { + return nil, fmt.Errorf("performing request: %+v", err) + } + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("performing request: expected 200 OK but got %d %s", resp.StatusCode, resp.Status) + } + + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("parsing response body: %+v", err) + } + resp.Body.Close() + + // Trim away a BOM if present + respBody = bytes.TrimPrefix(respBody, []byte("\xef\xbb\xbf")) + + var model *metaDataResponse + if err := json.Unmarshal(respBody, &model); err != nil { + log.Printf("[DEBUG] Unrecognised metadata response for %s: %s", uri, respBody) + return nil, fmt.Errorf("unmarshaling response: %+v", err) + } + + return model, nil +} + +func (c *Client) getMetaDataFrom2019API(ctx context.Context, name string) (*metaDataResponse, error) { + client := &http.Client{ + Transport: http.DefaultTransport, + } + uri := fmt.Sprintf("%s/metadata/endpoints?api-version=2019-05-01", c.endpoint) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, uri, nil) + if err != nil { + return nil, fmt.Errorf("preparing request: %+v", err) + } + + resp, err := client.Do(req) + if err != nil { + return nil, fmt.Errorf("performing request: %+v", err) + } + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("performing request: expected 200 OK but got %d %s", resp.StatusCode, resp.Status) + } + + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("parsing response body: %+v", err) + } + resp.Body.Close() + + // Trim away a BOM if present + respBody = bytes.TrimPrefix(respBody, []byte("\xef\xbb\xbf")) + + var model *[]metaDataResponse + if err := json.Unmarshal(respBody, &model); err != nil { + log.Printf("[DEBUG] Unrecognised metadata response for %s: %s", uri, respBody) + return nil, fmt.Errorf("unmarshaling response: %+v", err) + } + + if model == nil { + return nil, fmt.Errorf("unmarshaling response: no environments returned") + } + + // This version returns an array of environments, we are only interested in one + var env metaDataResponse + for _, e := range *model { + if name == "" || e.Name == name { + env = e + break + } + } + return &env, nil +} + +type metaDataResponse struct { + Portal string `json:"portal"` + Authentication struct { + LoginEndpoint string `json:"loginEndpoint"` + Audiences []string `json:"audiences"` + Tenant string `json:"tenant"` + IdentityProvider string `json:"identityProvider"` + } `json:"authentication"` + Media string `json:"media"` + GraphAudience string `json:"graphAudience"` + Graph string `json:"graph"` + Name string `json:"name"` + Suffixes struct { + AzureDataLakeStoreFileSystem string `json:"azureDataLakeStoreFileSystem"` + AcrLoginServer string `json:"acrLoginServer"` + SqlServerHostname string `json:"sqlServerHostname"` + AzureDataLakeAnalyticsCatalogAndJob string `json:"azureDataLakeAnalyticsCatalogAndJob"` + KeyVaultDns string `json:"keyVaultDns"` + Storage string `json:"storage"` + AzureFrontDoorEndpointSuffix string `json:"azureFrontDoorEndpointSuffix"` + StorageSyncEndpointSuffix string `json:"storageSyncEndpointSuffix"` + MhsmDns string `json:"mhsmDns"` + MysqlServerEndpoint string `json:"mysqlServerEndpoint"` + PostgresqlServerEndpoint string `json:"postgresqlServerEndpoint"` + MariadbServerEndpoint string `json:"mariadbServerEndpoint"` + SynapseAnalytics string `json:"synapseAnalytics"` + AttestationEndpoint string `json:"attestationEndpoint"` + } `json:"suffixes"` + Batch string `json:"batch"` + ResourceManager string `json:"resourceManager"` + VmImageAliasDoc string `json:"vmImageAliasDoc"` + ActiveDirectoryDataLake string `json:"activeDirectoryDataLake"` + SqlManagement string `json:"sqlManagement"` + MicrosoftGraphResourceId string `json:"microsoftGraphResourceId"` + AppInsightsResourceId string `json:"appInsightsResourceId"` + AppInsightsTelemetryChannelResourceId string `json:"appInsightsTelemetryChannelResourceId"` + AttestationResourceId string `json:"attestationResourceId"` + SynapseAnalyticsResourceId string `json:"synapseAnalyticsResourceId"` + LogAnalyticsResourceId string `json:"logAnalyticsResourceId"` + OssrDbmsResourceId string `json:"ossrDbmsResourceId"` + Gallery string `json:"gallery"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/metadata/helpers.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/metadata/helpers.go new file mode 100644 index 000000000000..d2f195d6396e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/metadata/helpers.go @@ -0,0 +1,7 @@ +package metadata + +import "strings" + +func normalizeResourceId(resourceId string) string { + return strings.TrimRight(resourceId, "/") +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/metadata/models.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/metadata/models.go new file mode 100644 index 000000000000..3fb8d37d9da7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/metadata/models.go @@ -0,0 +1,40 @@ +package metadata + +type MetaData struct { + Authentication Authentication + DnsSuffixes DnsSuffixes + Name string + ResourceIdentifiers ResourceIdentifiers + ResourceManagerEndpoint string +} + +type Authentication struct { + Audiences []string + LoginEndpoint string + IdentityProvider string + Tenant string +} + +type DnsSuffixes struct { + Attestation string + FrontDoor string + KeyVault string + ManagedHSM string + MariaDB string + MySql string + Postgresql string + SqlServer string + Storage string + StorageSync string + Synapse string +} + +type ResourceIdentifiers struct { + Attestation string + Batch string + LogAnalytics string + Media string + MicrosoftGraph string + OSSRDBMS string + Synapse string +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/stringfmt/quote_and_split_at.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/stringfmt/quote_and_split_at.go new file mode 100644 index 000000000000..59dd1eeb699c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/internal/stringfmt/quote_and_split_at.go @@ -0,0 +1,26 @@ +package stringfmt + +import ( + "fmt" + "math" +) + +// QuoteAndSplitString cuts a string to the specified number of characters and then quotes it +// to enable it to be output as an semi-formatted error message. +func QuoteAndSplitString(message, quoteChar string, characters int) []string { + lines := make([]string, 0) + + numberOfLines := int(math.Ceil(float64(len(message) / (characters * 1.0)))) + for i := 0; i <= numberOfLines; i++ { + start := characters * i + remainingString := message[start:] + end := characters + if len(remainingString) < characters { + end = len(remainingString) + } + line := remainingString[0:end] + lines = append(lines, fmt.Sprintf("%s %s", quoteChar, line)) + } + + return lines +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/odata/errors.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/odata/errors.go new file mode 100644 index 000000000000..468b3c56a645 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/odata/errors.go @@ -0,0 +1,102 @@ +package odata + +import ( + "encoding/json" + "fmt" + "regexp" + "strings" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const ( + ErrorAddedObjectReferencesAlreadyExist = "One or more added object references already exist" + ErrorCannotDeleteOrUpdateEnabledEntitlement = "Permission (scope or role) cannot be deleted or updated unless disabled first" + ErrorConflictingObjectPresentInDirectory = "A conflicting object with one or more of the specified property values is present in the directory" + ErrorNotValidReferenceUpdate = "Not a valid reference update" + ErrorPropertyValuesAreInvalid = "One or more property values specified are invalid" + ErrorResourceDoesNotExist = "Resource '.+' does not exist or one of its queried reference-property objects are not present" + ErrorRemovedObjectReferencesDoNotExist = "One or more removed object references do not exist" + ErrorServicePrincipalAppInOtherTenant = "When using this permission, the backing application of the service principal being created must in the local tenant" + ErrorServicePrincipalInvalidAppId = "The appId '.+' of the service principal does not reference a valid application object" + ErrorUnknownUnsupportedQuery = "UnknownError: Unsupported Query" +) + +// Error is used to unmarshal an API error message. +type Error struct { + Code *string `json:"code"` + Date *string `json:"date"` + Message *string `json:"-"` + RawMessage *json.RawMessage `json:"message"` // sometimes a string, sometimes an object :/ + ClientRequestId *string `json:"client-request-id"` + RequestId *string `json:"request-id"` + + InnerError *Error `json:"innerError"` // nested errors + + Details *[]struct { + Code *string `json:"code"` + Target *string `json:"target"` + } `json:"details"` + + Values *[]struct { + Item string `json:"item"` + Value string `json:"value"` + } `json:"values"` +} + +func (e *Error) UnmarshalJSON(data []byte) error { + // Perform unmarshalling using a local type + type error Error + var e2 error + if err := json.Unmarshal(data, &e2); err != nil { + return err + } + *e = Error(e2) + + // Unmarshal the message, which can be a plain string or an object wrapping a message + if raw := e.RawMessage; raw != nil && len(*raw) > 0 { + switch string((*raw)[0]) { + case "\"": + var s string + if err := json.Unmarshal(*raw, &s); err != nil { + return err + } + e.Message = &s + case "{": + var m map[string]interface{} + if err := json.Unmarshal(*raw, &m); err != nil { + return err + } + if v, ok := m["value"]; ok { + if s, ok := v.(string); ok { + e.Message = &s + } + } + default: + return fmt.Errorf("unrecognised error message: %#v", string(*raw)) + } + } + return nil +} + +func (e Error) String() string { + sl := make([]string, 0) + if e.Code != nil { + sl = append(sl, *e.Code) + } + if e.Message != nil { + sl = append(sl, *e.Message) + } + if e.InnerError != nil { + if is := e.InnerError.String(); is != "" { + sl = append(sl, is) + } + } + return strings.Join(sl, ": ") +} + +func (e Error) Match(errorText string) bool { + re := regexp.MustCompile(errorText) + return re.MatchString(e.String()) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/odata/http.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/odata/http.go new file mode 100644 index 000000000000..66687c423585 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/odata/http.go @@ -0,0 +1,46 @@ +package odata + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "net/http" + "strings" +) + +// FromResponse parses an http.Response and returns an unmarshaled OData +// If no odata is present in the response, or the content type is invalid, returns nil +func FromResponse(resp *http.Response) (*OData, error) { + if resp == nil { + return nil, nil + } + + var o OData + + // Check for json content before looking for odata metadata + contentType := strings.ToLower(resp.Header.Get("Content-Type")) + if strings.HasPrefix(contentType, "application/json") { + // Read the response body and close it + respBody, err := io.ReadAll(resp.Body) + resp.Body.Close() + if err != nil { + return nil, fmt.Errorf("could not read response body: %s", err) + } + + // Unmarshal odata + if err := json.Unmarshal(respBody, &o); err != nil { + return nil, err + } + + // Reassign the response body + resp.Body = io.NopCloser(bytes.NewBuffer(respBody)) + + return &o, nil + } + + return nil, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/odata/odata.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/odata/odata.go new file mode 100644 index 000000000000..f804ecdd3570 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/odata/odata.go @@ -0,0 +1,129 @@ +package odata + +import ( + "encoding/json" + "fmt" + "net/url" + "regexp" + + "github.com/hashicorp/go-uuid" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const ODataVersion = "4.0" // TODO: support 4.01 - https://docs.oasis-open.org/odata/odata-json-format/v4.01/cs01/odata-json-format-v4.01-cs01.html#_Toc499720587 + +type Id string + +func (id Id) MarshalJSON() ([]byte, error) { + id2 := regexp.MustCompile(`/v2/`).ReplaceAllString(string(id), `/v1.0/`) + + // For MS Graph, fix invalid IDs by attempting to parse a UUID from them and constructing a valid URI + // TODO: improve logic here, currently assumes all invalid IDs are graph entities + u, err := url.Parse(id2) + if err != nil || u.Scheme == "" || u.Host == "" { + matches := regexp.MustCompile(`([^()'"]+)\(['"]([^'"]+)['"]\)`).FindStringSubmatch(id2) + if len(matches) != 3 { + return nil, fmt.Errorf("Marshaling odata.Id: could not match a GUID") + } + + objectType := matches[1] + guid := matches[2] + if _, err = uuid.ParseUUID(guid); err != nil { + return nil, fmt.Errorf("Marshaling odata.Id: %+v", err) + } + + // Although we're hard-coding `graph.microsoft.com` here, this doesn't _appear_ to be a problem + // The host can seemingly be anything, even complete nonsense, and the API will accept it provided + // it can parse out a version number, an object type and a GUID. + id2 = fmt.Sprintf("https://graph.microsoft.com/v1.0/%s/%s", objectType, guid) + } + + return json.Marshal(id2) +} + +func (id *Id) UnmarshalJSON(data []byte) error { + if id == nil { + return nil + } + + var id2 string + if err := json.Unmarshal(data, &id2); err != nil { + return err + } + *id = Id(regexp.MustCompile(`/v2/`).ReplaceAllString(id2, `/v1.0/`)) + + return nil +} + +type Link string + +func (l *Link) UnmarshalJSON(data []byte) error { + if l == nil { + return nil + } + + var link string + if err := json.Unmarshal(data, &link); err != nil { + return err + } + + // Fix unescaped URLs + // https://github.com/Azure/azure-sdk-for-go/issues/18809 + u, err := url.ParseRequestURI(link) + if err != nil { + return err + } + u.RawQuery = u.Query().Encode() + + // For MS Graph, "v2" is a dev/internal version that sometimes leaks out + *l = Link(regexp.MustCompile(`/v2/`).ReplaceAllString(u.String(), `/v1.0/`)) + + return nil +} + +// OData is used to unmarshall OData metadata from an API response. +type OData struct { + Context *string `json:"@odata.context"` + MetadataEtag *string `json:"@odata.metadataEtag"` + Type *Type `json:"@odata.type"` + Count *int `json:"@odata.count"` + NextLink *Link `json:"@odata.nextLink"` + Delta *string `json:"@odata.delta"` + DeltaLink *Link `json:"@odata.deltaLink"` + Id *Id `json:"@odata.id"` + EditLink *Link `json:"@odata.editLink"` + Etag *string `json:"@odata.etag"` + + Error *Error `json:"-"` + + Value interface{} `json:"value"` +} + +func (o *OData) UnmarshalJSON(data []byte) error { + // Unmarshal using a local type + type odata OData + var o2 odata + if err := json.Unmarshal(data, &o2); err != nil { + return err + } + *o = OData(o2) + + // Look for errors in the "error" and "odata.error" fields + var e map[string]json.RawMessage + if err := json.Unmarshal(data, &e); err != nil { + return err + } + for _, k := range []string{"error", "odata.error"} { + if v, ok := e[k]; ok { + var e2 Error + if err := json.Unmarshal(v, &e2); err != nil { + return err + } + o.Error = &e2 + break + } + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/odata/query.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/odata/query.go new file mode 100644 index 000000000000..c9c6c582115a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/odata/query.go @@ -0,0 +1,183 @@ +package odata + +import ( + "fmt" + "net/http" + "net/url" + "strconv" + "strings" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConsistencyLevel string + +const ( + ConsistencyLevelEventual ConsistencyLevel = "eventual" +) + +type Metadata string + +const ( + MetadataFull Metadata = "full" + MetadataMinimal Metadata = "minimal" + MetadataNone Metadata = "none" +) + +type Query struct { + // ConsistencyLevel sets the corresponding http header + ConsistencyLevel ConsistencyLevel + + // Metadata indicates how much control information is requested (services assume "minimal" when not specified) + Metadata Metadata + + // Count includes a count of the total number of items in a collection alongside the page of data values + Count bool + + // Expand includes the expanded resource or collection referenced by a single relationship + Expand Expand + + // Filter retrieves just a subset of a collection, or relationships like members, memberOf, transitiveMembers, and transitiveMemberOf + Filter string + + // Format specifies the media format of the items returned + Format Format + + // OrderBy specify the sort order of the items returned + OrderBy OrderBy + + // Search restricts the results of a request to match a search criterion + Search string // complicated + + // Select returns a set of properties that are different than the default set for an individual resource or a collection of resources + Select []string + + // Skip sets the number of items to skip at the start of a collection + Skip int + + // Top specifies the page size of the result set + Top int +} + +// Headers returns an http.Header map containing OData specific headers +func (q Query) Headers() http.Header { + // Take extra care over canonicalization of header names + headers := http.Header{} + headers.Set("Odata-Maxversion", ODataVersion) + headers.Set("Odata-Version", ODataVersion) + + accept := "application/json; charset=utf-8; IEEE754Compatible=false" + if q.Metadata != "" { + accept = fmt.Sprintf("%s; odata.metadata=%s", accept, q.Metadata) + } + headers.Set("Accept", accept) + + if q.ConsistencyLevel != "" { + headers.Set("Consistencylevel", string(q.ConsistencyLevel)) + } + + return headers +} + +// AppendHeaders returns the provided http.Header map with OData specific headers appended, for use in requests +func (q Query) AppendHeaders(header http.Header) http.Header { + if header == nil { + header = http.Header{} + } + for k, v := range q.Headers() { + if len(v) > 0 { + header.Set(k, v[0]) + } + } + return header +} + +// Values returns a url.Values map containing OData specific query parameters +func (q Query) Values() url.Values { + p := url.Values{} + + if q.Count { + p.Add("$count", fmt.Sprintf("%t", q.Count)) + } + if expand := q.Expand.String(); expand != "" { + p.Add("$expand", expand) + } + if q.Filter != "" { + p.Add("$filter", q.Filter) + } + if format := string(q.Format); format != "" { + p.Add("$format", format) + } + if orderBy := q.OrderBy.String(); orderBy != "" { + p.Add("$orderby", orderBy) + } + if q.Search != "" { + p.Add("$search", fmt.Sprintf(`"%s"`, q.Search)) + } + if len(q.Select) > 0 { + p.Add("$select", strings.Join(q.Select, ",")) + } + if q.Skip > 0 { + p.Add("$skip", strconv.Itoa(q.Skip)) + } + if q.Top > 0 { + p.Add("$top", strconv.Itoa(q.Top)) + } + + return p +} + +// AppendValues returns the provided url.Values map with OData specific query parameters appended, for use in requests +func (q Query) AppendValues(values url.Values) url.Values { + if values == nil { + values = url.Values{} + } + for k, v := range q.Values() { + if len(v) > 0 { + values.Set(k, v[0]) + } + } + return values +} + +type Expand struct { + Relationship string + Select []string +} + +func (e Expand) String() (val string) { + val = e.Relationship + if len(e.Select) > 0 { + val = fmt.Sprintf("%s($select=%s)", val, strings.Join(e.Select, ",")) + } + return +} + +type Format string + +const ( + FormatJson Format = "json" + FormatAtom Format = "atom" + FormatXml Format = "xml" +) + +type Direction string + +const ( + Ascending Direction = "asc" + Descending Direction = "desc" +) + +type OrderBy struct { + Field string + Direction Direction +} + +func (o OrderBy) String() (val string) { + val = o.Field + if val != "" && o.Direction != "" { + val = fmt.Sprintf("%s %s", val, o.Direction) + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/odata/types.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/odata/types.go new file mode 100644 index 000000000000..70b1ee01393f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/odata/types.go @@ -0,0 +1,89 @@ +package odata + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ShortType = string + +const ( + ShortTypeAccessPackage ShortType = "accessPackage" + ShortTypeAccessPackageAssignmentPolicy ShortType = "accessPackageAssignmentPolicy" + ShortTypeAccessPackageCatalog ShortType = "accessPackageCatalog" + ShortTypeAccessPackageResourceRequest ShortType = "accessPackageResourceRequest" + ShortTypeAccessPackageQuestion ShortType = "accessPackageQuestion" + ShortTypeAccessPackageTextInputQuestion ShortType = "accessPackageTextInputQuestion" + ShortTypeAccessPackageMultipleChoiceQuestion ShortType = "accessPackageMultipleChoiceQuestion" + ShortTypeAdministrativeUnit ShortType = "administrativeUnit" + ShortTypeApplication ShortType = "application" + ShortTypeConditionalAccessPolicy ShortType = "conditionalAccessPolicy" + ShortTypeConnectedOrganizationMembers ShortType = "connectedOrganizationMembers" + ShortTypeConnectionInfo ShortType = "connectionInfo" + ShortTypeCountryNamedLocation ShortType = "countryNamedLocation" + ShortTypeDevice ShortType = "device" + ShortTypeDirectoryRole ShortType = "directoryRole" + ShortTypeDirectoryRoleTemplate ShortType = "directoryRoleTemplate" + ShortTypeDomain ShortType = "domain" + ShortTypeEmailAuthenticationMethod ShortType = "emailAuthenticationMethod" + ShortTypeExternalSponsors ShortType = "externalSponsors" + ShortTypeFido2AuthenticationMethod ShortType = "fido2AuthenticationMethod" + ShortTypeGroup ShortType = "group" + ShortTypeGroupMembers ShortType = "groupMembers" + ShortTypeIpNamedLocation ShortType = "ipNamedLocation" + ShortTypeInternalSponsors ShortType = "internalSponsors" + ShortTypeNamedLocation ShortType = "namedLocation" + ShortTypeMicrosoftAuthenticatorAuthenticationMethod ShortType = "microsoftAuthenticatorAuthenticationMethod" + ShortTypeOrganization ShortType = "organization" + ShortTypePasswordAuthenticationMethod ShortType = "passwordAuthenticationMethod" + ShortTypePhoneAuthenticationMethod ShortType = "phoneAuthenticationMethod" + ShortTypeRequestorManager ShortType = "requestorManager" + ShortTypeServicePrincipal ShortType = "servicePrincipal" + ShortTypeSingleUser ShortType = "singleUser" + ShortTypeSocialIdentityProvider ShortType = "socialIdentityProvider" + ShortTypeTemporaryAccessPassAuthenticationMethod ShortType = "temporaryAccessPassAuthenticationMethod" + ShortTypeUser ShortType = "user" + ShortTypeWindowsHelloForBusinessAuthenticationMethod ShortType = "windowsHelloForBusinessAuthenticationMethod" +) + +type Type = string + +const ( + TypeAccessPackage Type = "#microsoft.graph.accessPackage" + TypeAccessPackageAssignmentPolicy Type = "#microsoft.graph.accessPackageAssignmentPolicy" + TypeAccessPackageCatalog Type = "#microsoft.graph.accessPackageCatalog" + TypeAccessPackageMultipleChoiceQuestion Type = "#microsoft.graph.accessPackageMultipleChoiceQuestion" + TypeAccessPackageQuestion Type = "#microsoft.graph.accessPackageQuestion" + TypeAccessPackageResourceRequest Type = "#microsoft.graph.accessPackageResourceRequest" + TypeAccessPackageTextInputQuestion Type = "#microsoft.graph.accessPackageTextInputQuestion" + TypeAdministrativeUnit Type = "#microsoft.graph.administrativeUnit" + TypeApplication Type = "#microsoft.graph.application" + TypeAzureActiveDirectoryTenant Type = "#microsoft.graph.azureActiveDirectoryTenant" + TypeConditionalAccessPolicy Type = "#microsoft.graph.conditionalAccessPolicy" + TypeConnectedOrganizationMembers Type = "#microsoft.graph.connectedOrganizationMembers" + TypeConnectionInfo Type = "#microsoft.graph.connectionInfo" + TypeCountryNamedLocation Type = "#microsoft.graph.countryNamedLocation" + TypeDevice Type = "#microsoft.graph.device" + TypeDirectoryRole Type = "#microsoft.graph.directoryRole" + TypeDirectoryRoleTemplate Type = "#microsoft.graph.directoryRoleTemplate" + TypeDomain Type = "#microsoft.graph.domain" + TypeDomainIdentitySource Type = "#microsoft.graph.domainIdentitySource" + TypeEmailAuthenticationMethod Type = "#microsoft.graph.emailAuthenticationMethod" + TypeExternalDomainFederation Type = "#microsoft.graph.externalDomainFederation" + TypeExternalSponsors Type = "#microsoft.graph.externalSponsors" + TypeFido2AuthenticationMethod Type = "#microsoft.graph.fido2AuthenticationMethod" + TypeGroup Type = "#microsoft.graph.group" + TypeGroupMembers Type = "#microsoft.graph.groupMembers" + TypeInternalSponsors Type = "#microsoft.graph.internalSponsors" + TypeIpNamedLocation Type = "#microsoft.graph.ipNamedLocation" + TypeMicrosoftAuthenticatorAuthenticationMethod Type = "#microsoft.graph.microsoftAuthenticatorAuthenticationMethod" + TypeNamedLocation Type = "#microsoft.graph.namedLocation" + TypeOrganization Type = "#microsoft.graph.organization" + TypePasswordAuthenticationMethod Type = "#microsoft.graph.passwordAuthenticationMethod" + TypePhoneAuthenticationMethod Type = "#microsoft.graph.phoneAuthenticationMethod" + TypeRequestorManager Type = "#microsoft.graph.requestorManager" + TypeServicePrincipal Type = "#microsoft.graph.servicePrincipal" + TypeSingleUser Type = "#microsoft.graph.singleUser" + TypeSocialIdentityProvider Type = "#microsoft.graph.socialIdentityProvider" + TypeTemporaryAccessPassAuthenticationMethod Type = "#microsoft.graph.temporaryAccessPassAuthenticationMethod" + TypeUser Type = "#microsoft.graph.user" + TypeWindowsHelloForBusinessAuthenticationMethod Type = "#microsoft.graph.windowsHelloForBusinessAuthenticationMethod" +) diff --git a/vendor/github.com/hashicorp/go-hclog/colorize_unix.go b/vendor/github.com/hashicorp/go-hclog/colorize_unix.go index 9635c838b4e9..99cc176a416b 100644 --- a/vendor/github.com/hashicorp/go-hclog/colorize_unix.go +++ b/vendor/github.com/hashicorp/go-hclog/colorize_unix.go @@ -8,7 +8,7 @@ import ( ) // setColorization will mutate the values of this logger -// to approperately configure colorization options. It provides +// to appropriately configure colorization options. It provides // a wrapper to the output stream on Windows systems. func (l *intLogger) setColorization(opts *LoggerOptions) { switch opts.Color { diff --git a/vendor/github.com/hashicorp/go-hclog/colorize_windows.go b/vendor/github.com/hashicorp/go-hclog/colorize_windows.go index 30859168eebe..26f8cef8d121 100644 --- a/vendor/github.com/hashicorp/go-hclog/colorize_windows.go +++ b/vendor/github.com/hashicorp/go-hclog/colorize_windows.go @@ -11,7 +11,7 @@ import ( ) // setColorization will mutate the values of this logger -// to approperately configure colorization options. It provides +// to appropriately configure colorization options. It provides // a wrapper to the output stream on Windows systems. func (l *intLogger) setColorization(opts *LoggerOptions) { switch opts.Color { diff --git a/vendor/github.com/hashicorp/go-hclog/global.go b/vendor/github.com/hashicorp/go-hclog/global.go index b9f00217cae3..48ff1f3a4e90 100644 --- a/vendor/github.com/hashicorp/go-hclog/global.go +++ b/vendor/github.com/hashicorp/go-hclog/global.go @@ -20,13 +20,13 @@ var ( ) // Default returns a globally held logger. This can be a good starting -// place, and then you can use .With() and .Name() to create sub-loggers +// place, and then you can use .With() and .Named() to create sub-loggers // to be used in more specific contexts. // The value of the Default logger can be set via SetDefault() or by // changing the options in DefaultOptions. // // This method is goroutine safe, returning a global from memory, but -// cause should be used if SetDefault() is called it random times +// care should be used if SetDefault() is called it random times // in the program as that may result in race conditions and an unexpected // Logger being returned. func Default() Logger { diff --git a/vendor/github.com/hashicorp/go-hclog/intlogger.go b/vendor/github.com/hashicorp/go-hclog/intlogger.go index 83232f7a622f..89d26c9b01f7 100644 --- a/vendor/github.com/hashicorp/go-hclog/intlogger.go +++ b/vendor/github.com/hashicorp/go-hclog/intlogger.go @@ -17,6 +17,8 @@ import ( "sync" "sync/atomic" "time" + "unicode" + "unicode/utf8" "github.com/fatih/color" ) @@ -48,6 +50,12 @@ var ( Warn: color.New(color.FgHiYellow), Error: color.New(color.FgHiRed), } + + faintBoldColor = color.New(color.Faint, color.Bold) + faintColor = color.New(color.Faint) + faintMultiLinePrefix = faintColor.Sprint(" | ") + faintFieldSeparator = faintColor.Sprint("=") + faintFieldSeparatorWithNewLine = faintColor.Sprint("=\n") ) // Make sure that intLogger is a Logger @@ -70,6 +78,7 @@ type intLogger struct { level *int32 headerColor ColorOption + fieldColor ColorOption implied []interface{} @@ -115,14 +124,19 @@ func newLogger(opts *LoggerOptions) *intLogger { mutex = new(sync.Mutex) } - var primaryColor, headerColor ColorOption - - if opts.ColorHeaderOnly { - primaryColor = ColorOff + var ( + primaryColor ColorOption = ColorOff + headerColor ColorOption = ColorOff + fieldColor ColorOption = ColorOff + ) + switch { + case opts.ColorHeaderOnly: headerColor = opts.Color - } else { + case opts.ColorHeaderAndFields: + fieldColor = opts.Color + headerColor = opts.Color + default: primaryColor = opts.Color - headerColor = ColorOff } l := &intLogger{ @@ -137,6 +151,7 @@ func newLogger(opts *LoggerOptions) *intLogger { exclude: opts.Exclude, independentLevels: opts.IndependentLevels, headerColor: headerColor, + fieldColor: fieldColor, } if opts.IncludeLocation { l.callerOffset = offsetIntLogger + opts.AdditionalLocationOffset @@ -160,7 +175,7 @@ func newLogger(opts *LoggerOptions) *intLogger { } // offsetIntLogger is the stack frame offset in the call stack for the caller to -// one of the Warn,Info,Log,etc methods. +// one of the Warn, Info, Log, etc methods. const offsetIntLogger = 3 // Log a message and a set of key/value pairs if the given level is at @@ -235,7 +250,17 @@ func needsQuoting(str string) bool { return false } -// Non-JSON logging format function +// logPlain is the non-JSON logging format function which writes directly +// to the underlying writer the logger was initialized with. +// +// If the logger was initialized with a color function, it also handles +// applying the color to the log message. +// +// Color Options +// 1. No color. +// 2. Color the whole log line, based on the level. +// 3. Color only the header (level) part of the log line. +// 4. Color both the header and fields of the log line. func (l *intLogger) logPlain(t time.Time, name string, level Level, msg string, args ...interface{}) { if !l.disableTime { @@ -269,16 +294,19 @@ func (l *intLogger) logPlain(t time.Time, name string, level Level, msg string, if name != "" { l.writer.WriteString(name) - l.writer.WriteString(": ") + if msg != "" { + l.writer.WriteString(": ") + l.writer.WriteString(msg) + } + } else if msg != "" { + l.writer.WriteString(msg) } - l.writer.WriteString(msg) - args = append(l.implied, args...) var stacktrace CapturedStacktrace - if args != nil && len(args) > 0 { + if len(args) > 0 { if len(args)%2 != 0 { cs, ok := args[len(args)-1].(CapturedStacktrace) if ok { @@ -292,13 +320,16 @@ func (l *intLogger) logPlain(t time.Time, name string, level Level, msg string, l.writer.WriteByte(':') + // Handle the field arguments, which come in pairs (key=val). FOR: for i := 0; i < len(args); i = i + 2 { var ( + key string val string raw bool ) + // Convert the field value to a string. switch st := args[i+1].(type) { case string: val = st @@ -350,8 +381,7 @@ func (l *intLogger) logPlain(t time.Time, name string, level Level, msg string, } } - var key string - + // Convert the field key to a string. switch st := args[i].(type) { case string: key = st @@ -359,21 +389,49 @@ func (l *intLogger) logPlain(t time.Time, name string, level Level, msg string, key = fmt.Sprintf("%s", st) } + // Optionally apply the ANSI "faint" and "bold" + // SGR values to the key. + if l.fieldColor != ColorOff { + key = faintBoldColor.Sprint(key) + } + + // Values may contain multiple lines, and that format + // is preserved, with each line prefixed with a " | " + // to show it's part of a collection of lines. + // + // Values may also need quoting, if not all the runes + // in the value string are "normal", like if they + // contain ANSI escape sequences. if strings.Contains(val, "\n") { l.writer.WriteString("\n ") l.writer.WriteString(key) - l.writer.WriteString("=\n") - writeIndent(l.writer, val, " | ") + if l.fieldColor != ColorOff { + l.writer.WriteString(faintFieldSeparatorWithNewLine) + writeIndent(l.writer, val, faintMultiLinePrefix) + } else { + l.writer.WriteString("=\n") + writeIndent(l.writer, val, " | ") + } l.writer.WriteString(" ") } else if !raw && needsQuoting(val) { l.writer.WriteByte(' ') l.writer.WriteString(key) - l.writer.WriteByte('=') - l.writer.WriteString(strconv.Quote(val)) + if l.fieldColor != ColorOff { + l.writer.WriteString(faintFieldSeparator) + } else { + l.writer.WriteByte('=') + } + l.writer.WriteByte('"') + writeEscapedForOutput(l.writer, val, true) + l.writer.WriteByte('"') } else { l.writer.WriteByte(' ') l.writer.WriteString(key) - l.writer.WriteByte('=') + if l.fieldColor != ColorOff { + l.writer.WriteString(faintFieldSeparator) + } else { + l.writer.WriteByte('=') + } l.writer.WriteString(val) } } @@ -393,19 +451,98 @@ func writeIndent(w *writer, str string, indent string) { if nl == -1 { if str != "" { w.WriteString(indent) - w.WriteString(str) + writeEscapedForOutput(w, str, false) w.WriteString("\n") } return } w.WriteString(indent) - w.WriteString(str[:nl]) + writeEscapedForOutput(w, str[:nl], false) w.WriteString("\n") str = str[nl+1:] } } +func needsEscaping(str string) bool { + for _, b := range str { + if !unicode.IsPrint(b) || b == '"' { + return true + } + } + + return false +} + +const ( + lowerhex = "0123456789abcdef" +) + +var bufPool = sync.Pool{ + New: func() interface{} { + return new(bytes.Buffer) + }, +} + +func writeEscapedForOutput(w io.Writer, str string, escapeQuotes bool) { + if !needsEscaping(str) { + w.Write([]byte(str)) + return + } + + bb := bufPool.Get().(*bytes.Buffer) + bb.Reset() + + defer bufPool.Put(bb) + + for _, r := range str { + if escapeQuotes && r == '"' { + bb.WriteString(`\"`) + } else if unicode.IsPrint(r) { + bb.WriteRune(r) + } else { + switch r { + case '\a': + bb.WriteString(`\a`) + case '\b': + bb.WriteString(`\b`) + case '\f': + bb.WriteString(`\f`) + case '\n': + bb.WriteString(`\n`) + case '\r': + bb.WriteString(`\r`) + case '\t': + bb.WriteString(`\t`) + case '\v': + bb.WriteString(`\v`) + default: + switch { + case r < ' ': + bb.WriteString(`\x`) + bb.WriteByte(lowerhex[byte(r)>>4]) + bb.WriteByte(lowerhex[byte(r)&0xF]) + case !utf8.ValidRune(r): + r = 0xFFFD + fallthrough + case r < 0x10000: + bb.WriteString(`\u`) + for s := 12; s >= 0; s -= 4 { + bb.WriteByte(lowerhex[r>>uint(s)&0xF]) + } + default: + bb.WriteString(`\U`) + for s := 28; s >= 0; s -= 4 { + bb.WriteByte(lowerhex[r>>uint(s)&0xF]) + } + } + } + } + } + + w.Write(bb.Bytes()) +} + func (l *intLogger) renderSlice(v reflect.Value) string { var buf bytes.Buffer @@ -707,6 +844,11 @@ func (l *intLogger) SetLevel(level Level) { atomic.StoreInt32(l.level, int32(level)) } +// Returns the current level +func (l *intLogger) GetLevel() Level { + return Level(atomic.LoadInt32(l.level)) +} + // Create a *log.Logger that will send it's data through this Logger. This // allows packages that expect to be using the standard library log to actually // use this logger. diff --git a/vendor/github.com/hashicorp/go-hclog/logger.go b/vendor/github.com/hashicorp/go-hclog/logger.go index 858143028427..3cdb2837d798 100644 --- a/vendor/github.com/hashicorp/go-hclog/logger.go +++ b/vendor/github.com/hashicorp/go-hclog/logger.go @@ -9,7 +9,7 @@ import ( ) var ( - //DefaultOutput is used as the default log output. + // DefaultOutput is used as the default log output. DefaultOutput io.Writer = os.Stderr // DefaultLevel is used as the default log level. @@ -28,7 +28,7 @@ const ( // of actions in code, such as function enters/exits, etc. Trace Level = 1 - // Debug information for programmer lowlevel analysis. + // Debug information for programmer low-level analysis. Debug Level = 2 // Info information about steady state operations. @@ -44,13 +44,13 @@ const ( Off Level = 6 ) -// Format is a simple convience type for when formatting is required. When +// Format is a simple convenience type for when formatting is required. When // processing a value of this type, the logger automatically treats the first // argument as a Printf formatting string and passes the rest as the values // to be formatted. For example: L.Info(Fmt{"%d beans/day", beans}). type Format []interface{} -// Fmt returns a Format type. This is a convience function for creating a Format +// Fmt returns a Format type. This is a convenience function for creating a Format // type. func Fmt(str string, args ...interface{}) Format { return append(Format{str}, args...) @@ -134,7 +134,7 @@ func (l Level) String() string { } } -// Logger describes the interface that must be implemeted by all loggers. +// Logger describes the interface that must be implemented by all loggers. type Logger interface { // Args are alternating key, val pairs // keys must be strings @@ -198,6 +198,9 @@ type Logger interface { // implementation cannot update the level on the fly, it should no-op. SetLevel(level Level) + // Returns the current level + GetLevel() Level + // Return a value that conforms to the stdlib log.Logger interface StandardLogger(opts *StandardLoggerOptions) *log.Logger @@ -236,7 +239,7 @@ type LoggerOptions struct { // Name of the subsystem to prefix logs with Name string - // The threshold for the logger. Anything less severe is supressed + // The threshold for the logger. Anything less severe is suppressed Level Level // Where to write the logs to. Defaults to os.Stderr if nil @@ -267,13 +270,17 @@ type LoggerOptions struct { // because setting TimeFormat to empty assumes the default format. DisableTime bool - // Color the output. On Windows, colored logs are only avaiable for io.Writers that + // Color the output. On Windows, colored logs are only available for io.Writers that // are concretely instances of *os.File. Color ColorOption // Only color the header, not the body. This can help with readability of long messages. ColorHeaderOnly bool + // Color the header and message body fields. This can help with readability + // of long messages with multiple fields. + ColorHeaderAndFields bool + // A function which is called with the log information and if it returns true the value // should not be logged. // This is useful when interacting with a system that you wish to suppress the log @@ -282,8 +289,8 @@ type LoggerOptions struct { // IndependentLevels causes subloggers to be created with an independent // copy of this logger's level. This means that using SetLevel on this - // logger will not effect any subloggers, and SetLevel on any subloggers - // will not effect the parent or sibling loggers. + // logger will not affect any subloggers, and SetLevel on any subloggers + // will not affect the parent or sibling loggers. IndependentLevels bool } diff --git a/vendor/github.com/hashicorp/go-hclog/nulllogger.go b/vendor/github.com/hashicorp/go-hclog/nulllogger.go index bc14f7708075..55e89dd31cad 100644 --- a/vendor/github.com/hashicorp/go-hclog/nulllogger.go +++ b/vendor/github.com/hashicorp/go-hclog/nulllogger.go @@ -49,6 +49,8 @@ func (l *nullLogger) ResetNamed(name string) Logger { return l } func (l *nullLogger) SetLevel(level Level) {} +func (l *nullLogger) GetLevel() Level { return NoLevel } + func (l *nullLogger) StandardLogger(opts *StandardLoggerOptions) *log.Logger { return log.New(l.StandardWriter(opts), "", log.LstdFlags) } diff --git a/vendor/github.com/hashicorp/go-plugin/CHANGELOG.md b/vendor/github.com/hashicorp/go-plugin/CHANGELOG.md index 8341962886bc..d40ad613615e 100644 --- a/vendor/github.com/hashicorp/go-plugin/CHANGELOG.md +++ b/vendor/github.com/hashicorp/go-plugin/CHANGELOG.md @@ -1,3 +1,15 @@ +## v1.4.8 + +BUG FIXES: + +* Fix windows build: [[GH-227](https://github.com/hashicorp/go-plugin/pull/227)] + +## v1.4.7 + +ENHANCEMENTS: + +* More detailed error message on plugin start failure: [[GH-223](https://github.com/hashicorp/go-plugin/pull/223)] + ## v1.4.6 BUG FIXES: diff --git a/vendor/github.com/hashicorp/go-plugin/client.go b/vendor/github.com/hashicorp/go-plugin/client.go index 2e86f6213e23..d0baf7e8d76f 100644 --- a/vendor/github.com/hashicorp/go-plugin/client.go +++ b/vendor/github.com/hashicorp/go-plugin/client.go @@ -26,6 +26,14 @@ import ( "google.golang.org/grpc" ) +const unrecognizedRemotePluginMessage = `Unrecognized remote plugin message: %s +This usually means + the plugin was not compiled for this architecture, + the plugin is missing dynamic-link libraries necessary to run, + the plugin is not executable by this process due to file permissions, or + the plugin failed to negotiate the initial go-plugin protocol handshake +%s` + // If this is 1, then we've called CleanupClients. This can be used // by plugin RPC implementations to change error behavior since you // can expected network connection errors at this point. This should be @@ -473,7 +481,17 @@ func (c *Client) Kill() { c.l.Unlock() } -// Starts the underlying subprocess, communicating with it to negotiate +// peTypes is a list of Portable Executable (PE) machine types from https://learn.microsoft.com/en-us/windows/win32/debug/pe-format +// mapped to GOARCH types. It is not comprehensive, and only includes machine types that Go supports. +var peTypes = map[uint16]string{ + 0x14c: "386", + 0x1c0: "arm", + 0x6264: "loong64", + 0x8664: "amd64", + 0xaa64: "arm64", +} + +// Start the underlying subprocess, communicating with it to negotiate // a port for RPC connections, and returning the address to connect via RPC. // // This method is safe to call multiple times. Subsequent calls have no effect. @@ -697,10 +715,7 @@ func (c *Client) Start() (addr net.Addr, err error) { line = strings.TrimSpace(line) parts := strings.SplitN(line, "|", 6) if len(parts) < 4 { - err = fmt.Errorf( - "Unrecognized remote plugin message: %s\n\n"+ - "This usually means that the plugin is either invalid or simply\n"+ - "needs to be recompiled to support the latest protocol.", line) + err = fmt.Errorf(unrecognizedRemotePluginMessage, line, additionalNotesAboutCommand(cmd.Path)) return } diff --git a/vendor/github.com/hashicorp/go-plugin/notes_unix.go b/vendor/github.com/hashicorp/go-plugin/notes_unix.go new file mode 100644 index 000000000000..dae1c411deca --- /dev/null +++ b/vendor/github.com/hashicorp/go-plugin/notes_unix.go @@ -0,0 +1,64 @@ +//go:build !windows +// +build !windows + +package plugin + +import ( + "debug/elf" + "debug/macho" + "debug/pe" + "fmt" + "os" + "os/user" + "runtime" + "strconv" + "syscall" +) + +// additionalNotesAboutCommand tries to get additional information about a command that might help diagnose +// why it won't run correctly. It runs as a best effort only. +func additionalNotesAboutCommand(path string) string { + notes := "" + stat, err := os.Stat(path) + if err != nil { + return notes + } + + notes += "\nAdditional notes about plugin:\n" + notes += fmt.Sprintf(" Path: %s\n", path) + notes += fmt.Sprintf(" Mode: %s\n", stat.Mode()) + statT, ok := stat.Sys().(*syscall.Stat_t) + if ok { + currentUsername := "?" + if u, err := user.LookupId(strconv.FormatUint(uint64(os.Getuid()), 10)); err == nil { + currentUsername = u.Username + } + currentGroup := "?" + if g, err := user.LookupGroupId(strconv.FormatUint(uint64(os.Getgid()), 10)); err == nil { + currentGroup = g.Name + } + username := "?" + if u, err := user.LookupId(strconv.FormatUint(uint64(statT.Uid), 10)); err == nil { + username = u.Username + } + group := "?" + if g, err := user.LookupGroupId(strconv.FormatUint(uint64(statT.Gid), 10)); err == nil { + group = g.Name + } + notes += fmt.Sprintf(" Owner: %d [%s] (current: %d [%s])\n", statT.Uid, username, os.Getuid(), currentUsername) + notes += fmt.Sprintf(" Group: %d [%s] (current: %d [%s])\n", statT.Gid, group, os.Getgid(), currentGroup) + } + + if elfFile, err := elf.Open(path); err == nil { + notes += fmt.Sprintf(" ELF architecture: %s (current architecture: %s)\n", elfFile.Machine, runtime.GOARCH) + } else if machoFile, err := macho.Open(path); err == nil { + notes += fmt.Sprintf(" MachO architecture: %s (current architecture: %s)\n", machoFile.Cpu, runtime.GOARCH) + } else if peFile, err := pe.Open(path); err == nil { + machine, ok := peTypes[peFile.Machine] + if !ok { + machine = "unknown" + } + notes += fmt.Sprintf(" PE architecture: %s (current architecture: %s)\n", machine, runtime.GOARCH) + } + return notes +} diff --git a/vendor/github.com/hashicorp/go-plugin/notes_windows.go b/vendor/github.com/hashicorp/go-plugin/notes_windows.go new file mode 100644 index 000000000000..900b93319c1f --- /dev/null +++ b/vendor/github.com/hashicorp/go-plugin/notes_windows.go @@ -0,0 +1,40 @@ +//go:build windows +// +build windows + +package plugin + +import ( + "debug/elf" + "debug/macho" + "debug/pe" + "fmt" + "os" + "runtime" +) + +// additionalNotesAboutCommand tries to get additional information about a command that might help diagnose +// why it won't run correctly. It runs as a best effort only. +func additionalNotesAboutCommand(path string) string { + notes := "" + stat, err := os.Stat(path) + if err != nil { + return notes + } + + notes += "\nAdditional notes about plugin:\n" + notes += fmt.Sprintf(" Path: %s\n", path) + notes += fmt.Sprintf(" Mode: %s\n", stat.Mode()) + + if elfFile, err := elf.Open(path); err == nil { + notes += fmt.Sprintf(" ELF architecture: %s (current architecture: %s)\n", elfFile.Machine, runtime.GOARCH) + } else if machoFile, err := macho.Open(path); err == nil { + notes += fmt.Sprintf(" MachO architecture: %s (current architecture: %s)\n", machoFile.Cpu, runtime.GOARCH) + } else if peFile, err := pe.Open(path); err == nil { + machine, ok := peTypes[peFile.Machine] + if !ok { + machine = "unknown" + } + notes += fmt.Sprintf(" PE architecture: %s (current architecture: %s)\n", machine, runtime.GOARCH) + } + return notes +} diff --git a/vendor/github.com/hashicorp/go-retryablehttp/client.go b/vendor/github.com/hashicorp/go-retryablehttp/client.go index adbdd92e3ba2..f40d2411cf18 100644 --- a/vendor/github.com/hashicorp/go-retryablehttp/client.go +++ b/vendor/github.com/hashicorp/go-retryablehttp/client.go @@ -69,11 +69,28 @@ var ( // scheme specified in the URL is invalid. This error isn't typed // specifically so we resort to matching on the error string. schemeErrorRe = regexp.MustCompile(`unsupported protocol scheme`) + + // A regular expression to match the error returned by net/http when the + // TLS certificate is not trusted. This error isn't typed + // specifically so we resort to matching on the error string. + notTrustedErrorRe = regexp.MustCompile(`certificate is not trusted`) ) // ReaderFunc is the type of function that can be given natively to NewRequest type ReaderFunc func() (io.Reader, error) +// ResponseHandlerFunc is a type of function that takes in a Response, and does something with it. +// The ResponseHandlerFunc is called when the HTTP client successfully receives a response and the +// CheckRetry function indicates that a retry of the base request is not necessary. +// If an error is returned from this function, the CheckRetry policy will be used to determine +// whether to retry the whole request (including this handler). +// +// Make sure to check status codes! Even if the request was completed it may have a non-2xx status code. +// +// The response body is not automatically closed. It must be closed either by the ResponseHandlerFunc or +// by the caller out-of-band. Failure to do so will result in a memory leak. +type ResponseHandlerFunc func(*http.Response) error + // LenReader is an interface implemented by many in-memory io.Reader's. Used // for automatically sending the right Content-Length header when possible. type LenReader interface { @@ -86,6 +103,8 @@ type Request struct { // used to rewind the request data in between retries. body ReaderFunc + responseHandler ResponseHandlerFunc + // Embed an HTTP request directly. This makes a *Request act exactly // like an *http.Request so that all meta methods are supported. *http.Request @@ -94,8 +113,16 @@ type Request struct { // WithContext returns wrapped Request with a shallow copy of underlying *http.Request // with its context changed to ctx. The provided ctx must be non-nil. func (r *Request) WithContext(ctx context.Context) *Request { - r.Request = r.Request.WithContext(ctx) - return r + return &Request{ + body: r.body, + responseHandler: r.responseHandler, + Request: r.Request.WithContext(ctx), + } +} + +// SetResponseHandler allows setting the response handler. +func (r *Request) SetResponseHandler(fn ResponseHandlerFunc) { + r.responseHandler = fn } // BodyBytes allows accessing the request body. It is an analogue to @@ -252,23 +279,31 @@ func FromRequest(r *http.Request) (*Request, error) { return nil, err } // Could assert contentLength == r.ContentLength - return &Request{bodyReader, r}, nil + return &Request{body: bodyReader, Request: r}, nil } // NewRequest creates a new wrapped request. func NewRequest(method, url string, rawBody interface{}) (*Request, error) { + return NewRequestWithContext(context.Background(), method, url, rawBody) +} + +// NewRequestWithContext creates a new wrapped request with the provided context. +// +// The context controls the entire lifetime of a request and its response: +// obtaining a connection, sending the request, and reading the response headers and body. +func NewRequestWithContext(ctx context.Context, method, url string, rawBody interface{}) (*Request, error) { bodyReader, contentLength, err := getBodyReaderAndContentLength(rawBody) if err != nil { return nil, err } - httpReq, err := http.NewRequest(method, url, nil) + httpReq, err := http.NewRequestWithContext(ctx, method, url, nil) if err != nil { return nil, err } httpReq.ContentLength = contentLength - return &Request{bodyReader, httpReq}, nil + return &Request{body: bodyReader, Request: httpReq}, nil } // Logger interface allows to use other loggers than @@ -435,6 +470,9 @@ func baseRetryPolicy(resp *http.Response, err error) (bool, error) { } // Don't retry if the error was due to TLS cert verification failure. + if notTrustedErrorRe.MatchString(v.Error()) { + return false, v + } if _, ok := v.Err.(x509.UnknownAuthorityError); ok { return false, v } @@ -455,7 +493,7 @@ func baseRetryPolicy(resp *http.Response, err error) (bool, error) { // the server time to recover, as 500's are typically not permanent // errors and may relate to outages on the server side. This will catch // invalid response codes as well, like 0 and 999. - if resp.StatusCode == 0 || (resp.StatusCode >= 500 && resp.StatusCode != 501) { + if resp.StatusCode == 0 || (resp.StatusCode >= 500 && resp.StatusCode != http.StatusNotImplemented) { return true, fmt.Errorf("unexpected HTTP status %s", resp.Status) } @@ -555,13 +593,12 @@ func (c *Client) Do(req *Request) (*http.Response, error) { var resp *http.Response var attempt int var shouldRetry bool - var doErr, checkErr error + var doErr, respErr, checkErr error for i := 0; ; i++ { + doErr, respErr = nil, nil attempt++ - var code int // HTTP response code - // Always rewind the request body when non-nil. if req.body != nil { body, err := req.body() @@ -589,19 +626,24 @@ func (c *Client) Do(req *Request) (*http.Response, error) { // Attempt the request resp, doErr = c.HTTPClient.Do(req.Request) - if resp != nil { - code = resp.StatusCode - } // Check if we should continue with retries. shouldRetry, checkErr = c.CheckRetry(req.Context(), resp, doErr) + if !shouldRetry && doErr == nil && req.responseHandler != nil { + respErr = req.responseHandler(resp) + shouldRetry, checkErr = c.CheckRetry(req.Context(), resp, respErr) + } - if doErr != nil { + err := doErr + if respErr != nil { + err = respErr + } + if err != nil { switch v := logger.(type) { case LeveledLogger: - v.Error("request failed", "error", doErr, "method", req.Method, "url", req.URL) + v.Error("request failed", "error", err, "method", req.Method, "url", req.URL) case Logger: - v.Printf("[ERR] %s %s request failed: %v", req.Method, req.URL, doErr) + v.Printf("[ERR] %s %s request failed: %v", req.Method, req.URL, err) } } else { // Call this here to maintain the behavior of logging all requests, @@ -636,11 +678,11 @@ func (c *Client) Do(req *Request) (*http.Response, error) { } wait := c.Backoff(c.RetryWaitMin, c.RetryWaitMax, i, resp) - desc := fmt.Sprintf("%s %s", req.Method, req.URL) - if code > 0 { - desc = fmt.Sprintf("%s (status: %d)", desc, code) - } if logger != nil { + desc := fmt.Sprintf("%s %s", req.Method, req.URL) + if resp != nil { + desc = fmt.Sprintf("%s (status: %d)", desc, resp.StatusCode) + } switch v := logger.(type) { case LeveledLogger: v.Debug("retrying request", "request", desc, "timeout", wait, "remaining", remain) @@ -648,11 +690,13 @@ func (c *Client) Do(req *Request) (*http.Response, error) { v.Printf("[DEBUG] %s: retrying in %s (%d left)", desc, wait, remain) } } + timer := time.NewTimer(wait) select { case <-req.Context().Done(): + timer.Stop() c.HTTPClient.CloseIdleConnections() return nil, req.Context().Err() - case <-time.After(wait): + case <-timer.C: } // Make shallow copy of http Request so that we can modify its body @@ -662,15 +706,19 @@ func (c *Client) Do(req *Request) (*http.Response, error) { } // this is the closest we have to success criteria - if doErr == nil && checkErr == nil && !shouldRetry { + if doErr == nil && respErr == nil && checkErr == nil && !shouldRetry { return resp, nil } defer c.HTTPClient.CloseIdleConnections() - err := doErr + var err error if checkErr != nil { err = checkErr + } else if respErr != nil { + err = respErr + } else { + err = doErr } if c.ErrorHandler != nil { diff --git a/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/protocol_data.go b/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/protocol_data.go index 0e220f57cd54..36dfcd764df5 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/protocol_data.go +++ b/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/protocol_data.go @@ -122,7 +122,7 @@ func protocolDataDynamicValue6(_ context.Context, value *tfprotov6.DynamicValue) } func writeProtocolFile(ctx context.Context, dataDir string, rpc string, message string, field string, fileExtension string, fileContents []byte) { - fileName := fmt.Sprintf("%d_%s_%s_%s", time.Now().Unix(), rpc, message, field) + fileName := fmt.Sprintf("%d_%s_%s_%s", time.Now().UnixMilli(), rpc, message, field) if fileExtension != "" { fileName += "." + fileExtension diff --git a/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/toproto/diagnostic.go b/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/toproto/diagnostic.go index 979896f7787d..81d692cef915 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/toproto/diagnostic.go +++ b/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/toproto/diagnostic.go @@ -1,6 +1,8 @@ package toproto import ( + "unicode/utf8" + "github.com/hashicorp/terraform-plugin-go/tfprotov5" "github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5" ) @@ -8,8 +10,8 @@ import ( func Diagnostic(in *tfprotov5.Diagnostic) (*tfplugin5.Diagnostic, error) { diag := &tfplugin5.Diagnostic{ Severity: Diagnostic_Severity(in.Severity), - Summary: in.Summary, - Detail: in.Detail, + Summary: forceValidUTF8(in.Summary), + Detail: forceValidUTF8(in.Detail), } if in.Attribute != nil { attr, err := AttributePath(in.Attribute) @@ -41,6 +43,59 @@ func Diagnostics(in []*tfprotov5.Diagnostic) ([]*tfplugin5.Diagnostic, error) { return diagnostics, nil } +// forceValidUTF8 returns a string guaranteed to be valid UTF-8 even if the +// input isn't, by replacing any invalid bytes with a valid UTF-8 encoding of +// the Unicode Replacement Character (\uFFFD). +// +// The protobuf serialization library will reject invalid UTF-8 with an +// unhelpful error message: +// +// string field contains invalid UTF-8 +// +// Passing a string result through this function makes invalid UTF-8 instead +// emerge as placeholder characters on the other side of the wire protocol, +// giving a better chance of still returning a partially-legible message +// instead of a generic character encoding error. +// +// This is intended for user-facing messages such as diagnostic summary and +// detail messages, where Terraform will just treat the value as opaque and +// it's ultimately up to the user and their terminal or web browser to +// interpret the result. Don't use this for strings that have machine-readable +// meaning. +func forceValidUTF8(s string) string { + // Most strings that pass through here will already be valid UTF-8 and + // utf8.ValidString has a fast path which will beat our rune-by-rune + // analysis below, so it's worth the cost of walking the string twice + // in the rarer invalid case. + if utf8.ValidString(s) { + return s + } + + // If we get down here then we know there's at least one invalid UTF-8 + // sequence in the string, so in this slow path we'll reconstruct the + // string one rune at a time, guaranteeing that we'll only write valid + // UTF-8 sequences into the resulting buffer. + // + // Any invalid string will grow at least a little larger as a result of + // this operation because we'll be replacing each invalid byte with + // the three-byte sequence \xEF\xBF\xBD, which is the UTF-8 encoding of + // the replacement character \uFFFD. 9 is a magic number giving room for + // three such expansions without any further allocation. + ret := make([]byte, 0, len(s)+9) + for { + // If the first byte in s is not the start of a valid UTF-8 sequence + // then the following will return utf8.RuneError, 1, where + // utf8.RuneError is the unicode replacement character. + r, advance := utf8.DecodeRuneInString(s) + if advance == 0 { + break + } + s = s[advance:] + ret = utf8.AppendRune(ret, r) + } + return string(ret) +} + // we have to say this next thing to get golint to stop yelling at us about the // underscores in the function names. We want the function names to match // actually-generated code, so it feels like fair play. It's just a shame we diff --git a/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/toproto/diagnostic.go b/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/toproto/diagnostic.go index 26ce3e9df703..4144222ce4a8 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/toproto/diagnostic.go +++ b/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/toproto/diagnostic.go @@ -1,6 +1,8 @@ package toproto import ( + "unicode/utf8" + "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6" ) @@ -8,8 +10,8 @@ import ( func Diagnostic(in *tfprotov6.Diagnostic) (*tfplugin6.Diagnostic, error) { diag := &tfplugin6.Diagnostic{ Severity: Diagnostic_Severity(in.Severity), - Summary: in.Summary, - Detail: in.Detail, + Summary: forceValidUTF8(in.Summary), + Detail: forceValidUTF8(in.Detail), } if in.Attribute != nil { attr, err := AttributePath(in.Attribute) @@ -41,6 +43,59 @@ func Diagnostics(in []*tfprotov6.Diagnostic) ([]*tfplugin6.Diagnostic, error) { return diagnostics, nil } +// forceValidUTF8 returns a string guaranteed to be valid UTF-8 even if the +// input isn't, by replacing any invalid bytes with a valid UTF-8 encoding of +// the Unicode Replacement Character (\uFFFD). +// +// The protobuf serialization library will reject invalid UTF-8 with an +// unhelpful error message: +// +// string field contains invalid UTF-8 +// +// Passing a string result through this function makes invalid UTF-8 instead +// emerge as placeholder characters on the other side of the wire protocol, +// giving a better chance of still returning a partially-legible message +// instead of a generic character encoding error. +// +// This is intended for user-facing messages such as diagnostic summary and +// detail messages, where Terraform will just treat the value as opaque and +// it's ultimately up to the user and their terminal or web browser to +// interpret the result. Don't use this for strings that have machine-readable +// meaning. +func forceValidUTF8(s string) string { + // Most strings that pass through here will already be valid UTF-8 and + // utf8.ValidString has a fast path which will beat our rune-by-rune + // analysis below, so it's worth the cost of walking the string twice + // in the rarer invalid case. + if utf8.ValidString(s) { + return s + } + + // If we get down here then we know there's at least one invalid UTF-8 + // sequence in the string, so in this slow path we'll reconstruct the + // string one rune at a time, guaranteeing that we'll only write valid + // UTF-8 sequences into the resulting buffer. + // + // Any invalid string will grow at least a little larger as a result of + // this operation because we'll be replacing each invalid byte with + // the three-byte sequence \xEF\xBF\xBD, which is the UTF-8 encoding of + // the replacement character \uFFFD. 9 is a magic number giving room for + // three such expansions without any further allocation. + ret := make([]byte, 0, len(s)+9) + for { + // If the first byte in s is not the start of a valid UTF-8 sequence + // then the following will return utf8.RuneError, 1, where + // utf8.RuneError is the unicode replacement character. + r, advance := utf8.DecodeRuneInString(s) + if advance == 0 { + break + } + s = s[advance:] + ret = utf8.AppendRune(ret, r) + } + return string(ret) +} + // we have to say this next thing to get golint to stop yelling at us about the // underscores in the function names. We want the function names to match // actually-generated code, so it feels like fair play. It's just a shame we diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest/random.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest/random.go deleted file mode 100644 index 263a1ff57638..000000000000 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest/random.go +++ /dev/null @@ -1,173 +0,0 @@ -package acctest - -import ( - "bytes" - crand "crypto/rand" - "crypto/rsa" - "crypto/x509" - "crypto/x509/pkix" - "encoding/pem" - "fmt" - "math/big" - "math/rand" - "net" - "strings" - "time" - - "github.com/apparentlymart/go-cidr/cidr" - "golang.org/x/crypto/ssh" -) - -func init() { - rand.Seed(time.Now().UTC().UnixNano()) -} - -// Helpers for generating random tidbits for use in identifiers to prevent -// collisions in acceptance tests. - -// RandInt generates a random integer -func RandInt() int { - return rand.Int() -} - -// RandomWithPrefix is used to generate a unique name with a prefix, for -// randomizing names in acceptance tests -func RandomWithPrefix(name string) string { - return fmt.Sprintf("%s-%d", name, RandInt()) -} - -// RandIntRange returns a random integer between min (inclusive) and max (exclusive) -func RandIntRange(min int, max int) int { - return rand.Intn(max-min) + min -} - -// RandString generates a random alphanumeric string of the length specified -func RandString(strlen int) string { - return RandStringFromCharSet(strlen, CharSetAlphaNum) -} - -// RandStringFromCharSet generates a random string by selecting characters from -// the charset provided -func RandStringFromCharSet(strlen int, charSet string) string { - result := make([]byte, strlen) - for i := 0; i < strlen; i++ { - result[i] = charSet[RandIntRange(0, len(charSet))] - } - return string(result) -} - -// RandSSHKeyPair generates a public and private SSH key pair. The public key is -// returned in OpenSSH format, and the private key is PEM encoded. -func RandSSHKeyPair(comment string) (string, string, error) { - privateKey, privateKeyPEM, err := genPrivateKey() - if err != nil { - return "", "", err - } - - publicKey, err := ssh.NewPublicKey(&privateKey.PublicKey) - if err != nil { - return "", "", err - } - keyMaterial := strings.TrimSpace(string(ssh.MarshalAuthorizedKey(publicKey))) - return fmt.Sprintf("%s %s", keyMaterial, comment), privateKeyPEM, nil -} - -// RandTLSCert generates a self-signed TLS certificate with a newly created -// private key, and returns both the cert and the private key PEM encoded. -func RandTLSCert(orgName string) (string, string, error) { - template := &x509.Certificate{ - SerialNumber: big.NewInt(int64(RandInt())), - Subject: pkix.Name{ - Organization: []string{orgName}, - }, - NotBefore: time.Now(), - NotAfter: time.Now().Add(24 * time.Hour), - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, - BasicConstraintsValid: true, - } - - privateKey, privateKeyPEM, err := genPrivateKey() - if err != nil { - return "", "", err - } - - cert, err := x509.CreateCertificate(crand.Reader, template, template, &privateKey.PublicKey, privateKey) - if err != nil { - return "", "", err - } - - certPEM, err := pemEncode(cert, "CERTIFICATE") - if err != nil { - return "", "", err - } - - return certPEM, privateKeyPEM, nil -} - -// RandIpAddress returns a random IP address in the specified CIDR block. -// The prefix length must be less than 31. -func RandIpAddress(s string) (string, error) { - _, network, err := net.ParseCIDR(s) - if err != nil { - return "", err - } - - firstIp, lastIp := cidr.AddressRange(network) - first := &big.Int{} - first.SetBytes([]byte(firstIp)) - last := &big.Int{} - last.SetBytes([]byte(lastIp)) - r := &big.Int{} - r.Sub(last, first) - if bitLen := r.BitLen(); bitLen > 31 { - return "", fmt.Errorf("CIDR range is too large: %d", bitLen) - } - - max := int(r.Int64()) - if max == 0 { - // panic: invalid argument to Int31n - return firstIp.String(), nil - } - - host, err := cidr.Host(network, RandIntRange(0, max)) - if err != nil { - return "", err - } - - return host.String(), nil -} - -func genPrivateKey() (*rsa.PrivateKey, string, error) { - privateKey, err := rsa.GenerateKey(crand.Reader, 1024) - if err != nil { - return nil, "", err - } - - privateKeyPEM, err := pemEncode(x509.MarshalPKCS1PrivateKey(privateKey), "RSA PRIVATE KEY") - if err != nil { - return nil, "", err - } - - return privateKey, privateKeyPEM, nil -} - -func pemEncode(b []byte, block string) (string, error) { - var buf bytes.Buffer - pb := &pem.Block{Type: block, Bytes: b} - if err := pem.Encode(&buf, pb); err != nil { - return "", err - } - - return buf.String(), nil -} - -const ( - // CharSetAlphaNum is the alphanumeric character set for use with - // RandStringFromCharSet - CharSetAlphaNum = "abcdefghijklmnopqrstuvwxyz012346789" - - // CharSetAlpha is the alphabetical character set for use with - // RandStringFromCharSet - CharSetAlpha = "abcdefghijklmnopqrstuvwxyz" -) diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/environment_variables.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/environment_variables.go deleted file mode 100644 index fed6aa25c328..000000000000 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/environment_variables.go +++ /dev/null @@ -1,32 +0,0 @@ -package resource - -// Environment variables for acceptance testing. Additional environment -// variable constants can be found in the internal/plugintest package. -const ( - // Environment variable to enable acceptance tests using this package's - // ParallelTest and Test functions whose TestCase does not enable the - // IsUnitTest field. Defaults to disabled, in which each test will call - // (*testing.T).Skip(). Can be set to any value to enable acceptance tests, - // however "1" is conventional. - EnvTfAcc = "TF_ACC" - - // Environment variable with hostname for the provider under acceptance - // test. The hostname is the first portion of the full provider source - // address, such as "example.com" in example.com/myorg/myprovider. Defaults - // to "registry.terraform.io". - // - // Only required if any Terraform configuration set via the TestStep - // type Config field includes a provider source, such as the terraform - // configuration block required_providers attribute. - EnvTfAccProviderHost = "TF_ACC_PROVIDER_HOST" - - // Environment variable with namespace for the provider under acceptance - // test. The namespace is the second portion of the full provider source - // address, such as "myorg" in registry.terraform.io/myorg/myprovider. - // Defaults to "-" for Terraform 0.12-0.13 compatibility and "hashicorp". - // - // Only required if any Terraform configuration set via the TestStep - // type Config field includes a provider source, such as the terraform - // configuration block required_providers attribute. - EnvTfAccProviderNamespace = "TF_ACC_PROVIDER_NAMESPACE" -) diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/error.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/error.go deleted file mode 100644 index b406cbaea459..000000000000 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/error.go +++ /dev/null @@ -1,91 +0,0 @@ -package resource - -import ( - "fmt" - "strings" - "time" -) - -type NotFoundError struct { - LastError error - LastRequest interface{} - LastResponse interface{} - Message string - Retries int -} - -func (e *NotFoundError) Error() string { - if e.Message != "" { - return e.Message - } - - if e.Retries > 0 { - return fmt.Sprintf("couldn't find resource (%d retries)", e.Retries) - } - - return "couldn't find resource" -} - -func (e *NotFoundError) Unwrap() error { - return e.LastError -} - -// UnexpectedStateError is returned when Refresh returns a state that's neither in Target nor Pending -type UnexpectedStateError struct { - LastError error - State string - ExpectedState []string -} - -func (e *UnexpectedStateError) Error() string { - return fmt.Sprintf( - "unexpected state '%s', wanted target '%s'. last error: %s", - e.State, - strings.Join(e.ExpectedState, ", "), - e.LastError, - ) -} - -func (e *UnexpectedStateError) Unwrap() error { - return e.LastError -} - -// TimeoutError is returned when WaitForState times out -type TimeoutError struct { - LastError error - LastState string - Timeout time.Duration - ExpectedState []string -} - -func (e *TimeoutError) Error() string { - expectedState := "resource to be gone" - if len(e.ExpectedState) > 0 { - expectedState = fmt.Sprintf("state to become '%s'", strings.Join(e.ExpectedState, ", ")) - } - - extraInfo := make([]string, 0) - if e.LastState != "" { - extraInfo = append(extraInfo, fmt.Sprintf("last state: '%s'", e.LastState)) - } - if e.Timeout > 0 { - extraInfo = append(extraInfo, fmt.Sprintf("timeout: %s", e.Timeout.String())) - } - - suffix := "" - if len(extraInfo) > 0 { - suffix = fmt.Sprintf(" (%s)", strings.Join(extraInfo, ", ")) - } - - if e.LastError != nil { - return fmt.Sprintf("timeout while waiting for %s%s: %s", - expectedState, suffix, e.LastError) - } - - return fmt.Sprintf("timeout while waiting for %s%s", - expectedState, suffix) -} - -func (e *TimeoutError) Unwrap() error { - return e.LastError -} diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/json.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/json.go deleted file mode 100644 index 345abf719958..000000000000 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/json.go +++ /dev/null @@ -1,12 +0,0 @@ -package resource - -import ( - "bytes" - "encoding/json" -) - -func unmarshalJSON(data []byte, v interface{}) error { - dec := json.NewDecoder(bytes.NewReader(data)) - dec.UseNumber() - return dec.Decode(v) -} diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/state.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/state.go deleted file mode 100644 index 6eda1993f1bb..000000000000 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/state.go +++ /dev/null @@ -1,280 +0,0 @@ -package resource - -import ( - "context" - "log" - "time" -) - -var refreshGracePeriod = 30 * time.Second - -// StateRefreshFunc is a function type used for StateChangeConf that is -// responsible for refreshing the item being watched for a state change. -// -// It returns three results. `result` is any object that will be returned -// as the final object after waiting for state change. This allows you to -// return the final updated object, for example an EC2 instance after refreshing -// it. A nil result represents not found. -// -// `state` is the latest state of that object. And `err` is any error that -// may have happened while refreshing the state. -type StateRefreshFunc func() (result interface{}, state string, err error) - -// StateChangeConf is the configuration struct used for `WaitForState`. -type StateChangeConf struct { - Delay time.Duration // Wait this time before starting checks - Pending []string // States that are "allowed" and will continue trying - Refresh StateRefreshFunc // Refreshes the current state - Target []string // Target state - Timeout time.Duration // The amount of time to wait before timeout - MinTimeout time.Duration // Smallest time to wait before refreshes - PollInterval time.Duration // Override MinTimeout/backoff and only poll this often - NotFoundChecks int // Number of times to allow not found (nil result from Refresh) - - // This is to work around inconsistent APIs - ContinuousTargetOccurence int // Number of times the Target state has to occur continuously -} - -// WaitForStateContext watches an object and waits for it to achieve the state -// specified in the configuration using the specified Refresh() func, -// waiting the number of seconds specified in the timeout configuration. -// -// If the Refresh function returns an error, exit immediately with that error. -// -// If the Refresh function returns a state other than the Target state or one -// listed in Pending, return immediately with an error. -// -// If the Timeout is exceeded before reaching the Target state, return an -// error. -// -// Otherwise, the result is the result of the first call to the Refresh function to -// reach the target state. -// -// Cancellation from the passed in context will cancel the refresh loop -func (conf *StateChangeConf) WaitForStateContext(ctx context.Context) (interface{}, error) { - log.Printf("[DEBUG] Waiting for state to become: %s", conf.Target) - - notfoundTick := 0 - targetOccurence := 0 - - // Set a default for times to check for not found - if conf.NotFoundChecks == 0 { - conf.NotFoundChecks = 20 - } - - if conf.ContinuousTargetOccurence == 0 { - conf.ContinuousTargetOccurence = 1 - } - - type Result struct { - Result interface{} - State string - Error error - Done bool - } - - // Read every result from the refresh loop, waiting for a positive result.Done. - resCh := make(chan Result, 1) - // cancellation channel for the refresh loop - cancelCh := make(chan struct{}) - - result := Result{} - - go func() { - defer close(resCh) - - select { - case <-time.After(conf.Delay): - case <-cancelCh: - return - } - - // start with 0 delay for the first loop - var wait time.Duration - - for { - // store the last result - resCh <- result - - // wait and watch for cancellation - select { - case <-cancelCh: - return - case <-time.After(wait): - // first round had no wait - if wait == 0 { - wait = 100 * time.Millisecond - } - } - - res, currentState, err := conf.Refresh() - result = Result{ - Result: res, - State: currentState, - Error: err, - } - - if err != nil { - resCh <- result - return - } - - // If we're waiting for the absence of a thing, then return - if res == nil && len(conf.Target) == 0 { - targetOccurence++ - if conf.ContinuousTargetOccurence == targetOccurence { - result.Done = true - resCh <- result - return - } - continue - } - - if res == nil { - // If we didn't find the resource, check if we have been - // not finding it for awhile, and if so, report an error. - notfoundTick++ - if notfoundTick > conf.NotFoundChecks { - result.Error = &NotFoundError{ - LastError: err, - Retries: notfoundTick, - } - resCh <- result - return - } - } else { - // Reset the counter for when a resource isn't found - notfoundTick = 0 - found := false - - for _, allowed := range conf.Target { - if currentState == allowed { - found = true - targetOccurence++ - if conf.ContinuousTargetOccurence == targetOccurence { - result.Done = true - resCh <- result - return - } - continue - } - } - - for _, allowed := range conf.Pending { - if currentState == allowed { - found = true - targetOccurence = 0 - break - } - } - - if !found && len(conf.Pending) > 0 { - result.Error = &UnexpectedStateError{ - LastError: err, - State: result.State, - ExpectedState: conf.Target, - } - resCh <- result - return - } - } - - // Wait between refreshes using exponential backoff, except when - // waiting for the target state to reoccur. - if targetOccurence == 0 { - wait *= 2 - } - - // If a poll interval has been specified, choose that interval. - // Otherwise bound the default value. - if conf.PollInterval > 0 && conf.PollInterval < 180*time.Second { - wait = conf.PollInterval - } else { - if wait < conf.MinTimeout { - wait = conf.MinTimeout - } else if wait > 10*time.Second { - wait = 10 * time.Second - } - } - - log.Printf("[TRACE] Waiting %s before next try", wait) - } - }() - - // store the last value result from the refresh loop - lastResult := Result{} - - timeout := time.After(conf.Timeout) - for { - select { - case r, ok := <-resCh: - // channel closed, so return the last result - if !ok { - return lastResult.Result, lastResult.Error - } - - // we reached the intended state - if r.Done { - return r.Result, r.Error - } - - // still waiting, store the last result - lastResult = r - case <-ctx.Done(): - close(cancelCh) - return nil, ctx.Err() - case <-timeout: - log.Printf("[WARN] WaitForState timeout after %s", conf.Timeout) - log.Printf("[WARN] WaitForState starting %s refresh grace period", refreshGracePeriod) - - // cancel the goroutine and start our grace period timer - close(cancelCh) - timeout := time.After(refreshGracePeriod) - - // we need a for loop and a label to break on, because we may have - // an extra response value to read, but still want to wait for the - // channel to close. - forSelect: - for { - select { - case r, ok := <-resCh: - if r.Done { - // the last refresh loop reached the desired state - return r.Result, r.Error - } - - if !ok { - // the goroutine returned - break forSelect - } - - // target state not reached, save the result for the - // TimeoutError and wait for the channel to close - lastResult = r - case <-ctx.Done(): - log.Println("[ERROR] Context cancelation detected, abandoning grace period") - break forSelect - case <-timeout: - log.Println("[ERROR] WaitForState exceeded refresh grace period") - break forSelect - } - } - - return nil, &TimeoutError{ - LastError: lastResult.Error, - LastState: lastResult.State, - Timeout: conf.Timeout, - ExpectedState: conf.Target, - } - } - } -} - -// WaitForState watches an object and waits for it to achieve the state -// specified in the configuration using the specified Refresh() func, -// waiting the number of seconds specified in the timeout configuration. -// -// Deprecated: Please use WaitForStateContext to ensure proper plugin shutdown -func (conf *StateChangeConf) WaitForState() (interface{}, error) { - return conf.WaitForStateContext(context.Background()) -} diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_config.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_config.go deleted file mode 100644 index 35bfea0988d4..000000000000 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_config.go +++ /dev/null @@ -1,25 +0,0 @@ -package resource - -import ( - "context" - "fmt" - - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest" -) - -func testStepTaint(ctx context.Context, step TestStep, wd *plugintest.WorkingDir) error { - if len(step.Taint) == 0 { - return nil - } - - logging.HelperResourceTrace(ctx, fmt.Sprintf("Using TestStep Taint: %v", step.Taint)) - - for _, p := range step.Taint { - err := wd.Taint(ctx, p) - if err != nil { - return fmt.Errorf("error tainting resource: %s", err) - } - } - return nil -} diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/config.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/config.go deleted file mode 100644 index 920c47165589..000000000000 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/config.go +++ /dev/null @@ -1,92 +0,0 @@ -package plugintest - -import ( - "context" - "fmt" - "os" - "strings" - - "github.com/hashicorp/go-version" - install "github.com/hashicorp/hc-install" - "github.com/hashicorp/hc-install/checkpoint" - "github.com/hashicorp/hc-install/fs" - "github.com/hashicorp/hc-install/product" - "github.com/hashicorp/hc-install/releases" - "github.com/hashicorp/hc-install/src" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging" -) - -// Config is used to configure the test helper. In most normal test programs -// the configuration is discovered automatically by an Init* function using -// DiscoverConfig, but this is exposed so that more complex scenarios can be -// implemented by direct configuration. -type Config struct { - SourceDir string - TerraformExec string - execTempDir string - PreviousPluginExec string -} - -// DiscoverConfig uses environment variables and other means to automatically -// discover a reasonable test helper configuration. -func DiscoverConfig(ctx context.Context, sourceDir string) (*Config, error) { - tfVersion := strings.TrimPrefix(os.Getenv(EnvTfAccTerraformVersion), "v") - tfPath := os.Getenv(EnvTfAccTerraformPath) - - tempDir := os.Getenv(EnvTfAccTempDir) - tfDir, err := os.MkdirTemp(tempDir, "plugintest-terraform") - if err != nil { - return nil, fmt.Errorf("failed to create temp dir: %w", err) - } - - var sources []src.Source - switch { - case tfPath != "": - logging.HelperResourceTrace(ctx, fmt.Sprintf("Adding potential Terraform CLI source of exact path: %s", tfPath)) - - sources = append(sources, &fs.AnyVersion{ - ExactBinPath: tfPath, - }) - case tfVersion != "": - tfVersion, err := version.NewVersion(tfVersion) - - if err != nil { - return nil, fmt.Errorf("invalid Terraform version: %w", err) - } - - logging.HelperResourceTrace(ctx, fmt.Sprintf("Adding potential Terraform CLI source of releases.hashicorp.com exact version %q for installation in: %s", tfVersion, tfDir)) - - sources = append(sources, &releases.ExactVersion{ - InstallDir: tfDir, - Product: product.Terraform, - Version: tfVersion, - }) - default: - logging.HelperResourceTrace(ctx, "Adding potential Terraform CLI source of local filesystem PATH lookup") - logging.HelperResourceTrace(ctx, fmt.Sprintf("Adding potential Terraform CLI source of checkpoint.hashicorp.com latest version for installation in: %s", tfDir)) - - sources = append(sources, &fs.AnyVersion{ - Product: &product.Terraform, - }) - sources = append(sources, &checkpoint.LatestVersion{ - InstallDir: tfDir, - Product: product.Terraform, - }) - } - - installer := install.NewInstaller() - tfExec, err := installer.Ensure(context.Background(), sources) - if err != nil { - return nil, fmt.Errorf("failed to find or install Terraform CLI from %+v: %w", sources, err) - } - - ctx = logging.TestTerraformPathContext(ctx, tfExec) - - logging.HelperResourceDebug(ctx, "Found Terraform CLI") - - return &Config{ - SourceDir: sourceDir, - TerraformExec: tfExec, - execTempDir: tfDir, - }, nil -} diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/doc.go deleted file mode 100644 index 3f84c6a37e41..000000000000 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// Package plugintest contains utilities to help with writing tests for -// Terraform plugins. -// -// This is not a package for testing configurations or modules written in the -// Terraform language. It is for testing the plugins that allow Terraform to -// manage various cloud services and other APIs. -package plugintest diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/environment_variables.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/environment_variables.go deleted file mode 100644 index 6fd001a07d0b..000000000000 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/environment_variables.go +++ /dev/null @@ -1,108 +0,0 @@ -package plugintest - -// Environment variables -const ( - // Environment variable with acceptance testing temporary directory for - // testing files and Terraform CLI installation, if installation is - // required. By default, the operating system temporary directory is used. - // - // Setting TF_ACC_TERRAFORM_PATH does not override this value for Terraform - // CLI installation, if installation is required. - EnvTfAccTempDir = "TF_ACC_TEMP_DIR" - - // Environment variable with level to filter Terraform logs during - // acceptance testing. This value sets TF_LOG in a safe manner when - // executing Terraform CLI commands, which would otherwise interfere - // with the testing framework using TF_LOG to set the Go standard library - // log package level. - // - // This value takes precedence over TF_LOG_CORE, due to precedence rules - // in the Terraform core code, so it is not possible to set this to a level - // and also TF_LOG_CORE=OFF. Use TF_LOG_CORE and TF_LOG_PROVIDER in that - // case instead. - // - // If not set, but TF_ACC_LOG_PATH or TF_LOG_PATH_MASK is set, it defaults - // to TRACE. If Terraform CLI is version 0.14 or earlier, it will have no - // separate affect from the TF_ACC_LOG_PATH or TF_LOG_PATH_MASK behavior, - // as those earlier versions of Terraform are unreliable with the logging - // level being outside TRACE. - EnvTfAccLog = "TF_ACC_LOG" - - // Environment variable with path to save Terraform logs during acceptance - // testing. This value sets TF_LOG_PATH in a safe manner when executing - // Terraform CLI commands, which would otherwise be ignored since it could - // interfere with how the underlying execution is performed. - // - // If TF_LOG_PATH_MASK is set, it takes precedence over this value. - EnvTfAccLogPath = "TF_ACC_LOG_PATH" - - // Environment variable with level to filter Terraform core logs during - // acceptance testing. This value sets TF_LOG_CORE separate from - // TF_LOG_PROVIDER when calling Terraform. - // - // This value has no affect when TF_ACC_LOG is set (which sets Terraform's - // TF_LOG), due to precedence rules in the Terraform core code. Use - // TF_LOG_CORE and TF_LOG_PROVIDER in that case instead. - // - // If not set, defaults to TF_ACC_LOG behaviors. - EnvTfLogCore = "TF_LOG_CORE" - - // Environment variable with path containing the string %s, which is - // replaced with the test name, to save separate Terraform logs during - // acceptance testing. This value sets TF_LOG_PATH in a safe manner when - // executing Terraform CLI commands, which would otherwise be ignored since - // it could interfere with how the underlying execution is performed. - // - // Takes precedence over TF_ACC_LOG_PATH. - EnvTfLogPathMask = "TF_LOG_PATH_MASK" - - // Environment variable with level to filter Terraform provider logs during - // acceptance testing. This value sets TF_LOG_PROVIDER separate from - // TF_LOG_CORE. - // - // During testing, this only affects external providers whose logging goes - // through Terraform. The logging for the provider under test is controlled - // by the testing framework as it is running the provider code. Provider - // code using the Go standard library log package is controlled by TF_LOG - // for historical compatibility. - // - // This value takes precedence over TF_ACC_LOG for external provider logs, - // due to rules in the Terraform core code. - // - // If not set, defaults to TF_ACC_LOG behaviors. - EnvTfLogProvider = "TF_LOG_PROVIDER" - - // Environment variable with acceptance testing Terraform CLI version to - // download from releases.hashicorp.com, checksum verify, and install. The - // value can be any valid Terraform CLI version, such as 1.1.6, with or - // without a prepended v character. - // - // Setting this value takes precedence over using an available Terraform - // binary in the operation system PATH, or if not found, installing the - // latest version according to checkpoint.hashicorp.com. - // - // By default, the binary is installed in the operating system temporary - // directory, however that directory can be overridden with the - // TF_ACC_TEMP_DIR environment variable. - // - // If TF_ACC_TERRAFORM_PATH is also set, this installation method is - // only invoked when a binary does not exist at that path. No version - // checks are performed against an existing TF_ACC_TERRAFORM_PATH. - EnvTfAccTerraformVersion = "TF_ACC_TERRAFORM_VERSION" - - // Acceptance testing path to Terraform CLI binary. - // - // Setting this value takes precedence over using an available Terraform - // binary in the operation system PATH, or if not found, installing the - // latest version according to checkpoint.hashicorp.com. This value does - // not override TF_ACC_TEMP_DIR for Terraform CLI installation, if - // installation is required. - // - // If TF_ACC_TERRAFORM_VERSION is not set, the binary must exist and be - // executable, or an error will be returned. - // - // If TF_ACC_TERRAFORM_VERSION is also set, that Terraform CLI version - // will be installed if a binary is not found at the given path. No version - // checks are performed against an existing binary. - EnvTfAccTerraformPath = "TF_ACC_TERRAFORM_PATH" -) diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/util.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/util.go deleted file mode 100644 index c77a9cb08279..000000000000 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/util.go +++ /dev/null @@ -1,67 +0,0 @@ -package plugintest - -import ( - "fmt" - "os" - "path/filepath" -) - -func symlinkFile(src string, dest string) error { - err := os.Symlink(src, dest) - - if err != nil { - return fmt.Errorf("unable to symlink %q to %q: %w", src, dest, err) - } - - srcInfo, err := os.Stat(src) - - if err != nil { - return fmt.Errorf("unable to stat %q: %w", src, err) - } - - err = os.Chmod(dest, srcInfo.Mode()) - - if err != nil { - return fmt.Errorf("unable to set %q permissions: %w", dest, err) - } - - return nil -} - -// symlinkDirectoriesOnly finds only the first-level child directories in srcDir -// and symlinks them into destDir. -// Unlike symlinkDir, this is done non-recursively in order to limit the number -// of file descriptors used. -func symlinkDirectoriesOnly(srcDir string, destDir string) error { - srcInfo, err := os.Stat(srcDir) - if err != nil { - return fmt.Errorf("unable to stat source directory %q: %w", srcDir, err) - } - - err = os.MkdirAll(destDir, srcInfo.Mode()) - if err != nil { - return fmt.Errorf("unable to make destination directory %q: %w", destDir, err) - } - - dirEntries, err := os.ReadDir(srcDir) - - if err != nil { - return fmt.Errorf("unable to read source directory %q: %w", srcDir, err) - } - - for _, dirEntry := range dirEntries { - if !dirEntry.IsDir() { - continue - } - - srcPath := filepath.Join(srcDir, dirEntry.Name()) - destPath := filepath.Join(destDir, dirEntry.Name()) - err := symlinkFile(srcPath, destPath) - - if err != nil { - return fmt.Errorf("unable to symlink directory %q to %q: %w", srcPath, destPath, err) - } - } - - return nil -} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/LICENSE b/vendor/github.com/hashicorp/terraform-plugin-testing/LICENSE new file mode 100644 index 000000000000..07c599410bf3 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/LICENSE @@ -0,0 +1,375 @@ +Copyright (c) 2014 HashiCorp, Inc. + +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/helper/acctest/random.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/acctest/random.go new file mode 100644 index 000000000000..7891bf2266a5 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/acctest/random.go @@ -0,0 +1,206 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package acctest + +import ( + "bytes" + crand "crypto/rand" + "crypto/rsa" + "crypto/x509" + "crypto/x509/pkix" + "encoding/pem" + "fmt" + "math/big" + "math/rand" + "net/netip" + "strings" + "time" + + "golang.org/x/crypto/ssh" +) + +func init() { + rand.Seed(time.Now().UTC().UnixNano()) +} + +// Helpers for generating random tidbits for use in identifiers to prevent +// collisions in acceptance tests. + +// RandInt generates a random integer +func RandInt() int { + return rand.Int() +} + +// RandomWithPrefix is used to generate a unique name with a prefix, for +// randomizing names in acceptance tests +func RandomWithPrefix(name string) string { + return fmt.Sprintf("%s-%d", name, RandInt()) +} + +// RandIntRange returns a random integer between min (inclusive) and max (exclusive) +func RandIntRange(min int, max int) int { + return rand.Intn(max-min) + min +} + +// RandString generates a random alphanumeric string of the length specified +func RandString(strlen int) string { + return RandStringFromCharSet(strlen, CharSetAlphaNum) +} + +// RandStringFromCharSet generates a random string by selecting characters from +// the charset provided +func RandStringFromCharSet(strlen int, charSet string) string { + result := make([]byte, strlen) + for i := 0; i < strlen; i++ { + result[i] = charSet[RandIntRange(0, len(charSet))] + } + return string(result) +} + +// RandSSHKeyPair generates a random public and private SSH key pair. +// +// The public key is returned in OpenSSH authorized key format, for example: +// +// ssh-rsa XXX comment +// +// The private key is RSA algorithm, 1024 bits, PEM encoded, and has no +// passphrase. Testing with different or stricter security requirements should +// use the standard library [crypto] and [golang.org/x/crypto/ssh] packages +// directly. +func RandSSHKeyPair(comment string) (string, string, error) { + privateKey, privateKeyPEM, err := genPrivateKey() + if err != nil { + return "", "", err + } + + publicKey, err := ssh.NewPublicKey(&privateKey.PublicKey) + if err != nil { + return "", "", err + } + keyMaterial := strings.TrimSpace(string(ssh.MarshalAuthorizedKey(publicKey))) + return fmt.Sprintf("%s %s", keyMaterial, comment), privateKeyPEM, nil +} + +// RandTLSCert generates a self-signed TLS certificate with a newly created +// private key, and returns both the cert and the private key PEM encoded. +func RandTLSCert(orgName string) (string, string, error) { + template := &x509.Certificate{ + SerialNumber: big.NewInt(int64(RandInt())), + Subject: pkix.Name{ + Organization: []string{orgName}, + }, + NotBefore: time.Now(), + NotAfter: time.Now().Add(24 * time.Hour), + KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + BasicConstraintsValid: true, + } + + privateKey, privateKeyPEM, err := genPrivateKey() + if err != nil { + return "", "", err + } + + cert, err := x509.CreateCertificate(crand.Reader, template, template, &privateKey.PublicKey, privateKey) + if err != nil { + return "", "", err + } + + certPEM, err := pemEncode(cert, "CERTIFICATE") + if err != nil { + return "", "", err + } + + return certPEM, privateKeyPEM, nil +} + +// RandIpAddress returns a random IP address in the specified CIDR block. +// The prefix length must be less than 31. +func RandIpAddress(s string) (string, error) { + prefix, err := netip.ParsePrefix(s) + + if err != nil { + return "", err + } + + if prefix.IsSingleIP() { + return prefix.Addr().String(), nil + } + + prefixSizeExponent := uint(prefix.Addr().BitLen() - prefix.Bits()) + + if prefix.Addr().Is4() && prefixSizeExponent > 31 { + return "", fmt.Errorf("CIDR range is too large: %d", prefixSizeExponent) + } + + // Prevent panics with rand.Int63n(). + if prefix.Addr().Is6() && prefixSizeExponent > 63 { + return "", fmt.Errorf("CIDR range is too large: %d", prefixSizeExponent) + } + + // Calculate max random integer based on the prefix. + // Bit shift 1< 0 { + return fmt.Sprintf("couldn't find resource (%d retries)", e.Retries) + } + + return "couldn't find resource" +} + +func (e *NotFoundError) Unwrap() error { + return e.LastError +} + +// UnexpectedStateError is returned when Refresh returns a state that's neither in Target nor Pending +type UnexpectedStateError struct { + LastError error + State string + ExpectedState []string +} + +func (e *UnexpectedStateError) Error() string { + return fmt.Sprintf( + "unexpected state '%s', wanted target '%s'. last error: %s", + e.State, + strings.Join(e.ExpectedState, ", "), + e.LastError, + ) +} + +func (e *UnexpectedStateError) Unwrap() error { + return e.LastError +} + +// TimeoutError is returned when WaitForState times out +type TimeoutError struct { + LastError error + LastState string + Timeout time.Duration + ExpectedState []string +} + +func (e *TimeoutError) Error() string { + expectedState := "resource to be gone" + if len(e.ExpectedState) > 0 { + expectedState = fmt.Sprintf("state to become '%s'", strings.Join(e.ExpectedState, ", ")) + } + + extraInfo := make([]string, 0) + if e.LastState != "" { + extraInfo = append(extraInfo, fmt.Sprintf("last state: '%s'", e.LastState)) + } + if e.Timeout > 0 { + extraInfo = append(extraInfo, fmt.Sprintf("timeout: %s", e.Timeout.String())) + } + + suffix := "" + if len(extraInfo) > 0 { + suffix = fmt.Sprintf(" (%s)", strings.Join(extraInfo, ", ")) + } + + if e.LastError != nil { + return fmt.Sprintf("timeout while waiting for %s%s: %s", + expectedState, suffix, e.LastError) + } + + return fmt.Sprintf("timeout while waiting for %s%s", + expectedState, suffix) +} + +func (e *TimeoutError) Unwrap() error { + return e.LastError +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/id.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/id.go similarity index 95% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/id.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/id.go index 44949550e734..c02b1b5ef017 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/id.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/id.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resource import ( diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/json.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/json.go new file mode 100644 index 000000000000..9cd6a1b98329 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/json.go @@ -0,0 +1,15 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package resource + +import ( + "bytes" + "encoding/json" +) + +func unmarshalJSON(data []byte, v interface{}) error { + dec := json.NewDecoder(bytes.NewReader(data)) + dec.UseNumber() + return dec.Decode(v) +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/plugin.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/plugin.go similarity index 98% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/plugin.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/plugin.go index 120f04276b32..5c92f3ab9999 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/plugin.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/plugin.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resource import ( @@ -13,10 +16,11 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov5" "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest" "github.com/hashicorp/terraform-plugin-sdk/v2/plugin" - testing "github.com/mitchellh/go-testing-interface" + "github.com/mitchellh/go-testing-interface" + + "github.com/hashicorp/terraform-plugin-testing/internal/logging" + "github.com/hashicorp/terraform-plugin-testing/internal/plugintest" ) // protov5ProviderFactory is a function which is called to start a protocol diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/state.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/state.go new file mode 100644 index 000000000000..93f6be494abf --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/state.go @@ -0,0 +1,283 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package resource + +import ( + "context" + "log" + "time" +) + +var refreshGracePeriod = 30 * time.Second + +// StateRefreshFunc is a function type used for StateChangeConf that is +// responsible for refreshing the item being watched for a state change. +// +// It returns three results. `result` is any object that will be returned +// as the final object after waiting for state change. This allows you to +// return the final updated object, for example an EC2 instance after refreshing +// it. A nil result represents not found. +// +// `state` is the latest state of that object. And `err` is any error that +// may have happened while refreshing the state. +type StateRefreshFunc func() (result interface{}, state string, err error) + +// StateChangeConf is the configuration struct used for `WaitForState`. +type StateChangeConf struct { + Delay time.Duration // Wait this time before starting checks + Pending []string // States that are "allowed" and will continue trying + Refresh StateRefreshFunc // Refreshes the current state + Target []string // Target state + Timeout time.Duration // The amount of time to wait before timeout + MinTimeout time.Duration // Smallest time to wait before refreshes + PollInterval time.Duration // Override MinTimeout/backoff and only poll this often + NotFoundChecks int // Number of times to allow not found (nil result from Refresh) + + // This is to work around inconsistent APIs + ContinuousTargetOccurence int // Number of times the Target state has to occur continuously +} + +// WaitForStateContext watches an object and waits for it to achieve the state +// specified in the configuration using the specified Refresh() func, +// waiting the number of seconds specified in the timeout configuration. +// +// If the Refresh function returns an error, exit immediately with that error. +// +// If the Refresh function returns a state other than the Target state or one +// listed in Pending, return immediately with an error. +// +// If the Timeout is exceeded before reaching the Target state, return an +// error. +// +// Otherwise, the result is the result of the first call to the Refresh function to +// reach the target state. +// +// Cancellation from the passed in context will cancel the refresh loop +func (conf *StateChangeConf) WaitForStateContext(ctx context.Context) (interface{}, error) { + log.Printf("[DEBUG] Waiting for state to become: %s", conf.Target) + + notfoundTick := 0 + targetOccurence := 0 + + // Set a default for times to check for not found + if conf.NotFoundChecks == 0 { + conf.NotFoundChecks = 20 + } + + if conf.ContinuousTargetOccurence == 0 { + conf.ContinuousTargetOccurence = 1 + } + + type Result struct { + Result interface{} + State string + Error error + Done bool + } + + // Read every result from the refresh loop, waiting for a positive result.Done. + resCh := make(chan Result, 1) + // cancellation channel for the refresh loop + cancelCh := make(chan struct{}) + + result := Result{} + + go func() { + defer close(resCh) + + select { + case <-time.After(conf.Delay): + case <-cancelCh: + return + } + + // start with 0 delay for the first loop + var wait time.Duration + + for { + // store the last result + resCh <- result + + // wait and watch for cancellation + select { + case <-cancelCh: + return + case <-time.After(wait): + // first round had no wait + if wait == 0 { + wait = 100 * time.Millisecond + } + } + + res, currentState, err := conf.Refresh() + result = Result{ + Result: res, + State: currentState, + Error: err, + } + + if err != nil { + resCh <- result + return + } + + // If we're waiting for the absence of a thing, then return + if res == nil && len(conf.Target) == 0 { + targetOccurence++ + if conf.ContinuousTargetOccurence == targetOccurence { + result.Done = true + resCh <- result + return + } + continue + } + + if res == nil { + // If we didn't find the resource, check if we have been + // not finding it for awhile, and if so, report an error. + notfoundTick++ + if notfoundTick > conf.NotFoundChecks { + result.Error = &NotFoundError{ + LastError: err, + Retries: notfoundTick, + } + resCh <- result + return + } + } else { + // Reset the counter for when a resource isn't found + notfoundTick = 0 + found := false + + for _, allowed := range conf.Target { + if currentState == allowed { + found = true + targetOccurence++ + if conf.ContinuousTargetOccurence == targetOccurence { + result.Done = true + resCh <- result + return + } + continue + } + } + + for _, allowed := range conf.Pending { + if currentState == allowed { + found = true + targetOccurence = 0 + break + } + } + + if !found && len(conf.Pending) > 0 { + result.Error = &UnexpectedStateError{ + LastError: err, + State: result.State, + ExpectedState: conf.Target, + } + resCh <- result + return + } + } + + // Wait between refreshes using exponential backoff, except when + // waiting for the target state to reoccur. + if targetOccurence == 0 { + wait *= 2 + } + + // If a poll interval has been specified, choose that interval. + // Otherwise bound the default value. + if conf.PollInterval > 0 && conf.PollInterval < 180*time.Second { + wait = conf.PollInterval + } else { + if wait < conf.MinTimeout { + wait = conf.MinTimeout + } else if wait > 10*time.Second { + wait = 10 * time.Second + } + } + + log.Printf("[TRACE] Waiting %s before next try", wait) + } + }() + + // store the last value result from the refresh loop + lastResult := Result{} + + timeout := time.After(conf.Timeout) + for { + select { + case r, ok := <-resCh: + // channel closed, so return the last result + if !ok { + return lastResult.Result, lastResult.Error + } + + // we reached the intended state + if r.Done { + return r.Result, r.Error + } + + // still waiting, store the last result + lastResult = r + case <-ctx.Done(): + close(cancelCh) + return nil, ctx.Err() + case <-timeout: + log.Printf("[WARN] WaitForState timeout after %s", conf.Timeout) + log.Printf("[WARN] WaitForState starting %s refresh grace period", refreshGracePeriod) + + // cancel the goroutine and start our grace period timer + close(cancelCh) + timeout := time.After(refreshGracePeriod) + + // we need a for loop and a label to break on, because we may have + // an extra response value to read, but still want to wait for the + // channel to close. + forSelect: + for { + select { + case r, ok := <-resCh: + if r.Done { + // the last refresh loop reached the desired state + return r.Result, r.Error + } + + if !ok { + // the goroutine returned + break forSelect + } + + // target state not reached, save the result for the + // TimeoutError and wait for the channel to close + lastResult = r + case <-ctx.Done(): + log.Println("[ERROR] Context cancelation detected, abandoning grace period") + break forSelect + case <-timeout: + log.Println("[ERROR] WaitForState exceeded refresh grace period") + break forSelect + } + } + + return nil, &TimeoutError{ + LastError: lastResult.Error, + LastState: lastResult.State, + Timeout: conf.Timeout, + ExpectedState: conf.Target, + } + } + } +} + +// WaitForState watches an object and waits for it to achieve the state +// specified in the configuration using the specified Refresh() func, +// waiting the number of seconds specified in the timeout configuration. +// +// Deprecated: Please use WaitForStateContext to ensure proper plugin shutdown +func (conf *StateChangeConf) WaitForState() (interface{}, error) { + return conf.WaitForStateContext(context.Background()) +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/state_shim.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/state_shim.go similarity index 96% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/state_shim.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/state_shim.go index 497bcc1c9960..0da782401711 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/state_shim.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/state_shim.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resource import ( @@ -7,9 +10,10 @@ import ( tfjson "github.com/hashicorp/terraform-json" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/addrs" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/tfdiags" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/terraform" + + "github.com/hashicorp/terraform-plugin-testing/internal/addrs" + "github.com/hashicorp/terraform-plugin-testing/internal/tfdiags" ) type shimmedState struct { diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testcase_providers.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testcase_providers.go similarity index 96% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testcase_providers.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testcase_providers.go index 19a548cdb1f1..9639cb04dfc1 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testcase_providers.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testcase_providers.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resource import ( diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testcase_validate.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testcase_validate.go similarity index 94% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testcase_validate.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testcase_validate.go index 4a4911615cb2..7f2425394bb3 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testcase_validate.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testcase_validate.go @@ -1,10 +1,13 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resource import ( "context" "fmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging" + "github.com/hashicorp/terraform-plugin-testing/internal/logging" ) // hasProviders returns true if the TestCase has set any of the diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing.go similarity index 99% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing.go index caadc3ddc5fc..987654c6dfb4 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resource import ( @@ -19,10 +22,12 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/addrs" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + "github.com/hashicorp/terraform-plugin-testing/terraform" + + "github.com/hashicorp/terraform-plugin-testing/internal/addrs" + "github.com/hashicorp/terraform-plugin-testing/internal/logging" + "github.com/hashicorp/terraform-plugin-testing/internal/plugintest" ) // flagSweep is a flag available when running tests on the command line. It diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_config.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_config.go new file mode 100644 index 000000000000..57bc0d8ce328 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_config.go @@ -0,0 +1,29 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package resource + +import ( + "context" + "fmt" + + "github.com/hashicorp/terraform-plugin-testing/internal/logging" + + "github.com/hashicorp/terraform-plugin-testing/internal/plugintest" +) + +func testStepTaint(ctx context.Context, step TestStep, wd *plugintest.WorkingDir) error { + if len(step.Taint) == 0 { + return nil + } + + logging.HelperResourceTrace(ctx, fmt.Sprintf("Using TestStep Taint: %v", step.Taint)) + + for _, p := range step.Taint { + err := wd.Taint(ctx, p) + if err != nil { + return fmt.Errorf("error tainting resource: %s", err) + } + } + return nil +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_new.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_new.go similarity index 95% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_new.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_new.go index 007ab66c0d8d..86f653f8f897 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_new.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_new.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resource import ( @@ -6,13 +9,14 @@ import ( "reflect" "strings" - "github.com/davecgh/go-spew/spew" + "github.com/google/go-cmp/cmp" tfjson "github.com/hashicorp/terraform-json" "github.com/mitchellh/go-testing-interface" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/terraform" + + "github.com/hashicorp/terraform-plugin-testing/internal/logging" + "github.com/hashicorp/terraform-plugin-testing/internal/plugintest" ) func runPostTestDestroy(ctx context.Context, t testing.T, c TestCase, wd *plugintest.WorkingDir, providers *providerFactories, statePreDestroy *terraform.State) error { @@ -42,8 +46,6 @@ func runPostTestDestroy(ctx context.Context, t testing.T, c TestCase, wd *plugin func runNewTest(ctx context.Context, t testing.T, c TestCase, helper *plugintest.Helper) { t.Helper() - spewConf := spew.NewDefaultConfig() - spewConf.SortKeys = true wd := helper.RequireNewWorkingDir(ctx, t) ctx = logging.TestTerraformPathContext(ctx, wd.GetHelper().TerraformExecPath()) @@ -360,9 +362,6 @@ func planIsEmpty(plan *tfjson.Plan) bool { func testIDRefresh(ctx context.Context, t testing.T, c TestCase, wd *plugintest.WorkingDir, step TestStep, r *terraform.ResourceState, providers *providerFactories) error { t.Helper() - spewConf := spew.NewDefaultConfig() - spewConf.SortKeys = true - // Build the state. The state is just the resource with an ID. There // are no attributes. We only set what is needed to perform a refresh. state := terraform.NewState() @@ -436,12 +435,9 @@ func testIDRefresh(ctx context.Context, t testing.T, c TestCase, wd *plugintest. } } - spewConf := spew.NewDefaultConfig() - spewConf.SortKeys = true - return fmt.Errorf( - "Attributes not equivalent. Difference is shown below. Top is actual, bottom is expected."+ - "\n\n%s\n\n%s", - spewConf.Sdump(actual), spewConf.Sdump(expected)) + if diff := cmp.Diff(expected, actual); diff != "" { + return fmt.Errorf("IDRefreshName attributes not equivalent. Difference is shown below. The - symbol indicates attributes missing after refresh.\n\n%s", diff) + } } return nil diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_new_config.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_new_config.go similarity index 95% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_new_config.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_new_config.go index 0d4e0b0e4ae0..3ad3f0916512 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_new_config.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_new_config.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resource import ( @@ -6,11 +9,12 @@ import ( "fmt" tfjson "github.com/hashicorp/terraform-json" - testing "github.com/mitchellh/go-testing-interface" + "github.com/mitchellh/go-testing-interface" + + "github.com/hashicorp/terraform-plugin-testing/terraform" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/internal/logging" + "github.com/hashicorp/terraform-plugin-testing/internal/plugintest" ) func testStepNewConfig(ctx context.Context, t testing.T, c TestCase, wd *plugintest.WorkingDir, step TestStep, providers *providerFactories) error { diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_new_import_state.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_new_import_state.go similarity index 91% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_new_import_state.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_new_import_state.go index 0ec007168bbb..b1124894b761 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_new_import_state.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_new_import_state.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resource import ( @@ -6,20 +9,18 @@ import ( "reflect" "strings" - "github.com/davecgh/go-spew/spew" + "github.com/google/go-cmp/cmp" "github.com/mitchellh/go-testing-interface" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/terraform" + + "github.com/hashicorp/terraform-plugin-testing/internal/logging" + "github.com/hashicorp/terraform-plugin-testing/internal/plugintest" ) func testStepNewImportState(ctx context.Context, t testing.T, helper *plugintest.Helper, wd *plugintest.WorkingDir, step TestStep, cfg string, providers *providerFactories) error { t.Helper() - spewConf := spew.NewDefaultConfig() - spewConf.SortKeys = true - if step.ResourceName == "" { t.Fatal("ResourceName is required for an import state test") } @@ -261,6 +262,8 @@ func testStepNewImportState(ctx context.Context, t testing.T, helper *plugintest if !reflect.DeepEqual(actual, expected) { // Determine only the different attributes + // go-cmp tries to show surrounding identical map key/value for + // context of differences, which may be confusing. for k, v := range expected { if av, ok := actual[k]; ok && v == av { delete(expected, k) @@ -268,10 +271,9 @@ func testStepNewImportState(ctx context.Context, t testing.T, helper *plugintest } } - t.Fatalf( - "ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected."+ - "\n\n%s\n\n%s", - spewConf.Sdump(actual), spewConf.Sdump(expected)) + if diff := cmp.Diff(expected, actual); diff != "" { + return fmt.Errorf("ImportStateVerify attributes not equivalent. Difference is shown below. The - symbol indicates attributes missing after import.\n\n%s", diff) + } } } } diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_new_refresh_state.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_new_refresh_state.go similarity index 88% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_new_refresh_state.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_new_refresh_state.go index 161129347431..fe7b2814539f 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_new_refresh_state.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_new_refresh_state.go @@ -1,24 +1,24 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resource import ( "context" "fmt" - "github.com/davecgh/go-spew/spew" tfjson "github.com/hashicorp/terraform-json" "github.com/mitchellh/go-testing-interface" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/terraform" + + "github.com/hashicorp/terraform-plugin-testing/internal/logging" + "github.com/hashicorp/terraform-plugin-testing/internal/plugintest" ) func testStepNewRefreshState(ctx context.Context, t testing.T, wd *plugintest.WorkingDir, step TestStep, providers *providerFactories) error { t.Helper() - spewConf := spew.NewDefaultConfig() - spewConf.SortKeys = true - var err error // Explicitly ensure prior state exists before refresh. err = runProviderCommand(ctx, t, func() error { diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_sets.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_sets.go similarity index 99% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_sets.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_sets.go index 3cdb4b9ecc4e..a304bfc4e3eb 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing_sets.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/testing_sets.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // These test helpers were developed by the AWS provider team at HashiCorp. package resource @@ -7,7 +10,7 @@ import ( "regexp" "strings" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) const ( diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/teststep_providers.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/teststep_providers.go similarity index 97% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/teststep_providers.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/teststep_providers.go index 757f8f638cf7..9b759bde03ae 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/teststep_providers.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/teststep_providers.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resource import ( diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/teststep_validate.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/teststep_validate.go similarity index 97% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/teststep_validate.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/teststep_validate.go index 0ba655168c83..082d9e6dd1d3 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/teststep_validate.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/teststep_validate.go @@ -1,10 +1,13 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resource import ( "context" "fmt" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging" + "github.com/hashicorp/terraform-plugin-testing/internal/logging" ) // testStepValidateRequest contains data for the (TestStep).validate() method. diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/wait.go b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/wait.go similarity index 97% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/wait.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/wait.go index 6b7bdae8c96d..eff4f474a001 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/wait.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/helper/resource/wait.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package resource import ( diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/addrs/doc.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/addrs/doc.go new file mode 100644 index 000000000000..0d29d9f45639 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/addrs/doc.go @@ -0,0 +1,20 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Package addrs contains types that represent "addresses", which are +// references to specific objects within a Terraform configuration or +// state. +// +// All addresses have string representations based on HCL traversal syntax +// which should be used in the user-interface, and also in-memory +// representations that can be used internally. +// +// For object types that exist within Terraform modules a pair of types is +// used. The "local" part of the address is represented by a type, and then +// an absolute path to that object in the context of its module is represented +// by a type of the same name with an "Abs" prefix added, for "absolute". +// +// All types within this package should be treated as immutable, even if this +// is not enforced by the Go compiler. It is always an implementation error +// to modify an address object in-place after it is initially constructed. +package addrs diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/addrs/instance_key.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/addrs/instance_key.go new file mode 100644 index 000000000000..8373297f876b --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/addrs/instance_key.go @@ -0,0 +1,50 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package addrs + +import ( + "fmt" +) + +// instanceKey represents the key of an instance within an object that +// contains multiple instances due to using "count" or "for_each" arguments +// in configuration. +// +// intKey and stringKey are the two implementations of this type. No other +// implementations are allowed. The single instance of an object that _isn't_ +// using "count" or "for_each" is represented by NoKey, which is a nil +// InstanceKey. +type instanceKey interface { + instanceKeySigil() + String() string +} + +// NoKey represents the absense of an instanceKey, for the single instance +// of a configuration object that does not use "count" or "for_each" at all. +var NoKey instanceKey + +// intKey is the InstanceKey representation representing integer indices, as +// used when the "count" argument is specified or if for_each is used with +// a sequence type. +type intKey int + +func (k intKey) instanceKeySigil() { +} + +func (k intKey) String() string { + return fmt.Sprintf("[%d]", int(k)) +} + +// stringKey is the InstanceKey representation representing string indices, as +// used when the "for_each" argument is specified with a map or object type. +type stringKey string + +func (k stringKey) instanceKeySigil() { +} + +func (k stringKey) String() string { + // FIXME: This isn't _quite_ right because Go's quoted string syntax is + // slightly different than HCL's, but we'll accept it for now. + return fmt.Sprintf("[%q]", string(k)) +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/addrs/module.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/addrs/module.go new file mode 100644 index 000000000000..8dbbb469d487 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/addrs/module.go @@ -0,0 +1,16 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package addrs + +// Module is an address for a module call within configuration. This is +// the static counterpart of ModuleInstance, representing a traversal through +// the static module call tree in configuration and does not take into account +// the potentially-multiple instances of a module that might be created by +// "count" and "for_each" arguments within those calls. +// +// This type should be used only in very specialized cases when working with +// the static module call tree. Type ModuleInstance is appropriate in more cases. +// +// Although Module is a slice, it should be treated as immutable after creation. +type Module []string diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/addrs/module_instance.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/addrs/module_instance.go new file mode 100644 index 000000000000..e43fd3e36220 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/addrs/module_instance.go @@ -0,0 +1,242 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package addrs + +import ( + "bytes" + "fmt" + + "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/zclconf/go-cty/cty" + "github.com/zclconf/go-cty/cty/gocty" + + "github.com/hashicorp/terraform-plugin-testing/internal/tfdiags" +) + +// ModuleInstance is an address for a particular module instance within the +// dynamic module tree. This is an extension of the static traversals +// represented by type Module that deals with the possibility of a single +// module call producing multiple instances via the "count" and "for_each" +// arguments. +// +// Although ModuleInstance is a slice, it should be treated as immutable after +// creation. +type ModuleInstance []ModuleInstanceStep + +func parseModuleInstance(traversal hcl.Traversal) (ModuleInstance, tfdiags.Diagnostics) { + mi, remain, diags := parseModuleInstancePrefix(traversal) + if len(remain) != 0 { + if len(remain) == len(traversal) { + diags = append(diags, tfdiags.Diag( + tfdiags.Error, + "Invalid module instance address", + "A module instance address must begin with \"module.\".", + )) + } else { + diags = append(diags, tfdiags.Diag( + tfdiags.Error, + "Invalid module instance address", + "The module instance address is followed by additional invalid content.", + )) + } + } + return mi, diags +} + +// ParseModuleInstanceStr is a helper wrapper around ParseModuleInstance +// that takes a string and parses it with the HCL native syntax traversal parser +// before interpreting it. +// +// This should be used only in specialized situations since it will cause the +// created references to not have any meaningful source location information. +// If a reference string is coming from a source that should be identified in +// error messages then the caller should instead parse it directly using a +// suitable function from the HCL API and pass the traversal itself to +// ParseProviderConfigCompact. +// +// Error diagnostics are returned if either the parsing fails or the analysis +// of the traversal fails. There is no way for the caller to distinguish the +// two kinds of diagnostics programmatically. If error diagnostics are returned +// then the returned address is invalid. +func ParseModuleInstanceStr(str string) (ModuleInstance, tfdiags.Diagnostics) { + var diags tfdiags.Diagnostics + + traversal, parseDiags := hclsyntax.ParseTraversalAbs([]byte(str), "", hcl.Pos{Line: 1, Column: 1}) + for _, err := range parseDiags.Errs() { + // ignore warnings, they don't matter in this case + diags = append(diags, tfdiags.FromError(err)) + } + if parseDiags.HasErrors() { + return nil, diags + } + + addr, addrDiags := parseModuleInstance(traversal) + diags = append(diags, addrDiags...) + return addr, diags +} + +func parseModuleInstancePrefix(traversal hcl.Traversal) (ModuleInstance, hcl.Traversal, tfdiags.Diagnostics) { + remain := traversal + var mi ModuleInstance + var diags tfdiags.Diagnostics + + for len(remain) > 0 { + var next string + switch tt := remain[0].(type) { + case hcl.TraverseRoot: + next = tt.Name + case hcl.TraverseAttr: + next = tt.Name + default: + diags = append(diags, tfdiags.Diag( + tfdiags.Error, + "Invalid address operator", + "Module address prefix must be followed by dot and then a name.", + )) + } + + if next != "module" { + break + } + + remain = remain[1:] + // If we have the prefix "module" then we should be followed by an + // module call name, as an attribute, and then optionally an index step + // giving the instance key. + if len(remain) == 0 { + diags = append(diags, tfdiags.Diag( + tfdiags.Error, + "Invalid address operator", + "Prefix \"module.\" must be followed by a module name.", + )) + break + } + + var moduleName string + switch tt := remain[0].(type) { + case hcl.TraverseAttr: + moduleName = tt.Name + default: + diags = append(diags, tfdiags.Diag( + tfdiags.Error, + "Invalid address operator", + "Prefix \"module.\" must be followed by a module name.", + )) + } + remain = remain[1:] + step := ModuleInstanceStep{ + Name: moduleName, + } + + if len(remain) > 0 { + if idx, ok := remain[0].(hcl.TraverseIndex); ok { + remain = remain[1:] + + switch idx.Key.Type() { + case cty.String: + step.InstanceKey = stringKey(idx.Key.AsString()) + case cty.Number: + var idxInt int + err := gocty.FromCtyValue(idx.Key, &idxInt) + if err == nil { + step.InstanceKey = intKey(idxInt) + } else { + diags = append(diags, tfdiags.Diag( + tfdiags.Error, + "Invalid address operator", + fmt.Sprintf("Invalid module index: %s.", err), + )) + } + default: + // Should never happen, because no other types are allowed in traversal indices. + diags = append(diags, tfdiags.Diag( + tfdiags.Error, + "Invalid address operator", + "Invalid module key: must be either a string or an integer.", + )) + } + } + } + + mi = append(mi, step) + } + + var retRemain hcl.Traversal + if len(remain) > 0 { + retRemain = make(hcl.Traversal, len(remain)) + copy(retRemain, remain) + // The first element here might be either a TraverseRoot or a + // TraverseAttr, depending on whether we had a module address on the + // front. To make life easier for callers, we'll normalize to always + // start with a TraverseRoot. + if tt, ok := retRemain[0].(hcl.TraverseAttr); ok { + retRemain[0] = hcl.TraverseRoot{ + Name: tt.Name, + SrcRange: tt.SrcRange, + } + } + } + + return mi, retRemain, diags +} + +// UnkeyedInstanceShim is a shim method for converting a Module address to the +// equivalent ModuleInstance address that assumes that no modules have +// keyed instances. +// +// This is a temporary allowance for the fact that Terraform does not presently +// support "count" and "for_each" on modules, and thus graph building code that +// derives graph nodes from configuration must just assume unkeyed modules +// in order to construct the graph. At a later time when "count" and "for_each" +// support is added for modules, all callers of this method will need to be +// reworked to allow for keyed module instances. +func (m Module) UnkeyedInstanceShim() ModuleInstance { + path := make(ModuleInstance, len(m)) + for i, name := range m { + path[i] = ModuleInstanceStep{Name: name} + } + return path +} + +// ModuleInstanceStep is a single traversal step through the dynamic module +// tree. It is used only as part of ModuleInstance. +type ModuleInstanceStep struct { + Name string + InstanceKey instanceKey +} + +// RootModuleInstance is the module instance address representing the root +// module, which is also the zero value of ModuleInstance. +var RootModuleInstance ModuleInstance + +// Child returns the address of a child module instance of the receiver, +// identified by the given name and key. +func (m ModuleInstance) Child(name string, key instanceKey) ModuleInstance { + ret := make(ModuleInstance, 0, len(m)+1) + ret = append(ret, m...) + return append(ret, ModuleInstanceStep{ + Name: name, + InstanceKey: key, + }) +} + +// String returns a string representation of the receiver, in the format used +// within e.g. user-provided resource addresses. +// +// The address of the root module has the empty string as its representation. +func (m ModuleInstance) String() string { + var buf bytes.Buffer + sep := "" + for _, step := range m { + buf.WriteString(sep) + buf.WriteString("module.") + buf.WriteString(step.Name) + if step.InstanceKey != NoKey { + buf.WriteString(step.InstanceKey.String()) + } + sep = "." + } + return buf.String() +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/coerce_value.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/coerce_value.go new file mode 100644 index 000000000000..d12ff8cced9b --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/coerce_value.go @@ -0,0 +1,253 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package configschema + +import ( + "fmt" + + "github.com/hashicorp/go-cty/cty" + "github.com/hashicorp/go-cty/cty/convert" +) + +// CoerceValue attempts to force the given value to conform to the type +// implied by the receiever. +// +// This is useful in situations where a configuration must be derived from +// an already-decoded value. It is always better to decode directly from +// configuration where possible since then source location information is +// still available to produce diagnostics, but in special situations this +// function allows a compatible result to be obtained even if the +// configuration objects are not available. +// +// If the given value cannot be converted to conform to the receiving schema +// then an error is returned describing one of possibly many problems. This +// error may be a cty.PathError indicating a position within the nested +// data structure where the problem applies. +func (b *Block) CoerceValue(in cty.Value) (cty.Value, error) { + var path cty.Path + return b.coerceValue(in, path) +} + +func (b *Block) coerceValue(in cty.Value, path cty.Path) (cty.Value, error) { + switch { + case in.IsNull(): + return cty.NullVal(b.ImpliedType()), nil + case !in.IsKnown(): + return cty.UnknownVal(b.ImpliedType()), nil + } + + ty := in.Type() + if !ty.IsObjectType() { + return cty.UnknownVal(b.ImpliedType()), path.NewErrorf("an object is required") + } + + for name := range ty.AttributeTypes() { + if _, defined := b.Attributes[name]; defined { + continue + } + if _, defined := b.BlockTypes[name]; defined { + continue + } + return cty.UnknownVal(b.ImpliedType()), path.NewErrorf("unexpected attribute %q", name) + } + + attrs := make(map[string]cty.Value) + + for name, attrS := range b.Attributes { + var val cty.Value + switch { + case ty.HasAttribute(name): + val = in.GetAttr(name) + case attrS.Computed || attrS.Optional: + val = cty.NullVal(attrS.Type) + default: + return cty.UnknownVal(b.ImpliedType()), path.NewErrorf("attribute %q is required", name) + } + + val, err := attrS.coerceValue(val, append(path, cty.GetAttrStep{Name: name})) + if err != nil { + return cty.UnknownVal(b.ImpliedType()), err + } + + attrs[name] = val + } + for typeName, blockS := range b.BlockTypes { + switch blockS.Nesting { + + case NestingSingle, NestingGroup: + switch { + case ty.HasAttribute(typeName): + var err error + val := in.GetAttr(typeName) + attrs[typeName], err = blockS.coerceValue(val, append(path, cty.GetAttrStep{Name: typeName})) + if err != nil { + return cty.UnknownVal(b.ImpliedType()), err + } + default: + attrs[typeName] = blockS.EmptyValue() + } + + case NestingList: + switch { + case ty.HasAttribute(typeName): + coll := in.GetAttr(typeName) + + switch { + case coll.IsNull(): + attrs[typeName] = cty.NullVal(cty.List(blockS.ImpliedType())) + continue + case !coll.IsKnown(): + attrs[typeName] = cty.UnknownVal(cty.List(blockS.ImpliedType())) + continue + } + + if !coll.CanIterateElements() { + return cty.UnknownVal(b.ImpliedType()), path.NewErrorf("must be a list") + } + l := coll.LengthInt() + + if l == 0 { + attrs[typeName] = cty.ListValEmpty(blockS.ImpliedType()) + continue + } + elems := make([]cty.Value, 0, l) + { + path = append(path, cty.GetAttrStep{Name: typeName}) + for it := coll.ElementIterator(); it.Next(); { + var err error + idx, val := it.Element() + val, err = blockS.coerceValue(val, append(path, cty.IndexStep{Key: idx})) + if err != nil { + return cty.UnknownVal(b.ImpliedType()), err + } + elems = append(elems, val) + } + } + attrs[typeName] = cty.ListVal(elems) + default: + attrs[typeName] = cty.ListValEmpty(blockS.ImpliedType()) + } + + case NestingSet: + switch { + case ty.HasAttribute(typeName): + coll := in.GetAttr(typeName) + + switch { + case coll.IsNull(): + attrs[typeName] = cty.NullVal(cty.Set(blockS.ImpliedType())) + continue + case !coll.IsKnown(): + attrs[typeName] = cty.UnknownVal(cty.Set(blockS.ImpliedType())) + continue + } + + if !coll.CanIterateElements() { + return cty.UnknownVal(b.ImpliedType()), path.NewErrorf("must be a set") + } + l := coll.LengthInt() + + if l == 0 { + attrs[typeName] = cty.SetValEmpty(blockS.ImpliedType()) + continue + } + elems := make([]cty.Value, 0, l) + { + path = append(path, cty.GetAttrStep{Name: typeName}) + for it := coll.ElementIterator(); it.Next(); { + var err error + idx, val := it.Element() + val, err = blockS.coerceValue(val, append(path, cty.IndexStep{Key: idx})) + if err != nil { + return cty.UnknownVal(b.ImpliedType()), err + } + elems = append(elems, val) + } + } + attrs[typeName] = cty.SetVal(elems) + default: + attrs[typeName] = cty.SetValEmpty(blockS.ImpliedType()) + } + + case NestingMap: + switch { + case ty.HasAttribute(typeName): + coll := in.GetAttr(typeName) + + switch { + case coll.IsNull(): + attrs[typeName] = cty.NullVal(cty.Map(blockS.ImpliedType())) + continue + case !coll.IsKnown(): + attrs[typeName] = cty.UnknownVal(cty.Map(blockS.ImpliedType())) + continue + } + + if !coll.CanIterateElements() { + return cty.UnknownVal(b.ImpliedType()), path.NewErrorf("must be a map") + } + l := coll.LengthInt() + if l == 0 { + attrs[typeName] = cty.MapValEmpty(blockS.ImpliedType()) + continue + } + elems := make(map[string]cty.Value) + { + path = append(path, cty.GetAttrStep{Name: typeName}) + for it := coll.ElementIterator(); it.Next(); { + var err error + key, val := it.Element() + if key.Type() != cty.String || key.IsNull() || !key.IsKnown() { + return cty.UnknownVal(b.ImpliedType()), path.NewErrorf("must be a map") + } + val, err = blockS.coerceValue(val, append(path, cty.IndexStep{Key: key})) + if err != nil { + return cty.UnknownVal(b.ImpliedType()), err + } + elems[key.AsString()] = val + } + } + + // If the attribute values here contain any DynamicPseudoTypes, + // the concrete type must be an object. + useObject := false + switch { + case coll.Type().IsObjectType(): + useObject = true + default: + // It's possible that we were given a map, and need to coerce it to an object + ety := coll.Type().ElementType() + for _, v := range elems { + if !v.Type().Equals(ety) { + useObject = true + break + } + } + } + + if useObject { + attrs[typeName] = cty.ObjectVal(elems) + } else { + attrs[typeName] = cty.MapVal(elems) + } + default: + attrs[typeName] = cty.MapValEmpty(blockS.ImpliedType()) + } + + default: + // should never happen because above is exhaustive + panic(fmt.Errorf("unsupported nesting mode %#v", blockS.Nesting)) + } + } + + return cty.ObjectVal(attrs), nil +} + +func (a *Attribute) coerceValue(in cty.Value, path cty.Path) (cty.Value, error) { + val, err := convert.Convert(in, a.Type) + if err != nil { + return cty.UnknownVal(a.Type), path.NewError(err) + } + return val, nil +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/doc.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/doc.go new file mode 100644 index 000000000000..d96be9c7f0f7 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/doc.go @@ -0,0 +1,17 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Package configschema contains types for describing the expected structure +// of a configuration block whose shape is not known until runtime. +// +// For example, this is used to describe the expected contents of a resource +// configuration block, which is defined by the corresponding provider plugin +// and thus not compiled into Terraform core. +// +// A configschema primarily describes the shape of configuration, but it is +// also suitable for use with other structures derived from the configuration, +// such as the cached state of a resource or a resource diff. +// +// This package should not be confused with the package helper/schema, which +// is the higher-level helper library used to implement providers themselves. +package configschema diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/empty_value.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/empty_value.go new file mode 100644 index 000000000000..3c9573bc56ad --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/empty_value.go @@ -0,0 +1,62 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package configschema + +import ( + "github.com/hashicorp/go-cty/cty" +) + +// EmptyValue returns the "empty value" for the recieving block, which for +// a block type is a non-null object where all of the attribute values are +// the empty values of the block's attributes and nested block types. +// +// In other words, it returns the value that would be returned if an empty +// block were decoded against the recieving schema, assuming that no required +// attribute or block constraints were honored. +func (b *Block) EmptyValue() cty.Value { + vals := make(map[string]cty.Value) + for name, attrS := range b.Attributes { + vals[name] = attrS.EmptyValue() + } + for name, blockS := range b.BlockTypes { + vals[name] = blockS.EmptyValue() + } + return cty.ObjectVal(vals) +} + +// EmptyValue returns the "empty value" for the receiving attribute, which is +// the value that would be returned if there were no definition of the attribute +// at all, ignoring any required constraint. +func (a *Attribute) EmptyValue() cty.Value { + return cty.NullVal(a.Type) +} + +// EmptyValue returns the "empty value" for when there are zero nested blocks +// present of the receiving type. +func (b *NestedBlock) EmptyValue() cty.Value { + switch b.Nesting { + case NestingSingle: + return cty.NullVal(b.Block.ImpliedType()) + case NestingGroup: + return b.Block.EmptyValue() + case NestingList: + if ty := b.Block.ImpliedType(); ty.HasDynamicTypes() { + return cty.EmptyTupleVal + } else { + return cty.ListValEmpty(ty) + } + case NestingMap: + if ty := b.Block.ImpliedType(); ty.HasDynamicTypes() { + return cty.EmptyObjectVal + } else { + return cty.MapValEmpty(ty) + } + case NestingSet: + return cty.SetValEmpty(b.Block.ImpliedType()) + default: + // Should never get here because the above is intended to be exhaustive, + // but we'll be robust and return a result nonetheless. + return cty.NullVal(cty.DynamicPseudoType) + } +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/implied_type.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/implied_type.go new file mode 100644 index 000000000000..4de413519f65 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/implied_type.go @@ -0,0 +1,71 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package configschema + +import ( + "github.com/hashicorp/go-cty/cty" +) + +// ImpliedType returns the cty.Type that would result from decoding a +// configuration block using the receiving block schema. +// +// ImpliedType always returns a result, even if the given schema is +// inconsistent. +func (b *Block) ImpliedType() cty.Type { + if b == nil { + return cty.EmptyObject + } + + atys := make(map[string]cty.Type) + + for name, attrS := range b.Attributes { + atys[name] = attrS.Type + } + + for name, blockS := range b.BlockTypes { + if _, exists := atys[name]; exists { + panic("invalid schema, blocks and attributes cannot have the same name") + } + + childType := blockS.Block.ImpliedType() + + switch blockS.Nesting { + case NestingSingle, NestingGroup: + atys[name] = childType + case NestingList: + // We prefer to use a list where possible, since it makes our + // implied type more complete, but if there are any + // dynamically-typed attributes inside we must use a tuple + // instead, which means our type _constraint_ must be + // cty.DynamicPseudoType to allow the tuple type to be decided + // separately for each value. + if childType.HasDynamicTypes() { + atys[name] = cty.DynamicPseudoType + } else { + atys[name] = cty.List(childType) + } + case NestingSet: + if childType.HasDynamicTypes() { + panic("can't use cty.DynamicPseudoType inside a block type with NestingSet") + } + atys[name] = cty.Set(childType) + case NestingMap: + // We prefer to use a map where possible, since it makes our + // implied type more complete, but if there are any + // dynamically-typed attributes inside we must use an object + // instead, which means our type _constraint_ must be + // cty.DynamicPseudoType to allow the tuple type to be decided + // separately for each value. + if childType.HasDynamicTypes() { + atys[name] = cty.DynamicPseudoType + } else { + atys[name] = cty.Map(childType) + } + default: + panic("invalid nesting type") + } + } + + return cty.Object(atys) +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/nestingmode_string.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/nestingmode_string.go new file mode 100644 index 000000000000..febe743e11a6 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/nestingmode_string.go @@ -0,0 +1,28 @@ +// Code generated by "stringer -type=NestingMode"; DO NOT EDIT. + +package configschema + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[nestingModeInvalid-0] + _ = x[NestingSingle-1] + _ = x[NestingGroup-2] + _ = x[NestingList-3] + _ = x[NestingSet-4] + _ = x[NestingMap-5] +} + +const _NestingMode_name = "nestingModeInvalidNestingSingleNestingGroupNestingListNestingSetNestingMap" + +var _NestingMode_index = [...]uint8{0, 18, 31, 43, 54, 64, 74} + +func (i NestingMode) String() string { + if i < 0 || i >= NestingMode(len(_NestingMode_index)-1) { + return "NestingMode(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _NestingMode_name[_NestingMode_index[i]:_NestingMode_index[i+1]] +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/schema.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/schema.go new file mode 100644 index 000000000000..c445b4ba55e9 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema/schema.go @@ -0,0 +1,161 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package configschema + +import ( + "github.com/hashicorp/go-cty/cty" +) + +// StringKind represents the format a string is in. +type StringKind int + +const ( + // StringPlain indicates a string is plain-text and requires no processing for display. + StringPlain StringKind = iota + // StringMarkdown indicates a string is in markdown format and may + // require additional processing to display. + StringMarkdown +) + +// Block represents a configuration block. +// +// "Block" here is a logical grouping construct, though it happens to map +// directly onto the physical block syntax of Terraform's native configuration +// syntax. It may be a more a matter of convention in other syntaxes, such as +// JSON. +// +// When converted to a value, a Block always becomes an instance of an object +// type derived from its defined attributes and nested blocks +type Block struct { + // Attributes describes any attributes that may appear directly inside + // the block. + Attributes map[string]*Attribute + + // BlockTypes describes any nested block types that may appear directly + // inside the block. + BlockTypes map[string]*NestedBlock + + // Description and DescriptionKind contain a user facing description of the block + // and the format of that string. + Description string + DescriptionKind StringKind + + // Deprecated indicates whether the block has been marked as deprecated in the + // provider and usage should be discouraged. + Deprecated bool +} + +// Attribute represents a configuration attribute, within a block. +type Attribute struct { + // Type is a type specification that the attribute's value must conform to. + Type cty.Type + + // Description is an English-language description of the purpose and + // usage of the attribute. A description should be concise and use only + // one or two sentences, leaving full definition to longer-form + // documentation defined elsewhere. + Description string + DescriptionKind StringKind + + // Required, if set to true, specifies that an omitted or null value is + // not permitted. + Required bool + + // Optional, if set to true, specifies that an omitted or null value is + // permitted. This field conflicts with Required. + Optional bool + + // Computed, if set to true, specifies that the value comes from the + // provider rather than from configuration. If combined with Optional, + // then the config may optionally provide an overridden value. + Computed bool + + // Sensitive, if set to true, indicates that an attribute may contain + // sensitive information. + // + // At present nothing is done with this information, but callers are + // encouraged to set it where appropriate so that it may be used in the + // future to help Terraform mask sensitive information. (Terraform + // currently achieves this in a limited sense via other mechanisms.) + Sensitive bool + + // Deprecated indicates whether the attribute has been marked as deprecated in the + // provider and usage should be discouraged. + Deprecated bool +} + +// NestedBlock represents the embedding of one block within another. +type NestedBlock struct { + // Block is the description of the block that's nested. + Block + + // Nesting provides the nesting mode for the child block, which determines + // how many instances of the block are allowed, how many labels it expects, + // and how the resulting data will be converted into a data structure. + Nesting NestingMode + + // MinItems and MaxItems set, for the NestingList and NestingSet nesting + // modes, lower and upper limits on the number of child blocks allowed + // of the given type. If both are left at zero, no limit is applied. + // + // As a special case, both values can be set to 1 for NestingSingle in + // order to indicate that a particular single block is required. + // + // These fields are ignored for other nesting modes and must both be left + // at zero. + MinItems, MaxItems int +} + +// NestingMode is an enumeration of modes for nesting blocks inside other +// blocks. +type NestingMode int + +// This code was previously generated with a go:generate directive calling: +// go run golang.org/x/tools/cmd/stringer -type=NestingMode +// However, it is now considered frozen and the tooling dependency has been +// removed. The String method can be manually updated if necessary. + +const ( + nestingModeInvalid NestingMode = iota + + // NestingSingle indicates that only a single instance of a given + // block type is permitted, with no labels, and its content should be + // provided directly as an object value. + NestingSingle + + // NestingGroup is similar to NestingSingle in that it calls for only a + // single instance of a given block type with no labels, but it additonally + // guarantees that its result will never be null, even if the block is + // absent, and instead the nested attributes and blocks will be treated + // as absent in that case. (Any required attributes or blocks within the + // nested block are not enforced unless the block is explicitly present + // in the configuration, so they are all effectively optional when the + // block is not present.) + // + // This is useful for the situation where a remote API has a feature that + // is always enabled but has a group of settings related to that feature + // that themselves have default values. By using NestingGroup instead of + // NestingSingle in that case, generated plans will show the block as + // present even when not present in configuration, thus allowing any + // default values within to be displayed to the user. + NestingGroup + + // NestingList indicates that multiple blocks of the given type are + // permitted, with no labels, and that their corresponding objects should + // be provided in a list. + NestingList + + // NestingSet indicates that multiple blocks of the given type are + // permitted, with no labels, and that their corresponding objects should + // be provided in a set. + NestingSet + + // NestingMap indicates that multiple blocks of the given type are + // permitted, each with a single label, and that their corresponding + // objects should be provided in a map whose keys are the labels. + // + // It's an error, therefore, to use the same label value on multiple + // blocks. + NestingMap +) diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim/flatmap.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim/flatmap.go new file mode 100644 index 000000000000..2bad034de94f --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim/flatmap.go @@ -0,0 +1,426 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package hcl2shim + +import ( + "fmt" + "strconv" + "strings" + + "github.com/hashicorp/go-cty/cty" + "github.com/hashicorp/go-cty/cty/convert" +) + +// FlatmapValueFromHCL2 converts a value from HCL2 (really, from the cty dynamic +// types library that HCL2 uses) to a map compatible with what would be +// produced by the "flatmap" package. +// +// The type of the given value informs the structure of the resulting map. +// The value must be of an object type or this function will panic. +// +// Flatmap values can only represent maps when they are of primitive types, +// so the given value must not have any maps of complex types or the result +// is undefined. +func FlatmapValueFromHCL2(v cty.Value) map[string]string { + if v.IsNull() { + return nil + } + + if !v.Type().IsObjectType() { + panic(fmt.Sprintf("HCL2ValueFromFlatmap called on %#v", v.Type())) + } + + m := make(map[string]string) + flatmapValueFromHCL2Map(m, "", v) + return m +} + +func flatmapValueFromHCL2Value(m map[string]string, key string, val cty.Value) { + ty := val.Type() + switch { + case ty.IsPrimitiveType() || ty == cty.DynamicPseudoType: + flatmapValueFromHCL2Primitive(m, key, val) + case ty.IsObjectType() || ty.IsMapType(): + flatmapValueFromHCL2Map(m, key+".", val) + case ty.IsTupleType() || ty.IsListType() || ty.IsSetType(): + flatmapValueFromHCL2Seq(m, key+".", val) + default: + panic(fmt.Sprintf("cannot encode %s to flatmap", ty.FriendlyName())) + } +} + +func flatmapValueFromHCL2Primitive(m map[string]string, key string, val cty.Value) { + if !val.IsKnown() { + m[key] = UnknownVariableValue + return + } + if val.IsNull() { + // Omit entirely + return + } + + var err error + val, err = convert.Convert(val, cty.String) + if err != nil { + // Should not be possible, since all primitive types can convert to string. + panic(fmt.Sprintf("invalid primitive encoding to flatmap: %s", err)) + } + m[key] = val.AsString() +} + +func flatmapValueFromHCL2Map(m map[string]string, prefix string, val cty.Value) { + if val.IsNull() { + // Omit entirely + return + } + if !val.IsKnown() { + switch { + case val.Type().IsObjectType(): + // Whole objects can't be unknown in flatmap, so instead we'll + // just write all of the attribute values out as unknown. + for name, aty := range val.Type().AttributeTypes() { + flatmapValueFromHCL2Value(m, prefix+name, cty.UnknownVal(aty)) + } + default: + m[prefix+"%"] = UnknownVariableValue + } + return + } + + valLen := 0 + for it := val.ElementIterator(); it.Next(); { + ak, av := it.Element() + name := ak.AsString() + flatmapValueFromHCL2Value(m, prefix+name, av) + valLen++ + } + if !val.Type().IsObjectType() { // objects don't have an explicit count included, since their attribute count is fixed + m[prefix+"%"] = strconv.Itoa(valLen) + } +} + +func flatmapValueFromHCL2Seq(m map[string]string, prefix string, val cty.Value) { + if val.IsNull() { + // Omit entirely + return + } + if !val.IsKnown() { + m[prefix+"#"] = UnknownVariableValue + return + } + + // For sets this won't actually generate exactly what helper/schema would've + // generated, because we don't have access to the set key function it + // would've used. However, in practice it doesn't actually matter what the + // keys are as long as they are unique, so we'll just generate sequential + // indexes for them as if it were a list. + // + // An important implication of this, however, is that the set ordering will + // not be consistent across mutations and so different keys may be assigned + // to the same value when round-tripping. Since this shim is intended to + // be short-lived and not used for round-tripping, we accept this. + i := 0 + for it := val.ElementIterator(); it.Next(); { + _, av := it.Element() + key := prefix + strconv.Itoa(i) + flatmapValueFromHCL2Value(m, key, av) + i++ + } + m[prefix+"#"] = strconv.Itoa(i) +} + +// HCL2ValueFromFlatmap converts a map compatible with what would be produced +// by the "flatmap" package to a HCL2 (really, the cty dynamic types library +// that HCL2 uses) object type. +// +// The intended result type must be provided in order to guide how the +// map contents are decoded. This must be an object type or this function +// will panic. +// +// Flatmap values can only represent maps when they are of primitive types, +// so the given type must not have any maps of complex types or the result +// is undefined. +// +// The result may contain null values if the given map does not contain keys +// for all of the different key paths implied by the given type. +func HCL2ValueFromFlatmap(m map[string]string, ty cty.Type) (cty.Value, error) { + if m == nil { + return cty.NullVal(ty), nil + } + if !ty.IsObjectType() { + panic(fmt.Sprintf("HCL2ValueFromFlatmap called on %#v", ty)) + } + + return hcl2ValueFromFlatmapObject(m, "", ty.AttributeTypes()) +} + +func hcl2ValueFromFlatmapValue(m map[string]string, key string, ty cty.Type) (cty.Value, error) { + var val cty.Value + var err error + switch { + case ty.IsPrimitiveType(): + val, err = hcl2ValueFromFlatmapPrimitive(m, key, ty) + case ty.IsObjectType(): + val, err = hcl2ValueFromFlatmapObject(m, key+".", ty.AttributeTypes()) + case ty.IsTupleType(): + val, err = hcl2ValueFromFlatmapTuple(m, key+".", ty.TupleElementTypes()) + case ty.IsMapType(): + val, err = hcl2ValueFromFlatmapMap(m, key+".", ty) + case ty.IsListType(): + val, err = hcl2ValueFromFlatmapList(m, key+".", ty) + case ty.IsSetType(): + val, err = hcl2ValueFromFlatmapSet(m, key+".", ty) + default: + err = fmt.Errorf("cannot decode %s from flatmap", ty.FriendlyName()) + } + + if err != nil { + return cty.DynamicVal, err + } + return val, nil +} + +func hcl2ValueFromFlatmapPrimitive(m map[string]string, key string, ty cty.Type) (cty.Value, error) { + rawVal, exists := m[key] + if !exists { + return cty.NullVal(ty), nil + } + if rawVal == UnknownVariableValue { + return cty.UnknownVal(ty), nil + } + + var err error + val := cty.StringVal(rawVal) + val, err = convert.Convert(val, ty) + if err != nil { + // This should never happen for _valid_ input, but flatmap data might + // be tampered with by the user and become invalid. + return cty.DynamicVal, fmt.Errorf("invalid value for %q in state: %s", key, err) + } + + return val, nil +} + +func hcl2ValueFromFlatmapObject(m map[string]string, prefix string, atys map[string]cty.Type) (cty.Value, error) { + vals := make(map[string]cty.Value) + for name, aty := range atys { + val, err := hcl2ValueFromFlatmapValue(m, prefix+name, aty) + if err != nil { + return cty.DynamicVal, err + } + vals[name] = val + } + return cty.ObjectVal(vals), nil +} + +func hcl2ValueFromFlatmapTuple(m map[string]string, prefix string, etys []cty.Type) (cty.Value, error) { + var vals []cty.Value + + // if the container is unknown, there is no count string + listName := strings.TrimRight(prefix, ".") + if m[listName] == UnknownVariableValue { + return cty.UnknownVal(cty.Tuple(etys)), nil + } + + countStr, exists := m[prefix+"#"] + if !exists { + return cty.NullVal(cty.Tuple(etys)), nil + } + if countStr == UnknownVariableValue { + return cty.UnknownVal(cty.Tuple(etys)), nil + } + + count, err := strconv.Atoi(countStr) + if err != nil { + return cty.DynamicVal, fmt.Errorf("invalid count value for %q in state: %s", prefix, err) + } + if count != len(etys) { + return cty.DynamicVal, fmt.Errorf("wrong number of values for %q in state: got %d, but need %d", prefix, count, len(etys)) + } + + vals = make([]cty.Value, len(etys)) + for i, ety := range etys { + key := prefix + strconv.Itoa(i) + val, err := hcl2ValueFromFlatmapValue(m, key, ety) + if err != nil { + return cty.DynamicVal, err + } + vals[i] = val + } + return cty.TupleVal(vals), nil +} + +func hcl2ValueFromFlatmapMap(m map[string]string, prefix string, ty cty.Type) (cty.Value, error) { + vals := make(map[string]cty.Value) + ety := ty.ElementType() + + // if the container is unknown, there is no count string + listName := strings.TrimRight(prefix, ".") + if m[listName] == UnknownVariableValue { + return cty.UnknownVal(ty), nil + } + + // We actually don't really care about the "count" of a map for our + // purposes here, but we do need to check if it _exists_ in order to + // recognize the difference between null (not set at all) and empty. + if strCount, exists := m[prefix+"%"]; !exists { + return cty.NullVal(ty), nil + } else if strCount == UnknownVariableValue { + return cty.UnknownVal(ty), nil + } + + for fullKey := range m { + if !strings.HasPrefix(fullKey, prefix) { + continue + } + + // The flatmap format doesn't allow us to distinguish between keys + // that contain periods and nested objects, so by convention a + // map is only ever of primitive type in flatmap, and we just assume + // that the remainder of the raw key (dots and all) is the key we + // want in the result value. + key := fullKey[len(prefix):] + if key == "%" { + // Ignore the "count" key + continue + } + + val, err := hcl2ValueFromFlatmapValue(m, fullKey, ety) + if err != nil { + return cty.DynamicVal, err + } + vals[key] = val + } + + if len(vals) == 0 { + return cty.MapValEmpty(ety), nil + } + return cty.MapVal(vals), nil +} + +func hcl2ValueFromFlatmapList(m map[string]string, prefix string, ty cty.Type) (cty.Value, error) { + var vals []cty.Value + + // if the container is unknown, there is no count string + listName := strings.TrimRight(prefix, ".") + if m[listName] == UnknownVariableValue { + return cty.UnknownVal(ty), nil + } + + countStr, exists := m[prefix+"#"] + if !exists { + return cty.NullVal(ty), nil + } + if countStr == UnknownVariableValue { + return cty.UnknownVal(ty), nil + } + + count, err := strconv.Atoi(countStr) + if err != nil { + return cty.DynamicVal, fmt.Errorf("invalid count value for %q in state: %s", prefix, err) + } + + ety := ty.ElementType() + if count == 0 { + return cty.ListValEmpty(ety), nil + } + + vals = make([]cty.Value, count) + for i := 0; i < count; i++ { + key := prefix + strconv.Itoa(i) + val, err := hcl2ValueFromFlatmapValue(m, key, ety) + if err != nil { + return cty.DynamicVal, err + } + vals[i] = val + } + + return cty.ListVal(vals), nil +} + +func hcl2ValueFromFlatmapSet(m map[string]string, prefix string, ty cty.Type) (cty.Value, error) { + var vals []cty.Value + ety := ty.ElementType() + + // if the container is unknown, there is no count string + listName := strings.TrimRight(prefix, ".") + if m[listName] == UnknownVariableValue { + return cty.UnknownVal(ty), nil + } + + strCount, exists := m[prefix+"#"] + if !exists { + return cty.NullVal(ty), nil + } else if strCount == UnknownVariableValue { + return cty.UnknownVal(ty), nil + } + + // Keep track of keys we've seen, se we don't add the same set value + // multiple times. The cty.Set will normally de-duplicate values, but we may + // have unknown values that would not show as equivalent. + seen := map[string]bool{} + + for fullKey := range m { + if !strings.HasPrefix(fullKey, prefix) { + continue + } + subKey := fullKey[len(prefix):] + if subKey == "#" { + // Ignore the "count" key + continue + } + key := fullKey + if dot := strings.IndexByte(subKey, '.'); dot != -1 { + key = fullKey[:dot+len(prefix)] + } + + if seen[key] { + continue + } + + seen[key] = true + + // The flatmap format doesn't allow us to distinguish between keys + // that contain periods and nested objects, so by convention a + // map is only ever of primitive type in flatmap, and we just assume + // that the remainder of the raw key (dots and all) is the key we + // want in the result value. + + val, err := hcl2ValueFromFlatmapValue(m, key, ety) + if err != nil { + return cty.DynamicVal, err + } + vals = append(vals, val) + } + + if len(vals) == 0 && strCount == "1" { + // An empty set wouldn't be represented in the flatmap, so this must be + // a single empty object since the count is actually 1. + // Add an appropriately typed null value to the set. + var val cty.Value + switch { + case ety.IsMapType(): + val = cty.MapValEmpty(ety) + case ety.IsListType(): + val = cty.ListValEmpty(ety) + case ety.IsSetType(): + val = cty.SetValEmpty(ety) + case ety.IsObjectType(): + // TODO: cty.ObjectValEmpty + objectMap := map[string]cty.Value{} + for attr, ty := range ety.AttributeTypes() { + objectMap[attr] = cty.NullVal(ty) + } + val = cty.ObjectVal(objectMap) + default: + val = cty.NullVal(ety) + } + vals = append(vals, val) + + } else if len(vals) == 0 { + return cty.SetValEmpty(ety), nil + } + + return cty.SetVal(vals), nil +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim/paths.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim/paths.go new file mode 100644 index 000000000000..628a8bf68680 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim/paths.go @@ -0,0 +1,279 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package hcl2shim + +import ( + "fmt" + "reflect" + "strconv" + "strings" + + "github.com/hashicorp/go-cty/cty" +) + +// RequiresReplace takes a list of flatmapped paths from a +// InstanceDiff.Attributes along with the corresponding cty.Type, and returns +// the list of the cty.Paths that are flagged as causing the resource +// replacement (RequiresNew). +// This will filter out redundant paths, paths that refer to flatmapped indexes +// (e.g. "#", "%"), and will return any changes within a set as the path to the +// set itself. +func RequiresReplace(attrs []string, ty cty.Type) ([]cty.Path, error) { + var paths []cty.Path + + for _, attr := range attrs { + p, err := requiresReplacePath(attr, ty) + if err != nil { + return nil, err + } + + paths = append(paths, p) + } + + // now trim off any trailing paths that aren't GetAttrSteps, since only an + // attribute itself can require replacement + paths = trimPaths(paths) + + // There may be redundant paths due to set elements or index attributes + // Do some ugly n^2 filtering, but these are always fairly small sets. + for i := 0; i < len(paths)-1; i++ { + for j := i + 1; j < len(paths); j++ { + if reflect.DeepEqual(paths[i], paths[j]) { + // swap the tail and slice it off + paths[j], paths[len(paths)-1] = paths[len(paths)-1], paths[j] + paths = paths[:len(paths)-1] + j-- + } + } + } + + return paths, nil +} + +// trimPaths removes any trailing steps that aren't of type GetAttrSet, since +// only an attribute itself can require replacement +func trimPaths(paths []cty.Path) []cty.Path { + var trimmed []cty.Path + for _, path := range paths { + path = trimPath(path) + if len(path) > 0 { + trimmed = append(trimmed, path) + } + } + return trimmed +} + +func trimPath(path cty.Path) cty.Path { + for len(path) > 0 { + _, isGetAttr := path[len(path)-1].(cty.GetAttrStep) + if isGetAttr { + break + } + path = path[:len(path)-1] + } + return path +} + +// requiresReplacePath takes a key from a flatmap along with the cty.Type +// describing the structure, and returns the cty.Path that would be used to +// reference the nested value in the data structure. +// This is used specifically to record the RequiresReplace attributes from a +// ResourceInstanceDiff. +func requiresReplacePath(k string, ty cty.Type) (cty.Path, error) { + if k == "" { + return nil, nil + } + if !ty.IsObjectType() { + panic(fmt.Sprintf("requires replace path on non-object type: %#v", ty)) + } + + path, err := pathFromFlatmapKeyObject(k, ty.AttributeTypes()) + if err != nil { + return path, fmt.Errorf("[%s] %s", k, err) + } + return path, nil +} + +func pathSplit(p string) (string, string) { + parts := strings.SplitN(p, ".", 2) + head := parts[0] + rest := "" + if len(parts) > 1 { + rest = parts[1] + } + return head, rest +} + +func pathFromFlatmapKeyObject(key string, atys map[string]cty.Type) (cty.Path, error) { + k, rest := pathSplit(key) + + path := cty.Path{cty.GetAttrStep{Name: k}} + + ty, ok := atys[k] + if !ok { + return path, fmt.Errorf("attribute %q not found", k) + } + + if rest == "" { + return path, nil + } + + p, err := pathFromFlatmapKeyValue(rest, ty) + if err != nil { + return path, err + } + + return append(path, p...), nil +} + +func pathFromFlatmapKeyValue(key string, ty cty.Type) (cty.Path, error) { + var path cty.Path + var err error + + switch { + case ty.IsPrimitiveType(): + err = fmt.Errorf("invalid step %q with type %#v", key, ty) + case ty.IsObjectType(): + path, err = pathFromFlatmapKeyObject(key, ty.AttributeTypes()) + case ty.IsTupleType(): + path, err = pathFromFlatmapKeyTuple(key, ty.TupleElementTypes()) + case ty.IsMapType(): + path, err = pathFromFlatmapKeyMap(key, ty) + case ty.IsListType(): + path, err = pathFromFlatmapKeyList(key, ty) + case ty.IsSetType(): + path, err = pathFromFlatmapKeySet(key, ty) + default: + err = fmt.Errorf("unrecognized type: %s", ty.FriendlyName()) + } + + if err != nil { + return path, err + } + + return path, nil +} + +func pathFromFlatmapKeyTuple(key string, etys []cty.Type) (cty.Path, error) { + var path cty.Path + var err error + + k, rest := pathSplit(key) + + // we don't need to convert the index keys to paths + if k == "#" { + return path, nil + } + + idx, err := strconv.Atoi(k) + if err != nil { + return path, err + } + + path = cty.Path{cty.IndexStep{Key: cty.NumberIntVal(int64(idx))}} + + if idx >= len(etys) { + return path, fmt.Errorf("index %s out of range in %#v", key, etys) + } + + if rest == "" { + return path, nil + } + + ty := etys[idx] + + p, err := pathFromFlatmapKeyValue(rest, ty.ElementType()) + if err != nil { + return path, err + } + + return append(path, p...), nil +} + +func pathFromFlatmapKeyMap(key string, ty cty.Type) (cty.Path, error) { + var path cty.Path + var err error + + k, rest := key, "" + if !ty.ElementType().IsPrimitiveType() { + k, rest = pathSplit(key) + } + + // we don't need to convert the index keys to paths + if k == "%" { + return path, nil + } + + path = cty.Path{cty.IndexStep{Key: cty.StringVal(k)}} + + if rest == "" { + return path, nil + } + + p, err := pathFromFlatmapKeyValue(rest, ty.ElementType()) + if err != nil { + return path, err + } + + return append(path, p...), nil +} + +func pathFromFlatmapKeyList(key string, ty cty.Type) (cty.Path, error) { + var path cty.Path + var err error + + k, rest := pathSplit(key) + + // we don't need to convert the index keys to paths + if key == "#" { + return path, nil + } + + idx, err := strconv.Atoi(k) + if err != nil { + return path, err + } + + path = cty.Path{cty.IndexStep{Key: cty.NumberIntVal(int64(idx))}} + + if rest == "" { + return path, nil + } + + p, err := pathFromFlatmapKeyValue(rest, ty.ElementType()) + if err != nil { + return path, err + } + + return append(path, p...), nil +} + +func pathFromFlatmapKeySet(key string, ty cty.Type) (cty.Path, error) { + // once we hit a set, we can't return consistent paths, so just mark the + // set as a whole changed. + return nil, nil +} + +// FlatmapKeyFromPath returns the flatmap equivalent of the given cty.Path for +// use in generating legacy style diffs. +func FlatmapKeyFromPath(path cty.Path) string { + var parts []string + + for _, step := range path { + switch step := step.(type) { + case cty.GetAttrStep: + parts = append(parts, step.Name) + case cty.IndexStep: + switch ty := step.Key.Type(); { + case ty == cty.String: + parts = append(parts, step.Key.AsString()) + case ty == cty.Number: + i, _ := step.Key.AsBigFloat().Int64() + parts = append(parts, strconv.Itoa(int(i))) + } + } + } + + return strings.Join(parts, ".") +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim/values.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim/values.go new file mode 100644 index 000000000000..191f1bc75307 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim/values.go @@ -0,0 +1,233 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package hcl2shim + +import ( + "fmt" + "math/big" + + "github.com/hashicorp/go-cty/cty" + + "github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema" +) + +// UnknownVariableValue is a sentinel value that can be used +// to denote that the value of a variable is unknown at this time. +// RawConfig uses this information to build up data about +// unknown keys. +const UnknownVariableValue = "74D93920-ED26-11E3-AC10-0800200C9A66" + +// ConfigValueFromHCL2Block is like ConfigValueFromHCL2 but it works only for +// known object values and uses the provided block schema to perform some +// additional normalization to better mimic the shape of value that the old +// HCL1/HIL-based codepaths would've produced. +// +// In particular, it discards the collections that we use to represent nested +// blocks (other than NestingSingle) if they are empty, which better mimics +// the HCL1 behavior because HCL1 had no knowledge of the schema and so didn't +// know that an unspecified block _could_ exist. +// +// The given object value must conform to the schema's implied type or this +// function will panic or produce incorrect results. +// +// This is primarily useful for the final transition from new-style values to +// terraform.ResourceConfig before calling to a legacy provider, since +// helper/schema (the old provider SDK) is particularly sensitive to these +// subtle differences within its validation code. +func ConfigValueFromHCL2Block(v cty.Value, schema *configschema.Block) map[string]interface{} { + if v.IsNull() { + return nil + } + if !v.IsKnown() { + panic("ConfigValueFromHCL2Block used with unknown value") + } + if !v.Type().IsObjectType() { + panic(fmt.Sprintf("ConfigValueFromHCL2Block used with non-object value %#v", v)) + } + + atys := v.Type().AttributeTypes() + ret := make(map[string]interface{}) + + for name := range schema.Attributes { + if _, exists := atys[name]; !exists { + continue + } + + av := v.GetAttr(name) + if av.IsNull() { + // Skip nulls altogether, to better mimic how HCL1 would behave + continue + } + ret[name] = ConfigValueFromHCL2(av) + } + + for name, blockS := range schema.BlockTypes { + if _, exists := atys[name]; !exists { + continue + } + bv := v.GetAttr(name) + if !bv.IsKnown() { + ret[name] = UnknownVariableValue + continue + } + if bv.IsNull() { + continue + } + + switch blockS.Nesting { + + case configschema.NestingSingle, configschema.NestingGroup: + ret[name] = ConfigValueFromHCL2Block(bv, &blockS.Block) + + case configschema.NestingList, configschema.NestingSet: + l := bv.LengthInt() + if l == 0 { + // skip empty collections to better mimic how HCL1 would behave + continue + } + + elems := make([]interface{}, 0, l) + for it := bv.ElementIterator(); it.Next(); { + _, ev := it.Element() + if !ev.IsKnown() { + elems = append(elems, UnknownVariableValue) + continue + } + elems = append(elems, ConfigValueFromHCL2Block(ev, &blockS.Block)) + } + ret[name] = elems + + case configschema.NestingMap: + if bv.LengthInt() == 0 { + // skip empty collections to better mimic how HCL1 would behave + continue + } + + elems := make(map[string]interface{}) + for it := bv.ElementIterator(); it.Next(); { + ek, ev := it.Element() + if !ev.IsKnown() { + elems[ek.AsString()] = UnknownVariableValue + continue + } + elems[ek.AsString()] = ConfigValueFromHCL2Block(ev, &blockS.Block) + } + ret[name] = elems + } + } + + return ret +} + +// ConfigValueFromHCL2 converts a value from HCL2 (really, from the cty dynamic +// types library that HCL2 uses) to a value type that matches what would've +// been produced from the HCL-based interpolator for an equivalent structure. +// +// This function will transform a cty null value into a Go nil value, which +// isn't a possible outcome of the HCL/HIL-based decoder and so callers may +// need to detect and reject any null values. +func ConfigValueFromHCL2(v cty.Value) interface{} { + if !v.IsKnown() { + return UnknownVariableValue + } + if v.IsNull() { + return nil + } + + switch v.Type() { + case cty.Bool: + return v.True() // like HCL.BOOL + case cty.String: + return v.AsString() // like HCL token.STRING or token.HEREDOC + case cty.Number: + // We can't match HCL _exactly_ here because it distinguishes between + // int and float values, but we'll get as close as we can by using + // an int if the number is exactly representable, and a float if not. + // The conversion to float will force precision to that of a float64, + // which is potentially losing information from the specific number + // given, but no worse than what HCL would've done in its own conversion + // to float. + + f := v.AsBigFloat() + if i, acc := f.Int64(); acc == big.Exact { + // if we're on a 32-bit system and the number is too big for 32-bit + // int then we'll fall through here and use a float64. + const MaxInt = int(^uint(0) >> 1) + const MinInt = -MaxInt - 1 + if i <= int64(MaxInt) && i >= int64(MinInt) { + return int(i) // Like HCL token.NUMBER + } + } + + f64, _ := f.Float64() + return f64 // like HCL token.FLOAT + } + + if v.Type().IsListType() || v.Type().IsSetType() || v.Type().IsTupleType() { + l := make([]interface{}, 0, v.LengthInt()) + it := v.ElementIterator() + for it.Next() { + _, ev := it.Element() + l = append(l, ConfigValueFromHCL2(ev)) + } + return l + } + + if v.Type().IsMapType() || v.Type().IsObjectType() { + l := make(map[string]interface{}) + it := v.ElementIterator() + for it.Next() { + ek, ev := it.Element() + cv := ConfigValueFromHCL2(ev) + if cv != nil { + l[ek.AsString()] = cv + } + } + return l + } + + // If we fall out here then we have some weird type that we haven't + // accounted for. This should never happen unless the caller is using + // capsule types, and we don't currently have any such types defined. + panic(fmt.Errorf("can't convert %#v to config value", v)) +} + +// HCL2ValueFromConfigValue is the opposite of configValueFromHCL2: it takes +// a value as would be returned from the old interpolator and turns it into +// a cty.Value so it can be used within, for example, an HCL2 EvalContext. +func HCL2ValueFromConfigValue(v interface{}) cty.Value { + if v == nil { + return cty.NullVal(cty.DynamicPseudoType) + } + if v == UnknownVariableValue { + return cty.DynamicVal + } + + switch tv := v.(type) { + case bool: + return cty.BoolVal(tv) + case string: + return cty.StringVal(tv) + case int: + return cty.NumberIntVal(int64(tv)) + case float64: + return cty.NumberFloatVal(tv) + case []interface{}: + vals := make([]cty.Value, len(tv)) + for i, ev := range tv { + vals[i] = HCL2ValueFromConfigValue(ev) + } + return cty.TupleVal(vals) + case map[string]interface{}: + vals := map[string]cty.Value{} + for k, ev := range tv { + vals[k] = HCL2ValueFromConfigValue(ev) + } + return cty.ObjectVal(vals) + default: + // HCL/HIL should never generate anything that isn't caught by + // the above, so if we get here something has gone very wrong. + panic(fmt.Errorf("can't convert %#v to cty.Value", v)) + } +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim/values_equiv.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim/values_equiv.go new file mode 100644 index 000000000000..6b2be2239d34 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim/values_equiv.go @@ -0,0 +1,217 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package hcl2shim + +import ( + "github.com/hashicorp/go-cty/cty" +) + +// ValuesSDKEquivalent returns true if both of the given values seem equivalent +// as far as the legacy SDK diffing code would be concerned. +// +// Since SDK diffing is a fuzzy, inexact operation, this function is also +// fuzzy and inexact. It will err on the side of returning false if it +// encounters an ambiguous situation. Ambiguity is most common in the presence +// of sets because in practice it is impossible to exactly correlate +// nonequal-but-equivalent set elements because they have no identity separate +// from their value. +// +// This must be used _only_ for comparing values for equivalence within the +// SDK planning code. It is only meaningful to compare the "prior state" +// provided by Terraform Core with the "planned new state" produced by the +// legacy SDK code via shims. In particular it is not valid to use this +// function with their the config value or the "proposed new state" value +// because they contain only the subset of data that Terraform Core itself is +// able to determine. +func ValuesSDKEquivalent(a, b cty.Value) bool { + if a == cty.NilVal || b == cty.NilVal { + // We don't generally expect nils to appear, but we'll allow them + // for robustness since the data structures produced by legacy SDK code + // can sometimes be non-ideal. + return a == b // equivalent if they are _both_ nil + } + if a.RawEquals(b) { + // Easy case. We use RawEquals because we want two unknowns to be + // considered equal here, whereas "Equals" would return unknown. + return true + } + if !a.IsKnown() || !b.IsKnown() { + // Two unknown values are equivalent regardless of type. A known is + // never equivalent to an unknown. + return a.IsKnown() == b.IsKnown() + } + if aZero, bZero := valuesSDKEquivalentIsNullOrZero(a), valuesSDKEquivalentIsNullOrZero(b); aZero || bZero { + // Two null/zero values are equivalent regardless of type. A non-zero is + // never equivalent to a zero. + return aZero == bZero + } + + // If we get down here then we are guaranteed that both a and b are known, + // non-null values. + + aTy := a.Type() + bTy := b.Type() + switch { + case aTy.IsSetType() && bTy.IsSetType(): + return valuesSDKEquivalentSets(a, b) + case aTy.IsListType() && bTy.IsListType(): + return valuesSDKEquivalentSequences(a, b) + case aTy.IsTupleType() && bTy.IsTupleType(): + return valuesSDKEquivalentSequences(a, b) + case aTy.IsMapType() && bTy.IsMapType(): + return valuesSDKEquivalentMappings(a, b) + case aTy.IsObjectType() && bTy.IsObjectType(): + return valuesSDKEquivalentMappings(a, b) + case aTy == cty.Number && bTy == cty.Number: + return valuesSDKEquivalentNumbers(a, b) + default: + // We've now covered all the interesting cases, so anything that falls + // down here cannot be equivalent. + return false + } +} + +// valuesSDKEquivalentIsNullOrZero returns true if the given value is either +// null or is the "zero value" (in the SDK/Go sense) for its type. +func valuesSDKEquivalentIsNullOrZero(v cty.Value) bool { + if v == cty.NilVal { + return true + } + + ty := v.Type() + switch { + case !v.IsKnown(): + return false + case v.IsNull(): + return true + + // After this point, v is always known and non-null + case ty.IsListType() || ty.IsSetType() || ty.IsMapType() || ty.IsObjectType() || ty.IsTupleType(): + return v.LengthInt() == 0 + case ty == cty.String: + return v.RawEquals(cty.StringVal("")) + case ty == cty.Number: + return v.RawEquals(cty.Zero) + case ty == cty.Bool: + return v.RawEquals(cty.False) + default: + // The above is exhaustive, but for robustness we'll consider anything + // else to _not_ be zero unless it is null. + return false + } +} + +// valuesSDKEquivalentSets returns true only if each of the elements in a can +// be correlated with at least one equivalent element in b and vice-versa. +// This is a fuzzy operation that prefers to signal non-equivalence if it cannot +// be certain that all elements are accounted for. +func valuesSDKEquivalentSets(a, b cty.Value) bool { + if aLen, bLen := a.LengthInt(), b.LengthInt(); aLen != bLen { + return false + } + + // Our methodology here is a little tricky, to deal with the fact that + // it's impossible to directly correlate two non-equal set elements because + // they don't have identities separate from their values. + // The approach is to count the number of equivalent elements each element + // of a has in b and vice-versa, and then return true only if each element + // in both sets has at least one equivalent. + as := a.AsValueSlice() + bs := b.AsValueSlice() + aeqs := make([]bool, len(as)) + beqs := make([]bool, len(bs)) + for ai, av := range as { + for bi, bv := range bs { + if ValuesSDKEquivalent(av, bv) { + aeqs[ai] = true + beqs[bi] = true + } + } + } + + for _, eq := range aeqs { + if !eq { + return false + } + } + for _, eq := range beqs { + if !eq { + return false + } + } + return true +} + +// valuesSDKEquivalentSequences decides equivalence for two sequence values +// (lists or tuples). +func valuesSDKEquivalentSequences(a, b cty.Value) bool { + as := a.AsValueSlice() + bs := b.AsValueSlice() + if len(as) != len(bs) { + return false + } + + for i := range as { + if !ValuesSDKEquivalent(as[i], bs[i]) { + return false + } + } + return true +} + +// valuesSDKEquivalentMappings decides equivalence for two mapping values +// (maps or objects). +func valuesSDKEquivalentMappings(a, b cty.Value) bool { + as := a.AsValueMap() + bs := b.AsValueMap() + if len(as) != len(bs) { + return false + } + + for k, av := range as { + bv, ok := bs[k] + if !ok { + return false + } + if !ValuesSDKEquivalent(av, bv) { + return false + } + } + return true +} + +// valuesSDKEquivalentNumbers decides equivalence for two number values based +// on the fact that the SDK uses int and float64 representations while +// cty (and thus Terraform Core) uses big.Float, and so we expect to lose +// precision in the round-trip. +// +// This does _not_ attempt to allow for an epsilon difference that may be +// caused by accumulated innacuracy in a float calculation, under the +// expectation that providers generally do not actually do compuations on +// floats and instead just pass string representations of them on verbatim +// to remote APIs. A remote API _itself_ may introduce inaccuracy, but that's +// a problem for the provider itself to deal with, based on its knowledge of +// the remote system, e.g. using DiffSuppressFunc. +func valuesSDKEquivalentNumbers(a, b cty.Value) bool { + if a.RawEquals(b) { + return true // easy + } + + af := a.AsBigFloat() + bf := b.AsBigFloat() + + if af.IsInt() != bf.IsInt() { + return false + } + if af.IsInt() && bf.IsInt() { + return false // a.RawEquals(b) test above is good enough for integers + } + + // The SDK supports only int and float64, so if it's not an integer + // we know that only a float64-level of precision can possibly be + // significant. + af64, _ := af.Float64() + bf64, _ := bf.Float64() + return af64 == bf64 +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/logging/context.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/logging/context.go new file mode 100644 index 000000000000..0fe8002aa7a8 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/logging/context.go @@ -0,0 +1,78 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package logging + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-log/tfsdklog" + helperlogging "github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging" + testing "github.com/mitchellh/go-testing-interface" +) + +// InitContext creates SDK logger contexts when the provider is running in +// "production" (not under acceptance testing). The incoming context will +// already have the root SDK logger and root provider logger setup from +// terraform-plugin-go tf5server RPC handlers. +func InitContext(ctx context.Context) context.Context { + ctx = tfsdklog.NewSubsystem(ctx, SubsystemHelperSchema, + // All calls are through the HelperSchema* helper functions + tfsdklog.WithAdditionalLocationOffset(1), + tfsdklog.WithLevelFromEnv(EnvTfLogSdkHelperSchema), + // Propagate tf_req_id, tf_rpc, etc. fields + tfsdklog.WithRootFields(), + ) + + return ctx +} + +// InitTestContext registers the terraform-plugin-log/tfsdklog test sink, +// configures the standard library log package, and creates SDK logger +// contexts. The incoming context is expected to be devoid of logging setup. +// +// The standard library log package handling is important as provider code +// under test may be using that package or another logging library outside of +// terraform-plugin-log. +func InitTestContext(ctx context.Context, t testing.T) context.Context { + helperlogging.SetOutput(t) + + ctx = tfsdklog.RegisterTestSink(ctx, t) + ctx = tfsdklog.NewRootSDKLogger(ctx, tfsdklog.WithLevelFromEnv(EnvTfLogSdk)) + ctx = tfsdklog.NewSubsystem(ctx, SubsystemHelperResource, + // All calls are through the HelperResource* helper functions + tfsdklog.WithAdditionalLocationOffset(1), + tfsdklog.WithLevelFromEnv(EnvTfLogSdkHelperResource), + ) + ctx = TestNameContext(ctx, t.Name()) + + return ctx +} + +// TestNameContext adds the current test name to loggers. +func TestNameContext(ctx context.Context, testName string) context.Context { + ctx = tfsdklog.SubsystemSetField(ctx, SubsystemHelperResource, KeyTestName, testName) + + return ctx +} + +// TestStepNumberContext adds the current test step number to loggers. +func TestStepNumberContext(ctx context.Context, stepNumber int) context.Context { + ctx = tfsdklog.SubsystemSetField(ctx, SubsystemHelperResource, KeyTestStepNumber, stepNumber) + + return ctx +} + +// TestTerraformPathContext adds the current test Terraform CLI path to loggers. +func TestTerraformPathContext(ctx context.Context, terraformPath string) context.Context { + ctx = tfsdklog.SubsystemSetField(ctx, SubsystemHelperResource, KeyTestTerraformPath, terraformPath) + + return ctx +} + +// TestWorkingDirectoryContext adds the current test working directory to loggers. +func TestWorkingDirectoryContext(ctx context.Context, workingDirectory string) context.Context { + ctx = tfsdklog.SubsystemSetField(ctx, SubsystemHelperResource, KeyTestWorkingDirectory, workingDirectory) + + return ctx +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/logging/environment_variables.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/logging/environment_variables.go new file mode 100644 index 000000000000..2ffc73eee6cb --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/logging/environment_variables.go @@ -0,0 +1,27 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package logging + +// Environment variables. +const ( + // EnvTfLogSdk is an environment variable that sets the logging level of + // the root SDK logger, while the provider is under test. In "production" + // usage, this environment variable is handled by terraform-plugin-go. + // + // Terraform CLI's logging must be explicitly turned on before this + // environment varable can be used to reduce the SDK logging levels. It + // cannot be used to show only SDK logging unless all other logging levels + // are turned off. + EnvTfLogSdk = "TF_LOG_SDK" + + // EnvTfLogSdkHelperResource is an environment variable that sets the logging + // level of SDK helper/resource loggers. Infers root SDK logging level, if + // unset. + EnvTfLogSdkHelperResource = "TF_LOG_SDK_HELPER_RESOURCE" + + // EnvTfLogSdkHelperSchema is an environment variable that sets the logging + // level of SDK helper/schema loggers. Infers root SDK logging level, if + // unset. + EnvTfLogSdkHelperSchema = "TF_LOG_SDK_HELPER_SCHEMA" +) diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/logging/helper_resource.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/logging/helper_resource.go new file mode 100644 index 000000000000..1b1459f24612 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/logging/helper_resource.go @@ -0,0 +1,35 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package logging + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-log/tfsdklog" +) + +const ( + // SubsystemHelperResource is the tfsdklog subsystem name for helper/resource. + SubsystemHelperResource = "helper_resource" +) + +// HelperResourceTrace emits a helper/resource subsystem log at TRACE level. +func HelperResourceTrace(ctx context.Context, msg string, additionalFields ...map[string]interface{}) { + tfsdklog.SubsystemTrace(ctx, SubsystemHelperResource, msg, additionalFields...) +} + +// HelperResourceDebug emits a helper/resource subsystem log at DEBUG level. +func HelperResourceDebug(ctx context.Context, msg string, additionalFields ...map[string]interface{}) { + tfsdklog.SubsystemDebug(ctx, SubsystemHelperResource, msg, additionalFields...) +} + +// HelperResourceWarn emits a helper/resource subsystem log at WARN level. +func HelperResourceWarn(ctx context.Context, msg string, additionalFields ...map[string]interface{}) { + tfsdklog.SubsystemWarn(ctx, SubsystemHelperResource, msg, additionalFields...) +} + +// HelperResourceError emits a helper/resource subsystem log at ERROR level. +func HelperResourceError(ctx context.Context, msg string, additionalFields ...map[string]interface{}) { + tfsdklog.SubsystemError(ctx, SubsystemHelperResource, msg, additionalFields...) +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/logging/helper_schema.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/logging/helper_schema.go new file mode 100644 index 000000000000..0ecf6bf2e48c --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/logging/helper_schema.go @@ -0,0 +1,35 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package logging + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-log/tfsdklog" +) + +const ( + // SubsystemHelperSchema is the tfsdklog subsystem name for helper/schema. + SubsystemHelperSchema = "helper_schema" +) + +// HelperSchemaDebug emits a helper/schema subsystem log at DEBUG level. +func HelperSchemaDebug(ctx context.Context, msg string, additionalFields ...map[string]interface{}) { + tfsdklog.SubsystemDebug(ctx, SubsystemHelperSchema, msg, additionalFields...) +} + +// HelperSchemaError emits a helper/schema subsystem log at ERROR level. +func HelperSchemaError(ctx context.Context, msg string, additionalFields ...map[string]interface{}) { + tfsdklog.SubsystemError(ctx, SubsystemHelperSchema, msg, additionalFields...) +} + +// HelperSchemaTrace emits a helper/schema subsystem log at TRACE level. +func HelperSchemaTrace(ctx context.Context, msg string, additionalFields ...map[string]interface{}) { + tfsdklog.SubsystemTrace(ctx, SubsystemHelperSchema, msg, additionalFields...) +} + +// HelperSchemaWarn emits a helper/schema subsystem log at WARN level. +func HelperSchemaWarn(ctx context.Context, msg string, additionalFields ...map[string]interface{}) { + tfsdklog.SubsystemWarn(ctx, SubsystemHelperSchema, msg, additionalFields...) +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/logging/keys.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/logging/keys.go new file mode 100644 index 000000000000..983fde437a29 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/logging/keys.go @@ -0,0 +1,63 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package logging + +// Structured logging keys. +// +// Practitioners or tooling reading logs may be depending on these keys, so be +// conscious of that when changing them. +// +// Refer to the terraform-plugin-go logging keys as well, which should be +// equivalent to these when possible. +const ( + // Attribute path representation, which is typically in flatmap form such + // as parent.0.child in this project. + KeyAttributePath = "tf_attribute_path" + + // The type of data source being operated on, such as "archive_file" + KeyDataSourceType = "tf_data_source_type" + + // Underlying Go error string when logging an error. + KeyError = "error" + + // The full address of the provider, such as + // registry.terraform.io/hashicorp/random + KeyProviderAddress = "tf_provider_addr" + + // The type of resource being operated on, such as "random_pet" + KeyResourceType = "tf_resource_type" + + // The name of the test being executed. + KeyTestName = "test_name" + + // The TestStep number of the test being executed. Starts at 1. + KeyTestStepNumber = "test_step_number" + + // Terraform configuration used during acceptance testing Terraform operations. + KeyTestTerraformConfiguration = "test_terraform_configuration" + + // The Terraform CLI logging level (TF_LOG) used for an acceptance test. + KeyTestTerraformLogLevel = "test_terraform_log_level" + + // The Terraform CLI logging level (TF_LOG_CORE) used for an acceptance test. + KeyTestTerraformLogCoreLevel = "test_terraform_log_core_level" + + // The Terraform CLI logging level (TF_LOG_PROVIDER) used for an acceptance test. + KeyTestTerraformLogProviderLevel = "test_terraform_log_provider_level" + + // The path to the Terraform CLI logging file used for an acceptance test. + // + // This should match where the rest of the acceptance test logs are going + // already, but is provided for troubleshooting in case it does not. + KeyTestTerraformLogPath = "test_terraform_log_path" + + // The path to the Terraform CLI used for an acceptance test. + KeyTestTerraformPath = "test_terraform_path" + + // Terraform plan output generated during a TestStep. + KeyTestTerraformPlan = "test_terraform_plan" + + // The working directory of the acceptance test. + KeyTestWorkingDirectory = "test_working_directory" +) diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/config.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/config.go new file mode 100644 index 000000000000..b63a55e4ed5c --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/config.go @@ -0,0 +1,96 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package plugintest + +import ( + "context" + "fmt" + "os" + "strings" + + "github.com/hashicorp/go-version" + install "github.com/hashicorp/hc-install" + "github.com/hashicorp/hc-install/checkpoint" + "github.com/hashicorp/hc-install/fs" + "github.com/hashicorp/hc-install/product" + "github.com/hashicorp/hc-install/releases" + "github.com/hashicorp/hc-install/src" + + "github.com/hashicorp/terraform-plugin-testing/internal/logging" +) + +// Config is used to configure the test helper. In most normal test programs +// the configuration is discovered automatically by an Init* function using +// DiscoverConfig, but this is exposed so that more complex scenarios can be +// implemented by direct configuration. +type Config struct { + SourceDir string + TerraformExec string + execTempDir string + PreviousPluginExec string +} + +// DiscoverConfig uses environment variables and other means to automatically +// discover a reasonable test helper configuration. +func DiscoverConfig(ctx context.Context, sourceDir string) (*Config, error) { + tfVersion := strings.TrimPrefix(os.Getenv(EnvTfAccTerraformVersion), "v") + tfPath := os.Getenv(EnvTfAccTerraformPath) + + tempDir := os.Getenv(EnvTfAccTempDir) + tfDir, err := os.MkdirTemp(tempDir, "plugintest-terraform") + if err != nil { + return nil, fmt.Errorf("failed to create temp dir: %w", err) + } + + var sources []src.Source + switch { + case tfPath != "": + logging.HelperResourceTrace(ctx, fmt.Sprintf("Adding potential Terraform CLI source of exact path: %s", tfPath)) + + sources = append(sources, &fs.AnyVersion{ + ExactBinPath: tfPath, + }) + case tfVersion != "": + tfVersion, err := version.NewVersion(tfVersion) + + if err != nil { + return nil, fmt.Errorf("invalid Terraform version: %w", err) + } + + logging.HelperResourceTrace(ctx, fmt.Sprintf("Adding potential Terraform CLI source of releases.hashicorp.com exact version %q for installation in: %s", tfVersion, tfDir)) + + sources = append(sources, &releases.ExactVersion{ + InstallDir: tfDir, + Product: product.Terraform, + Version: tfVersion, + }) + default: + logging.HelperResourceTrace(ctx, "Adding potential Terraform CLI source of local filesystem PATH lookup") + logging.HelperResourceTrace(ctx, fmt.Sprintf("Adding potential Terraform CLI source of checkpoint.hashicorp.com latest version for installation in: %s", tfDir)) + + sources = append(sources, &fs.AnyVersion{ + Product: &product.Terraform, + }) + sources = append(sources, &checkpoint.LatestVersion{ + InstallDir: tfDir, + Product: product.Terraform, + }) + } + + installer := install.NewInstaller() + tfExec, err := installer.Ensure(context.Background(), sources) + if err != nil { + return nil, fmt.Errorf("failed to find or install Terraform CLI from %+v: %w", sources, err) + } + + ctx = logging.TestTerraformPathContext(ctx, tfExec) + + logging.HelperResourceDebug(ctx, "Found Terraform CLI") + + return &Config{ + SourceDir: sourceDir, + TerraformExec: tfExec, + execTempDir: tfDir, + }, nil +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/doc.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/doc.go new file mode 100644 index 000000000000..1b34a0b233ee --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/doc.go @@ -0,0 +1,10 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Package plugintest contains utilities to help with writing tests for +// Terraform plugins. +// +// This is not a package for testing configurations or modules written in the +// Terraform language. It is for testing the plugins that allow Terraform to +// manage various cloud services and other APIs. +package plugintest diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/environment_variables.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/environment_variables.go new file mode 100644 index 000000000000..6df86f89f8c1 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/environment_variables.go @@ -0,0 +1,111 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package plugintest + +// Environment variables +const ( + // Environment variable with acceptance testing temporary directory for + // testing files and Terraform CLI installation, if installation is + // required. By default, the operating system temporary directory is used. + // + // Setting TF_ACC_TERRAFORM_PATH does not override this value for Terraform + // CLI installation, if installation is required. + EnvTfAccTempDir = "TF_ACC_TEMP_DIR" + + // Environment variable with level to filter Terraform logs during + // acceptance testing. This value sets TF_LOG in a safe manner when + // executing Terraform CLI commands, which would otherwise interfere + // with the testing framework using TF_LOG to set the Go standard library + // log package level. + // + // This value takes precedence over TF_LOG_CORE, due to precedence rules + // in the Terraform core code, so it is not possible to set this to a level + // and also TF_LOG_CORE=OFF. Use TF_LOG_CORE and TF_LOG_PROVIDER in that + // case instead. + // + // If not set, but TF_ACC_LOG_PATH or TF_LOG_PATH_MASK is set, it defaults + // to TRACE. If Terraform CLI is version 0.14 or earlier, it will have no + // separate affect from the TF_ACC_LOG_PATH or TF_LOG_PATH_MASK behavior, + // as those earlier versions of Terraform are unreliable with the logging + // level being outside TRACE. + EnvTfAccLog = "TF_ACC_LOG" + + // Environment variable with path to save Terraform logs during acceptance + // testing. This value sets TF_LOG_PATH in a safe manner when executing + // Terraform CLI commands, which would otherwise be ignored since it could + // interfere with how the underlying execution is performed. + // + // If TF_LOG_PATH_MASK is set, it takes precedence over this value. + EnvTfAccLogPath = "TF_ACC_LOG_PATH" + + // Environment variable with level to filter Terraform core logs during + // acceptance testing. This value sets TF_LOG_CORE separate from + // TF_LOG_PROVIDER when calling Terraform. + // + // This value has no affect when TF_ACC_LOG is set (which sets Terraform's + // TF_LOG), due to precedence rules in the Terraform core code. Use + // TF_LOG_CORE and TF_LOG_PROVIDER in that case instead. + // + // If not set, defaults to TF_ACC_LOG behaviors. + EnvTfLogCore = "TF_LOG_CORE" + + // Environment variable with path containing the string %s, which is + // replaced with the test name, to save separate Terraform logs during + // acceptance testing. This value sets TF_LOG_PATH in a safe manner when + // executing Terraform CLI commands, which would otherwise be ignored since + // it could interfere with how the underlying execution is performed. + // + // Takes precedence over TF_ACC_LOG_PATH. + EnvTfLogPathMask = "TF_LOG_PATH_MASK" + + // Environment variable with level to filter Terraform provider logs during + // acceptance testing. This value sets TF_LOG_PROVIDER separate from + // TF_LOG_CORE. + // + // During testing, this only affects external providers whose logging goes + // through Terraform. The logging for the provider under test is controlled + // by the testing framework as it is running the provider code. Provider + // code using the Go standard library log package is controlled by TF_LOG + // for historical compatibility. + // + // This value takes precedence over TF_ACC_LOG for external provider logs, + // due to rules in the Terraform core code. + // + // If not set, defaults to TF_ACC_LOG behaviors. + EnvTfLogProvider = "TF_LOG_PROVIDER" + + // Environment variable with acceptance testing Terraform CLI version to + // download from releases.hashicorp.com, checksum verify, and install. The + // value can be any valid Terraform CLI version, such as 1.1.6, with or + // without a prepended v character. + // + // Setting this value takes precedence over using an available Terraform + // binary in the operation system PATH, or if not found, installing the + // latest version according to checkpoint.hashicorp.com. + // + // By default, the binary is installed in the operating system temporary + // directory, however that directory can be overridden with the + // TF_ACC_TEMP_DIR environment variable. + // + // If TF_ACC_TERRAFORM_PATH is also set, this installation method is + // only invoked when a binary does not exist at that path. No version + // checks are performed against an existing TF_ACC_TERRAFORM_PATH. + EnvTfAccTerraformVersion = "TF_ACC_TERRAFORM_VERSION" + + // Acceptance testing path to Terraform CLI binary. + // + // Setting this value takes precedence over using an available Terraform + // binary in the operation system PATH, or if not found, installing the + // latest version according to checkpoint.hashicorp.com. This value does + // not override TF_ACC_TEMP_DIR for Terraform CLI installation, if + // installation is required. + // + // If TF_ACC_TERRAFORM_VERSION is not set, the binary must exist and be + // executable, or an error will be returned. + // + // If TF_ACC_TERRAFORM_VERSION is also set, that Terraform CLI version + // will be installed if a binary is not found at the given path. No version + // checks are performed against an existing binary. + EnvTfAccTerraformPath = "TF_ACC_TERRAFORM_PATH" +) diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/guard.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/guard.go similarity index 95% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/guard.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/guard.go index ad796be08c6b..77f87398009b 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/guard.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/guard.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package plugintest import ( diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/helper.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/helper.go similarity index 98% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/helper.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/helper.go index bfe89e1b9eac..cfc56fc8ad62 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/helper.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/helper.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package plugintest import ( @@ -8,7 +11,8 @@ import ( "strings" "github.com/hashicorp/terraform-exec/tfexec" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging" + + "github.com/hashicorp/terraform-plugin-testing/internal/logging" ) // AutoInitProviderHelper is the main entrypoint for testing provider plugins diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/util.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/util.go new file mode 100644 index 000000000000..0d4bbe526676 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/util.go @@ -0,0 +1,70 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package plugintest + +import ( + "fmt" + "os" + "path/filepath" +) + +func symlinkFile(src string, dest string) error { + err := os.Symlink(src, dest) + + if err != nil { + return fmt.Errorf("unable to symlink %q to %q: %w", src, dest, err) + } + + srcInfo, err := os.Stat(src) + + if err != nil { + return fmt.Errorf("unable to stat %q: %w", src, err) + } + + err = os.Chmod(dest, srcInfo.Mode()) + + if err != nil { + return fmt.Errorf("unable to set %q permissions: %w", dest, err) + } + + return nil +} + +// symlinkDirectoriesOnly finds only the first-level child directories in srcDir +// and symlinks them into destDir. +// Unlike symlinkDir, this is done non-recursively in order to limit the number +// of file descriptors used. +func symlinkDirectoriesOnly(srcDir string, destDir string) error { + srcInfo, err := os.Stat(srcDir) + if err != nil { + return fmt.Errorf("unable to stat source directory %q: %w", srcDir, err) + } + + err = os.MkdirAll(destDir, srcInfo.Mode()) + if err != nil { + return fmt.Errorf("unable to make destination directory %q: %w", destDir, err) + } + + dirEntries, err := os.ReadDir(srcDir) + + if err != nil { + return fmt.Errorf("unable to read source directory %q: %w", srcDir, err) + } + + for _, dirEntry := range dirEntries { + if !dirEntry.IsDir() { + continue + } + + srcPath := filepath.Join(srcDir, dirEntry.Name()) + destPath := filepath.Join(destDir, dirEntry.Name()) + err := symlinkFile(srcPath, destPath) + + if err != nil { + return fmt.Errorf("unable to symlink directory %q to %q: %w", srcPath, destPath, err) + } + } + + return nil +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/working_dir.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/working_dir.go similarity index 98% rename from vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/working_dir.go rename to vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/working_dir.go index 159399350f61..734b6c9b5513 100644 --- a/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/working_dir.go +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/plugintest/working_dir.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package plugintest import ( @@ -10,7 +13,7 @@ import ( "github.com/hashicorp/terraform-exec/tfexec" tfjson "github.com/hashicorp/terraform-json" - "github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging" + "github.com/hashicorp/terraform-plugin-testing/internal/logging" ) const ( @@ -33,9 +36,6 @@ type WorkingDir struct { // was stored; empty until SetConfig is called. configFilename string - // baseArgs is arguments that should be appended to all commands - baseArgs []string - // tf is the instance of tfexec.Terraform used for running Terraform commands tf *tfexec.Terraform diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/config_traversals.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/config_traversals.go new file mode 100644 index 000000000000..6208117cbff6 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/config_traversals.go @@ -0,0 +1,59 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package tfdiags + +import ( + "bytes" + "fmt" + "strconv" + + "github.com/hashicorp/go-cty/cty" +) + +// FormatCtyPath is a helper function to produce a user-friendly string +// representation of a cty.Path. The result uses a syntax similar to the +// HCL expression language in the hope of it being familiar to users. +func FormatCtyPath(path cty.Path) string { + var buf bytes.Buffer + for _, step := range path { + switch ts := step.(type) { + case cty.GetAttrStep: + fmt.Fprintf(&buf, ".%s", ts.Name) + case cty.IndexStep: + buf.WriteByte('[') + key := ts.Key + keyTy := key.Type() + switch { + case key.IsNull(): + buf.WriteString("null") + case !key.IsKnown(): + buf.WriteString("(not yet known)") + case keyTy == cty.Number: + bf := key.AsBigFloat() + buf.WriteString(bf.Text('g', -1)) + case keyTy == cty.String: + buf.WriteString(strconv.Quote(key.AsString())) + default: + buf.WriteString("...") + } + buf.WriteByte(']') + } + } + return buf.String() +} + +// FormatError is a helper function to produce a user-friendly string +// representation of certain special error types that we might want to +// include in diagnostic messages. +// +// This currently has special behavior only for cty.PathError, where a +// non-empty path is rendered in a HCL-like syntax as context. +func FormatError(err error) string { + perr, ok := err.(cty.PathError) + if !ok || len(perr.Path) == 0 { + return err.Error() + } + + return fmt.Sprintf("%s: %s", FormatCtyPath(perr.Path), perr.Error()) +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/contextual.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/contextual.go new file mode 100644 index 000000000000..a9b5c7e83e8f --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/contextual.go @@ -0,0 +1,84 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package tfdiags + +import ( + "github.com/hashicorp/go-cty/cty" +) + +// AttributeValue returns a diagnostic about an attribute value in an implied current +// configuration context. This should be returned only from functions whose +// interface specifies a clear configuration context that this will be +// resolved in. +// +// The given path is relative to the implied configuration context. To describe +// a top-level attribute, it should be a single-element cty.Path with a +// cty.GetAttrStep. It's assumed that the path is returning into a structure +// that would be produced by our conventions in the configschema package; it +// may return unexpected results for structures that can't be represented by +// configschema. +// +// Since mapping attribute paths back onto configuration is an imprecise +// operation (e.g. dynamic block generation may cause the same block to be +// evaluated multiple times) the diagnostic detail should include the attribute +// name and other context required to help the user understand what is being +// referenced in case the identified source range is not unique. +// +// The returned attribute will not have source location information until +// context is applied to the containing diagnostics using diags.InConfigBody. +// After context is applied, the source location is the value assigned to the +// named attribute, or the containing body's "missing item range" if no +// value is present. +func AttributeValue(severity Severity, summary, detail string, attrPath cty.Path) Diagnostic { + return &attributeDiagnostic{ + diagnosticBase: diagnosticBase{ + severity: severity, + summary: summary, + detail: detail, + }, + attrPath: attrPath, + } +} + +// GetAttribute extracts an attribute cty.Path from a diagnostic if it contains +// one. Normally this is not accessed directly, and instead the config body is +// added to the Diagnostic to create a more complete message for the user. In +// some cases however, we may want to know just the name of the attribute that +// generated the Diagnostic message. +// This returns a nil cty.Path if it does not exist in the Diagnostic. +func GetAttribute(d Diagnostic) cty.Path { + if d, ok := d.(*attributeDiagnostic); ok { + return d.attrPath + } + return nil +} + +type attributeDiagnostic struct { + diagnosticBase + attrPath cty.Path +} + +// WholeContainingBody returns a diagnostic about the body that is an implied +// current configuration context. This should be returned only from +// functions whose interface specifies a clear configuration context that this +// will be resolved in. +// +// The returned attribute will not have source location information until +// context is applied to the containing diagnostics using diags.InConfigBody. +// After context is applied, the source location is currently the missing item +// range of the body. In future, this may change to some other suitable +// part of the containing body. +func WholeContainingBody(severity Severity, summary, detail string) Diagnostic { + return &wholeBodyDiagnostic{ + diagnosticBase: diagnosticBase{ + severity: severity, + summary: summary, + detail: detail, + }, + } +} + +type wholeBodyDiagnostic struct { + diagnosticBase +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/diagnostic.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/diagnostic.go new file mode 100644 index 000000000000..547271346aab --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/diagnostic.go @@ -0,0 +1,26 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package tfdiags + +type Diagnostic interface { + Severity() Severity + Description() Description +} + +type Severity rune + +// This code was previously generated with a go:generate directive calling: +// go run golang.org/x/tools/cmd/stringer -type=Severity +// However, it is now considered frozen and the tooling dependency has been +// removed. The String method can be manually updated if necessary. + +const ( + Error Severity = 'E' + Warning Severity = 'W' +) + +type Description struct { + Summary string + Detail string +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/diagnostic_base.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/diagnostic_base.go new file mode 100644 index 000000000000..505692ce51a3 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/diagnostic_base.go @@ -0,0 +1,34 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package tfdiags + +// diagnosticBase can be embedded in other diagnostic structs to get +// default implementations of Severity and Description. This type also +// has default implementations of Source that return no source +// location or expression-related information, so embedders should generally +// override those method to return more useful results where possible. +type diagnosticBase struct { + severity Severity + summary string + detail string +} + +func (d diagnosticBase) Severity() Severity { + return d.severity +} + +func (d diagnosticBase) Description() Description { + return Description{ + Summary: d.summary, + Detail: d.detail, + } +} + +func Diag(sev Severity, summary, detail string) Diagnostic { + return &diagnosticBase{ + severity: sev, + summary: summary, + detail: detail, + } +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/diagnostics.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/diagnostics.go new file mode 100644 index 000000000000..4fc99c1bb704 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/diagnostics.go @@ -0,0 +1,196 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package tfdiags + +import ( + "bytes" + "fmt" + "sort" +) + +// Diagnostics is a list of diagnostics. Diagnostics is intended to be used +// where a Go "error" might normally be used, allowing richer information +// to be conveyed (more context, support for warnings). +// +// A nil Diagnostics is a valid, empty diagnostics list, thus allowing +// heap allocation to be avoided in the common case where there are no +// diagnostics to report at all. +type Diagnostics []Diagnostic + +// HasErrors returns true if any of the diagnostics in the list have +// a severity of Error. +func (diags Diagnostics) HasErrors() bool { + for _, diag := range diags { + if diag.Severity() == Error { + return true + } + } + return false +} + +// Err flattens a diagnostics list into a single Go error, or to nil +// if the diagnostics list does not include any error-level diagnostics. +// +// This can be used to smuggle diagnostics through an API that deals in +// native errors, but unfortunately it will lose naked warnings (warnings +// that aren't accompanied by at least one error) since such APIs have no +// mechanism through which to report these. +// +// return result, diags.Error() +func (diags Diagnostics) Err() error { + if !diags.HasErrors() { + return nil + } + return diagnosticsAsError{diags} +} + +// ErrWithWarnings is similar to Err except that it will also return a non-nil +// error if the receiver contains only warnings. +// +// In the warnings-only situation, the result is guaranteed to be of dynamic +// type NonFatalError, allowing diagnostics-aware callers to type-assert +// and unwrap it, treating it as non-fatal. +// +// This should be used only in contexts where the caller is able to recognize +// and handle NonFatalError. For normal callers that expect a lack of errors +// to be signaled by nil, use just Diagnostics.Err. +func (diags Diagnostics) ErrWithWarnings() error { + if len(diags) == 0 { + return nil + } + if diags.HasErrors() { + return diags.Err() + } + return NonFatalError{diags} +} + +// NonFatalErr is similar to Err except that it always returns either nil +// (if there are no diagnostics at all) or NonFatalError. +// +// This allows diagnostics to be returned over an error return channel while +// being explicit that the diagnostics should not halt processing. +// +// This should be used only in contexts where the caller is able to recognize +// and handle NonFatalError. For normal callers that expect a lack of errors +// to be signaled by nil, use just Diagnostics.Err. +func (diags Diagnostics) NonFatalErr() error { + if len(diags) == 0 { + return nil + } + return NonFatalError{diags} +} + +type diagnosticsAsError struct { + Diagnostics +} + +func (dae diagnosticsAsError) Error() string { + diags := dae.Diagnostics + switch { + case len(diags) == 0: + // should never happen, since we don't create this wrapper if + // there are no diagnostics in the list. + return "no errors" + case len(diags) == 1: + desc := diags[0].Description() + if desc.Detail == "" { + return desc.Summary + } + return fmt.Sprintf("%s: %s", desc.Summary, desc.Detail) + default: + var ret bytes.Buffer + fmt.Fprintf(&ret, "%d problems:\n", len(diags)) + for _, diag := range dae.Diagnostics { + desc := diag.Description() + if desc.Detail == "" { + fmt.Fprintf(&ret, "\n- %s", desc.Summary) + } else { + fmt.Fprintf(&ret, "\n- %s: %s", desc.Summary, desc.Detail) + } + } + return ret.String() + } +} + +// WrappedErrors is an implementation of errwrap.Wrapper so that an error-wrapped +// diagnostics object can be picked apart by errwrap-aware code. +func (dae diagnosticsAsError) WrappedErrors() []error { + var errs []error + for _, diag := range dae.Diagnostics { + if wrapper, isErr := diag.(nativeError); isErr { + errs = append(errs, wrapper.err) + } + } + return errs +} + +// NonFatalError is a special error type, returned by +// Diagnostics.ErrWithWarnings and Diagnostics.NonFatalErr, +// that indicates that the wrapped diagnostics should be treated as non-fatal. +// Callers can conditionally type-assert an error to this type in order to +// detect the non-fatal scenario and handle it in a different way. +type NonFatalError struct { + Diagnostics +} + +func (woe NonFatalError) Error() string { + diags := woe.Diagnostics + switch { + case len(diags) == 0: + // should never happen, since we don't create this wrapper if + // there are no diagnostics in the list. + return "no errors or warnings" + case len(diags) == 1: + desc := diags[0].Description() + if desc.Detail == "" { + return desc.Summary + } + return fmt.Sprintf("%s: %s", desc.Summary, desc.Detail) + default: + var ret bytes.Buffer + if diags.HasErrors() { + fmt.Fprintf(&ret, "%d problems:\n", len(diags)) + } else { + fmt.Fprintf(&ret, "%d warnings:\n", len(diags)) + } + for _, diag := range woe.Diagnostics { + desc := diag.Description() + if desc.Detail == "" { + fmt.Fprintf(&ret, "\n- %s", desc.Summary) + } else { + fmt.Fprintf(&ret, "\n- %s: %s", desc.Summary, desc.Detail) + } + } + return ret.String() + } +} + +// sortDiagnostics is an implementation of sort.Interface +type sortDiagnostics []Diagnostic + +var _ sort.Interface = sortDiagnostics(nil) + +func (sd sortDiagnostics) Len() int { + return len(sd) +} + +func (sd sortDiagnostics) Less(i, j int) bool { + iD, jD := sd[i], sd[j] + iSev, jSev := iD.Severity(), jD.Severity() + + switch { + case iSev != jSev: + return iSev == Warning + default: + // The remaining properties do not have a defined ordering, so + // we'll leave it unspecified. Since we use sort.Stable in + // the caller of this, the ordering of remaining items will + // be preserved. + return false + } +} + +func (sd sortDiagnostics) Swap(i, j int) { + sd[i], sd[j] = sd[j], sd[i] +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/doc.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/doc.go new file mode 100644 index 000000000000..23be0a8bece7 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/doc.go @@ -0,0 +1,19 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Package tfdiags is a utility package for representing errors and +// warnings in a manner that allows us to produce good messages for the +// user. +// +// "diag" is short for "diagnostics", and is meant as a general word for +// feedback to a user about potential or actual problems. +// +// A design goal for this package is for it to be able to provide rich +// messaging where possible but to also be pragmatic about dealing with +// generic errors produced by system components that _can't_ provide +// such rich messaging. As a consequence, the main types in this package -- +// Diagnostics and Diagnostic -- are designed so that they can be "smuggled" +// over an error channel and then be unpacked at the other end, so that +// error diagnostics (at least) can transit through APIs that are not +// aware of this package. +package tfdiags diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/error.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/error.go new file mode 100644 index 000000000000..f7c9c65d382a --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/error.go @@ -0,0 +1,27 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package tfdiags + +// nativeError is a Diagnostic implementation that wraps a normal Go error +type nativeError struct { + err error +} + +var _ Diagnostic = nativeError{} + +func (e nativeError) Severity() Severity { + return Error +} + +func (e nativeError) Description() Description { + return Description{ + Summary: FormatError(e.err), + } +} + +func FromError(err error) Diagnostic { + return &nativeError{ + err: err, + } +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/severity_string.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/severity_string.go new file mode 100644 index 000000000000..78a721068c31 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/severity_string.go @@ -0,0 +1,29 @@ +// Code generated by "stringer -type=Severity"; DO NOT EDIT. + +package tfdiags + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[Error-69] + _ = x[Warning-87] +} + +const ( + _Severity_name_0 = "Error" + _Severity_name_1 = "Warning" +) + +func (i Severity) String() string { + switch { + case i == 69: + return _Severity_name_0 + case i == 87: + return _Severity_name_1 + default: + return "Severity(" + strconv.FormatInt(int64(i), 10) + ")" + } +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/simple_warning.go b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/simple_warning.go new file mode 100644 index 000000000000..0c90c4788910 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/internal/tfdiags/simple_warning.go @@ -0,0 +1,23 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package tfdiags + +type simpleWarning string + +var _ Diagnostic = simpleWarning("") + +// SimpleWarning constructs a simple (summary-only) warning diagnostic. +func SimpleWarning(msg string) Diagnostic { + return simpleWarning(msg) +} + +func (e simpleWarning) Severity() Severity { + return Warning +} + +func (e simpleWarning) Description() Description { + return Description{ + Summary: string(e), + } +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/diff.go b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/diff.go new file mode 100644 index 000000000000..967c67944ee2 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/diff.go @@ -0,0 +1,997 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package terraform + +import ( + "fmt" + "log" + "reflect" + "regexp" + "sort" + "strconv" + "strings" + "sync" + + "github.com/hashicorp/go-cty/cty" + + "github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim" +) + +// diffChangeType is an enum with the kind of changes a diff has planned. +type diffChangeType byte + +const ( + diffInvalid diffChangeType = iota //nolint:deadcode,varcheck + diffNone + diffCreate + diffUpdate + diffDestroy + diffDestroyCreate +) + +// multiVal matches the index key to a flatmapped set, list or map +var multiVal = regexp.MustCompile(`\.(#|%)$`) + +// InstanceDiff is the diff of a resource from some state to another. +type InstanceDiff struct { + mu sync.Mutex + Attributes map[string]*ResourceAttrDiff + Destroy bool + DestroyDeposed bool + DestroyTainted bool + + RawConfig cty.Value + RawState cty.Value + RawPlan cty.Value + + // Meta is a simple K/V map that is stored in a diff and persisted to + // plans but otherwise is completely ignored by Terraform core. It is + // meant to be used for additional data a resource may want to pass through. + // The value here must only contain Go primitives and collections. + Meta map[string]interface{} +} + +func (d *InstanceDiff) Lock() { d.mu.Lock() } +func (d *InstanceDiff) Unlock() { d.mu.Unlock() } + +// ApplyToValue merges the receiver into the given base value, returning a +// new value that incorporates the planned changes. The given value must +// conform to the given schema, or this method will panic. +// +// This method is intended for shimming old subsystems that still use this +// legacy diff type to work with the new-style types. +func (d *InstanceDiff) ApplyToValue(base cty.Value, schema *configschema.Block) (cty.Value, error) { + // Create an InstanceState attributes from our existing state. + // We can use this to more easily apply the diff changes. + attrs := hcl2shim.FlatmapValueFromHCL2(base) + applied, err := d.Apply(attrs, schema) + if err != nil { + return base, err + } + + val, err := hcl2shim.HCL2ValueFromFlatmap(applied, schema.ImpliedType()) + if err != nil { + return base, err + } + + return schema.CoerceValue(val) +} + +// Apply applies the diff to the provided flatmapped attributes, +// returning the new instance attributes. +// +// This method is intended for shimming old subsystems that still use this +// legacy diff type to work with the new-style types. +func (d *InstanceDiff) Apply(attrs map[string]string, schema *configschema.Block) (map[string]string, error) { + // We always build a new value here, even if the given diff is "empty", + // because we might be planning to create a new instance that happens + // to have no attributes set, and so we want to produce an empty object + // rather than just echoing back the null old value. + if attrs == nil { + attrs = map[string]string{} + } + + // Rather applying the diff to mutate the attrs, we'll copy new values into + // here to avoid the possibility of leaving stale values. + result := map[string]string{} + + if d.Destroy || d.DestroyDeposed || d.DestroyTainted { + return result, nil + } + + return d.applyBlockDiff(nil, attrs, schema) +} + +func (d *InstanceDiff) applyBlockDiff(path []string, attrs map[string]string, schema *configschema.Block) (map[string]string, error) { + result := map[string]string{} + name := "" + if len(path) > 0 { + name = path[len(path)-1] + } + + // localPrefix is used to build the local result map + localPrefix := "" + if name != "" { + localPrefix = name + "." + } + + // iterate over the schema rather than the attributes, so we can handle + // different block types separately from plain attributes + for n, attrSchema := range schema.Attributes { + var err error + newAttrs, err := d.applyAttrDiff(append(path, n), attrs, attrSchema) + + if err != nil { + return result, err + } + + for k, v := range newAttrs { + result[localPrefix+k] = v + } + } + + blockPrefix := strings.Join(path, ".") + if blockPrefix != "" { + blockPrefix += "." + } + for n, block := range schema.BlockTypes { + // we need to find the set of all keys that traverse this block + candidateKeys := map[string]bool{} + blockKey := blockPrefix + n + "." + localBlockPrefix := localPrefix + n + "." + + // we can only trust the diff for sets, since the path changes, so don't + // count existing values as candidate keys. If it turns out we're + // keeping the attributes, we will catch it down below with "keepBlock" + // after we check the set count. + if block.Nesting != configschema.NestingSet { + for k := range attrs { + if strings.HasPrefix(k, blockKey) { + nextDot := strings.Index(k[len(blockKey):], ".") + if nextDot < 0 { + continue + } + nextDot += len(blockKey) + candidateKeys[k[len(blockKey):nextDot]] = true + } + } + } + + for k, diff := range d.Attributes { + // helper/schema should not insert nil diff values, but don't panic + // if it does. + if diff == nil { + continue + } + + if strings.HasPrefix(k, blockKey) { + nextDot := strings.Index(k[len(blockKey):], ".") + if nextDot < 0 { + continue + } + + if diff.NewRemoved { + continue + } + + nextDot += len(blockKey) + candidateKeys[k[len(blockKey):nextDot]] = true + } + } + + // check each set candidate to see if it was removed. + // we need to do this, because when entire sets are removed, they may + // have the wrong key, and ony show diffs going to "" + if block.Nesting == configschema.NestingSet { + for k := range candidateKeys { + indexPrefix := strings.Join(append(path, n, k), ".") + "." + keep := false + // now check each set element to see if it's a new diff, or one + // that we're dropping. Since we're only applying the "New" + // portion of the set, we can ignore diffs that only contain "Old" + for attr, diff := range d.Attributes { + // helper/schema should not insert nil diff values, but don't panic + // if it does. + if diff == nil { + continue + } + + if !strings.HasPrefix(attr, indexPrefix) { + continue + } + + // check for empty "count" keys + if (strings.HasSuffix(attr, ".#") || strings.HasSuffix(attr, ".%")) && diff.New == "0" { + continue + } + + // removed items don't count either + if diff.NewRemoved { + continue + } + + // this must be a diff to keep + keep = true + break + } + if !keep { + delete(candidateKeys, k) + } + } + } + + for k := range candidateKeys { + newAttrs, err := d.applyBlockDiff(append(path, n, k), attrs, &block.Block) + if err != nil { + return result, err + } + + for attr, v := range newAttrs { + result[localBlockPrefix+attr] = v + } + } + + keepBlock := true + // check this block's count diff directly first, since we may not + // have candidates because it was removed and only set to "0" + if diff, ok := d.Attributes[blockKey+"#"]; ok { + if diff.New == "0" || diff.NewRemoved { + keepBlock = false + } + } + + // if there was no diff at all, then we need to keep the block attributes + if len(candidateKeys) == 0 && keepBlock { + for k, v := range attrs { + if strings.HasPrefix(k, blockKey) { + // we need the key relative to this block, so remove the + // entire prefix, then re-insert the block name. + localKey := localBlockPrefix + k[len(blockKey):] + result[localKey] = v + } + } + } + + countAddr := strings.Join(append(path, n, "#"), ".") + if countDiff, ok := d.Attributes[countAddr]; ok { + if countDiff.NewComputed { + result[localBlockPrefix+"#"] = hcl2shim.UnknownVariableValue + } else { + result[localBlockPrefix+"#"] = countDiff.New + + // While sets are complete, list are not, and we may not have all the + // information to track removals. If the list was truncated, we need to + // remove the extra items from the result. + if block.Nesting == configschema.NestingList && + countDiff.New != "" && countDiff.New != hcl2shim.UnknownVariableValue { + length, _ := strconv.Atoi(countDiff.New) + for k := range result { + if !strings.HasPrefix(k, localBlockPrefix) { + continue + } + + index := k[len(localBlockPrefix):] + nextDot := strings.Index(index, ".") + if nextDot < 1 { + continue + } + index = index[:nextDot] + i, err := strconv.Atoi(index) + if err != nil { + // this shouldn't happen since we added these + // ourself, but make note of it just in case. + log.Printf("[ERROR] bad list index in %q: %s", k, err) + continue + } + if i >= length { + delete(result, k) + } + } + } + } + } else if origCount, ok := attrs[countAddr]; ok && keepBlock { + result[localBlockPrefix+"#"] = origCount + } else { + result[localBlockPrefix+"#"] = countFlatmapContainerValues(localBlockPrefix+"#", result) + } + } + + return result, nil +} + +func (d *InstanceDiff) applyAttrDiff(path []string, attrs map[string]string, attrSchema *configschema.Attribute) (map[string]string, error) { + ty := attrSchema.Type + switch { + case ty.IsListType(), ty.IsTupleType(), ty.IsMapType(): + return d.applyCollectionDiff(path, attrs, attrSchema) + case ty.IsSetType(): + return d.applySetDiff(path, attrs, attrSchema) + default: + return d.applySingleAttrDiff(path, attrs, attrSchema) + } +} + +func (d *InstanceDiff) applySingleAttrDiff(path []string, attrs map[string]string, attrSchema *configschema.Attribute) (map[string]string, error) { + currentKey := strings.Join(path, ".") + + attr := path[len(path)-1] + + result := map[string]string{} + diff := d.Attributes[currentKey] + old, exists := attrs[currentKey] + + if diff != nil && diff.NewComputed { + result[attr] = hcl2shim.UnknownVariableValue + return result, nil + } + + // "id" must exist and not be an empty string, or it must be unknown. + // This only applied to top-level "id" fields. + if attr == "id" && len(path) == 1 { + if old == "" { + result[attr] = hcl2shim.UnknownVariableValue + } else { + result[attr] = old + } + return result, nil + } + + // attribute diffs are sometimes missed, so assume no diff means keep the + // old value + if diff == nil { + if exists { + result[attr] = old + } else { + // We need required values, so set those with an empty value. It + // must be set in the config, since if it were missing it would have + // failed validation. + if attrSchema.Required { + // we only set a missing string here, since bool or number types + // would have distinct zero value which shouldn't have been + // lost. + if attrSchema.Type == cty.String { + result[attr] = "" + } + } + } + return result, nil + } + + // check for missmatched diff values + if exists && + old != diff.Old && + old != hcl2shim.UnknownVariableValue && + diff.Old != hcl2shim.UnknownVariableValue { + return result, fmt.Errorf("diff apply conflict for %s: diff expects %q, but prior value has %q", attr, diff.Old, old) + } + + if diff.NewRemoved { + // don't set anything in the new value + return map[string]string{}, nil + } + + if diff.Old == diff.New && diff.New == "" { + // this can only be a valid empty string + if attrSchema.Type == cty.String { + result[attr] = "" + } + return result, nil + } + + if attrSchema.Computed && diff.NewComputed { + result[attr] = hcl2shim.UnknownVariableValue + return result, nil + } + + result[attr] = diff.New + + return result, nil +} + +func (d *InstanceDiff) applyCollectionDiff(path []string, attrs map[string]string, attrSchema *configschema.Attribute) (map[string]string, error) { + result := map[string]string{} + + prefix := "" + if len(path) > 1 { + prefix = strings.Join(path[:len(path)-1], ".") + "." + } + + name := "" + if len(path) > 0 { + name = path[len(path)-1] + } + + currentKey := prefix + name + + // check the index first for special handling + for k, diff := range d.Attributes { + // check the index value, which can be set, and 0 + if k == currentKey+".#" || k == currentKey+".%" || k == currentKey { + if diff.NewRemoved { + return result, nil + } + + if diff.NewComputed { + result[k[len(prefix):]] = hcl2shim.UnknownVariableValue + return result, nil + } + + // do what the diff tells us to here, so that it's consistent with applies + if diff.New == "0" { + result[k[len(prefix):]] = "0" + return result, nil + } + } + } + + // collect all the keys from the diff and the old state + noDiff := true + keys := map[string]bool{} + for k := range d.Attributes { + if !strings.HasPrefix(k, currentKey+".") { + continue + } + noDiff = false + keys[k] = true + } + + noAttrs := true + for k := range attrs { + if !strings.HasPrefix(k, currentKey+".") { + continue + } + noAttrs = false + keys[k] = true + } + + // If there's no diff and no attrs, then there's no value at all. + // This prevents an unexpected zero-count attribute in the attributes. + if noDiff && noAttrs { + return result, nil + } + + idx := "#" + if attrSchema.Type.IsMapType() { + idx = "%" + } + + for k := range keys { + // generate an schema placeholder for the values + elSchema := &configschema.Attribute{ + Type: attrSchema.Type.ElementType(), + } + + res, err := d.applySingleAttrDiff(append(path, k[len(currentKey)+1:]), attrs, elSchema) + if err != nil { + return result, err + } + + for k, v := range res { + result[name+"."+k] = v + } + } + + // Just like in nested list blocks, for simple lists we may need to fill in + // missing empty strings. + countKey := name + "." + idx + count := result[countKey] + length, _ := strconv.Atoi(count) + + if count != "" && count != hcl2shim.UnknownVariableValue && + attrSchema.Type.Equals(cty.List(cty.String)) { + // insert empty strings into missing indexes + for i := 0; i < length; i++ { + key := fmt.Sprintf("%s.%d", name, i) + if _, ok := result[key]; !ok { + result[key] = "" + } + } + } + + // now check for truncation in any type of list + if attrSchema.Type.IsListType() { + for key := range result { + if key == countKey { + continue + } + + if len(key) <= len(name)+1 { + // not sure what this is, but don't panic + continue + } + + index := key[len(name)+1:] + + // It is possible to have nested sets or maps, so look for another dot + dot := strings.Index(index, ".") + if dot > 0 { + index = index[:dot] + } + + // This shouldn't have any more dots, since the element type is only string. + num, err := strconv.Atoi(index) + if err != nil { + log.Printf("[ERROR] bad list index in %q: %s", currentKey, err) + continue + } + + if num >= length { + delete(result, key) + } + } + } + + // Fill in the count value if it wasn't present in the diff for some reason, + // or if there is no count at all. + _, countDiff := d.Attributes[countKey] + if result[countKey] == "" || (!countDiff && len(keys) != len(result)) { + result[countKey] = countFlatmapContainerValues(countKey, result) + } + + return result, nil +} + +func (d *InstanceDiff) applySetDiff(path []string, attrs map[string]string, attrSchema *configschema.Attribute) (map[string]string, error) { + // We only need this special behavior for sets of object. + if !attrSchema.Type.ElementType().IsObjectType() { + // The normal collection apply behavior will work okay for this one, then. + return d.applyCollectionDiff(path, attrs, attrSchema) + } + + // When we're dealing with a set of an object type we actually want to + // use our normal _block type_ apply behaviors, so we'll construct ourselves + // a synthetic schema that treats the object type as a block type and + // then delegate to our block apply method. + synthSchema := &configschema.Block{ + Attributes: make(map[string]*configschema.Attribute), + } + + for name, ty := range attrSchema.Type.ElementType().AttributeTypes() { + // We can safely make everything into an attribute here because in the + // event that there are nested set attributes we'll end up back in + // here again recursively and can then deal with the next level of + // expansion. + synthSchema.Attributes[name] = &configschema.Attribute{ + Type: ty, + Optional: true, + } + } + + parentPath := path[:len(path)-1] + childName := path[len(path)-1] + containerSchema := &configschema.Block{ + BlockTypes: map[string]*configschema.NestedBlock{ + childName: { + Nesting: configschema.NestingSet, + Block: *synthSchema, + }, + }, + } + + return d.applyBlockDiff(parentPath, attrs, containerSchema) +} + +// countFlatmapContainerValues returns the number of values in the flatmapped container +// (set, map, list) indexed by key. The key argument is expected to include the +// trailing ".#", or ".%". +func countFlatmapContainerValues(key string, attrs map[string]string) string { + if len(key) < 3 || !(strings.HasSuffix(key, ".#") || strings.HasSuffix(key, ".%")) { + panic(fmt.Sprintf("invalid index value %q", key)) + } + + prefix := key[:len(key)-1] + items := map[string]int{} + + for k := range attrs { + if k == key { + continue + } + if !strings.HasPrefix(k, prefix) { + continue + } + + suffix := k[len(prefix):] + dot := strings.Index(suffix, ".") + if dot > 0 { + suffix = suffix[:dot] + } + + items[suffix]++ + } + return strconv.Itoa(len(items)) +} + +// ResourceAttrDiff is the diff of a single attribute of a resource. +type ResourceAttrDiff struct { + Old string // Old Value + New string // New Value + NewComputed bool // True if new value is computed (unknown currently) + NewRemoved bool // True if this attribute is being removed + NewExtra interface{} // Extra information for the provider + RequiresNew bool // True if change requires new resource + Sensitive bool // True if the data should not be displayed in UI output + Type diffAttrType +} + +func (d *ResourceAttrDiff) GoString() string { + return fmt.Sprintf("*%#v", *d) +} + +// DiffAttrType is an enum type that says whether a resource attribute +// diff is an input attribute (comes from the configuration) or an +// output attribute (comes as a result of applying the configuration). An +// example input would be "ami" for AWS and an example output would be +// "private_ip". +type diffAttrType byte + +func NewInstanceDiff() *InstanceDiff { + return &InstanceDiff{Attributes: make(map[string]*ResourceAttrDiff)} +} + +// ChangeType returns the diffChangeType represented by the diff +// for this single instance. +func (d *InstanceDiff) ChangeType() diffChangeType { + if d.Empty() { + return diffNone + } + + if d.RequiresNew() && (d.GetDestroy() || d.GetDestroyTainted()) { + return diffDestroyCreate + } + + if d.GetDestroy() || d.GetDestroyDeposed() { + return diffDestroy + } + + if d.RequiresNew() { + return diffCreate + } + + return diffUpdate +} + +// Empty returns true if this diff encapsulates no changes. +func (d *InstanceDiff) Empty() bool { + if d == nil { + return true + } + + d.mu.Lock() + defer d.mu.Unlock() + return !d.Destroy && + !d.DestroyTainted && + !d.DestroyDeposed && + len(d.Attributes) == 0 +} + +// Equal compares two diffs for exact equality. +// +// This is different from the Same comparison that is supported which +// checks for operation equality taking into account computed values. Equal +// instead checks for exact equality. +// TODO: investigate why removing this unused method causes panic in tests +func (d *InstanceDiff) Equal(d2 *InstanceDiff) bool { + // If one is nil, they must both be nil + if d == nil || d2 == nil { + return d == d2 + } + + // Use DeepEqual + return reflect.DeepEqual(d, d2) +} + +func (d *InstanceDiff) GoString() string { + return fmt.Sprintf("*%#v", InstanceDiff{ + Attributes: d.Attributes, + Destroy: d.Destroy, + DestroyTainted: d.DestroyTainted, + DestroyDeposed: d.DestroyDeposed, + }) +} + +// RequiresNew returns true if the diff requires the creation of a new +// resource (implying the destruction of the old). +func (d *InstanceDiff) RequiresNew() bool { + if d == nil { + return false + } + + d.mu.Lock() + defer d.mu.Unlock() + + return d.requiresNew() +} + +func (d *InstanceDiff) requiresNew() bool { + if d == nil { + return false + } + + if d.DestroyTainted { + return true + } + + for _, rd := range d.Attributes { + if rd != nil && rd.RequiresNew { + return true + } + } + + return false +} + +func (d *InstanceDiff) GetDestroyDeposed() bool { + d.mu.Lock() + defer d.mu.Unlock() + + return d.DestroyDeposed +} + +func (d *InstanceDiff) GetDestroyTainted() bool { + d.mu.Lock() + defer d.mu.Unlock() + + return d.DestroyTainted +} + +func (d *InstanceDiff) GetDestroy() bool { + d.mu.Lock() + defer d.mu.Unlock() + + return d.Destroy +} + +func (d *InstanceDiff) GetAttribute(key string) (*ResourceAttrDiff, bool) { + d.mu.Lock() + defer d.mu.Unlock() + + attr, ok := d.Attributes[key] + return attr, ok +} + +// Safely copies the Attributes map +func (d *InstanceDiff) CopyAttributes() map[string]*ResourceAttrDiff { + d.mu.Lock() + defer d.mu.Unlock() + + attrs := make(map[string]*ResourceAttrDiff) + for k, v := range d.Attributes { + attrs[k] = v + } + + return attrs +} + +// Same checks whether or not two InstanceDiff's are the "same". When +// we say "same", it is not necessarily exactly equal. Instead, it is +// just checking that the same attributes are changing, a destroy +// isn't suddenly happening, etc. +func (d *InstanceDiff) Same(d2 *InstanceDiff) (bool, string) { + // we can safely compare the pointers without a lock + switch { + case d == nil && d2 == nil: + return true, "" + case d == nil || d2 == nil: + return false, "one nil" + case d == d2: + return true, "" + } + + d.mu.Lock() + defer d.mu.Unlock() + + // If we're going from requiring new to NOT requiring new, then we have + // to see if all required news were computed. If so, it is allowed since + // computed may also mean "same value and therefore not new". + oldNew := d.requiresNew() + newNew := d2.RequiresNew() + if oldNew && !newNew { + oldNew = false + + // This section builds a list of ignorable attributes for requiresNew + // by removing off any elements of collections going to zero elements. + // For collections going to zero, they may not exist at all in the + // new diff (and hence RequiresNew == false). + ignoreAttrs := make(map[string]struct{}) + for k, diffOld := range d.Attributes { + if !strings.HasSuffix(k, ".%") && !strings.HasSuffix(k, ".#") { + continue + } + + // This case is in here as a protection measure. The bug that this + // code originally fixed (GH-11349) didn't have to deal with computed + // so I'm not 100% sure what the correct behavior is. Best to leave + // the old behavior. + if diffOld.NewComputed { + continue + } + + // We're looking for the case a map goes to exactly 0. + if diffOld.New != "0" { + continue + } + + // Found it! Ignore all of these. The prefix here is stripping + // off the "%" so it is just "k." + prefix := k[:len(k)-1] + for k2 := range d.Attributes { + if strings.HasPrefix(k2, prefix) { + ignoreAttrs[k2] = struct{}{} + } + } + } + + for k, rd := range d.Attributes { + if _, ok := ignoreAttrs[k]; ok { + continue + } + + // If the field is requires new and NOT computed, then what + // we have is a diff mismatch for sure. We set that the old + // diff does REQUIRE a ForceNew. + if rd != nil && rd.RequiresNew && !rd.NewComputed { + oldNew = true + break + } + } + } + + if oldNew != newNew { + return false, fmt.Sprintf( + "diff RequiresNew; old: %t, new: %t", oldNew, newNew) + } + + // Verify that destroy matches. The second boolean here allows us to + // have mismatching Destroy if we're moving from RequiresNew true + // to false above. Therefore, the second boolean will only pass if + // we're moving from Destroy: true to false as well. + if d.Destroy != d2.GetDestroy() && d.requiresNew() == oldNew { + return false, fmt.Sprintf( + "diff: Destroy; old: %t, new: %t", d.Destroy, d2.GetDestroy()) + } + + // Go through the old diff and make sure the new diff has all the + // same attributes. To start, build up the check map to be all the keys. + checkOld := make(map[string]struct{}) + checkNew := make(map[string]struct{}) + for k := range d.Attributes { + checkOld[k] = struct{}{} + } + for k := range d2.CopyAttributes() { + checkNew[k] = struct{}{} + } + + // Make an ordered list so we are sure the approximated hashes are left + // to process at the end of the loop + keys := make([]string, 0, len(d.Attributes)) + for k := range d.Attributes { + keys = append(keys, k) + } + sort.StringSlice(keys).Sort() + + for _, k := range keys { + diffOld := d.Attributes[k] + + if _, ok := checkOld[k]; !ok { + // We're not checking this key for whatever reason (see where + // check is modified). + continue + } + + // Remove this key since we'll never hit it again + delete(checkOld, k) + delete(checkNew, k) + + _, ok := d2.GetAttribute(k) + if !ok { + // If there's no new attribute, and the old diff expected the attribute + // to be removed, that's just fine. + if diffOld.NewRemoved { + continue + } + + // If the last diff was a computed value then the absense of + // that value is allowed since it may mean the value ended up + // being the same. + if diffOld.NewComputed { + ok = true + } + + // No exact match, but maybe this is a set containing computed + // values. So check if there is an approximate hash in the key + // and if so, try to match the key. + if strings.Contains(k, "~") { + parts := strings.Split(k, ".") + parts2 := append([]string(nil), parts...) + + re := regexp.MustCompile(`^~\d+$`) + for i, part := range parts { + if re.MatchString(part) { + // we're going to consider this the base of a + // computed hash, and remove all longer matching fields + ok = true + + parts2[i] = `\d+` + parts2 = parts2[:i+1] + break + } + } + + re, err := regexp.Compile("^" + strings.Join(parts2, `\.`)) + if err != nil { + return false, fmt.Sprintf("regexp failed to compile; err: %#v", err) + } + + for k2 := range checkNew { + if re.MatchString(k2) { + delete(checkNew, k2) + } + } + } + + // This is a little tricky, but when a diff contains a computed + // list, set, or map that can only be interpolated after the apply + // command has created the dependent resources, it could turn out + // that the result is actually the same as the existing state which + // would remove the key from the diff. + if diffOld.NewComputed && (strings.HasSuffix(k, ".#") || strings.HasSuffix(k, ".%")) { + ok = true + } + + // Similarly, in a RequiresNew scenario, a list that shows up in the plan + // diff can disappear from the apply diff, which is calculated from an + // empty state. + if d.requiresNew() && (strings.HasSuffix(k, ".#") || strings.HasSuffix(k, ".%")) { + ok = true + } + + if !ok { + return false, fmt.Sprintf("attribute mismatch: %s", k) + } + } + + // search for the suffix of the base of a [computed] map, list or set. + match := multiVal.FindStringSubmatch(k) + + if diffOld.NewComputed && len(match) == 2 { + matchLen := len(match[1]) + + // This is a computed list, set, or map, so remove any keys with + // this prefix from the check list. + kprefix := k[:len(k)-matchLen] + for k2 := range checkOld { + if strings.HasPrefix(k2, kprefix) { + delete(checkOld, k2) + } + } + for k2 := range checkNew { + if strings.HasPrefix(k2, kprefix) { + delete(checkNew, k2) + } + } + } + + // We don't compare the values because we can't currently actually + // guarantee to generate the same value two two diffs created from + // the same state+config: we have some pesky interpolation functions + // that do not behave as pure functions (uuid, timestamp) and so they + // can be different each time a diff is produced. + // FIXME: Re-organize our config handling so that we don't re-evaluate + // expressions when we produce a second comparison diff during + // apply (for EvalCompareDiff). + } + + // Check for leftover attributes + if len(checkNew) > 0 { + extras := make([]string, 0, len(checkNew)) + for attr := range checkNew { + extras = append(extras, attr) + } + return false, + fmt.Sprintf("extra attributes: %s", strings.Join(extras, ", ")) + } + + return true, "" +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/instancetype.go b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/instancetype.go new file mode 100644 index 000000000000..1871445819a5 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/instancetype.go @@ -0,0 +1,19 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package terraform + +// This code was previously generated with a go:generate directive calling: +// go run golang.org/x/tools/cmd/stringer -type=instanceType instancetype.go +// However, it is now considered frozen and the tooling dependency has been +// removed. The String method can be manually updated if necessary. + +// instanceType is an enum of the various types of instances store in the State +type instanceType int + +const ( + typeInvalid instanceType = iota + typePrimary + typeTainted + typeDeposed +) diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/instancetype_string.go b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/instancetype_string.go new file mode 100644 index 000000000000..782ef90c05cb --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/instancetype_string.go @@ -0,0 +1,26 @@ +// Code generated by "stringer -type=instanceType instancetype.go"; DO NOT EDIT. + +package terraform + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[typeInvalid-0] + _ = x[typePrimary-1] + _ = x[typeTainted-2] + _ = x[typeDeposed-3] +} + +const _instanceType_name = "typeInvalidtypePrimarytypeTaintedtypeDeposed" + +var _instanceType_index = [...]uint8{0, 11, 22, 33, 44} + +func (i instanceType) String() string { + if i < 0 || i >= instanceType(len(_instanceType_index)-1) { + return "instanceType(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _instanceType_name[_instanceType_index[i]:_instanceType_index[i+1]] +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/resource.go b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/resource.go new file mode 100644 index 000000000000..1adfe6dffc23 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/resource.go @@ -0,0 +1,336 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package terraform + +import ( + "fmt" + "reflect" + "sort" + "strconv" + "strings" + + "github.com/hashicorp/go-cty/cty" + "github.com/mitchellh/copystructure" + "github.com/mitchellh/reflectwalk" + + "github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim" +) + +// InstanceInfo is used to hold information about the instance and/or +// resource being modified. +type InstanceInfo struct { + // Id is a unique name to represent this instance. This is not related + // to InstanceState.ID in any way. + Id string + + // ModulePath is the complete path of the module containing this + // instance. + ModulePath []string + + // Type is the resource type of this instance + Type string +} + +// ResourceConfig is a legacy type that was formerly used to represent +// interpolatable configuration blocks. It is now only used to shim to old +// APIs that still use this type, via NewResourceConfigShimmed. +type ResourceConfig struct { + ComputedKeys []string + Raw map[string]interface{} + Config map[string]interface{} +} + +// NewResourceConfigRaw constructs a ResourceConfig whose content is exactly +// the given value. +// +// The given value may contain hcl2shim.UnknownVariableValue to signal that +// something is computed, but it must not contain unprocessed interpolation +// sequences as we might've seen in Terraform v0.11 and prior. +func NewResourceConfigRaw(raw map[string]interface{}) *ResourceConfig { + v := hcl2shim.HCL2ValueFromConfigValue(raw) + + // This is a little weird but we round-trip the value through the hcl2shim + // package here for two reasons: firstly, because that reduces the risk + // of it including something unlike what NewResourceConfigShimmed would + // produce, and secondly because it creates a copy of "raw" just in case + // something is relying on the fact that in the old world the raw and + // config maps were always distinct, and thus you could in principle mutate + // one without affecting the other. (I sure hope nobody was doing that, though!) + cfg := hcl2shim.ConfigValueFromHCL2(v).(map[string]interface{}) + + return &ResourceConfig{ + Raw: raw, + Config: cfg, + + ComputedKeys: newResourceConfigShimmedComputedKeys(v, ""), + } +} + +// NewResourceConfigShimmed wraps a cty.Value of object type in a legacy +// ResourceConfig object, so that it can be passed to older APIs that expect +// this wrapping. +// +// The returned ResourceConfig is already interpolated and cannot be +// re-interpolated. It is, therefore, useful only to functions that expect +// an already-populated ResourceConfig which they then treat as read-only. +// +// If the given value is not of an object type that conforms to the given +// schema then this function will panic. +func NewResourceConfigShimmed(val cty.Value, schema *configschema.Block) *ResourceConfig { + if !val.Type().IsObjectType() { + panic(fmt.Errorf("NewResourceConfigShimmed given %#v; an object type is required", val.Type())) + } + ret := &ResourceConfig{} + + legacyVal := hcl2shim.ConfigValueFromHCL2Block(val, schema) + if legacyVal != nil { + ret.Config = legacyVal + + // Now we need to walk through our structure and find any unknown values, + // producing the separate list ComputedKeys to represent these. We use the + // schema here so that we can preserve the expected invariant + // that an attribute is always either wholly known or wholly unknown, while + // a child block can be partially unknown. + ret.ComputedKeys = newResourceConfigShimmedComputedKeys(val, "") + } else { + ret.Config = make(map[string]interface{}) + } + ret.Raw = ret.Config + + return ret +} + +// Record the any config values in ComputedKeys. This field had been unused in +// helper/schema, but in the new protocol we're using this so that the SDK can +// now handle having an unknown collection. The legacy diff code doesn't +// properly handle the unknown, because it can't be expressed in the same way +// between the config and diff. +func newResourceConfigShimmedComputedKeys(val cty.Value, path string) []string { + var ret []string + ty := val.Type() + + if val.IsNull() { + return ret + } + + if !val.IsKnown() { + // we shouldn't have an entirely unknown resource, but prevent empty + // strings just in case + if len(path) > 0 { + ret = append(ret, path) + } + return ret + } + + if path != "" { + path += "." + } + switch { + case ty.IsListType(), ty.IsTupleType(), ty.IsSetType(): + i := 0 + for it := val.ElementIterator(); it.Next(); i++ { + _, subVal := it.Element() + keys := newResourceConfigShimmedComputedKeys(subVal, fmt.Sprintf("%s%d", path, i)) + ret = append(ret, keys...) + } + + case ty.IsMapType(), ty.IsObjectType(): + for it := val.ElementIterator(); it.Next(); { + subK, subVal := it.Element() + keys := newResourceConfigShimmedComputedKeys(subVal, fmt.Sprintf("%s%s", path, subK.AsString())) + ret = append(ret, keys...) + } + } + + return ret +} + +// DeepCopy performs a deep copy of the configuration. This makes it safe +// to modify any of the structures that are part of the resource config without +// affecting the original configuration. +func (c *ResourceConfig) DeepCopy() *ResourceConfig { + // DeepCopying a nil should return a nil to avoid panics + if c == nil { + return nil + } + + // Copy, this will copy all the exported attributes + copiedConfig, err := copystructure.Config{Lock: true}.Copy(c) + if err != nil { + panic(err) + } + + // Force the type + result := copiedConfig.(*ResourceConfig) + + return result +} + +// Equal checks the equality of two resource configs. +func (c *ResourceConfig) Equal(c2 *ResourceConfig) bool { + // If either are nil, then they're only equal if they're both nil + if c == nil || c2 == nil { + return c == c2 + } + + // Sort the computed keys so they're deterministic + sort.Strings(c.ComputedKeys) + sort.Strings(c2.ComputedKeys) + + // Two resource configs if their exported properties are equal. + // We don't compare "raw" because it is never used again after + // initialization and for all intents and purposes they are equal + // if the exported properties are equal. + check := [][2]interface{}{ + {c.ComputedKeys, c2.ComputedKeys}, + {c.Raw, c2.Raw}, + {c.Config, c2.Config}, + } + for _, pair := range check { + if !reflect.DeepEqual(pair[0], pair[1]) { + return false + } + } + + return true +} + +// Get looks up a configuration value by key and returns the value. +// +// The second return value is true if the get was successful. Get will +// return the raw value if the key is computed, so you should pair this +// with IsComputed. +func (c *ResourceConfig) Get(k string) (interface{}, bool) { + // We aim to get a value from the configuration. If it is computed, + // then we return the pure raw value. + source := c.Config + if c.IsComputed(k) { + source = c.Raw + } + + return c.get(k, source) +} + +// GetRaw looks up a configuration value by key and returns the value, +// from the raw, uninterpolated config. +// +// The second return value is true if the get was successful. Get will +// not succeed if the value is being computed. +func (c *ResourceConfig) GetRaw(k string) (interface{}, bool) { + return c.get(k, c.Raw) +} + +// IsComputed returns whether the given key is computed or not. +func (c *ResourceConfig) IsComputed(k string) bool { + // The next thing we do is check the config if we get a computed + // value out of it. + v, ok := c.get(k, c.Config) + if !ok { + return false + } + + // If value is nil, then it isn't computed + if v == nil { + return false + } + + // Test if the value contains an unknown value + var w unknownCheckWalker + if err := reflectwalk.Walk(v, &w); err != nil { + panic(err) + } + + return w.Unknown +} + +func (c *ResourceConfig) get( + k string, raw map[string]interface{}) (interface{}, bool) { + parts := strings.Split(k, ".") + if len(parts) == 1 && parts[0] == "" { + parts = nil + } + + var current interface{} = raw + var previous interface{} = nil + for i, part := range parts { + if current == nil { + return nil, false + } + + cv := reflect.ValueOf(current) + switch cv.Kind() { + case reflect.Map: + previous = current + v := cv.MapIndex(reflect.ValueOf(part)) + if !v.IsValid() { + if i > 0 && i != (len(parts)-1) { + tryKey := strings.Join(parts[i:], ".") + v := cv.MapIndex(reflect.ValueOf(tryKey)) + if !v.IsValid() { + return nil, false + } + + return v.Interface(), true + } + + return nil, false + } + + current = v.Interface() + case reflect.Slice: + previous = current + + if part == "#" { + // If any value in a list is computed, this whole thing + // is computed and we can't read any part of it. + for i := 0; i < cv.Len(); i++ { + if v := cv.Index(i).Interface(); v == hcl2shim.UnknownVariableValue { + return v, true + } + } + + current = cv.Len() + } else { + i, err := strconv.ParseInt(part, 0, 0) + if err != nil { + return nil, false + } + if int(i) < 0 || int(i) >= cv.Len() { + return nil, false + } + current = cv.Index(int(i)).Interface() + } + case reflect.String: + // This happens when map keys contain "." and have a common + // prefix so were split as path components above. + actualKey := strings.Join(parts[i-1:], ".") + if prevMap, ok := previous.(map[string]interface{}); ok { + v, ok := prevMap[actualKey] + return v, ok + } + + return nil, false + default: + panic(fmt.Sprintf("Unknown kind: %s", cv.Kind())) + } + } + + return current, true +} + +// unknownCheckWalker +type unknownCheckWalker struct { + Unknown bool +} + +// TODO: investigate why deleting this causes odd runtime test failures +// must be some kind of interface implementation +func (w *unknownCheckWalker) Primitive(v reflect.Value) error { + if v.Interface() == hcl2shim.UnknownVariableValue { + w.Unknown = true + } + + return nil +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/resource_address.go b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/resource_address.go new file mode 100644 index 000000000000..8d92fbb5e453 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/resource_address.go @@ -0,0 +1,229 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package terraform + +import ( + "fmt" + "reflect" + "regexp" + "strconv" + "strings" +) + +// resourceAddress is a way of identifying an individual resource (or, +// eventually, a subset of resources) within the state. It is used for Targets. +type resourceAddress struct { + // Addresses a resource falling somewhere in the module path + // When specified alone, addresses all resources within a module path + Path []string + + // Addresses a specific resource that occurs in a list + Index int + + InstanceType instanceType + InstanceTypeSet bool + Name string + Type string + Mode ResourceMode // significant only if InstanceTypeSet +} + +// String outputs the address that parses into this address. +func (r *resourceAddress) String() string { + var result []string + for _, p := range r.Path { + result = append(result, "module", p) + } + + switch r.Mode { + case ManagedResourceMode: + // nothing to do + case DataResourceMode: + result = append(result, "data") + default: + panic(fmt.Errorf("unsupported resource mode %s", r.Mode)) + } + + if r.Type != "" { + result = append(result, r.Type) + } + + if r.Name != "" { + name := r.Name + if r.InstanceTypeSet { + switch r.InstanceType { + case typePrimary: + name += ".primary" + case typeDeposed: + name += ".deposed" + case typeTainted: + name += ".tainted" + } + } + + if r.Index >= 0 { + name += fmt.Sprintf("[%d]", r.Index) + } + result = append(result, name) + } + + return strings.Join(result, ".") +} + +func parseResourceAddress(s string) (*resourceAddress, error) { + matches, err := tokenizeResourceAddress(s) + if err != nil { + return nil, err + } + mode := ManagedResourceMode + if matches["data_prefix"] != "" { + mode = DataResourceMode + } + resourceIndex, err := parseResourceIndex(matches["index"]) + if err != nil { + return nil, err + } + instanceType, err := parseInstanceType(matches["instance_type"]) + if err != nil { + return nil, err + } + path := parseResourcePath(matches["path"]) + + // not allowed to say "data." without a type following + if mode == DataResourceMode && matches["type"] == "" { + return nil, fmt.Errorf( + "invalid resource address %q: must target specific data instance", + s, + ) + } + + return &resourceAddress{ + Path: path, + Index: resourceIndex, + InstanceType: instanceType, + InstanceTypeSet: matches["instance_type"] != "", + Name: matches["name"], + Type: matches["type"], + Mode: mode, + }, nil +} + +// Less returns true if and only if the receiver should be sorted before +// the given address when presenting a list of resource addresses to +// an end-user. +// +// This sort uses lexicographic sorting for most components, but uses +// numeric sort for indices, thus causing index 10 to sort after +// index 9, rather than after index 1. +func (addr *resourceAddress) Less(other *resourceAddress) bool { + + switch { + + case len(addr.Path) != len(other.Path): + return len(addr.Path) < len(other.Path) + + case !reflect.DeepEqual(addr.Path, other.Path): + // If the two paths are the same length but don't match, we'll just + // cheat and compare the string forms since it's easier than + // comparing all of the path segments in turn, and lexicographic + // comparison is correct for the module path portion. + addrStr := addr.String() + otherStr := other.String() + return addrStr < otherStr + + case addr.Mode != other.Mode: + return addr.Mode == DataResourceMode + + case addr.Type != other.Type: + return addr.Type < other.Type + + case addr.Name != other.Name: + return addr.Name < other.Name + + case addr.Index != other.Index: + // Since "Index" is -1 for an un-indexed address, this also conveniently + // sorts unindexed addresses before indexed ones, should they both + // appear for some reason. + return addr.Index < other.Index + + case addr.InstanceTypeSet != other.InstanceTypeSet: + return !addr.InstanceTypeSet + + case addr.InstanceType != other.InstanceType: + // InstanceType is actually an enum, so this is just an arbitrary + // sort based on the enum numeric values, and thus not particularly + // meaningful. + return addr.InstanceType < other.InstanceType + + default: + return false + + } +} + +func parseResourceIndex(s string) (int, error) { + if s == "" { + return -1, nil + } + return strconv.Atoi(s) +} + +func parseResourcePath(s string) []string { + if s == "" { + return nil + } + parts := strings.Split(s, ".") + path := make([]string, 0, len(parts)) + for _, s := range parts { + // Due to the limitations of the regexp match below, the path match has + // some noise in it we have to filter out :| + if s == "" || s == "module" { + continue + } + path = append(path, s) + } + return path +} + +func parseInstanceType(s string) (instanceType, error) { + switch s { + case "", "primary": + return typePrimary, nil + case "deposed": + return typeDeposed, nil + case "tainted": + return typeTainted, nil + default: + return typeInvalid, fmt.Errorf("Unexpected value for instanceType field: %q", s) + } +} + +func tokenizeResourceAddress(s string) (map[string]string, error) { + // Example of portions of the regexp below using the + // string "aws_instance.web.tainted[1]" + re := regexp.MustCompile(`\A` + + // "module.foo.module.bar" (optional) + `(?P(?:module\.(?P[^.]+)\.?)*)` + + // possibly "data.", if targeting is a data resource + `(?P(?:data\.)?)` + + // "aws_instance.web" (optional when module path specified) + `(?:(?P[^.]+)\.(?P[^.[]+))?` + + // "tainted" (optional, omission implies: "primary") + `(?:\.(?P\w+))?` + + // "1" (optional, omission implies: "0") + `(?:\[(?P\d+)\])?` + + `\z`) + + groupNames := re.SubexpNames() + rawMatches := re.FindAllStringSubmatch(s, -1) + if len(rawMatches) != 1 { + return nil, fmt.Errorf("invalid resource address %q", s) + } + + matches := make(map[string]string) + for i, m := range rawMatches[0] { + matches[groupNames[i]] = m + } + + return matches, nil +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/resource_mode.go b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/resource_mode.go new file mode 100644 index 000000000000..2d7b10bcff75 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/resource_mode.go @@ -0,0 +1,18 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package terraform + +// This code was previously generated with a go:generate directive calling: +// go run golang.org/x/tools/cmd/stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go +// However, it is now considered frozen and the tooling dependency has been +// removed. The String method can be manually updated if necessary. + +// ResourceMode is deprecated, use addrs.ResourceMode instead. +// It has been preserved for backwards compatibility. +type ResourceMode int + +const ( + ManagedResourceMode ResourceMode = iota + DataResourceMode +) diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/resource_mode_string.go b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/resource_mode_string.go new file mode 100644 index 000000000000..ba84346a218d --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/resource_mode_string.go @@ -0,0 +1,24 @@ +// Code generated by "stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go"; DO NOT EDIT. + +package terraform + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[ManagedResourceMode-0] + _ = x[DataResourceMode-1] +} + +const _ResourceMode_name = "ManagedResourceModeDataResourceMode" + +var _ResourceMode_index = [...]uint8{0, 19, 35} + +func (i ResourceMode) String() string { + if i < 0 || i >= ResourceMode(len(_ResourceMode_index)-1) { + return "ResourceMode(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _ResourceMode_name[_ResourceMode_index[i]:_ResourceMode_index[i+1]] +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/resource_provider.go b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/resource_provider.go new file mode 100644 index 000000000000..c8e7008c0a8d --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/resource_provider.go @@ -0,0 +1,29 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package terraform + +// ResourceType is a type of resource that a resource provider can manage. +type ResourceType struct { + Name string // Name of the resource, example "instance" (no provider prefix) + Importable bool // Whether this resource supports importing + + // SchemaAvailable is set if the provider supports the ProviderSchema, + // ResourceTypeSchema and DataSourceSchema methods. Although it is + // included on each resource type, it's actually a provider-wide setting + // that's smuggled here only because that avoids a breaking change to + // the plugin protocol. + SchemaAvailable bool +} + +// DataSource is a data source that a resource provider implements. +type DataSource struct { + Name string + + // SchemaAvailable is set if the provider supports the ProviderSchema, + // ResourceTypeSchema and DataSourceSchema methods. Although it is + // included on each resource type, it's actually a provider-wide setting + // that's smuggled here only because that avoids a breaking change to + // the plugin protocol. + SchemaAvailable bool +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/schemas.go b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/schemas.go new file mode 100644 index 000000000000..a1b61f181b75 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/schemas.go @@ -0,0 +1,29 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package terraform + +import ( + "github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema" +) + +// ProviderSchema represents the schema for a provider's own configuration +// and the configuration for some or all of its resources and data sources. +// +// The completeness of this structure depends on how it was constructed. +// When constructed for a configuration, it will generally include only +// resource types and data sources used by that configuration. +type ProviderSchema struct { + Provider *configschema.Block + ResourceTypes map[string]*configschema.Block + DataSources map[string]*configschema.Block + + ResourceTypeSchemaVersions map[string]uint64 +} + +// ProviderSchemaRequest is used to describe to a ResourceProvider which +// aspects of schema are required, when calling the GetSchema method. +type ProviderSchemaRequest struct { + ResourceTypes []string + DataSources []string +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/state.go b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/state.go new file mode 100644 index 000000000000..9041d7ae9e7b --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/state.go @@ -0,0 +1,1653 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package terraform + +import ( + "bufio" + "bytes" + "encoding/json" + "fmt" + "log" + "os" + "reflect" + "sort" + "strconv" + "strings" + "sync" + + "github.com/hashicorp/go-cty/cty" + "github.com/hashicorp/go-multierror" + "github.com/hashicorp/go-uuid" + "github.com/mitchellh/copystructure" + + "github.com/hashicorp/terraform-plugin-testing/internal/addrs" + "github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim" +) + +const ( + // StateVersion is the current version for our state file + stateVersion = 3 +) + +// rootModulePath is the path of the root module +var rootModulePath = []string{"root"} + +// normalizeModulePath transforms a legacy module path (which may or may not +// have a redundant "root" label at the start of it) into an +// addrs.ModuleInstance representing the same module. +// +// For legacy reasons, different parts of Terraform disagree about whether the +// root module has the path []string{} or []string{"root"}, and so this +// function accepts both and trims off the "root". An implication of this is +// that it's not possible to actually have a module call in the root module +// that is itself named "root", since that would be ambiguous. +// +// normalizeModulePath takes a raw module path and returns a path that +// has the rootModulePath prepended to it. If I could go back in time I +// would've never had a rootModulePath (empty path would be root). We can +// still fix this but thats a big refactor that my branch doesn't make sense +// for. Instead, this function normalizes paths. +func normalizeModulePath(p []string) addrs.ModuleInstance { + // FIXME: Remove this once everyone is using addrs.ModuleInstance. + + if len(p) > 0 && p[0] == "root" { + p = p[1:] + } + + ret := make(addrs.ModuleInstance, len(p)) + for i, name := range p { + // For now we don't actually support modules with multiple instances + // identified by keys, so we just treat every path element as a + // step with no key. + ret[i] = addrs.ModuleInstanceStep{ + Name: name, + } + } + return ret +} + +// State keeps track of a snapshot state-of-the-world that Terraform +// can use to keep track of what real world resources it is actually +// managing. +type State struct { + // Version is the state file protocol version. + Version int `json:"version"` + + // TFVersion is the version of Terraform that wrote this state. + TFVersion string `json:"terraform_version,omitempty"` + + // Serial is incremented on any operation that modifies + // the State file. It is used to detect potentially conflicting + // updates. + Serial int64 `json:"serial"` + + // Lineage is set when a new, blank state is created and then + // never updated. This allows us to determine whether the serials + // of two states can be meaningfully compared. + // Apart from the guarantee that collisions between two lineages + // are very unlikely, this value is opaque and external callers + // should only compare lineage strings byte-for-byte for equality. + Lineage string `json:"lineage"` + + // Remote is used to track the metadata required to + // pull and push state files from a remote storage endpoint. + Remote *RemoteState `json:"remote,omitempty"` + + // Backend tracks the configuration for the backend in use with + // this state. This is used to track any changes in the backend + // configuration. + Backend *BackendState `json:"backend,omitempty"` + + // Modules contains all the modules in a breadth-first order + Modules []*ModuleState `json:"modules"` + + mu sync.Mutex + + // IsBinaryDrivenTest is a special flag that assists with a binary driver + // heuristic, it should not be set externally + IsBinaryDrivenTest bool +} + +func (s *State) Lock() { s.mu.Lock() } +func (s *State) Unlock() { s.mu.Unlock() } + +// NewState is used to initialize a blank state +func NewState() *State { + s := &State{} + s.init() + return s +} + +// Children returns the ModuleStates that are direct children of +// the given path. If the path is "root", for example, then children +// returned might be "root.child", but not "root.child.grandchild". +func (s *State) Children(path []string) []*ModuleState { + s.Lock() + defer s.Unlock() + // TODO: test + + return s.children(path) +} + +func (s *State) children(path []string) []*ModuleState { + result := make([]*ModuleState, 0) + for _, m := range s.Modules { + if m == nil { + continue + } + + if len(m.Path) != len(path)+1 { + continue + } + if !reflect.DeepEqual(path, m.Path[:len(path)]) { + continue + } + + result = append(result, m) + } + + return result +} + +// AddModule adds the module with the given path to the state. +// +// This should be the preferred method to add module states since it +// allows us to optimize lookups later as well as control sorting. +func (s *State) AddModule(path addrs.ModuleInstance) *ModuleState { + s.Lock() + defer s.Unlock() + + return s.addModule(path) +} + +func (s *State) addModule(path addrs.ModuleInstance) *ModuleState { + // check if the module exists first + m := s.moduleByPath(path) + if m != nil { + return m + } + + // Lower the new-style address into a legacy-style address. + // This requires that none of the steps have instance keys, which is + // true for all addresses at the time of implementing this because + // "count" and "for_each" are not yet implemented for modules. + // For the purposes of state, the legacy address format also includes + // a redundant extra prefix element "root". It is important to include + // this because the "prune" method will remove any module that has a + // path length less than one, and other parts of the state code will + // trim off the first element indiscriminately. + legacyPath := make([]string, len(path)+1) + legacyPath[0] = "root" + for i, step := range path { + if step.InstanceKey != addrs.NoKey { + // FIXME: Once the rest of Terraform is ready to use count and + // for_each, remove all of this and just write the addrs.ModuleInstance + // value itself into the ModuleState. + panic("state cannot represent modules with count or for_each keys") + } + + legacyPath[i+1] = step.Name + } + + m = &ModuleState{Path: legacyPath} + m.init() + s.Modules = append(s.Modules, m) + s.sort() + return m +} + +// ModuleByPath is used to lookup the module state for the given path. +// This should be the preferred lookup mechanism as it allows for future +// lookup optimizations. +func (s *State) ModuleByPath(path addrs.ModuleInstance) *ModuleState { + if s == nil { + return nil + } + s.Lock() + defer s.Unlock() + + return s.moduleByPath(path) +} + +func (s *State) moduleByPath(path addrs.ModuleInstance) *ModuleState { + for _, mod := range s.Modules { + if mod == nil { + continue + } + if mod.Path == nil { + panic("missing module path") + } + modPath := normalizeModulePath(mod.Path) + if modPath.String() == path.String() { + return mod + } + } + return nil +} + +// Empty returns true if the state is empty. +func (s *State) Empty() bool { + if s == nil { + return true + } + s.Lock() + defer s.Unlock() + + return len(s.Modules) == 0 +} + +// HasResources returns true if the state contains any resources. +// +// This is similar to !s.Empty, but returns true also in the case where the +// state has modules but all of them are devoid of resources. +func (s *State) HasResources() bool { + if s.Empty() { + return false + } + + for _, mod := range s.Modules { + if len(mod.Resources) > 0 { + return true + } + } + + return false +} + +// IsRemote returns true if State represents a state that exists and is +// remote. +func (s *State) IsRemote() bool { + if s == nil { + return false + } + s.Lock() + defer s.Unlock() + + if s.Remote == nil { + return false + } + if s.Remote.Type == "" { + return false + } + + return true +} + +// Validate validates the integrity of this state file. +// +// Certain properties of the statefile are expected by Terraform in order +// to behave properly. The core of Terraform will assume that once it +// receives a State structure that it has been validated. This validation +// check should be called to ensure that. +// +// If this returns an error, then the user should be notified. The error +// response will include detailed information on the nature of the error. +func (s *State) Validate() error { + s.Lock() + defer s.Unlock() + + var result error + + // !!!! FOR DEVELOPERS !!!! + // + // Any errors returned from this Validate function will BLOCK TERRAFORM + // from loading a state file. Therefore, this should only contain checks + // that are only resolvable through manual intervention. + // + // !!!! FOR DEVELOPERS !!!! + + // Make sure there are no duplicate module states. We open a new + // block here so we can use basic variable names and future validations + // can do the same. + { + found := make(map[string]struct{}) + for _, ms := range s.Modules { + if ms == nil { + continue + } + + key := strings.Join(ms.Path, ".") + if _, ok := found[key]; ok { + result = multierror.Append(result, fmt.Errorf( + strings.TrimSpace(stateValidateErrMultiModule), key)) + continue + } + + found[key] = struct{}{} + } + } + + return result +} + +// Remove removes the item in the state at the given address, returning +// any errors that may have occurred. +// +// If the address references a module state or resource, it will delete +// all children as well. To check what will be deleted, use a StateFilter +// first. +func (s *State) Remove(addr ...string) error { + s.Lock() + defer s.Unlock() + + // Filter out what we need to delete + filter := &stateFilter{State: s} + results, err := filter.filter(addr...) + if err != nil { + return err + } + + // If we have no results, just exit early, we're not going to do anything. + // While what happens below is fairly fast, this is an important early + // exit since the prune below might modify the state more and we don't + // want to modify the state if we don't have to. + if len(results) == 0 { + return nil + } + + // Go through each result and grab what we need + removed := make(map[interface{}]struct{}) + for _, r := range results { + // Convert the path to our own type + path := append([]string{"root"}, r.Path...) + + // If we removed this already, then ignore + if _, ok := removed[r.Value]; ok { + continue + } + + // If we removed the parent already, then ignore + if r.Parent != nil { + if _, ok := removed[r.Parent.Value]; ok { + continue + } + } + + // Add this to the removed list + removed[r.Value] = struct{}{} + + switch v := r.Value.(type) { + case *ModuleState: + s.removeModule(v) + case *ResourceState: + s.removeResource(path, v) + case *InstanceState: + s.removeInstance(r.Parent.Value.(*ResourceState), v) + default: + return fmt.Errorf("unknown type to delete: %T", r.Value) + } + } + + // Prune since the removal functions often do the bare minimum to + // remove a thing and may leave around dangling empty modules, resources, + // etc. Prune will clean that all up. + s.prune() + + return nil +} + +func (s *State) removeModule(v *ModuleState) { + for i, m := range s.Modules { + if m == v { + s.Modules, s.Modules[len(s.Modules)-1] = append(s.Modules[:i], s.Modules[i+1:]...), nil + return + } + } +} + +func (s *State) removeResource(path []string, v *ResourceState) { + // Get the module this resource lives in. If it doesn't exist, we're done. + mod := s.moduleByPath(normalizeModulePath(path)) + if mod == nil { + return + } + + // Find this resource. This is a O(N) lookup when if we had the key + // it could be O(1) but even with thousands of resources this shouldn't + // matter right now. We can easily up performance here when the time comes. + for k, r := range mod.Resources { + if r == v { + // Found it + delete(mod.Resources, k) + return + } + } +} + +func (s *State) removeInstance(r *ResourceState, v *InstanceState) { + // Go through the resource and find the instance that matches this + // (if any) and remove it. + + // Check primary + if r.Primary == v { + r.Primary = nil + return + } +} + +// RootModule returns the ModuleState for the root module +func (s *State) RootModule() *ModuleState { + root := s.ModuleByPath(addrs.RootModuleInstance) + if root == nil { + panic("missing root module") + } + return root +} + +// Equal tests if one state is equal to another. +func (s *State) Equal(other *State) bool { + // If one is nil, we do a direct check + if s == nil || other == nil { + return s == other + } + + s.Lock() + defer s.Unlock() + return s.equal(other) +} + +func (s *State) equal(other *State) bool { + if s == nil || other == nil { + return s == other + } + + // If the versions are different, they're certainly not equal + if s.Version != other.Version { + return false + } + + // If any of the modules are not equal, then this state isn't equal + if len(s.Modules) != len(other.Modules) { + return false + } + for _, m := range s.Modules { + // This isn't very optimal currently but works. + otherM := other.moduleByPath(normalizeModulePath(m.Path)) + if otherM == nil { + return false + } + + // If they're not equal, then we're not equal! + if !m.Equal(otherM) { + return false + } + } + + return true +} + +type StateAgeComparison int + +const ( + StateAgeEqual StateAgeComparison = 0 + StateAgeReceiverNewer StateAgeComparison = 1 + StateAgeReceiverOlder StateAgeComparison = -1 +) + +// CompareAges compares one state with another for which is "older". +// +// This is a simple check using the state's serial, and is thus only as +// reliable as the serial itself. In the normal case, only one state +// exists for a given combination of lineage/serial, but Terraform +// does not guarantee this and so the result of this method should be +// used with care. +// +// Returns an integer that is negative if the receiver is older than +// the argument, positive if the converse, and zero if they are equal. +// An error is returned if the two states are not of the same lineage, +// in which case the integer returned has no meaning. +func (s *State) CompareAges(other *State) (StateAgeComparison, error) { + // nil states are "older" than actual states + switch { + case s != nil && other == nil: + return StateAgeReceiverNewer, nil + case s == nil && other != nil: + return StateAgeReceiverOlder, nil + case s == nil && other == nil: + return StateAgeEqual, nil + } + + if !s.SameLineage(other) { + return StateAgeEqual, fmt.Errorf( + "can't compare two states of differing lineage", + ) + } + + s.Lock() + defer s.Unlock() + + switch { + case s.Serial < other.Serial: + return StateAgeReceiverOlder, nil + case s.Serial > other.Serial: + return StateAgeReceiverNewer, nil + default: + return StateAgeEqual, nil + } +} + +// SameLineage returns true only if the state given in argument belongs +// to the same "lineage" of states as the receiver. +func (s *State) SameLineage(other *State) bool { + s.Lock() + defer s.Unlock() + + // If one of the states has no lineage then it is assumed to predate + // this concept, and so we'll accept it as belonging to any lineage + // so that a lineage string can be assigned to newer versions + // without breaking compatibility with older versions. + if s.Lineage == "" || other.Lineage == "" { + return true + } + + return s.Lineage == other.Lineage +} + +// DeepCopy performs a deep copy of the state structure and returns +// a new structure. +func (s *State) DeepCopy() *State { + if s == nil { + return nil + } + + copiedState, err := copystructure.Config{Lock: true}.Copy(s) + if err != nil { + panic(err) + } + + return copiedState.(*State) +} + +func (s *State) Init() { + s.Lock() + defer s.Unlock() + s.init() +} + +func (s *State) init() { + if s.Version == 0 { + s.Version = stateVersion + } + + if s.moduleByPath(addrs.RootModuleInstance) == nil { + s.addModule(addrs.RootModuleInstance) + } + s.ensureHasLineage() + + for _, mod := range s.Modules { + if mod != nil { + mod.init() + } + } + + if s.Remote != nil { + s.Remote.init() + } + +} + +func (s *State) EnsureHasLineage() { + s.Lock() + defer s.Unlock() + + s.ensureHasLineage() +} + +func (s *State) ensureHasLineage() { + if s.Lineage == "" { + lineage, err := uuid.GenerateUUID() + if err != nil { + panic(fmt.Errorf("Failed to generate lineage: %v", err)) + } + s.Lineage = lineage + if os.Getenv("TF_ACC") == "" || os.Getenv("TF_ACC_STATE_LINEAGE") == "1" { + log.Printf("[DEBUG] New state was assigned lineage %q\n", s.Lineage) + } + } else { + if os.Getenv("TF_ACC") == "" || os.Getenv("TF_ACC_STATE_LINEAGE") == "1" { + log.Printf("[TRACE] Preserving existing state lineage %q\n", s.Lineage) + } + } +} + +// AddModuleState insert this module state and override any existing ModuleState +func (s *State) AddModuleState(mod *ModuleState) { + mod.init() + s.Lock() + defer s.Unlock() + + s.addModuleState(mod) +} + +func (s *State) addModuleState(mod *ModuleState) { + for i, m := range s.Modules { + if reflect.DeepEqual(m.Path, mod.Path) { + s.Modules[i] = mod + return + } + } + + s.Modules = append(s.Modules, mod) + s.sort() +} + +// prune is used to remove any resources that are no longer required +func (s *State) prune() { + if s == nil { + return + } + + // Filter out empty modules. + // A module is always assumed to have a path, and it's length isn't always + // bounds checked later on. Modules may be "emptied" during destroy, but we + // never want to store those in the state. + for i := 0; i < len(s.Modules); i++ { + if s.Modules[i] == nil || len(s.Modules[i].Path) == 0 { + s.Modules = append(s.Modules[:i], s.Modules[i+1:]...) + i-- + } + } + + for _, mod := range s.Modules { + mod.prune() + } + if s.Remote != nil && s.Remote.Empty() { + s.Remote = nil + } +} + +// sort sorts the modules +func (s *State) sort() { + sort.Sort(moduleStateSort(s.Modules)) + + // Allow modules to be sorted + for _, m := range s.Modules { + if m != nil { + m.sort() + } + } +} + +func (s *State) String() string { + if s == nil { + return "" + } + s.Lock() + defer s.Unlock() + + var buf bytes.Buffer + for _, m := range s.Modules { + mStr := m.String() + + // If we're the root module, we just write the output directly. + if reflect.DeepEqual(m.Path, rootModulePath) { + buf.WriteString(mStr + "\n") + continue + } + + buf.WriteString(fmt.Sprintf("module.%s:\n", strings.Join(m.Path[1:], "."))) + + s := bufio.NewScanner(strings.NewReader(mStr)) + for s.Scan() { + text := s.Text() + if text != "" { + text = " " + text + } + + buf.WriteString(fmt.Sprintf("%s\n", text)) + } + } + + return strings.TrimSpace(buf.String()) +} + +// BackendState stores the configuration to connect to a remote backend. +type BackendState struct { + Type string `json:"type"` // Backend type + ConfigRaw json.RawMessage `json:"config"` // Backend raw config + Hash uint64 `json:"hash"` // Hash of portion of configuration from config files +} + +// RemoteState is used to track the information about a remote +// state store that we push/pull state to. +type RemoteState struct { + // Type controls the client we use for the remote state + Type string `json:"type"` + + // Config is used to store arbitrary configuration that + // is type specific + Config map[string]string `json:"config"` + + mu sync.Mutex +} + +func (s *RemoteState) Lock() { s.mu.Lock() } +func (s *RemoteState) Unlock() { s.mu.Unlock() } + +func (r *RemoteState) init() { + r.Lock() + defer r.Unlock() + + if r.Config == nil { + r.Config = make(map[string]string) + } +} + +func (r *RemoteState) Empty() bool { + if r == nil { + return true + } + r.Lock() + defer r.Unlock() + + return r.Type == "" +} + +// OutputState is used to track the state relevant to a single output. +type OutputState struct { + // Sensitive describes whether the output is considered sensitive, + // which may lead to masking the value on screen in some cases. + Sensitive bool `json:"sensitive"` + // Type describes the structure of Value. Valid values are "string", + // "map" and "list" + Type string `json:"type"` + // Value contains the value of the output, in the structure described + // by the Type field. + Value interface{} `json:"value"` + + mu sync.Mutex +} + +func (s *OutputState) Lock() { s.mu.Lock() } +func (s *OutputState) Unlock() { s.mu.Unlock() } + +func (s *OutputState) String() string { + return fmt.Sprintf("%#v", s.Value) +} + +// Equal compares two OutputState structures for equality. nil values are +// considered equal. +func (s *OutputState) Equal(other *OutputState) bool { + if s == nil && other == nil { + return true + } + + if s == nil || other == nil { + return false + } + s.Lock() + defer s.Unlock() + + if s.Type != other.Type { + return false + } + + if s.Sensitive != other.Sensitive { + return false + } + + if !reflect.DeepEqual(s.Value, other.Value) { + return false + } + + return true +} + +// ModuleState is used to track all the state relevant to a single +// module. Previous to Terraform 0.3, all state belonged to the "root" +// module. +type ModuleState struct { + // Path is the import path from the root module. Modules imports are + // always disjoint, so the path represents amodule tree + Path []string `json:"path"` + + // Locals are kept only transiently in-memory, because we can always + // re-compute them. + Locals map[string]interface{} `json:"-"` + + // Outputs declared by the module and maintained for each module + // even though only the root module technically needs to be kept. + // This allows operators to inspect values at the boundaries. + Outputs map[string]*OutputState `json:"outputs"` + + // Resources is a mapping of the logically named resource to + // the state of the resource. Each resource may actually have + // N instances underneath, although a user only needs to think + // about the 1:1 case. + Resources map[string]*ResourceState `json:"resources"` + + // Dependencies are a list of things that this module relies on + // existing to remain intact. For example: an module may depend + // on a VPC ID given by an aws_vpc resource. + // + // Terraform uses this information to build valid destruction + // orders and to warn the user if they're destroying a module that + // another resource depends on. + // + // Things can be put into this list that may not be managed by + // Terraform. If Terraform doesn't find a matching ID in the + // overall state, then it assumes it isn't managed and doesn't + // worry about it. + Dependencies []string `json:"depends_on"` + + mu sync.Mutex +} + +func (s *ModuleState) Lock() { s.mu.Lock() } +func (s *ModuleState) Unlock() { s.mu.Unlock() } + +// Equal tests whether one module state is equal to another. +func (m *ModuleState) Equal(other *ModuleState) bool { + m.Lock() + defer m.Unlock() + + // Paths must be equal + if !reflect.DeepEqual(m.Path, other.Path) { + return false + } + + // Outputs must be equal + if len(m.Outputs) != len(other.Outputs) { + return false + } + for k, v := range m.Outputs { + if !other.Outputs[k].Equal(v) { + return false + } + } + + // Dependencies must be equal. This sorts these in place but + // this shouldn't cause any problems. + sort.Strings(m.Dependencies) + sort.Strings(other.Dependencies) + if len(m.Dependencies) != len(other.Dependencies) { + return false + } + for i, d := range m.Dependencies { + if other.Dependencies[i] != d { + return false + } + } + + // Resources must be equal + if len(m.Resources) != len(other.Resources) { + return false + } + for k, r := range m.Resources { + otherR, ok := other.Resources[k] + if !ok { + return false + } + + if !r.Equal(otherR) { + return false + } + } + + return true +} + +func (m *ModuleState) init() { + m.Lock() + defer m.Unlock() + + if m.Path == nil { + m.Path = []string{} + } + if m.Outputs == nil { + m.Outputs = make(map[string]*OutputState) + } + if m.Resources == nil { + m.Resources = make(map[string]*ResourceState) + } + + if m.Dependencies == nil { + m.Dependencies = make([]string, 0) + } + + for _, rs := range m.Resources { + rs.init() + } +} + +// prune is used to remove any resources that are no longer required +func (m *ModuleState) prune() { + m.Lock() + defer m.Unlock() + + for k, v := range m.Resources { + if v == nil || (v.Primary == nil || v.Primary.ID == "") && len(v.Deposed) == 0 { + delete(m.Resources, k) + continue + } + + v.prune() + } + + for k, v := range m.Outputs { + if v.Value == hcl2shim.UnknownVariableValue { + delete(m.Outputs, k) + } + } + + m.Dependencies = uniqueStrings(m.Dependencies) +} + +func (m *ModuleState) sort() { + for _, v := range m.Resources { + v.sort() + } +} + +func (m *ModuleState) String() string { + m.Lock() + defer m.Unlock() + + var buf bytes.Buffer + + if len(m.Resources) == 0 { + buf.WriteString("") + } + + names := make([]string, 0, len(m.Resources)) + for name := range m.Resources { + names = append(names, name) + } + + sort.Sort(resourceNameSort(names)) + + for _, k := range names { + rs := m.Resources[k] + var id string + if rs.Primary != nil { + id = rs.Primary.ID + } + if id == "" { + id = "" + } + + taintStr := "" + if rs.Primary.Tainted { + taintStr = " (tainted)" + } + + deposedStr := "" + if len(rs.Deposed) > 0 { + deposedStr = fmt.Sprintf(" (%d deposed)", len(rs.Deposed)) + } + + buf.WriteString(fmt.Sprintf("%s:%s%s\n", k, taintStr, deposedStr)) + buf.WriteString(fmt.Sprintf(" ID = %s\n", id)) + if rs.Provider != "" { + buf.WriteString(fmt.Sprintf(" provider = %s\n", rs.Provider)) + } + + var attributes map[string]string + if rs.Primary != nil { + attributes = rs.Primary.Attributes + } + attrKeys := make([]string, 0, len(attributes)) + for ak := range attributes { + if ak == "id" { + continue + } + + attrKeys = append(attrKeys, ak) + } + + sort.Strings(attrKeys) + + for _, ak := range attrKeys { + av := attributes[ak] + buf.WriteString(fmt.Sprintf(" %s = %s\n", ak, av)) + } + + for idx, t := range rs.Deposed { + taintStr := "" + if t.Tainted { + taintStr = " (tainted)" + } + buf.WriteString(fmt.Sprintf(" Deposed ID %d = %s%s\n", idx+1, t.ID, taintStr)) + } + + if len(rs.Dependencies) > 0 { + buf.WriteString("\n Dependencies:\n") + for _, dep := range rs.Dependencies { + buf.WriteString(fmt.Sprintf(" %s\n", dep)) + } + } + } + + if len(m.Outputs) > 0 { + buf.WriteString("\nOutputs:\n\n") + + ks := make([]string, 0, len(m.Outputs)) + for k := range m.Outputs { + ks = append(ks, k) + } + + sort.Strings(ks) + + for _, k := range ks { + v := m.Outputs[k] + switch vTyped := v.Value.(type) { + case string: + buf.WriteString(fmt.Sprintf("%s = %s\n", k, vTyped)) + case []interface{}: + buf.WriteString(fmt.Sprintf("%s = %s\n", k, vTyped)) + case map[string]interface{}: + var mapKeys []string + for key := range vTyped { + mapKeys = append(mapKeys, key) + } + sort.Strings(mapKeys) + + var mapBuf bytes.Buffer + mapBuf.WriteString("{") + for _, key := range mapKeys { + mapBuf.WriteString(fmt.Sprintf("%s:%s ", key, vTyped[key])) + } + mapBuf.WriteString("}") + + buf.WriteString(fmt.Sprintf("%s = %s\n", k, mapBuf.String())) + } + } + } + + return buf.String() +} + +// ResourceStateKey is a structured representation of the key used for the +// ModuleState.Resources mapping +type ResourceStateKey struct { + Name string + Type string + Mode ResourceMode + Index int +} + +// Equal determines whether two ResourceStateKeys are the same +func (rsk *ResourceStateKey) Equal(other *ResourceStateKey) bool { + if rsk == nil || other == nil { + return false + } + if rsk.Mode != other.Mode { + return false + } + if rsk.Type != other.Type { + return false + } + if rsk.Name != other.Name { + return false + } + if rsk.Index != other.Index { + return false + } + return true +} + +func (rsk *ResourceStateKey) String() string { + if rsk == nil { + return "" + } + var prefix string + switch rsk.Mode { + case ManagedResourceMode: + prefix = "" + case DataResourceMode: + prefix = "data." + default: + panic(fmt.Errorf("unknown resource mode %s", rsk.Mode)) + } + if rsk.Index == -1 { + return fmt.Sprintf("%s%s.%s", prefix, rsk.Type, rsk.Name) + } + return fmt.Sprintf("%s%s.%s.%d", prefix, rsk.Type, rsk.Name, rsk.Index) +} + +// ParseResourceStateKey accepts a key in the format used by +// ModuleState.Resources and returns a resource name and resource index. In the +// state, a resource has the format "type.name.index" or "type.name". In the +// latter case, the index is returned as -1. +func parseResourceStateKey(k string) (*ResourceStateKey, error) { + parts := strings.Split(k, ".") + mode := ManagedResourceMode + if len(parts) > 0 && parts[0] == "data" { + mode = DataResourceMode + // Don't need the constant "data" prefix for parsing + // now that we've figured out the mode. + parts = parts[1:] + } + if len(parts) < 2 || len(parts) > 3 { + return nil, fmt.Errorf("Malformed resource state key: %s", k) + } + rsk := &ResourceStateKey{ + Mode: mode, + Type: parts[0], + Name: parts[1], + Index: -1, + } + if len(parts) == 3 { + index, err := strconv.Atoi(parts[2]) + if err != nil { + return nil, fmt.Errorf("Malformed resource state key index: %s", k) + } + rsk.Index = index + } + return rsk, nil +} + +// ResourceState holds the state of a resource that is used so that +// a provider can find and manage an existing resource as well as for +// storing attributes that are used to populate variables of child +// resources. +// +// Attributes has attributes about the created resource that are +// queryable in interpolation: "${type.id.attr}" +// +// Extra is just extra data that a provider can return that we store +// for later, but is not exposed in any way to the user. +type ResourceState struct { + // This is filled in and managed by Terraform, and is the resource + // type itself such as "mycloud_instance". If a resource provider sets + // this value, it won't be persisted. + Type string `json:"type"` + + // Dependencies are a list of things that this resource relies on + // existing to remain intact. For example: an AWS instance might + // depend on a subnet (which itself might depend on a VPC, and so + // on). + // + // Terraform uses this information to build valid destruction + // orders and to warn the user if they're destroying a resource that + // another resource depends on. + // + // Things can be put into this list that may not be managed by + // Terraform. If Terraform doesn't find a matching ID in the + // overall state, then it assumes it isn't managed and doesn't + // worry about it. + Dependencies []string `json:"depends_on"` + + // Primary is the current active instance for this resource. + // It can be replaced but only after a successful creation. + // This is the instances on which providers will act. + Primary *InstanceState `json:"primary"` + + // Deposed is used in the mechanics of CreateBeforeDestroy: the existing + // Primary is Deposed to get it out of the way for the replacement Primary to + // be created by Apply. If the replacement Primary creates successfully, the + // Deposed instance is cleaned up. + // + // If there were problems creating the replacement Primary, the Deposed + // instance and the (now tainted) replacement Primary will be swapped so the + // tainted replacement will be cleaned up instead. + // + // An instance will remain in the Deposed list until it is successfully + // destroyed and purged. + Deposed []*InstanceState `json:"deposed"` + + // Provider is used when a resource is connected to a provider with an alias. + // If this string is empty, the resource is connected to the default provider, + // e.g. "aws_instance" goes with the "aws" provider. + // If the resource block contained a "provider" key, that value will be set here. + Provider string `json:"provider"` + + mu sync.Mutex +} + +func (s *ResourceState) Lock() { s.mu.Lock() } +func (s *ResourceState) Unlock() { s.mu.Unlock() } + +// Equal tests whether two ResourceStates are equal. +func (s *ResourceState) Equal(other *ResourceState) bool { + s.Lock() + defer s.Unlock() + + if s.Type != other.Type { + return false + } + + if s.Provider != other.Provider { + return false + } + + // Dependencies must be equal + sort.Strings(s.Dependencies) + sort.Strings(other.Dependencies) + if len(s.Dependencies) != len(other.Dependencies) { + return false + } + for i, d := range s.Dependencies { + if other.Dependencies[i] != d { + return false + } + } + + // States must be equal + return s.Primary.Equal(other.Primary) +} + +func (s *ResourceState) init() { + s.Lock() + defer s.Unlock() + + if s.Primary == nil { + s.Primary = &InstanceState{} + } + s.Primary.init() + + if s.Dependencies == nil { + s.Dependencies = []string{} + } + + if s.Deposed == nil { + s.Deposed = make([]*InstanceState, 0) + } +} + +// prune is used to remove any instances that are no longer required +func (s *ResourceState) prune() { + s.Lock() + defer s.Unlock() + + n := len(s.Deposed) + for i := 0; i < n; i++ { + inst := s.Deposed[i] + if inst == nil || inst.ID == "" { + copy(s.Deposed[i:], s.Deposed[i+1:]) + s.Deposed[n-1] = nil + n-- + i-- + } + } + s.Deposed = s.Deposed[:n] + + s.Dependencies = uniqueStrings(s.Dependencies) +} + +func (s *ResourceState) sort() { + s.Lock() + defer s.Unlock() + + sort.Strings(s.Dependencies) +} + +func (s *ResourceState) String() string { + s.Lock() + defer s.Unlock() + + var buf bytes.Buffer + buf.WriteString(fmt.Sprintf("Type = %s", s.Type)) + return buf.String() +} + +// InstanceState is used to track the unique state information belonging +// to a given instance. +type InstanceState struct { + // A unique ID for this resource. This is opaque to Terraform + // and is only meant as a lookup mechanism for the providers. + ID string `json:"id"` + + // Attributes are basic information about the resource. Any keys here + // are accessible in variable format within Terraform configurations: + // ${resourcetype.name.attribute}. + Attributes map[string]string `json:"attributes"` + + // Ephemeral is used to store any state associated with this instance + // that is necessary for the Terraform run to complete, but is not + // persisted to a state file. + Ephemeral EphemeralState `json:"-"` + + // Meta is a simple K/V map that is persisted to the State but otherwise + // ignored by Terraform core. It's meant to be used for accounting by + // external client code. The value here must only contain Go primitives + // and collections. + Meta map[string]interface{} `json:"meta"` + + ProviderMeta cty.Value + + RawConfig cty.Value + RawState cty.Value + RawPlan cty.Value + + // Tainted is used to mark a resource for recreation. + Tainted bool `json:"tainted"` + + mu sync.Mutex +} + +func (s *InstanceState) Lock() { s.mu.Lock() } +func (s *InstanceState) Unlock() { s.mu.Unlock() } + +func (s *InstanceState) init() { + s.Lock() + defer s.Unlock() + + if s.Attributes == nil { + s.Attributes = make(map[string]string) + } + if s.Meta == nil { + s.Meta = make(map[string]interface{}) + } + s.Ephemeral.init() +} + +// NewInstanceStateShimmedFromValue is a shim method to lower a new-style +// object value representing the attributes of an instance object into the +// legacy InstanceState representation. +// +// This is for shimming to old components only and should not be used in new code. +func NewInstanceStateShimmedFromValue(state cty.Value, schemaVersion int) *InstanceState { + attrs := hcl2shim.FlatmapValueFromHCL2(state) + return &InstanceState{ + ID: attrs["id"], + Attributes: attrs, + Meta: map[string]interface{}{ + "schema_version": schemaVersion, + }, + } +} + +// AttrsAsObjectValue shims from the legacy InstanceState representation to +// a new-style cty object value representation of the state attributes, using +// the given type for guidance. +// +// The given type must be the implied type of the schema of the resource type +// of the object whose state is being converted, or the result is undefined. +// +// This is for shimming from old components only and should not be used in +// new code. +func (s *InstanceState) AttrsAsObjectValue(ty cty.Type) (cty.Value, error) { + if s == nil { + // if the state is nil, we need to construct a complete cty.Value with + // null attributes, rather than a single cty.NullVal(ty) + s = &InstanceState{} + } + + if s.Attributes == nil { + s.Attributes = map[string]string{} + } + + // make sure ID is included in the attributes. The InstanceState.ID value + // takes precedence. + if s.ID != "" { + s.Attributes["id"] = s.ID + } + + return hcl2shim.HCL2ValueFromFlatmap(s.Attributes, ty) +} + +// Copy all the Fields from another InstanceState +func (s *InstanceState) Set(from *InstanceState) { + s.Lock() + defer s.Unlock() + + from.Lock() + defer from.Unlock() + + s.ID = from.ID + s.Attributes = from.Attributes + s.Ephemeral = from.Ephemeral + s.Meta = from.Meta + s.Tainted = from.Tainted +} + +func (s *InstanceState) DeepCopy() *InstanceState { + copiedState, err := copystructure.Config{Lock: true}.Copy(s) + if err != nil { + panic(err) + } + + return copiedState.(*InstanceState) +} + +func (s *InstanceState) Empty() bool { + if s == nil { + return true + } + s.Lock() + defer s.Unlock() + + return s.ID == "" +} + +func (s *InstanceState) Equal(other *InstanceState) bool { + // Short circuit some nil checks + if s == nil || other == nil { + return s == other + } + s.Lock() + defer s.Unlock() + + // IDs must be equal + if s.ID != other.ID { + return false + } + + // Attributes must be equal + if len(s.Attributes) != len(other.Attributes) { + return false + } + for k, v := range s.Attributes { + otherV, ok := other.Attributes[k] + if !ok { + return false + } + + if v != otherV { + return false + } + } + + // Meta must be equal + if len(s.Meta) != len(other.Meta) { + return false + } + if s.Meta != nil && other.Meta != nil { + // We only do the deep check if both are non-nil. If one is nil + // we treat it as equal since their lengths are both zero (check + // above). + // + // Since this can contain numeric values that may change types during + // serialization, let's compare the serialized values. + sMeta, err := json.Marshal(s.Meta) + if err != nil { + // marshaling primitives shouldn't ever error out + panic(err) + } + otherMeta, err := json.Marshal(other.Meta) + if err != nil { + panic(err) + } + + if !bytes.Equal(sMeta, otherMeta) { + return false + } + } + + if s.Tainted != other.Tainted { + return false + } + + return true +} + +// MergeDiff takes a ResourceDiff and merges the attributes into +// this resource state in order to generate a new state. This new +// state can be used to provide updated attribute lookups for +// variable interpolation. +// +// If the diff attribute requires computing the value, and hence +// won't be available until apply, the value is replaced with the +// computeID. +func (s *InstanceState) MergeDiff(d *InstanceDiff) *InstanceState { + result := s.DeepCopy() + if result == nil { + result = new(InstanceState) + } + result.init() + + if s != nil { + s.Lock() + defer s.Unlock() + for k, v := range s.Attributes { + result.Attributes[k] = v + } + } + if d != nil { + for k, diff := range d.CopyAttributes() { + if diff.NewRemoved { + delete(result.Attributes, k) + continue + } + if diff.NewComputed { + result.Attributes[k] = hcl2shim.UnknownVariableValue + continue + } + + result.Attributes[k] = diff.New + } + } + + return result +} + +func (s *InstanceState) String() string { + notCreated := "" + + if s == nil { + return notCreated + } + + s.Lock() + defer s.Unlock() + + var buf bytes.Buffer + + if s.ID == "" { + return notCreated + } + + buf.WriteString(fmt.Sprintf("ID = %s\n", s.ID)) + + attributes := s.Attributes + attrKeys := make([]string, 0, len(attributes)) + for ak := range attributes { + if ak == "id" { + continue + } + + attrKeys = append(attrKeys, ak) + } + sort.Strings(attrKeys) + + for _, ak := range attrKeys { + av := attributes[ak] + buf.WriteString(fmt.Sprintf("%s = %s\n", ak, av)) + } + + buf.WriteString(fmt.Sprintf("Tainted = %t\n", s.Tainted)) + + return buf.String() +} + +// EphemeralState is used for transient state that is only kept in-memory +type EphemeralState struct { + // ConnInfo is used for the providers to export information which is + // used to connect to the resource for provisioning. For example, + // this could contain SSH or WinRM credentials. + ConnInfo map[string]string `json:"-"` + + // Type is used to specify the resource type for this instance. This is only + // required for import operations (as documented). If the documentation + // doesn't state that you need to set this, then don't worry about + // setting it. + Type string `json:"-"` +} + +func (e *EphemeralState) init() { + if e.ConnInfo == nil { + e.ConnInfo = make(map[string]string) + } +} + +// resourceNameSort implements the sort.Interface to sort name parts lexically for +// strings and numerically for integer indexes. +type resourceNameSort []string + +func (r resourceNameSort) Len() int { return len(r) } +func (r resourceNameSort) Swap(i, j int) { r[i], r[j] = r[j], r[i] } + +func (r resourceNameSort) Less(i, j int) bool { + iParts := strings.Split(r[i], ".") + jParts := strings.Split(r[j], ".") + + end := len(iParts) + if len(jParts) < end { + end = len(jParts) + } + + for idx := 0; idx < end; idx++ { + if iParts[idx] == jParts[idx] { + continue + } + + // sort on the first non-matching part + iInt, iIntErr := strconv.Atoi(iParts[idx]) + jInt, jIntErr := strconv.Atoi(jParts[idx]) + + switch { + case iIntErr == nil && jIntErr == nil: + // sort numerically if both parts are integers + return iInt < jInt + case iIntErr == nil: + // numbers sort before strings + return true + case jIntErr == nil: + return false + default: + return iParts[idx] < jParts[idx] + } + } + + return r[i] < r[j] +} + +// moduleStateSort implements sort.Interface to sort module states +type moduleStateSort []*ModuleState + +func (s moduleStateSort) Len() int { + return len(s) +} + +func (s moduleStateSort) Less(i, j int) bool { + a := s[i] + b := s[j] + + // If either is nil, then the nil one is "less" than + if a == nil || b == nil { + return a == nil + } + + // If the lengths are different, then the shorter one always wins + if len(a.Path) != len(b.Path) { + return len(a.Path) < len(b.Path) + } + + // Otherwise, compare lexically + return strings.Join(a.Path, ".") < strings.Join(b.Path, ".") +} + +func (s moduleStateSort) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} + +const stateValidateErrMultiModule = ` +Multiple modules with the same path: %s + +This means that there are multiple entries in the "modules" field +in your state file that point to the same module. This will cause Terraform +to behave in unexpected and error prone ways and is invalid. Please back up +and modify your state file manually to resolve this. +` diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/state_filter.go b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/state_filter.go new file mode 100644 index 000000000000..caf2c79674ba --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/state_filter.go @@ -0,0 +1,273 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package terraform + +import ( + "fmt" + "sort" +) + +// stateFilter is responsible for filtering and searching a state. +// +// This is a separate struct from State rather than a method on State +// because StateFilter might create sidecar data structures to optimize +// filtering on the state. +// +// If you change the State, the filter created is invalid and either +// Reset should be called or a new one should be allocated. StateFilter +// will not watch State for changes and do this for you. If you filter after +// changing the State without calling Reset, the behavior is not defined. +type stateFilter struct { + State *State +} + +// Filter takes the addresses specified by fs and finds all the matches. +// The values of fs are resource addressing syntax that can be parsed by +// parseResourceAddress. +func (f *stateFilter) filter(fs ...string) ([]*stateFilterResult, error) { + // Parse all the addresses + var as []*resourceAddress + + if len(fs) == 0 { + // If we weren't given any filters, then we list all + as = []*resourceAddress{{Index: -1}} + } else { + as = make([]*resourceAddress, len(fs)) + } + + for i, v := range fs { + a, err := parseResourceAddress(v) + if err != nil { + return nil, fmt.Errorf("Error parsing address '%s': %s", v, err) + } + + as[i] = a + } + + // Filter each of the address. We keep track of this in a map to + // strip duplicates. + resultSet := make(map[string]*stateFilterResult) + for _, a := range as { + for _, r := range f.filterSingle(a) { + resultSet[r.String()] = r + } + } + + // Make the result list + results := make([]*stateFilterResult, 0, len(resultSet)) + for _, v := range resultSet { + results = append(results, v) + } + + // Sort them and return + sort.Sort(stateFilterResultSlice(results)) + return results, nil +} + +func (f *stateFilter) filterSingle(a *resourceAddress) []*stateFilterResult { + // The slice to keep track of results + var results []*stateFilterResult + + // Go through modules first. + modules := make([]*ModuleState, 0, len(f.State.Modules)) + for _, m := range f.State.Modules { + if f.relevant(a, m) { + modules = append(modules, m) + + // Only add the module to the results if we haven't specified a type. + // We also ignore the root module. + if a.Type == "" && len(m.Path) > 1 { + results = append(results, &stateFilterResult{ + Path: m.Path[1:], + Address: (&resourceAddress{Path: m.Path[1:]}).String(), + Value: m, + }) + } + } + } + + // With the modules set, go through all the resources within + // the modules to find relevant resources. + for _, m := range modules { + for n, r := range m.Resources { + // The name in the state contains valuable information. Parse. + key, err := parseResourceStateKey(n) + if err != nil { + // If we get an error parsing, then just ignore it + // out of the state. + continue + } + + // Older states and test fixtures often don't contain the + // type directly on the ResourceState. We add this so StateFilter + // is a bit more robust. + if r.Type == "" { + r.Type = key.Type + } + + if f.relevant(a, r) { + if a.Name != "" && a.Name != key.Name { + // Name doesn't match + continue + } + + if a.Index >= 0 && key.Index != a.Index { + // Index doesn't match + continue + } + + if a.Name != "" && a.Name != key.Name { + continue + } + + // Build the address for this resource + addr := &resourceAddress{ + Path: m.Path[1:], + Name: key.Name, + Type: key.Type, + Index: key.Index, + } + + // Add the resource level result + resourceResult := &stateFilterResult{ + Path: addr.Path, + Address: addr.String(), + Value: r, + } + if !a.InstanceTypeSet { + results = append(results, resourceResult) + } + + // Add the instances + if r.Primary != nil { + addr.InstanceType = typePrimary + addr.InstanceTypeSet = false + results = append(results, &stateFilterResult{ + Path: addr.Path, + Address: addr.String(), + Parent: resourceResult, + Value: r.Primary, + }) + } + + for _, instance := range r.Deposed { + if f.relevant(a, instance) { + addr.InstanceType = typeDeposed + addr.InstanceTypeSet = true + results = append(results, &stateFilterResult{ + Path: addr.Path, + Address: addr.String(), + Parent: resourceResult, + Value: instance, + }) + } + } + } + } + } + + return results +} + +// relevant checks for relevance of this address against the given value. +func (f *stateFilter) relevant(addr *resourceAddress, raw interface{}) bool { + switch v := raw.(type) { + case *ModuleState: + path := v.Path[1:] + + if len(addr.Path) > len(path) { + // Longer path in address means there is no way we match. + return false + } + + // Check for a prefix match + for i, p := range addr.Path { + if path[i] != p { + // Any mismatches don't match. + return false + } + } + + return true + case *ResourceState: + if addr.Type == "" { + // If we have no resource type, then we're interested in all! + return true + } + + // If the type doesn't match we fail immediately + if v.Type != addr.Type { + return false + } + + return true + default: + // If we don't know about it, let's just say no + return false + } +} + +// stateFilterResult is a single result from a filter operation. Filter +// can match multiple things within a state (module, resource, instance, etc.) +// and this unifies that. +type stateFilterResult struct { + // Module path of the result + Path []string + + // Address is the address that can be used to reference this exact result. + Address string + + // Parent, if non-nil, is a parent of this result. For instances, the + // parent would be a resource. For resources, the parent would be + // a module. For modules, this is currently nil. + Parent *stateFilterResult + + // Value is the actual value. This must be type switched on. It can be + // any data structures that `State` can hold: `ModuleState`, + // `ResourceState`, `InstanceState`. + Value interface{} +} + +func (r *stateFilterResult) String() string { + return fmt.Sprintf("%T: %s", r.Value, r.Address) +} + +func (r *stateFilterResult) sortedType() int { + switch r.Value.(type) { + case *ModuleState: + return 0 + case *ResourceState: + return 1 + case *InstanceState: + return 2 + default: + return 50 + } +} + +// stateFilterResultSlice is a slice of results that implements +// sort.Interface. The sorting goal is what is most appealing to +// human output. +type stateFilterResultSlice []*stateFilterResult + +func (s stateFilterResultSlice) Len() int { return len(s) } +func (s stateFilterResultSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s stateFilterResultSlice) Less(i, j int) bool { + a, b := s[i], s[j] + + // if these address contain an index, we want to sort by index rather than name + addrA, errA := parseResourceAddress(a.Address) + addrB, errB := parseResourceAddress(b.Address) + if errA == nil && errB == nil && addrA.Name == addrB.Name && addrA.Index != addrB.Index { + return addrA.Index < addrB.Index + } + + // If the addresses are different it is just lexographic sorting + if a.Address != b.Address { + return a.Address < b.Address + } + + // Addresses are the same, which means it matters on the type + return a.sortedType() < b.sortedType() +} diff --git a/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/util.go b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/util.go new file mode 100644 index 000000000000..6353ad27d952 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-testing/terraform/util.go @@ -0,0 +1,25 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package terraform + +import ( + "sort" +) + +// deduplicate a slice of strings +func uniqueStrings(s []string) []string { + if len(s) < 2 { + return s + } + + sort.Strings(s) + result := make([]string, 1, len(s)) + result[0] = s[0] + for i := 1; i < len(s); i++ { + if s[i] != result[len(result)-1] { + result = append(result, s[i]) + } + } + return result +} diff --git a/vendor/github.com/hashicorp/terraform-registry-address/LICENSE b/vendor/github.com/hashicorp/terraform-registry-address/LICENSE index c33dcc7c928c..84cd0643979f 100644 --- a/vendor/github.com/hashicorp/terraform-registry-address/LICENSE +++ b/vendor/github.com/hashicorp/terraform-registry-address/LICENSE @@ -1,3 +1,5 @@ +Copyright (c) 2021 HashiCorp, Inc. + Mozilla Public License, version 2.0 1. Definitions diff --git a/vendor/github.com/manicminer/hamilton-autorest/auth/wrapper.go b/vendor/github.com/manicminer/hamilton-autorest/auth/wrapper.go index 4c0dd32c4d67..b8ca1e922b18 100644 --- a/vendor/github.com/manicminer/hamilton-autorest/auth/wrapper.go +++ b/vendor/github.com/manicminer/hamilton-autorest/auth/wrapper.go @@ -119,6 +119,8 @@ func (a *AuthorizerWrapper) Token() (*oauth2.Token, error) { var adalToken adal.Token if spToken, ok := tokenProviders[0].(ServicePrincipalToken); ok && spToken != nil { adalToken = spToken.Token() + } else if token, ok := tokenProviders[0].(*adal.Token); ok && token != nil { + adalToken = *token } if adalToken.AccessToken == "" { return nil, fmt.Errorf("could not obtain access token from token provider") diff --git a/vendor/github.com/manicminer/hamilton/auth/auth.go b/vendor/github.com/manicminer/hamilton/auth/auth.go index 360687f99832..faf7d34549f4 100644 --- a/vendor/github.com/manicminer/hamilton/auth/auth.go +++ b/vendor/github.com/manicminer/hamilton/auth/auth.go @@ -5,7 +5,7 @@ import ( "crypto/rsa" "crypto/x509" "fmt" - "io/ioutil" + "os" "strings" "golang.org/x/crypto/pkcs12" @@ -126,7 +126,7 @@ func NewMsiAuthorizer(ctx context.Context, api environments.Api, msiEndpoint, cl func NewClientCertificateAuthorizer(ctx context.Context, environment environments.Environment, api environments.Api, tokenVersion TokenVersion, tenantId string, auxTenantIds []string, clientId string, pfxData []byte, pfxPath, pfxPass string) (Authorizer, error) { if len(pfxData) == 0 { var err error - pfxData, err = ioutil.ReadFile(pfxPath) + pfxData, err = os.ReadFile(pfxPath) if err != nil { return nil, fmt.Errorf("could not read pkcs12 store at %q: %s", pfxPath, err) } diff --git a/vendor/github.com/manicminer/hamilton/auth/clientcredentials.go b/vendor/github.com/manicminer/hamilton/auth/clientcredentials.go index 5ab463a6a007..fd0e215050a1 100644 --- a/vendor/github.com/manicminer/hamilton/auth/clientcredentials.go +++ b/vendor/github.com/manicminer/hamilton/auth/clientcredentials.go @@ -15,7 +15,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net/http" "net/url" "strconv" @@ -410,7 +409,7 @@ func clientCredentialsToken(ctx context.Context, endpoint string, params *url.Va } defer resp.Body.Close() - body, err := ioutil.ReadAll(io.LimitReader(resp.Body, 1<<20)) + body, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20)) if err != nil { return nil, fmt.Errorf("clientCredentialsToken: cannot parse response: %v", err) } diff --git a/vendor/github.com/manicminer/hamilton/auth/github.go b/vendor/github.com/manicminer/hamilton/auth/github.go index 48cbf6b82e89..e18e908b83f0 100644 --- a/vendor/github.com/manicminer/hamilton/auth/github.go +++ b/vendor/github.com/manicminer/hamilton/auth/github.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/url" @@ -80,7 +79,7 @@ func (a *GitHubOIDCAuthorizer) githubAssertion() (*string, error) { } defer resp.Body.Close() - body, err := ioutil.ReadAll(io.LimitReader(resp.Body, 1<<20)) + body, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20)) if err != nil { return nil, fmt.Errorf("githubAssertion: cannot parse response: %v", err) } diff --git a/vendor/github.com/manicminer/hamilton/auth/msi.go b/vendor/github.com/manicminer/hamilton/auth/msi.go index ab3f1a47fdbf..fb4ddeaaecb1 100644 --- a/vendor/github.com/manicminer/hamilton/auth/msi.go +++ b/vendor/github.com/manicminer/hamilton/auth/msi.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/url" "strconv" @@ -140,7 +140,7 @@ func azureMetadata(ctx context.Context, url string) (body []byte, err error) { if err != nil { return } - body, err = ioutil.ReadAll(resp.Body) + body, err = io.ReadAll(resp.Body) if err != nil { return } diff --git a/vendor/github.com/manicminer/hamilton/environments/published.go b/vendor/github.com/manicminer/hamilton/environments/published.go index 2d1944f779d2..23deeb47f382 100644 --- a/vendor/github.com/manicminer/hamilton/environments/published.go +++ b/vendor/github.com/manicminer/hamilton/environments/published.go @@ -79,6 +79,7 @@ var PublishedApis = map[string]ApiAppId{ "MicrosoftAzureFrontDoorCdn": "205478c0-bd83-4e1b-a9d6-db63a3e1e1c8", "Microsoft365DataAtRestEncryption": "c066d759-24ae-40e7-a56f-027002b5d3e4", "MicrosoftGraph": "00000003-0000-0000-c000-000000000000", + "Microsoft.StorageSync": "9469b9f5-6722-4481-a2b2-14ed560b706f", "MicrosoftInvoicing": "b6b84568-6c01-4981-a80f-09da9a20bbed", "Office365Connectors": "48af08dc-f6d2-435f-b2a7-069abd99c086", "Office365Demeter": "982bda36-4632-4165-a46a-9863b1bbcf7d", diff --git a/vendor/github.com/manicminer/hamilton/msgraph/accesspackageresource.go b/vendor/github.com/manicminer/hamilton/msgraph/accesspackageresource.go index 711694e19ff6..33bbd3cd4463 100644 --- a/vendor/github.com/manicminer/hamilton/msgraph/accesspackageresource.go +++ b/vendor/github.com/manicminer/hamilton/msgraph/accesspackageresource.go @@ -57,7 +57,7 @@ func (c *AccessPackageResourceClient) Get(ctx context.Context, catalogId string, resp, status, _, err := c.BaseClient.Get(ctx, GetHttpRequestInput{ ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc, OData: odata.Query{ - Filter: fmt.Sprintf("startswith(originId,'%s')", originId), + Filter: fmt.Sprintf("originId eq '%s'", originId), }, ValidStatusCodes: []int{http.StatusOK}, Uri: Uri{ @@ -82,7 +82,11 @@ func (c *AccessPackageResourceClient) Get(ctx context.Context, catalogId string, return nil, status, fmt.Errorf("json.Unmarshal(): %v", err) } - accessPackageResource := data.AccessPackageResources[0] + accessPackageResources := data.AccessPackageResources - return &accessPackageResource, status, nil + if len(accessPackageResources) == 0 { + return nil, status, fmt.Errorf("No accessPackageResource found with catalogId %v and originId %v", catalogId, originId) + } + + return &accessPackageResources[0], status, nil } diff --git a/vendor/github.com/manicminer/hamilton/msgraph/administrative_units.go b/vendor/github.com/manicminer/hamilton/msgraph/administrative_units.go index 04b5b3008e01..bc35feb30b76 100644 --- a/vendor/github.com/manicminer/hamilton/msgraph/administrative_units.go +++ b/vendor/github.com/manicminer/hamilton/msgraph/administrative_units.go @@ -241,6 +241,41 @@ func (c *AdministrativeUnitsClient) GetMember(ctx context.Context, administrativ return &data.Id, status, nil } +func (c *AdministrativeUnitsClient) CreateGroup(ctx context.Context, administrativeUnitId string, group *Group) (*Group, int, error) { + var status int + odataTypeGroup := odata.TypeGroup + group.ODataType = &odataTypeGroup + body, err := json.Marshal(group) + if err != nil { + return nil, status, fmt.Errorf("json.Marshal(): %v", err) + } + response, status, _, err := c.BaseClient.Post(ctx, PostHttpRequestInput{ + Body: body, + ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc, + ValidStatusCodes: []int{http.StatusCreated}, + Uri: Uri{ + Entity: fmt.Sprintf("/administrativeUnits/%s/members", administrativeUnitId), + HasTenantId: true, + }, + }) + if err != nil { + return nil, status, fmt.Errorf("AdministrativeUnitsClient.BaseClient.Post(): %v", err) + } + + defer response.Body.Close() + responseBody, err := io.ReadAll(response.Body) + if err != nil { + return nil, status, fmt.Errorf("io.ReadAll(): %v", err) + } + + var newGroup Group + if err := json.Unmarshal(responseBody, &newGroup); err != nil { + return nil, status, fmt.Errorf("json.Unmarshal(): %v", err) + } + + return &newGroup, status, nil +} + // AddMembers adds new members to a AdministrativeUnit. func (c *AdministrativeUnitsClient) AddMembers(ctx context.Context, administrativeUnitId string, members *Members) (int, error) { var status int diff --git a/vendor/github.com/manicminer/hamilton/msgraph/applications.go b/vendor/github.com/manicminer/hamilton/msgraph/applications.go index a0b20ba5c532..4c3e84260abd 100644 --- a/vendor/github.com/manicminer/hamilton/msgraph/applications.go +++ b/vendor/github.com/manicminer/hamilton/msgraph/applications.go @@ -155,7 +155,7 @@ func (c *ApplicationsClient) GetDeleted(ctx context.Context, id string, query od func (c *ApplicationsClient) Update(ctx context.Context, application Application) (int, error) { var status int - if application.ID == nil { + if application.ID() == nil { return status, errors.New("ApplicationsClient.Update(): cannot update application with nil ID") } @@ -182,7 +182,7 @@ func (c *ApplicationsClient) Update(ctx context.Context, application Application ConsistencyFailureFunc: checkApplicationConsistency, ValidStatusCodes: []int{http.StatusNoContent}, Uri: Uri{ - Entity: fmt.Sprintf("/applications/%s", *application.ID), + Entity: fmt.Sprintf("/applications/%s", *application.ID()), HasTenantId: true, }, }) @@ -378,10 +378,7 @@ func (c *ApplicationsClient) ListOwners(ctx context.Context, id string) (*[]stri } var data struct { - Owners []struct { - Type string `json:"@odata.type"` - Id string `json:"id"` - } `json:"value"` + Owners []DirectoryObject `json:"value"` } if err := json.Unmarshal(respBody, &data); err != nil { return nil, status, fmt.Errorf("json.Unmarshal(): %v", err) @@ -389,7 +386,9 @@ func (c *ApplicationsClient) ListOwners(ctx context.Context, id string) (*[]stri ret := make([]string, len(data.Owners)) for i, v := range data.Owners { - ret[i] = v.Id + if d := v.ID(); d != nil { + ret[i] = *d + } } return &ret, status, nil @@ -438,7 +437,7 @@ func (c *ApplicationsClient) GetOwner(ctx context.Context, applicationId, ownerI func (c *ApplicationsClient) AddOwners(ctx context.Context, application *Application) (int, error) { var status int - if application.ID == nil { + if application.ID() == nil { return status, errors.New("cannot update application with nil ID") } if application.Owners == nil { @@ -465,7 +464,7 @@ func (c *ApplicationsClient) AddOwners(ctx context.Context, application *Applica ValidStatusCodes: []int{http.StatusNoContent}, ValidStatusFunc: checkOwnerAlreadyExists, Uri: Uri{ - Entity: fmt.Sprintf("/applications/%s/owners/$ref", *application.ID), + Entity: fmt.Sprintf("/applications/%s/owners/$ref", *application.ID()), HasTenantId: true, }, }) diff --git a/vendor/github.com/manicminer/hamilton/msgraph/claims_mapping_policy.go b/vendor/github.com/manicminer/hamilton/msgraph/claims_mapping_policy.go index 08e14b1c82cf..6adf9aa866e4 100644 --- a/vendor/github.com/manicminer/hamilton/msgraph/claims_mapping_policy.go +++ b/vendor/github.com/manicminer/hamilton/msgraph/claims_mapping_policy.go @@ -125,12 +125,13 @@ func (c *ClaimsMappingPolicyClient) Get(ctx context.Context, id string, query od func (c *ClaimsMappingPolicyClient) Update(ctx context.Context, claimsMappingPolicy ClaimsMappingPolicy) (int, error) { var status int - if claimsMappingPolicy.ID == nil { + if claimsMappingPolicy.ID() == nil { return status, fmt.Errorf("cannot update ClaimsMappingPolicy with nil ID") } - claimsMappingPolicyId := *claimsMappingPolicy.ID - claimsMappingPolicy.ID = nil + claimsMappingPolicyId := *claimsMappingPolicy.ID() + claimsMappingPolicy.Id = nil + claimsMappingPolicy.ObjectId = nil body, err := json.Marshal(claimsMappingPolicy) if err != nil { diff --git a/vendor/github.com/manicminer/hamilton/msgraph/connectedorganization.go b/vendor/github.com/manicminer/hamilton/msgraph/connectedorganization.go new file mode 100644 index 000000000000..3d92790fe503 --- /dev/null +++ b/vendor/github.com/manicminer/hamilton/msgraph/connectedorganization.go @@ -0,0 +1,341 @@ +package msgraph + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + + "github.com/manicminer/hamilton/internal/utils" + "github.com/manicminer/hamilton/odata" +) + +type ConnectedOrganizationClient struct { + BaseClient Client +} + +func NewConnectedOrganizationClient(tenantId string) *ConnectedOrganizationClient { + return &ConnectedOrganizationClient{ + BaseClient: NewClient(Version10, tenantId), + } +} + +// List returns a list of ConnectedOrganization +// https://docs.microsoft.com/graph/api/entitlementmanagement-list-connectedorganizations +func (c *ConnectedOrganizationClient) List(ctx context.Context, query odata.Query) (*[]ConnectedOrganization, int, error) { + resp, status, _, err := c.BaseClient.Get(ctx, GetHttpRequestInput{ + DisablePaging: query.Top > 0, + OData: query, + ValidStatusCodes: []int{http.StatusOK}, + Uri: Uri{ + Entity: "/identityGovernance/entitlementManagement/connectedOrganizations", + HasTenantId: true, + }, + }) + if err != nil { + return nil, status, fmt.Errorf("ConnectedOrganizationClient.BaseClient.Get(): %v", err) + } + + defer resp.Body.Close() + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return nil, status, fmt.Errorf("io.ReadAll(): %v", err) + } + + var data struct { + ConnectedOrganizations []ConnectedOrganization `json:"value"` + } + if err := json.Unmarshal(respBody, &data); err != nil { + return nil, status, fmt.Errorf("json.Unmarshal(): %v", err) + } + + return &data.ConnectedOrganizations, status, nil +} + +// Create creates a new ConnectedOrganization. +// https://docs.microsoft.com/graph/api/entitlementmanagement-post-connectedorganizations +func (c *ConnectedOrganizationClient) Create(ctx context.Context, connectedOrganization ConnectedOrganization) (*ConnectedOrganization, int, error) { + var status int + body, err := json.Marshal(connectedOrganization) + if err != nil { + return nil, status, fmt.Errorf("json.Marshal(): %v", err) + } + + resp, status, _, err := c.BaseClient.Post(ctx, PostHttpRequestInput{ + Body: body, + ValidStatusCodes: []int{http.StatusCreated}, + Uri: Uri{ + Entity: "/identityGovernance/entitlementManagement/connectedOrganizations", + HasTenantId: true, + }, + }) + if err != nil { + return nil, status, fmt.Errorf("ConnectedOrganizationClient.BaseClient.Post(): %v", err) + } + + defer resp.Body.Close() + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return nil, status, fmt.Errorf("io.ReadAll(): %v", err) + } + + var newConnectedOrganization ConnectedOrganization + if err := json.Unmarshal(respBody, &newConnectedOrganization); err != nil { + return nil, status, fmt.Errorf("json.Unmarshal(): %v", err) + } + + return &newConnectedOrganization, status, nil +} + +// Get retrieves a ConnectedOrganization. +// https://docs.microsoft.com/graph/api/connectedorganization-get +func (c *ConnectedOrganizationClient) Get(ctx context.Context, id string, query odata.Query) (*ConnectedOrganization, int, error) { + resp, status, _, err := c.BaseClient.Get(ctx, GetHttpRequestInput{ + ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc, + OData: query, + ValidStatusCodes: []int{http.StatusOK}, + Uri: Uri{ + Entity: fmt.Sprintf("/identityGovernance/entitlementManagement/connectedOrganizations/%s", id), + HasTenantId: true, + }, + }) + if err != nil { + return nil, status, fmt.Errorf("ConnectedOrganizationClient.BaseClient.Get(): %v", err) + } + + defer resp.Body.Close() + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return nil, status, fmt.Errorf("io.ReadAll(): %v", err) + } + + var connectedOrganization ConnectedOrganization + if err := json.Unmarshal(respBody, &connectedOrganization); err != nil { + return nil, status, fmt.Errorf("json.Unmarshal(): %v", err) + } + + return &connectedOrganization, status, nil +} + +// Update amends an existing ConnectedOrganization. +// https://docs.microsoft.com/graph/api/connectedorganization-update +func (c *ConnectedOrganizationClient) Update(ctx context.Context, connectedOrganization ConnectedOrganization) (int, error) { + var status int + + if connectedOrganization.ID == nil { + return status, errors.New("cannot update ConnectedOrganization with nil ID") + } + + // These are the only properties that can up updated. + updatedOrg := ConnectedOrganization{ + DisplayName: connectedOrganization.DisplayName, + Description: connectedOrganization.Description, + State: connectedOrganization.State, + } + + body, err := json.Marshal(updatedOrg) + if err != nil { + return status, fmt.Errorf("json.Marshal(): %v", err) + } + + _, status, _, err = c.BaseClient.Patch(ctx, PatchHttpRequestInput{ + Body: body, + ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc, + ValidStatusCodes: []int{http.StatusNoContent}, + Uri: Uri{ + Entity: fmt.Sprintf("/identityGovernance/entitlementManagement/connectedOrganizations/%s", *connectedOrganization.ID), + HasTenantId: true, + }, + }) + if err != nil { + return status, fmt.Errorf("ConnectedOrganizationClient.BaseClient.Patch(): %v", err) + } + + return status, nil +} + +// Delete removes a ConnectedOrganization. +// https://docs.microsoft.com/graph/api/connectedorganization-delete +func (c *ConnectedOrganizationClient) Delete(ctx context.Context, id string) (int, error) { + _, status, _, err := c.BaseClient.Delete(ctx, DeleteHttpRequestInput{ + ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc, + ValidStatusCodes: []int{http.StatusNoContent}, + Uri: Uri{ + Entity: fmt.Sprintf("/identityGovernance/entitlementManagement/connectedOrganizations/%s", id), + HasTenantId: true, + }, + }) + if err != nil { + return status, fmt.Errorf("ConnectedOrganizationClient.BaseClient.Delete(): %v", err) + } + + return status, nil +} + +// List the external sponsors for a connected organization. +// https://docs.microsoft.com/graph/api/connectedorganization-list-externalsponsors +func (c *ConnectedOrganizationClient) ListExternalSponsors(ctx context.Context, query odata.Query, id string) (*[]DirectoryObject, int, error) { + return listSponsors(&c.BaseClient, ctx, query, id, true) +} + +// List the internal sponsors for a connected organization. +// https://docs.microsoft.com/graph/api/connectedorganization-list-internalsponsors +func (c *ConnectedOrganizationClient) ListInternalSponsors(ctx context.Context, query odata.Query, id string) (*[]DirectoryObject, int, error) { + return listSponsors(&c.BaseClient, ctx, query, id, false) +} + +// Add a user as an external sponsor to the connected organization. +// https://docs.microsoft.com/graph/api/connectedorganization-post-externalsponsors +func (c *ConnectedOrganizationClient) AddExternalSponsorUser(ctx context.Context, orgId string, userId string) error { + return addSponsor(&c.BaseClient, ctx, orgId, userId, true, false) +} + +// Add a group as an external sponsor to the connected organization. +// https://docs.microsoft.com/graph/api/connectedorganization-post-externalsponsors +func (c *ConnectedOrganizationClient) AddExternalSponsorGroup(ctx context.Context, orgId string, grpId string) error { + return addSponsor(&c.BaseClient, ctx, orgId, grpId, true, true) +} + +// Add a user as an external sponsor to the connected organization. +// https://docs.microsoft.com/graph/api/connectedorganization-post-internalsponsors +func (c *ConnectedOrganizationClient) AddInternalSponsorUser(ctx context.Context, orgId string, userId string) error { + return addSponsor(&c.BaseClient, ctx, orgId, userId, false, false) +} + +// Add a group as an external sponsor to the connected organization. +// https://docs.microsoft.com/graph/api/connectedorganization-post-internalsponsors +func (c *ConnectedOrganizationClient) AddInternalSponsorGroup(ctx context.Context, orgId string, grpId string) error { + return addSponsor(&c.BaseClient, ctx, orgId, grpId, false, true) +} + +// Delete a user or group as an external sponsor to the connected organization. +// https://docs.microsoft.com/graph/api/connectedorganization-delete-externalsponsors +func (c *ConnectedOrganizationClient) DeleteExternalSponsor(ctx context.Context, orgId string, id string) error { + return deleteSponsor(&c.BaseClient, ctx, orgId, id, true) +} + +// Delete a user or group as an internal sponsor to the connected organization. +// https://docs.microsoft.com/graph/api/connectedorganization-delete-internalsponsors +func (c *ConnectedOrganizationClient) DeleteInternalSponsor(ctx context.Context, orgId string, id string) error { + return deleteSponsor(&c.BaseClient, ctx, orgId, id, false) +} + +func addSponsor(client *Client, ctx context.Context, orgId string, userOrGroupId string, external bool, group bool) error { + if !ValidateId(&orgId) { + return fmt.Errorf("the id %q is not a valid connected organization id", orgId) + } + if !ValidateId(&userOrGroupId) { + return fmt.Errorf("the id %q is not a valid user/group id", userOrGroupId) + } + + var userOrGroup string + if group { + userOrGroup = "/groups/" + } else { + userOrGroup = "/users/" + } + + extUser := Ref{ + ObjectUri: utils.StringPtr(string(client.Endpoint) + "/" + string(client.ApiVersion) + userOrGroup + userOrGroupId), + } + + body, err := json.Marshal(extUser) + if err != nil { + return fmt.Errorf("json.Marshal(): %v", err) + } + + var internalOrExternal string + if external { + internalOrExternal = "externalSponsors" + } else { + internalOrExternal = "internalSponsors" + } + + _, status, _, err := client.Post(ctx, PostHttpRequestInput{ + Uri: Uri{ + Entity: fmt.Sprintf("/identityGovernance/entitlementManagement/connectedOrganizations/%s/%s/$ref", orgId, internalOrExternal), + HasTenantId: true, + }, + ValidStatusCodes: []int{http.StatusNoContent}, + Body: body, + }) + + if err != nil { + return fmt.Errorf("AddExternalSponsorUser returned status code %d: %v", status, err) + } + + return nil +} + +// List the internal/external sponsors for a connected organization. +func listSponsors(c *Client, ctx context.Context, query odata.Query, id string, external bool) (*[]DirectoryObject, int, error) { + if !ValidateId(&id) { + return nil, 0, fmt.Errorf("the id %q is not a valid connected organization id", id) + } + + var internalOrExternal string + if external { + internalOrExternal = "externalSponsors" + } else { + internalOrExternal = "internalSponsors" + } + + resp, status, _, err := c.Get(ctx, GetHttpRequestInput{ + DisablePaging: query.Top > 0, + OData: query, + ValidStatusCodes: []int{http.StatusOK}, + Uri: Uri{ + Entity: fmt.Sprintf("/identityGovernance/entitlementManagement/connectedOrganizations/%s/%s", id, internalOrExternal), + HasTenantId: true, + }, + }) + if err != nil { + return nil, status, fmt.Errorf("ConnectedOrganizationClient.BaseClient.Get(): %v", err) + } + + defer resp.Body.Close() + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return nil, status, fmt.Errorf("io.ReadAll(): %v", err) + } + + var data struct { + ExternalSponsors []DirectoryObject `json:"value"` + } + if err := json.Unmarshal(respBody, &data); err != nil { + return nil, status, fmt.Errorf("json.Unmarshal(): %v", err) + } + + return &data.ExternalSponsors, status, nil +} + +func deleteSponsor(c *Client, ctx context.Context, orgId string, id string, external bool) error { + if !ValidateId(&orgId) { + return fmt.Errorf("the id %q is not a valid connected organization id", id) + } + if !ValidateId(&id) { + return fmt.Errorf("the id %q is not a valid user/group id", id) + } + var internalOrExternal string + if external { + internalOrExternal = "externalSponsors" + } else { + internalOrExternal = "internalSponsors" + } + + _, status, _, err := c.Delete(ctx, DeleteHttpRequestInput{ + Uri: Uri{ + Entity: fmt.Sprintf("/identityGovernance/entitlementManagement/connectedOrganizations/%s/%s/%s/$ref", orgId, internalOrExternal, id), + HasTenantId: true, + }, + ValidStatusCodes: []int{http.StatusNoContent}, + }) + + if err != nil { + return fmt.Errorf("DeleteSponsor returned status code %d: %v", status, err) + } + + return nil +} diff --git a/vendor/github.com/manicminer/hamilton/msgraph/directory_objects.go b/vendor/github.com/manicminer/hamilton/msgraph/directory_objects.go index 689fe1eef4f4..1e0103c140eb 100644 --- a/vendor/github.com/manicminer/hamilton/msgraph/directory_objects.go +++ b/vendor/github.com/manicminer/hamilton/msgraph/directory_objects.go @@ -46,13 +46,11 @@ func (c *DirectoryObjectsClient) Get(ctx context.Context, id string, query odata return nil, status, fmt.Errorf("io.ReadAll(): %v", err) } - var data map[string]interface{} - if err := json.Unmarshal(respBody, &data); err != nil { + directoryObject := DirectoryObject{} + if err = directoryObject.UnmarshalJSONWithAdditionalData(respBody); err != nil { return nil, status, fmt.Errorf("json.Unmarshal(): %v", err) } - directoryObject := c.translateResultToDirectoryObject(data) - return &directoryObject, status, nil } @@ -91,7 +89,7 @@ func (c *DirectoryObjectsClient) GetByIds(ctx context.Context, ids []string, typ } var rawData struct { - Objects []map[string]interface{} `json:"value"` + Objects []json.RawMessage `json:"value"` } if err := json.Unmarshal(respBody, &rawData); err != nil { return nil, status, fmt.Errorf("json.Unmarshal(): %v", err) @@ -101,8 +99,12 @@ func (c *DirectoryObjectsClient) GetByIds(ctx context.Context, ids []string, typ Objects []DirectoryObject `json:"value"` } - for _, row := range rawData.Objects { - data.Objects = append(data.Objects, c.translateResultToDirectoryObject(row)) + for _, rawObj := range rawData.Objects { + directoryObject := DirectoryObject{} + if err = directoryObject.UnmarshalJSONWithAdditionalData(rawObj); err != nil { + return nil, status, fmt.Errorf("json.Unmarshal(): %v", err) + } + data.Objects = append(data.Objects, directoryObject) } return &data.Objects, status, nil @@ -167,7 +169,7 @@ func (c *DirectoryObjectsClient) GetMemberGroups(ctx context.Context, id string, result := make([]DirectoryObject, len(data.IDs)) for i, id := range data.IDs { - result[i].ID = utils.StringPtr(id) + result[i].Id = utils.StringPtr(id) } return &result, status, nil @@ -215,43 +217,8 @@ func (c *DirectoryObjectsClient) GetMemberObjects(ctx context.Context, id string result := make([]DirectoryObject, len(data.IDs)) for i, id := range data.IDs { - result[i].ID = utils.StringPtr(id) + result[i].Id = utils.StringPtr(id) } return &result, status, nil } - -// translateResultToDirectoryObject translates directory object data into DirectoryObject -func (c *DirectoryObjectsClient) translateResultToDirectoryObject(data map[string]interface{}) DirectoryObject { - object := DirectoryObject{ - AdditionalData: data, - } - - if val, exists := data["@odata.id"]; exists { - if v, ok := val.(string); ok { - odataId := odata.Id(v) - object.ODataId = &odataId - } - } - - if val, exists := data["@odata.type"]; exists { - if v, ok := val.(string); ok { - odataType := odata.Type(v) - object.ODataType = &odataType - } - } - - if val, exists := data["id"]; exists { - if v, ok := val.(string); ok { - object.ID = &v - } - } - - if val, exists := data["displayName"]; exists { - if v, ok := val.(string); ok { - object.DisplayName = &v - } - } - - return object -} diff --git a/vendor/github.com/manicminer/hamilton/msgraph/directory_roles.go b/vendor/github.com/manicminer/hamilton/msgraph/directory_roles.go index 35b546b21eed..7dd17ad44745 100644 --- a/vendor/github.com/manicminer/hamilton/msgraph/directory_roles.go +++ b/vendor/github.com/manicminer/hamilton/msgraph/directory_roles.go @@ -152,7 +152,7 @@ func (c *DirectoryRolesClient) ListMembers(ctx context.Context, id string) (*[]s func (c *DirectoryRolesClient) AddMembers(ctx context.Context, directoryRole *DirectoryRole) (int, error) { var status int - if directoryRole.ID == nil { + if directoryRole.ID() == nil { return status, errors.New("cannot update directory role with nil ID") } if directoryRole.Members == nil { @@ -178,7 +178,7 @@ func (c *DirectoryRolesClient) AddMembers(ctx context.Context, directoryRole *Di ValidStatusCodes: []int{http.StatusNoContent}, ValidStatusFunc: checkMemberAlreadyExists, Uri: Uri{ - Entity: fmt.Sprintf("/directoryRoles/%s/members/$ref", *directoryRole.ID), + Entity: fmt.Sprintf("/directoryRoles/%s/members/$ref", *directoryRole.ID()), HasTenantId: true, }, }) diff --git a/vendor/github.com/manicminer/hamilton/msgraph/groups.go b/vendor/github.com/manicminer/hamilton/msgraph/groups.go index 8ec7bede8753..e1a8faaef1c5 100644 --- a/vendor/github.com/manicminer/hamilton/msgraph/groups.go +++ b/vendor/github.com/manicminer/hamilton/msgraph/groups.go @@ -62,16 +62,16 @@ func (c *GroupsClient) Create(ctx context.Context, group Group) (*Group, int, er return nil, status, fmt.Errorf("json.Marshal(): %v", err) } - ownersNotReplicated := func(resp *http.Response, o *odata.OData) bool { + consistencyFunc := func(resp *http.Response, o *odata.OData) bool { if resp != nil && resp.StatusCode == http.StatusBadRequest && o != nil && o.Error != nil { - return o.Error.Match(odata.ErrorResourceDoesNotExist) + return o.Error.Match(odata.ErrorPropertyValuesAreInvalid) || o.Error.Match(odata.ErrorResourceDoesNotExist) } return false } resp, status, _, err := c.BaseClient.Post(ctx, PostHttpRequestInput{ Body: body, - ConsistencyFailureFunc: ownersNotReplicated, + ConsistencyFailureFunc: consistencyFunc, OData: odata.Query{ Metadata: odata.MetadataFull, }, @@ -206,12 +206,13 @@ func (c *GroupsClient) GetDeleted(ctx context.Context, id string, query odata.Qu func (c *GroupsClient) Update(ctx context.Context, group Group) (int, error) { var status int - if group.ID == nil { + if group.ID() == nil { return status, fmt.Errorf("cannot update group with nil ID") } - groupId := *group.ID - group.ID = nil + groupId := *group.ID() + group.Id = nil + group.ObjectId = nil body, err := json.Marshal(group) if err != nil { @@ -368,6 +369,48 @@ func (c *GroupsClient) ListMembers(ctx context.Context, id string) (*[]string, i return &ret, status, nil } +// ListTransitiveMembers retrieves a flat list of all nested members of the specified Group. +// id is the object ID of the group. +func (c *GroupsClient) ListTransitiveMembers(ctx context.Context, id string) (*[]string, int, error) { + resp, status, _, err := c.BaseClient.Get(ctx, GetHttpRequestInput{ + ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc, + OData: odata.Query{ + Select: []string{"id"}, + }, + ValidStatusCodes: []int{http.StatusOK}, + Uri: Uri{ + Entity: fmt.Sprintf("/groups/%s/transitiveMembers", id), + HasTenantId: true, + }, + }) + if err != nil { + return nil, status, fmt.Errorf("GroupsClient.BaseClient.Get(): %v", err) + } + + defer resp.Body.Close() + respBody, err := io.ReadAll(resp.Body) + if err != nil { + return nil, status, fmt.Errorf("io.ReadAll(): %v", err) + } + + var data struct { + Members []struct { + Type string `json:"@odata.type"` + Id string `json:"id"` + } `json:"value"` + } + if err := json.Unmarshal(respBody, &data); err != nil { + return nil, status, fmt.Errorf("json.Unmarshal(): %v", err) + } + + ret := make([]string, len(data.Members)) + for i, v := range data.Members { + ret[i] = v.Id + } + + return &ret, status, nil +} + // GetMember retrieves a single member of the specified Group. // groupId is the object ID of the group. // memberId is the object ID of the member object. @@ -435,7 +478,7 @@ func (c *GroupsClient) AddMembers(ctx context.Context, group *Group) (int, error ValidStatusCodes: []int{http.StatusNoContent}, ValidStatusFunc: checkMemberAlreadyExists, Uri: Uri{ - Entity: fmt.Sprintf("/groups/%s/members/$ref", *group.ID), + Entity: fmt.Sprintf("/groups/%s/members/$ref", *group.ID()), HasTenantId: true, }, }) @@ -601,7 +644,7 @@ func (c *GroupsClient) AddOwners(ctx context.Context, group *Group) (int, error) ValidStatusCodes: []int{http.StatusNoContent}, ValidStatusFunc: checkOwnerAlreadyExists, Uri: Uri{ - Entity: fmt.Sprintf("/groups/%s/owners/$ref", *group.ID), + Entity: fmt.Sprintf("/groups/%s/owners/$ref", *group.ID()), HasTenantId: true, }, }) diff --git a/vendor/github.com/manicminer/hamilton/msgraph/models.go b/vendor/github.com/manicminer/hamilton/msgraph/models.go index 9019862a3e40..b1c70c4d550a 100644 --- a/vendor/github.com/manicminer/hamilton/msgraph/models.go +++ b/vendor/github.com/manicminer/hamilton/msgraph/models.go @@ -90,7 +90,7 @@ type AccessPackageResource struct { AccessPackageResourceEnvironment *AccessPackageResourceEnvironment `json:"accessPackageResourceEnvironment,omitempty"` AddedBy *string `json:"addedBy,omitempty"` AddedOn *time.Time `json:"addedOn,omitempty"` - Description *bool `json:"description,omitempty"` + Description *string `json:"description,omitempty"` DisplayName *string `json:"displayName,omitempty"` ID *string `json:"id,omitempty"` IsPendingOnboarding *bool `json:"isPendingOnboarding,omitempty"` @@ -202,6 +202,7 @@ type Application struct { CreatedDateTime *time.Time `json:"createdDateTime,omitempty"` DefaultRedirectUri *string `json:"defaultRedirectUri,omitempty"` DeletedDateTime *time.Time `json:"deletedDateTime,omitempty"` + Description *StringNullWhenEmpty `json:"description,omitempty"` DisabledByMicrosoftStatus interface{} `json:"disabledByMicrosoftStatus,omitempty"` DisplayName *string `json:"displayName,omitempty"` GroupMembershipClaims *[]GroupMembershipClaim `json:"-"` // see Application.MarshalJSON / Application.UnmarshalJSON @@ -667,6 +668,18 @@ type CredentialUserRegistrationDetails struct { UserPrincipalName *string `json:"UserPrincipalName,omitempty"` } +// In Azure AD entitlement management, a connected organization is a reference to a +// directory or domain of another organization whose users can request access. +type ConnectedOrganization struct { + ID *string `json:"id,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + IdentitySources *[]IdentitySource `json:"identitySources,omitempty"` + State *ConnectedOrganizationState `json:"state,omitempty"` + CreatedDateTime *time.Time `json:"createdDateTime,omitempty"` + ModifiedDateTime *time.Time `json:"modifiedDateTime,omitempty"` +} + type DelegatedPermissionGrant struct { Id *string `json:"id,omitempty"` ClientId *string `json:"clientId,omitempty"` @@ -749,16 +762,38 @@ type DirectoryAudit struct { type DirectoryObject struct { ODataId *odata.Id `json:"@odata.id,omitempty"` ODataType *odata.Type `json:"@odata.type,omitempty"` - ID *string `json:"id,omitempty"` + Id *string `json:"id,omitempty"` + ObjectId *string `json:"objectId,omitempty"` DisplayName *string `json:"displayName,omitempty"` AdditionalData map[string]interface{} `json:"-"` } +func (o *DirectoryObject) ID() (id *string) { + if o.Id != nil { + id = o.Id + } else if o.ObjectId != nil { + id = o.ObjectId + } + return +} + +func (o *DirectoryObject) UnmarshalJSONWithAdditionalData(data []byte) error { + type directoryObject DirectoryObject + obj := (*directoryObject)(o) + if err := json.Unmarshal(data, &obj); err != nil { + return err + } + if err := json.Unmarshal(data, &obj.AdditionalData); err != nil { + return err + } + return nil +} + func (o *DirectoryObject) Uri(endpoint environments.ApiEndpoint, apiVersion ApiVersion) string { - if o.ID == nil { + if o.Id == nil { return "" } - return fmt.Sprintf("%s/%s/directoryObjects/%s", endpoint, apiVersion, *o.ID) + return fmt.Sprintf("%s/%s/directoryObjects/%s", endpoint, apiVersion, *o.Id) } type DirectoryRole struct { @@ -871,6 +906,7 @@ type Group struct { HasMembersWithLicenseErrors *bool `json:"hasMembersWithLicenseErrors,omitempty"` HideFromAddressLists *bool `json:"hideFromAddressLists,omitempty"` HideFromOutlookClients *bool `json:"hideFromOutlookClients,omitempty"` + IsAssignableToRole *bool `json:"isAssignableToRole,omitempty"` IsSubscribedByMail *bool `json:"isSubscribedByMail,omitempty"` LicenseProcessingState *string `json:"licenseProcessingState,omitempty"` Mail *string `json:"mail,omitempty"` @@ -896,7 +932,7 @@ type Group struct { Theme *GroupTheme `json:"theme,omitempty"` UnseenCount *int `json:"unseenCount,omitempty"` Visibility *GroupVisibility `json:"visibility,omitempty"` - IsAssignableToRole *bool `json:"isAssignableToRole,omitempty"` + WritebackConfiguration *GroupWritebackConfiguration `json:"writebackConfiguration,omitempty"` } func (g Group) MarshalJSON() ([]byte, error) { @@ -977,6 +1013,11 @@ type GroupOnPremisesProvisioningError struct { Value *string `json:"value,omitempty"` } +type GroupWritebackConfiguration struct { + IsEnabled *bool `json:"isEnabled"` + OnPremisesGroupType *OnPremisesGroupType `json:"onPremisesGroupType"` +} + type Identity struct { DisplayName *string `json:"displayName,omitempty"` Id *string `json:"id,omitempty"` @@ -992,6 +1033,15 @@ type IdentityProvider struct { Name *string `json:"displayName,omitempty"` } +// Used in the identity sources of a ConnectedOrganization. +type IdentitySource struct { + ODataType *odata.Type `json:"@odata.type,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + TenantId *string `json:"tenantId,omitempty"` + DomainName *string `json:"domainName,omitempty"` + IssuerUri *string `json:"issuerUri,omitempty"` +} + type ImplicitGrantSettings struct { EnableAccessTokenIssuance *bool `json:"enableAccessTokenIssuance,omitempty"` EnableIdTokenIssuance *bool `json:"enableIdTokenIssuance,omitempty"` @@ -1210,6 +1260,10 @@ type Recipient struct { EmailAddress *EmailAddress `json:"emailAddress,omitempty"` } +type Ref struct { + ObjectUri *string `json:"@odata.id,omitempty"` +} + type RequestorSettings struct { ScopeType RequestorSettingsScopeType `json:"scopeType,omitempty"` AcceptRequests *bool `json:"acceptRequests,omitempty"` diff --git a/vendor/github.com/manicminer/hamilton/msgraph/role_definitions.go b/vendor/github.com/manicminer/hamilton/msgraph/role_definitions.go index eb95201dd0e5..a0fb5ab3be56 100644 --- a/vendor/github.com/manicminer/hamilton/msgraph/role_definitions.go +++ b/vendor/github.com/manicminer/hamilton/msgraph/role_definitions.go @@ -129,7 +129,7 @@ func (c *RoleDefinitionsClient) Update(ctx context.Context, roleDefinition Unifi ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc, ValidStatusCodes: []int{http.StatusNoContent}, Uri: Uri{ - Entity: fmt.Sprintf("/roleManagement/directory/roleDefinitions/%s", *roleDefinition.ID), + Entity: fmt.Sprintf("/roleManagement/directory/roleDefinitions/%s", *roleDefinition.ID()), HasTenantId: true, }, }) diff --git a/vendor/github.com/manicminer/hamilton/msgraph/serviceprincipals.go b/vendor/github.com/manicminer/hamilton/msgraph/serviceprincipals.go index 698523bfc072..89eeed4ecc16 100644 --- a/vendor/github.com/manicminer/hamilton/msgraph/serviceprincipals.go +++ b/vendor/github.com/manicminer/hamilton/msgraph/serviceprincipals.go @@ -138,7 +138,7 @@ func (c *ServicePrincipalsClient) Get(ctx context.Context, id string, query odat func (c *ServicePrincipalsClient) Update(ctx context.Context, servicePrincipal ServicePrincipal) (int, error) { var status int - if servicePrincipal.ID == nil { + if servicePrincipal.ID() == nil { return status, errors.New("cannot update service principal with nil ID") } @@ -152,7 +152,7 @@ func (c *ServicePrincipalsClient) Update(ctx context.Context, servicePrincipal S ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc, ValidStatusCodes: []int{http.StatusNoContent}, Uri: Uri{ - Entity: fmt.Sprintf("/servicePrincipals/%s", *servicePrincipal.ID), + Entity: fmt.Sprintf("/servicePrincipals/%s", *servicePrincipal.ID()), HasTenantId: true, }, }) @@ -265,7 +265,7 @@ func (c *ServicePrincipalsClient) GetOwner(ctx context.Context, servicePrincipal func (c *ServicePrincipalsClient) AddOwners(ctx context.Context, servicePrincipal *ServicePrincipal) (int, error) { var status int - if servicePrincipal.ID == nil { + if servicePrincipal.ID() == nil { return status, errors.New("cannot update service principal with nil ID") } if servicePrincipal.Owners == nil { @@ -292,7 +292,7 @@ func (c *ServicePrincipalsClient) AddOwners(ctx context.Context, servicePrincipa ValidStatusCodes: []int{http.StatusNoContent}, ValidStatusFunc: checkOwnerAlreadyExists, Uri: Uri{ - Entity: fmt.Sprintf("/servicePrincipals/%s/owners/$ref", *servicePrincipal.ID), + Entity: fmt.Sprintf("/servicePrincipals/%s/owners/$ref", *servicePrincipal.ID()), HasTenantId: true, }, }) @@ -352,7 +352,7 @@ func (c *ServicePrincipalsClient) RemoveOwners(ctx context.Context, servicePrinc func (c *ServicePrincipalsClient) AssignClaimsMappingPolicy(ctx context.Context, servicePrincipal *ServicePrincipal) (int, error) { var status int - if servicePrincipal.ID == nil { + if servicePrincipal.ID() == nil { return status, errors.New("cannot update service principal with nil ID") } if servicePrincipal.ClaimsMappingPolicies == nil { @@ -379,7 +379,7 @@ func (c *ServicePrincipalsClient) AssignClaimsMappingPolicy(ctx context.Context, ValidStatusCodes: []int{http.StatusNoContent}, ValidStatusFunc: checkPolicyAlreadyExists, Uri: Uri{ - Entity: fmt.Sprintf("/servicePrincipals/%s/claimsMappingPolicies/$ref", *servicePrincipal.ID), + Entity: fmt.Sprintf("/servicePrincipals/%s/claimsMappingPolicies/$ref", *servicePrincipal.ID()), HasTenantId: false, }, }) @@ -431,7 +431,7 @@ func (c *ServicePrincipalsClient) RemoveClaimsMappingPolicy(ctx context.Context, return status, errors.New("cannot remove, nil policyIds") } - assignedPolicies, _, err := c.ListClaimsMappingPolicy(ctx, *servicePrincipal.ID) + assignedPolicies, _, err := c.ListClaimsMappingPolicy(ctx, *servicePrincipal.ID()) if err != nil { return status, fmt.Errorf("ServicePrincipalsClient.BaseClient.ListClaimsMappingPolicy(): %v", err) } @@ -442,7 +442,7 @@ func (c *ServicePrincipalsClient) RemoveClaimsMappingPolicy(ctx context.Context, mapClaimsMappingPolicy := map[string]ClaimsMappingPolicy{} for _, v := range *assignedPolicies { - mapClaimsMappingPolicy[*v.ID] = v + mapClaimsMappingPolicy[*v.ID()] = v } for _, policyId := range *policyIds { @@ -465,7 +465,7 @@ func (c *ServicePrincipalsClient) RemoveClaimsMappingPolicy(ctx context.Context, ValidStatusCodes: []int{http.StatusNoContent}, ValidStatusFunc: checkPolicyStatus, Uri: Uri{ - Entity: fmt.Sprintf("/servicePrincipals/%s/claimsMappingPolicies/%s/$ref", *servicePrincipal.ID, policyId), + Entity: fmt.Sprintf("/servicePrincipals/%s/claimsMappingPolicies/%s/$ref", *servicePrincipal.ID(), policyId), HasTenantId: false, }, }) diff --git a/vendor/github.com/manicminer/hamilton/msgraph/users.go b/vendor/github.com/manicminer/hamilton/msgraph/users.go index 11ed3ad5ac91..e503ecc40db0 100644 --- a/vendor/github.com/manicminer/hamilton/msgraph/users.go +++ b/vendor/github.com/manicminer/hamilton/msgraph/users.go @@ -62,8 +62,16 @@ func (c *UsersClient) Create(ctx context.Context, user User) (*User, int, error) return nil, status, fmt.Errorf("json.Marshal(): %v", err) } + consistencyFunc := func(resp *http.Response, o *odata.OData) bool { + if resp != nil && resp.StatusCode == http.StatusBadRequest && o != nil && o.Error != nil { + return o.Error.Match(odata.ErrorPropertyValuesAreInvalid) + } + return false + } + resp, status, _, err := c.BaseClient.Post(ctx, PostHttpRequestInput{ - Body: body, + Body: body, + ConsistencyFailureFunc: consistencyFunc, OData: odata.Query{ Metadata: odata.MetadataFull, }, @@ -208,7 +216,7 @@ func (c *UsersClient) Update(ctx context.Context, user User) (int, error) { ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc, ValidStatusCodes: []int{http.StatusNoContent}, Uri: Uri{ - Entity: fmt.Sprintf("/users/%s", *user.ID), + Entity: fmt.Sprintf("/users/%s", *user.ID()), HasTenantId: true, }, }) diff --git a/vendor/github.com/manicminer/hamilton/msgraph/utils.go b/vendor/github.com/manicminer/hamilton/msgraph/utils.go index 77c1c4091cae..6b6d124b66ac 100644 --- a/vendor/github.com/manicminer/hamilton/msgraph/utils.go +++ b/vendor/github.com/manicminer/hamilton/msgraph/utils.go @@ -1,6 +1,10 @@ package msgraph -import "encoding/json" +import ( + "encoding/json" + + "github.com/hashicorp/go-uuid" +) func MarshalDocs(docs [][]byte) ([]byte, error) { out := make(map[string]interface{}) @@ -16,3 +20,13 @@ func MarshalDocs(docs [][]byte) ([]byte, error) { } return json.Marshal(out) } + +func ValidateId(id *string) bool { + if id == nil || *id == "" { + return false + } + if _, err := uuid.ParseUUID(*id); err != nil { + return false + } + return true +} diff --git a/vendor/github.com/manicminer/hamilton/msgraph/valuetypes.go b/vendor/github.com/manicminer/hamilton/msgraph/valuetypes.go index 1c59775636b7..11206c42b829 100644 --- a/vendor/github.com/manicminer/hamilton/msgraph/valuetypes.go +++ b/vendor/github.com/manicminer/hamilton/msgraph/valuetypes.go @@ -319,6 +319,14 @@ const ( ConditionalAccessRiskLevelUnknownFutureValue ConditionalAccessRiskLevel = "unknownFutureValue" ) +type ConnectedOrganizationState = string + +const ( + ConnectedOrganizationStateProposed ConnectedOrganizationState = "proposed" + ConnectedOrganizationStateConfigured ConnectedOrganizationState = "configured" + ConnectedOrganizationStateUnknownFutureValue ConnectedOrganizationState = "unknownFutureValue" +) + type DelegatedPermissionGrantConsentType = string const ( @@ -440,6 +448,14 @@ const ( KeyCredentialUsageVerify KeyCredentialUsage = "Verify" ) +type OnPremisesGroupType = string + +const ( + UniversalDistributionGroup OnPremisesGroupType = "UniversalDistributionGroup" + UniversalMailEnabledSecurityGroup OnPremisesGroupType = "UniversalMailEnabledSecurityGroup" + UniversalSecurityGroup OnPremisesGroupType = "UniversalSecurityGroup" +) + type Members []DirectoryObject func (o Members) MarshalJSON() ([]byte, error) { diff --git a/vendor/github.com/manicminer/hamilton/odata/errors.go b/vendor/github.com/manicminer/hamilton/odata/errors.go index abde41662103..f8bec32d82f9 100644 --- a/vendor/github.com/manicminer/hamilton/odata/errors.go +++ b/vendor/github.com/manicminer/hamilton/odata/errors.go @@ -5,6 +5,7 @@ const ( ErrorCannotDeleteOrUpdateEnabledEntitlement = "Permission (scope or role) cannot be deleted or updated unless disabled first" ErrorConflictingObjectPresentInDirectory = "A conflicting object with one or more of the specified property values is present in the directory" ErrorNotValidReferenceUpdate = "Not a valid reference update" + ErrorPropertyValuesAreInvalid = "One or more property values specified are invalid" ErrorResourceDoesNotExist = "Resource '.+' does not exist or one of its queried reference-property objects are not present" ErrorRemovedObjectReferencesDoNotExist = "One or more removed object references do not exist" ErrorServicePrincipalAppInOtherTenant = "When using this permission, the backing application of the service principal being created must in the local tenant" diff --git a/vendor/github.com/manicminer/hamilton/odata/http.go b/vendor/github.com/manicminer/hamilton/odata/http.go index e9a071938727..e14762f5de1f 100644 --- a/vendor/github.com/manicminer/hamilton/odata/http.go +++ b/vendor/github.com/manicminer/hamilton/odata/http.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "strings" ) @@ -22,7 +22,7 @@ func FromResponse(resp *http.Response) (*OData, error) { contentType := strings.ToLower(resp.Header.Get("Content-Type")) if strings.HasPrefix(contentType, "application/json") { // Read the response body and close it - respBody, err := ioutil.ReadAll(resp.Body) + respBody, err := io.ReadAll(resp.Body) resp.Body.Close() if err != nil { return nil, fmt.Errorf("could not read response body: %s", err) @@ -34,7 +34,7 @@ func FromResponse(resp *http.Response) (*OData, error) { } // Reassign the response body - resp.Body = ioutil.NopCloser(bytes.NewBuffer(respBody)) + resp.Body = io.NopCloser(bytes.NewBuffer(respBody)) return &o, nil } diff --git a/vendor/github.com/manicminer/hamilton/odata/types.go b/vendor/github.com/manicminer/hamilton/odata/types.go index 20c31534f6f5..ed342af35da9 100644 --- a/vendor/github.com/manicminer/hamilton/odata/types.go +++ b/vendor/github.com/manicminer/hamilton/odata/types.go @@ -46,13 +46,14 @@ type Type = string const ( TypeAccessPackage Type = "#microsoft.graph.accessPackage" TypeAccessPackageAssignmentPolicy Type = "#microsoft.graph.accessPackageAssignmentPolicy" - TypeAccessPackageQuestion Type = "#microsoft.graph.accessPackageQuestion" - TypeAccessPackageTextInputQuestion Type = "#microsoft.graph.accessPackageTextInputQuestion" - TypeAccessPackageMultipleChoiceQuestion Type = "#microsoft.graph.accessPackageMultipleChoiceQuestion" TypeAccessPackageCatalog Type = "#microsoft.graph.accessPackageCatalog" + TypeAccessPackageMultipleChoiceQuestion Type = "#microsoft.graph.accessPackageMultipleChoiceQuestion" + TypeAccessPackageQuestion Type = "#microsoft.graph.accessPackageQuestion" TypeAccessPackageResourceRequest Type = "#microsoft.graph.accessPackageResourceRequest" + TypeAccessPackageTextInputQuestion Type = "#microsoft.graph.accessPackageTextInputQuestion" TypeAdministrativeUnit Type = "#microsoft.graph.administrativeUnit" TypeApplication Type = "#microsoft.graph.application" + TypeAzureActiveDirectoryTenant Type = "#microsoft.graph.azureActiveDirectoryTenant" TypeConditionalAccessPolicy Type = "#microsoft.graph.conditionalAccessPolicy" TypeConnectedOrganizationMembers Type = "#microsoft.graph.connectedOrganizationMembers" TypeConnectionInfo Type = "#microsoft.graph.connectionInfo" @@ -61,15 +62,17 @@ const ( TypeDirectoryRole Type = "#microsoft.graph.directoryRole" TypeDirectoryRoleTemplate Type = "#microsoft.graph.directoryRoleTemplate" TypeDomain Type = "#microsoft.graph.domain" + TypeDomainIdentitySource Type = "#microsoft.graph.domainIdentitySource" TypeEmailAuthenticationMethod Type = "#microsoft.graph.emailAuthenticationMethod" + TypeExternalDomainFederation Type = "#microsoft.graph.externalDomainFederation" TypeExternalSponsors Type = "#microsoft.graph.externalSponsors" TypeFido2AuthenticationMethod Type = "#microsoft.graph.fido2AuthenticationMethod" TypeGroup Type = "#microsoft.graph.group" TypeGroupMembers Type = "#microsoft.graph.groupMembers" - TypeIpNamedLocation Type = "#microsoft.graph.ipNamedLocation" TypeInternalSponsors Type = "#microsoft.graph.internalSponsors" - TypeNamedLocation Type = "#microsoft.graph.namedLocation" + TypeIpNamedLocation Type = "#microsoft.graph.ipNamedLocation" TypeMicrosoftAuthenticatorAuthenticationMethod Type = "#microsoft.graph.microsoftAuthenticatorAuthenticationMethod" + TypeNamedLocation Type = "#microsoft.graph.namedLocation" TypeOrganization Type = "#microsoft.graph.organization" TypePasswordAuthenticationMethod Type = "#microsoft.graph.passwordAuthenticationMethod" TypePhoneAuthenticationMethod Type = "#microsoft.graph.phoneAuthenticationMethod" diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/botconnection.go b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/botconnection.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/botconnection.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/botconnection.go index 3fec3a9d11a9..4943500169a2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/botconnection.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/botconnection.go @@ -8,11 +8,12 @@ package botservice import ( "context" + "net/http" + "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" - "net/http" ) // BotConnectionClient is the azure Bot Service is a platform for creating smart conversational agents. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/bots.go b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/bots.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/bots.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/bots.go index cc636fc7e1f1..48cf5fc44c74 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/bots.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/bots.go @@ -8,11 +8,12 @@ package botservice import ( "context" + "net/http" + "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" - "net/http" ) // BotsClient is the azure Bot Service is a platform for creating smart conversational agents. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/channels.go b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/channels.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/channels.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/channels.go index b8c4463a0dd2..f81f6252e520 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/channels.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/channels.go @@ -8,11 +8,12 @@ package botservice import ( "context" + "net/http" + "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" - "net/http" ) // ChannelsClient is the azure Bot Service is a platform for creating smart conversational agents. diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/client.go b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/client.go new file mode 100644 index 000000000000..9eb3e45452fe --- /dev/null +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/client.go @@ -0,0 +1,41 @@ +// Package botservice implements the Azure ARM Botservice service API version 2021-05-01-preview. +// +// Azure Bot Service is a platform for creating smart conversational agents. +package botservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Botservice + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Botservice. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/directline.go b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/directline.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/directline.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/directline.go index bd423ec2f548..68941f3b8921 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/directline.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/directline.go @@ -8,11 +8,12 @@ package botservice import ( "context" + "net/http" + "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" - "net/http" ) // DirectLineClient is the azure Bot Service is a platform for creating smart conversational agents. diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/enums.go b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/enums.go new file mode 100644 index 000000000000..f6bb19fa61e1 --- /dev/null +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/enums.go @@ -0,0 +1,278 @@ +package botservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ChannelName enumerates the values for channel name. +type ChannelName string + +const ( + // ChannelNameAcsChatChannel ... + ChannelNameAcsChatChannel ChannelName = "AcsChatChannel" + // ChannelNameAlexaChannel ... + ChannelNameAlexaChannel ChannelName = "AlexaChannel" + // ChannelNameDirectLineChannel ... + ChannelNameDirectLineChannel ChannelName = "DirectLineChannel" + // ChannelNameDirectLineSpeechChannel ... + ChannelNameDirectLineSpeechChannel ChannelName = "DirectLineSpeechChannel" + // ChannelNameEmailChannel ... + ChannelNameEmailChannel ChannelName = "EmailChannel" + // ChannelNameFacebookChannel ... + ChannelNameFacebookChannel ChannelName = "FacebookChannel" + // ChannelNameKikChannel ... + ChannelNameKikChannel ChannelName = "KikChannel" + // ChannelNameLineChannel ... + ChannelNameLineChannel ChannelName = "LineChannel" + // ChannelNameM365Extensions ... + ChannelNameM365Extensions ChannelName = "M365Extensions" + // ChannelNameMsTeamsChannel ... + ChannelNameMsTeamsChannel ChannelName = "MsTeamsChannel" + // ChannelNameOmnichannel ... + ChannelNameOmnichannel ChannelName = "Omnichannel" + // ChannelNameOutlookChannel ... + ChannelNameOutlookChannel ChannelName = "OutlookChannel" + // ChannelNameSearchAssistant ... + ChannelNameSearchAssistant ChannelName = "SearchAssistant" + // ChannelNameSkypeChannel ... + ChannelNameSkypeChannel ChannelName = "SkypeChannel" + // ChannelNameSlackChannel ... + ChannelNameSlackChannel ChannelName = "SlackChannel" + // ChannelNameSmsChannel ... + ChannelNameSmsChannel ChannelName = "SmsChannel" + // ChannelNameTelegramChannel ... + ChannelNameTelegramChannel ChannelName = "TelegramChannel" + // ChannelNameTelephonyChannel ... + ChannelNameTelephonyChannel ChannelName = "TelephonyChannel" + // ChannelNameWebChatChannel ... + ChannelNameWebChatChannel ChannelName = "WebChatChannel" +) + +// PossibleChannelNameValues returns an array of possible values for the ChannelName const type. +func PossibleChannelNameValues() []ChannelName { + return []ChannelName{ChannelNameAcsChatChannel, ChannelNameAlexaChannel, ChannelNameDirectLineChannel, ChannelNameDirectLineSpeechChannel, ChannelNameEmailChannel, ChannelNameFacebookChannel, ChannelNameKikChannel, ChannelNameLineChannel, ChannelNameM365Extensions, ChannelNameMsTeamsChannel, ChannelNameOmnichannel, ChannelNameOutlookChannel, ChannelNameSearchAssistant, ChannelNameSkypeChannel, ChannelNameSlackChannel, ChannelNameSmsChannel, ChannelNameTelegramChannel, ChannelNameTelephonyChannel, ChannelNameWebChatChannel} +} + +// ChannelNameBasicChannel enumerates the values for channel name basic channel. +type ChannelNameBasicChannel string + +const ( + // ChannelNameBasicChannelChannelNameAcsChatChannel ... + ChannelNameBasicChannelChannelNameAcsChatChannel ChannelNameBasicChannel = "AcsChatChannel" + // ChannelNameBasicChannelChannelNameAlexaChannel ... + ChannelNameBasicChannelChannelNameAlexaChannel ChannelNameBasicChannel = "AlexaChannel" + // ChannelNameBasicChannelChannelNameChannel ... + ChannelNameBasicChannelChannelNameChannel ChannelNameBasicChannel = "Channel" + // ChannelNameBasicChannelChannelNameDirectLineChannel ... + ChannelNameBasicChannelChannelNameDirectLineChannel ChannelNameBasicChannel = "DirectLineChannel" + // ChannelNameBasicChannelChannelNameDirectLineSpeechChannel ... + ChannelNameBasicChannelChannelNameDirectLineSpeechChannel ChannelNameBasicChannel = "DirectLineSpeechChannel" + // ChannelNameBasicChannelChannelNameEmailChannel ... + ChannelNameBasicChannelChannelNameEmailChannel ChannelNameBasicChannel = "EmailChannel" + // ChannelNameBasicChannelChannelNameFacebookChannel ... + ChannelNameBasicChannelChannelNameFacebookChannel ChannelNameBasicChannel = "FacebookChannel" + // ChannelNameBasicChannelChannelNameKikChannel ... + ChannelNameBasicChannelChannelNameKikChannel ChannelNameBasicChannel = "KikChannel" + // ChannelNameBasicChannelChannelNameLineChannel ... + ChannelNameBasicChannelChannelNameLineChannel ChannelNameBasicChannel = "LineChannel" + // ChannelNameBasicChannelChannelNameM365Extensions ... + ChannelNameBasicChannelChannelNameM365Extensions ChannelNameBasicChannel = "M365Extensions" + // ChannelNameBasicChannelChannelNameMsTeamsChannel ... + ChannelNameBasicChannelChannelNameMsTeamsChannel ChannelNameBasicChannel = "MsTeamsChannel" + // ChannelNameBasicChannelChannelNameOmnichannel ... + ChannelNameBasicChannelChannelNameOmnichannel ChannelNameBasicChannel = "Omnichannel" + // ChannelNameBasicChannelChannelNameOutlookChannel ... + ChannelNameBasicChannelChannelNameOutlookChannel ChannelNameBasicChannel = "OutlookChannel" + // ChannelNameBasicChannelChannelNameSearchAssistant ... + ChannelNameBasicChannelChannelNameSearchAssistant ChannelNameBasicChannel = "SearchAssistant" + // ChannelNameBasicChannelChannelNameSkypeChannel ... + ChannelNameBasicChannelChannelNameSkypeChannel ChannelNameBasicChannel = "SkypeChannel" + // ChannelNameBasicChannelChannelNameSlackChannel ... + ChannelNameBasicChannelChannelNameSlackChannel ChannelNameBasicChannel = "SlackChannel" + // ChannelNameBasicChannelChannelNameSmsChannel ... + ChannelNameBasicChannelChannelNameSmsChannel ChannelNameBasicChannel = "SmsChannel" + // ChannelNameBasicChannelChannelNameTelegramChannel ... + ChannelNameBasicChannelChannelNameTelegramChannel ChannelNameBasicChannel = "TelegramChannel" + // ChannelNameBasicChannelChannelNameTelephonyChannel ... + ChannelNameBasicChannelChannelNameTelephonyChannel ChannelNameBasicChannel = "TelephonyChannel" + // ChannelNameBasicChannelChannelNameWebChatChannel ... + ChannelNameBasicChannelChannelNameWebChatChannel ChannelNameBasicChannel = "WebChatChannel" +) + +// PossibleChannelNameBasicChannelValues returns an array of possible values for the ChannelNameBasicChannel const type. +func PossibleChannelNameBasicChannelValues() []ChannelNameBasicChannel { + return []ChannelNameBasicChannel{ChannelNameBasicChannelChannelNameAcsChatChannel, ChannelNameBasicChannelChannelNameAlexaChannel, ChannelNameBasicChannelChannelNameChannel, ChannelNameBasicChannelChannelNameDirectLineChannel, ChannelNameBasicChannelChannelNameDirectLineSpeechChannel, ChannelNameBasicChannelChannelNameEmailChannel, ChannelNameBasicChannelChannelNameFacebookChannel, ChannelNameBasicChannelChannelNameKikChannel, ChannelNameBasicChannelChannelNameLineChannel, ChannelNameBasicChannelChannelNameM365Extensions, ChannelNameBasicChannelChannelNameMsTeamsChannel, ChannelNameBasicChannelChannelNameOmnichannel, ChannelNameBasicChannelChannelNameOutlookChannel, ChannelNameBasicChannelChannelNameSearchAssistant, ChannelNameBasicChannelChannelNameSkypeChannel, ChannelNameBasicChannelChannelNameSlackChannel, ChannelNameBasicChannelChannelNameSmsChannel, ChannelNameBasicChannelChannelNameTelegramChannel, ChannelNameBasicChannelChannelNameTelephonyChannel, ChannelNameBasicChannelChannelNameWebChatChannel} +} + +// Key enumerates the values for key. +type Key string + +const ( + // Key1 ... + Key1 Key = "key1" + // Key2 ... + Key2 Key = "key2" +) + +// PossibleKeyValues returns an array of possible values for the Key const type. +func PossibleKeyValues() []Key { + return []Key{Key1, Key2} +} + +// Kind enumerates the values for kind. +type Kind string + +const ( + // KindAzurebot ... + KindAzurebot Kind = "azurebot" + // KindBot ... + KindBot Kind = "bot" + // KindDesigner ... + KindDesigner Kind = "designer" + // KindFunction ... + KindFunction Kind = "function" + // KindSdk ... + KindSdk Kind = "sdk" +) + +// PossibleKindValues returns an array of possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{KindAzurebot, KindBot, KindDesigner, KindFunction, KindSdk} +} + +// MsaAppType enumerates the values for msa app type. +type MsaAppType string + +const ( + // MsaAppTypeMultiTenant ... + MsaAppTypeMultiTenant MsaAppType = "MultiTenant" + // MsaAppTypeSingleTenant ... + MsaAppTypeSingleTenant MsaAppType = "SingleTenant" + // MsaAppTypeUserAssignedMSI ... + MsaAppTypeUserAssignedMSI MsaAppType = "UserAssignedMSI" +) + +// PossibleMsaAppTypeValues returns an array of possible values for the MsaAppType const type. +func PossibleMsaAppTypeValues() []MsaAppType { + return []MsaAppType{MsaAppTypeMultiTenant, MsaAppTypeSingleTenant, MsaAppTypeUserAssignedMSI} +} + +// OperationResultStatus enumerates the values for operation result status. +type OperationResultStatus string + +const ( + // OperationResultStatusCanceled ... + OperationResultStatusCanceled OperationResultStatus = "Canceled" + // OperationResultStatusFailed ... + OperationResultStatusFailed OperationResultStatus = "Failed" + // OperationResultStatusRequested ... + OperationResultStatusRequested OperationResultStatus = "Requested" + // OperationResultStatusRunning ... + OperationResultStatusRunning OperationResultStatus = "Running" + // OperationResultStatusSucceeded ... + OperationResultStatusSucceeded OperationResultStatus = "Succeeded" +) + +// PossibleOperationResultStatusValues returns an array of possible values for the OperationResultStatus const type. +func PossibleOperationResultStatusValues() []OperationResultStatus { + return []OperationResultStatus{OperationResultStatusCanceled, OperationResultStatusFailed, OperationResultStatusRequested, OperationResultStatusRunning, OperationResultStatusSucceeded} +} + +// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection +// provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + // PrivateEndpointConnectionProvisioningStateCreating ... + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + // PrivateEndpointConnectionProvisioningStateDeleting ... + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + // PrivateEndpointConnectionProvisioningStateFailed ... + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateSucceeded ... + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded} +} + +// PrivateEndpointServiceConnectionStatus enumerates the values for private endpoint service connection status. +type PrivateEndpointServiceConnectionStatus string + +const ( + // PrivateEndpointServiceConnectionStatusApproved ... + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + // PrivateEndpointServiceConnectionStatusPending ... + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + // PrivateEndpointServiceConnectionStatusRejected ... + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointServiceConnectionStatusValues returns an array of possible values for the PrivateEndpointServiceConnectionStatus const type. +func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { + return []PrivateEndpointServiceConnectionStatus{PrivateEndpointServiceConnectionStatusApproved, PrivateEndpointServiceConnectionStatusPending, PrivateEndpointServiceConnectionStatusRejected} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled ... + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled ... + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} +} + +// RegenerateKeysChannelName enumerates the values for regenerate keys channel name. +type RegenerateKeysChannelName string + +const ( + // RegenerateKeysChannelNameDirectLineChannel ... + RegenerateKeysChannelNameDirectLineChannel RegenerateKeysChannelName = "DirectLineChannel" + // RegenerateKeysChannelNameWebChatChannel ... + RegenerateKeysChannelNameWebChatChannel RegenerateKeysChannelName = "WebChatChannel" +) + +// PossibleRegenerateKeysChannelNameValues returns an array of possible values for the RegenerateKeysChannelName const type. +func PossibleRegenerateKeysChannelNameValues() []RegenerateKeysChannelName { + return []RegenerateKeysChannelName{RegenerateKeysChannelNameDirectLineChannel, RegenerateKeysChannelNameWebChatChannel} +} + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // SkuNameF0 ... + SkuNameF0 SkuName = "F0" + // SkuNameS1 ... + SkuNameS1 SkuName = "S1" +) + +// PossibleSkuNameValues returns an array of possible values for the SkuName const type. +func PossibleSkuNameValues() []SkuName { + return []SkuName{SkuNameF0, SkuNameS1} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // SkuTierFree ... + SkuTierFree SkuTier = "Free" + // SkuTierStandard ... + SkuTierStandard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{SkuTierFree, SkuTierStandard} +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/hostsettings.go b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/hostsettings.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/hostsettings.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/hostsettings.go index ff1fb1f04bc3..25bb3f60de64 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/hostsettings.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/hostsettings.go @@ -8,10 +8,11 @@ package botservice import ( "context" + "net/http" + "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/tracing" - "net/http" ) // HostSettingsClient is the azure Bot Service is a platform for creating smart conversational agents. diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/models.go b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/models.go new file mode 100644 index 000000000000..2ba313927a4a --- /dev/null +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/models.go @@ -0,0 +1,5405 @@ +package botservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" +) + +// The package's fully qualified name. +const fqdn = "home/runner/work/kermit/kermit/sdk/botservice/2021-05-01-preview/botservice" + +// AcsChatChannel acsChat channel definition +type AcsChatChannel struct { + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for AcsChatChannel. +func (acc AcsChatChannel) MarshalJSON() ([]byte, error) { + acc.ChannelName = ChannelNameBasicChannelChannelNameAcsChatChannel + objectMap := make(map[string]interface{}) + if acc.Etag != nil { + objectMap["etag"] = acc.Etag + } + if acc.Location != nil { + objectMap["location"] = acc.Location + } + if acc.ChannelName != "" { + objectMap["channelName"] = acc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return &acc, true +} + +// AsSearchAssistant is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for AcsChatChannel. +func (acc AcsChatChannel) AsBasicChannel() (BasicChannel, bool) { + return &acc, true +} + +// AlexaChannel alexa channel definition +type AlexaChannel struct { + // Properties - The set of properties specific to Alexa channel resource + Properties *AlexaChannelProperties `json:"properties,omitempty"` + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlexaChannel. +func (ac AlexaChannel) MarshalJSON() ([]byte, error) { + ac.ChannelName = ChannelNameBasicChannelChannelNameAlexaChannel + objectMap := make(map[string]interface{}) + if ac.Properties != nil { + objectMap["properties"] = ac.Properties + } + if ac.Etag != nil { + objectMap["etag"] = ac.Etag + } + if ac.Location != nil { + objectMap["location"] = ac.Location + } + if ac.ChannelName != "" { + objectMap["channelName"] = ac.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return &ac, true +} + +// AsFacebookChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsBasicChannel() (BasicChannel, bool) { + return &ac, true +} + +// AlexaChannelProperties the parameters to provide for the Alexa channel. +type AlexaChannelProperties struct { + // AlexaSkillID - The Alexa skill Id + AlexaSkillID *string `json:"alexaSkillId,omitempty"` + // URLFragment - READ-ONLY; Url fragment used in part of the Uri configured in Alexa + URLFragment *string `json:"urlFragment,omitempty"` + // ServiceEndpointURI - READ-ONLY; Full Uri used to configured the skill in Alexa + ServiceEndpointURI *string `json:"serviceEndpointUri,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlexaChannelProperties. +func (acp AlexaChannelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if acp.AlexaSkillID != nil { + objectMap["alexaSkillId"] = acp.AlexaSkillID + } + if acp.IsEnabled != nil { + objectMap["isEnabled"] = acp.IsEnabled + } + return json.Marshal(objectMap) +} + +// Bot bot resource definition +type Bot struct { + autorest.Response `json:"-"` + // Properties - The set of properties specific to bot resource + Properties *BotProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Specifies the resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Specifies the name of the resource. + Name *string `json:"name,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Specifies the type of the resource. + Type *string `json:"type,omitempty"` + // Tags - Contains resource tags defined as key/value pairs. + Tags map[string]*string `json:"tags"` + // Sku - Gets or sets the SKU of the resource. + Sku *Sku `json:"sku,omitempty"` + // Kind - Required. Gets or sets the Kind of the resource. Possible values include: 'KindSdk', 'KindDesigner', 'KindBot', 'KindFunction', 'KindAzurebot' + Kind Kind `json:"kind,omitempty"` + // Etag - Entity Tag + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for Bot. +func (b Bot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if b.Properties != nil { + objectMap["properties"] = b.Properties + } + if b.Location != nil { + objectMap["location"] = b.Location + } + if b.Tags != nil { + objectMap["tags"] = b.Tags + } + if b.Sku != nil { + objectMap["sku"] = b.Sku + } + if b.Kind != "" { + objectMap["kind"] = b.Kind + } + if b.Etag != nil { + objectMap["etag"] = b.Etag + } + return json.Marshal(objectMap) +} + +// BotChannel bot channel resource definition +type BotChannel struct { + autorest.Response `json:"-"` + // Properties - The set of properties specific to bot channel resource + Properties BasicChannel `json:"properties,omitempty"` + // ID - READ-ONLY; Specifies the resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Specifies the name of the resource. + Name *string `json:"name,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Specifies the type of the resource. + Type *string `json:"type,omitempty"` + // Tags - Contains resource tags defined as key/value pairs. + Tags map[string]*string `json:"tags"` + // Sku - Gets or sets the SKU of the resource. + Sku *Sku `json:"sku,omitempty"` + // Kind - Required. Gets or sets the Kind of the resource. Possible values include: 'KindSdk', 'KindDesigner', 'KindBot', 'KindFunction', 'KindAzurebot' + Kind Kind `json:"kind,omitempty"` + // Etag - Entity Tag + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for BotChannel. +func (bc BotChannel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = bc.Properties + if bc.Location != nil { + objectMap["location"] = bc.Location + } + if bc.Tags != nil { + objectMap["tags"] = bc.Tags + } + if bc.Sku != nil { + objectMap["sku"] = bc.Sku + } + if bc.Kind != "" { + objectMap["kind"] = bc.Kind + } + if bc.Etag != nil { + objectMap["etag"] = bc.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BotChannel struct. +func (bc *BotChannel) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + properties, err := unmarshalBasicChannel(*v) + if err != nil { + return err + } + bc.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bc.Name = &name + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + bc.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bc.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + bc.Tags = tags + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + bc.Sku = &sku + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + bc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + bc.Etag = &etag + } + } + } + + return nil +} + +// BotProperties the parameters to provide for the Bot. +type BotProperties struct { + // DisplayName - The Name of the bot + DisplayName *string `json:"displayName,omitempty"` + // Description - The description of the bot + Description *string `json:"description,omitempty"` + // IconURL - The Icon Url of the bot + IconURL *string `json:"iconUrl,omitempty"` + // Endpoint - The bot's endpoint + Endpoint *string `json:"endpoint,omitempty"` + // EndpointVersion - READ-ONLY; The bot's endpoint version + EndpointVersion *string `json:"endpointVersion,omitempty"` + // AllSettings - Contains resource all settings defined as key/value pairs. + AllSettings map[string]*string `json:"allSettings"` + // Parameters - Contains resource parameters defined as key/value pairs. + Parameters map[string]*string `json:"parameters"` + // ManifestURL - The bot's manifest url + ManifestURL *string `json:"manifestUrl,omitempty"` + // MsaAppType - Microsoft App Type for the bot. Possible values include: 'MsaAppTypeUserAssignedMSI', 'MsaAppTypeSingleTenant', 'MsaAppTypeMultiTenant' + MsaAppType MsaAppType `json:"msaAppType,omitempty"` + // MsaAppID - Microsoft App Id for the bot + MsaAppID *string `json:"msaAppId,omitempty"` + // MsaAppTenantID - Microsoft App Tenant Id for the bot + MsaAppTenantID *string `json:"msaAppTenantId,omitempty"` + // MsaAppMSIResourceID - Microsoft App Managed Identity Resource Id for the bot + MsaAppMSIResourceID *string `json:"msaAppMSIResourceId,omitempty"` + // ConfiguredChannels - READ-ONLY; Collection of channels for which the bot is configured + ConfiguredChannels *[]string `json:"configuredChannels,omitempty"` + // EnabledChannels - READ-ONLY; Collection of channels for which the bot is enabled + EnabledChannels *[]string `json:"enabledChannels,omitempty"` + // DeveloperAppInsightKey - The Application Insights key + DeveloperAppInsightKey *string `json:"developerAppInsightKey,omitempty"` + // DeveloperAppInsightsAPIKey - The Application Insights Api Key + DeveloperAppInsightsAPIKey *string `json:"developerAppInsightsApiKey,omitempty"` + // DeveloperAppInsightsApplicationID - The Application Insights App Id + DeveloperAppInsightsApplicationID *string `json:"developerAppInsightsApplicationId,omitempty"` + // LuisAppIds - Collection of LUIS App Ids + LuisAppIds *[]string `json:"luisAppIds,omitempty"` + // LuisKey - The LUIS Key + LuisKey *string `json:"luisKey,omitempty"` + // IsCmekEnabled - Whether Cmek is enabled + IsCmekEnabled *bool `json:"isCmekEnabled,omitempty"` + // CmekKeyVaultURL - The CMK Url + CmekKeyVaultURL *string `json:"cmekKeyVaultUrl,omitempty"` + // CmekEncryptionStatus - READ-ONLY; The CMK encryption status + CmekEncryptionStatus *string `json:"cmekEncryptionStatus,omitempty"` + // TenantID - The Tenant Id for the bot + TenantID *string `json:"tenantId,omitempty"` + // PublicNetworkAccess - Whether the bot is in an isolated network. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // IsStreamingSupported - Whether the bot is streaming supported + IsStreamingSupported *bool `json:"isStreamingSupported,omitempty"` + // IsDeveloperAppInsightsAPIKeySet - READ-ONLY; Whether the bot is developerAppInsightsApiKey set + IsDeveloperAppInsightsAPIKeySet *bool `json:"isDeveloperAppInsightsApiKeySet,omitempty"` + // MigrationToken - READ-ONLY; Token used to migrate non Azure bot to azure subscription + MigrationToken *string `json:"migrationToken,omitempty"` + // DisableLocalAuth - Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // SchemaTransformationVersion - The channel schema transformation version for the bot + SchemaTransformationVersion *string `json:"schemaTransformationVersion,omitempty"` + // StorageResourceID - The storage resourceId for the bot + StorageResourceID *string `json:"storageResourceId,omitempty"` + // PrivateEndpointConnections - READ-ONLY; List of Private Endpoint Connections configured for the bot + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // OpenWithHint - The hint to browser (e.g. protocol handler) on how to open the bot for authoring + OpenWithHint *string `json:"openWithHint,omitempty"` + // AppPasswordHint - The hint (e.g. keyVault secret resourceId) on how to fetch the app secret + AppPasswordHint *string `json:"appPasswordHint,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // PublishingCredentials - Publishing credentials of the resource + PublishingCredentials *string `json:"publishingCredentials,omitempty"` +} + +// MarshalJSON is the custom marshaler for BotProperties. +func (bp BotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bp.DisplayName != nil { + objectMap["displayName"] = bp.DisplayName + } + if bp.Description != nil { + objectMap["description"] = bp.Description + } + if bp.IconURL != nil { + objectMap["iconUrl"] = bp.IconURL + } + if bp.Endpoint != nil { + objectMap["endpoint"] = bp.Endpoint + } + if bp.AllSettings != nil { + objectMap["allSettings"] = bp.AllSettings + } + if bp.Parameters != nil { + objectMap["parameters"] = bp.Parameters + } + if bp.ManifestURL != nil { + objectMap["manifestUrl"] = bp.ManifestURL + } + if bp.MsaAppType != "" { + objectMap["msaAppType"] = bp.MsaAppType + } + if bp.MsaAppID != nil { + objectMap["msaAppId"] = bp.MsaAppID + } + if bp.MsaAppTenantID != nil { + objectMap["msaAppTenantId"] = bp.MsaAppTenantID + } + if bp.MsaAppMSIResourceID != nil { + objectMap["msaAppMSIResourceId"] = bp.MsaAppMSIResourceID + } + if bp.DeveloperAppInsightKey != nil { + objectMap["developerAppInsightKey"] = bp.DeveloperAppInsightKey + } + if bp.DeveloperAppInsightsAPIKey != nil { + objectMap["developerAppInsightsApiKey"] = bp.DeveloperAppInsightsAPIKey + } + if bp.DeveloperAppInsightsApplicationID != nil { + objectMap["developerAppInsightsApplicationId"] = bp.DeveloperAppInsightsApplicationID + } + if bp.LuisAppIds != nil { + objectMap["luisAppIds"] = bp.LuisAppIds + } + if bp.LuisKey != nil { + objectMap["luisKey"] = bp.LuisKey + } + if bp.IsCmekEnabled != nil { + objectMap["isCmekEnabled"] = bp.IsCmekEnabled + } + if bp.CmekKeyVaultURL != nil { + objectMap["cmekKeyVaultUrl"] = bp.CmekKeyVaultURL + } + if bp.TenantID != nil { + objectMap["tenantId"] = bp.TenantID + } + if bp.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = bp.PublicNetworkAccess + } + if bp.IsStreamingSupported != nil { + objectMap["isStreamingSupported"] = bp.IsStreamingSupported + } + if bp.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = bp.DisableLocalAuth + } + if bp.SchemaTransformationVersion != nil { + objectMap["schemaTransformationVersion"] = bp.SchemaTransformationVersion + } + if bp.StorageResourceID != nil { + objectMap["storageResourceId"] = bp.StorageResourceID + } + if bp.OpenWithHint != nil { + objectMap["openWithHint"] = bp.OpenWithHint + } + if bp.AppPasswordHint != nil { + objectMap["appPasswordHint"] = bp.AppPasswordHint + } + if bp.PublishingCredentials != nil { + objectMap["publishingCredentials"] = bp.PublishingCredentials + } + return json.Marshal(objectMap) +} + +// BotResponseList the list of bot service operation response. +type BotResponseList struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of bot service resources. + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; Gets the list of bot service results and their properties. + Value *[]Bot `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for BotResponseList. +func (brl BotResponseList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if brl.NextLink != nil { + objectMap["nextLink"] = brl.NextLink + } + return json.Marshal(objectMap) +} + +// BotResponseListIterator provides access to a complete listing of Bot values. +type BotResponseListIterator struct { + i int + page BotResponseListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BotResponseListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotResponseListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BotResponseListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BotResponseListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BotResponseListIterator) Response() BotResponseList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BotResponseListIterator) Value() Bot { + if !iter.page.NotDone() { + return Bot{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BotResponseListIterator type. +func NewBotResponseListIterator(page BotResponseListPage) BotResponseListIterator { + return BotResponseListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (brl BotResponseList) IsEmpty() bool { + return brl.Value == nil || len(*brl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (brl BotResponseList) hasNextLink() bool { + return brl.NextLink != nil && len(*brl.NextLink) != 0 +} + +// botResponseListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (brl BotResponseList) botResponseListPreparer(ctx context.Context) (*http.Request, error) { + if !brl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(brl.NextLink))) +} + +// BotResponseListPage contains a page of Bot values. +type BotResponseListPage struct { + fn func(context.Context, BotResponseList) (BotResponseList, error) + brl BotResponseList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BotResponseListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotResponseListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.brl) + if err != nil { + return err + } + page.brl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BotResponseListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BotResponseListPage) NotDone() bool { + return !page.brl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BotResponseListPage) Response() BotResponseList { + return page.brl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BotResponseListPage) Values() []Bot { + if page.brl.IsEmpty() { + return nil + } + return *page.brl.Value +} + +// Creates a new instance of the BotResponseListPage type. +func NewBotResponseListPage(cur BotResponseList, getNextPage func(context.Context, BotResponseList) (BotResponseList, error)) BotResponseListPage { + return BotResponseListPage{ + fn: getNextPage, + brl: cur, + } +} + +// BasicChannel channel definition +type BasicChannel interface { + AsAlexaChannel() (*AlexaChannel, bool) + AsFacebookChannel() (*FacebookChannel, bool) + AsEmailChannel() (*EmailChannel, bool) + AsOutlookChannel() (*OutlookChannel, bool) + AsMsTeamsChannel() (*MsTeamsChannel, bool) + AsSkypeChannel() (*SkypeChannel, bool) + AsKikChannel() (*KikChannel, bool) + AsWebChatChannel() (*WebChatChannel, bool) + AsDirectLineChannel() (*DirectLineChannel, bool) + AsTelegramChannel() (*TelegramChannel, bool) + AsSmsChannel() (*SmsChannel, bool) + AsSlackChannel() (*SlackChannel, bool) + AsLineChannel() (*LineChannel, bool) + AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) + AsOmnichannel() (*Omnichannel, bool) + AsTelephonyChannel() (*TelephonyChannel, bool) + AsAcsChatChannel() (*AcsChatChannel, bool) + AsSearchAssistant() (*SearchAssistant, bool) + AsM365Extensions() (*M365Extensions, bool) + AsChannel() (*Channel, bool) +} + +// Channel channel definition +type Channel struct { + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +func unmarshalBasicChannel(body []byte) (BasicChannel, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["channelName"] { + case string(ChannelNameBasicChannelChannelNameAlexaChannel): + var ac AlexaChannel + err := json.Unmarshal(body, &ac) + return ac, err + case string(ChannelNameBasicChannelChannelNameFacebookChannel): + var fc FacebookChannel + err := json.Unmarshal(body, &fc) + return fc, err + case string(ChannelNameBasicChannelChannelNameEmailChannel): + var ec EmailChannel + err := json.Unmarshal(body, &ec) + return ec, err + case string(ChannelNameBasicChannelChannelNameOutlookChannel): + var oc OutlookChannel + err := json.Unmarshal(body, &oc) + return oc, err + case string(ChannelNameBasicChannelChannelNameMsTeamsChannel): + var mtc MsTeamsChannel + err := json.Unmarshal(body, &mtc) + return mtc, err + case string(ChannelNameBasicChannelChannelNameSkypeChannel): + var sc SkypeChannel + err := json.Unmarshal(body, &sc) + return sc, err + case string(ChannelNameBasicChannelChannelNameKikChannel): + var kc KikChannel + err := json.Unmarshal(body, &kc) + return kc, err + case string(ChannelNameBasicChannelChannelNameWebChatChannel): + var wcc WebChatChannel + err := json.Unmarshal(body, &wcc) + return wcc, err + case string(ChannelNameBasicChannelChannelNameDirectLineChannel): + var dlc DirectLineChannel + err := json.Unmarshal(body, &dlc) + return dlc, err + case string(ChannelNameBasicChannelChannelNameTelegramChannel): + var tc TelegramChannel + err := json.Unmarshal(body, &tc) + return tc, err + case string(ChannelNameBasicChannelChannelNameSmsChannel): + var sc SmsChannel + err := json.Unmarshal(body, &sc) + return sc, err + case string(ChannelNameBasicChannelChannelNameSlackChannel): + var sc SlackChannel + err := json.Unmarshal(body, &sc) + return sc, err + case string(ChannelNameBasicChannelChannelNameLineChannel): + var lc LineChannel + err := json.Unmarshal(body, &lc) + return lc, err + case string(ChannelNameBasicChannelChannelNameDirectLineSpeechChannel): + var dlsc DirectLineSpeechChannel + err := json.Unmarshal(body, &dlsc) + return dlsc, err + case string(ChannelNameBasicChannelChannelNameOmnichannel): + var o Omnichannel + err := json.Unmarshal(body, &o) + return o, err + case string(ChannelNameBasicChannelChannelNameTelephonyChannel): + var tc TelephonyChannel + err := json.Unmarshal(body, &tc) + return tc, err + case string(ChannelNameBasicChannelChannelNameAcsChatChannel): + var acc AcsChatChannel + err := json.Unmarshal(body, &acc) + return acc, err + case string(ChannelNameBasicChannelChannelNameSearchAssistant): + var sa SearchAssistant + err := json.Unmarshal(body, &sa) + return sa, err + case string(ChannelNameBasicChannelChannelNameM365Extensions): + var me M365Extensions + err := json.Unmarshal(body, &me) + return me, err + default: + var c Channel + err := json.Unmarshal(body, &c) + return c, err + } +} +func unmarshalBasicChannelArray(body []byte) ([]BasicChannel, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + cArray := make([]BasicChannel, len(rawMessages)) + + for index, rawMessage := range rawMessages { + c, err := unmarshalBasicChannel(*rawMessage) + if err != nil { + return nil, err + } + cArray[index] = c + } + return cArray, nil +} + +// MarshalJSON is the custom marshaler for Channel. +func (c Channel) MarshalJSON() ([]byte, error) { + c.ChannelName = ChannelNameBasicChannelChannelNameChannel + objectMap := make(map[string]interface{}) + if c.Etag != nil { + objectMap["etag"] = c.Etag + } + if c.Location != nil { + objectMap["location"] = c.Location + } + if c.ChannelName != "" { + objectMap["channelName"] = c.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for Channel. +func (c Channel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for Channel. +func (c Channel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for Channel. +func (c Channel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for Channel. +func (c Channel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for Channel. +func (c Channel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for Channel. +func (c Channel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for Channel. +func (c Channel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for Channel. +func (c Channel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for Channel. +func (c Channel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for Channel. +func (c Channel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for Channel. +func (c Channel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for Channel. +func (c Channel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for Channel. +func (c Channel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for Channel. +func (c Channel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for Channel. +func (c Channel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for Channel. +func (c Channel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for Channel. +func (c Channel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for Channel. +func (c Channel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for Channel. +func (c Channel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for Channel. +func (c Channel) AsChannel() (*Channel, bool) { + return &c, true +} + +// AsBasicChannel is the BasicChannel implementation for Channel. +func (c Channel) AsBasicChannel() (BasicChannel, bool) { + return &c, true +} + +// ChannelResponseList the list of bot service channel operation response. +type ChannelResponseList struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of bot service channel resources. + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; Gets the list of bot service channel results and their properties. + Value *[]BotChannel `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for ChannelResponseList. +func (crl ChannelResponseList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if crl.NextLink != nil { + objectMap["nextLink"] = crl.NextLink + } + return json.Marshal(objectMap) +} + +// ChannelResponseListIterator provides access to a complete listing of BotChannel values. +type ChannelResponseListIterator struct { + i int + page ChannelResponseListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ChannelResponseListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ChannelResponseListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ChannelResponseListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ChannelResponseListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ChannelResponseListIterator) Response() ChannelResponseList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ChannelResponseListIterator) Value() BotChannel { + if !iter.page.NotDone() { + return BotChannel{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ChannelResponseListIterator type. +func NewChannelResponseListIterator(page ChannelResponseListPage) ChannelResponseListIterator { + return ChannelResponseListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (crl ChannelResponseList) IsEmpty() bool { + return crl.Value == nil || len(*crl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (crl ChannelResponseList) hasNextLink() bool { + return crl.NextLink != nil && len(*crl.NextLink) != 0 +} + +// channelResponseListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (crl ChannelResponseList) channelResponseListPreparer(ctx context.Context) (*http.Request, error) { + if !crl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(crl.NextLink))) +} + +// ChannelResponseListPage contains a page of BotChannel values. +type ChannelResponseListPage struct { + fn func(context.Context, ChannelResponseList) (ChannelResponseList, error) + crl ChannelResponseList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ChannelResponseListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ChannelResponseListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.crl) + if err != nil { + return err + } + page.crl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ChannelResponseListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ChannelResponseListPage) NotDone() bool { + return !page.crl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ChannelResponseListPage) Response() ChannelResponseList { + return page.crl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ChannelResponseListPage) Values() []BotChannel { + if page.crl.IsEmpty() { + return nil + } + return *page.crl.Value +} + +// Creates a new instance of the ChannelResponseListPage type. +func NewChannelResponseListPage(cur ChannelResponseList, getNextPage func(context.Context, ChannelResponseList) (ChannelResponseList, error)) ChannelResponseListPage { + return ChannelResponseListPage{ + fn: getNextPage, + crl: cur, + } +} + +// ChannelSettings channel settings definition +type ChannelSettings struct { + // ExtensionKey1 - The extensionKey1 + ExtensionKey1 *string `json:"extensionKey1,omitempty"` + // ExtensionKey2 - The extensionKey2 + ExtensionKey2 *string `json:"extensionKey2,omitempty"` + // Sites - The list of sites + Sites *[]Site `json:"sites,omitempty"` + // ChannelID - The channel id + ChannelID *string `json:"channelId,omitempty"` + // ChannelDisplayName - The channel display name + ChannelDisplayName *string `json:"channelDisplayName,omitempty"` + // BotID - The bot id + BotID *string `json:"botId,omitempty"` + // BotIconURL - The bot icon url + BotIconURL *string `json:"botIconUrl,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` + // DisableLocalAuth - Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // RequireTermsAgreement - Whether customer needs to agree to new terms. + RequireTermsAgreement *bool `json:"requireTermsAgreement,omitempty"` +} + +// CheckNameAvailabilityRequestBody the request body for a request to Bot Service Management to check +// availability of a bot name. +type CheckNameAvailabilityRequestBody struct { + // Name - the name of the bot for which availability needs to be checked. + Name *string `json:"name,omitempty"` + // Type - the type of the bot for which availability needs to be checked + Type *string `json:"type,omitempty"` +} + +// CheckNameAvailabilityResponseBody the response body returned for a request to Bot Service Management to +// check availability of a bot name. +type CheckNameAvailabilityResponseBody struct { + autorest.Response `json:"-"` + // Valid - indicates if the bot name is valid. + Valid *bool `json:"valid,omitempty"` + // Message - additional message from the bot management api showing why a bot name is not available + Message *string `json:"message,omitempty"` + // AbsCode - response code from ABS + AbsCode *string `json:"absCode,omitempty"` +} + +// ConnectionItemName the display name of a connection Item Setting registered with the Bot +type ConnectionItemName struct { + // Name - READ-ONLY; Connection Item name that has been added in the API + Name *string `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionItemName. +func (cin ConnectionItemName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ConnectionSetting bot channel resource definition +type ConnectionSetting struct { + autorest.Response `json:"-"` + // Properties - The set of properties specific to bot channel resource + Properties *ConnectionSettingProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Specifies the resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Specifies the name of the resource. + Name *string `json:"name,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Specifies the type of the resource. + Type *string `json:"type,omitempty"` + // Tags - Contains resource tags defined as key/value pairs. + Tags map[string]*string `json:"tags"` + // Sku - Gets or sets the SKU of the resource. + Sku *Sku `json:"sku,omitempty"` + // Kind - Required. Gets or sets the Kind of the resource. Possible values include: 'KindSdk', 'KindDesigner', 'KindBot', 'KindFunction', 'KindAzurebot' + Kind Kind `json:"kind,omitempty"` + // Etag - Entity Tag + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionSetting. +func (cs ConnectionSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cs.Properties != nil { + objectMap["properties"] = cs.Properties + } + if cs.Location != nil { + objectMap["location"] = cs.Location + } + if cs.Tags != nil { + objectMap["tags"] = cs.Tags + } + if cs.Sku != nil { + objectMap["sku"] = cs.Sku + } + if cs.Kind != "" { + objectMap["kind"] = cs.Kind + } + if cs.Etag != nil { + objectMap["etag"] = cs.Etag + } + return json.Marshal(objectMap) +} + +// ConnectionSettingParameter extra Parameter in a Connection Setting Properties to indicate service +// provider specific properties +type ConnectionSettingParameter struct { + // Key - Key for the Connection Setting Parameter. + Key *string `json:"key,omitempty"` + // Value - Value associated with the Connection Setting Parameter. + Value *string `json:"value,omitempty"` +} + +// ConnectionSettingProperties properties for a Connection Setting Item +type ConnectionSettingProperties struct { + // ClientID - Client Id associated with the Connection Setting. + ClientID *string `json:"clientId,omitempty"` + // SettingID - READ-ONLY; Setting Id set by the service for the Connection Setting. + SettingID *string `json:"settingId,omitempty"` + // ClientSecret - Client Secret associated with the Connection Setting + ClientSecret *string `json:"clientSecret,omitempty"` + // Scopes - Scopes associated with the Connection Setting + Scopes *string `json:"scopes,omitempty"` + // ServiceProviderID - Service Provider Id associated with the Connection Setting + ServiceProviderID *string `json:"serviceProviderId,omitempty"` + // ServiceProviderDisplayName - Service Provider Display Name associated with the Connection Setting + ServiceProviderDisplayName *string `json:"serviceProviderDisplayName,omitempty"` + // Parameters - Service Provider Parameters associated with the Connection Setting + Parameters *[]ConnectionSettingParameter `json:"parameters,omitempty"` + // ProvisioningState - Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionSettingProperties. +func (csp ConnectionSettingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csp.ClientID != nil { + objectMap["clientId"] = csp.ClientID + } + if csp.ClientSecret != nil { + objectMap["clientSecret"] = csp.ClientSecret + } + if csp.Scopes != nil { + objectMap["scopes"] = csp.Scopes + } + if csp.ServiceProviderID != nil { + objectMap["serviceProviderId"] = csp.ServiceProviderID + } + if csp.ServiceProviderDisplayName != nil { + objectMap["serviceProviderDisplayName"] = csp.ServiceProviderDisplayName + } + if csp.Parameters != nil { + objectMap["parameters"] = csp.Parameters + } + if csp.ProvisioningState != nil { + objectMap["provisioningState"] = csp.ProvisioningState + } + return json.Marshal(objectMap) +} + +// ConnectionSettingResponseList the list of bot service connection settings response. +type ConnectionSettingResponseList struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of bot service connection setting resources. + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; Gets the list of bot service connection settings and their properties. + Value *[]ConnectionSetting `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionSettingResponseList. +func (csrl ConnectionSettingResponseList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csrl.NextLink != nil { + objectMap["nextLink"] = csrl.NextLink + } + return json.Marshal(objectMap) +} + +// ConnectionSettingResponseListIterator provides access to a complete listing of ConnectionSetting values. +type ConnectionSettingResponseListIterator struct { + i int + page ConnectionSettingResponseListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ConnectionSettingResponseListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionSettingResponseListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ConnectionSettingResponseListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ConnectionSettingResponseListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ConnectionSettingResponseListIterator) Response() ConnectionSettingResponseList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ConnectionSettingResponseListIterator) Value() ConnectionSetting { + if !iter.page.NotDone() { + return ConnectionSetting{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ConnectionSettingResponseListIterator type. +func NewConnectionSettingResponseListIterator(page ConnectionSettingResponseListPage) ConnectionSettingResponseListIterator { + return ConnectionSettingResponseListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (csrl ConnectionSettingResponseList) IsEmpty() bool { + return csrl.Value == nil || len(*csrl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (csrl ConnectionSettingResponseList) hasNextLink() bool { + return csrl.NextLink != nil && len(*csrl.NextLink) != 0 +} + +// connectionSettingResponseListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (csrl ConnectionSettingResponseList) connectionSettingResponseListPreparer(ctx context.Context) (*http.Request, error) { + if !csrl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(csrl.NextLink))) +} + +// ConnectionSettingResponseListPage contains a page of ConnectionSetting values. +type ConnectionSettingResponseListPage struct { + fn func(context.Context, ConnectionSettingResponseList) (ConnectionSettingResponseList, error) + csrl ConnectionSettingResponseList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ConnectionSettingResponseListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionSettingResponseListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.csrl) + if err != nil { + return err + } + page.csrl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ConnectionSettingResponseListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ConnectionSettingResponseListPage) NotDone() bool { + return !page.csrl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ConnectionSettingResponseListPage) Response() ConnectionSettingResponseList { + return page.csrl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ConnectionSettingResponseListPage) Values() []ConnectionSetting { + if page.csrl.IsEmpty() { + return nil + } + return *page.csrl.Value +} + +// Creates a new instance of the ConnectionSettingResponseListPage type. +func NewConnectionSettingResponseListPage(cur ConnectionSettingResponseList, getNextPage func(context.Context, ConnectionSettingResponseList) (ConnectionSettingResponseList, error)) ConnectionSettingResponseListPage { + return ConnectionSettingResponseListPage{ + fn: getNextPage, + csrl: cur, + } +} + +// DirectLineChannel direct Line channel definition +type DirectLineChannel struct { + // Properties - The set of properties specific to Direct Line channel resource + Properties *DirectLineChannelProperties `json:"properties,omitempty"` + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for DirectLineChannel. +func (dlc DirectLineChannel) MarshalJSON() ([]byte, error) { + dlc.ChannelName = ChannelNameBasicChannelChannelNameDirectLineChannel + objectMap := make(map[string]interface{}) + if dlc.Properties != nil { + objectMap["properties"] = dlc.Properties + } + if dlc.Etag != nil { + objectMap["etag"] = dlc.Etag + } + if dlc.Location != nil { + objectMap["location"] = dlc.Location + } + if dlc.ChannelName != "" { + objectMap["channelName"] = dlc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return &dlc, true +} + +// AsTelegramChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsBasicChannel() (BasicChannel, bool) { + return &dlc, true +} + +// DirectLineChannelProperties the parameters to provide for the Direct Line channel. +type DirectLineChannelProperties struct { + // Sites - The list of Direct Line sites + Sites *[]DirectLineSite `json:"sites,omitempty"` + // ExtensionKey1 - The extensionKey1 + ExtensionKey1 *string `json:"extensionKey1,omitempty"` + // ExtensionKey2 - The extensionKey2 + ExtensionKey2 *string `json:"extensionKey2,omitempty"` + // DirectLineEmbedCode - Direct Line embed code of the resource + DirectLineEmbedCode *string `json:"DirectLineEmbedCode,omitempty"` +} + +// DirectLineSite a site for the Direct Line channel +type DirectLineSite struct { + // TenantID - Tenant Id + TenantID *string `json:"tenantId,omitempty"` + // SiteID - READ-ONLY; Site Id + SiteID *string `json:"siteId,omitempty"` + // SiteName - Site name + SiteName *string `json:"siteName,omitempty"` + // Key - READ-ONLY; Primary key. Value only returned through POST to the action Channel List API, otherwise empty. + Key *string `json:"key,omitempty"` + // Key2 - READ-ONLY; Secondary key. Value only returned through POST to the action Channel List API, otherwise empty. + Key2 *string `json:"key2,omitempty"` + // IsEnabled - Whether this site is enabled for DirectLine channel + IsEnabled *bool `json:"isEnabled,omitempty"` + // IsTokenEnabled - READ-ONLY; Whether this site is token enabled for channel + IsTokenEnabled *bool `json:"isTokenEnabled,omitempty"` + // IsEndpointParametersEnabled - Whether this site is EndpointParameters enabled for channel + IsEndpointParametersEnabled *bool `json:"isEndpointParametersEnabled,omitempty"` + // IsDetailedLoggingEnabled - Whether this site is disabled detailed logging for + IsDetailedLoggingEnabled *bool `json:"isDetailedLoggingEnabled,omitempty"` + // IsBlockUserUploadEnabled - Whether this site is enabled for block user upload. + IsBlockUserUploadEnabled *bool `json:"isBlockUserUploadEnabled,omitempty"` + // IsNoStorageEnabled - Whether this no-storage site is disabled detailed logging for + IsNoStorageEnabled *bool `json:"isNoStorageEnabled,omitempty"` + // ETag - Entity Tag + ETag *string `json:"eTag,omitempty"` + // AppID - DirectLine application id + AppID *string `json:"appId,omitempty"` + // IsV1Enabled - Whether this site is enabled for Bot Framework V1 protocol. + IsV1Enabled *bool `json:"isV1Enabled,omitempty"` + // IsV3Enabled - Whether this site is enabled for Bot Framework V3 protocol. + IsV3Enabled *bool `json:"isV3Enabled,omitempty"` + // IsSecureSiteEnabled - Whether this site is enabled for authentication with Bot Framework. + IsSecureSiteEnabled *bool `json:"isSecureSiteEnabled,omitempty"` + // TrustedOrigins - List of Trusted Origin URLs for this site. This field is applicable only if isSecureSiteEnabled is True. + TrustedOrigins *[]string `json:"trustedOrigins,omitempty"` + // IsWebChatSpeechEnabled - Whether this site is enabled for Webchat Speech + IsWebChatSpeechEnabled *bool `json:"isWebChatSpeechEnabled,omitempty"` + // IsWebchatPreviewEnabled - Whether this site is enabled for preview versions of Webchat + IsWebchatPreviewEnabled *bool `json:"isWebchatPreviewEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for DirectLineSite. +func (dls DirectLineSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dls.TenantID != nil { + objectMap["tenantId"] = dls.TenantID + } + if dls.SiteName != nil { + objectMap["siteName"] = dls.SiteName + } + if dls.IsEnabled != nil { + objectMap["isEnabled"] = dls.IsEnabled + } + if dls.IsEndpointParametersEnabled != nil { + objectMap["isEndpointParametersEnabled"] = dls.IsEndpointParametersEnabled + } + if dls.IsDetailedLoggingEnabled != nil { + objectMap["isDetailedLoggingEnabled"] = dls.IsDetailedLoggingEnabled + } + if dls.IsBlockUserUploadEnabled != nil { + objectMap["isBlockUserUploadEnabled"] = dls.IsBlockUserUploadEnabled + } + if dls.IsNoStorageEnabled != nil { + objectMap["isNoStorageEnabled"] = dls.IsNoStorageEnabled + } + if dls.ETag != nil { + objectMap["eTag"] = dls.ETag + } + if dls.AppID != nil { + objectMap["appId"] = dls.AppID + } + if dls.IsV1Enabled != nil { + objectMap["isV1Enabled"] = dls.IsV1Enabled + } + if dls.IsV3Enabled != nil { + objectMap["isV3Enabled"] = dls.IsV3Enabled + } + if dls.IsSecureSiteEnabled != nil { + objectMap["isSecureSiteEnabled"] = dls.IsSecureSiteEnabled + } + if dls.TrustedOrigins != nil { + objectMap["trustedOrigins"] = dls.TrustedOrigins + } + if dls.IsWebChatSpeechEnabled != nil { + objectMap["isWebChatSpeechEnabled"] = dls.IsWebChatSpeechEnabled + } + if dls.IsWebchatPreviewEnabled != nil { + objectMap["isWebchatPreviewEnabled"] = dls.IsWebchatPreviewEnabled + } + return json.Marshal(objectMap) +} + +// DirectLineSpeechChannel directLine Speech channel definition +type DirectLineSpeechChannel struct { + // Properties - The set of properties specific to DirectLine Speech channel resource + Properties *DirectLineSpeechChannelProperties `json:"properties,omitempty"` + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) MarshalJSON() ([]byte, error) { + dlsc.ChannelName = ChannelNameBasicChannelChannelNameDirectLineSpeechChannel + objectMap := make(map[string]interface{}) + if dlsc.Properties != nil { + objectMap["properties"] = dlsc.Properties + } + if dlsc.Etag != nil { + objectMap["etag"] = dlsc.Etag + } + if dlsc.Location != nil { + objectMap["location"] = dlsc.Location + } + if dlsc.ChannelName != "" { + objectMap["channelName"] = dlsc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return &dlsc, true +} + +// AsOmnichannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsBasicChannel() (BasicChannel, bool) { + return &dlsc, true +} + +// DirectLineSpeechChannelProperties the parameters to provide for the DirectLine Speech channel. +type DirectLineSpeechChannelProperties struct { + // CognitiveServiceResourceID - The cognitive service id with this channel registration. + CognitiveServiceResourceID *string `json:"cognitiveServiceResourceId,omitempty"` + // CognitiveServiceRegion - The cognitive service region with this channel registration. + CognitiveServiceRegion *string `json:"cognitiveServiceRegion,omitempty"` + // CognitiveServiceSubscriptionKey - The cognitive service subscription key to use with this channel registration. + CognitiveServiceSubscriptionKey *string `json:"cognitiveServiceSubscriptionKey,omitempty"` + // IsEnabled - Whether this channel is enabled or not. + IsEnabled *bool `json:"isEnabled,omitempty"` + // CustomVoiceDeploymentID - Custom speech model id (optional). + CustomVoiceDeploymentID *string `json:"customVoiceDeploymentId,omitempty"` + // CustomSpeechModelID - Custom voice deployment id (optional). + CustomSpeechModelID *string `json:"customSpeechModelId,omitempty"` + // IsDefaultBotForCogSvcAccount - Make this a default bot for chosen cognitive service account. + IsDefaultBotForCogSvcAccount *bool `json:"isDefaultBotForCogSvcAccount,omitempty"` +} + +// EmailChannel email channel definition +type EmailChannel struct { + // Properties - The set of properties specific to email channel resource + Properties *EmailChannelProperties `json:"properties,omitempty"` + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for EmailChannel. +func (ec EmailChannel) MarshalJSON() ([]byte, error) { + ec.ChannelName = ChannelNameBasicChannelChannelNameEmailChannel + objectMap := make(map[string]interface{}) + if ec.Properties != nil { + objectMap["properties"] = ec.Properties + } + if ec.Etag != nil { + objectMap["etag"] = ec.Etag + } + if ec.Location != nil { + objectMap["location"] = ec.Location + } + if ec.ChannelName != "" { + objectMap["channelName"] = ec.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsEmailChannel() (*EmailChannel, bool) { + return &ec, true +} + +// AsOutlookChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsBasicChannel() (BasicChannel, bool) { + return &ec, true +} + +// EmailChannelProperties the parameters to provide for the Email channel. +type EmailChannelProperties struct { + // EmailAddress - The email address + EmailAddress *string `json:"emailAddress,omitempty"` + // AuthMethod - Email channel auth method. 0 Password (Default); 1 Graph. + AuthMethod *float64 `json:"authMethod,omitempty"` + // Password - The password for the email address. Value only returned through POST to the action Channel List API, otherwise empty. + Password *string `json:"password,omitempty"` + // MagicCode - The magic code for setting up the modern authentication. + MagicCode *string `json:"magicCode,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// Error bot Service error object. +type Error struct { + // Error - The error body. + Error *ErrorBody `json:"error,omitempty"` +} + +// ErrorBody bot Service error body. +type ErrorBody struct { + // Code - error code + Code *string `json:"code,omitempty"` + // Message - error message + Message *string `json:"message,omitempty"` +} + +// FacebookChannel facebook channel definition +type FacebookChannel struct { + // Properties - The set of properties specific to bot facebook channel + Properties *FacebookChannelProperties `json:"properties,omitempty"` + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for FacebookChannel. +func (fc FacebookChannel) MarshalJSON() ([]byte, error) { + fc.ChannelName = ChannelNameBasicChannelChannelNameFacebookChannel + objectMap := make(map[string]interface{}) + if fc.Properties != nil { + objectMap["properties"] = fc.Properties + } + if fc.Etag != nil { + objectMap["etag"] = fc.Etag + } + if fc.Location != nil { + objectMap["location"] = fc.Location + } + if fc.ChannelName != "" { + objectMap["channelName"] = fc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return &fc, true +} + +// AsEmailChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsBasicChannel() (BasicChannel, bool) { + return &fc, true +} + +// FacebookChannelProperties the parameters to provide for the Facebook channel. +type FacebookChannelProperties struct { + // VerifyToken - READ-ONLY; Verify token. Value only returned through POST to the action Channel List API, otherwise empty. + VerifyToken *string `json:"verifyToken,omitempty"` + // Pages - The list of Facebook pages + Pages *[]FacebookPage `json:"pages,omitempty"` + // AppID - Facebook application id + AppID *string `json:"appId,omitempty"` + // AppSecret - Facebook application secret. Value only returned through POST to the action Channel List API, otherwise empty. + AppSecret *string `json:"appSecret,omitempty"` + // CallbackURL - READ-ONLY; Callback Url + CallbackURL *string `json:"callbackUrl,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for FacebookChannelProperties. +func (fcp FacebookChannelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fcp.Pages != nil { + objectMap["pages"] = fcp.Pages + } + if fcp.AppID != nil { + objectMap["appId"] = fcp.AppID + } + if fcp.AppSecret != nil { + objectMap["appSecret"] = fcp.AppSecret + } + if fcp.IsEnabled != nil { + objectMap["isEnabled"] = fcp.IsEnabled + } + return json.Marshal(objectMap) +} + +// FacebookPage a Facebook page for Facebook channel registration +type FacebookPage struct { + // ID - Page id + ID *string `json:"id,omitempty"` + // AccessToken - Facebook application access token. Value only returned through POST to the action Channel List API, otherwise empty. + AccessToken *string `json:"accessToken,omitempty"` +} + +// HostSettingsResponse the response body returned for a request to Bot Service Management to check per +// subscription hostSettings +type HostSettingsResponse struct { + autorest.Response `json:"-"` + // OAuthURL - For in-conversation bot user authentication + OAuthURL *string `json:"OAuthUrl,omitempty"` + // ToBotFromChannelOpenIDMetadataURL - For verifying incoming tokens from the channels + ToBotFromChannelOpenIDMetadataURL *string `json:"ToBotFromChannelOpenIdMetadataUrl,omitempty"` + // ToBotFromChannelTokenIssuer - For verifying incoming tokens from the channels + ToBotFromChannelTokenIssuer *string `json:"ToBotFromChannelTokenIssuer,omitempty"` + // ToBotFromEmulatorOpenIDMetadataURL - For verifying incoming tokens from bot emulator + ToBotFromEmulatorOpenIDMetadataURL *string `json:"ToBotFromEmulatorOpenIdMetadataUrl,omitempty"` + // ToChannelFromBotLoginURL - For getting access token to channels from bot host + ToChannelFromBotLoginURL *string `json:"ToChannelFromBotLoginUrl,omitempty"` + // ToChannelFromBotOAuthScope - For getting access token to channels from bot host + ToChannelFromBotOAuthScope *string `json:"ToChannelFromBotOAuthScope,omitempty"` + // ValidateAuthority - Per cloud OAuth setting on whether authority is validated + ValidateAuthority *bool `json:"ValidateAuthority,omitempty"` + // BotOpenIDMetadata - Same as toBotFromChannelOpenIdMetadataUrl, used by SDK < v4.12 + BotOpenIDMetadata *string `json:"BotOpenIdMetadata,omitempty"` +} + +// KikChannel kik channel definition +type KikChannel struct { + // Properties - The set of properties specific to Kik channel resource + Properties *KikChannelProperties `json:"properties,omitempty"` + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for KikChannel. +func (kc KikChannel) MarshalJSON() ([]byte, error) { + kc.ChannelName = ChannelNameBasicChannelChannelNameKikChannel + objectMap := make(map[string]interface{}) + if kc.Properties != nil { + objectMap["properties"] = kc.Properties + } + if kc.Etag != nil { + objectMap["etag"] = kc.Etag + } + if kc.Location != nil { + objectMap["location"] = kc.Location + } + if kc.ChannelName != "" { + objectMap["channelName"] = kc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsKikChannel() (*KikChannel, bool) { + return &kc, true +} + +// AsWebChatChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsBasicChannel() (BasicChannel, bool) { + return &kc, true +} + +// KikChannelProperties the parameters to provide for the Kik channel. +type KikChannelProperties struct { + // UserName - The Kik user name + UserName *string `json:"userName,omitempty"` + // APIKey - Kik API key. Value only returned through POST to the action Channel List API, otherwise empty. + APIKey *string `json:"apiKey,omitempty"` + // IsValidated - Whether this channel is validated for the bot + IsValidated *bool `json:"isValidated,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// LineChannel line channel definition +type LineChannel struct { + // Properties - The set of properties specific to line channel resource + Properties *LineChannelProperties `json:"properties,omitempty"` + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for LineChannel. +func (lc LineChannel) MarshalJSON() ([]byte, error) { + lc.ChannelName = ChannelNameBasicChannelChannelNameLineChannel + objectMap := make(map[string]interface{}) + if lc.Properties != nil { + objectMap["properties"] = lc.Properties + } + if lc.Etag != nil { + objectMap["etag"] = lc.Etag + } + if lc.Location != nil { + objectMap["location"] = lc.Location + } + if lc.ChannelName != "" { + objectMap["channelName"] = lc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsLineChannel() (*LineChannel, bool) { + return &lc, true +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsBasicChannel() (BasicChannel, bool) { + return &lc, true +} + +// LineChannelProperties the parameters to provide for the Line channel. +type LineChannelProperties struct { + // LineRegistrations - The list of line channel registrations + LineRegistrations *[]LineRegistration `json:"lineRegistrations,omitempty"` + // CallbackURL - READ-ONLY; Callback Url to enter in line registration. + CallbackURL *string `json:"callbackUrl,omitempty"` + // IsValidated - READ-ONLY; Whether this channel is validated for the bot + IsValidated *bool `json:"isValidated,omitempty"` +} + +// MarshalJSON is the custom marshaler for LineChannelProperties. +func (lcp LineChannelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lcp.LineRegistrations != nil { + objectMap["lineRegistrations"] = lcp.LineRegistrations + } + return json.Marshal(objectMap) +} + +// LineRegistration the properties corresponding to a line channel registration +type LineRegistration struct { + // GeneratedID - READ-ONLY; Id generated for the line channel registration + GeneratedID *string `json:"generatedId,omitempty"` + // ChannelSecret - Secret for the line channel registration + ChannelSecret *string `json:"channelSecret,omitempty"` + // ChannelAccessToken - Access token for the line channel registration + ChannelAccessToken *string `json:"channelAccessToken,omitempty"` +} + +// MarshalJSON is the custom marshaler for LineRegistration. +func (lr LineRegistration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lr.ChannelSecret != nil { + objectMap["channelSecret"] = lr.ChannelSecret + } + if lr.ChannelAccessToken != nil { + objectMap["channelAccessToken"] = lr.ChannelAccessToken + } + return json.Marshal(objectMap) +} + +// ListChannelWithKeysResponse the ARM channel of list channel with keys operation response. +type ListChannelWithKeysResponse struct { + autorest.Response `json:"-"` + // Resource - The set of properties specific to bot channel resource + Resource BasicChannel `json:"resource,omitempty"` + // Setting - Channel settings + Setting *ChannelSettings `json:"setting,omitempty"` + // ProvisioningState - Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // EntityTag - Entity tag of the resource + EntityTag *string `json:"entityTag,omitempty"` + // ChangedTime - Changed time of the resource + ChangedTime *string `json:"changedTime,omitempty"` + // Properties - The set of properties specific to bot channel resource + Properties BasicChannel `json:"properties,omitempty"` + // ID - READ-ONLY; Specifies the resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Specifies the name of the resource. + Name *string `json:"name,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Specifies the type of the resource. + Type *string `json:"type,omitempty"` + // Tags - Contains resource tags defined as key/value pairs. + Tags map[string]*string `json:"tags"` + // Sku - Gets or sets the SKU of the resource. + Sku *Sku `json:"sku,omitempty"` + // Kind - Required. Gets or sets the Kind of the resource. Possible values include: 'KindSdk', 'KindDesigner', 'KindBot', 'KindFunction', 'KindAzurebot' + Kind Kind `json:"kind,omitempty"` + // Etag - Entity Tag + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListChannelWithKeysResponse. +func (lcwkr ListChannelWithKeysResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["resource"] = lcwkr.Resource + if lcwkr.Setting != nil { + objectMap["setting"] = lcwkr.Setting + } + if lcwkr.ProvisioningState != nil { + objectMap["provisioningState"] = lcwkr.ProvisioningState + } + if lcwkr.EntityTag != nil { + objectMap["entityTag"] = lcwkr.EntityTag + } + if lcwkr.ChangedTime != nil { + objectMap["changedTime"] = lcwkr.ChangedTime + } + objectMap["properties"] = lcwkr.Properties + if lcwkr.Location != nil { + objectMap["location"] = lcwkr.Location + } + if lcwkr.Tags != nil { + objectMap["tags"] = lcwkr.Tags + } + if lcwkr.Sku != nil { + objectMap["sku"] = lcwkr.Sku + } + if lcwkr.Kind != "" { + objectMap["kind"] = lcwkr.Kind + } + if lcwkr.Etag != nil { + objectMap["etag"] = lcwkr.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ListChannelWithKeysResponse struct. +func (lcwkr *ListChannelWithKeysResponse) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "resource": + if v != nil { + resource, err := unmarshalBasicChannel(*v) + if err != nil { + return err + } + lcwkr.Resource = resource + } + case "setting": + if v != nil { + var setting ChannelSettings + err = json.Unmarshal(*v, &setting) + if err != nil { + return err + } + lcwkr.Setting = &setting + } + case "provisioningState": + if v != nil { + var provisioningState string + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + lcwkr.ProvisioningState = &provisioningState + } + case "entityTag": + if v != nil { + var entityTag string + err = json.Unmarshal(*v, &entityTag) + if err != nil { + return err + } + lcwkr.EntityTag = &entityTag + } + case "changedTime": + if v != nil { + var changedTime string + err = json.Unmarshal(*v, &changedTime) + if err != nil { + return err + } + lcwkr.ChangedTime = &changedTime + } + case "properties": + if v != nil { + properties, err := unmarshalBasicChannel(*v) + if err != nil { + return err + } + lcwkr.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lcwkr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lcwkr.Name = &name + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lcwkr.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lcwkr.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lcwkr.Tags = tags + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + lcwkr.Sku = &sku + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lcwkr.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lcwkr.Etag = &etag + } + } + } + + return nil +} + +// M365Extensions m365 Extensions definition +type M365Extensions struct { + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for M365Extensions. +func (me M365Extensions) MarshalJSON() ([]byte, error) { + me.ChannelName = ChannelNameBasicChannelChannelNameM365Extensions + objectMap := make(map[string]interface{}) + if me.Etag != nil { + objectMap["etag"] = me.Etag + } + if me.Location != nil { + objectMap["location"] = me.Location + } + if me.ChannelName != "" { + objectMap["channelName"] = me.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsM365Extensions() (*M365Extensions, bool) { + return &me, true +} + +// AsChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for M365Extensions. +func (me M365Extensions) AsBasicChannel() (BasicChannel, bool) { + return &me, true +} + +// MsTeamsChannel microsoft Teams channel definition +type MsTeamsChannel struct { + // Properties - The set of properties specific to Microsoft Teams channel resource + Properties *MsTeamsChannelProperties `json:"properties,omitempty"` + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for MsTeamsChannel. +func (mtc MsTeamsChannel) MarshalJSON() ([]byte, error) { + mtc.ChannelName = ChannelNameBasicChannelChannelNameMsTeamsChannel + objectMap := make(map[string]interface{}) + if mtc.Properties != nil { + objectMap["properties"] = mtc.Properties + } + if mtc.Etag != nil { + objectMap["etag"] = mtc.Etag + } + if mtc.Location != nil { + objectMap["location"] = mtc.Location + } + if mtc.ChannelName != "" { + objectMap["channelName"] = mtc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return &mtc, true +} + +// AsSkypeChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsBasicChannel() (BasicChannel, bool) { + return &mtc, true +} + +// MsTeamsChannelProperties the parameters to provide for the Microsoft Teams channel. +type MsTeamsChannelProperties struct { + // EnableCalling - Enable calling for Microsoft Teams channel + EnableCalling *bool `json:"enableCalling,omitempty"` + // CallingWebhook - Webhook for Microsoft Teams channel calls + CallingWebhook *string `json:"callingWebhook,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` + // IncomingCallRoute - Webhook for Microsoft Teams channel calls + IncomingCallRoute *string `json:"incomingCallRoute,omitempty"` + // DeploymentEnvironment - Deployment environment for Microsoft Teams channel calls + DeploymentEnvironment *string `json:"deploymentEnvironment,omitempty"` + // AcceptedTerms - Whether this channel accepted terms + AcceptedTerms *bool `json:"acceptedTerms,omitempty"` +} + +// Omnichannel omnichannel channel definition +type Omnichannel struct { + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for Omnichannel. +func (o Omnichannel) MarshalJSON() ([]byte, error) { + o.ChannelName = ChannelNameBasicChannelChannelNameOmnichannel + objectMap := make(map[string]interface{}) + if o.Etag != nil { + objectMap["etag"] = o.Etag + } + if o.Location != nil { + objectMap["location"] = o.Location + } + if o.ChannelName != "" { + objectMap["channelName"] = o.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsOmnichannel() (*Omnichannel, bool) { + return &o, true +} + +// AsTelephonyChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for Omnichannel. +func (o Omnichannel) AsBasicChannel() (BasicChannel, bool) { + return &o, true +} + +// OperationDisplayInfo the operation supported by Bot Service Management. +type OperationDisplayInfo struct { + // Description - The description of the operation. + Description *string `json:"description,omitempty"` + // Operation - The action that users can perform, based on their permission level. + Operation *string `json:"operation,omitempty"` + // Provider - Service provider: Microsoft Bot Service. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` +} + +// OperationEntity the operations supported by Bot Service Management. +type OperationEntity struct { + // Name - Operation name: {provider}/{resource}/{operation}. + Name *string `json:"name,omitempty"` + // Display - The operation supported by Bot Service Management. + Display *OperationDisplayInfo `json:"display,omitempty"` + // Origin - The origin of the operation. + Origin *string `json:"origin,omitempty"` + // Properties - Additional properties. + Properties interface{} `json:"properties,omitempty"` +} + +// OperationEntityListResult the list of bot service operation response. +type OperationEntityListResult struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of operations. + NextLink *string `json:"nextLink,omitempty"` + // Value - The list of operations. + Value *[]OperationEntity `json:"value,omitempty"` +} + +// OperationEntityListResultIterator provides access to a complete listing of OperationEntity values. +type OperationEntityListResultIterator struct { + i int + page OperationEntityListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationEntityListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationEntityListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationEntityListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationEntityListResultIterator) Response() OperationEntityListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationEntityListResultIterator) Value() OperationEntity { + if !iter.page.NotDone() { + return OperationEntity{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationEntityListResultIterator type. +func NewOperationEntityListResultIterator(page OperationEntityListResultPage) OperationEntityListResultIterator { + return OperationEntityListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (oelr OperationEntityListResult) IsEmpty() bool { + return oelr.Value == nil || len(*oelr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (oelr OperationEntityListResult) hasNextLink() bool { + return oelr.NextLink != nil && len(*oelr.NextLink) != 0 +} + +// operationEntityListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (oelr OperationEntityListResult) operationEntityListResultPreparer(ctx context.Context) (*http.Request, error) { + if !oelr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(oelr.NextLink))) +} + +// OperationEntityListResultPage contains a page of OperationEntity values. +type OperationEntityListResultPage struct { + fn func(context.Context, OperationEntityListResult) (OperationEntityListResult, error) + oelr OperationEntityListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationEntityListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.oelr) + if err != nil { + return err + } + page.oelr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationEntityListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationEntityListResultPage) NotDone() bool { + return !page.oelr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationEntityListResultPage) Response() OperationEntityListResult { + return page.oelr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationEntityListResultPage) Values() []OperationEntity { + if page.oelr.IsEmpty() { + return nil + } + return *page.oelr.Value +} + +// Creates a new instance of the OperationEntityListResultPage type. +func NewOperationEntityListResultPage(cur OperationEntityListResult, getNextPage func(context.Context, OperationEntityListResult) (OperationEntityListResult, error)) OperationEntityListResultPage { + return OperationEntityListResultPage{ + fn: getNextPage, + oelr: cur, + } +} + +// OperationResultsDescription the properties indicating the operation result of an operation on a service. +type OperationResultsDescription struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the operation returned. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the operation result. + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; The status of the operation being performed. Possible values include: 'OperationResultStatusCanceled', 'OperationResultStatusSucceeded', 'OperationResultStatusFailed', 'OperationResultStatusRequested', 'OperationResultStatusRunning' + Status OperationResultStatus `json:"status,omitempty"` + // StartTime - READ-ONLY; The time that the operation was started. + StartTime *date.Time `json:"startTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationResultsDescription. +func (ord OperationResultsDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationResultsGetFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OperationResultsGetFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OperationResultsClient) (OperationResultsDescription, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OperationResultsGetFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OperationResultsGetFuture.Result. +func (future *OperationResultsGetFuture) result(client OperationResultsClient) (ord OperationResultsDescription, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.OperationResultsGetFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ord.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("botservice.OperationResultsGetFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ord.Response.Response, err = future.GetResult(sender); err == nil && ord.Response.Response.StatusCode != http.StatusNoContent { + ord, err = client.GetResponder(ord.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.OperationResultsGetFuture", "Result", ord.Response.Response, "Failure responding to request") + } + } + return +} + +// OutlookChannel outlook channel definition +type OutlookChannel struct { + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutlookChannel. +func (oc OutlookChannel) MarshalJSON() ([]byte, error) { + oc.ChannelName = ChannelNameBasicChannelChannelNameOutlookChannel + objectMap := make(map[string]interface{}) + if oc.Etag != nil { + objectMap["etag"] = oc.Etag + } + if oc.Location != nil { + objectMap["location"] = oc.Location + } + if oc.ChannelName != "" { + objectMap["channelName"] = oc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return &oc, true +} + +// AsMsTeamsChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for OutlookChannel. +func (oc OutlookChannel) AsBasicChannel() (BasicChannel, bool) { + return &oc, true +} + +// PrivateEndpoint the Private Endpoint resource. +type PrivateEndpoint struct { + // ID - READ-ONLY; The ARM identifier for Private Endpoint + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpoint. +func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnection the Private Endpoint Connection resource. +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // PrivateEndpointConnectionProperties - Resource properties. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + } + } + + return nil +} + +// PrivateEndpointConnectionListResult list of private endpoint connection associated with the specified +// storage account +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - Array of private endpoint connections + Value *[]PrivateEndpointConnection `json:"value,omitempty"` +} + +// PrivateEndpointConnectionProperties properties of the PrivateEndpointConnectProperties. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - The resource of private end point. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - The provisioning state of the private endpoint connection resource. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' + ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` + // GroupIds - Group ids + GroupIds *[]string `json:"groupIds,omitempty"` +} + +// PrivateLinkResource a private link resource +type PrivateLinkResource struct { + // PrivateLinkResourceProperties - Resource properties. + *PrivateLinkResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.PrivateLinkResourceProperties != nil { + objectMap["properties"] = plr.PrivateLinkResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. +func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkResourceProperties PrivateLinkResourceProperties + err = json.Unmarshal(*v, &privateLinkResourceProperties) + if err != nil { + return err + } + plr.PrivateLinkResourceProperties = &privateLinkResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plr.Type = &typeVar + } + } + } + + return nil +} + +// PrivateLinkResourceBase common fields that are returned in the response for all BotService Private Link +// Resources +type PrivateLinkResourceBase struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResourceBase. +func (plrb PrivateLinkResourceBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateLinkResourceListResult a list of private link resources +type PrivateLinkResourceListResult struct { + autorest.Response `json:"-"` + // Value - Array of private link resources + Value *[]PrivateLinkResource `json:"value,omitempty"` +} + +// PrivateLinkResourceProperties properties of a private link resource. +type PrivateLinkResourceProperties struct { + // GroupID - READ-ONLY; The private link resource group id. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - READ-ONLY; The private link resource required member names. + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - The private link resource Private link DNS zone name. + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. +func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plrp.RequiredZoneNames != nil { + objectMap["requiredZoneNames"] = plrp.RequiredZoneNames + } + return json.Marshal(objectMap) +} + +// PrivateLinkServiceConnectionState a collection of information about the state of the connection between +// service consumer and provider. +type PrivateLinkServiceConnectionState struct { + // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'PrivateEndpointServiceConnectionStatusPending', 'PrivateEndpointServiceConnectionStatusApproved', 'PrivateEndpointServiceConnectionStatusRejected' + Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` + // Description - The reason for approval/rejection of the connection. + Description *string `json:"description,omitempty"` + // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// Resource azure resource +type Resource struct { + // ID - READ-ONLY; Specifies the resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Specifies the name of the resource. + Name *string `json:"name,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Specifies the type of the resource. + Type *string `json:"type,omitempty"` + // Tags - Contains resource tags defined as key/value pairs. + Tags map[string]*string `json:"tags"` + // Sku - Gets or sets the SKU of the resource. + Sku *Sku `json:"sku,omitempty"` + // Kind - Required. Gets or sets the Kind of the resource. Possible values include: 'KindSdk', 'KindDesigner', 'KindBot', 'KindFunction', 'KindAzurebot' + Kind Kind `json:"kind,omitempty"` + // Etag - Entity Tag + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + if r.Sku != nil { + objectMap["sku"] = r.Sku + } + if r.Kind != "" { + objectMap["kind"] = r.Kind + } + if r.Etag != nil { + objectMap["etag"] = r.Etag + } + return json.Marshal(objectMap) +} + +// SearchAssistant searchAssistant definition +type SearchAssistant struct { + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for SearchAssistant. +func (sa SearchAssistant) MarshalJSON() ([]byte, error) { + sa.ChannelName = ChannelNameBasicChannelChannelNameSearchAssistant + objectMap := make(map[string]interface{}) + if sa.Etag != nil { + objectMap["etag"] = sa.Etag + } + if sa.Location != nil { + objectMap["location"] = sa.Location + } + if sa.ChannelName != "" { + objectMap["channelName"] = sa.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsSearchAssistant() (*SearchAssistant, bool) { + return &sa, true +} + +// AsM365Extensions is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for SearchAssistant. +func (sa SearchAssistant) AsBasicChannel() (BasicChannel, bool) { + return &sa, true +} + +// ServiceProvider service Provider Definition +type ServiceProvider struct { + // Properties - The Properties of a Service Provider Object + Properties *ServiceProviderProperties `json:"properties,omitempty"` +} + +// ServiceProviderParameter extra Parameters specific to each Service Provider +type ServiceProviderParameter struct { + // Name - READ-ONLY; Name of the Service Provider + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the Service Provider + Type *string `json:"type,omitempty"` + // DisplayName - READ-ONLY; Display Name of the Service Provider + DisplayName *string `json:"displayName,omitempty"` + // Description - READ-ONLY; Description of the Service Provider + Description *string `json:"description,omitempty"` + // HelpURL - READ-ONLY; Help Url for the Service Provider + HelpURL *string `json:"helpUrl,omitempty"` + // Default - READ-ONLY; Default Name for the Service Provider + Default *string `json:"default,omitempty"` + // Metadata - READ-ONLY; Meta data for the Service Provider + Metadata *ServiceProviderParameterMetadata `json:"metadata,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceProviderParameter. +func (spp ServiceProviderParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ServiceProviderParameterMetadata meta data for the Service Provider +type ServiceProviderParameterMetadata struct { + // Constraints - the constraints of the bot meta data. + Constraints *ServiceProviderParameterMetadataConstraints `json:"constraints,omitempty"` +} + +// ServiceProviderParameterMetadataConstraints the constraints of the bot meta data. +type ServiceProviderParameterMetadataConstraints struct { + // Required - Whether required the constraints of the bot meta data. + Required *bool `json:"required,omitempty"` +} + +// ServiceProviderProperties the Object used to describe a Service Provider supported by Bot Service +type ServiceProviderProperties struct { + // ID - READ-ONLY; Id for Service Provider + ID *string `json:"id,omitempty"` + // DisplayName - READ-ONLY; Display Name of the Service Provider + DisplayName *string `json:"displayName,omitempty"` + // ServiceProviderName - READ-ONLY; Name of the Service Provider + ServiceProviderName *string `json:"serviceProviderName,omitempty"` + // DevPortalURL - READ-ONLY; URL of Dev Portal + DevPortalURL *string `json:"devPortalUrl,omitempty"` + // IconURL - The URL of icon + IconURL *string `json:"iconUrl,omitempty"` + // Parameters - The list of parameters for the Service Provider + Parameters *[]ServiceProviderParameter `json:"parameters,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceProviderProperties. +func (spp ServiceProviderProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spp.IconURL != nil { + objectMap["iconUrl"] = spp.IconURL + } + if spp.Parameters != nil { + objectMap["parameters"] = spp.Parameters + } + return json.Marshal(objectMap) +} + +// ServiceProviderResponseList the list of bot service providers response. +type ServiceProviderResponseList struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of bot service providers. + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; Gets the list of bot service providers and their properties. + Value *[]ServiceProvider `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceProviderResponseList. +func (sprl ServiceProviderResponseList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sprl.NextLink != nil { + objectMap["nextLink"] = sprl.NextLink + } + return json.Marshal(objectMap) +} + +// Site a site for the channel +type Site struct { + // TenantID - Tenant Id + TenantID *string `json:"tenantId,omitempty"` + // SiteID - READ-ONLY; Site Id + SiteID *string `json:"siteId,omitempty"` + // SiteName - Site name + SiteName *string `json:"siteName,omitempty"` + // Key - READ-ONLY; Primary key. Value only returned through POST to the action Channel List API, otherwise empty. + Key *string `json:"key,omitempty"` + // Key2 - READ-ONLY; Secondary key. Value only returned through POST to the action Channel List API, otherwise empty. + Key2 *string `json:"key2,omitempty"` + // IsEnabled - Whether this site is enabled for DirectLine channel + IsEnabled *bool `json:"isEnabled,omitempty"` + // IsTokenEnabled - READ-ONLY; Whether this site is token enabled for channel + IsTokenEnabled *bool `json:"isTokenEnabled,omitempty"` + // IsEndpointParametersEnabled - Whether this site is EndpointParameters enabled for channel + IsEndpointParametersEnabled *bool `json:"isEndpointParametersEnabled,omitempty"` + // IsDetailedLoggingEnabled - Whether this site is disabled detailed logging for + IsDetailedLoggingEnabled *bool `json:"isDetailedLoggingEnabled,omitempty"` + // IsBlockUserUploadEnabled - Whether this site is enabled for block user upload. + IsBlockUserUploadEnabled *bool `json:"isBlockUserUploadEnabled,omitempty"` + // IsNoStorageEnabled - Whether this no-storage site is disabled detailed logging for + IsNoStorageEnabled *bool `json:"isNoStorageEnabled,omitempty"` + // ETag - Entity Tag + ETag *string `json:"eTag,omitempty"` + // AppID - DirectLine application id + AppID *string `json:"appId,omitempty"` + // IsV1Enabled - Whether this site is enabled for Bot Framework V1 protocol. + IsV1Enabled *bool `json:"isV1Enabled,omitempty"` + // IsV3Enabled - Whether this site is enabled for Bot Framework V3 protocol. + IsV3Enabled *bool `json:"isV3Enabled,omitempty"` + // IsSecureSiteEnabled - Whether this site is enabled for authentication with Bot Framework. + IsSecureSiteEnabled *bool `json:"isSecureSiteEnabled,omitempty"` + // TrustedOrigins - List of Trusted Origin URLs for this site. This field is applicable only if isSecureSiteEnabled is True. + TrustedOrigins *[]string `json:"trustedOrigins,omitempty"` + // IsWebChatSpeechEnabled - Whether this site is enabled for Webchat Speech + IsWebChatSpeechEnabled *bool `json:"isWebChatSpeechEnabled,omitempty"` + // IsWebchatPreviewEnabled - Whether this site is enabled for preview versions of Webchat + IsWebchatPreviewEnabled *bool `json:"isWebchatPreviewEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for Site. +func (s Site) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.TenantID != nil { + objectMap["tenantId"] = s.TenantID + } + if s.SiteName != nil { + objectMap["siteName"] = s.SiteName + } + if s.IsEnabled != nil { + objectMap["isEnabled"] = s.IsEnabled + } + if s.IsEndpointParametersEnabled != nil { + objectMap["isEndpointParametersEnabled"] = s.IsEndpointParametersEnabled + } + if s.IsDetailedLoggingEnabled != nil { + objectMap["isDetailedLoggingEnabled"] = s.IsDetailedLoggingEnabled + } + if s.IsBlockUserUploadEnabled != nil { + objectMap["isBlockUserUploadEnabled"] = s.IsBlockUserUploadEnabled + } + if s.IsNoStorageEnabled != nil { + objectMap["isNoStorageEnabled"] = s.IsNoStorageEnabled + } + if s.ETag != nil { + objectMap["eTag"] = s.ETag + } + if s.AppID != nil { + objectMap["appId"] = s.AppID + } + if s.IsV1Enabled != nil { + objectMap["isV1Enabled"] = s.IsV1Enabled + } + if s.IsV3Enabled != nil { + objectMap["isV3Enabled"] = s.IsV3Enabled + } + if s.IsSecureSiteEnabled != nil { + objectMap["isSecureSiteEnabled"] = s.IsSecureSiteEnabled + } + if s.TrustedOrigins != nil { + objectMap["trustedOrigins"] = s.TrustedOrigins + } + if s.IsWebChatSpeechEnabled != nil { + objectMap["isWebChatSpeechEnabled"] = s.IsWebChatSpeechEnabled + } + if s.IsWebchatPreviewEnabled != nil { + objectMap["isWebchatPreviewEnabled"] = s.IsWebchatPreviewEnabled + } + return json.Marshal(objectMap) +} + +// SiteInfo site information for WebChat or DirectLine Channels to identify which site to regenerate keys +// for. +type SiteInfo struct { + // SiteName - The site name + SiteName *string `json:"siteName,omitempty"` + // Key - Determines which key is to be regenerated. Possible values include: 'Key1', 'Key2' + Key Key `json:"key,omitempty"` +} + +// Sku the SKU of the cognitive services account. +type Sku struct { + // Name - The sku name. Possible values include: 'SkuNameF0', 'SkuNameS1' + Name SkuName `json:"name,omitempty"` + // Tier - READ-ONLY; Gets the sku tier. This is based on the SKU name. Possible values include: 'SkuTierFree', 'SkuTierStandard' + Tier SkuTier `json:"tier,omitempty"` +} + +// MarshalJSON is the custom marshaler for Sku. +func (s Sku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.Name != "" { + objectMap["name"] = s.Name + } + return json.Marshal(objectMap) +} + +// SkypeChannel skype channel definition +type SkypeChannel struct { + // Properties - The set of properties specific to Skype channel resource + Properties *SkypeChannelProperties `json:"properties,omitempty"` + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for SkypeChannel. +func (sc SkypeChannel) MarshalJSON() ([]byte, error) { + sc.ChannelName = ChannelNameBasicChannelChannelNameSkypeChannel + objectMap := make(map[string]interface{}) + if sc.Properties != nil { + objectMap["properties"] = sc.Properties + } + if sc.Etag != nil { + objectMap["etag"] = sc.Etag + } + if sc.Location != nil { + objectMap["location"] = sc.Location + } + if sc.ChannelName != "" { + objectMap["channelName"] = sc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return &sc, true +} + +// AsKikChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsBasicChannel() (BasicChannel, bool) { + return &sc, true +} + +// SkypeChannelProperties the parameters to provide for the Microsoft Teams channel. +type SkypeChannelProperties struct { + // EnableMessaging - Enable messaging for Skype channel + EnableMessaging *bool `json:"enableMessaging,omitempty"` + // EnableMediaCards - Enable media cards for Skype channel + EnableMediaCards *bool `json:"enableMediaCards,omitempty"` + // EnableVideo - Enable video for Skype channel + EnableVideo *bool `json:"enableVideo,omitempty"` + // EnableCalling - Enable calling for Skype channel + EnableCalling *bool `json:"enableCalling,omitempty"` + // EnableScreenSharing - Enable screen sharing for Skype channel + EnableScreenSharing *bool `json:"enableScreenSharing,omitempty"` + // EnableGroups - Enable groups for Skype channel + EnableGroups *bool `json:"enableGroups,omitempty"` + // GroupsMode - Group mode for Skype channel + GroupsMode *string `json:"groupsMode,omitempty"` + // CallingWebHook - Calling web hook for Skype channel + CallingWebHook *string `json:"callingWebHook,omitempty"` + // IncomingCallRoute - Incoming call route for Skype channel + IncomingCallRoute *string `json:"incomingCallRoute,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// SlackChannel slack channel definition +type SlackChannel struct { + // Properties - The set of properties specific to Slack channel resource + Properties *SlackChannelProperties `json:"properties,omitempty"` + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for SlackChannel. +func (sc SlackChannel) MarshalJSON() ([]byte, error) { + sc.ChannelName = ChannelNameBasicChannelChannelNameSlackChannel + objectMap := make(map[string]interface{}) + if sc.Properties != nil { + objectMap["properties"] = sc.Properties + } + if sc.Etag != nil { + objectMap["etag"] = sc.Etag + } + if sc.Location != nil { + objectMap["location"] = sc.Location + } + if sc.ChannelName != "" { + objectMap["channelName"] = sc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsSlackChannel() (*SlackChannel, bool) { + return &sc, true +} + +// AsLineChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsBasicChannel() (BasicChannel, bool) { + return &sc, true +} + +// SlackChannelProperties the parameters to provide for the Slack channel. +type SlackChannelProperties struct { + // ClientID - The Slack client id + ClientID *string `json:"clientId,omitempty"` + // ClientSecret - The Slack client secret. Value only returned through POST to the action Channel List API, otherwise empty. + ClientSecret *string `json:"clientSecret,omitempty"` + // VerificationToken - The Slack verification token. Value only returned through POST to the action Channel List API, otherwise empty. + VerificationToken *string `json:"verificationToken,omitempty"` + // Scopes - The Slack permission scopes. + Scopes *string `json:"scopes,omitempty"` + // LandingPageURL - The Slack landing page Url + LandingPageURL *string `json:"landingPageUrl,omitempty"` + // RedirectAction - READ-ONLY; The Slack redirect action + RedirectAction *string `json:"redirectAction,omitempty"` + // LastSubmissionID - READ-ONLY; The Sms auth token + LastSubmissionID *string `json:"lastSubmissionId,omitempty"` + // RegisterBeforeOAuthFlow - READ-ONLY; Whether to register the settings before OAuth validation is performed. Recommended to True. + RegisterBeforeOAuthFlow *bool `json:"registerBeforeOAuthFlow,omitempty"` + // IsValidated - READ-ONLY; Whether this channel is validated for the bot + IsValidated *bool `json:"IsValidated,omitempty"` + // SigningSecret - The Slack signing secret. + SigningSecret *string `json:"signingSecret,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for SlackChannelProperties. +func (scp SlackChannelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scp.ClientID != nil { + objectMap["clientId"] = scp.ClientID + } + if scp.ClientSecret != nil { + objectMap["clientSecret"] = scp.ClientSecret + } + if scp.VerificationToken != nil { + objectMap["verificationToken"] = scp.VerificationToken + } + if scp.Scopes != nil { + objectMap["scopes"] = scp.Scopes + } + if scp.LandingPageURL != nil { + objectMap["landingPageUrl"] = scp.LandingPageURL + } + if scp.SigningSecret != nil { + objectMap["signingSecret"] = scp.SigningSecret + } + if scp.IsEnabled != nil { + objectMap["isEnabled"] = scp.IsEnabled + } + return json.Marshal(objectMap) +} + +// SmsChannel sms channel definition +type SmsChannel struct { + // Properties - The set of properties specific to Sms channel resource + Properties *SmsChannelProperties `json:"properties,omitempty"` + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for SmsChannel. +func (sc SmsChannel) MarshalJSON() ([]byte, error) { + sc.ChannelName = ChannelNameBasicChannelChannelNameSmsChannel + objectMap := make(map[string]interface{}) + if sc.Properties != nil { + objectMap["properties"] = sc.Properties + } + if sc.Etag != nil { + objectMap["etag"] = sc.Etag + } + if sc.Location != nil { + objectMap["location"] = sc.Location + } + if sc.ChannelName != "" { + objectMap["channelName"] = sc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsSmsChannel() (*SmsChannel, bool) { + return &sc, true +} + +// AsSlackChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsBasicChannel() (BasicChannel, bool) { + return &sc, true +} + +// SmsChannelProperties the parameters to provide for the Sms channel. +type SmsChannelProperties struct { + // Phone - The Sms phone + Phone *string `json:"phone,omitempty"` + // AccountSID - The Sms account SID. Value only returned through POST to the action Channel List API, otherwise empty. + AccountSID *string `json:"accountSID,omitempty"` + // AuthToken - The Sms auth token. Value only returned through POST to the action Channel List API, otherwise empty. + AuthToken *string `json:"authToken,omitempty"` + // IsValidated - Whether this channel is validated for the bot + IsValidated *bool `json:"isValidated,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// TelegramChannel telegram channel definition +type TelegramChannel struct { + // Properties - The set of properties specific to Telegram channel resource + Properties *TelegramChannelProperties `json:"properties,omitempty"` + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for TelegramChannel. +func (tc TelegramChannel) MarshalJSON() ([]byte, error) { + tc.ChannelName = ChannelNameBasicChannelChannelNameTelegramChannel + objectMap := make(map[string]interface{}) + if tc.Properties != nil { + objectMap["properties"] = tc.Properties + } + if tc.Etag != nil { + objectMap["etag"] = tc.Etag + } + if tc.Location != nil { + objectMap["location"] = tc.Location + } + if tc.ChannelName != "" { + objectMap["channelName"] = tc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return &tc, true +} + +// AsSmsChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsBasicChannel() (BasicChannel, bool) { + return &tc, true +} + +// TelegramChannelProperties the parameters to provide for the Telegram channel. +type TelegramChannelProperties struct { + // AccessToken - The Telegram access token. Value only returned through POST to the action Channel List API, otherwise empty. + AccessToken *string `json:"accessToken,omitempty"` + // IsValidated - Whether this channel is validated for the bot + IsValidated *bool `json:"isValidated,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// TelephonyChannel telephony channel definition +type TelephonyChannel struct { + // Properties - The set of properties specific to Telephony channel resource + Properties *TelephonyChannelProperties `json:"properties,omitempty"` + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for TelephonyChannel. +func (tc TelephonyChannel) MarshalJSON() ([]byte, error) { + tc.ChannelName = ChannelNameBasicChannelChannelNameTelephonyChannel + objectMap := make(map[string]interface{}) + if tc.Properties != nil { + objectMap["properties"] = tc.Properties + } + if tc.Etag != nil { + objectMap["etag"] = tc.Etag + } + if tc.Location != nil { + objectMap["location"] = tc.Location + } + if tc.ChannelName != "" { + objectMap["channelName"] = tc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return &tc, true +} + +// AsAcsChatChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for TelephonyChannel. +func (tc TelephonyChannel) AsBasicChannel() (BasicChannel, bool) { + return &tc, true +} + +// TelephonyChannelProperties the parameters to provide for the Direct Line channel. +type TelephonyChannelProperties struct { + // PhoneNumbers - The list of Telephony phone numbers + PhoneNumbers *[]TelephonyPhoneNumbers `json:"phoneNumbers,omitempty"` + // APIConfigurations - The list of Telephony api configuration + APIConfigurations *[]TelephonyChannelResourceAPIConfiguration `json:"apiConfigurations,omitempty"` + // CognitiveServiceSubscriptionKey - The extensionKey1 + CognitiveServiceSubscriptionKey *string `json:"cognitiveServiceSubscriptionKey,omitempty"` + // CognitiveServiceRegion - The extensionKey2 + CognitiveServiceRegion *string `json:"cognitiveServiceRegion,omitempty"` + // DefaultLocale - The default locale of the channel + DefaultLocale *string `json:"defaultLocale,omitempty"` + // PremiumSKU - The premium SKU applied to the channel + PremiumSKU *string `json:"premiumSKU,omitempty"` + // IsEnabled - Whether the channel is enabled + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// TelephonyChannelResourceAPIConfiguration a resource Api configuration for the Telephony channel +type TelephonyChannelResourceAPIConfiguration struct { + // ID - The id of config. + ID *string `json:"id,omitempty"` + // ProviderName - The provider name. + ProviderName *string `json:"providerName,omitempty"` + // CognitiveServiceSubscriptionKey - The cognitive service subscription key. + CognitiveServiceSubscriptionKey *string `json:"cognitiveServiceSubscriptionKey,omitempty"` + // CognitiveServiceRegion - The cognitive service region. + CognitiveServiceRegion *string `json:"cognitiveServiceRegion,omitempty"` + // CognitiveServiceResourceID - The cognitive service resourceId. + CognitiveServiceResourceID *string `json:"cognitiveServiceResourceId,omitempty"` + // DefaultLocale - The default locale. + DefaultLocale *string `json:"defaultLocale,omitempty"` +} + +// TelephonyPhoneNumbers a telephone number for the Telephony channel +type TelephonyPhoneNumbers struct { + // ID - The element id. + ID *string `json:"id,omitempty"` + // PhoneNumber - The phone number. + PhoneNumber *string `json:"phoneNumber,omitempty"` + // AcsEndpoint - The endpoint of ACS. + AcsEndpoint *string `json:"acsEndpoint,omitempty"` + // AcsSecret - The secret of ACS. + AcsSecret *string `json:"acsSecret,omitempty"` + // AcsResourceID - The resource id of ACS. + AcsResourceID *string `json:"acsResourceId,omitempty"` + // CognitiveServiceSubscriptionKey - The subscription key of cognitive service. + CognitiveServiceSubscriptionKey *string `json:"cognitiveServiceSubscriptionKey,omitempty"` + // CognitiveServiceRegion - The service region of cognitive service. + CognitiveServiceRegion *string `json:"cognitiveServiceRegion,omitempty"` + // CognitiveServiceResourceID - The resource id of cognitive service. + CognitiveServiceResourceID *string `json:"cognitiveServiceResourceId,omitempty"` + // DefaultLocale - The default locale of the phone number. + DefaultLocale *string `json:"defaultLocale,omitempty"` + // OfferType - Optional Property that will determine the offering type of the phone. + OfferType *string `json:"offerType,omitempty"` +} + +// WebChatChannel web Chat channel definition +type WebChatChannel struct { + // Properties - The set of properties specific to Web Chat channel resource + Properties *WebChatChannelProperties `json:"properties,omitempty"` + // Etag - Entity Tag of the resource + Etag *string `json:"etag,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource + ProvisioningState *string `json:"provisioningState,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // ChannelName - Possible values include: 'ChannelNameBasicChannelChannelNameChannel', 'ChannelNameBasicChannelChannelNameAlexaChannel', 'ChannelNameBasicChannelChannelNameFacebookChannel', 'ChannelNameBasicChannelChannelNameEmailChannel', 'ChannelNameBasicChannelChannelNameOutlookChannel', 'ChannelNameBasicChannelChannelNameMsTeamsChannel', 'ChannelNameBasicChannelChannelNameSkypeChannel', 'ChannelNameBasicChannelChannelNameKikChannel', 'ChannelNameBasicChannelChannelNameWebChatChannel', 'ChannelNameBasicChannelChannelNameDirectLineChannel', 'ChannelNameBasicChannelChannelNameTelegramChannel', 'ChannelNameBasicChannelChannelNameSmsChannel', 'ChannelNameBasicChannelChannelNameSlackChannel', 'ChannelNameBasicChannelChannelNameLineChannel', 'ChannelNameBasicChannelChannelNameDirectLineSpeechChannel', 'ChannelNameBasicChannelChannelNameOmnichannel', 'ChannelNameBasicChannelChannelNameTelephonyChannel', 'ChannelNameBasicChannelChannelNameAcsChatChannel', 'ChannelNameBasicChannelChannelNameSearchAssistant', 'ChannelNameBasicChannelChannelNameM365Extensions' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebChatChannel. +func (wcc WebChatChannel) MarshalJSON() ([]byte, error) { + wcc.ChannelName = ChannelNameBasicChannelChannelNameWebChatChannel + objectMap := make(map[string]interface{}) + if wcc.Properties != nil { + objectMap["properties"] = wcc.Properties + } + if wcc.Etag != nil { + objectMap["etag"] = wcc.Etag + } + if wcc.Location != nil { + objectMap["location"] = wcc.Location + } + if wcc.ChannelName != "" { + objectMap["channelName"] = wcc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsOutlookChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsOutlookChannel() (*OutlookChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return &wcc, true +} + +// AsDirectLineChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsOmnichannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsOmnichannel() (*Omnichannel, bool) { + return nil, false +} + +// AsTelephonyChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsTelephonyChannel() (*TelephonyChannel, bool) { + return nil, false +} + +// AsAcsChatChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsAcsChatChannel() (*AcsChatChannel, bool) { + return nil, false +} + +// AsSearchAssistant is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsSearchAssistant() (*SearchAssistant, bool) { + return nil, false +} + +// AsM365Extensions is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsM365Extensions() (*M365Extensions, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsBasicChannel() (BasicChannel, bool) { + return &wcc, true +} + +// WebChatChannelProperties the parameters to provide for the Web Chat channel. +type WebChatChannelProperties struct { + // WebChatEmbedCode - READ-ONLY; Web chat control embed code + WebChatEmbedCode *string `json:"webChatEmbedCode,omitempty"` + // Sites - The list of Web Chat sites + Sites *[]WebChatSite `json:"sites,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebChatChannelProperties. +func (wccp WebChatChannelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wccp.Sites != nil { + objectMap["sites"] = wccp.Sites + } + return json.Marshal(objectMap) +} + +// WebChatSite a site for the Webchat channel +type WebChatSite struct { + // TenantID - Tenant Id + TenantID *string `json:"tenantId,omitempty"` + // SiteID - READ-ONLY; Site Id + SiteID *string `json:"siteId,omitempty"` + // SiteName - Site name + SiteName *string `json:"siteName,omitempty"` + // Key - READ-ONLY; Primary key. Value only returned through POST to the action Channel List API, otherwise empty. + Key *string `json:"key,omitempty"` + // Key2 - READ-ONLY; Secondary key. Value only returned through POST to the action Channel List API, otherwise empty. + Key2 *string `json:"key2,omitempty"` + // IsEnabled - Whether this site is enabled for DirectLine channel + IsEnabled *bool `json:"isEnabled,omitempty"` + // IsTokenEnabled - READ-ONLY; Whether this site is token enabled for channel + IsTokenEnabled *bool `json:"isTokenEnabled,omitempty"` + // IsEndpointParametersEnabled - Whether this site is EndpointParameters enabled for channel + IsEndpointParametersEnabled *bool `json:"isEndpointParametersEnabled,omitempty"` + // IsDetailedLoggingEnabled - Whether this site is disabled detailed logging for + IsDetailedLoggingEnabled *bool `json:"isDetailedLoggingEnabled,omitempty"` + // IsBlockUserUploadEnabled - Whether this site is enabled for block user upload. + IsBlockUserUploadEnabled *bool `json:"isBlockUserUploadEnabled,omitempty"` + // IsNoStorageEnabled - Whether this no-storage site is disabled detailed logging for + IsNoStorageEnabled *bool `json:"isNoStorageEnabled,omitempty"` + // ETag - Entity Tag + ETag *string `json:"eTag,omitempty"` + // AppID - DirectLine application id + AppID *string `json:"appId,omitempty"` + // IsV1Enabled - Whether this site is enabled for Bot Framework V1 protocol. + IsV1Enabled *bool `json:"isV1Enabled,omitempty"` + // IsV3Enabled - Whether this site is enabled for Bot Framework V3 protocol. + IsV3Enabled *bool `json:"isV3Enabled,omitempty"` + // IsSecureSiteEnabled - Whether this site is enabled for authentication with Bot Framework. + IsSecureSiteEnabled *bool `json:"isSecureSiteEnabled,omitempty"` + // TrustedOrigins - List of Trusted Origin URLs for this site. This field is applicable only if isSecureSiteEnabled is True. + TrustedOrigins *[]string `json:"trustedOrigins,omitempty"` + // IsWebChatSpeechEnabled - Whether this site is enabled for Webchat Speech + IsWebChatSpeechEnabled *bool `json:"isWebChatSpeechEnabled,omitempty"` + // IsWebchatPreviewEnabled - Whether this site is enabled for preview versions of Webchat + IsWebchatPreviewEnabled *bool `json:"isWebchatPreviewEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebChatSite. +func (wcs WebChatSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wcs.TenantID != nil { + objectMap["tenantId"] = wcs.TenantID + } + if wcs.SiteName != nil { + objectMap["siteName"] = wcs.SiteName + } + if wcs.IsEnabled != nil { + objectMap["isEnabled"] = wcs.IsEnabled + } + if wcs.IsEndpointParametersEnabled != nil { + objectMap["isEndpointParametersEnabled"] = wcs.IsEndpointParametersEnabled + } + if wcs.IsDetailedLoggingEnabled != nil { + objectMap["isDetailedLoggingEnabled"] = wcs.IsDetailedLoggingEnabled + } + if wcs.IsBlockUserUploadEnabled != nil { + objectMap["isBlockUserUploadEnabled"] = wcs.IsBlockUserUploadEnabled + } + if wcs.IsNoStorageEnabled != nil { + objectMap["isNoStorageEnabled"] = wcs.IsNoStorageEnabled + } + if wcs.ETag != nil { + objectMap["eTag"] = wcs.ETag + } + if wcs.AppID != nil { + objectMap["appId"] = wcs.AppID + } + if wcs.IsV1Enabled != nil { + objectMap["isV1Enabled"] = wcs.IsV1Enabled + } + if wcs.IsV3Enabled != nil { + objectMap["isV3Enabled"] = wcs.IsV3Enabled + } + if wcs.IsSecureSiteEnabled != nil { + objectMap["isSecureSiteEnabled"] = wcs.IsSecureSiteEnabled + } + if wcs.TrustedOrigins != nil { + objectMap["trustedOrigins"] = wcs.TrustedOrigins + } + if wcs.IsWebChatSpeechEnabled != nil { + objectMap["isWebChatSpeechEnabled"] = wcs.IsWebChatSpeechEnabled + } + if wcs.IsWebchatPreviewEnabled != nil { + objectMap["isWebchatPreviewEnabled"] = wcs.IsWebchatPreviewEnabled + } + return json.Marshal(objectMap) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/operationresults.go b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/operationresults.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/operationresults.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/operationresults.go index 6c897da94abb..cabadf52614d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/operationresults.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/operationresults.go @@ -8,10 +8,11 @@ package botservice import ( "context" + "net/http" + "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/tracing" - "net/http" ) // OperationResultsClient is the azure Bot Service is a platform for creating smart conversational agents. diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/operations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/operations.go new file mode 100644 index 000000000000..47c7892682f6 --- /dev/null +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/operations.go @@ -0,0 +1,141 @@ +package botservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" +) + +// OperationsClient is the azure Bot Service is a platform for creating smart conversational agents. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all the available BotService operations. +func (client OperationsClient) List(ctx context.Context) (result OperationEntityListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.oelr.Response.Response != nil { + sc = result.oelr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.oelr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.oelr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.oelr.hasNextLink() && result.oelr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.BotService/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationEntityListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationEntityListResult) (result OperationEntityListResult, err error) { + req, err := lastResults.operationEntityListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "botservice.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "botservice.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationEntityListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/privateendpointconnections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/privateendpointconnections.go new file mode 100644 index 000000000000..e74dfa4e5639 --- /dev/null +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/privateendpointconnections.go @@ -0,0 +1,400 @@ +package botservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" +) + +// PrivateEndpointConnectionsClient is the azure Bot Service is a platform for creating smart conversational agents. +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create update the state of specified private endpoint connection associated with the Bot. +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure +// resource +// properties - the private endpoint connection properties. +func (client PrivateEndpointConnectionsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: properties, + Constraints: []validation.Constraint{{Target: "properties.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "properties.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("botservice.PrivateEndpointConnectionsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, properties) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client PrivateEndpointConnectionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(properties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) CreateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified private endpoint connection associated with the Bot. +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure +// resource +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.PrivateEndpointConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified private endpoint connection associated with the Bot. +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure +// resource +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.PrivateEndpointConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all the private endpoint connections associated with the Bot. +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateEndpointConnectionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.PrivateEndpointConnectionsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/privatelinkresources.go b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/privatelinkresources.go new file mode 100644 index 000000000000..6b40684cbdb4 --- /dev/null +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/privatelinkresources.go @@ -0,0 +1,122 @@ +package botservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" +) + +// PrivateLinkResourcesClient is the azure Bot Service is a platform for creating smart conversational agents. +type PrivateLinkResourcesClient struct { + BaseClient +} + +// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByBotResource gets the private link resources that need to be created for a Bot. +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +func (client PrivateLinkResourcesClient) ListByBotResource(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateLinkResourceListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByBotResource") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.PrivateLinkResourcesClient", "ListByBotResource", err.Error()) + } + + req, err := client.ListByBotResourcePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.PrivateLinkResourcesClient", "ListByBotResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBotResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.PrivateLinkResourcesClient", "ListByBotResource", resp, "Failure sending request") + return + } + + result, err = client.ListByBotResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.PrivateLinkResourcesClient", "ListByBotResource", resp, "Failure responding to request") + return + } + + return +} + +// ListByBotResourcePreparer prepares the ListByBotResource request. +func (client PrivateLinkResourcesClient) ListByBotResourcePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBotResourceSender sends the ListByBotResource request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) ListByBotResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByBotResourceResponder handles the response to the ListByBotResource request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) ListByBotResourceResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/version.go b/vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/version.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice/version.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice/version.go diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/client.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/client.go deleted file mode 100644 index eb1719911d17..000000000000 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/client.go +++ /dev/null @@ -1,1296 +0,0 @@ -// Package network implements the Azure ARM Network service API version . -// -// Network Client -package network - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" -) - -const ( - // DefaultBaseURI is the default URI used for the service Network - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Network. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} - -// CheckDNSNameAvailability checks whether a domain name in the cloudapp.azure.com zone is available for use. -// Parameters: -// location - the location of the domain name. -// domainNameLabel - the domain name to be verified. It must conform to the following regular expression: -// ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. -func (client BaseClient) CheckDNSNameAvailability(ctx context.Context, location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckDNSNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CheckDNSNameAvailabilityPreparer(ctx, location, domainNameLabel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckDNSNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckDNSNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckDNSNameAvailabilityPreparer prepares the CheckDNSNameAvailability request. -func (client BaseClient) CheckDNSNameAvailabilityPreparer(ctx context.Context, location string, domainNameLabel string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "domainNameLabel": autorest.Encode("query", domainNameLabel), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckDNSNameAvailabilitySender sends the CheckDNSNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) CheckDNSNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckDNSNameAvailabilityResponder handles the response to the CheckDNSNameAvailability request. The method always -// closes the http.Response Body. -func (client BaseClient) CheckDNSNameAvailabilityResponder(resp *http.Response) (result DNSNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteBastionShareableLink deletes the Bastion Shareable Links for all the VMs specified in the request. -// Parameters: -// resourceGroupName - the name of the resource group. -// bastionHostName - the name of the Bastion Host. -// bslRequest - post request for all the Bastion Shareable Link endpoints. -func (client BaseClient) DeleteBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (result DeleteBastionShareableLinkFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteBastionShareableLink") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteBastionShareableLinkPreparer(ctx, resourceGroupName, bastionHostName, bslRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "DeleteBastionShareableLink", nil, "Failure preparing request") - return - } - - result, err = client.DeleteBastionShareableLinkSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "DeleteBastionShareableLink", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteBastionShareableLinkPreparer prepares the DeleteBastionShareableLink request. -func (client BaseClient) DeleteBastionShareableLinkPreparer(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "bastionHostName": autorest.Encode("path", bastionHostName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinks", pathParameters), - autorest.WithJSON(bslRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteBastionShareableLinkSender sends the DeleteBastionShareableLink request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) DeleteBastionShareableLinkSender(req *http.Request) (future DeleteBastionShareableLinkFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteBastionShareableLinkResponder handles the response to the DeleteBastionShareableLink request. The method always -// closes the http.Response Body. -func (client BaseClient) DeleteBastionShareableLinkResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// DisconnectActiveSessions returns the list of currently active sessions on the Bastion. -// Parameters: -// resourceGroupName - the name of the resource group. -// bastionHostName - the name of the Bastion Host. -// sessionIds - the list of sessionids to disconnect. -func (client BaseClient) DisconnectActiveSessions(ctx context.Context, resourceGroupName string, bastionHostName string, sessionIds SessionIds) (result BastionSessionDeleteResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DisconnectActiveSessions") - defer func() { - sc := -1 - if result.bsdr.Response.Response != nil { - sc = result.bsdr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.disconnectActiveSessionsNextResults - req, err := client.DisconnectActiveSessionsPreparer(ctx, resourceGroupName, bastionHostName, sessionIds) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "DisconnectActiveSessions", nil, "Failure preparing request") - return - } - - resp, err := client.DisconnectActiveSessionsSender(req) - if err != nil { - result.bsdr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.BaseClient", "DisconnectActiveSessions", resp, "Failure sending request") - return - } - - result.bsdr, err = client.DisconnectActiveSessionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "DisconnectActiveSessions", resp, "Failure responding to request") - return - } - if result.bsdr.hasNextLink() && result.bsdr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// DisconnectActiveSessionsPreparer prepares the DisconnectActiveSessions request. -func (client BaseClient) DisconnectActiveSessionsPreparer(ctx context.Context, resourceGroupName string, bastionHostName string, sessionIds SessionIds) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "bastionHostName": autorest.Encode("path", bastionHostName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/disconnectActiveSessions", pathParameters), - autorest.WithJSON(sessionIds), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DisconnectActiveSessionsSender sends the DisconnectActiveSessions request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) DisconnectActiveSessionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DisconnectActiveSessionsResponder handles the response to the DisconnectActiveSessions request. The method always -// closes the http.Response Body. -func (client BaseClient) DisconnectActiveSessionsResponder(resp *http.Response) (result BastionSessionDeleteResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// disconnectActiveSessionsNextResults retrieves the next set of results, if any. -func (client BaseClient) disconnectActiveSessionsNextResults(ctx context.Context, lastResults BastionSessionDeleteResult) (result BastionSessionDeleteResult, err error) { - req, err := lastResults.bastionSessionDeleteResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "network.BaseClient", "disconnectActiveSessionsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.DisconnectActiveSessionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.BaseClient", "disconnectActiveSessionsNextResults", resp, "Failure sending next results request") - } - result, err = client.DisconnectActiveSessionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "disconnectActiveSessionsNextResults", resp, "Failure responding to next results request") - } - return -} - -// DisconnectActiveSessionsComplete enumerates all values, automatically crossing page boundaries as required. -func (client BaseClient) DisconnectActiveSessionsComplete(ctx context.Context, resourceGroupName string, bastionHostName string, sessionIds SessionIds) (result BastionSessionDeleteResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DisconnectActiveSessions") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.DisconnectActiveSessions(ctx, resourceGroupName, bastionHostName, sessionIds) - return -} - -// ExpressRouteProviderPortMethod retrieves detail of a provider port. -// Parameters: -// providerport - the name of the provider port. -func (client BaseClient) ExpressRouteProviderPortMethod(ctx context.Context, providerport string) (result ExpressRouteProviderPort, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ExpressRouteProviderPortMethod") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ExpressRouteProviderPortMethodPreparer(ctx, providerport) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "ExpressRouteProviderPortMethod", nil, "Failure preparing request") - return - } - - resp, err := client.ExpressRouteProviderPortMethodSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.BaseClient", "ExpressRouteProviderPortMethod", resp, "Failure sending request") - return - } - - result, err = client.ExpressRouteProviderPortMethodResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "ExpressRouteProviderPortMethod", resp, "Failure responding to request") - return - } - - return -} - -// ExpressRouteProviderPortMethodPreparer prepares the ExpressRouteProviderPortMethod request. -func (client BaseClient) ExpressRouteProviderPortMethodPreparer(ctx context.Context, providerport string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerport": autorest.Encode("path", providerport), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts/{providerport}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExpressRouteProviderPortMethodSender sends the ExpressRouteProviderPortMethod request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) ExpressRouteProviderPortMethodSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExpressRouteProviderPortMethodResponder handles the response to the ExpressRouteProviderPortMethod request. The method always -// closes the http.Response Body. -func (client BaseClient) ExpressRouteProviderPortMethodResponder(resp *http.Response) (result ExpressRouteProviderPort, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Generatevirtualwanvpnserverconfigurationvpnprofile generates a unique VPN profile for P2S clients for VirtualWan and -// associated VpnServerConfiguration combination in the specified resource group. -// Parameters: -// resourceGroupName - the resource group name. -// virtualWANName - the name of the VirtualWAN whose associated VpnServerConfigurations is needed. -// vpnClientParams - parameters supplied to the generate VirtualWan VPN profile generation operation. -func (client BaseClient) Generatevirtualwanvpnserverconfigurationvpnprofile(ctx context.Context, resourceGroupName string, virtualWANName string, vpnClientParams VirtualWanVpnProfileParameters) (result GeneratevirtualwanvpnserverconfigurationvpnprofileFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.Generatevirtualwanvpnserverconfigurationvpnprofile") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GeneratevirtualwanvpnserverconfigurationvpnprofilePreparer(ctx, resourceGroupName, virtualWANName, vpnClientParams) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "Generatevirtualwanvpnserverconfigurationvpnprofile", nil, "Failure preparing request") - return - } - - result, err = client.GeneratevirtualwanvpnserverconfigurationvpnprofileSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "Generatevirtualwanvpnserverconfigurationvpnprofile", result.Response(), "Failure sending request") - return - } - - return -} - -// GeneratevirtualwanvpnserverconfigurationvpnprofilePreparer prepares the Generatevirtualwanvpnserverconfigurationvpnprofile request. -func (client BaseClient) GeneratevirtualwanvpnserverconfigurationvpnprofilePreparer(ctx context.Context, resourceGroupName string, virtualWANName string, vpnClientParams VirtualWanVpnProfileParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualWANName": autorest.Encode("path", virtualWANName), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/GenerateVpnProfile", pathParameters), - autorest.WithJSON(vpnClientParams), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GeneratevirtualwanvpnserverconfigurationvpnprofileSender sends the Generatevirtualwanvpnserverconfigurationvpnprofile request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GeneratevirtualwanvpnserverconfigurationvpnprofileSender(req *http.Request) (future GeneratevirtualwanvpnserverconfigurationvpnprofileFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// GeneratevirtualwanvpnserverconfigurationvpnprofileResponder handles the response to the Generatevirtualwanvpnserverconfigurationvpnprofile request. The method always -// closes the http.Response Body. -func (client BaseClient) GeneratevirtualwanvpnserverconfigurationvpnprofileResponder(resp *http.Response) (result VpnProfileResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetActiveSessions returns the list of currently active sessions on the Bastion. -// Parameters: -// resourceGroupName - the name of the resource group. -// bastionHostName - the name of the Bastion Host. -func (client BaseClient) GetActiveSessions(ctx context.Context, resourceGroupName string, bastionHostName string) (result GetActiveSessionsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetActiveSessions") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetActiveSessionsPreparer(ctx, resourceGroupName, bastionHostName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "GetActiveSessions", nil, "Failure preparing request") - return - } - - result, err = client.GetActiveSessionsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "GetActiveSessions", result.Response(), "Failure sending request") - return - } - - return -} - -// GetActiveSessionsPreparer prepares the GetActiveSessions request. -func (client BaseClient) GetActiveSessionsPreparer(ctx context.Context, resourceGroupName string, bastionHostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "bastionHostName": autorest.Encode("path", bastionHostName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getActiveSessions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetActiveSessionsSender sends the GetActiveSessions request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetActiveSessionsSender(req *http.Request) (future GetActiveSessionsFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// GetActiveSessionsResponder handles the response to the GetActiveSessions request. The method always -// closes the http.Response Body. -func (client BaseClient) GetActiveSessionsResponder(resp *http.Response) (result BastionActiveSessionListResultPage, err error) { - result.baslr, err = client.getActiveSessionsResponder(resp) - result.fn = client.getActiveSessionsNextResults - return -} - -func (client BaseClient) getActiveSessionsResponder(resp *http.Response) (result BastionActiveSessionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// getActiveSessionsNextResults retrieves the next set of results, if any. -func (client BaseClient) getActiveSessionsNextResults(ctx context.Context, lastResults BastionActiveSessionListResult) (result BastionActiveSessionListResult, err error) { - req, err := lastResults.bastionActiveSessionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "network.BaseClient", "getActiveSessionsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - var resp *http.Response - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - return result, autorest.NewErrorWithError(err, "network.BaseClient", "getActiveSessionsNextResults", resp, "Failure sending next results request") - } - return client.getActiveSessionsResponder(resp) -} - -// GetActiveSessionsComplete enumerates all values, automatically crossing page boundaries as required. -func (client BaseClient) GetActiveSessionsComplete(ctx context.Context, resourceGroupName string, bastionHostName string) (result GetActiveSessionsAllFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetActiveSessions") - defer func() { - sc := -1 - if result.Response() != nil { - sc = result.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - var future GetActiveSessionsFuture - future, err = client.GetActiveSessions(ctx, resourceGroupName, bastionHostName) - result.FutureAPI = future.FutureAPI - return -} - -// GetBastionShareableLink return the Bastion Shareable Links for all the VMs specified in the request. -// Parameters: -// resourceGroupName - the name of the resource group. -// bastionHostName - the name of the Bastion Host. -// bslRequest - post request for all the Bastion Shareable Link endpoints. -func (client BaseClient) GetBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (result BastionShareableLinkListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetBastionShareableLink") - defer func() { - sc := -1 - if result.bsllr.Response.Response != nil { - sc = result.bsllr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.getBastionShareableLinkNextResults - req, err := client.GetBastionShareableLinkPreparer(ctx, resourceGroupName, bastionHostName, bslRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "GetBastionShareableLink", nil, "Failure preparing request") - return - } - - resp, err := client.GetBastionShareableLinkSender(req) - if err != nil { - result.bsllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.BaseClient", "GetBastionShareableLink", resp, "Failure sending request") - return - } - - result.bsllr, err = client.GetBastionShareableLinkResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "GetBastionShareableLink", resp, "Failure responding to request") - return - } - if result.bsllr.hasNextLink() && result.bsllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// GetBastionShareableLinkPreparer prepares the GetBastionShareableLink request. -func (client BaseClient) GetBastionShareableLinkPreparer(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "bastionHostName": autorest.Encode("path", bastionHostName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getShareableLinks", pathParameters), - autorest.WithJSON(bslRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetBastionShareableLinkSender sends the GetBastionShareableLink request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) GetBastionShareableLinkSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetBastionShareableLinkResponder handles the response to the GetBastionShareableLink request. The method always -// closes the http.Response Body. -func (client BaseClient) GetBastionShareableLinkResponder(resp *http.Response) (result BastionShareableLinkListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// getBastionShareableLinkNextResults retrieves the next set of results, if any. -func (client BaseClient) getBastionShareableLinkNextResults(ctx context.Context, lastResults BastionShareableLinkListResult) (result BastionShareableLinkListResult, err error) { - req, err := lastResults.bastionShareableLinkListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "network.BaseClient", "getBastionShareableLinkNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.GetBastionShareableLinkSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.BaseClient", "getBastionShareableLinkNextResults", resp, "Failure sending next results request") - } - result, err = client.GetBastionShareableLinkResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "getBastionShareableLinkNextResults", resp, "Failure responding to next results request") - } - return -} - -// GetBastionShareableLinkComplete enumerates all values, automatically crossing page boundaries as required. -func (client BaseClient) GetBastionShareableLinkComplete(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (result BastionShareableLinkListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetBastionShareableLink") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.GetBastionShareableLink(ctx, resourceGroupName, bastionHostName, bslRequest) - return -} - -// ListActiveConnectivityConfigurations lists active connectivity configurations in a network manager. -// Parameters: -// parameters - active Configuration Parameter. -// resourceGroupName - the name of the resource group. -// networkManagerName - the name of the network manager. -// top - an optional query parameter which specifies the maximum number of records to be returned by the -// server. -func (client BaseClient) ListActiveConnectivityConfigurations(ctx context.Context, parameters ActiveConfigurationParameter, resourceGroupName string, networkManagerName string, top *int32) (result ActiveConnectivityConfigurationsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListActiveConnectivityConfigurations") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(20), Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("network.BaseClient", "ListActiveConnectivityConfigurations", err.Error()) - } - - req, err := client.ListActiveConnectivityConfigurationsPreparer(ctx, parameters, resourceGroupName, networkManagerName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "ListActiveConnectivityConfigurations", nil, "Failure preparing request") - return - } - - resp, err := client.ListActiveConnectivityConfigurationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.BaseClient", "ListActiveConnectivityConfigurations", resp, "Failure sending request") - return - } - - result, err = client.ListActiveConnectivityConfigurationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "ListActiveConnectivityConfigurations", resp, "Failure responding to request") - return - } - - return -} - -// ListActiveConnectivityConfigurationsPreparer prepares the ListActiveConnectivityConfigurations request. -func (client BaseClient) ListActiveConnectivityConfigurationsPreparer(ctx context.Context, parameters ActiveConfigurationParameter, resourceGroupName string, networkManagerName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkManagerName": autorest.Encode("path", networkManagerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListActiveConnectivityConfigurationsSender sends the ListActiveConnectivityConfigurations request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) ListActiveConnectivityConfigurationsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListActiveConnectivityConfigurationsResponder handles the response to the ListActiveConnectivityConfigurations request. The method always -// closes the http.Response Body. -func (client BaseClient) ListActiveConnectivityConfigurationsResponder(resp *http.Response) (result ActiveConnectivityConfigurationsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListActiveSecurityAdminRules lists active security admin rules in a network manager. -// Parameters: -// parameters - active Configuration Parameter. -// resourceGroupName - the name of the resource group. -// networkManagerName - the name of the network manager. -// top - an optional query parameter which specifies the maximum number of records to be returned by the -// server. -func (client BaseClient) ListActiveSecurityAdminRules(ctx context.Context, parameters ActiveConfigurationParameter, resourceGroupName string, networkManagerName string, top *int32) (result ActiveSecurityAdminRulesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListActiveSecurityAdminRules") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(20), Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("network.BaseClient", "ListActiveSecurityAdminRules", err.Error()) - } - - req, err := client.ListActiveSecurityAdminRulesPreparer(ctx, parameters, resourceGroupName, networkManagerName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "ListActiveSecurityAdminRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListActiveSecurityAdminRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.BaseClient", "ListActiveSecurityAdminRules", resp, "Failure sending request") - return - } - - result, err = client.ListActiveSecurityAdminRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "ListActiveSecurityAdminRules", resp, "Failure responding to request") - return - } - - return -} - -// ListActiveSecurityAdminRulesPreparer prepares the ListActiveSecurityAdminRules request. -func (client BaseClient) ListActiveSecurityAdminRulesPreparer(ctx context.Context, parameters ActiveConfigurationParameter, resourceGroupName string, networkManagerName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkManagerName": autorest.Encode("path", networkManagerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListActiveSecurityAdminRulesSender sends the ListActiveSecurityAdminRules request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) ListActiveSecurityAdminRulesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListActiveSecurityAdminRulesResponder handles the response to the ListActiveSecurityAdminRules request. The method always -// closes the http.Response Body. -func (client BaseClient) ListActiveSecurityAdminRulesResponder(resp *http.Response) (result ActiveSecurityAdminRulesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNetworkManagerEffectiveConnectivityConfigurations list all effective connectivity configurations applied on a -// virtual network. -// Parameters: -// parameters - parameters supplied to list correct page. -// resourceGroupName - the name of the resource group. -// virtualNetworkName - the name of the virtual network. -// top - an optional query parameter which specifies the maximum number of records to be returned by the -// server. -func (client BaseClient) ListNetworkManagerEffectiveConnectivityConfigurations(ctx context.Context, parameters QueryRequestOptions, resourceGroupName string, virtualNetworkName string, top *int32) (result ManagerEffectiveConnectivityConfigurationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListNetworkManagerEffectiveConnectivityConfigurations") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(20), Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("network.BaseClient", "ListNetworkManagerEffectiveConnectivityConfigurations", err.Error()) - } - - req, err := client.ListNetworkManagerEffectiveConnectivityConfigurationsPreparer(ctx, parameters, resourceGroupName, virtualNetworkName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "ListNetworkManagerEffectiveConnectivityConfigurations", nil, "Failure preparing request") - return - } - - resp, err := client.ListNetworkManagerEffectiveConnectivityConfigurationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.BaseClient", "ListNetworkManagerEffectiveConnectivityConfigurations", resp, "Failure sending request") - return - } - - result, err = client.ListNetworkManagerEffectiveConnectivityConfigurationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "ListNetworkManagerEffectiveConnectivityConfigurations", resp, "Failure responding to request") - return - } - - return -} - -// ListNetworkManagerEffectiveConnectivityConfigurationsPreparer prepares the ListNetworkManagerEffectiveConnectivityConfigurations request. -func (client BaseClient) ListNetworkManagerEffectiveConnectivityConfigurationsPreparer(ctx context.Context, parameters QueryRequestOptions, resourceGroupName string, virtualNetworkName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListNetworkManagerEffectiveConnectivityConfigurationsSender sends the ListNetworkManagerEffectiveConnectivityConfigurations request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) ListNetworkManagerEffectiveConnectivityConfigurationsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListNetworkManagerEffectiveConnectivityConfigurationsResponder handles the response to the ListNetworkManagerEffectiveConnectivityConfigurations request. The method always -// closes the http.Response Body. -func (client BaseClient) ListNetworkManagerEffectiveConnectivityConfigurationsResponder(resp *http.Response) (result ManagerEffectiveConnectivityConfigurationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNetworkManagerEffectiveSecurityAdminRules list all effective security admin rules applied on a virtual network. -// Parameters: -// parameters - parameters supplied to list correct page. -// resourceGroupName - the name of the resource group. -// virtualNetworkName - the name of the virtual network. -// top - an optional query parameter which specifies the maximum number of records to be returned by the -// server. -func (client BaseClient) ListNetworkManagerEffectiveSecurityAdminRules(ctx context.Context, parameters QueryRequestOptions, resourceGroupName string, virtualNetworkName string, top *int32) (result ManagerEffectiveSecurityAdminRulesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListNetworkManagerEffectiveSecurityAdminRules") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(20), Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("network.BaseClient", "ListNetworkManagerEffectiveSecurityAdminRules", err.Error()) - } - - req, err := client.ListNetworkManagerEffectiveSecurityAdminRulesPreparer(ctx, parameters, resourceGroupName, virtualNetworkName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "ListNetworkManagerEffectiveSecurityAdminRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListNetworkManagerEffectiveSecurityAdminRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.BaseClient", "ListNetworkManagerEffectiveSecurityAdminRules", resp, "Failure sending request") - return - } - - result, err = client.ListNetworkManagerEffectiveSecurityAdminRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "ListNetworkManagerEffectiveSecurityAdminRules", resp, "Failure responding to request") - return - } - - return -} - -// ListNetworkManagerEffectiveSecurityAdminRulesPreparer prepares the ListNetworkManagerEffectiveSecurityAdminRules request. -func (client BaseClient) ListNetworkManagerEffectiveSecurityAdminRulesPreparer(ctx context.Context, parameters QueryRequestOptions, resourceGroupName string, virtualNetworkName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveSecurityAdminRules", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListNetworkManagerEffectiveSecurityAdminRulesSender sends the ListNetworkManagerEffectiveSecurityAdminRules request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) ListNetworkManagerEffectiveSecurityAdminRulesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListNetworkManagerEffectiveSecurityAdminRulesResponder handles the response to the ListNetworkManagerEffectiveSecurityAdminRules request. The method always -// closes the http.Response Body. -func (client BaseClient) ListNetworkManagerEffectiveSecurityAdminRulesResponder(resp *http.Response) (result ManagerEffectiveSecurityAdminRulesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// PutBastionShareableLink creates a Bastion Shareable Links for all the VMs specified in the request. -// Parameters: -// resourceGroupName - the name of the resource group. -// bastionHostName - the name of the Bastion Host. -// bslRequest - post request for all the Bastion Shareable Link endpoints. -func (client BaseClient) PutBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (result PutBastionShareableLinkFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PutBastionShareableLink") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.PutBastionShareableLinkPreparer(ctx, resourceGroupName, bastionHostName, bslRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "PutBastionShareableLink", nil, "Failure preparing request") - return - } - - result, err = client.PutBastionShareableLinkSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "PutBastionShareableLink", result.Response(), "Failure sending request") - return - } - - return -} - -// PutBastionShareableLinkPreparer prepares the PutBastionShareableLink request. -func (client BaseClient) PutBastionShareableLinkPreparer(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "bastionHostName": autorest.Encode("path", bastionHostName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/createShareableLinks", pathParameters), - autorest.WithJSON(bslRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PutBastionShareableLinkSender sends the PutBastionShareableLink request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) PutBastionShareableLinkSender(req *http.Request) (future PutBastionShareableLinkFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// PutBastionShareableLinkResponder handles the response to the PutBastionShareableLink request. The method always -// closes the http.Response Body. -func (client BaseClient) PutBastionShareableLinkResponder(resp *http.Response) (result BastionShareableLinkListResultPage, err error) { - result.bsllr, err = client.putBastionShareableLinkResponder(resp) - result.fn = client.putBastionShareableLinkNextResults - return -} - -func (client BaseClient) putBastionShareableLinkResponder(resp *http.Response) (result BastionShareableLinkListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// putBastionShareableLinkNextResults retrieves the next set of results, if any. -func (client BaseClient) putBastionShareableLinkNextResults(ctx context.Context, lastResults BastionShareableLinkListResult) (result BastionShareableLinkListResult, err error) { - req, err := lastResults.bastionShareableLinkListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "network.BaseClient", "putBastionShareableLinkNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - var resp *http.Response - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - return result, autorest.NewErrorWithError(err, "network.BaseClient", "putBastionShareableLinkNextResults", resp, "Failure sending next results request") - } - return client.putBastionShareableLinkResponder(resp) -} - -// PutBastionShareableLinkComplete enumerates all values, automatically crossing page boundaries as required. -func (client BaseClient) PutBastionShareableLinkComplete(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (result PutBastionShareableLinkAllFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PutBastionShareableLink") - defer func() { - sc := -1 - if result.Response() != nil { - sc = result.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - var future PutBastionShareableLinkFuture - future, err = client.PutBastionShareableLink(ctx, resourceGroupName, bastionHostName, bslRequest) - result.FutureAPI = future.FutureAPI - return -} - -// SupportedSecurityProviders gives the supported security providers for the virtual wan. -// Parameters: -// resourceGroupName - the resource group name. -// virtualWANName - the name of the VirtualWAN for which supported security providers are needed. -func (client BaseClient) SupportedSecurityProviders(ctx context.Context, resourceGroupName string, virtualWANName string) (result VirtualWanSecurityProviders, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.SupportedSecurityProviders") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.SupportedSecurityProvidersPreparer(ctx, resourceGroupName, virtualWANName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "SupportedSecurityProviders", nil, "Failure preparing request") - return - } - - resp, err := client.SupportedSecurityProvidersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.BaseClient", "SupportedSecurityProviders", resp, "Failure sending request") - return - } - - result, err = client.SupportedSecurityProvidersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BaseClient", "SupportedSecurityProviders", resp, "Failure responding to request") - return - } - - return -} - -// SupportedSecurityProvidersPreparer prepares the SupportedSecurityProviders request. -func (client BaseClient) SupportedSecurityProvidersPreparer(ctx context.Context, resourceGroupName string, virtualWANName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualWANName": autorest.Encode("path", virtualWANName), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/supportedSecurityProviders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SupportedSecurityProvidersSender sends the SupportedSecurityProviders request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) SupportedSecurityProvidersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SupportedSecurityProvidersResponder handles the response to the SupportedSecurityProviders request. The method always -// closes the http.Response Body. -func (client BaseClient) SupportedSecurityProvidersResponder(resp *http.Response) (result VirtualWanSecurityProviders, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/enums.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/enums.go deleted file mode 100644 index c94257960c6d..000000000000 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/enums.go +++ /dev/null @@ -1,3699 +0,0 @@ -package network - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// Access enumerates the values for access. -type Access string - -const ( - // AccessAllow ... - AccessAllow Access = "Allow" - // AccessDeny ... - AccessDeny Access = "Deny" -) - -// PossibleAccessValues returns an array of possible values for the Access const type. -func PossibleAccessValues() []Access { - return []Access{AccessAllow, AccessDeny} -} - -// ActionType enumerates the values for action type. -type ActionType string - -const ( - // ActionTypeAllow ... - ActionTypeAllow ActionType = "Allow" - // ActionTypeAnomalyScoring ... - ActionTypeAnomalyScoring ActionType = "AnomalyScoring" - // ActionTypeBlock ... - ActionTypeBlock ActionType = "Block" - // ActionTypeLog ... - ActionTypeLog ActionType = "Log" -) - -// PossibleActionTypeValues returns an array of possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{ActionTypeAllow, ActionTypeAnomalyScoring, ActionTypeBlock, ActionTypeLog} -} - -// AddressPrefixType enumerates the values for address prefix type. -type AddressPrefixType string - -const ( - // AddressPrefixTypeIPPrefix ... - AddressPrefixTypeIPPrefix AddressPrefixType = "IPPrefix" - // AddressPrefixTypeServiceTag ... - AddressPrefixTypeServiceTag AddressPrefixType = "ServiceTag" -) - -// PossibleAddressPrefixTypeValues returns an array of possible values for the AddressPrefixType const type. -func PossibleAddressPrefixTypeValues() []AddressPrefixType { - return []AddressPrefixType{AddressPrefixTypeIPPrefix, AddressPrefixTypeServiceTag} -} - -// ApplicationGatewayBackendHealthServerHealth enumerates the values for application gateway backend health -// server health. -type ApplicationGatewayBackendHealthServerHealth string - -const ( - // ApplicationGatewayBackendHealthServerHealthDown ... - ApplicationGatewayBackendHealthServerHealthDown ApplicationGatewayBackendHealthServerHealth = "Down" - // ApplicationGatewayBackendHealthServerHealthDraining ... - ApplicationGatewayBackendHealthServerHealthDraining ApplicationGatewayBackendHealthServerHealth = "Draining" - // ApplicationGatewayBackendHealthServerHealthPartial ... - ApplicationGatewayBackendHealthServerHealthPartial ApplicationGatewayBackendHealthServerHealth = "Partial" - // ApplicationGatewayBackendHealthServerHealthUnknown ... - ApplicationGatewayBackendHealthServerHealthUnknown ApplicationGatewayBackendHealthServerHealth = "Unknown" - // ApplicationGatewayBackendHealthServerHealthUp ... - ApplicationGatewayBackendHealthServerHealthUp ApplicationGatewayBackendHealthServerHealth = "Up" -) - -// PossibleApplicationGatewayBackendHealthServerHealthValues returns an array of possible values for the ApplicationGatewayBackendHealthServerHealth const type. -func PossibleApplicationGatewayBackendHealthServerHealthValues() []ApplicationGatewayBackendHealthServerHealth { - return []ApplicationGatewayBackendHealthServerHealth{ApplicationGatewayBackendHealthServerHealthDown, ApplicationGatewayBackendHealthServerHealthDraining, ApplicationGatewayBackendHealthServerHealthPartial, ApplicationGatewayBackendHealthServerHealthUnknown, ApplicationGatewayBackendHealthServerHealthUp} -} - -// ApplicationGatewayClientRevocationOptions enumerates the values for application gateway client revocation -// options. -type ApplicationGatewayClientRevocationOptions string - -const ( - // ApplicationGatewayClientRevocationOptionsNone ... - ApplicationGatewayClientRevocationOptionsNone ApplicationGatewayClientRevocationOptions = "None" - // ApplicationGatewayClientRevocationOptionsOCSP ... - ApplicationGatewayClientRevocationOptionsOCSP ApplicationGatewayClientRevocationOptions = "OCSP" -) - -// PossibleApplicationGatewayClientRevocationOptionsValues returns an array of possible values for the ApplicationGatewayClientRevocationOptions const type. -func PossibleApplicationGatewayClientRevocationOptionsValues() []ApplicationGatewayClientRevocationOptions { - return []ApplicationGatewayClientRevocationOptions{ApplicationGatewayClientRevocationOptionsNone, ApplicationGatewayClientRevocationOptionsOCSP} -} - -// ApplicationGatewayCookieBasedAffinity enumerates the values for application gateway cookie based affinity. -type ApplicationGatewayCookieBasedAffinity string - -const ( - // ApplicationGatewayCookieBasedAffinityDisabled ... - ApplicationGatewayCookieBasedAffinityDisabled ApplicationGatewayCookieBasedAffinity = "Disabled" - // ApplicationGatewayCookieBasedAffinityEnabled ... - ApplicationGatewayCookieBasedAffinityEnabled ApplicationGatewayCookieBasedAffinity = "Enabled" -) - -// PossibleApplicationGatewayCookieBasedAffinityValues returns an array of possible values for the ApplicationGatewayCookieBasedAffinity const type. -func PossibleApplicationGatewayCookieBasedAffinityValues() []ApplicationGatewayCookieBasedAffinity { - return []ApplicationGatewayCookieBasedAffinity{ApplicationGatewayCookieBasedAffinityDisabled, ApplicationGatewayCookieBasedAffinityEnabled} -} - -// ApplicationGatewayCustomErrorStatusCode enumerates the values for application gateway custom error status -// code. -type ApplicationGatewayCustomErrorStatusCode string - -const ( - // ApplicationGatewayCustomErrorStatusCodeHTTPStatus403 ... - ApplicationGatewayCustomErrorStatusCodeHTTPStatus403 ApplicationGatewayCustomErrorStatusCode = "HttpStatus403" - // ApplicationGatewayCustomErrorStatusCodeHTTPStatus502 ... - ApplicationGatewayCustomErrorStatusCodeHTTPStatus502 ApplicationGatewayCustomErrorStatusCode = "HttpStatus502" -) - -// PossibleApplicationGatewayCustomErrorStatusCodeValues returns an array of possible values for the ApplicationGatewayCustomErrorStatusCode const type. -func PossibleApplicationGatewayCustomErrorStatusCodeValues() []ApplicationGatewayCustomErrorStatusCode { - return []ApplicationGatewayCustomErrorStatusCode{ApplicationGatewayCustomErrorStatusCodeHTTPStatus403, ApplicationGatewayCustomErrorStatusCodeHTTPStatus502} -} - -// ApplicationGatewayFirewallMode enumerates the values for application gateway firewall mode. -type ApplicationGatewayFirewallMode string - -const ( - // ApplicationGatewayFirewallModeDetection ... - ApplicationGatewayFirewallModeDetection ApplicationGatewayFirewallMode = "Detection" - // ApplicationGatewayFirewallModePrevention ... - ApplicationGatewayFirewallModePrevention ApplicationGatewayFirewallMode = "Prevention" -) - -// PossibleApplicationGatewayFirewallModeValues returns an array of possible values for the ApplicationGatewayFirewallMode const type. -func PossibleApplicationGatewayFirewallModeValues() []ApplicationGatewayFirewallMode { - return []ApplicationGatewayFirewallMode{ApplicationGatewayFirewallModeDetection, ApplicationGatewayFirewallModePrevention} -} - -// ApplicationGatewayLoadDistributionAlgorithm enumerates the values for application gateway load distribution -// algorithm. -type ApplicationGatewayLoadDistributionAlgorithm string - -const ( - // ApplicationGatewayLoadDistributionAlgorithmIPHash ... - ApplicationGatewayLoadDistributionAlgorithmIPHash ApplicationGatewayLoadDistributionAlgorithm = "IpHash" - // ApplicationGatewayLoadDistributionAlgorithmLeastConnections ... - ApplicationGatewayLoadDistributionAlgorithmLeastConnections ApplicationGatewayLoadDistributionAlgorithm = "LeastConnections" - // ApplicationGatewayLoadDistributionAlgorithmRoundRobin ... - ApplicationGatewayLoadDistributionAlgorithmRoundRobin ApplicationGatewayLoadDistributionAlgorithm = "RoundRobin" -) - -// PossibleApplicationGatewayLoadDistributionAlgorithmValues returns an array of possible values for the ApplicationGatewayLoadDistributionAlgorithm const type. -func PossibleApplicationGatewayLoadDistributionAlgorithmValues() []ApplicationGatewayLoadDistributionAlgorithm { - return []ApplicationGatewayLoadDistributionAlgorithm{ApplicationGatewayLoadDistributionAlgorithmIPHash, ApplicationGatewayLoadDistributionAlgorithmLeastConnections, ApplicationGatewayLoadDistributionAlgorithmRoundRobin} -} - -// ApplicationGatewayOperationalState enumerates the values for application gateway operational state. -type ApplicationGatewayOperationalState string - -const ( - // ApplicationGatewayOperationalStateRunning ... - ApplicationGatewayOperationalStateRunning ApplicationGatewayOperationalState = "Running" - // ApplicationGatewayOperationalStateStarting ... - ApplicationGatewayOperationalStateStarting ApplicationGatewayOperationalState = "Starting" - // ApplicationGatewayOperationalStateStopped ... - ApplicationGatewayOperationalStateStopped ApplicationGatewayOperationalState = "Stopped" - // ApplicationGatewayOperationalStateStopping ... - ApplicationGatewayOperationalStateStopping ApplicationGatewayOperationalState = "Stopping" -) - -// PossibleApplicationGatewayOperationalStateValues returns an array of possible values for the ApplicationGatewayOperationalState const type. -func PossibleApplicationGatewayOperationalStateValues() []ApplicationGatewayOperationalState { - return []ApplicationGatewayOperationalState{ApplicationGatewayOperationalStateRunning, ApplicationGatewayOperationalStateStarting, ApplicationGatewayOperationalStateStopped, ApplicationGatewayOperationalStateStopping} -} - -// ApplicationGatewayProtocol enumerates the values for application gateway protocol. -type ApplicationGatewayProtocol string - -const ( - // ApplicationGatewayProtocolHTTP ... - ApplicationGatewayProtocolHTTP ApplicationGatewayProtocol = "Http" - // ApplicationGatewayProtocolHTTPS ... - ApplicationGatewayProtocolHTTPS ApplicationGatewayProtocol = "Https" - // ApplicationGatewayProtocolTCP ... - ApplicationGatewayProtocolTCP ApplicationGatewayProtocol = "Tcp" - // ApplicationGatewayProtocolTLS ... - ApplicationGatewayProtocolTLS ApplicationGatewayProtocol = "Tls" -) - -// PossibleApplicationGatewayProtocolValues returns an array of possible values for the ApplicationGatewayProtocol const type. -func PossibleApplicationGatewayProtocolValues() []ApplicationGatewayProtocol { - return []ApplicationGatewayProtocol{ApplicationGatewayProtocolHTTP, ApplicationGatewayProtocolHTTPS, ApplicationGatewayProtocolTCP, ApplicationGatewayProtocolTLS} -} - -// ApplicationGatewayRedirectType enumerates the values for application gateway redirect type. -type ApplicationGatewayRedirectType string - -const ( - // ApplicationGatewayRedirectTypeFound ... - ApplicationGatewayRedirectTypeFound ApplicationGatewayRedirectType = "Found" - // ApplicationGatewayRedirectTypePermanent ... - ApplicationGatewayRedirectTypePermanent ApplicationGatewayRedirectType = "Permanent" - // ApplicationGatewayRedirectTypeSeeOther ... - ApplicationGatewayRedirectTypeSeeOther ApplicationGatewayRedirectType = "SeeOther" - // ApplicationGatewayRedirectTypeTemporary ... - ApplicationGatewayRedirectTypeTemporary ApplicationGatewayRedirectType = "Temporary" -) - -// PossibleApplicationGatewayRedirectTypeValues returns an array of possible values for the ApplicationGatewayRedirectType const type. -func PossibleApplicationGatewayRedirectTypeValues() []ApplicationGatewayRedirectType { - return []ApplicationGatewayRedirectType{ApplicationGatewayRedirectTypeFound, ApplicationGatewayRedirectTypePermanent, ApplicationGatewayRedirectTypeSeeOther, ApplicationGatewayRedirectTypeTemporary} -} - -// ApplicationGatewayRequestRoutingRuleType enumerates the values for application gateway request routing rule -// type. -type ApplicationGatewayRequestRoutingRuleType string - -const ( - // ApplicationGatewayRequestRoutingRuleTypeBasic ... - ApplicationGatewayRequestRoutingRuleTypeBasic ApplicationGatewayRequestRoutingRuleType = "Basic" - // ApplicationGatewayRequestRoutingRuleTypePathBasedRouting ... - ApplicationGatewayRequestRoutingRuleTypePathBasedRouting ApplicationGatewayRequestRoutingRuleType = "PathBasedRouting" -) - -// PossibleApplicationGatewayRequestRoutingRuleTypeValues returns an array of possible values for the ApplicationGatewayRequestRoutingRuleType const type. -func PossibleApplicationGatewayRequestRoutingRuleTypeValues() []ApplicationGatewayRequestRoutingRuleType { - return []ApplicationGatewayRequestRoutingRuleType{ApplicationGatewayRequestRoutingRuleTypeBasic, ApplicationGatewayRequestRoutingRuleTypePathBasedRouting} -} - -// ApplicationGatewayRuleSetStatusOptions enumerates the values for application gateway rule set status -// options. -type ApplicationGatewayRuleSetStatusOptions string - -const ( - // ApplicationGatewayRuleSetStatusOptionsDeprecated ... - ApplicationGatewayRuleSetStatusOptionsDeprecated ApplicationGatewayRuleSetStatusOptions = "Deprecated" - // ApplicationGatewayRuleSetStatusOptionsGA ... - ApplicationGatewayRuleSetStatusOptionsGA ApplicationGatewayRuleSetStatusOptions = "GA" - // ApplicationGatewayRuleSetStatusOptionsPreview ... - ApplicationGatewayRuleSetStatusOptionsPreview ApplicationGatewayRuleSetStatusOptions = "Preview" - // ApplicationGatewayRuleSetStatusOptionsSupported ... - ApplicationGatewayRuleSetStatusOptionsSupported ApplicationGatewayRuleSetStatusOptions = "Supported" -) - -// PossibleApplicationGatewayRuleSetStatusOptionsValues returns an array of possible values for the ApplicationGatewayRuleSetStatusOptions const type. -func PossibleApplicationGatewayRuleSetStatusOptionsValues() []ApplicationGatewayRuleSetStatusOptions { - return []ApplicationGatewayRuleSetStatusOptions{ApplicationGatewayRuleSetStatusOptionsDeprecated, ApplicationGatewayRuleSetStatusOptionsGA, ApplicationGatewayRuleSetStatusOptionsPreview, ApplicationGatewayRuleSetStatusOptionsSupported} -} - -// ApplicationGatewaySkuName enumerates the values for application gateway sku name. -type ApplicationGatewaySkuName string - -const ( - // ApplicationGatewaySkuNameStandardLarge ... - ApplicationGatewaySkuNameStandardLarge ApplicationGatewaySkuName = "Standard_Large" - // ApplicationGatewaySkuNameStandardMedium ... - ApplicationGatewaySkuNameStandardMedium ApplicationGatewaySkuName = "Standard_Medium" - // ApplicationGatewaySkuNameStandardSmall ... - ApplicationGatewaySkuNameStandardSmall ApplicationGatewaySkuName = "Standard_Small" - // ApplicationGatewaySkuNameStandardV2 ... - ApplicationGatewaySkuNameStandardV2 ApplicationGatewaySkuName = "Standard_v2" - // ApplicationGatewaySkuNameWAFLarge ... - ApplicationGatewaySkuNameWAFLarge ApplicationGatewaySkuName = "WAF_Large" - // ApplicationGatewaySkuNameWAFMedium ... - ApplicationGatewaySkuNameWAFMedium ApplicationGatewaySkuName = "WAF_Medium" - // ApplicationGatewaySkuNameWAFV2 ... - ApplicationGatewaySkuNameWAFV2 ApplicationGatewaySkuName = "WAF_v2" -) - -// PossibleApplicationGatewaySkuNameValues returns an array of possible values for the ApplicationGatewaySkuName const type. -func PossibleApplicationGatewaySkuNameValues() []ApplicationGatewaySkuName { - return []ApplicationGatewaySkuName{ApplicationGatewaySkuNameStandardLarge, ApplicationGatewaySkuNameStandardMedium, ApplicationGatewaySkuNameStandardSmall, ApplicationGatewaySkuNameStandardV2, ApplicationGatewaySkuNameWAFLarge, ApplicationGatewaySkuNameWAFMedium, ApplicationGatewaySkuNameWAFV2} -} - -// ApplicationGatewaySslCipherSuite enumerates the values for application gateway ssl cipher suite. -type ApplicationGatewaySslCipherSuite string - -const ( - // ApplicationGatewaySslCipherSuiteTLSDHEDSSWITH3DESEDECBCSHA ... - ApplicationGatewaySslCipherSuiteTLSDHEDSSWITH3DESEDECBCSHA ApplicationGatewaySslCipherSuite = "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA" - // ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA ... - ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA ApplicationGatewaySslCipherSuite = "TLS_DHE_DSS_WITH_AES_128_CBC_SHA" - // ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA256 ... - ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256" - // ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA ... - ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA ApplicationGatewaySslCipherSuite = "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" - // ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA256 ... - ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256" - // ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128CBCSHA ... - ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128CBCSHA ApplicationGatewaySslCipherSuite = "TLS_DHE_RSA_WITH_AES_128_CBC_SHA" - // ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128GCMSHA256 ... - ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128GCMSHA256 ApplicationGatewaySslCipherSuite = "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" - // ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256CBCSHA ... - ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256CBCSHA ApplicationGatewaySslCipherSuite = "TLS_DHE_RSA_WITH_AES_256_CBC_SHA" - // ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256GCMSHA384 ... - ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256GCMSHA384 ApplicationGatewaySslCipherSuite = "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384" - // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA ... - ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" - // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256 ... - ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" - // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256 ... - ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" - // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA ... - ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" - // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384 ... - ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384" - // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384 ... - ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" - // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA ... - ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" - // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA256 ... - ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" - // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128GCMSHA256 ... - ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128GCMSHA256 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" - // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA ... - ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" - // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA384 ... - ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA384 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" - // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256GCMSHA384 ... - ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256GCMSHA384 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" - // ApplicationGatewaySslCipherSuiteTLSRSAWITH3DESEDECBCSHA ... - ApplicationGatewaySslCipherSuiteTLSRSAWITH3DESEDECBCSHA ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_3DES_EDE_CBC_SHA" - // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA ... - ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_128_CBC_SHA" - // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA256 ... - ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_128_CBC_SHA256" - // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128GCMSHA256 ... - ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128GCMSHA256 ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_128_GCM_SHA256" - // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA ... - ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_256_CBC_SHA" - // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA256 ... - ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_256_CBC_SHA256" - // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256GCMSHA384 ... - ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256GCMSHA384 ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_256_GCM_SHA384" -) - -// PossibleApplicationGatewaySslCipherSuiteValues returns an array of possible values for the ApplicationGatewaySslCipherSuite const type. -func PossibleApplicationGatewaySslCipherSuiteValues() []ApplicationGatewaySslCipherSuite { - return []ApplicationGatewaySslCipherSuite{ApplicationGatewaySslCipherSuiteTLSDHEDSSWITH3DESEDECBCSHA, ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA, ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA256, ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA, ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA256, ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128CBCSHA, ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128GCMSHA256, ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256CBCSHA, ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256GCMSHA384, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA256, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128GCMSHA256, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA384, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256GCMSHA384, ApplicationGatewaySslCipherSuiteTLSRSAWITH3DESEDECBCSHA, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA256, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128GCMSHA256, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA256, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256GCMSHA384} -} - -// ApplicationGatewaySslPolicyName enumerates the values for application gateway ssl policy name. -type ApplicationGatewaySslPolicyName string - -const ( - // ApplicationGatewaySslPolicyNameAppGwSslPolicy20150501 ... - ApplicationGatewaySslPolicyNameAppGwSslPolicy20150501 ApplicationGatewaySslPolicyName = "AppGwSslPolicy20150501" - // ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401 ... - ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401 ApplicationGatewaySslPolicyName = "AppGwSslPolicy20170401" - // ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401S ... - ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401S ApplicationGatewaySslPolicyName = "AppGwSslPolicy20170401S" - // ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101 ... - ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101 ApplicationGatewaySslPolicyName = "AppGwSslPolicy20220101" - // ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101S ... - ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101S ApplicationGatewaySslPolicyName = "AppGwSslPolicy20220101S" -) - -// PossibleApplicationGatewaySslPolicyNameValues returns an array of possible values for the ApplicationGatewaySslPolicyName const type. -func PossibleApplicationGatewaySslPolicyNameValues() []ApplicationGatewaySslPolicyName { - return []ApplicationGatewaySslPolicyName{ApplicationGatewaySslPolicyNameAppGwSslPolicy20150501, ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401, ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401S, ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101, ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101S} -} - -// ApplicationGatewaySslPolicyType enumerates the values for application gateway ssl policy type. -type ApplicationGatewaySslPolicyType string - -const ( - // ApplicationGatewaySslPolicyTypeCustom ... - ApplicationGatewaySslPolicyTypeCustom ApplicationGatewaySslPolicyType = "Custom" - // ApplicationGatewaySslPolicyTypeCustomV2 ... - ApplicationGatewaySslPolicyTypeCustomV2 ApplicationGatewaySslPolicyType = "CustomV2" - // ApplicationGatewaySslPolicyTypePredefined ... - ApplicationGatewaySslPolicyTypePredefined ApplicationGatewaySslPolicyType = "Predefined" -) - -// PossibleApplicationGatewaySslPolicyTypeValues returns an array of possible values for the ApplicationGatewaySslPolicyType const type. -func PossibleApplicationGatewaySslPolicyTypeValues() []ApplicationGatewaySslPolicyType { - return []ApplicationGatewaySslPolicyType{ApplicationGatewaySslPolicyTypeCustom, ApplicationGatewaySslPolicyTypeCustomV2, ApplicationGatewaySslPolicyTypePredefined} -} - -// ApplicationGatewaySslProtocol enumerates the values for application gateway ssl protocol. -type ApplicationGatewaySslProtocol string - -const ( - // ApplicationGatewaySslProtocolTLSv10 ... - ApplicationGatewaySslProtocolTLSv10 ApplicationGatewaySslProtocol = "TLSv1_0" - // ApplicationGatewaySslProtocolTLSv11 ... - ApplicationGatewaySslProtocolTLSv11 ApplicationGatewaySslProtocol = "TLSv1_1" - // ApplicationGatewaySslProtocolTLSv12 ... - ApplicationGatewaySslProtocolTLSv12 ApplicationGatewaySslProtocol = "TLSv1_2" - // ApplicationGatewaySslProtocolTLSv13 ... - ApplicationGatewaySslProtocolTLSv13 ApplicationGatewaySslProtocol = "TLSv1_3" -) - -// PossibleApplicationGatewaySslProtocolValues returns an array of possible values for the ApplicationGatewaySslProtocol const type. -func PossibleApplicationGatewaySslProtocolValues() []ApplicationGatewaySslProtocol { - return []ApplicationGatewaySslProtocol{ApplicationGatewaySslProtocolTLSv10, ApplicationGatewaySslProtocolTLSv11, ApplicationGatewaySslProtocolTLSv12, ApplicationGatewaySslProtocolTLSv13} -} - -// ApplicationGatewayTier enumerates the values for application gateway tier. -type ApplicationGatewayTier string - -const ( - // ApplicationGatewayTierStandard ... - ApplicationGatewayTierStandard ApplicationGatewayTier = "Standard" - // ApplicationGatewayTierStandardV2 ... - ApplicationGatewayTierStandardV2 ApplicationGatewayTier = "Standard_v2" - // ApplicationGatewayTierWAF ... - ApplicationGatewayTierWAF ApplicationGatewayTier = "WAF" - // ApplicationGatewayTierWAFV2 ... - ApplicationGatewayTierWAFV2 ApplicationGatewayTier = "WAF_v2" -) - -// PossibleApplicationGatewayTierValues returns an array of possible values for the ApplicationGatewayTier const type. -func PossibleApplicationGatewayTierValues() []ApplicationGatewayTier { - return []ApplicationGatewayTier{ApplicationGatewayTierStandard, ApplicationGatewayTierStandardV2, ApplicationGatewayTierWAF, ApplicationGatewayTierWAFV2} -} - -// ApplicationGatewayTierTypes enumerates the values for application gateway tier types. -type ApplicationGatewayTierTypes string - -const ( - // ApplicationGatewayTierTypesStandard ... - ApplicationGatewayTierTypesStandard ApplicationGatewayTierTypes = "Standard" - // ApplicationGatewayTierTypesStandardV2 ... - ApplicationGatewayTierTypesStandardV2 ApplicationGatewayTierTypes = "Standard_v2" - // ApplicationGatewayTierTypesWAF ... - ApplicationGatewayTierTypesWAF ApplicationGatewayTierTypes = "WAF" - // ApplicationGatewayTierTypesWAFV2 ... - ApplicationGatewayTierTypesWAFV2 ApplicationGatewayTierTypes = "WAF_v2" -) - -// PossibleApplicationGatewayTierTypesValues returns an array of possible values for the ApplicationGatewayTierTypes const type. -func PossibleApplicationGatewayTierTypesValues() []ApplicationGatewayTierTypes { - return []ApplicationGatewayTierTypes{ApplicationGatewayTierTypesStandard, ApplicationGatewayTierTypesStandardV2, ApplicationGatewayTierTypesWAF, ApplicationGatewayTierTypesWAFV2} -} - -// ApplicationGatewayWafRuleActionTypes enumerates the values for application gateway waf rule action types. -type ApplicationGatewayWafRuleActionTypes string - -const ( - // ApplicationGatewayWafRuleActionTypesAllow ... - ApplicationGatewayWafRuleActionTypesAllow ApplicationGatewayWafRuleActionTypes = "Allow" - // ApplicationGatewayWafRuleActionTypesAnomalyScoring ... - ApplicationGatewayWafRuleActionTypesAnomalyScoring ApplicationGatewayWafRuleActionTypes = "AnomalyScoring" - // ApplicationGatewayWafRuleActionTypesBlock ... - ApplicationGatewayWafRuleActionTypesBlock ApplicationGatewayWafRuleActionTypes = "Block" - // ApplicationGatewayWafRuleActionTypesLog ... - ApplicationGatewayWafRuleActionTypesLog ApplicationGatewayWafRuleActionTypes = "Log" - // ApplicationGatewayWafRuleActionTypesNone ... - ApplicationGatewayWafRuleActionTypesNone ApplicationGatewayWafRuleActionTypes = "None" -) - -// PossibleApplicationGatewayWafRuleActionTypesValues returns an array of possible values for the ApplicationGatewayWafRuleActionTypes const type. -func PossibleApplicationGatewayWafRuleActionTypesValues() []ApplicationGatewayWafRuleActionTypes { - return []ApplicationGatewayWafRuleActionTypes{ApplicationGatewayWafRuleActionTypesAllow, ApplicationGatewayWafRuleActionTypesAnomalyScoring, ApplicationGatewayWafRuleActionTypesBlock, ApplicationGatewayWafRuleActionTypesLog, ApplicationGatewayWafRuleActionTypesNone} -} - -// ApplicationGatewayWafRuleStateTypes enumerates the values for application gateway waf rule state types. -type ApplicationGatewayWafRuleStateTypes string - -const ( - // ApplicationGatewayWafRuleStateTypesDisabled ... - ApplicationGatewayWafRuleStateTypesDisabled ApplicationGatewayWafRuleStateTypes = "Disabled" - // ApplicationGatewayWafRuleStateTypesEnabled ... - ApplicationGatewayWafRuleStateTypesEnabled ApplicationGatewayWafRuleStateTypes = "Enabled" -) - -// PossibleApplicationGatewayWafRuleStateTypesValues returns an array of possible values for the ApplicationGatewayWafRuleStateTypes const type. -func PossibleApplicationGatewayWafRuleStateTypesValues() []ApplicationGatewayWafRuleStateTypes { - return []ApplicationGatewayWafRuleStateTypes{ApplicationGatewayWafRuleStateTypesDisabled, ApplicationGatewayWafRuleStateTypesEnabled} -} - -// AssociationType enumerates the values for association type. -type AssociationType string - -const ( - // AssociationTypeAssociated ... - AssociationTypeAssociated AssociationType = "Associated" - // AssociationTypeContains ... - AssociationTypeContains AssociationType = "Contains" -) - -// PossibleAssociationTypeValues returns an array of possible values for the AssociationType const type. -func PossibleAssociationTypeValues() []AssociationType { - return []AssociationType{AssociationTypeAssociated, AssociationTypeContains} -} - -// AuthenticationMethod enumerates the values for authentication method. -type AuthenticationMethod string - -const ( - // AuthenticationMethodEAPMSCHAPv2 ... - AuthenticationMethodEAPMSCHAPv2 AuthenticationMethod = "EAPMSCHAPv2" - // AuthenticationMethodEAPTLS ... - AuthenticationMethodEAPTLS AuthenticationMethod = "EAPTLS" -) - -// PossibleAuthenticationMethodValues returns an array of possible values for the AuthenticationMethod const type. -func PossibleAuthenticationMethodValues() []AuthenticationMethod { - return []AuthenticationMethod{AuthenticationMethodEAPMSCHAPv2, AuthenticationMethodEAPTLS} -} - -// AuthorizationUseStatus enumerates the values for authorization use status. -type AuthorizationUseStatus string - -const ( - // AuthorizationUseStatusAvailable ... - AuthorizationUseStatusAvailable AuthorizationUseStatus = "Available" - // AuthorizationUseStatusInUse ... - AuthorizationUseStatusInUse AuthorizationUseStatus = "InUse" -) - -// PossibleAuthorizationUseStatusValues returns an array of possible values for the AuthorizationUseStatus const type. -func PossibleAuthorizationUseStatusValues() []AuthorizationUseStatus { - return []AuthorizationUseStatus{AuthorizationUseStatusAvailable, AuthorizationUseStatusInUse} -} - -// AutoLearnPrivateRangesMode enumerates the values for auto learn private ranges mode. -type AutoLearnPrivateRangesMode string - -const ( - // AutoLearnPrivateRangesModeDisabled ... - AutoLearnPrivateRangesModeDisabled AutoLearnPrivateRangesMode = "Disabled" - // AutoLearnPrivateRangesModeEnabled ... - AutoLearnPrivateRangesModeEnabled AutoLearnPrivateRangesMode = "Enabled" -) - -// PossibleAutoLearnPrivateRangesModeValues returns an array of possible values for the AutoLearnPrivateRangesMode const type. -func PossibleAutoLearnPrivateRangesModeValues() []AutoLearnPrivateRangesMode { - return []AutoLearnPrivateRangesMode{AutoLearnPrivateRangesModeDisabled, AutoLearnPrivateRangesModeEnabled} -} - -// AzureFirewallApplicationRuleProtocolType enumerates the values for azure firewall application rule protocol -// type. -type AzureFirewallApplicationRuleProtocolType string - -const ( - // AzureFirewallApplicationRuleProtocolTypeHTTP ... - AzureFirewallApplicationRuleProtocolTypeHTTP AzureFirewallApplicationRuleProtocolType = "Http" - // AzureFirewallApplicationRuleProtocolTypeHTTPS ... - AzureFirewallApplicationRuleProtocolTypeHTTPS AzureFirewallApplicationRuleProtocolType = "Https" - // AzureFirewallApplicationRuleProtocolTypeMssql ... - AzureFirewallApplicationRuleProtocolTypeMssql AzureFirewallApplicationRuleProtocolType = "Mssql" -) - -// PossibleAzureFirewallApplicationRuleProtocolTypeValues returns an array of possible values for the AzureFirewallApplicationRuleProtocolType const type. -func PossibleAzureFirewallApplicationRuleProtocolTypeValues() []AzureFirewallApplicationRuleProtocolType { - return []AzureFirewallApplicationRuleProtocolType{AzureFirewallApplicationRuleProtocolTypeHTTP, AzureFirewallApplicationRuleProtocolTypeHTTPS, AzureFirewallApplicationRuleProtocolTypeMssql} -} - -// AzureFirewallNatRCActionType enumerates the values for azure firewall nat rc action type. -type AzureFirewallNatRCActionType string - -const ( - // AzureFirewallNatRCActionTypeDnat ... - AzureFirewallNatRCActionTypeDnat AzureFirewallNatRCActionType = "Dnat" - // AzureFirewallNatRCActionTypeSnat ... - AzureFirewallNatRCActionTypeSnat AzureFirewallNatRCActionType = "Snat" -) - -// PossibleAzureFirewallNatRCActionTypeValues returns an array of possible values for the AzureFirewallNatRCActionType const type. -func PossibleAzureFirewallNatRCActionTypeValues() []AzureFirewallNatRCActionType { - return []AzureFirewallNatRCActionType{AzureFirewallNatRCActionTypeDnat, AzureFirewallNatRCActionTypeSnat} -} - -// AzureFirewallNetworkRuleProtocol enumerates the values for azure firewall network rule protocol. -type AzureFirewallNetworkRuleProtocol string - -const ( - // AzureFirewallNetworkRuleProtocolAny ... - AzureFirewallNetworkRuleProtocolAny AzureFirewallNetworkRuleProtocol = "Any" - // AzureFirewallNetworkRuleProtocolICMP ... - AzureFirewallNetworkRuleProtocolICMP AzureFirewallNetworkRuleProtocol = "ICMP" - // AzureFirewallNetworkRuleProtocolTCP ... - AzureFirewallNetworkRuleProtocolTCP AzureFirewallNetworkRuleProtocol = "TCP" - // AzureFirewallNetworkRuleProtocolUDP ... - AzureFirewallNetworkRuleProtocolUDP AzureFirewallNetworkRuleProtocol = "UDP" -) - -// PossibleAzureFirewallNetworkRuleProtocolValues returns an array of possible values for the AzureFirewallNetworkRuleProtocol const type. -func PossibleAzureFirewallNetworkRuleProtocolValues() []AzureFirewallNetworkRuleProtocol { - return []AzureFirewallNetworkRuleProtocol{AzureFirewallNetworkRuleProtocolAny, AzureFirewallNetworkRuleProtocolICMP, AzureFirewallNetworkRuleProtocolTCP, AzureFirewallNetworkRuleProtocolUDP} -} - -// AzureFirewallRCActionType enumerates the values for azure firewall rc action type. -type AzureFirewallRCActionType string - -const ( - // AzureFirewallRCActionTypeAllow ... - AzureFirewallRCActionTypeAllow AzureFirewallRCActionType = "Allow" - // AzureFirewallRCActionTypeDeny ... - AzureFirewallRCActionTypeDeny AzureFirewallRCActionType = "Deny" -) - -// PossibleAzureFirewallRCActionTypeValues returns an array of possible values for the AzureFirewallRCActionType const type. -func PossibleAzureFirewallRCActionTypeValues() []AzureFirewallRCActionType { - return []AzureFirewallRCActionType{AzureFirewallRCActionTypeAllow, AzureFirewallRCActionTypeDeny} -} - -// AzureFirewallSkuName enumerates the values for azure firewall sku name. -type AzureFirewallSkuName string - -const ( - // AzureFirewallSkuNameAZFWHub ... - AzureFirewallSkuNameAZFWHub AzureFirewallSkuName = "AZFW_Hub" - // AzureFirewallSkuNameAZFWVNet ... - AzureFirewallSkuNameAZFWVNet AzureFirewallSkuName = "AZFW_VNet" -) - -// PossibleAzureFirewallSkuNameValues returns an array of possible values for the AzureFirewallSkuName const type. -func PossibleAzureFirewallSkuNameValues() []AzureFirewallSkuName { - return []AzureFirewallSkuName{AzureFirewallSkuNameAZFWHub, AzureFirewallSkuNameAZFWVNet} -} - -// AzureFirewallSkuTier enumerates the values for azure firewall sku tier. -type AzureFirewallSkuTier string - -const ( - // AzureFirewallSkuTierBasic ... - AzureFirewallSkuTierBasic AzureFirewallSkuTier = "Basic" - // AzureFirewallSkuTierPremium ... - AzureFirewallSkuTierPremium AzureFirewallSkuTier = "Premium" - // AzureFirewallSkuTierStandard ... - AzureFirewallSkuTierStandard AzureFirewallSkuTier = "Standard" -) - -// PossibleAzureFirewallSkuTierValues returns an array of possible values for the AzureFirewallSkuTier const type. -func PossibleAzureFirewallSkuTierValues() []AzureFirewallSkuTier { - return []AzureFirewallSkuTier{AzureFirewallSkuTierBasic, AzureFirewallSkuTierPremium, AzureFirewallSkuTierStandard} -} - -// AzureFirewallThreatIntelMode enumerates the values for azure firewall threat intel mode. -type AzureFirewallThreatIntelMode string - -const ( - // AzureFirewallThreatIntelModeAlert ... - AzureFirewallThreatIntelModeAlert AzureFirewallThreatIntelMode = "Alert" - // AzureFirewallThreatIntelModeDeny ... - AzureFirewallThreatIntelModeDeny AzureFirewallThreatIntelMode = "Deny" - // AzureFirewallThreatIntelModeOff ... - AzureFirewallThreatIntelModeOff AzureFirewallThreatIntelMode = "Off" -) - -// PossibleAzureFirewallThreatIntelModeValues returns an array of possible values for the AzureFirewallThreatIntelMode const type. -func PossibleAzureFirewallThreatIntelModeValues() []AzureFirewallThreatIntelMode { - return []AzureFirewallThreatIntelMode{AzureFirewallThreatIntelModeAlert, AzureFirewallThreatIntelModeDeny, AzureFirewallThreatIntelModeOff} -} - -// BastionConnectProtocol enumerates the values for bastion connect protocol. -type BastionConnectProtocol string - -const ( - // BastionConnectProtocolRDP ... - BastionConnectProtocolRDP BastionConnectProtocol = "RDP" - // BastionConnectProtocolSSH ... - BastionConnectProtocolSSH BastionConnectProtocol = "SSH" -) - -// PossibleBastionConnectProtocolValues returns an array of possible values for the BastionConnectProtocol const type. -func PossibleBastionConnectProtocolValues() []BastionConnectProtocol { - return []BastionConnectProtocol{BastionConnectProtocolRDP, BastionConnectProtocolSSH} -} - -// BastionHostSkuName enumerates the values for bastion host sku name. -type BastionHostSkuName string - -const ( - // BastionHostSkuNameBasic ... - BastionHostSkuNameBasic BastionHostSkuName = "Basic" - // BastionHostSkuNameStandard ... - BastionHostSkuNameStandard BastionHostSkuName = "Standard" -) - -// PossibleBastionHostSkuNameValues returns an array of possible values for the BastionHostSkuName const type. -func PossibleBastionHostSkuNameValues() []BastionHostSkuName { - return []BastionHostSkuName{BastionHostSkuNameBasic, BastionHostSkuNameStandard} -} - -// BgpPeerState enumerates the values for bgp peer state. -type BgpPeerState string - -const ( - // BgpPeerStateConnected ... - BgpPeerStateConnected BgpPeerState = "Connected" - // BgpPeerStateConnecting ... - BgpPeerStateConnecting BgpPeerState = "Connecting" - // BgpPeerStateIdle ... - BgpPeerStateIdle BgpPeerState = "Idle" - // BgpPeerStateStopped ... - BgpPeerStateStopped BgpPeerState = "Stopped" - // BgpPeerStateUnknown ... - BgpPeerStateUnknown BgpPeerState = "Unknown" -) - -// PossibleBgpPeerStateValues returns an array of possible values for the BgpPeerState const type. -func PossibleBgpPeerStateValues() []BgpPeerState { - return []BgpPeerState{BgpPeerStateConnected, BgpPeerStateConnecting, BgpPeerStateIdle, BgpPeerStateStopped, BgpPeerStateUnknown} -} - -// CircuitConnectionStatus enumerates the values for circuit connection status. -type CircuitConnectionStatus string - -const ( - // CircuitConnectionStatusConnected ... - CircuitConnectionStatusConnected CircuitConnectionStatus = "Connected" - // CircuitConnectionStatusConnecting ... - CircuitConnectionStatusConnecting CircuitConnectionStatus = "Connecting" - // CircuitConnectionStatusDisconnected ... - CircuitConnectionStatusDisconnected CircuitConnectionStatus = "Disconnected" -) - -// PossibleCircuitConnectionStatusValues returns an array of possible values for the CircuitConnectionStatus const type. -func PossibleCircuitConnectionStatusValues() []CircuitConnectionStatus { - return []CircuitConnectionStatus{CircuitConnectionStatusConnected, CircuitConnectionStatusConnecting, CircuitConnectionStatusDisconnected} -} - -// CommissionedState enumerates the values for commissioned state. -type CommissionedState string - -const ( - // CommissionedStateCommissioned ... - CommissionedStateCommissioned CommissionedState = "Commissioned" - // CommissionedStateCommissionedNoInternetAdvertise ... - CommissionedStateCommissionedNoInternetAdvertise CommissionedState = "CommissionedNoInternetAdvertise" - // CommissionedStateCommissioning ... - CommissionedStateCommissioning CommissionedState = "Commissioning" - // CommissionedStateDecommissioning ... - CommissionedStateDecommissioning CommissionedState = "Decommissioning" - // CommissionedStateDeprovisioned ... - CommissionedStateDeprovisioned CommissionedState = "Deprovisioned" - // CommissionedStateDeprovisioning ... - CommissionedStateDeprovisioning CommissionedState = "Deprovisioning" - // CommissionedStateProvisioned ... - CommissionedStateProvisioned CommissionedState = "Provisioned" - // CommissionedStateProvisioning ... - CommissionedStateProvisioning CommissionedState = "Provisioning" -) - -// PossibleCommissionedStateValues returns an array of possible values for the CommissionedState const type. -func PossibleCommissionedStateValues() []CommissionedState { - return []CommissionedState{CommissionedStateCommissioned, CommissionedStateCommissionedNoInternetAdvertise, CommissionedStateCommissioning, CommissionedStateDecommissioning, CommissionedStateDeprovisioned, CommissionedStateDeprovisioning, CommissionedStateProvisioned, CommissionedStateProvisioning} -} - -// ConfigurationType enumerates the values for configuration type. -type ConfigurationType string - -const ( - // ConfigurationTypeConnectivity ... - ConfigurationTypeConnectivity ConfigurationType = "Connectivity" - // ConfigurationTypeSecurityAdmin ... - ConfigurationTypeSecurityAdmin ConfigurationType = "SecurityAdmin" -) - -// PossibleConfigurationTypeValues returns an array of possible values for the ConfigurationType const type. -func PossibleConfigurationTypeValues() []ConfigurationType { - return []ConfigurationType{ConfigurationTypeConnectivity, ConfigurationTypeSecurityAdmin} -} - -// ConnectionMonitorEndpointFilterItemType enumerates the values for connection monitor endpoint filter item -// type. -type ConnectionMonitorEndpointFilterItemType string - -const ( - // ConnectionMonitorEndpointFilterItemTypeAgentAddress ... - ConnectionMonitorEndpointFilterItemTypeAgentAddress ConnectionMonitorEndpointFilterItemType = "AgentAddress" -) - -// PossibleConnectionMonitorEndpointFilterItemTypeValues returns an array of possible values for the ConnectionMonitorEndpointFilterItemType const type. -func PossibleConnectionMonitorEndpointFilterItemTypeValues() []ConnectionMonitorEndpointFilterItemType { - return []ConnectionMonitorEndpointFilterItemType{ConnectionMonitorEndpointFilterItemTypeAgentAddress} -} - -// ConnectionMonitorEndpointFilterType enumerates the values for connection monitor endpoint filter type. -type ConnectionMonitorEndpointFilterType string - -const ( - // ConnectionMonitorEndpointFilterTypeInclude ... - ConnectionMonitorEndpointFilterTypeInclude ConnectionMonitorEndpointFilterType = "Include" -) - -// PossibleConnectionMonitorEndpointFilterTypeValues returns an array of possible values for the ConnectionMonitorEndpointFilterType const type. -func PossibleConnectionMonitorEndpointFilterTypeValues() []ConnectionMonitorEndpointFilterType { - return []ConnectionMonitorEndpointFilterType{ConnectionMonitorEndpointFilterTypeInclude} -} - -// ConnectionMonitorSourceStatus enumerates the values for connection monitor source status. -type ConnectionMonitorSourceStatus string - -const ( - // ConnectionMonitorSourceStatusActive ... - ConnectionMonitorSourceStatusActive ConnectionMonitorSourceStatus = "Active" - // ConnectionMonitorSourceStatusInactive ... - ConnectionMonitorSourceStatusInactive ConnectionMonitorSourceStatus = "Inactive" - // ConnectionMonitorSourceStatusUnknown ... - ConnectionMonitorSourceStatusUnknown ConnectionMonitorSourceStatus = "Unknown" -) - -// PossibleConnectionMonitorSourceStatusValues returns an array of possible values for the ConnectionMonitorSourceStatus const type. -func PossibleConnectionMonitorSourceStatusValues() []ConnectionMonitorSourceStatus { - return []ConnectionMonitorSourceStatus{ConnectionMonitorSourceStatusActive, ConnectionMonitorSourceStatusInactive, ConnectionMonitorSourceStatusUnknown} -} - -// ConnectionMonitorTestConfigurationProtocol enumerates the values for connection monitor test configuration -// protocol. -type ConnectionMonitorTestConfigurationProtocol string - -const ( - // ConnectionMonitorTestConfigurationProtocolHTTP ... - ConnectionMonitorTestConfigurationProtocolHTTP ConnectionMonitorTestConfigurationProtocol = "Http" - // ConnectionMonitorTestConfigurationProtocolIcmp ... - ConnectionMonitorTestConfigurationProtocolIcmp ConnectionMonitorTestConfigurationProtocol = "Icmp" - // ConnectionMonitorTestConfigurationProtocolTCP ... - ConnectionMonitorTestConfigurationProtocolTCP ConnectionMonitorTestConfigurationProtocol = "Tcp" -) - -// PossibleConnectionMonitorTestConfigurationProtocolValues returns an array of possible values for the ConnectionMonitorTestConfigurationProtocol const type. -func PossibleConnectionMonitorTestConfigurationProtocolValues() []ConnectionMonitorTestConfigurationProtocol { - return []ConnectionMonitorTestConfigurationProtocol{ConnectionMonitorTestConfigurationProtocolHTTP, ConnectionMonitorTestConfigurationProtocolIcmp, ConnectionMonitorTestConfigurationProtocolTCP} -} - -// ConnectionMonitorType enumerates the values for connection monitor type. -type ConnectionMonitorType string - -const ( - // ConnectionMonitorTypeMultiEndpoint ... - ConnectionMonitorTypeMultiEndpoint ConnectionMonitorType = "MultiEndpoint" - // ConnectionMonitorTypeSingleSourceDestination ... - ConnectionMonitorTypeSingleSourceDestination ConnectionMonitorType = "SingleSourceDestination" -) - -// PossibleConnectionMonitorTypeValues returns an array of possible values for the ConnectionMonitorType const type. -func PossibleConnectionMonitorTypeValues() []ConnectionMonitorType { - return []ConnectionMonitorType{ConnectionMonitorTypeMultiEndpoint, ConnectionMonitorTypeSingleSourceDestination} -} - -// ConnectionState enumerates the values for connection state. -type ConnectionState string - -const ( - // ConnectionStateReachable ... - ConnectionStateReachable ConnectionState = "Reachable" - // ConnectionStateUnknown ... - ConnectionStateUnknown ConnectionState = "Unknown" - // ConnectionStateUnreachable ... - ConnectionStateUnreachable ConnectionState = "Unreachable" -) - -// PossibleConnectionStateValues returns an array of possible values for the ConnectionState const type. -func PossibleConnectionStateValues() []ConnectionState { - return []ConnectionState{ConnectionStateReachable, ConnectionStateUnknown, ConnectionStateUnreachable} -} - -// ConnectionStatus enumerates the values for connection status. -type ConnectionStatus string - -const ( - // ConnectionStatusConnected ... - ConnectionStatusConnected ConnectionStatus = "Connected" - // ConnectionStatusDegraded ... - ConnectionStatusDegraded ConnectionStatus = "Degraded" - // ConnectionStatusDisconnected ... - ConnectionStatusDisconnected ConnectionStatus = "Disconnected" - // ConnectionStatusUnknown ... - ConnectionStatusUnknown ConnectionStatus = "Unknown" -) - -// PossibleConnectionStatusValues returns an array of possible values for the ConnectionStatus const type. -func PossibleConnectionStatusValues() []ConnectionStatus { - return []ConnectionStatus{ConnectionStatusConnected, ConnectionStatusDegraded, ConnectionStatusDisconnected, ConnectionStatusUnknown} -} - -// ConnectivityTopology enumerates the values for connectivity topology. -type ConnectivityTopology string - -const ( - // ConnectivityTopologyHubAndSpoke ... - ConnectivityTopologyHubAndSpoke ConnectivityTopology = "HubAndSpoke" - // ConnectivityTopologyMesh ... - ConnectivityTopologyMesh ConnectivityTopology = "Mesh" -) - -// PossibleConnectivityTopologyValues returns an array of possible values for the ConnectivityTopology const type. -func PossibleConnectivityTopologyValues() []ConnectivityTopology { - return []ConnectivityTopology{ConnectivityTopologyHubAndSpoke, ConnectivityTopologyMesh} -} - -// CoverageLevel enumerates the values for coverage level. -type CoverageLevel string - -const ( - // CoverageLevelAboveAverage ... - CoverageLevelAboveAverage CoverageLevel = "AboveAverage" - // CoverageLevelAverage ... - CoverageLevelAverage CoverageLevel = "Average" - // CoverageLevelBelowAverage ... - CoverageLevelBelowAverage CoverageLevel = "BelowAverage" - // CoverageLevelDefault ... - CoverageLevelDefault CoverageLevel = "Default" - // CoverageLevelFull ... - CoverageLevelFull CoverageLevel = "Full" - // CoverageLevelLow ... - CoverageLevelLow CoverageLevel = "Low" -) - -// PossibleCoverageLevelValues returns an array of possible values for the CoverageLevel const type. -func PossibleCoverageLevelValues() []CoverageLevel { - return []CoverageLevel{CoverageLevelAboveAverage, CoverageLevelAverage, CoverageLevelBelowAverage, CoverageLevelDefault, CoverageLevelFull, CoverageLevelLow} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// CustomIPPrefixType enumerates the values for custom ip prefix type. -type CustomIPPrefixType string - -const ( - // CustomIPPrefixTypeChild ... - CustomIPPrefixTypeChild CustomIPPrefixType = "Child" - // CustomIPPrefixTypeParent ... - CustomIPPrefixTypeParent CustomIPPrefixType = "Parent" - // CustomIPPrefixTypeSingular ... - CustomIPPrefixTypeSingular CustomIPPrefixType = "Singular" -) - -// PossibleCustomIPPrefixTypeValues returns an array of possible values for the CustomIPPrefixType const type. -func PossibleCustomIPPrefixTypeValues() []CustomIPPrefixType { - return []CustomIPPrefixType{CustomIPPrefixTypeChild, CustomIPPrefixTypeParent, CustomIPPrefixTypeSingular} -} - -// DdosSettingsProtectionMode enumerates the values for ddos settings protection mode. -type DdosSettingsProtectionMode string - -const ( - // DdosSettingsProtectionModeDisabled ... - DdosSettingsProtectionModeDisabled DdosSettingsProtectionMode = "Disabled" - // DdosSettingsProtectionModeEnabled ... - DdosSettingsProtectionModeEnabled DdosSettingsProtectionMode = "Enabled" - // DdosSettingsProtectionModeVirtualNetworkInherited ... - DdosSettingsProtectionModeVirtualNetworkInherited DdosSettingsProtectionMode = "VirtualNetworkInherited" -) - -// PossibleDdosSettingsProtectionModeValues returns an array of possible values for the DdosSettingsProtectionMode const type. -func PossibleDdosSettingsProtectionModeValues() []DdosSettingsProtectionMode { - return []DdosSettingsProtectionMode{DdosSettingsProtectionModeDisabled, DdosSettingsProtectionModeEnabled, DdosSettingsProtectionModeVirtualNetworkInherited} -} - -// DeleteExistingPeering enumerates the values for delete existing peering. -type DeleteExistingPeering string - -const ( - // DeleteExistingPeeringFalse ... - DeleteExistingPeeringFalse DeleteExistingPeering = "False" - // DeleteExistingPeeringTrue ... - DeleteExistingPeeringTrue DeleteExistingPeering = "True" -) - -// PossibleDeleteExistingPeeringValues returns an array of possible values for the DeleteExistingPeering const type. -func PossibleDeleteExistingPeeringValues() []DeleteExistingPeering { - return []DeleteExistingPeering{DeleteExistingPeeringFalse, DeleteExistingPeeringTrue} -} - -// DeleteOptions enumerates the values for delete options. -type DeleteOptions string - -const ( - // DeleteOptionsDelete ... - DeleteOptionsDelete DeleteOptions = "Delete" - // DeleteOptionsDetach ... - DeleteOptionsDetach DeleteOptions = "Detach" -) - -// PossibleDeleteOptionsValues returns an array of possible values for the DeleteOptions const type. -func PossibleDeleteOptionsValues() []DeleteOptions { - return []DeleteOptions{DeleteOptionsDelete, DeleteOptionsDetach} -} - -// DeploymentStatus enumerates the values for deployment status. -type DeploymentStatus string - -const ( - // DeploymentStatusDeployed ... - DeploymentStatusDeployed DeploymentStatus = "Deployed" - // DeploymentStatusDeploying ... - DeploymentStatusDeploying DeploymentStatus = "Deploying" - // DeploymentStatusFailed ... - DeploymentStatusFailed DeploymentStatus = "Failed" - // DeploymentStatusNotStarted ... - DeploymentStatusNotStarted DeploymentStatus = "NotStarted" -) - -// PossibleDeploymentStatusValues returns an array of possible values for the DeploymentStatus const type. -func PossibleDeploymentStatusValues() []DeploymentStatus { - return []DeploymentStatus{DeploymentStatusDeployed, DeploymentStatusDeploying, DeploymentStatusFailed, DeploymentStatusNotStarted} -} - -// DestinationPortBehavior enumerates the values for destination port behavior. -type DestinationPortBehavior string - -const ( - // DestinationPortBehaviorListenIfAvailable ... - DestinationPortBehaviorListenIfAvailable DestinationPortBehavior = "ListenIfAvailable" - // DestinationPortBehaviorNone ... - DestinationPortBehaviorNone DestinationPortBehavior = "None" -) - -// PossibleDestinationPortBehaviorValues returns an array of possible values for the DestinationPortBehavior const type. -func PossibleDestinationPortBehaviorValues() []DestinationPortBehavior { - return []DestinationPortBehavior{DestinationPortBehaviorListenIfAvailable, DestinationPortBehaviorNone} -} - -// DhGroup enumerates the values for dh group. -type DhGroup string - -const ( - // DhGroupDHGroup1 ... - DhGroupDHGroup1 DhGroup = "DHGroup1" - // DhGroupDHGroup14 ... - DhGroupDHGroup14 DhGroup = "DHGroup14" - // DhGroupDHGroup2 ... - DhGroupDHGroup2 DhGroup = "DHGroup2" - // DhGroupDHGroup2048 ... - DhGroupDHGroup2048 DhGroup = "DHGroup2048" - // DhGroupDHGroup24 ... - DhGroupDHGroup24 DhGroup = "DHGroup24" - // DhGroupECP256 ... - DhGroupECP256 DhGroup = "ECP256" - // DhGroupECP384 ... - DhGroupECP384 DhGroup = "ECP384" - // DhGroupNone ... - DhGroupNone DhGroup = "None" -) - -// PossibleDhGroupValues returns an array of possible values for the DhGroup const type. -func PossibleDhGroupValues() []DhGroup { - return []DhGroup{DhGroupDHGroup1, DhGroupDHGroup14, DhGroupDHGroup2, DhGroupDHGroup2048, DhGroupDHGroup24, DhGroupECP256, DhGroupECP384, DhGroupNone} -} - -// Direction enumerates the values for direction. -type Direction string - -const ( - // DirectionInbound ... - DirectionInbound Direction = "Inbound" - // DirectionOutbound ... - DirectionOutbound Direction = "Outbound" -) - -// PossibleDirectionValues returns an array of possible values for the Direction const type. -func PossibleDirectionValues() []Direction { - return []Direction{DirectionInbound, DirectionOutbound} -} - -// EffectiveRouteSource enumerates the values for effective route source. -type EffectiveRouteSource string - -const ( - // EffectiveRouteSourceDefault ... - EffectiveRouteSourceDefault EffectiveRouteSource = "Default" - // EffectiveRouteSourceUnknown ... - EffectiveRouteSourceUnknown EffectiveRouteSource = "Unknown" - // EffectiveRouteSourceUser ... - EffectiveRouteSourceUser EffectiveRouteSource = "User" - // EffectiveRouteSourceVirtualNetworkGateway ... - EffectiveRouteSourceVirtualNetworkGateway EffectiveRouteSource = "VirtualNetworkGateway" -) - -// PossibleEffectiveRouteSourceValues returns an array of possible values for the EffectiveRouteSource const type. -func PossibleEffectiveRouteSourceValues() []EffectiveRouteSource { - return []EffectiveRouteSource{EffectiveRouteSourceDefault, EffectiveRouteSourceUnknown, EffectiveRouteSourceUser, EffectiveRouteSourceVirtualNetworkGateway} -} - -// EffectiveRouteState enumerates the values for effective route state. -type EffectiveRouteState string - -const ( - // EffectiveRouteStateActive ... - EffectiveRouteStateActive EffectiveRouteState = "Active" - // EffectiveRouteStateInvalid ... - EffectiveRouteStateInvalid EffectiveRouteState = "Invalid" -) - -// PossibleEffectiveRouteStateValues returns an array of possible values for the EffectiveRouteState const type. -func PossibleEffectiveRouteStateValues() []EffectiveRouteState { - return []EffectiveRouteState{EffectiveRouteStateActive, EffectiveRouteStateInvalid} -} - -// EffectiveSecurityRuleProtocol enumerates the values for effective security rule protocol. -type EffectiveSecurityRuleProtocol string - -const ( - // EffectiveSecurityRuleProtocolAll ... - EffectiveSecurityRuleProtocolAll EffectiveSecurityRuleProtocol = "All" - // EffectiveSecurityRuleProtocolTCP ... - EffectiveSecurityRuleProtocolTCP EffectiveSecurityRuleProtocol = "Tcp" - // EffectiveSecurityRuleProtocolUDP ... - EffectiveSecurityRuleProtocolUDP EffectiveSecurityRuleProtocol = "Udp" -) - -// PossibleEffectiveSecurityRuleProtocolValues returns an array of possible values for the EffectiveSecurityRuleProtocol const type. -func PossibleEffectiveSecurityRuleProtocolValues() []EffectiveSecurityRuleProtocol { - return []EffectiveSecurityRuleProtocol{EffectiveSecurityRuleProtocolAll, EffectiveSecurityRuleProtocolTCP, EffectiveSecurityRuleProtocolUDP} -} - -// EndpointType enumerates the values for endpoint type. -type EndpointType string - -const ( - // EndpointTypeAzureArcVM ... - EndpointTypeAzureArcVM EndpointType = "AzureArcVM" - // EndpointTypeAzureSubnet ... - EndpointTypeAzureSubnet EndpointType = "AzureSubnet" - // EndpointTypeAzureVM ... - EndpointTypeAzureVM EndpointType = "AzureVM" - // EndpointTypeAzureVMSS ... - EndpointTypeAzureVMSS EndpointType = "AzureVMSS" - // EndpointTypeAzureVNet ... - EndpointTypeAzureVNet EndpointType = "AzureVNet" - // EndpointTypeExternalAddress ... - EndpointTypeExternalAddress EndpointType = "ExternalAddress" - // EndpointTypeMMAWorkspaceMachine ... - EndpointTypeMMAWorkspaceMachine EndpointType = "MMAWorkspaceMachine" - // EndpointTypeMMAWorkspaceNetwork ... - EndpointTypeMMAWorkspaceNetwork EndpointType = "MMAWorkspaceNetwork" -) - -// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. -func PossibleEndpointTypeValues() []EndpointType { - return []EndpointType{EndpointTypeAzureArcVM, EndpointTypeAzureSubnet, EndpointTypeAzureVM, EndpointTypeAzureVMSS, EndpointTypeAzureVNet, EndpointTypeExternalAddress, EndpointTypeMMAWorkspaceMachine, EndpointTypeMMAWorkspaceNetwork} -} - -// EvaluationState enumerates the values for evaluation state. -type EvaluationState string - -const ( - // EvaluationStateCompleted ... - EvaluationStateCompleted EvaluationState = "Completed" - // EvaluationStateInProgress ... - EvaluationStateInProgress EvaluationState = "InProgress" - // EvaluationStateNotStarted ... - EvaluationStateNotStarted EvaluationState = "NotStarted" -) - -// PossibleEvaluationStateValues returns an array of possible values for the EvaluationState const type. -func PossibleEvaluationStateValues() []EvaluationState { - return []EvaluationState{EvaluationStateCompleted, EvaluationStateInProgress, EvaluationStateNotStarted} -} - -// ExpressRouteCircuitPeeringAdvertisedPublicPrefixState enumerates the values for express route circuit -// peering advertised public prefix state. -type ExpressRouteCircuitPeeringAdvertisedPublicPrefixState string - -const ( - // ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfigured ... - ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfigured ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "Configured" - // ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfiguring ... - ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfiguring ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "Configuring" - // ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateNotConfigured ... - ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateNotConfigured ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "NotConfigured" - // ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded ... - ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "ValidationNeeded" -) - -// PossibleExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValues returns an array of possible values for the ExpressRouteCircuitPeeringAdvertisedPublicPrefixState const type. -func PossibleExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValues() []ExpressRouteCircuitPeeringAdvertisedPublicPrefixState { - return []ExpressRouteCircuitPeeringAdvertisedPublicPrefixState{ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfigured, ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfiguring, ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateNotConfigured, ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded} -} - -// ExpressRouteCircuitPeeringState enumerates the values for express route circuit peering state. -type ExpressRouteCircuitPeeringState string - -const ( - // ExpressRouteCircuitPeeringStateDisabled ... - ExpressRouteCircuitPeeringStateDisabled ExpressRouteCircuitPeeringState = "Disabled" - // ExpressRouteCircuitPeeringStateEnabled ... - ExpressRouteCircuitPeeringStateEnabled ExpressRouteCircuitPeeringState = "Enabled" -) - -// PossibleExpressRouteCircuitPeeringStateValues returns an array of possible values for the ExpressRouteCircuitPeeringState const type. -func PossibleExpressRouteCircuitPeeringStateValues() []ExpressRouteCircuitPeeringState { - return []ExpressRouteCircuitPeeringState{ExpressRouteCircuitPeeringStateDisabled, ExpressRouteCircuitPeeringStateEnabled} -} - -// ExpressRouteCircuitSkuFamily enumerates the values for express route circuit sku family. -type ExpressRouteCircuitSkuFamily string - -const ( - // ExpressRouteCircuitSkuFamilyMeteredData ... - ExpressRouteCircuitSkuFamilyMeteredData ExpressRouteCircuitSkuFamily = "MeteredData" - // ExpressRouteCircuitSkuFamilyUnlimitedData ... - ExpressRouteCircuitSkuFamilyUnlimitedData ExpressRouteCircuitSkuFamily = "UnlimitedData" -) - -// PossibleExpressRouteCircuitSkuFamilyValues returns an array of possible values for the ExpressRouteCircuitSkuFamily const type. -func PossibleExpressRouteCircuitSkuFamilyValues() []ExpressRouteCircuitSkuFamily { - return []ExpressRouteCircuitSkuFamily{ExpressRouteCircuitSkuFamilyMeteredData, ExpressRouteCircuitSkuFamilyUnlimitedData} -} - -// ExpressRouteCircuitSkuTier enumerates the values for express route circuit sku tier. -type ExpressRouteCircuitSkuTier string - -const ( - // ExpressRouteCircuitSkuTierBasic ... - ExpressRouteCircuitSkuTierBasic ExpressRouteCircuitSkuTier = "Basic" - // ExpressRouteCircuitSkuTierLocal ... - ExpressRouteCircuitSkuTierLocal ExpressRouteCircuitSkuTier = "Local" - // ExpressRouteCircuitSkuTierPremium ... - ExpressRouteCircuitSkuTierPremium ExpressRouteCircuitSkuTier = "Premium" - // ExpressRouteCircuitSkuTierStandard ... - ExpressRouteCircuitSkuTierStandard ExpressRouteCircuitSkuTier = "Standard" -) - -// PossibleExpressRouteCircuitSkuTierValues returns an array of possible values for the ExpressRouteCircuitSkuTier const type. -func PossibleExpressRouteCircuitSkuTierValues() []ExpressRouteCircuitSkuTier { - return []ExpressRouteCircuitSkuTier{ExpressRouteCircuitSkuTierBasic, ExpressRouteCircuitSkuTierLocal, ExpressRouteCircuitSkuTierPremium, ExpressRouteCircuitSkuTierStandard} -} - -// ExpressRouteLinkAdminState enumerates the values for express route link admin state. -type ExpressRouteLinkAdminState string - -const ( - // ExpressRouteLinkAdminStateDisabled ... - ExpressRouteLinkAdminStateDisabled ExpressRouteLinkAdminState = "Disabled" - // ExpressRouteLinkAdminStateEnabled ... - ExpressRouteLinkAdminStateEnabled ExpressRouteLinkAdminState = "Enabled" -) - -// PossibleExpressRouteLinkAdminStateValues returns an array of possible values for the ExpressRouteLinkAdminState const type. -func PossibleExpressRouteLinkAdminStateValues() []ExpressRouteLinkAdminState { - return []ExpressRouteLinkAdminState{ExpressRouteLinkAdminStateDisabled, ExpressRouteLinkAdminStateEnabled} -} - -// ExpressRouteLinkConnectorType enumerates the values for express route link connector type. -type ExpressRouteLinkConnectorType string - -const ( - // ExpressRouteLinkConnectorTypeLC ... - ExpressRouteLinkConnectorTypeLC ExpressRouteLinkConnectorType = "LC" - // ExpressRouteLinkConnectorTypeSC ... - ExpressRouteLinkConnectorTypeSC ExpressRouteLinkConnectorType = "SC" -) - -// PossibleExpressRouteLinkConnectorTypeValues returns an array of possible values for the ExpressRouteLinkConnectorType const type. -func PossibleExpressRouteLinkConnectorTypeValues() []ExpressRouteLinkConnectorType { - return []ExpressRouteLinkConnectorType{ExpressRouteLinkConnectorTypeLC, ExpressRouteLinkConnectorTypeSC} -} - -// ExpressRouteLinkMacSecCipher enumerates the values for express route link mac sec cipher. -type ExpressRouteLinkMacSecCipher string - -const ( - // ExpressRouteLinkMacSecCipherGcmAes128 ... - ExpressRouteLinkMacSecCipherGcmAes128 ExpressRouteLinkMacSecCipher = "GcmAes128" - // ExpressRouteLinkMacSecCipherGcmAes256 ... - ExpressRouteLinkMacSecCipherGcmAes256 ExpressRouteLinkMacSecCipher = "GcmAes256" - // ExpressRouteLinkMacSecCipherGcmAesXpn128 ... - ExpressRouteLinkMacSecCipherGcmAesXpn128 ExpressRouteLinkMacSecCipher = "GcmAesXpn128" - // ExpressRouteLinkMacSecCipherGcmAesXpn256 ... - ExpressRouteLinkMacSecCipherGcmAesXpn256 ExpressRouteLinkMacSecCipher = "GcmAesXpn256" -) - -// PossibleExpressRouteLinkMacSecCipherValues returns an array of possible values for the ExpressRouteLinkMacSecCipher const type. -func PossibleExpressRouteLinkMacSecCipherValues() []ExpressRouteLinkMacSecCipher { - return []ExpressRouteLinkMacSecCipher{ExpressRouteLinkMacSecCipherGcmAes128, ExpressRouteLinkMacSecCipherGcmAes256, ExpressRouteLinkMacSecCipherGcmAesXpn128, ExpressRouteLinkMacSecCipherGcmAesXpn256} -} - -// ExpressRouteLinkMacSecSciState enumerates the values for express route link mac sec sci state. -type ExpressRouteLinkMacSecSciState string - -const ( - // ExpressRouteLinkMacSecSciStateDisabled ... - ExpressRouteLinkMacSecSciStateDisabled ExpressRouteLinkMacSecSciState = "Disabled" - // ExpressRouteLinkMacSecSciStateEnabled ... - ExpressRouteLinkMacSecSciStateEnabled ExpressRouteLinkMacSecSciState = "Enabled" -) - -// PossibleExpressRouteLinkMacSecSciStateValues returns an array of possible values for the ExpressRouteLinkMacSecSciState const type. -func PossibleExpressRouteLinkMacSecSciStateValues() []ExpressRouteLinkMacSecSciState { - return []ExpressRouteLinkMacSecSciState{ExpressRouteLinkMacSecSciStateDisabled, ExpressRouteLinkMacSecSciStateEnabled} -} - -// ExpressRoutePeeringState enumerates the values for express route peering state. -type ExpressRoutePeeringState string - -const ( - // ExpressRoutePeeringStateDisabled ... - ExpressRoutePeeringStateDisabled ExpressRoutePeeringState = "Disabled" - // ExpressRoutePeeringStateEnabled ... - ExpressRoutePeeringStateEnabled ExpressRoutePeeringState = "Enabled" -) - -// PossibleExpressRoutePeeringStateValues returns an array of possible values for the ExpressRoutePeeringState const type. -func PossibleExpressRoutePeeringStateValues() []ExpressRoutePeeringState { - return []ExpressRoutePeeringState{ExpressRoutePeeringStateDisabled, ExpressRoutePeeringStateEnabled} -} - -// ExpressRoutePeeringType enumerates the values for express route peering type. -type ExpressRoutePeeringType string - -const ( - // ExpressRoutePeeringTypeAzurePrivatePeering ... - ExpressRoutePeeringTypeAzurePrivatePeering ExpressRoutePeeringType = "AzurePrivatePeering" - // ExpressRoutePeeringTypeAzurePublicPeering ... - ExpressRoutePeeringTypeAzurePublicPeering ExpressRoutePeeringType = "AzurePublicPeering" - // ExpressRoutePeeringTypeMicrosoftPeering ... - ExpressRoutePeeringTypeMicrosoftPeering ExpressRoutePeeringType = "MicrosoftPeering" -) - -// PossibleExpressRoutePeeringTypeValues returns an array of possible values for the ExpressRoutePeeringType const type. -func PossibleExpressRoutePeeringTypeValues() []ExpressRoutePeeringType { - return []ExpressRoutePeeringType{ExpressRoutePeeringTypeAzurePrivatePeering, ExpressRoutePeeringTypeAzurePublicPeering, ExpressRoutePeeringTypeMicrosoftPeering} -} - -// ExpressRoutePortAuthorizationUseStatus enumerates the values for express route port authorization use -// status. -type ExpressRoutePortAuthorizationUseStatus string - -const ( - // ExpressRoutePortAuthorizationUseStatusAvailable ... - ExpressRoutePortAuthorizationUseStatusAvailable ExpressRoutePortAuthorizationUseStatus = "Available" - // ExpressRoutePortAuthorizationUseStatusInUse ... - ExpressRoutePortAuthorizationUseStatusInUse ExpressRoutePortAuthorizationUseStatus = "InUse" -) - -// PossibleExpressRoutePortAuthorizationUseStatusValues returns an array of possible values for the ExpressRoutePortAuthorizationUseStatus const type. -func PossibleExpressRoutePortAuthorizationUseStatusValues() []ExpressRoutePortAuthorizationUseStatus { - return []ExpressRoutePortAuthorizationUseStatus{ExpressRoutePortAuthorizationUseStatusAvailable, ExpressRoutePortAuthorizationUseStatusInUse} -} - -// ExpressRoutePortsBillingType enumerates the values for express route ports billing type. -type ExpressRoutePortsBillingType string - -const ( - // ExpressRoutePortsBillingTypeMeteredData ... - ExpressRoutePortsBillingTypeMeteredData ExpressRoutePortsBillingType = "MeteredData" - // ExpressRoutePortsBillingTypeUnlimitedData ... - ExpressRoutePortsBillingTypeUnlimitedData ExpressRoutePortsBillingType = "UnlimitedData" -) - -// PossibleExpressRoutePortsBillingTypeValues returns an array of possible values for the ExpressRoutePortsBillingType const type. -func PossibleExpressRoutePortsBillingTypeValues() []ExpressRoutePortsBillingType { - return []ExpressRoutePortsBillingType{ExpressRoutePortsBillingTypeMeteredData, ExpressRoutePortsBillingTypeUnlimitedData} -} - -// ExpressRoutePortsEncapsulation enumerates the values for express route ports encapsulation. -type ExpressRoutePortsEncapsulation string - -const ( - // ExpressRoutePortsEncapsulationDot1Q ... - ExpressRoutePortsEncapsulationDot1Q ExpressRoutePortsEncapsulation = "Dot1Q" - // ExpressRoutePortsEncapsulationQinQ ... - ExpressRoutePortsEncapsulationQinQ ExpressRoutePortsEncapsulation = "QinQ" -) - -// PossibleExpressRoutePortsEncapsulationValues returns an array of possible values for the ExpressRoutePortsEncapsulation const type. -func PossibleExpressRoutePortsEncapsulationValues() []ExpressRoutePortsEncapsulation { - return []ExpressRoutePortsEncapsulation{ExpressRoutePortsEncapsulationDot1Q, ExpressRoutePortsEncapsulationQinQ} -} - -// ExtendedLocationTypes enumerates the values for extended location types. -type ExtendedLocationTypes string - -const ( - // ExtendedLocationTypesEdgeZone ... - ExtendedLocationTypesEdgeZone ExtendedLocationTypes = "EdgeZone" -) - -// PossibleExtendedLocationTypesValues returns an array of possible values for the ExtendedLocationTypes const type. -func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { - return []ExtendedLocationTypes{ExtendedLocationTypesEdgeZone} -} - -// FirewallPolicyFilterRuleCollectionActionType enumerates the values for firewall policy filter rule -// collection action type. -type FirewallPolicyFilterRuleCollectionActionType string - -const ( - // FirewallPolicyFilterRuleCollectionActionTypeAllow ... - FirewallPolicyFilterRuleCollectionActionTypeAllow FirewallPolicyFilterRuleCollectionActionType = "Allow" - // FirewallPolicyFilterRuleCollectionActionTypeDeny ... - FirewallPolicyFilterRuleCollectionActionTypeDeny FirewallPolicyFilterRuleCollectionActionType = "Deny" -) - -// PossibleFirewallPolicyFilterRuleCollectionActionTypeValues returns an array of possible values for the FirewallPolicyFilterRuleCollectionActionType const type. -func PossibleFirewallPolicyFilterRuleCollectionActionTypeValues() []FirewallPolicyFilterRuleCollectionActionType { - return []FirewallPolicyFilterRuleCollectionActionType{FirewallPolicyFilterRuleCollectionActionTypeAllow, FirewallPolicyFilterRuleCollectionActionTypeDeny} -} - -// FirewallPolicyIDPSQuerySortOrder enumerates the values for firewall policy idps query sort order. -type FirewallPolicyIDPSQuerySortOrder string - -const ( - // FirewallPolicyIDPSQuerySortOrderAscending ... - FirewallPolicyIDPSQuerySortOrderAscending FirewallPolicyIDPSQuerySortOrder = "Ascending" - // FirewallPolicyIDPSQuerySortOrderDescending ... - FirewallPolicyIDPSQuerySortOrderDescending FirewallPolicyIDPSQuerySortOrder = "Descending" -) - -// PossibleFirewallPolicyIDPSQuerySortOrderValues returns an array of possible values for the FirewallPolicyIDPSQuerySortOrder const type. -func PossibleFirewallPolicyIDPSQuerySortOrderValues() []FirewallPolicyIDPSQuerySortOrder { - return []FirewallPolicyIDPSQuerySortOrder{FirewallPolicyIDPSQuerySortOrderAscending, FirewallPolicyIDPSQuerySortOrderDescending} -} - -// FirewallPolicyIntrusionDetectionProtocol enumerates the values for firewall policy intrusion detection -// protocol. -type FirewallPolicyIntrusionDetectionProtocol string - -const ( - // FirewallPolicyIntrusionDetectionProtocolANY ... - FirewallPolicyIntrusionDetectionProtocolANY FirewallPolicyIntrusionDetectionProtocol = "ANY" - // FirewallPolicyIntrusionDetectionProtocolICMP ... - FirewallPolicyIntrusionDetectionProtocolICMP FirewallPolicyIntrusionDetectionProtocol = "ICMP" - // FirewallPolicyIntrusionDetectionProtocolTCP ... - FirewallPolicyIntrusionDetectionProtocolTCP FirewallPolicyIntrusionDetectionProtocol = "TCP" - // FirewallPolicyIntrusionDetectionProtocolUDP ... - FirewallPolicyIntrusionDetectionProtocolUDP FirewallPolicyIntrusionDetectionProtocol = "UDP" -) - -// PossibleFirewallPolicyIntrusionDetectionProtocolValues returns an array of possible values for the FirewallPolicyIntrusionDetectionProtocol const type. -func PossibleFirewallPolicyIntrusionDetectionProtocolValues() []FirewallPolicyIntrusionDetectionProtocol { - return []FirewallPolicyIntrusionDetectionProtocol{FirewallPolicyIntrusionDetectionProtocolANY, FirewallPolicyIntrusionDetectionProtocolICMP, FirewallPolicyIntrusionDetectionProtocolTCP, FirewallPolicyIntrusionDetectionProtocolUDP} -} - -// FirewallPolicyIntrusionDetectionStateType enumerates the values for firewall policy intrusion detection -// state type. -type FirewallPolicyIntrusionDetectionStateType string - -const ( - // FirewallPolicyIntrusionDetectionStateTypeAlert ... - FirewallPolicyIntrusionDetectionStateTypeAlert FirewallPolicyIntrusionDetectionStateType = "Alert" - // FirewallPolicyIntrusionDetectionStateTypeDeny ... - FirewallPolicyIntrusionDetectionStateTypeDeny FirewallPolicyIntrusionDetectionStateType = "Deny" - // FirewallPolicyIntrusionDetectionStateTypeOff ... - FirewallPolicyIntrusionDetectionStateTypeOff FirewallPolicyIntrusionDetectionStateType = "Off" -) - -// PossibleFirewallPolicyIntrusionDetectionStateTypeValues returns an array of possible values for the FirewallPolicyIntrusionDetectionStateType const type. -func PossibleFirewallPolicyIntrusionDetectionStateTypeValues() []FirewallPolicyIntrusionDetectionStateType { - return []FirewallPolicyIntrusionDetectionStateType{FirewallPolicyIntrusionDetectionStateTypeAlert, FirewallPolicyIntrusionDetectionStateTypeDeny, FirewallPolicyIntrusionDetectionStateTypeOff} -} - -// FirewallPolicyNatRuleCollectionActionType enumerates the values for firewall policy nat rule collection -// action type. -type FirewallPolicyNatRuleCollectionActionType string - -const ( - // FirewallPolicyNatRuleCollectionActionTypeDNAT ... - FirewallPolicyNatRuleCollectionActionTypeDNAT FirewallPolicyNatRuleCollectionActionType = "DNAT" -) - -// PossibleFirewallPolicyNatRuleCollectionActionTypeValues returns an array of possible values for the FirewallPolicyNatRuleCollectionActionType const type. -func PossibleFirewallPolicyNatRuleCollectionActionTypeValues() []FirewallPolicyNatRuleCollectionActionType { - return []FirewallPolicyNatRuleCollectionActionType{FirewallPolicyNatRuleCollectionActionTypeDNAT} -} - -// FirewallPolicyRuleApplicationProtocolType enumerates the values for firewall policy rule application -// protocol type. -type FirewallPolicyRuleApplicationProtocolType string - -const ( - // FirewallPolicyRuleApplicationProtocolTypeHTTP ... - FirewallPolicyRuleApplicationProtocolTypeHTTP FirewallPolicyRuleApplicationProtocolType = "Http" - // FirewallPolicyRuleApplicationProtocolTypeHTTPS ... - FirewallPolicyRuleApplicationProtocolTypeHTTPS FirewallPolicyRuleApplicationProtocolType = "Https" -) - -// PossibleFirewallPolicyRuleApplicationProtocolTypeValues returns an array of possible values for the FirewallPolicyRuleApplicationProtocolType const type. -func PossibleFirewallPolicyRuleApplicationProtocolTypeValues() []FirewallPolicyRuleApplicationProtocolType { - return []FirewallPolicyRuleApplicationProtocolType{FirewallPolicyRuleApplicationProtocolTypeHTTP, FirewallPolicyRuleApplicationProtocolTypeHTTPS} -} - -// FirewallPolicyRuleNetworkProtocol enumerates the values for firewall policy rule network protocol. -type FirewallPolicyRuleNetworkProtocol string - -const ( - // FirewallPolicyRuleNetworkProtocolAny ... - FirewallPolicyRuleNetworkProtocolAny FirewallPolicyRuleNetworkProtocol = "Any" - // FirewallPolicyRuleNetworkProtocolICMP ... - FirewallPolicyRuleNetworkProtocolICMP FirewallPolicyRuleNetworkProtocol = "ICMP" - // FirewallPolicyRuleNetworkProtocolTCP ... - FirewallPolicyRuleNetworkProtocolTCP FirewallPolicyRuleNetworkProtocol = "TCP" - // FirewallPolicyRuleNetworkProtocolUDP ... - FirewallPolicyRuleNetworkProtocolUDP FirewallPolicyRuleNetworkProtocol = "UDP" -) - -// PossibleFirewallPolicyRuleNetworkProtocolValues returns an array of possible values for the FirewallPolicyRuleNetworkProtocol const type. -func PossibleFirewallPolicyRuleNetworkProtocolValues() []FirewallPolicyRuleNetworkProtocol { - return []FirewallPolicyRuleNetworkProtocol{FirewallPolicyRuleNetworkProtocolAny, FirewallPolicyRuleNetworkProtocolICMP, FirewallPolicyRuleNetworkProtocolTCP, FirewallPolicyRuleNetworkProtocolUDP} -} - -// FirewallPolicySkuTier enumerates the values for firewall policy sku tier. -type FirewallPolicySkuTier string - -const ( - // FirewallPolicySkuTierBasic ... - FirewallPolicySkuTierBasic FirewallPolicySkuTier = "Basic" - // FirewallPolicySkuTierPremium ... - FirewallPolicySkuTierPremium FirewallPolicySkuTier = "Premium" - // FirewallPolicySkuTierStandard ... - FirewallPolicySkuTierStandard FirewallPolicySkuTier = "Standard" -) - -// PossibleFirewallPolicySkuTierValues returns an array of possible values for the FirewallPolicySkuTier const type. -func PossibleFirewallPolicySkuTierValues() []FirewallPolicySkuTier { - return []FirewallPolicySkuTier{FirewallPolicySkuTierBasic, FirewallPolicySkuTierPremium, FirewallPolicySkuTierStandard} -} - -// FlowLogFormatType enumerates the values for flow log format type. -type FlowLogFormatType string - -const ( - // FlowLogFormatTypeJSON ... - FlowLogFormatTypeJSON FlowLogFormatType = "JSON" -) - -// PossibleFlowLogFormatTypeValues returns an array of possible values for the FlowLogFormatType const type. -func PossibleFlowLogFormatTypeValues() []FlowLogFormatType { - return []FlowLogFormatType{FlowLogFormatTypeJSON} -} - -// GatewayLoadBalancerTunnelInterfaceType enumerates the values for gateway load balancer tunnel interface -// type. -type GatewayLoadBalancerTunnelInterfaceType string - -const ( - // GatewayLoadBalancerTunnelInterfaceTypeExternal ... - GatewayLoadBalancerTunnelInterfaceTypeExternal GatewayLoadBalancerTunnelInterfaceType = "External" - // GatewayLoadBalancerTunnelInterfaceTypeInternal ... - GatewayLoadBalancerTunnelInterfaceTypeInternal GatewayLoadBalancerTunnelInterfaceType = "Internal" - // GatewayLoadBalancerTunnelInterfaceTypeNone ... - GatewayLoadBalancerTunnelInterfaceTypeNone GatewayLoadBalancerTunnelInterfaceType = "None" -) - -// PossibleGatewayLoadBalancerTunnelInterfaceTypeValues returns an array of possible values for the GatewayLoadBalancerTunnelInterfaceType const type. -func PossibleGatewayLoadBalancerTunnelInterfaceTypeValues() []GatewayLoadBalancerTunnelInterfaceType { - return []GatewayLoadBalancerTunnelInterfaceType{GatewayLoadBalancerTunnelInterfaceTypeExternal, GatewayLoadBalancerTunnelInterfaceTypeInternal, GatewayLoadBalancerTunnelInterfaceTypeNone} -} - -// GatewayLoadBalancerTunnelProtocol enumerates the values for gateway load balancer tunnel protocol. -type GatewayLoadBalancerTunnelProtocol string - -const ( - // GatewayLoadBalancerTunnelProtocolNative ... - GatewayLoadBalancerTunnelProtocolNative GatewayLoadBalancerTunnelProtocol = "Native" - // GatewayLoadBalancerTunnelProtocolNone ... - GatewayLoadBalancerTunnelProtocolNone GatewayLoadBalancerTunnelProtocol = "None" - // GatewayLoadBalancerTunnelProtocolVXLAN ... - GatewayLoadBalancerTunnelProtocolVXLAN GatewayLoadBalancerTunnelProtocol = "VXLAN" -) - -// PossibleGatewayLoadBalancerTunnelProtocolValues returns an array of possible values for the GatewayLoadBalancerTunnelProtocol const type. -func PossibleGatewayLoadBalancerTunnelProtocolValues() []GatewayLoadBalancerTunnelProtocol { - return []GatewayLoadBalancerTunnelProtocol{GatewayLoadBalancerTunnelProtocolNative, GatewayLoadBalancerTunnelProtocolNone, GatewayLoadBalancerTunnelProtocolVXLAN} -} - -// Geo enumerates the values for geo. -type Geo string - -const ( - // GeoAFRI ... - GeoAFRI Geo = "AFRI" - // GeoAPAC ... - GeoAPAC Geo = "APAC" - // GeoAQ ... - GeoAQ Geo = "AQ" - // GeoEURO ... - GeoEURO Geo = "EURO" - // GeoGLOBAL ... - GeoGLOBAL Geo = "GLOBAL" - // GeoLATAM ... - GeoLATAM Geo = "LATAM" - // GeoME ... - GeoME Geo = "ME" - // GeoNAM ... - GeoNAM Geo = "NAM" - // GeoOCEANIA ... - GeoOCEANIA Geo = "OCEANIA" -) - -// PossibleGeoValues returns an array of possible values for the Geo const type. -func PossibleGeoValues() []Geo { - return []Geo{GeoAFRI, GeoAPAC, GeoAQ, GeoEURO, GeoGLOBAL, GeoLATAM, GeoME, GeoNAM, GeoOCEANIA} -} - -// GroupConnectivity enumerates the values for group connectivity. -type GroupConnectivity string - -const ( - // GroupConnectivityDirectlyConnected ... - GroupConnectivityDirectlyConnected GroupConnectivity = "DirectlyConnected" - // GroupConnectivityNone ... - GroupConnectivityNone GroupConnectivity = "None" -) - -// PossibleGroupConnectivityValues returns an array of possible values for the GroupConnectivity const type. -func PossibleGroupConnectivityValues() []GroupConnectivity { - return []GroupConnectivity{GroupConnectivityDirectlyConnected, GroupConnectivityNone} -} - -// HTTPConfigurationMethod enumerates the values for http configuration method. -type HTTPConfigurationMethod string - -const ( - // HTTPConfigurationMethodGet ... - HTTPConfigurationMethodGet HTTPConfigurationMethod = "Get" - // HTTPConfigurationMethodPost ... - HTTPConfigurationMethodPost HTTPConfigurationMethod = "Post" -) - -// PossibleHTTPConfigurationMethodValues returns an array of possible values for the HTTPConfigurationMethod const type. -func PossibleHTTPConfigurationMethodValues() []HTTPConfigurationMethod { - return []HTTPConfigurationMethod{HTTPConfigurationMethodGet, HTTPConfigurationMethodPost} -} - -// HTTPMethod enumerates the values for http method. -type HTTPMethod string - -const ( - // HTTPMethodGet ... - HTTPMethodGet HTTPMethod = "Get" -) - -// PossibleHTTPMethodValues returns an array of possible values for the HTTPMethod const type. -func PossibleHTTPMethodValues() []HTTPMethod { - return []HTTPMethod{HTTPMethodGet} -} - -// HubBgpConnectionStatus enumerates the values for hub bgp connection status. -type HubBgpConnectionStatus string - -const ( - // HubBgpConnectionStatusConnected ... - HubBgpConnectionStatusConnected HubBgpConnectionStatus = "Connected" - // HubBgpConnectionStatusConnecting ... - HubBgpConnectionStatusConnecting HubBgpConnectionStatus = "Connecting" - // HubBgpConnectionStatusNotConnected ... - HubBgpConnectionStatusNotConnected HubBgpConnectionStatus = "NotConnected" - // HubBgpConnectionStatusUnknown ... - HubBgpConnectionStatusUnknown HubBgpConnectionStatus = "Unknown" -) - -// PossibleHubBgpConnectionStatusValues returns an array of possible values for the HubBgpConnectionStatus const type. -func PossibleHubBgpConnectionStatusValues() []HubBgpConnectionStatus { - return []HubBgpConnectionStatus{HubBgpConnectionStatusConnected, HubBgpConnectionStatusConnecting, HubBgpConnectionStatusNotConnected, HubBgpConnectionStatusUnknown} -} - -// HubRoutingPreference enumerates the values for hub routing preference. -type HubRoutingPreference string - -const ( - // HubRoutingPreferenceASPath ... - HubRoutingPreferenceASPath HubRoutingPreference = "ASPath" - // HubRoutingPreferenceExpressRoute ... - HubRoutingPreferenceExpressRoute HubRoutingPreference = "ExpressRoute" - // HubRoutingPreferenceVpnGateway ... - HubRoutingPreferenceVpnGateway HubRoutingPreference = "VpnGateway" -) - -// PossibleHubRoutingPreferenceValues returns an array of possible values for the HubRoutingPreference const type. -func PossibleHubRoutingPreferenceValues() []HubRoutingPreference { - return []HubRoutingPreference{HubRoutingPreferenceASPath, HubRoutingPreferenceExpressRoute, HubRoutingPreferenceVpnGateway} -} - -// HubVirtualNetworkConnectionStatus enumerates the values for hub virtual network connection status. -type HubVirtualNetworkConnectionStatus string - -const ( - // HubVirtualNetworkConnectionStatusConnected ... - HubVirtualNetworkConnectionStatusConnected HubVirtualNetworkConnectionStatus = "Connected" - // HubVirtualNetworkConnectionStatusConnecting ... - HubVirtualNetworkConnectionStatusConnecting HubVirtualNetworkConnectionStatus = "Connecting" - // HubVirtualNetworkConnectionStatusNotConnected ... - HubVirtualNetworkConnectionStatusNotConnected HubVirtualNetworkConnectionStatus = "NotConnected" - // HubVirtualNetworkConnectionStatusUnknown ... - HubVirtualNetworkConnectionStatusUnknown HubVirtualNetworkConnectionStatus = "Unknown" -) - -// PossibleHubVirtualNetworkConnectionStatusValues returns an array of possible values for the HubVirtualNetworkConnectionStatus const type. -func PossibleHubVirtualNetworkConnectionStatusValues() []HubVirtualNetworkConnectionStatus { - return []HubVirtualNetworkConnectionStatus{HubVirtualNetworkConnectionStatusConnected, HubVirtualNetworkConnectionStatusConnecting, HubVirtualNetworkConnectionStatusNotConnected, HubVirtualNetworkConnectionStatusUnknown} -} - -// IPAllocationMethod enumerates the values for ip allocation method. -type IPAllocationMethod string - -const ( - // IPAllocationMethodDynamic ... - IPAllocationMethodDynamic IPAllocationMethod = "Dynamic" - // IPAllocationMethodStatic ... - IPAllocationMethodStatic IPAllocationMethod = "Static" -) - -// PossibleIPAllocationMethodValues returns an array of possible values for the IPAllocationMethod const type. -func PossibleIPAllocationMethodValues() []IPAllocationMethod { - return []IPAllocationMethod{IPAllocationMethodDynamic, IPAllocationMethodStatic} -} - -// IPAllocationType enumerates the values for ip allocation type. -type IPAllocationType string - -const ( - // IPAllocationTypeHypernet ... - IPAllocationTypeHypernet IPAllocationType = "Hypernet" - // IPAllocationTypeUndefined ... - IPAllocationTypeUndefined IPAllocationType = "Undefined" -) - -// PossibleIPAllocationTypeValues returns an array of possible values for the IPAllocationType const type. -func PossibleIPAllocationTypeValues() []IPAllocationType { - return []IPAllocationType{IPAllocationTypeHypernet, IPAllocationTypeUndefined} -} - -// IPFlowProtocol enumerates the values for ip flow protocol. -type IPFlowProtocol string - -const ( - // IPFlowProtocolTCP ... - IPFlowProtocolTCP IPFlowProtocol = "TCP" - // IPFlowProtocolUDP ... - IPFlowProtocolUDP IPFlowProtocol = "UDP" -) - -// PossibleIPFlowProtocolValues returns an array of possible values for the IPFlowProtocol const type. -func PossibleIPFlowProtocolValues() []IPFlowProtocol { - return []IPFlowProtocol{IPFlowProtocolTCP, IPFlowProtocolUDP} -} - -// IPVersion enumerates the values for ip version. -type IPVersion string - -const ( - // IPVersionIPv4 ... - IPVersionIPv4 IPVersion = "IPv4" - // IPVersionIPv6 ... - IPVersionIPv6 IPVersion = "IPv6" -) - -// PossibleIPVersionValues returns an array of possible values for the IPVersion const type. -func PossibleIPVersionValues() []IPVersion { - return []IPVersion{IPVersionIPv4, IPVersionIPv6} -} - -// IkeEncryption enumerates the values for ike encryption. -type IkeEncryption string - -const ( - // IkeEncryptionAES128 ... - IkeEncryptionAES128 IkeEncryption = "AES128" - // IkeEncryptionAES192 ... - IkeEncryptionAES192 IkeEncryption = "AES192" - // IkeEncryptionAES256 ... - IkeEncryptionAES256 IkeEncryption = "AES256" - // IkeEncryptionDES ... - IkeEncryptionDES IkeEncryption = "DES" - // IkeEncryptionDES3 ... - IkeEncryptionDES3 IkeEncryption = "DES3" - // IkeEncryptionGCMAES128 ... - IkeEncryptionGCMAES128 IkeEncryption = "GCMAES128" - // IkeEncryptionGCMAES256 ... - IkeEncryptionGCMAES256 IkeEncryption = "GCMAES256" -) - -// PossibleIkeEncryptionValues returns an array of possible values for the IkeEncryption const type. -func PossibleIkeEncryptionValues() []IkeEncryption { - return []IkeEncryption{IkeEncryptionAES128, IkeEncryptionAES192, IkeEncryptionAES256, IkeEncryptionDES, IkeEncryptionDES3, IkeEncryptionGCMAES128, IkeEncryptionGCMAES256} -} - -// IkeIntegrity enumerates the values for ike integrity. -type IkeIntegrity string - -const ( - // IkeIntegrityGCMAES128 ... - IkeIntegrityGCMAES128 IkeIntegrity = "GCMAES128" - // IkeIntegrityGCMAES256 ... - IkeIntegrityGCMAES256 IkeIntegrity = "GCMAES256" - // IkeIntegrityMD5 ... - IkeIntegrityMD5 IkeIntegrity = "MD5" - // IkeIntegritySHA1 ... - IkeIntegritySHA1 IkeIntegrity = "SHA1" - // IkeIntegritySHA256 ... - IkeIntegritySHA256 IkeIntegrity = "SHA256" - // IkeIntegritySHA384 ... - IkeIntegritySHA384 IkeIntegrity = "SHA384" -) - -// PossibleIkeIntegrityValues returns an array of possible values for the IkeIntegrity const type. -func PossibleIkeIntegrityValues() []IkeIntegrity { - return []IkeIntegrity{IkeIntegrityGCMAES128, IkeIntegrityGCMAES256, IkeIntegrityMD5, IkeIntegritySHA1, IkeIntegritySHA256, IkeIntegritySHA384} -} - -// InboundSecurityRulesProtocol enumerates the values for inbound security rules protocol. -type InboundSecurityRulesProtocol string - -const ( - // InboundSecurityRulesProtocolTCP ... - InboundSecurityRulesProtocolTCP InboundSecurityRulesProtocol = "TCP" - // InboundSecurityRulesProtocolUDP ... - InboundSecurityRulesProtocolUDP InboundSecurityRulesProtocol = "UDP" -) - -// PossibleInboundSecurityRulesProtocolValues returns an array of possible values for the InboundSecurityRulesProtocol const type. -func PossibleInboundSecurityRulesProtocolValues() []InboundSecurityRulesProtocol { - return []InboundSecurityRulesProtocol{InboundSecurityRulesProtocolTCP, InboundSecurityRulesProtocolUDP} -} - -// IntentPolicyBasedService enumerates the values for intent policy based service. -type IntentPolicyBasedService string - -const ( - // IntentPolicyBasedServiceAll ... - IntentPolicyBasedServiceAll IntentPolicyBasedService = "All" - // IntentPolicyBasedServiceAllowRulesOnly ... - IntentPolicyBasedServiceAllowRulesOnly IntentPolicyBasedService = "AllowRulesOnly" - // IntentPolicyBasedServiceNone ... - IntentPolicyBasedServiceNone IntentPolicyBasedService = "None" -) - -// PossibleIntentPolicyBasedServiceValues returns an array of possible values for the IntentPolicyBasedService const type. -func PossibleIntentPolicyBasedServiceValues() []IntentPolicyBasedService { - return []IntentPolicyBasedService{IntentPolicyBasedServiceAll, IntentPolicyBasedServiceAllowRulesOnly, IntentPolicyBasedServiceNone} -} - -// InterfaceAuxiliaryMode enumerates the values for interface auxiliary mode. -type InterfaceAuxiliaryMode string - -const ( - // InterfaceAuxiliaryModeFloating ... - InterfaceAuxiliaryModeFloating InterfaceAuxiliaryMode = "Floating" - // InterfaceAuxiliaryModeMaxConnections ... - InterfaceAuxiliaryModeMaxConnections InterfaceAuxiliaryMode = "MaxConnections" - // InterfaceAuxiliaryModeNone ... - InterfaceAuxiliaryModeNone InterfaceAuxiliaryMode = "None" -) - -// PossibleInterfaceAuxiliaryModeValues returns an array of possible values for the InterfaceAuxiliaryMode const type. -func PossibleInterfaceAuxiliaryModeValues() []InterfaceAuxiliaryMode { - return []InterfaceAuxiliaryMode{InterfaceAuxiliaryModeFloating, InterfaceAuxiliaryModeMaxConnections, InterfaceAuxiliaryModeNone} -} - -// InterfaceMigrationPhase enumerates the values for interface migration phase. -type InterfaceMigrationPhase string - -const ( - // InterfaceMigrationPhaseAbort ... - InterfaceMigrationPhaseAbort InterfaceMigrationPhase = "Abort" - // InterfaceMigrationPhaseCommit ... - InterfaceMigrationPhaseCommit InterfaceMigrationPhase = "Commit" - // InterfaceMigrationPhaseCommitted ... - InterfaceMigrationPhaseCommitted InterfaceMigrationPhase = "Committed" - // InterfaceMigrationPhaseNone ... - InterfaceMigrationPhaseNone InterfaceMigrationPhase = "None" - // InterfaceMigrationPhasePrepare ... - InterfaceMigrationPhasePrepare InterfaceMigrationPhase = "Prepare" -) - -// PossibleInterfaceMigrationPhaseValues returns an array of possible values for the InterfaceMigrationPhase const type. -func PossibleInterfaceMigrationPhaseValues() []InterfaceMigrationPhase { - return []InterfaceMigrationPhase{InterfaceMigrationPhaseAbort, InterfaceMigrationPhaseCommit, InterfaceMigrationPhaseCommitted, InterfaceMigrationPhaseNone, InterfaceMigrationPhasePrepare} -} - -// InterfaceNicType enumerates the values for interface nic type. -type InterfaceNicType string - -const ( - // InterfaceNicTypeElastic ... - InterfaceNicTypeElastic InterfaceNicType = "Elastic" - // InterfaceNicTypeStandard ... - InterfaceNicTypeStandard InterfaceNicType = "Standard" -) - -// PossibleInterfaceNicTypeValues returns an array of possible values for the InterfaceNicType const type. -func PossibleInterfaceNicTypeValues() []InterfaceNicType { - return []InterfaceNicType{InterfaceNicTypeElastic, InterfaceNicTypeStandard} -} - -// IpsecEncryption enumerates the values for ipsec encryption. -type IpsecEncryption string - -const ( - // IpsecEncryptionAES128 ... - IpsecEncryptionAES128 IpsecEncryption = "AES128" - // IpsecEncryptionAES192 ... - IpsecEncryptionAES192 IpsecEncryption = "AES192" - // IpsecEncryptionAES256 ... - IpsecEncryptionAES256 IpsecEncryption = "AES256" - // IpsecEncryptionDES ... - IpsecEncryptionDES IpsecEncryption = "DES" - // IpsecEncryptionDES3 ... - IpsecEncryptionDES3 IpsecEncryption = "DES3" - // IpsecEncryptionGCMAES128 ... - IpsecEncryptionGCMAES128 IpsecEncryption = "GCMAES128" - // IpsecEncryptionGCMAES192 ... - IpsecEncryptionGCMAES192 IpsecEncryption = "GCMAES192" - // IpsecEncryptionGCMAES256 ... - IpsecEncryptionGCMAES256 IpsecEncryption = "GCMAES256" - // IpsecEncryptionNone ... - IpsecEncryptionNone IpsecEncryption = "None" -) - -// PossibleIpsecEncryptionValues returns an array of possible values for the IpsecEncryption const type. -func PossibleIpsecEncryptionValues() []IpsecEncryption { - return []IpsecEncryption{IpsecEncryptionAES128, IpsecEncryptionAES192, IpsecEncryptionAES256, IpsecEncryptionDES, IpsecEncryptionDES3, IpsecEncryptionGCMAES128, IpsecEncryptionGCMAES192, IpsecEncryptionGCMAES256, IpsecEncryptionNone} -} - -// IpsecIntegrity enumerates the values for ipsec integrity. -type IpsecIntegrity string - -const ( - // IpsecIntegrityGCMAES128 ... - IpsecIntegrityGCMAES128 IpsecIntegrity = "GCMAES128" - // IpsecIntegrityGCMAES192 ... - IpsecIntegrityGCMAES192 IpsecIntegrity = "GCMAES192" - // IpsecIntegrityGCMAES256 ... - IpsecIntegrityGCMAES256 IpsecIntegrity = "GCMAES256" - // IpsecIntegrityMD5 ... - IpsecIntegrityMD5 IpsecIntegrity = "MD5" - // IpsecIntegritySHA1 ... - IpsecIntegritySHA1 IpsecIntegrity = "SHA1" - // IpsecIntegritySHA256 ... - IpsecIntegritySHA256 IpsecIntegrity = "SHA256" -) - -// PossibleIpsecIntegrityValues returns an array of possible values for the IpsecIntegrity const type. -func PossibleIpsecIntegrityValues() []IpsecIntegrity { - return []IpsecIntegrity{IpsecIntegrityGCMAES128, IpsecIntegrityGCMAES192, IpsecIntegrityGCMAES256, IpsecIntegrityMD5, IpsecIntegritySHA1, IpsecIntegritySHA256} -} - -// IsGlobal enumerates the values for is global. -type IsGlobal string - -const ( - // IsGlobalFalse ... - IsGlobalFalse IsGlobal = "False" - // IsGlobalTrue ... - IsGlobalTrue IsGlobal = "True" -) - -// PossibleIsGlobalValues returns an array of possible values for the IsGlobal const type. -func PossibleIsGlobalValues() []IsGlobal { - return []IsGlobal{IsGlobalFalse, IsGlobalTrue} -} - -// IsWorkloadProtected enumerates the values for is workload protected. -type IsWorkloadProtected string - -const ( - // IsWorkloadProtectedFalse ... - IsWorkloadProtectedFalse IsWorkloadProtected = "False" - // IsWorkloadProtectedTrue ... - IsWorkloadProtectedTrue IsWorkloadProtected = "True" -) - -// PossibleIsWorkloadProtectedValues returns an array of possible values for the IsWorkloadProtected const type. -func PossibleIsWorkloadProtectedValues() []IsWorkloadProtected { - return []IsWorkloadProtected{IsWorkloadProtectedFalse, IsWorkloadProtectedTrue} -} - -// IssueType enumerates the values for issue type. -type IssueType string - -const ( - // IssueTypeAgentStopped ... - IssueTypeAgentStopped IssueType = "AgentStopped" - // IssueTypeDNSResolution ... - IssueTypeDNSResolution IssueType = "DnsResolution" - // IssueTypeGuestFirewall ... - IssueTypeGuestFirewall IssueType = "GuestFirewall" - // IssueTypeNetworkSecurityRule ... - IssueTypeNetworkSecurityRule IssueType = "NetworkSecurityRule" - // IssueTypePlatform ... - IssueTypePlatform IssueType = "Platform" - // IssueTypePortThrottled ... - IssueTypePortThrottled IssueType = "PortThrottled" - // IssueTypeSocketBind ... - IssueTypeSocketBind IssueType = "SocketBind" - // IssueTypeUnknown ... - IssueTypeUnknown IssueType = "Unknown" - // IssueTypeUserDefinedRoute ... - IssueTypeUserDefinedRoute IssueType = "UserDefinedRoute" -) - -// PossibleIssueTypeValues returns an array of possible values for the IssueType const type. -func PossibleIssueTypeValues() []IssueType { - return []IssueType{IssueTypeAgentStopped, IssueTypeDNSResolution, IssueTypeGuestFirewall, IssueTypeNetworkSecurityRule, IssueTypePlatform, IssueTypePortThrottled, IssueTypeSocketBind, IssueTypeUnknown, IssueTypeUserDefinedRoute} -} - -// Kind enumerates the values for kind. -type Kind string - -const ( - // KindActiveBaseSecurityAdminRule ... - KindActiveBaseSecurityAdminRule Kind = "ActiveBaseSecurityAdminRule" - // KindCustom ... - KindCustom Kind = "Custom" - // KindDefault ... - KindDefault Kind = "Default" -) - -// PossibleKindValues returns an array of possible values for the Kind const type. -func PossibleKindValues() []Kind { - return []Kind{KindActiveBaseSecurityAdminRule, KindCustom, KindDefault} -} - -// KindBasicBaseAdminRule enumerates the values for kind basic base admin rule. -type KindBasicBaseAdminRule string - -const ( - // KindBasicBaseAdminRuleKindBaseAdminRule ... - KindBasicBaseAdminRuleKindBaseAdminRule KindBasicBaseAdminRule = "BaseAdminRule" - // KindBasicBaseAdminRuleKindCustom ... - KindBasicBaseAdminRuleKindCustom KindBasicBaseAdminRule = "Custom" - // KindBasicBaseAdminRuleKindDefault ... - KindBasicBaseAdminRuleKindDefault KindBasicBaseAdminRule = "Default" -) - -// PossibleKindBasicBaseAdminRuleValues returns an array of possible values for the KindBasicBaseAdminRule const type. -func PossibleKindBasicBaseAdminRuleValues() []KindBasicBaseAdminRule { - return []KindBasicBaseAdminRule{KindBasicBaseAdminRuleKindBaseAdminRule, KindBasicBaseAdminRuleKindCustom, KindBasicBaseAdminRuleKindDefault} -} - -// KindBasicEffectiveBaseSecurityAdminRule enumerates the values for kind basic effective base security admin -// rule. -type KindBasicEffectiveBaseSecurityAdminRule string - -const ( - // KindBasicEffectiveBaseSecurityAdminRuleKindCustom ... - KindBasicEffectiveBaseSecurityAdminRuleKindCustom KindBasicEffectiveBaseSecurityAdminRule = "Custom" - // KindBasicEffectiveBaseSecurityAdminRuleKindDefault ... - KindBasicEffectiveBaseSecurityAdminRuleKindDefault KindBasicEffectiveBaseSecurityAdminRule = "Default" - // KindBasicEffectiveBaseSecurityAdminRuleKindEffectiveBaseSecurityAdminRule ... - KindBasicEffectiveBaseSecurityAdminRuleKindEffectiveBaseSecurityAdminRule KindBasicEffectiveBaseSecurityAdminRule = "EffectiveBaseSecurityAdminRule" -) - -// PossibleKindBasicEffectiveBaseSecurityAdminRuleValues returns an array of possible values for the KindBasicEffectiveBaseSecurityAdminRule const type. -func PossibleKindBasicEffectiveBaseSecurityAdminRuleValues() []KindBasicEffectiveBaseSecurityAdminRule { - return []KindBasicEffectiveBaseSecurityAdminRule{KindBasicEffectiveBaseSecurityAdminRuleKindCustom, KindBasicEffectiveBaseSecurityAdminRuleKindDefault, KindBasicEffectiveBaseSecurityAdminRuleKindEffectiveBaseSecurityAdminRule} -} - -// LoadBalancerBackendAddressAdminState enumerates the values for load balancer backend address admin state. -type LoadBalancerBackendAddressAdminState string - -const ( - // LoadBalancerBackendAddressAdminStateDown ... - LoadBalancerBackendAddressAdminStateDown LoadBalancerBackendAddressAdminState = "Down" - // LoadBalancerBackendAddressAdminStateDrain ... - LoadBalancerBackendAddressAdminStateDrain LoadBalancerBackendAddressAdminState = "Drain" - // LoadBalancerBackendAddressAdminStateNone ... - LoadBalancerBackendAddressAdminStateNone LoadBalancerBackendAddressAdminState = "None" - // LoadBalancerBackendAddressAdminStateUp ... - LoadBalancerBackendAddressAdminStateUp LoadBalancerBackendAddressAdminState = "Up" -) - -// PossibleLoadBalancerBackendAddressAdminStateValues returns an array of possible values for the LoadBalancerBackendAddressAdminState const type. -func PossibleLoadBalancerBackendAddressAdminStateValues() []LoadBalancerBackendAddressAdminState { - return []LoadBalancerBackendAddressAdminState{LoadBalancerBackendAddressAdminStateDown, LoadBalancerBackendAddressAdminStateDrain, LoadBalancerBackendAddressAdminStateNone, LoadBalancerBackendAddressAdminStateUp} -} - -// LoadBalancerOutboundRuleProtocol enumerates the values for load balancer outbound rule protocol. -type LoadBalancerOutboundRuleProtocol string - -const ( - // LoadBalancerOutboundRuleProtocolAll ... - LoadBalancerOutboundRuleProtocolAll LoadBalancerOutboundRuleProtocol = "All" - // LoadBalancerOutboundRuleProtocolTCP ... - LoadBalancerOutboundRuleProtocolTCP LoadBalancerOutboundRuleProtocol = "Tcp" - // LoadBalancerOutboundRuleProtocolUDP ... - LoadBalancerOutboundRuleProtocolUDP LoadBalancerOutboundRuleProtocol = "Udp" -) - -// PossibleLoadBalancerOutboundRuleProtocolValues returns an array of possible values for the LoadBalancerOutboundRuleProtocol const type. -func PossibleLoadBalancerOutboundRuleProtocolValues() []LoadBalancerOutboundRuleProtocol { - return []LoadBalancerOutboundRuleProtocol{LoadBalancerOutboundRuleProtocolAll, LoadBalancerOutboundRuleProtocolTCP, LoadBalancerOutboundRuleProtocolUDP} -} - -// LoadBalancerSkuName enumerates the values for load balancer sku name. -type LoadBalancerSkuName string - -const ( - // LoadBalancerSkuNameBasic ... - LoadBalancerSkuNameBasic LoadBalancerSkuName = "Basic" - // LoadBalancerSkuNameGateway ... - LoadBalancerSkuNameGateway LoadBalancerSkuName = "Gateway" - // LoadBalancerSkuNameStandard ... - LoadBalancerSkuNameStandard LoadBalancerSkuName = "Standard" -) - -// PossibleLoadBalancerSkuNameValues returns an array of possible values for the LoadBalancerSkuName const type. -func PossibleLoadBalancerSkuNameValues() []LoadBalancerSkuName { - return []LoadBalancerSkuName{LoadBalancerSkuNameBasic, LoadBalancerSkuNameGateway, LoadBalancerSkuNameStandard} -} - -// LoadBalancerSkuTier enumerates the values for load balancer sku tier. -type LoadBalancerSkuTier string - -const ( - // LoadBalancerSkuTierGlobal ... - LoadBalancerSkuTierGlobal LoadBalancerSkuTier = "Global" - // LoadBalancerSkuTierRegional ... - LoadBalancerSkuTierRegional LoadBalancerSkuTier = "Regional" -) - -// PossibleLoadBalancerSkuTierValues returns an array of possible values for the LoadBalancerSkuTier const type. -func PossibleLoadBalancerSkuTierValues() []LoadBalancerSkuTier { - return []LoadBalancerSkuTier{LoadBalancerSkuTierGlobal, LoadBalancerSkuTierRegional} -} - -// LoadDistribution enumerates the values for load distribution. -type LoadDistribution string - -const ( - // LoadDistributionDefault ... - LoadDistributionDefault LoadDistribution = "Default" - // LoadDistributionSourceIP ... - LoadDistributionSourceIP LoadDistribution = "SourceIP" - // LoadDistributionSourceIPProtocol ... - LoadDistributionSourceIPProtocol LoadDistribution = "SourceIPProtocol" -) - -// PossibleLoadDistributionValues returns an array of possible values for the LoadDistribution const type. -func PossibleLoadDistributionValues() []LoadDistribution { - return []LoadDistribution{LoadDistributionDefault, LoadDistributionSourceIP, LoadDistributionSourceIPProtocol} -} - -// ManagedRuleEnabledState enumerates the values for managed rule enabled state. -type ManagedRuleEnabledState string - -const ( - // ManagedRuleEnabledStateDisabled ... - ManagedRuleEnabledStateDisabled ManagedRuleEnabledState = "Disabled" - // ManagedRuleEnabledStateEnabled ... - ManagedRuleEnabledStateEnabled ManagedRuleEnabledState = "Enabled" -) - -// PossibleManagedRuleEnabledStateValues returns an array of possible values for the ManagedRuleEnabledState const type. -func PossibleManagedRuleEnabledStateValues() []ManagedRuleEnabledState { - return []ManagedRuleEnabledState{ManagedRuleEnabledStateDisabled, ManagedRuleEnabledStateEnabled} -} - -// NatGatewaySkuName enumerates the values for nat gateway sku name. -type NatGatewaySkuName string - -const ( - // NatGatewaySkuNameStandard ... - NatGatewaySkuNameStandard NatGatewaySkuName = "Standard" -) - -// PossibleNatGatewaySkuNameValues returns an array of possible values for the NatGatewaySkuName const type. -func PossibleNatGatewaySkuNameValues() []NatGatewaySkuName { - return []NatGatewaySkuName{NatGatewaySkuNameStandard} -} - -// NextHopType enumerates the values for next hop type. -type NextHopType string - -const ( - // NextHopTypeHyperNetGateway ... - NextHopTypeHyperNetGateway NextHopType = "HyperNetGateway" - // NextHopTypeInternet ... - NextHopTypeInternet NextHopType = "Internet" - // NextHopTypeNone ... - NextHopTypeNone NextHopType = "None" - // NextHopTypeVirtualAppliance ... - NextHopTypeVirtualAppliance NextHopType = "VirtualAppliance" - // NextHopTypeVirtualNetworkGateway ... - NextHopTypeVirtualNetworkGateway NextHopType = "VirtualNetworkGateway" - // NextHopTypeVnetLocal ... - NextHopTypeVnetLocal NextHopType = "VnetLocal" -) - -// PossibleNextHopTypeValues returns an array of possible values for the NextHopType const type. -func PossibleNextHopTypeValues() []NextHopType { - return []NextHopType{NextHopTypeHyperNetGateway, NextHopTypeInternet, NextHopTypeNone, NextHopTypeVirtualAppliance, NextHopTypeVirtualNetworkGateway, NextHopTypeVnetLocal} -} - -// NextStep enumerates the values for next step. -type NextStep string - -const ( - // NextStepContinue ... - NextStepContinue NextStep = "Continue" - // NextStepTerminate ... - NextStepTerminate NextStep = "Terminate" - // NextStepUnknown ... - NextStepUnknown NextStep = "Unknown" -) - -// PossibleNextStepValues returns an array of possible values for the NextStep const type. -func PossibleNextStepValues() []NextStep { - return []NextStep{NextStepContinue, NextStepTerminate, NextStepUnknown} -} - -// OfficeTrafficCategory enumerates the values for office traffic category. -type OfficeTrafficCategory string - -const ( - // OfficeTrafficCategoryAll ... - OfficeTrafficCategoryAll OfficeTrafficCategory = "All" - // OfficeTrafficCategoryNone ... - OfficeTrafficCategoryNone OfficeTrafficCategory = "None" - // OfficeTrafficCategoryOptimize ... - OfficeTrafficCategoryOptimize OfficeTrafficCategory = "Optimize" - // OfficeTrafficCategoryOptimizeAndAllow ... - OfficeTrafficCategoryOptimizeAndAllow OfficeTrafficCategory = "OptimizeAndAllow" -) - -// PossibleOfficeTrafficCategoryValues returns an array of possible values for the OfficeTrafficCategory const type. -func PossibleOfficeTrafficCategoryValues() []OfficeTrafficCategory { - return []OfficeTrafficCategory{OfficeTrafficCategoryAll, OfficeTrafficCategoryNone, OfficeTrafficCategoryOptimize, OfficeTrafficCategoryOptimizeAndAllow} -} - -// OperationStatus enumerates the values for operation status. -type OperationStatus string - -const ( - // OperationStatusFailed ... - OperationStatusFailed OperationStatus = "Failed" - // OperationStatusInProgress ... - OperationStatusInProgress OperationStatus = "InProgress" - // OperationStatusSucceeded ... - OperationStatusSucceeded OperationStatus = "Succeeded" -) - -// PossibleOperationStatusValues returns an array of possible values for the OperationStatus const type. -func PossibleOperationStatusValues() []OperationStatus { - return []OperationStatus{OperationStatusFailed, OperationStatusInProgress, OperationStatusSucceeded} -} - -// Origin enumerates the values for origin. -type Origin string - -const ( - // OriginInbound ... - OriginInbound Origin = "Inbound" - // OriginLocal ... - OriginLocal Origin = "Local" - // OriginOutbound ... - OriginOutbound Origin = "Outbound" -) - -// PossibleOriginValues returns an array of possible values for the Origin const type. -func PossibleOriginValues() []Origin { - return []Origin{OriginInbound, OriginLocal, OriginOutbound} -} - -// OutputType enumerates the values for output type. -type OutputType string - -const ( - // OutputTypeWorkspace ... - OutputTypeWorkspace OutputType = "Workspace" -) - -// PossibleOutputTypeValues returns an array of possible values for the OutputType const type. -func PossibleOutputTypeValues() []OutputType { - return []OutputType{OutputTypeWorkspace} -} - -// OwaspCrsExclusionEntryMatchVariable enumerates the values for owasp crs exclusion entry match variable. -type OwaspCrsExclusionEntryMatchVariable string - -const ( - // OwaspCrsExclusionEntryMatchVariableRequestArgKeys ... - OwaspCrsExclusionEntryMatchVariableRequestArgKeys OwaspCrsExclusionEntryMatchVariable = "RequestArgKeys" - // OwaspCrsExclusionEntryMatchVariableRequestArgNames ... - OwaspCrsExclusionEntryMatchVariableRequestArgNames OwaspCrsExclusionEntryMatchVariable = "RequestArgNames" - // OwaspCrsExclusionEntryMatchVariableRequestArgValues ... - OwaspCrsExclusionEntryMatchVariableRequestArgValues OwaspCrsExclusionEntryMatchVariable = "RequestArgValues" - // OwaspCrsExclusionEntryMatchVariableRequestCookieKeys ... - OwaspCrsExclusionEntryMatchVariableRequestCookieKeys OwaspCrsExclusionEntryMatchVariable = "RequestCookieKeys" - // OwaspCrsExclusionEntryMatchVariableRequestCookieNames ... - OwaspCrsExclusionEntryMatchVariableRequestCookieNames OwaspCrsExclusionEntryMatchVariable = "RequestCookieNames" - // OwaspCrsExclusionEntryMatchVariableRequestCookieValues ... - OwaspCrsExclusionEntryMatchVariableRequestCookieValues OwaspCrsExclusionEntryMatchVariable = "RequestCookieValues" - // OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys ... - OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys OwaspCrsExclusionEntryMatchVariable = "RequestHeaderKeys" - // OwaspCrsExclusionEntryMatchVariableRequestHeaderNames ... - OwaspCrsExclusionEntryMatchVariableRequestHeaderNames OwaspCrsExclusionEntryMatchVariable = "RequestHeaderNames" - // OwaspCrsExclusionEntryMatchVariableRequestHeaderValues ... - OwaspCrsExclusionEntryMatchVariableRequestHeaderValues OwaspCrsExclusionEntryMatchVariable = "RequestHeaderValues" -) - -// PossibleOwaspCrsExclusionEntryMatchVariableValues returns an array of possible values for the OwaspCrsExclusionEntryMatchVariable const type. -func PossibleOwaspCrsExclusionEntryMatchVariableValues() []OwaspCrsExclusionEntryMatchVariable { - return []OwaspCrsExclusionEntryMatchVariable{OwaspCrsExclusionEntryMatchVariableRequestArgKeys, OwaspCrsExclusionEntryMatchVariableRequestArgNames, OwaspCrsExclusionEntryMatchVariableRequestArgValues, OwaspCrsExclusionEntryMatchVariableRequestCookieKeys, OwaspCrsExclusionEntryMatchVariableRequestCookieNames, OwaspCrsExclusionEntryMatchVariableRequestCookieValues, OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys, OwaspCrsExclusionEntryMatchVariableRequestHeaderNames, OwaspCrsExclusionEntryMatchVariableRequestHeaderValues} -} - -// OwaspCrsExclusionEntrySelectorMatchOperator enumerates the values for owasp crs exclusion entry selector -// match operator. -type OwaspCrsExclusionEntrySelectorMatchOperator string - -const ( - // OwaspCrsExclusionEntrySelectorMatchOperatorContains ... - OwaspCrsExclusionEntrySelectorMatchOperatorContains OwaspCrsExclusionEntrySelectorMatchOperator = "Contains" - // OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith ... - OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith OwaspCrsExclusionEntrySelectorMatchOperator = "EndsWith" - // OwaspCrsExclusionEntrySelectorMatchOperatorEquals ... - OwaspCrsExclusionEntrySelectorMatchOperatorEquals OwaspCrsExclusionEntrySelectorMatchOperator = "Equals" - // OwaspCrsExclusionEntrySelectorMatchOperatorEqualsAny ... - OwaspCrsExclusionEntrySelectorMatchOperatorEqualsAny OwaspCrsExclusionEntrySelectorMatchOperator = "EqualsAny" - // OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith ... - OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith OwaspCrsExclusionEntrySelectorMatchOperator = "StartsWith" -) - -// PossibleOwaspCrsExclusionEntrySelectorMatchOperatorValues returns an array of possible values for the OwaspCrsExclusionEntrySelectorMatchOperator const type. -func PossibleOwaspCrsExclusionEntrySelectorMatchOperatorValues() []OwaspCrsExclusionEntrySelectorMatchOperator { - return []OwaspCrsExclusionEntrySelectorMatchOperator{OwaspCrsExclusionEntrySelectorMatchOperatorContains, OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith, OwaspCrsExclusionEntrySelectorMatchOperatorEquals, OwaspCrsExclusionEntrySelectorMatchOperatorEqualsAny, OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith} -} - -// PacketCaptureTargetType enumerates the values for packet capture target type. -type PacketCaptureTargetType string - -const ( - // PacketCaptureTargetTypeAzureVM ... - PacketCaptureTargetTypeAzureVM PacketCaptureTargetType = "AzureVM" - // PacketCaptureTargetTypeAzureVMSS ... - PacketCaptureTargetTypeAzureVMSS PacketCaptureTargetType = "AzureVMSS" -) - -// PossiblePacketCaptureTargetTypeValues returns an array of possible values for the PacketCaptureTargetType const type. -func PossiblePacketCaptureTargetTypeValues() []PacketCaptureTargetType { - return []PacketCaptureTargetType{PacketCaptureTargetTypeAzureVM, PacketCaptureTargetTypeAzureVMSS} -} - -// PcError enumerates the values for pc error. -type PcError string - -const ( - // PcErrorAgentStopped ... - PcErrorAgentStopped PcError = "AgentStopped" - // PcErrorCaptureFailed ... - PcErrorCaptureFailed PcError = "CaptureFailed" - // PcErrorInternalError ... - PcErrorInternalError PcError = "InternalError" - // PcErrorLocalFileFailed ... - PcErrorLocalFileFailed PcError = "LocalFileFailed" - // PcErrorStorageFailed ... - PcErrorStorageFailed PcError = "StorageFailed" -) - -// PossiblePcErrorValues returns an array of possible values for the PcError const type. -func PossiblePcErrorValues() []PcError { - return []PcError{PcErrorAgentStopped, PcErrorCaptureFailed, PcErrorInternalError, PcErrorLocalFileFailed, PcErrorStorageFailed} -} - -// PcProtocol enumerates the values for pc protocol. -type PcProtocol string - -const ( - // PcProtocolAny ... - PcProtocolAny PcProtocol = "Any" - // PcProtocolTCP ... - PcProtocolTCP PcProtocol = "TCP" - // PcProtocolUDP ... - PcProtocolUDP PcProtocol = "UDP" -) - -// PossiblePcProtocolValues returns an array of possible values for the PcProtocol const type. -func PossiblePcProtocolValues() []PcProtocol { - return []PcProtocol{PcProtocolAny, PcProtocolTCP, PcProtocolUDP} -} - -// PcStatus enumerates the values for pc status. -type PcStatus string - -const ( - // PcStatusError ... - PcStatusError PcStatus = "Error" - // PcStatusNotStarted ... - PcStatusNotStarted PcStatus = "NotStarted" - // PcStatusRunning ... - PcStatusRunning PcStatus = "Running" - // PcStatusStopped ... - PcStatusStopped PcStatus = "Stopped" - // PcStatusUnknown ... - PcStatusUnknown PcStatus = "Unknown" -) - -// PossiblePcStatusValues returns an array of possible values for the PcStatus const type. -func PossiblePcStatusValues() []PcStatus { - return []PcStatus{PcStatusError, PcStatusNotStarted, PcStatusRunning, PcStatusStopped, PcStatusUnknown} -} - -// PfsGroup enumerates the values for pfs group. -type PfsGroup string - -const ( - // PfsGroupECP256 ... - PfsGroupECP256 PfsGroup = "ECP256" - // PfsGroupECP384 ... - PfsGroupECP384 PfsGroup = "ECP384" - // PfsGroupNone ... - PfsGroupNone PfsGroup = "None" - // PfsGroupPFS1 ... - PfsGroupPFS1 PfsGroup = "PFS1" - // PfsGroupPFS14 ... - PfsGroupPFS14 PfsGroup = "PFS14" - // PfsGroupPFS2 ... - PfsGroupPFS2 PfsGroup = "PFS2" - // PfsGroupPFS2048 ... - PfsGroupPFS2048 PfsGroup = "PFS2048" - // PfsGroupPFS24 ... - PfsGroupPFS24 PfsGroup = "PFS24" - // PfsGroupPFSMM ... - PfsGroupPFSMM PfsGroup = "PFSMM" -) - -// PossiblePfsGroupValues returns an array of possible values for the PfsGroup const type. -func PossiblePfsGroupValues() []PfsGroup { - return []PfsGroup{PfsGroupECP256, PfsGroupECP384, PfsGroupNone, PfsGroupPFS1, PfsGroupPFS14, PfsGroupPFS2, PfsGroupPFS2048, PfsGroupPFS24, PfsGroupPFSMM} -} - -// PreferredIPVersion enumerates the values for preferred ip version. -type PreferredIPVersion string - -const ( - // PreferredIPVersionIPv4 ... - PreferredIPVersionIPv4 PreferredIPVersion = "IPv4" - // PreferredIPVersionIPv6 ... - PreferredIPVersionIPv6 PreferredIPVersion = "IPv6" -) - -// PossiblePreferredIPVersionValues returns an array of possible values for the PreferredIPVersion const type. -func PossiblePreferredIPVersionValues() []PreferredIPVersion { - return []PreferredIPVersion{PreferredIPVersionIPv4, PreferredIPVersionIPv6} -} - -// PreferredRoutingGateway enumerates the values for preferred routing gateway. -type PreferredRoutingGateway string - -const ( - // PreferredRoutingGatewayExpressRoute ... - PreferredRoutingGatewayExpressRoute PreferredRoutingGateway = "ExpressRoute" - // PreferredRoutingGatewayNone ... - PreferredRoutingGatewayNone PreferredRoutingGateway = "None" - // PreferredRoutingGatewayVpnGateway ... - PreferredRoutingGatewayVpnGateway PreferredRoutingGateway = "VpnGateway" -) - -// PossiblePreferredRoutingGatewayValues returns an array of possible values for the PreferredRoutingGateway const type. -func PossiblePreferredRoutingGatewayValues() []PreferredRoutingGateway { - return []PreferredRoutingGateway{PreferredRoutingGatewayExpressRoute, PreferredRoutingGatewayNone, PreferredRoutingGatewayVpnGateway} -} - -// ProbeProtocol enumerates the values for probe protocol. -type ProbeProtocol string - -const ( - // ProbeProtocolHTTP ... - ProbeProtocolHTTP ProbeProtocol = "Http" - // ProbeProtocolHTTPS ... - ProbeProtocolHTTPS ProbeProtocol = "Https" - // ProbeProtocolTCP ... - ProbeProtocolTCP ProbeProtocol = "Tcp" -) - -// PossibleProbeProtocolValues returns an array of possible values for the ProbeProtocol const type. -func PossibleProbeProtocolValues() []ProbeProtocol { - return []ProbeProtocol{ProbeProtocolHTTP, ProbeProtocolHTTPS, ProbeProtocolTCP} -} - -// ProcessorArchitecture enumerates the values for processor architecture. -type ProcessorArchitecture string - -const ( - // ProcessorArchitectureAmd64 ... - ProcessorArchitectureAmd64 ProcessorArchitecture = "Amd64" - // ProcessorArchitectureX86 ... - ProcessorArchitectureX86 ProcessorArchitecture = "X86" -) - -// PossibleProcessorArchitectureValues returns an array of possible values for the ProcessorArchitecture const type. -func PossibleProcessorArchitectureValues() []ProcessorArchitecture { - return []ProcessorArchitecture{ProcessorArchitectureAmd64, ProcessorArchitectureX86} -} - -// Protocol enumerates the values for protocol. -type Protocol string - -const ( - // ProtocolHTTP ... - ProtocolHTTP Protocol = "Http" - // ProtocolHTTPS ... - ProtocolHTTPS Protocol = "Https" - // ProtocolIcmp ... - ProtocolIcmp Protocol = "Icmp" - // ProtocolTCP ... - ProtocolTCP Protocol = "Tcp" -) - -// PossibleProtocolValues returns an array of possible values for the Protocol const type. -func PossibleProtocolValues() []Protocol { - return []Protocol{ProtocolHTTP, ProtocolHTTPS, ProtocolIcmp, ProtocolTCP} -} - -// ProtocolType enumerates the values for protocol type. -type ProtocolType string - -const ( - // ProtocolTypeAh ... - ProtocolTypeAh ProtocolType = "Ah" - // ProtocolTypeAll ... - ProtocolTypeAll ProtocolType = "All" - // ProtocolTypeDoNotUse ... - ProtocolTypeDoNotUse ProtocolType = "DoNotUse" - // ProtocolTypeEsp ... - ProtocolTypeEsp ProtocolType = "Esp" - // ProtocolTypeGre ... - ProtocolTypeGre ProtocolType = "Gre" - // ProtocolTypeIcmp ... - ProtocolTypeIcmp ProtocolType = "Icmp" - // ProtocolTypeTCP ... - ProtocolTypeTCP ProtocolType = "Tcp" - // ProtocolTypeUDP ... - ProtocolTypeUDP ProtocolType = "Udp" - // ProtocolTypeVxlan ... - ProtocolTypeVxlan ProtocolType = "Vxlan" -) - -// PossibleProtocolTypeValues returns an array of possible values for the ProtocolType const type. -func PossibleProtocolTypeValues() []ProtocolType { - return []ProtocolType{ProtocolTypeAh, ProtocolTypeAll, ProtocolTypeDoNotUse, ProtocolTypeEsp, ProtocolTypeGre, ProtocolTypeIcmp, ProtocolTypeTCP, ProtocolTypeUDP, ProtocolTypeVxlan} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating ... - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} -} - -// PublicIPAddressMigrationPhase enumerates the values for public ip address migration phase. -type PublicIPAddressMigrationPhase string - -const ( - // PublicIPAddressMigrationPhaseAbort ... - PublicIPAddressMigrationPhaseAbort PublicIPAddressMigrationPhase = "Abort" - // PublicIPAddressMigrationPhaseCommit ... - PublicIPAddressMigrationPhaseCommit PublicIPAddressMigrationPhase = "Commit" - // PublicIPAddressMigrationPhaseCommitted ... - PublicIPAddressMigrationPhaseCommitted PublicIPAddressMigrationPhase = "Committed" - // PublicIPAddressMigrationPhaseNone ... - PublicIPAddressMigrationPhaseNone PublicIPAddressMigrationPhase = "None" - // PublicIPAddressMigrationPhasePrepare ... - PublicIPAddressMigrationPhasePrepare PublicIPAddressMigrationPhase = "Prepare" -) - -// PossiblePublicIPAddressMigrationPhaseValues returns an array of possible values for the PublicIPAddressMigrationPhase const type. -func PossiblePublicIPAddressMigrationPhaseValues() []PublicIPAddressMigrationPhase { - return []PublicIPAddressMigrationPhase{PublicIPAddressMigrationPhaseAbort, PublicIPAddressMigrationPhaseCommit, PublicIPAddressMigrationPhaseCommitted, PublicIPAddressMigrationPhaseNone, PublicIPAddressMigrationPhasePrepare} -} - -// PublicIPAddressSkuName enumerates the values for public ip address sku name. -type PublicIPAddressSkuName string - -const ( - // PublicIPAddressSkuNameBasic ... - PublicIPAddressSkuNameBasic PublicIPAddressSkuName = "Basic" - // PublicIPAddressSkuNameStandard ... - PublicIPAddressSkuNameStandard PublicIPAddressSkuName = "Standard" -) - -// PossiblePublicIPAddressSkuNameValues returns an array of possible values for the PublicIPAddressSkuName const type. -func PossiblePublicIPAddressSkuNameValues() []PublicIPAddressSkuName { - return []PublicIPAddressSkuName{PublicIPAddressSkuNameBasic, PublicIPAddressSkuNameStandard} -} - -// PublicIPAddressSkuTier enumerates the values for public ip address sku tier. -type PublicIPAddressSkuTier string - -const ( - // PublicIPAddressSkuTierGlobal ... - PublicIPAddressSkuTierGlobal PublicIPAddressSkuTier = "Global" - // PublicIPAddressSkuTierRegional ... - PublicIPAddressSkuTierRegional PublicIPAddressSkuTier = "Regional" -) - -// PossiblePublicIPAddressSkuTierValues returns an array of possible values for the PublicIPAddressSkuTier const type. -func PossiblePublicIPAddressSkuTierValues() []PublicIPAddressSkuTier { - return []PublicIPAddressSkuTier{PublicIPAddressSkuTierGlobal, PublicIPAddressSkuTierRegional} -} - -// PublicIPPrefixSkuName enumerates the values for public ip prefix sku name. -type PublicIPPrefixSkuName string - -const ( - // PublicIPPrefixSkuNameStandard ... - PublicIPPrefixSkuNameStandard PublicIPPrefixSkuName = "Standard" -) - -// PossiblePublicIPPrefixSkuNameValues returns an array of possible values for the PublicIPPrefixSkuName const type. -func PossiblePublicIPPrefixSkuNameValues() []PublicIPPrefixSkuName { - return []PublicIPPrefixSkuName{PublicIPPrefixSkuNameStandard} -} - -// PublicIPPrefixSkuTier enumerates the values for public ip prefix sku tier. -type PublicIPPrefixSkuTier string - -const ( - // PublicIPPrefixSkuTierGlobal ... - PublicIPPrefixSkuTierGlobal PublicIPPrefixSkuTier = "Global" - // PublicIPPrefixSkuTierRegional ... - PublicIPPrefixSkuTierRegional PublicIPPrefixSkuTier = "Regional" -) - -// PossiblePublicIPPrefixSkuTierValues returns an array of possible values for the PublicIPPrefixSkuTier const type. -func PossiblePublicIPPrefixSkuTierValues() []PublicIPPrefixSkuTier { - return []PublicIPPrefixSkuTier{PublicIPPrefixSkuTierGlobal, PublicIPPrefixSkuTierRegional} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone ... - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeSystemAssignedUserAssigned ... - ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" - // ResourceIdentityTypeUserAssigned ... - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} -} - -// RouteMapActionType enumerates the values for route map action type. -type RouteMapActionType string - -const ( - // RouteMapActionTypeAdd ... - RouteMapActionTypeAdd RouteMapActionType = "Add" - // RouteMapActionTypeDrop ... - RouteMapActionTypeDrop RouteMapActionType = "Drop" - // RouteMapActionTypeRemove ... - RouteMapActionTypeRemove RouteMapActionType = "Remove" - // RouteMapActionTypeReplace ... - RouteMapActionTypeReplace RouteMapActionType = "Replace" - // RouteMapActionTypeUnknown ... - RouteMapActionTypeUnknown RouteMapActionType = "Unknown" -) - -// PossibleRouteMapActionTypeValues returns an array of possible values for the RouteMapActionType const type. -func PossibleRouteMapActionTypeValues() []RouteMapActionType { - return []RouteMapActionType{RouteMapActionTypeAdd, RouteMapActionTypeDrop, RouteMapActionTypeRemove, RouteMapActionTypeReplace, RouteMapActionTypeUnknown} -} - -// RouteMapMatchCondition enumerates the values for route map match condition. -type RouteMapMatchCondition string - -const ( - // RouteMapMatchConditionContains ... - RouteMapMatchConditionContains RouteMapMatchCondition = "Contains" - // RouteMapMatchConditionEquals ... - RouteMapMatchConditionEquals RouteMapMatchCondition = "Equals" - // RouteMapMatchConditionNotContains ... - RouteMapMatchConditionNotContains RouteMapMatchCondition = "NotContains" - // RouteMapMatchConditionNotEquals ... - RouteMapMatchConditionNotEquals RouteMapMatchCondition = "NotEquals" - // RouteMapMatchConditionUnknown ... - RouteMapMatchConditionUnknown RouteMapMatchCondition = "Unknown" -) - -// PossibleRouteMapMatchConditionValues returns an array of possible values for the RouteMapMatchCondition const type. -func PossibleRouteMapMatchConditionValues() []RouteMapMatchCondition { - return []RouteMapMatchCondition{RouteMapMatchConditionContains, RouteMapMatchConditionEquals, RouteMapMatchConditionNotContains, RouteMapMatchConditionNotEquals, RouteMapMatchConditionUnknown} -} - -// RouteNextHopType enumerates the values for route next hop type. -type RouteNextHopType string - -const ( - // RouteNextHopTypeInternet ... - RouteNextHopTypeInternet RouteNextHopType = "Internet" - // RouteNextHopTypeNone ... - RouteNextHopTypeNone RouteNextHopType = "None" - // RouteNextHopTypeVirtualAppliance ... - RouteNextHopTypeVirtualAppliance RouteNextHopType = "VirtualAppliance" - // RouteNextHopTypeVirtualNetworkGateway ... - RouteNextHopTypeVirtualNetworkGateway RouteNextHopType = "VirtualNetworkGateway" - // RouteNextHopTypeVnetLocal ... - RouteNextHopTypeVnetLocal RouteNextHopType = "VnetLocal" -) - -// PossibleRouteNextHopTypeValues returns an array of possible values for the RouteNextHopType const type. -func PossibleRouteNextHopTypeValues() []RouteNextHopType { - return []RouteNextHopType{RouteNextHopTypeInternet, RouteNextHopTypeNone, RouteNextHopTypeVirtualAppliance, RouteNextHopTypeVirtualNetworkGateway, RouteNextHopTypeVnetLocal} -} - -// RoutingState enumerates the values for routing state. -type RoutingState string - -const ( - // RoutingStateFailed ... - RoutingStateFailed RoutingState = "Failed" - // RoutingStateNone ... - RoutingStateNone RoutingState = "None" - // RoutingStateProvisioned ... - RoutingStateProvisioned RoutingState = "Provisioned" - // RoutingStateProvisioning ... - RoutingStateProvisioning RoutingState = "Provisioning" -) - -// PossibleRoutingStateValues returns an array of possible values for the RoutingState const type. -func PossibleRoutingStateValues() []RoutingState { - return []RoutingState{RoutingStateFailed, RoutingStateNone, RoutingStateProvisioned, RoutingStateProvisioning} -} - -// RuleCollectionType enumerates the values for rule collection type. -type RuleCollectionType string - -const ( - // RuleCollectionTypeFirewallPolicyFilterRuleCollection ... - RuleCollectionTypeFirewallPolicyFilterRuleCollection RuleCollectionType = "FirewallPolicyFilterRuleCollection" - // RuleCollectionTypeFirewallPolicyNatRuleCollection ... - RuleCollectionTypeFirewallPolicyNatRuleCollection RuleCollectionType = "FirewallPolicyNatRuleCollection" - // RuleCollectionTypeFirewallPolicyRuleCollection ... - RuleCollectionTypeFirewallPolicyRuleCollection RuleCollectionType = "FirewallPolicyRuleCollection" -) - -// PossibleRuleCollectionTypeValues returns an array of possible values for the RuleCollectionType const type. -func PossibleRuleCollectionTypeValues() []RuleCollectionType { - return []RuleCollectionType{RuleCollectionTypeFirewallPolicyFilterRuleCollection, RuleCollectionTypeFirewallPolicyNatRuleCollection, RuleCollectionTypeFirewallPolicyRuleCollection} -} - -// RuleType enumerates the values for rule type. -type RuleType string - -const ( - // RuleTypeApplicationRule ... - RuleTypeApplicationRule RuleType = "ApplicationRule" - // RuleTypeFirewallPolicyRule ... - RuleTypeFirewallPolicyRule RuleType = "FirewallPolicyRule" - // RuleTypeNatRule ... - RuleTypeNatRule RuleType = "NatRule" - // RuleTypeNetworkRule ... - RuleTypeNetworkRule RuleType = "NetworkRule" -) - -// PossibleRuleTypeValues returns an array of possible values for the RuleType const type. -func PossibleRuleTypeValues() []RuleType { - return []RuleType{RuleTypeApplicationRule, RuleTypeFirewallPolicyRule, RuleTypeNatRule, RuleTypeNetworkRule} -} - -// ScopeConnectionState enumerates the values for scope connection state. -type ScopeConnectionState string - -const ( - // ScopeConnectionStateConflict ... - ScopeConnectionStateConflict ScopeConnectionState = "Conflict" - // ScopeConnectionStateConnected ... - ScopeConnectionStateConnected ScopeConnectionState = "Connected" - // ScopeConnectionStatePending ... - ScopeConnectionStatePending ScopeConnectionState = "Pending" - // ScopeConnectionStateRejected ... - ScopeConnectionStateRejected ScopeConnectionState = "Rejected" - // ScopeConnectionStateRevoked ... - ScopeConnectionStateRevoked ScopeConnectionState = "Revoked" -) - -// PossibleScopeConnectionStateValues returns an array of possible values for the ScopeConnectionState const type. -func PossibleScopeConnectionStateValues() []ScopeConnectionState { - return []ScopeConnectionState{ScopeConnectionStateConflict, ScopeConnectionStateConnected, ScopeConnectionStatePending, ScopeConnectionStateRejected, ScopeConnectionStateRevoked} -} - -// SecurityConfigurationRuleAccess enumerates the values for security configuration rule access. -type SecurityConfigurationRuleAccess string - -const ( - // SecurityConfigurationRuleAccessAllow ... - SecurityConfigurationRuleAccessAllow SecurityConfigurationRuleAccess = "Allow" - // SecurityConfigurationRuleAccessAlwaysAllow ... - SecurityConfigurationRuleAccessAlwaysAllow SecurityConfigurationRuleAccess = "AlwaysAllow" - // SecurityConfigurationRuleAccessDeny ... - SecurityConfigurationRuleAccessDeny SecurityConfigurationRuleAccess = "Deny" -) - -// PossibleSecurityConfigurationRuleAccessValues returns an array of possible values for the SecurityConfigurationRuleAccess const type. -func PossibleSecurityConfigurationRuleAccessValues() []SecurityConfigurationRuleAccess { - return []SecurityConfigurationRuleAccess{SecurityConfigurationRuleAccessAllow, SecurityConfigurationRuleAccessAlwaysAllow, SecurityConfigurationRuleAccessDeny} -} - -// SecurityConfigurationRuleDirection enumerates the values for security configuration rule direction. -type SecurityConfigurationRuleDirection string - -const ( - // SecurityConfigurationRuleDirectionInbound ... - SecurityConfigurationRuleDirectionInbound SecurityConfigurationRuleDirection = "Inbound" - // SecurityConfigurationRuleDirectionOutbound ... - SecurityConfigurationRuleDirectionOutbound SecurityConfigurationRuleDirection = "Outbound" -) - -// PossibleSecurityConfigurationRuleDirectionValues returns an array of possible values for the SecurityConfigurationRuleDirection const type. -func PossibleSecurityConfigurationRuleDirectionValues() []SecurityConfigurationRuleDirection { - return []SecurityConfigurationRuleDirection{SecurityConfigurationRuleDirectionInbound, SecurityConfigurationRuleDirectionOutbound} -} - -// SecurityConfigurationRuleProtocol enumerates the values for security configuration rule protocol. -type SecurityConfigurationRuleProtocol string - -const ( - // SecurityConfigurationRuleProtocolAh ... - SecurityConfigurationRuleProtocolAh SecurityConfigurationRuleProtocol = "Ah" - // SecurityConfigurationRuleProtocolAny ... - SecurityConfigurationRuleProtocolAny SecurityConfigurationRuleProtocol = "Any" - // SecurityConfigurationRuleProtocolEsp ... - SecurityConfigurationRuleProtocolEsp SecurityConfigurationRuleProtocol = "Esp" - // SecurityConfigurationRuleProtocolIcmp ... - SecurityConfigurationRuleProtocolIcmp SecurityConfigurationRuleProtocol = "Icmp" - // SecurityConfigurationRuleProtocolTCP ... - SecurityConfigurationRuleProtocolTCP SecurityConfigurationRuleProtocol = "Tcp" - // SecurityConfigurationRuleProtocolUDP ... - SecurityConfigurationRuleProtocolUDP SecurityConfigurationRuleProtocol = "Udp" -) - -// PossibleSecurityConfigurationRuleProtocolValues returns an array of possible values for the SecurityConfigurationRuleProtocol const type. -func PossibleSecurityConfigurationRuleProtocolValues() []SecurityConfigurationRuleProtocol { - return []SecurityConfigurationRuleProtocol{SecurityConfigurationRuleProtocolAh, SecurityConfigurationRuleProtocolAny, SecurityConfigurationRuleProtocolEsp, SecurityConfigurationRuleProtocolIcmp, SecurityConfigurationRuleProtocolTCP, SecurityConfigurationRuleProtocolUDP} -} - -// SecurityPartnerProviderConnectionStatus enumerates the values for security partner provider connection -// status. -type SecurityPartnerProviderConnectionStatus string - -const ( - // SecurityPartnerProviderConnectionStatusConnected ... - SecurityPartnerProviderConnectionStatusConnected SecurityPartnerProviderConnectionStatus = "Connected" - // SecurityPartnerProviderConnectionStatusNotConnected ... - SecurityPartnerProviderConnectionStatusNotConnected SecurityPartnerProviderConnectionStatus = "NotConnected" - // SecurityPartnerProviderConnectionStatusPartiallyConnected ... - SecurityPartnerProviderConnectionStatusPartiallyConnected SecurityPartnerProviderConnectionStatus = "PartiallyConnected" - // SecurityPartnerProviderConnectionStatusUnknown ... - SecurityPartnerProviderConnectionStatusUnknown SecurityPartnerProviderConnectionStatus = "Unknown" -) - -// PossibleSecurityPartnerProviderConnectionStatusValues returns an array of possible values for the SecurityPartnerProviderConnectionStatus const type. -func PossibleSecurityPartnerProviderConnectionStatusValues() []SecurityPartnerProviderConnectionStatus { - return []SecurityPartnerProviderConnectionStatus{SecurityPartnerProviderConnectionStatusConnected, SecurityPartnerProviderConnectionStatusNotConnected, SecurityPartnerProviderConnectionStatusPartiallyConnected, SecurityPartnerProviderConnectionStatusUnknown} -} - -// SecurityProviderName enumerates the values for security provider name. -type SecurityProviderName string - -const ( - // SecurityProviderNameCheckpoint ... - SecurityProviderNameCheckpoint SecurityProviderName = "Checkpoint" - // SecurityProviderNameIBoss ... - SecurityProviderNameIBoss SecurityProviderName = "IBoss" - // SecurityProviderNameZScaler ... - SecurityProviderNameZScaler SecurityProviderName = "ZScaler" -) - -// PossibleSecurityProviderNameValues returns an array of possible values for the SecurityProviderName const type. -func PossibleSecurityProviderNameValues() []SecurityProviderName { - return []SecurityProviderName{SecurityProviderNameCheckpoint, SecurityProviderNameIBoss, SecurityProviderNameZScaler} -} - -// SecurityRuleAccess enumerates the values for security rule access. -type SecurityRuleAccess string - -const ( - // SecurityRuleAccessAllow ... - SecurityRuleAccessAllow SecurityRuleAccess = "Allow" - // SecurityRuleAccessDeny ... - SecurityRuleAccessDeny SecurityRuleAccess = "Deny" -) - -// PossibleSecurityRuleAccessValues returns an array of possible values for the SecurityRuleAccess const type. -func PossibleSecurityRuleAccessValues() []SecurityRuleAccess { - return []SecurityRuleAccess{SecurityRuleAccessAllow, SecurityRuleAccessDeny} -} - -// SecurityRuleDirection enumerates the values for security rule direction. -type SecurityRuleDirection string - -const ( - // SecurityRuleDirectionInbound ... - SecurityRuleDirectionInbound SecurityRuleDirection = "Inbound" - // SecurityRuleDirectionOutbound ... - SecurityRuleDirectionOutbound SecurityRuleDirection = "Outbound" -) - -// PossibleSecurityRuleDirectionValues returns an array of possible values for the SecurityRuleDirection const type. -func PossibleSecurityRuleDirectionValues() []SecurityRuleDirection { - return []SecurityRuleDirection{SecurityRuleDirectionInbound, SecurityRuleDirectionOutbound} -} - -// SecurityRuleProtocol enumerates the values for security rule protocol. -type SecurityRuleProtocol string - -const ( - // SecurityRuleProtocolAh ... - SecurityRuleProtocolAh SecurityRuleProtocol = "Ah" - // SecurityRuleProtocolAsterisk ... - SecurityRuleProtocolAsterisk SecurityRuleProtocol = "*" - // SecurityRuleProtocolEsp ... - SecurityRuleProtocolEsp SecurityRuleProtocol = "Esp" - // SecurityRuleProtocolIcmp ... - SecurityRuleProtocolIcmp SecurityRuleProtocol = "Icmp" - // SecurityRuleProtocolTCP ... - SecurityRuleProtocolTCP SecurityRuleProtocol = "Tcp" - // SecurityRuleProtocolUDP ... - SecurityRuleProtocolUDP SecurityRuleProtocol = "Udp" -) - -// PossibleSecurityRuleProtocolValues returns an array of possible values for the SecurityRuleProtocol const type. -func PossibleSecurityRuleProtocolValues() []SecurityRuleProtocol { - return []SecurityRuleProtocol{SecurityRuleProtocolAh, SecurityRuleProtocolAsterisk, SecurityRuleProtocolEsp, SecurityRuleProtocolIcmp, SecurityRuleProtocolTCP, SecurityRuleProtocolUDP} -} - -// ServiceProviderProvisioningState enumerates the values for service provider provisioning state. -type ServiceProviderProvisioningState string - -const ( - // ServiceProviderProvisioningStateDeprovisioning ... - ServiceProviderProvisioningStateDeprovisioning ServiceProviderProvisioningState = "Deprovisioning" - // ServiceProviderProvisioningStateNotProvisioned ... - ServiceProviderProvisioningStateNotProvisioned ServiceProviderProvisioningState = "NotProvisioned" - // ServiceProviderProvisioningStateProvisioned ... - ServiceProviderProvisioningStateProvisioned ServiceProviderProvisioningState = "Provisioned" - // ServiceProviderProvisioningStateProvisioning ... - ServiceProviderProvisioningStateProvisioning ServiceProviderProvisioningState = "Provisioning" -) - -// PossibleServiceProviderProvisioningStateValues returns an array of possible values for the ServiceProviderProvisioningState const type. -func PossibleServiceProviderProvisioningStateValues() []ServiceProviderProvisioningState { - return []ServiceProviderProvisioningState{ServiceProviderProvisioningStateDeprovisioning, ServiceProviderProvisioningStateNotProvisioned, ServiceProviderProvisioningStateProvisioned, ServiceProviderProvisioningStateProvisioning} -} - -// Severity enumerates the values for severity. -type Severity string - -const ( - // SeverityError ... - SeverityError Severity = "Error" - // SeverityWarning ... - SeverityWarning Severity = "Warning" -) - -// PossibleSeverityValues returns an array of possible values for the Severity const type. -func PossibleSeverityValues() []Severity { - return []Severity{SeverityError, SeverityWarning} -} - -// SlotType enumerates the values for slot type. -type SlotType string - -const ( - // SlotTypeProduction ... - SlotTypeProduction SlotType = "Production" - // SlotTypeStaging ... - SlotTypeStaging SlotType = "Staging" -) - -// PossibleSlotTypeValues returns an array of possible values for the SlotType const type. -func PossibleSlotTypeValues() []SlotType { - return []SlotType{SlotTypeProduction, SlotTypeStaging} -} - -// SyncRemoteAddressSpace enumerates the values for sync remote address space. -type SyncRemoteAddressSpace string - -const ( - // SyncRemoteAddressSpaceTrue ... - SyncRemoteAddressSpaceTrue SyncRemoteAddressSpace = "true" -) - -// PossibleSyncRemoteAddressSpaceValues returns an array of possible values for the SyncRemoteAddressSpace const type. -func PossibleSyncRemoteAddressSpaceValues() []SyncRemoteAddressSpace { - return []SyncRemoteAddressSpace{SyncRemoteAddressSpaceTrue} -} - -// TransportProtocol enumerates the values for transport protocol. -type TransportProtocol string - -const ( - // TransportProtocolAll ... - TransportProtocolAll TransportProtocol = "All" - // TransportProtocolTCP ... - TransportProtocolTCP TransportProtocol = "Tcp" - // TransportProtocolUDP ... - TransportProtocolUDP TransportProtocol = "Udp" -) - -// PossibleTransportProtocolValues returns an array of possible values for the TransportProtocol const type. -func PossibleTransportProtocolValues() []TransportProtocol { - return []TransportProtocol{TransportProtocolAll, TransportProtocolTCP, TransportProtocolUDP} -} - -// TunnelConnectionStatus enumerates the values for tunnel connection status. -type TunnelConnectionStatus string - -const ( - // TunnelConnectionStatusConnected ... - TunnelConnectionStatusConnected TunnelConnectionStatus = "Connected" - // TunnelConnectionStatusConnecting ... - TunnelConnectionStatusConnecting TunnelConnectionStatus = "Connecting" - // TunnelConnectionStatusNotConnected ... - TunnelConnectionStatusNotConnected TunnelConnectionStatus = "NotConnected" - // TunnelConnectionStatusUnknown ... - TunnelConnectionStatusUnknown TunnelConnectionStatus = "Unknown" -) - -// PossibleTunnelConnectionStatusValues returns an array of possible values for the TunnelConnectionStatus const type. -func PossibleTunnelConnectionStatusValues() []TunnelConnectionStatus { - return []TunnelConnectionStatus{TunnelConnectionStatusConnected, TunnelConnectionStatusConnecting, TunnelConnectionStatusNotConnected, TunnelConnectionStatusUnknown} -} - -// UseHubGateway enumerates the values for use hub gateway. -type UseHubGateway string - -const ( - // UseHubGatewayFalse ... - UseHubGatewayFalse UseHubGateway = "False" - // UseHubGatewayTrue ... - UseHubGatewayTrue UseHubGateway = "True" -) - -// PossibleUseHubGatewayValues returns an array of possible values for the UseHubGateway const type. -func PossibleUseHubGatewayValues() []UseHubGateway { - return []UseHubGateway{UseHubGatewayFalse, UseHubGatewayTrue} -} - -// VerbosityLevel enumerates the values for verbosity level. -type VerbosityLevel string - -const ( - // VerbosityLevelFull ... - VerbosityLevelFull VerbosityLevel = "Full" - // VerbosityLevelMinimum ... - VerbosityLevelMinimum VerbosityLevel = "Minimum" - // VerbosityLevelNormal ... - VerbosityLevelNormal VerbosityLevel = "Normal" -) - -// PossibleVerbosityLevelValues returns an array of possible values for the VerbosityLevel const type. -func PossibleVerbosityLevelValues() []VerbosityLevel { - return []VerbosityLevel{VerbosityLevelFull, VerbosityLevelMinimum, VerbosityLevelNormal} -} - -// VirtualNetworkEncryptionEnforcement enumerates the values for virtual network encryption enforcement. -type VirtualNetworkEncryptionEnforcement string - -const ( - // VirtualNetworkEncryptionEnforcementAllowUnencrypted ... - VirtualNetworkEncryptionEnforcementAllowUnencrypted VirtualNetworkEncryptionEnforcement = "AllowUnencrypted" - // VirtualNetworkEncryptionEnforcementDropUnencrypted ... - VirtualNetworkEncryptionEnforcementDropUnencrypted VirtualNetworkEncryptionEnforcement = "DropUnencrypted" -) - -// PossibleVirtualNetworkEncryptionEnforcementValues returns an array of possible values for the VirtualNetworkEncryptionEnforcement const type. -func PossibleVirtualNetworkEncryptionEnforcementValues() []VirtualNetworkEncryptionEnforcement { - return []VirtualNetworkEncryptionEnforcement{VirtualNetworkEncryptionEnforcementAllowUnencrypted, VirtualNetworkEncryptionEnforcementDropUnencrypted} -} - -// VirtualNetworkGatewayConnectionMode enumerates the values for virtual network gateway connection mode. -type VirtualNetworkGatewayConnectionMode string - -const ( - // VirtualNetworkGatewayConnectionModeDefault ... - VirtualNetworkGatewayConnectionModeDefault VirtualNetworkGatewayConnectionMode = "Default" - // VirtualNetworkGatewayConnectionModeInitiatorOnly ... - VirtualNetworkGatewayConnectionModeInitiatorOnly VirtualNetworkGatewayConnectionMode = "InitiatorOnly" - // VirtualNetworkGatewayConnectionModeResponderOnly ... - VirtualNetworkGatewayConnectionModeResponderOnly VirtualNetworkGatewayConnectionMode = "ResponderOnly" -) - -// PossibleVirtualNetworkGatewayConnectionModeValues returns an array of possible values for the VirtualNetworkGatewayConnectionMode const type. -func PossibleVirtualNetworkGatewayConnectionModeValues() []VirtualNetworkGatewayConnectionMode { - return []VirtualNetworkGatewayConnectionMode{VirtualNetworkGatewayConnectionModeDefault, VirtualNetworkGatewayConnectionModeInitiatorOnly, VirtualNetworkGatewayConnectionModeResponderOnly} -} - -// VirtualNetworkGatewayConnectionProtocol enumerates the values for virtual network gateway connection -// protocol. -type VirtualNetworkGatewayConnectionProtocol string - -const ( - // VirtualNetworkGatewayConnectionProtocolIKEv1 ... - VirtualNetworkGatewayConnectionProtocolIKEv1 VirtualNetworkGatewayConnectionProtocol = "IKEv1" - // VirtualNetworkGatewayConnectionProtocolIKEv2 ... - VirtualNetworkGatewayConnectionProtocolIKEv2 VirtualNetworkGatewayConnectionProtocol = "IKEv2" -) - -// PossibleVirtualNetworkGatewayConnectionProtocolValues returns an array of possible values for the VirtualNetworkGatewayConnectionProtocol const type. -func PossibleVirtualNetworkGatewayConnectionProtocolValues() []VirtualNetworkGatewayConnectionProtocol { - return []VirtualNetworkGatewayConnectionProtocol{VirtualNetworkGatewayConnectionProtocolIKEv1, VirtualNetworkGatewayConnectionProtocolIKEv2} -} - -// VirtualNetworkGatewayConnectionStatus enumerates the values for virtual network gateway connection status. -type VirtualNetworkGatewayConnectionStatus string - -const ( - // VirtualNetworkGatewayConnectionStatusConnected ... - VirtualNetworkGatewayConnectionStatusConnected VirtualNetworkGatewayConnectionStatus = "Connected" - // VirtualNetworkGatewayConnectionStatusConnecting ... - VirtualNetworkGatewayConnectionStatusConnecting VirtualNetworkGatewayConnectionStatus = "Connecting" - // VirtualNetworkGatewayConnectionStatusNotConnected ... - VirtualNetworkGatewayConnectionStatusNotConnected VirtualNetworkGatewayConnectionStatus = "NotConnected" - // VirtualNetworkGatewayConnectionStatusUnknown ... - VirtualNetworkGatewayConnectionStatusUnknown VirtualNetworkGatewayConnectionStatus = "Unknown" -) - -// PossibleVirtualNetworkGatewayConnectionStatusValues returns an array of possible values for the VirtualNetworkGatewayConnectionStatus const type. -func PossibleVirtualNetworkGatewayConnectionStatusValues() []VirtualNetworkGatewayConnectionStatus { - return []VirtualNetworkGatewayConnectionStatus{VirtualNetworkGatewayConnectionStatusConnected, VirtualNetworkGatewayConnectionStatusConnecting, VirtualNetworkGatewayConnectionStatusNotConnected, VirtualNetworkGatewayConnectionStatusUnknown} -} - -// VirtualNetworkGatewayConnectionType enumerates the values for virtual network gateway connection type. -type VirtualNetworkGatewayConnectionType string - -const ( - // VirtualNetworkGatewayConnectionTypeExpressRoute ... - VirtualNetworkGatewayConnectionTypeExpressRoute VirtualNetworkGatewayConnectionType = "ExpressRoute" - // VirtualNetworkGatewayConnectionTypeIPsec ... - VirtualNetworkGatewayConnectionTypeIPsec VirtualNetworkGatewayConnectionType = "IPsec" - // VirtualNetworkGatewayConnectionTypeVPNClient ... - VirtualNetworkGatewayConnectionTypeVPNClient VirtualNetworkGatewayConnectionType = "VPNClient" - // VirtualNetworkGatewayConnectionTypeVnet2Vnet ... - VirtualNetworkGatewayConnectionTypeVnet2Vnet VirtualNetworkGatewayConnectionType = "Vnet2Vnet" -) - -// PossibleVirtualNetworkGatewayConnectionTypeValues returns an array of possible values for the VirtualNetworkGatewayConnectionType const type. -func PossibleVirtualNetworkGatewayConnectionTypeValues() []VirtualNetworkGatewayConnectionType { - return []VirtualNetworkGatewayConnectionType{VirtualNetworkGatewayConnectionTypeExpressRoute, VirtualNetworkGatewayConnectionTypeIPsec, VirtualNetworkGatewayConnectionTypeVPNClient, VirtualNetworkGatewayConnectionTypeVnet2Vnet} -} - -// VirtualNetworkGatewaySkuName enumerates the values for virtual network gateway sku name. -type VirtualNetworkGatewaySkuName string - -const ( - // VirtualNetworkGatewaySkuNameBasic ... - VirtualNetworkGatewaySkuNameBasic VirtualNetworkGatewaySkuName = "Basic" - // VirtualNetworkGatewaySkuNameErGw1AZ ... - VirtualNetworkGatewaySkuNameErGw1AZ VirtualNetworkGatewaySkuName = "ErGw1AZ" - // VirtualNetworkGatewaySkuNameErGw2AZ ... - VirtualNetworkGatewaySkuNameErGw2AZ VirtualNetworkGatewaySkuName = "ErGw2AZ" - // VirtualNetworkGatewaySkuNameErGw3AZ ... - VirtualNetworkGatewaySkuNameErGw3AZ VirtualNetworkGatewaySkuName = "ErGw3AZ" - // VirtualNetworkGatewaySkuNameHighPerformance ... - VirtualNetworkGatewaySkuNameHighPerformance VirtualNetworkGatewaySkuName = "HighPerformance" - // VirtualNetworkGatewaySkuNameStandard ... - VirtualNetworkGatewaySkuNameStandard VirtualNetworkGatewaySkuName = "Standard" - // VirtualNetworkGatewaySkuNameUltraPerformance ... - VirtualNetworkGatewaySkuNameUltraPerformance VirtualNetworkGatewaySkuName = "UltraPerformance" - // VirtualNetworkGatewaySkuNameVpnGw1 ... - VirtualNetworkGatewaySkuNameVpnGw1 VirtualNetworkGatewaySkuName = "VpnGw1" - // VirtualNetworkGatewaySkuNameVpnGw1AZ ... - VirtualNetworkGatewaySkuNameVpnGw1AZ VirtualNetworkGatewaySkuName = "VpnGw1AZ" - // VirtualNetworkGatewaySkuNameVpnGw2 ... - VirtualNetworkGatewaySkuNameVpnGw2 VirtualNetworkGatewaySkuName = "VpnGw2" - // VirtualNetworkGatewaySkuNameVpnGw2AZ ... - VirtualNetworkGatewaySkuNameVpnGw2AZ VirtualNetworkGatewaySkuName = "VpnGw2AZ" - // VirtualNetworkGatewaySkuNameVpnGw3 ... - VirtualNetworkGatewaySkuNameVpnGw3 VirtualNetworkGatewaySkuName = "VpnGw3" - // VirtualNetworkGatewaySkuNameVpnGw3AZ ... - VirtualNetworkGatewaySkuNameVpnGw3AZ VirtualNetworkGatewaySkuName = "VpnGw3AZ" - // VirtualNetworkGatewaySkuNameVpnGw4 ... - VirtualNetworkGatewaySkuNameVpnGw4 VirtualNetworkGatewaySkuName = "VpnGw4" - // VirtualNetworkGatewaySkuNameVpnGw4AZ ... - VirtualNetworkGatewaySkuNameVpnGw4AZ VirtualNetworkGatewaySkuName = "VpnGw4AZ" - // VirtualNetworkGatewaySkuNameVpnGw5 ... - VirtualNetworkGatewaySkuNameVpnGw5 VirtualNetworkGatewaySkuName = "VpnGw5" - // VirtualNetworkGatewaySkuNameVpnGw5AZ ... - VirtualNetworkGatewaySkuNameVpnGw5AZ VirtualNetworkGatewaySkuName = "VpnGw5AZ" -) - -// PossibleVirtualNetworkGatewaySkuNameValues returns an array of possible values for the VirtualNetworkGatewaySkuName const type. -func PossibleVirtualNetworkGatewaySkuNameValues() []VirtualNetworkGatewaySkuName { - return []VirtualNetworkGatewaySkuName{VirtualNetworkGatewaySkuNameBasic, VirtualNetworkGatewaySkuNameErGw1AZ, VirtualNetworkGatewaySkuNameErGw2AZ, VirtualNetworkGatewaySkuNameErGw3AZ, VirtualNetworkGatewaySkuNameHighPerformance, VirtualNetworkGatewaySkuNameStandard, VirtualNetworkGatewaySkuNameUltraPerformance, VirtualNetworkGatewaySkuNameVpnGw1, VirtualNetworkGatewaySkuNameVpnGw1AZ, VirtualNetworkGatewaySkuNameVpnGw2, VirtualNetworkGatewaySkuNameVpnGw2AZ, VirtualNetworkGatewaySkuNameVpnGw3, VirtualNetworkGatewaySkuNameVpnGw3AZ, VirtualNetworkGatewaySkuNameVpnGw4, VirtualNetworkGatewaySkuNameVpnGw4AZ, VirtualNetworkGatewaySkuNameVpnGw5, VirtualNetworkGatewaySkuNameVpnGw5AZ} -} - -// VirtualNetworkGatewaySkuTier enumerates the values for virtual network gateway sku tier. -type VirtualNetworkGatewaySkuTier string - -const ( - // VirtualNetworkGatewaySkuTierBasic ... - VirtualNetworkGatewaySkuTierBasic VirtualNetworkGatewaySkuTier = "Basic" - // VirtualNetworkGatewaySkuTierErGw1AZ ... - VirtualNetworkGatewaySkuTierErGw1AZ VirtualNetworkGatewaySkuTier = "ErGw1AZ" - // VirtualNetworkGatewaySkuTierErGw2AZ ... - VirtualNetworkGatewaySkuTierErGw2AZ VirtualNetworkGatewaySkuTier = "ErGw2AZ" - // VirtualNetworkGatewaySkuTierErGw3AZ ... - VirtualNetworkGatewaySkuTierErGw3AZ VirtualNetworkGatewaySkuTier = "ErGw3AZ" - // VirtualNetworkGatewaySkuTierHighPerformance ... - VirtualNetworkGatewaySkuTierHighPerformance VirtualNetworkGatewaySkuTier = "HighPerformance" - // VirtualNetworkGatewaySkuTierStandard ... - VirtualNetworkGatewaySkuTierStandard VirtualNetworkGatewaySkuTier = "Standard" - // VirtualNetworkGatewaySkuTierUltraPerformance ... - VirtualNetworkGatewaySkuTierUltraPerformance VirtualNetworkGatewaySkuTier = "UltraPerformance" - // VirtualNetworkGatewaySkuTierVpnGw1 ... - VirtualNetworkGatewaySkuTierVpnGw1 VirtualNetworkGatewaySkuTier = "VpnGw1" - // VirtualNetworkGatewaySkuTierVpnGw1AZ ... - VirtualNetworkGatewaySkuTierVpnGw1AZ VirtualNetworkGatewaySkuTier = "VpnGw1AZ" - // VirtualNetworkGatewaySkuTierVpnGw2 ... - VirtualNetworkGatewaySkuTierVpnGw2 VirtualNetworkGatewaySkuTier = "VpnGw2" - // VirtualNetworkGatewaySkuTierVpnGw2AZ ... - VirtualNetworkGatewaySkuTierVpnGw2AZ VirtualNetworkGatewaySkuTier = "VpnGw2AZ" - // VirtualNetworkGatewaySkuTierVpnGw3 ... - VirtualNetworkGatewaySkuTierVpnGw3 VirtualNetworkGatewaySkuTier = "VpnGw3" - // VirtualNetworkGatewaySkuTierVpnGw3AZ ... - VirtualNetworkGatewaySkuTierVpnGw3AZ VirtualNetworkGatewaySkuTier = "VpnGw3AZ" - // VirtualNetworkGatewaySkuTierVpnGw4 ... - VirtualNetworkGatewaySkuTierVpnGw4 VirtualNetworkGatewaySkuTier = "VpnGw4" - // VirtualNetworkGatewaySkuTierVpnGw4AZ ... - VirtualNetworkGatewaySkuTierVpnGw4AZ VirtualNetworkGatewaySkuTier = "VpnGw4AZ" - // VirtualNetworkGatewaySkuTierVpnGw5 ... - VirtualNetworkGatewaySkuTierVpnGw5 VirtualNetworkGatewaySkuTier = "VpnGw5" - // VirtualNetworkGatewaySkuTierVpnGw5AZ ... - VirtualNetworkGatewaySkuTierVpnGw5AZ VirtualNetworkGatewaySkuTier = "VpnGw5AZ" -) - -// PossibleVirtualNetworkGatewaySkuTierValues returns an array of possible values for the VirtualNetworkGatewaySkuTier const type. -func PossibleVirtualNetworkGatewaySkuTierValues() []VirtualNetworkGatewaySkuTier { - return []VirtualNetworkGatewaySkuTier{VirtualNetworkGatewaySkuTierBasic, VirtualNetworkGatewaySkuTierErGw1AZ, VirtualNetworkGatewaySkuTierErGw2AZ, VirtualNetworkGatewaySkuTierErGw3AZ, VirtualNetworkGatewaySkuTierHighPerformance, VirtualNetworkGatewaySkuTierStandard, VirtualNetworkGatewaySkuTierUltraPerformance, VirtualNetworkGatewaySkuTierVpnGw1, VirtualNetworkGatewaySkuTierVpnGw1AZ, VirtualNetworkGatewaySkuTierVpnGw2, VirtualNetworkGatewaySkuTierVpnGw2AZ, VirtualNetworkGatewaySkuTierVpnGw3, VirtualNetworkGatewaySkuTierVpnGw3AZ, VirtualNetworkGatewaySkuTierVpnGw4, VirtualNetworkGatewaySkuTierVpnGw4AZ, VirtualNetworkGatewaySkuTierVpnGw5, VirtualNetworkGatewaySkuTierVpnGw5AZ} -} - -// VirtualNetworkGatewayType enumerates the values for virtual network gateway type. -type VirtualNetworkGatewayType string - -const ( - // VirtualNetworkGatewayTypeExpressRoute ... - VirtualNetworkGatewayTypeExpressRoute VirtualNetworkGatewayType = "ExpressRoute" - // VirtualNetworkGatewayTypeLocalGateway ... - VirtualNetworkGatewayTypeLocalGateway VirtualNetworkGatewayType = "LocalGateway" - // VirtualNetworkGatewayTypeVpn ... - VirtualNetworkGatewayTypeVpn VirtualNetworkGatewayType = "Vpn" -) - -// PossibleVirtualNetworkGatewayTypeValues returns an array of possible values for the VirtualNetworkGatewayType const type. -func PossibleVirtualNetworkGatewayTypeValues() []VirtualNetworkGatewayType { - return []VirtualNetworkGatewayType{VirtualNetworkGatewayTypeExpressRoute, VirtualNetworkGatewayTypeLocalGateway, VirtualNetworkGatewayTypeVpn} -} - -// VirtualNetworkPeeringLevel enumerates the values for virtual network peering level. -type VirtualNetworkPeeringLevel string - -const ( - // VirtualNetworkPeeringLevelFullyInSync ... - VirtualNetworkPeeringLevelFullyInSync VirtualNetworkPeeringLevel = "FullyInSync" - // VirtualNetworkPeeringLevelLocalAndRemoteNotInSync ... - VirtualNetworkPeeringLevelLocalAndRemoteNotInSync VirtualNetworkPeeringLevel = "LocalAndRemoteNotInSync" - // VirtualNetworkPeeringLevelLocalNotInSync ... - VirtualNetworkPeeringLevelLocalNotInSync VirtualNetworkPeeringLevel = "LocalNotInSync" - // VirtualNetworkPeeringLevelRemoteNotInSync ... - VirtualNetworkPeeringLevelRemoteNotInSync VirtualNetworkPeeringLevel = "RemoteNotInSync" -) - -// PossibleVirtualNetworkPeeringLevelValues returns an array of possible values for the VirtualNetworkPeeringLevel const type. -func PossibleVirtualNetworkPeeringLevelValues() []VirtualNetworkPeeringLevel { - return []VirtualNetworkPeeringLevel{VirtualNetworkPeeringLevelFullyInSync, VirtualNetworkPeeringLevelLocalAndRemoteNotInSync, VirtualNetworkPeeringLevelLocalNotInSync, VirtualNetworkPeeringLevelRemoteNotInSync} -} - -// VirtualNetworkPeeringState enumerates the values for virtual network peering state. -type VirtualNetworkPeeringState string - -const ( - // VirtualNetworkPeeringStateConnected ... - VirtualNetworkPeeringStateConnected VirtualNetworkPeeringState = "Connected" - // VirtualNetworkPeeringStateDisconnected ... - VirtualNetworkPeeringStateDisconnected VirtualNetworkPeeringState = "Disconnected" - // VirtualNetworkPeeringStateInitiated ... - VirtualNetworkPeeringStateInitiated VirtualNetworkPeeringState = "Initiated" -) - -// PossibleVirtualNetworkPeeringStateValues returns an array of possible values for the VirtualNetworkPeeringState const type. -func PossibleVirtualNetworkPeeringStateValues() []VirtualNetworkPeeringState { - return []VirtualNetworkPeeringState{VirtualNetworkPeeringStateConnected, VirtualNetworkPeeringStateDisconnected, VirtualNetworkPeeringStateInitiated} -} - -// VirtualNetworkPrivateEndpointNetworkPolicies enumerates the values for virtual network private endpoint -// network policies. -type VirtualNetworkPrivateEndpointNetworkPolicies string - -const ( - // VirtualNetworkPrivateEndpointNetworkPoliciesDisabled ... - VirtualNetworkPrivateEndpointNetworkPoliciesDisabled VirtualNetworkPrivateEndpointNetworkPolicies = "Disabled" - // VirtualNetworkPrivateEndpointNetworkPoliciesEnabled ... - VirtualNetworkPrivateEndpointNetworkPoliciesEnabled VirtualNetworkPrivateEndpointNetworkPolicies = "Enabled" -) - -// PossibleVirtualNetworkPrivateEndpointNetworkPoliciesValues returns an array of possible values for the VirtualNetworkPrivateEndpointNetworkPolicies const type. -func PossibleVirtualNetworkPrivateEndpointNetworkPoliciesValues() []VirtualNetworkPrivateEndpointNetworkPolicies { - return []VirtualNetworkPrivateEndpointNetworkPolicies{VirtualNetworkPrivateEndpointNetworkPoliciesDisabled, VirtualNetworkPrivateEndpointNetworkPoliciesEnabled} -} - -// VirtualNetworkPrivateLinkServiceNetworkPolicies enumerates the values for virtual network private link -// service network policies. -type VirtualNetworkPrivateLinkServiceNetworkPolicies string - -const ( - // VirtualNetworkPrivateLinkServiceNetworkPoliciesDisabled ... - VirtualNetworkPrivateLinkServiceNetworkPoliciesDisabled VirtualNetworkPrivateLinkServiceNetworkPolicies = "Disabled" - // VirtualNetworkPrivateLinkServiceNetworkPoliciesEnabled ... - VirtualNetworkPrivateLinkServiceNetworkPoliciesEnabled VirtualNetworkPrivateLinkServiceNetworkPolicies = "Enabled" -) - -// PossibleVirtualNetworkPrivateLinkServiceNetworkPoliciesValues returns an array of possible values for the VirtualNetworkPrivateLinkServiceNetworkPolicies const type. -func PossibleVirtualNetworkPrivateLinkServiceNetworkPoliciesValues() []VirtualNetworkPrivateLinkServiceNetworkPolicies { - return []VirtualNetworkPrivateLinkServiceNetworkPolicies{VirtualNetworkPrivateLinkServiceNetworkPoliciesDisabled, VirtualNetworkPrivateLinkServiceNetworkPoliciesEnabled} -} - -// VirtualWanSecurityProviderType enumerates the values for virtual wan security provider type. -type VirtualWanSecurityProviderType string - -const ( - // VirtualWanSecurityProviderTypeExternal ... - VirtualWanSecurityProviderTypeExternal VirtualWanSecurityProviderType = "External" - // VirtualWanSecurityProviderTypeNative ... - VirtualWanSecurityProviderTypeNative VirtualWanSecurityProviderType = "Native" -) - -// PossibleVirtualWanSecurityProviderTypeValues returns an array of possible values for the VirtualWanSecurityProviderType const type. -func PossibleVirtualWanSecurityProviderTypeValues() []VirtualWanSecurityProviderType { - return []VirtualWanSecurityProviderType{VirtualWanSecurityProviderTypeExternal, VirtualWanSecurityProviderTypeNative} -} - -// VnetLocalRouteOverrideCriteria enumerates the values for vnet local route override criteria. -type VnetLocalRouteOverrideCriteria string - -const ( - // VnetLocalRouteOverrideCriteriaContains ... - VnetLocalRouteOverrideCriteriaContains VnetLocalRouteOverrideCriteria = "Contains" - // VnetLocalRouteOverrideCriteriaEqual ... - VnetLocalRouteOverrideCriteriaEqual VnetLocalRouteOverrideCriteria = "Equal" -) - -// PossibleVnetLocalRouteOverrideCriteriaValues returns an array of possible values for the VnetLocalRouteOverrideCriteria const type. -func PossibleVnetLocalRouteOverrideCriteriaValues() []VnetLocalRouteOverrideCriteria { - return []VnetLocalRouteOverrideCriteria{VnetLocalRouteOverrideCriteriaContains, VnetLocalRouteOverrideCriteriaEqual} -} - -// VpnAuthenticationType enumerates the values for vpn authentication type. -type VpnAuthenticationType string - -const ( - // VpnAuthenticationTypeAAD ... - VpnAuthenticationTypeAAD VpnAuthenticationType = "AAD" - // VpnAuthenticationTypeCertificate ... - VpnAuthenticationTypeCertificate VpnAuthenticationType = "Certificate" - // VpnAuthenticationTypeRadius ... - VpnAuthenticationTypeRadius VpnAuthenticationType = "Radius" -) - -// PossibleVpnAuthenticationTypeValues returns an array of possible values for the VpnAuthenticationType const type. -func PossibleVpnAuthenticationTypeValues() []VpnAuthenticationType { - return []VpnAuthenticationType{VpnAuthenticationTypeAAD, VpnAuthenticationTypeCertificate, VpnAuthenticationTypeRadius} -} - -// VpnClientProtocol enumerates the values for vpn client protocol. -type VpnClientProtocol string - -const ( - // VpnClientProtocolIkeV2 ... - VpnClientProtocolIkeV2 VpnClientProtocol = "IkeV2" - // VpnClientProtocolOpenVPN ... - VpnClientProtocolOpenVPN VpnClientProtocol = "OpenVPN" - // VpnClientProtocolSSTP ... - VpnClientProtocolSSTP VpnClientProtocol = "SSTP" -) - -// PossibleVpnClientProtocolValues returns an array of possible values for the VpnClientProtocol const type. -func PossibleVpnClientProtocolValues() []VpnClientProtocol { - return []VpnClientProtocol{VpnClientProtocolIkeV2, VpnClientProtocolOpenVPN, VpnClientProtocolSSTP} -} - -// VpnConnectionStatus enumerates the values for vpn connection status. -type VpnConnectionStatus string - -const ( - // VpnConnectionStatusConnected ... - VpnConnectionStatusConnected VpnConnectionStatus = "Connected" - // VpnConnectionStatusConnecting ... - VpnConnectionStatusConnecting VpnConnectionStatus = "Connecting" - // VpnConnectionStatusNotConnected ... - VpnConnectionStatusNotConnected VpnConnectionStatus = "NotConnected" - // VpnConnectionStatusUnknown ... - VpnConnectionStatusUnknown VpnConnectionStatus = "Unknown" -) - -// PossibleVpnConnectionStatusValues returns an array of possible values for the VpnConnectionStatus const type. -func PossibleVpnConnectionStatusValues() []VpnConnectionStatus { - return []VpnConnectionStatus{VpnConnectionStatusConnected, VpnConnectionStatusConnecting, VpnConnectionStatusNotConnected, VpnConnectionStatusUnknown} -} - -// VpnGatewayGeneration enumerates the values for vpn gateway generation. -type VpnGatewayGeneration string - -const ( - // VpnGatewayGenerationGeneration1 ... - VpnGatewayGenerationGeneration1 VpnGatewayGeneration = "Generation1" - // VpnGatewayGenerationGeneration2 ... - VpnGatewayGenerationGeneration2 VpnGatewayGeneration = "Generation2" - // VpnGatewayGenerationNone ... - VpnGatewayGenerationNone VpnGatewayGeneration = "None" -) - -// PossibleVpnGatewayGenerationValues returns an array of possible values for the VpnGatewayGeneration const type. -func PossibleVpnGatewayGenerationValues() []VpnGatewayGeneration { - return []VpnGatewayGeneration{VpnGatewayGenerationGeneration1, VpnGatewayGenerationGeneration2, VpnGatewayGenerationNone} -} - -// VpnGatewayTunnelingProtocol enumerates the values for vpn gateway tunneling protocol. -type VpnGatewayTunnelingProtocol string - -const ( - // VpnGatewayTunnelingProtocolIkeV2 ... - VpnGatewayTunnelingProtocolIkeV2 VpnGatewayTunnelingProtocol = "IkeV2" - // VpnGatewayTunnelingProtocolOpenVPN ... - VpnGatewayTunnelingProtocolOpenVPN VpnGatewayTunnelingProtocol = "OpenVPN" -) - -// PossibleVpnGatewayTunnelingProtocolValues returns an array of possible values for the VpnGatewayTunnelingProtocol const type. -func PossibleVpnGatewayTunnelingProtocolValues() []VpnGatewayTunnelingProtocol { - return []VpnGatewayTunnelingProtocol{VpnGatewayTunnelingProtocolIkeV2, VpnGatewayTunnelingProtocolOpenVPN} -} - -// VpnLinkConnectionMode enumerates the values for vpn link connection mode. -type VpnLinkConnectionMode string - -const ( - // VpnLinkConnectionModeDefault ... - VpnLinkConnectionModeDefault VpnLinkConnectionMode = "Default" - // VpnLinkConnectionModeInitiatorOnly ... - VpnLinkConnectionModeInitiatorOnly VpnLinkConnectionMode = "InitiatorOnly" - // VpnLinkConnectionModeResponderOnly ... - VpnLinkConnectionModeResponderOnly VpnLinkConnectionMode = "ResponderOnly" -) - -// PossibleVpnLinkConnectionModeValues returns an array of possible values for the VpnLinkConnectionMode const type. -func PossibleVpnLinkConnectionModeValues() []VpnLinkConnectionMode { - return []VpnLinkConnectionMode{VpnLinkConnectionModeDefault, VpnLinkConnectionModeInitiatorOnly, VpnLinkConnectionModeResponderOnly} -} - -// VpnNatRuleMode enumerates the values for vpn nat rule mode. -type VpnNatRuleMode string - -const ( - // VpnNatRuleModeEgressSnat ... - VpnNatRuleModeEgressSnat VpnNatRuleMode = "EgressSnat" - // VpnNatRuleModeIngressSnat ... - VpnNatRuleModeIngressSnat VpnNatRuleMode = "IngressSnat" -) - -// PossibleVpnNatRuleModeValues returns an array of possible values for the VpnNatRuleMode const type. -func PossibleVpnNatRuleModeValues() []VpnNatRuleMode { - return []VpnNatRuleMode{VpnNatRuleModeEgressSnat, VpnNatRuleModeIngressSnat} -} - -// VpnNatRuleType enumerates the values for vpn nat rule type. -type VpnNatRuleType string - -const ( - // VpnNatRuleTypeDynamic ... - VpnNatRuleTypeDynamic VpnNatRuleType = "Dynamic" - // VpnNatRuleTypeStatic ... - VpnNatRuleTypeStatic VpnNatRuleType = "Static" -) - -// PossibleVpnNatRuleTypeValues returns an array of possible values for the VpnNatRuleType const type. -func PossibleVpnNatRuleTypeValues() []VpnNatRuleType { - return []VpnNatRuleType{VpnNatRuleTypeDynamic, VpnNatRuleTypeStatic} -} - -// VpnPolicyMemberAttributeType enumerates the values for vpn policy member attribute type. -type VpnPolicyMemberAttributeType string - -const ( - // VpnPolicyMemberAttributeTypeAADGroupID ... - VpnPolicyMemberAttributeTypeAADGroupID VpnPolicyMemberAttributeType = "AADGroupId" - // VpnPolicyMemberAttributeTypeCertificateGroupID ... - VpnPolicyMemberAttributeTypeCertificateGroupID VpnPolicyMemberAttributeType = "CertificateGroupId" - // VpnPolicyMemberAttributeTypeRadiusAzureGroupID ... - VpnPolicyMemberAttributeTypeRadiusAzureGroupID VpnPolicyMemberAttributeType = "RadiusAzureGroupId" -) - -// PossibleVpnPolicyMemberAttributeTypeValues returns an array of possible values for the VpnPolicyMemberAttributeType const type. -func PossibleVpnPolicyMemberAttributeTypeValues() []VpnPolicyMemberAttributeType { - return []VpnPolicyMemberAttributeType{VpnPolicyMemberAttributeTypeAADGroupID, VpnPolicyMemberAttributeTypeCertificateGroupID, VpnPolicyMemberAttributeTypeRadiusAzureGroupID} -} - -// VpnType enumerates the values for vpn type. -type VpnType string - -const ( - // VpnTypePolicyBased ... - VpnTypePolicyBased VpnType = "PolicyBased" - // VpnTypeRouteBased ... - VpnTypeRouteBased VpnType = "RouteBased" -) - -// PossibleVpnTypeValues returns an array of possible values for the VpnType const type. -func PossibleVpnTypeValues() []VpnType { - return []VpnType{VpnTypePolicyBased, VpnTypeRouteBased} -} - -// WebApplicationFirewallAction enumerates the values for web application firewall action. -type WebApplicationFirewallAction string - -const ( - // WebApplicationFirewallActionAllow ... - WebApplicationFirewallActionAllow WebApplicationFirewallAction = "Allow" - // WebApplicationFirewallActionBlock ... - WebApplicationFirewallActionBlock WebApplicationFirewallAction = "Block" - // WebApplicationFirewallActionLog ... - WebApplicationFirewallActionLog WebApplicationFirewallAction = "Log" -) - -// PossibleWebApplicationFirewallActionValues returns an array of possible values for the WebApplicationFirewallAction const type. -func PossibleWebApplicationFirewallActionValues() []WebApplicationFirewallAction { - return []WebApplicationFirewallAction{WebApplicationFirewallActionAllow, WebApplicationFirewallActionBlock, WebApplicationFirewallActionLog} -} - -// WebApplicationFirewallEnabledState enumerates the values for web application firewall enabled state. -type WebApplicationFirewallEnabledState string - -const ( - // WebApplicationFirewallEnabledStateDisabled ... - WebApplicationFirewallEnabledStateDisabled WebApplicationFirewallEnabledState = "Disabled" - // WebApplicationFirewallEnabledStateEnabled ... - WebApplicationFirewallEnabledStateEnabled WebApplicationFirewallEnabledState = "Enabled" -) - -// PossibleWebApplicationFirewallEnabledStateValues returns an array of possible values for the WebApplicationFirewallEnabledState const type. -func PossibleWebApplicationFirewallEnabledStateValues() []WebApplicationFirewallEnabledState { - return []WebApplicationFirewallEnabledState{WebApplicationFirewallEnabledStateDisabled, WebApplicationFirewallEnabledStateEnabled} -} - -// WebApplicationFirewallMatchVariable enumerates the values for web application firewall match variable. -type WebApplicationFirewallMatchVariable string - -const ( - // WebApplicationFirewallMatchVariablePostArgs ... - WebApplicationFirewallMatchVariablePostArgs WebApplicationFirewallMatchVariable = "PostArgs" - // WebApplicationFirewallMatchVariableQueryString ... - WebApplicationFirewallMatchVariableQueryString WebApplicationFirewallMatchVariable = "QueryString" - // WebApplicationFirewallMatchVariableRemoteAddr ... - WebApplicationFirewallMatchVariableRemoteAddr WebApplicationFirewallMatchVariable = "RemoteAddr" - // WebApplicationFirewallMatchVariableRequestBody ... - WebApplicationFirewallMatchVariableRequestBody WebApplicationFirewallMatchVariable = "RequestBody" - // WebApplicationFirewallMatchVariableRequestCookies ... - WebApplicationFirewallMatchVariableRequestCookies WebApplicationFirewallMatchVariable = "RequestCookies" - // WebApplicationFirewallMatchVariableRequestHeaders ... - WebApplicationFirewallMatchVariableRequestHeaders WebApplicationFirewallMatchVariable = "RequestHeaders" - // WebApplicationFirewallMatchVariableRequestMethod ... - WebApplicationFirewallMatchVariableRequestMethod WebApplicationFirewallMatchVariable = "RequestMethod" - // WebApplicationFirewallMatchVariableRequestURI ... - WebApplicationFirewallMatchVariableRequestURI WebApplicationFirewallMatchVariable = "RequestUri" -) - -// PossibleWebApplicationFirewallMatchVariableValues returns an array of possible values for the WebApplicationFirewallMatchVariable const type. -func PossibleWebApplicationFirewallMatchVariableValues() []WebApplicationFirewallMatchVariable { - return []WebApplicationFirewallMatchVariable{WebApplicationFirewallMatchVariablePostArgs, WebApplicationFirewallMatchVariableQueryString, WebApplicationFirewallMatchVariableRemoteAddr, WebApplicationFirewallMatchVariableRequestBody, WebApplicationFirewallMatchVariableRequestCookies, WebApplicationFirewallMatchVariableRequestHeaders, WebApplicationFirewallMatchVariableRequestMethod, WebApplicationFirewallMatchVariableRequestURI} -} - -// WebApplicationFirewallMode enumerates the values for web application firewall mode. -type WebApplicationFirewallMode string - -const ( - // WebApplicationFirewallModeDetection ... - WebApplicationFirewallModeDetection WebApplicationFirewallMode = "Detection" - // WebApplicationFirewallModePrevention ... - WebApplicationFirewallModePrevention WebApplicationFirewallMode = "Prevention" -) - -// PossibleWebApplicationFirewallModeValues returns an array of possible values for the WebApplicationFirewallMode const type. -func PossibleWebApplicationFirewallModeValues() []WebApplicationFirewallMode { - return []WebApplicationFirewallMode{WebApplicationFirewallModeDetection, WebApplicationFirewallModePrevention} -} - -// WebApplicationFirewallOperator enumerates the values for web application firewall operator. -type WebApplicationFirewallOperator string - -const ( - // WebApplicationFirewallOperatorAny ... - WebApplicationFirewallOperatorAny WebApplicationFirewallOperator = "Any" - // WebApplicationFirewallOperatorBeginsWith ... - WebApplicationFirewallOperatorBeginsWith WebApplicationFirewallOperator = "BeginsWith" - // WebApplicationFirewallOperatorContains ... - WebApplicationFirewallOperatorContains WebApplicationFirewallOperator = "Contains" - // WebApplicationFirewallOperatorEndsWith ... - WebApplicationFirewallOperatorEndsWith WebApplicationFirewallOperator = "EndsWith" - // WebApplicationFirewallOperatorEqual ... - WebApplicationFirewallOperatorEqual WebApplicationFirewallOperator = "Equal" - // WebApplicationFirewallOperatorGeoMatch ... - WebApplicationFirewallOperatorGeoMatch WebApplicationFirewallOperator = "GeoMatch" - // WebApplicationFirewallOperatorGreaterThan ... - WebApplicationFirewallOperatorGreaterThan WebApplicationFirewallOperator = "GreaterThan" - // WebApplicationFirewallOperatorGreaterThanOrEqual ... - WebApplicationFirewallOperatorGreaterThanOrEqual WebApplicationFirewallOperator = "GreaterThanOrEqual" - // WebApplicationFirewallOperatorIPMatch ... - WebApplicationFirewallOperatorIPMatch WebApplicationFirewallOperator = "IPMatch" - // WebApplicationFirewallOperatorLessThan ... - WebApplicationFirewallOperatorLessThan WebApplicationFirewallOperator = "LessThan" - // WebApplicationFirewallOperatorLessThanOrEqual ... - WebApplicationFirewallOperatorLessThanOrEqual WebApplicationFirewallOperator = "LessThanOrEqual" - // WebApplicationFirewallOperatorRegex ... - WebApplicationFirewallOperatorRegex WebApplicationFirewallOperator = "Regex" -) - -// PossibleWebApplicationFirewallOperatorValues returns an array of possible values for the WebApplicationFirewallOperator const type. -func PossibleWebApplicationFirewallOperatorValues() []WebApplicationFirewallOperator { - return []WebApplicationFirewallOperator{WebApplicationFirewallOperatorAny, WebApplicationFirewallOperatorBeginsWith, WebApplicationFirewallOperatorContains, WebApplicationFirewallOperatorEndsWith, WebApplicationFirewallOperatorEqual, WebApplicationFirewallOperatorGeoMatch, WebApplicationFirewallOperatorGreaterThan, WebApplicationFirewallOperatorGreaterThanOrEqual, WebApplicationFirewallOperatorIPMatch, WebApplicationFirewallOperatorLessThan, WebApplicationFirewallOperatorLessThanOrEqual, WebApplicationFirewallOperatorRegex} -} - -// WebApplicationFirewallPolicyResourceState enumerates the values for web application firewall policy resource -// state. -type WebApplicationFirewallPolicyResourceState string - -const ( - // WebApplicationFirewallPolicyResourceStateCreating ... - WebApplicationFirewallPolicyResourceStateCreating WebApplicationFirewallPolicyResourceState = "Creating" - // WebApplicationFirewallPolicyResourceStateDeleting ... - WebApplicationFirewallPolicyResourceStateDeleting WebApplicationFirewallPolicyResourceState = "Deleting" - // WebApplicationFirewallPolicyResourceStateDisabled ... - WebApplicationFirewallPolicyResourceStateDisabled WebApplicationFirewallPolicyResourceState = "Disabled" - // WebApplicationFirewallPolicyResourceStateDisabling ... - WebApplicationFirewallPolicyResourceStateDisabling WebApplicationFirewallPolicyResourceState = "Disabling" - // WebApplicationFirewallPolicyResourceStateEnabled ... - WebApplicationFirewallPolicyResourceStateEnabled WebApplicationFirewallPolicyResourceState = "Enabled" - // WebApplicationFirewallPolicyResourceStateEnabling ... - WebApplicationFirewallPolicyResourceStateEnabling WebApplicationFirewallPolicyResourceState = "Enabling" -) - -// PossibleWebApplicationFirewallPolicyResourceStateValues returns an array of possible values for the WebApplicationFirewallPolicyResourceState const type. -func PossibleWebApplicationFirewallPolicyResourceStateValues() []WebApplicationFirewallPolicyResourceState { - return []WebApplicationFirewallPolicyResourceState{WebApplicationFirewallPolicyResourceStateCreating, WebApplicationFirewallPolicyResourceStateDeleting, WebApplicationFirewallPolicyResourceStateDisabled, WebApplicationFirewallPolicyResourceStateDisabling, WebApplicationFirewallPolicyResourceStateEnabled, WebApplicationFirewallPolicyResourceStateEnabling} -} - -// WebApplicationFirewallRuleType enumerates the values for web application firewall rule type. -type WebApplicationFirewallRuleType string - -const ( - // WebApplicationFirewallRuleTypeInvalid ... - WebApplicationFirewallRuleTypeInvalid WebApplicationFirewallRuleType = "Invalid" - // WebApplicationFirewallRuleTypeMatchRule ... - WebApplicationFirewallRuleTypeMatchRule WebApplicationFirewallRuleType = "MatchRule" -) - -// PossibleWebApplicationFirewallRuleTypeValues returns an array of possible values for the WebApplicationFirewallRuleType const type. -func PossibleWebApplicationFirewallRuleTypeValues() []WebApplicationFirewallRuleType { - return []WebApplicationFirewallRuleType{WebApplicationFirewallRuleTypeInvalid, WebApplicationFirewallRuleTypeMatchRule} -} - -// WebApplicationFirewallTransform enumerates the values for web application firewall transform. -type WebApplicationFirewallTransform string - -const ( - // WebApplicationFirewallTransformHTMLEntityDecode ... - WebApplicationFirewallTransformHTMLEntityDecode WebApplicationFirewallTransform = "HtmlEntityDecode" - // WebApplicationFirewallTransformLowercase ... - WebApplicationFirewallTransformLowercase WebApplicationFirewallTransform = "Lowercase" - // WebApplicationFirewallTransformRemoveNulls ... - WebApplicationFirewallTransformRemoveNulls WebApplicationFirewallTransform = "RemoveNulls" - // WebApplicationFirewallTransformTrim ... - WebApplicationFirewallTransformTrim WebApplicationFirewallTransform = "Trim" - // WebApplicationFirewallTransformURLDecode ... - WebApplicationFirewallTransformURLDecode WebApplicationFirewallTransform = "UrlDecode" - // WebApplicationFirewallTransformURLEncode ... - WebApplicationFirewallTransformURLEncode WebApplicationFirewallTransform = "UrlEncode" - // WebApplicationFirewallTransformUppercase ... - WebApplicationFirewallTransformUppercase WebApplicationFirewallTransform = "Uppercase" -) - -// PossibleWebApplicationFirewallTransformValues returns an array of possible values for the WebApplicationFirewallTransform const type. -func PossibleWebApplicationFirewallTransformValues() []WebApplicationFirewallTransform { - return []WebApplicationFirewallTransform{WebApplicationFirewallTransformHTMLEntityDecode, WebApplicationFirewallTransformLowercase, WebApplicationFirewallTransformRemoveNulls, WebApplicationFirewallTransformTrim, WebApplicationFirewallTransformURLDecode, WebApplicationFirewallTransformURLEncode, WebApplicationFirewallTransformUppercase} -} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/models.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/models.go deleted file mode 100644 index 12eeabd0c72b..000000000000 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/models.go +++ /dev/null @@ -1,58004 +0,0 @@ -package network - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" -) - -// The package's fully qualified name. -const fqdn = "home/runner/work/kermit/kermit/sdk/network/2022-05-01/network" - -// AadAuthenticationParameters AAD Vpn authentication type related parameters. -type AadAuthenticationParameters struct { - // AadTenant - AAD Vpn authentication parameter AAD tenant. - AadTenant *string `json:"aadTenant,omitempty"` - // AadAudience - AAD Vpn authentication parameter AAD audience. - AadAudience *string `json:"aadAudience,omitempty"` - // AadIssuer - AAD Vpn authentication parameter AAD issuer. - AadIssuer *string `json:"aadIssuer,omitempty"` -} - -// Action action to be taken on a route matching a RouteMap criterion. -type Action struct { - // Type - Type of action to be taken. Supported types are 'Remove', 'Add', 'Replace', and 'Drop.'. Possible values include: 'RouteMapActionTypeUnknown', 'RouteMapActionTypeRemove', 'RouteMapActionTypeAdd', 'RouteMapActionTypeReplace', 'RouteMapActionTypeDrop' - Type RouteMapActionType `json:"type,omitempty"` - // Parameters - List of parameters relevant to the action.For instance if type is drop then parameters has list of prefixes to be dropped.If type is add, parameters would have list of ASN numbers to be added - Parameters *[]Parameter `json:"parameters,omitempty"` -} - -// BasicActiveBaseSecurityAdminRule network base admin rule. -type BasicActiveBaseSecurityAdminRule interface { - AsActiveSecurityAdminRule() (*ActiveSecurityAdminRule, bool) - AsActiveDefaultSecurityAdminRule() (*ActiveDefaultSecurityAdminRule, bool) - AsActiveBaseSecurityAdminRule() (*ActiveBaseSecurityAdminRule, bool) -} - -// ActiveBaseSecurityAdminRule network base admin rule. -type ActiveBaseSecurityAdminRule struct { - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // CommitTime - Deployment time string. - CommitTime *date.Time `json:"commitTime,omitempty"` - // Region - Deployment region. - Region *string `json:"region,omitempty"` - // ConfigurationDescription - A description of the security admin configuration. - ConfigurationDescription *string `json:"configurationDescription,omitempty"` - // RuleCollectionDescription - A description of the rule collection. - RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` - // RuleCollectionAppliesToGroups - Groups for rule collection - RuleCollectionAppliesToGroups *[]ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` - // RuleGroups - Effective configuration groups. - RuleGroups *[]ConfigurationGroup `json:"ruleGroups,omitempty"` - // Kind - Possible values include: 'KindActiveBaseSecurityAdminRule', 'KindCustom', 'KindDefault' - Kind Kind `json:"kind,omitempty"` -} - -func unmarshalBasicActiveBaseSecurityAdminRule(body []byte) (BasicActiveBaseSecurityAdminRule, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["kind"] { - case string(KindCustom): - var asar ActiveSecurityAdminRule - err := json.Unmarshal(body, &asar) - return asar, err - case string(KindDefault): - var adsar ActiveDefaultSecurityAdminRule - err := json.Unmarshal(body, &adsar) - return adsar, err - default: - var absar ActiveBaseSecurityAdminRule - err := json.Unmarshal(body, &absar) - return absar, err - } -} -func unmarshalBasicActiveBaseSecurityAdminRuleArray(body []byte) ([]BasicActiveBaseSecurityAdminRule, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - absarArray := make([]BasicActiveBaseSecurityAdminRule, len(rawMessages)) - - for index, rawMessage := range rawMessages { - absar, err := unmarshalBasicActiveBaseSecurityAdminRule(*rawMessage) - if err != nil { - return nil, err - } - absarArray[index] = absar - } - return absarArray, nil -} - -// MarshalJSON is the custom marshaler for ActiveBaseSecurityAdminRule. -func (absar ActiveBaseSecurityAdminRule) MarshalJSON() ([]byte, error) { - absar.Kind = KindActiveBaseSecurityAdminRule - objectMap := make(map[string]interface{}) - if absar.ID != nil { - objectMap["id"] = absar.ID - } - if absar.CommitTime != nil { - objectMap["commitTime"] = absar.CommitTime - } - if absar.Region != nil { - objectMap["region"] = absar.Region - } - if absar.ConfigurationDescription != nil { - objectMap["configurationDescription"] = absar.ConfigurationDescription - } - if absar.RuleCollectionDescription != nil { - objectMap["ruleCollectionDescription"] = absar.RuleCollectionDescription - } - if absar.RuleCollectionAppliesToGroups != nil { - objectMap["ruleCollectionAppliesToGroups"] = absar.RuleCollectionAppliesToGroups - } - if absar.RuleGroups != nil { - objectMap["ruleGroups"] = absar.RuleGroups - } - if absar.Kind != "" { - objectMap["kind"] = absar.Kind - } - return json.Marshal(objectMap) -} - -// AsActiveSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveBaseSecurityAdminRule. -func (absar ActiveBaseSecurityAdminRule) AsActiveSecurityAdminRule() (*ActiveSecurityAdminRule, bool) { - return nil, false -} - -// AsActiveDefaultSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveBaseSecurityAdminRule. -func (absar ActiveBaseSecurityAdminRule) AsActiveDefaultSecurityAdminRule() (*ActiveDefaultSecurityAdminRule, bool) { - return nil, false -} - -// AsActiveBaseSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveBaseSecurityAdminRule. -func (absar ActiveBaseSecurityAdminRule) AsActiveBaseSecurityAdminRule() (*ActiveBaseSecurityAdminRule, bool) { - return &absar, true -} - -// AsBasicActiveBaseSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveBaseSecurityAdminRule. -func (absar ActiveBaseSecurityAdminRule) AsBasicActiveBaseSecurityAdminRule() (BasicActiveBaseSecurityAdminRule, bool) { - return &absar, true -} - -// ActiveConfigurationParameter effective Virtual Networks Parameter. -type ActiveConfigurationParameter struct { - // Regions - List of regions. - Regions *[]string `json:"regions,omitempty"` - // SkipToken - When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. - SkipToken *string `json:"skipToken,omitempty"` -} - -// ActiveConnectivityConfiguration active connectivity configuration. -type ActiveConnectivityConfiguration struct { - // CommitTime - Deployment time string. - CommitTime *date.Time `json:"commitTime,omitempty"` - // Region - Deployment region. - Region *string `json:"region,omitempty"` - // ID - Connectivity configuration ID. - ID *string `json:"id,omitempty"` - // ConnectivityConfigurationProperties - Properties of a network manager connectivity configuration - *ConnectivityConfigurationProperties `json:"properties,omitempty"` - // ConfigurationGroups - Effective configuration groups. - ConfigurationGroups *[]ConfigurationGroup `json:"configurationGroups,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActiveConnectivityConfiguration. -func (acc ActiveConnectivityConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acc.CommitTime != nil { - objectMap["commitTime"] = acc.CommitTime - } - if acc.Region != nil { - objectMap["region"] = acc.Region - } - if acc.ID != nil { - objectMap["id"] = acc.ID - } - if acc.ConnectivityConfigurationProperties != nil { - objectMap["properties"] = acc.ConnectivityConfigurationProperties - } - if acc.ConfigurationGroups != nil { - objectMap["configurationGroups"] = acc.ConfigurationGroups - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ActiveConnectivityConfiguration struct. -func (acc *ActiveConnectivityConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "commitTime": - if v != nil { - var commitTime date.Time - err = json.Unmarshal(*v, &commitTime) - if err != nil { - return err - } - acc.CommitTime = &commitTime - } - case "region": - if v != nil { - var region string - err = json.Unmarshal(*v, ®ion) - if err != nil { - return err - } - acc.Region = ®ion - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - acc.ID = &ID - } - case "properties": - if v != nil { - var connectivityConfigurationProperties ConnectivityConfigurationProperties - err = json.Unmarshal(*v, &connectivityConfigurationProperties) - if err != nil { - return err - } - acc.ConnectivityConfigurationProperties = &connectivityConfigurationProperties - } - case "configurationGroups": - if v != nil { - var configurationGroups []ConfigurationGroup - err = json.Unmarshal(*v, &configurationGroups) - if err != nil { - return err - } - acc.ConfigurationGroups = &configurationGroups - } - } - } - - return nil -} - -// ActiveConnectivityConfigurationsListResult result of the request to list active connectivity -// configurations. It contains a list of active connectivity configurations and a skiptoken to get the next -// set of results. -type ActiveConnectivityConfigurationsListResult struct { - autorest.Response `json:"-"` - // Value - Gets a page of active connectivity configurations. - Value *[]ActiveConnectivityConfiguration `json:"value,omitempty"` - // SkipToken - When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. - SkipToken *string `json:"skipToken,omitempty"` -} - -// ActiveDefaultSecurityAdminRule network default admin rule. -type ActiveDefaultSecurityAdminRule struct { - // DefaultAdminPropertiesFormat - Indicates the properties of the default security admin rule - *DefaultAdminPropertiesFormat `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // CommitTime - Deployment time string. - CommitTime *date.Time `json:"commitTime,omitempty"` - // Region - Deployment region. - Region *string `json:"region,omitempty"` - // ConfigurationDescription - A description of the security admin configuration. - ConfigurationDescription *string `json:"configurationDescription,omitempty"` - // RuleCollectionDescription - A description of the rule collection. - RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` - // RuleCollectionAppliesToGroups - Groups for rule collection - RuleCollectionAppliesToGroups *[]ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` - // RuleGroups - Effective configuration groups. - RuleGroups *[]ConfigurationGroup `json:"ruleGroups,omitempty"` - // Kind - Possible values include: 'KindActiveBaseSecurityAdminRule', 'KindCustom', 'KindDefault' - Kind Kind `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActiveDefaultSecurityAdminRule. -func (adsar ActiveDefaultSecurityAdminRule) MarshalJSON() ([]byte, error) { - adsar.Kind = KindDefault - objectMap := make(map[string]interface{}) - if adsar.DefaultAdminPropertiesFormat != nil { - objectMap["properties"] = adsar.DefaultAdminPropertiesFormat - } - if adsar.ID != nil { - objectMap["id"] = adsar.ID - } - if adsar.CommitTime != nil { - objectMap["commitTime"] = adsar.CommitTime - } - if adsar.Region != nil { - objectMap["region"] = adsar.Region - } - if adsar.ConfigurationDescription != nil { - objectMap["configurationDescription"] = adsar.ConfigurationDescription - } - if adsar.RuleCollectionDescription != nil { - objectMap["ruleCollectionDescription"] = adsar.RuleCollectionDescription - } - if adsar.RuleCollectionAppliesToGroups != nil { - objectMap["ruleCollectionAppliesToGroups"] = adsar.RuleCollectionAppliesToGroups - } - if adsar.RuleGroups != nil { - objectMap["ruleGroups"] = adsar.RuleGroups - } - if adsar.Kind != "" { - objectMap["kind"] = adsar.Kind - } - return json.Marshal(objectMap) -} - -// AsActiveSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveDefaultSecurityAdminRule. -func (adsar ActiveDefaultSecurityAdminRule) AsActiveSecurityAdminRule() (*ActiveSecurityAdminRule, bool) { - return nil, false -} - -// AsActiveDefaultSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveDefaultSecurityAdminRule. -func (adsar ActiveDefaultSecurityAdminRule) AsActiveDefaultSecurityAdminRule() (*ActiveDefaultSecurityAdminRule, bool) { - return &adsar, true -} - -// AsActiveBaseSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveDefaultSecurityAdminRule. -func (adsar ActiveDefaultSecurityAdminRule) AsActiveBaseSecurityAdminRule() (*ActiveBaseSecurityAdminRule, bool) { - return nil, false -} - -// AsBasicActiveBaseSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveDefaultSecurityAdminRule. -func (adsar ActiveDefaultSecurityAdminRule) AsBasicActiveBaseSecurityAdminRule() (BasicActiveBaseSecurityAdminRule, bool) { - return &adsar, true -} - -// UnmarshalJSON is the custom unmarshaler for ActiveDefaultSecurityAdminRule struct. -func (adsar *ActiveDefaultSecurityAdminRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var defaultAdminPropertiesFormat DefaultAdminPropertiesFormat - err = json.Unmarshal(*v, &defaultAdminPropertiesFormat) - if err != nil { - return err - } - adsar.DefaultAdminPropertiesFormat = &defaultAdminPropertiesFormat - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - adsar.ID = &ID - } - case "commitTime": - if v != nil { - var commitTime date.Time - err = json.Unmarshal(*v, &commitTime) - if err != nil { - return err - } - adsar.CommitTime = &commitTime - } - case "region": - if v != nil { - var region string - err = json.Unmarshal(*v, ®ion) - if err != nil { - return err - } - adsar.Region = ®ion - } - case "configurationDescription": - if v != nil { - var configurationDescription string - err = json.Unmarshal(*v, &configurationDescription) - if err != nil { - return err - } - adsar.ConfigurationDescription = &configurationDescription - } - case "ruleCollectionDescription": - if v != nil { - var ruleCollectionDescription string - err = json.Unmarshal(*v, &ruleCollectionDescription) - if err != nil { - return err - } - adsar.RuleCollectionDescription = &ruleCollectionDescription - } - case "ruleCollectionAppliesToGroups": - if v != nil { - var ruleCollectionAppliesToGroups []ManagerSecurityGroupItem - err = json.Unmarshal(*v, &ruleCollectionAppliesToGroups) - if err != nil { - return err - } - adsar.RuleCollectionAppliesToGroups = &ruleCollectionAppliesToGroups - } - case "ruleGroups": - if v != nil { - var ruleGroups []ConfigurationGroup - err = json.Unmarshal(*v, &ruleGroups) - if err != nil { - return err - } - adsar.RuleGroups = &ruleGroups - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - adsar.Kind = kind - } - } - } - - return nil -} - -// ActiveSecurityAdminRule network admin rule. -type ActiveSecurityAdminRule struct { - // AdminPropertiesFormat - Indicates the properties of the security admin rule - *AdminPropertiesFormat `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // CommitTime - Deployment time string. - CommitTime *date.Time `json:"commitTime,omitempty"` - // Region - Deployment region. - Region *string `json:"region,omitempty"` - // ConfigurationDescription - A description of the security admin configuration. - ConfigurationDescription *string `json:"configurationDescription,omitempty"` - // RuleCollectionDescription - A description of the rule collection. - RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` - // RuleCollectionAppliesToGroups - Groups for rule collection - RuleCollectionAppliesToGroups *[]ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` - // RuleGroups - Effective configuration groups. - RuleGroups *[]ConfigurationGroup `json:"ruleGroups,omitempty"` - // Kind - Possible values include: 'KindActiveBaseSecurityAdminRule', 'KindCustom', 'KindDefault' - Kind Kind `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActiveSecurityAdminRule. -func (asar ActiveSecurityAdminRule) MarshalJSON() ([]byte, error) { - asar.Kind = KindCustom - objectMap := make(map[string]interface{}) - if asar.AdminPropertiesFormat != nil { - objectMap["properties"] = asar.AdminPropertiesFormat - } - if asar.ID != nil { - objectMap["id"] = asar.ID - } - if asar.CommitTime != nil { - objectMap["commitTime"] = asar.CommitTime - } - if asar.Region != nil { - objectMap["region"] = asar.Region - } - if asar.ConfigurationDescription != nil { - objectMap["configurationDescription"] = asar.ConfigurationDescription - } - if asar.RuleCollectionDescription != nil { - objectMap["ruleCollectionDescription"] = asar.RuleCollectionDescription - } - if asar.RuleCollectionAppliesToGroups != nil { - objectMap["ruleCollectionAppliesToGroups"] = asar.RuleCollectionAppliesToGroups - } - if asar.RuleGroups != nil { - objectMap["ruleGroups"] = asar.RuleGroups - } - if asar.Kind != "" { - objectMap["kind"] = asar.Kind - } - return json.Marshal(objectMap) -} - -// AsActiveSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveSecurityAdminRule. -func (asar ActiveSecurityAdminRule) AsActiveSecurityAdminRule() (*ActiveSecurityAdminRule, bool) { - return &asar, true -} - -// AsActiveDefaultSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveSecurityAdminRule. -func (asar ActiveSecurityAdminRule) AsActiveDefaultSecurityAdminRule() (*ActiveDefaultSecurityAdminRule, bool) { - return nil, false -} - -// AsActiveBaseSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveSecurityAdminRule. -func (asar ActiveSecurityAdminRule) AsActiveBaseSecurityAdminRule() (*ActiveBaseSecurityAdminRule, bool) { - return nil, false -} - -// AsBasicActiveBaseSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveSecurityAdminRule. -func (asar ActiveSecurityAdminRule) AsBasicActiveBaseSecurityAdminRule() (BasicActiveBaseSecurityAdminRule, bool) { - return &asar, true -} - -// UnmarshalJSON is the custom unmarshaler for ActiveSecurityAdminRule struct. -func (asar *ActiveSecurityAdminRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var adminPropertiesFormat AdminPropertiesFormat - err = json.Unmarshal(*v, &adminPropertiesFormat) - if err != nil { - return err - } - asar.AdminPropertiesFormat = &adminPropertiesFormat - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asar.ID = &ID - } - case "commitTime": - if v != nil { - var commitTime date.Time - err = json.Unmarshal(*v, &commitTime) - if err != nil { - return err - } - asar.CommitTime = &commitTime - } - case "region": - if v != nil { - var region string - err = json.Unmarshal(*v, ®ion) - if err != nil { - return err - } - asar.Region = ®ion - } - case "configurationDescription": - if v != nil { - var configurationDescription string - err = json.Unmarshal(*v, &configurationDescription) - if err != nil { - return err - } - asar.ConfigurationDescription = &configurationDescription - } - case "ruleCollectionDescription": - if v != nil { - var ruleCollectionDescription string - err = json.Unmarshal(*v, &ruleCollectionDescription) - if err != nil { - return err - } - asar.RuleCollectionDescription = &ruleCollectionDescription - } - case "ruleCollectionAppliesToGroups": - if v != nil { - var ruleCollectionAppliesToGroups []ManagerSecurityGroupItem - err = json.Unmarshal(*v, &ruleCollectionAppliesToGroups) - if err != nil { - return err - } - asar.RuleCollectionAppliesToGroups = &ruleCollectionAppliesToGroups - } - case "ruleGroups": - if v != nil { - var ruleGroups []ConfigurationGroup - err = json.Unmarshal(*v, &ruleGroups) - if err != nil { - return err - } - asar.RuleGroups = &ruleGroups - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - asar.Kind = kind - } - } - } - - return nil -} - -// ActiveSecurityAdminRulesListResult result of the request to list active security admin rules. It -// contains a list of active security admin rules and a skiptoken to get the next set of results. -type ActiveSecurityAdminRulesListResult struct { - autorest.Response `json:"-"` - // Value - Gets a page of active security admin rules. - Value *[]BasicActiveBaseSecurityAdminRule `json:"value,omitempty"` - // SkipToken - When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. - SkipToken *string `json:"skipToken,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for ActiveSecurityAdminRulesListResult struct. -func (asarlr *ActiveSecurityAdminRulesListResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "value": - if v != nil { - value, err := unmarshalBasicActiveBaseSecurityAdminRuleArray(*v) - if err != nil { - return err - } - asarlr.Value = &value - } - case "skipToken": - if v != nil { - var skipToken string - err = json.Unmarshal(*v, &skipToken) - if err != nil { - return err - } - asarlr.SkipToken = &skipToken - } - } - } - - return nil -} - -// AddressPrefixItem address prefix item. -type AddressPrefixItem struct { - // AddressPrefix - Address prefix. - AddressPrefix *string `json:"addressPrefix,omitempty"` - // AddressPrefixType - Address prefix type. Possible values include: 'AddressPrefixTypeIPPrefix', 'AddressPrefixTypeServiceTag' - AddressPrefixType AddressPrefixType `json:"addressPrefixType,omitempty"` -} - -// AddressSpace addressSpace contains an array of IP address ranges that can be used by subnets of the -// virtual network. -type AddressSpace struct { - // AddressPrefixes - A list of address blocks reserved for this virtual network in CIDR notation. - AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` -} - -// AdminPropertiesFormat security admin rule resource. -type AdminPropertiesFormat struct { - // Description - A description for this rule. Restricted to 140 chars. - Description *string `json:"description,omitempty"` - // Protocol - Network protocol this rule applies to. Possible values include: 'SecurityConfigurationRuleProtocolTCP', 'SecurityConfigurationRuleProtocolUDP', 'SecurityConfigurationRuleProtocolIcmp', 'SecurityConfigurationRuleProtocolEsp', 'SecurityConfigurationRuleProtocolAny', 'SecurityConfigurationRuleProtocolAh' - Protocol SecurityConfigurationRuleProtocol `json:"protocol,omitempty"` - // Sources - The CIDR or source IP ranges. - Sources *[]AddressPrefixItem `json:"sources,omitempty"` - // Destinations - The destination address prefixes. CIDR or destination IP ranges. - Destinations *[]AddressPrefixItem `json:"destinations,omitempty"` - // SourcePortRanges - The source port ranges. - SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` - // DestinationPortRanges - The destination port ranges. - DestinationPortRanges *[]string `json:"destinationPortRanges,omitempty"` - // Access - Indicates the access allowed for this particular rule. Possible values include: 'SecurityConfigurationRuleAccessAllow', 'SecurityConfigurationRuleAccessDeny', 'SecurityConfigurationRuleAccessAlwaysAllow' - Access SecurityConfigurationRuleAccess `json:"access,omitempty"` - // Priority - The priority of the rule. The value can be between 1 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. - Priority *int32 `json:"priority,omitempty"` - // Direction - Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: 'SecurityConfigurationRuleDirectionInbound', 'SecurityConfigurationRuleDirectionOutbound' - Direction SecurityConfigurationRuleDirection `json:"direction,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for AdminPropertiesFormat. -func (apf AdminPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if apf.Description != nil { - objectMap["description"] = apf.Description - } - if apf.Protocol != "" { - objectMap["protocol"] = apf.Protocol - } - if apf.Sources != nil { - objectMap["sources"] = apf.Sources - } - if apf.Destinations != nil { - objectMap["destinations"] = apf.Destinations - } - if apf.SourcePortRanges != nil { - objectMap["sourcePortRanges"] = apf.SourcePortRanges - } - if apf.DestinationPortRanges != nil { - objectMap["destinationPortRanges"] = apf.DestinationPortRanges - } - if apf.Access != "" { - objectMap["access"] = apf.Access - } - if apf.Priority != nil { - objectMap["priority"] = apf.Priority - } - if apf.Direction != "" { - objectMap["direction"] = apf.Direction - } - return json.Marshal(objectMap) -} - -// AdminRule network admin rule. -type AdminRule struct { - // AdminPropertiesFormat - Indicates the properties of the security admin rule - *AdminPropertiesFormat `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata related to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Kind - Possible values include: 'KindBasicBaseAdminRuleKindBaseAdminRule', 'KindBasicBaseAdminRuleKindCustom', 'KindBasicBaseAdminRuleKindDefault' - Kind KindBasicBaseAdminRule `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for AdminRule. -func (ar AdminRule) MarshalJSON() ([]byte, error) { - ar.Kind = KindBasicBaseAdminRuleKindCustom - objectMap := make(map[string]interface{}) - if ar.AdminPropertiesFormat != nil { - objectMap["properties"] = ar.AdminPropertiesFormat - } - if ar.Kind != "" { - objectMap["kind"] = ar.Kind - } - return json.Marshal(objectMap) -} - -// AsAdminRule is the BasicBaseAdminRule implementation for AdminRule. -func (ar AdminRule) AsAdminRule() (*AdminRule, bool) { - return &ar, true -} - -// AsDefaultAdminRule is the BasicBaseAdminRule implementation for AdminRule. -func (ar AdminRule) AsDefaultAdminRule() (*DefaultAdminRule, bool) { - return nil, false -} - -// AsBaseAdminRule is the BasicBaseAdminRule implementation for AdminRule. -func (ar AdminRule) AsBaseAdminRule() (*BaseAdminRule, bool) { - return nil, false -} - -// AsBasicBaseAdminRule is the BasicBaseAdminRule implementation for AdminRule. -func (ar AdminRule) AsBasicBaseAdminRule() (BasicBaseAdminRule, bool) { - return &ar, true -} - -// UnmarshalJSON is the custom unmarshaler for AdminRule struct. -func (ar *AdminRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var adminPropertiesFormat AdminPropertiesFormat - err = json.Unmarshal(*v, &adminPropertiesFormat) - if err != nil { - return err - } - ar.AdminPropertiesFormat = &adminPropertiesFormat - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ar.SystemData = &systemData - } - case "kind": - if v != nil { - var kind KindBasicBaseAdminRule - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ar.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ar.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ar.Etag = &etag - } - } - } - - return nil -} - -// AdminRuleCollection defines the admin rule collection. -type AdminRuleCollection struct { - autorest.Response `json:"-"` - // AdminRuleCollectionPropertiesFormat - Indicates the properties for the network manager admin rule collection. - *AdminRuleCollectionPropertiesFormat `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata related to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for AdminRuleCollection. -func (arc AdminRuleCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arc.AdminRuleCollectionPropertiesFormat != nil { - objectMap["properties"] = arc.AdminRuleCollectionPropertiesFormat - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AdminRuleCollection struct. -func (arc *AdminRuleCollection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var adminRuleCollectionPropertiesFormat AdminRuleCollectionPropertiesFormat - err = json.Unmarshal(*v, &adminRuleCollectionPropertiesFormat) - if err != nil { - return err - } - arc.AdminRuleCollectionPropertiesFormat = &adminRuleCollectionPropertiesFormat - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - arc.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - arc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - arc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - arc.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - arc.Etag = &etag - } - } - } - - return nil -} - -// AdminRuleCollectionListResult security admin configuration rule collection list result. -type AdminRuleCollectionListResult struct { - autorest.Response `json:"-"` - // Value - A list of network manager security admin configuration rule collections - Value *[]AdminRuleCollection `json:"value,omitempty"` - // NextLink - Gets the URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AdminRuleCollectionListResultIterator provides access to a complete listing of AdminRuleCollection -// values. -type AdminRuleCollectionListResultIterator struct { - i int - page AdminRuleCollectionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AdminRuleCollectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdminRuleCollectionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AdminRuleCollectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AdminRuleCollectionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AdminRuleCollectionListResultIterator) Response() AdminRuleCollectionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AdminRuleCollectionListResultIterator) Value() AdminRuleCollection { - if !iter.page.NotDone() { - return AdminRuleCollection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AdminRuleCollectionListResultIterator type. -func NewAdminRuleCollectionListResultIterator(page AdminRuleCollectionListResultPage) AdminRuleCollectionListResultIterator { - return AdminRuleCollectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (arclr AdminRuleCollectionListResult) IsEmpty() bool { - return arclr.Value == nil || len(*arclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (arclr AdminRuleCollectionListResult) hasNextLink() bool { - return arclr.NextLink != nil && len(*arclr.NextLink) != 0 -} - -// adminRuleCollectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (arclr AdminRuleCollectionListResult) adminRuleCollectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !arclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(arclr.NextLink))) -} - -// AdminRuleCollectionListResultPage contains a page of AdminRuleCollection values. -type AdminRuleCollectionListResultPage struct { - fn func(context.Context, AdminRuleCollectionListResult) (AdminRuleCollectionListResult, error) - arclr AdminRuleCollectionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AdminRuleCollectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdminRuleCollectionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.arclr) - if err != nil { - return err - } - page.arclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AdminRuleCollectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AdminRuleCollectionListResultPage) NotDone() bool { - return !page.arclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AdminRuleCollectionListResultPage) Response() AdminRuleCollectionListResult { - return page.arclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AdminRuleCollectionListResultPage) Values() []AdminRuleCollection { - if page.arclr.IsEmpty() { - return nil - } - return *page.arclr.Value -} - -// Creates a new instance of the AdminRuleCollectionListResultPage type. -func NewAdminRuleCollectionListResultPage(cur AdminRuleCollectionListResult, getNextPage func(context.Context, AdminRuleCollectionListResult) (AdminRuleCollectionListResult, error)) AdminRuleCollectionListResultPage { - return AdminRuleCollectionListResultPage{ - fn: getNextPage, - arclr: cur, - } -} - -// AdminRuleCollectionPropertiesFormat defines the admin rule collection properties. -type AdminRuleCollectionPropertiesFormat struct { - // Description - A description of the admin rule collection. - Description *string `json:"description,omitempty"` - // AppliesToGroups - Groups for configuration - AppliesToGroups *[]ManagerSecurityGroupItem `json:"appliesToGroups,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for AdminRuleCollectionPropertiesFormat. -func (arcpf AdminRuleCollectionPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arcpf.Description != nil { - objectMap["description"] = arcpf.Description - } - if arcpf.AppliesToGroups != nil { - objectMap["appliesToGroups"] = arcpf.AppliesToGroups - } - return json.Marshal(objectMap) -} - -// AdminRuleCollectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type AdminRuleCollectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AdminRuleCollectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AdminRuleCollectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AdminRuleCollectionsDeleteFuture.Result. -func (future *AdminRuleCollectionsDeleteFuture) result(client AdminRuleCollectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.AdminRuleCollectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.AdminRuleCollectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AdminRuleListResult security configuration admin rule list result. -type AdminRuleListResult struct { - autorest.Response `json:"-"` - // Value - A list of admin rules - Value *[]BasicBaseAdminRule `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for AdminRuleListResult struct. -func (arlr *AdminRuleListResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "value": - if v != nil { - value, err := unmarshalBasicBaseAdminRuleArray(*v) - if err != nil { - return err - } - arlr.Value = &value - } - case "nextLink": - if v != nil { - var nextLink string - err = json.Unmarshal(*v, &nextLink) - if err != nil { - return err - } - arlr.NextLink = &nextLink - } - } - } - - return nil -} - -// AdminRuleListResultIterator provides access to a complete listing of BaseAdminRule values. -type AdminRuleListResultIterator struct { - i int - page AdminRuleListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AdminRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdminRuleListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AdminRuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AdminRuleListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AdminRuleListResultIterator) Response() AdminRuleListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AdminRuleListResultIterator) Value() BasicBaseAdminRule { - if !iter.page.NotDone() { - return BaseAdminRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AdminRuleListResultIterator type. -func NewAdminRuleListResultIterator(page AdminRuleListResultPage) AdminRuleListResultIterator { - return AdminRuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (arlr AdminRuleListResult) IsEmpty() bool { - return arlr.Value == nil || len(*arlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (arlr AdminRuleListResult) hasNextLink() bool { - return arlr.NextLink != nil && len(*arlr.NextLink) != 0 -} - -// adminRuleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (arlr AdminRuleListResult) adminRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !arlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(arlr.NextLink))) -} - -// AdminRuleListResultPage contains a page of BasicBaseAdminRule values. -type AdminRuleListResultPage struct { - fn func(context.Context, AdminRuleListResult) (AdminRuleListResult, error) - arlr AdminRuleListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AdminRuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdminRuleListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.arlr) - if err != nil { - return err - } - page.arlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AdminRuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AdminRuleListResultPage) NotDone() bool { - return !page.arlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AdminRuleListResultPage) Response() AdminRuleListResult { - return page.arlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AdminRuleListResultPage) Values() []BasicBaseAdminRule { - if page.arlr.IsEmpty() { - return nil - } - return *page.arlr.Value -} - -// Creates a new instance of the AdminRuleListResultPage type. -func NewAdminRuleListResultPage(cur AdminRuleListResult, getNextPage func(context.Context, AdminRuleListResult) (AdminRuleListResult, error)) AdminRuleListResultPage { - return AdminRuleListResultPage{ - fn: getNextPage, - arlr: cur, - } -} - -// AdminRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AdminRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AdminRulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AdminRulesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AdminRulesDeleteFuture.Result. -func (future *AdminRulesDeleteFuture) result(client AdminRulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.AdminRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.AdminRulesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationGateway application gateway resource. -type ApplicationGateway struct { - autorest.Response `json:"-"` - // ApplicationGatewayPropertiesFormat - Properties of the application gateway. - *ApplicationGatewayPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Zones - A list of availability zones denoting where the resource needs to come from. - Zones *[]string `json:"zones,omitempty"` - // Identity - The identity of the application gateway, if configured. - Identity *ManagedServiceIdentity `json:"identity,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ApplicationGateway. -func (ag ApplicationGateway) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ag.ApplicationGatewayPropertiesFormat != nil { - objectMap["properties"] = ag.ApplicationGatewayPropertiesFormat - } - if ag.Zones != nil { - objectMap["zones"] = ag.Zones - } - if ag.Identity != nil { - objectMap["identity"] = ag.Identity - } - if ag.ID != nil { - objectMap["id"] = ag.ID - } - if ag.Location != nil { - objectMap["location"] = ag.Location - } - if ag.Tags != nil { - objectMap["tags"] = ag.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGateway struct. -func (ag *ApplicationGateway) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayPropertiesFormat ApplicationGatewayPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayPropertiesFormat) - if err != nil { - return err - } - ag.ApplicationGatewayPropertiesFormat = &applicationGatewayPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ag.Etag = &etag - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - ag.Zones = &zones - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ag.Identity = &identity - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ag.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ag.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ag.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ag.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ag.Tags = tags - } - } - } - - return nil -} - -// ApplicationGatewayAuthenticationCertificate authentication certificates of an application gateway. -type ApplicationGatewayAuthenticationCertificate struct { - // ApplicationGatewayAuthenticationCertificatePropertiesFormat - Properties of the application gateway authentication certificate. - *ApplicationGatewayAuthenticationCertificatePropertiesFormat `json:"properties,omitempty"` - // Name - Name of the authentication certificate that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayAuthenticationCertificate. -func (agac ApplicationGatewayAuthenticationCertificate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agac.ApplicationGatewayAuthenticationCertificatePropertiesFormat != nil { - objectMap["properties"] = agac.ApplicationGatewayAuthenticationCertificatePropertiesFormat - } - if agac.Name != nil { - objectMap["name"] = agac.Name - } - if agac.ID != nil { - objectMap["id"] = agac.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayAuthenticationCertificate struct. -func (agac *ApplicationGatewayAuthenticationCertificate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayAuthenticationCertificatePropertiesFormat ApplicationGatewayAuthenticationCertificatePropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayAuthenticationCertificatePropertiesFormat) - if err != nil { - return err - } - agac.ApplicationGatewayAuthenticationCertificatePropertiesFormat = &applicationGatewayAuthenticationCertificatePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agac.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agac.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agac.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agac.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayAuthenticationCertificatePropertiesFormat authentication certificates properties of an -// application gateway. -type ApplicationGatewayAuthenticationCertificatePropertiesFormat struct { - // Data - Certificate public data. - Data *string `json:"data,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the authentication certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayAuthenticationCertificatePropertiesFormat. -func (agacpf ApplicationGatewayAuthenticationCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agacpf.Data != nil { - objectMap["data"] = agacpf.Data - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayAutoscaleConfiguration application Gateway autoscale configuration. -type ApplicationGatewayAutoscaleConfiguration struct { - // MinCapacity - Lower bound on number of Application Gateway capacity. - MinCapacity *int32 `json:"minCapacity,omitempty"` - // MaxCapacity - Upper bound on number of Application Gateway capacity. - MaxCapacity *int32 `json:"maxCapacity,omitempty"` -} - -// ApplicationGatewayAvailableSslOptions response for ApplicationGatewayAvailableSslOptions API service -// call. -type ApplicationGatewayAvailableSslOptions struct { - autorest.Response `json:"-"` - // ApplicationGatewayAvailableSslOptionsPropertiesFormat - Properties of the application gateway available SSL options. - *ApplicationGatewayAvailableSslOptionsPropertiesFormat `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayAvailableSslOptions. -func (agaso ApplicationGatewayAvailableSslOptions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agaso.ApplicationGatewayAvailableSslOptionsPropertiesFormat != nil { - objectMap["properties"] = agaso.ApplicationGatewayAvailableSslOptionsPropertiesFormat - } - if agaso.ID != nil { - objectMap["id"] = agaso.ID - } - if agaso.Location != nil { - objectMap["location"] = agaso.Location - } - if agaso.Tags != nil { - objectMap["tags"] = agaso.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayAvailableSslOptions struct. -func (agaso *ApplicationGatewayAvailableSslOptions) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayAvailableSslOptionsPropertiesFormat ApplicationGatewayAvailableSslOptionsPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayAvailableSslOptionsPropertiesFormat) - if err != nil { - return err - } - agaso.ApplicationGatewayAvailableSslOptionsPropertiesFormat = &applicationGatewayAvailableSslOptionsPropertiesFormat - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agaso.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agaso.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agaso.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - agaso.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - agaso.Tags = tags - } - } - } - - return nil -} - -// ApplicationGatewayAvailableSslOptionsPropertiesFormat properties of -// ApplicationGatewayAvailableSslOptions. -type ApplicationGatewayAvailableSslOptionsPropertiesFormat struct { - // PredefinedPolicies - List of available Ssl predefined policy. - PredefinedPolicies *[]SubResource `json:"predefinedPolicies,omitempty"` - // DefaultPolicy - Name of the Ssl predefined policy applied by default to application gateway. Possible values include: 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20150501', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401S', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101S' - DefaultPolicy ApplicationGatewaySslPolicyName `json:"defaultPolicy,omitempty"` - // AvailableCipherSuites - List of available Ssl cipher suites. - AvailableCipherSuites *[]ApplicationGatewaySslCipherSuite `json:"availableCipherSuites,omitempty"` - // AvailableProtocols - List of available Ssl protocols. - AvailableProtocols *[]ApplicationGatewaySslProtocol `json:"availableProtocols,omitempty"` -} - -// ApplicationGatewayAvailableSslPredefinedPolicies response for ApplicationGatewayAvailableSslOptions API -// service call. -type ApplicationGatewayAvailableSslPredefinedPolicies struct { - autorest.Response `json:"-"` - // Value - List of available Ssl predefined policy. - Value *[]ApplicationGatewaySslPredefinedPolicy `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ApplicationGatewayAvailableSslPredefinedPoliciesIterator provides access to a complete listing of -// ApplicationGatewaySslPredefinedPolicy values. -type ApplicationGatewayAvailableSslPredefinedPoliciesIterator struct { - i int - page ApplicationGatewayAvailableSslPredefinedPoliciesPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ApplicationGatewayAvailableSslPredefinedPoliciesIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayAvailableSslPredefinedPoliciesIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ApplicationGatewayAvailableSslPredefinedPoliciesIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ApplicationGatewayAvailableSslPredefinedPoliciesIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ApplicationGatewayAvailableSslPredefinedPoliciesIterator) Response() ApplicationGatewayAvailableSslPredefinedPolicies { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ApplicationGatewayAvailableSslPredefinedPoliciesIterator) Value() ApplicationGatewaySslPredefinedPolicy { - if !iter.page.NotDone() { - return ApplicationGatewaySslPredefinedPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ApplicationGatewayAvailableSslPredefinedPoliciesIterator type. -func NewApplicationGatewayAvailableSslPredefinedPoliciesIterator(page ApplicationGatewayAvailableSslPredefinedPoliciesPage) ApplicationGatewayAvailableSslPredefinedPoliciesIterator { - return ApplicationGatewayAvailableSslPredefinedPoliciesIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (agaspp ApplicationGatewayAvailableSslPredefinedPolicies) IsEmpty() bool { - return agaspp.Value == nil || len(*agaspp.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (agaspp ApplicationGatewayAvailableSslPredefinedPolicies) hasNextLink() bool { - return agaspp.NextLink != nil && len(*agaspp.NextLink) != 0 -} - -// applicationGatewayAvailableSslPredefinedPoliciesPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (agaspp ApplicationGatewayAvailableSslPredefinedPolicies) applicationGatewayAvailableSslPredefinedPoliciesPreparer(ctx context.Context) (*http.Request, error) { - if !agaspp.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(agaspp.NextLink))) -} - -// ApplicationGatewayAvailableSslPredefinedPoliciesPage contains a page of -// ApplicationGatewaySslPredefinedPolicy values. -type ApplicationGatewayAvailableSslPredefinedPoliciesPage struct { - fn func(context.Context, ApplicationGatewayAvailableSslPredefinedPolicies) (ApplicationGatewayAvailableSslPredefinedPolicies, error) - agaspp ApplicationGatewayAvailableSslPredefinedPolicies -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ApplicationGatewayAvailableSslPredefinedPoliciesPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayAvailableSslPredefinedPoliciesPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.agaspp) - if err != nil { - return err - } - page.agaspp = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ApplicationGatewayAvailableSslPredefinedPoliciesPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ApplicationGatewayAvailableSslPredefinedPoliciesPage) NotDone() bool { - return !page.agaspp.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ApplicationGatewayAvailableSslPredefinedPoliciesPage) Response() ApplicationGatewayAvailableSslPredefinedPolicies { - return page.agaspp -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ApplicationGatewayAvailableSslPredefinedPoliciesPage) Values() []ApplicationGatewaySslPredefinedPolicy { - if page.agaspp.IsEmpty() { - return nil - } - return *page.agaspp.Value -} - -// Creates a new instance of the ApplicationGatewayAvailableSslPredefinedPoliciesPage type. -func NewApplicationGatewayAvailableSslPredefinedPoliciesPage(cur ApplicationGatewayAvailableSslPredefinedPolicies, getNextPage func(context.Context, ApplicationGatewayAvailableSslPredefinedPolicies) (ApplicationGatewayAvailableSslPredefinedPolicies, error)) ApplicationGatewayAvailableSslPredefinedPoliciesPage { - return ApplicationGatewayAvailableSslPredefinedPoliciesPage{ - fn: getNextPage, - agaspp: cur, - } -} - -// ApplicationGatewayAvailableWafRuleSetsResult response for ApplicationGatewayAvailableWafRuleSets API -// service call. -type ApplicationGatewayAvailableWafRuleSetsResult struct { - autorest.Response `json:"-"` - // Value - The list of application gateway rule sets. - Value *[]ApplicationGatewayFirewallRuleSet `json:"value,omitempty"` -} - -// ApplicationGatewayBackendAddress backend address of an application gateway. -type ApplicationGatewayBackendAddress struct { - // Fqdn - Fully qualified domain name (FQDN). - Fqdn *string `json:"fqdn,omitempty"` - // IPAddress - IP address. - IPAddress *string `json:"ipAddress,omitempty"` -} - -// ApplicationGatewayBackendAddressPool backend Address Pool of an application gateway. -type ApplicationGatewayBackendAddressPool struct { - // ApplicationGatewayBackendAddressPoolPropertiesFormat - Properties of the application gateway backend address pool. - *ApplicationGatewayBackendAddressPoolPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the backend address pool that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayBackendAddressPool. -func (agbap ApplicationGatewayBackendAddressPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agbap.ApplicationGatewayBackendAddressPoolPropertiesFormat != nil { - objectMap["properties"] = agbap.ApplicationGatewayBackendAddressPoolPropertiesFormat - } - if agbap.Name != nil { - objectMap["name"] = agbap.Name - } - if agbap.ID != nil { - objectMap["id"] = agbap.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayBackendAddressPool struct. -func (agbap *ApplicationGatewayBackendAddressPool) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayBackendAddressPoolPropertiesFormat ApplicationGatewayBackendAddressPoolPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayBackendAddressPoolPropertiesFormat) - if err != nil { - return err - } - agbap.ApplicationGatewayBackendAddressPoolPropertiesFormat = &applicationGatewayBackendAddressPoolPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agbap.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agbap.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agbap.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agbap.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayBackendAddressPoolPropertiesFormat properties of Backend Address Pool of an -// application gateway. -type ApplicationGatewayBackendAddressPoolPropertiesFormat struct { - // BackendIPConfigurations - READ-ONLY; Collection of references to IPs defined in network interfaces. - BackendIPConfigurations *[]InterfaceIPConfiguration `json:"backendIPConfigurations,omitempty"` - // BackendAddresses - Backend addresses. - BackendAddresses *[]ApplicationGatewayBackendAddress `json:"backendAddresses,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the backend address pool resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayBackendAddressPoolPropertiesFormat. -func (agbappf ApplicationGatewayBackendAddressPoolPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agbappf.BackendAddresses != nil { - objectMap["backendAddresses"] = agbappf.BackendAddresses - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayBackendHTTPSettings backend address pool settings of an application gateway. -type ApplicationGatewayBackendHTTPSettings struct { - // ApplicationGatewayBackendHTTPSettingsPropertiesFormat - Properties of the application gateway backend HTTP settings. - *ApplicationGatewayBackendHTTPSettingsPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the backend http settings that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayBackendHTTPSettings. -func (agbhs ApplicationGatewayBackendHTTPSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agbhs.ApplicationGatewayBackendHTTPSettingsPropertiesFormat != nil { - objectMap["properties"] = agbhs.ApplicationGatewayBackendHTTPSettingsPropertiesFormat - } - if agbhs.Name != nil { - objectMap["name"] = agbhs.Name - } - if agbhs.ID != nil { - objectMap["id"] = agbhs.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayBackendHTTPSettings struct. -func (agbhs *ApplicationGatewayBackendHTTPSettings) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayBackendHTTPSettingsPropertiesFormat ApplicationGatewayBackendHTTPSettingsPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayBackendHTTPSettingsPropertiesFormat) - if err != nil { - return err - } - agbhs.ApplicationGatewayBackendHTTPSettingsPropertiesFormat = &applicationGatewayBackendHTTPSettingsPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agbhs.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agbhs.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agbhs.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agbhs.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayBackendHTTPSettingsPropertiesFormat properties of Backend address pool settings of an -// application gateway. -type ApplicationGatewayBackendHTTPSettingsPropertiesFormat struct { - // Port - The destination port on the backend. - Port *int32 `json:"port,omitempty"` - // Protocol - The protocol used to communicate with the backend. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' - Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` - // CookieBasedAffinity - Cookie based affinity. Possible values include: 'ApplicationGatewayCookieBasedAffinityEnabled', 'ApplicationGatewayCookieBasedAffinityDisabled' - CookieBasedAffinity ApplicationGatewayCookieBasedAffinity `json:"cookieBasedAffinity,omitempty"` - // RequestTimeout - 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. - RequestTimeout *int32 `json:"requestTimeout,omitempty"` - // Probe - Probe resource of an application gateway. - Probe *SubResource `json:"probe,omitempty"` - // AuthenticationCertificates - Array of references to application gateway authentication certificates. - AuthenticationCertificates *[]SubResource `json:"authenticationCertificates,omitempty"` - // TrustedRootCertificates - Array of references to application gateway trusted root certificates. - TrustedRootCertificates *[]SubResource `json:"trustedRootCertificates,omitempty"` - // ConnectionDraining - Connection draining of the backend http settings resource. - ConnectionDraining *ApplicationGatewayConnectionDraining `json:"connectionDraining,omitempty"` - // HostName - Host header to be sent to the backend servers. - HostName *string `json:"hostName,omitempty"` - // PickHostNameFromBackendAddress - Whether to pick host header should be picked from the host name of the backend server. Default value is false. - PickHostNameFromBackendAddress *bool `json:"pickHostNameFromBackendAddress,omitempty"` - // AffinityCookieName - Cookie name to use for the affinity cookie. - AffinityCookieName *string `json:"affinityCookieName,omitempty"` - // ProbeEnabled - Whether the probe is enabled. Default value is false. - ProbeEnabled *bool `json:"probeEnabled,omitempty"` - // Path - Path which should be used as a prefix for all HTTP requests. Null means no path will be prefixed. Default value is null. - Path *string `json:"path,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the backend HTTP settings resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayBackendHTTPSettingsPropertiesFormat. -func (agbhspf ApplicationGatewayBackendHTTPSettingsPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agbhspf.Port != nil { - objectMap["port"] = agbhspf.Port - } - if agbhspf.Protocol != "" { - objectMap["protocol"] = agbhspf.Protocol - } - if agbhspf.CookieBasedAffinity != "" { - objectMap["cookieBasedAffinity"] = agbhspf.CookieBasedAffinity - } - if agbhspf.RequestTimeout != nil { - objectMap["requestTimeout"] = agbhspf.RequestTimeout - } - if agbhspf.Probe != nil { - objectMap["probe"] = agbhspf.Probe - } - if agbhspf.AuthenticationCertificates != nil { - objectMap["authenticationCertificates"] = agbhspf.AuthenticationCertificates - } - if agbhspf.TrustedRootCertificates != nil { - objectMap["trustedRootCertificates"] = agbhspf.TrustedRootCertificates - } - if agbhspf.ConnectionDraining != nil { - objectMap["connectionDraining"] = agbhspf.ConnectionDraining - } - if agbhspf.HostName != nil { - objectMap["hostName"] = agbhspf.HostName - } - if agbhspf.PickHostNameFromBackendAddress != nil { - objectMap["pickHostNameFromBackendAddress"] = agbhspf.PickHostNameFromBackendAddress - } - if agbhspf.AffinityCookieName != nil { - objectMap["affinityCookieName"] = agbhspf.AffinityCookieName - } - if agbhspf.ProbeEnabled != nil { - objectMap["probeEnabled"] = agbhspf.ProbeEnabled - } - if agbhspf.Path != nil { - objectMap["path"] = agbhspf.Path - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayBackendHealth response for ApplicationGatewayBackendHealth API service call. -type ApplicationGatewayBackendHealth struct { - autorest.Response `json:"-"` - // BackendAddressPools - A list of ApplicationGatewayBackendHealthPool resources. - BackendAddressPools *[]ApplicationGatewayBackendHealthPool `json:"backendAddressPools,omitempty"` -} - -// ApplicationGatewayBackendHealthHTTPSettings application gateway BackendHealthHttp settings. -type ApplicationGatewayBackendHealthHTTPSettings struct { - // BackendHTTPSettings - Reference to an ApplicationGatewayBackendHttpSettings resource. - BackendHTTPSettings *ApplicationGatewayBackendHTTPSettings `json:"backendHttpSettings,omitempty"` - // Servers - List of ApplicationGatewayBackendHealthServer resources. - Servers *[]ApplicationGatewayBackendHealthServer `json:"servers,omitempty"` -} - -// ApplicationGatewayBackendHealthOnDemand result of on demand test probe. -type ApplicationGatewayBackendHealthOnDemand struct { - autorest.Response `json:"-"` - // BackendAddressPool - Reference to an ApplicationGatewayBackendAddressPool resource. - BackendAddressPool *ApplicationGatewayBackendAddressPool `json:"backendAddressPool,omitempty"` - // BackendHealthHTTPSettings - Application gateway BackendHealthHttp settings. - BackendHealthHTTPSettings *ApplicationGatewayBackendHealthHTTPSettings `json:"backendHealthHttpSettings,omitempty"` -} - -// ApplicationGatewayBackendHealthPool application gateway BackendHealth pool. -type ApplicationGatewayBackendHealthPool struct { - // BackendAddressPool - Reference to an ApplicationGatewayBackendAddressPool resource. - BackendAddressPool *ApplicationGatewayBackendAddressPool `json:"backendAddressPool,omitempty"` - // BackendHTTPSettingsCollection - List of ApplicationGatewayBackendHealthHttpSettings resources. - BackendHTTPSettingsCollection *[]ApplicationGatewayBackendHealthHTTPSettings `json:"backendHttpSettingsCollection,omitempty"` -} - -// ApplicationGatewayBackendHealthServer application gateway backendhealth http settings. -type ApplicationGatewayBackendHealthServer struct { - // Address - IP address or FQDN of backend server. - Address *string `json:"address,omitempty"` - // IPConfiguration - Reference to IP configuration of backend server. - IPConfiguration *InterfaceIPConfiguration `json:"ipConfiguration,omitempty"` - // Health - Health of backend server. Possible values include: 'ApplicationGatewayBackendHealthServerHealthUnknown', 'ApplicationGatewayBackendHealthServerHealthUp', 'ApplicationGatewayBackendHealthServerHealthDown', 'ApplicationGatewayBackendHealthServerHealthPartial', 'ApplicationGatewayBackendHealthServerHealthDraining' - Health ApplicationGatewayBackendHealthServerHealth `json:"health,omitempty"` - // HealthProbeLog - Health Probe Log. - HealthProbeLog *string `json:"healthProbeLog,omitempty"` -} - -// ApplicationGatewayBackendSettings backend address pool settings of an application gateway. -type ApplicationGatewayBackendSettings struct { - // ApplicationGatewayBackendSettingsPropertiesFormat - Properties of the application gateway backend settings. - *ApplicationGatewayBackendSettingsPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the backend settings that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayBackendSettings. -func (agbs ApplicationGatewayBackendSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agbs.ApplicationGatewayBackendSettingsPropertiesFormat != nil { - objectMap["properties"] = agbs.ApplicationGatewayBackendSettingsPropertiesFormat - } - if agbs.Name != nil { - objectMap["name"] = agbs.Name - } - if agbs.ID != nil { - objectMap["id"] = agbs.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayBackendSettings struct. -func (agbs *ApplicationGatewayBackendSettings) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayBackendSettingsPropertiesFormat ApplicationGatewayBackendSettingsPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayBackendSettingsPropertiesFormat) - if err != nil { - return err - } - agbs.ApplicationGatewayBackendSettingsPropertiesFormat = &applicationGatewayBackendSettingsPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agbs.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agbs.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agbs.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agbs.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayBackendSettingsPropertiesFormat properties of Backend address pool settings of an -// application gateway. -type ApplicationGatewayBackendSettingsPropertiesFormat struct { - // Port - The destination port on the backend. - Port *int32 `json:"port,omitempty"` - // Protocol - The protocol used to communicate with the backend. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' - Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` - // Timeout - 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. - Timeout *int32 `json:"timeout,omitempty"` - // Probe - Probe resource of an application gateway. - Probe *SubResource `json:"probe,omitempty"` - // TrustedRootCertificates - Array of references to application gateway trusted root certificates. - TrustedRootCertificates *[]SubResource `json:"trustedRootCertificates,omitempty"` - // HostName - Server name indication to be sent to the backend servers for Tls protocol. - HostName *string `json:"hostName,omitempty"` - // PickHostNameFromBackendAddress - Whether to pick server name indication from the host name of the backend server for Tls protocol. Default value is false. - PickHostNameFromBackendAddress *bool `json:"pickHostNameFromBackendAddress,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the backend HTTP settings resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayBackendSettingsPropertiesFormat. -func (agbspf ApplicationGatewayBackendSettingsPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agbspf.Port != nil { - objectMap["port"] = agbspf.Port - } - if agbspf.Protocol != "" { - objectMap["protocol"] = agbspf.Protocol - } - if agbspf.Timeout != nil { - objectMap["timeout"] = agbspf.Timeout - } - if agbspf.Probe != nil { - objectMap["probe"] = agbspf.Probe - } - if agbspf.TrustedRootCertificates != nil { - objectMap["trustedRootCertificates"] = agbspf.TrustedRootCertificates - } - if agbspf.HostName != nil { - objectMap["hostName"] = agbspf.HostName - } - if agbspf.PickHostNameFromBackendAddress != nil { - objectMap["pickHostNameFromBackendAddress"] = agbspf.PickHostNameFromBackendAddress - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayClientAuthConfiguration application gateway client authentication configuration. -type ApplicationGatewayClientAuthConfiguration struct { - // VerifyClientCertIssuerDN - Verify client certificate issuer name on the application gateway. - VerifyClientCertIssuerDN *bool `json:"verifyClientCertIssuerDN,omitempty"` - // VerifyClientRevocation - Verify client certificate revocation status. Possible values include: 'ApplicationGatewayClientRevocationOptionsNone', 'ApplicationGatewayClientRevocationOptionsOCSP' - VerifyClientRevocation ApplicationGatewayClientRevocationOptions `json:"verifyClientRevocation,omitempty"` -} - -// ApplicationGatewayConnectionDraining 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. -type ApplicationGatewayConnectionDraining struct { - // Enabled - Whether connection draining is enabled or not. - Enabled *bool `json:"enabled,omitempty"` - // DrainTimeoutInSec - The number of seconds connection draining is active. Acceptable values are from 1 second to 3600 seconds. - DrainTimeoutInSec *int32 `json:"drainTimeoutInSec,omitempty"` -} - -// ApplicationGatewayCustomError customer error of an application gateway. -type ApplicationGatewayCustomError struct { - // StatusCode - Status code of the application gateway customer error. Possible values include: 'ApplicationGatewayCustomErrorStatusCodeHTTPStatus403', 'ApplicationGatewayCustomErrorStatusCodeHTTPStatus502' - StatusCode ApplicationGatewayCustomErrorStatusCode `json:"statusCode,omitempty"` - // CustomErrorPageURL - Error page URL of the application gateway customer error. - CustomErrorPageURL *string `json:"customErrorPageUrl,omitempty"` -} - -// ApplicationGatewayFirewallDisabledRuleGroup allows to disable rules within a rule group or an entire -// rule group. -type ApplicationGatewayFirewallDisabledRuleGroup struct { - // RuleGroupName - The name of the rule group that will be disabled. - RuleGroupName *string `json:"ruleGroupName,omitempty"` - // Rules - The list of rules that will be disabled. If null, all rules of the rule group will be disabled. - Rules *[]int32 `json:"rules,omitempty"` -} - -// ApplicationGatewayFirewallExclusion allow to exclude some variable satisfy the condition for the WAF -// check. -type ApplicationGatewayFirewallExclusion struct { - // MatchVariable - The variable to be excluded. - MatchVariable *string `json:"matchVariable,omitempty"` - // SelectorMatchOperator - When matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to. - SelectorMatchOperator *string `json:"selectorMatchOperator,omitempty"` - // Selector - When matchVariable is a collection, operator used to specify which elements in the collection this exclusion applies to. - Selector *string `json:"selector,omitempty"` -} - -// ApplicationGatewayFirewallManifestRuleSet properties of the web application firewall rule set. -type ApplicationGatewayFirewallManifestRuleSet struct { - // RuleSetType - The type of the web application firewall rule set. - RuleSetType *string `json:"ruleSetType,omitempty"` - // RuleSetVersion - The version of the web application firewall rule set type. - RuleSetVersion *string `json:"ruleSetVersion,omitempty"` - // Status - The rule set status. Possible values include: 'ApplicationGatewayRuleSetStatusOptionsPreview', 'ApplicationGatewayRuleSetStatusOptionsGA', 'ApplicationGatewayRuleSetStatusOptionsSupported', 'ApplicationGatewayRuleSetStatusOptionsDeprecated' - Status ApplicationGatewayRuleSetStatusOptions `json:"status,omitempty"` - // Tiers - Tier of an application gateway that support the rule set. - Tiers *[]ApplicationGatewayTierTypes `json:"tiers,omitempty"` - // RuleGroups - The rule groups of the web application firewall rule set. - RuleGroups *[]ApplicationGatewayFirewallRuleGroup `json:"ruleGroups,omitempty"` -} - -// ApplicationGatewayFirewallRule a web application firewall rule. -type ApplicationGatewayFirewallRule struct { - // RuleID - The identifier of the web application firewall rule. - RuleID *int32 `json:"ruleId,omitempty"` - // RuleIDString - The string representation of the web application firewall rule identifier. - RuleIDString *string `json:"ruleIdString,omitempty"` - // State - The string representation of the web application firewall rule state. Possible values include: 'ApplicationGatewayWafRuleStateTypesEnabled', 'ApplicationGatewayWafRuleStateTypesDisabled' - State ApplicationGatewayWafRuleStateTypes `json:"state,omitempty"` - // Action - The string representation of the web application firewall rule action. Possible values include: 'ApplicationGatewayWafRuleActionTypesNone', 'ApplicationGatewayWafRuleActionTypesAnomalyScoring', 'ApplicationGatewayWafRuleActionTypesAllow', 'ApplicationGatewayWafRuleActionTypesBlock', 'ApplicationGatewayWafRuleActionTypesLog' - Action ApplicationGatewayWafRuleActionTypes `json:"action,omitempty"` - // Description - The description of the web application firewall rule. - Description *string `json:"description,omitempty"` -} - -// ApplicationGatewayFirewallRuleGroup a web application firewall rule group. -type ApplicationGatewayFirewallRuleGroup struct { - // RuleGroupName - The name of the web application firewall rule group. - RuleGroupName *string `json:"ruleGroupName,omitempty"` - // Description - The description of the web application firewall rule group. - Description *string `json:"description,omitempty"` - // Rules - The rules of the web application firewall rule group. - Rules *[]ApplicationGatewayFirewallRule `json:"rules,omitempty"` -} - -// ApplicationGatewayFirewallRuleSet a web application firewall rule set. -type ApplicationGatewayFirewallRuleSet struct { - // ApplicationGatewayFirewallRuleSetPropertiesFormat - Properties of the application gateway firewall rule set. - *ApplicationGatewayFirewallRuleSetPropertiesFormat `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayFirewallRuleSet. -func (agfrs ApplicationGatewayFirewallRuleSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agfrs.ApplicationGatewayFirewallRuleSetPropertiesFormat != nil { - objectMap["properties"] = agfrs.ApplicationGatewayFirewallRuleSetPropertiesFormat - } - if agfrs.ID != nil { - objectMap["id"] = agfrs.ID - } - if agfrs.Location != nil { - objectMap["location"] = agfrs.Location - } - if agfrs.Tags != nil { - objectMap["tags"] = agfrs.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayFirewallRuleSet struct. -func (agfrs *ApplicationGatewayFirewallRuleSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayFirewallRuleSetPropertiesFormat ApplicationGatewayFirewallRuleSetPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayFirewallRuleSetPropertiesFormat) - if err != nil { - return err - } - agfrs.ApplicationGatewayFirewallRuleSetPropertiesFormat = &applicationGatewayFirewallRuleSetPropertiesFormat - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agfrs.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agfrs.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agfrs.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - agfrs.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - agfrs.Tags = tags - } - } - } - - return nil -} - -// ApplicationGatewayFirewallRuleSetPropertiesFormat properties of the web application firewall rule set. -type ApplicationGatewayFirewallRuleSetPropertiesFormat struct { - // ProvisioningState - READ-ONLY; The provisioning state of the web application firewall rule set. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // RuleSetType - The type of the web application firewall rule set. - RuleSetType *string `json:"ruleSetType,omitempty"` - // RuleSetVersion - The version of the web application firewall rule set type. - RuleSetVersion *string `json:"ruleSetVersion,omitempty"` - // RuleGroups - The rule groups of the web application firewall rule set. - RuleGroups *[]ApplicationGatewayFirewallRuleGroup `json:"ruleGroups,omitempty"` - // Tiers - Tier of an application gateway that support the rule set. - Tiers *[]ApplicationGatewayTierTypes `json:"tiers,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayFirewallRuleSetPropertiesFormat. -func (agfrspf ApplicationGatewayFirewallRuleSetPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agfrspf.RuleSetType != nil { - objectMap["ruleSetType"] = agfrspf.RuleSetType - } - if agfrspf.RuleSetVersion != nil { - objectMap["ruleSetVersion"] = agfrspf.RuleSetVersion - } - if agfrspf.RuleGroups != nil { - objectMap["ruleGroups"] = agfrspf.RuleGroups - } - if agfrspf.Tiers != nil { - objectMap["tiers"] = agfrspf.Tiers - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayFrontendIPConfiguration frontend IP configuration of an application gateway. -type ApplicationGatewayFrontendIPConfiguration struct { - // ApplicationGatewayFrontendIPConfigurationPropertiesFormat - Properties of the application gateway frontend IP configuration. - *ApplicationGatewayFrontendIPConfigurationPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the frontend IP configuration that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayFrontendIPConfiguration. -func (agfic ApplicationGatewayFrontendIPConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agfic.ApplicationGatewayFrontendIPConfigurationPropertiesFormat != nil { - objectMap["properties"] = agfic.ApplicationGatewayFrontendIPConfigurationPropertiesFormat - } - if agfic.Name != nil { - objectMap["name"] = agfic.Name - } - if agfic.ID != nil { - objectMap["id"] = agfic.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayFrontendIPConfiguration struct. -func (agfic *ApplicationGatewayFrontendIPConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayFrontendIPConfigurationPropertiesFormat ApplicationGatewayFrontendIPConfigurationPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayFrontendIPConfigurationPropertiesFormat) - if err != nil { - return err - } - agfic.ApplicationGatewayFrontendIPConfigurationPropertiesFormat = &applicationGatewayFrontendIPConfigurationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agfic.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agfic.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agfic.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agfic.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayFrontendIPConfigurationPropertiesFormat properties of Frontend IP configuration of an -// application gateway. -type ApplicationGatewayFrontendIPConfigurationPropertiesFormat struct { - // PrivateIPAddress - PrivateIPAddress of the network interface IP Configuration. - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' - PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` - // Subnet - Reference to the subnet resource. - Subnet *SubResource `json:"subnet,omitempty"` - // PublicIPAddress - Reference to the PublicIP resource. - PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` - // PrivateLinkConfiguration - Reference to the application gateway private link configuration. - PrivateLinkConfiguration *SubResource `json:"privateLinkConfiguration,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the frontend IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayFrontendIPConfigurationPropertiesFormat. -func (agficpf ApplicationGatewayFrontendIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agficpf.PrivateIPAddress != nil { - objectMap["privateIPAddress"] = agficpf.PrivateIPAddress - } - if agficpf.PrivateIPAllocationMethod != "" { - objectMap["privateIPAllocationMethod"] = agficpf.PrivateIPAllocationMethod - } - if agficpf.Subnet != nil { - objectMap["subnet"] = agficpf.Subnet - } - if agficpf.PublicIPAddress != nil { - objectMap["publicIPAddress"] = agficpf.PublicIPAddress - } - if agficpf.PrivateLinkConfiguration != nil { - objectMap["privateLinkConfiguration"] = agficpf.PrivateLinkConfiguration - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayFrontendPort frontend port of an application gateway. -type ApplicationGatewayFrontendPort struct { - // ApplicationGatewayFrontendPortPropertiesFormat - Properties of the application gateway frontend port. - *ApplicationGatewayFrontendPortPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the frontend port that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayFrontendPort. -func (agfp ApplicationGatewayFrontendPort) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agfp.ApplicationGatewayFrontendPortPropertiesFormat != nil { - objectMap["properties"] = agfp.ApplicationGatewayFrontendPortPropertiesFormat - } - if agfp.Name != nil { - objectMap["name"] = agfp.Name - } - if agfp.ID != nil { - objectMap["id"] = agfp.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayFrontendPort struct. -func (agfp *ApplicationGatewayFrontendPort) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayFrontendPortPropertiesFormat ApplicationGatewayFrontendPortPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayFrontendPortPropertiesFormat) - if err != nil { - return err - } - agfp.ApplicationGatewayFrontendPortPropertiesFormat = &applicationGatewayFrontendPortPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agfp.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agfp.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agfp.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agfp.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayFrontendPortPropertiesFormat properties of Frontend port of an application gateway. -type ApplicationGatewayFrontendPortPropertiesFormat struct { - // Port - Frontend port. - Port *int32 `json:"port,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the frontend port resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayFrontendPortPropertiesFormat. -func (agfppf ApplicationGatewayFrontendPortPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agfppf.Port != nil { - objectMap["port"] = agfppf.Port - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayGlobalConfiguration application Gateway global configuration. -type ApplicationGatewayGlobalConfiguration struct { - // EnableRequestBuffering - Enable request buffering. - EnableRequestBuffering *bool `json:"enableRequestBuffering,omitempty"` - // EnableResponseBuffering - Enable response buffering. - EnableResponseBuffering *bool `json:"enableResponseBuffering,omitempty"` -} - -// ApplicationGatewayHTTPListener http listener of an application gateway. -type ApplicationGatewayHTTPListener struct { - // ApplicationGatewayHTTPListenerPropertiesFormat - Properties of the application gateway HTTP listener. - *ApplicationGatewayHTTPListenerPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the HTTP listener that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayHTTPListener. -func (aghl ApplicationGatewayHTTPListener) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aghl.ApplicationGatewayHTTPListenerPropertiesFormat != nil { - objectMap["properties"] = aghl.ApplicationGatewayHTTPListenerPropertiesFormat - } - if aghl.Name != nil { - objectMap["name"] = aghl.Name - } - if aghl.ID != nil { - objectMap["id"] = aghl.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayHTTPListener struct. -func (aghl *ApplicationGatewayHTTPListener) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayHTTPListenerPropertiesFormat ApplicationGatewayHTTPListenerPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayHTTPListenerPropertiesFormat) - if err != nil { - return err - } - aghl.ApplicationGatewayHTTPListenerPropertiesFormat = &applicationGatewayHTTPListenerPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - aghl.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - aghl.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - aghl.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - aghl.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayHTTPListenerPropertiesFormat properties of HTTP listener of an application gateway. -type ApplicationGatewayHTTPListenerPropertiesFormat struct { - // FrontendIPConfiguration - Frontend IP configuration resource of an application gateway. - FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` - // FrontendPort - Frontend port resource of an application gateway. - FrontendPort *SubResource `json:"frontendPort,omitempty"` - // Protocol - Protocol of the HTTP listener. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' - Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` - // HostName - Host name of HTTP listener. - HostName *string `json:"hostName,omitempty"` - // SslCertificate - SSL certificate resource of an application gateway. - SslCertificate *SubResource `json:"sslCertificate,omitempty"` - // SslProfile - SSL profile resource of the application gateway. - SslProfile *SubResource `json:"sslProfile,omitempty"` - // RequireServerNameIndication - Applicable only if protocol is https. Enables SNI for multi-hosting. - RequireServerNameIndication *bool `json:"requireServerNameIndication,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the HTTP listener resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // CustomErrorConfigurations - Custom error configurations of the HTTP listener. - CustomErrorConfigurations *[]ApplicationGatewayCustomError `json:"customErrorConfigurations,omitempty"` - // FirewallPolicy - Reference to the FirewallPolicy resource. - FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` - // HostNames - List of Host names for HTTP Listener that allows special wildcard characters as well. - HostNames *[]string `json:"hostNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayHTTPListenerPropertiesFormat. -func (aghlpf ApplicationGatewayHTTPListenerPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aghlpf.FrontendIPConfiguration != nil { - objectMap["frontendIPConfiguration"] = aghlpf.FrontendIPConfiguration - } - if aghlpf.FrontendPort != nil { - objectMap["frontendPort"] = aghlpf.FrontendPort - } - if aghlpf.Protocol != "" { - objectMap["protocol"] = aghlpf.Protocol - } - if aghlpf.HostName != nil { - objectMap["hostName"] = aghlpf.HostName - } - if aghlpf.SslCertificate != nil { - objectMap["sslCertificate"] = aghlpf.SslCertificate - } - if aghlpf.SslProfile != nil { - objectMap["sslProfile"] = aghlpf.SslProfile - } - if aghlpf.RequireServerNameIndication != nil { - objectMap["requireServerNameIndication"] = aghlpf.RequireServerNameIndication - } - if aghlpf.CustomErrorConfigurations != nil { - objectMap["customErrorConfigurations"] = aghlpf.CustomErrorConfigurations - } - if aghlpf.FirewallPolicy != nil { - objectMap["firewallPolicy"] = aghlpf.FirewallPolicy - } - if aghlpf.HostNames != nil { - objectMap["hostNames"] = aghlpf.HostNames - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayHeaderConfiguration header configuration of the Actions set in Application Gateway. -type ApplicationGatewayHeaderConfiguration struct { - // HeaderName - Header name of the header configuration. - HeaderName *string `json:"headerName,omitempty"` - // HeaderValue - Header value of the header configuration. - HeaderValue *string `json:"headerValue,omitempty"` -} - -// ApplicationGatewayIPConfiguration IP configuration of an application gateway. Currently 1 public and 1 -// private IP configuration is allowed. -type ApplicationGatewayIPConfiguration struct { - // ApplicationGatewayIPConfigurationPropertiesFormat - Properties of the application gateway IP configuration. - *ApplicationGatewayIPConfigurationPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the IP configuration that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayIPConfiguration. -func (agic ApplicationGatewayIPConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agic.ApplicationGatewayIPConfigurationPropertiesFormat != nil { - objectMap["properties"] = agic.ApplicationGatewayIPConfigurationPropertiesFormat - } - if agic.Name != nil { - objectMap["name"] = agic.Name - } - if agic.ID != nil { - objectMap["id"] = agic.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayIPConfiguration struct. -func (agic *ApplicationGatewayIPConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayIPConfigurationPropertiesFormat ApplicationGatewayIPConfigurationPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayIPConfigurationPropertiesFormat) - if err != nil { - return err - } - agic.ApplicationGatewayIPConfigurationPropertiesFormat = &applicationGatewayIPConfigurationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agic.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agic.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agic.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agic.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayIPConfigurationPropertiesFormat properties of IP configuration of an application -// gateway. -type ApplicationGatewayIPConfigurationPropertiesFormat struct { - // Subnet - Reference to the subnet resource. A subnet from where application gateway gets its private address. - Subnet *SubResource `json:"subnet,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the application gateway IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayIPConfigurationPropertiesFormat. -func (agicpf ApplicationGatewayIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agicpf.Subnet != nil { - objectMap["subnet"] = agicpf.Subnet - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayListResult response for ListApplicationGateways API service call. -type ApplicationGatewayListResult struct { - autorest.Response `json:"-"` - // Value - List of an application gateways in a resource group. - Value *[]ApplicationGateway `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ApplicationGatewayListResultIterator provides access to a complete listing of ApplicationGateway values. -type ApplicationGatewayListResultIterator struct { - i int - page ApplicationGatewayListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ApplicationGatewayListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ApplicationGatewayListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ApplicationGatewayListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ApplicationGatewayListResultIterator) Response() ApplicationGatewayListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ApplicationGatewayListResultIterator) Value() ApplicationGateway { - if !iter.page.NotDone() { - return ApplicationGateway{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ApplicationGatewayListResultIterator type. -func NewApplicationGatewayListResultIterator(page ApplicationGatewayListResultPage) ApplicationGatewayListResultIterator { - return ApplicationGatewayListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aglr ApplicationGatewayListResult) IsEmpty() bool { - return aglr.Value == nil || len(*aglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aglr ApplicationGatewayListResult) hasNextLink() bool { - return aglr.NextLink != nil && len(*aglr.NextLink) != 0 -} - -// applicationGatewayListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aglr ApplicationGatewayListResult) applicationGatewayListResultPreparer(ctx context.Context) (*http.Request, error) { - if !aglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aglr.NextLink))) -} - -// ApplicationGatewayListResultPage contains a page of ApplicationGateway values. -type ApplicationGatewayListResultPage struct { - fn func(context.Context, ApplicationGatewayListResult) (ApplicationGatewayListResult, error) - aglr ApplicationGatewayListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ApplicationGatewayListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.aglr) - if err != nil { - return err - } - page.aglr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ApplicationGatewayListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ApplicationGatewayListResultPage) NotDone() bool { - return !page.aglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ApplicationGatewayListResultPage) Response() ApplicationGatewayListResult { - return page.aglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ApplicationGatewayListResultPage) Values() []ApplicationGateway { - if page.aglr.IsEmpty() { - return nil - } - return *page.aglr.Value -} - -// Creates a new instance of the ApplicationGatewayListResultPage type. -func NewApplicationGatewayListResultPage(cur ApplicationGatewayListResult, getNextPage func(context.Context, ApplicationGatewayListResult) (ApplicationGatewayListResult, error)) ApplicationGatewayListResultPage { - return ApplicationGatewayListResultPage{ - fn: getNextPage, - aglr: cur, - } -} - -// ApplicationGatewayListener listener of an application gateway. -type ApplicationGatewayListener struct { - // ApplicationGatewayListenerPropertiesFormat - Properties of the application gateway listener. - *ApplicationGatewayListenerPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the listener that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayListener. -func (agl ApplicationGatewayListener) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agl.ApplicationGatewayListenerPropertiesFormat != nil { - objectMap["properties"] = agl.ApplicationGatewayListenerPropertiesFormat - } - if agl.Name != nil { - objectMap["name"] = agl.Name - } - if agl.ID != nil { - objectMap["id"] = agl.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayListener struct. -func (agl *ApplicationGatewayListener) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayListenerPropertiesFormat ApplicationGatewayListenerPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayListenerPropertiesFormat) - if err != nil { - return err - } - agl.ApplicationGatewayListenerPropertiesFormat = &applicationGatewayListenerPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agl.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agl.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agl.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agl.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayListenerPropertiesFormat properties of listener of an application gateway. -type ApplicationGatewayListenerPropertiesFormat struct { - // FrontendIPConfiguration - Frontend IP configuration resource of an application gateway. - FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` - // FrontendPort - Frontend port resource of an application gateway. - FrontendPort *SubResource `json:"frontendPort,omitempty"` - // Protocol - Protocol of the listener. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' - Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` - // SslCertificate - SSL certificate resource of an application gateway. - SslCertificate *SubResource `json:"sslCertificate,omitempty"` - // SslProfile - SSL profile resource of the application gateway. - SslProfile *SubResource `json:"sslProfile,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the listener resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayListenerPropertiesFormat. -func (aglpf ApplicationGatewayListenerPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aglpf.FrontendIPConfiguration != nil { - objectMap["frontendIPConfiguration"] = aglpf.FrontendIPConfiguration - } - if aglpf.FrontendPort != nil { - objectMap["frontendPort"] = aglpf.FrontendPort - } - if aglpf.Protocol != "" { - objectMap["protocol"] = aglpf.Protocol - } - if aglpf.SslCertificate != nil { - objectMap["sslCertificate"] = aglpf.SslCertificate - } - if aglpf.SslProfile != nil { - objectMap["sslProfile"] = aglpf.SslProfile - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayLoadDistributionPolicy load Distribution Policy of an application gateway. -type ApplicationGatewayLoadDistributionPolicy struct { - // ApplicationGatewayLoadDistributionPolicyPropertiesFormat - Properties of the application gateway load distribution policy. - *ApplicationGatewayLoadDistributionPolicyPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the load distribution policy that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayLoadDistributionPolicy. -func (agldp ApplicationGatewayLoadDistributionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agldp.ApplicationGatewayLoadDistributionPolicyPropertiesFormat != nil { - objectMap["properties"] = agldp.ApplicationGatewayLoadDistributionPolicyPropertiesFormat - } - if agldp.Name != nil { - objectMap["name"] = agldp.Name - } - if agldp.ID != nil { - objectMap["id"] = agldp.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayLoadDistributionPolicy struct. -func (agldp *ApplicationGatewayLoadDistributionPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayLoadDistributionPolicyPropertiesFormat ApplicationGatewayLoadDistributionPolicyPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayLoadDistributionPolicyPropertiesFormat) - if err != nil { - return err - } - agldp.ApplicationGatewayLoadDistributionPolicyPropertiesFormat = &applicationGatewayLoadDistributionPolicyPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agldp.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agldp.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agldp.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agldp.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayLoadDistributionPolicyPropertiesFormat properties of Load Distribution Policy of an -// application gateway. -type ApplicationGatewayLoadDistributionPolicyPropertiesFormat struct { - // LoadDistributionTargets - Load Distribution Targets resource of an application gateway. - LoadDistributionTargets *[]ApplicationGatewayLoadDistributionTarget `json:"loadDistributionTargets,omitempty"` - // LoadDistributionAlgorithm - Load Distribution Targets resource of an application gateway. Possible values include: 'ApplicationGatewayLoadDistributionAlgorithmRoundRobin', 'ApplicationGatewayLoadDistributionAlgorithmLeastConnections', 'ApplicationGatewayLoadDistributionAlgorithmIPHash' - LoadDistributionAlgorithm ApplicationGatewayLoadDistributionAlgorithm `json:"loadDistributionAlgorithm,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the Load Distribution Policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayLoadDistributionPolicyPropertiesFormat. -func (agldppf ApplicationGatewayLoadDistributionPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agldppf.LoadDistributionTargets != nil { - objectMap["loadDistributionTargets"] = agldppf.LoadDistributionTargets - } - if agldppf.LoadDistributionAlgorithm != "" { - objectMap["loadDistributionAlgorithm"] = agldppf.LoadDistributionAlgorithm - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayLoadDistributionTarget load Distribution Target of an application gateway. -type ApplicationGatewayLoadDistributionTarget struct { - // ApplicationGatewayLoadDistributionTargetPropertiesFormat - Properties of the application gateway load distribution target. - *ApplicationGatewayLoadDistributionTargetPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the load distribution policy that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayLoadDistributionTarget. -func (agldt ApplicationGatewayLoadDistributionTarget) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agldt.ApplicationGatewayLoadDistributionTargetPropertiesFormat != nil { - objectMap["properties"] = agldt.ApplicationGatewayLoadDistributionTargetPropertiesFormat - } - if agldt.Name != nil { - objectMap["name"] = agldt.Name - } - if agldt.ID != nil { - objectMap["id"] = agldt.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayLoadDistributionTarget struct. -func (agldt *ApplicationGatewayLoadDistributionTarget) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayLoadDistributionTargetPropertiesFormat ApplicationGatewayLoadDistributionTargetPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayLoadDistributionTargetPropertiesFormat) - if err != nil { - return err - } - agldt.ApplicationGatewayLoadDistributionTargetPropertiesFormat = &applicationGatewayLoadDistributionTargetPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agldt.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agldt.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agldt.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agldt.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayLoadDistributionTargetPropertiesFormat ... -type ApplicationGatewayLoadDistributionTargetPropertiesFormat struct { - // WeightPerServer - Weight per server. Range between 1 and 100. - WeightPerServer *int32 `json:"weightPerServer,omitempty"` - // BackendAddressPool - Backend address pool resource of the application gateway. - BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` -} - -// ApplicationGatewayOnDemandProbe details of on demand test probe request. -type ApplicationGatewayOnDemandProbe struct { - // Protocol - The protocol used for the probe. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' - Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` - // Host - Host name to send the probe to. - Host *string `json:"host,omitempty"` - // Path - Relative path of probe. Valid path starts from '/'. Probe is sent to ://:. - Path *string `json:"path,omitempty"` - // Timeout - 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. - Timeout *int32 `json:"timeout,omitempty"` - // PickHostNameFromBackendHTTPSettings - Whether the host header should be picked from the backend http settings. Default value is false. - PickHostNameFromBackendHTTPSettings *bool `json:"pickHostNameFromBackendHttpSettings,omitempty"` - // Match - Criterion for classifying a healthy probe response. - Match *ApplicationGatewayProbeHealthResponseMatch `json:"match,omitempty"` - // BackendAddressPool - Reference to backend pool of application gateway to which probe request will be sent. - BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` - // BackendHTTPSettings - Reference to backend http setting of application gateway to be used for test probe. - BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` -} - -// ApplicationGatewayPathRule path rule of URL path map of an application gateway. -type ApplicationGatewayPathRule struct { - // ApplicationGatewayPathRulePropertiesFormat - Properties of the application gateway path rule. - *ApplicationGatewayPathRulePropertiesFormat `json:"properties,omitempty"` - // Name - Name of the path rule that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayPathRule. -func (agpr ApplicationGatewayPathRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agpr.ApplicationGatewayPathRulePropertiesFormat != nil { - objectMap["properties"] = agpr.ApplicationGatewayPathRulePropertiesFormat - } - if agpr.Name != nil { - objectMap["name"] = agpr.Name - } - if agpr.ID != nil { - objectMap["id"] = agpr.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayPathRule struct. -func (agpr *ApplicationGatewayPathRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayPathRulePropertiesFormat ApplicationGatewayPathRulePropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayPathRulePropertiesFormat) - if err != nil { - return err - } - agpr.ApplicationGatewayPathRulePropertiesFormat = &applicationGatewayPathRulePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agpr.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agpr.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agpr.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agpr.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayPathRulePropertiesFormat properties of path rule of an application gateway. -type ApplicationGatewayPathRulePropertiesFormat struct { - // Paths - Path rules of URL path map. - Paths *[]string `json:"paths,omitempty"` - // BackendAddressPool - Backend address pool resource of URL path map path rule. - BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` - // BackendHTTPSettings - Backend http settings resource of URL path map path rule. - BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` - // RedirectConfiguration - Redirect configuration resource of URL path map path rule. - RedirectConfiguration *SubResource `json:"redirectConfiguration,omitempty"` - // RewriteRuleSet - Rewrite rule set resource of URL path map path rule. - RewriteRuleSet *SubResource `json:"rewriteRuleSet,omitempty"` - // LoadDistributionPolicy - Load Distribution Policy resource of URL path map path rule. - LoadDistributionPolicy *SubResource `json:"loadDistributionPolicy,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the path rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // FirewallPolicy - Reference to the FirewallPolicy resource. - FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayPathRulePropertiesFormat. -func (agprpf ApplicationGatewayPathRulePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agprpf.Paths != nil { - objectMap["paths"] = agprpf.Paths - } - if agprpf.BackendAddressPool != nil { - objectMap["backendAddressPool"] = agprpf.BackendAddressPool - } - if agprpf.BackendHTTPSettings != nil { - objectMap["backendHttpSettings"] = agprpf.BackendHTTPSettings - } - if agprpf.RedirectConfiguration != nil { - objectMap["redirectConfiguration"] = agprpf.RedirectConfiguration - } - if agprpf.RewriteRuleSet != nil { - objectMap["rewriteRuleSet"] = agprpf.RewriteRuleSet - } - if agprpf.LoadDistributionPolicy != nil { - objectMap["loadDistributionPolicy"] = agprpf.LoadDistributionPolicy - } - if agprpf.FirewallPolicy != nil { - objectMap["firewallPolicy"] = agprpf.FirewallPolicy - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayPrivateEndpointConnection private Endpoint connection on an application gateway. -type ApplicationGatewayPrivateEndpointConnection struct { - autorest.Response `json:"-"` - // ApplicationGatewayPrivateEndpointConnectionProperties - Properties of the application gateway private endpoint connection. - *ApplicationGatewayPrivateEndpointConnectionProperties `json:"properties,omitempty"` - // Name - Name of the private endpoint connection on an application gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateEndpointConnection. -func (agpec ApplicationGatewayPrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agpec.ApplicationGatewayPrivateEndpointConnectionProperties != nil { - objectMap["properties"] = agpec.ApplicationGatewayPrivateEndpointConnectionProperties - } - if agpec.Name != nil { - objectMap["name"] = agpec.Name - } - if agpec.ID != nil { - objectMap["id"] = agpec.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayPrivateEndpointConnection struct. -func (agpec *ApplicationGatewayPrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayPrivateEndpointConnectionProperties ApplicationGatewayPrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &applicationGatewayPrivateEndpointConnectionProperties) - if err != nil { - return err - } - agpec.ApplicationGatewayPrivateEndpointConnectionProperties = &applicationGatewayPrivateEndpointConnectionProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agpec.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agpec.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agpec.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agpec.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayPrivateEndpointConnectionListResult response for -// ListApplicationGatewayPrivateEndpointConnection API service call. Gets all private endpoint connections -// for an application gateway. -type ApplicationGatewayPrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - List of private endpoint connections on an application gateway. - Value *[]ApplicationGatewayPrivateEndpointConnection `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ApplicationGatewayPrivateEndpointConnectionListResultIterator provides access to a complete listing of -// ApplicationGatewayPrivateEndpointConnection values. -type ApplicationGatewayPrivateEndpointConnectionListResultIterator struct { - i int - page ApplicationGatewayPrivateEndpointConnectionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ApplicationGatewayPrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateEndpointConnectionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ApplicationGatewayPrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ApplicationGatewayPrivateEndpointConnectionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ApplicationGatewayPrivateEndpointConnectionListResultIterator) Response() ApplicationGatewayPrivateEndpointConnectionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ApplicationGatewayPrivateEndpointConnectionListResultIterator) Value() ApplicationGatewayPrivateEndpointConnection { - if !iter.page.NotDone() { - return ApplicationGatewayPrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ApplicationGatewayPrivateEndpointConnectionListResultIterator type. -func NewApplicationGatewayPrivateEndpointConnectionListResultIterator(page ApplicationGatewayPrivateEndpointConnectionListResultPage) ApplicationGatewayPrivateEndpointConnectionListResultIterator { - return ApplicationGatewayPrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (agpeclr ApplicationGatewayPrivateEndpointConnectionListResult) IsEmpty() bool { - return agpeclr.Value == nil || len(*agpeclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (agpeclr ApplicationGatewayPrivateEndpointConnectionListResult) hasNextLink() bool { - return agpeclr.NextLink != nil && len(*agpeclr.NextLink) != 0 -} - -// applicationGatewayPrivateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (agpeclr ApplicationGatewayPrivateEndpointConnectionListResult) applicationGatewayPrivateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !agpeclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(agpeclr.NextLink))) -} - -// ApplicationGatewayPrivateEndpointConnectionListResultPage contains a page of -// ApplicationGatewayPrivateEndpointConnection values. -type ApplicationGatewayPrivateEndpointConnectionListResultPage struct { - fn func(context.Context, ApplicationGatewayPrivateEndpointConnectionListResult) (ApplicationGatewayPrivateEndpointConnectionListResult, error) - agpeclr ApplicationGatewayPrivateEndpointConnectionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ApplicationGatewayPrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateEndpointConnectionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.agpeclr) - if err != nil { - return err - } - page.agpeclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ApplicationGatewayPrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ApplicationGatewayPrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.agpeclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ApplicationGatewayPrivateEndpointConnectionListResultPage) Response() ApplicationGatewayPrivateEndpointConnectionListResult { - return page.agpeclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ApplicationGatewayPrivateEndpointConnectionListResultPage) Values() []ApplicationGatewayPrivateEndpointConnection { - if page.agpeclr.IsEmpty() { - return nil - } - return *page.agpeclr.Value -} - -// Creates a new instance of the ApplicationGatewayPrivateEndpointConnectionListResultPage type. -func NewApplicationGatewayPrivateEndpointConnectionListResultPage(cur ApplicationGatewayPrivateEndpointConnectionListResult, getNextPage func(context.Context, ApplicationGatewayPrivateEndpointConnectionListResult) (ApplicationGatewayPrivateEndpointConnectionListResult, error)) ApplicationGatewayPrivateEndpointConnectionListResultPage { - return ApplicationGatewayPrivateEndpointConnectionListResultPage{ - fn: getNextPage, - agpeclr: cur, - } -} - -// ApplicationGatewayPrivateEndpointConnectionProperties properties of Private Link Resource of an -// application gateway. -type ApplicationGatewayPrivateEndpointConnectionProperties struct { - // PrivateEndpoint - READ-ONLY; The resource of private end point. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the application gateway private endpoint connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // LinkIdentifier - READ-ONLY; The consumer link id. - LinkIdentifier *string `json:"linkIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateEndpointConnectionProperties. -func (agpecp ApplicationGatewayPrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agpecp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = agpecp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayPrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type ApplicationGatewayPrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationGatewayPrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationGatewayPrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationGatewayPrivateEndpointConnectionsDeleteFuture.Result. -func (future *ApplicationGatewayPrivateEndpointConnectionsDeleteFuture) result(client ApplicationGatewayPrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewayPrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationGatewayPrivateEndpointConnectionsUpdateFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type ApplicationGatewayPrivateEndpointConnectionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationGatewayPrivateEndpointConnectionsClient) (ApplicationGatewayPrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationGatewayPrivateEndpointConnectionsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationGatewayPrivateEndpointConnectionsUpdateFuture.Result. -func (future *ApplicationGatewayPrivateEndpointConnectionsUpdateFuture) result(client ApplicationGatewayPrivateEndpointConnectionsClient) (agpec ApplicationGatewayPrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - agpec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewayPrivateEndpointConnectionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if agpec.Response.Response, err = future.GetResult(sender); err == nil && agpec.Response.Response.StatusCode != http.StatusNoContent { - agpec, err = client.UpdateResponder(agpec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsUpdateFuture", "Result", agpec.Response.Response, "Failure responding to request") - } - } - return -} - -// ApplicationGatewayPrivateLinkConfiguration private Link Configuration on an application gateway. -type ApplicationGatewayPrivateLinkConfiguration struct { - // ApplicationGatewayPrivateLinkConfigurationProperties - Properties of the application gateway private link configuration. - *ApplicationGatewayPrivateLinkConfigurationProperties `json:"properties,omitempty"` - // Name - Name of the private link configuration that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkConfiguration. -func (agplc ApplicationGatewayPrivateLinkConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agplc.ApplicationGatewayPrivateLinkConfigurationProperties != nil { - objectMap["properties"] = agplc.ApplicationGatewayPrivateLinkConfigurationProperties - } - if agplc.Name != nil { - objectMap["name"] = agplc.Name - } - if agplc.ID != nil { - objectMap["id"] = agplc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayPrivateLinkConfiguration struct. -func (agplc *ApplicationGatewayPrivateLinkConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayPrivateLinkConfigurationProperties ApplicationGatewayPrivateLinkConfigurationProperties - err = json.Unmarshal(*v, &applicationGatewayPrivateLinkConfigurationProperties) - if err != nil { - return err - } - agplc.ApplicationGatewayPrivateLinkConfigurationProperties = &applicationGatewayPrivateLinkConfigurationProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agplc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agplc.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agplc.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agplc.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayPrivateLinkConfigurationProperties properties of private link configuration on an -// application gateway. -type ApplicationGatewayPrivateLinkConfigurationProperties struct { - // IPConfigurations - An array of application gateway private link ip configurations. - IPConfigurations *[]ApplicationGatewayPrivateLinkIPConfiguration `json:"ipConfigurations,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the application gateway private link configuration. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkConfigurationProperties. -func (agplcp ApplicationGatewayPrivateLinkConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agplcp.IPConfigurations != nil { - objectMap["ipConfigurations"] = agplcp.IPConfigurations - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayPrivateLinkIPConfiguration the application gateway private link ip configuration. -type ApplicationGatewayPrivateLinkIPConfiguration struct { - // ApplicationGatewayPrivateLinkIPConfigurationProperties - Properties of an application gateway private link ip configuration. - *ApplicationGatewayPrivateLinkIPConfigurationProperties `json:"properties,omitempty"` - // Name - The name of application gateway private link ip configuration. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkIPConfiguration. -func (agplic ApplicationGatewayPrivateLinkIPConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agplic.ApplicationGatewayPrivateLinkIPConfigurationProperties != nil { - objectMap["properties"] = agplic.ApplicationGatewayPrivateLinkIPConfigurationProperties - } - if agplic.Name != nil { - objectMap["name"] = agplic.Name - } - if agplic.ID != nil { - objectMap["id"] = agplic.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayPrivateLinkIPConfiguration struct. -func (agplic *ApplicationGatewayPrivateLinkIPConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayPrivateLinkIPConfigurationProperties ApplicationGatewayPrivateLinkIPConfigurationProperties - err = json.Unmarshal(*v, &applicationGatewayPrivateLinkIPConfigurationProperties) - if err != nil { - return err - } - agplic.ApplicationGatewayPrivateLinkIPConfigurationProperties = &applicationGatewayPrivateLinkIPConfigurationProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agplic.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agplic.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agplic.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agplic.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayPrivateLinkIPConfigurationProperties properties of an application gateway private link -// IP configuration. -type ApplicationGatewayPrivateLinkIPConfigurationProperties struct { - // PrivateIPAddress - The private IP address of the IP configuration. - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' - PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` - // Subnet - Reference to the subnet resource. - Subnet *SubResource `json:"subnet,omitempty"` - // Primary - Whether the ip configuration is primary or not. - Primary *bool `json:"primary,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the application gateway private link IP configuration. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkIPConfigurationProperties. -func (agplicp ApplicationGatewayPrivateLinkIPConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agplicp.PrivateIPAddress != nil { - objectMap["privateIPAddress"] = agplicp.PrivateIPAddress - } - if agplicp.PrivateIPAllocationMethod != "" { - objectMap["privateIPAllocationMethod"] = agplicp.PrivateIPAllocationMethod - } - if agplicp.Subnet != nil { - objectMap["subnet"] = agplicp.Subnet - } - if agplicp.Primary != nil { - objectMap["primary"] = agplicp.Primary - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayPrivateLinkResource privateLink Resource of an application gateway. -type ApplicationGatewayPrivateLinkResource struct { - // ApplicationGatewayPrivateLinkResourceProperties - Properties of the application gateway private link resource. - *ApplicationGatewayPrivateLinkResourceProperties `json:"properties,omitempty"` - // Name - Name of the private link resource that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkResource. -func (agplr ApplicationGatewayPrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agplr.ApplicationGatewayPrivateLinkResourceProperties != nil { - objectMap["properties"] = agplr.ApplicationGatewayPrivateLinkResourceProperties - } - if agplr.Name != nil { - objectMap["name"] = agplr.Name - } - if agplr.ID != nil { - objectMap["id"] = agplr.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayPrivateLinkResource struct. -func (agplr *ApplicationGatewayPrivateLinkResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayPrivateLinkResourceProperties ApplicationGatewayPrivateLinkResourceProperties - err = json.Unmarshal(*v, &applicationGatewayPrivateLinkResourceProperties) - if err != nil { - return err - } - agplr.ApplicationGatewayPrivateLinkResourceProperties = &applicationGatewayPrivateLinkResourceProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agplr.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agplr.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agplr.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agplr.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayPrivateLinkResourceListResult response for ListApplicationGatewayPrivateLinkResources -// API service call. Gets all private link resources for an application gateway. -type ApplicationGatewayPrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - List of private link resources of an application gateway. - Value *[]ApplicationGatewayPrivateLinkResource `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ApplicationGatewayPrivateLinkResourceListResultIterator provides access to a complete listing of -// ApplicationGatewayPrivateLinkResource values. -type ApplicationGatewayPrivateLinkResourceListResultIterator struct { - i int - page ApplicationGatewayPrivateLinkResourceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ApplicationGatewayPrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateLinkResourceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ApplicationGatewayPrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ApplicationGatewayPrivateLinkResourceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ApplicationGatewayPrivateLinkResourceListResultIterator) Response() ApplicationGatewayPrivateLinkResourceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ApplicationGatewayPrivateLinkResourceListResultIterator) Value() ApplicationGatewayPrivateLinkResource { - if !iter.page.NotDone() { - return ApplicationGatewayPrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ApplicationGatewayPrivateLinkResourceListResultIterator type. -func NewApplicationGatewayPrivateLinkResourceListResultIterator(page ApplicationGatewayPrivateLinkResourceListResultPage) ApplicationGatewayPrivateLinkResourceListResultIterator { - return ApplicationGatewayPrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (agplrlr ApplicationGatewayPrivateLinkResourceListResult) IsEmpty() bool { - return agplrlr.Value == nil || len(*agplrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (agplrlr ApplicationGatewayPrivateLinkResourceListResult) hasNextLink() bool { - return agplrlr.NextLink != nil && len(*agplrlr.NextLink) != 0 -} - -// applicationGatewayPrivateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (agplrlr ApplicationGatewayPrivateLinkResourceListResult) applicationGatewayPrivateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !agplrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(agplrlr.NextLink))) -} - -// ApplicationGatewayPrivateLinkResourceListResultPage contains a page of -// ApplicationGatewayPrivateLinkResource values. -type ApplicationGatewayPrivateLinkResourceListResultPage struct { - fn func(context.Context, ApplicationGatewayPrivateLinkResourceListResult) (ApplicationGatewayPrivateLinkResourceListResult, error) - agplrlr ApplicationGatewayPrivateLinkResourceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ApplicationGatewayPrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateLinkResourceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.agplrlr) - if err != nil { - return err - } - page.agplrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ApplicationGatewayPrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ApplicationGatewayPrivateLinkResourceListResultPage) NotDone() bool { - return !page.agplrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ApplicationGatewayPrivateLinkResourceListResultPage) Response() ApplicationGatewayPrivateLinkResourceListResult { - return page.agplrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ApplicationGatewayPrivateLinkResourceListResultPage) Values() []ApplicationGatewayPrivateLinkResource { - if page.agplrlr.IsEmpty() { - return nil - } - return *page.agplrlr.Value -} - -// Creates a new instance of the ApplicationGatewayPrivateLinkResourceListResultPage type. -func NewApplicationGatewayPrivateLinkResourceListResultPage(cur ApplicationGatewayPrivateLinkResourceListResult, getNextPage func(context.Context, ApplicationGatewayPrivateLinkResourceListResult) (ApplicationGatewayPrivateLinkResourceListResult, error)) ApplicationGatewayPrivateLinkResourceListResultPage { - return ApplicationGatewayPrivateLinkResourceListResultPage{ - fn: getNextPage, - agplrlr: cur, - } -} - -// ApplicationGatewayPrivateLinkResourceProperties properties of a private link resource. -type ApplicationGatewayPrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; Group identifier of private link resource. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; Required member names of private link resource. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - Required DNS zone names of the the private link resource. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkResourceProperties. -func (agplrp ApplicationGatewayPrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agplrp.RequiredZoneNames != nil { - objectMap["requiredZoneNames"] = agplrp.RequiredZoneNames - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayProbe probe of the application gateway. -type ApplicationGatewayProbe struct { - // ApplicationGatewayProbePropertiesFormat - Properties of the application gateway probe. - *ApplicationGatewayProbePropertiesFormat `json:"properties,omitempty"` - // Name - Name of the probe that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayProbe. -func (agp ApplicationGatewayProbe) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agp.ApplicationGatewayProbePropertiesFormat != nil { - objectMap["properties"] = agp.ApplicationGatewayProbePropertiesFormat - } - if agp.Name != nil { - objectMap["name"] = agp.Name - } - if agp.ID != nil { - objectMap["id"] = agp.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayProbe struct. -func (agp *ApplicationGatewayProbe) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayProbePropertiesFormat ApplicationGatewayProbePropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayProbePropertiesFormat) - if err != nil { - return err - } - agp.ApplicationGatewayProbePropertiesFormat = &applicationGatewayProbePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agp.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agp.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agp.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agp.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayProbeHealthResponseMatch application gateway probe health response match. -type ApplicationGatewayProbeHealthResponseMatch struct { - // Body - Body that must be contained in the health response. Default value is empty. - Body *string `json:"body,omitempty"` - // StatusCodes - Allowed ranges of healthy status codes. Default range of healthy status codes is 200-399. - StatusCodes *[]string `json:"statusCodes,omitempty"` -} - -// ApplicationGatewayProbePropertiesFormat properties of probe of an application gateway. -type ApplicationGatewayProbePropertiesFormat struct { - // Protocol - The protocol used for the probe. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' - Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` - // Host - Host name to send the probe to. - Host *string `json:"host,omitempty"` - // Path - Relative path of probe. Valid path starts from '/'. Probe is sent to ://:. - Path *string `json:"path,omitempty"` - // Interval - The probing interval in seconds. This is the time interval between two consecutive probes. Acceptable values are from 1 second to 86400 seconds. - Interval *int32 `json:"interval,omitempty"` - // Timeout - 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. - Timeout *int32 `json:"timeout,omitempty"` - // UnhealthyThreshold - The probe retry count. Backend server is marked down after consecutive probe failure count reaches UnhealthyThreshold. Acceptable values are from 1 second to 20. - UnhealthyThreshold *int32 `json:"unhealthyThreshold,omitempty"` - // PickHostNameFromBackendHTTPSettings - Whether the host header should be picked from the backend http settings. Default value is false. - PickHostNameFromBackendHTTPSettings *bool `json:"pickHostNameFromBackendHttpSettings,omitempty"` - // PickHostNameFromBackendSettings - Whether the server name indication should be picked from the backend settings for Tls protocol. Default value is false. - PickHostNameFromBackendSettings *bool `json:"pickHostNameFromBackendSettings,omitempty"` - // MinServers - Minimum number of servers that are always marked healthy. Default value is 0. - MinServers *int32 `json:"minServers,omitempty"` - // Match - Criterion for classifying a healthy probe response. - Match *ApplicationGatewayProbeHealthResponseMatch `json:"match,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the probe resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Port - 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. - Port *int32 `json:"port,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayProbePropertiesFormat. -func (agppf ApplicationGatewayProbePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agppf.Protocol != "" { - objectMap["protocol"] = agppf.Protocol - } - if agppf.Host != nil { - objectMap["host"] = agppf.Host - } - if agppf.Path != nil { - objectMap["path"] = agppf.Path - } - if agppf.Interval != nil { - objectMap["interval"] = agppf.Interval - } - if agppf.Timeout != nil { - objectMap["timeout"] = agppf.Timeout - } - if agppf.UnhealthyThreshold != nil { - objectMap["unhealthyThreshold"] = agppf.UnhealthyThreshold - } - if agppf.PickHostNameFromBackendHTTPSettings != nil { - objectMap["pickHostNameFromBackendHttpSettings"] = agppf.PickHostNameFromBackendHTTPSettings - } - if agppf.PickHostNameFromBackendSettings != nil { - objectMap["pickHostNameFromBackendSettings"] = agppf.PickHostNameFromBackendSettings - } - if agppf.MinServers != nil { - objectMap["minServers"] = agppf.MinServers - } - if agppf.Match != nil { - objectMap["match"] = agppf.Match - } - if agppf.Port != nil { - objectMap["port"] = agppf.Port - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayPropertiesFormat properties of the application gateway. -type ApplicationGatewayPropertiesFormat struct { - // Sku - SKU of the application gateway resource. - Sku *ApplicationGatewaySku `json:"sku,omitempty"` - // SslPolicy - SSL policy of the application gateway resource. - SslPolicy *ApplicationGatewaySslPolicy `json:"sslPolicy,omitempty"` - // OperationalState - READ-ONLY; Operational state of the application gateway resource. Possible values include: 'ApplicationGatewayOperationalStateStopped', 'ApplicationGatewayOperationalStateStarting', 'ApplicationGatewayOperationalStateRunning', 'ApplicationGatewayOperationalStateStopping' - OperationalState ApplicationGatewayOperationalState `json:"operationalState,omitempty"` - // GatewayIPConfigurations - 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). - GatewayIPConfigurations *[]ApplicationGatewayIPConfiguration `json:"gatewayIPConfigurations,omitempty"` - // AuthenticationCertificates - 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). - AuthenticationCertificates *[]ApplicationGatewayAuthenticationCertificate `json:"authenticationCertificates,omitempty"` - // TrustedRootCertificates - 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). - TrustedRootCertificates *[]ApplicationGatewayTrustedRootCertificate `json:"trustedRootCertificates,omitempty"` - // TrustedClientCertificates - 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). - TrustedClientCertificates *[]ApplicationGatewayTrustedClientCertificate `json:"trustedClientCertificates,omitempty"` - // SslCertificates - 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). - SslCertificates *[]ApplicationGatewaySslCertificate `json:"sslCertificates,omitempty"` - // FrontendIPConfigurations - 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). - FrontendIPConfigurations *[]ApplicationGatewayFrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` - // FrontendPorts - 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). - FrontendPorts *[]ApplicationGatewayFrontendPort `json:"frontendPorts,omitempty"` - // Probes - Probes of the application gateway resource. - Probes *[]ApplicationGatewayProbe `json:"probes,omitempty"` - // BackendAddressPools - 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). - BackendAddressPools *[]ApplicationGatewayBackendAddressPool `json:"backendAddressPools,omitempty"` - // BackendHTTPSettingsCollection - 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). - BackendHTTPSettingsCollection *[]ApplicationGatewayBackendHTTPSettings `json:"backendHttpSettingsCollection,omitempty"` - // BackendSettingsCollection - 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). - BackendSettingsCollection *[]ApplicationGatewayBackendSettings `json:"backendSettingsCollection,omitempty"` - // HTTPListeners - 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). - HTTPListeners *[]ApplicationGatewayHTTPListener `json:"httpListeners,omitempty"` - // Listeners - 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). - Listeners *[]ApplicationGatewayListener `json:"listeners,omitempty"` - // SslProfiles - 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). - SslProfiles *[]ApplicationGatewaySslProfile `json:"sslProfiles,omitempty"` - // URLPathMaps - 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). - URLPathMaps *[]ApplicationGatewayURLPathMap `json:"urlPathMaps,omitempty"` - // RequestRoutingRules - Request routing rules of the application gateway resource. - RequestRoutingRules *[]ApplicationGatewayRequestRoutingRule `json:"requestRoutingRules,omitempty"` - // RoutingRules - Routing rules of the application gateway resource. - RoutingRules *[]ApplicationGatewayRoutingRule `json:"routingRules,omitempty"` - // RewriteRuleSets - Rewrite rules for the application gateway resource. - RewriteRuleSets *[]ApplicationGatewayRewriteRuleSet `json:"rewriteRuleSets,omitempty"` - // RedirectConfigurations - 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). - RedirectConfigurations *[]ApplicationGatewayRedirectConfiguration `json:"redirectConfigurations,omitempty"` - // WebApplicationFirewallConfiguration - Web application firewall configuration. - WebApplicationFirewallConfiguration *ApplicationGatewayWebApplicationFirewallConfiguration `json:"webApplicationFirewallConfiguration,omitempty"` - // FirewallPolicy - Reference to the FirewallPolicy resource. - FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` - // EnableHTTP2 - Whether HTTP2 is enabled on the application gateway resource. - EnableHTTP2 *bool `json:"enableHttp2,omitempty"` - // EnableFips - Whether FIPS is enabled on the application gateway resource. - EnableFips *bool `json:"enableFips,omitempty"` - // AutoscaleConfiguration - Autoscale Configuration. - AutoscaleConfiguration *ApplicationGatewayAutoscaleConfiguration `json:"autoscaleConfiguration,omitempty"` - // PrivateLinkConfigurations - PrivateLink configurations on application gateway. - PrivateLinkConfigurations *[]ApplicationGatewayPrivateLinkConfiguration `json:"privateLinkConfigurations,omitempty"` - // PrivateEndpointConnections - READ-ONLY; Private Endpoint connections on application gateway. - PrivateEndpointConnections *[]ApplicationGatewayPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the application gateway resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the application gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // CustomErrorConfigurations - Custom error configurations of the application gateway resource. - CustomErrorConfigurations *[]ApplicationGatewayCustomError `json:"customErrorConfigurations,omitempty"` - // ForceFirewallPolicyAssociation - If true, associates a firewall policy with an application gateway regardless whether the policy differs from the WAF Config. - ForceFirewallPolicyAssociation *bool `json:"forceFirewallPolicyAssociation,omitempty"` - // LoadDistributionPolicies - Load distribution policies of the application gateway resource. - LoadDistributionPolicies *[]ApplicationGatewayLoadDistributionPolicy `json:"loadDistributionPolicies,omitempty"` - // GlobalConfiguration - Global Configuration. - GlobalConfiguration *ApplicationGatewayGlobalConfiguration `json:"globalConfiguration,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayPropertiesFormat. -func (agpf ApplicationGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agpf.Sku != nil { - objectMap["sku"] = agpf.Sku - } - if agpf.SslPolicy != nil { - objectMap["sslPolicy"] = agpf.SslPolicy - } - if agpf.GatewayIPConfigurations != nil { - objectMap["gatewayIPConfigurations"] = agpf.GatewayIPConfigurations - } - if agpf.AuthenticationCertificates != nil { - objectMap["authenticationCertificates"] = agpf.AuthenticationCertificates - } - if agpf.TrustedRootCertificates != nil { - objectMap["trustedRootCertificates"] = agpf.TrustedRootCertificates - } - if agpf.TrustedClientCertificates != nil { - objectMap["trustedClientCertificates"] = agpf.TrustedClientCertificates - } - if agpf.SslCertificates != nil { - objectMap["sslCertificates"] = agpf.SslCertificates - } - if agpf.FrontendIPConfigurations != nil { - objectMap["frontendIPConfigurations"] = agpf.FrontendIPConfigurations - } - if agpf.FrontendPorts != nil { - objectMap["frontendPorts"] = agpf.FrontendPorts - } - if agpf.Probes != nil { - objectMap["probes"] = agpf.Probes - } - if agpf.BackendAddressPools != nil { - objectMap["backendAddressPools"] = agpf.BackendAddressPools - } - if agpf.BackendHTTPSettingsCollection != nil { - objectMap["backendHttpSettingsCollection"] = agpf.BackendHTTPSettingsCollection - } - if agpf.BackendSettingsCollection != nil { - objectMap["backendSettingsCollection"] = agpf.BackendSettingsCollection - } - if agpf.HTTPListeners != nil { - objectMap["httpListeners"] = agpf.HTTPListeners - } - if agpf.Listeners != nil { - objectMap["listeners"] = agpf.Listeners - } - if agpf.SslProfiles != nil { - objectMap["sslProfiles"] = agpf.SslProfiles - } - if agpf.URLPathMaps != nil { - objectMap["urlPathMaps"] = agpf.URLPathMaps - } - if agpf.RequestRoutingRules != nil { - objectMap["requestRoutingRules"] = agpf.RequestRoutingRules - } - if agpf.RoutingRules != nil { - objectMap["routingRules"] = agpf.RoutingRules - } - if agpf.RewriteRuleSets != nil { - objectMap["rewriteRuleSets"] = agpf.RewriteRuleSets - } - if agpf.RedirectConfigurations != nil { - objectMap["redirectConfigurations"] = agpf.RedirectConfigurations - } - if agpf.WebApplicationFirewallConfiguration != nil { - objectMap["webApplicationFirewallConfiguration"] = agpf.WebApplicationFirewallConfiguration - } - if agpf.FirewallPolicy != nil { - objectMap["firewallPolicy"] = agpf.FirewallPolicy - } - if agpf.EnableHTTP2 != nil { - objectMap["enableHttp2"] = agpf.EnableHTTP2 - } - if agpf.EnableFips != nil { - objectMap["enableFips"] = agpf.EnableFips - } - if agpf.AutoscaleConfiguration != nil { - objectMap["autoscaleConfiguration"] = agpf.AutoscaleConfiguration - } - if agpf.PrivateLinkConfigurations != nil { - objectMap["privateLinkConfigurations"] = agpf.PrivateLinkConfigurations - } - if agpf.CustomErrorConfigurations != nil { - objectMap["customErrorConfigurations"] = agpf.CustomErrorConfigurations - } - if agpf.ForceFirewallPolicyAssociation != nil { - objectMap["forceFirewallPolicyAssociation"] = agpf.ForceFirewallPolicyAssociation - } - if agpf.LoadDistributionPolicies != nil { - objectMap["loadDistributionPolicies"] = agpf.LoadDistributionPolicies - } - if agpf.GlobalConfiguration != nil { - objectMap["globalConfiguration"] = agpf.GlobalConfiguration - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayRedirectConfiguration redirect configuration of an application gateway. -type ApplicationGatewayRedirectConfiguration struct { - // ApplicationGatewayRedirectConfigurationPropertiesFormat - Properties of the application gateway redirect configuration. - *ApplicationGatewayRedirectConfigurationPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the redirect configuration that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayRedirectConfiguration. -func (agrc ApplicationGatewayRedirectConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agrc.ApplicationGatewayRedirectConfigurationPropertiesFormat != nil { - objectMap["properties"] = agrc.ApplicationGatewayRedirectConfigurationPropertiesFormat - } - if agrc.Name != nil { - objectMap["name"] = agrc.Name - } - if agrc.ID != nil { - objectMap["id"] = agrc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayRedirectConfiguration struct. -func (agrc *ApplicationGatewayRedirectConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayRedirectConfigurationPropertiesFormat ApplicationGatewayRedirectConfigurationPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayRedirectConfigurationPropertiesFormat) - if err != nil { - return err - } - agrc.ApplicationGatewayRedirectConfigurationPropertiesFormat = &applicationGatewayRedirectConfigurationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agrc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agrc.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agrc.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agrc.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayRedirectConfigurationPropertiesFormat properties of redirect configuration of the -// application gateway. -type ApplicationGatewayRedirectConfigurationPropertiesFormat struct { - // RedirectType - HTTP redirection type. Possible values include: 'ApplicationGatewayRedirectTypePermanent', 'ApplicationGatewayRedirectTypeFound', 'ApplicationGatewayRedirectTypeSeeOther', 'ApplicationGatewayRedirectTypeTemporary' - RedirectType ApplicationGatewayRedirectType `json:"redirectType,omitempty"` - // TargetListener - Reference to a listener to redirect the request to. - TargetListener *SubResource `json:"targetListener,omitempty"` - // TargetURL - Url to redirect the request to. - TargetURL *string `json:"targetUrl,omitempty"` - // IncludePath - Include path in the redirected url. - IncludePath *bool `json:"includePath,omitempty"` - // IncludeQueryString - Include query string in the redirected url. - IncludeQueryString *bool `json:"includeQueryString,omitempty"` - // RequestRoutingRules - Request routing specifying redirect configuration. - RequestRoutingRules *[]SubResource `json:"requestRoutingRules,omitempty"` - // URLPathMaps - Url path maps specifying default redirect configuration. - URLPathMaps *[]SubResource `json:"urlPathMaps,omitempty"` - // PathRules - Path rules specifying redirect configuration. - PathRules *[]SubResource `json:"pathRules,omitempty"` -} - -// ApplicationGatewayRequestRoutingRule request routing rule of an application gateway. -type ApplicationGatewayRequestRoutingRule struct { - // ApplicationGatewayRequestRoutingRulePropertiesFormat - Properties of the application gateway request routing rule. - *ApplicationGatewayRequestRoutingRulePropertiesFormat `json:"properties,omitempty"` - // Name - Name of the request routing rule that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayRequestRoutingRule. -func (agrrr ApplicationGatewayRequestRoutingRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agrrr.ApplicationGatewayRequestRoutingRulePropertiesFormat != nil { - objectMap["properties"] = agrrr.ApplicationGatewayRequestRoutingRulePropertiesFormat - } - if agrrr.Name != nil { - objectMap["name"] = agrrr.Name - } - if agrrr.ID != nil { - objectMap["id"] = agrrr.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayRequestRoutingRule struct. -func (agrrr *ApplicationGatewayRequestRoutingRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayRequestRoutingRulePropertiesFormat ApplicationGatewayRequestRoutingRulePropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayRequestRoutingRulePropertiesFormat) - if err != nil { - return err - } - agrrr.ApplicationGatewayRequestRoutingRulePropertiesFormat = &applicationGatewayRequestRoutingRulePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agrrr.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agrrr.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agrrr.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agrrr.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayRequestRoutingRulePropertiesFormat properties of request routing rule of the -// application gateway. -type ApplicationGatewayRequestRoutingRulePropertiesFormat struct { - // RuleType - Rule type. Possible values include: 'ApplicationGatewayRequestRoutingRuleTypeBasic', 'ApplicationGatewayRequestRoutingRuleTypePathBasedRouting' - RuleType ApplicationGatewayRequestRoutingRuleType `json:"ruleType,omitempty"` - // Priority - Priority of the request routing rule. - Priority *int32 `json:"priority,omitempty"` - // BackendAddressPool - Backend address pool resource of the application gateway. - BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` - // BackendHTTPSettings - Backend http settings resource of the application gateway. - BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` - // HTTPListener - Http listener resource of the application gateway. - HTTPListener *SubResource `json:"httpListener,omitempty"` - // URLPathMap - URL path map resource of the application gateway. - URLPathMap *SubResource `json:"urlPathMap,omitempty"` - // RewriteRuleSet - Rewrite Rule Set resource in Basic rule of the application gateway. - RewriteRuleSet *SubResource `json:"rewriteRuleSet,omitempty"` - // RedirectConfiguration - Redirect configuration resource of the application gateway. - RedirectConfiguration *SubResource `json:"redirectConfiguration,omitempty"` - // LoadDistributionPolicy - Load Distribution Policy resource of the application gateway. - LoadDistributionPolicy *SubResource `json:"loadDistributionPolicy,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the request routing rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayRequestRoutingRulePropertiesFormat. -func (agrrrpf ApplicationGatewayRequestRoutingRulePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agrrrpf.RuleType != "" { - objectMap["ruleType"] = agrrrpf.RuleType - } - if agrrrpf.Priority != nil { - objectMap["priority"] = agrrrpf.Priority - } - if agrrrpf.BackendAddressPool != nil { - objectMap["backendAddressPool"] = agrrrpf.BackendAddressPool - } - if agrrrpf.BackendHTTPSettings != nil { - objectMap["backendHttpSettings"] = agrrrpf.BackendHTTPSettings - } - if agrrrpf.HTTPListener != nil { - objectMap["httpListener"] = agrrrpf.HTTPListener - } - if agrrrpf.URLPathMap != nil { - objectMap["urlPathMap"] = agrrrpf.URLPathMap - } - if agrrrpf.RewriteRuleSet != nil { - objectMap["rewriteRuleSet"] = agrrrpf.RewriteRuleSet - } - if agrrrpf.RedirectConfiguration != nil { - objectMap["redirectConfiguration"] = agrrrpf.RedirectConfiguration - } - if agrrrpf.LoadDistributionPolicy != nil { - objectMap["loadDistributionPolicy"] = agrrrpf.LoadDistributionPolicy - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayRewriteRule rewrite rule of an application gateway. -type ApplicationGatewayRewriteRule struct { - // Name - Name of the rewrite rule that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // RuleSequence - Rule Sequence of the rewrite rule that determines the order of execution of a particular rule in a RewriteRuleSet. - RuleSequence *int32 `json:"ruleSequence,omitempty"` - // Conditions - Conditions based on which the action set execution will be evaluated. - Conditions *[]ApplicationGatewayRewriteRuleCondition `json:"conditions,omitempty"` - // ActionSet - Set of actions to be done as part of the rewrite Rule. - ActionSet *ApplicationGatewayRewriteRuleActionSet `json:"actionSet,omitempty"` -} - -// ApplicationGatewayRewriteRuleActionSet set of actions in the Rewrite Rule in Application Gateway. -type ApplicationGatewayRewriteRuleActionSet struct { - // RequestHeaderConfigurations - Request Header Actions in the Action Set. - RequestHeaderConfigurations *[]ApplicationGatewayHeaderConfiguration `json:"requestHeaderConfigurations,omitempty"` - // ResponseHeaderConfigurations - Response Header Actions in the Action Set. - ResponseHeaderConfigurations *[]ApplicationGatewayHeaderConfiguration `json:"responseHeaderConfigurations,omitempty"` - // URLConfiguration - Url Configuration Action in the Action Set. - URLConfiguration *ApplicationGatewayURLConfiguration `json:"urlConfiguration,omitempty"` -} - -// ApplicationGatewayRewriteRuleCondition set of conditions in the Rewrite Rule in Application Gateway. -type ApplicationGatewayRewriteRuleCondition struct { - // Variable - The condition parameter of the RewriteRuleCondition. - Variable *string `json:"variable,omitempty"` - // Pattern - The pattern, either fixed string or regular expression, that evaluates the truthfulness of the condition. - Pattern *string `json:"pattern,omitempty"` - // IgnoreCase - Setting this parameter to truth value with force the pattern to do a case in-sensitive comparison. - IgnoreCase *bool `json:"ignoreCase,omitempty"` - // Negate - Setting this value as truth will force to check the negation of the condition given by the user. - Negate *bool `json:"negate,omitempty"` -} - -// ApplicationGatewayRewriteRuleSet rewrite rule set of an application gateway. -type ApplicationGatewayRewriteRuleSet struct { - // ApplicationGatewayRewriteRuleSetPropertiesFormat - Properties of the application gateway rewrite rule set. - *ApplicationGatewayRewriteRuleSetPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the rewrite rule set that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayRewriteRuleSet. -func (agrrs ApplicationGatewayRewriteRuleSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agrrs.ApplicationGatewayRewriteRuleSetPropertiesFormat != nil { - objectMap["properties"] = agrrs.ApplicationGatewayRewriteRuleSetPropertiesFormat - } - if agrrs.Name != nil { - objectMap["name"] = agrrs.Name - } - if agrrs.ID != nil { - objectMap["id"] = agrrs.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayRewriteRuleSet struct. -func (agrrs *ApplicationGatewayRewriteRuleSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayRewriteRuleSetPropertiesFormat ApplicationGatewayRewriteRuleSetPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayRewriteRuleSetPropertiesFormat) - if err != nil { - return err - } - agrrs.ApplicationGatewayRewriteRuleSetPropertiesFormat = &applicationGatewayRewriteRuleSetPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agrrs.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agrrs.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agrrs.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayRewriteRuleSetPropertiesFormat properties of rewrite rule set of the application -// gateway. -type ApplicationGatewayRewriteRuleSetPropertiesFormat struct { - // RewriteRules - Rewrite rules in the rewrite rule set. - RewriteRules *[]ApplicationGatewayRewriteRule `json:"rewriteRules,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the rewrite rule set resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayRewriteRuleSetPropertiesFormat. -func (agrrspf ApplicationGatewayRewriteRuleSetPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agrrspf.RewriteRules != nil { - objectMap["rewriteRules"] = agrrspf.RewriteRules - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayRoutingRule routing rule of an application gateway. -type ApplicationGatewayRoutingRule struct { - // ApplicationGatewayRoutingRulePropertiesFormat - Properties of the application gateway routing rule. - *ApplicationGatewayRoutingRulePropertiesFormat `json:"properties,omitempty"` - // Name - Name of the routing rule that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayRoutingRule. -func (agrr ApplicationGatewayRoutingRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agrr.ApplicationGatewayRoutingRulePropertiesFormat != nil { - objectMap["properties"] = agrr.ApplicationGatewayRoutingRulePropertiesFormat - } - if agrr.Name != nil { - objectMap["name"] = agrr.Name - } - if agrr.ID != nil { - objectMap["id"] = agrr.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayRoutingRule struct. -func (agrr *ApplicationGatewayRoutingRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayRoutingRulePropertiesFormat ApplicationGatewayRoutingRulePropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayRoutingRulePropertiesFormat) - if err != nil { - return err - } - agrr.ApplicationGatewayRoutingRulePropertiesFormat = &applicationGatewayRoutingRulePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agrr.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agrr.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agrr.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agrr.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayRoutingRulePropertiesFormat properties of routing rule of the application gateway. -type ApplicationGatewayRoutingRulePropertiesFormat struct { - // RuleType - Rule type. Possible values include: 'ApplicationGatewayRequestRoutingRuleTypeBasic', 'ApplicationGatewayRequestRoutingRuleTypePathBasedRouting' - RuleType ApplicationGatewayRequestRoutingRuleType `json:"ruleType,omitempty"` - // Priority - Priority of the routing rule. - Priority *int32 `json:"priority,omitempty"` - // BackendAddressPool - Backend address pool resource of the application gateway. - BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` - // BackendSettings - Backend settings resource of the application gateway. - BackendSettings *SubResource `json:"backendSettings,omitempty"` - // Listener - Listener resource of the application gateway. - Listener *SubResource `json:"listener,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the request routing rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayRoutingRulePropertiesFormat. -func (agrrpf ApplicationGatewayRoutingRulePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agrrpf.RuleType != "" { - objectMap["ruleType"] = agrrpf.RuleType - } - if agrrpf.Priority != nil { - objectMap["priority"] = agrrpf.Priority - } - if agrrpf.BackendAddressPool != nil { - objectMap["backendAddressPool"] = agrrpf.BackendAddressPool - } - if agrrpf.BackendSettings != nil { - objectMap["backendSettings"] = agrrpf.BackendSettings - } - if agrrpf.Listener != nil { - objectMap["listener"] = agrrpf.Listener - } - return json.Marshal(objectMap) -} - -// ApplicationGatewaySku SKU of an application gateway. -type ApplicationGatewaySku struct { - // Name - Name of an application gateway SKU. Possible values include: 'ApplicationGatewaySkuNameStandardSmall', 'ApplicationGatewaySkuNameStandardMedium', 'ApplicationGatewaySkuNameStandardLarge', 'ApplicationGatewaySkuNameWAFMedium', 'ApplicationGatewaySkuNameWAFLarge', 'ApplicationGatewaySkuNameStandardV2', 'ApplicationGatewaySkuNameWAFV2' - Name ApplicationGatewaySkuName `json:"name,omitempty"` - // Tier - Tier of an application gateway. Possible values include: 'ApplicationGatewayTierStandard', 'ApplicationGatewayTierWAF', 'ApplicationGatewayTierStandardV2', 'ApplicationGatewayTierWAFV2' - Tier ApplicationGatewayTier `json:"tier,omitempty"` - // Capacity - Capacity (instance count) of an application gateway. - Capacity *int32 `json:"capacity,omitempty"` -} - -// ApplicationGatewaySslCertificate SSL certificates of an application gateway. -type ApplicationGatewaySslCertificate struct { - // ApplicationGatewaySslCertificatePropertiesFormat - Properties of the application gateway SSL certificate. - *ApplicationGatewaySslCertificatePropertiesFormat `json:"properties,omitempty"` - // Name - Name of the SSL certificate that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewaySslCertificate. -func (agsc ApplicationGatewaySslCertificate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agsc.ApplicationGatewaySslCertificatePropertiesFormat != nil { - objectMap["properties"] = agsc.ApplicationGatewaySslCertificatePropertiesFormat - } - if agsc.Name != nil { - objectMap["name"] = agsc.Name - } - if agsc.ID != nil { - objectMap["id"] = agsc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewaySslCertificate struct. -func (agsc *ApplicationGatewaySslCertificate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewaySslCertificatePropertiesFormat ApplicationGatewaySslCertificatePropertiesFormat - err = json.Unmarshal(*v, &applicationGatewaySslCertificatePropertiesFormat) - if err != nil { - return err - } - agsc.ApplicationGatewaySslCertificatePropertiesFormat = &applicationGatewaySslCertificatePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agsc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agsc.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agsc.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agsc.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewaySslCertificatePropertiesFormat properties of SSL certificates of an application -// gateway. -type ApplicationGatewaySslCertificatePropertiesFormat struct { - // Data - Base-64 encoded pfx certificate. Only applicable in PUT Request. - Data *string `json:"data,omitempty"` - // Password - Password for the pfx file specified in data. Only applicable in PUT request. - Password *string `json:"password,omitempty"` - // PublicCertData - READ-ONLY; Base-64 encoded Public cert data corresponding to pfx specified in data. Only applicable in GET request. - PublicCertData *string `json:"publicCertData,omitempty"` - // KeyVaultSecretID - Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. - KeyVaultSecretID *string `json:"keyVaultSecretId,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the SSL certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewaySslCertificatePropertiesFormat. -func (agscpf ApplicationGatewaySslCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agscpf.Data != nil { - objectMap["data"] = agscpf.Data - } - if agscpf.Password != nil { - objectMap["password"] = agscpf.Password - } - if agscpf.KeyVaultSecretID != nil { - objectMap["keyVaultSecretId"] = agscpf.KeyVaultSecretID - } - return json.Marshal(objectMap) -} - -// ApplicationGatewaySslPolicy application Gateway Ssl policy. -type ApplicationGatewaySslPolicy struct { - // DisabledSslProtocols - Ssl protocols to be disabled on application gateway. - DisabledSslProtocols *[]ApplicationGatewaySslProtocol `json:"disabledSslProtocols,omitempty"` - // PolicyType - Type of Ssl Policy. Possible values include: 'ApplicationGatewaySslPolicyTypePredefined', 'ApplicationGatewaySslPolicyTypeCustom', 'ApplicationGatewaySslPolicyTypeCustomV2' - PolicyType ApplicationGatewaySslPolicyType `json:"policyType,omitempty"` - // PolicyName - Name of Ssl predefined policy. Possible values include: 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20150501', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401S', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101S' - PolicyName ApplicationGatewaySslPolicyName `json:"policyName,omitempty"` - // CipherSuites - Ssl cipher suites to be enabled in the specified order to application gateway. - CipherSuites *[]ApplicationGatewaySslCipherSuite `json:"cipherSuites,omitempty"` - // MinProtocolVersion - Minimum version of Ssl protocol to be supported on application gateway. Possible values include: 'ApplicationGatewaySslProtocolTLSv10', 'ApplicationGatewaySslProtocolTLSv11', 'ApplicationGatewaySslProtocolTLSv12', 'ApplicationGatewaySslProtocolTLSv13' - MinProtocolVersion ApplicationGatewaySslProtocol `json:"minProtocolVersion,omitempty"` -} - -// ApplicationGatewaySslPredefinedPolicy an Ssl predefined policy. -type ApplicationGatewaySslPredefinedPolicy struct { - autorest.Response `json:"-"` - // Name - Name of the Ssl predefined policy. - Name *string `json:"name,omitempty"` - // ApplicationGatewaySslPredefinedPolicyPropertiesFormat - Properties of the application gateway SSL predefined policy. - *ApplicationGatewaySslPredefinedPolicyPropertiesFormat `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewaySslPredefinedPolicy. -func (agspp ApplicationGatewaySslPredefinedPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agspp.Name != nil { - objectMap["name"] = agspp.Name - } - if agspp.ApplicationGatewaySslPredefinedPolicyPropertiesFormat != nil { - objectMap["properties"] = agspp.ApplicationGatewaySslPredefinedPolicyPropertiesFormat - } - if agspp.ID != nil { - objectMap["id"] = agspp.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewaySslPredefinedPolicy struct. -func (agspp *ApplicationGatewaySslPredefinedPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agspp.Name = &name - } - case "properties": - if v != nil { - var applicationGatewaySslPredefinedPolicyPropertiesFormat ApplicationGatewaySslPredefinedPolicyPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewaySslPredefinedPolicyPropertiesFormat) - if err != nil { - return err - } - agspp.ApplicationGatewaySslPredefinedPolicyPropertiesFormat = &applicationGatewaySslPredefinedPolicyPropertiesFormat - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agspp.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewaySslPredefinedPolicyPropertiesFormat properties of -// ApplicationGatewaySslPredefinedPolicy. -type ApplicationGatewaySslPredefinedPolicyPropertiesFormat struct { - // CipherSuites - Ssl cipher suites to be enabled in the specified order for application gateway. - CipherSuites *[]ApplicationGatewaySslCipherSuite `json:"cipherSuites,omitempty"` - // MinProtocolVersion - Minimum version of Ssl protocol to be supported on application gateway. Possible values include: 'ApplicationGatewaySslProtocolTLSv10', 'ApplicationGatewaySslProtocolTLSv11', 'ApplicationGatewaySslProtocolTLSv12', 'ApplicationGatewaySslProtocolTLSv13' - MinProtocolVersion ApplicationGatewaySslProtocol `json:"minProtocolVersion,omitempty"` -} - -// ApplicationGatewaySslProfile SSL profile of an application gateway. -type ApplicationGatewaySslProfile struct { - // ApplicationGatewaySslProfilePropertiesFormat - Properties of the application gateway SSL profile. - *ApplicationGatewaySslProfilePropertiesFormat `json:"properties,omitempty"` - // Name - Name of the SSL profile that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewaySslProfile. -func (agsp ApplicationGatewaySslProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agsp.ApplicationGatewaySslProfilePropertiesFormat != nil { - objectMap["properties"] = agsp.ApplicationGatewaySslProfilePropertiesFormat - } - if agsp.Name != nil { - objectMap["name"] = agsp.Name - } - if agsp.ID != nil { - objectMap["id"] = agsp.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewaySslProfile struct. -func (agsp *ApplicationGatewaySslProfile) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewaySslProfilePropertiesFormat ApplicationGatewaySslProfilePropertiesFormat - err = json.Unmarshal(*v, &applicationGatewaySslProfilePropertiesFormat) - if err != nil { - return err - } - agsp.ApplicationGatewaySslProfilePropertiesFormat = &applicationGatewaySslProfilePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agsp.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agsp.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agsp.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agsp.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewaySslProfilePropertiesFormat properties of SSL profile of an application gateway. -type ApplicationGatewaySslProfilePropertiesFormat struct { - // TrustedClientCertificates - Array of references to application gateway trusted client certificates. - TrustedClientCertificates *[]SubResource `json:"trustedClientCertificates,omitempty"` - // SslPolicy - SSL policy of the application gateway resource. - SslPolicy *ApplicationGatewaySslPolicy `json:"sslPolicy,omitempty"` - // ClientAuthConfiguration - Client authentication configuration of the application gateway resource. - ClientAuthConfiguration *ApplicationGatewayClientAuthConfiguration `json:"clientAuthConfiguration,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the HTTP listener resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewaySslProfilePropertiesFormat. -func (agsppf ApplicationGatewaySslProfilePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agsppf.TrustedClientCertificates != nil { - objectMap["trustedClientCertificates"] = agsppf.TrustedClientCertificates - } - if agsppf.SslPolicy != nil { - objectMap["sslPolicy"] = agsppf.SslPolicy - } - if agsppf.ClientAuthConfiguration != nil { - objectMap["clientAuthConfiguration"] = agsppf.ClientAuthConfiguration - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayTrustedClientCertificate trusted client certificates of an application gateway. -type ApplicationGatewayTrustedClientCertificate struct { - // ApplicationGatewayTrustedClientCertificatePropertiesFormat - Properties of the application gateway trusted client certificate. - *ApplicationGatewayTrustedClientCertificatePropertiesFormat `json:"properties,omitempty"` - // Name - Name of the trusted client certificate that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayTrustedClientCertificate. -func (agtcc ApplicationGatewayTrustedClientCertificate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agtcc.ApplicationGatewayTrustedClientCertificatePropertiesFormat != nil { - objectMap["properties"] = agtcc.ApplicationGatewayTrustedClientCertificatePropertiesFormat - } - if agtcc.Name != nil { - objectMap["name"] = agtcc.Name - } - if agtcc.ID != nil { - objectMap["id"] = agtcc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayTrustedClientCertificate struct. -func (agtcc *ApplicationGatewayTrustedClientCertificate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayTrustedClientCertificatePropertiesFormat ApplicationGatewayTrustedClientCertificatePropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayTrustedClientCertificatePropertiesFormat) - if err != nil { - return err - } - agtcc.ApplicationGatewayTrustedClientCertificatePropertiesFormat = &applicationGatewayTrustedClientCertificatePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agtcc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agtcc.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agtcc.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agtcc.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayTrustedClientCertificatePropertiesFormat trusted client certificates properties of an -// application gateway. -type ApplicationGatewayTrustedClientCertificatePropertiesFormat struct { - // Data - Certificate public data. - Data *string `json:"data,omitempty"` - // ValidatedCertData - READ-ONLY; Validated certificate data. - ValidatedCertData *string `json:"validatedCertData,omitempty"` - // ClientCertIssuerDN - READ-ONLY; Distinguished name of client certificate issuer. - ClientCertIssuerDN *string `json:"clientCertIssuerDN,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the trusted client certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayTrustedClientCertificatePropertiesFormat. -func (agtccpf ApplicationGatewayTrustedClientCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agtccpf.Data != nil { - objectMap["data"] = agtccpf.Data - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayTrustedRootCertificate trusted Root certificates of an application gateway. -type ApplicationGatewayTrustedRootCertificate struct { - // ApplicationGatewayTrustedRootCertificatePropertiesFormat - Properties of the application gateway trusted root certificate. - *ApplicationGatewayTrustedRootCertificatePropertiesFormat `json:"properties,omitempty"` - // Name - Name of the trusted root certificate that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayTrustedRootCertificate. -func (agtrc ApplicationGatewayTrustedRootCertificate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agtrc.ApplicationGatewayTrustedRootCertificatePropertiesFormat != nil { - objectMap["properties"] = agtrc.ApplicationGatewayTrustedRootCertificatePropertiesFormat - } - if agtrc.Name != nil { - objectMap["name"] = agtrc.Name - } - if agtrc.ID != nil { - objectMap["id"] = agtrc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayTrustedRootCertificate struct. -func (agtrc *ApplicationGatewayTrustedRootCertificate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayTrustedRootCertificatePropertiesFormat ApplicationGatewayTrustedRootCertificatePropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayTrustedRootCertificatePropertiesFormat) - if err != nil { - return err - } - agtrc.ApplicationGatewayTrustedRootCertificatePropertiesFormat = &applicationGatewayTrustedRootCertificatePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agtrc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agtrc.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agtrc.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agtrc.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayTrustedRootCertificatePropertiesFormat trusted Root certificates properties of an -// application gateway. -type ApplicationGatewayTrustedRootCertificatePropertiesFormat struct { - // Data - Certificate public data. - Data *string `json:"data,omitempty"` - // KeyVaultSecretID - Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. - KeyVaultSecretID *string `json:"keyVaultSecretId,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the trusted root certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayTrustedRootCertificatePropertiesFormat. -func (agtrcpf ApplicationGatewayTrustedRootCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agtrcpf.Data != nil { - objectMap["data"] = agtrcpf.Data - } - if agtrcpf.KeyVaultSecretID != nil { - objectMap["keyVaultSecretId"] = agtrcpf.KeyVaultSecretID - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayURLConfiguration url configuration of the Actions set in Application Gateway. -type ApplicationGatewayURLConfiguration struct { - // ModifiedPath - Url path which user has provided for url rewrite. Null means no path will be updated. Default value is null. - ModifiedPath *string `json:"modifiedPath,omitempty"` - // ModifiedQueryString - Query string which user has provided for url rewrite. Null means no query string will be updated. Default value is null. - ModifiedQueryString *string `json:"modifiedQueryString,omitempty"` - // Reroute - 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. - Reroute *bool `json:"reroute,omitempty"` -} - -// ApplicationGatewayURLPathMap urlPathMaps give a url path to the backend mapping information for -// PathBasedRouting. -type ApplicationGatewayURLPathMap struct { - // ApplicationGatewayURLPathMapPropertiesFormat - Properties of the application gateway URL path map. - *ApplicationGatewayURLPathMapPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the URL path map that is unique within an Application Gateway. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayURLPathMap. -func (agupm ApplicationGatewayURLPathMap) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agupm.ApplicationGatewayURLPathMapPropertiesFormat != nil { - objectMap["properties"] = agupm.ApplicationGatewayURLPathMapPropertiesFormat - } - if agupm.Name != nil { - objectMap["name"] = agupm.Name - } - if agupm.ID != nil { - objectMap["id"] = agupm.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayURLPathMap struct. -func (agupm *ApplicationGatewayURLPathMap) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationGatewayURLPathMapPropertiesFormat ApplicationGatewayURLPathMapPropertiesFormat - err = json.Unmarshal(*v, &applicationGatewayURLPathMapPropertiesFormat) - if err != nil { - return err - } - agupm.ApplicationGatewayURLPathMapPropertiesFormat = &applicationGatewayURLPathMapPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agupm.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - agupm.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agupm.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agupm.ID = &ID - } - } - } - - return nil -} - -// ApplicationGatewayURLPathMapPropertiesFormat properties of UrlPathMap of the application gateway. -type ApplicationGatewayURLPathMapPropertiesFormat struct { - // DefaultBackendAddressPool - Default backend address pool resource of URL path map. - DefaultBackendAddressPool *SubResource `json:"defaultBackendAddressPool,omitempty"` - // DefaultBackendHTTPSettings - Default backend http settings resource of URL path map. - DefaultBackendHTTPSettings *SubResource `json:"defaultBackendHttpSettings,omitempty"` - // DefaultRewriteRuleSet - Default Rewrite rule set resource of URL path map. - DefaultRewriteRuleSet *SubResource `json:"defaultRewriteRuleSet,omitempty"` - // DefaultRedirectConfiguration - Default redirect configuration resource of URL path map. - DefaultRedirectConfiguration *SubResource `json:"defaultRedirectConfiguration,omitempty"` - // DefaultLoadDistributionPolicy - Default Load Distribution Policy resource of URL path map. - DefaultLoadDistributionPolicy *SubResource `json:"defaultLoadDistributionPolicy,omitempty"` - // PathRules - Path rule of URL path map resource. - PathRules *[]ApplicationGatewayPathRule `json:"pathRules,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the URL path map resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayURLPathMapPropertiesFormat. -func (agupmpf ApplicationGatewayURLPathMapPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agupmpf.DefaultBackendAddressPool != nil { - objectMap["defaultBackendAddressPool"] = agupmpf.DefaultBackendAddressPool - } - if agupmpf.DefaultBackendHTTPSettings != nil { - objectMap["defaultBackendHttpSettings"] = agupmpf.DefaultBackendHTTPSettings - } - if agupmpf.DefaultRewriteRuleSet != nil { - objectMap["defaultRewriteRuleSet"] = agupmpf.DefaultRewriteRuleSet - } - if agupmpf.DefaultRedirectConfiguration != nil { - objectMap["defaultRedirectConfiguration"] = agupmpf.DefaultRedirectConfiguration - } - if agupmpf.DefaultLoadDistributionPolicy != nil { - objectMap["defaultLoadDistributionPolicy"] = agupmpf.DefaultLoadDistributionPolicy - } - if agupmpf.PathRules != nil { - objectMap["pathRules"] = agupmpf.PathRules - } - return json.Marshal(objectMap) -} - -// ApplicationGatewayWafDynamicManifestPropertiesResult properties of ApplicationGatewayWafDynamicManifest. -type ApplicationGatewayWafDynamicManifestPropertiesResult struct { - // DefaultRuleSetPropertyFormat - The default ruleset. - *DefaultRuleSetPropertyFormat `json:"defaultRuleSet,omitempty"` - // AvailableRuleSets - The available rulesets. - AvailableRuleSets *[]ApplicationGatewayFirewallManifestRuleSet `json:"availableRuleSets,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayWafDynamicManifestPropertiesResult. -func (agwdmpr ApplicationGatewayWafDynamicManifestPropertiesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agwdmpr.DefaultRuleSetPropertyFormat != nil { - objectMap["defaultRuleSet"] = agwdmpr.DefaultRuleSetPropertyFormat - } - if agwdmpr.AvailableRuleSets != nil { - objectMap["availableRuleSets"] = agwdmpr.AvailableRuleSets - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayWafDynamicManifestPropertiesResult struct. -func (agwdmpr *ApplicationGatewayWafDynamicManifestPropertiesResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "defaultRuleSet": - if v != nil { - var defaultRuleSetPropertyFormat DefaultRuleSetPropertyFormat - err = json.Unmarshal(*v, &defaultRuleSetPropertyFormat) - if err != nil { - return err - } - agwdmpr.DefaultRuleSetPropertyFormat = &defaultRuleSetPropertyFormat - } - case "availableRuleSets": - if v != nil { - var availableRuleSets []ApplicationGatewayFirewallManifestRuleSet - err = json.Unmarshal(*v, &availableRuleSets) - if err != nil { - return err - } - agwdmpr.AvailableRuleSets = &availableRuleSets - } - } - } - - return nil -} - -// ApplicationGatewayWafDynamicManifestResult response for ApplicationGatewayWafDynamicManifest API service -// call. -type ApplicationGatewayWafDynamicManifestResult struct { - autorest.Response `json:"-"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ApplicationGatewayWafDynamicManifestPropertiesResult - Properties of the ApplicationGatewayWafDynamicManifest . - *ApplicationGatewayWafDynamicManifestPropertiesResult `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGatewayWafDynamicManifestResult. -func (agwdmr ApplicationGatewayWafDynamicManifestResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agwdmr.ID != nil { - objectMap["id"] = agwdmr.ID - } - if agwdmr.ApplicationGatewayWafDynamicManifestPropertiesResult != nil { - objectMap["properties"] = agwdmr.ApplicationGatewayWafDynamicManifestPropertiesResult - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayWafDynamicManifestResult struct. -func (agwdmr *ApplicationGatewayWafDynamicManifestResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agwdmr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agwdmr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agwdmr.Type = &typeVar - } - case "properties": - if v != nil { - var applicationGatewayWafDynamicManifestPropertiesResult ApplicationGatewayWafDynamicManifestPropertiesResult - err = json.Unmarshal(*v, &applicationGatewayWafDynamicManifestPropertiesResult) - if err != nil { - return err - } - agwdmr.ApplicationGatewayWafDynamicManifestPropertiesResult = &applicationGatewayWafDynamicManifestPropertiesResult - } - } - } - - return nil -} - -// ApplicationGatewayWafDynamicManifestResultList response for ApplicationGatewayWafDynamicManifests API -// service call. -type ApplicationGatewayWafDynamicManifestResultList struct { - autorest.Response `json:"-"` - // Value - The list of application gateway waf manifest. - Value *[]ApplicationGatewayWafDynamicManifestResult `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ApplicationGatewayWafDynamicManifestResultListIterator provides access to a complete listing of -// ApplicationGatewayWafDynamicManifestResult values. -type ApplicationGatewayWafDynamicManifestResultListIterator struct { - i int - page ApplicationGatewayWafDynamicManifestResultListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ApplicationGatewayWafDynamicManifestResultListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayWafDynamicManifestResultListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ApplicationGatewayWafDynamicManifestResultListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ApplicationGatewayWafDynamicManifestResultListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ApplicationGatewayWafDynamicManifestResultListIterator) Response() ApplicationGatewayWafDynamicManifestResultList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ApplicationGatewayWafDynamicManifestResultListIterator) Value() ApplicationGatewayWafDynamicManifestResult { - if !iter.page.NotDone() { - return ApplicationGatewayWafDynamicManifestResult{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ApplicationGatewayWafDynamicManifestResultListIterator type. -func NewApplicationGatewayWafDynamicManifestResultListIterator(page ApplicationGatewayWafDynamicManifestResultListPage) ApplicationGatewayWafDynamicManifestResultListIterator { - return ApplicationGatewayWafDynamicManifestResultListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (agwdmrl ApplicationGatewayWafDynamicManifestResultList) IsEmpty() bool { - return agwdmrl.Value == nil || len(*agwdmrl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (agwdmrl ApplicationGatewayWafDynamicManifestResultList) hasNextLink() bool { - return agwdmrl.NextLink != nil && len(*agwdmrl.NextLink) != 0 -} - -// applicationGatewayWafDynamicManifestResultListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (agwdmrl ApplicationGatewayWafDynamicManifestResultList) applicationGatewayWafDynamicManifestResultListPreparer(ctx context.Context) (*http.Request, error) { - if !agwdmrl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(agwdmrl.NextLink))) -} - -// ApplicationGatewayWafDynamicManifestResultListPage contains a page of -// ApplicationGatewayWafDynamicManifestResult values. -type ApplicationGatewayWafDynamicManifestResultListPage struct { - fn func(context.Context, ApplicationGatewayWafDynamicManifestResultList) (ApplicationGatewayWafDynamicManifestResultList, error) - agwdmrl ApplicationGatewayWafDynamicManifestResultList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ApplicationGatewayWafDynamicManifestResultListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayWafDynamicManifestResultListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.agwdmrl) - if err != nil { - return err - } - page.agwdmrl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ApplicationGatewayWafDynamicManifestResultListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ApplicationGatewayWafDynamicManifestResultListPage) NotDone() bool { - return !page.agwdmrl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ApplicationGatewayWafDynamicManifestResultListPage) Response() ApplicationGatewayWafDynamicManifestResultList { - return page.agwdmrl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ApplicationGatewayWafDynamicManifestResultListPage) Values() []ApplicationGatewayWafDynamicManifestResult { - if page.agwdmrl.IsEmpty() { - return nil - } - return *page.agwdmrl.Value -} - -// Creates a new instance of the ApplicationGatewayWafDynamicManifestResultListPage type. -func NewApplicationGatewayWafDynamicManifestResultListPage(cur ApplicationGatewayWafDynamicManifestResultList, getNextPage func(context.Context, ApplicationGatewayWafDynamicManifestResultList) (ApplicationGatewayWafDynamicManifestResultList, error)) ApplicationGatewayWafDynamicManifestResultListPage { - return ApplicationGatewayWafDynamicManifestResultListPage{ - fn: getNextPage, - agwdmrl: cur, - } -} - -// ApplicationGatewayWebApplicationFirewallConfiguration application gateway web application firewall -// configuration. -type ApplicationGatewayWebApplicationFirewallConfiguration struct { - // Enabled - Whether the web application firewall is enabled or not. - Enabled *bool `json:"enabled,omitempty"` - // FirewallMode - Web application firewall mode. Possible values include: 'ApplicationGatewayFirewallModeDetection', 'ApplicationGatewayFirewallModePrevention' - FirewallMode ApplicationGatewayFirewallMode `json:"firewallMode,omitempty"` - // RuleSetType - The type of the web application firewall rule set. Possible values are: 'OWASP'. - RuleSetType *string `json:"ruleSetType,omitempty"` - // RuleSetVersion - The version of the rule set type. - RuleSetVersion *string `json:"ruleSetVersion,omitempty"` - // DisabledRuleGroups - The disabled rule groups. - DisabledRuleGroups *[]ApplicationGatewayFirewallDisabledRuleGroup `json:"disabledRuleGroups,omitempty"` - // RequestBodyCheck - Whether allow WAF to check request Body. - RequestBodyCheck *bool `json:"requestBodyCheck,omitempty"` - // MaxRequestBodySize - Maximum request body size for WAF. - MaxRequestBodySize *int32 `json:"maxRequestBodySize,omitempty"` - // MaxRequestBodySizeInKb - Maximum request body size in Kb for WAF. - MaxRequestBodySizeInKb *int32 `json:"maxRequestBodySizeInKb,omitempty"` - // FileUploadLimitInMb - Maximum file upload size in Mb for WAF. - FileUploadLimitInMb *int32 `json:"fileUploadLimitInMb,omitempty"` - // Exclusions - The exclusion list. - Exclusions *[]ApplicationGatewayFirewallExclusion `json:"exclusions,omitempty"` -} - -// ApplicationGatewaysBackendHealthFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ApplicationGatewaysBackendHealthFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationGatewaysClient) (ApplicationGatewayBackendHealth, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationGatewaysBackendHealthFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationGatewaysBackendHealthFuture.Result. -func (future *ApplicationGatewaysBackendHealthFuture) result(client ApplicationGatewaysClient) (agbh ApplicationGatewayBackendHealth, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - agbh.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysBackendHealthFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if agbh.Response.Response, err = future.GetResult(sender); err == nil && agbh.Response.Response.StatusCode != http.StatusNoContent { - agbh, err = client.BackendHealthResponder(agbh.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthFuture", "Result", agbh.Response.Response, "Failure responding to request") - } - } - return -} - -// ApplicationGatewaysBackendHealthOnDemandFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ApplicationGatewaysBackendHealthOnDemandFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationGatewaysClient) (ApplicationGatewayBackendHealthOnDemand, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationGatewaysBackendHealthOnDemandFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationGatewaysBackendHealthOnDemandFuture.Result. -func (future *ApplicationGatewaysBackendHealthOnDemandFuture) result(client ApplicationGatewaysClient) (agbhod ApplicationGatewayBackendHealthOnDemand, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthOnDemandFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - agbhod.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysBackendHealthOnDemandFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if agbhod.Response.Response, err = future.GetResult(sender); err == nil && agbhod.Response.Response.StatusCode != http.StatusNoContent { - agbhod, err = client.BackendHealthOnDemandResponder(agbhod.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthOnDemandFuture", "Result", agbhod.Response.Response, "Failure responding to request") - } - } - return -} - -// ApplicationGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ApplicationGatewaysCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationGatewaysClient) (ApplicationGateway, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationGatewaysCreateOrUpdateFuture.Result. -func (future *ApplicationGatewaysCreateOrUpdateFuture) result(client ApplicationGatewaysClient) (ag ApplicationGateway, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ag.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ag.Response.Response, err = future.GetResult(sender); err == nil && ag.Response.Response.StatusCode != http.StatusNoContent { - ag, err = client.CreateOrUpdateResponder(ag.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", ag.Response.Response, "Failure responding to request") - } - } - return -} - -// ApplicationGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ApplicationGatewaysDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationGatewaysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationGatewaysDeleteFuture.Result. -func (future *ApplicationGatewaysDeleteFuture) result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationGatewaysStartFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ApplicationGatewaysStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationGatewaysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationGatewaysStartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationGatewaysStartFuture.Result. -func (future *ApplicationGatewaysStartFuture) result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStartFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationGatewaysStopFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ApplicationGatewaysStopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationGatewaysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationGatewaysStopFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationGatewaysStopFuture.Result. -func (future *ApplicationGatewaysStopFuture) result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStopFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationRule rule of type application. -type ApplicationRule struct { - // SourceAddresses - List of source IP addresses for this rule. - SourceAddresses *[]string `json:"sourceAddresses,omitempty"` - // DestinationAddresses - List of destination IP addresses or Service Tags. - DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` - // Protocols - Array of Application Protocols. - Protocols *[]FirewallPolicyRuleApplicationProtocol `json:"protocols,omitempty"` - // TargetFqdns - List of FQDNs for this rule. - TargetFqdns *[]string `json:"targetFqdns,omitempty"` - // TargetUrls - List of Urls for this rule condition. - TargetUrls *[]string `json:"targetUrls,omitempty"` - // FqdnTags - List of FQDN Tags for this rule. - FqdnTags *[]string `json:"fqdnTags,omitempty"` - // SourceIPGroups - List of source IpGroups for this rule. - SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` - // TerminateTLS - Terminate TLS connections for this rule. - TerminateTLS *bool `json:"terminateTLS,omitempty"` - // WebCategories - List of destination azure web categories. - WebCategories *[]string `json:"webCategories,omitempty"` - // Name - Name of the rule. - Name *string `json:"name,omitempty"` - // Description - Description of the rule. - Description *string `json:"description,omitempty"` - // RuleType - Possible values include: 'RuleTypeFirewallPolicyRule', 'RuleTypeApplicationRule', 'RuleTypeNatRule', 'RuleTypeNetworkRule' - RuleType RuleType `json:"ruleType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationRule. -func (ar ApplicationRule) MarshalJSON() ([]byte, error) { - ar.RuleType = RuleTypeApplicationRule - objectMap := make(map[string]interface{}) - if ar.SourceAddresses != nil { - objectMap["sourceAddresses"] = ar.SourceAddresses - } - if ar.DestinationAddresses != nil { - objectMap["destinationAddresses"] = ar.DestinationAddresses - } - if ar.Protocols != nil { - objectMap["protocols"] = ar.Protocols - } - if ar.TargetFqdns != nil { - objectMap["targetFqdns"] = ar.TargetFqdns - } - if ar.TargetUrls != nil { - objectMap["targetUrls"] = ar.TargetUrls - } - if ar.FqdnTags != nil { - objectMap["fqdnTags"] = ar.FqdnTags - } - if ar.SourceIPGroups != nil { - objectMap["sourceIpGroups"] = ar.SourceIPGroups - } - if ar.TerminateTLS != nil { - objectMap["terminateTLS"] = ar.TerminateTLS - } - if ar.WebCategories != nil { - objectMap["webCategories"] = ar.WebCategories - } - if ar.Name != nil { - objectMap["name"] = ar.Name - } - if ar.Description != nil { - objectMap["description"] = ar.Description - } - if ar.RuleType != "" { - objectMap["ruleType"] = ar.RuleType - } - return json.Marshal(objectMap) -} - -// AsApplicationRule is the BasicFirewallPolicyRule implementation for ApplicationRule. -func (ar ApplicationRule) AsApplicationRule() (*ApplicationRule, bool) { - return &ar, true -} - -// AsNatRule is the BasicFirewallPolicyRule implementation for ApplicationRule. -func (ar ApplicationRule) AsNatRule() (*NatRule, bool) { - return nil, false -} - -// AsRule is the BasicFirewallPolicyRule implementation for ApplicationRule. -func (ar ApplicationRule) AsRule() (*Rule, bool) { - return nil, false -} - -// AsFirewallPolicyRule is the BasicFirewallPolicyRule implementation for ApplicationRule. -func (ar ApplicationRule) AsFirewallPolicyRule() (*FirewallPolicyRule, bool) { - return nil, false -} - -// AsBasicFirewallPolicyRule is the BasicFirewallPolicyRule implementation for ApplicationRule. -func (ar ApplicationRule) AsBasicFirewallPolicyRule() (BasicFirewallPolicyRule, bool) { - return &ar, true -} - -// ApplicationSecurityGroup an application security group in a resource group. -type ApplicationSecurityGroup struct { - autorest.Response `json:"-"` - // ApplicationSecurityGroupPropertiesFormat - Properties of the application security group. - *ApplicationSecurityGroupPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ApplicationSecurityGroup. -func (asg ApplicationSecurityGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asg.ApplicationSecurityGroupPropertiesFormat != nil { - objectMap["properties"] = asg.ApplicationSecurityGroupPropertiesFormat - } - if asg.ID != nil { - objectMap["id"] = asg.ID - } - if asg.Location != nil { - objectMap["location"] = asg.Location - } - if asg.Tags != nil { - objectMap["tags"] = asg.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationSecurityGroup struct. -func (asg *ApplicationSecurityGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applicationSecurityGroupPropertiesFormat ApplicationSecurityGroupPropertiesFormat - err = json.Unmarshal(*v, &applicationSecurityGroupPropertiesFormat) - if err != nil { - return err - } - asg.ApplicationSecurityGroupPropertiesFormat = &applicationSecurityGroupPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - asg.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - asg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - asg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - asg.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - asg.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - asg.Tags = tags - } - } - } - - return nil -} - -// ApplicationSecurityGroupListResult a list of application security groups. -type ApplicationSecurityGroupListResult struct { - autorest.Response `json:"-"` - // Value - A list of application security groups. - Value *[]ApplicationSecurityGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationSecurityGroupListResult. -func (asglr ApplicationSecurityGroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asglr.Value != nil { - objectMap["value"] = asglr.Value - } - return json.Marshal(objectMap) -} - -// ApplicationSecurityGroupListResultIterator provides access to a complete listing of -// ApplicationSecurityGroup values. -type ApplicationSecurityGroupListResultIterator struct { - i int - page ApplicationSecurityGroupListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ApplicationSecurityGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationSecurityGroupListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ApplicationSecurityGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ApplicationSecurityGroupListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ApplicationSecurityGroupListResultIterator) Response() ApplicationSecurityGroupListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ApplicationSecurityGroupListResultIterator) Value() ApplicationSecurityGroup { - if !iter.page.NotDone() { - return ApplicationSecurityGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ApplicationSecurityGroupListResultIterator type. -func NewApplicationSecurityGroupListResultIterator(page ApplicationSecurityGroupListResultPage) ApplicationSecurityGroupListResultIterator { - return ApplicationSecurityGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asglr ApplicationSecurityGroupListResult) IsEmpty() bool { - return asglr.Value == nil || len(*asglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asglr ApplicationSecurityGroupListResult) hasNextLink() bool { - return asglr.NextLink != nil && len(*asglr.NextLink) != 0 -} - -// applicationSecurityGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asglr ApplicationSecurityGroupListResult) applicationSecurityGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !asglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asglr.NextLink))) -} - -// ApplicationSecurityGroupListResultPage contains a page of ApplicationSecurityGroup values. -type ApplicationSecurityGroupListResultPage struct { - fn func(context.Context, ApplicationSecurityGroupListResult) (ApplicationSecurityGroupListResult, error) - asglr ApplicationSecurityGroupListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ApplicationSecurityGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationSecurityGroupListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.asglr) - if err != nil { - return err - } - page.asglr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ApplicationSecurityGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ApplicationSecurityGroupListResultPage) NotDone() bool { - return !page.asglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ApplicationSecurityGroupListResultPage) Response() ApplicationSecurityGroupListResult { - return page.asglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ApplicationSecurityGroupListResultPage) Values() []ApplicationSecurityGroup { - if page.asglr.IsEmpty() { - return nil - } - return *page.asglr.Value -} - -// Creates a new instance of the ApplicationSecurityGroupListResultPage type. -func NewApplicationSecurityGroupListResultPage(cur ApplicationSecurityGroupListResult, getNextPage func(context.Context, ApplicationSecurityGroupListResult) (ApplicationSecurityGroupListResult, error)) ApplicationSecurityGroupListResultPage { - return ApplicationSecurityGroupListResultPage{ - fn: getNextPage, - asglr: cur, - } -} - -// ApplicationSecurityGroupPropertiesFormat application security group properties. -type ApplicationSecurityGroupPropertiesFormat struct { - // ResourceGUID - READ-ONLY; 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. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the application security group resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationSecurityGroupPropertiesFormat. -func (asgpf ApplicationSecurityGroupPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ApplicationSecurityGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ApplicationSecurityGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationSecurityGroupsClient) (ApplicationSecurityGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationSecurityGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationSecurityGroupsCreateOrUpdateFuture.Result. -func (future *ApplicationSecurityGroupsCreateOrUpdateFuture) result(client ApplicationSecurityGroupsClient) (asg ApplicationSecurityGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - asg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ApplicationSecurityGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if asg.Response.Response, err = future.GetResult(sender); err == nil && asg.Response.Response.StatusCode != http.StatusNoContent { - asg, err = client.CreateOrUpdateResponder(asg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsCreateOrUpdateFuture", "Result", asg.Response.Response, "Failure responding to request") - } - } - return -} - -// ApplicationSecurityGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ApplicationSecurityGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ApplicationSecurityGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ApplicationSecurityGroupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ApplicationSecurityGroupsDeleteFuture.Result. -func (future *ApplicationSecurityGroupsDeleteFuture) result(client ApplicationSecurityGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ApplicationSecurityGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AuthorizationListResult response for ListAuthorizations API service call retrieves all authorizations -// that belongs to an ExpressRouteCircuit. -type AuthorizationListResult struct { - autorest.Response `json:"-"` - // Value - The authorizations in an ExpressRoute Circuit. - Value *[]ExpressRouteCircuitAuthorization `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AuthorizationListResultIterator provides access to a complete listing of -// ExpressRouteCircuitAuthorization values. -type AuthorizationListResultIterator struct { - i int - page AuthorizationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AuthorizationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AuthorizationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AuthorizationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AuthorizationListResultIterator) Response() AuthorizationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AuthorizationListResultIterator) Value() ExpressRouteCircuitAuthorization { - if !iter.page.NotDone() { - return ExpressRouteCircuitAuthorization{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AuthorizationListResultIterator type. -func NewAuthorizationListResultIterator(page AuthorizationListResultPage) AuthorizationListResultIterator { - return AuthorizationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (alr AuthorizationListResult) IsEmpty() bool { - return alr.Value == nil || len(*alr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (alr AuthorizationListResult) hasNextLink() bool { - return alr.NextLink != nil && len(*alr.NextLink) != 0 -} - -// authorizationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (alr AuthorizationListResult) authorizationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !alr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(alr.NextLink))) -} - -// AuthorizationListResultPage contains a page of ExpressRouteCircuitAuthorization values. -type AuthorizationListResultPage struct { - fn func(context.Context, AuthorizationListResult) (AuthorizationListResult, error) - alr AuthorizationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AuthorizationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.alr) - if err != nil { - return err - } - page.alr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AuthorizationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AuthorizationListResultPage) NotDone() bool { - return !page.alr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AuthorizationListResultPage) Response() AuthorizationListResult { - return page.alr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AuthorizationListResultPage) Values() []ExpressRouteCircuitAuthorization { - if page.alr.IsEmpty() { - return nil - } - return *page.alr.Value -} - -// Creates a new instance of the AuthorizationListResultPage type. -func NewAuthorizationListResultPage(cur AuthorizationListResult, getNextPage func(context.Context, AuthorizationListResult) (AuthorizationListResult, error)) AuthorizationListResultPage { - return AuthorizationListResultPage{ - fn: getNextPage, - alr: cur, - } -} - -// AuthorizationPropertiesFormat properties of ExpressRouteCircuitAuthorization. -type AuthorizationPropertiesFormat struct { - // AuthorizationKey - The authorization key. - AuthorizationKey *string `json:"authorizationKey,omitempty"` - // AuthorizationUseStatus - The authorization use status. Possible values include: 'AuthorizationUseStatusAvailable', 'AuthorizationUseStatusInUse' - AuthorizationUseStatus AuthorizationUseStatus `json:"authorizationUseStatus,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the authorization resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for AuthorizationPropertiesFormat. -func (apf AuthorizationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if apf.AuthorizationKey != nil { - objectMap["authorizationKey"] = apf.AuthorizationKey - } - if apf.AuthorizationUseStatus != "" { - objectMap["authorizationUseStatus"] = apf.AuthorizationUseStatus - } - return json.Marshal(objectMap) -} - -// AutoApprovedPrivateLinkService the information of an AutoApprovedPrivateLinkService. -type AutoApprovedPrivateLinkService struct { - // PrivateLinkService - The id of the private link service resource. - PrivateLinkService *string `json:"privateLinkService,omitempty"` -} - -// AutoApprovedPrivateLinkServicesResult an array of private link service id that can be linked to a -// private end point with auto approved. -type AutoApprovedPrivateLinkServicesResult struct { - autorest.Response `json:"-"` - // Value - An array of auto approved private link service. - Value *[]AutoApprovedPrivateLinkService `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for AutoApprovedPrivateLinkServicesResult. -func (aaplsr AutoApprovedPrivateLinkServicesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aaplsr.Value != nil { - objectMap["value"] = aaplsr.Value - } - return json.Marshal(objectMap) -} - -// AutoApprovedPrivateLinkServicesResultIterator provides access to a complete listing of -// AutoApprovedPrivateLinkService values. -type AutoApprovedPrivateLinkServicesResultIterator struct { - i int - page AutoApprovedPrivateLinkServicesResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AutoApprovedPrivateLinkServicesResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoApprovedPrivateLinkServicesResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AutoApprovedPrivateLinkServicesResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AutoApprovedPrivateLinkServicesResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AutoApprovedPrivateLinkServicesResultIterator) Response() AutoApprovedPrivateLinkServicesResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AutoApprovedPrivateLinkServicesResultIterator) Value() AutoApprovedPrivateLinkService { - if !iter.page.NotDone() { - return AutoApprovedPrivateLinkService{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AutoApprovedPrivateLinkServicesResultIterator type. -func NewAutoApprovedPrivateLinkServicesResultIterator(page AutoApprovedPrivateLinkServicesResultPage) AutoApprovedPrivateLinkServicesResultIterator { - return AutoApprovedPrivateLinkServicesResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aaplsr AutoApprovedPrivateLinkServicesResult) IsEmpty() bool { - return aaplsr.Value == nil || len(*aaplsr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aaplsr AutoApprovedPrivateLinkServicesResult) hasNextLink() bool { - return aaplsr.NextLink != nil && len(*aaplsr.NextLink) != 0 -} - -// autoApprovedPrivateLinkServicesResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aaplsr AutoApprovedPrivateLinkServicesResult) autoApprovedPrivateLinkServicesResultPreparer(ctx context.Context) (*http.Request, error) { - if !aaplsr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aaplsr.NextLink))) -} - -// AutoApprovedPrivateLinkServicesResultPage contains a page of AutoApprovedPrivateLinkService values. -type AutoApprovedPrivateLinkServicesResultPage struct { - fn func(context.Context, AutoApprovedPrivateLinkServicesResult) (AutoApprovedPrivateLinkServicesResult, error) - aaplsr AutoApprovedPrivateLinkServicesResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AutoApprovedPrivateLinkServicesResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AutoApprovedPrivateLinkServicesResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.aaplsr) - if err != nil { - return err - } - page.aaplsr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AutoApprovedPrivateLinkServicesResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AutoApprovedPrivateLinkServicesResultPage) NotDone() bool { - return !page.aaplsr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AutoApprovedPrivateLinkServicesResultPage) Response() AutoApprovedPrivateLinkServicesResult { - return page.aaplsr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AutoApprovedPrivateLinkServicesResultPage) Values() []AutoApprovedPrivateLinkService { - if page.aaplsr.IsEmpty() { - return nil - } - return *page.aaplsr.Value -} - -// Creates a new instance of the AutoApprovedPrivateLinkServicesResultPage type. -func NewAutoApprovedPrivateLinkServicesResultPage(cur AutoApprovedPrivateLinkServicesResult, getNextPage func(context.Context, AutoApprovedPrivateLinkServicesResult) (AutoApprovedPrivateLinkServicesResult, error)) AutoApprovedPrivateLinkServicesResultPage { - return AutoApprovedPrivateLinkServicesResultPage{ - fn: getNextPage, - aaplsr: cur, - } -} - -// Availability availability of the metric. -type Availability struct { - // TimeGrain - The time grain of the availability. - TimeGrain *string `json:"timeGrain,omitempty"` - // Retention - The retention of the availability. - Retention *string `json:"retention,omitempty"` - // BlobDuration - Duration of the availability blob. - BlobDuration *string `json:"blobDuration,omitempty"` -} - -// AvailableDelegation the serviceName of an AvailableDelegation indicates a possible delegation for a -// subnet. -type AvailableDelegation struct { - // Name - The name of the AvailableDelegation resource. - Name *string `json:"name,omitempty"` - // ID - A unique identifier of the AvailableDelegation resource. - ID *string `json:"id,omitempty"` - // Type - Resource type. - Type *string `json:"type,omitempty"` - // ServiceName - The name of the service and resource. - ServiceName *string `json:"serviceName,omitempty"` - // Actions - The actions permitted to the service upon delegation. - Actions *[]string `json:"actions,omitempty"` -} - -// AvailableDelegationsResult an array of available delegations. -type AvailableDelegationsResult struct { - autorest.Response `json:"-"` - // Value - An array of available delegations. - Value *[]AvailableDelegation `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for AvailableDelegationsResult. -func (adr AvailableDelegationsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if adr.Value != nil { - objectMap["value"] = adr.Value - } - return json.Marshal(objectMap) -} - -// AvailableDelegationsResultIterator provides access to a complete listing of AvailableDelegation values. -type AvailableDelegationsResultIterator struct { - i int - page AvailableDelegationsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AvailableDelegationsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailableDelegationsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AvailableDelegationsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AvailableDelegationsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AvailableDelegationsResultIterator) Response() AvailableDelegationsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AvailableDelegationsResultIterator) Value() AvailableDelegation { - if !iter.page.NotDone() { - return AvailableDelegation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AvailableDelegationsResultIterator type. -func NewAvailableDelegationsResultIterator(page AvailableDelegationsResultPage) AvailableDelegationsResultIterator { - return AvailableDelegationsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (adr AvailableDelegationsResult) IsEmpty() bool { - return adr.Value == nil || len(*adr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (adr AvailableDelegationsResult) hasNextLink() bool { - return adr.NextLink != nil && len(*adr.NextLink) != 0 -} - -// availableDelegationsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (adr AvailableDelegationsResult) availableDelegationsResultPreparer(ctx context.Context) (*http.Request, error) { - if !adr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(adr.NextLink))) -} - -// AvailableDelegationsResultPage contains a page of AvailableDelegation values. -type AvailableDelegationsResultPage struct { - fn func(context.Context, AvailableDelegationsResult) (AvailableDelegationsResult, error) - adr AvailableDelegationsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AvailableDelegationsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailableDelegationsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.adr) - if err != nil { - return err - } - page.adr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AvailableDelegationsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AvailableDelegationsResultPage) NotDone() bool { - return !page.adr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AvailableDelegationsResultPage) Response() AvailableDelegationsResult { - return page.adr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AvailableDelegationsResultPage) Values() []AvailableDelegation { - if page.adr.IsEmpty() { - return nil - } - return *page.adr.Value -} - -// Creates a new instance of the AvailableDelegationsResultPage type. -func NewAvailableDelegationsResultPage(cur AvailableDelegationsResult, getNextPage func(context.Context, AvailableDelegationsResult) (AvailableDelegationsResult, error)) AvailableDelegationsResultPage { - return AvailableDelegationsResultPage{ - fn: getNextPage, - adr: cur, - } -} - -// AvailablePrivateEndpointType the information of an AvailablePrivateEndpointType. -type AvailablePrivateEndpointType struct { - // Name - The name of the service and resource. - Name *string `json:"name,omitempty"` - // ID - A unique identifier of the AvailablePrivateEndpoint Type resource. - ID *string `json:"id,omitempty"` - // Type - Resource type. - Type *string `json:"type,omitempty"` - // ResourceName - The name of the service and resource. - ResourceName *string `json:"resourceName,omitempty"` - // DisplayName - Display name of the resource. - DisplayName *string `json:"displayName,omitempty"` -} - -// AvailablePrivateEndpointTypesResult an array of available PrivateEndpoint types. -type AvailablePrivateEndpointTypesResult struct { - autorest.Response `json:"-"` - // Value - An array of available privateEndpoint type. - Value *[]AvailablePrivateEndpointType `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for AvailablePrivateEndpointTypesResult. -func (apetr AvailablePrivateEndpointTypesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if apetr.Value != nil { - objectMap["value"] = apetr.Value - } - return json.Marshal(objectMap) -} - -// AvailablePrivateEndpointTypesResultIterator provides access to a complete listing of -// AvailablePrivateEndpointType values. -type AvailablePrivateEndpointTypesResultIterator struct { - i int - page AvailablePrivateEndpointTypesResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AvailablePrivateEndpointTypesResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailablePrivateEndpointTypesResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AvailablePrivateEndpointTypesResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AvailablePrivateEndpointTypesResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AvailablePrivateEndpointTypesResultIterator) Response() AvailablePrivateEndpointTypesResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AvailablePrivateEndpointTypesResultIterator) Value() AvailablePrivateEndpointType { - if !iter.page.NotDone() { - return AvailablePrivateEndpointType{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AvailablePrivateEndpointTypesResultIterator type. -func NewAvailablePrivateEndpointTypesResultIterator(page AvailablePrivateEndpointTypesResultPage) AvailablePrivateEndpointTypesResultIterator { - return AvailablePrivateEndpointTypesResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (apetr AvailablePrivateEndpointTypesResult) IsEmpty() bool { - return apetr.Value == nil || len(*apetr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (apetr AvailablePrivateEndpointTypesResult) hasNextLink() bool { - return apetr.NextLink != nil && len(*apetr.NextLink) != 0 -} - -// availablePrivateEndpointTypesResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (apetr AvailablePrivateEndpointTypesResult) availablePrivateEndpointTypesResultPreparer(ctx context.Context) (*http.Request, error) { - if !apetr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(apetr.NextLink))) -} - -// AvailablePrivateEndpointTypesResultPage contains a page of AvailablePrivateEndpointType values. -type AvailablePrivateEndpointTypesResultPage struct { - fn func(context.Context, AvailablePrivateEndpointTypesResult) (AvailablePrivateEndpointTypesResult, error) - apetr AvailablePrivateEndpointTypesResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AvailablePrivateEndpointTypesResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailablePrivateEndpointTypesResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.apetr) - if err != nil { - return err - } - page.apetr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AvailablePrivateEndpointTypesResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AvailablePrivateEndpointTypesResultPage) NotDone() bool { - return !page.apetr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AvailablePrivateEndpointTypesResultPage) Response() AvailablePrivateEndpointTypesResult { - return page.apetr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AvailablePrivateEndpointTypesResultPage) Values() []AvailablePrivateEndpointType { - if page.apetr.IsEmpty() { - return nil - } - return *page.apetr.Value -} - -// Creates a new instance of the AvailablePrivateEndpointTypesResultPage type. -func NewAvailablePrivateEndpointTypesResultPage(cur AvailablePrivateEndpointTypesResult, getNextPage func(context.Context, AvailablePrivateEndpointTypesResult) (AvailablePrivateEndpointTypesResult, error)) AvailablePrivateEndpointTypesResultPage { - return AvailablePrivateEndpointTypesResultPage{ - fn: getNextPage, - apetr: cur, - } -} - -// AvailableProvidersList list of available countries with details. -type AvailableProvidersList struct { - autorest.Response `json:"-"` - // Countries - List of available countries. - Countries *[]AvailableProvidersListCountry `json:"countries,omitempty"` -} - -// AvailableProvidersListCity city or town details. -type AvailableProvidersListCity struct { - // CityName - The city or town name. - CityName *string `json:"cityName,omitempty"` - // Providers - A list of Internet service providers. - Providers *[]string `json:"providers,omitempty"` -} - -// AvailableProvidersListCountry country details. -type AvailableProvidersListCountry struct { - // CountryName - The country name. - CountryName *string `json:"countryName,omitempty"` - // Providers - A list of Internet service providers. - Providers *[]string `json:"providers,omitempty"` - // States - List of available states in the country. - States *[]AvailableProvidersListState `json:"states,omitempty"` -} - -// AvailableProvidersListParameters constraints that determine the list of available Internet service -// providers. -type AvailableProvidersListParameters struct { - // AzureLocations - A list of Azure regions. - AzureLocations *[]string `json:"azureLocations,omitempty"` - // Country - The country for available providers list. - Country *string `json:"country,omitempty"` - // State - The state for available providers list. - State *string `json:"state,omitempty"` - // City - The city or town for available providers list. - City *string `json:"city,omitempty"` -} - -// AvailableProvidersListState state details. -type AvailableProvidersListState struct { - // StateName - The state name. - StateName *string `json:"stateName,omitempty"` - // Providers - A list of Internet service providers. - Providers *[]string `json:"providers,omitempty"` - // Cities - List of available cities or towns in the state. - Cities *[]AvailableProvidersListCity `json:"cities,omitempty"` -} - -// AvailableServiceAlias the available service alias. -type AvailableServiceAlias struct { - // Name - The name of the service alias. - Name *string `json:"name,omitempty"` - // ID - The ID of the service alias. - ID *string `json:"id,omitempty"` - // Type - The type of the resource. - Type *string `json:"type,omitempty"` - // ResourceName - The resource name of the service alias. - ResourceName *string `json:"resourceName,omitempty"` -} - -// AvailableServiceAliasesResult an array of available service aliases. -type AvailableServiceAliasesResult struct { - autorest.Response `json:"-"` - // Value - An array of available service aliases. - Value *[]AvailableServiceAlias `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for AvailableServiceAliasesResult. -func (asar AvailableServiceAliasesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asar.Value != nil { - objectMap["value"] = asar.Value - } - return json.Marshal(objectMap) -} - -// AvailableServiceAliasesResultIterator provides access to a complete listing of AvailableServiceAlias -// values. -type AvailableServiceAliasesResultIterator struct { - i int - page AvailableServiceAliasesResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AvailableServiceAliasesResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailableServiceAliasesResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AvailableServiceAliasesResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AvailableServiceAliasesResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AvailableServiceAliasesResultIterator) Response() AvailableServiceAliasesResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AvailableServiceAliasesResultIterator) Value() AvailableServiceAlias { - if !iter.page.NotDone() { - return AvailableServiceAlias{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AvailableServiceAliasesResultIterator type. -func NewAvailableServiceAliasesResultIterator(page AvailableServiceAliasesResultPage) AvailableServiceAliasesResultIterator { - return AvailableServiceAliasesResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (asar AvailableServiceAliasesResult) IsEmpty() bool { - return asar.Value == nil || len(*asar.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (asar AvailableServiceAliasesResult) hasNextLink() bool { - return asar.NextLink != nil && len(*asar.NextLink) != 0 -} - -// availableServiceAliasesResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (asar AvailableServiceAliasesResult) availableServiceAliasesResultPreparer(ctx context.Context) (*http.Request, error) { - if !asar.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(asar.NextLink))) -} - -// AvailableServiceAliasesResultPage contains a page of AvailableServiceAlias values. -type AvailableServiceAliasesResultPage struct { - fn func(context.Context, AvailableServiceAliasesResult) (AvailableServiceAliasesResult, error) - asar AvailableServiceAliasesResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AvailableServiceAliasesResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailableServiceAliasesResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.asar) - if err != nil { - return err - } - page.asar = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AvailableServiceAliasesResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AvailableServiceAliasesResultPage) NotDone() bool { - return !page.asar.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AvailableServiceAliasesResultPage) Response() AvailableServiceAliasesResult { - return page.asar -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AvailableServiceAliasesResultPage) Values() []AvailableServiceAlias { - if page.asar.IsEmpty() { - return nil - } - return *page.asar.Value -} - -// Creates a new instance of the AvailableServiceAliasesResultPage type. -func NewAvailableServiceAliasesResultPage(cur AvailableServiceAliasesResult, getNextPage func(context.Context, AvailableServiceAliasesResult) (AvailableServiceAliasesResult, error)) AvailableServiceAliasesResultPage { - return AvailableServiceAliasesResultPage{ - fn: getNextPage, - asar: cur, - } -} - -// AzureAsyncOperationResult 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. -type AzureAsyncOperationResult struct { - // Status - Status of the Azure async operation. Possible values include: 'OperationStatusInProgress', 'OperationStatusSucceeded', 'OperationStatusFailed' - Status OperationStatus `json:"status,omitempty"` - // Error - Details of the error occurred during specified asynchronous operation. - Error *Error `json:"error,omitempty"` -} - -// AzureFirewall azure Firewall resource. -type AzureFirewall struct { - autorest.Response `json:"-"` - // AzureFirewallPropertiesFormat - Properties of the azure firewall. - *AzureFirewallPropertiesFormat `json:"properties,omitempty"` - // Zones - A list of availability zones denoting where the resource needs to come from. - Zones *[]string `json:"zones,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AzureFirewall. -func (af AzureFirewall) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if af.AzureFirewallPropertiesFormat != nil { - objectMap["properties"] = af.AzureFirewallPropertiesFormat - } - if af.Zones != nil { - objectMap["zones"] = af.Zones - } - if af.ID != nil { - objectMap["id"] = af.ID - } - if af.Location != nil { - objectMap["location"] = af.Location - } - if af.Tags != nil { - objectMap["tags"] = af.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AzureFirewall struct. -func (af *AzureFirewall) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var azureFirewallPropertiesFormat AzureFirewallPropertiesFormat - err = json.Unmarshal(*v, &azureFirewallPropertiesFormat) - if err != nil { - return err - } - af.AzureFirewallPropertiesFormat = &azureFirewallPropertiesFormat - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - af.Zones = &zones - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - af.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - af.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - af.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - af.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - af.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - af.Tags = tags - } - } - } - - return nil -} - -// AzureFirewallApplicationRule properties of an application rule. -type AzureFirewallApplicationRule struct { - // Name - Name of the application rule. - Name *string `json:"name,omitempty"` - // Description - Description of the rule. - Description *string `json:"description,omitempty"` - // SourceAddresses - List of source IP addresses for this rule. - SourceAddresses *[]string `json:"sourceAddresses,omitempty"` - // Protocols - Array of ApplicationRuleProtocols. - Protocols *[]AzureFirewallApplicationRuleProtocol `json:"protocols,omitempty"` - // TargetFqdns - List of FQDNs for this rule. - TargetFqdns *[]string `json:"targetFqdns,omitempty"` - // FqdnTags - List of FQDN Tags for this rule. - FqdnTags *[]string `json:"fqdnTags,omitempty"` - // SourceIPGroups - List of source IpGroups for this rule. - SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` -} - -// AzureFirewallApplicationRuleCollection application rule collection resource. -type AzureFirewallApplicationRuleCollection struct { - // AzureFirewallApplicationRuleCollectionPropertiesFormat - Properties of the azure firewall application rule collection. - *AzureFirewallApplicationRuleCollectionPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureFirewallApplicationRuleCollection. -func (afarc AzureFirewallApplicationRuleCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if afarc.AzureFirewallApplicationRuleCollectionPropertiesFormat != nil { - objectMap["properties"] = afarc.AzureFirewallApplicationRuleCollectionPropertiesFormat - } - if afarc.Name != nil { - objectMap["name"] = afarc.Name - } - if afarc.ID != nil { - objectMap["id"] = afarc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AzureFirewallApplicationRuleCollection struct. -func (afarc *AzureFirewallApplicationRuleCollection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var azureFirewallApplicationRuleCollectionPropertiesFormat AzureFirewallApplicationRuleCollectionPropertiesFormat - err = json.Unmarshal(*v, &azureFirewallApplicationRuleCollectionPropertiesFormat) - if err != nil { - return err - } - afarc.AzureFirewallApplicationRuleCollectionPropertiesFormat = &azureFirewallApplicationRuleCollectionPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - afarc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - afarc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - afarc.ID = &ID - } - } - } - - return nil -} - -// AzureFirewallApplicationRuleCollectionPropertiesFormat properties of the application rule collection. -type AzureFirewallApplicationRuleCollectionPropertiesFormat struct { - // Priority - Priority of the application rule collection resource. - Priority *int32 `json:"priority,omitempty"` - // Action - The action type of a rule collection. - Action *AzureFirewallRCAction `json:"action,omitempty"` - // Rules - Collection of rules used by a application rule collection. - Rules *[]AzureFirewallApplicationRule `json:"rules,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the application rule collection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureFirewallApplicationRuleCollectionPropertiesFormat. -func (afarcpf AzureFirewallApplicationRuleCollectionPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if afarcpf.Priority != nil { - objectMap["priority"] = afarcpf.Priority - } - if afarcpf.Action != nil { - objectMap["action"] = afarcpf.Action - } - if afarcpf.Rules != nil { - objectMap["rules"] = afarcpf.Rules - } - return json.Marshal(objectMap) -} - -// AzureFirewallApplicationRuleProtocol properties of the application rule protocol. -type AzureFirewallApplicationRuleProtocol struct { - // ProtocolType - Protocol type. Possible values include: 'AzureFirewallApplicationRuleProtocolTypeHTTP', 'AzureFirewallApplicationRuleProtocolTypeHTTPS', 'AzureFirewallApplicationRuleProtocolTypeMssql' - ProtocolType AzureFirewallApplicationRuleProtocolType `json:"protocolType,omitempty"` - // Port - Port number for the protocol, cannot be greater than 64000. This field is optional. - Port *int32 `json:"port,omitempty"` -} - -// AzureFirewallFqdnTag azure Firewall FQDN Tag Resource. -type AzureFirewallFqdnTag struct { - // AzureFirewallFqdnTagPropertiesFormat - Properties of the azure firewall FQDN tag. - *AzureFirewallFqdnTagPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AzureFirewallFqdnTag. -func (afft AzureFirewallFqdnTag) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if afft.AzureFirewallFqdnTagPropertiesFormat != nil { - objectMap["properties"] = afft.AzureFirewallFqdnTagPropertiesFormat - } - if afft.ID != nil { - objectMap["id"] = afft.ID - } - if afft.Location != nil { - objectMap["location"] = afft.Location - } - if afft.Tags != nil { - objectMap["tags"] = afft.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AzureFirewallFqdnTag struct. -func (afft *AzureFirewallFqdnTag) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var azureFirewallFqdnTagPropertiesFormat AzureFirewallFqdnTagPropertiesFormat - err = json.Unmarshal(*v, &azureFirewallFqdnTagPropertiesFormat) - if err != nil { - return err - } - afft.AzureFirewallFqdnTagPropertiesFormat = &azureFirewallFqdnTagPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - afft.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - afft.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - afft.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - afft.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - afft.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - afft.Tags = tags - } - } - } - - return nil -} - -// AzureFirewallFqdnTagListResult response for ListAzureFirewallFqdnTags API service call. -type AzureFirewallFqdnTagListResult struct { - autorest.Response `json:"-"` - // Value - List of Azure Firewall FQDN Tags in a resource group. - Value *[]AzureFirewallFqdnTag `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AzureFirewallFqdnTagListResultIterator provides access to a complete listing of AzureFirewallFqdnTag -// values. -type AzureFirewallFqdnTagListResultIterator struct { - i int - page AzureFirewallFqdnTagListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AzureFirewallFqdnTagListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallFqdnTagListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AzureFirewallFqdnTagListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AzureFirewallFqdnTagListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AzureFirewallFqdnTagListResultIterator) Response() AzureFirewallFqdnTagListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AzureFirewallFqdnTagListResultIterator) Value() AzureFirewallFqdnTag { - if !iter.page.NotDone() { - return AzureFirewallFqdnTag{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AzureFirewallFqdnTagListResultIterator type. -func NewAzureFirewallFqdnTagListResultIterator(page AzureFirewallFqdnTagListResultPage) AzureFirewallFqdnTagListResultIterator { - return AzureFirewallFqdnTagListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (afftlr AzureFirewallFqdnTagListResult) IsEmpty() bool { - return afftlr.Value == nil || len(*afftlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (afftlr AzureFirewallFqdnTagListResult) hasNextLink() bool { - return afftlr.NextLink != nil && len(*afftlr.NextLink) != 0 -} - -// azureFirewallFqdnTagListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (afftlr AzureFirewallFqdnTagListResult) azureFirewallFqdnTagListResultPreparer(ctx context.Context) (*http.Request, error) { - if !afftlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(afftlr.NextLink))) -} - -// AzureFirewallFqdnTagListResultPage contains a page of AzureFirewallFqdnTag values. -type AzureFirewallFqdnTagListResultPage struct { - fn func(context.Context, AzureFirewallFqdnTagListResult) (AzureFirewallFqdnTagListResult, error) - afftlr AzureFirewallFqdnTagListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AzureFirewallFqdnTagListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallFqdnTagListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.afftlr) - if err != nil { - return err - } - page.afftlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AzureFirewallFqdnTagListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AzureFirewallFqdnTagListResultPage) NotDone() bool { - return !page.afftlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AzureFirewallFqdnTagListResultPage) Response() AzureFirewallFqdnTagListResult { - return page.afftlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AzureFirewallFqdnTagListResultPage) Values() []AzureFirewallFqdnTag { - if page.afftlr.IsEmpty() { - return nil - } - return *page.afftlr.Value -} - -// Creates a new instance of the AzureFirewallFqdnTagListResultPage type. -func NewAzureFirewallFqdnTagListResultPage(cur AzureFirewallFqdnTagListResult, getNextPage func(context.Context, AzureFirewallFqdnTagListResult) (AzureFirewallFqdnTagListResult, error)) AzureFirewallFqdnTagListResultPage { - return AzureFirewallFqdnTagListResultPage{ - fn: getNextPage, - afftlr: cur, - } -} - -// AzureFirewallFqdnTagPropertiesFormat azure Firewall FQDN Tag Properties. -type AzureFirewallFqdnTagPropertiesFormat struct { - // ProvisioningState - READ-ONLY; The provisioning state of the Azure firewall FQDN tag resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // FqdnTagName - READ-ONLY; The name of this FQDN Tag. - FqdnTagName *string `json:"fqdnTagName,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureFirewallFqdnTagPropertiesFormat. -func (afftpf AzureFirewallFqdnTagPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AzureFirewallIPConfiguration IP configuration of an Azure Firewall. -type AzureFirewallIPConfiguration struct { - // AzureFirewallIPConfigurationPropertiesFormat - Properties of the azure firewall IP configuration. - *AzureFirewallIPConfigurationPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureFirewallIPConfiguration. -func (afic AzureFirewallIPConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if afic.AzureFirewallIPConfigurationPropertiesFormat != nil { - objectMap["properties"] = afic.AzureFirewallIPConfigurationPropertiesFormat - } - if afic.Name != nil { - objectMap["name"] = afic.Name - } - if afic.ID != nil { - objectMap["id"] = afic.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AzureFirewallIPConfiguration struct. -func (afic *AzureFirewallIPConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var azureFirewallIPConfigurationPropertiesFormat AzureFirewallIPConfigurationPropertiesFormat - err = json.Unmarshal(*v, &azureFirewallIPConfigurationPropertiesFormat) - if err != nil { - return err - } - afic.AzureFirewallIPConfigurationPropertiesFormat = &azureFirewallIPConfigurationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - afic.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - afic.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - afic.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - afic.ID = &ID - } - } - } - - return nil -} - -// AzureFirewallIPConfigurationPropertiesFormat properties of IP configuration of an Azure Firewall. -type AzureFirewallIPConfigurationPropertiesFormat struct { - // PrivateIPAddress - READ-ONLY; The Firewall Internal Load Balancer IP to be used as the next hop in User Defined Routes. - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - // Subnet - Reference to the subnet resource. This resource must be named 'AzureFirewallSubnet' or 'AzureFirewallManagementSubnet'. - Subnet *SubResource `json:"subnet,omitempty"` - // PublicIPAddress - Reference to the PublicIP resource. This field is a mandatory input if subnet is not null. - PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the Azure firewall IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureFirewallIPConfigurationPropertiesFormat. -func (aficpf AzureFirewallIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aficpf.Subnet != nil { - objectMap["subnet"] = aficpf.Subnet - } - if aficpf.PublicIPAddress != nil { - objectMap["publicIPAddress"] = aficpf.PublicIPAddress - } - return json.Marshal(objectMap) -} - -// AzureFirewallIPGroups ipGroups associated with azure firewall. -type AzureFirewallIPGroups struct { - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // ChangeNumber - READ-ONLY; The iteration number. - ChangeNumber *string `json:"changeNumber,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureFirewallIPGroups. -func (afig AzureFirewallIPGroups) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AzureFirewallListResult response for ListAzureFirewalls API service call. -type AzureFirewallListResult struct { - autorest.Response `json:"-"` - // Value - List of Azure Firewalls in a resource group. - Value *[]AzureFirewall `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AzureFirewallListResultIterator provides access to a complete listing of AzureFirewall values. -type AzureFirewallListResultIterator struct { - i int - page AzureFirewallListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AzureFirewallListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AzureFirewallListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AzureFirewallListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AzureFirewallListResultIterator) Response() AzureFirewallListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AzureFirewallListResultIterator) Value() AzureFirewall { - if !iter.page.NotDone() { - return AzureFirewall{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AzureFirewallListResultIterator type. -func NewAzureFirewallListResultIterator(page AzureFirewallListResultPage) AzureFirewallListResultIterator { - return AzureFirewallListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aflr AzureFirewallListResult) IsEmpty() bool { - return aflr.Value == nil || len(*aflr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aflr AzureFirewallListResult) hasNextLink() bool { - return aflr.NextLink != nil && len(*aflr.NextLink) != 0 -} - -// azureFirewallListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aflr AzureFirewallListResult) azureFirewallListResultPreparer(ctx context.Context) (*http.Request, error) { - if !aflr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aflr.NextLink))) -} - -// AzureFirewallListResultPage contains a page of AzureFirewall values. -type AzureFirewallListResultPage struct { - fn func(context.Context, AzureFirewallListResult) (AzureFirewallListResult, error) - aflr AzureFirewallListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AzureFirewallListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.aflr) - if err != nil { - return err - } - page.aflr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AzureFirewallListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AzureFirewallListResultPage) NotDone() bool { - return !page.aflr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AzureFirewallListResultPage) Response() AzureFirewallListResult { - return page.aflr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AzureFirewallListResultPage) Values() []AzureFirewall { - if page.aflr.IsEmpty() { - return nil - } - return *page.aflr.Value -} - -// Creates a new instance of the AzureFirewallListResultPage type. -func NewAzureFirewallListResultPage(cur AzureFirewallListResult, getNextPage func(context.Context, AzureFirewallListResult) (AzureFirewallListResult, error)) AzureFirewallListResultPage { - return AzureFirewallListResultPage{ - fn: getNextPage, - aflr: cur, - } -} - -// AzureFirewallNatRCAction azureFirewall NAT Rule Collection Action. -type AzureFirewallNatRCAction struct { - // Type - The type of action. Possible values include: 'AzureFirewallNatRCActionTypeSnat', 'AzureFirewallNatRCActionTypeDnat' - Type AzureFirewallNatRCActionType `json:"type,omitempty"` -} - -// AzureFirewallNatRule properties of a NAT rule. -type AzureFirewallNatRule struct { - // Name - Name of the NAT rule. - Name *string `json:"name,omitempty"` - // Description - Description of the rule. - Description *string `json:"description,omitempty"` - // SourceAddresses - List of source IP addresses for this rule. - SourceAddresses *[]string `json:"sourceAddresses,omitempty"` - // DestinationAddresses - List of destination IP addresses for this rule. Supports IP ranges, prefixes, and service tags. - DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` - // DestinationPorts - List of destination ports. - DestinationPorts *[]string `json:"destinationPorts,omitempty"` - // Protocols - Array of AzureFirewallNetworkRuleProtocols applicable to this NAT rule. - Protocols *[]AzureFirewallNetworkRuleProtocol `json:"protocols,omitempty"` - // TranslatedAddress - The translated address for this NAT rule. - TranslatedAddress *string `json:"translatedAddress,omitempty"` - // TranslatedPort - The translated port for this NAT rule. - TranslatedPort *string `json:"translatedPort,omitempty"` - // TranslatedFqdn - The translated FQDN for this NAT rule. - TranslatedFqdn *string `json:"translatedFqdn,omitempty"` - // SourceIPGroups - List of source IpGroups for this rule. - SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` -} - -// AzureFirewallNatRuleCollection NAT rule collection resource. -type AzureFirewallNatRuleCollection struct { - // AzureFirewallNatRuleCollectionProperties - Properties of the azure firewall NAT rule collection. - *AzureFirewallNatRuleCollectionProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureFirewallNatRuleCollection. -func (afnrc AzureFirewallNatRuleCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if afnrc.AzureFirewallNatRuleCollectionProperties != nil { - objectMap["properties"] = afnrc.AzureFirewallNatRuleCollectionProperties - } - if afnrc.Name != nil { - objectMap["name"] = afnrc.Name - } - if afnrc.ID != nil { - objectMap["id"] = afnrc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AzureFirewallNatRuleCollection struct. -func (afnrc *AzureFirewallNatRuleCollection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var azureFirewallNatRuleCollectionProperties AzureFirewallNatRuleCollectionProperties - err = json.Unmarshal(*v, &azureFirewallNatRuleCollectionProperties) - if err != nil { - return err - } - afnrc.AzureFirewallNatRuleCollectionProperties = &azureFirewallNatRuleCollectionProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - afnrc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - afnrc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - afnrc.ID = &ID - } - } - } - - return nil -} - -// AzureFirewallNatRuleCollectionProperties properties of the NAT rule collection. -type AzureFirewallNatRuleCollectionProperties struct { - // Priority - Priority of the NAT rule collection resource. - Priority *int32 `json:"priority,omitempty"` - // Action - The action type of a NAT rule collection. - Action *AzureFirewallNatRCAction `json:"action,omitempty"` - // Rules - Collection of rules used by a NAT rule collection. - Rules *[]AzureFirewallNatRule `json:"rules,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the NAT rule collection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureFirewallNatRuleCollectionProperties. -func (afnrcp AzureFirewallNatRuleCollectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if afnrcp.Priority != nil { - objectMap["priority"] = afnrcp.Priority - } - if afnrcp.Action != nil { - objectMap["action"] = afnrcp.Action - } - if afnrcp.Rules != nil { - objectMap["rules"] = afnrcp.Rules - } - return json.Marshal(objectMap) -} - -// AzureFirewallNetworkRule properties of the network rule. -type AzureFirewallNetworkRule struct { - // Name - Name of the network rule. - Name *string `json:"name,omitempty"` - // Description - Description of the rule. - Description *string `json:"description,omitempty"` - // Protocols - Array of AzureFirewallNetworkRuleProtocols. - Protocols *[]AzureFirewallNetworkRuleProtocol `json:"protocols,omitempty"` - // SourceAddresses - List of source IP addresses for this rule. - SourceAddresses *[]string `json:"sourceAddresses,omitempty"` - // DestinationAddresses - List of destination IP addresses. - DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` - // DestinationPorts - List of destination ports. - DestinationPorts *[]string `json:"destinationPorts,omitempty"` - // DestinationFqdns - List of destination FQDNs. - DestinationFqdns *[]string `json:"destinationFqdns,omitempty"` - // SourceIPGroups - List of source IpGroups for this rule. - SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` - // DestinationIPGroups - List of destination IpGroups for this rule. - DestinationIPGroups *[]string `json:"destinationIpGroups,omitempty"` -} - -// AzureFirewallNetworkRuleCollection network rule collection resource. -type AzureFirewallNetworkRuleCollection struct { - // AzureFirewallNetworkRuleCollectionPropertiesFormat - Properties of the azure firewall network rule collection. - *AzureFirewallNetworkRuleCollectionPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureFirewallNetworkRuleCollection. -func (afnrc AzureFirewallNetworkRuleCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if afnrc.AzureFirewallNetworkRuleCollectionPropertiesFormat != nil { - objectMap["properties"] = afnrc.AzureFirewallNetworkRuleCollectionPropertiesFormat - } - if afnrc.Name != nil { - objectMap["name"] = afnrc.Name - } - if afnrc.ID != nil { - objectMap["id"] = afnrc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AzureFirewallNetworkRuleCollection struct. -func (afnrc *AzureFirewallNetworkRuleCollection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var azureFirewallNetworkRuleCollectionPropertiesFormat AzureFirewallNetworkRuleCollectionPropertiesFormat - err = json.Unmarshal(*v, &azureFirewallNetworkRuleCollectionPropertiesFormat) - if err != nil { - return err - } - afnrc.AzureFirewallNetworkRuleCollectionPropertiesFormat = &azureFirewallNetworkRuleCollectionPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - afnrc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - afnrc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - afnrc.ID = &ID - } - } - } - - return nil -} - -// AzureFirewallNetworkRuleCollectionPropertiesFormat properties of the network rule collection. -type AzureFirewallNetworkRuleCollectionPropertiesFormat struct { - // Priority - Priority of the network rule collection resource. - Priority *int32 `json:"priority,omitempty"` - // Action - The action type of a rule collection. - Action *AzureFirewallRCAction `json:"action,omitempty"` - // Rules - Collection of rules used by a network rule collection. - Rules *[]AzureFirewallNetworkRule `json:"rules,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the network rule collection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureFirewallNetworkRuleCollectionPropertiesFormat. -func (afnrcpf AzureFirewallNetworkRuleCollectionPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if afnrcpf.Priority != nil { - objectMap["priority"] = afnrcpf.Priority - } - if afnrcpf.Action != nil { - objectMap["action"] = afnrcpf.Action - } - if afnrcpf.Rules != nil { - objectMap["rules"] = afnrcpf.Rules - } - return json.Marshal(objectMap) -} - -// AzureFirewallPropertiesFormat properties of the Azure Firewall. -type AzureFirewallPropertiesFormat struct { - // ApplicationRuleCollections - Collection of application rule collections used by Azure Firewall. - ApplicationRuleCollections *[]AzureFirewallApplicationRuleCollection `json:"applicationRuleCollections,omitempty"` - // NatRuleCollections - Collection of NAT rule collections used by Azure Firewall. - NatRuleCollections *[]AzureFirewallNatRuleCollection `json:"natRuleCollections,omitempty"` - // NetworkRuleCollections - Collection of network rule collections used by Azure Firewall. - NetworkRuleCollections *[]AzureFirewallNetworkRuleCollection `json:"networkRuleCollections,omitempty"` - // IPConfigurations - IP configuration of the Azure Firewall resource. - IPConfigurations *[]AzureFirewallIPConfiguration `json:"ipConfigurations,omitempty"` - // ManagementIPConfiguration - IP configuration of the Azure Firewall used for management traffic. - ManagementIPConfiguration *AzureFirewallIPConfiguration `json:"managementIpConfiguration,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the Azure firewall resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ThreatIntelMode - The operation mode for Threat Intelligence. Possible values include: 'AzureFirewallThreatIntelModeAlert', 'AzureFirewallThreatIntelModeDeny', 'AzureFirewallThreatIntelModeOff' - ThreatIntelMode AzureFirewallThreatIntelMode `json:"threatIntelMode,omitempty"` - // VirtualHub - The virtualHub to which the firewall belongs. - VirtualHub *SubResource `json:"virtualHub,omitempty"` - // FirewallPolicy - The firewallPolicy associated with this azure firewall. - FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` - // HubIPAddresses - IP addresses associated with AzureFirewall. - HubIPAddresses *HubIPAddresses `json:"hubIPAddresses,omitempty"` - // IPGroups - READ-ONLY; IpGroups associated with AzureFirewall. - IPGroups *[]AzureFirewallIPGroups `json:"ipGroups,omitempty"` - // Sku - The Azure Firewall Resource SKU. - Sku *AzureFirewallSku `json:"sku,omitempty"` - // AdditionalProperties - The additional properties used to further config this azure firewall. - AdditionalProperties map[string]*string `json:"additionalProperties"` -} - -// MarshalJSON is the custom marshaler for AzureFirewallPropertiesFormat. -func (afpf AzureFirewallPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if afpf.ApplicationRuleCollections != nil { - objectMap["applicationRuleCollections"] = afpf.ApplicationRuleCollections - } - if afpf.NatRuleCollections != nil { - objectMap["natRuleCollections"] = afpf.NatRuleCollections - } - if afpf.NetworkRuleCollections != nil { - objectMap["networkRuleCollections"] = afpf.NetworkRuleCollections - } - if afpf.IPConfigurations != nil { - objectMap["ipConfigurations"] = afpf.IPConfigurations - } - if afpf.ManagementIPConfiguration != nil { - objectMap["managementIpConfiguration"] = afpf.ManagementIPConfiguration - } - if afpf.ThreatIntelMode != "" { - objectMap["threatIntelMode"] = afpf.ThreatIntelMode - } - if afpf.VirtualHub != nil { - objectMap["virtualHub"] = afpf.VirtualHub - } - if afpf.FirewallPolicy != nil { - objectMap["firewallPolicy"] = afpf.FirewallPolicy - } - if afpf.HubIPAddresses != nil { - objectMap["hubIPAddresses"] = afpf.HubIPAddresses - } - if afpf.Sku != nil { - objectMap["sku"] = afpf.Sku - } - if afpf.AdditionalProperties != nil { - objectMap["additionalProperties"] = afpf.AdditionalProperties - } - return json.Marshal(objectMap) -} - -// AzureFirewallPublicIPAddress public IP Address associated with azure firewall. -type AzureFirewallPublicIPAddress struct { - // Address - Public IP Address value. - Address *string `json:"address,omitempty"` -} - -// AzureFirewallRCAction properties of the AzureFirewallRCAction. -type AzureFirewallRCAction struct { - // Type - The type of action. Possible values include: 'AzureFirewallRCActionTypeAllow', 'AzureFirewallRCActionTypeDeny' - Type AzureFirewallRCActionType `json:"type,omitempty"` -} - -// AzureFirewallSku SKU of an Azure Firewall. -type AzureFirewallSku struct { - // Name - Name of an Azure Firewall SKU. Possible values include: 'AzureFirewallSkuNameAZFWVNet', 'AzureFirewallSkuNameAZFWHub' - Name AzureFirewallSkuName `json:"name,omitempty"` - // Tier - Tier of an Azure Firewall. Possible values include: 'AzureFirewallSkuTierStandard', 'AzureFirewallSkuTierPremium', 'AzureFirewallSkuTierBasic' - Tier AzureFirewallSkuTier `json:"tier,omitempty"` -} - -// AzureFirewallsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type AzureFirewallsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AzureFirewallsClient) (AzureFirewall, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AzureFirewallsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AzureFirewallsCreateOrUpdateFuture.Result. -func (future *AzureFirewallsCreateOrUpdateFuture) result(client AzureFirewallsClient) (af AzureFirewall, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.AzureFirewallsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - af.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.AzureFirewallsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if af.Response.Response, err = future.GetResult(sender); err == nil && af.Response.Response.StatusCode != http.StatusNoContent { - af, err = client.CreateOrUpdateResponder(af.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.AzureFirewallsCreateOrUpdateFuture", "Result", af.Response.Response, "Failure responding to request") - } - } - return -} - -// AzureFirewallsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AzureFirewallsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AzureFirewallsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AzureFirewallsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AzureFirewallsDeleteFuture.Result. -func (future *AzureFirewallsDeleteFuture) result(client AzureFirewallsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.AzureFirewallsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.AzureFirewallsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AzureFirewallsListLearnedPrefixesFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type AzureFirewallsListLearnedPrefixesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AzureFirewallsClient) (IPPrefixesList, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AzureFirewallsListLearnedPrefixesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AzureFirewallsListLearnedPrefixesFuture.Result. -func (future *AzureFirewallsListLearnedPrefixesFuture) result(client AzureFirewallsClient) (ipl IPPrefixesList, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.AzureFirewallsListLearnedPrefixesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ipl.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.AzureFirewallsListLearnedPrefixesFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ipl.Response.Response, err = future.GetResult(sender); err == nil && ipl.Response.Response.StatusCode != http.StatusNoContent { - ipl, err = client.ListLearnedPrefixesResponder(ipl.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.AzureFirewallsListLearnedPrefixesFuture", "Result", ipl.Response.Response, "Failure responding to request") - } - } - return -} - -// AzureFirewallsUpdateTagsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type AzureFirewallsUpdateTagsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AzureFirewallsClient) (AzureFirewall, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AzureFirewallsUpdateTagsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AzureFirewallsUpdateTagsFuture.Result. -func (future *AzureFirewallsUpdateTagsFuture) result(client AzureFirewallsClient) (af AzureFirewall, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.AzureFirewallsUpdateTagsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - af.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.AzureFirewallsUpdateTagsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if af.Response.Response, err = future.GetResult(sender); err == nil && af.Response.Response.StatusCode != http.StatusNoContent { - af, err = client.UpdateTagsResponder(af.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.AzureFirewallsUpdateTagsFuture", "Result", af.Response.Response, "Failure responding to request") - } - } - return -} - -// AzureReachabilityReport azure reachability report details. -type AzureReachabilityReport struct { - autorest.Response `json:"-"` - // AggregationLevel - The aggregation level of Azure reachability report. Can be Country, State or City. - AggregationLevel *string `json:"aggregationLevel,omitempty"` - // ProviderLocation - Parameters that define a geographic location. - ProviderLocation *AzureReachabilityReportLocation `json:"providerLocation,omitempty"` - // ReachabilityReport - List of Azure reachability report items. - ReachabilityReport *[]AzureReachabilityReportItem `json:"reachabilityReport,omitempty"` -} - -// AzureReachabilityReportItem azure reachability report details for a given provider location. -type AzureReachabilityReportItem struct { - // Provider - The Internet service provider. - Provider *string `json:"provider,omitempty"` - // AzureLocation - The Azure region. - AzureLocation *string `json:"azureLocation,omitempty"` - // Latencies - List of latency details for each of the time series. - Latencies *[]AzureReachabilityReportLatencyInfo `json:"latencies,omitempty"` -} - -// AzureReachabilityReportLatencyInfo details on latency for a time series. -type AzureReachabilityReportLatencyInfo struct { - // TimeStamp - The time stamp. - TimeStamp *date.Time `json:"timeStamp,omitempty"` - // Score - The relative latency score between 1 and 100, higher values indicating a faster connection. - Score *int32 `json:"score,omitempty"` -} - -// AzureReachabilityReportLocation parameters that define a geographic location. -type AzureReachabilityReportLocation struct { - // Country - The name of the country. - Country *string `json:"country,omitempty"` - // State - The name of the state. - State *string `json:"state,omitempty"` - // City - The name of the city or town. - City *string `json:"city,omitempty"` -} - -// AzureReachabilityReportParameters geographic and time constraints for Azure reachability report. -type AzureReachabilityReportParameters struct { - // ProviderLocation - Parameters that define a geographic location. - ProviderLocation *AzureReachabilityReportLocation `json:"providerLocation,omitempty"` - // Providers - List of Internet service providers. - Providers *[]string `json:"providers,omitempty"` - // AzureLocations - Optional Azure regions to scope the query to. - AzureLocations *[]string `json:"azureLocations,omitempty"` - // StartTime - The start time for the Azure reachability report. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - The end time for the Azure reachability report. - EndTime *date.Time `json:"endTime,omitempty"` -} - -// AzureWebCategory azure Web Category Resource. -type AzureWebCategory struct { - autorest.Response `json:"-"` - // AzureWebCategoryPropertiesFormat - Properties of the Azure Web Category. - *AzureWebCategoryPropertiesFormat `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureWebCategory. -func (awc AzureWebCategory) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if awc.AzureWebCategoryPropertiesFormat != nil { - objectMap["properties"] = awc.AzureWebCategoryPropertiesFormat - } - if awc.ID != nil { - objectMap["id"] = awc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AzureWebCategory struct. -func (awc *AzureWebCategory) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var azureWebCategoryPropertiesFormat AzureWebCategoryPropertiesFormat - err = json.Unmarshal(*v, &azureWebCategoryPropertiesFormat) - if err != nil { - return err - } - awc.AzureWebCategoryPropertiesFormat = &azureWebCategoryPropertiesFormat - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - awc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - awc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - awc.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - awc.Etag = &etag - } - } - } - - return nil -} - -// AzureWebCategoryListResult response for ListAzureWebCategories API service call. -type AzureWebCategoryListResult struct { - autorest.Response `json:"-"` - // Value - List of Azure Web Categories for a given Subscription. - Value *[]AzureWebCategory `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AzureWebCategoryListResultIterator provides access to a complete listing of AzureWebCategory values. -type AzureWebCategoryListResultIterator struct { - i int - page AzureWebCategoryListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AzureWebCategoryListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureWebCategoryListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AzureWebCategoryListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AzureWebCategoryListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AzureWebCategoryListResultIterator) Response() AzureWebCategoryListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AzureWebCategoryListResultIterator) Value() AzureWebCategory { - if !iter.page.NotDone() { - return AzureWebCategory{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AzureWebCategoryListResultIterator type. -func NewAzureWebCategoryListResultIterator(page AzureWebCategoryListResultPage) AzureWebCategoryListResultIterator { - return AzureWebCategoryListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (awclr AzureWebCategoryListResult) IsEmpty() bool { - return awclr.Value == nil || len(*awclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (awclr AzureWebCategoryListResult) hasNextLink() bool { - return awclr.NextLink != nil && len(*awclr.NextLink) != 0 -} - -// azureWebCategoryListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (awclr AzureWebCategoryListResult) azureWebCategoryListResultPreparer(ctx context.Context) (*http.Request, error) { - if !awclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(awclr.NextLink))) -} - -// AzureWebCategoryListResultPage contains a page of AzureWebCategory values. -type AzureWebCategoryListResultPage struct { - fn func(context.Context, AzureWebCategoryListResult) (AzureWebCategoryListResult, error) - awclr AzureWebCategoryListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AzureWebCategoryListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureWebCategoryListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.awclr) - if err != nil { - return err - } - page.awclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AzureWebCategoryListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AzureWebCategoryListResultPage) NotDone() bool { - return !page.awclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AzureWebCategoryListResultPage) Response() AzureWebCategoryListResult { - return page.awclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AzureWebCategoryListResultPage) Values() []AzureWebCategory { - if page.awclr.IsEmpty() { - return nil - } - return *page.awclr.Value -} - -// Creates a new instance of the AzureWebCategoryListResultPage type. -func NewAzureWebCategoryListResultPage(cur AzureWebCategoryListResult, getNextPage func(context.Context, AzureWebCategoryListResult) (AzureWebCategoryListResult, error)) AzureWebCategoryListResultPage { - return AzureWebCategoryListResultPage{ - fn: getNextPage, - awclr: cur, - } -} - -// AzureWebCategoryPropertiesFormat azure Web Category Properties. -type AzureWebCategoryPropertiesFormat struct { - // Group - READ-ONLY; The name of the group that the category belongs to. - Group *string `json:"group,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureWebCategoryPropertiesFormat. -func (awcpf AzureWebCategoryPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BGPCommunity contains bgp community information offered in Service Community resources. -type BGPCommunity struct { - // ServiceSupportedRegion - The region which the service support. e.g. For O365, region is Global. - ServiceSupportedRegion *string `json:"serviceSupportedRegion,omitempty"` - // CommunityName - The name of the bgp community. e.g. Skype. - CommunityName *string `json:"communityName,omitempty"` - // CommunityValue - The value of the bgp community. For more information: https://docs.microsoft.com/en-us/azure/expressroute/expressroute-routing. - CommunityValue *string `json:"communityValue,omitempty"` - // CommunityPrefixes - The prefixes that the bgp community contains. - CommunityPrefixes *[]string `json:"communityPrefixes,omitempty"` - // IsAuthorizedToUse - Customer is authorized to use bgp community or not. - IsAuthorizedToUse *bool `json:"isAuthorizedToUse,omitempty"` - // ServiceGroup - The service group of the bgp community contains. - ServiceGroup *string `json:"serviceGroup,omitempty"` -} - -// BackendAddressInboundNatRulePortMappings the response for a QueryInboundNatRulePortMapping API. -type BackendAddressInboundNatRulePortMappings struct { - autorest.Response `json:"-"` - // InboundNatRulePortMappings - Collection of inbound NAT rule port mappings. - InboundNatRulePortMappings *[]InboundNatRulePortMapping `json:"inboundNatRulePortMappings,omitempty"` -} - -// BackendAddressPool pool of backend IP addresses. -type BackendAddressPool struct { - autorest.Response `json:"-"` - // BackendAddressPoolPropertiesFormat - Properties of load balancer backend address pool. - *BackendAddressPoolPropertiesFormat `json:"properties,omitempty"` - // Name - 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. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendAddressPool. -func (bap BackendAddressPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bap.BackendAddressPoolPropertiesFormat != nil { - objectMap["properties"] = bap.BackendAddressPoolPropertiesFormat - } - if bap.Name != nil { - objectMap["name"] = bap.Name - } - if bap.ID != nil { - objectMap["id"] = bap.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackendAddressPool struct. -func (bap *BackendAddressPool) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var backendAddressPoolPropertiesFormat BackendAddressPoolPropertiesFormat - err = json.Unmarshal(*v, &backendAddressPoolPropertiesFormat) - if err != nil { - return err - } - bap.BackendAddressPoolPropertiesFormat = &backendAddressPoolPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bap.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - bap.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bap.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bap.ID = &ID - } - } - } - - return nil -} - -// BackendAddressPoolPropertiesFormat properties of the backend address pool. -type BackendAddressPoolPropertiesFormat struct { - // Location - The location of the backend address pool. - Location *string `json:"location,omitempty"` - // TunnelInterfaces - An array of gateway load balancer tunnel interfaces. - TunnelInterfaces *[]GatewayLoadBalancerTunnelInterface `json:"tunnelInterfaces,omitempty"` - // LoadBalancerBackendAddresses - An array of backend addresses. - LoadBalancerBackendAddresses *[]LoadBalancerBackendAddress `json:"loadBalancerBackendAddresses,omitempty"` - // BackendIPConfigurations - READ-ONLY; An array of references to IP addresses defined in network interfaces. - BackendIPConfigurations *[]InterfaceIPConfiguration `json:"backendIPConfigurations,omitempty"` - // LoadBalancingRules - READ-ONLY; An array of references to load balancing rules that use this backend address pool. - LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` - // OutboundRule - READ-ONLY; A reference to an outbound rule that uses this backend address pool. - OutboundRule *SubResource `json:"outboundRule,omitempty"` - // OutboundRules - READ-ONLY; An array of references to outbound rules that use this backend address pool. - OutboundRules *[]SubResource `json:"outboundRules,omitempty"` - // InboundNatRules - READ-ONLY; An array of references to inbound NAT rules that use this backend address pool. - InboundNatRules *[]SubResource `json:"inboundNatRules,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the backend address pool resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // DrainPeriodInSeconds - Amount of seconds Load Balancer waits for before sending RESET to client and backend address. - DrainPeriodInSeconds *int32 `json:"drainPeriodInSeconds,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackendAddressPoolPropertiesFormat. -func (bappf BackendAddressPoolPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bappf.Location != nil { - objectMap["location"] = bappf.Location - } - if bappf.TunnelInterfaces != nil { - objectMap["tunnelInterfaces"] = bappf.TunnelInterfaces - } - if bappf.LoadBalancerBackendAddresses != nil { - objectMap["loadBalancerBackendAddresses"] = bappf.LoadBalancerBackendAddresses - } - if bappf.DrainPeriodInSeconds != nil { - objectMap["drainPeriodInSeconds"] = bappf.DrainPeriodInSeconds - } - return json.Marshal(objectMap) -} - -// BasicBaseAdminRule network base admin rule. -type BasicBaseAdminRule interface { - AsAdminRule() (*AdminRule, bool) - AsDefaultAdminRule() (*DefaultAdminRule, bool) - AsBaseAdminRule() (*BaseAdminRule, bool) -} - -// BaseAdminRule network base admin rule. -type BaseAdminRule struct { - autorest.Response `json:"-"` - // SystemData - READ-ONLY; The system metadata related to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // Kind - Possible values include: 'KindBasicBaseAdminRuleKindBaseAdminRule', 'KindBasicBaseAdminRuleKindCustom', 'KindBasicBaseAdminRuleKindDefault' - Kind KindBasicBaseAdminRule `json:"kind,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` -} - -func unmarshalBasicBaseAdminRule(body []byte) (BasicBaseAdminRule, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["kind"] { - case string(KindBasicBaseAdminRuleKindCustom): - var ar AdminRule - err := json.Unmarshal(body, &ar) - return ar, err - case string(KindBasicBaseAdminRuleKindDefault): - var dar DefaultAdminRule - err := json.Unmarshal(body, &dar) - return dar, err - default: - var bar BaseAdminRule - err := json.Unmarshal(body, &bar) - return bar, err - } -} -func unmarshalBasicBaseAdminRuleArray(body []byte) ([]BasicBaseAdminRule, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - barArray := make([]BasicBaseAdminRule, len(rawMessages)) - - for index, rawMessage := range rawMessages { - bar, err := unmarshalBasicBaseAdminRule(*rawMessage) - if err != nil { - return nil, err - } - barArray[index] = bar - } - return barArray, nil -} - -// MarshalJSON is the custom marshaler for BaseAdminRule. -func (bar BaseAdminRule) MarshalJSON() ([]byte, error) { - bar.Kind = KindBasicBaseAdminRuleKindBaseAdminRule - objectMap := make(map[string]interface{}) - if bar.Kind != "" { - objectMap["kind"] = bar.Kind - } - return json.Marshal(objectMap) -} - -// AsAdminRule is the BasicBaseAdminRule implementation for BaseAdminRule. -func (bar BaseAdminRule) AsAdminRule() (*AdminRule, bool) { - return nil, false -} - -// AsDefaultAdminRule is the BasicBaseAdminRule implementation for BaseAdminRule. -func (bar BaseAdminRule) AsDefaultAdminRule() (*DefaultAdminRule, bool) { - return nil, false -} - -// AsBaseAdminRule is the BasicBaseAdminRule implementation for BaseAdminRule. -func (bar BaseAdminRule) AsBaseAdminRule() (*BaseAdminRule, bool) { - return &bar, true -} - -// AsBasicBaseAdminRule is the BasicBaseAdminRule implementation for BaseAdminRule. -func (bar BaseAdminRule) AsBasicBaseAdminRule() (BasicBaseAdminRule, bool) { - return &bar, true -} - -// BaseAdminRuleModel ... -type BaseAdminRuleModel struct { - autorest.Response `json:"-"` - Value BasicBaseAdminRule `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for BaseAdminRuleModel struct. -func (barm *BaseAdminRuleModel) UnmarshalJSON(body []byte) error { - bar, err := unmarshalBasicBaseAdminRule(body) - if err != nil { - return err - } - barm.Value = bar - - return nil -} - -// BastionActiveSession the session detail for a target. -type BastionActiveSession struct { - // SessionID - READ-ONLY; A unique id for the session. - SessionID *string `json:"sessionId,omitempty"` - // StartTime - READ-ONLY; The time when the session started. - StartTime interface{} `json:"startTime,omitempty"` - // TargetSubscriptionID - READ-ONLY; The subscription id for the target virtual machine. - TargetSubscriptionID *string `json:"targetSubscriptionId,omitempty"` - // ResourceType - READ-ONLY; The type of the resource. - ResourceType *string `json:"resourceType,omitempty"` - // TargetHostName - READ-ONLY; The host name of the target. - TargetHostName *string `json:"targetHostName,omitempty"` - // TargetResourceGroup - READ-ONLY; The resource group of the target. - TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` - // UserName - READ-ONLY; The user name who is active on this session. - UserName *string `json:"userName,omitempty"` - // TargetIPAddress - READ-ONLY; The IP Address of the target. - TargetIPAddress *string `json:"targetIpAddress,omitempty"` - // Protocol - READ-ONLY; The protocol used to connect to the target. Possible values include: 'BastionConnectProtocolSSH', 'BastionConnectProtocolRDP' - Protocol BastionConnectProtocol `json:"protocol,omitempty"` - // TargetResourceID - READ-ONLY; The resource id of the target. - TargetResourceID *string `json:"targetResourceId,omitempty"` - // SessionDurationInMins - READ-ONLY; Duration in mins the session has been active. - SessionDurationInMins *float64 `json:"sessionDurationInMins,omitempty"` -} - -// MarshalJSON is the custom marshaler for BastionActiveSession. -func (bas BastionActiveSession) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BastionActiveSessionListResult response for GetActiveSessions. -type BastionActiveSessionListResult struct { - autorest.Response `json:"-"` - // Value - List of active sessions on the bastion. - Value *[]BastionActiveSession `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// BastionActiveSessionListResultIterator provides access to a complete listing of BastionActiveSession -// values. -type BastionActiveSessionListResultIterator struct { - i int - page BastionActiveSessionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BastionActiveSessionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BastionActiveSessionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BastionActiveSessionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BastionActiveSessionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BastionActiveSessionListResultIterator) Response() BastionActiveSessionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BastionActiveSessionListResultIterator) Value() BastionActiveSession { - if !iter.page.NotDone() { - return BastionActiveSession{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BastionActiveSessionListResultIterator type. -func NewBastionActiveSessionListResultIterator(page BastionActiveSessionListResultPage) BastionActiveSessionListResultIterator { - return BastionActiveSessionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (baslr BastionActiveSessionListResult) IsEmpty() bool { - return baslr.Value == nil || len(*baslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (baslr BastionActiveSessionListResult) hasNextLink() bool { - return baslr.NextLink != nil && len(*baslr.NextLink) != 0 -} - -// bastionActiveSessionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (baslr BastionActiveSessionListResult) bastionActiveSessionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !baslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(baslr.NextLink))) -} - -// BastionActiveSessionListResultPage contains a page of BastionActiveSession values. -type BastionActiveSessionListResultPage struct { - fn func(context.Context, BastionActiveSessionListResult) (BastionActiveSessionListResult, error) - baslr BastionActiveSessionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BastionActiveSessionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BastionActiveSessionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.baslr) - if err != nil { - return err - } - page.baslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BastionActiveSessionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BastionActiveSessionListResultPage) NotDone() bool { - return !page.baslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BastionActiveSessionListResultPage) Response() BastionActiveSessionListResult { - return page.baslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BastionActiveSessionListResultPage) Values() []BastionActiveSession { - if page.baslr.IsEmpty() { - return nil - } - return *page.baslr.Value -} - -// Creates a new instance of the BastionActiveSessionListResultPage type. -func NewBastionActiveSessionListResultPage(cur BastionActiveSessionListResult, getNextPage func(context.Context, BastionActiveSessionListResult) (BastionActiveSessionListResult, error)) BastionActiveSessionListResultPage { - return BastionActiveSessionListResultPage{ - fn: getNextPage, - baslr: cur, - } -} - -// BastionHost bastion Host resource. -type BastionHost struct { - autorest.Response `json:"-"` - // BastionHostPropertiesFormat - Represents the bastion host resource. - *BastionHostPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Sku - The sku of this Bastion Host. - Sku *Sku `json:"sku,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for BastionHost. -func (bh BastionHost) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bh.BastionHostPropertiesFormat != nil { - objectMap["properties"] = bh.BastionHostPropertiesFormat - } - if bh.Sku != nil { - objectMap["sku"] = bh.Sku - } - if bh.ID != nil { - objectMap["id"] = bh.ID - } - if bh.Location != nil { - objectMap["location"] = bh.Location - } - if bh.Tags != nil { - objectMap["tags"] = bh.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BastionHost struct. -func (bh *BastionHost) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var bastionHostPropertiesFormat BastionHostPropertiesFormat - err = json.Unmarshal(*v, &bastionHostPropertiesFormat) - if err != nil { - return err - } - bh.BastionHostPropertiesFormat = &bastionHostPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - bh.Etag = &etag - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - bh.Sku = &sku - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bh.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bh.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bh.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - bh.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - bh.Tags = tags - } - } - } - - return nil -} - -// BastionHostIPConfiguration IP configuration of an Bastion Host. -type BastionHostIPConfiguration struct { - // BastionHostIPConfigurationPropertiesFormat - Represents the ip configuration associated with the resource. - *BastionHostIPConfigurationPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Ip configuration type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for BastionHostIPConfiguration. -func (bhic BastionHostIPConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bhic.BastionHostIPConfigurationPropertiesFormat != nil { - objectMap["properties"] = bhic.BastionHostIPConfigurationPropertiesFormat - } - if bhic.Name != nil { - objectMap["name"] = bhic.Name - } - if bhic.ID != nil { - objectMap["id"] = bhic.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BastionHostIPConfiguration struct. -func (bhic *BastionHostIPConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var bastionHostIPConfigurationPropertiesFormat BastionHostIPConfigurationPropertiesFormat - err = json.Unmarshal(*v, &bastionHostIPConfigurationPropertiesFormat) - if err != nil { - return err - } - bhic.BastionHostIPConfigurationPropertiesFormat = &bastionHostIPConfigurationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bhic.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - bhic.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bhic.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bhic.ID = &ID - } - } - } - - return nil -} - -// BastionHostIPConfigurationPropertiesFormat properties of IP configuration of an Bastion Host. -type BastionHostIPConfigurationPropertiesFormat struct { - // Subnet - Reference of the subnet resource. - Subnet *SubResource `json:"subnet,omitempty"` - // PublicIPAddress - Reference of the PublicIP resource. - PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the bastion host IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // PrivateIPAllocationMethod - Private IP allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' - PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` -} - -// MarshalJSON is the custom marshaler for BastionHostIPConfigurationPropertiesFormat. -func (bhicpf BastionHostIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bhicpf.Subnet != nil { - objectMap["subnet"] = bhicpf.Subnet - } - if bhicpf.PublicIPAddress != nil { - objectMap["publicIPAddress"] = bhicpf.PublicIPAddress - } - if bhicpf.PrivateIPAllocationMethod != "" { - objectMap["privateIPAllocationMethod"] = bhicpf.PrivateIPAllocationMethod - } - return json.Marshal(objectMap) -} - -// BastionHostListResult response for ListBastionHosts API service call. -type BastionHostListResult struct { - autorest.Response `json:"-"` - // Value - List of Bastion Hosts in a resource group. - Value *[]BastionHost `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// BastionHostListResultIterator provides access to a complete listing of BastionHost values. -type BastionHostListResultIterator struct { - i int - page BastionHostListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BastionHostListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BastionHostListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BastionHostListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BastionHostListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BastionHostListResultIterator) Response() BastionHostListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BastionHostListResultIterator) Value() BastionHost { - if !iter.page.NotDone() { - return BastionHost{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BastionHostListResultIterator type. -func NewBastionHostListResultIterator(page BastionHostListResultPage) BastionHostListResultIterator { - return BastionHostListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bhlr BastionHostListResult) IsEmpty() bool { - return bhlr.Value == nil || len(*bhlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bhlr BastionHostListResult) hasNextLink() bool { - return bhlr.NextLink != nil && len(*bhlr.NextLink) != 0 -} - -// bastionHostListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bhlr BastionHostListResult) bastionHostListResultPreparer(ctx context.Context) (*http.Request, error) { - if !bhlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bhlr.NextLink))) -} - -// BastionHostListResultPage contains a page of BastionHost values. -type BastionHostListResultPage struct { - fn func(context.Context, BastionHostListResult) (BastionHostListResult, error) - bhlr BastionHostListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BastionHostListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BastionHostListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.bhlr) - if err != nil { - return err - } - page.bhlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BastionHostListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BastionHostListResultPage) NotDone() bool { - return !page.bhlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BastionHostListResultPage) Response() BastionHostListResult { - return page.bhlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BastionHostListResultPage) Values() []BastionHost { - if page.bhlr.IsEmpty() { - return nil - } - return *page.bhlr.Value -} - -// Creates a new instance of the BastionHostListResultPage type. -func NewBastionHostListResultPage(cur BastionHostListResult, getNextPage func(context.Context, BastionHostListResult) (BastionHostListResult, error)) BastionHostListResultPage { - return BastionHostListResultPage{ - fn: getNextPage, - bhlr: cur, - } -} - -// BastionHostPropertiesFormat properties of the Bastion Host. -type BastionHostPropertiesFormat struct { - // IPConfigurations - IP configuration of the Bastion Host resource. - IPConfigurations *[]BastionHostIPConfiguration `json:"ipConfigurations,omitempty"` - // DNSName - FQDN for the endpoint on which bastion host is accessible. - DNSName *string `json:"dnsName,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the bastion host resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ScaleUnits - The scale units for the Bastion Host resource. - ScaleUnits *int32 `json:"scaleUnits,omitempty"` - // DisableCopyPaste - Enable/Disable Copy/Paste feature of the Bastion Host resource. - DisableCopyPaste *bool `json:"disableCopyPaste,omitempty"` - // EnableFileCopy - Enable/Disable File Copy feature of the Bastion Host resource. - EnableFileCopy *bool `json:"enableFileCopy,omitempty"` - // EnableIPConnect - Enable/Disable IP Connect feature of the Bastion Host resource. - EnableIPConnect *bool `json:"enableIpConnect,omitempty"` - // EnableShareableLink - Enable/Disable Shareable Link of the Bastion Host resource. - EnableShareableLink *bool `json:"enableShareableLink,omitempty"` - // EnableTunneling - Enable/Disable Tunneling feature of the Bastion Host resource. - EnableTunneling *bool `json:"enableTunneling,omitempty"` -} - -// MarshalJSON is the custom marshaler for BastionHostPropertiesFormat. -func (bhpf BastionHostPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bhpf.IPConfigurations != nil { - objectMap["ipConfigurations"] = bhpf.IPConfigurations - } - if bhpf.DNSName != nil { - objectMap["dnsName"] = bhpf.DNSName - } - if bhpf.ScaleUnits != nil { - objectMap["scaleUnits"] = bhpf.ScaleUnits - } - if bhpf.DisableCopyPaste != nil { - objectMap["disableCopyPaste"] = bhpf.DisableCopyPaste - } - if bhpf.EnableFileCopy != nil { - objectMap["enableFileCopy"] = bhpf.EnableFileCopy - } - if bhpf.EnableIPConnect != nil { - objectMap["enableIpConnect"] = bhpf.EnableIPConnect - } - if bhpf.EnableShareableLink != nil { - objectMap["enableShareableLink"] = bhpf.EnableShareableLink - } - if bhpf.EnableTunneling != nil { - objectMap["enableTunneling"] = bhpf.EnableTunneling - } - return json.Marshal(objectMap) -} - -// BastionHostsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type BastionHostsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BastionHostsClient) (BastionHost, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BastionHostsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BastionHostsCreateOrUpdateFuture.Result. -func (future *BastionHostsCreateOrUpdateFuture) result(client BastionHostsClient) (bh BastionHost, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BastionHostsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bh.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.BastionHostsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bh.Response.Response, err = future.GetResult(sender); err == nil && bh.Response.Response.StatusCode != http.StatusNoContent { - bh, err = client.CreateOrUpdateResponder(bh.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BastionHostsCreateOrUpdateFuture", "Result", bh.Response.Response, "Failure responding to request") - } - } - return -} - -// BastionHostsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BastionHostsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BastionHostsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BastionHostsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BastionHostsDeleteFuture.Result. -func (future *BastionHostsDeleteFuture) result(client BastionHostsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BastionHostsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.BastionHostsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// BastionHostsUpdateTagsFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BastionHostsUpdateTagsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BastionHostsClient) (BastionHost, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BastionHostsUpdateTagsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BastionHostsUpdateTagsFuture.Result. -func (future *BastionHostsUpdateTagsFuture) result(client BastionHostsClient) (bh BastionHost, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BastionHostsUpdateTagsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bh.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.BastionHostsUpdateTagsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bh.Response.Response, err = future.GetResult(sender); err == nil && bh.Response.Response.StatusCode != http.StatusNoContent { - bh, err = client.UpdateTagsResponder(bh.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BastionHostsUpdateTagsFuture", "Result", bh.Response.Response, "Failure responding to request") - } - } - return -} - -// BastionSessionDeleteResult response for DisconnectActiveSessions. -type BastionSessionDeleteResult struct { - autorest.Response `json:"-"` - // Value - List of sessions with their corresponding state. - Value *[]BastionSessionState `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// BastionSessionDeleteResultIterator provides access to a complete listing of BastionSessionState values. -type BastionSessionDeleteResultIterator struct { - i int - page BastionSessionDeleteResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BastionSessionDeleteResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BastionSessionDeleteResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BastionSessionDeleteResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BastionSessionDeleteResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BastionSessionDeleteResultIterator) Response() BastionSessionDeleteResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BastionSessionDeleteResultIterator) Value() BastionSessionState { - if !iter.page.NotDone() { - return BastionSessionState{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BastionSessionDeleteResultIterator type. -func NewBastionSessionDeleteResultIterator(page BastionSessionDeleteResultPage) BastionSessionDeleteResultIterator { - return BastionSessionDeleteResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bsdr BastionSessionDeleteResult) IsEmpty() bool { - return bsdr.Value == nil || len(*bsdr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bsdr BastionSessionDeleteResult) hasNextLink() bool { - return bsdr.NextLink != nil && len(*bsdr.NextLink) != 0 -} - -// bastionSessionDeleteResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bsdr BastionSessionDeleteResult) bastionSessionDeleteResultPreparer(ctx context.Context) (*http.Request, error) { - if !bsdr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bsdr.NextLink))) -} - -// BastionSessionDeleteResultPage contains a page of BastionSessionState values. -type BastionSessionDeleteResultPage struct { - fn func(context.Context, BastionSessionDeleteResult) (BastionSessionDeleteResult, error) - bsdr BastionSessionDeleteResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BastionSessionDeleteResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BastionSessionDeleteResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.bsdr) - if err != nil { - return err - } - page.bsdr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BastionSessionDeleteResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BastionSessionDeleteResultPage) NotDone() bool { - return !page.bsdr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BastionSessionDeleteResultPage) Response() BastionSessionDeleteResult { - return page.bsdr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BastionSessionDeleteResultPage) Values() []BastionSessionState { - if page.bsdr.IsEmpty() { - return nil - } - return *page.bsdr.Value -} - -// Creates a new instance of the BastionSessionDeleteResultPage type. -func NewBastionSessionDeleteResultPage(cur BastionSessionDeleteResult, getNextPage func(context.Context, BastionSessionDeleteResult) (BastionSessionDeleteResult, error)) BastionSessionDeleteResultPage { - return BastionSessionDeleteResultPage{ - fn: getNextPage, - bsdr: cur, - } -} - -// BastionSessionState the session state detail for a target. -type BastionSessionState struct { - // SessionID - READ-ONLY; A unique id for the session. - SessionID *string `json:"sessionId,omitempty"` - // Message - READ-ONLY; Used for extra information. - Message *string `json:"message,omitempty"` - // State - READ-ONLY; The state of the session. Disconnected/Failed/NotFound. - State *string `json:"state,omitempty"` -} - -// MarshalJSON is the custom marshaler for BastionSessionState. -func (bss BastionSessionState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BastionShareableLink bastion Shareable Link. -type BastionShareableLink struct { - // VM - Reference of the virtual machine resource. - VM *VM `json:"vm,omitempty"` - // Bsl - READ-ONLY; The unique Bastion Shareable Link to the virtual machine. - Bsl *string `json:"bsl,omitempty"` - // CreatedAt - READ-ONLY; The time when the link was created. - CreatedAt *string `json:"createdAt,omitempty"` - // Message - READ-ONLY; Optional field indicating the warning or error message related to the vm in case of partial failure. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for BastionShareableLink. -func (bsl BastionShareableLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bsl.VM != nil { - objectMap["vm"] = bsl.VM - } - return json.Marshal(objectMap) -} - -// BastionShareableLinkListRequest post request for all the Bastion Shareable Link endpoints. -type BastionShareableLinkListRequest struct { - // Vms - List of VM references. - Vms *[]BastionShareableLink `json:"vms,omitempty"` -} - -// BastionShareableLinkListResult response for all the Bastion Shareable Link endpoints. -type BastionShareableLinkListResult struct { - autorest.Response `json:"-"` - // Value - List of Bastion Shareable Links for the request. - Value *[]BastionShareableLink `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// BastionShareableLinkListResultIterator provides access to a complete listing of BastionShareableLink -// values. -type BastionShareableLinkListResultIterator struct { - i int - page BastionShareableLinkListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BastionShareableLinkListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BastionShareableLinkListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BastionShareableLinkListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BastionShareableLinkListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BastionShareableLinkListResultIterator) Response() BastionShareableLinkListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BastionShareableLinkListResultIterator) Value() BastionShareableLink { - if !iter.page.NotDone() { - return BastionShareableLink{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BastionShareableLinkListResultIterator type. -func NewBastionShareableLinkListResultIterator(page BastionShareableLinkListResultPage) BastionShareableLinkListResultIterator { - return BastionShareableLinkListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bsllr BastionShareableLinkListResult) IsEmpty() bool { - return bsllr.Value == nil || len(*bsllr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bsllr BastionShareableLinkListResult) hasNextLink() bool { - return bsllr.NextLink != nil && len(*bsllr.NextLink) != 0 -} - -// bastionShareableLinkListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bsllr BastionShareableLinkListResult) bastionShareableLinkListResultPreparer(ctx context.Context) (*http.Request, error) { - if !bsllr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bsllr.NextLink))) -} - -// BastionShareableLinkListResultPage contains a page of BastionShareableLink values. -type BastionShareableLinkListResultPage struct { - fn func(context.Context, BastionShareableLinkListResult) (BastionShareableLinkListResult, error) - bsllr BastionShareableLinkListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BastionShareableLinkListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BastionShareableLinkListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.bsllr) - if err != nil { - return err - } - page.bsllr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BastionShareableLinkListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BastionShareableLinkListResultPage) NotDone() bool { - return !page.bsllr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BastionShareableLinkListResultPage) Response() BastionShareableLinkListResult { - return page.bsllr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BastionShareableLinkListResultPage) Values() []BastionShareableLink { - if page.bsllr.IsEmpty() { - return nil - } - return *page.bsllr.Value -} - -// Creates a new instance of the BastionShareableLinkListResultPage type. -func NewBastionShareableLinkListResultPage(cur BastionShareableLinkListResult, getNextPage func(context.Context, BastionShareableLinkListResult) (BastionShareableLinkListResult, error)) BastionShareableLinkListResultPage { - return BastionShareableLinkListResultPage{ - fn: getNextPage, - bsllr: cur, - } -} - -// BgpConnection virtual Appliance Site resource. -type BgpConnection struct { - autorest.Response `json:"-"` - // BgpConnectionProperties - The properties of the Bgp connections. - *BgpConnectionProperties `json:"properties,omitempty"` - // Name - Name of the connection. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Connection type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for BgpConnection. -func (bc BgpConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bc.BgpConnectionProperties != nil { - objectMap["properties"] = bc.BgpConnectionProperties - } - if bc.Name != nil { - objectMap["name"] = bc.Name - } - if bc.ID != nil { - objectMap["id"] = bc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BgpConnection struct. -func (bc *BgpConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var bgpConnectionProperties BgpConnectionProperties - err = json.Unmarshal(*v, &bgpConnectionProperties) - if err != nil { - return err - } - bc.BgpConnectionProperties = &bgpConnectionProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - bc.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bc.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bc.ID = &ID - } - } - } - - return nil -} - -// BgpConnectionProperties properties of the bgp connection. -type BgpConnectionProperties struct { - // PeerAsn - Peer ASN. - PeerAsn *int64 `json:"peerAsn,omitempty"` - // PeerIP - Peer IP. - PeerIP *string `json:"peerIp,omitempty"` - // HubVirtualNetworkConnection - The reference to the HubVirtualNetworkConnection resource. - HubVirtualNetworkConnection *SubResource `json:"hubVirtualNetworkConnection,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ConnectionState - READ-ONLY; The current state of the VirtualHub to Peer. Possible values include: 'HubBgpConnectionStatusUnknown', 'HubBgpConnectionStatusConnecting', 'HubBgpConnectionStatusConnected', 'HubBgpConnectionStatusNotConnected' - ConnectionState HubBgpConnectionStatus `json:"connectionState,omitempty"` -} - -// MarshalJSON is the custom marshaler for BgpConnectionProperties. -func (bcp BgpConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bcp.PeerAsn != nil { - objectMap["peerAsn"] = bcp.PeerAsn - } - if bcp.PeerIP != nil { - objectMap["peerIp"] = bcp.PeerIP - } - if bcp.HubVirtualNetworkConnection != nil { - objectMap["hubVirtualNetworkConnection"] = bcp.HubVirtualNetworkConnection - } - return json.Marshal(objectMap) -} - -// BgpPeerStatus BGP peer status details. -type BgpPeerStatus struct { - // LocalAddress - READ-ONLY; The virtual network gateway's local address. - LocalAddress *string `json:"localAddress,omitempty"` - // Neighbor - READ-ONLY; The remote BGP peer. - Neighbor *string `json:"neighbor,omitempty"` - // Asn - READ-ONLY; The autonomous system number of the remote BGP peer. - Asn *int64 `json:"asn,omitempty"` - // State - READ-ONLY; The BGP peer state. Possible values include: 'BgpPeerStateUnknown', 'BgpPeerStateStopped', 'BgpPeerStateIdle', 'BgpPeerStateConnecting', 'BgpPeerStateConnected' - State BgpPeerState `json:"state,omitempty"` - // ConnectedDuration - READ-ONLY; For how long the peering has been up. - ConnectedDuration *string `json:"connectedDuration,omitempty"` - // RoutesReceived - READ-ONLY; The number of routes learned from this peer. - RoutesReceived *int64 `json:"routesReceived,omitempty"` - // MessagesSent - READ-ONLY; The number of BGP messages sent. - MessagesSent *int64 `json:"messagesSent,omitempty"` - // MessagesReceived - READ-ONLY; The number of BGP messages received. - MessagesReceived *int64 `json:"messagesReceived,omitempty"` -} - -// MarshalJSON is the custom marshaler for BgpPeerStatus. -func (bps BgpPeerStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BgpPeerStatusListResult response for list BGP peer status API service call. -type BgpPeerStatusListResult struct { - autorest.Response `json:"-"` - // Value - List of BGP peers. - Value *[]BgpPeerStatus `json:"value,omitempty"` -} - -// BgpServiceCommunity service Community Properties. -type BgpServiceCommunity struct { - // BgpServiceCommunityPropertiesFormat - Properties of the BGP service community. - *BgpServiceCommunityPropertiesFormat `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for BgpServiceCommunity. -func (bsc BgpServiceCommunity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bsc.BgpServiceCommunityPropertiesFormat != nil { - objectMap["properties"] = bsc.BgpServiceCommunityPropertiesFormat - } - if bsc.ID != nil { - objectMap["id"] = bsc.ID - } - if bsc.Location != nil { - objectMap["location"] = bsc.Location - } - if bsc.Tags != nil { - objectMap["tags"] = bsc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BgpServiceCommunity struct. -func (bsc *BgpServiceCommunity) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var bgpServiceCommunityPropertiesFormat BgpServiceCommunityPropertiesFormat - err = json.Unmarshal(*v, &bgpServiceCommunityPropertiesFormat) - if err != nil { - return err - } - bsc.BgpServiceCommunityPropertiesFormat = &bgpServiceCommunityPropertiesFormat - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bsc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bsc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bsc.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - bsc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - bsc.Tags = tags - } - } - } - - return nil -} - -// BgpServiceCommunityListResult response for the ListServiceCommunity API service call. -type BgpServiceCommunityListResult struct { - autorest.Response `json:"-"` - // Value - A list of service community resources. - Value *[]BgpServiceCommunity `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// BgpServiceCommunityListResultIterator provides access to a complete listing of BgpServiceCommunity -// values. -type BgpServiceCommunityListResultIterator struct { - i int - page BgpServiceCommunityListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BgpServiceCommunityListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BgpServiceCommunityListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BgpServiceCommunityListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BgpServiceCommunityListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BgpServiceCommunityListResultIterator) Response() BgpServiceCommunityListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BgpServiceCommunityListResultIterator) Value() BgpServiceCommunity { - if !iter.page.NotDone() { - return BgpServiceCommunity{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BgpServiceCommunityListResultIterator type. -func NewBgpServiceCommunityListResultIterator(page BgpServiceCommunityListResultPage) BgpServiceCommunityListResultIterator { - return BgpServiceCommunityListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bsclr BgpServiceCommunityListResult) IsEmpty() bool { - return bsclr.Value == nil || len(*bsclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bsclr BgpServiceCommunityListResult) hasNextLink() bool { - return bsclr.NextLink != nil && len(*bsclr.NextLink) != 0 -} - -// bgpServiceCommunityListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bsclr BgpServiceCommunityListResult) bgpServiceCommunityListResultPreparer(ctx context.Context) (*http.Request, error) { - if !bsclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bsclr.NextLink))) -} - -// BgpServiceCommunityListResultPage contains a page of BgpServiceCommunity values. -type BgpServiceCommunityListResultPage struct { - fn func(context.Context, BgpServiceCommunityListResult) (BgpServiceCommunityListResult, error) - bsclr BgpServiceCommunityListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BgpServiceCommunityListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BgpServiceCommunityListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.bsclr) - if err != nil { - return err - } - page.bsclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BgpServiceCommunityListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BgpServiceCommunityListResultPage) NotDone() bool { - return !page.bsclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BgpServiceCommunityListResultPage) Response() BgpServiceCommunityListResult { - return page.bsclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BgpServiceCommunityListResultPage) Values() []BgpServiceCommunity { - if page.bsclr.IsEmpty() { - return nil - } - return *page.bsclr.Value -} - -// Creates a new instance of the BgpServiceCommunityListResultPage type. -func NewBgpServiceCommunityListResultPage(cur BgpServiceCommunityListResult, getNextPage func(context.Context, BgpServiceCommunityListResult) (BgpServiceCommunityListResult, error)) BgpServiceCommunityListResultPage { - return BgpServiceCommunityListResultPage{ - fn: getNextPage, - bsclr: cur, - } -} - -// BgpServiceCommunityPropertiesFormat properties of Service Community. -type BgpServiceCommunityPropertiesFormat struct { - // ServiceName - The name of the bgp community. e.g. Skype. - ServiceName *string `json:"serviceName,omitempty"` - // BgpCommunities - A list of bgp communities. - BgpCommunities *[]BGPCommunity `json:"bgpCommunities,omitempty"` -} - -// BgpSettings BGP settings details. -type BgpSettings struct { - // Asn - The BGP speaker's ASN. - Asn *int64 `json:"asn,omitempty"` - // BgpPeeringAddress - The BGP peering address and BGP identifier of this BGP speaker. - BgpPeeringAddress *string `json:"bgpPeeringAddress,omitempty"` - // PeerWeight - The weight added to routes learned from this BGP speaker. - PeerWeight *int32 `json:"peerWeight,omitempty"` - // BgpPeeringAddresses - BGP peering address with IP configuration ID for virtual network gateway. - BgpPeeringAddresses *[]IPConfigurationBgpPeeringAddress `json:"bgpPeeringAddresses,omitempty"` -} - -// BreakOutCategoryPolicies network Virtual Appliance Sku Properties. -type BreakOutCategoryPolicies struct { - // Allow - Flag to control breakout of o365 allow category. - Allow *bool `json:"allow,omitempty"` - // Optimize - Flag to control breakout of o365 optimize category. - Optimize *bool `json:"optimize,omitempty"` - // Default - Flag to control breakout of o365 default category. - Default *bool `json:"default,omitempty"` -} - -// CheckPrivateLinkServiceVisibilityRequest request body of the CheckPrivateLinkServiceVisibility API -// service call. -type CheckPrivateLinkServiceVisibilityRequest struct { - // PrivateLinkServiceAlias - The alias of the private link service. - PrivateLinkServiceAlias *string `json:"privateLinkServiceAlias,omitempty"` -} - -// ChildResource proxy resource representation. -type ChildResource struct { - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ChildResource. -func (cr ChildResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CloudError an error response from the service. -type CloudError struct { - // Error - Cloud error body. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from the service. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// ConfigurationDiagnosticParameters parameters to get network configuration diagnostic. -type ConfigurationDiagnosticParameters struct { - // TargetResourceID - The ID of the target resource to perform network configuration diagnostic. Valid options are VM, NetworkInterface, VMSS/NetworkInterface and Application Gateway. - TargetResourceID *string `json:"targetResourceId,omitempty"` - // VerbosityLevel - Verbosity level. Possible values include: 'VerbosityLevelNormal', 'VerbosityLevelMinimum', 'VerbosityLevelFull' - VerbosityLevel VerbosityLevel `json:"verbosityLevel,omitempty"` - // Profiles - List of network configuration diagnostic profiles. - Profiles *[]ConfigurationDiagnosticProfile `json:"profiles,omitempty"` -} - -// ConfigurationDiagnosticProfile parameters to compare with network configuration. -type ConfigurationDiagnosticProfile struct { - // Direction - The direction of the traffic. Possible values include: 'DirectionInbound', 'DirectionOutbound' - Direction Direction `json:"direction,omitempty"` - // Protocol - Protocol to be verified on. Accepted values are '*', TCP, UDP. - Protocol *string `json:"protocol,omitempty"` - // Source - Traffic source. Accepted values are '*', IP Address/CIDR, Service Tag. - Source *string `json:"source,omitempty"` - // Destination - Traffic destination. Accepted values are: '*', IP Address/CIDR, Service Tag. - Destination *string `json:"destination,omitempty"` - // DestinationPort - Traffic destination port. Accepted values are '*' and a single port in the range (0 - 65535). - DestinationPort *string `json:"destinationPort,omitempty"` -} - -// ConfigurationDiagnosticResponse results of network configuration diagnostic on the target resource. -type ConfigurationDiagnosticResponse struct { - autorest.Response `json:"-"` - // Results - READ-ONLY; List of network configuration diagnostic results. - Results *[]ConfigurationDiagnosticResult `json:"results,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigurationDiagnosticResponse. -func (cdr ConfigurationDiagnosticResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConfigurationDiagnosticResult network configuration diagnostic result corresponded to provided traffic -// query. -type ConfigurationDiagnosticResult struct { - // Profile - Network configuration diagnostic profile. - Profile *ConfigurationDiagnosticProfile `json:"profile,omitempty"` - // NetworkSecurityGroupResult - Network security group result. - NetworkSecurityGroupResult *SecurityGroupResult `json:"networkSecurityGroupResult,omitempty"` -} - -// ConfigurationGroup the network configuration group resource -type ConfigurationGroup struct { - // ID - Network group ID. - ID *string `json:"id,omitempty"` - // GroupProperties - The network configuration group properties - *GroupProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigurationGroup. -func (cg ConfigurationGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cg.ID != nil { - objectMap["id"] = cg.ID - } - if cg.GroupProperties != nil { - objectMap["properties"] = cg.GroupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConfigurationGroup struct. -func (cg *ConfigurationGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cg.ID = &ID - } - case "properties": - if v != nil { - var groupProperties GroupProperties - err = json.Unmarshal(*v, &groupProperties) - if err != nil { - return err - } - cg.GroupProperties = &groupProperties - } - } - } - - return nil -} - -// ConfigurationPolicyGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ConfigurationPolicyGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConfigurationPolicyGroupsClient) (VpnServerConfigurationPolicyGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConfigurationPolicyGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConfigurationPolicyGroupsCreateOrUpdateFuture.Result. -func (future *ConfigurationPolicyGroupsCreateOrUpdateFuture) result(client ConfigurationPolicyGroupsClient) (vscpg VpnServerConfigurationPolicyGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vscpg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ConfigurationPolicyGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vscpg.Response.Response, err = future.GetResult(sender); err == nil && vscpg.Response.Response.StatusCode != http.StatusNoContent { - vscpg, err = client.CreateOrUpdateResponder(vscpg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsCreateOrUpdateFuture", "Result", vscpg.Response.Response, "Failure responding to request") - } - } - return -} - -// ConfigurationPolicyGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConfigurationPolicyGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConfigurationPolicyGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConfigurationPolicyGroupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConfigurationPolicyGroupsDeleteFuture.Result. -func (future *ConfigurationPolicyGroupsDeleteFuture) result(client ConfigurationPolicyGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ConfigurationPolicyGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ConnectionMonitor parameters that define the operation to create a connection monitor. -type ConnectionMonitor struct { - // Location - Connection monitor location. - Location *string `json:"location,omitempty"` - // Tags - Connection monitor tags. - Tags map[string]*string `json:"tags"` - // ConnectionMonitorParameters - Properties of the connection monitor. - *ConnectionMonitorParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionMonitor. -func (cm ConnectionMonitor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cm.Location != nil { - objectMap["location"] = cm.Location - } - if cm.Tags != nil { - objectMap["tags"] = cm.Tags - } - if cm.ConnectionMonitorParameters != nil { - objectMap["properties"] = cm.ConnectionMonitorParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectionMonitor struct. -func (cm *ConnectionMonitor) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - cm.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cm.Tags = tags - } - case "properties": - if v != nil { - var connectionMonitorParameters ConnectionMonitorParameters - err = json.Unmarshal(*v, &connectionMonitorParameters) - if err != nil { - return err - } - cm.ConnectionMonitorParameters = &connectionMonitorParameters - } - } - } - - return nil -} - -// ConnectionMonitorDestination describes the destination of connection monitor. -type ConnectionMonitorDestination struct { - // ResourceID - The ID of the resource used as the destination by connection monitor. - ResourceID *string `json:"resourceId,omitempty"` - // Address - Address of the connection monitor destination (IP or domain name). - Address *string `json:"address,omitempty"` - // Port - The destination port used by connection monitor. - Port *int32 `json:"port,omitempty"` -} - -// ConnectionMonitorEndpoint describes the connection monitor endpoint. -type ConnectionMonitorEndpoint struct { - // Name - The name of the connection monitor endpoint. - Name *string `json:"name,omitempty"` - // Type - The endpoint type. Possible values include: 'EndpointTypeAzureVM', 'EndpointTypeAzureVNet', 'EndpointTypeAzureSubnet', 'EndpointTypeExternalAddress', 'EndpointTypeMMAWorkspaceMachine', 'EndpointTypeMMAWorkspaceNetwork', 'EndpointTypeAzureArcVM', 'EndpointTypeAzureVMSS' - Type EndpointType `json:"type,omitempty"` - // ResourceID - Resource ID of the connection monitor endpoint. - ResourceID *string `json:"resourceId,omitempty"` - // Address - Address of the connection monitor endpoint (IP or domain name). - Address *string `json:"address,omitempty"` - // Filter - Filter for sub-items within the endpoint. - Filter *ConnectionMonitorEndpointFilter `json:"filter,omitempty"` - // Scope - Endpoint scope. - Scope *ConnectionMonitorEndpointScope `json:"scope,omitempty"` - // CoverageLevel - Test coverage for the endpoint. Possible values include: 'CoverageLevelDefault', 'CoverageLevelLow', 'CoverageLevelBelowAverage', 'CoverageLevelAverage', 'CoverageLevelAboveAverage', 'CoverageLevelFull' - CoverageLevel CoverageLevel `json:"coverageLevel,omitempty"` -} - -// ConnectionMonitorEndpointFilter describes the connection monitor endpoint filter. -type ConnectionMonitorEndpointFilter struct { - // Type - The behavior of the endpoint filter. Currently only 'Include' is supported. Possible values include: 'ConnectionMonitorEndpointFilterTypeInclude' - Type ConnectionMonitorEndpointFilterType `json:"type,omitempty"` - // Items - List of items in the filter. - Items *[]ConnectionMonitorEndpointFilterItem `json:"items,omitempty"` -} - -// ConnectionMonitorEndpointFilterItem describes the connection monitor endpoint filter item. -type ConnectionMonitorEndpointFilterItem struct { - // Type - The type of item included in the filter. Currently only 'AgentAddress' is supported. Possible values include: 'ConnectionMonitorEndpointFilterItemTypeAgentAddress' - Type ConnectionMonitorEndpointFilterItemType `json:"type,omitempty"` - // Address - The address of the filter item. - Address *string `json:"address,omitempty"` -} - -// ConnectionMonitorEndpointScope describes the connection monitor endpoint scope. -type ConnectionMonitorEndpointScope struct { - // Include - List of items which needs to be included to the endpoint scope. - Include *[]ConnectionMonitorEndpointScopeItem `json:"include,omitempty"` - // Exclude - List of items which needs to be excluded from the endpoint scope. - Exclude *[]ConnectionMonitorEndpointScopeItem `json:"exclude,omitempty"` -} - -// ConnectionMonitorEndpointScopeItem describes the connection monitor endpoint scope item. -type ConnectionMonitorEndpointScopeItem struct { - // Address - The address of the endpoint item. Supported types are IPv4/IPv6 subnet mask or IPv4/IPv6 IP address. - Address *string `json:"address,omitempty"` -} - -// ConnectionMonitorHTTPConfiguration describes the HTTP configuration. -type ConnectionMonitorHTTPConfiguration struct { - // Port - The port to connect to. - Port *int32 `json:"port,omitempty"` - // Method - The HTTP method to use. Possible values include: 'HTTPConfigurationMethodGet', 'HTTPConfigurationMethodPost' - Method HTTPConfigurationMethod `json:"method,omitempty"` - // Path - The path component of the URI. For instance, "/dir1/dir2". - Path *string `json:"path,omitempty"` - // RequestHeaders - The HTTP headers to transmit with the request. - RequestHeaders *[]HTTPHeader `json:"requestHeaders,omitempty"` - // ValidStatusCodeRanges - HTTP status codes to consider successful. For instance, "2xx,301-304,418". - ValidStatusCodeRanges *[]string `json:"validStatusCodeRanges,omitempty"` - // PreferHTTPS - Value indicating whether HTTPS is preferred over HTTP in cases where the choice is not explicit. - PreferHTTPS *bool `json:"preferHTTPS,omitempty"` -} - -// ConnectionMonitorIcmpConfiguration describes the ICMP configuration. -type ConnectionMonitorIcmpConfiguration struct { - // DisableTraceRoute - Value indicating whether path evaluation with trace route should be disabled. - DisableTraceRoute *bool `json:"disableTraceRoute,omitempty"` -} - -// ConnectionMonitorListResult list of connection monitors. -type ConnectionMonitorListResult struct { - autorest.Response `json:"-"` - // Value - Information about connection monitors. - Value *[]ConnectionMonitorResult `json:"value,omitempty"` -} - -// ConnectionMonitorOutput describes a connection monitor output destination. -type ConnectionMonitorOutput struct { - // Type - Connection monitor output destination type. Currently, only "Workspace" is supported. Possible values include: 'OutputTypeWorkspace' - Type OutputType `json:"type,omitempty"` - // WorkspaceSettings - Describes the settings for producing output into a log analytics workspace. - WorkspaceSettings *ConnectionMonitorWorkspaceSettings `json:"workspaceSettings,omitempty"` -} - -// ConnectionMonitorParameters parameters that define the operation to create a connection monitor. -type ConnectionMonitorParameters struct { - // Source - Describes the source of connection monitor. - Source *ConnectionMonitorSource `json:"source,omitempty"` - // Destination - Describes the destination of connection monitor. - Destination *ConnectionMonitorDestination `json:"destination,omitempty"` - // AutoStart - Determines if the connection monitor will start automatically once created. - AutoStart *bool `json:"autoStart,omitempty"` - // MonitoringIntervalInSeconds - Monitoring interval in seconds. - MonitoringIntervalInSeconds *int32 `json:"monitoringIntervalInSeconds,omitempty"` - // Endpoints - List of connection monitor endpoints. - Endpoints *[]ConnectionMonitorEndpoint `json:"endpoints,omitempty"` - // TestConfigurations - List of connection monitor test configurations. - TestConfigurations *[]ConnectionMonitorTestConfiguration `json:"testConfigurations,omitempty"` - // TestGroups - List of connection monitor test groups. - TestGroups *[]ConnectionMonitorTestGroup `json:"testGroups,omitempty"` - // Outputs - List of connection monitor outputs. - Outputs *[]ConnectionMonitorOutput `json:"outputs,omitempty"` - // Notes - Optional notes to be associated with the connection monitor. - Notes *string `json:"notes,omitempty"` -} - -// ConnectionMonitorQueryResult list of connection states snapshots. -type ConnectionMonitorQueryResult struct { - autorest.Response `json:"-"` - // SourceStatus - Status of connection monitor source. Possible values include: 'ConnectionMonitorSourceStatusUnknown', 'ConnectionMonitorSourceStatusActive', 'ConnectionMonitorSourceStatusInactive' - SourceStatus ConnectionMonitorSourceStatus `json:"sourceStatus,omitempty"` - // States - Information about connection states. - States *[]ConnectionStateSnapshot `json:"states,omitempty"` -} - -// ConnectionMonitorResult information about the connection monitor. -type ConnectionMonitorResult struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Name of the connection monitor. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; ID of the connection monitor. - ID *string `json:"id,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Connection monitor type. - Type *string `json:"type,omitempty"` - // Location - Connection monitor location. - Location *string `json:"location,omitempty"` - // Tags - Connection monitor tags. - Tags map[string]*string `json:"tags"` - // ConnectionMonitorResultProperties - Properties of the connection monitor result. - *ConnectionMonitorResultProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionMonitorResult. -func (cmr ConnectionMonitorResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cmr.Location != nil { - objectMap["location"] = cmr.Location - } - if cmr.Tags != nil { - objectMap["tags"] = cmr.Tags - } - if cmr.ConnectionMonitorResultProperties != nil { - objectMap["properties"] = cmr.ConnectionMonitorResultProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectionMonitorResult struct. -func (cmr *ConnectionMonitorResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cmr.Name = &name - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cmr.ID = &ID - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - cmr.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cmr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - cmr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cmr.Tags = tags - } - case "properties": - if v != nil { - var connectionMonitorResultProperties ConnectionMonitorResultProperties - err = json.Unmarshal(*v, &connectionMonitorResultProperties) - if err != nil { - return err - } - cmr.ConnectionMonitorResultProperties = &connectionMonitorResultProperties - } - } - } - - return nil -} - -// ConnectionMonitorResultProperties describes the properties of a connection monitor. -type ConnectionMonitorResultProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the connection monitor. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // StartTime - READ-ONLY; The date and time when the connection monitor was started. - StartTime *date.Time `json:"startTime,omitempty"` - // MonitoringStatus - READ-ONLY; The monitoring status of the connection monitor. - MonitoringStatus *string `json:"monitoringStatus,omitempty"` - // ConnectionMonitorType - READ-ONLY; Type of connection monitor. Possible values include: 'ConnectionMonitorTypeMultiEndpoint', 'ConnectionMonitorTypeSingleSourceDestination' - ConnectionMonitorType ConnectionMonitorType `json:"connectionMonitorType,omitempty"` - // Source - Describes the source of connection monitor. - Source *ConnectionMonitorSource `json:"source,omitempty"` - // Destination - Describes the destination of connection monitor. - Destination *ConnectionMonitorDestination `json:"destination,omitempty"` - // AutoStart - Determines if the connection monitor will start automatically once created. - AutoStart *bool `json:"autoStart,omitempty"` - // MonitoringIntervalInSeconds - Monitoring interval in seconds. - MonitoringIntervalInSeconds *int32 `json:"monitoringIntervalInSeconds,omitempty"` - // Endpoints - List of connection monitor endpoints. - Endpoints *[]ConnectionMonitorEndpoint `json:"endpoints,omitempty"` - // TestConfigurations - List of connection monitor test configurations. - TestConfigurations *[]ConnectionMonitorTestConfiguration `json:"testConfigurations,omitempty"` - // TestGroups - List of connection monitor test groups. - TestGroups *[]ConnectionMonitorTestGroup `json:"testGroups,omitempty"` - // Outputs - List of connection monitor outputs. - Outputs *[]ConnectionMonitorOutput `json:"outputs,omitempty"` - // Notes - Optional notes to be associated with the connection monitor. - Notes *string `json:"notes,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionMonitorResultProperties. -func (cmrp ConnectionMonitorResultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cmrp.Source != nil { - objectMap["source"] = cmrp.Source - } - if cmrp.Destination != nil { - objectMap["destination"] = cmrp.Destination - } - if cmrp.AutoStart != nil { - objectMap["autoStart"] = cmrp.AutoStart - } - if cmrp.MonitoringIntervalInSeconds != nil { - objectMap["monitoringIntervalInSeconds"] = cmrp.MonitoringIntervalInSeconds - } - if cmrp.Endpoints != nil { - objectMap["endpoints"] = cmrp.Endpoints - } - if cmrp.TestConfigurations != nil { - objectMap["testConfigurations"] = cmrp.TestConfigurations - } - if cmrp.TestGroups != nil { - objectMap["testGroups"] = cmrp.TestGroups - } - if cmrp.Outputs != nil { - objectMap["outputs"] = cmrp.Outputs - } - if cmrp.Notes != nil { - objectMap["notes"] = cmrp.Notes - } - return json.Marshal(objectMap) -} - -// ConnectionMonitorSource describes the source of connection monitor. -type ConnectionMonitorSource struct { - // ResourceID - The ID of the resource used as the source by connection monitor. - ResourceID *string `json:"resourceId,omitempty"` - // Port - The source port used by connection monitor. - Port *int32 `json:"port,omitempty"` -} - -// ConnectionMonitorSuccessThreshold describes the threshold for declaring a test successful. -type ConnectionMonitorSuccessThreshold struct { - // ChecksFailedPercent - The maximum percentage of failed checks permitted for a test to evaluate as successful. - ChecksFailedPercent *int32 `json:"checksFailedPercent,omitempty"` - // RoundTripTimeMs - The maximum round-trip time in milliseconds permitted for a test to evaluate as successful. - RoundTripTimeMs *float64 `json:"roundTripTimeMs,omitempty"` -} - -// ConnectionMonitorTCPConfiguration describes the TCP configuration. -type ConnectionMonitorTCPConfiguration struct { - // Port - The port to connect to. - Port *int32 `json:"port,omitempty"` - // DisableTraceRoute - Value indicating whether path evaluation with trace route should be disabled. - DisableTraceRoute *bool `json:"disableTraceRoute,omitempty"` - // DestinationPortBehavior - Destination port behavior. Possible values include: 'DestinationPortBehaviorNone', 'DestinationPortBehaviorListenIfAvailable' - DestinationPortBehavior DestinationPortBehavior `json:"destinationPortBehavior,omitempty"` -} - -// ConnectionMonitorTestConfiguration describes a connection monitor test configuration. -type ConnectionMonitorTestConfiguration struct { - // Name - The name of the connection monitor test configuration. - Name *string `json:"name,omitempty"` - // TestFrequencySec - The frequency of test evaluation, in seconds. - TestFrequencySec *int32 `json:"testFrequencySec,omitempty"` - // Protocol - The protocol to use in test evaluation. Possible values include: 'ConnectionMonitorTestConfigurationProtocolTCP', 'ConnectionMonitorTestConfigurationProtocolHTTP', 'ConnectionMonitorTestConfigurationProtocolIcmp' - Protocol ConnectionMonitorTestConfigurationProtocol `json:"protocol,omitempty"` - // PreferredIPVersion - The preferred IP version to use in test evaluation. The connection monitor may choose to use a different version depending on other parameters. Possible values include: 'PreferredIPVersionIPv4', 'PreferredIPVersionIPv6' - PreferredIPVersion PreferredIPVersion `json:"preferredIPVersion,omitempty"` - // HTTPConfiguration - The parameters used to perform test evaluation over HTTP. - HTTPConfiguration *ConnectionMonitorHTTPConfiguration `json:"httpConfiguration,omitempty"` - // TCPConfiguration - The parameters used to perform test evaluation over TCP. - TCPConfiguration *ConnectionMonitorTCPConfiguration `json:"tcpConfiguration,omitempty"` - // IcmpConfiguration - The parameters used to perform test evaluation over ICMP. - IcmpConfiguration *ConnectionMonitorIcmpConfiguration `json:"icmpConfiguration,omitempty"` - // SuccessThreshold - The threshold for declaring a test successful. - SuccessThreshold *ConnectionMonitorSuccessThreshold `json:"successThreshold,omitempty"` -} - -// ConnectionMonitorTestGroup describes the connection monitor test group. -type ConnectionMonitorTestGroup struct { - // Name - The name of the connection monitor test group. - Name *string `json:"name,omitempty"` - // Disable - Value indicating whether test group is disabled. - Disable *bool `json:"disable,omitempty"` - // TestConfigurations - List of test configuration names. - TestConfigurations *[]string `json:"testConfigurations,omitempty"` - // Sources - List of source endpoint names. - Sources *[]string `json:"sources,omitempty"` - // Destinations - List of destination endpoint names. - Destinations *[]string `json:"destinations,omitempty"` -} - -// ConnectionMonitorWorkspaceSettings describes the settings for producing output into a log analytics -// workspace. -type ConnectionMonitorWorkspaceSettings struct { - // WorkspaceResourceID - Log analytics workspace resource ID. - WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` -} - -// ConnectionMonitorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConnectionMonitorsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConnectionMonitorsClient) (ConnectionMonitorResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConnectionMonitorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConnectionMonitorsCreateOrUpdateFuture.Result. -func (future *ConnectionMonitorsCreateOrUpdateFuture) result(client ConnectionMonitorsClient) (cmr ConnectionMonitorResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cmr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cmr.Response.Response, err = future.GetResult(sender); err == nil && cmr.Response.Response.StatusCode != http.StatusNoContent { - cmr, err = client.CreateOrUpdateResponder(cmr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsCreateOrUpdateFuture", "Result", cmr.Response.Response, "Failure responding to request") - } - } - return -} - -// ConnectionMonitorsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConnectionMonitorsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConnectionMonitorsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConnectionMonitorsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConnectionMonitorsDeleteFuture.Result. -func (future *ConnectionMonitorsDeleteFuture) result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ConnectionMonitorsQueryFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ConnectionMonitorsQueryFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConnectionMonitorsClient) (ConnectionMonitorQueryResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConnectionMonitorsQueryFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConnectionMonitorsQueryFuture.Result. -func (future *ConnectionMonitorsQueryFuture) result(client ConnectionMonitorsClient) (cmqr ConnectionMonitorQueryResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsQueryFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cmqr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsQueryFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cmqr.Response.Response, err = future.GetResult(sender); err == nil && cmqr.Response.Response.StatusCode != http.StatusNoContent { - cmqr, err = client.QueryResponder(cmqr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsQueryFuture", "Result", cmqr.Response.Response, "Failure responding to request") - } - } - return -} - -// ConnectionMonitorsStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ConnectionMonitorsStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConnectionMonitorsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConnectionMonitorsStartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConnectionMonitorsStartFuture.Result. -func (future *ConnectionMonitorsStartFuture) result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsStartFuture") - return - } - ar.Response = future.Response() - return -} - -// ConnectionMonitorsStopFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ConnectionMonitorsStopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConnectionMonitorsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConnectionMonitorsStopFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConnectionMonitorsStopFuture.Result. -func (future *ConnectionMonitorsStopFuture) result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsStopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsStopFuture") - return - } - ar.Response = future.Response() - return -} - -// ConnectionResetSharedKey the virtual network connection reset shared key. -type ConnectionResetSharedKey struct { - autorest.Response `json:"-"` - // KeyLength - The virtual network connection reset shared key length, should between 1 and 128. - KeyLength *int32 `json:"keyLength,omitempty"` -} - -// ConnectionSharedKey response for GetConnectionSharedKey API service call. -type ConnectionSharedKey struct { - autorest.Response `json:"-"` - // Value - The virtual network connection shared key value. - Value *string `json:"value,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// ConnectionStateSnapshot connection state snapshot. -type ConnectionStateSnapshot struct { - // ConnectionState - The connection state. Possible values include: 'ConnectionStateReachable', 'ConnectionStateUnreachable', 'ConnectionStateUnknown' - ConnectionState ConnectionState `json:"connectionState,omitempty"` - // StartTime - The start time of the connection snapshot. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - The end time of the connection snapshot. - EndTime *date.Time `json:"endTime,omitempty"` - // EvaluationState - Connectivity analysis evaluation state. Possible values include: 'EvaluationStateNotStarted', 'EvaluationStateInProgress', 'EvaluationStateCompleted' - EvaluationState EvaluationState `json:"evaluationState,omitempty"` - // AvgLatencyInMs - Average latency in ms. - AvgLatencyInMs *int64 `json:"avgLatencyInMs,omitempty"` - // MinLatencyInMs - Minimum latency in ms. - MinLatencyInMs *int64 `json:"minLatencyInMs,omitempty"` - // MaxLatencyInMs - Maximum latency in ms. - MaxLatencyInMs *int64 `json:"maxLatencyInMs,omitempty"` - // ProbesSent - The number of sent probes. - ProbesSent *int64 `json:"probesSent,omitempty"` - // ProbesFailed - The number of failed probes. - ProbesFailed *int64 `json:"probesFailed,omitempty"` - // Hops - READ-ONLY; List of hops between the source and the destination. - Hops *[]ConnectivityHop `json:"hops,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectionStateSnapshot. -func (CSS ConnectionStateSnapshot) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if CSS.ConnectionState != "" { - objectMap["connectionState"] = CSS.ConnectionState - } - if CSS.StartTime != nil { - objectMap["startTime"] = CSS.StartTime - } - if CSS.EndTime != nil { - objectMap["endTime"] = CSS.EndTime - } - if CSS.EvaluationState != "" { - objectMap["evaluationState"] = CSS.EvaluationState - } - if CSS.AvgLatencyInMs != nil { - objectMap["avgLatencyInMs"] = CSS.AvgLatencyInMs - } - if CSS.MinLatencyInMs != nil { - objectMap["minLatencyInMs"] = CSS.MinLatencyInMs - } - if CSS.MaxLatencyInMs != nil { - objectMap["maxLatencyInMs"] = CSS.MaxLatencyInMs - } - if CSS.ProbesSent != nil { - objectMap["probesSent"] = CSS.ProbesSent - } - if CSS.ProbesFailed != nil { - objectMap["probesFailed"] = CSS.ProbesFailed - } - return json.Marshal(objectMap) -} - -// ConnectivityConfiguration the network manager connectivity configuration resource -type ConnectivityConfiguration struct { - autorest.Response `json:"-"` - // ConnectivityConfigurationProperties - Properties of a network manager connectivity configuration - *ConnectivityConfigurationProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata related to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectivityConfiguration. -func (cc ConnectivityConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cc.ConnectivityConfigurationProperties != nil { - objectMap["properties"] = cc.ConnectivityConfigurationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConnectivityConfiguration struct. -func (cc *ConnectivityConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var connectivityConfigurationProperties ConnectivityConfigurationProperties - err = json.Unmarshal(*v, &connectivityConfigurationProperties) - if err != nil { - return err - } - cc.ConnectivityConfigurationProperties = &connectivityConfigurationProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - cc.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cc.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - cc.Etag = &etag - } - } - } - - return nil -} - -// ConnectivityConfigurationListResult result of the request to list network manager connectivity -// configurations. It contains a list of configurations and a link to get the next set of results. -type ConnectivityConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - Gets a page of Connectivity Configurations - Value *[]ConnectivityConfiguration `json:"value,omitempty"` - // NextLink - Gets the URL to get the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ConnectivityConfigurationListResultIterator provides access to a complete listing of -// ConnectivityConfiguration values. -type ConnectivityConfigurationListResultIterator struct { - i int - page ConnectivityConfigurationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ConnectivityConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectivityConfigurationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ConnectivityConfigurationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ConnectivityConfigurationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ConnectivityConfigurationListResultIterator) Response() ConnectivityConfigurationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ConnectivityConfigurationListResultIterator) Value() ConnectivityConfiguration { - if !iter.page.NotDone() { - return ConnectivityConfiguration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ConnectivityConfigurationListResultIterator type. -func NewConnectivityConfigurationListResultIterator(page ConnectivityConfigurationListResultPage) ConnectivityConfigurationListResultIterator { - return ConnectivityConfigurationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cclr ConnectivityConfigurationListResult) IsEmpty() bool { - return cclr.Value == nil || len(*cclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cclr ConnectivityConfigurationListResult) hasNextLink() bool { - return cclr.NextLink != nil && len(*cclr.NextLink) != 0 -} - -// connectivityConfigurationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cclr ConnectivityConfigurationListResult) connectivityConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !cclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cclr.NextLink))) -} - -// ConnectivityConfigurationListResultPage contains a page of ConnectivityConfiguration values. -type ConnectivityConfigurationListResultPage struct { - fn func(context.Context, ConnectivityConfigurationListResult) (ConnectivityConfigurationListResult, error) - cclr ConnectivityConfigurationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ConnectivityConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConnectivityConfigurationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cclr) - if err != nil { - return err - } - page.cclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ConnectivityConfigurationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ConnectivityConfigurationListResultPage) NotDone() bool { - return !page.cclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ConnectivityConfigurationListResultPage) Response() ConnectivityConfigurationListResult { - return page.cclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ConnectivityConfigurationListResultPage) Values() []ConnectivityConfiguration { - if page.cclr.IsEmpty() { - return nil - } - return *page.cclr.Value -} - -// Creates a new instance of the ConnectivityConfigurationListResultPage type. -func NewConnectivityConfigurationListResultPage(cur ConnectivityConfigurationListResult, getNextPage func(context.Context, ConnectivityConfigurationListResult) (ConnectivityConfigurationListResult, error)) ConnectivityConfigurationListResultPage { - return ConnectivityConfigurationListResultPage{ - fn: getNextPage, - cclr: cur, - } -} - -// ConnectivityConfigurationProperties properties of network manager connectivity configuration -type ConnectivityConfigurationProperties struct { - // Description - A description of the connectivity configuration. - Description *string `json:"description,omitempty"` - // ConnectivityTopology - Connectivity topology type. Possible values include: 'ConnectivityTopologyHubAndSpoke', 'ConnectivityTopologyMesh' - ConnectivityTopology ConnectivityTopology `json:"connectivityTopology,omitempty"` - // Hubs - List of hubItems - Hubs *[]Hub `json:"hubs,omitempty"` - // IsGlobal - Flag if global mesh is supported. Possible values include: 'IsGlobalFalse', 'IsGlobalTrue' - IsGlobal IsGlobal `json:"isGlobal,omitempty"` - // AppliesToGroups - Groups for configuration - AppliesToGroups *[]ConnectivityGroupItem `json:"appliesToGroups,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the connectivity configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // DeleteExistingPeering - Flag if need to remove current existing peerings. Possible values include: 'DeleteExistingPeeringFalse', 'DeleteExistingPeeringTrue' - DeleteExistingPeering DeleteExistingPeering `json:"deleteExistingPeering,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectivityConfigurationProperties. -func (ccp ConnectivityConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ccp.Description != nil { - objectMap["description"] = ccp.Description - } - if ccp.ConnectivityTopology != "" { - objectMap["connectivityTopology"] = ccp.ConnectivityTopology - } - if ccp.Hubs != nil { - objectMap["hubs"] = ccp.Hubs - } - if ccp.IsGlobal != "" { - objectMap["isGlobal"] = ccp.IsGlobal - } - if ccp.AppliesToGroups != nil { - objectMap["appliesToGroups"] = ccp.AppliesToGroups - } - if ccp.DeleteExistingPeering != "" { - objectMap["deleteExistingPeering"] = ccp.DeleteExistingPeering - } - return json.Marshal(objectMap) -} - -// ConnectivityConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConnectivityConfigurationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConnectivityConfigurationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConnectivityConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConnectivityConfigurationsDeleteFuture.Result. -func (future *ConnectivityConfigurationsDeleteFuture) result(client ConnectivityConfigurationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectivityConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ConnectivityConfigurationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ConnectivityDestination parameters that define destination of connection. -type ConnectivityDestination struct { - // ResourceID - The ID of the resource to which a connection attempt will be made. - ResourceID *string `json:"resourceId,omitempty"` - // Address - The IP address or URI the resource to which a connection attempt will be made. - Address *string `json:"address,omitempty"` - // Port - Port on which check connectivity will be performed. - Port *int32 `json:"port,omitempty"` -} - -// ConnectivityGroupItem connectivity group item. -type ConnectivityGroupItem struct { - // NetworkGroupID - Network group Id. - NetworkGroupID *string `json:"networkGroupId,omitempty"` - // UseHubGateway - Flag if need to use hub gateway. Possible values include: 'UseHubGatewayFalse', 'UseHubGatewayTrue' - UseHubGateway UseHubGateway `json:"useHubGateway,omitempty"` - // IsGlobal - Flag if global is supported. Possible values include: 'IsGlobalFalse', 'IsGlobalTrue' - IsGlobal IsGlobal `json:"isGlobal,omitempty"` - // GroupConnectivity - Group connectivity type. Possible values include: 'GroupConnectivityNone', 'GroupConnectivityDirectlyConnected' - GroupConnectivity GroupConnectivity `json:"groupConnectivity,omitempty"` -} - -// ConnectivityHop information about a hop between the source and the destination. -type ConnectivityHop struct { - // Type - READ-ONLY; The type of the hop. - Type *string `json:"type,omitempty"` - // ID - READ-ONLY; The ID of the hop. - ID *string `json:"id,omitempty"` - // Address - READ-ONLY; The IP address of the hop. - Address *string `json:"address,omitempty"` - // ResourceID - READ-ONLY; The ID of the resource corresponding to this hop. - ResourceID *string `json:"resourceId,omitempty"` - // NextHopIds - READ-ONLY; List of next hop identifiers. - NextHopIds *[]string `json:"nextHopIds,omitempty"` - // PreviousHopIds - READ-ONLY; List of previous hop identifiers. - PreviousHopIds *[]string `json:"previousHopIds,omitempty"` - // Links - READ-ONLY; List of hop links. - Links *[]HopLink `json:"links,omitempty"` - // PreviousLinks - READ-ONLY; List of previous hop links. - PreviousLinks *[]HopLink `json:"previousLinks,omitempty"` - // Issues - READ-ONLY; List of issues. - Issues *[]ConnectivityIssue `json:"issues,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectivityHop. -func (ch ConnectivityHop) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConnectivityInformation information on the connectivity status. -type ConnectivityInformation struct { - autorest.Response `json:"-"` - // Hops - READ-ONLY; List of hops between the source and the destination. - Hops *[]ConnectivityHop `json:"hops,omitempty"` - // ConnectionStatus - READ-ONLY; The connection status. Possible values include: 'ConnectionStatusUnknown', 'ConnectionStatusConnected', 'ConnectionStatusDisconnected', 'ConnectionStatusDegraded' - ConnectionStatus ConnectionStatus `json:"connectionStatus,omitempty"` - // AvgLatencyInMs - READ-ONLY; Average latency in milliseconds. - AvgLatencyInMs *int32 `json:"avgLatencyInMs,omitempty"` - // MinLatencyInMs - READ-ONLY; Minimum latency in milliseconds. - MinLatencyInMs *int32 `json:"minLatencyInMs,omitempty"` - // MaxLatencyInMs - READ-ONLY; Maximum latency in milliseconds. - MaxLatencyInMs *int32 `json:"maxLatencyInMs,omitempty"` - // ProbesSent - READ-ONLY; Total number of probes sent. - ProbesSent *int32 `json:"probesSent,omitempty"` - // ProbesFailed - READ-ONLY; Number of failed probes. - ProbesFailed *int32 `json:"probesFailed,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectivityInformation. -func (ci ConnectivityInformation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConnectivityIssue information about an issue encountered in the process of checking for connectivity. -type ConnectivityIssue struct { - // Origin - READ-ONLY; The origin of the issue. Possible values include: 'OriginLocal', 'OriginInbound', 'OriginOutbound' - Origin Origin `json:"origin,omitempty"` - // Severity - READ-ONLY; The severity of the issue. Possible values include: 'SeverityError', 'SeverityWarning' - Severity Severity `json:"severity,omitempty"` - // Type - READ-ONLY; The type of issue. Possible values include: 'IssueTypeUnknown', 'IssueTypeAgentStopped', 'IssueTypeGuestFirewall', 'IssueTypeDNSResolution', 'IssueTypeSocketBind', 'IssueTypeNetworkSecurityRule', 'IssueTypeUserDefinedRoute', 'IssueTypePortThrottled', 'IssueTypePlatform' - Type IssueType `json:"type,omitempty"` - // Context - READ-ONLY; Provides additional context on the issue. - Context *[]map[string]*string `json:"context,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConnectivityIssue. -func (ci ConnectivityIssue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConnectivityParameters parameters that determine how the connectivity check will be performed. -type ConnectivityParameters struct { - // Source - The source of the connection. - Source *ConnectivitySource `json:"source,omitempty"` - // Destination - The destination of connection. - Destination *ConnectivityDestination `json:"destination,omitempty"` - // Protocol - Network protocol. Possible values include: 'ProtocolTCP', 'ProtocolHTTP', 'ProtocolHTTPS', 'ProtocolIcmp' - Protocol Protocol `json:"protocol,omitempty"` - // ProtocolConfiguration - Configuration of the protocol. - ProtocolConfiguration *ProtocolConfiguration `json:"protocolConfiguration,omitempty"` - // PreferredIPVersion - Preferred IP version of the connection. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' - PreferredIPVersion IPVersion `json:"preferredIPVersion,omitempty"` -} - -// ConnectivitySource parameters that define the source of the connection. -type ConnectivitySource struct { - // ResourceID - The ID of the resource from which a connectivity check will be initiated. - ResourceID *string `json:"resourceId,omitempty"` - // Port - The source port from which a connectivity check will be performed. - Port *int32 `json:"port,omitempty"` -} - -// Container reference to container resource in remote resource provider. -type Container struct { - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// ContainerNetworkInterface container network interface child resource. -type ContainerNetworkInterface struct { - // ContainerNetworkInterfacePropertiesFormat - Container network interface properties. - *ContainerNetworkInterfacePropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Sub Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerNetworkInterface. -func (cni ContainerNetworkInterface) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cni.ContainerNetworkInterfacePropertiesFormat != nil { - objectMap["properties"] = cni.ContainerNetworkInterfacePropertiesFormat - } - if cni.Name != nil { - objectMap["name"] = cni.Name - } - if cni.ID != nil { - objectMap["id"] = cni.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ContainerNetworkInterface struct. -func (cni *ContainerNetworkInterface) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var containerNetworkInterfacePropertiesFormat ContainerNetworkInterfacePropertiesFormat - err = json.Unmarshal(*v, &containerNetworkInterfacePropertiesFormat) - if err != nil { - return err - } - cni.ContainerNetworkInterfacePropertiesFormat = &containerNetworkInterfacePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cni.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cni.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - cni.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cni.ID = &ID - } - } - } - - return nil -} - -// ContainerNetworkInterfaceConfiguration container network interface configuration child resource. -type ContainerNetworkInterfaceConfiguration struct { - // ContainerNetworkInterfaceConfigurationPropertiesFormat - Container network interface configuration properties. - *ContainerNetworkInterfaceConfigurationPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Sub Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerNetworkInterfaceConfiguration. -func (cnic ContainerNetworkInterfaceConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cnic.ContainerNetworkInterfaceConfigurationPropertiesFormat != nil { - objectMap["properties"] = cnic.ContainerNetworkInterfaceConfigurationPropertiesFormat - } - if cnic.Name != nil { - objectMap["name"] = cnic.Name - } - if cnic.ID != nil { - objectMap["id"] = cnic.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ContainerNetworkInterfaceConfiguration struct. -func (cnic *ContainerNetworkInterfaceConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var containerNetworkInterfaceConfigurationPropertiesFormat ContainerNetworkInterfaceConfigurationPropertiesFormat - err = json.Unmarshal(*v, &containerNetworkInterfaceConfigurationPropertiesFormat) - if err != nil { - return err - } - cnic.ContainerNetworkInterfaceConfigurationPropertiesFormat = &containerNetworkInterfaceConfigurationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cnic.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cnic.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - cnic.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cnic.ID = &ID - } - } - } - - return nil -} - -// ContainerNetworkInterfaceConfigurationPropertiesFormat container network interface configuration -// properties. -type ContainerNetworkInterfaceConfigurationPropertiesFormat struct { - // IPConfigurations - A list of ip configurations of the container network interface configuration. - IPConfigurations *[]IPConfigurationProfile `json:"ipConfigurations,omitempty"` - // ContainerNetworkInterfaces - A list of container network interfaces created from this container network interface configuration. - ContainerNetworkInterfaces *[]SubResource `json:"containerNetworkInterfaces,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the container network interface configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerNetworkInterfaceConfigurationPropertiesFormat. -func (cnicpf ContainerNetworkInterfaceConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cnicpf.IPConfigurations != nil { - objectMap["ipConfigurations"] = cnicpf.IPConfigurations - } - if cnicpf.ContainerNetworkInterfaces != nil { - objectMap["containerNetworkInterfaces"] = cnicpf.ContainerNetworkInterfaces - } - return json.Marshal(objectMap) -} - -// ContainerNetworkInterfaceIPConfiguration the ip configuration for a container network interface. -type ContainerNetworkInterfaceIPConfiguration struct { - // ContainerNetworkInterfaceIPConfigurationPropertiesFormat - Properties of the container network interface IP configuration. - *ContainerNetworkInterfaceIPConfigurationPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Sub Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerNetworkInterfaceIPConfiguration. -func (cniic ContainerNetworkInterfaceIPConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cniic.ContainerNetworkInterfaceIPConfigurationPropertiesFormat != nil { - objectMap["properties"] = cniic.ContainerNetworkInterfaceIPConfigurationPropertiesFormat - } - if cniic.Name != nil { - objectMap["name"] = cniic.Name - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ContainerNetworkInterfaceIPConfiguration struct. -func (cniic *ContainerNetworkInterfaceIPConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var containerNetworkInterfaceIPConfigurationPropertiesFormat ContainerNetworkInterfaceIPConfigurationPropertiesFormat - err = json.Unmarshal(*v, &containerNetworkInterfaceIPConfigurationPropertiesFormat) - if err != nil { - return err - } - cniic.ContainerNetworkInterfaceIPConfigurationPropertiesFormat = &containerNetworkInterfaceIPConfigurationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cniic.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cniic.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - cniic.Etag = &etag - } - } - } - - return nil -} - -// ContainerNetworkInterfaceIPConfigurationPropertiesFormat properties of the container network interface -// IP configuration. -type ContainerNetworkInterfaceIPConfigurationPropertiesFormat struct { - // ProvisioningState - READ-ONLY; The provisioning state of the container network interface IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerNetworkInterfaceIPConfigurationPropertiesFormat. -func (cniicpf ContainerNetworkInterfaceIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ContainerNetworkInterfacePropertiesFormat properties of container network interface. -type ContainerNetworkInterfacePropertiesFormat struct { - // ContainerNetworkInterfaceConfiguration - READ-ONLY; Container network interface configuration from which this container network interface is created. - ContainerNetworkInterfaceConfiguration *ContainerNetworkInterfaceConfiguration `json:"containerNetworkInterfaceConfiguration,omitempty"` - // Container - Reference to the container to which this container network interface is attached. - Container *Container `json:"container,omitempty"` - // IPConfigurations - READ-ONLY; Reference to the ip configuration on this container nic. - IPConfigurations *[]ContainerNetworkInterfaceIPConfiguration `json:"ipConfigurations,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the container network interface resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerNetworkInterfacePropertiesFormat. -func (cnipf ContainerNetworkInterfacePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cnipf.Container != nil { - objectMap["container"] = cnipf.Container - } - return json.Marshal(objectMap) -} - -// Criterion a matching criteria which matches routes based on route prefix, community, and AS path. -type Criterion struct { - // RoutePrefix - List of route prefixes which this criteria matches. - RoutePrefix *[]string `json:"routePrefix,omitempty"` - // Community - List of BGP communities which this criteria matches. - Community *[]string `json:"community,omitempty"` - // AsPath - List of AS paths which this criteria matches. - AsPath *[]string `json:"asPath,omitempty"` - // MatchCondition - Match condition to apply RouteMap rules. Possible values include: 'RouteMapMatchConditionUnknown', 'RouteMapMatchConditionContains', 'RouteMapMatchConditionEquals', 'RouteMapMatchConditionNotContains', 'RouteMapMatchConditionNotEquals' - MatchCondition RouteMapMatchCondition `json:"matchCondition,omitempty"` -} - -// CrossTenantScopes cross tenant scopes. -type CrossTenantScopes struct { - // TenantID - READ-ONLY; Tenant ID. - TenantID *string `json:"tenantId,omitempty"` - // ManagementGroups - READ-ONLY; List of management groups. - ManagementGroups *[]string `json:"managementGroups,omitempty"` - // Subscriptions - READ-ONLY; List of subscriptions. - Subscriptions *[]string `json:"subscriptions,omitempty"` -} - -// MarshalJSON is the custom marshaler for CrossTenantScopes. -func (cts CrossTenantScopes) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CustomDNSConfigPropertiesFormat contains custom Dns resolution configuration from customer. -type CustomDNSConfigPropertiesFormat struct { - // Fqdn - Fqdn that resolves to private endpoint ip address. - Fqdn *string `json:"fqdn,omitempty"` - // IPAddresses - A list of private ip addresses of the private endpoint. - IPAddresses *[]string `json:"ipAddresses,omitempty"` -} - -// CustomIPPrefix custom IP prefix resource. -type CustomIPPrefix struct { - autorest.Response `json:"-"` - // ExtendedLocation - The extended location of the custom IP prefix. - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - // CustomIPPrefixPropertiesFormat - Custom IP prefix properties. - *CustomIPPrefixPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Zones - A list of availability zones denoting the IP allocated for the resource needs to come from. - Zones *[]string `json:"zones,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for CustomIPPrefix. -func (cip CustomIPPrefix) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cip.ExtendedLocation != nil { - objectMap["extendedLocation"] = cip.ExtendedLocation - } - if cip.CustomIPPrefixPropertiesFormat != nil { - objectMap["properties"] = cip.CustomIPPrefixPropertiesFormat - } - if cip.Zones != nil { - objectMap["zones"] = cip.Zones - } - if cip.ID != nil { - objectMap["id"] = cip.ID - } - if cip.Location != nil { - objectMap["location"] = cip.Location - } - if cip.Tags != nil { - objectMap["tags"] = cip.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CustomIPPrefix struct. -func (cip *CustomIPPrefix) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "extendedLocation": - if v != nil { - var extendedLocation ExtendedLocation - err = json.Unmarshal(*v, &extendedLocation) - if err != nil { - return err - } - cip.ExtendedLocation = &extendedLocation - } - case "properties": - if v != nil { - var customIPPrefixPropertiesFormat CustomIPPrefixPropertiesFormat - err = json.Unmarshal(*v, &customIPPrefixPropertiesFormat) - if err != nil { - return err - } - cip.CustomIPPrefixPropertiesFormat = &customIPPrefixPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - cip.Etag = &etag - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - cip.Zones = &zones - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cip.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cip.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cip.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - cip.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cip.Tags = tags - } - } - } - - return nil -} - -// CustomIPPrefixListResult response for ListCustomIpPrefixes API service call. -type CustomIPPrefixListResult struct { - autorest.Response `json:"-"` - // Value - A list of Custom IP prefixes that exists in a resource group. - Value *[]CustomIPPrefix `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// CustomIPPrefixListResultIterator provides access to a complete listing of CustomIPPrefix values. -type CustomIPPrefixListResultIterator struct { - i int - page CustomIPPrefixListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *CustomIPPrefixListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomIPPrefixListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *CustomIPPrefixListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CustomIPPrefixListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter CustomIPPrefixListResultIterator) Response() CustomIPPrefixListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter CustomIPPrefixListResultIterator) Value() CustomIPPrefix { - if !iter.page.NotDone() { - return CustomIPPrefix{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CustomIPPrefixListResultIterator type. -func NewCustomIPPrefixListResultIterator(page CustomIPPrefixListResultPage) CustomIPPrefixListResultIterator { - return CustomIPPrefixListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ciplr CustomIPPrefixListResult) IsEmpty() bool { - return ciplr.Value == nil || len(*ciplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ciplr CustomIPPrefixListResult) hasNextLink() bool { - return ciplr.NextLink != nil && len(*ciplr.NextLink) != 0 -} - -// customIPPrefixListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ciplr CustomIPPrefixListResult) customIPPrefixListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ciplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ciplr.NextLink))) -} - -// CustomIPPrefixListResultPage contains a page of CustomIPPrefix values. -type CustomIPPrefixListResultPage struct { - fn func(context.Context, CustomIPPrefixListResult) (CustomIPPrefixListResult, error) - ciplr CustomIPPrefixListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *CustomIPPrefixListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomIPPrefixListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ciplr) - if err != nil { - return err - } - page.ciplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *CustomIPPrefixListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CustomIPPrefixListResultPage) NotDone() bool { - return !page.ciplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CustomIPPrefixListResultPage) Response() CustomIPPrefixListResult { - return page.ciplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CustomIPPrefixListResultPage) Values() []CustomIPPrefix { - if page.ciplr.IsEmpty() { - return nil - } - return *page.ciplr.Value -} - -// Creates a new instance of the CustomIPPrefixListResultPage type. -func NewCustomIPPrefixListResultPage(cur CustomIPPrefixListResult, getNextPage func(context.Context, CustomIPPrefixListResult) (CustomIPPrefixListResult, error)) CustomIPPrefixListResultPage { - return CustomIPPrefixListResultPage{ - fn: getNextPage, - ciplr: cur, - } -} - -// CustomIPPrefixPropertiesFormat custom IP prefix properties. -type CustomIPPrefixPropertiesFormat struct { - // Asn - The ASN for CIDR advertising. Should be an integer as string. - Asn *string `json:"asn,omitempty"` - // Cidr - The prefix range in CIDR notation. Should include the start address and the prefix length. - Cidr *string `json:"cidr,omitempty"` - // SignedMessage - Signed message for WAN validation. - SignedMessage *string `json:"signedMessage,omitempty"` - // AuthorizationMessage - Authorization message for WAN validation. - AuthorizationMessage *string `json:"authorizationMessage,omitempty"` - // CustomIPPrefixParent - The Parent CustomIpPrefix for IPv6 /64 CustomIpPrefix. - CustomIPPrefixParent *SubResource `json:"customIpPrefixParent,omitempty"` - // ChildCustomIPPrefixes - READ-ONLY; The list of all Children for IPv6 /48 CustomIpPrefix. - ChildCustomIPPrefixes *[]SubResource `json:"childCustomIpPrefixes,omitempty"` - // CommissionedState - The commissioned state of the Custom IP Prefix. Possible values include: 'CommissionedStateProvisioning', 'CommissionedStateProvisioned', 'CommissionedStateCommissioning', 'CommissionedStateCommissionedNoInternetAdvertise', 'CommissionedStateCommissioned', 'CommissionedStateDecommissioning', 'CommissionedStateDeprovisioning', 'CommissionedStateDeprovisioned' - CommissionedState CommissionedState `json:"commissionedState,omitempty"` - // ExpressRouteAdvertise - Whether to do express route advertise. - ExpressRouteAdvertise *bool `json:"expressRouteAdvertise,omitempty"` - // Geo - The Geo for CIDR advertising. Should be an Geo code. Possible values include: 'GeoGLOBAL', 'GeoAFRI', 'GeoAPAC', 'GeoEURO', 'GeoLATAM', 'GeoNAM', 'GeoME', 'GeoOCEANIA', 'GeoAQ' - Geo Geo `json:"geo,omitempty"` - // NoInternetAdvertise - Whether to Advertise the range to Internet. - NoInternetAdvertise *bool `json:"noInternetAdvertise,omitempty"` - // PrefixType - Type of custom IP prefix. Should be Singular, Parent, or Child. Possible values include: 'CustomIPPrefixTypeSingular', 'CustomIPPrefixTypeParent', 'CustomIPPrefixTypeChild' - PrefixType CustomIPPrefixType `json:"prefixType,omitempty"` - // PublicIPPrefixes - READ-ONLY; The list of all referenced PublicIpPrefixes. - PublicIPPrefixes *[]SubResource `json:"publicIpPrefixes,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the custom IP prefix resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // FailedReason - READ-ONLY; The reason why resource is in failed state. - FailedReason *string `json:"failedReason,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the custom IP prefix resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for CustomIPPrefixPropertiesFormat. -func (cippf CustomIPPrefixPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cippf.Asn != nil { - objectMap["asn"] = cippf.Asn - } - if cippf.Cidr != nil { - objectMap["cidr"] = cippf.Cidr - } - if cippf.SignedMessage != nil { - objectMap["signedMessage"] = cippf.SignedMessage - } - if cippf.AuthorizationMessage != nil { - objectMap["authorizationMessage"] = cippf.AuthorizationMessage - } - if cippf.CustomIPPrefixParent != nil { - objectMap["customIpPrefixParent"] = cippf.CustomIPPrefixParent - } - if cippf.CommissionedState != "" { - objectMap["commissionedState"] = cippf.CommissionedState - } - if cippf.ExpressRouteAdvertise != nil { - objectMap["expressRouteAdvertise"] = cippf.ExpressRouteAdvertise - } - if cippf.Geo != "" { - objectMap["geo"] = cippf.Geo - } - if cippf.NoInternetAdvertise != nil { - objectMap["noInternetAdvertise"] = cippf.NoInternetAdvertise - } - if cippf.PrefixType != "" { - objectMap["prefixType"] = cippf.PrefixType - } - return json.Marshal(objectMap) -} - -// CustomIPPrefixesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type CustomIPPrefixesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CustomIPPrefixesClient) (CustomIPPrefix, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CustomIPPrefixesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CustomIPPrefixesCreateOrUpdateFuture.Result. -func (future *CustomIPPrefixesCreateOrUpdateFuture) result(client CustomIPPrefixesClient) (cip CustomIPPrefix, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cip.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.CustomIPPrefixesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cip.Response.Response, err = future.GetResult(sender); err == nil && cip.Response.Response.StatusCode != http.StatusNoContent { - cip, err = client.CreateOrUpdateResponder(cip.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesCreateOrUpdateFuture", "Result", cip.Response.Response, "Failure responding to request") - } - } - return -} - -// CustomIPPrefixesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type CustomIPPrefixesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CustomIPPrefixesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CustomIPPrefixesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CustomIPPrefixesDeleteFuture.Result. -func (future *CustomIPPrefixesDeleteFuture) result(client CustomIPPrefixesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.CustomIPPrefixesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DNSNameAvailabilityResult response for the CheckDnsNameAvailability API service call. -type DNSNameAvailabilityResult struct { - autorest.Response `json:"-"` - // Available - Domain availability (True/False). - Available *bool `json:"available,omitempty"` -} - -// DNSSettings DNS Proxy Settings in Firewall Policy. -type DNSSettings struct { - // Servers - List of Custom DNS Servers. - Servers *[]string `json:"servers,omitempty"` - // EnableProxy - Enable DNS Proxy on Firewalls attached to the Firewall Policy. - EnableProxy *bool `json:"enableProxy,omitempty"` - // RequireProxyForNetworkRules - FQDNs in Network Rules are supported when set to true. - RequireProxyForNetworkRules *bool `json:"requireProxyForNetworkRules,omitempty"` -} - -// DdosCustomPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DdosCustomPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DdosCustomPoliciesClient) (DdosCustomPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DdosCustomPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DdosCustomPoliciesCreateOrUpdateFuture.Result. -func (future *DdosCustomPoliciesCreateOrUpdateFuture) result(client DdosCustomPoliciesClient) (dcp DdosCustomPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dcp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.DdosCustomPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dcp.Response.Response, err = future.GetResult(sender); err == nil && dcp.Response.Response.StatusCode != http.StatusNoContent { - dcp, err = client.CreateOrUpdateResponder(dcp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesCreateOrUpdateFuture", "Result", dcp.Response.Response, "Failure responding to request") - } - } - return -} - -// DdosCustomPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DdosCustomPoliciesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DdosCustomPoliciesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DdosCustomPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DdosCustomPoliciesDeleteFuture.Result. -func (future *DdosCustomPoliciesDeleteFuture) result(client DdosCustomPoliciesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.DdosCustomPoliciesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DdosCustomPolicy a DDoS custom policy in a resource group. -type DdosCustomPolicy struct { - autorest.Response `json:"-"` - // DdosCustomPolicyPropertiesFormat - Properties of the DDoS custom policy. - *DdosCustomPolicyPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DdosCustomPolicy. -func (dcp DdosCustomPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcp.DdosCustomPolicyPropertiesFormat != nil { - objectMap["properties"] = dcp.DdosCustomPolicyPropertiesFormat - } - if dcp.ID != nil { - objectMap["id"] = dcp.ID - } - if dcp.Location != nil { - objectMap["location"] = dcp.Location - } - if dcp.Tags != nil { - objectMap["tags"] = dcp.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DdosCustomPolicy struct. -func (dcp *DdosCustomPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var ddosCustomPolicyPropertiesFormat DdosCustomPolicyPropertiesFormat - err = json.Unmarshal(*v, &ddosCustomPolicyPropertiesFormat) - if err != nil { - return err - } - dcp.DdosCustomPolicyPropertiesFormat = &ddosCustomPolicyPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dcp.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dcp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dcp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dcp.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dcp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dcp.Tags = tags - } - } - } - - return nil -} - -// DdosCustomPolicyPropertiesFormat dDoS custom policy properties. -type DdosCustomPolicyPropertiesFormat struct { - // ResourceGUID - READ-ONLY; 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. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the DDoS custom policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DdosCustomPolicyPropertiesFormat. -func (dcppf DdosCustomPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DdosProtectionPlan a DDoS protection plan in a resource group. -type DdosProtectionPlan struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // DdosProtectionPlanPropertiesFormat - Properties of the DDoS protection plan. - *DdosProtectionPlanPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for DdosProtectionPlan. -func (dpp DdosProtectionPlan) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dpp.Location != nil { - objectMap["location"] = dpp.Location - } - if dpp.Tags != nil { - objectMap["tags"] = dpp.Tags - } - if dpp.DdosProtectionPlanPropertiesFormat != nil { - objectMap["properties"] = dpp.DdosProtectionPlanPropertiesFormat - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DdosProtectionPlan struct. -func (dpp *DdosProtectionPlan) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dpp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dpp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dpp.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dpp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dpp.Tags = tags - } - case "properties": - if v != nil { - var ddosProtectionPlanPropertiesFormat DdosProtectionPlanPropertiesFormat - err = json.Unmarshal(*v, &ddosProtectionPlanPropertiesFormat) - if err != nil { - return err - } - dpp.DdosProtectionPlanPropertiesFormat = &ddosProtectionPlanPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dpp.Etag = &etag - } - } - } - - return nil -} - -// DdosProtectionPlanListResult a list of DDoS protection plans. -type DdosProtectionPlanListResult struct { - autorest.Response `json:"-"` - // Value - A list of DDoS protection plans. - Value *[]DdosProtectionPlan `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DdosProtectionPlanListResult. -func (dpplr DdosProtectionPlanListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dpplr.Value != nil { - objectMap["value"] = dpplr.Value - } - return json.Marshal(objectMap) -} - -// DdosProtectionPlanListResultIterator provides access to a complete listing of DdosProtectionPlan values. -type DdosProtectionPlanListResultIterator struct { - i int - page DdosProtectionPlanListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DdosProtectionPlanListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DdosProtectionPlanListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DdosProtectionPlanListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DdosProtectionPlanListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DdosProtectionPlanListResultIterator) Response() DdosProtectionPlanListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DdosProtectionPlanListResultIterator) Value() DdosProtectionPlan { - if !iter.page.NotDone() { - return DdosProtectionPlan{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DdosProtectionPlanListResultIterator type. -func NewDdosProtectionPlanListResultIterator(page DdosProtectionPlanListResultPage) DdosProtectionPlanListResultIterator { - return DdosProtectionPlanListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dpplr DdosProtectionPlanListResult) IsEmpty() bool { - return dpplr.Value == nil || len(*dpplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dpplr DdosProtectionPlanListResult) hasNextLink() bool { - return dpplr.NextLink != nil && len(*dpplr.NextLink) != 0 -} - -// ddosProtectionPlanListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dpplr DdosProtectionPlanListResult) ddosProtectionPlanListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dpplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dpplr.NextLink))) -} - -// DdosProtectionPlanListResultPage contains a page of DdosProtectionPlan values. -type DdosProtectionPlanListResultPage struct { - fn func(context.Context, DdosProtectionPlanListResult) (DdosProtectionPlanListResult, error) - dpplr DdosProtectionPlanListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DdosProtectionPlanListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DdosProtectionPlanListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dpplr) - if err != nil { - return err - } - page.dpplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DdosProtectionPlanListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DdosProtectionPlanListResultPage) NotDone() bool { - return !page.dpplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DdosProtectionPlanListResultPage) Response() DdosProtectionPlanListResult { - return page.dpplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DdosProtectionPlanListResultPage) Values() []DdosProtectionPlan { - if page.dpplr.IsEmpty() { - return nil - } - return *page.dpplr.Value -} - -// Creates a new instance of the DdosProtectionPlanListResultPage type. -func NewDdosProtectionPlanListResultPage(cur DdosProtectionPlanListResult, getNextPage func(context.Context, DdosProtectionPlanListResult) (DdosProtectionPlanListResult, error)) DdosProtectionPlanListResultPage { - return DdosProtectionPlanListResultPage{ - fn: getNextPage, - dpplr: cur, - } -} - -// DdosProtectionPlanPropertiesFormat dDoS protection plan properties. -type DdosProtectionPlanPropertiesFormat struct { - // ResourceGUID - READ-ONLY; 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. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the DDoS protection plan resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // PublicIPAddresses - READ-ONLY; The list of public IPs associated with the DDoS protection plan resource. This list is read-only. - PublicIPAddresses *[]SubResource `json:"publicIpAddresses,omitempty"` - // VirtualNetworks - READ-ONLY; The list of virtual networks associated with the DDoS protection plan resource. This list is read-only. - VirtualNetworks *[]SubResource `json:"virtualNetworks,omitempty"` -} - -// MarshalJSON is the custom marshaler for DdosProtectionPlanPropertiesFormat. -func (dpppf DdosProtectionPlanPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DdosProtectionPlansCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DdosProtectionPlansCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DdosProtectionPlansClient) (DdosProtectionPlan, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DdosProtectionPlansCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DdosProtectionPlansCreateOrUpdateFuture.Result. -func (future *DdosProtectionPlansCreateOrUpdateFuture) result(client DdosProtectionPlansClient) (dpp DdosProtectionPlan, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dpp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.DdosProtectionPlansCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dpp.Response.Response, err = future.GetResult(sender); err == nil && dpp.Response.Response.StatusCode != http.StatusNoContent { - dpp, err = client.CreateOrUpdateResponder(dpp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansCreateOrUpdateFuture", "Result", dpp.Response.Response, "Failure responding to request") - } - } - return -} - -// DdosProtectionPlansDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DdosProtectionPlansDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DdosProtectionPlansClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DdosProtectionPlansDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DdosProtectionPlansDeleteFuture.Result. -func (future *DdosProtectionPlansDeleteFuture) result(client DdosProtectionPlansClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.DdosProtectionPlansDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DdosSettings contains the DDoS protection settings of the public IP. -type DdosSettings struct { - // ProtectionMode - The DDoS protection mode of the public IP. Possible values include: 'DdosSettingsProtectionModeVirtualNetworkInherited', 'DdosSettingsProtectionModeEnabled', 'DdosSettingsProtectionModeDisabled' - ProtectionMode DdosSettingsProtectionMode `json:"protectionMode,omitempty"` - // DdosProtectionPlan - The DDoS protection plan associated with the public IP. Can only be set if ProtectionMode is Enabled - DdosProtectionPlan *SubResource `json:"ddosProtectionPlan,omitempty"` -} - -// DefaultAdminPropertiesFormat security default admin rule resource. -type DefaultAdminPropertiesFormat struct { - // Description - READ-ONLY; A description for this rule. Restricted to 140 chars. - Description *string `json:"description,omitempty"` - // Flag - Default rule flag. - Flag *string `json:"flag,omitempty"` - // Protocol - READ-ONLY; Network protocol this rule applies to. Possible values include: 'SecurityConfigurationRuleProtocolTCP', 'SecurityConfigurationRuleProtocolUDP', 'SecurityConfigurationRuleProtocolIcmp', 'SecurityConfigurationRuleProtocolEsp', 'SecurityConfigurationRuleProtocolAny', 'SecurityConfigurationRuleProtocolAh' - Protocol SecurityConfigurationRuleProtocol `json:"protocol,omitempty"` - // Sources - READ-ONLY; The CIDR or source IP ranges. - Sources *[]AddressPrefixItem `json:"sources,omitempty"` - // Destinations - READ-ONLY; The destination address prefixes. CIDR or destination IP ranges. - Destinations *[]AddressPrefixItem `json:"destinations,omitempty"` - // SourcePortRanges - READ-ONLY; The source port ranges. - SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` - // DestinationPortRanges - READ-ONLY; The destination port ranges. - DestinationPortRanges *[]string `json:"destinationPortRanges,omitempty"` - // Access - READ-ONLY; Indicates the access allowed for this particular rule. Possible values include: 'SecurityConfigurationRuleAccessAllow', 'SecurityConfigurationRuleAccessDeny', 'SecurityConfigurationRuleAccessAlwaysAllow' - Access SecurityConfigurationRuleAccess `json:"access,omitempty"` - // Priority - READ-ONLY; The priority of the rule. The value can be between 1 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. - Priority *int32 `json:"priority,omitempty"` - // Direction - READ-ONLY; Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: 'SecurityConfigurationRuleDirectionInbound', 'SecurityConfigurationRuleDirectionOutbound' - Direction SecurityConfigurationRuleDirection `json:"direction,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DefaultAdminPropertiesFormat. -func (dapf DefaultAdminPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dapf.Flag != nil { - objectMap["flag"] = dapf.Flag - } - return json.Marshal(objectMap) -} - -// DefaultAdminRule network default admin rule. -type DefaultAdminRule struct { - // DefaultAdminPropertiesFormat - Indicates the properties of the security admin rule - *DefaultAdminPropertiesFormat `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata related to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // Kind - Possible values include: 'KindBasicBaseAdminRuleKindBaseAdminRule', 'KindBasicBaseAdminRuleKindCustom', 'KindBasicBaseAdminRuleKindDefault' - Kind KindBasicBaseAdminRule `json:"kind,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for DefaultAdminRule. -func (dar DefaultAdminRule) MarshalJSON() ([]byte, error) { - dar.Kind = KindBasicBaseAdminRuleKindDefault - objectMap := make(map[string]interface{}) - if dar.DefaultAdminPropertiesFormat != nil { - objectMap["properties"] = dar.DefaultAdminPropertiesFormat - } - if dar.Kind != "" { - objectMap["kind"] = dar.Kind - } - return json.Marshal(objectMap) -} - -// AsAdminRule is the BasicBaseAdminRule implementation for DefaultAdminRule. -func (dar DefaultAdminRule) AsAdminRule() (*AdminRule, bool) { - return nil, false -} - -// AsDefaultAdminRule is the BasicBaseAdminRule implementation for DefaultAdminRule. -func (dar DefaultAdminRule) AsDefaultAdminRule() (*DefaultAdminRule, bool) { - return &dar, true -} - -// AsBaseAdminRule is the BasicBaseAdminRule implementation for DefaultAdminRule. -func (dar DefaultAdminRule) AsBaseAdminRule() (*BaseAdminRule, bool) { - return nil, false -} - -// AsBasicBaseAdminRule is the BasicBaseAdminRule implementation for DefaultAdminRule. -func (dar DefaultAdminRule) AsBasicBaseAdminRule() (BasicBaseAdminRule, bool) { - return &dar, true -} - -// UnmarshalJSON is the custom unmarshaler for DefaultAdminRule struct. -func (dar *DefaultAdminRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var defaultAdminPropertiesFormat DefaultAdminPropertiesFormat - err = json.Unmarshal(*v, &defaultAdminPropertiesFormat) - if err != nil { - return err - } - dar.DefaultAdminPropertiesFormat = &defaultAdminPropertiesFormat - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - dar.SystemData = &systemData - } - case "kind": - if v != nil { - var kind KindBasicBaseAdminRule - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - dar.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dar.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dar.Etag = &etag - } - } - } - - return nil -} - -// DefaultRuleSetPropertyFormat the default web application firewall rule set. -type DefaultRuleSetPropertyFormat struct { - // RuleSetType - The type of the web application firewall rule set. - RuleSetType *string `json:"ruleSetType,omitempty"` - // RuleSetVersion - The version of the web application firewall rule set type. - RuleSetVersion *string `json:"ruleSetVersion,omitempty"` -} - -// Delegation details the service to which the subnet is delegated. -type Delegation struct { - // ServiceDelegationPropertiesFormat - Properties of the subnet. - *ServiceDelegationPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a subnet. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for Delegation. -func (d Delegation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.ServiceDelegationPropertiesFormat != nil { - objectMap["properties"] = d.ServiceDelegationPropertiesFormat - } - if d.Name != nil { - objectMap["name"] = d.Name - } - if d.Type != nil { - objectMap["type"] = d.Type - } - if d.ID != nil { - objectMap["id"] = d.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Delegation struct. -func (d *Delegation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var serviceDelegationPropertiesFormat ServiceDelegationPropertiesFormat - err = json.Unmarshal(*v, &serviceDelegationPropertiesFormat) - if err != nil { - return err - } - d.ServiceDelegationPropertiesFormat = &serviceDelegationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - d.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - } - } - - return nil -} - -// DeleteBastionShareableLinkFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DeleteBastionShareableLinkFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BaseClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeleteBastionShareableLinkFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeleteBastionShareableLinkFuture.Result. -func (future *DeleteBastionShareableLinkFuture) result(client BaseClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.DeleteBastionShareableLinkFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.DeleteBastionShareableLinkFuture") - return - } - ar.Response = future.Response() - return -} - -// DeviceProperties list of properties of the device. -type DeviceProperties struct { - // DeviceVendor - Name of the device Vendor. - DeviceVendor *string `json:"deviceVendor,omitempty"` - // DeviceModel - Model of the device. - DeviceModel *string `json:"deviceModel,omitempty"` - // LinkSpeedInMbps - Link speed. - LinkSpeedInMbps *int32 `json:"linkSpeedInMbps,omitempty"` -} - -// DhcpOptions 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. -type DhcpOptions struct { - // DNSServers - The list of DNS servers IP addresses. - DNSServers *[]string `json:"dnsServers,omitempty"` -} - -// Dimension dimension of the metric. -type Dimension struct { - // Name - The name of the dimension. - Name *string `json:"name,omitempty"` - // DisplayName - The display name of the dimension. - DisplayName *string `json:"displayName,omitempty"` - // InternalName - The internal name of the dimension. - InternalName *string `json:"internalName,omitempty"` -} - -// DscpConfiguration differentiated Services Code Point configuration for any given network interface -type DscpConfiguration struct { - autorest.Response `json:"-"` - // DscpConfigurationPropertiesFormat - Properties of the network interface. - *DscpConfigurationPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DscpConfiguration. -func (dc DscpConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dc.DscpConfigurationPropertiesFormat != nil { - objectMap["properties"] = dc.DscpConfigurationPropertiesFormat - } - if dc.ID != nil { - objectMap["id"] = dc.ID - } - if dc.Location != nil { - objectMap["location"] = dc.Location - } - if dc.Tags != nil { - objectMap["tags"] = dc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DscpConfiguration struct. -func (dc *DscpConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var dscpConfigurationPropertiesFormat DscpConfigurationPropertiesFormat - err = json.Unmarshal(*v, &dscpConfigurationPropertiesFormat) - if err != nil { - return err - } - dc.DscpConfigurationPropertiesFormat = &dscpConfigurationPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - dc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dc.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dc.Tags = tags - } - } - } - - return nil -} - -// DscpConfigurationCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DscpConfigurationCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DscpConfigurationClient) (DscpConfiguration, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DscpConfigurationCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DscpConfigurationCreateOrUpdateFuture.Result. -func (future *DscpConfigurationCreateOrUpdateFuture) result(client DscpConfigurationClient) (dc DscpConfiguration, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.DscpConfigurationCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.DscpConfigurationCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dc.Response.Response, err = future.GetResult(sender); err == nil && dc.Response.Response.StatusCode != http.StatusNoContent { - dc, err = client.CreateOrUpdateResponder(dc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.DscpConfigurationCreateOrUpdateFuture", "Result", dc.Response.Response, "Failure responding to request") - } - } - return -} - -// DscpConfigurationDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DscpConfigurationDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DscpConfigurationClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DscpConfigurationDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DscpConfigurationDeleteFuture.Result. -func (future *DscpConfigurationDeleteFuture) result(client DscpConfigurationClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.DscpConfigurationDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.DscpConfigurationDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DscpConfigurationListResult response for the DscpConfigurationList API service call. -type DscpConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - A list of dscp configurations in a resource group. - Value *[]DscpConfiguration `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DscpConfigurationListResult. -func (dclr DscpConfigurationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dclr.Value != nil { - objectMap["value"] = dclr.Value - } - return json.Marshal(objectMap) -} - -// DscpConfigurationListResultIterator provides access to a complete listing of DscpConfiguration values. -type DscpConfigurationListResultIterator struct { - i int - page DscpConfigurationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DscpConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscpConfigurationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DscpConfigurationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DscpConfigurationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DscpConfigurationListResultIterator) Response() DscpConfigurationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DscpConfigurationListResultIterator) Value() DscpConfiguration { - if !iter.page.NotDone() { - return DscpConfiguration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DscpConfigurationListResultIterator type. -func NewDscpConfigurationListResultIterator(page DscpConfigurationListResultPage) DscpConfigurationListResultIterator { - return DscpConfigurationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dclr DscpConfigurationListResult) IsEmpty() bool { - return dclr.Value == nil || len(*dclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dclr DscpConfigurationListResult) hasNextLink() bool { - return dclr.NextLink != nil && len(*dclr.NextLink) != 0 -} - -// dscpConfigurationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dclr DscpConfigurationListResult) dscpConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dclr.NextLink))) -} - -// DscpConfigurationListResultPage contains a page of DscpConfiguration values. -type DscpConfigurationListResultPage struct { - fn func(context.Context, DscpConfigurationListResult) (DscpConfigurationListResult, error) - dclr DscpConfigurationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DscpConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DscpConfigurationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dclr) - if err != nil { - return err - } - page.dclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DscpConfigurationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DscpConfigurationListResultPage) NotDone() bool { - return !page.dclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DscpConfigurationListResultPage) Response() DscpConfigurationListResult { - return page.dclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DscpConfigurationListResultPage) Values() []DscpConfiguration { - if page.dclr.IsEmpty() { - return nil - } - return *page.dclr.Value -} - -// Creates a new instance of the DscpConfigurationListResultPage type. -func NewDscpConfigurationListResultPage(cur DscpConfigurationListResult, getNextPage func(context.Context, DscpConfigurationListResult) (DscpConfigurationListResult, error)) DscpConfigurationListResultPage { - return DscpConfigurationListResultPage{ - fn: getNextPage, - dclr: cur, - } -} - -// DscpConfigurationPropertiesFormat differentiated Services Code Point configuration properties. -type DscpConfigurationPropertiesFormat struct { - // Markings - List of markings to be used in the configuration. - Markings *[]int32 `json:"markings,omitempty"` - // SourceIPRanges - Source IP ranges. - SourceIPRanges *[]QosIPRange `json:"sourceIpRanges,omitempty"` - // DestinationIPRanges - Destination IP ranges. - DestinationIPRanges *[]QosIPRange `json:"destinationIpRanges,omitempty"` - // SourcePortRanges - Sources port ranges. - SourcePortRanges *[]QosPortRange `json:"sourcePortRanges,omitempty"` - // DestinationPortRanges - Destination port ranges. - DestinationPortRanges *[]QosPortRange `json:"destinationPortRanges,omitempty"` - // Protocol - RNM supported protocol types. Possible values include: 'ProtocolTypeDoNotUse', 'ProtocolTypeIcmp', 'ProtocolTypeTCP', 'ProtocolTypeUDP', 'ProtocolTypeGre', 'ProtocolTypeEsp', 'ProtocolTypeAh', 'ProtocolTypeVxlan', 'ProtocolTypeAll' - Protocol ProtocolType `json:"protocol,omitempty"` - // QosDefinitionCollection - QoS object definitions - QosDefinitionCollection *[]QosDefinition `json:"qosDefinitionCollection,omitempty"` - // QosCollectionID - READ-ONLY; Qos Collection ID generated by RNM. - QosCollectionID *string `json:"qosCollectionId,omitempty"` - // AssociatedNetworkInterfaces - READ-ONLY; Associated Network Interfaces to the DSCP Configuration. - AssociatedNetworkInterfaces *[]Interface `json:"associatedNetworkInterfaces,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the DSCP Configuration resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the DSCP Configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DscpConfigurationPropertiesFormat. -func (dcpf DscpConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dcpf.Markings != nil { - objectMap["markings"] = dcpf.Markings - } - if dcpf.SourceIPRanges != nil { - objectMap["sourceIpRanges"] = dcpf.SourceIPRanges - } - if dcpf.DestinationIPRanges != nil { - objectMap["destinationIpRanges"] = dcpf.DestinationIPRanges - } - if dcpf.SourcePortRanges != nil { - objectMap["sourcePortRanges"] = dcpf.SourcePortRanges - } - if dcpf.DestinationPortRanges != nil { - objectMap["destinationPortRanges"] = dcpf.DestinationPortRanges - } - if dcpf.Protocol != "" { - objectMap["protocol"] = dcpf.Protocol - } - if dcpf.QosDefinitionCollection != nil { - objectMap["qosDefinitionCollection"] = dcpf.QosDefinitionCollection - } - return json.Marshal(objectMap) -} - -// BasicEffectiveBaseSecurityAdminRule network base admin rule. -type BasicEffectiveBaseSecurityAdminRule interface { - AsEffectiveSecurityAdminRule() (*EffectiveSecurityAdminRule, bool) - AsEffectiveDefaultSecurityAdminRule() (*EffectiveDefaultSecurityAdminRule, bool) - AsEffectiveBaseSecurityAdminRule() (*EffectiveBaseSecurityAdminRule, bool) -} - -// EffectiveBaseSecurityAdminRule network base admin rule. -type EffectiveBaseSecurityAdminRule struct { - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // ConfigurationDescription - A description of the security admin configuration. - ConfigurationDescription *string `json:"configurationDescription,omitempty"` - // RuleCollectionDescription - A description of the rule collection. - RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` - // RuleCollectionAppliesToGroups - Groups for rule collection - RuleCollectionAppliesToGroups *[]ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` - // RuleGroups - Effective configuration groups. - RuleGroups *[]ConfigurationGroup `json:"ruleGroups,omitempty"` - // Kind - Possible values include: 'KindBasicEffectiveBaseSecurityAdminRuleKindEffectiveBaseSecurityAdminRule', 'KindBasicEffectiveBaseSecurityAdminRuleKindCustom', 'KindBasicEffectiveBaseSecurityAdminRuleKindDefault' - Kind KindBasicEffectiveBaseSecurityAdminRule `json:"kind,omitempty"` -} - -func unmarshalBasicEffectiveBaseSecurityAdminRule(body []byte) (BasicEffectiveBaseSecurityAdminRule, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["kind"] { - case string(KindBasicEffectiveBaseSecurityAdminRuleKindCustom): - var esar EffectiveSecurityAdminRule - err := json.Unmarshal(body, &esar) - return esar, err - case string(KindBasicEffectiveBaseSecurityAdminRuleKindDefault): - var edsar EffectiveDefaultSecurityAdminRule - err := json.Unmarshal(body, &edsar) - return edsar, err - default: - var ebsar EffectiveBaseSecurityAdminRule - err := json.Unmarshal(body, &ebsar) - return ebsar, err - } -} -func unmarshalBasicEffectiveBaseSecurityAdminRuleArray(body []byte) ([]BasicEffectiveBaseSecurityAdminRule, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - ebsarArray := make([]BasicEffectiveBaseSecurityAdminRule, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ebsar, err := unmarshalBasicEffectiveBaseSecurityAdminRule(*rawMessage) - if err != nil { - return nil, err - } - ebsarArray[index] = ebsar - } - return ebsarArray, nil -} - -// MarshalJSON is the custom marshaler for EffectiveBaseSecurityAdminRule. -func (ebsar EffectiveBaseSecurityAdminRule) MarshalJSON() ([]byte, error) { - ebsar.Kind = KindBasicEffectiveBaseSecurityAdminRuleKindEffectiveBaseSecurityAdminRule - objectMap := make(map[string]interface{}) - if ebsar.ID != nil { - objectMap["id"] = ebsar.ID - } - if ebsar.ConfigurationDescription != nil { - objectMap["configurationDescription"] = ebsar.ConfigurationDescription - } - if ebsar.RuleCollectionDescription != nil { - objectMap["ruleCollectionDescription"] = ebsar.RuleCollectionDescription - } - if ebsar.RuleCollectionAppliesToGroups != nil { - objectMap["ruleCollectionAppliesToGroups"] = ebsar.RuleCollectionAppliesToGroups - } - if ebsar.RuleGroups != nil { - objectMap["ruleGroups"] = ebsar.RuleGroups - } - if ebsar.Kind != "" { - objectMap["kind"] = ebsar.Kind - } - return json.Marshal(objectMap) -} - -// AsEffectiveSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveBaseSecurityAdminRule. -func (ebsar EffectiveBaseSecurityAdminRule) AsEffectiveSecurityAdminRule() (*EffectiveSecurityAdminRule, bool) { - return nil, false -} - -// AsEffectiveDefaultSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveBaseSecurityAdminRule. -func (ebsar EffectiveBaseSecurityAdminRule) AsEffectiveDefaultSecurityAdminRule() (*EffectiveDefaultSecurityAdminRule, bool) { - return nil, false -} - -// AsEffectiveBaseSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveBaseSecurityAdminRule. -func (ebsar EffectiveBaseSecurityAdminRule) AsEffectiveBaseSecurityAdminRule() (*EffectiveBaseSecurityAdminRule, bool) { - return &ebsar, true -} - -// AsBasicEffectiveBaseSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveBaseSecurityAdminRule. -func (ebsar EffectiveBaseSecurityAdminRule) AsBasicEffectiveBaseSecurityAdminRule() (BasicEffectiveBaseSecurityAdminRule, bool) { - return &ebsar, true -} - -// EffectiveConnectivityConfiguration the network manager effective connectivity configuration -type EffectiveConnectivityConfiguration struct { - // ID - Connectivity configuration ID. - ID *string `json:"id,omitempty"` - // ConnectivityConfigurationProperties - Properties of a network manager connectivity configuration - *ConnectivityConfigurationProperties `json:"properties,omitempty"` - // ConfigurationGroups - Effective configuration groups. - ConfigurationGroups *[]ConfigurationGroup `json:"configurationGroups,omitempty"` -} - -// MarshalJSON is the custom marshaler for EffectiveConnectivityConfiguration. -func (ecc EffectiveConnectivityConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ecc.ID != nil { - objectMap["id"] = ecc.ID - } - if ecc.ConnectivityConfigurationProperties != nil { - objectMap["properties"] = ecc.ConnectivityConfigurationProperties - } - if ecc.ConfigurationGroups != nil { - objectMap["configurationGroups"] = ecc.ConfigurationGroups - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EffectiveConnectivityConfiguration struct. -func (ecc *EffectiveConnectivityConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ecc.ID = &ID - } - case "properties": - if v != nil { - var connectivityConfigurationProperties ConnectivityConfigurationProperties - err = json.Unmarshal(*v, &connectivityConfigurationProperties) - if err != nil { - return err - } - ecc.ConnectivityConfigurationProperties = &connectivityConfigurationProperties - } - case "configurationGroups": - if v != nil { - var configurationGroups []ConfigurationGroup - err = json.Unmarshal(*v, &configurationGroups) - if err != nil { - return err - } - ecc.ConfigurationGroups = &configurationGroups - } - } - } - - return nil -} - -// EffectiveDefaultSecurityAdminRule network default admin rule. -type EffectiveDefaultSecurityAdminRule struct { - // DefaultAdminPropertiesFormat - Indicates the properties of the default security admin rule - *DefaultAdminPropertiesFormat `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // ConfigurationDescription - A description of the security admin configuration. - ConfigurationDescription *string `json:"configurationDescription,omitempty"` - // RuleCollectionDescription - A description of the rule collection. - RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` - // RuleCollectionAppliesToGroups - Groups for rule collection - RuleCollectionAppliesToGroups *[]ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` - // RuleGroups - Effective configuration groups. - RuleGroups *[]ConfigurationGroup `json:"ruleGroups,omitempty"` - // Kind - Possible values include: 'KindBasicEffectiveBaseSecurityAdminRuleKindEffectiveBaseSecurityAdminRule', 'KindBasicEffectiveBaseSecurityAdminRuleKindCustom', 'KindBasicEffectiveBaseSecurityAdminRuleKindDefault' - Kind KindBasicEffectiveBaseSecurityAdminRule `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for EffectiveDefaultSecurityAdminRule. -func (edsar EffectiveDefaultSecurityAdminRule) MarshalJSON() ([]byte, error) { - edsar.Kind = KindBasicEffectiveBaseSecurityAdminRuleKindDefault - objectMap := make(map[string]interface{}) - if edsar.DefaultAdminPropertiesFormat != nil { - objectMap["properties"] = edsar.DefaultAdminPropertiesFormat - } - if edsar.ID != nil { - objectMap["id"] = edsar.ID - } - if edsar.ConfigurationDescription != nil { - objectMap["configurationDescription"] = edsar.ConfigurationDescription - } - if edsar.RuleCollectionDescription != nil { - objectMap["ruleCollectionDescription"] = edsar.RuleCollectionDescription - } - if edsar.RuleCollectionAppliesToGroups != nil { - objectMap["ruleCollectionAppliesToGroups"] = edsar.RuleCollectionAppliesToGroups - } - if edsar.RuleGroups != nil { - objectMap["ruleGroups"] = edsar.RuleGroups - } - if edsar.Kind != "" { - objectMap["kind"] = edsar.Kind - } - return json.Marshal(objectMap) -} - -// AsEffectiveSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveDefaultSecurityAdminRule. -func (edsar EffectiveDefaultSecurityAdminRule) AsEffectiveSecurityAdminRule() (*EffectiveSecurityAdminRule, bool) { - return nil, false -} - -// AsEffectiveDefaultSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveDefaultSecurityAdminRule. -func (edsar EffectiveDefaultSecurityAdminRule) AsEffectiveDefaultSecurityAdminRule() (*EffectiveDefaultSecurityAdminRule, bool) { - return &edsar, true -} - -// AsEffectiveBaseSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveDefaultSecurityAdminRule. -func (edsar EffectiveDefaultSecurityAdminRule) AsEffectiveBaseSecurityAdminRule() (*EffectiveBaseSecurityAdminRule, bool) { - return nil, false -} - -// AsBasicEffectiveBaseSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveDefaultSecurityAdminRule. -func (edsar EffectiveDefaultSecurityAdminRule) AsBasicEffectiveBaseSecurityAdminRule() (BasicEffectiveBaseSecurityAdminRule, bool) { - return &edsar, true -} - -// UnmarshalJSON is the custom unmarshaler for EffectiveDefaultSecurityAdminRule struct. -func (edsar *EffectiveDefaultSecurityAdminRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var defaultAdminPropertiesFormat DefaultAdminPropertiesFormat - err = json.Unmarshal(*v, &defaultAdminPropertiesFormat) - if err != nil { - return err - } - edsar.DefaultAdminPropertiesFormat = &defaultAdminPropertiesFormat - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - edsar.ID = &ID - } - case "configurationDescription": - if v != nil { - var configurationDescription string - err = json.Unmarshal(*v, &configurationDescription) - if err != nil { - return err - } - edsar.ConfigurationDescription = &configurationDescription - } - case "ruleCollectionDescription": - if v != nil { - var ruleCollectionDescription string - err = json.Unmarshal(*v, &ruleCollectionDescription) - if err != nil { - return err - } - edsar.RuleCollectionDescription = &ruleCollectionDescription - } - case "ruleCollectionAppliesToGroups": - if v != nil { - var ruleCollectionAppliesToGroups []ManagerSecurityGroupItem - err = json.Unmarshal(*v, &ruleCollectionAppliesToGroups) - if err != nil { - return err - } - edsar.RuleCollectionAppliesToGroups = &ruleCollectionAppliesToGroups - } - case "ruleGroups": - if v != nil { - var ruleGroups []ConfigurationGroup - err = json.Unmarshal(*v, &ruleGroups) - if err != nil { - return err - } - edsar.RuleGroups = &ruleGroups - } - case "kind": - if v != nil { - var kind KindBasicEffectiveBaseSecurityAdminRule - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - edsar.Kind = kind - } - } - } - - return nil -} - -// EffectiveNetworkSecurityGroup effective network security group. -type EffectiveNetworkSecurityGroup struct { - // NetworkSecurityGroup - The ID of network security group that is applied. - NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` - // Association - Associated resources. - Association *EffectiveNetworkSecurityGroupAssociation `json:"association,omitempty"` - // EffectiveSecurityRules - A collection of effective security rules. - EffectiveSecurityRules *[]EffectiveNetworkSecurityRule `json:"effectiveSecurityRules,omitempty"` - // TagMap - Mapping of tags to list of IP Addresses included within the tag. - TagMap map[string][]string `json:"tagMap"` -} - -// MarshalJSON is the custom marshaler for EffectiveNetworkSecurityGroup. -func (ensg EffectiveNetworkSecurityGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ensg.NetworkSecurityGroup != nil { - objectMap["networkSecurityGroup"] = ensg.NetworkSecurityGroup - } - if ensg.Association != nil { - objectMap["association"] = ensg.Association - } - if ensg.EffectiveSecurityRules != nil { - objectMap["effectiveSecurityRules"] = ensg.EffectiveSecurityRules - } - if ensg.TagMap != nil { - objectMap["tagMap"] = ensg.TagMap - } - return json.Marshal(objectMap) -} - -// EffectiveNetworkSecurityGroupAssociation the effective network security group association. -type EffectiveNetworkSecurityGroupAssociation struct { - // NetworkManager - The ID of the Azure network manager if assigned. - NetworkManager *SubResource `json:"networkManager,omitempty"` - // Subnet - The ID of the subnet if assigned. - Subnet *SubResource `json:"subnet,omitempty"` - // NetworkInterface - The ID of the network interface if assigned. - NetworkInterface *SubResource `json:"networkInterface,omitempty"` -} - -// EffectiveNetworkSecurityGroupListResult response for list effective network security groups API service -// call. -type EffectiveNetworkSecurityGroupListResult struct { - autorest.Response `json:"-"` - // Value - A list of effective network security groups. - Value *[]EffectiveNetworkSecurityGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for EffectiveNetworkSecurityGroupListResult. -func (ensglr EffectiveNetworkSecurityGroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ensglr.Value != nil { - objectMap["value"] = ensglr.Value - } - return json.Marshal(objectMap) -} - -// EffectiveNetworkSecurityRule effective network security rules. -type EffectiveNetworkSecurityRule struct { - // Name - The name of the security rule specified by the user (if created by the user). - Name *string `json:"name,omitempty"` - // Protocol - The network protocol this rule applies to. Possible values include: 'EffectiveSecurityRuleProtocolTCP', 'EffectiveSecurityRuleProtocolUDP', 'EffectiveSecurityRuleProtocolAll' - Protocol EffectiveSecurityRuleProtocol `json:"protocol,omitempty"` - // SourcePortRange - The source port or range. - SourcePortRange *string `json:"sourcePortRange,omitempty"` - // DestinationPortRange - The destination port or range. - DestinationPortRange *string `json:"destinationPortRange,omitempty"` - // SourcePortRanges - 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 (*). - SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` - // DestinationPortRanges - 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 (*). - DestinationPortRanges *[]string `json:"destinationPortRanges,omitempty"` - // SourceAddressPrefix - The source address prefix. - SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` - // DestinationAddressPrefix - The destination address prefix. - DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` - // SourceAddressPrefixes - The source address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System Tags, and the asterisk (*). - SourceAddressPrefixes *[]string `json:"sourceAddressPrefixes,omitempty"` - // DestinationAddressPrefixes - The destination address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System Tags, and the asterisk (*). - DestinationAddressPrefixes *[]string `json:"destinationAddressPrefixes,omitempty"` - // ExpandedSourceAddressPrefix - The expanded source address prefix. - ExpandedSourceAddressPrefix *[]string `json:"expandedSourceAddressPrefix,omitempty"` - // ExpandedDestinationAddressPrefix - Expanded destination address prefix. - ExpandedDestinationAddressPrefix *[]string `json:"expandedDestinationAddressPrefix,omitempty"` - // Access - Whether network traffic is allowed or denied. Possible values include: 'SecurityRuleAccessAllow', 'SecurityRuleAccessDeny' - Access SecurityRuleAccess `json:"access,omitempty"` - // Priority - The priority of the rule. - Priority *int32 `json:"priority,omitempty"` - // Direction - The direction of the rule. Possible values include: 'SecurityRuleDirectionInbound', 'SecurityRuleDirectionOutbound' - Direction SecurityRuleDirection `json:"direction,omitempty"` -} - -// EffectiveRoute effective Route. -type EffectiveRoute struct { - // Name - The name of the user defined route. This is optional. - Name *string `json:"name,omitempty"` - // DisableBgpRoutePropagation - If true, on-premises routes are not propagated to the network interfaces in the subnet. - DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` - // Source - Who created the route. Possible values include: 'EffectiveRouteSourceUnknown', 'EffectiveRouteSourceUser', 'EffectiveRouteSourceVirtualNetworkGateway', 'EffectiveRouteSourceDefault' - Source EffectiveRouteSource `json:"source,omitempty"` - // State - The value of effective route. Possible values include: 'EffectiveRouteStateActive', 'EffectiveRouteStateInvalid' - State EffectiveRouteState `json:"state,omitempty"` - // AddressPrefix - The address prefixes of the effective routes in CIDR notation. - AddressPrefix *[]string `json:"addressPrefix,omitempty"` - // NextHopIPAddress - The IP address of the next hop of the effective route. - NextHopIPAddress *[]string `json:"nextHopIpAddress,omitempty"` - // NextHopType - The type of Azure hop the packet should be sent to. Possible values include: 'RouteNextHopTypeVirtualNetworkGateway', 'RouteNextHopTypeVnetLocal', 'RouteNextHopTypeInternet', 'RouteNextHopTypeVirtualAppliance', 'RouteNextHopTypeNone' - NextHopType RouteNextHopType `json:"nextHopType,omitempty"` -} - -// EffectiveRouteListResult response for list effective route API service call. -type EffectiveRouteListResult struct { - autorest.Response `json:"-"` - // Value - A list of effective routes. - Value *[]EffectiveRoute `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for EffectiveRouteListResult. -func (erlr EffectiveRouteListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erlr.Value != nil { - objectMap["value"] = erlr.Value - } - return json.Marshal(objectMap) -} - -// EffectiveRouteMapRoute the effective RouteMap route configured on the connection resource. -type EffectiveRouteMapRoute struct { - // Prefix - The address prefix of the route. - Prefix *[]string `json:"prefix,omitempty"` - // BgpCommunities - BGP communities of the route. - BgpCommunities *string `json:"bgpCommunities,omitempty"` - // AsPath - The ASPath of this route. - AsPath *string `json:"asPath,omitempty"` -} - -// EffectiveRoutesParameters the parameters specifying the resource whose effective routes are being -// requested. -type EffectiveRoutesParameters struct { - // ResourceID - The resource whose effective routes are being requested. - ResourceID *string `json:"resourceId,omitempty"` - // VirtualWanResourceType - The type of the specified resource like RouteTable, ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and P2SConnection. - VirtualWanResourceType *string `json:"virtualWanResourceType,omitempty"` -} - -// EffectiveSecurityAdminRule network admin rule. -type EffectiveSecurityAdminRule struct { - // AdminPropertiesFormat - Indicates the properties of the security admin rule - *AdminPropertiesFormat `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // ConfigurationDescription - A description of the security admin configuration. - ConfigurationDescription *string `json:"configurationDescription,omitempty"` - // RuleCollectionDescription - A description of the rule collection. - RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` - // RuleCollectionAppliesToGroups - Groups for rule collection - RuleCollectionAppliesToGroups *[]ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` - // RuleGroups - Effective configuration groups. - RuleGroups *[]ConfigurationGroup `json:"ruleGroups,omitempty"` - // Kind - Possible values include: 'KindBasicEffectiveBaseSecurityAdminRuleKindEffectiveBaseSecurityAdminRule', 'KindBasicEffectiveBaseSecurityAdminRuleKindCustom', 'KindBasicEffectiveBaseSecurityAdminRuleKindDefault' - Kind KindBasicEffectiveBaseSecurityAdminRule `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for EffectiveSecurityAdminRule. -func (esar EffectiveSecurityAdminRule) MarshalJSON() ([]byte, error) { - esar.Kind = KindBasicEffectiveBaseSecurityAdminRuleKindCustom - objectMap := make(map[string]interface{}) - if esar.AdminPropertiesFormat != nil { - objectMap["properties"] = esar.AdminPropertiesFormat - } - if esar.ID != nil { - objectMap["id"] = esar.ID - } - if esar.ConfigurationDescription != nil { - objectMap["configurationDescription"] = esar.ConfigurationDescription - } - if esar.RuleCollectionDescription != nil { - objectMap["ruleCollectionDescription"] = esar.RuleCollectionDescription - } - if esar.RuleCollectionAppliesToGroups != nil { - objectMap["ruleCollectionAppliesToGroups"] = esar.RuleCollectionAppliesToGroups - } - if esar.RuleGroups != nil { - objectMap["ruleGroups"] = esar.RuleGroups - } - if esar.Kind != "" { - objectMap["kind"] = esar.Kind - } - return json.Marshal(objectMap) -} - -// AsEffectiveSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveSecurityAdminRule. -func (esar EffectiveSecurityAdminRule) AsEffectiveSecurityAdminRule() (*EffectiveSecurityAdminRule, bool) { - return &esar, true -} - -// AsEffectiveDefaultSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveSecurityAdminRule. -func (esar EffectiveSecurityAdminRule) AsEffectiveDefaultSecurityAdminRule() (*EffectiveDefaultSecurityAdminRule, bool) { - return nil, false -} - -// AsEffectiveBaseSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveSecurityAdminRule. -func (esar EffectiveSecurityAdminRule) AsEffectiveBaseSecurityAdminRule() (*EffectiveBaseSecurityAdminRule, bool) { - return nil, false -} - -// AsBasicEffectiveBaseSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveSecurityAdminRule. -func (esar EffectiveSecurityAdminRule) AsBasicEffectiveBaseSecurityAdminRule() (BasicEffectiveBaseSecurityAdminRule, bool) { - return &esar, true -} - -// UnmarshalJSON is the custom unmarshaler for EffectiveSecurityAdminRule struct. -func (esar *EffectiveSecurityAdminRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var adminPropertiesFormat AdminPropertiesFormat - err = json.Unmarshal(*v, &adminPropertiesFormat) - if err != nil { - return err - } - esar.AdminPropertiesFormat = &adminPropertiesFormat - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - esar.ID = &ID - } - case "configurationDescription": - if v != nil { - var configurationDescription string - err = json.Unmarshal(*v, &configurationDescription) - if err != nil { - return err - } - esar.ConfigurationDescription = &configurationDescription - } - case "ruleCollectionDescription": - if v != nil { - var ruleCollectionDescription string - err = json.Unmarshal(*v, &ruleCollectionDescription) - if err != nil { - return err - } - esar.RuleCollectionDescription = &ruleCollectionDescription - } - case "ruleCollectionAppliesToGroups": - if v != nil { - var ruleCollectionAppliesToGroups []ManagerSecurityGroupItem - err = json.Unmarshal(*v, &ruleCollectionAppliesToGroups) - if err != nil { - return err - } - esar.RuleCollectionAppliesToGroups = &ruleCollectionAppliesToGroups - } - case "ruleGroups": - if v != nil { - var ruleGroups []ConfigurationGroup - err = json.Unmarshal(*v, &ruleGroups) - if err != nil { - return err - } - esar.RuleGroups = &ruleGroups - } - case "kind": - if v != nil { - var kind KindBasicEffectiveBaseSecurityAdminRule - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - esar.Kind = kind - } - } - } - - return nil -} - -// EndpointServiceResult endpoint service. -type EndpointServiceResult struct { - // Name - READ-ONLY; Name of the endpoint service. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the endpoint service. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for EndpointServiceResult. -func (esr EndpointServiceResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if esr.ID != nil { - objectMap["id"] = esr.ID - } - return json.Marshal(objectMap) -} - -// EndpointServicesListResult response for the ListAvailableEndpointServices API service call. -type EndpointServicesListResult struct { - autorest.Response `json:"-"` - // Value - List of available endpoint services in a region. - Value *[]EndpointServiceResult `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// EndpointServicesListResultIterator provides access to a complete listing of EndpointServiceResult -// values. -type EndpointServicesListResultIterator struct { - i int - page EndpointServicesListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *EndpointServicesListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EndpointServicesListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *EndpointServicesListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EndpointServicesListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter EndpointServicesListResultIterator) Response() EndpointServicesListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter EndpointServicesListResultIterator) Value() EndpointServiceResult { - if !iter.page.NotDone() { - return EndpointServiceResult{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EndpointServicesListResultIterator type. -func NewEndpointServicesListResultIterator(page EndpointServicesListResultPage) EndpointServicesListResultIterator { - return EndpointServicesListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eslr EndpointServicesListResult) IsEmpty() bool { - return eslr.Value == nil || len(*eslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eslr EndpointServicesListResult) hasNextLink() bool { - return eslr.NextLink != nil && len(*eslr.NextLink) != 0 -} - -// endpointServicesListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eslr EndpointServicesListResult) endpointServicesListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eslr.NextLink))) -} - -// EndpointServicesListResultPage contains a page of EndpointServiceResult values. -type EndpointServicesListResultPage struct { - fn func(context.Context, EndpointServicesListResult) (EndpointServicesListResult, error) - eslr EndpointServicesListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *EndpointServicesListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EndpointServicesListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.eslr) - if err != nil { - return err - } - page.eslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *EndpointServicesListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EndpointServicesListResultPage) NotDone() bool { - return !page.eslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EndpointServicesListResultPage) Response() EndpointServicesListResult { - return page.eslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EndpointServicesListResultPage) Values() []EndpointServiceResult { - if page.eslr.IsEmpty() { - return nil - } - return *page.eslr.Value -} - -// Creates a new instance of the EndpointServicesListResultPage type. -func NewEndpointServicesListResultPage(cur EndpointServicesListResult, getNextPage func(context.Context, EndpointServicesListResult) (EndpointServicesListResult, error)) EndpointServicesListResultPage { - return EndpointServicesListResultPage{ - fn: getNextPage, - eslr: cur, - } -} - -// Error common error representation. -type Error struct { - // Code - Error code. - Code *string `json:"code,omitempty"` - // Message - Error message. - Message *string `json:"message,omitempty"` - // Target - Error target. - Target *string `json:"target,omitempty"` - // Details - Error details. - Details *[]ErrorDetails `json:"details,omitempty"` - // InnerError - Inner error message. - InnerError *string `json:"innerError,omitempty"` -} - -// ErrorDetails common error details representation. -type ErrorDetails struct { - // Code - Error code. - Code *string `json:"code,omitempty"` - // Target - Error target. - Target *string `json:"target,omitempty"` - // Message - Error message. - Message *string `json:"message,omitempty"` -} - -// ErrorResponse the error object. -type ErrorResponse struct { - // Error - The error details object. - Error *Error `json:"error,omitempty"` -} - -// EvaluatedNetworkSecurityGroup results of network security group evaluation. -type EvaluatedNetworkSecurityGroup struct { - // NetworkSecurityGroupID - Network security group ID. - NetworkSecurityGroupID *string `json:"networkSecurityGroupId,omitempty"` - // AppliedTo - Resource ID of nic or subnet to which network security group is applied. - AppliedTo *string `json:"appliedTo,omitempty"` - // MatchedRule - Matched network security rule. - MatchedRule *MatchedRule `json:"matchedRule,omitempty"` - // RulesEvaluationResult - READ-ONLY; List of network security rules evaluation results. - RulesEvaluationResult *[]SecurityRulesEvaluationResult `json:"rulesEvaluationResult,omitempty"` -} - -// MarshalJSON is the custom marshaler for EvaluatedNetworkSecurityGroup. -func (ensg EvaluatedNetworkSecurityGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ensg.NetworkSecurityGroupID != nil { - objectMap["networkSecurityGroupId"] = ensg.NetworkSecurityGroupID - } - if ensg.AppliedTo != nil { - objectMap["appliedTo"] = ensg.AppliedTo - } - if ensg.MatchedRule != nil { - objectMap["matchedRule"] = ensg.MatchedRule - } - return json.Marshal(objectMap) -} - -// ExclusionManagedRule defines a managed rule to use for exclusion. -type ExclusionManagedRule struct { - // RuleID - Identifier for the managed rule. - RuleID *string `json:"ruleId,omitempty"` -} - -// ExclusionManagedRuleGroup defines a managed rule group to use for exclusion. -type ExclusionManagedRuleGroup struct { - // RuleGroupName - The managed rule group for exclusion. - RuleGroupName *string `json:"ruleGroupName,omitempty"` - // Rules - List of rules that will be excluded. If none specified, all rules in the group will be excluded. - Rules *[]ExclusionManagedRule `json:"rules,omitempty"` -} - -// ExclusionManagedRuleSet defines a managed rule set for Exclusions. -type ExclusionManagedRuleSet struct { - // RuleSetType - Defines the rule set type to use. - RuleSetType *string `json:"ruleSetType,omitempty"` - // RuleSetVersion - Defines the version of the rule set to use. - RuleSetVersion *string `json:"ruleSetVersion,omitempty"` - // RuleGroups - Defines the rule groups to apply to the rule set. - RuleGroups *[]ExclusionManagedRuleGroup `json:"ruleGroups,omitempty"` -} - -// ExplicitProxy explicit Proxy Settings in Firewall Policy. -type ExplicitProxy struct { - // EnableExplicitProxy - When set to true, explicit proxy mode is enabled. - EnableExplicitProxy *bool `json:"enableExplicitProxy,omitempty"` - // HTTPPort - Port number for explicit proxy http protocol, cannot be greater than 64000. - HTTPPort *int32 `json:"httpPort,omitempty"` - // HTTPSPort - Port number for explicit proxy https protocol, cannot be greater than 64000. - HTTPSPort *int32 `json:"httpsPort,omitempty"` - // EnablePacFile - When set to true, pac file port and url needs to be provided. - EnablePacFile *bool `json:"enablePacFile,omitempty"` - // PacFilePort - Port number for firewall to serve PAC file. - PacFilePort *int32 `json:"pacFilePort,omitempty"` - // PacFile - SAS URL for PAC file. - PacFile *string `json:"pacFile,omitempty"` -} - -// ExpressRouteCircuit expressRouteCircuit resource. -type ExpressRouteCircuit struct { - autorest.Response `json:"-"` - // Sku - The SKU. - Sku *ExpressRouteCircuitSku `json:"sku,omitempty"` - // ExpressRouteCircuitPropertiesFormat - Properties of the express route circuit. - *ExpressRouteCircuitPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteCircuit. -func (erc ExpressRouteCircuit) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erc.Sku != nil { - objectMap["sku"] = erc.Sku - } - if erc.ExpressRouteCircuitPropertiesFormat != nil { - objectMap["properties"] = erc.ExpressRouteCircuitPropertiesFormat - } - if erc.ID != nil { - objectMap["id"] = erc.ID - } - if erc.Location != nil { - objectMap["location"] = erc.Location - } - if erc.Tags != nil { - objectMap["tags"] = erc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuit struct. -func (erc *ExpressRouteCircuit) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku ExpressRouteCircuitSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - erc.Sku = &sku - } - case "properties": - if v != nil { - var expressRouteCircuitPropertiesFormat ExpressRouteCircuitPropertiesFormat - err = json.Unmarshal(*v, &expressRouteCircuitPropertiesFormat) - if err != nil { - return err - } - erc.ExpressRouteCircuitPropertiesFormat = &expressRouteCircuitPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - erc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - erc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - erc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - erc.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - erc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - erc.Tags = tags - } - } - } - - return nil -} - -// ExpressRouteCircuitArpTable the ARP table associated with the ExpressRouteCircuit. -type ExpressRouteCircuitArpTable struct { - // Age - Entry age in minutes. - Age *int32 `json:"age,omitempty"` - // Interface - Interface address. - Interface *string `json:"interface,omitempty"` - // IPAddress - The IP address. - IPAddress *string `json:"ipAddress,omitempty"` - // MacAddress - The MAC address. - MacAddress *string `json:"macAddress,omitempty"` -} - -// ExpressRouteCircuitAuthorization authorization in an ExpressRouteCircuit resource. -type ExpressRouteCircuitAuthorization struct { - autorest.Response `json:"-"` - // AuthorizationPropertiesFormat - Properties of the express route circuit authorization. - *AuthorizationPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteCircuitAuthorization. -func (erca ExpressRouteCircuitAuthorization) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erca.AuthorizationPropertiesFormat != nil { - objectMap["properties"] = erca.AuthorizationPropertiesFormat - } - if erca.Name != nil { - objectMap["name"] = erca.Name - } - if erca.ID != nil { - objectMap["id"] = erca.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuitAuthorization struct. -func (erca *ExpressRouteCircuitAuthorization) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var authorizationPropertiesFormat AuthorizationPropertiesFormat - err = json.Unmarshal(*v, &authorizationPropertiesFormat) - if err != nil { - return err - } - erca.AuthorizationPropertiesFormat = &authorizationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - erca.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - erca.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - erca.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - erca.ID = &ID - } - } - } - - return nil -} - -// ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCircuitAuthorizationsClient) (ExpressRouteCircuitAuthorization, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture.Result. -func (future *ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture) result(client ExpressRouteCircuitAuthorizationsClient) (erca ExpressRouteCircuitAuthorization, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - erca.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if erca.Response.Response, err = future.GetResult(sender); err == nil && erca.Response.Response.StatusCode != http.StatusNoContent { - erca, err = client.CreateOrUpdateResponder(erca.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", erca.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRouteCircuitAuthorizationsDeleteFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ExpressRouteCircuitAuthorizationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCircuitAuthorizationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCircuitAuthorizationsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCircuitAuthorizationsDeleteFuture.Result. -func (future *ExpressRouteCircuitAuthorizationsDeleteFuture) result(client ExpressRouteCircuitAuthorizationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitAuthorizationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ExpressRouteCircuitConnection express Route Circuit Connection in an ExpressRouteCircuitPeering -// resource. -type ExpressRouteCircuitConnection struct { - autorest.Response `json:"-"` - // ExpressRouteCircuitConnectionPropertiesFormat - Properties of the express route circuit connection. - *ExpressRouteCircuitConnectionPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteCircuitConnection. -func (ercc ExpressRouteCircuitConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ercc.ExpressRouteCircuitConnectionPropertiesFormat != nil { - objectMap["properties"] = ercc.ExpressRouteCircuitConnectionPropertiesFormat - } - if ercc.Name != nil { - objectMap["name"] = ercc.Name - } - if ercc.ID != nil { - objectMap["id"] = ercc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuitConnection struct. -func (ercc *ExpressRouteCircuitConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var expressRouteCircuitConnectionPropertiesFormat ExpressRouteCircuitConnectionPropertiesFormat - err = json.Unmarshal(*v, &expressRouteCircuitConnectionPropertiesFormat) - if err != nil { - return err - } - ercc.ExpressRouteCircuitConnectionPropertiesFormat = &expressRouteCircuitConnectionPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ercc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ercc.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ercc.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ercc.ID = &ID - } - } - } - - return nil -} - -// ExpressRouteCircuitConnectionListResult response for ListConnections API service call retrieves all -// global reach connections that belongs to a Private Peering for an ExpressRouteCircuit. -type ExpressRouteCircuitConnectionListResult struct { - autorest.Response `json:"-"` - // Value - The global reach connection associated with Private Peering in an ExpressRoute Circuit. - Value *[]ExpressRouteCircuitConnection `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRouteCircuitConnectionListResultIterator provides access to a complete listing of -// ExpressRouteCircuitConnection values. -type ExpressRouteCircuitConnectionListResultIterator struct { - i int - page ExpressRouteCircuitConnectionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ExpressRouteCircuitConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitConnectionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ExpressRouteCircuitConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExpressRouteCircuitConnectionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ExpressRouteCircuitConnectionListResultIterator) Response() ExpressRouteCircuitConnectionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ExpressRouteCircuitConnectionListResultIterator) Value() ExpressRouteCircuitConnection { - if !iter.page.NotDone() { - return ExpressRouteCircuitConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExpressRouteCircuitConnectionListResultIterator type. -func NewExpressRouteCircuitConnectionListResultIterator(page ExpressRouteCircuitConnectionListResultPage) ExpressRouteCircuitConnectionListResultIterator { - return ExpressRouteCircuitConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ercclr ExpressRouteCircuitConnectionListResult) IsEmpty() bool { - return ercclr.Value == nil || len(*ercclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ercclr ExpressRouteCircuitConnectionListResult) hasNextLink() bool { - return ercclr.NextLink != nil && len(*ercclr.NextLink) != 0 -} - -// expressRouteCircuitConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ercclr ExpressRouteCircuitConnectionListResult) expressRouteCircuitConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ercclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ercclr.NextLink))) -} - -// ExpressRouteCircuitConnectionListResultPage contains a page of ExpressRouteCircuitConnection values. -type ExpressRouteCircuitConnectionListResultPage struct { - fn func(context.Context, ExpressRouteCircuitConnectionListResult) (ExpressRouteCircuitConnectionListResult, error) - ercclr ExpressRouteCircuitConnectionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ExpressRouteCircuitConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitConnectionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ercclr) - if err != nil { - return err - } - page.ercclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ExpressRouteCircuitConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExpressRouteCircuitConnectionListResultPage) NotDone() bool { - return !page.ercclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExpressRouteCircuitConnectionListResultPage) Response() ExpressRouteCircuitConnectionListResult { - return page.ercclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExpressRouteCircuitConnectionListResultPage) Values() []ExpressRouteCircuitConnection { - if page.ercclr.IsEmpty() { - return nil - } - return *page.ercclr.Value -} - -// Creates a new instance of the ExpressRouteCircuitConnectionListResultPage type. -func NewExpressRouteCircuitConnectionListResultPage(cur ExpressRouteCircuitConnectionListResult, getNextPage func(context.Context, ExpressRouteCircuitConnectionListResult) (ExpressRouteCircuitConnectionListResult, error)) ExpressRouteCircuitConnectionListResultPage { - return ExpressRouteCircuitConnectionListResultPage{ - fn: getNextPage, - ercclr: cur, - } -} - -// ExpressRouteCircuitConnectionPropertiesFormat properties of the express route circuit connection. -type ExpressRouteCircuitConnectionPropertiesFormat struct { - // ExpressRouteCircuitPeering - Reference to Express Route Circuit Private Peering Resource of the circuit initiating connection. - ExpressRouteCircuitPeering *SubResource `json:"expressRouteCircuitPeering,omitempty"` - // PeerExpressRouteCircuitPeering - Reference to Express Route Circuit Private Peering Resource of the peered circuit. - PeerExpressRouteCircuitPeering *SubResource `json:"peerExpressRouteCircuitPeering,omitempty"` - // AddressPrefix - /29 IP address space to carve out Customer addresses for tunnels. - AddressPrefix *string `json:"addressPrefix,omitempty"` - // AuthorizationKey - The authorization key. - AuthorizationKey *string `json:"authorizationKey,omitempty"` - // Ipv6CircuitConnectionConfig - IPv6 Address PrefixProperties of the express route circuit connection. - Ipv6CircuitConnectionConfig *Ipv6CircuitConnectionConfig `json:"ipv6CircuitConnectionConfig,omitempty"` - // CircuitConnectionStatus - Express Route Circuit connection state. Possible values include: 'CircuitConnectionStatusConnected', 'CircuitConnectionStatusConnecting', 'CircuitConnectionStatusDisconnected' - CircuitConnectionStatus CircuitConnectionStatus `json:"circuitConnectionStatus,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the express route circuit connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteCircuitConnectionPropertiesFormat. -func (erccpf ExpressRouteCircuitConnectionPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erccpf.ExpressRouteCircuitPeering != nil { - objectMap["expressRouteCircuitPeering"] = erccpf.ExpressRouteCircuitPeering - } - if erccpf.PeerExpressRouteCircuitPeering != nil { - objectMap["peerExpressRouteCircuitPeering"] = erccpf.PeerExpressRouteCircuitPeering - } - if erccpf.AddressPrefix != nil { - objectMap["addressPrefix"] = erccpf.AddressPrefix - } - if erccpf.AuthorizationKey != nil { - objectMap["authorizationKey"] = erccpf.AuthorizationKey - } - if erccpf.Ipv6CircuitConnectionConfig != nil { - objectMap["ipv6CircuitConnectionConfig"] = erccpf.Ipv6CircuitConnectionConfig - } - if erccpf.CircuitConnectionStatus != "" { - objectMap["circuitConnectionStatus"] = erccpf.CircuitConnectionStatus - } - return json.Marshal(objectMap) -} - -// ExpressRouteCircuitConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ExpressRouteCircuitConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCircuitConnectionsClient) (ExpressRouteCircuitConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCircuitConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCircuitConnectionsCreateOrUpdateFuture.Result. -func (future *ExpressRouteCircuitConnectionsCreateOrUpdateFuture) result(client ExpressRouteCircuitConnectionsClient) (ercc ExpressRouteCircuitConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ercc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ercc.Response.Response, err = future.GetResult(sender); err == nil && ercc.Response.Response.StatusCode != http.StatusNoContent { - ercc, err = client.CreateOrUpdateResponder(ercc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsCreateOrUpdateFuture", "Result", ercc.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRouteCircuitConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExpressRouteCircuitConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCircuitConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCircuitConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCircuitConnectionsDeleteFuture.Result. -func (future *ExpressRouteCircuitConnectionsDeleteFuture) result(client ExpressRouteCircuitConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ExpressRouteCircuitListResult response for ListExpressRouteCircuit API service call. -type ExpressRouteCircuitListResult struct { - autorest.Response `json:"-"` - // Value - A list of ExpressRouteCircuits in a resource group. - Value *[]ExpressRouteCircuit `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRouteCircuitListResultIterator provides access to a complete listing of ExpressRouteCircuit -// values. -type ExpressRouteCircuitListResultIterator struct { - i int - page ExpressRouteCircuitListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ExpressRouteCircuitListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ExpressRouteCircuitListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExpressRouteCircuitListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ExpressRouteCircuitListResultIterator) Response() ExpressRouteCircuitListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ExpressRouteCircuitListResultIterator) Value() ExpressRouteCircuit { - if !iter.page.NotDone() { - return ExpressRouteCircuit{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExpressRouteCircuitListResultIterator type. -func NewExpressRouteCircuitListResultIterator(page ExpressRouteCircuitListResultPage) ExpressRouteCircuitListResultIterator { - return ExpressRouteCircuitListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (erclr ExpressRouteCircuitListResult) IsEmpty() bool { - return erclr.Value == nil || len(*erclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (erclr ExpressRouteCircuitListResult) hasNextLink() bool { - return erclr.NextLink != nil && len(*erclr.NextLink) != 0 -} - -// expressRouteCircuitListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (erclr ExpressRouteCircuitListResult) expressRouteCircuitListResultPreparer(ctx context.Context) (*http.Request, error) { - if !erclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(erclr.NextLink))) -} - -// ExpressRouteCircuitListResultPage contains a page of ExpressRouteCircuit values. -type ExpressRouteCircuitListResultPage struct { - fn func(context.Context, ExpressRouteCircuitListResult) (ExpressRouteCircuitListResult, error) - erclr ExpressRouteCircuitListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ExpressRouteCircuitListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.erclr) - if err != nil { - return err - } - page.erclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ExpressRouteCircuitListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExpressRouteCircuitListResultPage) NotDone() bool { - return !page.erclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExpressRouteCircuitListResultPage) Response() ExpressRouteCircuitListResult { - return page.erclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExpressRouteCircuitListResultPage) Values() []ExpressRouteCircuit { - if page.erclr.IsEmpty() { - return nil - } - return *page.erclr.Value -} - -// Creates a new instance of the ExpressRouteCircuitListResultPage type. -func NewExpressRouteCircuitListResultPage(cur ExpressRouteCircuitListResult, getNextPage func(context.Context, ExpressRouteCircuitListResult) (ExpressRouteCircuitListResult, error)) ExpressRouteCircuitListResultPage { - return ExpressRouteCircuitListResultPage{ - fn: getNextPage, - erclr: cur, - } -} - -// ExpressRouteCircuitPeering peering in an ExpressRouteCircuit resource. -type ExpressRouteCircuitPeering struct { - autorest.Response `json:"-"` - // ExpressRouteCircuitPeeringPropertiesFormat - Properties of the express route circuit peering. - *ExpressRouteCircuitPeeringPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteCircuitPeering. -func (ercp ExpressRouteCircuitPeering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ercp.ExpressRouteCircuitPeeringPropertiesFormat != nil { - objectMap["properties"] = ercp.ExpressRouteCircuitPeeringPropertiesFormat - } - if ercp.Name != nil { - objectMap["name"] = ercp.Name - } - if ercp.ID != nil { - objectMap["id"] = ercp.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuitPeering struct. -func (ercp *ExpressRouteCircuitPeering) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var expressRouteCircuitPeeringPropertiesFormat ExpressRouteCircuitPeeringPropertiesFormat - err = json.Unmarshal(*v, &expressRouteCircuitPeeringPropertiesFormat) - if err != nil { - return err - } - ercp.ExpressRouteCircuitPeeringPropertiesFormat = &expressRouteCircuitPeeringPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ercp.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ercp.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ercp.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ercp.ID = &ID - } - } - } - - return nil -} - -// ExpressRouteCircuitPeeringConfig specifies the peering configuration. -type ExpressRouteCircuitPeeringConfig struct { - // AdvertisedPublicPrefixes - The reference to AdvertisedPublicPrefixes. - AdvertisedPublicPrefixes *[]string `json:"advertisedPublicPrefixes,omitempty"` - // AdvertisedCommunities - The communities of bgp peering. Specified for microsoft peering. - AdvertisedCommunities *[]string `json:"advertisedCommunities,omitempty"` - // AdvertisedPublicPrefixesState - READ-ONLY; The advertised public prefix state of the Peering resource. Possible values include: 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateNotConfigured', 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfiguring', 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfigured', 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded' - AdvertisedPublicPrefixesState ExpressRouteCircuitPeeringAdvertisedPublicPrefixState `json:"advertisedPublicPrefixesState,omitempty"` - // LegacyMode - The legacy mode of the peering. - LegacyMode *int32 `json:"legacyMode,omitempty"` - // CustomerASN - The CustomerASN of the peering. - CustomerASN *int32 `json:"customerASN,omitempty"` - // RoutingRegistryName - The RoutingRegistryName of the configuration. - RoutingRegistryName *string `json:"routingRegistryName,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteCircuitPeeringConfig. -func (ercpc ExpressRouteCircuitPeeringConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ercpc.AdvertisedPublicPrefixes != nil { - objectMap["advertisedPublicPrefixes"] = ercpc.AdvertisedPublicPrefixes - } - if ercpc.AdvertisedCommunities != nil { - objectMap["advertisedCommunities"] = ercpc.AdvertisedCommunities - } - if ercpc.LegacyMode != nil { - objectMap["legacyMode"] = ercpc.LegacyMode - } - if ercpc.CustomerASN != nil { - objectMap["customerASN"] = ercpc.CustomerASN - } - if ercpc.RoutingRegistryName != nil { - objectMap["routingRegistryName"] = ercpc.RoutingRegistryName - } - return json.Marshal(objectMap) -} - -// ExpressRouteCircuitPeeringID expressRoute circuit peering identifier. -type ExpressRouteCircuitPeeringID struct { - // ID - The ID of the ExpressRoute circuit peering. - ID *string `json:"id,omitempty"` -} - -// ExpressRouteCircuitPeeringListResult response for ListPeering API service call retrieves all peerings -// that belong to an ExpressRouteCircuit. -type ExpressRouteCircuitPeeringListResult struct { - autorest.Response `json:"-"` - // Value - The peerings in an express route circuit. - Value *[]ExpressRouteCircuitPeering `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRouteCircuitPeeringListResultIterator provides access to a complete listing of -// ExpressRouteCircuitPeering values. -type ExpressRouteCircuitPeeringListResultIterator struct { - i int - page ExpressRouteCircuitPeeringListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ExpressRouteCircuitPeeringListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitPeeringListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ExpressRouteCircuitPeeringListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExpressRouteCircuitPeeringListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ExpressRouteCircuitPeeringListResultIterator) Response() ExpressRouteCircuitPeeringListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ExpressRouteCircuitPeeringListResultIterator) Value() ExpressRouteCircuitPeering { - if !iter.page.NotDone() { - return ExpressRouteCircuitPeering{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExpressRouteCircuitPeeringListResultIterator type. -func NewExpressRouteCircuitPeeringListResultIterator(page ExpressRouteCircuitPeeringListResultPage) ExpressRouteCircuitPeeringListResultIterator { - return ExpressRouteCircuitPeeringListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ercplr ExpressRouteCircuitPeeringListResult) IsEmpty() bool { - return ercplr.Value == nil || len(*ercplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ercplr ExpressRouteCircuitPeeringListResult) hasNextLink() bool { - return ercplr.NextLink != nil && len(*ercplr.NextLink) != 0 -} - -// expressRouteCircuitPeeringListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ercplr ExpressRouteCircuitPeeringListResult) expressRouteCircuitPeeringListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ercplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ercplr.NextLink))) -} - -// ExpressRouteCircuitPeeringListResultPage contains a page of ExpressRouteCircuitPeering values. -type ExpressRouteCircuitPeeringListResultPage struct { - fn func(context.Context, ExpressRouteCircuitPeeringListResult) (ExpressRouteCircuitPeeringListResult, error) - ercplr ExpressRouteCircuitPeeringListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ExpressRouteCircuitPeeringListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitPeeringListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ercplr) - if err != nil { - return err - } - page.ercplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ExpressRouteCircuitPeeringListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExpressRouteCircuitPeeringListResultPage) NotDone() bool { - return !page.ercplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExpressRouteCircuitPeeringListResultPage) Response() ExpressRouteCircuitPeeringListResult { - return page.ercplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExpressRouteCircuitPeeringListResultPage) Values() []ExpressRouteCircuitPeering { - if page.ercplr.IsEmpty() { - return nil - } - return *page.ercplr.Value -} - -// Creates a new instance of the ExpressRouteCircuitPeeringListResultPage type. -func NewExpressRouteCircuitPeeringListResultPage(cur ExpressRouteCircuitPeeringListResult, getNextPage func(context.Context, ExpressRouteCircuitPeeringListResult) (ExpressRouteCircuitPeeringListResult, error)) ExpressRouteCircuitPeeringListResultPage { - return ExpressRouteCircuitPeeringListResultPage{ - fn: getNextPage, - ercplr: cur, - } -} - -// ExpressRouteCircuitPeeringPropertiesFormat properties of the express route circuit peering. -type ExpressRouteCircuitPeeringPropertiesFormat struct { - // PeeringType - The peering type. Possible values include: 'ExpressRoutePeeringTypeAzurePublicPeering', 'ExpressRoutePeeringTypeAzurePrivatePeering', 'ExpressRoutePeeringTypeMicrosoftPeering' - PeeringType ExpressRoutePeeringType `json:"peeringType,omitempty"` - // State - The peering state. Possible values include: 'ExpressRoutePeeringStateDisabled', 'ExpressRoutePeeringStateEnabled' - State ExpressRoutePeeringState `json:"state,omitempty"` - // AzureASN - The Azure ASN. - AzureASN *int32 `json:"azureASN,omitempty"` - // PeerASN - The peer ASN. - PeerASN *int64 `json:"peerASN,omitempty"` - // PrimaryPeerAddressPrefix - The primary address prefix. - PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` - // SecondaryPeerAddressPrefix - The secondary address prefix. - SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"` - // PrimaryAzurePort - The primary port. - PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` - // SecondaryAzurePort - The secondary port. - SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` - // SharedKey - The shared key. - SharedKey *string `json:"sharedKey,omitempty"` - // VlanID - The VLAN ID. - VlanID *int32 `json:"vlanId,omitempty"` - // MicrosoftPeeringConfig - The Microsoft peering configuration. - MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` - // Stats - The peering stats of express route circuit. - Stats *ExpressRouteCircuitStats `json:"stats,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the express route circuit peering resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // GatewayManagerEtag - The GatewayManager Etag. - GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` - // LastModifiedBy - READ-ONLY; Who was the last to modify the peering. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // RouteFilter - The reference to the RouteFilter resource. - RouteFilter *SubResource `json:"routeFilter,omitempty"` - // Ipv6PeeringConfig - The IPv6 peering configuration. - Ipv6PeeringConfig *Ipv6ExpressRouteCircuitPeeringConfig `json:"ipv6PeeringConfig,omitempty"` - // ExpressRouteConnection - The ExpressRoute connection. - ExpressRouteConnection *ExpressRouteConnectionID `json:"expressRouteConnection,omitempty"` - // Connections - The list of circuit connections associated with Azure Private Peering for this circuit. - Connections *[]ExpressRouteCircuitConnection `json:"connections,omitempty"` - // PeeredConnections - READ-ONLY; The list of peered circuit connections associated with Azure Private Peering for this circuit. - PeeredConnections *[]PeerExpressRouteCircuitConnection `json:"peeredConnections,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteCircuitPeeringPropertiesFormat. -func (ercppf ExpressRouteCircuitPeeringPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ercppf.PeeringType != "" { - objectMap["peeringType"] = ercppf.PeeringType - } - if ercppf.State != "" { - objectMap["state"] = ercppf.State - } - if ercppf.AzureASN != nil { - objectMap["azureASN"] = ercppf.AzureASN - } - if ercppf.PeerASN != nil { - objectMap["peerASN"] = ercppf.PeerASN - } - if ercppf.PrimaryPeerAddressPrefix != nil { - objectMap["primaryPeerAddressPrefix"] = ercppf.PrimaryPeerAddressPrefix - } - if ercppf.SecondaryPeerAddressPrefix != nil { - objectMap["secondaryPeerAddressPrefix"] = ercppf.SecondaryPeerAddressPrefix - } - if ercppf.PrimaryAzurePort != nil { - objectMap["primaryAzurePort"] = ercppf.PrimaryAzurePort - } - if ercppf.SecondaryAzurePort != nil { - objectMap["secondaryAzurePort"] = ercppf.SecondaryAzurePort - } - if ercppf.SharedKey != nil { - objectMap["sharedKey"] = ercppf.SharedKey - } - if ercppf.VlanID != nil { - objectMap["vlanId"] = ercppf.VlanID - } - if ercppf.MicrosoftPeeringConfig != nil { - objectMap["microsoftPeeringConfig"] = ercppf.MicrosoftPeeringConfig - } - if ercppf.Stats != nil { - objectMap["stats"] = ercppf.Stats - } - if ercppf.GatewayManagerEtag != nil { - objectMap["gatewayManagerEtag"] = ercppf.GatewayManagerEtag - } - if ercppf.RouteFilter != nil { - objectMap["routeFilter"] = ercppf.RouteFilter - } - if ercppf.Ipv6PeeringConfig != nil { - objectMap["ipv6PeeringConfig"] = ercppf.Ipv6PeeringConfig - } - if ercppf.ExpressRouteConnection != nil { - objectMap["expressRouteConnection"] = ercppf.ExpressRouteConnection - } - if ercppf.Connections != nil { - objectMap["connections"] = ercppf.Connections - } - return json.Marshal(objectMap) -} - -// ExpressRouteCircuitPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ExpressRouteCircuitPeeringsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCircuitPeeringsClient) (ExpressRouteCircuitPeering, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCircuitPeeringsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCircuitPeeringsCreateOrUpdateFuture.Result. -func (future *ExpressRouteCircuitPeeringsCreateOrUpdateFuture) result(client ExpressRouteCircuitPeeringsClient) (ercp ExpressRouteCircuitPeering, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ercp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ercp.Response.Response, err = future.GetResult(sender); err == nil && ercp.Response.Response.StatusCode != http.StatusNoContent { - ercp, err = client.CreateOrUpdateResponder(ercp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", ercp.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRouteCircuitPeeringsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExpressRouteCircuitPeeringsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCircuitPeeringsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCircuitPeeringsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCircuitPeeringsDeleteFuture.Result. -func (future *ExpressRouteCircuitPeeringsDeleteFuture) result(client ExpressRouteCircuitPeeringsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitPeeringsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ExpressRouteCircuitPropertiesFormat properties of ExpressRouteCircuit. -type ExpressRouteCircuitPropertiesFormat struct { - // AllowClassicOperations - Allow classic operations. - AllowClassicOperations *bool `json:"allowClassicOperations,omitempty"` - // CircuitProvisioningState - The CircuitProvisioningState state of the resource. - CircuitProvisioningState *string `json:"circuitProvisioningState,omitempty"` - // ServiceProviderProvisioningState - The ServiceProviderProvisioningState state of the resource. Possible values include: 'ServiceProviderProvisioningStateNotProvisioned', 'ServiceProviderProvisioningStateProvisioning', 'ServiceProviderProvisioningStateProvisioned', 'ServiceProviderProvisioningStateDeprovisioning' - ServiceProviderProvisioningState ServiceProviderProvisioningState `json:"serviceProviderProvisioningState,omitempty"` - // Authorizations - The list of authorizations. - Authorizations *[]ExpressRouteCircuitAuthorization `json:"authorizations,omitempty"` - // Peerings - The list of peerings. - Peerings *[]ExpressRouteCircuitPeering `json:"peerings,omitempty"` - // ServiceKey - The ServiceKey. - ServiceKey *string `json:"serviceKey,omitempty"` - // ServiceProviderNotes - The ServiceProviderNotes. - ServiceProviderNotes *string `json:"serviceProviderNotes,omitempty"` - // ServiceProviderProperties - The ServiceProviderProperties. - ServiceProviderProperties *ExpressRouteCircuitServiceProviderProperties `json:"serviceProviderProperties,omitempty"` - // ExpressRoutePort - The reference to the ExpressRoutePort resource when the circuit is provisioned on an ExpressRoutePort resource. - ExpressRoutePort *SubResource `json:"expressRoutePort,omitempty"` - // BandwidthInGbps - The bandwidth of the circuit when the circuit is provisioned on an ExpressRoutePort resource. - BandwidthInGbps *float64 `json:"bandwidthInGbps,omitempty"` - // Stag - READ-ONLY; The identifier of the circuit traffic. Outer tag for QinQ encapsulation. - Stag *int32 `json:"stag,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the express route circuit resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // GatewayManagerEtag - The GatewayManager Etag. - GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` - // GlobalReachEnabled - Flag denoting global reach status. - GlobalReachEnabled *bool `json:"globalReachEnabled,omitempty"` - // AuthorizationKey - The authorizationKey. - AuthorizationKey *string `json:"authorizationKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteCircuitPropertiesFormat. -func (ercpf ExpressRouteCircuitPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ercpf.AllowClassicOperations != nil { - objectMap["allowClassicOperations"] = ercpf.AllowClassicOperations - } - if ercpf.CircuitProvisioningState != nil { - objectMap["circuitProvisioningState"] = ercpf.CircuitProvisioningState - } - if ercpf.ServiceProviderProvisioningState != "" { - objectMap["serviceProviderProvisioningState"] = ercpf.ServiceProviderProvisioningState - } - if ercpf.Authorizations != nil { - objectMap["authorizations"] = ercpf.Authorizations - } - if ercpf.Peerings != nil { - objectMap["peerings"] = ercpf.Peerings - } - if ercpf.ServiceKey != nil { - objectMap["serviceKey"] = ercpf.ServiceKey - } - if ercpf.ServiceProviderNotes != nil { - objectMap["serviceProviderNotes"] = ercpf.ServiceProviderNotes - } - if ercpf.ServiceProviderProperties != nil { - objectMap["serviceProviderProperties"] = ercpf.ServiceProviderProperties - } - if ercpf.ExpressRoutePort != nil { - objectMap["expressRoutePort"] = ercpf.ExpressRoutePort - } - if ercpf.BandwidthInGbps != nil { - objectMap["bandwidthInGbps"] = ercpf.BandwidthInGbps - } - if ercpf.GatewayManagerEtag != nil { - objectMap["gatewayManagerEtag"] = ercpf.GatewayManagerEtag - } - if ercpf.GlobalReachEnabled != nil { - objectMap["globalReachEnabled"] = ercpf.GlobalReachEnabled - } - if ercpf.AuthorizationKey != nil { - objectMap["authorizationKey"] = ercpf.AuthorizationKey - } - return json.Marshal(objectMap) -} - -// ExpressRouteCircuitReference reference to an express route circuit. -type ExpressRouteCircuitReference struct { - // ID - Corresponding Express Route Circuit Id. - ID *string `json:"id,omitempty"` -} - -// ExpressRouteCircuitRoutesTable the routes table associated with the ExpressRouteCircuit. -type ExpressRouteCircuitRoutesTable struct { - // NetworkProperty - IP address of a network entity. - NetworkProperty *string `json:"network,omitempty"` - // NextHop - NextHop address. - NextHop *string `json:"nextHop,omitempty"` - // LocPrf - Local preference value as set with the set local-preference route-map configuration command. - LocPrf *string `json:"locPrf,omitempty"` - // Weight - Route Weight. - Weight *int32 `json:"weight,omitempty"` - // Path - Autonomous system paths to the destination network. - Path *string `json:"path,omitempty"` -} - -// ExpressRouteCircuitRoutesTableSummary the routes table associated with the ExpressRouteCircuit. -type ExpressRouteCircuitRoutesTableSummary struct { - // Neighbor - IP address of the neighbor. - Neighbor *string `json:"neighbor,omitempty"` - // V - BGP version number spoken to the neighbor. - V *int32 `json:"v,omitempty"` - // As - Autonomous system number. - As *int32 `json:"as,omitempty"` - // UpDown - The length of time that the BGP session has been in the Established state, or the current status if not in the Established state. - UpDown *string `json:"upDown,omitempty"` - // StatePfxRcd - Current state of the BGP session, and the number of prefixes that have been received from a neighbor or peer group. - StatePfxRcd *string `json:"statePfxRcd,omitempty"` -} - -// ExpressRouteCircuitServiceProviderProperties contains ServiceProviderProperties in an -// ExpressRouteCircuit. -type ExpressRouteCircuitServiceProviderProperties struct { - // ServiceProviderName - The serviceProviderName. - ServiceProviderName *string `json:"serviceProviderName,omitempty"` - // PeeringLocation - The peering location. - PeeringLocation *string `json:"peeringLocation,omitempty"` - // BandwidthInMbps - The BandwidthInMbps. - BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"` -} - -// ExpressRouteCircuitSku contains SKU in an ExpressRouteCircuit. -type ExpressRouteCircuitSku struct { - // Name - The name of the SKU. - Name *string `json:"name,omitempty"` - // Tier - The tier of the SKU. Possible values include: 'ExpressRouteCircuitSkuTierStandard', 'ExpressRouteCircuitSkuTierPremium', 'ExpressRouteCircuitSkuTierBasic', 'ExpressRouteCircuitSkuTierLocal' - Tier ExpressRouteCircuitSkuTier `json:"tier,omitempty"` - // Family - The family of the SKU. Possible values include: 'ExpressRouteCircuitSkuFamilyUnlimitedData', 'ExpressRouteCircuitSkuFamilyMeteredData' - Family ExpressRouteCircuitSkuFamily `json:"family,omitempty"` -} - -// ExpressRouteCircuitStats contains stats associated with the peering. -type ExpressRouteCircuitStats struct { - autorest.Response `json:"-"` - // PrimarybytesIn - The Primary BytesIn of the peering. - PrimarybytesIn *int64 `json:"primarybytesIn,omitempty"` - // PrimarybytesOut - The primary BytesOut of the peering. - PrimarybytesOut *int64 `json:"primarybytesOut,omitempty"` - // SecondarybytesIn - The secondary BytesIn of the peering. - SecondarybytesIn *int64 `json:"secondarybytesIn,omitempty"` - // SecondarybytesOut - The secondary BytesOut of the peering. - SecondarybytesOut *int64 `json:"secondarybytesOut,omitempty"` -} - -// ExpressRouteCircuitsArpTableListResult response for ListArpTable associated with the Express Route -// Circuits API. -type ExpressRouteCircuitsArpTableListResult struct { - autorest.Response `json:"-"` - // Value - A list of the ARP tables. - Value *[]ExpressRouteCircuitArpTable `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRouteCircuitsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExpressRouteCircuitsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCircuitsClient) (ExpressRouteCircuit, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCircuitsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCircuitsCreateOrUpdateFuture.Result. -func (future *ExpressRouteCircuitsCreateOrUpdateFuture) result(client ExpressRouteCircuitsClient) (erc ExpressRouteCircuit, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - erc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if erc.Response.Response, err = future.GetResult(sender); err == nil && erc.Response.Response.StatusCode != http.StatusNoContent { - erc, err = client.CreateOrUpdateResponder(erc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", erc.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRouteCircuitsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExpressRouteCircuitsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCircuitsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCircuitsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCircuitsDeleteFuture.Result. -func (future *ExpressRouteCircuitsDeleteFuture) result(client ExpressRouteCircuitsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ExpressRouteCircuitsListArpTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExpressRouteCircuitsListArpTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCircuitsClient) (ExpressRouteCircuitsArpTableListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCircuitsListArpTableFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCircuitsListArpTableFuture.Result. -func (future *ExpressRouteCircuitsListArpTableFuture) result(client ExpressRouteCircuitsClient) (ercatlr ExpressRouteCircuitsArpTableListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ercatlr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListArpTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ercatlr.Response.Response, err = future.GetResult(sender); err == nil && ercatlr.Response.Response.StatusCode != http.StatusNoContent { - ercatlr, err = client.ListArpTableResponder(ercatlr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", ercatlr.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRouteCircuitsListRoutesTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExpressRouteCircuitsListRoutesTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCircuitsClient) (ExpressRouteCircuitsRoutesTableListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCircuitsListRoutesTableFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCircuitsListRoutesTableFuture.Result. -func (future *ExpressRouteCircuitsListRoutesTableFuture) result(client ExpressRouteCircuitsClient) (ercrtlr ExpressRouteCircuitsRoutesTableListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ercrtlr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListRoutesTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ercrtlr.Response.Response, err = future.GetResult(sender); err == nil && ercrtlr.Response.Response.StatusCode != http.StatusNoContent { - ercrtlr, err = client.ListRoutesTableResponder(ercrtlr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", ercrtlr.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRouteCircuitsListRoutesTableSummaryFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ExpressRouteCircuitsListRoutesTableSummaryFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCircuitsClient) (ExpressRouteCircuitsRoutesTableSummaryListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCircuitsListRoutesTableSummaryFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCircuitsListRoutesTableSummaryFuture.Result. -func (future *ExpressRouteCircuitsListRoutesTableSummaryFuture) result(client ExpressRouteCircuitsClient) (ercrtslr ExpressRouteCircuitsRoutesTableSummaryListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ercrtslr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListRoutesTableSummaryFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ercrtslr.Response.Response, err = future.GetResult(sender); err == nil && ercrtslr.Response.Response.StatusCode != http.StatusNoContent { - ercrtslr, err = client.ListRoutesTableSummaryResponder(ercrtslr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", ercrtslr.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRouteCircuitsRoutesTableListResult response for ListRoutesTable associated with the Express Route -// Circuits API. -type ExpressRouteCircuitsRoutesTableListResult struct { - autorest.Response `json:"-"` - // Value - The list of routes table. - Value *[]ExpressRouteCircuitRoutesTable `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRouteCircuitsRoutesTableSummaryListResult response for ListRoutesTable associated with the -// Express Route Circuits API. -type ExpressRouteCircuitsRoutesTableSummaryListResult struct { - autorest.Response `json:"-"` - // Value - A list of the routes table. - Value *[]ExpressRouteCircuitRoutesTableSummary `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRouteConnection expressRouteConnection resource. -type ExpressRouteConnection struct { - autorest.Response `json:"-"` - // ExpressRouteConnectionProperties - Properties of the express route connection. - *ExpressRouteConnectionProperties `json:"properties,omitempty"` - // Name - The name of the resource. - Name *string `json:"name,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteConnection. -func (erc ExpressRouteConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erc.ExpressRouteConnectionProperties != nil { - objectMap["properties"] = erc.ExpressRouteConnectionProperties - } - if erc.Name != nil { - objectMap["name"] = erc.Name - } - if erc.ID != nil { - objectMap["id"] = erc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpressRouteConnection struct. -func (erc *ExpressRouteConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var expressRouteConnectionProperties ExpressRouteConnectionProperties - err = json.Unmarshal(*v, &expressRouteConnectionProperties) - if err != nil { - return err - } - erc.ExpressRouteConnectionProperties = &expressRouteConnectionProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - erc.Name = &name - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - erc.ID = &ID - } - } - } - - return nil -} - -// ExpressRouteConnectionID the ID of the ExpressRouteConnection. -type ExpressRouteConnectionID struct { - // ID - READ-ONLY; The ID of the ExpressRouteConnection. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteConnectionID. -func (erci ExpressRouteConnectionID) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ExpressRouteConnectionList expressRouteConnection list. -type ExpressRouteConnectionList struct { - autorest.Response `json:"-"` - // Value - The list of ExpressRoute connections. - Value *[]ExpressRouteConnection `json:"value,omitempty"` -} - -// ExpressRouteConnectionProperties properties of the ExpressRouteConnection subresource. -type ExpressRouteConnectionProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the express route connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ExpressRouteCircuitPeering - The ExpressRoute circuit peering. - ExpressRouteCircuitPeering *ExpressRouteCircuitPeeringID `json:"expressRouteCircuitPeering,omitempty"` - // AuthorizationKey - Authorization key to establish the connection. - AuthorizationKey *string `json:"authorizationKey,omitempty"` - // RoutingWeight - The routing weight associated to the connection. - RoutingWeight *int32 `json:"routingWeight,omitempty"` - // EnableInternetSecurity - Enable internet security. - EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` - // ExpressRouteGatewayBypass - Enable FastPath to vWan Firewall hub. - ExpressRouteGatewayBypass *bool `json:"expressRouteGatewayBypass,omitempty"` - // EnablePrivateLinkFastPath - Bypass the ExpressRoute gateway when accessing private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be enabled. - EnablePrivateLinkFastPath *bool `json:"enablePrivateLinkFastPath,omitempty"` - // RoutingConfiguration - The Routing Configuration indicating the associated and propagated route tables on this connection. - RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteConnectionProperties. -func (ercp ExpressRouteConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ercp.ExpressRouteCircuitPeering != nil { - objectMap["expressRouteCircuitPeering"] = ercp.ExpressRouteCircuitPeering - } - if ercp.AuthorizationKey != nil { - objectMap["authorizationKey"] = ercp.AuthorizationKey - } - if ercp.RoutingWeight != nil { - objectMap["routingWeight"] = ercp.RoutingWeight - } - if ercp.EnableInternetSecurity != nil { - objectMap["enableInternetSecurity"] = ercp.EnableInternetSecurity - } - if ercp.ExpressRouteGatewayBypass != nil { - objectMap["expressRouteGatewayBypass"] = ercp.ExpressRouteGatewayBypass - } - if ercp.EnablePrivateLinkFastPath != nil { - objectMap["enablePrivateLinkFastPath"] = ercp.EnablePrivateLinkFastPath - } - if ercp.RoutingConfiguration != nil { - objectMap["routingConfiguration"] = ercp.RoutingConfiguration - } - return json.Marshal(objectMap) -} - -// ExpressRouteConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type ExpressRouteConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteConnectionsClient) (ExpressRouteConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteConnectionsCreateOrUpdateFuture.Result. -func (future *ExpressRouteConnectionsCreateOrUpdateFuture) result(client ExpressRouteConnectionsClient) (erc ExpressRouteConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - erc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if erc.Response.Response, err = future.GetResult(sender); err == nil && erc.Response.Response.StatusCode != http.StatusNoContent { - erc, err = client.CreateOrUpdateResponder(erc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsCreateOrUpdateFuture", "Result", erc.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRouteConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExpressRouteConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteConnectionsDeleteFuture.Result. -func (future *ExpressRouteConnectionsDeleteFuture) result(client ExpressRouteConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ExpressRouteCrossConnection expressRouteCrossConnection resource. -type ExpressRouteCrossConnection struct { - autorest.Response `json:"-"` - // ExpressRouteCrossConnectionProperties - Properties of the express route cross connection. - *ExpressRouteCrossConnectionProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteCrossConnection. -func (ercc ExpressRouteCrossConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ercc.ExpressRouteCrossConnectionProperties != nil { - objectMap["properties"] = ercc.ExpressRouteCrossConnectionProperties - } - if ercc.ID != nil { - objectMap["id"] = ercc.ID - } - if ercc.Location != nil { - objectMap["location"] = ercc.Location - } - if ercc.Tags != nil { - objectMap["tags"] = ercc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpressRouteCrossConnection struct. -func (ercc *ExpressRouteCrossConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var expressRouteCrossConnectionProperties ExpressRouteCrossConnectionProperties - err = json.Unmarshal(*v, &expressRouteCrossConnectionProperties) - if err != nil { - return err - } - ercc.ExpressRouteCrossConnectionProperties = &expressRouteCrossConnectionProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ercc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ercc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ercc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ercc.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ercc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ercc.Tags = tags - } - } - } - - return nil -} - -// ExpressRouteCrossConnectionListResult response for ListExpressRouteCrossConnection API service call. -type ExpressRouteCrossConnectionListResult struct { - autorest.Response `json:"-"` - // Value - A list of ExpressRouteCrossConnection resources. - Value *[]ExpressRouteCrossConnection `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionListResult. -func (ercclr ExpressRouteCrossConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ercclr.Value != nil { - objectMap["value"] = ercclr.Value - } - return json.Marshal(objectMap) -} - -// ExpressRouteCrossConnectionListResultIterator provides access to a complete listing of -// ExpressRouteCrossConnection values. -type ExpressRouteCrossConnectionListResultIterator struct { - i int - page ExpressRouteCrossConnectionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ExpressRouteCrossConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ExpressRouteCrossConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExpressRouteCrossConnectionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ExpressRouteCrossConnectionListResultIterator) Response() ExpressRouteCrossConnectionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ExpressRouteCrossConnectionListResultIterator) Value() ExpressRouteCrossConnection { - if !iter.page.NotDone() { - return ExpressRouteCrossConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExpressRouteCrossConnectionListResultIterator type. -func NewExpressRouteCrossConnectionListResultIterator(page ExpressRouteCrossConnectionListResultPage) ExpressRouteCrossConnectionListResultIterator { - return ExpressRouteCrossConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ercclr ExpressRouteCrossConnectionListResult) IsEmpty() bool { - return ercclr.Value == nil || len(*ercclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ercclr ExpressRouteCrossConnectionListResult) hasNextLink() bool { - return ercclr.NextLink != nil && len(*ercclr.NextLink) != 0 -} - -// expressRouteCrossConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ercclr ExpressRouteCrossConnectionListResult) expressRouteCrossConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ercclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ercclr.NextLink))) -} - -// ExpressRouteCrossConnectionListResultPage contains a page of ExpressRouteCrossConnection values. -type ExpressRouteCrossConnectionListResultPage struct { - fn func(context.Context, ExpressRouteCrossConnectionListResult) (ExpressRouteCrossConnectionListResult, error) - ercclr ExpressRouteCrossConnectionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ExpressRouteCrossConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ercclr) - if err != nil { - return err - } - page.ercclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ExpressRouteCrossConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExpressRouteCrossConnectionListResultPage) NotDone() bool { - return !page.ercclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExpressRouteCrossConnectionListResultPage) Response() ExpressRouteCrossConnectionListResult { - return page.ercclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExpressRouteCrossConnectionListResultPage) Values() []ExpressRouteCrossConnection { - if page.ercclr.IsEmpty() { - return nil - } - return *page.ercclr.Value -} - -// Creates a new instance of the ExpressRouteCrossConnectionListResultPage type. -func NewExpressRouteCrossConnectionListResultPage(cur ExpressRouteCrossConnectionListResult, getNextPage func(context.Context, ExpressRouteCrossConnectionListResult) (ExpressRouteCrossConnectionListResult, error)) ExpressRouteCrossConnectionListResultPage { - return ExpressRouteCrossConnectionListResultPage{ - fn: getNextPage, - ercclr: cur, - } -} - -// ExpressRouteCrossConnectionPeering peering in an ExpressRoute Cross Connection resource. -type ExpressRouteCrossConnectionPeering struct { - autorest.Response `json:"-"` - // ExpressRouteCrossConnectionPeeringProperties - Properties of the express route cross connection peering. - *ExpressRouteCrossConnectionPeeringProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionPeering. -func (erccp ExpressRouteCrossConnectionPeering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erccp.ExpressRouteCrossConnectionPeeringProperties != nil { - objectMap["properties"] = erccp.ExpressRouteCrossConnectionPeeringProperties - } - if erccp.Name != nil { - objectMap["name"] = erccp.Name - } - if erccp.ID != nil { - objectMap["id"] = erccp.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpressRouteCrossConnectionPeering struct. -func (erccp *ExpressRouteCrossConnectionPeering) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var expressRouteCrossConnectionPeeringProperties ExpressRouteCrossConnectionPeeringProperties - err = json.Unmarshal(*v, &expressRouteCrossConnectionPeeringProperties) - if err != nil { - return err - } - erccp.ExpressRouteCrossConnectionPeeringProperties = &expressRouteCrossConnectionPeeringProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - erccp.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - erccp.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - erccp.ID = &ID - } - } - } - - return nil -} - -// ExpressRouteCrossConnectionPeeringList response for ListPeering API service call retrieves all peerings -// that belong to an ExpressRouteCrossConnection. -type ExpressRouteCrossConnectionPeeringList struct { - autorest.Response `json:"-"` - // Value - The peerings in an express route cross connection. - Value *[]ExpressRouteCrossConnectionPeering `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionPeeringList. -func (erccpl ExpressRouteCrossConnectionPeeringList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erccpl.Value != nil { - objectMap["value"] = erccpl.Value - } - return json.Marshal(objectMap) -} - -// ExpressRouteCrossConnectionPeeringListIterator provides access to a complete listing of -// ExpressRouteCrossConnectionPeering values. -type ExpressRouteCrossConnectionPeeringListIterator struct { - i int - page ExpressRouteCrossConnectionPeeringListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ExpressRouteCrossConnectionPeeringListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionPeeringListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ExpressRouteCrossConnectionPeeringListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExpressRouteCrossConnectionPeeringListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ExpressRouteCrossConnectionPeeringListIterator) Response() ExpressRouteCrossConnectionPeeringList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ExpressRouteCrossConnectionPeeringListIterator) Value() ExpressRouteCrossConnectionPeering { - if !iter.page.NotDone() { - return ExpressRouteCrossConnectionPeering{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExpressRouteCrossConnectionPeeringListIterator type. -func NewExpressRouteCrossConnectionPeeringListIterator(page ExpressRouteCrossConnectionPeeringListPage) ExpressRouteCrossConnectionPeeringListIterator { - return ExpressRouteCrossConnectionPeeringListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (erccpl ExpressRouteCrossConnectionPeeringList) IsEmpty() bool { - return erccpl.Value == nil || len(*erccpl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (erccpl ExpressRouteCrossConnectionPeeringList) hasNextLink() bool { - return erccpl.NextLink != nil && len(*erccpl.NextLink) != 0 -} - -// expressRouteCrossConnectionPeeringListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (erccpl ExpressRouteCrossConnectionPeeringList) expressRouteCrossConnectionPeeringListPreparer(ctx context.Context) (*http.Request, error) { - if !erccpl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(erccpl.NextLink))) -} - -// ExpressRouteCrossConnectionPeeringListPage contains a page of ExpressRouteCrossConnectionPeering values. -type ExpressRouteCrossConnectionPeeringListPage struct { - fn func(context.Context, ExpressRouteCrossConnectionPeeringList) (ExpressRouteCrossConnectionPeeringList, error) - erccpl ExpressRouteCrossConnectionPeeringList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ExpressRouteCrossConnectionPeeringListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionPeeringListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.erccpl) - if err != nil { - return err - } - page.erccpl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ExpressRouteCrossConnectionPeeringListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExpressRouteCrossConnectionPeeringListPage) NotDone() bool { - return !page.erccpl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExpressRouteCrossConnectionPeeringListPage) Response() ExpressRouteCrossConnectionPeeringList { - return page.erccpl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExpressRouteCrossConnectionPeeringListPage) Values() []ExpressRouteCrossConnectionPeering { - if page.erccpl.IsEmpty() { - return nil - } - return *page.erccpl.Value -} - -// Creates a new instance of the ExpressRouteCrossConnectionPeeringListPage type. -func NewExpressRouteCrossConnectionPeeringListPage(cur ExpressRouteCrossConnectionPeeringList, getNextPage func(context.Context, ExpressRouteCrossConnectionPeeringList) (ExpressRouteCrossConnectionPeeringList, error)) ExpressRouteCrossConnectionPeeringListPage { - return ExpressRouteCrossConnectionPeeringListPage{ - fn: getNextPage, - erccpl: cur, - } -} - -// ExpressRouteCrossConnectionPeeringProperties properties of express route cross connection peering. -type ExpressRouteCrossConnectionPeeringProperties struct { - // PeeringType - The peering type. Possible values include: 'ExpressRoutePeeringTypeAzurePublicPeering', 'ExpressRoutePeeringTypeAzurePrivatePeering', 'ExpressRoutePeeringTypeMicrosoftPeering' - PeeringType ExpressRoutePeeringType `json:"peeringType,omitempty"` - // State - The peering state. Possible values include: 'ExpressRoutePeeringStateDisabled', 'ExpressRoutePeeringStateEnabled' - State ExpressRoutePeeringState `json:"state,omitempty"` - // AzureASN - READ-ONLY; The Azure ASN. - AzureASN *int32 `json:"azureASN,omitempty"` - // PeerASN - The peer ASN. - PeerASN *int64 `json:"peerASN,omitempty"` - // PrimaryPeerAddressPrefix - The primary address prefix. - PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` - // SecondaryPeerAddressPrefix - The secondary address prefix. - SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"` - // PrimaryAzurePort - READ-ONLY; The primary port. - PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` - // SecondaryAzurePort - READ-ONLY; The secondary port. - SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` - // SharedKey - The shared key. - SharedKey *string `json:"sharedKey,omitempty"` - // VlanID - The VLAN ID. - VlanID *int32 `json:"vlanId,omitempty"` - // MicrosoftPeeringConfig - The Microsoft peering configuration. - MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the express route cross connection peering resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // GatewayManagerEtag - The GatewayManager Etag. - GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` - // LastModifiedBy - READ-ONLY; Who was the last to modify the peering. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // Ipv6PeeringConfig - The IPv6 peering configuration. - Ipv6PeeringConfig *Ipv6ExpressRouteCircuitPeeringConfig `json:"ipv6PeeringConfig,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionPeeringProperties. -func (erccpp ExpressRouteCrossConnectionPeeringProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erccpp.PeeringType != "" { - objectMap["peeringType"] = erccpp.PeeringType - } - if erccpp.State != "" { - objectMap["state"] = erccpp.State - } - if erccpp.PeerASN != nil { - objectMap["peerASN"] = erccpp.PeerASN - } - if erccpp.PrimaryPeerAddressPrefix != nil { - objectMap["primaryPeerAddressPrefix"] = erccpp.PrimaryPeerAddressPrefix - } - if erccpp.SecondaryPeerAddressPrefix != nil { - objectMap["secondaryPeerAddressPrefix"] = erccpp.SecondaryPeerAddressPrefix - } - if erccpp.SharedKey != nil { - objectMap["sharedKey"] = erccpp.SharedKey - } - if erccpp.VlanID != nil { - objectMap["vlanId"] = erccpp.VlanID - } - if erccpp.MicrosoftPeeringConfig != nil { - objectMap["microsoftPeeringConfig"] = erccpp.MicrosoftPeeringConfig - } - if erccpp.GatewayManagerEtag != nil { - objectMap["gatewayManagerEtag"] = erccpp.GatewayManagerEtag - } - if erccpp.Ipv6PeeringConfig != nil { - objectMap["ipv6PeeringConfig"] = erccpp.Ipv6PeeringConfig - } - return json.Marshal(objectMap) -} - -// ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCrossConnectionPeeringsClient) (ExpressRouteCrossConnectionPeering, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture.Result. -func (future *ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture) result(client ExpressRouteCrossConnectionPeeringsClient) (erccp ExpressRouteCrossConnectionPeering, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - erccp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if erccp.Response.Response, err = future.GetResult(sender); err == nil && erccp.Response.Response.StatusCode != http.StatusNoContent { - erccp, err = client.CreateOrUpdateResponder(erccp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture", "Result", erccp.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRouteCrossConnectionPeeringsDeleteFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ExpressRouteCrossConnectionPeeringsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCrossConnectionPeeringsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCrossConnectionPeeringsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCrossConnectionPeeringsDeleteFuture.Result. -func (future *ExpressRouteCrossConnectionPeeringsDeleteFuture) result(client ExpressRouteCrossConnectionPeeringsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionPeeringsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ExpressRouteCrossConnectionProperties properties of ExpressRouteCrossConnection. -type ExpressRouteCrossConnectionProperties struct { - // PrimaryAzurePort - READ-ONLY; The name of the primary port. - PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` - // SecondaryAzurePort - READ-ONLY; The name of the secondary port. - SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` - // STag - READ-ONLY; The identifier of the circuit traffic. - STag *int32 `json:"sTag,omitempty"` - // PeeringLocation - READ-ONLY; The peering location of the ExpressRoute circuit. - PeeringLocation *string `json:"peeringLocation,omitempty"` - // BandwidthInMbps - READ-ONLY; The circuit bandwidth In Mbps. - BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"` - // ExpressRouteCircuit - The ExpressRouteCircuit. - ExpressRouteCircuit *ExpressRouteCircuitReference `json:"expressRouteCircuit,omitempty"` - // ServiceProviderProvisioningState - The provisioning state of the circuit in the connectivity provider system. Possible values include: 'ServiceProviderProvisioningStateNotProvisioned', 'ServiceProviderProvisioningStateProvisioning', 'ServiceProviderProvisioningStateProvisioned', 'ServiceProviderProvisioningStateDeprovisioning' - ServiceProviderProvisioningState ServiceProviderProvisioningState `json:"serviceProviderProvisioningState,omitempty"` - // ServiceProviderNotes - Additional read only notes set by the connectivity provider. - ServiceProviderNotes *string `json:"serviceProviderNotes,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the express route cross connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Peerings - The list of peerings. - Peerings *[]ExpressRouteCrossConnectionPeering `json:"peerings,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionProperties. -func (erccp ExpressRouteCrossConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erccp.ExpressRouteCircuit != nil { - objectMap["expressRouteCircuit"] = erccp.ExpressRouteCircuit - } - if erccp.ServiceProviderProvisioningState != "" { - objectMap["serviceProviderProvisioningState"] = erccp.ServiceProviderProvisioningState - } - if erccp.ServiceProviderNotes != nil { - objectMap["serviceProviderNotes"] = erccp.ServiceProviderNotes - } - if erccp.Peerings != nil { - objectMap["peerings"] = erccp.Peerings - } - return json.Marshal(objectMap) -} - -// ExpressRouteCrossConnectionRoutesTableSummary the routes table associated with the ExpressRouteCircuit. -type ExpressRouteCrossConnectionRoutesTableSummary struct { - // Neighbor - IP address of Neighbor router. - Neighbor *string `json:"neighbor,omitempty"` - // Asn - Autonomous system number. - Asn *int32 `json:"asn,omitempty"` - // UpDown - The length of time that the BGP session has been in the Established state, or the current status if not in the Established state. - UpDown *string `json:"upDown,omitempty"` - // StateOrPrefixesReceived - Current state of the BGP session, and the number of prefixes that have been received from a neighbor or peer group. - StateOrPrefixesReceived *string `json:"stateOrPrefixesReceived,omitempty"` -} - -// ExpressRouteCrossConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ExpressRouteCrossConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCrossConnectionsClient) (ExpressRouteCrossConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCrossConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCrossConnectionsCreateOrUpdateFuture.Result. -func (future *ExpressRouteCrossConnectionsCreateOrUpdateFuture) result(client ExpressRouteCrossConnectionsClient) (ercc ExpressRouteCrossConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ercc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ercc.Response.Response, err = future.GetResult(sender); err == nil && ercc.Response.Response.StatusCode != http.StatusNoContent { - ercc, err = client.CreateOrUpdateResponder(ercc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsCreateOrUpdateFuture", "Result", ercc.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRouteCrossConnectionsListArpTableFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ExpressRouteCrossConnectionsListArpTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCrossConnectionsClient) (ExpressRouteCircuitsArpTableListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCrossConnectionsListArpTableFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCrossConnectionsListArpTableFuture.Result. -func (future *ExpressRouteCrossConnectionsListArpTableFuture) result(client ExpressRouteCrossConnectionsClient) (ercatlr ExpressRouteCircuitsArpTableListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListArpTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ercatlr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsListArpTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ercatlr.Response.Response, err = future.GetResult(sender); err == nil && ercatlr.Response.Response.StatusCode != http.StatusNoContent { - ercatlr, err = client.ListArpTableResponder(ercatlr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListArpTableFuture", "Result", ercatlr.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRouteCrossConnectionsListRoutesTableFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ExpressRouteCrossConnectionsListRoutesTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCrossConnectionsClient) (ExpressRouteCircuitsRoutesTableListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCrossConnectionsListRoutesTableFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCrossConnectionsListRoutesTableFuture.Result. -func (future *ExpressRouteCrossConnectionsListRoutesTableFuture) result(client ExpressRouteCrossConnectionsClient) (ercrtlr ExpressRouteCircuitsRoutesTableListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ercrtlr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsListRoutesTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ercrtlr.Response.Response, err = future.GetResult(sender); err == nil && ercrtlr.Response.Response.StatusCode != http.StatusNoContent { - ercrtlr, err = client.ListRoutesTableResponder(ercrtlr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableFuture", "Result", ercrtlr.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRouteCrossConnectionsListRoutesTableSummaryFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type ExpressRouteCrossConnectionsListRoutesTableSummaryFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteCrossConnectionsClient) (ExpressRouteCrossConnectionsRoutesTableSummaryListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteCrossConnectionsListRoutesTableSummaryFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteCrossConnectionsListRoutesTableSummaryFuture.Result. -func (future *ExpressRouteCrossConnectionsListRoutesTableSummaryFuture) result(client ExpressRouteCrossConnectionsClient) (erccrtslr ExpressRouteCrossConnectionsRoutesTableSummaryListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - erccrtslr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if erccrtslr.Response.Response, err = future.GetResult(sender); err == nil && erccrtslr.Response.Response.StatusCode != http.StatusNoContent { - erccrtslr, err = client.ListRoutesTableSummaryResponder(erccrtslr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture", "Result", erccrtslr.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRouteCrossConnectionsRoutesTableSummaryListResult response for ListRoutesTable associated with -// the Express Route Cross Connections. -type ExpressRouteCrossConnectionsRoutesTableSummaryListResult struct { - autorest.Response `json:"-"` - // Value - A list of the routes table. - Value *[]ExpressRouteCrossConnectionRoutesTableSummary `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionsRoutesTableSummaryListResult. -func (erccrtslr ExpressRouteCrossConnectionsRoutesTableSummaryListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erccrtslr.Value != nil { - objectMap["value"] = erccrtslr.Value - } - return json.Marshal(objectMap) -} - -// ExpressRouteGateway expressRoute gateway resource. -type ExpressRouteGateway struct { - autorest.Response `json:"-"` - // ExpressRouteGatewayProperties - Properties of the express route gateway. - *ExpressRouteGatewayProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteGateway. -func (erg ExpressRouteGateway) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erg.ExpressRouteGatewayProperties != nil { - objectMap["properties"] = erg.ExpressRouteGatewayProperties - } - if erg.ID != nil { - objectMap["id"] = erg.ID - } - if erg.Location != nil { - objectMap["location"] = erg.Location - } - if erg.Tags != nil { - objectMap["tags"] = erg.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpressRouteGateway struct. -func (erg *ExpressRouteGateway) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var expressRouteGatewayProperties ExpressRouteGatewayProperties - err = json.Unmarshal(*v, &expressRouteGatewayProperties) - if err != nil { - return err - } - erg.ExpressRouteGatewayProperties = &expressRouteGatewayProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - erg.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - erg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - erg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - erg.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - erg.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - erg.Tags = tags - } - } - } - - return nil -} - -// ExpressRouteGatewayList list of ExpressRoute gateways. -type ExpressRouteGatewayList struct { - autorest.Response `json:"-"` - // Value - List of ExpressRoute gateways. - Value *[]ExpressRouteGateway `json:"value,omitempty"` -} - -// ExpressRouteGatewayProperties expressRoute gateway resource properties. -type ExpressRouteGatewayProperties struct { - // AutoScaleConfiguration - Configuration for auto scaling. - AutoScaleConfiguration *ExpressRouteGatewayPropertiesAutoScaleConfiguration `json:"autoScaleConfiguration,omitempty"` - // ExpressRouteConnections - List of ExpressRoute connections to the ExpressRoute gateway. - ExpressRouteConnections *[]ExpressRouteConnection `json:"expressRouteConnections,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the express route gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // VirtualHub - The Virtual Hub where the ExpressRoute gateway is or will be deployed. - VirtualHub *VirtualHubID `json:"virtualHub,omitempty"` - // AllowNonVirtualWanTraffic - Configures this gateway to accept traffic from non Virtual WAN networks. - AllowNonVirtualWanTraffic *bool `json:"allowNonVirtualWanTraffic,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteGatewayProperties. -func (ergp ExpressRouteGatewayProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ergp.AutoScaleConfiguration != nil { - objectMap["autoScaleConfiguration"] = ergp.AutoScaleConfiguration - } - if ergp.ExpressRouteConnections != nil { - objectMap["expressRouteConnections"] = ergp.ExpressRouteConnections - } - if ergp.VirtualHub != nil { - objectMap["virtualHub"] = ergp.VirtualHub - } - if ergp.AllowNonVirtualWanTraffic != nil { - objectMap["allowNonVirtualWanTraffic"] = ergp.AllowNonVirtualWanTraffic - } - return json.Marshal(objectMap) -} - -// ExpressRouteGatewayPropertiesAutoScaleConfiguration configuration for auto scaling. -type ExpressRouteGatewayPropertiesAutoScaleConfiguration struct { - // Bounds - Minimum and maximum number of scale units to deploy. - Bounds *ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds `json:"bounds,omitempty"` -} - -// ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds minimum and maximum number of scale units to -// deploy. -type ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds struct { - // Min - Minimum number of scale units deployed for ExpressRoute gateway. - Min *int32 `json:"min,omitempty"` - // Max - Maximum number of scale units deployed for ExpressRoute gateway. - Max *int32 `json:"max,omitempty"` -} - -// ExpressRouteGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExpressRouteGatewaysCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteGatewaysClient) (ExpressRouteGateway, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteGatewaysCreateOrUpdateFuture.Result. -func (future *ExpressRouteGatewaysCreateOrUpdateFuture) result(client ExpressRouteGatewaysClient) (erg ExpressRouteGateway, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - erg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteGatewaysCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if erg.Response.Response, err = future.GetResult(sender); err == nil && erg.Response.Response.StatusCode != http.StatusNoContent { - erg, err = client.CreateOrUpdateResponder(erg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysCreateOrUpdateFuture", "Result", erg.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRouteGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExpressRouteGatewaysDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteGatewaysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteGatewaysDeleteFuture.Result. -func (future *ExpressRouteGatewaysDeleteFuture) result(client ExpressRouteGatewaysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteGatewaysDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ExpressRouteGatewaysUpdateTagsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExpressRouteGatewaysUpdateTagsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRouteGatewaysClient) (ExpressRouteGateway, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRouteGatewaysUpdateTagsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRouteGatewaysUpdateTagsFuture.Result. -func (future *ExpressRouteGatewaysUpdateTagsFuture) result(client ExpressRouteGatewaysClient) (erg ExpressRouteGateway, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysUpdateTagsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - erg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRouteGatewaysUpdateTagsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if erg.Response.Response, err = future.GetResult(sender); err == nil && erg.Response.Response.StatusCode != http.StatusNoContent { - erg, err = client.UpdateTagsResponder(erg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysUpdateTagsFuture", "Result", erg.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRouteLink expressRouteLink child resource definition. -type ExpressRouteLink struct { - autorest.Response `json:"-"` - // ExpressRouteLinkPropertiesFormat - ExpressRouteLink properties. - *ExpressRouteLinkPropertiesFormat `json:"properties,omitempty"` - // Name - Name of child port resource that is unique among child port resources of the parent. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteLink. -func (erl ExpressRouteLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erl.ExpressRouteLinkPropertiesFormat != nil { - objectMap["properties"] = erl.ExpressRouteLinkPropertiesFormat - } - if erl.Name != nil { - objectMap["name"] = erl.Name - } - if erl.ID != nil { - objectMap["id"] = erl.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpressRouteLink struct. -func (erl *ExpressRouteLink) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var expressRouteLinkPropertiesFormat ExpressRouteLinkPropertiesFormat - err = json.Unmarshal(*v, &expressRouteLinkPropertiesFormat) - if err != nil { - return err - } - erl.ExpressRouteLinkPropertiesFormat = &expressRouteLinkPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - erl.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - erl.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - erl.ID = &ID - } - } - } - - return nil -} - -// ExpressRouteLinkListResult response for ListExpressRouteLinks API service call. -type ExpressRouteLinkListResult struct { - autorest.Response `json:"-"` - // Value - The list of ExpressRouteLink sub-resources. - Value *[]ExpressRouteLink `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRouteLinkListResultIterator provides access to a complete listing of ExpressRouteLink values. -type ExpressRouteLinkListResultIterator struct { - i int - page ExpressRouteLinkListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ExpressRouteLinkListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteLinkListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ExpressRouteLinkListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExpressRouteLinkListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ExpressRouteLinkListResultIterator) Response() ExpressRouteLinkListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ExpressRouteLinkListResultIterator) Value() ExpressRouteLink { - if !iter.page.NotDone() { - return ExpressRouteLink{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExpressRouteLinkListResultIterator type. -func NewExpressRouteLinkListResultIterator(page ExpressRouteLinkListResultPage) ExpressRouteLinkListResultIterator { - return ExpressRouteLinkListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (erllr ExpressRouteLinkListResult) IsEmpty() bool { - return erllr.Value == nil || len(*erllr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (erllr ExpressRouteLinkListResult) hasNextLink() bool { - return erllr.NextLink != nil && len(*erllr.NextLink) != 0 -} - -// expressRouteLinkListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (erllr ExpressRouteLinkListResult) expressRouteLinkListResultPreparer(ctx context.Context) (*http.Request, error) { - if !erllr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(erllr.NextLink))) -} - -// ExpressRouteLinkListResultPage contains a page of ExpressRouteLink values. -type ExpressRouteLinkListResultPage struct { - fn func(context.Context, ExpressRouteLinkListResult) (ExpressRouteLinkListResult, error) - erllr ExpressRouteLinkListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ExpressRouteLinkListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteLinkListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.erllr) - if err != nil { - return err - } - page.erllr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ExpressRouteLinkListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExpressRouteLinkListResultPage) NotDone() bool { - return !page.erllr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExpressRouteLinkListResultPage) Response() ExpressRouteLinkListResult { - return page.erllr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExpressRouteLinkListResultPage) Values() []ExpressRouteLink { - if page.erllr.IsEmpty() { - return nil - } - return *page.erllr.Value -} - -// Creates a new instance of the ExpressRouteLinkListResultPage type. -func NewExpressRouteLinkListResultPage(cur ExpressRouteLinkListResult, getNextPage func(context.Context, ExpressRouteLinkListResult) (ExpressRouteLinkListResult, error)) ExpressRouteLinkListResultPage { - return ExpressRouteLinkListResultPage{ - fn: getNextPage, - erllr: cur, - } -} - -// ExpressRouteLinkMacSecConfig expressRouteLink Mac Security Configuration. -type ExpressRouteLinkMacSecConfig struct { - // CknSecretIdentifier - Keyvault Secret Identifier URL containing Mac security CKN key. - CknSecretIdentifier *string `json:"cknSecretIdentifier,omitempty"` - // CakSecretIdentifier - Keyvault Secret Identifier URL containing Mac security CAK key. - CakSecretIdentifier *string `json:"cakSecretIdentifier,omitempty"` - // Cipher - Mac security cipher. Possible values include: 'ExpressRouteLinkMacSecCipherGcmAes256', 'ExpressRouteLinkMacSecCipherGcmAes128', 'ExpressRouteLinkMacSecCipherGcmAesXpn128', 'ExpressRouteLinkMacSecCipherGcmAesXpn256' - Cipher ExpressRouteLinkMacSecCipher `json:"cipher,omitempty"` - // SciState - Sci mode enabled/disabled. Possible values include: 'ExpressRouteLinkMacSecSciStateDisabled', 'ExpressRouteLinkMacSecSciStateEnabled' - SciState ExpressRouteLinkMacSecSciState `json:"sciState,omitempty"` -} - -// ExpressRouteLinkPropertiesFormat properties specific to ExpressRouteLink resources. -type ExpressRouteLinkPropertiesFormat struct { - // RouterName - READ-ONLY; Name of Azure router associated with physical port. - RouterName *string `json:"routerName,omitempty"` - // InterfaceName - READ-ONLY; Name of Azure router interface. - InterfaceName *string `json:"interfaceName,omitempty"` - // PatchPanelID - READ-ONLY; Mapping between physical port to patch panel port. - PatchPanelID *string `json:"patchPanelId,omitempty"` - // RackID - READ-ONLY; Mapping of physical patch panel to rack. - RackID *string `json:"rackId,omitempty"` - // ColoLocation - READ-ONLY; Cololocation for ExpressRoute Hybrid Direct. - ColoLocation *string `json:"coloLocation,omitempty"` - // ConnectorType - READ-ONLY; Physical fiber port type. Possible values include: 'ExpressRouteLinkConnectorTypeLC', 'ExpressRouteLinkConnectorTypeSC' - ConnectorType ExpressRouteLinkConnectorType `json:"connectorType,omitempty"` - // AdminState - Administrative state of the physical port. Possible values include: 'ExpressRouteLinkAdminStateEnabled', 'ExpressRouteLinkAdminStateDisabled' - AdminState ExpressRouteLinkAdminState `json:"adminState,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the express route link resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // MacSecConfig - MacSec configuration. - MacSecConfig *ExpressRouteLinkMacSecConfig `json:"macSecConfig,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteLinkPropertiesFormat. -func (erlpf ExpressRouteLinkPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erlpf.AdminState != "" { - objectMap["adminState"] = erlpf.AdminState - } - if erlpf.MacSecConfig != nil { - objectMap["macSecConfig"] = erlpf.MacSecConfig - } - return json.Marshal(objectMap) -} - -// ExpressRoutePort expressRoutePort resource definition. -type ExpressRoutePort struct { - autorest.Response `json:"-"` - // ExpressRoutePortPropertiesFormat - ExpressRoutePort properties. - *ExpressRoutePortPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Identity - The identity of ExpressRoutePort, if configured. - Identity *ManagedServiceIdentity `json:"identity,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ExpressRoutePort. -func (erp ExpressRoutePort) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erp.ExpressRoutePortPropertiesFormat != nil { - objectMap["properties"] = erp.ExpressRoutePortPropertiesFormat - } - if erp.Identity != nil { - objectMap["identity"] = erp.Identity - } - if erp.ID != nil { - objectMap["id"] = erp.ID - } - if erp.Location != nil { - objectMap["location"] = erp.Location - } - if erp.Tags != nil { - objectMap["tags"] = erp.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpressRoutePort struct. -func (erp *ExpressRoutePort) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var expressRoutePortPropertiesFormat ExpressRoutePortPropertiesFormat - err = json.Unmarshal(*v, &expressRoutePortPropertiesFormat) - if err != nil { - return err - } - erp.ExpressRoutePortPropertiesFormat = &expressRoutePortPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - erp.Etag = &etag - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - erp.Identity = &identity - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - erp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - erp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - erp.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - erp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - erp.Tags = tags - } - } - } - - return nil -} - -// ExpressRoutePortAuthorization expressRoutePort Authorization resource definition. -type ExpressRoutePortAuthorization struct { - autorest.Response `json:"-"` - // ExpressRoutePortAuthorizationPropertiesFormat - ExpressRoutePort properties. - *ExpressRoutePortAuthorizationPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRoutePortAuthorization. -func (erpa ExpressRoutePortAuthorization) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erpa.ExpressRoutePortAuthorizationPropertiesFormat != nil { - objectMap["properties"] = erpa.ExpressRoutePortAuthorizationPropertiesFormat - } - if erpa.Name != nil { - objectMap["name"] = erpa.Name - } - if erpa.ID != nil { - objectMap["id"] = erpa.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpressRoutePortAuthorization struct. -func (erpa *ExpressRoutePortAuthorization) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var expressRoutePortAuthorizationPropertiesFormat ExpressRoutePortAuthorizationPropertiesFormat - err = json.Unmarshal(*v, &expressRoutePortAuthorizationPropertiesFormat) - if err != nil { - return err - } - erpa.ExpressRoutePortAuthorizationPropertiesFormat = &expressRoutePortAuthorizationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - erpa.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - erpa.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - erpa.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - erpa.ID = &ID - } - } - } - - return nil -} - -// ExpressRoutePortAuthorizationListResult response for ListExpressRoutePortAuthorizations API service -// call. -type ExpressRoutePortAuthorizationListResult struct { - autorest.Response `json:"-"` - // Value - The authorizations in an ExpressRoute Port. - Value *[]ExpressRoutePortAuthorization `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRoutePortAuthorizationListResultIterator provides access to a complete listing of -// ExpressRoutePortAuthorization values. -type ExpressRoutePortAuthorizationListResultIterator struct { - i int - page ExpressRoutePortAuthorizationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ExpressRoutePortAuthorizationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortAuthorizationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ExpressRoutePortAuthorizationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExpressRoutePortAuthorizationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ExpressRoutePortAuthorizationListResultIterator) Response() ExpressRoutePortAuthorizationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ExpressRoutePortAuthorizationListResultIterator) Value() ExpressRoutePortAuthorization { - if !iter.page.NotDone() { - return ExpressRoutePortAuthorization{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExpressRoutePortAuthorizationListResultIterator type. -func NewExpressRoutePortAuthorizationListResultIterator(page ExpressRoutePortAuthorizationListResultPage) ExpressRoutePortAuthorizationListResultIterator { - return ExpressRoutePortAuthorizationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (erpalr ExpressRoutePortAuthorizationListResult) IsEmpty() bool { - return erpalr.Value == nil || len(*erpalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (erpalr ExpressRoutePortAuthorizationListResult) hasNextLink() bool { - return erpalr.NextLink != nil && len(*erpalr.NextLink) != 0 -} - -// expressRoutePortAuthorizationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (erpalr ExpressRoutePortAuthorizationListResult) expressRoutePortAuthorizationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !erpalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(erpalr.NextLink))) -} - -// ExpressRoutePortAuthorizationListResultPage contains a page of ExpressRoutePortAuthorization values. -type ExpressRoutePortAuthorizationListResultPage struct { - fn func(context.Context, ExpressRoutePortAuthorizationListResult) (ExpressRoutePortAuthorizationListResult, error) - erpalr ExpressRoutePortAuthorizationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ExpressRoutePortAuthorizationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortAuthorizationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.erpalr) - if err != nil { - return err - } - page.erpalr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ExpressRoutePortAuthorizationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExpressRoutePortAuthorizationListResultPage) NotDone() bool { - return !page.erpalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExpressRoutePortAuthorizationListResultPage) Response() ExpressRoutePortAuthorizationListResult { - return page.erpalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExpressRoutePortAuthorizationListResultPage) Values() []ExpressRoutePortAuthorization { - if page.erpalr.IsEmpty() { - return nil - } - return *page.erpalr.Value -} - -// Creates a new instance of the ExpressRoutePortAuthorizationListResultPage type. -func NewExpressRoutePortAuthorizationListResultPage(cur ExpressRoutePortAuthorizationListResult, getNextPage func(context.Context, ExpressRoutePortAuthorizationListResult) (ExpressRoutePortAuthorizationListResult, error)) ExpressRoutePortAuthorizationListResultPage { - return ExpressRoutePortAuthorizationListResultPage{ - fn: getNextPage, - erpalr: cur, - } -} - -// ExpressRoutePortAuthorizationPropertiesFormat properties of ExpressRoutePort Authorization. -type ExpressRoutePortAuthorizationPropertiesFormat struct { - // AuthorizationKey - READ-ONLY; The authorization key. - AuthorizationKey *string `json:"authorizationKey,omitempty"` - // AuthorizationUseStatus - READ-ONLY; The authorization use status. Possible values include: 'ExpressRoutePortAuthorizationUseStatusAvailable', 'ExpressRoutePortAuthorizationUseStatusInUse' - AuthorizationUseStatus ExpressRoutePortAuthorizationUseStatus `json:"authorizationUseStatus,omitempty"` - // CircuitResourceURI - READ-ONLY; The reference to the ExpressRoute circuit resource using the authorization. - CircuitResourceURI *string `json:"circuitResourceUri,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the authorization resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRoutePortAuthorizationPropertiesFormat. -func (erpapf ExpressRoutePortAuthorizationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ExpressRoutePortAuthorizationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ExpressRoutePortAuthorizationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRoutePortAuthorizationsClient) (ExpressRoutePortAuthorization, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRoutePortAuthorizationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRoutePortAuthorizationsCreateOrUpdateFuture.Result. -func (future *ExpressRoutePortAuthorizationsCreateOrUpdateFuture) result(client ExpressRoutePortAuthorizationsClient) (erpa ExpressRoutePortAuthorization, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - erpa.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRoutePortAuthorizationsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if erpa.Response.Response, err = future.GetResult(sender); err == nil && erpa.Response.Response.StatusCode != http.StatusNoContent { - erpa, err = client.CreateOrUpdateResponder(erpa.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsCreateOrUpdateFuture", "Result", erpa.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRoutePortAuthorizationsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExpressRoutePortAuthorizationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRoutePortAuthorizationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRoutePortAuthorizationsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRoutePortAuthorizationsDeleteFuture.Result. -func (future *ExpressRoutePortAuthorizationsDeleteFuture) result(client ExpressRoutePortAuthorizationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRoutePortAuthorizationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ExpressRoutePortListResult response for ListExpressRoutePorts API service call. -type ExpressRoutePortListResult struct { - autorest.Response `json:"-"` - // Value - A list of ExpressRoutePort resources. - Value *[]ExpressRoutePort `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRoutePortListResultIterator provides access to a complete listing of ExpressRoutePort values. -type ExpressRoutePortListResultIterator struct { - i int - page ExpressRoutePortListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ExpressRoutePortListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ExpressRoutePortListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExpressRoutePortListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ExpressRoutePortListResultIterator) Response() ExpressRoutePortListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ExpressRoutePortListResultIterator) Value() ExpressRoutePort { - if !iter.page.NotDone() { - return ExpressRoutePort{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExpressRoutePortListResultIterator type. -func NewExpressRoutePortListResultIterator(page ExpressRoutePortListResultPage) ExpressRoutePortListResultIterator { - return ExpressRoutePortListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (erplr ExpressRoutePortListResult) IsEmpty() bool { - return erplr.Value == nil || len(*erplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (erplr ExpressRoutePortListResult) hasNextLink() bool { - return erplr.NextLink != nil && len(*erplr.NextLink) != 0 -} - -// expressRoutePortListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (erplr ExpressRoutePortListResult) expressRoutePortListResultPreparer(ctx context.Context) (*http.Request, error) { - if !erplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(erplr.NextLink))) -} - -// ExpressRoutePortListResultPage contains a page of ExpressRoutePort values. -type ExpressRoutePortListResultPage struct { - fn func(context.Context, ExpressRoutePortListResult) (ExpressRoutePortListResult, error) - erplr ExpressRoutePortListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ExpressRoutePortListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.erplr) - if err != nil { - return err - } - page.erplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ExpressRoutePortListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExpressRoutePortListResultPage) NotDone() bool { - return !page.erplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExpressRoutePortListResultPage) Response() ExpressRoutePortListResult { - return page.erplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExpressRoutePortListResultPage) Values() []ExpressRoutePort { - if page.erplr.IsEmpty() { - return nil - } - return *page.erplr.Value -} - -// Creates a new instance of the ExpressRoutePortListResultPage type. -func NewExpressRoutePortListResultPage(cur ExpressRoutePortListResult, getNextPage func(context.Context, ExpressRoutePortListResult) (ExpressRoutePortListResult, error)) ExpressRoutePortListResultPage { - return ExpressRoutePortListResultPage{ - fn: getNextPage, - erplr: cur, - } -} - -// ExpressRoutePortPropertiesFormat properties specific to ExpressRoutePort resources. -type ExpressRoutePortPropertiesFormat struct { - // PeeringLocation - The name of the peering location that the ExpressRoutePort is mapped to physically. - PeeringLocation *string `json:"peeringLocation,omitempty"` - // BandwidthInGbps - Bandwidth of procured ports in Gbps. - BandwidthInGbps *int32 `json:"bandwidthInGbps,omitempty"` - // ProvisionedBandwidthInGbps - READ-ONLY; Aggregate Gbps of associated circuit bandwidths. - ProvisionedBandwidthInGbps *float64 `json:"provisionedBandwidthInGbps,omitempty"` - // Mtu - READ-ONLY; Maximum transmission unit of the physical port pair(s). - Mtu *string `json:"mtu,omitempty"` - // Encapsulation - Encapsulation method on physical ports. Possible values include: 'ExpressRoutePortsEncapsulationDot1Q', 'ExpressRoutePortsEncapsulationQinQ' - Encapsulation ExpressRoutePortsEncapsulation `json:"encapsulation,omitempty"` - // EtherType - READ-ONLY; Ether type of the physical port. - EtherType *string `json:"etherType,omitempty"` - // AllocationDate - READ-ONLY; Date of the physical port allocation to be used in Letter of Authorization. - AllocationDate *string `json:"allocationDate,omitempty"` - // Links - The set of physical links of the ExpressRoutePort resource. - Links *[]ExpressRouteLink `json:"links,omitempty"` - // Circuits - READ-ONLY; Reference the ExpressRoute circuit(s) that are provisioned on this ExpressRoutePort resource. - Circuits *[]SubResource `json:"circuits,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the express route port resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the express route port resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // BillingType - The billing type of the ExpressRoutePort resource. Possible values include: 'ExpressRoutePortsBillingTypeMeteredData', 'ExpressRoutePortsBillingTypeUnlimitedData' - BillingType ExpressRoutePortsBillingType `json:"billingType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRoutePortPropertiesFormat. -func (erppf ExpressRoutePortPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erppf.PeeringLocation != nil { - objectMap["peeringLocation"] = erppf.PeeringLocation - } - if erppf.BandwidthInGbps != nil { - objectMap["bandwidthInGbps"] = erppf.BandwidthInGbps - } - if erppf.Encapsulation != "" { - objectMap["encapsulation"] = erppf.Encapsulation - } - if erppf.Links != nil { - objectMap["links"] = erppf.Links - } - if erppf.BillingType != "" { - objectMap["billingType"] = erppf.BillingType - } - return json.Marshal(objectMap) -} - -// ExpressRoutePortsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ExpressRoutePortsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRoutePortsClient) (ExpressRoutePort, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRoutePortsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRoutePortsCreateOrUpdateFuture.Result. -func (future *ExpressRoutePortsCreateOrUpdateFuture) result(client ExpressRoutePortsClient) (erp ExpressRoutePort, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - erp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRoutePortsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if erp.Response.Response, err = future.GetResult(sender); err == nil && erp.Response.Response.StatusCode != http.StatusNoContent { - erp, err = client.CreateOrUpdateResponder(erp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsCreateOrUpdateFuture", "Result", erp.Response.Response, "Failure responding to request") - } - } - return -} - -// ExpressRoutePortsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ExpressRoutePortsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExpressRoutePortsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExpressRoutePortsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExpressRoutePortsDeleteFuture.Result. -func (future *ExpressRoutePortsDeleteFuture) result(client ExpressRoutePortsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ExpressRoutePortsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ExpressRoutePortsLocation definition of the ExpressRoutePorts peering location resource. -type ExpressRoutePortsLocation struct { - autorest.Response `json:"-"` - // ExpressRoutePortsLocationPropertiesFormat - ExpressRoutePort peering location properties. - *ExpressRoutePortsLocationPropertiesFormat `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ExpressRoutePortsLocation. -func (erpl ExpressRoutePortsLocation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erpl.ExpressRoutePortsLocationPropertiesFormat != nil { - objectMap["properties"] = erpl.ExpressRoutePortsLocationPropertiesFormat - } - if erpl.ID != nil { - objectMap["id"] = erpl.ID - } - if erpl.Location != nil { - objectMap["location"] = erpl.Location - } - if erpl.Tags != nil { - objectMap["tags"] = erpl.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpressRoutePortsLocation struct. -func (erpl *ExpressRoutePortsLocation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var expressRoutePortsLocationPropertiesFormat ExpressRoutePortsLocationPropertiesFormat - err = json.Unmarshal(*v, &expressRoutePortsLocationPropertiesFormat) - if err != nil { - return err - } - erpl.ExpressRoutePortsLocationPropertiesFormat = &expressRoutePortsLocationPropertiesFormat - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - erpl.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - erpl.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - erpl.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - erpl.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - erpl.Tags = tags - } - } - } - - return nil -} - -// ExpressRoutePortsLocationBandwidths real-time inventory of available ExpressRoute port bandwidths. -type ExpressRoutePortsLocationBandwidths struct { - // OfferName - READ-ONLY; Bandwidth descriptive name. - OfferName *string `json:"offerName,omitempty"` - // ValueInGbps - READ-ONLY; Bandwidth value in Gbps. - ValueInGbps *int32 `json:"valueInGbps,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRoutePortsLocationBandwidths. -func (erplb ExpressRoutePortsLocationBandwidths) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ExpressRoutePortsLocationListResult response for ListExpressRoutePortsLocations API service call. -type ExpressRoutePortsLocationListResult struct { - autorest.Response `json:"-"` - // Value - The list of all ExpressRoutePort peering locations. - Value *[]ExpressRoutePortsLocation `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRoutePortsLocationListResultIterator provides access to a complete listing of -// ExpressRoutePortsLocation values. -type ExpressRoutePortsLocationListResultIterator struct { - i int - page ExpressRoutePortsLocationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ExpressRoutePortsLocationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsLocationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ExpressRoutePortsLocationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExpressRoutePortsLocationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ExpressRoutePortsLocationListResultIterator) Response() ExpressRoutePortsLocationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ExpressRoutePortsLocationListResultIterator) Value() ExpressRoutePortsLocation { - if !iter.page.NotDone() { - return ExpressRoutePortsLocation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExpressRoutePortsLocationListResultIterator type. -func NewExpressRoutePortsLocationListResultIterator(page ExpressRoutePortsLocationListResultPage) ExpressRoutePortsLocationListResultIterator { - return ExpressRoutePortsLocationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (erpllr ExpressRoutePortsLocationListResult) IsEmpty() bool { - return erpllr.Value == nil || len(*erpllr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (erpllr ExpressRoutePortsLocationListResult) hasNextLink() bool { - return erpllr.NextLink != nil && len(*erpllr.NextLink) != 0 -} - -// expressRoutePortsLocationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (erpllr ExpressRoutePortsLocationListResult) expressRoutePortsLocationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !erpllr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(erpllr.NextLink))) -} - -// ExpressRoutePortsLocationListResultPage contains a page of ExpressRoutePortsLocation values. -type ExpressRoutePortsLocationListResultPage struct { - fn func(context.Context, ExpressRoutePortsLocationListResult) (ExpressRoutePortsLocationListResult, error) - erpllr ExpressRoutePortsLocationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ExpressRoutePortsLocationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsLocationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.erpllr) - if err != nil { - return err - } - page.erpllr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ExpressRoutePortsLocationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExpressRoutePortsLocationListResultPage) NotDone() bool { - return !page.erpllr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExpressRoutePortsLocationListResultPage) Response() ExpressRoutePortsLocationListResult { - return page.erpllr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExpressRoutePortsLocationListResultPage) Values() []ExpressRoutePortsLocation { - if page.erpllr.IsEmpty() { - return nil - } - return *page.erpllr.Value -} - -// Creates a new instance of the ExpressRoutePortsLocationListResultPage type. -func NewExpressRoutePortsLocationListResultPage(cur ExpressRoutePortsLocationListResult, getNextPage func(context.Context, ExpressRoutePortsLocationListResult) (ExpressRoutePortsLocationListResult, error)) ExpressRoutePortsLocationListResultPage { - return ExpressRoutePortsLocationListResultPage{ - fn: getNextPage, - erpllr: cur, - } -} - -// ExpressRoutePortsLocationPropertiesFormat properties specific to ExpressRoutePorts peering location -// resources. -type ExpressRoutePortsLocationPropertiesFormat struct { - // Address - READ-ONLY; Address of peering location. - Address *string `json:"address,omitempty"` - // Contact - READ-ONLY; Contact details of peering locations. - Contact *string `json:"contact,omitempty"` - // AvailableBandwidths - The inventory of available ExpressRoutePort bandwidths. - AvailableBandwidths *[]ExpressRoutePortsLocationBandwidths `json:"availableBandwidths,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the express route port location resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRoutePortsLocationPropertiesFormat. -func (erplpf ExpressRoutePortsLocationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erplpf.AvailableBandwidths != nil { - objectMap["availableBandwidths"] = erplpf.AvailableBandwidths - } - return json.Marshal(objectMap) -} - -// ExpressRouteProviderPort expressRouteProviderPort resource. -type ExpressRouteProviderPort struct { - autorest.Response `json:"-"` - // ExpressRouteProviderPortProperties - Properties of the express route Service Provider Port. - *ExpressRouteProviderPortProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteProviderPort. -func (erpp ExpressRouteProviderPort) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erpp.ExpressRouteProviderPortProperties != nil { - objectMap["properties"] = erpp.ExpressRouteProviderPortProperties - } - if erpp.ID != nil { - objectMap["id"] = erpp.ID - } - if erpp.Location != nil { - objectMap["location"] = erpp.Location - } - if erpp.Tags != nil { - objectMap["tags"] = erpp.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpressRouteProviderPort struct. -func (erpp *ExpressRouteProviderPort) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var expressRouteProviderPortProperties ExpressRouteProviderPortProperties - err = json.Unmarshal(*v, &expressRouteProviderPortProperties) - if err != nil { - return err - } - erpp.ExpressRouteProviderPortProperties = &expressRouteProviderPortProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - erpp.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - erpp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - erpp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - erpp.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - erpp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - erpp.Tags = tags - } - } - } - - return nil -} - -// ExpressRouteProviderPortListResult response for ListExpressRouteProviderPort API service call. -type ExpressRouteProviderPortListResult struct { - autorest.Response `json:"-"` - // Value - A list of ExpressRouteProviderPort resources. - Value *[]ExpressRouteProviderPort `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteProviderPortListResult. -func (erpplr ExpressRouteProviderPortListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erpplr.Value != nil { - objectMap["value"] = erpplr.Value - } - return json.Marshal(objectMap) -} - -// ExpressRouteProviderPortProperties properties of ExpressRouteProviderPort. -type ExpressRouteProviderPortProperties struct { - // PortPairDescriptor - READ-ONLY; The name of the port pair. - PortPairDescriptor *string `json:"portPairDescriptor,omitempty"` - // PrimaryAzurePort - READ-ONLY; The name of the primary port. - PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` - // SecondaryAzurePort - READ-ONLY; The name of the secondary port. - SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` - // PeeringLocation - The peering location of the port pair. - PeeringLocation *string `json:"peeringLocation,omitempty"` - // OverprovisionFactor - Overprovisioning factor for the port pair. - OverprovisionFactor *int32 `json:"overprovisionFactor,omitempty"` - // PortBandwidthInMbps - Bandwidth of the port in Mbps - PortBandwidthInMbps *int32 `json:"portBandwidthInMbps,omitempty"` - // UsedBandwidthInMbps - Used Bandwidth of the port in Mbps - UsedBandwidthInMbps *int32 `json:"usedBandwidthInMbps,omitempty"` - // RemainingBandwidthInMbps - Remaining Bandwidth of the port in Mbps - RemainingBandwidthInMbps *int32 `json:"remainingBandwidthInMbps,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteProviderPortProperties. -func (erppp ExpressRouteProviderPortProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if erppp.PeeringLocation != nil { - objectMap["peeringLocation"] = erppp.PeeringLocation - } - if erppp.OverprovisionFactor != nil { - objectMap["overprovisionFactor"] = erppp.OverprovisionFactor - } - if erppp.PortBandwidthInMbps != nil { - objectMap["portBandwidthInMbps"] = erppp.PortBandwidthInMbps - } - if erppp.UsedBandwidthInMbps != nil { - objectMap["usedBandwidthInMbps"] = erppp.UsedBandwidthInMbps - } - if erppp.RemainingBandwidthInMbps != nil { - objectMap["remainingBandwidthInMbps"] = erppp.RemainingBandwidthInMbps - } - return json.Marshal(objectMap) -} - -// ExpressRouteServiceProvider a ExpressRouteResourceProvider object. -type ExpressRouteServiceProvider struct { - // ExpressRouteServiceProviderPropertiesFormat - Properties of the express route service provider. - *ExpressRouteServiceProviderPropertiesFormat `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteServiceProvider. -func (ersp ExpressRouteServiceProvider) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ersp.ExpressRouteServiceProviderPropertiesFormat != nil { - objectMap["properties"] = ersp.ExpressRouteServiceProviderPropertiesFormat - } - if ersp.ID != nil { - objectMap["id"] = ersp.ID - } - if ersp.Location != nil { - objectMap["location"] = ersp.Location - } - if ersp.Tags != nil { - objectMap["tags"] = ersp.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpressRouteServiceProvider struct. -func (ersp *ExpressRouteServiceProvider) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var expressRouteServiceProviderPropertiesFormat ExpressRouteServiceProviderPropertiesFormat - err = json.Unmarshal(*v, &expressRouteServiceProviderPropertiesFormat) - if err != nil { - return err - } - ersp.ExpressRouteServiceProviderPropertiesFormat = &expressRouteServiceProviderPropertiesFormat - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ersp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ersp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ersp.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ersp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ersp.Tags = tags - } - } - } - - return nil -} - -// ExpressRouteServiceProviderBandwidthsOffered contains bandwidths offered in ExpressRouteServiceProvider -// resources. -type ExpressRouteServiceProviderBandwidthsOffered struct { - // OfferName - The OfferName. - OfferName *string `json:"offerName,omitempty"` - // ValueInMbps - The ValueInMbps. - ValueInMbps *int32 `json:"valueInMbps,omitempty"` -} - -// ExpressRouteServiceProviderListResult response for the ListExpressRouteServiceProvider API service call. -type ExpressRouteServiceProviderListResult struct { - autorest.Response `json:"-"` - // Value - A list of ExpressRouteResourceProvider resources. - Value *[]ExpressRouteServiceProvider `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRouteServiceProviderListResultIterator provides access to a complete listing of -// ExpressRouteServiceProvider values. -type ExpressRouteServiceProviderListResultIterator struct { - i int - page ExpressRouteServiceProviderListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ExpressRouteServiceProviderListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteServiceProviderListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ExpressRouteServiceProviderListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExpressRouteServiceProviderListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ExpressRouteServiceProviderListResultIterator) Response() ExpressRouteServiceProviderListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ExpressRouteServiceProviderListResultIterator) Value() ExpressRouteServiceProvider { - if !iter.page.NotDone() { - return ExpressRouteServiceProvider{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExpressRouteServiceProviderListResultIterator type. -func NewExpressRouteServiceProviderListResultIterator(page ExpressRouteServiceProviderListResultPage) ExpressRouteServiceProviderListResultIterator { - return ExpressRouteServiceProviderListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ersplr ExpressRouteServiceProviderListResult) IsEmpty() bool { - return ersplr.Value == nil || len(*ersplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ersplr ExpressRouteServiceProviderListResult) hasNextLink() bool { - return ersplr.NextLink != nil && len(*ersplr.NextLink) != 0 -} - -// expressRouteServiceProviderListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ersplr ExpressRouteServiceProviderListResult) expressRouteServiceProviderListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ersplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ersplr.NextLink))) -} - -// ExpressRouteServiceProviderListResultPage contains a page of ExpressRouteServiceProvider values. -type ExpressRouteServiceProviderListResultPage struct { - fn func(context.Context, ExpressRouteServiceProviderListResult) (ExpressRouteServiceProviderListResult, error) - ersplr ExpressRouteServiceProviderListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ExpressRouteServiceProviderListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteServiceProviderListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ersplr) - if err != nil { - return err - } - page.ersplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ExpressRouteServiceProviderListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExpressRouteServiceProviderListResultPage) NotDone() bool { - return !page.ersplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExpressRouteServiceProviderListResultPage) Response() ExpressRouteServiceProviderListResult { - return page.ersplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExpressRouteServiceProviderListResultPage) Values() []ExpressRouteServiceProvider { - if page.ersplr.IsEmpty() { - return nil - } - return *page.ersplr.Value -} - -// Creates a new instance of the ExpressRouteServiceProviderListResultPage type. -func NewExpressRouteServiceProviderListResultPage(cur ExpressRouteServiceProviderListResult, getNextPage func(context.Context, ExpressRouteServiceProviderListResult) (ExpressRouteServiceProviderListResult, error)) ExpressRouteServiceProviderListResultPage { - return ExpressRouteServiceProviderListResultPage{ - fn: getNextPage, - ersplr: cur, - } -} - -// ExpressRouteServiceProviderPropertiesFormat properties of ExpressRouteServiceProvider. -type ExpressRouteServiceProviderPropertiesFormat struct { - // PeeringLocations - A list of peering locations. - PeeringLocations *[]string `json:"peeringLocations,omitempty"` - // BandwidthsOffered - A list of bandwidths offered. - BandwidthsOffered *[]ExpressRouteServiceProviderBandwidthsOffered `json:"bandwidthsOffered,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the express route service provider resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressRouteServiceProviderPropertiesFormat. -func (ersppf ExpressRouteServiceProviderPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ersppf.PeeringLocations != nil { - objectMap["peeringLocations"] = ersppf.PeeringLocations - } - if ersppf.BandwidthsOffered != nil { - objectMap["bandwidthsOffered"] = ersppf.BandwidthsOffered - } - return json.Marshal(objectMap) -} - -// ExtendedLocation extendedLocation complex type. -type ExtendedLocation struct { - // Name - The name of the extended location. - Name *string `json:"name,omitempty"` - // Type - The type of the extended location. Possible values include: 'ExtendedLocationTypesEdgeZone' - Type ExtendedLocationTypes `json:"type,omitempty"` -} - -// FilterItems will contain the filter name and values to operate on -type FilterItems struct { - // Field - The name of the field we would like to filter - Field *string `json:"field,omitempty"` - // Values - List of values to filter the current field by - Values *[]string `json:"values,omitempty"` -} - -// FirewallPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type FirewallPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FirewallPoliciesClient) (FirewallPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FirewallPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FirewallPoliciesCreateOrUpdateFuture.Result. -func (future *FirewallPoliciesCreateOrUpdateFuture) result(client FirewallPoliciesClient) (fp FirewallPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.FirewallPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.FirewallPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fp.Response.Response, err = future.GetResult(sender); err == nil && fp.Response.Response.StatusCode != http.StatusNoContent { - fp, err = client.CreateOrUpdateResponder(fp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.FirewallPoliciesCreateOrUpdateFuture", "Result", fp.Response.Response, "Failure responding to request") - } - } - return -} - -// FirewallPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FirewallPoliciesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FirewallPoliciesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FirewallPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FirewallPoliciesDeleteFuture.Result. -func (future *FirewallPoliciesDeleteFuture) result(client FirewallPoliciesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.FirewallPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.FirewallPoliciesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// FirewallPolicy firewallPolicy Resource. -type FirewallPolicy struct { - autorest.Response `json:"-"` - // FirewallPolicyPropertiesFormat - Properties of the firewall policy. - *FirewallPolicyPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Identity - The identity of the firewall policy. - Identity *ManagedServiceIdentity `json:"identity,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for FirewallPolicy. -func (fp FirewallPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fp.FirewallPolicyPropertiesFormat != nil { - objectMap["properties"] = fp.FirewallPolicyPropertiesFormat - } - if fp.Identity != nil { - objectMap["identity"] = fp.Identity - } - if fp.ID != nil { - objectMap["id"] = fp.ID - } - if fp.Location != nil { - objectMap["location"] = fp.Location - } - if fp.Tags != nil { - objectMap["tags"] = fp.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FirewallPolicy struct. -func (fp *FirewallPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var firewallPolicyPropertiesFormat FirewallPolicyPropertiesFormat - err = json.Unmarshal(*v, &firewallPolicyPropertiesFormat) - if err != nil { - return err - } - fp.FirewallPolicyPropertiesFormat = &firewallPolicyPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - fp.Etag = &etag - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - fp.Identity = &identity - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fp.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - fp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - fp.Tags = tags - } - } - } - - return nil -} - -// FirewallPolicyCertificateAuthority trusted Root certificates properties for tls. -type FirewallPolicyCertificateAuthority struct { - // KeyVaultSecretID - Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. - KeyVaultSecretID *string `json:"keyVaultSecretId,omitempty"` - // Name - Name of the CA certificate. - Name *string `json:"name,omitempty"` -} - -// FirewallPolicyFilterRuleCollection firewall Policy Filter Rule Collection. -type FirewallPolicyFilterRuleCollection struct { - // Action - The action type of a Filter rule collection. - Action *FirewallPolicyFilterRuleCollectionAction `json:"action,omitempty"` - // Rules - List of rules included in a rule collection. - Rules *[]BasicFirewallPolicyRule `json:"rules,omitempty"` - // Name - The name of the rule collection. - Name *string `json:"name,omitempty"` - // Priority - Priority of the Firewall Policy Rule Collection resource. - Priority *int32 `json:"priority,omitempty"` - // RuleCollectionType - Possible values include: 'RuleCollectionTypeFirewallPolicyRuleCollection', 'RuleCollectionTypeFirewallPolicyNatRuleCollection', 'RuleCollectionTypeFirewallPolicyFilterRuleCollection' - RuleCollectionType RuleCollectionType `json:"ruleCollectionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for FirewallPolicyFilterRuleCollection. -func (fpfrc FirewallPolicyFilterRuleCollection) MarshalJSON() ([]byte, error) { - fpfrc.RuleCollectionType = RuleCollectionTypeFirewallPolicyFilterRuleCollection - objectMap := make(map[string]interface{}) - if fpfrc.Action != nil { - objectMap["action"] = fpfrc.Action - } - if fpfrc.Rules != nil { - objectMap["rules"] = fpfrc.Rules - } - if fpfrc.Name != nil { - objectMap["name"] = fpfrc.Name - } - if fpfrc.Priority != nil { - objectMap["priority"] = fpfrc.Priority - } - if fpfrc.RuleCollectionType != "" { - objectMap["ruleCollectionType"] = fpfrc.RuleCollectionType - } - return json.Marshal(objectMap) -} - -// AsFirewallPolicyNatRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyFilterRuleCollection. -func (fpfrc FirewallPolicyFilterRuleCollection) AsFirewallPolicyNatRuleCollection() (*FirewallPolicyNatRuleCollection, bool) { - return nil, false -} - -// AsFirewallPolicyFilterRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyFilterRuleCollection. -func (fpfrc FirewallPolicyFilterRuleCollection) AsFirewallPolicyFilterRuleCollection() (*FirewallPolicyFilterRuleCollection, bool) { - return &fpfrc, true -} - -// AsFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyFilterRuleCollection. -func (fpfrc FirewallPolicyFilterRuleCollection) AsFirewallPolicyRuleCollection() (*FirewallPolicyRuleCollection, bool) { - return nil, false -} - -// AsBasicFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyFilterRuleCollection. -func (fpfrc FirewallPolicyFilterRuleCollection) AsBasicFirewallPolicyRuleCollection() (BasicFirewallPolicyRuleCollection, bool) { - return &fpfrc, true -} - -// UnmarshalJSON is the custom unmarshaler for FirewallPolicyFilterRuleCollection struct. -func (fpfrc *FirewallPolicyFilterRuleCollection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "action": - if v != nil { - var action FirewallPolicyFilterRuleCollectionAction - err = json.Unmarshal(*v, &action) - if err != nil { - return err - } - fpfrc.Action = &action - } - case "rules": - if v != nil { - rules, err := unmarshalBasicFirewallPolicyRuleArray(*v) - if err != nil { - return err - } - fpfrc.Rules = &rules - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fpfrc.Name = &name - } - case "priority": - if v != nil { - var priority int32 - err = json.Unmarshal(*v, &priority) - if err != nil { - return err - } - fpfrc.Priority = &priority - } - case "ruleCollectionType": - if v != nil { - var ruleCollectionType RuleCollectionType - err = json.Unmarshal(*v, &ruleCollectionType) - if err != nil { - return err - } - fpfrc.RuleCollectionType = ruleCollectionType - } - } - } - - return nil -} - -// FirewallPolicyFilterRuleCollectionAction properties of the FirewallPolicyFilterRuleCollectionAction. -type FirewallPolicyFilterRuleCollectionAction struct { - // Type - The type of action. Possible values include: 'FirewallPolicyFilterRuleCollectionActionTypeAllow', 'FirewallPolicyFilterRuleCollectionActionTypeDeny' - Type FirewallPolicyFilterRuleCollectionActionType `json:"type,omitempty"` -} - -// FirewallPolicyInsights firewall Policy Insights. -type FirewallPolicyInsights struct { - // IsEnabled - A flag to indicate if the insights are enabled on the policy. - IsEnabled *bool `json:"isEnabled,omitempty"` - // RetentionDays - Number of days the insights should be enabled on the policy. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // LogAnalyticsResources - Workspaces needed to configure the Firewall Policy Insights. - LogAnalyticsResources *FirewallPolicyLogAnalyticsResources `json:"logAnalyticsResources,omitempty"` -} - -// FirewallPolicyIntrusionDetection configuration for intrusion detection mode and rules. -type FirewallPolicyIntrusionDetection struct { - // Mode - Intrusion detection general state. Possible values include: 'FirewallPolicyIntrusionDetectionStateTypeOff', 'FirewallPolicyIntrusionDetectionStateTypeAlert', 'FirewallPolicyIntrusionDetectionStateTypeDeny' - Mode FirewallPolicyIntrusionDetectionStateType `json:"mode,omitempty"` - // Configuration - Intrusion detection configuration properties. - Configuration *FirewallPolicyIntrusionDetectionConfiguration `json:"configuration,omitempty"` -} - -// FirewallPolicyIntrusionDetectionBypassTrafficSpecifications intrusion detection bypass traffic -// specification. -type FirewallPolicyIntrusionDetectionBypassTrafficSpecifications struct { - // Name - Name of the bypass traffic rule. - Name *string `json:"name,omitempty"` - // Description - Description of the bypass traffic rule. - Description *string `json:"description,omitempty"` - // Protocol - The rule bypass protocol. Possible values include: 'FirewallPolicyIntrusionDetectionProtocolTCP', 'FirewallPolicyIntrusionDetectionProtocolUDP', 'FirewallPolicyIntrusionDetectionProtocolICMP', 'FirewallPolicyIntrusionDetectionProtocolANY' - Protocol FirewallPolicyIntrusionDetectionProtocol `json:"protocol,omitempty"` - // SourceAddresses - List of source IP addresses or ranges for this rule. - SourceAddresses *[]string `json:"sourceAddresses,omitempty"` - // DestinationAddresses - List of destination IP addresses or ranges for this rule. - DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` - // DestinationPorts - List of destination ports or ranges. - DestinationPorts *[]string `json:"destinationPorts,omitempty"` - // SourceIPGroups - List of source IpGroups for this rule. - SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` - // DestinationIPGroups - List of destination IpGroups for this rule. - DestinationIPGroups *[]string `json:"destinationIpGroups,omitempty"` -} - -// FirewallPolicyIntrusionDetectionConfiguration the operation for configuring intrusion detection. -type FirewallPolicyIntrusionDetectionConfiguration struct { - // SignatureOverrides - List of specific signatures states. - SignatureOverrides *[]FirewallPolicyIntrusionDetectionSignatureSpecification `json:"signatureOverrides,omitempty"` - // BypassTrafficSettings - List of rules for traffic to bypass. - BypassTrafficSettings *[]FirewallPolicyIntrusionDetectionBypassTrafficSpecifications `json:"bypassTrafficSettings,omitempty"` - // PrivateRanges - 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 - PrivateRanges *[]string `json:"privateRanges,omitempty"` -} - -// FirewallPolicyIntrusionDetectionSignatureSpecification intrusion detection signatures specification -// states. -type FirewallPolicyIntrusionDetectionSignatureSpecification struct { - // ID - Signature id. - ID *string `json:"id,omitempty"` - // Mode - The signature state. Possible values include: 'FirewallPolicyIntrusionDetectionStateTypeOff', 'FirewallPolicyIntrusionDetectionStateTypeAlert', 'FirewallPolicyIntrusionDetectionStateTypeDeny' - Mode FirewallPolicyIntrusionDetectionStateType `json:"mode,omitempty"` -} - -// FirewallPolicyListResult response for ListFirewallPolicies API service call. -type FirewallPolicyListResult struct { - autorest.Response `json:"-"` - // Value - List of Firewall Policies in a resource group. - Value *[]FirewallPolicy `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// FirewallPolicyListResultIterator provides access to a complete listing of FirewallPolicy values. -type FirewallPolicyListResultIterator struct { - i int - page FirewallPolicyListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *FirewallPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *FirewallPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter FirewallPolicyListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter FirewallPolicyListResultIterator) Response() FirewallPolicyListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter FirewallPolicyListResultIterator) Value() FirewallPolicy { - if !iter.page.NotDone() { - return FirewallPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the FirewallPolicyListResultIterator type. -func NewFirewallPolicyListResultIterator(page FirewallPolicyListResultPage) FirewallPolicyListResultIterator { - return FirewallPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (fplr FirewallPolicyListResult) IsEmpty() bool { - return fplr.Value == nil || len(*fplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (fplr FirewallPolicyListResult) hasNextLink() bool { - return fplr.NextLink != nil && len(*fplr.NextLink) != 0 -} - -// firewallPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (fplr FirewallPolicyListResult) firewallPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !fplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(fplr.NextLink))) -} - -// FirewallPolicyListResultPage contains a page of FirewallPolicy values. -type FirewallPolicyListResultPage struct { - fn func(context.Context, FirewallPolicyListResult) (FirewallPolicyListResult, error) - fplr FirewallPolicyListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *FirewallPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.fplr) - if err != nil { - return err - } - page.fplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *FirewallPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page FirewallPolicyListResultPage) NotDone() bool { - return !page.fplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page FirewallPolicyListResultPage) Response() FirewallPolicyListResult { - return page.fplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page FirewallPolicyListResultPage) Values() []FirewallPolicy { - if page.fplr.IsEmpty() { - return nil - } - return *page.fplr.Value -} - -// Creates a new instance of the FirewallPolicyListResultPage type. -func NewFirewallPolicyListResultPage(cur FirewallPolicyListResult, getNextPage func(context.Context, FirewallPolicyListResult) (FirewallPolicyListResult, error)) FirewallPolicyListResultPage { - return FirewallPolicyListResultPage{ - fn: getNextPage, - fplr: cur, - } -} - -// FirewallPolicyLogAnalyticsResources log Analytics Resources for Firewall Policy Insights. -type FirewallPolicyLogAnalyticsResources struct { - // Workspaces - List of workspaces for Firewall Policy Insights. - Workspaces *[]FirewallPolicyLogAnalyticsWorkspace `json:"workspaces,omitempty"` - // DefaultWorkspaceID - The default workspace Id for Firewall Policy Insights. - DefaultWorkspaceID *SubResource `json:"defaultWorkspaceId,omitempty"` -} - -// FirewallPolicyLogAnalyticsWorkspace log Analytics Workspace for Firewall Policy Insights. -type FirewallPolicyLogAnalyticsWorkspace struct { - // Region - Region to configure the Workspace. - Region *string `json:"region,omitempty"` - // WorkspaceID - The workspace Id for Firewall Policy Insights. - WorkspaceID *SubResource `json:"workspaceId,omitempty"` -} - -// FirewallPolicyNatRuleCollection firewall Policy NAT Rule Collection. -type FirewallPolicyNatRuleCollection struct { - // Action - The action type of a Nat rule collection. - Action *FirewallPolicyNatRuleCollectionAction `json:"action,omitempty"` - // Rules - List of rules included in a rule collection. - Rules *[]BasicFirewallPolicyRule `json:"rules,omitempty"` - // Name - The name of the rule collection. - Name *string `json:"name,omitempty"` - // Priority - Priority of the Firewall Policy Rule Collection resource. - Priority *int32 `json:"priority,omitempty"` - // RuleCollectionType - Possible values include: 'RuleCollectionTypeFirewallPolicyRuleCollection', 'RuleCollectionTypeFirewallPolicyNatRuleCollection', 'RuleCollectionTypeFirewallPolicyFilterRuleCollection' - RuleCollectionType RuleCollectionType `json:"ruleCollectionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for FirewallPolicyNatRuleCollection. -func (fpnrc FirewallPolicyNatRuleCollection) MarshalJSON() ([]byte, error) { - fpnrc.RuleCollectionType = RuleCollectionTypeFirewallPolicyNatRuleCollection - objectMap := make(map[string]interface{}) - if fpnrc.Action != nil { - objectMap["action"] = fpnrc.Action - } - if fpnrc.Rules != nil { - objectMap["rules"] = fpnrc.Rules - } - if fpnrc.Name != nil { - objectMap["name"] = fpnrc.Name - } - if fpnrc.Priority != nil { - objectMap["priority"] = fpnrc.Priority - } - if fpnrc.RuleCollectionType != "" { - objectMap["ruleCollectionType"] = fpnrc.RuleCollectionType - } - return json.Marshal(objectMap) -} - -// AsFirewallPolicyNatRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyNatRuleCollection. -func (fpnrc FirewallPolicyNatRuleCollection) AsFirewallPolicyNatRuleCollection() (*FirewallPolicyNatRuleCollection, bool) { - return &fpnrc, true -} - -// AsFirewallPolicyFilterRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyNatRuleCollection. -func (fpnrc FirewallPolicyNatRuleCollection) AsFirewallPolicyFilterRuleCollection() (*FirewallPolicyFilterRuleCollection, bool) { - return nil, false -} - -// AsFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyNatRuleCollection. -func (fpnrc FirewallPolicyNatRuleCollection) AsFirewallPolicyRuleCollection() (*FirewallPolicyRuleCollection, bool) { - return nil, false -} - -// AsBasicFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyNatRuleCollection. -func (fpnrc FirewallPolicyNatRuleCollection) AsBasicFirewallPolicyRuleCollection() (BasicFirewallPolicyRuleCollection, bool) { - return &fpnrc, true -} - -// UnmarshalJSON is the custom unmarshaler for FirewallPolicyNatRuleCollection struct. -func (fpnrc *FirewallPolicyNatRuleCollection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "action": - if v != nil { - var action FirewallPolicyNatRuleCollectionAction - err = json.Unmarshal(*v, &action) - if err != nil { - return err - } - fpnrc.Action = &action - } - case "rules": - if v != nil { - rules, err := unmarshalBasicFirewallPolicyRuleArray(*v) - if err != nil { - return err - } - fpnrc.Rules = &rules - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fpnrc.Name = &name - } - case "priority": - if v != nil { - var priority int32 - err = json.Unmarshal(*v, &priority) - if err != nil { - return err - } - fpnrc.Priority = &priority - } - case "ruleCollectionType": - if v != nil { - var ruleCollectionType RuleCollectionType - err = json.Unmarshal(*v, &ruleCollectionType) - if err != nil { - return err - } - fpnrc.RuleCollectionType = ruleCollectionType - } - } - } - - return nil -} - -// FirewallPolicyNatRuleCollectionAction properties of the FirewallPolicyNatRuleCollectionAction. -type FirewallPolicyNatRuleCollectionAction struct { - // Type - The type of action. Possible values include: 'FirewallPolicyNatRuleCollectionActionTypeDNAT' - Type FirewallPolicyNatRuleCollectionActionType `json:"type,omitempty"` -} - -// FirewallPolicyPropertiesFormat firewall Policy definition. -type FirewallPolicyPropertiesFormat struct { - // RuleCollectionGroups - READ-ONLY; List of references to FirewallPolicyRuleCollectionGroups. - RuleCollectionGroups *[]SubResource `json:"ruleCollectionGroups,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the firewall policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // BasePolicy - The parent firewall policy from which rules are inherited. - BasePolicy *SubResource `json:"basePolicy,omitempty"` - // Firewalls - READ-ONLY; List of references to Azure Firewalls that this Firewall Policy is associated with. - Firewalls *[]SubResource `json:"firewalls,omitempty"` - // ChildPolicies - READ-ONLY; List of references to Child Firewall Policies. - ChildPolicies *[]SubResource `json:"childPolicies,omitempty"` - // ThreatIntelMode - The operation mode for Threat Intelligence. Possible values include: 'AzureFirewallThreatIntelModeAlert', 'AzureFirewallThreatIntelModeDeny', 'AzureFirewallThreatIntelModeOff' - ThreatIntelMode AzureFirewallThreatIntelMode `json:"threatIntelMode,omitempty"` - // ThreatIntelWhitelist - ThreatIntel Whitelist for Firewall Policy. - ThreatIntelWhitelist *FirewallPolicyThreatIntelWhitelist `json:"threatIntelWhitelist,omitempty"` - // Insights - Insights on Firewall Policy. - Insights *FirewallPolicyInsights `json:"insights,omitempty"` - // Snat - The private IP addresses/IP ranges to which traffic will not be SNAT. - Snat *FirewallPolicySNAT `json:"snat,omitempty"` - // SQL - SQL Settings definition. - SQL *FirewallPolicySQL `json:"sql,omitempty"` - // DNSSettings - DNS Proxy Settings definition. - DNSSettings *DNSSettings `json:"dnsSettings,omitempty"` - // ExplicitProxy - Explicit Proxy Settings definition. - ExplicitProxy *ExplicitProxy `json:"explicitProxy,omitempty"` - // IntrusionDetection - The configuration for Intrusion detection. - IntrusionDetection *FirewallPolicyIntrusionDetection `json:"intrusionDetection,omitempty"` - // TransportSecurity - TLS Configuration definition. - TransportSecurity *FirewallPolicyTransportSecurity `json:"transportSecurity,omitempty"` - // Sku - The Firewall Policy SKU. - Sku *FirewallPolicySku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for FirewallPolicyPropertiesFormat. -func (fppf FirewallPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fppf.BasePolicy != nil { - objectMap["basePolicy"] = fppf.BasePolicy - } - if fppf.ThreatIntelMode != "" { - objectMap["threatIntelMode"] = fppf.ThreatIntelMode - } - if fppf.ThreatIntelWhitelist != nil { - objectMap["threatIntelWhitelist"] = fppf.ThreatIntelWhitelist - } - if fppf.Insights != nil { - objectMap["insights"] = fppf.Insights - } - if fppf.Snat != nil { - objectMap["snat"] = fppf.Snat - } - if fppf.SQL != nil { - objectMap["sql"] = fppf.SQL - } - if fppf.DNSSettings != nil { - objectMap["dnsSettings"] = fppf.DNSSettings - } - if fppf.ExplicitProxy != nil { - objectMap["explicitProxy"] = fppf.ExplicitProxy - } - if fppf.IntrusionDetection != nil { - objectMap["intrusionDetection"] = fppf.IntrusionDetection - } - if fppf.TransportSecurity != nil { - objectMap["transportSecurity"] = fppf.TransportSecurity - } - if fppf.Sku != nil { - objectMap["sku"] = fppf.Sku - } - return json.Marshal(objectMap) -} - -// BasicFirewallPolicyRule properties of a rule. -type BasicFirewallPolicyRule interface { - AsApplicationRule() (*ApplicationRule, bool) - AsNatRule() (*NatRule, bool) - AsRule() (*Rule, bool) - AsFirewallPolicyRule() (*FirewallPolicyRule, bool) -} - -// FirewallPolicyRule properties of a rule. -type FirewallPolicyRule struct { - // Name - Name of the rule. - Name *string `json:"name,omitempty"` - // Description - Description of the rule. - Description *string `json:"description,omitempty"` - // RuleType - Possible values include: 'RuleTypeFirewallPolicyRule', 'RuleTypeApplicationRule', 'RuleTypeNatRule', 'RuleTypeNetworkRule' - RuleType RuleType `json:"ruleType,omitempty"` -} - -func unmarshalBasicFirewallPolicyRule(body []byte) (BasicFirewallPolicyRule, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["ruleType"] { - case string(RuleTypeApplicationRule): - var ar ApplicationRule - err := json.Unmarshal(body, &ar) - return ar, err - case string(RuleTypeNatRule): - var nr NatRule - err := json.Unmarshal(body, &nr) - return nr, err - case string(RuleTypeNetworkRule): - var r Rule - err := json.Unmarshal(body, &r) - return r, err - default: - var fpr FirewallPolicyRule - err := json.Unmarshal(body, &fpr) - return fpr, err - } -} -func unmarshalBasicFirewallPolicyRuleArray(body []byte) ([]BasicFirewallPolicyRule, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - fprArray := make([]BasicFirewallPolicyRule, len(rawMessages)) - - for index, rawMessage := range rawMessages { - fpr, err := unmarshalBasicFirewallPolicyRule(*rawMessage) - if err != nil { - return nil, err - } - fprArray[index] = fpr - } - return fprArray, nil -} - -// MarshalJSON is the custom marshaler for FirewallPolicyRule. -func (fpr FirewallPolicyRule) MarshalJSON() ([]byte, error) { - fpr.RuleType = RuleTypeFirewallPolicyRule - objectMap := make(map[string]interface{}) - if fpr.Name != nil { - objectMap["name"] = fpr.Name - } - if fpr.Description != nil { - objectMap["description"] = fpr.Description - } - if fpr.RuleType != "" { - objectMap["ruleType"] = fpr.RuleType - } - return json.Marshal(objectMap) -} - -// AsApplicationRule is the BasicFirewallPolicyRule implementation for FirewallPolicyRule. -func (fpr FirewallPolicyRule) AsApplicationRule() (*ApplicationRule, bool) { - return nil, false -} - -// AsNatRule is the BasicFirewallPolicyRule implementation for FirewallPolicyRule. -func (fpr FirewallPolicyRule) AsNatRule() (*NatRule, bool) { - return nil, false -} - -// AsRule is the BasicFirewallPolicyRule implementation for FirewallPolicyRule. -func (fpr FirewallPolicyRule) AsRule() (*Rule, bool) { - return nil, false -} - -// AsFirewallPolicyRule is the BasicFirewallPolicyRule implementation for FirewallPolicyRule. -func (fpr FirewallPolicyRule) AsFirewallPolicyRule() (*FirewallPolicyRule, bool) { - return &fpr, true -} - -// AsBasicFirewallPolicyRule is the BasicFirewallPolicyRule implementation for FirewallPolicyRule. -func (fpr FirewallPolicyRule) AsBasicFirewallPolicyRule() (BasicFirewallPolicyRule, bool) { - return &fpr, true -} - -// FirewallPolicyRuleApplicationProtocol properties of the application rule protocol. -type FirewallPolicyRuleApplicationProtocol struct { - // ProtocolType - Protocol type. Possible values include: 'FirewallPolicyRuleApplicationProtocolTypeHTTP', 'FirewallPolicyRuleApplicationProtocolTypeHTTPS' - ProtocolType FirewallPolicyRuleApplicationProtocolType `json:"protocolType,omitempty"` - // Port - Port number for the protocol, cannot be greater than 64000. - Port *int32 `json:"port,omitempty"` -} - -// BasicFirewallPolicyRuleCollection properties of the rule collection. -type BasicFirewallPolicyRuleCollection interface { - AsFirewallPolicyNatRuleCollection() (*FirewallPolicyNatRuleCollection, bool) - AsFirewallPolicyFilterRuleCollection() (*FirewallPolicyFilterRuleCollection, bool) - AsFirewallPolicyRuleCollection() (*FirewallPolicyRuleCollection, bool) -} - -// FirewallPolicyRuleCollection properties of the rule collection. -type FirewallPolicyRuleCollection struct { - // Name - The name of the rule collection. - Name *string `json:"name,omitempty"` - // Priority - Priority of the Firewall Policy Rule Collection resource. - Priority *int32 `json:"priority,omitempty"` - // RuleCollectionType - Possible values include: 'RuleCollectionTypeFirewallPolicyRuleCollection', 'RuleCollectionTypeFirewallPolicyNatRuleCollection', 'RuleCollectionTypeFirewallPolicyFilterRuleCollection' - RuleCollectionType RuleCollectionType `json:"ruleCollectionType,omitempty"` -} - -func unmarshalBasicFirewallPolicyRuleCollection(body []byte) (BasicFirewallPolicyRuleCollection, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["ruleCollectionType"] { - case string(RuleCollectionTypeFirewallPolicyNatRuleCollection): - var fpnrc FirewallPolicyNatRuleCollection - err := json.Unmarshal(body, &fpnrc) - return fpnrc, err - case string(RuleCollectionTypeFirewallPolicyFilterRuleCollection): - var fpfrc FirewallPolicyFilterRuleCollection - err := json.Unmarshal(body, &fpfrc) - return fpfrc, err - default: - var fprc FirewallPolicyRuleCollection - err := json.Unmarshal(body, &fprc) - return fprc, err - } -} -func unmarshalBasicFirewallPolicyRuleCollectionArray(body []byte) ([]BasicFirewallPolicyRuleCollection, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - fprcArray := make([]BasicFirewallPolicyRuleCollection, len(rawMessages)) - - for index, rawMessage := range rawMessages { - fprc, err := unmarshalBasicFirewallPolicyRuleCollection(*rawMessage) - if err != nil { - return nil, err - } - fprcArray[index] = fprc - } - return fprcArray, nil -} - -// MarshalJSON is the custom marshaler for FirewallPolicyRuleCollection. -func (fprc FirewallPolicyRuleCollection) MarshalJSON() ([]byte, error) { - fprc.RuleCollectionType = RuleCollectionTypeFirewallPolicyRuleCollection - objectMap := make(map[string]interface{}) - if fprc.Name != nil { - objectMap["name"] = fprc.Name - } - if fprc.Priority != nil { - objectMap["priority"] = fprc.Priority - } - if fprc.RuleCollectionType != "" { - objectMap["ruleCollectionType"] = fprc.RuleCollectionType - } - return json.Marshal(objectMap) -} - -// AsFirewallPolicyNatRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyRuleCollection. -func (fprc FirewallPolicyRuleCollection) AsFirewallPolicyNatRuleCollection() (*FirewallPolicyNatRuleCollection, bool) { - return nil, false -} - -// AsFirewallPolicyFilterRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyRuleCollection. -func (fprc FirewallPolicyRuleCollection) AsFirewallPolicyFilterRuleCollection() (*FirewallPolicyFilterRuleCollection, bool) { - return nil, false -} - -// AsFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyRuleCollection. -func (fprc FirewallPolicyRuleCollection) AsFirewallPolicyRuleCollection() (*FirewallPolicyRuleCollection, bool) { - return &fprc, true -} - -// AsBasicFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyRuleCollection. -func (fprc FirewallPolicyRuleCollection) AsBasicFirewallPolicyRuleCollection() (BasicFirewallPolicyRuleCollection, bool) { - return &fprc, true -} - -// FirewallPolicyRuleCollectionGroup rule Collection Group resource. -type FirewallPolicyRuleCollectionGroup struct { - autorest.Response `json:"-"` - // FirewallPolicyRuleCollectionGroupProperties - The properties of the firewall policy rule collection group. - *FirewallPolicyRuleCollectionGroupProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Rule Group type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for FirewallPolicyRuleCollectionGroup. -func (fprcg FirewallPolicyRuleCollectionGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fprcg.FirewallPolicyRuleCollectionGroupProperties != nil { - objectMap["properties"] = fprcg.FirewallPolicyRuleCollectionGroupProperties - } - if fprcg.Name != nil { - objectMap["name"] = fprcg.Name - } - if fprcg.ID != nil { - objectMap["id"] = fprcg.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FirewallPolicyRuleCollectionGroup struct. -func (fprcg *FirewallPolicyRuleCollectionGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var firewallPolicyRuleCollectionGroupProperties FirewallPolicyRuleCollectionGroupProperties - err = json.Unmarshal(*v, &firewallPolicyRuleCollectionGroupProperties) - if err != nil { - return err - } - fprcg.FirewallPolicyRuleCollectionGroupProperties = &firewallPolicyRuleCollectionGroupProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fprcg.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - fprcg.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fprcg.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fprcg.ID = &ID - } - } - } - - return nil -} - -// FirewallPolicyRuleCollectionGroupListResult response for ListFirewallPolicyRuleCollectionGroups API -// service call. -type FirewallPolicyRuleCollectionGroupListResult struct { - autorest.Response `json:"-"` - // Value - List of FirewallPolicyRuleCollectionGroups in a FirewallPolicy. - Value *[]FirewallPolicyRuleCollectionGroup `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// FirewallPolicyRuleCollectionGroupListResultIterator provides access to a complete listing of -// FirewallPolicyRuleCollectionGroup values. -type FirewallPolicyRuleCollectionGroupListResultIterator struct { - i int - page FirewallPolicyRuleCollectionGroupListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *FirewallPolicyRuleCollectionGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyRuleCollectionGroupListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *FirewallPolicyRuleCollectionGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter FirewallPolicyRuleCollectionGroupListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter FirewallPolicyRuleCollectionGroupListResultIterator) Response() FirewallPolicyRuleCollectionGroupListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter FirewallPolicyRuleCollectionGroupListResultIterator) Value() FirewallPolicyRuleCollectionGroup { - if !iter.page.NotDone() { - return FirewallPolicyRuleCollectionGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the FirewallPolicyRuleCollectionGroupListResultIterator type. -func NewFirewallPolicyRuleCollectionGroupListResultIterator(page FirewallPolicyRuleCollectionGroupListResultPage) FirewallPolicyRuleCollectionGroupListResultIterator { - return FirewallPolicyRuleCollectionGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (fprcglr FirewallPolicyRuleCollectionGroupListResult) IsEmpty() bool { - return fprcglr.Value == nil || len(*fprcglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (fprcglr FirewallPolicyRuleCollectionGroupListResult) hasNextLink() bool { - return fprcglr.NextLink != nil && len(*fprcglr.NextLink) != 0 -} - -// firewallPolicyRuleCollectionGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (fprcglr FirewallPolicyRuleCollectionGroupListResult) firewallPolicyRuleCollectionGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !fprcglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(fprcglr.NextLink))) -} - -// FirewallPolicyRuleCollectionGroupListResultPage contains a page of FirewallPolicyRuleCollectionGroup -// values. -type FirewallPolicyRuleCollectionGroupListResultPage struct { - fn func(context.Context, FirewallPolicyRuleCollectionGroupListResult) (FirewallPolicyRuleCollectionGroupListResult, error) - fprcglr FirewallPolicyRuleCollectionGroupListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *FirewallPolicyRuleCollectionGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyRuleCollectionGroupListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.fprcglr) - if err != nil { - return err - } - page.fprcglr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *FirewallPolicyRuleCollectionGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page FirewallPolicyRuleCollectionGroupListResultPage) NotDone() bool { - return !page.fprcglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page FirewallPolicyRuleCollectionGroupListResultPage) Response() FirewallPolicyRuleCollectionGroupListResult { - return page.fprcglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page FirewallPolicyRuleCollectionGroupListResultPage) Values() []FirewallPolicyRuleCollectionGroup { - if page.fprcglr.IsEmpty() { - return nil - } - return *page.fprcglr.Value -} - -// Creates a new instance of the FirewallPolicyRuleCollectionGroupListResultPage type. -func NewFirewallPolicyRuleCollectionGroupListResultPage(cur FirewallPolicyRuleCollectionGroupListResult, getNextPage func(context.Context, FirewallPolicyRuleCollectionGroupListResult) (FirewallPolicyRuleCollectionGroupListResult, error)) FirewallPolicyRuleCollectionGroupListResultPage { - return FirewallPolicyRuleCollectionGroupListResultPage{ - fn: getNextPage, - fprcglr: cur, - } -} - -// FirewallPolicyRuleCollectionGroupProperties properties of the rule collection group. -type FirewallPolicyRuleCollectionGroupProperties struct { - // Priority - Priority of the Firewall Policy Rule Collection Group resource. - Priority *int32 `json:"priority,omitempty"` - // RuleCollections - Group of Firewall Policy rule collections. - RuleCollections *[]BasicFirewallPolicyRuleCollection `json:"ruleCollections,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the firewall policy rule collection group resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for FirewallPolicyRuleCollectionGroupProperties. -func (fprcgp FirewallPolicyRuleCollectionGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fprcgp.Priority != nil { - objectMap["priority"] = fprcgp.Priority - } - if fprcgp.RuleCollections != nil { - objectMap["ruleCollections"] = fprcgp.RuleCollections - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FirewallPolicyRuleCollectionGroupProperties struct. -func (fprcgp *FirewallPolicyRuleCollectionGroupProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "priority": - if v != nil { - var priority int32 - err = json.Unmarshal(*v, &priority) - if err != nil { - return err - } - fprcgp.Priority = &priority - } - case "ruleCollections": - if v != nil { - ruleCollections, err := unmarshalBasicFirewallPolicyRuleCollectionArray(*v) - if err != nil { - return err - } - fprcgp.RuleCollections = &ruleCollections - } - case "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - fprcgp.ProvisioningState = provisioningState - } - } - } - - return nil -} - -// FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FirewallPolicyRuleCollectionGroupsClient) (FirewallPolicyRuleCollectionGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture.Result. -func (future *FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture) result(client FirewallPolicyRuleCollectionGroupsClient) (fprcg FirewallPolicyRuleCollectionGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fprcg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fprcg.Response.Response, err = future.GetResult(sender); err == nil && fprcg.Response.Response.StatusCode != http.StatusNoContent { - fprcg, err = client.CreateOrUpdateResponder(fprcg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture", "Result", fprcg.Response.Response, "Failure responding to request") - } - } - return -} - -// FirewallPolicyRuleCollectionGroupsDeleteFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type FirewallPolicyRuleCollectionGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FirewallPolicyRuleCollectionGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FirewallPolicyRuleCollectionGroupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FirewallPolicyRuleCollectionGroupsDeleteFuture.Result. -func (future *FirewallPolicyRuleCollectionGroupsDeleteFuture) result(client FirewallPolicyRuleCollectionGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.FirewallPolicyRuleCollectionGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// FirewallPolicySNAT the private IP addresses/IP ranges to which traffic will not be SNAT. -type FirewallPolicySNAT struct { - // PrivateRanges - List of private IP addresses/IP address ranges to not be SNAT. - PrivateRanges *[]string `json:"privateRanges,omitempty"` - // AutoLearnPrivateRanges - The operation mode for automatically learning private ranges to not be SNAT. Possible values include: 'AutoLearnPrivateRangesModeEnabled', 'AutoLearnPrivateRangesModeDisabled' - AutoLearnPrivateRanges AutoLearnPrivateRangesMode `json:"autoLearnPrivateRanges,omitempty"` -} - -// FirewallPolicySQL SQL Settings in Firewall Policy. -type FirewallPolicySQL struct { - // AllowSQLRedirect - A flag to indicate if SQL Redirect traffic filtering is enabled. Turning on the flag requires no rule using port 11000-11999. - AllowSQLRedirect *bool `json:"allowSqlRedirect,omitempty"` -} - -// FirewallPolicySku SKU of Firewall policy. -type FirewallPolicySku struct { - // Tier - Tier of Firewall Policy. Possible values include: 'FirewallPolicySkuTierStandard', 'FirewallPolicySkuTierPremium', 'FirewallPolicySkuTierBasic' - Tier FirewallPolicySkuTier `json:"tier,omitempty"` -} - -// FirewallPolicyThreatIntelWhitelist threatIntel Whitelist for Firewall Policy. -type FirewallPolicyThreatIntelWhitelist struct { - // IPAddresses - List of IP addresses for the ThreatIntel Whitelist. - IPAddresses *[]string `json:"ipAddresses,omitempty"` - // Fqdns - List of FQDNs for the ThreatIntel Whitelist. - Fqdns *[]string `json:"fqdns,omitempty"` -} - -// FirewallPolicyTransportSecurity configuration needed to perform TLS termination & initiation. -type FirewallPolicyTransportSecurity struct { - // CertificateAuthority - The CA used for intermediate CA generation. - CertificateAuthority *FirewallPolicyCertificateAuthority `json:"certificateAuthority,omitempty"` -} - -// FlowLog a flow log resource. -type FlowLog struct { - autorest.Response `json:"-"` - // FlowLogPropertiesFormat - Properties of the flow log. - *FlowLogPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for FlowLog. -func (fl FlowLog) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fl.FlowLogPropertiesFormat != nil { - objectMap["properties"] = fl.FlowLogPropertiesFormat - } - if fl.ID != nil { - objectMap["id"] = fl.ID - } - if fl.Location != nil { - objectMap["location"] = fl.Location - } - if fl.Tags != nil { - objectMap["tags"] = fl.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FlowLog struct. -func (fl *FlowLog) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var flowLogPropertiesFormat FlowLogPropertiesFormat - err = json.Unmarshal(*v, &flowLogPropertiesFormat) - if err != nil { - return err - } - fl.FlowLogPropertiesFormat = &flowLogPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - fl.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fl.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fl.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fl.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - fl.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - fl.Tags = tags - } - } - } - - return nil -} - -// FlowLogFormatParameters parameters that define the flow log format. -type FlowLogFormatParameters struct { - // Type - The file type of flow log. Possible values include: 'FlowLogFormatTypeJSON' - Type FlowLogFormatType `json:"type,omitempty"` - // Version - The version (revision) of the flow log. - Version *int32 `json:"version,omitempty"` -} - -// FlowLogInformation information on the configuration of flow log and traffic analytics (optional) . -type FlowLogInformation struct { - autorest.Response `json:"-"` - // TargetResourceID - The ID of the resource to configure for flow log and traffic analytics (optional) . - TargetResourceID *string `json:"targetResourceId,omitempty"` - // FlowLogProperties - Properties of the flow log. - *FlowLogProperties `json:"properties,omitempty"` - // FlowAnalyticsConfiguration - Parameters that define the configuration of traffic analytics. - FlowAnalyticsConfiguration *TrafficAnalyticsProperties `json:"flowAnalyticsConfiguration,omitempty"` -} - -// MarshalJSON is the custom marshaler for FlowLogInformation. -func (fli FlowLogInformation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fli.TargetResourceID != nil { - objectMap["targetResourceId"] = fli.TargetResourceID - } - if fli.FlowLogProperties != nil { - objectMap["properties"] = fli.FlowLogProperties - } - if fli.FlowAnalyticsConfiguration != nil { - objectMap["flowAnalyticsConfiguration"] = fli.FlowAnalyticsConfiguration - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FlowLogInformation struct. -func (fli *FlowLogInformation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "targetResourceId": - if v != nil { - var targetResourceID string - err = json.Unmarshal(*v, &targetResourceID) - if err != nil { - return err - } - fli.TargetResourceID = &targetResourceID - } - case "properties": - if v != nil { - var flowLogProperties FlowLogProperties - err = json.Unmarshal(*v, &flowLogProperties) - if err != nil { - return err - } - fli.FlowLogProperties = &flowLogProperties - } - case "flowAnalyticsConfiguration": - if v != nil { - var flowAnalyticsConfiguration TrafficAnalyticsProperties - err = json.Unmarshal(*v, &flowAnalyticsConfiguration) - if err != nil { - return err - } - fli.FlowAnalyticsConfiguration = &flowAnalyticsConfiguration - } - } - } - - return nil -} - -// FlowLogListResult list of flow logs. -type FlowLogListResult struct { - autorest.Response `json:"-"` - // Value - Information about flow log resource. - Value *[]FlowLog `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for FlowLogListResult. -func (fllr FlowLogListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fllr.Value != nil { - objectMap["value"] = fllr.Value - } - return json.Marshal(objectMap) -} - -// FlowLogListResultIterator provides access to a complete listing of FlowLog values. -type FlowLogListResultIterator struct { - i int - page FlowLogListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *FlowLogListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FlowLogListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *FlowLogListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter FlowLogListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter FlowLogListResultIterator) Response() FlowLogListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter FlowLogListResultIterator) Value() FlowLog { - if !iter.page.NotDone() { - return FlowLog{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the FlowLogListResultIterator type. -func NewFlowLogListResultIterator(page FlowLogListResultPage) FlowLogListResultIterator { - return FlowLogListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (fllr FlowLogListResult) IsEmpty() bool { - return fllr.Value == nil || len(*fllr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (fllr FlowLogListResult) hasNextLink() bool { - return fllr.NextLink != nil && len(*fllr.NextLink) != 0 -} - -// flowLogListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (fllr FlowLogListResult) flowLogListResultPreparer(ctx context.Context) (*http.Request, error) { - if !fllr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(fllr.NextLink))) -} - -// FlowLogListResultPage contains a page of FlowLog values. -type FlowLogListResultPage struct { - fn func(context.Context, FlowLogListResult) (FlowLogListResult, error) - fllr FlowLogListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *FlowLogListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FlowLogListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.fllr) - if err != nil { - return err - } - page.fllr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *FlowLogListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page FlowLogListResultPage) NotDone() bool { - return !page.fllr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page FlowLogListResultPage) Response() FlowLogListResult { - return page.fllr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page FlowLogListResultPage) Values() []FlowLog { - if page.fllr.IsEmpty() { - return nil - } - return *page.fllr.Value -} - -// Creates a new instance of the FlowLogListResultPage type. -func NewFlowLogListResultPage(cur FlowLogListResult, getNextPage func(context.Context, FlowLogListResult) (FlowLogListResult, error)) FlowLogListResultPage { - return FlowLogListResultPage{ - fn: getNextPage, - fllr: cur, - } -} - -// FlowLogProperties parameters that define the configuration of flow log. -type FlowLogProperties struct { - // StorageID - ID of the storage account which is used to store the flow log. - StorageID *string `json:"storageId,omitempty"` - // Enabled - Flag to enable/disable flow logging. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - Parameters that define the retention policy for flow log. - RetentionPolicy *RetentionPolicyParameters `json:"retentionPolicy,omitempty"` - // Format - Parameters that define the flow log format. - Format *FlowLogFormatParameters `json:"format,omitempty"` -} - -// FlowLogPropertiesFormat parameters that define the configuration of flow log. -type FlowLogPropertiesFormat struct { - // TargetResourceID - ID of network security group to which flow log will be applied. - TargetResourceID *string `json:"targetResourceId,omitempty"` - // TargetResourceGUID - READ-ONLY; Guid of network security group to which flow log will be applied. - TargetResourceGUID *string `json:"targetResourceGuid,omitempty"` - // StorageID - ID of the storage account which is used to store the flow log. - StorageID *string `json:"storageId,omitempty"` - // Enabled - Flag to enable/disable flow logging. - Enabled *bool `json:"enabled,omitempty"` - // RetentionPolicy - Parameters that define the retention policy for flow log. - RetentionPolicy *RetentionPolicyParameters `json:"retentionPolicy,omitempty"` - // Format - Parameters that define the flow log format. - Format *FlowLogFormatParameters `json:"format,omitempty"` - // FlowAnalyticsConfiguration - Parameters that define the configuration of traffic analytics. - FlowAnalyticsConfiguration *TrafficAnalyticsProperties `json:"flowAnalyticsConfiguration,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the flow log. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for FlowLogPropertiesFormat. -func (flpf FlowLogPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if flpf.TargetResourceID != nil { - objectMap["targetResourceId"] = flpf.TargetResourceID - } - if flpf.StorageID != nil { - objectMap["storageId"] = flpf.StorageID - } - if flpf.Enabled != nil { - objectMap["enabled"] = flpf.Enabled - } - if flpf.RetentionPolicy != nil { - objectMap["retentionPolicy"] = flpf.RetentionPolicy - } - if flpf.Format != nil { - objectMap["format"] = flpf.Format - } - if flpf.FlowAnalyticsConfiguration != nil { - objectMap["flowAnalyticsConfiguration"] = flpf.FlowAnalyticsConfiguration - } - return json.Marshal(objectMap) -} - -// FlowLogStatusParameters parameters that define a resource to query flow log and traffic analytics -// (optional) status. -type FlowLogStatusParameters struct { - // TargetResourceID - The target resource where getting the flow log and traffic analytics (optional) status. - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// FlowLogsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FlowLogsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FlowLogsClient) (FlowLog, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FlowLogsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FlowLogsCreateOrUpdateFuture.Result. -func (future *FlowLogsCreateOrUpdateFuture) result(client FlowLogsClient) (fl FlowLog, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.FlowLogsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fl.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.FlowLogsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fl.Response.Response, err = future.GetResult(sender); err == nil && fl.Response.Response.StatusCode != http.StatusNoContent { - fl, err = client.CreateOrUpdateResponder(fl.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.FlowLogsCreateOrUpdateFuture", "Result", fl.Response.Response, "Failure responding to request") - } - } - return -} - -// FlowLogsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FlowLogsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FlowLogsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FlowLogsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FlowLogsDeleteFuture.Result. -func (future *FlowLogsDeleteFuture) result(client FlowLogsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.FlowLogsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.FlowLogsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// FrontendIPConfiguration frontend IP address of the load balancer. -type FrontendIPConfiguration struct { - autorest.Response `json:"-"` - // FrontendIPConfigurationPropertiesFormat - Properties of the load balancer probe. - *FrontendIPConfigurationPropertiesFormat `json:"properties,omitempty"` - // Name - 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. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // Zones - A list of availability zones denoting the IP allocated for the resource needs to come from. - Zones *[]string `json:"zones,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for FrontendIPConfiguration. -func (fic FrontendIPConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fic.FrontendIPConfigurationPropertiesFormat != nil { - objectMap["properties"] = fic.FrontendIPConfigurationPropertiesFormat - } - if fic.Name != nil { - objectMap["name"] = fic.Name - } - if fic.Zones != nil { - objectMap["zones"] = fic.Zones - } - if fic.ID != nil { - objectMap["id"] = fic.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FrontendIPConfiguration struct. -func (fic *FrontendIPConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var frontendIPConfigurationPropertiesFormat FrontendIPConfigurationPropertiesFormat - err = json.Unmarshal(*v, &frontendIPConfigurationPropertiesFormat) - if err != nil { - return err - } - fic.FrontendIPConfigurationPropertiesFormat = &frontendIPConfigurationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fic.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - fic.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fic.Type = &typeVar - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - fic.Zones = &zones - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fic.ID = &ID - } - } - } - - return nil -} - -// FrontendIPConfigurationPropertiesFormat properties of Frontend IP Configuration of the load balancer. -type FrontendIPConfigurationPropertiesFormat struct { - // InboundNatRules - READ-ONLY; An array of references to inbound rules that use this frontend IP. - InboundNatRules *[]SubResource `json:"inboundNatRules,omitempty"` - // InboundNatPools - READ-ONLY; An array of references to inbound pools that use this frontend IP. - InboundNatPools *[]SubResource `json:"inboundNatPools,omitempty"` - // OutboundRules - READ-ONLY; An array of references to outbound rules that use this frontend IP. - OutboundRules *[]SubResource `json:"outboundRules,omitempty"` - // LoadBalancingRules - READ-ONLY; An array of references to load balancing rules that use this frontend IP. - LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` - // PrivateIPAddress - The private IP address of the IP configuration. - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - // PrivateIPAllocationMethod - The Private IP allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' - PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` - // PrivateIPAddressVersion - Whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' - PrivateIPAddressVersion IPVersion `json:"privateIPAddressVersion,omitempty"` - // Subnet - The reference to the subnet resource. - Subnet *Subnet `json:"subnet,omitempty"` - // PublicIPAddress - The reference to the Public IP resource. - PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` - // PublicIPPrefix - The reference to the Public IP Prefix resource. - PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` - // GatewayLoadBalancer - The reference to gateway load balancer frontend IP. - GatewayLoadBalancer *SubResource `json:"gatewayLoadBalancer,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the frontend IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for FrontendIPConfigurationPropertiesFormat. -func (ficpf FrontendIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ficpf.PrivateIPAddress != nil { - objectMap["privateIPAddress"] = ficpf.PrivateIPAddress - } - if ficpf.PrivateIPAllocationMethod != "" { - objectMap["privateIPAllocationMethod"] = ficpf.PrivateIPAllocationMethod - } - if ficpf.PrivateIPAddressVersion != "" { - objectMap["privateIPAddressVersion"] = ficpf.PrivateIPAddressVersion - } - if ficpf.Subnet != nil { - objectMap["subnet"] = ficpf.Subnet - } - if ficpf.PublicIPAddress != nil { - objectMap["publicIPAddress"] = ficpf.PublicIPAddress - } - if ficpf.PublicIPPrefix != nil { - objectMap["publicIPPrefix"] = ficpf.PublicIPPrefix - } - if ficpf.GatewayLoadBalancer != nil { - objectMap["gatewayLoadBalancer"] = ficpf.GatewayLoadBalancer - } - return json.Marshal(objectMap) -} - -// GatewayCustomBgpIPAddressIPConfiguration gatewayCustomBgpIpAddressIpConfiguration for a virtual network -// gateway connection. -type GatewayCustomBgpIPAddressIPConfiguration struct { - // IPConfigurationID - The IpconfigurationId of ipconfiguration which belongs to gateway. - IPConfigurationID *string `json:"ipConfigurationId,omitempty"` - // CustomBgpIPAddress - The custom BgpPeeringAddress which belongs to IpconfigurationId. - CustomBgpIPAddress *string `json:"customBgpIpAddress,omitempty"` -} - -// GatewayLoadBalancerTunnelInterface gateway load balancer tunnel interface of a load balancer backend -// address pool. -type GatewayLoadBalancerTunnelInterface struct { - // Port - Port of gateway load balancer tunnel interface. - Port *int32 `json:"port,omitempty"` - // Identifier - Identifier of gateway load balancer tunnel interface. - Identifier *int32 `json:"identifier,omitempty"` - // Protocol - Protocol of gateway load balancer tunnel interface. Possible values include: 'GatewayLoadBalancerTunnelProtocolNone', 'GatewayLoadBalancerTunnelProtocolNative', 'GatewayLoadBalancerTunnelProtocolVXLAN' - Protocol GatewayLoadBalancerTunnelProtocol `json:"protocol,omitempty"` - // Type - Traffic type of gateway load balancer tunnel interface. Possible values include: 'GatewayLoadBalancerTunnelInterfaceTypeNone', 'GatewayLoadBalancerTunnelInterfaceTypeInternal', 'GatewayLoadBalancerTunnelInterfaceTypeExternal' - Type GatewayLoadBalancerTunnelInterfaceType `json:"type,omitempty"` -} - -// GatewayRoute gateway routing details. -type GatewayRoute struct { - // LocalAddress - READ-ONLY; The gateway's local address. - LocalAddress *string `json:"localAddress,omitempty"` - // NetworkProperty - READ-ONLY; The route's network prefix. - NetworkProperty *string `json:"network,omitempty"` - // NextHop - READ-ONLY; The route's next hop. - NextHop *string `json:"nextHop,omitempty"` - // SourcePeer - READ-ONLY; The peer this route was learned from. - SourcePeer *string `json:"sourcePeer,omitempty"` - // Origin - READ-ONLY; The source this route was learned from. - Origin *string `json:"origin,omitempty"` - // AsPath - READ-ONLY; The route's AS path sequence. - AsPath *string `json:"asPath,omitempty"` - // Weight - READ-ONLY; The route's weight. - Weight *int32 `json:"weight,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayRoute. -func (gr GatewayRoute) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GatewayRouteListResult list of virtual network gateway routes. -type GatewayRouteListResult struct { - autorest.Response `json:"-"` - // Value - List of gateway routes. - Value *[]GatewayRoute `json:"value,omitempty"` -} - -// GenerateExpressRoutePortsLOARequest the customer name to be printed on a letter of authorization. -type GenerateExpressRoutePortsLOARequest struct { - // CustomerName - The customer name. - CustomerName *string `json:"customerName,omitempty"` -} - -// GenerateExpressRoutePortsLOAResult response for GenerateExpressRoutePortsLOA API service call. -type GenerateExpressRoutePortsLOAResult struct { - autorest.Response `json:"-"` - // EncodedContent - The content as a base64 encoded string. - EncodedContent *string `json:"encodedContent,omitempty"` -} - -// GeneratevirtualwanvpnserverconfigurationvpnprofileFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type GeneratevirtualwanvpnserverconfigurationvpnprofileFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BaseClient) (VpnProfileResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GeneratevirtualwanvpnserverconfigurationvpnprofileFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GeneratevirtualwanvpnserverconfigurationvpnprofileFuture.Result. -func (future *GeneratevirtualwanvpnserverconfigurationvpnprofileFuture) result(client BaseClient) (vpr VpnProfileResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.GeneratevirtualwanvpnserverconfigurationvpnprofileFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vpr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.GeneratevirtualwanvpnserverconfigurationvpnprofileFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vpr.Response.Response, err = future.GetResult(sender); err == nil && vpr.Response.Response.StatusCode != http.StatusNoContent { - vpr, err = client.GeneratevirtualwanvpnserverconfigurationvpnprofileResponder(vpr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.GeneratevirtualwanvpnserverconfigurationvpnprofileFuture", "Result", vpr.Response.Response, "Failure responding to request") - } - } - return -} - -// GetActiveSessionsAllFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type GetActiveSessionsAllFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BaseClient) (BastionActiveSessionListResultPage, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GetActiveSessionsAllFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GetActiveSessionsAllFuture.Result. -func (future *GetActiveSessionsAllFuture) result(client BaseClient) (baslrp BastionActiveSessionListResultPage, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.GetActiveSessionsAllFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - baslrp.baslr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.GetActiveSessionsAllFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if baslrp.baslr.Response.Response, err = future.GetResult(sender); err == nil && baslrp.baslr.Response.Response.StatusCode != http.StatusNoContent { - baslrp, err = client.GetActiveSessionsResponder(baslrp.baslr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.GetActiveSessionsAllFuture", "Result", baslrp.baslr.Response.Response, "Failure responding to request") - } - } - return -} - -// GetActiveSessionsFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type GetActiveSessionsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BaseClient) (BastionActiveSessionListResultPage, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GetActiveSessionsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GetActiveSessionsFuture.Result. -func (future *GetActiveSessionsFuture) result(client BaseClient) (baslrp BastionActiveSessionListResultPage, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.GetActiveSessionsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - baslrp.baslr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.GetActiveSessionsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if baslrp.baslr.Response.Response, err = future.GetResult(sender); err == nil && baslrp.baslr.Response.Response.StatusCode != http.StatusNoContent { - baslrp, err = client.GetActiveSessionsResponder(baslrp.baslr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.GetActiveSessionsFuture", "Result", baslrp.baslr.Response.Response, "Failure responding to request") - } - } - return -} - -// GetInboundRoutesParameters the parameters specifying the connection resource whose inbound routes are -// being requested. -type GetInboundRoutesParameters struct { - // ResourceURI - The connection resource whose inbound routes are being requested. - ResourceURI *string `json:"resourceUri,omitempty"` - // ConnectionType - The type of the specified connection resource like ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and P2SConnection. - ConnectionType *string `json:"connectionType,omitempty"` -} - -// GetOutboundRoutesParameters the parameters specifying the connection resource whose outbound routes are -// being requested. -type GetOutboundRoutesParameters struct { - // ResourceURI - The connection resource whose outbound routes are being requested. - ResourceURI *string `json:"resourceUri,omitempty"` - // ConnectionType - The type of the specified connection resource like ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and P2SConnection. - ConnectionType *string `json:"connectionType,omitempty"` -} - -// GetVpnSitesConfigurationRequest list of Vpn-Sites. -type GetVpnSitesConfigurationRequest struct { - // VpnSites - List of resource-ids of the vpn-sites for which config is to be downloaded. - VpnSites *[]string `json:"vpnSites,omitempty"` - // OutputBlobSasURL - The sas-url to download the configurations for vpn-sites. - OutputBlobSasURL *string `json:"outputBlobSasUrl,omitempty"` -} - -// Group the network group resource -type Group struct { - autorest.Response `json:"-"` - // GroupProperties - The Network Group properties - *GroupProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata related to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Group. -func (g Group) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if g.GroupProperties != nil { - objectMap["properties"] = g.GroupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Group struct. -func (g *Group) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var groupProperties GroupProperties - err = json.Unmarshal(*v, &groupProperties) - if err != nil { - return err - } - g.GroupProperties = &groupProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - g.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - g.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - g.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - g.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - g.Etag = &etag - } - } - } - - return nil -} - -// GroupListResult result of the request to list NetworkGroup. It contains a list of groups and a URL link -// to get the next set of results. -type GroupListResult struct { - autorest.Response `json:"-"` - // Value - Gets a page of NetworkGroup - Value *[]Group `json:"value,omitempty"` - // NextLink - Gets the URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// GroupListResultIterator provides access to a complete listing of Group values. -type GroupListResultIterator struct { - i int - page GroupListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *GroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *GroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GroupListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter GroupListResultIterator) Response() GroupListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter GroupListResultIterator) Value() Group { - if !iter.page.NotDone() { - return Group{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GroupListResultIterator type. -func NewGroupListResultIterator(page GroupListResultPage) GroupListResultIterator { - return GroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (glr GroupListResult) IsEmpty() bool { - return glr.Value == nil || len(*glr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (glr GroupListResult) hasNextLink() bool { - return glr.NextLink != nil && len(*glr.NextLink) != 0 -} - -// groupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (glr GroupListResult) groupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !glr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(glr.NextLink))) -} - -// GroupListResultPage contains a page of Group values. -type GroupListResultPage struct { - fn func(context.Context, GroupListResult) (GroupListResult, error) - glr GroupListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *GroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.glr) - if err != nil { - return err - } - page.glr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *GroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GroupListResultPage) NotDone() bool { - return !page.glr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GroupListResultPage) Response() GroupListResult { - return page.glr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GroupListResultPage) Values() []Group { - if page.glr.IsEmpty() { - return nil - } - return *page.glr.Value -} - -// Creates a new instance of the GroupListResultPage type. -func NewGroupListResultPage(cur GroupListResult, getNextPage func(context.Context, GroupListResult) (GroupListResult, error)) GroupListResultPage { - return GroupListResultPage{ - fn: getNextPage, - glr: cur, - } -} - -// GroupProperties properties of network group -type GroupProperties struct { - // Description - A description of the network group. - Description *string `json:"description,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the scope assignment resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupProperties. -func (gp GroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gp.Description != nil { - objectMap["description"] = gp.Description - } - return json.Marshal(objectMap) -} - -// GroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type GroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GroupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GroupsDeleteFuture.Result. -func (future *GroupsDeleteFuture) result(client GroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.GroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.GroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// HTTPConfiguration HTTP configuration of the connectivity check. -type HTTPConfiguration struct { - // Method - HTTP method. Possible values include: 'HTTPMethodGet' - Method HTTPMethod `json:"method,omitempty"` - // Headers - List of HTTP headers. - Headers *[]HTTPHeader `json:"headers,omitempty"` - // ValidStatusCodes - Valid status codes. - ValidStatusCodes *[]int32 `json:"validStatusCodes,omitempty"` -} - -// HTTPHeader the HTTP header. -type HTTPHeader struct { - // Name - The name in HTTP header. - Name *string `json:"name,omitempty"` - // Value - The value in HTTP header. - Value *string `json:"value,omitempty"` -} - -// HopLink hop link. -type HopLink struct { - // NextHopID - READ-ONLY; The ID of the next hop. - NextHopID *string `json:"nextHopId,omitempty"` - // LinkType - READ-ONLY; Link type. - LinkType *string `json:"linkType,omitempty"` - // HopLinkProperties - Hop link properties. - *HopLinkProperties `json:"properties,omitempty"` - // Issues - READ-ONLY; List of issues. - Issues *[]ConnectivityIssue `json:"issues,omitempty"` - // Context - READ-ONLY; Provides additional context on links. - Context map[string]*string `json:"context"` - // ResourceID - READ-ONLY; Resource ID. - ResourceID *string `json:"resourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for HopLink. -func (hl HopLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hl.HopLinkProperties != nil { - objectMap["properties"] = hl.HopLinkProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for HopLink struct. -func (hl *HopLink) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "nextHopId": - if v != nil { - var nextHopID string - err = json.Unmarshal(*v, &nextHopID) - if err != nil { - return err - } - hl.NextHopID = &nextHopID - } - case "linkType": - if v != nil { - var linkType string - err = json.Unmarshal(*v, &linkType) - if err != nil { - return err - } - hl.LinkType = &linkType - } - case "properties": - if v != nil { - var hopLinkProperties HopLinkProperties - err = json.Unmarshal(*v, &hopLinkProperties) - if err != nil { - return err - } - hl.HopLinkProperties = &hopLinkProperties - } - case "issues": - if v != nil { - var issues []ConnectivityIssue - err = json.Unmarshal(*v, &issues) - if err != nil { - return err - } - hl.Issues = &issues - } - case "context": - if v != nil { - var context map[string]*string - err = json.Unmarshal(*v, &context) - if err != nil { - return err - } - hl.Context = context - } - case "resourceId": - if v != nil { - var resourceID string - err = json.Unmarshal(*v, &resourceID) - if err != nil { - return err - } - hl.ResourceID = &resourceID - } - } - } - - return nil -} - -// HopLinkProperties hop link properties. -type HopLinkProperties struct { - // RoundTripTimeMin - READ-ONLY; Minimum roundtrip time in milliseconds. - RoundTripTimeMin *int64 `json:"roundTripTimeMin,omitempty"` - // RoundTripTimeAvg - READ-ONLY; Average roundtrip time in milliseconds. - RoundTripTimeAvg *int64 `json:"roundTripTimeAvg,omitempty"` - // RoundTripTimeMax - READ-ONLY; Maximum roundtrip time in milliseconds. - RoundTripTimeMax *int64 `json:"roundTripTimeMax,omitempty"` -} - -// MarshalJSON is the custom marshaler for HopLinkProperties. -func (hlp HopLinkProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Hub hub Item. -type Hub struct { - // ResourceID - Resource Id. - ResourceID *string `json:"resourceId,omitempty"` - // ResourceType - Resource Type. - ResourceType *string `json:"resourceType,omitempty"` -} - -// HubIPAddresses IP addresses associated with azure firewall. -type HubIPAddresses struct { - // PublicIPs - Public IP addresses associated with azure firewall. - PublicIPs *HubPublicIPAddresses `json:"publicIPs,omitempty"` - // PrivateIPAddress - Private IP Address associated with azure firewall. - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` -} - -// HubIPConfiguration ipConfigurations. -type HubIPConfiguration struct { - autorest.Response `json:"-"` - // HubIPConfigurationPropertiesFormat - The properties of the Virtual Hub IPConfigurations. - *HubIPConfigurationPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the Ip Configuration. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Ipconfiguration type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for HubIPConfiguration. -func (hic HubIPConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hic.HubIPConfigurationPropertiesFormat != nil { - objectMap["properties"] = hic.HubIPConfigurationPropertiesFormat - } - if hic.Name != nil { - objectMap["name"] = hic.Name - } - if hic.ID != nil { - objectMap["id"] = hic.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for HubIPConfiguration struct. -func (hic *HubIPConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var hubIPConfigurationPropertiesFormat HubIPConfigurationPropertiesFormat - err = json.Unmarshal(*v, &hubIPConfigurationPropertiesFormat) - if err != nil { - return err - } - hic.HubIPConfigurationPropertiesFormat = &hubIPConfigurationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - hic.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - hic.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - hic.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - hic.ID = &ID - } - } - } - - return nil -} - -// HubIPConfigurationPropertiesFormat properties of IP configuration. -type HubIPConfigurationPropertiesFormat struct { - // PrivateIPAddress - The private IP address of the IP configuration. - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' - PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` - // Subnet - The reference to the subnet resource. - Subnet *Subnet `json:"subnet,omitempty"` - // PublicIPAddress - The reference to the public IP resource. - PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for HubIPConfigurationPropertiesFormat. -func (hicpf HubIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hicpf.PrivateIPAddress != nil { - objectMap["privateIPAddress"] = hicpf.PrivateIPAddress - } - if hicpf.PrivateIPAllocationMethod != "" { - objectMap["privateIPAllocationMethod"] = hicpf.PrivateIPAllocationMethod - } - if hicpf.Subnet != nil { - objectMap["subnet"] = hicpf.Subnet - } - if hicpf.PublicIPAddress != nil { - objectMap["publicIPAddress"] = hicpf.PublicIPAddress - } - return json.Marshal(objectMap) -} - -// HubPublicIPAddresses public IP addresses associated with azure firewall. -type HubPublicIPAddresses struct { - // Addresses - The list of Public IP addresses associated with azure firewall or IP addresses to be retained. - Addresses *[]AzureFirewallPublicIPAddress `json:"addresses,omitempty"` - // Count - The number of Public IP addresses associated with azure firewall. - Count *int32 `json:"count,omitempty"` -} - -// HubRoute routeTable route. -type HubRoute struct { - // Name - The name of the Route that is unique within a RouteTable. This name can be used to access this route. - Name *string `json:"name,omitempty"` - // DestinationType - The type of destinations (eg: CIDR, ResourceId, Service). - DestinationType *string `json:"destinationType,omitempty"` - // Destinations - List of all destinations. - Destinations *[]string `json:"destinations,omitempty"` - // NextHopType - The type of next hop (eg: ResourceId). - NextHopType *string `json:"nextHopType,omitempty"` - // NextHop - NextHop resource ID. - NextHop *string `json:"nextHop,omitempty"` -} - -// HubRouteTable routeTable resource in a virtual hub. -type HubRouteTable struct { - autorest.Response `json:"-"` - // HubRouteTableProperties - Properties of the RouteTable resource. - *HubRouteTableProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for HubRouteTable. -func (hrt HubRouteTable) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hrt.HubRouteTableProperties != nil { - objectMap["properties"] = hrt.HubRouteTableProperties - } - if hrt.Name != nil { - objectMap["name"] = hrt.Name - } - if hrt.ID != nil { - objectMap["id"] = hrt.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for HubRouteTable struct. -func (hrt *HubRouteTable) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var hubRouteTableProperties HubRouteTableProperties - err = json.Unmarshal(*v, &hubRouteTableProperties) - if err != nil { - return err - } - hrt.HubRouteTableProperties = &hubRouteTableProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - hrt.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - hrt.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - hrt.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - hrt.ID = &ID - } - } - } - - return nil -} - -// HubRouteTableProperties parameters for RouteTable. -type HubRouteTableProperties struct { - // Routes - List of all routes. - Routes *[]HubRoute `json:"routes,omitempty"` - // Labels - List of labels associated with this route table. - Labels *[]string `json:"labels,omitempty"` - // AssociatedConnections - READ-ONLY; List of all connections associated with this route table. - AssociatedConnections *[]string `json:"associatedConnections,omitempty"` - // PropagatingConnections - READ-ONLY; List of all connections that advertise to this route table. - PropagatingConnections *[]string `json:"propagatingConnections,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the RouteTable resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for HubRouteTableProperties. -func (hrtp HubRouteTableProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hrtp.Routes != nil { - objectMap["routes"] = hrtp.Routes - } - if hrtp.Labels != nil { - objectMap["labels"] = hrtp.Labels - } - return json.Marshal(objectMap) -} - -// HubRouteTablesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type HubRouteTablesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(HubRouteTablesClient) (HubRouteTable, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *HubRouteTablesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for HubRouteTablesCreateOrUpdateFuture.Result. -func (future *HubRouteTablesCreateOrUpdateFuture) result(client HubRouteTablesClient) (hrt HubRouteTable, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.HubRouteTablesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - hrt.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.HubRouteTablesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if hrt.Response.Response, err = future.GetResult(sender); err == nil && hrt.Response.Response.StatusCode != http.StatusNoContent { - hrt, err = client.CreateOrUpdateResponder(hrt.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.HubRouteTablesCreateOrUpdateFuture", "Result", hrt.Response.Response, "Failure responding to request") - } - } - return -} - -// HubRouteTablesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type HubRouteTablesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(HubRouteTablesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *HubRouteTablesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for HubRouteTablesDeleteFuture.Result. -func (future *HubRouteTablesDeleteFuture) result(client HubRouteTablesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.HubRouteTablesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.HubRouteTablesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// HubVirtualNetworkConnection hubVirtualNetworkConnection Resource. -type HubVirtualNetworkConnection struct { - autorest.Response `json:"-"` - // HubVirtualNetworkConnectionProperties - Properties of the hub virtual network connection. - *HubVirtualNetworkConnectionProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for HubVirtualNetworkConnection. -func (hvnc HubVirtualNetworkConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hvnc.HubVirtualNetworkConnectionProperties != nil { - objectMap["properties"] = hvnc.HubVirtualNetworkConnectionProperties - } - if hvnc.Name != nil { - objectMap["name"] = hvnc.Name - } - if hvnc.ID != nil { - objectMap["id"] = hvnc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for HubVirtualNetworkConnection struct. -func (hvnc *HubVirtualNetworkConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var hubVirtualNetworkConnectionProperties HubVirtualNetworkConnectionProperties - err = json.Unmarshal(*v, &hubVirtualNetworkConnectionProperties) - if err != nil { - return err - } - hvnc.HubVirtualNetworkConnectionProperties = &hubVirtualNetworkConnectionProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - hvnc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - hvnc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - hvnc.ID = &ID - } - } - } - - return nil -} - -// HubVirtualNetworkConnectionProperties parameters for HubVirtualNetworkConnection. -type HubVirtualNetworkConnectionProperties struct { - // RemoteVirtualNetwork - Reference to the remote virtual network. - RemoteVirtualNetwork *SubResource `json:"remoteVirtualNetwork,omitempty"` - // AllowHubToRemoteVnetTransit - Deprecated: VirtualHub to RemoteVnet transit to enabled or not. - AllowHubToRemoteVnetTransit *bool `json:"allowHubToRemoteVnetTransit,omitempty"` - // AllowRemoteVnetToUseHubVnetGateways - Deprecated: Allow RemoteVnet to use Virtual Hub's gateways. - AllowRemoteVnetToUseHubVnetGateways *bool `json:"allowRemoteVnetToUseHubVnetGateways,omitempty"` - // EnableInternetSecurity - Enable internet security. - EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` - // RoutingConfiguration - The Routing Configuration indicating the associated and propagated route tables on this connection. - RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the hub virtual network connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for HubVirtualNetworkConnectionProperties. -func (hvncp HubVirtualNetworkConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hvncp.RemoteVirtualNetwork != nil { - objectMap["remoteVirtualNetwork"] = hvncp.RemoteVirtualNetwork - } - if hvncp.AllowHubToRemoteVnetTransit != nil { - objectMap["allowHubToRemoteVnetTransit"] = hvncp.AllowHubToRemoteVnetTransit - } - if hvncp.AllowRemoteVnetToUseHubVnetGateways != nil { - objectMap["allowRemoteVnetToUseHubVnetGateways"] = hvncp.AllowRemoteVnetToUseHubVnetGateways - } - if hvncp.EnableInternetSecurity != nil { - objectMap["enableInternetSecurity"] = hvncp.EnableInternetSecurity - } - if hvncp.RoutingConfiguration != nil { - objectMap["routingConfiguration"] = hvncp.RoutingConfiguration - } - return json.Marshal(objectMap) -} - -// HubVirtualNetworkConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type HubVirtualNetworkConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(HubVirtualNetworkConnectionsClient) (HubVirtualNetworkConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *HubVirtualNetworkConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for HubVirtualNetworkConnectionsCreateOrUpdateFuture.Result. -func (future *HubVirtualNetworkConnectionsCreateOrUpdateFuture) result(client HubVirtualNetworkConnectionsClient) (hvnc HubVirtualNetworkConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - hvnc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.HubVirtualNetworkConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if hvnc.Response.Response, err = future.GetResult(sender); err == nil && hvnc.Response.Response.StatusCode != http.StatusNoContent { - hvnc, err = client.CreateOrUpdateResponder(hvnc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsCreateOrUpdateFuture", "Result", hvnc.Response.Response, "Failure responding to request") - } - } - return -} - -// HubVirtualNetworkConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type HubVirtualNetworkConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(HubVirtualNetworkConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *HubVirtualNetworkConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for HubVirtualNetworkConnectionsDeleteFuture.Result. -func (future *HubVirtualNetworkConnectionsDeleteFuture) result(client HubVirtualNetworkConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.HubVirtualNetworkConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// IDPSQueryObject will describe the query to run against the IDPS signatures DB -type IDPSQueryObject struct { - // Filters - Contain all filters names and values - Filters *[]FilterItems `json:"filters,omitempty"` - // Search - Search term in all columns - Search *string `json:"search,omitempty"` - // OrderBy - Column to sort response by - OrderBy *OrderBy `json:"orderBy,omitempty"` - // ResultsPerPage - The number of the results to return in each page - ResultsPerPage *int32 `json:"resultsPerPage,omitempty"` - // Skip - The number of records matching the filter to skip - Skip *int32 `json:"skip,omitempty"` -} - -// IPAddressAvailabilityResult response for CheckIPAddressAvailability API service call. -type IPAddressAvailabilityResult struct { - autorest.Response `json:"-"` - // Available - Private IP address availability. - Available *bool `json:"available,omitempty"` - // AvailableIPAddresses - Contains other available private IP addresses if the asked for address is taken. - AvailableIPAddresses *[]string `json:"availableIPAddresses,omitempty"` - // IsPlatformReserved - Private IP address platform reserved. - IsPlatformReserved *bool `json:"isPlatformReserved,omitempty"` -} - -// IPAllocation ipAllocation resource. -type IPAllocation struct { - autorest.Response `json:"-"` - // IPAllocationPropertiesFormat - Properties of the IpAllocation. - *IPAllocationPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for IPAllocation. -func (ia IPAllocation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ia.IPAllocationPropertiesFormat != nil { - objectMap["properties"] = ia.IPAllocationPropertiesFormat - } - if ia.ID != nil { - objectMap["id"] = ia.ID - } - if ia.Location != nil { - objectMap["location"] = ia.Location - } - if ia.Tags != nil { - objectMap["tags"] = ia.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IPAllocation struct. -func (ia *IPAllocation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var IPAllocationPropertiesFormat IPAllocationPropertiesFormat - err = json.Unmarshal(*v, &IPAllocationPropertiesFormat) - if err != nil { - return err - } - ia.IPAllocationPropertiesFormat = &IPAllocationPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ia.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ia.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ia.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ia.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ia.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ia.Tags = tags - } - } - } - - return nil -} - -// IPAllocationListResult response for the ListIpAllocations API service call. -type IPAllocationListResult struct { - autorest.Response `json:"-"` - // Value - A list of IpAllocation resources. - Value *[]IPAllocation `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// IPAllocationListResultIterator provides access to a complete listing of IPAllocation values. -type IPAllocationListResultIterator struct { - i int - page IPAllocationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IPAllocationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPAllocationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IPAllocationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IPAllocationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IPAllocationListResultIterator) Response() IPAllocationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IPAllocationListResultIterator) Value() IPAllocation { - if !iter.page.NotDone() { - return IPAllocation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IPAllocationListResultIterator type. -func NewIPAllocationListResultIterator(page IPAllocationListResultPage) IPAllocationListResultIterator { - return IPAllocationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ialr IPAllocationListResult) IsEmpty() bool { - return ialr.Value == nil || len(*ialr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ialr IPAllocationListResult) hasNextLink() bool { - return ialr.NextLink != nil && len(*ialr.NextLink) != 0 -} - -// iPAllocationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ialr IPAllocationListResult) iPAllocationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ialr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ialr.NextLink))) -} - -// IPAllocationListResultPage contains a page of IPAllocation values. -type IPAllocationListResultPage struct { - fn func(context.Context, IPAllocationListResult) (IPAllocationListResult, error) - ialr IPAllocationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IPAllocationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPAllocationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ialr) - if err != nil { - return err - } - page.ialr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IPAllocationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IPAllocationListResultPage) NotDone() bool { - return !page.ialr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IPAllocationListResultPage) Response() IPAllocationListResult { - return page.ialr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IPAllocationListResultPage) Values() []IPAllocation { - if page.ialr.IsEmpty() { - return nil - } - return *page.ialr.Value -} - -// Creates a new instance of the IPAllocationListResultPage type. -func NewIPAllocationListResultPage(cur IPAllocationListResult, getNextPage func(context.Context, IPAllocationListResult) (IPAllocationListResult, error)) IPAllocationListResultPage { - return IPAllocationListResultPage{ - fn: getNextPage, - ialr: cur, - } -} - -// IPAllocationPropertiesFormat properties of the IpAllocation. -type IPAllocationPropertiesFormat struct { - // Subnet - READ-ONLY; The Subnet that using the prefix of this IpAllocation resource. - Subnet *SubResource `json:"subnet,omitempty"` - // VirtualNetwork - READ-ONLY; The VirtualNetwork that using the prefix of this IpAllocation resource. - VirtualNetwork *SubResource `json:"virtualNetwork,omitempty"` - // Type - The type for the IpAllocation. Possible values include: 'IPAllocationTypeUndefined', 'IPAllocationTypeHypernet' - Type IPAllocationType `json:"type,omitempty"` - // Prefix - The address prefix for the IpAllocation. - Prefix *string `json:"prefix,omitempty"` - // PrefixLength - The address prefix length for the IpAllocation. - PrefixLength *int32 `json:"prefixLength,omitempty"` - // PrefixType - The address prefix Type for the IpAllocation. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' - PrefixType IPVersion `json:"prefixType,omitempty"` - // IpamAllocationID - The IPAM allocation ID. - IpamAllocationID *string `json:"ipamAllocationId,omitempty"` - // AllocationTags - IpAllocation tags. - AllocationTags map[string]*string `json:"allocationTags"` -} - -// MarshalJSON is the custom marshaler for IPAllocationPropertiesFormat. -func (iapf IPAllocationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iapf.Type != "" { - objectMap["type"] = iapf.Type - } - if iapf.Prefix != nil { - objectMap["prefix"] = iapf.Prefix - } - if iapf.PrefixLength != nil { - objectMap["prefixLength"] = iapf.PrefixLength - } - if iapf.PrefixType != "" { - objectMap["prefixType"] = iapf.PrefixType - } - if iapf.IpamAllocationID != nil { - objectMap["ipamAllocationId"] = iapf.IpamAllocationID - } - if iapf.AllocationTags != nil { - objectMap["allocationTags"] = iapf.AllocationTags - } - return json.Marshal(objectMap) -} - -// IPAllocationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type IPAllocationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IPAllocationsClient) (IPAllocation, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IPAllocationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for IPAllocationsCreateOrUpdateFuture.Result. -func (future *IPAllocationsCreateOrUpdateFuture) result(client IPAllocationsClient) (ia IPAllocation, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.IPAllocationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ia.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.IPAllocationsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ia.Response.Response, err = future.GetResult(sender); err == nil && ia.Response.Response.StatusCode != http.StatusNoContent { - ia, err = client.CreateOrUpdateResponder(ia.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.IPAllocationsCreateOrUpdateFuture", "Result", ia.Response.Response, "Failure responding to request") - } - } - return -} - -// IPAllocationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type IPAllocationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IPAllocationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IPAllocationsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for IPAllocationsDeleteFuture.Result. -func (future *IPAllocationsDeleteFuture) result(client IPAllocationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.IPAllocationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.IPAllocationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// IPConfiguration IP configuration. -type IPConfiguration struct { - // IPConfigurationPropertiesFormat - Properties of the IP configuration. - *IPConfigurationPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for IPConfiguration. -func (ic IPConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ic.IPConfigurationPropertiesFormat != nil { - objectMap["properties"] = ic.IPConfigurationPropertiesFormat - } - if ic.Name != nil { - objectMap["name"] = ic.Name - } - if ic.ID != nil { - objectMap["id"] = ic.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IPConfiguration struct. -func (ic *IPConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var IPConfigurationPropertiesFormat IPConfigurationPropertiesFormat - err = json.Unmarshal(*v, &IPConfigurationPropertiesFormat) - if err != nil { - return err - } - ic.IPConfigurationPropertiesFormat = &IPConfigurationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ic.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ic.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ic.ID = &ID - } - } - } - - return nil -} - -// IPConfigurationBgpPeeringAddress properties of IPConfigurationBgpPeeringAddress. -type IPConfigurationBgpPeeringAddress struct { - // IpconfigurationID - The ID of IP configuration which belongs to gateway. - IpconfigurationID *string `json:"ipconfigurationId,omitempty"` - // DefaultBgpIPAddresses - READ-ONLY; The list of default BGP peering addresses which belong to IP configuration. - DefaultBgpIPAddresses *[]string `json:"defaultBgpIpAddresses,omitempty"` - // CustomBgpIPAddresses - The list of custom BGP peering addresses which belong to IP configuration. - CustomBgpIPAddresses *[]string `json:"customBgpIpAddresses,omitempty"` - // TunnelIPAddresses - READ-ONLY; The list of tunnel public IP addresses which belong to IP configuration. - TunnelIPAddresses *[]string `json:"tunnelIpAddresses,omitempty"` -} - -// MarshalJSON is the custom marshaler for IPConfigurationBgpPeeringAddress. -func (icbpa IPConfigurationBgpPeeringAddress) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if icbpa.IpconfigurationID != nil { - objectMap["ipconfigurationId"] = icbpa.IpconfigurationID - } - if icbpa.CustomBgpIPAddresses != nil { - objectMap["customBgpIpAddresses"] = icbpa.CustomBgpIPAddresses - } - return json.Marshal(objectMap) -} - -// IPConfigurationProfile IP configuration profile child resource. -type IPConfigurationProfile struct { - // IPConfigurationProfilePropertiesFormat - Properties of the IP configuration profile. - *IPConfigurationProfilePropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Sub Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for IPConfigurationProfile. -func (icp IPConfigurationProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if icp.IPConfigurationProfilePropertiesFormat != nil { - objectMap["properties"] = icp.IPConfigurationProfilePropertiesFormat - } - if icp.Name != nil { - objectMap["name"] = icp.Name - } - if icp.ID != nil { - objectMap["id"] = icp.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IPConfigurationProfile struct. -func (icp *IPConfigurationProfile) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var IPConfigurationProfilePropertiesFormat IPConfigurationProfilePropertiesFormat - err = json.Unmarshal(*v, &IPConfigurationProfilePropertiesFormat) - if err != nil { - return err - } - icp.IPConfigurationProfilePropertiesFormat = &IPConfigurationProfilePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - icp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - icp.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - icp.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - icp.ID = &ID - } - } - } - - return nil -} - -// IPConfigurationProfilePropertiesFormat IP configuration profile properties. -type IPConfigurationProfilePropertiesFormat struct { - // Subnet - The reference to the subnet resource to create a container network interface ip configuration. - Subnet *Subnet `json:"subnet,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the IP configuration profile resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for IPConfigurationProfilePropertiesFormat. -func (icppf IPConfigurationProfilePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if icppf.Subnet != nil { - objectMap["subnet"] = icppf.Subnet - } - return json.Marshal(objectMap) -} - -// IPConfigurationPropertiesFormat properties of IP configuration. -type IPConfigurationPropertiesFormat struct { - // PrivateIPAddress - The private IP address of the IP configuration. - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' - PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` - // Subnet - The reference to the subnet resource. - Subnet *Subnet `json:"subnet,omitempty"` - // PublicIPAddress - The reference to the public IP resource. - PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for IPConfigurationPropertiesFormat. -func (icpf IPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if icpf.PrivateIPAddress != nil { - objectMap["privateIPAddress"] = icpf.PrivateIPAddress - } - if icpf.PrivateIPAllocationMethod != "" { - objectMap["privateIPAllocationMethod"] = icpf.PrivateIPAllocationMethod - } - if icpf.Subnet != nil { - objectMap["subnet"] = icpf.Subnet - } - if icpf.PublicIPAddress != nil { - objectMap["publicIPAddress"] = icpf.PublicIPAddress - } - return json.Marshal(objectMap) -} - -// IPGroup the IpGroups resource information. -type IPGroup struct { - autorest.Response `json:"-"` - // IPGroupPropertiesFormat - Properties of the IpGroups. - *IPGroupPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for IPGroup. -func (ig IPGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ig.IPGroupPropertiesFormat != nil { - objectMap["properties"] = ig.IPGroupPropertiesFormat - } - if ig.ID != nil { - objectMap["id"] = ig.ID - } - if ig.Location != nil { - objectMap["location"] = ig.Location - } - if ig.Tags != nil { - objectMap["tags"] = ig.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IPGroup struct. -func (ig *IPGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var IPGroupPropertiesFormat IPGroupPropertiesFormat - err = json.Unmarshal(*v, &IPGroupPropertiesFormat) - if err != nil { - return err - } - ig.IPGroupPropertiesFormat = &IPGroupPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ig.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ig.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ig.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ig.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ig.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ig.Tags = tags - } - } - } - - return nil -} - -// IPGroupListResult response for the ListIpGroups API service call. -type IPGroupListResult struct { - autorest.Response `json:"-"` - // Value - The list of IpGroups information resources. - Value *[]IPGroup `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// IPGroupListResultIterator provides access to a complete listing of IPGroup values. -type IPGroupListResultIterator struct { - i int - page IPGroupListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *IPGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPGroupListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *IPGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IPGroupListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter IPGroupListResultIterator) Response() IPGroupListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter IPGroupListResultIterator) Value() IPGroup { - if !iter.page.NotDone() { - return IPGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IPGroupListResultIterator type. -func NewIPGroupListResultIterator(page IPGroupListResultPage) IPGroupListResultIterator { - return IPGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iglr IPGroupListResult) IsEmpty() bool { - return iglr.Value == nil || len(*iglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iglr IPGroupListResult) hasNextLink() bool { - return iglr.NextLink != nil && len(*iglr.NextLink) != 0 -} - -// iPGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iglr IPGroupListResult) iPGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !iglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iglr.NextLink))) -} - -// IPGroupListResultPage contains a page of IPGroup values. -type IPGroupListResultPage struct { - fn func(context.Context, IPGroupListResult) (IPGroupListResult, error) - iglr IPGroupListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *IPGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IPGroupListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.iglr) - if err != nil { - return err - } - page.iglr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *IPGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IPGroupListResultPage) NotDone() bool { - return !page.iglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IPGroupListResultPage) Response() IPGroupListResult { - return page.iglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IPGroupListResultPage) Values() []IPGroup { - if page.iglr.IsEmpty() { - return nil - } - return *page.iglr.Value -} - -// Creates a new instance of the IPGroupListResultPage type. -func NewIPGroupListResultPage(cur IPGroupListResult, getNextPage func(context.Context, IPGroupListResult) (IPGroupListResult, error)) IPGroupListResultPage { - return IPGroupListResultPage{ - fn: getNextPage, - iglr: cur, - } -} - -// IPGroupPropertiesFormat the IpGroups property information. -type IPGroupPropertiesFormat struct { - // ProvisioningState - READ-ONLY; The provisioning state of the IpGroups resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // IPAddresses - IpAddresses/IpAddressPrefixes in the IpGroups resource. - IPAddresses *[]string `json:"ipAddresses,omitempty"` - // Firewalls - READ-ONLY; List of references to Firewall resources that this IpGroups is associated with. - Firewalls *[]SubResource `json:"firewalls,omitempty"` - // FirewallPolicies - READ-ONLY; List of references to Firewall Policies resources that this IpGroups is associated with. - FirewallPolicies *[]SubResource `json:"firewallPolicies,omitempty"` -} - -// MarshalJSON is the custom marshaler for IPGroupPropertiesFormat. -func (igpf IPGroupPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if igpf.IPAddresses != nil { - objectMap["ipAddresses"] = igpf.IPAddresses - } - return json.Marshal(objectMap) -} - -// IPGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type IPGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IPGroupsClient) (IPGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IPGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for IPGroupsCreateOrUpdateFuture.Result. -func (future *IPGroupsCreateOrUpdateFuture) result(client IPGroupsClient) (ig IPGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.IPGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ig.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.IPGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ig.Response.Response, err = future.GetResult(sender); err == nil && ig.Response.Response.StatusCode != http.StatusNoContent { - ig, err = client.CreateOrUpdateResponder(ig.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.IPGroupsCreateOrUpdateFuture", "Result", ig.Response.Response, "Failure responding to request") - } - } - return -} - -// IPGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type IPGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(IPGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *IPGroupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for IPGroupsDeleteFuture.Result. -func (future *IPGroupsDeleteFuture) result(client IPGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.IPGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.IPGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// IPPrefixesList list of SNAT IP Prefixes learnt by firewall to not SNAT -type IPPrefixesList struct { - autorest.Response `json:"-"` - // IPPrefixes - IP Prefix value. - IPPrefixes *[]string `json:"ipPrefixes,omitempty"` -} - -// IPTag contains the IpTag associated with the object. -type IPTag struct { - // IPTagType - The IP tag type. Example: FirstPartyUsage. - IPTagType *string `json:"ipTagType,omitempty"` - // Tag - The value of the IP tag associated with the public IP. Example: SQL. - Tag *string `json:"tag,omitempty"` -} - -// InboundNatPool inbound NAT pool of the load balancer. -type InboundNatPool struct { - // InboundNatPoolPropertiesFormat - Properties of load balancer inbound nat pool. - *InboundNatPoolPropertiesFormat `json:"properties,omitempty"` - // Name - 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. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for InboundNatPool. -func (inp InboundNatPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if inp.InboundNatPoolPropertiesFormat != nil { - objectMap["properties"] = inp.InboundNatPoolPropertiesFormat - } - if inp.Name != nil { - objectMap["name"] = inp.Name - } - if inp.ID != nil { - objectMap["id"] = inp.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for InboundNatPool struct. -func (inp *InboundNatPool) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var inboundNatPoolPropertiesFormat InboundNatPoolPropertiesFormat - err = json.Unmarshal(*v, &inboundNatPoolPropertiesFormat) - if err != nil { - return err - } - inp.InboundNatPoolPropertiesFormat = &inboundNatPoolPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - inp.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - inp.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - inp.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - inp.ID = &ID - } - } - } - - return nil -} - -// InboundNatPoolPropertiesFormat properties of Inbound NAT pool. -type InboundNatPoolPropertiesFormat struct { - // FrontendIPConfiguration - A reference to frontend IP addresses. - FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` - // Protocol - The reference to the transport protocol used by the inbound NAT pool. Possible values include: 'TransportProtocolUDP', 'TransportProtocolTCP', 'TransportProtocolAll' - Protocol TransportProtocol `json:"protocol,omitempty"` - // FrontendPortRangeStart - 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. - FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` - // FrontendPortRangeEnd - 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. - FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` - // BackendPort - The port used for internal connections on the endpoint. Acceptable values are between 1 and 65535. - BackendPort *int32 `json:"backendPort,omitempty"` - // IdleTimeoutInMinutes - 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. - IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` - // EnableFloatingIP - 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. - EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` - // EnableTCPReset - 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. - EnableTCPReset *bool `json:"enableTcpReset,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the inbound NAT pool resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for InboundNatPoolPropertiesFormat. -func (inppf InboundNatPoolPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if inppf.FrontendIPConfiguration != nil { - objectMap["frontendIPConfiguration"] = inppf.FrontendIPConfiguration - } - if inppf.Protocol != "" { - objectMap["protocol"] = inppf.Protocol - } - if inppf.FrontendPortRangeStart != nil { - objectMap["frontendPortRangeStart"] = inppf.FrontendPortRangeStart - } - if inppf.FrontendPortRangeEnd != nil { - objectMap["frontendPortRangeEnd"] = inppf.FrontendPortRangeEnd - } - if inppf.BackendPort != nil { - objectMap["backendPort"] = inppf.BackendPort - } - if inppf.IdleTimeoutInMinutes != nil { - objectMap["idleTimeoutInMinutes"] = inppf.IdleTimeoutInMinutes - } - if inppf.EnableFloatingIP != nil { - objectMap["enableFloatingIP"] = inppf.EnableFloatingIP - } - if inppf.EnableTCPReset != nil { - objectMap["enableTcpReset"] = inppf.EnableTCPReset - } - return json.Marshal(objectMap) -} - -// InboundNatRule inbound NAT rule of the load balancer. -type InboundNatRule struct { - autorest.Response `json:"-"` - // InboundNatRulePropertiesFormat - Properties of load balancer inbound NAT rule. - *InboundNatRulePropertiesFormat `json:"properties,omitempty"` - // Name - 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. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for InboundNatRule. -func (inr InboundNatRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if inr.InboundNatRulePropertiesFormat != nil { - objectMap["properties"] = inr.InboundNatRulePropertiesFormat - } - if inr.Name != nil { - objectMap["name"] = inr.Name - } - if inr.ID != nil { - objectMap["id"] = inr.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for InboundNatRule struct. -func (inr *InboundNatRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var inboundNatRulePropertiesFormat InboundNatRulePropertiesFormat - err = json.Unmarshal(*v, &inboundNatRulePropertiesFormat) - if err != nil { - return err - } - inr.InboundNatRulePropertiesFormat = &inboundNatRulePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - inr.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - inr.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - inr.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - inr.ID = &ID - } - } - } - - return nil -} - -// InboundNatRuleListResult response for ListInboundNatRule API service call. -type InboundNatRuleListResult struct { - autorest.Response `json:"-"` - // Value - A list of inbound NAT rules in a load balancer. - Value *[]InboundNatRule `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for InboundNatRuleListResult. -func (inrlr InboundNatRuleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if inrlr.Value != nil { - objectMap["value"] = inrlr.Value - } - return json.Marshal(objectMap) -} - -// InboundNatRuleListResultIterator provides access to a complete listing of InboundNatRule values. -type InboundNatRuleListResultIterator struct { - i int - page InboundNatRuleListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *InboundNatRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InboundNatRuleListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *InboundNatRuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter InboundNatRuleListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter InboundNatRuleListResultIterator) Response() InboundNatRuleListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter InboundNatRuleListResultIterator) Value() InboundNatRule { - if !iter.page.NotDone() { - return InboundNatRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the InboundNatRuleListResultIterator type. -func NewInboundNatRuleListResultIterator(page InboundNatRuleListResultPage) InboundNatRuleListResultIterator { - return InboundNatRuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (inrlr InboundNatRuleListResult) IsEmpty() bool { - return inrlr.Value == nil || len(*inrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (inrlr InboundNatRuleListResult) hasNextLink() bool { - return inrlr.NextLink != nil && len(*inrlr.NextLink) != 0 -} - -// inboundNatRuleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (inrlr InboundNatRuleListResult) inboundNatRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !inrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(inrlr.NextLink))) -} - -// InboundNatRuleListResultPage contains a page of InboundNatRule values. -type InboundNatRuleListResultPage struct { - fn func(context.Context, InboundNatRuleListResult) (InboundNatRuleListResult, error) - inrlr InboundNatRuleListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *InboundNatRuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InboundNatRuleListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.inrlr) - if err != nil { - return err - } - page.inrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *InboundNatRuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page InboundNatRuleListResultPage) NotDone() bool { - return !page.inrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page InboundNatRuleListResultPage) Response() InboundNatRuleListResult { - return page.inrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page InboundNatRuleListResultPage) Values() []InboundNatRule { - if page.inrlr.IsEmpty() { - return nil - } - return *page.inrlr.Value -} - -// Creates a new instance of the InboundNatRuleListResultPage type. -func NewInboundNatRuleListResultPage(cur InboundNatRuleListResult, getNextPage func(context.Context, InboundNatRuleListResult) (InboundNatRuleListResult, error)) InboundNatRuleListResultPage { - return InboundNatRuleListResultPage{ - fn: getNextPage, - inrlr: cur, - } -} - -// InboundNatRulePortMapping individual port mappings for inbound NAT rule created for backend pool. -type InboundNatRulePortMapping struct { - // InboundNatRuleName - READ-ONLY; Name of inbound NAT rule. - InboundNatRuleName *string `json:"inboundNatRuleName,omitempty"` - // Protocol - READ-ONLY; The reference to the transport protocol used by the inbound NAT rule. Possible values include: 'TransportProtocolUDP', 'TransportProtocolTCP', 'TransportProtocolAll' - Protocol TransportProtocol `json:"protocol,omitempty"` - // FrontendPort - READ-ONLY; Frontend port. - FrontendPort *int32 `json:"frontendPort,omitempty"` - // BackendPort - READ-ONLY; Backend port. - BackendPort *int32 `json:"backendPort,omitempty"` -} - -// MarshalJSON is the custom marshaler for InboundNatRulePortMapping. -func (inrpm InboundNatRulePortMapping) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// InboundNatRulePropertiesFormat properties of the inbound NAT rule. -type InboundNatRulePropertiesFormat struct { - // FrontendIPConfiguration - A reference to frontend IP addresses. - FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` - // BackendIPConfiguration - READ-ONLY; A reference to a private IP address defined on a network interface of a VM. Traffic sent to the frontend port of each of the frontend IP configurations is forwarded to the backend IP. - BackendIPConfiguration *InterfaceIPConfiguration `json:"backendIPConfiguration,omitempty"` - // Protocol - The reference to the transport protocol used by the load balancing rule. Possible values include: 'TransportProtocolUDP', 'TransportProtocolTCP', 'TransportProtocolAll' - Protocol TransportProtocol `json:"protocol,omitempty"` - // FrontendPort - 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. - FrontendPort *int32 `json:"frontendPort,omitempty"` - // BackendPort - The port used for the internal endpoint. Acceptable values range from 1 to 65535. - BackendPort *int32 `json:"backendPort,omitempty"` - // IdleTimeoutInMinutes - 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. - IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` - // EnableFloatingIP - 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. - EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` - // EnableTCPReset - 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. - EnableTCPReset *bool `json:"enableTcpReset,omitempty"` - // FrontendPortRangeStart - 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. - FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` - // FrontendPortRangeEnd - 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. - FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` - // BackendAddressPool - A reference to backendAddressPool resource. - BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the inbound NAT rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for InboundNatRulePropertiesFormat. -func (inrpf InboundNatRulePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if inrpf.FrontendIPConfiguration != nil { - objectMap["frontendIPConfiguration"] = inrpf.FrontendIPConfiguration - } - if inrpf.Protocol != "" { - objectMap["protocol"] = inrpf.Protocol - } - if inrpf.FrontendPort != nil { - objectMap["frontendPort"] = inrpf.FrontendPort - } - if inrpf.BackendPort != nil { - objectMap["backendPort"] = inrpf.BackendPort - } - if inrpf.IdleTimeoutInMinutes != nil { - objectMap["idleTimeoutInMinutes"] = inrpf.IdleTimeoutInMinutes - } - if inrpf.EnableFloatingIP != nil { - objectMap["enableFloatingIP"] = inrpf.EnableFloatingIP - } - if inrpf.EnableTCPReset != nil { - objectMap["enableTcpReset"] = inrpf.EnableTCPReset - } - if inrpf.FrontendPortRangeStart != nil { - objectMap["frontendPortRangeStart"] = inrpf.FrontendPortRangeStart - } - if inrpf.FrontendPortRangeEnd != nil { - objectMap["frontendPortRangeEnd"] = inrpf.FrontendPortRangeEnd - } - if inrpf.BackendAddressPool != nil { - objectMap["backendAddressPool"] = inrpf.BackendAddressPool - } - return json.Marshal(objectMap) -} - -// InboundNatRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InboundNatRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InboundNatRulesClient) (InboundNatRule, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InboundNatRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for InboundNatRulesCreateOrUpdateFuture.Result. -func (future *InboundNatRulesCreateOrUpdateFuture) result(client InboundNatRulesClient) (inr InboundNatRule, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundNatRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - inr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.InboundNatRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if inr.Response.Response, err = future.GetResult(sender); err == nil && inr.Response.Response.StatusCode != http.StatusNoContent { - inr, err = client.CreateOrUpdateResponder(inr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundNatRulesCreateOrUpdateFuture", "Result", inr.Response.Response, "Failure responding to request") - } - } - return -} - -// InboundNatRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type InboundNatRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InboundNatRulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InboundNatRulesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for InboundNatRulesDeleteFuture.Result. -func (future *InboundNatRulesDeleteFuture) result(client InboundNatRulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundNatRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.InboundNatRulesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// InboundSecurityRule NVA Inbound Security Rule resource. -type InboundSecurityRule struct { - autorest.Response `json:"-"` - // InboundSecurityRuleProperties - The properties of the Inbound Security Rules. - *InboundSecurityRuleProperties `json:"properties,omitempty"` - // Name - Name of security rule collection. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; NVA inbound security rule type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for InboundSecurityRule. -func (isr InboundSecurityRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if isr.InboundSecurityRuleProperties != nil { - objectMap["properties"] = isr.InboundSecurityRuleProperties - } - if isr.Name != nil { - objectMap["name"] = isr.Name - } - if isr.ID != nil { - objectMap["id"] = isr.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for InboundSecurityRule struct. -func (isr *InboundSecurityRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var inboundSecurityRuleProperties InboundSecurityRuleProperties - err = json.Unmarshal(*v, &inboundSecurityRuleProperties) - if err != nil { - return err - } - isr.InboundSecurityRuleProperties = &inboundSecurityRuleProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - isr.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - isr.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - isr.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - isr.ID = &ID - } - } - } - - return nil -} - -// InboundSecurityRuleCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InboundSecurityRuleCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InboundSecurityRuleClient) (InboundSecurityRule, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InboundSecurityRuleCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for InboundSecurityRuleCreateOrUpdateFuture.Result. -func (future *InboundSecurityRuleCreateOrUpdateFuture) result(client InboundSecurityRuleClient) (isr InboundSecurityRule, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundSecurityRuleCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - isr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.InboundSecurityRuleCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if isr.Response.Response, err = future.GetResult(sender); err == nil && isr.Response.Response.StatusCode != http.StatusNoContent { - isr, err = client.CreateOrUpdateResponder(isr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundSecurityRuleCreateOrUpdateFuture", "Result", isr.Response.Response, "Failure responding to request") - } - } - return -} - -// InboundSecurityRuleProperties properties of the Inbound Security Rules resource. -type InboundSecurityRuleProperties struct { - // Rules - List of allowed rules. - Rules *[]InboundSecurityRules `json:"rules,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for InboundSecurityRuleProperties. -func (isrp InboundSecurityRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if isrp.Rules != nil { - objectMap["rules"] = isrp.Rules - } - return json.Marshal(objectMap) -} - -// InboundSecurityRules properties of the Inbound Security Rules resource. -type InboundSecurityRules struct { - // Protocol - Protocol. This should be either TCP or UDP. Possible values include: 'InboundSecurityRulesProtocolTCP', 'InboundSecurityRulesProtocolUDP' - Protocol InboundSecurityRulesProtocol `json:"protocol,omitempty"` - // SourceAddressPrefix - The CIDR or source IP range. Only /30, /31 and /32 Ip ranges are allowed. - SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` - // DestinationPortRange - NVA port ranges to be opened up. One needs to provide specific ports. - DestinationPortRange *int32 `json:"destinationPortRange,omitempty"` -} - -// IntentPolicy network Intent Policy resource. -type IntentPolicy struct { - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for IntentPolicy. -func (IP IntentPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if IP.ID != nil { - objectMap["id"] = IP.ID - } - if IP.Location != nil { - objectMap["location"] = IP.Location - } - if IP.Tags != nil { - objectMap["tags"] = IP.Tags - } - return json.Marshal(objectMap) -} - -// IntentPolicyConfiguration details of NetworkIntentPolicyConfiguration for PrepareNetworkPoliciesRequest. -type IntentPolicyConfiguration struct { - // NetworkIntentPolicyName - The name of the Network Intent Policy for storing in target subscription. - NetworkIntentPolicyName *string `json:"networkIntentPolicyName,omitempty"` - // SourceNetworkIntentPolicy - Source network intent policy. - SourceNetworkIntentPolicy *IntentPolicy `json:"sourceNetworkIntentPolicy,omitempty"` -} - -// Interface a network interface in a resource group. -type Interface struct { - autorest.Response `json:"-"` - // ExtendedLocation - The extended location of the network interface. - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - // InterfacePropertiesFormat - Properties of the network interface. - *InterfacePropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Interface. -func (i Interface) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if i.ExtendedLocation != nil { - objectMap["extendedLocation"] = i.ExtendedLocation - } - if i.InterfacePropertiesFormat != nil { - objectMap["properties"] = i.InterfacePropertiesFormat - } - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Location != nil { - objectMap["location"] = i.Location - } - if i.Tags != nil { - objectMap["tags"] = i.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Interface struct. -func (i *Interface) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "extendedLocation": - if v != nil { - var extendedLocation ExtendedLocation - err = json.Unmarshal(*v, &extendedLocation) - if err != nil { - return err - } - i.ExtendedLocation = &extendedLocation - } - case "properties": - if v != nil { - var interfacePropertiesFormat InterfacePropertiesFormat - err = json.Unmarshal(*v, &interfacePropertiesFormat) - if err != nil { - return err - } - i.InterfacePropertiesFormat = &interfacePropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - i.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - i.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - i.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - i.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - i.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - i.Tags = tags - } - } - } - - return nil -} - -// InterfaceAssociation network interface and its custom security rules. -type InterfaceAssociation struct { - // ID - READ-ONLY; Network interface ID. - ID *string `json:"id,omitempty"` - // SecurityRules - Collection of custom security rules. - SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` -} - -// MarshalJSON is the custom marshaler for InterfaceAssociation. -func (ia InterfaceAssociation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ia.SecurityRules != nil { - objectMap["securityRules"] = ia.SecurityRules - } - return json.Marshal(objectMap) -} - -// InterfaceDNSSettings DNS settings of a network interface. -type InterfaceDNSSettings struct { - // DNSServers - 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. - DNSServers *[]string `json:"dnsServers,omitempty"` - // AppliedDNSServers - READ-ONLY; 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. - AppliedDNSServers *[]string `json:"appliedDnsServers,omitempty"` - // InternalDNSNameLabel - Relative DNS name for this NIC used for internal communications between VMs in the same virtual network. - InternalDNSNameLabel *string `json:"internalDnsNameLabel,omitempty"` - // InternalFqdn - READ-ONLY; Fully qualified DNS name supporting internal communications between VMs in the same virtual network. - InternalFqdn *string `json:"internalFqdn,omitempty"` - // InternalDomainNameSuffix - READ-ONLY; 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. - InternalDomainNameSuffix *string `json:"internalDomainNameSuffix,omitempty"` -} - -// MarshalJSON is the custom marshaler for InterfaceDNSSettings. -func (ids InterfaceDNSSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ids.DNSServers != nil { - objectMap["dnsServers"] = ids.DNSServers - } - if ids.InternalDNSNameLabel != nil { - objectMap["internalDnsNameLabel"] = ids.InternalDNSNameLabel - } - return json.Marshal(objectMap) -} - -// InterfaceIPConfiguration iPConfiguration in a network interface. -type InterfaceIPConfiguration struct { - autorest.Response `json:"-"` - // InterfaceIPConfigurationPropertiesFormat - Network interface IP configuration properties. - *InterfaceIPConfigurationPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for InterfaceIPConfiguration. -func (iic InterfaceIPConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iic.InterfaceIPConfigurationPropertiesFormat != nil { - objectMap["properties"] = iic.InterfaceIPConfigurationPropertiesFormat - } - if iic.Name != nil { - objectMap["name"] = iic.Name - } - if iic.Type != nil { - objectMap["type"] = iic.Type - } - if iic.ID != nil { - objectMap["id"] = iic.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for InterfaceIPConfiguration struct. -func (iic *InterfaceIPConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var interfaceIPConfigurationPropertiesFormat InterfaceIPConfigurationPropertiesFormat - err = json.Unmarshal(*v, &interfaceIPConfigurationPropertiesFormat) - if err != nil { - return err - } - iic.InterfaceIPConfigurationPropertiesFormat = &interfaceIPConfigurationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - iic.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - iic.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - iic.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - iic.ID = &ID - } - } - } - - return nil -} - -// InterfaceIPConfigurationListResult response for list ip configurations API service call. -type InterfaceIPConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - A list of ip configurations. - Value *[]InterfaceIPConfiguration `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for InterfaceIPConfigurationListResult. -func (iiclr InterfaceIPConfigurationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iiclr.Value != nil { - objectMap["value"] = iiclr.Value - } - return json.Marshal(objectMap) -} - -// InterfaceIPConfigurationListResultIterator provides access to a complete listing of -// InterfaceIPConfiguration values. -type InterfaceIPConfigurationListResultIterator struct { - i int - page InterfaceIPConfigurationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *InterfaceIPConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceIPConfigurationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *InterfaceIPConfigurationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter InterfaceIPConfigurationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter InterfaceIPConfigurationListResultIterator) Response() InterfaceIPConfigurationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter InterfaceIPConfigurationListResultIterator) Value() InterfaceIPConfiguration { - if !iter.page.NotDone() { - return InterfaceIPConfiguration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the InterfaceIPConfigurationListResultIterator type. -func NewInterfaceIPConfigurationListResultIterator(page InterfaceIPConfigurationListResultPage) InterfaceIPConfigurationListResultIterator { - return InterfaceIPConfigurationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (iiclr InterfaceIPConfigurationListResult) IsEmpty() bool { - return iiclr.Value == nil || len(*iiclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (iiclr InterfaceIPConfigurationListResult) hasNextLink() bool { - return iiclr.NextLink != nil && len(*iiclr.NextLink) != 0 -} - -// interfaceIPConfigurationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (iiclr InterfaceIPConfigurationListResult) interfaceIPConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !iiclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(iiclr.NextLink))) -} - -// InterfaceIPConfigurationListResultPage contains a page of InterfaceIPConfiguration values. -type InterfaceIPConfigurationListResultPage struct { - fn func(context.Context, InterfaceIPConfigurationListResult) (InterfaceIPConfigurationListResult, error) - iiclr InterfaceIPConfigurationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *InterfaceIPConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceIPConfigurationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.iiclr) - if err != nil { - return err - } - page.iiclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *InterfaceIPConfigurationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page InterfaceIPConfigurationListResultPage) NotDone() bool { - return !page.iiclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page InterfaceIPConfigurationListResultPage) Response() InterfaceIPConfigurationListResult { - return page.iiclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page InterfaceIPConfigurationListResultPage) Values() []InterfaceIPConfiguration { - if page.iiclr.IsEmpty() { - return nil - } - return *page.iiclr.Value -} - -// Creates a new instance of the InterfaceIPConfigurationListResultPage type. -func NewInterfaceIPConfigurationListResultPage(cur InterfaceIPConfigurationListResult, getNextPage func(context.Context, InterfaceIPConfigurationListResult) (InterfaceIPConfigurationListResult, error)) InterfaceIPConfigurationListResultPage { - return InterfaceIPConfigurationListResultPage{ - fn: getNextPage, - iiclr: cur, - } -} - -// InterfaceIPConfigurationPrivateLinkConnectionProperties privateLinkConnection properties for the network -// interface. -type InterfaceIPConfigurationPrivateLinkConnectionProperties struct { - // GroupID - READ-ONLY; The group ID for current private link connection. - GroupID *string `json:"groupId,omitempty"` - // RequiredMemberName - READ-ONLY; The required member name for current private link connection. - RequiredMemberName *string `json:"requiredMemberName,omitempty"` - // Fqdns - READ-ONLY; List of FQDNs for current private link connection. - Fqdns *[]string `json:"fqdns,omitempty"` -} - -// MarshalJSON is the custom marshaler for InterfaceIPConfigurationPrivateLinkConnectionProperties. -func (iicplcp InterfaceIPConfigurationPrivateLinkConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// InterfaceIPConfigurationPropertiesFormat properties of IP configuration. -type InterfaceIPConfigurationPropertiesFormat struct { - // GatewayLoadBalancer - The reference to gateway load balancer frontend IP. - GatewayLoadBalancer *SubResource `json:"gatewayLoadBalancer,omitempty"` - // VirtualNetworkTaps - The reference to Virtual Network Taps. - VirtualNetworkTaps *[]VirtualNetworkTap `json:"virtualNetworkTaps,omitempty"` - // ApplicationGatewayBackendAddressPools - The reference to ApplicationGatewayBackendAddressPool resource. - ApplicationGatewayBackendAddressPools *[]ApplicationGatewayBackendAddressPool `json:"applicationGatewayBackendAddressPools,omitempty"` - // LoadBalancerBackendAddressPools - The reference to LoadBalancerBackendAddressPool resource. - LoadBalancerBackendAddressPools *[]BackendAddressPool `json:"loadBalancerBackendAddressPools,omitempty"` - // LoadBalancerInboundNatRules - A list of references of LoadBalancerInboundNatRules. - LoadBalancerInboundNatRules *[]InboundNatRule `json:"loadBalancerInboundNatRules,omitempty"` - // PrivateIPAddress - Private IP address of the IP configuration. - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' - PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` - // PrivateIPAddressVersion - Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' - PrivateIPAddressVersion IPVersion `json:"privateIPAddressVersion,omitempty"` - // Subnet - Subnet bound to the IP configuration. - Subnet *Subnet `json:"subnet,omitempty"` - // Primary - Whether this is a primary customer address on the network interface. - Primary *bool `json:"primary,omitempty"` - // PublicIPAddress - Public IP address bound to the IP configuration. - PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` - // ApplicationSecurityGroups - Application security groups in which the IP configuration is included. - ApplicationSecurityGroups *[]ApplicationSecurityGroup `json:"applicationSecurityGroups,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the network interface IP configuration. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // PrivateLinkConnectionProperties - READ-ONLY; PrivateLinkConnection properties for the network interface. - PrivateLinkConnectionProperties *InterfaceIPConfigurationPrivateLinkConnectionProperties `json:"privateLinkConnectionProperties,omitempty"` -} - -// MarshalJSON is the custom marshaler for InterfaceIPConfigurationPropertiesFormat. -func (iicpf InterfaceIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iicpf.GatewayLoadBalancer != nil { - objectMap["gatewayLoadBalancer"] = iicpf.GatewayLoadBalancer - } - if iicpf.VirtualNetworkTaps != nil { - objectMap["virtualNetworkTaps"] = iicpf.VirtualNetworkTaps - } - if iicpf.ApplicationGatewayBackendAddressPools != nil { - objectMap["applicationGatewayBackendAddressPools"] = iicpf.ApplicationGatewayBackendAddressPools - } - if iicpf.LoadBalancerBackendAddressPools != nil { - objectMap["loadBalancerBackendAddressPools"] = iicpf.LoadBalancerBackendAddressPools - } - if iicpf.LoadBalancerInboundNatRules != nil { - objectMap["loadBalancerInboundNatRules"] = iicpf.LoadBalancerInboundNatRules - } - if iicpf.PrivateIPAddress != nil { - objectMap["privateIPAddress"] = iicpf.PrivateIPAddress - } - if iicpf.PrivateIPAllocationMethod != "" { - objectMap["privateIPAllocationMethod"] = iicpf.PrivateIPAllocationMethod - } - if iicpf.PrivateIPAddressVersion != "" { - objectMap["privateIPAddressVersion"] = iicpf.PrivateIPAddressVersion - } - if iicpf.Subnet != nil { - objectMap["subnet"] = iicpf.Subnet - } - if iicpf.Primary != nil { - objectMap["primary"] = iicpf.Primary - } - if iicpf.PublicIPAddress != nil { - objectMap["publicIPAddress"] = iicpf.PublicIPAddress - } - if iicpf.ApplicationSecurityGroups != nil { - objectMap["applicationSecurityGroups"] = iicpf.ApplicationSecurityGroups - } - return json.Marshal(objectMap) -} - -// InterfaceListResult response for the ListNetworkInterface API service call. -type InterfaceListResult struct { - autorest.Response `json:"-"` - // Value - A list of network interfaces in a resource group. - Value *[]Interface `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for InterfaceListResult. -func (ilr InterfaceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ilr.Value != nil { - objectMap["value"] = ilr.Value - } - return json.Marshal(objectMap) -} - -// InterfaceListResultIterator provides access to a complete listing of Interface values. -type InterfaceListResultIterator struct { - i int - page InterfaceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *InterfaceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *InterfaceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter InterfaceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter InterfaceListResultIterator) Response() InterfaceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter InterfaceListResultIterator) Value() Interface { - if !iter.page.NotDone() { - return Interface{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the InterfaceListResultIterator type. -func NewInterfaceListResultIterator(page InterfaceListResultPage) InterfaceListResultIterator { - return InterfaceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ilr InterfaceListResult) IsEmpty() bool { - return ilr.Value == nil || len(*ilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ilr InterfaceListResult) hasNextLink() bool { - return ilr.NextLink != nil && len(*ilr.NextLink) != 0 -} - -// interfaceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ilr InterfaceListResult) interfaceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ilr.NextLink))) -} - -// InterfaceListResultPage contains a page of Interface values. -type InterfaceListResultPage struct { - fn func(context.Context, InterfaceListResult) (InterfaceListResult, error) - ilr InterfaceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *InterfaceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ilr) - if err != nil { - return err - } - page.ilr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *InterfaceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page InterfaceListResultPage) NotDone() bool { - return !page.ilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page InterfaceListResultPage) Response() InterfaceListResult { - return page.ilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page InterfaceListResultPage) Values() []Interface { - if page.ilr.IsEmpty() { - return nil - } - return *page.ilr.Value -} - -// Creates a new instance of the InterfaceListResultPage type. -func NewInterfaceListResultPage(cur InterfaceListResult, getNextPage func(context.Context, InterfaceListResult) (InterfaceListResult, error)) InterfaceListResultPage { - return InterfaceListResultPage{ - fn: getNextPage, - ilr: cur, - } -} - -// InterfaceLoadBalancerListResult response for list ip configurations API service call. -type InterfaceLoadBalancerListResult struct { - autorest.Response `json:"-"` - // Value - A list of load balancers. - Value *[]LoadBalancer `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for InterfaceLoadBalancerListResult. -func (ilblr InterfaceLoadBalancerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ilblr.Value != nil { - objectMap["value"] = ilblr.Value - } - return json.Marshal(objectMap) -} - -// InterfaceLoadBalancerListResultIterator provides access to a complete listing of LoadBalancer values. -type InterfaceLoadBalancerListResultIterator struct { - i int - page InterfaceLoadBalancerListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *InterfaceLoadBalancerListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceLoadBalancerListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *InterfaceLoadBalancerListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter InterfaceLoadBalancerListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter InterfaceLoadBalancerListResultIterator) Response() InterfaceLoadBalancerListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter InterfaceLoadBalancerListResultIterator) Value() LoadBalancer { - if !iter.page.NotDone() { - return LoadBalancer{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the InterfaceLoadBalancerListResultIterator type. -func NewInterfaceLoadBalancerListResultIterator(page InterfaceLoadBalancerListResultPage) InterfaceLoadBalancerListResultIterator { - return InterfaceLoadBalancerListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ilblr InterfaceLoadBalancerListResult) IsEmpty() bool { - return ilblr.Value == nil || len(*ilblr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ilblr InterfaceLoadBalancerListResult) hasNextLink() bool { - return ilblr.NextLink != nil && len(*ilblr.NextLink) != 0 -} - -// interfaceLoadBalancerListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ilblr InterfaceLoadBalancerListResult) interfaceLoadBalancerListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ilblr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ilblr.NextLink))) -} - -// InterfaceLoadBalancerListResultPage contains a page of LoadBalancer values. -type InterfaceLoadBalancerListResultPage struct { - fn func(context.Context, InterfaceLoadBalancerListResult) (InterfaceLoadBalancerListResult, error) - ilblr InterfaceLoadBalancerListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *InterfaceLoadBalancerListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceLoadBalancerListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ilblr) - if err != nil { - return err - } - page.ilblr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *InterfaceLoadBalancerListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page InterfaceLoadBalancerListResultPage) NotDone() bool { - return !page.ilblr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page InterfaceLoadBalancerListResultPage) Response() InterfaceLoadBalancerListResult { - return page.ilblr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page InterfaceLoadBalancerListResultPage) Values() []LoadBalancer { - if page.ilblr.IsEmpty() { - return nil - } - return *page.ilblr.Value -} - -// Creates a new instance of the InterfaceLoadBalancerListResultPage type. -func NewInterfaceLoadBalancerListResultPage(cur InterfaceLoadBalancerListResult, getNextPage func(context.Context, InterfaceLoadBalancerListResult) (InterfaceLoadBalancerListResult, error)) InterfaceLoadBalancerListResultPage { - return InterfaceLoadBalancerListResultPage{ - fn: getNextPage, - ilblr: cur, - } -} - -// InterfacePropertiesFormat networkInterface properties. -type InterfacePropertiesFormat struct { - // VirtualMachine - READ-ONLY; The reference to a virtual machine. - VirtualMachine *SubResource `json:"virtualMachine,omitempty"` - // NetworkSecurityGroup - The reference to the NetworkSecurityGroup resource. - NetworkSecurityGroup *SecurityGroup `json:"networkSecurityGroup,omitempty"` - // PrivateEndpoint - READ-ONLY; A reference to the private endpoint to which the network interface is linked. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // IPConfigurations - A list of IPConfigurations of the network interface. - IPConfigurations *[]InterfaceIPConfiguration `json:"ipConfigurations,omitempty"` - // TapConfigurations - READ-ONLY; A list of TapConfigurations of the network interface. - TapConfigurations *[]InterfaceTapConfiguration `json:"tapConfigurations,omitempty"` - // DNSSettings - The DNS settings in network interface. - DNSSettings *InterfaceDNSSettings `json:"dnsSettings,omitempty"` - // MacAddress - READ-ONLY; The MAC address of the network interface. - MacAddress *string `json:"macAddress,omitempty"` - // Primary - READ-ONLY; Whether this is a primary network interface on a virtual machine. - Primary *bool `json:"primary,omitempty"` - // VnetEncryptionSupported - READ-ONLY; Whether the virtual machine this nic is attached to supports encryption. - VnetEncryptionSupported *bool `json:"vnetEncryptionSupported,omitempty"` - // EnableAcceleratedNetworking - If the network interface is configured for accelerated networking. Not applicable to VM sizes which require accelerated networking. - EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` - // DisableTCPStateTracking - Indicates whether to disable tcp state tracking. - DisableTCPStateTracking *bool `json:"disableTcpStateTracking,omitempty"` - // EnableIPForwarding - Indicates whether IP forwarding is enabled on this network interface. - EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` - // HostedWorkloads - READ-ONLY; A list of references to linked BareMetal resources. - HostedWorkloads *[]string `json:"hostedWorkloads,omitempty"` - // DscpConfiguration - READ-ONLY; A reference to the dscp configuration to which the network interface is linked. - DscpConfiguration *SubResource `json:"dscpConfiguration,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the network interface resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the network interface resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // WorkloadType - WorkloadType of the NetworkInterface for BareMetal resources - WorkloadType *string `json:"workloadType,omitempty"` - // NicType - Type of Network Interface resource. Possible values include: 'InterfaceNicTypeStandard', 'InterfaceNicTypeElastic' - NicType InterfaceNicType `json:"nicType,omitempty"` - // PrivateLinkService - Privatelinkservice of the network interface resource. - PrivateLinkService *PrivateLinkService `json:"privateLinkService,omitempty"` - // MigrationPhase - Migration phase of Network Interface resource. Possible values include: 'InterfaceMigrationPhaseNone', 'InterfaceMigrationPhasePrepare', 'InterfaceMigrationPhaseCommit', 'InterfaceMigrationPhaseAbort', 'InterfaceMigrationPhaseCommitted' - MigrationPhase InterfaceMigrationPhase `json:"migrationPhase,omitempty"` - // AuxiliaryMode - Auxiliary mode of Network Interface resource. Possible values include: 'InterfaceAuxiliaryModeNone', 'InterfaceAuxiliaryModeMaxConnections', 'InterfaceAuxiliaryModeFloating' - AuxiliaryMode InterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for InterfacePropertiesFormat. -func (ipf InterfacePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipf.NetworkSecurityGroup != nil { - objectMap["networkSecurityGroup"] = ipf.NetworkSecurityGroup - } - if ipf.IPConfigurations != nil { - objectMap["ipConfigurations"] = ipf.IPConfigurations - } - if ipf.DNSSettings != nil { - objectMap["dnsSettings"] = ipf.DNSSettings - } - if ipf.EnableAcceleratedNetworking != nil { - objectMap["enableAcceleratedNetworking"] = ipf.EnableAcceleratedNetworking - } - if ipf.DisableTCPStateTracking != nil { - objectMap["disableTcpStateTracking"] = ipf.DisableTCPStateTracking - } - if ipf.EnableIPForwarding != nil { - objectMap["enableIPForwarding"] = ipf.EnableIPForwarding - } - if ipf.WorkloadType != nil { - objectMap["workloadType"] = ipf.WorkloadType - } - if ipf.NicType != "" { - objectMap["nicType"] = ipf.NicType - } - if ipf.PrivateLinkService != nil { - objectMap["privateLinkService"] = ipf.PrivateLinkService - } - if ipf.MigrationPhase != "" { - objectMap["migrationPhase"] = ipf.MigrationPhase - } - if ipf.AuxiliaryMode != "" { - objectMap["auxiliaryMode"] = ipf.AuxiliaryMode - } - return json.Marshal(objectMap) -} - -// InterfaceTapConfiguration tap configuration in a Network Interface. -type InterfaceTapConfiguration struct { - autorest.Response `json:"-"` - // InterfaceTapConfigurationPropertiesFormat - Properties of the Virtual Network Tap configuration. - *InterfaceTapConfigurationPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Sub Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for InterfaceTapConfiguration. -func (itc InterfaceTapConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if itc.InterfaceTapConfigurationPropertiesFormat != nil { - objectMap["properties"] = itc.InterfaceTapConfigurationPropertiesFormat - } - if itc.Name != nil { - objectMap["name"] = itc.Name - } - if itc.ID != nil { - objectMap["id"] = itc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for InterfaceTapConfiguration struct. -func (itc *InterfaceTapConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var interfaceTapConfigurationPropertiesFormat InterfaceTapConfigurationPropertiesFormat - err = json.Unmarshal(*v, &interfaceTapConfigurationPropertiesFormat) - if err != nil { - return err - } - itc.InterfaceTapConfigurationPropertiesFormat = &interfaceTapConfigurationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - itc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - itc.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - itc.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - itc.ID = &ID - } - } - } - - return nil -} - -// InterfaceTapConfigurationListResult response for list tap configurations API service call. -type InterfaceTapConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - A list of tap configurations. - Value *[]InterfaceTapConfiguration `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for InterfaceTapConfigurationListResult. -func (itclr InterfaceTapConfigurationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if itclr.Value != nil { - objectMap["value"] = itclr.Value - } - return json.Marshal(objectMap) -} - -// InterfaceTapConfigurationListResultIterator provides access to a complete listing of -// InterfaceTapConfiguration values. -type InterfaceTapConfigurationListResultIterator struct { - i int - page InterfaceTapConfigurationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *InterfaceTapConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceTapConfigurationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *InterfaceTapConfigurationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter InterfaceTapConfigurationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter InterfaceTapConfigurationListResultIterator) Response() InterfaceTapConfigurationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter InterfaceTapConfigurationListResultIterator) Value() InterfaceTapConfiguration { - if !iter.page.NotDone() { - return InterfaceTapConfiguration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the InterfaceTapConfigurationListResultIterator type. -func NewInterfaceTapConfigurationListResultIterator(page InterfaceTapConfigurationListResultPage) InterfaceTapConfigurationListResultIterator { - return InterfaceTapConfigurationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (itclr InterfaceTapConfigurationListResult) IsEmpty() bool { - return itclr.Value == nil || len(*itclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (itclr InterfaceTapConfigurationListResult) hasNextLink() bool { - return itclr.NextLink != nil && len(*itclr.NextLink) != 0 -} - -// interfaceTapConfigurationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (itclr InterfaceTapConfigurationListResult) interfaceTapConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !itclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(itclr.NextLink))) -} - -// InterfaceTapConfigurationListResultPage contains a page of InterfaceTapConfiguration values. -type InterfaceTapConfigurationListResultPage struct { - fn func(context.Context, InterfaceTapConfigurationListResult) (InterfaceTapConfigurationListResult, error) - itclr InterfaceTapConfigurationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *InterfaceTapConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceTapConfigurationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.itclr) - if err != nil { - return err - } - page.itclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *InterfaceTapConfigurationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page InterfaceTapConfigurationListResultPage) NotDone() bool { - return !page.itclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page InterfaceTapConfigurationListResultPage) Response() InterfaceTapConfigurationListResult { - return page.itclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page InterfaceTapConfigurationListResultPage) Values() []InterfaceTapConfiguration { - if page.itclr.IsEmpty() { - return nil - } - return *page.itclr.Value -} - -// Creates a new instance of the InterfaceTapConfigurationListResultPage type. -func NewInterfaceTapConfigurationListResultPage(cur InterfaceTapConfigurationListResult, getNextPage func(context.Context, InterfaceTapConfigurationListResult) (InterfaceTapConfigurationListResult, error)) InterfaceTapConfigurationListResultPage { - return InterfaceTapConfigurationListResultPage{ - fn: getNextPage, - itclr: cur, - } -} - -// InterfaceTapConfigurationPropertiesFormat properties of Virtual Network Tap configuration. -type InterfaceTapConfigurationPropertiesFormat struct { - // VirtualNetworkTap - The reference to the Virtual Network Tap resource. - VirtualNetworkTap *VirtualNetworkTap `json:"virtualNetworkTap,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the network interface tap configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for InterfaceTapConfigurationPropertiesFormat. -func (itcpf InterfaceTapConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if itcpf.VirtualNetworkTap != nil { - objectMap["virtualNetworkTap"] = itcpf.VirtualNetworkTap - } - return json.Marshal(objectMap) -} - -// InterfaceTapConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type InterfaceTapConfigurationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InterfaceTapConfigurationsClient) (InterfaceTapConfiguration, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InterfaceTapConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for InterfaceTapConfigurationsCreateOrUpdateFuture.Result. -func (future *InterfaceTapConfigurationsCreateOrUpdateFuture) result(client InterfaceTapConfigurationsClient) (itc InterfaceTapConfiguration, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - itc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.InterfaceTapConfigurationsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if itc.Response.Response, err = future.GetResult(sender); err == nil && itc.Response.Response.StatusCode != http.StatusNoContent { - itc, err = client.CreateOrUpdateResponder(itc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsCreateOrUpdateFuture", "Result", itc.Response.Response, "Failure responding to request") - } - } - return -} - -// InterfaceTapConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InterfaceTapConfigurationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InterfaceTapConfigurationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InterfaceTapConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for InterfaceTapConfigurationsDeleteFuture.Result. -func (future *InterfaceTapConfigurationsDeleteFuture) result(client InterfaceTapConfigurationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.InterfaceTapConfigurationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// InterfacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InterfacesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InterfacesClient) (Interface, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InterfacesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for InterfacesCreateOrUpdateFuture.Result. -func (future *InterfacesCreateOrUpdateFuture) result(client InterfacesClient) (i Interface, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - i.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.InterfacesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if i.Response.Response, err = future.GetResult(sender); err == nil && i.Response.Response.StatusCode != http.StatusNoContent { - i, err = client.CreateOrUpdateResponder(i.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", i.Response.Response, "Failure responding to request") - } - } - return -} - -// InterfacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type InterfacesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InterfacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InterfacesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for InterfacesDeleteFuture.Result. -func (future *InterfacesDeleteFuture) result(client InterfacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.InterfacesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// InterfacesGetEffectiveRouteTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InterfacesGetEffectiveRouteTableFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InterfacesClient) (EffectiveRouteListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InterfacesGetEffectiveRouteTableFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for InterfacesGetEffectiveRouteTableFuture.Result. -func (future *InterfacesGetEffectiveRouteTableFuture) result(client InterfacesClient) (erlr EffectiveRouteListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesGetEffectiveRouteTableFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - erlr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.InterfacesGetEffectiveRouteTableFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if erlr.Response.Response, err = future.GetResult(sender); err == nil && erlr.Response.Response.StatusCode != http.StatusNoContent { - erlr, err = client.GetEffectiveRouteTableResponder(erlr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesGetEffectiveRouteTableFuture", "Result", erlr.Response.Response, "Failure responding to request") - } - } - return -} - -// InterfacesListEffectiveNetworkSecurityGroupsFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type InterfacesListEffectiveNetworkSecurityGroupsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InterfacesClient) (EffectiveNetworkSecurityGroupListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InterfacesListEffectiveNetworkSecurityGroupsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for InterfacesListEffectiveNetworkSecurityGroupsFuture.Result. -func (future *InterfacesListEffectiveNetworkSecurityGroupsFuture) result(client InterfacesClient) (ensglr EffectiveNetworkSecurityGroupListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesListEffectiveNetworkSecurityGroupsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ensglr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.InterfacesListEffectiveNetworkSecurityGroupsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ensglr.Response.Response, err = future.GetResult(sender); err == nil && ensglr.Response.Response.StatusCode != http.StatusNoContent { - ensglr, err = client.ListEffectiveNetworkSecurityGroupsResponder(ensglr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesListEffectiveNetworkSecurityGroupsFuture", "Result", ensglr.Response.Response, "Failure responding to request") - } - } - return -} - -// IpsecPolicy an IPSec Policy configuration for a virtual network gateway connection. -type IpsecPolicy struct { - // SaLifeTimeSeconds - The IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for a site to site VPN tunnel. - SaLifeTimeSeconds *int32 `json:"saLifeTimeSeconds,omitempty"` - // SaDataSizeKilobytes - The IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB for a site to site VPN tunnel. - SaDataSizeKilobytes *int32 `json:"saDataSizeKilobytes,omitempty"` - // IpsecEncryption - The IPSec encryption algorithm (IKE phase 1). Possible values include: 'IpsecEncryptionNone', 'IpsecEncryptionDES', 'IpsecEncryptionDES3', 'IpsecEncryptionAES128', 'IpsecEncryptionAES192', 'IpsecEncryptionAES256', 'IpsecEncryptionGCMAES128', 'IpsecEncryptionGCMAES192', 'IpsecEncryptionGCMAES256' - IpsecEncryption IpsecEncryption `json:"ipsecEncryption,omitempty"` - // IpsecIntegrity - The IPSec integrity algorithm (IKE phase 1). Possible values include: 'IpsecIntegrityMD5', 'IpsecIntegritySHA1', 'IpsecIntegritySHA256', 'IpsecIntegrityGCMAES128', 'IpsecIntegrityGCMAES192', 'IpsecIntegrityGCMAES256' - IpsecIntegrity IpsecIntegrity `json:"ipsecIntegrity,omitempty"` - // IkeEncryption - The IKE encryption algorithm (IKE phase 2). Possible values include: 'IkeEncryptionDES', 'IkeEncryptionDES3', 'IkeEncryptionAES128', 'IkeEncryptionAES192', 'IkeEncryptionAES256', 'IkeEncryptionGCMAES256', 'IkeEncryptionGCMAES128' - IkeEncryption IkeEncryption `json:"ikeEncryption,omitempty"` - // IkeIntegrity - The IKE integrity algorithm (IKE phase 2). Possible values include: 'IkeIntegrityMD5', 'IkeIntegritySHA1', 'IkeIntegritySHA256', 'IkeIntegritySHA384', 'IkeIntegrityGCMAES256', 'IkeIntegrityGCMAES128' - IkeIntegrity IkeIntegrity `json:"ikeIntegrity,omitempty"` - // DhGroup - The DH Group used in IKE Phase 1 for initial SA. Possible values include: 'DhGroupNone', 'DhGroupDHGroup1', 'DhGroupDHGroup2', 'DhGroupDHGroup14', 'DhGroupDHGroup2048', 'DhGroupECP256', 'DhGroupECP384', 'DhGroupDHGroup24' - DhGroup DhGroup `json:"dhGroup,omitempty"` - // PfsGroup - The Pfs Group used in IKE Phase 2 for new child SA. Possible values include: 'PfsGroupNone', 'PfsGroupPFS1', 'PfsGroupPFS2', 'PfsGroupPFS2048', 'PfsGroupECP256', 'PfsGroupECP384', 'PfsGroupPFS24', 'PfsGroupPFS14', 'PfsGroupPFSMM' - PfsGroup PfsGroup `json:"pfsGroup,omitempty"` -} - -// Ipv6CircuitConnectionConfig iPv6 Circuit Connection properties for global reach. -type Ipv6CircuitConnectionConfig struct { - // AddressPrefix - /125 IP address space to carve out customer addresses for global reach. - AddressPrefix *string `json:"addressPrefix,omitempty"` - // CircuitConnectionStatus - READ-ONLY; Express Route Circuit connection state. Possible values include: 'CircuitConnectionStatusConnected', 'CircuitConnectionStatusConnecting', 'CircuitConnectionStatusDisconnected' - CircuitConnectionStatus CircuitConnectionStatus `json:"circuitConnectionStatus,omitempty"` -} - -// MarshalJSON is the custom marshaler for Ipv6CircuitConnectionConfig. -func (i6ccc Ipv6CircuitConnectionConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if i6ccc.AddressPrefix != nil { - objectMap["addressPrefix"] = i6ccc.AddressPrefix - } - return json.Marshal(objectMap) -} - -// Ipv6ExpressRouteCircuitPeeringConfig contains IPv6 peering config. -type Ipv6ExpressRouteCircuitPeeringConfig struct { - // PrimaryPeerAddressPrefix - The primary address prefix. - PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` - // SecondaryPeerAddressPrefix - The secondary address prefix. - SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"` - // MicrosoftPeeringConfig - The Microsoft peering configuration. - MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` - // RouteFilter - The reference to the RouteFilter resource. - RouteFilter *SubResource `json:"routeFilter,omitempty"` - // State - The state of peering. Possible values include: 'ExpressRouteCircuitPeeringStateDisabled', 'ExpressRouteCircuitPeeringStateEnabled' - State ExpressRouteCircuitPeeringState `json:"state,omitempty"` -} - -// ListHubRouteTablesResult list of RouteTables and a URL nextLink to get the next set of results. -type ListHubRouteTablesResult struct { - autorest.Response `json:"-"` - // Value - List of RouteTables. - Value *[]HubRouteTable `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListHubRouteTablesResultIterator provides access to a complete listing of HubRouteTable values. -type ListHubRouteTablesResultIterator struct { - i int - page ListHubRouteTablesResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListHubRouteTablesResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListHubRouteTablesResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListHubRouteTablesResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListHubRouteTablesResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListHubRouteTablesResultIterator) Response() ListHubRouteTablesResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListHubRouteTablesResultIterator) Value() HubRouteTable { - if !iter.page.NotDone() { - return HubRouteTable{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListHubRouteTablesResultIterator type. -func NewListHubRouteTablesResultIterator(page ListHubRouteTablesResultPage) ListHubRouteTablesResultIterator { - return ListHubRouteTablesResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lhrtr ListHubRouteTablesResult) IsEmpty() bool { - return lhrtr.Value == nil || len(*lhrtr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lhrtr ListHubRouteTablesResult) hasNextLink() bool { - return lhrtr.NextLink != nil && len(*lhrtr.NextLink) != 0 -} - -// listHubRouteTablesResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lhrtr ListHubRouteTablesResult) listHubRouteTablesResultPreparer(ctx context.Context) (*http.Request, error) { - if !lhrtr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lhrtr.NextLink))) -} - -// ListHubRouteTablesResultPage contains a page of HubRouteTable values. -type ListHubRouteTablesResultPage struct { - fn func(context.Context, ListHubRouteTablesResult) (ListHubRouteTablesResult, error) - lhrtr ListHubRouteTablesResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListHubRouteTablesResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListHubRouteTablesResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lhrtr) - if err != nil { - return err - } - page.lhrtr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListHubRouteTablesResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListHubRouteTablesResultPage) NotDone() bool { - return !page.lhrtr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListHubRouteTablesResultPage) Response() ListHubRouteTablesResult { - return page.lhrtr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListHubRouteTablesResultPage) Values() []HubRouteTable { - if page.lhrtr.IsEmpty() { - return nil - } - return *page.lhrtr.Value -} - -// Creates a new instance of the ListHubRouteTablesResultPage type. -func NewListHubRouteTablesResultPage(cur ListHubRouteTablesResult, getNextPage func(context.Context, ListHubRouteTablesResult) (ListHubRouteTablesResult, error)) ListHubRouteTablesResultPage { - return ListHubRouteTablesResultPage{ - fn: getNextPage, - lhrtr: cur, - } -} - -// ListHubVirtualNetworkConnectionsResult list of HubVirtualNetworkConnections and a URL nextLink to get -// the next set of results. -type ListHubVirtualNetworkConnectionsResult struct { - autorest.Response `json:"-"` - // Value - List of HubVirtualNetworkConnections. - Value *[]HubVirtualNetworkConnection `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListHubVirtualNetworkConnectionsResultIterator provides access to a complete listing of -// HubVirtualNetworkConnection values. -type ListHubVirtualNetworkConnectionsResultIterator struct { - i int - page ListHubVirtualNetworkConnectionsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListHubVirtualNetworkConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListHubVirtualNetworkConnectionsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListHubVirtualNetworkConnectionsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListHubVirtualNetworkConnectionsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListHubVirtualNetworkConnectionsResultIterator) Response() ListHubVirtualNetworkConnectionsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListHubVirtualNetworkConnectionsResultIterator) Value() HubVirtualNetworkConnection { - if !iter.page.NotDone() { - return HubVirtualNetworkConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListHubVirtualNetworkConnectionsResultIterator type. -func NewListHubVirtualNetworkConnectionsResultIterator(page ListHubVirtualNetworkConnectionsResultPage) ListHubVirtualNetworkConnectionsResultIterator { - return ListHubVirtualNetworkConnectionsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lhvncr ListHubVirtualNetworkConnectionsResult) IsEmpty() bool { - return lhvncr.Value == nil || len(*lhvncr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lhvncr ListHubVirtualNetworkConnectionsResult) hasNextLink() bool { - return lhvncr.NextLink != nil && len(*lhvncr.NextLink) != 0 -} - -// listHubVirtualNetworkConnectionsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lhvncr ListHubVirtualNetworkConnectionsResult) listHubVirtualNetworkConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { - if !lhvncr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lhvncr.NextLink))) -} - -// ListHubVirtualNetworkConnectionsResultPage contains a page of HubVirtualNetworkConnection values. -type ListHubVirtualNetworkConnectionsResultPage struct { - fn func(context.Context, ListHubVirtualNetworkConnectionsResult) (ListHubVirtualNetworkConnectionsResult, error) - lhvncr ListHubVirtualNetworkConnectionsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListHubVirtualNetworkConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListHubVirtualNetworkConnectionsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lhvncr) - if err != nil { - return err - } - page.lhvncr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListHubVirtualNetworkConnectionsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListHubVirtualNetworkConnectionsResultPage) NotDone() bool { - return !page.lhvncr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListHubVirtualNetworkConnectionsResultPage) Response() ListHubVirtualNetworkConnectionsResult { - return page.lhvncr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListHubVirtualNetworkConnectionsResultPage) Values() []HubVirtualNetworkConnection { - if page.lhvncr.IsEmpty() { - return nil - } - return *page.lhvncr.Value -} - -// Creates a new instance of the ListHubVirtualNetworkConnectionsResultPage type. -func NewListHubVirtualNetworkConnectionsResultPage(cur ListHubVirtualNetworkConnectionsResult, getNextPage func(context.Context, ListHubVirtualNetworkConnectionsResult) (ListHubVirtualNetworkConnectionsResult, error)) ListHubVirtualNetworkConnectionsResultPage { - return ListHubVirtualNetworkConnectionsResultPage{ - fn: getNextPage, - lhvncr: cur, - } -} - -// ListP2SVpnGatewaysResult result of the request to list P2SVpnGateways. It contains a list of -// P2SVpnGateways and a URL nextLink to get the next set of results. -type ListP2SVpnGatewaysResult struct { - autorest.Response `json:"-"` - // Value - List of P2SVpnGateways. - Value *[]P2SVpnGateway `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListP2SVpnGatewaysResultIterator provides access to a complete listing of P2SVpnGateway values. -type ListP2SVpnGatewaysResultIterator struct { - i int - page ListP2SVpnGatewaysResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListP2SVpnGatewaysResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListP2SVpnGatewaysResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListP2SVpnGatewaysResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListP2SVpnGatewaysResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListP2SVpnGatewaysResultIterator) Response() ListP2SVpnGatewaysResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListP2SVpnGatewaysResultIterator) Value() P2SVpnGateway { - if !iter.page.NotDone() { - return P2SVpnGateway{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListP2SVpnGatewaysResultIterator type. -func NewListP2SVpnGatewaysResultIterator(page ListP2SVpnGatewaysResultPage) ListP2SVpnGatewaysResultIterator { - return ListP2SVpnGatewaysResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lpvgr ListP2SVpnGatewaysResult) IsEmpty() bool { - return lpvgr.Value == nil || len(*lpvgr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lpvgr ListP2SVpnGatewaysResult) hasNextLink() bool { - return lpvgr.NextLink != nil && len(*lpvgr.NextLink) != 0 -} - -// listP2SVpnGatewaysResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lpvgr ListP2SVpnGatewaysResult) listP2SVpnGatewaysResultPreparer(ctx context.Context) (*http.Request, error) { - if !lpvgr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lpvgr.NextLink))) -} - -// ListP2SVpnGatewaysResultPage contains a page of P2SVpnGateway values. -type ListP2SVpnGatewaysResultPage struct { - fn func(context.Context, ListP2SVpnGatewaysResult) (ListP2SVpnGatewaysResult, error) - lpvgr ListP2SVpnGatewaysResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListP2SVpnGatewaysResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListP2SVpnGatewaysResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lpvgr) - if err != nil { - return err - } - page.lpvgr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListP2SVpnGatewaysResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListP2SVpnGatewaysResultPage) NotDone() bool { - return !page.lpvgr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListP2SVpnGatewaysResultPage) Response() ListP2SVpnGatewaysResult { - return page.lpvgr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListP2SVpnGatewaysResultPage) Values() []P2SVpnGateway { - if page.lpvgr.IsEmpty() { - return nil - } - return *page.lpvgr.Value -} - -// Creates a new instance of the ListP2SVpnGatewaysResultPage type. -func NewListP2SVpnGatewaysResultPage(cur ListP2SVpnGatewaysResult, getNextPage func(context.Context, ListP2SVpnGatewaysResult) (ListP2SVpnGatewaysResult, error)) ListP2SVpnGatewaysResultPage { - return ListP2SVpnGatewaysResultPage{ - fn: getNextPage, - lpvgr: cur, - } -} - -// ListRouteMapsResult list of RouteMaps and a URL nextLink to get the next set of results. -type ListRouteMapsResult struct { - autorest.Response `json:"-"` - // Value - List of RouteMaps. - Value *[]RouteMap `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListRouteMapsResultIterator provides access to a complete listing of RouteMap values. -type ListRouteMapsResultIterator struct { - i int - page ListRouteMapsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListRouteMapsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListRouteMapsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListRouteMapsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListRouteMapsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListRouteMapsResultIterator) Response() ListRouteMapsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListRouteMapsResultIterator) Value() RouteMap { - if !iter.page.NotDone() { - return RouteMap{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListRouteMapsResultIterator type. -func NewListRouteMapsResultIterator(page ListRouteMapsResultPage) ListRouteMapsResultIterator { - return ListRouteMapsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lrmr ListRouteMapsResult) IsEmpty() bool { - return lrmr.Value == nil || len(*lrmr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lrmr ListRouteMapsResult) hasNextLink() bool { - return lrmr.NextLink != nil && len(*lrmr.NextLink) != 0 -} - -// listRouteMapsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lrmr ListRouteMapsResult) listRouteMapsResultPreparer(ctx context.Context) (*http.Request, error) { - if !lrmr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lrmr.NextLink))) -} - -// ListRouteMapsResultPage contains a page of RouteMap values. -type ListRouteMapsResultPage struct { - fn func(context.Context, ListRouteMapsResult) (ListRouteMapsResult, error) - lrmr ListRouteMapsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListRouteMapsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListRouteMapsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lrmr) - if err != nil { - return err - } - page.lrmr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListRouteMapsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListRouteMapsResultPage) NotDone() bool { - return !page.lrmr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListRouteMapsResultPage) Response() ListRouteMapsResult { - return page.lrmr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListRouteMapsResultPage) Values() []RouteMap { - if page.lrmr.IsEmpty() { - return nil - } - return *page.lrmr.Value -} - -// Creates a new instance of the ListRouteMapsResultPage type. -func NewListRouteMapsResultPage(cur ListRouteMapsResult, getNextPage func(context.Context, ListRouteMapsResult) (ListRouteMapsResult, error)) ListRouteMapsResultPage { - return ListRouteMapsResultPage{ - fn: getNextPage, - lrmr: cur, - } -} - -// ListRoutingIntentResult list of the routing intent result and a URL nextLink to get the next set of -// results. -type ListRoutingIntentResult struct { - autorest.Response `json:"-"` - // Value - List of RoutingIntent resource. - Value *[]RoutingIntent `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListRoutingIntentResultIterator provides access to a complete listing of RoutingIntent values. -type ListRoutingIntentResultIterator struct { - i int - page ListRoutingIntentResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListRoutingIntentResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListRoutingIntentResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListRoutingIntentResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListRoutingIntentResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListRoutingIntentResultIterator) Response() ListRoutingIntentResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListRoutingIntentResultIterator) Value() RoutingIntent { - if !iter.page.NotDone() { - return RoutingIntent{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListRoutingIntentResultIterator type. -func NewListRoutingIntentResultIterator(page ListRoutingIntentResultPage) ListRoutingIntentResultIterator { - return ListRoutingIntentResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lrir ListRoutingIntentResult) IsEmpty() bool { - return lrir.Value == nil || len(*lrir.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lrir ListRoutingIntentResult) hasNextLink() bool { - return lrir.NextLink != nil && len(*lrir.NextLink) != 0 -} - -// listRoutingIntentResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lrir ListRoutingIntentResult) listRoutingIntentResultPreparer(ctx context.Context) (*http.Request, error) { - if !lrir.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lrir.NextLink))) -} - -// ListRoutingIntentResultPage contains a page of RoutingIntent values. -type ListRoutingIntentResultPage struct { - fn func(context.Context, ListRoutingIntentResult) (ListRoutingIntentResult, error) - lrir ListRoutingIntentResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListRoutingIntentResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListRoutingIntentResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lrir) - if err != nil { - return err - } - page.lrir = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListRoutingIntentResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListRoutingIntentResultPage) NotDone() bool { - return !page.lrir.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListRoutingIntentResultPage) Response() ListRoutingIntentResult { - return page.lrir -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListRoutingIntentResultPage) Values() []RoutingIntent { - if page.lrir.IsEmpty() { - return nil - } - return *page.lrir.Value -} - -// Creates a new instance of the ListRoutingIntentResultPage type. -func NewListRoutingIntentResultPage(cur ListRoutingIntentResult, getNextPage func(context.Context, ListRoutingIntentResult) (ListRoutingIntentResult, error)) ListRoutingIntentResultPage { - return ListRoutingIntentResultPage{ - fn: getNextPage, - lrir: cur, - } -} - -// ListString ... -type ListString struct { - autorest.Response `json:"-"` - Value *[]string `json:"value,omitempty"` -} - -// ListVirtualHubBgpConnectionResults virtualHubBgpConnections list. -type ListVirtualHubBgpConnectionResults struct { - autorest.Response `json:"-"` - // Value - The list of VirtualHubBgpConnections. - Value *[]BgpConnection `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListVirtualHubBgpConnectionResultsIterator provides access to a complete listing of BgpConnection -// values. -type ListVirtualHubBgpConnectionResultsIterator struct { - i int - page ListVirtualHubBgpConnectionResultsPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListVirtualHubBgpConnectionResultsIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubBgpConnectionResultsIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListVirtualHubBgpConnectionResultsIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListVirtualHubBgpConnectionResultsIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListVirtualHubBgpConnectionResultsIterator) Response() ListVirtualHubBgpConnectionResults { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListVirtualHubBgpConnectionResultsIterator) Value() BgpConnection { - if !iter.page.NotDone() { - return BgpConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListVirtualHubBgpConnectionResultsIterator type. -func NewListVirtualHubBgpConnectionResultsIterator(page ListVirtualHubBgpConnectionResultsPage) ListVirtualHubBgpConnectionResultsIterator { - return ListVirtualHubBgpConnectionResultsIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvhbcr ListVirtualHubBgpConnectionResults) IsEmpty() bool { - return lvhbcr.Value == nil || len(*lvhbcr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvhbcr ListVirtualHubBgpConnectionResults) hasNextLink() bool { - return lvhbcr.NextLink != nil && len(*lvhbcr.NextLink) != 0 -} - -// listVirtualHubBgpConnectionResultsPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvhbcr ListVirtualHubBgpConnectionResults) listVirtualHubBgpConnectionResultsPreparer(ctx context.Context) (*http.Request, error) { - if !lvhbcr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvhbcr.NextLink))) -} - -// ListVirtualHubBgpConnectionResultsPage contains a page of BgpConnection values. -type ListVirtualHubBgpConnectionResultsPage struct { - fn func(context.Context, ListVirtualHubBgpConnectionResults) (ListVirtualHubBgpConnectionResults, error) - lvhbcr ListVirtualHubBgpConnectionResults -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListVirtualHubBgpConnectionResultsPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubBgpConnectionResultsPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvhbcr) - if err != nil { - return err - } - page.lvhbcr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListVirtualHubBgpConnectionResultsPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListVirtualHubBgpConnectionResultsPage) NotDone() bool { - return !page.lvhbcr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListVirtualHubBgpConnectionResultsPage) Response() ListVirtualHubBgpConnectionResults { - return page.lvhbcr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListVirtualHubBgpConnectionResultsPage) Values() []BgpConnection { - if page.lvhbcr.IsEmpty() { - return nil - } - return *page.lvhbcr.Value -} - -// Creates a new instance of the ListVirtualHubBgpConnectionResultsPage type. -func NewListVirtualHubBgpConnectionResultsPage(cur ListVirtualHubBgpConnectionResults, getNextPage func(context.Context, ListVirtualHubBgpConnectionResults) (ListVirtualHubBgpConnectionResults, error)) ListVirtualHubBgpConnectionResultsPage { - return ListVirtualHubBgpConnectionResultsPage{ - fn: getNextPage, - lvhbcr: cur, - } -} - -// ListVirtualHubIPConfigurationResults virtualHubIpConfigurations list. -type ListVirtualHubIPConfigurationResults struct { - autorest.Response `json:"-"` - // Value - The list of VirtualHubIpConfigurations. - Value *[]HubIPConfiguration `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListVirtualHubIPConfigurationResultsIterator provides access to a complete listing of HubIPConfiguration -// values. -type ListVirtualHubIPConfigurationResultsIterator struct { - i int - page ListVirtualHubIPConfigurationResultsPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListVirtualHubIPConfigurationResultsIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubIPConfigurationResultsIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListVirtualHubIPConfigurationResultsIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListVirtualHubIPConfigurationResultsIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListVirtualHubIPConfigurationResultsIterator) Response() ListVirtualHubIPConfigurationResults { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListVirtualHubIPConfigurationResultsIterator) Value() HubIPConfiguration { - if !iter.page.NotDone() { - return HubIPConfiguration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListVirtualHubIPConfigurationResultsIterator type. -func NewListVirtualHubIPConfigurationResultsIterator(page ListVirtualHubIPConfigurationResultsPage) ListVirtualHubIPConfigurationResultsIterator { - return ListVirtualHubIPConfigurationResultsIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvhicr ListVirtualHubIPConfigurationResults) IsEmpty() bool { - return lvhicr.Value == nil || len(*lvhicr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvhicr ListVirtualHubIPConfigurationResults) hasNextLink() bool { - return lvhicr.NextLink != nil && len(*lvhicr.NextLink) != 0 -} - -// listVirtualHubIPConfigurationResultsPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvhicr ListVirtualHubIPConfigurationResults) listVirtualHubIPConfigurationResultsPreparer(ctx context.Context) (*http.Request, error) { - if !lvhicr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvhicr.NextLink))) -} - -// ListVirtualHubIPConfigurationResultsPage contains a page of HubIPConfiguration values. -type ListVirtualHubIPConfigurationResultsPage struct { - fn func(context.Context, ListVirtualHubIPConfigurationResults) (ListVirtualHubIPConfigurationResults, error) - lvhicr ListVirtualHubIPConfigurationResults -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListVirtualHubIPConfigurationResultsPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubIPConfigurationResultsPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvhicr) - if err != nil { - return err - } - page.lvhicr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListVirtualHubIPConfigurationResultsPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListVirtualHubIPConfigurationResultsPage) NotDone() bool { - return !page.lvhicr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListVirtualHubIPConfigurationResultsPage) Response() ListVirtualHubIPConfigurationResults { - return page.lvhicr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListVirtualHubIPConfigurationResultsPage) Values() []HubIPConfiguration { - if page.lvhicr.IsEmpty() { - return nil - } - return *page.lvhicr.Value -} - -// Creates a new instance of the ListVirtualHubIPConfigurationResultsPage type. -func NewListVirtualHubIPConfigurationResultsPage(cur ListVirtualHubIPConfigurationResults, getNextPage func(context.Context, ListVirtualHubIPConfigurationResults) (ListVirtualHubIPConfigurationResults, error)) ListVirtualHubIPConfigurationResultsPage { - return ListVirtualHubIPConfigurationResultsPage{ - fn: getNextPage, - lvhicr: cur, - } -} - -// ListVirtualHubRouteTableV2sResult list of VirtualHubRouteTableV2s and a URL nextLink to get the next set -// of results. -type ListVirtualHubRouteTableV2sResult struct { - autorest.Response `json:"-"` - // Value - List of VirtualHubRouteTableV2s. - Value *[]VirtualHubRouteTableV2 `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListVirtualHubRouteTableV2sResultIterator provides access to a complete listing of -// VirtualHubRouteTableV2 values. -type ListVirtualHubRouteTableV2sResultIterator struct { - i int - page ListVirtualHubRouteTableV2sResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListVirtualHubRouteTableV2sResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubRouteTableV2sResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListVirtualHubRouteTableV2sResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListVirtualHubRouteTableV2sResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListVirtualHubRouteTableV2sResultIterator) Response() ListVirtualHubRouteTableV2sResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListVirtualHubRouteTableV2sResultIterator) Value() VirtualHubRouteTableV2 { - if !iter.page.NotDone() { - return VirtualHubRouteTableV2{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListVirtualHubRouteTableV2sResultIterator type. -func NewListVirtualHubRouteTableV2sResultIterator(page ListVirtualHubRouteTableV2sResultPage) ListVirtualHubRouteTableV2sResultIterator { - return ListVirtualHubRouteTableV2sResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvhrtvr ListVirtualHubRouteTableV2sResult) IsEmpty() bool { - return lvhrtvr.Value == nil || len(*lvhrtvr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvhrtvr ListVirtualHubRouteTableV2sResult) hasNextLink() bool { - return lvhrtvr.NextLink != nil && len(*lvhrtvr.NextLink) != 0 -} - -// listVirtualHubRouteTableV2sResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvhrtvr ListVirtualHubRouteTableV2sResult) listVirtualHubRouteTableV2sResultPreparer(ctx context.Context) (*http.Request, error) { - if !lvhrtvr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvhrtvr.NextLink))) -} - -// ListVirtualHubRouteTableV2sResultPage contains a page of VirtualHubRouteTableV2 values. -type ListVirtualHubRouteTableV2sResultPage struct { - fn func(context.Context, ListVirtualHubRouteTableV2sResult) (ListVirtualHubRouteTableV2sResult, error) - lvhrtvr ListVirtualHubRouteTableV2sResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListVirtualHubRouteTableV2sResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubRouteTableV2sResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvhrtvr) - if err != nil { - return err - } - page.lvhrtvr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListVirtualHubRouteTableV2sResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListVirtualHubRouteTableV2sResultPage) NotDone() bool { - return !page.lvhrtvr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListVirtualHubRouteTableV2sResultPage) Response() ListVirtualHubRouteTableV2sResult { - return page.lvhrtvr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListVirtualHubRouteTableV2sResultPage) Values() []VirtualHubRouteTableV2 { - if page.lvhrtvr.IsEmpty() { - return nil - } - return *page.lvhrtvr.Value -} - -// Creates a new instance of the ListVirtualHubRouteTableV2sResultPage type. -func NewListVirtualHubRouteTableV2sResultPage(cur ListVirtualHubRouteTableV2sResult, getNextPage func(context.Context, ListVirtualHubRouteTableV2sResult) (ListVirtualHubRouteTableV2sResult, error)) ListVirtualHubRouteTableV2sResultPage { - return ListVirtualHubRouteTableV2sResultPage{ - fn: getNextPage, - lvhrtvr: cur, - } -} - -// ListVirtualHubsResult result of the request to list VirtualHubs. It contains a list of VirtualHubs and a -// URL nextLink to get the next set of results. -type ListVirtualHubsResult struct { - autorest.Response `json:"-"` - // Value - List of VirtualHubs. - Value *[]VirtualHub `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListVirtualHubsResultIterator provides access to a complete listing of VirtualHub values. -type ListVirtualHubsResultIterator struct { - i int - page ListVirtualHubsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListVirtualHubsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListVirtualHubsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListVirtualHubsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListVirtualHubsResultIterator) Response() ListVirtualHubsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListVirtualHubsResultIterator) Value() VirtualHub { - if !iter.page.NotDone() { - return VirtualHub{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListVirtualHubsResultIterator type. -func NewListVirtualHubsResultIterator(page ListVirtualHubsResultPage) ListVirtualHubsResultIterator { - return ListVirtualHubsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvhr ListVirtualHubsResult) IsEmpty() bool { - return lvhr.Value == nil || len(*lvhr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvhr ListVirtualHubsResult) hasNextLink() bool { - return lvhr.NextLink != nil && len(*lvhr.NextLink) != 0 -} - -// listVirtualHubsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvhr ListVirtualHubsResult) listVirtualHubsResultPreparer(ctx context.Context) (*http.Request, error) { - if !lvhr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvhr.NextLink))) -} - -// ListVirtualHubsResultPage contains a page of VirtualHub values. -type ListVirtualHubsResultPage struct { - fn func(context.Context, ListVirtualHubsResult) (ListVirtualHubsResult, error) - lvhr ListVirtualHubsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListVirtualHubsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvhr) - if err != nil { - return err - } - page.lvhr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListVirtualHubsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListVirtualHubsResultPage) NotDone() bool { - return !page.lvhr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListVirtualHubsResultPage) Response() ListVirtualHubsResult { - return page.lvhr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListVirtualHubsResultPage) Values() []VirtualHub { - if page.lvhr.IsEmpty() { - return nil - } - return *page.lvhr.Value -} - -// Creates a new instance of the ListVirtualHubsResultPage type. -func NewListVirtualHubsResultPage(cur ListVirtualHubsResult, getNextPage func(context.Context, ListVirtualHubsResult) (ListVirtualHubsResult, error)) ListVirtualHubsResultPage { - return ListVirtualHubsResultPage{ - fn: getNextPage, - lvhr: cur, - } -} - -// ListVirtualNetworkGatewayNatRulesResult 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. -type ListVirtualNetworkGatewayNatRulesResult struct { - autorest.Response `json:"-"` - // Value - List of Nat Rules. - Value *[]VirtualNetworkGatewayNatRule `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListVirtualNetworkGatewayNatRulesResultIterator provides access to a complete listing of -// VirtualNetworkGatewayNatRule values. -type ListVirtualNetworkGatewayNatRulesResultIterator struct { - i int - page ListVirtualNetworkGatewayNatRulesResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListVirtualNetworkGatewayNatRulesResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualNetworkGatewayNatRulesResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListVirtualNetworkGatewayNatRulesResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListVirtualNetworkGatewayNatRulesResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListVirtualNetworkGatewayNatRulesResultIterator) Response() ListVirtualNetworkGatewayNatRulesResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListVirtualNetworkGatewayNatRulesResultIterator) Value() VirtualNetworkGatewayNatRule { - if !iter.page.NotDone() { - return VirtualNetworkGatewayNatRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListVirtualNetworkGatewayNatRulesResultIterator type. -func NewListVirtualNetworkGatewayNatRulesResultIterator(page ListVirtualNetworkGatewayNatRulesResultPage) ListVirtualNetworkGatewayNatRulesResultIterator { - return ListVirtualNetworkGatewayNatRulesResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvngnrr ListVirtualNetworkGatewayNatRulesResult) IsEmpty() bool { - return lvngnrr.Value == nil || len(*lvngnrr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvngnrr ListVirtualNetworkGatewayNatRulesResult) hasNextLink() bool { - return lvngnrr.NextLink != nil && len(*lvngnrr.NextLink) != 0 -} - -// listVirtualNetworkGatewayNatRulesResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvngnrr ListVirtualNetworkGatewayNatRulesResult) listVirtualNetworkGatewayNatRulesResultPreparer(ctx context.Context) (*http.Request, error) { - if !lvngnrr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvngnrr.NextLink))) -} - -// ListVirtualNetworkGatewayNatRulesResultPage contains a page of VirtualNetworkGatewayNatRule values. -type ListVirtualNetworkGatewayNatRulesResultPage struct { - fn func(context.Context, ListVirtualNetworkGatewayNatRulesResult) (ListVirtualNetworkGatewayNatRulesResult, error) - lvngnrr ListVirtualNetworkGatewayNatRulesResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListVirtualNetworkGatewayNatRulesResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualNetworkGatewayNatRulesResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvngnrr) - if err != nil { - return err - } - page.lvngnrr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListVirtualNetworkGatewayNatRulesResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListVirtualNetworkGatewayNatRulesResultPage) NotDone() bool { - return !page.lvngnrr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListVirtualNetworkGatewayNatRulesResultPage) Response() ListVirtualNetworkGatewayNatRulesResult { - return page.lvngnrr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListVirtualNetworkGatewayNatRulesResultPage) Values() []VirtualNetworkGatewayNatRule { - if page.lvngnrr.IsEmpty() { - return nil - } - return *page.lvngnrr.Value -} - -// Creates a new instance of the ListVirtualNetworkGatewayNatRulesResultPage type. -func NewListVirtualNetworkGatewayNatRulesResultPage(cur ListVirtualNetworkGatewayNatRulesResult, getNextPage func(context.Context, ListVirtualNetworkGatewayNatRulesResult) (ListVirtualNetworkGatewayNatRulesResult, error)) ListVirtualNetworkGatewayNatRulesResultPage { - return ListVirtualNetworkGatewayNatRulesResultPage{ - fn: getNextPage, - lvngnrr: cur, - } -} - -// ListVirtualWANsResult result of the request to list VirtualWANs. It contains a list of VirtualWANs and a -// URL nextLink to get the next set of results. -type ListVirtualWANsResult struct { - autorest.Response `json:"-"` - // Value - List of VirtualWANs. - Value *[]VirtualWAN `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListVirtualWANsResultIterator provides access to a complete listing of VirtualWAN values. -type ListVirtualWANsResultIterator struct { - i int - page ListVirtualWANsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListVirtualWANsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualWANsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListVirtualWANsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListVirtualWANsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListVirtualWANsResultIterator) Response() ListVirtualWANsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListVirtualWANsResultIterator) Value() VirtualWAN { - if !iter.page.NotDone() { - return VirtualWAN{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListVirtualWANsResultIterator type. -func NewListVirtualWANsResultIterator(page ListVirtualWANsResultPage) ListVirtualWANsResultIterator { - return ListVirtualWANsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvwnr ListVirtualWANsResult) IsEmpty() bool { - return lvwnr.Value == nil || len(*lvwnr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvwnr ListVirtualWANsResult) hasNextLink() bool { - return lvwnr.NextLink != nil && len(*lvwnr.NextLink) != 0 -} - -// listVirtualWANsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvwnr ListVirtualWANsResult) listVirtualWANsResultPreparer(ctx context.Context) (*http.Request, error) { - if !lvwnr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvwnr.NextLink))) -} - -// ListVirtualWANsResultPage contains a page of VirtualWAN values. -type ListVirtualWANsResultPage struct { - fn func(context.Context, ListVirtualWANsResult) (ListVirtualWANsResult, error) - lvwnr ListVirtualWANsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListVirtualWANsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualWANsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvwnr) - if err != nil { - return err - } - page.lvwnr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListVirtualWANsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListVirtualWANsResultPage) NotDone() bool { - return !page.lvwnr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListVirtualWANsResultPage) Response() ListVirtualWANsResult { - return page.lvwnr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListVirtualWANsResultPage) Values() []VirtualWAN { - if page.lvwnr.IsEmpty() { - return nil - } - return *page.lvwnr.Value -} - -// Creates a new instance of the ListVirtualWANsResultPage type. -func NewListVirtualWANsResultPage(cur ListVirtualWANsResult, getNextPage func(context.Context, ListVirtualWANsResult) (ListVirtualWANsResult, error)) ListVirtualWANsResultPage { - return ListVirtualWANsResultPage{ - fn: getNextPage, - lvwnr: cur, - } -} - -// ListVpnConnectionsResult 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. -type ListVpnConnectionsResult struct { - autorest.Response `json:"-"` - // Value - List of Vpn Connections. - Value *[]VpnConnection `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListVpnConnectionsResultIterator provides access to a complete listing of VpnConnection values. -type ListVpnConnectionsResultIterator struct { - i int - page ListVpnConnectionsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListVpnConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnConnectionsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListVpnConnectionsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListVpnConnectionsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListVpnConnectionsResultIterator) Response() ListVpnConnectionsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListVpnConnectionsResultIterator) Value() VpnConnection { - if !iter.page.NotDone() { - return VpnConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListVpnConnectionsResultIterator type. -func NewListVpnConnectionsResultIterator(page ListVpnConnectionsResultPage) ListVpnConnectionsResultIterator { - return ListVpnConnectionsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvcr ListVpnConnectionsResult) IsEmpty() bool { - return lvcr.Value == nil || len(*lvcr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvcr ListVpnConnectionsResult) hasNextLink() bool { - return lvcr.NextLink != nil && len(*lvcr.NextLink) != 0 -} - -// listVpnConnectionsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvcr ListVpnConnectionsResult) listVpnConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { - if !lvcr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvcr.NextLink))) -} - -// ListVpnConnectionsResultPage contains a page of VpnConnection values. -type ListVpnConnectionsResultPage struct { - fn func(context.Context, ListVpnConnectionsResult) (ListVpnConnectionsResult, error) - lvcr ListVpnConnectionsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListVpnConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnConnectionsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvcr) - if err != nil { - return err - } - page.lvcr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListVpnConnectionsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListVpnConnectionsResultPage) NotDone() bool { - return !page.lvcr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListVpnConnectionsResultPage) Response() ListVpnConnectionsResult { - return page.lvcr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListVpnConnectionsResultPage) Values() []VpnConnection { - if page.lvcr.IsEmpty() { - return nil - } - return *page.lvcr.Value -} - -// Creates a new instance of the ListVpnConnectionsResultPage type. -func NewListVpnConnectionsResultPage(cur ListVpnConnectionsResult, getNextPage func(context.Context, ListVpnConnectionsResult) (ListVpnConnectionsResult, error)) ListVpnConnectionsResultPage { - return ListVpnConnectionsResultPage{ - fn: getNextPage, - lvcr: cur, - } -} - -// ListVpnGatewayNatRulesResult 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. -type ListVpnGatewayNatRulesResult struct { - autorest.Response `json:"-"` - // Value - List of Nat Rules. - Value *[]VpnGatewayNatRule `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListVpnGatewayNatRulesResultIterator provides access to a complete listing of VpnGatewayNatRule values. -type ListVpnGatewayNatRulesResultIterator struct { - i int - page ListVpnGatewayNatRulesResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListVpnGatewayNatRulesResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnGatewayNatRulesResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListVpnGatewayNatRulesResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListVpnGatewayNatRulesResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListVpnGatewayNatRulesResultIterator) Response() ListVpnGatewayNatRulesResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListVpnGatewayNatRulesResultIterator) Value() VpnGatewayNatRule { - if !iter.page.NotDone() { - return VpnGatewayNatRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListVpnGatewayNatRulesResultIterator type. -func NewListVpnGatewayNatRulesResultIterator(page ListVpnGatewayNatRulesResultPage) ListVpnGatewayNatRulesResultIterator { - return ListVpnGatewayNatRulesResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvgnrr ListVpnGatewayNatRulesResult) IsEmpty() bool { - return lvgnrr.Value == nil || len(*lvgnrr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvgnrr ListVpnGatewayNatRulesResult) hasNextLink() bool { - return lvgnrr.NextLink != nil && len(*lvgnrr.NextLink) != 0 -} - -// listVpnGatewayNatRulesResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvgnrr ListVpnGatewayNatRulesResult) listVpnGatewayNatRulesResultPreparer(ctx context.Context) (*http.Request, error) { - if !lvgnrr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvgnrr.NextLink))) -} - -// ListVpnGatewayNatRulesResultPage contains a page of VpnGatewayNatRule values. -type ListVpnGatewayNatRulesResultPage struct { - fn func(context.Context, ListVpnGatewayNatRulesResult) (ListVpnGatewayNatRulesResult, error) - lvgnrr ListVpnGatewayNatRulesResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListVpnGatewayNatRulesResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnGatewayNatRulesResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvgnrr) - if err != nil { - return err - } - page.lvgnrr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListVpnGatewayNatRulesResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListVpnGatewayNatRulesResultPage) NotDone() bool { - return !page.lvgnrr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListVpnGatewayNatRulesResultPage) Response() ListVpnGatewayNatRulesResult { - return page.lvgnrr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListVpnGatewayNatRulesResultPage) Values() []VpnGatewayNatRule { - if page.lvgnrr.IsEmpty() { - return nil - } - return *page.lvgnrr.Value -} - -// Creates a new instance of the ListVpnGatewayNatRulesResultPage type. -func NewListVpnGatewayNatRulesResultPage(cur ListVpnGatewayNatRulesResult, getNextPage func(context.Context, ListVpnGatewayNatRulesResult) (ListVpnGatewayNatRulesResult, error)) ListVpnGatewayNatRulesResultPage { - return ListVpnGatewayNatRulesResultPage{ - fn: getNextPage, - lvgnrr: cur, - } -} - -// ListVpnGatewaysResult result of the request to list VpnGateways. It contains a list of VpnGateways and a -// URL nextLink to get the next set of results. -type ListVpnGatewaysResult struct { - autorest.Response `json:"-"` - // Value - List of VpnGateways. - Value *[]VpnGateway `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListVpnGatewaysResultIterator provides access to a complete listing of VpnGateway values. -type ListVpnGatewaysResultIterator struct { - i int - page ListVpnGatewaysResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListVpnGatewaysResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnGatewaysResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListVpnGatewaysResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListVpnGatewaysResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListVpnGatewaysResultIterator) Response() ListVpnGatewaysResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListVpnGatewaysResultIterator) Value() VpnGateway { - if !iter.page.NotDone() { - return VpnGateway{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListVpnGatewaysResultIterator type. -func NewListVpnGatewaysResultIterator(page ListVpnGatewaysResultPage) ListVpnGatewaysResultIterator { - return ListVpnGatewaysResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvgr ListVpnGatewaysResult) IsEmpty() bool { - return lvgr.Value == nil || len(*lvgr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvgr ListVpnGatewaysResult) hasNextLink() bool { - return lvgr.NextLink != nil && len(*lvgr.NextLink) != 0 -} - -// listVpnGatewaysResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvgr ListVpnGatewaysResult) listVpnGatewaysResultPreparer(ctx context.Context) (*http.Request, error) { - if !lvgr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvgr.NextLink))) -} - -// ListVpnGatewaysResultPage contains a page of VpnGateway values. -type ListVpnGatewaysResultPage struct { - fn func(context.Context, ListVpnGatewaysResult) (ListVpnGatewaysResult, error) - lvgr ListVpnGatewaysResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListVpnGatewaysResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnGatewaysResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvgr) - if err != nil { - return err - } - page.lvgr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListVpnGatewaysResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListVpnGatewaysResultPage) NotDone() bool { - return !page.lvgr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListVpnGatewaysResultPage) Response() ListVpnGatewaysResult { - return page.lvgr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListVpnGatewaysResultPage) Values() []VpnGateway { - if page.lvgr.IsEmpty() { - return nil - } - return *page.lvgr.Value -} - -// Creates a new instance of the ListVpnGatewaysResultPage type. -func NewListVpnGatewaysResultPage(cur ListVpnGatewaysResult, getNextPage func(context.Context, ListVpnGatewaysResult) (ListVpnGatewaysResult, error)) ListVpnGatewaysResultPage { - return ListVpnGatewaysResultPage{ - fn: getNextPage, - lvgr: cur, - } -} - -// ListVpnServerConfigurationPolicyGroupsResult result of the request to list -// VpnServerConfigurationPolicyGroups. It contains a list of VpnServerConfigurationPolicyGroups and a URL -// nextLink to get the next set of results. -type ListVpnServerConfigurationPolicyGroupsResult struct { - autorest.Response `json:"-"` - // Value - List of VpnServerConfigurationPolicyGroups. - Value *[]VpnServerConfigurationPolicyGroup `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListVpnServerConfigurationPolicyGroupsResultIterator provides access to a complete listing of -// VpnServerConfigurationPolicyGroup values. -type ListVpnServerConfigurationPolicyGroupsResultIterator struct { - i int - page ListVpnServerConfigurationPolicyGroupsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListVpnServerConfigurationPolicyGroupsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnServerConfigurationPolicyGroupsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListVpnServerConfigurationPolicyGroupsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListVpnServerConfigurationPolicyGroupsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListVpnServerConfigurationPolicyGroupsResultIterator) Response() ListVpnServerConfigurationPolicyGroupsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListVpnServerConfigurationPolicyGroupsResultIterator) Value() VpnServerConfigurationPolicyGroup { - if !iter.page.NotDone() { - return VpnServerConfigurationPolicyGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListVpnServerConfigurationPolicyGroupsResultIterator type. -func NewListVpnServerConfigurationPolicyGroupsResultIterator(page ListVpnServerConfigurationPolicyGroupsResultPage) ListVpnServerConfigurationPolicyGroupsResultIterator { - return ListVpnServerConfigurationPolicyGroupsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvscpgr ListVpnServerConfigurationPolicyGroupsResult) IsEmpty() bool { - return lvscpgr.Value == nil || len(*lvscpgr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvscpgr ListVpnServerConfigurationPolicyGroupsResult) hasNextLink() bool { - return lvscpgr.NextLink != nil && len(*lvscpgr.NextLink) != 0 -} - -// listVpnServerConfigurationPolicyGroupsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvscpgr ListVpnServerConfigurationPolicyGroupsResult) listVpnServerConfigurationPolicyGroupsResultPreparer(ctx context.Context) (*http.Request, error) { - if !lvscpgr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvscpgr.NextLink))) -} - -// ListVpnServerConfigurationPolicyGroupsResultPage contains a page of VpnServerConfigurationPolicyGroup -// values. -type ListVpnServerConfigurationPolicyGroupsResultPage struct { - fn func(context.Context, ListVpnServerConfigurationPolicyGroupsResult) (ListVpnServerConfigurationPolicyGroupsResult, error) - lvscpgr ListVpnServerConfigurationPolicyGroupsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListVpnServerConfigurationPolicyGroupsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnServerConfigurationPolicyGroupsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvscpgr) - if err != nil { - return err - } - page.lvscpgr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListVpnServerConfigurationPolicyGroupsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListVpnServerConfigurationPolicyGroupsResultPage) NotDone() bool { - return !page.lvscpgr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListVpnServerConfigurationPolicyGroupsResultPage) Response() ListVpnServerConfigurationPolicyGroupsResult { - return page.lvscpgr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListVpnServerConfigurationPolicyGroupsResultPage) Values() []VpnServerConfigurationPolicyGroup { - if page.lvscpgr.IsEmpty() { - return nil - } - return *page.lvscpgr.Value -} - -// Creates a new instance of the ListVpnServerConfigurationPolicyGroupsResultPage type. -func NewListVpnServerConfigurationPolicyGroupsResultPage(cur ListVpnServerConfigurationPolicyGroupsResult, getNextPage func(context.Context, ListVpnServerConfigurationPolicyGroupsResult) (ListVpnServerConfigurationPolicyGroupsResult, error)) ListVpnServerConfigurationPolicyGroupsResultPage { - return ListVpnServerConfigurationPolicyGroupsResultPage{ - fn: getNextPage, - lvscpgr: cur, - } -} - -// ListVpnServerConfigurationsResult 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. -type ListVpnServerConfigurationsResult struct { - autorest.Response `json:"-"` - // Value - List of VpnServerConfigurations. - Value *[]VpnServerConfiguration `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListVpnServerConfigurationsResultIterator provides access to a complete listing of -// VpnServerConfiguration values. -type ListVpnServerConfigurationsResultIterator struct { - i int - page ListVpnServerConfigurationsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListVpnServerConfigurationsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnServerConfigurationsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListVpnServerConfigurationsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListVpnServerConfigurationsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListVpnServerConfigurationsResultIterator) Response() ListVpnServerConfigurationsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListVpnServerConfigurationsResultIterator) Value() VpnServerConfiguration { - if !iter.page.NotDone() { - return VpnServerConfiguration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListVpnServerConfigurationsResultIterator type. -func NewListVpnServerConfigurationsResultIterator(page ListVpnServerConfigurationsResultPage) ListVpnServerConfigurationsResultIterator { - return ListVpnServerConfigurationsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvscr ListVpnServerConfigurationsResult) IsEmpty() bool { - return lvscr.Value == nil || len(*lvscr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvscr ListVpnServerConfigurationsResult) hasNextLink() bool { - return lvscr.NextLink != nil && len(*lvscr.NextLink) != 0 -} - -// listVpnServerConfigurationsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvscr ListVpnServerConfigurationsResult) listVpnServerConfigurationsResultPreparer(ctx context.Context) (*http.Request, error) { - if !lvscr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvscr.NextLink))) -} - -// ListVpnServerConfigurationsResultPage contains a page of VpnServerConfiguration values. -type ListVpnServerConfigurationsResultPage struct { - fn func(context.Context, ListVpnServerConfigurationsResult) (ListVpnServerConfigurationsResult, error) - lvscr ListVpnServerConfigurationsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListVpnServerConfigurationsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnServerConfigurationsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvscr) - if err != nil { - return err - } - page.lvscr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListVpnServerConfigurationsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListVpnServerConfigurationsResultPage) NotDone() bool { - return !page.lvscr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListVpnServerConfigurationsResultPage) Response() ListVpnServerConfigurationsResult { - return page.lvscr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListVpnServerConfigurationsResultPage) Values() []VpnServerConfiguration { - if page.lvscr.IsEmpty() { - return nil - } - return *page.lvscr.Value -} - -// Creates a new instance of the ListVpnServerConfigurationsResultPage type. -func NewListVpnServerConfigurationsResultPage(cur ListVpnServerConfigurationsResult, getNextPage func(context.Context, ListVpnServerConfigurationsResult) (ListVpnServerConfigurationsResult, error)) ListVpnServerConfigurationsResultPage { - return ListVpnServerConfigurationsResultPage{ - fn: getNextPage, - lvscr: cur, - } -} - -// ListVpnSiteLinkConnectionsResult 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. -type ListVpnSiteLinkConnectionsResult struct { - autorest.Response `json:"-"` - // Value - List of VpnSiteLinkConnections. - Value *[]VpnSiteLinkConnection `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListVpnSiteLinkConnectionsResultIterator provides access to a complete listing of VpnSiteLinkConnection -// values. -type ListVpnSiteLinkConnectionsResultIterator struct { - i int - page ListVpnSiteLinkConnectionsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListVpnSiteLinkConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSiteLinkConnectionsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListVpnSiteLinkConnectionsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListVpnSiteLinkConnectionsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListVpnSiteLinkConnectionsResultIterator) Response() ListVpnSiteLinkConnectionsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListVpnSiteLinkConnectionsResultIterator) Value() VpnSiteLinkConnection { - if !iter.page.NotDone() { - return VpnSiteLinkConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListVpnSiteLinkConnectionsResultIterator type. -func NewListVpnSiteLinkConnectionsResultIterator(page ListVpnSiteLinkConnectionsResultPage) ListVpnSiteLinkConnectionsResultIterator { - return ListVpnSiteLinkConnectionsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvslcr ListVpnSiteLinkConnectionsResult) IsEmpty() bool { - return lvslcr.Value == nil || len(*lvslcr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvslcr ListVpnSiteLinkConnectionsResult) hasNextLink() bool { - return lvslcr.NextLink != nil && len(*lvslcr.NextLink) != 0 -} - -// listVpnSiteLinkConnectionsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvslcr ListVpnSiteLinkConnectionsResult) listVpnSiteLinkConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { - if !lvslcr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvslcr.NextLink))) -} - -// ListVpnSiteLinkConnectionsResultPage contains a page of VpnSiteLinkConnection values. -type ListVpnSiteLinkConnectionsResultPage struct { - fn func(context.Context, ListVpnSiteLinkConnectionsResult) (ListVpnSiteLinkConnectionsResult, error) - lvslcr ListVpnSiteLinkConnectionsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListVpnSiteLinkConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSiteLinkConnectionsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvslcr) - if err != nil { - return err - } - page.lvslcr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListVpnSiteLinkConnectionsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListVpnSiteLinkConnectionsResultPage) NotDone() bool { - return !page.lvslcr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListVpnSiteLinkConnectionsResultPage) Response() ListVpnSiteLinkConnectionsResult { - return page.lvslcr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListVpnSiteLinkConnectionsResultPage) Values() []VpnSiteLinkConnection { - if page.lvslcr.IsEmpty() { - return nil - } - return *page.lvslcr.Value -} - -// Creates a new instance of the ListVpnSiteLinkConnectionsResultPage type. -func NewListVpnSiteLinkConnectionsResultPage(cur ListVpnSiteLinkConnectionsResult, getNextPage func(context.Context, ListVpnSiteLinkConnectionsResult) (ListVpnSiteLinkConnectionsResult, error)) ListVpnSiteLinkConnectionsResultPage { - return ListVpnSiteLinkConnectionsResultPage{ - fn: getNextPage, - lvslcr: cur, - } -} - -// ListVpnSiteLinksResult result of the request to list VpnSiteLinks. It contains a list of VpnSiteLinks -// and a URL nextLink to get the next set of results. -type ListVpnSiteLinksResult struct { - autorest.Response `json:"-"` - // Value - List of VpnSitesLinks. - Value *[]VpnSiteLink `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListVpnSiteLinksResultIterator provides access to a complete listing of VpnSiteLink values. -type ListVpnSiteLinksResultIterator struct { - i int - page ListVpnSiteLinksResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListVpnSiteLinksResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSiteLinksResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListVpnSiteLinksResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListVpnSiteLinksResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListVpnSiteLinksResultIterator) Response() ListVpnSiteLinksResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListVpnSiteLinksResultIterator) Value() VpnSiteLink { - if !iter.page.NotDone() { - return VpnSiteLink{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListVpnSiteLinksResultIterator type. -func NewListVpnSiteLinksResultIterator(page ListVpnSiteLinksResultPage) ListVpnSiteLinksResultIterator { - return ListVpnSiteLinksResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvslr ListVpnSiteLinksResult) IsEmpty() bool { - return lvslr.Value == nil || len(*lvslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvslr ListVpnSiteLinksResult) hasNextLink() bool { - return lvslr.NextLink != nil && len(*lvslr.NextLink) != 0 -} - -// listVpnSiteLinksResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvslr ListVpnSiteLinksResult) listVpnSiteLinksResultPreparer(ctx context.Context) (*http.Request, error) { - if !lvslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvslr.NextLink))) -} - -// ListVpnSiteLinksResultPage contains a page of VpnSiteLink values. -type ListVpnSiteLinksResultPage struct { - fn func(context.Context, ListVpnSiteLinksResult) (ListVpnSiteLinksResult, error) - lvslr ListVpnSiteLinksResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListVpnSiteLinksResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSiteLinksResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvslr) - if err != nil { - return err - } - page.lvslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListVpnSiteLinksResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListVpnSiteLinksResultPage) NotDone() bool { - return !page.lvslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListVpnSiteLinksResultPage) Response() ListVpnSiteLinksResult { - return page.lvslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListVpnSiteLinksResultPage) Values() []VpnSiteLink { - if page.lvslr.IsEmpty() { - return nil - } - return *page.lvslr.Value -} - -// Creates a new instance of the ListVpnSiteLinksResultPage type. -func NewListVpnSiteLinksResultPage(cur ListVpnSiteLinksResult, getNextPage func(context.Context, ListVpnSiteLinksResult) (ListVpnSiteLinksResult, error)) ListVpnSiteLinksResultPage { - return ListVpnSiteLinksResultPage{ - fn: getNextPage, - lvslr: cur, - } -} - -// ListVpnSitesResult result of the request to list VpnSites. It contains a list of VpnSites and a URL -// nextLink to get the next set of results. -type ListVpnSitesResult struct { - autorest.Response `json:"-"` - // Value - List of VpnSites. - Value *[]VpnSite `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// ListVpnSitesResultIterator provides access to a complete listing of VpnSite values. -type ListVpnSitesResultIterator struct { - i int - page ListVpnSitesResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListVpnSitesResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSitesResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListVpnSitesResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListVpnSitesResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListVpnSitesResultIterator) Response() ListVpnSitesResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListVpnSitesResultIterator) Value() VpnSite { - if !iter.page.NotDone() { - return VpnSite{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListVpnSitesResultIterator type. -func NewListVpnSitesResultIterator(page ListVpnSitesResultPage) ListVpnSitesResultIterator { - return ListVpnSitesResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lvsr ListVpnSitesResult) IsEmpty() bool { - return lvsr.Value == nil || len(*lvsr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lvsr ListVpnSitesResult) hasNextLink() bool { - return lvsr.NextLink != nil && len(*lvsr.NextLink) != 0 -} - -// listVpnSitesResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lvsr ListVpnSitesResult) listVpnSitesResultPreparer(ctx context.Context) (*http.Request, error) { - if !lvsr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lvsr.NextLink))) -} - -// ListVpnSitesResultPage contains a page of VpnSite values. -type ListVpnSitesResultPage struct { - fn func(context.Context, ListVpnSitesResult) (ListVpnSitesResult, error) - lvsr ListVpnSitesResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListVpnSitesResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSitesResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lvsr) - if err != nil { - return err - } - page.lvsr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListVpnSitesResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListVpnSitesResultPage) NotDone() bool { - return !page.lvsr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListVpnSitesResultPage) Response() ListVpnSitesResult { - return page.lvsr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListVpnSitesResultPage) Values() []VpnSite { - if page.lvsr.IsEmpty() { - return nil - } - return *page.lvsr.Value -} - -// Creates a new instance of the ListVpnSitesResultPage type. -func NewListVpnSitesResultPage(cur ListVpnSitesResult, getNextPage func(context.Context, ListVpnSitesResult) (ListVpnSitesResult, error)) ListVpnSitesResultPage { - return ListVpnSitesResultPage{ - fn: getNextPage, - lvsr: cur, - } -} - -// LoadBalancer loadBalancer resource. -type LoadBalancer struct { - autorest.Response `json:"-"` - // ExtendedLocation - The extended location of the load balancer. - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - // Sku - The load balancer SKU. - Sku *LoadBalancerSku `json:"sku,omitempty"` - // LoadBalancerPropertiesFormat - Properties of load balancer. - *LoadBalancerPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for LoadBalancer. -func (lb LoadBalancer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lb.ExtendedLocation != nil { - objectMap["extendedLocation"] = lb.ExtendedLocation - } - if lb.Sku != nil { - objectMap["sku"] = lb.Sku - } - if lb.LoadBalancerPropertiesFormat != nil { - objectMap["properties"] = lb.LoadBalancerPropertiesFormat - } - if lb.ID != nil { - objectMap["id"] = lb.ID - } - if lb.Location != nil { - objectMap["location"] = lb.Location - } - if lb.Tags != nil { - objectMap["tags"] = lb.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LoadBalancer struct. -func (lb *LoadBalancer) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "extendedLocation": - if v != nil { - var extendedLocation ExtendedLocation - err = json.Unmarshal(*v, &extendedLocation) - if err != nil { - return err - } - lb.ExtendedLocation = &extendedLocation - } - case "sku": - if v != nil { - var sku LoadBalancerSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - lb.Sku = &sku - } - case "properties": - if v != nil { - var loadBalancerPropertiesFormat LoadBalancerPropertiesFormat - err = json.Unmarshal(*v, &loadBalancerPropertiesFormat) - if err != nil { - return err - } - lb.LoadBalancerPropertiesFormat = &loadBalancerPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - lb.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lb.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lb.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lb.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lb.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lb.Tags = tags - } - } - } - - return nil -} - -// LoadBalancerBackendAddress load balancer backend addresses. -type LoadBalancerBackendAddress struct { - // LoadBalancerBackendAddressPropertiesFormat - Properties of load balancer backend address pool. - *LoadBalancerBackendAddressPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the backend address. - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoadBalancerBackendAddress. -func (lbba LoadBalancerBackendAddress) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lbba.LoadBalancerBackendAddressPropertiesFormat != nil { - objectMap["properties"] = lbba.LoadBalancerBackendAddressPropertiesFormat - } - if lbba.Name != nil { - objectMap["name"] = lbba.Name - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LoadBalancerBackendAddress struct. -func (lbba *LoadBalancerBackendAddress) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var loadBalancerBackendAddressPropertiesFormat LoadBalancerBackendAddressPropertiesFormat - err = json.Unmarshal(*v, &loadBalancerBackendAddressPropertiesFormat) - if err != nil { - return err - } - lbba.LoadBalancerBackendAddressPropertiesFormat = &loadBalancerBackendAddressPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lbba.Name = &name - } - } - } - - return nil -} - -// LoadBalancerBackendAddressPoolListResult response for ListBackendAddressPool API service call. -type LoadBalancerBackendAddressPoolListResult struct { - autorest.Response `json:"-"` - // Value - A list of backend address pools in a load balancer. - Value *[]BackendAddressPool `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoadBalancerBackendAddressPoolListResult. -func (lbbaplr LoadBalancerBackendAddressPoolListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lbbaplr.Value != nil { - objectMap["value"] = lbbaplr.Value - } - return json.Marshal(objectMap) -} - -// LoadBalancerBackendAddressPoolListResultIterator provides access to a complete listing of -// BackendAddressPool values. -type LoadBalancerBackendAddressPoolListResultIterator struct { - i int - page LoadBalancerBackendAddressPoolListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *LoadBalancerBackendAddressPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerBackendAddressPoolListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *LoadBalancerBackendAddressPoolListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LoadBalancerBackendAddressPoolListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter LoadBalancerBackendAddressPoolListResultIterator) Response() LoadBalancerBackendAddressPoolListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter LoadBalancerBackendAddressPoolListResultIterator) Value() BackendAddressPool { - if !iter.page.NotDone() { - return BackendAddressPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LoadBalancerBackendAddressPoolListResultIterator type. -func NewLoadBalancerBackendAddressPoolListResultIterator(page LoadBalancerBackendAddressPoolListResultPage) LoadBalancerBackendAddressPoolListResultIterator { - return LoadBalancerBackendAddressPoolListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lbbaplr LoadBalancerBackendAddressPoolListResult) IsEmpty() bool { - return lbbaplr.Value == nil || len(*lbbaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lbbaplr LoadBalancerBackendAddressPoolListResult) hasNextLink() bool { - return lbbaplr.NextLink != nil && len(*lbbaplr.NextLink) != 0 -} - -// loadBalancerBackendAddressPoolListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lbbaplr LoadBalancerBackendAddressPoolListResult) loadBalancerBackendAddressPoolListResultPreparer(ctx context.Context) (*http.Request, error) { - if !lbbaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lbbaplr.NextLink))) -} - -// LoadBalancerBackendAddressPoolListResultPage contains a page of BackendAddressPool values. -type LoadBalancerBackendAddressPoolListResultPage struct { - fn func(context.Context, LoadBalancerBackendAddressPoolListResult) (LoadBalancerBackendAddressPoolListResult, error) - lbbaplr LoadBalancerBackendAddressPoolListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *LoadBalancerBackendAddressPoolListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerBackendAddressPoolListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lbbaplr) - if err != nil { - return err - } - page.lbbaplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *LoadBalancerBackendAddressPoolListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LoadBalancerBackendAddressPoolListResultPage) NotDone() bool { - return !page.lbbaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LoadBalancerBackendAddressPoolListResultPage) Response() LoadBalancerBackendAddressPoolListResult { - return page.lbbaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LoadBalancerBackendAddressPoolListResultPage) Values() []BackendAddressPool { - if page.lbbaplr.IsEmpty() { - return nil - } - return *page.lbbaplr.Value -} - -// Creates a new instance of the LoadBalancerBackendAddressPoolListResultPage type. -func NewLoadBalancerBackendAddressPoolListResultPage(cur LoadBalancerBackendAddressPoolListResult, getNextPage func(context.Context, LoadBalancerBackendAddressPoolListResult) (LoadBalancerBackendAddressPoolListResult, error)) LoadBalancerBackendAddressPoolListResultPage { - return LoadBalancerBackendAddressPoolListResultPage{ - fn: getNextPage, - lbbaplr: cur, - } -} - -// LoadBalancerBackendAddressPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type LoadBalancerBackendAddressPoolsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LoadBalancerBackendAddressPoolsClient) (BackendAddressPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LoadBalancerBackendAddressPoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LoadBalancerBackendAddressPoolsCreateOrUpdateFuture.Result. -func (future *LoadBalancerBackendAddressPoolsCreateOrUpdateFuture) result(client LoadBalancerBackendAddressPoolsClient) (bap BackendAddressPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.LoadBalancerBackendAddressPoolsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bap.Response.Response, err = future.GetResult(sender); err == nil && bap.Response.Response.StatusCode != http.StatusNoContent { - bap, err = client.CreateOrUpdateResponder(bap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsCreateOrUpdateFuture", "Result", bap.Response.Response, "Failure responding to request") - } - } - return -} - -// LoadBalancerBackendAddressPoolsDeleteFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type LoadBalancerBackendAddressPoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LoadBalancerBackendAddressPoolsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LoadBalancerBackendAddressPoolsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LoadBalancerBackendAddressPoolsDeleteFuture.Result. -func (future *LoadBalancerBackendAddressPoolsDeleteFuture) result(client LoadBalancerBackendAddressPoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.LoadBalancerBackendAddressPoolsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// LoadBalancerBackendAddressPropertiesFormat properties of the load balancer backend addresses. -type LoadBalancerBackendAddressPropertiesFormat struct { - // VirtualNetwork - Reference to an existing virtual network. - VirtualNetwork *SubResource `json:"virtualNetwork,omitempty"` - // Subnet - Reference to an existing subnet. - Subnet *SubResource `json:"subnet,omitempty"` - // IPAddress - IP Address belonging to the referenced virtual network. - IPAddress *string `json:"ipAddress,omitempty"` - // NetworkInterfaceIPConfiguration - READ-ONLY; Reference to IP address defined in network interfaces. - NetworkInterfaceIPConfiguration *SubResource `json:"networkInterfaceIPConfiguration,omitempty"` - // LoadBalancerFrontendIPConfiguration - Reference to the frontend ip address configuration defined in regional loadbalancer. - LoadBalancerFrontendIPConfiguration *SubResource `json:"loadBalancerFrontendIPConfiguration,omitempty"` - // InboundNatRulesPortMapping - READ-ONLY; Collection of inbound NAT rule port mappings. - InboundNatRulesPortMapping *[]NatRulePortMapping `json:"inboundNatRulesPortMapping,omitempty"` - // AdminState - 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. Possible values include: 'LoadBalancerBackendAddressAdminStateNone', 'LoadBalancerBackendAddressAdminStateUp', 'LoadBalancerBackendAddressAdminStateDown', 'LoadBalancerBackendAddressAdminStateDrain' - AdminState LoadBalancerBackendAddressAdminState `json:"adminState,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoadBalancerBackendAddressPropertiesFormat. -func (lbbapf LoadBalancerBackendAddressPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lbbapf.VirtualNetwork != nil { - objectMap["virtualNetwork"] = lbbapf.VirtualNetwork - } - if lbbapf.Subnet != nil { - objectMap["subnet"] = lbbapf.Subnet - } - if lbbapf.IPAddress != nil { - objectMap["ipAddress"] = lbbapf.IPAddress - } - if lbbapf.LoadBalancerFrontendIPConfiguration != nil { - objectMap["loadBalancerFrontendIPConfiguration"] = lbbapf.LoadBalancerFrontendIPConfiguration - } - if lbbapf.AdminState != "" { - objectMap["adminState"] = lbbapf.AdminState - } - return json.Marshal(objectMap) -} - -// LoadBalancerFrontendIPConfigurationListResult response for ListFrontendIPConfiguration API service call. -type LoadBalancerFrontendIPConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - A list of frontend IP configurations in a load balancer. - Value *[]FrontendIPConfiguration `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoadBalancerFrontendIPConfigurationListResult. -func (lbficlr LoadBalancerFrontendIPConfigurationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lbficlr.Value != nil { - objectMap["value"] = lbficlr.Value - } - return json.Marshal(objectMap) -} - -// LoadBalancerFrontendIPConfigurationListResultIterator provides access to a complete listing of -// FrontendIPConfiguration values. -type LoadBalancerFrontendIPConfigurationListResultIterator struct { - i int - page LoadBalancerFrontendIPConfigurationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *LoadBalancerFrontendIPConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerFrontendIPConfigurationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *LoadBalancerFrontendIPConfigurationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LoadBalancerFrontendIPConfigurationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter LoadBalancerFrontendIPConfigurationListResultIterator) Response() LoadBalancerFrontendIPConfigurationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter LoadBalancerFrontendIPConfigurationListResultIterator) Value() FrontendIPConfiguration { - if !iter.page.NotDone() { - return FrontendIPConfiguration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LoadBalancerFrontendIPConfigurationListResultIterator type. -func NewLoadBalancerFrontendIPConfigurationListResultIterator(page LoadBalancerFrontendIPConfigurationListResultPage) LoadBalancerFrontendIPConfigurationListResultIterator { - return LoadBalancerFrontendIPConfigurationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lbficlr LoadBalancerFrontendIPConfigurationListResult) IsEmpty() bool { - return lbficlr.Value == nil || len(*lbficlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lbficlr LoadBalancerFrontendIPConfigurationListResult) hasNextLink() bool { - return lbficlr.NextLink != nil && len(*lbficlr.NextLink) != 0 -} - -// loadBalancerFrontendIPConfigurationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lbficlr LoadBalancerFrontendIPConfigurationListResult) loadBalancerFrontendIPConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !lbficlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lbficlr.NextLink))) -} - -// LoadBalancerFrontendIPConfigurationListResultPage contains a page of FrontendIPConfiguration values. -type LoadBalancerFrontendIPConfigurationListResultPage struct { - fn func(context.Context, LoadBalancerFrontendIPConfigurationListResult) (LoadBalancerFrontendIPConfigurationListResult, error) - lbficlr LoadBalancerFrontendIPConfigurationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *LoadBalancerFrontendIPConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerFrontendIPConfigurationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lbficlr) - if err != nil { - return err - } - page.lbficlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *LoadBalancerFrontendIPConfigurationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LoadBalancerFrontendIPConfigurationListResultPage) NotDone() bool { - return !page.lbficlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LoadBalancerFrontendIPConfigurationListResultPage) Response() LoadBalancerFrontendIPConfigurationListResult { - return page.lbficlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LoadBalancerFrontendIPConfigurationListResultPage) Values() []FrontendIPConfiguration { - if page.lbficlr.IsEmpty() { - return nil - } - return *page.lbficlr.Value -} - -// Creates a new instance of the LoadBalancerFrontendIPConfigurationListResultPage type. -func NewLoadBalancerFrontendIPConfigurationListResultPage(cur LoadBalancerFrontendIPConfigurationListResult, getNextPage func(context.Context, LoadBalancerFrontendIPConfigurationListResult) (LoadBalancerFrontendIPConfigurationListResult, error)) LoadBalancerFrontendIPConfigurationListResultPage { - return LoadBalancerFrontendIPConfigurationListResultPage{ - fn: getNextPage, - lbficlr: cur, - } -} - -// LoadBalancerListResult response for ListLoadBalancers API service call. -type LoadBalancerListResult struct { - autorest.Response `json:"-"` - // Value - A list of load balancers in a resource group. - Value *[]LoadBalancer `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoadBalancerListResult. -func (lblr LoadBalancerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lblr.Value != nil { - objectMap["value"] = lblr.Value - } - return json.Marshal(objectMap) -} - -// LoadBalancerListResultIterator provides access to a complete listing of LoadBalancer values. -type LoadBalancerListResultIterator struct { - i int - page LoadBalancerListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *LoadBalancerListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *LoadBalancerListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LoadBalancerListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter LoadBalancerListResultIterator) Response() LoadBalancerListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter LoadBalancerListResultIterator) Value() LoadBalancer { - if !iter.page.NotDone() { - return LoadBalancer{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LoadBalancerListResultIterator type. -func NewLoadBalancerListResultIterator(page LoadBalancerListResultPage) LoadBalancerListResultIterator { - return LoadBalancerListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lblr LoadBalancerListResult) IsEmpty() bool { - return lblr.Value == nil || len(*lblr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lblr LoadBalancerListResult) hasNextLink() bool { - return lblr.NextLink != nil && len(*lblr.NextLink) != 0 -} - -// loadBalancerListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lblr LoadBalancerListResult) loadBalancerListResultPreparer(ctx context.Context) (*http.Request, error) { - if !lblr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lblr.NextLink))) -} - -// LoadBalancerListResultPage contains a page of LoadBalancer values. -type LoadBalancerListResultPage struct { - fn func(context.Context, LoadBalancerListResult) (LoadBalancerListResult, error) - lblr LoadBalancerListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *LoadBalancerListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lblr) - if err != nil { - return err - } - page.lblr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *LoadBalancerListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LoadBalancerListResultPage) NotDone() bool { - return !page.lblr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LoadBalancerListResultPage) Response() LoadBalancerListResult { - return page.lblr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LoadBalancerListResultPage) Values() []LoadBalancer { - if page.lblr.IsEmpty() { - return nil - } - return *page.lblr.Value -} - -// Creates a new instance of the LoadBalancerListResultPage type. -func NewLoadBalancerListResultPage(cur LoadBalancerListResult, getNextPage func(context.Context, LoadBalancerListResult) (LoadBalancerListResult, error)) LoadBalancerListResultPage { - return LoadBalancerListResultPage{ - fn: getNextPage, - lblr: cur, - } -} - -// LoadBalancerLoadBalancingRuleListResult response for ListLoadBalancingRule API service call. -type LoadBalancerLoadBalancingRuleListResult struct { - autorest.Response `json:"-"` - // Value - A list of load balancing rules in a load balancer. - Value *[]LoadBalancingRule `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoadBalancerLoadBalancingRuleListResult. -func (lblbrlr LoadBalancerLoadBalancingRuleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lblbrlr.Value != nil { - objectMap["value"] = lblbrlr.Value - } - return json.Marshal(objectMap) -} - -// LoadBalancerLoadBalancingRuleListResultIterator provides access to a complete listing of -// LoadBalancingRule values. -type LoadBalancerLoadBalancingRuleListResultIterator struct { - i int - page LoadBalancerLoadBalancingRuleListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *LoadBalancerLoadBalancingRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerLoadBalancingRuleListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *LoadBalancerLoadBalancingRuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LoadBalancerLoadBalancingRuleListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter LoadBalancerLoadBalancingRuleListResultIterator) Response() LoadBalancerLoadBalancingRuleListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter LoadBalancerLoadBalancingRuleListResultIterator) Value() LoadBalancingRule { - if !iter.page.NotDone() { - return LoadBalancingRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LoadBalancerLoadBalancingRuleListResultIterator type. -func NewLoadBalancerLoadBalancingRuleListResultIterator(page LoadBalancerLoadBalancingRuleListResultPage) LoadBalancerLoadBalancingRuleListResultIterator { - return LoadBalancerLoadBalancingRuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lblbrlr LoadBalancerLoadBalancingRuleListResult) IsEmpty() bool { - return lblbrlr.Value == nil || len(*lblbrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lblbrlr LoadBalancerLoadBalancingRuleListResult) hasNextLink() bool { - return lblbrlr.NextLink != nil && len(*lblbrlr.NextLink) != 0 -} - -// loadBalancerLoadBalancingRuleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lblbrlr LoadBalancerLoadBalancingRuleListResult) loadBalancerLoadBalancingRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !lblbrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lblbrlr.NextLink))) -} - -// LoadBalancerLoadBalancingRuleListResultPage contains a page of LoadBalancingRule values. -type LoadBalancerLoadBalancingRuleListResultPage struct { - fn func(context.Context, LoadBalancerLoadBalancingRuleListResult) (LoadBalancerLoadBalancingRuleListResult, error) - lblbrlr LoadBalancerLoadBalancingRuleListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *LoadBalancerLoadBalancingRuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerLoadBalancingRuleListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lblbrlr) - if err != nil { - return err - } - page.lblbrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *LoadBalancerLoadBalancingRuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LoadBalancerLoadBalancingRuleListResultPage) NotDone() bool { - return !page.lblbrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LoadBalancerLoadBalancingRuleListResultPage) Response() LoadBalancerLoadBalancingRuleListResult { - return page.lblbrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LoadBalancerLoadBalancingRuleListResultPage) Values() []LoadBalancingRule { - if page.lblbrlr.IsEmpty() { - return nil - } - return *page.lblbrlr.Value -} - -// Creates a new instance of the LoadBalancerLoadBalancingRuleListResultPage type. -func NewLoadBalancerLoadBalancingRuleListResultPage(cur LoadBalancerLoadBalancingRuleListResult, getNextPage func(context.Context, LoadBalancerLoadBalancingRuleListResult) (LoadBalancerLoadBalancingRuleListResult, error)) LoadBalancerLoadBalancingRuleListResultPage { - return LoadBalancerLoadBalancingRuleListResultPage{ - fn: getNextPage, - lblbrlr: cur, - } -} - -// LoadBalancerOutboundRuleListResult response for ListOutboundRule API service call. -type LoadBalancerOutboundRuleListResult struct { - autorest.Response `json:"-"` - // Value - A list of outbound rules in a load balancer. - Value *[]OutboundRule `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoadBalancerOutboundRuleListResult. -func (lborlr LoadBalancerOutboundRuleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lborlr.Value != nil { - objectMap["value"] = lborlr.Value - } - return json.Marshal(objectMap) -} - -// LoadBalancerOutboundRuleListResultIterator provides access to a complete listing of OutboundRule values. -type LoadBalancerOutboundRuleListResultIterator struct { - i int - page LoadBalancerOutboundRuleListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *LoadBalancerOutboundRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerOutboundRuleListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *LoadBalancerOutboundRuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LoadBalancerOutboundRuleListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter LoadBalancerOutboundRuleListResultIterator) Response() LoadBalancerOutboundRuleListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter LoadBalancerOutboundRuleListResultIterator) Value() OutboundRule { - if !iter.page.NotDone() { - return OutboundRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LoadBalancerOutboundRuleListResultIterator type. -func NewLoadBalancerOutboundRuleListResultIterator(page LoadBalancerOutboundRuleListResultPage) LoadBalancerOutboundRuleListResultIterator { - return LoadBalancerOutboundRuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lborlr LoadBalancerOutboundRuleListResult) IsEmpty() bool { - return lborlr.Value == nil || len(*lborlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lborlr LoadBalancerOutboundRuleListResult) hasNextLink() bool { - return lborlr.NextLink != nil && len(*lborlr.NextLink) != 0 -} - -// loadBalancerOutboundRuleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lborlr LoadBalancerOutboundRuleListResult) loadBalancerOutboundRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !lborlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lborlr.NextLink))) -} - -// LoadBalancerOutboundRuleListResultPage contains a page of OutboundRule values. -type LoadBalancerOutboundRuleListResultPage struct { - fn func(context.Context, LoadBalancerOutboundRuleListResult) (LoadBalancerOutboundRuleListResult, error) - lborlr LoadBalancerOutboundRuleListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *LoadBalancerOutboundRuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerOutboundRuleListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lborlr) - if err != nil { - return err - } - page.lborlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *LoadBalancerOutboundRuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LoadBalancerOutboundRuleListResultPage) NotDone() bool { - return !page.lborlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LoadBalancerOutboundRuleListResultPage) Response() LoadBalancerOutboundRuleListResult { - return page.lborlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LoadBalancerOutboundRuleListResultPage) Values() []OutboundRule { - if page.lborlr.IsEmpty() { - return nil - } - return *page.lborlr.Value -} - -// Creates a new instance of the LoadBalancerOutboundRuleListResultPage type. -func NewLoadBalancerOutboundRuleListResultPage(cur LoadBalancerOutboundRuleListResult, getNextPage func(context.Context, LoadBalancerOutboundRuleListResult) (LoadBalancerOutboundRuleListResult, error)) LoadBalancerOutboundRuleListResultPage { - return LoadBalancerOutboundRuleListResultPage{ - fn: getNextPage, - lborlr: cur, - } -} - -// LoadBalancerProbeListResult response for ListProbe API service call. -type LoadBalancerProbeListResult struct { - autorest.Response `json:"-"` - // Value - A list of probes in a load balancer. - Value *[]Probe `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoadBalancerProbeListResult. -func (lbplr LoadBalancerProbeListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lbplr.Value != nil { - objectMap["value"] = lbplr.Value - } - return json.Marshal(objectMap) -} - -// LoadBalancerProbeListResultIterator provides access to a complete listing of Probe values. -type LoadBalancerProbeListResultIterator struct { - i int - page LoadBalancerProbeListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *LoadBalancerProbeListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerProbeListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *LoadBalancerProbeListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LoadBalancerProbeListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter LoadBalancerProbeListResultIterator) Response() LoadBalancerProbeListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter LoadBalancerProbeListResultIterator) Value() Probe { - if !iter.page.NotDone() { - return Probe{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LoadBalancerProbeListResultIterator type. -func NewLoadBalancerProbeListResultIterator(page LoadBalancerProbeListResultPage) LoadBalancerProbeListResultIterator { - return LoadBalancerProbeListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lbplr LoadBalancerProbeListResult) IsEmpty() bool { - return lbplr.Value == nil || len(*lbplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lbplr LoadBalancerProbeListResult) hasNextLink() bool { - return lbplr.NextLink != nil && len(*lbplr.NextLink) != 0 -} - -// loadBalancerProbeListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lbplr LoadBalancerProbeListResult) loadBalancerProbeListResultPreparer(ctx context.Context) (*http.Request, error) { - if !lbplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lbplr.NextLink))) -} - -// LoadBalancerProbeListResultPage contains a page of Probe values. -type LoadBalancerProbeListResultPage struct { - fn func(context.Context, LoadBalancerProbeListResult) (LoadBalancerProbeListResult, error) - lbplr LoadBalancerProbeListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *LoadBalancerProbeListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerProbeListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lbplr) - if err != nil { - return err - } - page.lbplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *LoadBalancerProbeListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LoadBalancerProbeListResultPage) NotDone() bool { - return !page.lbplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LoadBalancerProbeListResultPage) Response() LoadBalancerProbeListResult { - return page.lbplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LoadBalancerProbeListResultPage) Values() []Probe { - if page.lbplr.IsEmpty() { - return nil - } - return *page.lbplr.Value -} - -// Creates a new instance of the LoadBalancerProbeListResultPage type. -func NewLoadBalancerProbeListResultPage(cur LoadBalancerProbeListResult, getNextPage func(context.Context, LoadBalancerProbeListResult) (LoadBalancerProbeListResult, error)) LoadBalancerProbeListResultPage { - return LoadBalancerProbeListResultPage{ - fn: getNextPage, - lbplr: cur, - } -} - -// LoadBalancerPropertiesFormat properties of the load balancer. -type LoadBalancerPropertiesFormat struct { - // FrontendIPConfigurations - Object representing the frontend IPs to be used for the load balancer. - FrontendIPConfigurations *[]FrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` - // BackendAddressPools - Collection of backend address pools used by a load balancer. - BackendAddressPools *[]BackendAddressPool `json:"backendAddressPools,omitempty"` - // LoadBalancingRules - Object collection representing the load balancing rules Gets the provisioning. - LoadBalancingRules *[]LoadBalancingRule `json:"loadBalancingRules,omitempty"` - // Probes - Collection of probe objects used in the load balancer. - Probes *[]Probe `json:"probes,omitempty"` - // InboundNatRules - 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. - InboundNatRules *[]InboundNatRule `json:"inboundNatRules,omitempty"` - // InboundNatPools - 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. - InboundNatPools *[]InboundNatPool `json:"inboundNatPools,omitempty"` - // OutboundRules - The outbound rules. - OutboundRules *[]OutboundRule `json:"outboundRules,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the load balancer resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the load balancer resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoadBalancerPropertiesFormat. -func (lbpf LoadBalancerPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lbpf.FrontendIPConfigurations != nil { - objectMap["frontendIPConfigurations"] = lbpf.FrontendIPConfigurations - } - if lbpf.BackendAddressPools != nil { - objectMap["backendAddressPools"] = lbpf.BackendAddressPools - } - if lbpf.LoadBalancingRules != nil { - objectMap["loadBalancingRules"] = lbpf.LoadBalancingRules - } - if lbpf.Probes != nil { - objectMap["probes"] = lbpf.Probes - } - if lbpf.InboundNatRules != nil { - objectMap["inboundNatRules"] = lbpf.InboundNatRules - } - if lbpf.InboundNatPools != nil { - objectMap["inboundNatPools"] = lbpf.InboundNatPools - } - if lbpf.OutboundRules != nil { - objectMap["outboundRules"] = lbpf.OutboundRules - } - return json.Marshal(objectMap) -} - -// LoadBalancerSku SKU of a load balancer. -type LoadBalancerSku struct { - // Name - Name of a load balancer SKU. Possible values include: 'LoadBalancerSkuNameBasic', 'LoadBalancerSkuNameStandard', 'LoadBalancerSkuNameGateway' - Name LoadBalancerSkuName `json:"name,omitempty"` - // Tier - Tier of a load balancer SKU. Possible values include: 'LoadBalancerSkuTierRegional', 'LoadBalancerSkuTierGlobal' - Tier LoadBalancerSkuTier `json:"tier,omitempty"` -} - -// LoadBalancerVipSwapRequest the request for a VIP swap. -type LoadBalancerVipSwapRequest struct { - // FrontendIPConfigurations - A list of frontend IP configuration resources that should swap VIPs. - FrontendIPConfigurations *[]LoadBalancerVipSwapRequestFrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` -} - -// LoadBalancerVipSwapRequestFrontendIPConfiguration VIP swap request's frontend IP configuration object. -type LoadBalancerVipSwapRequestFrontendIPConfiguration struct { - // ID - The ID of frontend IP configuration resource. - ID *string `json:"id,omitempty"` - // LoadBalancerVipSwapRequestFrontendIPConfigurationProperties - The properties of VIP swap request's frontend IP configuration object. - *LoadBalancerVipSwapRequestFrontendIPConfigurationProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoadBalancerVipSwapRequestFrontendIPConfiguration. -func (lbvsrfic LoadBalancerVipSwapRequestFrontendIPConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lbvsrfic.ID != nil { - objectMap["id"] = lbvsrfic.ID - } - if lbvsrfic.LoadBalancerVipSwapRequestFrontendIPConfigurationProperties != nil { - objectMap["properties"] = lbvsrfic.LoadBalancerVipSwapRequestFrontendIPConfigurationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LoadBalancerVipSwapRequestFrontendIPConfiguration struct. -func (lbvsrfic *LoadBalancerVipSwapRequestFrontendIPConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lbvsrfic.ID = &ID - } - case "properties": - if v != nil { - var loadBalancerVipSwapRequestFrontendIPConfigurationProperties LoadBalancerVipSwapRequestFrontendIPConfigurationProperties - err = json.Unmarshal(*v, &loadBalancerVipSwapRequestFrontendIPConfigurationProperties) - if err != nil { - return err - } - lbvsrfic.LoadBalancerVipSwapRequestFrontendIPConfigurationProperties = &loadBalancerVipSwapRequestFrontendIPConfigurationProperties - } - } - } - - return nil -} - -// LoadBalancerVipSwapRequestFrontendIPConfigurationProperties the properties of VIP swap request's -// frontend IP configuration object. -type LoadBalancerVipSwapRequestFrontendIPConfigurationProperties struct { - // PublicIPAddress - A reference to public IP address resource. - PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` -} - -// LoadBalancersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type LoadBalancersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LoadBalancersClient) (LoadBalancer, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LoadBalancersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LoadBalancersCreateOrUpdateFuture.Result. -func (future *LoadBalancersCreateOrUpdateFuture) result(client LoadBalancersClient) (lb LoadBalancer, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - lb.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.LoadBalancersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if lb.Response.Response, err = future.GetResult(sender); err == nil && lb.Response.Response.StatusCode != http.StatusNoContent { - lb, err = client.CreateOrUpdateResponder(lb.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", lb.Response.Response, "Failure responding to request") - } - } - return -} - -// LoadBalancersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type LoadBalancersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LoadBalancersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LoadBalancersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LoadBalancersDeleteFuture.Result. -func (future *LoadBalancersDeleteFuture) result(client LoadBalancersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.LoadBalancersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// LoadBalancersListInboundNatRulePortMappingsFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type LoadBalancersListInboundNatRulePortMappingsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LoadBalancersClient) (BackendAddressInboundNatRulePortMappings, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LoadBalancersListInboundNatRulePortMappingsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LoadBalancersListInboundNatRulePortMappingsFuture.Result. -func (future *LoadBalancersListInboundNatRulePortMappingsFuture) result(client LoadBalancersClient) (bainrpm BackendAddressInboundNatRulePortMappings, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersListInboundNatRulePortMappingsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bainrpm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.LoadBalancersListInboundNatRulePortMappingsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bainrpm.Response.Response, err = future.GetResult(sender); err == nil && bainrpm.Response.Response.StatusCode != http.StatusNoContent { - bainrpm, err = client.ListInboundNatRulePortMappingsResponder(bainrpm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersListInboundNatRulePortMappingsFuture", "Result", bainrpm.Response.Response, "Failure responding to request") - } - } - return -} - -// LoadBalancersSwapPublicIPAddressesFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type LoadBalancersSwapPublicIPAddressesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LoadBalancersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LoadBalancersSwapPublicIPAddressesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LoadBalancersSwapPublicIPAddressesFuture.Result. -func (future *LoadBalancersSwapPublicIPAddressesFuture) result(client LoadBalancersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersSwapPublicIPAddressesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.LoadBalancersSwapPublicIPAddressesFuture") - return - } - ar.Response = future.Response() - return -} - -// LoadBalancingRule a load balancing rule for a load balancer. -type LoadBalancingRule struct { - autorest.Response `json:"-"` - // LoadBalancingRulePropertiesFormat - Properties of load balancer load balancing rule. - *LoadBalancingRulePropertiesFormat `json:"properties,omitempty"` - // Name - 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. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoadBalancingRule. -func (lbr LoadBalancingRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lbr.LoadBalancingRulePropertiesFormat != nil { - objectMap["properties"] = lbr.LoadBalancingRulePropertiesFormat - } - if lbr.Name != nil { - objectMap["name"] = lbr.Name - } - if lbr.ID != nil { - objectMap["id"] = lbr.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LoadBalancingRule struct. -func (lbr *LoadBalancingRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var loadBalancingRulePropertiesFormat LoadBalancingRulePropertiesFormat - err = json.Unmarshal(*v, &loadBalancingRulePropertiesFormat) - if err != nil { - return err - } - lbr.LoadBalancingRulePropertiesFormat = &loadBalancingRulePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lbr.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - lbr.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lbr.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lbr.ID = &ID - } - } - } - - return nil -} - -// LoadBalancingRulePropertiesFormat properties of the load balancer. -type LoadBalancingRulePropertiesFormat struct { - // FrontendIPConfiguration - A reference to frontend IP addresses. - FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` - // BackendAddressPool - A reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend IPs. - BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` - // BackendAddressPools - An array of references to pool of DIPs. - BackendAddressPools *[]SubResource `json:"backendAddressPools,omitempty"` - // Probe - The reference to the load balancer probe used by the load balancing rule. - Probe *SubResource `json:"probe,omitempty"` - // Protocol - The reference to the transport protocol used by the load balancing rule. Possible values include: 'TransportProtocolUDP', 'TransportProtocolTCP', 'TransportProtocolAll' - Protocol TransportProtocol `json:"protocol,omitempty"` - // LoadDistribution - The load distribution policy for this rule. Possible values include: 'LoadDistributionDefault', 'LoadDistributionSourceIP', 'LoadDistributionSourceIPProtocol' - LoadDistribution LoadDistribution `json:"loadDistribution,omitempty"` - // FrontendPort - 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". - FrontendPort *int32 `json:"frontendPort,omitempty"` - // BackendPort - The port used for internal connections on the endpoint. Acceptable values are between 0 and 65535. Note that value 0 enables "Any Port". - BackendPort *int32 `json:"backendPort,omitempty"` - // IdleTimeoutInMinutes - 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. - IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` - // EnableFloatingIP - 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. - EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` - // EnableTCPReset - 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. - EnableTCPReset *bool `json:"enableTcpReset,omitempty"` - // DisableOutboundSnat - Configures SNAT for the VMs in the backend pool to use the publicIP address specified in the frontend of the load balancing rule. - DisableOutboundSnat *bool `json:"disableOutboundSnat,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the load balancing rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for LoadBalancingRulePropertiesFormat. -func (lbrpf LoadBalancingRulePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lbrpf.FrontendIPConfiguration != nil { - objectMap["frontendIPConfiguration"] = lbrpf.FrontendIPConfiguration - } - if lbrpf.BackendAddressPool != nil { - objectMap["backendAddressPool"] = lbrpf.BackendAddressPool - } - if lbrpf.BackendAddressPools != nil { - objectMap["backendAddressPools"] = lbrpf.BackendAddressPools - } - if lbrpf.Probe != nil { - objectMap["probe"] = lbrpf.Probe - } - if lbrpf.Protocol != "" { - objectMap["protocol"] = lbrpf.Protocol - } - if lbrpf.LoadDistribution != "" { - objectMap["loadDistribution"] = lbrpf.LoadDistribution - } - if lbrpf.FrontendPort != nil { - objectMap["frontendPort"] = lbrpf.FrontendPort - } - if lbrpf.BackendPort != nil { - objectMap["backendPort"] = lbrpf.BackendPort - } - if lbrpf.IdleTimeoutInMinutes != nil { - objectMap["idleTimeoutInMinutes"] = lbrpf.IdleTimeoutInMinutes - } - if lbrpf.EnableFloatingIP != nil { - objectMap["enableFloatingIP"] = lbrpf.EnableFloatingIP - } - if lbrpf.EnableTCPReset != nil { - objectMap["enableTcpReset"] = lbrpf.EnableTCPReset - } - if lbrpf.DisableOutboundSnat != nil { - objectMap["disableOutboundSnat"] = lbrpf.DisableOutboundSnat - } - return json.Marshal(objectMap) -} - -// LocalNetworkGateway a common class for general resource information. -type LocalNetworkGateway struct { - autorest.Response `json:"-"` - // LocalNetworkGatewayPropertiesFormat - Properties of the local network gateway. - *LocalNetworkGatewayPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for LocalNetworkGateway. -func (lng LocalNetworkGateway) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lng.LocalNetworkGatewayPropertiesFormat != nil { - objectMap["properties"] = lng.LocalNetworkGatewayPropertiesFormat - } - if lng.ID != nil { - objectMap["id"] = lng.ID - } - if lng.Location != nil { - objectMap["location"] = lng.Location - } - if lng.Tags != nil { - objectMap["tags"] = lng.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LocalNetworkGateway struct. -func (lng *LocalNetworkGateway) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var localNetworkGatewayPropertiesFormat LocalNetworkGatewayPropertiesFormat - err = json.Unmarshal(*v, &localNetworkGatewayPropertiesFormat) - if err != nil { - return err - } - lng.LocalNetworkGatewayPropertiesFormat = &localNetworkGatewayPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - lng.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lng.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lng.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lng.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - lng.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - lng.Tags = tags - } - } - } - - return nil -} - -// LocalNetworkGatewayListResult response for ListLocalNetworkGateways API service call. -type LocalNetworkGatewayListResult struct { - autorest.Response `json:"-"` - // Value - A list of local network gateways that exists in a resource group. - Value *[]LocalNetworkGateway `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocalNetworkGatewayListResult. -func (lnglr LocalNetworkGatewayListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lnglr.Value != nil { - objectMap["value"] = lnglr.Value - } - return json.Marshal(objectMap) -} - -// LocalNetworkGatewayListResultIterator provides access to a complete listing of LocalNetworkGateway -// values. -type LocalNetworkGatewayListResultIterator struct { - i int - page LocalNetworkGatewayListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *LocalNetworkGatewayListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewayListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *LocalNetworkGatewayListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LocalNetworkGatewayListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter LocalNetworkGatewayListResultIterator) Response() LocalNetworkGatewayListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter LocalNetworkGatewayListResultIterator) Value() LocalNetworkGateway { - if !iter.page.NotDone() { - return LocalNetworkGateway{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the LocalNetworkGatewayListResultIterator type. -func NewLocalNetworkGatewayListResultIterator(page LocalNetworkGatewayListResultPage) LocalNetworkGatewayListResultIterator { - return LocalNetworkGatewayListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lnglr LocalNetworkGatewayListResult) IsEmpty() bool { - return lnglr.Value == nil || len(*lnglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lnglr LocalNetworkGatewayListResult) hasNextLink() bool { - return lnglr.NextLink != nil && len(*lnglr.NextLink) != 0 -} - -// localNetworkGatewayListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lnglr LocalNetworkGatewayListResult) localNetworkGatewayListResultPreparer(ctx context.Context) (*http.Request, error) { - if !lnglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lnglr.NextLink))) -} - -// LocalNetworkGatewayListResultPage contains a page of LocalNetworkGateway values. -type LocalNetworkGatewayListResultPage struct { - fn func(context.Context, LocalNetworkGatewayListResult) (LocalNetworkGatewayListResult, error) - lnglr LocalNetworkGatewayListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *LocalNetworkGatewayListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewayListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lnglr) - if err != nil { - return err - } - page.lnglr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *LocalNetworkGatewayListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LocalNetworkGatewayListResultPage) NotDone() bool { - return !page.lnglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page LocalNetworkGatewayListResultPage) Response() LocalNetworkGatewayListResult { - return page.lnglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page LocalNetworkGatewayListResultPage) Values() []LocalNetworkGateway { - if page.lnglr.IsEmpty() { - return nil - } - return *page.lnglr.Value -} - -// Creates a new instance of the LocalNetworkGatewayListResultPage type. -func NewLocalNetworkGatewayListResultPage(cur LocalNetworkGatewayListResult, getNextPage func(context.Context, LocalNetworkGatewayListResult) (LocalNetworkGatewayListResult, error)) LocalNetworkGatewayListResultPage { - return LocalNetworkGatewayListResultPage{ - fn: getNextPage, - lnglr: cur, - } -} - -// LocalNetworkGatewayPropertiesFormat localNetworkGateway properties. -type LocalNetworkGatewayPropertiesFormat struct { - // LocalNetworkAddressSpace - Local network site address space. - LocalNetworkAddressSpace *AddressSpace `json:"localNetworkAddressSpace,omitempty"` - // GatewayIPAddress - IP address of local network gateway. - GatewayIPAddress *string `json:"gatewayIpAddress,omitempty"` - // Fqdn - FQDN of local network gateway. - Fqdn *string `json:"fqdn,omitempty"` - // BgpSettings - Local network gateway's BGP speaker settings. - BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the local network gateway resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the local network gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for LocalNetworkGatewayPropertiesFormat. -func (lngpf LocalNetworkGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lngpf.LocalNetworkAddressSpace != nil { - objectMap["localNetworkAddressSpace"] = lngpf.LocalNetworkAddressSpace - } - if lngpf.GatewayIPAddress != nil { - objectMap["gatewayIpAddress"] = lngpf.GatewayIPAddress - } - if lngpf.Fqdn != nil { - objectMap["fqdn"] = lngpf.Fqdn - } - if lngpf.BgpSettings != nil { - objectMap["bgpSettings"] = lngpf.BgpSettings - } - return json.Marshal(objectMap) -} - -// LocalNetworkGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type LocalNetworkGatewaysCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LocalNetworkGatewaysClient) (LocalNetworkGateway, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LocalNetworkGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LocalNetworkGatewaysCreateOrUpdateFuture.Result. -func (future *LocalNetworkGatewaysCreateOrUpdateFuture) result(client LocalNetworkGatewaysClient) (lng LocalNetworkGateway, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - lng.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if lng.Response.Response, err = future.GetResult(sender); err == nil && lng.Response.Response.StatusCode != http.StatusNoContent { - lng, err = client.CreateOrUpdateResponder(lng.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", lng.Response.Response, "Failure responding to request") - } - } - return -} - -// LocalNetworkGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type LocalNetworkGatewaysDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LocalNetworkGatewaysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LocalNetworkGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LocalNetworkGatewaysDeleteFuture.Result. -func (future *LocalNetworkGatewaysDeleteFuture) result(client LocalNetworkGatewaysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// LogSpecification description of logging specification. -type LogSpecification struct { - // Name - The name of the specification. - Name *string `json:"name,omitempty"` - // DisplayName - The display name of the specification. - DisplayName *string `json:"displayName,omitempty"` - // BlobDuration - Duration of the blob. - BlobDuration *string `json:"blobDuration,omitempty"` -} - -// ManagedRuleGroupOverride defines a managed rule group override setting. -type ManagedRuleGroupOverride struct { - // RuleGroupName - The managed rule group to override. - RuleGroupName *string `json:"ruleGroupName,omitempty"` - // Rules - List of rules that will be disabled. If none specified, all rules in the group will be disabled. - Rules *[]ManagedRuleOverride `json:"rules,omitempty"` -} - -// ManagedRuleOverride defines a managed rule group override setting. -type ManagedRuleOverride struct { - // RuleID - Identifier for the managed rule. - RuleID *string `json:"ruleId,omitempty"` - // State - The state of the managed rule. Defaults to Disabled if not specified. Possible values include: 'ManagedRuleEnabledStateDisabled', 'ManagedRuleEnabledStateEnabled' - State ManagedRuleEnabledState `json:"state,omitempty"` - // Action - Describes the override action to be applied when rule matches. Possible values include: 'ActionTypeAnomalyScoring', 'ActionTypeAllow', 'ActionTypeBlock', 'ActionTypeLog' - Action ActionType `json:"action,omitempty"` -} - -// ManagedRuleSet defines a managed rule set. -type ManagedRuleSet struct { - // RuleSetType - Defines the rule set type to use. - RuleSetType *string `json:"ruleSetType,omitempty"` - // RuleSetVersion - Defines the version of the rule set to use. - RuleSetVersion *string `json:"ruleSetVersion,omitempty"` - // RuleGroupOverrides - Defines the rule group overrides to apply to the rule set. - RuleGroupOverrides *[]ManagedRuleGroupOverride `json:"ruleGroupOverrides,omitempty"` -} - -// ManagedRulesDefinition allow to exclude some variable satisfy the condition for the WAF check. -type ManagedRulesDefinition struct { - // Exclusions - The Exclusions that are applied on the policy. - Exclusions *[]OwaspCrsExclusionEntry `json:"exclusions,omitempty"` - // ManagedRuleSets - The managed rule sets that are associated with the policy. - ManagedRuleSets *[]ManagedRuleSet `json:"managedRuleSets,omitempty"` -} - -// ManagedServiceIdentity identity for the resource. -type ManagedServiceIdentity struct { - // PrincipalID - READ-ONLY; The principal id of the system assigned identity. This property will only be provided for a system assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant id of the system assigned identity. This property will only be provided for a system assigned identity. - TenantID *string `json:"tenantId,omitempty"` - // Type - 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. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - 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}'. - UserAssignedIdentities map[string]*ManagedServiceIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for ManagedServiceIdentity. -func (msi ManagedServiceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if msi.Type != "" { - objectMap["type"] = msi.Type - } - if msi.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = msi.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// ManagedServiceIdentityUserAssignedIdentitiesValue ... -type ManagedServiceIdentityUserAssignedIdentitiesValue struct { - // PrincipalID - READ-ONLY; The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - READ-ONLY; The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedServiceIdentityUserAssignedIdentitiesValue. -func (msiAiv ManagedServiceIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Manager the Managed Network resource -type Manager struct { - autorest.Response `json:"-"` - // ManagerProperties - The network manager properties - *ManagerProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // SystemData - READ-ONLY; The system metadata related to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Manager. -func (mVar Manager) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mVar.ManagerProperties != nil { - objectMap["properties"] = mVar.ManagerProperties - } - if mVar.ID != nil { - objectMap["id"] = mVar.ID - } - if mVar.Location != nil { - objectMap["location"] = mVar.Location - } - if mVar.Tags != nil { - objectMap["tags"] = mVar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Manager struct. -func (mVar *Manager) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var managerProperties ManagerProperties - err = json.Unmarshal(*v, &managerProperties) - if err != nil { - return err - } - mVar.ManagerProperties = &managerProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - mVar.Etag = &etag - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - mVar.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mVar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mVar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mVar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mVar.Tags = tags - } - } - } - - return nil -} - -// ManagerCommit network Manager Commit. -type ManagerCommit struct { - autorest.Response `json:"-"` - // CommitID - READ-ONLY; Commit Id. - CommitID *string `json:"commitId,omitempty"` - // TargetLocations - List of target locations. - TargetLocations *[]string `json:"targetLocations,omitempty"` - // ConfigurationIds - List of configuration ids. - ConfigurationIds *[]string `json:"configurationIds,omitempty"` - // CommitType - Commit Type. Possible values include: 'ConfigurationTypeSecurityAdmin', 'ConfigurationTypeConnectivity' - CommitType ConfigurationType `json:"commitType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagerCommit. -func (mc ManagerCommit) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mc.TargetLocations != nil { - objectMap["targetLocations"] = mc.TargetLocations - } - if mc.ConfigurationIds != nil { - objectMap["configurationIds"] = mc.ConfigurationIds - } - if mc.CommitType != "" { - objectMap["commitType"] = mc.CommitType - } - return json.Marshal(objectMap) -} - -// ManagerCommitsPostFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagerCommitsPostFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagerCommitsClient) (ManagerCommit, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagerCommitsPostFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagerCommitsPostFuture.Result. -func (future *ManagerCommitsPostFuture) result(client ManagerCommitsClient) (mc ManagerCommit, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ManagerCommitsPostFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ManagerCommitsPostFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mc.Response.Response, err = future.GetResult(sender); err == nil && mc.Response.Response.StatusCode != http.StatusNoContent { - mc, err = client.PostResponder(mc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ManagerCommitsPostFuture", "Result", mc.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagerConnection the Network Manager Connection resource -type ManagerConnection struct { - autorest.Response `json:"-"` - // ManagerConnectionProperties - The scope connection properties - *ManagerConnectionProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata related to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagerConnection. -func (mc ManagerConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mc.ManagerConnectionProperties != nil { - objectMap["properties"] = mc.ManagerConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagerConnection struct. -func (mc *ManagerConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var managerConnectionProperties ManagerConnectionProperties - err = json.Unmarshal(*v, &managerConnectionProperties) - if err != nil { - return err - } - mc.ManagerConnectionProperties = &managerConnectionProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - mc.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mc.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - mc.Etag = &etag - } - } - } - - return nil -} - -// ManagerConnectionListResult list of network manager connections. -type ManagerConnectionListResult struct { - autorest.Response `json:"-"` - // Value - List of network manager connections. - Value *[]ManagerConnection `json:"value,omitempty"` - // NextLink - Gets the URL to get the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ManagerConnectionListResultIterator provides access to a complete listing of ManagerConnection values. -type ManagerConnectionListResultIterator struct { - i int - page ManagerConnectionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ManagerConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagerConnectionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ManagerConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagerConnectionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ManagerConnectionListResultIterator) Response() ManagerConnectionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ManagerConnectionListResultIterator) Value() ManagerConnection { - if !iter.page.NotDone() { - return ManagerConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagerConnectionListResultIterator type. -func NewManagerConnectionListResultIterator(page ManagerConnectionListResultPage) ManagerConnectionListResultIterator { - return ManagerConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mclr ManagerConnectionListResult) IsEmpty() bool { - return mclr.Value == nil || len(*mclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mclr ManagerConnectionListResult) hasNextLink() bool { - return mclr.NextLink != nil && len(*mclr.NextLink) != 0 -} - -// managerConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mclr ManagerConnectionListResult) managerConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mclr.NextLink))) -} - -// ManagerConnectionListResultPage contains a page of ManagerConnection values. -type ManagerConnectionListResultPage struct { - fn func(context.Context, ManagerConnectionListResult) (ManagerConnectionListResult, error) - mclr ManagerConnectionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ManagerConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagerConnectionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.mclr) - if err != nil { - return err - } - page.mclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ManagerConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagerConnectionListResultPage) NotDone() bool { - return !page.mclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagerConnectionListResultPage) Response() ManagerConnectionListResult { - return page.mclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagerConnectionListResultPage) Values() []ManagerConnection { - if page.mclr.IsEmpty() { - return nil - } - return *page.mclr.Value -} - -// Creates a new instance of the ManagerConnectionListResultPage type. -func NewManagerConnectionListResultPage(cur ManagerConnectionListResult, getNextPage func(context.Context, ManagerConnectionListResult) (ManagerConnectionListResult, error)) ManagerConnectionListResultPage { - return ManagerConnectionListResultPage{ - fn: getNextPage, - mclr: cur, - } -} - -// ManagerConnectionProperties information about the network manager connection. -type ManagerConnectionProperties struct { - // NetworkManagerID - Network Manager Id. - NetworkManagerID *string `json:"networkManagerId,omitempty"` - // ConnectionState - Connection state. Possible values include: 'ScopeConnectionStateConnected', 'ScopeConnectionStatePending', 'ScopeConnectionStateConflict', 'ScopeConnectionStateRevoked', 'ScopeConnectionStateRejected' - ConnectionState ScopeConnectionState `json:"connectionState,omitempty"` - // Description - A description of the network manager connection. - Description *string `json:"description,omitempty"` -} - -// ManagerDeploymentStatus network Manager Deployment Status. -type ManagerDeploymentStatus struct { - // CommitTime - Commit Time. - CommitTime *date.Time `json:"commitTime,omitempty"` - // Region - Region Name. - Region *string `json:"region,omitempty"` - // DeploymentStatus - Deployment Status. Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusDeploying', 'DeploymentStatusDeployed', 'DeploymentStatusFailed' - DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` - // ConfigurationIds - List of configuration ids. - ConfigurationIds *[]string `json:"configurationIds,omitempty"` - // DeploymentType - Possible values include: 'ConfigurationTypeSecurityAdmin', 'ConfigurationTypeConnectivity' - DeploymentType ConfigurationType `json:"deploymentType,omitempty"` - // ErrorMessage - Error Message. - ErrorMessage *string `json:"errorMessage,omitempty"` -} - -// ManagerDeploymentStatusListResult a list of Network Manager Deployment Status -type ManagerDeploymentStatusListResult struct { - autorest.Response `json:"-"` - // Value - Gets a page of Network Manager Deployment Status - Value *[]ManagerDeploymentStatus `json:"value,omitempty"` - // SkipToken - When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. - SkipToken *string `json:"skipToken,omitempty"` -} - -// ManagerDeploymentStatusParameter network Manager Deployment Status Parameter. -type ManagerDeploymentStatusParameter struct { - // Regions - List of locations. - Regions *[]string `json:"regions,omitempty"` - // DeploymentTypes - List of deployment types. - DeploymentTypes *[]ConfigurationType `json:"deploymentTypes,omitempty"` - // SkipToken - Continuation token for pagination, capturing the next page size and offset, as well as the context of the query. - SkipToken *string `json:"skipToken,omitempty"` -} - -// ManagerEffectiveConnectivityConfigurationListResult result of the request to list -// networkManagerEffectiveConnectivityConfiguration. It contains a list of groups and a skiptoken to get -// the next set of results. -type ManagerEffectiveConnectivityConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - Gets a page of NetworkManagerEffectiveConnectivityConfiguration - Value *[]EffectiveConnectivityConfiguration `json:"value,omitempty"` - // SkipToken - When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. - SkipToken *string `json:"skipToken,omitempty"` -} - -// ManagerEffectiveSecurityAdminRulesListResult result of the request to list -// networkManagerEffectiveSecurityAdminRules. It contains a list of groups and a skiptoken to get the next -// set of results. -type ManagerEffectiveSecurityAdminRulesListResult struct { - autorest.Response `json:"-"` - // Value - Gets a page of NetworkManagerEffectiveSecurityAdminRules - Value *[]BasicEffectiveBaseSecurityAdminRule `json:"value,omitempty"` - // SkipToken - When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. - SkipToken *string `json:"skipToken,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for ManagerEffectiveSecurityAdminRulesListResult struct. -func (mesarlr *ManagerEffectiveSecurityAdminRulesListResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "value": - if v != nil { - value, err := unmarshalBasicEffectiveBaseSecurityAdminRuleArray(*v) - if err != nil { - return err - } - mesarlr.Value = &value - } - case "skipToken": - if v != nil { - var skipToken string - err = json.Unmarshal(*v, &skipToken) - if err != nil { - return err - } - mesarlr.SkipToken = &skipToken - } - } - } - - return nil -} - -// ManagerListResult result of the request to list NetworkManager. It contains a list of network managers -// and a URL link to get the next set of results. -type ManagerListResult struct { - autorest.Response `json:"-"` - // Value - Gets a page of NetworkManager - Value *[]Manager `json:"value,omitempty"` - // NextLink - Gets the URL to get the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ManagerListResultIterator provides access to a complete listing of Manager values. -type ManagerListResultIterator struct { - i int - page ManagerListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ManagerListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagerListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ManagerListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagerListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ManagerListResultIterator) Response() ManagerListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ManagerListResultIterator) Value() Manager { - if !iter.page.NotDone() { - return Manager{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagerListResultIterator type. -func NewManagerListResultIterator(page ManagerListResultPage) ManagerListResultIterator { - return ManagerListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mlr ManagerListResult) IsEmpty() bool { - return mlr.Value == nil || len(*mlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mlr ManagerListResult) hasNextLink() bool { - return mlr.NextLink != nil && len(*mlr.NextLink) != 0 -} - -// managerListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mlr ManagerListResult) managerListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mlr.NextLink))) -} - -// ManagerListResultPage contains a page of Manager values. -type ManagerListResultPage struct { - fn func(context.Context, ManagerListResult) (ManagerListResult, error) - mlr ManagerListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ManagerListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagerListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.mlr) - if err != nil { - return err - } - page.mlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ManagerListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagerListResultPage) NotDone() bool { - return !page.mlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagerListResultPage) Response() ManagerListResult { - return page.mlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagerListResultPage) Values() []Manager { - if page.mlr.IsEmpty() { - return nil - } - return *page.mlr.Value -} - -// Creates a new instance of the ManagerListResultPage type. -func NewManagerListResultPage(cur ManagerListResult, getNextPage func(context.Context, ManagerListResult) (ManagerListResult, error)) ManagerListResultPage { - return ManagerListResultPage{ - fn: getNextPage, - mlr: cur, - } -} - -// ManagerProperties properties of Managed Network -type ManagerProperties struct { - // Description - A description of the network manager. - Description *string `json:"description,omitempty"` - // NetworkManagerScopes - Scope of Network Manager. - NetworkManagerScopes *ManagerPropertiesNetworkManagerScopes `json:"networkManagerScopes,omitempty"` - // NetworkManagerScopeAccesses - Scope Access. - NetworkManagerScopeAccesses *[]ConfigurationType `json:"networkManagerScopeAccesses,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the network manager resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagerProperties. -func (mp ManagerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mp.Description != nil { - objectMap["description"] = mp.Description - } - if mp.NetworkManagerScopes != nil { - objectMap["networkManagerScopes"] = mp.NetworkManagerScopes - } - if mp.NetworkManagerScopeAccesses != nil { - objectMap["networkManagerScopeAccesses"] = mp.NetworkManagerScopeAccesses - } - return json.Marshal(objectMap) -} - -// ManagerPropertiesNetworkManagerScopes scope of Network Manager. -type ManagerPropertiesNetworkManagerScopes struct { - // ManagementGroups - List of management groups. - ManagementGroups *[]string `json:"managementGroups,omitempty"` - // Subscriptions - List of subscriptions. - Subscriptions *[]string `json:"subscriptions,omitempty"` - // CrossTenantScopes - READ-ONLY; List of cross tenant scopes. - CrossTenantScopes *[]CrossTenantScopes `json:"crossTenantScopes,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagerPropertiesNetworkManagerScopes. -func (mpMs ManagerPropertiesNetworkManagerScopes) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mpMs.ManagementGroups != nil { - objectMap["managementGroups"] = mpMs.ManagementGroups - } - if mpMs.Subscriptions != nil { - objectMap["subscriptions"] = mpMs.Subscriptions - } - return json.Marshal(objectMap) -} - -// ManagerSecurityGroupItem network manager security group item. -type ManagerSecurityGroupItem struct { - // NetworkGroupID - Network manager group Id. - NetworkGroupID *string `json:"networkGroupId,omitempty"` -} - -// ManagersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagersDeleteFuture.Result. -func (future *ManagersDeleteFuture) result(client ManagersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ManagersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ManagersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// MatchCondition define match conditions. -type MatchCondition struct { - // MatchVariables - List of match variables. - MatchVariables *[]MatchVariable `json:"matchVariables,omitempty"` - // Operator - The operator to be matched. Possible values include: 'WebApplicationFirewallOperatorIPMatch', 'WebApplicationFirewallOperatorEqual', 'WebApplicationFirewallOperatorContains', 'WebApplicationFirewallOperatorLessThan', 'WebApplicationFirewallOperatorGreaterThan', 'WebApplicationFirewallOperatorLessThanOrEqual', 'WebApplicationFirewallOperatorGreaterThanOrEqual', 'WebApplicationFirewallOperatorBeginsWith', 'WebApplicationFirewallOperatorEndsWith', 'WebApplicationFirewallOperatorRegex', 'WebApplicationFirewallOperatorGeoMatch', 'WebApplicationFirewallOperatorAny' - Operator WebApplicationFirewallOperator `json:"operator,omitempty"` - // NegationConditon - Whether this is negate condition or not. - NegationConditon *bool `json:"negationConditon,omitempty"` - // MatchValues - Match value. - MatchValues *[]string `json:"matchValues,omitempty"` - // Transforms - List of transforms. - Transforms *[]WebApplicationFirewallTransform `json:"transforms,omitempty"` -} - -// MatchVariable define match variables. -type MatchVariable struct { - // VariableName - Match Variable. Possible values include: 'WebApplicationFirewallMatchVariableRemoteAddr', 'WebApplicationFirewallMatchVariableRequestMethod', 'WebApplicationFirewallMatchVariableQueryString', 'WebApplicationFirewallMatchVariablePostArgs', 'WebApplicationFirewallMatchVariableRequestURI', 'WebApplicationFirewallMatchVariableRequestHeaders', 'WebApplicationFirewallMatchVariableRequestBody', 'WebApplicationFirewallMatchVariableRequestCookies' - VariableName WebApplicationFirewallMatchVariable `json:"variableName,omitempty"` - // Selector - The selector of match variable. - Selector *string `json:"selector,omitempty"` -} - -// MatchedRule matched rule. -type MatchedRule struct { - // RuleName - Name of the matched network security rule. - RuleName *string `json:"ruleName,omitempty"` - // Action - The network traffic is allowed or denied. Possible values are 'Allow' and 'Deny'. - Action *string `json:"action,omitempty"` -} - -// MetricSpecification description of metrics specification. -type MetricSpecification struct { - // Name - The name of the metric. - Name *string `json:"name,omitempty"` - // DisplayName - The display name of the metric. - DisplayName *string `json:"displayName,omitempty"` - // DisplayDescription - The description of the metric. - DisplayDescription *string `json:"displayDescription,omitempty"` - // Unit - Units the metric to be displayed in. - Unit *string `json:"unit,omitempty"` - // AggregationType - The aggregation type. - AggregationType *string `json:"aggregationType,omitempty"` - // Availabilities - List of availability. - Availabilities *[]Availability `json:"availabilities,omitempty"` - // EnableRegionalMdmAccount - Whether regional MDM account enabled. - EnableRegionalMdmAccount *bool `json:"enableRegionalMdmAccount,omitempty"` - // FillGapWithZero - Whether gaps would be filled with zeros. - FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` - // MetricFilterPattern - Pattern for the filter of the metric. - MetricFilterPattern *string `json:"metricFilterPattern,omitempty"` - // Dimensions - List of dimensions. - Dimensions *[]Dimension `json:"dimensions,omitempty"` - // IsInternal - Whether the metric is internal. - IsInternal *bool `json:"isInternal,omitempty"` - // SourceMdmAccount - The source MDM account. - SourceMdmAccount *string `json:"sourceMdmAccount,omitempty"` - // SourceMdmNamespace - The source MDM namespace. - SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` - // ResourceIDDimensionNameOverride - The resource Id dimension name override. - ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` -} - -// NatGateway nat Gateway resource. -type NatGateway struct { - autorest.Response `json:"-"` - // Sku - The nat gateway SKU. - Sku *NatGatewaySku `json:"sku,omitempty"` - // NatGatewayPropertiesFormat - Nat Gateway properties. - *NatGatewayPropertiesFormat `json:"properties,omitempty"` - // Zones - A list of availability zones denoting the zone in which Nat Gateway should be deployed. - Zones *[]string `json:"zones,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for NatGateway. -func (ng NatGateway) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ng.Sku != nil { - objectMap["sku"] = ng.Sku - } - if ng.NatGatewayPropertiesFormat != nil { - objectMap["properties"] = ng.NatGatewayPropertiesFormat - } - if ng.Zones != nil { - objectMap["zones"] = ng.Zones - } - if ng.ID != nil { - objectMap["id"] = ng.ID - } - if ng.Location != nil { - objectMap["location"] = ng.Location - } - if ng.Tags != nil { - objectMap["tags"] = ng.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NatGateway struct. -func (ng *NatGateway) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku NatGatewaySku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - ng.Sku = &sku - } - case "properties": - if v != nil { - var natGatewayPropertiesFormat NatGatewayPropertiesFormat - err = json.Unmarshal(*v, &natGatewayPropertiesFormat) - if err != nil { - return err - } - ng.NatGatewayPropertiesFormat = &natGatewayPropertiesFormat - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - ng.Zones = &zones - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ng.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ng.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ng.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ng.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ng.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ng.Tags = tags - } - } - } - - return nil -} - -// NatGatewayListResult response for ListNatGateways API service call. -type NatGatewayListResult struct { - autorest.Response `json:"-"` - // Value - A list of Nat Gateways that exists in a resource group. - Value *[]NatGateway `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// NatGatewayListResultIterator provides access to a complete listing of NatGateway values. -type NatGatewayListResultIterator struct { - i int - page NatGatewayListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *NatGatewayListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NatGatewayListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *NatGatewayListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter NatGatewayListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter NatGatewayListResultIterator) Response() NatGatewayListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter NatGatewayListResultIterator) Value() NatGateway { - if !iter.page.NotDone() { - return NatGateway{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the NatGatewayListResultIterator type. -func NewNatGatewayListResultIterator(page NatGatewayListResultPage) NatGatewayListResultIterator { - return NatGatewayListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (nglr NatGatewayListResult) IsEmpty() bool { - return nglr.Value == nil || len(*nglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (nglr NatGatewayListResult) hasNextLink() bool { - return nglr.NextLink != nil && len(*nglr.NextLink) != 0 -} - -// natGatewayListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (nglr NatGatewayListResult) natGatewayListResultPreparer(ctx context.Context) (*http.Request, error) { - if !nglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(nglr.NextLink))) -} - -// NatGatewayListResultPage contains a page of NatGateway values. -type NatGatewayListResultPage struct { - fn func(context.Context, NatGatewayListResult) (NatGatewayListResult, error) - nglr NatGatewayListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *NatGatewayListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NatGatewayListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.nglr) - if err != nil { - return err - } - page.nglr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *NatGatewayListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page NatGatewayListResultPage) NotDone() bool { - return !page.nglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page NatGatewayListResultPage) Response() NatGatewayListResult { - return page.nglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page NatGatewayListResultPage) Values() []NatGateway { - if page.nglr.IsEmpty() { - return nil - } - return *page.nglr.Value -} - -// Creates a new instance of the NatGatewayListResultPage type. -func NewNatGatewayListResultPage(cur NatGatewayListResult, getNextPage func(context.Context, NatGatewayListResult) (NatGatewayListResult, error)) NatGatewayListResultPage { - return NatGatewayListResultPage{ - fn: getNextPage, - nglr: cur, - } -} - -// NatGatewayPropertiesFormat nat Gateway properties. -type NatGatewayPropertiesFormat struct { - // IdleTimeoutInMinutes - The idle timeout of the nat gateway. - IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` - // PublicIPAddresses - An array of public ip addresses associated with the nat gateway resource. - PublicIPAddresses *[]SubResource `json:"publicIpAddresses,omitempty"` - // PublicIPPrefixes - An array of public ip prefixes associated with the nat gateway resource. - PublicIPPrefixes *[]SubResource `json:"publicIpPrefixes,omitempty"` - // Subnets - READ-ONLY; An array of references to the subnets using this nat gateway resource. - Subnets *[]SubResource `json:"subnets,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the NAT gateway resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the NAT gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for NatGatewayPropertiesFormat. -func (ngpf NatGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ngpf.IdleTimeoutInMinutes != nil { - objectMap["idleTimeoutInMinutes"] = ngpf.IdleTimeoutInMinutes - } - if ngpf.PublicIPAddresses != nil { - objectMap["publicIpAddresses"] = ngpf.PublicIPAddresses - } - if ngpf.PublicIPPrefixes != nil { - objectMap["publicIpPrefixes"] = ngpf.PublicIPPrefixes - } - return json.Marshal(objectMap) -} - -// NatGatewaySku SKU of nat gateway. -type NatGatewaySku struct { - // Name - Name of Nat Gateway SKU. Possible values include: 'NatGatewaySkuNameStandard' - Name NatGatewaySkuName `json:"name,omitempty"` -} - -// NatGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NatGatewaysCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NatGatewaysClient) (NatGateway, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NatGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for NatGatewaysCreateOrUpdateFuture.Result. -func (future *NatGatewaysCreateOrUpdateFuture) result(client NatGatewaysClient) (ng NatGateway, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.NatGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ng.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.NatGatewaysCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ng.Response.Response, err = future.GetResult(sender); err == nil && ng.Response.Response.StatusCode != http.StatusNoContent { - ng, err = client.CreateOrUpdateResponder(ng.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.NatGatewaysCreateOrUpdateFuture", "Result", ng.Response.Response, "Failure responding to request") - } - } - return -} - -// NatGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NatGatewaysDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NatGatewaysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NatGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for NatGatewaysDeleteFuture.Result. -func (future *NatGatewaysDeleteFuture) result(client NatGatewaysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.NatGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.NatGatewaysDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// NatRule rule of type nat. -type NatRule struct { - // IPProtocols - Array of FirewallPolicyRuleNetworkProtocols. - IPProtocols *[]FirewallPolicyRuleNetworkProtocol `json:"ipProtocols,omitempty"` - // SourceAddresses - List of source IP addresses for this rule. - SourceAddresses *[]string `json:"sourceAddresses,omitempty"` - // DestinationAddresses - List of destination IP addresses or Service Tags. - DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` - // DestinationPorts - List of destination ports. - DestinationPorts *[]string `json:"destinationPorts,omitempty"` - // TranslatedAddress - The translated address for this NAT rule. - TranslatedAddress *string `json:"translatedAddress,omitempty"` - // TranslatedPort - The translated port for this NAT rule. - TranslatedPort *string `json:"translatedPort,omitempty"` - // SourceIPGroups - List of source IpGroups for this rule. - SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` - // TranslatedFqdn - The translated FQDN for this NAT rule. - TranslatedFqdn *string `json:"translatedFqdn,omitempty"` - // Name - Name of the rule. - Name *string `json:"name,omitempty"` - // Description - Description of the rule. - Description *string `json:"description,omitempty"` - // RuleType - Possible values include: 'RuleTypeFirewallPolicyRule', 'RuleTypeApplicationRule', 'RuleTypeNatRule', 'RuleTypeNetworkRule' - RuleType RuleType `json:"ruleType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NatRule. -func (nr NatRule) MarshalJSON() ([]byte, error) { - nr.RuleType = RuleTypeNatRule - objectMap := make(map[string]interface{}) - if nr.IPProtocols != nil { - objectMap["ipProtocols"] = nr.IPProtocols - } - if nr.SourceAddresses != nil { - objectMap["sourceAddresses"] = nr.SourceAddresses - } - if nr.DestinationAddresses != nil { - objectMap["destinationAddresses"] = nr.DestinationAddresses - } - if nr.DestinationPorts != nil { - objectMap["destinationPorts"] = nr.DestinationPorts - } - if nr.TranslatedAddress != nil { - objectMap["translatedAddress"] = nr.TranslatedAddress - } - if nr.TranslatedPort != nil { - objectMap["translatedPort"] = nr.TranslatedPort - } - if nr.SourceIPGroups != nil { - objectMap["sourceIpGroups"] = nr.SourceIPGroups - } - if nr.TranslatedFqdn != nil { - objectMap["translatedFqdn"] = nr.TranslatedFqdn - } - if nr.Name != nil { - objectMap["name"] = nr.Name - } - if nr.Description != nil { - objectMap["description"] = nr.Description - } - if nr.RuleType != "" { - objectMap["ruleType"] = nr.RuleType - } - return json.Marshal(objectMap) -} - -// AsApplicationRule is the BasicFirewallPolicyRule implementation for NatRule. -func (nr NatRule) AsApplicationRule() (*ApplicationRule, bool) { - return nil, false -} - -// AsNatRule is the BasicFirewallPolicyRule implementation for NatRule. -func (nr NatRule) AsNatRule() (*NatRule, bool) { - return &nr, true -} - -// AsRule is the BasicFirewallPolicyRule implementation for NatRule. -func (nr NatRule) AsRule() (*Rule, bool) { - return nil, false -} - -// AsFirewallPolicyRule is the BasicFirewallPolicyRule implementation for NatRule. -func (nr NatRule) AsFirewallPolicyRule() (*FirewallPolicyRule, bool) { - return nil, false -} - -// AsBasicFirewallPolicyRule is the BasicFirewallPolicyRule implementation for NatRule. -func (nr NatRule) AsBasicFirewallPolicyRule() (BasicFirewallPolicyRule, bool) { - return &nr, true -} - -// NatRulePortMapping individual port mappings for inbound NAT rule created for backend pool. -type NatRulePortMapping struct { - // InboundNatRuleName - Name of inbound NAT rule. - InboundNatRuleName *string `json:"inboundNatRuleName,omitempty"` - // FrontendPort - Frontend port. - FrontendPort *int32 `json:"frontendPort,omitempty"` - // BackendPort - Backend port. - BackendPort *int32 `json:"backendPort,omitempty"` -} - -// NatRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NatRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NatRulesClient) (VpnGatewayNatRule, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NatRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for NatRulesCreateOrUpdateFuture.Result. -func (future *NatRulesCreateOrUpdateFuture) result(client NatRulesClient) (vgnr VpnGatewayNatRule, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.NatRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vgnr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.NatRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vgnr.Response.Response, err = future.GetResult(sender); err == nil && vgnr.Response.Response.StatusCode != http.StatusNoContent { - vgnr, err = client.CreateOrUpdateResponder(vgnr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.NatRulesCreateOrUpdateFuture", "Result", vgnr.Response.Response, "Failure responding to request") - } - } - return -} - -// NatRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NatRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NatRulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NatRulesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for NatRulesDeleteFuture.Result. -func (future *NatRulesDeleteFuture) result(client NatRulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.NatRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.NatRulesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// NextHopParameters parameters that define the source and destination endpoint. -type NextHopParameters struct { - // TargetResourceID - The resource identifier of the target resource against which the action is to be performed. - TargetResourceID *string `json:"targetResourceId,omitempty"` - // SourceIPAddress - The source IP address. - SourceIPAddress *string `json:"sourceIPAddress,omitempty"` - // DestinationIPAddress - The destination IP address. - DestinationIPAddress *string `json:"destinationIPAddress,omitempty"` - // TargetNicResourceID - 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). - TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` -} - -// NextHopResult the information about next hop from the specified VM. -type NextHopResult struct { - autorest.Response `json:"-"` - // NextHopType - Next hop type. Possible values include: 'NextHopTypeInternet', 'NextHopTypeVirtualAppliance', 'NextHopTypeVirtualNetworkGateway', 'NextHopTypeVnetLocal', 'NextHopTypeHyperNetGateway', 'NextHopTypeNone' - NextHopType NextHopType `json:"nextHopType,omitempty"` - // NextHopIPAddress - Next hop IP Address. - NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` - // RouteTableID - 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'. - RouteTableID *string `json:"routeTableId,omitempty"` -} - -// O365BreakOutCategoryPolicies office365 breakout categories. -type O365BreakOutCategoryPolicies struct { - // Allow - Flag to control allow category. - Allow *bool `json:"allow,omitempty"` - // Optimize - Flag to control optimize category. - Optimize *bool `json:"optimize,omitempty"` - // Default - Flag to control default category. - Default *bool `json:"default,omitempty"` -} - -// O365PolicyProperties the Office365 breakout policy. -type O365PolicyProperties struct { - // BreakOutCategories - Office365 breakout categories. - BreakOutCategories *O365BreakOutCategoryPolicies `json:"breakOutCategories,omitempty"` -} - -// Office365PolicyProperties network Virtual Appliance Sku Properties. -type Office365PolicyProperties struct { - // BreakOutCategories - Office 365 breakout categories. - BreakOutCategories *BreakOutCategoryPolicies `json:"breakOutCategories,omitempty"` -} - -// Operation network REST API operation definition. -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - Origin of the operation. - Origin *string `json:"origin,omitempty"` - // OperationPropertiesFormat - Operation properties format. - *OperationPropertiesFormat `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if o.Name != nil { - objectMap["name"] = o.Name - } - if o.Display != nil { - objectMap["display"] = o.Display - } - if o.Origin != nil { - objectMap["origin"] = o.Origin - } - if o.OperationPropertiesFormat != nil { - objectMap["properties"] = o.OperationPropertiesFormat - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Operation struct. -func (o *Operation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - o.Name = &name - } - case "display": - if v != nil { - var display OperationDisplay - err = json.Unmarshal(*v, &display) - if err != nil { - return err - } - o.Display = &display - } - case "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - o.Origin = &origin - } - case "properties": - if v != nil { - var operationPropertiesFormat OperationPropertiesFormat - err = json.Unmarshal(*v, &operationPropertiesFormat) - if err != nil { - return err - } - o.OperationPropertiesFormat = &operationPropertiesFormat - } - } - } - - return nil -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft Network. - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - Type of the operation: get, read, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - Description of the operation. - Description *string `json:"description,omitempty"` -} - -// OperationListResult 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. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of Network operations supported by the Network resource provider. - Value *[]Operation `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// OperationPropertiesFormat description of operation properties format. -type OperationPropertiesFormat struct { - // ServiceSpecification - Specification of the service. - ServiceSpecification *OperationPropertiesFormatServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// OperationPropertiesFormatServiceSpecification specification of the service. -type OperationPropertiesFormatServiceSpecification struct { - // MetricSpecifications - Operation service specification. - MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` - // LogSpecifications - Operation log specification. - LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` -} - -// OrderBy describes a column to sort -type OrderBy struct { - // Field - Describes the actual column name to sort by - Field *string `json:"field,omitempty"` - // Order - Describes if results should be in ascending/descending order. Possible values include: 'FirewallPolicyIDPSQuerySortOrderAscending', 'FirewallPolicyIDPSQuerySortOrderDescending' - Order FirewallPolicyIDPSQuerySortOrder `json:"order,omitempty"` -} - -// OutboundRule outbound rule of the load balancer. -type OutboundRule struct { - autorest.Response `json:"-"` - // OutboundRulePropertiesFormat - Properties of load balancer outbound rule. - *OutboundRulePropertiesFormat `json:"properties,omitempty"` - // Name - 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. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for OutboundRule. -func (or OutboundRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if or.OutboundRulePropertiesFormat != nil { - objectMap["properties"] = or.OutboundRulePropertiesFormat - } - if or.Name != nil { - objectMap["name"] = or.Name - } - if or.ID != nil { - objectMap["id"] = or.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OutboundRule struct. -func (or *OutboundRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var outboundRulePropertiesFormat OutboundRulePropertiesFormat - err = json.Unmarshal(*v, &outboundRulePropertiesFormat) - if err != nil { - return err - } - or.OutboundRulePropertiesFormat = &outboundRulePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - or.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - or.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - or.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - or.ID = &ID - } - } - } - - return nil -} - -// OutboundRulePropertiesFormat outbound rule of the load balancer. -type OutboundRulePropertiesFormat struct { - // AllocatedOutboundPorts - The number of outbound ports to be used for NAT. - AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` - // FrontendIPConfigurations - The Frontend IP addresses of the load balancer. - FrontendIPConfigurations *[]SubResource `json:"frontendIPConfigurations,omitempty"` - // BackendAddressPool - A reference to a pool of DIPs. Outbound traffic is randomly load balanced across IPs in the backend IPs. - BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the outbound rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Protocol - The protocol for the outbound rule in load balancer. Possible values include: 'LoadBalancerOutboundRuleProtocolTCP', 'LoadBalancerOutboundRuleProtocolUDP', 'LoadBalancerOutboundRuleProtocolAll' - Protocol LoadBalancerOutboundRuleProtocol `json:"protocol,omitempty"` - // EnableTCPReset - 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. - EnableTCPReset *bool `json:"enableTcpReset,omitempty"` - // IdleTimeoutInMinutes - The timeout for the TCP idle connection. - IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` -} - -// MarshalJSON is the custom marshaler for OutboundRulePropertiesFormat. -func (orpf OutboundRulePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if orpf.AllocatedOutboundPorts != nil { - objectMap["allocatedOutboundPorts"] = orpf.AllocatedOutboundPorts - } - if orpf.FrontendIPConfigurations != nil { - objectMap["frontendIPConfigurations"] = orpf.FrontendIPConfigurations - } - if orpf.BackendAddressPool != nil { - objectMap["backendAddressPool"] = orpf.BackendAddressPool - } - if orpf.Protocol != "" { - objectMap["protocol"] = orpf.Protocol - } - if orpf.EnableTCPReset != nil { - objectMap["enableTcpReset"] = orpf.EnableTCPReset - } - if orpf.IdleTimeoutInMinutes != nil { - objectMap["idleTimeoutInMinutes"] = orpf.IdleTimeoutInMinutes - } - return json.Marshal(objectMap) -} - -// OwaspCrsExclusionEntry allow to exclude some variable satisfy the condition for the WAF check. -type OwaspCrsExclusionEntry struct { - // MatchVariable - The variable to be excluded. Possible values include: 'OwaspCrsExclusionEntryMatchVariableRequestHeaderNames', 'OwaspCrsExclusionEntryMatchVariableRequestCookieNames', 'OwaspCrsExclusionEntryMatchVariableRequestArgNames', 'OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys', 'OwaspCrsExclusionEntryMatchVariableRequestHeaderValues', 'OwaspCrsExclusionEntryMatchVariableRequestCookieKeys', 'OwaspCrsExclusionEntryMatchVariableRequestCookieValues', 'OwaspCrsExclusionEntryMatchVariableRequestArgKeys', 'OwaspCrsExclusionEntryMatchVariableRequestArgValues' - MatchVariable OwaspCrsExclusionEntryMatchVariable `json:"matchVariable,omitempty"` - // SelectorMatchOperator - When matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to. Possible values include: 'OwaspCrsExclusionEntrySelectorMatchOperatorEquals', 'OwaspCrsExclusionEntrySelectorMatchOperatorContains', 'OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith', 'OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith', 'OwaspCrsExclusionEntrySelectorMatchOperatorEqualsAny' - SelectorMatchOperator OwaspCrsExclusionEntrySelectorMatchOperator `json:"selectorMatchOperator,omitempty"` - // Selector - When matchVariable is a collection, operator used to specify which elements in the collection this exclusion applies to. - Selector *string `json:"selector,omitempty"` - // ExclusionManagedRuleSets - The managed rule sets that are associated with the exclusion. - ExclusionManagedRuleSets *[]ExclusionManagedRuleSet `json:"exclusionManagedRuleSets,omitempty"` -} - -// P2SConnectionConfiguration p2SConnectionConfiguration Resource. -type P2SConnectionConfiguration struct { - // P2SConnectionConfigurationProperties - Properties of the P2S connection configuration. - *P2SConnectionConfigurationProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for P2SConnectionConfiguration. -func (pcc P2SConnectionConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pcc.P2SConnectionConfigurationProperties != nil { - objectMap["properties"] = pcc.P2SConnectionConfigurationProperties - } - if pcc.Name != nil { - objectMap["name"] = pcc.Name - } - if pcc.ID != nil { - objectMap["id"] = pcc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for P2SConnectionConfiguration struct. -func (pcc *P2SConnectionConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var p2SConnectionConfigurationProperties P2SConnectionConfigurationProperties - err = json.Unmarshal(*v, &p2SConnectionConfigurationProperties) - if err != nil { - return err - } - pcc.P2SConnectionConfigurationProperties = &p2SConnectionConfigurationProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pcc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - pcc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pcc.ID = &ID - } - } - } - - return nil -} - -// P2SConnectionConfigurationProperties parameters for P2SConnectionConfiguration. -type P2SConnectionConfigurationProperties struct { - // VpnClientAddressPool - The reference to the address space resource which represents Address space for P2S VpnClient. - VpnClientAddressPool *AddressSpace `json:"vpnClientAddressPool,omitempty"` - // RoutingConfiguration - The Routing Configuration indicating the associated and propagated route tables on this connection. - RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` - // EnableInternetSecurity - Flag indicating whether the enable internet security flag is turned on for the P2S Connections or not. - EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` - // ConfigurationPolicyGroupAssociations - READ-ONLY; List of Configuration Policy Groups that this P2SConnectionConfiguration is attached to. - ConfigurationPolicyGroupAssociations *[]SubResource `json:"configurationPolicyGroupAssociations,omitempty"` - // PreviousConfigurationPolicyGroupAssociations - READ-ONLY; List of previous Configuration Policy Groups that this P2SConnectionConfiguration was attached to. - PreviousConfigurationPolicyGroupAssociations *[]VpnServerConfigurationPolicyGroup `json:"previousConfigurationPolicyGroupAssociations,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the P2SConnectionConfiguration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for P2SConnectionConfigurationProperties. -func (pccp P2SConnectionConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pccp.VpnClientAddressPool != nil { - objectMap["vpnClientAddressPool"] = pccp.VpnClientAddressPool - } - if pccp.RoutingConfiguration != nil { - objectMap["routingConfiguration"] = pccp.RoutingConfiguration - } - if pccp.EnableInternetSecurity != nil { - objectMap["enableInternetSecurity"] = pccp.EnableInternetSecurity - } - return json.Marshal(objectMap) -} - -// P2SVpnConnectionHealth p2S Vpn connection detailed health written to sas url. -type P2SVpnConnectionHealth struct { - autorest.Response `json:"-"` - // SasURL - Returned sas url of the blob to which the p2s vpn connection detailed health will be written. - SasURL *string `json:"sasUrl,omitempty"` -} - -// P2SVpnConnectionHealthRequest list of P2S Vpn connection health request. -type P2SVpnConnectionHealthRequest struct { - // VpnUserNamesFilter - The list of p2s vpn user names whose p2s vpn connection detailed health to retrieve for. - VpnUserNamesFilter *[]string `json:"vpnUserNamesFilter,omitempty"` - // OutputBlobSasURL - The sas-url to download the P2S Vpn connection health detail. - OutputBlobSasURL *string `json:"outputBlobSasUrl,omitempty"` -} - -// P2SVpnConnectionRequest list of p2s vpn connections to be disconnected. -type P2SVpnConnectionRequest struct { - // VpnConnectionIds - List of p2s vpn connection Ids. - VpnConnectionIds *[]string `json:"vpnConnectionIds,omitempty"` -} - -// P2SVpnGateway p2SVpnGateway Resource. -type P2SVpnGateway struct { - autorest.Response `json:"-"` - // P2SVpnGatewayProperties - Properties of the P2SVpnGateway. - *P2SVpnGatewayProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for P2SVpnGateway. -func (pvg P2SVpnGateway) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pvg.P2SVpnGatewayProperties != nil { - objectMap["properties"] = pvg.P2SVpnGatewayProperties - } - if pvg.ID != nil { - objectMap["id"] = pvg.ID - } - if pvg.Location != nil { - objectMap["location"] = pvg.Location - } - if pvg.Tags != nil { - objectMap["tags"] = pvg.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for P2SVpnGateway struct. -func (pvg *P2SVpnGateway) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var p2SVpnGatewayProperties P2SVpnGatewayProperties - err = json.Unmarshal(*v, &p2SVpnGatewayProperties) - if err != nil { - return err - } - pvg.P2SVpnGatewayProperties = &p2SVpnGatewayProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - pvg.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pvg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pvg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pvg.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - pvg.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - pvg.Tags = tags - } - } - } - - return nil -} - -// P2SVpnGatewayProperties parameters for P2SVpnGateway. -type P2SVpnGatewayProperties struct { - // VirtualHub - The VirtualHub to which the gateway belongs. - VirtualHub *SubResource `json:"virtualHub,omitempty"` - // P2SConnectionConfigurations - List of all p2s connection configurations of the gateway. - P2SConnectionConfigurations *[]P2SConnectionConfiguration `json:"p2SConnectionConfigurations,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the P2S VPN gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // VpnGatewayScaleUnit - The scale unit for this p2s vpn gateway. - VpnGatewayScaleUnit *int32 `json:"vpnGatewayScaleUnit,omitempty"` - // VpnServerConfiguration - The VpnServerConfiguration to which the p2sVpnGateway is attached to. - VpnServerConfiguration *SubResource `json:"vpnServerConfiguration,omitempty"` - // VpnClientConnectionHealth - READ-ONLY; All P2S VPN clients' connection health status. - VpnClientConnectionHealth *VpnClientConnectionHealth `json:"vpnClientConnectionHealth,omitempty"` - // CustomDNSServers - List of all customer specified DNS servers IP addresses. - CustomDNSServers *[]string `json:"customDnsServers,omitempty"` - // IsRoutingPreferenceInternet - Enable Routing Preference property for the Public IP Interface of the P2SVpnGateway. - IsRoutingPreferenceInternet *bool `json:"isRoutingPreferenceInternet,omitempty"` -} - -// MarshalJSON is the custom marshaler for P2SVpnGatewayProperties. -func (pvgp P2SVpnGatewayProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pvgp.VirtualHub != nil { - objectMap["virtualHub"] = pvgp.VirtualHub - } - if pvgp.P2SConnectionConfigurations != nil { - objectMap["p2SConnectionConfigurations"] = pvgp.P2SConnectionConfigurations - } - if pvgp.VpnGatewayScaleUnit != nil { - objectMap["vpnGatewayScaleUnit"] = pvgp.VpnGatewayScaleUnit - } - if pvgp.VpnServerConfiguration != nil { - objectMap["vpnServerConfiguration"] = pvgp.VpnServerConfiguration - } - if pvgp.CustomDNSServers != nil { - objectMap["customDnsServers"] = pvgp.CustomDNSServers - } - if pvgp.IsRoutingPreferenceInternet != nil { - objectMap["isRoutingPreferenceInternet"] = pvgp.IsRoutingPreferenceInternet - } - return json.Marshal(objectMap) -} - -// P2SVpnGatewaysResetFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type P2SVpnGatewaysResetFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(P2sVpnGatewaysClient) (P2SVpnGateway, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *P2SVpnGatewaysResetFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for P2SVpnGatewaysResetFuture.Result. -func (future *P2SVpnGatewaysResetFuture) result(client P2sVpnGatewaysClient) (pvg P2SVpnGateway, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.P2SVpnGatewaysResetFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pvg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.P2SVpnGatewaysResetFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pvg.Response.Response, err = future.GetResult(sender); err == nil && pvg.Response.Response.StatusCode != http.StatusNoContent { - pvg, err = client.ResetResponder(pvg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.P2SVpnGatewaysResetFuture", "Result", pvg.Response.Response, "Failure responding to request") - } - } - return -} - -// P2SVpnProfileParameters vpn Client Parameters for package generation. -type P2SVpnProfileParameters struct { - // AuthenticationMethod - VPN client authentication method. Possible values include: 'AuthenticationMethodEAPTLS', 'AuthenticationMethodEAPMSCHAPv2' - AuthenticationMethod AuthenticationMethod `json:"authenticationMethod,omitempty"` -} - -// P2sVpnGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type P2sVpnGatewaysCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(P2sVpnGatewaysClient) (P2SVpnGateway, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *P2sVpnGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for P2sVpnGatewaysCreateOrUpdateFuture.Result. -func (future *P2sVpnGatewaysCreateOrUpdateFuture) result(client P2sVpnGatewaysClient) (pvg P2SVpnGateway, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pvg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pvg.Response.Response, err = future.GetResult(sender); err == nil && pvg.Response.Response.StatusCode != http.StatusNoContent { - pvg, err = client.CreateOrUpdateResponder(pvg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysCreateOrUpdateFuture", "Result", pvg.Response.Response, "Failure responding to request") - } - } - return -} - -// P2sVpnGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type P2sVpnGatewaysDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(P2sVpnGatewaysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *P2sVpnGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for P2sVpnGatewaysDeleteFuture.Result. -func (future *P2sVpnGatewaysDeleteFuture) result(client P2sVpnGatewaysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(P2sVpnGatewaysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture.Result. -func (future *P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture) result(client P2sVpnGatewaysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture") - return - } - ar.Response = future.Response() - return -} - -// P2sVpnGatewaysGenerateVpnProfileFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type P2sVpnGatewaysGenerateVpnProfileFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(P2sVpnGatewaysClient) (VpnProfileResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *P2sVpnGatewaysGenerateVpnProfileFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for P2sVpnGatewaysGenerateVpnProfileFuture.Result. -func (future *P2sVpnGatewaysGenerateVpnProfileFuture) result(client P2sVpnGatewaysClient) (vpr VpnProfileResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGenerateVpnProfileFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vpr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysGenerateVpnProfileFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vpr.Response.Response, err = future.GetResult(sender); err == nil && vpr.Response.Response.StatusCode != http.StatusNoContent { - vpr, err = client.GenerateVpnProfileResponder(vpr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGenerateVpnProfileFuture", "Result", vpr.Response.Response, "Failure responding to request") - } - } - return -} - -// P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(P2sVpnGatewaysClient) (P2SVpnConnectionHealth, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture.Result. -func (future *P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture) result(client P2sVpnGatewaysClient) (pvch P2SVpnConnectionHealth, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pvch.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pvch.Response.Response, err = future.GetResult(sender); err == nil && pvch.Response.Response.StatusCode != http.StatusNoContent { - pvch, err = client.GetP2sVpnConnectionHealthDetailedResponder(pvch.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture", "Result", pvch.Response.Response, "Failure responding to request") - } - } - return -} - -// P2sVpnGatewaysGetP2sVpnConnectionHealthFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type P2sVpnGatewaysGetP2sVpnConnectionHealthFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(P2sVpnGatewaysClient) (P2SVpnGateway, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *P2sVpnGatewaysGetP2sVpnConnectionHealthFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for P2sVpnGatewaysGetP2sVpnConnectionHealthFuture.Result. -func (future *P2sVpnGatewaysGetP2sVpnConnectionHealthFuture) result(client P2sVpnGatewaysClient) (pvg P2SVpnGateway, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGetP2sVpnConnectionHealthFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pvg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysGetP2sVpnConnectionHealthFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pvg.Response.Response, err = future.GetResult(sender); err == nil && pvg.Response.Response.StatusCode != http.StatusNoContent { - pvg, err = client.GetP2sVpnConnectionHealthResponder(pvg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGetP2sVpnConnectionHealthFuture", "Result", pvg.Response.Response, "Failure responding to request") - } - } - return -} - -// P2sVpnGatewaysUpdateTagsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type P2sVpnGatewaysUpdateTagsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(P2sVpnGatewaysClient) (P2SVpnGateway, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *P2sVpnGatewaysUpdateTagsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for P2sVpnGatewaysUpdateTagsFuture.Result. -func (future *P2sVpnGatewaysUpdateTagsFuture) result(client P2sVpnGatewaysClient) (pvg P2SVpnGateway, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysUpdateTagsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pvg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysUpdateTagsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pvg.Response.Response, err = future.GetResult(sender); err == nil && pvg.Response.Response.StatusCode != http.StatusNoContent { - pvg, err = client.UpdateTagsResponder(pvg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysUpdateTagsFuture", "Result", pvg.Response.Response, "Failure responding to request") - } - } - return -} - -// PacketCapture parameters that define the create packet capture operation. -type PacketCapture struct { - // PacketCaptureParameters - Properties of the packet capture. - *PacketCaptureParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for PacketCapture. -func (pc PacketCapture) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pc.PacketCaptureParameters != nil { - objectMap["properties"] = pc.PacketCaptureParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PacketCapture struct. -func (pc *PacketCapture) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var packetCaptureParameters PacketCaptureParameters - err = json.Unmarshal(*v, &packetCaptureParameters) - if err != nil { - return err - } - pc.PacketCaptureParameters = &packetCaptureParameters - } - } - } - - return nil -} - -// PacketCaptureFilter filter that is applied to packet capture request. Multiple filters can be applied. -type PacketCaptureFilter struct { - // Protocol - Protocol to be filtered on. Possible values include: 'PcProtocolTCP', 'PcProtocolUDP', 'PcProtocolAny' - Protocol PcProtocol `json:"protocol,omitempty"` - // LocalIPAddress - 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. - LocalIPAddress *string `json:"localIPAddress,omitempty"` - // RemoteIPAddress - 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. - RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` - // LocalPort - 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. - LocalPort *string `json:"localPort,omitempty"` - // RemotePort - 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. - RemotePort *string `json:"remotePort,omitempty"` -} - -// PacketCaptureListResult list of packet capture sessions. -type PacketCaptureListResult struct { - autorest.Response `json:"-"` - // Value - Information about packet capture sessions. - Value *[]PacketCaptureResult `json:"value,omitempty"` -} - -// PacketCaptureMachineScope a list of AzureVMSS instances which can be included or excluded to run packet -// capture. If both included and excluded are empty, then the packet capture will run on all instances of -// AzureVMSS. -type PacketCaptureMachineScope struct { - // Include - List of AzureVMSS instances to run packet capture on. - Include *[]string `json:"include,omitempty"` - // Exclude - List of AzureVMSS instances which has to be excluded from the AzureVMSS from running packet capture. - Exclude *[]string `json:"exclude,omitempty"` -} - -// PacketCaptureParameters parameters that define the create packet capture operation. -type PacketCaptureParameters struct { - // Target - The ID of the targeted resource, only AzureVM and AzureVMSS as target type are currently supported. - Target *string `json:"target,omitempty"` - // Scope - A list of AzureVMSS instances which can be included or excluded to run packet capture. If both included and excluded are empty, then the packet capture will run on all instances of AzureVMSS. - Scope *PacketCaptureMachineScope `json:"scope,omitempty"` - // TargetType - Target type of the resource provided. Possible values include: 'PacketCaptureTargetTypeAzureVM', 'PacketCaptureTargetTypeAzureVMSS' - TargetType PacketCaptureTargetType `json:"targetType,omitempty"` - // BytesToCapturePerPacket - Number of bytes captured per packet, the remaining bytes are truncated. - BytesToCapturePerPacket *int64 `json:"bytesToCapturePerPacket,omitempty"` - // TotalBytesPerSession - Maximum size of the capture output. - TotalBytesPerSession *int64 `json:"totalBytesPerSession,omitempty"` - // TimeLimitInSeconds - Maximum duration of the capture session in seconds. - TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` - // StorageLocation - The storage location for a packet capture session. - StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` - // Filters - A list of packet capture filters. - Filters *[]PacketCaptureFilter `json:"filters,omitempty"` -} - -// PacketCaptureQueryStatusResult status of packet capture session. -type PacketCaptureQueryStatusResult struct { - autorest.Response `json:"-"` - // Name - The name of the packet capture resource. - Name *string `json:"name,omitempty"` - // ID - The ID of the packet capture resource. - ID *string `json:"id,omitempty"` - // CaptureStartTime - The start time of the packet capture session. - CaptureStartTime *date.Time `json:"captureStartTime,omitempty"` - // PacketCaptureStatus - The status of the packet capture session. Possible values include: 'PcStatusNotStarted', 'PcStatusRunning', 'PcStatusStopped', 'PcStatusError', 'PcStatusUnknown' - PacketCaptureStatus PcStatus `json:"packetCaptureStatus,omitempty"` - // StopReason - The reason the current packet capture session was stopped. - StopReason *string `json:"stopReason,omitempty"` - // PacketCaptureError - List of errors of packet capture session. - PacketCaptureError *[]PcError `json:"packetCaptureError,omitempty"` -} - -// PacketCaptureResult information about packet capture session. -type PacketCaptureResult struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; Name of the packet capture session. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; ID of the packet capture operation. - ID *string `json:"id,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // PacketCaptureResultProperties - Properties of the packet capture result. - *PacketCaptureResultProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for PacketCaptureResult. -func (pcr PacketCaptureResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pcr.PacketCaptureResultProperties != nil { - objectMap["properties"] = pcr.PacketCaptureResultProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PacketCaptureResult struct. -func (pcr *PacketCaptureResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pcr.Name = &name - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pcr.ID = &ID - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - pcr.Etag = &etag - } - case "properties": - if v != nil { - var packetCaptureResultProperties PacketCaptureResultProperties - err = json.Unmarshal(*v, &packetCaptureResultProperties) - if err != nil { - return err - } - pcr.PacketCaptureResultProperties = &packetCaptureResultProperties - } - } - } - - return nil -} - -// PacketCaptureResultProperties the properties of a packet capture session. -type PacketCaptureResultProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the packet capture session. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Target - The ID of the targeted resource, only AzureVM and AzureVMSS as target type are currently supported. - Target *string `json:"target,omitempty"` - // Scope - A list of AzureVMSS instances which can be included or excluded to run packet capture. If both included and excluded are empty, then the packet capture will run on all instances of AzureVMSS. - Scope *PacketCaptureMachineScope `json:"scope,omitempty"` - // TargetType - Target type of the resource provided. Possible values include: 'PacketCaptureTargetTypeAzureVM', 'PacketCaptureTargetTypeAzureVMSS' - TargetType PacketCaptureTargetType `json:"targetType,omitempty"` - // BytesToCapturePerPacket - Number of bytes captured per packet, the remaining bytes are truncated. - BytesToCapturePerPacket *int64 `json:"bytesToCapturePerPacket,omitempty"` - // TotalBytesPerSession - Maximum size of the capture output. - TotalBytesPerSession *int64 `json:"totalBytesPerSession,omitempty"` - // TimeLimitInSeconds - Maximum duration of the capture session in seconds. - TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` - // StorageLocation - The storage location for a packet capture session. - StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` - // Filters - A list of packet capture filters. - Filters *[]PacketCaptureFilter `json:"filters,omitempty"` -} - -// MarshalJSON is the custom marshaler for PacketCaptureResultProperties. -func (pcrp PacketCaptureResultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pcrp.Target != nil { - objectMap["target"] = pcrp.Target - } - if pcrp.Scope != nil { - objectMap["scope"] = pcrp.Scope - } - if pcrp.TargetType != "" { - objectMap["targetType"] = pcrp.TargetType - } - if pcrp.BytesToCapturePerPacket != nil { - objectMap["bytesToCapturePerPacket"] = pcrp.BytesToCapturePerPacket - } - if pcrp.TotalBytesPerSession != nil { - objectMap["totalBytesPerSession"] = pcrp.TotalBytesPerSession - } - if pcrp.TimeLimitInSeconds != nil { - objectMap["timeLimitInSeconds"] = pcrp.TimeLimitInSeconds - } - if pcrp.StorageLocation != nil { - objectMap["storageLocation"] = pcrp.StorageLocation - } - if pcrp.Filters != nil { - objectMap["filters"] = pcrp.Filters - } - return json.Marshal(objectMap) -} - -// PacketCaptureStorageLocation the storage location for a packet capture session. -type PacketCaptureStorageLocation struct { - // StorageID - The ID of the storage account to save the packet capture session. Required if no local file path is provided. - StorageID *string `json:"storageId,omitempty"` - // StoragePath - 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. - StoragePath *string `json:"storagePath,omitempty"` - // FilePath - 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. - FilePath *string `json:"filePath,omitempty"` -} - -// PacketCapturesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PacketCapturesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PacketCapturesClient) (PacketCaptureResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PacketCapturesCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PacketCapturesCreateFuture.Result. -func (future *PacketCapturesCreateFuture) result(client PacketCapturesClient) (pcr PacketCaptureResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pcr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PacketCapturesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pcr.Response.Response, err = future.GetResult(sender); err == nil && pcr.Response.Response.StatusCode != http.StatusNoContent { - pcr, err = client.CreateResponder(pcr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesCreateFuture", "Result", pcr.Response.Response, "Failure responding to request") - } - } - return -} - -// PacketCapturesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PacketCapturesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PacketCapturesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PacketCapturesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PacketCapturesDeleteFuture.Result. -func (future *PacketCapturesDeleteFuture) result(client PacketCapturesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PacketCapturesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PacketCapturesGetStatusFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PacketCapturesGetStatusFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PacketCapturesClient) (PacketCaptureQueryStatusResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PacketCapturesGetStatusFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PacketCapturesGetStatusFuture.Result. -func (future *PacketCapturesGetStatusFuture) result(client PacketCapturesClient) (pcqsr PacketCaptureQueryStatusResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesGetStatusFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pcqsr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PacketCapturesGetStatusFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pcqsr.Response.Response, err = future.GetResult(sender); err == nil && pcqsr.Response.Response.StatusCode != http.StatusNoContent { - pcqsr, err = client.GetStatusResponder(pcqsr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesGetStatusFuture", "Result", pcqsr.Response.Response, "Failure responding to request") - } - } - return -} - -// PacketCapturesStopFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PacketCapturesStopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PacketCapturesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PacketCapturesStopFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PacketCapturesStopFuture.Result. -func (future *PacketCapturesStopFuture) result(client PacketCapturesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesStopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PacketCapturesStopFuture") - return - } - ar.Response = future.Response() - return -} - -// Parameter parameters for an Action. -type Parameter struct { - // RoutePrefix - List of route prefixes. - RoutePrefix *[]string `json:"routePrefix,omitempty"` - // Community - List of BGP communities. - Community *[]string `json:"community,omitempty"` - // AsPath - List of AS paths. - AsPath *[]string `json:"asPath,omitempty"` -} - -// PatchObject object for patch operations. -type PatchObject struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PatchObject. -func (po PatchObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if po.Tags != nil { - objectMap["tags"] = po.Tags - } - return json.Marshal(objectMap) -} - -// PatchRouteFilter route Filter Resource. -type PatchRouteFilter struct { - // RouteFilterPropertiesFormat - Properties of the route filter. - *RouteFilterPropertiesFormat `json:"properties,omitempty"` - // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PatchRouteFilter. -func (prf PatchRouteFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if prf.RouteFilterPropertiesFormat != nil { - objectMap["properties"] = prf.RouteFilterPropertiesFormat - } - if prf.Tags != nil { - objectMap["tags"] = prf.Tags - } - if prf.ID != nil { - objectMap["id"] = prf.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PatchRouteFilter struct. -func (prf *PatchRouteFilter) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var routeFilterPropertiesFormat RouteFilterPropertiesFormat - err = json.Unmarshal(*v, &routeFilterPropertiesFormat) - if err != nil { - return err - } - prf.RouteFilterPropertiesFormat = &routeFilterPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - prf.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - prf.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - prf.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - prf.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - prf.ID = &ID - } - } - } - - return nil -} - -// PatchRouteFilterRule route Filter Rule Resource. -type PatchRouteFilterRule struct { - // RouteFilterRulePropertiesFormat - Properties of the route filter rule. - *RouteFilterRulePropertiesFormat `json:"properties,omitempty"` - // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PatchRouteFilterRule. -func (prfr PatchRouteFilterRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if prfr.RouteFilterRulePropertiesFormat != nil { - objectMap["properties"] = prfr.RouteFilterRulePropertiesFormat - } - if prfr.ID != nil { - objectMap["id"] = prfr.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PatchRouteFilterRule struct. -func (prfr *PatchRouteFilterRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var routeFilterRulePropertiesFormat RouteFilterRulePropertiesFormat - err = json.Unmarshal(*v, &routeFilterRulePropertiesFormat) - if err != nil { - return err - } - prfr.RouteFilterRulePropertiesFormat = &routeFilterRulePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - prfr.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - prfr.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - prfr.ID = &ID - } - } - } - - return nil -} - -// PeerExpressRouteCircuitConnection peer Express Route Circuit Connection in an ExpressRouteCircuitPeering -// resource. -type PeerExpressRouteCircuitConnection struct { - autorest.Response `json:"-"` - // PeerExpressRouteCircuitConnectionPropertiesFormat - Properties of the peer express route circuit connection. - *PeerExpressRouteCircuitConnectionPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PeerExpressRouteCircuitConnection. -func (percc PeerExpressRouteCircuitConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if percc.PeerExpressRouteCircuitConnectionPropertiesFormat != nil { - objectMap["properties"] = percc.PeerExpressRouteCircuitConnectionPropertiesFormat - } - if percc.Name != nil { - objectMap["name"] = percc.Name - } - if percc.ID != nil { - objectMap["id"] = percc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PeerExpressRouteCircuitConnection struct. -func (percc *PeerExpressRouteCircuitConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var peerExpressRouteCircuitConnectionPropertiesFormat PeerExpressRouteCircuitConnectionPropertiesFormat - err = json.Unmarshal(*v, &peerExpressRouteCircuitConnectionPropertiesFormat) - if err != nil { - return err - } - percc.PeerExpressRouteCircuitConnectionPropertiesFormat = &peerExpressRouteCircuitConnectionPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - percc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - percc.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - percc.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - percc.ID = &ID - } - } - } - - return nil -} - -// PeerExpressRouteCircuitConnectionListResult response for ListPeeredConnections API service call -// retrieves all global reach peer circuit connections that belongs to a Private Peering for an -// ExpressRouteCircuit. -type PeerExpressRouteCircuitConnectionListResult struct { - autorest.Response `json:"-"` - // Value - The global reach peer circuit connection associated with Private Peering in an ExpressRoute Circuit. - Value *[]PeerExpressRouteCircuitConnection `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// PeerExpressRouteCircuitConnectionListResultIterator provides access to a complete listing of -// PeerExpressRouteCircuitConnection values. -type PeerExpressRouteCircuitConnectionListResultIterator struct { - i int - page PeerExpressRouteCircuitConnectionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PeerExpressRouteCircuitConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PeerExpressRouteCircuitConnectionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PeerExpressRouteCircuitConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PeerExpressRouteCircuitConnectionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PeerExpressRouteCircuitConnectionListResultIterator) Response() PeerExpressRouteCircuitConnectionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PeerExpressRouteCircuitConnectionListResultIterator) Value() PeerExpressRouteCircuitConnection { - if !iter.page.NotDone() { - return PeerExpressRouteCircuitConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PeerExpressRouteCircuitConnectionListResultIterator type. -func NewPeerExpressRouteCircuitConnectionListResultIterator(page PeerExpressRouteCircuitConnectionListResultPage) PeerExpressRouteCircuitConnectionListResultIterator { - return PeerExpressRouteCircuitConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (percclr PeerExpressRouteCircuitConnectionListResult) IsEmpty() bool { - return percclr.Value == nil || len(*percclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (percclr PeerExpressRouteCircuitConnectionListResult) hasNextLink() bool { - return percclr.NextLink != nil && len(*percclr.NextLink) != 0 -} - -// peerExpressRouteCircuitConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (percclr PeerExpressRouteCircuitConnectionListResult) peerExpressRouteCircuitConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !percclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(percclr.NextLink))) -} - -// PeerExpressRouteCircuitConnectionListResultPage contains a page of PeerExpressRouteCircuitConnection -// values. -type PeerExpressRouteCircuitConnectionListResultPage struct { - fn func(context.Context, PeerExpressRouteCircuitConnectionListResult) (PeerExpressRouteCircuitConnectionListResult, error) - percclr PeerExpressRouteCircuitConnectionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PeerExpressRouteCircuitConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PeerExpressRouteCircuitConnectionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.percclr) - if err != nil { - return err - } - page.percclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PeerExpressRouteCircuitConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PeerExpressRouteCircuitConnectionListResultPage) NotDone() bool { - return !page.percclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PeerExpressRouteCircuitConnectionListResultPage) Response() PeerExpressRouteCircuitConnectionListResult { - return page.percclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PeerExpressRouteCircuitConnectionListResultPage) Values() []PeerExpressRouteCircuitConnection { - if page.percclr.IsEmpty() { - return nil - } - return *page.percclr.Value -} - -// Creates a new instance of the PeerExpressRouteCircuitConnectionListResultPage type. -func NewPeerExpressRouteCircuitConnectionListResultPage(cur PeerExpressRouteCircuitConnectionListResult, getNextPage func(context.Context, PeerExpressRouteCircuitConnectionListResult) (PeerExpressRouteCircuitConnectionListResult, error)) PeerExpressRouteCircuitConnectionListResultPage { - return PeerExpressRouteCircuitConnectionListResultPage{ - fn: getNextPage, - percclr: cur, - } -} - -// PeerExpressRouteCircuitConnectionPropertiesFormat properties of the peer express route circuit -// connection. -type PeerExpressRouteCircuitConnectionPropertiesFormat struct { - // ExpressRouteCircuitPeering - Reference to Express Route Circuit Private Peering Resource of the circuit. - ExpressRouteCircuitPeering *SubResource `json:"expressRouteCircuitPeering,omitempty"` - // PeerExpressRouteCircuitPeering - Reference to Express Route Circuit Private Peering Resource of the peered circuit. - PeerExpressRouteCircuitPeering *SubResource `json:"peerExpressRouteCircuitPeering,omitempty"` - // AddressPrefix - /29 IP address space to carve out Customer addresses for tunnels. - AddressPrefix *string `json:"addressPrefix,omitempty"` - // CircuitConnectionStatus - Express Route Circuit connection state. Possible values include: 'CircuitConnectionStatusConnected', 'CircuitConnectionStatusConnecting', 'CircuitConnectionStatusDisconnected' - CircuitConnectionStatus CircuitConnectionStatus `json:"circuitConnectionStatus,omitempty"` - // ConnectionName - The name of the express route circuit connection resource. - ConnectionName *string `json:"connectionName,omitempty"` - // AuthResourceGUID - The resource guid of the authorization used for the express route circuit connection. - AuthResourceGUID *string `json:"authResourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the peer express route circuit connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for PeerExpressRouteCircuitConnectionPropertiesFormat. -func (perccpf PeerExpressRouteCircuitConnectionPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if perccpf.ExpressRouteCircuitPeering != nil { - objectMap["expressRouteCircuitPeering"] = perccpf.ExpressRouteCircuitPeering - } - if perccpf.PeerExpressRouteCircuitPeering != nil { - objectMap["peerExpressRouteCircuitPeering"] = perccpf.PeerExpressRouteCircuitPeering - } - if perccpf.AddressPrefix != nil { - objectMap["addressPrefix"] = perccpf.AddressPrefix - } - if perccpf.CircuitConnectionStatus != "" { - objectMap["circuitConnectionStatus"] = perccpf.CircuitConnectionStatus - } - if perccpf.ConnectionName != nil { - objectMap["connectionName"] = perccpf.ConnectionName - } - if perccpf.AuthResourceGUID != nil { - objectMap["authResourceGuid"] = perccpf.AuthResourceGUID - } - return json.Marshal(objectMap) -} - -// PeerRoute peer routing details. -type PeerRoute struct { - // LocalAddress - READ-ONLY; The peer's local address. - LocalAddress *string `json:"localAddress,omitempty"` - // NetworkProperty - READ-ONLY; The route's network prefix. - NetworkProperty *string `json:"network,omitempty"` - // NextHop - READ-ONLY; The route's next hop. - NextHop *string `json:"nextHop,omitempty"` - // SourcePeer - READ-ONLY; The peer this route was learned from. - SourcePeer *string `json:"sourcePeer,omitempty"` - // Origin - READ-ONLY; The source this route was learned from. - Origin *string `json:"origin,omitempty"` - // AsPath - READ-ONLY; The route's AS path sequence. - AsPath *string `json:"asPath,omitempty"` - // Weight - READ-ONLY; The route's weight. - Weight *int32 `json:"weight,omitempty"` -} - -// MarshalJSON is the custom marshaler for PeerRoute. -func (pr PeerRoute) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PeerRouteList list of virtual router peer routes. -type PeerRouteList struct { - autorest.Response `json:"-"` - // Value - List of peer routes. - Value *[]PeerRoute `json:"value,omitempty"` -} - -// PolicySettings defines contents of a web application firewall global configuration. -type PolicySettings struct { - // State - The state of the policy. Possible values include: 'WebApplicationFirewallEnabledStateDisabled', 'WebApplicationFirewallEnabledStateEnabled' - State WebApplicationFirewallEnabledState `json:"state,omitempty"` - // Mode - The mode of the policy. Possible values include: 'WebApplicationFirewallModePrevention', 'WebApplicationFirewallModeDetection' - Mode WebApplicationFirewallMode `json:"mode,omitempty"` - // RequestBodyCheck - Whether to allow WAF to check request Body. - RequestBodyCheck *bool `json:"requestBodyCheck,omitempty"` - // MaxRequestBodySizeInKb - Maximum request body size in Kb for WAF. - MaxRequestBodySizeInKb *int32 `json:"maxRequestBodySizeInKb,omitempty"` - // FileUploadLimitInMb - Maximum file upload size in Mb for WAF. - FileUploadLimitInMb *int32 `json:"fileUploadLimitInMb,omitempty"` -} - -// PrepareNetworkPoliciesRequest details of PrepareNetworkPolicies for Subnet. -type PrepareNetworkPoliciesRequest struct { - // ServiceName - The name of the service for which subnet is being prepared for. - ServiceName *string `json:"serviceName,omitempty"` - // NetworkIntentPolicyConfigurations - A list of NetworkIntentPolicyConfiguration. - NetworkIntentPolicyConfigurations *[]IntentPolicyConfiguration `json:"networkIntentPolicyConfigurations,omitempty"` -} - -// PrivateDNSZoneConfig privateDnsZoneConfig resource. -type PrivateDNSZoneConfig struct { - // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // PrivateDNSZonePropertiesFormat - Properties of the private dns zone configuration. - *PrivateDNSZonePropertiesFormat `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateDNSZoneConfig. -func (pdzc PrivateDNSZoneConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pdzc.Name != nil { - objectMap["name"] = pdzc.Name - } - if pdzc.PrivateDNSZonePropertiesFormat != nil { - objectMap["properties"] = pdzc.PrivateDNSZonePropertiesFormat - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateDNSZoneConfig struct. -func (pdzc *PrivateDNSZoneConfig) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pdzc.Name = &name - } - case "properties": - if v != nil { - var privateDNSZonePropertiesFormat PrivateDNSZonePropertiesFormat - err = json.Unmarshal(*v, &privateDNSZonePropertiesFormat) - if err != nil { - return err - } - pdzc.PrivateDNSZonePropertiesFormat = &privateDNSZonePropertiesFormat - } - } - } - - return nil -} - -// PrivateDNSZoneGroup private dns zone group resource. -type PrivateDNSZoneGroup struct { - autorest.Response `json:"-"` - // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // PrivateDNSZoneGroupPropertiesFormat - Properties of the private dns zone group. - *PrivateDNSZoneGroupPropertiesFormat `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateDNSZoneGroup. -func (pdzg PrivateDNSZoneGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pdzg.Name != nil { - objectMap["name"] = pdzg.Name - } - if pdzg.PrivateDNSZoneGroupPropertiesFormat != nil { - objectMap["properties"] = pdzg.PrivateDNSZoneGroupPropertiesFormat - } - if pdzg.ID != nil { - objectMap["id"] = pdzg.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateDNSZoneGroup struct. -func (pdzg *PrivateDNSZoneGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pdzg.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - pdzg.Etag = &etag - } - case "properties": - if v != nil { - var privateDNSZoneGroupPropertiesFormat PrivateDNSZoneGroupPropertiesFormat - err = json.Unmarshal(*v, &privateDNSZoneGroupPropertiesFormat) - if err != nil { - return err - } - pdzg.PrivateDNSZoneGroupPropertiesFormat = &privateDNSZoneGroupPropertiesFormat - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pdzg.ID = &ID - } - } - } - - return nil -} - -// PrivateDNSZoneGroupListResult response for the ListPrivateDnsZoneGroups API service call. -type PrivateDNSZoneGroupListResult struct { - autorest.Response `json:"-"` - // Value - A list of private dns zone group resources in a private endpoint. - Value *[]PrivateDNSZoneGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateDNSZoneGroupListResult. -func (pdzglr PrivateDNSZoneGroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pdzglr.Value != nil { - objectMap["value"] = pdzglr.Value - } - return json.Marshal(objectMap) -} - -// PrivateDNSZoneGroupListResultIterator provides access to a complete listing of PrivateDNSZoneGroup -// values. -type PrivateDNSZoneGroupListResultIterator struct { - i int - page PrivateDNSZoneGroupListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateDNSZoneGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateDNSZoneGroupListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateDNSZoneGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateDNSZoneGroupListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateDNSZoneGroupListResultIterator) Response() PrivateDNSZoneGroupListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateDNSZoneGroupListResultIterator) Value() PrivateDNSZoneGroup { - if !iter.page.NotDone() { - return PrivateDNSZoneGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateDNSZoneGroupListResultIterator type. -func NewPrivateDNSZoneGroupListResultIterator(page PrivateDNSZoneGroupListResultPage) PrivateDNSZoneGroupListResultIterator { - return PrivateDNSZoneGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pdzglr PrivateDNSZoneGroupListResult) IsEmpty() bool { - return pdzglr.Value == nil || len(*pdzglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pdzglr PrivateDNSZoneGroupListResult) hasNextLink() bool { - return pdzglr.NextLink != nil && len(*pdzglr.NextLink) != 0 -} - -// privateDNSZoneGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pdzglr PrivateDNSZoneGroupListResult) privateDNSZoneGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !pdzglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pdzglr.NextLink))) -} - -// PrivateDNSZoneGroupListResultPage contains a page of PrivateDNSZoneGroup values. -type PrivateDNSZoneGroupListResultPage struct { - fn func(context.Context, PrivateDNSZoneGroupListResult) (PrivateDNSZoneGroupListResult, error) - pdzglr PrivateDNSZoneGroupListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateDNSZoneGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateDNSZoneGroupListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.pdzglr) - if err != nil { - return err - } - page.pdzglr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateDNSZoneGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateDNSZoneGroupListResultPage) NotDone() bool { - return !page.pdzglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateDNSZoneGroupListResultPage) Response() PrivateDNSZoneGroupListResult { - return page.pdzglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateDNSZoneGroupListResultPage) Values() []PrivateDNSZoneGroup { - if page.pdzglr.IsEmpty() { - return nil - } - return *page.pdzglr.Value -} - -// Creates a new instance of the PrivateDNSZoneGroupListResultPage type. -func NewPrivateDNSZoneGroupListResultPage(cur PrivateDNSZoneGroupListResult, getNextPage func(context.Context, PrivateDNSZoneGroupListResult) (PrivateDNSZoneGroupListResult, error)) PrivateDNSZoneGroupListResultPage { - return PrivateDNSZoneGroupListResultPage{ - fn: getNextPage, - pdzglr: cur, - } -} - -// PrivateDNSZoneGroupPropertiesFormat properties of the private dns zone group. -type PrivateDNSZoneGroupPropertiesFormat struct { - // ProvisioningState - READ-ONLY; The provisioning state of the private dns zone group resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // PrivateDNSZoneConfigs - A collection of private dns zone configurations of the private dns zone group. - PrivateDNSZoneConfigs *[]PrivateDNSZoneConfig `json:"privateDnsZoneConfigs,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateDNSZoneGroupPropertiesFormat. -func (pdzgpf PrivateDNSZoneGroupPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pdzgpf.PrivateDNSZoneConfigs != nil { - objectMap["privateDnsZoneConfigs"] = pdzgpf.PrivateDNSZoneConfigs - } - return json.Marshal(objectMap) -} - -// PrivateDNSZoneGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateDNSZoneGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateDNSZoneGroupsClient) (PrivateDNSZoneGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateDNSZoneGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateDNSZoneGroupsCreateOrUpdateFuture.Result. -func (future *PrivateDNSZoneGroupsCreateOrUpdateFuture) result(client PrivateDNSZoneGroupsClient) (pdzg PrivateDNSZoneGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pdzg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PrivateDNSZoneGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pdzg.Response.Response, err = future.GetResult(sender); err == nil && pdzg.Response.Response.StatusCode != http.StatusNoContent { - pdzg, err = client.CreateOrUpdateResponder(pdzg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsCreateOrUpdateFuture", "Result", pdzg.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateDNSZoneGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateDNSZoneGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateDNSZoneGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateDNSZoneGroupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateDNSZoneGroupsDeleteFuture.Result. -func (future *PrivateDNSZoneGroupsDeleteFuture) result(client PrivateDNSZoneGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PrivateDNSZoneGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateDNSZonePropertiesFormat properties of the private dns zone configuration resource. -type PrivateDNSZonePropertiesFormat struct { - // PrivateDNSZoneID - The resource id of the private dns zone. - PrivateDNSZoneID *string `json:"privateDnsZoneId,omitempty"` - // RecordSets - READ-ONLY; A collection of information regarding a recordSet, holding information to identify private resources. - RecordSets *[]RecordSet `json:"recordSets,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateDNSZonePropertiesFormat. -func (pdzpf PrivateDNSZonePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pdzpf.PrivateDNSZoneID != nil { - objectMap["privateDnsZoneId"] = pdzpf.PrivateDNSZoneID - } - return json.Marshal(objectMap) -} - -// PrivateEndpoint private endpoint resource. -type PrivateEndpoint struct { - autorest.Response `json:"-"` - // ExtendedLocation - The extended location of the load balancer. - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - // PrivateEndpointProperties - Properties of the private endpoint. - *PrivateEndpointProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpoint. -func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if peVar.ExtendedLocation != nil { - objectMap["extendedLocation"] = peVar.ExtendedLocation - } - if peVar.PrivateEndpointProperties != nil { - objectMap["properties"] = peVar.PrivateEndpointProperties - } - if peVar.ID != nil { - objectMap["id"] = peVar.ID - } - if peVar.Location != nil { - objectMap["location"] = peVar.Location - } - if peVar.Tags != nil { - objectMap["tags"] = peVar.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpoint struct. -func (peVar *PrivateEndpoint) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "extendedLocation": - if v != nil { - var extendedLocation ExtendedLocation - err = json.Unmarshal(*v, &extendedLocation) - if err != nil { - return err - } - peVar.ExtendedLocation = &extendedLocation - } - case "properties": - if v != nil { - var privateEndpointProperties PrivateEndpointProperties - err = json.Unmarshal(*v, &privateEndpointProperties) - if err != nil { - return err - } - peVar.PrivateEndpointProperties = &privateEndpointProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - peVar.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - peVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - peVar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - peVar.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - peVar.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - peVar.Tags = tags - } - } - } - - return nil -} - -// PrivateEndpointConnection privateEndpointConnection resource. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Properties of the private end point connection. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - if pec.Name != nil { - objectMap["name"] = pec.Name - } - if pec.ID != nil { - objectMap["id"] = pec.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - pec.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult response for the ListPrivateEndpointConnection API service call. -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - A list of PrivateEndpointConnection resources for a specific private link service. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. -func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if peclr.Value != nil { - objectMap["value"] = peclr.Value - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionListResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultIterator struct { - i int - page PrivateEndpointConnectionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. -func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { - return PrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { - return peclr.Value == nil || len(*peclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { - return peclr.NextLink != nil && len(*peclr.NextLink) != 0 -} - -// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !peclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclr.NextLink))) -} - -// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultPage struct { - fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) - peclr PrivateEndpointConnectionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.peclr) - if err != nil { - return err - } - page.peclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.peclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { - return page.peclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { - if page.peclr.IsEmpty() { - return nil - } - return *page.peclr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultPage type. -func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { - return PrivateEndpointConnectionListResultPage{ - fn: getNextPage, - peclr: cur, - } -} - -// PrivateEndpointConnectionProperties properties of the PrivateEndpointConnectProperties. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - READ-ONLY; The resource of private end point. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the private endpoint connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // LinkIdentifier - READ-ONLY; The consumer link id. - LinkIdentifier *string `json:"linkIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. -func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateEndpointIPConfiguration an IP Configuration of the private endpoint. -type PrivateEndpointIPConfiguration struct { - // PrivateEndpointIPConfigurationProperties - Properties of private endpoint IP configurations. - *PrivateEndpointIPConfigurationProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointIPConfiguration. -func (peic PrivateEndpointIPConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if peic.PrivateEndpointIPConfigurationProperties != nil { - objectMap["properties"] = peic.PrivateEndpointIPConfigurationProperties - } - if peic.Name != nil { - objectMap["name"] = peic.Name - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointIPConfiguration struct. -func (peic *PrivateEndpointIPConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointIPConfigurationProperties PrivateEndpointIPConfigurationProperties - err = json.Unmarshal(*v, &privateEndpointIPConfigurationProperties) - if err != nil { - return err - } - peic.PrivateEndpointIPConfigurationProperties = &privateEndpointIPConfigurationProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - peic.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - peic.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - peic.Etag = &etag - } - } - } - - return nil -} - -// PrivateEndpointIPConfigurationProperties properties of an IP Configuration of the private endpoint. -type PrivateEndpointIPConfigurationProperties struct { - // GroupID - The ID of a group obtained from the remote resource that this private endpoint should connect to. - GroupID *string `json:"groupId,omitempty"` - // MemberName - The member name of a group obtained from the remote resource that this private endpoint should connect to. - MemberName *string `json:"memberName,omitempty"` - // PrivateIPAddress - A private ip address obtained from the private endpoint's subnet. - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` -} - -// PrivateEndpointListResult response for the ListPrivateEndpoints API service call. -type PrivateEndpointListResult struct { - autorest.Response `json:"-"` - // Value - A list of private endpoint resources in a resource group. - Value *[]PrivateEndpoint `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointListResult. -func (pelr PrivateEndpointListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pelr.Value != nil { - objectMap["value"] = pelr.Value - } - return json.Marshal(objectMap) -} - -// PrivateEndpointListResultIterator provides access to a complete listing of PrivateEndpoint values. -type PrivateEndpointListResultIterator struct { - i int - page PrivateEndpointListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateEndpointListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateEndpointListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateEndpointListResultIterator) Response() PrivateEndpointListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateEndpointListResultIterator) Value() PrivateEndpoint { - if !iter.page.NotDone() { - return PrivateEndpoint{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointListResultIterator type. -func NewPrivateEndpointListResultIterator(page PrivateEndpointListResultPage) PrivateEndpointListResultIterator { - return PrivateEndpointListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pelr PrivateEndpointListResult) IsEmpty() bool { - return pelr.Value == nil || len(*pelr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pelr PrivateEndpointListResult) hasNextLink() bool { - return pelr.NextLink != nil && len(*pelr.NextLink) != 0 -} - -// privateEndpointListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pelr PrivateEndpointListResult) privateEndpointListResultPreparer(ctx context.Context) (*http.Request, error) { - if !pelr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pelr.NextLink))) -} - -// PrivateEndpointListResultPage contains a page of PrivateEndpoint values. -type PrivateEndpointListResultPage struct { - fn func(context.Context, PrivateEndpointListResult) (PrivateEndpointListResult, error) - pelr PrivateEndpointListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateEndpointListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.pelr) - if err != nil { - return err - } - page.pelr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateEndpointListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointListResultPage) NotDone() bool { - return !page.pelr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointListResultPage) Response() PrivateEndpointListResult { - return page.pelr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointListResultPage) Values() []PrivateEndpoint { - if page.pelr.IsEmpty() { - return nil - } - return *page.pelr.Value -} - -// Creates a new instance of the PrivateEndpointListResultPage type. -func NewPrivateEndpointListResultPage(cur PrivateEndpointListResult, getNextPage func(context.Context, PrivateEndpointListResult) (PrivateEndpointListResult, error)) PrivateEndpointListResultPage { - return PrivateEndpointListResultPage{ - fn: getNextPage, - pelr: cur, - } -} - -// PrivateEndpointProperties properties of the private endpoint. -type PrivateEndpointProperties struct { - // Subnet - The ID of the subnet from which the private IP will be allocated. - Subnet *Subnet `json:"subnet,omitempty"` - // NetworkInterfaces - READ-ONLY; An array of references to the network interfaces created for this private endpoint. - NetworkInterfaces *[]Interface `json:"networkInterfaces,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the private endpoint resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // PrivateLinkServiceConnections - A grouping of information about the connection to the remote resource. - PrivateLinkServiceConnections *[]PrivateLinkServiceConnection `json:"privateLinkServiceConnections,omitempty"` - // ManualPrivateLinkServiceConnections - 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. - ManualPrivateLinkServiceConnections *[]PrivateLinkServiceConnection `json:"manualPrivateLinkServiceConnections,omitempty"` - // CustomDNSConfigs - An array of custom dns configurations. - CustomDNSConfigs *[]CustomDNSConfigPropertiesFormat `json:"customDnsConfigs,omitempty"` - // ApplicationSecurityGroups - Application security groups in which the private endpoint IP configuration is included. - ApplicationSecurityGroups *[]ApplicationSecurityGroup `json:"applicationSecurityGroups,omitempty"` - // IPConfigurations - A list of IP configurations of the private endpoint. This will be used to map to the First Party Service's endpoints. - IPConfigurations *[]PrivateEndpointIPConfiguration `json:"ipConfigurations,omitempty"` - // CustomNetworkInterfaceName - The custom name of the network interface attached to the private endpoint. - CustomNetworkInterfaceName *string `json:"customNetworkInterfaceName,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointProperties. -func (pep PrivateEndpointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pep.Subnet != nil { - objectMap["subnet"] = pep.Subnet - } - if pep.PrivateLinkServiceConnections != nil { - objectMap["privateLinkServiceConnections"] = pep.PrivateLinkServiceConnections - } - if pep.ManualPrivateLinkServiceConnections != nil { - objectMap["manualPrivateLinkServiceConnections"] = pep.ManualPrivateLinkServiceConnections - } - if pep.CustomDNSConfigs != nil { - objectMap["customDnsConfigs"] = pep.CustomDNSConfigs - } - if pep.ApplicationSecurityGroups != nil { - objectMap["applicationSecurityGroups"] = pep.ApplicationSecurityGroups - } - if pep.IPConfigurations != nil { - objectMap["ipConfigurations"] = pep.IPConfigurations - } - if pep.CustomNetworkInterfaceName != nil { - objectMap["customNetworkInterfaceName"] = pep.CustomNetworkInterfaceName - } - return json.Marshal(objectMap) -} - -// PrivateEndpointsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointsClient) (PrivateEndpoint, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointsCreateOrUpdateFuture) result(client PrivateEndpointsClient) (peVar PrivateEndpoint, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PrivateEndpointsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - peVar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PrivateEndpointsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if peVar.Response.Response, err = future.GetResult(sender); err == nil && peVar.Response.Response.StatusCode != http.StatusNoContent { - peVar, err = client.CreateOrUpdateResponder(peVar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PrivateEndpointsCreateOrUpdateFuture", "Result", peVar.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PrivateEndpointsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointsDeleteFuture.Result. -func (future *PrivateEndpointsDeleteFuture) result(client PrivateEndpointsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PrivateEndpointsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PrivateEndpointsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkService private link service resource. -type PrivateLinkService struct { - autorest.Response `json:"-"` - // ExtendedLocation - The extended location of the load balancer. - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - // PrivateLinkServiceProperties - Properties of the private link service. - *PrivateLinkServiceProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkService. -func (pls PrivateLinkService) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pls.ExtendedLocation != nil { - objectMap["extendedLocation"] = pls.ExtendedLocation - } - if pls.PrivateLinkServiceProperties != nil { - objectMap["properties"] = pls.PrivateLinkServiceProperties - } - if pls.ID != nil { - objectMap["id"] = pls.ID - } - if pls.Location != nil { - objectMap["location"] = pls.Location - } - if pls.Tags != nil { - objectMap["tags"] = pls.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkService struct. -func (pls *PrivateLinkService) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "extendedLocation": - if v != nil { - var extendedLocation ExtendedLocation - err = json.Unmarshal(*v, &extendedLocation) - if err != nil { - return err - } - pls.ExtendedLocation = &extendedLocation - } - case "properties": - if v != nil { - var privateLinkServiceProperties PrivateLinkServiceProperties - err = json.Unmarshal(*v, &privateLinkServiceProperties) - if err != nil { - return err - } - pls.PrivateLinkServiceProperties = &privateLinkServiceProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - pls.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pls.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pls.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pls.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - pls.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - pls.Tags = tags - } - } - } - - return nil -} - -// PrivateLinkServiceConnection privateLinkServiceConnection resource. -type PrivateLinkServiceConnection struct { - // PrivateLinkServiceConnectionProperties - Properties of the private link service connection. - *PrivateLinkServiceConnectionProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnection. -func (plsc PrivateLinkServiceConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plsc.PrivateLinkServiceConnectionProperties != nil { - objectMap["properties"] = plsc.PrivateLinkServiceConnectionProperties - } - if plsc.Name != nil { - objectMap["name"] = plsc.Name - } - if plsc.ID != nil { - objectMap["id"] = plsc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkServiceConnection struct. -func (plsc *PrivateLinkServiceConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkServiceConnectionProperties PrivateLinkServiceConnectionProperties - err = json.Unmarshal(*v, &privateLinkServiceConnectionProperties) - if err != nil { - return err - } - plsc.PrivateLinkServiceConnectionProperties = &privateLinkServiceConnectionProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plsc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plsc.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - plsc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plsc.ID = &ID - } - } - } - - return nil -} - -// PrivateLinkServiceConnectionProperties properties of the PrivateLinkServiceConnection. -type PrivateLinkServiceConnectionProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the private link service connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // PrivateLinkServiceID - The resource id of private link service. - PrivateLinkServiceID *string `json:"privateLinkServiceId,omitempty"` - // GroupIds - The ID(s) of the group(s) obtained from the remote resource that this private endpoint should connect to. - GroupIds *[]string `json:"groupIds,omitempty"` - // RequestMessage - A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars. - RequestMessage *string `json:"requestMessage,omitempty"` - // PrivateLinkServiceConnectionState - A collection of read-only information about the state of the connection to the remote resource. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionProperties. -func (plscp PrivateLinkServiceConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscp.PrivateLinkServiceID != nil { - objectMap["privateLinkServiceId"] = plscp.PrivateLinkServiceID - } - if plscp.GroupIds != nil { - objectMap["groupIds"] = plscp.GroupIds - } - if plscp.RequestMessage != nil { - objectMap["requestMessage"] = plscp.RequestMessage - } - if plscp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = plscp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionState a collection of information about the state of the connection between -// service consumer and provider. -type PrivateLinkServiceConnectionState struct { - // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. - Status *string `json:"status,omitempty"` - // Description - The reason for approval/rejection of the connection. - Description *string `json:"description,omitempty"` - // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// PrivateLinkServiceIPConfiguration the private link service ip configuration. -type PrivateLinkServiceIPConfiguration struct { - // PrivateLinkServiceIPConfigurationProperties - Properties of the private link service ip configuration. - *PrivateLinkServiceIPConfigurationProperties `json:"properties,omitempty"` - // Name - The name of private link service ip configuration. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceIPConfiguration. -func (plsic PrivateLinkServiceIPConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plsic.PrivateLinkServiceIPConfigurationProperties != nil { - objectMap["properties"] = plsic.PrivateLinkServiceIPConfigurationProperties - } - if plsic.Name != nil { - objectMap["name"] = plsic.Name - } - if plsic.ID != nil { - objectMap["id"] = plsic.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkServiceIPConfiguration struct. -func (plsic *PrivateLinkServiceIPConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkServiceIPConfigurationProperties PrivateLinkServiceIPConfigurationProperties - err = json.Unmarshal(*v, &privateLinkServiceIPConfigurationProperties) - if err != nil { - return err - } - plsic.PrivateLinkServiceIPConfigurationProperties = &privateLinkServiceIPConfigurationProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plsic.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - plsic.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plsic.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plsic.ID = &ID - } - } - } - - return nil -} - -// PrivateLinkServiceIPConfigurationProperties properties of private link service IP configuration. -type PrivateLinkServiceIPConfigurationProperties struct { - // PrivateIPAddress - The private IP address of the IP configuration. - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' - PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` - // Subnet - The reference to the subnet resource. - Subnet *Subnet `json:"subnet,omitempty"` - // Primary - Whether the ip configuration is primary or not. - Primary *bool `json:"primary,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the private link service IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // PrivateIPAddressVersion - Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' - PrivateIPAddressVersion IPVersion `json:"privateIPAddressVersion,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceIPConfigurationProperties. -func (plsicp PrivateLinkServiceIPConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plsicp.PrivateIPAddress != nil { - objectMap["privateIPAddress"] = plsicp.PrivateIPAddress - } - if plsicp.PrivateIPAllocationMethod != "" { - objectMap["privateIPAllocationMethod"] = plsicp.PrivateIPAllocationMethod - } - if plsicp.Subnet != nil { - objectMap["subnet"] = plsicp.Subnet - } - if plsicp.Primary != nil { - objectMap["primary"] = plsicp.Primary - } - if plsicp.PrivateIPAddressVersion != "" { - objectMap["privateIPAddressVersion"] = plsicp.PrivateIPAddressVersion - } - return json.Marshal(objectMap) -} - -// PrivateLinkServiceListResult response for the ListPrivateLinkService API service call. -type PrivateLinkServiceListResult struct { - autorest.Response `json:"-"` - // Value - A list of PrivateLinkService resources in a resource group. - Value *[]PrivateLinkService `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceListResult. -func (plslr PrivateLinkServiceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plslr.Value != nil { - objectMap["value"] = plslr.Value - } - return json.Marshal(objectMap) -} - -// PrivateLinkServiceListResultIterator provides access to a complete listing of PrivateLinkService values. -type PrivateLinkServiceListResultIterator struct { - i int - page PrivateLinkServiceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateLinkServiceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServiceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateLinkServiceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkServiceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateLinkServiceListResultIterator) Response() PrivateLinkServiceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateLinkServiceListResultIterator) Value() PrivateLinkService { - if !iter.page.NotDone() { - return PrivateLinkService{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkServiceListResultIterator type. -func NewPrivateLinkServiceListResultIterator(page PrivateLinkServiceListResultPage) PrivateLinkServiceListResultIterator { - return PrivateLinkServiceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plslr PrivateLinkServiceListResult) IsEmpty() bool { - return plslr.Value == nil || len(*plslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plslr PrivateLinkServiceListResult) hasNextLink() bool { - return plslr.NextLink != nil && len(*plslr.NextLink) != 0 -} - -// privateLinkServiceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plslr PrivateLinkServiceListResult) privateLinkServiceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plslr.NextLink))) -} - -// PrivateLinkServiceListResultPage contains a page of PrivateLinkService values. -type PrivateLinkServiceListResultPage struct { - fn func(context.Context, PrivateLinkServiceListResult) (PrivateLinkServiceListResult, error) - plslr PrivateLinkServiceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateLinkServiceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServiceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.plslr) - if err != nil { - return err - } - page.plslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateLinkServiceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkServiceListResultPage) NotDone() bool { - return !page.plslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkServiceListResultPage) Response() PrivateLinkServiceListResult { - return page.plslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkServiceListResultPage) Values() []PrivateLinkService { - if page.plslr.IsEmpty() { - return nil - } - return *page.plslr.Value -} - -// Creates a new instance of the PrivateLinkServiceListResultPage type. -func NewPrivateLinkServiceListResultPage(cur PrivateLinkServiceListResult, getNextPage func(context.Context, PrivateLinkServiceListResult) (PrivateLinkServiceListResult, error)) PrivateLinkServiceListResultPage { - return PrivateLinkServiceListResultPage{ - fn: getNextPage, - plslr: cur, - } -} - -// PrivateLinkServiceProperties properties of the private link service. -type PrivateLinkServiceProperties struct { - // LoadBalancerFrontendIPConfigurations - An array of references to the load balancer IP configurations. - LoadBalancerFrontendIPConfigurations *[]FrontendIPConfiguration `json:"loadBalancerFrontendIpConfigurations,omitempty"` - // IPConfigurations - An array of private link service IP configurations. - IPConfigurations *[]PrivateLinkServiceIPConfiguration `json:"ipConfigurations,omitempty"` - // NetworkInterfaces - READ-ONLY; An array of references to the network interfaces created for this private link service. - NetworkInterfaces *[]Interface `json:"networkInterfaces,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the private link service resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // PrivateEndpointConnections - READ-ONLY; An array of list about connections to the private endpoint. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // Visibility - The visibility list of the private link service. - Visibility *PrivateLinkServicePropertiesVisibility `json:"visibility,omitempty"` - // AutoApproval - The auto-approval list of the private link service. - AutoApproval *PrivateLinkServicePropertiesAutoApproval `json:"autoApproval,omitempty"` - // Fqdns - The list of Fqdn. - Fqdns *[]string `json:"fqdns,omitempty"` - // Alias - READ-ONLY; The alias of the private link service. - Alias *string `json:"alias,omitempty"` - // EnableProxyProtocol - Whether the private link service is enabled for proxy protocol or not. - EnableProxyProtocol *bool `json:"enableProxyProtocol,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceProperties. -func (plsp PrivateLinkServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plsp.LoadBalancerFrontendIPConfigurations != nil { - objectMap["loadBalancerFrontendIpConfigurations"] = plsp.LoadBalancerFrontendIPConfigurations - } - if plsp.IPConfigurations != nil { - objectMap["ipConfigurations"] = plsp.IPConfigurations - } - if plsp.Visibility != nil { - objectMap["visibility"] = plsp.Visibility - } - if plsp.AutoApproval != nil { - objectMap["autoApproval"] = plsp.AutoApproval - } - if plsp.Fqdns != nil { - objectMap["fqdns"] = plsp.Fqdns - } - if plsp.EnableProxyProtocol != nil { - objectMap["enableProxyProtocol"] = plsp.EnableProxyProtocol - } - return json.Marshal(objectMap) -} - -// PrivateLinkServicePropertiesAutoApproval the auto-approval list of the private link service. -type PrivateLinkServicePropertiesAutoApproval struct { - // Subscriptions - The list of subscriptions. - Subscriptions *[]string `json:"subscriptions,omitempty"` -} - -// PrivateLinkServicePropertiesVisibility the visibility list of the private link service. -type PrivateLinkServicePropertiesVisibility struct { - // Subscriptions - The list of subscriptions. - Subscriptions *[]string `json:"subscriptions,omitempty"` -} - -// PrivateLinkServiceVisibility response for the CheckPrivateLinkServiceVisibility API service call. -type PrivateLinkServiceVisibility struct { - autorest.Response `json:"-"` - // Visible - Private Link Service Visibility (True/False). - Visible *bool `json:"visible,omitempty"` -} - -// PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture an abstraction for monitoring -// and retrieving the results of a long-running operation. -type PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkServicesClient) (PrivateLinkServiceVisibility, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture.Result. -func (future *PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture) result(client PrivateLinkServicesClient) (plsv PrivateLinkServiceVisibility, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - plsv.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if plsv.Response.Response, err = future.GetResult(sender); err == nil && plsv.Response.Response.StatusCode != http.StatusNoContent { - plsv, err = client.CheckPrivateLinkServiceVisibilityByResourceGroupResponder(plsv.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture", "Result", plsv.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkServicesClient) (PrivateLinkServiceVisibility, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture.Result. -func (future *PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture) result(client PrivateLinkServicesClient) (plsv PrivateLinkServiceVisibility, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - plsv.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if plsv.Response.Response, err = future.GetResult(sender); err == nil && plsv.Response.Response.StatusCode != http.StatusNoContent { - plsv, err = client.CheckPrivateLinkServiceVisibilityResponder(plsv.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture", "Result", plsv.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateLinkServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateLinkServicesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkServicesClient) (PrivateLinkService, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateLinkServicesCreateOrUpdateFuture.Result. -func (future *PrivateLinkServicesCreateOrUpdateFuture) result(client PrivateLinkServicesClient) (pls PrivateLinkService, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pls.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PrivateLinkServicesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pls.Response.Response, err = future.GetResult(sender); err == nil && pls.Response.Response.StatusCode != http.StatusNoContent { - pls, err = client.CreateOrUpdateResponder(pls.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCreateOrUpdateFuture", "Result", pls.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateLinkServicesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateLinkServicesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkServicesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkServicesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateLinkServicesDeleteFuture.Result. -func (future *PrivateLinkServicesDeleteFuture) result(client PrivateLinkServicesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PrivateLinkServicesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkServicesDeletePrivateEndpointConnectionFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type PrivateLinkServicesDeletePrivateEndpointConnectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateLinkServicesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateLinkServicesDeletePrivateEndpointConnectionFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateLinkServicesDeletePrivateEndpointConnectionFuture.Result. -func (future *PrivateLinkServicesDeletePrivateEndpointConnectionFuture) result(client PrivateLinkServicesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesDeletePrivateEndpointConnectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PrivateLinkServicesDeletePrivateEndpointConnectionFuture") - return - } - ar.Response = future.Response() - return -} - -// Probe a load balancer probe. -type Probe struct { - autorest.Response `json:"-"` - // ProbePropertiesFormat - Properties of load balancer probe. - *ProbePropertiesFormat `json:"properties,omitempty"` - // Name - 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. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for Probe. -func (p Probe) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if p.ProbePropertiesFormat != nil { - objectMap["properties"] = p.ProbePropertiesFormat - } - if p.Name != nil { - objectMap["name"] = p.Name - } - if p.ID != nil { - objectMap["id"] = p.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Probe struct. -func (p *Probe) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var probePropertiesFormat ProbePropertiesFormat - err = json.Unmarshal(*v, &probePropertiesFormat) - if err != nil { - return err - } - p.ProbePropertiesFormat = &probePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - p.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - p.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - p.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - p.ID = &ID - } - } - } - - return nil -} - -// ProbePropertiesFormat load balancer probe resource. -type ProbePropertiesFormat struct { - // LoadBalancingRules - READ-ONLY; The load balancer rules that use this probe. - LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` - // Protocol - 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. Possible values include: 'ProbeProtocolHTTP', 'ProbeProtocolTCP', 'ProbeProtocolHTTPS' - Protocol ProbeProtocol `json:"protocol,omitempty"` - // Port - The port for communicating the probe. Possible values range from 1 to 65535, inclusive. - Port *int32 `json:"port,omitempty"` - // IntervalInSeconds - 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. - IntervalInSeconds *int32 `json:"intervalInSeconds,omitempty"` - // NumberOfProbes - 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. - NumberOfProbes *int32 `json:"numberOfProbes,omitempty"` - // ProbeThreshold - The number of consecutive successful or failed probes in order to allow or deny traffic from being delivered to this endpoint. After failing the number of consecutive probes equal to this value, the endpoint will be taken out of rotation and require the same number of successful consecutive probes to be placed back in rotation. - ProbeThreshold *int32 `json:"probeThreshold,omitempty"` - // RequestPath - 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. - RequestPath *string `json:"requestPath,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the probe resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProbePropertiesFormat. -func (ppf ProbePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ppf.Protocol != "" { - objectMap["protocol"] = ppf.Protocol - } - if ppf.Port != nil { - objectMap["port"] = ppf.Port - } - if ppf.IntervalInSeconds != nil { - objectMap["intervalInSeconds"] = ppf.IntervalInSeconds - } - if ppf.NumberOfProbes != nil { - objectMap["numberOfProbes"] = ppf.NumberOfProbes - } - if ppf.ProbeThreshold != nil { - objectMap["probeThreshold"] = ppf.ProbeThreshold - } - if ppf.RequestPath != nil { - objectMap["requestPath"] = ppf.RequestPath - } - return json.Marshal(objectMap) -} - -// Profile network profile resource. -type Profile struct { - autorest.Response `json:"-"` - // ProfilePropertiesFormat - Network profile properties. - *ProfilePropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Profile. -func (p Profile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if p.ProfilePropertiesFormat != nil { - objectMap["properties"] = p.ProfilePropertiesFormat - } - if p.ID != nil { - objectMap["id"] = p.ID - } - if p.Location != nil { - objectMap["location"] = p.Location - } - if p.Tags != nil { - objectMap["tags"] = p.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Profile struct. -func (p *Profile) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var profilePropertiesFormat ProfilePropertiesFormat - err = json.Unmarshal(*v, &profilePropertiesFormat) - if err != nil { - return err - } - p.ProfilePropertiesFormat = &profilePropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - p.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - p.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - p.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - p.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - p.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - p.Tags = tags - } - } - } - - return nil -} - -// ProfileListResult response for ListNetworkProfiles API service call. -type ProfileListResult struct { - autorest.Response `json:"-"` - // Value - A list of network profiles that exist in a resource group. - Value *[]Profile `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ProfileListResultIterator provides access to a complete listing of Profile values. -type ProfileListResultIterator struct { - i int - page ProfileListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ProfileListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ProfileListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ProfileListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ProfileListResultIterator) Response() ProfileListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ProfileListResultIterator) Value() Profile { - if !iter.page.NotDone() { - return Profile{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ProfileListResultIterator type. -func NewProfileListResultIterator(page ProfileListResultPage) ProfileListResultIterator { - return ProfileListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plr ProfileListResult) IsEmpty() bool { - return plr.Value == nil || len(*plr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plr ProfileListResult) hasNextLink() bool { - return plr.NextLink != nil && len(*plr.NextLink) != 0 -} - -// profileListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plr ProfileListResult) profileListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plr.NextLink))) -} - -// ProfileListResultPage contains a page of Profile values. -type ProfileListResultPage struct { - fn func(context.Context, ProfileListResult) (ProfileListResult, error) - plr ProfileListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ProfileListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.plr) - if err != nil { - return err - } - page.plr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ProfileListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ProfileListResultPage) NotDone() bool { - return !page.plr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ProfileListResultPage) Response() ProfileListResult { - return page.plr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ProfileListResultPage) Values() []Profile { - if page.plr.IsEmpty() { - return nil - } - return *page.plr.Value -} - -// Creates a new instance of the ProfileListResultPage type. -func NewProfileListResultPage(cur ProfileListResult, getNextPage func(context.Context, ProfileListResult) (ProfileListResult, error)) ProfileListResultPage { - return ProfileListResultPage{ - fn: getNextPage, - plr: cur, - } -} - -// ProfilePropertiesFormat network profile properties. -type ProfilePropertiesFormat struct { - // ContainerNetworkInterfaces - READ-ONLY; List of child container network interfaces. - ContainerNetworkInterfaces *[]ContainerNetworkInterface `json:"containerNetworkInterfaces,omitempty"` - // ContainerNetworkInterfaceConfigurations - List of chid container network interface configurations. - ContainerNetworkInterfaceConfigurations *[]ContainerNetworkInterfaceConfiguration `json:"containerNetworkInterfaceConfigurations,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the network profile resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the network profile resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProfilePropertiesFormat. -func (ppf ProfilePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ppf.ContainerNetworkInterfaceConfigurations != nil { - objectMap["containerNetworkInterfaceConfigurations"] = ppf.ContainerNetworkInterfaceConfigurations - } - return json.Marshal(objectMap) -} - -// ProfilesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ProfilesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ProfilesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ProfilesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ProfilesDeleteFuture.Result. -func (future *ProfilesDeleteFuture) result(client ProfilesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ProfilesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ProfilesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PropagatedRouteTable the list of RouteTables to advertise the routes to. -type PropagatedRouteTable struct { - // Labels - The list of labels. - Labels *[]string `json:"labels,omitempty"` - // Ids - The list of resource ids of all the RouteTables. - Ids *[]SubResource `json:"ids,omitempty"` -} - -// ProtocolConfiguration configuration of the protocol. -type ProtocolConfiguration struct { - // HTTPConfiguration - HTTP configuration of the connectivity check. - HTTPConfiguration *HTTPConfiguration `json:"HTTPConfiguration,omitempty"` -} - -// PublicIPAddress public IP address resource. -type PublicIPAddress struct { - autorest.Response `json:"-"` - // ExtendedLocation - The extended location of the public ip address. - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - // Sku - The public IP address SKU. - Sku *PublicIPAddressSku `json:"sku,omitempty"` - // PublicIPAddressPropertiesFormat - Public IP address properties. - *PublicIPAddressPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Zones - A list of availability zones denoting the IP allocated for the resource needs to come from. - Zones *[]string `json:"zones,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PublicIPAddress. -func (pia PublicIPAddress) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pia.ExtendedLocation != nil { - objectMap["extendedLocation"] = pia.ExtendedLocation - } - if pia.Sku != nil { - objectMap["sku"] = pia.Sku - } - if pia.PublicIPAddressPropertiesFormat != nil { - objectMap["properties"] = pia.PublicIPAddressPropertiesFormat - } - if pia.Zones != nil { - objectMap["zones"] = pia.Zones - } - if pia.ID != nil { - objectMap["id"] = pia.ID - } - if pia.Location != nil { - objectMap["location"] = pia.Location - } - if pia.Tags != nil { - objectMap["tags"] = pia.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PublicIPAddress struct. -func (pia *PublicIPAddress) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "extendedLocation": - if v != nil { - var extendedLocation ExtendedLocation - err = json.Unmarshal(*v, &extendedLocation) - if err != nil { - return err - } - pia.ExtendedLocation = &extendedLocation - } - case "sku": - if v != nil { - var sku PublicIPAddressSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - pia.Sku = &sku - } - case "properties": - if v != nil { - var publicIPAddressPropertiesFormat PublicIPAddressPropertiesFormat - err = json.Unmarshal(*v, &publicIPAddressPropertiesFormat) - if err != nil { - return err - } - pia.PublicIPAddressPropertiesFormat = &publicIPAddressPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - pia.Etag = &etag - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - pia.Zones = &zones - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pia.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pia.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pia.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - pia.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - pia.Tags = tags - } - } - } - - return nil -} - -// PublicIPAddressDNSSettings contains FQDN of the DNS record associated with the public IP address. -type PublicIPAddressDNSSettings struct { - // DomainNameLabel - 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. - DomainNameLabel *string `json:"domainNameLabel,omitempty"` - // Fqdn - 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. - Fqdn *string `json:"fqdn,omitempty"` - // ReverseFqdn - 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. - ReverseFqdn *string `json:"reverseFqdn,omitempty"` -} - -// PublicIPAddressListResult response for ListPublicIpAddresses API service call. -type PublicIPAddressListResult struct { - autorest.Response `json:"-"` - // Value - A list of public IP addresses that exists in a resource group. - Value *[]PublicIPAddress `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// PublicIPAddressListResultIterator provides access to a complete listing of PublicIPAddress values. -type PublicIPAddressListResultIterator struct { - i int - page PublicIPAddressListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PublicIPAddressListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PublicIPAddressListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PublicIPAddressListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PublicIPAddressListResultIterator) Response() PublicIPAddressListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PublicIPAddressListResultIterator) Value() PublicIPAddress { - if !iter.page.NotDone() { - return PublicIPAddress{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PublicIPAddressListResultIterator type. -func NewPublicIPAddressListResultIterator(page PublicIPAddressListResultPage) PublicIPAddressListResultIterator { - return PublicIPAddressListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pialr PublicIPAddressListResult) IsEmpty() bool { - return pialr.Value == nil || len(*pialr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pialr PublicIPAddressListResult) hasNextLink() bool { - return pialr.NextLink != nil && len(*pialr.NextLink) != 0 -} - -// publicIPAddressListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pialr PublicIPAddressListResult) publicIPAddressListResultPreparer(ctx context.Context) (*http.Request, error) { - if !pialr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pialr.NextLink))) -} - -// PublicIPAddressListResultPage contains a page of PublicIPAddress values. -type PublicIPAddressListResultPage struct { - fn func(context.Context, PublicIPAddressListResult) (PublicIPAddressListResult, error) - pialr PublicIPAddressListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PublicIPAddressListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.pialr) - if err != nil { - return err - } - page.pialr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PublicIPAddressListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PublicIPAddressListResultPage) NotDone() bool { - return !page.pialr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PublicIPAddressListResultPage) Response() PublicIPAddressListResult { - return page.pialr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PublicIPAddressListResultPage) Values() []PublicIPAddress { - if page.pialr.IsEmpty() { - return nil - } - return *page.pialr.Value -} - -// Creates a new instance of the PublicIPAddressListResultPage type. -func NewPublicIPAddressListResultPage(cur PublicIPAddressListResult, getNextPage func(context.Context, PublicIPAddressListResult) (PublicIPAddressListResult, error)) PublicIPAddressListResultPage { - return PublicIPAddressListResultPage{ - fn: getNextPage, - pialr: cur, - } -} - -// PublicIPAddressPropertiesFormat public IP address properties. -type PublicIPAddressPropertiesFormat struct { - // PublicIPAllocationMethod - The public IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' - PublicIPAllocationMethod IPAllocationMethod `json:"publicIPAllocationMethod,omitempty"` - // PublicIPAddressVersion - The public IP address version. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' - PublicIPAddressVersion IPVersion `json:"publicIPAddressVersion,omitempty"` - // IPConfiguration - READ-ONLY; The IP configuration associated with the public IP address. - IPConfiguration *IPConfiguration `json:"ipConfiguration,omitempty"` - // DNSSettings - The FQDN of the DNS record associated with the public IP address. - DNSSettings *PublicIPAddressDNSSettings `json:"dnsSettings,omitempty"` - // DdosSettings - The DDoS protection custom policy associated with the public IP address. - DdosSettings *DdosSettings `json:"ddosSettings,omitempty"` - // IPTags - The list of tags associated with the public IP address. - IPTags *[]IPTag `json:"ipTags,omitempty"` - // IPAddress - The IP address associated with the public IP address resource. - IPAddress *string `json:"ipAddress,omitempty"` - // PublicIPPrefix - The Public IP Prefix this Public IP Address should be allocated from. - PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` - // IdleTimeoutInMinutes - The idle timeout of the public IP address. - IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the public IP address resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the public IP address resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ServicePublicIPAddress - The service public IP address of the public IP address resource. - ServicePublicIPAddress *PublicIPAddress `json:"servicePublicIPAddress,omitempty"` - // NatGateway - The NatGateway for the Public IP address. - NatGateway *NatGateway `json:"natGateway,omitempty"` - // MigrationPhase - Migration phase of Public IP Address. Possible values include: 'PublicIPAddressMigrationPhaseNone', 'PublicIPAddressMigrationPhasePrepare', 'PublicIPAddressMigrationPhaseCommit', 'PublicIPAddressMigrationPhaseAbort', 'PublicIPAddressMigrationPhaseCommitted' - MigrationPhase PublicIPAddressMigrationPhase `json:"migrationPhase,omitempty"` - // LinkedPublicIPAddress - The linked public IP address of the public IP address resource. - LinkedPublicIPAddress *PublicIPAddress `json:"linkedPublicIPAddress,omitempty"` - // DeleteOption - Specify what happens to the public IP address when the VM using it is deleted. Possible values include: 'DeleteOptionsDelete', 'DeleteOptionsDetach' - DeleteOption DeleteOptions `json:"deleteOption,omitempty"` -} - -// MarshalJSON is the custom marshaler for PublicIPAddressPropertiesFormat. -func (piapf PublicIPAddressPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if piapf.PublicIPAllocationMethod != "" { - objectMap["publicIPAllocationMethod"] = piapf.PublicIPAllocationMethod - } - if piapf.PublicIPAddressVersion != "" { - objectMap["publicIPAddressVersion"] = piapf.PublicIPAddressVersion - } - if piapf.DNSSettings != nil { - objectMap["dnsSettings"] = piapf.DNSSettings - } - if piapf.DdosSettings != nil { - objectMap["ddosSettings"] = piapf.DdosSettings - } - if piapf.IPTags != nil { - objectMap["ipTags"] = piapf.IPTags - } - if piapf.IPAddress != nil { - objectMap["ipAddress"] = piapf.IPAddress - } - if piapf.PublicIPPrefix != nil { - objectMap["publicIPPrefix"] = piapf.PublicIPPrefix - } - if piapf.IdleTimeoutInMinutes != nil { - objectMap["idleTimeoutInMinutes"] = piapf.IdleTimeoutInMinutes - } - if piapf.ServicePublicIPAddress != nil { - objectMap["servicePublicIPAddress"] = piapf.ServicePublicIPAddress - } - if piapf.NatGateway != nil { - objectMap["natGateway"] = piapf.NatGateway - } - if piapf.MigrationPhase != "" { - objectMap["migrationPhase"] = piapf.MigrationPhase - } - if piapf.LinkedPublicIPAddress != nil { - objectMap["linkedPublicIPAddress"] = piapf.LinkedPublicIPAddress - } - if piapf.DeleteOption != "" { - objectMap["deleteOption"] = piapf.DeleteOption - } - return json.Marshal(objectMap) -} - -// PublicIPAddressSku SKU of a public IP address. -type PublicIPAddressSku struct { - // Name - Name of a public IP address SKU. Possible values include: 'PublicIPAddressSkuNameBasic', 'PublicIPAddressSkuNameStandard' - Name PublicIPAddressSkuName `json:"name,omitempty"` - // Tier - Tier of a public IP address SKU. Possible values include: 'PublicIPAddressSkuTierRegional', 'PublicIPAddressSkuTierGlobal' - Tier PublicIPAddressSkuTier `json:"tier,omitempty"` -} - -// PublicIPAddressesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PublicIPAddressesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PublicIPAddressesClient) (PublicIPAddress, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PublicIPAddressesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PublicIPAddressesCreateOrUpdateFuture.Result. -func (future *PublicIPAddressesCreateOrUpdateFuture) result(client PublicIPAddressesClient) (pia PublicIPAddress, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pia.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pia.Response.Response, err = future.GetResult(sender); err == nil && pia.Response.Response.StatusCode != http.StatusNoContent { - pia, err = client.CreateOrUpdateResponder(pia.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", pia.Response.Response, "Failure responding to request") - } - } - return -} - -// PublicIPAddressesDdosProtectionStatusFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type PublicIPAddressesDdosProtectionStatusFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PublicIPAddressesClient) (PublicIPDdosProtectionStatusResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PublicIPAddressesDdosProtectionStatusFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PublicIPAddressesDdosProtectionStatusFuture.Result. -func (future *PublicIPAddressesDdosProtectionStatusFuture) result(client PublicIPAddressesClient) (pidpsr PublicIPDdosProtectionStatusResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesDdosProtectionStatusFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pidpsr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesDdosProtectionStatusFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pidpsr.Response.Response, err = future.GetResult(sender); err == nil && pidpsr.Response.Response.StatusCode != http.StatusNoContent { - pidpsr, err = client.DdosProtectionStatusResponder(pidpsr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesDdosProtectionStatusFuture", "Result", pidpsr.Response.Response, "Failure responding to request") - } - } - return -} - -// PublicIPAddressesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PublicIPAddressesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PublicIPAddressesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PublicIPAddressesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PublicIPAddressesDeleteFuture.Result. -func (future *PublicIPAddressesDeleteFuture) result(client PublicIPAddressesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PublicIPDdosProtectionStatusResult response for GetPublicIpAddressDdosProtectionStatusOperation API -// service call. -type PublicIPDdosProtectionStatusResult struct { - autorest.Response `json:"-"` - // PublicIPAddressID - Public IP ARM resource ID - PublicIPAddressID *string `json:"publicIpAddressId,omitempty"` - // PublicIPAddress - IP Address of the Public IP Resource - PublicIPAddress *string `json:"publicIpAddress,omitempty"` - // IsWorkloadProtected - Value indicating whether the IP address is DDoS workload protected or not. Possible values include: 'IsWorkloadProtectedFalse', 'IsWorkloadProtectedTrue' - IsWorkloadProtected IsWorkloadProtected `json:"isWorkloadProtected,omitempty"` - // DdosProtectionPlanID - DDoS protection plan Resource Id of a if IP address is protected through a plan. - DdosProtectionPlanID *string `json:"ddosProtectionPlanId,omitempty"` -} - -// PublicIPPrefix public IP prefix resource. -type PublicIPPrefix struct { - autorest.Response `json:"-"` - // ExtendedLocation - The extended location of the public ip address. - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - // Sku - The public IP prefix SKU. - Sku *PublicIPPrefixSku `json:"sku,omitempty"` - // PublicIPPrefixPropertiesFormat - Public IP prefix properties. - *PublicIPPrefixPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Zones - A list of availability zones denoting the IP allocated for the resource needs to come from. - Zones *[]string `json:"zones,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PublicIPPrefix. -func (pip PublicIPPrefix) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pip.ExtendedLocation != nil { - objectMap["extendedLocation"] = pip.ExtendedLocation - } - if pip.Sku != nil { - objectMap["sku"] = pip.Sku - } - if pip.PublicIPPrefixPropertiesFormat != nil { - objectMap["properties"] = pip.PublicIPPrefixPropertiesFormat - } - if pip.Zones != nil { - objectMap["zones"] = pip.Zones - } - if pip.ID != nil { - objectMap["id"] = pip.ID - } - if pip.Location != nil { - objectMap["location"] = pip.Location - } - if pip.Tags != nil { - objectMap["tags"] = pip.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PublicIPPrefix struct. -func (pip *PublicIPPrefix) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "extendedLocation": - if v != nil { - var extendedLocation ExtendedLocation - err = json.Unmarshal(*v, &extendedLocation) - if err != nil { - return err - } - pip.ExtendedLocation = &extendedLocation - } - case "sku": - if v != nil { - var sku PublicIPPrefixSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - pip.Sku = &sku - } - case "properties": - if v != nil { - var publicIPPrefixPropertiesFormat PublicIPPrefixPropertiesFormat - err = json.Unmarshal(*v, &publicIPPrefixPropertiesFormat) - if err != nil { - return err - } - pip.PublicIPPrefixPropertiesFormat = &publicIPPrefixPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - pip.Etag = &etag - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - pip.Zones = &zones - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pip.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pip.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pip.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - pip.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - pip.Tags = tags - } - } - } - - return nil -} - -// PublicIPPrefixListResult response for ListPublicIpPrefixes API service call. -type PublicIPPrefixListResult struct { - autorest.Response `json:"-"` - // Value - A list of public IP prefixes that exists in a resource group. - Value *[]PublicIPPrefix `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// PublicIPPrefixListResultIterator provides access to a complete listing of PublicIPPrefix values. -type PublicIPPrefixListResultIterator struct { - i int - page PublicIPPrefixListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PublicIPPrefixListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPPrefixListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PublicIPPrefixListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PublicIPPrefixListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PublicIPPrefixListResultIterator) Response() PublicIPPrefixListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PublicIPPrefixListResultIterator) Value() PublicIPPrefix { - if !iter.page.NotDone() { - return PublicIPPrefix{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PublicIPPrefixListResultIterator type. -func NewPublicIPPrefixListResultIterator(page PublicIPPrefixListResultPage) PublicIPPrefixListResultIterator { - return PublicIPPrefixListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (piplr PublicIPPrefixListResult) IsEmpty() bool { - return piplr.Value == nil || len(*piplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (piplr PublicIPPrefixListResult) hasNextLink() bool { - return piplr.NextLink != nil && len(*piplr.NextLink) != 0 -} - -// publicIPPrefixListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (piplr PublicIPPrefixListResult) publicIPPrefixListResultPreparer(ctx context.Context) (*http.Request, error) { - if !piplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(piplr.NextLink))) -} - -// PublicIPPrefixListResultPage contains a page of PublicIPPrefix values. -type PublicIPPrefixListResultPage struct { - fn func(context.Context, PublicIPPrefixListResult) (PublicIPPrefixListResult, error) - piplr PublicIPPrefixListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PublicIPPrefixListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPPrefixListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.piplr) - if err != nil { - return err - } - page.piplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PublicIPPrefixListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PublicIPPrefixListResultPage) NotDone() bool { - return !page.piplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PublicIPPrefixListResultPage) Response() PublicIPPrefixListResult { - return page.piplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PublicIPPrefixListResultPage) Values() []PublicIPPrefix { - if page.piplr.IsEmpty() { - return nil - } - return *page.piplr.Value -} - -// Creates a new instance of the PublicIPPrefixListResultPage type. -func NewPublicIPPrefixListResultPage(cur PublicIPPrefixListResult, getNextPage func(context.Context, PublicIPPrefixListResult) (PublicIPPrefixListResult, error)) PublicIPPrefixListResultPage { - return PublicIPPrefixListResultPage{ - fn: getNextPage, - piplr: cur, - } -} - -// PublicIPPrefixPropertiesFormat public IP prefix properties. -type PublicIPPrefixPropertiesFormat struct { - // PublicIPAddressVersion - The public IP address version. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' - PublicIPAddressVersion IPVersion `json:"publicIPAddressVersion,omitempty"` - // IPTags - The list of tags associated with the public IP prefix. - IPTags *[]IPTag `json:"ipTags,omitempty"` - // PrefixLength - The Length of the Public IP Prefix. - PrefixLength *int32 `json:"prefixLength,omitempty"` - // IPPrefix - READ-ONLY; The allocated Prefix. - IPPrefix *string `json:"ipPrefix,omitempty"` - // PublicIPAddresses - READ-ONLY; The list of all referenced PublicIPAddresses. - PublicIPAddresses *[]ReferencedPublicIPAddress `json:"publicIPAddresses,omitempty"` - // LoadBalancerFrontendIPConfiguration - READ-ONLY; The reference to load balancer frontend IP configuration associated with the public IP prefix. - LoadBalancerFrontendIPConfiguration *SubResource `json:"loadBalancerFrontendIpConfiguration,omitempty"` - // CustomIPPrefix - The customIpPrefix that this prefix is associated with. - CustomIPPrefix *SubResource `json:"customIPPrefix,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the public IP prefix resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the public IP prefix resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // NatGateway - NatGateway of Public IP Prefix. - NatGateway *NatGateway `json:"natGateway,omitempty"` -} - -// MarshalJSON is the custom marshaler for PublicIPPrefixPropertiesFormat. -func (pippf PublicIPPrefixPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pippf.PublicIPAddressVersion != "" { - objectMap["publicIPAddressVersion"] = pippf.PublicIPAddressVersion - } - if pippf.IPTags != nil { - objectMap["ipTags"] = pippf.IPTags - } - if pippf.PrefixLength != nil { - objectMap["prefixLength"] = pippf.PrefixLength - } - if pippf.CustomIPPrefix != nil { - objectMap["customIPPrefix"] = pippf.CustomIPPrefix - } - if pippf.NatGateway != nil { - objectMap["natGateway"] = pippf.NatGateway - } - return json.Marshal(objectMap) -} - -// PublicIPPrefixSku SKU of a public IP prefix. -type PublicIPPrefixSku struct { - // Name - Name of a public IP prefix SKU. Possible values include: 'PublicIPPrefixSkuNameStandard' - Name PublicIPPrefixSkuName `json:"name,omitempty"` - // Tier - Tier of a public IP prefix SKU. Possible values include: 'PublicIPPrefixSkuTierRegional', 'PublicIPPrefixSkuTierGlobal' - Tier PublicIPPrefixSkuTier `json:"tier,omitempty"` -} - -// PublicIPPrefixesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PublicIPPrefixesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PublicIPPrefixesClient) (PublicIPPrefix, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PublicIPPrefixesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PublicIPPrefixesCreateOrUpdateFuture.Result. -func (future *PublicIPPrefixesCreateOrUpdateFuture) result(client PublicIPPrefixesClient) (pip PublicIPPrefix, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pip.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PublicIPPrefixesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pip.Response.Response, err = future.GetResult(sender); err == nil && pip.Response.Response.StatusCode != http.StatusNoContent { - pip, err = client.CreateOrUpdateResponder(pip.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesCreateOrUpdateFuture", "Result", pip.Response.Response, "Failure responding to request") - } - } - return -} - -// PublicIPPrefixesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PublicIPPrefixesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PublicIPPrefixesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PublicIPPrefixesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PublicIPPrefixesDeleteFuture.Result. -func (future *PublicIPPrefixesDeleteFuture) result(client PublicIPPrefixesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PublicIPPrefixesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PutBastionShareableLinkAllFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PutBastionShareableLinkAllFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BaseClient) (BastionShareableLinkListResultPage, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PutBastionShareableLinkAllFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PutBastionShareableLinkAllFuture.Result. -func (future *PutBastionShareableLinkAllFuture) result(client BaseClient) (bsllrp BastionShareableLinkListResultPage, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PutBastionShareableLinkAllFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bsllrp.bsllr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PutBastionShareableLinkAllFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bsllrp.bsllr.Response.Response, err = future.GetResult(sender); err == nil && bsllrp.bsllr.Response.Response.StatusCode != http.StatusNoContent { - bsllrp, err = client.PutBastionShareableLinkResponder(bsllrp.bsllr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PutBastionShareableLinkAllFuture", "Result", bsllrp.bsllr.Response.Response, "Failure responding to request") - } - } - return -} - -// PutBastionShareableLinkFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PutBastionShareableLinkFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BaseClient) (BastionShareableLinkListResultPage, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PutBastionShareableLinkFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PutBastionShareableLinkFuture.Result. -func (future *PutBastionShareableLinkFuture) result(client BaseClient) (bsllrp BastionShareableLinkListResultPage, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PutBastionShareableLinkFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bsllrp.bsllr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.PutBastionShareableLinkFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bsllrp.bsllr.Response.Response, err = future.GetResult(sender); err == nil && bsllrp.bsllr.Response.Response.StatusCode != http.StatusNoContent { - bsllrp, err = client.PutBastionShareableLinkResponder(bsllrp.bsllr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PutBastionShareableLinkFuture", "Result", bsllrp.bsllr.Response.Response, "Failure responding to request") - } - } - return -} - -// QosDefinition quality of Service defines the traffic configuration between endpoints. Mandatory to have -// one marking. -type QosDefinition struct { - // Markings - List of markings to be used in the configuration. - Markings *[]int32 `json:"markings,omitempty"` - // SourceIPRanges - Source IP ranges. - SourceIPRanges *[]QosIPRange `json:"sourceIpRanges,omitempty"` - // DestinationIPRanges - Destination IP ranges. - DestinationIPRanges *[]QosIPRange `json:"destinationIpRanges,omitempty"` - // SourcePortRanges - Sources port ranges. - SourcePortRanges *[]QosPortRange `json:"sourcePortRanges,omitempty"` - // DestinationPortRanges - Destination port ranges. - DestinationPortRanges *[]QosPortRange `json:"destinationPortRanges,omitempty"` - // Protocol - RNM supported protocol types. Possible values include: 'ProtocolTypeDoNotUse', 'ProtocolTypeIcmp', 'ProtocolTypeTCP', 'ProtocolTypeUDP', 'ProtocolTypeGre', 'ProtocolTypeEsp', 'ProtocolTypeAh', 'ProtocolTypeVxlan', 'ProtocolTypeAll' - Protocol ProtocolType `json:"protocol,omitempty"` -} - -// QosIPRange qos Traffic Profiler IP Range properties. -type QosIPRange struct { - // StartIP - Start IP Address. - StartIP *string `json:"startIP,omitempty"` - // EndIP - End IP Address. - EndIP *string `json:"endIP,omitempty"` -} - -// QosPortRange qos Traffic Profiler Port range properties. -type QosPortRange struct { - // Start - Qos Port Range start. - Start *int32 `json:"start,omitempty"` - // End - Qos Port Range end. - End *int32 `json:"end,omitempty"` -} - -// QueryInboundNatRulePortMappingRequest the request for a QueryInboundNatRulePortMapping API. Either -// IpConfiguration or IpAddress should be set -type QueryInboundNatRulePortMappingRequest struct { - // IPConfiguration - NetworkInterfaceIPConfiguration set in load balancer backend address. - IPConfiguration *SubResource `json:"ipConfiguration,omitempty"` - // IPAddress - IP address set in load balancer backend address. - IPAddress *string `json:"ipAddress,omitempty"` -} - -// QueryRequestOptions query Request Options -type QueryRequestOptions struct { - // SkipToken - When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. - SkipToken *string `json:"skipToken,omitempty"` -} - -// QueryResults query result -type QueryResults struct { - autorest.Response `json:"-"` - // MatchingRecordsCount - Number of total records matching the query. - MatchingRecordsCount *int64 `json:"matchingRecordsCount,omitempty"` - // Signatures - Array containing the results of the query - Signatures *[]SingleQueryResult `json:"signatures,omitempty"` -} - -// QueryTroubleshootingParameters parameters that define the resource to query the troubleshooting result. -type QueryTroubleshootingParameters struct { - // TargetResourceID - The target resource ID to query the troubleshooting result. - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// RadiusServer radius Server Settings. -type RadiusServer struct { - // RadiusServerAddress - The address of this radius server. - RadiusServerAddress *string `json:"radiusServerAddress,omitempty"` - // RadiusServerScore - The initial score assigned to this radius server. - RadiusServerScore *int64 `json:"radiusServerScore,omitempty"` - // RadiusServerSecret - The secret used for this radius server. - RadiusServerSecret *string `json:"radiusServerSecret,omitempty"` -} - -// RecordSet a collective group of information about the record set information. -type RecordSet struct { - // RecordType - Resource record type. - RecordType *string `json:"recordType,omitempty"` - // RecordSetName - Recordset name. - RecordSetName *string `json:"recordSetName,omitempty"` - // Fqdn - Fqdn that resolves to private endpoint ip address. - Fqdn *string `json:"fqdn,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the recordset. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // TTL - Recordset time to live. - TTL *int32 `json:"ttl,omitempty"` - // IPAddresses - The private ip address of the private endpoint. - IPAddresses *[]string `json:"ipAddresses,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecordSet. -func (rs RecordSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rs.RecordType != nil { - objectMap["recordType"] = rs.RecordType - } - if rs.RecordSetName != nil { - objectMap["recordSetName"] = rs.RecordSetName - } - if rs.Fqdn != nil { - objectMap["fqdn"] = rs.Fqdn - } - if rs.TTL != nil { - objectMap["ttl"] = rs.TTL - } - if rs.IPAddresses != nil { - objectMap["ipAddresses"] = rs.IPAddresses - } - return json.Marshal(objectMap) -} - -// ReferencedPublicIPAddress reference to a public IP address. -type ReferencedPublicIPAddress struct { - // ID - The PublicIPAddress Reference. - ID *string `json:"id,omitempty"` -} - -// Resource common resource representation. -type Resource struct { - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.ID != nil { - objectMap["id"] = r.ID - } - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// ResourceNavigationLink resourceNavigationLink resource. -type ResourceNavigationLink struct { - // ResourceNavigationLinkFormat - Resource navigation link properties format. - *ResourceNavigationLinkFormat `json:"properties,omitempty"` - // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceNavigationLink. -func (rnl ResourceNavigationLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rnl.ResourceNavigationLinkFormat != nil { - objectMap["properties"] = rnl.ResourceNavigationLinkFormat - } - if rnl.Name != nil { - objectMap["name"] = rnl.Name - } - if rnl.ID != nil { - objectMap["id"] = rnl.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ResourceNavigationLink struct. -func (rnl *ResourceNavigationLink) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var resourceNavigationLinkFormat ResourceNavigationLinkFormat - err = json.Unmarshal(*v, &resourceNavigationLinkFormat) - if err != nil { - return err - } - rnl.ResourceNavigationLinkFormat = &resourceNavigationLinkFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rnl.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - rnl.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rnl.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rnl.ID = &ID - } - } - } - - return nil -} - -// ResourceNavigationLinkFormat properties of ResourceNavigationLink. -type ResourceNavigationLinkFormat struct { - // LinkedResourceType - Resource type of the linked resource. - LinkedResourceType *string `json:"linkedResourceType,omitempty"` - // Link - Link to the external resource. - Link *string `json:"link,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the resource navigation link resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceNavigationLinkFormat. -func (rnlf ResourceNavigationLinkFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rnlf.LinkedResourceType != nil { - objectMap["linkedResourceType"] = rnlf.LinkedResourceType - } - if rnlf.Link != nil { - objectMap["link"] = rnlf.Link - } - return json.Marshal(objectMap) -} - -// ResourceNavigationLinksListResult response for ResourceNavigationLinks_List operation. -type ResourceNavigationLinksListResult struct { - autorest.Response `json:"-"` - // Value - The resource navigation links in a subnet. - Value *[]ResourceNavigationLink `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceNavigationLinksListResult. -func (rnllr ResourceNavigationLinksListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rnllr.Value != nil { - objectMap["value"] = rnllr.Value - } - return json.Marshal(objectMap) -} - -// ResourceSet the base resource set for visibility and auto-approval. -type ResourceSet struct { - // Subscriptions - The list of subscriptions. - Subscriptions *[]string `json:"subscriptions,omitempty"` -} - -// RetentionPolicyParameters parameters that define the retention policy for flow log. -type RetentionPolicyParameters struct { - // Days - Number of days to retain flow log records. - Days *int32 `json:"days,omitempty"` - // Enabled - Flag to enable/disable retention. - Enabled *bool `json:"enabled,omitempty"` -} - -// Route route resource. -type Route struct { - autorest.Response `json:"-"` - // RoutePropertiesFormat - Properties of the route. - *RoutePropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - The type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for Route. -func (r Route) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.RoutePropertiesFormat != nil { - objectMap["properties"] = r.RoutePropertiesFormat - } - if r.Name != nil { - objectMap["name"] = r.Name - } - if r.Type != nil { - objectMap["type"] = r.Type - } - if r.ID != nil { - objectMap["id"] = r.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Route struct. -func (r *Route) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var routePropertiesFormat RoutePropertiesFormat - err = json.Unmarshal(*v, &routePropertiesFormat) - if err != nil { - return err - } - r.RoutePropertiesFormat = &routePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - r.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - r.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - r.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - r.ID = &ID - } - } - } - - return nil -} - -// RouteFilter route Filter Resource. -type RouteFilter struct { - autorest.Response `json:"-"` - // RouteFilterPropertiesFormat - Properties of the route filter. - *RouteFilterPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for RouteFilter. -func (rf RouteFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rf.RouteFilterPropertiesFormat != nil { - objectMap["properties"] = rf.RouteFilterPropertiesFormat - } - if rf.ID != nil { - objectMap["id"] = rf.ID - } - if rf.Location != nil { - objectMap["location"] = rf.Location - } - if rf.Tags != nil { - objectMap["tags"] = rf.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RouteFilter struct. -func (rf *RouteFilter) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var routeFilterPropertiesFormat RouteFilterPropertiesFormat - err = json.Unmarshal(*v, &routeFilterPropertiesFormat) - if err != nil { - return err - } - rf.RouteFilterPropertiesFormat = &routeFilterPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - rf.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rf.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rf.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rf.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rf.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rf.Tags = tags - } - } - } - - return nil -} - -// RouteFilterListResult response for the ListRouteFilters API service call. -type RouteFilterListResult struct { - autorest.Response `json:"-"` - // Value - A list of route filters in a resource group. - Value *[]RouteFilter `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// RouteFilterListResultIterator provides access to a complete listing of RouteFilter values. -type RouteFilterListResultIterator struct { - i int - page RouteFilterListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RouteFilterListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RouteFilterListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RouteFilterListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RouteFilterListResultIterator) Response() RouteFilterListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RouteFilterListResultIterator) Value() RouteFilter { - if !iter.page.NotDone() { - return RouteFilter{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RouteFilterListResultIterator type. -func NewRouteFilterListResultIterator(page RouteFilterListResultPage) RouteFilterListResultIterator { - return RouteFilterListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rflr RouteFilterListResult) IsEmpty() bool { - return rflr.Value == nil || len(*rflr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rflr RouteFilterListResult) hasNextLink() bool { - return rflr.NextLink != nil && len(*rflr.NextLink) != 0 -} - -// routeFilterListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rflr RouteFilterListResult) routeFilterListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rflr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rflr.NextLink))) -} - -// RouteFilterListResultPage contains a page of RouteFilter values. -type RouteFilterListResultPage struct { - fn func(context.Context, RouteFilterListResult) (RouteFilterListResult, error) - rflr RouteFilterListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RouteFilterListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rflr) - if err != nil { - return err - } - page.rflr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RouteFilterListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RouteFilterListResultPage) NotDone() bool { - return !page.rflr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RouteFilterListResultPage) Response() RouteFilterListResult { - return page.rflr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RouteFilterListResultPage) Values() []RouteFilter { - if page.rflr.IsEmpty() { - return nil - } - return *page.rflr.Value -} - -// Creates a new instance of the RouteFilterListResultPage type. -func NewRouteFilterListResultPage(cur RouteFilterListResult, getNextPage func(context.Context, RouteFilterListResult) (RouteFilterListResult, error)) RouteFilterListResultPage { - return RouteFilterListResultPage{ - fn: getNextPage, - rflr: cur, - } -} - -// RouteFilterPropertiesFormat route Filter Resource. -type RouteFilterPropertiesFormat struct { - // Rules - Collection of RouteFilterRules contained within a route filter. - Rules *[]RouteFilterRule `json:"rules,omitempty"` - // Peerings - READ-ONLY; A collection of references to express route circuit peerings. - Peerings *[]ExpressRouteCircuitPeering `json:"peerings,omitempty"` - // Ipv6Peerings - READ-ONLY; A collection of references to express route circuit ipv6 peerings. - Ipv6Peerings *[]ExpressRouteCircuitPeering `json:"ipv6Peerings,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the route filter resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for RouteFilterPropertiesFormat. -func (rfpf RouteFilterPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rfpf.Rules != nil { - objectMap["rules"] = rfpf.Rules - } - return json.Marshal(objectMap) -} - -// RouteFilterRule route Filter Rule Resource. -type RouteFilterRule struct { - autorest.Response `json:"-"` - // RouteFilterRulePropertiesFormat - Properties of the route filter rule. - *RouteFilterRulePropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for RouteFilterRule. -func (rfr RouteFilterRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rfr.RouteFilterRulePropertiesFormat != nil { - objectMap["properties"] = rfr.RouteFilterRulePropertiesFormat - } - if rfr.Name != nil { - objectMap["name"] = rfr.Name - } - if rfr.Location != nil { - objectMap["location"] = rfr.Location - } - if rfr.ID != nil { - objectMap["id"] = rfr.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RouteFilterRule struct. -func (rfr *RouteFilterRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var routeFilterRulePropertiesFormat RouteFilterRulePropertiesFormat - err = json.Unmarshal(*v, &routeFilterRulePropertiesFormat) - if err != nil { - return err - } - rfr.RouteFilterRulePropertiesFormat = &routeFilterRulePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rfr.Name = &name - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rfr.Location = &location - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - rfr.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rfr.ID = &ID - } - } - } - - return nil -} - -// RouteFilterRuleListResult response for the ListRouteFilterRules API service call. -type RouteFilterRuleListResult struct { - autorest.Response `json:"-"` - // Value - A list of RouteFilterRules in a resource group. - Value *[]RouteFilterRule `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// RouteFilterRuleListResultIterator provides access to a complete listing of RouteFilterRule values. -type RouteFilterRuleListResultIterator struct { - i int - page RouteFilterRuleListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RouteFilterRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterRuleListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RouteFilterRuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RouteFilterRuleListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RouteFilterRuleListResultIterator) Response() RouteFilterRuleListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RouteFilterRuleListResultIterator) Value() RouteFilterRule { - if !iter.page.NotDone() { - return RouteFilterRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RouteFilterRuleListResultIterator type. -func NewRouteFilterRuleListResultIterator(page RouteFilterRuleListResultPage) RouteFilterRuleListResultIterator { - return RouteFilterRuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rfrlr RouteFilterRuleListResult) IsEmpty() bool { - return rfrlr.Value == nil || len(*rfrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rfrlr RouteFilterRuleListResult) hasNextLink() bool { - return rfrlr.NextLink != nil && len(*rfrlr.NextLink) != 0 -} - -// routeFilterRuleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rfrlr RouteFilterRuleListResult) routeFilterRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rfrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rfrlr.NextLink))) -} - -// RouteFilterRuleListResultPage contains a page of RouteFilterRule values. -type RouteFilterRuleListResultPage struct { - fn func(context.Context, RouteFilterRuleListResult) (RouteFilterRuleListResult, error) - rfrlr RouteFilterRuleListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RouteFilterRuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterRuleListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rfrlr) - if err != nil { - return err - } - page.rfrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RouteFilterRuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RouteFilterRuleListResultPage) NotDone() bool { - return !page.rfrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RouteFilterRuleListResultPage) Response() RouteFilterRuleListResult { - return page.rfrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RouteFilterRuleListResultPage) Values() []RouteFilterRule { - if page.rfrlr.IsEmpty() { - return nil - } - return *page.rfrlr.Value -} - -// Creates a new instance of the RouteFilterRuleListResultPage type. -func NewRouteFilterRuleListResultPage(cur RouteFilterRuleListResult, getNextPage func(context.Context, RouteFilterRuleListResult) (RouteFilterRuleListResult, error)) RouteFilterRuleListResultPage { - return RouteFilterRuleListResultPage{ - fn: getNextPage, - rfrlr: cur, - } -} - -// RouteFilterRulePropertiesFormat route Filter Rule Resource. -type RouteFilterRulePropertiesFormat struct { - // Access - The access type of the rule. Possible values include: 'AccessAllow', 'AccessDeny' - Access Access `json:"access,omitempty"` - // RouteFilterRuleType - The rule type of the rule. - RouteFilterRuleType *string `json:"routeFilterRuleType,omitempty"` - // Communities - The collection for bgp community values to filter on. e.g. ['12076:5010','12076:5020']. - Communities *[]string `json:"communities,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the route filter rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for RouteFilterRulePropertiesFormat. -func (rfrpf RouteFilterRulePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rfrpf.Access != "" { - objectMap["access"] = rfrpf.Access - } - if rfrpf.RouteFilterRuleType != nil { - objectMap["routeFilterRuleType"] = rfrpf.RouteFilterRuleType - } - if rfrpf.Communities != nil { - objectMap["communities"] = rfrpf.Communities - } - return json.Marshal(objectMap) -} - -// RouteFilterRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type RouteFilterRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RouteFilterRulesClient) (RouteFilterRule, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RouteFilterRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RouteFilterRulesCreateOrUpdateFuture.Result. -func (future *RouteFilterRulesCreateOrUpdateFuture) result(client RouteFilterRulesClient) (rfr RouteFilterRule, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rfr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.RouteFilterRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rfr.Response.Response, err = future.GetResult(sender); err == nil && rfr.Response.Response.StatusCode != http.StatusNoContent { - rfr, err = client.CreateOrUpdateResponder(rfr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesCreateOrUpdateFuture", "Result", rfr.Response.Response, "Failure responding to request") - } - } - return -} - -// RouteFilterRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RouteFilterRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RouteFilterRulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RouteFilterRulesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RouteFilterRulesDeleteFuture.Result. -func (future *RouteFilterRulesDeleteFuture) result(client RouteFilterRulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.RouteFilterRulesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// RouteFiltersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type RouteFiltersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RouteFiltersClient) (RouteFilter, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RouteFiltersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RouteFiltersCreateOrUpdateFuture.Result. -func (future *RouteFiltersCreateOrUpdateFuture) result(client RouteFiltersClient) (rf RouteFilter, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rf.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.RouteFiltersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rf.Response.Response, err = future.GetResult(sender); err == nil && rf.Response.Response.StatusCode != http.StatusNoContent { - rf, err = client.CreateOrUpdateResponder(rf.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersCreateOrUpdateFuture", "Result", rf.Response.Response, "Failure responding to request") - } - } - return -} - -// RouteFiltersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RouteFiltersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RouteFiltersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RouteFiltersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RouteFiltersDeleteFuture.Result. -func (future *RouteFiltersDeleteFuture) result(client RouteFiltersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.RouteFiltersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// RouteListResult response for the ListRoute API service call. -type RouteListResult struct { - autorest.Response `json:"-"` - // Value - A list of routes in a resource group. - Value *[]Route `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// RouteListResultIterator provides access to a complete listing of Route values. -type RouteListResultIterator struct { - i int - page RouteListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RouteListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RouteListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RouteListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RouteListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RouteListResultIterator) Response() RouteListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RouteListResultIterator) Value() Route { - if !iter.page.NotDone() { - return Route{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RouteListResultIterator type. -func NewRouteListResultIterator(page RouteListResultPage) RouteListResultIterator { - return RouteListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RouteListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RouteListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// routeListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RouteListResult) routeListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rlr.NextLink))) -} - -// RouteListResultPage contains a page of Route values. -type RouteListResultPage struct { - fn func(context.Context, RouteListResult) (RouteListResult, error) - rlr RouteListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RouteListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RouteListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rlr) - if err != nil { - return err - } - page.rlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RouteListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RouteListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RouteListResultPage) Response() RouteListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RouteListResultPage) Values() []Route { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RouteListResultPage type. -func NewRouteListResultPage(cur RouteListResult, getNextPage func(context.Context, RouteListResult) (RouteListResult, error)) RouteListResultPage { - return RouteListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RouteMap the RouteMap child resource of a Virtual hub. -type RouteMap struct { - autorest.Response `json:"-"` - // RouteMapProperties - Properties of the RouteMap resource. - *RouteMapProperties `json:"properties,omitempty"` - // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for RouteMap. -func (rm RouteMap) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rm.RouteMapProperties != nil { - objectMap["properties"] = rm.RouteMapProperties - } - if rm.ID != nil { - objectMap["id"] = rm.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RouteMap struct. -func (rm *RouteMap) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var routeMapProperties RouteMapProperties - err = json.Unmarshal(*v, &routeMapProperties) - if err != nil { - return err - } - rm.RouteMapProperties = &routeMapProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rm.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - rm.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rm.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rm.ID = &ID - } - } - } - - return nil -} - -// RouteMapProperties properties of RouteMap resource -type RouteMapProperties struct { - // AssociatedInboundConnections - List of connections which have this RoutMap associated for inbound traffic. - AssociatedInboundConnections *[]string `json:"associatedInboundConnections,omitempty"` - // AssociatedOutboundConnections - List of connections which have this RoutMap associated for outbound traffic. - AssociatedOutboundConnections *[]string `json:"associatedOutboundConnections,omitempty"` - // Rules - List of RouteMap rules to be applied. - Rules *[]RouteMapRule `json:"rules,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the RouteMap resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for RouteMapProperties. -func (rmp RouteMapProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rmp.AssociatedInboundConnections != nil { - objectMap["associatedInboundConnections"] = rmp.AssociatedInboundConnections - } - if rmp.AssociatedOutboundConnections != nil { - objectMap["associatedOutboundConnections"] = rmp.AssociatedOutboundConnections - } - if rmp.Rules != nil { - objectMap["rules"] = rmp.Rules - } - return json.Marshal(objectMap) -} - -// RouteMapRule a RouteMap Rule. -type RouteMapRule struct { - // Name - The unique name for the rule. - Name *string `json:"name,omitempty"` - // MatchCriteria - List of matching criterion which will be applied to traffic. - MatchCriteria *[]Criterion `json:"matchCriteria,omitempty"` - // Actions - List of actions which will be applied on a match. - Actions *[]Action `json:"actions,omitempty"` - // NextStepIfMatched - Next step after rule is evaluated. Current supported behaviors are 'Continue'(to next rule) and 'Terminate'. Possible values include: 'NextStepUnknown', 'NextStepContinue', 'NextStepTerminate' - NextStepIfMatched NextStep `json:"nextStepIfMatched,omitempty"` -} - -// RouteMapsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RouteMapsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RouteMapsClient) (RouteMap, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RouteMapsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RouteMapsCreateOrUpdateFuture.Result. -func (future *RouteMapsCreateOrUpdateFuture) result(client RouteMapsClient) (rm RouteMap, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteMapsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.RouteMapsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rm.Response.Response, err = future.GetResult(sender); err == nil && rm.Response.Response.StatusCode != http.StatusNoContent { - rm, err = client.CreateOrUpdateResponder(rm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteMapsCreateOrUpdateFuture", "Result", rm.Response.Response, "Failure responding to request") - } - } - return -} - -// RouteMapsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RouteMapsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RouteMapsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RouteMapsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RouteMapsDeleteFuture.Result. -func (future *RouteMapsDeleteFuture) result(client RouteMapsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteMapsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.RouteMapsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// RoutePropertiesFormat route resource. -type RoutePropertiesFormat struct { - // AddressPrefix - The destination CIDR to which the route applies. - AddressPrefix *string `json:"addressPrefix,omitempty"` - // NextHopType - The type of Azure hop the packet should be sent to. Possible values include: 'RouteNextHopTypeVirtualNetworkGateway', 'RouteNextHopTypeVnetLocal', 'RouteNextHopTypeInternet', 'RouteNextHopTypeVirtualAppliance', 'RouteNextHopTypeNone' - NextHopType RouteNextHopType `json:"nextHopType,omitempty"` - // NextHopIPAddress - The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. - NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the route resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // HasBgpOverride - A value indicating whether this route overrides overlapping BGP routes regardless of LPM. - HasBgpOverride *bool `json:"hasBgpOverride,omitempty"` -} - -// MarshalJSON is the custom marshaler for RoutePropertiesFormat. -func (rpf RoutePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rpf.AddressPrefix != nil { - objectMap["addressPrefix"] = rpf.AddressPrefix - } - if rpf.NextHopType != "" { - objectMap["nextHopType"] = rpf.NextHopType - } - if rpf.NextHopIPAddress != nil { - objectMap["nextHopIpAddress"] = rpf.NextHopIPAddress - } - if rpf.HasBgpOverride != nil { - objectMap["hasBgpOverride"] = rpf.HasBgpOverride - } - return json.Marshal(objectMap) -} - -// RouteTable route table resource. -type RouteTable struct { - autorest.Response `json:"-"` - // RouteTablePropertiesFormat - Properties of the route table. - *RouteTablePropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for RouteTable. -func (rt RouteTable) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rt.RouteTablePropertiesFormat != nil { - objectMap["properties"] = rt.RouteTablePropertiesFormat - } - if rt.ID != nil { - objectMap["id"] = rt.ID - } - if rt.Location != nil { - objectMap["location"] = rt.Location - } - if rt.Tags != nil { - objectMap["tags"] = rt.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RouteTable struct. -func (rt *RouteTable) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var routeTablePropertiesFormat RouteTablePropertiesFormat - err = json.Unmarshal(*v, &routeTablePropertiesFormat) - if err != nil { - return err - } - rt.RouteTablePropertiesFormat = &routeTablePropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - rt.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rt.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rt.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rt.Tags = tags - } - } - } - - return nil -} - -// RouteTableListResult response for the ListRouteTable API service call. -type RouteTableListResult struct { - autorest.Response `json:"-"` - // Value - A list of route tables in a resource group. - Value *[]RouteTable `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// RouteTableListResultIterator provides access to a complete listing of RouteTable values. -type RouteTableListResultIterator struct { - i int - page RouteTableListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RouteTableListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RouteTableListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RouteTableListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RouteTableListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RouteTableListResultIterator) Response() RouteTableListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RouteTableListResultIterator) Value() RouteTable { - if !iter.page.NotDone() { - return RouteTable{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RouteTableListResultIterator type. -func NewRouteTableListResultIterator(page RouteTableListResultPage) RouteTableListResultIterator { - return RouteTableListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rtlr RouteTableListResult) IsEmpty() bool { - return rtlr.Value == nil || len(*rtlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rtlr RouteTableListResult) hasNextLink() bool { - return rtlr.NextLink != nil && len(*rtlr.NextLink) != 0 -} - -// routeTableListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rtlr RouteTableListResult) routeTableListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rtlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rtlr.NextLink))) -} - -// RouteTableListResultPage contains a page of RouteTable values. -type RouteTableListResultPage struct { - fn func(context.Context, RouteTableListResult) (RouteTableListResult, error) - rtlr RouteTableListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RouteTableListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RouteTableListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rtlr) - if err != nil { - return err - } - page.rtlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RouteTableListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RouteTableListResultPage) NotDone() bool { - return !page.rtlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RouteTableListResultPage) Response() RouteTableListResult { - return page.rtlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RouteTableListResultPage) Values() []RouteTable { - if page.rtlr.IsEmpty() { - return nil - } - return *page.rtlr.Value -} - -// Creates a new instance of the RouteTableListResultPage type. -func NewRouteTableListResultPage(cur RouteTableListResult, getNextPage func(context.Context, RouteTableListResult) (RouteTableListResult, error)) RouteTableListResultPage { - return RouteTableListResultPage{ - fn: getNextPage, - rtlr: cur, - } -} - -// RouteTablePropertiesFormat route Table resource. -type RouteTablePropertiesFormat struct { - // Routes - Collection of routes contained within a route table. - Routes *[]Route `json:"routes,omitempty"` - // Subnets - READ-ONLY; A collection of references to subnets. - Subnets *[]Subnet `json:"subnets,omitempty"` - // DisableBgpRoutePropagation - Whether to disable the routes learned by BGP on that route table. True means disable. - DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the route table resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the route table. - ResourceGUID *string `json:"resourceGuid,omitempty"` -} - -// MarshalJSON is the custom marshaler for RouteTablePropertiesFormat. -func (rtpf RouteTablePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rtpf.Routes != nil { - objectMap["routes"] = rtpf.Routes - } - if rtpf.DisableBgpRoutePropagation != nil { - objectMap["disableBgpRoutePropagation"] = rtpf.DisableBgpRoutePropagation - } - return json.Marshal(objectMap) -} - -// RouteTablesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type RouteTablesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RouteTablesClient) (RouteTable, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RouteTablesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RouteTablesCreateOrUpdateFuture.Result. -func (future *RouteTablesCreateOrUpdateFuture) result(client RouteTablesClient) (rt RouteTable, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rt.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.RouteTablesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent { - rt, err = client.CreateOrUpdateResponder(rt.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", rt.Response.Response, "Failure responding to request") - } - } - return -} - -// RouteTablesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RouteTablesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RouteTablesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RouteTablesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RouteTablesDeleteFuture.Result. -func (future *RouteTablesDeleteFuture) result(client RouteTablesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.RouteTablesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// RoutesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RoutesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RoutesClient) (Route, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RoutesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RoutesCreateOrUpdateFuture.Result. -func (future *RoutesCreateOrUpdateFuture) result(client RoutesClient) (r Route, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - r.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.RoutesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { - r, err = client.CreateOrUpdateResponder(r.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", r.Response.Response, "Failure responding to request") - } - } - return -} - -// RoutesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type RoutesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RoutesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RoutesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RoutesDeleteFuture.Result. -func (future *RoutesDeleteFuture) result(client RoutesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.RoutesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// RoutingConfiguration routing Configuration indicating the associated and propagated route tables for -// this connection. -type RoutingConfiguration struct { - // AssociatedRouteTable - The resource id RouteTable associated with this RoutingConfiguration. - AssociatedRouteTable *SubResource `json:"associatedRouteTable,omitempty"` - // PropagatedRouteTables - The list of RouteTables to advertise the routes to. - PropagatedRouteTables *PropagatedRouteTable `json:"propagatedRouteTables,omitempty"` - // VnetRoutes - List of routes that control routing from VirtualHub into a virtual network connection. - VnetRoutes *VnetRoute `json:"vnetRoutes,omitempty"` - // InboundRouteMap - The resource id of the RouteMap associated with this RoutingConfiguration for inbound learned routes. - InboundRouteMap *SubResource `json:"inboundRouteMap,omitempty"` - // OutboundRouteMap - The resource id of theRouteMap associated with this RoutingConfiguration for outbound advertised routes. - OutboundRouteMap *SubResource `json:"outboundRouteMap,omitempty"` -} - -// RoutingIntent the routing intent child resource of a Virtual hub. -type RoutingIntent struct { - autorest.Response `json:"-"` - // RoutingIntentProperties - Properties of the RoutingIntent resource. - *RoutingIntentProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for RoutingIntent. -func (ri RoutingIntent) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ri.RoutingIntentProperties != nil { - objectMap["properties"] = ri.RoutingIntentProperties - } - if ri.Name != nil { - objectMap["name"] = ri.Name - } - if ri.ID != nil { - objectMap["id"] = ri.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RoutingIntent struct. -func (ri *RoutingIntent) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var routingIntentProperties RoutingIntentProperties - err = json.Unmarshal(*v, &routingIntentProperties) - if err != nil { - return err - } - ri.RoutingIntentProperties = &routingIntentProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ri.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ri.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ri.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ri.ID = &ID - } - } - } - - return nil -} - -// RoutingIntentCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type RoutingIntentCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RoutingIntentClient) (RoutingIntent, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RoutingIntentCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RoutingIntentCreateOrUpdateFuture.Result. -func (future *RoutingIntentCreateOrUpdateFuture) result(client RoutingIntentClient) (ri RoutingIntent, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutingIntentCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ri.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.RoutingIntentCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ri.Response.Response, err = future.GetResult(sender); err == nil && ri.Response.Response.StatusCode != http.StatusNoContent { - ri, err = client.CreateOrUpdateResponder(ri.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutingIntentCreateOrUpdateFuture", "Result", ri.Response.Response, "Failure responding to request") - } - } - return -} - -// RoutingIntentDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type RoutingIntentDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RoutingIntentClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RoutingIntentDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RoutingIntentDeleteFuture.Result. -func (future *RoutingIntentDeleteFuture) result(client RoutingIntentClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutingIntentDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.RoutingIntentDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// RoutingIntentProperties the properties of a RoutingIntent resource. -type RoutingIntentProperties struct { - // RoutingPolicies - List of routing policies. - RoutingPolicies *[]RoutingPolicy `json:"routingPolicies,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the RoutingIntent resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for RoutingIntentProperties. -func (rip RoutingIntentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rip.RoutingPolicies != nil { - objectMap["routingPolicies"] = rip.RoutingPolicies - } - return json.Marshal(objectMap) -} - -// RoutingPolicy the routing policy object used in a RoutingIntent resource. -type RoutingPolicy struct { - // Name - The unique name for the routing policy. - Name *string `json:"name,omitempty"` - // Destinations - List of all destinations which this routing policy is applicable to (for example: Internet, PrivateTraffic). - Destinations *[]string `json:"destinations,omitempty"` - // NextHop - The next hop resource id on which this routing policy is applicable to. - NextHop *string `json:"nextHop,omitempty"` -} - -// Rule rule of type network. -type Rule struct { - // IPProtocols - Array of FirewallPolicyRuleNetworkProtocols. - IPProtocols *[]FirewallPolicyRuleNetworkProtocol `json:"ipProtocols,omitempty"` - // SourceAddresses - List of source IP addresses for this rule. - SourceAddresses *[]string `json:"sourceAddresses,omitempty"` - // DestinationAddresses - List of destination IP addresses or Service Tags. - DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` - // DestinationPorts - List of destination ports. - DestinationPorts *[]string `json:"destinationPorts,omitempty"` - // SourceIPGroups - List of source IpGroups for this rule. - SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` - // DestinationIPGroups - List of destination IpGroups for this rule. - DestinationIPGroups *[]string `json:"destinationIpGroups,omitempty"` - // DestinationFqdns - List of destination FQDNs. - DestinationFqdns *[]string `json:"destinationFqdns,omitempty"` - // Name - Name of the rule. - Name *string `json:"name,omitempty"` - // Description - Description of the rule. - Description *string `json:"description,omitempty"` - // RuleType - Possible values include: 'RuleTypeFirewallPolicyRule', 'RuleTypeApplicationRule', 'RuleTypeNatRule', 'RuleTypeNetworkRule' - RuleType RuleType `json:"ruleType,omitempty"` -} - -// MarshalJSON is the custom marshaler for Rule. -func (r Rule) MarshalJSON() ([]byte, error) { - r.RuleType = RuleTypeNetworkRule - objectMap := make(map[string]interface{}) - if r.IPProtocols != nil { - objectMap["ipProtocols"] = r.IPProtocols - } - if r.SourceAddresses != nil { - objectMap["sourceAddresses"] = r.SourceAddresses - } - if r.DestinationAddresses != nil { - objectMap["destinationAddresses"] = r.DestinationAddresses - } - if r.DestinationPorts != nil { - objectMap["destinationPorts"] = r.DestinationPorts - } - if r.SourceIPGroups != nil { - objectMap["sourceIpGroups"] = r.SourceIPGroups - } - if r.DestinationIPGroups != nil { - objectMap["destinationIpGroups"] = r.DestinationIPGroups - } - if r.DestinationFqdns != nil { - objectMap["destinationFqdns"] = r.DestinationFqdns - } - if r.Name != nil { - objectMap["name"] = r.Name - } - if r.Description != nil { - objectMap["description"] = r.Description - } - if r.RuleType != "" { - objectMap["ruleType"] = r.RuleType - } - return json.Marshal(objectMap) -} - -// AsApplicationRule is the BasicFirewallPolicyRule implementation for Rule. -func (r Rule) AsApplicationRule() (*ApplicationRule, bool) { - return nil, false -} - -// AsNatRule is the BasicFirewallPolicyRule implementation for Rule. -func (r Rule) AsNatRule() (*NatRule, bool) { - return nil, false -} - -// AsRule is the BasicFirewallPolicyRule implementation for Rule. -func (r Rule) AsRule() (*Rule, bool) { - return &r, true -} - -// AsFirewallPolicyRule is the BasicFirewallPolicyRule implementation for Rule. -func (r Rule) AsFirewallPolicyRule() (*FirewallPolicyRule, bool) { - return nil, false -} - -// AsBasicFirewallPolicyRule is the BasicFirewallPolicyRule implementation for Rule. -func (r Rule) AsBasicFirewallPolicyRule() (BasicFirewallPolicyRule, bool) { - return &r, true -} - -// ScopeConnection the Scope Connections resource -type ScopeConnection struct { - autorest.Response `json:"-"` - // ScopeConnectionProperties - The scope connection properties - *ScopeConnectionProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata related to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScopeConnection. -func (sc ScopeConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sc.ScopeConnectionProperties != nil { - objectMap["properties"] = sc.ScopeConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScopeConnection struct. -func (sc *ScopeConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var scopeConnectionProperties ScopeConnectionProperties - err = json.Unmarshal(*v, &scopeConnectionProperties) - if err != nil { - return err - } - sc.ScopeConnectionProperties = &scopeConnectionProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sc.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sc.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sc.Etag = &etag - } - } - } - - return nil -} - -// ScopeConnectionListResult list of scope connections. -type ScopeConnectionListResult struct { - autorest.Response `json:"-"` - // Value - List of scope connections. - Value *[]ScopeConnection `json:"value,omitempty"` - // NextLink - Gets the URL to get the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ScopeConnectionListResultIterator provides access to a complete listing of ScopeConnection values. -type ScopeConnectionListResultIterator struct { - i int - page ScopeConnectionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ScopeConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeConnectionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ScopeConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ScopeConnectionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ScopeConnectionListResultIterator) Response() ScopeConnectionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ScopeConnectionListResultIterator) Value() ScopeConnection { - if !iter.page.NotDone() { - return ScopeConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ScopeConnectionListResultIterator type. -func NewScopeConnectionListResultIterator(page ScopeConnectionListResultPage) ScopeConnectionListResultIterator { - return ScopeConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sclr ScopeConnectionListResult) IsEmpty() bool { - return sclr.Value == nil || len(*sclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sclr ScopeConnectionListResult) hasNextLink() bool { - return sclr.NextLink != nil && len(*sclr.NextLink) != 0 -} - -// scopeConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sclr ScopeConnectionListResult) scopeConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sclr.NextLink))) -} - -// ScopeConnectionListResultPage contains a page of ScopeConnection values. -type ScopeConnectionListResultPage struct { - fn func(context.Context, ScopeConnectionListResult) (ScopeConnectionListResult, error) - sclr ScopeConnectionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ScopeConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScopeConnectionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sclr) - if err != nil { - return err - } - page.sclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ScopeConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ScopeConnectionListResultPage) NotDone() bool { - return !page.sclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ScopeConnectionListResultPage) Response() ScopeConnectionListResult { - return page.sclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ScopeConnectionListResultPage) Values() []ScopeConnection { - if page.sclr.IsEmpty() { - return nil - } - return *page.sclr.Value -} - -// Creates a new instance of the ScopeConnectionListResultPage type. -func NewScopeConnectionListResultPage(cur ScopeConnectionListResult, getNextPage func(context.Context, ScopeConnectionListResult) (ScopeConnectionListResult, error)) ScopeConnectionListResultPage { - return ScopeConnectionListResultPage{ - fn: getNextPage, - sclr: cur, - } -} - -// ScopeConnectionProperties scope connection. -type ScopeConnectionProperties struct { - // TenantID - Tenant ID. - TenantID *string `json:"tenantId,omitempty"` - // ResourceID - Resource ID. - ResourceID *string `json:"resourceId,omitempty"` - // ConnectionState - Connection State. Possible values include: 'ScopeConnectionStateConnected', 'ScopeConnectionStatePending', 'ScopeConnectionStateConflict', 'ScopeConnectionStateRevoked', 'ScopeConnectionStateRejected' - ConnectionState ScopeConnectionState `json:"connectionState,omitempty"` - // Description - A description of the scope connection. - Description *string `json:"description,omitempty"` -} - -// SecurityAdminConfiguration defines the security admin configuration -type SecurityAdminConfiguration struct { - autorest.Response `json:"-"` - // SecurityAdminConfigurationPropertiesFormat - Indicates the properties for the network manager security admin configuration. - *SecurityAdminConfigurationPropertiesFormat `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata related to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for SecurityAdminConfiguration. -func (sac SecurityAdminConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sac.SecurityAdminConfigurationPropertiesFormat != nil { - objectMap["properties"] = sac.SecurityAdminConfigurationPropertiesFormat - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SecurityAdminConfiguration struct. -func (sac *SecurityAdminConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var securityAdminConfigurationPropertiesFormat SecurityAdminConfigurationPropertiesFormat - err = json.Unmarshal(*v, &securityAdminConfigurationPropertiesFormat) - if err != nil { - return err - } - sac.SecurityAdminConfigurationPropertiesFormat = &securityAdminConfigurationPropertiesFormat - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sac.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sac.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sac.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sac.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sac.Etag = &etag - } - } - } - - return nil -} - -// SecurityAdminConfigurationListResult a list of network manager security admin configurations -type SecurityAdminConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - Gets a page of security admin configurations - Value *[]SecurityAdminConfiguration `json:"value,omitempty"` - // NextLink - Gets the URL to get the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// SecurityAdminConfigurationListResultIterator provides access to a complete listing of -// SecurityAdminConfiguration values. -type SecurityAdminConfigurationListResultIterator struct { - i int - page SecurityAdminConfigurationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SecurityAdminConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecurityAdminConfigurationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SecurityAdminConfigurationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SecurityAdminConfigurationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SecurityAdminConfigurationListResultIterator) Response() SecurityAdminConfigurationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SecurityAdminConfigurationListResultIterator) Value() SecurityAdminConfiguration { - if !iter.page.NotDone() { - return SecurityAdminConfiguration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SecurityAdminConfigurationListResultIterator type. -func NewSecurityAdminConfigurationListResultIterator(page SecurityAdminConfigurationListResultPage) SecurityAdminConfigurationListResultIterator { - return SecurityAdminConfigurationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (saclr SecurityAdminConfigurationListResult) IsEmpty() bool { - return saclr.Value == nil || len(*saclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (saclr SecurityAdminConfigurationListResult) hasNextLink() bool { - return saclr.NextLink != nil && len(*saclr.NextLink) != 0 -} - -// securityAdminConfigurationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (saclr SecurityAdminConfigurationListResult) securityAdminConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !saclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(saclr.NextLink))) -} - -// SecurityAdminConfigurationListResultPage contains a page of SecurityAdminConfiguration values. -type SecurityAdminConfigurationListResultPage struct { - fn func(context.Context, SecurityAdminConfigurationListResult) (SecurityAdminConfigurationListResult, error) - saclr SecurityAdminConfigurationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SecurityAdminConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecurityAdminConfigurationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.saclr) - if err != nil { - return err - } - page.saclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SecurityAdminConfigurationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SecurityAdminConfigurationListResultPage) NotDone() bool { - return !page.saclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SecurityAdminConfigurationListResultPage) Response() SecurityAdminConfigurationListResult { - return page.saclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SecurityAdminConfigurationListResultPage) Values() []SecurityAdminConfiguration { - if page.saclr.IsEmpty() { - return nil - } - return *page.saclr.Value -} - -// Creates a new instance of the SecurityAdminConfigurationListResultPage type. -func NewSecurityAdminConfigurationListResultPage(cur SecurityAdminConfigurationListResult, getNextPage func(context.Context, SecurityAdminConfigurationListResult) (SecurityAdminConfigurationListResult, error)) SecurityAdminConfigurationListResultPage { - return SecurityAdminConfigurationListResultPage{ - fn: getNextPage, - saclr: cur, - } -} - -// SecurityAdminConfigurationPropertiesFormat defines the security admin configuration properties. -type SecurityAdminConfigurationPropertiesFormat struct { - // Description - A description of the security configuration. - Description *string `json:"description,omitempty"` - // ApplyOnNetworkIntentPolicyBasedServices - Enum list of network intent policy based services. - ApplyOnNetworkIntentPolicyBasedServices *[]IntentPolicyBasedService `json:"applyOnNetworkIntentPolicyBasedServices,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for SecurityAdminConfigurationPropertiesFormat. -func (sacpf SecurityAdminConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sacpf.Description != nil { - objectMap["description"] = sacpf.Description - } - if sacpf.ApplyOnNetworkIntentPolicyBasedServices != nil { - objectMap["applyOnNetworkIntentPolicyBasedServices"] = sacpf.ApplyOnNetworkIntentPolicyBasedServices - } - return json.Marshal(objectMap) -} - -// SecurityAdminConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SecurityAdminConfigurationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SecurityAdminConfigurationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SecurityAdminConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SecurityAdminConfigurationsDeleteFuture.Result. -func (future *SecurityAdminConfigurationsDeleteFuture) result(client SecurityAdminConfigurationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityAdminConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.SecurityAdminConfigurationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SecurityGroup networkSecurityGroup resource. -type SecurityGroup struct { - autorest.Response `json:"-"` - // SecurityGroupPropertiesFormat - Properties of the network security group. - *SecurityGroupPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SecurityGroup. -func (sg SecurityGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sg.SecurityGroupPropertiesFormat != nil { - objectMap["properties"] = sg.SecurityGroupPropertiesFormat - } - if sg.ID != nil { - objectMap["id"] = sg.ID - } - if sg.Location != nil { - objectMap["location"] = sg.Location - } - if sg.Tags != nil { - objectMap["tags"] = sg.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SecurityGroup struct. -func (sg *SecurityGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var securityGroupPropertiesFormat SecurityGroupPropertiesFormat - err = json.Unmarshal(*v, &securityGroupPropertiesFormat) - if err != nil { - return err - } - sg.SecurityGroupPropertiesFormat = &securityGroupPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sg.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sg.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sg.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sg.Tags = tags - } - } - } - - return nil -} - -// SecurityGroupListResult response for ListNetworkSecurityGroups API service call. -type SecurityGroupListResult struct { - autorest.Response `json:"-"` - // Value - A list of NetworkSecurityGroup resources. - Value *[]SecurityGroup `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// SecurityGroupListResultIterator provides access to a complete listing of SecurityGroup values. -type SecurityGroupListResultIterator struct { - i int - page SecurityGroupListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SecurityGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SecurityGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SecurityGroupListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SecurityGroupListResultIterator) Response() SecurityGroupListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SecurityGroupListResultIterator) Value() SecurityGroup { - if !iter.page.NotDone() { - return SecurityGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SecurityGroupListResultIterator type. -func NewSecurityGroupListResultIterator(page SecurityGroupListResultPage) SecurityGroupListResultIterator { - return SecurityGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sglr SecurityGroupListResult) IsEmpty() bool { - return sglr.Value == nil || len(*sglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sglr SecurityGroupListResult) hasNextLink() bool { - return sglr.NextLink != nil && len(*sglr.NextLink) != 0 -} - -// securityGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sglr SecurityGroupListResult) securityGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sglr.NextLink))) -} - -// SecurityGroupListResultPage contains a page of SecurityGroup values. -type SecurityGroupListResultPage struct { - fn func(context.Context, SecurityGroupListResult) (SecurityGroupListResult, error) - sglr SecurityGroupListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SecurityGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sglr) - if err != nil { - return err - } - page.sglr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SecurityGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SecurityGroupListResultPage) NotDone() bool { - return !page.sglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SecurityGroupListResultPage) Response() SecurityGroupListResult { - return page.sglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SecurityGroupListResultPage) Values() []SecurityGroup { - if page.sglr.IsEmpty() { - return nil - } - return *page.sglr.Value -} - -// Creates a new instance of the SecurityGroupListResultPage type. -func NewSecurityGroupListResultPage(cur SecurityGroupListResult, getNextPage func(context.Context, SecurityGroupListResult) (SecurityGroupListResult, error)) SecurityGroupListResultPage { - return SecurityGroupListResultPage{ - fn: getNextPage, - sglr: cur, - } -} - -// SecurityGroupNetworkInterface network interface and all its associated security rules. -type SecurityGroupNetworkInterface struct { - // ID - ID of the network interface. - ID *string `json:"id,omitempty"` - // SecurityRuleAssociations - All security rules associated with the network interface. - SecurityRuleAssociations *SecurityRuleAssociations `json:"securityRuleAssociations,omitempty"` -} - -// SecurityGroupPropertiesFormat network Security Group resource. -type SecurityGroupPropertiesFormat struct { - // FlushConnection - When enabled, flows created from Network Security Group connections will be re-evaluated when rules are updates. Initial enablement will trigger re-evaluation. - FlushConnection *bool `json:"flushConnection,omitempty"` - // SecurityRules - A collection of security rules of the network security group. - SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` - // DefaultSecurityRules - READ-ONLY; The default security rules of network security group. - DefaultSecurityRules *[]SecurityRule `json:"defaultSecurityRules,omitempty"` - // NetworkInterfaces - READ-ONLY; A collection of references to network interfaces. - NetworkInterfaces *[]Interface `json:"networkInterfaces,omitempty"` - // Subnets - READ-ONLY; A collection of references to subnets. - Subnets *[]Subnet `json:"subnets,omitempty"` - // FlowLogs - READ-ONLY; A collection of references to flow log resources. - FlowLogs *[]FlowLog `json:"flowLogs,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the network security group resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the network security group resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for SecurityGroupPropertiesFormat. -func (sgpf SecurityGroupPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sgpf.FlushConnection != nil { - objectMap["flushConnection"] = sgpf.FlushConnection - } - if sgpf.SecurityRules != nil { - objectMap["securityRules"] = sgpf.SecurityRules - } - return json.Marshal(objectMap) -} - -// SecurityGroupResult network configuration diagnostic result corresponded provided traffic query. -type SecurityGroupResult struct { - // SecurityRuleAccessResult - The network traffic is allowed or denied. Possible values include: 'SecurityRuleAccessAllow', 'SecurityRuleAccessDeny' - SecurityRuleAccessResult SecurityRuleAccess `json:"securityRuleAccessResult,omitempty"` - // EvaluatedNetworkSecurityGroups - READ-ONLY; List of results network security groups diagnostic. - EvaluatedNetworkSecurityGroups *[]EvaluatedNetworkSecurityGroup `json:"evaluatedNetworkSecurityGroups,omitempty"` -} - -// MarshalJSON is the custom marshaler for SecurityGroupResult. -func (sgr SecurityGroupResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sgr.SecurityRuleAccessResult != "" { - objectMap["securityRuleAccessResult"] = sgr.SecurityRuleAccessResult - } - return json.Marshal(objectMap) -} - -// SecurityGroupViewParameters parameters that define the VM to check security groups for. -type SecurityGroupViewParameters struct { - // TargetResourceID - ID of the target VM. - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// SecurityGroupViewResult the information about security rules applied to the specified VM. -type SecurityGroupViewResult struct { - autorest.Response `json:"-"` - // NetworkInterfaces - List of network interfaces on the specified VM. - NetworkInterfaces *[]SecurityGroupNetworkInterface `json:"networkInterfaces,omitempty"` -} - -// SecurityGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SecurityGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SecurityGroupsClient) (SecurityGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SecurityGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SecurityGroupsCreateOrUpdateFuture.Result. -func (future *SecurityGroupsCreateOrUpdateFuture) result(client SecurityGroupsClient) (sg SecurityGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.SecurityGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sg.Response.Response, err = future.GetResult(sender); err == nil && sg.Response.Response.StatusCode != http.StatusNoContent { - sg, err = client.CreateOrUpdateResponder(sg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", sg.Response.Response, "Failure responding to request") - } - } - return -} - -// SecurityGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SecurityGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SecurityGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SecurityGroupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SecurityGroupsDeleteFuture.Result. -func (future *SecurityGroupsDeleteFuture) result(client SecurityGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.SecurityGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SecurityPartnerProvider security Partner Provider resource. -type SecurityPartnerProvider struct { - autorest.Response `json:"-"` - // SecurityPartnerProviderPropertiesFormat - Properties of the Security Partner Provider. - *SecurityPartnerProviderPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SecurityPartnerProvider. -func (spp SecurityPartnerProvider) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spp.SecurityPartnerProviderPropertiesFormat != nil { - objectMap["properties"] = spp.SecurityPartnerProviderPropertiesFormat - } - if spp.ID != nil { - objectMap["id"] = spp.ID - } - if spp.Location != nil { - objectMap["location"] = spp.Location - } - if spp.Tags != nil { - objectMap["tags"] = spp.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SecurityPartnerProvider struct. -func (spp *SecurityPartnerProvider) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var securityPartnerProviderPropertiesFormat SecurityPartnerProviderPropertiesFormat - err = json.Unmarshal(*v, &securityPartnerProviderPropertiesFormat) - if err != nil { - return err - } - spp.SecurityPartnerProviderPropertiesFormat = &securityPartnerProviderPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - spp.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spp.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - spp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - spp.Tags = tags - } - } - } - - return nil -} - -// SecurityPartnerProviderListResult response for ListSecurityPartnerProviders API service call. -type SecurityPartnerProviderListResult struct { - autorest.Response `json:"-"` - // Value - List of Security Partner Providers in a resource group. - Value *[]SecurityPartnerProvider `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// SecurityPartnerProviderListResultIterator provides access to a complete listing of -// SecurityPartnerProvider values. -type SecurityPartnerProviderListResultIterator struct { - i int - page SecurityPartnerProviderListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SecurityPartnerProviderListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPartnerProviderListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SecurityPartnerProviderListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SecurityPartnerProviderListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SecurityPartnerProviderListResultIterator) Response() SecurityPartnerProviderListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SecurityPartnerProviderListResultIterator) Value() SecurityPartnerProvider { - if !iter.page.NotDone() { - return SecurityPartnerProvider{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SecurityPartnerProviderListResultIterator type. -func NewSecurityPartnerProviderListResultIterator(page SecurityPartnerProviderListResultPage) SecurityPartnerProviderListResultIterator { - return SecurityPartnerProviderListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spplr SecurityPartnerProviderListResult) IsEmpty() bool { - return spplr.Value == nil || len(*spplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spplr SecurityPartnerProviderListResult) hasNextLink() bool { - return spplr.NextLink != nil && len(*spplr.NextLink) != 0 -} - -// securityPartnerProviderListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spplr SecurityPartnerProviderListResult) securityPartnerProviderListResultPreparer(ctx context.Context) (*http.Request, error) { - if !spplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spplr.NextLink))) -} - -// SecurityPartnerProviderListResultPage contains a page of SecurityPartnerProvider values. -type SecurityPartnerProviderListResultPage struct { - fn func(context.Context, SecurityPartnerProviderListResult) (SecurityPartnerProviderListResult, error) - spplr SecurityPartnerProviderListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SecurityPartnerProviderListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPartnerProviderListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.spplr) - if err != nil { - return err - } - page.spplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SecurityPartnerProviderListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SecurityPartnerProviderListResultPage) NotDone() bool { - return !page.spplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SecurityPartnerProviderListResultPage) Response() SecurityPartnerProviderListResult { - return page.spplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SecurityPartnerProviderListResultPage) Values() []SecurityPartnerProvider { - if page.spplr.IsEmpty() { - return nil - } - return *page.spplr.Value -} - -// Creates a new instance of the SecurityPartnerProviderListResultPage type. -func NewSecurityPartnerProviderListResultPage(cur SecurityPartnerProviderListResult, getNextPage func(context.Context, SecurityPartnerProviderListResult) (SecurityPartnerProviderListResult, error)) SecurityPartnerProviderListResultPage { - return SecurityPartnerProviderListResultPage{ - fn: getNextPage, - spplr: cur, - } -} - -// SecurityPartnerProviderPropertiesFormat properties of the Security Partner Provider. -type SecurityPartnerProviderPropertiesFormat struct { - // ProvisioningState - READ-ONLY; The provisioning state of the Security Partner Provider resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // SecurityProviderName - The security provider name. Possible values include: 'SecurityProviderNameZScaler', 'SecurityProviderNameIBoss', 'SecurityProviderNameCheckpoint' - SecurityProviderName SecurityProviderName `json:"securityProviderName,omitempty"` - // ConnectionStatus - READ-ONLY; The connection status with the Security Partner Provider. Possible values include: 'SecurityPartnerProviderConnectionStatusUnknown', 'SecurityPartnerProviderConnectionStatusPartiallyConnected', 'SecurityPartnerProviderConnectionStatusConnected', 'SecurityPartnerProviderConnectionStatusNotConnected' - ConnectionStatus SecurityPartnerProviderConnectionStatus `json:"connectionStatus,omitempty"` - // VirtualHub - The virtualHub to which the Security Partner Provider belongs. - VirtualHub *SubResource `json:"virtualHub,omitempty"` -} - -// MarshalJSON is the custom marshaler for SecurityPartnerProviderPropertiesFormat. -func (spppf SecurityPartnerProviderPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spppf.SecurityProviderName != "" { - objectMap["securityProviderName"] = spppf.SecurityProviderName - } - if spppf.VirtualHub != nil { - objectMap["virtualHub"] = spppf.VirtualHub - } - return json.Marshal(objectMap) -} - -// SecurityPartnerProvidersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type SecurityPartnerProvidersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SecurityPartnerProvidersClient) (SecurityPartnerProvider, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SecurityPartnerProvidersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SecurityPartnerProvidersCreateOrUpdateFuture.Result. -func (future *SecurityPartnerProvidersCreateOrUpdateFuture) result(client SecurityPartnerProvidersClient) (spp SecurityPartnerProvider, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - spp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.SecurityPartnerProvidersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if spp.Response.Response, err = future.GetResult(sender); err == nil && spp.Response.Response.StatusCode != http.StatusNoContent { - spp, err = client.CreateOrUpdateResponder(spp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersCreateOrUpdateFuture", "Result", spp.Response.Response, "Failure responding to request") - } - } - return -} - -// SecurityPartnerProvidersDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SecurityPartnerProvidersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SecurityPartnerProvidersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SecurityPartnerProvidersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SecurityPartnerProvidersDeleteFuture.Result. -func (future *SecurityPartnerProvidersDeleteFuture) result(client SecurityPartnerProvidersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.SecurityPartnerProvidersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SecurityRule network security rule. -type SecurityRule struct { - autorest.Response `json:"-"` - // SecurityRulePropertiesFormat - Properties of the security rule. - *SecurityRulePropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - The type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for SecurityRule. -func (sr SecurityRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.SecurityRulePropertiesFormat != nil { - objectMap["properties"] = sr.SecurityRulePropertiesFormat - } - if sr.Name != nil { - objectMap["name"] = sr.Name - } - if sr.Type != nil { - objectMap["type"] = sr.Type - } - if sr.ID != nil { - objectMap["id"] = sr.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SecurityRule struct. -func (sr *SecurityRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var securityRulePropertiesFormat SecurityRulePropertiesFormat - err = json.Unmarshal(*v, &securityRulePropertiesFormat) - if err != nil { - return err - } - sr.SecurityRulePropertiesFormat = &securityRulePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sr.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sr.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sr.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sr.ID = &ID - } - } - } - - return nil -} - -// SecurityRuleAssociations all security rules associated with the network interface. -type SecurityRuleAssociations struct { - // NetworkInterfaceAssociation - Network interface and it's custom security rules. - NetworkInterfaceAssociation *InterfaceAssociation `json:"networkInterfaceAssociation,omitempty"` - // SubnetAssociation - Subnet and it's custom security rules. - SubnetAssociation *SubnetAssociation `json:"subnetAssociation,omitempty"` - // DefaultSecurityRules - Collection of default security rules of the network security group. - DefaultSecurityRules *[]SecurityRule `json:"defaultSecurityRules,omitempty"` - // EffectiveSecurityRules - Collection of effective security rules. - EffectiveSecurityRules *[]EffectiveNetworkSecurityRule `json:"effectiveSecurityRules,omitempty"` -} - -// SecurityRuleListResult response for ListSecurityRule API service call. Retrieves all security rules that -// belongs to a network security group. -type SecurityRuleListResult struct { - autorest.Response `json:"-"` - // Value - The security rules in a network security group. - Value *[]SecurityRule `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// SecurityRuleListResultIterator provides access to a complete listing of SecurityRule values. -type SecurityRuleListResultIterator struct { - i int - page SecurityRuleListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SecurityRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecurityRuleListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SecurityRuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SecurityRuleListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SecurityRuleListResultIterator) Response() SecurityRuleListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SecurityRuleListResultIterator) Value() SecurityRule { - if !iter.page.NotDone() { - return SecurityRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SecurityRuleListResultIterator type. -func NewSecurityRuleListResultIterator(page SecurityRuleListResultPage) SecurityRuleListResultIterator { - return SecurityRuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (srlr SecurityRuleListResult) IsEmpty() bool { - return srlr.Value == nil || len(*srlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (srlr SecurityRuleListResult) hasNextLink() bool { - return srlr.NextLink != nil && len(*srlr.NextLink) != 0 -} - -// securityRuleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (srlr SecurityRuleListResult) securityRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !srlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(srlr.NextLink))) -} - -// SecurityRuleListResultPage contains a page of SecurityRule values. -type SecurityRuleListResultPage struct { - fn func(context.Context, SecurityRuleListResult) (SecurityRuleListResult, error) - srlr SecurityRuleListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SecurityRuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SecurityRuleListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.srlr) - if err != nil { - return err - } - page.srlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SecurityRuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SecurityRuleListResultPage) NotDone() bool { - return !page.srlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SecurityRuleListResultPage) Response() SecurityRuleListResult { - return page.srlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SecurityRuleListResultPage) Values() []SecurityRule { - if page.srlr.IsEmpty() { - return nil - } - return *page.srlr.Value -} - -// Creates a new instance of the SecurityRuleListResultPage type. -func NewSecurityRuleListResultPage(cur SecurityRuleListResult, getNextPage func(context.Context, SecurityRuleListResult) (SecurityRuleListResult, error)) SecurityRuleListResultPage { - return SecurityRuleListResultPage{ - fn: getNextPage, - srlr: cur, - } -} - -// SecurityRulePropertiesFormat security rule resource. -type SecurityRulePropertiesFormat struct { - // Description - A description for this rule. Restricted to 140 chars. - Description *string `json:"description,omitempty"` - // Protocol - Network protocol this rule applies to. Possible values include: 'SecurityRuleProtocolTCP', 'SecurityRuleProtocolUDP', 'SecurityRuleProtocolIcmp', 'SecurityRuleProtocolEsp', 'SecurityRuleProtocolAsterisk', 'SecurityRuleProtocolAh' - Protocol SecurityRuleProtocol `json:"protocol,omitempty"` - // SourcePortRange - The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. - SourcePortRange *string `json:"sourcePortRange,omitempty"` - // DestinationPortRange - The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. - DestinationPortRange *string `json:"destinationPortRange,omitempty"` - // SourceAddressPrefix - 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. - SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` - // SourceAddressPrefixes - The CIDR or source IP ranges. - SourceAddressPrefixes *[]string `json:"sourceAddressPrefixes,omitempty"` - // SourceApplicationSecurityGroups - The application security group specified as source. - SourceApplicationSecurityGroups *[]ApplicationSecurityGroup `json:"sourceApplicationSecurityGroups,omitempty"` - // DestinationAddressPrefix - 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. - DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` - // DestinationAddressPrefixes - The destination address prefixes. CIDR or destination IP ranges. - DestinationAddressPrefixes *[]string `json:"destinationAddressPrefixes,omitempty"` - // DestinationApplicationSecurityGroups - The application security group specified as destination. - DestinationApplicationSecurityGroups *[]ApplicationSecurityGroup `json:"destinationApplicationSecurityGroups,omitempty"` - // SourcePortRanges - The source port ranges. - SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` - // DestinationPortRanges - The destination port ranges. - DestinationPortRanges *[]string `json:"destinationPortRanges,omitempty"` - // Access - The network traffic is allowed or denied. Possible values include: 'SecurityRuleAccessAllow', 'SecurityRuleAccessDeny' - Access SecurityRuleAccess `json:"access,omitempty"` - // Priority - 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. - Priority *int32 `json:"priority,omitempty"` - // Direction - The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values include: 'SecurityRuleDirectionInbound', 'SecurityRuleDirectionOutbound' - Direction SecurityRuleDirection `json:"direction,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the security rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for SecurityRulePropertiesFormat. -func (srpf SecurityRulePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if srpf.Description != nil { - objectMap["description"] = srpf.Description - } - if srpf.Protocol != "" { - objectMap["protocol"] = srpf.Protocol - } - if srpf.SourcePortRange != nil { - objectMap["sourcePortRange"] = srpf.SourcePortRange - } - if srpf.DestinationPortRange != nil { - objectMap["destinationPortRange"] = srpf.DestinationPortRange - } - if srpf.SourceAddressPrefix != nil { - objectMap["sourceAddressPrefix"] = srpf.SourceAddressPrefix - } - if srpf.SourceAddressPrefixes != nil { - objectMap["sourceAddressPrefixes"] = srpf.SourceAddressPrefixes - } - if srpf.SourceApplicationSecurityGroups != nil { - objectMap["sourceApplicationSecurityGroups"] = srpf.SourceApplicationSecurityGroups - } - if srpf.DestinationAddressPrefix != nil { - objectMap["destinationAddressPrefix"] = srpf.DestinationAddressPrefix - } - if srpf.DestinationAddressPrefixes != nil { - objectMap["destinationAddressPrefixes"] = srpf.DestinationAddressPrefixes - } - if srpf.DestinationApplicationSecurityGroups != nil { - objectMap["destinationApplicationSecurityGroups"] = srpf.DestinationApplicationSecurityGroups - } - if srpf.SourcePortRanges != nil { - objectMap["sourcePortRanges"] = srpf.SourcePortRanges - } - if srpf.DestinationPortRanges != nil { - objectMap["destinationPortRanges"] = srpf.DestinationPortRanges - } - if srpf.Access != "" { - objectMap["access"] = srpf.Access - } - if srpf.Priority != nil { - objectMap["priority"] = srpf.Priority - } - if srpf.Direction != "" { - objectMap["direction"] = srpf.Direction - } - return json.Marshal(objectMap) -} - -// SecurityRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SecurityRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SecurityRulesClient) (SecurityRule, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SecurityRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SecurityRulesCreateOrUpdateFuture.Result. -func (future *SecurityRulesCreateOrUpdateFuture) result(client SecurityRulesClient) (sr SecurityRule, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.SecurityRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.CreateOrUpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// SecurityRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SecurityRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SecurityRulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SecurityRulesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SecurityRulesDeleteFuture.Result. -func (future *SecurityRulesDeleteFuture) result(client SecurityRulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.SecurityRulesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SecurityRulesEvaluationResult network security rules evaluation result. -type SecurityRulesEvaluationResult struct { - // Name - Name of the network security rule. - Name *string `json:"name,omitempty"` - // ProtocolMatched - Value indicating whether protocol is matched. - ProtocolMatched *bool `json:"protocolMatched,omitempty"` - // SourceMatched - Value indicating whether source is matched. - SourceMatched *bool `json:"sourceMatched,omitempty"` - // SourcePortMatched - Value indicating whether source port is matched. - SourcePortMatched *bool `json:"sourcePortMatched,omitempty"` - // DestinationMatched - Value indicating whether destination is matched. - DestinationMatched *bool `json:"destinationMatched,omitempty"` - // DestinationPortMatched - Value indicating whether destination port is matched. - DestinationPortMatched *bool `json:"destinationPortMatched,omitempty"` -} - -// ServiceAssociationLink serviceAssociationLink resource. -type ServiceAssociationLink struct { - // ServiceAssociationLinkPropertiesFormat - Resource navigation link properties format. - *ServiceAssociationLinkPropertiesFormat `json:"properties,omitempty"` - // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceAssociationLink. -func (sal ServiceAssociationLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sal.ServiceAssociationLinkPropertiesFormat != nil { - objectMap["properties"] = sal.ServiceAssociationLinkPropertiesFormat - } - if sal.Name != nil { - objectMap["name"] = sal.Name - } - if sal.ID != nil { - objectMap["id"] = sal.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceAssociationLink struct. -func (sal *ServiceAssociationLink) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var serviceAssociationLinkPropertiesFormat ServiceAssociationLinkPropertiesFormat - err = json.Unmarshal(*v, &serviceAssociationLinkPropertiesFormat) - if err != nil { - return err - } - sal.ServiceAssociationLinkPropertiesFormat = &serviceAssociationLinkPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sal.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sal.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sal.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sal.ID = &ID - } - } - } - - return nil -} - -// ServiceAssociationLinkPropertiesFormat properties of ServiceAssociationLink. -type ServiceAssociationLinkPropertiesFormat struct { - // LinkedResourceType - Resource type of the linked resource. - LinkedResourceType *string `json:"linkedResourceType,omitempty"` - // Link - Link to the external resource. - Link *string `json:"link,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the service association link resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // AllowDelete - If true, the resource can be deleted. - AllowDelete *bool `json:"allowDelete,omitempty"` - // Locations - A list of locations. - Locations *[]string `json:"locations,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceAssociationLinkPropertiesFormat. -func (salpf ServiceAssociationLinkPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if salpf.LinkedResourceType != nil { - objectMap["linkedResourceType"] = salpf.LinkedResourceType - } - if salpf.Link != nil { - objectMap["link"] = salpf.Link - } - if salpf.AllowDelete != nil { - objectMap["allowDelete"] = salpf.AllowDelete - } - if salpf.Locations != nil { - objectMap["locations"] = salpf.Locations - } - return json.Marshal(objectMap) -} - -// ServiceAssociationLinksListResult response for ServiceAssociationLinks_List operation. -type ServiceAssociationLinksListResult struct { - autorest.Response `json:"-"` - // Value - The service association links in a subnet. - Value *[]ServiceAssociationLink `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceAssociationLinksListResult. -func (sallr ServiceAssociationLinksListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sallr.Value != nil { - objectMap["value"] = sallr.Value - } - return json.Marshal(objectMap) -} - -// ServiceDelegationPropertiesFormat properties of a service delegation. -type ServiceDelegationPropertiesFormat struct { - // ServiceName - The name of the service to whom the subnet should be delegated (e.g. Microsoft.Sql/servers). - ServiceName *string `json:"serviceName,omitempty"` - // Actions - READ-ONLY; The actions permitted to the service upon delegation. - Actions *[]string `json:"actions,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the service delegation resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceDelegationPropertiesFormat. -func (sdpf ServiceDelegationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sdpf.ServiceName != nil { - objectMap["serviceName"] = sdpf.ServiceName - } - return json.Marshal(objectMap) -} - -// ServiceEndpointPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type ServiceEndpointPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceEndpointPoliciesClient) (ServiceEndpointPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceEndpointPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceEndpointPoliciesCreateOrUpdateFuture.Result. -func (future *ServiceEndpointPoliciesCreateOrUpdateFuture) result(client ServiceEndpointPoliciesClient) (sep ServiceEndpointPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ServiceEndpointPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sep.Response.Response, err = future.GetResult(sender); err == nil && sep.Response.Response.StatusCode != http.StatusNoContent { - sep, err = client.CreateOrUpdateResponder(sep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesCreateOrUpdateFuture", "Result", sep.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceEndpointPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServiceEndpointPoliciesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceEndpointPoliciesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceEndpointPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceEndpointPoliciesDeleteFuture.Result. -func (future *ServiceEndpointPoliciesDeleteFuture) result(client ServiceEndpointPoliciesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ServiceEndpointPoliciesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServiceEndpointPolicy service End point policy resource. -type ServiceEndpointPolicy struct { - autorest.Response `json:"-"` - // ServiceEndpointPolicyPropertiesFormat - Properties of the service end point policy. - *ServiceEndpointPolicyPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Kind - READ-ONLY; Kind of service endpoint policy. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServiceEndpointPolicy. -func (sep ServiceEndpointPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sep.ServiceEndpointPolicyPropertiesFormat != nil { - objectMap["properties"] = sep.ServiceEndpointPolicyPropertiesFormat - } - if sep.ID != nil { - objectMap["id"] = sep.ID - } - if sep.Location != nil { - objectMap["location"] = sep.Location - } - if sep.Tags != nil { - objectMap["tags"] = sep.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceEndpointPolicy struct. -func (sep *ServiceEndpointPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var serviceEndpointPolicyPropertiesFormat ServiceEndpointPolicyPropertiesFormat - err = json.Unmarshal(*v, &serviceEndpointPolicyPropertiesFormat) - if err != nil { - return err - } - sep.ServiceEndpointPolicyPropertiesFormat = &serviceEndpointPolicyPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sep.Etag = &etag - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - sep.Kind = &kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sep.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sep.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sep.Tags = tags - } - } - } - - return nil -} - -// ServiceEndpointPolicyDefinition service Endpoint policy definitions. -type ServiceEndpointPolicyDefinition struct { - autorest.Response `json:"-"` - // ServiceEndpointPolicyDefinitionPropertiesFormat - Properties of the service endpoint policy definition. - *ServiceEndpointPolicyDefinitionPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - The type of the resource. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceEndpointPolicyDefinition. -func (sepd ServiceEndpointPolicyDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sepd.ServiceEndpointPolicyDefinitionPropertiesFormat != nil { - objectMap["properties"] = sepd.ServiceEndpointPolicyDefinitionPropertiesFormat - } - if sepd.Name != nil { - objectMap["name"] = sepd.Name - } - if sepd.Type != nil { - objectMap["type"] = sepd.Type - } - if sepd.ID != nil { - objectMap["id"] = sepd.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceEndpointPolicyDefinition struct. -func (sepd *ServiceEndpointPolicyDefinition) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var serviceEndpointPolicyDefinitionPropertiesFormat ServiceEndpointPolicyDefinitionPropertiesFormat - err = json.Unmarshal(*v, &serviceEndpointPolicyDefinitionPropertiesFormat) - if err != nil { - return err - } - sepd.ServiceEndpointPolicyDefinitionPropertiesFormat = &serviceEndpointPolicyDefinitionPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sepd.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sepd.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sepd.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sepd.ID = &ID - } - } - } - - return nil -} - -// ServiceEndpointPolicyDefinitionListResult response for ListServiceEndpointPolicyDefinition API service -// call. Retrieves all service endpoint policy definition that belongs to a service endpoint policy. -type ServiceEndpointPolicyDefinitionListResult struct { - autorest.Response `json:"-"` - // Value - The service endpoint policy definition in a service endpoint policy. - Value *[]ServiceEndpointPolicyDefinition `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ServiceEndpointPolicyDefinitionListResultIterator provides access to a complete listing of -// ServiceEndpointPolicyDefinition values. -type ServiceEndpointPolicyDefinitionListResultIterator struct { - i int - page ServiceEndpointPolicyDefinitionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServiceEndpointPolicyDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyDefinitionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServiceEndpointPolicyDefinitionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServiceEndpointPolicyDefinitionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServiceEndpointPolicyDefinitionListResultIterator) Response() ServiceEndpointPolicyDefinitionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServiceEndpointPolicyDefinitionListResultIterator) Value() ServiceEndpointPolicyDefinition { - if !iter.page.NotDone() { - return ServiceEndpointPolicyDefinition{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServiceEndpointPolicyDefinitionListResultIterator type. -func NewServiceEndpointPolicyDefinitionListResultIterator(page ServiceEndpointPolicyDefinitionListResultPage) ServiceEndpointPolicyDefinitionListResultIterator { - return ServiceEndpointPolicyDefinitionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sepdlr ServiceEndpointPolicyDefinitionListResult) IsEmpty() bool { - return sepdlr.Value == nil || len(*sepdlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sepdlr ServiceEndpointPolicyDefinitionListResult) hasNextLink() bool { - return sepdlr.NextLink != nil && len(*sepdlr.NextLink) != 0 -} - -// serviceEndpointPolicyDefinitionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sepdlr ServiceEndpointPolicyDefinitionListResult) serviceEndpointPolicyDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sepdlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sepdlr.NextLink))) -} - -// ServiceEndpointPolicyDefinitionListResultPage contains a page of ServiceEndpointPolicyDefinition values. -type ServiceEndpointPolicyDefinitionListResultPage struct { - fn func(context.Context, ServiceEndpointPolicyDefinitionListResult) (ServiceEndpointPolicyDefinitionListResult, error) - sepdlr ServiceEndpointPolicyDefinitionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServiceEndpointPolicyDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyDefinitionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sepdlr) - if err != nil { - return err - } - page.sepdlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServiceEndpointPolicyDefinitionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServiceEndpointPolicyDefinitionListResultPage) NotDone() bool { - return !page.sepdlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServiceEndpointPolicyDefinitionListResultPage) Response() ServiceEndpointPolicyDefinitionListResult { - return page.sepdlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServiceEndpointPolicyDefinitionListResultPage) Values() []ServiceEndpointPolicyDefinition { - if page.sepdlr.IsEmpty() { - return nil - } - return *page.sepdlr.Value -} - -// Creates a new instance of the ServiceEndpointPolicyDefinitionListResultPage type. -func NewServiceEndpointPolicyDefinitionListResultPage(cur ServiceEndpointPolicyDefinitionListResult, getNextPage func(context.Context, ServiceEndpointPolicyDefinitionListResult) (ServiceEndpointPolicyDefinitionListResult, error)) ServiceEndpointPolicyDefinitionListResultPage { - return ServiceEndpointPolicyDefinitionListResultPage{ - fn: getNextPage, - sepdlr: cur, - } -} - -// ServiceEndpointPolicyDefinitionPropertiesFormat service Endpoint policy definition resource. -type ServiceEndpointPolicyDefinitionPropertiesFormat struct { - // Description - A description for this rule. Restricted to 140 chars. - Description *string `json:"description,omitempty"` - // Service - Service endpoint name. - Service *string `json:"service,omitempty"` - // ServiceResources - A list of service resources. - ServiceResources *[]string `json:"serviceResources,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the service endpoint policy definition resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceEndpointPolicyDefinitionPropertiesFormat. -func (sepdpf ServiceEndpointPolicyDefinitionPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sepdpf.Description != nil { - objectMap["description"] = sepdpf.Description - } - if sepdpf.Service != nil { - objectMap["service"] = sepdpf.Service - } - if sepdpf.ServiceResources != nil { - objectMap["serviceResources"] = sepdpf.ServiceResources - } - return json.Marshal(objectMap) -} - -// ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceEndpointPolicyDefinitionsClient) (ServiceEndpointPolicyDefinition, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture.Result. -func (future *ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture) result(client ServiceEndpointPolicyDefinitionsClient) (sepd ServiceEndpointPolicyDefinition, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sepd.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sepd.Response.Response, err = future.GetResult(sender); err == nil && sepd.Response.Response.StatusCode != http.StatusNoContent { - sepd, err = client.CreateOrUpdateResponder(sepd.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture", "Result", sepd.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceEndpointPolicyDefinitionsDeleteFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type ServiceEndpointPolicyDefinitionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceEndpointPolicyDefinitionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceEndpointPolicyDefinitionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceEndpointPolicyDefinitionsDeleteFuture.Result. -func (future *ServiceEndpointPolicyDefinitionsDeleteFuture) result(client ServiceEndpointPolicyDefinitionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.ServiceEndpointPolicyDefinitionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServiceEndpointPolicyListResult response for ListServiceEndpointPolicies API service call. -type ServiceEndpointPolicyListResult struct { - autorest.Response `json:"-"` - // Value - A list of ServiceEndpointPolicy resources. - Value *[]ServiceEndpointPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceEndpointPolicyListResult. -func (seplr ServiceEndpointPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if seplr.Value != nil { - objectMap["value"] = seplr.Value - } - return json.Marshal(objectMap) -} - -// ServiceEndpointPolicyListResultIterator provides access to a complete listing of ServiceEndpointPolicy -// values. -type ServiceEndpointPolicyListResultIterator struct { - i int - page ServiceEndpointPolicyListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServiceEndpointPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServiceEndpointPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServiceEndpointPolicyListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServiceEndpointPolicyListResultIterator) Response() ServiceEndpointPolicyListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServiceEndpointPolicyListResultIterator) Value() ServiceEndpointPolicy { - if !iter.page.NotDone() { - return ServiceEndpointPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServiceEndpointPolicyListResultIterator type. -func NewServiceEndpointPolicyListResultIterator(page ServiceEndpointPolicyListResultPage) ServiceEndpointPolicyListResultIterator { - return ServiceEndpointPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (seplr ServiceEndpointPolicyListResult) IsEmpty() bool { - return seplr.Value == nil || len(*seplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (seplr ServiceEndpointPolicyListResult) hasNextLink() bool { - return seplr.NextLink != nil && len(*seplr.NextLink) != 0 -} - -// serviceEndpointPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (seplr ServiceEndpointPolicyListResult) serviceEndpointPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !seplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(seplr.NextLink))) -} - -// ServiceEndpointPolicyListResultPage contains a page of ServiceEndpointPolicy values. -type ServiceEndpointPolicyListResultPage struct { - fn func(context.Context, ServiceEndpointPolicyListResult) (ServiceEndpointPolicyListResult, error) - seplr ServiceEndpointPolicyListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServiceEndpointPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.seplr) - if err != nil { - return err - } - page.seplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServiceEndpointPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServiceEndpointPolicyListResultPage) NotDone() bool { - return !page.seplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServiceEndpointPolicyListResultPage) Response() ServiceEndpointPolicyListResult { - return page.seplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServiceEndpointPolicyListResultPage) Values() []ServiceEndpointPolicy { - if page.seplr.IsEmpty() { - return nil - } - return *page.seplr.Value -} - -// Creates a new instance of the ServiceEndpointPolicyListResultPage type. -func NewServiceEndpointPolicyListResultPage(cur ServiceEndpointPolicyListResult, getNextPage func(context.Context, ServiceEndpointPolicyListResult) (ServiceEndpointPolicyListResult, error)) ServiceEndpointPolicyListResultPage { - return ServiceEndpointPolicyListResultPage{ - fn: getNextPage, - seplr: cur, - } -} - -// ServiceEndpointPolicyPropertiesFormat service Endpoint Policy resource. -type ServiceEndpointPolicyPropertiesFormat struct { - // ServiceEndpointPolicyDefinitions - A collection of service endpoint policy definitions of the service endpoint policy. - ServiceEndpointPolicyDefinitions *[]ServiceEndpointPolicyDefinition `json:"serviceEndpointPolicyDefinitions,omitempty"` - // Subnets - READ-ONLY; A collection of references to subnets. - Subnets *[]Subnet `json:"subnets,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the service endpoint policy resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the service endpoint policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ServiceAlias - The alias indicating if the policy belongs to a service - ServiceAlias *string `json:"serviceAlias,omitempty"` - // ContextualServiceEndpointPolicies - A collection of contextual service endpoint policy. - ContextualServiceEndpointPolicies *[]string `json:"contextualServiceEndpointPolicies,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceEndpointPolicyPropertiesFormat. -func (seppf ServiceEndpointPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if seppf.ServiceEndpointPolicyDefinitions != nil { - objectMap["serviceEndpointPolicyDefinitions"] = seppf.ServiceEndpointPolicyDefinitions - } - if seppf.ServiceAlias != nil { - objectMap["serviceAlias"] = seppf.ServiceAlias - } - if seppf.ContextualServiceEndpointPolicies != nil { - objectMap["contextualServiceEndpointPolicies"] = seppf.ContextualServiceEndpointPolicies - } - return json.Marshal(objectMap) -} - -// ServiceEndpointPropertiesFormat the service endpoint properties. -type ServiceEndpointPropertiesFormat struct { - // Service - The type of the endpoint service. - Service *string `json:"service,omitempty"` - // Locations - A list of locations. - Locations *[]string `json:"locations,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the service endpoint resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceEndpointPropertiesFormat. -func (sepf ServiceEndpointPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sepf.Service != nil { - objectMap["service"] = sepf.Service - } - if sepf.Locations != nil { - objectMap["locations"] = sepf.Locations - } - return json.Marshal(objectMap) -} - -// ServiceTagInformation the service tag information. -type ServiceTagInformation struct { - // Properties - READ-ONLY; Properties of the service tag information. - Properties *ServiceTagInformationPropertiesFormat `json:"properties,omitempty"` - // Name - READ-ONLY; The name of service tag. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; The ID of service tag. - ID *string `json:"id,omitempty"` - // ServiceTagChangeNumber - READ-ONLY; The iteration number of service tag object for region. - ServiceTagChangeNumber *string `json:"serviceTagChangeNumber,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceTagInformation. -func (sti ServiceTagInformation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServiceTagInformationListResult response for Get ServiceTagInformation API service call. Retrieves the -// list of service tag information resources. -type ServiceTagInformationListResult struct { - autorest.Response `json:"-"` - // Value - The list of service tag information resources. - Value *[]ServiceTagInformation `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceTagInformationListResult. -func (stilr ServiceTagInformationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stilr.Value != nil { - objectMap["value"] = stilr.Value - } - return json.Marshal(objectMap) -} - -// ServiceTagInformationListResultIterator provides access to a complete listing of ServiceTagInformation -// values. -type ServiceTagInformationListResultIterator struct { - i int - page ServiceTagInformationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServiceTagInformationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceTagInformationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServiceTagInformationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServiceTagInformationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServiceTagInformationListResultIterator) Response() ServiceTagInformationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServiceTagInformationListResultIterator) Value() ServiceTagInformation { - if !iter.page.NotDone() { - return ServiceTagInformation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServiceTagInformationListResultIterator type. -func NewServiceTagInformationListResultIterator(page ServiceTagInformationListResultPage) ServiceTagInformationListResultIterator { - return ServiceTagInformationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (stilr ServiceTagInformationListResult) IsEmpty() bool { - return stilr.Value == nil || len(*stilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (stilr ServiceTagInformationListResult) hasNextLink() bool { - return stilr.NextLink != nil && len(*stilr.NextLink) != 0 -} - -// serviceTagInformationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (stilr ServiceTagInformationListResult) serviceTagInformationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !stilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(stilr.NextLink))) -} - -// ServiceTagInformationListResultPage contains a page of ServiceTagInformation values. -type ServiceTagInformationListResultPage struct { - fn func(context.Context, ServiceTagInformationListResult) (ServiceTagInformationListResult, error) - stilr ServiceTagInformationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServiceTagInformationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceTagInformationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.stilr) - if err != nil { - return err - } - page.stilr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServiceTagInformationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServiceTagInformationListResultPage) NotDone() bool { - return !page.stilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServiceTagInformationListResultPage) Response() ServiceTagInformationListResult { - return page.stilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServiceTagInformationListResultPage) Values() []ServiceTagInformation { - if page.stilr.IsEmpty() { - return nil - } - return *page.stilr.Value -} - -// Creates a new instance of the ServiceTagInformationListResultPage type. -func NewServiceTagInformationListResultPage(cur ServiceTagInformationListResult, getNextPage func(context.Context, ServiceTagInformationListResult) (ServiceTagInformationListResult, error)) ServiceTagInformationListResultPage { - return ServiceTagInformationListResultPage{ - fn: getNextPage, - stilr: cur, - } -} - -// ServiceTagInformationPropertiesFormat properties of the service tag information. -type ServiceTagInformationPropertiesFormat struct { - // ChangeNumber - READ-ONLY; The iteration number of service tag. - ChangeNumber *string `json:"changeNumber,omitempty"` - // Region - READ-ONLY; The region of service tag. - Region *string `json:"region,omitempty"` - // SystemService - READ-ONLY; The name of system service. - SystemService *string `json:"systemService,omitempty"` - // AddressPrefixes - READ-ONLY; The list of IP address prefixes. - AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` - // State - READ-ONLY; The state of the service tag. - State *string `json:"state,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceTagInformationPropertiesFormat. -func (stipf ServiceTagInformationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServiceTagsListResult response for the ListServiceTags API service call. -type ServiceTagsListResult struct { - autorest.Response `json:"-"` - // Name - READ-ONLY; The name of the cloud. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; The ID of the cloud. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; The azure resource type. - Type *string `json:"type,omitempty"` - // ChangeNumber - READ-ONLY; The iteration number. - ChangeNumber *string `json:"changeNumber,omitempty"` - // Cloud - READ-ONLY; The name of the cloud. - Cloud *string `json:"cloud,omitempty"` - // Values - READ-ONLY; The list of service tag information resources. - Values *[]ServiceTagInformation `json:"values,omitempty"` - // NextLink - READ-ONLY; The URL to get next page of service tag information resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceTagsListResult. -func (stlr ServiceTagsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SessionIds list of session IDs. -type SessionIds struct { - // SessionIds - List of session IDs. - SessionIds *[]string `json:"sessionIds,omitempty"` -} - -// SignatureOverridesFilterValuesQuery describes the filter values possibles for a given column -type SignatureOverridesFilterValuesQuery struct { - // FilterName - Describes the name of the column which values will be returned - FilterName *string `json:"filterName,omitempty"` -} - -// SignatureOverridesFilterValuesResponse describes the list of all possible values for a specific filter -// value -type SignatureOverridesFilterValuesResponse struct { - autorest.Response `json:"-"` - // FilterValues - Describes the possible values - FilterValues *[]string `json:"filterValues,omitempty"` -} - -// SignaturesOverrides contains all specific policy signatures overrides for the IDPS -type SignaturesOverrides struct { - autorest.Response `json:"-"` - // Name - Contains the name of the resource (default) - Name *string `json:"name,omitempty"` - // ID - Will contain the resource id of the signature override resource - ID *string `json:"id,omitempty"` - // Type - Will contain the type of the resource: Microsoft.Network/firewallPolicies/intrusionDetectionSignaturesOverrides - Type *string `json:"type,omitempty"` - // Properties - Will contain the properties of the resource (the actual signature overrides) - Properties *SignaturesOverridesProperties `json:"properties,omitempty"` -} - -// SignaturesOverridesList describes an object containing an array with a single item -type SignaturesOverridesList struct { - autorest.Response `json:"-"` - // Value - Describes a list consisting exactly one item describing the policy's signature override status - Value *[]SignaturesOverrides `json:"value,omitempty"` -} - -// SignaturesOverridesProperties will contain the properties of the resource (the actual signature -// overrides) -type SignaturesOverridesProperties struct { - Signatures map[string]*string `json:"signatures"` -} - -// MarshalJSON is the custom marshaler for SignaturesOverridesProperties. -func (so SignaturesOverridesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if so.Signatures != nil { - objectMap["signatures"] = so.Signatures - } - return json.Marshal(objectMap) -} - -// SingleQueryResult ... -type SingleQueryResult struct { - // SignatureID - The ID of the signature - SignatureID *int32 `json:"signatureId,omitempty"` - // Mode - The current mode enforced, 0 - Disabled, 1 - Alert, 2 -Deny - Mode *int32 `json:"mode,omitempty"` - // Severity - Describes the severity of signature: 1 - Low, 2 - Medium, 3 - High - Severity *int32 `json:"severity,omitempty"` - // Direction - Describes in which direction signature is being enforced: 0 - Inbound, 1 - OutBound, 2 - Bidirectional - Direction *int32 `json:"direction,omitempty"` - // Group - Describes the groups the signature belongs to - Group *string `json:"group,omitempty"` - // Description - Describes what is the signature enforces - Description *string `json:"description,omitempty"` - // Protocol - Describes the protocol the signatures is being enforced in - Protocol *string `json:"protocol,omitempty"` - // SourcePorts - Describes the list of source ports related to this signature - SourcePorts *[]string `json:"sourcePorts,omitempty"` - // DestinationPorts - Describes the list of destination ports related to this signature - DestinationPorts *[]string `json:"destinationPorts,omitempty"` - // LastUpdated - Describes the last updated time of the signature (provided from 3rd party vendor) - LastUpdated *string `json:"lastUpdated,omitempty"` - // InheritedFromParentPolicy - Describes if this override is inherited from base policy or not - InheritedFromParentPolicy *bool `json:"inheritedFromParentPolicy,omitempty"` -} - -// Sku the sku of this Bastion Host. -type Sku struct { - // Name - The name of this Bastion Host. Possible values include: 'BastionHostSkuNameBasic', 'BastionHostSkuNameStandard' - Name BastionHostSkuName `json:"name,omitempty"` -} - -// StaticMember staticMember Item. -type StaticMember struct { - autorest.Response `json:"-"` - // StaticMemberProperties - The Static Member properties - *StaticMemberProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata related to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for StaticMember. -func (sm StaticMember) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sm.StaticMemberProperties != nil { - objectMap["properties"] = sm.StaticMemberProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for StaticMember struct. -func (sm *StaticMember) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var staticMemberProperties StaticMemberProperties - err = json.Unmarshal(*v, &staticMemberProperties) - if err != nil { - return err - } - sm.StaticMemberProperties = &staticMemberProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sm.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sm.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sm.Etag = &etag - } - } - } - - return nil -} - -// StaticMemberListResult result of the request to list StaticMember. It contains a list of groups and a -// URL link to get the next set of results. -type StaticMemberListResult struct { - autorest.Response `json:"-"` - // Value - Gets a page of StaticMember - Value *[]StaticMember `json:"value,omitempty"` - // NextLink - Gets the URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// StaticMemberListResultIterator provides access to a complete listing of StaticMember values. -type StaticMemberListResultIterator struct { - i int - page StaticMemberListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *StaticMemberListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/StaticMemberListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *StaticMemberListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter StaticMemberListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter StaticMemberListResultIterator) Response() StaticMemberListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter StaticMemberListResultIterator) Value() StaticMember { - if !iter.page.NotDone() { - return StaticMember{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the StaticMemberListResultIterator type. -func NewStaticMemberListResultIterator(page StaticMemberListResultPage) StaticMemberListResultIterator { - return StaticMemberListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (smlr StaticMemberListResult) IsEmpty() bool { - return smlr.Value == nil || len(*smlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (smlr StaticMemberListResult) hasNextLink() bool { - return smlr.NextLink != nil && len(*smlr.NextLink) != 0 -} - -// staticMemberListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (smlr StaticMemberListResult) staticMemberListResultPreparer(ctx context.Context) (*http.Request, error) { - if !smlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(smlr.NextLink))) -} - -// StaticMemberListResultPage contains a page of StaticMember values. -type StaticMemberListResultPage struct { - fn func(context.Context, StaticMemberListResult) (StaticMemberListResult, error) - smlr StaticMemberListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *StaticMemberListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/StaticMemberListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.smlr) - if err != nil { - return err - } - page.smlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *StaticMemberListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page StaticMemberListResultPage) NotDone() bool { - return !page.smlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page StaticMemberListResultPage) Response() StaticMemberListResult { - return page.smlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page StaticMemberListResultPage) Values() []StaticMember { - if page.smlr.IsEmpty() { - return nil - } - return *page.smlr.Value -} - -// Creates a new instance of the StaticMemberListResultPage type. -func NewStaticMemberListResultPage(cur StaticMemberListResult, getNextPage func(context.Context, StaticMemberListResult) (StaticMemberListResult, error)) StaticMemberListResultPage { - return StaticMemberListResultPage{ - fn: getNextPage, - smlr: cur, - } -} - -// StaticMemberProperties properties of static member. -type StaticMemberProperties struct { - // ResourceID - Resource Id. - ResourceID *string `json:"resourceId,omitempty"` - // Region - READ-ONLY; Resource region. - Region *string `json:"region,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the scope assignment resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for StaticMemberProperties. -func (smp StaticMemberProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smp.ResourceID != nil { - objectMap["resourceId"] = smp.ResourceID - } - return json.Marshal(objectMap) -} - -// StaticRoute list of all Static Routes. -type StaticRoute struct { - // Name - The name of the StaticRoute that is unique within a VnetRoute. - Name *string `json:"name,omitempty"` - // AddressPrefixes - List of all address prefixes. - AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` - // NextHopIPAddress - The ip address of the next hop. - NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` -} - -// StaticRoutesConfig configuration for static routes on this HubVnetConnectionConfiguration for static -// routes on this HubVnetConnection. -type StaticRoutesConfig struct { - // PropagateStaticRoutes - READ-ONLY; Boolean indicating whether static routes on this connection are automatically propagate to route tables which this connection propagates to. - PropagateStaticRoutes *bool `json:"propagateStaticRoutes,omitempty"` - // VnetLocalRouteOverrideCriteria - Parameter determining whether NVA in spoke vnet is bypassed for traffic with destination in spoke. Possible values include: 'VnetLocalRouteOverrideCriteriaContains', 'VnetLocalRouteOverrideCriteriaEqual' - VnetLocalRouteOverrideCriteria VnetLocalRouteOverrideCriteria `json:"vnetLocalRouteOverrideCriteria,omitempty"` -} - -// MarshalJSON is the custom marshaler for StaticRoutesConfig. -func (src StaticRoutesConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if src.VnetLocalRouteOverrideCriteria != "" { - objectMap["vnetLocalRouteOverrideCriteria"] = src.VnetLocalRouteOverrideCriteria - } - return json.Marshal(objectMap) -} - -// String ... -type String struct { - autorest.Response `json:"-"` - Value *string `json:"value,omitempty"` -} - -// SubResource reference to another subresource. -type SubResource struct { - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// Subnet subnet in a virtual network resource. -type Subnet struct { - autorest.Response `json:"-"` - // SubnetPropertiesFormat - Properties of the subnet. - *SubnetPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for Subnet. -func (s Subnet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.SubnetPropertiesFormat != nil { - objectMap["properties"] = s.SubnetPropertiesFormat - } - if s.Name != nil { - objectMap["name"] = s.Name - } - if s.Type != nil { - objectMap["type"] = s.Type - } - if s.ID != nil { - objectMap["id"] = s.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Subnet struct. -func (s *Subnet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var subnetPropertiesFormat SubnetPropertiesFormat - err = json.Unmarshal(*v, &subnetPropertiesFormat) - if err != nil { - return err - } - s.SubnetPropertiesFormat = &subnetPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - s.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - s.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - s.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - s.ID = &ID - } - } - } - - return nil -} - -// SubnetAssociation subnet and it's custom security rules. -type SubnetAssociation struct { - // ID - READ-ONLY; Subnet ID. - ID *string `json:"id,omitempty"` - // SecurityRules - Collection of custom security rules. - SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubnetAssociation. -func (sa SubnetAssociation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sa.SecurityRules != nil { - objectMap["securityRules"] = sa.SecurityRules - } - return json.Marshal(objectMap) -} - -// SubnetListResult response for ListSubnets API service callRetrieves all subnet that belongs to a virtual -// network. -type SubnetListResult struct { - autorest.Response `json:"-"` - // Value - The subnets in a virtual network. - Value *[]Subnet `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// SubnetListResultIterator provides access to a complete listing of Subnet values. -type SubnetListResultIterator struct { - i int - page SubnetListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SubnetListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubnetListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SubnetListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SubnetListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SubnetListResultIterator) Response() SubnetListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SubnetListResultIterator) Value() Subnet { - if !iter.page.NotDone() { - return Subnet{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SubnetListResultIterator type. -func NewSubnetListResultIterator(page SubnetListResultPage) SubnetListResultIterator { - return SubnetListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (slr SubnetListResult) IsEmpty() bool { - return slr.Value == nil || len(*slr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (slr SubnetListResult) hasNextLink() bool { - return slr.NextLink != nil && len(*slr.NextLink) != 0 -} - -// subnetListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (slr SubnetListResult) subnetListResultPreparer(ctx context.Context) (*http.Request, error) { - if !slr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(slr.NextLink))) -} - -// SubnetListResultPage contains a page of Subnet values. -type SubnetListResultPage struct { - fn func(context.Context, SubnetListResult) (SubnetListResult, error) - slr SubnetListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SubnetListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubnetListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.slr) - if err != nil { - return err - } - page.slr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SubnetListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SubnetListResultPage) NotDone() bool { - return !page.slr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SubnetListResultPage) Response() SubnetListResult { - return page.slr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SubnetListResultPage) Values() []Subnet { - if page.slr.IsEmpty() { - return nil - } - return *page.slr.Value -} - -// Creates a new instance of the SubnetListResultPage type. -func NewSubnetListResultPage(cur SubnetListResult, getNextPage func(context.Context, SubnetListResult) (SubnetListResult, error)) SubnetListResultPage { - return SubnetListResultPage{ - fn: getNextPage, - slr: cur, - } -} - -// SubnetPropertiesFormat properties of the subnet. -type SubnetPropertiesFormat struct { - // AddressPrefix - The address prefix for the subnet. - AddressPrefix *string `json:"addressPrefix,omitempty"` - // AddressPrefixes - List of address prefixes for the subnet. - AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` - // NetworkSecurityGroup - The reference to the NetworkSecurityGroup resource. - NetworkSecurityGroup *SecurityGroup `json:"networkSecurityGroup,omitempty"` - // RouteTable - The reference to the RouteTable resource. - RouteTable *RouteTable `json:"routeTable,omitempty"` - // NatGateway - Nat gateway associated with this subnet. - NatGateway *SubResource `json:"natGateway,omitempty"` - // ServiceEndpoints - An array of service endpoints. - ServiceEndpoints *[]ServiceEndpointPropertiesFormat `json:"serviceEndpoints,omitempty"` - // ServiceEndpointPolicies - An array of service endpoint policies. - ServiceEndpointPolicies *[]ServiceEndpointPolicy `json:"serviceEndpointPolicies,omitempty"` - // PrivateEndpoints - READ-ONLY; An array of references to private endpoints. - PrivateEndpoints *[]PrivateEndpoint `json:"privateEndpoints,omitempty"` - // IPConfigurations - READ-ONLY; An array of references to the network interface IP configurations using subnet. - IPConfigurations *[]IPConfiguration `json:"ipConfigurations,omitempty"` - // IPConfigurationProfiles - READ-ONLY; Array of IP configuration profiles which reference this subnet. - IPConfigurationProfiles *[]IPConfigurationProfile `json:"ipConfigurationProfiles,omitempty"` - // IPAllocations - Array of IpAllocation which reference this subnet. - IPAllocations *[]SubResource `json:"ipAllocations,omitempty"` - // ResourceNavigationLinks - READ-ONLY; An array of references to the external resources using subnet. - ResourceNavigationLinks *[]ResourceNavigationLink `json:"resourceNavigationLinks,omitempty"` - // ServiceAssociationLinks - READ-ONLY; An array of references to services injecting into this subnet. - ServiceAssociationLinks *[]ServiceAssociationLink `json:"serviceAssociationLinks,omitempty"` - // Delegations - An array of references to the delegations on the subnet. - Delegations *[]Delegation `json:"delegations,omitempty"` - // Purpose - READ-ONLY; A read-only string identifying the intention of use for this subnet based on delegations and other user-defined properties. - Purpose *string `json:"purpose,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the subnet resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // PrivateEndpointNetworkPolicies - Enable or Disable apply network policies on private end point in the subnet. Possible values include: 'VirtualNetworkPrivateEndpointNetworkPoliciesEnabled', 'VirtualNetworkPrivateEndpointNetworkPoliciesDisabled' - PrivateEndpointNetworkPolicies VirtualNetworkPrivateEndpointNetworkPolicies `json:"privateEndpointNetworkPolicies,omitempty"` - // PrivateLinkServiceNetworkPolicies - Enable or Disable apply network policies on private link service in the subnet. Possible values include: 'VirtualNetworkPrivateLinkServiceNetworkPoliciesEnabled', 'VirtualNetworkPrivateLinkServiceNetworkPoliciesDisabled' - PrivateLinkServiceNetworkPolicies VirtualNetworkPrivateLinkServiceNetworkPolicies `json:"privateLinkServiceNetworkPolicies,omitempty"` - // ApplicationGatewayIPConfigurations - Application gateway IP configurations of virtual network resource. - ApplicationGatewayIPConfigurations *[]ApplicationGatewayIPConfiguration `json:"applicationGatewayIpConfigurations,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubnetPropertiesFormat. -func (spf SubnetPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spf.AddressPrefix != nil { - objectMap["addressPrefix"] = spf.AddressPrefix - } - if spf.AddressPrefixes != nil { - objectMap["addressPrefixes"] = spf.AddressPrefixes - } - if spf.NetworkSecurityGroup != nil { - objectMap["networkSecurityGroup"] = spf.NetworkSecurityGroup - } - if spf.RouteTable != nil { - objectMap["routeTable"] = spf.RouteTable - } - if spf.NatGateway != nil { - objectMap["natGateway"] = spf.NatGateway - } - if spf.ServiceEndpoints != nil { - objectMap["serviceEndpoints"] = spf.ServiceEndpoints - } - if spf.ServiceEndpointPolicies != nil { - objectMap["serviceEndpointPolicies"] = spf.ServiceEndpointPolicies - } - if spf.IPAllocations != nil { - objectMap["ipAllocations"] = spf.IPAllocations - } - if spf.Delegations != nil { - objectMap["delegations"] = spf.Delegations - } - if spf.PrivateEndpointNetworkPolicies != "" { - objectMap["privateEndpointNetworkPolicies"] = spf.PrivateEndpointNetworkPolicies - } - if spf.PrivateLinkServiceNetworkPolicies != "" { - objectMap["privateLinkServiceNetworkPolicies"] = spf.PrivateLinkServiceNetworkPolicies - } - if spf.ApplicationGatewayIPConfigurations != nil { - objectMap["applicationGatewayIpConfigurations"] = spf.ApplicationGatewayIPConfigurations - } - return json.Marshal(objectMap) -} - -// SubnetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SubnetsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SubnetsClient) (Subnet, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SubnetsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SubnetsCreateOrUpdateFuture.Result. -func (future *SubnetsCreateOrUpdateFuture) result(client SubnetsClient) (s Subnet, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.SubnetsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.CreateOrUpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// SubnetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SubnetsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SubnetsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SubnetsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SubnetsDeleteFuture.Result. -func (future *SubnetsDeleteFuture) result(client SubnetsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.SubnetsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SubnetsPrepareNetworkPoliciesFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SubnetsPrepareNetworkPoliciesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SubnetsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SubnetsPrepareNetworkPoliciesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SubnetsPrepareNetworkPoliciesFuture.Result. -func (future *SubnetsPrepareNetworkPoliciesFuture) result(client SubnetsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsPrepareNetworkPoliciesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.SubnetsPrepareNetworkPoliciesFuture") - return - } - ar.Response = future.Response() - return -} - -// SubnetsUnprepareNetworkPoliciesFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SubnetsUnprepareNetworkPoliciesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SubnetsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SubnetsUnprepareNetworkPoliciesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SubnetsUnprepareNetworkPoliciesFuture.Result. -func (future *SubnetsUnprepareNetworkPoliciesFuture) result(client SubnetsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsUnprepareNetworkPoliciesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.SubnetsUnprepareNetworkPoliciesFuture") - return - } - ar.Response = future.Response() - return -} - -// SwapResource swapResource to represent slot type on the specified cloud service. -type SwapResource struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Resource Id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - Properties *SwapResourceProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SwapResource. -func (sr SwapResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Properties != nil { - objectMap["properties"] = sr.Properties - } - return json.Marshal(objectMap) -} - -// SwapResourceListResult swapResource List with single entry to represent slot type on the specified cloud -// service. -type SwapResourceListResult struct { - autorest.Response `json:"-"` - Value *[]SwapResource `json:"value,omitempty"` -} - -// SwapResourceProperties swap resource properties -type SwapResourceProperties struct { - // SlotType - Specifies slot info on a cloud service. Possible values include: 'SlotTypeProduction', 'SlotTypeStaging' - SlotType SlotType `json:"slotType,omitempty"` -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The type of identity that last modified the resource. - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TagsObject tags object for patch operations. -type TagsObject struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TagsObject. -func (toVar TagsObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if toVar.Tags != nil { - objectMap["tags"] = toVar.Tags - } - return json.Marshal(objectMap) -} - -// Topology topology of the specified resource group. -type Topology struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; GUID representing the operation id. - ID *string `json:"id,omitempty"` - // CreatedDateTime - READ-ONLY; The datetime when the topology was initially created for the resource group. - CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` - // LastModified - READ-ONLY; The datetime when the topology was last modified. - LastModified *date.Time `json:"lastModified,omitempty"` - // Resources - A list of topology resources. - Resources *[]TopologyResource `json:"resources,omitempty"` -} - -// MarshalJSON is the custom marshaler for Topology. -func (t Topology) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.Resources != nil { - objectMap["resources"] = t.Resources - } - return json.Marshal(objectMap) -} - -// TopologyAssociation resources that have an association with the parent resource. -type TopologyAssociation struct { - // Name - The name of the resource that is associated with the parent resource. - Name *string `json:"name,omitempty"` - // ResourceID - The ID of the resource that is associated with the parent resource. - ResourceID *string `json:"resourceId,omitempty"` - // AssociationType - The association type of the child resource to the parent resource. Possible values include: 'AssociationTypeAssociated', 'AssociationTypeContains' - AssociationType AssociationType `json:"associationType,omitempty"` -} - -// TopologyParameters parameters that define the representation of topology. -type TopologyParameters struct { - // TargetResourceGroupName - The name of the target resource group to perform topology on. - TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` - // TargetVirtualNetwork - The reference to the Virtual Network resource. - TargetVirtualNetwork *SubResource `json:"targetVirtualNetwork,omitempty"` - // TargetSubnet - The reference to the Subnet resource. - TargetSubnet *SubResource `json:"targetSubnet,omitempty"` -} - -// TopologyResource the network resource topology information for the given resource group. -type TopologyResource struct { - // Name - Name of the resource. - Name *string `json:"name,omitempty"` - // ID - ID of the resource. - ID *string `json:"id,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Associations - Holds the associations the resource has with other resources in the resource group. - Associations *[]TopologyAssociation `json:"associations,omitempty"` -} - -// TrafficAnalyticsConfigurationProperties parameters that define the configuration of traffic analytics. -type TrafficAnalyticsConfigurationProperties struct { - // Enabled - Flag to enable/disable traffic analytics. - Enabled *bool `json:"enabled,omitempty"` - // WorkspaceID - The resource guid of the attached workspace. - WorkspaceID *string `json:"workspaceId,omitempty"` - // WorkspaceRegion - The location of the attached workspace. - WorkspaceRegion *string `json:"workspaceRegion,omitempty"` - // WorkspaceResourceID - Resource Id of the attached workspace. - WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` - // TrafficAnalyticsInterval - The interval in minutes which would decide how frequently TA service should do flow analytics. - TrafficAnalyticsInterval *int32 `json:"trafficAnalyticsInterval,omitempty"` -} - -// TrafficAnalyticsProperties parameters that define the configuration of traffic analytics. -type TrafficAnalyticsProperties struct { - // NetworkWatcherFlowAnalyticsConfiguration - Parameters that define the configuration of traffic analytics. - NetworkWatcherFlowAnalyticsConfiguration *TrafficAnalyticsConfigurationProperties `json:"networkWatcherFlowAnalyticsConfiguration,omitempty"` -} - -// TrafficSelectorPolicy an traffic selector policy for a virtual network gateway connection. -type TrafficSelectorPolicy struct { - // LocalAddressRanges - A collection of local address spaces in CIDR format. - LocalAddressRanges *[]string `json:"localAddressRanges,omitempty"` - // RemoteAddressRanges - A collection of remote address spaces in CIDR format. - RemoteAddressRanges *[]string `json:"remoteAddressRanges,omitempty"` -} - -// TroubleshootingDetails information gained from troubleshooting of specified resource. -type TroubleshootingDetails struct { - // ID - The id of the get troubleshoot operation. - ID *string `json:"id,omitempty"` - // ReasonType - Reason type of failure. - ReasonType *string `json:"reasonType,omitempty"` - // Summary - A summary of troubleshooting. - Summary *string `json:"summary,omitempty"` - // Detail - Details on troubleshooting results. - Detail *string `json:"detail,omitempty"` - // RecommendedActions - List of recommended actions. - RecommendedActions *[]TroubleshootingRecommendedActions `json:"recommendedActions,omitempty"` -} - -// TroubleshootingParameters parameters that define the resource to troubleshoot. -type TroubleshootingParameters struct { - // TargetResourceID - The target resource to troubleshoot. - TargetResourceID *string `json:"targetResourceId,omitempty"` - // TroubleshootingProperties - Properties of the troubleshooting resource. - *TroubleshootingProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for TroubleshootingParameters. -func (tp TroubleshootingParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tp.TargetResourceID != nil { - objectMap["targetResourceId"] = tp.TargetResourceID - } - if tp.TroubleshootingProperties != nil { - objectMap["properties"] = tp.TroubleshootingProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TroubleshootingParameters struct. -func (tp *TroubleshootingParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "targetResourceId": - if v != nil { - var targetResourceID string - err = json.Unmarshal(*v, &targetResourceID) - if err != nil { - return err - } - tp.TargetResourceID = &targetResourceID - } - case "properties": - if v != nil { - var troubleshootingProperties TroubleshootingProperties - err = json.Unmarshal(*v, &troubleshootingProperties) - if err != nil { - return err - } - tp.TroubleshootingProperties = &troubleshootingProperties - } - } - } - - return nil -} - -// TroubleshootingProperties storage location provided for troubleshoot. -type TroubleshootingProperties struct { - // StorageID - The ID for the storage account to save the troubleshoot result. - StorageID *string `json:"storageId,omitempty"` - // StoragePath - The path to the blob to save the troubleshoot result in. - StoragePath *string `json:"storagePath,omitempty"` -} - -// TroubleshootingRecommendedActions recommended actions based on discovered issues. -type TroubleshootingRecommendedActions struct { - // ActionID - ID of the recommended action. - ActionID *string `json:"actionId,omitempty"` - // ActionText - Description of recommended actions. - ActionText *string `json:"actionText,omitempty"` - // ActionURI - The uri linking to a documentation for the recommended troubleshooting actions. - ActionURI *string `json:"actionUri,omitempty"` - // ActionURIText - The information from the URI for the recommended troubleshooting actions. - ActionURIText *string `json:"actionUriText,omitempty"` -} - -// TroubleshootingResult troubleshooting information gained from specified resource. -type TroubleshootingResult struct { - autorest.Response `json:"-"` - // StartTime - The start time of the troubleshooting. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - The end time of the troubleshooting. - EndTime *date.Time `json:"endTime,omitempty"` - // Code - The result code of the troubleshooting. - Code *string `json:"code,omitempty"` - // Results - Information from troubleshooting. - Results *[]TroubleshootingDetails `json:"results,omitempty"` -} - -// TunnelConnectionHealth virtualNetworkGatewayConnection properties. -type TunnelConnectionHealth struct { - // Tunnel - READ-ONLY; Tunnel name. - Tunnel *string `json:"tunnel,omitempty"` - // ConnectionStatus - READ-ONLY; Virtual Network Gateway connection status. Possible values include: 'VirtualNetworkGatewayConnectionStatusUnknown', 'VirtualNetworkGatewayConnectionStatusConnecting', 'VirtualNetworkGatewayConnectionStatusConnected', 'VirtualNetworkGatewayConnectionStatusNotConnected' - ConnectionStatus VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty"` - // IngressBytesTransferred - READ-ONLY; The Ingress Bytes Transferred in this connection. - IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` - // EgressBytesTransferred - READ-ONLY; The Egress Bytes Transferred in this connection. - EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` - // LastConnectionEstablishedUtcTime - READ-ONLY; The time at which connection was established in Utc format. - LastConnectionEstablishedUtcTime *string `json:"lastConnectionEstablishedUtcTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for TunnelConnectionHealth. -func (tch TunnelConnectionHealth) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UnprepareNetworkPoliciesRequest details of UnprepareNetworkPolicies for Subnet. -type UnprepareNetworkPoliciesRequest struct { - // ServiceName - The name of the service for which subnet is being unprepared for. - ServiceName *string `json:"serviceName,omitempty"` -} - -// Usage the network resource usage. -type Usage struct { - // ID - READ-ONLY; Resource identifier. - ID *string `json:"id,omitempty"` - // Unit - An enum describing the unit of measurement. - Unit *string `json:"unit,omitempty"` - // CurrentValue - The current value of the usage. - CurrentValue *int64 `json:"currentValue,omitempty"` - // Limit - The limit of usage. - Limit *int64 `json:"limit,omitempty"` - // Name - The name of the type of usage. - Name *UsageName `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for Usage. -func (u Usage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if u.Unit != nil { - objectMap["unit"] = u.Unit - } - if u.CurrentValue != nil { - objectMap["currentValue"] = u.CurrentValue - } - if u.Limit != nil { - objectMap["limit"] = u.Limit - } - if u.Name != nil { - objectMap["name"] = u.Name - } - return json.Marshal(objectMap) -} - -// UsageName the usage names. -type UsageName struct { - // Value - A string describing the resource name. - Value *string `json:"value,omitempty"` - // LocalizedValue - A localized string describing the resource name. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// UsagesListResult the list usages operation response. -type UsagesListResult struct { - autorest.Response `json:"-"` - // Value - The list network resource usages. - Value *[]Usage `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// UsagesListResultIterator provides access to a complete listing of Usage values. -type UsagesListResultIterator struct { - i int - page UsagesListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *UsagesListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsagesListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *UsagesListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter UsagesListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter UsagesListResultIterator) Response() UsagesListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter UsagesListResultIterator) Value() Usage { - if !iter.page.NotDone() { - return Usage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the UsagesListResultIterator type. -func NewUsagesListResultIterator(page UsagesListResultPage) UsagesListResultIterator { - return UsagesListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ulr UsagesListResult) IsEmpty() bool { - return ulr.Value == nil || len(*ulr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ulr UsagesListResult) hasNextLink() bool { - return ulr.NextLink != nil && len(*ulr.NextLink) != 0 -} - -// usagesListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ulr UsagesListResult) usagesListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ulr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ulr.NextLink))) -} - -// UsagesListResultPage contains a page of Usage values. -type UsagesListResultPage struct { - fn func(context.Context, UsagesListResult) (UsagesListResult, error) - ulr UsagesListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *UsagesListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsagesListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ulr) - if err != nil { - return err - } - page.ulr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *UsagesListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page UsagesListResultPage) NotDone() bool { - return !page.ulr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page UsagesListResultPage) Response() UsagesListResult { - return page.ulr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page UsagesListResultPage) Values() []Usage { - if page.ulr.IsEmpty() { - return nil - } - return *page.ulr.Value -} - -// Creates a new instance of the UsagesListResultPage type. -func NewUsagesListResultPage(cur UsagesListResult, getNextPage func(context.Context, UsagesListResult) (UsagesListResult, error)) UsagesListResultPage { - return UsagesListResultPage{ - fn: getNextPage, - ulr: cur, - } -} - -// VM describes a Virtual Machine. -type VM struct { - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VM. -func (vVar VM) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vVar.ID != nil { - objectMap["id"] = vVar.ID - } - if vVar.Location != nil { - objectMap["location"] = vVar.Location - } - if vVar.Tags != nil { - objectMap["tags"] = vVar.Tags - } - return json.Marshal(objectMap) -} - -// VerificationIPFlowParameters parameters that define the IP flow to be verified. -type VerificationIPFlowParameters struct { - // TargetResourceID - The ID of the target resource to perform next-hop on. - TargetResourceID *string `json:"targetResourceId,omitempty"` - // Direction - The direction of the packet represented as a 5-tuple. Possible values include: 'DirectionInbound', 'DirectionOutbound' - Direction Direction `json:"direction,omitempty"` - // Protocol - Protocol to be verified on. Possible values include: 'IPFlowProtocolTCP', 'IPFlowProtocolUDP' - Protocol IPFlowProtocol `json:"protocol,omitempty"` - // LocalPort - 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. - LocalPort *string `json:"localPort,omitempty"` - // RemotePort - 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. - RemotePort *string `json:"remotePort,omitempty"` - // LocalIPAddress - The local IP address. Acceptable values are valid IPv4 addresses. - LocalIPAddress *string `json:"localIPAddress,omitempty"` - // RemoteIPAddress - The remote IP address. Acceptable values are valid IPv4 addresses. - RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` - // TargetNicResourceID - 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). - TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` -} - -// VerificationIPFlowResult results of IP flow verification on the target resource. -type VerificationIPFlowResult struct { - autorest.Response `json:"-"` - // Access - Indicates whether the traffic is allowed or denied. Possible values include: 'AccessAllow', 'AccessDeny' - Access Access `json:"access,omitempty"` - // RuleName - Name of the rule. If input is not matched against any security rule, it is not displayed. - RuleName *string `json:"ruleName,omitempty"` -} - -// VipSwapCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VipSwapCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VipSwapClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VipSwapCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VipSwapCreateFuture.Result. -func (future *VipSwapCreateFuture) result(client VipSwapClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VipSwapCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VipSwapCreateFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualAppliance networkVirtualAppliance Resource. -type VirtualAppliance struct { - autorest.Response `json:"-"` - // VirtualAppliancePropertiesFormat - Properties of the Network Virtual Appliance. - *VirtualAppliancePropertiesFormat `json:"properties,omitempty"` - // Identity - The service principal that has read access to cloud-init and config blob. - Identity *ManagedServiceIdentity `json:"identity,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VirtualAppliance. -func (va VirtualAppliance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if va.VirtualAppliancePropertiesFormat != nil { - objectMap["properties"] = va.VirtualAppliancePropertiesFormat - } - if va.Identity != nil { - objectMap["identity"] = va.Identity - } - if va.ID != nil { - objectMap["id"] = va.ID - } - if va.Location != nil { - objectMap["location"] = va.Location - } - if va.Tags != nil { - objectMap["tags"] = va.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualAppliance struct. -func (va *VirtualAppliance) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualAppliancePropertiesFormat VirtualAppliancePropertiesFormat - err = json.Unmarshal(*v, &virtualAppliancePropertiesFormat) - if err != nil { - return err - } - va.VirtualAppliancePropertiesFormat = &virtualAppliancePropertiesFormat - } - case "identity": - if v != nil { - var identity ManagedServiceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - va.Identity = &identity - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - va.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - va.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - va.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - va.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - va.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - va.Tags = tags - } - } - } - - return nil -} - -// VirtualApplianceListResult response for ListNetworkVirtualAppliances API service call. -type VirtualApplianceListResult struct { - autorest.Response `json:"-"` - // Value - List of Network Virtual Appliances. - Value *[]VirtualAppliance `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualApplianceListResultIterator provides access to a complete listing of VirtualAppliance values. -type VirtualApplianceListResultIterator struct { - i int - page VirtualApplianceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualApplianceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualApplianceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualApplianceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualApplianceListResultIterator) Response() VirtualApplianceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualApplianceListResultIterator) Value() VirtualAppliance { - if !iter.page.NotDone() { - return VirtualAppliance{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualApplianceListResultIterator type. -func NewVirtualApplianceListResultIterator(page VirtualApplianceListResultPage) VirtualApplianceListResultIterator { - return VirtualApplianceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (valr VirtualApplianceListResult) IsEmpty() bool { - return valr.Value == nil || len(*valr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (valr VirtualApplianceListResult) hasNextLink() bool { - return valr.NextLink != nil && len(*valr.NextLink) != 0 -} - -// virtualApplianceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (valr VirtualApplianceListResult) virtualApplianceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !valr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(valr.NextLink))) -} - -// VirtualApplianceListResultPage contains a page of VirtualAppliance values. -type VirtualApplianceListResultPage struct { - fn func(context.Context, VirtualApplianceListResult) (VirtualApplianceListResult, error) - valr VirtualApplianceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualApplianceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.valr) - if err != nil { - return err - } - page.valr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualApplianceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualApplianceListResultPage) NotDone() bool { - return !page.valr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualApplianceListResultPage) Response() VirtualApplianceListResult { - return page.valr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualApplianceListResultPage) Values() []VirtualAppliance { - if page.valr.IsEmpty() { - return nil - } - return *page.valr.Value -} - -// Creates a new instance of the VirtualApplianceListResultPage type. -func NewVirtualApplianceListResultPage(cur VirtualApplianceListResult, getNextPage func(context.Context, VirtualApplianceListResult) (VirtualApplianceListResult, error)) VirtualApplianceListResultPage { - return VirtualApplianceListResultPage{ - fn: getNextPage, - valr: cur, - } -} - -// VirtualApplianceNicProperties network Virtual Appliance NIC properties. -type VirtualApplianceNicProperties struct { - // Name - READ-ONLY; NIC name. - Name *string `json:"name,omitempty"` - // PublicIPAddress - READ-ONLY; Public IP address. - PublicIPAddress *string `json:"publicIpAddress,omitempty"` - // PrivateIPAddress - READ-ONLY; Private IP address. - PrivateIPAddress *string `json:"privateIpAddress,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualApplianceNicProperties. -func (vanp VirtualApplianceNicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualAppliancePropertiesFormat network Virtual Appliance definition. -type VirtualAppliancePropertiesFormat struct { - // NvaSku - Network Virtual Appliance SKU. - NvaSku *VirtualApplianceSkuProperties `json:"nvaSku,omitempty"` - // AddressPrefix - READ-ONLY; Address Prefix. - AddressPrefix *string `json:"addressPrefix,omitempty"` - // BootStrapConfigurationBlobs - BootStrapConfigurationBlobs storage URLs. - BootStrapConfigurationBlobs *[]string `json:"bootStrapConfigurationBlobs,omitempty"` - // VirtualHub - The Virtual Hub where Network Virtual Appliance is being deployed. - VirtualHub *SubResource `json:"virtualHub,omitempty"` - // CloudInitConfigurationBlobs - CloudInitConfigurationBlob storage URLs. - CloudInitConfigurationBlobs *[]string `json:"cloudInitConfigurationBlobs,omitempty"` - // CloudInitConfiguration - CloudInitConfiguration string in plain text. - CloudInitConfiguration *string `json:"cloudInitConfiguration,omitempty"` - // VirtualApplianceAsn - VirtualAppliance ASN. - VirtualApplianceAsn *int64 `json:"virtualApplianceAsn,omitempty"` - // SSHPublicKey - Public key for SSH login. - SSHPublicKey *string `json:"sshPublicKey,omitempty"` - // VirtualApplianceNics - READ-ONLY; List of Virtual Appliance Network Interfaces. - VirtualApplianceNics *[]VirtualApplianceNicProperties `json:"virtualApplianceNics,omitempty"` - // VirtualApplianceSites - READ-ONLY; List of references to VirtualApplianceSite. - VirtualApplianceSites *[]SubResource `json:"virtualApplianceSites,omitempty"` - // InboundSecurityRules - READ-ONLY; List of references to InboundSecurityRules. - InboundSecurityRules *[]SubResource `json:"inboundSecurityRules,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualAppliancePropertiesFormat. -func (vapf VirtualAppliancePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vapf.NvaSku != nil { - objectMap["nvaSku"] = vapf.NvaSku - } - if vapf.BootStrapConfigurationBlobs != nil { - objectMap["bootStrapConfigurationBlobs"] = vapf.BootStrapConfigurationBlobs - } - if vapf.VirtualHub != nil { - objectMap["virtualHub"] = vapf.VirtualHub - } - if vapf.CloudInitConfigurationBlobs != nil { - objectMap["cloudInitConfigurationBlobs"] = vapf.CloudInitConfigurationBlobs - } - if vapf.CloudInitConfiguration != nil { - objectMap["cloudInitConfiguration"] = vapf.CloudInitConfiguration - } - if vapf.VirtualApplianceAsn != nil { - objectMap["virtualApplianceAsn"] = vapf.VirtualApplianceAsn - } - if vapf.SSHPublicKey != nil { - objectMap["sshPublicKey"] = vapf.SSHPublicKey - } - return json.Marshal(objectMap) -} - -// VirtualApplianceSite virtual Appliance Site resource. -type VirtualApplianceSite struct { - autorest.Response `json:"-"` - // VirtualApplianceSiteProperties - The properties of the Virtual Appliance Sites. - *VirtualApplianceSiteProperties `json:"properties,omitempty"` - // Name - Name of the virtual appliance site. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Site type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualApplianceSite. -func (vas VirtualApplianceSite) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vas.VirtualApplianceSiteProperties != nil { - objectMap["properties"] = vas.VirtualApplianceSiteProperties - } - if vas.Name != nil { - objectMap["name"] = vas.Name - } - if vas.ID != nil { - objectMap["id"] = vas.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualApplianceSite struct. -func (vas *VirtualApplianceSite) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualApplianceSiteProperties VirtualApplianceSiteProperties - err = json.Unmarshal(*v, &virtualApplianceSiteProperties) - if err != nil { - return err - } - vas.VirtualApplianceSiteProperties = &virtualApplianceSiteProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vas.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vas.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vas.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vas.ID = &ID - } - } - } - - return nil -} - -// VirtualApplianceSiteListResult response for ListNetworkVirtualApplianceSites API service call. -type VirtualApplianceSiteListResult struct { - autorest.Response `json:"-"` - // Value - List of Network Virtual Appliance sites. - Value *[]VirtualApplianceSite `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualApplianceSiteListResultIterator provides access to a complete listing of VirtualApplianceSite -// values. -type VirtualApplianceSiteListResultIterator struct { - i int - page VirtualApplianceSiteListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualApplianceSiteListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSiteListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualApplianceSiteListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualApplianceSiteListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualApplianceSiteListResultIterator) Response() VirtualApplianceSiteListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualApplianceSiteListResultIterator) Value() VirtualApplianceSite { - if !iter.page.NotDone() { - return VirtualApplianceSite{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualApplianceSiteListResultIterator type. -func NewVirtualApplianceSiteListResultIterator(page VirtualApplianceSiteListResultPage) VirtualApplianceSiteListResultIterator { - return VirtualApplianceSiteListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vaslr VirtualApplianceSiteListResult) IsEmpty() bool { - return vaslr.Value == nil || len(*vaslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vaslr VirtualApplianceSiteListResult) hasNextLink() bool { - return vaslr.NextLink != nil && len(*vaslr.NextLink) != 0 -} - -// virtualApplianceSiteListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vaslr VirtualApplianceSiteListResult) virtualApplianceSiteListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vaslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vaslr.NextLink))) -} - -// VirtualApplianceSiteListResultPage contains a page of VirtualApplianceSite values. -type VirtualApplianceSiteListResultPage struct { - fn func(context.Context, VirtualApplianceSiteListResult) (VirtualApplianceSiteListResult, error) - vaslr VirtualApplianceSiteListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualApplianceSiteListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSiteListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vaslr) - if err != nil { - return err - } - page.vaslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualApplianceSiteListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualApplianceSiteListResultPage) NotDone() bool { - return !page.vaslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualApplianceSiteListResultPage) Response() VirtualApplianceSiteListResult { - return page.vaslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualApplianceSiteListResultPage) Values() []VirtualApplianceSite { - if page.vaslr.IsEmpty() { - return nil - } - return *page.vaslr.Value -} - -// Creates a new instance of the VirtualApplianceSiteListResultPage type. -func NewVirtualApplianceSiteListResultPage(cur VirtualApplianceSiteListResult, getNextPage func(context.Context, VirtualApplianceSiteListResult) (VirtualApplianceSiteListResult, error)) VirtualApplianceSiteListResultPage { - return VirtualApplianceSiteListResultPage{ - fn: getNextPage, - vaslr: cur, - } -} - -// VirtualApplianceSiteProperties properties of the rule group. -type VirtualApplianceSiteProperties struct { - // AddressPrefix - Address Prefix. - AddressPrefix *string `json:"addressPrefix,omitempty"` - // O365Policy - Office 365 Policy. - O365Policy *Office365PolicyProperties `json:"o365Policy,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualApplianceSiteProperties. -func (vasp VirtualApplianceSiteProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vasp.AddressPrefix != nil { - objectMap["addressPrefix"] = vasp.AddressPrefix - } - if vasp.O365Policy != nil { - objectMap["o365Policy"] = vasp.O365Policy - } - return json.Marshal(objectMap) -} - -// VirtualApplianceSitesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualApplianceSitesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualApplianceSitesClient) (VirtualApplianceSite, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualApplianceSitesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualApplianceSitesCreateOrUpdateFuture.Result. -func (future *VirtualApplianceSitesCreateOrUpdateFuture) result(client VirtualApplianceSitesClient) (vas VirtualApplianceSite, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vas.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualApplianceSitesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vas.Response.Response, err = future.GetResult(sender); err == nil && vas.Response.Response.StatusCode != http.StatusNoContent { - vas, err = client.CreateOrUpdateResponder(vas.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesCreateOrUpdateFuture", "Result", vas.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualApplianceSitesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualApplianceSitesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualApplianceSitesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualApplianceSitesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualApplianceSitesDeleteFuture.Result. -func (future *VirtualApplianceSitesDeleteFuture) result(client VirtualApplianceSitesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualApplianceSitesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualApplianceSku definition of the NetworkVirtualApplianceSkus resource. -type VirtualApplianceSku struct { - autorest.Response `json:"-"` - // VirtualApplianceSkuPropertiesFormat - NetworkVirtualApplianceSku properties. - *VirtualApplianceSkuPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VirtualApplianceSku. -func (vas VirtualApplianceSku) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vas.VirtualApplianceSkuPropertiesFormat != nil { - objectMap["properties"] = vas.VirtualApplianceSkuPropertiesFormat - } - if vas.ID != nil { - objectMap["id"] = vas.ID - } - if vas.Location != nil { - objectMap["location"] = vas.Location - } - if vas.Tags != nil { - objectMap["tags"] = vas.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualApplianceSku struct. -func (vas *VirtualApplianceSku) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualApplianceSkuPropertiesFormat VirtualApplianceSkuPropertiesFormat - err = json.Unmarshal(*v, &virtualApplianceSkuPropertiesFormat) - if err != nil { - return err - } - vas.VirtualApplianceSkuPropertiesFormat = &virtualApplianceSkuPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vas.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vas.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vas.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vas.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vas.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vas.Tags = tags - } - } - } - - return nil -} - -// VirtualApplianceSkuInstances list of available Sku and instances. -type VirtualApplianceSkuInstances struct { - // ScaleUnit - READ-ONLY; Scale Unit. - ScaleUnit *string `json:"scaleUnit,omitempty"` - // InstanceCount - READ-ONLY; Instance Count. - InstanceCount *int32 `json:"instanceCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualApplianceSkuInstances. -func (vasi VirtualApplianceSkuInstances) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualApplianceSkuListResult response for ListNetworkVirtualApplianceSkus API service call. -type VirtualApplianceSkuListResult struct { - autorest.Response `json:"-"` - // Value - List of Network Virtual Appliance Skus that are available. - Value *[]VirtualApplianceSku `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualApplianceSkuListResultIterator provides access to a complete listing of VirtualApplianceSku -// values. -type VirtualApplianceSkuListResultIterator struct { - i int - page VirtualApplianceSkuListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualApplianceSkuListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSkuListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualApplianceSkuListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualApplianceSkuListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualApplianceSkuListResultIterator) Response() VirtualApplianceSkuListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualApplianceSkuListResultIterator) Value() VirtualApplianceSku { - if !iter.page.NotDone() { - return VirtualApplianceSku{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualApplianceSkuListResultIterator type. -func NewVirtualApplianceSkuListResultIterator(page VirtualApplianceSkuListResultPage) VirtualApplianceSkuListResultIterator { - return VirtualApplianceSkuListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vaslr VirtualApplianceSkuListResult) IsEmpty() bool { - return vaslr.Value == nil || len(*vaslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vaslr VirtualApplianceSkuListResult) hasNextLink() bool { - return vaslr.NextLink != nil && len(*vaslr.NextLink) != 0 -} - -// virtualApplianceSkuListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vaslr VirtualApplianceSkuListResult) virtualApplianceSkuListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vaslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vaslr.NextLink))) -} - -// VirtualApplianceSkuListResultPage contains a page of VirtualApplianceSku values. -type VirtualApplianceSkuListResultPage struct { - fn func(context.Context, VirtualApplianceSkuListResult) (VirtualApplianceSkuListResult, error) - vaslr VirtualApplianceSkuListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualApplianceSkuListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSkuListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vaslr) - if err != nil { - return err - } - page.vaslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualApplianceSkuListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualApplianceSkuListResultPage) NotDone() bool { - return !page.vaslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualApplianceSkuListResultPage) Response() VirtualApplianceSkuListResult { - return page.vaslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualApplianceSkuListResultPage) Values() []VirtualApplianceSku { - if page.vaslr.IsEmpty() { - return nil - } - return *page.vaslr.Value -} - -// Creates a new instance of the VirtualApplianceSkuListResultPage type. -func NewVirtualApplianceSkuListResultPage(cur VirtualApplianceSkuListResult, getNextPage func(context.Context, VirtualApplianceSkuListResult) (VirtualApplianceSkuListResult, error)) VirtualApplianceSkuListResultPage { - return VirtualApplianceSkuListResultPage{ - fn: getNextPage, - vaslr: cur, - } -} - -// VirtualApplianceSkuProperties network Virtual Appliance Sku Properties. -type VirtualApplianceSkuProperties struct { - // Vendor - Virtual Appliance Vendor. - Vendor *string `json:"vendor,omitempty"` - // BundledScaleUnit - Virtual Appliance Scale Unit. - BundledScaleUnit *string `json:"bundledScaleUnit,omitempty"` - // MarketPlaceVersion - Virtual Appliance Version. - MarketPlaceVersion *string `json:"marketPlaceVersion,omitempty"` -} - -// VirtualApplianceSkuPropertiesFormat properties specific to NetworkVirtualApplianceSkus. -type VirtualApplianceSkuPropertiesFormat struct { - // Vendor - READ-ONLY; Network Virtual Appliance Sku vendor. - Vendor *string `json:"vendor,omitempty"` - // AvailableVersions - READ-ONLY; Available Network Virtual Appliance versions. - AvailableVersions *[]string `json:"availableVersions,omitempty"` - // AvailableScaleUnits - The list of scale units available. - AvailableScaleUnits *[]VirtualApplianceSkuInstances `json:"availableScaleUnits,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualApplianceSkuPropertiesFormat. -func (vaspf VirtualApplianceSkuPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vaspf.AvailableScaleUnits != nil { - objectMap["availableScaleUnits"] = vaspf.AvailableScaleUnits - } - return json.Marshal(objectMap) -} - -// VirtualAppliancesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualAppliancesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualAppliancesClient) (VirtualAppliance, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualAppliancesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualAppliancesCreateOrUpdateFuture.Result. -func (future *VirtualAppliancesCreateOrUpdateFuture) result(client VirtualAppliancesClient) (va VirtualAppliance, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualAppliancesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - va.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualAppliancesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if va.Response.Response, err = future.GetResult(sender); err == nil && va.Response.Response.StatusCode != http.StatusNoContent { - va, err = client.CreateOrUpdateResponder(va.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualAppliancesCreateOrUpdateFuture", "Result", va.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualAppliancesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualAppliancesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualAppliancesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualAppliancesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualAppliancesDeleteFuture.Result. -func (future *VirtualAppliancesDeleteFuture) result(client VirtualAppliancesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualAppliancesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualAppliancesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualHub virtualHub Resource. -type VirtualHub struct { - autorest.Response `json:"-"` - // VirtualHubProperties - Properties of the virtual hub. - *VirtualHubProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Kind - READ-ONLY; Kind of service virtual hub. This is metadata used for the Azure portal experience for Route Server. - Kind *string `json:"kind,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VirtualHub. -func (vh VirtualHub) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vh.VirtualHubProperties != nil { - objectMap["properties"] = vh.VirtualHubProperties - } - if vh.ID != nil { - objectMap["id"] = vh.ID - } - if vh.Location != nil { - objectMap["location"] = vh.Location - } - if vh.Tags != nil { - objectMap["tags"] = vh.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualHub struct. -func (vh *VirtualHub) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualHubProperties VirtualHubProperties - err = json.Unmarshal(*v, &virtualHubProperties) - if err != nil { - return err - } - vh.VirtualHubProperties = &virtualHubProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vh.Etag = &etag - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - vh.Kind = &kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vh.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vh.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vh.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vh.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vh.Tags = tags - } - } - } - - return nil -} - -// VirtualHubBgpConnectionCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type VirtualHubBgpConnectionCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualHubBgpConnectionClient) (BgpConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualHubBgpConnectionCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualHubBgpConnectionCreateOrUpdateFuture.Result. -func (future *VirtualHubBgpConnectionCreateOrUpdateFuture) result(client VirtualHubBgpConnectionClient) (bc BgpConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualHubBgpConnectionCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bc.Response.Response, err = future.GetResult(sender); err == nil && bc.Response.Response.StatusCode != http.StatusNoContent { - bc, err = client.CreateOrUpdateResponder(bc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionCreateOrUpdateFuture", "Result", bc.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualHubBgpConnectionDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualHubBgpConnectionDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualHubBgpConnectionClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualHubBgpConnectionDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualHubBgpConnectionDeleteFuture.Result. -func (future *VirtualHubBgpConnectionDeleteFuture) result(client VirtualHubBgpConnectionClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualHubBgpConnectionDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualHubBgpConnectionsListAdvertisedRoutesFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type VirtualHubBgpConnectionsListAdvertisedRoutesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualHubBgpConnectionsClient) (PeerRouteList, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualHubBgpConnectionsListAdvertisedRoutesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualHubBgpConnectionsListAdvertisedRoutesFuture.Result. -func (future *VirtualHubBgpConnectionsListAdvertisedRoutesFuture) result(client VirtualHubBgpConnectionsClient) (prl PeerRouteList, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsListAdvertisedRoutesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - prl.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualHubBgpConnectionsListAdvertisedRoutesFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if prl.Response.Response, err = future.GetResult(sender); err == nil && prl.Response.Response.StatusCode != http.StatusNoContent { - prl, err = client.ListAdvertisedRoutesResponder(prl.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsListAdvertisedRoutesFuture", "Result", prl.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualHubBgpConnectionsListLearnedRoutesFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type VirtualHubBgpConnectionsListLearnedRoutesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualHubBgpConnectionsClient) (PeerRouteList, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualHubBgpConnectionsListLearnedRoutesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualHubBgpConnectionsListLearnedRoutesFuture.Result. -func (future *VirtualHubBgpConnectionsListLearnedRoutesFuture) result(client VirtualHubBgpConnectionsClient) (prl PeerRouteList, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsListLearnedRoutesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - prl.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualHubBgpConnectionsListLearnedRoutesFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if prl.Response.Response, err = future.GetResult(sender); err == nil && prl.Response.Response.StatusCode != http.StatusNoContent { - prl, err = client.ListLearnedRoutesResponder(prl.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsListLearnedRoutesFuture", "Result", prl.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualHubEffectiveRoute the effective route configured on the virtual hub or specified resource. -type VirtualHubEffectiveRoute struct { - // AddressPrefixes - The list of address prefixes. - AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` - // NextHops - The list of next hops. - NextHops *[]string `json:"nextHops,omitempty"` - // NextHopType - The type of the next hop. - NextHopType *string `json:"nextHopType,omitempty"` - // AsPath - The ASPath of this route. - AsPath *string `json:"asPath,omitempty"` - // RouteOrigin - The origin of this route. - RouteOrigin *string `json:"routeOrigin,omitempty"` -} - -// VirtualHubEffectiveRouteList effectiveRoutes List. -type VirtualHubEffectiveRouteList struct { - // Value - The list of effective routes configured on the virtual hub or the specified resource. - Value *[]VirtualHubEffectiveRoute `json:"value,omitempty"` -} - -// VirtualHubID virtual Hub identifier. -type VirtualHubID struct { - // ID - 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. - ID *string `json:"id,omitempty"` -} - -// VirtualHubIPConfigurationCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type VirtualHubIPConfigurationCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualHubIPConfigurationClient) (HubIPConfiguration, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualHubIPConfigurationCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualHubIPConfigurationCreateOrUpdateFuture.Result. -func (future *VirtualHubIPConfigurationCreateOrUpdateFuture) result(client VirtualHubIPConfigurationClient) (hic HubIPConfiguration, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - hic.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualHubIPConfigurationCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if hic.Response.Response, err = future.GetResult(sender); err == nil && hic.Response.Response.StatusCode != http.StatusNoContent { - hic, err = client.CreateOrUpdateResponder(hic.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationCreateOrUpdateFuture", "Result", hic.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualHubIPConfigurationDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualHubIPConfigurationDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualHubIPConfigurationClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualHubIPConfigurationDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualHubIPConfigurationDeleteFuture.Result. -func (future *VirtualHubIPConfigurationDeleteFuture) result(client VirtualHubIPConfigurationClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualHubIPConfigurationDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualHubProperties parameters for VirtualHub. -type VirtualHubProperties struct { - // VirtualWan - The VirtualWAN to which the VirtualHub belongs. - VirtualWan *SubResource `json:"virtualWan,omitempty"` - // VpnGateway - The VpnGateway associated with this VirtualHub. - VpnGateway *SubResource `json:"vpnGateway,omitempty"` - // P2SVpnGateway - The P2SVpnGateway associated with this VirtualHub. - P2SVpnGateway *SubResource `json:"p2SVpnGateway,omitempty"` - // ExpressRouteGateway - The expressRouteGateway associated with this VirtualHub. - ExpressRouteGateway *SubResource `json:"expressRouteGateway,omitempty"` - // AzureFirewall - The azureFirewall associated with this VirtualHub. - AzureFirewall *SubResource `json:"azureFirewall,omitempty"` - // SecurityPartnerProvider - The securityPartnerProvider associated with this VirtualHub. - SecurityPartnerProvider *SubResource `json:"securityPartnerProvider,omitempty"` - // AddressPrefix - Address-prefix for this VirtualHub. - AddressPrefix *string `json:"addressPrefix,omitempty"` - // RouteTable - The routeTable associated with this virtual hub. - RouteTable *VirtualHubRouteTable `json:"routeTable,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the virtual hub resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // SecurityProviderName - The Security Provider name. - SecurityProviderName *string `json:"securityProviderName,omitempty"` - // VirtualHubRouteTableV2s - List of all virtual hub route table v2s associated with this VirtualHub. - VirtualHubRouteTableV2s *[]VirtualHubRouteTableV2 `json:"virtualHubRouteTableV2s,omitempty"` - // Sku - The sku of this VirtualHub. - Sku *string `json:"sku,omitempty"` - // RoutingState - The routing state. Possible values include: 'RoutingStateNone', 'RoutingStateProvisioned', 'RoutingStateProvisioning', 'RoutingStateFailed' - RoutingState RoutingState `json:"routingState,omitempty"` - // BgpConnections - READ-ONLY; List of references to Bgp Connections. - BgpConnections *[]SubResource `json:"bgpConnections,omitempty"` - // IPConfigurations - READ-ONLY; List of references to IpConfigurations. - IPConfigurations *[]SubResource `json:"ipConfigurations,omitempty"` - // RouteMaps - READ-ONLY; List of references to RouteMaps. - RouteMaps *[]SubResource `json:"routeMaps,omitempty"` - // VirtualRouterAsn - VirtualRouter ASN. - VirtualRouterAsn *int64 `json:"virtualRouterAsn,omitempty"` - // VirtualRouterIps - VirtualRouter IPs. - VirtualRouterIps *[]string `json:"virtualRouterIps,omitempty"` - // AllowBranchToBranchTraffic - Flag to control transit for VirtualRouter hub. - AllowBranchToBranchTraffic *bool `json:"allowBranchToBranchTraffic,omitempty"` - // PreferredRoutingGateway - The preferred gateway to route on-prem traffic. Possible values include: 'PreferredRoutingGatewayExpressRoute', 'PreferredRoutingGatewayVpnGateway', 'PreferredRoutingGatewayNone' - PreferredRoutingGateway PreferredRoutingGateway `json:"preferredRoutingGateway,omitempty"` - // HubRoutingPreference - The hubRoutingPreference of this VirtualHub. Possible values include: 'HubRoutingPreferenceExpressRoute', 'HubRoutingPreferenceVpnGateway', 'HubRoutingPreferenceASPath' - HubRoutingPreference HubRoutingPreference `json:"hubRoutingPreference,omitempty"` - // VirtualRouterAutoScaleConfiguration - The VirtualHub Router autoscale configuration. - VirtualRouterAutoScaleConfiguration *VirtualRouterAutoScaleConfiguration `json:"virtualRouterAutoScaleConfiguration,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualHubProperties. -func (vhp VirtualHubProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vhp.VirtualWan != nil { - objectMap["virtualWan"] = vhp.VirtualWan - } - if vhp.VpnGateway != nil { - objectMap["vpnGateway"] = vhp.VpnGateway - } - if vhp.P2SVpnGateway != nil { - objectMap["p2SVpnGateway"] = vhp.P2SVpnGateway - } - if vhp.ExpressRouteGateway != nil { - objectMap["expressRouteGateway"] = vhp.ExpressRouteGateway - } - if vhp.AzureFirewall != nil { - objectMap["azureFirewall"] = vhp.AzureFirewall - } - if vhp.SecurityPartnerProvider != nil { - objectMap["securityPartnerProvider"] = vhp.SecurityPartnerProvider - } - if vhp.AddressPrefix != nil { - objectMap["addressPrefix"] = vhp.AddressPrefix - } - if vhp.RouteTable != nil { - objectMap["routeTable"] = vhp.RouteTable - } - if vhp.SecurityProviderName != nil { - objectMap["securityProviderName"] = vhp.SecurityProviderName - } - if vhp.VirtualHubRouteTableV2s != nil { - objectMap["virtualHubRouteTableV2s"] = vhp.VirtualHubRouteTableV2s - } - if vhp.Sku != nil { - objectMap["sku"] = vhp.Sku - } - if vhp.RoutingState != "" { - objectMap["routingState"] = vhp.RoutingState - } - if vhp.VirtualRouterAsn != nil { - objectMap["virtualRouterAsn"] = vhp.VirtualRouterAsn - } - if vhp.VirtualRouterIps != nil { - objectMap["virtualRouterIps"] = vhp.VirtualRouterIps - } - if vhp.AllowBranchToBranchTraffic != nil { - objectMap["allowBranchToBranchTraffic"] = vhp.AllowBranchToBranchTraffic - } - if vhp.PreferredRoutingGateway != "" { - objectMap["preferredRoutingGateway"] = vhp.PreferredRoutingGateway - } - if vhp.HubRoutingPreference != "" { - objectMap["hubRoutingPreference"] = vhp.HubRoutingPreference - } - if vhp.VirtualRouterAutoScaleConfiguration != nil { - objectMap["virtualRouterAutoScaleConfiguration"] = vhp.VirtualRouterAutoScaleConfiguration - } - return json.Marshal(objectMap) -} - -// VirtualHubRoute virtualHub route. -type VirtualHubRoute struct { - // AddressPrefixes - List of all addressPrefixes. - AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` - // NextHopIPAddress - NextHop ip address. - NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` -} - -// VirtualHubRouteTable virtualHub route table. -type VirtualHubRouteTable struct { - // Routes - List of all routes. - Routes *[]VirtualHubRoute `json:"routes,omitempty"` -} - -// VirtualHubRouteTableV2 virtualHubRouteTableV2 Resource. -type VirtualHubRouteTableV2 struct { - autorest.Response `json:"-"` - // VirtualHubRouteTableV2Properties - Properties of the virtual hub route table v2. - *VirtualHubRouteTableV2Properties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualHubRouteTableV2. -func (vhrtv VirtualHubRouteTableV2) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vhrtv.VirtualHubRouteTableV2Properties != nil { - objectMap["properties"] = vhrtv.VirtualHubRouteTableV2Properties - } - if vhrtv.Name != nil { - objectMap["name"] = vhrtv.Name - } - if vhrtv.ID != nil { - objectMap["id"] = vhrtv.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualHubRouteTableV2 struct. -func (vhrtv *VirtualHubRouteTableV2) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualHubRouteTableV2Properties VirtualHubRouteTableV2Properties - err = json.Unmarshal(*v, &virtualHubRouteTableV2Properties) - if err != nil { - return err - } - vhrtv.VirtualHubRouteTableV2Properties = &virtualHubRouteTableV2Properties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vhrtv.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vhrtv.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vhrtv.ID = &ID - } - } - } - - return nil -} - -// VirtualHubRouteTableV2Properties parameters for VirtualHubRouteTableV2. -type VirtualHubRouteTableV2Properties struct { - // Routes - List of all routes. - Routes *[]VirtualHubRouteV2 `json:"routes,omitempty"` - // AttachedConnections - List of all connections attached to this route table v2. - AttachedConnections *[]string `json:"attachedConnections,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the virtual hub route table v2 resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualHubRouteTableV2Properties. -func (vhrtvp VirtualHubRouteTableV2Properties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vhrtvp.Routes != nil { - objectMap["routes"] = vhrtvp.Routes - } - if vhrtvp.AttachedConnections != nil { - objectMap["attachedConnections"] = vhrtvp.AttachedConnections - } - return json.Marshal(objectMap) -} - -// VirtualHubRouteTableV2sCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type VirtualHubRouteTableV2sCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualHubRouteTableV2sClient) (VirtualHubRouteTableV2, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualHubRouteTableV2sCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualHubRouteTableV2sCreateOrUpdateFuture.Result. -func (future *VirtualHubRouteTableV2sCreateOrUpdateFuture) result(client VirtualHubRouteTableV2sClient) (vhrtv VirtualHubRouteTableV2, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vhrtv.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualHubRouteTableV2sCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vhrtv.Response.Response, err = future.GetResult(sender); err == nil && vhrtv.Response.Response.StatusCode != http.StatusNoContent { - vhrtv, err = client.CreateOrUpdateResponder(vhrtv.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sCreateOrUpdateFuture", "Result", vhrtv.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualHubRouteTableV2sDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualHubRouteTableV2sDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualHubRouteTableV2sClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualHubRouteTableV2sDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualHubRouteTableV2sDeleteFuture.Result. -func (future *VirtualHubRouteTableV2sDeleteFuture) result(client VirtualHubRouteTableV2sClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualHubRouteTableV2sDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualHubRouteV2 virtualHubRouteTableV2 route. -type VirtualHubRouteV2 struct { - // DestinationType - The type of destinations. - DestinationType *string `json:"destinationType,omitempty"` - // Destinations - List of all destinations. - Destinations *[]string `json:"destinations,omitempty"` - // NextHopType - The type of next hops. - NextHopType *string `json:"nextHopType,omitempty"` - // NextHops - NextHops ip address. - NextHops *[]string `json:"nextHops,omitempty"` -} - -// VirtualHubsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualHubsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualHubsClient) (VirtualHub, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualHubsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualHubsCreateOrUpdateFuture.Result. -func (future *VirtualHubsCreateOrUpdateFuture) result(client VirtualHubsClient) (vh VirtualHub, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vh.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualHubsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vh.Response.Response, err = future.GetResult(sender); err == nil && vh.Response.Response.StatusCode != http.StatusNoContent { - vh, err = client.CreateOrUpdateResponder(vh.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubsCreateOrUpdateFuture", "Result", vh.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualHubsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualHubsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualHubsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualHubsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualHubsDeleteFuture.Result. -func (future *VirtualHubsDeleteFuture) result(client VirtualHubsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualHubsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualHubsGetEffectiveVirtualHubRoutesFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type VirtualHubsGetEffectiveVirtualHubRoutesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualHubsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualHubsGetEffectiveVirtualHubRoutesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualHubsGetEffectiveVirtualHubRoutesFuture.Result. -func (future *VirtualHubsGetEffectiveVirtualHubRoutesFuture) result(client VirtualHubsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubsGetEffectiveVirtualHubRoutesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualHubsGetEffectiveVirtualHubRoutesFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualHubsGetInboundRoutesFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualHubsGetInboundRoutesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualHubsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualHubsGetInboundRoutesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualHubsGetInboundRoutesFuture.Result. -func (future *VirtualHubsGetInboundRoutesFuture) result(client VirtualHubsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubsGetInboundRoutesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualHubsGetInboundRoutesFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualHubsGetOutboundRoutesFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualHubsGetOutboundRoutesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualHubsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualHubsGetOutboundRoutesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualHubsGetOutboundRoutesFuture.Result. -func (future *VirtualHubsGetOutboundRoutesFuture) result(client VirtualHubsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualHubsGetOutboundRoutesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualHubsGetOutboundRoutesFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualNetwork virtual Network resource. -type VirtualNetwork struct { - autorest.Response `json:"-"` - // ExtendedLocation - The extended location of the virtual network. - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - // VirtualNetworkPropertiesFormat - Properties of the virtual network. - *VirtualNetworkPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VirtualNetwork. -func (vn VirtualNetwork) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vn.ExtendedLocation != nil { - objectMap["extendedLocation"] = vn.ExtendedLocation - } - if vn.VirtualNetworkPropertiesFormat != nil { - objectMap["properties"] = vn.VirtualNetworkPropertiesFormat - } - if vn.ID != nil { - objectMap["id"] = vn.ID - } - if vn.Location != nil { - objectMap["location"] = vn.Location - } - if vn.Tags != nil { - objectMap["tags"] = vn.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetwork struct. -func (vn *VirtualNetwork) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "extendedLocation": - if v != nil { - var extendedLocation ExtendedLocation - err = json.Unmarshal(*v, &extendedLocation) - if err != nil { - return err - } - vn.ExtendedLocation = &extendedLocation - } - case "properties": - if v != nil { - var virtualNetworkPropertiesFormat VirtualNetworkPropertiesFormat - err = json.Unmarshal(*v, &virtualNetworkPropertiesFormat) - if err != nil { - return err - } - vn.VirtualNetworkPropertiesFormat = &virtualNetworkPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vn.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vn.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vn.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vn.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vn.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vn.Tags = tags - } - } - } - - return nil -} - -// VirtualNetworkBgpCommunities bgp Communities sent over ExpressRoute with each route corresponding to a -// prefix in this VNET. -type VirtualNetworkBgpCommunities struct { - // VirtualNetworkCommunity - The BGP community associated with the virtual network. - VirtualNetworkCommunity *string `json:"virtualNetworkCommunity,omitempty"` - // RegionalCommunity - READ-ONLY; The BGP community associated with the region of the virtual network. - RegionalCommunity *string `json:"regionalCommunity,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkBgpCommunities. -func (vnbc VirtualNetworkBgpCommunities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnbc.VirtualNetworkCommunity != nil { - objectMap["virtualNetworkCommunity"] = vnbc.VirtualNetworkCommunity - } - return json.Marshal(objectMap) -} - -// VirtualNetworkConnectionGatewayReference a reference to VirtualNetworkGateway or LocalNetworkGateway -// resource. -type VirtualNetworkConnectionGatewayReference struct { - // ID - The ID of VirtualNetworkGateway or LocalNetworkGateway resource. - ID *string `json:"id,omitempty"` -} - -// VirtualNetworkDdosProtectionStatusResult response for GetVirtualNetworkDdosProtectionStatusOperation. -type VirtualNetworkDdosProtectionStatusResult struct { - autorest.Response `json:"-"` - // Value - The Ddos Protection Status Result for each public ip under a virtual network. - Value *[]PublicIPDdosProtectionStatusResult `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualNetworkDdosProtectionStatusResultIterator provides access to a complete listing of -// PublicIPDdosProtectionStatusResult values. -type VirtualNetworkDdosProtectionStatusResultIterator struct { - i int - page VirtualNetworkDdosProtectionStatusResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualNetworkDdosProtectionStatusResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkDdosProtectionStatusResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualNetworkDdosProtectionStatusResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualNetworkDdosProtectionStatusResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualNetworkDdosProtectionStatusResultIterator) Response() VirtualNetworkDdosProtectionStatusResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualNetworkDdosProtectionStatusResultIterator) Value() PublicIPDdosProtectionStatusResult { - if !iter.page.NotDone() { - return PublicIPDdosProtectionStatusResult{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualNetworkDdosProtectionStatusResultIterator type. -func NewVirtualNetworkDdosProtectionStatusResultIterator(page VirtualNetworkDdosProtectionStatusResultPage) VirtualNetworkDdosProtectionStatusResultIterator { - return VirtualNetworkDdosProtectionStatusResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vndpsr VirtualNetworkDdosProtectionStatusResult) IsEmpty() bool { - return vndpsr.Value == nil || len(*vndpsr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vndpsr VirtualNetworkDdosProtectionStatusResult) hasNextLink() bool { - return vndpsr.NextLink != nil && len(*vndpsr.NextLink) != 0 -} - -// virtualNetworkDdosProtectionStatusResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vndpsr VirtualNetworkDdosProtectionStatusResult) virtualNetworkDdosProtectionStatusResultPreparer(ctx context.Context) (*http.Request, error) { - if !vndpsr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vndpsr.NextLink))) -} - -// VirtualNetworkDdosProtectionStatusResultPage contains a page of PublicIPDdosProtectionStatusResult -// values. -type VirtualNetworkDdosProtectionStatusResultPage struct { - fn func(context.Context, VirtualNetworkDdosProtectionStatusResult) (VirtualNetworkDdosProtectionStatusResult, error) - vndpsr VirtualNetworkDdosProtectionStatusResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualNetworkDdosProtectionStatusResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkDdosProtectionStatusResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vndpsr) - if err != nil { - return err - } - page.vndpsr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualNetworkDdosProtectionStatusResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualNetworkDdosProtectionStatusResultPage) NotDone() bool { - return !page.vndpsr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualNetworkDdosProtectionStatusResultPage) Response() VirtualNetworkDdosProtectionStatusResult { - return page.vndpsr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualNetworkDdosProtectionStatusResultPage) Values() []PublicIPDdosProtectionStatusResult { - if page.vndpsr.IsEmpty() { - return nil - } - return *page.vndpsr.Value -} - -// Creates a new instance of the VirtualNetworkDdosProtectionStatusResultPage type. -func NewVirtualNetworkDdosProtectionStatusResultPage(cur VirtualNetworkDdosProtectionStatusResult, getNextPage func(context.Context, VirtualNetworkDdosProtectionStatusResult) (VirtualNetworkDdosProtectionStatusResult, error)) VirtualNetworkDdosProtectionStatusResultPage { - return VirtualNetworkDdosProtectionStatusResultPage{ - fn: getNextPage, - vndpsr: cur, - } -} - -// VirtualNetworkEncryption indicates if encryption is enabled on virtual network and if VM without -// encryption is allowed in encrypted VNet. -type VirtualNetworkEncryption struct { - // Enabled - Indicates if encryption is enabled on the virtual network. - Enabled *bool `json:"enabled,omitempty"` - // Enforcement - If the encrypted VNet allows VM that does not support encryption. Possible values include: 'VirtualNetworkEncryptionEnforcementDropUnencrypted', 'VirtualNetworkEncryptionEnforcementAllowUnencrypted' - Enforcement VirtualNetworkEncryptionEnforcement `json:"enforcement,omitempty"` -} - -// VirtualNetworkGateway a common class for general resource information. -type VirtualNetworkGateway struct { - autorest.Response `json:"-"` - // VirtualNetworkGatewayPropertiesFormat - Properties of the virtual network gateway. - *VirtualNetworkGatewayPropertiesFormat `json:"properties,omitempty"` - // ExtendedLocation - The extended location of type local virtual network gateway. - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGateway. -func (vng VirtualNetworkGateway) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vng.VirtualNetworkGatewayPropertiesFormat != nil { - objectMap["properties"] = vng.VirtualNetworkGatewayPropertiesFormat - } - if vng.ExtendedLocation != nil { - objectMap["extendedLocation"] = vng.ExtendedLocation - } - if vng.ID != nil { - objectMap["id"] = vng.ID - } - if vng.Location != nil { - objectMap["location"] = vng.Location - } - if vng.Tags != nil { - objectMap["tags"] = vng.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGateway struct. -func (vng *VirtualNetworkGateway) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualNetworkGatewayPropertiesFormat VirtualNetworkGatewayPropertiesFormat - err = json.Unmarshal(*v, &virtualNetworkGatewayPropertiesFormat) - if err != nil { - return err - } - vng.VirtualNetworkGatewayPropertiesFormat = &virtualNetworkGatewayPropertiesFormat - } - case "extendedLocation": - if v != nil { - var extendedLocation ExtendedLocation - err = json.Unmarshal(*v, &extendedLocation) - if err != nil { - return err - } - vng.ExtendedLocation = &extendedLocation - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vng.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vng.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vng.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vng.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vng.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vng.Tags = tags - } - } - } - - return nil -} - -// VirtualNetworkGatewayConnection a common class for general resource information. -type VirtualNetworkGatewayConnection struct { - autorest.Response `json:"-"` - // VirtualNetworkGatewayConnectionPropertiesFormat - Properties of the virtual network gateway connection. - *VirtualNetworkGatewayConnectionPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnection. -func (vngc VirtualNetworkGatewayConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vngc.VirtualNetworkGatewayConnectionPropertiesFormat != nil { - objectMap["properties"] = vngc.VirtualNetworkGatewayConnectionPropertiesFormat - } - if vngc.ID != nil { - objectMap["id"] = vngc.ID - } - if vngc.Location != nil { - objectMap["location"] = vngc.Location - } - if vngc.Tags != nil { - objectMap["tags"] = vngc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayConnection struct. -func (vngc *VirtualNetworkGatewayConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualNetworkGatewayConnectionPropertiesFormat VirtualNetworkGatewayConnectionPropertiesFormat - err = json.Unmarshal(*v, &virtualNetworkGatewayConnectionPropertiesFormat) - if err != nil { - return err - } - vngc.VirtualNetworkGatewayConnectionPropertiesFormat = &virtualNetworkGatewayConnectionPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vngc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vngc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vngc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vngc.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vngc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vngc.Tags = tags - } - } - } - - return nil -} - -// VirtualNetworkGatewayConnectionListEntity a common class for general resource information. -type VirtualNetworkGatewayConnectionListEntity struct { - // VirtualNetworkGatewayConnectionListEntityPropertiesFormat - Properties of the virtual network gateway connection. - *VirtualNetworkGatewayConnectionListEntityPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnectionListEntity. -func (vngcle VirtualNetworkGatewayConnectionListEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vngcle.VirtualNetworkGatewayConnectionListEntityPropertiesFormat != nil { - objectMap["properties"] = vngcle.VirtualNetworkGatewayConnectionListEntityPropertiesFormat - } - if vngcle.ID != nil { - objectMap["id"] = vngcle.ID - } - if vngcle.Location != nil { - objectMap["location"] = vngcle.Location - } - if vngcle.Tags != nil { - objectMap["tags"] = vngcle.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayConnectionListEntity struct. -func (vngcle *VirtualNetworkGatewayConnectionListEntity) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualNetworkGatewayConnectionListEntityPropertiesFormat VirtualNetworkGatewayConnectionListEntityPropertiesFormat - err = json.Unmarshal(*v, &virtualNetworkGatewayConnectionListEntityPropertiesFormat) - if err != nil { - return err - } - vngcle.VirtualNetworkGatewayConnectionListEntityPropertiesFormat = &virtualNetworkGatewayConnectionListEntityPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vngcle.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vngcle.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vngcle.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vngcle.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vngcle.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vngcle.Tags = tags - } - } - } - - return nil -} - -// VirtualNetworkGatewayConnectionListEntityPropertiesFormat virtualNetworkGatewayConnection properties. -type VirtualNetworkGatewayConnectionListEntityPropertiesFormat struct { - // AuthorizationKey - The authorizationKey. - AuthorizationKey *string `json:"authorizationKey,omitempty"` - // VirtualNetworkGateway1 - The reference to virtual network gateway resource. - VirtualNetworkGateway1 *VirtualNetworkConnectionGatewayReference `json:"virtualNetworkGateway1,omitempty"` - // VirtualNetworkGateway2 - The reference to virtual network gateway resource. - VirtualNetworkGateway2 *VirtualNetworkConnectionGatewayReference `json:"virtualNetworkGateway2,omitempty"` - // LocalNetworkGateway2 - The reference to local network gateway resource. - LocalNetworkGateway2 *VirtualNetworkConnectionGatewayReference `json:"localNetworkGateway2,omitempty"` - // ConnectionType - Gateway connection type. Possible values include: 'VirtualNetworkGatewayConnectionTypeIPsec', 'VirtualNetworkGatewayConnectionTypeVnet2Vnet', 'VirtualNetworkGatewayConnectionTypeExpressRoute', 'VirtualNetworkGatewayConnectionTypeVPNClient' - ConnectionType VirtualNetworkGatewayConnectionType `json:"connectionType,omitempty"` - // ConnectionProtocol - Connection protocol used for this connection. Possible values include: 'VirtualNetworkGatewayConnectionProtocolIKEv2', 'VirtualNetworkGatewayConnectionProtocolIKEv1' - ConnectionProtocol VirtualNetworkGatewayConnectionProtocol `json:"connectionProtocol,omitempty"` - // RoutingWeight - The routing weight. - RoutingWeight *int32 `json:"routingWeight,omitempty"` - // ConnectionMode - The connection mode for this connection. Possible values include: 'VirtualNetworkGatewayConnectionModeDefault', 'VirtualNetworkGatewayConnectionModeResponderOnly', 'VirtualNetworkGatewayConnectionModeInitiatorOnly' - ConnectionMode VirtualNetworkGatewayConnectionMode `json:"connectionMode,omitempty"` - // SharedKey - The IPSec shared key. - SharedKey *string `json:"sharedKey,omitempty"` - // ConnectionStatus - READ-ONLY; Virtual Network Gateway connection status. Possible values include: 'VirtualNetworkGatewayConnectionStatusUnknown', 'VirtualNetworkGatewayConnectionStatusConnecting', 'VirtualNetworkGatewayConnectionStatusConnected', 'VirtualNetworkGatewayConnectionStatusNotConnected' - ConnectionStatus VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty"` - // TunnelConnectionStatus - READ-ONLY; Collection of all tunnels' connection health status. - TunnelConnectionStatus *[]TunnelConnectionHealth `json:"tunnelConnectionStatus,omitempty"` - // EgressBytesTransferred - READ-ONLY; The egress bytes transferred in this connection. - EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` - // IngressBytesTransferred - READ-ONLY; The ingress bytes transferred in this connection. - IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` - // Peer - The reference to peerings resource. - Peer *SubResource `json:"peer,omitempty"` - // EnableBgp - EnableBgp flag. - EnableBgp *bool `json:"enableBgp,omitempty"` - // GatewayCustomBgpIPAddresses - GatewayCustomBgpIpAddresses to be used for virtual network gateway Connection. - GatewayCustomBgpIPAddresses *[]GatewayCustomBgpIPAddressIPConfiguration `json:"gatewayCustomBgpIpAddresses,omitempty"` - // UsePolicyBasedTrafficSelectors - Enable policy-based traffic selectors. - UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` - // IpsecPolicies - The IPSec Policies to be considered by this connection. - IpsecPolicies *[]IpsecPolicy `json:"ipsecPolicies,omitempty"` - // TrafficSelectorPolicies - The Traffic Selector Policies to be considered by this connection. - TrafficSelectorPolicies *[]TrafficSelectorPolicy `json:"trafficSelectorPolicies,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the virtual network gateway connection resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the virtual network gateway connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ExpressRouteGatewayBypass - Bypass ExpressRoute Gateway for data forwarding. - ExpressRouteGatewayBypass *bool `json:"expressRouteGatewayBypass,omitempty"` - // EnablePrivateLinkFastPath - Bypass the ExpressRoute gateway when accessing private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be enabled. - EnablePrivateLinkFastPath *bool `json:"enablePrivateLinkFastPath,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnectionListEntityPropertiesFormat. -func (vngclepf VirtualNetworkGatewayConnectionListEntityPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vngclepf.AuthorizationKey != nil { - objectMap["authorizationKey"] = vngclepf.AuthorizationKey - } - if vngclepf.VirtualNetworkGateway1 != nil { - objectMap["virtualNetworkGateway1"] = vngclepf.VirtualNetworkGateway1 - } - if vngclepf.VirtualNetworkGateway2 != nil { - objectMap["virtualNetworkGateway2"] = vngclepf.VirtualNetworkGateway2 - } - if vngclepf.LocalNetworkGateway2 != nil { - objectMap["localNetworkGateway2"] = vngclepf.LocalNetworkGateway2 - } - if vngclepf.ConnectionType != "" { - objectMap["connectionType"] = vngclepf.ConnectionType - } - if vngclepf.ConnectionProtocol != "" { - objectMap["connectionProtocol"] = vngclepf.ConnectionProtocol - } - if vngclepf.RoutingWeight != nil { - objectMap["routingWeight"] = vngclepf.RoutingWeight - } - if vngclepf.ConnectionMode != "" { - objectMap["connectionMode"] = vngclepf.ConnectionMode - } - if vngclepf.SharedKey != nil { - objectMap["sharedKey"] = vngclepf.SharedKey - } - if vngclepf.Peer != nil { - objectMap["peer"] = vngclepf.Peer - } - if vngclepf.EnableBgp != nil { - objectMap["enableBgp"] = vngclepf.EnableBgp - } - if vngclepf.GatewayCustomBgpIPAddresses != nil { - objectMap["gatewayCustomBgpIpAddresses"] = vngclepf.GatewayCustomBgpIPAddresses - } - if vngclepf.UsePolicyBasedTrafficSelectors != nil { - objectMap["usePolicyBasedTrafficSelectors"] = vngclepf.UsePolicyBasedTrafficSelectors - } - if vngclepf.IpsecPolicies != nil { - objectMap["ipsecPolicies"] = vngclepf.IpsecPolicies - } - if vngclepf.TrafficSelectorPolicies != nil { - objectMap["trafficSelectorPolicies"] = vngclepf.TrafficSelectorPolicies - } - if vngclepf.ExpressRouteGatewayBypass != nil { - objectMap["expressRouteGatewayBypass"] = vngclepf.ExpressRouteGatewayBypass - } - if vngclepf.EnablePrivateLinkFastPath != nil { - objectMap["enablePrivateLinkFastPath"] = vngclepf.EnablePrivateLinkFastPath - } - return json.Marshal(objectMap) -} - -// VirtualNetworkGatewayConnectionListResult response for the ListVirtualNetworkGatewayConnections API -// service call. -type VirtualNetworkGatewayConnectionListResult struct { - autorest.Response `json:"-"` - // Value - A list of VirtualNetworkGatewayConnection resources that exists in a resource group. - Value *[]VirtualNetworkGatewayConnection `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnectionListResult. -func (vngclr VirtualNetworkGatewayConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vngclr.Value != nil { - objectMap["value"] = vngclr.Value - } - return json.Marshal(objectMap) -} - -// VirtualNetworkGatewayConnectionListResultIterator provides access to a complete listing of -// VirtualNetworkGatewayConnection values. -type VirtualNetworkGatewayConnectionListResultIterator struct { - i int - page VirtualNetworkGatewayConnectionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualNetworkGatewayConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualNetworkGatewayConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualNetworkGatewayConnectionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualNetworkGatewayConnectionListResultIterator) Response() VirtualNetworkGatewayConnectionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualNetworkGatewayConnectionListResultIterator) Value() VirtualNetworkGatewayConnection { - if !iter.page.NotDone() { - return VirtualNetworkGatewayConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualNetworkGatewayConnectionListResultIterator type. -func NewVirtualNetworkGatewayConnectionListResultIterator(page VirtualNetworkGatewayConnectionListResultPage) VirtualNetworkGatewayConnectionListResultIterator { - return VirtualNetworkGatewayConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vngclr VirtualNetworkGatewayConnectionListResult) IsEmpty() bool { - return vngclr.Value == nil || len(*vngclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vngclr VirtualNetworkGatewayConnectionListResult) hasNextLink() bool { - return vngclr.NextLink != nil && len(*vngclr.NextLink) != 0 -} - -// virtualNetworkGatewayConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vngclr VirtualNetworkGatewayConnectionListResult) virtualNetworkGatewayConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vngclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vngclr.NextLink))) -} - -// VirtualNetworkGatewayConnectionListResultPage contains a page of VirtualNetworkGatewayConnection values. -type VirtualNetworkGatewayConnectionListResultPage struct { - fn func(context.Context, VirtualNetworkGatewayConnectionListResult) (VirtualNetworkGatewayConnectionListResult, error) - vngclr VirtualNetworkGatewayConnectionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualNetworkGatewayConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vngclr) - if err != nil { - return err - } - page.vngclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualNetworkGatewayConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualNetworkGatewayConnectionListResultPage) NotDone() bool { - return !page.vngclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualNetworkGatewayConnectionListResultPage) Response() VirtualNetworkGatewayConnectionListResult { - return page.vngclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualNetworkGatewayConnectionListResultPage) Values() []VirtualNetworkGatewayConnection { - if page.vngclr.IsEmpty() { - return nil - } - return *page.vngclr.Value -} - -// Creates a new instance of the VirtualNetworkGatewayConnectionListResultPage type. -func NewVirtualNetworkGatewayConnectionListResultPage(cur VirtualNetworkGatewayConnectionListResult, getNextPage func(context.Context, VirtualNetworkGatewayConnectionListResult) (VirtualNetworkGatewayConnectionListResult, error)) VirtualNetworkGatewayConnectionListResultPage { - return VirtualNetworkGatewayConnectionListResultPage{ - fn: getNextPage, - vngclr: cur, - } -} - -// VirtualNetworkGatewayConnectionPropertiesFormat virtualNetworkGatewayConnection properties. -type VirtualNetworkGatewayConnectionPropertiesFormat struct { - // AuthorizationKey - The authorizationKey. - AuthorizationKey *string `json:"authorizationKey,omitempty"` - // VirtualNetworkGateway1 - The reference to virtual network gateway resource. - VirtualNetworkGateway1 *VirtualNetworkGateway `json:"virtualNetworkGateway1,omitempty"` - // VirtualNetworkGateway2 - The reference to virtual network gateway resource. - VirtualNetworkGateway2 *VirtualNetworkGateway `json:"virtualNetworkGateway2,omitempty"` - // LocalNetworkGateway2 - The reference to local network gateway resource. - LocalNetworkGateway2 *LocalNetworkGateway `json:"localNetworkGateway2,omitempty"` - // IngressNatRules - List of ingress NatRules. - IngressNatRules *[]SubResource `json:"ingressNatRules,omitempty"` - // EgressNatRules - List of egress NatRules. - EgressNatRules *[]SubResource `json:"egressNatRules,omitempty"` - // ConnectionType - Gateway connection type. Possible values include: 'VirtualNetworkGatewayConnectionTypeIPsec', 'VirtualNetworkGatewayConnectionTypeVnet2Vnet', 'VirtualNetworkGatewayConnectionTypeExpressRoute', 'VirtualNetworkGatewayConnectionTypeVPNClient' - ConnectionType VirtualNetworkGatewayConnectionType `json:"connectionType,omitempty"` - // ConnectionProtocol - Connection protocol used for this connection. Possible values include: 'VirtualNetworkGatewayConnectionProtocolIKEv2', 'VirtualNetworkGatewayConnectionProtocolIKEv1' - ConnectionProtocol VirtualNetworkGatewayConnectionProtocol `json:"connectionProtocol,omitempty"` - // RoutingWeight - The routing weight. - RoutingWeight *int32 `json:"routingWeight,omitempty"` - // DpdTimeoutSeconds - The dead peer detection timeout of this connection in seconds. - DpdTimeoutSeconds *int32 `json:"dpdTimeoutSeconds,omitempty"` - // ConnectionMode - The connection mode for this connection. Possible values include: 'VirtualNetworkGatewayConnectionModeDefault', 'VirtualNetworkGatewayConnectionModeResponderOnly', 'VirtualNetworkGatewayConnectionModeInitiatorOnly' - ConnectionMode VirtualNetworkGatewayConnectionMode `json:"connectionMode,omitempty"` - // SharedKey - The IPSec shared key. - SharedKey *string `json:"sharedKey,omitempty"` - // ConnectionStatus - READ-ONLY; Virtual Network Gateway connection status. Possible values include: 'VirtualNetworkGatewayConnectionStatusUnknown', 'VirtualNetworkGatewayConnectionStatusConnecting', 'VirtualNetworkGatewayConnectionStatusConnected', 'VirtualNetworkGatewayConnectionStatusNotConnected' - ConnectionStatus VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty"` - // TunnelConnectionStatus - READ-ONLY; Collection of all tunnels' connection health status. - TunnelConnectionStatus *[]TunnelConnectionHealth `json:"tunnelConnectionStatus,omitempty"` - // EgressBytesTransferred - READ-ONLY; The egress bytes transferred in this connection. - EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` - // IngressBytesTransferred - READ-ONLY; The ingress bytes transferred in this connection. - IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` - // Peer - The reference to peerings resource. - Peer *SubResource `json:"peer,omitempty"` - // EnableBgp - EnableBgp flag. - EnableBgp *bool `json:"enableBgp,omitempty"` - // GatewayCustomBgpIPAddresses - GatewayCustomBgpIpAddresses to be used for virtual network gateway Connection. - GatewayCustomBgpIPAddresses *[]GatewayCustomBgpIPAddressIPConfiguration `json:"gatewayCustomBgpIpAddresses,omitempty"` - // UseLocalAzureIPAddress - Use private local Azure IP for the connection. - UseLocalAzureIPAddress *bool `json:"useLocalAzureIpAddress,omitempty"` - // UsePolicyBasedTrafficSelectors - Enable policy-based traffic selectors. - UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` - // IpsecPolicies - The IPSec Policies to be considered by this connection. - IpsecPolicies *[]IpsecPolicy `json:"ipsecPolicies,omitempty"` - // TrafficSelectorPolicies - The Traffic Selector Policies to be considered by this connection. - TrafficSelectorPolicies *[]TrafficSelectorPolicy `json:"trafficSelectorPolicies,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the virtual network gateway connection resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the virtual network gateway connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ExpressRouteGatewayBypass - Bypass ExpressRoute Gateway for data forwarding. - ExpressRouteGatewayBypass *bool `json:"expressRouteGatewayBypass,omitempty"` - // EnablePrivateLinkFastPath - Bypass the ExpressRoute gateway when accessing private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be enabled. - EnablePrivateLinkFastPath *bool `json:"enablePrivateLinkFastPath,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnectionPropertiesFormat. -func (vngcpf VirtualNetworkGatewayConnectionPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vngcpf.AuthorizationKey != nil { - objectMap["authorizationKey"] = vngcpf.AuthorizationKey - } - if vngcpf.VirtualNetworkGateway1 != nil { - objectMap["virtualNetworkGateway1"] = vngcpf.VirtualNetworkGateway1 - } - if vngcpf.VirtualNetworkGateway2 != nil { - objectMap["virtualNetworkGateway2"] = vngcpf.VirtualNetworkGateway2 - } - if vngcpf.LocalNetworkGateway2 != nil { - objectMap["localNetworkGateway2"] = vngcpf.LocalNetworkGateway2 - } - if vngcpf.IngressNatRules != nil { - objectMap["ingressNatRules"] = vngcpf.IngressNatRules - } - if vngcpf.EgressNatRules != nil { - objectMap["egressNatRules"] = vngcpf.EgressNatRules - } - if vngcpf.ConnectionType != "" { - objectMap["connectionType"] = vngcpf.ConnectionType - } - if vngcpf.ConnectionProtocol != "" { - objectMap["connectionProtocol"] = vngcpf.ConnectionProtocol - } - if vngcpf.RoutingWeight != nil { - objectMap["routingWeight"] = vngcpf.RoutingWeight - } - if vngcpf.DpdTimeoutSeconds != nil { - objectMap["dpdTimeoutSeconds"] = vngcpf.DpdTimeoutSeconds - } - if vngcpf.ConnectionMode != "" { - objectMap["connectionMode"] = vngcpf.ConnectionMode - } - if vngcpf.SharedKey != nil { - objectMap["sharedKey"] = vngcpf.SharedKey - } - if vngcpf.Peer != nil { - objectMap["peer"] = vngcpf.Peer - } - if vngcpf.EnableBgp != nil { - objectMap["enableBgp"] = vngcpf.EnableBgp - } - if vngcpf.GatewayCustomBgpIPAddresses != nil { - objectMap["gatewayCustomBgpIpAddresses"] = vngcpf.GatewayCustomBgpIPAddresses - } - if vngcpf.UseLocalAzureIPAddress != nil { - objectMap["useLocalAzureIpAddress"] = vngcpf.UseLocalAzureIPAddress - } - if vngcpf.UsePolicyBasedTrafficSelectors != nil { - objectMap["usePolicyBasedTrafficSelectors"] = vngcpf.UsePolicyBasedTrafficSelectors - } - if vngcpf.IpsecPolicies != nil { - objectMap["ipsecPolicies"] = vngcpf.IpsecPolicies - } - if vngcpf.TrafficSelectorPolicies != nil { - objectMap["trafficSelectorPolicies"] = vngcpf.TrafficSelectorPolicies - } - if vngcpf.ExpressRouteGatewayBypass != nil { - objectMap["expressRouteGatewayBypass"] = vngcpf.ExpressRouteGatewayBypass - } - if vngcpf.EnablePrivateLinkFastPath != nil { - objectMap["enablePrivateLinkFastPath"] = vngcpf.EnablePrivateLinkFastPath - } - return json.Marshal(objectMap) -} - -// VirtualNetworkGatewayConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type VirtualNetworkGatewayConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewayConnectionsClient) (VirtualNetworkGatewayConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewayConnectionsCreateOrUpdateFuture.Result. -func (future *VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) result(client VirtualNetworkGatewayConnectionsClient) (vngc VirtualNetworkGatewayConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vngc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vngc.Response.Response, err = future.GetResult(sender); err == nil && vngc.Response.Response.StatusCode != http.StatusNoContent { - vngc, err = client.CreateOrUpdateResponder(vngc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", vngc.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewayConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type VirtualNetworkGatewayConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewayConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewayConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewayConnectionsDeleteFuture.Result. -func (future *VirtualNetworkGatewayConnectionsDeleteFuture) result(client VirtualNetworkGatewayConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualNetworkGatewayConnectionsGetIkeSasFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type VirtualNetworkGatewayConnectionsGetIkeSasFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewayConnectionsClient) (String, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewayConnectionsGetIkeSasFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewayConnectionsGetIkeSasFuture.Result. -func (future *VirtualNetworkGatewayConnectionsGetIkeSasFuture) result(client VirtualNetworkGatewayConnectionsClient) (s String, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsGetIkeSasFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsGetIkeSasFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.GetIkeSasResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsGetIkeSasFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewayConnectionsResetConnectionFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type VirtualNetworkGatewayConnectionsResetConnectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewayConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewayConnectionsResetConnectionFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewayConnectionsResetConnectionFuture.Result. -func (future *VirtualNetworkGatewayConnectionsResetConnectionFuture) result(client VirtualNetworkGatewayConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetConnectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsResetConnectionFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualNetworkGatewayConnectionsResetSharedKeyFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type VirtualNetworkGatewayConnectionsResetSharedKeyFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewayConnectionsClient) (ConnectionResetSharedKey, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewayConnectionsResetSharedKeyFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewayConnectionsResetSharedKeyFuture.Result. -func (future *VirtualNetworkGatewayConnectionsResetSharedKeyFuture) result(client VirtualNetworkGatewayConnectionsClient) (crsk ConnectionResetSharedKey, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - crsk.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if crsk.Response.Response, err = future.GetResult(sender); err == nil && crsk.Response.Response.StatusCode != http.StatusNoContent { - crsk, err = client.ResetSharedKeyResponder(crsk.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", crsk.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewayConnectionsSetSharedKeyFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type VirtualNetworkGatewayConnectionsSetSharedKeyFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewayConnectionsClient) (ConnectionSharedKey, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewayConnectionsSetSharedKeyFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewayConnectionsSetSharedKeyFuture.Result. -func (future *VirtualNetworkGatewayConnectionsSetSharedKeyFuture) result(client VirtualNetworkGatewayConnectionsClient) (csk ConnectionSharedKey, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - csk.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if csk.Response.Response, err = future.GetResult(sender); err == nil && csk.Response.Response.StatusCode != http.StatusNoContent { - csk, err = client.SetSharedKeyResponder(csk.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", csk.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewayConnectionsStartPacketCaptureFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type VirtualNetworkGatewayConnectionsStartPacketCaptureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewayConnectionsClient) (String, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewayConnectionsStartPacketCaptureFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewayConnectionsStartPacketCaptureFuture.Result. -func (future *VirtualNetworkGatewayConnectionsStartPacketCaptureFuture) result(client VirtualNetworkGatewayConnectionsClient) (s String, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsStartPacketCaptureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsStartPacketCaptureFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.StartPacketCaptureResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsStartPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewayConnectionsStopPacketCaptureFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type VirtualNetworkGatewayConnectionsStopPacketCaptureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewayConnectionsClient) (String, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewayConnectionsStopPacketCaptureFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewayConnectionsStopPacketCaptureFuture.Result. -func (future *VirtualNetworkGatewayConnectionsStopPacketCaptureFuture) result(client VirtualNetworkGatewayConnectionsClient) (s String, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsStopPacketCaptureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsStopPacketCaptureFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.StopPacketCaptureResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsStopPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewayConnectionsUpdateTagsFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type VirtualNetworkGatewayConnectionsUpdateTagsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewayConnectionsClient) (VirtualNetworkGatewayConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewayConnectionsUpdateTagsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewayConnectionsUpdateTagsFuture.Result. -func (future *VirtualNetworkGatewayConnectionsUpdateTagsFuture) result(client VirtualNetworkGatewayConnectionsClient) (vngc VirtualNetworkGatewayConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsUpdateTagsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vngc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsUpdateTagsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vngc.Response.Response, err = future.GetResult(sender); err == nil && vngc.Response.Response.StatusCode != http.StatusNoContent { - vngc, err = client.UpdateTagsResponder(vngc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsUpdateTagsFuture", "Result", vngc.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewayIPConfiguration IP configuration for virtual network gateway. -type VirtualNetworkGatewayIPConfiguration struct { - // VirtualNetworkGatewayIPConfigurationPropertiesFormat - Properties of the virtual network gateway ip configuration. - *VirtualNetworkGatewayIPConfigurationPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGatewayIPConfiguration. -func (vngic VirtualNetworkGatewayIPConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vngic.VirtualNetworkGatewayIPConfigurationPropertiesFormat != nil { - objectMap["properties"] = vngic.VirtualNetworkGatewayIPConfigurationPropertiesFormat - } - if vngic.Name != nil { - objectMap["name"] = vngic.Name - } - if vngic.ID != nil { - objectMap["id"] = vngic.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayIPConfiguration struct. -func (vngic *VirtualNetworkGatewayIPConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualNetworkGatewayIPConfigurationPropertiesFormat VirtualNetworkGatewayIPConfigurationPropertiesFormat - err = json.Unmarshal(*v, &virtualNetworkGatewayIPConfigurationPropertiesFormat) - if err != nil { - return err - } - vngic.VirtualNetworkGatewayIPConfigurationPropertiesFormat = &virtualNetworkGatewayIPConfigurationPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vngic.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vngic.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vngic.ID = &ID - } - } - } - - return nil -} - -// VirtualNetworkGatewayIPConfigurationPropertiesFormat properties of VirtualNetworkGatewayIPConfiguration. -type VirtualNetworkGatewayIPConfigurationPropertiesFormat struct { - // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' - PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` - // Subnet - The reference to the subnet resource. - Subnet *SubResource `json:"subnet,omitempty"` - // PublicIPAddress - The reference to the public IP resource. - PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` - // PrivateIPAddress - READ-ONLY; Private IP Address for this gateway. - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the virtual network gateway IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGatewayIPConfigurationPropertiesFormat. -func (vngicpf VirtualNetworkGatewayIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vngicpf.PrivateIPAllocationMethod != "" { - objectMap["privateIPAllocationMethod"] = vngicpf.PrivateIPAllocationMethod - } - if vngicpf.Subnet != nil { - objectMap["subnet"] = vngicpf.Subnet - } - if vngicpf.PublicIPAddress != nil { - objectMap["publicIPAddress"] = vngicpf.PublicIPAddress - } - return json.Marshal(objectMap) -} - -// VirtualNetworkGatewayListConnectionsResult response for the VirtualNetworkGatewayListConnections API -// service call. -type VirtualNetworkGatewayListConnectionsResult struct { - autorest.Response `json:"-"` - // Value - A list of VirtualNetworkGatewayConnection resources that exists in a resource group. - Value *[]VirtualNetworkGatewayConnectionListEntity `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGatewayListConnectionsResult. -func (vnglcr VirtualNetworkGatewayListConnectionsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnglcr.Value != nil { - objectMap["value"] = vnglcr.Value - } - return json.Marshal(objectMap) -} - -// VirtualNetworkGatewayListConnectionsResultIterator provides access to a complete listing of -// VirtualNetworkGatewayConnectionListEntity values. -type VirtualNetworkGatewayListConnectionsResultIterator struct { - i int - page VirtualNetworkGatewayListConnectionsResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualNetworkGatewayListConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayListConnectionsResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualNetworkGatewayListConnectionsResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualNetworkGatewayListConnectionsResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualNetworkGatewayListConnectionsResultIterator) Response() VirtualNetworkGatewayListConnectionsResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualNetworkGatewayListConnectionsResultIterator) Value() VirtualNetworkGatewayConnectionListEntity { - if !iter.page.NotDone() { - return VirtualNetworkGatewayConnectionListEntity{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualNetworkGatewayListConnectionsResultIterator type. -func NewVirtualNetworkGatewayListConnectionsResultIterator(page VirtualNetworkGatewayListConnectionsResultPage) VirtualNetworkGatewayListConnectionsResultIterator { - return VirtualNetworkGatewayListConnectionsResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vnglcr VirtualNetworkGatewayListConnectionsResult) IsEmpty() bool { - return vnglcr.Value == nil || len(*vnglcr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vnglcr VirtualNetworkGatewayListConnectionsResult) hasNextLink() bool { - return vnglcr.NextLink != nil && len(*vnglcr.NextLink) != 0 -} - -// virtualNetworkGatewayListConnectionsResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vnglcr VirtualNetworkGatewayListConnectionsResult) virtualNetworkGatewayListConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { - if !vnglcr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vnglcr.NextLink))) -} - -// VirtualNetworkGatewayListConnectionsResultPage contains a page of -// VirtualNetworkGatewayConnectionListEntity values. -type VirtualNetworkGatewayListConnectionsResultPage struct { - fn func(context.Context, VirtualNetworkGatewayListConnectionsResult) (VirtualNetworkGatewayListConnectionsResult, error) - vnglcr VirtualNetworkGatewayListConnectionsResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualNetworkGatewayListConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayListConnectionsResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vnglcr) - if err != nil { - return err - } - page.vnglcr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualNetworkGatewayListConnectionsResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualNetworkGatewayListConnectionsResultPage) NotDone() bool { - return !page.vnglcr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualNetworkGatewayListConnectionsResultPage) Response() VirtualNetworkGatewayListConnectionsResult { - return page.vnglcr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualNetworkGatewayListConnectionsResultPage) Values() []VirtualNetworkGatewayConnectionListEntity { - if page.vnglcr.IsEmpty() { - return nil - } - return *page.vnglcr.Value -} - -// Creates a new instance of the VirtualNetworkGatewayListConnectionsResultPage type. -func NewVirtualNetworkGatewayListConnectionsResultPage(cur VirtualNetworkGatewayListConnectionsResult, getNextPage func(context.Context, VirtualNetworkGatewayListConnectionsResult) (VirtualNetworkGatewayListConnectionsResult, error)) VirtualNetworkGatewayListConnectionsResultPage { - return VirtualNetworkGatewayListConnectionsResultPage{ - fn: getNextPage, - vnglcr: cur, - } -} - -// VirtualNetworkGatewayListResult response for the ListVirtualNetworkGateways API service call. -type VirtualNetworkGatewayListResult struct { - autorest.Response `json:"-"` - // Value - A list of VirtualNetworkGateway resources that exists in a resource group. - Value *[]VirtualNetworkGateway `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGatewayListResult. -func (vnglr VirtualNetworkGatewayListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnglr.Value != nil { - objectMap["value"] = vnglr.Value - } - return json.Marshal(objectMap) -} - -// VirtualNetworkGatewayListResultIterator provides access to a complete listing of VirtualNetworkGateway -// values. -type VirtualNetworkGatewayListResultIterator struct { - i int - page VirtualNetworkGatewayListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualNetworkGatewayListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualNetworkGatewayListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualNetworkGatewayListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualNetworkGatewayListResultIterator) Response() VirtualNetworkGatewayListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualNetworkGatewayListResultIterator) Value() VirtualNetworkGateway { - if !iter.page.NotDone() { - return VirtualNetworkGateway{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualNetworkGatewayListResultIterator type. -func NewVirtualNetworkGatewayListResultIterator(page VirtualNetworkGatewayListResultPage) VirtualNetworkGatewayListResultIterator { - return VirtualNetworkGatewayListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vnglr VirtualNetworkGatewayListResult) IsEmpty() bool { - return vnglr.Value == nil || len(*vnglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vnglr VirtualNetworkGatewayListResult) hasNextLink() bool { - return vnglr.NextLink != nil && len(*vnglr.NextLink) != 0 -} - -// virtualNetworkGatewayListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vnglr VirtualNetworkGatewayListResult) virtualNetworkGatewayListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vnglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vnglr.NextLink))) -} - -// VirtualNetworkGatewayListResultPage contains a page of VirtualNetworkGateway values. -type VirtualNetworkGatewayListResultPage struct { - fn func(context.Context, VirtualNetworkGatewayListResult) (VirtualNetworkGatewayListResult, error) - vnglr VirtualNetworkGatewayListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualNetworkGatewayListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vnglr) - if err != nil { - return err - } - page.vnglr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualNetworkGatewayListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualNetworkGatewayListResultPage) NotDone() bool { - return !page.vnglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualNetworkGatewayListResultPage) Response() VirtualNetworkGatewayListResult { - return page.vnglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualNetworkGatewayListResultPage) Values() []VirtualNetworkGateway { - if page.vnglr.IsEmpty() { - return nil - } - return *page.vnglr.Value -} - -// Creates a new instance of the VirtualNetworkGatewayListResultPage type. -func NewVirtualNetworkGatewayListResultPage(cur VirtualNetworkGatewayListResult, getNextPage func(context.Context, VirtualNetworkGatewayListResult) (VirtualNetworkGatewayListResult, error)) VirtualNetworkGatewayListResultPage { - return VirtualNetworkGatewayListResultPage{ - fn: getNextPage, - vnglr: cur, - } -} - -// VirtualNetworkGatewayNatRule virtualNetworkGatewayNatRule Resource. -type VirtualNetworkGatewayNatRule struct { - autorest.Response `json:"-"` - // VirtualNetworkGatewayNatRuleProperties - Properties of the Virtual Network Gateway NAT rule. - *VirtualNetworkGatewayNatRuleProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGatewayNatRule. -func (vngnr VirtualNetworkGatewayNatRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vngnr.VirtualNetworkGatewayNatRuleProperties != nil { - objectMap["properties"] = vngnr.VirtualNetworkGatewayNatRuleProperties - } - if vngnr.Name != nil { - objectMap["name"] = vngnr.Name - } - if vngnr.ID != nil { - objectMap["id"] = vngnr.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayNatRule struct. -func (vngnr *VirtualNetworkGatewayNatRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualNetworkGatewayNatRuleProperties VirtualNetworkGatewayNatRuleProperties - err = json.Unmarshal(*v, &virtualNetworkGatewayNatRuleProperties) - if err != nil { - return err - } - vngnr.VirtualNetworkGatewayNatRuleProperties = &virtualNetworkGatewayNatRuleProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vngnr.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vngnr.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vngnr.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vngnr.ID = &ID - } - } - } - - return nil -} - -// VirtualNetworkGatewayNatRuleProperties parameters for VirtualNetworkGatewayNatRule. -type VirtualNetworkGatewayNatRuleProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the NAT Rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Type - The type of NAT rule for VPN NAT. Possible values include: 'VpnNatRuleTypeStatic', 'VpnNatRuleTypeDynamic' - Type VpnNatRuleType `json:"type,omitempty"` - // Mode - The Source NAT direction of a VPN NAT. Possible values include: 'VpnNatRuleModeEgressSnat', 'VpnNatRuleModeIngressSnat' - Mode VpnNatRuleMode `json:"mode,omitempty"` - // InternalMappings - The private IP address internal mapping for NAT. - InternalMappings *[]VpnNatRuleMapping `json:"internalMappings,omitempty"` - // ExternalMappings - The private IP address external mapping for NAT. - ExternalMappings *[]VpnNatRuleMapping `json:"externalMappings,omitempty"` - // IPConfigurationID - The IP Configuration ID this NAT rule applies to. - IPConfigurationID *string `json:"ipConfigurationId,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGatewayNatRuleProperties. -func (vngnrp VirtualNetworkGatewayNatRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vngnrp.Type != "" { - objectMap["type"] = vngnrp.Type - } - if vngnrp.Mode != "" { - objectMap["mode"] = vngnrp.Mode - } - if vngnrp.InternalMappings != nil { - objectMap["internalMappings"] = vngnrp.InternalMappings - } - if vngnrp.ExternalMappings != nil { - objectMap["externalMappings"] = vngnrp.ExternalMappings - } - if vngnrp.IPConfigurationID != nil { - objectMap["ipConfigurationId"] = vngnrp.IPConfigurationID - } - return json.Marshal(objectMap) -} - -// VirtualNetworkGatewayNatRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type VirtualNetworkGatewayNatRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewayNatRulesClient) (VirtualNetworkGatewayNatRule, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewayNatRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewayNatRulesCreateOrUpdateFuture.Result. -func (future *VirtualNetworkGatewayNatRulesCreateOrUpdateFuture) result(client VirtualNetworkGatewayNatRulesClient) (vngnr VirtualNetworkGatewayNatRule, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vngnr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayNatRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vngnr.Response.Response, err = future.GetResult(sender); err == nil && vngnr.Response.Response.StatusCode != http.StatusNoContent { - vngnr, err = client.CreateOrUpdateResponder(vngnr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesCreateOrUpdateFuture", "Result", vngnr.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewayNatRulesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkGatewayNatRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewayNatRulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewayNatRulesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewayNatRulesDeleteFuture.Result. -func (future *VirtualNetworkGatewayNatRulesDeleteFuture) result(client VirtualNetworkGatewayNatRulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayNatRulesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualNetworkGatewayPolicyGroup parameters for VirtualNetworkGatewayPolicyGroup. -type VirtualNetworkGatewayPolicyGroup struct { - // VirtualNetworkGatewayPolicyGroupProperties - Properties of tVirtualNetworkGatewayPolicyGroup. - *VirtualNetworkGatewayPolicyGroupProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGatewayPolicyGroup. -func (vngpg VirtualNetworkGatewayPolicyGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vngpg.VirtualNetworkGatewayPolicyGroupProperties != nil { - objectMap["properties"] = vngpg.VirtualNetworkGatewayPolicyGroupProperties - } - if vngpg.Name != nil { - objectMap["name"] = vngpg.Name - } - if vngpg.ID != nil { - objectMap["id"] = vngpg.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayPolicyGroup struct. -func (vngpg *VirtualNetworkGatewayPolicyGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualNetworkGatewayPolicyGroupProperties VirtualNetworkGatewayPolicyGroupProperties - err = json.Unmarshal(*v, &virtualNetworkGatewayPolicyGroupProperties) - if err != nil { - return err - } - vngpg.VirtualNetworkGatewayPolicyGroupProperties = &virtualNetworkGatewayPolicyGroupProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vngpg.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vngpg.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vngpg.ID = &ID - } - } - } - - return nil -} - -// VirtualNetworkGatewayPolicyGroupMember vpn Client Connection configuration PolicyGroup member -type VirtualNetworkGatewayPolicyGroupMember struct { - // Name - Name of the VirtualNetworkGatewayPolicyGroupMember. - Name *string `json:"name,omitempty"` - // AttributeType - The Vpn Policy member attribute type. Possible values include: 'VpnPolicyMemberAttributeTypeCertificateGroupID', 'VpnPolicyMemberAttributeTypeAADGroupID', 'VpnPolicyMemberAttributeTypeRadiusAzureGroupID' - AttributeType VpnPolicyMemberAttributeType `json:"attributeType,omitempty"` - // AttributeValue - The value of Attribute used for this VirtualNetworkGatewayPolicyGroupMember. - AttributeValue *string `json:"attributeValue,omitempty"` -} - -// VirtualNetworkGatewayPolicyGroupProperties properties of VirtualNetworkGatewayPolicyGroup. -type VirtualNetworkGatewayPolicyGroupProperties struct { - // IsDefault - Shows if this is a Default VirtualNetworkGatewayPolicyGroup or not. - IsDefault *bool `json:"isDefault,omitempty"` - // Priority - Priority for VirtualNetworkGatewayPolicyGroup. - Priority *int32 `json:"priority,omitempty"` - // PolicyMembers - Multiple PolicyMembers for VirtualNetworkGatewayPolicyGroup. - PolicyMembers *[]VirtualNetworkGatewayPolicyGroupMember `json:"policyMembers,omitempty"` - // VngClientConnectionConfigurations - READ-ONLY; List of references to vngClientConnectionConfigurations. - VngClientConnectionConfigurations *[]SubResource `json:"vngClientConnectionConfigurations,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the VirtualNetworkGatewayPolicyGroup resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGatewayPolicyGroupProperties. -func (vngpgp VirtualNetworkGatewayPolicyGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vngpgp.IsDefault != nil { - objectMap["isDefault"] = vngpgp.IsDefault - } - if vngpgp.Priority != nil { - objectMap["priority"] = vngpgp.Priority - } - if vngpgp.PolicyMembers != nil { - objectMap["policyMembers"] = vngpgp.PolicyMembers - } - return json.Marshal(objectMap) -} - -// VirtualNetworkGatewayPropertiesFormat virtualNetworkGateway properties. -type VirtualNetworkGatewayPropertiesFormat struct { - // IPConfigurations - IP configurations for virtual network gateway. - IPConfigurations *[]VirtualNetworkGatewayIPConfiguration `json:"ipConfigurations,omitempty"` - // GatewayType - The type of this virtual network gateway. Possible values include: 'VirtualNetworkGatewayTypeVpn', 'VirtualNetworkGatewayTypeExpressRoute', 'VirtualNetworkGatewayTypeLocalGateway' - GatewayType VirtualNetworkGatewayType `json:"gatewayType,omitempty"` - // VpnType - The type of this virtual network gateway. Possible values include: 'VpnTypePolicyBased', 'VpnTypeRouteBased' - VpnType VpnType `json:"vpnType,omitempty"` - // VpnGatewayGeneration - The generation for this VirtualNetworkGateway. Must be None if gatewayType is not VPN. Possible values include: 'VpnGatewayGenerationNone', 'VpnGatewayGenerationGeneration1', 'VpnGatewayGenerationGeneration2' - VpnGatewayGeneration VpnGatewayGeneration `json:"vpnGatewayGeneration,omitempty"` - // EnableBgp - Whether BGP is enabled for this virtual network gateway or not. - EnableBgp *bool `json:"enableBgp,omitempty"` - // EnablePrivateIPAddress - Whether private IP needs to be enabled on this gateway for connections or not. - EnablePrivateIPAddress *bool `json:"enablePrivateIpAddress,omitempty"` - // ActiveActive - ActiveActive flag. - ActiveActive *bool `json:"activeActive,omitempty"` - // DisableIPSecReplayProtection - disableIPSecReplayProtection flag. - DisableIPSecReplayProtection *bool `json:"disableIPSecReplayProtection,omitempty"` - // GatewayDefaultSite - The reference to the LocalNetworkGateway resource which represents local network site having default routes. Assign Null value in case of removing existing default site setting. - GatewayDefaultSite *SubResource `json:"gatewayDefaultSite,omitempty"` - // Sku - The reference to the VirtualNetworkGatewaySku resource which represents the SKU selected for Virtual network gateway. - Sku *VirtualNetworkGatewaySku `json:"sku,omitempty"` - // VpnClientConfiguration - The reference to the VpnClientConfiguration resource which represents the P2S VpnClient configurations. - VpnClientConfiguration *VpnClientConfiguration `json:"vpnClientConfiguration,omitempty"` - // VirtualNetworkGatewayPolicyGroups - The reference to the VirtualNetworkGatewayPolicyGroup resource which represents the available VirtualNetworkGatewayPolicyGroup for the gateway. - VirtualNetworkGatewayPolicyGroups *[]VirtualNetworkGatewayPolicyGroup `json:"virtualNetworkGatewayPolicyGroups,omitempty"` - // BgpSettings - Virtual network gateway's BGP speaker settings. - BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` - // CustomRoutes - The reference to the address space resource which represents the custom routes address space specified by the customer for virtual network gateway and VpnClient. - CustomRoutes *AddressSpace `json:"customRoutes,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the virtual network gateway resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the virtual network gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // EnableDNSForwarding - Whether dns forwarding is enabled or not. - EnableDNSForwarding *bool `json:"enableDnsForwarding,omitempty"` - // InboundDNSForwardingEndpoint - READ-ONLY; The IP address allocated by the gateway to which dns requests can be sent. - InboundDNSForwardingEndpoint *string `json:"inboundDnsForwardingEndpoint,omitempty"` - // VNetExtendedLocationResourceID - Customer vnet resource id. VirtualNetworkGateway of type local gateway is associated with the customer vnet. - VNetExtendedLocationResourceID *string `json:"vNetExtendedLocationResourceId,omitempty"` - // NatRules - NatRules for virtual network gateway. - NatRules *[]VirtualNetworkGatewayNatRule `json:"natRules,omitempty"` - // EnableBgpRouteTranslationForNat - EnableBgpRouteTranslationForNat flag. - EnableBgpRouteTranslationForNat *bool `json:"enableBgpRouteTranslationForNat,omitempty"` - // AllowVirtualWanTraffic - Configures this gateway to accept traffic from remote Virtual WAN networks. - AllowVirtualWanTraffic *bool `json:"allowVirtualWanTraffic,omitempty"` - // AllowRemoteVnetTraffic - Configure this gateway to accept traffic from other Azure Virtual Networks. This configuration does not support connectivity to Azure Virtual WAN. - AllowRemoteVnetTraffic *bool `json:"allowRemoteVnetTraffic,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGatewayPropertiesFormat. -func (vngpf VirtualNetworkGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vngpf.IPConfigurations != nil { - objectMap["ipConfigurations"] = vngpf.IPConfigurations - } - if vngpf.GatewayType != "" { - objectMap["gatewayType"] = vngpf.GatewayType - } - if vngpf.VpnType != "" { - objectMap["vpnType"] = vngpf.VpnType - } - if vngpf.VpnGatewayGeneration != "" { - objectMap["vpnGatewayGeneration"] = vngpf.VpnGatewayGeneration - } - if vngpf.EnableBgp != nil { - objectMap["enableBgp"] = vngpf.EnableBgp - } - if vngpf.EnablePrivateIPAddress != nil { - objectMap["enablePrivateIpAddress"] = vngpf.EnablePrivateIPAddress - } - if vngpf.ActiveActive != nil { - objectMap["activeActive"] = vngpf.ActiveActive - } - if vngpf.DisableIPSecReplayProtection != nil { - objectMap["disableIPSecReplayProtection"] = vngpf.DisableIPSecReplayProtection - } - if vngpf.GatewayDefaultSite != nil { - objectMap["gatewayDefaultSite"] = vngpf.GatewayDefaultSite - } - if vngpf.Sku != nil { - objectMap["sku"] = vngpf.Sku - } - if vngpf.VpnClientConfiguration != nil { - objectMap["vpnClientConfiguration"] = vngpf.VpnClientConfiguration - } - if vngpf.VirtualNetworkGatewayPolicyGroups != nil { - objectMap["virtualNetworkGatewayPolicyGroups"] = vngpf.VirtualNetworkGatewayPolicyGroups - } - if vngpf.BgpSettings != nil { - objectMap["bgpSettings"] = vngpf.BgpSettings - } - if vngpf.CustomRoutes != nil { - objectMap["customRoutes"] = vngpf.CustomRoutes - } - if vngpf.EnableDNSForwarding != nil { - objectMap["enableDnsForwarding"] = vngpf.EnableDNSForwarding - } - if vngpf.VNetExtendedLocationResourceID != nil { - objectMap["vNetExtendedLocationResourceId"] = vngpf.VNetExtendedLocationResourceID - } - if vngpf.NatRules != nil { - objectMap["natRules"] = vngpf.NatRules - } - if vngpf.EnableBgpRouteTranslationForNat != nil { - objectMap["enableBgpRouteTranslationForNat"] = vngpf.EnableBgpRouteTranslationForNat - } - if vngpf.AllowVirtualWanTraffic != nil { - objectMap["allowVirtualWanTraffic"] = vngpf.AllowVirtualWanTraffic - } - if vngpf.AllowRemoteVnetTraffic != nil { - objectMap["allowRemoteVnetTraffic"] = vngpf.AllowRemoteVnetTraffic - } - return json.Marshal(objectMap) -} - -// VirtualNetworkGatewaySku virtualNetworkGatewaySku details. -type VirtualNetworkGatewaySku struct { - // Name - Gateway SKU name. Possible values include: 'VirtualNetworkGatewaySkuNameBasic', 'VirtualNetworkGatewaySkuNameHighPerformance', 'VirtualNetworkGatewaySkuNameStandard', 'VirtualNetworkGatewaySkuNameUltraPerformance', 'VirtualNetworkGatewaySkuNameVpnGw1', 'VirtualNetworkGatewaySkuNameVpnGw2', 'VirtualNetworkGatewaySkuNameVpnGw3', 'VirtualNetworkGatewaySkuNameVpnGw4', 'VirtualNetworkGatewaySkuNameVpnGw5', 'VirtualNetworkGatewaySkuNameVpnGw1AZ', 'VirtualNetworkGatewaySkuNameVpnGw2AZ', 'VirtualNetworkGatewaySkuNameVpnGw3AZ', 'VirtualNetworkGatewaySkuNameVpnGw4AZ', 'VirtualNetworkGatewaySkuNameVpnGw5AZ', 'VirtualNetworkGatewaySkuNameErGw1AZ', 'VirtualNetworkGatewaySkuNameErGw2AZ', 'VirtualNetworkGatewaySkuNameErGw3AZ' - Name VirtualNetworkGatewaySkuName `json:"name,omitempty"` - // Tier - Gateway SKU tier. Possible values include: 'VirtualNetworkGatewaySkuTierBasic', 'VirtualNetworkGatewaySkuTierHighPerformance', 'VirtualNetworkGatewaySkuTierStandard', 'VirtualNetworkGatewaySkuTierUltraPerformance', 'VirtualNetworkGatewaySkuTierVpnGw1', 'VirtualNetworkGatewaySkuTierVpnGw2', 'VirtualNetworkGatewaySkuTierVpnGw3', 'VirtualNetworkGatewaySkuTierVpnGw4', 'VirtualNetworkGatewaySkuTierVpnGw5', 'VirtualNetworkGatewaySkuTierVpnGw1AZ', 'VirtualNetworkGatewaySkuTierVpnGw2AZ', 'VirtualNetworkGatewaySkuTierVpnGw3AZ', 'VirtualNetworkGatewaySkuTierVpnGw4AZ', 'VirtualNetworkGatewaySkuTierVpnGw5AZ', 'VirtualNetworkGatewaySkuTierErGw1AZ', 'VirtualNetworkGatewaySkuTierErGw2AZ', 'VirtualNetworkGatewaySkuTierErGw3AZ' - Tier VirtualNetworkGatewaySkuTier `json:"tier,omitempty"` - // Capacity - READ-ONLY; The capacity. - Capacity *int32 `json:"capacity,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkGatewaySku. -func (vngs VirtualNetworkGatewaySku) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vngs.Name != "" { - objectMap["name"] = vngs.Name - } - if vngs.Tier != "" { - objectMap["tier"] = vngs.Tier - } - return json.Marshal(objectMap) -} - -// VirtualNetworkGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkGatewaysCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (VirtualNetworkGateway, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysCreateOrUpdateFuture.Result. -func (future *VirtualNetworkGatewaysCreateOrUpdateFuture) result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vng.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { - vng, err = client.CreateOrUpdateResponder(vng.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", vng.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkGatewaysDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysDeleteFuture.Result. -func (future *VirtualNetworkGatewaysDeleteFuture) result(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture an abstraction for monitoring -// and retrieving the results of a long-running operation. -type VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture.Result. -func (future *VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture) result(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualNetworkGatewaysGenerateVpnProfileFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type VirtualNetworkGatewaysGenerateVpnProfileFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (String, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysGenerateVpnProfileFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysGenerateVpnProfileFuture.Result. -func (future *VirtualNetworkGatewaysGenerateVpnProfileFuture) result(client VirtualNetworkGatewaysClient) (s String, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGenerateVpnProfileFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.GenerateVpnProfileResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewaysGeneratevpnclientpackageFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type VirtualNetworkGatewaysGeneratevpnclientpackageFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (String, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysGeneratevpnclientpackageFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysGeneratevpnclientpackageFuture.Result. -func (future *VirtualNetworkGatewaysGeneratevpnclientpackageFuture) result(client VirtualNetworkGatewaysClient) (s String, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.GeneratevpnclientpackageResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewaysGetAdvertisedRoutesFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type VirtualNetworkGatewaysGetAdvertisedRoutesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (GatewayRouteListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysGetAdvertisedRoutesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysGetAdvertisedRoutesFuture.Result. -func (future *VirtualNetworkGatewaysGetAdvertisedRoutesFuture) result(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - grlr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if grlr.Response.Response, err = future.GetResult(sender); err == nil && grlr.Response.Response.StatusCode != http.StatusNoContent { - grlr, err = client.GetAdvertisedRoutesResponder(grlr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", grlr.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewaysGetBgpPeerStatusFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type VirtualNetworkGatewaysGetBgpPeerStatusFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (BgpPeerStatusListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysGetBgpPeerStatusFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysGetBgpPeerStatusFuture.Result. -func (future *VirtualNetworkGatewaysGetBgpPeerStatusFuture) result(client VirtualNetworkGatewaysClient) (bpslr BgpPeerStatusListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bpslr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetBgpPeerStatusFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bpslr.Response.Response, err = future.GetResult(sender); err == nil && bpslr.Response.Response.StatusCode != http.StatusNoContent { - bpslr, err = client.GetBgpPeerStatusResponder(bpslr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", bpslr.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewaysGetLearnedRoutesFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type VirtualNetworkGatewaysGetLearnedRoutesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (GatewayRouteListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysGetLearnedRoutesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysGetLearnedRoutesFuture.Result. -func (future *VirtualNetworkGatewaysGetLearnedRoutesFuture) result(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - grlr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetLearnedRoutesFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if grlr.Response.Response, err = future.GetResult(sender); err == nil && grlr.Response.Response.StatusCode != http.StatusNoContent { - grlr, err = client.GetLearnedRoutesResponder(grlr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", grlr.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewaysGetVpnProfilePackageURLFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type VirtualNetworkGatewaysGetVpnProfilePackageURLFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (String, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysGetVpnProfilePackageURLFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysGetVpnProfilePackageURLFuture.Result. -func (future *VirtualNetworkGatewaysGetVpnProfilePackageURLFuture) result(client VirtualNetworkGatewaysClient) (s String, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.GetVpnProfilePackageURLResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (VpnClientConnectionHealthDetailListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture.Result. -func (future *VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture) result(client VirtualNetworkGatewaysClient) (vcchdlr VpnClientConnectionHealthDetailListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vcchdlr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vcchdlr.Response.Response, err = future.GetResult(sender); err == nil && vcchdlr.Response.Response.StatusCode != http.StatusNoContent { - vcchdlr, err = client.GetVpnclientConnectionHealthResponder(vcchdlr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture", "Result", vcchdlr.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (VpnClientIPsecParameters, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture.Result. -func (future *VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture) result(client VirtualNetworkGatewaysClient) (vcipp VpnClientIPsecParameters, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vcipp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vcipp.Response.Response, err = future.GetResult(sender); err == nil && vcipp.Response.Response.StatusCode != http.StatusNoContent { - vcipp, err = client.GetVpnclientIpsecParametersResponder(vcipp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture", "Result", vcipp.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewaysResetFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkGatewaysResetFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (VirtualNetworkGateway, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysResetFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysResetFuture.Result. -func (future *VirtualNetworkGatewaysResetFuture) result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vng.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { - vng, err = client.ResetResponder(vng.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", vng.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewaysResetVpnClientSharedKeyFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type VirtualNetworkGatewaysResetVpnClientSharedKeyFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysResetVpnClientSharedKeyFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysResetVpnClientSharedKeyFuture.Result. -func (future *VirtualNetworkGatewaysResetVpnClientSharedKeyFuture) result(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetVpnClientSharedKeyFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetVpnClientSharedKeyFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (VpnClientIPsecParameters, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture.Result. -func (future *VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture) result(client VirtualNetworkGatewaysClient) (vcipp VpnClientIPsecParameters, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vcipp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vcipp.Response.Response, err = future.GetResult(sender); err == nil && vcipp.Response.Response.StatusCode != http.StatusNoContent { - vcipp, err = client.SetVpnclientIpsecParametersResponder(vcipp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture", "Result", vcipp.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewaysStartPacketCaptureFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type VirtualNetworkGatewaysStartPacketCaptureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (String, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysStartPacketCaptureFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysStartPacketCaptureFuture.Result. -func (future *VirtualNetworkGatewaysStartPacketCaptureFuture) result(client VirtualNetworkGatewaysClient) (s String, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStartPacketCaptureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysStartPacketCaptureFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.StartPacketCaptureResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStartPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewaysStopPacketCaptureFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type VirtualNetworkGatewaysStopPacketCaptureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (String, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysStopPacketCaptureFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysStopPacketCaptureFuture.Result. -func (future *VirtualNetworkGatewaysStopPacketCaptureFuture) result(client VirtualNetworkGatewaysClient) (s String, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStopPacketCaptureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysStopPacketCaptureFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.StopPacketCaptureResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStopPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkGatewaysUpdateTagsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkGatewaysUpdateTagsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkGatewaysClient) (VirtualNetworkGateway, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkGatewaysUpdateTagsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkGatewaysUpdateTagsFuture.Result. -func (future *VirtualNetworkGatewaysUpdateTagsFuture) result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vng.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysUpdateTagsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { - vng, err = client.UpdateTagsResponder(vng.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", vng.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkListResult response for the ListVirtualNetworks API service call. -type VirtualNetworkListResult struct { - autorest.Response `json:"-"` - // Value - A list of VirtualNetwork resources in a resource group. - Value *[]VirtualNetwork `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualNetworkListResultIterator provides access to a complete listing of VirtualNetwork values. -type VirtualNetworkListResultIterator struct { - i int - page VirtualNetworkListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualNetworkListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualNetworkListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualNetworkListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualNetworkListResultIterator) Response() VirtualNetworkListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualNetworkListResultIterator) Value() VirtualNetwork { - if !iter.page.NotDone() { - return VirtualNetwork{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualNetworkListResultIterator type. -func NewVirtualNetworkListResultIterator(page VirtualNetworkListResultPage) VirtualNetworkListResultIterator { - return VirtualNetworkListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vnlr VirtualNetworkListResult) IsEmpty() bool { - return vnlr.Value == nil || len(*vnlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vnlr VirtualNetworkListResult) hasNextLink() bool { - return vnlr.NextLink != nil && len(*vnlr.NextLink) != 0 -} - -// virtualNetworkListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vnlr VirtualNetworkListResult) virtualNetworkListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vnlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vnlr.NextLink))) -} - -// VirtualNetworkListResultPage contains a page of VirtualNetwork values. -type VirtualNetworkListResultPage struct { - fn func(context.Context, VirtualNetworkListResult) (VirtualNetworkListResult, error) - vnlr VirtualNetworkListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualNetworkListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vnlr) - if err != nil { - return err - } - page.vnlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualNetworkListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualNetworkListResultPage) NotDone() bool { - return !page.vnlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualNetworkListResultPage) Response() VirtualNetworkListResult { - return page.vnlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualNetworkListResultPage) Values() []VirtualNetwork { - if page.vnlr.IsEmpty() { - return nil - } - return *page.vnlr.Value -} - -// Creates a new instance of the VirtualNetworkListResultPage type. -func NewVirtualNetworkListResultPage(cur VirtualNetworkListResult, getNextPage func(context.Context, VirtualNetworkListResult) (VirtualNetworkListResult, error)) VirtualNetworkListResultPage { - return VirtualNetworkListResultPage{ - fn: getNextPage, - vnlr: cur, - } -} - -// VirtualNetworkListUsageResult response for the virtual networks GetUsage API service call. -type VirtualNetworkListUsageResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; VirtualNetwork usage stats. - Value *[]VirtualNetworkUsage `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkListUsageResult. -func (vnlur VirtualNetworkListUsageResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnlur.NextLink != nil { - objectMap["nextLink"] = vnlur.NextLink - } - return json.Marshal(objectMap) -} - -// VirtualNetworkListUsageResultIterator provides access to a complete listing of VirtualNetworkUsage -// values. -type VirtualNetworkListUsageResultIterator struct { - i int - page VirtualNetworkListUsageResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualNetworkListUsageResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListUsageResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualNetworkListUsageResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualNetworkListUsageResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualNetworkListUsageResultIterator) Response() VirtualNetworkListUsageResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualNetworkListUsageResultIterator) Value() VirtualNetworkUsage { - if !iter.page.NotDone() { - return VirtualNetworkUsage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualNetworkListUsageResultIterator type. -func NewVirtualNetworkListUsageResultIterator(page VirtualNetworkListUsageResultPage) VirtualNetworkListUsageResultIterator { - return VirtualNetworkListUsageResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vnlur VirtualNetworkListUsageResult) IsEmpty() bool { - return vnlur.Value == nil || len(*vnlur.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vnlur VirtualNetworkListUsageResult) hasNextLink() bool { - return vnlur.NextLink != nil && len(*vnlur.NextLink) != 0 -} - -// virtualNetworkListUsageResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vnlur VirtualNetworkListUsageResult) virtualNetworkListUsageResultPreparer(ctx context.Context) (*http.Request, error) { - if !vnlur.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vnlur.NextLink))) -} - -// VirtualNetworkListUsageResultPage contains a page of VirtualNetworkUsage values. -type VirtualNetworkListUsageResultPage struct { - fn func(context.Context, VirtualNetworkListUsageResult) (VirtualNetworkListUsageResult, error) - vnlur VirtualNetworkListUsageResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualNetworkListUsageResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListUsageResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vnlur) - if err != nil { - return err - } - page.vnlur = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualNetworkListUsageResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualNetworkListUsageResultPage) NotDone() bool { - return !page.vnlur.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualNetworkListUsageResultPage) Response() VirtualNetworkListUsageResult { - return page.vnlur -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualNetworkListUsageResultPage) Values() []VirtualNetworkUsage { - if page.vnlur.IsEmpty() { - return nil - } - return *page.vnlur.Value -} - -// Creates a new instance of the VirtualNetworkListUsageResultPage type. -func NewVirtualNetworkListUsageResultPage(cur VirtualNetworkListUsageResult, getNextPage func(context.Context, VirtualNetworkListUsageResult) (VirtualNetworkListUsageResult, error)) VirtualNetworkListUsageResultPage { - return VirtualNetworkListUsageResultPage{ - fn: getNextPage, - vnlur: cur, - } -} - -// VirtualNetworkPeering peerings in a virtual network resource. -type VirtualNetworkPeering struct { - autorest.Response `json:"-"` - // VirtualNetworkPeeringPropertiesFormat - Properties of the virtual network peering. - *VirtualNetworkPeeringPropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkPeering. -func (vnp VirtualNetworkPeering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnp.VirtualNetworkPeeringPropertiesFormat != nil { - objectMap["properties"] = vnp.VirtualNetworkPeeringPropertiesFormat - } - if vnp.Name != nil { - objectMap["name"] = vnp.Name - } - if vnp.Type != nil { - objectMap["type"] = vnp.Type - } - if vnp.ID != nil { - objectMap["id"] = vnp.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetworkPeering struct. -func (vnp *VirtualNetworkPeering) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualNetworkPeeringPropertiesFormat VirtualNetworkPeeringPropertiesFormat - err = json.Unmarshal(*v, &virtualNetworkPeeringPropertiesFormat) - if err != nil { - return err - } - vnp.VirtualNetworkPeeringPropertiesFormat = &virtualNetworkPeeringPropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vnp.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vnp.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vnp.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vnp.ID = &ID - } - } - } - - return nil -} - -// VirtualNetworkPeeringListResult response for ListSubnets API service call. Retrieves all subnets that -// belong to a virtual network. -type VirtualNetworkPeeringListResult struct { - autorest.Response `json:"-"` - // Value - The peerings in a virtual network. - Value *[]VirtualNetworkPeering `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualNetworkPeeringListResultIterator provides access to a complete listing of VirtualNetworkPeering -// values. -type VirtualNetworkPeeringListResultIterator struct { - i int - page VirtualNetworkPeeringListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualNetworkPeeringListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkPeeringListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualNetworkPeeringListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualNetworkPeeringListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualNetworkPeeringListResultIterator) Response() VirtualNetworkPeeringListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualNetworkPeeringListResultIterator) Value() VirtualNetworkPeering { - if !iter.page.NotDone() { - return VirtualNetworkPeering{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualNetworkPeeringListResultIterator type. -func NewVirtualNetworkPeeringListResultIterator(page VirtualNetworkPeeringListResultPage) VirtualNetworkPeeringListResultIterator { - return VirtualNetworkPeeringListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vnplr VirtualNetworkPeeringListResult) IsEmpty() bool { - return vnplr.Value == nil || len(*vnplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vnplr VirtualNetworkPeeringListResult) hasNextLink() bool { - return vnplr.NextLink != nil && len(*vnplr.NextLink) != 0 -} - -// virtualNetworkPeeringListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vnplr VirtualNetworkPeeringListResult) virtualNetworkPeeringListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vnplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vnplr.NextLink))) -} - -// VirtualNetworkPeeringListResultPage contains a page of VirtualNetworkPeering values. -type VirtualNetworkPeeringListResultPage struct { - fn func(context.Context, VirtualNetworkPeeringListResult) (VirtualNetworkPeeringListResult, error) - vnplr VirtualNetworkPeeringListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualNetworkPeeringListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkPeeringListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vnplr) - if err != nil { - return err - } - page.vnplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualNetworkPeeringListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualNetworkPeeringListResultPage) NotDone() bool { - return !page.vnplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualNetworkPeeringListResultPage) Response() VirtualNetworkPeeringListResult { - return page.vnplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualNetworkPeeringListResultPage) Values() []VirtualNetworkPeering { - if page.vnplr.IsEmpty() { - return nil - } - return *page.vnplr.Value -} - -// Creates a new instance of the VirtualNetworkPeeringListResultPage type. -func NewVirtualNetworkPeeringListResultPage(cur VirtualNetworkPeeringListResult, getNextPage func(context.Context, VirtualNetworkPeeringListResult) (VirtualNetworkPeeringListResult, error)) VirtualNetworkPeeringListResultPage { - return VirtualNetworkPeeringListResultPage{ - fn: getNextPage, - vnplr: cur, - } -} - -// VirtualNetworkPeeringPropertiesFormat properties of the virtual network peering. -type VirtualNetworkPeeringPropertiesFormat struct { - // AllowVirtualNetworkAccess - Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space. - AllowVirtualNetworkAccess *bool `json:"allowVirtualNetworkAccess,omitempty"` - // AllowForwardedTraffic - Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network. - AllowForwardedTraffic *bool `json:"allowForwardedTraffic,omitempty"` - // AllowGatewayTransit - If gateway links can be used in remote virtual networking to link to this virtual network. - AllowGatewayTransit *bool `json:"allowGatewayTransit,omitempty"` - // UseRemoteGateways - 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. - UseRemoteGateways *bool `json:"useRemoteGateways,omitempty"` - // RemoteVirtualNetwork - The reference to the remote virtual network. The remote virtual network can be in the same or different region (preview). See here to register for the preview and learn more (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). - RemoteVirtualNetwork *SubResource `json:"remoteVirtualNetwork,omitempty"` - // RemoteAddressSpace - The reference to the address space peered with the remote virtual network. - RemoteAddressSpace *AddressSpace `json:"remoteAddressSpace,omitempty"` - // RemoteVirtualNetworkAddressSpace - The reference to the current address space of the remote virtual network. - RemoteVirtualNetworkAddressSpace *AddressSpace `json:"remoteVirtualNetworkAddressSpace,omitempty"` - // RemoteBgpCommunities - The reference to the remote virtual network's Bgp Communities. - RemoteBgpCommunities *VirtualNetworkBgpCommunities `json:"remoteBgpCommunities,omitempty"` - // RemoteVirtualNetworkEncryption - READ-ONLY; The reference to the remote virtual network's encryption - RemoteVirtualNetworkEncryption *VirtualNetworkEncryption `json:"remoteVirtualNetworkEncryption,omitempty"` - // PeeringState - The status of the virtual network peering. Possible values include: 'VirtualNetworkPeeringStateInitiated', 'VirtualNetworkPeeringStateConnected', 'VirtualNetworkPeeringStateDisconnected' - PeeringState VirtualNetworkPeeringState `json:"peeringState,omitempty"` - // PeeringSyncLevel - The peering sync status of the virtual network peering. Possible values include: 'VirtualNetworkPeeringLevelFullyInSync', 'VirtualNetworkPeeringLevelRemoteNotInSync', 'VirtualNetworkPeeringLevelLocalNotInSync', 'VirtualNetworkPeeringLevelLocalAndRemoteNotInSync' - PeeringSyncLevel VirtualNetworkPeeringLevel `json:"peeringSyncLevel,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the virtual network peering resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // DoNotVerifyRemoteGateways - If we need to verify the provisioning state of the remote gateway. - DoNotVerifyRemoteGateways *bool `json:"doNotVerifyRemoteGateways,omitempty"` - // ResourceGUID - READ-ONLY; The resourceGuid property of the Virtual Network peering resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkPeeringPropertiesFormat. -func (vnppf VirtualNetworkPeeringPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnppf.AllowVirtualNetworkAccess != nil { - objectMap["allowVirtualNetworkAccess"] = vnppf.AllowVirtualNetworkAccess - } - if vnppf.AllowForwardedTraffic != nil { - objectMap["allowForwardedTraffic"] = vnppf.AllowForwardedTraffic - } - if vnppf.AllowGatewayTransit != nil { - objectMap["allowGatewayTransit"] = vnppf.AllowGatewayTransit - } - if vnppf.UseRemoteGateways != nil { - objectMap["useRemoteGateways"] = vnppf.UseRemoteGateways - } - if vnppf.RemoteVirtualNetwork != nil { - objectMap["remoteVirtualNetwork"] = vnppf.RemoteVirtualNetwork - } - if vnppf.RemoteAddressSpace != nil { - objectMap["remoteAddressSpace"] = vnppf.RemoteAddressSpace - } - if vnppf.RemoteVirtualNetworkAddressSpace != nil { - objectMap["remoteVirtualNetworkAddressSpace"] = vnppf.RemoteVirtualNetworkAddressSpace - } - if vnppf.RemoteBgpCommunities != nil { - objectMap["remoteBgpCommunities"] = vnppf.RemoteBgpCommunities - } - if vnppf.PeeringState != "" { - objectMap["peeringState"] = vnppf.PeeringState - } - if vnppf.PeeringSyncLevel != "" { - objectMap["peeringSyncLevel"] = vnppf.PeeringSyncLevel - } - if vnppf.DoNotVerifyRemoteGateways != nil { - objectMap["doNotVerifyRemoteGateways"] = vnppf.DoNotVerifyRemoteGateways - } - return json.Marshal(objectMap) -} - -// VirtualNetworkPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkPeeringsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkPeeringsClient) (VirtualNetworkPeering, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkPeeringsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkPeeringsCreateOrUpdateFuture.Result. -func (future *VirtualNetworkPeeringsCreateOrUpdateFuture) result(client VirtualNetworkPeeringsClient) (vnp VirtualNetworkPeering, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vnp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkPeeringsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vnp.Response.Response, err = future.GetResult(sender); err == nil && vnp.Response.Response.StatusCode != http.StatusNoContent { - vnp, err = client.CreateOrUpdateResponder(vnp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsCreateOrUpdateFuture", "Result", vnp.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkPeeringsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkPeeringsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkPeeringsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkPeeringsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkPeeringsDeleteFuture.Result. -func (future *VirtualNetworkPeeringsDeleteFuture) result(client VirtualNetworkPeeringsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkPeeringsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualNetworkPropertiesFormat properties of the virtual network. -type VirtualNetworkPropertiesFormat struct { - // AddressSpace - The AddressSpace that contains an array of IP address ranges that can be used by subnets. - AddressSpace *AddressSpace `json:"addressSpace,omitempty"` - // DhcpOptions - The dhcpOptions that contains an array of DNS servers available to VMs deployed in the virtual network. - DhcpOptions *DhcpOptions `json:"dhcpOptions,omitempty"` - // FlowTimeoutInMinutes - The FlowTimeout value (in minutes) for the Virtual Network - FlowTimeoutInMinutes *int32 `json:"flowTimeoutInMinutes,omitempty"` - // Subnets - A list of subnets in a Virtual Network. - Subnets *[]Subnet `json:"subnets,omitempty"` - // VirtualNetworkPeerings - A list of peerings in a Virtual Network. - VirtualNetworkPeerings *[]VirtualNetworkPeering `json:"virtualNetworkPeerings,omitempty"` - // ResourceGUID - READ-ONLY; The resourceGuid property of the Virtual Network resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the virtual network resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // EnableDdosProtection - 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. - EnableDdosProtection *bool `json:"enableDdosProtection,omitempty"` - // EnableVMProtection - Indicates if VM protection is enabled for all the subnets in the virtual network. - EnableVMProtection *bool `json:"enableVmProtection,omitempty"` - // DdosProtectionPlan - The DDoS protection plan associated with the virtual network. - DdosProtectionPlan *SubResource `json:"ddosProtectionPlan,omitempty"` - // BgpCommunities - Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET. - BgpCommunities *VirtualNetworkBgpCommunities `json:"bgpCommunities,omitempty"` - // Encryption - Indicates if encryption is enabled on virtual network and if VM without encryption is allowed in encrypted VNet. - Encryption *VirtualNetworkEncryption `json:"encryption,omitempty"` - // IPAllocations - Array of IpAllocation which reference this VNET. - IPAllocations *[]SubResource `json:"ipAllocations,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkPropertiesFormat. -func (vnpf VirtualNetworkPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnpf.AddressSpace != nil { - objectMap["addressSpace"] = vnpf.AddressSpace - } - if vnpf.DhcpOptions != nil { - objectMap["dhcpOptions"] = vnpf.DhcpOptions - } - if vnpf.FlowTimeoutInMinutes != nil { - objectMap["flowTimeoutInMinutes"] = vnpf.FlowTimeoutInMinutes - } - if vnpf.Subnets != nil { - objectMap["subnets"] = vnpf.Subnets - } - if vnpf.VirtualNetworkPeerings != nil { - objectMap["virtualNetworkPeerings"] = vnpf.VirtualNetworkPeerings - } - if vnpf.EnableDdosProtection != nil { - objectMap["enableDdosProtection"] = vnpf.EnableDdosProtection - } - if vnpf.EnableVMProtection != nil { - objectMap["enableVmProtection"] = vnpf.EnableVMProtection - } - if vnpf.DdosProtectionPlan != nil { - objectMap["ddosProtectionPlan"] = vnpf.DdosProtectionPlan - } - if vnpf.BgpCommunities != nil { - objectMap["bgpCommunities"] = vnpf.BgpCommunities - } - if vnpf.Encryption != nil { - objectMap["encryption"] = vnpf.Encryption - } - if vnpf.IPAllocations != nil { - objectMap["ipAllocations"] = vnpf.IPAllocations - } - return json.Marshal(objectMap) -} - -// VirtualNetworkTap virtual Network Tap resource. -type VirtualNetworkTap struct { - autorest.Response `json:"-"` - // VirtualNetworkTapPropertiesFormat - Virtual Network Tap Properties. - *VirtualNetworkTapPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkTap. -func (vnt VirtualNetworkTap) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnt.VirtualNetworkTapPropertiesFormat != nil { - objectMap["properties"] = vnt.VirtualNetworkTapPropertiesFormat - } - if vnt.ID != nil { - objectMap["id"] = vnt.ID - } - if vnt.Location != nil { - objectMap["location"] = vnt.Location - } - if vnt.Tags != nil { - objectMap["tags"] = vnt.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetworkTap struct. -func (vnt *VirtualNetworkTap) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualNetworkTapPropertiesFormat VirtualNetworkTapPropertiesFormat - err = json.Unmarshal(*v, &virtualNetworkTapPropertiesFormat) - if err != nil { - return err - } - vnt.VirtualNetworkTapPropertiesFormat = &virtualNetworkTapPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vnt.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vnt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vnt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vnt.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vnt.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vnt.Tags = tags - } - } - } - - return nil -} - -// VirtualNetworkTapListResult response for ListVirtualNetworkTap API service call. -type VirtualNetworkTapListResult struct { - autorest.Response `json:"-"` - // Value - A list of VirtualNetworkTaps in a resource group. - Value *[]VirtualNetworkTap `json:"value,omitempty"` - // NextLink - The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualNetworkTapListResultIterator provides access to a complete listing of VirtualNetworkTap values. -type VirtualNetworkTapListResultIterator struct { - i int - page VirtualNetworkTapListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualNetworkTapListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualNetworkTapListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualNetworkTapListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualNetworkTapListResultIterator) Response() VirtualNetworkTapListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualNetworkTapListResultIterator) Value() VirtualNetworkTap { - if !iter.page.NotDone() { - return VirtualNetworkTap{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualNetworkTapListResultIterator type. -func NewVirtualNetworkTapListResultIterator(page VirtualNetworkTapListResultPage) VirtualNetworkTapListResultIterator { - return VirtualNetworkTapListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vntlr VirtualNetworkTapListResult) IsEmpty() bool { - return vntlr.Value == nil || len(*vntlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vntlr VirtualNetworkTapListResult) hasNextLink() bool { - return vntlr.NextLink != nil && len(*vntlr.NextLink) != 0 -} - -// virtualNetworkTapListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vntlr VirtualNetworkTapListResult) virtualNetworkTapListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vntlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vntlr.NextLink))) -} - -// VirtualNetworkTapListResultPage contains a page of VirtualNetworkTap values. -type VirtualNetworkTapListResultPage struct { - fn func(context.Context, VirtualNetworkTapListResult) (VirtualNetworkTapListResult, error) - vntlr VirtualNetworkTapListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualNetworkTapListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vntlr) - if err != nil { - return err - } - page.vntlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualNetworkTapListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualNetworkTapListResultPage) NotDone() bool { - return !page.vntlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualNetworkTapListResultPage) Response() VirtualNetworkTapListResult { - return page.vntlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualNetworkTapListResultPage) Values() []VirtualNetworkTap { - if page.vntlr.IsEmpty() { - return nil - } - return *page.vntlr.Value -} - -// Creates a new instance of the VirtualNetworkTapListResultPage type. -func NewVirtualNetworkTapListResultPage(cur VirtualNetworkTapListResult, getNextPage func(context.Context, VirtualNetworkTapListResult) (VirtualNetworkTapListResult, error)) VirtualNetworkTapListResultPage { - return VirtualNetworkTapListResultPage{ - fn: getNextPage, - vntlr: cur, - } -} - -// VirtualNetworkTapPropertiesFormat virtual Network Tap properties. -type VirtualNetworkTapPropertiesFormat struct { - // NetworkInterfaceTapConfigurations - READ-ONLY; Specifies the list of resource IDs for the network interface IP configuration that needs to be tapped. - NetworkInterfaceTapConfigurations *[]InterfaceTapConfiguration `json:"networkInterfaceTapConfigurations,omitempty"` - // ResourceGUID - READ-ONLY; The resource GUID property of the virtual network tap resource. - ResourceGUID *string `json:"resourceGuid,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the virtual network tap resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // DestinationNetworkInterfaceIPConfiguration - The reference to the private IP Address of the collector nic that will receive the tap. - DestinationNetworkInterfaceIPConfiguration *InterfaceIPConfiguration `json:"destinationNetworkInterfaceIPConfiguration,omitempty"` - // DestinationLoadBalancerFrontEndIPConfiguration - The reference to the private IP address on the internal Load Balancer that will receive the tap. - DestinationLoadBalancerFrontEndIPConfiguration *FrontendIPConfiguration `json:"destinationLoadBalancerFrontEndIPConfiguration,omitempty"` - // DestinationPort - The VXLAN destination port that will receive the tapped traffic. - DestinationPort *int32 `json:"destinationPort,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkTapPropertiesFormat. -func (vntpf VirtualNetworkTapPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vntpf.DestinationNetworkInterfaceIPConfiguration != nil { - objectMap["destinationNetworkInterfaceIPConfiguration"] = vntpf.DestinationNetworkInterfaceIPConfiguration - } - if vntpf.DestinationLoadBalancerFrontEndIPConfiguration != nil { - objectMap["destinationLoadBalancerFrontEndIPConfiguration"] = vntpf.DestinationLoadBalancerFrontEndIPConfiguration - } - if vntpf.DestinationPort != nil { - objectMap["destinationPort"] = vntpf.DestinationPort - } - return json.Marshal(objectMap) -} - -// VirtualNetworkTapsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkTapsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkTapsClient) (VirtualNetworkTap, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkTapsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkTapsCreateOrUpdateFuture.Result. -func (future *VirtualNetworkTapsCreateOrUpdateFuture) result(client VirtualNetworkTapsClient) (vnt VirtualNetworkTap, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vnt.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkTapsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vnt.Response.Response, err = future.GetResult(sender); err == nil && vnt.Response.Response.StatusCode != http.StatusNoContent { - vnt, err = client.CreateOrUpdateResponder(vnt.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsCreateOrUpdateFuture", "Result", vnt.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkTapsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkTapsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkTapsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkTapsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkTapsDeleteFuture.Result. -func (future *VirtualNetworkTapsDeleteFuture) result(client VirtualNetworkTapsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkTapsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualNetworkUsage usage details for subnet. -type VirtualNetworkUsage struct { - // CurrentValue - READ-ONLY; Indicates number of IPs used from the Subnet. - CurrentValue *float64 `json:"currentValue,omitempty"` - // ID - READ-ONLY; Subnet identifier. - ID *string `json:"id,omitempty"` - // Limit - READ-ONLY; Indicates the size of the subnet. - Limit *float64 `json:"limit,omitempty"` - // Name - READ-ONLY; The name containing common and localized value for usage. - Name *VirtualNetworkUsageName `json:"name,omitempty"` - // Unit - READ-ONLY; Usage units. Returns 'Count'. - Unit *string `json:"unit,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkUsage. -func (vnu VirtualNetworkUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkUsageName usage strings container. -type VirtualNetworkUsageName struct { - // LocalizedValue - READ-ONLY; Localized subnet size and usage string. - LocalizedValue *string `json:"localizedValue,omitempty"` - // Value - READ-ONLY; Subnet size and usage string. - Value *string `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkUsageName. -func (vnun VirtualNetworkUsageName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworksCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworksClient) (VirtualNetwork, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworksCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworksCreateOrUpdateFuture.Result. -func (future *VirtualNetworksCreateOrUpdateFuture) result(client VirtualNetworksClient) (vn VirtualNetwork, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vn.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vn.Response.Response, err = future.GetResult(sender); err == nil && vn.Response.Response.StatusCode != http.StatusNoContent { - vn, err = client.CreateOrUpdateResponder(vn.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", vn.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualNetworksDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworksDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworksDeleteFuture.Result. -func (future *VirtualNetworksDeleteFuture) result(client VirtualNetworksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualNetworksListDdosProtectionStatusAllFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type VirtualNetworksListDdosProtectionStatusAllFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworksClient) (VirtualNetworkDdosProtectionStatusResultPage, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworksListDdosProtectionStatusAllFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworksListDdosProtectionStatusAllFuture.Result. -func (future *VirtualNetworksListDdosProtectionStatusAllFuture) result(client VirtualNetworksClient) (vndpsrp VirtualNetworkDdosProtectionStatusResultPage, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksListDdosProtectionStatusAllFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vndpsrp.vndpsr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksListDdosProtectionStatusAllFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vndpsrp.vndpsr.Response.Response, err = future.GetResult(sender); err == nil && vndpsrp.vndpsr.Response.Response.StatusCode != http.StatusNoContent { - vndpsrp, err = client.ListDdosProtectionStatusResponder(vndpsrp.vndpsr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksListDdosProtectionStatusAllFuture", "Result", vndpsrp.vndpsr.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworksListDdosProtectionStatusFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type VirtualNetworksListDdosProtectionStatusFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworksClient) (VirtualNetworkDdosProtectionStatusResultPage, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworksListDdosProtectionStatusFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworksListDdosProtectionStatusFuture.Result. -func (future *VirtualNetworksListDdosProtectionStatusFuture) result(client VirtualNetworksClient) (vndpsrp VirtualNetworkDdosProtectionStatusResultPage, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksListDdosProtectionStatusFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vndpsrp.vndpsr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksListDdosProtectionStatusFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vndpsrp.vndpsr.Response.Response, err = future.GetResult(sender); err == nil && vndpsrp.vndpsr.Response.Response.StatusCode != http.StatusNoContent { - vndpsrp, err = client.ListDdosProtectionStatusResponder(vndpsrp.vndpsr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksListDdosProtectionStatusFuture", "Result", vndpsrp.vndpsr.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualRouter virtualRouter Resource. -type VirtualRouter struct { - autorest.Response `json:"-"` - // VirtualRouterPropertiesFormat - Properties of the Virtual Router. - *VirtualRouterPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VirtualRouter. -func (vr VirtualRouter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vr.VirtualRouterPropertiesFormat != nil { - objectMap["properties"] = vr.VirtualRouterPropertiesFormat - } - if vr.ID != nil { - objectMap["id"] = vr.ID - } - if vr.Location != nil { - objectMap["location"] = vr.Location - } - if vr.Tags != nil { - objectMap["tags"] = vr.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualRouter struct. -func (vr *VirtualRouter) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualRouterPropertiesFormat VirtualRouterPropertiesFormat - err = json.Unmarshal(*v, &virtualRouterPropertiesFormat) - if err != nil { - return err - } - vr.VirtualRouterPropertiesFormat = &virtualRouterPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vr.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vr.Tags = tags - } - } - } - - return nil -} - -// VirtualRouterAutoScaleConfiguration the VirtualHub Router autoscale configuration. -type VirtualRouterAutoScaleConfiguration struct { - // MinCapacity - The minimum number of scale units for VirtualHub Router. - MinCapacity *int32 `json:"minCapacity,omitempty"` -} - -// VirtualRouterListResult response for ListVirtualRouters API service call. -type VirtualRouterListResult struct { - autorest.Response `json:"-"` - // Value - List of Virtual Routers. - Value *[]VirtualRouter `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualRouterListResultIterator provides access to a complete listing of VirtualRouter values. -type VirtualRouterListResultIterator struct { - i int - page VirtualRouterListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualRouterListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualRouterListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualRouterListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualRouterListResultIterator) Response() VirtualRouterListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualRouterListResultIterator) Value() VirtualRouter { - if !iter.page.NotDone() { - return VirtualRouter{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualRouterListResultIterator type. -func NewVirtualRouterListResultIterator(page VirtualRouterListResultPage) VirtualRouterListResultIterator { - return VirtualRouterListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vrlr VirtualRouterListResult) IsEmpty() bool { - return vrlr.Value == nil || len(*vrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vrlr VirtualRouterListResult) hasNextLink() bool { - return vrlr.NextLink != nil && len(*vrlr.NextLink) != 0 -} - -// virtualRouterListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vrlr VirtualRouterListResult) virtualRouterListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vrlr.NextLink))) -} - -// VirtualRouterListResultPage contains a page of VirtualRouter values. -type VirtualRouterListResultPage struct { - fn func(context.Context, VirtualRouterListResult) (VirtualRouterListResult, error) - vrlr VirtualRouterListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualRouterListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vrlr) - if err != nil { - return err - } - page.vrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualRouterListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualRouterListResultPage) NotDone() bool { - return !page.vrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualRouterListResultPage) Response() VirtualRouterListResult { - return page.vrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualRouterListResultPage) Values() []VirtualRouter { - if page.vrlr.IsEmpty() { - return nil - } - return *page.vrlr.Value -} - -// Creates a new instance of the VirtualRouterListResultPage type. -func NewVirtualRouterListResultPage(cur VirtualRouterListResult, getNextPage func(context.Context, VirtualRouterListResult) (VirtualRouterListResult, error)) VirtualRouterListResultPage { - return VirtualRouterListResultPage{ - fn: getNextPage, - vrlr: cur, - } -} - -// VirtualRouterPeering virtual Router Peering resource. -type VirtualRouterPeering struct { - autorest.Response `json:"-"` - // VirtualRouterPeeringProperties - The properties of the Virtual Router Peering. - *VirtualRouterPeeringProperties `json:"properties,omitempty"` - // Name - Name of the virtual router peering that is unique within a virtual router. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Peering type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualRouterPeering. -func (vrp VirtualRouterPeering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vrp.VirtualRouterPeeringProperties != nil { - objectMap["properties"] = vrp.VirtualRouterPeeringProperties - } - if vrp.Name != nil { - objectMap["name"] = vrp.Name - } - if vrp.ID != nil { - objectMap["id"] = vrp.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualRouterPeering struct. -func (vrp *VirtualRouterPeering) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualRouterPeeringProperties VirtualRouterPeeringProperties - err = json.Unmarshal(*v, &virtualRouterPeeringProperties) - if err != nil { - return err - } - vrp.VirtualRouterPeeringProperties = &virtualRouterPeeringProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vrp.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vrp.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vrp.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vrp.ID = &ID - } - } - } - - return nil -} - -// VirtualRouterPeeringListResult response for ListVirtualRouterPeerings API service call. -type VirtualRouterPeeringListResult struct { - autorest.Response `json:"-"` - // Value - List of VirtualRouterPeerings in a VirtualRouter. - Value *[]VirtualRouterPeering `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualRouterPeeringListResultIterator provides access to a complete listing of VirtualRouterPeering -// values. -type VirtualRouterPeeringListResultIterator struct { - i int - page VirtualRouterPeeringListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualRouterPeeringListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterPeeringListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualRouterPeeringListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualRouterPeeringListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualRouterPeeringListResultIterator) Response() VirtualRouterPeeringListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualRouterPeeringListResultIterator) Value() VirtualRouterPeering { - if !iter.page.NotDone() { - return VirtualRouterPeering{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualRouterPeeringListResultIterator type. -func NewVirtualRouterPeeringListResultIterator(page VirtualRouterPeeringListResultPage) VirtualRouterPeeringListResultIterator { - return VirtualRouterPeeringListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vrplr VirtualRouterPeeringListResult) IsEmpty() bool { - return vrplr.Value == nil || len(*vrplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vrplr VirtualRouterPeeringListResult) hasNextLink() bool { - return vrplr.NextLink != nil && len(*vrplr.NextLink) != 0 -} - -// virtualRouterPeeringListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vrplr VirtualRouterPeeringListResult) virtualRouterPeeringListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vrplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vrplr.NextLink))) -} - -// VirtualRouterPeeringListResultPage contains a page of VirtualRouterPeering values. -type VirtualRouterPeeringListResultPage struct { - fn func(context.Context, VirtualRouterPeeringListResult) (VirtualRouterPeeringListResult, error) - vrplr VirtualRouterPeeringListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualRouterPeeringListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterPeeringListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vrplr) - if err != nil { - return err - } - page.vrplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualRouterPeeringListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualRouterPeeringListResultPage) NotDone() bool { - return !page.vrplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualRouterPeeringListResultPage) Response() VirtualRouterPeeringListResult { - return page.vrplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualRouterPeeringListResultPage) Values() []VirtualRouterPeering { - if page.vrplr.IsEmpty() { - return nil - } - return *page.vrplr.Value -} - -// Creates a new instance of the VirtualRouterPeeringListResultPage type. -func NewVirtualRouterPeeringListResultPage(cur VirtualRouterPeeringListResult, getNextPage func(context.Context, VirtualRouterPeeringListResult) (VirtualRouterPeeringListResult, error)) VirtualRouterPeeringListResultPage { - return VirtualRouterPeeringListResultPage{ - fn: getNextPage, - vrplr: cur, - } -} - -// VirtualRouterPeeringProperties properties of the rule group. -type VirtualRouterPeeringProperties struct { - // PeerAsn - Peer ASN. - PeerAsn *int64 `json:"peerAsn,omitempty"` - // PeerIP - Peer IP. - PeerIP *string `json:"peerIp,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualRouterPeeringProperties. -func (vrpp VirtualRouterPeeringProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vrpp.PeerAsn != nil { - objectMap["peerAsn"] = vrpp.PeerAsn - } - if vrpp.PeerIP != nil { - objectMap["peerIp"] = vrpp.PeerIP - } - return json.Marshal(objectMap) -} - -// VirtualRouterPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualRouterPeeringsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualRouterPeeringsClient) (VirtualRouterPeering, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualRouterPeeringsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualRouterPeeringsCreateOrUpdateFuture.Result. -func (future *VirtualRouterPeeringsCreateOrUpdateFuture) result(client VirtualRouterPeeringsClient) (vrp VirtualRouterPeering, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualRouterPeeringsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vrp.Response.Response, err = future.GetResult(sender); err == nil && vrp.Response.Response.StatusCode != http.StatusNoContent { - vrp, err = client.CreateOrUpdateResponder(vrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsCreateOrUpdateFuture", "Result", vrp.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualRouterPeeringsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualRouterPeeringsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualRouterPeeringsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualRouterPeeringsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualRouterPeeringsDeleteFuture.Result. -func (future *VirtualRouterPeeringsDeleteFuture) result(client VirtualRouterPeeringsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualRouterPeeringsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualRouterPropertiesFormat virtual Router definition. -type VirtualRouterPropertiesFormat struct { - // VirtualRouterAsn - VirtualRouter ASN. - VirtualRouterAsn *int64 `json:"virtualRouterAsn,omitempty"` - // VirtualRouterIps - VirtualRouter IPs. - VirtualRouterIps *[]string `json:"virtualRouterIps,omitempty"` - // HostedSubnet - The Subnet on which VirtualRouter is hosted. - HostedSubnet *SubResource `json:"hostedSubnet,omitempty"` - // HostedGateway - The Gateway on which VirtualRouter is hosted. - HostedGateway *SubResource `json:"hostedGateway,omitempty"` - // Peerings - READ-ONLY; List of references to VirtualRouterPeerings. - Peerings *[]SubResource `json:"peerings,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualRouterPropertiesFormat. -func (vrpf VirtualRouterPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vrpf.VirtualRouterAsn != nil { - objectMap["virtualRouterAsn"] = vrpf.VirtualRouterAsn - } - if vrpf.VirtualRouterIps != nil { - objectMap["virtualRouterIps"] = vrpf.VirtualRouterIps - } - if vrpf.HostedSubnet != nil { - objectMap["hostedSubnet"] = vrpf.HostedSubnet - } - if vrpf.HostedGateway != nil { - objectMap["hostedGateway"] = vrpf.HostedGateway - } - return json.Marshal(objectMap) -} - -// VirtualRoutersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualRoutersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualRoutersClient) (VirtualRouter, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualRoutersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualRoutersCreateOrUpdateFuture.Result. -func (future *VirtualRoutersCreateOrUpdateFuture) result(client VirtualRoutersClient) (vr VirtualRouter, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualRoutersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualRoutersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vr.Response.Response, err = future.GetResult(sender); err == nil && vr.Response.Response.StatusCode != http.StatusNoContent { - vr, err = client.CreateOrUpdateResponder(vr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualRoutersCreateOrUpdateFuture", "Result", vr.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualRoutersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualRoutersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualRoutersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualRoutersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualRoutersDeleteFuture.Result. -func (future *VirtualRoutersDeleteFuture) result(client VirtualRoutersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualRoutersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualRoutersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VirtualWAN virtualWAN Resource. -type VirtualWAN struct { - autorest.Response `json:"-"` - // VirtualWanProperties - Properties of the virtual WAN. - *VirtualWanProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VirtualWAN. -func (vw VirtualWAN) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vw.VirtualWanProperties != nil { - objectMap["properties"] = vw.VirtualWanProperties - } - if vw.ID != nil { - objectMap["id"] = vw.ID - } - if vw.Location != nil { - objectMap["location"] = vw.Location - } - if vw.Tags != nil { - objectMap["tags"] = vw.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualWAN struct. -func (vw *VirtualWAN) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualWanProperties VirtualWanProperties - err = json.Unmarshal(*v, &virtualWanProperties) - if err != nil { - return err - } - vw.VirtualWanProperties = &virtualWanProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vw.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vw.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vw.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vw.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vw.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vw.Tags = tags - } - } - } - - return nil -} - -// VirtualWanProperties parameters for VirtualWAN. -type VirtualWanProperties struct { - // DisableVpnEncryption - Vpn encryption to be disabled or not. - DisableVpnEncryption *bool `json:"disableVpnEncryption,omitempty"` - // VirtualHubs - READ-ONLY; List of VirtualHubs in the VirtualWAN. - VirtualHubs *[]SubResource `json:"virtualHubs,omitempty"` - // VpnSites - READ-ONLY; List of VpnSites in the VirtualWAN. - VpnSites *[]SubResource `json:"vpnSites,omitempty"` - // AllowBranchToBranchTraffic - True if branch to branch traffic is allowed. - AllowBranchToBranchTraffic *bool `json:"allowBranchToBranchTraffic,omitempty"` - // AllowVnetToVnetTraffic - True if Vnet to Vnet traffic is allowed. - AllowVnetToVnetTraffic *bool `json:"allowVnetToVnetTraffic,omitempty"` - // Office365LocalBreakoutCategory - The office local breakout category. Possible values include: 'OfficeTrafficCategoryOptimize', 'OfficeTrafficCategoryOptimizeAndAllow', 'OfficeTrafficCategoryAll', 'OfficeTrafficCategoryNone' - Office365LocalBreakoutCategory OfficeTrafficCategory `json:"office365LocalBreakoutCategory,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the virtual WAN resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Type - The type of the VirtualWAN. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualWanProperties. -func (vwp VirtualWanProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vwp.DisableVpnEncryption != nil { - objectMap["disableVpnEncryption"] = vwp.DisableVpnEncryption - } - if vwp.AllowBranchToBranchTraffic != nil { - objectMap["allowBranchToBranchTraffic"] = vwp.AllowBranchToBranchTraffic - } - if vwp.AllowVnetToVnetTraffic != nil { - objectMap["allowVnetToVnetTraffic"] = vwp.AllowVnetToVnetTraffic - } - if vwp.Office365LocalBreakoutCategory != "" { - objectMap["office365LocalBreakoutCategory"] = vwp.Office365LocalBreakoutCategory - } - if vwp.Type != nil { - objectMap["type"] = vwp.Type - } - return json.Marshal(objectMap) -} - -// VirtualWanSecurityProvider collection of SecurityProviders. -type VirtualWanSecurityProvider struct { - // Name - Name of the security provider. - Name *string `json:"name,omitempty"` - // URL - Url of the security provider. - URL *string `json:"url,omitempty"` - // Type - Name of the security provider. Possible values include: 'VirtualWanSecurityProviderTypeExternal', 'VirtualWanSecurityProviderTypeNative' - Type VirtualWanSecurityProviderType `json:"type,omitempty"` -} - -// VirtualWanSecurityProviders collection of SecurityProviders. -type VirtualWanSecurityProviders struct { - autorest.Response `json:"-"` - // SupportedProviders - List of VirtualWAN security providers. - SupportedProviders *[]VirtualWanSecurityProvider `json:"supportedProviders,omitempty"` -} - -// VirtualWanVpnProfileParameters virtual Wan Vpn profile parameters Vpn profile generation. -type VirtualWanVpnProfileParameters struct { - // VpnServerConfigurationResourceID - VpnServerConfiguration partial resource uri with which VirtualWan is associated to. - VpnServerConfigurationResourceID *string `json:"vpnServerConfigurationResourceId,omitempty"` - // AuthenticationMethod - VPN client authentication method. Possible values include: 'AuthenticationMethodEAPTLS', 'AuthenticationMethodEAPMSCHAPv2' - AuthenticationMethod AuthenticationMethod `json:"authenticationMethod,omitempty"` -} - -// VirtualWansCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualWansCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualWansClient) (VirtualWAN, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualWansCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualWansCreateOrUpdateFuture.Result. -func (future *VirtualWansCreateOrUpdateFuture) result(client VirtualWansClient) (vw VirtualWAN, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualWansCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vw.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualWansCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vw.Response.Response, err = future.GetResult(sender); err == nil && vw.Response.Response.StatusCode != http.StatusNoContent { - vw, err = client.CreateOrUpdateResponder(vw.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualWansCreateOrUpdateFuture", "Result", vw.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualWansDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VirtualWansDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualWansClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualWansDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualWansDeleteFuture.Result. -func (future *VirtualWansDeleteFuture) result(client VirtualWansClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualWansDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VirtualWansDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VnetRoute list of routes that control routing from VirtualHub into a virtual network connection. -type VnetRoute struct { - // StaticRoutesConfig - Configuration for static routes on this HubVnetConnection. - StaticRoutesConfig *StaticRoutesConfig `json:"staticRoutesConfig,omitempty"` - // StaticRoutes - List of all Static Routes. - StaticRoutes *[]StaticRoute `json:"staticRoutes,omitempty"` - // BgpConnections - READ-ONLY; The list of references to HubBgpConnection objects. - BgpConnections *[]SubResource `json:"bgpConnections,omitempty"` -} - -// MarshalJSON is the custom marshaler for VnetRoute. -func (vr VnetRoute) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vr.StaticRoutesConfig != nil { - objectMap["staticRoutesConfig"] = vr.StaticRoutesConfig - } - if vr.StaticRoutes != nil { - objectMap["staticRoutes"] = vr.StaticRoutes - } - return json.Marshal(objectMap) -} - -// VngClientConnectionConfiguration a vpn client connection configuration for client connection -// configuration. -type VngClientConnectionConfiguration struct { - // VngClientConnectionConfigurationProperties - Properties of the vpn client root certificate. - *VngClientConnectionConfigurationProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for VngClientConnectionConfiguration. -func (vccc VngClientConnectionConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vccc.VngClientConnectionConfigurationProperties != nil { - objectMap["properties"] = vccc.VngClientConnectionConfigurationProperties - } - if vccc.Name != nil { - objectMap["name"] = vccc.Name - } - if vccc.ID != nil { - objectMap["id"] = vccc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VngClientConnectionConfiguration struct. -func (vccc *VngClientConnectionConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var vngClientConnectionConfigurationProperties VngClientConnectionConfigurationProperties - err = json.Unmarshal(*v, &vngClientConnectionConfigurationProperties) - if err != nil { - return err - } - vccc.VngClientConnectionConfigurationProperties = &vngClientConnectionConfigurationProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vccc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vccc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vccc.ID = &ID - } - } - } - - return nil -} - -// VngClientConnectionConfigurationProperties properties of VngClientConnectionConfiguration. -type VngClientConnectionConfigurationProperties struct { - // VpnClientAddressPool - The reference to the address space resource which represents Address space for P2S VpnClient. - VpnClientAddressPool *AddressSpace `json:"vpnClientAddressPool,omitempty"` - // VirtualNetworkGatewayPolicyGroups - List of references to virtualNetworkGatewayPolicyGroups - VirtualNetworkGatewayPolicyGroups *[]SubResource `json:"virtualNetworkGatewayPolicyGroups,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the VngClientConnectionConfiguration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for VngClientConnectionConfigurationProperties. -func (vcccp VngClientConnectionConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vcccp.VpnClientAddressPool != nil { - objectMap["vpnClientAddressPool"] = vcccp.VpnClientAddressPool - } - if vcccp.VirtualNetworkGatewayPolicyGroups != nil { - objectMap["virtualNetworkGatewayPolicyGroups"] = vcccp.VirtualNetworkGatewayPolicyGroups - } - return json.Marshal(objectMap) -} - -// VpnClientConfiguration vpnClientConfiguration for P2S client. -type VpnClientConfiguration struct { - // VpnClientAddressPool - The reference to the address space resource which represents Address space for P2S VpnClient. - VpnClientAddressPool *AddressSpace `json:"vpnClientAddressPool,omitempty"` - // VpnClientRootCertificates - VpnClientRootCertificate for virtual network gateway. - VpnClientRootCertificates *[]VpnClientRootCertificate `json:"vpnClientRootCertificates,omitempty"` - // VpnClientRevokedCertificates - VpnClientRevokedCertificate for Virtual network gateway. - VpnClientRevokedCertificates *[]VpnClientRevokedCertificate `json:"vpnClientRevokedCertificates,omitempty"` - // VpnClientProtocols - VpnClientProtocols for Virtual network gateway. - VpnClientProtocols *[]VpnClientProtocol `json:"vpnClientProtocols,omitempty"` - // VpnAuthenticationTypes - VPN authentication types for the virtual network gateway.. - VpnAuthenticationTypes *[]VpnAuthenticationType `json:"vpnAuthenticationTypes,omitempty"` - // VpnClientIpsecPolicies - VpnClientIpsecPolicies for virtual network gateway P2S client. - VpnClientIpsecPolicies *[]IpsecPolicy `json:"vpnClientIpsecPolicies,omitempty"` - // RadiusServerAddress - The radius server address property of the VirtualNetworkGateway resource for vpn client connection. - RadiusServerAddress *string `json:"radiusServerAddress,omitempty"` - // RadiusServerSecret - The radius secret property of the VirtualNetworkGateway resource for vpn client connection. - RadiusServerSecret *string `json:"radiusServerSecret,omitempty"` - // RadiusServers - The radiusServers property for multiple radius server configuration. - RadiusServers *[]RadiusServer `json:"radiusServers,omitempty"` - // AadTenant - The AADTenant property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. - AadTenant *string `json:"aadTenant,omitempty"` - // AadAudience - The AADAudience property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. - AadAudience *string `json:"aadAudience,omitempty"` - // AadIssuer - The AADIssuer property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. - AadIssuer *string `json:"aadIssuer,omitempty"` - // VngClientConnectionConfigurations - per ip address pool connection policy for virtual network gateway P2S client. - VngClientConnectionConfigurations *[]VngClientConnectionConfiguration `json:"vngClientConnectionConfigurations,omitempty"` -} - -// VpnClientConnectionHealth vpnClientConnectionHealth properties. -type VpnClientConnectionHealth struct { - // TotalIngressBytesTransferred - READ-ONLY; Total of the Ingress Bytes Transferred in this P2S Vpn connection. - TotalIngressBytesTransferred *int64 `json:"totalIngressBytesTransferred,omitempty"` - // TotalEgressBytesTransferred - READ-ONLY; Total of the Egress Bytes Transferred in this connection. - TotalEgressBytesTransferred *int64 `json:"totalEgressBytesTransferred,omitempty"` - // VpnClientConnectionsCount - The total of p2s vpn clients connected at this time to this P2SVpnGateway. - VpnClientConnectionsCount *int32 `json:"vpnClientConnectionsCount,omitempty"` - // AllocatedIPAddresses - List of allocated ip addresses to the connected p2s vpn clients. - AllocatedIPAddresses *[]string `json:"allocatedIpAddresses,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnClientConnectionHealth. -func (vcch VpnClientConnectionHealth) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vcch.VpnClientConnectionsCount != nil { - objectMap["vpnClientConnectionsCount"] = vcch.VpnClientConnectionsCount - } - if vcch.AllocatedIPAddresses != nil { - objectMap["allocatedIpAddresses"] = vcch.AllocatedIPAddresses - } - return json.Marshal(objectMap) -} - -// VpnClientConnectionHealthDetail VPN client connection health detail. -type VpnClientConnectionHealthDetail struct { - // VpnConnectionID - READ-ONLY; The vpn client Id. - VpnConnectionID *string `json:"vpnConnectionId,omitempty"` - // VpnConnectionDuration - READ-ONLY; The duration time of a connected vpn client. - VpnConnectionDuration *int64 `json:"vpnConnectionDuration,omitempty"` - // VpnConnectionTime - READ-ONLY; The start time of a connected vpn client. - VpnConnectionTime *string `json:"vpnConnectionTime,omitempty"` - // PublicIPAddress - READ-ONLY; The public Ip of a connected vpn client. - PublicIPAddress *string `json:"publicIpAddress,omitempty"` - // PrivateIPAddress - READ-ONLY; The assigned private Ip of a connected vpn client. - PrivateIPAddress *string `json:"privateIpAddress,omitempty"` - // VpnUserName - READ-ONLY; The user name of a connected vpn client. - VpnUserName *string `json:"vpnUserName,omitempty"` - // MaxBandwidth - READ-ONLY; The max band width. - MaxBandwidth *int64 `json:"maxBandwidth,omitempty"` - // EgressPacketsTransferred - READ-ONLY; The egress packets per second. - EgressPacketsTransferred *int64 `json:"egressPacketsTransferred,omitempty"` - // EgressBytesTransferred - READ-ONLY; The egress bytes per second. - EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` - // IngressPacketsTransferred - READ-ONLY; The ingress packets per second. - IngressPacketsTransferred *int64 `json:"ingressPacketsTransferred,omitempty"` - // IngressBytesTransferred - READ-ONLY; The ingress bytes per second. - IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` - // MaxPacketsPerSecond - READ-ONLY; The max packets transferred per second. - MaxPacketsPerSecond *int64 `json:"maxPacketsPerSecond,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnClientConnectionHealthDetail. -func (vcchd VpnClientConnectionHealthDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VpnClientConnectionHealthDetailListResult list of virtual network gateway vpn client connection health. -type VpnClientConnectionHealthDetailListResult struct { - autorest.Response `json:"-"` - // Value - List of vpn client connection health. - Value *[]VpnClientConnectionHealthDetail `json:"value,omitempty"` -} - -// VpnClientIPsecParameters an IPSec parameters for a virtual network gateway P2S connection. -type VpnClientIPsecParameters struct { - autorest.Response `json:"-"` - // SaLifeTimeSeconds - The IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for P2S client. - SaLifeTimeSeconds *int32 `json:"saLifeTimeSeconds,omitempty"` - // SaDataSizeKilobytes - The IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB for P2S client.. - SaDataSizeKilobytes *int32 `json:"saDataSizeKilobytes,omitempty"` - // IpsecEncryption - The IPSec encryption algorithm (IKE phase 1). Possible values include: 'IpsecEncryptionNone', 'IpsecEncryptionDES', 'IpsecEncryptionDES3', 'IpsecEncryptionAES128', 'IpsecEncryptionAES192', 'IpsecEncryptionAES256', 'IpsecEncryptionGCMAES128', 'IpsecEncryptionGCMAES192', 'IpsecEncryptionGCMAES256' - IpsecEncryption IpsecEncryption `json:"ipsecEncryption,omitempty"` - // IpsecIntegrity - The IPSec integrity algorithm (IKE phase 1). Possible values include: 'IpsecIntegrityMD5', 'IpsecIntegritySHA1', 'IpsecIntegritySHA256', 'IpsecIntegrityGCMAES128', 'IpsecIntegrityGCMAES192', 'IpsecIntegrityGCMAES256' - IpsecIntegrity IpsecIntegrity `json:"ipsecIntegrity,omitempty"` - // IkeEncryption - The IKE encryption algorithm (IKE phase 2). Possible values include: 'IkeEncryptionDES', 'IkeEncryptionDES3', 'IkeEncryptionAES128', 'IkeEncryptionAES192', 'IkeEncryptionAES256', 'IkeEncryptionGCMAES256', 'IkeEncryptionGCMAES128' - IkeEncryption IkeEncryption `json:"ikeEncryption,omitempty"` - // IkeIntegrity - The IKE integrity algorithm (IKE phase 2). Possible values include: 'IkeIntegrityMD5', 'IkeIntegritySHA1', 'IkeIntegritySHA256', 'IkeIntegritySHA384', 'IkeIntegrityGCMAES256', 'IkeIntegrityGCMAES128' - IkeIntegrity IkeIntegrity `json:"ikeIntegrity,omitempty"` - // DhGroup - The DH Group used in IKE Phase 1 for initial SA. Possible values include: 'DhGroupNone', 'DhGroupDHGroup1', 'DhGroupDHGroup2', 'DhGroupDHGroup14', 'DhGroupDHGroup2048', 'DhGroupECP256', 'DhGroupECP384', 'DhGroupDHGroup24' - DhGroup DhGroup `json:"dhGroup,omitempty"` - // PfsGroup - The Pfs Group used in IKE Phase 2 for new child SA. Possible values include: 'PfsGroupNone', 'PfsGroupPFS1', 'PfsGroupPFS2', 'PfsGroupPFS2048', 'PfsGroupECP256', 'PfsGroupECP384', 'PfsGroupPFS24', 'PfsGroupPFS14', 'PfsGroupPFSMM' - PfsGroup PfsGroup `json:"pfsGroup,omitempty"` -} - -// VpnClientParameters vpn Client Parameters for package generation. -type VpnClientParameters struct { - // ProcessorArchitecture - VPN client Processor Architecture. Possible values include: 'ProcessorArchitectureAmd64', 'ProcessorArchitectureX86' - ProcessorArchitecture ProcessorArchitecture `json:"processorArchitecture,omitempty"` - // AuthenticationMethod - VPN client authentication method. Possible values include: 'AuthenticationMethodEAPTLS', 'AuthenticationMethodEAPMSCHAPv2' - AuthenticationMethod AuthenticationMethod `json:"authenticationMethod,omitempty"` - // RadiusServerAuthCertificate - 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. - RadiusServerAuthCertificate *string `json:"radiusServerAuthCertificate,omitempty"` - // ClientRootCertificates - A list of client root certificates public certificate data encoded as Base-64 strings. Optional parameter for external radius based authentication with EAPTLS. - ClientRootCertificates *[]string `json:"clientRootCertificates,omitempty"` -} - -// VpnClientRevokedCertificate VPN client revoked certificate of virtual network gateway. -type VpnClientRevokedCertificate struct { - // VpnClientRevokedCertificatePropertiesFormat - Properties of the vpn client revoked certificate. - *VpnClientRevokedCertificatePropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnClientRevokedCertificate. -func (vcrc VpnClientRevokedCertificate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vcrc.VpnClientRevokedCertificatePropertiesFormat != nil { - objectMap["properties"] = vcrc.VpnClientRevokedCertificatePropertiesFormat - } - if vcrc.Name != nil { - objectMap["name"] = vcrc.Name - } - if vcrc.ID != nil { - objectMap["id"] = vcrc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VpnClientRevokedCertificate struct. -func (vcrc *VpnClientRevokedCertificate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var vpnClientRevokedCertificatePropertiesFormat VpnClientRevokedCertificatePropertiesFormat - err = json.Unmarshal(*v, &vpnClientRevokedCertificatePropertiesFormat) - if err != nil { - return err - } - vcrc.VpnClientRevokedCertificatePropertiesFormat = &vpnClientRevokedCertificatePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vcrc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vcrc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vcrc.ID = &ID - } - } - } - - return nil -} - -// VpnClientRevokedCertificatePropertiesFormat properties of the revoked VPN client certificate of virtual -// network gateway. -type VpnClientRevokedCertificatePropertiesFormat struct { - // Thumbprint - The revoked VPN client certificate thumbprint. - Thumbprint *string `json:"thumbprint,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the VPN client revoked certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnClientRevokedCertificatePropertiesFormat. -func (vcrcpf VpnClientRevokedCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vcrcpf.Thumbprint != nil { - objectMap["thumbprint"] = vcrcpf.Thumbprint - } - return json.Marshal(objectMap) -} - -// VpnClientRootCertificate VPN client root certificate of virtual network gateway. -type VpnClientRootCertificate struct { - // VpnClientRootCertificatePropertiesFormat - Properties of the vpn client root certificate. - *VpnClientRootCertificatePropertiesFormat `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnClientRootCertificate. -func (vcrc VpnClientRootCertificate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vcrc.VpnClientRootCertificatePropertiesFormat != nil { - objectMap["properties"] = vcrc.VpnClientRootCertificatePropertiesFormat - } - if vcrc.Name != nil { - objectMap["name"] = vcrc.Name - } - if vcrc.ID != nil { - objectMap["id"] = vcrc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VpnClientRootCertificate struct. -func (vcrc *VpnClientRootCertificate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var vpnClientRootCertificatePropertiesFormat VpnClientRootCertificatePropertiesFormat - err = json.Unmarshal(*v, &vpnClientRootCertificatePropertiesFormat) - if err != nil { - return err - } - vcrc.VpnClientRootCertificatePropertiesFormat = &vpnClientRootCertificatePropertiesFormat - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vcrc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vcrc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vcrc.ID = &ID - } - } - } - - return nil -} - -// VpnClientRootCertificatePropertiesFormat properties of SSL certificates of application gateway. -type VpnClientRootCertificatePropertiesFormat struct { - // PublicCertData - The certificate public data. - PublicCertData *string `json:"publicCertData,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the VPN client root certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnClientRootCertificatePropertiesFormat. -func (vcrcpf VpnClientRootCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vcrcpf.PublicCertData != nil { - objectMap["publicCertData"] = vcrcpf.PublicCertData - } - return json.Marshal(objectMap) -} - -// VpnConnection vpnConnection Resource. -type VpnConnection struct { - autorest.Response `json:"-"` - // VpnConnectionProperties - Properties of the VPN connection. - *VpnConnectionProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnConnection. -func (vc VpnConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vc.VpnConnectionProperties != nil { - objectMap["properties"] = vc.VpnConnectionProperties - } - if vc.Name != nil { - objectMap["name"] = vc.Name - } - if vc.ID != nil { - objectMap["id"] = vc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VpnConnection struct. -func (vc *VpnConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var vpnConnectionProperties VpnConnectionProperties - err = json.Unmarshal(*v, &vpnConnectionProperties) - if err != nil { - return err - } - vc.VpnConnectionProperties = &vpnConnectionProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vc.ID = &ID - } - } - } - - return nil -} - -// VpnConnectionPacketCaptureStartParameters vpn Connection packet capture parameters supplied to start -// packet capture on gateway connection. -type VpnConnectionPacketCaptureStartParameters struct { - // FilterData - Start Packet capture parameters on vpn connection. - FilterData *string `json:"filterData,omitempty"` - // LinkConnectionNames - List of site link connection names. - LinkConnectionNames *[]string `json:"linkConnectionNames,omitempty"` -} - -// VpnConnectionPacketCaptureStopParameters vpn Connection packet capture parameters supplied to stop -// packet capture on gateway connection. -type VpnConnectionPacketCaptureStopParameters struct { - // SasURL - SAS url for packet capture on vpn connection. - SasURL *string `json:"sasUrl,omitempty"` - // LinkConnectionNames - List of site link connection names. - LinkConnectionNames *[]string `json:"linkConnectionNames,omitempty"` -} - -// VpnConnectionProperties parameters for VpnConnection. -type VpnConnectionProperties struct { - // RemoteVpnSite - Id of the connected vpn site. - RemoteVpnSite *SubResource `json:"remoteVpnSite,omitempty"` - // RoutingWeight - Routing weight for vpn connection. - RoutingWeight *int32 `json:"routingWeight,omitempty"` - // DpdTimeoutSeconds - DPD timeout in seconds for vpn connection. - DpdTimeoutSeconds *int32 `json:"dpdTimeoutSeconds,omitempty"` - // ConnectionStatus - The connection status. Possible values include: 'VpnConnectionStatusUnknown', 'VpnConnectionStatusConnecting', 'VpnConnectionStatusConnected', 'VpnConnectionStatusNotConnected' - ConnectionStatus VpnConnectionStatus `json:"connectionStatus,omitempty"` - // VpnConnectionProtocolType - Connection protocol used for this connection. Possible values include: 'VirtualNetworkGatewayConnectionProtocolIKEv2', 'VirtualNetworkGatewayConnectionProtocolIKEv1' - VpnConnectionProtocolType VirtualNetworkGatewayConnectionProtocol `json:"vpnConnectionProtocolType,omitempty"` - // IngressBytesTransferred - READ-ONLY; Ingress bytes transferred. - IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` - // EgressBytesTransferred - READ-ONLY; Egress bytes transferred. - EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` - // ConnectionBandwidth - Expected bandwidth in MBPS. - ConnectionBandwidth *int32 `json:"connectionBandwidth,omitempty"` - // SharedKey - SharedKey for the vpn connection. - SharedKey *string `json:"sharedKey,omitempty"` - // EnableBgp - EnableBgp flag. - EnableBgp *bool `json:"enableBgp,omitempty"` - // UsePolicyBasedTrafficSelectors - Enable policy-based traffic selectors. - UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` - // IpsecPolicies - The IPSec Policies to be considered by this connection. - IpsecPolicies *[]IpsecPolicy `json:"ipsecPolicies,omitempty"` - // TrafficSelectorPolicies - The Traffic Selector Policies to be considered by this connection. - TrafficSelectorPolicies *[]TrafficSelectorPolicy `json:"trafficSelectorPolicies,omitempty"` - // EnableRateLimiting - EnableBgp flag. - EnableRateLimiting *bool `json:"enableRateLimiting,omitempty"` - // EnableInternetSecurity - Enable internet security. - EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` - // UseLocalAzureIPAddress - Use local azure ip to initiate connection. - UseLocalAzureIPAddress *bool `json:"useLocalAzureIpAddress,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the VPN connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // VpnLinkConnections - List of all vpn site link connections to the gateway. - VpnLinkConnections *[]VpnSiteLinkConnection `json:"vpnLinkConnections,omitempty"` - // RoutingConfiguration - The Routing Configuration indicating the associated and propagated route tables on this connection. - RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnConnectionProperties. -func (vcp VpnConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vcp.RemoteVpnSite != nil { - objectMap["remoteVpnSite"] = vcp.RemoteVpnSite - } - if vcp.RoutingWeight != nil { - objectMap["routingWeight"] = vcp.RoutingWeight - } - if vcp.DpdTimeoutSeconds != nil { - objectMap["dpdTimeoutSeconds"] = vcp.DpdTimeoutSeconds - } - if vcp.ConnectionStatus != "" { - objectMap["connectionStatus"] = vcp.ConnectionStatus - } - if vcp.VpnConnectionProtocolType != "" { - objectMap["vpnConnectionProtocolType"] = vcp.VpnConnectionProtocolType - } - if vcp.ConnectionBandwidth != nil { - objectMap["connectionBandwidth"] = vcp.ConnectionBandwidth - } - if vcp.SharedKey != nil { - objectMap["sharedKey"] = vcp.SharedKey - } - if vcp.EnableBgp != nil { - objectMap["enableBgp"] = vcp.EnableBgp - } - if vcp.UsePolicyBasedTrafficSelectors != nil { - objectMap["usePolicyBasedTrafficSelectors"] = vcp.UsePolicyBasedTrafficSelectors - } - if vcp.IpsecPolicies != nil { - objectMap["ipsecPolicies"] = vcp.IpsecPolicies - } - if vcp.TrafficSelectorPolicies != nil { - objectMap["trafficSelectorPolicies"] = vcp.TrafficSelectorPolicies - } - if vcp.EnableRateLimiting != nil { - objectMap["enableRateLimiting"] = vcp.EnableRateLimiting - } - if vcp.EnableInternetSecurity != nil { - objectMap["enableInternetSecurity"] = vcp.EnableInternetSecurity - } - if vcp.UseLocalAzureIPAddress != nil { - objectMap["useLocalAzureIpAddress"] = vcp.UseLocalAzureIPAddress - } - if vcp.VpnLinkConnections != nil { - objectMap["vpnLinkConnections"] = vcp.VpnLinkConnections - } - if vcp.RoutingConfiguration != nil { - objectMap["routingConfiguration"] = vcp.RoutingConfiguration - } - return json.Marshal(objectMap) -} - -// VpnConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VpnConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnConnectionsClient) (VpnConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnConnectionsCreateOrUpdateFuture.Result. -func (future *VpnConnectionsCreateOrUpdateFuture) result(client VpnConnectionsClient) (vc VpnConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vc.Response.Response, err = future.GetResult(sender); err == nil && vc.Response.Response.StatusCode != http.StatusNoContent { - vc, err = client.CreateOrUpdateResponder(vc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnConnectionsCreateOrUpdateFuture", "Result", vc.Response.Response, "Failure responding to request") - } - } - return -} - -// VpnConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VpnConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnConnectionsDeleteFuture.Result. -func (future *VpnConnectionsDeleteFuture) result(client VpnConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VpnConnectionsStartPacketCaptureFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VpnConnectionsStartPacketCaptureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnConnectionsClient) (String, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnConnectionsStartPacketCaptureFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnConnectionsStartPacketCaptureFuture.Result. -func (future *VpnConnectionsStartPacketCaptureFuture) result(client VpnConnectionsClient) (s String, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnConnectionsStartPacketCaptureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnConnectionsStartPacketCaptureFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.StartPacketCaptureResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnConnectionsStartPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// VpnConnectionsStopPacketCaptureFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VpnConnectionsStopPacketCaptureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnConnectionsClient) (String, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnConnectionsStopPacketCaptureFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnConnectionsStopPacketCaptureFuture.Result. -func (future *VpnConnectionsStopPacketCaptureFuture) result(client VpnConnectionsClient) (s String, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnConnectionsStopPacketCaptureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnConnectionsStopPacketCaptureFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.StopPacketCaptureResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnConnectionsStopPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// VpnDeviceScriptParameters vpn device configuration script generation parameters. -type VpnDeviceScriptParameters struct { - // Vendor - The vendor for the vpn device. - Vendor *string `json:"vendor,omitempty"` - // DeviceFamily - The device family for the vpn device. - DeviceFamily *string `json:"deviceFamily,omitempty"` - // FirmwareVersion - The firmware version for the vpn device. - FirmwareVersion *string `json:"firmwareVersion,omitempty"` -} - -// VpnGateway vpnGateway Resource. -type VpnGateway struct { - autorest.Response `json:"-"` - // VpnGatewayProperties - Properties of the VPN gateway. - *VpnGatewayProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VpnGateway. -func (vg VpnGateway) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vg.VpnGatewayProperties != nil { - objectMap["properties"] = vg.VpnGatewayProperties - } - if vg.ID != nil { - objectMap["id"] = vg.ID - } - if vg.Location != nil { - objectMap["location"] = vg.Location - } - if vg.Tags != nil { - objectMap["tags"] = vg.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VpnGateway struct. -func (vg *VpnGateway) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var vpnGatewayProperties VpnGatewayProperties - err = json.Unmarshal(*v, &vpnGatewayProperties) - if err != nil { - return err - } - vg.VpnGatewayProperties = &vpnGatewayProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vg.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vg.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vg.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vg.Tags = tags - } - } - } - - return nil -} - -// VpnGatewayIPConfiguration IP Configuration of a VPN Gateway Resource. -type VpnGatewayIPConfiguration struct { - // ID - The identifier of the IP configuration for a VPN Gateway. - ID *string `json:"id,omitempty"` - // PublicIPAddress - The public IP address of this IP configuration. - PublicIPAddress *string `json:"publicIpAddress,omitempty"` - // PrivateIPAddress - The private IP address of this IP configuration. - PrivateIPAddress *string `json:"privateIpAddress,omitempty"` -} - -// VpnGatewayNatRule vpnGatewayNatRule Resource. -type VpnGatewayNatRule struct { - autorest.Response `json:"-"` - // VpnGatewayNatRuleProperties - Properties of the VpnGateway NAT rule. - *VpnGatewayNatRuleProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnGatewayNatRule. -func (vgnr VpnGatewayNatRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vgnr.VpnGatewayNatRuleProperties != nil { - objectMap["properties"] = vgnr.VpnGatewayNatRuleProperties - } - if vgnr.Name != nil { - objectMap["name"] = vgnr.Name - } - if vgnr.ID != nil { - objectMap["id"] = vgnr.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VpnGatewayNatRule struct. -func (vgnr *VpnGatewayNatRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var vpnGatewayNatRuleProperties VpnGatewayNatRuleProperties - err = json.Unmarshal(*v, &vpnGatewayNatRuleProperties) - if err != nil { - return err - } - vgnr.VpnGatewayNatRuleProperties = &vpnGatewayNatRuleProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vgnr.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vgnr.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vgnr.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vgnr.ID = &ID - } - } - } - - return nil -} - -// VpnGatewayNatRuleProperties parameters for VpnGatewayNatRule. -type VpnGatewayNatRuleProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the NAT Rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Type - The type of NAT rule for VPN NAT. Possible values include: 'VpnNatRuleTypeStatic', 'VpnNatRuleTypeDynamic' - Type VpnNatRuleType `json:"type,omitempty"` - // Mode - The Source NAT direction of a VPN NAT. Possible values include: 'VpnNatRuleModeEgressSnat', 'VpnNatRuleModeIngressSnat' - Mode VpnNatRuleMode `json:"mode,omitempty"` - // InternalMappings - The private IP address internal mapping for NAT. - InternalMappings *[]VpnNatRuleMapping `json:"internalMappings,omitempty"` - // ExternalMappings - The private IP address external mapping for NAT. - ExternalMappings *[]VpnNatRuleMapping `json:"externalMappings,omitempty"` - // IPConfigurationID - The IP Configuration ID this NAT rule applies to. - IPConfigurationID *string `json:"ipConfigurationId,omitempty"` - // EgressVpnSiteLinkConnections - READ-ONLY; List of egress VpnSiteLinkConnections. - EgressVpnSiteLinkConnections *[]SubResource `json:"egressVpnSiteLinkConnections,omitempty"` - // IngressVpnSiteLinkConnections - READ-ONLY; List of ingress VpnSiteLinkConnections. - IngressVpnSiteLinkConnections *[]SubResource `json:"ingressVpnSiteLinkConnections,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnGatewayNatRuleProperties. -func (vgnrp VpnGatewayNatRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vgnrp.Type != "" { - objectMap["type"] = vgnrp.Type - } - if vgnrp.Mode != "" { - objectMap["mode"] = vgnrp.Mode - } - if vgnrp.InternalMappings != nil { - objectMap["internalMappings"] = vgnrp.InternalMappings - } - if vgnrp.ExternalMappings != nil { - objectMap["externalMappings"] = vgnrp.ExternalMappings - } - if vgnrp.IPConfigurationID != nil { - objectMap["ipConfigurationId"] = vgnrp.IPConfigurationID - } - return json.Marshal(objectMap) -} - -// VpnGatewayPacketCaptureStartParameters start packet capture parameters. -type VpnGatewayPacketCaptureStartParameters struct { - // FilterData - Start Packet capture parameters on vpn gateway. - FilterData *string `json:"filterData,omitempty"` -} - -// VpnGatewayPacketCaptureStopParameters stop packet capture parameters. -type VpnGatewayPacketCaptureStopParameters struct { - // SasURL - SAS url for packet capture on vpn gateway. - SasURL *string `json:"sasUrl,omitempty"` -} - -// VpnGatewayProperties parameters for VpnGateway. -type VpnGatewayProperties struct { - // VirtualHub - The VirtualHub to which the gateway belongs. - VirtualHub *SubResource `json:"virtualHub,omitempty"` - // Connections - List of all vpn connections to the gateway. - Connections *[]VpnConnection `json:"connections,omitempty"` - // BgpSettings - Local network gateway's BGP speaker settings. - BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the VPN gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // VpnGatewayScaleUnit - The scale unit for this vpn gateway. - VpnGatewayScaleUnit *int32 `json:"vpnGatewayScaleUnit,omitempty"` - // IPConfigurations - READ-ONLY; List of all IPs configured on the gateway. - IPConfigurations *[]VpnGatewayIPConfiguration `json:"ipConfigurations,omitempty"` - // EnableBgpRouteTranslationForNat - Enable BGP routes translation for NAT on this VpnGateway. - EnableBgpRouteTranslationForNat *bool `json:"enableBgpRouteTranslationForNat,omitempty"` - // IsRoutingPreferenceInternet - Enable Routing Preference property for the Public IP Interface of the VpnGateway. - IsRoutingPreferenceInternet *bool `json:"isRoutingPreferenceInternet,omitempty"` - // NatRules - List of all the nat Rules associated with the gateway. - NatRules *[]VpnGatewayNatRule `json:"natRules,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnGatewayProperties. -func (vgp VpnGatewayProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vgp.VirtualHub != nil { - objectMap["virtualHub"] = vgp.VirtualHub - } - if vgp.Connections != nil { - objectMap["connections"] = vgp.Connections - } - if vgp.BgpSettings != nil { - objectMap["bgpSettings"] = vgp.BgpSettings - } - if vgp.VpnGatewayScaleUnit != nil { - objectMap["vpnGatewayScaleUnit"] = vgp.VpnGatewayScaleUnit - } - if vgp.EnableBgpRouteTranslationForNat != nil { - objectMap["enableBgpRouteTranslationForNat"] = vgp.EnableBgpRouteTranslationForNat - } - if vgp.IsRoutingPreferenceInternet != nil { - objectMap["isRoutingPreferenceInternet"] = vgp.IsRoutingPreferenceInternet - } - if vgp.NatRules != nil { - objectMap["natRules"] = vgp.NatRules - } - return json.Marshal(objectMap) -} - -// VpnGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VpnGatewaysCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnGatewaysClient) (VpnGateway, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnGatewaysCreateOrUpdateFuture.Result. -func (future *VpnGatewaysCreateOrUpdateFuture) result(client VpnGatewaysClient) (vg VpnGateway, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vg.Response.Response, err = future.GetResult(sender); err == nil && vg.Response.Response.StatusCode != http.StatusNoContent { - vg, err = client.CreateOrUpdateResponder(vg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnGatewaysCreateOrUpdateFuture", "Result", vg.Response.Response, "Failure responding to request") - } - } - return -} - -// VpnGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VpnGatewaysDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnGatewaysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnGatewaysDeleteFuture.Result. -func (future *VpnGatewaysDeleteFuture) result(client VpnGatewaysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VpnGatewaysResetFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VpnGatewaysResetFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnGatewaysClient) (VpnGateway, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnGatewaysResetFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnGatewaysResetFuture.Result. -func (future *VpnGatewaysResetFuture) result(client VpnGatewaysClient) (vg VpnGateway, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnGatewaysResetFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysResetFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vg.Response.Response, err = future.GetResult(sender); err == nil && vg.Response.Response.StatusCode != http.StatusNoContent { - vg, err = client.ResetResponder(vg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnGatewaysResetFuture", "Result", vg.Response.Response, "Failure responding to request") - } - } - return -} - -// VpnGatewaysStartPacketCaptureFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VpnGatewaysStartPacketCaptureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnGatewaysClient) (String, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnGatewaysStartPacketCaptureFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnGatewaysStartPacketCaptureFuture.Result. -func (future *VpnGatewaysStartPacketCaptureFuture) result(client VpnGatewaysClient) (s String, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnGatewaysStartPacketCaptureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysStartPacketCaptureFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.StartPacketCaptureResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnGatewaysStartPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// VpnGatewaysStopPacketCaptureFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VpnGatewaysStopPacketCaptureFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnGatewaysClient) (String, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnGatewaysStopPacketCaptureFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnGatewaysStopPacketCaptureFuture.Result. -func (future *VpnGatewaysStopPacketCaptureFuture) result(client VpnGatewaysClient) (s String, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnGatewaysStopPacketCaptureFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysStopPacketCaptureFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.StopPacketCaptureResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnGatewaysStopPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// VpnGatewaysUpdateTagsFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VpnGatewaysUpdateTagsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnGatewaysClient) (VpnGateway, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnGatewaysUpdateTagsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnGatewaysUpdateTagsFuture.Result. -func (future *VpnGatewaysUpdateTagsFuture) result(client VpnGatewaysClient) (vg VpnGateway, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnGatewaysUpdateTagsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysUpdateTagsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vg.Response.Response, err = future.GetResult(sender); err == nil && vg.Response.Response.StatusCode != http.StatusNoContent { - vg, err = client.UpdateTagsResponder(vg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnGatewaysUpdateTagsFuture", "Result", vg.Response.Response, "Failure responding to request") - } - } - return -} - -// VpnLinkBgpSettings BGP settings details for a link. -type VpnLinkBgpSettings struct { - // Asn - The BGP speaker's ASN. - Asn *int64 `json:"asn,omitempty"` - // BgpPeeringAddress - The BGP peering address and BGP identifier of this BGP speaker. - BgpPeeringAddress *string `json:"bgpPeeringAddress,omitempty"` -} - -// VpnLinkConnectionsGetIkeSasFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VpnLinkConnectionsGetIkeSasFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnLinkConnectionsClient) (String, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnLinkConnectionsGetIkeSasFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnLinkConnectionsGetIkeSasFuture.Result. -func (future *VpnLinkConnectionsGetIkeSasFuture) result(client VpnLinkConnectionsClient) (s String, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsGetIkeSasFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnLinkConnectionsGetIkeSasFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.GetIkeSasResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsGetIkeSasFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// VpnLinkConnectionsResetConnectionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VpnLinkConnectionsResetConnectionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnLinkConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnLinkConnectionsResetConnectionFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnLinkConnectionsResetConnectionFuture.Result. -func (future *VpnLinkConnectionsResetConnectionFuture) result(client VpnLinkConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsResetConnectionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnLinkConnectionsResetConnectionFuture") - return - } - ar.Response = future.Response() - return -} - -// VpnLinkProviderProperties list of properties of a link provider. -type VpnLinkProviderProperties struct { - // LinkProviderName - Name of the link provider. - LinkProviderName *string `json:"linkProviderName,omitempty"` - // LinkSpeedInMbps - Link speed. - LinkSpeedInMbps *int32 `json:"linkSpeedInMbps,omitempty"` -} - -// VpnNatRuleMapping vpn NatRule mapping. -type VpnNatRuleMapping struct { - // AddressSpace - Address space for Vpn NatRule mapping. - AddressSpace *string `json:"addressSpace,omitempty"` - // PortRange - Port range for Vpn NatRule mapping. - PortRange *string `json:"portRange,omitempty"` -} - -// VpnPacketCaptureStartParameters start packet capture parameters on virtual network gateway. -type VpnPacketCaptureStartParameters struct { - // FilterData - Start Packet capture parameters. - FilterData *string `json:"filterData,omitempty"` -} - -// VpnPacketCaptureStopParameters stop packet capture parameters. -type VpnPacketCaptureStopParameters struct { - // SasURL - SAS url for packet capture on virtual network gateway. - SasURL *string `json:"sasUrl,omitempty"` -} - -// VpnProfileResponse vpn Profile Response for package generation. -type VpnProfileResponse struct { - autorest.Response `json:"-"` - // ProfileURL - URL to the VPN profile. - ProfileURL *string `json:"profileUrl,omitempty"` -} - -// VpnServerConfigRadiusClientRootCertificate properties of the Radius client root certificate of -// VpnServerConfiguration. -type VpnServerConfigRadiusClientRootCertificate struct { - // Name - The certificate name. - Name *string `json:"name,omitempty"` - // Thumbprint - The Radius client root certificate thumbprint. - Thumbprint *string `json:"thumbprint,omitempty"` -} - -// VpnServerConfigRadiusServerRootCertificate properties of Radius Server root certificate of -// VpnServerConfiguration. -type VpnServerConfigRadiusServerRootCertificate struct { - // Name - The certificate name. - Name *string `json:"name,omitempty"` - // PublicCertData - The certificate public data. - PublicCertData *string `json:"publicCertData,omitempty"` -} - -// VpnServerConfigVpnClientRevokedCertificate properties of the revoked VPN client certificate of -// VpnServerConfiguration. -type VpnServerConfigVpnClientRevokedCertificate struct { - // Name - The certificate name. - Name *string `json:"name,omitempty"` - // Thumbprint - The revoked VPN client certificate thumbprint. - Thumbprint *string `json:"thumbprint,omitempty"` -} - -// VpnServerConfigVpnClientRootCertificate properties of VPN client root certificate of -// VpnServerConfiguration. -type VpnServerConfigVpnClientRootCertificate struct { - // Name - The certificate name. - Name *string `json:"name,omitempty"` - // PublicCertData - The certificate public data. - PublicCertData *string `json:"publicCertData,omitempty"` -} - -// VpnServerConfiguration vpnServerConfiguration Resource. -type VpnServerConfiguration struct { - autorest.Response `json:"-"` - // VpnServerConfigurationProperties - Properties of the P2SVpnServer configuration. - *VpnServerConfigurationProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VpnServerConfiguration. -func (vsc VpnServerConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vsc.VpnServerConfigurationProperties != nil { - objectMap["properties"] = vsc.VpnServerConfigurationProperties - } - if vsc.ID != nil { - objectMap["id"] = vsc.ID - } - if vsc.Location != nil { - objectMap["location"] = vsc.Location - } - if vsc.Tags != nil { - objectMap["tags"] = vsc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VpnServerConfiguration struct. -func (vsc *VpnServerConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var vpnServerConfigurationProperties VpnServerConfigurationProperties - err = json.Unmarshal(*v, &vpnServerConfigurationProperties) - if err != nil { - return err - } - vsc.VpnServerConfigurationProperties = &vpnServerConfigurationProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vsc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vsc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vsc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vsc.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vsc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vsc.Tags = tags - } - } - } - - return nil -} - -// VpnServerConfigurationPolicyGroup vpnServerConfigurationPolicyGroup Resource. -type VpnServerConfigurationPolicyGroup struct { - autorest.Response `json:"-"` - // VpnServerConfigurationPolicyGroupProperties - Properties of the VpnServerConfigurationPolicyGroup. - *VpnServerConfigurationPolicyGroupProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnServerConfigurationPolicyGroup. -func (vscpg VpnServerConfigurationPolicyGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vscpg.VpnServerConfigurationPolicyGroupProperties != nil { - objectMap["properties"] = vscpg.VpnServerConfigurationPolicyGroupProperties - } - if vscpg.Name != nil { - objectMap["name"] = vscpg.Name - } - if vscpg.ID != nil { - objectMap["id"] = vscpg.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VpnServerConfigurationPolicyGroup struct. -func (vscpg *VpnServerConfigurationPolicyGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var vpnServerConfigurationPolicyGroupProperties VpnServerConfigurationPolicyGroupProperties - err = json.Unmarshal(*v, &vpnServerConfigurationPolicyGroupProperties) - if err != nil { - return err - } - vscpg.VpnServerConfigurationPolicyGroupProperties = &vpnServerConfigurationPolicyGroupProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vscpg.Etag = &etag - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vscpg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vscpg.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vscpg.ID = &ID - } - } - } - - return nil -} - -// VpnServerConfigurationPolicyGroupMember vpnServerConfiguration PolicyGroup member -type VpnServerConfigurationPolicyGroupMember struct { - // Name - Name of the VpnServerConfigurationPolicyGroupMember. - Name *string `json:"name,omitempty"` - // AttributeType - The Vpn Policy member attribute type. Possible values include: 'VpnPolicyMemberAttributeTypeCertificateGroupID', 'VpnPolicyMemberAttributeTypeAADGroupID', 'VpnPolicyMemberAttributeTypeRadiusAzureGroupID' - AttributeType VpnPolicyMemberAttributeType `json:"attributeType,omitempty"` - // AttributeValue - The value of Attribute used for this VpnServerConfigurationPolicyGroupMember. - AttributeValue *string `json:"attributeValue,omitempty"` -} - -// VpnServerConfigurationPolicyGroupProperties parameters for VpnServerConfigurationPolicyGroup. -type VpnServerConfigurationPolicyGroupProperties struct { - // IsDefault - Shows if this is a Default VpnServerConfigurationPolicyGroup or not. - IsDefault *bool `json:"isDefault,omitempty"` - // Priority - Priority for VpnServerConfigurationPolicyGroup. - Priority *int32 `json:"priority,omitempty"` - // PolicyMembers - Multiple PolicyMembers for VpnServerConfigurationPolicyGroup. - PolicyMembers *[]VpnServerConfigurationPolicyGroupMember `json:"policyMembers,omitempty"` - // P2SConnectionConfigurations - READ-ONLY; List of references to P2SConnectionConfigurations. - P2SConnectionConfigurations *[]SubResource `json:"p2SConnectionConfigurations,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the VpnServerConfigurationPolicyGroup resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnServerConfigurationPolicyGroupProperties. -func (vscpgp VpnServerConfigurationPolicyGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vscpgp.IsDefault != nil { - objectMap["isDefault"] = vscpgp.IsDefault - } - if vscpgp.Priority != nil { - objectMap["priority"] = vscpgp.Priority - } - if vscpgp.PolicyMembers != nil { - objectMap["policyMembers"] = vscpgp.PolicyMembers - } - return json.Marshal(objectMap) -} - -// VpnServerConfigurationProperties parameters for VpnServerConfiguration. -type VpnServerConfigurationProperties struct { - // Name - The name of the VpnServerConfiguration that is unique within a resource group. - Name *string `json:"name,omitempty"` - // VpnProtocols - VPN protocols for the VpnServerConfiguration. - VpnProtocols *[]VpnGatewayTunnelingProtocol `json:"vpnProtocols,omitempty"` - // VpnAuthenticationTypes - VPN authentication types for the VpnServerConfiguration. - VpnAuthenticationTypes *[]VpnAuthenticationType `json:"vpnAuthenticationTypes,omitempty"` - // VpnClientRootCertificates - VPN client root certificate of VpnServerConfiguration. - VpnClientRootCertificates *[]VpnServerConfigVpnClientRootCertificate `json:"vpnClientRootCertificates,omitempty"` - // VpnClientRevokedCertificates - VPN client revoked certificate of VpnServerConfiguration. - VpnClientRevokedCertificates *[]VpnServerConfigVpnClientRevokedCertificate `json:"vpnClientRevokedCertificates,omitempty"` - // RadiusServerRootCertificates - Radius Server root certificate of VpnServerConfiguration. - RadiusServerRootCertificates *[]VpnServerConfigRadiusServerRootCertificate `json:"radiusServerRootCertificates,omitempty"` - // RadiusClientRootCertificates - Radius client root certificate of VpnServerConfiguration. - RadiusClientRootCertificates *[]VpnServerConfigRadiusClientRootCertificate `json:"radiusClientRootCertificates,omitempty"` - // VpnClientIpsecPolicies - VpnClientIpsecPolicies for VpnServerConfiguration. - VpnClientIpsecPolicies *[]IpsecPolicy `json:"vpnClientIpsecPolicies,omitempty"` - // RadiusServerAddress - The radius server address property of the VpnServerConfiguration resource for point to site client connection. - RadiusServerAddress *string `json:"radiusServerAddress,omitempty"` - // RadiusServerSecret - The radius secret property of the VpnServerConfiguration resource for point to site client connection. - RadiusServerSecret *string `json:"radiusServerSecret,omitempty"` - // RadiusServers - Multiple Radius Server configuration for VpnServerConfiguration. - RadiusServers *[]RadiusServer `json:"radiusServers,omitempty"` - // AadAuthenticationParameters - The set of aad vpn authentication parameters. - AadAuthenticationParameters *AadAuthenticationParameters `json:"aadAuthenticationParameters,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the VpnServerConfiguration resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. - ProvisioningState *string `json:"provisioningState,omitempty"` - // P2SVpnGateways - READ-ONLY; List of references to P2SVpnGateways. - P2SVpnGateways *[]P2SVpnGateway `json:"p2SVpnGateways,omitempty"` - // ConfigurationPolicyGroups - List of all VpnServerConfigurationPolicyGroups. - ConfigurationPolicyGroups *[]VpnServerConfigurationPolicyGroup `json:"configurationPolicyGroups,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnServerConfigurationProperties. -func (vscp VpnServerConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vscp.Name != nil { - objectMap["name"] = vscp.Name - } - if vscp.VpnProtocols != nil { - objectMap["vpnProtocols"] = vscp.VpnProtocols - } - if vscp.VpnAuthenticationTypes != nil { - objectMap["vpnAuthenticationTypes"] = vscp.VpnAuthenticationTypes - } - if vscp.VpnClientRootCertificates != nil { - objectMap["vpnClientRootCertificates"] = vscp.VpnClientRootCertificates - } - if vscp.VpnClientRevokedCertificates != nil { - objectMap["vpnClientRevokedCertificates"] = vscp.VpnClientRevokedCertificates - } - if vscp.RadiusServerRootCertificates != nil { - objectMap["radiusServerRootCertificates"] = vscp.RadiusServerRootCertificates - } - if vscp.RadiusClientRootCertificates != nil { - objectMap["radiusClientRootCertificates"] = vscp.RadiusClientRootCertificates - } - if vscp.VpnClientIpsecPolicies != nil { - objectMap["vpnClientIpsecPolicies"] = vscp.VpnClientIpsecPolicies - } - if vscp.RadiusServerAddress != nil { - objectMap["radiusServerAddress"] = vscp.RadiusServerAddress - } - if vscp.RadiusServerSecret != nil { - objectMap["radiusServerSecret"] = vscp.RadiusServerSecret - } - if vscp.RadiusServers != nil { - objectMap["radiusServers"] = vscp.RadiusServers - } - if vscp.AadAuthenticationParameters != nil { - objectMap["aadAuthenticationParameters"] = vscp.AadAuthenticationParameters - } - if vscp.ConfigurationPolicyGroups != nil { - objectMap["configurationPolicyGroups"] = vscp.ConfigurationPolicyGroups - } - return json.Marshal(objectMap) -} - -// VpnServerConfigurationsAssociatedWithVirtualWanListFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type VpnServerConfigurationsAssociatedWithVirtualWanListFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnServerConfigurationsAssociatedWithVirtualWanClient) (VpnServerConfigurationsResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnServerConfigurationsAssociatedWithVirtualWanListFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnServerConfigurationsAssociatedWithVirtualWanListFuture.Result. -func (future *VpnServerConfigurationsAssociatedWithVirtualWanListFuture) result(client VpnServerConfigurationsAssociatedWithVirtualWanClient) (vscr VpnServerConfigurationsResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsAssociatedWithVirtualWanListFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vscr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnServerConfigurationsAssociatedWithVirtualWanListFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vscr.Response.Response, err = future.GetResult(sender); err == nil && vscr.Response.Response.StatusCode != http.StatusNoContent { - vscr, err = client.ListResponder(vscr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsAssociatedWithVirtualWanListFuture", "Result", vscr.Response.Response, "Failure responding to request") - } - } - return -} - -// VpnServerConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type VpnServerConfigurationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnServerConfigurationsClient) (VpnServerConfiguration, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnServerConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnServerConfigurationsCreateOrUpdateFuture.Result. -func (future *VpnServerConfigurationsCreateOrUpdateFuture) result(client VpnServerConfigurationsClient) (vsc VpnServerConfiguration, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vsc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnServerConfigurationsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vsc.Response.Response, err = future.GetResult(sender); err == nil && vsc.Response.Response.StatusCode != http.StatusNoContent { - vsc, err = client.CreateOrUpdateResponder(vsc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsCreateOrUpdateFuture", "Result", vsc.Response.Response, "Failure responding to request") - } - } - return -} - -// VpnServerConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VpnServerConfigurationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnServerConfigurationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnServerConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnServerConfigurationsDeleteFuture.Result. -func (future *VpnServerConfigurationsDeleteFuture) result(client VpnServerConfigurationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnServerConfigurationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VpnServerConfigurationsResponse vpnServerConfigurations list associated with VirtualWan Response. -type VpnServerConfigurationsResponse struct { - autorest.Response `json:"-"` - // VpnServerConfigurationResourceIds - List of VpnServerConfigurations associated with VirtualWan. - VpnServerConfigurationResourceIds *[]string `json:"vpnServerConfigurationResourceIds,omitempty"` -} - -// VpnSite vpnSite Resource. -type VpnSite struct { - autorest.Response `json:"-"` - // VpnSiteProperties - Properties of the VPN site. - *VpnSiteProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for VpnSite. -func (vs VpnSite) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vs.VpnSiteProperties != nil { - objectMap["properties"] = vs.VpnSiteProperties - } - if vs.ID != nil { - objectMap["id"] = vs.ID - } - if vs.Location != nil { - objectMap["location"] = vs.Location - } - if vs.Tags != nil { - objectMap["tags"] = vs.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VpnSite struct. -func (vs *VpnSite) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var vpnSiteProperties VpnSiteProperties - err = json.Unmarshal(*v, &vpnSiteProperties) - if err != nil { - return err - } - vs.VpnSiteProperties = &vpnSiteProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vs.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vs.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vs.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vs.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vs.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vs.Tags = tags - } - } - } - - return nil -} - -// VpnSiteID vpnSite Resource. -type VpnSiteID struct { - // VpnSite - READ-ONLY; The resource-uri of the vpn-site for which config is to be fetched. - VpnSite *string `json:"vpnSite,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnSiteID. -func (vsi VpnSiteID) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VpnSiteLink vpnSiteLink Resource. -type VpnSiteLink struct { - autorest.Response `json:"-"` - // VpnSiteLinkProperties - Properties of the VPN site link. - *VpnSiteLinkProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnSiteLink. -func (vsl VpnSiteLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vsl.VpnSiteLinkProperties != nil { - objectMap["properties"] = vsl.VpnSiteLinkProperties - } - if vsl.Name != nil { - objectMap["name"] = vsl.Name - } - if vsl.ID != nil { - objectMap["id"] = vsl.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VpnSiteLink struct. -func (vsl *VpnSiteLink) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var vpnSiteLinkProperties VpnSiteLinkProperties - err = json.Unmarshal(*v, &vpnSiteLinkProperties) - if err != nil { - return err - } - vsl.VpnSiteLinkProperties = &vpnSiteLinkProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vsl.Etag = &etag - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vsl.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vsl.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vsl.ID = &ID - } - } - } - - return nil -} - -// VpnSiteLinkConnection vpnSiteLinkConnection Resource. -type VpnSiteLinkConnection struct { - autorest.Response `json:"-"` - // VpnSiteLinkConnectionProperties - Properties of the VPN site link connection. - *VpnSiteLinkConnectionProperties `json:"properties,omitempty"` - // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnSiteLinkConnection. -func (vslc VpnSiteLinkConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vslc.VpnSiteLinkConnectionProperties != nil { - objectMap["properties"] = vslc.VpnSiteLinkConnectionProperties - } - if vslc.Name != nil { - objectMap["name"] = vslc.Name - } - if vslc.ID != nil { - objectMap["id"] = vslc.ID - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VpnSiteLinkConnection struct. -func (vslc *VpnSiteLinkConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var vpnSiteLinkConnectionProperties VpnSiteLinkConnectionProperties - err = json.Unmarshal(*v, &vpnSiteLinkConnectionProperties) - if err != nil { - return err - } - vslc.VpnSiteLinkConnectionProperties = &vpnSiteLinkConnectionProperties - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vslc.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vslc.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vslc.Type = &typeVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vslc.ID = &ID - } - } - } - - return nil -} - -// VpnSiteLinkConnectionProperties parameters for VpnConnection. -type VpnSiteLinkConnectionProperties struct { - // VpnSiteLink - Id of the connected vpn site link. - VpnSiteLink *SubResource `json:"vpnSiteLink,omitempty"` - // RoutingWeight - Routing weight for vpn connection. - RoutingWeight *int32 `json:"routingWeight,omitempty"` - // VpnLinkConnectionMode - Vpn link connection mode. Possible values include: 'VpnLinkConnectionModeDefault', 'VpnLinkConnectionModeResponderOnly', 'VpnLinkConnectionModeInitiatorOnly' - VpnLinkConnectionMode VpnLinkConnectionMode `json:"vpnLinkConnectionMode,omitempty"` - // ConnectionStatus - The connection status. Possible values include: 'VpnConnectionStatusUnknown', 'VpnConnectionStatusConnecting', 'VpnConnectionStatusConnected', 'VpnConnectionStatusNotConnected' - ConnectionStatus VpnConnectionStatus `json:"connectionStatus,omitempty"` - // VpnConnectionProtocolType - Connection protocol used for this connection. Possible values include: 'VirtualNetworkGatewayConnectionProtocolIKEv2', 'VirtualNetworkGatewayConnectionProtocolIKEv1' - VpnConnectionProtocolType VirtualNetworkGatewayConnectionProtocol `json:"vpnConnectionProtocolType,omitempty"` - // IngressBytesTransferred - READ-ONLY; Ingress bytes transferred. - IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` - // EgressBytesTransferred - READ-ONLY; Egress bytes transferred. - EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` - // ConnectionBandwidth - Expected bandwidth in MBPS. - ConnectionBandwidth *int32 `json:"connectionBandwidth,omitempty"` - // SharedKey - SharedKey for the vpn connection. - SharedKey *string `json:"sharedKey,omitempty"` - // EnableBgp - EnableBgp flag. - EnableBgp *bool `json:"enableBgp,omitempty"` - // VpnGatewayCustomBgpAddresses - vpnGatewayCustomBgpAddresses used by this connection. - VpnGatewayCustomBgpAddresses *[]GatewayCustomBgpIPAddressIPConfiguration `json:"vpnGatewayCustomBgpAddresses,omitempty"` - // UsePolicyBasedTrafficSelectors - Enable policy-based traffic selectors. - UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` - // IpsecPolicies - The IPSec Policies to be considered by this connection. - IpsecPolicies *[]IpsecPolicy `json:"ipsecPolicies,omitempty"` - // EnableRateLimiting - EnableBgp flag. - EnableRateLimiting *bool `json:"enableRateLimiting,omitempty"` - // UseLocalAzureIPAddress - Use local azure ip to initiate connection. - UseLocalAzureIPAddress *bool `json:"useLocalAzureIpAddress,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the VPN site link connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // IngressNatRules - List of ingress NatRules. - IngressNatRules *[]SubResource `json:"ingressNatRules,omitempty"` - // EgressNatRules - List of egress NatRules. - EgressNatRules *[]SubResource `json:"egressNatRules,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnSiteLinkConnectionProperties. -func (vslcp VpnSiteLinkConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vslcp.VpnSiteLink != nil { - objectMap["vpnSiteLink"] = vslcp.VpnSiteLink - } - if vslcp.RoutingWeight != nil { - objectMap["routingWeight"] = vslcp.RoutingWeight - } - if vslcp.VpnLinkConnectionMode != "" { - objectMap["vpnLinkConnectionMode"] = vslcp.VpnLinkConnectionMode - } - if vslcp.ConnectionStatus != "" { - objectMap["connectionStatus"] = vslcp.ConnectionStatus - } - if vslcp.VpnConnectionProtocolType != "" { - objectMap["vpnConnectionProtocolType"] = vslcp.VpnConnectionProtocolType - } - if vslcp.ConnectionBandwidth != nil { - objectMap["connectionBandwidth"] = vslcp.ConnectionBandwidth - } - if vslcp.SharedKey != nil { - objectMap["sharedKey"] = vslcp.SharedKey - } - if vslcp.EnableBgp != nil { - objectMap["enableBgp"] = vslcp.EnableBgp - } - if vslcp.VpnGatewayCustomBgpAddresses != nil { - objectMap["vpnGatewayCustomBgpAddresses"] = vslcp.VpnGatewayCustomBgpAddresses - } - if vslcp.UsePolicyBasedTrafficSelectors != nil { - objectMap["usePolicyBasedTrafficSelectors"] = vslcp.UsePolicyBasedTrafficSelectors - } - if vslcp.IpsecPolicies != nil { - objectMap["ipsecPolicies"] = vslcp.IpsecPolicies - } - if vslcp.EnableRateLimiting != nil { - objectMap["enableRateLimiting"] = vslcp.EnableRateLimiting - } - if vslcp.UseLocalAzureIPAddress != nil { - objectMap["useLocalAzureIpAddress"] = vslcp.UseLocalAzureIPAddress - } - if vslcp.IngressNatRules != nil { - objectMap["ingressNatRules"] = vslcp.IngressNatRules - } - if vslcp.EgressNatRules != nil { - objectMap["egressNatRules"] = vslcp.EgressNatRules - } - return json.Marshal(objectMap) -} - -// VpnSiteLinkProperties parameters for VpnSite. -type VpnSiteLinkProperties struct { - // LinkProperties - The link provider properties. - LinkProperties *VpnLinkProviderProperties `json:"linkProperties,omitempty"` - // IPAddress - The ip-address for the vpn-site-link. - IPAddress *string `json:"ipAddress,omitempty"` - // Fqdn - FQDN of vpn-site-link. - Fqdn *string `json:"fqdn,omitempty"` - // BgpProperties - The set of bgp properties. - BgpProperties *VpnLinkBgpSettings `json:"bgpProperties,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the VPN site link resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnSiteLinkProperties. -func (vslp VpnSiteLinkProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vslp.LinkProperties != nil { - objectMap["linkProperties"] = vslp.LinkProperties - } - if vslp.IPAddress != nil { - objectMap["ipAddress"] = vslp.IPAddress - } - if vslp.Fqdn != nil { - objectMap["fqdn"] = vslp.Fqdn - } - if vslp.BgpProperties != nil { - objectMap["bgpProperties"] = vslp.BgpProperties - } - return json.Marshal(objectMap) -} - -// VpnSiteProperties parameters for VpnSite. -type VpnSiteProperties struct { - // VirtualWan - The VirtualWAN to which the vpnSite belongs. - VirtualWan *SubResource `json:"virtualWan,omitempty"` - // DeviceProperties - The device properties. - DeviceProperties *DeviceProperties `json:"deviceProperties,omitempty"` - // IPAddress - The ip-address for the vpn-site. - IPAddress *string `json:"ipAddress,omitempty"` - // SiteKey - The key for vpn-site that can be used for connections. - SiteKey *string `json:"siteKey,omitempty"` - // AddressSpace - The AddressSpace that contains an array of IP address ranges. - AddressSpace *AddressSpace `json:"addressSpace,omitempty"` - // BgpProperties - The set of bgp properties. - BgpProperties *BgpSettings `json:"bgpProperties,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the VPN site resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // IsSecuritySite - IsSecuritySite flag. - IsSecuritySite *bool `json:"isSecuritySite,omitempty"` - // VpnSiteLinks - List of all vpn site links. - VpnSiteLinks *[]VpnSiteLink `json:"vpnSiteLinks,omitempty"` - // O365Policy - Office365 Policy. - O365Policy *O365PolicyProperties `json:"o365Policy,omitempty"` -} - -// MarshalJSON is the custom marshaler for VpnSiteProperties. -func (vsp VpnSiteProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vsp.VirtualWan != nil { - objectMap["virtualWan"] = vsp.VirtualWan - } - if vsp.DeviceProperties != nil { - objectMap["deviceProperties"] = vsp.DeviceProperties - } - if vsp.IPAddress != nil { - objectMap["ipAddress"] = vsp.IPAddress - } - if vsp.SiteKey != nil { - objectMap["siteKey"] = vsp.SiteKey - } - if vsp.AddressSpace != nil { - objectMap["addressSpace"] = vsp.AddressSpace - } - if vsp.BgpProperties != nil { - objectMap["bgpProperties"] = vsp.BgpProperties - } - if vsp.IsSecuritySite != nil { - objectMap["isSecuritySite"] = vsp.IsSecuritySite - } - if vsp.VpnSiteLinks != nil { - objectMap["vpnSiteLinks"] = vsp.VpnSiteLinks - } - if vsp.O365Policy != nil { - objectMap["o365Policy"] = vsp.O365Policy - } - return json.Marshal(objectMap) -} - -// VpnSitesConfigurationDownloadFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VpnSitesConfigurationDownloadFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnSitesConfigurationClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnSitesConfigurationDownloadFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnSitesConfigurationDownloadFuture.Result. -func (future *VpnSitesConfigurationDownloadFuture) result(client VpnSitesConfigurationClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnSitesConfigurationDownloadFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnSitesConfigurationDownloadFuture") - return - } - ar.Response = future.Response() - return -} - -// VpnSitesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VpnSitesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnSitesClient) (VpnSite, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnSitesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnSitesCreateOrUpdateFuture.Result. -func (future *VpnSitesCreateOrUpdateFuture) result(client VpnSitesClient) (vs VpnSite, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnSitesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vs.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnSitesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vs.Response.Response, err = future.GetResult(sender); err == nil && vs.Response.Response.StatusCode != http.StatusNoContent { - vs, err = client.CreateOrUpdateResponder(vs.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnSitesCreateOrUpdateFuture", "Result", vs.Response.Response, "Failure responding to request") - } - } - return -} - -// VpnSitesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VpnSitesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VpnSitesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VpnSitesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VpnSitesDeleteFuture.Result. -func (future *VpnSitesDeleteFuture) result(client VpnSitesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VpnSitesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.VpnSitesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// Watcher network watcher in a resource group. -type Watcher struct { - autorest.Response `json:"-"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // WatcherPropertiesFormat - Properties of the network watcher. - *WatcherPropertiesFormat `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Watcher. -func (w Watcher) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.WatcherPropertiesFormat != nil { - objectMap["properties"] = w.WatcherPropertiesFormat - } - if w.ID != nil { - objectMap["id"] = w.ID - } - if w.Location != nil { - objectMap["location"] = w.Location - } - if w.Tags != nil { - objectMap["tags"] = w.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Watcher struct. -func (w *Watcher) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - w.Etag = &etag - } - case "properties": - if v != nil { - var watcherPropertiesFormat WatcherPropertiesFormat - err = json.Unmarshal(*v, &watcherPropertiesFormat) - if err != nil { - return err - } - w.WatcherPropertiesFormat = &watcherPropertiesFormat - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - w.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - w.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - w.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - w.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - w.Tags = tags - } - } - } - - return nil -} - -// WatcherListResult response for ListNetworkWatchers API service call. -type WatcherListResult struct { - autorest.Response `json:"-"` - // Value - List of network watcher resources. - Value *[]Watcher `json:"value,omitempty"` -} - -// WatcherPropertiesFormat the network watcher properties. -type WatcherPropertiesFormat struct { - // ProvisioningState - READ-ONLY; The provisioning state of the network watcher resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // RunningOperationIds - List of running operation IDs. - RunningOperationIds *[]int32 `json:"runningOperationIds,omitempty"` -} - -// MarshalJSON is the custom marshaler for WatcherPropertiesFormat. -func (wpf WatcherPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wpf.RunningOperationIds != nil { - objectMap["runningOperationIds"] = wpf.RunningOperationIds - } - return json.Marshal(objectMap) -} - -// WatchersCheckConnectivityFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WatchersCheckConnectivityFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WatchersClient) (ConnectivityInformation, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WatchersCheckConnectivityFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for WatchersCheckConnectivityFuture.Result. -func (future *WatchersCheckConnectivityFuture) result(client WatchersClient) (ci ConnectivityInformation, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersCheckConnectivityFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ci.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.WatchersCheckConnectivityFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ci.Response.Response, err = future.GetResult(sender); err == nil && ci.Response.Response.StatusCode != http.StatusNoContent { - ci, err = client.CheckConnectivityResponder(ci.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersCheckConnectivityFuture", "Result", ci.Response.Response, "Failure responding to request") - } - } - return -} - -// WatchersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WatchersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WatchersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WatchersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for WatchersDeleteFuture.Result. -func (future *WatchersDeleteFuture) result(client WatchersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.WatchersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WatchersGetAzureReachabilityReportFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WatchersGetAzureReachabilityReportFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WatchersClient) (AzureReachabilityReport, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WatchersGetAzureReachabilityReportFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for WatchersGetAzureReachabilityReportFuture.Result. -func (future *WatchersGetAzureReachabilityReportFuture) result(client WatchersClient) (arr AzureReachabilityReport, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetAzureReachabilityReportFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - arr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.WatchersGetAzureReachabilityReportFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if arr.Response.Response, err = future.GetResult(sender); err == nil && arr.Response.Response.StatusCode != http.StatusNoContent { - arr, err = client.GetAzureReachabilityReportResponder(arr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetAzureReachabilityReportFuture", "Result", arr.Response.Response, "Failure responding to request") - } - } - return -} - -// WatchersGetFlowLogStatusFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WatchersGetFlowLogStatusFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WatchersClient) (FlowLogInformation, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WatchersGetFlowLogStatusFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for WatchersGetFlowLogStatusFuture.Result. -func (future *WatchersGetFlowLogStatusFuture) result(client WatchersClient) (fli FlowLogInformation, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetFlowLogStatusFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fli.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.WatchersGetFlowLogStatusFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fli.Response.Response, err = future.GetResult(sender); err == nil && fli.Response.Response.StatusCode != http.StatusNoContent { - fli, err = client.GetFlowLogStatusResponder(fli.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetFlowLogStatusFuture", "Result", fli.Response.Response, "Failure responding to request") - } - } - return -} - -// WatchersGetNetworkConfigurationDiagnosticFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type WatchersGetNetworkConfigurationDiagnosticFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WatchersClient) (ConfigurationDiagnosticResponse, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WatchersGetNetworkConfigurationDiagnosticFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for WatchersGetNetworkConfigurationDiagnosticFuture.Result. -func (future *WatchersGetNetworkConfigurationDiagnosticFuture) result(client WatchersClient) (cdr ConfigurationDiagnosticResponse, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetNetworkConfigurationDiagnosticFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cdr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.WatchersGetNetworkConfigurationDiagnosticFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cdr.Response.Response, err = future.GetResult(sender); err == nil && cdr.Response.Response.StatusCode != http.StatusNoContent { - cdr, err = client.GetNetworkConfigurationDiagnosticResponder(cdr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetNetworkConfigurationDiagnosticFuture", "Result", cdr.Response.Response, "Failure responding to request") - } - } - return -} - -// WatchersGetNextHopFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WatchersGetNextHopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WatchersClient) (NextHopResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WatchersGetNextHopFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for WatchersGetNextHopFuture.Result. -func (future *WatchersGetNextHopFuture) result(client WatchersClient) (nhr NextHopResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetNextHopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - nhr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.WatchersGetNextHopFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if nhr.Response.Response, err = future.GetResult(sender); err == nil && nhr.Response.Response.StatusCode != http.StatusNoContent { - nhr, err = client.GetNextHopResponder(nhr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetNextHopFuture", "Result", nhr.Response.Response, "Failure responding to request") - } - } - return -} - -// WatchersGetTroubleshootingFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WatchersGetTroubleshootingFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WatchersClient) (TroubleshootingResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WatchersGetTroubleshootingFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for WatchersGetTroubleshootingFuture.Result. -func (future *WatchersGetTroubleshootingFuture) result(client WatchersClient) (tr TroubleshootingResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.WatchersGetTroubleshootingFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { - tr, err = client.GetTroubleshootingResponder(tr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingFuture", "Result", tr.Response.Response, "Failure responding to request") - } - } - return -} - -// WatchersGetTroubleshootingResultFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WatchersGetTroubleshootingResultFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WatchersClient) (TroubleshootingResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WatchersGetTroubleshootingResultFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for WatchersGetTroubleshootingResultFuture.Result. -func (future *WatchersGetTroubleshootingResultFuture) result(client WatchersClient) (tr TroubleshootingResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingResultFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - tr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.WatchersGetTroubleshootingResultFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { - tr, err = client.GetTroubleshootingResultResponder(tr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingResultFuture", "Result", tr.Response.Response, "Failure responding to request") - } - } - return -} - -// WatchersGetVMSecurityRulesFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WatchersGetVMSecurityRulesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WatchersClient) (SecurityGroupViewResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WatchersGetVMSecurityRulesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for WatchersGetVMSecurityRulesFuture.Result. -func (future *WatchersGetVMSecurityRulesFuture) result(client WatchersClient) (sgvr SecurityGroupViewResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetVMSecurityRulesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sgvr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.WatchersGetVMSecurityRulesFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sgvr.Response.Response, err = future.GetResult(sender); err == nil && sgvr.Response.Response.StatusCode != http.StatusNoContent { - sgvr, err = client.GetVMSecurityRulesResponder(sgvr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetVMSecurityRulesFuture", "Result", sgvr.Response.Response, "Failure responding to request") - } - } - return -} - -// WatchersListAvailableProvidersFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WatchersListAvailableProvidersFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WatchersClient) (AvailableProvidersList, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WatchersListAvailableProvidersFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for WatchersListAvailableProvidersFuture.Result. -func (future *WatchersListAvailableProvidersFuture) result(client WatchersClient) (apl AvailableProvidersList, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersListAvailableProvidersFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - apl.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.WatchersListAvailableProvidersFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if apl.Response.Response, err = future.GetResult(sender); err == nil && apl.Response.Response.StatusCode != http.StatusNoContent { - apl, err = client.ListAvailableProvidersResponder(apl.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersListAvailableProvidersFuture", "Result", apl.Response.Response, "Failure responding to request") - } - } - return -} - -// WatchersSetFlowLogConfigurationFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WatchersSetFlowLogConfigurationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WatchersClient) (FlowLogInformation, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WatchersSetFlowLogConfigurationFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for WatchersSetFlowLogConfigurationFuture.Result. -func (future *WatchersSetFlowLogConfigurationFuture) result(client WatchersClient) (fli FlowLogInformation, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersSetFlowLogConfigurationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fli.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.WatchersSetFlowLogConfigurationFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fli.Response.Response, err = future.GetResult(sender); err == nil && fli.Response.Response.StatusCode != http.StatusNoContent { - fli, err = client.SetFlowLogConfigurationResponder(fli.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersSetFlowLogConfigurationFuture", "Result", fli.Response.Response, "Failure responding to request") - } - } - return -} - -// WatchersVerifyIPFlowFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WatchersVerifyIPFlowFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WatchersClient) (VerificationIPFlowResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WatchersVerifyIPFlowFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for WatchersVerifyIPFlowFuture.Result. -func (future *WatchersVerifyIPFlowFuture) result(client WatchersClient) (vifr VerificationIPFlowResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersVerifyIPFlowFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vifr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.WatchersVerifyIPFlowFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vifr.Response.Response, err = future.GetResult(sender); err == nil && vifr.Response.Response.StatusCode != http.StatusNoContent { - vifr, err = client.VerifyIPFlowResponder(vifr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersVerifyIPFlowFuture", "Result", vifr.Response.Response, "Failure responding to request") - } - } - return -} - -// WebApplicationFirewallCustomRule defines contents of a web application rule. -type WebApplicationFirewallCustomRule struct { - // Name - The name of the resource that is unique within a policy. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Priority - Priority of the rule. Rules with a lower value will be evaluated before rules with a higher value. - Priority *int32 `json:"priority,omitempty"` - // RuleType - The rule type. Possible values include: 'WebApplicationFirewallRuleTypeMatchRule', 'WebApplicationFirewallRuleTypeInvalid' - RuleType WebApplicationFirewallRuleType `json:"ruleType,omitempty"` - // MatchConditions - List of match conditions. - MatchConditions *[]MatchCondition `json:"matchConditions,omitempty"` - // Action - Type of Actions. Possible values include: 'WebApplicationFirewallActionAllow', 'WebApplicationFirewallActionBlock', 'WebApplicationFirewallActionLog' - Action WebApplicationFirewallAction `json:"action,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebApplicationFirewallCustomRule. -func (wafcr WebApplicationFirewallCustomRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wafcr.Name != nil { - objectMap["name"] = wafcr.Name - } - if wafcr.Priority != nil { - objectMap["priority"] = wafcr.Priority - } - if wafcr.RuleType != "" { - objectMap["ruleType"] = wafcr.RuleType - } - if wafcr.MatchConditions != nil { - objectMap["matchConditions"] = wafcr.MatchConditions - } - if wafcr.Action != "" { - objectMap["action"] = wafcr.Action - } - return json.Marshal(objectMap) -} - -// WebApplicationFirewallPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WebApplicationFirewallPoliciesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(WebApplicationFirewallPoliciesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *WebApplicationFirewallPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for WebApplicationFirewallPoliciesDeleteFuture.Result. -func (future *WebApplicationFirewallPoliciesDeleteFuture) result(client WebApplicationFirewallPoliciesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("network.WebApplicationFirewallPoliciesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WebApplicationFirewallPolicy defines web application firewall policy. -type WebApplicationFirewallPolicy struct { - autorest.Response `json:"-"` - // WebApplicationFirewallPolicyPropertiesFormat - Properties of the web application firewall policy. - *WebApplicationFirewallPolicyPropertiesFormat `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicy. -func (wafp WebApplicationFirewallPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wafp.WebApplicationFirewallPolicyPropertiesFormat != nil { - objectMap["properties"] = wafp.WebApplicationFirewallPolicyPropertiesFormat - } - if wafp.ID != nil { - objectMap["id"] = wafp.ID - } - if wafp.Location != nil { - objectMap["location"] = wafp.Location - } - if wafp.Tags != nil { - objectMap["tags"] = wafp.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebApplicationFirewallPolicy struct. -func (wafp *WebApplicationFirewallPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var webApplicationFirewallPolicyPropertiesFormat WebApplicationFirewallPolicyPropertiesFormat - err = json.Unmarshal(*v, &webApplicationFirewallPolicyPropertiesFormat) - if err != nil { - return err - } - wafp.WebApplicationFirewallPolicyPropertiesFormat = &webApplicationFirewallPolicyPropertiesFormat - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - wafp.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wafp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wafp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - wafp.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wafp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - wafp.Tags = tags - } - } - } - - return nil -} - -// WebApplicationFirewallPolicyListResult 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. -type WebApplicationFirewallPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of WebApplicationFirewallPolicies within a resource group. - Value *[]WebApplicationFirewallPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of WebApplicationFirewallPolicy objects if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyListResult. -func (wafplr WebApplicationFirewallPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WebApplicationFirewallPolicyListResultIterator provides access to a complete listing of -// WebApplicationFirewallPolicy values. -type WebApplicationFirewallPolicyListResultIterator struct { - i int - page WebApplicationFirewallPolicyListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *WebApplicationFirewallPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPolicyListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *WebApplicationFirewallPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WebApplicationFirewallPolicyListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter WebApplicationFirewallPolicyListResultIterator) Response() WebApplicationFirewallPolicyListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter WebApplicationFirewallPolicyListResultIterator) Value() WebApplicationFirewallPolicy { - if !iter.page.NotDone() { - return WebApplicationFirewallPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WebApplicationFirewallPolicyListResultIterator type. -func NewWebApplicationFirewallPolicyListResultIterator(page WebApplicationFirewallPolicyListResultPage) WebApplicationFirewallPolicyListResultIterator { - return WebApplicationFirewallPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wafplr WebApplicationFirewallPolicyListResult) IsEmpty() bool { - return wafplr.Value == nil || len(*wafplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wafplr WebApplicationFirewallPolicyListResult) hasNextLink() bool { - return wafplr.NextLink != nil && len(*wafplr.NextLink) != 0 -} - -// webApplicationFirewallPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wafplr WebApplicationFirewallPolicyListResult) webApplicationFirewallPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wafplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wafplr.NextLink))) -} - -// WebApplicationFirewallPolicyListResultPage contains a page of WebApplicationFirewallPolicy values. -type WebApplicationFirewallPolicyListResultPage struct { - fn func(context.Context, WebApplicationFirewallPolicyListResult) (WebApplicationFirewallPolicyListResult, error) - wafplr WebApplicationFirewallPolicyListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *WebApplicationFirewallPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPolicyListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.wafplr) - if err != nil { - return err - } - page.wafplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *WebApplicationFirewallPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WebApplicationFirewallPolicyListResultPage) NotDone() bool { - return !page.wafplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WebApplicationFirewallPolicyListResultPage) Response() WebApplicationFirewallPolicyListResult { - return page.wafplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WebApplicationFirewallPolicyListResultPage) Values() []WebApplicationFirewallPolicy { - if page.wafplr.IsEmpty() { - return nil - } - return *page.wafplr.Value -} - -// Creates a new instance of the WebApplicationFirewallPolicyListResultPage type. -func NewWebApplicationFirewallPolicyListResultPage(cur WebApplicationFirewallPolicyListResult, getNextPage func(context.Context, WebApplicationFirewallPolicyListResult) (WebApplicationFirewallPolicyListResult, error)) WebApplicationFirewallPolicyListResultPage { - return WebApplicationFirewallPolicyListResultPage{ - fn: getNextPage, - wafplr: cur, - } -} - -// WebApplicationFirewallPolicyPropertiesFormat defines web application firewall policy properties. -type WebApplicationFirewallPolicyPropertiesFormat struct { - // PolicySettings - The PolicySettings for policy. - PolicySettings *PolicySettings `json:"policySettings,omitempty"` - // CustomRules - The custom rules inside the policy. - CustomRules *[]WebApplicationFirewallCustomRule `json:"customRules,omitempty"` - // ApplicationGateways - READ-ONLY; A collection of references to application gateways. - ApplicationGateways *[]ApplicationGateway `json:"applicationGateways,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state of the web application firewall policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ResourceState - READ-ONLY; Resource status of the policy. Possible values include: 'WebApplicationFirewallPolicyResourceStateCreating', 'WebApplicationFirewallPolicyResourceStateEnabling', 'WebApplicationFirewallPolicyResourceStateEnabled', 'WebApplicationFirewallPolicyResourceStateDisabling', 'WebApplicationFirewallPolicyResourceStateDisabled', 'WebApplicationFirewallPolicyResourceStateDeleting' - ResourceState WebApplicationFirewallPolicyResourceState `json:"resourceState,omitempty"` - // ManagedRules - Describes the managedRules structure. - ManagedRules *ManagedRulesDefinition `json:"managedRules,omitempty"` - // HTTPListeners - READ-ONLY; A collection of references to application gateway http listeners. - HTTPListeners *[]SubResource `json:"httpListeners,omitempty"` - // PathBasedRules - READ-ONLY; A collection of references to application gateway path rules. - PathBasedRules *[]SubResource `json:"pathBasedRules,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyPropertiesFormat. -func (wafppf WebApplicationFirewallPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wafppf.PolicySettings != nil { - objectMap["policySettings"] = wafppf.PolicySettings - } - if wafppf.CustomRules != nil { - objectMap["customRules"] = wafppf.CustomRules - } - if wafppf.ManagedRules != nil { - objectMap["managedRules"] = wafppf.ManagedRules - } - return json.Marshal(objectMap) -} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/operations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/operations.go deleted file mode 100644 index c3bb696b2866..000000000000 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/operations.go +++ /dev/null @@ -1,141 +0,0 @@ -package network - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" -) - -// OperationsClient is the network Client -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available Network Rest API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "network.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Network/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "network.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/usages.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/usages.go deleted file mode 100644 index 55a5d78a3a25..000000000000 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/usages.go +++ /dev/null @@ -1,155 +0,0 @@ -package network - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" -) - -// UsagesClient is the network Client -type UsagesClient struct { - BaseClient -} - -// NewUsagesClient creates an instance of the UsagesClient client. -func NewUsagesClient(subscriptionID string) UsagesClient { - return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { - return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list network usages for a subscription. -// Parameters: -// location - the location where resource usage is queried. -func (client UsagesClient) List(ctx context.Context, location string) (result UsagesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.List") - defer func() { - sc := -1 - if result.ulr.Response.Response != nil { - sc = result.ulr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: location, - Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._ ]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("network.UsagesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.ulr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure sending request") - return - } - - result.ulr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure responding to request") - return - } - if result.ulr.hasNextLink() && result.ulr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UsagesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UsagesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UsagesClient) ListResponder(resp *http.Response) (result UsagesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client UsagesClient) listNextResults(ctx context.Context, lastResults UsagesListResult) (result UsagesListResult, err error) { - req, err := lastResults.usagesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "network.UsagesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.UsagesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.UsagesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client UsagesClient) ListComplete(ctx context.Context, location string) (result UsagesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, location) - return -} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/version.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/version.go deleted file mode 100644 index f619a74b8fad..000000000000 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package network - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " network/2022-05-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworks.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworks.go deleted file mode 100644 index 27e1518c9adb..000000000000 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworks.go +++ /dev/null @@ -1,917 +0,0 @@ -package network - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" -) - -// VirtualNetworksClient is the network Client -type VirtualNetworksClient struct { - BaseClient -} - -// NewVirtualNetworksClient creates an instance of the VirtualNetworksClient client. -func NewVirtualNetworksClient(subscriptionID string) VirtualNetworksClient { - return NewVirtualNetworksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualNetworksClientWithBaseURI creates an instance of the VirtualNetworksClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworksClient { - return VirtualNetworksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckIPAddressAvailability checks whether a private IP address is available for use. -// Parameters: -// resourceGroupName - the name of the resource group. -// virtualNetworkName - the name of the virtual network. -// IPAddress - the private IP address to be verified. -func (client VirtualNetworksClient) CheckIPAddressAvailability(ctx context.Context, resourceGroupName string, virtualNetworkName string, IPAddress string) (result IPAddressAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.CheckIPAddressAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CheckIPAddressAvailabilityPreparer(ctx, resourceGroupName, virtualNetworkName, IPAddress) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckIPAddressAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckIPAddressAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckIPAddressAvailabilityPreparer prepares the CheckIPAddressAvailability request. -func (client VirtualNetworksClient) CheckIPAddressAvailabilityPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, IPAddress string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "ipAddress": autorest.Encode("query", IPAddress), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckIPAddressAvailabilitySender sends the CheckIPAddressAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) CheckIPAddressAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckIPAddressAvailabilityResponder handles the response to the CheckIPAddressAvailability request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) CheckIPAddressAvailabilityResponder(resp *http.Response) (result IPAddressAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a virtual network in the specified resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -// virtualNetworkName - the name of the virtual network. -// parameters - parameters supplied to the create or update virtual network operation. -func (client VirtualNetworksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork) (result VirtualNetworksCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkPropertiesFormat", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkPropertiesFormat.BgpCommunities", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkPropertiesFormat.BgpCommunities.VirtualNetworkCommunity", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.VirtualNetworkPropertiesFormat.Encryption", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkPropertiesFormat.Encryption.Enabled", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("network.VirtualNetworksClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualNetworksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Etag = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworksCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetwork, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified virtual network. -// Parameters: -// resourceGroupName - the name of the resource group. -// virtualNetworkName - the name of the virtual network. -func (client VirtualNetworksClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VirtualNetworksClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) DeleteSender(req *http.Request) (future VirtualNetworksDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified virtual network by resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -// virtualNetworkName - the name of the virtual network. -// expand - expands referenced resources. -func (client VirtualNetworksClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, expand string) (result VirtualNetwork, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualNetworksClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) GetResponder(resp *http.Response) (result VirtualNetwork, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all virtual networks in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client VirtualNetworksClient) List(ctx context.Context, resourceGroupName string) (result VirtualNetworkListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.List") - defer func() { - sc := -1 - if result.vnlr.Response.Response != nil { - sc = result.vnlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.vnlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure sending request") - return - } - - result.vnlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure responding to request") - return - } - if result.vnlr.hasNextLink() && result.vnlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualNetworksClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) ListResponder(resp *http.Response) (result VirtualNetworkListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client VirtualNetworksClient) listNextResults(ctx context.Context, lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) { - req, err := lastResults.virtualNetworkListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualNetworksClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualNetworkListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName) - return -} - -// ListAll gets all virtual networks in a subscription. -func (client VirtualNetworksClient) ListAll(ctx context.Context) (result VirtualNetworkListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListAll") - defer func() { - sc := -1 - if result.vnlr.Response.Response != nil { - sc = result.vnlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listAllNextResults - req, err := client.ListAllPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.vnlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure sending request") - return - } - - result.vnlr, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure responding to request") - return - } - if result.vnlr.hasNextLink() && result.vnlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client VirtualNetworksClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) ListAllSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) ListAllResponder(resp *http.Response) (result VirtualNetworkListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAllNextResults retrieves the next set of results, if any. -func (client VirtualNetworksClient) listAllNextResults(ctx context.Context, lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) { - req, err := lastResults.virtualNetworkListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listAllNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listAllNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listAllNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAllComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualNetworksClient) ListAllComplete(ctx context.Context) (result VirtualNetworkListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListAll") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAll(ctx) - return -} - -// ListDdosProtectionStatus gets the Ddos Protection Status of all IP Addresses under the Virtual Network -// Parameters: -// resourceGroupName - the name of the resource group. -// virtualNetworkName - the name of the virtual network. -// top - the max number of ip addresses to return. -// skipToken - the skipToken that is given with nextLink. -func (client VirtualNetworksClient) ListDdosProtectionStatus(ctx context.Context, resourceGroupName string, virtualNetworkName string, top *int32, skipToken string) (result VirtualNetworksListDdosProtectionStatusFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListDdosProtectionStatus") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListDdosProtectionStatusPreparer(ctx, resourceGroupName, virtualNetworkName, top, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListDdosProtectionStatus", nil, "Failure preparing request") - return - } - - result, err = client.ListDdosProtectionStatusSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListDdosProtectionStatus", result.Response(), "Failure sending request") - return - } - - return -} - -// ListDdosProtectionStatusPreparer prepares the ListDdosProtectionStatus request. -func (client VirtualNetworksClient) ListDdosProtectionStatusPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, top *int32, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["top"] = autorest.Encode("query", *top) - } - if len(skipToken) > 0 { - queryParameters["skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/ddosProtectionStatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListDdosProtectionStatusSender sends the ListDdosProtectionStatus request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) ListDdosProtectionStatusSender(req *http.Request) (future VirtualNetworksListDdosProtectionStatusFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ListDdosProtectionStatusResponder handles the response to the ListDdosProtectionStatus request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) ListDdosProtectionStatusResponder(resp *http.Response) (result VirtualNetworkDdosProtectionStatusResultPage, err error) { - result.vndpsr, err = client.listDdosProtectionStatusResponder(resp) - result.fn = client.listDdosProtectionStatusNextResults - return -} - -func (client VirtualNetworksClient) listDdosProtectionStatusResponder(resp *http.Response) (result VirtualNetworkDdosProtectionStatusResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listDdosProtectionStatusNextResults retrieves the next set of results, if any. -func (client VirtualNetworksClient) listDdosProtectionStatusNextResults(ctx context.Context, lastResults VirtualNetworkDdosProtectionStatusResult) (result VirtualNetworkDdosProtectionStatusResult, err error) { - req, err := lastResults.virtualNetworkDdosProtectionStatusResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listDdosProtectionStatusNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - var resp *http.Response - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listDdosProtectionStatusNextResults", resp, "Failure sending next results request") - } - return client.listDdosProtectionStatusResponder(resp) -} - -// ListDdosProtectionStatusComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualNetworksClient) ListDdosProtectionStatusComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string, top *int32, skipToken string) (result VirtualNetworksListDdosProtectionStatusAllFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListDdosProtectionStatus") - defer func() { - sc := -1 - if result.Response() != nil { - sc = result.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - var future VirtualNetworksListDdosProtectionStatusFuture - future, err = client.ListDdosProtectionStatus(ctx, resourceGroupName, virtualNetworkName, top, skipToken) - result.FutureAPI = future.FutureAPI - return -} - -// ListUsage lists usage stats. -// Parameters: -// resourceGroupName - the name of the resource group. -// virtualNetworkName - the name of the virtual network. -func (client VirtualNetworksClient) ListUsage(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworkListUsageResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListUsage") - defer func() { - sc := -1 - if result.vnlur.Response.Response != nil { - sc = result.vnlur.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listUsageNextResults - req, err := client.ListUsagePreparer(ctx, resourceGroupName, virtualNetworkName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsageSender(req) - if err != nil { - result.vnlur.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", resp, "Failure sending request") - return - } - - result.vnlur, err = client.ListUsageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", resp, "Failure responding to request") - return - } - if result.vnlur.hasNextLink() && result.vnlur.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListUsagePreparer prepares the ListUsage request. -func (client VirtualNetworksClient) ListUsagePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsageSender sends the ListUsage request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) ListUsageSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsageResponder handles the response to the ListUsage request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) ListUsageResponder(resp *http.Response) (result VirtualNetworkListUsageResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listUsageNextResults retrieves the next set of results, if any. -func (client VirtualNetworksClient) listUsageNextResults(ctx context.Context, lastResults VirtualNetworkListUsageResult) (result VirtualNetworkListUsageResult, err error) { - req, err := lastResults.virtualNetworkListUsageResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listUsageNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListUsageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listUsageNextResults", resp, "Failure sending next results request") - } - result, err = client.ListUsageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listUsageNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListUsageComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualNetworksClient) ListUsageComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworkListUsageResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListUsage") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListUsage(ctx, resourceGroupName, virtualNetworkName) - return -} - -// UpdateTags updates a virtual network tags. -// Parameters: -// resourceGroupName - the name of the resource group. -// virtualNetworkName - the name of the virtual network. -// parameters - parameters supplied to update virtual network tags. -func (client VirtualNetworksClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters TagsObject) (result VirtualNetwork, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.UpdateTags") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "UpdateTags", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "UpdateTags", resp, "Failure sending request") - return - } - - result, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "UpdateTags", resp, "Failure responding to request") - return - } - - return -} - -// UpdateTagsPreparer prepares the UpdateTags request. -func (client VirtualNetworksClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters TagsObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2022-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTagsSender sends the UpdateTags request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateTagsResponder handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) UpdateTagsResponder(resp *http.Response) (result VirtualNetwork, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/adminrulecollections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/adminrulecollections.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/adminrulecollections.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/adminrulecollections.go index 073f4ceaec8a..a938770cfe1d 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/adminrulecollections.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/adminrulecollections.go @@ -90,7 +90,7 @@ func (client AdminRuleCollectionsClient) CreateOrUpdatePreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -168,7 +168,7 @@ func (client AdminRuleCollectionsClient) DeletePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -260,7 +260,7 @@ func (client AdminRuleCollectionsClient) GetPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -357,7 +357,7 @@ func (client AdminRuleCollectionsClient) ListPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/adminrules.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/adminrules.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/adminrules.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/adminrules.go index d3785332a234..1918a1ec0065 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/adminrules.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/adminrules.go @@ -84,7 +84,7 @@ func (client AdminRulesClient) CreateOrUpdatePreparer(ctx context.Context, admin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -163,7 +163,7 @@ func (client AdminRulesClient) DeletePreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -257,7 +257,7 @@ func (client AdminRulesClient) GetPreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -356,7 +356,7 @@ func (client AdminRulesClient) ListPreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationgatewayprivateendpointconnections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationgatewayprivateendpointconnections.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationgatewayprivateendpointconnections.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationgatewayprivateendpointconnections.go index 55529c00ae96..7a537932b3bb 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationgatewayprivateendpointconnections.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationgatewayprivateendpointconnections.go @@ -73,7 +73,7 @@ func (client ApplicationGatewayPrivateEndpointConnectionsClient) DeletePreparer( "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -160,7 +160,7 @@ func (client ApplicationGatewayPrivateEndpointConnectionsClient) GetPreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -241,7 +241,7 @@ func (client ApplicationGatewayPrivateEndpointConnectionsClient) ListPreparer(ct "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -350,7 +350,7 @@ func (client ApplicationGatewayPrivateEndpointConnectionsClient) UpdatePreparer( "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationgatewayprivatelinkresources.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationgatewayprivatelinkresources.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationgatewayprivatelinkresources.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationgatewayprivatelinkresources.go index 484cfaeb30d7..97dabdda95df 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationgatewayprivatelinkresources.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationgatewayprivatelinkresources.go @@ -83,7 +83,7 @@ func (client ApplicationGatewayPrivateLinkResourcesClient) ListPreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationgateways.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationgateways.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationgateways.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationgateways.go index 26df6b004534..f069d37c9cee 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationgateways.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationgateways.go @@ -72,7 +72,7 @@ func (client ApplicationGatewaysClient) BackendHealthPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -157,7 +157,7 @@ func (client ApplicationGatewaysClient) BackendHealthOnDemandPreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -270,7 +270,7 @@ func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -352,7 +352,7 @@ func (client ApplicationGatewaysClient) DeletePreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -437,7 +437,7 @@ func (client ApplicationGatewaysClient) GetPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -511,7 +511,7 @@ func (client ApplicationGatewaysClient) GetSslPredefinedPolicyPreparer(ctx conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -590,7 +590,7 @@ func (client ApplicationGatewaysClient) ListPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -703,7 +703,7 @@ func (client ApplicationGatewaysClient) ListAllPreparer(ctx context.Context) (*h "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -811,7 +811,7 @@ func (client ApplicationGatewaysClient) ListAvailableRequestHeadersPreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -882,7 +882,7 @@ func (client ApplicationGatewaysClient) ListAvailableResponseHeadersPreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -953,7 +953,7 @@ func (client ApplicationGatewaysClient) ListAvailableServerVariablesPreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1024,7 +1024,7 @@ func (client ApplicationGatewaysClient) ListAvailableSslOptionsPreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1100,7 +1100,7 @@ func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesPrepar "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1208,7 +1208,7 @@ func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsPreparer(ctx con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1277,7 +1277,7 @@ func (client ApplicationGatewaysClient) StartPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1355,7 +1355,7 @@ func (client ApplicationGatewaysClient) StopPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1441,7 +1441,7 @@ func (client ApplicationGatewaysClient) UpdateTagsPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationgatewaywafdynamicmanifests.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationgatewaywafdynamicmanifests.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationgatewaywafdynamicmanifests.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationgatewaywafdynamicmanifests.go index 9258def126c0..a12adbf8e108 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationgatewaywafdynamicmanifests.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationgatewaywafdynamicmanifests.go @@ -81,7 +81,7 @@ func (client ApplicationGatewayWafDynamicManifestsClient) GetPreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationgatewaywafdynamicmanifestsdefault.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationgatewaywafdynamicmanifestsdefault.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationgatewaywafdynamicmanifestsdefault.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationgatewaywafdynamicmanifestsdefault.go index 1f178b9e9e3a..34425953f722 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationgatewaywafdynamicmanifestsdefault.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationgatewaywafdynamicmanifestsdefault.go @@ -76,7 +76,7 @@ func (client ApplicationGatewayWafDynamicManifestsDefaultClient) GetPreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationsecuritygroups.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationsecuritygroups.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationsecuritygroups.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationsecuritygroups.go index 0437def297de..d26497ec42af 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/applicationsecuritygroups.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/applicationsecuritygroups.go @@ -71,7 +71,7 @@ func (client ApplicationSecurityGroupsClient) CreateOrUpdatePreparer(ctx context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -153,7 +153,7 @@ func (client ApplicationSecurityGroupsClient) DeletePreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -238,7 +238,7 @@ func (client ApplicationSecurityGroupsClient) GetPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -317,7 +317,7 @@ func (client ApplicationSecurityGroupsClient) ListPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -430,7 +430,7 @@ func (client ApplicationSecurityGroupsClient) ListAllPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -544,7 +544,7 @@ func (client ApplicationSecurityGroupsClient) UpdateTagsPreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/availabledelegations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/availabledelegations.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/availabledelegations.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/availabledelegations.go index f3b9470af8ca..d359ef4e54e6 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/availabledelegations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/availabledelegations.go @@ -80,7 +80,7 @@ func (client AvailableDelegationsClient) ListPreparer(ctx context.Context, locat "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/availableendpointservices.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/availableendpointservices.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/availableendpointservices.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/availableendpointservices.go index 2b9730cdf95a..a56571bf9133 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/availableendpointservices.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/availableendpointservices.go @@ -80,7 +80,7 @@ func (client AvailableEndpointServicesClient) ListPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/availableprivateendpointtypes.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/availableprivateendpointtypes.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/availableprivateendpointtypes.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/availableprivateendpointtypes.go index 3164ec6fbd7d..2b39e9ee44d1 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/availableprivateendpointtypes.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/availableprivateendpointtypes.go @@ -80,7 +80,7 @@ func (client AvailablePrivateEndpointTypesClient) ListPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -199,7 +199,7 @@ func (client AvailablePrivateEndpointTypesClient) ListByResourceGroupPreparer(ct "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/availableresourcegroupdelegations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/availableresourcegroupdelegations.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/availableresourcegroupdelegations.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/availableresourcegroupdelegations.go index 4b95c077c155..61e744de0947 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/availableresourcegroupdelegations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/availableresourcegroupdelegations.go @@ -83,7 +83,7 @@ func (client AvailableResourceGroupDelegationsClient) ListPreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/availableservicealiases.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/availableservicealiases.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/availableservicealiases.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/availableservicealiases.go index b2fba7a41111..033be4938f61 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/availableservicealiases.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/availableservicealiases.go @@ -80,7 +80,7 @@ func (client AvailableServiceAliasesClient) ListPreparer(ctx context.Context, lo "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -198,7 +198,7 @@ func (client AvailableServiceAliasesClient) ListByResourceGroupPreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/azurefirewallfqdntags.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/azurefirewallfqdntags.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/azurefirewallfqdntags.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/azurefirewallfqdntags.go index 7ed814bbaa90..aa0b019aee4f 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/azurefirewallfqdntags.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/azurefirewallfqdntags.go @@ -77,7 +77,7 @@ func (client AzureFirewallFqdnTagsClient) ListAllPreparer(ctx context.Context) ( "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/azurefirewalls.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/azurefirewalls.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/azurefirewalls.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/azurefirewalls.go index a6eef086ac7c..6c62d879e896 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/azurefirewalls.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/azurefirewalls.go @@ -78,7 +78,7 @@ func (client AzureFirewallsClient) CreateOrUpdatePreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -160,7 +160,7 @@ func (client AzureFirewallsClient) DeletePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -245,7 +245,7 @@ func (client AzureFirewallsClient) GetPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -324,7 +324,7 @@ func (client AzureFirewallsClient) ListPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -437,7 +437,7 @@ func (client AzureFirewallsClient) ListAllPreparer(ctx context.Context) (*http.R "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -543,7 +543,7 @@ func (client AzureFirewallsClient) ListLearnedPrefixesPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -623,7 +623,7 @@ func (client AzureFirewallsClient) UpdateTagsPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/bastionhosts.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/bastionhosts.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/bastionhosts.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/bastionhosts.go index 6a70d40497aa..a60163f803a6 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/bastionhosts.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/bastionhosts.go @@ -82,7 +82,7 @@ func (client BastionHostsClient) CreateOrUpdatePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -164,7 +164,7 @@ func (client BastionHostsClient) DeletePreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -249,7 +249,7 @@ func (client BastionHostsClient) GetPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -325,7 +325,7 @@ func (client BastionHostsClient) ListPreparer(ctx context.Context) (*http.Reques "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -441,7 +441,7 @@ func (client BastionHostsClient) ListByResourceGroupPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -548,7 +548,7 @@ func (client BastionHostsClient) UpdateTagsPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/bgpservicecommunities.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/bgpservicecommunities.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/bgpservicecommunities.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/bgpservicecommunities.go index 950db80d5d23..7dbc9410f93d 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/bgpservicecommunities.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/bgpservicecommunities.go @@ -77,7 +77,7 @@ func (client BgpServiceCommunitiesClient) ListPreparer(ctx context.Context) (*ht "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/client.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/client.go new file mode 100644 index 000000000000..9624a11500fa --- /dev/null +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/client.go @@ -0,0 +1,1296 @@ +// Package network implements the Azure ARM Network service API version . +// +// Network Client +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" +) + +const ( + // DefaultBaseURI is the default URI used for the service Network + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Network. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} + +// CheckDNSNameAvailability checks whether a domain name in the cloudapp.azure.com zone is available for use. +// Parameters: +// location - the location of the domain name. +// domainNameLabel - the domain name to be verified. It must conform to the following regular expression: +// ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. +func (client BaseClient) CheckDNSNameAvailability(ctx context.Context, location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckDNSNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckDNSNameAvailabilityPreparer(ctx, location, domainNameLabel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckDNSNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckDNSNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckDNSNameAvailabilityPreparer prepares the CheckDNSNameAvailability request. +func (client BaseClient) CheckDNSNameAvailabilityPreparer(ctx context.Context, location string, domainNameLabel string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "domainNameLabel": autorest.Encode("query", domainNameLabel), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckDNSNameAvailabilitySender sends the CheckDNSNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) CheckDNSNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckDNSNameAvailabilityResponder handles the response to the CheckDNSNameAvailability request. The method always +// closes the http.Response Body. +func (client BaseClient) CheckDNSNameAvailabilityResponder(resp *http.Response) (result DNSNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteBastionShareableLink deletes the Bastion Shareable Links for all the VMs specified in the request. +// Parameters: +// resourceGroupName - the name of the resource group. +// bastionHostName - the name of the Bastion Host. +// bslRequest - post request for all the Bastion Shareable Link endpoints. +func (client BaseClient) DeleteBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (result DeleteBastionShareableLinkFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteBastionShareableLink") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteBastionShareableLinkPreparer(ctx, resourceGroupName, bastionHostName, bslRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "DeleteBastionShareableLink", nil, "Failure preparing request") + return + } + + result, err = client.DeleteBastionShareableLinkSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "DeleteBastionShareableLink", result.Response(), "Failure sending request") + return + } + + return +} + +// DeleteBastionShareableLinkPreparer prepares the DeleteBastionShareableLink request. +func (client BaseClient) DeleteBastionShareableLinkPreparer(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bastionHostName": autorest.Encode("path", bastionHostName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/deleteShareableLinks", pathParameters), + autorest.WithJSON(bslRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteBastionShareableLinkSender sends the DeleteBastionShareableLink request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DeleteBastionShareableLinkSender(req *http.Request) (future DeleteBastionShareableLinkFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteBastionShareableLinkResponder handles the response to the DeleteBastionShareableLink request. The method always +// closes the http.Response Body. +func (client BaseClient) DeleteBastionShareableLinkResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DisconnectActiveSessions returns the list of currently active sessions on the Bastion. +// Parameters: +// resourceGroupName - the name of the resource group. +// bastionHostName - the name of the Bastion Host. +// sessionIds - the list of sessionids to disconnect. +func (client BaseClient) DisconnectActiveSessions(ctx context.Context, resourceGroupName string, bastionHostName string, sessionIds SessionIds) (result BastionSessionDeleteResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DisconnectActiveSessions") + defer func() { + sc := -1 + if result.bsdr.Response.Response != nil { + sc = result.bsdr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.disconnectActiveSessionsNextResults + req, err := client.DisconnectActiveSessionsPreparer(ctx, resourceGroupName, bastionHostName, sessionIds) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "DisconnectActiveSessions", nil, "Failure preparing request") + return + } + + resp, err := client.DisconnectActiveSessionsSender(req) + if err != nil { + result.bsdr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BaseClient", "DisconnectActiveSessions", resp, "Failure sending request") + return + } + + result.bsdr, err = client.DisconnectActiveSessionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "DisconnectActiveSessions", resp, "Failure responding to request") + return + } + if result.bsdr.hasNextLink() && result.bsdr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// DisconnectActiveSessionsPreparer prepares the DisconnectActiveSessions request. +func (client BaseClient) DisconnectActiveSessionsPreparer(ctx context.Context, resourceGroupName string, bastionHostName string, sessionIds SessionIds) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bastionHostName": autorest.Encode("path", bastionHostName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/disconnectActiveSessions", pathParameters), + autorest.WithJSON(sessionIds), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisconnectActiveSessionsSender sends the DisconnectActiveSessions request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DisconnectActiveSessionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DisconnectActiveSessionsResponder handles the response to the DisconnectActiveSessions request. The method always +// closes the http.Response Body. +func (client BaseClient) DisconnectActiveSessionsResponder(resp *http.Response) (result BastionSessionDeleteResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// disconnectActiveSessionsNextResults retrieves the next set of results, if any. +func (client BaseClient) disconnectActiveSessionsNextResults(ctx context.Context, lastResults BastionSessionDeleteResult) (result BastionSessionDeleteResult, err error) { + req, err := lastResults.bastionSessionDeleteResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BaseClient", "disconnectActiveSessionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.DisconnectActiveSessionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.BaseClient", "disconnectActiveSessionsNextResults", resp, "Failure sending next results request") + } + result, err = client.DisconnectActiveSessionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "disconnectActiveSessionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// DisconnectActiveSessionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) DisconnectActiveSessionsComplete(ctx context.Context, resourceGroupName string, bastionHostName string, sessionIds SessionIds) (result BastionSessionDeleteResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DisconnectActiveSessions") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.DisconnectActiveSessions(ctx, resourceGroupName, bastionHostName, sessionIds) + return +} + +// ExpressRouteProviderPortMethod retrieves detail of a provider port. +// Parameters: +// providerport - the name of the provider port. +func (client BaseClient) ExpressRouteProviderPortMethod(ctx context.Context, providerport string) (result ExpressRouteProviderPort, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ExpressRouteProviderPortMethod") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ExpressRouteProviderPortMethodPreparer(ctx, providerport) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "ExpressRouteProviderPortMethod", nil, "Failure preparing request") + return + } + + resp, err := client.ExpressRouteProviderPortMethodSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BaseClient", "ExpressRouteProviderPortMethod", resp, "Failure sending request") + return + } + + result, err = client.ExpressRouteProviderPortMethodResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "ExpressRouteProviderPortMethod", resp, "Failure responding to request") + return + } + + return +} + +// ExpressRouteProviderPortMethodPreparer prepares the ExpressRouteProviderPortMethod request. +func (client BaseClient) ExpressRouteProviderPortMethodPreparer(ctx context.Context, providerport string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "providerport": autorest.Encode("path", providerport), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts/{providerport}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExpressRouteProviderPortMethodSender sends the ExpressRouteProviderPortMethod request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ExpressRouteProviderPortMethodSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ExpressRouteProviderPortMethodResponder handles the response to the ExpressRouteProviderPortMethod request. The method always +// closes the http.Response Body. +func (client BaseClient) ExpressRouteProviderPortMethodResponder(resp *http.Response) (result ExpressRouteProviderPort, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Generatevirtualwanvpnserverconfigurationvpnprofile generates a unique VPN profile for P2S clients for VirtualWan and +// associated VpnServerConfiguration combination in the specified resource group. +// Parameters: +// resourceGroupName - the resource group name. +// virtualWANName - the name of the VirtualWAN whose associated VpnServerConfigurations is needed. +// vpnClientParams - parameters supplied to the generate VirtualWan VPN profile generation operation. +func (client BaseClient) Generatevirtualwanvpnserverconfigurationvpnprofile(ctx context.Context, resourceGroupName string, virtualWANName string, vpnClientParams VirtualWanVpnProfileParameters) (result GeneratevirtualwanvpnserverconfigurationvpnprofileFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.Generatevirtualwanvpnserverconfigurationvpnprofile") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GeneratevirtualwanvpnserverconfigurationvpnprofilePreparer(ctx, resourceGroupName, virtualWANName, vpnClientParams) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "Generatevirtualwanvpnserverconfigurationvpnprofile", nil, "Failure preparing request") + return + } + + result, err = client.GeneratevirtualwanvpnserverconfigurationvpnprofileSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "Generatevirtualwanvpnserverconfigurationvpnprofile", result.Response(), "Failure sending request") + return + } + + return +} + +// GeneratevirtualwanvpnserverconfigurationvpnprofilePreparer prepares the Generatevirtualwanvpnserverconfigurationvpnprofile request. +func (client BaseClient) GeneratevirtualwanvpnserverconfigurationvpnprofilePreparer(ctx context.Context, resourceGroupName string, virtualWANName string, vpnClientParams VirtualWanVpnProfileParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualWANName": autorest.Encode("path", virtualWANName), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/GenerateVpnProfile", pathParameters), + autorest.WithJSON(vpnClientParams), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GeneratevirtualwanvpnserverconfigurationvpnprofileSender sends the Generatevirtualwanvpnserverconfigurationvpnprofile request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GeneratevirtualwanvpnserverconfigurationvpnprofileSender(req *http.Request) (future GeneratevirtualwanvpnserverconfigurationvpnprofileFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GeneratevirtualwanvpnserverconfigurationvpnprofileResponder handles the response to the Generatevirtualwanvpnserverconfigurationvpnprofile request. The method always +// closes the http.Response Body. +func (client BaseClient) GeneratevirtualwanvpnserverconfigurationvpnprofileResponder(resp *http.Response) (result VpnProfileResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetActiveSessions returns the list of currently active sessions on the Bastion. +// Parameters: +// resourceGroupName - the name of the resource group. +// bastionHostName - the name of the Bastion Host. +func (client BaseClient) GetActiveSessions(ctx context.Context, resourceGroupName string, bastionHostName string) (result GetActiveSessionsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetActiveSessions") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetActiveSessionsPreparer(ctx, resourceGroupName, bastionHostName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "GetActiveSessions", nil, "Failure preparing request") + return + } + + result, err = client.GetActiveSessionsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "GetActiveSessions", result.Response(), "Failure sending request") + return + } + + return +} + +// GetActiveSessionsPreparer prepares the GetActiveSessions request. +func (client BaseClient) GetActiveSessionsPreparer(ctx context.Context, resourceGroupName string, bastionHostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bastionHostName": autorest.Encode("path", bastionHostName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getActiveSessions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetActiveSessionsSender sends the GetActiveSessions request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetActiveSessionsSender(req *http.Request) (future GetActiveSessionsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetActiveSessionsResponder handles the response to the GetActiveSessions request. The method always +// closes the http.Response Body. +func (client BaseClient) GetActiveSessionsResponder(resp *http.Response) (result BastionActiveSessionListResultPage, err error) { + result.baslr, err = client.getActiveSessionsResponder(resp) + result.fn = client.getActiveSessionsNextResults + return +} + +func (client BaseClient) getActiveSessionsResponder(resp *http.Response) (result BastionActiveSessionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getActiveSessionsNextResults retrieves the next set of results, if any. +func (client BaseClient) getActiveSessionsNextResults(ctx context.Context, lastResults BastionActiveSessionListResult) (result BastionActiveSessionListResult, err error) { + req, err := lastResults.bastionActiveSessionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BaseClient", "getActiveSessionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + var resp *http.Response + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BaseClient", "getActiveSessionsNextResults", resp, "Failure sending next results request") + } + return client.getActiveSessionsResponder(resp) +} + +// GetActiveSessionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetActiveSessionsComplete(ctx context.Context, resourceGroupName string, bastionHostName string) (result GetActiveSessionsAllFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetActiveSessions") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + var future GetActiveSessionsFuture + future, err = client.GetActiveSessions(ctx, resourceGroupName, bastionHostName) + result.FutureAPI = future.FutureAPI + return +} + +// GetBastionShareableLink return the Bastion Shareable Links for all the VMs specified in the request. +// Parameters: +// resourceGroupName - the name of the resource group. +// bastionHostName - the name of the Bastion Host. +// bslRequest - post request for all the Bastion Shareable Link endpoints. +func (client BaseClient) GetBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (result BastionShareableLinkListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetBastionShareableLink") + defer func() { + sc := -1 + if result.bsllr.Response.Response != nil { + sc = result.bsllr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.getBastionShareableLinkNextResults + req, err := client.GetBastionShareableLinkPreparer(ctx, resourceGroupName, bastionHostName, bslRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "GetBastionShareableLink", nil, "Failure preparing request") + return + } + + resp, err := client.GetBastionShareableLinkSender(req) + if err != nil { + result.bsllr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BaseClient", "GetBastionShareableLink", resp, "Failure sending request") + return + } + + result.bsllr, err = client.GetBastionShareableLinkResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "GetBastionShareableLink", resp, "Failure responding to request") + return + } + if result.bsllr.hasNextLink() && result.bsllr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetBastionShareableLinkPreparer prepares the GetBastionShareableLink request. +func (client BaseClient) GetBastionShareableLinkPreparer(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bastionHostName": autorest.Encode("path", bastionHostName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getShareableLinks", pathParameters), + autorest.WithJSON(bslRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBastionShareableLinkSender sends the GetBastionShareableLink request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetBastionShareableLinkSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBastionShareableLinkResponder handles the response to the GetBastionShareableLink request. The method always +// closes the http.Response Body. +func (client BaseClient) GetBastionShareableLinkResponder(resp *http.Response) (result BastionShareableLinkListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getBastionShareableLinkNextResults retrieves the next set of results, if any. +func (client BaseClient) getBastionShareableLinkNextResults(ctx context.Context, lastResults BastionShareableLinkListResult) (result BastionShareableLinkListResult, err error) { + req, err := lastResults.bastionShareableLinkListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BaseClient", "getBastionShareableLinkNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetBastionShareableLinkSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.BaseClient", "getBastionShareableLinkNextResults", resp, "Failure sending next results request") + } + result, err = client.GetBastionShareableLinkResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "getBastionShareableLinkNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetBastionShareableLinkComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetBastionShareableLinkComplete(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (result BastionShareableLinkListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetBastionShareableLink") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetBastionShareableLink(ctx, resourceGroupName, bastionHostName, bslRequest) + return +} + +// ListActiveConnectivityConfigurations lists active connectivity configurations in a network manager. +// Parameters: +// parameters - active Configuration Parameter. +// resourceGroupName - the name of the resource group. +// networkManagerName - the name of the network manager. +// top - an optional query parameter which specifies the maximum number of records to be returned by the +// server. +func (client BaseClient) ListActiveConnectivityConfigurations(ctx context.Context, parameters ActiveConfigurationParameter, resourceGroupName string, networkManagerName string, top *int32) (result ActiveConnectivityConfigurationsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListActiveConnectivityConfigurations") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(20), Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("network.BaseClient", "ListActiveConnectivityConfigurations", err.Error()) + } + + req, err := client.ListActiveConnectivityConfigurationsPreparer(ctx, parameters, resourceGroupName, networkManagerName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "ListActiveConnectivityConfigurations", nil, "Failure preparing request") + return + } + + resp, err := client.ListActiveConnectivityConfigurationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BaseClient", "ListActiveConnectivityConfigurations", resp, "Failure sending request") + return + } + + result, err = client.ListActiveConnectivityConfigurationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "ListActiveConnectivityConfigurations", resp, "Failure responding to request") + return + } + + return +} + +// ListActiveConnectivityConfigurationsPreparer prepares the ListActiveConnectivityConfigurations request. +func (client BaseClient) ListActiveConnectivityConfigurationsPreparer(ctx context.Context, parameters ActiveConfigurationParameter, resourceGroupName string, networkManagerName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkManagerName": autorest.Encode("path", networkManagerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveConnectivityConfigurations", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListActiveConnectivityConfigurationsSender sends the ListActiveConnectivityConfigurations request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ListActiveConnectivityConfigurationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListActiveConnectivityConfigurationsResponder handles the response to the ListActiveConnectivityConfigurations request. The method always +// closes the http.Response Body. +func (client BaseClient) ListActiveConnectivityConfigurationsResponder(resp *http.Response) (result ActiveConnectivityConfigurationsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListActiveSecurityAdminRules lists active security admin rules in a network manager. +// Parameters: +// parameters - active Configuration Parameter. +// resourceGroupName - the name of the resource group. +// networkManagerName - the name of the network manager. +// top - an optional query parameter which specifies the maximum number of records to be returned by the +// server. +func (client BaseClient) ListActiveSecurityAdminRules(ctx context.Context, parameters ActiveConfigurationParameter, resourceGroupName string, networkManagerName string, top *int32) (result ActiveSecurityAdminRulesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListActiveSecurityAdminRules") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(20), Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("network.BaseClient", "ListActiveSecurityAdminRules", err.Error()) + } + + req, err := client.ListActiveSecurityAdminRulesPreparer(ctx, parameters, resourceGroupName, networkManagerName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "ListActiveSecurityAdminRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListActiveSecurityAdminRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BaseClient", "ListActiveSecurityAdminRules", resp, "Failure sending request") + return + } + + result, err = client.ListActiveSecurityAdminRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "ListActiveSecurityAdminRules", resp, "Failure responding to request") + return + } + + return +} + +// ListActiveSecurityAdminRulesPreparer prepares the ListActiveSecurityAdminRules request. +func (client BaseClient) ListActiveSecurityAdminRulesPreparer(ctx context.Context, parameters ActiveConfigurationParameter, resourceGroupName string, networkManagerName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkManagerName": autorest.Encode("path", networkManagerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/listActiveSecurityAdminRules", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListActiveSecurityAdminRulesSender sends the ListActiveSecurityAdminRules request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ListActiveSecurityAdminRulesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListActiveSecurityAdminRulesResponder handles the response to the ListActiveSecurityAdminRules request. The method always +// closes the http.Response Body. +func (client BaseClient) ListActiveSecurityAdminRulesResponder(resp *http.Response) (result ActiveSecurityAdminRulesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNetworkManagerEffectiveConnectivityConfigurations list all effective connectivity configurations applied on a +// virtual network. +// Parameters: +// parameters - parameters supplied to list correct page. +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// top - an optional query parameter which specifies the maximum number of records to be returned by the +// server. +func (client BaseClient) ListNetworkManagerEffectiveConnectivityConfigurations(ctx context.Context, parameters QueryRequestOptions, resourceGroupName string, virtualNetworkName string, top *int32) (result ManagerEffectiveConnectivityConfigurationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListNetworkManagerEffectiveConnectivityConfigurations") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(20), Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("network.BaseClient", "ListNetworkManagerEffectiveConnectivityConfigurations", err.Error()) + } + + req, err := client.ListNetworkManagerEffectiveConnectivityConfigurationsPreparer(ctx, parameters, resourceGroupName, virtualNetworkName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "ListNetworkManagerEffectiveConnectivityConfigurations", nil, "Failure preparing request") + return + } + + resp, err := client.ListNetworkManagerEffectiveConnectivityConfigurationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BaseClient", "ListNetworkManagerEffectiveConnectivityConfigurations", resp, "Failure sending request") + return + } + + result, err = client.ListNetworkManagerEffectiveConnectivityConfigurationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "ListNetworkManagerEffectiveConnectivityConfigurations", resp, "Failure responding to request") + return + } + + return +} + +// ListNetworkManagerEffectiveConnectivityConfigurationsPreparer prepares the ListNetworkManagerEffectiveConnectivityConfigurations request. +func (client BaseClient) ListNetworkManagerEffectiveConnectivityConfigurationsPreparer(ctx context.Context, parameters QueryRequestOptions, resourceGroupName string, virtualNetworkName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveConnectivityConfigurations", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListNetworkManagerEffectiveConnectivityConfigurationsSender sends the ListNetworkManagerEffectiveConnectivityConfigurations request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ListNetworkManagerEffectiveConnectivityConfigurationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListNetworkManagerEffectiveConnectivityConfigurationsResponder handles the response to the ListNetworkManagerEffectiveConnectivityConfigurations request. The method always +// closes the http.Response Body. +func (client BaseClient) ListNetworkManagerEffectiveConnectivityConfigurationsResponder(resp *http.Response) (result ManagerEffectiveConnectivityConfigurationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNetworkManagerEffectiveSecurityAdminRules list all effective security admin rules applied on a virtual network. +// Parameters: +// parameters - parameters supplied to list correct page. +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// top - an optional query parameter which specifies the maximum number of records to be returned by the +// server. +func (client BaseClient) ListNetworkManagerEffectiveSecurityAdminRules(ctx context.Context, parameters QueryRequestOptions, resourceGroupName string, virtualNetworkName string, top *int32) (result ManagerEffectiveSecurityAdminRulesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListNetworkManagerEffectiveSecurityAdminRules") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(20), Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("network.BaseClient", "ListNetworkManagerEffectiveSecurityAdminRules", err.Error()) + } + + req, err := client.ListNetworkManagerEffectiveSecurityAdminRulesPreparer(ctx, parameters, resourceGroupName, virtualNetworkName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "ListNetworkManagerEffectiveSecurityAdminRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListNetworkManagerEffectiveSecurityAdminRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BaseClient", "ListNetworkManagerEffectiveSecurityAdminRules", resp, "Failure sending request") + return + } + + result, err = client.ListNetworkManagerEffectiveSecurityAdminRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "ListNetworkManagerEffectiveSecurityAdminRules", resp, "Failure responding to request") + return + } + + return +} + +// ListNetworkManagerEffectiveSecurityAdminRulesPreparer prepares the ListNetworkManagerEffectiveSecurityAdminRules request. +func (client BaseClient) ListNetworkManagerEffectiveSecurityAdminRulesPreparer(ctx context.Context, parameters QueryRequestOptions, resourceGroupName string, virtualNetworkName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listNetworkManagerEffectiveSecurityAdminRules", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListNetworkManagerEffectiveSecurityAdminRulesSender sends the ListNetworkManagerEffectiveSecurityAdminRules request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ListNetworkManagerEffectiveSecurityAdminRulesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListNetworkManagerEffectiveSecurityAdminRulesResponder handles the response to the ListNetworkManagerEffectiveSecurityAdminRules request. The method always +// closes the http.Response Body. +func (client BaseClient) ListNetworkManagerEffectiveSecurityAdminRulesResponder(resp *http.Response) (result ManagerEffectiveSecurityAdminRulesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// PutBastionShareableLink creates a Bastion Shareable Links for all the VMs specified in the request. +// Parameters: +// resourceGroupName - the name of the resource group. +// bastionHostName - the name of the Bastion Host. +// bslRequest - post request for all the Bastion Shareable Link endpoints. +func (client BaseClient) PutBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (result PutBastionShareableLinkFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PutBastionShareableLink") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PutBastionShareableLinkPreparer(ctx, resourceGroupName, bastionHostName, bslRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "PutBastionShareableLink", nil, "Failure preparing request") + return + } + + result, err = client.PutBastionShareableLinkSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "PutBastionShareableLink", result.Response(), "Failure sending request") + return + } + + return +} + +// PutBastionShareableLinkPreparer prepares the PutBastionShareableLink request. +func (client BaseClient) PutBastionShareableLinkPreparer(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bastionHostName": autorest.Encode("path", bastionHostName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/createShareableLinks", pathParameters), + autorest.WithJSON(bslRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutBastionShareableLinkSender sends the PutBastionShareableLink request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) PutBastionShareableLinkSender(req *http.Request) (future PutBastionShareableLinkFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PutBastionShareableLinkResponder handles the response to the PutBastionShareableLink request. The method always +// closes the http.Response Body. +func (client BaseClient) PutBastionShareableLinkResponder(resp *http.Response) (result BastionShareableLinkListResultPage, err error) { + result.bsllr, err = client.putBastionShareableLinkResponder(resp) + result.fn = client.putBastionShareableLinkNextResults + return +} + +func (client BaseClient) putBastionShareableLinkResponder(resp *http.Response) (result BastionShareableLinkListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// putBastionShareableLinkNextResults retrieves the next set of results, if any. +func (client BaseClient) putBastionShareableLinkNextResults(ctx context.Context, lastResults BastionShareableLinkListResult) (result BastionShareableLinkListResult, err error) { + req, err := lastResults.bastionShareableLinkListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BaseClient", "putBastionShareableLinkNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + var resp *http.Response + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BaseClient", "putBastionShareableLinkNextResults", resp, "Failure sending next results request") + } + return client.putBastionShareableLinkResponder(resp) +} + +// PutBastionShareableLinkComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) PutBastionShareableLinkComplete(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (result PutBastionShareableLinkAllFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PutBastionShareableLink") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + var future PutBastionShareableLinkFuture + future, err = client.PutBastionShareableLink(ctx, resourceGroupName, bastionHostName, bslRequest) + result.FutureAPI = future.FutureAPI + return +} + +// SupportedSecurityProviders gives the supported security providers for the virtual wan. +// Parameters: +// resourceGroupName - the resource group name. +// virtualWANName - the name of the VirtualWAN for which supported security providers are needed. +func (client BaseClient) SupportedSecurityProviders(ctx context.Context, resourceGroupName string, virtualWANName string) (result VirtualWanSecurityProviders, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.SupportedSecurityProviders") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.SupportedSecurityProvidersPreparer(ctx, resourceGroupName, virtualWANName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "SupportedSecurityProviders", nil, "Failure preparing request") + return + } + + resp, err := client.SupportedSecurityProvidersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BaseClient", "SupportedSecurityProviders", resp, "Failure sending request") + return + } + + result, err = client.SupportedSecurityProvidersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "SupportedSecurityProviders", resp, "Failure responding to request") + return + } + + return +} + +// SupportedSecurityProvidersPreparer prepares the SupportedSecurityProviders request. +func (client BaseClient) SupportedSecurityProvidersPreparer(ctx context.Context, resourceGroupName string, virtualWANName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualWANName": autorest.Encode("path", virtualWANName), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/supportedSecurityProviders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SupportedSecurityProvidersSender sends the SupportedSecurityProviders request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) SupportedSecurityProvidersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SupportedSecurityProvidersResponder handles the response to the SupportedSecurityProviders request. The method always +// closes the http.Response Body. +func (client BaseClient) SupportedSecurityProvidersResponder(resp *http.Response) (result VirtualWanSecurityProviders, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/configurationpolicygroups.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/configurationpolicygroups.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/configurationpolicygroups.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/configurationpolicygroups.go index 32b8e2644c79..8ec9ada2cc4e 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/configurationpolicygroups.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/configurationpolicygroups.go @@ -74,7 +74,7 @@ func (client ConfigurationPolicyGroupsClient) CreateOrUpdatePreparer(ctx context "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -159,7 +159,7 @@ func (client ConfigurationPolicyGroupsClient) DeletePreparer(ctx context.Context "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -246,7 +246,7 @@ func (client ConfigurationPolicyGroupsClient) GetPreparer(ctx context.Context, r "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -328,7 +328,7 @@ func (client ConfigurationPolicyGroupsClient) ListByVpnServerConfigurationPrepar "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/connectionmonitors.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/connectionmonitors.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/connectionmonitors.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/connectionmonitors.go index 1900e622e618..9d49d5437fc4 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/connectionmonitors.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/connectionmonitors.go @@ -99,7 +99,7 @@ func (client ConnectionMonitorsClient) CreateOrUpdatePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -185,7 +185,7 @@ func (client ConnectionMonitorsClient) DeletePreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -272,7 +272,7 @@ func (client ConnectionMonitorsClient) GetPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -348,7 +348,7 @@ func (client ConnectionMonitorsClient) ListPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -419,7 +419,7 @@ func (client ConnectionMonitorsClient) QueryPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -500,7 +500,7 @@ func (client ConnectionMonitorsClient) StartPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -580,7 +580,7 @@ func (client ConnectionMonitorsClient) StopPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -668,7 +668,7 @@ func (client ConnectionMonitorsClient) UpdateTagsPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/connectivityconfigurations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/connectivityconfigurations.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/connectivityconfigurations.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/connectivityconfigurations.go index 009aaf836398..5f59cb330877 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/connectivityconfigurations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/connectivityconfigurations.go @@ -89,7 +89,7 @@ func (client ConnectivityConfigurationsClient) CreateOrUpdatePreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -166,7 +166,7 @@ func (client ConnectivityConfigurationsClient) DeletePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -257,7 +257,7 @@ func (client ConnectivityConfigurationsClient) GetPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -352,7 +352,7 @@ func (client ConnectivityConfigurationsClient) ListPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/customipprefixes.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/customipprefixes.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/customipprefixes.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/customipprefixes.go index eb2286c03a6b..d5011657a00d 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/customipprefixes.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/customipprefixes.go @@ -71,7 +71,7 @@ func (client CustomIPPrefixesClient) CreateOrUpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -153,7 +153,7 @@ func (client CustomIPPrefixesClient) DeletePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -239,7 +239,7 @@ func (client CustomIPPrefixesClient) GetPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -321,7 +321,7 @@ func (client CustomIPPrefixesClient) ListPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -434,7 +434,7 @@ func (client CustomIPPrefixesClient) ListAllPreparer(ctx context.Context) (*http "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -548,7 +548,7 @@ func (client CustomIPPrefixesClient) UpdateTagsPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/ddoscustompolicies.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/ddoscustompolicies.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/ddoscustompolicies.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/ddoscustompolicies.go index c01d050ac5ae..afca9e15343c 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/ddoscustompolicies.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/ddoscustompolicies.go @@ -71,7 +71,7 @@ func (client DdosCustomPoliciesClient) CreateOrUpdatePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -153,7 +153,7 @@ func (client DdosCustomPoliciesClient) DeletePreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -238,7 +238,7 @@ func (client DdosCustomPoliciesClient) GetPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -315,7 +315,7 @@ func (client DdosCustomPoliciesClient) UpdateTagsPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/ddosprotectionplans.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/ddosprotectionplans.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/ddosprotectionplans.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/ddosprotectionplans.go index 5e1f9fc78f1c..d0166c3c45ff 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/ddosprotectionplans.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/ddosprotectionplans.go @@ -71,7 +71,7 @@ func (client DdosProtectionPlansClient) CreateOrUpdatePreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -156,7 +156,7 @@ func (client DdosProtectionPlansClient) DeletePreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -241,7 +241,7 @@ func (client DdosProtectionPlansClient) GetPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -317,7 +317,7 @@ func (client DdosProtectionPlansClient) ListPreparer(ctx context.Context) (*http "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -433,7 +433,7 @@ func (client DdosProtectionPlansClient) ListByResourceGroupPreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -547,7 +547,7 @@ func (client DdosProtectionPlansClient) UpdateTagsPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/defaultsecurityrules.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/defaultsecurityrules.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/defaultsecurityrules.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/defaultsecurityrules.go index 667cda88474f..68566501925f 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/defaultsecurityrules.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/defaultsecurityrules.go @@ -79,7 +79,7 @@ func (client DefaultSecurityRulesClient) GetPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -160,7 +160,7 @@ func (client DefaultSecurityRulesClient) ListPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/dscpconfiguration.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/dscpconfiguration.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/dscpconfiguration.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/dscpconfiguration.go index 646ce35c474a..af7d30d75ef6 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/dscpconfiguration.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/dscpconfiguration.go @@ -71,7 +71,7 @@ func (client DscpConfigurationClient) CreateOrUpdatePreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -153,7 +153,7 @@ func (client DscpConfigurationClient) DeletePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -238,7 +238,7 @@ func (client DscpConfigurationClient) GetPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -317,7 +317,7 @@ func (client DscpConfigurationClient) ListPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -430,7 +430,7 @@ func (client DscpConfigurationClient) ListAllPreparer(ctx context.Context) (*htt "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/enums.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/enums.go new file mode 100644 index 000000000000..8c94cefd9fa2 --- /dev/null +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/enums.go @@ -0,0 +1,3703 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Access enumerates the values for access. +type Access string + +const ( + // AccessAllow ... + AccessAllow Access = "Allow" + // AccessDeny ... + AccessDeny Access = "Deny" +) + +// PossibleAccessValues returns an array of possible values for the Access const type. +func PossibleAccessValues() []Access { + return []Access{AccessAllow, AccessDeny} +} + +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // ActionTypeAllow ... + ActionTypeAllow ActionType = "Allow" + // ActionTypeAnomalyScoring ... + ActionTypeAnomalyScoring ActionType = "AnomalyScoring" + // ActionTypeBlock ... + ActionTypeBlock ActionType = "Block" + // ActionTypeLog ... + ActionTypeLog ActionType = "Log" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ActionTypeAllow, ActionTypeAnomalyScoring, ActionTypeBlock, ActionTypeLog} +} + +// AddressPrefixType enumerates the values for address prefix type. +type AddressPrefixType string + +const ( + // AddressPrefixTypeIPPrefix ... + AddressPrefixTypeIPPrefix AddressPrefixType = "IPPrefix" + // AddressPrefixTypeServiceTag ... + AddressPrefixTypeServiceTag AddressPrefixType = "ServiceTag" +) + +// PossibleAddressPrefixTypeValues returns an array of possible values for the AddressPrefixType const type. +func PossibleAddressPrefixTypeValues() []AddressPrefixType { + return []AddressPrefixType{AddressPrefixTypeIPPrefix, AddressPrefixTypeServiceTag} +} + +// ApplicationGatewayBackendHealthServerHealth enumerates the values for application gateway backend health +// server health. +type ApplicationGatewayBackendHealthServerHealth string + +const ( + // ApplicationGatewayBackendHealthServerHealthDown ... + ApplicationGatewayBackendHealthServerHealthDown ApplicationGatewayBackendHealthServerHealth = "Down" + // ApplicationGatewayBackendHealthServerHealthDraining ... + ApplicationGatewayBackendHealthServerHealthDraining ApplicationGatewayBackendHealthServerHealth = "Draining" + // ApplicationGatewayBackendHealthServerHealthPartial ... + ApplicationGatewayBackendHealthServerHealthPartial ApplicationGatewayBackendHealthServerHealth = "Partial" + // ApplicationGatewayBackendHealthServerHealthUnknown ... + ApplicationGatewayBackendHealthServerHealthUnknown ApplicationGatewayBackendHealthServerHealth = "Unknown" + // ApplicationGatewayBackendHealthServerHealthUp ... + ApplicationGatewayBackendHealthServerHealthUp ApplicationGatewayBackendHealthServerHealth = "Up" +) + +// PossibleApplicationGatewayBackendHealthServerHealthValues returns an array of possible values for the ApplicationGatewayBackendHealthServerHealth const type. +func PossibleApplicationGatewayBackendHealthServerHealthValues() []ApplicationGatewayBackendHealthServerHealth { + return []ApplicationGatewayBackendHealthServerHealth{ApplicationGatewayBackendHealthServerHealthDown, ApplicationGatewayBackendHealthServerHealthDraining, ApplicationGatewayBackendHealthServerHealthPartial, ApplicationGatewayBackendHealthServerHealthUnknown, ApplicationGatewayBackendHealthServerHealthUp} +} + +// ApplicationGatewayClientRevocationOptions enumerates the values for application gateway client revocation +// options. +type ApplicationGatewayClientRevocationOptions string + +const ( + // ApplicationGatewayClientRevocationOptionsNone ... + ApplicationGatewayClientRevocationOptionsNone ApplicationGatewayClientRevocationOptions = "None" + // ApplicationGatewayClientRevocationOptionsOCSP ... + ApplicationGatewayClientRevocationOptionsOCSP ApplicationGatewayClientRevocationOptions = "OCSP" +) + +// PossibleApplicationGatewayClientRevocationOptionsValues returns an array of possible values for the ApplicationGatewayClientRevocationOptions const type. +func PossibleApplicationGatewayClientRevocationOptionsValues() []ApplicationGatewayClientRevocationOptions { + return []ApplicationGatewayClientRevocationOptions{ApplicationGatewayClientRevocationOptionsNone, ApplicationGatewayClientRevocationOptionsOCSP} +} + +// ApplicationGatewayCookieBasedAffinity enumerates the values for application gateway cookie based affinity. +type ApplicationGatewayCookieBasedAffinity string + +const ( + // ApplicationGatewayCookieBasedAffinityDisabled ... + ApplicationGatewayCookieBasedAffinityDisabled ApplicationGatewayCookieBasedAffinity = "Disabled" + // ApplicationGatewayCookieBasedAffinityEnabled ... + ApplicationGatewayCookieBasedAffinityEnabled ApplicationGatewayCookieBasedAffinity = "Enabled" +) + +// PossibleApplicationGatewayCookieBasedAffinityValues returns an array of possible values for the ApplicationGatewayCookieBasedAffinity const type. +func PossibleApplicationGatewayCookieBasedAffinityValues() []ApplicationGatewayCookieBasedAffinity { + return []ApplicationGatewayCookieBasedAffinity{ApplicationGatewayCookieBasedAffinityDisabled, ApplicationGatewayCookieBasedAffinityEnabled} +} + +// ApplicationGatewayCustomErrorStatusCode enumerates the values for application gateway custom error status +// code. +type ApplicationGatewayCustomErrorStatusCode string + +const ( + // ApplicationGatewayCustomErrorStatusCodeHTTPStatus403 ... + ApplicationGatewayCustomErrorStatusCodeHTTPStatus403 ApplicationGatewayCustomErrorStatusCode = "HttpStatus403" + // ApplicationGatewayCustomErrorStatusCodeHTTPStatus502 ... + ApplicationGatewayCustomErrorStatusCodeHTTPStatus502 ApplicationGatewayCustomErrorStatusCode = "HttpStatus502" +) + +// PossibleApplicationGatewayCustomErrorStatusCodeValues returns an array of possible values for the ApplicationGatewayCustomErrorStatusCode const type. +func PossibleApplicationGatewayCustomErrorStatusCodeValues() []ApplicationGatewayCustomErrorStatusCode { + return []ApplicationGatewayCustomErrorStatusCode{ApplicationGatewayCustomErrorStatusCodeHTTPStatus403, ApplicationGatewayCustomErrorStatusCodeHTTPStatus502} +} + +// ApplicationGatewayFirewallMode enumerates the values for application gateway firewall mode. +type ApplicationGatewayFirewallMode string + +const ( + // ApplicationGatewayFirewallModeDetection ... + ApplicationGatewayFirewallModeDetection ApplicationGatewayFirewallMode = "Detection" + // ApplicationGatewayFirewallModePrevention ... + ApplicationGatewayFirewallModePrevention ApplicationGatewayFirewallMode = "Prevention" +) + +// PossibleApplicationGatewayFirewallModeValues returns an array of possible values for the ApplicationGatewayFirewallMode const type. +func PossibleApplicationGatewayFirewallModeValues() []ApplicationGatewayFirewallMode { + return []ApplicationGatewayFirewallMode{ApplicationGatewayFirewallModeDetection, ApplicationGatewayFirewallModePrevention} +} + +// ApplicationGatewayLoadDistributionAlgorithm enumerates the values for application gateway load distribution +// algorithm. +type ApplicationGatewayLoadDistributionAlgorithm string + +const ( + // ApplicationGatewayLoadDistributionAlgorithmIPHash ... + ApplicationGatewayLoadDistributionAlgorithmIPHash ApplicationGatewayLoadDistributionAlgorithm = "IpHash" + // ApplicationGatewayLoadDistributionAlgorithmLeastConnections ... + ApplicationGatewayLoadDistributionAlgorithmLeastConnections ApplicationGatewayLoadDistributionAlgorithm = "LeastConnections" + // ApplicationGatewayLoadDistributionAlgorithmRoundRobin ... + ApplicationGatewayLoadDistributionAlgorithmRoundRobin ApplicationGatewayLoadDistributionAlgorithm = "RoundRobin" +) + +// PossibleApplicationGatewayLoadDistributionAlgorithmValues returns an array of possible values for the ApplicationGatewayLoadDistributionAlgorithm const type. +func PossibleApplicationGatewayLoadDistributionAlgorithmValues() []ApplicationGatewayLoadDistributionAlgorithm { + return []ApplicationGatewayLoadDistributionAlgorithm{ApplicationGatewayLoadDistributionAlgorithmIPHash, ApplicationGatewayLoadDistributionAlgorithmLeastConnections, ApplicationGatewayLoadDistributionAlgorithmRoundRobin} +} + +// ApplicationGatewayOperationalState enumerates the values for application gateway operational state. +type ApplicationGatewayOperationalState string + +const ( + // ApplicationGatewayOperationalStateRunning ... + ApplicationGatewayOperationalStateRunning ApplicationGatewayOperationalState = "Running" + // ApplicationGatewayOperationalStateStarting ... + ApplicationGatewayOperationalStateStarting ApplicationGatewayOperationalState = "Starting" + // ApplicationGatewayOperationalStateStopped ... + ApplicationGatewayOperationalStateStopped ApplicationGatewayOperationalState = "Stopped" + // ApplicationGatewayOperationalStateStopping ... + ApplicationGatewayOperationalStateStopping ApplicationGatewayOperationalState = "Stopping" +) + +// PossibleApplicationGatewayOperationalStateValues returns an array of possible values for the ApplicationGatewayOperationalState const type. +func PossibleApplicationGatewayOperationalStateValues() []ApplicationGatewayOperationalState { + return []ApplicationGatewayOperationalState{ApplicationGatewayOperationalStateRunning, ApplicationGatewayOperationalStateStarting, ApplicationGatewayOperationalStateStopped, ApplicationGatewayOperationalStateStopping} +} + +// ApplicationGatewayProtocol enumerates the values for application gateway protocol. +type ApplicationGatewayProtocol string + +const ( + // ApplicationGatewayProtocolHTTP ... + ApplicationGatewayProtocolHTTP ApplicationGatewayProtocol = "Http" + // ApplicationGatewayProtocolHTTPS ... + ApplicationGatewayProtocolHTTPS ApplicationGatewayProtocol = "Https" + // ApplicationGatewayProtocolTCP ... + ApplicationGatewayProtocolTCP ApplicationGatewayProtocol = "Tcp" + // ApplicationGatewayProtocolTLS ... + ApplicationGatewayProtocolTLS ApplicationGatewayProtocol = "Tls" +) + +// PossibleApplicationGatewayProtocolValues returns an array of possible values for the ApplicationGatewayProtocol const type. +func PossibleApplicationGatewayProtocolValues() []ApplicationGatewayProtocol { + return []ApplicationGatewayProtocol{ApplicationGatewayProtocolHTTP, ApplicationGatewayProtocolHTTPS, ApplicationGatewayProtocolTCP, ApplicationGatewayProtocolTLS} +} + +// ApplicationGatewayRedirectType enumerates the values for application gateway redirect type. +type ApplicationGatewayRedirectType string + +const ( + // ApplicationGatewayRedirectTypeFound ... + ApplicationGatewayRedirectTypeFound ApplicationGatewayRedirectType = "Found" + // ApplicationGatewayRedirectTypePermanent ... + ApplicationGatewayRedirectTypePermanent ApplicationGatewayRedirectType = "Permanent" + // ApplicationGatewayRedirectTypeSeeOther ... + ApplicationGatewayRedirectTypeSeeOther ApplicationGatewayRedirectType = "SeeOther" + // ApplicationGatewayRedirectTypeTemporary ... + ApplicationGatewayRedirectTypeTemporary ApplicationGatewayRedirectType = "Temporary" +) + +// PossibleApplicationGatewayRedirectTypeValues returns an array of possible values for the ApplicationGatewayRedirectType const type. +func PossibleApplicationGatewayRedirectTypeValues() []ApplicationGatewayRedirectType { + return []ApplicationGatewayRedirectType{ApplicationGatewayRedirectTypeFound, ApplicationGatewayRedirectTypePermanent, ApplicationGatewayRedirectTypeSeeOther, ApplicationGatewayRedirectTypeTemporary} +} + +// ApplicationGatewayRequestRoutingRuleType enumerates the values for application gateway request routing rule +// type. +type ApplicationGatewayRequestRoutingRuleType string + +const ( + // ApplicationGatewayRequestRoutingRuleTypeBasic ... + ApplicationGatewayRequestRoutingRuleTypeBasic ApplicationGatewayRequestRoutingRuleType = "Basic" + // ApplicationGatewayRequestRoutingRuleTypePathBasedRouting ... + ApplicationGatewayRequestRoutingRuleTypePathBasedRouting ApplicationGatewayRequestRoutingRuleType = "PathBasedRouting" +) + +// PossibleApplicationGatewayRequestRoutingRuleTypeValues returns an array of possible values for the ApplicationGatewayRequestRoutingRuleType const type. +func PossibleApplicationGatewayRequestRoutingRuleTypeValues() []ApplicationGatewayRequestRoutingRuleType { + return []ApplicationGatewayRequestRoutingRuleType{ApplicationGatewayRequestRoutingRuleTypeBasic, ApplicationGatewayRequestRoutingRuleTypePathBasedRouting} +} + +// ApplicationGatewayRuleSetStatusOptions enumerates the values for application gateway rule set status +// options. +type ApplicationGatewayRuleSetStatusOptions string + +const ( + // ApplicationGatewayRuleSetStatusOptionsDeprecated ... + ApplicationGatewayRuleSetStatusOptionsDeprecated ApplicationGatewayRuleSetStatusOptions = "Deprecated" + // ApplicationGatewayRuleSetStatusOptionsGA ... + ApplicationGatewayRuleSetStatusOptionsGA ApplicationGatewayRuleSetStatusOptions = "GA" + // ApplicationGatewayRuleSetStatusOptionsPreview ... + ApplicationGatewayRuleSetStatusOptionsPreview ApplicationGatewayRuleSetStatusOptions = "Preview" + // ApplicationGatewayRuleSetStatusOptionsSupported ... + ApplicationGatewayRuleSetStatusOptionsSupported ApplicationGatewayRuleSetStatusOptions = "Supported" +) + +// PossibleApplicationGatewayRuleSetStatusOptionsValues returns an array of possible values for the ApplicationGatewayRuleSetStatusOptions const type. +func PossibleApplicationGatewayRuleSetStatusOptionsValues() []ApplicationGatewayRuleSetStatusOptions { + return []ApplicationGatewayRuleSetStatusOptions{ApplicationGatewayRuleSetStatusOptionsDeprecated, ApplicationGatewayRuleSetStatusOptionsGA, ApplicationGatewayRuleSetStatusOptionsPreview, ApplicationGatewayRuleSetStatusOptionsSupported} +} + +// ApplicationGatewaySkuName enumerates the values for application gateway sku name. +type ApplicationGatewaySkuName string + +const ( + // ApplicationGatewaySkuNameStandardBasic ... + ApplicationGatewaySkuNameStandardBasic ApplicationGatewaySkuName = "Standard_Basic" + // ApplicationGatewaySkuNameStandardLarge ... + ApplicationGatewaySkuNameStandardLarge ApplicationGatewaySkuName = "Standard_Large" + // ApplicationGatewaySkuNameStandardMedium ... + ApplicationGatewaySkuNameStandardMedium ApplicationGatewaySkuName = "Standard_Medium" + // ApplicationGatewaySkuNameStandardSmall ... + ApplicationGatewaySkuNameStandardSmall ApplicationGatewaySkuName = "Standard_Small" + // ApplicationGatewaySkuNameStandardV2 ... + ApplicationGatewaySkuNameStandardV2 ApplicationGatewaySkuName = "Standard_v2" + // ApplicationGatewaySkuNameWAFLarge ... + ApplicationGatewaySkuNameWAFLarge ApplicationGatewaySkuName = "WAF_Large" + // ApplicationGatewaySkuNameWAFMedium ... + ApplicationGatewaySkuNameWAFMedium ApplicationGatewaySkuName = "WAF_Medium" + // ApplicationGatewaySkuNameWAFV2 ... + ApplicationGatewaySkuNameWAFV2 ApplicationGatewaySkuName = "WAF_v2" +) + +// PossibleApplicationGatewaySkuNameValues returns an array of possible values for the ApplicationGatewaySkuName const type. +func PossibleApplicationGatewaySkuNameValues() []ApplicationGatewaySkuName { + return []ApplicationGatewaySkuName{ApplicationGatewaySkuNameStandardBasic, ApplicationGatewaySkuNameStandardLarge, ApplicationGatewaySkuNameStandardMedium, ApplicationGatewaySkuNameStandardSmall, ApplicationGatewaySkuNameStandardV2, ApplicationGatewaySkuNameWAFLarge, ApplicationGatewaySkuNameWAFMedium, ApplicationGatewaySkuNameWAFV2} +} + +// ApplicationGatewaySslCipherSuite enumerates the values for application gateway ssl cipher suite. +type ApplicationGatewaySslCipherSuite string + +const ( + // ApplicationGatewaySslCipherSuiteTLSDHEDSSWITH3DESEDECBCSHA ... + ApplicationGatewaySslCipherSuiteTLSDHEDSSWITH3DESEDECBCSHA ApplicationGatewaySslCipherSuite = "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA ApplicationGatewaySslCipherSuite = "TLS_DHE_DSS_WITH_AES_128_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA256 ... + ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256" + // ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA ApplicationGatewaySslCipherSuite = "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA256 ... + ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256" + // ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128CBCSHA ApplicationGatewaySslCipherSuite = "TLS_DHE_RSA_WITH_AES_128_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128GCMSHA256 ... + ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128GCMSHA256 ApplicationGatewaySslCipherSuite = "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" + // ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256CBCSHA ApplicationGatewaySslCipherSuite = "TLS_DHE_RSA_WITH_AES_256_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256GCMSHA384 ... + ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256GCMSHA384 ApplicationGatewaySslCipherSuite = "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384" + // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256 ... + ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" + // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256 ... + ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" + // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384 ... + ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384" + // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384 ... + ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" + // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA256 ... + ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" + // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128GCMSHA256 ... + ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128GCMSHA256 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" + // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA384 ... + ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA384 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" + // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256GCMSHA384 ... + ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256GCMSHA384 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" + // ApplicationGatewaySslCipherSuiteTLSRSAWITH3DESEDECBCSHA ... + ApplicationGatewaySslCipherSuiteTLSRSAWITH3DESEDECBCSHA ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_3DES_EDE_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_128_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA256 ... + ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_128_CBC_SHA256" + // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128GCMSHA256 ... + ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128GCMSHA256 ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_128_GCM_SHA256" + // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_256_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA256 ... + ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_256_CBC_SHA256" + // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256GCMSHA384 ... + ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256GCMSHA384 ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_256_GCM_SHA384" +) + +// PossibleApplicationGatewaySslCipherSuiteValues returns an array of possible values for the ApplicationGatewaySslCipherSuite const type. +func PossibleApplicationGatewaySslCipherSuiteValues() []ApplicationGatewaySslCipherSuite { + return []ApplicationGatewaySslCipherSuite{ApplicationGatewaySslCipherSuiteTLSDHEDSSWITH3DESEDECBCSHA, ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA, ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA256, ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA, ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA256, ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128CBCSHA, ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128GCMSHA256, ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256CBCSHA, ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256GCMSHA384, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA256, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128GCMSHA256, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA384, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256GCMSHA384, ApplicationGatewaySslCipherSuiteTLSRSAWITH3DESEDECBCSHA, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA256, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128GCMSHA256, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA256, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256GCMSHA384} +} + +// ApplicationGatewaySslPolicyName enumerates the values for application gateway ssl policy name. +type ApplicationGatewaySslPolicyName string + +const ( + // ApplicationGatewaySslPolicyNameAppGwSslPolicy20150501 ... + ApplicationGatewaySslPolicyNameAppGwSslPolicy20150501 ApplicationGatewaySslPolicyName = "AppGwSslPolicy20150501" + // ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401 ... + ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401 ApplicationGatewaySslPolicyName = "AppGwSslPolicy20170401" + // ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401S ... + ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401S ApplicationGatewaySslPolicyName = "AppGwSslPolicy20170401S" + // ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101 ... + ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101 ApplicationGatewaySslPolicyName = "AppGwSslPolicy20220101" + // ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101S ... + ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101S ApplicationGatewaySslPolicyName = "AppGwSslPolicy20220101S" +) + +// PossibleApplicationGatewaySslPolicyNameValues returns an array of possible values for the ApplicationGatewaySslPolicyName const type. +func PossibleApplicationGatewaySslPolicyNameValues() []ApplicationGatewaySslPolicyName { + return []ApplicationGatewaySslPolicyName{ApplicationGatewaySslPolicyNameAppGwSslPolicy20150501, ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401, ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401S, ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101, ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101S} +} + +// ApplicationGatewaySslPolicyType enumerates the values for application gateway ssl policy type. +type ApplicationGatewaySslPolicyType string + +const ( + // ApplicationGatewaySslPolicyTypeCustom ... + ApplicationGatewaySslPolicyTypeCustom ApplicationGatewaySslPolicyType = "Custom" + // ApplicationGatewaySslPolicyTypeCustomV2 ... + ApplicationGatewaySslPolicyTypeCustomV2 ApplicationGatewaySslPolicyType = "CustomV2" + // ApplicationGatewaySslPolicyTypePredefined ... + ApplicationGatewaySslPolicyTypePredefined ApplicationGatewaySslPolicyType = "Predefined" +) + +// PossibleApplicationGatewaySslPolicyTypeValues returns an array of possible values for the ApplicationGatewaySslPolicyType const type. +func PossibleApplicationGatewaySslPolicyTypeValues() []ApplicationGatewaySslPolicyType { + return []ApplicationGatewaySslPolicyType{ApplicationGatewaySslPolicyTypeCustom, ApplicationGatewaySslPolicyTypeCustomV2, ApplicationGatewaySslPolicyTypePredefined} +} + +// ApplicationGatewaySslProtocol enumerates the values for application gateway ssl protocol. +type ApplicationGatewaySslProtocol string + +const ( + // ApplicationGatewaySslProtocolTLSv10 ... + ApplicationGatewaySslProtocolTLSv10 ApplicationGatewaySslProtocol = "TLSv1_0" + // ApplicationGatewaySslProtocolTLSv11 ... + ApplicationGatewaySslProtocolTLSv11 ApplicationGatewaySslProtocol = "TLSv1_1" + // ApplicationGatewaySslProtocolTLSv12 ... + ApplicationGatewaySslProtocolTLSv12 ApplicationGatewaySslProtocol = "TLSv1_2" + // ApplicationGatewaySslProtocolTLSv13 ... + ApplicationGatewaySslProtocolTLSv13 ApplicationGatewaySslProtocol = "TLSv1_3" +) + +// PossibleApplicationGatewaySslProtocolValues returns an array of possible values for the ApplicationGatewaySslProtocol const type. +func PossibleApplicationGatewaySslProtocolValues() []ApplicationGatewaySslProtocol { + return []ApplicationGatewaySslProtocol{ApplicationGatewaySslProtocolTLSv10, ApplicationGatewaySslProtocolTLSv11, ApplicationGatewaySslProtocolTLSv12, ApplicationGatewaySslProtocolTLSv13} +} + +// ApplicationGatewayTier enumerates the values for application gateway tier. +type ApplicationGatewayTier string + +const ( + // ApplicationGatewayTierStandard ... + ApplicationGatewayTierStandard ApplicationGatewayTier = "Standard" + // ApplicationGatewayTierStandardBasic ... + ApplicationGatewayTierStandardBasic ApplicationGatewayTier = "Standard_Basic" + // ApplicationGatewayTierStandardV2 ... + ApplicationGatewayTierStandardV2 ApplicationGatewayTier = "Standard_v2" + // ApplicationGatewayTierWAF ... + ApplicationGatewayTierWAF ApplicationGatewayTier = "WAF" + // ApplicationGatewayTierWAFV2 ... + ApplicationGatewayTierWAFV2 ApplicationGatewayTier = "WAF_v2" +) + +// PossibleApplicationGatewayTierValues returns an array of possible values for the ApplicationGatewayTier const type. +func PossibleApplicationGatewayTierValues() []ApplicationGatewayTier { + return []ApplicationGatewayTier{ApplicationGatewayTierStandard, ApplicationGatewayTierStandardBasic, ApplicationGatewayTierStandardV2, ApplicationGatewayTierWAF, ApplicationGatewayTierWAFV2} +} + +// ApplicationGatewayTierTypes enumerates the values for application gateway tier types. +type ApplicationGatewayTierTypes string + +const ( + // ApplicationGatewayTierTypesStandard ... + ApplicationGatewayTierTypesStandard ApplicationGatewayTierTypes = "Standard" + // ApplicationGatewayTierTypesStandardV2 ... + ApplicationGatewayTierTypesStandardV2 ApplicationGatewayTierTypes = "Standard_v2" + // ApplicationGatewayTierTypesWAF ... + ApplicationGatewayTierTypesWAF ApplicationGatewayTierTypes = "WAF" + // ApplicationGatewayTierTypesWAFV2 ... + ApplicationGatewayTierTypesWAFV2 ApplicationGatewayTierTypes = "WAF_v2" +) + +// PossibleApplicationGatewayTierTypesValues returns an array of possible values for the ApplicationGatewayTierTypes const type. +func PossibleApplicationGatewayTierTypesValues() []ApplicationGatewayTierTypes { + return []ApplicationGatewayTierTypes{ApplicationGatewayTierTypesStandard, ApplicationGatewayTierTypesStandardV2, ApplicationGatewayTierTypesWAF, ApplicationGatewayTierTypesWAFV2} +} + +// ApplicationGatewayWafRuleActionTypes enumerates the values for application gateway waf rule action types. +type ApplicationGatewayWafRuleActionTypes string + +const ( + // ApplicationGatewayWafRuleActionTypesAllow ... + ApplicationGatewayWafRuleActionTypesAllow ApplicationGatewayWafRuleActionTypes = "Allow" + // ApplicationGatewayWafRuleActionTypesAnomalyScoring ... + ApplicationGatewayWafRuleActionTypesAnomalyScoring ApplicationGatewayWafRuleActionTypes = "AnomalyScoring" + // ApplicationGatewayWafRuleActionTypesBlock ... + ApplicationGatewayWafRuleActionTypesBlock ApplicationGatewayWafRuleActionTypes = "Block" + // ApplicationGatewayWafRuleActionTypesLog ... + ApplicationGatewayWafRuleActionTypesLog ApplicationGatewayWafRuleActionTypes = "Log" + // ApplicationGatewayWafRuleActionTypesNone ... + ApplicationGatewayWafRuleActionTypesNone ApplicationGatewayWafRuleActionTypes = "None" +) + +// PossibleApplicationGatewayWafRuleActionTypesValues returns an array of possible values for the ApplicationGatewayWafRuleActionTypes const type. +func PossibleApplicationGatewayWafRuleActionTypesValues() []ApplicationGatewayWafRuleActionTypes { + return []ApplicationGatewayWafRuleActionTypes{ApplicationGatewayWafRuleActionTypesAllow, ApplicationGatewayWafRuleActionTypesAnomalyScoring, ApplicationGatewayWafRuleActionTypesBlock, ApplicationGatewayWafRuleActionTypesLog, ApplicationGatewayWafRuleActionTypesNone} +} + +// ApplicationGatewayWafRuleStateTypes enumerates the values for application gateway waf rule state types. +type ApplicationGatewayWafRuleStateTypes string + +const ( + // ApplicationGatewayWafRuleStateTypesDisabled ... + ApplicationGatewayWafRuleStateTypesDisabled ApplicationGatewayWafRuleStateTypes = "Disabled" + // ApplicationGatewayWafRuleStateTypesEnabled ... + ApplicationGatewayWafRuleStateTypesEnabled ApplicationGatewayWafRuleStateTypes = "Enabled" +) + +// PossibleApplicationGatewayWafRuleStateTypesValues returns an array of possible values for the ApplicationGatewayWafRuleStateTypes const type. +func PossibleApplicationGatewayWafRuleStateTypesValues() []ApplicationGatewayWafRuleStateTypes { + return []ApplicationGatewayWafRuleStateTypes{ApplicationGatewayWafRuleStateTypesDisabled, ApplicationGatewayWafRuleStateTypesEnabled} +} + +// AssociationType enumerates the values for association type. +type AssociationType string + +const ( + // AssociationTypeAssociated ... + AssociationTypeAssociated AssociationType = "Associated" + // AssociationTypeContains ... + AssociationTypeContains AssociationType = "Contains" +) + +// PossibleAssociationTypeValues returns an array of possible values for the AssociationType const type. +func PossibleAssociationTypeValues() []AssociationType { + return []AssociationType{AssociationTypeAssociated, AssociationTypeContains} +} + +// AuthenticationMethod enumerates the values for authentication method. +type AuthenticationMethod string + +const ( + // AuthenticationMethodEAPMSCHAPv2 ... + AuthenticationMethodEAPMSCHAPv2 AuthenticationMethod = "EAPMSCHAPv2" + // AuthenticationMethodEAPTLS ... + AuthenticationMethodEAPTLS AuthenticationMethod = "EAPTLS" +) + +// PossibleAuthenticationMethodValues returns an array of possible values for the AuthenticationMethod const type. +func PossibleAuthenticationMethodValues() []AuthenticationMethod { + return []AuthenticationMethod{AuthenticationMethodEAPMSCHAPv2, AuthenticationMethodEAPTLS} +} + +// AuthorizationUseStatus enumerates the values for authorization use status. +type AuthorizationUseStatus string + +const ( + // AuthorizationUseStatusAvailable ... + AuthorizationUseStatusAvailable AuthorizationUseStatus = "Available" + // AuthorizationUseStatusInUse ... + AuthorizationUseStatusInUse AuthorizationUseStatus = "InUse" +) + +// PossibleAuthorizationUseStatusValues returns an array of possible values for the AuthorizationUseStatus const type. +func PossibleAuthorizationUseStatusValues() []AuthorizationUseStatus { + return []AuthorizationUseStatus{AuthorizationUseStatusAvailable, AuthorizationUseStatusInUse} +} + +// AutoLearnPrivateRangesMode enumerates the values for auto learn private ranges mode. +type AutoLearnPrivateRangesMode string + +const ( + // AutoLearnPrivateRangesModeDisabled ... + AutoLearnPrivateRangesModeDisabled AutoLearnPrivateRangesMode = "Disabled" + // AutoLearnPrivateRangesModeEnabled ... + AutoLearnPrivateRangesModeEnabled AutoLearnPrivateRangesMode = "Enabled" +) + +// PossibleAutoLearnPrivateRangesModeValues returns an array of possible values for the AutoLearnPrivateRangesMode const type. +func PossibleAutoLearnPrivateRangesModeValues() []AutoLearnPrivateRangesMode { + return []AutoLearnPrivateRangesMode{AutoLearnPrivateRangesModeDisabled, AutoLearnPrivateRangesModeEnabled} +} + +// AzureFirewallApplicationRuleProtocolType enumerates the values for azure firewall application rule protocol +// type. +type AzureFirewallApplicationRuleProtocolType string + +const ( + // AzureFirewallApplicationRuleProtocolTypeHTTP ... + AzureFirewallApplicationRuleProtocolTypeHTTP AzureFirewallApplicationRuleProtocolType = "Http" + // AzureFirewallApplicationRuleProtocolTypeHTTPS ... + AzureFirewallApplicationRuleProtocolTypeHTTPS AzureFirewallApplicationRuleProtocolType = "Https" + // AzureFirewallApplicationRuleProtocolTypeMssql ... + AzureFirewallApplicationRuleProtocolTypeMssql AzureFirewallApplicationRuleProtocolType = "Mssql" +) + +// PossibleAzureFirewallApplicationRuleProtocolTypeValues returns an array of possible values for the AzureFirewallApplicationRuleProtocolType const type. +func PossibleAzureFirewallApplicationRuleProtocolTypeValues() []AzureFirewallApplicationRuleProtocolType { + return []AzureFirewallApplicationRuleProtocolType{AzureFirewallApplicationRuleProtocolTypeHTTP, AzureFirewallApplicationRuleProtocolTypeHTTPS, AzureFirewallApplicationRuleProtocolTypeMssql} +} + +// AzureFirewallNatRCActionType enumerates the values for azure firewall nat rc action type. +type AzureFirewallNatRCActionType string + +const ( + // AzureFirewallNatRCActionTypeDnat ... + AzureFirewallNatRCActionTypeDnat AzureFirewallNatRCActionType = "Dnat" + // AzureFirewallNatRCActionTypeSnat ... + AzureFirewallNatRCActionTypeSnat AzureFirewallNatRCActionType = "Snat" +) + +// PossibleAzureFirewallNatRCActionTypeValues returns an array of possible values for the AzureFirewallNatRCActionType const type. +func PossibleAzureFirewallNatRCActionTypeValues() []AzureFirewallNatRCActionType { + return []AzureFirewallNatRCActionType{AzureFirewallNatRCActionTypeDnat, AzureFirewallNatRCActionTypeSnat} +} + +// AzureFirewallNetworkRuleProtocol enumerates the values for azure firewall network rule protocol. +type AzureFirewallNetworkRuleProtocol string + +const ( + // AzureFirewallNetworkRuleProtocolAny ... + AzureFirewallNetworkRuleProtocolAny AzureFirewallNetworkRuleProtocol = "Any" + // AzureFirewallNetworkRuleProtocolICMP ... + AzureFirewallNetworkRuleProtocolICMP AzureFirewallNetworkRuleProtocol = "ICMP" + // AzureFirewallNetworkRuleProtocolTCP ... + AzureFirewallNetworkRuleProtocolTCP AzureFirewallNetworkRuleProtocol = "TCP" + // AzureFirewallNetworkRuleProtocolUDP ... + AzureFirewallNetworkRuleProtocolUDP AzureFirewallNetworkRuleProtocol = "UDP" +) + +// PossibleAzureFirewallNetworkRuleProtocolValues returns an array of possible values for the AzureFirewallNetworkRuleProtocol const type. +func PossibleAzureFirewallNetworkRuleProtocolValues() []AzureFirewallNetworkRuleProtocol { + return []AzureFirewallNetworkRuleProtocol{AzureFirewallNetworkRuleProtocolAny, AzureFirewallNetworkRuleProtocolICMP, AzureFirewallNetworkRuleProtocolTCP, AzureFirewallNetworkRuleProtocolUDP} +} + +// AzureFirewallRCActionType enumerates the values for azure firewall rc action type. +type AzureFirewallRCActionType string + +const ( + // AzureFirewallRCActionTypeAllow ... + AzureFirewallRCActionTypeAllow AzureFirewallRCActionType = "Allow" + // AzureFirewallRCActionTypeDeny ... + AzureFirewallRCActionTypeDeny AzureFirewallRCActionType = "Deny" +) + +// PossibleAzureFirewallRCActionTypeValues returns an array of possible values for the AzureFirewallRCActionType const type. +func PossibleAzureFirewallRCActionTypeValues() []AzureFirewallRCActionType { + return []AzureFirewallRCActionType{AzureFirewallRCActionTypeAllow, AzureFirewallRCActionTypeDeny} +} + +// AzureFirewallSkuName enumerates the values for azure firewall sku name. +type AzureFirewallSkuName string + +const ( + // AzureFirewallSkuNameAZFWHub ... + AzureFirewallSkuNameAZFWHub AzureFirewallSkuName = "AZFW_Hub" + // AzureFirewallSkuNameAZFWVNet ... + AzureFirewallSkuNameAZFWVNet AzureFirewallSkuName = "AZFW_VNet" +) + +// PossibleAzureFirewallSkuNameValues returns an array of possible values for the AzureFirewallSkuName const type. +func PossibleAzureFirewallSkuNameValues() []AzureFirewallSkuName { + return []AzureFirewallSkuName{AzureFirewallSkuNameAZFWHub, AzureFirewallSkuNameAZFWVNet} +} + +// AzureFirewallSkuTier enumerates the values for azure firewall sku tier. +type AzureFirewallSkuTier string + +const ( + // AzureFirewallSkuTierBasic ... + AzureFirewallSkuTierBasic AzureFirewallSkuTier = "Basic" + // AzureFirewallSkuTierPremium ... + AzureFirewallSkuTierPremium AzureFirewallSkuTier = "Premium" + // AzureFirewallSkuTierStandard ... + AzureFirewallSkuTierStandard AzureFirewallSkuTier = "Standard" +) + +// PossibleAzureFirewallSkuTierValues returns an array of possible values for the AzureFirewallSkuTier const type. +func PossibleAzureFirewallSkuTierValues() []AzureFirewallSkuTier { + return []AzureFirewallSkuTier{AzureFirewallSkuTierBasic, AzureFirewallSkuTierPremium, AzureFirewallSkuTierStandard} +} + +// AzureFirewallThreatIntelMode enumerates the values for azure firewall threat intel mode. +type AzureFirewallThreatIntelMode string + +const ( + // AzureFirewallThreatIntelModeAlert ... + AzureFirewallThreatIntelModeAlert AzureFirewallThreatIntelMode = "Alert" + // AzureFirewallThreatIntelModeDeny ... + AzureFirewallThreatIntelModeDeny AzureFirewallThreatIntelMode = "Deny" + // AzureFirewallThreatIntelModeOff ... + AzureFirewallThreatIntelModeOff AzureFirewallThreatIntelMode = "Off" +) + +// PossibleAzureFirewallThreatIntelModeValues returns an array of possible values for the AzureFirewallThreatIntelMode const type. +func PossibleAzureFirewallThreatIntelModeValues() []AzureFirewallThreatIntelMode { + return []AzureFirewallThreatIntelMode{AzureFirewallThreatIntelModeAlert, AzureFirewallThreatIntelModeDeny, AzureFirewallThreatIntelModeOff} +} + +// BastionConnectProtocol enumerates the values for bastion connect protocol. +type BastionConnectProtocol string + +const ( + // BastionConnectProtocolRDP ... + BastionConnectProtocolRDP BastionConnectProtocol = "RDP" + // BastionConnectProtocolSSH ... + BastionConnectProtocolSSH BastionConnectProtocol = "SSH" +) + +// PossibleBastionConnectProtocolValues returns an array of possible values for the BastionConnectProtocol const type. +func PossibleBastionConnectProtocolValues() []BastionConnectProtocol { + return []BastionConnectProtocol{BastionConnectProtocolRDP, BastionConnectProtocolSSH} +} + +// BastionHostSkuName enumerates the values for bastion host sku name. +type BastionHostSkuName string + +const ( + // BastionHostSkuNameBasic ... + BastionHostSkuNameBasic BastionHostSkuName = "Basic" + // BastionHostSkuNameStandard ... + BastionHostSkuNameStandard BastionHostSkuName = "Standard" +) + +// PossibleBastionHostSkuNameValues returns an array of possible values for the BastionHostSkuName const type. +func PossibleBastionHostSkuNameValues() []BastionHostSkuName { + return []BastionHostSkuName{BastionHostSkuNameBasic, BastionHostSkuNameStandard} +} + +// BgpPeerState enumerates the values for bgp peer state. +type BgpPeerState string + +const ( + // BgpPeerStateConnected ... + BgpPeerStateConnected BgpPeerState = "Connected" + // BgpPeerStateConnecting ... + BgpPeerStateConnecting BgpPeerState = "Connecting" + // BgpPeerStateIdle ... + BgpPeerStateIdle BgpPeerState = "Idle" + // BgpPeerStateStopped ... + BgpPeerStateStopped BgpPeerState = "Stopped" + // BgpPeerStateUnknown ... + BgpPeerStateUnknown BgpPeerState = "Unknown" +) + +// PossibleBgpPeerStateValues returns an array of possible values for the BgpPeerState const type. +func PossibleBgpPeerStateValues() []BgpPeerState { + return []BgpPeerState{BgpPeerStateConnected, BgpPeerStateConnecting, BgpPeerStateIdle, BgpPeerStateStopped, BgpPeerStateUnknown} +} + +// CircuitConnectionStatus enumerates the values for circuit connection status. +type CircuitConnectionStatus string + +const ( + // CircuitConnectionStatusConnected ... + CircuitConnectionStatusConnected CircuitConnectionStatus = "Connected" + // CircuitConnectionStatusConnecting ... + CircuitConnectionStatusConnecting CircuitConnectionStatus = "Connecting" + // CircuitConnectionStatusDisconnected ... + CircuitConnectionStatusDisconnected CircuitConnectionStatus = "Disconnected" +) + +// PossibleCircuitConnectionStatusValues returns an array of possible values for the CircuitConnectionStatus const type. +func PossibleCircuitConnectionStatusValues() []CircuitConnectionStatus { + return []CircuitConnectionStatus{CircuitConnectionStatusConnected, CircuitConnectionStatusConnecting, CircuitConnectionStatusDisconnected} +} + +// CommissionedState enumerates the values for commissioned state. +type CommissionedState string + +const ( + // CommissionedStateCommissioned ... + CommissionedStateCommissioned CommissionedState = "Commissioned" + // CommissionedStateCommissionedNoInternetAdvertise ... + CommissionedStateCommissionedNoInternetAdvertise CommissionedState = "CommissionedNoInternetAdvertise" + // CommissionedStateCommissioning ... + CommissionedStateCommissioning CommissionedState = "Commissioning" + // CommissionedStateDecommissioning ... + CommissionedStateDecommissioning CommissionedState = "Decommissioning" + // CommissionedStateDeprovisioned ... + CommissionedStateDeprovisioned CommissionedState = "Deprovisioned" + // CommissionedStateDeprovisioning ... + CommissionedStateDeprovisioning CommissionedState = "Deprovisioning" + // CommissionedStateProvisioned ... + CommissionedStateProvisioned CommissionedState = "Provisioned" + // CommissionedStateProvisioning ... + CommissionedStateProvisioning CommissionedState = "Provisioning" +) + +// PossibleCommissionedStateValues returns an array of possible values for the CommissionedState const type. +func PossibleCommissionedStateValues() []CommissionedState { + return []CommissionedState{CommissionedStateCommissioned, CommissionedStateCommissionedNoInternetAdvertise, CommissionedStateCommissioning, CommissionedStateDecommissioning, CommissionedStateDeprovisioned, CommissionedStateDeprovisioning, CommissionedStateProvisioned, CommissionedStateProvisioning} +} + +// ConfigurationType enumerates the values for configuration type. +type ConfigurationType string + +const ( + // ConfigurationTypeConnectivity ... + ConfigurationTypeConnectivity ConfigurationType = "Connectivity" + // ConfigurationTypeSecurityAdmin ... + ConfigurationTypeSecurityAdmin ConfigurationType = "SecurityAdmin" +) + +// PossibleConfigurationTypeValues returns an array of possible values for the ConfigurationType const type. +func PossibleConfigurationTypeValues() []ConfigurationType { + return []ConfigurationType{ConfigurationTypeConnectivity, ConfigurationTypeSecurityAdmin} +} + +// ConnectionMonitorEndpointFilterItemType enumerates the values for connection monitor endpoint filter item +// type. +type ConnectionMonitorEndpointFilterItemType string + +const ( + // ConnectionMonitorEndpointFilterItemTypeAgentAddress ... + ConnectionMonitorEndpointFilterItemTypeAgentAddress ConnectionMonitorEndpointFilterItemType = "AgentAddress" +) + +// PossibleConnectionMonitorEndpointFilterItemTypeValues returns an array of possible values for the ConnectionMonitorEndpointFilterItemType const type. +func PossibleConnectionMonitorEndpointFilterItemTypeValues() []ConnectionMonitorEndpointFilterItemType { + return []ConnectionMonitorEndpointFilterItemType{ConnectionMonitorEndpointFilterItemTypeAgentAddress} +} + +// ConnectionMonitorEndpointFilterType enumerates the values for connection monitor endpoint filter type. +type ConnectionMonitorEndpointFilterType string + +const ( + // ConnectionMonitorEndpointFilterTypeInclude ... + ConnectionMonitorEndpointFilterTypeInclude ConnectionMonitorEndpointFilterType = "Include" +) + +// PossibleConnectionMonitorEndpointFilterTypeValues returns an array of possible values for the ConnectionMonitorEndpointFilterType const type. +func PossibleConnectionMonitorEndpointFilterTypeValues() []ConnectionMonitorEndpointFilterType { + return []ConnectionMonitorEndpointFilterType{ConnectionMonitorEndpointFilterTypeInclude} +} + +// ConnectionMonitorSourceStatus enumerates the values for connection monitor source status. +type ConnectionMonitorSourceStatus string + +const ( + // ConnectionMonitorSourceStatusActive ... + ConnectionMonitorSourceStatusActive ConnectionMonitorSourceStatus = "Active" + // ConnectionMonitorSourceStatusInactive ... + ConnectionMonitorSourceStatusInactive ConnectionMonitorSourceStatus = "Inactive" + // ConnectionMonitorSourceStatusUnknown ... + ConnectionMonitorSourceStatusUnknown ConnectionMonitorSourceStatus = "Unknown" +) + +// PossibleConnectionMonitorSourceStatusValues returns an array of possible values for the ConnectionMonitorSourceStatus const type. +func PossibleConnectionMonitorSourceStatusValues() []ConnectionMonitorSourceStatus { + return []ConnectionMonitorSourceStatus{ConnectionMonitorSourceStatusActive, ConnectionMonitorSourceStatusInactive, ConnectionMonitorSourceStatusUnknown} +} + +// ConnectionMonitorTestConfigurationProtocol enumerates the values for connection monitor test configuration +// protocol. +type ConnectionMonitorTestConfigurationProtocol string + +const ( + // ConnectionMonitorTestConfigurationProtocolHTTP ... + ConnectionMonitorTestConfigurationProtocolHTTP ConnectionMonitorTestConfigurationProtocol = "Http" + // ConnectionMonitorTestConfigurationProtocolIcmp ... + ConnectionMonitorTestConfigurationProtocolIcmp ConnectionMonitorTestConfigurationProtocol = "Icmp" + // ConnectionMonitorTestConfigurationProtocolTCP ... + ConnectionMonitorTestConfigurationProtocolTCP ConnectionMonitorTestConfigurationProtocol = "Tcp" +) + +// PossibleConnectionMonitorTestConfigurationProtocolValues returns an array of possible values for the ConnectionMonitorTestConfigurationProtocol const type. +func PossibleConnectionMonitorTestConfigurationProtocolValues() []ConnectionMonitorTestConfigurationProtocol { + return []ConnectionMonitorTestConfigurationProtocol{ConnectionMonitorTestConfigurationProtocolHTTP, ConnectionMonitorTestConfigurationProtocolIcmp, ConnectionMonitorTestConfigurationProtocolTCP} +} + +// ConnectionMonitorType enumerates the values for connection monitor type. +type ConnectionMonitorType string + +const ( + // ConnectionMonitorTypeMultiEndpoint ... + ConnectionMonitorTypeMultiEndpoint ConnectionMonitorType = "MultiEndpoint" + // ConnectionMonitorTypeSingleSourceDestination ... + ConnectionMonitorTypeSingleSourceDestination ConnectionMonitorType = "SingleSourceDestination" +) + +// PossibleConnectionMonitorTypeValues returns an array of possible values for the ConnectionMonitorType const type. +func PossibleConnectionMonitorTypeValues() []ConnectionMonitorType { + return []ConnectionMonitorType{ConnectionMonitorTypeMultiEndpoint, ConnectionMonitorTypeSingleSourceDestination} +} + +// ConnectionState enumerates the values for connection state. +type ConnectionState string + +const ( + // ConnectionStateReachable ... + ConnectionStateReachable ConnectionState = "Reachable" + // ConnectionStateUnknown ... + ConnectionStateUnknown ConnectionState = "Unknown" + // ConnectionStateUnreachable ... + ConnectionStateUnreachable ConnectionState = "Unreachable" +) + +// PossibleConnectionStateValues returns an array of possible values for the ConnectionState const type. +func PossibleConnectionStateValues() []ConnectionState { + return []ConnectionState{ConnectionStateReachable, ConnectionStateUnknown, ConnectionStateUnreachable} +} + +// ConnectionStatus enumerates the values for connection status. +type ConnectionStatus string + +const ( + // ConnectionStatusConnected ... + ConnectionStatusConnected ConnectionStatus = "Connected" + // ConnectionStatusDegraded ... + ConnectionStatusDegraded ConnectionStatus = "Degraded" + // ConnectionStatusDisconnected ... + ConnectionStatusDisconnected ConnectionStatus = "Disconnected" + // ConnectionStatusUnknown ... + ConnectionStatusUnknown ConnectionStatus = "Unknown" +) + +// PossibleConnectionStatusValues returns an array of possible values for the ConnectionStatus const type. +func PossibleConnectionStatusValues() []ConnectionStatus { + return []ConnectionStatus{ConnectionStatusConnected, ConnectionStatusDegraded, ConnectionStatusDisconnected, ConnectionStatusUnknown} +} + +// ConnectivityTopology enumerates the values for connectivity topology. +type ConnectivityTopology string + +const ( + // ConnectivityTopologyHubAndSpoke ... + ConnectivityTopologyHubAndSpoke ConnectivityTopology = "HubAndSpoke" + // ConnectivityTopologyMesh ... + ConnectivityTopologyMesh ConnectivityTopology = "Mesh" +) + +// PossibleConnectivityTopologyValues returns an array of possible values for the ConnectivityTopology const type. +func PossibleConnectivityTopologyValues() []ConnectivityTopology { + return []ConnectivityTopology{ConnectivityTopologyHubAndSpoke, ConnectivityTopologyMesh} +} + +// CoverageLevel enumerates the values for coverage level. +type CoverageLevel string + +const ( + // CoverageLevelAboveAverage ... + CoverageLevelAboveAverage CoverageLevel = "AboveAverage" + // CoverageLevelAverage ... + CoverageLevelAverage CoverageLevel = "Average" + // CoverageLevelBelowAverage ... + CoverageLevelBelowAverage CoverageLevel = "BelowAverage" + // CoverageLevelDefault ... + CoverageLevelDefault CoverageLevel = "Default" + // CoverageLevelFull ... + CoverageLevelFull CoverageLevel = "Full" + // CoverageLevelLow ... + CoverageLevelLow CoverageLevel = "Low" +) + +// PossibleCoverageLevelValues returns an array of possible values for the CoverageLevel const type. +func PossibleCoverageLevelValues() []CoverageLevel { + return []CoverageLevel{CoverageLevelAboveAverage, CoverageLevelAverage, CoverageLevelBelowAverage, CoverageLevelDefault, CoverageLevelFull, CoverageLevelLow} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// CustomIPPrefixType enumerates the values for custom ip prefix type. +type CustomIPPrefixType string + +const ( + // CustomIPPrefixTypeChild ... + CustomIPPrefixTypeChild CustomIPPrefixType = "Child" + // CustomIPPrefixTypeParent ... + CustomIPPrefixTypeParent CustomIPPrefixType = "Parent" + // CustomIPPrefixTypeSingular ... + CustomIPPrefixTypeSingular CustomIPPrefixType = "Singular" +) + +// PossibleCustomIPPrefixTypeValues returns an array of possible values for the CustomIPPrefixType const type. +func PossibleCustomIPPrefixTypeValues() []CustomIPPrefixType { + return []CustomIPPrefixType{CustomIPPrefixTypeChild, CustomIPPrefixTypeParent, CustomIPPrefixTypeSingular} +} + +// DdosSettingsProtectionMode enumerates the values for ddos settings protection mode. +type DdosSettingsProtectionMode string + +const ( + // DdosSettingsProtectionModeDisabled ... + DdosSettingsProtectionModeDisabled DdosSettingsProtectionMode = "Disabled" + // DdosSettingsProtectionModeEnabled ... + DdosSettingsProtectionModeEnabled DdosSettingsProtectionMode = "Enabled" + // DdosSettingsProtectionModeVirtualNetworkInherited ... + DdosSettingsProtectionModeVirtualNetworkInherited DdosSettingsProtectionMode = "VirtualNetworkInherited" +) + +// PossibleDdosSettingsProtectionModeValues returns an array of possible values for the DdosSettingsProtectionMode const type. +func PossibleDdosSettingsProtectionModeValues() []DdosSettingsProtectionMode { + return []DdosSettingsProtectionMode{DdosSettingsProtectionModeDisabled, DdosSettingsProtectionModeEnabled, DdosSettingsProtectionModeVirtualNetworkInherited} +} + +// DeleteExistingPeering enumerates the values for delete existing peering. +type DeleteExistingPeering string + +const ( + // DeleteExistingPeeringFalse ... + DeleteExistingPeeringFalse DeleteExistingPeering = "False" + // DeleteExistingPeeringTrue ... + DeleteExistingPeeringTrue DeleteExistingPeering = "True" +) + +// PossibleDeleteExistingPeeringValues returns an array of possible values for the DeleteExistingPeering const type. +func PossibleDeleteExistingPeeringValues() []DeleteExistingPeering { + return []DeleteExistingPeering{DeleteExistingPeeringFalse, DeleteExistingPeeringTrue} +} + +// DeleteOptions enumerates the values for delete options. +type DeleteOptions string + +const ( + // DeleteOptionsDelete ... + DeleteOptionsDelete DeleteOptions = "Delete" + // DeleteOptionsDetach ... + DeleteOptionsDetach DeleteOptions = "Detach" +) + +// PossibleDeleteOptionsValues returns an array of possible values for the DeleteOptions const type. +func PossibleDeleteOptionsValues() []DeleteOptions { + return []DeleteOptions{DeleteOptionsDelete, DeleteOptionsDetach} +} + +// DeploymentStatus enumerates the values for deployment status. +type DeploymentStatus string + +const ( + // DeploymentStatusDeployed ... + DeploymentStatusDeployed DeploymentStatus = "Deployed" + // DeploymentStatusDeploying ... + DeploymentStatusDeploying DeploymentStatus = "Deploying" + // DeploymentStatusFailed ... + DeploymentStatusFailed DeploymentStatus = "Failed" + // DeploymentStatusNotStarted ... + DeploymentStatusNotStarted DeploymentStatus = "NotStarted" +) + +// PossibleDeploymentStatusValues returns an array of possible values for the DeploymentStatus const type. +func PossibleDeploymentStatusValues() []DeploymentStatus { + return []DeploymentStatus{DeploymentStatusDeployed, DeploymentStatusDeploying, DeploymentStatusFailed, DeploymentStatusNotStarted} +} + +// DestinationPortBehavior enumerates the values for destination port behavior. +type DestinationPortBehavior string + +const ( + // DestinationPortBehaviorListenIfAvailable ... + DestinationPortBehaviorListenIfAvailable DestinationPortBehavior = "ListenIfAvailable" + // DestinationPortBehaviorNone ... + DestinationPortBehaviorNone DestinationPortBehavior = "None" +) + +// PossibleDestinationPortBehaviorValues returns an array of possible values for the DestinationPortBehavior const type. +func PossibleDestinationPortBehaviorValues() []DestinationPortBehavior { + return []DestinationPortBehavior{DestinationPortBehaviorListenIfAvailable, DestinationPortBehaviorNone} +} + +// DhGroup enumerates the values for dh group. +type DhGroup string + +const ( + // DhGroupDHGroup1 ... + DhGroupDHGroup1 DhGroup = "DHGroup1" + // DhGroupDHGroup14 ... + DhGroupDHGroup14 DhGroup = "DHGroup14" + // DhGroupDHGroup2 ... + DhGroupDHGroup2 DhGroup = "DHGroup2" + // DhGroupDHGroup2048 ... + DhGroupDHGroup2048 DhGroup = "DHGroup2048" + // DhGroupDHGroup24 ... + DhGroupDHGroup24 DhGroup = "DHGroup24" + // DhGroupECP256 ... + DhGroupECP256 DhGroup = "ECP256" + // DhGroupECP384 ... + DhGroupECP384 DhGroup = "ECP384" + // DhGroupNone ... + DhGroupNone DhGroup = "None" +) + +// PossibleDhGroupValues returns an array of possible values for the DhGroup const type. +func PossibleDhGroupValues() []DhGroup { + return []DhGroup{DhGroupDHGroup1, DhGroupDHGroup14, DhGroupDHGroup2, DhGroupDHGroup2048, DhGroupDHGroup24, DhGroupECP256, DhGroupECP384, DhGroupNone} +} + +// Direction enumerates the values for direction. +type Direction string + +const ( + // DirectionInbound ... + DirectionInbound Direction = "Inbound" + // DirectionOutbound ... + DirectionOutbound Direction = "Outbound" +) + +// PossibleDirectionValues returns an array of possible values for the Direction const type. +func PossibleDirectionValues() []Direction { + return []Direction{DirectionInbound, DirectionOutbound} +} + +// EffectiveRouteSource enumerates the values for effective route source. +type EffectiveRouteSource string + +const ( + // EffectiveRouteSourceDefault ... + EffectiveRouteSourceDefault EffectiveRouteSource = "Default" + // EffectiveRouteSourceUnknown ... + EffectiveRouteSourceUnknown EffectiveRouteSource = "Unknown" + // EffectiveRouteSourceUser ... + EffectiveRouteSourceUser EffectiveRouteSource = "User" + // EffectiveRouteSourceVirtualNetworkGateway ... + EffectiveRouteSourceVirtualNetworkGateway EffectiveRouteSource = "VirtualNetworkGateway" +) + +// PossibleEffectiveRouteSourceValues returns an array of possible values for the EffectiveRouteSource const type. +func PossibleEffectiveRouteSourceValues() []EffectiveRouteSource { + return []EffectiveRouteSource{EffectiveRouteSourceDefault, EffectiveRouteSourceUnknown, EffectiveRouteSourceUser, EffectiveRouteSourceVirtualNetworkGateway} +} + +// EffectiveRouteState enumerates the values for effective route state. +type EffectiveRouteState string + +const ( + // EffectiveRouteStateActive ... + EffectiveRouteStateActive EffectiveRouteState = "Active" + // EffectiveRouteStateInvalid ... + EffectiveRouteStateInvalid EffectiveRouteState = "Invalid" +) + +// PossibleEffectiveRouteStateValues returns an array of possible values for the EffectiveRouteState const type. +func PossibleEffectiveRouteStateValues() []EffectiveRouteState { + return []EffectiveRouteState{EffectiveRouteStateActive, EffectiveRouteStateInvalid} +} + +// EffectiveSecurityRuleProtocol enumerates the values for effective security rule protocol. +type EffectiveSecurityRuleProtocol string + +const ( + // EffectiveSecurityRuleProtocolAll ... + EffectiveSecurityRuleProtocolAll EffectiveSecurityRuleProtocol = "All" + // EffectiveSecurityRuleProtocolTCP ... + EffectiveSecurityRuleProtocolTCP EffectiveSecurityRuleProtocol = "Tcp" + // EffectiveSecurityRuleProtocolUDP ... + EffectiveSecurityRuleProtocolUDP EffectiveSecurityRuleProtocol = "Udp" +) + +// PossibleEffectiveSecurityRuleProtocolValues returns an array of possible values for the EffectiveSecurityRuleProtocol const type. +func PossibleEffectiveSecurityRuleProtocolValues() []EffectiveSecurityRuleProtocol { + return []EffectiveSecurityRuleProtocol{EffectiveSecurityRuleProtocolAll, EffectiveSecurityRuleProtocolTCP, EffectiveSecurityRuleProtocolUDP} +} + +// EndpointType enumerates the values for endpoint type. +type EndpointType string + +const ( + // EndpointTypeAzureArcVM ... + EndpointTypeAzureArcVM EndpointType = "AzureArcVM" + // EndpointTypeAzureSubnet ... + EndpointTypeAzureSubnet EndpointType = "AzureSubnet" + // EndpointTypeAzureVM ... + EndpointTypeAzureVM EndpointType = "AzureVM" + // EndpointTypeAzureVMSS ... + EndpointTypeAzureVMSS EndpointType = "AzureVMSS" + // EndpointTypeAzureVNet ... + EndpointTypeAzureVNet EndpointType = "AzureVNet" + // EndpointTypeExternalAddress ... + EndpointTypeExternalAddress EndpointType = "ExternalAddress" + // EndpointTypeMMAWorkspaceMachine ... + EndpointTypeMMAWorkspaceMachine EndpointType = "MMAWorkspaceMachine" + // EndpointTypeMMAWorkspaceNetwork ... + EndpointTypeMMAWorkspaceNetwork EndpointType = "MMAWorkspaceNetwork" +) + +// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. +func PossibleEndpointTypeValues() []EndpointType { + return []EndpointType{EndpointTypeAzureArcVM, EndpointTypeAzureSubnet, EndpointTypeAzureVM, EndpointTypeAzureVMSS, EndpointTypeAzureVNet, EndpointTypeExternalAddress, EndpointTypeMMAWorkspaceMachine, EndpointTypeMMAWorkspaceNetwork} +} + +// EvaluationState enumerates the values for evaluation state. +type EvaluationState string + +const ( + // EvaluationStateCompleted ... + EvaluationStateCompleted EvaluationState = "Completed" + // EvaluationStateInProgress ... + EvaluationStateInProgress EvaluationState = "InProgress" + // EvaluationStateNotStarted ... + EvaluationStateNotStarted EvaluationState = "NotStarted" +) + +// PossibleEvaluationStateValues returns an array of possible values for the EvaluationState const type. +func PossibleEvaluationStateValues() []EvaluationState { + return []EvaluationState{EvaluationStateCompleted, EvaluationStateInProgress, EvaluationStateNotStarted} +} + +// ExpressRouteCircuitPeeringAdvertisedPublicPrefixState enumerates the values for express route circuit +// peering advertised public prefix state. +type ExpressRouteCircuitPeeringAdvertisedPublicPrefixState string + +const ( + // ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfigured ... + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfigured ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "Configured" + // ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfiguring ... + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfiguring ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "Configuring" + // ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateNotConfigured ... + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateNotConfigured ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "NotConfigured" + // ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded ... + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "ValidationNeeded" +) + +// PossibleExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValues returns an array of possible values for the ExpressRouteCircuitPeeringAdvertisedPublicPrefixState const type. +func PossibleExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValues() []ExpressRouteCircuitPeeringAdvertisedPublicPrefixState { + return []ExpressRouteCircuitPeeringAdvertisedPublicPrefixState{ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfigured, ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfiguring, ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateNotConfigured, ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded} +} + +// ExpressRouteCircuitPeeringState enumerates the values for express route circuit peering state. +type ExpressRouteCircuitPeeringState string + +const ( + // ExpressRouteCircuitPeeringStateDisabled ... + ExpressRouteCircuitPeeringStateDisabled ExpressRouteCircuitPeeringState = "Disabled" + // ExpressRouteCircuitPeeringStateEnabled ... + ExpressRouteCircuitPeeringStateEnabled ExpressRouteCircuitPeeringState = "Enabled" +) + +// PossibleExpressRouteCircuitPeeringStateValues returns an array of possible values for the ExpressRouteCircuitPeeringState const type. +func PossibleExpressRouteCircuitPeeringStateValues() []ExpressRouteCircuitPeeringState { + return []ExpressRouteCircuitPeeringState{ExpressRouteCircuitPeeringStateDisabled, ExpressRouteCircuitPeeringStateEnabled} +} + +// ExpressRouteCircuitSkuFamily enumerates the values for express route circuit sku family. +type ExpressRouteCircuitSkuFamily string + +const ( + // ExpressRouteCircuitSkuFamilyMeteredData ... + ExpressRouteCircuitSkuFamilyMeteredData ExpressRouteCircuitSkuFamily = "MeteredData" + // ExpressRouteCircuitSkuFamilyUnlimitedData ... + ExpressRouteCircuitSkuFamilyUnlimitedData ExpressRouteCircuitSkuFamily = "UnlimitedData" +) + +// PossibleExpressRouteCircuitSkuFamilyValues returns an array of possible values for the ExpressRouteCircuitSkuFamily const type. +func PossibleExpressRouteCircuitSkuFamilyValues() []ExpressRouteCircuitSkuFamily { + return []ExpressRouteCircuitSkuFamily{ExpressRouteCircuitSkuFamilyMeteredData, ExpressRouteCircuitSkuFamilyUnlimitedData} +} + +// ExpressRouteCircuitSkuTier enumerates the values for express route circuit sku tier. +type ExpressRouteCircuitSkuTier string + +const ( + // ExpressRouteCircuitSkuTierBasic ... + ExpressRouteCircuitSkuTierBasic ExpressRouteCircuitSkuTier = "Basic" + // ExpressRouteCircuitSkuTierLocal ... + ExpressRouteCircuitSkuTierLocal ExpressRouteCircuitSkuTier = "Local" + // ExpressRouteCircuitSkuTierPremium ... + ExpressRouteCircuitSkuTierPremium ExpressRouteCircuitSkuTier = "Premium" + // ExpressRouteCircuitSkuTierStandard ... + ExpressRouteCircuitSkuTierStandard ExpressRouteCircuitSkuTier = "Standard" +) + +// PossibleExpressRouteCircuitSkuTierValues returns an array of possible values for the ExpressRouteCircuitSkuTier const type. +func PossibleExpressRouteCircuitSkuTierValues() []ExpressRouteCircuitSkuTier { + return []ExpressRouteCircuitSkuTier{ExpressRouteCircuitSkuTierBasic, ExpressRouteCircuitSkuTierLocal, ExpressRouteCircuitSkuTierPremium, ExpressRouteCircuitSkuTierStandard} +} + +// ExpressRouteLinkAdminState enumerates the values for express route link admin state. +type ExpressRouteLinkAdminState string + +const ( + // ExpressRouteLinkAdminStateDisabled ... + ExpressRouteLinkAdminStateDisabled ExpressRouteLinkAdminState = "Disabled" + // ExpressRouteLinkAdminStateEnabled ... + ExpressRouteLinkAdminStateEnabled ExpressRouteLinkAdminState = "Enabled" +) + +// PossibleExpressRouteLinkAdminStateValues returns an array of possible values for the ExpressRouteLinkAdminState const type. +func PossibleExpressRouteLinkAdminStateValues() []ExpressRouteLinkAdminState { + return []ExpressRouteLinkAdminState{ExpressRouteLinkAdminStateDisabled, ExpressRouteLinkAdminStateEnabled} +} + +// ExpressRouteLinkConnectorType enumerates the values for express route link connector type. +type ExpressRouteLinkConnectorType string + +const ( + // ExpressRouteLinkConnectorTypeLC ... + ExpressRouteLinkConnectorTypeLC ExpressRouteLinkConnectorType = "LC" + // ExpressRouteLinkConnectorTypeSC ... + ExpressRouteLinkConnectorTypeSC ExpressRouteLinkConnectorType = "SC" +) + +// PossibleExpressRouteLinkConnectorTypeValues returns an array of possible values for the ExpressRouteLinkConnectorType const type. +func PossibleExpressRouteLinkConnectorTypeValues() []ExpressRouteLinkConnectorType { + return []ExpressRouteLinkConnectorType{ExpressRouteLinkConnectorTypeLC, ExpressRouteLinkConnectorTypeSC} +} + +// ExpressRouteLinkMacSecCipher enumerates the values for express route link mac sec cipher. +type ExpressRouteLinkMacSecCipher string + +const ( + // ExpressRouteLinkMacSecCipherGcmAes128 ... + ExpressRouteLinkMacSecCipherGcmAes128 ExpressRouteLinkMacSecCipher = "GcmAes128" + // ExpressRouteLinkMacSecCipherGcmAes256 ... + ExpressRouteLinkMacSecCipherGcmAes256 ExpressRouteLinkMacSecCipher = "GcmAes256" + // ExpressRouteLinkMacSecCipherGcmAesXpn128 ... + ExpressRouteLinkMacSecCipherGcmAesXpn128 ExpressRouteLinkMacSecCipher = "GcmAesXpn128" + // ExpressRouteLinkMacSecCipherGcmAesXpn256 ... + ExpressRouteLinkMacSecCipherGcmAesXpn256 ExpressRouteLinkMacSecCipher = "GcmAesXpn256" +) + +// PossibleExpressRouteLinkMacSecCipherValues returns an array of possible values for the ExpressRouteLinkMacSecCipher const type. +func PossibleExpressRouteLinkMacSecCipherValues() []ExpressRouteLinkMacSecCipher { + return []ExpressRouteLinkMacSecCipher{ExpressRouteLinkMacSecCipherGcmAes128, ExpressRouteLinkMacSecCipherGcmAes256, ExpressRouteLinkMacSecCipherGcmAesXpn128, ExpressRouteLinkMacSecCipherGcmAesXpn256} +} + +// ExpressRouteLinkMacSecSciState enumerates the values for express route link mac sec sci state. +type ExpressRouteLinkMacSecSciState string + +const ( + // ExpressRouteLinkMacSecSciStateDisabled ... + ExpressRouteLinkMacSecSciStateDisabled ExpressRouteLinkMacSecSciState = "Disabled" + // ExpressRouteLinkMacSecSciStateEnabled ... + ExpressRouteLinkMacSecSciStateEnabled ExpressRouteLinkMacSecSciState = "Enabled" +) + +// PossibleExpressRouteLinkMacSecSciStateValues returns an array of possible values for the ExpressRouteLinkMacSecSciState const type. +func PossibleExpressRouteLinkMacSecSciStateValues() []ExpressRouteLinkMacSecSciState { + return []ExpressRouteLinkMacSecSciState{ExpressRouteLinkMacSecSciStateDisabled, ExpressRouteLinkMacSecSciStateEnabled} +} + +// ExpressRoutePeeringState enumerates the values for express route peering state. +type ExpressRoutePeeringState string + +const ( + // ExpressRoutePeeringStateDisabled ... + ExpressRoutePeeringStateDisabled ExpressRoutePeeringState = "Disabled" + // ExpressRoutePeeringStateEnabled ... + ExpressRoutePeeringStateEnabled ExpressRoutePeeringState = "Enabled" +) + +// PossibleExpressRoutePeeringStateValues returns an array of possible values for the ExpressRoutePeeringState const type. +func PossibleExpressRoutePeeringStateValues() []ExpressRoutePeeringState { + return []ExpressRoutePeeringState{ExpressRoutePeeringStateDisabled, ExpressRoutePeeringStateEnabled} +} + +// ExpressRoutePeeringType enumerates the values for express route peering type. +type ExpressRoutePeeringType string + +const ( + // ExpressRoutePeeringTypeAzurePrivatePeering ... + ExpressRoutePeeringTypeAzurePrivatePeering ExpressRoutePeeringType = "AzurePrivatePeering" + // ExpressRoutePeeringTypeAzurePublicPeering ... + ExpressRoutePeeringTypeAzurePublicPeering ExpressRoutePeeringType = "AzurePublicPeering" + // ExpressRoutePeeringTypeMicrosoftPeering ... + ExpressRoutePeeringTypeMicrosoftPeering ExpressRoutePeeringType = "MicrosoftPeering" +) + +// PossibleExpressRoutePeeringTypeValues returns an array of possible values for the ExpressRoutePeeringType const type. +func PossibleExpressRoutePeeringTypeValues() []ExpressRoutePeeringType { + return []ExpressRoutePeeringType{ExpressRoutePeeringTypeAzurePrivatePeering, ExpressRoutePeeringTypeAzurePublicPeering, ExpressRoutePeeringTypeMicrosoftPeering} +} + +// ExpressRoutePortAuthorizationUseStatus enumerates the values for express route port authorization use +// status. +type ExpressRoutePortAuthorizationUseStatus string + +const ( + // ExpressRoutePortAuthorizationUseStatusAvailable ... + ExpressRoutePortAuthorizationUseStatusAvailable ExpressRoutePortAuthorizationUseStatus = "Available" + // ExpressRoutePortAuthorizationUseStatusInUse ... + ExpressRoutePortAuthorizationUseStatusInUse ExpressRoutePortAuthorizationUseStatus = "InUse" +) + +// PossibleExpressRoutePortAuthorizationUseStatusValues returns an array of possible values for the ExpressRoutePortAuthorizationUseStatus const type. +func PossibleExpressRoutePortAuthorizationUseStatusValues() []ExpressRoutePortAuthorizationUseStatus { + return []ExpressRoutePortAuthorizationUseStatus{ExpressRoutePortAuthorizationUseStatusAvailable, ExpressRoutePortAuthorizationUseStatusInUse} +} + +// ExpressRoutePortsBillingType enumerates the values for express route ports billing type. +type ExpressRoutePortsBillingType string + +const ( + // ExpressRoutePortsBillingTypeMeteredData ... + ExpressRoutePortsBillingTypeMeteredData ExpressRoutePortsBillingType = "MeteredData" + // ExpressRoutePortsBillingTypeUnlimitedData ... + ExpressRoutePortsBillingTypeUnlimitedData ExpressRoutePortsBillingType = "UnlimitedData" +) + +// PossibleExpressRoutePortsBillingTypeValues returns an array of possible values for the ExpressRoutePortsBillingType const type. +func PossibleExpressRoutePortsBillingTypeValues() []ExpressRoutePortsBillingType { + return []ExpressRoutePortsBillingType{ExpressRoutePortsBillingTypeMeteredData, ExpressRoutePortsBillingTypeUnlimitedData} +} + +// ExpressRoutePortsEncapsulation enumerates the values for express route ports encapsulation. +type ExpressRoutePortsEncapsulation string + +const ( + // ExpressRoutePortsEncapsulationDot1Q ... + ExpressRoutePortsEncapsulationDot1Q ExpressRoutePortsEncapsulation = "Dot1Q" + // ExpressRoutePortsEncapsulationQinQ ... + ExpressRoutePortsEncapsulationQinQ ExpressRoutePortsEncapsulation = "QinQ" +) + +// PossibleExpressRoutePortsEncapsulationValues returns an array of possible values for the ExpressRoutePortsEncapsulation const type. +func PossibleExpressRoutePortsEncapsulationValues() []ExpressRoutePortsEncapsulation { + return []ExpressRoutePortsEncapsulation{ExpressRoutePortsEncapsulationDot1Q, ExpressRoutePortsEncapsulationQinQ} +} + +// ExtendedLocationTypes enumerates the values for extended location types. +type ExtendedLocationTypes string + +const ( + // ExtendedLocationTypesEdgeZone ... + ExtendedLocationTypesEdgeZone ExtendedLocationTypes = "EdgeZone" +) + +// PossibleExtendedLocationTypesValues returns an array of possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{ExtendedLocationTypesEdgeZone} +} + +// FirewallPolicyFilterRuleCollectionActionType enumerates the values for firewall policy filter rule +// collection action type. +type FirewallPolicyFilterRuleCollectionActionType string + +const ( + // FirewallPolicyFilterRuleCollectionActionTypeAllow ... + FirewallPolicyFilterRuleCollectionActionTypeAllow FirewallPolicyFilterRuleCollectionActionType = "Allow" + // FirewallPolicyFilterRuleCollectionActionTypeDeny ... + FirewallPolicyFilterRuleCollectionActionTypeDeny FirewallPolicyFilterRuleCollectionActionType = "Deny" +) + +// PossibleFirewallPolicyFilterRuleCollectionActionTypeValues returns an array of possible values for the FirewallPolicyFilterRuleCollectionActionType const type. +func PossibleFirewallPolicyFilterRuleCollectionActionTypeValues() []FirewallPolicyFilterRuleCollectionActionType { + return []FirewallPolicyFilterRuleCollectionActionType{FirewallPolicyFilterRuleCollectionActionTypeAllow, FirewallPolicyFilterRuleCollectionActionTypeDeny} +} + +// FirewallPolicyIDPSQuerySortOrder enumerates the values for firewall policy idps query sort order. +type FirewallPolicyIDPSQuerySortOrder string + +const ( + // FirewallPolicyIDPSQuerySortOrderAscending ... + FirewallPolicyIDPSQuerySortOrderAscending FirewallPolicyIDPSQuerySortOrder = "Ascending" + // FirewallPolicyIDPSQuerySortOrderDescending ... + FirewallPolicyIDPSQuerySortOrderDescending FirewallPolicyIDPSQuerySortOrder = "Descending" +) + +// PossibleFirewallPolicyIDPSQuerySortOrderValues returns an array of possible values for the FirewallPolicyIDPSQuerySortOrder const type. +func PossibleFirewallPolicyIDPSQuerySortOrderValues() []FirewallPolicyIDPSQuerySortOrder { + return []FirewallPolicyIDPSQuerySortOrder{FirewallPolicyIDPSQuerySortOrderAscending, FirewallPolicyIDPSQuerySortOrderDescending} +} + +// FirewallPolicyIntrusionDetectionProtocol enumerates the values for firewall policy intrusion detection +// protocol. +type FirewallPolicyIntrusionDetectionProtocol string + +const ( + // FirewallPolicyIntrusionDetectionProtocolANY ... + FirewallPolicyIntrusionDetectionProtocolANY FirewallPolicyIntrusionDetectionProtocol = "ANY" + // FirewallPolicyIntrusionDetectionProtocolICMP ... + FirewallPolicyIntrusionDetectionProtocolICMP FirewallPolicyIntrusionDetectionProtocol = "ICMP" + // FirewallPolicyIntrusionDetectionProtocolTCP ... + FirewallPolicyIntrusionDetectionProtocolTCP FirewallPolicyIntrusionDetectionProtocol = "TCP" + // FirewallPolicyIntrusionDetectionProtocolUDP ... + FirewallPolicyIntrusionDetectionProtocolUDP FirewallPolicyIntrusionDetectionProtocol = "UDP" +) + +// PossibleFirewallPolicyIntrusionDetectionProtocolValues returns an array of possible values for the FirewallPolicyIntrusionDetectionProtocol const type. +func PossibleFirewallPolicyIntrusionDetectionProtocolValues() []FirewallPolicyIntrusionDetectionProtocol { + return []FirewallPolicyIntrusionDetectionProtocol{FirewallPolicyIntrusionDetectionProtocolANY, FirewallPolicyIntrusionDetectionProtocolICMP, FirewallPolicyIntrusionDetectionProtocolTCP, FirewallPolicyIntrusionDetectionProtocolUDP} +} + +// FirewallPolicyIntrusionDetectionStateType enumerates the values for firewall policy intrusion detection +// state type. +type FirewallPolicyIntrusionDetectionStateType string + +const ( + // FirewallPolicyIntrusionDetectionStateTypeAlert ... + FirewallPolicyIntrusionDetectionStateTypeAlert FirewallPolicyIntrusionDetectionStateType = "Alert" + // FirewallPolicyIntrusionDetectionStateTypeDeny ... + FirewallPolicyIntrusionDetectionStateTypeDeny FirewallPolicyIntrusionDetectionStateType = "Deny" + // FirewallPolicyIntrusionDetectionStateTypeOff ... + FirewallPolicyIntrusionDetectionStateTypeOff FirewallPolicyIntrusionDetectionStateType = "Off" +) + +// PossibleFirewallPolicyIntrusionDetectionStateTypeValues returns an array of possible values for the FirewallPolicyIntrusionDetectionStateType const type. +func PossibleFirewallPolicyIntrusionDetectionStateTypeValues() []FirewallPolicyIntrusionDetectionStateType { + return []FirewallPolicyIntrusionDetectionStateType{FirewallPolicyIntrusionDetectionStateTypeAlert, FirewallPolicyIntrusionDetectionStateTypeDeny, FirewallPolicyIntrusionDetectionStateTypeOff} +} + +// FirewallPolicyNatRuleCollectionActionType enumerates the values for firewall policy nat rule collection +// action type. +type FirewallPolicyNatRuleCollectionActionType string + +const ( + // FirewallPolicyNatRuleCollectionActionTypeDNAT ... + FirewallPolicyNatRuleCollectionActionTypeDNAT FirewallPolicyNatRuleCollectionActionType = "DNAT" +) + +// PossibleFirewallPolicyNatRuleCollectionActionTypeValues returns an array of possible values for the FirewallPolicyNatRuleCollectionActionType const type. +func PossibleFirewallPolicyNatRuleCollectionActionTypeValues() []FirewallPolicyNatRuleCollectionActionType { + return []FirewallPolicyNatRuleCollectionActionType{FirewallPolicyNatRuleCollectionActionTypeDNAT} +} + +// FirewallPolicyRuleApplicationProtocolType enumerates the values for firewall policy rule application +// protocol type. +type FirewallPolicyRuleApplicationProtocolType string + +const ( + // FirewallPolicyRuleApplicationProtocolTypeHTTP ... + FirewallPolicyRuleApplicationProtocolTypeHTTP FirewallPolicyRuleApplicationProtocolType = "Http" + // FirewallPolicyRuleApplicationProtocolTypeHTTPS ... + FirewallPolicyRuleApplicationProtocolTypeHTTPS FirewallPolicyRuleApplicationProtocolType = "Https" +) + +// PossibleFirewallPolicyRuleApplicationProtocolTypeValues returns an array of possible values for the FirewallPolicyRuleApplicationProtocolType const type. +func PossibleFirewallPolicyRuleApplicationProtocolTypeValues() []FirewallPolicyRuleApplicationProtocolType { + return []FirewallPolicyRuleApplicationProtocolType{FirewallPolicyRuleApplicationProtocolTypeHTTP, FirewallPolicyRuleApplicationProtocolTypeHTTPS} +} + +// FirewallPolicyRuleNetworkProtocol enumerates the values for firewall policy rule network protocol. +type FirewallPolicyRuleNetworkProtocol string + +const ( + // FirewallPolicyRuleNetworkProtocolAny ... + FirewallPolicyRuleNetworkProtocolAny FirewallPolicyRuleNetworkProtocol = "Any" + // FirewallPolicyRuleNetworkProtocolICMP ... + FirewallPolicyRuleNetworkProtocolICMP FirewallPolicyRuleNetworkProtocol = "ICMP" + // FirewallPolicyRuleNetworkProtocolTCP ... + FirewallPolicyRuleNetworkProtocolTCP FirewallPolicyRuleNetworkProtocol = "TCP" + // FirewallPolicyRuleNetworkProtocolUDP ... + FirewallPolicyRuleNetworkProtocolUDP FirewallPolicyRuleNetworkProtocol = "UDP" +) + +// PossibleFirewallPolicyRuleNetworkProtocolValues returns an array of possible values for the FirewallPolicyRuleNetworkProtocol const type. +func PossibleFirewallPolicyRuleNetworkProtocolValues() []FirewallPolicyRuleNetworkProtocol { + return []FirewallPolicyRuleNetworkProtocol{FirewallPolicyRuleNetworkProtocolAny, FirewallPolicyRuleNetworkProtocolICMP, FirewallPolicyRuleNetworkProtocolTCP, FirewallPolicyRuleNetworkProtocolUDP} +} + +// FirewallPolicySkuTier enumerates the values for firewall policy sku tier. +type FirewallPolicySkuTier string + +const ( + // FirewallPolicySkuTierBasic ... + FirewallPolicySkuTierBasic FirewallPolicySkuTier = "Basic" + // FirewallPolicySkuTierPremium ... + FirewallPolicySkuTierPremium FirewallPolicySkuTier = "Premium" + // FirewallPolicySkuTierStandard ... + FirewallPolicySkuTierStandard FirewallPolicySkuTier = "Standard" +) + +// PossibleFirewallPolicySkuTierValues returns an array of possible values for the FirewallPolicySkuTier const type. +func PossibleFirewallPolicySkuTierValues() []FirewallPolicySkuTier { + return []FirewallPolicySkuTier{FirewallPolicySkuTierBasic, FirewallPolicySkuTierPremium, FirewallPolicySkuTierStandard} +} + +// FlowLogFormatType enumerates the values for flow log format type. +type FlowLogFormatType string + +const ( + // FlowLogFormatTypeJSON ... + FlowLogFormatTypeJSON FlowLogFormatType = "JSON" +) + +// PossibleFlowLogFormatTypeValues returns an array of possible values for the FlowLogFormatType const type. +func PossibleFlowLogFormatTypeValues() []FlowLogFormatType { + return []FlowLogFormatType{FlowLogFormatTypeJSON} +} + +// GatewayLoadBalancerTunnelInterfaceType enumerates the values for gateway load balancer tunnel interface +// type. +type GatewayLoadBalancerTunnelInterfaceType string + +const ( + // GatewayLoadBalancerTunnelInterfaceTypeExternal ... + GatewayLoadBalancerTunnelInterfaceTypeExternal GatewayLoadBalancerTunnelInterfaceType = "External" + // GatewayLoadBalancerTunnelInterfaceTypeInternal ... + GatewayLoadBalancerTunnelInterfaceTypeInternal GatewayLoadBalancerTunnelInterfaceType = "Internal" + // GatewayLoadBalancerTunnelInterfaceTypeNone ... + GatewayLoadBalancerTunnelInterfaceTypeNone GatewayLoadBalancerTunnelInterfaceType = "None" +) + +// PossibleGatewayLoadBalancerTunnelInterfaceTypeValues returns an array of possible values for the GatewayLoadBalancerTunnelInterfaceType const type. +func PossibleGatewayLoadBalancerTunnelInterfaceTypeValues() []GatewayLoadBalancerTunnelInterfaceType { + return []GatewayLoadBalancerTunnelInterfaceType{GatewayLoadBalancerTunnelInterfaceTypeExternal, GatewayLoadBalancerTunnelInterfaceTypeInternal, GatewayLoadBalancerTunnelInterfaceTypeNone} +} + +// GatewayLoadBalancerTunnelProtocol enumerates the values for gateway load balancer tunnel protocol. +type GatewayLoadBalancerTunnelProtocol string + +const ( + // GatewayLoadBalancerTunnelProtocolNative ... + GatewayLoadBalancerTunnelProtocolNative GatewayLoadBalancerTunnelProtocol = "Native" + // GatewayLoadBalancerTunnelProtocolNone ... + GatewayLoadBalancerTunnelProtocolNone GatewayLoadBalancerTunnelProtocol = "None" + // GatewayLoadBalancerTunnelProtocolVXLAN ... + GatewayLoadBalancerTunnelProtocolVXLAN GatewayLoadBalancerTunnelProtocol = "VXLAN" +) + +// PossibleGatewayLoadBalancerTunnelProtocolValues returns an array of possible values for the GatewayLoadBalancerTunnelProtocol const type. +func PossibleGatewayLoadBalancerTunnelProtocolValues() []GatewayLoadBalancerTunnelProtocol { + return []GatewayLoadBalancerTunnelProtocol{GatewayLoadBalancerTunnelProtocolNative, GatewayLoadBalancerTunnelProtocolNone, GatewayLoadBalancerTunnelProtocolVXLAN} +} + +// Geo enumerates the values for geo. +type Geo string + +const ( + // GeoAFRI ... + GeoAFRI Geo = "AFRI" + // GeoAPAC ... + GeoAPAC Geo = "APAC" + // GeoAQ ... + GeoAQ Geo = "AQ" + // GeoEURO ... + GeoEURO Geo = "EURO" + // GeoGLOBAL ... + GeoGLOBAL Geo = "GLOBAL" + // GeoLATAM ... + GeoLATAM Geo = "LATAM" + // GeoME ... + GeoME Geo = "ME" + // GeoNAM ... + GeoNAM Geo = "NAM" + // GeoOCEANIA ... + GeoOCEANIA Geo = "OCEANIA" +) + +// PossibleGeoValues returns an array of possible values for the Geo const type. +func PossibleGeoValues() []Geo { + return []Geo{GeoAFRI, GeoAPAC, GeoAQ, GeoEURO, GeoGLOBAL, GeoLATAM, GeoME, GeoNAM, GeoOCEANIA} +} + +// GroupConnectivity enumerates the values for group connectivity. +type GroupConnectivity string + +const ( + // GroupConnectivityDirectlyConnected ... + GroupConnectivityDirectlyConnected GroupConnectivity = "DirectlyConnected" + // GroupConnectivityNone ... + GroupConnectivityNone GroupConnectivity = "None" +) + +// PossibleGroupConnectivityValues returns an array of possible values for the GroupConnectivity const type. +func PossibleGroupConnectivityValues() []GroupConnectivity { + return []GroupConnectivity{GroupConnectivityDirectlyConnected, GroupConnectivityNone} +} + +// HTTPConfigurationMethod enumerates the values for http configuration method. +type HTTPConfigurationMethod string + +const ( + // HTTPConfigurationMethodGet ... + HTTPConfigurationMethodGet HTTPConfigurationMethod = "Get" + // HTTPConfigurationMethodPost ... + HTTPConfigurationMethodPost HTTPConfigurationMethod = "Post" +) + +// PossibleHTTPConfigurationMethodValues returns an array of possible values for the HTTPConfigurationMethod const type. +func PossibleHTTPConfigurationMethodValues() []HTTPConfigurationMethod { + return []HTTPConfigurationMethod{HTTPConfigurationMethodGet, HTTPConfigurationMethodPost} +} + +// HTTPMethod enumerates the values for http method. +type HTTPMethod string + +const ( + // HTTPMethodGet ... + HTTPMethodGet HTTPMethod = "Get" +) + +// PossibleHTTPMethodValues returns an array of possible values for the HTTPMethod const type. +func PossibleHTTPMethodValues() []HTTPMethod { + return []HTTPMethod{HTTPMethodGet} +} + +// HubBgpConnectionStatus enumerates the values for hub bgp connection status. +type HubBgpConnectionStatus string + +const ( + // HubBgpConnectionStatusConnected ... + HubBgpConnectionStatusConnected HubBgpConnectionStatus = "Connected" + // HubBgpConnectionStatusConnecting ... + HubBgpConnectionStatusConnecting HubBgpConnectionStatus = "Connecting" + // HubBgpConnectionStatusNotConnected ... + HubBgpConnectionStatusNotConnected HubBgpConnectionStatus = "NotConnected" + // HubBgpConnectionStatusUnknown ... + HubBgpConnectionStatusUnknown HubBgpConnectionStatus = "Unknown" +) + +// PossibleHubBgpConnectionStatusValues returns an array of possible values for the HubBgpConnectionStatus const type. +func PossibleHubBgpConnectionStatusValues() []HubBgpConnectionStatus { + return []HubBgpConnectionStatus{HubBgpConnectionStatusConnected, HubBgpConnectionStatusConnecting, HubBgpConnectionStatusNotConnected, HubBgpConnectionStatusUnknown} +} + +// HubRoutingPreference enumerates the values for hub routing preference. +type HubRoutingPreference string + +const ( + // HubRoutingPreferenceASPath ... + HubRoutingPreferenceASPath HubRoutingPreference = "ASPath" + // HubRoutingPreferenceExpressRoute ... + HubRoutingPreferenceExpressRoute HubRoutingPreference = "ExpressRoute" + // HubRoutingPreferenceVpnGateway ... + HubRoutingPreferenceVpnGateway HubRoutingPreference = "VpnGateway" +) + +// PossibleHubRoutingPreferenceValues returns an array of possible values for the HubRoutingPreference const type. +func PossibleHubRoutingPreferenceValues() []HubRoutingPreference { + return []HubRoutingPreference{HubRoutingPreferenceASPath, HubRoutingPreferenceExpressRoute, HubRoutingPreferenceVpnGateway} +} + +// HubVirtualNetworkConnectionStatus enumerates the values for hub virtual network connection status. +type HubVirtualNetworkConnectionStatus string + +const ( + // HubVirtualNetworkConnectionStatusConnected ... + HubVirtualNetworkConnectionStatusConnected HubVirtualNetworkConnectionStatus = "Connected" + // HubVirtualNetworkConnectionStatusConnecting ... + HubVirtualNetworkConnectionStatusConnecting HubVirtualNetworkConnectionStatus = "Connecting" + // HubVirtualNetworkConnectionStatusNotConnected ... + HubVirtualNetworkConnectionStatusNotConnected HubVirtualNetworkConnectionStatus = "NotConnected" + // HubVirtualNetworkConnectionStatusUnknown ... + HubVirtualNetworkConnectionStatusUnknown HubVirtualNetworkConnectionStatus = "Unknown" +) + +// PossibleHubVirtualNetworkConnectionStatusValues returns an array of possible values for the HubVirtualNetworkConnectionStatus const type. +func PossibleHubVirtualNetworkConnectionStatusValues() []HubVirtualNetworkConnectionStatus { + return []HubVirtualNetworkConnectionStatus{HubVirtualNetworkConnectionStatusConnected, HubVirtualNetworkConnectionStatusConnecting, HubVirtualNetworkConnectionStatusNotConnected, HubVirtualNetworkConnectionStatusUnknown} +} + +// IPAllocationMethod enumerates the values for ip allocation method. +type IPAllocationMethod string + +const ( + // IPAllocationMethodDynamic ... + IPAllocationMethodDynamic IPAllocationMethod = "Dynamic" + // IPAllocationMethodStatic ... + IPAllocationMethodStatic IPAllocationMethod = "Static" +) + +// PossibleIPAllocationMethodValues returns an array of possible values for the IPAllocationMethod const type. +func PossibleIPAllocationMethodValues() []IPAllocationMethod { + return []IPAllocationMethod{IPAllocationMethodDynamic, IPAllocationMethodStatic} +} + +// IPAllocationType enumerates the values for ip allocation type. +type IPAllocationType string + +const ( + // IPAllocationTypeHypernet ... + IPAllocationTypeHypernet IPAllocationType = "Hypernet" + // IPAllocationTypeUndefined ... + IPAllocationTypeUndefined IPAllocationType = "Undefined" +) + +// PossibleIPAllocationTypeValues returns an array of possible values for the IPAllocationType const type. +func PossibleIPAllocationTypeValues() []IPAllocationType { + return []IPAllocationType{IPAllocationTypeHypernet, IPAllocationTypeUndefined} +} + +// IPFlowProtocol enumerates the values for ip flow protocol. +type IPFlowProtocol string + +const ( + // IPFlowProtocolTCP ... + IPFlowProtocolTCP IPFlowProtocol = "TCP" + // IPFlowProtocolUDP ... + IPFlowProtocolUDP IPFlowProtocol = "UDP" +) + +// PossibleIPFlowProtocolValues returns an array of possible values for the IPFlowProtocol const type. +func PossibleIPFlowProtocolValues() []IPFlowProtocol { + return []IPFlowProtocol{IPFlowProtocolTCP, IPFlowProtocolUDP} +} + +// IPVersion enumerates the values for ip version. +type IPVersion string + +const ( + // IPVersionIPv4 ... + IPVersionIPv4 IPVersion = "IPv4" + // IPVersionIPv6 ... + IPVersionIPv6 IPVersion = "IPv6" +) + +// PossibleIPVersionValues returns an array of possible values for the IPVersion const type. +func PossibleIPVersionValues() []IPVersion { + return []IPVersion{IPVersionIPv4, IPVersionIPv6} +} + +// IkeEncryption enumerates the values for ike encryption. +type IkeEncryption string + +const ( + // IkeEncryptionAES128 ... + IkeEncryptionAES128 IkeEncryption = "AES128" + // IkeEncryptionAES192 ... + IkeEncryptionAES192 IkeEncryption = "AES192" + // IkeEncryptionAES256 ... + IkeEncryptionAES256 IkeEncryption = "AES256" + // IkeEncryptionDES ... + IkeEncryptionDES IkeEncryption = "DES" + // IkeEncryptionDES3 ... + IkeEncryptionDES3 IkeEncryption = "DES3" + // IkeEncryptionGCMAES128 ... + IkeEncryptionGCMAES128 IkeEncryption = "GCMAES128" + // IkeEncryptionGCMAES256 ... + IkeEncryptionGCMAES256 IkeEncryption = "GCMAES256" +) + +// PossibleIkeEncryptionValues returns an array of possible values for the IkeEncryption const type. +func PossibleIkeEncryptionValues() []IkeEncryption { + return []IkeEncryption{IkeEncryptionAES128, IkeEncryptionAES192, IkeEncryptionAES256, IkeEncryptionDES, IkeEncryptionDES3, IkeEncryptionGCMAES128, IkeEncryptionGCMAES256} +} + +// IkeIntegrity enumerates the values for ike integrity. +type IkeIntegrity string + +const ( + // IkeIntegrityGCMAES128 ... + IkeIntegrityGCMAES128 IkeIntegrity = "GCMAES128" + // IkeIntegrityGCMAES256 ... + IkeIntegrityGCMAES256 IkeIntegrity = "GCMAES256" + // IkeIntegrityMD5 ... + IkeIntegrityMD5 IkeIntegrity = "MD5" + // IkeIntegritySHA1 ... + IkeIntegritySHA1 IkeIntegrity = "SHA1" + // IkeIntegritySHA256 ... + IkeIntegritySHA256 IkeIntegrity = "SHA256" + // IkeIntegritySHA384 ... + IkeIntegritySHA384 IkeIntegrity = "SHA384" +) + +// PossibleIkeIntegrityValues returns an array of possible values for the IkeIntegrity const type. +func PossibleIkeIntegrityValues() []IkeIntegrity { + return []IkeIntegrity{IkeIntegrityGCMAES128, IkeIntegrityGCMAES256, IkeIntegrityMD5, IkeIntegritySHA1, IkeIntegritySHA256, IkeIntegritySHA384} +} + +// InboundSecurityRulesProtocol enumerates the values for inbound security rules protocol. +type InboundSecurityRulesProtocol string + +const ( + // InboundSecurityRulesProtocolTCP ... + InboundSecurityRulesProtocolTCP InboundSecurityRulesProtocol = "TCP" + // InboundSecurityRulesProtocolUDP ... + InboundSecurityRulesProtocolUDP InboundSecurityRulesProtocol = "UDP" +) + +// PossibleInboundSecurityRulesProtocolValues returns an array of possible values for the InboundSecurityRulesProtocol const type. +func PossibleInboundSecurityRulesProtocolValues() []InboundSecurityRulesProtocol { + return []InboundSecurityRulesProtocol{InboundSecurityRulesProtocolTCP, InboundSecurityRulesProtocolUDP} +} + +// IntentPolicyBasedService enumerates the values for intent policy based service. +type IntentPolicyBasedService string + +const ( + // IntentPolicyBasedServiceAll ... + IntentPolicyBasedServiceAll IntentPolicyBasedService = "All" + // IntentPolicyBasedServiceAllowRulesOnly ... + IntentPolicyBasedServiceAllowRulesOnly IntentPolicyBasedService = "AllowRulesOnly" + // IntentPolicyBasedServiceNone ... + IntentPolicyBasedServiceNone IntentPolicyBasedService = "None" +) + +// PossibleIntentPolicyBasedServiceValues returns an array of possible values for the IntentPolicyBasedService const type. +func PossibleIntentPolicyBasedServiceValues() []IntentPolicyBasedService { + return []IntentPolicyBasedService{IntentPolicyBasedServiceAll, IntentPolicyBasedServiceAllowRulesOnly, IntentPolicyBasedServiceNone} +} + +// InterfaceAuxiliaryMode enumerates the values for interface auxiliary mode. +type InterfaceAuxiliaryMode string + +const ( + // InterfaceAuxiliaryModeFloating ... + InterfaceAuxiliaryModeFloating InterfaceAuxiliaryMode = "Floating" + // InterfaceAuxiliaryModeMaxConnections ... + InterfaceAuxiliaryModeMaxConnections InterfaceAuxiliaryMode = "MaxConnections" + // InterfaceAuxiliaryModeNone ... + InterfaceAuxiliaryModeNone InterfaceAuxiliaryMode = "None" +) + +// PossibleInterfaceAuxiliaryModeValues returns an array of possible values for the InterfaceAuxiliaryMode const type. +func PossibleInterfaceAuxiliaryModeValues() []InterfaceAuxiliaryMode { + return []InterfaceAuxiliaryMode{InterfaceAuxiliaryModeFloating, InterfaceAuxiliaryModeMaxConnections, InterfaceAuxiliaryModeNone} +} + +// InterfaceMigrationPhase enumerates the values for interface migration phase. +type InterfaceMigrationPhase string + +const ( + // InterfaceMigrationPhaseAbort ... + InterfaceMigrationPhaseAbort InterfaceMigrationPhase = "Abort" + // InterfaceMigrationPhaseCommit ... + InterfaceMigrationPhaseCommit InterfaceMigrationPhase = "Commit" + // InterfaceMigrationPhaseCommitted ... + InterfaceMigrationPhaseCommitted InterfaceMigrationPhase = "Committed" + // InterfaceMigrationPhaseNone ... + InterfaceMigrationPhaseNone InterfaceMigrationPhase = "None" + // InterfaceMigrationPhasePrepare ... + InterfaceMigrationPhasePrepare InterfaceMigrationPhase = "Prepare" +) + +// PossibleInterfaceMigrationPhaseValues returns an array of possible values for the InterfaceMigrationPhase const type. +func PossibleInterfaceMigrationPhaseValues() []InterfaceMigrationPhase { + return []InterfaceMigrationPhase{InterfaceMigrationPhaseAbort, InterfaceMigrationPhaseCommit, InterfaceMigrationPhaseCommitted, InterfaceMigrationPhaseNone, InterfaceMigrationPhasePrepare} +} + +// InterfaceNicType enumerates the values for interface nic type. +type InterfaceNicType string + +const ( + // InterfaceNicTypeElastic ... + InterfaceNicTypeElastic InterfaceNicType = "Elastic" + // InterfaceNicTypeStandard ... + InterfaceNicTypeStandard InterfaceNicType = "Standard" +) + +// PossibleInterfaceNicTypeValues returns an array of possible values for the InterfaceNicType const type. +func PossibleInterfaceNicTypeValues() []InterfaceNicType { + return []InterfaceNicType{InterfaceNicTypeElastic, InterfaceNicTypeStandard} +} + +// IpsecEncryption enumerates the values for ipsec encryption. +type IpsecEncryption string + +const ( + // IpsecEncryptionAES128 ... + IpsecEncryptionAES128 IpsecEncryption = "AES128" + // IpsecEncryptionAES192 ... + IpsecEncryptionAES192 IpsecEncryption = "AES192" + // IpsecEncryptionAES256 ... + IpsecEncryptionAES256 IpsecEncryption = "AES256" + // IpsecEncryptionDES ... + IpsecEncryptionDES IpsecEncryption = "DES" + // IpsecEncryptionDES3 ... + IpsecEncryptionDES3 IpsecEncryption = "DES3" + // IpsecEncryptionGCMAES128 ... + IpsecEncryptionGCMAES128 IpsecEncryption = "GCMAES128" + // IpsecEncryptionGCMAES192 ... + IpsecEncryptionGCMAES192 IpsecEncryption = "GCMAES192" + // IpsecEncryptionGCMAES256 ... + IpsecEncryptionGCMAES256 IpsecEncryption = "GCMAES256" + // IpsecEncryptionNone ... + IpsecEncryptionNone IpsecEncryption = "None" +) + +// PossibleIpsecEncryptionValues returns an array of possible values for the IpsecEncryption const type. +func PossibleIpsecEncryptionValues() []IpsecEncryption { + return []IpsecEncryption{IpsecEncryptionAES128, IpsecEncryptionAES192, IpsecEncryptionAES256, IpsecEncryptionDES, IpsecEncryptionDES3, IpsecEncryptionGCMAES128, IpsecEncryptionGCMAES192, IpsecEncryptionGCMAES256, IpsecEncryptionNone} +} + +// IpsecIntegrity enumerates the values for ipsec integrity. +type IpsecIntegrity string + +const ( + // IpsecIntegrityGCMAES128 ... + IpsecIntegrityGCMAES128 IpsecIntegrity = "GCMAES128" + // IpsecIntegrityGCMAES192 ... + IpsecIntegrityGCMAES192 IpsecIntegrity = "GCMAES192" + // IpsecIntegrityGCMAES256 ... + IpsecIntegrityGCMAES256 IpsecIntegrity = "GCMAES256" + // IpsecIntegrityMD5 ... + IpsecIntegrityMD5 IpsecIntegrity = "MD5" + // IpsecIntegritySHA1 ... + IpsecIntegritySHA1 IpsecIntegrity = "SHA1" + // IpsecIntegritySHA256 ... + IpsecIntegritySHA256 IpsecIntegrity = "SHA256" +) + +// PossibleIpsecIntegrityValues returns an array of possible values for the IpsecIntegrity const type. +func PossibleIpsecIntegrityValues() []IpsecIntegrity { + return []IpsecIntegrity{IpsecIntegrityGCMAES128, IpsecIntegrityGCMAES192, IpsecIntegrityGCMAES256, IpsecIntegrityMD5, IpsecIntegritySHA1, IpsecIntegritySHA256} +} + +// IsGlobal enumerates the values for is global. +type IsGlobal string + +const ( + // IsGlobalFalse ... + IsGlobalFalse IsGlobal = "False" + // IsGlobalTrue ... + IsGlobalTrue IsGlobal = "True" +) + +// PossibleIsGlobalValues returns an array of possible values for the IsGlobal const type. +func PossibleIsGlobalValues() []IsGlobal { + return []IsGlobal{IsGlobalFalse, IsGlobalTrue} +} + +// IsWorkloadProtected enumerates the values for is workload protected. +type IsWorkloadProtected string + +const ( + // IsWorkloadProtectedFalse ... + IsWorkloadProtectedFalse IsWorkloadProtected = "False" + // IsWorkloadProtectedTrue ... + IsWorkloadProtectedTrue IsWorkloadProtected = "True" +) + +// PossibleIsWorkloadProtectedValues returns an array of possible values for the IsWorkloadProtected const type. +func PossibleIsWorkloadProtectedValues() []IsWorkloadProtected { + return []IsWorkloadProtected{IsWorkloadProtectedFalse, IsWorkloadProtectedTrue} +} + +// IssueType enumerates the values for issue type. +type IssueType string + +const ( + // IssueTypeAgentStopped ... + IssueTypeAgentStopped IssueType = "AgentStopped" + // IssueTypeDNSResolution ... + IssueTypeDNSResolution IssueType = "DnsResolution" + // IssueTypeGuestFirewall ... + IssueTypeGuestFirewall IssueType = "GuestFirewall" + // IssueTypeNetworkSecurityRule ... + IssueTypeNetworkSecurityRule IssueType = "NetworkSecurityRule" + // IssueTypePlatform ... + IssueTypePlatform IssueType = "Platform" + // IssueTypePortThrottled ... + IssueTypePortThrottled IssueType = "PortThrottled" + // IssueTypeSocketBind ... + IssueTypeSocketBind IssueType = "SocketBind" + // IssueTypeUnknown ... + IssueTypeUnknown IssueType = "Unknown" + // IssueTypeUserDefinedRoute ... + IssueTypeUserDefinedRoute IssueType = "UserDefinedRoute" +) + +// PossibleIssueTypeValues returns an array of possible values for the IssueType const type. +func PossibleIssueTypeValues() []IssueType { + return []IssueType{IssueTypeAgentStopped, IssueTypeDNSResolution, IssueTypeGuestFirewall, IssueTypeNetworkSecurityRule, IssueTypePlatform, IssueTypePortThrottled, IssueTypeSocketBind, IssueTypeUnknown, IssueTypeUserDefinedRoute} +} + +// Kind enumerates the values for kind. +type Kind string + +const ( + // KindActiveBaseSecurityAdminRule ... + KindActiveBaseSecurityAdminRule Kind = "ActiveBaseSecurityAdminRule" + // KindCustom ... + KindCustom Kind = "Custom" + // KindDefault ... + KindDefault Kind = "Default" +) + +// PossibleKindValues returns an array of possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{KindActiveBaseSecurityAdminRule, KindCustom, KindDefault} +} + +// KindBasicBaseAdminRule enumerates the values for kind basic base admin rule. +type KindBasicBaseAdminRule string + +const ( + // KindBasicBaseAdminRuleKindBaseAdminRule ... + KindBasicBaseAdminRuleKindBaseAdminRule KindBasicBaseAdminRule = "BaseAdminRule" + // KindBasicBaseAdminRuleKindCustom ... + KindBasicBaseAdminRuleKindCustom KindBasicBaseAdminRule = "Custom" + // KindBasicBaseAdminRuleKindDefault ... + KindBasicBaseAdminRuleKindDefault KindBasicBaseAdminRule = "Default" +) + +// PossibleKindBasicBaseAdminRuleValues returns an array of possible values for the KindBasicBaseAdminRule const type. +func PossibleKindBasicBaseAdminRuleValues() []KindBasicBaseAdminRule { + return []KindBasicBaseAdminRule{KindBasicBaseAdminRuleKindBaseAdminRule, KindBasicBaseAdminRuleKindCustom, KindBasicBaseAdminRuleKindDefault} +} + +// KindBasicEffectiveBaseSecurityAdminRule enumerates the values for kind basic effective base security admin +// rule. +type KindBasicEffectiveBaseSecurityAdminRule string + +const ( + // KindBasicEffectiveBaseSecurityAdminRuleKindCustom ... + KindBasicEffectiveBaseSecurityAdminRuleKindCustom KindBasicEffectiveBaseSecurityAdminRule = "Custom" + // KindBasicEffectiveBaseSecurityAdminRuleKindDefault ... + KindBasicEffectiveBaseSecurityAdminRuleKindDefault KindBasicEffectiveBaseSecurityAdminRule = "Default" + // KindBasicEffectiveBaseSecurityAdminRuleKindEffectiveBaseSecurityAdminRule ... + KindBasicEffectiveBaseSecurityAdminRuleKindEffectiveBaseSecurityAdminRule KindBasicEffectiveBaseSecurityAdminRule = "EffectiveBaseSecurityAdminRule" +) + +// PossibleKindBasicEffectiveBaseSecurityAdminRuleValues returns an array of possible values for the KindBasicEffectiveBaseSecurityAdminRule const type. +func PossibleKindBasicEffectiveBaseSecurityAdminRuleValues() []KindBasicEffectiveBaseSecurityAdminRule { + return []KindBasicEffectiveBaseSecurityAdminRule{KindBasicEffectiveBaseSecurityAdminRuleKindCustom, KindBasicEffectiveBaseSecurityAdminRuleKindDefault, KindBasicEffectiveBaseSecurityAdminRuleKindEffectiveBaseSecurityAdminRule} +} + +// LoadBalancerBackendAddressAdminState enumerates the values for load balancer backend address admin state. +type LoadBalancerBackendAddressAdminState string + +const ( + // LoadBalancerBackendAddressAdminStateDown ... + LoadBalancerBackendAddressAdminStateDown LoadBalancerBackendAddressAdminState = "Down" + // LoadBalancerBackendAddressAdminStateDrain ... + LoadBalancerBackendAddressAdminStateDrain LoadBalancerBackendAddressAdminState = "Drain" + // LoadBalancerBackendAddressAdminStateNone ... + LoadBalancerBackendAddressAdminStateNone LoadBalancerBackendAddressAdminState = "None" + // LoadBalancerBackendAddressAdminStateUp ... + LoadBalancerBackendAddressAdminStateUp LoadBalancerBackendAddressAdminState = "Up" +) + +// PossibleLoadBalancerBackendAddressAdminStateValues returns an array of possible values for the LoadBalancerBackendAddressAdminState const type. +func PossibleLoadBalancerBackendAddressAdminStateValues() []LoadBalancerBackendAddressAdminState { + return []LoadBalancerBackendAddressAdminState{LoadBalancerBackendAddressAdminStateDown, LoadBalancerBackendAddressAdminStateDrain, LoadBalancerBackendAddressAdminStateNone, LoadBalancerBackendAddressAdminStateUp} +} + +// LoadBalancerOutboundRuleProtocol enumerates the values for load balancer outbound rule protocol. +type LoadBalancerOutboundRuleProtocol string + +const ( + // LoadBalancerOutboundRuleProtocolAll ... + LoadBalancerOutboundRuleProtocolAll LoadBalancerOutboundRuleProtocol = "All" + // LoadBalancerOutboundRuleProtocolTCP ... + LoadBalancerOutboundRuleProtocolTCP LoadBalancerOutboundRuleProtocol = "Tcp" + // LoadBalancerOutboundRuleProtocolUDP ... + LoadBalancerOutboundRuleProtocolUDP LoadBalancerOutboundRuleProtocol = "Udp" +) + +// PossibleLoadBalancerOutboundRuleProtocolValues returns an array of possible values for the LoadBalancerOutboundRuleProtocol const type. +func PossibleLoadBalancerOutboundRuleProtocolValues() []LoadBalancerOutboundRuleProtocol { + return []LoadBalancerOutboundRuleProtocol{LoadBalancerOutboundRuleProtocolAll, LoadBalancerOutboundRuleProtocolTCP, LoadBalancerOutboundRuleProtocolUDP} +} + +// LoadBalancerSkuName enumerates the values for load balancer sku name. +type LoadBalancerSkuName string + +const ( + // LoadBalancerSkuNameBasic ... + LoadBalancerSkuNameBasic LoadBalancerSkuName = "Basic" + // LoadBalancerSkuNameGateway ... + LoadBalancerSkuNameGateway LoadBalancerSkuName = "Gateway" + // LoadBalancerSkuNameStandard ... + LoadBalancerSkuNameStandard LoadBalancerSkuName = "Standard" +) + +// PossibleLoadBalancerSkuNameValues returns an array of possible values for the LoadBalancerSkuName const type. +func PossibleLoadBalancerSkuNameValues() []LoadBalancerSkuName { + return []LoadBalancerSkuName{LoadBalancerSkuNameBasic, LoadBalancerSkuNameGateway, LoadBalancerSkuNameStandard} +} + +// LoadBalancerSkuTier enumerates the values for load balancer sku tier. +type LoadBalancerSkuTier string + +const ( + // LoadBalancerSkuTierGlobal ... + LoadBalancerSkuTierGlobal LoadBalancerSkuTier = "Global" + // LoadBalancerSkuTierRegional ... + LoadBalancerSkuTierRegional LoadBalancerSkuTier = "Regional" +) + +// PossibleLoadBalancerSkuTierValues returns an array of possible values for the LoadBalancerSkuTier const type. +func PossibleLoadBalancerSkuTierValues() []LoadBalancerSkuTier { + return []LoadBalancerSkuTier{LoadBalancerSkuTierGlobal, LoadBalancerSkuTierRegional} +} + +// LoadDistribution enumerates the values for load distribution. +type LoadDistribution string + +const ( + // LoadDistributionDefault ... + LoadDistributionDefault LoadDistribution = "Default" + // LoadDistributionSourceIP ... + LoadDistributionSourceIP LoadDistribution = "SourceIP" + // LoadDistributionSourceIPProtocol ... + LoadDistributionSourceIPProtocol LoadDistribution = "SourceIPProtocol" +) + +// PossibleLoadDistributionValues returns an array of possible values for the LoadDistribution const type. +func PossibleLoadDistributionValues() []LoadDistribution { + return []LoadDistribution{LoadDistributionDefault, LoadDistributionSourceIP, LoadDistributionSourceIPProtocol} +} + +// ManagedRuleEnabledState enumerates the values for managed rule enabled state. +type ManagedRuleEnabledState string + +const ( + // ManagedRuleEnabledStateDisabled ... + ManagedRuleEnabledStateDisabled ManagedRuleEnabledState = "Disabled" + // ManagedRuleEnabledStateEnabled ... + ManagedRuleEnabledStateEnabled ManagedRuleEnabledState = "Enabled" +) + +// PossibleManagedRuleEnabledStateValues returns an array of possible values for the ManagedRuleEnabledState const type. +func PossibleManagedRuleEnabledStateValues() []ManagedRuleEnabledState { + return []ManagedRuleEnabledState{ManagedRuleEnabledStateDisabled, ManagedRuleEnabledStateEnabled} +} + +// NatGatewaySkuName enumerates the values for nat gateway sku name. +type NatGatewaySkuName string + +const ( + // NatGatewaySkuNameStandard ... + NatGatewaySkuNameStandard NatGatewaySkuName = "Standard" +) + +// PossibleNatGatewaySkuNameValues returns an array of possible values for the NatGatewaySkuName const type. +func PossibleNatGatewaySkuNameValues() []NatGatewaySkuName { + return []NatGatewaySkuName{NatGatewaySkuNameStandard} +} + +// NextHopType enumerates the values for next hop type. +type NextHopType string + +const ( + // NextHopTypeHyperNetGateway ... + NextHopTypeHyperNetGateway NextHopType = "HyperNetGateway" + // NextHopTypeInternet ... + NextHopTypeInternet NextHopType = "Internet" + // NextHopTypeNone ... + NextHopTypeNone NextHopType = "None" + // NextHopTypeVirtualAppliance ... + NextHopTypeVirtualAppliance NextHopType = "VirtualAppliance" + // NextHopTypeVirtualNetworkGateway ... + NextHopTypeVirtualNetworkGateway NextHopType = "VirtualNetworkGateway" + // NextHopTypeVnetLocal ... + NextHopTypeVnetLocal NextHopType = "VnetLocal" +) + +// PossibleNextHopTypeValues returns an array of possible values for the NextHopType const type. +func PossibleNextHopTypeValues() []NextHopType { + return []NextHopType{NextHopTypeHyperNetGateway, NextHopTypeInternet, NextHopTypeNone, NextHopTypeVirtualAppliance, NextHopTypeVirtualNetworkGateway, NextHopTypeVnetLocal} +} + +// NextStep enumerates the values for next step. +type NextStep string + +const ( + // NextStepContinue ... + NextStepContinue NextStep = "Continue" + // NextStepTerminate ... + NextStepTerminate NextStep = "Terminate" + // NextStepUnknown ... + NextStepUnknown NextStep = "Unknown" +) + +// PossibleNextStepValues returns an array of possible values for the NextStep const type. +func PossibleNextStepValues() []NextStep { + return []NextStep{NextStepContinue, NextStepTerminate, NextStepUnknown} +} + +// OfficeTrafficCategory enumerates the values for office traffic category. +type OfficeTrafficCategory string + +const ( + // OfficeTrafficCategoryAll ... + OfficeTrafficCategoryAll OfficeTrafficCategory = "All" + // OfficeTrafficCategoryNone ... + OfficeTrafficCategoryNone OfficeTrafficCategory = "None" + // OfficeTrafficCategoryOptimize ... + OfficeTrafficCategoryOptimize OfficeTrafficCategory = "Optimize" + // OfficeTrafficCategoryOptimizeAndAllow ... + OfficeTrafficCategoryOptimizeAndAllow OfficeTrafficCategory = "OptimizeAndAllow" +) + +// PossibleOfficeTrafficCategoryValues returns an array of possible values for the OfficeTrafficCategory const type. +func PossibleOfficeTrafficCategoryValues() []OfficeTrafficCategory { + return []OfficeTrafficCategory{OfficeTrafficCategoryAll, OfficeTrafficCategoryNone, OfficeTrafficCategoryOptimize, OfficeTrafficCategoryOptimizeAndAllow} +} + +// OperationStatus enumerates the values for operation status. +type OperationStatus string + +const ( + // OperationStatusFailed ... + OperationStatusFailed OperationStatus = "Failed" + // OperationStatusInProgress ... + OperationStatusInProgress OperationStatus = "InProgress" + // OperationStatusSucceeded ... + OperationStatusSucceeded OperationStatus = "Succeeded" +) + +// PossibleOperationStatusValues returns an array of possible values for the OperationStatus const type. +func PossibleOperationStatusValues() []OperationStatus { + return []OperationStatus{OperationStatusFailed, OperationStatusInProgress, OperationStatusSucceeded} +} + +// Origin enumerates the values for origin. +type Origin string + +const ( + // OriginInbound ... + OriginInbound Origin = "Inbound" + // OriginLocal ... + OriginLocal Origin = "Local" + // OriginOutbound ... + OriginOutbound Origin = "Outbound" +) + +// PossibleOriginValues returns an array of possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{OriginInbound, OriginLocal, OriginOutbound} +} + +// OutputType enumerates the values for output type. +type OutputType string + +const ( + // OutputTypeWorkspace ... + OutputTypeWorkspace OutputType = "Workspace" +) + +// PossibleOutputTypeValues returns an array of possible values for the OutputType const type. +func PossibleOutputTypeValues() []OutputType { + return []OutputType{OutputTypeWorkspace} +} + +// OwaspCrsExclusionEntryMatchVariable enumerates the values for owasp crs exclusion entry match variable. +type OwaspCrsExclusionEntryMatchVariable string + +const ( + // OwaspCrsExclusionEntryMatchVariableRequestArgKeys ... + OwaspCrsExclusionEntryMatchVariableRequestArgKeys OwaspCrsExclusionEntryMatchVariable = "RequestArgKeys" + // OwaspCrsExclusionEntryMatchVariableRequestArgNames ... + OwaspCrsExclusionEntryMatchVariableRequestArgNames OwaspCrsExclusionEntryMatchVariable = "RequestArgNames" + // OwaspCrsExclusionEntryMatchVariableRequestArgValues ... + OwaspCrsExclusionEntryMatchVariableRequestArgValues OwaspCrsExclusionEntryMatchVariable = "RequestArgValues" + // OwaspCrsExclusionEntryMatchVariableRequestCookieKeys ... + OwaspCrsExclusionEntryMatchVariableRequestCookieKeys OwaspCrsExclusionEntryMatchVariable = "RequestCookieKeys" + // OwaspCrsExclusionEntryMatchVariableRequestCookieNames ... + OwaspCrsExclusionEntryMatchVariableRequestCookieNames OwaspCrsExclusionEntryMatchVariable = "RequestCookieNames" + // OwaspCrsExclusionEntryMatchVariableRequestCookieValues ... + OwaspCrsExclusionEntryMatchVariableRequestCookieValues OwaspCrsExclusionEntryMatchVariable = "RequestCookieValues" + // OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys ... + OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys OwaspCrsExclusionEntryMatchVariable = "RequestHeaderKeys" + // OwaspCrsExclusionEntryMatchVariableRequestHeaderNames ... + OwaspCrsExclusionEntryMatchVariableRequestHeaderNames OwaspCrsExclusionEntryMatchVariable = "RequestHeaderNames" + // OwaspCrsExclusionEntryMatchVariableRequestHeaderValues ... + OwaspCrsExclusionEntryMatchVariableRequestHeaderValues OwaspCrsExclusionEntryMatchVariable = "RequestHeaderValues" +) + +// PossibleOwaspCrsExclusionEntryMatchVariableValues returns an array of possible values for the OwaspCrsExclusionEntryMatchVariable const type. +func PossibleOwaspCrsExclusionEntryMatchVariableValues() []OwaspCrsExclusionEntryMatchVariable { + return []OwaspCrsExclusionEntryMatchVariable{OwaspCrsExclusionEntryMatchVariableRequestArgKeys, OwaspCrsExclusionEntryMatchVariableRequestArgNames, OwaspCrsExclusionEntryMatchVariableRequestArgValues, OwaspCrsExclusionEntryMatchVariableRequestCookieKeys, OwaspCrsExclusionEntryMatchVariableRequestCookieNames, OwaspCrsExclusionEntryMatchVariableRequestCookieValues, OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys, OwaspCrsExclusionEntryMatchVariableRequestHeaderNames, OwaspCrsExclusionEntryMatchVariableRequestHeaderValues} +} + +// OwaspCrsExclusionEntrySelectorMatchOperator enumerates the values for owasp crs exclusion entry selector +// match operator. +type OwaspCrsExclusionEntrySelectorMatchOperator string + +const ( + // OwaspCrsExclusionEntrySelectorMatchOperatorContains ... + OwaspCrsExclusionEntrySelectorMatchOperatorContains OwaspCrsExclusionEntrySelectorMatchOperator = "Contains" + // OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith ... + OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith OwaspCrsExclusionEntrySelectorMatchOperator = "EndsWith" + // OwaspCrsExclusionEntrySelectorMatchOperatorEquals ... + OwaspCrsExclusionEntrySelectorMatchOperatorEquals OwaspCrsExclusionEntrySelectorMatchOperator = "Equals" + // OwaspCrsExclusionEntrySelectorMatchOperatorEqualsAny ... + OwaspCrsExclusionEntrySelectorMatchOperatorEqualsAny OwaspCrsExclusionEntrySelectorMatchOperator = "EqualsAny" + // OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith ... + OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith OwaspCrsExclusionEntrySelectorMatchOperator = "StartsWith" +) + +// PossibleOwaspCrsExclusionEntrySelectorMatchOperatorValues returns an array of possible values for the OwaspCrsExclusionEntrySelectorMatchOperator const type. +func PossibleOwaspCrsExclusionEntrySelectorMatchOperatorValues() []OwaspCrsExclusionEntrySelectorMatchOperator { + return []OwaspCrsExclusionEntrySelectorMatchOperator{OwaspCrsExclusionEntrySelectorMatchOperatorContains, OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith, OwaspCrsExclusionEntrySelectorMatchOperatorEquals, OwaspCrsExclusionEntrySelectorMatchOperatorEqualsAny, OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith} +} + +// PacketCaptureTargetType enumerates the values for packet capture target type. +type PacketCaptureTargetType string + +const ( + // PacketCaptureTargetTypeAzureVM ... + PacketCaptureTargetTypeAzureVM PacketCaptureTargetType = "AzureVM" + // PacketCaptureTargetTypeAzureVMSS ... + PacketCaptureTargetTypeAzureVMSS PacketCaptureTargetType = "AzureVMSS" +) + +// PossiblePacketCaptureTargetTypeValues returns an array of possible values for the PacketCaptureTargetType const type. +func PossiblePacketCaptureTargetTypeValues() []PacketCaptureTargetType { + return []PacketCaptureTargetType{PacketCaptureTargetTypeAzureVM, PacketCaptureTargetTypeAzureVMSS} +} + +// PcError enumerates the values for pc error. +type PcError string + +const ( + // PcErrorAgentStopped ... + PcErrorAgentStopped PcError = "AgentStopped" + // PcErrorCaptureFailed ... + PcErrorCaptureFailed PcError = "CaptureFailed" + // PcErrorInternalError ... + PcErrorInternalError PcError = "InternalError" + // PcErrorLocalFileFailed ... + PcErrorLocalFileFailed PcError = "LocalFileFailed" + // PcErrorStorageFailed ... + PcErrorStorageFailed PcError = "StorageFailed" +) + +// PossiblePcErrorValues returns an array of possible values for the PcError const type. +func PossiblePcErrorValues() []PcError { + return []PcError{PcErrorAgentStopped, PcErrorCaptureFailed, PcErrorInternalError, PcErrorLocalFileFailed, PcErrorStorageFailed} +} + +// PcProtocol enumerates the values for pc protocol. +type PcProtocol string + +const ( + // PcProtocolAny ... + PcProtocolAny PcProtocol = "Any" + // PcProtocolTCP ... + PcProtocolTCP PcProtocol = "TCP" + // PcProtocolUDP ... + PcProtocolUDP PcProtocol = "UDP" +) + +// PossiblePcProtocolValues returns an array of possible values for the PcProtocol const type. +func PossiblePcProtocolValues() []PcProtocol { + return []PcProtocol{PcProtocolAny, PcProtocolTCP, PcProtocolUDP} +} + +// PcStatus enumerates the values for pc status. +type PcStatus string + +const ( + // PcStatusError ... + PcStatusError PcStatus = "Error" + // PcStatusNotStarted ... + PcStatusNotStarted PcStatus = "NotStarted" + // PcStatusRunning ... + PcStatusRunning PcStatus = "Running" + // PcStatusStopped ... + PcStatusStopped PcStatus = "Stopped" + // PcStatusUnknown ... + PcStatusUnknown PcStatus = "Unknown" +) + +// PossiblePcStatusValues returns an array of possible values for the PcStatus const type. +func PossiblePcStatusValues() []PcStatus { + return []PcStatus{PcStatusError, PcStatusNotStarted, PcStatusRunning, PcStatusStopped, PcStatusUnknown} +} + +// PfsGroup enumerates the values for pfs group. +type PfsGroup string + +const ( + // PfsGroupECP256 ... + PfsGroupECP256 PfsGroup = "ECP256" + // PfsGroupECP384 ... + PfsGroupECP384 PfsGroup = "ECP384" + // PfsGroupNone ... + PfsGroupNone PfsGroup = "None" + // PfsGroupPFS1 ... + PfsGroupPFS1 PfsGroup = "PFS1" + // PfsGroupPFS14 ... + PfsGroupPFS14 PfsGroup = "PFS14" + // PfsGroupPFS2 ... + PfsGroupPFS2 PfsGroup = "PFS2" + // PfsGroupPFS2048 ... + PfsGroupPFS2048 PfsGroup = "PFS2048" + // PfsGroupPFS24 ... + PfsGroupPFS24 PfsGroup = "PFS24" + // PfsGroupPFSMM ... + PfsGroupPFSMM PfsGroup = "PFSMM" +) + +// PossiblePfsGroupValues returns an array of possible values for the PfsGroup const type. +func PossiblePfsGroupValues() []PfsGroup { + return []PfsGroup{PfsGroupECP256, PfsGroupECP384, PfsGroupNone, PfsGroupPFS1, PfsGroupPFS14, PfsGroupPFS2, PfsGroupPFS2048, PfsGroupPFS24, PfsGroupPFSMM} +} + +// PreferredIPVersion enumerates the values for preferred ip version. +type PreferredIPVersion string + +const ( + // PreferredIPVersionIPv4 ... + PreferredIPVersionIPv4 PreferredIPVersion = "IPv4" + // PreferredIPVersionIPv6 ... + PreferredIPVersionIPv6 PreferredIPVersion = "IPv6" +) + +// PossiblePreferredIPVersionValues returns an array of possible values for the PreferredIPVersion const type. +func PossiblePreferredIPVersionValues() []PreferredIPVersion { + return []PreferredIPVersion{PreferredIPVersionIPv4, PreferredIPVersionIPv6} +} + +// PreferredRoutingGateway enumerates the values for preferred routing gateway. +type PreferredRoutingGateway string + +const ( + // PreferredRoutingGatewayExpressRoute ... + PreferredRoutingGatewayExpressRoute PreferredRoutingGateway = "ExpressRoute" + // PreferredRoutingGatewayNone ... + PreferredRoutingGatewayNone PreferredRoutingGateway = "None" + // PreferredRoutingGatewayVpnGateway ... + PreferredRoutingGatewayVpnGateway PreferredRoutingGateway = "VpnGateway" +) + +// PossiblePreferredRoutingGatewayValues returns an array of possible values for the PreferredRoutingGateway const type. +func PossiblePreferredRoutingGatewayValues() []PreferredRoutingGateway { + return []PreferredRoutingGateway{PreferredRoutingGatewayExpressRoute, PreferredRoutingGatewayNone, PreferredRoutingGatewayVpnGateway} +} + +// ProbeProtocol enumerates the values for probe protocol. +type ProbeProtocol string + +const ( + // ProbeProtocolHTTP ... + ProbeProtocolHTTP ProbeProtocol = "Http" + // ProbeProtocolHTTPS ... + ProbeProtocolHTTPS ProbeProtocol = "Https" + // ProbeProtocolTCP ... + ProbeProtocolTCP ProbeProtocol = "Tcp" +) + +// PossibleProbeProtocolValues returns an array of possible values for the ProbeProtocol const type. +func PossibleProbeProtocolValues() []ProbeProtocol { + return []ProbeProtocol{ProbeProtocolHTTP, ProbeProtocolHTTPS, ProbeProtocolTCP} +} + +// ProcessorArchitecture enumerates the values for processor architecture. +type ProcessorArchitecture string + +const ( + // ProcessorArchitectureAmd64 ... + ProcessorArchitectureAmd64 ProcessorArchitecture = "Amd64" + // ProcessorArchitectureX86 ... + ProcessorArchitectureX86 ProcessorArchitecture = "X86" +) + +// PossibleProcessorArchitectureValues returns an array of possible values for the ProcessorArchitecture const type. +func PossibleProcessorArchitectureValues() []ProcessorArchitecture { + return []ProcessorArchitecture{ProcessorArchitectureAmd64, ProcessorArchitectureX86} +} + +// Protocol enumerates the values for protocol. +type Protocol string + +const ( + // ProtocolHTTP ... + ProtocolHTTP Protocol = "Http" + // ProtocolHTTPS ... + ProtocolHTTPS Protocol = "Https" + // ProtocolIcmp ... + ProtocolIcmp Protocol = "Icmp" + // ProtocolTCP ... + ProtocolTCP Protocol = "Tcp" +) + +// PossibleProtocolValues returns an array of possible values for the Protocol const type. +func PossibleProtocolValues() []Protocol { + return []Protocol{ProtocolHTTP, ProtocolHTTPS, ProtocolIcmp, ProtocolTCP} +} + +// ProtocolType enumerates the values for protocol type. +type ProtocolType string + +const ( + // ProtocolTypeAh ... + ProtocolTypeAh ProtocolType = "Ah" + // ProtocolTypeAll ... + ProtocolTypeAll ProtocolType = "All" + // ProtocolTypeDoNotUse ... + ProtocolTypeDoNotUse ProtocolType = "DoNotUse" + // ProtocolTypeEsp ... + ProtocolTypeEsp ProtocolType = "Esp" + // ProtocolTypeGre ... + ProtocolTypeGre ProtocolType = "Gre" + // ProtocolTypeIcmp ... + ProtocolTypeIcmp ProtocolType = "Icmp" + // ProtocolTypeTCP ... + ProtocolTypeTCP ProtocolType = "Tcp" + // ProtocolTypeUDP ... + ProtocolTypeUDP ProtocolType = "Udp" + // ProtocolTypeVxlan ... + ProtocolTypeVxlan ProtocolType = "Vxlan" +) + +// PossibleProtocolTypeValues returns an array of possible values for the ProtocolType const type. +func PossibleProtocolTypeValues() []ProtocolType { + return []ProtocolType{ProtocolTypeAh, ProtocolTypeAll, ProtocolTypeDoNotUse, ProtocolTypeEsp, ProtocolTypeGre, ProtocolTypeIcmp, ProtocolTypeTCP, ProtocolTypeUDP, ProtocolTypeVxlan} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// PublicIPAddressMigrationPhase enumerates the values for public ip address migration phase. +type PublicIPAddressMigrationPhase string + +const ( + // PublicIPAddressMigrationPhaseAbort ... + PublicIPAddressMigrationPhaseAbort PublicIPAddressMigrationPhase = "Abort" + // PublicIPAddressMigrationPhaseCommit ... + PublicIPAddressMigrationPhaseCommit PublicIPAddressMigrationPhase = "Commit" + // PublicIPAddressMigrationPhaseCommitted ... + PublicIPAddressMigrationPhaseCommitted PublicIPAddressMigrationPhase = "Committed" + // PublicIPAddressMigrationPhaseNone ... + PublicIPAddressMigrationPhaseNone PublicIPAddressMigrationPhase = "None" + // PublicIPAddressMigrationPhasePrepare ... + PublicIPAddressMigrationPhasePrepare PublicIPAddressMigrationPhase = "Prepare" +) + +// PossiblePublicIPAddressMigrationPhaseValues returns an array of possible values for the PublicIPAddressMigrationPhase const type. +func PossiblePublicIPAddressMigrationPhaseValues() []PublicIPAddressMigrationPhase { + return []PublicIPAddressMigrationPhase{PublicIPAddressMigrationPhaseAbort, PublicIPAddressMigrationPhaseCommit, PublicIPAddressMigrationPhaseCommitted, PublicIPAddressMigrationPhaseNone, PublicIPAddressMigrationPhasePrepare} +} + +// PublicIPAddressSkuName enumerates the values for public ip address sku name. +type PublicIPAddressSkuName string + +const ( + // PublicIPAddressSkuNameBasic ... + PublicIPAddressSkuNameBasic PublicIPAddressSkuName = "Basic" + // PublicIPAddressSkuNameStandard ... + PublicIPAddressSkuNameStandard PublicIPAddressSkuName = "Standard" +) + +// PossiblePublicIPAddressSkuNameValues returns an array of possible values for the PublicIPAddressSkuName const type. +func PossiblePublicIPAddressSkuNameValues() []PublicIPAddressSkuName { + return []PublicIPAddressSkuName{PublicIPAddressSkuNameBasic, PublicIPAddressSkuNameStandard} +} + +// PublicIPAddressSkuTier enumerates the values for public ip address sku tier. +type PublicIPAddressSkuTier string + +const ( + // PublicIPAddressSkuTierGlobal ... + PublicIPAddressSkuTierGlobal PublicIPAddressSkuTier = "Global" + // PublicIPAddressSkuTierRegional ... + PublicIPAddressSkuTierRegional PublicIPAddressSkuTier = "Regional" +) + +// PossiblePublicIPAddressSkuTierValues returns an array of possible values for the PublicIPAddressSkuTier const type. +func PossiblePublicIPAddressSkuTierValues() []PublicIPAddressSkuTier { + return []PublicIPAddressSkuTier{PublicIPAddressSkuTierGlobal, PublicIPAddressSkuTierRegional} +} + +// PublicIPPrefixSkuName enumerates the values for public ip prefix sku name. +type PublicIPPrefixSkuName string + +const ( + // PublicIPPrefixSkuNameStandard ... + PublicIPPrefixSkuNameStandard PublicIPPrefixSkuName = "Standard" +) + +// PossiblePublicIPPrefixSkuNameValues returns an array of possible values for the PublicIPPrefixSkuName const type. +func PossiblePublicIPPrefixSkuNameValues() []PublicIPPrefixSkuName { + return []PublicIPPrefixSkuName{PublicIPPrefixSkuNameStandard} +} + +// PublicIPPrefixSkuTier enumerates the values for public ip prefix sku tier. +type PublicIPPrefixSkuTier string + +const ( + // PublicIPPrefixSkuTierGlobal ... + PublicIPPrefixSkuTierGlobal PublicIPPrefixSkuTier = "Global" + // PublicIPPrefixSkuTierRegional ... + PublicIPPrefixSkuTierRegional PublicIPPrefixSkuTier = "Regional" +) + +// PossiblePublicIPPrefixSkuTierValues returns an array of possible values for the PublicIPPrefixSkuTier const type. +func PossiblePublicIPPrefixSkuTierValues() []PublicIPPrefixSkuTier { + return []PublicIPPrefixSkuTier{PublicIPPrefixSkuTierGlobal, PublicIPPrefixSkuTierRegional} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeNone ... + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeSystemAssigned ... + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + // ResourceIdentityTypeSystemAssignedUserAssigned ... + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + // ResourceIdentityTypeUserAssigned ... + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} +} + +// RouteMapActionType enumerates the values for route map action type. +type RouteMapActionType string + +const ( + // RouteMapActionTypeAdd ... + RouteMapActionTypeAdd RouteMapActionType = "Add" + // RouteMapActionTypeDrop ... + RouteMapActionTypeDrop RouteMapActionType = "Drop" + // RouteMapActionTypeRemove ... + RouteMapActionTypeRemove RouteMapActionType = "Remove" + // RouteMapActionTypeReplace ... + RouteMapActionTypeReplace RouteMapActionType = "Replace" + // RouteMapActionTypeUnknown ... + RouteMapActionTypeUnknown RouteMapActionType = "Unknown" +) + +// PossibleRouteMapActionTypeValues returns an array of possible values for the RouteMapActionType const type. +func PossibleRouteMapActionTypeValues() []RouteMapActionType { + return []RouteMapActionType{RouteMapActionTypeAdd, RouteMapActionTypeDrop, RouteMapActionTypeRemove, RouteMapActionTypeReplace, RouteMapActionTypeUnknown} +} + +// RouteMapMatchCondition enumerates the values for route map match condition. +type RouteMapMatchCondition string + +const ( + // RouteMapMatchConditionContains ... + RouteMapMatchConditionContains RouteMapMatchCondition = "Contains" + // RouteMapMatchConditionEquals ... + RouteMapMatchConditionEquals RouteMapMatchCondition = "Equals" + // RouteMapMatchConditionNotContains ... + RouteMapMatchConditionNotContains RouteMapMatchCondition = "NotContains" + // RouteMapMatchConditionNotEquals ... + RouteMapMatchConditionNotEquals RouteMapMatchCondition = "NotEquals" + // RouteMapMatchConditionUnknown ... + RouteMapMatchConditionUnknown RouteMapMatchCondition = "Unknown" +) + +// PossibleRouteMapMatchConditionValues returns an array of possible values for the RouteMapMatchCondition const type. +func PossibleRouteMapMatchConditionValues() []RouteMapMatchCondition { + return []RouteMapMatchCondition{RouteMapMatchConditionContains, RouteMapMatchConditionEquals, RouteMapMatchConditionNotContains, RouteMapMatchConditionNotEquals, RouteMapMatchConditionUnknown} +} + +// RouteNextHopType enumerates the values for route next hop type. +type RouteNextHopType string + +const ( + // RouteNextHopTypeInternet ... + RouteNextHopTypeInternet RouteNextHopType = "Internet" + // RouteNextHopTypeNone ... + RouteNextHopTypeNone RouteNextHopType = "None" + // RouteNextHopTypeVirtualAppliance ... + RouteNextHopTypeVirtualAppliance RouteNextHopType = "VirtualAppliance" + // RouteNextHopTypeVirtualNetworkGateway ... + RouteNextHopTypeVirtualNetworkGateway RouteNextHopType = "VirtualNetworkGateway" + // RouteNextHopTypeVnetLocal ... + RouteNextHopTypeVnetLocal RouteNextHopType = "VnetLocal" +) + +// PossibleRouteNextHopTypeValues returns an array of possible values for the RouteNextHopType const type. +func PossibleRouteNextHopTypeValues() []RouteNextHopType { + return []RouteNextHopType{RouteNextHopTypeInternet, RouteNextHopTypeNone, RouteNextHopTypeVirtualAppliance, RouteNextHopTypeVirtualNetworkGateway, RouteNextHopTypeVnetLocal} +} + +// RoutingState enumerates the values for routing state. +type RoutingState string + +const ( + // RoutingStateFailed ... + RoutingStateFailed RoutingState = "Failed" + // RoutingStateNone ... + RoutingStateNone RoutingState = "None" + // RoutingStateProvisioned ... + RoutingStateProvisioned RoutingState = "Provisioned" + // RoutingStateProvisioning ... + RoutingStateProvisioning RoutingState = "Provisioning" +) + +// PossibleRoutingStateValues returns an array of possible values for the RoutingState const type. +func PossibleRoutingStateValues() []RoutingState { + return []RoutingState{RoutingStateFailed, RoutingStateNone, RoutingStateProvisioned, RoutingStateProvisioning} +} + +// RuleCollectionType enumerates the values for rule collection type. +type RuleCollectionType string + +const ( + // RuleCollectionTypeFirewallPolicyFilterRuleCollection ... + RuleCollectionTypeFirewallPolicyFilterRuleCollection RuleCollectionType = "FirewallPolicyFilterRuleCollection" + // RuleCollectionTypeFirewallPolicyNatRuleCollection ... + RuleCollectionTypeFirewallPolicyNatRuleCollection RuleCollectionType = "FirewallPolicyNatRuleCollection" + // RuleCollectionTypeFirewallPolicyRuleCollection ... + RuleCollectionTypeFirewallPolicyRuleCollection RuleCollectionType = "FirewallPolicyRuleCollection" +) + +// PossibleRuleCollectionTypeValues returns an array of possible values for the RuleCollectionType const type. +func PossibleRuleCollectionTypeValues() []RuleCollectionType { + return []RuleCollectionType{RuleCollectionTypeFirewallPolicyFilterRuleCollection, RuleCollectionTypeFirewallPolicyNatRuleCollection, RuleCollectionTypeFirewallPolicyRuleCollection} +} + +// RuleType enumerates the values for rule type. +type RuleType string + +const ( + // RuleTypeApplicationRule ... + RuleTypeApplicationRule RuleType = "ApplicationRule" + // RuleTypeFirewallPolicyRule ... + RuleTypeFirewallPolicyRule RuleType = "FirewallPolicyRule" + // RuleTypeNatRule ... + RuleTypeNatRule RuleType = "NatRule" + // RuleTypeNetworkRule ... + RuleTypeNetworkRule RuleType = "NetworkRule" +) + +// PossibleRuleTypeValues returns an array of possible values for the RuleType const type. +func PossibleRuleTypeValues() []RuleType { + return []RuleType{RuleTypeApplicationRule, RuleTypeFirewallPolicyRule, RuleTypeNatRule, RuleTypeNetworkRule} +} + +// ScopeConnectionState enumerates the values for scope connection state. +type ScopeConnectionState string + +const ( + // ScopeConnectionStateConflict ... + ScopeConnectionStateConflict ScopeConnectionState = "Conflict" + // ScopeConnectionStateConnected ... + ScopeConnectionStateConnected ScopeConnectionState = "Connected" + // ScopeConnectionStatePending ... + ScopeConnectionStatePending ScopeConnectionState = "Pending" + // ScopeConnectionStateRejected ... + ScopeConnectionStateRejected ScopeConnectionState = "Rejected" + // ScopeConnectionStateRevoked ... + ScopeConnectionStateRevoked ScopeConnectionState = "Revoked" +) + +// PossibleScopeConnectionStateValues returns an array of possible values for the ScopeConnectionState const type. +func PossibleScopeConnectionStateValues() []ScopeConnectionState { + return []ScopeConnectionState{ScopeConnectionStateConflict, ScopeConnectionStateConnected, ScopeConnectionStatePending, ScopeConnectionStateRejected, ScopeConnectionStateRevoked} +} + +// SecurityConfigurationRuleAccess enumerates the values for security configuration rule access. +type SecurityConfigurationRuleAccess string + +const ( + // SecurityConfigurationRuleAccessAllow ... + SecurityConfigurationRuleAccessAllow SecurityConfigurationRuleAccess = "Allow" + // SecurityConfigurationRuleAccessAlwaysAllow ... + SecurityConfigurationRuleAccessAlwaysAllow SecurityConfigurationRuleAccess = "AlwaysAllow" + // SecurityConfigurationRuleAccessDeny ... + SecurityConfigurationRuleAccessDeny SecurityConfigurationRuleAccess = "Deny" +) + +// PossibleSecurityConfigurationRuleAccessValues returns an array of possible values for the SecurityConfigurationRuleAccess const type. +func PossibleSecurityConfigurationRuleAccessValues() []SecurityConfigurationRuleAccess { + return []SecurityConfigurationRuleAccess{SecurityConfigurationRuleAccessAllow, SecurityConfigurationRuleAccessAlwaysAllow, SecurityConfigurationRuleAccessDeny} +} + +// SecurityConfigurationRuleDirection enumerates the values for security configuration rule direction. +type SecurityConfigurationRuleDirection string + +const ( + // SecurityConfigurationRuleDirectionInbound ... + SecurityConfigurationRuleDirectionInbound SecurityConfigurationRuleDirection = "Inbound" + // SecurityConfigurationRuleDirectionOutbound ... + SecurityConfigurationRuleDirectionOutbound SecurityConfigurationRuleDirection = "Outbound" +) + +// PossibleSecurityConfigurationRuleDirectionValues returns an array of possible values for the SecurityConfigurationRuleDirection const type. +func PossibleSecurityConfigurationRuleDirectionValues() []SecurityConfigurationRuleDirection { + return []SecurityConfigurationRuleDirection{SecurityConfigurationRuleDirectionInbound, SecurityConfigurationRuleDirectionOutbound} +} + +// SecurityConfigurationRuleProtocol enumerates the values for security configuration rule protocol. +type SecurityConfigurationRuleProtocol string + +const ( + // SecurityConfigurationRuleProtocolAh ... + SecurityConfigurationRuleProtocolAh SecurityConfigurationRuleProtocol = "Ah" + // SecurityConfigurationRuleProtocolAny ... + SecurityConfigurationRuleProtocolAny SecurityConfigurationRuleProtocol = "Any" + // SecurityConfigurationRuleProtocolEsp ... + SecurityConfigurationRuleProtocolEsp SecurityConfigurationRuleProtocol = "Esp" + // SecurityConfigurationRuleProtocolIcmp ... + SecurityConfigurationRuleProtocolIcmp SecurityConfigurationRuleProtocol = "Icmp" + // SecurityConfigurationRuleProtocolTCP ... + SecurityConfigurationRuleProtocolTCP SecurityConfigurationRuleProtocol = "Tcp" + // SecurityConfigurationRuleProtocolUDP ... + SecurityConfigurationRuleProtocolUDP SecurityConfigurationRuleProtocol = "Udp" +) + +// PossibleSecurityConfigurationRuleProtocolValues returns an array of possible values for the SecurityConfigurationRuleProtocol const type. +func PossibleSecurityConfigurationRuleProtocolValues() []SecurityConfigurationRuleProtocol { + return []SecurityConfigurationRuleProtocol{SecurityConfigurationRuleProtocolAh, SecurityConfigurationRuleProtocolAny, SecurityConfigurationRuleProtocolEsp, SecurityConfigurationRuleProtocolIcmp, SecurityConfigurationRuleProtocolTCP, SecurityConfigurationRuleProtocolUDP} +} + +// SecurityPartnerProviderConnectionStatus enumerates the values for security partner provider connection +// status. +type SecurityPartnerProviderConnectionStatus string + +const ( + // SecurityPartnerProviderConnectionStatusConnected ... + SecurityPartnerProviderConnectionStatusConnected SecurityPartnerProviderConnectionStatus = "Connected" + // SecurityPartnerProviderConnectionStatusNotConnected ... + SecurityPartnerProviderConnectionStatusNotConnected SecurityPartnerProviderConnectionStatus = "NotConnected" + // SecurityPartnerProviderConnectionStatusPartiallyConnected ... + SecurityPartnerProviderConnectionStatusPartiallyConnected SecurityPartnerProviderConnectionStatus = "PartiallyConnected" + // SecurityPartnerProviderConnectionStatusUnknown ... + SecurityPartnerProviderConnectionStatusUnknown SecurityPartnerProviderConnectionStatus = "Unknown" +) + +// PossibleSecurityPartnerProviderConnectionStatusValues returns an array of possible values for the SecurityPartnerProviderConnectionStatus const type. +func PossibleSecurityPartnerProviderConnectionStatusValues() []SecurityPartnerProviderConnectionStatus { + return []SecurityPartnerProviderConnectionStatus{SecurityPartnerProviderConnectionStatusConnected, SecurityPartnerProviderConnectionStatusNotConnected, SecurityPartnerProviderConnectionStatusPartiallyConnected, SecurityPartnerProviderConnectionStatusUnknown} +} + +// SecurityProviderName enumerates the values for security provider name. +type SecurityProviderName string + +const ( + // SecurityProviderNameCheckpoint ... + SecurityProviderNameCheckpoint SecurityProviderName = "Checkpoint" + // SecurityProviderNameIBoss ... + SecurityProviderNameIBoss SecurityProviderName = "IBoss" + // SecurityProviderNameZScaler ... + SecurityProviderNameZScaler SecurityProviderName = "ZScaler" +) + +// PossibleSecurityProviderNameValues returns an array of possible values for the SecurityProviderName const type. +func PossibleSecurityProviderNameValues() []SecurityProviderName { + return []SecurityProviderName{SecurityProviderNameCheckpoint, SecurityProviderNameIBoss, SecurityProviderNameZScaler} +} + +// SecurityRuleAccess enumerates the values for security rule access. +type SecurityRuleAccess string + +const ( + // SecurityRuleAccessAllow ... + SecurityRuleAccessAllow SecurityRuleAccess = "Allow" + // SecurityRuleAccessDeny ... + SecurityRuleAccessDeny SecurityRuleAccess = "Deny" +) + +// PossibleSecurityRuleAccessValues returns an array of possible values for the SecurityRuleAccess const type. +func PossibleSecurityRuleAccessValues() []SecurityRuleAccess { + return []SecurityRuleAccess{SecurityRuleAccessAllow, SecurityRuleAccessDeny} +} + +// SecurityRuleDirection enumerates the values for security rule direction. +type SecurityRuleDirection string + +const ( + // SecurityRuleDirectionInbound ... + SecurityRuleDirectionInbound SecurityRuleDirection = "Inbound" + // SecurityRuleDirectionOutbound ... + SecurityRuleDirectionOutbound SecurityRuleDirection = "Outbound" +) + +// PossibleSecurityRuleDirectionValues returns an array of possible values for the SecurityRuleDirection const type. +func PossibleSecurityRuleDirectionValues() []SecurityRuleDirection { + return []SecurityRuleDirection{SecurityRuleDirectionInbound, SecurityRuleDirectionOutbound} +} + +// SecurityRuleProtocol enumerates the values for security rule protocol. +type SecurityRuleProtocol string + +const ( + // SecurityRuleProtocolAh ... + SecurityRuleProtocolAh SecurityRuleProtocol = "Ah" + // SecurityRuleProtocolAsterisk ... + SecurityRuleProtocolAsterisk SecurityRuleProtocol = "*" + // SecurityRuleProtocolEsp ... + SecurityRuleProtocolEsp SecurityRuleProtocol = "Esp" + // SecurityRuleProtocolIcmp ... + SecurityRuleProtocolIcmp SecurityRuleProtocol = "Icmp" + // SecurityRuleProtocolTCP ... + SecurityRuleProtocolTCP SecurityRuleProtocol = "Tcp" + // SecurityRuleProtocolUDP ... + SecurityRuleProtocolUDP SecurityRuleProtocol = "Udp" +) + +// PossibleSecurityRuleProtocolValues returns an array of possible values for the SecurityRuleProtocol const type. +func PossibleSecurityRuleProtocolValues() []SecurityRuleProtocol { + return []SecurityRuleProtocol{SecurityRuleProtocolAh, SecurityRuleProtocolAsterisk, SecurityRuleProtocolEsp, SecurityRuleProtocolIcmp, SecurityRuleProtocolTCP, SecurityRuleProtocolUDP} +} + +// ServiceProviderProvisioningState enumerates the values for service provider provisioning state. +type ServiceProviderProvisioningState string + +const ( + // ServiceProviderProvisioningStateDeprovisioning ... + ServiceProviderProvisioningStateDeprovisioning ServiceProviderProvisioningState = "Deprovisioning" + // ServiceProviderProvisioningStateNotProvisioned ... + ServiceProviderProvisioningStateNotProvisioned ServiceProviderProvisioningState = "NotProvisioned" + // ServiceProviderProvisioningStateProvisioned ... + ServiceProviderProvisioningStateProvisioned ServiceProviderProvisioningState = "Provisioned" + // ServiceProviderProvisioningStateProvisioning ... + ServiceProviderProvisioningStateProvisioning ServiceProviderProvisioningState = "Provisioning" +) + +// PossibleServiceProviderProvisioningStateValues returns an array of possible values for the ServiceProviderProvisioningState const type. +func PossibleServiceProviderProvisioningStateValues() []ServiceProviderProvisioningState { + return []ServiceProviderProvisioningState{ServiceProviderProvisioningStateDeprovisioning, ServiceProviderProvisioningStateNotProvisioned, ServiceProviderProvisioningStateProvisioned, ServiceProviderProvisioningStateProvisioning} +} + +// Severity enumerates the values for severity. +type Severity string + +const ( + // SeverityError ... + SeverityError Severity = "Error" + // SeverityWarning ... + SeverityWarning Severity = "Warning" +) + +// PossibleSeverityValues returns an array of possible values for the Severity const type. +func PossibleSeverityValues() []Severity { + return []Severity{SeverityError, SeverityWarning} +} + +// SlotType enumerates the values for slot type. +type SlotType string + +const ( + // SlotTypeProduction ... + SlotTypeProduction SlotType = "Production" + // SlotTypeStaging ... + SlotTypeStaging SlotType = "Staging" +) + +// PossibleSlotTypeValues returns an array of possible values for the SlotType const type. +func PossibleSlotTypeValues() []SlotType { + return []SlotType{SlotTypeProduction, SlotTypeStaging} +} + +// SyncRemoteAddressSpace enumerates the values for sync remote address space. +type SyncRemoteAddressSpace string + +const ( + // SyncRemoteAddressSpaceTrue ... + SyncRemoteAddressSpaceTrue SyncRemoteAddressSpace = "true" +) + +// PossibleSyncRemoteAddressSpaceValues returns an array of possible values for the SyncRemoteAddressSpace const type. +func PossibleSyncRemoteAddressSpaceValues() []SyncRemoteAddressSpace { + return []SyncRemoteAddressSpace{SyncRemoteAddressSpaceTrue} +} + +// TransportProtocol enumerates the values for transport protocol. +type TransportProtocol string + +const ( + // TransportProtocolAll ... + TransportProtocolAll TransportProtocol = "All" + // TransportProtocolTCP ... + TransportProtocolTCP TransportProtocol = "Tcp" + // TransportProtocolUDP ... + TransportProtocolUDP TransportProtocol = "Udp" +) + +// PossibleTransportProtocolValues returns an array of possible values for the TransportProtocol const type. +func PossibleTransportProtocolValues() []TransportProtocol { + return []TransportProtocol{TransportProtocolAll, TransportProtocolTCP, TransportProtocolUDP} +} + +// TunnelConnectionStatus enumerates the values for tunnel connection status. +type TunnelConnectionStatus string + +const ( + // TunnelConnectionStatusConnected ... + TunnelConnectionStatusConnected TunnelConnectionStatus = "Connected" + // TunnelConnectionStatusConnecting ... + TunnelConnectionStatusConnecting TunnelConnectionStatus = "Connecting" + // TunnelConnectionStatusNotConnected ... + TunnelConnectionStatusNotConnected TunnelConnectionStatus = "NotConnected" + // TunnelConnectionStatusUnknown ... + TunnelConnectionStatusUnknown TunnelConnectionStatus = "Unknown" +) + +// PossibleTunnelConnectionStatusValues returns an array of possible values for the TunnelConnectionStatus const type. +func PossibleTunnelConnectionStatusValues() []TunnelConnectionStatus { + return []TunnelConnectionStatus{TunnelConnectionStatusConnected, TunnelConnectionStatusConnecting, TunnelConnectionStatusNotConnected, TunnelConnectionStatusUnknown} +} + +// UseHubGateway enumerates the values for use hub gateway. +type UseHubGateway string + +const ( + // UseHubGatewayFalse ... + UseHubGatewayFalse UseHubGateway = "False" + // UseHubGatewayTrue ... + UseHubGatewayTrue UseHubGateway = "True" +) + +// PossibleUseHubGatewayValues returns an array of possible values for the UseHubGateway const type. +func PossibleUseHubGatewayValues() []UseHubGateway { + return []UseHubGateway{UseHubGatewayFalse, UseHubGatewayTrue} +} + +// VerbosityLevel enumerates the values for verbosity level. +type VerbosityLevel string + +const ( + // VerbosityLevelFull ... + VerbosityLevelFull VerbosityLevel = "Full" + // VerbosityLevelMinimum ... + VerbosityLevelMinimum VerbosityLevel = "Minimum" + // VerbosityLevelNormal ... + VerbosityLevelNormal VerbosityLevel = "Normal" +) + +// PossibleVerbosityLevelValues returns an array of possible values for the VerbosityLevel const type. +func PossibleVerbosityLevelValues() []VerbosityLevel { + return []VerbosityLevel{VerbosityLevelFull, VerbosityLevelMinimum, VerbosityLevelNormal} +} + +// VirtualNetworkEncryptionEnforcement enumerates the values for virtual network encryption enforcement. +type VirtualNetworkEncryptionEnforcement string + +const ( + // VirtualNetworkEncryptionEnforcementAllowUnencrypted ... + VirtualNetworkEncryptionEnforcementAllowUnencrypted VirtualNetworkEncryptionEnforcement = "AllowUnencrypted" + // VirtualNetworkEncryptionEnforcementDropUnencrypted ... + VirtualNetworkEncryptionEnforcementDropUnencrypted VirtualNetworkEncryptionEnforcement = "DropUnencrypted" +) + +// PossibleVirtualNetworkEncryptionEnforcementValues returns an array of possible values for the VirtualNetworkEncryptionEnforcement const type. +func PossibleVirtualNetworkEncryptionEnforcementValues() []VirtualNetworkEncryptionEnforcement { + return []VirtualNetworkEncryptionEnforcement{VirtualNetworkEncryptionEnforcementAllowUnencrypted, VirtualNetworkEncryptionEnforcementDropUnencrypted} +} + +// VirtualNetworkGatewayConnectionMode enumerates the values for virtual network gateway connection mode. +type VirtualNetworkGatewayConnectionMode string + +const ( + // VirtualNetworkGatewayConnectionModeDefault ... + VirtualNetworkGatewayConnectionModeDefault VirtualNetworkGatewayConnectionMode = "Default" + // VirtualNetworkGatewayConnectionModeInitiatorOnly ... + VirtualNetworkGatewayConnectionModeInitiatorOnly VirtualNetworkGatewayConnectionMode = "InitiatorOnly" + // VirtualNetworkGatewayConnectionModeResponderOnly ... + VirtualNetworkGatewayConnectionModeResponderOnly VirtualNetworkGatewayConnectionMode = "ResponderOnly" +) + +// PossibleVirtualNetworkGatewayConnectionModeValues returns an array of possible values for the VirtualNetworkGatewayConnectionMode const type. +func PossibleVirtualNetworkGatewayConnectionModeValues() []VirtualNetworkGatewayConnectionMode { + return []VirtualNetworkGatewayConnectionMode{VirtualNetworkGatewayConnectionModeDefault, VirtualNetworkGatewayConnectionModeInitiatorOnly, VirtualNetworkGatewayConnectionModeResponderOnly} +} + +// VirtualNetworkGatewayConnectionProtocol enumerates the values for virtual network gateway connection +// protocol. +type VirtualNetworkGatewayConnectionProtocol string + +const ( + // VirtualNetworkGatewayConnectionProtocolIKEv1 ... + VirtualNetworkGatewayConnectionProtocolIKEv1 VirtualNetworkGatewayConnectionProtocol = "IKEv1" + // VirtualNetworkGatewayConnectionProtocolIKEv2 ... + VirtualNetworkGatewayConnectionProtocolIKEv2 VirtualNetworkGatewayConnectionProtocol = "IKEv2" +) + +// PossibleVirtualNetworkGatewayConnectionProtocolValues returns an array of possible values for the VirtualNetworkGatewayConnectionProtocol const type. +func PossibleVirtualNetworkGatewayConnectionProtocolValues() []VirtualNetworkGatewayConnectionProtocol { + return []VirtualNetworkGatewayConnectionProtocol{VirtualNetworkGatewayConnectionProtocolIKEv1, VirtualNetworkGatewayConnectionProtocolIKEv2} +} + +// VirtualNetworkGatewayConnectionStatus enumerates the values for virtual network gateway connection status. +type VirtualNetworkGatewayConnectionStatus string + +const ( + // VirtualNetworkGatewayConnectionStatusConnected ... + VirtualNetworkGatewayConnectionStatusConnected VirtualNetworkGatewayConnectionStatus = "Connected" + // VirtualNetworkGatewayConnectionStatusConnecting ... + VirtualNetworkGatewayConnectionStatusConnecting VirtualNetworkGatewayConnectionStatus = "Connecting" + // VirtualNetworkGatewayConnectionStatusNotConnected ... + VirtualNetworkGatewayConnectionStatusNotConnected VirtualNetworkGatewayConnectionStatus = "NotConnected" + // VirtualNetworkGatewayConnectionStatusUnknown ... + VirtualNetworkGatewayConnectionStatusUnknown VirtualNetworkGatewayConnectionStatus = "Unknown" +) + +// PossibleVirtualNetworkGatewayConnectionStatusValues returns an array of possible values for the VirtualNetworkGatewayConnectionStatus const type. +func PossibleVirtualNetworkGatewayConnectionStatusValues() []VirtualNetworkGatewayConnectionStatus { + return []VirtualNetworkGatewayConnectionStatus{VirtualNetworkGatewayConnectionStatusConnected, VirtualNetworkGatewayConnectionStatusConnecting, VirtualNetworkGatewayConnectionStatusNotConnected, VirtualNetworkGatewayConnectionStatusUnknown} +} + +// VirtualNetworkGatewayConnectionType enumerates the values for virtual network gateway connection type. +type VirtualNetworkGatewayConnectionType string + +const ( + // VirtualNetworkGatewayConnectionTypeExpressRoute ... + VirtualNetworkGatewayConnectionTypeExpressRoute VirtualNetworkGatewayConnectionType = "ExpressRoute" + // VirtualNetworkGatewayConnectionTypeIPsec ... + VirtualNetworkGatewayConnectionTypeIPsec VirtualNetworkGatewayConnectionType = "IPsec" + // VirtualNetworkGatewayConnectionTypeVPNClient ... + VirtualNetworkGatewayConnectionTypeVPNClient VirtualNetworkGatewayConnectionType = "VPNClient" + // VirtualNetworkGatewayConnectionTypeVnet2Vnet ... + VirtualNetworkGatewayConnectionTypeVnet2Vnet VirtualNetworkGatewayConnectionType = "Vnet2Vnet" +) + +// PossibleVirtualNetworkGatewayConnectionTypeValues returns an array of possible values for the VirtualNetworkGatewayConnectionType const type. +func PossibleVirtualNetworkGatewayConnectionTypeValues() []VirtualNetworkGatewayConnectionType { + return []VirtualNetworkGatewayConnectionType{VirtualNetworkGatewayConnectionTypeExpressRoute, VirtualNetworkGatewayConnectionTypeIPsec, VirtualNetworkGatewayConnectionTypeVPNClient, VirtualNetworkGatewayConnectionTypeVnet2Vnet} +} + +// VirtualNetworkGatewaySkuName enumerates the values for virtual network gateway sku name. +type VirtualNetworkGatewaySkuName string + +const ( + // VirtualNetworkGatewaySkuNameBasic ... + VirtualNetworkGatewaySkuNameBasic VirtualNetworkGatewaySkuName = "Basic" + // VirtualNetworkGatewaySkuNameErGw1AZ ... + VirtualNetworkGatewaySkuNameErGw1AZ VirtualNetworkGatewaySkuName = "ErGw1AZ" + // VirtualNetworkGatewaySkuNameErGw2AZ ... + VirtualNetworkGatewaySkuNameErGw2AZ VirtualNetworkGatewaySkuName = "ErGw2AZ" + // VirtualNetworkGatewaySkuNameErGw3AZ ... + VirtualNetworkGatewaySkuNameErGw3AZ VirtualNetworkGatewaySkuName = "ErGw3AZ" + // VirtualNetworkGatewaySkuNameHighPerformance ... + VirtualNetworkGatewaySkuNameHighPerformance VirtualNetworkGatewaySkuName = "HighPerformance" + // VirtualNetworkGatewaySkuNameStandard ... + VirtualNetworkGatewaySkuNameStandard VirtualNetworkGatewaySkuName = "Standard" + // VirtualNetworkGatewaySkuNameUltraPerformance ... + VirtualNetworkGatewaySkuNameUltraPerformance VirtualNetworkGatewaySkuName = "UltraPerformance" + // VirtualNetworkGatewaySkuNameVpnGw1 ... + VirtualNetworkGatewaySkuNameVpnGw1 VirtualNetworkGatewaySkuName = "VpnGw1" + // VirtualNetworkGatewaySkuNameVpnGw1AZ ... + VirtualNetworkGatewaySkuNameVpnGw1AZ VirtualNetworkGatewaySkuName = "VpnGw1AZ" + // VirtualNetworkGatewaySkuNameVpnGw2 ... + VirtualNetworkGatewaySkuNameVpnGw2 VirtualNetworkGatewaySkuName = "VpnGw2" + // VirtualNetworkGatewaySkuNameVpnGw2AZ ... + VirtualNetworkGatewaySkuNameVpnGw2AZ VirtualNetworkGatewaySkuName = "VpnGw2AZ" + // VirtualNetworkGatewaySkuNameVpnGw3 ... + VirtualNetworkGatewaySkuNameVpnGw3 VirtualNetworkGatewaySkuName = "VpnGw3" + // VirtualNetworkGatewaySkuNameVpnGw3AZ ... + VirtualNetworkGatewaySkuNameVpnGw3AZ VirtualNetworkGatewaySkuName = "VpnGw3AZ" + // VirtualNetworkGatewaySkuNameVpnGw4 ... + VirtualNetworkGatewaySkuNameVpnGw4 VirtualNetworkGatewaySkuName = "VpnGw4" + // VirtualNetworkGatewaySkuNameVpnGw4AZ ... + VirtualNetworkGatewaySkuNameVpnGw4AZ VirtualNetworkGatewaySkuName = "VpnGw4AZ" + // VirtualNetworkGatewaySkuNameVpnGw5 ... + VirtualNetworkGatewaySkuNameVpnGw5 VirtualNetworkGatewaySkuName = "VpnGw5" + // VirtualNetworkGatewaySkuNameVpnGw5AZ ... + VirtualNetworkGatewaySkuNameVpnGw5AZ VirtualNetworkGatewaySkuName = "VpnGw5AZ" +) + +// PossibleVirtualNetworkGatewaySkuNameValues returns an array of possible values for the VirtualNetworkGatewaySkuName const type. +func PossibleVirtualNetworkGatewaySkuNameValues() []VirtualNetworkGatewaySkuName { + return []VirtualNetworkGatewaySkuName{VirtualNetworkGatewaySkuNameBasic, VirtualNetworkGatewaySkuNameErGw1AZ, VirtualNetworkGatewaySkuNameErGw2AZ, VirtualNetworkGatewaySkuNameErGw3AZ, VirtualNetworkGatewaySkuNameHighPerformance, VirtualNetworkGatewaySkuNameStandard, VirtualNetworkGatewaySkuNameUltraPerformance, VirtualNetworkGatewaySkuNameVpnGw1, VirtualNetworkGatewaySkuNameVpnGw1AZ, VirtualNetworkGatewaySkuNameVpnGw2, VirtualNetworkGatewaySkuNameVpnGw2AZ, VirtualNetworkGatewaySkuNameVpnGw3, VirtualNetworkGatewaySkuNameVpnGw3AZ, VirtualNetworkGatewaySkuNameVpnGw4, VirtualNetworkGatewaySkuNameVpnGw4AZ, VirtualNetworkGatewaySkuNameVpnGw5, VirtualNetworkGatewaySkuNameVpnGw5AZ} +} + +// VirtualNetworkGatewaySkuTier enumerates the values for virtual network gateway sku tier. +type VirtualNetworkGatewaySkuTier string + +const ( + // VirtualNetworkGatewaySkuTierBasic ... + VirtualNetworkGatewaySkuTierBasic VirtualNetworkGatewaySkuTier = "Basic" + // VirtualNetworkGatewaySkuTierErGw1AZ ... + VirtualNetworkGatewaySkuTierErGw1AZ VirtualNetworkGatewaySkuTier = "ErGw1AZ" + // VirtualNetworkGatewaySkuTierErGw2AZ ... + VirtualNetworkGatewaySkuTierErGw2AZ VirtualNetworkGatewaySkuTier = "ErGw2AZ" + // VirtualNetworkGatewaySkuTierErGw3AZ ... + VirtualNetworkGatewaySkuTierErGw3AZ VirtualNetworkGatewaySkuTier = "ErGw3AZ" + // VirtualNetworkGatewaySkuTierHighPerformance ... + VirtualNetworkGatewaySkuTierHighPerformance VirtualNetworkGatewaySkuTier = "HighPerformance" + // VirtualNetworkGatewaySkuTierStandard ... + VirtualNetworkGatewaySkuTierStandard VirtualNetworkGatewaySkuTier = "Standard" + // VirtualNetworkGatewaySkuTierUltraPerformance ... + VirtualNetworkGatewaySkuTierUltraPerformance VirtualNetworkGatewaySkuTier = "UltraPerformance" + // VirtualNetworkGatewaySkuTierVpnGw1 ... + VirtualNetworkGatewaySkuTierVpnGw1 VirtualNetworkGatewaySkuTier = "VpnGw1" + // VirtualNetworkGatewaySkuTierVpnGw1AZ ... + VirtualNetworkGatewaySkuTierVpnGw1AZ VirtualNetworkGatewaySkuTier = "VpnGw1AZ" + // VirtualNetworkGatewaySkuTierVpnGw2 ... + VirtualNetworkGatewaySkuTierVpnGw2 VirtualNetworkGatewaySkuTier = "VpnGw2" + // VirtualNetworkGatewaySkuTierVpnGw2AZ ... + VirtualNetworkGatewaySkuTierVpnGw2AZ VirtualNetworkGatewaySkuTier = "VpnGw2AZ" + // VirtualNetworkGatewaySkuTierVpnGw3 ... + VirtualNetworkGatewaySkuTierVpnGw3 VirtualNetworkGatewaySkuTier = "VpnGw3" + // VirtualNetworkGatewaySkuTierVpnGw3AZ ... + VirtualNetworkGatewaySkuTierVpnGw3AZ VirtualNetworkGatewaySkuTier = "VpnGw3AZ" + // VirtualNetworkGatewaySkuTierVpnGw4 ... + VirtualNetworkGatewaySkuTierVpnGw4 VirtualNetworkGatewaySkuTier = "VpnGw4" + // VirtualNetworkGatewaySkuTierVpnGw4AZ ... + VirtualNetworkGatewaySkuTierVpnGw4AZ VirtualNetworkGatewaySkuTier = "VpnGw4AZ" + // VirtualNetworkGatewaySkuTierVpnGw5 ... + VirtualNetworkGatewaySkuTierVpnGw5 VirtualNetworkGatewaySkuTier = "VpnGw5" + // VirtualNetworkGatewaySkuTierVpnGw5AZ ... + VirtualNetworkGatewaySkuTierVpnGw5AZ VirtualNetworkGatewaySkuTier = "VpnGw5AZ" +) + +// PossibleVirtualNetworkGatewaySkuTierValues returns an array of possible values for the VirtualNetworkGatewaySkuTier const type. +func PossibleVirtualNetworkGatewaySkuTierValues() []VirtualNetworkGatewaySkuTier { + return []VirtualNetworkGatewaySkuTier{VirtualNetworkGatewaySkuTierBasic, VirtualNetworkGatewaySkuTierErGw1AZ, VirtualNetworkGatewaySkuTierErGw2AZ, VirtualNetworkGatewaySkuTierErGw3AZ, VirtualNetworkGatewaySkuTierHighPerformance, VirtualNetworkGatewaySkuTierStandard, VirtualNetworkGatewaySkuTierUltraPerformance, VirtualNetworkGatewaySkuTierVpnGw1, VirtualNetworkGatewaySkuTierVpnGw1AZ, VirtualNetworkGatewaySkuTierVpnGw2, VirtualNetworkGatewaySkuTierVpnGw2AZ, VirtualNetworkGatewaySkuTierVpnGw3, VirtualNetworkGatewaySkuTierVpnGw3AZ, VirtualNetworkGatewaySkuTierVpnGw4, VirtualNetworkGatewaySkuTierVpnGw4AZ, VirtualNetworkGatewaySkuTierVpnGw5, VirtualNetworkGatewaySkuTierVpnGw5AZ} +} + +// VirtualNetworkGatewayType enumerates the values for virtual network gateway type. +type VirtualNetworkGatewayType string + +const ( + // VirtualNetworkGatewayTypeExpressRoute ... + VirtualNetworkGatewayTypeExpressRoute VirtualNetworkGatewayType = "ExpressRoute" + // VirtualNetworkGatewayTypeLocalGateway ... + VirtualNetworkGatewayTypeLocalGateway VirtualNetworkGatewayType = "LocalGateway" + // VirtualNetworkGatewayTypeVpn ... + VirtualNetworkGatewayTypeVpn VirtualNetworkGatewayType = "Vpn" +) + +// PossibleVirtualNetworkGatewayTypeValues returns an array of possible values for the VirtualNetworkGatewayType const type. +func PossibleVirtualNetworkGatewayTypeValues() []VirtualNetworkGatewayType { + return []VirtualNetworkGatewayType{VirtualNetworkGatewayTypeExpressRoute, VirtualNetworkGatewayTypeLocalGateway, VirtualNetworkGatewayTypeVpn} +} + +// VirtualNetworkPeeringLevel enumerates the values for virtual network peering level. +type VirtualNetworkPeeringLevel string + +const ( + // VirtualNetworkPeeringLevelFullyInSync ... + VirtualNetworkPeeringLevelFullyInSync VirtualNetworkPeeringLevel = "FullyInSync" + // VirtualNetworkPeeringLevelLocalAndRemoteNotInSync ... + VirtualNetworkPeeringLevelLocalAndRemoteNotInSync VirtualNetworkPeeringLevel = "LocalAndRemoteNotInSync" + // VirtualNetworkPeeringLevelLocalNotInSync ... + VirtualNetworkPeeringLevelLocalNotInSync VirtualNetworkPeeringLevel = "LocalNotInSync" + // VirtualNetworkPeeringLevelRemoteNotInSync ... + VirtualNetworkPeeringLevelRemoteNotInSync VirtualNetworkPeeringLevel = "RemoteNotInSync" +) + +// PossibleVirtualNetworkPeeringLevelValues returns an array of possible values for the VirtualNetworkPeeringLevel const type. +func PossibleVirtualNetworkPeeringLevelValues() []VirtualNetworkPeeringLevel { + return []VirtualNetworkPeeringLevel{VirtualNetworkPeeringLevelFullyInSync, VirtualNetworkPeeringLevelLocalAndRemoteNotInSync, VirtualNetworkPeeringLevelLocalNotInSync, VirtualNetworkPeeringLevelRemoteNotInSync} +} + +// VirtualNetworkPeeringState enumerates the values for virtual network peering state. +type VirtualNetworkPeeringState string + +const ( + // VirtualNetworkPeeringStateConnected ... + VirtualNetworkPeeringStateConnected VirtualNetworkPeeringState = "Connected" + // VirtualNetworkPeeringStateDisconnected ... + VirtualNetworkPeeringStateDisconnected VirtualNetworkPeeringState = "Disconnected" + // VirtualNetworkPeeringStateInitiated ... + VirtualNetworkPeeringStateInitiated VirtualNetworkPeeringState = "Initiated" +) + +// PossibleVirtualNetworkPeeringStateValues returns an array of possible values for the VirtualNetworkPeeringState const type. +func PossibleVirtualNetworkPeeringStateValues() []VirtualNetworkPeeringState { + return []VirtualNetworkPeeringState{VirtualNetworkPeeringStateConnected, VirtualNetworkPeeringStateDisconnected, VirtualNetworkPeeringStateInitiated} +} + +// VirtualNetworkPrivateEndpointNetworkPolicies enumerates the values for virtual network private endpoint +// network policies. +type VirtualNetworkPrivateEndpointNetworkPolicies string + +const ( + // VirtualNetworkPrivateEndpointNetworkPoliciesDisabled ... + VirtualNetworkPrivateEndpointNetworkPoliciesDisabled VirtualNetworkPrivateEndpointNetworkPolicies = "Disabled" + // VirtualNetworkPrivateEndpointNetworkPoliciesEnabled ... + VirtualNetworkPrivateEndpointNetworkPoliciesEnabled VirtualNetworkPrivateEndpointNetworkPolicies = "Enabled" +) + +// PossibleVirtualNetworkPrivateEndpointNetworkPoliciesValues returns an array of possible values for the VirtualNetworkPrivateEndpointNetworkPolicies const type. +func PossibleVirtualNetworkPrivateEndpointNetworkPoliciesValues() []VirtualNetworkPrivateEndpointNetworkPolicies { + return []VirtualNetworkPrivateEndpointNetworkPolicies{VirtualNetworkPrivateEndpointNetworkPoliciesDisabled, VirtualNetworkPrivateEndpointNetworkPoliciesEnabled} +} + +// VirtualNetworkPrivateLinkServiceNetworkPolicies enumerates the values for virtual network private link +// service network policies. +type VirtualNetworkPrivateLinkServiceNetworkPolicies string + +const ( + // VirtualNetworkPrivateLinkServiceNetworkPoliciesDisabled ... + VirtualNetworkPrivateLinkServiceNetworkPoliciesDisabled VirtualNetworkPrivateLinkServiceNetworkPolicies = "Disabled" + // VirtualNetworkPrivateLinkServiceNetworkPoliciesEnabled ... + VirtualNetworkPrivateLinkServiceNetworkPoliciesEnabled VirtualNetworkPrivateLinkServiceNetworkPolicies = "Enabled" +) + +// PossibleVirtualNetworkPrivateLinkServiceNetworkPoliciesValues returns an array of possible values for the VirtualNetworkPrivateLinkServiceNetworkPolicies const type. +func PossibleVirtualNetworkPrivateLinkServiceNetworkPoliciesValues() []VirtualNetworkPrivateLinkServiceNetworkPolicies { + return []VirtualNetworkPrivateLinkServiceNetworkPolicies{VirtualNetworkPrivateLinkServiceNetworkPoliciesDisabled, VirtualNetworkPrivateLinkServiceNetworkPoliciesEnabled} +} + +// VirtualWanSecurityProviderType enumerates the values for virtual wan security provider type. +type VirtualWanSecurityProviderType string + +const ( + // VirtualWanSecurityProviderTypeExternal ... + VirtualWanSecurityProviderTypeExternal VirtualWanSecurityProviderType = "External" + // VirtualWanSecurityProviderTypeNative ... + VirtualWanSecurityProviderTypeNative VirtualWanSecurityProviderType = "Native" +) + +// PossibleVirtualWanSecurityProviderTypeValues returns an array of possible values for the VirtualWanSecurityProviderType const type. +func PossibleVirtualWanSecurityProviderTypeValues() []VirtualWanSecurityProviderType { + return []VirtualWanSecurityProviderType{VirtualWanSecurityProviderTypeExternal, VirtualWanSecurityProviderTypeNative} +} + +// VnetLocalRouteOverrideCriteria enumerates the values for vnet local route override criteria. +type VnetLocalRouteOverrideCriteria string + +const ( + // VnetLocalRouteOverrideCriteriaContains ... + VnetLocalRouteOverrideCriteriaContains VnetLocalRouteOverrideCriteria = "Contains" + // VnetLocalRouteOverrideCriteriaEqual ... + VnetLocalRouteOverrideCriteriaEqual VnetLocalRouteOverrideCriteria = "Equal" +) + +// PossibleVnetLocalRouteOverrideCriteriaValues returns an array of possible values for the VnetLocalRouteOverrideCriteria const type. +func PossibleVnetLocalRouteOverrideCriteriaValues() []VnetLocalRouteOverrideCriteria { + return []VnetLocalRouteOverrideCriteria{VnetLocalRouteOverrideCriteriaContains, VnetLocalRouteOverrideCriteriaEqual} +} + +// VpnAuthenticationType enumerates the values for vpn authentication type. +type VpnAuthenticationType string + +const ( + // VpnAuthenticationTypeAAD ... + VpnAuthenticationTypeAAD VpnAuthenticationType = "AAD" + // VpnAuthenticationTypeCertificate ... + VpnAuthenticationTypeCertificate VpnAuthenticationType = "Certificate" + // VpnAuthenticationTypeRadius ... + VpnAuthenticationTypeRadius VpnAuthenticationType = "Radius" +) + +// PossibleVpnAuthenticationTypeValues returns an array of possible values for the VpnAuthenticationType const type. +func PossibleVpnAuthenticationTypeValues() []VpnAuthenticationType { + return []VpnAuthenticationType{VpnAuthenticationTypeAAD, VpnAuthenticationTypeCertificate, VpnAuthenticationTypeRadius} +} + +// VpnClientProtocol enumerates the values for vpn client protocol. +type VpnClientProtocol string + +const ( + // VpnClientProtocolIkeV2 ... + VpnClientProtocolIkeV2 VpnClientProtocol = "IkeV2" + // VpnClientProtocolOpenVPN ... + VpnClientProtocolOpenVPN VpnClientProtocol = "OpenVPN" + // VpnClientProtocolSSTP ... + VpnClientProtocolSSTP VpnClientProtocol = "SSTP" +) + +// PossibleVpnClientProtocolValues returns an array of possible values for the VpnClientProtocol const type. +func PossibleVpnClientProtocolValues() []VpnClientProtocol { + return []VpnClientProtocol{VpnClientProtocolIkeV2, VpnClientProtocolOpenVPN, VpnClientProtocolSSTP} +} + +// VpnConnectionStatus enumerates the values for vpn connection status. +type VpnConnectionStatus string + +const ( + // VpnConnectionStatusConnected ... + VpnConnectionStatusConnected VpnConnectionStatus = "Connected" + // VpnConnectionStatusConnecting ... + VpnConnectionStatusConnecting VpnConnectionStatus = "Connecting" + // VpnConnectionStatusNotConnected ... + VpnConnectionStatusNotConnected VpnConnectionStatus = "NotConnected" + // VpnConnectionStatusUnknown ... + VpnConnectionStatusUnknown VpnConnectionStatus = "Unknown" +) + +// PossibleVpnConnectionStatusValues returns an array of possible values for the VpnConnectionStatus const type. +func PossibleVpnConnectionStatusValues() []VpnConnectionStatus { + return []VpnConnectionStatus{VpnConnectionStatusConnected, VpnConnectionStatusConnecting, VpnConnectionStatusNotConnected, VpnConnectionStatusUnknown} +} + +// VpnGatewayGeneration enumerates the values for vpn gateway generation. +type VpnGatewayGeneration string + +const ( + // VpnGatewayGenerationGeneration1 ... + VpnGatewayGenerationGeneration1 VpnGatewayGeneration = "Generation1" + // VpnGatewayGenerationGeneration2 ... + VpnGatewayGenerationGeneration2 VpnGatewayGeneration = "Generation2" + // VpnGatewayGenerationNone ... + VpnGatewayGenerationNone VpnGatewayGeneration = "None" +) + +// PossibleVpnGatewayGenerationValues returns an array of possible values for the VpnGatewayGeneration const type. +func PossibleVpnGatewayGenerationValues() []VpnGatewayGeneration { + return []VpnGatewayGeneration{VpnGatewayGenerationGeneration1, VpnGatewayGenerationGeneration2, VpnGatewayGenerationNone} +} + +// VpnGatewayTunnelingProtocol enumerates the values for vpn gateway tunneling protocol. +type VpnGatewayTunnelingProtocol string + +const ( + // VpnGatewayTunnelingProtocolIkeV2 ... + VpnGatewayTunnelingProtocolIkeV2 VpnGatewayTunnelingProtocol = "IkeV2" + // VpnGatewayTunnelingProtocolOpenVPN ... + VpnGatewayTunnelingProtocolOpenVPN VpnGatewayTunnelingProtocol = "OpenVPN" +) + +// PossibleVpnGatewayTunnelingProtocolValues returns an array of possible values for the VpnGatewayTunnelingProtocol const type. +func PossibleVpnGatewayTunnelingProtocolValues() []VpnGatewayTunnelingProtocol { + return []VpnGatewayTunnelingProtocol{VpnGatewayTunnelingProtocolIkeV2, VpnGatewayTunnelingProtocolOpenVPN} +} + +// VpnLinkConnectionMode enumerates the values for vpn link connection mode. +type VpnLinkConnectionMode string + +const ( + // VpnLinkConnectionModeDefault ... + VpnLinkConnectionModeDefault VpnLinkConnectionMode = "Default" + // VpnLinkConnectionModeInitiatorOnly ... + VpnLinkConnectionModeInitiatorOnly VpnLinkConnectionMode = "InitiatorOnly" + // VpnLinkConnectionModeResponderOnly ... + VpnLinkConnectionModeResponderOnly VpnLinkConnectionMode = "ResponderOnly" +) + +// PossibleVpnLinkConnectionModeValues returns an array of possible values for the VpnLinkConnectionMode const type. +func PossibleVpnLinkConnectionModeValues() []VpnLinkConnectionMode { + return []VpnLinkConnectionMode{VpnLinkConnectionModeDefault, VpnLinkConnectionModeInitiatorOnly, VpnLinkConnectionModeResponderOnly} +} + +// VpnNatRuleMode enumerates the values for vpn nat rule mode. +type VpnNatRuleMode string + +const ( + // VpnNatRuleModeEgressSnat ... + VpnNatRuleModeEgressSnat VpnNatRuleMode = "EgressSnat" + // VpnNatRuleModeIngressSnat ... + VpnNatRuleModeIngressSnat VpnNatRuleMode = "IngressSnat" +) + +// PossibleVpnNatRuleModeValues returns an array of possible values for the VpnNatRuleMode const type. +func PossibleVpnNatRuleModeValues() []VpnNatRuleMode { + return []VpnNatRuleMode{VpnNatRuleModeEgressSnat, VpnNatRuleModeIngressSnat} +} + +// VpnNatRuleType enumerates the values for vpn nat rule type. +type VpnNatRuleType string + +const ( + // VpnNatRuleTypeDynamic ... + VpnNatRuleTypeDynamic VpnNatRuleType = "Dynamic" + // VpnNatRuleTypeStatic ... + VpnNatRuleTypeStatic VpnNatRuleType = "Static" +) + +// PossibleVpnNatRuleTypeValues returns an array of possible values for the VpnNatRuleType const type. +func PossibleVpnNatRuleTypeValues() []VpnNatRuleType { + return []VpnNatRuleType{VpnNatRuleTypeDynamic, VpnNatRuleTypeStatic} +} + +// VpnPolicyMemberAttributeType enumerates the values for vpn policy member attribute type. +type VpnPolicyMemberAttributeType string + +const ( + // VpnPolicyMemberAttributeTypeAADGroupID ... + VpnPolicyMemberAttributeTypeAADGroupID VpnPolicyMemberAttributeType = "AADGroupId" + // VpnPolicyMemberAttributeTypeCertificateGroupID ... + VpnPolicyMemberAttributeTypeCertificateGroupID VpnPolicyMemberAttributeType = "CertificateGroupId" + // VpnPolicyMemberAttributeTypeRadiusAzureGroupID ... + VpnPolicyMemberAttributeTypeRadiusAzureGroupID VpnPolicyMemberAttributeType = "RadiusAzureGroupId" +) + +// PossibleVpnPolicyMemberAttributeTypeValues returns an array of possible values for the VpnPolicyMemberAttributeType const type. +func PossibleVpnPolicyMemberAttributeTypeValues() []VpnPolicyMemberAttributeType { + return []VpnPolicyMemberAttributeType{VpnPolicyMemberAttributeTypeAADGroupID, VpnPolicyMemberAttributeTypeCertificateGroupID, VpnPolicyMemberAttributeTypeRadiusAzureGroupID} +} + +// VpnType enumerates the values for vpn type. +type VpnType string + +const ( + // VpnTypePolicyBased ... + VpnTypePolicyBased VpnType = "PolicyBased" + // VpnTypeRouteBased ... + VpnTypeRouteBased VpnType = "RouteBased" +) + +// PossibleVpnTypeValues returns an array of possible values for the VpnType const type. +func PossibleVpnTypeValues() []VpnType { + return []VpnType{VpnTypePolicyBased, VpnTypeRouteBased} +} + +// WebApplicationFirewallAction enumerates the values for web application firewall action. +type WebApplicationFirewallAction string + +const ( + // WebApplicationFirewallActionAllow ... + WebApplicationFirewallActionAllow WebApplicationFirewallAction = "Allow" + // WebApplicationFirewallActionBlock ... + WebApplicationFirewallActionBlock WebApplicationFirewallAction = "Block" + // WebApplicationFirewallActionLog ... + WebApplicationFirewallActionLog WebApplicationFirewallAction = "Log" +) + +// PossibleWebApplicationFirewallActionValues returns an array of possible values for the WebApplicationFirewallAction const type. +func PossibleWebApplicationFirewallActionValues() []WebApplicationFirewallAction { + return []WebApplicationFirewallAction{WebApplicationFirewallActionAllow, WebApplicationFirewallActionBlock, WebApplicationFirewallActionLog} +} + +// WebApplicationFirewallEnabledState enumerates the values for web application firewall enabled state. +type WebApplicationFirewallEnabledState string + +const ( + // WebApplicationFirewallEnabledStateDisabled ... + WebApplicationFirewallEnabledStateDisabled WebApplicationFirewallEnabledState = "Disabled" + // WebApplicationFirewallEnabledStateEnabled ... + WebApplicationFirewallEnabledStateEnabled WebApplicationFirewallEnabledState = "Enabled" +) + +// PossibleWebApplicationFirewallEnabledStateValues returns an array of possible values for the WebApplicationFirewallEnabledState const type. +func PossibleWebApplicationFirewallEnabledStateValues() []WebApplicationFirewallEnabledState { + return []WebApplicationFirewallEnabledState{WebApplicationFirewallEnabledStateDisabled, WebApplicationFirewallEnabledStateEnabled} +} + +// WebApplicationFirewallMatchVariable enumerates the values for web application firewall match variable. +type WebApplicationFirewallMatchVariable string + +const ( + // WebApplicationFirewallMatchVariablePostArgs ... + WebApplicationFirewallMatchVariablePostArgs WebApplicationFirewallMatchVariable = "PostArgs" + // WebApplicationFirewallMatchVariableQueryString ... + WebApplicationFirewallMatchVariableQueryString WebApplicationFirewallMatchVariable = "QueryString" + // WebApplicationFirewallMatchVariableRemoteAddr ... + WebApplicationFirewallMatchVariableRemoteAddr WebApplicationFirewallMatchVariable = "RemoteAddr" + // WebApplicationFirewallMatchVariableRequestBody ... + WebApplicationFirewallMatchVariableRequestBody WebApplicationFirewallMatchVariable = "RequestBody" + // WebApplicationFirewallMatchVariableRequestCookies ... + WebApplicationFirewallMatchVariableRequestCookies WebApplicationFirewallMatchVariable = "RequestCookies" + // WebApplicationFirewallMatchVariableRequestHeaders ... + WebApplicationFirewallMatchVariableRequestHeaders WebApplicationFirewallMatchVariable = "RequestHeaders" + // WebApplicationFirewallMatchVariableRequestMethod ... + WebApplicationFirewallMatchVariableRequestMethod WebApplicationFirewallMatchVariable = "RequestMethod" + // WebApplicationFirewallMatchVariableRequestURI ... + WebApplicationFirewallMatchVariableRequestURI WebApplicationFirewallMatchVariable = "RequestUri" +) + +// PossibleWebApplicationFirewallMatchVariableValues returns an array of possible values for the WebApplicationFirewallMatchVariable const type. +func PossibleWebApplicationFirewallMatchVariableValues() []WebApplicationFirewallMatchVariable { + return []WebApplicationFirewallMatchVariable{WebApplicationFirewallMatchVariablePostArgs, WebApplicationFirewallMatchVariableQueryString, WebApplicationFirewallMatchVariableRemoteAddr, WebApplicationFirewallMatchVariableRequestBody, WebApplicationFirewallMatchVariableRequestCookies, WebApplicationFirewallMatchVariableRequestHeaders, WebApplicationFirewallMatchVariableRequestMethod, WebApplicationFirewallMatchVariableRequestURI} +} + +// WebApplicationFirewallMode enumerates the values for web application firewall mode. +type WebApplicationFirewallMode string + +const ( + // WebApplicationFirewallModeDetection ... + WebApplicationFirewallModeDetection WebApplicationFirewallMode = "Detection" + // WebApplicationFirewallModePrevention ... + WebApplicationFirewallModePrevention WebApplicationFirewallMode = "Prevention" +) + +// PossibleWebApplicationFirewallModeValues returns an array of possible values for the WebApplicationFirewallMode const type. +func PossibleWebApplicationFirewallModeValues() []WebApplicationFirewallMode { + return []WebApplicationFirewallMode{WebApplicationFirewallModeDetection, WebApplicationFirewallModePrevention} +} + +// WebApplicationFirewallOperator enumerates the values for web application firewall operator. +type WebApplicationFirewallOperator string + +const ( + // WebApplicationFirewallOperatorAny ... + WebApplicationFirewallOperatorAny WebApplicationFirewallOperator = "Any" + // WebApplicationFirewallOperatorBeginsWith ... + WebApplicationFirewallOperatorBeginsWith WebApplicationFirewallOperator = "BeginsWith" + // WebApplicationFirewallOperatorContains ... + WebApplicationFirewallOperatorContains WebApplicationFirewallOperator = "Contains" + // WebApplicationFirewallOperatorEndsWith ... + WebApplicationFirewallOperatorEndsWith WebApplicationFirewallOperator = "EndsWith" + // WebApplicationFirewallOperatorEqual ... + WebApplicationFirewallOperatorEqual WebApplicationFirewallOperator = "Equal" + // WebApplicationFirewallOperatorGeoMatch ... + WebApplicationFirewallOperatorGeoMatch WebApplicationFirewallOperator = "GeoMatch" + // WebApplicationFirewallOperatorGreaterThan ... + WebApplicationFirewallOperatorGreaterThan WebApplicationFirewallOperator = "GreaterThan" + // WebApplicationFirewallOperatorGreaterThanOrEqual ... + WebApplicationFirewallOperatorGreaterThanOrEqual WebApplicationFirewallOperator = "GreaterThanOrEqual" + // WebApplicationFirewallOperatorIPMatch ... + WebApplicationFirewallOperatorIPMatch WebApplicationFirewallOperator = "IPMatch" + // WebApplicationFirewallOperatorLessThan ... + WebApplicationFirewallOperatorLessThan WebApplicationFirewallOperator = "LessThan" + // WebApplicationFirewallOperatorLessThanOrEqual ... + WebApplicationFirewallOperatorLessThanOrEqual WebApplicationFirewallOperator = "LessThanOrEqual" + // WebApplicationFirewallOperatorRegex ... + WebApplicationFirewallOperatorRegex WebApplicationFirewallOperator = "Regex" +) + +// PossibleWebApplicationFirewallOperatorValues returns an array of possible values for the WebApplicationFirewallOperator const type. +func PossibleWebApplicationFirewallOperatorValues() []WebApplicationFirewallOperator { + return []WebApplicationFirewallOperator{WebApplicationFirewallOperatorAny, WebApplicationFirewallOperatorBeginsWith, WebApplicationFirewallOperatorContains, WebApplicationFirewallOperatorEndsWith, WebApplicationFirewallOperatorEqual, WebApplicationFirewallOperatorGeoMatch, WebApplicationFirewallOperatorGreaterThan, WebApplicationFirewallOperatorGreaterThanOrEqual, WebApplicationFirewallOperatorIPMatch, WebApplicationFirewallOperatorLessThan, WebApplicationFirewallOperatorLessThanOrEqual, WebApplicationFirewallOperatorRegex} +} + +// WebApplicationFirewallPolicyResourceState enumerates the values for web application firewall policy resource +// state. +type WebApplicationFirewallPolicyResourceState string + +const ( + // WebApplicationFirewallPolicyResourceStateCreating ... + WebApplicationFirewallPolicyResourceStateCreating WebApplicationFirewallPolicyResourceState = "Creating" + // WebApplicationFirewallPolicyResourceStateDeleting ... + WebApplicationFirewallPolicyResourceStateDeleting WebApplicationFirewallPolicyResourceState = "Deleting" + // WebApplicationFirewallPolicyResourceStateDisabled ... + WebApplicationFirewallPolicyResourceStateDisabled WebApplicationFirewallPolicyResourceState = "Disabled" + // WebApplicationFirewallPolicyResourceStateDisabling ... + WebApplicationFirewallPolicyResourceStateDisabling WebApplicationFirewallPolicyResourceState = "Disabling" + // WebApplicationFirewallPolicyResourceStateEnabled ... + WebApplicationFirewallPolicyResourceStateEnabled WebApplicationFirewallPolicyResourceState = "Enabled" + // WebApplicationFirewallPolicyResourceStateEnabling ... + WebApplicationFirewallPolicyResourceStateEnabling WebApplicationFirewallPolicyResourceState = "Enabling" +) + +// PossibleWebApplicationFirewallPolicyResourceStateValues returns an array of possible values for the WebApplicationFirewallPolicyResourceState const type. +func PossibleWebApplicationFirewallPolicyResourceStateValues() []WebApplicationFirewallPolicyResourceState { + return []WebApplicationFirewallPolicyResourceState{WebApplicationFirewallPolicyResourceStateCreating, WebApplicationFirewallPolicyResourceStateDeleting, WebApplicationFirewallPolicyResourceStateDisabled, WebApplicationFirewallPolicyResourceStateDisabling, WebApplicationFirewallPolicyResourceStateEnabled, WebApplicationFirewallPolicyResourceStateEnabling} +} + +// WebApplicationFirewallRuleType enumerates the values for web application firewall rule type. +type WebApplicationFirewallRuleType string + +const ( + // WebApplicationFirewallRuleTypeInvalid ... + WebApplicationFirewallRuleTypeInvalid WebApplicationFirewallRuleType = "Invalid" + // WebApplicationFirewallRuleTypeMatchRule ... + WebApplicationFirewallRuleTypeMatchRule WebApplicationFirewallRuleType = "MatchRule" +) + +// PossibleWebApplicationFirewallRuleTypeValues returns an array of possible values for the WebApplicationFirewallRuleType const type. +func PossibleWebApplicationFirewallRuleTypeValues() []WebApplicationFirewallRuleType { + return []WebApplicationFirewallRuleType{WebApplicationFirewallRuleTypeInvalid, WebApplicationFirewallRuleTypeMatchRule} +} + +// WebApplicationFirewallTransform enumerates the values for web application firewall transform. +type WebApplicationFirewallTransform string + +const ( + // WebApplicationFirewallTransformHTMLEntityDecode ... + WebApplicationFirewallTransformHTMLEntityDecode WebApplicationFirewallTransform = "HtmlEntityDecode" + // WebApplicationFirewallTransformLowercase ... + WebApplicationFirewallTransformLowercase WebApplicationFirewallTransform = "Lowercase" + // WebApplicationFirewallTransformRemoveNulls ... + WebApplicationFirewallTransformRemoveNulls WebApplicationFirewallTransform = "RemoveNulls" + // WebApplicationFirewallTransformTrim ... + WebApplicationFirewallTransformTrim WebApplicationFirewallTransform = "Trim" + // WebApplicationFirewallTransformURLDecode ... + WebApplicationFirewallTransformURLDecode WebApplicationFirewallTransform = "UrlDecode" + // WebApplicationFirewallTransformURLEncode ... + WebApplicationFirewallTransformURLEncode WebApplicationFirewallTransform = "UrlEncode" + // WebApplicationFirewallTransformUppercase ... + WebApplicationFirewallTransformUppercase WebApplicationFirewallTransform = "Uppercase" +) + +// PossibleWebApplicationFirewallTransformValues returns an array of possible values for the WebApplicationFirewallTransform const type. +func PossibleWebApplicationFirewallTransformValues() []WebApplicationFirewallTransform { + return []WebApplicationFirewallTransform{WebApplicationFirewallTransformHTMLEntityDecode, WebApplicationFirewallTransformLowercase, WebApplicationFirewallTransformRemoveNulls, WebApplicationFirewallTransformTrim, WebApplicationFirewallTransformURLDecode, WebApplicationFirewallTransformURLEncode, WebApplicationFirewallTransformUppercase} +} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecircuitauthorizations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecircuitauthorizations.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecircuitauthorizations.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecircuitauthorizations.go index 70cac7003ea8..00ec9b1814c0 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecircuitauthorizations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecircuitauthorizations.go @@ -75,7 +75,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -160,7 +160,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(ctx context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -247,7 +247,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) GetPreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -328,7 +328,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) ListPreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecircuitconnections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecircuitconnections.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecircuitconnections.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecircuitconnections.go index df47114d0340..608ba572ce52 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecircuitconnections.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecircuitconnections.go @@ -76,7 +76,7 @@ func (client ExpressRouteCircuitConnectionsClient) CreateOrUpdatePreparer(ctx co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -163,7 +163,7 @@ func (client ExpressRouteCircuitConnectionsClient) DeletePreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -252,7 +252,7 @@ func (client ExpressRouteCircuitConnectionsClient) GetPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -335,7 +335,7 @@ func (client ExpressRouteCircuitConnectionsClient) ListPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecircuitpeerings.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecircuitpeerings.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecircuitpeerings.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecircuitpeerings.go index f4f4495ff422..50fecd9a9566 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecircuitpeerings.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecircuitpeerings.go @@ -85,7 +85,7 @@ func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(ctx conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -170,7 +170,7 @@ func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -257,7 +257,7 @@ func (client ExpressRouteCircuitPeeringsClient) GetPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -338,7 +338,7 @@ func (client ExpressRouteCircuitPeeringsClient) ListPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecircuits.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecircuits.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecircuits.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecircuits.go index 7decffae16e6..7f8a7b334bff 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecircuits.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecircuits.go @@ -71,7 +71,7 @@ func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -153,7 +153,7 @@ func (client ExpressRouteCircuitsClient) DeletePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -238,7 +238,7 @@ func (client ExpressRouteCircuitsClient) GetPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -316,7 +316,7 @@ func (client ExpressRouteCircuitsClient) GetPeeringStatsPreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -392,7 +392,7 @@ func (client ExpressRouteCircuitsClient) GetStatsPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -471,7 +471,7 @@ func (client ExpressRouteCircuitsClient) ListPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -584,7 +584,7 @@ func (client ExpressRouteCircuitsClient) ListAllPreparer(ctx context.Context) (* "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -694,7 +694,7 @@ func (client ExpressRouteCircuitsClient) ListArpTablePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -778,7 +778,7 @@ func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -862,7 +862,7 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -949,7 +949,7 @@ func (client ExpressRouteCircuitsClient) UpdateTagsPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteconnections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteconnections.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteconnections.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteconnections.go index b87befd80477..d5d8fc744316 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteconnections.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteconnections.go @@ -82,7 +82,7 @@ func (client ExpressRouteConnectionsClient) CreateOrUpdatePreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -165,7 +165,7 @@ func (client ExpressRouteConnectionsClient) DeletePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -252,7 +252,7 @@ func (client ExpressRouteConnectionsClient) GetPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -328,7 +328,7 @@ func (client ExpressRouteConnectionsClient) ListPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecrossconnectionpeerings.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecrossconnectionpeerings.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecrossconnectionpeerings.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecrossconnectionpeerings.go index 8b7f26494f05..b3011858db70 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecrossconnectionpeerings.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecrossconnectionpeerings.go @@ -87,7 +87,7 @@ func (client ExpressRouteCrossConnectionPeeringsClient) CreateOrUpdatePreparer(c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -171,7 +171,7 @@ func (client ExpressRouteCrossConnectionPeeringsClient) DeletePreparer(ctx conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -258,7 +258,7 @@ func (client ExpressRouteCrossConnectionPeeringsClient) GetPreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -339,7 +339,7 @@ func (client ExpressRouteCrossConnectionPeeringsClient) ListPreparer(ctx context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecrossconnections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecrossconnections.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecrossconnections.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecrossconnections.go index 8401feb23651..7dd8aca8c00c 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutecrossconnections.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutecrossconnections.go @@ -71,7 +71,7 @@ func (client ExpressRouteCrossConnectionsClient) CreateOrUpdatePreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -160,7 +160,7 @@ func (client ExpressRouteCrossConnectionsClient) GetPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -236,7 +236,7 @@ func (client ExpressRouteCrossConnectionsClient) ListPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -347,7 +347,7 @@ func (client ExpressRouteCrossConnectionsClient) ListArpTablePreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -436,7 +436,7 @@ func (client ExpressRouteCrossConnectionsClient) ListByResourceGroupPreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -547,7 +547,7 @@ func (client ExpressRouteCrossConnectionsClient) ListRoutesTablePreparer(ctx con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -631,7 +631,7 @@ func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummaryPreparer( "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -718,7 +718,7 @@ func (client ExpressRouteCrossConnectionsClient) UpdateTagsPreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutegateways.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutegateways.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutegateways.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutegateways.go index f25225e25b13..1618148612e4 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutegateways.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutegateways.go @@ -79,7 +79,7 @@ func (client ExpressRouteGatewaysClient) CreateOrUpdatePreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -162,7 +162,7 @@ func (client ExpressRouteGatewaysClient) DeletePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -247,7 +247,7 @@ func (client ExpressRouteGatewaysClient) GetPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -321,7 +321,7 @@ func (client ExpressRouteGatewaysClient) ListByResourceGroupPreparer(ctx context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -392,7 +392,7 @@ func (client ExpressRouteGatewaysClient) ListBySubscriptionPreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -462,7 +462,7 @@ func (client ExpressRouteGatewaysClient) UpdateTagsPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutelinks.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutelinks.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutelinks.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutelinks.go index 9938690c367d..428325af0b4e 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressroutelinks.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressroutelinks.go @@ -79,7 +79,7 @@ func (client ExpressRouteLinksClient) GetPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -160,7 +160,7 @@ func (client ExpressRouteLinksClient) ListPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteportauthorizations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteportauthorizations.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteportauthorizations.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteportauthorizations.go index d12091ca0d27..ddc9bb53b48f 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteportauthorizations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteportauthorizations.go @@ -74,7 +74,7 @@ func (client ExpressRoutePortAuthorizationsClient) CreateOrUpdatePreparer(ctx co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -159,7 +159,7 @@ func (client ExpressRoutePortAuthorizationsClient) DeletePreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -246,7 +246,7 @@ func (client ExpressRoutePortAuthorizationsClient) GetPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -327,7 +327,7 @@ func (client ExpressRoutePortAuthorizationsClient) ListPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteports.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteports.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteports.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteports.go index e30d7483cc8d..4686579b2919 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteports.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteports.go @@ -72,7 +72,7 @@ func (client ExpressRoutePortsClient) CreateOrUpdatePreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -154,7 +154,7 @@ func (client ExpressRoutePortsClient) DeletePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -246,7 +246,7 @@ func (client ExpressRoutePortsClient) GenerateLOAPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -324,7 +324,7 @@ func (client ExpressRoutePortsClient) GetPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -400,7 +400,7 @@ func (client ExpressRoutePortsClient) ListPreparer(ctx context.Context) (*http.R "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -516,7 +516,7 @@ func (client ExpressRoutePortsClient) ListByResourceGroupPreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -630,7 +630,7 @@ func (client ExpressRoutePortsClient) UpdateTagsPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteportslocations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteportslocations.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteportslocations.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteportslocations.go index d4c1950395a5..3078343f2e7f 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteportslocations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteportslocations.go @@ -76,7 +76,7 @@ func (client ExpressRoutePortsLocationsClient) GetPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -153,7 +153,7 @@ func (client ExpressRoutePortsLocationsClient) ListPreparer(ctx context.Context) "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteproviderportslocation.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteproviderportslocation.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteproviderportslocation.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteproviderportslocation.go index e59f9fd94630..1786f2288a97 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteproviderportslocation.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteproviderportslocation.go @@ -75,7 +75,7 @@ func (client ExpressRouteProviderPortsLocationClient) ListPreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteserviceproviders.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteserviceproviders.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteserviceproviders.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteserviceproviders.go index e53b5979ef8e..794383f9cbbc 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/expressrouteserviceproviders.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/expressrouteserviceproviders.go @@ -77,7 +77,7 @@ func (client ExpressRouteServiceProvidersClient) ListPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/firewallpolicies.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/firewallpolicies.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/firewallpolicies.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/firewallpolicies.go index 434416eec06b..f25384c74383 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/firewallpolicies.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/firewallpolicies.go @@ -93,7 +93,7 @@ func (client FirewallPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -175,7 +175,7 @@ func (client FirewallPoliciesClient) DeletePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -261,7 +261,7 @@ func (client FirewallPoliciesClient) GetPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -343,7 +343,7 @@ func (client FirewallPoliciesClient) ListPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -456,7 +456,7 @@ func (client FirewallPoliciesClient) ListAllPreparer(ctx context.Context) (*http "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -570,7 +570,7 @@ func (client FirewallPoliciesClient) UpdateTagsPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/firewallpolicyidpssignatures.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/firewallpolicyidpssignatures.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/firewallpolicyidpssignatures.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/firewallpolicyidpssignatures.go index f98daff2b953..5f3b30fb4faa 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/firewallpolicyidpssignatures.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/firewallpolicyidpssignatures.go @@ -87,7 +87,7 @@ func (client FirewallPolicyIdpsSignaturesClient) ListPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/firewallpolicyidpssignaturesfiltervalues.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/firewallpolicyidpssignaturesfiltervalues.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/firewallpolicyidpssignaturesfiltervalues.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/firewallpolicyidpssignaturesfiltervalues.go index 53237db1c675..2ccdf87e5a2c 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/firewallpolicyidpssignaturesfiltervalues.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/firewallpolicyidpssignaturesfiltervalues.go @@ -78,7 +78,7 @@ func (client FirewallPolicyIdpsSignaturesFilterValuesClient) ListPreparer(ctx co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/firewallpolicyidpssignaturesoverrides.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/firewallpolicyidpssignaturesoverrides.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/firewallpolicyidpssignaturesoverrides.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/firewallpolicyidpssignaturesoverrides.go index 65d887ee660e..2a1abb6de578 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/firewallpolicyidpssignaturesoverrides.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/firewallpolicyidpssignaturesoverrides.go @@ -78,7 +78,7 @@ func (client FirewallPolicyIdpsSignaturesOverridesClient) GetPreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -154,7 +154,7 @@ func (client FirewallPolicyIdpsSignaturesOverridesClient) ListPreparer(ctx conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -231,7 +231,7 @@ func (client FirewallPolicyIdpsSignaturesOverridesClient) PatchPreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -310,7 +310,7 @@ func (client FirewallPolicyIdpsSignaturesOverridesClient) PutPreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/firewallpolicyrulecollectiongroups.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/firewallpolicyrulecollectiongroups.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/firewallpolicyrulecollectiongroups.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/firewallpolicyrulecollectiongroups.go index 4bc10a0c4b79..e86a4e003d7b 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/firewallpolicyrulecollectiongroups.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/firewallpolicyrulecollectiongroups.go @@ -86,7 +86,7 @@ func (client FirewallPolicyRuleCollectionGroupsClient) CreateOrUpdatePreparer(ct "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -171,7 +171,7 @@ func (client FirewallPolicyRuleCollectionGroupsClient) DeletePreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -258,7 +258,7 @@ func (client FirewallPolicyRuleCollectionGroupsClient) GetPreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -339,7 +339,7 @@ func (client FirewallPolicyRuleCollectionGroupsClient) ListPreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/flowlogs.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/flowlogs.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/flowlogs.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/flowlogs.go index 27fc94681a62..57b3d7b1b244 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/flowlogs.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/flowlogs.go @@ -82,7 +82,7 @@ func (client FlowLogsClient) CreateOrUpdatePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -166,7 +166,7 @@ func (client FlowLogsClient) DeletePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -253,7 +253,7 @@ func (client FlowLogsClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -334,7 +334,7 @@ func (client FlowLogsClient) ListPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -450,7 +450,7 @@ func (client FlowLogsClient) UpdateTagsPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/groups.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/groups.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/groups.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/groups.go index 9c1730140c74..563f265c269e 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/groups.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/groups.go @@ -82,7 +82,7 @@ func (client GroupsClient) CreateOrUpdatePreparer(ctx context.Context, parameter "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -162,7 +162,7 @@ func (client GroupsClient) DeletePreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -252,7 +252,7 @@ func (client GroupsClient) GetPreparer(ctx context.Context, resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -347,7 +347,7 @@ func (client GroupsClient) ListPreparer(ctx context.Context, resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/hubroutetables.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/hubroutetables.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/hubroutetables.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/hubroutetables.go index 3335893b750c..689ec6835791 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/hubroutetables.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/hubroutetables.go @@ -72,7 +72,7 @@ func (client HubRouteTablesClient) CreateOrUpdatePreparer(ctx context.Context, r "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -157,7 +157,7 @@ func (client HubRouteTablesClient) DeletePreparer(ctx context.Context, resourceG "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -244,7 +244,7 @@ func (client HubRouteTablesClient) GetPreparer(ctx context.Context, resourceGrou "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -325,7 +325,7 @@ func (client HubRouteTablesClient) ListPreparer(ctx context.Context, resourceGro "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/hubvirtualnetworkconnections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/hubvirtualnetworkconnections.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/hubvirtualnetworkconnections.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/hubvirtualnetworkconnections.go index 5b79fb0d75bc..179c88ba17f7 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/hubvirtualnetworkconnections.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/hubvirtualnetworkconnections.go @@ -74,7 +74,7 @@ func (client HubVirtualNetworkConnectionsClient) CreateOrUpdatePreparer(ctx cont "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -158,7 +158,7 @@ func (client HubVirtualNetworkConnectionsClient) DeletePreparer(ctx context.Cont "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -245,7 +245,7 @@ func (client HubVirtualNetworkConnectionsClient) GetPreparer(ctx context.Context "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -326,7 +326,7 @@ func (client HubVirtualNetworkConnectionsClient) ListPreparer(ctx context.Contex "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/inboundnatrules.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/inboundnatrules.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/inboundnatrules.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/inboundnatrules.go index 6569edeb69a6..da883db5b86d 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/inboundnatrules.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/inboundnatrules.go @@ -94,7 +94,7 @@ func (client InboundNatRulesClient) CreateOrUpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -179,7 +179,7 @@ func (client InboundNatRulesClient) DeletePreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -267,7 +267,7 @@ func (client InboundNatRulesClient) GetPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -351,7 +351,7 @@ func (client InboundNatRulesClient) ListPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/inboundsecurityrule.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/inboundsecurityrule.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/inboundsecurityrule.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/inboundsecurityrule.go index 7a00b6877708..b1a9f4e526a9 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/inboundsecurityrule.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/inboundsecurityrule.go @@ -74,7 +74,7 @@ func (client InboundSecurityRuleClient) CreateOrUpdatePreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/interfaceipconfigurations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/interfaceipconfigurations.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/interfaceipconfigurations.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/interfaceipconfigurations.go index 163115b43b81..daf95cce8f4c 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/interfaceipconfigurations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/interfaceipconfigurations.go @@ -79,7 +79,7 @@ func (client InterfaceIPConfigurationsClient) GetPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -160,7 +160,7 @@ func (client InterfaceIPConfigurationsClient) ListPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/interfaceloadbalancers.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/interfaceloadbalancers.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/interfaceloadbalancers.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/interfaceloadbalancers.go index 0f452857566c..60e5ef24bb09 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/interfaceloadbalancers.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/interfaceloadbalancers.go @@ -82,7 +82,7 @@ func (client InterfaceLoadBalancersClient) ListPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/interfacesgroup.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/interfacesgroup.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/interfacesgroup.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/interfacesgroup.go index bb47fc71e264..41c9c0ae5cf1 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/interfacesgroup.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/interfacesgroup.go @@ -70,7 +70,7 @@ func (client InterfacesClient) CreateOrUpdatePreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -152,7 +152,7 @@ func (client InterfacesClient) DeletePreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -238,7 +238,7 @@ func (client InterfacesClient) GetPreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -322,7 +322,7 @@ func (client InterfacesClient) GetCloudServiceNetworkInterfacePreparer(ctx conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -394,7 +394,7 @@ func (client InterfacesClient) GetEffectiveRouteTablePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -654,7 +654,7 @@ func (client InterfacesClient) ListPreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -767,7 +767,7 @@ func (client InterfacesClient) ListAllPreparer(ctx context.Context) (*http.Reque "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -885,7 +885,7 @@ func (client InterfacesClient) ListCloudServiceNetworkInterfacesPreparer(ctx con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1006,7 +1006,7 @@ func (client InterfacesClient) ListCloudServiceRoleInstanceNetworkInterfacesPrep "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1112,7 +1112,7 @@ func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsPreparer(ctx co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1565,7 +1565,7 @@ func (client InterfacesClient) UpdateTagsPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/interfacetapconfigurations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/interfacetapconfigurations.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/interfacetapconfigurations.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/interfacetapconfigurations.go index 3a7104628642..679c369116d5 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/interfacetapconfigurations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/interfacetapconfigurations.go @@ -113,7 +113,7 @@ func (client InterfaceTapConfigurationsClient) CreateOrUpdatePreparer(ctx contex "tapConfigurationName": autorest.Encode("path", tapConfigurationName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -198,7 +198,7 @@ func (client InterfaceTapConfigurationsClient) DeletePreparer(ctx context.Contex "tapConfigurationName": autorest.Encode("path", tapConfigurationName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -285,7 +285,7 @@ func (client InterfaceTapConfigurationsClient) GetPreparer(ctx context.Context, "tapConfigurationName": autorest.Encode("path", tapConfigurationName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -366,7 +366,7 @@ func (client InterfaceTapConfigurationsClient) ListPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/ipallocations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/ipallocations.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/ipallocations.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/ipallocations.go index c8e131bd4ece..442ddb11f027 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/ipallocations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/ipallocations.go @@ -70,7 +70,7 @@ func (client IPAllocationsClient) CreateOrUpdatePreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -152,7 +152,7 @@ func (client IPAllocationsClient) DeletePreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -238,7 +238,7 @@ func (client IPAllocationsClient) GetPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -317,7 +317,7 @@ func (client IPAllocationsClient) ListPreparer(ctx context.Context) (*http.Reque "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -433,7 +433,7 @@ func (client IPAllocationsClient) ListByResourceGroupPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -547,7 +547,7 @@ func (client IPAllocationsClient) UpdateTagsPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/ipgroups.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/ipgroups.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/ipgroups.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/ipgroups.go index 89f079408238..d38526f3bcf8 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/ipgroups.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/ipgroups.go @@ -70,7 +70,7 @@ func (client IPGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -152,7 +152,7 @@ func (client IPGroupsClient) DeletePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -239,7 +239,7 @@ func (client IPGroupsClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -318,7 +318,7 @@ func (client IPGroupsClient) ListPreparer(ctx context.Context) (*http.Request, e "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -434,7 +434,7 @@ func (client IPGroupsClient) ListByResourceGroupPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -548,7 +548,7 @@ func (client IPGroupsClient) UpdateGroupsPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancerbackendaddresspools.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancerbackendaddresspools.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancerbackendaddresspools.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancerbackendaddresspools.go index f168eac97af0..74f96f33e9ba 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancerbackendaddresspools.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancerbackendaddresspools.go @@ -73,7 +73,7 @@ func (client LoadBalancerBackendAddressPoolsClient) CreateOrUpdatePreparer(ctx c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -158,7 +158,7 @@ func (client LoadBalancerBackendAddressPoolsClient) DeletePreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -245,7 +245,7 @@ func (client LoadBalancerBackendAddressPoolsClient) GetPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -326,7 +326,7 @@ func (client LoadBalancerBackendAddressPoolsClient) ListPreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancerfrontendipconfigurations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancerfrontendipconfigurations.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancerfrontendipconfigurations.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancerfrontendipconfigurations.go index 018b8f397958..77815eaca4dc 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancerfrontendipconfigurations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancerfrontendipconfigurations.go @@ -80,7 +80,7 @@ func (client LoadBalancerFrontendIPConfigurationsClient) GetPreparer(ctx context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -161,7 +161,7 @@ func (client LoadBalancerFrontendIPConfigurationsClient) ListPreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancerloadbalancingrules.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancerloadbalancingrules.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancerloadbalancingrules.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancerloadbalancingrules.go index 09fdcc1ec19e..d07097363e6b 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancerloadbalancingrules.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancerloadbalancingrules.go @@ -79,7 +79,7 @@ func (client LoadBalancerLoadBalancingRulesClient) GetPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -160,7 +160,7 @@ func (client LoadBalancerLoadBalancingRulesClient) ListPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancernetworkinterfaces.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancernetworkinterfaces.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancernetworkinterfaces.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancernetworkinterfaces.go index fa85108d43e9..be932663fd12 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancernetworkinterfaces.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancernetworkinterfaces.go @@ -82,7 +82,7 @@ func (client LoadBalancerNetworkInterfacesClient) ListPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalanceroutboundrules.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalanceroutboundrules.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalanceroutboundrules.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalanceroutboundrules.go index 369e1cd9dee1..a4c2cd5c4525 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalanceroutboundrules.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalanceroutboundrules.go @@ -79,7 +79,7 @@ func (client LoadBalancerOutboundRulesClient) GetPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -160,7 +160,7 @@ func (client LoadBalancerOutboundRulesClient) ListPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancerprobes.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancerprobes.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancerprobes.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancerprobes.go index f3f38bf8a450..342e54858353 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancerprobes.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancerprobes.go @@ -79,7 +79,7 @@ func (client LoadBalancerProbesClient) GetPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -160,7 +160,7 @@ func (client LoadBalancerProbesClient) ListPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancers.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancers.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancers.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancers.go index 64c0aa640a5f..86c009e0b364 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/loadbalancers.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/loadbalancers.go @@ -70,7 +70,7 @@ func (client LoadBalancersClient) CreateOrUpdatePreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -152,7 +152,7 @@ func (client LoadBalancersClient) DeletePreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -238,7 +238,7 @@ func (client LoadBalancersClient) GetPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -320,7 +320,7 @@ func (client LoadBalancersClient) ListPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -433,7 +433,7 @@ func (client LoadBalancersClient) ListAllPreparer(ctx context.Context) (*http.Re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -542,7 +542,7 @@ func (client LoadBalancersClient) ListInboundNatRulePortMappingsPreparer(ctx con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -622,7 +622,7 @@ func (client LoadBalancersClient) SwapPublicIPAddressesPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -710,7 +710,7 @@ func (client LoadBalancersClient) UpdateTagsPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/localnetworkgateways.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/localnetworkgateways.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/localnetworkgateways.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/localnetworkgateways.go index b55e6f89a8bf..0eda03f8d6f8 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/localnetworkgateways.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/localnetworkgateways.go @@ -87,7 +87,7 @@ func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -175,7 +175,7 @@ func (client LocalNetworkGatewaysClient) DeletePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -266,7 +266,7 @@ func (client LocalNetworkGatewaysClient) GetPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -345,7 +345,7 @@ func (client LocalNetworkGatewaysClient) ListPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -465,7 +465,7 @@ func (client LocalNetworkGatewaysClient) UpdateTagsPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/managementgroupnetworkmanagerconnections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/managementgroupnetworkmanagerconnections.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/managementgroupnetworkmanagerconnections.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/managementgroupnetworkmanagerconnections.go index d3124bf09716..fb5d9a12a7c9 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/managementgroupnetworkmanagerconnections.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/managementgroupnetworkmanagerconnections.go @@ -79,7 +79,7 @@ func (client ManagementGroupNetworkManagerConnectionsClient) CreateOrUpdatePrepa "networkManagerConnectionName": autorest.Encode("path", networkManagerConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -157,7 +157,7 @@ func (client ManagementGroupNetworkManagerConnectionsClient) DeletePreparer(ctx "networkManagerConnectionName": autorest.Encode("path", networkManagerConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -231,7 +231,7 @@ func (client ManagementGroupNetworkManagerConnectionsClient) GetPreparer(ctx con "networkManagerConnectionName": autorest.Encode("path", networkManagerConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -323,7 +323,7 @@ func (client ManagementGroupNetworkManagerConnectionsClient) ListPreparer(ctx co "managementGroupId": autorest.Encode("path", managementGroupID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/managercommits.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/managercommits.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/managercommits.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/managercommits.go index 65752d2406cd..30699bec96d6 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/managercommits.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/managercommits.go @@ -77,7 +77,7 @@ func (client ManagerCommitsClient) PostPreparer(ctx context.Context, parameters "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/managerdeploymentstatus.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/managerdeploymentstatus.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/managerdeploymentstatus.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/managerdeploymentstatus.go index 641e42a40c46..1aeb49e13818 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/managerdeploymentstatus.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/managerdeploymentstatus.go @@ -90,7 +90,7 @@ func (client ManagerDeploymentStatusClient) ListPreparer(ctx context.Context, pa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/managers.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/managers.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/managers.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/managers.go index 47307b837e07..0d79f74019b0 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/managers.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/managers.go @@ -87,7 +87,7 @@ func (client ManagersClient) CreateOrUpdatePreparer(ctx context.Context, paramet "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -162,7 +162,7 @@ func (client ManagersClient) DeletePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -250,7 +250,7 @@ func (client ManagersClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -343,7 +343,7 @@ func (client ManagersClient) ListPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -477,7 +477,7 @@ func (client ManagersClient) ListBySubscriptionPreparer(ctx context.Context, top "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -597,7 +597,7 @@ func (client ManagersClient) PatchPreparer(ctx context.Context, parameters Patch "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/models.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/models.go new file mode 100644 index 000000000000..b93702df32d5 --- /dev/null +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/models.go @@ -0,0 +1,58053 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" +) + +// The package's fully qualified name. +const fqdn = "home/runner/work/kermit/kermit/sdk/network/2022-07-01/network" + +// AadAuthenticationParameters AAD Vpn authentication type related parameters. +type AadAuthenticationParameters struct { + // AadTenant - AAD Vpn authentication parameter AAD tenant. + AadTenant *string `json:"aadTenant,omitempty"` + // AadAudience - AAD Vpn authentication parameter AAD audience. + AadAudience *string `json:"aadAudience,omitempty"` + // AadIssuer - AAD Vpn authentication parameter AAD issuer. + AadIssuer *string `json:"aadIssuer,omitempty"` +} + +// Action action to be taken on a route matching a RouteMap criterion. +type Action struct { + // Type - Type of action to be taken. Supported types are 'Remove', 'Add', 'Replace', and 'Drop.'. Possible values include: 'RouteMapActionTypeUnknown', 'RouteMapActionTypeRemove', 'RouteMapActionTypeAdd', 'RouteMapActionTypeReplace', 'RouteMapActionTypeDrop' + Type RouteMapActionType `json:"type,omitempty"` + // Parameters - List of parameters relevant to the action.For instance if type is drop then parameters has list of prefixes to be dropped.If type is add, parameters would have list of ASN numbers to be added + Parameters *[]Parameter `json:"parameters,omitempty"` +} + +// BasicActiveBaseSecurityAdminRule network base admin rule. +type BasicActiveBaseSecurityAdminRule interface { + AsActiveSecurityAdminRule() (*ActiveSecurityAdminRule, bool) + AsActiveDefaultSecurityAdminRule() (*ActiveDefaultSecurityAdminRule, bool) + AsActiveBaseSecurityAdminRule() (*ActiveBaseSecurityAdminRule, bool) +} + +// ActiveBaseSecurityAdminRule network base admin rule. +type ActiveBaseSecurityAdminRule struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // CommitTime - Deployment time string. + CommitTime *date.Time `json:"commitTime,omitempty"` + // Region - Deployment region. + Region *string `json:"region,omitempty"` + // ConfigurationDescription - A description of the security admin configuration. + ConfigurationDescription *string `json:"configurationDescription,omitempty"` + // RuleCollectionDescription - A description of the rule collection. + RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` + // RuleCollectionAppliesToGroups - Groups for rule collection + RuleCollectionAppliesToGroups *[]ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` + // RuleGroups - Effective configuration groups. + RuleGroups *[]ConfigurationGroup `json:"ruleGroups,omitempty"` + // Kind - Possible values include: 'KindActiveBaseSecurityAdminRule', 'KindCustom', 'KindDefault' + Kind Kind `json:"kind,omitempty"` +} + +func unmarshalBasicActiveBaseSecurityAdminRule(body []byte) (BasicActiveBaseSecurityAdminRule, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindCustom): + var asar ActiveSecurityAdminRule + err := json.Unmarshal(body, &asar) + return asar, err + case string(KindDefault): + var adsar ActiveDefaultSecurityAdminRule + err := json.Unmarshal(body, &adsar) + return adsar, err + default: + var absar ActiveBaseSecurityAdminRule + err := json.Unmarshal(body, &absar) + return absar, err + } +} +func unmarshalBasicActiveBaseSecurityAdminRuleArray(body []byte) ([]BasicActiveBaseSecurityAdminRule, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + absarArray := make([]BasicActiveBaseSecurityAdminRule, len(rawMessages)) + + for index, rawMessage := range rawMessages { + absar, err := unmarshalBasicActiveBaseSecurityAdminRule(*rawMessage) + if err != nil { + return nil, err + } + absarArray[index] = absar + } + return absarArray, nil +} + +// MarshalJSON is the custom marshaler for ActiveBaseSecurityAdminRule. +func (absar ActiveBaseSecurityAdminRule) MarshalJSON() ([]byte, error) { + absar.Kind = KindActiveBaseSecurityAdminRule + objectMap := make(map[string]interface{}) + if absar.ID != nil { + objectMap["id"] = absar.ID + } + if absar.CommitTime != nil { + objectMap["commitTime"] = absar.CommitTime + } + if absar.Region != nil { + objectMap["region"] = absar.Region + } + if absar.ConfigurationDescription != nil { + objectMap["configurationDescription"] = absar.ConfigurationDescription + } + if absar.RuleCollectionDescription != nil { + objectMap["ruleCollectionDescription"] = absar.RuleCollectionDescription + } + if absar.RuleCollectionAppliesToGroups != nil { + objectMap["ruleCollectionAppliesToGroups"] = absar.RuleCollectionAppliesToGroups + } + if absar.RuleGroups != nil { + objectMap["ruleGroups"] = absar.RuleGroups + } + if absar.Kind != "" { + objectMap["kind"] = absar.Kind + } + return json.Marshal(objectMap) +} + +// AsActiveSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveBaseSecurityAdminRule. +func (absar ActiveBaseSecurityAdminRule) AsActiveSecurityAdminRule() (*ActiveSecurityAdminRule, bool) { + return nil, false +} + +// AsActiveDefaultSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveBaseSecurityAdminRule. +func (absar ActiveBaseSecurityAdminRule) AsActiveDefaultSecurityAdminRule() (*ActiveDefaultSecurityAdminRule, bool) { + return nil, false +} + +// AsActiveBaseSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveBaseSecurityAdminRule. +func (absar ActiveBaseSecurityAdminRule) AsActiveBaseSecurityAdminRule() (*ActiveBaseSecurityAdminRule, bool) { + return &absar, true +} + +// AsBasicActiveBaseSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveBaseSecurityAdminRule. +func (absar ActiveBaseSecurityAdminRule) AsBasicActiveBaseSecurityAdminRule() (BasicActiveBaseSecurityAdminRule, bool) { + return &absar, true +} + +// ActiveConfigurationParameter effective Virtual Networks Parameter. +type ActiveConfigurationParameter struct { + // Regions - List of regions. + Regions *[]string `json:"regions,omitempty"` + // SkipToken - When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. + SkipToken *string `json:"skipToken,omitempty"` +} + +// ActiveConnectivityConfiguration active connectivity configuration. +type ActiveConnectivityConfiguration struct { + // CommitTime - Deployment time string. + CommitTime *date.Time `json:"commitTime,omitempty"` + // Region - Deployment region. + Region *string `json:"region,omitempty"` + // ID - Connectivity configuration ID. + ID *string `json:"id,omitempty"` + // ConnectivityConfigurationProperties - Properties of a network manager connectivity configuration + *ConnectivityConfigurationProperties `json:"properties,omitempty"` + // ConfigurationGroups - Effective configuration groups. + ConfigurationGroups *[]ConfigurationGroup `json:"configurationGroups,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActiveConnectivityConfiguration. +func (acc ActiveConnectivityConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if acc.CommitTime != nil { + objectMap["commitTime"] = acc.CommitTime + } + if acc.Region != nil { + objectMap["region"] = acc.Region + } + if acc.ID != nil { + objectMap["id"] = acc.ID + } + if acc.ConnectivityConfigurationProperties != nil { + objectMap["properties"] = acc.ConnectivityConfigurationProperties + } + if acc.ConfigurationGroups != nil { + objectMap["configurationGroups"] = acc.ConfigurationGroups + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ActiveConnectivityConfiguration struct. +func (acc *ActiveConnectivityConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "commitTime": + if v != nil { + var commitTime date.Time + err = json.Unmarshal(*v, &commitTime) + if err != nil { + return err + } + acc.CommitTime = &commitTime + } + case "region": + if v != nil { + var region string + err = json.Unmarshal(*v, ®ion) + if err != nil { + return err + } + acc.Region = ®ion + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + acc.ID = &ID + } + case "properties": + if v != nil { + var connectivityConfigurationProperties ConnectivityConfigurationProperties + err = json.Unmarshal(*v, &connectivityConfigurationProperties) + if err != nil { + return err + } + acc.ConnectivityConfigurationProperties = &connectivityConfigurationProperties + } + case "configurationGroups": + if v != nil { + var configurationGroups []ConfigurationGroup + err = json.Unmarshal(*v, &configurationGroups) + if err != nil { + return err + } + acc.ConfigurationGroups = &configurationGroups + } + } + } + + return nil +} + +// ActiveConnectivityConfigurationsListResult result of the request to list active connectivity +// configurations. It contains a list of active connectivity configurations and a skiptoken to get the next +// set of results. +type ActiveConnectivityConfigurationsListResult struct { + autorest.Response `json:"-"` + // Value - Gets a page of active connectivity configurations. + Value *[]ActiveConnectivityConfiguration `json:"value,omitempty"` + // SkipToken - When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. + SkipToken *string `json:"skipToken,omitempty"` +} + +// ActiveDefaultSecurityAdminRule network default admin rule. +type ActiveDefaultSecurityAdminRule struct { + // DefaultAdminPropertiesFormat - Indicates the properties of the default security admin rule + *DefaultAdminPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // CommitTime - Deployment time string. + CommitTime *date.Time `json:"commitTime,omitempty"` + // Region - Deployment region. + Region *string `json:"region,omitempty"` + // ConfigurationDescription - A description of the security admin configuration. + ConfigurationDescription *string `json:"configurationDescription,omitempty"` + // RuleCollectionDescription - A description of the rule collection. + RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` + // RuleCollectionAppliesToGroups - Groups for rule collection + RuleCollectionAppliesToGroups *[]ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` + // RuleGroups - Effective configuration groups. + RuleGroups *[]ConfigurationGroup `json:"ruleGroups,omitempty"` + // Kind - Possible values include: 'KindActiveBaseSecurityAdminRule', 'KindCustom', 'KindDefault' + Kind Kind `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActiveDefaultSecurityAdminRule. +func (adsar ActiveDefaultSecurityAdminRule) MarshalJSON() ([]byte, error) { + adsar.Kind = KindDefault + objectMap := make(map[string]interface{}) + if adsar.DefaultAdminPropertiesFormat != nil { + objectMap["properties"] = adsar.DefaultAdminPropertiesFormat + } + if adsar.ID != nil { + objectMap["id"] = adsar.ID + } + if adsar.CommitTime != nil { + objectMap["commitTime"] = adsar.CommitTime + } + if adsar.Region != nil { + objectMap["region"] = adsar.Region + } + if adsar.ConfigurationDescription != nil { + objectMap["configurationDescription"] = adsar.ConfigurationDescription + } + if adsar.RuleCollectionDescription != nil { + objectMap["ruleCollectionDescription"] = adsar.RuleCollectionDescription + } + if adsar.RuleCollectionAppliesToGroups != nil { + objectMap["ruleCollectionAppliesToGroups"] = adsar.RuleCollectionAppliesToGroups + } + if adsar.RuleGroups != nil { + objectMap["ruleGroups"] = adsar.RuleGroups + } + if adsar.Kind != "" { + objectMap["kind"] = adsar.Kind + } + return json.Marshal(objectMap) +} + +// AsActiveSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveDefaultSecurityAdminRule. +func (adsar ActiveDefaultSecurityAdminRule) AsActiveSecurityAdminRule() (*ActiveSecurityAdminRule, bool) { + return nil, false +} + +// AsActiveDefaultSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveDefaultSecurityAdminRule. +func (adsar ActiveDefaultSecurityAdminRule) AsActiveDefaultSecurityAdminRule() (*ActiveDefaultSecurityAdminRule, bool) { + return &adsar, true +} + +// AsActiveBaseSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveDefaultSecurityAdminRule. +func (adsar ActiveDefaultSecurityAdminRule) AsActiveBaseSecurityAdminRule() (*ActiveBaseSecurityAdminRule, bool) { + return nil, false +} + +// AsBasicActiveBaseSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveDefaultSecurityAdminRule. +func (adsar ActiveDefaultSecurityAdminRule) AsBasicActiveBaseSecurityAdminRule() (BasicActiveBaseSecurityAdminRule, bool) { + return &adsar, true +} + +// UnmarshalJSON is the custom unmarshaler for ActiveDefaultSecurityAdminRule struct. +func (adsar *ActiveDefaultSecurityAdminRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var defaultAdminPropertiesFormat DefaultAdminPropertiesFormat + err = json.Unmarshal(*v, &defaultAdminPropertiesFormat) + if err != nil { + return err + } + adsar.DefaultAdminPropertiesFormat = &defaultAdminPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + adsar.ID = &ID + } + case "commitTime": + if v != nil { + var commitTime date.Time + err = json.Unmarshal(*v, &commitTime) + if err != nil { + return err + } + adsar.CommitTime = &commitTime + } + case "region": + if v != nil { + var region string + err = json.Unmarshal(*v, ®ion) + if err != nil { + return err + } + adsar.Region = ®ion + } + case "configurationDescription": + if v != nil { + var configurationDescription string + err = json.Unmarshal(*v, &configurationDescription) + if err != nil { + return err + } + adsar.ConfigurationDescription = &configurationDescription + } + case "ruleCollectionDescription": + if v != nil { + var ruleCollectionDescription string + err = json.Unmarshal(*v, &ruleCollectionDescription) + if err != nil { + return err + } + adsar.RuleCollectionDescription = &ruleCollectionDescription + } + case "ruleCollectionAppliesToGroups": + if v != nil { + var ruleCollectionAppliesToGroups []ManagerSecurityGroupItem + err = json.Unmarshal(*v, &ruleCollectionAppliesToGroups) + if err != nil { + return err + } + adsar.RuleCollectionAppliesToGroups = &ruleCollectionAppliesToGroups + } + case "ruleGroups": + if v != nil { + var ruleGroups []ConfigurationGroup + err = json.Unmarshal(*v, &ruleGroups) + if err != nil { + return err + } + adsar.RuleGroups = &ruleGroups + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + adsar.Kind = kind + } + } + } + + return nil +} + +// ActiveSecurityAdminRule network admin rule. +type ActiveSecurityAdminRule struct { + // AdminPropertiesFormat - Indicates the properties of the security admin rule + *AdminPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // CommitTime - Deployment time string. + CommitTime *date.Time `json:"commitTime,omitempty"` + // Region - Deployment region. + Region *string `json:"region,omitempty"` + // ConfigurationDescription - A description of the security admin configuration. + ConfigurationDescription *string `json:"configurationDescription,omitempty"` + // RuleCollectionDescription - A description of the rule collection. + RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` + // RuleCollectionAppliesToGroups - Groups for rule collection + RuleCollectionAppliesToGroups *[]ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` + // RuleGroups - Effective configuration groups. + RuleGroups *[]ConfigurationGroup `json:"ruleGroups,omitempty"` + // Kind - Possible values include: 'KindActiveBaseSecurityAdminRule', 'KindCustom', 'KindDefault' + Kind Kind `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActiveSecurityAdminRule. +func (asar ActiveSecurityAdminRule) MarshalJSON() ([]byte, error) { + asar.Kind = KindCustom + objectMap := make(map[string]interface{}) + if asar.AdminPropertiesFormat != nil { + objectMap["properties"] = asar.AdminPropertiesFormat + } + if asar.ID != nil { + objectMap["id"] = asar.ID + } + if asar.CommitTime != nil { + objectMap["commitTime"] = asar.CommitTime + } + if asar.Region != nil { + objectMap["region"] = asar.Region + } + if asar.ConfigurationDescription != nil { + objectMap["configurationDescription"] = asar.ConfigurationDescription + } + if asar.RuleCollectionDescription != nil { + objectMap["ruleCollectionDescription"] = asar.RuleCollectionDescription + } + if asar.RuleCollectionAppliesToGroups != nil { + objectMap["ruleCollectionAppliesToGroups"] = asar.RuleCollectionAppliesToGroups + } + if asar.RuleGroups != nil { + objectMap["ruleGroups"] = asar.RuleGroups + } + if asar.Kind != "" { + objectMap["kind"] = asar.Kind + } + return json.Marshal(objectMap) +} + +// AsActiveSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveSecurityAdminRule. +func (asar ActiveSecurityAdminRule) AsActiveSecurityAdminRule() (*ActiveSecurityAdminRule, bool) { + return &asar, true +} + +// AsActiveDefaultSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveSecurityAdminRule. +func (asar ActiveSecurityAdminRule) AsActiveDefaultSecurityAdminRule() (*ActiveDefaultSecurityAdminRule, bool) { + return nil, false +} + +// AsActiveBaseSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveSecurityAdminRule. +func (asar ActiveSecurityAdminRule) AsActiveBaseSecurityAdminRule() (*ActiveBaseSecurityAdminRule, bool) { + return nil, false +} + +// AsBasicActiveBaseSecurityAdminRule is the BasicActiveBaseSecurityAdminRule implementation for ActiveSecurityAdminRule. +func (asar ActiveSecurityAdminRule) AsBasicActiveBaseSecurityAdminRule() (BasicActiveBaseSecurityAdminRule, bool) { + return &asar, true +} + +// UnmarshalJSON is the custom unmarshaler for ActiveSecurityAdminRule struct. +func (asar *ActiveSecurityAdminRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var adminPropertiesFormat AdminPropertiesFormat + err = json.Unmarshal(*v, &adminPropertiesFormat) + if err != nil { + return err + } + asar.AdminPropertiesFormat = &adminPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asar.ID = &ID + } + case "commitTime": + if v != nil { + var commitTime date.Time + err = json.Unmarshal(*v, &commitTime) + if err != nil { + return err + } + asar.CommitTime = &commitTime + } + case "region": + if v != nil { + var region string + err = json.Unmarshal(*v, ®ion) + if err != nil { + return err + } + asar.Region = ®ion + } + case "configurationDescription": + if v != nil { + var configurationDescription string + err = json.Unmarshal(*v, &configurationDescription) + if err != nil { + return err + } + asar.ConfigurationDescription = &configurationDescription + } + case "ruleCollectionDescription": + if v != nil { + var ruleCollectionDescription string + err = json.Unmarshal(*v, &ruleCollectionDescription) + if err != nil { + return err + } + asar.RuleCollectionDescription = &ruleCollectionDescription + } + case "ruleCollectionAppliesToGroups": + if v != nil { + var ruleCollectionAppliesToGroups []ManagerSecurityGroupItem + err = json.Unmarshal(*v, &ruleCollectionAppliesToGroups) + if err != nil { + return err + } + asar.RuleCollectionAppliesToGroups = &ruleCollectionAppliesToGroups + } + case "ruleGroups": + if v != nil { + var ruleGroups []ConfigurationGroup + err = json.Unmarshal(*v, &ruleGroups) + if err != nil { + return err + } + asar.RuleGroups = &ruleGroups + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asar.Kind = kind + } + } + } + + return nil +} + +// ActiveSecurityAdminRulesListResult result of the request to list active security admin rules. It +// contains a list of active security admin rules and a skiptoken to get the next set of results. +type ActiveSecurityAdminRulesListResult struct { + autorest.Response `json:"-"` + // Value - Gets a page of active security admin rules. + Value *[]BasicActiveBaseSecurityAdminRule `json:"value,omitempty"` + // SkipToken - When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. + SkipToken *string `json:"skipToken,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ActiveSecurityAdminRulesListResult struct. +func (asarlr *ActiveSecurityAdminRulesListResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "value": + if v != nil { + value, err := unmarshalBasicActiveBaseSecurityAdminRuleArray(*v) + if err != nil { + return err + } + asarlr.Value = &value + } + case "skipToken": + if v != nil { + var skipToken string + err = json.Unmarshal(*v, &skipToken) + if err != nil { + return err + } + asarlr.SkipToken = &skipToken + } + } + } + + return nil +} + +// AddressPrefixItem address prefix item. +type AddressPrefixItem struct { + // AddressPrefix - Address prefix. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // AddressPrefixType - Address prefix type. Possible values include: 'AddressPrefixTypeIPPrefix', 'AddressPrefixTypeServiceTag' + AddressPrefixType AddressPrefixType `json:"addressPrefixType,omitempty"` +} + +// AddressSpace addressSpace contains an array of IP address ranges that can be used by subnets of the +// virtual network. +type AddressSpace struct { + // AddressPrefixes - A list of address blocks reserved for this virtual network in CIDR notation. + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` +} + +// AdminPropertiesFormat security admin rule resource. +type AdminPropertiesFormat struct { + // Description - A description for this rule. Restricted to 140 chars. + Description *string `json:"description,omitempty"` + // Protocol - Network protocol this rule applies to. Possible values include: 'SecurityConfigurationRuleProtocolTCP', 'SecurityConfigurationRuleProtocolUDP', 'SecurityConfigurationRuleProtocolIcmp', 'SecurityConfigurationRuleProtocolEsp', 'SecurityConfigurationRuleProtocolAny', 'SecurityConfigurationRuleProtocolAh' + Protocol SecurityConfigurationRuleProtocol `json:"protocol,omitempty"` + // Sources - The CIDR or source IP ranges. + Sources *[]AddressPrefixItem `json:"sources,omitempty"` + // Destinations - The destination address prefixes. CIDR or destination IP ranges. + Destinations *[]AddressPrefixItem `json:"destinations,omitempty"` + // SourcePortRanges - The source port ranges. + SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` + // DestinationPortRanges - The destination port ranges. + DestinationPortRanges *[]string `json:"destinationPortRanges,omitempty"` + // Access - Indicates the access allowed for this particular rule. Possible values include: 'SecurityConfigurationRuleAccessAllow', 'SecurityConfigurationRuleAccessDeny', 'SecurityConfigurationRuleAccessAlwaysAllow' + Access SecurityConfigurationRuleAccess `json:"access,omitempty"` + // Priority - The priority of the rule. The value can be between 1 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. + Priority *int32 `json:"priority,omitempty"` + // Direction - Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: 'SecurityConfigurationRuleDirectionInbound', 'SecurityConfigurationRuleDirectionOutbound' + Direction SecurityConfigurationRuleDirection `json:"direction,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AdminPropertiesFormat. +func (apf AdminPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apf.Description != nil { + objectMap["description"] = apf.Description + } + if apf.Protocol != "" { + objectMap["protocol"] = apf.Protocol + } + if apf.Sources != nil { + objectMap["sources"] = apf.Sources + } + if apf.Destinations != nil { + objectMap["destinations"] = apf.Destinations + } + if apf.SourcePortRanges != nil { + objectMap["sourcePortRanges"] = apf.SourcePortRanges + } + if apf.DestinationPortRanges != nil { + objectMap["destinationPortRanges"] = apf.DestinationPortRanges + } + if apf.Access != "" { + objectMap["access"] = apf.Access + } + if apf.Priority != nil { + objectMap["priority"] = apf.Priority + } + if apf.Direction != "" { + objectMap["direction"] = apf.Direction + } + return json.Marshal(objectMap) +} + +// AdminRule network admin rule. +type AdminRule struct { + // AdminPropertiesFormat - Indicates the properties of the security admin rule + *AdminPropertiesFormat `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Kind - Possible values include: 'KindBasicBaseAdminRuleKindBaseAdminRule', 'KindBasicBaseAdminRuleKindCustom', 'KindBasicBaseAdminRuleKindDefault' + Kind KindBasicBaseAdminRule `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for AdminRule. +func (ar AdminRule) MarshalJSON() ([]byte, error) { + ar.Kind = KindBasicBaseAdminRuleKindCustom + objectMap := make(map[string]interface{}) + if ar.AdminPropertiesFormat != nil { + objectMap["properties"] = ar.AdminPropertiesFormat + } + if ar.Kind != "" { + objectMap["kind"] = ar.Kind + } + return json.Marshal(objectMap) +} + +// AsAdminRule is the BasicBaseAdminRule implementation for AdminRule. +func (ar AdminRule) AsAdminRule() (*AdminRule, bool) { + return &ar, true +} + +// AsDefaultAdminRule is the BasicBaseAdminRule implementation for AdminRule. +func (ar AdminRule) AsDefaultAdminRule() (*DefaultAdminRule, bool) { + return nil, false +} + +// AsBaseAdminRule is the BasicBaseAdminRule implementation for AdminRule. +func (ar AdminRule) AsBaseAdminRule() (*BaseAdminRule, bool) { + return nil, false +} + +// AsBasicBaseAdminRule is the BasicBaseAdminRule implementation for AdminRule. +func (ar AdminRule) AsBasicBaseAdminRule() (BasicBaseAdminRule, bool) { + return &ar, true +} + +// UnmarshalJSON is the custom unmarshaler for AdminRule struct. +func (ar *AdminRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var adminPropertiesFormat AdminPropertiesFormat + err = json.Unmarshal(*v, &adminPropertiesFormat) + if err != nil { + return err + } + ar.AdminPropertiesFormat = &adminPropertiesFormat + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ar.SystemData = &systemData + } + case "kind": + if v != nil { + var kind KindBasicBaseAdminRule + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ar.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ar.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ar.Etag = &etag + } + } + } + + return nil +} + +// AdminRuleCollection defines the admin rule collection. +type AdminRuleCollection struct { + autorest.Response `json:"-"` + // AdminRuleCollectionPropertiesFormat - Indicates the properties for the network manager admin rule collection. + *AdminRuleCollectionPropertiesFormat `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for AdminRuleCollection. +func (arc AdminRuleCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arc.AdminRuleCollectionPropertiesFormat != nil { + objectMap["properties"] = arc.AdminRuleCollectionPropertiesFormat + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AdminRuleCollection struct. +func (arc *AdminRuleCollection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var adminRuleCollectionPropertiesFormat AdminRuleCollectionPropertiesFormat + err = json.Unmarshal(*v, &adminRuleCollectionPropertiesFormat) + if err != nil { + return err + } + arc.AdminRuleCollectionPropertiesFormat = &adminRuleCollectionPropertiesFormat + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + arc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + arc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + arc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + arc.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + arc.Etag = &etag + } + } + } + + return nil +} + +// AdminRuleCollectionListResult security admin configuration rule collection list result. +type AdminRuleCollectionListResult struct { + autorest.Response `json:"-"` + // Value - A list of network manager security admin configuration rule collections + Value *[]AdminRuleCollection `json:"value,omitempty"` + // NextLink - Gets the URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AdminRuleCollectionListResultIterator provides access to a complete listing of AdminRuleCollection +// values. +type AdminRuleCollectionListResultIterator struct { + i int + page AdminRuleCollectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AdminRuleCollectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AdminRuleCollectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AdminRuleCollectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AdminRuleCollectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AdminRuleCollectionListResultIterator) Response() AdminRuleCollectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AdminRuleCollectionListResultIterator) Value() AdminRuleCollection { + if !iter.page.NotDone() { + return AdminRuleCollection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AdminRuleCollectionListResultIterator type. +func NewAdminRuleCollectionListResultIterator(page AdminRuleCollectionListResultPage) AdminRuleCollectionListResultIterator { + return AdminRuleCollectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arclr AdminRuleCollectionListResult) IsEmpty() bool { + return arclr.Value == nil || len(*arclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (arclr AdminRuleCollectionListResult) hasNextLink() bool { + return arclr.NextLink != nil && len(*arclr.NextLink) != 0 +} + +// adminRuleCollectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arclr AdminRuleCollectionListResult) adminRuleCollectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !arclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arclr.NextLink))) +} + +// AdminRuleCollectionListResultPage contains a page of AdminRuleCollection values. +type AdminRuleCollectionListResultPage struct { + fn func(context.Context, AdminRuleCollectionListResult) (AdminRuleCollectionListResult, error) + arclr AdminRuleCollectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AdminRuleCollectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AdminRuleCollectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.arclr) + if err != nil { + return err + } + page.arclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AdminRuleCollectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AdminRuleCollectionListResultPage) NotDone() bool { + return !page.arclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AdminRuleCollectionListResultPage) Response() AdminRuleCollectionListResult { + return page.arclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AdminRuleCollectionListResultPage) Values() []AdminRuleCollection { + if page.arclr.IsEmpty() { + return nil + } + return *page.arclr.Value +} + +// Creates a new instance of the AdminRuleCollectionListResultPage type. +func NewAdminRuleCollectionListResultPage(cur AdminRuleCollectionListResult, getNextPage func(context.Context, AdminRuleCollectionListResult) (AdminRuleCollectionListResult, error)) AdminRuleCollectionListResultPage { + return AdminRuleCollectionListResultPage{ + fn: getNextPage, + arclr: cur, + } +} + +// AdminRuleCollectionPropertiesFormat defines the admin rule collection properties. +type AdminRuleCollectionPropertiesFormat struct { + // Description - A description of the admin rule collection. + Description *string `json:"description,omitempty"` + // AppliesToGroups - Groups for configuration + AppliesToGroups *[]ManagerSecurityGroupItem `json:"appliesToGroups,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AdminRuleCollectionPropertiesFormat. +func (arcpf AdminRuleCollectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arcpf.Description != nil { + objectMap["description"] = arcpf.Description + } + if arcpf.AppliesToGroups != nil { + objectMap["appliesToGroups"] = arcpf.AppliesToGroups + } + return json.Marshal(objectMap) +} + +// AdminRuleCollectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AdminRuleCollectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AdminRuleCollectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AdminRuleCollectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AdminRuleCollectionsDeleteFuture.Result. +func (future *AdminRuleCollectionsDeleteFuture) result(client AdminRuleCollectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AdminRuleCollectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.AdminRuleCollectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AdminRuleListResult security configuration admin rule list result. +type AdminRuleListResult struct { + autorest.Response `json:"-"` + // Value - A list of admin rules + Value *[]BasicBaseAdminRule `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for AdminRuleListResult struct. +func (arlr *AdminRuleListResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "value": + if v != nil { + value, err := unmarshalBasicBaseAdminRuleArray(*v) + if err != nil { + return err + } + arlr.Value = &value + } + case "nextLink": + if v != nil { + var nextLink string + err = json.Unmarshal(*v, &nextLink) + if err != nil { + return err + } + arlr.NextLink = &nextLink + } + } + } + + return nil +} + +// AdminRuleListResultIterator provides access to a complete listing of BaseAdminRule values. +type AdminRuleListResultIterator struct { + i int + page AdminRuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AdminRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AdminRuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AdminRuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AdminRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AdminRuleListResultIterator) Response() AdminRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AdminRuleListResultIterator) Value() BasicBaseAdminRule { + if !iter.page.NotDone() { + return BaseAdminRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AdminRuleListResultIterator type. +func NewAdminRuleListResultIterator(page AdminRuleListResultPage) AdminRuleListResultIterator { + return AdminRuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arlr AdminRuleListResult) IsEmpty() bool { + return arlr.Value == nil || len(*arlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (arlr AdminRuleListResult) hasNextLink() bool { + return arlr.NextLink != nil && len(*arlr.NextLink) != 0 +} + +// adminRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arlr AdminRuleListResult) adminRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !arlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arlr.NextLink))) +} + +// AdminRuleListResultPage contains a page of BasicBaseAdminRule values. +type AdminRuleListResultPage struct { + fn func(context.Context, AdminRuleListResult) (AdminRuleListResult, error) + arlr AdminRuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AdminRuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AdminRuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.arlr) + if err != nil { + return err + } + page.arlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AdminRuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AdminRuleListResultPage) NotDone() bool { + return !page.arlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AdminRuleListResultPage) Response() AdminRuleListResult { + return page.arlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AdminRuleListResultPage) Values() []BasicBaseAdminRule { + if page.arlr.IsEmpty() { + return nil + } + return *page.arlr.Value +} + +// Creates a new instance of the AdminRuleListResultPage type. +func NewAdminRuleListResultPage(cur AdminRuleListResult, getNextPage func(context.Context, AdminRuleListResult) (AdminRuleListResult, error)) AdminRuleListResultPage { + return AdminRuleListResultPage{ + fn: getNextPage, + arlr: cur, + } +} + +// AdminRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AdminRulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AdminRulesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AdminRulesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AdminRulesDeleteFuture.Result. +func (future *AdminRulesDeleteFuture) result(client AdminRulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AdminRulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.AdminRulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ApplicationGateway application gateway resource. +type ApplicationGateway struct { + autorest.Response `json:"-"` + // ApplicationGatewayPropertiesFormat - Properties of the application gateway. + *ApplicationGatewayPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Zones - A list of availability zones denoting where the resource needs to come from. + Zones *[]string `json:"zones,omitempty"` + // Identity - The identity of the application gateway, if configured. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ApplicationGateway. +func (ag ApplicationGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ag.ApplicationGatewayPropertiesFormat != nil { + objectMap["properties"] = ag.ApplicationGatewayPropertiesFormat + } + if ag.Zones != nil { + objectMap["zones"] = ag.Zones + } + if ag.Identity != nil { + objectMap["identity"] = ag.Identity + } + if ag.ID != nil { + objectMap["id"] = ag.ID + } + if ag.Location != nil { + objectMap["location"] = ag.Location + } + if ag.Tags != nil { + objectMap["tags"] = ag.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGateway struct. +func (ag *ApplicationGateway) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayPropertiesFormat ApplicationGatewayPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayPropertiesFormat) + if err != nil { + return err + } + ag.ApplicationGatewayPropertiesFormat = &applicationGatewayPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ag.Etag = &etag + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + ag.Zones = &zones + } + case "identity": + if v != nil { + var identity ManagedServiceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + ag.Identity = &identity + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ag.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ag.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ag.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ag.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ag.Tags = tags + } + } + } + + return nil +} + +// ApplicationGatewayAuthenticationCertificate authentication certificates of an application gateway. +type ApplicationGatewayAuthenticationCertificate struct { + // ApplicationGatewayAuthenticationCertificatePropertiesFormat - Properties of the application gateway authentication certificate. + *ApplicationGatewayAuthenticationCertificatePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the authentication certificate that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayAuthenticationCertificate. +func (agac ApplicationGatewayAuthenticationCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agac.ApplicationGatewayAuthenticationCertificatePropertiesFormat != nil { + objectMap["properties"] = agac.ApplicationGatewayAuthenticationCertificatePropertiesFormat + } + if agac.Name != nil { + objectMap["name"] = agac.Name + } + if agac.ID != nil { + objectMap["id"] = agac.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayAuthenticationCertificate struct. +func (agac *ApplicationGatewayAuthenticationCertificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayAuthenticationCertificatePropertiesFormat ApplicationGatewayAuthenticationCertificatePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayAuthenticationCertificatePropertiesFormat) + if err != nil { + return err + } + agac.ApplicationGatewayAuthenticationCertificatePropertiesFormat = &applicationGatewayAuthenticationCertificatePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agac.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agac.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agac.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agac.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayAuthenticationCertificatePropertiesFormat authentication certificates properties of an +// application gateway. +type ApplicationGatewayAuthenticationCertificatePropertiesFormat struct { + // Data - Certificate public data. + Data *string `json:"data,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the authentication certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayAuthenticationCertificatePropertiesFormat. +func (agacpf ApplicationGatewayAuthenticationCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agacpf.Data != nil { + objectMap["data"] = agacpf.Data + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayAutoscaleConfiguration application Gateway autoscale configuration. +type ApplicationGatewayAutoscaleConfiguration struct { + // MinCapacity - Lower bound on number of Application Gateway capacity. + MinCapacity *int32 `json:"minCapacity,omitempty"` + // MaxCapacity - Upper bound on number of Application Gateway capacity. + MaxCapacity *int32 `json:"maxCapacity,omitempty"` +} + +// ApplicationGatewayAvailableSslOptions response for ApplicationGatewayAvailableSslOptions API service +// call. +type ApplicationGatewayAvailableSslOptions struct { + autorest.Response `json:"-"` + // ApplicationGatewayAvailableSslOptionsPropertiesFormat - Properties of the application gateway available SSL options. + *ApplicationGatewayAvailableSslOptionsPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayAvailableSslOptions. +func (agaso ApplicationGatewayAvailableSslOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agaso.ApplicationGatewayAvailableSslOptionsPropertiesFormat != nil { + objectMap["properties"] = agaso.ApplicationGatewayAvailableSslOptionsPropertiesFormat + } + if agaso.ID != nil { + objectMap["id"] = agaso.ID + } + if agaso.Location != nil { + objectMap["location"] = agaso.Location + } + if agaso.Tags != nil { + objectMap["tags"] = agaso.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayAvailableSslOptions struct. +func (agaso *ApplicationGatewayAvailableSslOptions) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayAvailableSslOptionsPropertiesFormat ApplicationGatewayAvailableSslOptionsPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayAvailableSslOptionsPropertiesFormat) + if err != nil { + return err + } + agaso.ApplicationGatewayAvailableSslOptionsPropertiesFormat = &applicationGatewayAvailableSslOptionsPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agaso.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agaso.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agaso.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + agaso.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + agaso.Tags = tags + } + } + } + + return nil +} + +// ApplicationGatewayAvailableSslOptionsPropertiesFormat properties of +// ApplicationGatewayAvailableSslOptions. +type ApplicationGatewayAvailableSslOptionsPropertiesFormat struct { + // PredefinedPolicies - List of available Ssl predefined policy. + PredefinedPolicies *[]SubResource `json:"predefinedPolicies,omitempty"` + // DefaultPolicy - Name of the Ssl predefined policy applied by default to application gateway. Possible values include: 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20150501', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401S', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101S' + DefaultPolicy ApplicationGatewaySslPolicyName `json:"defaultPolicy,omitempty"` + // AvailableCipherSuites - List of available Ssl cipher suites. + AvailableCipherSuites *[]ApplicationGatewaySslCipherSuite `json:"availableCipherSuites,omitempty"` + // AvailableProtocols - List of available Ssl protocols. + AvailableProtocols *[]ApplicationGatewaySslProtocol `json:"availableProtocols,omitempty"` +} + +// ApplicationGatewayAvailableSslPredefinedPolicies response for ApplicationGatewayAvailableSslOptions API +// service call. +type ApplicationGatewayAvailableSslPredefinedPolicies struct { + autorest.Response `json:"-"` + // Value - List of available Ssl predefined policy. + Value *[]ApplicationGatewaySslPredefinedPolicy `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplicationGatewayAvailableSslPredefinedPoliciesIterator provides access to a complete listing of +// ApplicationGatewaySslPredefinedPolicy values. +type ApplicationGatewayAvailableSslPredefinedPoliciesIterator struct { + i int + page ApplicationGatewayAvailableSslPredefinedPoliciesPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ApplicationGatewayAvailableSslPredefinedPoliciesIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayAvailableSslPredefinedPoliciesIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationGatewayAvailableSslPredefinedPoliciesIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationGatewayAvailableSslPredefinedPoliciesIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ApplicationGatewayAvailableSslPredefinedPoliciesIterator) Response() ApplicationGatewayAvailableSslPredefinedPolicies { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ApplicationGatewayAvailableSslPredefinedPoliciesIterator) Value() ApplicationGatewaySslPredefinedPolicy { + if !iter.page.NotDone() { + return ApplicationGatewaySslPredefinedPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ApplicationGatewayAvailableSslPredefinedPoliciesIterator type. +func NewApplicationGatewayAvailableSslPredefinedPoliciesIterator(page ApplicationGatewayAvailableSslPredefinedPoliciesPage) ApplicationGatewayAvailableSslPredefinedPoliciesIterator { + return ApplicationGatewayAvailableSslPredefinedPoliciesIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (agaspp ApplicationGatewayAvailableSslPredefinedPolicies) IsEmpty() bool { + return agaspp.Value == nil || len(*agaspp.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (agaspp ApplicationGatewayAvailableSslPredefinedPolicies) hasNextLink() bool { + return agaspp.NextLink != nil && len(*agaspp.NextLink) != 0 +} + +// applicationGatewayAvailableSslPredefinedPoliciesPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (agaspp ApplicationGatewayAvailableSslPredefinedPolicies) applicationGatewayAvailableSslPredefinedPoliciesPreparer(ctx context.Context) (*http.Request, error) { + if !agaspp.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(agaspp.NextLink))) +} + +// ApplicationGatewayAvailableSslPredefinedPoliciesPage contains a page of +// ApplicationGatewaySslPredefinedPolicy values. +type ApplicationGatewayAvailableSslPredefinedPoliciesPage struct { + fn func(context.Context, ApplicationGatewayAvailableSslPredefinedPolicies) (ApplicationGatewayAvailableSslPredefinedPolicies, error) + agaspp ApplicationGatewayAvailableSslPredefinedPolicies +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ApplicationGatewayAvailableSslPredefinedPoliciesPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayAvailableSslPredefinedPoliciesPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.agaspp) + if err != nil { + return err + } + page.agaspp = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationGatewayAvailableSslPredefinedPoliciesPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationGatewayAvailableSslPredefinedPoliciesPage) NotDone() bool { + return !page.agaspp.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationGatewayAvailableSslPredefinedPoliciesPage) Response() ApplicationGatewayAvailableSslPredefinedPolicies { + return page.agaspp +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationGatewayAvailableSslPredefinedPoliciesPage) Values() []ApplicationGatewaySslPredefinedPolicy { + if page.agaspp.IsEmpty() { + return nil + } + return *page.agaspp.Value +} + +// Creates a new instance of the ApplicationGatewayAvailableSslPredefinedPoliciesPage type. +func NewApplicationGatewayAvailableSslPredefinedPoliciesPage(cur ApplicationGatewayAvailableSslPredefinedPolicies, getNextPage func(context.Context, ApplicationGatewayAvailableSslPredefinedPolicies) (ApplicationGatewayAvailableSslPredefinedPolicies, error)) ApplicationGatewayAvailableSslPredefinedPoliciesPage { + return ApplicationGatewayAvailableSslPredefinedPoliciesPage{ + fn: getNextPage, + agaspp: cur, + } +} + +// ApplicationGatewayAvailableWafRuleSetsResult response for ApplicationGatewayAvailableWafRuleSets API +// service call. +type ApplicationGatewayAvailableWafRuleSetsResult struct { + autorest.Response `json:"-"` + // Value - The list of application gateway rule sets. + Value *[]ApplicationGatewayFirewallRuleSet `json:"value,omitempty"` +} + +// ApplicationGatewayBackendAddress backend address of an application gateway. +type ApplicationGatewayBackendAddress struct { + // Fqdn - Fully qualified domain name (FQDN). + Fqdn *string `json:"fqdn,omitempty"` + // IPAddress - IP address. + IPAddress *string `json:"ipAddress,omitempty"` +} + +// ApplicationGatewayBackendAddressPool backend Address Pool of an application gateway. +type ApplicationGatewayBackendAddressPool struct { + // ApplicationGatewayBackendAddressPoolPropertiesFormat - Properties of the application gateway backend address pool. + *ApplicationGatewayBackendAddressPoolPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the backend address pool that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayBackendAddressPool. +func (agbap ApplicationGatewayBackendAddressPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agbap.ApplicationGatewayBackendAddressPoolPropertiesFormat != nil { + objectMap["properties"] = agbap.ApplicationGatewayBackendAddressPoolPropertiesFormat + } + if agbap.Name != nil { + objectMap["name"] = agbap.Name + } + if agbap.ID != nil { + objectMap["id"] = agbap.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayBackendAddressPool struct. +func (agbap *ApplicationGatewayBackendAddressPool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayBackendAddressPoolPropertiesFormat ApplicationGatewayBackendAddressPoolPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayBackendAddressPoolPropertiesFormat) + if err != nil { + return err + } + agbap.ApplicationGatewayBackendAddressPoolPropertiesFormat = &applicationGatewayBackendAddressPoolPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agbap.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agbap.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agbap.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agbap.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayBackendAddressPoolPropertiesFormat properties of Backend Address Pool of an +// application gateway. +type ApplicationGatewayBackendAddressPoolPropertiesFormat struct { + // BackendIPConfigurations - READ-ONLY; Collection of references to IPs defined in network interfaces. + BackendIPConfigurations *[]InterfaceIPConfiguration `json:"backendIPConfigurations,omitempty"` + // BackendAddresses - Backend addresses. + BackendAddresses *[]ApplicationGatewayBackendAddress `json:"backendAddresses,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the backend address pool resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayBackendAddressPoolPropertiesFormat. +func (agbappf ApplicationGatewayBackendAddressPoolPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agbappf.BackendAddresses != nil { + objectMap["backendAddresses"] = agbappf.BackendAddresses + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayBackendHTTPSettings backend address pool settings of an application gateway. +type ApplicationGatewayBackendHTTPSettings struct { + // ApplicationGatewayBackendHTTPSettingsPropertiesFormat - Properties of the application gateway backend HTTP settings. + *ApplicationGatewayBackendHTTPSettingsPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the backend http settings that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayBackendHTTPSettings. +func (agbhs ApplicationGatewayBackendHTTPSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agbhs.ApplicationGatewayBackendHTTPSettingsPropertiesFormat != nil { + objectMap["properties"] = agbhs.ApplicationGatewayBackendHTTPSettingsPropertiesFormat + } + if agbhs.Name != nil { + objectMap["name"] = agbhs.Name + } + if agbhs.ID != nil { + objectMap["id"] = agbhs.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayBackendHTTPSettings struct. +func (agbhs *ApplicationGatewayBackendHTTPSettings) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayBackendHTTPSettingsPropertiesFormat ApplicationGatewayBackendHTTPSettingsPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayBackendHTTPSettingsPropertiesFormat) + if err != nil { + return err + } + agbhs.ApplicationGatewayBackendHTTPSettingsPropertiesFormat = &applicationGatewayBackendHTTPSettingsPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agbhs.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agbhs.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agbhs.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agbhs.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayBackendHTTPSettingsPropertiesFormat properties of Backend address pool settings of an +// application gateway. +type ApplicationGatewayBackendHTTPSettingsPropertiesFormat struct { + // Port - The destination port on the backend. + Port *int32 `json:"port,omitempty"` + // Protocol - The protocol used to communicate with the backend. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + // CookieBasedAffinity - Cookie based affinity. Possible values include: 'ApplicationGatewayCookieBasedAffinityEnabled', 'ApplicationGatewayCookieBasedAffinityDisabled' + CookieBasedAffinity ApplicationGatewayCookieBasedAffinity `json:"cookieBasedAffinity,omitempty"` + // RequestTimeout - 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. + RequestTimeout *int32 `json:"requestTimeout,omitempty"` + // Probe - Probe resource of an application gateway. + Probe *SubResource `json:"probe,omitempty"` + // AuthenticationCertificates - Array of references to application gateway authentication certificates. + AuthenticationCertificates *[]SubResource `json:"authenticationCertificates,omitempty"` + // TrustedRootCertificates - Array of references to application gateway trusted root certificates. + TrustedRootCertificates *[]SubResource `json:"trustedRootCertificates,omitempty"` + // ConnectionDraining - Connection draining of the backend http settings resource. + ConnectionDraining *ApplicationGatewayConnectionDraining `json:"connectionDraining,omitempty"` + // HostName - Host header to be sent to the backend servers. + HostName *string `json:"hostName,omitempty"` + // PickHostNameFromBackendAddress - Whether to pick host header should be picked from the host name of the backend server. Default value is false. + PickHostNameFromBackendAddress *bool `json:"pickHostNameFromBackendAddress,omitempty"` + // AffinityCookieName - Cookie name to use for the affinity cookie. + AffinityCookieName *string `json:"affinityCookieName,omitempty"` + // ProbeEnabled - Whether the probe is enabled. Default value is false. + ProbeEnabled *bool `json:"probeEnabled,omitempty"` + // Path - Path which should be used as a prefix for all HTTP requests. Null means no path will be prefixed. Default value is null. + Path *string `json:"path,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the backend HTTP settings resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayBackendHTTPSettingsPropertiesFormat. +func (agbhspf ApplicationGatewayBackendHTTPSettingsPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agbhspf.Port != nil { + objectMap["port"] = agbhspf.Port + } + if agbhspf.Protocol != "" { + objectMap["protocol"] = agbhspf.Protocol + } + if agbhspf.CookieBasedAffinity != "" { + objectMap["cookieBasedAffinity"] = agbhspf.CookieBasedAffinity + } + if agbhspf.RequestTimeout != nil { + objectMap["requestTimeout"] = agbhspf.RequestTimeout + } + if agbhspf.Probe != nil { + objectMap["probe"] = agbhspf.Probe + } + if agbhspf.AuthenticationCertificates != nil { + objectMap["authenticationCertificates"] = agbhspf.AuthenticationCertificates + } + if agbhspf.TrustedRootCertificates != nil { + objectMap["trustedRootCertificates"] = agbhspf.TrustedRootCertificates + } + if agbhspf.ConnectionDraining != nil { + objectMap["connectionDraining"] = agbhspf.ConnectionDraining + } + if agbhspf.HostName != nil { + objectMap["hostName"] = agbhspf.HostName + } + if agbhspf.PickHostNameFromBackendAddress != nil { + objectMap["pickHostNameFromBackendAddress"] = agbhspf.PickHostNameFromBackendAddress + } + if agbhspf.AffinityCookieName != nil { + objectMap["affinityCookieName"] = agbhspf.AffinityCookieName + } + if agbhspf.ProbeEnabled != nil { + objectMap["probeEnabled"] = agbhspf.ProbeEnabled + } + if agbhspf.Path != nil { + objectMap["path"] = agbhspf.Path + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayBackendHealth response for ApplicationGatewayBackendHealth API service call. +type ApplicationGatewayBackendHealth struct { + autorest.Response `json:"-"` + // BackendAddressPools - A list of ApplicationGatewayBackendHealthPool resources. + BackendAddressPools *[]ApplicationGatewayBackendHealthPool `json:"backendAddressPools,omitempty"` +} + +// ApplicationGatewayBackendHealthHTTPSettings application gateway BackendHealthHttp settings. +type ApplicationGatewayBackendHealthHTTPSettings struct { + // BackendHTTPSettings - Reference to an ApplicationGatewayBackendHttpSettings resource. + BackendHTTPSettings *ApplicationGatewayBackendHTTPSettings `json:"backendHttpSettings,omitempty"` + // Servers - List of ApplicationGatewayBackendHealthServer resources. + Servers *[]ApplicationGatewayBackendHealthServer `json:"servers,omitempty"` +} + +// ApplicationGatewayBackendHealthOnDemand result of on demand test probe. +type ApplicationGatewayBackendHealthOnDemand struct { + autorest.Response `json:"-"` + // BackendAddressPool - Reference to an ApplicationGatewayBackendAddressPool resource. + BackendAddressPool *ApplicationGatewayBackendAddressPool `json:"backendAddressPool,omitempty"` + // BackendHealthHTTPSettings - Application gateway BackendHealthHttp settings. + BackendHealthHTTPSettings *ApplicationGatewayBackendHealthHTTPSettings `json:"backendHealthHttpSettings,omitempty"` +} + +// ApplicationGatewayBackendHealthPool application gateway BackendHealth pool. +type ApplicationGatewayBackendHealthPool struct { + // BackendAddressPool - Reference to an ApplicationGatewayBackendAddressPool resource. + BackendAddressPool *ApplicationGatewayBackendAddressPool `json:"backendAddressPool,omitempty"` + // BackendHTTPSettingsCollection - List of ApplicationGatewayBackendHealthHttpSettings resources. + BackendHTTPSettingsCollection *[]ApplicationGatewayBackendHealthHTTPSettings `json:"backendHttpSettingsCollection,omitempty"` +} + +// ApplicationGatewayBackendHealthServer application gateway backendhealth http settings. +type ApplicationGatewayBackendHealthServer struct { + // Address - IP address or FQDN of backend server. + Address *string `json:"address,omitempty"` + // IPConfiguration - Reference to IP configuration of backend server. + IPConfiguration *InterfaceIPConfiguration `json:"ipConfiguration,omitempty"` + // Health - Health of backend server. Possible values include: 'ApplicationGatewayBackendHealthServerHealthUnknown', 'ApplicationGatewayBackendHealthServerHealthUp', 'ApplicationGatewayBackendHealthServerHealthDown', 'ApplicationGatewayBackendHealthServerHealthPartial', 'ApplicationGatewayBackendHealthServerHealthDraining' + Health ApplicationGatewayBackendHealthServerHealth `json:"health,omitempty"` + // HealthProbeLog - Health Probe Log. + HealthProbeLog *string `json:"healthProbeLog,omitempty"` +} + +// ApplicationGatewayBackendSettings backend address pool settings of an application gateway. +type ApplicationGatewayBackendSettings struct { + // ApplicationGatewayBackendSettingsPropertiesFormat - Properties of the application gateway backend settings. + *ApplicationGatewayBackendSettingsPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the backend settings that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayBackendSettings. +func (agbs ApplicationGatewayBackendSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agbs.ApplicationGatewayBackendSettingsPropertiesFormat != nil { + objectMap["properties"] = agbs.ApplicationGatewayBackendSettingsPropertiesFormat + } + if agbs.Name != nil { + objectMap["name"] = agbs.Name + } + if agbs.ID != nil { + objectMap["id"] = agbs.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayBackendSettings struct. +func (agbs *ApplicationGatewayBackendSettings) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayBackendSettingsPropertiesFormat ApplicationGatewayBackendSettingsPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayBackendSettingsPropertiesFormat) + if err != nil { + return err + } + agbs.ApplicationGatewayBackendSettingsPropertiesFormat = &applicationGatewayBackendSettingsPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agbs.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agbs.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agbs.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agbs.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayBackendSettingsPropertiesFormat properties of Backend address pool settings of an +// application gateway. +type ApplicationGatewayBackendSettingsPropertiesFormat struct { + // Port - The destination port on the backend. + Port *int32 `json:"port,omitempty"` + // Protocol - The protocol used to communicate with the backend. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + // Timeout - 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. + Timeout *int32 `json:"timeout,omitempty"` + // Probe - Probe resource of an application gateway. + Probe *SubResource `json:"probe,omitempty"` + // TrustedRootCertificates - Array of references to application gateway trusted root certificates. + TrustedRootCertificates *[]SubResource `json:"trustedRootCertificates,omitempty"` + // HostName - Server name indication to be sent to the backend servers for Tls protocol. + HostName *string `json:"hostName,omitempty"` + // PickHostNameFromBackendAddress - Whether to pick server name indication from the host name of the backend server for Tls protocol. Default value is false. + PickHostNameFromBackendAddress *bool `json:"pickHostNameFromBackendAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the backend HTTP settings resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayBackendSettingsPropertiesFormat. +func (agbspf ApplicationGatewayBackendSettingsPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agbspf.Port != nil { + objectMap["port"] = agbspf.Port + } + if agbspf.Protocol != "" { + objectMap["protocol"] = agbspf.Protocol + } + if agbspf.Timeout != nil { + objectMap["timeout"] = agbspf.Timeout + } + if agbspf.Probe != nil { + objectMap["probe"] = agbspf.Probe + } + if agbspf.TrustedRootCertificates != nil { + objectMap["trustedRootCertificates"] = agbspf.TrustedRootCertificates + } + if agbspf.HostName != nil { + objectMap["hostName"] = agbspf.HostName + } + if agbspf.PickHostNameFromBackendAddress != nil { + objectMap["pickHostNameFromBackendAddress"] = agbspf.PickHostNameFromBackendAddress + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayClientAuthConfiguration application gateway client authentication configuration. +type ApplicationGatewayClientAuthConfiguration struct { + // VerifyClientCertIssuerDN - Verify client certificate issuer name on the application gateway. + VerifyClientCertIssuerDN *bool `json:"verifyClientCertIssuerDN,omitempty"` + // VerifyClientRevocation - Verify client certificate revocation status. Possible values include: 'ApplicationGatewayClientRevocationOptionsNone', 'ApplicationGatewayClientRevocationOptionsOCSP' + VerifyClientRevocation ApplicationGatewayClientRevocationOptions `json:"verifyClientRevocation,omitempty"` +} + +// ApplicationGatewayConnectionDraining 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. +type ApplicationGatewayConnectionDraining struct { + // Enabled - Whether connection draining is enabled or not. + Enabled *bool `json:"enabled,omitempty"` + // DrainTimeoutInSec - The number of seconds connection draining is active. Acceptable values are from 1 second to 3600 seconds. + DrainTimeoutInSec *int32 `json:"drainTimeoutInSec,omitempty"` +} + +// ApplicationGatewayCustomError customer error of an application gateway. +type ApplicationGatewayCustomError struct { + // StatusCode - Status code of the application gateway customer error. Possible values include: 'ApplicationGatewayCustomErrorStatusCodeHTTPStatus403', 'ApplicationGatewayCustomErrorStatusCodeHTTPStatus502' + StatusCode ApplicationGatewayCustomErrorStatusCode `json:"statusCode,omitempty"` + // CustomErrorPageURL - Error page URL of the application gateway customer error. + CustomErrorPageURL *string `json:"customErrorPageUrl,omitempty"` +} + +// ApplicationGatewayFirewallDisabledRuleGroup allows to disable rules within a rule group or an entire +// rule group. +type ApplicationGatewayFirewallDisabledRuleGroup struct { + // RuleGroupName - The name of the rule group that will be disabled. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + // Rules - The list of rules that will be disabled. If null, all rules of the rule group will be disabled. + Rules *[]int32 `json:"rules,omitempty"` +} + +// ApplicationGatewayFirewallExclusion allow to exclude some variable satisfy the condition for the WAF +// check. +type ApplicationGatewayFirewallExclusion struct { + // MatchVariable - The variable to be excluded. + MatchVariable *string `json:"matchVariable,omitempty"` + // SelectorMatchOperator - When matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to. + SelectorMatchOperator *string `json:"selectorMatchOperator,omitempty"` + // Selector - When matchVariable is a collection, operator used to specify which elements in the collection this exclusion applies to. + Selector *string `json:"selector,omitempty"` +} + +// ApplicationGatewayFirewallManifestRuleSet properties of the web application firewall rule set. +type ApplicationGatewayFirewallManifestRuleSet struct { + // RuleSetType - The type of the web application firewall rule set. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - The version of the web application firewall rule set type. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + // Status - The rule set status. Possible values include: 'ApplicationGatewayRuleSetStatusOptionsPreview', 'ApplicationGatewayRuleSetStatusOptionsGA', 'ApplicationGatewayRuleSetStatusOptionsSupported', 'ApplicationGatewayRuleSetStatusOptionsDeprecated' + Status ApplicationGatewayRuleSetStatusOptions `json:"status,omitempty"` + // Tiers - Tier of an application gateway that support the rule set. + Tiers *[]ApplicationGatewayTierTypes `json:"tiers,omitempty"` + // RuleGroups - The rule groups of the web application firewall rule set. + RuleGroups *[]ApplicationGatewayFirewallRuleGroup `json:"ruleGroups,omitempty"` +} + +// ApplicationGatewayFirewallRule a web application firewall rule. +type ApplicationGatewayFirewallRule struct { + // RuleID - The identifier of the web application firewall rule. + RuleID *int32 `json:"ruleId,omitempty"` + // RuleIDString - The string representation of the web application firewall rule identifier. + RuleIDString *string `json:"ruleIdString,omitempty"` + // State - The string representation of the web application firewall rule state. Possible values include: 'ApplicationGatewayWafRuleStateTypesEnabled', 'ApplicationGatewayWafRuleStateTypesDisabled' + State ApplicationGatewayWafRuleStateTypes `json:"state,omitempty"` + // Action - The string representation of the web application firewall rule action. Possible values include: 'ApplicationGatewayWafRuleActionTypesNone', 'ApplicationGatewayWafRuleActionTypesAnomalyScoring', 'ApplicationGatewayWafRuleActionTypesAllow', 'ApplicationGatewayWafRuleActionTypesBlock', 'ApplicationGatewayWafRuleActionTypesLog' + Action ApplicationGatewayWafRuleActionTypes `json:"action,omitempty"` + // Description - The description of the web application firewall rule. + Description *string `json:"description,omitempty"` +} + +// ApplicationGatewayFirewallRuleGroup a web application firewall rule group. +type ApplicationGatewayFirewallRuleGroup struct { + // RuleGroupName - The name of the web application firewall rule group. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + // Description - The description of the web application firewall rule group. + Description *string `json:"description,omitempty"` + // Rules - The rules of the web application firewall rule group. + Rules *[]ApplicationGatewayFirewallRule `json:"rules,omitempty"` +} + +// ApplicationGatewayFirewallRuleSet a web application firewall rule set. +type ApplicationGatewayFirewallRuleSet struct { + // ApplicationGatewayFirewallRuleSetPropertiesFormat - Properties of the application gateway firewall rule set. + *ApplicationGatewayFirewallRuleSetPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayFirewallRuleSet. +func (agfrs ApplicationGatewayFirewallRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agfrs.ApplicationGatewayFirewallRuleSetPropertiesFormat != nil { + objectMap["properties"] = agfrs.ApplicationGatewayFirewallRuleSetPropertiesFormat + } + if agfrs.ID != nil { + objectMap["id"] = agfrs.ID + } + if agfrs.Location != nil { + objectMap["location"] = agfrs.Location + } + if agfrs.Tags != nil { + objectMap["tags"] = agfrs.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayFirewallRuleSet struct. +func (agfrs *ApplicationGatewayFirewallRuleSet) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayFirewallRuleSetPropertiesFormat ApplicationGatewayFirewallRuleSetPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayFirewallRuleSetPropertiesFormat) + if err != nil { + return err + } + agfrs.ApplicationGatewayFirewallRuleSetPropertiesFormat = &applicationGatewayFirewallRuleSetPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agfrs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agfrs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agfrs.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + agfrs.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + agfrs.Tags = tags + } + } + } + + return nil +} + +// ApplicationGatewayFirewallRuleSetPropertiesFormat properties of the web application firewall rule set. +type ApplicationGatewayFirewallRuleSetPropertiesFormat struct { + // ProvisioningState - READ-ONLY; The provisioning state of the web application firewall rule set. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // RuleSetType - The type of the web application firewall rule set. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - The version of the web application firewall rule set type. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + // RuleGroups - The rule groups of the web application firewall rule set. + RuleGroups *[]ApplicationGatewayFirewallRuleGroup `json:"ruleGroups,omitempty"` + // Tiers - Tier of an application gateway that support the rule set. + Tiers *[]ApplicationGatewayTierTypes `json:"tiers,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayFirewallRuleSetPropertiesFormat. +func (agfrspf ApplicationGatewayFirewallRuleSetPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agfrspf.RuleSetType != nil { + objectMap["ruleSetType"] = agfrspf.RuleSetType + } + if agfrspf.RuleSetVersion != nil { + objectMap["ruleSetVersion"] = agfrspf.RuleSetVersion + } + if agfrspf.RuleGroups != nil { + objectMap["ruleGroups"] = agfrspf.RuleGroups + } + if agfrspf.Tiers != nil { + objectMap["tiers"] = agfrspf.Tiers + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayFrontendIPConfiguration frontend IP configuration of an application gateway. +type ApplicationGatewayFrontendIPConfiguration struct { + // ApplicationGatewayFrontendIPConfigurationPropertiesFormat - Properties of the application gateway frontend IP configuration. + *ApplicationGatewayFrontendIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the frontend IP configuration that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayFrontendIPConfiguration. +func (agfic ApplicationGatewayFrontendIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agfic.ApplicationGatewayFrontendIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = agfic.ApplicationGatewayFrontendIPConfigurationPropertiesFormat + } + if agfic.Name != nil { + objectMap["name"] = agfic.Name + } + if agfic.ID != nil { + objectMap["id"] = agfic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayFrontendIPConfiguration struct. +func (agfic *ApplicationGatewayFrontendIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayFrontendIPConfigurationPropertiesFormat ApplicationGatewayFrontendIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayFrontendIPConfigurationPropertiesFormat) + if err != nil { + return err + } + agfic.ApplicationGatewayFrontendIPConfigurationPropertiesFormat = &applicationGatewayFrontendIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agfic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agfic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agfic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agfic.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayFrontendIPConfigurationPropertiesFormat properties of Frontend IP configuration of an +// application gateway. +type ApplicationGatewayFrontendIPConfigurationPropertiesFormat struct { + // PrivateIPAddress - PrivateIPAddress of the network interface IP Configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // Subnet - Reference to the subnet resource. + Subnet *SubResource `json:"subnet,omitempty"` + // PublicIPAddress - Reference to the PublicIP resource. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` + // PrivateLinkConfiguration - Reference to the application gateway private link configuration. + PrivateLinkConfiguration *SubResource `json:"privateLinkConfiguration,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the frontend IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayFrontendIPConfigurationPropertiesFormat. +func (agficpf ApplicationGatewayFrontendIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agficpf.PrivateIPAddress != nil { + objectMap["privateIPAddress"] = agficpf.PrivateIPAddress + } + if agficpf.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = agficpf.PrivateIPAllocationMethod + } + if agficpf.Subnet != nil { + objectMap["subnet"] = agficpf.Subnet + } + if agficpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = agficpf.PublicIPAddress + } + if agficpf.PrivateLinkConfiguration != nil { + objectMap["privateLinkConfiguration"] = agficpf.PrivateLinkConfiguration + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayFrontendPort frontend port of an application gateway. +type ApplicationGatewayFrontendPort struct { + // ApplicationGatewayFrontendPortPropertiesFormat - Properties of the application gateway frontend port. + *ApplicationGatewayFrontendPortPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the frontend port that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayFrontendPort. +func (agfp ApplicationGatewayFrontendPort) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agfp.ApplicationGatewayFrontendPortPropertiesFormat != nil { + objectMap["properties"] = agfp.ApplicationGatewayFrontendPortPropertiesFormat + } + if agfp.Name != nil { + objectMap["name"] = agfp.Name + } + if agfp.ID != nil { + objectMap["id"] = agfp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayFrontendPort struct. +func (agfp *ApplicationGatewayFrontendPort) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayFrontendPortPropertiesFormat ApplicationGatewayFrontendPortPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayFrontendPortPropertiesFormat) + if err != nil { + return err + } + agfp.ApplicationGatewayFrontendPortPropertiesFormat = &applicationGatewayFrontendPortPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agfp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agfp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agfp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agfp.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayFrontendPortPropertiesFormat properties of Frontend port of an application gateway. +type ApplicationGatewayFrontendPortPropertiesFormat struct { + // Port - Frontend port. + Port *int32 `json:"port,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the frontend port resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayFrontendPortPropertiesFormat. +func (agfppf ApplicationGatewayFrontendPortPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agfppf.Port != nil { + objectMap["port"] = agfppf.Port + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayGlobalConfiguration application Gateway global configuration. +type ApplicationGatewayGlobalConfiguration struct { + // EnableRequestBuffering - Enable request buffering. + EnableRequestBuffering *bool `json:"enableRequestBuffering,omitempty"` + // EnableResponseBuffering - Enable response buffering. + EnableResponseBuffering *bool `json:"enableResponseBuffering,omitempty"` +} + +// ApplicationGatewayHTTPListener http listener of an application gateway. +type ApplicationGatewayHTTPListener struct { + // ApplicationGatewayHTTPListenerPropertiesFormat - Properties of the application gateway HTTP listener. + *ApplicationGatewayHTTPListenerPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the HTTP listener that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayHTTPListener. +func (aghl ApplicationGatewayHTTPListener) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aghl.ApplicationGatewayHTTPListenerPropertiesFormat != nil { + objectMap["properties"] = aghl.ApplicationGatewayHTTPListenerPropertiesFormat + } + if aghl.Name != nil { + objectMap["name"] = aghl.Name + } + if aghl.ID != nil { + objectMap["id"] = aghl.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayHTTPListener struct. +func (aghl *ApplicationGatewayHTTPListener) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayHTTPListenerPropertiesFormat ApplicationGatewayHTTPListenerPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayHTTPListenerPropertiesFormat) + if err != nil { + return err + } + aghl.ApplicationGatewayHTTPListenerPropertiesFormat = &applicationGatewayHTTPListenerPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + aghl.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + aghl.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + aghl.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + aghl.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayHTTPListenerPropertiesFormat properties of HTTP listener of an application gateway. +type ApplicationGatewayHTTPListenerPropertiesFormat struct { + // FrontendIPConfiguration - Frontend IP configuration resource of an application gateway. + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + // FrontendPort - Frontend port resource of an application gateway. + FrontendPort *SubResource `json:"frontendPort,omitempty"` + // Protocol - Protocol of the HTTP listener. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + // HostName - Host name of HTTP listener. + HostName *string `json:"hostName,omitempty"` + // SslCertificate - SSL certificate resource of an application gateway. + SslCertificate *SubResource `json:"sslCertificate,omitempty"` + // SslProfile - SSL profile resource of the application gateway. + SslProfile *SubResource `json:"sslProfile,omitempty"` + // RequireServerNameIndication - Applicable only if protocol is https. Enables SNI for multi-hosting. + RequireServerNameIndication *bool `json:"requireServerNameIndication,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the HTTP listener resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // CustomErrorConfigurations - Custom error configurations of the HTTP listener. + CustomErrorConfigurations *[]ApplicationGatewayCustomError `json:"customErrorConfigurations,omitempty"` + // FirewallPolicy - Reference to the FirewallPolicy resource. + FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` + // HostNames - List of Host names for HTTP Listener that allows special wildcard characters as well. + HostNames *[]string `json:"hostNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayHTTPListenerPropertiesFormat. +func (aghlpf ApplicationGatewayHTTPListenerPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aghlpf.FrontendIPConfiguration != nil { + objectMap["frontendIPConfiguration"] = aghlpf.FrontendIPConfiguration + } + if aghlpf.FrontendPort != nil { + objectMap["frontendPort"] = aghlpf.FrontendPort + } + if aghlpf.Protocol != "" { + objectMap["protocol"] = aghlpf.Protocol + } + if aghlpf.HostName != nil { + objectMap["hostName"] = aghlpf.HostName + } + if aghlpf.SslCertificate != nil { + objectMap["sslCertificate"] = aghlpf.SslCertificate + } + if aghlpf.SslProfile != nil { + objectMap["sslProfile"] = aghlpf.SslProfile + } + if aghlpf.RequireServerNameIndication != nil { + objectMap["requireServerNameIndication"] = aghlpf.RequireServerNameIndication + } + if aghlpf.CustomErrorConfigurations != nil { + objectMap["customErrorConfigurations"] = aghlpf.CustomErrorConfigurations + } + if aghlpf.FirewallPolicy != nil { + objectMap["firewallPolicy"] = aghlpf.FirewallPolicy + } + if aghlpf.HostNames != nil { + objectMap["hostNames"] = aghlpf.HostNames + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayHeaderConfiguration header configuration of the Actions set in Application Gateway. +type ApplicationGatewayHeaderConfiguration struct { + // HeaderName - Header name of the header configuration. + HeaderName *string `json:"headerName,omitempty"` + // HeaderValue - Header value of the header configuration. + HeaderValue *string `json:"headerValue,omitempty"` +} + +// ApplicationGatewayIPConfiguration IP configuration of an application gateway. Currently 1 public and 1 +// private IP configuration is allowed. +type ApplicationGatewayIPConfiguration struct { + // ApplicationGatewayIPConfigurationPropertiesFormat - Properties of the application gateway IP configuration. + *ApplicationGatewayIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the IP configuration that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayIPConfiguration. +func (agic ApplicationGatewayIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agic.ApplicationGatewayIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = agic.ApplicationGatewayIPConfigurationPropertiesFormat + } + if agic.Name != nil { + objectMap["name"] = agic.Name + } + if agic.ID != nil { + objectMap["id"] = agic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayIPConfiguration struct. +func (agic *ApplicationGatewayIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayIPConfigurationPropertiesFormat ApplicationGatewayIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayIPConfigurationPropertiesFormat) + if err != nil { + return err + } + agic.ApplicationGatewayIPConfigurationPropertiesFormat = &applicationGatewayIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agic.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayIPConfigurationPropertiesFormat properties of IP configuration of an application +// gateway. +type ApplicationGatewayIPConfigurationPropertiesFormat struct { + // Subnet - Reference to the subnet resource. A subnet from where application gateway gets its private address. + Subnet *SubResource `json:"subnet,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the application gateway IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayIPConfigurationPropertiesFormat. +func (agicpf ApplicationGatewayIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agicpf.Subnet != nil { + objectMap["subnet"] = agicpf.Subnet + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayListResult response for ListApplicationGateways API service call. +type ApplicationGatewayListResult struct { + autorest.Response `json:"-"` + // Value - List of an application gateways in a resource group. + Value *[]ApplicationGateway `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplicationGatewayListResultIterator provides access to a complete listing of ApplicationGateway values. +type ApplicationGatewayListResultIterator struct { + i int + page ApplicationGatewayListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ApplicationGatewayListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationGatewayListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationGatewayListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ApplicationGatewayListResultIterator) Response() ApplicationGatewayListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ApplicationGatewayListResultIterator) Value() ApplicationGateway { + if !iter.page.NotDone() { + return ApplicationGateway{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ApplicationGatewayListResultIterator type. +func NewApplicationGatewayListResultIterator(page ApplicationGatewayListResultPage) ApplicationGatewayListResultIterator { + return ApplicationGatewayListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aglr ApplicationGatewayListResult) IsEmpty() bool { + return aglr.Value == nil || len(*aglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aglr ApplicationGatewayListResult) hasNextLink() bool { + return aglr.NextLink != nil && len(*aglr.NextLink) != 0 +} + +// applicationGatewayListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aglr ApplicationGatewayListResult) applicationGatewayListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aglr.NextLink))) +} + +// ApplicationGatewayListResultPage contains a page of ApplicationGateway values. +type ApplicationGatewayListResultPage struct { + fn func(context.Context, ApplicationGatewayListResult) (ApplicationGatewayListResult, error) + aglr ApplicationGatewayListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ApplicationGatewayListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aglr) + if err != nil { + return err + } + page.aglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationGatewayListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationGatewayListResultPage) NotDone() bool { + return !page.aglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationGatewayListResultPage) Response() ApplicationGatewayListResult { + return page.aglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationGatewayListResultPage) Values() []ApplicationGateway { + if page.aglr.IsEmpty() { + return nil + } + return *page.aglr.Value +} + +// Creates a new instance of the ApplicationGatewayListResultPage type. +func NewApplicationGatewayListResultPage(cur ApplicationGatewayListResult, getNextPage func(context.Context, ApplicationGatewayListResult) (ApplicationGatewayListResult, error)) ApplicationGatewayListResultPage { + return ApplicationGatewayListResultPage{ + fn: getNextPage, + aglr: cur, + } +} + +// ApplicationGatewayListener listener of an application gateway. +type ApplicationGatewayListener struct { + // ApplicationGatewayListenerPropertiesFormat - Properties of the application gateway listener. + *ApplicationGatewayListenerPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the listener that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayListener. +func (agl ApplicationGatewayListener) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agl.ApplicationGatewayListenerPropertiesFormat != nil { + objectMap["properties"] = agl.ApplicationGatewayListenerPropertiesFormat + } + if agl.Name != nil { + objectMap["name"] = agl.Name + } + if agl.ID != nil { + objectMap["id"] = agl.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayListener struct. +func (agl *ApplicationGatewayListener) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayListenerPropertiesFormat ApplicationGatewayListenerPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayListenerPropertiesFormat) + if err != nil { + return err + } + agl.ApplicationGatewayListenerPropertiesFormat = &applicationGatewayListenerPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agl.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agl.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agl.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agl.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayListenerPropertiesFormat properties of listener of an application gateway. +type ApplicationGatewayListenerPropertiesFormat struct { + // FrontendIPConfiguration - Frontend IP configuration resource of an application gateway. + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + // FrontendPort - Frontend port resource of an application gateway. + FrontendPort *SubResource `json:"frontendPort,omitempty"` + // Protocol - Protocol of the listener. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + // SslCertificate - SSL certificate resource of an application gateway. + SslCertificate *SubResource `json:"sslCertificate,omitempty"` + // SslProfile - SSL profile resource of the application gateway. + SslProfile *SubResource `json:"sslProfile,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the listener resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayListenerPropertiesFormat. +func (aglpf ApplicationGatewayListenerPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aglpf.FrontendIPConfiguration != nil { + objectMap["frontendIPConfiguration"] = aglpf.FrontendIPConfiguration + } + if aglpf.FrontendPort != nil { + objectMap["frontendPort"] = aglpf.FrontendPort + } + if aglpf.Protocol != "" { + objectMap["protocol"] = aglpf.Protocol + } + if aglpf.SslCertificate != nil { + objectMap["sslCertificate"] = aglpf.SslCertificate + } + if aglpf.SslProfile != nil { + objectMap["sslProfile"] = aglpf.SslProfile + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayLoadDistributionPolicy load Distribution Policy of an application gateway. +type ApplicationGatewayLoadDistributionPolicy struct { + // ApplicationGatewayLoadDistributionPolicyPropertiesFormat - Properties of the application gateway load distribution policy. + *ApplicationGatewayLoadDistributionPolicyPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the load distribution policy that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayLoadDistributionPolicy. +func (agldp ApplicationGatewayLoadDistributionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agldp.ApplicationGatewayLoadDistributionPolicyPropertiesFormat != nil { + objectMap["properties"] = agldp.ApplicationGatewayLoadDistributionPolicyPropertiesFormat + } + if agldp.Name != nil { + objectMap["name"] = agldp.Name + } + if agldp.ID != nil { + objectMap["id"] = agldp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayLoadDistributionPolicy struct. +func (agldp *ApplicationGatewayLoadDistributionPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayLoadDistributionPolicyPropertiesFormat ApplicationGatewayLoadDistributionPolicyPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayLoadDistributionPolicyPropertiesFormat) + if err != nil { + return err + } + agldp.ApplicationGatewayLoadDistributionPolicyPropertiesFormat = &applicationGatewayLoadDistributionPolicyPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agldp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agldp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agldp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agldp.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayLoadDistributionPolicyPropertiesFormat properties of Load Distribution Policy of an +// application gateway. +type ApplicationGatewayLoadDistributionPolicyPropertiesFormat struct { + // LoadDistributionTargets - Load Distribution Targets resource of an application gateway. + LoadDistributionTargets *[]ApplicationGatewayLoadDistributionTarget `json:"loadDistributionTargets,omitempty"` + // LoadDistributionAlgorithm - Load Distribution Targets resource of an application gateway. Possible values include: 'ApplicationGatewayLoadDistributionAlgorithmRoundRobin', 'ApplicationGatewayLoadDistributionAlgorithmLeastConnections', 'ApplicationGatewayLoadDistributionAlgorithmIPHash' + LoadDistributionAlgorithm ApplicationGatewayLoadDistributionAlgorithm `json:"loadDistributionAlgorithm,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the Load Distribution Policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayLoadDistributionPolicyPropertiesFormat. +func (agldppf ApplicationGatewayLoadDistributionPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agldppf.LoadDistributionTargets != nil { + objectMap["loadDistributionTargets"] = agldppf.LoadDistributionTargets + } + if agldppf.LoadDistributionAlgorithm != "" { + objectMap["loadDistributionAlgorithm"] = agldppf.LoadDistributionAlgorithm + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayLoadDistributionTarget load Distribution Target of an application gateway. +type ApplicationGatewayLoadDistributionTarget struct { + // ApplicationGatewayLoadDistributionTargetPropertiesFormat - Properties of the application gateway load distribution target. + *ApplicationGatewayLoadDistributionTargetPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the load distribution policy that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayLoadDistributionTarget. +func (agldt ApplicationGatewayLoadDistributionTarget) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agldt.ApplicationGatewayLoadDistributionTargetPropertiesFormat != nil { + objectMap["properties"] = agldt.ApplicationGatewayLoadDistributionTargetPropertiesFormat + } + if agldt.Name != nil { + objectMap["name"] = agldt.Name + } + if agldt.ID != nil { + objectMap["id"] = agldt.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayLoadDistributionTarget struct. +func (agldt *ApplicationGatewayLoadDistributionTarget) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayLoadDistributionTargetPropertiesFormat ApplicationGatewayLoadDistributionTargetPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayLoadDistributionTargetPropertiesFormat) + if err != nil { + return err + } + agldt.ApplicationGatewayLoadDistributionTargetPropertiesFormat = &applicationGatewayLoadDistributionTargetPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agldt.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agldt.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agldt.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agldt.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayLoadDistributionTargetPropertiesFormat ... +type ApplicationGatewayLoadDistributionTargetPropertiesFormat struct { + // WeightPerServer - Weight per server. Range between 1 and 100. + WeightPerServer *int32 `json:"weightPerServer,omitempty"` + // BackendAddressPool - Backend address pool resource of the application gateway. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` +} + +// ApplicationGatewayOnDemandProbe details of on demand test probe request. +type ApplicationGatewayOnDemandProbe struct { + // Protocol - The protocol used for the probe. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + // Host - Host name to send the probe to. + Host *string `json:"host,omitempty"` + // Path - Relative path of probe. Valid path starts from '/'. Probe is sent to ://:. + Path *string `json:"path,omitempty"` + // Timeout - 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. + Timeout *int32 `json:"timeout,omitempty"` + // PickHostNameFromBackendHTTPSettings - Whether the host header should be picked from the backend http settings. Default value is false. + PickHostNameFromBackendHTTPSettings *bool `json:"pickHostNameFromBackendHttpSettings,omitempty"` + // Match - Criterion for classifying a healthy probe response. + Match *ApplicationGatewayProbeHealthResponseMatch `json:"match,omitempty"` + // BackendAddressPool - Reference to backend pool of application gateway to which probe request will be sent. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + // BackendHTTPSettings - Reference to backend http setting of application gateway to be used for test probe. + BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` +} + +// ApplicationGatewayPathRule path rule of URL path map of an application gateway. +type ApplicationGatewayPathRule struct { + // ApplicationGatewayPathRulePropertiesFormat - Properties of the application gateway path rule. + *ApplicationGatewayPathRulePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the path rule that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPathRule. +func (agpr ApplicationGatewayPathRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agpr.ApplicationGatewayPathRulePropertiesFormat != nil { + objectMap["properties"] = agpr.ApplicationGatewayPathRulePropertiesFormat + } + if agpr.Name != nil { + objectMap["name"] = agpr.Name + } + if agpr.ID != nil { + objectMap["id"] = agpr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayPathRule struct. +func (agpr *ApplicationGatewayPathRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayPathRulePropertiesFormat ApplicationGatewayPathRulePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayPathRulePropertiesFormat) + if err != nil { + return err + } + agpr.ApplicationGatewayPathRulePropertiesFormat = &applicationGatewayPathRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agpr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agpr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agpr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agpr.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayPathRulePropertiesFormat properties of path rule of an application gateway. +type ApplicationGatewayPathRulePropertiesFormat struct { + // Paths - Path rules of URL path map. + Paths *[]string `json:"paths,omitempty"` + // BackendAddressPool - Backend address pool resource of URL path map path rule. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + // BackendHTTPSettings - Backend http settings resource of URL path map path rule. + BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` + // RedirectConfiguration - Redirect configuration resource of URL path map path rule. + RedirectConfiguration *SubResource `json:"redirectConfiguration,omitempty"` + // RewriteRuleSet - Rewrite rule set resource of URL path map path rule. + RewriteRuleSet *SubResource `json:"rewriteRuleSet,omitempty"` + // LoadDistributionPolicy - Load Distribution Policy resource of URL path map path rule. + LoadDistributionPolicy *SubResource `json:"loadDistributionPolicy,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the path rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // FirewallPolicy - Reference to the FirewallPolicy resource. + FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPathRulePropertiesFormat. +func (agprpf ApplicationGatewayPathRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agprpf.Paths != nil { + objectMap["paths"] = agprpf.Paths + } + if agprpf.BackendAddressPool != nil { + objectMap["backendAddressPool"] = agprpf.BackendAddressPool + } + if agprpf.BackendHTTPSettings != nil { + objectMap["backendHttpSettings"] = agprpf.BackendHTTPSettings + } + if agprpf.RedirectConfiguration != nil { + objectMap["redirectConfiguration"] = agprpf.RedirectConfiguration + } + if agprpf.RewriteRuleSet != nil { + objectMap["rewriteRuleSet"] = agprpf.RewriteRuleSet + } + if agprpf.LoadDistributionPolicy != nil { + objectMap["loadDistributionPolicy"] = agprpf.LoadDistributionPolicy + } + if agprpf.FirewallPolicy != nil { + objectMap["firewallPolicy"] = agprpf.FirewallPolicy + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayPrivateEndpointConnection private Endpoint connection on an application gateway. +type ApplicationGatewayPrivateEndpointConnection struct { + autorest.Response `json:"-"` + // ApplicationGatewayPrivateEndpointConnectionProperties - Properties of the application gateway private endpoint connection. + *ApplicationGatewayPrivateEndpointConnectionProperties `json:"properties,omitempty"` + // Name - Name of the private endpoint connection on an application gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateEndpointConnection. +func (agpec ApplicationGatewayPrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agpec.ApplicationGatewayPrivateEndpointConnectionProperties != nil { + objectMap["properties"] = agpec.ApplicationGatewayPrivateEndpointConnectionProperties + } + if agpec.Name != nil { + objectMap["name"] = agpec.Name + } + if agpec.ID != nil { + objectMap["id"] = agpec.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayPrivateEndpointConnection struct. +func (agpec *ApplicationGatewayPrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayPrivateEndpointConnectionProperties ApplicationGatewayPrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &applicationGatewayPrivateEndpointConnectionProperties) + if err != nil { + return err + } + agpec.ApplicationGatewayPrivateEndpointConnectionProperties = &applicationGatewayPrivateEndpointConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agpec.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agpec.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agpec.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agpec.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayPrivateEndpointConnectionListResult response for +// ListApplicationGatewayPrivateEndpointConnection API service call. Gets all private endpoint connections +// for an application gateway. +type ApplicationGatewayPrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - List of private endpoint connections on an application gateway. + Value *[]ApplicationGatewayPrivateEndpointConnection `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplicationGatewayPrivateEndpointConnectionListResultIterator provides access to a complete listing of +// ApplicationGatewayPrivateEndpointConnection values. +type ApplicationGatewayPrivateEndpointConnectionListResultIterator struct { + i int + page ApplicationGatewayPrivateEndpointConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ApplicationGatewayPrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateEndpointConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationGatewayPrivateEndpointConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationGatewayPrivateEndpointConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ApplicationGatewayPrivateEndpointConnectionListResultIterator) Response() ApplicationGatewayPrivateEndpointConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ApplicationGatewayPrivateEndpointConnectionListResultIterator) Value() ApplicationGatewayPrivateEndpointConnection { + if !iter.page.NotDone() { + return ApplicationGatewayPrivateEndpointConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ApplicationGatewayPrivateEndpointConnectionListResultIterator type. +func NewApplicationGatewayPrivateEndpointConnectionListResultIterator(page ApplicationGatewayPrivateEndpointConnectionListResultPage) ApplicationGatewayPrivateEndpointConnectionListResultIterator { + return ApplicationGatewayPrivateEndpointConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (agpeclr ApplicationGatewayPrivateEndpointConnectionListResult) IsEmpty() bool { + return agpeclr.Value == nil || len(*agpeclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (agpeclr ApplicationGatewayPrivateEndpointConnectionListResult) hasNextLink() bool { + return agpeclr.NextLink != nil && len(*agpeclr.NextLink) != 0 +} + +// applicationGatewayPrivateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (agpeclr ApplicationGatewayPrivateEndpointConnectionListResult) applicationGatewayPrivateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !agpeclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(agpeclr.NextLink))) +} + +// ApplicationGatewayPrivateEndpointConnectionListResultPage contains a page of +// ApplicationGatewayPrivateEndpointConnection values. +type ApplicationGatewayPrivateEndpointConnectionListResultPage struct { + fn func(context.Context, ApplicationGatewayPrivateEndpointConnectionListResult) (ApplicationGatewayPrivateEndpointConnectionListResult, error) + agpeclr ApplicationGatewayPrivateEndpointConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ApplicationGatewayPrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateEndpointConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.agpeclr) + if err != nil { + return err + } + page.agpeclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationGatewayPrivateEndpointConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationGatewayPrivateEndpointConnectionListResultPage) NotDone() bool { + return !page.agpeclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationGatewayPrivateEndpointConnectionListResultPage) Response() ApplicationGatewayPrivateEndpointConnectionListResult { + return page.agpeclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationGatewayPrivateEndpointConnectionListResultPage) Values() []ApplicationGatewayPrivateEndpointConnection { + if page.agpeclr.IsEmpty() { + return nil + } + return *page.agpeclr.Value +} + +// Creates a new instance of the ApplicationGatewayPrivateEndpointConnectionListResultPage type. +func NewApplicationGatewayPrivateEndpointConnectionListResultPage(cur ApplicationGatewayPrivateEndpointConnectionListResult, getNextPage func(context.Context, ApplicationGatewayPrivateEndpointConnectionListResult) (ApplicationGatewayPrivateEndpointConnectionListResult, error)) ApplicationGatewayPrivateEndpointConnectionListResultPage { + return ApplicationGatewayPrivateEndpointConnectionListResultPage{ + fn: getNextPage, + agpeclr: cur, + } +} + +// ApplicationGatewayPrivateEndpointConnectionProperties properties of Private Link Resource of an +// application gateway. +type ApplicationGatewayPrivateEndpointConnectionProperties struct { + // PrivateEndpoint - READ-ONLY; The resource of private end point. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the application gateway private endpoint connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // LinkIdentifier - READ-ONLY; The consumer link id. + LinkIdentifier *string `json:"linkIdentifier,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateEndpointConnectionProperties. +func (agpecp ApplicationGatewayPrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agpecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = agpecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayPrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type ApplicationGatewayPrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewayPrivateEndpointConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewayPrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewayPrivateEndpointConnectionsDeleteFuture.Result. +func (future *ApplicationGatewayPrivateEndpointConnectionsDeleteFuture) result(client ApplicationGatewayPrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewayPrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ApplicationGatewayPrivateEndpointConnectionsUpdateFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type ApplicationGatewayPrivateEndpointConnectionsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewayPrivateEndpointConnectionsClient) (ApplicationGatewayPrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewayPrivateEndpointConnectionsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewayPrivateEndpointConnectionsUpdateFuture.Result. +func (future *ApplicationGatewayPrivateEndpointConnectionsUpdateFuture) result(client ApplicationGatewayPrivateEndpointConnectionsClient) (agpec ApplicationGatewayPrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + agpec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewayPrivateEndpointConnectionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if agpec.Response.Response, err = future.GetResult(sender); err == nil && agpec.Response.Response.StatusCode != http.StatusNoContent { + agpec, err = client.UpdateResponder(agpec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsUpdateFuture", "Result", agpec.Response.Response, "Failure responding to request") + } + } + return +} + +// ApplicationGatewayPrivateLinkConfiguration private Link Configuration on an application gateway. +type ApplicationGatewayPrivateLinkConfiguration struct { + // ApplicationGatewayPrivateLinkConfigurationProperties - Properties of the application gateway private link configuration. + *ApplicationGatewayPrivateLinkConfigurationProperties `json:"properties,omitempty"` + // Name - Name of the private link configuration that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkConfiguration. +func (agplc ApplicationGatewayPrivateLinkConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agplc.ApplicationGatewayPrivateLinkConfigurationProperties != nil { + objectMap["properties"] = agplc.ApplicationGatewayPrivateLinkConfigurationProperties + } + if agplc.Name != nil { + objectMap["name"] = agplc.Name + } + if agplc.ID != nil { + objectMap["id"] = agplc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayPrivateLinkConfiguration struct. +func (agplc *ApplicationGatewayPrivateLinkConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayPrivateLinkConfigurationProperties ApplicationGatewayPrivateLinkConfigurationProperties + err = json.Unmarshal(*v, &applicationGatewayPrivateLinkConfigurationProperties) + if err != nil { + return err + } + agplc.ApplicationGatewayPrivateLinkConfigurationProperties = &applicationGatewayPrivateLinkConfigurationProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agplc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agplc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agplc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agplc.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayPrivateLinkConfigurationProperties properties of private link configuration on an +// application gateway. +type ApplicationGatewayPrivateLinkConfigurationProperties struct { + // IPConfigurations - An array of application gateway private link ip configurations. + IPConfigurations *[]ApplicationGatewayPrivateLinkIPConfiguration `json:"ipConfigurations,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the application gateway private link configuration. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkConfigurationProperties. +func (agplcp ApplicationGatewayPrivateLinkConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agplcp.IPConfigurations != nil { + objectMap["ipConfigurations"] = agplcp.IPConfigurations + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayPrivateLinkIPConfiguration the application gateway private link ip configuration. +type ApplicationGatewayPrivateLinkIPConfiguration struct { + // ApplicationGatewayPrivateLinkIPConfigurationProperties - Properties of an application gateway private link ip configuration. + *ApplicationGatewayPrivateLinkIPConfigurationProperties `json:"properties,omitempty"` + // Name - The name of application gateway private link ip configuration. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkIPConfiguration. +func (agplic ApplicationGatewayPrivateLinkIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agplic.ApplicationGatewayPrivateLinkIPConfigurationProperties != nil { + objectMap["properties"] = agplic.ApplicationGatewayPrivateLinkIPConfigurationProperties + } + if agplic.Name != nil { + objectMap["name"] = agplic.Name + } + if agplic.ID != nil { + objectMap["id"] = agplic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayPrivateLinkIPConfiguration struct. +func (agplic *ApplicationGatewayPrivateLinkIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayPrivateLinkIPConfigurationProperties ApplicationGatewayPrivateLinkIPConfigurationProperties + err = json.Unmarshal(*v, &applicationGatewayPrivateLinkIPConfigurationProperties) + if err != nil { + return err + } + agplic.ApplicationGatewayPrivateLinkIPConfigurationProperties = &applicationGatewayPrivateLinkIPConfigurationProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agplic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agplic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agplic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agplic.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayPrivateLinkIPConfigurationProperties properties of an application gateway private link +// IP configuration. +type ApplicationGatewayPrivateLinkIPConfigurationProperties struct { + // PrivateIPAddress - The private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // Subnet - Reference to the subnet resource. + Subnet *SubResource `json:"subnet,omitempty"` + // Primary - Whether the ip configuration is primary or not. + Primary *bool `json:"primary,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the application gateway private link IP configuration. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkIPConfigurationProperties. +func (agplicp ApplicationGatewayPrivateLinkIPConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agplicp.PrivateIPAddress != nil { + objectMap["privateIPAddress"] = agplicp.PrivateIPAddress + } + if agplicp.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = agplicp.PrivateIPAllocationMethod + } + if agplicp.Subnet != nil { + objectMap["subnet"] = agplicp.Subnet + } + if agplicp.Primary != nil { + objectMap["primary"] = agplicp.Primary + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayPrivateLinkResource privateLink Resource of an application gateway. +type ApplicationGatewayPrivateLinkResource struct { + // ApplicationGatewayPrivateLinkResourceProperties - Properties of the application gateway private link resource. + *ApplicationGatewayPrivateLinkResourceProperties `json:"properties,omitempty"` + // Name - Name of the private link resource that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkResource. +func (agplr ApplicationGatewayPrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agplr.ApplicationGatewayPrivateLinkResourceProperties != nil { + objectMap["properties"] = agplr.ApplicationGatewayPrivateLinkResourceProperties + } + if agplr.Name != nil { + objectMap["name"] = agplr.Name + } + if agplr.ID != nil { + objectMap["id"] = agplr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayPrivateLinkResource struct. +func (agplr *ApplicationGatewayPrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayPrivateLinkResourceProperties ApplicationGatewayPrivateLinkResourceProperties + err = json.Unmarshal(*v, &applicationGatewayPrivateLinkResourceProperties) + if err != nil { + return err + } + agplr.ApplicationGatewayPrivateLinkResourceProperties = &applicationGatewayPrivateLinkResourceProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agplr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agplr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agplr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agplr.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayPrivateLinkResourceListResult response for ListApplicationGatewayPrivateLinkResources +// API service call. Gets all private link resources for an application gateway. +type ApplicationGatewayPrivateLinkResourceListResult struct { + autorest.Response `json:"-"` + // Value - List of private link resources of an application gateway. + Value *[]ApplicationGatewayPrivateLinkResource `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplicationGatewayPrivateLinkResourceListResultIterator provides access to a complete listing of +// ApplicationGatewayPrivateLinkResource values. +type ApplicationGatewayPrivateLinkResourceListResultIterator struct { + i int + page ApplicationGatewayPrivateLinkResourceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ApplicationGatewayPrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateLinkResourceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationGatewayPrivateLinkResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationGatewayPrivateLinkResourceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ApplicationGatewayPrivateLinkResourceListResultIterator) Response() ApplicationGatewayPrivateLinkResourceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ApplicationGatewayPrivateLinkResourceListResultIterator) Value() ApplicationGatewayPrivateLinkResource { + if !iter.page.NotDone() { + return ApplicationGatewayPrivateLinkResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ApplicationGatewayPrivateLinkResourceListResultIterator type. +func NewApplicationGatewayPrivateLinkResourceListResultIterator(page ApplicationGatewayPrivateLinkResourceListResultPage) ApplicationGatewayPrivateLinkResourceListResultIterator { + return ApplicationGatewayPrivateLinkResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (agplrlr ApplicationGatewayPrivateLinkResourceListResult) IsEmpty() bool { + return agplrlr.Value == nil || len(*agplrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (agplrlr ApplicationGatewayPrivateLinkResourceListResult) hasNextLink() bool { + return agplrlr.NextLink != nil && len(*agplrlr.NextLink) != 0 +} + +// applicationGatewayPrivateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (agplrlr ApplicationGatewayPrivateLinkResourceListResult) applicationGatewayPrivateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !agplrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(agplrlr.NextLink))) +} + +// ApplicationGatewayPrivateLinkResourceListResultPage contains a page of +// ApplicationGatewayPrivateLinkResource values. +type ApplicationGatewayPrivateLinkResourceListResultPage struct { + fn func(context.Context, ApplicationGatewayPrivateLinkResourceListResult) (ApplicationGatewayPrivateLinkResourceListResult, error) + agplrlr ApplicationGatewayPrivateLinkResourceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ApplicationGatewayPrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateLinkResourceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.agplrlr) + if err != nil { + return err + } + page.agplrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationGatewayPrivateLinkResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationGatewayPrivateLinkResourceListResultPage) NotDone() bool { + return !page.agplrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationGatewayPrivateLinkResourceListResultPage) Response() ApplicationGatewayPrivateLinkResourceListResult { + return page.agplrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationGatewayPrivateLinkResourceListResultPage) Values() []ApplicationGatewayPrivateLinkResource { + if page.agplrlr.IsEmpty() { + return nil + } + return *page.agplrlr.Value +} + +// Creates a new instance of the ApplicationGatewayPrivateLinkResourceListResultPage type. +func NewApplicationGatewayPrivateLinkResourceListResultPage(cur ApplicationGatewayPrivateLinkResourceListResult, getNextPage func(context.Context, ApplicationGatewayPrivateLinkResourceListResult) (ApplicationGatewayPrivateLinkResourceListResult, error)) ApplicationGatewayPrivateLinkResourceListResultPage { + return ApplicationGatewayPrivateLinkResourceListResultPage{ + fn: getNextPage, + agplrlr: cur, + } +} + +// ApplicationGatewayPrivateLinkResourceProperties properties of a private link resource. +type ApplicationGatewayPrivateLinkResourceProperties struct { + // GroupID - READ-ONLY; Group identifier of private link resource. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - READ-ONLY; Required member names of private link resource. + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - Required DNS zone names of the the private link resource. + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkResourceProperties. +func (agplrp ApplicationGatewayPrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agplrp.RequiredZoneNames != nil { + objectMap["requiredZoneNames"] = agplrp.RequiredZoneNames + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayProbe probe of the application gateway. +type ApplicationGatewayProbe struct { + // ApplicationGatewayProbePropertiesFormat - Properties of the application gateway probe. + *ApplicationGatewayProbePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the probe that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayProbe. +func (agp ApplicationGatewayProbe) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agp.ApplicationGatewayProbePropertiesFormat != nil { + objectMap["properties"] = agp.ApplicationGatewayProbePropertiesFormat + } + if agp.Name != nil { + objectMap["name"] = agp.Name + } + if agp.ID != nil { + objectMap["id"] = agp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayProbe struct. +func (agp *ApplicationGatewayProbe) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayProbePropertiesFormat ApplicationGatewayProbePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayProbePropertiesFormat) + if err != nil { + return err + } + agp.ApplicationGatewayProbePropertiesFormat = &applicationGatewayProbePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agp.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayProbeHealthResponseMatch application gateway probe health response match. +type ApplicationGatewayProbeHealthResponseMatch struct { + // Body - Body that must be contained in the health response. Default value is empty. + Body *string `json:"body,omitempty"` + // StatusCodes - Allowed ranges of healthy status codes. Default range of healthy status codes is 200-399. + StatusCodes *[]string `json:"statusCodes,omitempty"` +} + +// ApplicationGatewayProbePropertiesFormat properties of probe of an application gateway. +type ApplicationGatewayProbePropertiesFormat struct { + // Protocol - The protocol used for the probe. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + // Host - Host name to send the probe to. + Host *string `json:"host,omitempty"` + // Path - Relative path of probe. Valid path starts from '/'. Probe is sent to ://:. + Path *string `json:"path,omitempty"` + // Interval - The probing interval in seconds. This is the time interval between two consecutive probes. Acceptable values are from 1 second to 86400 seconds. + Interval *int32 `json:"interval,omitempty"` + // Timeout - 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. + Timeout *int32 `json:"timeout,omitempty"` + // UnhealthyThreshold - The probe retry count. Backend server is marked down after consecutive probe failure count reaches UnhealthyThreshold. Acceptable values are from 1 second to 20. + UnhealthyThreshold *int32 `json:"unhealthyThreshold,omitempty"` + // PickHostNameFromBackendHTTPSettings - Whether the host header should be picked from the backend http settings. Default value is false. + PickHostNameFromBackendHTTPSettings *bool `json:"pickHostNameFromBackendHttpSettings,omitempty"` + // PickHostNameFromBackendSettings - Whether the server name indication should be picked from the backend settings for Tls protocol. Default value is false. + PickHostNameFromBackendSettings *bool `json:"pickHostNameFromBackendSettings,omitempty"` + // MinServers - Minimum number of servers that are always marked healthy. Default value is 0. + MinServers *int32 `json:"minServers,omitempty"` + // Match - Criterion for classifying a healthy probe response. + Match *ApplicationGatewayProbeHealthResponseMatch `json:"match,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the probe resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Port - 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. + Port *int32 `json:"port,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayProbePropertiesFormat. +func (agppf ApplicationGatewayProbePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agppf.Protocol != "" { + objectMap["protocol"] = agppf.Protocol + } + if agppf.Host != nil { + objectMap["host"] = agppf.Host + } + if agppf.Path != nil { + objectMap["path"] = agppf.Path + } + if agppf.Interval != nil { + objectMap["interval"] = agppf.Interval + } + if agppf.Timeout != nil { + objectMap["timeout"] = agppf.Timeout + } + if agppf.UnhealthyThreshold != nil { + objectMap["unhealthyThreshold"] = agppf.UnhealthyThreshold + } + if agppf.PickHostNameFromBackendHTTPSettings != nil { + objectMap["pickHostNameFromBackendHttpSettings"] = agppf.PickHostNameFromBackendHTTPSettings + } + if agppf.PickHostNameFromBackendSettings != nil { + objectMap["pickHostNameFromBackendSettings"] = agppf.PickHostNameFromBackendSettings + } + if agppf.MinServers != nil { + objectMap["minServers"] = agppf.MinServers + } + if agppf.Match != nil { + objectMap["match"] = agppf.Match + } + if agppf.Port != nil { + objectMap["port"] = agppf.Port + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayPropertiesFormat properties of the application gateway. +type ApplicationGatewayPropertiesFormat struct { + // Sku - SKU of the application gateway resource. + Sku *ApplicationGatewaySku `json:"sku,omitempty"` + // SslPolicy - SSL policy of the application gateway resource. + SslPolicy *ApplicationGatewaySslPolicy `json:"sslPolicy,omitempty"` + // OperationalState - READ-ONLY; Operational state of the application gateway resource. Possible values include: 'ApplicationGatewayOperationalStateStopped', 'ApplicationGatewayOperationalStateStarting', 'ApplicationGatewayOperationalStateRunning', 'ApplicationGatewayOperationalStateStopping' + OperationalState ApplicationGatewayOperationalState `json:"operationalState,omitempty"` + // GatewayIPConfigurations - 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). + GatewayIPConfigurations *[]ApplicationGatewayIPConfiguration `json:"gatewayIPConfigurations,omitempty"` + // AuthenticationCertificates - 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). + AuthenticationCertificates *[]ApplicationGatewayAuthenticationCertificate `json:"authenticationCertificates,omitempty"` + // TrustedRootCertificates - 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). + TrustedRootCertificates *[]ApplicationGatewayTrustedRootCertificate `json:"trustedRootCertificates,omitempty"` + // TrustedClientCertificates - 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). + TrustedClientCertificates *[]ApplicationGatewayTrustedClientCertificate `json:"trustedClientCertificates,omitempty"` + // SslCertificates - 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). + SslCertificates *[]ApplicationGatewaySslCertificate `json:"sslCertificates,omitempty"` + // FrontendIPConfigurations - 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). + FrontendIPConfigurations *[]ApplicationGatewayFrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` + // FrontendPorts - 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). + FrontendPorts *[]ApplicationGatewayFrontendPort `json:"frontendPorts,omitempty"` + // Probes - Probes of the application gateway resource. + Probes *[]ApplicationGatewayProbe `json:"probes,omitempty"` + // BackendAddressPools - 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). + BackendAddressPools *[]ApplicationGatewayBackendAddressPool `json:"backendAddressPools,omitempty"` + // BackendHTTPSettingsCollection - 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). + BackendHTTPSettingsCollection *[]ApplicationGatewayBackendHTTPSettings `json:"backendHttpSettingsCollection,omitempty"` + // BackendSettingsCollection - 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). + BackendSettingsCollection *[]ApplicationGatewayBackendSettings `json:"backendSettingsCollection,omitempty"` + // HTTPListeners - 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). + HTTPListeners *[]ApplicationGatewayHTTPListener `json:"httpListeners,omitempty"` + // Listeners - 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). + Listeners *[]ApplicationGatewayListener `json:"listeners,omitempty"` + // SslProfiles - 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). + SslProfiles *[]ApplicationGatewaySslProfile `json:"sslProfiles,omitempty"` + // URLPathMaps - 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). + URLPathMaps *[]ApplicationGatewayURLPathMap `json:"urlPathMaps,omitempty"` + // RequestRoutingRules - Request routing rules of the application gateway resource. + RequestRoutingRules *[]ApplicationGatewayRequestRoutingRule `json:"requestRoutingRules,omitempty"` + // RoutingRules - Routing rules of the application gateway resource. + RoutingRules *[]ApplicationGatewayRoutingRule `json:"routingRules,omitempty"` + // RewriteRuleSets - Rewrite rules for the application gateway resource. + RewriteRuleSets *[]ApplicationGatewayRewriteRuleSet `json:"rewriteRuleSets,omitempty"` + // RedirectConfigurations - 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). + RedirectConfigurations *[]ApplicationGatewayRedirectConfiguration `json:"redirectConfigurations,omitempty"` + // WebApplicationFirewallConfiguration - Web application firewall configuration. + WebApplicationFirewallConfiguration *ApplicationGatewayWebApplicationFirewallConfiguration `json:"webApplicationFirewallConfiguration,omitempty"` + // FirewallPolicy - Reference to the FirewallPolicy resource. + FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` + // EnableHTTP2 - Whether HTTP2 is enabled on the application gateway resource. + EnableHTTP2 *bool `json:"enableHttp2,omitempty"` + // EnableFips - Whether FIPS is enabled on the application gateway resource. + EnableFips *bool `json:"enableFips,omitempty"` + // AutoscaleConfiguration - Autoscale Configuration. + AutoscaleConfiguration *ApplicationGatewayAutoscaleConfiguration `json:"autoscaleConfiguration,omitempty"` + // PrivateLinkConfigurations - PrivateLink configurations on application gateway. + PrivateLinkConfigurations *[]ApplicationGatewayPrivateLinkConfiguration `json:"privateLinkConfigurations,omitempty"` + // PrivateEndpointConnections - READ-ONLY; Private Endpoint connections on application gateway. + PrivateEndpointConnections *[]ApplicationGatewayPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the application gateway resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the application gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // CustomErrorConfigurations - Custom error configurations of the application gateway resource. + CustomErrorConfigurations *[]ApplicationGatewayCustomError `json:"customErrorConfigurations,omitempty"` + // ForceFirewallPolicyAssociation - If true, associates a firewall policy with an application gateway regardless whether the policy differs from the WAF Config. + ForceFirewallPolicyAssociation *bool `json:"forceFirewallPolicyAssociation,omitempty"` + // LoadDistributionPolicies - Load distribution policies of the application gateway resource. + LoadDistributionPolicies *[]ApplicationGatewayLoadDistributionPolicy `json:"loadDistributionPolicies,omitempty"` + // GlobalConfiguration - Global Configuration. + GlobalConfiguration *ApplicationGatewayGlobalConfiguration `json:"globalConfiguration,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPropertiesFormat. +func (agpf ApplicationGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agpf.Sku != nil { + objectMap["sku"] = agpf.Sku + } + if agpf.SslPolicy != nil { + objectMap["sslPolicy"] = agpf.SslPolicy + } + if agpf.GatewayIPConfigurations != nil { + objectMap["gatewayIPConfigurations"] = agpf.GatewayIPConfigurations + } + if agpf.AuthenticationCertificates != nil { + objectMap["authenticationCertificates"] = agpf.AuthenticationCertificates + } + if agpf.TrustedRootCertificates != nil { + objectMap["trustedRootCertificates"] = agpf.TrustedRootCertificates + } + if agpf.TrustedClientCertificates != nil { + objectMap["trustedClientCertificates"] = agpf.TrustedClientCertificates + } + if agpf.SslCertificates != nil { + objectMap["sslCertificates"] = agpf.SslCertificates + } + if agpf.FrontendIPConfigurations != nil { + objectMap["frontendIPConfigurations"] = agpf.FrontendIPConfigurations + } + if agpf.FrontendPorts != nil { + objectMap["frontendPorts"] = agpf.FrontendPorts + } + if agpf.Probes != nil { + objectMap["probes"] = agpf.Probes + } + if agpf.BackendAddressPools != nil { + objectMap["backendAddressPools"] = agpf.BackendAddressPools + } + if agpf.BackendHTTPSettingsCollection != nil { + objectMap["backendHttpSettingsCollection"] = agpf.BackendHTTPSettingsCollection + } + if agpf.BackendSettingsCollection != nil { + objectMap["backendSettingsCollection"] = agpf.BackendSettingsCollection + } + if agpf.HTTPListeners != nil { + objectMap["httpListeners"] = agpf.HTTPListeners + } + if agpf.Listeners != nil { + objectMap["listeners"] = agpf.Listeners + } + if agpf.SslProfiles != nil { + objectMap["sslProfiles"] = agpf.SslProfiles + } + if agpf.URLPathMaps != nil { + objectMap["urlPathMaps"] = agpf.URLPathMaps + } + if agpf.RequestRoutingRules != nil { + objectMap["requestRoutingRules"] = agpf.RequestRoutingRules + } + if agpf.RoutingRules != nil { + objectMap["routingRules"] = agpf.RoutingRules + } + if agpf.RewriteRuleSets != nil { + objectMap["rewriteRuleSets"] = agpf.RewriteRuleSets + } + if agpf.RedirectConfigurations != nil { + objectMap["redirectConfigurations"] = agpf.RedirectConfigurations + } + if agpf.WebApplicationFirewallConfiguration != nil { + objectMap["webApplicationFirewallConfiguration"] = agpf.WebApplicationFirewallConfiguration + } + if agpf.FirewallPolicy != nil { + objectMap["firewallPolicy"] = agpf.FirewallPolicy + } + if agpf.EnableHTTP2 != nil { + objectMap["enableHttp2"] = agpf.EnableHTTP2 + } + if agpf.EnableFips != nil { + objectMap["enableFips"] = agpf.EnableFips + } + if agpf.AutoscaleConfiguration != nil { + objectMap["autoscaleConfiguration"] = agpf.AutoscaleConfiguration + } + if agpf.PrivateLinkConfigurations != nil { + objectMap["privateLinkConfigurations"] = agpf.PrivateLinkConfigurations + } + if agpf.CustomErrorConfigurations != nil { + objectMap["customErrorConfigurations"] = agpf.CustomErrorConfigurations + } + if agpf.ForceFirewallPolicyAssociation != nil { + objectMap["forceFirewallPolicyAssociation"] = agpf.ForceFirewallPolicyAssociation + } + if agpf.LoadDistributionPolicies != nil { + objectMap["loadDistributionPolicies"] = agpf.LoadDistributionPolicies + } + if agpf.GlobalConfiguration != nil { + objectMap["globalConfiguration"] = agpf.GlobalConfiguration + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayRedirectConfiguration redirect configuration of an application gateway. +type ApplicationGatewayRedirectConfiguration struct { + // ApplicationGatewayRedirectConfigurationPropertiesFormat - Properties of the application gateway redirect configuration. + *ApplicationGatewayRedirectConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the redirect configuration that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayRedirectConfiguration. +func (agrc ApplicationGatewayRedirectConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agrc.ApplicationGatewayRedirectConfigurationPropertiesFormat != nil { + objectMap["properties"] = agrc.ApplicationGatewayRedirectConfigurationPropertiesFormat + } + if agrc.Name != nil { + objectMap["name"] = agrc.Name + } + if agrc.ID != nil { + objectMap["id"] = agrc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayRedirectConfiguration struct. +func (agrc *ApplicationGatewayRedirectConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayRedirectConfigurationPropertiesFormat ApplicationGatewayRedirectConfigurationPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayRedirectConfigurationPropertiesFormat) + if err != nil { + return err + } + agrc.ApplicationGatewayRedirectConfigurationPropertiesFormat = &applicationGatewayRedirectConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agrc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agrc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agrc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agrc.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayRedirectConfigurationPropertiesFormat properties of redirect configuration of the +// application gateway. +type ApplicationGatewayRedirectConfigurationPropertiesFormat struct { + // RedirectType - HTTP redirection type. Possible values include: 'ApplicationGatewayRedirectTypePermanent', 'ApplicationGatewayRedirectTypeFound', 'ApplicationGatewayRedirectTypeSeeOther', 'ApplicationGatewayRedirectTypeTemporary' + RedirectType ApplicationGatewayRedirectType `json:"redirectType,omitempty"` + // TargetListener - Reference to a listener to redirect the request to. + TargetListener *SubResource `json:"targetListener,omitempty"` + // TargetURL - Url to redirect the request to. + TargetURL *string `json:"targetUrl,omitempty"` + // IncludePath - Include path in the redirected url. + IncludePath *bool `json:"includePath,omitempty"` + // IncludeQueryString - Include query string in the redirected url. + IncludeQueryString *bool `json:"includeQueryString,omitempty"` + // RequestRoutingRules - Request routing specifying redirect configuration. + RequestRoutingRules *[]SubResource `json:"requestRoutingRules,omitempty"` + // URLPathMaps - Url path maps specifying default redirect configuration. + URLPathMaps *[]SubResource `json:"urlPathMaps,omitempty"` + // PathRules - Path rules specifying redirect configuration. + PathRules *[]SubResource `json:"pathRules,omitempty"` +} + +// ApplicationGatewayRequestRoutingRule request routing rule of an application gateway. +type ApplicationGatewayRequestRoutingRule struct { + // ApplicationGatewayRequestRoutingRulePropertiesFormat - Properties of the application gateway request routing rule. + *ApplicationGatewayRequestRoutingRulePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the request routing rule that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayRequestRoutingRule. +func (agrrr ApplicationGatewayRequestRoutingRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agrrr.ApplicationGatewayRequestRoutingRulePropertiesFormat != nil { + objectMap["properties"] = agrrr.ApplicationGatewayRequestRoutingRulePropertiesFormat + } + if agrrr.Name != nil { + objectMap["name"] = agrrr.Name + } + if agrrr.ID != nil { + objectMap["id"] = agrrr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayRequestRoutingRule struct. +func (agrrr *ApplicationGatewayRequestRoutingRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayRequestRoutingRulePropertiesFormat ApplicationGatewayRequestRoutingRulePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayRequestRoutingRulePropertiesFormat) + if err != nil { + return err + } + agrrr.ApplicationGatewayRequestRoutingRulePropertiesFormat = &applicationGatewayRequestRoutingRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agrrr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agrrr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agrrr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agrrr.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayRequestRoutingRulePropertiesFormat properties of request routing rule of the +// application gateway. +type ApplicationGatewayRequestRoutingRulePropertiesFormat struct { + // RuleType - Rule type. Possible values include: 'ApplicationGatewayRequestRoutingRuleTypeBasic', 'ApplicationGatewayRequestRoutingRuleTypePathBasedRouting' + RuleType ApplicationGatewayRequestRoutingRuleType `json:"ruleType,omitempty"` + // Priority - Priority of the request routing rule. + Priority *int32 `json:"priority,omitempty"` + // BackendAddressPool - Backend address pool resource of the application gateway. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + // BackendHTTPSettings - Backend http settings resource of the application gateway. + BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` + // HTTPListener - Http listener resource of the application gateway. + HTTPListener *SubResource `json:"httpListener,omitempty"` + // URLPathMap - URL path map resource of the application gateway. + URLPathMap *SubResource `json:"urlPathMap,omitempty"` + // RewriteRuleSet - Rewrite Rule Set resource in Basic rule of the application gateway. + RewriteRuleSet *SubResource `json:"rewriteRuleSet,omitempty"` + // RedirectConfiguration - Redirect configuration resource of the application gateway. + RedirectConfiguration *SubResource `json:"redirectConfiguration,omitempty"` + // LoadDistributionPolicy - Load Distribution Policy resource of the application gateway. + LoadDistributionPolicy *SubResource `json:"loadDistributionPolicy,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the request routing rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayRequestRoutingRulePropertiesFormat. +func (agrrrpf ApplicationGatewayRequestRoutingRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agrrrpf.RuleType != "" { + objectMap["ruleType"] = agrrrpf.RuleType + } + if agrrrpf.Priority != nil { + objectMap["priority"] = agrrrpf.Priority + } + if agrrrpf.BackendAddressPool != nil { + objectMap["backendAddressPool"] = agrrrpf.BackendAddressPool + } + if agrrrpf.BackendHTTPSettings != nil { + objectMap["backendHttpSettings"] = agrrrpf.BackendHTTPSettings + } + if agrrrpf.HTTPListener != nil { + objectMap["httpListener"] = agrrrpf.HTTPListener + } + if agrrrpf.URLPathMap != nil { + objectMap["urlPathMap"] = agrrrpf.URLPathMap + } + if agrrrpf.RewriteRuleSet != nil { + objectMap["rewriteRuleSet"] = agrrrpf.RewriteRuleSet + } + if agrrrpf.RedirectConfiguration != nil { + objectMap["redirectConfiguration"] = agrrrpf.RedirectConfiguration + } + if agrrrpf.LoadDistributionPolicy != nil { + objectMap["loadDistributionPolicy"] = agrrrpf.LoadDistributionPolicy + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayRewriteRule rewrite rule of an application gateway. +type ApplicationGatewayRewriteRule struct { + // Name - Name of the rewrite rule that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // RuleSequence - Rule Sequence of the rewrite rule that determines the order of execution of a particular rule in a RewriteRuleSet. + RuleSequence *int32 `json:"ruleSequence,omitempty"` + // Conditions - Conditions based on which the action set execution will be evaluated. + Conditions *[]ApplicationGatewayRewriteRuleCondition `json:"conditions,omitempty"` + // ActionSet - Set of actions to be done as part of the rewrite Rule. + ActionSet *ApplicationGatewayRewriteRuleActionSet `json:"actionSet,omitempty"` +} + +// ApplicationGatewayRewriteRuleActionSet set of actions in the Rewrite Rule in Application Gateway. +type ApplicationGatewayRewriteRuleActionSet struct { + // RequestHeaderConfigurations - Request Header Actions in the Action Set. + RequestHeaderConfigurations *[]ApplicationGatewayHeaderConfiguration `json:"requestHeaderConfigurations,omitempty"` + // ResponseHeaderConfigurations - Response Header Actions in the Action Set. + ResponseHeaderConfigurations *[]ApplicationGatewayHeaderConfiguration `json:"responseHeaderConfigurations,omitempty"` + // URLConfiguration - Url Configuration Action in the Action Set. + URLConfiguration *ApplicationGatewayURLConfiguration `json:"urlConfiguration,omitempty"` +} + +// ApplicationGatewayRewriteRuleCondition set of conditions in the Rewrite Rule in Application Gateway. +type ApplicationGatewayRewriteRuleCondition struct { + // Variable - The condition parameter of the RewriteRuleCondition. + Variable *string `json:"variable,omitempty"` + // Pattern - The pattern, either fixed string or regular expression, that evaluates the truthfulness of the condition. + Pattern *string `json:"pattern,omitempty"` + // IgnoreCase - Setting this parameter to truth value with force the pattern to do a case in-sensitive comparison. + IgnoreCase *bool `json:"ignoreCase,omitempty"` + // Negate - Setting this value as truth will force to check the negation of the condition given by the user. + Negate *bool `json:"negate,omitempty"` +} + +// ApplicationGatewayRewriteRuleSet rewrite rule set of an application gateway. +type ApplicationGatewayRewriteRuleSet struct { + // ApplicationGatewayRewriteRuleSetPropertiesFormat - Properties of the application gateway rewrite rule set. + *ApplicationGatewayRewriteRuleSetPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the rewrite rule set that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayRewriteRuleSet. +func (agrrs ApplicationGatewayRewriteRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agrrs.ApplicationGatewayRewriteRuleSetPropertiesFormat != nil { + objectMap["properties"] = agrrs.ApplicationGatewayRewriteRuleSetPropertiesFormat + } + if agrrs.Name != nil { + objectMap["name"] = agrrs.Name + } + if agrrs.ID != nil { + objectMap["id"] = agrrs.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayRewriteRuleSet struct. +func (agrrs *ApplicationGatewayRewriteRuleSet) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayRewriteRuleSetPropertiesFormat ApplicationGatewayRewriteRuleSetPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayRewriteRuleSetPropertiesFormat) + if err != nil { + return err + } + agrrs.ApplicationGatewayRewriteRuleSetPropertiesFormat = &applicationGatewayRewriteRuleSetPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agrrs.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agrrs.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agrrs.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayRewriteRuleSetPropertiesFormat properties of rewrite rule set of the application +// gateway. +type ApplicationGatewayRewriteRuleSetPropertiesFormat struct { + // RewriteRules - Rewrite rules in the rewrite rule set. + RewriteRules *[]ApplicationGatewayRewriteRule `json:"rewriteRules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the rewrite rule set resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayRewriteRuleSetPropertiesFormat. +func (agrrspf ApplicationGatewayRewriteRuleSetPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agrrspf.RewriteRules != nil { + objectMap["rewriteRules"] = agrrspf.RewriteRules + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayRoutingRule routing rule of an application gateway. +type ApplicationGatewayRoutingRule struct { + // ApplicationGatewayRoutingRulePropertiesFormat - Properties of the application gateway routing rule. + *ApplicationGatewayRoutingRulePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the routing rule that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayRoutingRule. +func (agrr ApplicationGatewayRoutingRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agrr.ApplicationGatewayRoutingRulePropertiesFormat != nil { + objectMap["properties"] = agrr.ApplicationGatewayRoutingRulePropertiesFormat + } + if agrr.Name != nil { + objectMap["name"] = agrr.Name + } + if agrr.ID != nil { + objectMap["id"] = agrr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayRoutingRule struct. +func (agrr *ApplicationGatewayRoutingRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayRoutingRulePropertiesFormat ApplicationGatewayRoutingRulePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayRoutingRulePropertiesFormat) + if err != nil { + return err + } + agrr.ApplicationGatewayRoutingRulePropertiesFormat = &applicationGatewayRoutingRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agrr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agrr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agrr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agrr.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayRoutingRulePropertiesFormat properties of routing rule of the application gateway. +type ApplicationGatewayRoutingRulePropertiesFormat struct { + // RuleType - Rule type. Possible values include: 'ApplicationGatewayRequestRoutingRuleTypeBasic', 'ApplicationGatewayRequestRoutingRuleTypePathBasedRouting' + RuleType ApplicationGatewayRequestRoutingRuleType `json:"ruleType,omitempty"` + // Priority - Priority of the routing rule. + Priority *int32 `json:"priority,omitempty"` + // BackendAddressPool - Backend address pool resource of the application gateway. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + // BackendSettings - Backend settings resource of the application gateway. + BackendSettings *SubResource `json:"backendSettings,omitempty"` + // Listener - Listener resource of the application gateway. + Listener *SubResource `json:"listener,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the request routing rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayRoutingRulePropertiesFormat. +func (agrrpf ApplicationGatewayRoutingRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agrrpf.RuleType != "" { + objectMap["ruleType"] = agrrpf.RuleType + } + if agrrpf.Priority != nil { + objectMap["priority"] = agrrpf.Priority + } + if agrrpf.BackendAddressPool != nil { + objectMap["backendAddressPool"] = agrrpf.BackendAddressPool + } + if agrrpf.BackendSettings != nil { + objectMap["backendSettings"] = agrrpf.BackendSettings + } + if agrrpf.Listener != nil { + objectMap["listener"] = agrrpf.Listener + } + return json.Marshal(objectMap) +} + +// ApplicationGatewaySku SKU of an application gateway. +type ApplicationGatewaySku struct { + // Name - Name of an application gateway SKU. Possible values include: 'ApplicationGatewaySkuNameStandardSmall', 'ApplicationGatewaySkuNameStandardMedium', 'ApplicationGatewaySkuNameStandardLarge', 'ApplicationGatewaySkuNameWAFMedium', 'ApplicationGatewaySkuNameWAFLarge', 'ApplicationGatewaySkuNameStandardV2', 'ApplicationGatewaySkuNameStandardBasic', 'ApplicationGatewaySkuNameWAFV2' + Name ApplicationGatewaySkuName `json:"name,omitempty"` + // Tier - Tier of an application gateway. Possible values include: 'ApplicationGatewayTierStandard', 'ApplicationGatewayTierWAF', 'ApplicationGatewayTierStandardV2', 'ApplicationGatewayTierWAFV2', 'ApplicationGatewayTierStandardBasic' + Tier ApplicationGatewayTier `json:"tier,omitempty"` + // Capacity - Capacity (instance count) of an application gateway. + Capacity *int32 `json:"capacity,omitempty"` +} + +// ApplicationGatewaySslCertificate SSL certificates of an application gateway. +type ApplicationGatewaySslCertificate struct { + // ApplicationGatewaySslCertificatePropertiesFormat - Properties of the application gateway SSL certificate. + *ApplicationGatewaySslCertificatePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the SSL certificate that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewaySslCertificate. +func (agsc ApplicationGatewaySslCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agsc.ApplicationGatewaySslCertificatePropertiesFormat != nil { + objectMap["properties"] = agsc.ApplicationGatewaySslCertificatePropertiesFormat + } + if agsc.Name != nil { + objectMap["name"] = agsc.Name + } + if agsc.ID != nil { + objectMap["id"] = agsc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewaySslCertificate struct. +func (agsc *ApplicationGatewaySslCertificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewaySslCertificatePropertiesFormat ApplicationGatewaySslCertificatePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewaySslCertificatePropertiesFormat) + if err != nil { + return err + } + agsc.ApplicationGatewaySslCertificatePropertiesFormat = &applicationGatewaySslCertificatePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agsc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agsc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agsc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agsc.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewaySslCertificatePropertiesFormat properties of SSL certificates of an application +// gateway. +type ApplicationGatewaySslCertificatePropertiesFormat struct { + // Data - Base-64 encoded pfx certificate. Only applicable in PUT Request. + Data *string `json:"data,omitempty"` + // Password - Password for the pfx file specified in data. Only applicable in PUT request. + Password *string `json:"password,omitempty"` + // PublicCertData - READ-ONLY; Base-64 encoded Public cert data corresponding to pfx specified in data. Only applicable in GET request. + PublicCertData *string `json:"publicCertData,omitempty"` + // KeyVaultSecretID - Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. + KeyVaultSecretID *string `json:"keyVaultSecretId,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the SSL certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewaySslCertificatePropertiesFormat. +func (agscpf ApplicationGatewaySslCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agscpf.Data != nil { + objectMap["data"] = agscpf.Data + } + if agscpf.Password != nil { + objectMap["password"] = agscpf.Password + } + if agscpf.KeyVaultSecretID != nil { + objectMap["keyVaultSecretId"] = agscpf.KeyVaultSecretID + } + return json.Marshal(objectMap) +} + +// ApplicationGatewaySslPolicy application Gateway Ssl policy. +type ApplicationGatewaySslPolicy struct { + // DisabledSslProtocols - Ssl protocols to be disabled on application gateway. + DisabledSslProtocols *[]ApplicationGatewaySslProtocol `json:"disabledSslProtocols,omitempty"` + // PolicyType - Type of Ssl Policy. Possible values include: 'ApplicationGatewaySslPolicyTypePredefined', 'ApplicationGatewaySslPolicyTypeCustom', 'ApplicationGatewaySslPolicyTypeCustomV2' + PolicyType ApplicationGatewaySslPolicyType `json:"policyType,omitempty"` + // PolicyName - Name of Ssl predefined policy. Possible values include: 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20150501', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401S', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20220101S' + PolicyName ApplicationGatewaySslPolicyName `json:"policyName,omitempty"` + // CipherSuites - Ssl cipher suites to be enabled in the specified order to application gateway. + CipherSuites *[]ApplicationGatewaySslCipherSuite `json:"cipherSuites,omitempty"` + // MinProtocolVersion - Minimum version of Ssl protocol to be supported on application gateway. Possible values include: 'ApplicationGatewaySslProtocolTLSv10', 'ApplicationGatewaySslProtocolTLSv11', 'ApplicationGatewaySslProtocolTLSv12', 'ApplicationGatewaySslProtocolTLSv13' + MinProtocolVersion ApplicationGatewaySslProtocol `json:"minProtocolVersion,omitempty"` +} + +// ApplicationGatewaySslPredefinedPolicy an Ssl predefined policy. +type ApplicationGatewaySslPredefinedPolicy struct { + autorest.Response `json:"-"` + // Name - Name of the Ssl predefined policy. + Name *string `json:"name,omitempty"` + // ApplicationGatewaySslPredefinedPolicyPropertiesFormat - Properties of the application gateway SSL predefined policy. + *ApplicationGatewaySslPredefinedPolicyPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewaySslPredefinedPolicy. +func (agspp ApplicationGatewaySslPredefinedPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agspp.Name != nil { + objectMap["name"] = agspp.Name + } + if agspp.ApplicationGatewaySslPredefinedPolicyPropertiesFormat != nil { + objectMap["properties"] = agspp.ApplicationGatewaySslPredefinedPolicyPropertiesFormat + } + if agspp.ID != nil { + objectMap["id"] = agspp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewaySslPredefinedPolicy struct. +func (agspp *ApplicationGatewaySslPredefinedPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agspp.Name = &name + } + case "properties": + if v != nil { + var applicationGatewaySslPredefinedPolicyPropertiesFormat ApplicationGatewaySslPredefinedPolicyPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewaySslPredefinedPolicyPropertiesFormat) + if err != nil { + return err + } + agspp.ApplicationGatewaySslPredefinedPolicyPropertiesFormat = &applicationGatewaySslPredefinedPolicyPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agspp.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewaySslPredefinedPolicyPropertiesFormat properties of +// ApplicationGatewaySslPredefinedPolicy. +type ApplicationGatewaySslPredefinedPolicyPropertiesFormat struct { + // CipherSuites - Ssl cipher suites to be enabled in the specified order for application gateway. + CipherSuites *[]ApplicationGatewaySslCipherSuite `json:"cipherSuites,omitempty"` + // MinProtocolVersion - Minimum version of Ssl protocol to be supported on application gateway. Possible values include: 'ApplicationGatewaySslProtocolTLSv10', 'ApplicationGatewaySslProtocolTLSv11', 'ApplicationGatewaySslProtocolTLSv12', 'ApplicationGatewaySslProtocolTLSv13' + MinProtocolVersion ApplicationGatewaySslProtocol `json:"minProtocolVersion,omitempty"` +} + +// ApplicationGatewaySslProfile SSL profile of an application gateway. +type ApplicationGatewaySslProfile struct { + // ApplicationGatewaySslProfilePropertiesFormat - Properties of the application gateway SSL profile. + *ApplicationGatewaySslProfilePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the SSL profile that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewaySslProfile. +func (agsp ApplicationGatewaySslProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agsp.ApplicationGatewaySslProfilePropertiesFormat != nil { + objectMap["properties"] = agsp.ApplicationGatewaySslProfilePropertiesFormat + } + if agsp.Name != nil { + objectMap["name"] = agsp.Name + } + if agsp.ID != nil { + objectMap["id"] = agsp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewaySslProfile struct. +func (agsp *ApplicationGatewaySslProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewaySslProfilePropertiesFormat ApplicationGatewaySslProfilePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewaySslProfilePropertiesFormat) + if err != nil { + return err + } + agsp.ApplicationGatewaySslProfilePropertiesFormat = &applicationGatewaySslProfilePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agsp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agsp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agsp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agsp.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewaySslProfilePropertiesFormat properties of SSL profile of an application gateway. +type ApplicationGatewaySslProfilePropertiesFormat struct { + // TrustedClientCertificates - Array of references to application gateway trusted client certificates. + TrustedClientCertificates *[]SubResource `json:"trustedClientCertificates,omitempty"` + // SslPolicy - SSL policy of the application gateway resource. + SslPolicy *ApplicationGatewaySslPolicy `json:"sslPolicy,omitempty"` + // ClientAuthConfiguration - Client authentication configuration of the application gateway resource. + ClientAuthConfiguration *ApplicationGatewayClientAuthConfiguration `json:"clientAuthConfiguration,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the HTTP listener resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewaySslProfilePropertiesFormat. +func (agsppf ApplicationGatewaySslProfilePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agsppf.TrustedClientCertificates != nil { + objectMap["trustedClientCertificates"] = agsppf.TrustedClientCertificates + } + if agsppf.SslPolicy != nil { + objectMap["sslPolicy"] = agsppf.SslPolicy + } + if agsppf.ClientAuthConfiguration != nil { + objectMap["clientAuthConfiguration"] = agsppf.ClientAuthConfiguration + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayTrustedClientCertificate trusted client certificates of an application gateway. +type ApplicationGatewayTrustedClientCertificate struct { + // ApplicationGatewayTrustedClientCertificatePropertiesFormat - Properties of the application gateway trusted client certificate. + *ApplicationGatewayTrustedClientCertificatePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the trusted client certificate that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayTrustedClientCertificate. +func (agtcc ApplicationGatewayTrustedClientCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agtcc.ApplicationGatewayTrustedClientCertificatePropertiesFormat != nil { + objectMap["properties"] = agtcc.ApplicationGatewayTrustedClientCertificatePropertiesFormat + } + if agtcc.Name != nil { + objectMap["name"] = agtcc.Name + } + if agtcc.ID != nil { + objectMap["id"] = agtcc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayTrustedClientCertificate struct. +func (agtcc *ApplicationGatewayTrustedClientCertificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayTrustedClientCertificatePropertiesFormat ApplicationGatewayTrustedClientCertificatePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayTrustedClientCertificatePropertiesFormat) + if err != nil { + return err + } + agtcc.ApplicationGatewayTrustedClientCertificatePropertiesFormat = &applicationGatewayTrustedClientCertificatePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agtcc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agtcc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agtcc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agtcc.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayTrustedClientCertificatePropertiesFormat trusted client certificates properties of an +// application gateway. +type ApplicationGatewayTrustedClientCertificatePropertiesFormat struct { + // Data - Certificate public data. + Data *string `json:"data,omitempty"` + // ValidatedCertData - READ-ONLY; Validated certificate data. + ValidatedCertData *string `json:"validatedCertData,omitempty"` + // ClientCertIssuerDN - READ-ONLY; Distinguished name of client certificate issuer. + ClientCertIssuerDN *string `json:"clientCertIssuerDN,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the trusted client certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayTrustedClientCertificatePropertiesFormat. +func (agtccpf ApplicationGatewayTrustedClientCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agtccpf.Data != nil { + objectMap["data"] = agtccpf.Data + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayTrustedRootCertificate trusted Root certificates of an application gateway. +type ApplicationGatewayTrustedRootCertificate struct { + // ApplicationGatewayTrustedRootCertificatePropertiesFormat - Properties of the application gateway trusted root certificate. + *ApplicationGatewayTrustedRootCertificatePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the trusted root certificate that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayTrustedRootCertificate. +func (agtrc ApplicationGatewayTrustedRootCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agtrc.ApplicationGatewayTrustedRootCertificatePropertiesFormat != nil { + objectMap["properties"] = agtrc.ApplicationGatewayTrustedRootCertificatePropertiesFormat + } + if agtrc.Name != nil { + objectMap["name"] = agtrc.Name + } + if agtrc.ID != nil { + objectMap["id"] = agtrc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayTrustedRootCertificate struct. +func (agtrc *ApplicationGatewayTrustedRootCertificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayTrustedRootCertificatePropertiesFormat ApplicationGatewayTrustedRootCertificatePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayTrustedRootCertificatePropertiesFormat) + if err != nil { + return err + } + agtrc.ApplicationGatewayTrustedRootCertificatePropertiesFormat = &applicationGatewayTrustedRootCertificatePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agtrc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agtrc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agtrc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agtrc.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayTrustedRootCertificatePropertiesFormat trusted Root certificates properties of an +// application gateway. +type ApplicationGatewayTrustedRootCertificatePropertiesFormat struct { + // Data - Certificate public data. + Data *string `json:"data,omitempty"` + // KeyVaultSecretID - Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. + KeyVaultSecretID *string `json:"keyVaultSecretId,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the trusted root certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayTrustedRootCertificatePropertiesFormat. +func (agtrcpf ApplicationGatewayTrustedRootCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agtrcpf.Data != nil { + objectMap["data"] = agtrcpf.Data + } + if agtrcpf.KeyVaultSecretID != nil { + objectMap["keyVaultSecretId"] = agtrcpf.KeyVaultSecretID + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayURLConfiguration url configuration of the Actions set in Application Gateway. +type ApplicationGatewayURLConfiguration struct { + // ModifiedPath - Url path which user has provided for url rewrite. Null means no path will be updated. Default value is null. + ModifiedPath *string `json:"modifiedPath,omitempty"` + // ModifiedQueryString - Query string which user has provided for url rewrite. Null means no query string will be updated. Default value is null. + ModifiedQueryString *string `json:"modifiedQueryString,omitempty"` + // Reroute - 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. + Reroute *bool `json:"reroute,omitempty"` +} + +// ApplicationGatewayURLPathMap urlPathMaps give a url path to the backend mapping information for +// PathBasedRouting. +type ApplicationGatewayURLPathMap struct { + // ApplicationGatewayURLPathMapPropertiesFormat - Properties of the application gateway URL path map. + *ApplicationGatewayURLPathMapPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the URL path map that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayURLPathMap. +func (agupm ApplicationGatewayURLPathMap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agupm.ApplicationGatewayURLPathMapPropertiesFormat != nil { + objectMap["properties"] = agupm.ApplicationGatewayURLPathMapPropertiesFormat + } + if agupm.Name != nil { + objectMap["name"] = agupm.Name + } + if agupm.ID != nil { + objectMap["id"] = agupm.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayURLPathMap struct. +func (agupm *ApplicationGatewayURLPathMap) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayURLPathMapPropertiesFormat ApplicationGatewayURLPathMapPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayURLPathMapPropertiesFormat) + if err != nil { + return err + } + agupm.ApplicationGatewayURLPathMapPropertiesFormat = &applicationGatewayURLPathMapPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agupm.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agupm.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agupm.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agupm.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayURLPathMapPropertiesFormat properties of UrlPathMap of the application gateway. +type ApplicationGatewayURLPathMapPropertiesFormat struct { + // DefaultBackendAddressPool - Default backend address pool resource of URL path map. + DefaultBackendAddressPool *SubResource `json:"defaultBackendAddressPool,omitempty"` + // DefaultBackendHTTPSettings - Default backend http settings resource of URL path map. + DefaultBackendHTTPSettings *SubResource `json:"defaultBackendHttpSettings,omitempty"` + // DefaultRewriteRuleSet - Default Rewrite rule set resource of URL path map. + DefaultRewriteRuleSet *SubResource `json:"defaultRewriteRuleSet,omitempty"` + // DefaultRedirectConfiguration - Default redirect configuration resource of URL path map. + DefaultRedirectConfiguration *SubResource `json:"defaultRedirectConfiguration,omitempty"` + // DefaultLoadDistributionPolicy - Default Load Distribution Policy resource of URL path map. + DefaultLoadDistributionPolicy *SubResource `json:"defaultLoadDistributionPolicy,omitempty"` + // PathRules - Path rule of URL path map resource. + PathRules *[]ApplicationGatewayPathRule `json:"pathRules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the URL path map resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayURLPathMapPropertiesFormat. +func (agupmpf ApplicationGatewayURLPathMapPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agupmpf.DefaultBackendAddressPool != nil { + objectMap["defaultBackendAddressPool"] = agupmpf.DefaultBackendAddressPool + } + if agupmpf.DefaultBackendHTTPSettings != nil { + objectMap["defaultBackendHttpSettings"] = agupmpf.DefaultBackendHTTPSettings + } + if agupmpf.DefaultRewriteRuleSet != nil { + objectMap["defaultRewriteRuleSet"] = agupmpf.DefaultRewriteRuleSet + } + if agupmpf.DefaultRedirectConfiguration != nil { + objectMap["defaultRedirectConfiguration"] = agupmpf.DefaultRedirectConfiguration + } + if agupmpf.DefaultLoadDistributionPolicy != nil { + objectMap["defaultLoadDistributionPolicy"] = agupmpf.DefaultLoadDistributionPolicy + } + if agupmpf.PathRules != nil { + objectMap["pathRules"] = agupmpf.PathRules + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayWafDynamicManifestPropertiesResult properties of ApplicationGatewayWafDynamicManifest. +type ApplicationGatewayWafDynamicManifestPropertiesResult struct { + // DefaultRuleSetPropertyFormat - The default ruleset. + *DefaultRuleSetPropertyFormat `json:"defaultRuleSet,omitempty"` + // AvailableRuleSets - The available rulesets. + AvailableRuleSets *[]ApplicationGatewayFirewallManifestRuleSet `json:"availableRuleSets,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayWafDynamicManifestPropertiesResult. +func (agwdmpr ApplicationGatewayWafDynamicManifestPropertiesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agwdmpr.DefaultRuleSetPropertyFormat != nil { + objectMap["defaultRuleSet"] = agwdmpr.DefaultRuleSetPropertyFormat + } + if agwdmpr.AvailableRuleSets != nil { + objectMap["availableRuleSets"] = agwdmpr.AvailableRuleSets + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayWafDynamicManifestPropertiesResult struct. +func (agwdmpr *ApplicationGatewayWafDynamicManifestPropertiesResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "defaultRuleSet": + if v != nil { + var defaultRuleSetPropertyFormat DefaultRuleSetPropertyFormat + err = json.Unmarshal(*v, &defaultRuleSetPropertyFormat) + if err != nil { + return err + } + agwdmpr.DefaultRuleSetPropertyFormat = &defaultRuleSetPropertyFormat + } + case "availableRuleSets": + if v != nil { + var availableRuleSets []ApplicationGatewayFirewallManifestRuleSet + err = json.Unmarshal(*v, &availableRuleSets) + if err != nil { + return err + } + agwdmpr.AvailableRuleSets = &availableRuleSets + } + } + } + + return nil +} + +// ApplicationGatewayWafDynamicManifestResult response for ApplicationGatewayWafDynamicManifest API service +// call. +type ApplicationGatewayWafDynamicManifestResult struct { + autorest.Response `json:"-"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ApplicationGatewayWafDynamicManifestPropertiesResult - Properties of the ApplicationGatewayWafDynamicManifest . + *ApplicationGatewayWafDynamicManifestPropertiesResult `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayWafDynamicManifestResult. +func (agwdmr ApplicationGatewayWafDynamicManifestResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agwdmr.ID != nil { + objectMap["id"] = agwdmr.ID + } + if agwdmr.ApplicationGatewayWafDynamicManifestPropertiesResult != nil { + objectMap["properties"] = agwdmr.ApplicationGatewayWafDynamicManifestPropertiesResult + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayWafDynamicManifestResult struct. +func (agwdmr *ApplicationGatewayWafDynamicManifestResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agwdmr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agwdmr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agwdmr.Type = &typeVar + } + case "properties": + if v != nil { + var applicationGatewayWafDynamicManifestPropertiesResult ApplicationGatewayWafDynamicManifestPropertiesResult + err = json.Unmarshal(*v, &applicationGatewayWafDynamicManifestPropertiesResult) + if err != nil { + return err + } + agwdmr.ApplicationGatewayWafDynamicManifestPropertiesResult = &applicationGatewayWafDynamicManifestPropertiesResult + } + } + } + + return nil +} + +// ApplicationGatewayWafDynamicManifestResultList response for ApplicationGatewayWafDynamicManifests API +// service call. +type ApplicationGatewayWafDynamicManifestResultList struct { + autorest.Response `json:"-"` + // Value - The list of application gateway waf manifest. + Value *[]ApplicationGatewayWafDynamicManifestResult `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplicationGatewayWafDynamicManifestResultListIterator provides access to a complete listing of +// ApplicationGatewayWafDynamicManifestResult values. +type ApplicationGatewayWafDynamicManifestResultListIterator struct { + i int + page ApplicationGatewayWafDynamicManifestResultListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ApplicationGatewayWafDynamicManifestResultListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayWafDynamicManifestResultListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationGatewayWafDynamicManifestResultListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationGatewayWafDynamicManifestResultListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ApplicationGatewayWafDynamicManifestResultListIterator) Response() ApplicationGatewayWafDynamicManifestResultList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ApplicationGatewayWafDynamicManifestResultListIterator) Value() ApplicationGatewayWafDynamicManifestResult { + if !iter.page.NotDone() { + return ApplicationGatewayWafDynamicManifestResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ApplicationGatewayWafDynamicManifestResultListIterator type. +func NewApplicationGatewayWafDynamicManifestResultListIterator(page ApplicationGatewayWafDynamicManifestResultListPage) ApplicationGatewayWafDynamicManifestResultListIterator { + return ApplicationGatewayWafDynamicManifestResultListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (agwdmrl ApplicationGatewayWafDynamicManifestResultList) IsEmpty() bool { + return agwdmrl.Value == nil || len(*agwdmrl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (agwdmrl ApplicationGatewayWafDynamicManifestResultList) hasNextLink() bool { + return agwdmrl.NextLink != nil && len(*agwdmrl.NextLink) != 0 +} + +// applicationGatewayWafDynamicManifestResultListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (agwdmrl ApplicationGatewayWafDynamicManifestResultList) applicationGatewayWafDynamicManifestResultListPreparer(ctx context.Context) (*http.Request, error) { + if !agwdmrl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(agwdmrl.NextLink))) +} + +// ApplicationGatewayWafDynamicManifestResultListPage contains a page of +// ApplicationGatewayWafDynamicManifestResult values. +type ApplicationGatewayWafDynamicManifestResultListPage struct { + fn func(context.Context, ApplicationGatewayWafDynamicManifestResultList) (ApplicationGatewayWafDynamicManifestResultList, error) + agwdmrl ApplicationGatewayWafDynamicManifestResultList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ApplicationGatewayWafDynamicManifestResultListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayWafDynamicManifestResultListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.agwdmrl) + if err != nil { + return err + } + page.agwdmrl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationGatewayWafDynamicManifestResultListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationGatewayWafDynamicManifestResultListPage) NotDone() bool { + return !page.agwdmrl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationGatewayWafDynamicManifestResultListPage) Response() ApplicationGatewayWafDynamicManifestResultList { + return page.agwdmrl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationGatewayWafDynamicManifestResultListPage) Values() []ApplicationGatewayWafDynamicManifestResult { + if page.agwdmrl.IsEmpty() { + return nil + } + return *page.agwdmrl.Value +} + +// Creates a new instance of the ApplicationGatewayWafDynamicManifestResultListPage type. +func NewApplicationGatewayWafDynamicManifestResultListPage(cur ApplicationGatewayWafDynamicManifestResultList, getNextPage func(context.Context, ApplicationGatewayWafDynamicManifestResultList) (ApplicationGatewayWafDynamicManifestResultList, error)) ApplicationGatewayWafDynamicManifestResultListPage { + return ApplicationGatewayWafDynamicManifestResultListPage{ + fn: getNextPage, + agwdmrl: cur, + } +} + +// ApplicationGatewayWebApplicationFirewallConfiguration application gateway web application firewall +// configuration. +type ApplicationGatewayWebApplicationFirewallConfiguration struct { + // Enabled - Whether the web application firewall is enabled or not. + Enabled *bool `json:"enabled,omitempty"` + // FirewallMode - Web application firewall mode. Possible values include: 'ApplicationGatewayFirewallModeDetection', 'ApplicationGatewayFirewallModePrevention' + FirewallMode ApplicationGatewayFirewallMode `json:"firewallMode,omitempty"` + // RuleSetType - The type of the web application firewall rule set. Possible values are: 'OWASP'. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - The version of the rule set type. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + // DisabledRuleGroups - The disabled rule groups. + DisabledRuleGroups *[]ApplicationGatewayFirewallDisabledRuleGroup `json:"disabledRuleGroups,omitempty"` + // RequestBodyCheck - Whether allow WAF to check request Body. + RequestBodyCheck *bool `json:"requestBodyCheck,omitempty"` + // MaxRequestBodySize - Maximum request body size for WAF. + MaxRequestBodySize *int32 `json:"maxRequestBodySize,omitempty"` + // MaxRequestBodySizeInKb - Maximum request body size in Kb for WAF. + MaxRequestBodySizeInKb *int32 `json:"maxRequestBodySizeInKb,omitempty"` + // FileUploadLimitInMb - Maximum file upload size in Mb for WAF. + FileUploadLimitInMb *int32 `json:"fileUploadLimitInMb,omitempty"` + // Exclusions - The exclusion list. + Exclusions *[]ApplicationGatewayFirewallExclusion `json:"exclusions,omitempty"` +} + +// ApplicationGatewaysBackendHealthFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ApplicationGatewaysBackendHealthFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewaysClient) (ApplicationGatewayBackendHealth, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewaysBackendHealthFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewaysBackendHealthFuture.Result. +func (future *ApplicationGatewaysBackendHealthFuture) result(client ApplicationGatewaysClient) (agbh ApplicationGatewayBackendHealth, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + agbh.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysBackendHealthFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if agbh.Response.Response, err = future.GetResult(sender); err == nil && agbh.Response.Response.StatusCode != http.StatusNoContent { + agbh, err = client.BackendHealthResponder(agbh.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthFuture", "Result", agbh.Response.Response, "Failure responding to request") + } + } + return +} + +// ApplicationGatewaysBackendHealthOnDemandFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ApplicationGatewaysBackendHealthOnDemandFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewaysClient) (ApplicationGatewayBackendHealthOnDemand, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewaysBackendHealthOnDemandFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewaysBackendHealthOnDemandFuture.Result. +func (future *ApplicationGatewaysBackendHealthOnDemandFuture) result(client ApplicationGatewaysClient) (agbhod ApplicationGatewayBackendHealthOnDemand, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthOnDemandFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + agbhod.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysBackendHealthOnDemandFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if agbhod.Response.Response, err = future.GetResult(sender); err == nil && agbhod.Response.Response.StatusCode != http.StatusNoContent { + agbhod, err = client.BackendHealthOnDemandResponder(agbhod.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthOnDemandFuture", "Result", agbhod.Response.Response, "Failure responding to request") + } + } + return +} + +// ApplicationGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ApplicationGatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewaysClient) (ApplicationGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewaysCreateOrUpdateFuture.Result. +func (future *ApplicationGatewaysCreateOrUpdateFuture) result(client ApplicationGatewaysClient) (ag ApplicationGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ag.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ag.Response.Response, err = future.GetResult(sender); err == nil && ag.Response.Response.StatusCode != http.StatusNoContent { + ag, err = client.CreateOrUpdateResponder(ag.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", ag.Response.Response, "Failure responding to request") + } + } + return +} + +// ApplicationGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ApplicationGatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewaysDeleteFuture.Result. +func (future *ApplicationGatewaysDeleteFuture) result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ApplicationGatewaysStartFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ApplicationGatewaysStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewaysStartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewaysStartFuture.Result. +func (future *ApplicationGatewaysStartFuture) result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStartFuture") + return + } + ar.Response = future.Response() + return +} + +// ApplicationGatewaysStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ApplicationGatewaysStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewaysStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewaysStopFuture.Result. +func (future *ApplicationGatewaysStopFuture) result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStopFuture") + return + } + ar.Response = future.Response() + return +} + +// ApplicationRule rule of type application. +type ApplicationRule struct { + // SourceAddresses - List of source IP addresses for this rule. + SourceAddresses *[]string `json:"sourceAddresses,omitempty"` + // DestinationAddresses - List of destination IP addresses or Service Tags. + DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` + // Protocols - Array of Application Protocols. + Protocols *[]FirewallPolicyRuleApplicationProtocol `json:"protocols,omitempty"` + // TargetFqdns - List of FQDNs for this rule. + TargetFqdns *[]string `json:"targetFqdns,omitempty"` + // TargetUrls - List of Urls for this rule condition. + TargetUrls *[]string `json:"targetUrls,omitempty"` + // FqdnTags - List of FQDN Tags for this rule. + FqdnTags *[]string `json:"fqdnTags,omitempty"` + // SourceIPGroups - List of source IpGroups for this rule. + SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` + // TerminateTLS - Terminate TLS connections for this rule. + TerminateTLS *bool `json:"terminateTLS,omitempty"` + // WebCategories - List of destination azure web categories. + WebCategories *[]string `json:"webCategories,omitempty"` + // Name - Name of the rule. + Name *string `json:"name,omitempty"` + // Description - Description of the rule. + Description *string `json:"description,omitempty"` + // RuleType - Possible values include: 'RuleTypeFirewallPolicyRule', 'RuleTypeApplicationRule', 'RuleTypeNatRule', 'RuleTypeNetworkRule' + RuleType RuleType `json:"ruleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationRule. +func (ar ApplicationRule) MarshalJSON() ([]byte, error) { + ar.RuleType = RuleTypeApplicationRule + objectMap := make(map[string]interface{}) + if ar.SourceAddresses != nil { + objectMap["sourceAddresses"] = ar.SourceAddresses + } + if ar.DestinationAddresses != nil { + objectMap["destinationAddresses"] = ar.DestinationAddresses + } + if ar.Protocols != nil { + objectMap["protocols"] = ar.Protocols + } + if ar.TargetFqdns != nil { + objectMap["targetFqdns"] = ar.TargetFqdns + } + if ar.TargetUrls != nil { + objectMap["targetUrls"] = ar.TargetUrls + } + if ar.FqdnTags != nil { + objectMap["fqdnTags"] = ar.FqdnTags + } + if ar.SourceIPGroups != nil { + objectMap["sourceIpGroups"] = ar.SourceIPGroups + } + if ar.TerminateTLS != nil { + objectMap["terminateTLS"] = ar.TerminateTLS + } + if ar.WebCategories != nil { + objectMap["webCategories"] = ar.WebCategories + } + if ar.Name != nil { + objectMap["name"] = ar.Name + } + if ar.Description != nil { + objectMap["description"] = ar.Description + } + if ar.RuleType != "" { + objectMap["ruleType"] = ar.RuleType + } + return json.Marshal(objectMap) +} + +// AsApplicationRule is the BasicFirewallPolicyRule implementation for ApplicationRule. +func (ar ApplicationRule) AsApplicationRule() (*ApplicationRule, bool) { + return &ar, true +} + +// AsNatRule is the BasicFirewallPolicyRule implementation for ApplicationRule. +func (ar ApplicationRule) AsNatRule() (*NatRule, bool) { + return nil, false +} + +// AsRule is the BasicFirewallPolicyRule implementation for ApplicationRule. +func (ar ApplicationRule) AsRule() (*Rule, bool) { + return nil, false +} + +// AsFirewallPolicyRule is the BasicFirewallPolicyRule implementation for ApplicationRule. +func (ar ApplicationRule) AsFirewallPolicyRule() (*FirewallPolicyRule, bool) { + return nil, false +} + +// AsBasicFirewallPolicyRule is the BasicFirewallPolicyRule implementation for ApplicationRule. +func (ar ApplicationRule) AsBasicFirewallPolicyRule() (BasicFirewallPolicyRule, bool) { + return &ar, true +} + +// ApplicationSecurityGroup an application security group in a resource group. +type ApplicationSecurityGroup struct { + autorest.Response `json:"-"` + // ApplicationSecurityGroupPropertiesFormat - Properties of the application security group. + *ApplicationSecurityGroupPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ApplicationSecurityGroup. +func (asg ApplicationSecurityGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asg.ApplicationSecurityGroupPropertiesFormat != nil { + objectMap["properties"] = asg.ApplicationSecurityGroupPropertiesFormat + } + if asg.ID != nil { + objectMap["id"] = asg.ID + } + if asg.Location != nil { + objectMap["location"] = asg.Location + } + if asg.Tags != nil { + objectMap["tags"] = asg.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationSecurityGroup struct. +func (asg *ApplicationSecurityGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationSecurityGroupPropertiesFormat ApplicationSecurityGroupPropertiesFormat + err = json.Unmarshal(*v, &applicationSecurityGroupPropertiesFormat) + if err != nil { + return err + } + asg.ApplicationSecurityGroupPropertiesFormat = &applicationSecurityGroupPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + asg.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + asg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + asg.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asg.Tags = tags + } + } + } + + return nil +} + +// ApplicationSecurityGroupListResult a list of application security groups. +type ApplicationSecurityGroupListResult struct { + autorest.Response `json:"-"` + // Value - A list of application security groups. + Value *[]ApplicationSecurityGroup `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationSecurityGroupListResult. +func (asglr ApplicationSecurityGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asglr.Value != nil { + objectMap["value"] = asglr.Value + } + return json.Marshal(objectMap) +} + +// ApplicationSecurityGroupListResultIterator provides access to a complete listing of +// ApplicationSecurityGroup values. +type ApplicationSecurityGroupListResultIterator struct { + i int + page ApplicationSecurityGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ApplicationSecurityGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationSecurityGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationSecurityGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationSecurityGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ApplicationSecurityGroupListResultIterator) Response() ApplicationSecurityGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ApplicationSecurityGroupListResultIterator) Value() ApplicationSecurityGroup { + if !iter.page.NotDone() { + return ApplicationSecurityGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ApplicationSecurityGroupListResultIterator type. +func NewApplicationSecurityGroupListResultIterator(page ApplicationSecurityGroupListResultPage) ApplicationSecurityGroupListResultIterator { + return ApplicationSecurityGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (asglr ApplicationSecurityGroupListResult) IsEmpty() bool { + return asglr.Value == nil || len(*asglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (asglr ApplicationSecurityGroupListResult) hasNextLink() bool { + return asglr.NextLink != nil && len(*asglr.NextLink) != 0 +} + +// applicationSecurityGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (asglr ApplicationSecurityGroupListResult) applicationSecurityGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !asglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(asglr.NextLink))) +} + +// ApplicationSecurityGroupListResultPage contains a page of ApplicationSecurityGroup values. +type ApplicationSecurityGroupListResultPage struct { + fn func(context.Context, ApplicationSecurityGroupListResult) (ApplicationSecurityGroupListResult, error) + asglr ApplicationSecurityGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ApplicationSecurityGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationSecurityGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.asglr) + if err != nil { + return err + } + page.asglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationSecurityGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationSecurityGroupListResultPage) NotDone() bool { + return !page.asglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationSecurityGroupListResultPage) Response() ApplicationSecurityGroupListResult { + return page.asglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationSecurityGroupListResultPage) Values() []ApplicationSecurityGroup { + if page.asglr.IsEmpty() { + return nil + } + return *page.asglr.Value +} + +// Creates a new instance of the ApplicationSecurityGroupListResultPage type. +func NewApplicationSecurityGroupListResultPage(cur ApplicationSecurityGroupListResult, getNextPage func(context.Context, ApplicationSecurityGroupListResult) (ApplicationSecurityGroupListResult, error)) ApplicationSecurityGroupListResultPage { + return ApplicationSecurityGroupListResultPage{ + fn: getNextPage, + asglr: cur, + } +} + +// ApplicationSecurityGroupPropertiesFormat application security group properties. +type ApplicationSecurityGroupPropertiesFormat struct { + // ResourceGUID - READ-ONLY; 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. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the application security group resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationSecurityGroupPropertiesFormat. +func (asgpf ApplicationSecurityGroupPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApplicationSecurityGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ApplicationSecurityGroupsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationSecurityGroupsClient) (ApplicationSecurityGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationSecurityGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationSecurityGroupsCreateOrUpdateFuture.Result. +func (future *ApplicationSecurityGroupsCreateOrUpdateFuture) result(client ApplicationSecurityGroupsClient) (asg ApplicationSecurityGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + asg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationSecurityGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if asg.Response.Response, err = future.GetResult(sender); err == nil && asg.Response.Response.StatusCode != http.StatusNoContent { + asg, err = client.CreateOrUpdateResponder(asg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsCreateOrUpdateFuture", "Result", asg.Response.Response, "Failure responding to request") + } + } + return +} + +// ApplicationSecurityGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ApplicationSecurityGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationSecurityGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationSecurityGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationSecurityGroupsDeleteFuture.Result. +func (future *ApplicationSecurityGroupsDeleteFuture) result(client ApplicationSecurityGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationSecurityGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AuthorizationListResult response for ListAuthorizations API service call retrieves all authorizations +// that belongs to an ExpressRouteCircuit. +type AuthorizationListResult struct { + autorest.Response `json:"-"` + // Value - The authorizations in an ExpressRoute Circuit. + Value *[]ExpressRouteCircuitAuthorization `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AuthorizationListResultIterator provides access to a complete listing of +// ExpressRouteCircuitAuthorization values. +type AuthorizationListResultIterator struct { + i int + page AuthorizationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AuthorizationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AuthorizationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AuthorizationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AuthorizationListResultIterator) Response() AuthorizationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AuthorizationListResultIterator) Value() ExpressRouteCircuitAuthorization { + if !iter.page.NotDone() { + return ExpressRouteCircuitAuthorization{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AuthorizationListResultIterator type. +func NewAuthorizationListResultIterator(page AuthorizationListResultPage) AuthorizationListResultIterator { + return AuthorizationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (alr AuthorizationListResult) IsEmpty() bool { + return alr.Value == nil || len(*alr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (alr AuthorizationListResult) hasNextLink() bool { + return alr.NextLink != nil && len(*alr.NextLink) != 0 +} + +// authorizationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (alr AuthorizationListResult) authorizationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !alr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(alr.NextLink))) +} + +// AuthorizationListResultPage contains a page of ExpressRouteCircuitAuthorization values. +type AuthorizationListResultPage struct { + fn func(context.Context, AuthorizationListResult) (AuthorizationListResult, error) + alr AuthorizationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AuthorizationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.alr) + if err != nil { + return err + } + page.alr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AuthorizationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AuthorizationListResultPage) NotDone() bool { + return !page.alr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AuthorizationListResultPage) Response() AuthorizationListResult { + return page.alr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AuthorizationListResultPage) Values() []ExpressRouteCircuitAuthorization { + if page.alr.IsEmpty() { + return nil + } + return *page.alr.Value +} + +// Creates a new instance of the AuthorizationListResultPage type. +func NewAuthorizationListResultPage(cur AuthorizationListResult, getNextPage func(context.Context, AuthorizationListResult) (AuthorizationListResult, error)) AuthorizationListResultPage { + return AuthorizationListResultPage{ + fn: getNextPage, + alr: cur, + } +} + +// AuthorizationPropertiesFormat properties of ExpressRouteCircuitAuthorization. +type AuthorizationPropertiesFormat struct { + // AuthorizationKey - The authorization key. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + // AuthorizationUseStatus - The authorization use status. Possible values include: 'AuthorizationUseStatusAvailable', 'AuthorizationUseStatusInUse' + AuthorizationUseStatus AuthorizationUseStatus `json:"authorizationUseStatus,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the authorization resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AuthorizationPropertiesFormat. +func (apf AuthorizationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apf.AuthorizationKey != nil { + objectMap["authorizationKey"] = apf.AuthorizationKey + } + if apf.AuthorizationUseStatus != "" { + objectMap["authorizationUseStatus"] = apf.AuthorizationUseStatus + } + return json.Marshal(objectMap) +} + +// AutoApprovedPrivateLinkService the information of an AutoApprovedPrivateLinkService. +type AutoApprovedPrivateLinkService struct { + // PrivateLinkService - The id of the private link service resource. + PrivateLinkService *string `json:"privateLinkService,omitempty"` +} + +// AutoApprovedPrivateLinkServicesResult an array of private link service id that can be linked to a +// private end point with auto approved. +type AutoApprovedPrivateLinkServicesResult struct { + autorest.Response `json:"-"` + // Value - An array of auto approved private link service. + Value *[]AutoApprovedPrivateLinkService `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutoApprovedPrivateLinkServicesResult. +func (aaplsr AutoApprovedPrivateLinkServicesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aaplsr.Value != nil { + objectMap["value"] = aaplsr.Value + } + return json.Marshal(objectMap) +} + +// AutoApprovedPrivateLinkServicesResultIterator provides access to a complete listing of +// AutoApprovedPrivateLinkService values. +type AutoApprovedPrivateLinkServicesResultIterator struct { + i int + page AutoApprovedPrivateLinkServicesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AutoApprovedPrivateLinkServicesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoApprovedPrivateLinkServicesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AutoApprovedPrivateLinkServicesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AutoApprovedPrivateLinkServicesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AutoApprovedPrivateLinkServicesResultIterator) Response() AutoApprovedPrivateLinkServicesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AutoApprovedPrivateLinkServicesResultIterator) Value() AutoApprovedPrivateLinkService { + if !iter.page.NotDone() { + return AutoApprovedPrivateLinkService{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AutoApprovedPrivateLinkServicesResultIterator type. +func NewAutoApprovedPrivateLinkServicesResultIterator(page AutoApprovedPrivateLinkServicesResultPage) AutoApprovedPrivateLinkServicesResultIterator { + return AutoApprovedPrivateLinkServicesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aaplsr AutoApprovedPrivateLinkServicesResult) IsEmpty() bool { + return aaplsr.Value == nil || len(*aaplsr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aaplsr AutoApprovedPrivateLinkServicesResult) hasNextLink() bool { + return aaplsr.NextLink != nil && len(*aaplsr.NextLink) != 0 +} + +// autoApprovedPrivateLinkServicesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aaplsr AutoApprovedPrivateLinkServicesResult) autoApprovedPrivateLinkServicesResultPreparer(ctx context.Context) (*http.Request, error) { + if !aaplsr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aaplsr.NextLink))) +} + +// AutoApprovedPrivateLinkServicesResultPage contains a page of AutoApprovedPrivateLinkService values. +type AutoApprovedPrivateLinkServicesResultPage struct { + fn func(context.Context, AutoApprovedPrivateLinkServicesResult) (AutoApprovedPrivateLinkServicesResult, error) + aaplsr AutoApprovedPrivateLinkServicesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AutoApprovedPrivateLinkServicesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoApprovedPrivateLinkServicesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aaplsr) + if err != nil { + return err + } + page.aaplsr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AutoApprovedPrivateLinkServicesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AutoApprovedPrivateLinkServicesResultPage) NotDone() bool { + return !page.aaplsr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AutoApprovedPrivateLinkServicesResultPage) Response() AutoApprovedPrivateLinkServicesResult { + return page.aaplsr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AutoApprovedPrivateLinkServicesResultPage) Values() []AutoApprovedPrivateLinkService { + if page.aaplsr.IsEmpty() { + return nil + } + return *page.aaplsr.Value +} + +// Creates a new instance of the AutoApprovedPrivateLinkServicesResultPage type. +func NewAutoApprovedPrivateLinkServicesResultPage(cur AutoApprovedPrivateLinkServicesResult, getNextPage func(context.Context, AutoApprovedPrivateLinkServicesResult) (AutoApprovedPrivateLinkServicesResult, error)) AutoApprovedPrivateLinkServicesResultPage { + return AutoApprovedPrivateLinkServicesResultPage{ + fn: getNextPage, + aaplsr: cur, + } +} + +// Availability availability of the metric. +type Availability struct { + // TimeGrain - The time grain of the availability. + TimeGrain *string `json:"timeGrain,omitempty"` + // Retention - The retention of the availability. + Retention *string `json:"retention,omitempty"` + // BlobDuration - Duration of the availability blob. + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// AvailableDelegation the serviceName of an AvailableDelegation indicates a possible delegation for a +// subnet. +type AvailableDelegation struct { + // Name - The name of the AvailableDelegation resource. + Name *string `json:"name,omitempty"` + // ID - A unique identifier of the AvailableDelegation resource. + ID *string `json:"id,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` + // ServiceName - The name of the service and resource. + ServiceName *string `json:"serviceName,omitempty"` + // Actions - The actions permitted to the service upon delegation. + Actions *[]string `json:"actions,omitempty"` +} + +// AvailableDelegationsResult an array of available delegations. +type AvailableDelegationsResult struct { + autorest.Response `json:"-"` + // Value - An array of available delegations. + Value *[]AvailableDelegation `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailableDelegationsResult. +func (adr AvailableDelegationsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adr.Value != nil { + objectMap["value"] = adr.Value + } + return json.Marshal(objectMap) +} + +// AvailableDelegationsResultIterator provides access to a complete listing of AvailableDelegation values. +type AvailableDelegationsResultIterator struct { + i int + page AvailableDelegationsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AvailableDelegationsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableDelegationsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AvailableDelegationsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AvailableDelegationsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AvailableDelegationsResultIterator) Response() AvailableDelegationsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AvailableDelegationsResultIterator) Value() AvailableDelegation { + if !iter.page.NotDone() { + return AvailableDelegation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AvailableDelegationsResultIterator type. +func NewAvailableDelegationsResultIterator(page AvailableDelegationsResultPage) AvailableDelegationsResultIterator { + return AvailableDelegationsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (adr AvailableDelegationsResult) IsEmpty() bool { + return adr.Value == nil || len(*adr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (adr AvailableDelegationsResult) hasNextLink() bool { + return adr.NextLink != nil && len(*adr.NextLink) != 0 +} + +// availableDelegationsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (adr AvailableDelegationsResult) availableDelegationsResultPreparer(ctx context.Context) (*http.Request, error) { + if !adr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(adr.NextLink))) +} + +// AvailableDelegationsResultPage contains a page of AvailableDelegation values. +type AvailableDelegationsResultPage struct { + fn func(context.Context, AvailableDelegationsResult) (AvailableDelegationsResult, error) + adr AvailableDelegationsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AvailableDelegationsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableDelegationsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.adr) + if err != nil { + return err + } + page.adr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AvailableDelegationsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AvailableDelegationsResultPage) NotDone() bool { + return !page.adr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AvailableDelegationsResultPage) Response() AvailableDelegationsResult { + return page.adr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AvailableDelegationsResultPage) Values() []AvailableDelegation { + if page.adr.IsEmpty() { + return nil + } + return *page.adr.Value +} + +// Creates a new instance of the AvailableDelegationsResultPage type. +func NewAvailableDelegationsResultPage(cur AvailableDelegationsResult, getNextPage func(context.Context, AvailableDelegationsResult) (AvailableDelegationsResult, error)) AvailableDelegationsResultPage { + return AvailableDelegationsResultPage{ + fn: getNextPage, + adr: cur, + } +} + +// AvailablePrivateEndpointType the information of an AvailablePrivateEndpointType. +type AvailablePrivateEndpointType struct { + // Name - The name of the service and resource. + Name *string `json:"name,omitempty"` + // ID - A unique identifier of the AvailablePrivateEndpoint Type resource. + ID *string `json:"id,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` + // ResourceName - The name of the service and resource. + ResourceName *string `json:"resourceName,omitempty"` + // DisplayName - Display name of the resource. + DisplayName *string `json:"displayName,omitempty"` +} + +// AvailablePrivateEndpointTypesResult an array of available PrivateEndpoint types. +type AvailablePrivateEndpointTypesResult struct { + autorest.Response `json:"-"` + // Value - An array of available privateEndpoint type. + Value *[]AvailablePrivateEndpointType `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailablePrivateEndpointTypesResult. +func (apetr AvailablePrivateEndpointTypesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apetr.Value != nil { + objectMap["value"] = apetr.Value + } + return json.Marshal(objectMap) +} + +// AvailablePrivateEndpointTypesResultIterator provides access to a complete listing of +// AvailablePrivateEndpointType values. +type AvailablePrivateEndpointTypesResultIterator struct { + i int + page AvailablePrivateEndpointTypesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AvailablePrivateEndpointTypesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailablePrivateEndpointTypesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AvailablePrivateEndpointTypesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AvailablePrivateEndpointTypesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AvailablePrivateEndpointTypesResultIterator) Response() AvailablePrivateEndpointTypesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AvailablePrivateEndpointTypesResultIterator) Value() AvailablePrivateEndpointType { + if !iter.page.NotDone() { + return AvailablePrivateEndpointType{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AvailablePrivateEndpointTypesResultIterator type. +func NewAvailablePrivateEndpointTypesResultIterator(page AvailablePrivateEndpointTypesResultPage) AvailablePrivateEndpointTypesResultIterator { + return AvailablePrivateEndpointTypesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (apetr AvailablePrivateEndpointTypesResult) IsEmpty() bool { + return apetr.Value == nil || len(*apetr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (apetr AvailablePrivateEndpointTypesResult) hasNextLink() bool { + return apetr.NextLink != nil && len(*apetr.NextLink) != 0 +} + +// availablePrivateEndpointTypesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (apetr AvailablePrivateEndpointTypesResult) availablePrivateEndpointTypesResultPreparer(ctx context.Context) (*http.Request, error) { + if !apetr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(apetr.NextLink))) +} + +// AvailablePrivateEndpointTypesResultPage contains a page of AvailablePrivateEndpointType values. +type AvailablePrivateEndpointTypesResultPage struct { + fn func(context.Context, AvailablePrivateEndpointTypesResult) (AvailablePrivateEndpointTypesResult, error) + apetr AvailablePrivateEndpointTypesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AvailablePrivateEndpointTypesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailablePrivateEndpointTypesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.apetr) + if err != nil { + return err + } + page.apetr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AvailablePrivateEndpointTypesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AvailablePrivateEndpointTypesResultPage) NotDone() bool { + return !page.apetr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AvailablePrivateEndpointTypesResultPage) Response() AvailablePrivateEndpointTypesResult { + return page.apetr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AvailablePrivateEndpointTypesResultPage) Values() []AvailablePrivateEndpointType { + if page.apetr.IsEmpty() { + return nil + } + return *page.apetr.Value +} + +// Creates a new instance of the AvailablePrivateEndpointTypesResultPage type. +func NewAvailablePrivateEndpointTypesResultPage(cur AvailablePrivateEndpointTypesResult, getNextPage func(context.Context, AvailablePrivateEndpointTypesResult) (AvailablePrivateEndpointTypesResult, error)) AvailablePrivateEndpointTypesResultPage { + return AvailablePrivateEndpointTypesResultPage{ + fn: getNextPage, + apetr: cur, + } +} + +// AvailableProvidersList list of available countries with details. +type AvailableProvidersList struct { + autorest.Response `json:"-"` + // Countries - List of available countries. + Countries *[]AvailableProvidersListCountry `json:"countries,omitempty"` +} + +// AvailableProvidersListCity city or town details. +type AvailableProvidersListCity struct { + // CityName - The city or town name. + CityName *string `json:"cityName,omitempty"` + // Providers - A list of Internet service providers. + Providers *[]string `json:"providers,omitempty"` +} + +// AvailableProvidersListCountry country details. +type AvailableProvidersListCountry struct { + // CountryName - The country name. + CountryName *string `json:"countryName,omitempty"` + // Providers - A list of Internet service providers. + Providers *[]string `json:"providers,omitempty"` + // States - List of available states in the country. + States *[]AvailableProvidersListState `json:"states,omitempty"` +} + +// AvailableProvidersListParameters constraints that determine the list of available Internet service +// providers. +type AvailableProvidersListParameters struct { + // AzureLocations - A list of Azure regions. + AzureLocations *[]string `json:"azureLocations,omitempty"` + // Country - The country for available providers list. + Country *string `json:"country,omitempty"` + // State - The state for available providers list. + State *string `json:"state,omitempty"` + // City - The city or town for available providers list. + City *string `json:"city,omitempty"` +} + +// AvailableProvidersListState state details. +type AvailableProvidersListState struct { + // StateName - The state name. + StateName *string `json:"stateName,omitempty"` + // Providers - A list of Internet service providers. + Providers *[]string `json:"providers,omitempty"` + // Cities - List of available cities or towns in the state. + Cities *[]AvailableProvidersListCity `json:"cities,omitempty"` +} + +// AvailableServiceAlias the available service alias. +type AvailableServiceAlias struct { + // Name - The name of the service alias. + Name *string `json:"name,omitempty"` + // ID - The ID of the service alias. + ID *string `json:"id,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // ResourceName - The resource name of the service alias. + ResourceName *string `json:"resourceName,omitempty"` +} + +// AvailableServiceAliasesResult an array of available service aliases. +type AvailableServiceAliasesResult struct { + autorest.Response `json:"-"` + // Value - An array of available service aliases. + Value *[]AvailableServiceAlias `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailableServiceAliasesResult. +func (asar AvailableServiceAliasesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asar.Value != nil { + objectMap["value"] = asar.Value + } + return json.Marshal(objectMap) +} + +// AvailableServiceAliasesResultIterator provides access to a complete listing of AvailableServiceAlias +// values. +type AvailableServiceAliasesResultIterator struct { + i int + page AvailableServiceAliasesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AvailableServiceAliasesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableServiceAliasesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AvailableServiceAliasesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AvailableServiceAliasesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AvailableServiceAliasesResultIterator) Response() AvailableServiceAliasesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AvailableServiceAliasesResultIterator) Value() AvailableServiceAlias { + if !iter.page.NotDone() { + return AvailableServiceAlias{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AvailableServiceAliasesResultIterator type. +func NewAvailableServiceAliasesResultIterator(page AvailableServiceAliasesResultPage) AvailableServiceAliasesResultIterator { + return AvailableServiceAliasesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (asar AvailableServiceAliasesResult) IsEmpty() bool { + return asar.Value == nil || len(*asar.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (asar AvailableServiceAliasesResult) hasNextLink() bool { + return asar.NextLink != nil && len(*asar.NextLink) != 0 +} + +// availableServiceAliasesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (asar AvailableServiceAliasesResult) availableServiceAliasesResultPreparer(ctx context.Context) (*http.Request, error) { + if !asar.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(asar.NextLink))) +} + +// AvailableServiceAliasesResultPage contains a page of AvailableServiceAlias values. +type AvailableServiceAliasesResultPage struct { + fn func(context.Context, AvailableServiceAliasesResult) (AvailableServiceAliasesResult, error) + asar AvailableServiceAliasesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AvailableServiceAliasesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableServiceAliasesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.asar) + if err != nil { + return err + } + page.asar = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AvailableServiceAliasesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AvailableServiceAliasesResultPage) NotDone() bool { + return !page.asar.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AvailableServiceAliasesResultPage) Response() AvailableServiceAliasesResult { + return page.asar +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AvailableServiceAliasesResultPage) Values() []AvailableServiceAlias { + if page.asar.IsEmpty() { + return nil + } + return *page.asar.Value +} + +// Creates a new instance of the AvailableServiceAliasesResultPage type. +func NewAvailableServiceAliasesResultPage(cur AvailableServiceAliasesResult, getNextPage func(context.Context, AvailableServiceAliasesResult) (AvailableServiceAliasesResult, error)) AvailableServiceAliasesResultPage { + return AvailableServiceAliasesResultPage{ + fn: getNextPage, + asar: cur, + } +} + +// AzureAsyncOperationResult 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. +type AzureAsyncOperationResult struct { + // Status - Status of the Azure async operation. Possible values include: 'OperationStatusInProgress', 'OperationStatusSucceeded', 'OperationStatusFailed' + Status OperationStatus `json:"status,omitempty"` + // Error - Details of the error occurred during specified asynchronous operation. + Error *Error `json:"error,omitempty"` +} + +// AzureFirewall azure Firewall resource. +type AzureFirewall struct { + autorest.Response `json:"-"` + // AzureFirewallPropertiesFormat - Properties of the azure firewall. + *AzureFirewallPropertiesFormat `json:"properties,omitempty"` + // Zones - A list of availability zones denoting where the resource needs to come from. + Zones *[]string `json:"zones,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AzureFirewall. +func (af AzureFirewall) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if af.AzureFirewallPropertiesFormat != nil { + objectMap["properties"] = af.AzureFirewallPropertiesFormat + } + if af.Zones != nil { + objectMap["zones"] = af.Zones + } + if af.ID != nil { + objectMap["id"] = af.ID + } + if af.Location != nil { + objectMap["location"] = af.Location + } + if af.Tags != nil { + objectMap["tags"] = af.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureFirewall struct. +func (af *AzureFirewall) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureFirewallPropertiesFormat AzureFirewallPropertiesFormat + err = json.Unmarshal(*v, &azureFirewallPropertiesFormat) + if err != nil { + return err + } + af.AzureFirewallPropertiesFormat = &azureFirewallPropertiesFormat + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + af.Zones = &zones + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + af.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + af.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + af.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + af.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + af.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + af.Tags = tags + } + } + } + + return nil +} + +// AzureFirewallApplicationRule properties of an application rule. +type AzureFirewallApplicationRule struct { + // Name - Name of the application rule. + Name *string `json:"name,omitempty"` + // Description - Description of the rule. + Description *string `json:"description,omitempty"` + // SourceAddresses - List of source IP addresses for this rule. + SourceAddresses *[]string `json:"sourceAddresses,omitempty"` + // Protocols - Array of ApplicationRuleProtocols. + Protocols *[]AzureFirewallApplicationRuleProtocol `json:"protocols,omitempty"` + // TargetFqdns - List of FQDNs for this rule. + TargetFqdns *[]string `json:"targetFqdns,omitempty"` + // FqdnTags - List of FQDN Tags for this rule. + FqdnTags *[]string `json:"fqdnTags,omitempty"` + // SourceIPGroups - List of source IpGroups for this rule. + SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` +} + +// AzureFirewallApplicationRuleCollection application rule collection resource. +type AzureFirewallApplicationRuleCollection struct { + // AzureFirewallApplicationRuleCollectionPropertiesFormat - Properties of the azure firewall application rule collection. + *AzureFirewallApplicationRuleCollectionPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallApplicationRuleCollection. +func (afarc AzureFirewallApplicationRuleCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afarc.AzureFirewallApplicationRuleCollectionPropertiesFormat != nil { + objectMap["properties"] = afarc.AzureFirewallApplicationRuleCollectionPropertiesFormat + } + if afarc.Name != nil { + objectMap["name"] = afarc.Name + } + if afarc.ID != nil { + objectMap["id"] = afarc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureFirewallApplicationRuleCollection struct. +func (afarc *AzureFirewallApplicationRuleCollection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureFirewallApplicationRuleCollectionPropertiesFormat AzureFirewallApplicationRuleCollectionPropertiesFormat + err = json.Unmarshal(*v, &azureFirewallApplicationRuleCollectionPropertiesFormat) + if err != nil { + return err + } + afarc.AzureFirewallApplicationRuleCollectionPropertiesFormat = &azureFirewallApplicationRuleCollectionPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + afarc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + afarc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + afarc.ID = &ID + } + } + } + + return nil +} + +// AzureFirewallApplicationRuleCollectionPropertiesFormat properties of the application rule collection. +type AzureFirewallApplicationRuleCollectionPropertiesFormat struct { + // Priority - Priority of the application rule collection resource. + Priority *int32 `json:"priority,omitempty"` + // Action - The action type of a rule collection. + Action *AzureFirewallRCAction `json:"action,omitempty"` + // Rules - Collection of rules used by a application rule collection. + Rules *[]AzureFirewallApplicationRule `json:"rules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the application rule collection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallApplicationRuleCollectionPropertiesFormat. +func (afarcpf AzureFirewallApplicationRuleCollectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afarcpf.Priority != nil { + objectMap["priority"] = afarcpf.Priority + } + if afarcpf.Action != nil { + objectMap["action"] = afarcpf.Action + } + if afarcpf.Rules != nil { + objectMap["rules"] = afarcpf.Rules + } + return json.Marshal(objectMap) +} + +// AzureFirewallApplicationRuleProtocol properties of the application rule protocol. +type AzureFirewallApplicationRuleProtocol struct { + // ProtocolType - Protocol type. Possible values include: 'AzureFirewallApplicationRuleProtocolTypeHTTP', 'AzureFirewallApplicationRuleProtocolTypeHTTPS', 'AzureFirewallApplicationRuleProtocolTypeMssql' + ProtocolType AzureFirewallApplicationRuleProtocolType `json:"protocolType,omitempty"` + // Port - Port number for the protocol, cannot be greater than 64000. This field is optional. + Port *int32 `json:"port,omitempty"` +} + +// AzureFirewallFqdnTag azure Firewall FQDN Tag Resource. +type AzureFirewallFqdnTag struct { + // AzureFirewallFqdnTagPropertiesFormat - Properties of the azure firewall FQDN tag. + *AzureFirewallFqdnTagPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallFqdnTag. +func (afft AzureFirewallFqdnTag) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afft.AzureFirewallFqdnTagPropertiesFormat != nil { + objectMap["properties"] = afft.AzureFirewallFqdnTagPropertiesFormat + } + if afft.ID != nil { + objectMap["id"] = afft.ID + } + if afft.Location != nil { + objectMap["location"] = afft.Location + } + if afft.Tags != nil { + objectMap["tags"] = afft.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureFirewallFqdnTag struct. +func (afft *AzureFirewallFqdnTag) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureFirewallFqdnTagPropertiesFormat AzureFirewallFqdnTagPropertiesFormat + err = json.Unmarshal(*v, &azureFirewallFqdnTagPropertiesFormat) + if err != nil { + return err + } + afft.AzureFirewallFqdnTagPropertiesFormat = &azureFirewallFqdnTagPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + afft.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + afft.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + afft.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + afft.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + afft.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + afft.Tags = tags + } + } + } + + return nil +} + +// AzureFirewallFqdnTagListResult response for ListAzureFirewallFqdnTags API service call. +type AzureFirewallFqdnTagListResult struct { + autorest.Response `json:"-"` + // Value - List of Azure Firewall FQDN Tags in a resource group. + Value *[]AzureFirewallFqdnTag `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AzureFirewallFqdnTagListResultIterator provides access to a complete listing of AzureFirewallFqdnTag +// values. +type AzureFirewallFqdnTagListResultIterator struct { + i int + page AzureFirewallFqdnTagListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AzureFirewallFqdnTagListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallFqdnTagListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AzureFirewallFqdnTagListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AzureFirewallFqdnTagListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AzureFirewallFqdnTagListResultIterator) Response() AzureFirewallFqdnTagListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AzureFirewallFqdnTagListResultIterator) Value() AzureFirewallFqdnTag { + if !iter.page.NotDone() { + return AzureFirewallFqdnTag{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AzureFirewallFqdnTagListResultIterator type. +func NewAzureFirewallFqdnTagListResultIterator(page AzureFirewallFqdnTagListResultPage) AzureFirewallFqdnTagListResultIterator { + return AzureFirewallFqdnTagListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (afftlr AzureFirewallFqdnTagListResult) IsEmpty() bool { + return afftlr.Value == nil || len(*afftlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (afftlr AzureFirewallFqdnTagListResult) hasNextLink() bool { + return afftlr.NextLink != nil && len(*afftlr.NextLink) != 0 +} + +// azureFirewallFqdnTagListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (afftlr AzureFirewallFqdnTagListResult) azureFirewallFqdnTagListResultPreparer(ctx context.Context) (*http.Request, error) { + if !afftlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(afftlr.NextLink))) +} + +// AzureFirewallFqdnTagListResultPage contains a page of AzureFirewallFqdnTag values. +type AzureFirewallFqdnTagListResultPage struct { + fn func(context.Context, AzureFirewallFqdnTagListResult) (AzureFirewallFqdnTagListResult, error) + afftlr AzureFirewallFqdnTagListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AzureFirewallFqdnTagListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallFqdnTagListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.afftlr) + if err != nil { + return err + } + page.afftlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AzureFirewallFqdnTagListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AzureFirewallFqdnTagListResultPage) NotDone() bool { + return !page.afftlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AzureFirewallFqdnTagListResultPage) Response() AzureFirewallFqdnTagListResult { + return page.afftlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AzureFirewallFqdnTagListResultPage) Values() []AzureFirewallFqdnTag { + if page.afftlr.IsEmpty() { + return nil + } + return *page.afftlr.Value +} + +// Creates a new instance of the AzureFirewallFqdnTagListResultPage type. +func NewAzureFirewallFqdnTagListResultPage(cur AzureFirewallFqdnTagListResult, getNextPage func(context.Context, AzureFirewallFqdnTagListResult) (AzureFirewallFqdnTagListResult, error)) AzureFirewallFqdnTagListResultPage { + return AzureFirewallFqdnTagListResultPage{ + fn: getNextPage, + afftlr: cur, + } +} + +// AzureFirewallFqdnTagPropertiesFormat azure Firewall FQDN Tag Properties. +type AzureFirewallFqdnTagPropertiesFormat struct { + // ProvisioningState - READ-ONLY; The provisioning state of the Azure firewall FQDN tag resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // FqdnTagName - READ-ONLY; The name of this FQDN Tag. + FqdnTagName *string `json:"fqdnTagName,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallFqdnTagPropertiesFormat. +func (afftpf AzureFirewallFqdnTagPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureFirewallIPConfiguration IP configuration of an Azure Firewall. +type AzureFirewallIPConfiguration struct { + // AzureFirewallIPConfigurationPropertiesFormat - Properties of the azure firewall IP configuration. + *AzureFirewallIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallIPConfiguration. +func (afic AzureFirewallIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afic.AzureFirewallIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = afic.AzureFirewallIPConfigurationPropertiesFormat + } + if afic.Name != nil { + objectMap["name"] = afic.Name + } + if afic.ID != nil { + objectMap["id"] = afic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureFirewallIPConfiguration struct. +func (afic *AzureFirewallIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureFirewallIPConfigurationPropertiesFormat AzureFirewallIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &azureFirewallIPConfigurationPropertiesFormat) + if err != nil { + return err + } + afic.AzureFirewallIPConfigurationPropertiesFormat = &azureFirewallIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + afic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + afic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + afic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + afic.ID = &ID + } + } + } + + return nil +} + +// AzureFirewallIPConfigurationPropertiesFormat properties of IP configuration of an Azure Firewall. +type AzureFirewallIPConfigurationPropertiesFormat struct { + // PrivateIPAddress - READ-ONLY; The Firewall Internal Load Balancer IP to be used as the next hop in User Defined Routes. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // Subnet - Reference to the subnet resource. This resource must be named 'AzureFirewallSubnet' or 'AzureFirewallManagementSubnet'. + Subnet *SubResource `json:"subnet,omitempty"` + // PublicIPAddress - Reference to the PublicIP resource. This field is a mandatory input if subnet is not null. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the Azure firewall IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallIPConfigurationPropertiesFormat. +func (aficpf AzureFirewallIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aficpf.Subnet != nil { + objectMap["subnet"] = aficpf.Subnet + } + if aficpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = aficpf.PublicIPAddress + } + return json.Marshal(objectMap) +} + +// AzureFirewallIPGroups ipGroups associated with azure firewall. +type AzureFirewallIPGroups struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // ChangeNumber - READ-ONLY; The iteration number. + ChangeNumber *string `json:"changeNumber,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallIPGroups. +func (afig AzureFirewallIPGroups) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureFirewallListResult response for ListAzureFirewalls API service call. +type AzureFirewallListResult struct { + autorest.Response `json:"-"` + // Value - List of Azure Firewalls in a resource group. + Value *[]AzureFirewall `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AzureFirewallListResultIterator provides access to a complete listing of AzureFirewall values. +type AzureFirewallListResultIterator struct { + i int + page AzureFirewallListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AzureFirewallListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AzureFirewallListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AzureFirewallListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AzureFirewallListResultIterator) Response() AzureFirewallListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AzureFirewallListResultIterator) Value() AzureFirewall { + if !iter.page.NotDone() { + return AzureFirewall{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AzureFirewallListResultIterator type. +func NewAzureFirewallListResultIterator(page AzureFirewallListResultPage) AzureFirewallListResultIterator { + return AzureFirewallListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aflr AzureFirewallListResult) IsEmpty() bool { + return aflr.Value == nil || len(*aflr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aflr AzureFirewallListResult) hasNextLink() bool { + return aflr.NextLink != nil && len(*aflr.NextLink) != 0 +} + +// azureFirewallListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aflr AzureFirewallListResult) azureFirewallListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aflr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aflr.NextLink))) +} + +// AzureFirewallListResultPage contains a page of AzureFirewall values. +type AzureFirewallListResultPage struct { + fn func(context.Context, AzureFirewallListResult) (AzureFirewallListResult, error) + aflr AzureFirewallListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AzureFirewallListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aflr) + if err != nil { + return err + } + page.aflr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AzureFirewallListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AzureFirewallListResultPage) NotDone() bool { + return !page.aflr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AzureFirewallListResultPage) Response() AzureFirewallListResult { + return page.aflr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AzureFirewallListResultPage) Values() []AzureFirewall { + if page.aflr.IsEmpty() { + return nil + } + return *page.aflr.Value +} + +// Creates a new instance of the AzureFirewallListResultPage type. +func NewAzureFirewallListResultPage(cur AzureFirewallListResult, getNextPage func(context.Context, AzureFirewallListResult) (AzureFirewallListResult, error)) AzureFirewallListResultPage { + return AzureFirewallListResultPage{ + fn: getNextPage, + aflr: cur, + } +} + +// AzureFirewallNatRCAction azureFirewall NAT Rule Collection Action. +type AzureFirewallNatRCAction struct { + // Type - The type of action. Possible values include: 'AzureFirewallNatRCActionTypeSnat', 'AzureFirewallNatRCActionTypeDnat' + Type AzureFirewallNatRCActionType `json:"type,omitempty"` +} + +// AzureFirewallNatRule properties of a NAT rule. +type AzureFirewallNatRule struct { + // Name - Name of the NAT rule. + Name *string `json:"name,omitempty"` + // Description - Description of the rule. + Description *string `json:"description,omitempty"` + // SourceAddresses - List of source IP addresses for this rule. + SourceAddresses *[]string `json:"sourceAddresses,omitempty"` + // DestinationAddresses - List of destination IP addresses for this rule. Supports IP ranges, prefixes, and service tags. + DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` + // DestinationPorts - List of destination ports. + DestinationPorts *[]string `json:"destinationPorts,omitempty"` + // Protocols - Array of AzureFirewallNetworkRuleProtocols applicable to this NAT rule. + Protocols *[]AzureFirewallNetworkRuleProtocol `json:"protocols,omitempty"` + // TranslatedAddress - The translated address for this NAT rule. + TranslatedAddress *string `json:"translatedAddress,omitempty"` + // TranslatedPort - The translated port for this NAT rule. + TranslatedPort *string `json:"translatedPort,omitempty"` + // TranslatedFqdn - The translated FQDN for this NAT rule. + TranslatedFqdn *string `json:"translatedFqdn,omitempty"` + // SourceIPGroups - List of source IpGroups for this rule. + SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` +} + +// AzureFirewallNatRuleCollection NAT rule collection resource. +type AzureFirewallNatRuleCollection struct { + // AzureFirewallNatRuleCollectionProperties - Properties of the azure firewall NAT rule collection. + *AzureFirewallNatRuleCollectionProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallNatRuleCollection. +func (afnrc AzureFirewallNatRuleCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afnrc.AzureFirewallNatRuleCollectionProperties != nil { + objectMap["properties"] = afnrc.AzureFirewallNatRuleCollectionProperties + } + if afnrc.Name != nil { + objectMap["name"] = afnrc.Name + } + if afnrc.ID != nil { + objectMap["id"] = afnrc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureFirewallNatRuleCollection struct. +func (afnrc *AzureFirewallNatRuleCollection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureFirewallNatRuleCollectionProperties AzureFirewallNatRuleCollectionProperties + err = json.Unmarshal(*v, &azureFirewallNatRuleCollectionProperties) + if err != nil { + return err + } + afnrc.AzureFirewallNatRuleCollectionProperties = &azureFirewallNatRuleCollectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + afnrc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + afnrc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + afnrc.ID = &ID + } + } + } + + return nil +} + +// AzureFirewallNatRuleCollectionProperties properties of the NAT rule collection. +type AzureFirewallNatRuleCollectionProperties struct { + // Priority - Priority of the NAT rule collection resource. + Priority *int32 `json:"priority,omitempty"` + // Action - The action type of a NAT rule collection. + Action *AzureFirewallNatRCAction `json:"action,omitempty"` + // Rules - Collection of rules used by a NAT rule collection. + Rules *[]AzureFirewallNatRule `json:"rules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the NAT rule collection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallNatRuleCollectionProperties. +func (afnrcp AzureFirewallNatRuleCollectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afnrcp.Priority != nil { + objectMap["priority"] = afnrcp.Priority + } + if afnrcp.Action != nil { + objectMap["action"] = afnrcp.Action + } + if afnrcp.Rules != nil { + objectMap["rules"] = afnrcp.Rules + } + return json.Marshal(objectMap) +} + +// AzureFirewallNetworkRule properties of the network rule. +type AzureFirewallNetworkRule struct { + // Name - Name of the network rule. + Name *string `json:"name,omitempty"` + // Description - Description of the rule. + Description *string `json:"description,omitempty"` + // Protocols - Array of AzureFirewallNetworkRuleProtocols. + Protocols *[]AzureFirewallNetworkRuleProtocol `json:"protocols,omitempty"` + // SourceAddresses - List of source IP addresses for this rule. + SourceAddresses *[]string `json:"sourceAddresses,omitempty"` + // DestinationAddresses - List of destination IP addresses. + DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` + // DestinationPorts - List of destination ports. + DestinationPorts *[]string `json:"destinationPorts,omitempty"` + // DestinationFqdns - List of destination FQDNs. + DestinationFqdns *[]string `json:"destinationFqdns,omitempty"` + // SourceIPGroups - List of source IpGroups for this rule. + SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` + // DestinationIPGroups - List of destination IpGroups for this rule. + DestinationIPGroups *[]string `json:"destinationIpGroups,omitempty"` +} + +// AzureFirewallNetworkRuleCollection network rule collection resource. +type AzureFirewallNetworkRuleCollection struct { + // AzureFirewallNetworkRuleCollectionPropertiesFormat - Properties of the azure firewall network rule collection. + *AzureFirewallNetworkRuleCollectionPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallNetworkRuleCollection. +func (afnrc AzureFirewallNetworkRuleCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afnrc.AzureFirewallNetworkRuleCollectionPropertiesFormat != nil { + objectMap["properties"] = afnrc.AzureFirewallNetworkRuleCollectionPropertiesFormat + } + if afnrc.Name != nil { + objectMap["name"] = afnrc.Name + } + if afnrc.ID != nil { + objectMap["id"] = afnrc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureFirewallNetworkRuleCollection struct. +func (afnrc *AzureFirewallNetworkRuleCollection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureFirewallNetworkRuleCollectionPropertiesFormat AzureFirewallNetworkRuleCollectionPropertiesFormat + err = json.Unmarshal(*v, &azureFirewallNetworkRuleCollectionPropertiesFormat) + if err != nil { + return err + } + afnrc.AzureFirewallNetworkRuleCollectionPropertiesFormat = &azureFirewallNetworkRuleCollectionPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + afnrc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + afnrc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + afnrc.ID = &ID + } + } + } + + return nil +} + +// AzureFirewallNetworkRuleCollectionPropertiesFormat properties of the network rule collection. +type AzureFirewallNetworkRuleCollectionPropertiesFormat struct { + // Priority - Priority of the network rule collection resource. + Priority *int32 `json:"priority,omitempty"` + // Action - The action type of a rule collection. + Action *AzureFirewallRCAction `json:"action,omitempty"` + // Rules - Collection of rules used by a network rule collection. + Rules *[]AzureFirewallNetworkRule `json:"rules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the network rule collection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallNetworkRuleCollectionPropertiesFormat. +func (afnrcpf AzureFirewallNetworkRuleCollectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afnrcpf.Priority != nil { + objectMap["priority"] = afnrcpf.Priority + } + if afnrcpf.Action != nil { + objectMap["action"] = afnrcpf.Action + } + if afnrcpf.Rules != nil { + objectMap["rules"] = afnrcpf.Rules + } + return json.Marshal(objectMap) +} + +// AzureFirewallPropertiesFormat properties of the Azure Firewall. +type AzureFirewallPropertiesFormat struct { + // ApplicationRuleCollections - Collection of application rule collections used by Azure Firewall. + ApplicationRuleCollections *[]AzureFirewallApplicationRuleCollection `json:"applicationRuleCollections,omitempty"` + // NatRuleCollections - Collection of NAT rule collections used by Azure Firewall. + NatRuleCollections *[]AzureFirewallNatRuleCollection `json:"natRuleCollections,omitempty"` + // NetworkRuleCollections - Collection of network rule collections used by Azure Firewall. + NetworkRuleCollections *[]AzureFirewallNetworkRuleCollection `json:"networkRuleCollections,omitempty"` + // IPConfigurations - IP configuration of the Azure Firewall resource. + IPConfigurations *[]AzureFirewallIPConfiguration `json:"ipConfigurations,omitempty"` + // ManagementIPConfiguration - IP configuration of the Azure Firewall used for management traffic. + ManagementIPConfiguration *AzureFirewallIPConfiguration `json:"managementIpConfiguration,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the Azure firewall resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ThreatIntelMode - The operation mode for Threat Intelligence. Possible values include: 'AzureFirewallThreatIntelModeAlert', 'AzureFirewallThreatIntelModeDeny', 'AzureFirewallThreatIntelModeOff' + ThreatIntelMode AzureFirewallThreatIntelMode `json:"threatIntelMode,omitempty"` + // VirtualHub - The virtualHub to which the firewall belongs. + VirtualHub *SubResource `json:"virtualHub,omitempty"` + // FirewallPolicy - The firewallPolicy associated with this azure firewall. + FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` + // HubIPAddresses - IP addresses associated with AzureFirewall. + HubIPAddresses *HubIPAddresses `json:"hubIPAddresses,omitempty"` + // IPGroups - READ-ONLY; IpGroups associated with AzureFirewall. + IPGroups *[]AzureFirewallIPGroups `json:"ipGroups,omitempty"` + // Sku - The Azure Firewall Resource SKU. + Sku *AzureFirewallSku `json:"sku,omitempty"` + // AdditionalProperties - The additional properties used to further config this azure firewall. + AdditionalProperties map[string]*string `json:"additionalProperties"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallPropertiesFormat. +func (afpf AzureFirewallPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afpf.ApplicationRuleCollections != nil { + objectMap["applicationRuleCollections"] = afpf.ApplicationRuleCollections + } + if afpf.NatRuleCollections != nil { + objectMap["natRuleCollections"] = afpf.NatRuleCollections + } + if afpf.NetworkRuleCollections != nil { + objectMap["networkRuleCollections"] = afpf.NetworkRuleCollections + } + if afpf.IPConfigurations != nil { + objectMap["ipConfigurations"] = afpf.IPConfigurations + } + if afpf.ManagementIPConfiguration != nil { + objectMap["managementIpConfiguration"] = afpf.ManagementIPConfiguration + } + if afpf.ThreatIntelMode != "" { + objectMap["threatIntelMode"] = afpf.ThreatIntelMode + } + if afpf.VirtualHub != nil { + objectMap["virtualHub"] = afpf.VirtualHub + } + if afpf.FirewallPolicy != nil { + objectMap["firewallPolicy"] = afpf.FirewallPolicy + } + if afpf.HubIPAddresses != nil { + objectMap["hubIPAddresses"] = afpf.HubIPAddresses + } + if afpf.Sku != nil { + objectMap["sku"] = afpf.Sku + } + if afpf.AdditionalProperties != nil { + objectMap["additionalProperties"] = afpf.AdditionalProperties + } + return json.Marshal(objectMap) +} + +// AzureFirewallPublicIPAddress public IP Address associated with azure firewall. +type AzureFirewallPublicIPAddress struct { + // Address - Public IP Address value. + Address *string `json:"address,omitempty"` +} + +// AzureFirewallRCAction properties of the AzureFirewallRCAction. +type AzureFirewallRCAction struct { + // Type - The type of action. Possible values include: 'AzureFirewallRCActionTypeAllow', 'AzureFirewallRCActionTypeDeny' + Type AzureFirewallRCActionType `json:"type,omitempty"` +} + +// AzureFirewallSku SKU of an Azure Firewall. +type AzureFirewallSku struct { + // Name - Name of an Azure Firewall SKU. Possible values include: 'AzureFirewallSkuNameAZFWVNet', 'AzureFirewallSkuNameAZFWHub' + Name AzureFirewallSkuName `json:"name,omitempty"` + // Tier - Tier of an Azure Firewall. Possible values include: 'AzureFirewallSkuTierStandard', 'AzureFirewallSkuTierPremium', 'AzureFirewallSkuTierBasic' + Tier AzureFirewallSkuTier `json:"tier,omitempty"` +} + +// AzureFirewallsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AzureFirewallsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AzureFirewallsClient) (AzureFirewall, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AzureFirewallsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AzureFirewallsCreateOrUpdateFuture.Result. +func (future *AzureFirewallsCreateOrUpdateFuture) result(client AzureFirewallsClient) (af AzureFirewall, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + af.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.AzureFirewallsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if af.Response.Response, err = future.GetResult(sender); err == nil && af.Response.Response.StatusCode != http.StatusNoContent { + af, err = client.CreateOrUpdateResponder(af.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsCreateOrUpdateFuture", "Result", af.Response.Response, "Failure responding to request") + } + } + return +} + +// AzureFirewallsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AzureFirewallsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AzureFirewallsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AzureFirewallsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AzureFirewallsDeleteFuture.Result. +func (future *AzureFirewallsDeleteFuture) result(client AzureFirewallsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.AzureFirewallsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AzureFirewallsListLearnedPrefixesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AzureFirewallsListLearnedPrefixesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AzureFirewallsClient) (IPPrefixesList, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AzureFirewallsListLearnedPrefixesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AzureFirewallsListLearnedPrefixesFuture.Result. +func (future *AzureFirewallsListLearnedPrefixesFuture) result(client AzureFirewallsClient) (ipl IPPrefixesList, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsListLearnedPrefixesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ipl.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.AzureFirewallsListLearnedPrefixesFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ipl.Response.Response, err = future.GetResult(sender); err == nil && ipl.Response.Response.StatusCode != http.StatusNoContent { + ipl, err = client.ListLearnedPrefixesResponder(ipl.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsListLearnedPrefixesFuture", "Result", ipl.Response.Response, "Failure responding to request") + } + } + return +} + +// AzureFirewallsUpdateTagsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AzureFirewallsUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AzureFirewallsClient) (AzureFirewall, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AzureFirewallsUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AzureFirewallsUpdateTagsFuture.Result. +func (future *AzureFirewallsUpdateTagsFuture) result(client AzureFirewallsClient) (af AzureFirewall, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + af.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.AzureFirewallsUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if af.Response.Response, err = future.GetResult(sender); err == nil && af.Response.Response.StatusCode != http.StatusNoContent { + af, err = client.UpdateTagsResponder(af.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsUpdateTagsFuture", "Result", af.Response.Response, "Failure responding to request") + } + } + return +} + +// AzureReachabilityReport azure reachability report details. +type AzureReachabilityReport struct { + autorest.Response `json:"-"` + // AggregationLevel - The aggregation level of Azure reachability report. Can be Country, State or City. + AggregationLevel *string `json:"aggregationLevel,omitempty"` + // ProviderLocation - Parameters that define a geographic location. + ProviderLocation *AzureReachabilityReportLocation `json:"providerLocation,omitempty"` + // ReachabilityReport - List of Azure reachability report items. + ReachabilityReport *[]AzureReachabilityReportItem `json:"reachabilityReport,omitempty"` +} + +// AzureReachabilityReportItem azure reachability report details for a given provider location. +type AzureReachabilityReportItem struct { + // Provider - The Internet service provider. + Provider *string `json:"provider,omitempty"` + // AzureLocation - The Azure region. + AzureLocation *string `json:"azureLocation,omitempty"` + // Latencies - List of latency details for each of the time series. + Latencies *[]AzureReachabilityReportLatencyInfo `json:"latencies,omitempty"` +} + +// AzureReachabilityReportLatencyInfo details on latency for a time series. +type AzureReachabilityReportLatencyInfo struct { + // TimeStamp - The time stamp. + TimeStamp *date.Time `json:"timeStamp,omitempty"` + // Score - The relative latency score between 1 and 100, higher values indicating a faster connection. + Score *int32 `json:"score,omitempty"` +} + +// AzureReachabilityReportLocation parameters that define a geographic location. +type AzureReachabilityReportLocation struct { + // Country - The name of the country. + Country *string `json:"country,omitempty"` + // State - The name of the state. + State *string `json:"state,omitempty"` + // City - The name of the city or town. + City *string `json:"city,omitempty"` +} + +// AzureReachabilityReportParameters geographic and time constraints for Azure reachability report. +type AzureReachabilityReportParameters struct { + // ProviderLocation - Parameters that define a geographic location. + ProviderLocation *AzureReachabilityReportLocation `json:"providerLocation,omitempty"` + // Providers - List of Internet service providers. + Providers *[]string `json:"providers,omitempty"` + // AzureLocations - Optional Azure regions to scope the query to. + AzureLocations *[]string `json:"azureLocations,omitempty"` + // StartTime - The start time for the Azure reachability report. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - The end time for the Azure reachability report. + EndTime *date.Time `json:"endTime,omitempty"` +} + +// AzureWebCategory azure Web Category Resource. +type AzureWebCategory struct { + autorest.Response `json:"-"` + // AzureWebCategoryPropertiesFormat - Properties of the Azure Web Category. + *AzureWebCategoryPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureWebCategory. +func (awc AzureWebCategory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if awc.AzureWebCategoryPropertiesFormat != nil { + objectMap["properties"] = awc.AzureWebCategoryPropertiesFormat + } + if awc.ID != nil { + objectMap["id"] = awc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureWebCategory struct. +func (awc *AzureWebCategory) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureWebCategoryPropertiesFormat AzureWebCategoryPropertiesFormat + err = json.Unmarshal(*v, &azureWebCategoryPropertiesFormat) + if err != nil { + return err + } + awc.AzureWebCategoryPropertiesFormat = &azureWebCategoryPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + awc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + awc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + awc.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + awc.Etag = &etag + } + } + } + + return nil +} + +// AzureWebCategoryListResult response for ListAzureWebCategories API service call. +type AzureWebCategoryListResult struct { + autorest.Response `json:"-"` + // Value - List of Azure Web Categories for a given Subscription. + Value *[]AzureWebCategory `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AzureWebCategoryListResultIterator provides access to a complete listing of AzureWebCategory values. +type AzureWebCategoryListResultIterator struct { + i int + page AzureWebCategoryListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AzureWebCategoryListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureWebCategoryListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AzureWebCategoryListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AzureWebCategoryListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AzureWebCategoryListResultIterator) Response() AzureWebCategoryListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AzureWebCategoryListResultIterator) Value() AzureWebCategory { + if !iter.page.NotDone() { + return AzureWebCategory{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AzureWebCategoryListResultIterator type. +func NewAzureWebCategoryListResultIterator(page AzureWebCategoryListResultPage) AzureWebCategoryListResultIterator { + return AzureWebCategoryListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (awclr AzureWebCategoryListResult) IsEmpty() bool { + return awclr.Value == nil || len(*awclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (awclr AzureWebCategoryListResult) hasNextLink() bool { + return awclr.NextLink != nil && len(*awclr.NextLink) != 0 +} + +// azureWebCategoryListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (awclr AzureWebCategoryListResult) azureWebCategoryListResultPreparer(ctx context.Context) (*http.Request, error) { + if !awclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(awclr.NextLink))) +} + +// AzureWebCategoryListResultPage contains a page of AzureWebCategory values. +type AzureWebCategoryListResultPage struct { + fn func(context.Context, AzureWebCategoryListResult) (AzureWebCategoryListResult, error) + awclr AzureWebCategoryListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AzureWebCategoryListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureWebCategoryListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.awclr) + if err != nil { + return err + } + page.awclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AzureWebCategoryListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AzureWebCategoryListResultPage) NotDone() bool { + return !page.awclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AzureWebCategoryListResultPage) Response() AzureWebCategoryListResult { + return page.awclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AzureWebCategoryListResultPage) Values() []AzureWebCategory { + if page.awclr.IsEmpty() { + return nil + } + return *page.awclr.Value +} + +// Creates a new instance of the AzureWebCategoryListResultPage type. +func NewAzureWebCategoryListResultPage(cur AzureWebCategoryListResult, getNextPage func(context.Context, AzureWebCategoryListResult) (AzureWebCategoryListResult, error)) AzureWebCategoryListResultPage { + return AzureWebCategoryListResultPage{ + fn: getNextPage, + awclr: cur, + } +} + +// AzureWebCategoryPropertiesFormat azure Web Category Properties. +type AzureWebCategoryPropertiesFormat struct { + // Group - READ-ONLY; The name of the group that the category belongs to. + Group *string `json:"group,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureWebCategoryPropertiesFormat. +func (awcpf AzureWebCategoryPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BGPCommunity contains bgp community information offered in Service Community resources. +type BGPCommunity struct { + // ServiceSupportedRegion - The region which the service support. e.g. For O365, region is Global. + ServiceSupportedRegion *string `json:"serviceSupportedRegion,omitempty"` + // CommunityName - The name of the bgp community. e.g. Skype. + CommunityName *string `json:"communityName,omitempty"` + // CommunityValue - The value of the bgp community. For more information: https://docs.microsoft.com/en-us/azure/expressroute/expressroute-routing. + CommunityValue *string `json:"communityValue,omitempty"` + // CommunityPrefixes - The prefixes that the bgp community contains. + CommunityPrefixes *[]string `json:"communityPrefixes,omitempty"` + // IsAuthorizedToUse - Customer is authorized to use bgp community or not. + IsAuthorizedToUse *bool `json:"isAuthorizedToUse,omitempty"` + // ServiceGroup - The service group of the bgp community contains. + ServiceGroup *string `json:"serviceGroup,omitempty"` +} + +// BackendAddressInboundNatRulePortMappings the response for a QueryInboundNatRulePortMapping API. +type BackendAddressInboundNatRulePortMappings struct { + autorest.Response `json:"-"` + // InboundNatRulePortMappings - Collection of inbound NAT rule port mappings. + InboundNatRulePortMappings *[]InboundNatRulePortMapping `json:"inboundNatRulePortMappings,omitempty"` +} + +// BackendAddressPool pool of backend IP addresses. +type BackendAddressPool struct { + autorest.Response `json:"-"` + // BackendAddressPoolPropertiesFormat - Properties of load balancer backend address pool. + *BackendAddressPoolPropertiesFormat `json:"properties,omitempty"` + // Name - 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. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackendAddressPool. +func (bap BackendAddressPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bap.BackendAddressPoolPropertiesFormat != nil { + objectMap["properties"] = bap.BackendAddressPoolPropertiesFormat + } + if bap.Name != nil { + objectMap["name"] = bap.Name + } + if bap.ID != nil { + objectMap["id"] = bap.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BackendAddressPool struct. +func (bap *BackendAddressPool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var backendAddressPoolPropertiesFormat BackendAddressPoolPropertiesFormat + err = json.Unmarshal(*v, &backendAddressPoolPropertiesFormat) + if err != nil { + return err + } + bap.BackendAddressPoolPropertiesFormat = &backendAddressPoolPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bap.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + bap.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bap.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bap.ID = &ID + } + } + } + + return nil +} + +// BackendAddressPoolPropertiesFormat properties of the backend address pool. +type BackendAddressPoolPropertiesFormat struct { + // Location - The location of the backend address pool. + Location *string `json:"location,omitempty"` + // TunnelInterfaces - An array of gateway load balancer tunnel interfaces. + TunnelInterfaces *[]GatewayLoadBalancerTunnelInterface `json:"tunnelInterfaces,omitempty"` + // LoadBalancerBackendAddresses - An array of backend addresses. + LoadBalancerBackendAddresses *[]LoadBalancerBackendAddress `json:"loadBalancerBackendAddresses,omitempty"` + // BackendIPConfigurations - READ-ONLY; An array of references to IP addresses defined in network interfaces. + BackendIPConfigurations *[]InterfaceIPConfiguration `json:"backendIPConfigurations,omitempty"` + // LoadBalancingRules - READ-ONLY; An array of references to load balancing rules that use this backend address pool. + LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` + // OutboundRule - READ-ONLY; A reference to an outbound rule that uses this backend address pool. + OutboundRule *SubResource `json:"outboundRule,omitempty"` + // OutboundRules - READ-ONLY; An array of references to outbound rules that use this backend address pool. + OutboundRules *[]SubResource `json:"outboundRules,omitempty"` + // InboundNatRules - READ-ONLY; An array of references to inbound NAT rules that use this backend address pool. + InboundNatRules *[]SubResource `json:"inboundNatRules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the backend address pool resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // DrainPeriodInSeconds - Amount of seconds Load Balancer waits for before sending RESET to client and backend address. + DrainPeriodInSeconds *int32 `json:"drainPeriodInSeconds,omitempty"` + // VirtualNetwork - A reference to a virtual network. + VirtualNetwork *SubResource `json:"virtualNetwork,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackendAddressPoolPropertiesFormat. +func (bappf BackendAddressPoolPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bappf.Location != nil { + objectMap["location"] = bappf.Location + } + if bappf.TunnelInterfaces != nil { + objectMap["tunnelInterfaces"] = bappf.TunnelInterfaces + } + if bappf.LoadBalancerBackendAddresses != nil { + objectMap["loadBalancerBackendAddresses"] = bappf.LoadBalancerBackendAddresses + } + if bappf.DrainPeriodInSeconds != nil { + objectMap["drainPeriodInSeconds"] = bappf.DrainPeriodInSeconds + } + if bappf.VirtualNetwork != nil { + objectMap["virtualNetwork"] = bappf.VirtualNetwork + } + return json.Marshal(objectMap) +} + +// BasicBaseAdminRule network base admin rule. +type BasicBaseAdminRule interface { + AsAdminRule() (*AdminRule, bool) + AsDefaultAdminRule() (*DefaultAdminRule, bool) + AsBaseAdminRule() (*BaseAdminRule, bool) +} + +// BaseAdminRule network base admin rule. +type BaseAdminRule struct { + autorest.Response `json:"-"` + // SystemData - READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindBasicBaseAdminRuleKindBaseAdminRule', 'KindBasicBaseAdminRuleKindCustom', 'KindBasicBaseAdminRuleKindDefault' + Kind KindBasicBaseAdminRule `json:"kind,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +func unmarshalBasicBaseAdminRule(body []byte) (BasicBaseAdminRule, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBasicBaseAdminRuleKindCustom): + var ar AdminRule + err := json.Unmarshal(body, &ar) + return ar, err + case string(KindBasicBaseAdminRuleKindDefault): + var dar DefaultAdminRule + err := json.Unmarshal(body, &dar) + return dar, err + default: + var bar BaseAdminRule + err := json.Unmarshal(body, &bar) + return bar, err + } +} +func unmarshalBasicBaseAdminRuleArray(body []byte) ([]BasicBaseAdminRule, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + barArray := make([]BasicBaseAdminRule, len(rawMessages)) + + for index, rawMessage := range rawMessages { + bar, err := unmarshalBasicBaseAdminRule(*rawMessage) + if err != nil { + return nil, err + } + barArray[index] = bar + } + return barArray, nil +} + +// MarshalJSON is the custom marshaler for BaseAdminRule. +func (bar BaseAdminRule) MarshalJSON() ([]byte, error) { + bar.Kind = KindBasicBaseAdminRuleKindBaseAdminRule + objectMap := make(map[string]interface{}) + if bar.Kind != "" { + objectMap["kind"] = bar.Kind + } + return json.Marshal(objectMap) +} + +// AsAdminRule is the BasicBaseAdminRule implementation for BaseAdminRule. +func (bar BaseAdminRule) AsAdminRule() (*AdminRule, bool) { + return nil, false +} + +// AsDefaultAdminRule is the BasicBaseAdminRule implementation for BaseAdminRule. +func (bar BaseAdminRule) AsDefaultAdminRule() (*DefaultAdminRule, bool) { + return nil, false +} + +// AsBaseAdminRule is the BasicBaseAdminRule implementation for BaseAdminRule. +func (bar BaseAdminRule) AsBaseAdminRule() (*BaseAdminRule, bool) { + return &bar, true +} + +// AsBasicBaseAdminRule is the BasicBaseAdminRule implementation for BaseAdminRule. +func (bar BaseAdminRule) AsBasicBaseAdminRule() (BasicBaseAdminRule, bool) { + return &bar, true +} + +// BaseAdminRuleModel ... +type BaseAdminRuleModel struct { + autorest.Response `json:"-"` + Value BasicBaseAdminRule `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for BaseAdminRuleModel struct. +func (barm *BaseAdminRuleModel) UnmarshalJSON(body []byte) error { + bar, err := unmarshalBasicBaseAdminRule(body) + if err != nil { + return err + } + barm.Value = bar + + return nil +} + +// BastionActiveSession the session detail for a target. +type BastionActiveSession struct { + // SessionID - READ-ONLY; A unique id for the session. + SessionID *string `json:"sessionId,omitempty"` + // StartTime - READ-ONLY; The time when the session started. + StartTime interface{} `json:"startTime,omitempty"` + // TargetSubscriptionID - READ-ONLY; The subscription id for the target virtual machine. + TargetSubscriptionID *string `json:"targetSubscriptionId,omitempty"` + // ResourceType - READ-ONLY; The type of the resource. + ResourceType *string `json:"resourceType,omitempty"` + // TargetHostName - READ-ONLY; The host name of the target. + TargetHostName *string `json:"targetHostName,omitempty"` + // TargetResourceGroup - READ-ONLY; The resource group of the target. + TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` + // UserName - READ-ONLY; The user name who is active on this session. + UserName *string `json:"userName,omitempty"` + // TargetIPAddress - READ-ONLY; The IP Address of the target. + TargetIPAddress *string `json:"targetIpAddress,omitempty"` + // Protocol - READ-ONLY; The protocol used to connect to the target. Possible values include: 'BastionConnectProtocolSSH', 'BastionConnectProtocolRDP' + Protocol BastionConnectProtocol `json:"protocol,omitempty"` + // TargetResourceID - READ-ONLY; The resource id of the target. + TargetResourceID *string `json:"targetResourceId,omitempty"` + // SessionDurationInMins - READ-ONLY; Duration in mins the session has been active. + SessionDurationInMins *float64 `json:"sessionDurationInMins,omitempty"` +} + +// MarshalJSON is the custom marshaler for BastionActiveSession. +func (bas BastionActiveSession) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BastionActiveSessionListResult response for GetActiveSessions. +type BastionActiveSessionListResult struct { + autorest.Response `json:"-"` + // Value - List of active sessions on the bastion. + Value *[]BastionActiveSession `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// BastionActiveSessionListResultIterator provides access to a complete listing of BastionActiveSession +// values. +type BastionActiveSessionListResultIterator struct { + i int + page BastionActiveSessionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BastionActiveSessionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionActiveSessionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BastionActiveSessionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BastionActiveSessionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BastionActiveSessionListResultIterator) Response() BastionActiveSessionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BastionActiveSessionListResultIterator) Value() BastionActiveSession { + if !iter.page.NotDone() { + return BastionActiveSession{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BastionActiveSessionListResultIterator type. +func NewBastionActiveSessionListResultIterator(page BastionActiveSessionListResultPage) BastionActiveSessionListResultIterator { + return BastionActiveSessionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (baslr BastionActiveSessionListResult) IsEmpty() bool { + return baslr.Value == nil || len(*baslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (baslr BastionActiveSessionListResult) hasNextLink() bool { + return baslr.NextLink != nil && len(*baslr.NextLink) != 0 +} + +// bastionActiveSessionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (baslr BastionActiveSessionListResult) bastionActiveSessionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !baslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(baslr.NextLink))) +} + +// BastionActiveSessionListResultPage contains a page of BastionActiveSession values. +type BastionActiveSessionListResultPage struct { + fn func(context.Context, BastionActiveSessionListResult) (BastionActiveSessionListResult, error) + baslr BastionActiveSessionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BastionActiveSessionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionActiveSessionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.baslr) + if err != nil { + return err + } + page.baslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BastionActiveSessionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BastionActiveSessionListResultPage) NotDone() bool { + return !page.baslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BastionActiveSessionListResultPage) Response() BastionActiveSessionListResult { + return page.baslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BastionActiveSessionListResultPage) Values() []BastionActiveSession { + if page.baslr.IsEmpty() { + return nil + } + return *page.baslr.Value +} + +// Creates a new instance of the BastionActiveSessionListResultPage type. +func NewBastionActiveSessionListResultPage(cur BastionActiveSessionListResult, getNextPage func(context.Context, BastionActiveSessionListResult) (BastionActiveSessionListResult, error)) BastionActiveSessionListResultPage { + return BastionActiveSessionListResultPage{ + fn: getNextPage, + baslr: cur, + } +} + +// BastionHost bastion Host resource. +type BastionHost struct { + autorest.Response `json:"-"` + // BastionHostPropertiesFormat - Represents the bastion host resource. + *BastionHostPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Sku - The sku of this Bastion Host. + Sku *Sku `json:"sku,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for BastionHost. +func (bh BastionHost) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bh.BastionHostPropertiesFormat != nil { + objectMap["properties"] = bh.BastionHostPropertiesFormat + } + if bh.Sku != nil { + objectMap["sku"] = bh.Sku + } + if bh.ID != nil { + objectMap["id"] = bh.ID + } + if bh.Location != nil { + objectMap["location"] = bh.Location + } + if bh.Tags != nil { + objectMap["tags"] = bh.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BastionHost struct. +func (bh *BastionHost) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var bastionHostPropertiesFormat BastionHostPropertiesFormat + err = json.Unmarshal(*v, &bastionHostPropertiesFormat) + if err != nil { + return err + } + bh.BastionHostPropertiesFormat = &bastionHostPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + bh.Etag = &etag + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + bh.Sku = &sku + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bh.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bh.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bh.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + bh.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + bh.Tags = tags + } + } + } + + return nil +} + +// BastionHostIPConfiguration IP configuration of an Bastion Host. +type BastionHostIPConfiguration struct { + // BastionHostIPConfigurationPropertiesFormat - Represents the ip configuration associated with the resource. + *BastionHostIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Ip configuration type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for BastionHostIPConfiguration. +func (bhic BastionHostIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bhic.BastionHostIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = bhic.BastionHostIPConfigurationPropertiesFormat + } + if bhic.Name != nil { + objectMap["name"] = bhic.Name + } + if bhic.ID != nil { + objectMap["id"] = bhic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BastionHostIPConfiguration struct. +func (bhic *BastionHostIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var bastionHostIPConfigurationPropertiesFormat BastionHostIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &bastionHostIPConfigurationPropertiesFormat) + if err != nil { + return err + } + bhic.BastionHostIPConfigurationPropertiesFormat = &bastionHostIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bhic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + bhic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bhic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bhic.ID = &ID + } + } + } + + return nil +} + +// BastionHostIPConfigurationPropertiesFormat properties of IP configuration of an Bastion Host. +type BastionHostIPConfigurationPropertiesFormat struct { + // Subnet - Reference of the subnet resource. + Subnet *SubResource `json:"subnet,omitempty"` + // PublicIPAddress - Reference of the PublicIP resource. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the bastion host IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateIPAllocationMethod - Private IP allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` +} + +// MarshalJSON is the custom marshaler for BastionHostIPConfigurationPropertiesFormat. +func (bhicpf BastionHostIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bhicpf.Subnet != nil { + objectMap["subnet"] = bhicpf.Subnet + } + if bhicpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = bhicpf.PublicIPAddress + } + if bhicpf.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = bhicpf.PrivateIPAllocationMethod + } + return json.Marshal(objectMap) +} + +// BastionHostListResult response for ListBastionHosts API service call. +type BastionHostListResult struct { + autorest.Response `json:"-"` + // Value - List of Bastion Hosts in a resource group. + Value *[]BastionHost `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// BastionHostListResultIterator provides access to a complete listing of BastionHost values. +type BastionHostListResultIterator struct { + i int + page BastionHostListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BastionHostListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionHostListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BastionHostListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BastionHostListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BastionHostListResultIterator) Response() BastionHostListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BastionHostListResultIterator) Value() BastionHost { + if !iter.page.NotDone() { + return BastionHost{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BastionHostListResultIterator type. +func NewBastionHostListResultIterator(page BastionHostListResultPage) BastionHostListResultIterator { + return BastionHostListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bhlr BastionHostListResult) IsEmpty() bool { + return bhlr.Value == nil || len(*bhlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bhlr BastionHostListResult) hasNextLink() bool { + return bhlr.NextLink != nil && len(*bhlr.NextLink) != 0 +} + +// bastionHostListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bhlr BastionHostListResult) bastionHostListResultPreparer(ctx context.Context) (*http.Request, error) { + if !bhlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bhlr.NextLink))) +} + +// BastionHostListResultPage contains a page of BastionHost values. +type BastionHostListResultPage struct { + fn func(context.Context, BastionHostListResult) (BastionHostListResult, error) + bhlr BastionHostListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BastionHostListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionHostListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bhlr) + if err != nil { + return err + } + page.bhlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BastionHostListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BastionHostListResultPage) NotDone() bool { + return !page.bhlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BastionHostListResultPage) Response() BastionHostListResult { + return page.bhlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BastionHostListResultPage) Values() []BastionHost { + if page.bhlr.IsEmpty() { + return nil + } + return *page.bhlr.Value +} + +// Creates a new instance of the BastionHostListResultPage type. +func NewBastionHostListResultPage(cur BastionHostListResult, getNextPage func(context.Context, BastionHostListResult) (BastionHostListResult, error)) BastionHostListResultPage { + return BastionHostListResultPage{ + fn: getNextPage, + bhlr: cur, + } +} + +// BastionHostPropertiesFormat properties of the Bastion Host. +type BastionHostPropertiesFormat struct { + // IPConfigurations - IP configuration of the Bastion Host resource. + IPConfigurations *[]BastionHostIPConfiguration `json:"ipConfigurations,omitempty"` + // DNSName - FQDN for the endpoint on which bastion host is accessible. + DNSName *string `json:"dnsName,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the bastion host resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ScaleUnits - The scale units for the Bastion Host resource. + ScaleUnits *int32 `json:"scaleUnits,omitempty"` + // DisableCopyPaste - Enable/Disable Copy/Paste feature of the Bastion Host resource. + DisableCopyPaste *bool `json:"disableCopyPaste,omitempty"` + // EnableFileCopy - Enable/Disable File Copy feature of the Bastion Host resource. + EnableFileCopy *bool `json:"enableFileCopy,omitempty"` + // EnableIPConnect - Enable/Disable IP Connect feature of the Bastion Host resource. + EnableIPConnect *bool `json:"enableIpConnect,omitempty"` + // EnableShareableLink - Enable/Disable Shareable Link of the Bastion Host resource. + EnableShareableLink *bool `json:"enableShareableLink,omitempty"` + // EnableTunneling - Enable/Disable Tunneling feature of the Bastion Host resource. + EnableTunneling *bool `json:"enableTunneling,omitempty"` +} + +// MarshalJSON is the custom marshaler for BastionHostPropertiesFormat. +func (bhpf BastionHostPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bhpf.IPConfigurations != nil { + objectMap["ipConfigurations"] = bhpf.IPConfigurations + } + if bhpf.DNSName != nil { + objectMap["dnsName"] = bhpf.DNSName + } + if bhpf.ScaleUnits != nil { + objectMap["scaleUnits"] = bhpf.ScaleUnits + } + if bhpf.DisableCopyPaste != nil { + objectMap["disableCopyPaste"] = bhpf.DisableCopyPaste + } + if bhpf.EnableFileCopy != nil { + objectMap["enableFileCopy"] = bhpf.EnableFileCopy + } + if bhpf.EnableIPConnect != nil { + objectMap["enableIpConnect"] = bhpf.EnableIPConnect + } + if bhpf.EnableShareableLink != nil { + objectMap["enableShareableLink"] = bhpf.EnableShareableLink + } + if bhpf.EnableTunneling != nil { + objectMap["enableTunneling"] = bhpf.EnableTunneling + } + return json.Marshal(objectMap) +} + +// BastionHostsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BastionHostsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BastionHostsClient) (BastionHost, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BastionHostsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BastionHostsCreateOrUpdateFuture.Result. +func (future *BastionHostsCreateOrUpdateFuture) result(client BastionHostsClient) (bh BastionHost, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bh.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.BastionHostsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bh.Response.Response, err = future.GetResult(sender); err == nil && bh.Response.Response.StatusCode != http.StatusNoContent { + bh, err = client.CreateOrUpdateResponder(bh.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsCreateOrUpdateFuture", "Result", bh.Response.Response, "Failure responding to request") + } + } + return +} + +// BastionHostsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BastionHostsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BastionHostsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BastionHostsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BastionHostsDeleteFuture.Result. +func (future *BastionHostsDeleteFuture) result(client BastionHostsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.BastionHostsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BastionHostsUpdateTagsFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BastionHostsUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BastionHostsClient) (BastionHost, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BastionHostsUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BastionHostsUpdateTagsFuture.Result. +func (future *BastionHostsUpdateTagsFuture) result(client BastionHostsClient) (bh BastionHost, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bh.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.BastionHostsUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bh.Response.Response, err = future.GetResult(sender); err == nil && bh.Response.Response.StatusCode != http.StatusNoContent { + bh, err = client.UpdateTagsResponder(bh.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsUpdateTagsFuture", "Result", bh.Response.Response, "Failure responding to request") + } + } + return +} + +// BastionSessionDeleteResult response for DisconnectActiveSessions. +type BastionSessionDeleteResult struct { + autorest.Response `json:"-"` + // Value - List of sessions with their corresponding state. + Value *[]BastionSessionState `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// BastionSessionDeleteResultIterator provides access to a complete listing of BastionSessionState values. +type BastionSessionDeleteResultIterator struct { + i int + page BastionSessionDeleteResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BastionSessionDeleteResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionSessionDeleteResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BastionSessionDeleteResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BastionSessionDeleteResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BastionSessionDeleteResultIterator) Response() BastionSessionDeleteResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BastionSessionDeleteResultIterator) Value() BastionSessionState { + if !iter.page.NotDone() { + return BastionSessionState{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BastionSessionDeleteResultIterator type. +func NewBastionSessionDeleteResultIterator(page BastionSessionDeleteResultPage) BastionSessionDeleteResultIterator { + return BastionSessionDeleteResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bsdr BastionSessionDeleteResult) IsEmpty() bool { + return bsdr.Value == nil || len(*bsdr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bsdr BastionSessionDeleteResult) hasNextLink() bool { + return bsdr.NextLink != nil && len(*bsdr.NextLink) != 0 +} + +// bastionSessionDeleteResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bsdr BastionSessionDeleteResult) bastionSessionDeleteResultPreparer(ctx context.Context) (*http.Request, error) { + if !bsdr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bsdr.NextLink))) +} + +// BastionSessionDeleteResultPage contains a page of BastionSessionState values. +type BastionSessionDeleteResultPage struct { + fn func(context.Context, BastionSessionDeleteResult) (BastionSessionDeleteResult, error) + bsdr BastionSessionDeleteResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BastionSessionDeleteResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionSessionDeleteResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bsdr) + if err != nil { + return err + } + page.bsdr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BastionSessionDeleteResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BastionSessionDeleteResultPage) NotDone() bool { + return !page.bsdr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BastionSessionDeleteResultPage) Response() BastionSessionDeleteResult { + return page.bsdr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BastionSessionDeleteResultPage) Values() []BastionSessionState { + if page.bsdr.IsEmpty() { + return nil + } + return *page.bsdr.Value +} + +// Creates a new instance of the BastionSessionDeleteResultPage type. +func NewBastionSessionDeleteResultPage(cur BastionSessionDeleteResult, getNextPage func(context.Context, BastionSessionDeleteResult) (BastionSessionDeleteResult, error)) BastionSessionDeleteResultPage { + return BastionSessionDeleteResultPage{ + fn: getNextPage, + bsdr: cur, + } +} + +// BastionSessionState the session state detail for a target. +type BastionSessionState struct { + // SessionID - READ-ONLY; A unique id for the session. + SessionID *string `json:"sessionId,omitempty"` + // Message - READ-ONLY; Used for extra information. + Message *string `json:"message,omitempty"` + // State - READ-ONLY; The state of the session. Disconnected/Failed/NotFound. + State *string `json:"state,omitempty"` +} + +// MarshalJSON is the custom marshaler for BastionSessionState. +func (bss BastionSessionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BastionShareableLink bastion Shareable Link. +type BastionShareableLink struct { + // VM - Reference of the virtual machine resource. + VM *VM `json:"vm,omitempty"` + // Bsl - READ-ONLY; The unique Bastion Shareable Link to the virtual machine. + Bsl *string `json:"bsl,omitempty"` + // CreatedAt - READ-ONLY; The time when the link was created. + CreatedAt *string `json:"createdAt,omitempty"` + // Message - READ-ONLY; Optional field indicating the warning or error message related to the vm in case of partial failure. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for BastionShareableLink. +func (bsl BastionShareableLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsl.VM != nil { + objectMap["vm"] = bsl.VM + } + return json.Marshal(objectMap) +} + +// BastionShareableLinkListRequest post request for all the Bastion Shareable Link endpoints. +type BastionShareableLinkListRequest struct { + // Vms - List of VM references. + Vms *[]BastionShareableLink `json:"vms,omitempty"` +} + +// BastionShareableLinkListResult response for all the Bastion Shareable Link endpoints. +type BastionShareableLinkListResult struct { + autorest.Response `json:"-"` + // Value - List of Bastion Shareable Links for the request. + Value *[]BastionShareableLink `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// BastionShareableLinkListResultIterator provides access to a complete listing of BastionShareableLink +// values. +type BastionShareableLinkListResultIterator struct { + i int + page BastionShareableLinkListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BastionShareableLinkListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionShareableLinkListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BastionShareableLinkListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BastionShareableLinkListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BastionShareableLinkListResultIterator) Response() BastionShareableLinkListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BastionShareableLinkListResultIterator) Value() BastionShareableLink { + if !iter.page.NotDone() { + return BastionShareableLink{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BastionShareableLinkListResultIterator type. +func NewBastionShareableLinkListResultIterator(page BastionShareableLinkListResultPage) BastionShareableLinkListResultIterator { + return BastionShareableLinkListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bsllr BastionShareableLinkListResult) IsEmpty() bool { + return bsllr.Value == nil || len(*bsllr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bsllr BastionShareableLinkListResult) hasNextLink() bool { + return bsllr.NextLink != nil && len(*bsllr.NextLink) != 0 +} + +// bastionShareableLinkListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bsllr BastionShareableLinkListResult) bastionShareableLinkListResultPreparer(ctx context.Context) (*http.Request, error) { + if !bsllr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bsllr.NextLink))) +} + +// BastionShareableLinkListResultPage contains a page of BastionShareableLink values. +type BastionShareableLinkListResultPage struct { + fn func(context.Context, BastionShareableLinkListResult) (BastionShareableLinkListResult, error) + bsllr BastionShareableLinkListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BastionShareableLinkListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionShareableLinkListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bsllr) + if err != nil { + return err + } + page.bsllr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BastionShareableLinkListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BastionShareableLinkListResultPage) NotDone() bool { + return !page.bsllr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BastionShareableLinkListResultPage) Response() BastionShareableLinkListResult { + return page.bsllr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BastionShareableLinkListResultPage) Values() []BastionShareableLink { + if page.bsllr.IsEmpty() { + return nil + } + return *page.bsllr.Value +} + +// Creates a new instance of the BastionShareableLinkListResultPage type. +func NewBastionShareableLinkListResultPage(cur BastionShareableLinkListResult, getNextPage func(context.Context, BastionShareableLinkListResult) (BastionShareableLinkListResult, error)) BastionShareableLinkListResultPage { + return BastionShareableLinkListResultPage{ + fn: getNextPage, + bsllr: cur, + } +} + +// BgpConnection virtual Appliance Site resource. +type BgpConnection struct { + autorest.Response `json:"-"` + // BgpConnectionProperties - The properties of the Bgp connections. + *BgpConnectionProperties `json:"properties,omitempty"` + // Name - Name of the connection. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Connection type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for BgpConnection. +func (bc BgpConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bc.BgpConnectionProperties != nil { + objectMap["properties"] = bc.BgpConnectionProperties + } + if bc.Name != nil { + objectMap["name"] = bc.Name + } + if bc.ID != nil { + objectMap["id"] = bc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BgpConnection struct. +func (bc *BgpConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var bgpConnectionProperties BgpConnectionProperties + err = json.Unmarshal(*v, &bgpConnectionProperties) + if err != nil { + return err + } + bc.BgpConnectionProperties = &bgpConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + bc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bc.ID = &ID + } + } + } + + return nil +} + +// BgpConnectionProperties properties of the bgp connection. +type BgpConnectionProperties struct { + // PeerAsn - Peer ASN. + PeerAsn *int64 `json:"peerAsn,omitempty"` + // PeerIP - Peer IP. + PeerIP *string `json:"peerIp,omitempty"` + // HubVirtualNetworkConnection - The reference to the HubVirtualNetworkConnection resource. + HubVirtualNetworkConnection *SubResource `json:"hubVirtualNetworkConnection,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ConnectionState - READ-ONLY; The current state of the VirtualHub to Peer. Possible values include: 'HubBgpConnectionStatusUnknown', 'HubBgpConnectionStatusConnecting', 'HubBgpConnectionStatusConnected', 'HubBgpConnectionStatusNotConnected' + ConnectionState HubBgpConnectionStatus `json:"connectionState,omitempty"` +} + +// MarshalJSON is the custom marshaler for BgpConnectionProperties. +func (bcp BgpConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bcp.PeerAsn != nil { + objectMap["peerAsn"] = bcp.PeerAsn + } + if bcp.PeerIP != nil { + objectMap["peerIp"] = bcp.PeerIP + } + if bcp.HubVirtualNetworkConnection != nil { + objectMap["hubVirtualNetworkConnection"] = bcp.HubVirtualNetworkConnection + } + return json.Marshal(objectMap) +} + +// BgpPeerStatus BGP peer status details. +type BgpPeerStatus struct { + // LocalAddress - READ-ONLY; The virtual network gateway's local address. + LocalAddress *string `json:"localAddress,omitempty"` + // Neighbor - READ-ONLY; The remote BGP peer. + Neighbor *string `json:"neighbor,omitempty"` + // Asn - READ-ONLY; The autonomous system number of the remote BGP peer. + Asn *int64 `json:"asn,omitempty"` + // State - READ-ONLY; The BGP peer state. Possible values include: 'BgpPeerStateUnknown', 'BgpPeerStateStopped', 'BgpPeerStateIdle', 'BgpPeerStateConnecting', 'BgpPeerStateConnected' + State BgpPeerState `json:"state,omitempty"` + // ConnectedDuration - READ-ONLY; For how long the peering has been up. + ConnectedDuration *string `json:"connectedDuration,omitempty"` + // RoutesReceived - READ-ONLY; The number of routes learned from this peer. + RoutesReceived *int64 `json:"routesReceived,omitempty"` + // MessagesSent - READ-ONLY; The number of BGP messages sent. + MessagesSent *int64 `json:"messagesSent,omitempty"` + // MessagesReceived - READ-ONLY; The number of BGP messages received. + MessagesReceived *int64 `json:"messagesReceived,omitempty"` +} + +// MarshalJSON is the custom marshaler for BgpPeerStatus. +func (bps BgpPeerStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BgpPeerStatusListResult response for list BGP peer status API service call. +type BgpPeerStatusListResult struct { + autorest.Response `json:"-"` + // Value - List of BGP peers. + Value *[]BgpPeerStatus `json:"value,omitempty"` +} + +// BgpServiceCommunity service Community Properties. +type BgpServiceCommunity struct { + // BgpServiceCommunityPropertiesFormat - Properties of the BGP service community. + *BgpServiceCommunityPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for BgpServiceCommunity. +func (bsc BgpServiceCommunity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsc.BgpServiceCommunityPropertiesFormat != nil { + objectMap["properties"] = bsc.BgpServiceCommunityPropertiesFormat + } + if bsc.ID != nil { + objectMap["id"] = bsc.ID + } + if bsc.Location != nil { + objectMap["location"] = bsc.Location + } + if bsc.Tags != nil { + objectMap["tags"] = bsc.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BgpServiceCommunity struct. +func (bsc *BgpServiceCommunity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var bgpServiceCommunityPropertiesFormat BgpServiceCommunityPropertiesFormat + err = json.Unmarshal(*v, &bgpServiceCommunityPropertiesFormat) + if err != nil { + return err + } + bsc.BgpServiceCommunityPropertiesFormat = &bgpServiceCommunityPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bsc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bsc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bsc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + bsc.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + bsc.Tags = tags + } + } + } + + return nil +} + +// BgpServiceCommunityListResult response for the ListServiceCommunity API service call. +type BgpServiceCommunityListResult struct { + autorest.Response `json:"-"` + // Value - A list of service community resources. + Value *[]BgpServiceCommunity `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// BgpServiceCommunityListResultIterator provides access to a complete listing of BgpServiceCommunity +// values. +type BgpServiceCommunityListResultIterator struct { + i int + page BgpServiceCommunityListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BgpServiceCommunityListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BgpServiceCommunityListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BgpServiceCommunityListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BgpServiceCommunityListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BgpServiceCommunityListResultIterator) Response() BgpServiceCommunityListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BgpServiceCommunityListResultIterator) Value() BgpServiceCommunity { + if !iter.page.NotDone() { + return BgpServiceCommunity{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BgpServiceCommunityListResultIterator type. +func NewBgpServiceCommunityListResultIterator(page BgpServiceCommunityListResultPage) BgpServiceCommunityListResultIterator { + return BgpServiceCommunityListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bsclr BgpServiceCommunityListResult) IsEmpty() bool { + return bsclr.Value == nil || len(*bsclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bsclr BgpServiceCommunityListResult) hasNextLink() bool { + return bsclr.NextLink != nil && len(*bsclr.NextLink) != 0 +} + +// bgpServiceCommunityListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bsclr BgpServiceCommunityListResult) bgpServiceCommunityListResultPreparer(ctx context.Context) (*http.Request, error) { + if !bsclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bsclr.NextLink))) +} + +// BgpServiceCommunityListResultPage contains a page of BgpServiceCommunity values. +type BgpServiceCommunityListResultPage struct { + fn func(context.Context, BgpServiceCommunityListResult) (BgpServiceCommunityListResult, error) + bsclr BgpServiceCommunityListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BgpServiceCommunityListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BgpServiceCommunityListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bsclr) + if err != nil { + return err + } + page.bsclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BgpServiceCommunityListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BgpServiceCommunityListResultPage) NotDone() bool { + return !page.bsclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BgpServiceCommunityListResultPage) Response() BgpServiceCommunityListResult { + return page.bsclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BgpServiceCommunityListResultPage) Values() []BgpServiceCommunity { + if page.bsclr.IsEmpty() { + return nil + } + return *page.bsclr.Value +} + +// Creates a new instance of the BgpServiceCommunityListResultPage type. +func NewBgpServiceCommunityListResultPage(cur BgpServiceCommunityListResult, getNextPage func(context.Context, BgpServiceCommunityListResult) (BgpServiceCommunityListResult, error)) BgpServiceCommunityListResultPage { + return BgpServiceCommunityListResultPage{ + fn: getNextPage, + bsclr: cur, + } +} + +// BgpServiceCommunityPropertiesFormat properties of Service Community. +type BgpServiceCommunityPropertiesFormat struct { + // ServiceName - The name of the bgp community. e.g. Skype. + ServiceName *string `json:"serviceName,omitempty"` + // BgpCommunities - A list of bgp communities. + BgpCommunities *[]BGPCommunity `json:"bgpCommunities,omitempty"` +} + +// BgpSettings BGP settings details. +type BgpSettings struct { + // Asn - The BGP speaker's ASN. + Asn *int64 `json:"asn,omitempty"` + // BgpPeeringAddress - The BGP peering address and BGP identifier of this BGP speaker. + BgpPeeringAddress *string `json:"bgpPeeringAddress,omitempty"` + // PeerWeight - The weight added to routes learned from this BGP speaker. + PeerWeight *int32 `json:"peerWeight,omitempty"` + // BgpPeeringAddresses - BGP peering address with IP configuration ID for virtual network gateway. + BgpPeeringAddresses *[]IPConfigurationBgpPeeringAddress `json:"bgpPeeringAddresses,omitempty"` +} + +// BreakOutCategoryPolicies network Virtual Appliance Sku Properties. +type BreakOutCategoryPolicies struct { + // Allow - Flag to control breakout of o365 allow category. + Allow *bool `json:"allow,omitempty"` + // Optimize - Flag to control breakout of o365 optimize category. + Optimize *bool `json:"optimize,omitempty"` + // Default - Flag to control breakout of o365 default category. + Default *bool `json:"default,omitempty"` +} + +// CheckPrivateLinkServiceVisibilityRequest request body of the CheckPrivateLinkServiceVisibility API +// service call. +type CheckPrivateLinkServiceVisibilityRequest struct { + // PrivateLinkServiceAlias - The alias of the private link service. + PrivateLinkServiceAlias *string `json:"privateLinkServiceAlias,omitempty"` +} + +// ChildResource proxy resource representation. +type ChildResource struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ChildResource. +func (cr ChildResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CloudError an error response from the service. +type CloudError struct { + // Error - Cloud error body. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// ConfigurationDiagnosticParameters parameters to get network configuration diagnostic. +type ConfigurationDiagnosticParameters struct { + // TargetResourceID - The ID of the target resource to perform network configuration diagnostic. Valid options are VM, NetworkInterface, VMSS/NetworkInterface and Application Gateway. + TargetResourceID *string `json:"targetResourceId,omitempty"` + // VerbosityLevel - Verbosity level. Possible values include: 'VerbosityLevelNormal', 'VerbosityLevelMinimum', 'VerbosityLevelFull' + VerbosityLevel VerbosityLevel `json:"verbosityLevel,omitempty"` + // Profiles - List of network configuration diagnostic profiles. + Profiles *[]ConfigurationDiagnosticProfile `json:"profiles,omitempty"` +} + +// ConfigurationDiagnosticProfile parameters to compare with network configuration. +type ConfigurationDiagnosticProfile struct { + // Direction - The direction of the traffic. Possible values include: 'DirectionInbound', 'DirectionOutbound' + Direction Direction `json:"direction,omitempty"` + // Protocol - Protocol to be verified on. Accepted values are '*', TCP, UDP. + Protocol *string `json:"protocol,omitempty"` + // Source - Traffic source. Accepted values are '*', IP Address/CIDR, Service Tag. + Source *string `json:"source,omitempty"` + // Destination - Traffic destination. Accepted values are: '*', IP Address/CIDR, Service Tag. + Destination *string `json:"destination,omitempty"` + // DestinationPort - Traffic destination port. Accepted values are '*' and a single port in the range (0 - 65535). + DestinationPort *string `json:"destinationPort,omitempty"` +} + +// ConfigurationDiagnosticResponse results of network configuration diagnostic on the target resource. +type ConfigurationDiagnosticResponse struct { + autorest.Response `json:"-"` + // Results - READ-ONLY; List of network configuration diagnostic results. + Results *[]ConfigurationDiagnosticResult `json:"results,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationDiagnosticResponse. +func (cdr ConfigurationDiagnosticResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ConfigurationDiagnosticResult network configuration diagnostic result corresponded to provided traffic +// query. +type ConfigurationDiagnosticResult struct { + // Profile - Network configuration diagnostic profile. + Profile *ConfigurationDiagnosticProfile `json:"profile,omitempty"` + // NetworkSecurityGroupResult - Network security group result. + NetworkSecurityGroupResult *SecurityGroupResult `json:"networkSecurityGroupResult,omitempty"` +} + +// ConfigurationGroup the network configuration group resource +type ConfigurationGroup struct { + // ID - Network group ID. + ID *string `json:"id,omitempty"` + // GroupProperties - The network configuration group properties + *GroupProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationGroup. +func (cg ConfigurationGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cg.ID != nil { + objectMap["id"] = cg.ID + } + if cg.GroupProperties != nil { + objectMap["properties"] = cg.GroupProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ConfigurationGroup struct. +func (cg *ConfigurationGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cg.ID = &ID + } + case "properties": + if v != nil { + var groupProperties GroupProperties + err = json.Unmarshal(*v, &groupProperties) + if err != nil { + return err + } + cg.GroupProperties = &groupProperties + } + } + } + + return nil +} + +// ConfigurationPolicyGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ConfigurationPolicyGroupsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigurationPolicyGroupsClient) (VpnServerConfigurationPolicyGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigurationPolicyGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConfigurationPolicyGroupsCreateOrUpdateFuture.Result. +func (future *ConfigurationPolicyGroupsCreateOrUpdateFuture) result(client ConfigurationPolicyGroupsClient) (vscpg VpnServerConfigurationPolicyGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vscpg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ConfigurationPolicyGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vscpg.Response.Response, err = future.GetResult(sender); err == nil && vscpg.Response.Response.StatusCode != http.StatusNoContent { + vscpg, err = client.CreateOrUpdateResponder(vscpg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsCreateOrUpdateFuture", "Result", vscpg.Response.Response, "Failure responding to request") + } + } + return +} + +// ConfigurationPolicyGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConfigurationPolicyGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigurationPolicyGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigurationPolicyGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConfigurationPolicyGroupsDeleteFuture.Result. +func (future *ConfigurationPolicyGroupsDeleteFuture) result(client ConfigurationPolicyGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ConfigurationPolicyGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ConnectionMonitor parameters that define the operation to create a connection monitor. +type ConnectionMonitor struct { + // Location - Connection monitor location. + Location *string `json:"location,omitempty"` + // Tags - Connection monitor tags. + Tags map[string]*string `json:"tags"` + // ConnectionMonitorParameters - Properties of the connection monitor. + *ConnectionMonitorParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionMonitor. +func (cm ConnectionMonitor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cm.Location != nil { + objectMap["location"] = cm.Location + } + if cm.Tags != nil { + objectMap["tags"] = cm.Tags + } + if cm.ConnectionMonitorParameters != nil { + objectMap["properties"] = cm.ConnectionMonitorParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ConnectionMonitor struct. +func (cm *ConnectionMonitor) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + cm.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cm.Tags = tags + } + case "properties": + if v != nil { + var connectionMonitorParameters ConnectionMonitorParameters + err = json.Unmarshal(*v, &connectionMonitorParameters) + if err != nil { + return err + } + cm.ConnectionMonitorParameters = &connectionMonitorParameters + } + } + } + + return nil +} + +// ConnectionMonitorDestination describes the destination of connection monitor. +type ConnectionMonitorDestination struct { + // ResourceID - The ID of the resource used as the destination by connection monitor. + ResourceID *string `json:"resourceId,omitempty"` + // Address - Address of the connection monitor destination (IP or domain name). + Address *string `json:"address,omitempty"` + // Port - The destination port used by connection monitor. + Port *int32 `json:"port,omitempty"` +} + +// ConnectionMonitorEndpoint describes the connection monitor endpoint. +type ConnectionMonitorEndpoint struct { + // Name - The name of the connection monitor endpoint. + Name *string `json:"name,omitempty"` + // Type - The endpoint type. Possible values include: 'EndpointTypeAzureVM', 'EndpointTypeAzureVNet', 'EndpointTypeAzureSubnet', 'EndpointTypeExternalAddress', 'EndpointTypeMMAWorkspaceMachine', 'EndpointTypeMMAWorkspaceNetwork', 'EndpointTypeAzureArcVM', 'EndpointTypeAzureVMSS' + Type EndpointType `json:"type,omitempty"` + // ResourceID - Resource ID of the connection monitor endpoint. + ResourceID *string `json:"resourceId,omitempty"` + // Address - Address of the connection monitor endpoint (IP or domain name). + Address *string `json:"address,omitempty"` + // Filter - Filter for sub-items within the endpoint. + Filter *ConnectionMonitorEndpointFilter `json:"filter,omitempty"` + // Scope - Endpoint scope. + Scope *ConnectionMonitorEndpointScope `json:"scope,omitempty"` + // CoverageLevel - Test coverage for the endpoint. Possible values include: 'CoverageLevelDefault', 'CoverageLevelLow', 'CoverageLevelBelowAverage', 'CoverageLevelAverage', 'CoverageLevelAboveAverage', 'CoverageLevelFull' + CoverageLevel CoverageLevel `json:"coverageLevel,omitempty"` +} + +// ConnectionMonitorEndpointFilter describes the connection monitor endpoint filter. +type ConnectionMonitorEndpointFilter struct { + // Type - The behavior of the endpoint filter. Currently only 'Include' is supported. Possible values include: 'ConnectionMonitorEndpointFilterTypeInclude' + Type ConnectionMonitorEndpointFilterType `json:"type,omitempty"` + // Items - List of items in the filter. + Items *[]ConnectionMonitorEndpointFilterItem `json:"items,omitempty"` +} + +// ConnectionMonitorEndpointFilterItem describes the connection monitor endpoint filter item. +type ConnectionMonitorEndpointFilterItem struct { + // Type - The type of item included in the filter. Currently only 'AgentAddress' is supported. Possible values include: 'ConnectionMonitorEndpointFilterItemTypeAgentAddress' + Type ConnectionMonitorEndpointFilterItemType `json:"type,omitempty"` + // Address - The address of the filter item. + Address *string `json:"address,omitempty"` +} + +// ConnectionMonitorEndpointScope describes the connection monitor endpoint scope. +type ConnectionMonitorEndpointScope struct { + // Include - List of items which needs to be included to the endpoint scope. + Include *[]ConnectionMonitorEndpointScopeItem `json:"include,omitempty"` + // Exclude - List of items which needs to be excluded from the endpoint scope. + Exclude *[]ConnectionMonitorEndpointScopeItem `json:"exclude,omitempty"` +} + +// ConnectionMonitorEndpointScopeItem describes the connection monitor endpoint scope item. +type ConnectionMonitorEndpointScopeItem struct { + // Address - The address of the endpoint item. Supported types are IPv4/IPv6 subnet mask or IPv4/IPv6 IP address. + Address *string `json:"address,omitempty"` +} + +// ConnectionMonitorHTTPConfiguration describes the HTTP configuration. +type ConnectionMonitorHTTPConfiguration struct { + // Port - The port to connect to. + Port *int32 `json:"port,omitempty"` + // Method - The HTTP method to use. Possible values include: 'HTTPConfigurationMethodGet', 'HTTPConfigurationMethodPost' + Method HTTPConfigurationMethod `json:"method,omitempty"` + // Path - The path component of the URI. For instance, "/dir1/dir2". + Path *string `json:"path,omitempty"` + // RequestHeaders - The HTTP headers to transmit with the request. + RequestHeaders *[]HTTPHeader `json:"requestHeaders,omitempty"` + // ValidStatusCodeRanges - HTTP status codes to consider successful. For instance, "2xx,301-304,418". + ValidStatusCodeRanges *[]string `json:"validStatusCodeRanges,omitempty"` + // PreferHTTPS - Value indicating whether HTTPS is preferred over HTTP in cases where the choice is not explicit. + PreferHTTPS *bool `json:"preferHTTPS,omitempty"` +} + +// ConnectionMonitorIcmpConfiguration describes the ICMP configuration. +type ConnectionMonitorIcmpConfiguration struct { + // DisableTraceRoute - Value indicating whether path evaluation with trace route should be disabled. + DisableTraceRoute *bool `json:"disableTraceRoute,omitempty"` +} + +// ConnectionMonitorListResult list of connection monitors. +type ConnectionMonitorListResult struct { + autorest.Response `json:"-"` + // Value - Information about connection monitors. + Value *[]ConnectionMonitorResult `json:"value,omitempty"` +} + +// ConnectionMonitorOutput describes a connection monitor output destination. +type ConnectionMonitorOutput struct { + // Type - Connection monitor output destination type. Currently, only "Workspace" is supported. Possible values include: 'OutputTypeWorkspace' + Type OutputType `json:"type,omitempty"` + // WorkspaceSettings - Describes the settings for producing output into a log analytics workspace. + WorkspaceSettings *ConnectionMonitorWorkspaceSettings `json:"workspaceSettings,omitempty"` +} + +// ConnectionMonitorParameters parameters that define the operation to create a connection monitor. +type ConnectionMonitorParameters struct { + // Source - Describes the source of connection monitor. + Source *ConnectionMonitorSource `json:"source,omitempty"` + // Destination - Describes the destination of connection monitor. + Destination *ConnectionMonitorDestination `json:"destination,omitempty"` + // AutoStart - Determines if the connection monitor will start automatically once created. + AutoStart *bool `json:"autoStart,omitempty"` + // MonitoringIntervalInSeconds - Monitoring interval in seconds. + MonitoringIntervalInSeconds *int32 `json:"monitoringIntervalInSeconds,omitempty"` + // Endpoints - List of connection monitor endpoints. + Endpoints *[]ConnectionMonitorEndpoint `json:"endpoints,omitempty"` + // TestConfigurations - List of connection monitor test configurations. + TestConfigurations *[]ConnectionMonitorTestConfiguration `json:"testConfigurations,omitempty"` + // TestGroups - List of connection monitor test groups. + TestGroups *[]ConnectionMonitorTestGroup `json:"testGroups,omitempty"` + // Outputs - List of connection monitor outputs. + Outputs *[]ConnectionMonitorOutput `json:"outputs,omitempty"` + // Notes - Optional notes to be associated with the connection monitor. + Notes *string `json:"notes,omitempty"` +} + +// ConnectionMonitorQueryResult list of connection states snapshots. +type ConnectionMonitorQueryResult struct { + autorest.Response `json:"-"` + // SourceStatus - Status of connection monitor source. Possible values include: 'ConnectionMonitorSourceStatusUnknown', 'ConnectionMonitorSourceStatusActive', 'ConnectionMonitorSourceStatusInactive' + SourceStatus ConnectionMonitorSourceStatus `json:"sourceStatus,omitempty"` + // States - Information about connection states. + States *[]ConnectionStateSnapshot `json:"states,omitempty"` +} + +// ConnectionMonitorResult information about the connection monitor. +type ConnectionMonitorResult struct { + autorest.Response `json:"-"` + // Name - READ-ONLY; Name of the connection monitor. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; ID of the connection monitor. + ID *string `json:"id,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Connection monitor type. + Type *string `json:"type,omitempty"` + // Location - Connection monitor location. + Location *string `json:"location,omitempty"` + // Tags - Connection monitor tags. + Tags map[string]*string `json:"tags"` + // ConnectionMonitorResultProperties - Properties of the connection monitor result. + *ConnectionMonitorResultProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionMonitorResult. +func (cmr ConnectionMonitorResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cmr.Location != nil { + objectMap["location"] = cmr.Location + } + if cmr.Tags != nil { + objectMap["tags"] = cmr.Tags + } + if cmr.ConnectionMonitorResultProperties != nil { + objectMap["properties"] = cmr.ConnectionMonitorResultProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ConnectionMonitorResult struct. +func (cmr *ConnectionMonitorResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cmr.Name = &name + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cmr.ID = &ID + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + cmr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cmr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + cmr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cmr.Tags = tags + } + case "properties": + if v != nil { + var connectionMonitorResultProperties ConnectionMonitorResultProperties + err = json.Unmarshal(*v, &connectionMonitorResultProperties) + if err != nil { + return err + } + cmr.ConnectionMonitorResultProperties = &connectionMonitorResultProperties + } + } + } + + return nil +} + +// ConnectionMonitorResultProperties describes the properties of a connection monitor. +type ConnectionMonitorResultProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the connection monitor. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // StartTime - READ-ONLY; The date and time when the connection monitor was started. + StartTime *date.Time `json:"startTime,omitempty"` + // MonitoringStatus - READ-ONLY; The monitoring status of the connection monitor. + MonitoringStatus *string `json:"monitoringStatus,omitempty"` + // ConnectionMonitorType - READ-ONLY; Type of connection monitor. Possible values include: 'ConnectionMonitorTypeMultiEndpoint', 'ConnectionMonitorTypeSingleSourceDestination' + ConnectionMonitorType ConnectionMonitorType `json:"connectionMonitorType,omitempty"` + // Source - Describes the source of connection monitor. + Source *ConnectionMonitorSource `json:"source,omitempty"` + // Destination - Describes the destination of connection monitor. + Destination *ConnectionMonitorDestination `json:"destination,omitempty"` + // AutoStart - Determines if the connection monitor will start automatically once created. + AutoStart *bool `json:"autoStart,omitempty"` + // MonitoringIntervalInSeconds - Monitoring interval in seconds. + MonitoringIntervalInSeconds *int32 `json:"monitoringIntervalInSeconds,omitempty"` + // Endpoints - List of connection monitor endpoints. + Endpoints *[]ConnectionMonitorEndpoint `json:"endpoints,omitempty"` + // TestConfigurations - List of connection monitor test configurations. + TestConfigurations *[]ConnectionMonitorTestConfiguration `json:"testConfigurations,omitempty"` + // TestGroups - List of connection monitor test groups. + TestGroups *[]ConnectionMonitorTestGroup `json:"testGroups,omitempty"` + // Outputs - List of connection monitor outputs. + Outputs *[]ConnectionMonitorOutput `json:"outputs,omitempty"` + // Notes - Optional notes to be associated with the connection monitor. + Notes *string `json:"notes,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionMonitorResultProperties. +func (cmrp ConnectionMonitorResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cmrp.Source != nil { + objectMap["source"] = cmrp.Source + } + if cmrp.Destination != nil { + objectMap["destination"] = cmrp.Destination + } + if cmrp.AutoStart != nil { + objectMap["autoStart"] = cmrp.AutoStart + } + if cmrp.MonitoringIntervalInSeconds != nil { + objectMap["monitoringIntervalInSeconds"] = cmrp.MonitoringIntervalInSeconds + } + if cmrp.Endpoints != nil { + objectMap["endpoints"] = cmrp.Endpoints + } + if cmrp.TestConfigurations != nil { + objectMap["testConfigurations"] = cmrp.TestConfigurations + } + if cmrp.TestGroups != nil { + objectMap["testGroups"] = cmrp.TestGroups + } + if cmrp.Outputs != nil { + objectMap["outputs"] = cmrp.Outputs + } + if cmrp.Notes != nil { + objectMap["notes"] = cmrp.Notes + } + return json.Marshal(objectMap) +} + +// ConnectionMonitorSource describes the source of connection monitor. +type ConnectionMonitorSource struct { + // ResourceID - The ID of the resource used as the source by connection monitor. + ResourceID *string `json:"resourceId,omitempty"` + // Port - The source port used by connection monitor. + Port *int32 `json:"port,omitempty"` +} + +// ConnectionMonitorSuccessThreshold describes the threshold for declaring a test successful. +type ConnectionMonitorSuccessThreshold struct { + // ChecksFailedPercent - The maximum percentage of failed checks permitted for a test to evaluate as successful. + ChecksFailedPercent *int32 `json:"checksFailedPercent,omitempty"` + // RoundTripTimeMs - The maximum round-trip time in milliseconds permitted for a test to evaluate as successful. + RoundTripTimeMs *float64 `json:"roundTripTimeMs,omitempty"` +} + +// ConnectionMonitorTCPConfiguration describes the TCP configuration. +type ConnectionMonitorTCPConfiguration struct { + // Port - The port to connect to. + Port *int32 `json:"port,omitempty"` + // DisableTraceRoute - Value indicating whether path evaluation with trace route should be disabled. + DisableTraceRoute *bool `json:"disableTraceRoute,omitempty"` + // DestinationPortBehavior - Destination port behavior. Possible values include: 'DestinationPortBehaviorNone', 'DestinationPortBehaviorListenIfAvailable' + DestinationPortBehavior DestinationPortBehavior `json:"destinationPortBehavior,omitempty"` +} + +// ConnectionMonitorTestConfiguration describes a connection monitor test configuration. +type ConnectionMonitorTestConfiguration struct { + // Name - The name of the connection monitor test configuration. + Name *string `json:"name,omitempty"` + // TestFrequencySec - The frequency of test evaluation, in seconds. + TestFrequencySec *int32 `json:"testFrequencySec,omitempty"` + // Protocol - The protocol to use in test evaluation. Possible values include: 'ConnectionMonitorTestConfigurationProtocolTCP', 'ConnectionMonitorTestConfigurationProtocolHTTP', 'ConnectionMonitorTestConfigurationProtocolIcmp' + Protocol ConnectionMonitorTestConfigurationProtocol `json:"protocol,omitempty"` + // PreferredIPVersion - The preferred IP version to use in test evaluation. The connection monitor may choose to use a different version depending on other parameters. Possible values include: 'PreferredIPVersionIPv4', 'PreferredIPVersionIPv6' + PreferredIPVersion PreferredIPVersion `json:"preferredIPVersion,omitempty"` + // HTTPConfiguration - The parameters used to perform test evaluation over HTTP. + HTTPConfiguration *ConnectionMonitorHTTPConfiguration `json:"httpConfiguration,omitempty"` + // TCPConfiguration - The parameters used to perform test evaluation over TCP. + TCPConfiguration *ConnectionMonitorTCPConfiguration `json:"tcpConfiguration,omitempty"` + // IcmpConfiguration - The parameters used to perform test evaluation over ICMP. + IcmpConfiguration *ConnectionMonitorIcmpConfiguration `json:"icmpConfiguration,omitempty"` + // SuccessThreshold - The threshold for declaring a test successful. + SuccessThreshold *ConnectionMonitorSuccessThreshold `json:"successThreshold,omitempty"` +} + +// ConnectionMonitorTestGroup describes the connection monitor test group. +type ConnectionMonitorTestGroup struct { + // Name - The name of the connection monitor test group. + Name *string `json:"name,omitempty"` + // Disable - Value indicating whether test group is disabled. + Disable *bool `json:"disable,omitempty"` + // TestConfigurations - List of test configuration names. + TestConfigurations *[]string `json:"testConfigurations,omitempty"` + // Sources - List of source endpoint names. + Sources *[]string `json:"sources,omitempty"` + // Destinations - List of destination endpoint names. + Destinations *[]string `json:"destinations,omitempty"` +} + +// ConnectionMonitorWorkspaceSettings describes the settings for producing output into a log analytics +// workspace. +type ConnectionMonitorWorkspaceSettings struct { + // WorkspaceResourceID - Log analytics workspace resource ID. + WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` +} + +// ConnectionMonitorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConnectionMonitorsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConnectionMonitorsClient) (ConnectionMonitorResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConnectionMonitorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConnectionMonitorsCreateOrUpdateFuture.Result. +func (future *ConnectionMonitorsCreateOrUpdateFuture) result(client ConnectionMonitorsClient) (cmr ConnectionMonitorResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cmr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cmr.Response.Response, err = future.GetResult(sender); err == nil && cmr.Response.Response.StatusCode != http.StatusNoContent { + cmr, err = client.CreateOrUpdateResponder(cmr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsCreateOrUpdateFuture", "Result", cmr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConnectionMonitorsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConnectionMonitorsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConnectionMonitorsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConnectionMonitorsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConnectionMonitorsDeleteFuture.Result. +func (future *ConnectionMonitorsDeleteFuture) result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ConnectionMonitorsQueryFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConnectionMonitorsQueryFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConnectionMonitorsClient) (ConnectionMonitorQueryResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConnectionMonitorsQueryFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConnectionMonitorsQueryFuture.Result. +func (future *ConnectionMonitorsQueryFuture) result(client ConnectionMonitorsClient) (cmqr ConnectionMonitorQueryResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsQueryFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cmqr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsQueryFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cmqr.Response.Response, err = future.GetResult(sender); err == nil && cmqr.Response.Response.StatusCode != http.StatusNoContent { + cmqr, err = client.QueryResponder(cmqr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsQueryFuture", "Result", cmqr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConnectionMonitorsStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConnectionMonitorsStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConnectionMonitorsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConnectionMonitorsStartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConnectionMonitorsStartFuture.Result. +func (future *ConnectionMonitorsStartFuture) result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsStartFuture") + return + } + ar.Response = future.Response() + return +} + +// ConnectionMonitorsStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConnectionMonitorsStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConnectionMonitorsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConnectionMonitorsStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConnectionMonitorsStopFuture.Result. +func (future *ConnectionMonitorsStopFuture) result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsStopFuture") + return + } + ar.Response = future.Response() + return +} + +// ConnectionResetSharedKey the virtual network connection reset shared key. +type ConnectionResetSharedKey struct { + autorest.Response `json:"-"` + // KeyLength - The virtual network connection reset shared key length, should between 1 and 128. + KeyLength *int32 `json:"keyLength,omitempty"` +} + +// ConnectionSharedKey response for GetConnectionSharedKey API service call. +type ConnectionSharedKey struct { + autorest.Response `json:"-"` + // Value - The virtual network connection shared key value. + Value *string `json:"value,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// ConnectionStateSnapshot connection state snapshot. +type ConnectionStateSnapshot struct { + // ConnectionState - The connection state. Possible values include: 'ConnectionStateReachable', 'ConnectionStateUnreachable', 'ConnectionStateUnknown' + ConnectionState ConnectionState `json:"connectionState,omitempty"` + // StartTime - The start time of the connection snapshot. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - The end time of the connection snapshot. + EndTime *date.Time `json:"endTime,omitempty"` + // EvaluationState - Connectivity analysis evaluation state. Possible values include: 'EvaluationStateNotStarted', 'EvaluationStateInProgress', 'EvaluationStateCompleted' + EvaluationState EvaluationState `json:"evaluationState,omitempty"` + // AvgLatencyInMs - Average latency in ms. + AvgLatencyInMs *int64 `json:"avgLatencyInMs,omitempty"` + // MinLatencyInMs - Minimum latency in ms. + MinLatencyInMs *int64 `json:"minLatencyInMs,omitempty"` + // MaxLatencyInMs - Maximum latency in ms. + MaxLatencyInMs *int64 `json:"maxLatencyInMs,omitempty"` + // ProbesSent - The number of sent probes. + ProbesSent *int64 `json:"probesSent,omitempty"` + // ProbesFailed - The number of failed probes. + ProbesFailed *int64 `json:"probesFailed,omitempty"` + // Hops - READ-ONLY; List of hops between the source and the destination. + Hops *[]ConnectivityHop `json:"hops,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionStateSnapshot. +func (CSS ConnectionStateSnapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if CSS.ConnectionState != "" { + objectMap["connectionState"] = CSS.ConnectionState + } + if CSS.StartTime != nil { + objectMap["startTime"] = CSS.StartTime + } + if CSS.EndTime != nil { + objectMap["endTime"] = CSS.EndTime + } + if CSS.EvaluationState != "" { + objectMap["evaluationState"] = CSS.EvaluationState + } + if CSS.AvgLatencyInMs != nil { + objectMap["avgLatencyInMs"] = CSS.AvgLatencyInMs + } + if CSS.MinLatencyInMs != nil { + objectMap["minLatencyInMs"] = CSS.MinLatencyInMs + } + if CSS.MaxLatencyInMs != nil { + objectMap["maxLatencyInMs"] = CSS.MaxLatencyInMs + } + if CSS.ProbesSent != nil { + objectMap["probesSent"] = CSS.ProbesSent + } + if CSS.ProbesFailed != nil { + objectMap["probesFailed"] = CSS.ProbesFailed + } + return json.Marshal(objectMap) +} + +// ConnectivityConfiguration the network manager connectivity configuration resource +type ConnectivityConfiguration struct { + autorest.Response `json:"-"` + // ConnectivityConfigurationProperties - Properties of a network manager connectivity configuration + *ConnectivityConfigurationProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectivityConfiguration. +func (cc ConnectivityConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cc.ConnectivityConfigurationProperties != nil { + objectMap["properties"] = cc.ConnectivityConfigurationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ConnectivityConfiguration struct. +func (cc *ConnectivityConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var connectivityConfigurationProperties ConnectivityConfigurationProperties + err = json.Unmarshal(*v, &connectivityConfigurationProperties) + if err != nil { + return err + } + cc.ConnectivityConfigurationProperties = &connectivityConfigurationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + cc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cc.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + cc.Etag = &etag + } + } + } + + return nil +} + +// ConnectivityConfigurationListResult result of the request to list network manager connectivity +// configurations. It contains a list of configurations and a link to get the next set of results. +type ConnectivityConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - Gets a page of Connectivity Configurations + Value *[]ConnectivityConfiguration `json:"value,omitempty"` + // NextLink - Gets the URL to get the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ConnectivityConfigurationListResultIterator provides access to a complete listing of +// ConnectivityConfiguration values. +type ConnectivityConfigurationListResultIterator struct { + i int + page ConnectivityConfigurationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ConnectivityConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectivityConfigurationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ConnectivityConfigurationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ConnectivityConfigurationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ConnectivityConfigurationListResultIterator) Response() ConnectivityConfigurationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ConnectivityConfigurationListResultIterator) Value() ConnectivityConfiguration { + if !iter.page.NotDone() { + return ConnectivityConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ConnectivityConfigurationListResultIterator type. +func NewConnectivityConfigurationListResultIterator(page ConnectivityConfigurationListResultPage) ConnectivityConfigurationListResultIterator { + return ConnectivityConfigurationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cclr ConnectivityConfigurationListResult) IsEmpty() bool { + return cclr.Value == nil || len(*cclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cclr ConnectivityConfigurationListResult) hasNextLink() bool { + return cclr.NextLink != nil && len(*cclr.NextLink) != 0 +} + +// connectivityConfigurationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cclr ConnectivityConfigurationListResult) connectivityConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !cclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cclr.NextLink))) +} + +// ConnectivityConfigurationListResultPage contains a page of ConnectivityConfiguration values. +type ConnectivityConfigurationListResultPage struct { + fn func(context.Context, ConnectivityConfigurationListResult) (ConnectivityConfigurationListResult, error) + cclr ConnectivityConfigurationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ConnectivityConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectivityConfigurationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cclr) + if err != nil { + return err + } + page.cclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ConnectivityConfigurationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ConnectivityConfigurationListResultPage) NotDone() bool { + return !page.cclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ConnectivityConfigurationListResultPage) Response() ConnectivityConfigurationListResult { + return page.cclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ConnectivityConfigurationListResultPage) Values() []ConnectivityConfiguration { + if page.cclr.IsEmpty() { + return nil + } + return *page.cclr.Value +} + +// Creates a new instance of the ConnectivityConfigurationListResultPage type. +func NewConnectivityConfigurationListResultPage(cur ConnectivityConfigurationListResult, getNextPage func(context.Context, ConnectivityConfigurationListResult) (ConnectivityConfigurationListResult, error)) ConnectivityConfigurationListResultPage { + return ConnectivityConfigurationListResultPage{ + fn: getNextPage, + cclr: cur, + } +} + +// ConnectivityConfigurationProperties properties of network manager connectivity configuration +type ConnectivityConfigurationProperties struct { + // Description - A description of the connectivity configuration. + Description *string `json:"description,omitempty"` + // ConnectivityTopology - Connectivity topology type. Possible values include: 'ConnectivityTopologyHubAndSpoke', 'ConnectivityTopologyMesh' + ConnectivityTopology ConnectivityTopology `json:"connectivityTopology,omitempty"` + // Hubs - List of hubItems + Hubs *[]Hub `json:"hubs,omitempty"` + // IsGlobal - Flag if global mesh is supported. Possible values include: 'IsGlobalFalse', 'IsGlobalTrue' + IsGlobal IsGlobal `json:"isGlobal,omitempty"` + // AppliesToGroups - Groups for configuration + AppliesToGroups *[]ConnectivityGroupItem `json:"appliesToGroups,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the connectivity configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // DeleteExistingPeering - Flag if need to remove current existing peerings. Possible values include: 'DeleteExistingPeeringFalse', 'DeleteExistingPeeringTrue' + DeleteExistingPeering DeleteExistingPeering `json:"deleteExistingPeering,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectivityConfigurationProperties. +func (ccp ConnectivityConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ccp.Description != nil { + objectMap["description"] = ccp.Description + } + if ccp.ConnectivityTopology != "" { + objectMap["connectivityTopology"] = ccp.ConnectivityTopology + } + if ccp.Hubs != nil { + objectMap["hubs"] = ccp.Hubs + } + if ccp.IsGlobal != "" { + objectMap["isGlobal"] = ccp.IsGlobal + } + if ccp.AppliesToGroups != nil { + objectMap["appliesToGroups"] = ccp.AppliesToGroups + } + if ccp.DeleteExistingPeering != "" { + objectMap["deleteExistingPeering"] = ccp.DeleteExistingPeering + } + return json.Marshal(objectMap) +} + +// ConnectivityConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConnectivityConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConnectivityConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConnectivityConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConnectivityConfigurationsDeleteFuture.Result. +func (future *ConnectivityConfigurationsDeleteFuture) result(client ConnectivityConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectivityConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ConnectivityConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ConnectivityDestination parameters that define destination of connection. +type ConnectivityDestination struct { + // ResourceID - The ID of the resource to which a connection attempt will be made. + ResourceID *string `json:"resourceId,omitempty"` + // Address - The IP address or URI the resource to which a connection attempt will be made. + Address *string `json:"address,omitempty"` + // Port - Port on which check connectivity will be performed. + Port *int32 `json:"port,omitempty"` +} + +// ConnectivityGroupItem connectivity group item. +type ConnectivityGroupItem struct { + // NetworkGroupID - Network group Id. + NetworkGroupID *string `json:"networkGroupId,omitempty"` + // UseHubGateway - Flag if need to use hub gateway. Possible values include: 'UseHubGatewayFalse', 'UseHubGatewayTrue' + UseHubGateway UseHubGateway `json:"useHubGateway,omitempty"` + // IsGlobal - Flag if global is supported. Possible values include: 'IsGlobalFalse', 'IsGlobalTrue' + IsGlobal IsGlobal `json:"isGlobal,omitempty"` + // GroupConnectivity - Group connectivity type. Possible values include: 'GroupConnectivityNone', 'GroupConnectivityDirectlyConnected' + GroupConnectivity GroupConnectivity `json:"groupConnectivity,omitempty"` +} + +// ConnectivityHop information about a hop between the source and the destination. +type ConnectivityHop struct { + // Type - READ-ONLY; The type of the hop. + Type *string `json:"type,omitempty"` + // ID - READ-ONLY; The ID of the hop. + ID *string `json:"id,omitempty"` + // Address - READ-ONLY; The IP address of the hop. + Address *string `json:"address,omitempty"` + // ResourceID - READ-ONLY; The ID of the resource corresponding to this hop. + ResourceID *string `json:"resourceId,omitempty"` + // NextHopIds - READ-ONLY; List of next hop identifiers. + NextHopIds *[]string `json:"nextHopIds,omitempty"` + // PreviousHopIds - READ-ONLY; List of previous hop identifiers. + PreviousHopIds *[]string `json:"previousHopIds,omitempty"` + // Links - READ-ONLY; List of hop links. + Links *[]HopLink `json:"links,omitempty"` + // PreviousLinks - READ-ONLY; List of previous hop links. + PreviousLinks *[]HopLink `json:"previousLinks,omitempty"` + // Issues - READ-ONLY; List of issues. + Issues *[]ConnectivityIssue `json:"issues,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectivityHop. +func (ch ConnectivityHop) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ConnectivityInformation information on the connectivity status. +type ConnectivityInformation struct { + autorest.Response `json:"-"` + // Hops - READ-ONLY; List of hops between the source and the destination. + Hops *[]ConnectivityHop `json:"hops,omitempty"` + // ConnectionStatus - READ-ONLY; The connection status. Possible values include: 'ConnectionStatusUnknown', 'ConnectionStatusConnected', 'ConnectionStatusDisconnected', 'ConnectionStatusDegraded' + ConnectionStatus ConnectionStatus `json:"connectionStatus,omitempty"` + // AvgLatencyInMs - READ-ONLY; Average latency in milliseconds. + AvgLatencyInMs *int32 `json:"avgLatencyInMs,omitempty"` + // MinLatencyInMs - READ-ONLY; Minimum latency in milliseconds. + MinLatencyInMs *int32 `json:"minLatencyInMs,omitempty"` + // MaxLatencyInMs - READ-ONLY; Maximum latency in milliseconds. + MaxLatencyInMs *int32 `json:"maxLatencyInMs,omitempty"` + // ProbesSent - READ-ONLY; Total number of probes sent. + ProbesSent *int32 `json:"probesSent,omitempty"` + // ProbesFailed - READ-ONLY; Number of failed probes. + ProbesFailed *int32 `json:"probesFailed,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectivityInformation. +func (ci ConnectivityInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ConnectivityIssue information about an issue encountered in the process of checking for connectivity. +type ConnectivityIssue struct { + // Origin - READ-ONLY; The origin of the issue. Possible values include: 'OriginLocal', 'OriginInbound', 'OriginOutbound' + Origin Origin `json:"origin,omitempty"` + // Severity - READ-ONLY; The severity of the issue. Possible values include: 'SeverityError', 'SeverityWarning' + Severity Severity `json:"severity,omitempty"` + // Type - READ-ONLY; The type of issue. Possible values include: 'IssueTypeUnknown', 'IssueTypeAgentStopped', 'IssueTypeGuestFirewall', 'IssueTypeDNSResolution', 'IssueTypeSocketBind', 'IssueTypeNetworkSecurityRule', 'IssueTypeUserDefinedRoute', 'IssueTypePortThrottled', 'IssueTypePlatform' + Type IssueType `json:"type,omitempty"` + // Context - READ-ONLY; Provides additional context on the issue. + Context *[]map[string]*string `json:"context,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectivityIssue. +func (ci ConnectivityIssue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ConnectivityParameters parameters that determine how the connectivity check will be performed. +type ConnectivityParameters struct { + // Source - The source of the connection. + Source *ConnectivitySource `json:"source,omitempty"` + // Destination - The destination of connection. + Destination *ConnectivityDestination `json:"destination,omitempty"` + // Protocol - Network protocol. Possible values include: 'ProtocolTCP', 'ProtocolHTTP', 'ProtocolHTTPS', 'ProtocolIcmp' + Protocol Protocol `json:"protocol,omitempty"` + // ProtocolConfiguration - Configuration of the protocol. + ProtocolConfiguration *ProtocolConfiguration `json:"protocolConfiguration,omitempty"` + // PreferredIPVersion - Preferred IP version of the connection. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' + PreferredIPVersion IPVersion `json:"preferredIPVersion,omitempty"` +} + +// ConnectivitySource parameters that define the source of the connection. +type ConnectivitySource struct { + // ResourceID - The ID of the resource from which a connectivity check will be initiated. + ResourceID *string `json:"resourceId,omitempty"` + // Port - The source port from which a connectivity check will be performed. + Port *int32 `json:"port,omitempty"` +} + +// Container reference to container resource in remote resource provider. +type Container struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// ContainerNetworkInterface container network interface child resource. +type ContainerNetworkInterface struct { + // ContainerNetworkInterfacePropertiesFormat - Container network interface properties. + *ContainerNetworkInterfacePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Sub Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerNetworkInterface. +func (cni ContainerNetworkInterface) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cni.ContainerNetworkInterfacePropertiesFormat != nil { + objectMap["properties"] = cni.ContainerNetworkInterfacePropertiesFormat + } + if cni.Name != nil { + objectMap["name"] = cni.Name + } + if cni.ID != nil { + objectMap["id"] = cni.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ContainerNetworkInterface struct. +func (cni *ContainerNetworkInterface) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var containerNetworkInterfacePropertiesFormat ContainerNetworkInterfacePropertiesFormat + err = json.Unmarshal(*v, &containerNetworkInterfacePropertiesFormat) + if err != nil { + return err + } + cni.ContainerNetworkInterfacePropertiesFormat = &containerNetworkInterfacePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cni.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cni.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + cni.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cni.ID = &ID + } + } + } + + return nil +} + +// ContainerNetworkInterfaceConfiguration container network interface configuration child resource. +type ContainerNetworkInterfaceConfiguration struct { + // ContainerNetworkInterfaceConfigurationPropertiesFormat - Container network interface configuration properties. + *ContainerNetworkInterfaceConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Sub Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerNetworkInterfaceConfiguration. +func (cnic ContainerNetworkInterfaceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cnic.ContainerNetworkInterfaceConfigurationPropertiesFormat != nil { + objectMap["properties"] = cnic.ContainerNetworkInterfaceConfigurationPropertiesFormat + } + if cnic.Name != nil { + objectMap["name"] = cnic.Name + } + if cnic.ID != nil { + objectMap["id"] = cnic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ContainerNetworkInterfaceConfiguration struct. +func (cnic *ContainerNetworkInterfaceConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var containerNetworkInterfaceConfigurationPropertiesFormat ContainerNetworkInterfaceConfigurationPropertiesFormat + err = json.Unmarshal(*v, &containerNetworkInterfaceConfigurationPropertiesFormat) + if err != nil { + return err + } + cnic.ContainerNetworkInterfaceConfigurationPropertiesFormat = &containerNetworkInterfaceConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cnic.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cnic.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + cnic.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cnic.ID = &ID + } + } + } + + return nil +} + +// ContainerNetworkInterfaceConfigurationPropertiesFormat container network interface configuration +// properties. +type ContainerNetworkInterfaceConfigurationPropertiesFormat struct { + // IPConfigurations - A list of ip configurations of the container network interface configuration. + IPConfigurations *[]IPConfigurationProfile `json:"ipConfigurations,omitempty"` + // ContainerNetworkInterfaces - A list of container network interfaces created from this container network interface configuration. + ContainerNetworkInterfaces *[]SubResource `json:"containerNetworkInterfaces,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the container network interface configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerNetworkInterfaceConfigurationPropertiesFormat. +func (cnicpf ContainerNetworkInterfaceConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cnicpf.IPConfigurations != nil { + objectMap["ipConfigurations"] = cnicpf.IPConfigurations + } + if cnicpf.ContainerNetworkInterfaces != nil { + objectMap["containerNetworkInterfaces"] = cnicpf.ContainerNetworkInterfaces + } + return json.Marshal(objectMap) +} + +// ContainerNetworkInterfaceIPConfiguration the ip configuration for a container network interface. +type ContainerNetworkInterfaceIPConfiguration struct { + // ContainerNetworkInterfaceIPConfigurationPropertiesFormat - Properties of the container network interface IP configuration. + *ContainerNetworkInterfaceIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Sub Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerNetworkInterfaceIPConfiguration. +func (cniic ContainerNetworkInterfaceIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cniic.ContainerNetworkInterfaceIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = cniic.ContainerNetworkInterfaceIPConfigurationPropertiesFormat + } + if cniic.Name != nil { + objectMap["name"] = cniic.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ContainerNetworkInterfaceIPConfiguration struct. +func (cniic *ContainerNetworkInterfaceIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var containerNetworkInterfaceIPConfigurationPropertiesFormat ContainerNetworkInterfaceIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &containerNetworkInterfaceIPConfigurationPropertiesFormat) + if err != nil { + return err + } + cniic.ContainerNetworkInterfaceIPConfigurationPropertiesFormat = &containerNetworkInterfaceIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cniic.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cniic.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + cniic.Etag = &etag + } + } + } + + return nil +} + +// ContainerNetworkInterfaceIPConfigurationPropertiesFormat properties of the container network interface +// IP configuration. +type ContainerNetworkInterfaceIPConfigurationPropertiesFormat struct { + // ProvisioningState - READ-ONLY; The provisioning state of the container network interface IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerNetworkInterfaceIPConfigurationPropertiesFormat. +func (cniicpf ContainerNetworkInterfaceIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ContainerNetworkInterfacePropertiesFormat properties of container network interface. +type ContainerNetworkInterfacePropertiesFormat struct { + // ContainerNetworkInterfaceConfiguration - READ-ONLY; Container network interface configuration from which this container network interface is created. + ContainerNetworkInterfaceConfiguration *ContainerNetworkInterfaceConfiguration `json:"containerNetworkInterfaceConfiguration,omitempty"` + // Container - Reference to the container to which this container network interface is attached. + Container *Container `json:"container,omitempty"` + // IPConfigurations - READ-ONLY; Reference to the ip configuration on this container nic. + IPConfigurations *[]ContainerNetworkInterfaceIPConfiguration `json:"ipConfigurations,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the container network interface resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerNetworkInterfacePropertiesFormat. +func (cnipf ContainerNetworkInterfacePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cnipf.Container != nil { + objectMap["container"] = cnipf.Container + } + return json.Marshal(objectMap) +} + +// Criterion a matching criteria which matches routes based on route prefix, community, and AS path. +type Criterion struct { + // RoutePrefix - List of route prefixes which this criteria matches. + RoutePrefix *[]string `json:"routePrefix,omitempty"` + // Community - List of BGP communities which this criteria matches. + Community *[]string `json:"community,omitempty"` + // AsPath - List of AS paths which this criteria matches. + AsPath *[]string `json:"asPath,omitempty"` + // MatchCondition - Match condition to apply RouteMap rules. Possible values include: 'RouteMapMatchConditionUnknown', 'RouteMapMatchConditionContains', 'RouteMapMatchConditionEquals', 'RouteMapMatchConditionNotContains', 'RouteMapMatchConditionNotEquals' + MatchCondition RouteMapMatchCondition `json:"matchCondition,omitempty"` +} + +// CrossTenantScopes cross tenant scopes. +type CrossTenantScopes struct { + // TenantID - READ-ONLY; Tenant ID. + TenantID *string `json:"tenantId,omitempty"` + // ManagementGroups - READ-ONLY; List of management groups. + ManagementGroups *[]string `json:"managementGroups,omitempty"` + // Subscriptions - READ-ONLY; List of subscriptions. + Subscriptions *[]string `json:"subscriptions,omitempty"` +} + +// MarshalJSON is the custom marshaler for CrossTenantScopes. +func (cts CrossTenantScopes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CustomDNSConfigPropertiesFormat contains custom Dns resolution configuration from customer. +type CustomDNSConfigPropertiesFormat struct { + // Fqdn - Fqdn that resolves to private endpoint ip address. + Fqdn *string `json:"fqdn,omitempty"` + // IPAddresses - A list of private ip addresses of the private endpoint. + IPAddresses *[]string `json:"ipAddresses,omitempty"` +} + +// CustomIPPrefix custom IP prefix resource. +type CustomIPPrefix struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the custom IP prefix. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // CustomIPPrefixPropertiesFormat - Custom IP prefix properties. + *CustomIPPrefixPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Zones - A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones *[]string `json:"zones,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for CustomIPPrefix. +func (cip CustomIPPrefix) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cip.ExtendedLocation != nil { + objectMap["extendedLocation"] = cip.ExtendedLocation + } + if cip.CustomIPPrefixPropertiesFormat != nil { + objectMap["properties"] = cip.CustomIPPrefixPropertiesFormat + } + if cip.Zones != nil { + objectMap["zones"] = cip.Zones + } + if cip.ID != nil { + objectMap["id"] = cip.ID + } + if cip.Location != nil { + objectMap["location"] = cip.Location + } + if cip.Tags != nil { + objectMap["tags"] = cip.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CustomIPPrefix struct. +func (cip *CustomIPPrefix) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + cip.ExtendedLocation = &extendedLocation + } + case "properties": + if v != nil { + var customIPPrefixPropertiesFormat CustomIPPrefixPropertiesFormat + err = json.Unmarshal(*v, &customIPPrefixPropertiesFormat) + if err != nil { + return err + } + cip.CustomIPPrefixPropertiesFormat = &customIPPrefixPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + cip.Etag = &etag + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + cip.Zones = &zones + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cip.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cip.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cip.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + cip.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cip.Tags = tags + } + } + } + + return nil +} + +// CustomIPPrefixListResult response for ListCustomIpPrefixes API service call. +type CustomIPPrefixListResult struct { + autorest.Response `json:"-"` + // Value - A list of Custom IP prefixes that exists in a resource group. + Value *[]CustomIPPrefix `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// CustomIPPrefixListResultIterator provides access to a complete listing of CustomIPPrefix values. +type CustomIPPrefixListResultIterator struct { + i int + page CustomIPPrefixListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CustomIPPrefixListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomIPPrefixListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CustomIPPrefixListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CustomIPPrefixListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CustomIPPrefixListResultIterator) Response() CustomIPPrefixListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CustomIPPrefixListResultIterator) Value() CustomIPPrefix { + if !iter.page.NotDone() { + return CustomIPPrefix{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CustomIPPrefixListResultIterator type. +func NewCustomIPPrefixListResultIterator(page CustomIPPrefixListResultPage) CustomIPPrefixListResultIterator { + return CustomIPPrefixListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ciplr CustomIPPrefixListResult) IsEmpty() bool { + return ciplr.Value == nil || len(*ciplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ciplr CustomIPPrefixListResult) hasNextLink() bool { + return ciplr.NextLink != nil && len(*ciplr.NextLink) != 0 +} + +// customIPPrefixListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ciplr CustomIPPrefixListResult) customIPPrefixListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ciplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ciplr.NextLink))) +} + +// CustomIPPrefixListResultPage contains a page of CustomIPPrefix values. +type CustomIPPrefixListResultPage struct { + fn func(context.Context, CustomIPPrefixListResult) (CustomIPPrefixListResult, error) + ciplr CustomIPPrefixListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CustomIPPrefixListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomIPPrefixListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ciplr) + if err != nil { + return err + } + page.ciplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CustomIPPrefixListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CustomIPPrefixListResultPage) NotDone() bool { + return !page.ciplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CustomIPPrefixListResultPage) Response() CustomIPPrefixListResult { + return page.ciplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CustomIPPrefixListResultPage) Values() []CustomIPPrefix { + if page.ciplr.IsEmpty() { + return nil + } + return *page.ciplr.Value +} + +// Creates a new instance of the CustomIPPrefixListResultPage type. +func NewCustomIPPrefixListResultPage(cur CustomIPPrefixListResult, getNextPage func(context.Context, CustomIPPrefixListResult) (CustomIPPrefixListResult, error)) CustomIPPrefixListResultPage { + return CustomIPPrefixListResultPage{ + fn: getNextPage, + ciplr: cur, + } +} + +// CustomIPPrefixPropertiesFormat custom IP prefix properties. +type CustomIPPrefixPropertiesFormat struct { + // Asn - The ASN for CIDR advertising. Should be an integer as string. + Asn *string `json:"asn,omitempty"` + // Cidr - The prefix range in CIDR notation. Should include the start address and the prefix length. + Cidr *string `json:"cidr,omitempty"` + // SignedMessage - Signed message for WAN validation. + SignedMessage *string `json:"signedMessage,omitempty"` + // AuthorizationMessage - Authorization message for WAN validation. + AuthorizationMessage *string `json:"authorizationMessage,omitempty"` + // CustomIPPrefixParent - The Parent CustomIpPrefix for IPv6 /64 CustomIpPrefix. + CustomIPPrefixParent *SubResource `json:"customIpPrefixParent,omitempty"` + // ChildCustomIPPrefixes - READ-ONLY; The list of all Children for IPv6 /48 CustomIpPrefix. + ChildCustomIPPrefixes *[]SubResource `json:"childCustomIpPrefixes,omitempty"` + // CommissionedState - The commissioned state of the Custom IP Prefix. Possible values include: 'CommissionedStateProvisioning', 'CommissionedStateProvisioned', 'CommissionedStateCommissioning', 'CommissionedStateCommissionedNoInternetAdvertise', 'CommissionedStateCommissioned', 'CommissionedStateDecommissioning', 'CommissionedStateDeprovisioning', 'CommissionedStateDeprovisioned' + CommissionedState CommissionedState `json:"commissionedState,omitempty"` + // ExpressRouteAdvertise - Whether to do express route advertise. + ExpressRouteAdvertise *bool `json:"expressRouteAdvertise,omitempty"` + // Geo - The Geo for CIDR advertising. Should be an Geo code. Possible values include: 'GeoGLOBAL', 'GeoAFRI', 'GeoAPAC', 'GeoEURO', 'GeoLATAM', 'GeoNAM', 'GeoME', 'GeoOCEANIA', 'GeoAQ' + Geo Geo `json:"geo,omitempty"` + // NoInternetAdvertise - Whether to Advertise the range to Internet. + NoInternetAdvertise *bool `json:"noInternetAdvertise,omitempty"` + // PrefixType - Type of custom IP prefix. Should be Singular, Parent, or Child. Possible values include: 'CustomIPPrefixTypeSingular', 'CustomIPPrefixTypeParent', 'CustomIPPrefixTypeChild' + PrefixType CustomIPPrefixType `json:"prefixType,omitempty"` + // PublicIPPrefixes - READ-ONLY; The list of all referenced PublicIpPrefixes. + PublicIPPrefixes *[]SubResource `json:"publicIpPrefixes,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the custom IP prefix resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // FailedReason - READ-ONLY; The reason why resource is in failed state. + FailedReason *string `json:"failedReason,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the custom IP prefix resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomIPPrefixPropertiesFormat. +func (cippf CustomIPPrefixPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cippf.Asn != nil { + objectMap["asn"] = cippf.Asn + } + if cippf.Cidr != nil { + objectMap["cidr"] = cippf.Cidr + } + if cippf.SignedMessage != nil { + objectMap["signedMessage"] = cippf.SignedMessage + } + if cippf.AuthorizationMessage != nil { + objectMap["authorizationMessage"] = cippf.AuthorizationMessage + } + if cippf.CustomIPPrefixParent != nil { + objectMap["customIpPrefixParent"] = cippf.CustomIPPrefixParent + } + if cippf.CommissionedState != "" { + objectMap["commissionedState"] = cippf.CommissionedState + } + if cippf.ExpressRouteAdvertise != nil { + objectMap["expressRouteAdvertise"] = cippf.ExpressRouteAdvertise + } + if cippf.Geo != "" { + objectMap["geo"] = cippf.Geo + } + if cippf.NoInternetAdvertise != nil { + objectMap["noInternetAdvertise"] = cippf.NoInternetAdvertise + } + if cippf.PrefixType != "" { + objectMap["prefixType"] = cippf.PrefixType + } + return json.Marshal(objectMap) +} + +// CustomIPPrefixesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type CustomIPPrefixesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomIPPrefixesClient) (CustomIPPrefix, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomIPPrefixesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CustomIPPrefixesCreateOrUpdateFuture.Result. +func (future *CustomIPPrefixesCreateOrUpdateFuture) result(client CustomIPPrefixesClient) (cip CustomIPPrefix, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cip.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.CustomIPPrefixesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cip.Response.Response, err = future.GetResult(sender); err == nil && cip.Response.Response.StatusCode != http.StatusNoContent { + cip, err = client.CreateOrUpdateResponder(cip.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesCreateOrUpdateFuture", "Result", cip.Response.Response, "Failure responding to request") + } + } + return +} + +// CustomIPPrefixesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CustomIPPrefixesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomIPPrefixesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomIPPrefixesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CustomIPPrefixesDeleteFuture.Result. +func (future *CustomIPPrefixesDeleteFuture) result(client CustomIPPrefixesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.CustomIPPrefixesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DNSNameAvailabilityResult response for the CheckDnsNameAvailability API service call. +type DNSNameAvailabilityResult struct { + autorest.Response `json:"-"` + // Available - Domain availability (True/False). + Available *bool `json:"available,omitempty"` +} + +// DNSSettings DNS Proxy Settings in Firewall Policy. +type DNSSettings struct { + // Servers - List of Custom DNS Servers. + Servers *[]string `json:"servers,omitempty"` + // EnableProxy - Enable DNS Proxy on Firewalls attached to the Firewall Policy. + EnableProxy *bool `json:"enableProxy,omitempty"` + // RequireProxyForNetworkRules - FQDNs in Network Rules are supported when set to true. + RequireProxyForNetworkRules *bool `json:"requireProxyForNetworkRules,omitempty"` +} + +// DdosCustomPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DdosCustomPoliciesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DdosCustomPoliciesClient) (DdosCustomPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DdosCustomPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DdosCustomPoliciesCreateOrUpdateFuture.Result. +func (future *DdosCustomPoliciesCreateOrUpdateFuture) result(client DdosCustomPoliciesClient) (dcp DdosCustomPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dcp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.DdosCustomPoliciesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dcp.Response.Response, err = future.GetResult(sender); err == nil && dcp.Response.Response.StatusCode != http.StatusNoContent { + dcp, err = client.CreateOrUpdateResponder(dcp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesCreateOrUpdateFuture", "Result", dcp.Response.Response, "Failure responding to request") + } + } + return +} + +// DdosCustomPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DdosCustomPoliciesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DdosCustomPoliciesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DdosCustomPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DdosCustomPoliciesDeleteFuture.Result. +func (future *DdosCustomPoliciesDeleteFuture) result(client DdosCustomPoliciesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.DdosCustomPoliciesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DdosCustomPolicy a DDoS custom policy in a resource group. +type DdosCustomPolicy struct { + autorest.Response `json:"-"` + // DdosCustomPolicyPropertiesFormat - Properties of the DDoS custom policy. + *DdosCustomPolicyPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DdosCustomPolicy. +func (dcp DdosCustomPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcp.DdosCustomPolicyPropertiesFormat != nil { + objectMap["properties"] = dcp.DdosCustomPolicyPropertiesFormat + } + if dcp.ID != nil { + objectMap["id"] = dcp.ID + } + if dcp.Location != nil { + objectMap["location"] = dcp.Location + } + if dcp.Tags != nil { + objectMap["tags"] = dcp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DdosCustomPolicy struct. +func (dcp *DdosCustomPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var ddosCustomPolicyPropertiesFormat DdosCustomPolicyPropertiesFormat + err = json.Unmarshal(*v, &ddosCustomPolicyPropertiesFormat) + if err != nil { + return err + } + dcp.DdosCustomPolicyPropertiesFormat = &ddosCustomPolicyPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + dcp.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dcp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dcp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dcp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dcp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dcp.Tags = tags + } + } + } + + return nil +} + +// DdosCustomPolicyPropertiesFormat dDoS custom policy properties. +type DdosCustomPolicyPropertiesFormat struct { + // ResourceGUID - READ-ONLY; 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. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the DDoS custom policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for DdosCustomPolicyPropertiesFormat. +func (dcppf DdosCustomPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DdosProtectionPlan a DDoS protection plan in a resource group. +type DdosProtectionPlan struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // DdosProtectionPlanPropertiesFormat - Properties of the DDoS protection plan. + *DdosProtectionPlanPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for DdosProtectionPlan. +func (dpp DdosProtectionPlan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dpp.Location != nil { + objectMap["location"] = dpp.Location + } + if dpp.Tags != nil { + objectMap["tags"] = dpp.Tags + } + if dpp.DdosProtectionPlanPropertiesFormat != nil { + objectMap["properties"] = dpp.DdosProtectionPlanPropertiesFormat + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DdosProtectionPlan struct. +func (dpp *DdosProtectionPlan) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dpp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dpp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dpp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dpp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dpp.Tags = tags + } + case "properties": + if v != nil { + var ddosProtectionPlanPropertiesFormat DdosProtectionPlanPropertiesFormat + err = json.Unmarshal(*v, &ddosProtectionPlanPropertiesFormat) + if err != nil { + return err + } + dpp.DdosProtectionPlanPropertiesFormat = &ddosProtectionPlanPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + dpp.Etag = &etag + } + } + } + + return nil +} + +// DdosProtectionPlanListResult a list of DDoS protection plans. +type DdosProtectionPlanListResult struct { + autorest.Response `json:"-"` + // Value - A list of DDoS protection plans. + Value *[]DdosProtectionPlan `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DdosProtectionPlanListResult. +func (dpplr DdosProtectionPlanListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dpplr.Value != nil { + objectMap["value"] = dpplr.Value + } + return json.Marshal(objectMap) +} + +// DdosProtectionPlanListResultIterator provides access to a complete listing of DdosProtectionPlan values. +type DdosProtectionPlanListResultIterator struct { + i int + page DdosProtectionPlanListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DdosProtectionPlanListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosProtectionPlanListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DdosProtectionPlanListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DdosProtectionPlanListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DdosProtectionPlanListResultIterator) Response() DdosProtectionPlanListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DdosProtectionPlanListResultIterator) Value() DdosProtectionPlan { + if !iter.page.NotDone() { + return DdosProtectionPlan{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DdosProtectionPlanListResultIterator type. +func NewDdosProtectionPlanListResultIterator(page DdosProtectionPlanListResultPage) DdosProtectionPlanListResultIterator { + return DdosProtectionPlanListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dpplr DdosProtectionPlanListResult) IsEmpty() bool { + return dpplr.Value == nil || len(*dpplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dpplr DdosProtectionPlanListResult) hasNextLink() bool { + return dpplr.NextLink != nil && len(*dpplr.NextLink) != 0 +} + +// ddosProtectionPlanListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dpplr DdosProtectionPlanListResult) ddosProtectionPlanListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dpplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dpplr.NextLink))) +} + +// DdosProtectionPlanListResultPage contains a page of DdosProtectionPlan values. +type DdosProtectionPlanListResultPage struct { + fn func(context.Context, DdosProtectionPlanListResult) (DdosProtectionPlanListResult, error) + dpplr DdosProtectionPlanListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DdosProtectionPlanListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosProtectionPlanListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dpplr) + if err != nil { + return err + } + page.dpplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DdosProtectionPlanListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DdosProtectionPlanListResultPage) NotDone() bool { + return !page.dpplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DdosProtectionPlanListResultPage) Response() DdosProtectionPlanListResult { + return page.dpplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DdosProtectionPlanListResultPage) Values() []DdosProtectionPlan { + if page.dpplr.IsEmpty() { + return nil + } + return *page.dpplr.Value +} + +// Creates a new instance of the DdosProtectionPlanListResultPage type. +func NewDdosProtectionPlanListResultPage(cur DdosProtectionPlanListResult, getNextPage func(context.Context, DdosProtectionPlanListResult) (DdosProtectionPlanListResult, error)) DdosProtectionPlanListResultPage { + return DdosProtectionPlanListResultPage{ + fn: getNextPage, + dpplr: cur, + } +} + +// DdosProtectionPlanPropertiesFormat dDoS protection plan properties. +type DdosProtectionPlanPropertiesFormat struct { + // ResourceGUID - READ-ONLY; 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. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the DDoS protection plan resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PublicIPAddresses - READ-ONLY; The list of public IPs associated with the DDoS protection plan resource. This list is read-only. + PublicIPAddresses *[]SubResource `json:"publicIPAddresses,omitempty"` + // VirtualNetworks - READ-ONLY; The list of virtual networks associated with the DDoS protection plan resource. This list is read-only. + VirtualNetworks *[]SubResource `json:"virtualNetworks,omitempty"` +} + +// MarshalJSON is the custom marshaler for DdosProtectionPlanPropertiesFormat. +func (dpppf DdosProtectionPlanPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DdosProtectionPlansCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DdosProtectionPlansCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DdosProtectionPlansClient) (DdosProtectionPlan, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DdosProtectionPlansCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DdosProtectionPlansCreateOrUpdateFuture.Result. +func (future *DdosProtectionPlansCreateOrUpdateFuture) result(client DdosProtectionPlansClient) (dpp DdosProtectionPlan, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dpp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.DdosProtectionPlansCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dpp.Response.Response, err = future.GetResult(sender); err == nil && dpp.Response.Response.StatusCode != http.StatusNoContent { + dpp, err = client.CreateOrUpdateResponder(dpp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansCreateOrUpdateFuture", "Result", dpp.Response.Response, "Failure responding to request") + } + } + return +} + +// DdosProtectionPlansDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DdosProtectionPlansDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DdosProtectionPlansClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DdosProtectionPlansDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DdosProtectionPlansDeleteFuture.Result. +func (future *DdosProtectionPlansDeleteFuture) result(client DdosProtectionPlansClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.DdosProtectionPlansDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DdosSettings contains the DDoS protection settings of the public IP. +type DdosSettings struct { + // ProtectionMode - The DDoS protection mode of the public IP. Possible values include: 'DdosSettingsProtectionModeVirtualNetworkInherited', 'DdosSettingsProtectionModeEnabled', 'DdosSettingsProtectionModeDisabled' + ProtectionMode DdosSettingsProtectionMode `json:"protectionMode,omitempty"` + // DdosProtectionPlan - The DDoS protection plan associated with the public IP. Can only be set if ProtectionMode is Enabled + DdosProtectionPlan *SubResource `json:"ddosProtectionPlan,omitempty"` +} + +// DefaultAdminPropertiesFormat security default admin rule resource. +type DefaultAdminPropertiesFormat struct { + // Description - READ-ONLY; A description for this rule. Restricted to 140 chars. + Description *string `json:"description,omitempty"` + // Flag - Default rule flag. + Flag *string `json:"flag,omitempty"` + // Protocol - READ-ONLY; Network protocol this rule applies to. Possible values include: 'SecurityConfigurationRuleProtocolTCP', 'SecurityConfigurationRuleProtocolUDP', 'SecurityConfigurationRuleProtocolIcmp', 'SecurityConfigurationRuleProtocolEsp', 'SecurityConfigurationRuleProtocolAny', 'SecurityConfigurationRuleProtocolAh' + Protocol SecurityConfigurationRuleProtocol `json:"protocol,omitempty"` + // Sources - READ-ONLY; The CIDR or source IP ranges. + Sources *[]AddressPrefixItem `json:"sources,omitempty"` + // Destinations - READ-ONLY; The destination address prefixes. CIDR or destination IP ranges. + Destinations *[]AddressPrefixItem `json:"destinations,omitempty"` + // SourcePortRanges - READ-ONLY; The source port ranges. + SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` + // DestinationPortRanges - READ-ONLY; The destination port ranges. + DestinationPortRanges *[]string `json:"destinationPortRanges,omitempty"` + // Access - READ-ONLY; Indicates the access allowed for this particular rule. Possible values include: 'SecurityConfigurationRuleAccessAllow', 'SecurityConfigurationRuleAccessDeny', 'SecurityConfigurationRuleAccessAlwaysAllow' + Access SecurityConfigurationRuleAccess `json:"access,omitempty"` + // Priority - READ-ONLY; The priority of the rule. The value can be between 1 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. + Priority *int32 `json:"priority,omitempty"` + // Direction - READ-ONLY; Indicates if the traffic matched against the rule in inbound or outbound. Possible values include: 'SecurityConfigurationRuleDirectionInbound', 'SecurityConfigurationRuleDirectionOutbound' + Direction SecurityConfigurationRuleDirection `json:"direction,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for DefaultAdminPropertiesFormat. +func (dapf DefaultAdminPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dapf.Flag != nil { + objectMap["flag"] = dapf.Flag + } + return json.Marshal(objectMap) +} + +// DefaultAdminRule network default admin rule. +type DefaultAdminRule struct { + // DefaultAdminPropertiesFormat - Indicates the properties of the security admin rule + *DefaultAdminPropertiesFormat `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindBasicBaseAdminRuleKindBaseAdminRule', 'KindBasicBaseAdminRuleKindCustom', 'KindBasicBaseAdminRuleKindDefault' + Kind KindBasicBaseAdminRule `json:"kind,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for DefaultAdminRule. +func (dar DefaultAdminRule) MarshalJSON() ([]byte, error) { + dar.Kind = KindBasicBaseAdminRuleKindDefault + objectMap := make(map[string]interface{}) + if dar.DefaultAdminPropertiesFormat != nil { + objectMap["properties"] = dar.DefaultAdminPropertiesFormat + } + if dar.Kind != "" { + objectMap["kind"] = dar.Kind + } + return json.Marshal(objectMap) +} + +// AsAdminRule is the BasicBaseAdminRule implementation for DefaultAdminRule. +func (dar DefaultAdminRule) AsAdminRule() (*AdminRule, bool) { + return nil, false +} + +// AsDefaultAdminRule is the BasicBaseAdminRule implementation for DefaultAdminRule. +func (dar DefaultAdminRule) AsDefaultAdminRule() (*DefaultAdminRule, bool) { + return &dar, true +} + +// AsBaseAdminRule is the BasicBaseAdminRule implementation for DefaultAdminRule. +func (dar DefaultAdminRule) AsBaseAdminRule() (*BaseAdminRule, bool) { + return nil, false +} + +// AsBasicBaseAdminRule is the BasicBaseAdminRule implementation for DefaultAdminRule. +func (dar DefaultAdminRule) AsBasicBaseAdminRule() (BasicBaseAdminRule, bool) { + return &dar, true +} + +// UnmarshalJSON is the custom unmarshaler for DefaultAdminRule struct. +func (dar *DefaultAdminRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var defaultAdminPropertiesFormat DefaultAdminPropertiesFormat + err = json.Unmarshal(*v, &defaultAdminPropertiesFormat) + if err != nil { + return err + } + dar.DefaultAdminPropertiesFormat = &defaultAdminPropertiesFormat + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + dar.SystemData = &systemData + } + case "kind": + if v != nil { + var kind KindBasicBaseAdminRule + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + dar.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dar.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + dar.Etag = &etag + } + } + } + + return nil +} + +// DefaultRuleSetPropertyFormat the default web application firewall rule set. +type DefaultRuleSetPropertyFormat struct { + // RuleSetType - The type of the web application firewall rule set. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - The version of the web application firewall rule set type. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` +} + +// Delegation details the service to which the subnet is delegated. +type Delegation struct { + // ServiceDelegationPropertiesFormat - Properties of the subnet. + *ServiceDelegationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a subnet. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for Delegation. +func (d Delegation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.ServiceDelegationPropertiesFormat != nil { + objectMap["properties"] = d.ServiceDelegationPropertiesFormat + } + if d.Name != nil { + objectMap["name"] = d.Name + } + if d.Type != nil { + objectMap["type"] = d.Type + } + if d.ID != nil { + objectMap["id"] = d.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Delegation struct. +func (d *Delegation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var serviceDelegationPropertiesFormat ServiceDelegationPropertiesFormat + err = json.Unmarshal(*v, &serviceDelegationPropertiesFormat) + if err != nil { + return err + } + d.ServiceDelegationPropertiesFormat = &serviceDelegationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + d.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + d.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + d.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + d.ID = &ID + } + } + } + + return nil +} + +// DelegationProperties properties of the delegation. +type DelegationProperties struct { + // ServiceName - The service name to which the NVA is delegated. + ServiceName *string `json:"serviceName,omitempty"` + // ProvisioningState - READ-ONLY; Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for DelegationProperties. +func (dp DelegationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dp.ServiceName != nil { + objectMap["serviceName"] = dp.ServiceName + } + return json.Marshal(objectMap) +} + +// DeleteBastionShareableLinkFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeleteBastionShareableLinkFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BaseClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeleteBastionShareableLinkFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeleteBastionShareableLinkFuture.Result. +func (future *DeleteBastionShareableLinkFuture) result(client BaseClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DeleteBastionShareableLinkFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.DeleteBastionShareableLinkFuture") + return + } + ar.Response = future.Response() + return +} + +// DeviceProperties list of properties of the device. +type DeviceProperties struct { + // DeviceVendor - Name of the device Vendor. + DeviceVendor *string `json:"deviceVendor,omitempty"` + // DeviceModel - Model of the device. + DeviceModel *string `json:"deviceModel,omitempty"` + // LinkSpeedInMbps - Link speed. + LinkSpeedInMbps *int32 `json:"linkSpeedInMbps,omitempty"` +} + +// DhcpOptions 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. +type DhcpOptions struct { + // DNSServers - The list of DNS servers IP addresses. + DNSServers *[]string `json:"dnsServers,omitempty"` +} + +// Dimension dimension of the metric. +type Dimension struct { + // Name - The name of the dimension. + Name *string `json:"name,omitempty"` + // DisplayName - The display name of the dimension. + DisplayName *string `json:"displayName,omitempty"` + // InternalName - The internal name of the dimension. + InternalName *string `json:"internalName,omitempty"` +} + +// DscpConfiguration differentiated Services Code Point configuration for any given network interface +type DscpConfiguration struct { + autorest.Response `json:"-"` + // DscpConfigurationPropertiesFormat - Properties of the network interface. + *DscpConfigurationPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DscpConfiguration. +func (dc DscpConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dc.DscpConfigurationPropertiesFormat != nil { + objectMap["properties"] = dc.DscpConfigurationPropertiesFormat + } + if dc.ID != nil { + objectMap["id"] = dc.ID + } + if dc.Location != nil { + objectMap["location"] = dc.Location + } + if dc.Tags != nil { + objectMap["tags"] = dc.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DscpConfiguration struct. +func (dc *DscpConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var dscpConfigurationPropertiesFormat DscpConfigurationPropertiesFormat + err = json.Unmarshal(*v, &dscpConfigurationPropertiesFormat) + if err != nil { + return err + } + dc.DscpConfigurationPropertiesFormat = &dscpConfigurationPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + dc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dc.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dc.Tags = tags + } + } + } + + return nil +} + +// DscpConfigurationCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DscpConfigurationCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DscpConfigurationClient) (DscpConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DscpConfigurationCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DscpConfigurationCreateOrUpdateFuture.Result. +func (future *DscpConfigurationCreateOrUpdateFuture) result(client DscpConfigurationClient) (dc DscpConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.DscpConfigurationCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dc.Response.Response, err = future.GetResult(sender); err == nil && dc.Response.Response.StatusCode != http.StatusNoContent { + dc, err = client.CreateOrUpdateResponder(dc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationCreateOrUpdateFuture", "Result", dc.Response.Response, "Failure responding to request") + } + } + return +} + +// DscpConfigurationDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DscpConfigurationDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DscpConfigurationClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DscpConfigurationDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DscpConfigurationDeleteFuture.Result. +func (future *DscpConfigurationDeleteFuture) result(client DscpConfigurationClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.DscpConfigurationDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DscpConfigurationListResult response for the DscpConfigurationList API service call. +type DscpConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - A list of dscp configurations in a resource group. + Value *[]DscpConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DscpConfigurationListResult. +func (dclr DscpConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dclr.Value != nil { + objectMap["value"] = dclr.Value + } + return json.Marshal(objectMap) +} + +// DscpConfigurationListResultIterator provides access to a complete listing of DscpConfiguration values. +type DscpConfigurationListResultIterator struct { + i int + page DscpConfigurationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DscpConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DscpConfigurationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DscpConfigurationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DscpConfigurationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DscpConfigurationListResultIterator) Response() DscpConfigurationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DscpConfigurationListResultIterator) Value() DscpConfiguration { + if !iter.page.NotDone() { + return DscpConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DscpConfigurationListResultIterator type. +func NewDscpConfigurationListResultIterator(page DscpConfigurationListResultPage) DscpConfigurationListResultIterator { + return DscpConfigurationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dclr DscpConfigurationListResult) IsEmpty() bool { + return dclr.Value == nil || len(*dclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dclr DscpConfigurationListResult) hasNextLink() bool { + return dclr.NextLink != nil && len(*dclr.NextLink) != 0 +} + +// dscpConfigurationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dclr DscpConfigurationListResult) dscpConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dclr.NextLink))) +} + +// DscpConfigurationListResultPage contains a page of DscpConfiguration values. +type DscpConfigurationListResultPage struct { + fn func(context.Context, DscpConfigurationListResult) (DscpConfigurationListResult, error) + dclr DscpConfigurationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DscpConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DscpConfigurationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dclr) + if err != nil { + return err + } + page.dclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DscpConfigurationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DscpConfigurationListResultPage) NotDone() bool { + return !page.dclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DscpConfigurationListResultPage) Response() DscpConfigurationListResult { + return page.dclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DscpConfigurationListResultPage) Values() []DscpConfiguration { + if page.dclr.IsEmpty() { + return nil + } + return *page.dclr.Value +} + +// Creates a new instance of the DscpConfigurationListResultPage type. +func NewDscpConfigurationListResultPage(cur DscpConfigurationListResult, getNextPage func(context.Context, DscpConfigurationListResult) (DscpConfigurationListResult, error)) DscpConfigurationListResultPage { + return DscpConfigurationListResultPage{ + fn: getNextPage, + dclr: cur, + } +} + +// DscpConfigurationPropertiesFormat differentiated Services Code Point configuration properties. +type DscpConfigurationPropertiesFormat struct { + // Markings - List of markings to be used in the configuration. + Markings *[]int32 `json:"markings,omitempty"` + // SourceIPRanges - Source IP ranges. + SourceIPRanges *[]QosIPRange `json:"sourceIpRanges,omitempty"` + // DestinationIPRanges - Destination IP ranges. + DestinationIPRanges *[]QosIPRange `json:"destinationIpRanges,omitempty"` + // SourcePortRanges - Sources port ranges. + SourcePortRanges *[]QosPortRange `json:"sourcePortRanges,omitempty"` + // DestinationPortRanges - Destination port ranges. + DestinationPortRanges *[]QosPortRange `json:"destinationPortRanges,omitempty"` + // Protocol - RNM supported protocol types. Possible values include: 'ProtocolTypeDoNotUse', 'ProtocolTypeIcmp', 'ProtocolTypeTCP', 'ProtocolTypeUDP', 'ProtocolTypeGre', 'ProtocolTypeEsp', 'ProtocolTypeAh', 'ProtocolTypeVxlan', 'ProtocolTypeAll' + Protocol ProtocolType `json:"protocol,omitempty"` + // QosDefinitionCollection - QoS object definitions + QosDefinitionCollection *[]QosDefinition `json:"qosDefinitionCollection,omitempty"` + // QosCollectionID - READ-ONLY; Qos Collection ID generated by RNM. + QosCollectionID *string `json:"qosCollectionId,omitempty"` + // AssociatedNetworkInterfaces - READ-ONLY; Associated Network Interfaces to the DSCP Configuration. + AssociatedNetworkInterfaces *[]Interface `json:"associatedNetworkInterfaces,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the DSCP Configuration resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the DSCP Configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for DscpConfigurationPropertiesFormat. +func (dcpf DscpConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcpf.Markings != nil { + objectMap["markings"] = dcpf.Markings + } + if dcpf.SourceIPRanges != nil { + objectMap["sourceIpRanges"] = dcpf.SourceIPRanges + } + if dcpf.DestinationIPRanges != nil { + objectMap["destinationIpRanges"] = dcpf.DestinationIPRanges + } + if dcpf.SourcePortRanges != nil { + objectMap["sourcePortRanges"] = dcpf.SourcePortRanges + } + if dcpf.DestinationPortRanges != nil { + objectMap["destinationPortRanges"] = dcpf.DestinationPortRanges + } + if dcpf.Protocol != "" { + objectMap["protocol"] = dcpf.Protocol + } + if dcpf.QosDefinitionCollection != nil { + objectMap["qosDefinitionCollection"] = dcpf.QosDefinitionCollection + } + return json.Marshal(objectMap) +} + +// BasicEffectiveBaseSecurityAdminRule network base admin rule. +type BasicEffectiveBaseSecurityAdminRule interface { + AsEffectiveSecurityAdminRule() (*EffectiveSecurityAdminRule, bool) + AsEffectiveDefaultSecurityAdminRule() (*EffectiveDefaultSecurityAdminRule, bool) + AsEffectiveBaseSecurityAdminRule() (*EffectiveBaseSecurityAdminRule, bool) +} + +// EffectiveBaseSecurityAdminRule network base admin rule. +type EffectiveBaseSecurityAdminRule struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // ConfigurationDescription - A description of the security admin configuration. + ConfigurationDescription *string `json:"configurationDescription,omitempty"` + // RuleCollectionDescription - A description of the rule collection. + RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` + // RuleCollectionAppliesToGroups - Groups for rule collection + RuleCollectionAppliesToGroups *[]ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` + // RuleGroups - Effective configuration groups. + RuleGroups *[]ConfigurationGroup `json:"ruleGroups,omitempty"` + // Kind - Possible values include: 'KindBasicEffectiveBaseSecurityAdminRuleKindEffectiveBaseSecurityAdminRule', 'KindBasicEffectiveBaseSecurityAdminRuleKindCustom', 'KindBasicEffectiveBaseSecurityAdminRuleKindDefault' + Kind KindBasicEffectiveBaseSecurityAdminRule `json:"kind,omitempty"` +} + +func unmarshalBasicEffectiveBaseSecurityAdminRule(body []byte) (BasicEffectiveBaseSecurityAdminRule, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBasicEffectiveBaseSecurityAdminRuleKindCustom): + var esar EffectiveSecurityAdminRule + err := json.Unmarshal(body, &esar) + return esar, err + case string(KindBasicEffectiveBaseSecurityAdminRuleKindDefault): + var edsar EffectiveDefaultSecurityAdminRule + err := json.Unmarshal(body, &edsar) + return edsar, err + default: + var ebsar EffectiveBaseSecurityAdminRule + err := json.Unmarshal(body, &ebsar) + return ebsar, err + } +} +func unmarshalBasicEffectiveBaseSecurityAdminRuleArray(body []byte) ([]BasicEffectiveBaseSecurityAdminRule, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + ebsarArray := make([]BasicEffectiveBaseSecurityAdminRule, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ebsar, err := unmarshalBasicEffectiveBaseSecurityAdminRule(*rawMessage) + if err != nil { + return nil, err + } + ebsarArray[index] = ebsar + } + return ebsarArray, nil +} + +// MarshalJSON is the custom marshaler for EffectiveBaseSecurityAdminRule. +func (ebsar EffectiveBaseSecurityAdminRule) MarshalJSON() ([]byte, error) { + ebsar.Kind = KindBasicEffectiveBaseSecurityAdminRuleKindEffectiveBaseSecurityAdminRule + objectMap := make(map[string]interface{}) + if ebsar.ID != nil { + objectMap["id"] = ebsar.ID + } + if ebsar.ConfigurationDescription != nil { + objectMap["configurationDescription"] = ebsar.ConfigurationDescription + } + if ebsar.RuleCollectionDescription != nil { + objectMap["ruleCollectionDescription"] = ebsar.RuleCollectionDescription + } + if ebsar.RuleCollectionAppliesToGroups != nil { + objectMap["ruleCollectionAppliesToGroups"] = ebsar.RuleCollectionAppliesToGroups + } + if ebsar.RuleGroups != nil { + objectMap["ruleGroups"] = ebsar.RuleGroups + } + if ebsar.Kind != "" { + objectMap["kind"] = ebsar.Kind + } + return json.Marshal(objectMap) +} + +// AsEffectiveSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveBaseSecurityAdminRule. +func (ebsar EffectiveBaseSecurityAdminRule) AsEffectiveSecurityAdminRule() (*EffectiveSecurityAdminRule, bool) { + return nil, false +} + +// AsEffectiveDefaultSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveBaseSecurityAdminRule. +func (ebsar EffectiveBaseSecurityAdminRule) AsEffectiveDefaultSecurityAdminRule() (*EffectiveDefaultSecurityAdminRule, bool) { + return nil, false +} + +// AsEffectiveBaseSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveBaseSecurityAdminRule. +func (ebsar EffectiveBaseSecurityAdminRule) AsEffectiveBaseSecurityAdminRule() (*EffectiveBaseSecurityAdminRule, bool) { + return &ebsar, true +} + +// AsBasicEffectiveBaseSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveBaseSecurityAdminRule. +func (ebsar EffectiveBaseSecurityAdminRule) AsBasicEffectiveBaseSecurityAdminRule() (BasicEffectiveBaseSecurityAdminRule, bool) { + return &ebsar, true +} + +// EffectiveConnectivityConfiguration the network manager effective connectivity configuration +type EffectiveConnectivityConfiguration struct { + // ID - Connectivity configuration ID. + ID *string `json:"id,omitempty"` + // ConnectivityConfigurationProperties - Properties of a network manager connectivity configuration + *ConnectivityConfigurationProperties `json:"properties,omitempty"` + // ConfigurationGroups - Effective configuration groups. + ConfigurationGroups *[]ConfigurationGroup `json:"configurationGroups,omitempty"` +} + +// MarshalJSON is the custom marshaler for EffectiveConnectivityConfiguration. +func (ecc EffectiveConnectivityConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ecc.ID != nil { + objectMap["id"] = ecc.ID + } + if ecc.ConnectivityConfigurationProperties != nil { + objectMap["properties"] = ecc.ConnectivityConfigurationProperties + } + if ecc.ConfigurationGroups != nil { + objectMap["configurationGroups"] = ecc.ConfigurationGroups + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EffectiveConnectivityConfiguration struct. +func (ecc *EffectiveConnectivityConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ecc.ID = &ID + } + case "properties": + if v != nil { + var connectivityConfigurationProperties ConnectivityConfigurationProperties + err = json.Unmarshal(*v, &connectivityConfigurationProperties) + if err != nil { + return err + } + ecc.ConnectivityConfigurationProperties = &connectivityConfigurationProperties + } + case "configurationGroups": + if v != nil { + var configurationGroups []ConfigurationGroup + err = json.Unmarshal(*v, &configurationGroups) + if err != nil { + return err + } + ecc.ConfigurationGroups = &configurationGroups + } + } + } + + return nil +} + +// EffectiveDefaultSecurityAdminRule network default admin rule. +type EffectiveDefaultSecurityAdminRule struct { + // DefaultAdminPropertiesFormat - Indicates the properties of the default security admin rule + *DefaultAdminPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // ConfigurationDescription - A description of the security admin configuration. + ConfigurationDescription *string `json:"configurationDescription,omitempty"` + // RuleCollectionDescription - A description of the rule collection. + RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` + // RuleCollectionAppliesToGroups - Groups for rule collection + RuleCollectionAppliesToGroups *[]ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` + // RuleGroups - Effective configuration groups. + RuleGroups *[]ConfigurationGroup `json:"ruleGroups,omitempty"` + // Kind - Possible values include: 'KindBasicEffectiveBaseSecurityAdminRuleKindEffectiveBaseSecurityAdminRule', 'KindBasicEffectiveBaseSecurityAdminRuleKindCustom', 'KindBasicEffectiveBaseSecurityAdminRuleKindDefault' + Kind KindBasicEffectiveBaseSecurityAdminRule `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for EffectiveDefaultSecurityAdminRule. +func (edsar EffectiveDefaultSecurityAdminRule) MarshalJSON() ([]byte, error) { + edsar.Kind = KindBasicEffectiveBaseSecurityAdminRuleKindDefault + objectMap := make(map[string]interface{}) + if edsar.DefaultAdminPropertiesFormat != nil { + objectMap["properties"] = edsar.DefaultAdminPropertiesFormat + } + if edsar.ID != nil { + objectMap["id"] = edsar.ID + } + if edsar.ConfigurationDescription != nil { + objectMap["configurationDescription"] = edsar.ConfigurationDescription + } + if edsar.RuleCollectionDescription != nil { + objectMap["ruleCollectionDescription"] = edsar.RuleCollectionDescription + } + if edsar.RuleCollectionAppliesToGroups != nil { + objectMap["ruleCollectionAppliesToGroups"] = edsar.RuleCollectionAppliesToGroups + } + if edsar.RuleGroups != nil { + objectMap["ruleGroups"] = edsar.RuleGroups + } + if edsar.Kind != "" { + objectMap["kind"] = edsar.Kind + } + return json.Marshal(objectMap) +} + +// AsEffectiveSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveDefaultSecurityAdminRule. +func (edsar EffectiveDefaultSecurityAdminRule) AsEffectiveSecurityAdminRule() (*EffectiveSecurityAdminRule, bool) { + return nil, false +} + +// AsEffectiveDefaultSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveDefaultSecurityAdminRule. +func (edsar EffectiveDefaultSecurityAdminRule) AsEffectiveDefaultSecurityAdminRule() (*EffectiveDefaultSecurityAdminRule, bool) { + return &edsar, true +} + +// AsEffectiveBaseSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveDefaultSecurityAdminRule. +func (edsar EffectiveDefaultSecurityAdminRule) AsEffectiveBaseSecurityAdminRule() (*EffectiveBaseSecurityAdminRule, bool) { + return nil, false +} + +// AsBasicEffectiveBaseSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveDefaultSecurityAdminRule. +func (edsar EffectiveDefaultSecurityAdminRule) AsBasicEffectiveBaseSecurityAdminRule() (BasicEffectiveBaseSecurityAdminRule, bool) { + return &edsar, true +} + +// UnmarshalJSON is the custom unmarshaler for EffectiveDefaultSecurityAdminRule struct. +func (edsar *EffectiveDefaultSecurityAdminRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var defaultAdminPropertiesFormat DefaultAdminPropertiesFormat + err = json.Unmarshal(*v, &defaultAdminPropertiesFormat) + if err != nil { + return err + } + edsar.DefaultAdminPropertiesFormat = &defaultAdminPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + edsar.ID = &ID + } + case "configurationDescription": + if v != nil { + var configurationDescription string + err = json.Unmarshal(*v, &configurationDescription) + if err != nil { + return err + } + edsar.ConfigurationDescription = &configurationDescription + } + case "ruleCollectionDescription": + if v != nil { + var ruleCollectionDescription string + err = json.Unmarshal(*v, &ruleCollectionDescription) + if err != nil { + return err + } + edsar.RuleCollectionDescription = &ruleCollectionDescription + } + case "ruleCollectionAppliesToGroups": + if v != nil { + var ruleCollectionAppliesToGroups []ManagerSecurityGroupItem + err = json.Unmarshal(*v, &ruleCollectionAppliesToGroups) + if err != nil { + return err + } + edsar.RuleCollectionAppliesToGroups = &ruleCollectionAppliesToGroups + } + case "ruleGroups": + if v != nil { + var ruleGroups []ConfigurationGroup + err = json.Unmarshal(*v, &ruleGroups) + if err != nil { + return err + } + edsar.RuleGroups = &ruleGroups + } + case "kind": + if v != nil { + var kind KindBasicEffectiveBaseSecurityAdminRule + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + edsar.Kind = kind + } + } + } + + return nil +} + +// EffectiveNetworkSecurityGroup effective network security group. +type EffectiveNetworkSecurityGroup struct { + // NetworkSecurityGroup - The ID of network security group that is applied. + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + // Association - Associated resources. + Association *EffectiveNetworkSecurityGroupAssociation `json:"association,omitempty"` + // EffectiveSecurityRules - A collection of effective security rules. + EffectiveSecurityRules *[]EffectiveNetworkSecurityRule `json:"effectiveSecurityRules,omitempty"` + // TagMap - Mapping of tags to list of IP Addresses included within the tag. + TagMap map[string][]string `json:"tagMap"` +} + +// MarshalJSON is the custom marshaler for EffectiveNetworkSecurityGroup. +func (ensg EffectiveNetworkSecurityGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ensg.NetworkSecurityGroup != nil { + objectMap["networkSecurityGroup"] = ensg.NetworkSecurityGroup + } + if ensg.Association != nil { + objectMap["association"] = ensg.Association + } + if ensg.EffectiveSecurityRules != nil { + objectMap["effectiveSecurityRules"] = ensg.EffectiveSecurityRules + } + if ensg.TagMap != nil { + objectMap["tagMap"] = ensg.TagMap + } + return json.Marshal(objectMap) +} + +// EffectiveNetworkSecurityGroupAssociation the effective network security group association. +type EffectiveNetworkSecurityGroupAssociation struct { + // NetworkManager - The ID of the Azure network manager if assigned. + NetworkManager *SubResource `json:"networkManager,omitempty"` + // Subnet - The ID of the subnet if assigned. + Subnet *SubResource `json:"subnet,omitempty"` + // NetworkInterface - The ID of the network interface if assigned. + NetworkInterface *SubResource `json:"networkInterface,omitempty"` +} + +// EffectiveNetworkSecurityGroupListResult response for list effective network security groups API service +// call. +type EffectiveNetworkSecurityGroupListResult struct { + autorest.Response `json:"-"` + // Value - A list of effective network security groups. + Value *[]EffectiveNetworkSecurityGroup `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for EffectiveNetworkSecurityGroupListResult. +func (ensglr EffectiveNetworkSecurityGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ensglr.Value != nil { + objectMap["value"] = ensglr.Value + } + return json.Marshal(objectMap) +} + +// EffectiveNetworkSecurityRule effective network security rules. +type EffectiveNetworkSecurityRule struct { + // Name - The name of the security rule specified by the user (if created by the user). + Name *string `json:"name,omitempty"` + // Protocol - The network protocol this rule applies to. Possible values include: 'EffectiveSecurityRuleProtocolTCP', 'EffectiveSecurityRuleProtocolUDP', 'EffectiveSecurityRuleProtocolAll' + Protocol EffectiveSecurityRuleProtocol `json:"protocol,omitempty"` + // SourcePortRange - The source port or range. + SourcePortRange *string `json:"sourcePortRange,omitempty"` + // DestinationPortRange - The destination port or range. + DestinationPortRange *string `json:"destinationPortRange,omitempty"` + // SourcePortRanges - 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 (*). + SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` + // DestinationPortRanges - 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 (*). + DestinationPortRanges *[]string `json:"destinationPortRanges,omitempty"` + // SourceAddressPrefix - The source address prefix. + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + // DestinationAddressPrefix - The destination address prefix. + DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` + // SourceAddressPrefixes - The source address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System Tags, and the asterisk (*). + SourceAddressPrefixes *[]string `json:"sourceAddressPrefixes,omitempty"` + // DestinationAddressPrefixes - The destination address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System Tags, and the asterisk (*). + DestinationAddressPrefixes *[]string `json:"destinationAddressPrefixes,omitempty"` + // ExpandedSourceAddressPrefix - The expanded source address prefix. + ExpandedSourceAddressPrefix *[]string `json:"expandedSourceAddressPrefix,omitempty"` + // ExpandedDestinationAddressPrefix - Expanded destination address prefix. + ExpandedDestinationAddressPrefix *[]string `json:"expandedDestinationAddressPrefix,omitempty"` + // Access - Whether network traffic is allowed or denied. Possible values include: 'SecurityRuleAccessAllow', 'SecurityRuleAccessDeny' + Access SecurityRuleAccess `json:"access,omitempty"` + // Priority - The priority of the rule. + Priority *int32 `json:"priority,omitempty"` + // Direction - The direction of the rule. Possible values include: 'SecurityRuleDirectionInbound', 'SecurityRuleDirectionOutbound' + Direction SecurityRuleDirection `json:"direction,omitempty"` +} + +// EffectiveRoute effective Route. +type EffectiveRoute struct { + // Name - The name of the user defined route. This is optional. + Name *string `json:"name,omitempty"` + // DisableBgpRoutePropagation - If true, on-premises routes are not propagated to the network interfaces in the subnet. + DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` + // Source - Who created the route. Possible values include: 'EffectiveRouteSourceUnknown', 'EffectiveRouteSourceUser', 'EffectiveRouteSourceVirtualNetworkGateway', 'EffectiveRouteSourceDefault' + Source EffectiveRouteSource `json:"source,omitempty"` + // State - The value of effective route. Possible values include: 'EffectiveRouteStateActive', 'EffectiveRouteStateInvalid' + State EffectiveRouteState `json:"state,omitempty"` + // AddressPrefix - The address prefixes of the effective routes in CIDR notation. + AddressPrefix *[]string `json:"addressPrefix,omitempty"` + // NextHopIPAddress - The IP address of the next hop of the effective route. + NextHopIPAddress *[]string `json:"nextHopIpAddress,omitempty"` + // NextHopType - The type of Azure hop the packet should be sent to. Possible values include: 'RouteNextHopTypeVirtualNetworkGateway', 'RouteNextHopTypeVnetLocal', 'RouteNextHopTypeInternet', 'RouteNextHopTypeVirtualAppliance', 'RouteNextHopTypeNone' + NextHopType RouteNextHopType `json:"nextHopType,omitempty"` +} + +// EffectiveRouteListResult response for list effective route API service call. +type EffectiveRouteListResult struct { + autorest.Response `json:"-"` + // Value - A list of effective routes. + Value *[]EffectiveRoute `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for EffectiveRouteListResult. +func (erlr EffectiveRouteListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erlr.Value != nil { + objectMap["value"] = erlr.Value + } + return json.Marshal(objectMap) +} + +// EffectiveRouteMapRoute the effective RouteMap route configured on the connection resource. +type EffectiveRouteMapRoute struct { + // Prefix - The address prefix of the route. + Prefix *[]string `json:"prefix,omitempty"` + // BgpCommunities - BGP communities of the route. + BgpCommunities *string `json:"bgpCommunities,omitempty"` + // AsPath - The ASPath of this route. + AsPath *string `json:"asPath,omitempty"` +} + +// EffectiveRoutesParameters the parameters specifying the resource whose effective routes are being +// requested. +type EffectiveRoutesParameters struct { + // ResourceID - The resource whose effective routes are being requested. + ResourceID *string `json:"resourceId,omitempty"` + // VirtualWanResourceType - The type of the specified resource like RouteTable, ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and P2SConnection. + VirtualWanResourceType *string `json:"virtualWanResourceType,omitempty"` +} + +// EffectiveSecurityAdminRule network admin rule. +type EffectiveSecurityAdminRule struct { + // AdminPropertiesFormat - Indicates the properties of the security admin rule + *AdminPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // ConfigurationDescription - A description of the security admin configuration. + ConfigurationDescription *string `json:"configurationDescription,omitempty"` + // RuleCollectionDescription - A description of the rule collection. + RuleCollectionDescription *string `json:"ruleCollectionDescription,omitempty"` + // RuleCollectionAppliesToGroups - Groups for rule collection + RuleCollectionAppliesToGroups *[]ManagerSecurityGroupItem `json:"ruleCollectionAppliesToGroups,omitempty"` + // RuleGroups - Effective configuration groups. + RuleGroups *[]ConfigurationGroup `json:"ruleGroups,omitempty"` + // Kind - Possible values include: 'KindBasicEffectiveBaseSecurityAdminRuleKindEffectiveBaseSecurityAdminRule', 'KindBasicEffectiveBaseSecurityAdminRuleKindCustom', 'KindBasicEffectiveBaseSecurityAdminRuleKindDefault' + Kind KindBasicEffectiveBaseSecurityAdminRule `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for EffectiveSecurityAdminRule. +func (esar EffectiveSecurityAdminRule) MarshalJSON() ([]byte, error) { + esar.Kind = KindBasicEffectiveBaseSecurityAdminRuleKindCustom + objectMap := make(map[string]interface{}) + if esar.AdminPropertiesFormat != nil { + objectMap["properties"] = esar.AdminPropertiesFormat + } + if esar.ID != nil { + objectMap["id"] = esar.ID + } + if esar.ConfigurationDescription != nil { + objectMap["configurationDescription"] = esar.ConfigurationDescription + } + if esar.RuleCollectionDescription != nil { + objectMap["ruleCollectionDescription"] = esar.RuleCollectionDescription + } + if esar.RuleCollectionAppliesToGroups != nil { + objectMap["ruleCollectionAppliesToGroups"] = esar.RuleCollectionAppliesToGroups + } + if esar.RuleGroups != nil { + objectMap["ruleGroups"] = esar.RuleGroups + } + if esar.Kind != "" { + objectMap["kind"] = esar.Kind + } + return json.Marshal(objectMap) +} + +// AsEffectiveSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveSecurityAdminRule. +func (esar EffectiveSecurityAdminRule) AsEffectiveSecurityAdminRule() (*EffectiveSecurityAdminRule, bool) { + return &esar, true +} + +// AsEffectiveDefaultSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveSecurityAdminRule. +func (esar EffectiveSecurityAdminRule) AsEffectiveDefaultSecurityAdminRule() (*EffectiveDefaultSecurityAdminRule, bool) { + return nil, false +} + +// AsEffectiveBaseSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveSecurityAdminRule. +func (esar EffectiveSecurityAdminRule) AsEffectiveBaseSecurityAdminRule() (*EffectiveBaseSecurityAdminRule, bool) { + return nil, false +} + +// AsBasicEffectiveBaseSecurityAdminRule is the BasicEffectiveBaseSecurityAdminRule implementation for EffectiveSecurityAdminRule. +func (esar EffectiveSecurityAdminRule) AsBasicEffectiveBaseSecurityAdminRule() (BasicEffectiveBaseSecurityAdminRule, bool) { + return &esar, true +} + +// UnmarshalJSON is the custom unmarshaler for EffectiveSecurityAdminRule struct. +func (esar *EffectiveSecurityAdminRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var adminPropertiesFormat AdminPropertiesFormat + err = json.Unmarshal(*v, &adminPropertiesFormat) + if err != nil { + return err + } + esar.AdminPropertiesFormat = &adminPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + esar.ID = &ID + } + case "configurationDescription": + if v != nil { + var configurationDescription string + err = json.Unmarshal(*v, &configurationDescription) + if err != nil { + return err + } + esar.ConfigurationDescription = &configurationDescription + } + case "ruleCollectionDescription": + if v != nil { + var ruleCollectionDescription string + err = json.Unmarshal(*v, &ruleCollectionDescription) + if err != nil { + return err + } + esar.RuleCollectionDescription = &ruleCollectionDescription + } + case "ruleCollectionAppliesToGroups": + if v != nil { + var ruleCollectionAppliesToGroups []ManagerSecurityGroupItem + err = json.Unmarshal(*v, &ruleCollectionAppliesToGroups) + if err != nil { + return err + } + esar.RuleCollectionAppliesToGroups = &ruleCollectionAppliesToGroups + } + case "ruleGroups": + if v != nil { + var ruleGroups []ConfigurationGroup + err = json.Unmarshal(*v, &ruleGroups) + if err != nil { + return err + } + esar.RuleGroups = &ruleGroups + } + case "kind": + if v != nil { + var kind KindBasicEffectiveBaseSecurityAdminRule + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + esar.Kind = kind + } + } + } + + return nil +} + +// EndpointServiceResult endpoint service. +type EndpointServiceResult struct { + // Name - READ-ONLY; Name of the endpoint service. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the endpoint service. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointServiceResult. +func (esr EndpointServiceResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if esr.ID != nil { + objectMap["id"] = esr.ID + } + return json.Marshal(objectMap) +} + +// EndpointServicesListResult response for the ListAvailableEndpointServices API service call. +type EndpointServicesListResult struct { + autorest.Response `json:"-"` + // Value - List of available endpoint services in a region. + Value *[]EndpointServiceResult `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// EndpointServicesListResultIterator provides access to a complete listing of EndpointServiceResult +// values. +type EndpointServicesListResultIterator struct { + i int + page EndpointServicesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EndpointServicesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointServicesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EndpointServicesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EndpointServicesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EndpointServicesListResultIterator) Response() EndpointServicesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EndpointServicesListResultIterator) Value() EndpointServiceResult { + if !iter.page.NotDone() { + return EndpointServiceResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EndpointServicesListResultIterator type. +func NewEndpointServicesListResultIterator(page EndpointServicesListResultPage) EndpointServicesListResultIterator { + return EndpointServicesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (eslr EndpointServicesListResult) IsEmpty() bool { + return eslr.Value == nil || len(*eslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (eslr EndpointServicesListResult) hasNextLink() bool { + return eslr.NextLink != nil && len(*eslr.NextLink) != 0 +} + +// endpointServicesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (eslr EndpointServicesListResult) endpointServicesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !eslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(eslr.NextLink))) +} + +// EndpointServicesListResultPage contains a page of EndpointServiceResult values. +type EndpointServicesListResultPage struct { + fn func(context.Context, EndpointServicesListResult) (EndpointServicesListResult, error) + eslr EndpointServicesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EndpointServicesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointServicesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.eslr) + if err != nil { + return err + } + page.eslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EndpointServicesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EndpointServicesListResultPage) NotDone() bool { + return !page.eslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EndpointServicesListResultPage) Response() EndpointServicesListResult { + return page.eslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EndpointServicesListResultPage) Values() []EndpointServiceResult { + if page.eslr.IsEmpty() { + return nil + } + return *page.eslr.Value +} + +// Creates a new instance of the EndpointServicesListResultPage type. +func NewEndpointServicesListResultPage(cur EndpointServicesListResult, getNextPage func(context.Context, EndpointServicesListResult) (EndpointServicesListResult, error)) EndpointServicesListResultPage { + return EndpointServicesListResultPage{ + fn: getNextPage, + eslr: cur, + } +} + +// Error common error representation. +type Error struct { + // Code - Error code. + Code *string `json:"code,omitempty"` + // Message - Error message. + Message *string `json:"message,omitempty"` + // Target - Error target. + Target *string `json:"target,omitempty"` + // Details - Error details. + Details *[]ErrorDetails `json:"details,omitempty"` + // InnerError - Inner error message. + InnerError *string `json:"innerError,omitempty"` +} + +// ErrorDetails common error details representation. +type ErrorDetails struct { + // Code - Error code. + Code *string `json:"code,omitempty"` + // Target - Error target. + Target *string `json:"target,omitempty"` + // Message - Error message. + Message *string `json:"message,omitempty"` +} + +// ErrorResponse the error object. +type ErrorResponse struct { + // Error - The error details object. + Error *ErrorDetails `json:"error,omitempty"` +} + +// EvaluatedNetworkSecurityGroup results of network security group evaluation. +type EvaluatedNetworkSecurityGroup struct { + // NetworkSecurityGroupID - Network security group ID. + NetworkSecurityGroupID *string `json:"networkSecurityGroupId,omitempty"` + // AppliedTo - Resource ID of nic or subnet to which network security group is applied. + AppliedTo *string `json:"appliedTo,omitempty"` + // MatchedRule - Matched network security rule. + MatchedRule *MatchedRule `json:"matchedRule,omitempty"` + // RulesEvaluationResult - READ-ONLY; List of network security rules evaluation results. + RulesEvaluationResult *[]SecurityRulesEvaluationResult `json:"rulesEvaluationResult,omitempty"` +} + +// MarshalJSON is the custom marshaler for EvaluatedNetworkSecurityGroup. +func (ensg EvaluatedNetworkSecurityGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ensg.NetworkSecurityGroupID != nil { + objectMap["networkSecurityGroupId"] = ensg.NetworkSecurityGroupID + } + if ensg.AppliedTo != nil { + objectMap["appliedTo"] = ensg.AppliedTo + } + if ensg.MatchedRule != nil { + objectMap["matchedRule"] = ensg.MatchedRule + } + return json.Marshal(objectMap) +} + +// ExclusionManagedRule defines a managed rule to use for exclusion. +type ExclusionManagedRule struct { + // RuleID - Identifier for the managed rule. + RuleID *string `json:"ruleId,omitempty"` +} + +// ExclusionManagedRuleGroup defines a managed rule group to use for exclusion. +type ExclusionManagedRuleGroup struct { + // RuleGroupName - The managed rule group for exclusion. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + // Rules - List of rules that will be excluded. If none specified, all rules in the group will be excluded. + Rules *[]ExclusionManagedRule `json:"rules,omitempty"` +} + +// ExclusionManagedRuleSet defines a managed rule set for Exclusions. +type ExclusionManagedRuleSet struct { + // RuleSetType - Defines the rule set type to use. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - Defines the version of the rule set to use. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + // RuleGroups - Defines the rule groups to apply to the rule set. + RuleGroups *[]ExclusionManagedRuleGroup `json:"ruleGroups,omitempty"` +} + +// ExplicitProxy explicit Proxy Settings in Firewall Policy. +type ExplicitProxy struct { + // EnableExplicitProxy - When set to true, explicit proxy mode is enabled. + EnableExplicitProxy *bool `json:"enableExplicitProxy,omitempty"` + // HTTPPort - Port number for explicit proxy http protocol, cannot be greater than 64000. + HTTPPort *int32 `json:"httpPort,omitempty"` + // HTTPSPort - Port number for explicit proxy https protocol, cannot be greater than 64000. + HTTPSPort *int32 `json:"httpsPort,omitempty"` + // EnablePacFile - When set to true, pac file port and url needs to be provided. + EnablePacFile *bool `json:"enablePacFile,omitempty"` + // PacFilePort - Port number for firewall to serve PAC file. + PacFilePort *int32 `json:"pacFilePort,omitempty"` + // PacFile - SAS URL for PAC file. + PacFile *string `json:"pacFile,omitempty"` +} + +// ExpressRouteCircuit expressRouteCircuit resource. +type ExpressRouteCircuit struct { + autorest.Response `json:"-"` + // Sku - The SKU. + Sku *ExpressRouteCircuitSku `json:"sku,omitempty"` + // ExpressRouteCircuitPropertiesFormat - Properties of the express route circuit. + *ExpressRouteCircuitPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuit. +func (erc ExpressRouteCircuit) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erc.Sku != nil { + objectMap["sku"] = erc.Sku + } + if erc.ExpressRouteCircuitPropertiesFormat != nil { + objectMap["properties"] = erc.ExpressRouteCircuitPropertiesFormat + } + if erc.ID != nil { + objectMap["id"] = erc.ID + } + if erc.Location != nil { + objectMap["location"] = erc.Location + } + if erc.Tags != nil { + objectMap["tags"] = erc.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuit struct. +func (erc *ExpressRouteCircuit) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku ExpressRouteCircuitSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + erc.Sku = &sku + } + case "properties": + if v != nil { + var expressRouteCircuitPropertiesFormat ExpressRouteCircuitPropertiesFormat + err = json.Unmarshal(*v, &expressRouteCircuitPropertiesFormat) + if err != nil { + return err + } + erc.ExpressRouteCircuitPropertiesFormat = &expressRouteCircuitPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + erc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + erc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + erc.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + erc.Tags = tags + } + } + } + + return nil +} + +// ExpressRouteCircuitArpTable the ARP table associated with the ExpressRouteCircuit. +type ExpressRouteCircuitArpTable struct { + // Age - Entry age in minutes. + Age *int32 `json:"age,omitempty"` + // Interface - Interface address. + Interface *string `json:"interface,omitempty"` + // IPAddress - The IP address. + IPAddress *string `json:"ipAddress,omitempty"` + // MacAddress - The MAC address. + MacAddress *string `json:"macAddress,omitempty"` +} + +// ExpressRouteCircuitAuthorization authorization in an ExpressRouteCircuit resource. +type ExpressRouteCircuitAuthorization struct { + autorest.Response `json:"-"` + // AuthorizationPropertiesFormat - Properties of the express route circuit authorization. + *AuthorizationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuitAuthorization. +func (erca ExpressRouteCircuitAuthorization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erca.AuthorizationPropertiesFormat != nil { + objectMap["properties"] = erca.AuthorizationPropertiesFormat + } + if erca.Name != nil { + objectMap["name"] = erca.Name + } + if erca.ID != nil { + objectMap["id"] = erca.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuitAuthorization struct. +func (erca *ExpressRouteCircuitAuthorization) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var authorizationPropertiesFormat AuthorizationPropertiesFormat + err = json.Unmarshal(*v, &authorizationPropertiesFormat) + if err != nil { + return err + } + erca.AuthorizationPropertiesFormat = &authorizationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erca.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + erca.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + erca.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erca.ID = &ID + } + } + } + + return nil +} + +// ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitAuthorizationsClient) (ExpressRouteCircuitAuthorization, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture.Result. +func (future *ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture) result(client ExpressRouteCircuitAuthorizationsClient) (erca ExpressRouteCircuitAuthorization, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erca.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erca.Response.Response, err = future.GetResult(sender); err == nil && erca.Response.Response.StatusCode != http.StatusNoContent { + erca, err = client.CreateOrUpdateResponder(erca.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", erca.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCircuitAuthorizationsDeleteFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ExpressRouteCircuitAuthorizationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitAuthorizationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitAuthorizationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitAuthorizationsDeleteFuture.Result. +func (future *ExpressRouteCircuitAuthorizationsDeleteFuture) result(client ExpressRouteCircuitAuthorizationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitAuthorizationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRouteCircuitConnection express Route Circuit Connection in an ExpressRouteCircuitPeering +// resource. +type ExpressRouteCircuitConnection struct { + autorest.Response `json:"-"` + // ExpressRouteCircuitConnectionPropertiesFormat - Properties of the express route circuit connection. + *ExpressRouteCircuitConnectionPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuitConnection. +func (ercc ExpressRouteCircuitConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercc.ExpressRouteCircuitConnectionPropertiesFormat != nil { + objectMap["properties"] = ercc.ExpressRouteCircuitConnectionPropertiesFormat + } + if ercc.Name != nil { + objectMap["name"] = ercc.Name + } + if ercc.ID != nil { + objectMap["id"] = ercc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuitConnection struct. +func (ercc *ExpressRouteCircuitConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteCircuitConnectionPropertiesFormat ExpressRouteCircuitConnectionPropertiesFormat + err = json.Unmarshal(*v, &expressRouteCircuitConnectionPropertiesFormat) + if err != nil { + return err + } + ercc.ExpressRouteCircuitConnectionPropertiesFormat = &expressRouteCircuitConnectionPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ercc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ercc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ercc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ercc.ID = &ID + } + } + } + + return nil +} + +// ExpressRouteCircuitConnectionListResult response for ListConnections API service call retrieves all +// global reach connections that belongs to a Private Peering for an ExpressRouteCircuit. +type ExpressRouteCircuitConnectionListResult struct { + autorest.Response `json:"-"` + // Value - The global reach connection associated with Private Peering in an ExpressRoute Circuit. + Value *[]ExpressRouteCircuitConnection `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitConnectionListResultIterator provides access to a complete listing of +// ExpressRouteCircuitConnection values. +type ExpressRouteCircuitConnectionListResultIterator struct { + i int + page ExpressRouteCircuitConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRouteCircuitConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRouteCircuitConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRouteCircuitConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRouteCircuitConnectionListResultIterator) Response() ExpressRouteCircuitConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRouteCircuitConnectionListResultIterator) Value() ExpressRouteCircuitConnection { + if !iter.page.NotDone() { + return ExpressRouteCircuitConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRouteCircuitConnectionListResultIterator type. +func NewExpressRouteCircuitConnectionListResultIterator(page ExpressRouteCircuitConnectionListResultPage) ExpressRouteCircuitConnectionListResultIterator { + return ExpressRouteCircuitConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ercclr ExpressRouteCircuitConnectionListResult) IsEmpty() bool { + return ercclr.Value == nil || len(*ercclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ercclr ExpressRouteCircuitConnectionListResult) hasNextLink() bool { + return ercclr.NextLink != nil && len(*ercclr.NextLink) != 0 +} + +// expressRouteCircuitConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ercclr ExpressRouteCircuitConnectionListResult) expressRouteCircuitConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ercclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ercclr.NextLink))) +} + +// ExpressRouteCircuitConnectionListResultPage contains a page of ExpressRouteCircuitConnection values. +type ExpressRouteCircuitConnectionListResultPage struct { + fn func(context.Context, ExpressRouteCircuitConnectionListResult) (ExpressRouteCircuitConnectionListResult, error) + ercclr ExpressRouteCircuitConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRouteCircuitConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ercclr) + if err != nil { + return err + } + page.ercclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRouteCircuitConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRouteCircuitConnectionListResultPage) NotDone() bool { + return !page.ercclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRouteCircuitConnectionListResultPage) Response() ExpressRouteCircuitConnectionListResult { + return page.ercclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRouteCircuitConnectionListResultPage) Values() []ExpressRouteCircuitConnection { + if page.ercclr.IsEmpty() { + return nil + } + return *page.ercclr.Value +} + +// Creates a new instance of the ExpressRouteCircuitConnectionListResultPage type. +func NewExpressRouteCircuitConnectionListResultPage(cur ExpressRouteCircuitConnectionListResult, getNextPage func(context.Context, ExpressRouteCircuitConnectionListResult) (ExpressRouteCircuitConnectionListResult, error)) ExpressRouteCircuitConnectionListResultPage { + return ExpressRouteCircuitConnectionListResultPage{ + fn: getNextPage, + ercclr: cur, + } +} + +// ExpressRouteCircuitConnectionPropertiesFormat properties of the express route circuit connection. +type ExpressRouteCircuitConnectionPropertiesFormat struct { + // ExpressRouteCircuitPeering - Reference to Express Route Circuit Private Peering Resource of the circuit initiating connection. + ExpressRouteCircuitPeering *SubResource `json:"expressRouteCircuitPeering,omitempty"` + // PeerExpressRouteCircuitPeering - Reference to Express Route Circuit Private Peering Resource of the peered circuit. + PeerExpressRouteCircuitPeering *SubResource `json:"peerExpressRouteCircuitPeering,omitempty"` + // AddressPrefix - /29 IP address space to carve out Customer addresses for tunnels. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // AuthorizationKey - The authorization key. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + // Ipv6CircuitConnectionConfig - IPv6 Address PrefixProperties of the express route circuit connection. + Ipv6CircuitConnectionConfig *Ipv6CircuitConnectionConfig `json:"ipv6CircuitConnectionConfig,omitempty"` + // CircuitConnectionStatus - Express Route Circuit connection state. Possible values include: 'CircuitConnectionStatusConnected', 'CircuitConnectionStatusConnecting', 'CircuitConnectionStatusDisconnected' + CircuitConnectionStatus CircuitConnectionStatus `json:"circuitConnectionStatus,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route circuit connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuitConnectionPropertiesFormat. +func (erccpf ExpressRouteCircuitConnectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erccpf.ExpressRouteCircuitPeering != nil { + objectMap["expressRouteCircuitPeering"] = erccpf.ExpressRouteCircuitPeering + } + if erccpf.PeerExpressRouteCircuitPeering != nil { + objectMap["peerExpressRouteCircuitPeering"] = erccpf.PeerExpressRouteCircuitPeering + } + if erccpf.AddressPrefix != nil { + objectMap["addressPrefix"] = erccpf.AddressPrefix + } + if erccpf.AuthorizationKey != nil { + objectMap["authorizationKey"] = erccpf.AuthorizationKey + } + if erccpf.Ipv6CircuitConnectionConfig != nil { + objectMap["ipv6CircuitConnectionConfig"] = erccpf.Ipv6CircuitConnectionConfig + } + if erccpf.CircuitConnectionStatus != "" { + objectMap["circuitConnectionStatus"] = erccpf.CircuitConnectionStatus + } + return json.Marshal(objectMap) +} + +// ExpressRouteCircuitConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExpressRouteCircuitConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitConnectionsClient) (ExpressRouteCircuitConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitConnectionsCreateOrUpdateFuture.Result. +func (future *ExpressRouteCircuitConnectionsCreateOrUpdateFuture) result(client ExpressRouteCircuitConnectionsClient) (ercc ExpressRouteCircuitConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercc.Response.Response, err = future.GetResult(sender); err == nil && ercc.Response.Response.StatusCode != http.StatusNoContent { + ercc, err = client.CreateOrUpdateResponder(ercc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsCreateOrUpdateFuture", "Result", ercc.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCircuitConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitConnectionsDeleteFuture.Result. +func (future *ExpressRouteCircuitConnectionsDeleteFuture) result(client ExpressRouteCircuitConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRouteCircuitListResult response for ListExpressRouteCircuit API service call. +type ExpressRouteCircuitListResult struct { + autorest.Response `json:"-"` + // Value - A list of ExpressRouteCircuits in a resource group. + Value *[]ExpressRouteCircuit `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitListResultIterator provides access to a complete listing of ExpressRouteCircuit +// values. +type ExpressRouteCircuitListResultIterator struct { + i int + page ExpressRouteCircuitListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRouteCircuitListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRouteCircuitListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRouteCircuitListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRouteCircuitListResultIterator) Response() ExpressRouteCircuitListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRouteCircuitListResultIterator) Value() ExpressRouteCircuit { + if !iter.page.NotDone() { + return ExpressRouteCircuit{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRouteCircuitListResultIterator type. +func NewExpressRouteCircuitListResultIterator(page ExpressRouteCircuitListResultPage) ExpressRouteCircuitListResultIterator { + return ExpressRouteCircuitListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (erclr ExpressRouteCircuitListResult) IsEmpty() bool { + return erclr.Value == nil || len(*erclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (erclr ExpressRouteCircuitListResult) hasNextLink() bool { + return erclr.NextLink != nil && len(*erclr.NextLink) != 0 +} + +// expressRouteCircuitListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (erclr ExpressRouteCircuitListResult) expressRouteCircuitListResultPreparer(ctx context.Context) (*http.Request, error) { + if !erclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(erclr.NextLink))) +} + +// ExpressRouteCircuitListResultPage contains a page of ExpressRouteCircuit values. +type ExpressRouteCircuitListResultPage struct { + fn func(context.Context, ExpressRouteCircuitListResult) (ExpressRouteCircuitListResult, error) + erclr ExpressRouteCircuitListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRouteCircuitListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.erclr) + if err != nil { + return err + } + page.erclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRouteCircuitListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRouteCircuitListResultPage) NotDone() bool { + return !page.erclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRouteCircuitListResultPage) Response() ExpressRouteCircuitListResult { + return page.erclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRouteCircuitListResultPage) Values() []ExpressRouteCircuit { + if page.erclr.IsEmpty() { + return nil + } + return *page.erclr.Value +} + +// Creates a new instance of the ExpressRouteCircuitListResultPage type. +func NewExpressRouteCircuitListResultPage(cur ExpressRouteCircuitListResult, getNextPage func(context.Context, ExpressRouteCircuitListResult) (ExpressRouteCircuitListResult, error)) ExpressRouteCircuitListResultPage { + return ExpressRouteCircuitListResultPage{ + fn: getNextPage, + erclr: cur, + } +} + +// ExpressRouteCircuitPeering peering in an ExpressRouteCircuit resource. +type ExpressRouteCircuitPeering struct { + autorest.Response `json:"-"` + // ExpressRouteCircuitPeeringPropertiesFormat - Properties of the express route circuit peering. + *ExpressRouteCircuitPeeringPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuitPeering. +func (ercp ExpressRouteCircuitPeering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercp.ExpressRouteCircuitPeeringPropertiesFormat != nil { + objectMap["properties"] = ercp.ExpressRouteCircuitPeeringPropertiesFormat + } + if ercp.Name != nil { + objectMap["name"] = ercp.Name + } + if ercp.ID != nil { + objectMap["id"] = ercp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuitPeering struct. +func (ercp *ExpressRouteCircuitPeering) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteCircuitPeeringPropertiesFormat ExpressRouteCircuitPeeringPropertiesFormat + err = json.Unmarshal(*v, &expressRouteCircuitPeeringPropertiesFormat) + if err != nil { + return err + } + ercp.ExpressRouteCircuitPeeringPropertiesFormat = &expressRouteCircuitPeeringPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ercp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ercp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ercp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ercp.ID = &ID + } + } + } + + return nil +} + +// ExpressRouteCircuitPeeringConfig specifies the peering configuration. +type ExpressRouteCircuitPeeringConfig struct { + // AdvertisedPublicPrefixes - The reference to AdvertisedPublicPrefixes. + AdvertisedPublicPrefixes *[]string `json:"advertisedPublicPrefixes,omitempty"` + // AdvertisedCommunities - The communities of bgp peering. Specified for microsoft peering. + AdvertisedCommunities *[]string `json:"advertisedCommunities,omitempty"` + // AdvertisedPublicPrefixesState - READ-ONLY; The advertised public prefix state of the Peering resource. Possible values include: 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateNotConfigured', 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfiguring', 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfigured', 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded' + AdvertisedPublicPrefixesState ExpressRouteCircuitPeeringAdvertisedPublicPrefixState `json:"advertisedPublicPrefixesState,omitempty"` + // LegacyMode - The legacy mode of the peering. + LegacyMode *int32 `json:"legacyMode,omitempty"` + // CustomerASN - The CustomerASN of the peering. + CustomerASN *int32 `json:"customerASN,omitempty"` + // RoutingRegistryName - The RoutingRegistryName of the configuration. + RoutingRegistryName *string `json:"routingRegistryName,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuitPeeringConfig. +func (ercpc ExpressRouteCircuitPeeringConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercpc.AdvertisedPublicPrefixes != nil { + objectMap["advertisedPublicPrefixes"] = ercpc.AdvertisedPublicPrefixes + } + if ercpc.AdvertisedCommunities != nil { + objectMap["advertisedCommunities"] = ercpc.AdvertisedCommunities + } + if ercpc.LegacyMode != nil { + objectMap["legacyMode"] = ercpc.LegacyMode + } + if ercpc.CustomerASN != nil { + objectMap["customerASN"] = ercpc.CustomerASN + } + if ercpc.RoutingRegistryName != nil { + objectMap["routingRegistryName"] = ercpc.RoutingRegistryName + } + return json.Marshal(objectMap) +} + +// ExpressRouteCircuitPeeringID expressRoute circuit peering identifier. +type ExpressRouteCircuitPeeringID struct { + // ID - The ID of the ExpressRoute circuit peering. + ID *string `json:"id,omitempty"` +} + +// ExpressRouteCircuitPeeringListResult response for ListPeering API service call retrieves all peerings +// that belong to an ExpressRouteCircuit. +type ExpressRouteCircuitPeeringListResult struct { + autorest.Response `json:"-"` + // Value - The peerings in an express route circuit. + Value *[]ExpressRouteCircuitPeering `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitPeeringListResultIterator provides access to a complete listing of +// ExpressRouteCircuitPeering values. +type ExpressRouteCircuitPeeringListResultIterator struct { + i int + page ExpressRouteCircuitPeeringListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRouteCircuitPeeringListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitPeeringListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRouteCircuitPeeringListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRouteCircuitPeeringListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRouteCircuitPeeringListResultIterator) Response() ExpressRouteCircuitPeeringListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRouteCircuitPeeringListResultIterator) Value() ExpressRouteCircuitPeering { + if !iter.page.NotDone() { + return ExpressRouteCircuitPeering{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRouteCircuitPeeringListResultIterator type. +func NewExpressRouteCircuitPeeringListResultIterator(page ExpressRouteCircuitPeeringListResultPage) ExpressRouteCircuitPeeringListResultIterator { + return ExpressRouteCircuitPeeringListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ercplr ExpressRouteCircuitPeeringListResult) IsEmpty() bool { + return ercplr.Value == nil || len(*ercplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ercplr ExpressRouteCircuitPeeringListResult) hasNextLink() bool { + return ercplr.NextLink != nil && len(*ercplr.NextLink) != 0 +} + +// expressRouteCircuitPeeringListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ercplr ExpressRouteCircuitPeeringListResult) expressRouteCircuitPeeringListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ercplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ercplr.NextLink))) +} + +// ExpressRouteCircuitPeeringListResultPage contains a page of ExpressRouteCircuitPeering values. +type ExpressRouteCircuitPeeringListResultPage struct { + fn func(context.Context, ExpressRouteCircuitPeeringListResult) (ExpressRouteCircuitPeeringListResult, error) + ercplr ExpressRouteCircuitPeeringListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRouteCircuitPeeringListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitPeeringListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ercplr) + if err != nil { + return err + } + page.ercplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRouteCircuitPeeringListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRouteCircuitPeeringListResultPage) NotDone() bool { + return !page.ercplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRouteCircuitPeeringListResultPage) Response() ExpressRouteCircuitPeeringListResult { + return page.ercplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRouteCircuitPeeringListResultPage) Values() []ExpressRouteCircuitPeering { + if page.ercplr.IsEmpty() { + return nil + } + return *page.ercplr.Value +} + +// Creates a new instance of the ExpressRouteCircuitPeeringListResultPage type. +func NewExpressRouteCircuitPeeringListResultPage(cur ExpressRouteCircuitPeeringListResult, getNextPage func(context.Context, ExpressRouteCircuitPeeringListResult) (ExpressRouteCircuitPeeringListResult, error)) ExpressRouteCircuitPeeringListResultPage { + return ExpressRouteCircuitPeeringListResultPage{ + fn: getNextPage, + ercplr: cur, + } +} + +// ExpressRouteCircuitPeeringPropertiesFormat properties of the express route circuit peering. +type ExpressRouteCircuitPeeringPropertiesFormat struct { + // PeeringType - The peering type. Possible values include: 'ExpressRoutePeeringTypeAzurePublicPeering', 'ExpressRoutePeeringTypeAzurePrivatePeering', 'ExpressRoutePeeringTypeMicrosoftPeering' + PeeringType ExpressRoutePeeringType `json:"peeringType,omitempty"` + // State - The peering state. Possible values include: 'ExpressRoutePeeringStateDisabled', 'ExpressRoutePeeringStateEnabled' + State ExpressRoutePeeringState `json:"state,omitempty"` + // AzureASN - The Azure ASN. + AzureASN *int32 `json:"azureASN,omitempty"` + // PeerASN - The peer ASN. + PeerASN *int64 `json:"peerASN,omitempty"` + // PrimaryPeerAddressPrefix - The primary address prefix. + PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` + // SecondaryPeerAddressPrefix - The secondary address prefix. + SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"` + // PrimaryAzurePort - The primary port. + PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` + // SecondaryAzurePort - The secondary port. + SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` + // SharedKey - The shared key. + SharedKey *string `json:"sharedKey,omitempty"` + // VlanID - The VLAN ID. + VlanID *int32 `json:"vlanId,omitempty"` + // MicrosoftPeeringConfig - The Microsoft peering configuration. + MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` + // Stats - The peering stats of express route circuit. + Stats *ExpressRouteCircuitStats `json:"stats,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route circuit peering resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // GatewayManagerEtag - The GatewayManager Etag. + GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` + // LastModifiedBy - READ-ONLY; Who was the last to modify the peering. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // RouteFilter - The reference to the RouteFilter resource. + RouteFilter *SubResource `json:"routeFilter,omitempty"` + // Ipv6PeeringConfig - The IPv6 peering configuration. + Ipv6PeeringConfig *Ipv6ExpressRouteCircuitPeeringConfig `json:"ipv6PeeringConfig,omitempty"` + // ExpressRouteConnection - The ExpressRoute connection. + ExpressRouteConnection *ExpressRouteConnectionID `json:"expressRouteConnection,omitempty"` + // Connections - The list of circuit connections associated with Azure Private Peering for this circuit. + Connections *[]ExpressRouteCircuitConnection `json:"connections,omitempty"` + // PeeredConnections - READ-ONLY; The list of peered circuit connections associated with Azure Private Peering for this circuit. + PeeredConnections *[]PeerExpressRouteCircuitConnection `json:"peeredConnections,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuitPeeringPropertiesFormat. +func (ercppf ExpressRouteCircuitPeeringPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercppf.PeeringType != "" { + objectMap["peeringType"] = ercppf.PeeringType + } + if ercppf.State != "" { + objectMap["state"] = ercppf.State + } + if ercppf.AzureASN != nil { + objectMap["azureASN"] = ercppf.AzureASN + } + if ercppf.PeerASN != nil { + objectMap["peerASN"] = ercppf.PeerASN + } + if ercppf.PrimaryPeerAddressPrefix != nil { + objectMap["primaryPeerAddressPrefix"] = ercppf.PrimaryPeerAddressPrefix + } + if ercppf.SecondaryPeerAddressPrefix != nil { + objectMap["secondaryPeerAddressPrefix"] = ercppf.SecondaryPeerAddressPrefix + } + if ercppf.PrimaryAzurePort != nil { + objectMap["primaryAzurePort"] = ercppf.PrimaryAzurePort + } + if ercppf.SecondaryAzurePort != nil { + objectMap["secondaryAzurePort"] = ercppf.SecondaryAzurePort + } + if ercppf.SharedKey != nil { + objectMap["sharedKey"] = ercppf.SharedKey + } + if ercppf.VlanID != nil { + objectMap["vlanId"] = ercppf.VlanID + } + if ercppf.MicrosoftPeeringConfig != nil { + objectMap["microsoftPeeringConfig"] = ercppf.MicrosoftPeeringConfig + } + if ercppf.Stats != nil { + objectMap["stats"] = ercppf.Stats + } + if ercppf.GatewayManagerEtag != nil { + objectMap["gatewayManagerEtag"] = ercppf.GatewayManagerEtag + } + if ercppf.RouteFilter != nil { + objectMap["routeFilter"] = ercppf.RouteFilter + } + if ercppf.Ipv6PeeringConfig != nil { + objectMap["ipv6PeeringConfig"] = ercppf.Ipv6PeeringConfig + } + if ercppf.ExpressRouteConnection != nil { + objectMap["expressRouteConnection"] = ercppf.ExpressRouteConnection + } + if ercppf.Connections != nil { + objectMap["connections"] = ercppf.Connections + } + return json.Marshal(objectMap) +} + +// ExpressRouteCircuitPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ExpressRouteCircuitPeeringsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitPeeringsClient) (ExpressRouteCircuitPeering, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitPeeringsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitPeeringsCreateOrUpdateFuture.Result. +func (future *ExpressRouteCircuitPeeringsCreateOrUpdateFuture) result(client ExpressRouteCircuitPeeringsClient) (ercp ExpressRouteCircuitPeering, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercp.Response.Response, err = future.GetResult(sender); err == nil && ercp.Response.Response.StatusCode != http.StatusNoContent { + ercp, err = client.CreateOrUpdateResponder(ercp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", ercp.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCircuitPeeringsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitPeeringsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitPeeringsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitPeeringsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitPeeringsDeleteFuture.Result. +func (future *ExpressRouteCircuitPeeringsDeleteFuture) result(client ExpressRouteCircuitPeeringsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitPeeringsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRouteCircuitPropertiesFormat properties of ExpressRouteCircuit. +type ExpressRouteCircuitPropertiesFormat struct { + // AllowClassicOperations - Allow classic operations. + AllowClassicOperations *bool `json:"allowClassicOperations,omitempty"` + // CircuitProvisioningState - The CircuitProvisioningState state of the resource. + CircuitProvisioningState *string `json:"circuitProvisioningState,omitempty"` + // ServiceProviderProvisioningState - The ServiceProviderProvisioningState state of the resource. Possible values include: 'ServiceProviderProvisioningStateNotProvisioned', 'ServiceProviderProvisioningStateProvisioning', 'ServiceProviderProvisioningStateProvisioned', 'ServiceProviderProvisioningStateDeprovisioning' + ServiceProviderProvisioningState ServiceProviderProvisioningState `json:"serviceProviderProvisioningState,omitempty"` + // Authorizations - The list of authorizations. + Authorizations *[]ExpressRouteCircuitAuthorization `json:"authorizations,omitempty"` + // Peerings - The list of peerings. + Peerings *[]ExpressRouteCircuitPeering `json:"peerings,omitempty"` + // ServiceKey - The ServiceKey. + ServiceKey *string `json:"serviceKey,omitempty"` + // ServiceProviderNotes - The ServiceProviderNotes. + ServiceProviderNotes *string `json:"serviceProviderNotes,omitempty"` + // ServiceProviderProperties - The ServiceProviderProperties. + ServiceProviderProperties *ExpressRouteCircuitServiceProviderProperties `json:"serviceProviderProperties,omitempty"` + // ExpressRoutePort - The reference to the ExpressRoutePort resource when the circuit is provisioned on an ExpressRoutePort resource. + ExpressRoutePort *SubResource `json:"expressRoutePort,omitempty"` + // BandwidthInGbps - The bandwidth of the circuit when the circuit is provisioned on an ExpressRoutePort resource. + BandwidthInGbps *float64 `json:"bandwidthInGbps,omitempty"` + // Stag - READ-ONLY; The identifier of the circuit traffic. Outer tag for QinQ encapsulation. + Stag *int32 `json:"stag,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route circuit resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // GatewayManagerEtag - The GatewayManager Etag. + GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` + // GlobalReachEnabled - Flag denoting global reach status. + GlobalReachEnabled *bool `json:"globalReachEnabled,omitempty"` + // AuthorizationKey - The authorizationKey. + AuthorizationKey *string `json:"authorizationKey,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuitPropertiesFormat. +func (ercpf ExpressRouteCircuitPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercpf.AllowClassicOperations != nil { + objectMap["allowClassicOperations"] = ercpf.AllowClassicOperations + } + if ercpf.CircuitProvisioningState != nil { + objectMap["circuitProvisioningState"] = ercpf.CircuitProvisioningState + } + if ercpf.ServiceProviderProvisioningState != "" { + objectMap["serviceProviderProvisioningState"] = ercpf.ServiceProviderProvisioningState + } + if ercpf.Authorizations != nil { + objectMap["authorizations"] = ercpf.Authorizations + } + if ercpf.Peerings != nil { + objectMap["peerings"] = ercpf.Peerings + } + if ercpf.ServiceKey != nil { + objectMap["serviceKey"] = ercpf.ServiceKey + } + if ercpf.ServiceProviderNotes != nil { + objectMap["serviceProviderNotes"] = ercpf.ServiceProviderNotes + } + if ercpf.ServiceProviderProperties != nil { + objectMap["serviceProviderProperties"] = ercpf.ServiceProviderProperties + } + if ercpf.ExpressRoutePort != nil { + objectMap["expressRoutePort"] = ercpf.ExpressRoutePort + } + if ercpf.BandwidthInGbps != nil { + objectMap["bandwidthInGbps"] = ercpf.BandwidthInGbps + } + if ercpf.GatewayManagerEtag != nil { + objectMap["gatewayManagerEtag"] = ercpf.GatewayManagerEtag + } + if ercpf.GlobalReachEnabled != nil { + objectMap["globalReachEnabled"] = ercpf.GlobalReachEnabled + } + if ercpf.AuthorizationKey != nil { + objectMap["authorizationKey"] = ercpf.AuthorizationKey + } + return json.Marshal(objectMap) +} + +// ExpressRouteCircuitReference reference to an express route circuit. +type ExpressRouteCircuitReference struct { + // ID - Corresponding Express Route Circuit Id. + ID *string `json:"id,omitempty"` +} + +// ExpressRouteCircuitRoutesTable the routes table associated with the ExpressRouteCircuit. +type ExpressRouteCircuitRoutesTable struct { + // NetworkProperty - IP address of a network entity. + NetworkProperty *string `json:"network,omitempty"` + // NextHop - NextHop address. + NextHop *string `json:"nextHop,omitempty"` + // LocPrf - Local preference value as set with the set local-preference route-map configuration command. + LocPrf *string `json:"locPrf,omitempty"` + // Weight - Route Weight. + Weight *int32 `json:"weight,omitempty"` + // Path - Autonomous system paths to the destination network. + Path *string `json:"path,omitempty"` +} + +// ExpressRouteCircuitRoutesTableSummary the routes table associated with the ExpressRouteCircuit. +type ExpressRouteCircuitRoutesTableSummary struct { + // Neighbor - IP address of the neighbor. + Neighbor *string `json:"neighbor,omitempty"` + // V - BGP version number spoken to the neighbor. + V *int32 `json:"v,omitempty"` + // As - Autonomous system number. + As *int32 `json:"as,omitempty"` + // UpDown - The length of time that the BGP session has been in the Established state, or the current status if not in the Established state. + UpDown *string `json:"upDown,omitempty"` + // StatePfxRcd - Current state of the BGP session, and the number of prefixes that have been received from a neighbor or peer group. + StatePfxRcd *string `json:"statePfxRcd,omitempty"` +} + +// ExpressRouteCircuitServiceProviderProperties contains ServiceProviderProperties in an +// ExpressRouteCircuit. +type ExpressRouteCircuitServiceProviderProperties struct { + // ServiceProviderName - The serviceProviderName. + ServiceProviderName *string `json:"serviceProviderName,omitempty"` + // PeeringLocation - The peering location. + PeeringLocation *string `json:"peeringLocation,omitempty"` + // BandwidthInMbps - The BandwidthInMbps. + BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"` +} + +// ExpressRouteCircuitSku contains SKU in an ExpressRouteCircuit. +type ExpressRouteCircuitSku struct { + // Name - The name of the SKU. + Name *string `json:"name,omitempty"` + // Tier - The tier of the SKU. Possible values include: 'ExpressRouteCircuitSkuTierStandard', 'ExpressRouteCircuitSkuTierPremium', 'ExpressRouteCircuitSkuTierBasic', 'ExpressRouteCircuitSkuTierLocal' + Tier ExpressRouteCircuitSkuTier `json:"tier,omitempty"` + // Family - The family of the SKU. Possible values include: 'ExpressRouteCircuitSkuFamilyUnlimitedData', 'ExpressRouteCircuitSkuFamilyMeteredData' + Family ExpressRouteCircuitSkuFamily `json:"family,omitempty"` +} + +// ExpressRouteCircuitStats contains stats associated with the peering. +type ExpressRouteCircuitStats struct { + autorest.Response `json:"-"` + // PrimarybytesIn - The Primary BytesIn of the peering. + PrimarybytesIn *int64 `json:"primarybytesIn,omitempty"` + // PrimarybytesOut - The primary BytesOut of the peering. + PrimarybytesOut *int64 `json:"primarybytesOut,omitempty"` + // SecondarybytesIn - The secondary BytesIn of the peering. + SecondarybytesIn *int64 `json:"secondarybytesIn,omitempty"` + // SecondarybytesOut - The secondary BytesOut of the peering. + SecondarybytesOut *int64 `json:"secondarybytesOut,omitempty"` +} + +// ExpressRouteCircuitsArpTableListResult response for ListArpTable associated with the Express Route +// Circuits API. +type ExpressRouteCircuitsArpTableListResult struct { + autorest.Response `json:"-"` + // Value - A list of the ARP tables. + Value *[]ExpressRouteCircuitArpTable `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitsClient) (ExpressRouteCircuit, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitsCreateOrUpdateFuture.Result. +func (future *ExpressRouteCircuitsCreateOrUpdateFuture) result(client ExpressRouteCircuitsClient) (erc ExpressRouteCircuit, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erc.Response.Response, err = future.GetResult(sender); err == nil && erc.Response.Response.StatusCode != http.StatusNoContent { + erc, err = client.CreateOrUpdateResponder(erc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", erc.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCircuitsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitsDeleteFuture.Result. +func (future *ExpressRouteCircuitsDeleteFuture) result(client ExpressRouteCircuitsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRouteCircuitsListArpTableFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitsListArpTableFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitsClient) (ExpressRouteCircuitsArpTableListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitsListArpTableFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitsListArpTableFuture.Result. +func (future *ExpressRouteCircuitsListArpTableFuture) result(client ExpressRouteCircuitsClient) (ercatlr ExpressRouteCircuitsArpTableListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercatlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListArpTableFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercatlr.Response.Response, err = future.GetResult(sender); err == nil && ercatlr.Response.Response.StatusCode != http.StatusNoContent { + ercatlr, err = client.ListArpTableResponder(ercatlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", ercatlr.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCircuitsListRoutesTableFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitsListRoutesTableFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitsClient) (ExpressRouteCircuitsRoutesTableListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitsListRoutesTableFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitsListRoutesTableFuture.Result. +func (future *ExpressRouteCircuitsListRoutesTableFuture) result(client ExpressRouteCircuitsClient) (ercrtlr ExpressRouteCircuitsRoutesTableListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercrtlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListRoutesTableFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercrtlr.Response.Response, err = future.GetResult(sender); err == nil && ercrtlr.Response.Response.StatusCode != http.StatusNoContent { + ercrtlr, err = client.ListRoutesTableResponder(ercrtlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", ercrtlr.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCircuitsListRoutesTableSummaryFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExpressRouteCircuitsListRoutesTableSummaryFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitsClient) (ExpressRouteCircuitsRoutesTableSummaryListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitsListRoutesTableSummaryFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitsListRoutesTableSummaryFuture.Result. +func (future *ExpressRouteCircuitsListRoutesTableSummaryFuture) result(client ExpressRouteCircuitsClient) (ercrtslr ExpressRouteCircuitsRoutesTableSummaryListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercrtslr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListRoutesTableSummaryFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercrtslr.Response.Response, err = future.GetResult(sender); err == nil && ercrtslr.Response.Response.StatusCode != http.StatusNoContent { + ercrtslr, err = client.ListRoutesTableSummaryResponder(ercrtslr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", ercrtslr.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCircuitsRoutesTableListResult response for ListRoutesTable associated with the Express Route +// Circuits API. +type ExpressRouteCircuitsRoutesTableListResult struct { + autorest.Response `json:"-"` + // Value - The list of routes table. + Value *[]ExpressRouteCircuitRoutesTable `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitsRoutesTableSummaryListResult response for ListRoutesTable associated with the +// Express Route Circuits API. +type ExpressRouteCircuitsRoutesTableSummaryListResult struct { + autorest.Response `json:"-"` + // Value - A list of the routes table. + Value *[]ExpressRouteCircuitRoutesTableSummary `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteConnection expressRouteConnection resource. +type ExpressRouteConnection struct { + autorest.Response `json:"-"` + // ExpressRouteConnectionProperties - Properties of the express route connection. + *ExpressRouteConnectionProperties `json:"properties,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteConnection. +func (erc ExpressRouteConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erc.ExpressRouteConnectionProperties != nil { + objectMap["properties"] = erc.ExpressRouteConnectionProperties + } + if erc.Name != nil { + objectMap["name"] = erc.Name + } + if erc.ID != nil { + objectMap["id"] = erc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteConnection struct. +func (erc *ExpressRouteConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteConnectionProperties ExpressRouteConnectionProperties + err = json.Unmarshal(*v, &expressRouteConnectionProperties) + if err != nil { + return err + } + erc.ExpressRouteConnectionProperties = &expressRouteConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erc.Name = &name + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erc.ID = &ID + } + } + } + + return nil +} + +// ExpressRouteConnectionID the ID of the ExpressRouteConnection. +type ExpressRouteConnectionID struct { + // ID - READ-ONLY; The ID of the ExpressRouteConnection. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteConnectionID. +func (erci ExpressRouteConnectionID) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExpressRouteConnectionList expressRouteConnection list. +type ExpressRouteConnectionList struct { + autorest.Response `json:"-"` + // Value - The list of ExpressRoute connections. + Value *[]ExpressRouteConnection `json:"value,omitempty"` +} + +// ExpressRouteConnectionProperties properties of the ExpressRouteConnection subresource. +type ExpressRouteConnectionProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the express route connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ExpressRouteCircuitPeering - The ExpressRoute circuit peering. + ExpressRouteCircuitPeering *ExpressRouteCircuitPeeringID `json:"expressRouteCircuitPeering,omitempty"` + // AuthorizationKey - Authorization key to establish the connection. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + // RoutingWeight - The routing weight associated to the connection. + RoutingWeight *int32 `json:"routingWeight,omitempty"` + // EnableInternetSecurity - Enable internet security. + EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` + // ExpressRouteGatewayBypass - Enable FastPath to vWan Firewall hub. + ExpressRouteGatewayBypass *bool `json:"expressRouteGatewayBypass,omitempty"` + // EnablePrivateLinkFastPath - Bypass the ExpressRoute gateway when accessing private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be enabled. + EnablePrivateLinkFastPath *bool `json:"enablePrivateLinkFastPath,omitempty"` + // RoutingConfiguration - The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteConnectionProperties. +func (ercp ExpressRouteConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercp.ExpressRouteCircuitPeering != nil { + objectMap["expressRouteCircuitPeering"] = ercp.ExpressRouteCircuitPeering + } + if ercp.AuthorizationKey != nil { + objectMap["authorizationKey"] = ercp.AuthorizationKey + } + if ercp.RoutingWeight != nil { + objectMap["routingWeight"] = ercp.RoutingWeight + } + if ercp.EnableInternetSecurity != nil { + objectMap["enableInternetSecurity"] = ercp.EnableInternetSecurity + } + if ercp.ExpressRouteGatewayBypass != nil { + objectMap["expressRouteGatewayBypass"] = ercp.ExpressRouteGatewayBypass + } + if ercp.EnablePrivateLinkFastPath != nil { + objectMap["enablePrivateLinkFastPath"] = ercp.EnablePrivateLinkFastPath + } + if ercp.RoutingConfiguration != nil { + objectMap["routingConfiguration"] = ercp.RoutingConfiguration + } + return json.Marshal(objectMap) +} + +// ExpressRouteConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type ExpressRouteConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteConnectionsClient) (ExpressRouteConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteConnectionsCreateOrUpdateFuture.Result. +func (future *ExpressRouteConnectionsCreateOrUpdateFuture) result(client ExpressRouteConnectionsClient) (erc ExpressRouteConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erc.Response.Response, err = future.GetResult(sender); err == nil && erc.Response.Response.StatusCode != http.StatusNoContent { + erc, err = client.CreateOrUpdateResponder(erc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsCreateOrUpdateFuture", "Result", erc.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteConnectionsDeleteFuture.Result. +func (future *ExpressRouteConnectionsDeleteFuture) result(client ExpressRouteConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRouteCrossConnection expressRouteCrossConnection resource. +type ExpressRouteCrossConnection struct { + autorest.Response `json:"-"` + // ExpressRouteCrossConnectionProperties - Properties of the express route cross connection. + *ExpressRouteCrossConnectionProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnection. +func (ercc ExpressRouteCrossConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercc.ExpressRouteCrossConnectionProperties != nil { + objectMap["properties"] = ercc.ExpressRouteCrossConnectionProperties + } + if ercc.ID != nil { + objectMap["id"] = ercc.ID + } + if ercc.Location != nil { + objectMap["location"] = ercc.Location + } + if ercc.Tags != nil { + objectMap["tags"] = ercc.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteCrossConnection struct. +func (ercc *ExpressRouteCrossConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteCrossConnectionProperties ExpressRouteCrossConnectionProperties + err = json.Unmarshal(*v, &expressRouteCrossConnectionProperties) + if err != nil { + return err + } + ercc.ExpressRouteCrossConnectionProperties = &expressRouteCrossConnectionProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ercc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ercc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ercc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ercc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ercc.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ercc.Tags = tags + } + } + } + + return nil +} + +// ExpressRouteCrossConnectionListResult response for ListExpressRouteCrossConnection API service call. +type ExpressRouteCrossConnectionListResult struct { + autorest.Response `json:"-"` + // Value - A list of ExpressRouteCrossConnection resources. + Value *[]ExpressRouteCrossConnection `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionListResult. +func (ercclr ExpressRouteCrossConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercclr.Value != nil { + objectMap["value"] = ercclr.Value + } + return json.Marshal(objectMap) +} + +// ExpressRouteCrossConnectionListResultIterator provides access to a complete listing of +// ExpressRouteCrossConnection values. +type ExpressRouteCrossConnectionListResultIterator struct { + i int + page ExpressRouteCrossConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRouteCrossConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRouteCrossConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRouteCrossConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRouteCrossConnectionListResultIterator) Response() ExpressRouteCrossConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRouteCrossConnectionListResultIterator) Value() ExpressRouteCrossConnection { + if !iter.page.NotDone() { + return ExpressRouteCrossConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRouteCrossConnectionListResultIterator type. +func NewExpressRouteCrossConnectionListResultIterator(page ExpressRouteCrossConnectionListResultPage) ExpressRouteCrossConnectionListResultIterator { + return ExpressRouteCrossConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ercclr ExpressRouteCrossConnectionListResult) IsEmpty() bool { + return ercclr.Value == nil || len(*ercclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ercclr ExpressRouteCrossConnectionListResult) hasNextLink() bool { + return ercclr.NextLink != nil && len(*ercclr.NextLink) != 0 +} + +// expressRouteCrossConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ercclr ExpressRouteCrossConnectionListResult) expressRouteCrossConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ercclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ercclr.NextLink))) +} + +// ExpressRouteCrossConnectionListResultPage contains a page of ExpressRouteCrossConnection values. +type ExpressRouteCrossConnectionListResultPage struct { + fn func(context.Context, ExpressRouteCrossConnectionListResult) (ExpressRouteCrossConnectionListResult, error) + ercclr ExpressRouteCrossConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRouteCrossConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ercclr) + if err != nil { + return err + } + page.ercclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRouteCrossConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRouteCrossConnectionListResultPage) NotDone() bool { + return !page.ercclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRouteCrossConnectionListResultPage) Response() ExpressRouteCrossConnectionListResult { + return page.ercclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRouteCrossConnectionListResultPage) Values() []ExpressRouteCrossConnection { + if page.ercclr.IsEmpty() { + return nil + } + return *page.ercclr.Value +} + +// Creates a new instance of the ExpressRouteCrossConnectionListResultPage type. +func NewExpressRouteCrossConnectionListResultPage(cur ExpressRouteCrossConnectionListResult, getNextPage func(context.Context, ExpressRouteCrossConnectionListResult) (ExpressRouteCrossConnectionListResult, error)) ExpressRouteCrossConnectionListResultPage { + return ExpressRouteCrossConnectionListResultPage{ + fn: getNextPage, + ercclr: cur, + } +} + +// ExpressRouteCrossConnectionPeering peering in an ExpressRoute Cross Connection resource. +type ExpressRouteCrossConnectionPeering struct { + autorest.Response `json:"-"` + // ExpressRouteCrossConnectionPeeringProperties - Properties of the express route cross connection peering. + *ExpressRouteCrossConnectionPeeringProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionPeering. +func (erccp ExpressRouteCrossConnectionPeering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erccp.ExpressRouteCrossConnectionPeeringProperties != nil { + objectMap["properties"] = erccp.ExpressRouteCrossConnectionPeeringProperties + } + if erccp.Name != nil { + objectMap["name"] = erccp.Name + } + if erccp.ID != nil { + objectMap["id"] = erccp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteCrossConnectionPeering struct. +func (erccp *ExpressRouteCrossConnectionPeering) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteCrossConnectionPeeringProperties ExpressRouteCrossConnectionPeeringProperties + err = json.Unmarshal(*v, &expressRouteCrossConnectionPeeringProperties) + if err != nil { + return err + } + erccp.ExpressRouteCrossConnectionPeeringProperties = &expressRouteCrossConnectionPeeringProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erccp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + erccp.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erccp.ID = &ID + } + } + } + + return nil +} + +// ExpressRouteCrossConnectionPeeringList response for ListPeering API service call retrieves all peerings +// that belong to an ExpressRouteCrossConnection. +type ExpressRouteCrossConnectionPeeringList struct { + autorest.Response `json:"-"` + // Value - The peerings in an express route cross connection. + Value *[]ExpressRouteCrossConnectionPeering `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionPeeringList. +func (erccpl ExpressRouteCrossConnectionPeeringList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erccpl.Value != nil { + objectMap["value"] = erccpl.Value + } + return json.Marshal(objectMap) +} + +// ExpressRouteCrossConnectionPeeringListIterator provides access to a complete listing of +// ExpressRouteCrossConnectionPeering values. +type ExpressRouteCrossConnectionPeeringListIterator struct { + i int + page ExpressRouteCrossConnectionPeeringListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRouteCrossConnectionPeeringListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionPeeringListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRouteCrossConnectionPeeringListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRouteCrossConnectionPeeringListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRouteCrossConnectionPeeringListIterator) Response() ExpressRouteCrossConnectionPeeringList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRouteCrossConnectionPeeringListIterator) Value() ExpressRouteCrossConnectionPeering { + if !iter.page.NotDone() { + return ExpressRouteCrossConnectionPeering{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRouteCrossConnectionPeeringListIterator type. +func NewExpressRouteCrossConnectionPeeringListIterator(page ExpressRouteCrossConnectionPeeringListPage) ExpressRouteCrossConnectionPeeringListIterator { + return ExpressRouteCrossConnectionPeeringListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (erccpl ExpressRouteCrossConnectionPeeringList) IsEmpty() bool { + return erccpl.Value == nil || len(*erccpl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (erccpl ExpressRouteCrossConnectionPeeringList) hasNextLink() bool { + return erccpl.NextLink != nil && len(*erccpl.NextLink) != 0 +} + +// expressRouteCrossConnectionPeeringListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (erccpl ExpressRouteCrossConnectionPeeringList) expressRouteCrossConnectionPeeringListPreparer(ctx context.Context) (*http.Request, error) { + if !erccpl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(erccpl.NextLink))) +} + +// ExpressRouteCrossConnectionPeeringListPage contains a page of ExpressRouteCrossConnectionPeering values. +type ExpressRouteCrossConnectionPeeringListPage struct { + fn func(context.Context, ExpressRouteCrossConnectionPeeringList) (ExpressRouteCrossConnectionPeeringList, error) + erccpl ExpressRouteCrossConnectionPeeringList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRouteCrossConnectionPeeringListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionPeeringListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.erccpl) + if err != nil { + return err + } + page.erccpl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRouteCrossConnectionPeeringListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRouteCrossConnectionPeeringListPage) NotDone() bool { + return !page.erccpl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRouteCrossConnectionPeeringListPage) Response() ExpressRouteCrossConnectionPeeringList { + return page.erccpl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRouteCrossConnectionPeeringListPage) Values() []ExpressRouteCrossConnectionPeering { + if page.erccpl.IsEmpty() { + return nil + } + return *page.erccpl.Value +} + +// Creates a new instance of the ExpressRouteCrossConnectionPeeringListPage type. +func NewExpressRouteCrossConnectionPeeringListPage(cur ExpressRouteCrossConnectionPeeringList, getNextPage func(context.Context, ExpressRouteCrossConnectionPeeringList) (ExpressRouteCrossConnectionPeeringList, error)) ExpressRouteCrossConnectionPeeringListPage { + return ExpressRouteCrossConnectionPeeringListPage{ + fn: getNextPage, + erccpl: cur, + } +} + +// ExpressRouteCrossConnectionPeeringProperties properties of express route cross connection peering. +type ExpressRouteCrossConnectionPeeringProperties struct { + // PeeringType - The peering type. Possible values include: 'ExpressRoutePeeringTypeAzurePublicPeering', 'ExpressRoutePeeringTypeAzurePrivatePeering', 'ExpressRoutePeeringTypeMicrosoftPeering' + PeeringType ExpressRoutePeeringType `json:"peeringType,omitempty"` + // State - The peering state. Possible values include: 'ExpressRoutePeeringStateDisabled', 'ExpressRoutePeeringStateEnabled' + State ExpressRoutePeeringState `json:"state,omitempty"` + // AzureASN - READ-ONLY; The Azure ASN. + AzureASN *int32 `json:"azureASN,omitempty"` + // PeerASN - The peer ASN. + PeerASN *int64 `json:"peerASN,omitempty"` + // PrimaryPeerAddressPrefix - The primary address prefix. + PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` + // SecondaryPeerAddressPrefix - The secondary address prefix. + SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"` + // PrimaryAzurePort - READ-ONLY; The primary port. + PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` + // SecondaryAzurePort - READ-ONLY; The secondary port. + SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` + // SharedKey - The shared key. + SharedKey *string `json:"sharedKey,omitempty"` + // VlanID - The VLAN ID. + VlanID *int32 `json:"vlanId,omitempty"` + // MicrosoftPeeringConfig - The Microsoft peering configuration. + MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route cross connection peering resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // GatewayManagerEtag - The GatewayManager Etag. + GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` + // LastModifiedBy - READ-ONLY; Who was the last to modify the peering. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // Ipv6PeeringConfig - The IPv6 peering configuration. + Ipv6PeeringConfig *Ipv6ExpressRouteCircuitPeeringConfig `json:"ipv6PeeringConfig,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionPeeringProperties. +func (erccpp ExpressRouteCrossConnectionPeeringProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erccpp.PeeringType != "" { + objectMap["peeringType"] = erccpp.PeeringType + } + if erccpp.State != "" { + objectMap["state"] = erccpp.State + } + if erccpp.PeerASN != nil { + objectMap["peerASN"] = erccpp.PeerASN + } + if erccpp.PrimaryPeerAddressPrefix != nil { + objectMap["primaryPeerAddressPrefix"] = erccpp.PrimaryPeerAddressPrefix + } + if erccpp.SecondaryPeerAddressPrefix != nil { + objectMap["secondaryPeerAddressPrefix"] = erccpp.SecondaryPeerAddressPrefix + } + if erccpp.SharedKey != nil { + objectMap["sharedKey"] = erccpp.SharedKey + } + if erccpp.VlanID != nil { + objectMap["vlanId"] = erccpp.VlanID + } + if erccpp.MicrosoftPeeringConfig != nil { + objectMap["microsoftPeeringConfig"] = erccpp.MicrosoftPeeringConfig + } + if erccpp.GatewayManagerEtag != nil { + objectMap["gatewayManagerEtag"] = erccpp.GatewayManagerEtag + } + if erccpp.Ipv6PeeringConfig != nil { + objectMap["ipv6PeeringConfig"] = erccpp.Ipv6PeeringConfig + } + return json.Marshal(objectMap) +} + +// ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCrossConnectionPeeringsClient) (ExpressRouteCrossConnectionPeering, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture.Result. +func (future *ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture) result(client ExpressRouteCrossConnectionPeeringsClient) (erccp ExpressRouteCrossConnectionPeering, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erccp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erccp.Response.Response, err = future.GetResult(sender); err == nil && erccp.Response.Response.StatusCode != http.StatusNoContent { + erccp, err = client.CreateOrUpdateResponder(erccp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture", "Result", erccp.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCrossConnectionPeeringsDeleteFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ExpressRouteCrossConnectionPeeringsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCrossConnectionPeeringsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCrossConnectionPeeringsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCrossConnectionPeeringsDeleteFuture.Result. +func (future *ExpressRouteCrossConnectionPeeringsDeleteFuture) result(client ExpressRouteCrossConnectionPeeringsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionPeeringsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRouteCrossConnectionProperties properties of ExpressRouteCrossConnection. +type ExpressRouteCrossConnectionProperties struct { + // PrimaryAzurePort - READ-ONLY; The name of the primary port. + PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` + // SecondaryAzurePort - READ-ONLY; The name of the secondary port. + SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` + // STag - READ-ONLY; The identifier of the circuit traffic. + STag *int32 `json:"sTag,omitempty"` + // PeeringLocation - READ-ONLY; The peering location of the ExpressRoute circuit. + PeeringLocation *string `json:"peeringLocation,omitempty"` + // BandwidthInMbps - READ-ONLY; The circuit bandwidth In Mbps. + BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"` + // ExpressRouteCircuit - The ExpressRouteCircuit. + ExpressRouteCircuit *ExpressRouteCircuitReference `json:"expressRouteCircuit,omitempty"` + // ServiceProviderProvisioningState - The provisioning state of the circuit in the connectivity provider system. Possible values include: 'ServiceProviderProvisioningStateNotProvisioned', 'ServiceProviderProvisioningStateProvisioning', 'ServiceProviderProvisioningStateProvisioned', 'ServiceProviderProvisioningStateDeprovisioning' + ServiceProviderProvisioningState ServiceProviderProvisioningState `json:"serviceProviderProvisioningState,omitempty"` + // ServiceProviderNotes - Additional read only notes set by the connectivity provider. + ServiceProviderNotes *string `json:"serviceProviderNotes,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route cross connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Peerings - The list of peerings. + Peerings *[]ExpressRouteCrossConnectionPeering `json:"peerings,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionProperties. +func (erccp ExpressRouteCrossConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erccp.ExpressRouteCircuit != nil { + objectMap["expressRouteCircuit"] = erccp.ExpressRouteCircuit + } + if erccp.ServiceProviderProvisioningState != "" { + objectMap["serviceProviderProvisioningState"] = erccp.ServiceProviderProvisioningState + } + if erccp.ServiceProviderNotes != nil { + objectMap["serviceProviderNotes"] = erccp.ServiceProviderNotes + } + if erccp.Peerings != nil { + objectMap["peerings"] = erccp.Peerings + } + return json.Marshal(objectMap) +} + +// ExpressRouteCrossConnectionRoutesTableSummary the routes table associated with the ExpressRouteCircuit. +type ExpressRouteCrossConnectionRoutesTableSummary struct { + // Neighbor - IP address of Neighbor router. + Neighbor *string `json:"neighbor,omitempty"` + // Asn - Autonomous system number. + Asn *int32 `json:"asn,omitempty"` + // UpDown - The length of time that the BGP session has been in the Established state, or the current status if not in the Established state. + UpDown *string `json:"upDown,omitempty"` + // StateOrPrefixesReceived - Current state of the BGP session, and the number of prefixes that have been received from a neighbor or peer group. + StateOrPrefixesReceived *string `json:"stateOrPrefixesReceived,omitempty"` +} + +// ExpressRouteCrossConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExpressRouteCrossConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCrossConnectionsClient) (ExpressRouteCrossConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCrossConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCrossConnectionsCreateOrUpdateFuture.Result. +func (future *ExpressRouteCrossConnectionsCreateOrUpdateFuture) result(client ExpressRouteCrossConnectionsClient) (ercc ExpressRouteCrossConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercc.Response.Response, err = future.GetResult(sender); err == nil && ercc.Response.Response.StatusCode != http.StatusNoContent { + ercc, err = client.CreateOrUpdateResponder(ercc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsCreateOrUpdateFuture", "Result", ercc.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCrossConnectionsListArpTableFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ExpressRouteCrossConnectionsListArpTableFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCrossConnectionsClient) (ExpressRouteCircuitsArpTableListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCrossConnectionsListArpTableFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCrossConnectionsListArpTableFuture.Result. +func (future *ExpressRouteCrossConnectionsListArpTableFuture) result(client ExpressRouteCrossConnectionsClient) (ercatlr ExpressRouteCircuitsArpTableListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListArpTableFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercatlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsListArpTableFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercatlr.Response.Response, err = future.GetResult(sender); err == nil && ercatlr.Response.Response.StatusCode != http.StatusNoContent { + ercatlr, err = client.ListArpTableResponder(ercatlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListArpTableFuture", "Result", ercatlr.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCrossConnectionsListRoutesTableFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExpressRouteCrossConnectionsListRoutesTableFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCrossConnectionsClient) (ExpressRouteCircuitsRoutesTableListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCrossConnectionsListRoutesTableFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCrossConnectionsListRoutesTableFuture.Result. +func (future *ExpressRouteCrossConnectionsListRoutesTableFuture) result(client ExpressRouteCrossConnectionsClient) (ercrtlr ExpressRouteCircuitsRoutesTableListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercrtlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsListRoutesTableFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercrtlr.Response.Response, err = future.GetResult(sender); err == nil && ercrtlr.Response.Response.StatusCode != http.StatusNoContent { + ercrtlr, err = client.ListRoutesTableResponder(ercrtlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableFuture", "Result", ercrtlr.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCrossConnectionsListRoutesTableSummaryFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type ExpressRouteCrossConnectionsListRoutesTableSummaryFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCrossConnectionsClient) (ExpressRouteCrossConnectionsRoutesTableSummaryListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCrossConnectionsListRoutesTableSummaryFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCrossConnectionsListRoutesTableSummaryFuture.Result. +func (future *ExpressRouteCrossConnectionsListRoutesTableSummaryFuture) result(client ExpressRouteCrossConnectionsClient) (erccrtslr ExpressRouteCrossConnectionsRoutesTableSummaryListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erccrtslr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erccrtslr.Response.Response, err = future.GetResult(sender); err == nil && erccrtslr.Response.Response.StatusCode != http.StatusNoContent { + erccrtslr, err = client.ListRoutesTableSummaryResponder(erccrtslr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture", "Result", erccrtslr.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCrossConnectionsRoutesTableSummaryListResult response for ListRoutesTable associated with +// the Express Route Cross Connections. +type ExpressRouteCrossConnectionsRoutesTableSummaryListResult struct { + autorest.Response `json:"-"` + // Value - A list of the routes table. + Value *[]ExpressRouteCrossConnectionRoutesTableSummary `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionsRoutesTableSummaryListResult. +func (erccrtslr ExpressRouteCrossConnectionsRoutesTableSummaryListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erccrtslr.Value != nil { + objectMap["value"] = erccrtslr.Value + } + return json.Marshal(objectMap) +} + +// ExpressRouteGateway expressRoute gateway resource. +type ExpressRouteGateway struct { + autorest.Response `json:"-"` + // ExpressRouteGatewayProperties - Properties of the express route gateway. + *ExpressRouteGatewayProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteGateway. +func (erg ExpressRouteGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erg.ExpressRouteGatewayProperties != nil { + objectMap["properties"] = erg.ExpressRouteGatewayProperties + } + if erg.ID != nil { + objectMap["id"] = erg.ID + } + if erg.Location != nil { + objectMap["location"] = erg.Location + } + if erg.Tags != nil { + objectMap["tags"] = erg.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteGateway struct. +func (erg *ExpressRouteGateway) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteGatewayProperties ExpressRouteGatewayProperties + err = json.Unmarshal(*v, &expressRouteGatewayProperties) + if err != nil { + return err + } + erg.ExpressRouteGatewayProperties = &expressRouteGatewayProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + erg.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + erg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + erg.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + erg.Tags = tags + } + } + } + + return nil +} + +// ExpressRouteGatewayList list of ExpressRoute gateways. +type ExpressRouteGatewayList struct { + autorest.Response `json:"-"` + // Value - List of ExpressRoute gateways. + Value *[]ExpressRouteGateway `json:"value,omitempty"` +} + +// ExpressRouteGatewayProperties expressRoute gateway resource properties. +type ExpressRouteGatewayProperties struct { + // AutoScaleConfiguration - Configuration for auto scaling. + AutoScaleConfiguration *ExpressRouteGatewayPropertiesAutoScaleConfiguration `json:"autoScaleConfiguration,omitempty"` + // ExpressRouteConnections - List of ExpressRoute connections to the ExpressRoute gateway. + ExpressRouteConnections *[]ExpressRouteConnection `json:"expressRouteConnections,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // VirtualHub - The Virtual Hub where the ExpressRoute gateway is or will be deployed. + VirtualHub *VirtualHubID `json:"virtualHub,omitempty"` + // AllowNonVirtualWanTraffic - Configures this gateway to accept traffic from non Virtual WAN networks. + AllowNonVirtualWanTraffic *bool `json:"allowNonVirtualWanTraffic,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteGatewayProperties. +func (ergp ExpressRouteGatewayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ergp.AutoScaleConfiguration != nil { + objectMap["autoScaleConfiguration"] = ergp.AutoScaleConfiguration + } + if ergp.ExpressRouteConnections != nil { + objectMap["expressRouteConnections"] = ergp.ExpressRouteConnections + } + if ergp.VirtualHub != nil { + objectMap["virtualHub"] = ergp.VirtualHub + } + if ergp.AllowNonVirtualWanTraffic != nil { + objectMap["allowNonVirtualWanTraffic"] = ergp.AllowNonVirtualWanTraffic + } + return json.Marshal(objectMap) +} + +// ExpressRouteGatewayPropertiesAutoScaleConfiguration configuration for auto scaling. +type ExpressRouteGatewayPropertiesAutoScaleConfiguration struct { + // Bounds - Minimum and maximum number of scale units to deploy. + Bounds *ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds `json:"bounds,omitempty"` +} + +// ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds minimum and maximum number of scale units to +// deploy. +type ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds struct { + // Min - Minimum number of scale units deployed for ExpressRoute gateway. + Min *int32 `json:"min,omitempty"` + // Max - Maximum number of scale units deployed for ExpressRoute gateway. + Max *int32 `json:"max,omitempty"` +} + +// ExpressRouteGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteGatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteGatewaysClient) (ExpressRouteGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteGatewaysCreateOrUpdateFuture.Result. +func (future *ExpressRouteGatewaysCreateOrUpdateFuture) result(client ExpressRouteGatewaysClient) (erg ExpressRouteGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteGatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erg.Response.Response, err = future.GetResult(sender); err == nil && erg.Response.Response.StatusCode != http.StatusNoContent { + erg, err = client.CreateOrUpdateResponder(erg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysCreateOrUpdateFuture", "Result", erg.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteGatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteGatewaysDeleteFuture.Result. +func (future *ExpressRouteGatewaysDeleteFuture) result(client ExpressRouteGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteGatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRouteGatewaysUpdateTagsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteGatewaysUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteGatewaysClient) (ExpressRouteGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteGatewaysUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteGatewaysUpdateTagsFuture.Result. +func (future *ExpressRouteGatewaysUpdateTagsFuture) result(client ExpressRouteGatewaysClient) (erg ExpressRouteGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteGatewaysUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erg.Response.Response, err = future.GetResult(sender); err == nil && erg.Response.Response.StatusCode != http.StatusNoContent { + erg, err = client.UpdateTagsResponder(erg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysUpdateTagsFuture", "Result", erg.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteLink expressRouteLink child resource definition. +type ExpressRouteLink struct { + autorest.Response `json:"-"` + // ExpressRouteLinkPropertiesFormat - ExpressRouteLink properties. + *ExpressRouteLinkPropertiesFormat `json:"properties,omitempty"` + // Name - Name of child port resource that is unique among child port resources of the parent. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteLink. +func (erl ExpressRouteLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erl.ExpressRouteLinkPropertiesFormat != nil { + objectMap["properties"] = erl.ExpressRouteLinkPropertiesFormat + } + if erl.Name != nil { + objectMap["name"] = erl.Name + } + if erl.ID != nil { + objectMap["id"] = erl.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteLink struct. +func (erl *ExpressRouteLink) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteLinkPropertiesFormat ExpressRouteLinkPropertiesFormat + err = json.Unmarshal(*v, &expressRouteLinkPropertiesFormat) + if err != nil { + return err + } + erl.ExpressRouteLinkPropertiesFormat = &expressRouteLinkPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erl.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + erl.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erl.ID = &ID + } + } + } + + return nil +} + +// ExpressRouteLinkListResult response for ListExpressRouteLinks API service call. +type ExpressRouteLinkListResult struct { + autorest.Response `json:"-"` + // Value - The list of ExpressRouteLink sub-resources. + Value *[]ExpressRouteLink `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteLinkListResultIterator provides access to a complete listing of ExpressRouteLink values. +type ExpressRouteLinkListResultIterator struct { + i int + page ExpressRouteLinkListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRouteLinkListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteLinkListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRouteLinkListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRouteLinkListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRouteLinkListResultIterator) Response() ExpressRouteLinkListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRouteLinkListResultIterator) Value() ExpressRouteLink { + if !iter.page.NotDone() { + return ExpressRouteLink{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRouteLinkListResultIterator type. +func NewExpressRouteLinkListResultIterator(page ExpressRouteLinkListResultPage) ExpressRouteLinkListResultIterator { + return ExpressRouteLinkListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (erllr ExpressRouteLinkListResult) IsEmpty() bool { + return erllr.Value == nil || len(*erllr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (erllr ExpressRouteLinkListResult) hasNextLink() bool { + return erllr.NextLink != nil && len(*erllr.NextLink) != 0 +} + +// expressRouteLinkListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (erllr ExpressRouteLinkListResult) expressRouteLinkListResultPreparer(ctx context.Context) (*http.Request, error) { + if !erllr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(erllr.NextLink))) +} + +// ExpressRouteLinkListResultPage contains a page of ExpressRouteLink values. +type ExpressRouteLinkListResultPage struct { + fn func(context.Context, ExpressRouteLinkListResult) (ExpressRouteLinkListResult, error) + erllr ExpressRouteLinkListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRouteLinkListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteLinkListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.erllr) + if err != nil { + return err + } + page.erllr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRouteLinkListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRouteLinkListResultPage) NotDone() bool { + return !page.erllr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRouteLinkListResultPage) Response() ExpressRouteLinkListResult { + return page.erllr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRouteLinkListResultPage) Values() []ExpressRouteLink { + if page.erllr.IsEmpty() { + return nil + } + return *page.erllr.Value +} + +// Creates a new instance of the ExpressRouteLinkListResultPage type. +func NewExpressRouteLinkListResultPage(cur ExpressRouteLinkListResult, getNextPage func(context.Context, ExpressRouteLinkListResult) (ExpressRouteLinkListResult, error)) ExpressRouteLinkListResultPage { + return ExpressRouteLinkListResultPage{ + fn: getNextPage, + erllr: cur, + } +} + +// ExpressRouteLinkMacSecConfig expressRouteLink Mac Security Configuration. +type ExpressRouteLinkMacSecConfig struct { + // CknSecretIdentifier - Keyvault Secret Identifier URL containing Mac security CKN key. + CknSecretIdentifier *string `json:"cknSecretIdentifier,omitempty"` + // CakSecretIdentifier - Keyvault Secret Identifier URL containing Mac security CAK key. + CakSecretIdentifier *string `json:"cakSecretIdentifier,omitempty"` + // Cipher - Mac security cipher. Possible values include: 'ExpressRouteLinkMacSecCipherGcmAes256', 'ExpressRouteLinkMacSecCipherGcmAes128', 'ExpressRouteLinkMacSecCipherGcmAesXpn128', 'ExpressRouteLinkMacSecCipherGcmAesXpn256' + Cipher ExpressRouteLinkMacSecCipher `json:"cipher,omitempty"` + // SciState - Sci mode enabled/disabled. Possible values include: 'ExpressRouteLinkMacSecSciStateDisabled', 'ExpressRouteLinkMacSecSciStateEnabled' + SciState ExpressRouteLinkMacSecSciState `json:"sciState,omitempty"` +} + +// ExpressRouteLinkPropertiesFormat properties specific to ExpressRouteLink resources. +type ExpressRouteLinkPropertiesFormat struct { + // RouterName - READ-ONLY; Name of Azure router associated with physical port. + RouterName *string `json:"routerName,omitempty"` + // InterfaceName - READ-ONLY; Name of Azure router interface. + InterfaceName *string `json:"interfaceName,omitempty"` + // PatchPanelID - READ-ONLY; Mapping between physical port to patch panel port. + PatchPanelID *string `json:"patchPanelId,omitempty"` + // RackID - READ-ONLY; Mapping of physical patch panel to rack. + RackID *string `json:"rackId,omitempty"` + // ColoLocation - READ-ONLY; Cololocation for ExpressRoute Hybrid Direct. + ColoLocation *string `json:"coloLocation,omitempty"` + // ConnectorType - READ-ONLY; Physical fiber port type. Possible values include: 'ExpressRouteLinkConnectorTypeLC', 'ExpressRouteLinkConnectorTypeSC' + ConnectorType ExpressRouteLinkConnectorType `json:"connectorType,omitempty"` + // AdminState - Administrative state of the physical port. Possible values include: 'ExpressRouteLinkAdminStateEnabled', 'ExpressRouteLinkAdminStateDisabled' + AdminState ExpressRouteLinkAdminState `json:"adminState,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route link resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // MacSecConfig - MacSec configuration. + MacSecConfig *ExpressRouteLinkMacSecConfig `json:"macSecConfig,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteLinkPropertiesFormat. +func (erlpf ExpressRouteLinkPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erlpf.AdminState != "" { + objectMap["adminState"] = erlpf.AdminState + } + if erlpf.MacSecConfig != nil { + objectMap["macSecConfig"] = erlpf.MacSecConfig + } + return json.Marshal(objectMap) +} + +// ExpressRoutePort expressRoutePort resource definition. +type ExpressRoutePort struct { + autorest.Response `json:"-"` + // ExpressRoutePortPropertiesFormat - ExpressRoutePort properties. + *ExpressRoutePortPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Identity - The identity of ExpressRoutePort, if configured. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ExpressRoutePort. +func (erp ExpressRoutePort) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erp.ExpressRoutePortPropertiesFormat != nil { + objectMap["properties"] = erp.ExpressRoutePortPropertiesFormat + } + if erp.Identity != nil { + objectMap["identity"] = erp.Identity + } + if erp.ID != nil { + objectMap["id"] = erp.ID + } + if erp.Location != nil { + objectMap["location"] = erp.Location + } + if erp.Tags != nil { + objectMap["tags"] = erp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRoutePort struct. +func (erp *ExpressRoutePort) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRoutePortPropertiesFormat ExpressRoutePortPropertiesFormat + err = json.Unmarshal(*v, &expressRoutePortPropertiesFormat) + if err != nil { + return err + } + erp.ExpressRoutePortPropertiesFormat = &expressRoutePortPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + erp.Etag = &etag + } + case "identity": + if v != nil { + var identity ManagedServiceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + erp.Identity = &identity + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + erp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + erp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + erp.Tags = tags + } + } + } + + return nil +} + +// ExpressRoutePortAuthorization expressRoutePort Authorization resource definition. +type ExpressRoutePortAuthorization struct { + autorest.Response `json:"-"` + // ExpressRoutePortAuthorizationPropertiesFormat - ExpressRoutePort properties. + *ExpressRoutePortAuthorizationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRoutePortAuthorization. +func (erpa ExpressRoutePortAuthorization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erpa.ExpressRoutePortAuthorizationPropertiesFormat != nil { + objectMap["properties"] = erpa.ExpressRoutePortAuthorizationPropertiesFormat + } + if erpa.Name != nil { + objectMap["name"] = erpa.Name + } + if erpa.ID != nil { + objectMap["id"] = erpa.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRoutePortAuthorization struct. +func (erpa *ExpressRoutePortAuthorization) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRoutePortAuthorizationPropertiesFormat ExpressRoutePortAuthorizationPropertiesFormat + err = json.Unmarshal(*v, &expressRoutePortAuthorizationPropertiesFormat) + if err != nil { + return err + } + erpa.ExpressRoutePortAuthorizationPropertiesFormat = &expressRoutePortAuthorizationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erpa.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + erpa.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + erpa.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erpa.ID = &ID + } + } + } + + return nil +} + +// ExpressRoutePortAuthorizationListResult response for ListExpressRoutePortAuthorizations API service +// call. +type ExpressRoutePortAuthorizationListResult struct { + autorest.Response `json:"-"` + // Value - The authorizations in an ExpressRoute Port. + Value *[]ExpressRoutePortAuthorization `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRoutePortAuthorizationListResultIterator provides access to a complete listing of +// ExpressRoutePortAuthorization values. +type ExpressRoutePortAuthorizationListResultIterator struct { + i int + page ExpressRoutePortAuthorizationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRoutePortAuthorizationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortAuthorizationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRoutePortAuthorizationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRoutePortAuthorizationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRoutePortAuthorizationListResultIterator) Response() ExpressRoutePortAuthorizationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRoutePortAuthorizationListResultIterator) Value() ExpressRoutePortAuthorization { + if !iter.page.NotDone() { + return ExpressRoutePortAuthorization{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRoutePortAuthorizationListResultIterator type. +func NewExpressRoutePortAuthorizationListResultIterator(page ExpressRoutePortAuthorizationListResultPage) ExpressRoutePortAuthorizationListResultIterator { + return ExpressRoutePortAuthorizationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (erpalr ExpressRoutePortAuthorizationListResult) IsEmpty() bool { + return erpalr.Value == nil || len(*erpalr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (erpalr ExpressRoutePortAuthorizationListResult) hasNextLink() bool { + return erpalr.NextLink != nil && len(*erpalr.NextLink) != 0 +} + +// expressRoutePortAuthorizationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (erpalr ExpressRoutePortAuthorizationListResult) expressRoutePortAuthorizationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !erpalr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(erpalr.NextLink))) +} + +// ExpressRoutePortAuthorizationListResultPage contains a page of ExpressRoutePortAuthorization values. +type ExpressRoutePortAuthorizationListResultPage struct { + fn func(context.Context, ExpressRoutePortAuthorizationListResult) (ExpressRoutePortAuthorizationListResult, error) + erpalr ExpressRoutePortAuthorizationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRoutePortAuthorizationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortAuthorizationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.erpalr) + if err != nil { + return err + } + page.erpalr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRoutePortAuthorizationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRoutePortAuthorizationListResultPage) NotDone() bool { + return !page.erpalr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRoutePortAuthorizationListResultPage) Response() ExpressRoutePortAuthorizationListResult { + return page.erpalr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRoutePortAuthorizationListResultPage) Values() []ExpressRoutePortAuthorization { + if page.erpalr.IsEmpty() { + return nil + } + return *page.erpalr.Value +} + +// Creates a new instance of the ExpressRoutePortAuthorizationListResultPage type. +func NewExpressRoutePortAuthorizationListResultPage(cur ExpressRoutePortAuthorizationListResult, getNextPage func(context.Context, ExpressRoutePortAuthorizationListResult) (ExpressRoutePortAuthorizationListResult, error)) ExpressRoutePortAuthorizationListResultPage { + return ExpressRoutePortAuthorizationListResultPage{ + fn: getNextPage, + erpalr: cur, + } +} + +// ExpressRoutePortAuthorizationPropertiesFormat properties of ExpressRoutePort Authorization. +type ExpressRoutePortAuthorizationPropertiesFormat struct { + // AuthorizationKey - READ-ONLY; The authorization key. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + // AuthorizationUseStatus - READ-ONLY; The authorization use status. Possible values include: 'ExpressRoutePortAuthorizationUseStatusAvailable', 'ExpressRoutePortAuthorizationUseStatusInUse' + AuthorizationUseStatus ExpressRoutePortAuthorizationUseStatus `json:"authorizationUseStatus,omitempty"` + // CircuitResourceURI - READ-ONLY; The reference to the ExpressRoute circuit resource using the authorization. + CircuitResourceURI *string `json:"circuitResourceUri,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the authorization resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRoutePortAuthorizationPropertiesFormat. +func (erpapf ExpressRoutePortAuthorizationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExpressRoutePortAuthorizationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExpressRoutePortAuthorizationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRoutePortAuthorizationsClient) (ExpressRoutePortAuthorization, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRoutePortAuthorizationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRoutePortAuthorizationsCreateOrUpdateFuture.Result. +func (future *ExpressRoutePortAuthorizationsCreateOrUpdateFuture) result(client ExpressRoutePortAuthorizationsClient) (erpa ExpressRoutePortAuthorization, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erpa.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRoutePortAuthorizationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erpa.Response.Response, err = future.GetResult(sender); err == nil && erpa.Response.Response.StatusCode != http.StatusNoContent { + erpa, err = client.CreateOrUpdateResponder(erpa.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsCreateOrUpdateFuture", "Result", erpa.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRoutePortAuthorizationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRoutePortAuthorizationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRoutePortAuthorizationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRoutePortAuthorizationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRoutePortAuthorizationsDeleteFuture.Result. +func (future *ExpressRoutePortAuthorizationsDeleteFuture) result(client ExpressRoutePortAuthorizationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRoutePortAuthorizationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRoutePortListResult response for ListExpressRoutePorts API service call. +type ExpressRoutePortListResult struct { + autorest.Response `json:"-"` + // Value - A list of ExpressRoutePort resources. + Value *[]ExpressRoutePort `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRoutePortListResultIterator provides access to a complete listing of ExpressRoutePort values. +type ExpressRoutePortListResultIterator struct { + i int + page ExpressRoutePortListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRoutePortListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRoutePortListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRoutePortListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRoutePortListResultIterator) Response() ExpressRoutePortListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRoutePortListResultIterator) Value() ExpressRoutePort { + if !iter.page.NotDone() { + return ExpressRoutePort{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRoutePortListResultIterator type. +func NewExpressRoutePortListResultIterator(page ExpressRoutePortListResultPage) ExpressRoutePortListResultIterator { + return ExpressRoutePortListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (erplr ExpressRoutePortListResult) IsEmpty() bool { + return erplr.Value == nil || len(*erplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (erplr ExpressRoutePortListResult) hasNextLink() bool { + return erplr.NextLink != nil && len(*erplr.NextLink) != 0 +} + +// expressRoutePortListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (erplr ExpressRoutePortListResult) expressRoutePortListResultPreparer(ctx context.Context) (*http.Request, error) { + if !erplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(erplr.NextLink))) +} + +// ExpressRoutePortListResultPage contains a page of ExpressRoutePort values. +type ExpressRoutePortListResultPage struct { + fn func(context.Context, ExpressRoutePortListResult) (ExpressRoutePortListResult, error) + erplr ExpressRoutePortListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRoutePortListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.erplr) + if err != nil { + return err + } + page.erplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRoutePortListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRoutePortListResultPage) NotDone() bool { + return !page.erplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRoutePortListResultPage) Response() ExpressRoutePortListResult { + return page.erplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRoutePortListResultPage) Values() []ExpressRoutePort { + if page.erplr.IsEmpty() { + return nil + } + return *page.erplr.Value +} + +// Creates a new instance of the ExpressRoutePortListResultPage type. +func NewExpressRoutePortListResultPage(cur ExpressRoutePortListResult, getNextPage func(context.Context, ExpressRoutePortListResult) (ExpressRoutePortListResult, error)) ExpressRoutePortListResultPage { + return ExpressRoutePortListResultPage{ + fn: getNextPage, + erplr: cur, + } +} + +// ExpressRoutePortPropertiesFormat properties specific to ExpressRoutePort resources. +type ExpressRoutePortPropertiesFormat struct { + // PeeringLocation - The name of the peering location that the ExpressRoutePort is mapped to physically. + PeeringLocation *string `json:"peeringLocation,omitempty"` + // BandwidthInGbps - Bandwidth of procured ports in Gbps. + BandwidthInGbps *int32 `json:"bandwidthInGbps,omitempty"` + // ProvisionedBandwidthInGbps - READ-ONLY; Aggregate Gbps of associated circuit bandwidths. + ProvisionedBandwidthInGbps *float64 `json:"provisionedBandwidthInGbps,omitempty"` + // Mtu - READ-ONLY; Maximum transmission unit of the physical port pair(s). + Mtu *string `json:"mtu,omitempty"` + // Encapsulation - Encapsulation method on physical ports. Possible values include: 'ExpressRoutePortsEncapsulationDot1Q', 'ExpressRoutePortsEncapsulationQinQ' + Encapsulation ExpressRoutePortsEncapsulation `json:"encapsulation,omitempty"` + // EtherType - READ-ONLY; Ether type of the physical port. + EtherType *string `json:"etherType,omitempty"` + // AllocationDate - READ-ONLY; Date of the physical port allocation to be used in Letter of Authorization. + AllocationDate *string `json:"allocationDate,omitempty"` + // Links - The set of physical links of the ExpressRoutePort resource. + Links *[]ExpressRouteLink `json:"links,omitempty"` + // Circuits - READ-ONLY; Reference the ExpressRoute circuit(s) that are provisioned on this ExpressRoutePort resource. + Circuits *[]SubResource `json:"circuits,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route port resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the express route port resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // BillingType - The billing type of the ExpressRoutePort resource. Possible values include: 'ExpressRoutePortsBillingTypeMeteredData', 'ExpressRoutePortsBillingTypeUnlimitedData' + BillingType ExpressRoutePortsBillingType `json:"billingType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRoutePortPropertiesFormat. +func (erppf ExpressRoutePortPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erppf.PeeringLocation != nil { + objectMap["peeringLocation"] = erppf.PeeringLocation + } + if erppf.BandwidthInGbps != nil { + objectMap["bandwidthInGbps"] = erppf.BandwidthInGbps + } + if erppf.Encapsulation != "" { + objectMap["encapsulation"] = erppf.Encapsulation + } + if erppf.Links != nil { + objectMap["links"] = erppf.Links + } + if erppf.BillingType != "" { + objectMap["billingType"] = erppf.BillingType + } + return json.Marshal(objectMap) +} + +// ExpressRoutePortsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRoutePortsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRoutePortsClient) (ExpressRoutePort, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRoutePortsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRoutePortsCreateOrUpdateFuture.Result. +func (future *ExpressRoutePortsCreateOrUpdateFuture) result(client ExpressRoutePortsClient) (erp ExpressRoutePort, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRoutePortsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erp.Response.Response, err = future.GetResult(sender); err == nil && erp.Response.Response.StatusCode != http.StatusNoContent { + erp, err = client.CreateOrUpdateResponder(erp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsCreateOrUpdateFuture", "Result", erp.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRoutePortsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExpressRoutePortsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRoutePortsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRoutePortsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRoutePortsDeleteFuture.Result. +func (future *ExpressRoutePortsDeleteFuture) result(client ExpressRoutePortsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRoutePortsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRoutePortsLocation definition of the ExpressRoutePorts peering location resource. +type ExpressRoutePortsLocation struct { + autorest.Response `json:"-"` + // ExpressRoutePortsLocationPropertiesFormat - ExpressRoutePort peering location properties. + *ExpressRoutePortsLocationPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ExpressRoutePortsLocation. +func (erpl ExpressRoutePortsLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erpl.ExpressRoutePortsLocationPropertiesFormat != nil { + objectMap["properties"] = erpl.ExpressRoutePortsLocationPropertiesFormat + } + if erpl.ID != nil { + objectMap["id"] = erpl.ID + } + if erpl.Location != nil { + objectMap["location"] = erpl.Location + } + if erpl.Tags != nil { + objectMap["tags"] = erpl.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRoutePortsLocation struct. +func (erpl *ExpressRoutePortsLocation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRoutePortsLocationPropertiesFormat ExpressRoutePortsLocationPropertiesFormat + err = json.Unmarshal(*v, &expressRoutePortsLocationPropertiesFormat) + if err != nil { + return err + } + erpl.ExpressRoutePortsLocationPropertiesFormat = &expressRoutePortsLocationPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erpl.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erpl.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + erpl.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + erpl.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + erpl.Tags = tags + } + } + } + + return nil +} + +// ExpressRoutePortsLocationBandwidths real-time inventory of available ExpressRoute port bandwidths. +type ExpressRoutePortsLocationBandwidths struct { + // OfferName - READ-ONLY; Bandwidth descriptive name. + OfferName *string `json:"offerName,omitempty"` + // ValueInGbps - READ-ONLY; Bandwidth value in Gbps. + ValueInGbps *int32 `json:"valueInGbps,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRoutePortsLocationBandwidths. +func (erplb ExpressRoutePortsLocationBandwidths) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExpressRoutePortsLocationListResult response for ListExpressRoutePortsLocations API service call. +type ExpressRoutePortsLocationListResult struct { + autorest.Response `json:"-"` + // Value - The list of all ExpressRoutePort peering locations. + Value *[]ExpressRoutePortsLocation `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRoutePortsLocationListResultIterator provides access to a complete listing of +// ExpressRoutePortsLocation values. +type ExpressRoutePortsLocationListResultIterator struct { + i int + page ExpressRoutePortsLocationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRoutePortsLocationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsLocationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRoutePortsLocationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRoutePortsLocationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRoutePortsLocationListResultIterator) Response() ExpressRoutePortsLocationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRoutePortsLocationListResultIterator) Value() ExpressRoutePortsLocation { + if !iter.page.NotDone() { + return ExpressRoutePortsLocation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRoutePortsLocationListResultIterator type. +func NewExpressRoutePortsLocationListResultIterator(page ExpressRoutePortsLocationListResultPage) ExpressRoutePortsLocationListResultIterator { + return ExpressRoutePortsLocationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (erpllr ExpressRoutePortsLocationListResult) IsEmpty() bool { + return erpllr.Value == nil || len(*erpllr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (erpllr ExpressRoutePortsLocationListResult) hasNextLink() bool { + return erpllr.NextLink != nil && len(*erpllr.NextLink) != 0 +} + +// expressRoutePortsLocationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (erpllr ExpressRoutePortsLocationListResult) expressRoutePortsLocationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !erpllr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(erpllr.NextLink))) +} + +// ExpressRoutePortsLocationListResultPage contains a page of ExpressRoutePortsLocation values. +type ExpressRoutePortsLocationListResultPage struct { + fn func(context.Context, ExpressRoutePortsLocationListResult) (ExpressRoutePortsLocationListResult, error) + erpllr ExpressRoutePortsLocationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRoutePortsLocationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsLocationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.erpllr) + if err != nil { + return err + } + page.erpllr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRoutePortsLocationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRoutePortsLocationListResultPage) NotDone() bool { + return !page.erpllr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRoutePortsLocationListResultPage) Response() ExpressRoutePortsLocationListResult { + return page.erpllr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRoutePortsLocationListResultPage) Values() []ExpressRoutePortsLocation { + if page.erpllr.IsEmpty() { + return nil + } + return *page.erpllr.Value +} + +// Creates a new instance of the ExpressRoutePortsLocationListResultPage type. +func NewExpressRoutePortsLocationListResultPage(cur ExpressRoutePortsLocationListResult, getNextPage func(context.Context, ExpressRoutePortsLocationListResult) (ExpressRoutePortsLocationListResult, error)) ExpressRoutePortsLocationListResultPage { + return ExpressRoutePortsLocationListResultPage{ + fn: getNextPage, + erpllr: cur, + } +} + +// ExpressRoutePortsLocationPropertiesFormat properties specific to ExpressRoutePorts peering location +// resources. +type ExpressRoutePortsLocationPropertiesFormat struct { + // Address - READ-ONLY; Address of peering location. + Address *string `json:"address,omitempty"` + // Contact - READ-ONLY; Contact details of peering locations. + Contact *string `json:"contact,omitempty"` + // AvailableBandwidths - The inventory of available ExpressRoutePort bandwidths. + AvailableBandwidths *[]ExpressRoutePortsLocationBandwidths `json:"availableBandwidths,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route port location resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRoutePortsLocationPropertiesFormat. +func (erplpf ExpressRoutePortsLocationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erplpf.AvailableBandwidths != nil { + objectMap["availableBandwidths"] = erplpf.AvailableBandwidths + } + return json.Marshal(objectMap) +} + +// ExpressRouteProviderPort expressRouteProviderPort resource. +type ExpressRouteProviderPort struct { + autorest.Response `json:"-"` + // ExpressRouteProviderPortProperties - Properties of the express route Service Provider Port. + *ExpressRouteProviderPortProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteProviderPort. +func (erpp ExpressRouteProviderPort) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erpp.ExpressRouteProviderPortProperties != nil { + objectMap["properties"] = erpp.ExpressRouteProviderPortProperties + } + if erpp.ID != nil { + objectMap["id"] = erpp.ID + } + if erpp.Location != nil { + objectMap["location"] = erpp.Location + } + if erpp.Tags != nil { + objectMap["tags"] = erpp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteProviderPort struct. +func (erpp *ExpressRouteProviderPort) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteProviderPortProperties ExpressRouteProviderPortProperties + err = json.Unmarshal(*v, &expressRouteProviderPortProperties) + if err != nil { + return err + } + erpp.ExpressRouteProviderPortProperties = &expressRouteProviderPortProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + erpp.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erpp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erpp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + erpp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + erpp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + erpp.Tags = tags + } + } + } + + return nil +} + +// ExpressRouteProviderPortListResult response for ListExpressRouteProviderPort API service call. +type ExpressRouteProviderPortListResult struct { + autorest.Response `json:"-"` + // Value - A list of ExpressRouteProviderPort resources. + Value *[]ExpressRouteProviderPort `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteProviderPortListResult. +func (erpplr ExpressRouteProviderPortListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erpplr.Value != nil { + objectMap["value"] = erpplr.Value + } + return json.Marshal(objectMap) +} + +// ExpressRouteProviderPortProperties properties of ExpressRouteProviderPort. +type ExpressRouteProviderPortProperties struct { + // PortPairDescriptor - READ-ONLY; The name of the port pair. + PortPairDescriptor *string `json:"portPairDescriptor,omitempty"` + // PrimaryAzurePort - READ-ONLY; The name of the primary port. + PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` + // SecondaryAzurePort - READ-ONLY; The name of the secondary port. + SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` + // PeeringLocation - The peering location of the port pair. + PeeringLocation *string `json:"peeringLocation,omitempty"` + // OverprovisionFactor - Overprovisioning factor for the port pair. + OverprovisionFactor *int32 `json:"overprovisionFactor,omitempty"` + // PortBandwidthInMbps - Bandwidth of the port in Mbps + PortBandwidthInMbps *int32 `json:"portBandwidthInMbps,omitempty"` + // UsedBandwidthInMbps - Used Bandwidth of the port in Mbps + UsedBandwidthInMbps *int32 `json:"usedBandwidthInMbps,omitempty"` + // RemainingBandwidthInMbps - Remaining Bandwidth of the port in Mbps + RemainingBandwidthInMbps *int32 `json:"remainingBandwidthInMbps,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteProviderPortProperties. +func (erppp ExpressRouteProviderPortProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erppp.PeeringLocation != nil { + objectMap["peeringLocation"] = erppp.PeeringLocation + } + if erppp.OverprovisionFactor != nil { + objectMap["overprovisionFactor"] = erppp.OverprovisionFactor + } + if erppp.PortBandwidthInMbps != nil { + objectMap["portBandwidthInMbps"] = erppp.PortBandwidthInMbps + } + if erppp.UsedBandwidthInMbps != nil { + objectMap["usedBandwidthInMbps"] = erppp.UsedBandwidthInMbps + } + if erppp.RemainingBandwidthInMbps != nil { + objectMap["remainingBandwidthInMbps"] = erppp.RemainingBandwidthInMbps + } + return json.Marshal(objectMap) +} + +// ExpressRouteServiceProvider a ExpressRouteResourceProvider object. +type ExpressRouteServiceProvider struct { + // ExpressRouteServiceProviderPropertiesFormat - Properties of the express route service provider. + *ExpressRouteServiceProviderPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteServiceProvider. +func (ersp ExpressRouteServiceProvider) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ersp.ExpressRouteServiceProviderPropertiesFormat != nil { + objectMap["properties"] = ersp.ExpressRouteServiceProviderPropertiesFormat + } + if ersp.ID != nil { + objectMap["id"] = ersp.ID + } + if ersp.Location != nil { + objectMap["location"] = ersp.Location + } + if ersp.Tags != nil { + objectMap["tags"] = ersp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteServiceProvider struct. +func (ersp *ExpressRouteServiceProvider) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteServiceProviderPropertiesFormat ExpressRouteServiceProviderPropertiesFormat + err = json.Unmarshal(*v, &expressRouteServiceProviderPropertiesFormat) + if err != nil { + return err + } + ersp.ExpressRouteServiceProviderPropertiesFormat = &expressRouteServiceProviderPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ersp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ersp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ersp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ersp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ersp.Tags = tags + } + } + } + + return nil +} + +// ExpressRouteServiceProviderBandwidthsOffered contains bandwidths offered in ExpressRouteServiceProvider +// resources. +type ExpressRouteServiceProviderBandwidthsOffered struct { + // OfferName - The OfferName. + OfferName *string `json:"offerName,omitempty"` + // ValueInMbps - The ValueInMbps. + ValueInMbps *int32 `json:"valueInMbps,omitempty"` +} + +// ExpressRouteServiceProviderListResult response for the ListExpressRouteServiceProvider API service call. +type ExpressRouteServiceProviderListResult struct { + autorest.Response `json:"-"` + // Value - A list of ExpressRouteResourceProvider resources. + Value *[]ExpressRouteServiceProvider `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteServiceProviderListResultIterator provides access to a complete listing of +// ExpressRouteServiceProvider values. +type ExpressRouteServiceProviderListResultIterator struct { + i int + page ExpressRouteServiceProviderListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRouteServiceProviderListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteServiceProviderListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRouteServiceProviderListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRouteServiceProviderListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRouteServiceProviderListResultIterator) Response() ExpressRouteServiceProviderListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRouteServiceProviderListResultIterator) Value() ExpressRouteServiceProvider { + if !iter.page.NotDone() { + return ExpressRouteServiceProvider{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRouteServiceProviderListResultIterator type. +func NewExpressRouteServiceProviderListResultIterator(page ExpressRouteServiceProviderListResultPage) ExpressRouteServiceProviderListResultIterator { + return ExpressRouteServiceProviderListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ersplr ExpressRouteServiceProviderListResult) IsEmpty() bool { + return ersplr.Value == nil || len(*ersplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ersplr ExpressRouteServiceProviderListResult) hasNextLink() bool { + return ersplr.NextLink != nil && len(*ersplr.NextLink) != 0 +} + +// expressRouteServiceProviderListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ersplr ExpressRouteServiceProviderListResult) expressRouteServiceProviderListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ersplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ersplr.NextLink))) +} + +// ExpressRouteServiceProviderListResultPage contains a page of ExpressRouteServiceProvider values. +type ExpressRouteServiceProviderListResultPage struct { + fn func(context.Context, ExpressRouteServiceProviderListResult) (ExpressRouteServiceProviderListResult, error) + ersplr ExpressRouteServiceProviderListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRouteServiceProviderListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteServiceProviderListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ersplr) + if err != nil { + return err + } + page.ersplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRouteServiceProviderListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRouteServiceProviderListResultPage) NotDone() bool { + return !page.ersplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRouteServiceProviderListResultPage) Response() ExpressRouteServiceProviderListResult { + return page.ersplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRouteServiceProviderListResultPage) Values() []ExpressRouteServiceProvider { + if page.ersplr.IsEmpty() { + return nil + } + return *page.ersplr.Value +} + +// Creates a new instance of the ExpressRouteServiceProviderListResultPage type. +func NewExpressRouteServiceProviderListResultPage(cur ExpressRouteServiceProviderListResult, getNextPage func(context.Context, ExpressRouteServiceProviderListResult) (ExpressRouteServiceProviderListResult, error)) ExpressRouteServiceProviderListResultPage { + return ExpressRouteServiceProviderListResultPage{ + fn: getNextPage, + ersplr: cur, + } +} + +// ExpressRouteServiceProviderPropertiesFormat properties of ExpressRouteServiceProvider. +type ExpressRouteServiceProviderPropertiesFormat struct { + // PeeringLocations - A list of peering locations. + PeeringLocations *[]string `json:"peeringLocations,omitempty"` + // BandwidthsOffered - A list of bandwidths offered. + BandwidthsOffered *[]ExpressRouteServiceProviderBandwidthsOffered `json:"bandwidthsOffered,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route service provider resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteServiceProviderPropertiesFormat. +func (ersppf ExpressRouteServiceProviderPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ersppf.PeeringLocations != nil { + objectMap["peeringLocations"] = ersppf.PeeringLocations + } + if ersppf.BandwidthsOffered != nil { + objectMap["bandwidthsOffered"] = ersppf.BandwidthsOffered + } + return json.Marshal(objectMap) +} + +// ExtendedLocation extendedLocation complex type. +type ExtendedLocation struct { + // Name - The name of the extended location. + Name *string `json:"name,omitempty"` + // Type - The type of the extended location. Possible values include: 'ExtendedLocationTypesEdgeZone' + Type ExtendedLocationTypes `json:"type,omitempty"` +} + +// FilterItems will contain the filter name and values to operate on +type FilterItems struct { + // Field - The name of the field we would like to filter + Field *string `json:"field,omitempty"` + // Values - List of values to filter the current field by + Values *[]string `json:"values,omitempty"` +} + +// FirewallPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FirewallPoliciesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FirewallPoliciesClient) (FirewallPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FirewallPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FirewallPoliciesCreateOrUpdateFuture.Result. +func (future *FirewallPoliciesCreateOrUpdateFuture) result(client FirewallPoliciesClient) (fp FirewallPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.FirewallPoliciesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fp.Response.Response, err = future.GetResult(sender); err == nil && fp.Response.Response.StatusCode != http.StatusNoContent { + fp, err = client.CreateOrUpdateResponder(fp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesCreateOrUpdateFuture", "Result", fp.Response.Response, "Failure responding to request") + } + } + return +} + +// FirewallPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type FirewallPoliciesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FirewallPoliciesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FirewallPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FirewallPoliciesDeleteFuture.Result. +func (future *FirewallPoliciesDeleteFuture) result(client FirewallPoliciesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.FirewallPoliciesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// FirewallPolicy firewallPolicy Resource. +type FirewallPolicy struct { + autorest.Response `json:"-"` + // FirewallPolicyPropertiesFormat - Properties of the firewall policy. + *FirewallPolicyPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Identity - The identity of the firewall policy. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for FirewallPolicy. +func (fp FirewallPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fp.FirewallPolicyPropertiesFormat != nil { + objectMap["properties"] = fp.FirewallPolicyPropertiesFormat + } + if fp.Identity != nil { + objectMap["identity"] = fp.Identity + } + if fp.ID != nil { + objectMap["id"] = fp.ID + } + if fp.Location != nil { + objectMap["location"] = fp.Location + } + if fp.Tags != nil { + objectMap["tags"] = fp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FirewallPolicy struct. +func (fp *FirewallPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var firewallPolicyPropertiesFormat FirewallPolicyPropertiesFormat + err = json.Unmarshal(*v, &firewallPolicyPropertiesFormat) + if err != nil { + return err + } + fp.FirewallPolicyPropertiesFormat = &firewallPolicyPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + fp.Etag = &etag + } + case "identity": + if v != nil { + var identity ManagedServiceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + fp.Identity = &identity + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + fp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + fp.Tags = tags + } + } + } + + return nil +} + +// FirewallPolicyCertificateAuthority trusted Root certificates properties for tls. +type FirewallPolicyCertificateAuthority struct { + // KeyVaultSecretID - Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. + KeyVaultSecretID *string `json:"keyVaultSecretId,omitempty"` + // Name - Name of the CA certificate. + Name *string `json:"name,omitempty"` +} + +// FirewallPolicyFilterRuleCollection firewall Policy Filter Rule Collection. +type FirewallPolicyFilterRuleCollection struct { + // Action - The action type of a Filter rule collection. + Action *FirewallPolicyFilterRuleCollectionAction `json:"action,omitempty"` + // Rules - List of rules included in a rule collection. + Rules *[]BasicFirewallPolicyRule `json:"rules,omitempty"` + // Name - The name of the rule collection. + Name *string `json:"name,omitempty"` + // Priority - Priority of the Firewall Policy Rule Collection resource. + Priority *int32 `json:"priority,omitempty"` + // RuleCollectionType - Possible values include: 'RuleCollectionTypeFirewallPolicyRuleCollection', 'RuleCollectionTypeFirewallPolicyNatRuleCollection', 'RuleCollectionTypeFirewallPolicyFilterRuleCollection' + RuleCollectionType RuleCollectionType `json:"ruleCollectionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for FirewallPolicyFilterRuleCollection. +func (fpfrc FirewallPolicyFilterRuleCollection) MarshalJSON() ([]byte, error) { + fpfrc.RuleCollectionType = RuleCollectionTypeFirewallPolicyFilterRuleCollection + objectMap := make(map[string]interface{}) + if fpfrc.Action != nil { + objectMap["action"] = fpfrc.Action + } + if fpfrc.Rules != nil { + objectMap["rules"] = fpfrc.Rules + } + if fpfrc.Name != nil { + objectMap["name"] = fpfrc.Name + } + if fpfrc.Priority != nil { + objectMap["priority"] = fpfrc.Priority + } + if fpfrc.RuleCollectionType != "" { + objectMap["ruleCollectionType"] = fpfrc.RuleCollectionType + } + return json.Marshal(objectMap) +} + +// AsFirewallPolicyNatRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyFilterRuleCollection. +func (fpfrc FirewallPolicyFilterRuleCollection) AsFirewallPolicyNatRuleCollection() (*FirewallPolicyNatRuleCollection, bool) { + return nil, false +} + +// AsFirewallPolicyFilterRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyFilterRuleCollection. +func (fpfrc FirewallPolicyFilterRuleCollection) AsFirewallPolicyFilterRuleCollection() (*FirewallPolicyFilterRuleCollection, bool) { + return &fpfrc, true +} + +// AsFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyFilterRuleCollection. +func (fpfrc FirewallPolicyFilterRuleCollection) AsFirewallPolicyRuleCollection() (*FirewallPolicyRuleCollection, bool) { + return nil, false +} + +// AsBasicFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyFilterRuleCollection. +func (fpfrc FirewallPolicyFilterRuleCollection) AsBasicFirewallPolicyRuleCollection() (BasicFirewallPolicyRuleCollection, bool) { + return &fpfrc, true +} + +// UnmarshalJSON is the custom unmarshaler for FirewallPolicyFilterRuleCollection struct. +func (fpfrc *FirewallPolicyFilterRuleCollection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "action": + if v != nil { + var action FirewallPolicyFilterRuleCollectionAction + err = json.Unmarshal(*v, &action) + if err != nil { + return err + } + fpfrc.Action = &action + } + case "rules": + if v != nil { + rules, err := unmarshalBasicFirewallPolicyRuleArray(*v) + if err != nil { + return err + } + fpfrc.Rules = &rules + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fpfrc.Name = &name + } + case "priority": + if v != nil { + var priority int32 + err = json.Unmarshal(*v, &priority) + if err != nil { + return err + } + fpfrc.Priority = &priority + } + case "ruleCollectionType": + if v != nil { + var ruleCollectionType RuleCollectionType + err = json.Unmarshal(*v, &ruleCollectionType) + if err != nil { + return err + } + fpfrc.RuleCollectionType = ruleCollectionType + } + } + } + + return nil +} + +// FirewallPolicyFilterRuleCollectionAction properties of the FirewallPolicyFilterRuleCollectionAction. +type FirewallPolicyFilterRuleCollectionAction struct { + // Type - The type of action. Possible values include: 'FirewallPolicyFilterRuleCollectionActionTypeAllow', 'FirewallPolicyFilterRuleCollectionActionTypeDeny' + Type FirewallPolicyFilterRuleCollectionActionType `json:"type,omitempty"` +} + +// FirewallPolicyInsights firewall Policy Insights. +type FirewallPolicyInsights struct { + // IsEnabled - A flag to indicate if the insights are enabled on the policy. + IsEnabled *bool `json:"isEnabled,omitempty"` + // RetentionDays - Number of days the insights should be enabled on the policy. + RetentionDays *int32 `json:"retentionDays,omitempty"` + // LogAnalyticsResources - Workspaces needed to configure the Firewall Policy Insights. + LogAnalyticsResources *FirewallPolicyLogAnalyticsResources `json:"logAnalyticsResources,omitempty"` +} + +// FirewallPolicyIntrusionDetection configuration for intrusion detection mode and rules. +type FirewallPolicyIntrusionDetection struct { + // Mode - Intrusion detection general state. Possible values include: 'FirewallPolicyIntrusionDetectionStateTypeOff', 'FirewallPolicyIntrusionDetectionStateTypeAlert', 'FirewallPolicyIntrusionDetectionStateTypeDeny' + Mode FirewallPolicyIntrusionDetectionStateType `json:"mode,omitempty"` + // Configuration - Intrusion detection configuration properties. + Configuration *FirewallPolicyIntrusionDetectionConfiguration `json:"configuration,omitempty"` +} + +// FirewallPolicyIntrusionDetectionBypassTrafficSpecifications intrusion detection bypass traffic +// specification. +type FirewallPolicyIntrusionDetectionBypassTrafficSpecifications struct { + // Name - Name of the bypass traffic rule. + Name *string `json:"name,omitempty"` + // Description - Description of the bypass traffic rule. + Description *string `json:"description,omitempty"` + // Protocol - The rule bypass protocol. Possible values include: 'FirewallPolicyIntrusionDetectionProtocolTCP', 'FirewallPolicyIntrusionDetectionProtocolUDP', 'FirewallPolicyIntrusionDetectionProtocolICMP', 'FirewallPolicyIntrusionDetectionProtocolANY' + Protocol FirewallPolicyIntrusionDetectionProtocol `json:"protocol,omitempty"` + // SourceAddresses - List of source IP addresses or ranges for this rule. + SourceAddresses *[]string `json:"sourceAddresses,omitempty"` + // DestinationAddresses - List of destination IP addresses or ranges for this rule. + DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` + // DestinationPorts - List of destination ports or ranges. + DestinationPorts *[]string `json:"destinationPorts,omitempty"` + // SourceIPGroups - List of source IpGroups for this rule. + SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` + // DestinationIPGroups - List of destination IpGroups for this rule. + DestinationIPGroups *[]string `json:"destinationIpGroups,omitempty"` +} + +// FirewallPolicyIntrusionDetectionConfiguration the operation for configuring intrusion detection. +type FirewallPolicyIntrusionDetectionConfiguration struct { + // SignatureOverrides - List of specific signatures states. + SignatureOverrides *[]FirewallPolicyIntrusionDetectionSignatureSpecification `json:"signatureOverrides,omitempty"` + // BypassTrafficSettings - List of rules for traffic to bypass. + BypassTrafficSettings *[]FirewallPolicyIntrusionDetectionBypassTrafficSpecifications `json:"bypassTrafficSettings,omitempty"` + // PrivateRanges - 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 + PrivateRanges *[]string `json:"privateRanges,omitempty"` +} + +// FirewallPolicyIntrusionDetectionSignatureSpecification intrusion detection signatures specification +// states. +type FirewallPolicyIntrusionDetectionSignatureSpecification struct { + // ID - Signature id. + ID *string `json:"id,omitempty"` + // Mode - The signature state. Possible values include: 'FirewallPolicyIntrusionDetectionStateTypeOff', 'FirewallPolicyIntrusionDetectionStateTypeAlert', 'FirewallPolicyIntrusionDetectionStateTypeDeny' + Mode FirewallPolicyIntrusionDetectionStateType `json:"mode,omitempty"` +} + +// FirewallPolicyListResult response for ListFirewallPolicies API service call. +type FirewallPolicyListResult struct { + autorest.Response `json:"-"` + // Value - List of Firewall Policies in a resource group. + Value *[]FirewallPolicy `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// FirewallPolicyListResultIterator provides access to a complete listing of FirewallPolicy values. +type FirewallPolicyListResultIterator struct { + i int + page FirewallPolicyListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *FirewallPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *FirewallPolicyListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FirewallPolicyListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter FirewallPolicyListResultIterator) Response() FirewallPolicyListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter FirewallPolicyListResultIterator) Value() FirewallPolicy { + if !iter.page.NotDone() { + return FirewallPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FirewallPolicyListResultIterator type. +func NewFirewallPolicyListResultIterator(page FirewallPolicyListResultPage) FirewallPolicyListResultIterator { + return FirewallPolicyListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (fplr FirewallPolicyListResult) IsEmpty() bool { + return fplr.Value == nil || len(*fplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (fplr FirewallPolicyListResult) hasNextLink() bool { + return fplr.NextLink != nil && len(*fplr.NextLink) != 0 +} + +// firewallPolicyListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (fplr FirewallPolicyListResult) firewallPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !fplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(fplr.NextLink))) +} + +// FirewallPolicyListResultPage contains a page of FirewallPolicy values. +type FirewallPolicyListResultPage struct { + fn func(context.Context, FirewallPolicyListResult) (FirewallPolicyListResult, error) + fplr FirewallPolicyListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *FirewallPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.fplr) + if err != nil { + return err + } + page.fplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *FirewallPolicyListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FirewallPolicyListResultPage) NotDone() bool { + return !page.fplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FirewallPolicyListResultPage) Response() FirewallPolicyListResult { + return page.fplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FirewallPolicyListResultPage) Values() []FirewallPolicy { + if page.fplr.IsEmpty() { + return nil + } + return *page.fplr.Value +} + +// Creates a new instance of the FirewallPolicyListResultPage type. +func NewFirewallPolicyListResultPage(cur FirewallPolicyListResult, getNextPage func(context.Context, FirewallPolicyListResult) (FirewallPolicyListResult, error)) FirewallPolicyListResultPage { + return FirewallPolicyListResultPage{ + fn: getNextPage, + fplr: cur, + } +} + +// FirewallPolicyLogAnalyticsResources log Analytics Resources for Firewall Policy Insights. +type FirewallPolicyLogAnalyticsResources struct { + // Workspaces - List of workspaces for Firewall Policy Insights. + Workspaces *[]FirewallPolicyLogAnalyticsWorkspace `json:"workspaces,omitempty"` + // DefaultWorkspaceID - The default workspace Id for Firewall Policy Insights. + DefaultWorkspaceID *SubResource `json:"defaultWorkspaceId,omitempty"` +} + +// FirewallPolicyLogAnalyticsWorkspace log Analytics Workspace for Firewall Policy Insights. +type FirewallPolicyLogAnalyticsWorkspace struct { + // Region - Region to configure the Workspace. + Region *string `json:"region,omitempty"` + // WorkspaceID - The workspace Id for Firewall Policy Insights. + WorkspaceID *SubResource `json:"workspaceId,omitempty"` +} + +// FirewallPolicyNatRuleCollection firewall Policy NAT Rule Collection. +type FirewallPolicyNatRuleCollection struct { + // Action - The action type of a Nat rule collection. + Action *FirewallPolicyNatRuleCollectionAction `json:"action,omitempty"` + // Rules - List of rules included in a rule collection. + Rules *[]BasicFirewallPolicyRule `json:"rules,omitempty"` + // Name - The name of the rule collection. + Name *string `json:"name,omitempty"` + // Priority - Priority of the Firewall Policy Rule Collection resource. + Priority *int32 `json:"priority,omitempty"` + // RuleCollectionType - Possible values include: 'RuleCollectionTypeFirewallPolicyRuleCollection', 'RuleCollectionTypeFirewallPolicyNatRuleCollection', 'RuleCollectionTypeFirewallPolicyFilterRuleCollection' + RuleCollectionType RuleCollectionType `json:"ruleCollectionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for FirewallPolicyNatRuleCollection. +func (fpnrc FirewallPolicyNatRuleCollection) MarshalJSON() ([]byte, error) { + fpnrc.RuleCollectionType = RuleCollectionTypeFirewallPolicyNatRuleCollection + objectMap := make(map[string]interface{}) + if fpnrc.Action != nil { + objectMap["action"] = fpnrc.Action + } + if fpnrc.Rules != nil { + objectMap["rules"] = fpnrc.Rules + } + if fpnrc.Name != nil { + objectMap["name"] = fpnrc.Name + } + if fpnrc.Priority != nil { + objectMap["priority"] = fpnrc.Priority + } + if fpnrc.RuleCollectionType != "" { + objectMap["ruleCollectionType"] = fpnrc.RuleCollectionType + } + return json.Marshal(objectMap) +} + +// AsFirewallPolicyNatRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyNatRuleCollection. +func (fpnrc FirewallPolicyNatRuleCollection) AsFirewallPolicyNatRuleCollection() (*FirewallPolicyNatRuleCollection, bool) { + return &fpnrc, true +} + +// AsFirewallPolicyFilterRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyNatRuleCollection. +func (fpnrc FirewallPolicyNatRuleCollection) AsFirewallPolicyFilterRuleCollection() (*FirewallPolicyFilterRuleCollection, bool) { + return nil, false +} + +// AsFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyNatRuleCollection. +func (fpnrc FirewallPolicyNatRuleCollection) AsFirewallPolicyRuleCollection() (*FirewallPolicyRuleCollection, bool) { + return nil, false +} + +// AsBasicFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyNatRuleCollection. +func (fpnrc FirewallPolicyNatRuleCollection) AsBasicFirewallPolicyRuleCollection() (BasicFirewallPolicyRuleCollection, bool) { + return &fpnrc, true +} + +// UnmarshalJSON is the custom unmarshaler for FirewallPolicyNatRuleCollection struct. +func (fpnrc *FirewallPolicyNatRuleCollection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "action": + if v != nil { + var action FirewallPolicyNatRuleCollectionAction + err = json.Unmarshal(*v, &action) + if err != nil { + return err + } + fpnrc.Action = &action + } + case "rules": + if v != nil { + rules, err := unmarshalBasicFirewallPolicyRuleArray(*v) + if err != nil { + return err + } + fpnrc.Rules = &rules + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fpnrc.Name = &name + } + case "priority": + if v != nil { + var priority int32 + err = json.Unmarshal(*v, &priority) + if err != nil { + return err + } + fpnrc.Priority = &priority + } + case "ruleCollectionType": + if v != nil { + var ruleCollectionType RuleCollectionType + err = json.Unmarshal(*v, &ruleCollectionType) + if err != nil { + return err + } + fpnrc.RuleCollectionType = ruleCollectionType + } + } + } + + return nil +} + +// FirewallPolicyNatRuleCollectionAction properties of the FirewallPolicyNatRuleCollectionAction. +type FirewallPolicyNatRuleCollectionAction struct { + // Type - The type of action. Possible values include: 'FirewallPolicyNatRuleCollectionActionTypeDNAT' + Type FirewallPolicyNatRuleCollectionActionType `json:"type,omitempty"` +} + +// FirewallPolicyPropertiesFormat firewall Policy definition. +type FirewallPolicyPropertiesFormat struct { + // RuleCollectionGroups - READ-ONLY; List of references to FirewallPolicyRuleCollectionGroups. + RuleCollectionGroups *[]SubResource `json:"ruleCollectionGroups,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the firewall policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // BasePolicy - The parent firewall policy from which rules are inherited. + BasePolicy *SubResource `json:"basePolicy,omitempty"` + // Firewalls - READ-ONLY; List of references to Azure Firewalls that this Firewall Policy is associated with. + Firewalls *[]SubResource `json:"firewalls,omitempty"` + // ChildPolicies - READ-ONLY; List of references to Child Firewall Policies. + ChildPolicies *[]SubResource `json:"childPolicies,omitempty"` + // ThreatIntelMode - The operation mode for Threat Intelligence. Possible values include: 'AzureFirewallThreatIntelModeAlert', 'AzureFirewallThreatIntelModeDeny', 'AzureFirewallThreatIntelModeOff' + ThreatIntelMode AzureFirewallThreatIntelMode `json:"threatIntelMode,omitempty"` + // ThreatIntelWhitelist - ThreatIntel Whitelist for Firewall Policy. + ThreatIntelWhitelist *FirewallPolicyThreatIntelWhitelist `json:"threatIntelWhitelist,omitempty"` + // Insights - Insights on Firewall Policy. + Insights *FirewallPolicyInsights `json:"insights,omitempty"` + // Snat - The private IP addresses/IP ranges to which traffic will not be SNAT. + Snat *FirewallPolicySNAT `json:"snat,omitempty"` + // SQL - SQL Settings definition. + SQL *FirewallPolicySQL `json:"sql,omitempty"` + // DNSSettings - DNS Proxy Settings definition. + DNSSettings *DNSSettings `json:"dnsSettings,omitempty"` + // ExplicitProxy - Explicit Proxy Settings definition. + ExplicitProxy *ExplicitProxy `json:"explicitProxy,omitempty"` + // IntrusionDetection - The configuration for Intrusion detection. + IntrusionDetection *FirewallPolicyIntrusionDetection `json:"intrusionDetection,omitempty"` + // TransportSecurity - TLS Configuration definition. + TransportSecurity *FirewallPolicyTransportSecurity `json:"transportSecurity,omitempty"` + // Sku - The Firewall Policy SKU. + Sku *FirewallPolicySku `json:"sku,omitempty"` +} + +// MarshalJSON is the custom marshaler for FirewallPolicyPropertiesFormat. +func (fppf FirewallPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fppf.BasePolicy != nil { + objectMap["basePolicy"] = fppf.BasePolicy + } + if fppf.ThreatIntelMode != "" { + objectMap["threatIntelMode"] = fppf.ThreatIntelMode + } + if fppf.ThreatIntelWhitelist != nil { + objectMap["threatIntelWhitelist"] = fppf.ThreatIntelWhitelist + } + if fppf.Insights != nil { + objectMap["insights"] = fppf.Insights + } + if fppf.Snat != nil { + objectMap["snat"] = fppf.Snat + } + if fppf.SQL != nil { + objectMap["sql"] = fppf.SQL + } + if fppf.DNSSettings != nil { + objectMap["dnsSettings"] = fppf.DNSSettings + } + if fppf.ExplicitProxy != nil { + objectMap["explicitProxy"] = fppf.ExplicitProxy + } + if fppf.IntrusionDetection != nil { + objectMap["intrusionDetection"] = fppf.IntrusionDetection + } + if fppf.TransportSecurity != nil { + objectMap["transportSecurity"] = fppf.TransportSecurity + } + if fppf.Sku != nil { + objectMap["sku"] = fppf.Sku + } + return json.Marshal(objectMap) +} + +// BasicFirewallPolicyRule properties of a rule. +type BasicFirewallPolicyRule interface { + AsApplicationRule() (*ApplicationRule, bool) + AsNatRule() (*NatRule, bool) + AsRule() (*Rule, bool) + AsFirewallPolicyRule() (*FirewallPolicyRule, bool) +} + +// FirewallPolicyRule properties of a rule. +type FirewallPolicyRule struct { + // Name - Name of the rule. + Name *string `json:"name,omitempty"` + // Description - Description of the rule. + Description *string `json:"description,omitempty"` + // RuleType - Possible values include: 'RuleTypeFirewallPolicyRule', 'RuleTypeApplicationRule', 'RuleTypeNatRule', 'RuleTypeNetworkRule' + RuleType RuleType `json:"ruleType,omitempty"` +} + +func unmarshalBasicFirewallPolicyRule(body []byte) (BasicFirewallPolicyRule, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["ruleType"] { + case string(RuleTypeApplicationRule): + var ar ApplicationRule + err := json.Unmarshal(body, &ar) + return ar, err + case string(RuleTypeNatRule): + var nr NatRule + err := json.Unmarshal(body, &nr) + return nr, err + case string(RuleTypeNetworkRule): + var r Rule + err := json.Unmarshal(body, &r) + return r, err + default: + var fpr FirewallPolicyRule + err := json.Unmarshal(body, &fpr) + return fpr, err + } +} +func unmarshalBasicFirewallPolicyRuleArray(body []byte) ([]BasicFirewallPolicyRule, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + fprArray := make([]BasicFirewallPolicyRule, len(rawMessages)) + + for index, rawMessage := range rawMessages { + fpr, err := unmarshalBasicFirewallPolicyRule(*rawMessage) + if err != nil { + return nil, err + } + fprArray[index] = fpr + } + return fprArray, nil +} + +// MarshalJSON is the custom marshaler for FirewallPolicyRule. +func (fpr FirewallPolicyRule) MarshalJSON() ([]byte, error) { + fpr.RuleType = RuleTypeFirewallPolicyRule + objectMap := make(map[string]interface{}) + if fpr.Name != nil { + objectMap["name"] = fpr.Name + } + if fpr.Description != nil { + objectMap["description"] = fpr.Description + } + if fpr.RuleType != "" { + objectMap["ruleType"] = fpr.RuleType + } + return json.Marshal(objectMap) +} + +// AsApplicationRule is the BasicFirewallPolicyRule implementation for FirewallPolicyRule. +func (fpr FirewallPolicyRule) AsApplicationRule() (*ApplicationRule, bool) { + return nil, false +} + +// AsNatRule is the BasicFirewallPolicyRule implementation for FirewallPolicyRule. +func (fpr FirewallPolicyRule) AsNatRule() (*NatRule, bool) { + return nil, false +} + +// AsRule is the BasicFirewallPolicyRule implementation for FirewallPolicyRule. +func (fpr FirewallPolicyRule) AsRule() (*Rule, bool) { + return nil, false +} + +// AsFirewallPolicyRule is the BasicFirewallPolicyRule implementation for FirewallPolicyRule. +func (fpr FirewallPolicyRule) AsFirewallPolicyRule() (*FirewallPolicyRule, bool) { + return &fpr, true +} + +// AsBasicFirewallPolicyRule is the BasicFirewallPolicyRule implementation for FirewallPolicyRule. +func (fpr FirewallPolicyRule) AsBasicFirewallPolicyRule() (BasicFirewallPolicyRule, bool) { + return &fpr, true +} + +// FirewallPolicyRuleApplicationProtocol properties of the application rule protocol. +type FirewallPolicyRuleApplicationProtocol struct { + // ProtocolType - Protocol type. Possible values include: 'FirewallPolicyRuleApplicationProtocolTypeHTTP', 'FirewallPolicyRuleApplicationProtocolTypeHTTPS' + ProtocolType FirewallPolicyRuleApplicationProtocolType `json:"protocolType,omitempty"` + // Port - Port number for the protocol, cannot be greater than 64000. + Port *int32 `json:"port,omitempty"` +} + +// BasicFirewallPolicyRuleCollection properties of the rule collection. +type BasicFirewallPolicyRuleCollection interface { + AsFirewallPolicyNatRuleCollection() (*FirewallPolicyNatRuleCollection, bool) + AsFirewallPolicyFilterRuleCollection() (*FirewallPolicyFilterRuleCollection, bool) + AsFirewallPolicyRuleCollection() (*FirewallPolicyRuleCollection, bool) +} + +// FirewallPolicyRuleCollection properties of the rule collection. +type FirewallPolicyRuleCollection struct { + // Name - The name of the rule collection. + Name *string `json:"name,omitempty"` + // Priority - Priority of the Firewall Policy Rule Collection resource. + Priority *int32 `json:"priority,omitempty"` + // RuleCollectionType - Possible values include: 'RuleCollectionTypeFirewallPolicyRuleCollection', 'RuleCollectionTypeFirewallPolicyNatRuleCollection', 'RuleCollectionTypeFirewallPolicyFilterRuleCollection' + RuleCollectionType RuleCollectionType `json:"ruleCollectionType,omitempty"` +} + +func unmarshalBasicFirewallPolicyRuleCollection(body []byte) (BasicFirewallPolicyRuleCollection, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["ruleCollectionType"] { + case string(RuleCollectionTypeFirewallPolicyNatRuleCollection): + var fpnrc FirewallPolicyNatRuleCollection + err := json.Unmarshal(body, &fpnrc) + return fpnrc, err + case string(RuleCollectionTypeFirewallPolicyFilterRuleCollection): + var fpfrc FirewallPolicyFilterRuleCollection + err := json.Unmarshal(body, &fpfrc) + return fpfrc, err + default: + var fprc FirewallPolicyRuleCollection + err := json.Unmarshal(body, &fprc) + return fprc, err + } +} +func unmarshalBasicFirewallPolicyRuleCollectionArray(body []byte) ([]BasicFirewallPolicyRuleCollection, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + fprcArray := make([]BasicFirewallPolicyRuleCollection, len(rawMessages)) + + for index, rawMessage := range rawMessages { + fprc, err := unmarshalBasicFirewallPolicyRuleCollection(*rawMessage) + if err != nil { + return nil, err + } + fprcArray[index] = fprc + } + return fprcArray, nil +} + +// MarshalJSON is the custom marshaler for FirewallPolicyRuleCollection. +func (fprc FirewallPolicyRuleCollection) MarshalJSON() ([]byte, error) { + fprc.RuleCollectionType = RuleCollectionTypeFirewallPolicyRuleCollection + objectMap := make(map[string]interface{}) + if fprc.Name != nil { + objectMap["name"] = fprc.Name + } + if fprc.Priority != nil { + objectMap["priority"] = fprc.Priority + } + if fprc.RuleCollectionType != "" { + objectMap["ruleCollectionType"] = fprc.RuleCollectionType + } + return json.Marshal(objectMap) +} + +// AsFirewallPolicyNatRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyRuleCollection. +func (fprc FirewallPolicyRuleCollection) AsFirewallPolicyNatRuleCollection() (*FirewallPolicyNatRuleCollection, bool) { + return nil, false +} + +// AsFirewallPolicyFilterRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyRuleCollection. +func (fprc FirewallPolicyRuleCollection) AsFirewallPolicyFilterRuleCollection() (*FirewallPolicyFilterRuleCollection, bool) { + return nil, false +} + +// AsFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyRuleCollection. +func (fprc FirewallPolicyRuleCollection) AsFirewallPolicyRuleCollection() (*FirewallPolicyRuleCollection, bool) { + return &fprc, true +} + +// AsBasicFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyRuleCollection. +func (fprc FirewallPolicyRuleCollection) AsBasicFirewallPolicyRuleCollection() (BasicFirewallPolicyRuleCollection, bool) { + return &fprc, true +} + +// FirewallPolicyRuleCollectionGroup rule Collection Group resource. +type FirewallPolicyRuleCollectionGroup struct { + autorest.Response `json:"-"` + // FirewallPolicyRuleCollectionGroupProperties - The properties of the firewall policy rule collection group. + *FirewallPolicyRuleCollectionGroupProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Rule Group type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for FirewallPolicyRuleCollectionGroup. +func (fprcg FirewallPolicyRuleCollectionGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fprcg.FirewallPolicyRuleCollectionGroupProperties != nil { + objectMap["properties"] = fprcg.FirewallPolicyRuleCollectionGroupProperties + } + if fprcg.Name != nil { + objectMap["name"] = fprcg.Name + } + if fprcg.ID != nil { + objectMap["id"] = fprcg.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FirewallPolicyRuleCollectionGroup struct. +func (fprcg *FirewallPolicyRuleCollectionGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var firewallPolicyRuleCollectionGroupProperties FirewallPolicyRuleCollectionGroupProperties + err = json.Unmarshal(*v, &firewallPolicyRuleCollectionGroupProperties) + if err != nil { + return err + } + fprcg.FirewallPolicyRuleCollectionGroupProperties = &firewallPolicyRuleCollectionGroupProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fprcg.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + fprcg.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fprcg.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fprcg.ID = &ID + } + } + } + + return nil +} + +// FirewallPolicyRuleCollectionGroupListResult response for ListFirewallPolicyRuleCollectionGroups API +// service call. +type FirewallPolicyRuleCollectionGroupListResult struct { + autorest.Response `json:"-"` + // Value - List of FirewallPolicyRuleCollectionGroups in a FirewallPolicy. + Value *[]FirewallPolicyRuleCollectionGroup `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// FirewallPolicyRuleCollectionGroupListResultIterator provides access to a complete listing of +// FirewallPolicyRuleCollectionGroup values. +type FirewallPolicyRuleCollectionGroupListResultIterator struct { + i int + page FirewallPolicyRuleCollectionGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *FirewallPolicyRuleCollectionGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyRuleCollectionGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *FirewallPolicyRuleCollectionGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FirewallPolicyRuleCollectionGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter FirewallPolicyRuleCollectionGroupListResultIterator) Response() FirewallPolicyRuleCollectionGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter FirewallPolicyRuleCollectionGroupListResultIterator) Value() FirewallPolicyRuleCollectionGroup { + if !iter.page.NotDone() { + return FirewallPolicyRuleCollectionGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FirewallPolicyRuleCollectionGroupListResultIterator type. +func NewFirewallPolicyRuleCollectionGroupListResultIterator(page FirewallPolicyRuleCollectionGroupListResultPage) FirewallPolicyRuleCollectionGroupListResultIterator { + return FirewallPolicyRuleCollectionGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (fprcglr FirewallPolicyRuleCollectionGroupListResult) IsEmpty() bool { + return fprcglr.Value == nil || len(*fprcglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (fprcglr FirewallPolicyRuleCollectionGroupListResult) hasNextLink() bool { + return fprcglr.NextLink != nil && len(*fprcglr.NextLink) != 0 +} + +// firewallPolicyRuleCollectionGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (fprcglr FirewallPolicyRuleCollectionGroupListResult) firewallPolicyRuleCollectionGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !fprcglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(fprcglr.NextLink))) +} + +// FirewallPolicyRuleCollectionGroupListResultPage contains a page of FirewallPolicyRuleCollectionGroup +// values. +type FirewallPolicyRuleCollectionGroupListResultPage struct { + fn func(context.Context, FirewallPolicyRuleCollectionGroupListResult) (FirewallPolicyRuleCollectionGroupListResult, error) + fprcglr FirewallPolicyRuleCollectionGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *FirewallPolicyRuleCollectionGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyRuleCollectionGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.fprcglr) + if err != nil { + return err + } + page.fprcglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *FirewallPolicyRuleCollectionGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FirewallPolicyRuleCollectionGroupListResultPage) NotDone() bool { + return !page.fprcglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FirewallPolicyRuleCollectionGroupListResultPage) Response() FirewallPolicyRuleCollectionGroupListResult { + return page.fprcglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FirewallPolicyRuleCollectionGroupListResultPage) Values() []FirewallPolicyRuleCollectionGroup { + if page.fprcglr.IsEmpty() { + return nil + } + return *page.fprcglr.Value +} + +// Creates a new instance of the FirewallPolicyRuleCollectionGroupListResultPage type. +func NewFirewallPolicyRuleCollectionGroupListResultPage(cur FirewallPolicyRuleCollectionGroupListResult, getNextPage func(context.Context, FirewallPolicyRuleCollectionGroupListResult) (FirewallPolicyRuleCollectionGroupListResult, error)) FirewallPolicyRuleCollectionGroupListResultPage { + return FirewallPolicyRuleCollectionGroupListResultPage{ + fn: getNextPage, + fprcglr: cur, + } +} + +// FirewallPolicyRuleCollectionGroupProperties properties of the rule collection group. +type FirewallPolicyRuleCollectionGroupProperties struct { + // Priority - Priority of the Firewall Policy Rule Collection Group resource. + Priority *int32 `json:"priority,omitempty"` + // RuleCollections - Group of Firewall Policy rule collections. + RuleCollections *[]BasicFirewallPolicyRuleCollection `json:"ruleCollections,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the firewall policy rule collection group resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for FirewallPolicyRuleCollectionGroupProperties. +func (fprcgp FirewallPolicyRuleCollectionGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fprcgp.Priority != nil { + objectMap["priority"] = fprcgp.Priority + } + if fprcgp.RuleCollections != nil { + objectMap["ruleCollections"] = fprcgp.RuleCollections + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FirewallPolicyRuleCollectionGroupProperties struct. +func (fprcgp *FirewallPolicyRuleCollectionGroupProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "priority": + if v != nil { + var priority int32 + err = json.Unmarshal(*v, &priority) + if err != nil { + return err + } + fprcgp.Priority = &priority + } + case "ruleCollections": + if v != nil { + ruleCollections, err := unmarshalBasicFirewallPolicyRuleCollectionArray(*v) + if err != nil { + return err + } + fprcgp.RuleCollections = &ruleCollections + } + case "provisioningState": + if v != nil { + var provisioningState ProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + fprcgp.ProvisioningState = provisioningState + } + } + } + + return nil +} + +// FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FirewallPolicyRuleCollectionGroupsClient) (FirewallPolicyRuleCollectionGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture.Result. +func (future *FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture) result(client FirewallPolicyRuleCollectionGroupsClient) (fprcg FirewallPolicyRuleCollectionGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fprcg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fprcg.Response.Response, err = future.GetResult(sender); err == nil && fprcg.Response.Response.StatusCode != http.StatusNoContent { + fprcg, err = client.CreateOrUpdateResponder(fprcg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture", "Result", fprcg.Response.Response, "Failure responding to request") + } + } + return +} + +// FirewallPolicyRuleCollectionGroupsDeleteFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type FirewallPolicyRuleCollectionGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FirewallPolicyRuleCollectionGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FirewallPolicyRuleCollectionGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FirewallPolicyRuleCollectionGroupsDeleteFuture.Result. +func (future *FirewallPolicyRuleCollectionGroupsDeleteFuture) result(client FirewallPolicyRuleCollectionGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.FirewallPolicyRuleCollectionGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// FirewallPolicySNAT the private IP addresses/IP ranges to which traffic will not be SNAT. +type FirewallPolicySNAT struct { + // PrivateRanges - List of private IP addresses/IP address ranges to not be SNAT. + PrivateRanges *[]string `json:"privateRanges,omitempty"` + // AutoLearnPrivateRanges - The operation mode for automatically learning private ranges to not be SNAT. Possible values include: 'AutoLearnPrivateRangesModeEnabled', 'AutoLearnPrivateRangesModeDisabled' + AutoLearnPrivateRanges AutoLearnPrivateRangesMode `json:"autoLearnPrivateRanges,omitempty"` +} + +// FirewallPolicySQL SQL Settings in Firewall Policy. +type FirewallPolicySQL struct { + // AllowSQLRedirect - A flag to indicate if SQL Redirect traffic filtering is enabled. Turning on the flag requires no rule using port 11000-11999. + AllowSQLRedirect *bool `json:"allowSqlRedirect,omitempty"` +} + +// FirewallPolicySku SKU of Firewall policy. +type FirewallPolicySku struct { + // Tier - Tier of Firewall Policy. Possible values include: 'FirewallPolicySkuTierStandard', 'FirewallPolicySkuTierPremium', 'FirewallPolicySkuTierBasic' + Tier FirewallPolicySkuTier `json:"tier,omitempty"` +} + +// FirewallPolicyThreatIntelWhitelist threatIntel Whitelist for Firewall Policy. +type FirewallPolicyThreatIntelWhitelist struct { + // IPAddresses - List of IP addresses for the ThreatIntel Whitelist. + IPAddresses *[]string `json:"ipAddresses,omitempty"` + // Fqdns - List of FQDNs for the ThreatIntel Whitelist. + Fqdns *[]string `json:"fqdns,omitempty"` +} + +// FirewallPolicyTransportSecurity configuration needed to perform TLS termination & initiation. +type FirewallPolicyTransportSecurity struct { + // CertificateAuthority - The CA used for intermediate CA generation. + CertificateAuthority *FirewallPolicyCertificateAuthority `json:"certificateAuthority,omitempty"` +} + +// FlowLog a flow log resource. +type FlowLog struct { + autorest.Response `json:"-"` + // FlowLogPropertiesFormat - Properties of the flow log. + *FlowLogPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for FlowLog. +func (fl FlowLog) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fl.FlowLogPropertiesFormat != nil { + objectMap["properties"] = fl.FlowLogPropertiesFormat + } + if fl.ID != nil { + objectMap["id"] = fl.ID + } + if fl.Location != nil { + objectMap["location"] = fl.Location + } + if fl.Tags != nil { + objectMap["tags"] = fl.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FlowLog struct. +func (fl *FlowLog) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var flowLogPropertiesFormat FlowLogPropertiesFormat + err = json.Unmarshal(*v, &flowLogPropertiesFormat) + if err != nil { + return err + } + fl.FlowLogPropertiesFormat = &flowLogPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + fl.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fl.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fl.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fl.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + fl.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + fl.Tags = tags + } + } + } + + return nil +} + +// FlowLogFormatParameters parameters that define the flow log format. +type FlowLogFormatParameters struct { + // Type - The file type of flow log. Possible values include: 'FlowLogFormatTypeJSON' + Type FlowLogFormatType `json:"type,omitempty"` + // Version - The version (revision) of the flow log. + Version *int32 `json:"version,omitempty"` +} + +// FlowLogInformation information on the configuration of flow log and traffic analytics (optional) . +type FlowLogInformation struct { + autorest.Response `json:"-"` + // TargetResourceID - The ID of the resource to configure for flow log and traffic analytics (optional) . + TargetResourceID *string `json:"targetResourceId,omitempty"` + // FlowLogProperties - Properties of the flow log. + *FlowLogProperties `json:"properties,omitempty"` + // FlowAnalyticsConfiguration - Parameters that define the configuration of traffic analytics. + FlowAnalyticsConfiguration *TrafficAnalyticsProperties `json:"flowAnalyticsConfiguration,omitempty"` +} + +// MarshalJSON is the custom marshaler for FlowLogInformation. +func (fli FlowLogInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fli.TargetResourceID != nil { + objectMap["targetResourceId"] = fli.TargetResourceID + } + if fli.FlowLogProperties != nil { + objectMap["properties"] = fli.FlowLogProperties + } + if fli.FlowAnalyticsConfiguration != nil { + objectMap["flowAnalyticsConfiguration"] = fli.FlowAnalyticsConfiguration + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FlowLogInformation struct. +func (fli *FlowLogInformation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "targetResourceId": + if v != nil { + var targetResourceID string + err = json.Unmarshal(*v, &targetResourceID) + if err != nil { + return err + } + fli.TargetResourceID = &targetResourceID + } + case "properties": + if v != nil { + var flowLogProperties FlowLogProperties + err = json.Unmarshal(*v, &flowLogProperties) + if err != nil { + return err + } + fli.FlowLogProperties = &flowLogProperties + } + case "flowAnalyticsConfiguration": + if v != nil { + var flowAnalyticsConfiguration TrafficAnalyticsProperties + err = json.Unmarshal(*v, &flowAnalyticsConfiguration) + if err != nil { + return err + } + fli.FlowAnalyticsConfiguration = &flowAnalyticsConfiguration + } + } + } + + return nil +} + +// FlowLogListResult list of flow logs. +type FlowLogListResult struct { + autorest.Response `json:"-"` + // Value - Information about flow log resource. + Value *[]FlowLog `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for FlowLogListResult. +func (fllr FlowLogListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fllr.Value != nil { + objectMap["value"] = fllr.Value + } + return json.Marshal(objectMap) +} + +// FlowLogListResultIterator provides access to a complete listing of FlowLog values. +type FlowLogListResultIterator struct { + i int + page FlowLogListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *FlowLogListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FlowLogListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *FlowLogListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FlowLogListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter FlowLogListResultIterator) Response() FlowLogListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter FlowLogListResultIterator) Value() FlowLog { + if !iter.page.NotDone() { + return FlowLog{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FlowLogListResultIterator type. +func NewFlowLogListResultIterator(page FlowLogListResultPage) FlowLogListResultIterator { + return FlowLogListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (fllr FlowLogListResult) IsEmpty() bool { + return fllr.Value == nil || len(*fllr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (fllr FlowLogListResult) hasNextLink() bool { + return fllr.NextLink != nil && len(*fllr.NextLink) != 0 +} + +// flowLogListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (fllr FlowLogListResult) flowLogListResultPreparer(ctx context.Context) (*http.Request, error) { + if !fllr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(fllr.NextLink))) +} + +// FlowLogListResultPage contains a page of FlowLog values. +type FlowLogListResultPage struct { + fn func(context.Context, FlowLogListResult) (FlowLogListResult, error) + fllr FlowLogListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *FlowLogListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FlowLogListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.fllr) + if err != nil { + return err + } + page.fllr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *FlowLogListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FlowLogListResultPage) NotDone() bool { + return !page.fllr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FlowLogListResultPage) Response() FlowLogListResult { + return page.fllr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FlowLogListResultPage) Values() []FlowLog { + if page.fllr.IsEmpty() { + return nil + } + return *page.fllr.Value +} + +// Creates a new instance of the FlowLogListResultPage type. +func NewFlowLogListResultPage(cur FlowLogListResult, getNextPage func(context.Context, FlowLogListResult) (FlowLogListResult, error)) FlowLogListResultPage { + return FlowLogListResultPage{ + fn: getNextPage, + fllr: cur, + } +} + +// FlowLogProperties parameters that define the configuration of flow log. +type FlowLogProperties struct { + // StorageID - ID of the storage account which is used to store the flow log. + StorageID *string `json:"storageId,omitempty"` + // Enabled - Flag to enable/disable flow logging. + Enabled *bool `json:"enabled,omitempty"` + // RetentionPolicy - Parameters that define the retention policy for flow log. + RetentionPolicy *RetentionPolicyParameters `json:"retentionPolicy,omitempty"` + // Format - Parameters that define the flow log format. + Format *FlowLogFormatParameters `json:"format,omitempty"` +} + +// FlowLogPropertiesFormat parameters that define the configuration of flow log. +type FlowLogPropertiesFormat struct { + // TargetResourceID - ID of network security group to which flow log will be applied. + TargetResourceID *string `json:"targetResourceId,omitempty"` + // TargetResourceGUID - READ-ONLY; Guid of network security group to which flow log will be applied. + TargetResourceGUID *string `json:"targetResourceGuid,omitempty"` + // StorageID - ID of the storage account which is used to store the flow log. + StorageID *string `json:"storageId,omitempty"` + // Enabled - Flag to enable/disable flow logging. + Enabled *bool `json:"enabled,omitempty"` + // RetentionPolicy - Parameters that define the retention policy for flow log. + RetentionPolicy *RetentionPolicyParameters `json:"retentionPolicy,omitempty"` + // Format - Parameters that define the flow log format. + Format *FlowLogFormatParameters `json:"format,omitempty"` + // FlowAnalyticsConfiguration - Parameters that define the configuration of traffic analytics. + FlowAnalyticsConfiguration *TrafficAnalyticsProperties `json:"flowAnalyticsConfiguration,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the flow log. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for FlowLogPropertiesFormat. +func (flpf FlowLogPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if flpf.TargetResourceID != nil { + objectMap["targetResourceId"] = flpf.TargetResourceID + } + if flpf.StorageID != nil { + objectMap["storageId"] = flpf.StorageID + } + if flpf.Enabled != nil { + objectMap["enabled"] = flpf.Enabled + } + if flpf.RetentionPolicy != nil { + objectMap["retentionPolicy"] = flpf.RetentionPolicy + } + if flpf.Format != nil { + objectMap["format"] = flpf.Format + } + if flpf.FlowAnalyticsConfiguration != nil { + objectMap["flowAnalyticsConfiguration"] = flpf.FlowAnalyticsConfiguration + } + return json.Marshal(objectMap) +} + +// FlowLogStatusParameters parameters that define a resource to query flow log and traffic analytics +// (optional) status. +type FlowLogStatusParameters struct { + // TargetResourceID - The target resource where getting the flow log and traffic analytics (optional) status. + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// FlowLogsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type FlowLogsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FlowLogsClient) (FlowLog, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FlowLogsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FlowLogsCreateOrUpdateFuture.Result. +func (future *FlowLogsCreateOrUpdateFuture) result(client FlowLogsClient) (fl FlowLog, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fl.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.FlowLogsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fl.Response.Response, err = future.GetResult(sender); err == nil && fl.Response.Response.StatusCode != http.StatusNoContent { + fl, err = client.CreateOrUpdateResponder(fl.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsCreateOrUpdateFuture", "Result", fl.Response.Response, "Failure responding to request") + } + } + return +} + +// FlowLogsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type FlowLogsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FlowLogsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FlowLogsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FlowLogsDeleteFuture.Result. +func (future *FlowLogsDeleteFuture) result(client FlowLogsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.FlowLogsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// FrontendIPConfiguration frontend IP address of the load balancer. +type FrontendIPConfiguration struct { + autorest.Response `json:"-"` + // FrontendIPConfigurationPropertiesFormat - Properties of the load balancer probe. + *FrontendIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - 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. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // Zones - A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones *[]string `json:"zones,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for FrontendIPConfiguration. +func (fic FrontendIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fic.FrontendIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = fic.FrontendIPConfigurationPropertiesFormat + } + if fic.Name != nil { + objectMap["name"] = fic.Name + } + if fic.Zones != nil { + objectMap["zones"] = fic.Zones + } + if fic.ID != nil { + objectMap["id"] = fic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FrontendIPConfiguration struct. +func (fic *FrontendIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var frontendIPConfigurationPropertiesFormat FrontendIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &frontendIPConfigurationPropertiesFormat) + if err != nil { + return err + } + fic.FrontendIPConfigurationPropertiesFormat = &frontendIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + fic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fic.Type = &typeVar + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + fic.Zones = &zones + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fic.ID = &ID + } + } + } + + return nil +} + +// FrontendIPConfigurationPropertiesFormat properties of Frontend IP Configuration of the load balancer. +type FrontendIPConfigurationPropertiesFormat struct { + // InboundNatRules - READ-ONLY; An array of references to inbound rules that use this frontend IP. + InboundNatRules *[]SubResource `json:"inboundNatRules,omitempty"` + // InboundNatPools - READ-ONLY; An array of references to inbound pools that use this frontend IP. + InboundNatPools *[]SubResource `json:"inboundNatPools,omitempty"` + // OutboundRules - READ-ONLY; An array of references to outbound rules that use this frontend IP. + OutboundRules *[]SubResource `json:"outboundRules,omitempty"` + // LoadBalancingRules - READ-ONLY; An array of references to load balancing rules that use this frontend IP. + LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` + // PrivateIPAddress - The private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // PrivateIPAllocationMethod - The Private IP allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // PrivateIPAddressVersion - Whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' + PrivateIPAddressVersion IPVersion `json:"privateIPAddressVersion,omitempty"` + // Subnet - The reference to the subnet resource. + Subnet *Subnet `json:"subnet,omitempty"` + // PublicIPAddress - The reference to the Public IP resource. + PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` + // PublicIPPrefix - The reference to the Public IP Prefix resource. + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` + // GatewayLoadBalancer - The reference to gateway load balancer frontend IP. + GatewayLoadBalancer *SubResource `json:"gatewayLoadBalancer,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the frontend IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for FrontendIPConfigurationPropertiesFormat. +func (ficpf FrontendIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ficpf.PrivateIPAddress != nil { + objectMap["privateIPAddress"] = ficpf.PrivateIPAddress + } + if ficpf.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = ficpf.PrivateIPAllocationMethod + } + if ficpf.PrivateIPAddressVersion != "" { + objectMap["privateIPAddressVersion"] = ficpf.PrivateIPAddressVersion + } + if ficpf.Subnet != nil { + objectMap["subnet"] = ficpf.Subnet + } + if ficpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = ficpf.PublicIPAddress + } + if ficpf.PublicIPPrefix != nil { + objectMap["publicIPPrefix"] = ficpf.PublicIPPrefix + } + if ficpf.GatewayLoadBalancer != nil { + objectMap["gatewayLoadBalancer"] = ficpf.GatewayLoadBalancer + } + return json.Marshal(objectMap) +} + +// GatewayCustomBgpIPAddressIPConfiguration gatewayCustomBgpIpAddressIpConfiguration for a virtual network +// gateway connection. +type GatewayCustomBgpIPAddressIPConfiguration struct { + // IPConfigurationID - The IpconfigurationId of ipconfiguration which belongs to gateway. + IPConfigurationID *string `json:"ipConfigurationId,omitempty"` + // CustomBgpIPAddress - The custom BgpPeeringAddress which belongs to IpconfigurationId. + CustomBgpIPAddress *string `json:"customBgpIpAddress,omitempty"` +} + +// GatewayLoadBalancerTunnelInterface gateway load balancer tunnel interface of a load balancer backend +// address pool. +type GatewayLoadBalancerTunnelInterface struct { + // Port - Port of gateway load balancer tunnel interface. + Port *int32 `json:"port,omitempty"` + // Identifier - Identifier of gateway load balancer tunnel interface. + Identifier *int32 `json:"identifier,omitempty"` + // Protocol - Protocol of gateway load balancer tunnel interface. Possible values include: 'GatewayLoadBalancerTunnelProtocolNone', 'GatewayLoadBalancerTunnelProtocolNative', 'GatewayLoadBalancerTunnelProtocolVXLAN' + Protocol GatewayLoadBalancerTunnelProtocol `json:"protocol,omitempty"` + // Type - Traffic type of gateway load balancer tunnel interface. Possible values include: 'GatewayLoadBalancerTunnelInterfaceTypeNone', 'GatewayLoadBalancerTunnelInterfaceTypeInternal', 'GatewayLoadBalancerTunnelInterfaceTypeExternal' + Type GatewayLoadBalancerTunnelInterfaceType `json:"type,omitempty"` +} + +// GatewayRoute gateway routing details. +type GatewayRoute struct { + // LocalAddress - READ-ONLY; The gateway's local address. + LocalAddress *string `json:"localAddress,omitempty"` + // NetworkProperty - READ-ONLY; The route's network prefix. + NetworkProperty *string `json:"network,omitempty"` + // NextHop - READ-ONLY; The route's next hop. + NextHop *string `json:"nextHop,omitempty"` + // SourcePeer - READ-ONLY; The peer this route was learned from. + SourcePeer *string `json:"sourcePeer,omitempty"` + // Origin - READ-ONLY; The source this route was learned from. + Origin *string `json:"origin,omitempty"` + // AsPath - READ-ONLY; The route's AS path sequence. + AsPath *string `json:"asPath,omitempty"` + // Weight - READ-ONLY; The route's weight. + Weight *int32 `json:"weight,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayRoute. +func (gr GatewayRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// GatewayRouteListResult list of virtual network gateway routes. +type GatewayRouteListResult struct { + autorest.Response `json:"-"` + // Value - List of gateway routes. + Value *[]GatewayRoute `json:"value,omitempty"` +} + +// GenerateExpressRoutePortsLOARequest the customer name to be printed on a letter of authorization. +type GenerateExpressRoutePortsLOARequest struct { + // CustomerName - The customer name. + CustomerName *string `json:"customerName,omitempty"` +} + +// GenerateExpressRoutePortsLOAResult response for GenerateExpressRoutePortsLOA API service call. +type GenerateExpressRoutePortsLOAResult struct { + autorest.Response `json:"-"` + // EncodedContent - The content as a base64 encoded string. + EncodedContent *string `json:"encodedContent,omitempty"` +} + +// GeneratevirtualwanvpnserverconfigurationvpnprofileFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type GeneratevirtualwanvpnserverconfigurationvpnprofileFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BaseClient) (VpnProfileResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GeneratevirtualwanvpnserverconfigurationvpnprofileFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for GeneratevirtualwanvpnserverconfigurationvpnprofileFuture.Result. +func (future *GeneratevirtualwanvpnserverconfigurationvpnprofileFuture) result(client BaseClient) (vpr VpnProfileResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.GeneratevirtualwanvpnserverconfigurationvpnprofileFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vpr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.GeneratevirtualwanvpnserverconfigurationvpnprofileFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vpr.Response.Response, err = future.GetResult(sender); err == nil && vpr.Response.Response.StatusCode != http.StatusNoContent { + vpr, err = client.GeneratevirtualwanvpnserverconfigurationvpnprofileResponder(vpr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.GeneratevirtualwanvpnserverconfigurationvpnprofileFuture", "Result", vpr.Response.Response, "Failure responding to request") + } + } + return +} + +// GetActiveSessionsAllFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GetActiveSessionsAllFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BaseClient) (BastionActiveSessionListResultPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GetActiveSessionsAllFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for GetActiveSessionsAllFuture.Result. +func (future *GetActiveSessionsAllFuture) result(client BaseClient) (baslrp BastionActiveSessionListResultPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.GetActiveSessionsAllFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + baslrp.baslr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.GetActiveSessionsAllFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if baslrp.baslr.Response.Response, err = future.GetResult(sender); err == nil && baslrp.baslr.Response.Response.StatusCode != http.StatusNoContent { + baslrp, err = client.GetActiveSessionsResponder(baslrp.baslr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.GetActiveSessionsAllFuture", "Result", baslrp.baslr.Response.Response, "Failure responding to request") + } + } + return +} + +// GetActiveSessionsFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GetActiveSessionsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BaseClient) (BastionActiveSessionListResultPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GetActiveSessionsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for GetActiveSessionsFuture.Result. +func (future *GetActiveSessionsFuture) result(client BaseClient) (baslrp BastionActiveSessionListResultPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.GetActiveSessionsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + baslrp.baslr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.GetActiveSessionsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if baslrp.baslr.Response.Response, err = future.GetResult(sender); err == nil && baslrp.baslr.Response.Response.StatusCode != http.StatusNoContent { + baslrp, err = client.GetActiveSessionsResponder(baslrp.baslr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.GetActiveSessionsFuture", "Result", baslrp.baslr.Response.Response, "Failure responding to request") + } + } + return +} + +// GetInboundRoutesParameters the parameters specifying the connection resource whose inbound routes are +// being requested. +type GetInboundRoutesParameters struct { + // ResourceURI - The connection resource whose inbound routes are being requested. + ResourceURI *string `json:"resourceUri,omitempty"` + // ConnectionType - The type of the specified connection resource like ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and P2SConnection. + ConnectionType *string `json:"connectionType,omitempty"` +} + +// GetOutboundRoutesParameters the parameters specifying the connection resource whose outbound routes are +// being requested. +type GetOutboundRoutesParameters struct { + // ResourceURI - The connection resource whose outbound routes are being requested. + ResourceURI *string `json:"resourceUri,omitempty"` + // ConnectionType - The type of the specified connection resource like ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and P2SConnection. + ConnectionType *string `json:"connectionType,omitempty"` +} + +// GetVpnSitesConfigurationRequest list of Vpn-Sites. +type GetVpnSitesConfigurationRequest struct { + // VpnSites - List of resource-ids of the vpn-sites for which config is to be downloaded. + VpnSites *[]string `json:"vpnSites,omitempty"` + // OutputBlobSasURL - The sas-url to download the configurations for vpn-sites. + OutputBlobSasURL *string `json:"outputBlobSasUrl,omitempty"` +} + +// Group the network group resource +type Group struct { + autorest.Response `json:"-"` + // GroupProperties - The Network Group properties + *GroupProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for Group. +func (g Group) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if g.GroupProperties != nil { + objectMap["properties"] = g.GroupProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Group struct. +func (g *Group) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var groupProperties GroupProperties + err = json.Unmarshal(*v, &groupProperties) + if err != nil { + return err + } + g.GroupProperties = &groupProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + g.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + g.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + g.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + g.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + g.Etag = &etag + } + } + } + + return nil +} + +// GroupListResult result of the request to list NetworkGroup. It contains a list of groups and a URL link +// to get the next set of results. +type GroupListResult struct { + autorest.Response `json:"-"` + // Value - Gets a page of NetworkGroup + Value *[]Group `json:"value,omitempty"` + // NextLink - Gets the URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// GroupListResultIterator provides access to a complete listing of Group values. +type GroupListResultIterator struct { + i int + page GroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *GroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *GroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter GroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter GroupListResultIterator) Response() GroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter GroupListResultIterator) Value() Group { + if !iter.page.NotDone() { + return Group{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the GroupListResultIterator type. +func NewGroupListResultIterator(page GroupListResultPage) GroupListResultIterator { + return GroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (glr GroupListResult) IsEmpty() bool { + return glr.Value == nil || len(*glr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (glr GroupListResult) hasNextLink() bool { + return glr.NextLink != nil && len(*glr.NextLink) != 0 +} + +// groupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (glr GroupListResult) groupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !glr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(glr.NextLink))) +} + +// GroupListResultPage contains a page of Group values. +type GroupListResultPage struct { + fn func(context.Context, GroupListResult) (GroupListResult, error) + glr GroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *GroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.glr) + if err != nil { + return err + } + page.glr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *GroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page GroupListResultPage) NotDone() bool { + return !page.glr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page GroupListResultPage) Response() GroupListResult { + return page.glr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page GroupListResultPage) Values() []Group { + if page.glr.IsEmpty() { + return nil + } + return *page.glr.Value +} + +// Creates a new instance of the GroupListResultPage type. +func NewGroupListResultPage(cur GroupListResult, getNextPage func(context.Context, GroupListResult) (GroupListResult, error)) GroupListResultPage { + return GroupListResultPage{ + fn: getNextPage, + glr: cur, + } +} + +// GroupProperties properties of network group +type GroupProperties struct { + // Description - A description of the network group. + Description *string `json:"description,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the scope assignment resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for GroupProperties. +func (gp GroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gp.Description != nil { + objectMap["description"] = gp.Description + } + return json.Marshal(objectMap) +} + +// GroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type GroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(GroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for GroupsDeleteFuture.Result. +func (future *GroupsDeleteFuture) result(client GroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.GroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.GroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// HTTPConfiguration HTTP configuration of the connectivity check. +type HTTPConfiguration struct { + // Method - HTTP method. Possible values include: 'HTTPMethodGet' + Method HTTPMethod `json:"method,omitempty"` + // Headers - List of HTTP headers. + Headers *[]HTTPHeader `json:"headers,omitempty"` + // ValidStatusCodes - Valid status codes. + ValidStatusCodes *[]int32 `json:"validStatusCodes,omitempty"` +} + +// HTTPHeader the HTTP header. +type HTTPHeader struct { + // Name - The name in HTTP header. + Name *string `json:"name,omitempty"` + // Value - The value in HTTP header. + Value *string `json:"value,omitempty"` +} + +// HopLink hop link. +type HopLink struct { + // NextHopID - READ-ONLY; The ID of the next hop. + NextHopID *string `json:"nextHopId,omitempty"` + // LinkType - READ-ONLY; Link type. + LinkType *string `json:"linkType,omitempty"` + // HopLinkProperties - Hop link properties. + *HopLinkProperties `json:"properties,omitempty"` + // Issues - READ-ONLY; List of issues. + Issues *[]ConnectivityIssue `json:"issues,omitempty"` + // Context - READ-ONLY; Provides additional context on links. + Context map[string]*string `json:"context"` + // ResourceID - READ-ONLY; Resource ID. + ResourceID *string `json:"resourceId,omitempty"` +} + +// MarshalJSON is the custom marshaler for HopLink. +func (hl HopLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hl.HopLinkProperties != nil { + objectMap["properties"] = hl.HopLinkProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for HopLink struct. +func (hl *HopLink) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "nextHopId": + if v != nil { + var nextHopID string + err = json.Unmarshal(*v, &nextHopID) + if err != nil { + return err + } + hl.NextHopID = &nextHopID + } + case "linkType": + if v != nil { + var linkType string + err = json.Unmarshal(*v, &linkType) + if err != nil { + return err + } + hl.LinkType = &linkType + } + case "properties": + if v != nil { + var hopLinkProperties HopLinkProperties + err = json.Unmarshal(*v, &hopLinkProperties) + if err != nil { + return err + } + hl.HopLinkProperties = &hopLinkProperties + } + case "issues": + if v != nil { + var issues []ConnectivityIssue + err = json.Unmarshal(*v, &issues) + if err != nil { + return err + } + hl.Issues = &issues + } + case "context": + if v != nil { + var context map[string]*string + err = json.Unmarshal(*v, &context) + if err != nil { + return err + } + hl.Context = context + } + case "resourceId": + if v != nil { + var resourceID string + err = json.Unmarshal(*v, &resourceID) + if err != nil { + return err + } + hl.ResourceID = &resourceID + } + } + } + + return nil +} + +// HopLinkProperties hop link properties. +type HopLinkProperties struct { + // RoundTripTimeMin - READ-ONLY; Minimum roundtrip time in milliseconds. + RoundTripTimeMin *int64 `json:"roundTripTimeMin,omitempty"` + // RoundTripTimeAvg - READ-ONLY; Average roundtrip time in milliseconds. + RoundTripTimeAvg *int64 `json:"roundTripTimeAvg,omitempty"` + // RoundTripTimeMax - READ-ONLY; Maximum roundtrip time in milliseconds. + RoundTripTimeMax *int64 `json:"roundTripTimeMax,omitempty"` +} + +// MarshalJSON is the custom marshaler for HopLinkProperties. +func (hlp HopLinkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Hub hub Item. +type Hub struct { + // ResourceID - Resource Id. + ResourceID *string `json:"resourceId,omitempty"` + // ResourceType - Resource Type. + ResourceType *string `json:"resourceType,omitempty"` +} + +// HubIPAddresses IP addresses associated with azure firewall. +type HubIPAddresses struct { + // PublicIPs - Public IP addresses associated with azure firewall. + PublicIPs *HubPublicIPAddresses `json:"publicIPs,omitempty"` + // PrivateIPAddress - Private IP Address associated with azure firewall. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` +} + +// HubIPConfiguration ipConfigurations. +type HubIPConfiguration struct { + autorest.Response `json:"-"` + // HubIPConfigurationPropertiesFormat - The properties of the Virtual Hub IPConfigurations. + *HubIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the Ip Configuration. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Ipconfiguration type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for HubIPConfiguration. +func (hic HubIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hic.HubIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = hic.HubIPConfigurationPropertiesFormat + } + if hic.Name != nil { + objectMap["name"] = hic.Name + } + if hic.ID != nil { + objectMap["id"] = hic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for HubIPConfiguration struct. +func (hic *HubIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var hubIPConfigurationPropertiesFormat HubIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &hubIPConfigurationPropertiesFormat) + if err != nil { + return err + } + hic.HubIPConfigurationPropertiesFormat = &hubIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + hic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + hic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + hic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + hic.ID = &ID + } + } + } + + return nil +} + +// HubIPConfigurationPropertiesFormat properties of IP configuration. +type HubIPConfigurationPropertiesFormat struct { + // PrivateIPAddress - The private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // Subnet - The reference to the subnet resource. + Subnet *Subnet `json:"subnet,omitempty"` + // PublicIPAddress - The reference to the public IP resource. + PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for HubIPConfigurationPropertiesFormat. +func (hicpf HubIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hicpf.PrivateIPAddress != nil { + objectMap["privateIPAddress"] = hicpf.PrivateIPAddress + } + if hicpf.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = hicpf.PrivateIPAllocationMethod + } + if hicpf.Subnet != nil { + objectMap["subnet"] = hicpf.Subnet + } + if hicpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = hicpf.PublicIPAddress + } + return json.Marshal(objectMap) +} + +// HubPublicIPAddresses public IP addresses associated with azure firewall. +type HubPublicIPAddresses struct { + // Addresses - The list of Public IP addresses associated with azure firewall or IP addresses to be retained. + Addresses *[]AzureFirewallPublicIPAddress `json:"addresses,omitempty"` + // Count - The number of Public IP addresses associated with azure firewall. + Count *int32 `json:"count,omitempty"` +} + +// HubRoute routeTable route. +type HubRoute struct { + // Name - The name of the Route that is unique within a RouteTable. This name can be used to access this route. + Name *string `json:"name,omitempty"` + // DestinationType - The type of destinations (eg: CIDR, ResourceId, Service). + DestinationType *string `json:"destinationType,omitempty"` + // Destinations - List of all destinations. + Destinations *[]string `json:"destinations,omitempty"` + // NextHopType - The type of next hop (eg: ResourceId). + NextHopType *string `json:"nextHopType,omitempty"` + // NextHop - NextHop resource ID. + NextHop *string `json:"nextHop,omitempty"` +} + +// HubRouteTable routeTable resource in a virtual hub. +type HubRouteTable struct { + autorest.Response `json:"-"` + // HubRouteTableProperties - Properties of the RouteTable resource. + *HubRouteTableProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for HubRouteTable. +func (hrt HubRouteTable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hrt.HubRouteTableProperties != nil { + objectMap["properties"] = hrt.HubRouteTableProperties + } + if hrt.Name != nil { + objectMap["name"] = hrt.Name + } + if hrt.ID != nil { + objectMap["id"] = hrt.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for HubRouteTable struct. +func (hrt *HubRouteTable) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var hubRouteTableProperties HubRouteTableProperties + err = json.Unmarshal(*v, &hubRouteTableProperties) + if err != nil { + return err + } + hrt.HubRouteTableProperties = &hubRouteTableProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + hrt.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + hrt.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + hrt.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + hrt.ID = &ID + } + } + } + + return nil +} + +// HubRouteTableProperties parameters for RouteTable. +type HubRouteTableProperties struct { + // Routes - List of all routes. + Routes *[]HubRoute `json:"routes,omitempty"` + // Labels - List of labels associated with this route table. + Labels *[]string `json:"labels,omitempty"` + // AssociatedConnections - READ-ONLY; List of all connections associated with this route table. + AssociatedConnections *[]string `json:"associatedConnections,omitempty"` + // PropagatingConnections - READ-ONLY; List of all connections that advertise to this route table. + PropagatingConnections *[]string `json:"propagatingConnections,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the RouteTable resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for HubRouteTableProperties. +func (hrtp HubRouteTableProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hrtp.Routes != nil { + objectMap["routes"] = hrtp.Routes + } + if hrtp.Labels != nil { + objectMap["labels"] = hrtp.Labels + } + return json.Marshal(objectMap) +} + +// HubRouteTablesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type HubRouteTablesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(HubRouteTablesClient) (HubRouteTable, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *HubRouteTablesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for HubRouteTablesCreateOrUpdateFuture.Result. +func (future *HubRouteTablesCreateOrUpdateFuture) result(client HubRouteTablesClient) (hrt HubRouteTable, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubRouteTablesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + hrt.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.HubRouteTablesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if hrt.Response.Response, err = future.GetResult(sender); err == nil && hrt.Response.Response.StatusCode != http.StatusNoContent { + hrt, err = client.CreateOrUpdateResponder(hrt.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubRouteTablesCreateOrUpdateFuture", "Result", hrt.Response.Response, "Failure responding to request") + } + } + return +} + +// HubRouteTablesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type HubRouteTablesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(HubRouteTablesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *HubRouteTablesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for HubRouteTablesDeleteFuture.Result. +func (future *HubRouteTablesDeleteFuture) result(client HubRouteTablesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubRouteTablesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.HubRouteTablesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// HubVirtualNetworkConnection hubVirtualNetworkConnection Resource. +type HubVirtualNetworkConnection struct { + autorest.Response `json:"-"` + // HubVirtualNetworkConnectionProperties - Properties of the hub virtual network connection. + *HubVirtualNetworkConnectionProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for HubVirtualNetworkConnection. +func (hvnc HubVirtualNetworkConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hvnc.HubVirtualNetworkConnectionProperties != nil { + objectMap["properties"] = hvnc.HubVirtualNetworkConnectionProperties + } + if hvnc.Name != nil { + objectMap["name"] = hvnc.Name + } + if hvnc.ID != nil { + objectMap["id"] = hvnc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for HubVirtualNetworkConnection struct. +func (hvnc *HubVirtualNetworkConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var hubVirtualNetworkConnectionProperties HubVirtualNetworkConnectionProperties + err = json.Unmarshal(*v, &hubVirtualNetworkConnectionProperties) + if err != nil { + return err + } + hvnc.HubVirtualNetworkConnectionProperties = &hubVirtualNetworkConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + hvnc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + hvnc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + hvnc.ID = &ID + } + } + } + + return nil +} + +// HubVirtualNetworkConnectionProperties parameters for HubVirtualNetworkConnection. +type HubVirtualNetworkConnectionProperties struct { + // RemoteVirtualNetwork - Reference to the remote virtual network. + RemoteVirtualNetwork *SubResource `json:"remoteVirtualNetwork,omitempty"` + // AllowHubToRemoteVnetTransit - Deprecated: VirtualHub to RemoteVnet transit to enabled or not. + AllowHubToRemoteVnetTransit *bool `json:"allowHubToRemoteVnetTransit,omitempty"` + // AllowRemoteVnetToUseHubVnetGateways - Deprecated: Allow RemoteVnet to use Virtual Hub's gateways. + AllowRemoteVnetToUseHubVnetGateways *bool `json:"allowRemoteVnetToUseHubVnetGateways,omitempty"` + // EnableInternetSecurity - Enable internet security. + EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` + // RoutingConfiguration - The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the hub virtual network connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for HubVirtualNetworkConnectionProperties. +func (hvncp HubVirtualNetworkConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hvncp.RemoteVirtualNetwork != nil { + objectMap["remoteVirtualNetwork"] = hvncp.RemoteVirtualNetwork + } + if hvncp.AllowHubToRemoteVnetTransit != nil { + objectMap["allowHubToRemoteVnetTransit"] = hvncp.AllowHubToRemoteVnetTransit + } + if hvncp.AllowRemoteVnetToUseHubVnetGateways != nil { + objectMap["allowRemoteVnetToUseHubVnetGateways"] = hvncp.AllowRemoteVnetToUseHubVnetGateways + } + if hvncp.EnableInternetSecurity != nil { + objectMap["enableInternetSecurity"] = hvncp.EnableInternetSecurity + } + if hvncp.RoutingConfiguration != nil { + objectMap["routingConfiguration"] = hvncp.RoutingConfiguration + } + return json.Marshal(objectMap) +} + +// HubVirtualNetworkConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type HubVirtualNetworkConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(HubVirtualNetworkConnectionsClient) (HubVirtualNetworkConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *HubVirtualNetworkConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for HubVirtualNetworkConnectionsCreateOrUpdateFuture.Result. +func (future *HubVirtualNetworkConnectionsCreateOrUpdateFuture) result(client HubVirtualNetworkConnectionsClient) (hvnc HubVirtualNetworkConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + hvnc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.HubVirtualNetworkConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if hvnc.Response.Response, err = future.GetResult(sender); err == nil && hvnc.Response.Response.StatusCode != http.StatusNoContent { + hvnc, err = client.CreateOrUpdateResponder(hvnc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsCreateOrUpdateFuture", "Result", hvnc.Response.Response, "Failure responding to request") + } + } + return +} + +// HubVirtualNetworkConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type HubVirtualNetworkConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(HubVirtualNetworkConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *HubVirtualNetworkConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for HubVirtualNetworkConnectionsDeleteFuture.Result. +func (future *HubVirtualNetworkConnectionsDeleteFuture) result(client HubVirtualNetworkConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.HubVirtualNetworkConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// IDPSQueryObject will describe the query to run against the IDPS signatures DB +type IDPSQueryObject struct { + // Filters - Contain all filters names and values + Filters *[]FilterItems `json:"filters,omitempty"` + // Search - Search term in all columns + Search *string `json:"search,omitempty"` + // OrderBy - Column to sort response by + OrderBy *OrderBy `json:"orderBy,omitempty"` + // ResultsPerPage - The number of the results to return in each page + ResultsPerPage *int32 `json:"resultsPerPage,omitempty"` + // Skip - The number of records matching the filter to skip + Skip *int32 `json:"skip,omitempty"` +} + +// IPAddressAvailabilityResult response for CheckIPAddressAvailability API service call. +type IPAddressAvailabilityResult struct { + autorest.Response `json:"-"` + // Available - Private IP address availability. + Available *bool `json:"available,omitempty"` + // AvailableIPAddresses - Contains other available private IP addresses if the asked for address is taken. + AvailableIPAddresses *[]string `json:"availableIPAddresses,omitempty"` + // IsPlatformReserved - Private IP address platform reserved. + IsPlatformReserved *bool `json:"isPlatformReserved,omitempty"` +} + +// IPAllocation ipAllocation resource. +type IPAllocation struct { + autorest.Response `json:"-"` + // IPAllocationPropertiesFormat - Properties of the IpAllocation. + *IPAllocationPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for IPAllocation. +func (ia IPAllocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ia.IPAllocationPropertiesFormat != nil { + objectMap["properties"] = ia.IPAllocationPropertiesFormat + } + if ia.ID != nil { + objectMap["id"] = ia.ID + } + if ia.Location != nil { + objectMap["location"] = ia.Location + } + if ia.Tags != nil { + objectMap["tags"] = ia.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for IPAllocation struct. +func (ia *IPAllocation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var IPAllocationPropertiesFormat IPAllocationPropertiesFormat + err = json.Unmarshal(*v, &IPAllocationPropertiesFormat) + if err != nil { + return err + } + ia.IPAllocationPropertiesFormat = &IPAllocationPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ia.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ia.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ia.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ia.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ia.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ia.Tags = tags + } + } + } + + return nil +} + +// IPAllocationListResult response for the ListIpAllocations API service call. +type IPAllocationListResult struct { + autorest.Response `json:"-"` + // Value - A list of IpAllocation resources. + Value *[]IPAllocation `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// IPAllocationListResultIterator provides access to a complete listing of IPAllocation values. +type IPAllocationListResultIterator struct { + i int + page IPAllocationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *IPAllocationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPAllocationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *IPAllocationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter IPAllocationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter IPAllocationListResultIterator) Response() IPAllocationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter IPAllocationListResultIterator) Value() IPAllocation { + if !iter.page.NotDone() { + return IPAllocation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the IPAllocationListResultIterator type. +func NewIPAllocationListResultIterator(page IPAllocationListResultPage) IPAllocationListResultIterator { + return IPAllocationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ialr IPAllocationListResult) IsEmpty() bool { + return ialr.Value == nil || len(*ialr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ialr IPAllocationListResult) hasNextLink() bool { + return ialr.NextLink != nil && len(*ialr.NextLink) != 0 +} + +// iPAllocationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ialr IPAllocationListResult) iPAllocationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ialr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ialr.NextLink))) +} + +// IPAllocationListResultPage contains a page of IPAllocation values. +type IPAllocationListResultPage struct { + fn func(context.Context, IPAllocationListResult) (IPAllocationListResult, error) + ialr IPAllocationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *IPAllocationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPAllocationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ialr) + if err != nil { + return err + } + page.ialr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *IPAllocationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IPAllocationListResultPage) NotDone() bool { + return !page.ialr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IPAllocationListResultPage) Response() IPAllocationListResult { + return page.ialr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IPAllocationListResultPage) Values() []IPAllocation { + if page.ialr.IsEmpty() { + return nil + } + return *page.ialr.Value +} + +// Creates a new instance of the IPAllocationListResultPage type. +func NewIPAllocationListResultPage(cur IPAllocationListResult, getNextPage func(context.Context, IPAllocationListResult) (IPAllocationListResult, error)) IPAllocationListResultPage { + return IPAllocationListResultPage{ + fn: getNextPage, + ialr: cur, + } +} + +// IPAllocationPropertiesFormat properties of the IpAllocation. +type IPAllocationPropertiesFormat struct { + // Subnet - READ-ONLY; The Subnet that using the prefix of this IpAllocation resource. + Subnet *SubResource `json:"subnet,omitempty"` + // VirtualNetwork - READ-ONLY; The VirtualNetwork that using the prefix of this IpAllocation resource. + VirtualNetwork *SubResource `json:"virtualNetwork,omitempty"` + // Type - The type for the IpAllocation. Possible values include: 'IPAllocationTypeUndefined', 'IPAllocationTypeHypernet' + Type IPAllocationType `json:"type,omitempty"` + // Prefix - The address prefix for the IpAllocation. + Prefix *string `json:"prefix,omitempty"` + // PrefixLength - The address prefix length for the IpAllocation. + PrefixLength *int32 `json:"prefixLength,omitempty"` + // PrefixType - The address prefix Type for the IpAllocation. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' + PrefixType IPVersion `json:"prefixType,omitempty"` + // IpamAllocationID - The IPAM allocation ID. + IpamAllocationID *string `json:"ipamAllocationId,omitempty"` + // AllocationTags - IpAllocation tags. + AllocationTags map[string]*string `json:"allocationTags"` +} + +// MarshalJSON is the custom marshaler for IPAllocationPropertiesFormat. +func (iapf IPAllocationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if iapf.Type != "" { + objectMap["type"] = iapf.Type + } + if iapf.Prefix != nil { + objectMap["prefix"] = iapf.Prefix + } + if iapf.PrefixLength != nil { + objectMap["prefixLength"] = iapf.PrefixLength + } + if iapf.PrefixType != "" { + objectMap["prefixType"] = iapf.PrefixType + } + if iapf.IpamAllocationID != nil { + objectMap["ipamAllocationId"] = iapf.IpamAllocationID + } + if iapf.AllocationTags != nil { + objectMap["allocationTags"] = iapf.AllocationTags + } + return json.Marshal(objectMap) +} + +// IPAllocationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type IPAllocationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(IPAllocationsClient) (IPAllocation, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *IPAllocationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for IPAllocationsCreateOrUpdateFuture.Result. +func (future *IPAllocationsCreateOrUpdateFuture) result(client IPAllocationsClient) (ia IPAllocation, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ia.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.IPAllocationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ia.Response.Response, err = future.GetResult(sender); err == nil && ia.Response.Response.StatusCode != http.StatusNoContent { + ia, err = client.CreateOrUpdateResponder(ia.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsCreateOrUpdateFuture", "Result", ia.Response.Response, "Failure responding to request") + } + } + return +} + +// IPAllocationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type IPAllocationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(IPAllocationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *IPAllocationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for IPAllocationsDeleteFuture.Result. +func (future *IPAllocationsDeleteFuture) result(client IPAllocationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.IPAllocationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// IPConfiguration IP configuration. +type IPConfiguration struct { + // IPConfigurationPropertiesFormat - Properties of the IP configuration. + *IPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPConfiguration. +func (ic IPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ic.IPConfigurationPropertiesFormat != nil { + objectMap["properties"] = ic.IPConfigurationPropertiesFormat + } + if ic.Name != nil { + objectMap["name"] = ic.Name + } + if ic.ID != nil { + objectMap["id"] = ic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for IPConfiguration struct. +func (ic *IPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var IPConfigurationPropertiesFormat IPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &IPConfigurationPropertiesFormat) + if err != nil { + return err + } + ic.IPConfigurationPropertiesFormat = &IPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ic.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ic.ID = &ID + } + } + } + + return nil +} + +// IPConfigurationBgpPeeringAddress properties of IPConfigurationBgpPeeringAddress. +type IPConfigurationBgpPeeringAddress struct { + // IpconfigurationID - The ID of IP configuration which belongs to gateway. + IpconfigurationID *string `json:"ipconfigurationId,omitempty"` + // DefaultBgpIPAddresses - READ-ONLY; The list of default BGP peering addresses which belong to IP configuration. + DefaultBgpIPAddresses *[]string `json:"defaultBgpIpAddresses,omitempty"` + // CustomBgpIPAddresses - The list of custom BGP peering addresses which belong to IP configuration. + CustomBgpIPAddresses *[]string `json:"customBgpIpAddresses,omitempty"` + // TunnelIPAddresses - READ-ONLY; The list of tunnel public IP addresses which belong to IP configuration. + TunnelIPAddresses *[]string `json:"tunnelIpAddresses,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPConfigurationBgpPeeringAddress. +func (icbpa IPConfigurationBgpPeeringAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if icbpa.IpconfigurationID != nil { + objectMap["ipconfigurationId"] = icbpa.IpconfigurationID + } + if icbpa.CustomBgpIPAddresses != nil { + objectMap["customBgpIpAddresses"] = icbpa.CustomBgpIPAddresses + } + return json.Marshal(objectMap) +} + +// IPConfigurationProfile IP configuration profile child resource. +type IPConfigurationProfile struct { + // IPConfigurationProfilePropertiesFormat - Properties of the IP configuration profile. + *IPConfigurationProfilePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Sub Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPConfigurationProfile. +func (icp IPConfigurationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if icp.IPConfigurationProfilePropertiesFormat != nil { + objectMap["properties"] = icp.IPConfigurationProfilePropertiesFormat + } + if icp.Name != nil { + objectMap["name"] = icp.Name + } + if icp.ID != nil { + objectMap["id"] = icp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for IPConfigurationProfile struct. +func (icp *IPConfigurationProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var IPConfigurationProfilePropertiesFormat IPConfigurationProfilePropertiesFormat + err = json.Unmarshal(*v, &IPConfigurationProfilePropertiesFormat) + if err != nil { + return err + } + icp.IPConfigurationProfilePropertiesFormat = &IPConfigurationProfilePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + icp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + icp.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + icp.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + icp.ID = &ID + } + } + } + + return nil +} + +// IPConfigurationProfilePropertiesFormat IP configuration profile properties. +type IPConfigurationProfilePropertiesFormat struct { + // Subnet - The reference to the subnet resource to create a container network interface ip configuration. + Subnet *Subnet `json:"subnet,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the IP configuration profile resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPConfigurationProfilePropertiesFormat. +func (icppf IPConfigurationProfilePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if icppf.Subnet != nil { + objectMap["subnet"] = icppf.Subnet + } + return json.Marshal(objectMap) +} + +// IPConfigurationPropertiesFormat properties of IP configuration. +type IPConfigurationPropertiesFormat struct { + // PrivateIPAddress - The private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // Subnet - The reference to the subnet resource. + Subnet *Subnet `json:"subnet,omitempty"` + // PublicIPAddress - The reference to the public IP resource. + PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPConfigurationPropertiesFormat. +func (icpf IPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if icpf.PrivateIPAddress != nil { + objectMap["privateIPAddress"] = icpf.PrivateIPAddress + } + if icpf.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = icpf.PrivateIPAllocationMethod + } + if icpf.Subnet != nil { + objectMap["subnet"] = icpf.Subnet + } + if icpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = icpf.PublicIPAddress + } + return json.Marshal(objectMap) +} + +// IPGroup the IpGroups resource information. +type IPGroup struct { + autorest.Response `json:"-"` + // IPGroupPropertiesFormat - Properties of the IpGroups. + *IPGroupPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for IPGroup. +func (ig IPGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ig.IPGroupPropertiesFormat != nil { + objectMap["properties"] = ig.IPGroupPropertiesFormat + } + if ig.ID != nil { + objectMap["id"] = ig.ID + } + if ig.Location != nil { + objectMap["location"] = ig.Location + } + if ig.Tags != nil { + objectMap["tags"] = ig.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for IPGroup struct. +func (ig *IPGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var IPGroupPropertiesFormat IPGroupPropertiesFormat + err = json.Unmarshal(*v, &IPGroupPropertiesFormat) + if err != nil { + return err + } + ig.IPGroupPropertiesFormat = &IPGroupPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ig.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ig.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ig.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ig.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ig.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ig.Tags = tags + } + } + } + + return nil +} + +// IPGroupListResult response for the ListIpGroups API service call. +type IPGroupListResult struct { + autorest.Response `json:"-"` + // Value - The list of IpGroups information resources. + Value *[]IPGroup `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// IPGroupListResultIterator provides access to a complete listing of IPGroup values. +type IPGroupListResultIterator struct { + i int + page IPGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *IPGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *IPGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter IPGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter IPGroupListResultIterator) Response() IPGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter IPGroupListResultIterator) Value() IPGroup { + if !iter.page.NotDone() { + return IPGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the IPGroupListResultIterator type. +func NewIPGroupListResultIterator(page IPGroupListResultPage) IPGroupListResultIterator { + return IPGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (iglr IPGroupListResult) IsEmpty() bool { + return iglr.Value == nil || len(*iglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (iglr IPGroupListResult) hasNextLink() bool { + return iglr.NextLink != nil && len(*iglr.NextLink) != 0 +} + +// iPGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (iglr IPGroupListResult) iPGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !iglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(iglr.NextLink))) +} + +// IPGroupListResultPage contains a page of IPGroup values. +type IPGroupListResultPage struct { + fn func(context.Context, IPGroupListResult) (IPGroupListResult, error) + iglr IPGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *IPGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.iglr) + if err != nil { + return err + } + page.iglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *IPGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IPGroupListResultPage) NotDone() bool { + return !page.iglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IPGroupListResultPage) Response() IPGroupListResult { + return page.iglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IPGroupListResultPage) Values() []IPGroup { + if page.iglr.IsEmpty() { + return nil + } + return *page.iglr.Value +} + +// Creates a new instance of the IPGroupListResultPage type. +func NewIPGroupListResultPage(cur IPGroupListResult, getNextPage func(context.Context, IPGroupListResult) (IPGroupListResult, error)) IPGroupListResultPage { + return IPGroupListResultPage{ + fn: getNextPage, + iglr: cur, + } +} + +// IPGroupPropertiesFormat the IpGroups property information. +type IPGroupPropertiesFormat struct { + // ProvisioningState - READ-ONLY; The provisioning state of the IpGroups resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // IPAddresses - IpAddresses/IpAddressPrefixes in the IpGroups resource. + IPAddresses *[]string `json:"ipAddresses,omitempty"` + // Firewalls - READ-ONLY; List of references to Firewall resources that this IpGroups is associated with. + Firewalls *[]SubResource `json:"firewalls,omitempty"` + // FirewallPolicies - READ-ONLY; List of references to Firewall Policies resources that this IpGroups is associated with. + FirewallPolicies *[]SubResource `json:"firewallPolicies,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPGroupPropertiesFormat. +func (igpf IPGroupPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if igpf.IPAddresses != nil { + objectMap["ipAddresses"] = igpf.IPAddresses + } + return json.Marshal(objectMap) +} + +// IPGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type IPGroupsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(IPGroupsClient) (IPGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *IPGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for IPGroupsCreateOrUpdateFuture.Result. +func (future *IPGroupsCreateOrUpdateFuture) result(client IPGroupsClient) (ig IPGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ig.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.IPGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ig.Response.Response, err = future.GetResult(sender); err == nil && ig.Response.Response.StatusCode != http.StatusNoContent { + ig, err = client.CreateOrUpdateResponder(ig.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsCreateOrUpdateFuture", "Result", ig.Response.Response, "Failure responding to request") + } + } + return +} + +// IPGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type IPGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(IPGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *IPGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for IPGroupsDeleteFuture.Result. +func (future *IPGroupsDeleteFuture) result(client IPGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.IPGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// IPPrefixesList list of SNAT IP Prefixes learnt by firewall to not SNAT +type IPPrefixesList struct { + autorest.Response `json:"-"` + // IPPrefixes - IP Prefix value. + IPPrefixes *[]string `json:"ipPrefixes,omitempty"` +} + +// IPTag contains the IpTag associated with the object. +type IPTag struct { + // IPTagType - The IP tag type. Example: FirstPartyUsage. + IPTagType *string `json:"ipTagType,omitempty"` + // Tag - The value of the IP tag associated with the public IP. Example: SQL. + Tag *string `json:"tag,omitempty"` +} + +// InboundNatPool inbound NAT pool of the load balancer. +type InboundNatPool struct { + // InboundNatPoolPropertiesFormat - Properties of load balancer inbound nat pool. + *InboundNatPoolPropertiesFormat `json:"properties,omitempty"` + // Name - 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. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundNatPool. +func (inp InboundNatPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if inp.InboundNatPoolPropertiesFormat != nil { + objectMap["properties"] = inp.InboundNatPoolPropertiesFormat + } + if inp.Name != nil { + objectMap["name"] = inp.Name + } + if inp.ID != nil { + objectMap["id"] = inp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for InboundNatPool struct. +func (inp *InboundNatPool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var inboundNatPoolPropertiesFormat InboundNatPoolPropertiesFormat + err = json.Unmarshal(*v, &inboundNatPoolPropertiesFormat) + if err != nil { + return err + } + inp.InboundNatPoolPropertiesFormat = &inboundNatPoolPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + inp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + inp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + inp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + inp.ID = &ID + } + } + } + + return nil +} + +// InboundNatPoolPropertiesFormat properties of Inbound NAT pool. +type InboundNatPoolPropertiesFormat struct { + // FrontendIPConfiguration - A reference to frontend IP addresses. + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + // Protocol - The reference to the transport protocol used by the inbound NAT pool. Possible values include: 'TransportProtocolUDP', 'TransportProtocolTCP', 'TransportProtocolAll' + Protocol TransportProtocol `json:"protocol,omitempty"` + // FrontendPortRangeStart - 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. + FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` + // FrontendPortRangeEnd - 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. + FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` + // BackendPort - The port used for internal connections on the endpoint. Acceptable values are between 1 and 65535. + BackendPort *int32 `json:"backendPort,omitempty"` + // IdleTimeoutInMinutes - 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. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // EnableFloatingIP - 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. + EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` + // EnableTCPReset - 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. + EnableTCPReset *bool `json:"enableTcpReset,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the inbound NAT pool resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundNatPoolPropertiesFormat. +func (inppf InboundNatPoolPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if inppf.FrontendIPConfiguration != nil { + objectMap["frontendIPConfiguration"] = inppf.FrontendIPConfiguration + } + if inppf.Protocol != "" { + objectMap["protocol"] = inppf.Protocol + } + if inppf.FrontendPortRangeStart != nil { + objectMap["frontendPortRangeStart"] = inppf.FrontendPortRangeStart + } + if inppf.FrontendPortRangeEnd != nil { + objectMap["frontendPortRangeEnd"] = inppf.FrontendPortRangeEnd + } + if inppf.BackendPort != nil { + objectMap["backendPort"] = inppf.BackendPort + } + if inppf.IdleTimeoutInMinutes != nil { + objectMap["idleTimeoutInMinutes"] = inppf.IdleTimeoutInMinutes + } + if inppf.EnableFloatingIP != nil { + objectMap["enableFloatingIP"] = inppf.EnableFloatingIP + } + if inppf.EnableTCPReset != nil { + objectMap["enableTcpReset"] = inppf.EnableTCPReset + } + return json.Marshal(objectMap) +} + +// InboundNatRule inbound NAT rule of the load balancer. +type InboundNatRule struct { + autorest.Response `json:"-"` + // InboundNatRulePropertiesFormat - Properties of load balancer inbound NAT rule. + *InboundNatRulePropertiesFormat `json:"properties,omitempty"` + // Name - 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. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundNatRule. +func (inr InboundNatRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if inr.InboundNatRulePropertiesFormat != nil { + objectMap["properties"] = inr.InboundNatRulePropertiesFormat + } + if inr.Name != nil { + objectMap["name"] = inr.Name + } + if inr.ID != nil { + objectMap["id"] = inr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for InboundNatRule struct. +func (inr *InboundNatRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var inboundNatRulePropertiesFormat InboundNatRulePropertiesFormat + err = json.Unmarshal(*v, &inboundNatRulePropertiesFormat) + if err != nil { + return err + } + inr.InboundNatRulePropertiesFormat = &inboundNatRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + inr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + inr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + inr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + inr.ID = &ID + } + } + } + + return nil +} + +// InboundNatRuleListResult response for ListInboundNatRule API service call. +type InboundNatRuleListResult struct { + autorest.Response `json:"-"` + // Value - A list of inbound NAT rules in a load balancer. + Value *[]InboundNatRule `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundNatRuleListResult. +func (inrlr InboundNatRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if inrlr.Value != nil { + objectMap["value"] = inrlr.Value + } + return json.Marshal(objectMap) +} + +// InboundNatRuleListResultIterator provides access to a complete listing of InboundNatRule values. +type InboundNatRuleListResultIterator struct { + i int + page InboundNatRuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *InboundNatRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InboundNatRuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *InboundNatRuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter InboundNatRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter InboundNatRuleListResultIterator) Response() InboundNatRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter InboundNatRuleListResultIterator) Value() InboundNatRule { + if !iter.page.NotDone() { + return InboundNatRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the InboundNatRuleListResultIterator type. +func NewInboundNatRuleListResultIterator(page InboundNatRuleListResultPage) InboundNatRuleListResultIterator { + return InboundNatRuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (inrlr InboundNatRuleListResult) IsEmpty() bool { + return inrlr.Value == nil || len(*inrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (inrlr InboundNatRuleListResult) hasNextLink() bool { + return inrlr.NextLink != nil && len(*inrlr.NextLink) != 0 +} + +// inboundNatRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (inrlr InboundNatRuleListResult) inboundNatRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !inrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(inrlr.NextLink))) +} + +// InboundNatRuleListResultPage contains a page of InboundNatRule values. +type InboundNatRuleListResultPage struct { + fn func(context.Context, InboundNatRuleListResult) (InboundNatRuleListResult, error) + inrlr InboundNatRuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *InboundNatRuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InboundNatRuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.inrlr) + if err != nil { + return err + } + page.inrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *InboundNatRuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page InboundNatRuleListResultPage) NotDone() bool { + return !page.inrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page InboundNatRuleListResultPage) Response() InboundNatRuleListResult { + return page.inrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page InboundNatRuleListResultPage) Values() []InboundNatRule { + if page.inrlr.IsEmpty() { + return nil + } + return *page.inrlr.Value +} + +// Creates a new instance of the InboundNatRuleListResultPage type. +func NewInboundNatRuleListResultPage(cur InboundNatRuleListResult, getNextPage func(context.Context, InboundNatRuleListResult) (InboundNatRuleListResult, error)) InboundNatRuleListResultPage { + return InboundNatRuleListResultPage{ + fn: getNextPage, + inrlr: cur, + } +} + +// InboundNatRulePortMapping individual port mappings for inbound NAT rule created for backend pool. +type InboundNatRulePortMapping struct { + // InboundNatRuleName - READ-ONLY; Name of inbound NAT rule. + InboundNatRuleName *string `json:"inboundNatRuleName,omitempty"` + // Protocol - READ-ONLY; The reference to the transport protocol used by the inbound NAT rule. Possible values include: 'TransportProtocolUDP', 'TransportProtocolTCP', 'TransportProtocolAll' + Protocol TransportProtocol `json:"protocol,omitempty"` + // FrontendPort - READ-ONLY; Frontend port. + FrontendPort *int32 `json:"frontendPort,omitempty"` + // BackendPort - READ-ONLY; Backend port. + BackendPort *int32 `json:"backendPort,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundNatRulePortMapping. +func (inrpm InboundNatRulePortMapping) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// InboundNatRulePropertiesFormat properties of the inbound NAT rule. +type InboundNatRulePropertiesFormat struct { + // FrontendIPConfiguration - A reference to frontend IP addresses. + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + // BackendIPConfiguration - READ-ONLY; A reference to a private IP address defined on a network interface of a VM. Traffic sent to the frontend port of each of the frontend IP configurations is forwarded to the backend IP. + BackendIPConfiguration *InterfaceIPConfiguration `json:"backendIPConfiguration,omitempty"` + // Protocol - The reference to the transport protocol used by the load balancing rule. Possible values include: 'TransportProtocolUDP', 'TransportProtocolTCP', 'TransportProtocolAll' + Protocol TransportProtocol `json:"protocol,omitempty"` + // FrontendPort - 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. + FrontendPort *int32 `json:"frontendPort,omitempty"` + // BackendPort - The port used for the internal endpoint. Acceptable values range from 1 to 65535. + BackendPort *int32 `json:"backendPort,omitempty"` + // IdleTimeoutInMinutes - 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. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // EnableFloatingIP - 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. + EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` + // EnableTCPReset - 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. + EnableTCPReset *bool `json:"enableTcpReset,omitempty"` + // FrontendPortRangeStart - 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. + FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` + // FrontendPortRangeEnd - 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. + FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` + // BackendAddressPool - A reference to backendAddressPool resource. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the inbound NAT rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundNatRulePropertiesFormat. +func (inrpf InboundNatRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if inrpf.FrontendIPConfiguration != nil { + objectMap["frontendIPConfiguration"] = inrpf.FrontendIPConfiguration + } + if inrpf.Protocol != "" { + objectMap["protocol"] = inrpf.Protocol + } + if inrpf.FrontendPort != nil { + objectMap["frontendPort"] = inrpf.FrontendPort + } + if inrpf.BackendPort != nil { + objectMap["backendPort"] = inrpf.BackendPort + } + if inrpf.IdleTimeoutInMinutes != nil { + objectMap["idleTimeoutInMinutes"] = inrpf.IdleTimeoutInMinutes + } + if inrpf.EnableFloatingIP != nil { + objectMap["enableFloatingIP"] = inrpf.EnableFloatingIP + } + if inrpf.EnableTCPReset != nil { + objectMap["enableTcpReset"] = inrpf.EnableTCPReset + } + if inrpf.FrontendPortRangeStart != nil { + objectMap["frontendPortRangeStart"] = inrpf.FrontendPortRangeStart + } + if inrpf.FrontendPortRangeEnd != nil { + objectMap["frontendPortRangeEnd"] = inrpf.FrontendPortRangeEnd + } + if inrpf.BackendAddressPool != nil { + objectMap["backendAddressPool"] = inrpf.BackendAddressPool + } + return json.Marshal(objectMap) +} + +// InboundNatRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type InboundNatRulesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InboundNatRulesClient) (InboundNatRule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InboundNatRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InboundNatRulesCreateOrUpdateFuture.Result. +func (future *InboundNatRulesCreateOrUpdateFuture) result(client InboundNatRulesClient) (inr InboundNatRule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundNatRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + inr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InboundNatRulesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if inr.Response.Response, err = future.GetResult(sender); err == nil && inr.Response.Response.StatusCode != http.StatusNoContent { + inr, err = client.CreateOrUpdateResponder(inr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundNatRulesCreateOrUpdateFuture", "Result", inr.Response.Response, "Failure responding to request") + } + } + return +} + +// InboundNatRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type InboundNatRulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InboundNatRulesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InboundNatRulesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InboundNatRulesDeleteFuture.Result. +func (future *InboundNatRulesDeleteFuture) result(client InboundNatRulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundNatRulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InboundNatRulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// InboundSecurityRule NVA Inbound Security Rule resource. +type InboundSecurityRule struct { + autorest.Response `json:"-"` + // InboundSecurityRuleProperties - The properties of the Inbound Security Rules. + *InboundSecurityRuleProperties `json:"properties,omitempty"` + // Name - Name of security rule collection. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; NVA inbound security rule type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundSecurityRule. +func (isr InboundSecurityRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if isr.InboundSecurityRuleProperties != nil { + objectMap["properties"] = isr.InboundSecurityRuleProperties + } + if isr.Name != nil { + objectMap["name"] = isr.Name + } + if isr.ID != nil { + objectMap["id"] = isr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for InboundSecurityRule struct. +func (isr *InboundSecurityRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var inboundSecurityRuleProperties InboundSecurityRuleProperties + err = json.Unmarshal(*v, &inboundSecurityRuleProperties) + if err != nil { + return err + } + isr.InboundSecurityRuleProperties = &inboundSecurityRuleProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + isr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + isr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + isr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + isr.ID = &ID + } + } + } + + return nil +} + +// InboundSecurityRuleCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type InboundSecurityRuleCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InboundSecurityRuleClient) (InboundSecurityRule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InboundSecurityRuleCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InboundSecurityRuleCreateOrUpdateFuture.Result. +func (future *InboundSecurityRuleCreateOrUpdateFuture) result(client InboundSecurityRuleClient) (isr InboundSecurityRule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundSecurityRuleCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + isr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InboundSecurityRuleCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if isr.Response.Response, err = future.GetResult(sender); err == nil && isr.Response.Response.StatusCode != http.StatusNoContent { + isr, err = client.CreateOrUpdateResponder(isr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundSecurityRuleCreateOrUpdateFuture", "Result", isr.Response.Response, "Failure responding to request") + } + } + return +} + +// InboundSecurityRuleProperties properties of the Inbound Security Rules resource. +type InboundSecurityRuleProperties struct { + // Rules - List of allowed rules. + Rules *[]InboundSecurityRules `json:"rules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundSecurityRuleProperties. +func (isrp InboundSecurityRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if isrp.Rules != nil { + objectMap["rules"] = isrp.Rules + } + return json.Marshal(objectMap) +} + +// InboundSecurityRules properties of the Inbound Security Rules resource. +type InboundSecurityRules struct { + // Protocol - Protocol. This should be either TCP or UDP. Possible values include: 'InboundSecurityRulesProtocolTCP', 'InboundSecurityRulesProtocolUDP' + Protocol InboundSecurityRulesProtocol `json:"protocol,omitempty"` + // SourceAddressPrefix - The CIDR or source IP range. Only /30, /31 and /32 Ip ranges are allowed. + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + // DestinationPortRange - NVA port ranges to be opened up. One needs to provide specific ports. + DestinationPortRange *int32 `json:"destinationPortRange,omitempty"` +} + +// IntentPolicy network Intent Policy resource. +type IntentPolicy struct { + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for IntentPolicy. +func (IP IntentPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if IP.ID != nil { + objectMap["id"] = IP.ID + } + if IP.Location != nil { + objectMap["location"] = IP.Location + } + if IP.Tags != nil { + objectMap["tags"] = IP.Tags + } + return json.Marshal(objectMap) +} + +// IntentPolicyConfiguration details of NetworkIntentPolicyConfiguration for PrepareNetworkPoliciesRequest. +type IntentPolicyConfiguration struct { + // NetworkIntentPolicyName - The name of the Network Intent Policy for storing in target subscription. + NetworkIntentPolicyName *string `json:"networkIntentPolicyName,omitempty"` + // SourceNetworkIntentPolicy - Source network intent policy. + SourceNetworkIntentPolicy *IntentPolicy `json:"sourceNetworkIntentPolicy,omitempty"` +} + +// Interface a network interface in a resource group. +type Interface struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the network interface. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // InterfacePropertiesFormat - Properties of the network interface. + *InterfacePropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Interface. +func (i Interface) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.ExtendedLocation != nil { + objectMap["extendedLocation"] = i.ExtendedLocation + } + if i.InterfacePropertiesFormat != nil { + objectMap["properties"] = i.InterfacePropertiesFormat + } + if i.ID != nil { + objectMap["id"] = i.ID + } + if i.Location != nil { + objectMap["location"] = i.Location + } + if i.Tags != nil { + objectMap["tags"] = i.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Interface struct. +func (i *Interface) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + i.ExtendedLocation = &extendedLocation + } + case "properties": + if v != nil { + var interfacePropertiesFormat InterfacePropertiesFormat + err = json.Unmarshal(*v, &interfacePropertiesFormat) + if err != nil { + return err + } + i.InterfacePropertiesFormat = &interfacePropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + i.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + i.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + i.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + i.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + i.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + i.Tags = tags + } + } + } + + return nil +} + +// InterfaceAssociation network interface and its custom security rules. +type InterfaceAssociation struct { + // ID - READ-ONLY; Network interface ID. + ID *string `json:"id,omitempty"` + // SecurityRules - Collection of custom security rules. + SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceAssociation. +func (ia InterfaceAssociation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ia.SecurityRules != nil { + objectMap["securityRules"] = ia.SecurityRules + } + return json.Marshal(objectMap) +} + +// InterfaceDNSSettings DNS settings of a network interface. +type InterfaceDNSSettings struct { + // DNSServers - 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. + DNSServers *[]string `json:"dnsServers,omitempty"` + // AppliedDNSServers - READ-ONLY; 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. + AppliedDNSServers *[]string `json:"appliedDnsServers,omitempty"` + // InternalDNSNameLabel - Relative DNS name for this NIC used for internal communications between VMs in the same virtual network. + InternalDNSNameLabel *string `json:"internalDnsNameLabel,omitempty"` + // InternalFqdn - READ-ONLY; Fully qualified DNS name supporting internal communications between VMs in the same virtual network. + InternalFqdn *string `json:"internalFqdn,omitempty"` + // InternalDomainNameSuffix - READ-ONLY; 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. + InternalDomainNameSuffix *string `json:"internalDomainNameSuffix,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceDNSSettings. +func (ids InterfaceDNSSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ids.DNSServers != nil { + objectMap["dnsServers"] = ids.DNSServers + } + if ids.InternalDNSNameLabel != nil { + objectMap["internalDnsNameLabel"] = ids.InternalDNSNameLabel + } + return json.Marshal(objectMap) +} + +// InterfaceIPConfiguration iPConfiguration in a network interface. +type InterfaceIPConfiguration struct { + autorest.Response `json:"-"` + // InterfaceIPConfigurationPropertiesFormat - Network interface IP configuration properties. + *InterfaceIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceIPConfiguration. +func (iic InterfaceIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if iic.InterfaceIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = iic.InterfaceIPConfigurationPropertiesFormat + } + if iic.Name != nil { + objectMap["name"] = iic.Name + } + if iic.Type != nil { + objectMap["type"] = iic.Type + } + if iic.ID != nil { + objectMap["id"] = iic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for InterfaceIPConfiguration struct. +func (iic *InterfaceIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var interfaceIPConfigurationPropertiesFormat InterfaceIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &interfaceIPConfigurationPropertiesFormat) + if err != nil { + return err + } + iic.InterfaceIPConfigurationPropertiesFormat = &interfaceIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + iic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + iic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + iic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + iic.ID = &ID + } + } + } + + return nil +} + +// InterfaceIPConfigurationListResult response for list ip configurations API service call. +type InterfaceIPConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - A list of ip configurations. + Value *[]InterfaceIPConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceIPConfigurationListResult. +func (iiclr InterfaceIPConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if iiclr.Value != nil { + objectMap["value"] = iiclr.Value + } + return json.Marshal(objectMap) +} + +// InterfaceIPConfigurationListResultIterator provides access to a complete listing of +// InterfaceIPConfiguration values. +type InterfaceIPConfigurationListResultIterator struct { + i int + page InterfaceIPConfigurationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *InterfaceIPConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceIPConfigurationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *InterfaceIPConfigurationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter InterfaceIPConfigurationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter InterfaceIPConfigurationListResultIterator) Response() InterfaceIPConfigurationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter InterfaceIPConfigurationListResultIterator) Value() InterfaceIPConfiguration { + if !iter.page.NotDone() { + return InterfaceIPConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the InterfaceIPConfigurationListResultIterator type. +func NewInterfaceIPConfigurationListResultIterator(page InterfaceIPConfigurationListResultPage) InterfaceIPConfigurationListResultIterator { + return InterfaceIPConfigurationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (iiclr InterfaceIPConfigurationListResult) IsEmpty() bool { + return iiclr.Value == nil || len(*iiclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (iiclr InterfaceIPConfigurationListResult) hasNextLink() bool { + return iiclr.NextLink != nil && len(*iiclr.NextLink) != 0 +} + +// interfaceIPConfigurationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (iiclr InterfaceIPConfigurationListResult) interfaceIPConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !iiclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(iiclr.NextLink))) +} + +// InterfaceIPConfigurationListResultPage contains a page of InterfaceIPConfiguration values. +type InterfaceIPConfigurationListResultPage struct { + fn func(context.Context, InterfaceIPConfigurationListResult) (InterfaceIPConfigurationListResult, error) + iiclr InterfaceIPConfigurationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *InterfaceIPConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceIPConfigurationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.iiclr) + if err != nil { + return err + } + page.iiclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *InterfaceIPConfigurationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page InterfaceIPConfigurationListResultPage) NotDone() bool { + return !page.iiclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page InterfaceIPConfigurationListResultPage) Response() InterfaceIPConfigurationListResult { + return page.iiclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page InterfaceIPConfigurationListResultPage) Values() []InterfaceIPConfiguration { + if page.iiclr.IsEmpty() { + return nil + } + return *page.iiclr.Value +} + +// Creates a new instance of the InterfaceIPConfigurationListResultPage type. +func NewInterfaceIPConfigurationListResultPage(cur InterfaceIPConfigurationListResult, getNextPage func(context.Context, InterfaceIPConfigurationListResult) (InterfaceIPConfigurationListResult, error)) InterfaceIPConfigurationListResultPage { + return InterfaceIPConfigurationListResultPage{ + fn: getNextPage, + iiclr: cur, + } +} + +// InterfaceIPConfigurationPrivateLinkConnectionProperties privateLinkConnection properties for the network +// interface. +type InterfaceIPConfigurationPrivateLinkConnectionProperties struct { + // GroupID - READ-ONLY; The group ID for current private link connection. + GroupID *string `json:"groupId,omitempty"` + // RequiredMemberName - READ-ONLY; The required member name for current private link connection. + RequiredMemberName *string `json:"requiredMemberName,omitempty"` + // Fqdns - READ-ONLY; List of FQDNs for current private link connection. + Fqdns *[]string `json:"fqdns,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceIPConfigurationPrivateLinkConnectionProperties. +func (iicplcp InterfaceIPConfigurationPrivateLinkConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// InterfaceIPConfigurationPropertiesFormat properties of IP configuration. +type InterfaceIPConfigurationPropertiesFormat struct { + // GatewayLoadBalancer - The reference to gateway load balancer frontend IP. + GatewayLoadBalancer *SubResource `json:"gatewayLoadBalancer,omitempty"` + // VirtualNetworkTaps - The reference to Virtual Network Taps. + VirtualNetworkTaps *[]VirtualNetworkTap `json:"virtualNetworkTaps,omitempty"` + // ApplicationGatewayBackendAddressPools - The reference to ApplicationGatewayBackendAddressPool resource. + ApplicationGatewayBackendAddressPools *[]ApplicationGatewayBackendAddressPool `json:"applicationGatewayBackendAddressPools,omitempty"` + // LoadBalancerBackendAddressPools - The reference to LoadBalancerBackendAddressPool resource. + LoadBalancerBackendAddressPools *[]BackendAddressPool `json:"loadBalancerBackendAddressPools,omitempty"` + // LoadBalancerInboundNatRules - A list of references of LoadBalancerInboundNatRules. + LoadBalancerInboundNatRules *[]InboundNatRule `json:"loadBalancerInboundNatRules,omitempty"` + // PrivateIPAddress - Private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // PrivateIPAddressVersion - Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' + PrivateIPAddressVersion IPVersion `json:"privateIPAddressVersion,omitempty"` + // Subnet - Subnet bound to the IP configuration. + Subnet *Subnet `json:"subnet,omitempty"` + // Primary - Whether this is a primary customer address on the network interface. + Primary *bool `json:"primary,omitempty"` + // PublicIPAddress - Public IP address bound to the IP configuration. + PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` + // ApplicationSecurityGroups - Application security groups in which the IP configuration is included. + ApplicationSecurityGroups *[]ApplicationSecurityGroup `json:"applicationSecurityGroups,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the network interface IP configuration. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateLinkConnectionProperties - READ-ONLY; PrivateLinkConnection properties for the network interface. + PrivateLinkConnectionProperties *InterfaceIPConfigurationPrivateLinkConnectionProperties `json:"privateLinkConnectionProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceIPConfigurationPropertiesFormat. +func (iicpf InterfaceIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if iicpf.GatewayLoadBalancer != nil { + objectMap["gatewayLoadBalancer"] = iicpf.GatewayLoadBalancer + } + if iicpf.VirtualNetworkTaps != nil { + objectMap["virtualNetworkTaps"] = iicpf.VirtualNetworkTaps + } + if iicpf.ApplicationGatewayBackendAddressPools != nil { + objectMap["applicationGatewayBackendAddressPools"] = iicpf.ApplicationGatewayBackendAddressPools + } + if iicpf.LoadBalancerBackendAddressPools != nil { + objectMap["loadBalancerBackendAddressPools"] = iicpf.LoadBalancerBackendAddressPools + } + if iicpf.LoadBalancerInboundNatRules != nil { + objectMap["loadBalancerInboundNatRules"] = iicpf.LoadBalancerInboundNatRules + } + if iicpf.PrivateIPAddress != nil { + objectMap["privateIPAddress"] = iicpf.PrivateIPAddress + } + if iicpf.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = iicpf.PrivateIPAllocationMethod + } + if iicpf.PrivateIPAddressVersion != "" { + objectMap["privateIPAddressVersion"] = iicpf.PrivateIPAddressVersion + } + if iicpf.Subnet != nil { + objectMap["subnet"] = iicpf.Subnet + } + if iicpf.Primary != nil { + objectMap["primary"] = iicpf.Primary + } + if iicpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = iicpf.PublicIPAddress + } + if iicpf.ApplicationSecurityGroups != nil { + objectMap["applicationSecurityGroups"] = iicpf.ApplicationSecurityGroups + } + return json.Marshal(objectMap) +} + +// InterfaceListResult response for the ListNetworkInterface API service call. +type InterfaceListResult struct { + autorest.Response `json:"-"` + // Value - A list of network interfaces in a resource group. + Value *[]Interface `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceListResult. +func (ilr InterfaceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ilr.Value != nil { + objectMap["value"] = ilr.Value + } + return json.Marshal(objectMap) +} + +// InterfaceListResultIterator provides access to a complete listing of Interface values. +type InterfaceListResultIterator struct { + i int + page InterfaceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *InterfaceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *InterfaceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter InterfaceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter InterfaceListResultIterator) Response() InterfaceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter InterfaceListResultIterator) Value() Interface { + if !iter.page.NotDone() { + return Interface{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the InterfaceListResultIterator type. +func NewInterfaceListResultIterator(page InterfaceListResultPage) InterfaceListResultIterator { + return InterfaceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ilr InterfaceListResult) IsEmpty() bool { + return ilr.Value == nil || len(*ilr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ilr InterfaceListResult) hasNextLink() bool { + return ilr.NextLink != nil && len(*ilr.NextLink) != 0 +} + +// interfaceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ilr InterfaceListResult) interfaceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ilr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ilr.NextLink))) +} + +// InterfaceListResultPage contains a page of Interface values. +type InterfaceListResultPage struct { + fn func(context.Context, InterfaceListResult) (InterfaceListResult, error) + ilr InterfaceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *InterfaceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ilr) + if err != nil { + return err + } + page.ilr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *InterfaceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page InterfaceListResultPage) NotDone() bool { + return !page.ilr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page InterfaceListResultPage) Response() InterfaceListResult { + return page.ilr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page InterfaceListResultPage) Values() []Interface { + if page.ilr.IsEmpty() { + return nil + } + return *page.ilr.Value +} + +// Creates a new instance of the InterfaceListResultPage type. +func NewInterfaceListResultPage(cur InterfaceListResult, getNextPage func(context.Context, InterfaceListResult) (InterfaceListResult, error)) InterfaceListResultPage { + return InterfaceListResultPage{ + fn: getNextPage, + ilr: cur, + } +} + +// InterfaceLoadBalancerListResult response for list ip configurations API service call. +type InterfaceLoadBalancerListResult struct { + autorest.Response `json:"-"` + // Value - A list of load balancers. + Value *[]LoadBalancer `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceLoadBalancerListResult. +func (ilblr InterfaceLoadBalancerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ilblr.Value != nil { + objectMap["value"] = ilblr.Value + } + return json.Marshal(objectMap) +} + +// InterfaceLoadBalancerListResultIterator provides access to a complete listing of LoadBalancer values. +type InterfaceLoadBalancerListResultIterator struct { + i int + page InterfaceLoadBalancerListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *InterfaceLoadBalancerListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceLoadBalancerListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *InterfaceLoadBalancerListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter InterfaceLoadBalancerListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter InterfaceLoadBalancerListResultIterator) Response() InterfaceLoadBalancerListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter InterfaceLoadBalancerListResultIterator) Value() LoadBalancer { + if !iter.page.NotDone() { + return LoadBalancer{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the InterfaceLoadBalancerListResultIterator type. +func NewInterfaceLoadBalancerListResultIterator(page InterfaceLoadBalancerListResultPage) InterfaceLoadBalancerListResultIterator { + return InterfaceLoadBalancerListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ilblr InterfaceLoadBalancerListResult) IsEmpty() bool { + return ilblr.Value == nil || len(*ilblr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ilblr InterfaceLoadBalancerListResult) hasNextLink() bool { + return ilblr.NextLink != nil && len(*ilblr.NextLink) != 0 +} + +// interfaceLoadBalancerListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ilblr InterfaceLoadBalancerListResult) interfaceLoadBalancerListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ilblr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ilblr.NextLink))) +} + +// InterfaceLoadBalancerListResultPage contains a page of LoadBalancer values. +type InterfaceLoadBalancerListResultPage struct { + fn func(context.Context, InterfaceLoadBalancerListResult) (InterfaceLoadBalancerListResult, error) + ilblr InterfaceLoadBalancerListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *InterfaceLoadBalancerListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceLoadBalancerListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ilblr) + if err != nil { + return err + } + page.ilblr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *InterfaceLoadBalancerListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page InterfaceLoadBalancerListResultPage) NotDone() bool { + return !page.ilblr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page InterfaceLoadBalancerListResultPage) Response() InterfaceLoadBalancerListResult { + return page.ilblr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page InterfaceLoadBalancerListResultPage) Values() []LoadBalancer { + if page.ilblr.IsEmpty() { + return nil + } + return *page.ilblr.Value +} + +// Creates a new instance of the InterfaceLoadBalancerListResultPage type. +func NewInterfaceLoadBalancerListResultPage(cur InterfaceLoadBalancerListResult, getNextPage func(context.Context, InterfaceLoadBalancerListResult) (InterfaceLoadBalancerListResult, error)) InterfaceLoadBalancerListResultPage { + return InterfaceLoadBalancerListResultPage{ + fn: getNextPage, + ilblr: cur, + } +} + +// InterfacePropertiesFormat networkInterface properties. +type InterfacePropertiesFormat struct { + // VirtualMachine - READ-ONLY; The reference to a virtual machine. + VirtualMachine *SubResource `json:"virtualMachine,omitempty"` + // NetworkSecurityGroup - The reference to the NetworkSecurityGroup resource. + NetworkSecurityGroup *SecurityGroup `json:"networkSecurityGroup,omitempty"` + // PrivateEndpoint - READ-ONLY; A reference to the private endpoint to which the network interface is linked. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // IPConfigurations - A list of IPConfigurations of the network interface. + IPConfigurations *[]InterfaceIPConfiguration `json:"ipConfigurations,omitempty"` + // TapConfigurations - READ-ONLY; A list of TapConfigurations of the network interface. + TapConfigurations *[]InterfaceTapConfiguration `json:"tapConfigurations,omitempty"` + // DNSSettings - The DNS settings in network interface. + DNSSettings *InterfaceDNSSettings `json:"dnsSettings,omitempty"` + // MacAddress - READ-ONLY; The MAC address of the network interface. + MacAddress *string `json:"macAddress,omitempty"` + // Primary - READ-ONLY; Whether this is a primary network interface on a virtual machine. + Primary *bool `json:"primary,omitempty"` + // VnetEncryptionSupported - READ-ONLY; Whether the virtual machine this nic is attached to supports encryption. + VnetEncryptionSupported *bool `json:"vnetEncryptionSupported,omitempty"` + // EnableAcceleratedNetworking - If the network interface is configured for accelerated networking. Not applicable to VM sizes which require accelerated networking. + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + // DisableTCPStateTracking - Indicates whether to disable tcp state tracking. + DisableTCPStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + // EnableIPForwarding - Indicates whether IP forwarding is enabled on this network interface. + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + // HostedWorkloads - READ-ONLY; A list of references to linked BareMetal resources. + HostedWorkloads *[]string `json:"hostedWorkloads,omitempty"` + // DscpConfiguration - READ-ONLY; A reference to the dscp configuration to which the network interface is linked. + DscpConfiguration *SubResource `json:"dscpConfiguration,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the network interface resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the network interface resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // WorkloadType - WorkloadType of the NetworkInterface for BareMetal resources + WorkloadType *string `json:"workloadType,omitempty"` + // NicType - Type of Network Interface resource. Possible values include: 'InterfaceNicTypeStandard', 'InterfaceNicTypeElastic' + NicType InterfaceNicType `json:"nicType,omitempty"` + // PrivateLinkService - Privatelinkservice of the network interface resource. + PrivateLinkService *PrivateLinkService `json:"privateLinkService,omitempty"` + // MigrationPhase - Migration phase of Network Interface resource. Possible values include: 'InterfaceMigrationPhaseNone', 'InterfaceMigrationPhasePrepare', 'InterfaceMigrationPhaseCommit', 'InterfaceMigrationPhaseAbort', 'InterfaceMigrationPhaseCommitted' + MigrationPhase InterfaceMigrationPhase `json:"migrationPhase,omitempty"` + // AuxiliaryMode - Auxiliary mode of Network Interface resource. Possible values include: 'InterfaceAuxiliaryModeNone', 'InterfaceAuxiliaryModeMaxConnections', 'InterfaceAuxiliaryModeFloating' + AuxiliaryMode InterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfacePropertiesFormat. +func (ipf InterfacePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ipf.NetworkSecurityGroup != nil { + objectMap["networkSecurityGroup"] = ipf.NetworkSecurityGroup + } + if ipf.IPConfigurations != nil { + objectMap["ipConfigurations"] = ipf.IPConfigurations + } + if ipf.DNSSettings != nil { + objectMap["dnsSettings"] = ipf.DNSSettings + } + if ipf.EnableAcceleratedNetworking != nil { + objectMap["enableAcceleratedNetworking"] = ipf.EnableAcceleratedNetworking + } + if ipf.DisableTCPStateTracking != nil { + objectMap["disableTcpStateTracking"] = ipf.DisableTCPStateTracking + } + if ipf.EnableIPForwarding != nil { + objectMap["enableIPForwarding"] = ipf.EnableIPForwarding + } + if ipf.WorkloadType != nil { + objectMap["workloadType"] = ipf.WorkloadType + } + if ipf.NicType != "" { + objectMap["nicType"] = ipf.NicType + } + if ipf.PrivateLinkService != nil { + objectMap["privateLinkService"] = ipf.PrivateLinkService + } + if ipf.MigrationPhase != "" { + objectMap["migrationPhase"] = ipf.MigrationPhase + } + if ipf.AuxiliaryMode != "" { + objectMap["auxiliaryMode"] = ipf.AuxiliaryMode + } + return json.Marshal(objectMap) +} + +// InterfaceTapConfiguration tap configuration in a Network Interface. +type InterfaceTapConfiguration struct { + autorest.Response `json:"-"` + // InterfaceTapConfigurationPropertiesFormat - Properties of the Virtual Network Tap configuration. + *InterfaceTapConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Sub Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceTapConfiguration. +func (itc InterfaceTapConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if itc.InterfaceTapConfigurationPropertiesFormat != nil { + objectMap["properties"] = itc.InterfaceTapConfigurationPropertiesFormat + } + if itc.Name != nil { + objectMap["name"] = itc.Name + } + if itc.ID != nil { + objectMap["id"] = itc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for InterfaceTapConfiguration struct. +func (itc *InterfaceTapConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var interfaceTapConfigurationPropertiesFormat InterfaceTapConfigurationPropertiesFormat + err = json.Unmarshal(*v, &interfaceTapConfigurationPropertiesFormat) + if err != nil { + return err + } + itc.InterfaceTapConfigurationPropertiesFormat = &interfaceTapConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + itc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + itc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + itc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + itc.ID = &ID + } + } + } + + return nil +} + +// InterfaceTapConfigurationListResult response for list tap configurations API service call. +type InterfaceTapConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - A list of tap configurations. + Value *[]InterfaceTapConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceTapConfigurationListResult. +func (itclr InterfaceTapConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if itclr.Value != nil { + objectMap["value"] = itclr.Value + } + return json.Marshal(objectMap) +} + +// InterfaceTapConfigurationListResultIterator provides access to a complete listing of +// InterfaceTapConfiguration values. +type InterfaceTapConfigurationListResultIterator struct { + i int + page InterfaceTapConfigurationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *InterfaceTapConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceTapConfigurationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *InterfaceTapConfigurationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter InterfaceTapConfigurationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter InterfaceTapConfigurationListResultIterator) Response() InterfaceTapConfigurationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter InterfaceTapConfigurationListResultIterator) Value() InterfaceTapConfiguration { + if !iter.page.NotDone() { + return InterfaceTapConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the InterfaceTapConfigurationListResultIterator type. +func NewInterfaceTapConfigurationListResultIterator(page InterfaceTapConfigurationListResultPage) InterfaceTapConfigurationListResultIterator { + return InterfaceTapConfigurationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (itclr InterfaceTapConfigurationListResult) IsEmpty() bool { + return itclr.Value == nil || len(*itclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (itclr InterfaceTapConfigurationListResult) hasNextLink() bool { + return itclr.NextLink != nil && len(*itclr.NextLink) != 0 +} + +// interfaceTapConfigurationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (itclr InterfaceTapConfigurationListResult) interfaceTapConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !itclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(itclr.NextLink))) +} + +// InterfaceTapConfigurationListResultPage contains a page of InterfaceTapConfiguration values. +type InterfaceTapConfigurationListResultPage struct { + fn func(context.Context, InterfaceTapConfigurationListResult) (InterfaceTapConfigurationListResult, error) + itclr InterfaceTapConfigurationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *InterfaceTapConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceTapConfigurationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.itclr) + if err != nil { + return err + } + page.itclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *InterfaceTapConfigurationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page InterfaceTapConfigurationListResultPage) NotDone() bool { + return !page.itclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page InterfaceTapConfigurationListResultPage) Response() InterfaceTapConfigurationListResult { + return page.itclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page InterfaceTapConfigurationListResultPage) Values() []InterfaceTapConfiguration { + if page.itclr.IsEmpty() { + return nil + } + return *page.itclr.Value +} + +// Creates a new instance of the InterfaceTapConfigurationListResultPage type. +func NewInterfaceTapConfigurationListResultPage(cur InterfaceTapConfigurationListResult, getNextPage func(context.Context, InterfaceTapConfigurationListResult) (InterfaceTapConfigurationListResult, error)) InterfaceTapConfigurationListResultPage { + return InterfaceTapConfigurationListResultPage{ + fn: getNextPage, + itclr: cur, + } +} + +// InterfaceTapConfigurationPropertiesFormat properties of Virtual Network Tap configuration. +type InterfaceTapConfigurationPropertiesFormat struct { + // VirtualNetworkTap - The reference to the Virtual Network Tap resource. + VirtualNetworkTap *VirtualNetworkTap `json:"virtualNetworkTap,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the network interface tap configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceTapConfigurationPropertiesFormat. +func (itcpf InterfaceTapConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if itcpf.VirtualNetworkTap != nil { + objectMap["virtualNetworkTap"] = itcpf.VirtualNetworkTap + } + return json.Marshal(objectMap) +} + +// InterfaceTapConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type InterfaceTapConfigurationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InterfaceTapConfigurationsClient) (InterfaceTapConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InterfaceTapConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InterfaceTapConfigurationsCreateOrUpdateFuture.Result. +func (future *InterfaceTapConfigurationsCreateOrUpdateFuture) result(client InterfaceTapConfigurationsClient) (itc InterfaceTapConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + itc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InterfaceTapConfigurationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if itc.Response.Response, err = future.GetResult(sender); err == nil && itc.Response.Response.StatusCode != http.StatusNoContent { + itc, err = client.CreateOrUpdateResponder(itc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsCreateOrUpdateFuture", "Result", itc.Response.Response, "Failure responding to request") + } + } + return +} + +// InterfaceTapConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type InterfaceTapConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InterfaceTapConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InterfaceTapConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InterfaceTapConfigurationsDeleteFuture.Result. +func (future *InterfaceTapConfigurationsDeleteFuture) result(client InterfaceTapConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InterfaceTapConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// InterfacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type InterfacesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InterfacesClient) (Interface, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InterfacesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InterfacesCreateOrUpdateFuture.Result. +func (future *InterfacesCreateOrUpdateFuture) result(client InterfacesClient) (i Interface, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + i.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InterfacesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if i.Response.Response, err = future.GetResult(sender); err == nil && i.Response.Response.StatusCode != http.StatusNoContent { + i, err = client.CreateOrUpdateResponder(i.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", i.Response.Response, "Failure responding to request") + } + } + return +} + +// InterfacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type InterfacesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InterfacesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InterfacesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InterfacesDeleteFuture.Result. +func (future *InterfacesDeleteFuture) result(client InterfacesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InterfacesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// InterfacesGetEffectiveRouteTableFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type InterfacesGetEffectiveRouteTableFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InterfacesClient) (EffectiveRouteListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InterfacesGetEffectiveRouteTableFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InterfacesGetEffectiveRouteTableFuture.Result. +func (future *InterfacesGetEffectiveRouteTableFuture) result(client InterfacesClient) (erlr EffectiveRouteListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesGetEffectiveRouteTableFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InterfacesGetEffectiveRouteTableFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erlr.Response.Response, err = future.GetResult(sender); err == nil && erlr.Response.Response.StatusCode != http.StatusNoContent { + erlr, err = client.GetEffectiveRouteTableResponder(erlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesGetEffectiveRouteTableFuture", "Result", erlr.Response.Response, "Failure responding to request") + } + } + return +} + +// InterfacesListEffectiveNetworkSecurityGroupsFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type InterfacesListEffectiveNetworkSecurityGroupsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InterfacesClient) (EffectiveNetworkSecurityGroupListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InterfacesListEffectiveNetworkSecurityGroupsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InterfacesListEffectiveNetworkSecurityGroupsFuture.Result. +func (future *InterfacesListEffectiveNetworkSecurityGroupsFuture) result(client InterfacesClient) (ensglr EffectiveNetworkSecurityGroupListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesListEffectiveNetworkSecurityGroupsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ensglr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InterfacesListEffectiveNetworkSecurityGroupsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ensglr.Response.Response, err = future.GetResult(sender); err == nil && ensglr.Response.Response.StatusCode != http.StatusNoContent { + ensglr, err = client.ListEffectiveNetworkSecurityGroupsResponder(ensglr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesListEffectiveNetworkSecurityGroupsFuture", "Result", ensglr.Response.Response, "Failure responding to request") + } + } + return +} + +// IpsecPolicy an IPSec Policy configuration for a virtual network gateway connection. +type IpsecPolicy struct { + // SaLifeTimeSeconds - The IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for a site to site VPN tunnel. + SaLifeTimeSeconds *int32 `json:"saLifeTimeSeconds,omitempty"` + // SaDataSizeKilobytes - The IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB for a site to site VPN tunnel. + SaDataSizeKilobytes *int32 `json:"saDataSizeKilobytes,omitempty"` + // IpsecEncryption - The IPSec encryption algorithm (IKE phase 1). Possible values include: 'IpsecEncryptionNone', 'IpsecEncryptionDES', 'IpsecEncryptionDES3', 'IpsecEncryptionAES128', 'IpsecEncryptionAES192', 'IpsecEncryptionAES256', 'IpsecEncryptionGCMAES128', 'IpsecEncryptionGCMAES192', 'IpsecEncryptionGCMAES256' + IpsecEncryption IpsecEncryption `json:"ipsecEncryption,omitempty"` + // IpsecIntegrity - The IPSec integrity algorithm (IKE phase 1). Possible values include: 'IpsecIntegrityMD5', 'IpsecIntegritySHA1', 'IpsecIntegritySHA256', 'IpsecIntegrityGCMAES128', 'IpsecIntegrityGCMAES192', 'IpsecIntegrityGCMAES256' + IpsecIntegrity IpsecIntegrity `json:"ipsecIntegrity,omitempty"` + // IkeEncryption - The IKE encryption algorithm (IKE phase 2). Possible values include: 'IkeEncryptionDES', 'IkeEncryptionDES3', 'IkeEncryptionAES128', 'IkeEncryptionAES192', 'IkeEncryptionAES256', 'IkeEncryptionGCMAES256', 'IkeEncryptionGCMAES128' + IkeEncryption IkeEncryption `json:"ikeEncryption,omitempty"` + // IkeIntegrity - The IKE integrity algorithm (IKE phase 2). Possible values include: 'IkeIntegrityMD5', 'IkeIntegritySHA1', 'IkeIntegritySHA256', 'IkeIntegritySHA384', 'IkeIntegrityGCMAES256', 'IkeIntegrityGCMAES128' + IkeIntegrity IkeIntegrity `json:"ikeIntegrity,omitempty"` + // DhGroup - The DH Group used in IKE Phase 1 for initial SA. Possible values include: 'DhGroupNone', 'DhGroupDHGroup1', 'DhGroupDHGroup2', 'DhGroupDHGroup14', 'DhGroupDHGroup2048', 'DhGroupECP256', 'DhGroupECP384', 'DhGroupDHGroup24' + DhGroup DhGroup `json:"dhGroup,omitempty"` + // PfsGroup - The Pfs Group used in IKE Phase 2 for new child SA. Possible values include: 'PfsGroupNone', 'PfsGroupPFS1', 'PfsGroupPFS2', 'PfsGroupPFS2048', 'PfsGroupECP256', 'PfsGroupECP384', 'PfsGroupPFS24', 'PfsGroupPFS14', 'PfsGroupPFSMM' + PfsGroup PfsGroup `json:"pfsGroup,omitempty"` +} + +// Ipv6CircuitConnectionConfig iPv6 Circuit Connection properties for global reach. +type Ipv6CircuitConnectionConfig struct { + // AddressPrefix - /125 IP address space to carve out customer addresses for global reach. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // CircuitConnectionStatus - READ-ONLY; Express Route Circuit connection state. Possible values include: 'CircuitConnectionStatusConnected', 'CircuitConnectionStatusConnecting', 'CircuitConnectionStatusDisconnected' + CircuitConnectionStatus CircuitConnectionStatus `json:"circuitConnectionStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for Ipv6CircuitConnectionConfig. +func (i6ccc Ipv6CircuitConnectionConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i6ccc.AddressPrefix != nil { + objectMap["addressPrefix"] = i6ccc.AddressPrefix + } + return json.Marshal(objectMap) +} + +// Ipv6ExpressRouteCircuitPeeringConfig contains IPv6 peering config. +type Ipv6ExpressRouteCircuitPeeringConfig struct { + // PrimaryPeerAddressPrefix - The primary address prefix. + PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` + // SecondaryPeerAddressPrefix - The secondary address prefix. + SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"` + // MicrosoftPeeringConfig - The Microsoft peering configuration. + MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` + // RouteFilter - The reference to the RouteFilter resource. + RouteFilter *SubResource `json:"routeFilter,omitempty"` + // State - The state of peering. Possible values include: 'ExpressRouteCircuitPeeringStateDisabled', 'ExpressRouteCircuitPeeringStateEnabled' + State ExpressRouteCircuitPeeringState `json:"state,omitempty"` +} + +// ListHubRouteTablesResult list of RouteTables and a URL nextLink to get the next set of results. +type ListHubRouteTablesResult struct { + autorest.Response `json:"-"` + // Value - List of RouteTables. + Value *[]HubRouteTable `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListHubRouteTablesResultIterator provides access to a complete listing of HubRouteTable values. +type ListHubRouteTablesResultIterator struct { + i int + page ListHubRouteTablesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListHubRouteTablesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListHubRouteTablesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListHubRouteTablesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListHubRouteTablesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListHubRouteTablesResultIterator) Response() ListHubRouteTablesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListHubRouteTablesResultIterator) Value() HubRouteTable { + if !iter.page.NotDone() { + return HubRouteTable{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListHubRouteTablesResultIterator type. +func NewListHubRouteTablesResultIterator(page ListHubRouteTablesResultPage) ListHubRouteTablesResultIterator { + return ListHubRouteTablesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lhrtr ListHubRouteTablesResult) IsEmpty() bool { + return lhrtr.Value == nil || len(*lhrtr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lhrtr ListHubRouteTablesResult) hasNextLink() bool { + return lhrtr.NextLink != nil && len(*lhrtr.NextLink) != 0 +} + +// listHubRouteTablesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lhrtr ListHubRouteTablesResult) listHubRouteTablesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lhrtr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lhrtr.NextLink))) +} + +// ListHubRouteTablesResultPage contains a page of HubRouteTable values. +type ListHubRouteTablesResultPage struct { + fn func(context.Context, ListHubRouteTablesResult) (ListHubRouteTablesResult, error) + lhrtr ListHubRouteTablesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListHubRouteTablesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListHubRouteTablesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lhrtr) + if err != nil { + return err + } + page.lhrtr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListHubRouteTablesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListHubRouteTablesResultPage) NotDone() bool { + return !page.lhrtr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListHubRouteTablesResultPage) Response() ListHubRouteTablesResult { + return page.lhrtr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListHubRouteTablesResultPage) Values() []HubRouteTable { + if page.lhrtr.IsEmpty() { + return nil + } + return *page.lhrtr.Value +} + +// Creates a new instance of the ListHubRouteTablesResultPage type. +func NewListHubRouteTablesResultPage(cur ListHubRouteTablesResult, getNextPage func(context.Context, ListHubRouteTablesResult) (ListHubRouteTablesResult, error)) ListHubRouteTablesResultPage { + return ListHubRouteTablesResultPage{ + fn: getNextPage, + lhrtr: cur, + } +} + +// ListHubVirtualNetworkConnectionsResult list of HubVirtualNetworkConnections and a URL nextLink to get +// the next set of results. +type ListHubVirtualNetworkConnectionsResult struct { + autorest.Response `json:"-"` + // Value - List of HubVirtualNetworkConnections. + Value *[]HubVirtualNetworkConnection `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListHubVirtualNetworkConnectionsResultIterator provides access to a complete listing of +// HubVirtualNetworkConnection values. +type ListHubVirtualNetworkConnectionsResultIterator struct { + i int + page ListHubVirtualNetworkConnectionsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListHubVirtualNetworkConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListHubVirtualNetworkConnectionsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListHubVirtualNetworkConnectionsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListHubVirtualNetworkConnectionsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListHubVirtualNetworkConnectionsResultIterator) Response() ListHubVirtualNetworkConnectionsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListHubVirtualNetworkConnectionsResultIterator) Value() HubVirtualNetworkConnection { + if !iter.page.NotDone() { + return HubVirtualNetworkConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListHubVirtualNetworkConnectionsResultIterator type. +func NewListHubVirtualNetworkConnectionsResultIterator(page ListHubVirtualNetworkConnectionsResultPage) ListHubVirtualNetworkConnectionsResultIterator { + return ListHubVirtualNetworkConnectionsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lhvncr ListHubVirtualNetworkConnectionsResult) IsEmpty() bool { + return lhvncr.Value == nil || len(*lhvncr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lhvncr ListHubVirtualNetworkConnectionsResult) hasNextLink() bool { + return lhvncr.NextLink != nil && len(*lhvncr.NextLink) != 0 +} + +// listHubVirtualNetworkConnectionsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lhvncr ListHubVirtualNetworkConnectionsResult) listHubVirtualNetworkConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lhvncr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lhvncr.NextLink))) +} + +// ListHubVirtualNetworkConnectionsResultPage contains a page of HubVirtualNetworkConnection values. +type ListHubVirtualNetworkConnectionsResultPage struct { + fn func(context.Context, ListHubVirtualNetworkConnectionsResult) (ListHubVirtualNetworkConnectionsResult, error) + lhvncr ListHubVirtualNetworkConnectionsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListHubVirtualNetworkConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListHubVirtualNetworkConnectionsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lhvncr) + if err != nil { + return err + } + page.lhvncr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListHubVirtualNetworkConnectionsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListHubVirtualNetworkConnectionsResultPage) NotDone() bool { + return !page.lhvncr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListHubVirtualNetworkConnectionsResultPage) Response() ListHubVirtualNetworkConnectionsResult { + return page.lhvncr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListHubVirtualNetworkConnectionsResultPage) Values() []HubVirtualNetworkConnection { + if page.lhvncr.IsEmpty() { + return nil + } + return *page.lhvncr.Value +} + +// Creates a new instance of the ListHubVirtualNetworkConnectionsResultPage type. +func NewListHubVirtualNetworkConnectionsResultPage(cur ListHubVirtualNetworkConnectionsResult, getNextPage func(context.Context, ListHubVirtualNetworkConnectionsResult) (ListHubVirtualNetworkConnectionsResult, error)) ListHubVirtualNetworkConnectionsResultPage { + return ListHubVirtualNetworkConnectionsResultPage{ + fn: getNextPage, + lhvncr: cur, + } +} + +// ListP2SVpnGatewaysResult result of the request to list P2SVpnGateways. It contains a list of +// P2SVpnGateways and a URL nextLink to get the next set of results. +type ListP2SVpnGatewaysResult struct { + autorest.Response `json:"-"` + // Value - List of P2SVpnGateways. + Value *[]P2SVpnGateway `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListP2SVpnGatewaysResultIterator provides access to a complete listing of P2SVpnGateway values. +type ListP2SVpnGatewaysResultIterator struct { + i int + page ListP2SVpnGatewaysResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListP2SVpnGatewaysResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListP2SVpnGatewaysResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListP2SVpnGatewaysResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListP2SVpnGatewaysResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListP2SVpnGatewaysResultIterator) Response() ListP2SVpnGatewaysResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListP2SVpnGatewaysResultIterator) Value() P2SVpnGateway { + if !iter.page.NotDone() { + return P2SVpnGateway{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListP2SVpnGatewaysResultIterator type. +func NewListP2SVpnGatewaysResultIterator(page ListP2SVpnGatewaysResultPage) ListP2SVpnGatewaysResultIterator { + return ListP2SVpnGatewaysResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lpvgr ListP2SVpnGatewaysResult) IsEmpty() bool { + return lpvgr.Value == nil || len(*lpvgr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lpvgr ListP2SVpnGatewaysResult) hasNextLink() bool { + return lpvgr.NextLink != nil && len(*lpvgr.NextLink) != 0 +} + +// listP2SVpnGatewaysResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lpvgr ListP2SVpnGatewaysResult) listP2SVpnGatewaysResultPreparer(ctx context.Context) (*http.Request, error) { + if !lpvgr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lpvgr.NextLink))) +} + +// ListP2SVpnGatewaysResultPage contains a page of P2SVpnGateway values. +type ListP2SVpnGatewaysResultPage struct { + fn func(context.Context, ListP2SVpnGatewaysResult) (ListP2SVpnGatewaysResult, error) + lpvgr ListP2SVpnGatewaysResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListP2SVpnGatewaysResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListP2SVpnGatewaysResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lpvgr) + if err != nil { + return err + } + page.lpvgr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListP2SVpnGatewaysResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListP2SVpnGatewaysResultPage) NotDone() bool { + return !page.lpvgr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListP2SVpnGatewaysResultPage) Response() ListP2SVpnGatewaysResult { + return page.lpvgr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListP2SVpnGatewaysResultPage) Values() []P2SVpnGateway { + if page.lpvgr.IsEmpty() { + return nil + } + return *page.lpvgr.Value +} + +// Creates a new instance of the ListP2SVpnGatewaysResultPage type. +func NewListP2SVpnGatewaysResultPage(cur ListP2SVpnGatewaysResult, getNextPage func(context.Context, ListP2SVpnGatewaysResult) (ListP2SVpnGatewaysResult, error)) ListP2SVpnGatewaysResultPage { + return ListP2SVpnGatewaysResultPage{ + fn: getNextPage, + lpvgr: cur, + } +} + +// ListRouteMapsResult list of RouteMaps and a URL nextLink to get the next set of results. +type ListRouteMapsResult struct { + autorest.Response `json:"-"` + // Value - List of RouteMaps. + Value *[]RouteMap `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListRouteMapsResultIterator provides access to a complete listing of RouteMap values. +type ListRouteMapsResultIterator struct { + i int + page ListRouteMapsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListRouteMapsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListRouteMapsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListRouteMapsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListRouteMapsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListRouteMapsResultIterator) Response() ListRouteMapsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListRouteMapsResultIterator) Value() RouteMap { + if !iter.page.NotDone() { + return RouteMap{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListRouteMapsResultIterator type. +func NewListRouteMapsResultIterator(page ListRouteMapsResultPage) ListRouteMapsResultIterator { + return ListRouteMapsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lrmr ListRouteMapsResult) IsEmpty() bool { + return lrmr.Value == nil || len(*lrmr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lrmr ListRouteMapsResult) hasNextLink() bool { + return lrmr.NextLink != nil && len(*lrmr.NextLink) != 0 +} + +// listRouteMapsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lrmr ListRouteMapsResult) listRouteMapsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lrmr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lrmr.NextLink))) +} + +// ListRouteMapsResultPage contains a page of RouteMap values. +type ListRouteMapsResultPage struct { + fn func(context.Context, ListRouteMapsResult) (ListRouteMapsResult, error) + lrmr ListRouteMapsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListRouteMapsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListRouteMapsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lrmr) + if err != nil { + return err + } + page.lrmr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListRouteMapsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListRouteMapsResultPage) NotDone() bool { + return !page.lrmr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListRouteMapsResultPage) Response() ListRouteMapsResult { + return page.lrmr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListRouteMapsResultPage) Values() []RouteMap { + if page.lrmr.IsEmpty() { + return nil + } + return *page.lrmr.Value +} + +// Creates a new instance of the ListRouteMapsResultPage type. +func NewListRouteMapsResultPage(cur ListRouteMapsResult, getNextPage func(context.Context, ListRouteMapsResult) (ListRouteMapsResult, error)) ListRouteMapsResultPage { + return ListRouteMapsResultPage{ + fn: getNextPage, + lrmr: cur, + } +} + +// ListRoutingIntentResult list of the routing intent result and a URL nextLink to get the next set of +// results. +type ListRoutingIntentResult struct { + autorest.Response `json:"-"` + // Value - List of RoutingIntent resource. + Value *[]RoutingIntent `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListRoutingIntentResultIterator provides access to a complete listing of RoutingIntent values. +type ListRoutingIntentResultIterator struct { + i int + page ListRoutingIntentResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListRoutingIntentResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListRoutingIntentResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListRoutingIntentResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListRoutingIntentResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListRoutingIntentResultIterator) Response() ListRoutingIntentResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListRoutingIntentResultIterator) Value() RoutingIntent { + if !iter.page.NotDone() { + return RoutingIntent{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListRoutingIntentResultIterator type. +func NewListRoutingIntentResultIterator(page ListRoutingIntentResultPage) ListRoutingIntentResultIterator { + return ListRoutingIntentResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lrir ListRoutingIntentResult) IsEmpty() bool { + return lrir.Value == nil || len(*lrir.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lrir ListRoutingIntentResult) hasNextLink() bool { + return lrir.NextLink != nil && len(*lrir.NextLink) != 0 +} + +// listRoutingIntentResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lrir ListRoutingIntentResult) listRoutingIntentResultPreparer(ctx context.Context) (*http.Request, error) { + if !lrir.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lrir.NextLink))) +} + +// ListRoutingIntentResultPage contains a page of RoutingIntent values. +type ListRoutingIntentResultPage struct { + fn func(context.Context, ListRoutingIntentResult) (ListRoutingIntentResult, error) + lrir ListRoutingIntentResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListRoutingIntentResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListRoutingIntentResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lrir) + if err != nil { + return err + } + page.lrir = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListRoutingIntentResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListRoutingIntentResultPage) NotDone() bool { + return !page.lrir.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListRoutingIntentResultPage) Response() ListRoutingIntentResult { + return page.lrir +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListRoutingIntentResultPage) Values() []RoutingIntent { + if page.lrir.IsEmpty() { + return nil + } + return *page.lrir.Value +} + +// Creates a new instance of the ListRoutingIntentResultPage type. +func NewListRoutingIntentResultPage(cur ListRoutingIntentResult, getNextPage func(context.Context, ListRoutingIntentResult) (ListRoutingIntentResult, error)) ListRoutingIntentResultPage { + return ListRoutingIntentResultPage{ + fn: getNextPage, + lrir: cur, + } +} + +// ListString ... +type ListString struct { + autorest.Response `json:"-"` + Value *[]string `json:"value,omitempty"` +} + +// ListVirtualHubBgpConnectionResults virtualHubBgpConnections list. +type ListVirtualHubBgpConnectionResults struct { + autorest.Response `json:"-"` + // Value - The list of VirtualHubBgpConnections. + Value *[]BgpConnection `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVirtualHubBgpConnectionResultsIterator provides access to a complete listing of BgpConnection +// values. +type ListVirtualHubBgpConnectionResultsIterator struct { + i int + page ListVirtualHubBgpConnectionResultsPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVirtualHubBgpConnectionResultsIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubBgpConnectionResultsIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVirtualHubBgpConnectionResultsIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVirtualHubBgpConnectionResultsIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVirtualHubBgpConnectionResultsIterator) Response() ListVirtualHubBgpConnectionResults { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVirtualHubBgpConnectionResultsIterator) Value() BgpConnection { + if !iter.page.NotDone() { + return BgpConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVirtualHubBgpConnectionResultsIterator type. +func NewListVirtualHubBgpConnectionResultsIterator(page ListVirtualHubBgpConnectionResultsPage) ListVirtualHubBgpConnectionResultsIterator { + return ListVirtualHubBgpConnectionResultsIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvhbcr ListVirtualHubBgpConnectionResults) IsEmpty() bool { + return lvhbcr.Value == nil || len(*lvhbcr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvhbcr ListVirtualHubBgpConnectionResults) hasNextLink() bool { + return lvhbcr.NextLink != nil && len(*lvhbcr.NextLink) != 0 +} + +// listVirtualHubBgpConnectionResultsPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvhbcr ListVirtualHubBgpConnectionResults) listVirtualHubBgpConnectionResultsPreparer(ctx context.Context) (*http.Request, error) { + if !lvhbcr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvhbcr.NextLink))) +} + +// ListVirtualHubBgpConnectionResultsPage contains a page of BgpConnection values. +type ListVirtualHubBgpConnectionResultsPage struct { + fn func(context.Context, ListVirtualHubBgpConnectionResults) (ListVirtualHubBgpConnectionResults, error) + lvhbcr ListVirtualHubBgpConnectionResults +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVirtualHubBgpConnectionResultsPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubBgpConnectionResultsPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvhbcr) + if err != nil { + return err + } + page.lvhbcr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVirtualHubBgpConnectionResultsPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVirtualHubBgpConnectionResultsPage) NotDone() bool { + return !page.lvhbcr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVirtualHubBgpConnectionResultsPage) Response() ListVirtualHubBgpConnectionResults { + return page.lvhbcr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVirtualHubBgpConnectionResultsPage) Values() []BgpConnection { + if page.lvhbcr.IsEmpty() { + return nil + } + return *page.lvhbcr.Value +} + +// Creates a new instance of the ListVirtualHubBgpConnectionResultsPage type. +func NewListVirtualHubBgpConnectionResultsPage(cur ListVirtualHubBgpConnectionResults, getNextPage func(context.Context, ListVirtualHubBgpConnectionResults) (ListVirtualHubBgpConnectionResults, error)) ListVirtualHubBgpConnectionResultsPage { + return ListVirtualHubBgpConnectionResultsPage{ + fn: getNextPage, + lvhbcr: cur, + } +} + +// ListVirtualHubIPConfigurationResults virtualHubIpConfigurations list. +type ListVirtualHubIPConfigurationResults struct { + autorest.Response `json:"-"` + // Value - The list of VirtualHubIpConfigurations. + Value *[]HubIPConfiguration `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVirtualHubIPConfigurationResultsIterator provides access to a complete listing of HubIPConfiguration +// values. +type ListVirtualHubIPConfigurationResultsIterator struct { + i int + page ListVirtualHubIPConfigurationResultsPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVirtualHubIPConfigurationResultsIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubIPConfigurationResultsIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVirtualHubIPConfigurationResultsIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVirtualHubIPConfigurationResultsIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVirtualHubIPConfigurationResultsIterator) Response() ListVirtualHubIPConfigurationResults { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVirtualHubIPConfigurationResultsIterator) Value() HubIPConfiguration { + if !iter.page.NotDone() { + return HubIPConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVirtualHubIPConfigurationResultsIterator type. +func NewListVirtualHubIPConfigurationResultsIterator(page ListVirtualHubIPConfigurationResultsPage) ListVirtualHubIPConfigurationResultsIterator { + return ListVirtualHubIPConfigurationResultsIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvhicr ListVirtualHubIPConfigurationResults) IsEmpty() bool { + return lvhicr.Value == nil || len(*lvhicr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvhicr ListVirtualHubIPConfigurationResults) hasNextLink() bool { + return lvhicr.NextLink != nil && len(*lvhicr.NextLink) != 0 +} + +// listVirtualHubIPConfigurationResultsPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvhicr ListVirtualHubIPConfigurationResults) listVirtualHubIPConfigurationResultsPreparer(ctx context.Context) (*http.Request, error) { + if !lvhicr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvhicr.NextLink))) +} + +// ListVirtualHubIPConfigurationResultsPage contains a page of HubIPConfiguration values. +type ListVirtualHubIPConfigurationResultsPage struct { + fn func(context.Context, ListVirtualHubIPConfigurationResults) (ListVirtualHubIPConfigurationResults, error) + lvhicr ListVirtualHubIPConfigurationResults +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVirtualHubIPConfigurationResultsPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubIPConfigurationResultsPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvhicr) + if err != nil { + return err + } + page.lvhicr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVirtualHubIPConfigurationResultsPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVirtualHubIPConfigurationResultsPage) NotDone() bool { + return !page.lvhicr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVirtualHubIPConfigurationResultsPage) Response() ListVirtualHubIPConfigurationResults { + return page.lvhicr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVirtualHubIPConfigurationResultsPage) Values() []HubIPConfiguration { + if page.lvhicr.IsEmpty() { + return nil + } + return *page.lvhicr.Value +} + +// Creates a new instance of the ListVirtualHubIPConfigurationResultsPage type. +func NewListVirtualHubIPConfigurationResultsPage(cur ListVirtualHubIPConfigurationResults, getNextPage func(context.Context, ListVirtualHubIPConfigurationResults) (ListVirtualHubIPConfigurationResults, error)) ListVirtualHubIPConfigurationResultsPage { + return ListVirtualHubIPConfigurationResultsPage{ + fn: getNextPage, + lvhicr: cur, + } +} + +// ListVirtualHubRouteTableV2sResult list of VirtualHubRouteTableV2s and a URL nextLink to get the next set +// of results. +type ListVirtualHubRouteTableV2sResult struct { + autorest.Response `json:"-"` + // Value - List of VirtualHubRouteTableV2s. + Value *[]VirtualHubRouteTableV2 `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVirtualHubRouteTableV2sResultIterator provides access to a complete listing of +// VirtualHubRouteTableV2 values. +type ListVirtualHubRouteTableV2sResultIterator struct { + i int + page ListVirtualHubRouteTableV2sResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVirtualHubRouteTableV2sResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubRouteTableV2sResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVirtualHubRouteTableV2sResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVirtualHubRouteTableV2sResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVirtualHubRouteTableV2sResultIterator) Response() ListVirtualHubRouteTableV2sResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVirtualHubRouteTableV2sResultIterator) Value() VirtualHubRouteTableV2 { + if !iter.page.NotDone() { + return VirtualHubRouteTableV2{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVirtualHubRouteTableV2sResultIterator type. +func NewListVirtualHubRouteTableV2sResultIterator(page ListVirtualHubRouteTableV2sResultPage) ListVirtualHubRouteTableV2sResultIterator { + return ListVirtualHubRouteTableV2sResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvhrtvr ListVirtualHubRouteTableV2sResult) IsEmpty() bool { + return lvhrtvr.Value == nil || len(*lvhrtvr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvhrtvr ListVirtualHubRouteTableV2sResult) hasNextLink() bool { + return lvhrtvr.NextLink != nil && len(*lvhrtvr.NextLink) != 0 +} + +// listVirtualHubRouteTableV2sResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvhrtvr ListVirtualHubRouteTableV2sResult) listVirtualHubRouteTableV2sResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvhrtvr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvhrtvr.NextLink))) +} + +// ListVirtualHubRouteTableV2sResultPage contains a page of VirtualHubRouteTableV2 values. +type ListVirtualHubRouteTableV2sResultPage struct { + fn func(context.Context, ListVirtualHubRouteTableV2sResult) (ListVirtualHubRouteTableV2sResult, error) + lvhrtvr ListVirtualHubRouteTableV2sResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVirtualHubRouteTableV2sResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubRouteTableV2sResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvhrtvr) + if err != nil { + return err + } + page.lvhrtvr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVirtualHubRouteTableV2sResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVirtualHubRouteTableV2sResultPage) NotDone() bool { + return !page.lvhrtvr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVirtualHubRouteTableV2sResultPage) Response() ListVirtualHubRouteTableV2sResult { + return page.lvhrtvr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVirtualHubRouteTableV2sResultPage) Values() []VirtualHubRouteTableV2 { + if page.lvhrtvr.IsEmpty() { + return nil + } + return *page.lvhrtvr.Value +} + +// Creates a new instance of the ListVirtualHubRouteTableV2sResultPage type. +func NewListVirtualHubRouteTableV2sResultPage(cur ListVirtualHubRouteTableV2sResult, getNextPage func(context.Context, ListVirtualHubRouteTableV2sResult) (ListVirtualHubRouteTableV2sResult, error)) ListVirtualHubRouteTableV2sResultPage { + return ListVirtualHubRouteTableV2sResultPage{ + fn: getNextPage, + lvhrtvr: cur, + } +} + +// ListVirtualHubsResult result of the request to list VirtualHubs. It contains a list of VirtualHubs and a +// URL nextLink to get the next set of results. +type ListVirtualHubsResult struct { + autorest.Response `json:"-"` + // Value - List of VirtualHubs. + Value *[]VirtualHub `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVirtualHubsResultIterator provides access to a complete listing of VirtualHub values. +type ListVirtualHubsResultIterator struct { + i int + page ListVirtualHubsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVirtualHubsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVirtualHubsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVirtualHubsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVirtualHubsResultIterator) Response() ListVirtualHubsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVirtualHubsResultIterator) Value() VirtualHub { + if !iter.page.NotDone() { + return VirtualHub{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVirtualHubsResultIterator type. +func NewListVirtualHubsResultIterator(page ListVirtualHubsResultPage) ListVirtualHubsResultIterator { + return ListVirtualHubsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvhr ListVirtualHubsResult) IsEmpty() bool { + return lvhr.Value == nil || len(*lvhr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvhr ListVirtualHubsResult) hasNextLink() bool { + return lvhr.NextLink != nil && len(*lvhr.NextLink) != 0 +} + +// listVirtualHubsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvhr ListVirtualHubsResult) listVirtualHubsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvhr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvhr.NextLink))) +} + +// ListVirtualHubsResultPage contains a page of VirtualHub values. +type ListVirtualHubsResultPage struct { + fn func(context.Context, ListVirtualHubsResult) (ListVirtualHubsResult, error) + lvhr ListVirtualHubsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVirtualHubsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvhr) + if err != nil { + return err + } + page.lvhr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVirtualHubsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVirtualHubsResultPage) NotDone() bool { + return !page.lvhr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVirtualHubsResultPage) Response() ListVirtualHubsResult { + return page.lvhr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVirtualHubsResultPage) Values() []VirtualHub { + if page.lvhr.IsEmpty() { + return nil + } + return *page.lvhr.Value +} + +// Creates a new instance of the ListVirtualHubsResultPage type. +func NewListVirtualHubsResultPage(cur ListVirtualHubsResult, getNextPage func(context.Context, ListVirtualHubsResult) (ListVirtualHubsResult, error)) ListVirtualHubsResultPage { + return ListVirtualHubsResultPage{ + fn: getNextPage, + lvhr: cur, + } +} + +// ListVirtualNetworkGatewayNatRulesResult 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. +type ListVirtualNetworkGatewayNatRulesResult struct { + autorest.Response `json:"-"` + // Value - List of Nat Rules. + Value *[]VirtualNetworkGatewayNatRule `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVirtualNetworkGatewayNatRulesResultIterator provides access to a complete listing of +// VirtualNetworkGatewayNatRule values. +type ListVirtualNetworkGatewayNatRulesResultIterator struct { + i int + page ListVirtualNetworkGatewayNatRulesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVirtualNetworkGatewayNatRulesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualNetworkGatewayNatRulesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVirtualNetworkGatewayNatRulesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVirtualNetworkGatewayNatRulesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVirtualNetworkGatewayNatRulesResultIterator) Response() ListVirtualNetworkGatewayNatRulesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVirtualNetworkGatewayNatRulesResultIterator) Value() VirtualNetworkGatewayNatRule { + if !iter.page.NotDone() { + return VirtualNetworkGatewayNatRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVirtualNetworkGatewayNatRulesResultIterator type. +func NewListVirtualNetworkGatewayNatRulesResultIterator(page ListVirtualNetworkGatewayNatRulesResultPage) ListVirtualNetworkGatewayNatRulesResultIterator { + return ListVirtualNetworkGatewayNatRulesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvngnrr ListVirtualNetworkGatewayNatRulesResult) IsEmpty() bool { + return lvngnrr.Value == nil || len(*lvngnrr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvngnrr ListVirtualNetworkGatewayNatRulesResult) hasNextLink() bool { + return lvngnrr.NextLink != nil && len(*lvngnrr.NextLink) != 0 +} + +// listVirtualNetworkGatewayNatRulesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvngnrr ListVirtualNetworkGatewayNatRulesResult) listVirtualNetworkGatewayNatRulesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvngnrr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvngnrr.NextLink))) +} + +// ListVirtualNetworkGatewayNatRulesResultPage contains a page of VirtualNetworkGatewayNatRule values. +type ListVirtualNetworkGatewayNatRulesResultPage struct { + fn func(context.Context, ListVirtualNetworkGatewayNatRulesResult) (ListVirtualNetworkGatewayNatRulesResult, error) + lvngnrr ListVirtualNetworkGatewayNatRulesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVirtualNetworkGatewayNatRulesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualNetworkGatewayNatRulesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvngnrr) + if err != nil { + return err + } + page.lvngnrr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVirtualNetworkGatewayNatRulesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVirtualNetworkGatewayNatRulesResultPage) NotDone() bool { + return !page.lvngnrr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVirtualNetworkGatewayNatRulesResultPage) Response() ListVirtualNetworkGatewayNatRulesResult { + return page.lvngnrr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVirtualNetworkGatewayNatRulesResultPage) Values() []VirtualNetworkGatewayNatRule { + if page.lvngnrr.IsEmpty() { + return nil + } + return *page.lvngnrr.Value +} + +// Creates a new instance of the ListVirtualNetworkGatewayNatRulesResultPage type. +func NewListVirtualNetworkGatewayNatRulesResultPage(cur ListVirtualNetworkGatewayNatRulesResult, getNextPage func(context.Context, ListVirtualNetworkGatewayNatRulesResult) (ListVirtualNetworkGatewayNatRulesResult, error)) ListVirtualNetworkGatewayNatRulesResultPage { + return ListVirtualNetworkGatewayNatRulesResultPage{ + fn: getNextPage, + lvngnrr: cur, + } +} + +// ListVirtualWANsResult result of the request to list VirtualWANs. It contains a list of VirtualWANs and a +// URL nextLink to get the next set of results. +type ListVirtualWANsResult struct { + autorest.Response `json:"-"` + // Value - List of VirtualWANs. + Value *[]VirtualWAN `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVirtualWANsResultIterator provides access to a complete listing of VirtualWAN values. +type ListVirtualWANsResultIterator struct { + i int + page ListVirtualWANsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVirtualWANsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualWANsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVirtualWANsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVirtualWANsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVirtualWANsResultIterator) Response() ListVirtualWANsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVirtualWANsResultIterator) Value() VirtualWAN { + if !iter.page.NotDone() { + return VirtualWAN{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVirtualWANsResultIterator type. +func NewListVirtualWANsResultIterator(page ListVirtualWANsResultPage) ListVirtualWANsResultIterator { + return ListVirtualWANsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvwnr ListVirtualWANsResult) IsEmpty() bool { + return lvwnr.Value == nil || len(*lvwnr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvwnr ListVirtualWANsResult) hasNextLink() bool { + return lvwnr.NextLink != nil && len(*lvwnr.NextLink) != 0 +} + +// listVirtualWANsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvwnr ListVirtualWANsResult) listVirtualWANsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvwnr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvwnr.NextLink))) +} + +// ListVirtualWANsResultPage contains a page of VirtualWAN values. +type ListVirtualWANsResultPage struct { + fn func(context.Context, ListVirtualWANsResult) (ListVirtualWANsResult, error) + lvwnr ListVirtualWANsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVirtualWANsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualWANsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvwnr) + if err != nil { + return err + } + page.lvwnr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVirtualWANsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVirtualWANsResultPage) NotDone() bool { + return !page.lvwnr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVirtualWANsResultPage) Response() ListVirtualWANsResult { + return page.lvwnr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVirtualWANsResultPage) Values() []VirtualWAN { + if page.lvwnr.IsEmpty() { + return nil + } + return *page.lvwnr.Value +} + +// Creates a new instance of the ListVirtualWANsResultPage type. +func NewListVirtualWANsResultPage(cur ListVirtualWANsResult, getNextPage func(context.Context, ListVirtualWANsResult) (ListVirtualWANsResult, error)) ListVirtualWANsResultPage { + return ListVirtualWANsResultPage{ + fn: getNextPage, + lvwnr: cur, + } +} + +// ListVpnConnectionsResult 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. +type ListVpnConnectionsResult struct { + autorest.Response `json:"-"` + // Value - List of Vpn Connections. + Value *[]VpnConnection `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnConnectionsResultIterator provides access to a complete listing of VpnConnection values. +type ListVpnConnectionsResultIterator struct { + i int + page ListVpnConnectionsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnConnectionsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnConnectionsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnConnectionsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnConnectionsResultIterator) Response() ListVpnConnectionsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnConnectionsResultIterator) Value() VpnConnection { + if !iter.page.NotDone() { + return VpnConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnConnectionsResultIterator type. +func NewListVpnConnectionsResultIterator(page ListVpnConnectionsResultPage) ListVpnConnectionsResultIterator { + return ListVpnConnectionsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvcr ListVpnConnectionsResult) IsEmpty() bool { + return lvcr.Value == nil || len(*lvcr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvcr ListVpnConnectionsResult) hasNextLink() bool { + return lvcr.NextLink != nil && len(*lvcr.NextLink) != 0 +} + +// listVpnConnectionsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvcr ListVpnConnectionsResult) listVpnConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvcr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvcr.NextLink))) +} + +// ListVpnConnectionsResultPage contains a page of VpnConnection values. +type ListVpnConnectionsResultPage struct { + fn func(context.Context, ListVpnConnectionsResult) (ListVpnConnectionsResult, error) + lvcr ListVpnConnectionsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnConnectionsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvcr) + if err != nil { + return err + } + page.lvcr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnConnectionsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnConnectionsResultPage) NotDone() bool { + return !page.lvcr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnConnectionsResultPage) Response() ListVpnConnectionsResult { + return page.lvcr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnConnectionsResultPage) Values() []VpnConnection { + if page.lvcr.IsEmpty() { + return nil + } + return *page.lvcr.Value +} + +// Creates a new instance of the ListVpnConnectionsResultPage type. +func NewListVpnConnectionsResultPage(cur ListVpnConnectionsResult, getNextPage func(context.Context, ListVpnConnectionsResult) (ListVpnConnectionsResult, error)) ListVpnConnectionsResultPage { + return ListVpnConnectionsResultPage{ + fn: getNextPage, + lvcr: cur, + } +} + +// ListVpnGatewayNatRulesResult 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. +type ListVpnGatewayNatRulesResult struct { + autorest.Response `json:"-"` + // Value - List of Nat Rules. + Value *[]VpnGatewayNatRule `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnGatewayNatRulesResultIterator provides access to a complete listing of VpnGatewayNatRule values. +type ListVpnGatewayNatRulesResultIterator struct { + i int + page ListVpnGatewayNatRulesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnGatewayNatRulesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnGatewayNatRulesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnGatewayNatRulesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnGatewayNatRulesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnGatewayNatRulesResultIterator) Response() ListVpnGatewayNatRulesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnGatewayNatRulesResultIterator) Value() VpnGatewayNatRule { + if !iter.page.NotDone() { + return VpnGatewayNatRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnGatewayNatRulesResultIterator type. +func NewListVpnGatewayNatRulesResultIterator(page ListVpnGatewayNatRulesResultPage) ListVpnGatewayNatRulesResultIterator { + return ListVpnGatewayNatRulesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvgnrr ListVpnGatewayNatRulesResult) IsEmpty() bool { + return lvgnrr.Value == nil || len(*lvgnrr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvgnrr ListVpnGatewayNatRulesResult) hasNextLink() bool { + return lvgnrr.NextLink != nil && len(*lvgnrr.NextLink) != 0 +} + +// listVpnGatewayNatRulesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvgnrr ListVpnGatewayNatRulesResult) listVpnGatewayNatRulesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvgnrr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvgnrr.NextLink))) +} + +// ListVpnGatewayNatRulesResultPage contains a page of VpnGatewayNatRule values. +type ListVpnGatewayNatRulesResultPage struct { + fn func(context.Context, ListVpnGatewayNatRulesResult) (ListVpnGatewayNatRulesResult, error) + lvgnrr ListVpnGatewayNatRulesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnGatewayNatRulesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnGatewayNatRulesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvgnrr) + if err != nil { + return err + } + page.lvgnrr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnGatewayNatRulesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnGatewayNatRulesResultPage) NotDone() bool { + return !page.lvgnrr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnGatewayNatRulesResultPage) Response() ListVpnGatewayNatRulesResult { + return page.lvgnrr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnGatewayNatRulesResultPage) Values() []VpnGatewayNatRule { + if page.lvgnrr.IsEmpty() { + return nil + } + return *page.lvgnrr.Value +} + +// Creates a new instance of the ListVpnGatewayNatRulesResultPage type. +func NewListVpnGatewayNatRulesResultPage(cur ListVpnGatewayNatRulesResult, getNextPage func(context.Context, ListVpnGatewayNatRulesResult) (ListVpnGatewayNatRulesResult, error)) ListVpnGatewayNatRulesResultPage { + return ListVpnGatewayNatRulesResultPage{ + fn: getNextPage, + lvgnrr: cur, + } +} + +// ListVpnGatewaysResult result of the request to list VpnGateways. It contains a list of VpnGateways and a +// URL nextLink to get the next set of results. +type ListVpnGatewaysResult struct { + autorest.Response `json:"-"` + // Value - List of VpnGateways. + Value *[]VpnGateway `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnGatewaysResultIterator provides access to a complete listing of VpnGateway values. +type ListVpnGatewaysResultIterator struct { + i int + page ListVpnGatewaysResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnGatewaysResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnGatewaysResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnGatewaysResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnGatewaysResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnGatewaysResultIterator) Response() ListVpnGatewaysResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnGatewaysResultIterator) Value() VpnGateway { + if !iter.page.NotDone() { + return VpnGateway{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnGatewaysResultIterator type. +func NewListVpnGatewaysResultIterator(page ListVpnGatewaysResultPage) ListVpnGatewaysResultIterator { + return ListVpnGatewaysResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvgr ListVpnGatewaysResult) IsEmpty() bool { + return lvgr.Value == nil || len(*lvgr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvgr ListVpnGatewaysResult) hasNextLink() bool { + return lvgr.NextLink != nil && len(*lvgr.NextLink) != 0 +} + +// listVpnGatewaysResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvgr ListVpnGatewaysResult) listVpnGatewaysResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvgr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvgr.NextLink))) +} + +// ListVpnGatewaysResultPage contains a page of VpnGateway values. +type ListVpnGatewaysResultPage struct { + fn func(context.Context, ListVpnGatewaysResult) (ListVpnGatewaysResult, error) + lvgr ListVpnGatewaysResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnGatewaysResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnGatewaysResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvgr) + if err != nil { + return err + } + page.lvgr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnGatewaysResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnGatewaysResultPage) NotDone() bool { + return !page.lvgr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnGatewaysResultPage) Response() ListVpnGatewaysResult { + return page.lvgr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnGatewaysResultPage) Values() []VpnGateway { + if page.lvgr.IsEmpty() { + return nil + } + return *page.lvgr.Value +} + +// Creates a new instance of the ListVpnGatewaysResultPage type. +func NewListVpnGatewaysResultPage(cur ListVpnGatewaysResult, getNextPage func(context.Context, ListVpnGatewaysResult) (ListVpnGatewaysResult, error)) ListVpnGatewaysResultPage { + return ListVpnGatewaysResultPage{ + fn: getNextPage, + lvgr: cur, + } +} + +// ListVpnServerConfigurationPolicyGroupsResult result of the request to list +// VpnServerConfigurationPolicyGroups. It contains a list of VpnServerConfigurationPolicyGroups and a URL +// nextLink to get the next set of results. +type ListVpnServerConfigurationPolicyGroupsResult struct { + autorest.Response `json:"-"` + // Value - List of VpnServerConfigurationPolicyGroups. + Value *[]VpnServerConfigurationPolicyGroup `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnServerConfigurationPolicyGroupsResultIterator provides access to a complete listing of +// VpnServerConfigurationPolicyGroup values. +type ListVpnServerConfigurationPolicyGroupsResultIterator struct { + i int + page ListVpnServerConfigurationPolicyGroupsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnServerConfigurationPolicyGroupsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnServerConfigurationPolicyGroupsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnServerConfigurationPolicyGroupsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnServerConfigurationPolicyGroupsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnServerConfigurationPolicyGroupsResultIterator) Response() ListVpnServerConfigurationPolicyGroupsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnServerConfigurationPolicyGroupsResultIterator) Value() VpnServerConfigurationPolicyGroup { + if !iter.page.NotDone() { + return VpnServerConfigurationPolicyGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnServerConfigurationPolicyGroupsResultIterator type. +func NewListVpnServerConfigurationPolicyGroupsResultIterator(page ListVpnServerConfigurationPolicyGroupsResultPage) ListVpnServerConfigurationPolicyGroupsResultIterator { + return ListVpnServerConfigurationPolicyGroupsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvscpgr ListVpnServerConfigurationPolicyGroupsResult) IsEmpty() bool { + return lvscpgr.Value == nil || len(*lvscpgr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvscpgr ListVpnServerConfigurationPolicyGroupsResult) hasNextLink() bool { + return lvscpgr.NextLink != nil && len(*lvscpgr.NextLink) != 0 +} + +// listVpnServerConfigurationPolicyGroupsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvscpgr ListVpnServerConfigurationPolicyGroupsResult) listVpnServerConfigurationPolicyGroupsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvscpgr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvscpgr.NextLink))) +} + +// ListVpnServerConfigurationPolicyGroupsResultPage contains a page of VpnServerConfigurationPolicyGroup +// values. +type ListVpnServerConfigurationPolicyGroupsResultPage struct { + fn func(context.Context, ListVpnServerConfigurationPolicyGroupsResult) (ListVpnServerConfigurationPolicyGroupsResult, error) + lvscpgr ListVpnServerConfigurationPolicyGroupsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnServerConfigurationPolicyGroupsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnServerConfigurationPolicyGroupsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvscpgr) + if err != nil { + return err + } + page.lvscpgr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnServerConfigurationPolicyGroupsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnServerConfigurationPolicyGroupsResultPage) NotDone() bool { + return !page.lvscpgr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnServerConfigurationPolicyGroupsResultPage) Response() ListVpnServerConfigurationPolicyGroupsResult { + return page.lvscpgr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnServerConfigurationPolicyGroupsResultPage) Values() []VpnServerConfigurationPolicyGroup { + if page.lvscpgr.IsEmpty() { + return nil + } + return *page.lvscpgr.Value +} + +// Creates a new instance of the ListVpnServerConfigurationPolicyGroupsResultPage type. +func NewListVpnServerConfigurationPolicyGroupsResultPage(cur ListVpnServerConfigurationPolicyGroupsResult, getNextPage func(context.Context, ListVpnServerConfigurationPolicyGroupsResult) (ListVpnServerConfigurationPolicyGroupsResult, error)) ListVpnServerConfigurationPolicyGroupsResultPage { + return ListVpnServerConfigurationPolicyGroupsResultPage{ + fn: getNextPage, + lvscpgr: cur, + } +} + +// ListVpnServerConfigurationsResult 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. +type ListVpnServerConfigurationsResult struct { + autorest.Response `json:"-"` + // Value - List of VpnServerConfigurations. + Value *[]VpnServerConfiguration `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnServerConfigurationsResultIterator provides access to a complete listing of +// VpnServerConfiguration values. +type ListVpnServerConfigurationsResultIterator struct { + i int + page ListVpnServerConfigurationsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnServerConfigurationsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnServerConfigurationsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnServerConfigurationsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnServerConfigurationsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnServerConfigurationsResultIterator) Response() ListVpnServerConfigurationsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnServerConfigurationsResultIterator) Value() VpnServerConfiguration { + if !iter.page.NotDone() { + return VpnServerConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnServerConfigurationsResultIterator type. +func NewListVpnServerConfigurationsResultIterator(page ListVpnServerConfigurationsResultPage) ListVpnServerConfigurationsResultIterator { + return ListVpnServerConfigurationsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvscr ListVpnServerConfigurationsResult) IsEmpty() bool { + return lvscr.Value == nil || len(*lvscr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvscr ListVpnServerConfigurationsResult) hasNextLink() bool { + return lvscr.NextLink != nil && len(*lvscr.NextLink) != 0 +} + +// listVpnServerConfigurationsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvscr ListVpnServerConfigurationsResult) listVpnServerConfigurationsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvscr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvscr.NextLink))) +} + +// ListVpnServerConfigurationsResultPage contains a page of VpnServerConfiguration values. +type ListVpnServerConfigurationsResultPage struct { + fn func(context.Context, ListVpnServerConfigurationsResult) (ListVpnServerConfigurationsResult, error) + lvscr ListVpnServerConfigurationsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnServerConfigurationsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnServerConfigurationsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvscr) + if err != nil { + return err + } + page.lvscr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnServerConfigurationsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnServerConfigurationsResultPage) NotDone() bool { + return !page.lvscr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnServerConfigurationsResultPage) Response() ListVpnServerConfigurationsResult { + return page.lvscr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnServerConfigurationsResultPage) Values() []VpnServerConfiguration { + if page.lvscr.IsEmpty() { + return nil + } + return *page.lvscr.Value +} + +// Creates a new instance of the ListVpnServerConfigurationsResultPage type. +func NewListVpnServerConfigurationsResultPage(cur ListVpnServerConfigurationsResult, getNextPage func(context.Context, ListVpnServerConfigurationsResult) (ListVpnServerConfigurationsResult, error)) ListVpnServerConfigurationsResultPage { + return ListVpnServerConfigurationsResultPage{ + fn: getNextPage, + lvscr: cur, + } +} + +// ListVpnSiteLinkConnectionsResult 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. +type ListVpnSiteLinkConnectionsResult struct { + autorest.Response `json:"-"` + // Value - List of VpnSiteLinkConnections. + Value *[]VpnSiteLinkConnection `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnSiteLinkConnectionsResultIterator provides access to a complete listing of VpnSiteLinkConnection +// values. +type ListVpnSiteLinkConnectionsResultIterator struct { + i int + page ListVpnSiteLinkConnectionsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnSiteLinkConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSiteLinkConnectionsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnSiteLinkConnectionsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnSiteLinkConnectionsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnSiteLinkConnectionsResultIterator) Response() ListVpnSiteLinkConnectionsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnSiteLinkConnectionsResultIterator) Value() VpnSiteLinkConnection { + if !iter.page.NotDone() { + return VpnSiteLinkConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnSiteLinkConnectionsResultIterator type. +func NewListVpnSiteLinkConnectionsResultIterator(page ListVpnSiteLinkConnectionsResultPage) ListVpnSiteLinkConnectionsResultIterator { + return ListVpnSiteLinkConnectionsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvslcr ListVpnSiteLinkConnectionsResult) IsEmpty() bool { + return lvslcr.Value == nil || len(*lvslcr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvslcr ListVpnSiteLinkConnectionsResult) hasNextLink() bool { + return lvslcr.NextLink != nil && len(*lvslcr.NextLink) != 0 +} + +// listVpnSiteLinkConnectionsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvslcr ListVpnSiteLinkConnectionsResult) listVpnSiteLinkConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvslcr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvslcr.NextLink))) +} + +// ListVpnSiteLinkConnectionsResultPage contains a page of VpnSiteLinkConnection values. +type ListVpnSiteLinkConnectionsResultPage struct { + fn func(context.Context, ListVpnSiteLinkConnectionsResult) (ListVpnSiteLinkConnectionsResult, error) + lvslcr ListVpnSiteLinkConnectionsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnSiteLinkConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSiteLinkConnectionsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvslcr) + if err != nil { + return err + } + page.lvslcr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnSiteLinkConnectionsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnSiteLinkConnectionsResultPage) NotDone() bool { + return !page.lvslcr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnSiteLinkConnectionsResultPage) Response() ListVpnSiteLinkConnectionsResult { + return page.lvslcr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnSiteLinkConnectionsResultPage) Values() []VpnSiteLinkConnection { + if page.lvslcr.IsEmpty() { + return nil + } + return *page.lvslcr.Value +} + +// Creates a new instance of the ListVpnSiteLinkConnectionsResultPage type. +func NewListVpnSiteLinkConnectionsResultPage(cur ListVpnSiteLinkConnectionsResult, getNextPage func(context.Context, ListVpnSiteLinkConnectionsResult) (ListVpnSiteLinkConnectionsResult, error)) ListVpnSiteLinkConnectionsResultPage { + return ListVpnSiteLinkConnectionsResultPage{ + fn: getNextPage, + lvslcr: cur, + } +} + +// ListVpnSiteLinksResult result of the request to list VpnSiteLinks. It contains a list of VpnSiteLinks +// and a URL nextLink to get the next set of results. +type ListVpnSiteLinksResult struct { + autorest.Response `json:"-"` + // Value - List of VpnSitesLinks. + Value *[]VpnSiteLink `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnSiteLinksResultIterator provides access to a complete listing of VpnSiteLink values. +type ListVpnSiteLinksResultIterator struct { + i int + page ListVpnSiteLinksResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnSiteLinksResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSiteLinksResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnSiteLinksResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnSiteLinksResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnSiteLinksResultIterator) Response() ListVpnSiteLinksResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnSiteLinksResultIterator) Value() VpnSiteLink { + if !iter.page.NotDone() { + return VpnSiteLink{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnSiteLinksResultIterator type. +func NewListVpnSiteLinksResultIterator(page ListVpnSiteLinksResultPage) ListVpnSiteLinksResultIterator { + return ListVpnSiteLinksResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvslr ListVpnSiteLinksResult) IsEmpty() bool { + return lvslr.Value == nil || len(*lvslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvslr ListVpnSiteLinksResult) hasNextLink() bool { + return lvslr.NextLink != nil && len(*lvslr.NextLink) != 0 +} + +// listVpnSiteLinksResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvslr ListVpnSiteLinksResult) listVpnSiteLinksResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvslr.NextLink))) +} + +// ListVpnSiteLinksResultPage contains a page of VpnSiteLink values. +type ListVpnSiteLinksResultPage struct { + fn func(context.Context, ListVpnSiteLinksResult) (ListVpnSiteLinksResult, error) + lvslr ListVpnSiteLinksResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnSiteLinksResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSiteLinksResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvslr) + if err != nil { + return err + } + page.lvslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnSiteLinksResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnSiteLinksResultPage) NotDone() bool { + return !page.lvslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnSiteLinksResultPage) Response() ListVpnSiteLinksResult { + return page.lvslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnSiteLinksResultPage) Values() []VpnSiteLink { + if page.lvslr.IsEmpty() { + return nil + } + return *page.lvslr.Value +} + +// Creates a new instance of the ListVpnSiteLinksResultPage type. +func NewListVpnSiteLinksResultPage(cur ListVpnSiteLinksResult, getNextPage func(context.Context, ListVpnSiteLinksResult) (ListVpnSiteLinksResult, error)) ListVpnSiteLinksResultPage { + return ListVpnSiteLinksResultPage{ + fn: getNextPage, + lvslr: cur, + } +} + +// ListVpnSitesResult result of the request to list VpnSites. It contains a list of VpnSites and a URL +// nextLink to get the next set of results. +type ListVpnSitesResult struct { + autorest.Response `json:"-"` + // Value - List of VpnSites. + Value *[]VpnSite `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnSitesResultIterator provides access to a complete listing of VpnSite values. +type ListVpnSitesResultIterator struct { + i int + page ListVpnSitesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnSitesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSitesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnSitesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnSitesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnSitesResultIterator) Response() ListVpnSitesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnSitesResultIterator) Value() VpnSite { + if !iter.page.NotDone() { + return VpnSite{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnSitesResultIterator type. +func NewListVpnSitesResultIterator(page ListVpnSitesResultPage) ListVpnSitesResultIterator { + return ListVpnSitesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvsr ListVpnSitesResult) IsEmpty() bool { + return lvsr.Value == nil || len(*lvsr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvsr ListVpnSitesResult) hasNextLink() bool { + return lvsr.NextLink != nil && len(*lvsr.NextLink) != 0 +} + +// listVpnSitesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvsr ListVpnSitesResult) listVpnSitesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvsr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvsr.NextLink))) +} + +// ListVpnSitesResultPage contains a page of VpnSite values. +type ListVpnSitesResultPage struct { + fn func(context.Context, ListVpnSitesResult) (ListVpnSitesResult, error) + lvsr ListVpnSitesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnSitesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSitesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvsr) + if err != nil { + return err + } + page.lvsr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnSitesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnSitesResultPage) NotDone() bool { + return !page.lvsr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnSitesResultPage) Response() ListVpnSitesResult { + return page.lvsr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnSitesResultPage) Values() []VpnSite { + if page.lvsr.IsEmpty() { + return nil + } + return *page.lvsr.Value +} + +// Creates a new instance of the ListVpnSitesResultPage type. +func NewListVpnSitesResultPage(cur ListVpnSitesResult, getNextPage func(context.Context, ListVpnSitesResult) (ListVpnSitesResult, error)) ListVpnSitesResultPage { + return ListVpnSitesResultPage{ + fn: getNextPage, + lvsr: cur, + } +} + +// LoadBalancer loadBalancer resource. +type LoadBalancer struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the load balancer. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Sku - The load balancer SKU. + Sku *LoadBalancerSku `json:"sku,omitempty"` + // LoadBalancerPropertiesFormat - Properties of load balancer. + *LoadBalancerPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LoadBalancer. +func (lb LoadBalancer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lb.ExtendedLocation != nil { + objectMap["extendedLocation"] = lb.ExtendedLocation + } + if lb.Sku != nil { + objectMap["sku"] = lb.Sku + } + if lb.LoadBalancerPropertiesFormat != nil { + objectMap["properties"] = lb.LoadBalancerPropertiesFormat + } + if lb.ID != nil { + objectMap["id"] = lb.ID + } + if lb.Location != nil { + objectMap["location"] = lb.Location + } + if lb.Tags != nil { + objectMap["tags"] = lb.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LoadBalancer struct. +func (lb *LoadBalancer) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + lb.ExtendedLocation = &extendedLocation + } + case "sku": + if v != nil { + var sku LoadBalancerSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + lb.Sku = &sku + } + case "properties": + if v != nil { + var loadBalancerPropertiesFormat LoadBalancerPropertiesFormat + err = json.Unmarshal(*v, &loadBalancerPropertiesFormat) + if err != nil { + return err + } + lb.LoadBalancerPropertiesFormat = &loadBalancerPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lb.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lb.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lb.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lb.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lb.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lb.Tags = tags + } + } + } + + return nil +} + +// LoadBalancerBackendAddress load balancer backend addresses. +type LoadBalancerBackendAddress struct { + // LoadBalancerBackendAddressPropertiesFormat - Properties of load balancer backend address pool. + *LoadBalancerBackendAddressPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the backend address. + Name *string `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerBackendAddress. +func (lbba LoadBalancerBackendAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbba.LoadBalancerBackendAddressPropertiesFormat != nil { + objectMap["properties"] = lbba.LoadBalancerBackendAddressPropertiesFormat + } + if lbba.Name != nil { + objectMap["name"] = lbba.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LoadBalancerBackendAddress struct. +func (lbba *LoadBalancerBackendAddress) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var loadBalancerBackendAddressPropertiesFormat LoadBalancerBackendAddressPropertiesFormat + err = json.Unmarshal(*v, &loadBalancerBackendAddressPropertiesFormat) + if err != nil { + return err + } + lbba.LoadBalancerBackendAddressPropertiesFormat = &loadBalancerBackendAddressPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lbba.Name = &name + } + } + } + + return nil +} + +// LoadBalancerBackendAddressPoolListResult response for ListBackendAddressPool API service call. +type LoadBalancerBackendAddressPoolListResult struct { + autorest.Response `json:"-"` + // Value - A list of backend address pools in a load balancer. + Value *[]BackendAddressPool `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerBackendAddressPoolListResult. +func (lbbaplr LoadBalancerBackendAddressPoolListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbbaplr.Value != nil { + objectMap["value"] = lbbaplr.Value + } + return json.Marshal(objectMap) +} + +// LoadBalancerBackendAddressPoolListResultIterator provides access to a complete listing of +// BackendAddressPool values. +type LoadBalancerBackendAddressPoolListResultIterator struct { + i int + page LoadBalancerBackendAddressPoolListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LoadBalancerBackendAddressPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerBackendAddressPoolListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LoadBalancerBackendAddressPoolListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LoadBalancerBackendAddressPoolListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LoadBalancerBackendAddressPoolListResultIterator) Response() LoadBalancerBackendAddressPoolListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LoadBalancerBackendAddressPoolListResultIterator) Value() BackendAddressPool { + if !iter.page.NotDone() { + return BackendAddressPool{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LoadBalancerBackendAddressPoolListResultIterator type. +func NewLoadBalancerBackendAddressPoolListResultIterator(page LoadBalancerBackendAddressPoolListResultPage) LoadBalancerBackendAddressPoolListResultIterator { + return LoadBalancerBackendAddressPoolListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lbbaplr LoadBalancerBackendAddressPoolListResult) IsEmpty() bool { + return lbbaplr.Value == nil || len(*lbbaplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lbbaplr LoadBalancerBackendAddressPoolListResult) hasNextLink() bool { + return lbbaplr.NextLink != nil && len(*lbbaplr.NextLink) != 0 +} + +// loadBalancerBackendAddressPoolListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lbbaplr LoadBalancerBackendAddressPoolListResult) loadBalancerBackendAddressPoolListResultPreparer(ctx context.Context) (*http.Request, error) { + if !lbbaplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lbbaplr.NextLink))) +} + +// LoadBalancerBackendAddressPoolListResultPage contains a page of BackendAddressPool values. +type LoadBalancerBackendAddressPoolListResultPage struct { + fn func(context.Context, LoadBalancerBackendAddressPoolListResult) (LoadBalancerBackendAddressPoolListResult, error) + lbbaplr LoadBalancerBackendAddressPoolListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LoadBalancerBackendAddressPoolListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerBackendAddressPoolListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lbbaplr) + if err != nil { + return err + } + page.lbbaplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LoadBalancerBackendAddressPoolListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LoadBalancerBackendAddressPoolListResultPage) NotDone() bool { + return !page.lbbaplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LoadBalancerBackendAddressPoolListResultPage) Response() LoadBalancerBackendAddressPoolListResult { + return page.lbbaplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LoadBalancerBackendAddressPoolListResultPage) Values() []BackendAddressPool { + if page.lbbaplr.IsEmpty() { + return nil + } + return *page.lbbaplr.Value +} + +// Creates a new instance of the LoadBalancerBackendAddressPoolListResultPage type. +func NewLoadBalancerBackendAddressPoolListResultPage(cur LoadBalancerBackendAddressPoolListResult, getNextPage func(context.Context, LoadBalancerBackendAddressPoolListResult) (LoadBalancerBackendAddressPoolListResult, error)) LoadBalancerBackendAddressPoolListResultPage { + return LoadBalancerBackendAddressPoolListResultPage{ + fn: getNextPage, + lbbaplr: cur, + } +} + +// LoadBalancerBackendAddressPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type LoadBalancerBackendAddressPoolsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LoadBalancerBackendAddressPoolsClient) (BackendAddressPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LoadBalancerBackendAddressPoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LoadBalancerBackendAddressPoolsCreateOrUpdateFuture.Result. +func (future *LoadBalancerBackendAddressPoolsCreateOrUpdateFuture) result(client LoadBalancerBackendAddressPoolsClient) (bap BackendAddressPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bap.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LoadBalancerBackendAddressPoolsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bap.Response.Response, err = future.GetResult(sender); err == nil && bap.Response.Response.StatusCode != http.StatusNoContent { + bap, err = client.CreateOrUpdateResponder(bap.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsCreateOrUpdateFuture", "Result", bap.Response.Response, "Failure responding to request") + } + } + return +} + +// LoadBalancerBackendAddressPoolsDeleteFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type LoadBalancerBackendAddressPoolsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LoadBalancerBackendAddressPoolsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LoadBalancerBackendAddressPoolsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LoadBalancerBackendAddressPoolsDeleteFuture.Result. +func (future *LoadBalancerBackendAddressPoolsDeleteFuture) result(client LoadBalancerBackendAddressPoolsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LoadBalancerBackendAddressPoolsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// LoadBalancerBackendAddressPropertiesFormat properties of the load balancer backend addresses. +type LoadBalancerBackendAddressPropertiesFormat struct { + // VirtualNetwork - Reference to an existing virtual network. + VirtualNetwork *SubResource `json:"virtualNetwork,omitempty"` + // Subnet - Reference to an existing subnet. + Subnet *SubResource `json:"subnet,omitempty"` + // IPAddress - IP Address belonging to the referenced virtual network. + IPAddress *string `json:"ipAddress,omitempty"` + // NetworkInterfaceIPConfiguration - READ-ONLY; Reference to IP address defined in network interfaces. + NetworkInterfaceIPConfiguration *SubResource `json:"networkInterfaceIPConfiguration,omitempty"` + // LoadBalancerFrontendIPConfiguration - Reference to the frontend ip address configuration defined in regional loadbalancer. + LoadBalancerFrontendIPConfiguration *SubResource `json:"loadBalancerFrontendIPConfiguration,omitempty"` + // InboundNatRulesPortMapping - READ-ONLY; Collection of inbound NAT rule port mappings. + InboundNatRulesPortMapping *[]NatRulePortMapping `json:"inboundNatRulesPortMapping,omitempty"` + // AdminState - 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. Possible values include: 'LoadBalancerBackendAddressAdminStateNone', 'LoadBalancerBackendAddressAdminStateUp', 'LoadBalancerBackendAddressAdminStateDown', 'LoadBalancerBackendAddressAdminStateDrain' + AdminState LoadBalancerBackendAddressAdminState `json:"adminState,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerBackendAddressPropertiesFormat. +func (lbbapf LoadBalancerBackendAddressPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbbapf.VirtualNetwork != nil { + objectMap["virtualNetwork"] = lbbapf.VirtualNetwork + } + if lbbapf.Subnet != nil { + objectMap["subnet"] = lbbapf.Subnet + } + if lbbapf.IPAddress != nil { + objectMap["ipAddress"] = lbbapf.IPAddress + } + if lbbapf.LoadBalancerFrontendIPConfiguration != nil { + objectMap["loadBalancerFrontendIPConfiguration"] = lbbapf.LoadBalancerFrontendIPConfiguration + } + if lbbapf.AdminState != "" { + objectMap["adminState"] = lbbapf.AdminState + } + return json.Marshal(objectMap) +} + +// LoadBalancerFrontendIPConfigurationListResult response for ListFrontendIPConfiguration API service call. +type LoadBalancerFrontendIPConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - A list of frontend IP configurations in a load balancer. + Value *[]FrontendIPConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerFrontendIPConfigurationListResult. +func (lbficlr LoadBalancerFrontendIPConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbficlr.Value != nil { + objectMap["value"] = lbficlr.Value + } + return json.Marshal(objectMap) +} + +// LoadBalancerFrontendIPConfigurationListResultIterator provides access to a complete listing of +// FrontendIPConfiguration values. +type LoadBalancerFrontendIPConfigurationListResultIterator struct { + i int + page LoadBalancerFrontendIPConfigurationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LoadBalancerFrontendIPConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerFrontendIPConfigurationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LoadBalancerFrontendIPConfigurationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LoadBalancerFrontendIPConfigurationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LoadBalancerFrontendIPConfigurationListResultIterator) Response() LoadBalancerFrontendIPConfigurationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LoadBalancerFrontendIPConfigurationListResultIterator) Value() FrontendIPConfiguration { + if !iter.page.NotDone() { + return FrontendIPConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LoadBalancerFrontendIPConfigurationListResultIterator type. +func NewLoadBalancerFrontendIPConfigurationListResultIterator(page LoadBalancerFrontendIPConfigurationListResultPage) LoadBalancerFrontendIPConfigurationListResultIterator { + return LoadBalancerFrontendIPConfigurationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lbficlr LoadBalancerFrontendIPConfigurationListResult) IsEmpty() bool { + return lbficlr.Value == nil || len(*lbficlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lbficlr LoadBalancerFrontendIPConfigurationListResult) hasNextLink() bool { + return lbficlr.NextLink != nil && len(*lbficlr.NextLink) != 0 +} + +// loadBalancerFrontendIPConfigurationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lbficlr LoadBalancerFrontendIPConfigurationListResult) loadBalancerFrontendIPConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !lbficlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lbficlr.NextLink))) +} + +// LoadBalancerFrontendIPConfigurationListResultPage contains a page of FrontendIPConfiguration values. +type LoadBalancerFrontendIPConfigurationListResultPage struct { + fn func(context.Context, LoadBalancerFrontendIPConfigurationListResult) (LoadBalancerFrontendIPConfigurationListResult, error) + lbficlr LoadBalancerFrontendIPConfigurationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LoadBalancerFrontendIPConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerFrontendIPConfigurationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lbficlr) + if err != nil { + return err + } + page.lbficlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LoadBalancerFrontendIPConfigurationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LoadBalancerFrontendIPConfigurationListResultPage) NotDone() bool { + return !page.lbficlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LoadBalancerFrontendIPConfigurationListResultPage) Response() LoadBalancerFrontendIPConfigurationListResult { + return page.lbficlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LoadBalancerFrontendIPConfigurationListResultPage) Values() []FrontendIPConfiguration { + if page.lbficlr.IsEmpty() { + return nil + } + return *page.lbficlr.Value +} + +// Creates a new instance of the LoadBalancerFrontendIPConfigurationListResultPage type. +func NewLoadBalancerFrontendIPConfigurationListResultPage(cur LoadBalancerFrontendIPConfigurationListResult, getNextPage func(context.Context, LoadBalancerFrontendIPConfigurationListResult) (LoadBalancerFrontendIPConfigurationListResult, error)) LoadBalancerFrontendIPConfigurationListResultPage { + return LoadBalancerFrontendIPConfigurationListResultPage{ + fn: getNextPage, + lbficlr: cur, + } +} + +// LoadBalancerListResult response for ListLoadBalancers API service call. +type LoadBalancerListResult struct { + autorest.Response `json:"-"` + // Value - A list of load balancers in a resource group. + Value *[]LoadBalancer `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerListResult. +func (lblr LoadBalancerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lblr.Value != nil { + objectMap["value"] = lblr.Value + } + return json.Marshal(objectMap) +} + +// LoadBalancerListResultIterator provides access to a complete listing of LoadBalancer values. +type LoadBalancerListResultIterator struct { + i int + page LoadBalancerListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LoadBalancerListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LoadBalancerListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LoadBalancerListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LoadBalancerListResultIterator) Response() LoadBalancerListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LoadBalancerListResultIterator) Value() LoadBalancer { + if !iter.page.NotDone() { + return LoadBalancer{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LoadBalancerListResultIterator type. +func NewLoadBalancerListResultIterator(page LoadBalancerListResultPage) LoadBalancerListResultIterator { + return LoadBalancerListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lblr LoadBalancerListResult) IsEmpty() bool { + return lblr.Value == nil || len(*lblr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lblr LoadBalancerListResult) hasNextLink() bool { + return lblr.NextLink != nil && len(*lblr.NextLink) != 0 +} + +// loadBalancerListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lblr LoadBalancerListResult) loadBalancerListResultPreparer(ctx context.Context) (*http.Request, error) { + if !lblr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lblr.NextLink))) +} + +// LoadBalancerListResultPage contains a page of LoadBalancer values. +type LoadBalancerListResultPage struct { + fn func(context.Context, LoadBalancerListResult) (LoadBalancerListResult, error) + lblr LoadBalancerListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LoadBalancerListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lblr) + if err != nil { + return err + } + page.lblr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LoadBalancerListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LoadBalancerListResultPage) NotDone() bool { + return !page.lblr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LoadBalancerListResultPage) Response() LoadBalancerListResult { + return page.lblr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LoadBalancerListResultPage) Values() []LoadBalancer { + if page.lblr.IsEmpty() { + return nil + } + return *page.lblr.Value +} + +// Creates a new instance of the LoadBalancerListResultPage type. +func NewLoadBalancerListResultPage(cur LoadBalancerListResult, getNextPage func(context.Context, LoadBalancerListResult) (LoadBalancerListResult, error)) LoadBalancerListResultPage { + return LoadBalancerListResultPage{ + fn: getNextPage, + lblr: cur, + } +} + +// LoadBalancerLoadBalancingRuleListResult response for ListLoadBalancingRule API service call. +type LoadBalancerLoadBalancingRuleListResult struct { + autorest.Response `json:"-"` + // Value - A list of load balancing rules in a load balancer. + Value *[]LoadBalancingRule `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerLoadBalancingRuleListResult. +func (lblbrlr LoadBalancerLoadBalancingRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lblbrlr.Value != nil { + objectMap["value"] = lblbrlr.Value + } + return json.Marshal(objectMap) +} + +// LoadBalancerLoadBalancingRuleListResultIterator provides access to a complete listing of +// LoadBalancingRule values. +type LoadBalancerLoadBalancingRuleListResultIterator struct { + i int + page LoadBalancerLoadBalancingRuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LoadBalancerLoadBalancingRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerLoadBalancingRuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LoadBalancerLoadBalancingRuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LoadBalancerLoadBalancingRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LoadBalancerLoadBalancingRuleListResultIterator) Response() LoadBalancerLoadBalancingRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LoadBalancerLoadBalancingRuleListResultIterator) Value() LoadBalancingRule { + if !iter.page.NotDone() { + return LoadBalancingRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LoadBalancerLoadBalancingRuleListResultIterator type. +func NewLoadBalancerLoadBalancingRuleListResultIterator(page LoadBalancerLoadBalancingRuleListResultPage) LoadBalancerLoadBalancingRuleListResultIterator { + return LoadBalancerLoadBalancingRuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lblbrlr LoadBalancerLoadBalancingRuleListResult) IsEmpty() bool { + return lblbrlr.Value == nil || len(*lblbrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lblbrlr LoadBalancerLoadBalancingRuleListResult) hasNextLink() bool { + return lblbrlr.NextLink != nil && len(*lblbrlr.NextLink) != 0 +} + +// loadBalancerLoadBalancingRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lblbrlr LoadBalancerLoadBalancingRuleListResult) loadBalancerLoadBalancingRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !lblbrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lblbrlr.NextLink))) +} + +// LoadBalancerLoadBalancingRuleListResultPage contains a page of LoadBalancingRule values. +type LoadBalancerLoadBalancingRuleListResultPage struct { + fn func(context.Context, LoadBalancerLoadBalancingRuleListResult) (LoadBalancerLoadBalancingRuleListResult, error) + lblbrlr LoadBalancerLoadBalancingRuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LoadBalancerLoadBalancingRuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerLoadBalancingRuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lblbrlr) + if err != nil { + return err + } + page.lblbrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LoadBalancerLoadBalancingRuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LoadBalancerLoadBalancingRuleListResultPage) NotDone() bool { + return !page.lblbrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LoadBalancerLoadBalancingRuleListResultPage) Response() LoadBalancerLoadBalancingRuleListResult { + return page.lblbrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LoadBalancerLoadBalancingRuleListResultPage) Values() []LoadBalancingRule { + if page.lblbrlr.IsEmpty() { + return nil + } + return *page.lblbrlr.Value +} + +// Creates a new instance of the LoadBalancerLoadBalancingRuleListResultPage type. +func NewLoadBalancerLoadBalancingRuleListResultPage(cur LoadBalancerLoadBalancingRuleListResult, getNextPage func(context.Context, LoadBalancerLoadBalancingRuleListResult) (LoadBalancerLoadBalancingRuleListResult, error)) LoadBalancerLoadBalancingRuleListResultPage { + return LoadBalancerLoadBalancingRuleListResultPage{ + fn: getNextPage, + lblbrlr: cur, + } +} + +// LoadBalancerOutboundRuleListResult response for ListOutboundRule API service call. +type LoadBalancerOutboundRuleListResult struct { + autorest.Response `json:"-"` + // Value - A list of outbound rules in a load balancer. + Value *[]OutboundRule `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerOutboundRuleListResult. +func (lborlr LoadBalancerOutboundRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lborlr.Value != nil { + objectMap["value"] = lborlr.Value + } + return json.Marshal(objectMap) +} + +// LoadBalancerOutboundRuleListResultIterator provides access to a complete listing of OutboundRule values. +type LoadBalancerOutboundRuleListResultIterator struct { + i int + page LoadBalancerOutboundRuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LoadBalancerOutboundRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerOutboundRuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LoadBalancerOutboundRuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LoadBalancerOutboundRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LoadBalancerOutboundRuleListResultIterator) Response() LoadBalancerOutboundRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LoadBalancerOutboundRuleListResultIterator) Value() OutboundRule { + if !iter.page.NotDone() { + return OutboundRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LoadBalancerOutboundRuleListResultIterator type. +func NewLoadBalancerOutboundRuleListResultIterator(page LoadBalancerOutboundRuleListResultPage) LoadBalancerOutboundRuleListResultIterator { + return LoadBalancerOutboundRuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lborlr LoadBalancerOutboundRuleListResult) IsEmpty() bool { + return lborlr.Value == nil || len(*lborlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lborlr LoadBalancerOutboundRuleListResult) hasNextLink() bool { + return lborlr.NextLink != nil && len(*lborlr.NextLink) != 0 +} + +// loadBalancerOutboundRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lborlr LoadBalancerOutboundRuleListResult) loadBalancerOutboundRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !lborlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lborlr.NextLink))) +} + +// LoadBalancerOutboundRuleListResultPage contains a page of OutboundRule values. +type LoadBalancerOutboundRuleListResultPage struct { + fn func(context.Context, LoadBalancerOutboundRuleListResult) (LoadBalancerOutboundRuleListResult, error) + lborlr LoadBalancerOutboundRuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LoadBalancerOutboundRuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerOutboundRuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lborlr) + if err != nil { + return err + } + page.lborlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LoadBalancerOutboundRuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LoadBalancerOutboundRuleListResultPage) NotDone() bool { + return !page.lborlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LoadBalancerOutboundRuleListResultPage) Response() LoadBalancerOutboundRuleListResult { + return page.lborlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LoadBalancerOutboundRuleListResultPage) Values() []OutboundRule { + if page.lborlr.IsEmpty() { + return nil + } + return *page.lborlr.Value +} + +// Creates a new instance of the LoadBalancerOutboundRuleListResultPage type. +func NewLoadBalancerOutboundRuleListResultPage(cur LoadBalancerOutboundRuleListResult, getNextPage func(context.Context, LoadBalancerOutboundRuleListResult) (LoadBalancerOutboundRuleListResult, error)) LoadBalancerOutboundRuleListResultPage { + return LoadBalancerOutboundRuleListResultPage{ + fn: getNextPage, + lborlr: cur, + } +} + +// LoadBalancerProbeListResult response for ListProbe API service call. +type LoadBalancerProbeListResult struct { + autorest.Response `json:"-"` + // Value - A list of probes in a load balancer. + Value *[]Probe `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerProbeListResult. +func (lbplr LoadBalancerProbeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbplr.Value != nil { + objectMap["value"] = lbplr.Value + } + return json.Marshal(objectMap) +} + +// LoadBalancerProbeListResultIterator provides access to a complete listing of Probe values. +type LoadBalancerProbeListResultIterator struct { + i int + page LoadBalancerProbeListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LoadBalancerProbeListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerProbeListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LoadBalancerProbeListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LoadBalancerProbeListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LoadBalancerProbeListResultIterator) Response() LoadBalancerProbeListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LoadBalancerProbeListResultIterator) Value() Probe { + if !iter.page.NotDone() { + return Probe{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LoadBalancerProbeListResultIterator type. +func NewLoadBalancerProbeListResultIterator(page LoadBalancerProbeListResultPage) LoadBalancerProbeListResultIterator { + return LoadBalancerProbeListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lbplr LoadBalancerProbeListResult) IsEmpty() bool { + return lbplr.Value == nil || len(*lbplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lbplr LoadBalancerProbeListResult) hasNextLink() bool { + return lbplr.NextLink != nil && len(*lbplr.NextLink) != 0 +} + +// loadBalancerProbeListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lbplr LoadBalancerProbeListResult) loadBalancerProbeListResultPreparer(ctx context.Context) (*http.Request, error) { + if !lbplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lbplr.NextLink))) +} + +// LoadBalancerProbeListResultPage contains a page of Probe values. +type LoadBalancerProbeListResultPage struct { + fn func(context.Context, LoadBalancerProbeListResult) (LoadBalancerProbeListResult, error) + lbplr LoadBalancerProbeListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LoadBalancerProbeListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerProbeListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lbplr) + if err != nil { + return err + } + page.lbplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LoadBalancerProbeListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LoadBalancerProbeListResultPage) NotDone() bool { + return !page.lbplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LoadBalancerProbeListResultPage) Response() LoadBalancerProbeListResult { + return page.lbplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LoadBalancerProbeListResultPage) Values() []Probe { + if page.lbplr.IsEmpty() { + return nil + } + return *page.lbplr.Value +} + +// Creates a new instance of the LoadBalancerProbeListResultPage type. +func NewLoadBalancerProbeListResultPage(cur LoadBalancerProbeListResult, getNextPage func(context.Context, LoadBalancerProbeListResult) (LoadBalancerProbeListResult, error)) LoadBalancerProbeListResultPage { + return LoadBalancerProbeListResultPage{ + fn: getNextPage, + lbplr: cur, + } +} + +// LoadBalancerPropertiesFormat properties of the load balancer. +type LoadBalancerPropertiesFormat struct { + // FrontendIPConfigurations - Object representing the frontend IPs to be used for the load balancer. + FrontendIPConfigurations *[]FrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` + // BackendAddressPools - Collection of backend address pools used by a load balancer. + BackendAddressPools *[]BackendAddressPool `json:"backendAddressPools,omitempty"` + // LoadBalancingRules - Object collection representing the load balancing rules Gets the provisioning. + LoadBalancingRules *[]LoadBalancingRule `json:"loadBalancingRules,omitempty"` + // Probes - Collection of probe objects used in the load balancer. + Probes *[]Probe `json:"probes,omitempty"` + // InboundNatRules - 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. + InboundNatRules *[]InboundNatRule `json:"inboundNatRules,omitempty"` + // InboundNatPools - 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. + InboundNatPools *[]InboundNatPool `json:"inboundNatPools,omitempty"` + // OutboundRules - The outbound rules. + OutboundRules *[]OutboundRule `json:"outboundRules,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the load balancer resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the load balancer resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerPropertiesFormat. +func (lbpf LoadBalancerPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbpf.FrontendIPConfigurations != nil { + objectMap["frontendIPConfigurations"] = lbpf.FrontendIPConfigurations + } + if lbpf.BackendAddressPools != nil { + objectMap["backendAddressPools"] = lbpf.BackendAddressPools + } + if lbpf.LoadBalancingRules != nil { + objectMap["loadBalancingRules"] = lbpf.LoadBalancingRules + } + if lbpf.Probes != nil { + objectMap["probes"] = lbpf.Probes + } + if lbpf.InboundNatRules != nil { + objectMap["inboundNatRules"] = lbpf.InboundNatRules + } + if lbpf.InboundNatPools != nil { + objectMap["inboundNatPools"] = lbpf.InboundNatPools + } + if lbpf.OutboundRules != nil { + objectMap["outboundRules"] = lbpf.OutboundRules + } + return json.Marshal(objectMap) +} + +// LoadBalancerSku SKU of a load balancer. +type LoadBalancerSku struct { + // Name - Name of a load balancer SKU. Possible values include: 'LoadBalancerSkuNameBasic', 'LoadBalancerSkuNameStandard', 'LoadBalancerSkuNameGateway' + Name LoadBalancerSkuName `json:"name,omitempty"` + // Tier - Tier of a load balancer SKU. Possible values include: 'LoadBalancerSkuTierRegional', 'LoadBalancerSkuTierGlobal' + Tier LoadBalancerSkuTier `json:"tier,omitempty"` +} + +// LoadBalancerVipSwapRequest the request for a VIP swap. +type LoadBalancerVipSwapRequest struct { + // FrontendIPConfigurations - A list of frontend IP configuration resources that should swap VIPs. + FrontendIPConfigurations *[]LoadBalancerVipSwapRequestFrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` +} + +// LoadBalancerVipSwapRequestFrontendIPConfiguration VIP swap request's frontend IP configuration object. +type LoadBalancerVipSwapRequestFrontendIPConfiguration struct { + // ID - The ID of frontend IP configuration resource. + ID *string `json:"id,omitempty"` + // LoadBalancerVipSwapRequestFrontendIPConfigurationProperties - The properties of VIP swap request's frontend IP configuration object. + *LoadBalancerVipSwapRequestFrontendIPConfigurationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerVipSwapRequestFrontendIPConfiguration. +func (lbvsrfic LoadBalancerVipSwapRequestFrontendIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbvsrfic.ID != nil { + objectMap["id"] = lbvsrfic.ID + } + if lbvsrfic.LoadBalancerVipSwapRequestFrontendIPConfigurationProperties != nil { + objectMap["properties"] = lbvsrfic.LoadBalancerVipSwapRequestFrontendIPConfigurationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LoadBalancerVipSwapRequestFrontendIPConfiguration struct. +func (lbvsrfic *LoadBalancerVipSwapRequestFrontendIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lbvsrfic.ID = &ID + } + case "properties": + if v != nil { + var loadBalancerVipSwapRequestFrontendIPConfigurationProperties LoadBalancerVipSwapRequestFrontendIPConfigurationProperties + err = json.Unmarshal(*v, &loadBalancerVipSwapRequestFrontendIPConfigurationProperties) + if err != nil { + return err + } + lbvsrfic.LoadBalancerVipSwapRequestFrontendIPConfigurationProperties = &loadBalancerVipSwapRequestFrontendIPConfigurationProperties + } + } + } + + return nil +} + +// LoadBalancerVipSwapRequestFrontendIPConfigurationProperties the properties of VIP swap request's +// frontend IP configuration object. +type LoadBalancerVipSwapRequestFrontendIPConfigurationProperties struct { + // PublicIPAddress - A reference to public IP address resource. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` +} + +// LoadBalancersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LoadBalancersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LoadBalancersClient) (LoadBalancer, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LoadBalancersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LoadBalancersCreateOrUpdateFuture.Result. +func (future *LoadBalancersCreateOrUpdateFuture) result(client LoadBalancersClient) (lb LoadBalancer, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + lb.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LoadBalancersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if lb.Response.Response, err = future.GetResult(sender); err == nil && lb.Response.Response.StatusCode != http.StatusNoContent { + lb, err = client.CreateOrUpdateResponder(lb.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", lb.Response.Response, "Failure responding to request") + } + } + return +} + +// LoadBalancersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type LoadBalancersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LoadBalancersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LoadBalancersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LoadBalancersDeleteFuture.Result. +func (future *LoadBalancersDeleteFuture) result(client LoadBalancersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LoadBalancersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// LoadBalancersListInboundNatRulePortMappingsFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type LoadBalancersListInboundNatRulePortMappingsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LoadBalancersClient) (BackendAddressInboundNatRulePortMappings, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LoadBalancersListInboundNatRulePortMappingsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LoadBalancersListInboundNatRulePortMappingsFuture.Result. +func (future *LoadBalancersListInboundNatRulePortMappingsFuture) result(client LoadBalancersClient) (bainrpm BackendAddressInboundNatRulePortMappings, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersListInboundNatRulePortMappingsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bainrpm.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LoadBalancersListInboundNatRulePortMappingsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bainrpm.Response.Response, err = future.GetResult(sender); err == nil && bainrpm.Response.Response.StatusCode != http.StatusNoContent { + bainrpm, err = client.ListInboundNatRulePortMappingsResponder(bainrpm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersListInboundNatRulePortMappingsFuture", "Result", bainrpm.Response.Response, "Failure responding to request") + } + } + return +} + +// LoadBalancersSwapPublicIPAddressesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LoadBalancersSwapPublicIPAddressesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LoadBalancersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LoadBalancersSwapPublicIPAddressesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LoadBalancersSwapPublicIPAddressesFuture.Result. +func (future *LoadBalancersSwapPublicIPAddressesFuture) result(client LoadBalancersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersSwapPublicIPAddressesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LoadBalancersSwapPublicIPAddressesFuture") + return + } + ar.Response = future.Response() + return +} + +// LoadBalancingRule a load balancing rule for a load balancer. +type LoadBalancingRule struct { + autorest.Response `json:"-"` + // LoadBalancingRulePropertiesFormat - Properties of load balancer load balancing rule. + *LoadBalancingRulePropertiesFormat `json:"properties,omitempty"` + // Name - 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. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancingRule. +func (lbr LoadBalancingRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbr.LoadBalancingRulePropertiesFormat != nil { + objectMap["properties"] = lbr.LoadBalancingRulePropertiesFormat + } + if lbr.Name != nil { + objectMap["name"] = lbr.Name + } + if lbr.ID != nil { + objectMap["id"] = lbr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LoadBalancingRule struct. +func (lbr *LoadBalancingRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var loadBalancingRulePropertiesFormat LoadBalancingRulePropertiesFormat + err = json.Unmarshal(*v, &loadBalancingRulePropertiesFormat) + if err != nil { + return err + } + lbr.LoadBalancingRulePropertiesFormat = &loadBalancingRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lbr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lbr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lbr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lbr.ID = &ID + } + } + } + + return nil +} + +// LoadBalancingRulePropertiesFormat properties of the load balancer. +type LoadBalancingRulePropertiesFormat struct { + // FrontendIPConfiguration - A reference to frontend IP addresses. + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + // BackendAddressPool - A reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend IPs. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + // BackendAddressPools - An array of references to pool of DIPs. + BackendAddressPools *[]SubResource `json:"backendAddressPools,omitempty"` + // Probe - The reference to the load balancer probe used by the load balancing rule. + Probe *SubResource `json:"probe,omitempty"` + // Protocol - The reference to the transport protocol used by the load balancing rule. Possible values include: 'TransportProtocolUDP', 'TransportProtocolTCP', 'TransportProtocolAll' + Protocol TransportProtocol `json:"protocol,omitempty"` + // LoadDistribution - The load distribution policy for this rule. Possible values include: 'LoadDistributionDefault', 'LoadDistributionSourceIP', 'LoadDistributionSourceIPProtocol' + LoadDistribution LoadDistribution `json:"loadDistribution,omitempty"` + // FrontendPort - 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". + FrontendPort *int32 `json:"frontendPort,omitempty"` + // BackendPort - The port used for internal connections on the endpoint. Acceptable values are between 0 and 65535. Note that value 0 enables "Any Port". + BackendPort *int32 `json:"backendPort,omitempty"` + // IdleTimeoutInMinutes - 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. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // EnableFloatingIP - 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. + EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` + // EnableTCPReset - 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. + EnableTCPReset *bool `json:"enableTcpReset,omitempty"` + // DisableOutboundSnat - Configures SNAT for the VMs in the backend pool to use the publicIP address specified in the frontend of the load balancing rule. + DisableOutboundSnat *bool `json:"disableOutboundSnat,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the load balancing rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancingRulePropertiesFormat. +func (lbrpf LoadBalancingRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbrpf.FrontendIPConfiguration != nil { + objectMap["frontendIPConfiguration"] = lbrpf.FrontendIPConfiguration + } + if lbrpf.BackendAddressPool != nil { + objectMap["backendAddressPool"] = lbrpf.BackendAddressPool + } + if lbrpf.BackendAddressPools != nil { + objectMap["backendAddressPools"] = lbrpf.BackendAddressPools + } + if lbrpf.Probe != nil { + objectMap["probe"] = lbrpf.Probe + } + if lbrpf.Protocol != "" { + objectMap["protocol"] = lbrpf.Protocol + } + if lbrpf.LoadDistribution != "" { + objectMap["loadDistribution"] = lbrpf.LoadDistribution + } + if lbrpf.FrontendPort != nil { + objectMap["frontendPort"] = lbrpf.FrontendPort + } + if lbrpf.BackendPort != nil { + objectMap["backendPort"] = lbrpf.BackendPort + } + if lbrpf.IdleTimeoutInMinutes != nil { + objectMap["idleTimeoutInMinutes"] = lbrpf.IdleTimeoutInMinutes + } + if lbrpf.EnableFloatingIP != nil { + objectMap["enableFloatingIP"] = lbrpf.EnableFloatingIP + } + if lbrpf.EnableTCPReset != nil { + objectMap["enableTcpReset"] = lbrpf.EnableTCPReset + } + if lbrpf.DisableOutboundSnat != nil { + objectMap["disableOutboundSnat"] = lbrpf.DisableOutboundSnat + } + return json.Marshal(objectMap) +} + +// LocalNetworkGateway a common class for general resource information. +type LocalNetworkGateway struct { + autorest.Response `json:"-"` + // LocalNetworkGatewayPropertiesFormat - Properties of the local network gateway. + *LocalNetworkGatewayPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LocalNetworkGateway. +func (lng LocalNetworkGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lng.LocalNetworkGatewayPropertiesFormat != nil { + objectMap["properties"] = lng.LocalNetworkGatewayPropertiesFormat + } + if lng.ID != nil { + objectMap["id"] = lng.ID + } + if lng.Location != nil { + objectMap["location"] = lng.Location + } + if lng.Tags != nil { + objectMap["tags"] = lng.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LocalNetworkGateway struct. +func (lng *LocalNetworkGateway) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var localNetworkGatewayPropertiesFormat LocalNetworkGatewayPropertiesFormat + err = json.Unmarshal(*v, &localNetworkGatewayPropertiesFormat) + if err != nil { + return err + } + lng.LocalNetworkGatewayPropertiesFormat = &localNetworkGatewayPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lng.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lng.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lng.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lng.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lng.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lng.Tags = tags + } + } + } + + return nil +} + +// LocalNetworkGatewayListResult response for ListLocalNetworkGateways API service call. +type LocalNetworkGatewayListResult struct { + autorest.Response `json:"-"` + // Value - A list of local network gateways that exists in a resource group. + Value *[]LocalNetworkGateway `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LocalNetworkGatewayListResult. +func (lnglr LocalNetworkGatewayListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lnglr.Value != nil { + objectMap["value"] = lnglr.Value + } + return json.Marshal(objectMap) +} + +// LocalNetworkGatewayListResultIterator provides access to a complete listing of LocalNetworkGateway +// values. +type LocalNetworkGatewayListResultIterator struct { + i int + page LocalNetworkGatewayListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LocalNetworkGatewayListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewayListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LocalNetworkGatewayListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LocalNetworkGatewayListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LocalNetworkGatewayListResultIterator) Response() LocalNetworkGatewayListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LocalNetworkGatewayListResultIterator) Value() LocalNetworkGateway { + if !iter.page.NotDone() { + return LocalNetworkGateway{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LocalNetworkGatewayListResultIterator type. +func NewLocalNetworkGatewayListResultIterator(page LocalNetworkGatewayListResultPage) LocalNetworkGatewayListResultIterator { + return LocalNetworkGatewayListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lnglr LocalNetworkGatewayListResult) IsEmpty() bool { + return lnglr.Value == nil || len(*lnglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lnglr LocalNetworkGatewayListResult) hasNextLink() bool { + return lnglr.NextLink != nil && len(*lnglr.NextLink) != 0 +} + +// localNetworkGatewayListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lnglr LocalNetworkGatewayListResult) localNetworkGatewayListResultPreparer(ctx context.Context) (*http.Request, error) { + if !lnglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lnglr.NextLink))) +} + +// LocalNetworkGatewayListResultPage contains a page of LocalNetworkGateway values. +type LocalNetworkGatewayListResultPage struct { + fn func(context.Context, LocalNetworkGatewayListResult) (LocalNetworkGatewayListResult, error) + lnglr LocalNetworkGatewayListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LocalNetworkGatewayListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewayListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lnglr) + if err != nil { + return err + } + page.lnglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LocalNetworkGatewayListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LocalNetworkGatewayListResultPage) NotDone() bool { + return !page.lnglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LocalNetworkGatewayListResultPage) Response() LocalNetworkGatewayListResult { + return page.lnglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LocalNetworkGatewayListResultPage) Values() []LocalNetworkGateway { + if page.lnglr.IsEmpty() { + return nil + } + return *page.lnglr.Value +} + +// Creates a new instance of the LocalNetworkGatewayListResultPage type. +func NewLocalNetworkGatewayListResultPage(cur LocalNetworkGatewayListResult, getNextPage func(context.Context, LocalNetworkGatewayListResult) (LocalNetworkGatewayListResult, error)) LocalNetworkGatewayListResultPage { + return LocalNetworkGatewayListResultPage{ + fn: getNextPage, + lnglr: cur, + } +} + +// LocalNetworkGatewayPropertiesFormat localNetworkGateway properties. +type LocalNetworkGatewayPropertiesFormat struct { + // LocalNetworkAddressSpace - Local network site address space. + LocalNetworkAddressSpace *AddressSpace `json:"localNetworkAddressSpace,omitempty"` + // GatewayIPAddress - IP address of local network gateway. + GatewayIPAddress *string `json:"gatewayIpAddress,omitempty"` + // Fqdn - FQDN of local network gateway. + Fqdn *string `json:"fqdn,omitempty"` + // BgpSettings - Local network gateway's BGP speaker settings. + BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the local network gateway resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the local network gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for LocalNetworkGatewayPropertiesFormat. +func (lngpf LocalNetworkGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lngpf.LocalNetworkAddressSpace != nil { + objectMap["localNetworkAddressSpace"] = lngpf.LocalNetworkAddressSpace + } + if lngpf.GatewayIPAddress != nil { + objectMap["gatewayIpAddress"] = lngpf.GatewayIPAddress + } + if lngpf.Fqdn != nil { + objectMap["fqdn"] = lngpf.Fqdn + } + if lngpf.BgpSettings != nil { + objectMap["bgpSettings"] = lngpf.BgpSettings + } + return json.Marshal(objectMap) +} + +// LocalNetworkGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LocalNetworkGatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LocalNetworkGatewaysClient) (LocalNetworkGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LocalNetworkGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LocalNetworkGatewaysCreateOrUpdateFuture.Result. +func (future *LocalNetworkGatewaysCreateOrUpdateFuture) result(client LocalNetworkGatewaysClient) (lng LocalNetworkGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + lng.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if lng.Response.Response, err = future.GetResult(sender); err == nil && lng.Response.Response.StatusCode != http.StatusNoContent { + lng, err = client.CreateOrUpdateResponder(lng.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", lng.Response.Response, "Failure responding to request") + } + } + return +} + +// LocalNetworkGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LocalNetworkGatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LocalNetworkGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LocalNetworkGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LocalNetworkGatewaysDeleteFuture.Result. +func (future *LocalNetworkGatewaysDeleteFuture) result(client LocalNetworkGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// LogSpecification description of logging specification. +type LogSpecification struct { + // Name - The name of the specification. + Name *string `json:"name,omitempty"` + // DisplayName - The display name of the specification. + DisplayName *string `json:"displayName,omitempty"` + // BlobDuration - Duration of the blob. + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// ManagedRuleGroupOverride defines a managed rule group override setting. +type ManagedRuleGroupOverride struct { + // RuleGroupName - The managed rule group to override. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + // Rules - List of rules that will be disabled. If none specified, all rules in the group will be disabled. + Rules *[]ManagedRuleOverride `json:"rules,omitempty"` +} + +// ManagedRuleOverride defines a managed rule group override setting. +type ManagedRuleOverride struct { + // RuleID - Identifier for the managed rule. + RuleID *string `json:"ruleId,omitempty"` + // State - The state of the managed rule. Defaults to Disabled if not specified. Possible values include: 'ManagedRuleEnabledStateDisabled', 'ManagedRuleEnabledStateEnabled' + State ManagedRuleEnabledState `json:"state,omitempty"` + // Action - Describes the override action to be applied when rule matches. Possible values include: 'ActionTypeAnomalyScoring', 'ActionTypeAllow', 'ActionTypeBlock', 'ActionTypeLog' + Action ActionType `json:"action,omitempty"` +} + +// ManagedRuleSet defines a managed rule set. +type ManagedRuleSet struct { + // RuleSetType - Defines the rule set type to use. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - Defines the version of the rule set to use. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + // RuleGroupOverrides - Defines the rule group overrides to apply to the rule set. + RuleGroupOverrides *[]ManagedRuleGroupOverride `json:"ruleGroupOverrides,omitempty"` +} + +// ManagedRulesDefinition allow to exclude some variable satisfy the condition for the WAF check. +type ManagedRulesDefinition struct { + // Exclusions - The Exclusions that are applied on the policy. + Exclusions *[]OwaspCrsExclusionEntry `json:"exclusions,omitempty"` + // ManagedRuleSets - The managed rule sets that are associated with the policy. + ManagedRuleSets *[]ManagedRuleSet `json:"managedRuleSets,omitempty"` +} + +// ManagedServiceIdentity identity for the resource. +type ManagedServiceIdentity struct { + // PrincipalID - READ-ONLY; The principal id of the system assigned identity. This property will only be provided for a system assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty"` + // Type - 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. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - 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}'. + UserAssignedIdentities map[string]*ManagedServiceIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ManagedServiceIdentity. +func (msi ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if msi.Type != "" { + objectMap["type"] = msi.Type + } + if msi.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = msi.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// ManagedServiceIdentityUserAssignedIdentitiesValue ... +type ManagedServiceIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedServiceIdentityUserAssignedIdentitiesValue. +func (msiAiv ManagedServiceIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Manager the Managed Network resource +type Manager struct { + autorest.Response `json:"-"` + // ManagerProperties - The network manager properties + *ManagerProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // SystemData - READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Manager. +func (mVar Manager) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mVar.ManagerProperties != nil { + objectMap["properties"] = mVar.ManagerProperties + } + if mVar.ID != nil { + objectMap["id"] = mVar.ID + } + if mVar.Location != nil { + objectMap["location"] = mVar.Location + } + if mVar.Tags != nil { + objectMap["tags"] = mVar.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Manager struct. +func (mVar *Manager) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managerProperties ManagerProperties + err = json.Unmarshal(*v, &managerProperties) + if err != nil { + return err + } + mVar.ManagerProperties = &managerProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mVar.Etag = &etag + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mVar.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mVar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mVar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mVar.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mVar.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mVar.Tags = tags + } + } + } + + return nil +} + +// ManagerCommit network Manager Commit. +type ManagerCommit struct { + autorest.Response `json:"-"` + // CommitID - READ-ONLY; Commit Id. + CommitID *string `json:"commitId,omitempty"` + // TargetLocations - List of target locations. + TargetLocations *[]string `json:"targetLocations,omitempty"` + // ConfigurationIds - List of configuration ids. + ConfigurationIds *[]string `json:"configurationIds,omitempty"` + // CommitType - Commit Type. Possible values include: 'ConfigurationTypeSecurityAdmin', 'ConfigurationTypeConnectivity' + CommitType ConfigurationType `json:"commitType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagerCommit. +func (mc ManagerCommit) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mc.TargetLocations != nil { + objectMap["targetLocations"] = mc.TargetLocations + } + if mc.ConfigurationIds != nil { + objectMap["configurationIds"] = mc.ConfigurationIds + } + if mc.CommitType != "" { + objectMap["commitType"] = mc.CommitType + } + return json.Marshal(objectMap) +} + +// ManagerCommitsPostFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagerCommitsPostFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagerCommitsClient) (ManagerCommit, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagerCommitsPostFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagerCommitsPostFuture.Result. +func (future *ManagerCommitsPostFuture) result(client ManagerCommitsClient) (mc ManagerCommit, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ManagerCommitsPostFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ManagerCommitsPostFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mc.Response.Response, err = future.GetResult(sender); err == nil && mc.Response.Response.StatusCode != http.StatusNoContent { + mc, err = client.PostResponder(mc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ManagerCommitsPostFuture", "Result", mc.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagerConnection the Network Manager Connection resource +type ManagerConnection struct { + autorest.Response `json:"-"` + // ManagerConnectionProperties - The scope connection properties + *ManagerConnectionProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagerConnection. +func (mc ManagerConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mc.ManagerConnectionProperties != nil { + objectMap["properties"] = mc.ManagerConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagerConnection struct. +func (mc *ManagerConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managerConnectionProperties ManagerConnectionProperties + err = json.Unmarshal(*v, &managerConnectionProperties) + if err != nil { + return err + } + mc.ManagerConnectionProperties = &managerConnectionProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mc.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mc.Etag = &etag + } + } + } + + return nil +} + +// ManagerConnectionListResult list of network manager connections. +type ManagerConnectionListResult struct { + autorest.Response `json:"-"` + // Value - List of network manager connections. + Value *[]ManagerConnection `json:"value,omitempty"` + // NextLink - Gets the URL to get the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ManagerConnectionListResultIterator provides access to a complete listing of ManagerConnection values. +type ManagerConnectionListResultIterator struct { + i int + page ManagerConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagerConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagerConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagerConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagerConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagerConnectionListResultIterator) Response() ManagerConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagerConnectionListResultIterator) Value() ManagerConnection { + if !iter.page.NotDone() { + return ManagerConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagerConnectionListResultIterator type. +func NewManagerConnectionListResultIterator(page ManagerConnectionListResultPage) ManagerConnectionListResultIterator { + return ManagerConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mclr ManagerConnectionListResult) IsEmpty() bool { + return mclr.Value == nil || len(*mclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mclr ManagerConnectionListResult) hasNextLink() bool { + return mclr.NextLink != nil && len(*mclr.NextLink) != 0 +} + +// managerConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mclr ManagerConnectionListResult) managerConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mclr.NextLink))) +} + +// ManagerConnectionListResultPage contains a page of ManagerConnection values. +type ManagerConnectionListResultPage struct { + fn func(context.Context, ManagerConnectionListResult) (ManagerConnectionListResult, error) + mclr ManagerConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagerConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagerConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mclr) + if err != nil { + return err + } + page.mclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagerConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagerConnectionListResultPage) NotDone() bool { + return !page.mclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagerConnectionListResultPage) Response() ManagerConnectionListResult { + return page.mclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagerConnectionListResultPage) Values() []ManagerConnection { + if page.mclr.IsEmpty() { + return nil + } + return *page.mclr.Value +} + +// Creates a new instance of the ManagerConnectionListResultPage type. +func NewManagerConnectionListResultPage(cur ManagerConnectionListResult, getNextPage func(context.Context, ManagerConnectionListResult) (ManagerConnectionListResult, error)) ManagerConnectionListResultPage { + return ManagerConnectionListResultPage{ + fn: getNextPage, + mclr: cur, + } +} + +// ManagerConnectionProperties information about the network manager connection. +type ManagerConnectionProperties struct { + // NetworkManagerID - Network Manager Id. + NetworkManagerID *string `json:"networkManagerId,omitempty"` + // ConnectionState - Connection state. Possible values include: 'ScopeConnectionStateConnected', 'ScopeConnectionStatePending', 'ScopeConnectionStateConflict', 'ScopeConnectionStateRevoked', 'ScopeConnectionStateRejected' + ConnectionState ScopeConnectionState `json:"connectionState,omitempty"` + // Description - A description of the network manager connection. + Description *string `json:"description,omitempty"` +} + +// ManagerDeploymentStatus network Manager Deployment Status. +type ManagerDeploymentStatus struct { + // CommitTime - Commit Time. + CommitTime *date.Time `json:"commitTime,omitempty"` + // Region - Region Name. + Region *string `json:"region,omitempty"` + // DeploymentStatus - Deployment Status. Possible values include: 'DeploymentStatusNotStarted', 'DeploymentStatusDeploying', 'DeploymentStatusDeployed', 'DeploymentStatusFailed' + DeploymentStatus DeploymentStatus `json:"deploymentStatus,omitempty"` + // ConfigurationIds - List of configuration ids. + ConfigurationIds *[]string `json:"configurationIds,omitempty"` + // DeploymentType - Possible values include: 'ConfigurationTypeSecurityAdmin', 'ConfigurationTypeConnectivity' + DeploymentType ConfigurationType `json:"deploymentType,omitempty"` + // ErrorMessage - Error Message. + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// ManagerDeploymentStatusListResult a list of Network Manager Deployment Status +type ManagerDeploymentStatusListResult struct { + autorest.Response `json:"-"` + // Value - Gets a page of Network Manager Deployment Status + Value *[]ManagerDeploymentStatus `json:"value,omitempty"` + // SkipToken - When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. + SkipToken *string `json:"skipToken,omitempty"` +} + +// ManagerDeploymentStatusParameter network Manager Deployment Status Parameter. +type ManagerDeploymentStatusParameter struct { + // Regions - List of locations. + Regions *[]string `json:"regions,omitempty"` + // DeploymentTypes - List of deployment types. + DeploymentTypes *[]ConfigurationType `json:"deploymentTypes,omitempty"` + // SkipToken - Continuation token for pagination, capturing the next page size and offset, as well as the context of the query. + SkipToken *string `json:"skipToken,omitempty"` +} + +// ManagerEffectiveConnectivityConfigurationListResult result of the request to list +// networkManagerEffectiveConnectivityConfiguration. It contains a list of groups and a skiptoken to get +// the next set of results. +type ManagerEffectiveConnectivityConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - Gets a page of NetworkManagerEffectiveConnectivityConfiguration + Value *[]EffectiveConnectivityConfiguration `json:"value,omitempty"` + // SkipToken - When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. + SkipToken *string `json:"skipToken,omitempty"` +} + +// ManagerEffectiveSecurityAdminRulesListResult result of the request to list +// networkManagerEffectiveSecurityAdminRules. It contains a list of groups and a skiptoken to get the next +// set of results. +type ManagerEffectiveSecurityAdminRulesListResult struct { + autorest.Response `json:"-"` + // Value - Gets a page of NetworkManagerEffectiveSecurityAdminRules + Value *[]BasicEffectiveBaseSecurityAdminRule `json:"value,omitempty"` + // SkipToken - When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. + SkipToken *string `json:"skipToken,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ManagerEffectiveSecurityAdminRulesListResult struct. +func (mesarlr *ManagerEffectiveSecurityAdminRulesListResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "value": + if v != nil { + value, err := unmarshalBasicEffectiveBaseSecurityAdminRuleArray(*v) + if err != nil { + return err + } + mesarlr.Value = &value + } + case "skipToken": + if v != nil { + var skipToken string + err = json.Unmarshal(*v, &skipToken) + if err != nil { + return err + } + mesarlr.SkipToken = &skipToken + } + } + } + + return nil +} + +// ManagerListResult result of the request to list NetworkManager. It contains a list of network managers +// and a URL link to get the next set of results. +type ManagerListResult struct { + autorest.Response `json:"-"` + // Value - Gets a page of NetworkManager + Value *[]Manager `json:"value,omitempty"` + // NextLink - Gets the URL to get the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ManagerListResultIterator provides access to a complete listing of Manager values. +type ManagerListResultIterator struct { + i int + page ManagerListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagerListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagerListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagerListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagerListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagerListResultIterator) Response() ManagerListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagerListResultIterator) Value() Manager { + if !iter.page.NotDone() { + return Manager{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagerListResultIterator type. +func NewManagerListResultIterator(page ManagerListResultPage) ManagerListResultIterator { + return ManagerListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mlr ManagerListResult) IsEmpty() bool { + return mlr.Value == nil || len(*mlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mlr ManagerListResult) hasNextLink() bool { + return mlr.NextLink != nil && len(*mlr.NextLink) != 0 +} + +// managerListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mlr ManagerListResult) managerListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mlr.NextLink))) +} + +// ManagerListResultPage contains a page of Manager values. +type ManagerListResultPage struct { + fn func(context.Context, ManagerListResult) (ManagerListResult, error) + mlr ManagerListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagerListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagerListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mlr) + if err != nil { + return err + } + page.mlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagerListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagerListResultPage) NotDone() bool { + return !page.mlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagerListResultPage) Response() ManagerListResult { + return page.mlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagerListResultPage) Values() []Manager { + if page.mlr.IsEmpty() { + return nil + } + return *page.mlr.Value +} + +// Creates a new instance of the ManagerListResultPage type. +func NewManagerListResultPage(cur ManagerListResult, getNextPage func(context.Context, ManagerListResult) (ManagerListResult, error)) ManagerListResultPage { + return ManagerListResultPage{ + fn: getNextPage, + mlr: cur, + } +} + +// ManagerProperties properties of Managed Network +type ManagerProperties struct { + // Description - A description of the network manager. + Description *string `json:"description,omitempty"` + // NetworkManagerScopes - Scope of Network Manager. + NetworkManagerScopes *ManagerPropertiesNetworkManagerScopes `json:"networkManagerScopes,omitempty"` + // NetworkManagerScopeAccesses - Scope Access. + NetworkManagerScopeAccesses *[]ConfigurationType `json:"networkManagerScopeAccesses,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the network manager resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagerProperties. +func (mp ManagerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mp.Description != nil { + objectMap["description"] = mp.Description + } + if mp.NetworkManagerScopes != nil { + objectMap["networkManagerScopes"] = mp.NetworkManagerScopes + } + if mp.NetworkManagerScopeAccesses != nil { + objectMap["networkManagerScopeAccesses"] = mp.NetworkManagerScopeAccesses + } + return json.Marshal(objectMap) +} + +// ManagerPropertiesNetworkManagerScopes scope of Network Manager. +type ManagerPropertiesNetworkManagerScopes struct { + // ManagementGroups - List of management groups. + ManagementGroups *[]string `json:"managementGroups,omitempty"` + // Subscriptions - List of subscriptions. + Subscriptions *[]string `json:"subscriptions,omitempty"` + // CrossTenantScopes - READ-ONLY; List of cross tenant scopes. + CrossTenantScopes *[]CrossTenantScopes `json:"crossTenantScopes,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagerPropertiesNetworkManagerScopes. +func (mpMs ManagerPropertiesNetworkManagerScopes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mpMs.ManagementGroups != nil { + objectMap["managementGroups"] = mpMs.ManagementGroups + } + if mpMs.Subscriptions != nil { + objectMap["subscriptions"] = mpMs.Subscriptions + } + return json.Marshal(objectMap) +} + +// ManagerSecurityGroupItem network manager security group item. +type ManagerSecurityGroupItem struct { + // NetworkGroupID - Network manager group Id. + NetworkGroupID *string `json:"networkGroupId,omitempty"` +} + +// ManagersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagersDeleteFuture.Result. +func (future *ManagersDeleteFuture) result(client ManagersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ManagersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ManagersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// MatchCondition define match conditions. +type MatchCondition struct { + // MatchVariables - List of match variables. + MatchVariables *[]MatchVariable `json:"matchVariables,omitempty"` + // Operator - The operator to be matched. Possible values include: 'WebApplicationFirewallOperatorIPMatch', 'WebApplicationFirewallOperatorEqual', 'WebApplicationFirewallOperatorContains', 'WebApplicationFirewallOperatorLessThan', 'WebApplicationFirewallOperatorGreaterThan', 'WebApplicationFirewallOperatorLessThanOrEqual', 'WebApplicationFirewallOperatorGreaterThanOrEqual', 'WebApplicationFirewallOperatorBeginsWith', 'WebApplicationFirewallOperatorEndsWith', 'WebApplicationFirewallOperatorRegex', 'WebApplicationFirewallOperatorGeoMatch', 'WebApplicationFirewallOperatorAny' + Operator WebApplicationFirewallOperator `json:"operator,omitempty"` + // NegationConditon - Whether this is negate condition or not. + NegationConditon *bool `json:"negationConditon,omitempty"` + // MatchValues - Match value. + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms. + Transforms *[]WebApplicationFirewallTransform `json:"transforms,omitempty"` +} + +// MatchVariable define match variables. +type MatchVariable struct { + // VariableName - Match Variable. Possible values include: 'WebApplicationFirewallMatchVariableRemoteAddr', 'WebApplicationFirewallMatchVariableRequestMethod', 'WebApplicationFirewallMatchVariableQueryString', 'WebApplicationFirewallMatchVariablePostArgs', 'WebApplicationFirewallMatchVariableRequestURI', 'WebApplicationFirewallMatchVariableRequestHeaders', 'WebApplicationFirewallMatchVariableRequestBody', 'WebApplicationFirewallMatchVariableRequestCookies' + VariableName WebApplicationFirewallMatchVariable `json:"variableName,omitempty"` + // Selector - The selector of match variable. + Selector *string `json:"selector,omitempty"` +} + +// MatchedRule matched rule. +type MatchedRule struct { + // RuleName - Name of the matched network security rule. + RuleName *string `json:"ruleName,omitempty"` + // Action - The network traffic is allowed or denied. Possible values are 'Allow' and 'Deny'. + Action *string `json:"action,omitempty"` +} + +// MetricSpecification description of metrics specification. +type MetricSpecification struct { + // Name - The name of the metric. + Name *string `json:"name,omitempty"` + // DisplayName - The display name of the metric. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - The description of the metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - Units the metric to be displayed in. + Unit *string `json:"unit,omitempty"` + // AggregationType - The aggregation type. + AggregationType *string `json:"aggregationType,omitempty"` + // Availabilities - List of availability. + Availabilities *[]Availability `json:"availabilities,omitempty"` + // EnableRegionalMdmAccount - Whether regional MDM account enabled. + EnableRegionalMdmAccount *bool `json:"enableRegionalMdmAccount,omitempty"` + // FillGapWithZero - Whether gaps would be filled with zeros. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // MetricFilterPattern - Pattern for the filter of the metric. + MetricFilterPattern *string `json:"metricFilterPattern,omitempty"` + // Dimensions - List of dimensions. + Dimensions *[]Dimension `json:"dimensions,omitempty"` + // IsInternal - Whether the metric is internal. + IsInternal *bool `json:"isInternal,omitempty"` + // SourceMdmAccount - The source MDM account. + SourceMdmAccount *string `json:"sourceMdmAccount,omitempty"` + // SourceMdmNamespace - The source MDM namespace. + SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` + // ResourceIDDimensionNameOverride - The resource Id dimension name override. + ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` +} + +// NatGateway nat Gateway resource. +type NatGateway struct { + autorest.Response `json:"-"` + // Sku - The nat gateway SKU. + Sku *NatGatewaySku `json:"sku,omitempty"` + // NatGatewayPropertiesFormat - Nat Gateway properties. + *NatGatewayPropertiesFormat `json:"properties,omitempty"` + // Zones - A list of availability zones denoting the zone in which Nat Gateway should be deployed. + Zones *[]string `json:"zones,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for NatGateway. +func (ng NatGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ng.Sku != nil { + objectMap["sku"] = ng.Sku + } + if ng.NatGatewayPropertiesFormat != nil { + objectMap["properties"] = ng.NatGatewayPropertiesFormat + } + if ng.Zones != nil { + objectMap["zones"] = ng.Zones + } + if ng.ID != nil { + objectMap["id"] = ng.ID + } + if ng.Location != nil { + objectMap["location"] = ng.Location + } + if ng.Tags != nil { + objectMap["tags"] = ng.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for NatGateway struct. +func (ng *NatGateway) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku NatGatewaySku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + ng.Sku = &sku + } + case "properties": + if v != nil { + var natGatewayPropertiesFormat NatGatewayPropertiesFormat + err = json.Unmarshal(*v, &natGatewayPropertiesFormat) + if err != nil { + return err + } + ng.NatGatewayPropertiesFormat = &natGatewayPropertiesFormat + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + ng.Zones = &zones + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ng.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ng.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ng.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ng.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ng.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ng.Tags = tags + } + } + } + + return nil +} + +// NatGatewayListResult response for ListNatGateways API service call. +type NatGatewayListResult struct { + autorest.Response `json:"-"` + // Value - A list of Nat Gateways that exists in a resource group. + Value *[]NatGateway `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// NatGatewayListResultIterator provides access to a complete listing of NatGateway values. +type NatGatewayListResultIterator struct { + i int + page NatGatewayListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *NatGatewayListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatGatewayListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *NatGatewayListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter NatGatewayListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter NatGatewayListResultIterator) Response() NatGatewayListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter NatGatewayListResultIterator) Value() NatGateway { + if !iter.page.NotDone() { + return NatGateway{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the NatGatewayListResultIterator type. +func NewNatGatewayListResultIterator(page NatGatewayListResultPage) NatGatewayListResultIterator { + return NatGatewayListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (nglr NatGatewayListResult) IsEmpty() bool { + return nglr.Value == nil || len(*nglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (nglr NatGatewayListResult) hasNextLink() bool { + return nglr.NextLink != nil && len(*nglr.NextLink) != 0 +} + +// natGatewayListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (nglr NatGatewayListResult) natGatewayListResultPreparer(ctx context.Context) (*http.Request, error) { + if !nglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(nglr.NextLink))) +} + +// NatGatewayListResultPage contains a page of NatGateway values. +type NatGatewayListResultPage struct { + fn func(context.Context, NatGatewayListResult) (NatGatewayListResult, error) + nglr NatGatewayListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *NatGatewayListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatGatewayListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.nglr) + if err != nil { + return err + } + page.nglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *NatGatewayListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page NatGatewayListResultPage) NotDone() bool { + return !page.nglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page NatGatewayListResultPage) Response() NatGatewayListResult { + return page.nglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page NatGatewayListResultPage) Values() []NatGateway { + if page.nglr.IsEmpty() { + return nil + } + return *page.nglr.Value +} + +// Creates a new instance of the NatGatewayListResultPage type. +func NewNatGatewayListResultPage(cur NatGatewayListResult, getNextPage func(context.Context, NatGatewayListResult) (NatGatewayListResult, error)) NatGatewayListResultPage { + return NatGatewayListResultPage{ + fn: getNextPage, + nglr: cur, + } +} + +// NatGatewayPropertiesFormat nat Gateway properties. +type NatGatewayPropertiesFormat struct { + // IdleTimeoutInMinutes - The idle timeout of the nat gateway. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // PublicIPAddresses - An array of public ip addresses associated with the nat gateway resource. + PublicIPAddresses *[]SubResource `json:"publicIpAddresses,omitempty"` + // PublicIPPrefixes - An array of public ip prefixes associated with the nat gateway resource. + PublicIPPrefixes *[]SubResource `json:"publicIpPrefixes,omitempty"` + // Subnets - READ-ONLY; An array of references to the subnets using this nat gateway resource. + Subnets *[]SubResource `json:"subnets,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the NAT gateway resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the NAT gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for NatGatewayPropertiesFormat. +func (ngpf NatGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ngpf.IdleTimeoutInMinutes != nil { + objectMap["idleTimeoutInMinutes"] = ngpf.IdleTimeoutInMinutes + } + if ngpf.PublicIPAddresses != nil { + objectMap["publicIpAddresses"] = ngpf.PublicIPAddresses + } + if ngpf.PublicIPPrefixes != nil { + objectMap["publicIpPrefixes"] = ngpf.PublicIPPrefixes + } + return json.Marshal(objectMap) +} + +// NatGatewaySku SKU of nat gateway. +type NatGatewaySku struct { + // Name - Name of Nat Gateway SKU. Possible values include: 'NatGatewaySkuNameStandard' + Name NatGatewaySkuName `json:"name,omitempty"` +} + +// NatGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type NatGatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(NatGatewaysClient) (NatGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *NatGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for NatGatewaysCreateOrUpdateFuture.Result. +func (future *NatGatewaysCreateOrUpdateFuture) result(client NatGatewaysClient) (ng NatGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ng.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.NatGatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ng.Response.Response, err = future.GetResult(sender); err == nil && ng.Response.Response.StatusCode != http.StatusNoContent { + ng, err = client.CreateOrUpdateResponder(ng.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysCreateOrUpdateFuture", "Result", ng.Response.Response, "Failure responding to request") + } + } + return +} + +// NatGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type NatGatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(NatGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *NatGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for NatGatewaysDeleteFuture.Result. +func (future *NatGatewaysDeleteFuture) result(client NatGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.NatGatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// NatRule rule of type nat. +type NatRule struct { + // IPProtocols - Array of FirewallPolicyRuleNetworkProtocols. + IPProtocols *[]FirewallPolicyRuleNetworkProtocol `json:"ipProtocols,omitempty"` + // SourceAddresses - List of source IP addresses for this rule. + SourceAddresses *[]string `json:"sourceAddresses,omitempty"` + // DestinationAddresses - List of destination IP addresses or Service Tags. + DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` + // DestinationPorts - List of destination ports. + DestinationPorts *[]string `json:"destinationPorts,omitempty"` + // TranslatedAddress - The translated address for this NAT rule. + TranslatedAddress *string `json:"translatedAddress,omitempty"` + // TranslatedPort - The translated port for this NAT rule. + TranslatedPort *string `json:"translatedPort,omitempty"` + // SourceIPGroups - List of source IpGroups for this rule. + SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` + // TranslatedFqdn - The translated FQDN for this NAT rule. + TranslatedFqdn *string `json:"translatedFqdn,omitempty"` + // Name - Name of the rule. + Name *string `json:"name,omitempty"` + // Description - Description of the rule. + Description *string `json:"description,omitempty"` + // RuleType - Possible values include: 'RuleTypeFirewallPolicyRule', 'RuleTypeApplicationRule', 'RuleTypeNatRule', 'RuleTypeNetworkRule' + RuleType RuleType `json:"ruleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NatRule. +func (nr NatRule) MarshalJSON() ([]byte, error) { + nr.RuleType = RuleTypeNatRule + objectMap := make(map[string]interface{}) + if nr.IPProtocols != nil { + objectMap["ipProtocols"] = nr.IPProtocols + } + if nr.SourceAddresses != nil { + objectMap["sourceAddresses"] = nr.SourceAddresses + } + if nr.DestinationAddresses != nil { + objectMap["destinationAddresses"] = nr.DestinationAddresses + } + if nr.DestinationPorts != nil { + objectMap["destinationPorts"] = nr.DestinationPorts + } + if nr.TranslatedAddress != nil { + objectMap["translatedAddress"] = nr.TranslatedAddress + } + if nr.TranslatedPort != nil { + objectMap["translatedPort"] = nr.TranslatedPort + } + if nr.SourceIPGroups != nil { + objectMap["sourceIpGroups"] = nr.SourceIPGroups + } + if nr.TranslatedFqdn != nil { + objectMap["translatedFqdn"] = nr.TranslatedFqdn + } + if nr.Name != nil { + objectMap["name"] = nr.Name + } + if nr.Description != nil { + objectMap["description"] = nr.Description + } + if nr.RuleType != "" { + objectMap["ruleType"] = nr.RuleType + } + return json.Marshal(objectMap) +} + +// AsApplicationRule is the BasicFirewallPolicyRule implementation for NatRule. +func (nr NatRule) AsApplicationRule() (*ApplicationRule, bool) { + return nil, false +} + +// AsNatRule is the BasicFirewallPolicyRule implementation for NatRule. +func (nr NatRule) AsNatRule() (*NatRule, bool) { + return &nr, true +} + +// AsRule is the BasicFirewallPolicyRule implementation for NatRule. +func (nr NatRule) AsRule() (*Rule, bool) { + return nil, false +} + +// AsFirewallPolicyRule is the BasicFirewallPolicyRule implementation for NatRule. +func (nr NatRule) AsFirewallPolicyRule() (*FirewallPolicyRule, bool) { + return nil, false +} + +// AsBasicFirewallPolicyRule is the BasicFirewallPolicyRule implementation for NatRule. +func (nr NatRule) AsBasicFirewallPolicyRule() (BasicFirewallPolicyRule, bool) { + return &nr, true +} + +// NatRulePortMapping individual port mappings for inbound NAT rule created for backend pool. +type NatRulePortMapping struct { + // InboundNatRuleName - Name of inbound NAT rule. + InboundNatRuleName *string `json:"inboundNatRuleName,omitempty"` + // FrontendPort - Frontend port. + FrontendPort *int32 `json:"frontendPort,omitempty"` + // BackendPort - Backend port. + BackendPort *int32 `json:"backendPort,omitempty"` +} + +// NatRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type NatRulesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(NatRulesClient) (VpnGatewayNatRule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *NatRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for NatRulesCreateOrUpdateFuture.Result. +func (future *NatRulesCreateOrUpdateFuture) result(client NatRulesClient) (vgnr VpnGatewayNatRule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vgnr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.NatRulesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vgnr.Response.Response, err = future.GetResult(sender); err == nil && vgnr.Response.Response.StatusCode != http.StatusNoContent { + vgnr, err = client.CreateOrUpdateResponder(vgnr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatRulesCreateOrUpdateFuture", "Result", vgnr.Response.Response, "Failure responding to request") + } + } + return +} + +// NatRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type NatRulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(NatRulesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *NatRulesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for NatRulesDeleteFuture.Result. +func (future *NatRulesDeleteFuture) result(client NatRulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatRulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.NatRulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// NextHopParameters parameters that define the source and destination endpoint. +type NextHopParameters struct { + // TargetResourceID - The resource identifier of the target resource against which the action is to be performed. + TargetResourceID *string `json:"targetResourceId,omitempty"` + // SourceIPAddress - The source IP address. + SourceIPAddress *string `json:"sourceIPAddress,omitempty"` + // DestinationIPAddress - The destination IP address. + DestinationIPAddress *string `json:"destinationIPAddress,omitempty"` + // TargetNicResourceID - 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). + TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` +} + +// NextHopResult the information about next hop from the specified VM. +type NextHopResult struct { + autorest.Response `json:"-"` + // NextHopType - Next hop type. Possible values include: 'NextHopTypeInternet', 'NextHopTypeVirtualAppliance', 'NextHopTypeVirtualNetworkGateway', 'NextHopTypeVnetLocal', 'NextHopTypeHyperNetGateway', 'NextHopTypeNone' + NextHopType NextHopType `json:"nextHopType,omitempty"` + // NextHopIPAddress - Next hop IP Address. + NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` + // RouteTableID - 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'. + RouteTableID *string `json:"routeTableId,omitempty"` +} + +// O365BreakOutCategoryPolicies office365 breakout categories. +type O365BreakOutCategoryPolicies struct { + // Allow - Flag to control allow category. + Allow *bool `json:"allow,omitempty"` + // Optimize - Flag to control optimize category. + Optimize *bool `json:"optimize,omitempty"` + // Default - Flag to control default category. + Default *bool `json:"default,omitempty"` +} + +// O365PolicyProperties the Office365 breakout policy. +type O365PolicyProperties struct { + // BreakOutCategories - Office365 breakout categories. + BreakOutCategories *O365BreakOutCategoryPolicies `json:"breakOutCategories,omitempty"` +} + +// Office365PolicyProperties network Virtual Appliance Sku Properties. +type Office365PolicyProperties struct { + // BreakOutCategories - Office 365 breakout categories. + BreakOutCategories *BreakOutCategoryPolicies `json:"breakOutCategories,omitempty"` +} + +// Operation network REST API operation definition. +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation}. + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - Origin of the operation. + Origin *string `json:"origin,omitempty"` + // OperationPropertiesFormat - Operation properties format. + *OperationPropertiesFormat `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Name != nil { + objectMap["name"] = o.Name + } + if o.Display != nil { + objectMap["display"] = o.Display + } + if o.Origin != nil { + objectMap["origin"] = o.Origin + } + if o.OperationPropertiesFormat != nil { + objectMap["properties"] = o.OperationPropertiesFormat + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Operation struct. +func (o *Operation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o.Name = &name + } + case "display": + if v != nil { + var display OperationDisplay + err = json.Unmarshal(*v, &display) + if err != nil { + return err + } + o.Display = &display + } + case "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + o.Origin = &origin + } + case "properties": + if v != nil { + var operationPropertiesFormat OperationPropertiesFormat + err = json.Unmarshal(*v, &operationPropertiesFormat) + if err != nil { + return err + } + o.OperationPropertiesFormat = &operationPropertiesFormat + } + } + } + + return nil +} + +// OperationDisplay display metadata associated with the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft Network. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Type of the operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of the operation. + Description *string `json:"description,omitempty"` +} + +// OperationListResult 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. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of Network operations supported by the Network resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// OperationPropertiesFormat description of operation properties format. +type OperationPropertiesFormat struct { + // ServiceSpecification - Specification of the service. + ServiceSpecification *OperationPropertiesFormatServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// OperationPropertiesFormatServiceSpecification specification of the service. +type OperationPropertiesFormatServiceSpecification struct { + // MetricSpecifications - Operation service specification. + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` + // LogSpecifications - Operation log specification. + LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` +} + +// OrderBy describes a column to sort +type OrderBy struct { + // Field - Describes the actual column name to sort by + Field *string `json:"field,omitempty"` + // Order - Describes if results should be in ascending/descending order. Possible values include: 'FirewallPolicyIDPSQuerySortOrderAscending', 'FirewallPolicyIDPSQuerySortOrderDescending' + Order FirewallPolicyIDPSQuerySortOrder `json:"order,omitempty"` +} + +// OutboundRule outbound rule of the load balancer. +type OutboundRule struct { + autorest.Response `json:"-"` + // OutboundRulePropertiesFormat - Properties of load balancer outbound rule. + *OutboundRulePropertiesFormat `json:"properties,omitempty"` + // Name - 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. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutboundRule. +func (or OutboundRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if or.OutboundRulePropertiesFormat != nil { + objectMap["properties"] = or.OutboundRulePropertiesFormat + } + if or.Name != nil { + objectMap["name"] = or.Name + } + if or.ID != nil { + objectMap["id"] = or.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OutboundRule struct. +func (or *OutboundRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var outboundRulePropertiesFormat OutboundRulePropertiesFormat + err = json.Unmarshal(*v, &outboundRulePropertiesFormat) + if err != nil { + return err + } + or.OutboundRulePropertiesFormat = &outboundRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + or.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + or.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + or.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + or.ID = &ID + } + } + } + + return nil +} + +// OutboundRulePropertiesFormat outbound rule of the load balancer. +type OutboundRulePropertiesFormat struct { + // AllocatedOutboundPorts - The number of outbound ports to be used for NAT. + AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` + // FrontendIPConfigurations - The Frontend IP addresses of the load balancer. + FrontendIPConfigurations *[]SubResource `json:"frontendIPConfigurations,omitempty"` + // BackendAddressPool - A reference to a pool of DIPs. Outbound traffic is randomly load balanced across IPs in the backend IPs. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the outbound rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Protocol - The protocol for the outbound rule in load balancer. Possible values include: 'LoadBalancerOutboundRuleProtocolTCP', 'LoadBalancerOutboundRuleProtocolUDP', 'LoadBalancerOutboundRuleProtocolAll' + Protocol LoadBalancerOutboundRuleProtocol `json:"protocol,omitempty"` + // EnableTCPReset - 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. + EnableTCPReset *bool `json:"enableTcpReset,omitempty"` + // IdleTimeoutInMinutes - The timeout for the TCP idle connection. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutboundRulePropertiesFormat. +func (orpf OutboundRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if orpf.AllocatedOutboundPorts != nil { + objectMap["allocatedOutboundPorts"] = orpf.AllocatedOutboundPorts + } + if orpf.FrontendIPConfigurations != nil { + objectMap["frontendIPConfigurations"] = orpf.FrontendIPConfigurations + } + if orpf.BackendAddressPool != nil { + objectMap["backendAddressPool"] = orpf.BackendAddressPool + } + if orpf.Protocol != "" { + objectMap["protocol"] = orpf.Protocol + } + if orpf.EnableTCPReset != nil { + objectMap["enableTcpReset"] = orpf.EnableTCPReset + } + if orpf.IdleTimeoutInMinutes != nil { + objectMap["idleTimeoutInMinutes"] = orpf.IdleTimeoutInMinutes + } + return json.Marshal(objectMap) +} + +// OwaspCrsExclusionEntry allow to exclude some variable satisfy the condition for the WAF check. +type OwaspCrsExclusionEntry struct { + // MatchVariable - The variable to be excluded. Possible values include: 'OwaspCrsExclusionEntryMatchVariableRequestHeaderNames', 'OwaspCrsExclusionEntryMatchVariableRequestCookieNames', 'OwaspCrsExclusionEntryMatchVariableRequestArgNames', 'OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys', 'OwaspCrsExclusionEntryMatchVariableRequestHeaderValues', 'OwaspCrsExclusionEntryMatchVariableRequestCookieKeys', 'OwaspCrsExclusionEntryMatchVariableRequestCookieValues', 'OwaspCrsExclusionEntryMatchVariableRequestArgKeys', 'OwaspCrsExclusionEntryMatchVariableRequestArgValues' + MatchVariable OwaspCrsExclusionEntryMatchVariable `json:"matchVariable,omitempty"` + // SelectorMatchOperator - When matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to. Possible values include: 'OwaspCrsExclusionEntrySelectorMatchOperatorEquals', 'OwaspCrsExclusionEntrySelectorMatchOperatorContains', 'OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith', 'OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith', 'OwaspCrsExclusionEntrySelectorMatchOperatorEqualsAny' + SelectorMatchOperator OwaspCrsExclusionEntrySelectorMatchOperator `json:"selectorMatchOperator,omitempty"` + // Selector - When matchVariable is a collection, operator used to specify which elements in the collection this exclusion applies to. + Selector *string `json:"selector,omitempty"` + // ExclusionManagedRuleSets - The managed rule sets that are associated with the exclusion. + ExclusionManagedRuleSets *[]ExclusionManagedRuleSet `json:"exclusionManagedRuleSets,omitempty"` +} + +// P2SConnectionConfiguration p2SConnectionConfiguration Resource. +type P2SConnectionConfiguration struct { + // P2SConnectionConfigurationProperties - Properties of the P2S connection configuration. + *P2SConnectionConfigurationProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for P2SConnectionConfiguration. +func (pcc P2SConnectionConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pcc.P2SConnectionConfigurationProperties != nil { + objectMap["properties"] = pcc.P2SConnectionConfigurationProperties + } + if pcc.Name != nil { + objectMap["name"] = pcc.Name + } + if pcc.ID != nil { + objectMap["id"] = pcc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for P2SConnectionConfiguration struct. +func (pcc *P2SConnectionConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var p2SConnectionConfigurationProperties P2SConnectionConfigurationProperties + err = json.Unmarshal(*v, &p2SConnectionConfigurationProperties) + if err != nil { + return err + } + pcc.P2SConnectionConfigurationProperties = &p2SConnectionConfigurationProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pcc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pcc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pcc.ID = &ID + } + } + } + + return nil +} + +// P2SConnectionConfigurationProperties parameters for P2SConnectionConfiguration. +type P2SConnectionConfigurationProperties struct { + // VpnClientAddressPool - The reference to the address space resource which represents Address space for P2S VpnClient. + VpnClientAddressPool *AddressSpace `json:"vpnClientAddressPool,omitempty"` + // RoutingConfiguration - The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` + // EnableInternetSecurity - Flag indicating whether the enable internet security flag is turned on for the P2S Connections or not. + EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` + // ConfigurationPolicyGroupAssociations - READ-ONLY; List of Configuration Policy Groups that this P2SConnectionConfiguration is attached to. + ConfigurationPolicyGroupAssociations *[]SubResource `json:"configurationPolicyGroupAssociations,omitempty"` + // PreviousConfigurationPolicyGroupAssociations - READ-ONLY; List of previous Configuration Policy Groups that this P2SConnectionConfiguration was attached to. + PreviousConfigurationPolicyGroupAssociations *[]VpnServerConfigurationPolicyGroup `json:"previousConfigurationPolicyGroupAssociations,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the P2SConnectionConfiguration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for P2SConnectionConfigurationProperties. +func (pccp P2SConnectionConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pccp.VpnClientAddressPool != nil { + objectMap["vpnClientAddressPool"] = pccp.VpnClientAddressPool + } + if pccp.RoutingConfiguration != nil { + objectMap["routingConfiguration"] = pccp.RoutingConfiguration + } + if pccp.EnableInternetSecurity != nil { + objectMap["enableInternetSecurity"] = pccp.EnableInternetSecurity + } + return json.Marshal(objectMap) +} + +// P2SVpnConnectionHealth p2S Vpn connection detailed health written to sas url. +type P2SVpnConnectionHealth struct { + autorest.Response `json:"-"` + // SasURL - Returned sas url of the blob to which the p2s vpn connection detailed health will be written. + SasURL *string `json:"sasUrl,omitempty"` +} + +// P2SVpnConnectionHealthRequest list of P2S Vpn connection health request. +type P2SVpnConnectionHealthRequest struct { + // VpnUserNamesFilter - The list of p2s vpn user names whose p2s vpn connection detailed health to retrieve for. + VpnUserNamesFilter *[]string `json:"vpnUserNamesFilter,omitempty"` + // OutputBlobSasURL - The sas-url to download the P2S Vpn connection health detail. + OutputBlobSasURL *string `json:"outputBlobSasUrl,omitempty"` +} + +// P2SVpnConnectionRequest list of p2s vpn connections to be disconnected. +type P2SVpnConnectionRequest struct { + // VpnConnectionIds - List of p2s vpn connection Ids. + VpnConnectionIds *[]string `json:"vpnConnectionIds,omitempty"` +} + +// P2SVpnGateway p2SVpnGateway Resource. +type P2SVpnGateway struct { + autorest.Response `json:"-"` + // P2SVpnGatewayProperties - Properties of the P2SVpnGateway. + *P2SVpnGatewayProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for P2SVpnGateway. +func (pvg P2SVpnGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pvg.P2SVpnGatewayProperties != nil { + objectMap["properties"] = pvg.P2SVpnGatewayProperties + } + if pvg.ID != nil { + objectMap["id"] = pvg.ID + } + if pvg.Location != nil { + objectMap["location"] = pvg.Location + } + if pvg.Tags != nil { + objectMap["tags"] = pvg.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for P2SVpnGateway struct. +func (pvg *P2SVpnGateway) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var p2SVpnGatewayProperties P2SVpnGatewayProperties + err = json.Unmarshal(*v, &p2SVpnGatewayProperties) + if err != nil { + return err + } + pvg.P2SVpnGatewayProperties = &p2SVpnGatewayProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pvg.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pvg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pvg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pvg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pvg.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pvg.Tags = tags + } + } + } + + return nil +} + +// P2SVpnGatewayProperties parameters for P2SVpnGateway. +type P2SVpnGatewayProperties struct { + // VirtualHub - The VirtualHub to which the gateway belongs. + VirtualHub *SubResource `json:"virtualHub,omitempty"` + // P2SConnectionConfigurations - List of all p2s connection configurations of the gateway. + P2SConnectionConfigurations *[]P2SConnectionConfiguration `json:"p2SConnectionConfigurations,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the P2S VPN gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // VpnGatewayScaleUnit - The scale unit for this p2s vpn gateway. + VpnGatewayScaleUnit *int32 `json:"vpnGatewayScaleUnit,omitempty"` + // VpnServerConfiguration - The VpnServerConfiguration to which the p2sVpnGateway is attached to. + VpnServerConfiguration *SubResource `json:"vpnServerConfiguration,omitempty"` + // VpnClientConnectionHealth - READ-ONLY; All P2S VPN clients' connection health status. + VpnClientConnectionHealth *VpnClientConnectionHealth `json:"vpnClientConnectionHealth,omitempty"` + // CustomDNSServers - List of all customer specified DNS servers IP addresses. + CustomDNSServers *[]string `json:"customDnsServers,omitempty"` + // IsRoutingPreferenceInternet - Enable Routing Preference property for the Public IP Interface of the P2SVpnGateway. + IsRoutingPreferenceInternet *bool `json:"isRoutingPreferenceInternet,omitempty"` +} + +// MarshalJSON is the custom marshaler for P2SVpnGatewayProperties. +func (pvgp P2SVpnGatewayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pvgp.VirtualHub != nil { + objectMap["virtualHub"] = pvgp.VirtualHub + } + if pvgp.P2SConnectionConfigurations != nil { + objectMap["p2SConnectionConfigurations"] = pvgp.P2SConnectionConfigurations + } + if pvgp.VpnGatewayScaleUnit != nil { + objectMap["vpnGatewayScaleUnit"] = pvgp.VpnGatewayScaleUnit + } + if pvgp.VpnServerConfiguration != nil { + objectMap["vpnServerConfiguration"] = pvgp.VpnServerConfiguration + } + if pvgp.CustomDNSServers != nil { + objectMap["customDnsServers"] = pvgp.CustomDNSServers + } + if pvgp.IsRoutingPreferenceInternet != nil { + objectMap["isRoutingPreferenceInternet"] = pvgp.IsRoutingPreferenceInternet + } + return json.Marshal(objectMap) +} + +// P2SVpnGatewaysResetFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type P2SVpnGatewaysResetFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (P2SVpnGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2SVpnGatewaysResetFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2SVpnGatewaysResetFuture.Result. +func (future *P2SVpnGatewaysResetFuture) result(client P2sVpnGatewaysClient) (pvg P2SVpnGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2SVpnGatewaysResetFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pvg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2SVpnGatewaysResetFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pvg.Response.Response, err = future.GetResult(sender); err == nil && pvg.Response.Response.StatusCode != http.StatusNoContent { + pvg, err = client.ResetResponder(pvg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2SVpnGatewaysResetFuture", "Result", pvg.Response.Response, "Failure responding to request") + } + } + return +} + +// P2SVpnProfileParameters vpn Client Parameters for package generation. +type P2SVpnProfileParameters struct { + // AuthenticationMethod - VPN client authentication method. Possible values include: 'AuthenticationMethodEAPTLS', 'AuthenticationMethodEAPMSCHAPv2' + AuthenticationMethod AuthenticationMethod `json:"authenticationMethod,omitempty"` +} + +// P2sVpnGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type P2sVpnGatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (P2SVpnGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2sVpnGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2sVpnGatewaysCreateOrUpdateFuture.Result. +func (future *P2sVpnGatewaysCreateOrUpdateFuture) result(client P2sVpnGatewaysClient) (pvg P2SVpnGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pvg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pvg.Response.Response, err = future.GetResult(sender); err == nil && pvg.Response.Response.StatusCode != http.StatusNoContent { + pvg, err = client.CreateOrUpdateResponder(pvg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysCreateOrUpdateFuture", "Result", pvg.Response.Response, "Failure responding to request") + } + } + return +} + +// P2sVpnGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type P2sVpnGatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2sVpnGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2sVpnGatewaysDeleteFuture.Result. +func (future *P2sVpnGatewaysDeleteFuture) result(client P2sVpnGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture.Result. +func (future *P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture) result(client P2sVpnGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture") + return + } + ar.Response = future.Response() + return +} + +// P2sVpnGatewaysGenerateVpnProfileFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type P2sVpnGatewaysGenerateVpnProfileFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (VpnProfileResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2sVpnGatewaysGenerateVpnProfileFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2sVpnGatewaysGenerateVpnProfileFuture.Result. +func (future *P2sVpnGatewaysGenerateVpnProfileFuture) result(client P2sVpnGatewaysClient) (vpr VpnProfileResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGenerateVpnProfileFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vpr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysGenerateVpnProfileFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vpr.Response.Response, err = future.GetResult(sender); err == nil && vpr.Response.Response.StatusCode != http.StatusNoContent { + vpr, err = client.GenerateVpnProfileResponder(vpr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGenerateVpnProfileFuture", "Result", vpr.Response.Response, "Failure responding to request") + } + } + return +} + +// P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (P2SVpnConnectionHealth, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture.Result. +func (future *P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture) result(client P2sVpnGatewaysClient) (pvch P2SVpnConnectionHealth, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pvch.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pvch.Response.Response, err = future.GetResult(sender); err == nil && pvch.Response.Response.StatusCode != http.StatusNoContent { + pvch, err = client.GetP2sVpnConnectionHealthDetailedResponder(pvch.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture", "Result", pvch.Response.Response, "Failure responding to request") + } + } + return +} + +// P2sVpnGatewaysGetP2sVpnConnectionHealthFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type P2sVpnGatewaysGetP2sVpnConnectionHealthFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (P2SVpnGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2sVpnGatewaysGetP2sVpnConnectionHealthFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2sVpnGatewaysGetP2sVpnConnectionHealthFuture.Result. +func (future *P2sVpnGatewaysGetP2sVpnConnectionHealthFuture) result(client P2sVpnGatewaysClient) (pvg P2SVpnGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGetP2sVpnConnectionHealthFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pvg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysGetP2sVpnConnectionHealthFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pvg.Response.Response, err = future.GetResult(sender); err == nil && pvg.Response.Response.StatusCode != http.StatusNoContent { + pvg, err = client.GetP2sVpnConnectionHealthResponder(pvg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGetP2sVpnConnectionHealthFuture", "Result", pvg.Response.Response, "Failure responding to request") + } + } + return +} + +// P2sVpnGatewaysUpdateTagsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type P2sVpnGatewaysUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (P2SVpnGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2sVpnGatewaysUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2sVpnGatewaysUpdateTagsFuture.Result. +func (future *P2sVpnGatewaysUpdateTagsFuture) result(client P2sVpnGatewaysClient) (pvg P2SVpnGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pvg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pvg.Response.Response, err = future.GetResult(sender); err == nil && pvg.Response.Response.StatusCode != http.StatusNoContent { + pvg, err = client.UpdateTagsResponder(pvg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysUpdateTagsFuture", "Result", pvg.Response.Response, "Failure responding to request") + } + } + return +} + +// PacketCapture parameters that define the create packet capture operation. +type PacketCapture struct { + // PacketCaptureParameters - Properties of the packet capture. + *PacketCaptureParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PacketCapture. +func (pc PacketCapture) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pc.PacketCaptureParameters != nil { + objectMap["properties"] = pc.PacketCaptureParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PacketCapture struct. +func (pc *PacketCapture) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var packetCaptureParameters PacketCaptureParameters + err = json.Unmarshal(*v, &packetCaptureParameters) + if err != nil { + return err + } + pc.PacketCaptureParameters = &packetCaptureParameters + } + } + } + + return nil +} + +// PacketCaptureFilter filter that is applied to packet capture request. Multiple filters can be applied. +type PacketCaptureFilter struct { + // Protocol - Protocol to be filtered on. Possible values include: 'PcProtocolTCP', 'PcProtocolUDP', 'PcProtocolAny' + Protocol PcProtocol `json:"protocol,omitempty"` + // LocalIPAddress - 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. + LocalIPAddress *string `json:"localIPAddress,omitempty"` + // RemoteIPAddress - 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. + RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` + // LocalPort - 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. + LocalPort *string `json:"localPort,omitempty"` + // RemotePort - 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. + RemotePort *string `json:"remotePort,omitempty"` +} + +// PacketCaptureListResult list of packet capture sessions. +type PacketCaptureListResult struct { + autorest.Response `json:"-"` + // Value - Information about packet capture sessions. + Value *[]PacketCaptureResult `json:"value,omitempty"` +} + +// PacketCaptureMachineScope a list of AzureVMSS instances which can be included or excluded to run packet +// capture. If both included and excluded are empty, then the packet capture will run on all instances of +// AzureVMSS. +type PacketCaptureMachineScope struct { + // Include - List of AzureVMSS instances to run packet capture on. + Include *[]string `json:"include,omitempty"` + // Exclude - List of AzureVMSS instances which has to be excluded from the AzureVMSS from running packet capture. + Exclude *[]string `json:"exclude,omitempty"` +} + +// PacketCaptureParameters parameters that define the create packet capture operation. +type PacketCaptureParameters struct { + // Target - The ID of the targeted resource, only AzureVM and AzureVMSS as target type are currently supported. + Target *string `json:"target,omitempty"` + // Scope - A list of AzureVMSS instances which can be included or excluded to run packet capture. If both included and excluded are empty, then the packet capture will run on all instances of AzureVMSS. + Scope *PacketCaptureMachineScope `json:"scope,omitempty"` + // TargetType - Target type of the resource provided. Possible values include: 'PacketCaptureTargetTypeAzureVM', 'PacketCaptureTargetTypeAzureVMSS' + TargetType PacketCaptureTargetType `json:"targetType,omitempty"` + // BytesToCapturePerPacket - Number of bytes captured per packet, the remaining bytes are truncated. + BytesToCapturePerPacket *int64 `json:"bytesToCapturePerPacket,omitempty"` + // TotalBytesPerSession - Maximum size of the capture output. + TotalBytesPerSession *int64 `json:"totalBytesPerSession,omitempty"` + // TimeLimitInSeconds - Maximum duration of the capture session in seconds. + TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` + // StorageLocation - The storage location for a packet capture session. + StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` + // Filters - A list of packet capture filters. + Filters *[]PacketCaptureFilter `json:"filters,omitempty"` +} + +// PacketCaptureQueryStatusResult status of packet capture session. +type PacketCaptureQueryStatusResult struct { + autorest.Response `json:"-"` + // Name - The name of the packet capture resource. + Name *string `json:"name,omitempty"` + // ID - The ID of the packet capture resource. + ID *string `json:"id,omitempty"` + // CaptureStartTime - The start time of the packet capture session. + CaptureStartTime *date.Time `json:"captureStartTime,omitempty"` + // PacketCaptureStatus - The status of the packet capture session. Possible values include: 'PcStatusNotStarted', 'PcStatusRunning', 'PcStatusStopped', 'PcStatusError', 'PcStatusUnknown' + PacketCaptureStatus PcStatus `json:"packetCaptureStatus,omitempty"` + // StopReason - The reason the current packet capture session was stopped. + StopReason *string `json:"stopReason,omitempty"` + // PacketCaptureError - List of errors of packet capture session. + PacketCaptureError *[]PcError `json:"packetCaptureError,omitempty"` +} + +// PacketCaptureResult information about packet capture session. +type PacketCaptureResult struct { + autorest.Response `json:"-"` + // Name - READ-ONLY; Name of the packet capture session. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; ID of the packet capture operation. + ID *string `json:"id,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // PacketCaptureResultProperties - Properties of the packet capture result. + *PacketCaptureResultProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PacketCaptureResult. +func (pcr PacketCaptureResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pcr.PacketCaptureResultProperties != nil { + objectMap["properties"] = pcr.PacketCaptureResultProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PacketCaptureResult struct. +func (pcr *PacketCaptureResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pcr.Name = &name + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pcr.ID = &ID + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pcr.Etag = &etag + } + case "properties": + if v != nil { + var packetCaptureResultProperties PacketCaptureResultProperties + err = json.Unmarshal(*v, &packetCaptureResultProperties) + if err != nil { + return err + } + pcr.PacketCaptureResultProperties = &packetCaptureResultProperties + } + } + } + + return nil +} + +// PacketCaptureResultProperties the properties of a packet capture session. +type PacketCaptureResultProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the packet capture session. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Target - The ID of the targeted resource, only AzureVM and AzureVMSS as target type are currently supported. + Target *string `json:"target,omitempty"` + // Scope - A list of AzureVMSS instances which can be included or excluded to run packet capture. If both included and excluded are empty, then the packet capture will run on all instances of AzureVMSS. + Scope *PacketCaptureMachineScope `json:"scope,omitempty"` + // TargetType - Target type of the resource provided. Possible values include: 'PacketCaptureTargetTypeAzureVM', 'PacketCaptureTargetTypeAzureVMSS' + TargetType PacketCaptureTargetType `json:"targetType,omitempty"` + // BytesToCapturePerPacket - Number of bytes captured per packet, the remaining bytes are truncated. + BytesToCapturePerPacket *int64 `json:"bytesToCapturePerPacket,omitempty"` + // TotalBytesPerSession - Maximum size of the capture output. + TotalBytesPerSession *int64 `json:"totalBytesPerSession,omitempty"` + // TimeLimitInSeconds - Maximum duration of the capture session in seconds. + TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` + // StorageLocation - The storage location for a packet capture session. + StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` + // Filters - A list of packet capture filters. + Filters *[]PacketCaptureFilter `json:"filters,omitempty"` +} + +// MarshalJSON is the custom marshaler for PacketCaptureResultProperties. +func (pcrp PacketCaptureResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pcrp.Target != nil { + objectMap["target"] = pcrp.Target + } + if pcrp.Scope != nil { + objectMap["scope"] = pcrp.Scope + } + if pcrp.TargetType != "" { + objectMap["targetType"] = pcrp.TargetType + } + if pcrp.BytesToCapturePerPacket != nil { + objectMap["bytesToCapturePerPacket"] = pcrp.BytesToCapturePerPacket + } + if pcrp.TotalBytesPerSession != nil { + objectMap["totalBytesPerSession"] = pcrp.TotalBytesPerSession + } + if pcrp.TimeLimitInSeconds != nil { + objectMap["timeLimitInSeconds"] = pcrp.TimeLimitInSeconds + } + if pcrp.StorageLocation != nil { + objectMap["storageLocation"] = pcrp.StorageLocation + } + if pcrp.Filters != nil { + objectMap["filters"] = pcrp.Filters + } + return json.Marshal(objectMap) +} + +// PacketCaptureStorageLocation the storage location for a packet capture session. +type PacketCaptureStorageLocation struct { + // StorageID - The ID of the storage account to save the packet capture session. Required if no local file path is provided. + StorageID *string `json:"storageId,omitempty"` + // StoragePath - 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. + StoragePath *string `json:"storagePath,omitempty"` + // FilePath - 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. + FilePath *string `json:"filePath,omitempty"` +} + +// PacketCapturesCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PacketCapturesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PacketCapturesClient) (PacketCaptureResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PacketCapturesCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PacketCapturesCreateFuture.Result. +func (future *PacketCapturesCreateFuture) result(client PacketCapturesClient) (pcr PacketCaptureResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pcr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pcr.Response.Response, err = future.GetResult(sender); err == nil && pcr.Response.Response.StatusCode != http.StatusNoContent { + pcr, err = client.CreateResponder(pcr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesCreateFuture", "Result", pcr.Response.Response, "Failure responding to request") + } + } + return +} + +// PacketCapturesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PacketCapturesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PacketCapturesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PacketCapturesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PacketCapturesDeleteFuture.Result. +func (future *PacketCapturesDeleteFuture) result(client PacketCapturesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PacketCapturesGetStatusFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PacketCapturesGetStatusFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PacketCapturesClient) (PacketCaptureQueryStatusResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PacketCapturesGetStatusFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PacketCapturesGetStatusFuture.Result. +func (future *PacketCapturesGetStatusFuture) result(client PacketCapturesClient) (pcqsr PacketCaptureQueryStatusResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesGetStatusFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pcqsr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesGetStatusFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pcqsr.Response.Response, err = future.GetResult(sender); err == nil && pcqsr.Response.Response.StatusCode != http.StatusNoContent { + pcqsr, err = client.GetStatusResponder(pcqsr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesGetStatusFuture", "Result", pcqsr.Response.Response, "Failure responding to request") + } + } + return +} + +// PacketCapturesStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PacketCapturesStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PacketCapturesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PacketCapturesStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PacketCapturesStopFuture.Result. +func (future *PacketCapturesStopFuture) result(client PacketCapturesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesStopFuture") + return + } + ar.Response = future.Response() + return +} + +// Parameter parameters for an Action. +type Parameter struct { + // RoutePrefix - List of route prefixes. + RoutePrefix *[]string `json:"routePrefix,omitempty"` + // Community - List of BGP communities. + Community *[]string `json:"community,omitempty"` + // AsPath - List of AS paths. + AsPath *[]string `json:"asPath,omitempty"` +} + +// PartnerManagedResourceProperties properties of the partner managed resource. +type PartnerManagedResourceProperties struct { + // ID - READ-ONLY; The partner managed resource id. + ID *string `json:"id,omitempty"` + // InternalLoadBalancerID - READ-ONLY; The partner managed ILB resource id + InternalLoadBalancerID *string `json:"internalLoadBalancerId,omitempty"` + // StandardLoadBalancerID - READ-ONLY; The partner managed SLB resource id + StandardLoadBalancerID *string `json:"standardLoadBalancerId,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartnerManagedResourceProperties. +func (pmrp PartnerManagedResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PatchObject object for patch operations. +type PatchObject struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PatchObject. +func (po PatchObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if po.Tags != nil { + objectMap["tags"] = po.Tags + } + return json.Marshal(objectMap) +} + +// PatchRouteFilter route Filter Resource. +type PatchRouteFilter struct { + // RouteFilterPropertiesFormat - Properties of the route filter. + *RouteFilterPropertiesFormat `json:"properties,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PatchRouteFilter. +func (prf PatchRouteFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if prf.RouteFilterPropertiesFormat != nil { + objectMap["properties"] = prf.RouteFilterPropertiesFormat + } + if prf.Tags != nil { + objectMap["tags"] = prf.Tags + } + if prf.ID != nil { + objectMap["id"] = prf.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PatchRouteFilter struct. +func (prf *PatchRouteFilter) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routeFilterPropertiesFormat RouteFilterPropertiesFormat + err = json.Unmarshal(*v, &routeFilterPropertiesFormat) + if err != nil { + return err + } + prf.RouteFilterPropertiesFormat = &routeFilterPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + prf.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + prf.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + prf.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + prf.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + prf.ID = &ID + } + } + } + + return nil +} + +// PatchRouteFilterRule route Filter Rule Resource. +type PatchRouteFilterRule struct { + // RouteFilterRulePropertiesFormat - Properties of the route filter rule. + *RouteFilterRulePropertiesFormat `json:"properties,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PatchRouteFilterRule. +func (prfr PatchRouteFilterRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if prfr.RouteFilterRulePropertiesFormat != nil { + objectMap["properties"] = prfr.RouteFilterRulePropertiesFormat + } + if prfr.ID != nil { + objectMap["id"] = prfr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PatchRouteFilterRule struct. +func (prfr *PatchRouteFilterRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routeFilterRulePropertiesFormat RouteFilterRulePropertiesFormat + err = json.Unmarshal(*v, &routeFilterRulePropertiesFormat) + if err != nil { + return err + } + prfr.RouteFilterRulePropertiesFormat = &routeFilterRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + prfr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + prfr.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + prfr.ID = &ID + } + } + } + + return nil +} + +// PeerExpressRouteCircuitConnection peer Express Route Circuit Connection in an ExpressRouteCircuitPeering +// resource. +type PeerExpressRouteCircuitConnection struct { + autorest.Response `json:"-"` + // PeerExpressRouteCircuitConnectionPropertiesFormat - Properties of the peer express route circuit connection. + *PeerExpressRouteCircuitConnectionPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PeerExpressRouteCircuitConnection. +func (percc PeerExpressRouteCircuitConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if percc.PeerExpressRouteCircuitConnectionPropertiesFormat != nil { + objectMap["properties"] = percc.PeerExpressRouteCircuitConnectionPropertiesFormat + } + if percc.Name != nil { + objectMap["name"] = percc.Name + } + if percc.ID != nil { + objectMap["id"] = percc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PeerExpressRouteCircuitConnection struct. +func (percc *PeerExpressRouteCircuitConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var peerExpressRouteCircuitConnectionPropertiesFormat PeerExpressRouteCircuitConnectionPropertiesFormat + err = json.Unmarshal(*v, &peerExpressRouteCircuitConnectionPropertiesFormat) + if err != nil { + return err + } + percc.PeerExpressRouteCircuitConnectionPropertiesFormat = &peerExpressRouteCircuitConnectionPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + percc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + percc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + percc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + percc.ID = &ID + } + } + } + + return nil +} + +// PeerExpressRouteCircuitConnectionListResult response for ListPeeredConnections API service call +// retrieves all global reach peer circuit connections that belongs to a Private Peering for an +// ExpressRouteCircuit. +type PeerExpressRouteCircuitConnectionListResult struct { + autorest.Response `json:"-"` + // Value - The global reach peer circuit connection associated with Private Peering in an ExpressRoute Circuit. + Value *[]PeerExpressRouteCircuitConnection `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// PeerExpressRouteCircuitConnectionListResultIterator provides access to a complete listing of +// PeerExpressRouteCircuitConnection values. +type PeerExpressRouteCircuitConnectionListResultIterator struct { + i int + page PeerExpressRouteCircuitConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PeerExpressRouteCircuitConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PeerExpressRouteCircuitConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PeerExpressRouteCircuitConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PeerExpressRouteCircuitConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PeerExpressRouteCircuitConnectionListResultIterator) Response() PeerExpressRouteCircuitConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PeerExpressRouteCircuitConnectionListResultIterator) Value() PeerExpressRouteCircuitConnection { + if !iter.page.NotDone() { + return PeerExpressRouteCircuitConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PeerExpressRouteCircuitConnectionListResultIterator type. +func NewPeerExpressRouteCircuitConnectionListResultIterator(page PeerExpressRouteCircuitConnectionListResultPage) PeerExpressRouteCircuitConnectionListResultIterator { + return PeerExpressRouteCircuitConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (percclr PeerExpressRouteCircuitConnectionListResult) IsEmpty() bool { + return percclr.Value == nil || len(*percclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (percclr PeerExpressRouteCircuitConnectionListResult) hasNextLink() bool { + return percclr.NextLink != nil && len(*percclr.NextLink) != 0 +} + +// peerExpressRouteCircuitConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (percclr PeerExpressRouteCircuitConnectionListResult) peerExpressRouteCircuitConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !percclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(percclr.NextLink))) +} + +// PeerExpressRouteCircuitConnectionListResultPage contains a page of PeerExpressRouteCircuitConnection +// values. +type PeerExpressRouteCircuitConnectionListResultPage struct { + fn func(context.Context, PeerExpressRouteCircuitConnectionListResult) (PeerExpressRouteCircuitConnectionListResult, error) + percclr PeerExpressRouteCircuitConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PeerExpressRouteCircuitConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PeerExpressRouteCircuitConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.percclr) + if err != nil { + return err + } + page.percclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PeerExpressRouteCircuitConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PeerExpressRouteCircuitConnectionListResultPage) NotDone() bool { + return !page.percclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PeerExpressRouteCircuitConnectionListResultPage) Response() PeerExpressRouteCircuitConnectionListResult { + return page.percclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PeerExpressRouteCircuitConnectionListResultPage) Values() []PeerExpressRouteCircuitConnection { + if page.percclr.IsEmpty() { + return nil + } + return *page.percclr.Value +} + +// Creates a new instance of the PeerExpressRouteCircuitConnectionListResultPage type. +func NewPeerExpressRouteCircuitConnectionListResultPage(cur PeerExpressRouteCircuitConnectionListResult, getNextPage func(context.Context, PeerExpressRouteCircuitConnectionListResult) (PeerExpressRouteCircuitConnectionListResult, error)) PeerExpressRouteCircuitConnectionListResultPage { + return PeerExpressRouteCircuitConnectionListResultPage{ + fn: getNextPage, + percclr: cur, + } +} + +// PeerExpressRouteCircuitConnectionPropertiesFormat properties of the peer express route circuit +// connection. +type PeerExpressRouteCircuitConnectionPropertiesFormat struct { + // ExpressRouteCircuitPeering - Reference to Express Route Circuit Private Peering Resource of the circuit. + ExpressRouteCircuitPeering *SubResource `json:"expressRouteCircuitPeering,omitempty"` + // PeerExpressRouteCircuitPeering - Reference to Express Route Circuit Private Peering Resource of the peered circuit. + PeerExpressRouteCircuitPeering *SubResource `json:"peerExpressRouteCircuitPeering,omitempty"` + // AddressPrefix - /29 IP address space to carve out Customer addresses for tunnels. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // CircuitConnectionStatus - Express Route Circuit connection state. Possible values include: 'CircuitConnectionStatusConnected', 'CircuitConnectionStatusConnecting', 'CircuitConnectionStatusDisconnected' + CircuitConnectionStatus CircuitConnectionStatus `json:"circuitConnectionStatus,omitempty"` + // ConnectionName - The name of the express route circuit connection resource. + ConnectionName *string `json:"connectionName,omitempty"` + // AuthResourceGUID - The resource guid of the authorization used for the express route circuit connection. + AuthResourceGUID *string `json:"authResourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the peer express route circuit connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PeerExpressRouteCircuitConnectionPropertiesFormat. +func (perccpf PeerExpressRouteCircuitConnectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if perccpf.ExpressRouteCircuitPeering != nil { + objectMap["expressRouteCircuitPeering"] = perccpf.ExpressRouteCircuitPeering + } + if perccpf.PeerExpressRouteCircuitPeering != nil { + objectMap["peerExpressRouteCircuitPeering"] = perccpf.PeerExpressRouteCircuitPeering + } + if perccpf.AddressPrefix != nil { + objectMap["addressPrefix"] = perccpf.AddressPrefix + } + if perccpf.CircuitConnectionStatus != "" { + objectMap["circuitConnectionStatus"] = perccpf.CircuitConnectionStatus + } + if perccpf.ConnectionName != nil { + objectMap["connectionName"] = perccpf.ConnectionName + } + if perccpf.AuthResourceGUID != nil { + objectMap["authResourceGuid"] = perccpf.AuthResourceGUID + } + return json.Marshal(objectMap) +} + +// PeerRoute peer routing details. +type PeerRoute struct { + // LocalAddress - READ-ONLY; The peer's local address. + LocalAddress *string `json:"localAddress,omitempty"` + // NetworkProperty - READ-ONLY; The route's network prefix. + NetworkProperty *string `json:"network,omitempty"` + // NextHop - READ-ONLY; The route's next hop. + NextHop *string `json:"nextHop,omitempty"` + // SourcePeer - READ-ONLY; The peer this route was learned from. + SourcePeer *string `json:"sourcePeer,omitempty"` + // Origin - READ-ONLY; The source this route was learned from. + Origin *string `json:"origin,omitempty"` + // AsPath - READ-ONLY; The route's AS path sequence. + AsPath *string `json:"asPath,omitempty"` + // Weight - READ-ONLY; The route's weight. + Weight *int32 `json:"weight,omitempty"` +} + +// MarshalJSON is the custom marshaler for PeerRoute. +func (pr PeerRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PeerRouteList list of virtual router peer routes. +type PeerRouteList struct { + autorest.Response `json:"-"` + // Value - List of peer routes. + Value *[]PeerRoute `json:"value,omitempty"` +} + +// PolicySettings defines contents of a web application firewall global configuration. +type PolicySettings struct { + // State - The state of the policy. Possible values include: 'WebApplicationFirewallEnabledStateDisabled', 'WebApplicationFirewallEnabledStateEnabled' + State WebApplicationFirewallEnabledState `json:"state,omitempty"` + // Mode - The mode of the policy. Possible values include: 'WebApplicationFirewallModePrevention', 'WebApplicationFirewallModeDetection' + Mode WebApplicationFirewallMode `json:"mode,omitempty"` + // RequestBodyCheck - Whether to allow WAF to check request Body. + RequestBodyCheck *bool `json:"requestBodyCheck,omitempty"` + // MaxRequestBodySizeInKb - Maximum request body size in Kb for WAF. + MaxRequestBodySizeInKb *int32 `json:"maxRequestBodySizeInKb,omitempty"` + // FileUploadLimitInMb - Maximum file upload size in Mb for WAF. + FileUploadLimitInMb *int32 `json:"fileUploadLimitInMb,omitempty"` + // CustomBlockResponseStatusCode - If the action type is block, customer can override the response status code. + CustomBlockResponseStatusCode *int32 `json:"customBlockResponseStatusCode,omitempty"` + // CustomBlockResponseBody - If the action type is block, customer can override the response body. The body must be specified in base64 encoding. + CustomBlockResponseBody *string `json:"customBlockResponseBody,omitempty"` +} + +// PrepareNetworkPoliciesRequest details of PrepareNetworkPolicies for Subnet. +type PrepareNetworkPoliciesRequest struct { + // ServiceName - The name of the service for which subnet is being prepared for. + ServiceName *string `json:"serviceName,omitempty"` + // NetworkIntentPolicyConfigurations - A list of NetworkIntentPolicyConfiguration. + NetworkIntentPolicyConfigurations *[]IntentPolicyConfiguration `json:"networkIntentPolicyConfigurations,omitempty"` +} + +// PrivateDNSZoneConfig privateDnsZoneConfig resource. +type PrivateDNSZoneConfig struct { + // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // PrivateDNSZonePropertiesFormat - Properties of the private dns zone configuration. + *PrivateDNSZonePropertiesFormat `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateDNSZoneConfig. +func (pdzc PrivateDNSZoneConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pdzc.Name != nil { + objectMap["name"] = pdzc.Name + } + if pdzc.PrivateDNSZonePropertiesFormat != nil { + objectMap["properties"] = pdzc.PrivateDNSZonePropertiesFormat + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateDNSZoneConfig struct. +func (pdzc *PrivateDNSZoneConfig) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pdzc.Name = &name + } + case "properties": + if v != nil { + var privateDNSZonePropertiesFormat PrivateDNSZonePropertiesFormat + err = json.Unmarshal(*v, &privateDNSZonePropertiesFormat) + if err != nil { + return err + } + pdzc.PrivateDNSZonePropertiesFormat = &privateDNSZonePropertiesFormat + } + } + } + + return nil +} + +// PrivateDNSZoneGroup private dns zone group resource. +type PrivateDNSZoneGroup struct { + autorest.Response `json:"-"` + // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // PrivateDNSZoneGroupPropertiesFormat - Properties of the private dns zone group. + *PrivateDNSZoneGroupPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateDNSZoneGroup. +func (pdzg PrivateDNSZoneGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pdzg.Name != nil { + objectMap["name"] = pdzg.Name + } + if pdzg.PrivateDNSZoneGroupPropertiesFormat != nil { + objectMap["properties"] = pdzg.PrivateDNSZoneGroupPropertiesFormat + } + if pdzg.ID != nil { + objectMap["id"] = pdzg.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateDNSZoneGroup struct. +func (pdzg *PrivateDNSZoneGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pdzg.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pdzg.Etag = &etag + } + case "properties": + if v != nil { + var privateDNSZoneGroupPropertiesFormat PrivateDNSZoneGroupPropertiesFormat + err = json.Unmarshal(*v, &privateDNSZoneGroupPropertiesFormat) + if err != nil { + return err + } + pdzg.PrivateDNSZoneGroupPropertiesFormat = &privateDNSZoneGroupPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pdzg.ID = &ID + } + } + } + + return nil +} + +// PrivateDNSZoneGroupListResult response for the ListPrivateDnsZoneGroups API service call. +type PrivateDNSZoneGroupListResult struct { + autorest.Response `json:"-"` + // Value - A list of private dns zone group resources in a private endpoint. + Value *[]PrivateDNSZoneGroup `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateDNSZoneGroupListResult. +func (pdzglr PrivateDNSZoneGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pdzglr.Value != nil { + objectMap["value"] = pdzglr.Value + } + return json.Marshal(objectMap) +} + +// PrivateDNSZoneGroupListResultIterator provides access to a complete listing of PrivateDNSZoneGroup +// values. +type PrivateDNSZoneGroupListResultIterator struct { + i int + page PrivateDNSZoneGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateDNSZoneGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateDNSZoneGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateDNSZoneGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateDNSZoneGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateDNSZoneGroupListResultIterator) Response() PrivateDNSZoneGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateDNSZoneGroupListResultIterator) Value() PrivateDNSZoneGroup { + if !iter.page.NotDone() { + return PrivateDNSZoneGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateDNSZoneGroupListResultIterator type. +func NewPrivateDNSZoneGroupListResultIterator(page PrivateDNSZoneGroupListResultPage) PrivateDNSZoneGroupListResultIterator { + return PrivateDNSZoneGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pdzglr PrivateDNSZoneGroupListResult) IsEmpty() bool { + return pdzglr.Value == nil || len(*pdzglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pdzglr PrivateDNSZoneGroupListResult) hasNextLink() bool { + return pdzglr.NextLink != nil && len(*pdzglr.NextLink) != 0 +} + +// privateDNSZoneGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pdzglr PrivateDNSZoneGroupListResult) privateDNSZoneGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !pdzglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pdzglr.NextLink))) +} + +// PrivateDNSZoneGroupListResultPage contains a page of PrivateDNSZoneGroup values. +type PrivateDNSZoneGroupListResultPage struct { + fn func(context.Context, PrivateDNSZoneGroupListResult) (PrivateDNSZoneGroupListResult, error) + pdzglr PrivateDNSZoneGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateDNSZoneGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateDNSZoneGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pdzglr) + if err != nil { + return err + } + page.pdzglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateDNSZoneGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateDNSZoneGroupListResultPage) NotDone() bool { + return !page.pdzglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateDNSZoneGroupListResultPage) Response() PrivateDNSZoneGroupListResult { + return page.pdzglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateDNSZoneGroupListResultPage) Values() []PrivateDNSZoneGroup { + if page.pdzglr.IsEmpty() { + return nil + } + return *page.pdzglr.Value +} + +// Creates a new instance of the PrivateDNSZoneGroupListResultPage type. +func NewPrivateDNSZoneGroupListResultPage(cur PrivateDNSZoneGroupListResult, getNextPage func(context.Context, PrivateDNSZoneGroupListResult) (PrivateDNSZoneGroupListResult, error)) PrivateDNSZoneGroupListResultPage { + return PrivateDNSZoneGroupListResultPage{ + fn: getNextPage, + pdzglr: cur, + } +} + +// PrivateDNSZoneGroupPropertiesFormat properties of the private dns zone group. +type PrivateDNSZoneGroupPropertiesFormat struct { + // ProvisioningState - READ-ONLY; The provisioning state of the private dns zone group resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateDNSZoneConfigs - A collection of private dns zone configurations of the private dns zone group. + PrivateDNSZoneConfigs *[]PrivateDNSZoneConfig `json:"privateDnsZoneConfigs,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateDNSZoneGroupPropertiesFormat. +func (pdzgpf PrivateDNSZoneGroupPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pdzgpf.PrivateDNSZoneConfigs != nil { + objectMap["privateDnsZoneConfigs"] = pdzgpf.PrivateDNSZoneConfigs + } + return json.Marshal(objectMap) +} + +// PrivateDNSZoneGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateDNSZoneGroupsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateDNSZoneGroupsClient) (PrivateDNSZoneGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateDNSZoneGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateDNSZoneGroupsCreateOrUpdateFuture.Result. +func (future *PrivateDNSZoneGroupsCreateOrUpdateFuture) result(client PrivateDNSZoneGroupsClient) (pdzg PrivateDNSZoneGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pdzg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateDNSZoneGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pdzg.Response.Response, err = future.GetResult(sender); err == nil && pdzg.Response.Response.StatusCode != http.StatusNoContent { + pdzg, err = client.CreateOrUpdateResponder(pdzg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsCreateOrUpdateFuture", "Result", pdzg.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateDNSZoneGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateDNSZoneGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateDNSZoneGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateDNSZoneGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateDNSZoneGroupsDeleteFuture.Result. +func (future *PrivateDNSZoneGroupsDeleteFuture) result(client PrivateDNSZoneGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateDNSZoneGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateDNSZonePropertiesFormat properties of the private dns zone configuration resource. +type PrivateDNSZonePropertiesFormat struct { + // PrivateDNSZoneID - The resource id of the private dns zone. + PrivateDNSZoneID *string `json:"privateDnsZoneId,omitempty"` + // RecordSets - READ-ONLY; A collection of information regarding a recordSet, holding information to identify private resources. + RecordSets *[]RecordSet `json:"recordSets,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateDNSZonePropertiesFormat. +func (pdzpf PrivateDNSZonePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pdzpf.PrivateDNSZoneID != nil { + objectMap["privateDnsZoneId"] = pdzpf.PrivateDNSZoneID + } + return json.Marshal(objectMap) +} + +// PrivateEndpoint private endpoint resource. +type PrivateEndpoint struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the load balancer. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // PrivateEndpointProperties - Properties of the private endpoint. + *PrivateEndpointProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpoint. +func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.ExtendedLocation != nil { + objectMap["extendedLocation"] = peVar.ExtendedLocation + } + if peVar.PrivateEndpointProperties != nil { + objectMap["properties"] = peVar.PrivateEndpointProperties + } + if peVar.ID != nil { + objectMap["id"] = peVar.ID + } + if peVar.Location != nil { + objectMap["location"] = peVar.Location + } + if peVar.Tags != nil { + objectMap["tags"] = peVar.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpoint struct. +func (peVar *PrivateEndpoint) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + peVar.ExtendedLocation = &extendedLocation + } + case "properties": + if v != nil { + var privateEndpointProperties PrivateEndpointProperties + err = json.Unmarshal(*v, &privateEndpointProperties) + if err != nil { + return err + } + peVar.PrivateEndpointProperties = &privateEndpointProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + peVar.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + peVar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + peVar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + peVar.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + peVar.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + peVar.Tags = tags + } + } + } + + return nil +} + +// PrivateEndpointConnection privateEndpointConnection resource. +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // PrivateEndpointConnectionProperties - Properties of the private end point connection. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + if pec.Name != nil { + objectMap["name"] = pec.Name + } + if pec.ID != nil { + objectMap["id"] = pec.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pec.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + } + } + + return nil +} + +// PrivateEndpointConnectionListResult response for the ListPrivateEndpointConnection API service call. +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - A list of PrivateEndpointConnection resources for a specific private link service. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. +func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peclr.Value != nil { + objectMap["value"] = peclr.Value + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionListResultIterator provides access to a complete listing of +// PrivateEndpointConnection values. +type PrivateEndpointConnectionListResultIterator struct { + i int + page PrivateEndpointConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateEndpointConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { + if !iter.page.NotDone() { + return PrivateEndpointConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. +func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { + return PrivateEndpointConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { + return peclr.Value == nil || len(*peclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { + return peclr.NextLink != nil && len(*peclr.NextLink) != 0 +} + +// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !peclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(peclr.NextLink))) +} + +// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. +type PrivateEndpointConnectionListResultPage struct { + fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) + peclr PrivateEndpointConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.peclr) + if err != nil { + return err + } + page.peclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateEndpointConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateEndpointConnectionListResultPage) NotDone() bool { + return !page.peclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { + return page.peclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { + if page.peclr.IsEmpty() { + return nil + } + return *page.peclr.Value +} + +// Creates a new instance of the PrivateEndpointConnectionListResultPage type. +func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { + return PrivateEndpointConnectionListResultPage{ + fn: getNextPage, + peclr: cur, + } +} + +// PrivateEndpointConnectionProperties properties of the PrivateEndpointConnectProperties. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - READ-ONLY; The resource of private end point. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the private endpoint connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // LinkIdentifier - READ-ONLY; The consumer link id. + LinkIdentifier *string `json:"linkIdentifier,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. +func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// PrivateEndpointIPConfiguration an IP Configuration of the private endpoint. +type PrivateEndpointIPConfiguration struct { + // PrivateEndpointIPConfigurationProperties - Properties of private endpoint IP configurations. + *PrivateEndpointIPConfigurationProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointIPConfiguration. +func (peic PrivateEndpointIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peic.PrivateEndpointIPConfigurationProperties != nil { + objectMap["properties"] = peic.PrivateEndpointIPConfigurationProperties + } + if peic.Name != nil { + objectMap["name"] = peic.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointIPConfiguration struct. +func (peic *PrivateEndpointIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateEndpointIPConfigurationProperties PrivateEndpointIPConfigurationProperties + err = json.Unmarshal(*v, &privateEndpointIPConfigurationProperties) + if err != nil { + return err + } + peic.PrivateEndpointIPConfigurationProperties = &privateEndpointIPConfigurationProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + peic.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + peic.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + peic.Etag = &etag + } + } + } + + return nil +} + +// PrivateEndpointIPConfigurationProperties properties of an IP Configuration of the private endpoint. +type PrivateEndpointIPConfigurationProperties struct { + // GroupID - The ID of a group obtained from the remote resource that this private endpoint should connect to. + GroupID *string `json:"groupId,omitempty"` + // MemberName - The member name of a group obtained from the remote resource that this private endpoint should connect to. + MemberName *string `json:"memberName,omitempty"` + // PrivateIPAddress - A private ip address obtained from the private endpoint's subnet. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` +} + +// PrivateEndpointListResult response for the ListPrivateEndpoints API service call. +type PrivateEndpointListResult struct { + autorest.Response `json:"-"` + // Value - A list of private endpoint resources in a resource group. + Value *[]PrivateEndpoint `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointListResult. +func (pelr PrivateEndpointListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pelr.Value != nil { + objectMap["value"] = pelr.Value + } + return json.Marshal(objectMap) +} + +// PrivateEndpointListResultIterator provides access to a complete listing of PrivateEndpoint values. +type PrivateEndpointListResultIterator struct { + i int + page PrivateEndpointListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateEndpointListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateEndpointListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateEndpointListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateEndpointListResultIterator) Response() PrivateEndpointListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateEndpointListResultIterator) Value() PrivateEndpoint { + if !iter.page.NotDone() { + return PrivateEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateEndpointListResultIterator type. +func NewPrivateEndpointListResultIterator(page PrivateEndpointListResultPage) PrivateEndpointListResultIterator { + return PrivateEndpointListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pelr PrivateEndpointListResult) IsEmpty() bool { + return pelr.Value == nil || len(*pelr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pelr PrivateEndpointListResult) hasNextLink() bool { + return pelr.NextLink != nil && len(*pelr.NextLink) != 0 +} + +// privateEndpointListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pelr PrivateEndpointListResult) privateEndpointListResultPreparer(ctx context.Context) (*http.Request, error) { + if !pelr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pelr.NextLink))) +} + +// PrivateEndpointListResultPage contains a page of PrivateEndpoint values. +type PrivateEndpointListResultPage struct { + fn func(context.Context, PrivateEndpointListResult) (PrivateEndpointListResult, error) + pelr PrivateEndpointListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateEndpointListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pelr) + if err != nil { + return err + } + page.pelr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateEndpointListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateEndpointListResultPage) NotDone() bool { + return !page.pelr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateEndpointListResultPage) Response() PrivateEndpointListResult { + return page.pelr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateEndpointListResultPage) Values() []PrivateEndpoint { + if page.pelr.IsEmpty() { + return nil + } + return *page.pelr.Value +} + +// Creates a new instance of the PrivateEndpointListResultPage type. +func NewPrivateEndpointListResultPage(cur PrivateEndpointListResult, getNextPage func(context.Context, PrivateEndpointListResult) (PrivateEndpointListResult, error)) PrivateEndpointListResultPage { + return PrivateEndpointListResultPage{ + fn: getNextPage, + pelr: cur, + } +} + +// PrivateEndpointProperties properties of the private endpoint. +type PrivateEndpointProperties struct { + // Subnet - The ID of the subnet from which the private IP will be allocated. + Subnet *Subnet `json:"subnet,omitempty"` + // NetworkInterfaces - READ-ONLY; An array of references to the network interfaces created for this private endpoint. + NetworkInterfaces *[]Interface `json:"networkInterfaces,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the private endpoint resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateLinkServiceConnections - A grouping of information about the connection to the remote resource. + PrivateLinkServiceConnections *[]PrivateLinkServiceConnection `json:"privateLinkServiceConnections,omitempty"` + // ManualPrivateLinkServiceConnections - 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. + ManualPrivateLinkServiceConnections *[]PrivateLinkServiceConnection `json:"manualPrivateLinkServiceConnections,omitempty"` + // CustomDNSConfigs - An array of custom dns configurations. + CustomDNSConfigs *[]CustomDNSConfigPropertiesFormat `json:"customDnsConfigs,omitempty"` + // ApplicationSecurityGroups - Application security groups in which the private endpoint IP configuration is included. + ApplicationSecurityGroups *[]ApplicationSecurityGroup `json:"applicationSecurityGroups,omitempty"` + // IPConfigurations - A list of IP configurations of the private endpoint. This will be used to map to the First Party Service's endpoints. + IPConfigurations *[]PrivateEndpointIPConfiguration `json:"ipConfigurations,omitempty"` + // CustomNetworkInterfaceName - The custom name of the network interface attached to the private endpoint. + CustomNetworkInterfaceName *string `json:"customNetworkInterfaceName,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointProperties. +func (pep PrivateEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pep.Subnet != nil { + objectMap["subnet"] = pep.Subnet + } + if pep.PrivateLinkServiceConnections != nil { + objectMap["privateLinkServiceConnections"] = pep.PrivateLinkServiceConnections + } + if pep.ManualPrivateLinkServiceConnections != nil { + objectMap["manualPrivateLinkServiceConnections"] = pep.ManualPrivateLinkServiceConnections + } + if pep.CustomDNSConfigs != nil { + objectMap["customDnsConfigs"] = pep.CustomDNSConfigs + } + if pep.ApplicationSecurityGroups != nil { + objectMap["applicationSecurityGroups"] = pep.ApplicationSecurityGroups + } + if pep.IPConfigurations != nil { + objectMap["ipConfigurations"] = pep.IPConfigurations + } + if pep.CustomNetworkInterfaceName != nil { + objectMap["customNetworkInterfaceName"] = pep.CustomNetworkInterfaceName + } + return json.Marshal(objectMap) +} + +// PrivateEndpointsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointsClient) (PrivateEndpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointsCreateOrUpdateFuture.Result. +func (future *PrivateEndpointsCreateOrUpdateFuture) result(client PrivateEndpointsClient) (peVar PrivateEndpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + peVar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateEndpointsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if peVar.Response.Response, err = future.GetResult(sender); err == nil && peVar.Response.Response.StatusCode != http.StatusNoContent { + peVar, err = client.CreateOrUpdateResponder(peVar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsCreateOrUpdateFuture", "Result", peVar.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateEndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PrivateEndpointsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointsDeleteFuture.Result. +func (future *PrivateEndpointsDeleteFuture) result(client PrivateEndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateEndpointsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkService private link service resource. +type PrivateLinkService struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the load balancer. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // PrivateLinkServiceProperties - Properties of the private link service. + *PrivateLinkServiceProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkService. +func (pls PrivateLinkService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pls.ExtendedLocation != nil { + objectMap["extendedLocation"] = pls.ExtendedLocation + } + if pls.PrivateLinkServiceProperties != nil { + objectMap["properties"] = pls.PrivateLinkServiceProperties + } + if pls.ID != nil { + objectMap["id"] = pls.ID + } + if pls.Location != nil { + objectMap["location"] = pls.Location + } + if pls.Tags != nil { + objectMap["tags"] = pls.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkService struct. +func (pls *PrivateLinkService) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + pls.ExtendedLocation = &extendedLocation + } + case "properties": + if v != nil { + var privateLinkServiceProperties PrivateLinkServiceProperties + err = json.Unmarshal(*v, &privateLinkServiceProperties) + if err != nil { + return err + } + pls.PrivateLinkServiceProperties = &privateLinkServiceProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pls.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pls.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pls.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pls.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pls.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pls.Tags = tags + } + } + } + + return nil +} + +// PrivateLinkServiceConnection privateLinkServiceConnection resource. +type PrivateLinkServiceConnection struct { + // PrivateLinkServiceConnectionProperties - Properties of the private link service connection. + *PrivateLinkServiceConnectionProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceConnection. +func (plsc PrivateLinkServiceConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plsc.PrivateLinkServiceConnectionProperties != nil { + objectMap["properties"] = plsc.PrivateLinkServiceConnectionProperties + } + if plsc.Name != nil { + objectMap["name"] = plsc.Name + } + if plsc.ID != nil { + objectMap["id"] = plsc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkServiceConnection struct. +func (plsc *PrivateLinkServiceConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkServiceConnectionProperties PrivateLinkServiceConnectionProperties + err = json.Unmarshal(*v, &privateLinkServiceConnectionProperties) + if err != nil { + return err + } + plsc.PrivateLinkServiceConnectionProperties = &privateLinkServiceConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plsc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plsc.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + plsc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plsc.ID = &ID + } + } + } + + return nil +} + +// PrivateLinkServiceConnectionProperties properties of the PrivateLinkServiceConnection. +type PrivateLinkServiceConnectionProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the private link service connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateLinkServiceID - The resource id of private link service. + PrivateLinkServiceID *string `json:"privateLinkServiceId,omitempty"` + // GroupIds - The ID(s) of the group(s) obtained from the remote resource that this private endpoint should connect to. + GroupIds *[]string `json:"groupIds,omitempty"` + // RequestMessage - A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars. + RequestMessage *string `json:"requestMessage,omitempty"` + // PrivateLinkServiceConnectionState - A collection of read-only information about the state of the connection to the remote resource. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionProperties. +func (plscp PrivateLinkServiceConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plscp.PrivateLinkServiceID != nil { + objectMap["privateLinkServiceId"] = plscp.PrivateLinkServiceID + } + if plscp.GroupIds != nil { + objectMap["groupIds"] = plscp.GroupIds + } + if plscp.RequestMessage != nil { + objectMap["requestMessage"] = plscp.RequestMessage + } + if plscp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = plscp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// PrivateLinkServiceConnectionState a collection of information about the state of the connection between +// service consumer and provider. +type PrivateLinkServiceConnectionState struct { + // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *string `json:"status,omitempty"` + // Description - The reason for approval/rejection of the connection. + Description *string `json:"description,omitempty"` + // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// PrivateLinkServiceIPConfiguration the private link service ip configuration. +type PrivateLinkServiceIPConfiguration struct { + // PrivateLinkServiceIPConfigurationProperties - Properties of the private link service ip configuration. + *PrivateLinkServiceIPConfigurationProperties `json:"properties,omitempty"` + // Name - The name of private link service ip configuration. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceIPConfiguration. +func (plsic PrivateLinkServiceIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plsic.PrivateLinkServiceIPConfigurationProperties != nil { + objectMap["properties"] = plsic.PrivateLinkServiceIPConfigurationProperties + } + if plsic.Name != nil { + objectMap["name"] = plsic.Name + } + if plsic.ID != nil { + objectMap["id"] = plsic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkServiceIPConfiguration struct. +func (plsic *PrivateLinkServiceIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkServiceIPConfigurationProperties PrivateLinkServiceIPConfigurationProperties + err = json.Unmarshal(*v, &privateLinkServiceIPConfigurationProperties) + if err != nil { + return err + } + plsic.PrivateLinkServiceIPConfigurationProperties = &privateLinkServiceIPConfigurationProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plsic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + plsic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plsic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plsic.ID = &ID + } + } + } + + return nil +} + +// PrivateLinkServiceIPConfigurationProperties properties of private link service IP configuration. +type PrivateLinkServiceIPConfigurationProperties struct { + // PrivateIPAddress - The private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // Subnet - The reference to the subnet resource. + Subnet *Subnet `json:"subnet,omitempty"` + // Primary - Whether the ip configuration is primary or not. + Primary *bool `json:"primary,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the private link service IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateIPAddressVersion - Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' + PrivateIPAddressVersion IPVersion `json:"privateIPAddressVersion,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceIPConfigurationProperties. +func (plsicp PrivateLinkServiceIPConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plsicp.PrivateIPAddress != nil { + objectMap["privateIPAddress"] = plsicp.PrivateIPAddress + } + if plsicp.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = plsicp.PrivateIPAllocationMethod + } + if plsicp.Subnet != nil { + objectMap["subnet"] = plsicp.Subnet + } + if plsicp.Primary != nil { + objectMap["primary"] = plsicp.Primary + } + if plsicp.PrivateIPAddressVersion != "" { + objectMap["privateIPAddressVersion"] = plsicp.PrivateIPAddressVersion + } + return json.Marshal(objectMap) +} + +// PrivateLinkServiceListResult response for the ListPrivateLinkService API service call. +type PrivateLinkServiceListResult struct { + autorest.Response `json:"-"` + // Value - A list of PrivateLinkService resources in a resource group. + Value *[]PrivateLinkService `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceListResult. +func (plslr PrivateLinkServiceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plslr.Value != nil { + objectMap["value"] = plslr.Value + } + return json.Marshal(objectMap) +} + +// PrivateLinkServiceListResultIterator provides access to a complete listing of PrivateLinkService values. +type PrivateLinkServiceListResultIterator struct { + i int + page PrivateLinkServiceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateLinkServiceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServiceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateLinkServiceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateLinkServiceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateLinkServiceListResultIterator) Response() PrivateLinkServiceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateLinkServiceListResultIterator) Value() PrivateLinkService { + if !iter.page.NotDone() { + return PrivateLinkService{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateLinkServiceListResultIterator type. +func NewPrivateLinkServiceListResultIterator(page PrivateLinkServiceListResultPage) PrivateLinkServiceListResultIterator { + return PrivateLinkServiceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plslr PrivateLinkServiceListResult) IsEmpty() bool { + return plslr.Value == nil || len(*plslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (plslr PrivateLinkServiceListResult) hasNextLink() bool { + return plslr.NextLink != nil && len(*plslr.NextLink) != 0 +} + +// privateLinkServiceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plslr PrivateLinkServiceListResult) privateLinkServiceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !plslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plslr.NextLink))) +} + +// PrivateLinkServiceListResultPage contains a page of PrivateLinkService values. +type PrivateLinkServiceListResultPage struct { + fn func(context.Context, PrivateLinkServiceListResult) (PrivateLinkServiceListResult, error) + plslr PrivateLinkServiceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateLinkServiceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServiceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.plslr) + if err != nil { + return err + } + page.plslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateLinkServiceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateLinkServiceListResultPage) NotDone() bool { + return !page.plslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateLinkServiceListResultPage) Response() PrivateLinkServiceListResult { + return page.plslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateLinkServiceListResultPage) Values() []PrivateLinkService { + if page.plslr.IsEmpty() { + return nil + } + return *page.plslr.Value +} + +// Creates a new instance of the PrivateLinkServiceListResultPage type. +func NewPrivateLinkServiceListResultPage(cur PrivateLinkServiceListResult, getNextPage func(context.Context, PrivateLinkServiceListResult) (PrivateLinkServiceListResult, error)) PrivateLinkServiceListResultPage { + return PrivateLinkServiceListResultPage{ + fn: getNextPage, + plslr: cur, + } +} + +// PrivateLinkServiceProperties properties of the private link service. +type PrivateLinkServiceProperties struct { + // LoadBalancerFrontendIPConfigurations - An array of references to the load balancer IP configurations. + LoadBalancerFrontendIPConfigurations *[]FrontendIPConfiguration `json:"loadBalancerFrontendIpConfigurations,omitempty"` + // IPConfigurations - An array of private link service IP configurations. + IPConfigurations *[]PrivateLinkServiceIPConfiguration `json:"ipConfigurations,omitempty"` + // NetworkInterfaces - READ-ONLY; An array of references to the network interfaces created for this private link service. + NetworkInterfaces *[]Interface `json:"networkInterfaces,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the private link service resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateEndpointConnections - READ-ONLY; An array of list about connections to the private endpoint. + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // Visibility - The visibility list of the private link service. + Visibility *PrivateLinkServicePropertiesVisibility `json:"visibility,omitempty"` + // AutoApproval - The auto-approval list of the private link service. + AutoApproval *PrivateLinkServicePropertiesAutoApproval `json:"autoApproval,omitempty"` + // Fqdns - The list of Fqdn. + Fqdns *[]string `json:"fqdns,omitempty"` + // Alias - READ-ONLY; The alias of the private link service. + Alias *string `json:"alias,omitempty"` + // EnableProxyProtocol - Whether the private link service is enabled for proxy protocol or not. + EnableProxyProtocol *bool `json:"enableProxyProtocol,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceProperties. +func (plsp PrivateLinkServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plsp.LoadBalancerFrontendIPConfigurations != nil { + objectMap["loadBalancerFrontendIpConfigurations"] = plsp.LoadBalancerFrontendIPConfigurations + } + if plsp.IPConfigurations != nil { + objectMap["ipConfigurations"] = plsp.IPConfigurations + } + if plsp.Visibility != nil { + objectMap["visibility"] = plsp.Visibility + } + if plsp.AutoApproval != nil { + objectMap["autoApproval"] = plsp.AutoApproval + } + if plsp.Fqdns != nil { + objectMap["fqdns"] = plsp.Fqdns + } + if plsp.EnableProxyProtocol != nil { + objectMap["enableProxyProtocol"] = plsp.EnableProxyProtocol + } + return json.Marshal(objectMap) +} + +// PrivateLinkServicePropertiesAutoApproval the auto-approval list of the private link service. +type PrivateLinkServicePropertiesAutoApproval struct { + // Subscriptions - The list of subscriptions. + Subscriptions *[]string `json:"subscriptions,omitempty"` +} + +// PrivateLinkServicePropertiesVisibility the visibility list of the private link service. +type PrivateLinkServicePropertiesVisibility struct { + // Subscriptions - The list of subscriptions. + Subscriptions *[]string `json:"subscriptions,omitempty"` +} + +// PrivateLinkServiceVisibility response for the CheckPrivateLinkServiceVisibility API service call. +type PrivateLinkServiceVisibility struct { + autorest.Response `json:"-"` + // Visible - Private Link Service Visibility (True/False). + Visible *bool `json:"visible,omitempty"` +} + +// PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture an abstraction for monitoring +// and retrieving the results of a long-running operation. +type PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkServicesClient) (PrivateLinkServiceVisibility, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture.Result. +func (future *PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture) result(client PrivateLinkServicesClient) (plsv PrivateLinkServiceVisibility, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + plsv.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if plsv.Response.Response, err = future.GetResult(sender); err == nil && plsv.Response.Response.StatusCode != http.StatusNoContent { + plsv, err = client.CheckPrivateLinkServiceVisibilityByResourceGroupResponder(plsv.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture", "Result", plsv.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkServicesClient) (PrivateLinkServiceVisibility, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture.Result. +func (future *PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture) result(client PrivateLinkServicesClient) (plsv PrivateLinkServiceVisibility, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + plsv.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if plsv.Response.Response, err = future.GetResult(sender); err == nil && plsv.Response.Response.StatusCode != http.StatusNoContent { + plsv, err = client.CheckPrivateLinkServiceVisibilityResponder(plsv.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture", "Result", plsv.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateLinkServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateLinkServicesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkServicesClient) (PrivateLinkService, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateLinkServicesCreateOrUpdateFuture.Result. +func (future *PrivateLinkServicesCreateOrUpdateFuture) result(client PrivateLinkServicesClient) (pls PrivateLinkService, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pls.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateLinkServicesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pls.Response.Response, err = future.GetResult(sender); err == nil && pls.Response.Response.StatusCode != http.StatusNoContent { + pls, err = client.CreateOrUpdateResponder(pls.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCreateOrUpdateFuture", "Result", pls.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateLinkServicesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateLinkServicesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkServicesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkServicesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateLinkServicesDeleteFuture.Result. +func (future *PrivateLinkServicesDeleteFuture) result(client PrivateLinkServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateLinkServicesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkServicesDeletePrivateEndpointConnectionFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type PrivateLinkServicesDeletePrivateEndpointConnectionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkServicesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkServicesDeletePrivateEndpointConnectionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateLinkServicesDeletePrivateEndpointConnectionFuture.Result. +func (future *PrivateLinkServicesDeletePrivateEndpointConnectionFuture) result(client PrivateLinkServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesDeletePrivateEndpointConnectionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateLinkServicesDeletePrivateEndpointConnectionFuture") + return + } + ar.Response = future.Response() + return +} + +// Probe a load balancer probe. +type Probe struct { + autorest.Response `json:"-"` + // ProbePropertiesFormat - Properties of load balancer probe. + *ProbePropertiesFormat `json:"properties,omitempty"` + // Name - 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. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for Probe. +func (p Probe) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.ProbePropertiesFormat != nil { + objectMap["properties"] = p.ProbePropertiesFormat + } + if p.Name != nil { + objectMap["name"] = p.Name + } + if p.ID != nil { + objectMap["id"] = p.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Probe struct. +func (p *Probe) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var probePropertiesFormat ProbePropertiesFormat + err = json.Unmarshal(*v, &probePropertiesFormat) + if err != nil { + return err + } + p.ProbePropertiesFormat = &probePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + p.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + p.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + p.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + p.ID = &ID + } + } + } + + return nil +} + +// ProbePropertiesFormat load balancer probe resource. +type ProbePropertiesFormat struct { + // LoadBalancingRules - READ-ONLY; The load balancer rules that use this probe. + LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` + // Protocol - 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. Possible values include: 'ProbeProtocolHTTP', 'ProbeProtocolTCP', 'ProbeProtocolHTTPS' + Protocol ProbeProtocol `json:"protocol,omitempty"` + // Port - The port for communicating the probe. Possible values range from 1 to 65535, inclusive. + Port *int32 `json:"port,omitempty"` + // IntervalInSeconds - 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. + IntervalInSeconds *int32 `json:"intervalInSeconds,omitempty"` + // NumberOfProbes - 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. + NumberOfProbes *int32 `json:"numberOfProbes,omitempty"` + // ProbeThreshold - The number of consecutive successful or failed probes in order to allow or deny traffic from being delivered to this endpoint. After failing the number of consecutive probes equal to this value, the endpoint will be taken out of rotation and require the same number of successful consecutive probes to be placed back in rotation. + ProbeThreshold *int32 `json:"probeThreshold,omitempty"` + // RequestPath - 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. + RequestPath *string `json:"requestPath,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the probe resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProbePropertiesFormat. +func (ppf ProbePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ppf.Protocol != "" { + objectMap["protocol"] = ppf.Protocol + } + if ppf.Port != nil { + objectMap["port"] = ppf.Port + } + if ppf.IntervalInSeconds != nil { + objectMap["intervalInSeconds"] = ppf.IntervalInSeconds + } + if ppf.NumberOfProbes != nil { + objectMap["numberOfProbes"] = ppf.NumberOfProbes + } + if ppf.ProbeThreshold != nil { + objectMap["probeThreshold"] = ppf.ProbeThreshold + } + if ppf.RequestPath != nil { + objectMap["requestPath"] = ppf.RequestPath + } + return json.Marshal(objectMap) +} + +// Profile network profile resource. +type Profile struct { + autorest.Response `json:"-"` + // ProfilePropertiesFormat - Network profile properties. + *ProfilePropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Profile. +func (p Profile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.ProfilePropertiesFormat != nil { + objectMap["properties"] = p.ProfilePropertiesFormat + } + if p.ID != nil { + objectMap["id"] = p.ID + } + if p.Location != nil { + objectMap["location"] = p.Location + } + if p.Tags != nil { + objectMap["tags"] = p.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Profile struct. +func (p *Profile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var profilePropertiesFormat ProfilePropertiesFormat + err = json.Unmarshal(*v, &profilePropertiesFormat) + if err != nil { + return err + } + p.ProfilePropertiesFormat = &profilePropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + p.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + p.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + p.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + p.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + p.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + p.Tags = tags + } + } + } + + return nil +} + +// ProfileListResult response for ListNetworkProfiles API service call. +type ProfileListResult struct { + autorest.Response `json:"-"` + // Value - A list of network profiles that exist in a resource group. + Value *[]Profile `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ProfileListResultIterator provides access to a complete listing of Profile values. +type ProfileListResultIterator struct { + i int + page ProfileListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ProfileListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ProfileListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ProfileListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ProfileListResultIterator) Response() ProfileListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ProfileListResultIterator) Value() Profile { + if !iter.page.NotDone() { + return Profile{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ProfileListResultIterator type. +func NewProfileListResultIterator(page ProfileListResultPage) ProfileListResultIterator { + return ProfileListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plr ProfileListResult) IsEmpty() bool { + return plr.Value == nil || len(*plr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (plr ProfileListResult) hasNextLink() bool { + return plr.NextLink != nil && len(*plr.NextLink) != 0 +} + +// profileListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plr ProfileListResult) profileListResultPreparer(ctx context.Context) (*http.Request, error) { + if !plr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plr.NextLink))) +} + +// ProfileListResultPage contains a page of Profile values. +type ProfileListResultPage struct { + fn func(context.Context, ProfileListResult) (ProfileListResult, error) + plr ProfileListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ProfileListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.plr) + if err != nil { + return err + } + page.plr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ProfileListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ProfileListResultPage) NotDone() bool { + return !page.plr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ProfileListResultPage) Response() ProfileListResult { + return page.plr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ProfileListResultPage) Values() []Profile { + if page.plr.IsEmpty() { + return nil + } + return *page.plr.Value +} + +// Creates a new instance of the ProfileListResultPage type. +func NewProfileListResultPage(cur ProfileListResult, getNextPage func(context.Context, ProfileListResult) (ProfileListResult, error)) ProfileListResultPage { + return ProfileListResultPage{ + fn: getNextPage, + plr: cur, + } +} + +// ProfilePropertiesFormat network profile properties. +type ProfilePropertiesFormat struct { + // ContainerNetworkInterfaces - READ-ONLY; List of child container network interfaces. + ContainerNetworkInterfaces *[]ContainerNetworkInterface `json:"containerNetworkInterfaces,omitempty"` + // ContainerNetworkInterfaceConfigurations - List of chid container network interface configurations. + ContainerNetworkInterfaceConfigurations *[]ContainerNetworkInterfaceConfiguration `json:"containerNetworkInterfaceConfigurations,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the network profile resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the network profile resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProfilePropertiesFormat. +func (ppf ProfilePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ppf.ContainerNetworkInterfaceConfigurations != nil { + objectMap["containerNetworkInterfaceConfigurations"] = ppf.ContainerNetworkInterfaceConfigurations + } + return json.Marshal(objectMap) +} + +// ProfilesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ProfilesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ProfilesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ProfilesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ProfilesDeleteFuture.Result. +func (future *ProfilesDeleteFuture) result(client ProfilesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ProfilesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PropagatedRouteTable the list of RouteTables to advertise the routes to. +type PropagatedRouteTable struct { + // Labels - The list of labels. + Labels *[]string `json:"labels,omitempty"` + // Ids - The list of resource ids of all the RouteTables. + Ids *[]SubResource `json:"ids,omitempty"` +} + +// ProtocolConfiguration configuration of the protocol. +type ProtocolConfiguration struct { + // HTTPConfiguration - HTTP configuration of the connectivity check. + HTTPConfiguration *HTTPConfiguration `json:"HTTPConfiguration,omitempty"` +} + +// PublicIPAddress public IP address resource. +type PublicIPAddress struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the public ip address. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Sku - The public IP address SKU. + Sku *PublicIPAddressSku `json:"sku,omitempty"` + // PublicIPAddressPropertiesFormat - Public IP address properties. + *PublicIPAddressPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Zones - A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones *[]string `json:"zones,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PublicIPAddress. +func (pia PublicIPAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pia.ExtendedLocation != nil { + objectMap["extendedLocation"] = pia.ExtendedLocation + } + if pia.Sku != nil { + objectMap["sku"] = pia.Sku + } + if pia.PublicIPAddressPropertiesFormat != nil { + objectMap["properties"] = pia.PublicIPAddressPropertiesFormat + } + if pia.Zones != nil { + objectMap["zones"] = pia.Zones + } + if pia.ID != nil { + objectMap["id"] = pia.ID + } + if pia.Location != nil { + objectMap["location"] = pia.Location + } + if pia.Tags != nil { + objectMap["tags"] = pia.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PublicIPAddress struct. +func (pia *PublicIPAddress) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + pia.ExtendedLocation = &extendedLocation + } + case "sku": + if v != nil { + var sku PublicIPAddressSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + pia.Sku = &sku + } + case "properties": + if v != nil { + var publicIPAddressPropertiesFormat PublicIPAddressPropertiesFormat + err = json.Unmarshal(*v, &publicIPAddressPropertiesFormat) + if err != nil { + return err + } + pia.PublicIPAddressPropertiesFormat = &publicIPAddressPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pia.Etag = &etag + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + pia.Zones = &zones + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pia.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pia.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pia.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pia.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pia.Tags = tags + } + } + } + + return nil +} + +// PublicIPAddressDNSSettings contains FQDN of the DNS record associated with the public IP address. +type PublicIPAddressDNSSettings struct { + // DomainNameLabel - 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. + DomainNameLabel *string `json:"domainNameLabel,omitempty"` + // Fqdn - 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. + Fqdn *string `json:"fqdn,omitempty"` + // ReverseFqdn - 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. + ReverseFqdn *string `json:"reverseFqdn,omitempty"` +} + +// PublicIPAddressListResult response for ListPublicIpAddresses API service call. +type PublicIPAddressListResult struct { + autorest.Response `json:"-"` + // Value - A list of public IP addresses that exists in a resource group. + Value *[]PublicIPAddress `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// PublicIPAddressListResultIterator provides access to a complete listing of PublicIPAddress values. +type PublicIPAddressListResultIterator struct { + i int + page PublicIPAddressListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PublicIPAddressListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PublicIPAddressListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PublicIPAddressListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PublicIPAddressListResultIterator) Response() PublicIPAddressListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PublicIPAddressListResultIterator) Value() PublicIPAddress { + if !iter.page.NotDone() { + return PublicIPAddress{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PublicIPAddressListResultIterator type. +func NewPublicIPAddressListResultIterator(page PublicIPAddressListResultPage) PublicIPAddressListResultIterator { + return PublicIPAddressListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pialr PublicIPAddressListResult) IsEmpty() bool { + return pialr.Value == nil || len(*pialr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pialr PublicIPAddressListResult) hasNextLink() bool { + return pialr.NextLink != nil && len(*pialr.NextLink) != 0 +} + +// publicIPAddressListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pialr PublicIPAddressListResult) publicIPAddressListResultPreparer(ctx context.Context) (*http.Request, error) { + if !pialr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pialr.NextLink))) +} + +// PublicIPAddressListResultPage contains a page of PublicIPAddress values. +type PublicIPAddressListResultPage struct { + fn func(context.Context, PublicIPAddressListResult) (PublicIPAddressListResult, error) + pialr PublicIPAddressListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PublicIPAddressListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pialr) + if err != nil { + return err + } + page.pialr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PublicIPAddressListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PublicIPAddressListResultPage) NotDone() bool { + return !page.pialr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PublicIPAddressListResultPage) Response() PublicIPAddressListResult { + return page.pialr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PublicIPAddressListResultPage) Values() []PublicIPAddress { + if page.pialr.IsEmpty() { + return nil + } + return *page.pialr.Value +} + +// Creates a new instance of the PublicIPAddressListResultPage type. +func NewPublicIPAddressListResultPage(cur PublicIPAddressListResult, getNextPage func(context.Context, PublicIPAddressListResult) (PublicIPAddressListResult, error)) PublicIPAddressListResultPage { + return PublicIPAddressListResultPage{ + fn: getNextPage, + pialr: cur, + } +} + +// PublicIPAddressPropertiesFormat public IP address properties. +type PublicIPAddressPropertiesFormat struct { + // PublicIPAllocationMethod - The public IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PublicIPAllocationMethod IPAllocationMethod `json:"publicIPAllocationMethod,omitempty"` + // PublicIPAddressVersion - The public IP address version. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' + PublicIPAddressVersion IPVersion `json:"publicIPAddressVersion,omitempty"` + // IPConfiguration - READ-ONLY; The IP configuration associated with the public IP address. + IPConfiguration *IPConfiguration `json:"ipConfiguration,omitempty"` + // DNSSettings - The FQDN of the DNS record associated with the public IP address. + DNSSettings *PublicIPAddressDNSSettings `json:"dnsSettings,omitempty"` + // DdosSettings - The DDoS protection custom policy associated with the public IP address. + DdosSettings *DdosSettings `json:"ddosSettings,omitempty"` + // IPTags - The list of tags associated with the public IP address. + IPTags *[]IPTag `json:"ipTags,omitempty"` + // IPAddress - The IP address associated with the public IP address resource. + IPAddress *string `json:"ipAddress,omitempty"` + // PublicIPPrefix - The Public IP Prefix this Public IP Address should be allocated from. + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` + // IdleTimeoutInMinutes - The idle timeout of the public IP address. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the public IP address resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the public IP address resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ServicePublicIPAddress - The service public IP address of the public IP address resource. + ServicePublicIPAddress *PublicIPAddress `json:"servicePublicIPAddress,omitempty"` + // NatGateway - The NatGateway for the Public IP address. + NatGateway *NatGateway `json:"natGateway,omitempty"` + // MigrationPhase - Migration phase of Public IP Address. Possible values include: 'PublicIPAddressMigrationPhaseNone', 'PublicIPAddressMigrationPhasePrepare', 'PublicIPAddressMigrationPhaseCommit', 'PublicIPAddressMigrationPhaseAbort', 'PublicIPAddressMigrationPhaseCommitted' + MigrationPhase PublicIPAddressMigrationPhase `json:"migrationPhase,omitempty"` + // LinkedPublicIPAddress - The linked public IP address of the public IP address resource. + LinkedPublicIPAddress *PublicIPAddress `json:"linkedPublicIPAddress,omitempty"` + // DeleteOption - Specify what happens to the public IP address when the VM using it is deleted. Possible values include: 'DeleteOptionsDelete', 'DeleteOptionsDetach' + DeleteOption DeleteOptions `json:"deleteOption,omitempty"` +} + +// MarshalJSON is the custom marshaler for PublicIPAddressPropertiesFormat. +func (piapf PublicIPAddressPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if piapf.PublicIPAllocationMethod != "" { + objectMap["publicIPAllocationMethod"] = piapf.PublicIPAllocationMethod + } + if piapf.PublicIPAddressVersion != "" { + objectMap["publicIPAddressVersion"] = piapf.PublicIPAddressVersion + } + if piapf.DNSSettings != nil { + objectMap["dnsSettings"] = piapf.DNSSettings + } + if piapf.DdosSettings != nil { + objectMap["ddosSettings"] = piapf.DdosSettings + } + if piapf.IPTags != nil { + objectMap["ipTags"] = piapf.IPTags + } + if piapf.IPAddress != nil { + objectMap["ipAddress"] = piapf.IPAddress + } + if piapf.PublicIPPrefix != nil { + objectMap["publicIPPrefix"] = piapf.PublicIPPrefix + } + if piapf.IdleTimeoutInMinutes != nil { + objectMap["idleTimeoutInMinutes"] = piapf.IdleTimeoutInMinutes + } + if piapf.ServicePublicIPAddress != nil { + objectMap["servicePublicIPAddress"] = piapf.ServicePublicIPAddress + } + if piapf.NatGateway != nil { + objectMap["natGateway"] = piapf.NatGateway + } + if piapf.MigrationPhase != "" { + objectMap["migrationPhase"] = piapf.MigrationPhase + } + if piapf.LinkedPublicIPAddress != nil { + objectMap["linkedPublicIPAddress"] = piapf.LinkedPublicIPAddress + } + if piapf.DeleteOption != "" { + objectMap["deleteOption"] = piapf.DeleteOption + } + return json.Marshal(objectMap) +} + +// PublicIPAddressSku SKU of a public IP address. +type PublicIPAddressSku struct { + // Name - Name of a public IP address SKU. Possible values include: 'PublicIPAddressSkuNameBasic', 'PublicIPAddressSkuNameStandard' + Name PublicIPAddressSkuName `json:"name,omitempty"` + // Tier - Tier of a public IP address SKU. Possible values include: 'PublicIPAddressSkuTierRegional', 'PublicIPAddressSkuTierGlobal' + Tier PublicIPAddressSkuTier `json:"tier,omitempty"` +} + +// PublicIPAddressesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PublicIPAddressesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PublicIPAddressesClient) (PublicIPAddress, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PublicIPAddressesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PublicIPAddressesCreateOrUpdateFuture.Result. +func (future *PublicIPAddressesCreateOrUpdateFuture) result(client PublicIPAddressesClient) (pia PublicIPAddress, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pia.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pia.Response.Response, err = future.GetResult(sender); err == nil && pia.Response.Response.StatusCode != http.StatusNoContent { + pia, err = client.CreateOrUpdateResponder(pia.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", pia.Response.Response, "Failure responding to request") + } + } + return +} + +// PublicIPAddressesDdosProtectionStatusFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type PublicIPAddressesDdosProtectionStatusFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PublicIPAddressesClient) (PublicIPDdosProtectionStatusResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PublicIPAddressesDdosProtectionStatusFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PublicIPAddressesDdosProtectionStatusFuture.Result. +func (future *PublicIPAddressesDdosProtectionStatusFuture) result(client PublicIPAddressesClient) (pidpsr PublicIPDdosProtectionStatusResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesDdosProtectionStatusFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pidpsr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesDdosProtectionStatusFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pidpsr.Response.Response, err = future.GetResult(sender); err == nil && pidpsr.Response.Response.StatusCode != http.StatusNoContent { + pidpsr, err = client.DdosProtectionStatusResponder(pidpsr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesDdosProtectionStatusFuture", "Result", pidpsr.Response.Response, "Failure responding to request") + } + } + return +} + +// PublicIPAddressesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PublicIPAddressesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PublicIPAddressesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PublicIPAddressesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PublicIPAddressesDeleteFuture.Result. +func (future *PublicIPAddressesDeleteFuture) result(client PublicIPAddressesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PublicIPDdosProtectionStatusResult response for GetPublicIpAddressDdosProtectionStatusOperation API +// service call. +type PublicIPDdosProtectionStatusResult struct { + autorest.Response `json:"-"` + // PublicIPAddressID - Public IP ARM resource ID + PublicIPAddressID *string `json:"publicIpAddressId,omitempty"` + // PublicIPAddress - IP Address of the Public IP Resource + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + // IsWorkloadProtected - Value indicating whether the IP address is DDoS workload protected or not. Possible values include: 'IsWorkloadProtectedFalse', 'IsWorkloadProtectedTrue' + IsWorkloadProtected IsWorkloadProtected `json:"isWorkloadProtected,omitempty"` + // DdosProtectionPlanID - DDoS protection plan Resource Id of a if IP address is protected through a plan. + DdosProtectionPlanID *string `json:"ddosProtectionPlanId,omitempty"` +} + +// PublicIPPrefix public IP prefix resource. +type PublicIPPrefix struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the public ip address. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Sku - The public IP prefix SKU. + Sku *PublicIPPrefixSku `json:"sku,omitempty"` + // PublicIPPrefixPropertiesFormat - Public IP prefix properties. + *PublicIPPrefixPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Zones - A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones *[]string `json:"zones,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PublicIPPrefix. +func (pip PublicIPPrefix) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pip.ExtendedLocation != nil { + objectMap["extendedLocation"] = pip.ExtendedLocation + } + if pip.Sku != nil { + objectMap["sku"] = pip.Sku + } + if pip.PublicIPPrefixPropertiesFormat != nil { + objectMap["properties"] = pip.PublicIPPrefixPropertiesFormat + } + if pip.Zones != nil { + objectMap["zones"] = pip.Zones + } + if pip.ID != nil { + objectMap["id"] = pip.ID + } + if pip.Location != nil { + objectMap["location"] = pip.Location + } + if pip.Tags != nil { + objectMap["tags"] = pip.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PublicIPPrefix struct. +func (pip *PublicIPPrefix) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + pip.ExtendedLocation = &extendedLocation + } + case "sku": + if v != nil { + var sku PublicIPPrefixSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + pip.Sku = &sku + } + case "properties": + if v != nil { + var publicIPPrefixPropertiesFormat PublicIPPrefixPropertiesFormat + err = json.Unmarshal(*v, &publicIPPrefixPropertiesFormat) + if err != nil { + return err + } + pip.PublicIPPrefixPropertiesFormat = &publicIPPrefixPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pip.Etag = &etag + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + pip.Zones = &zones + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pip.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pip.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pip.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pip.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pip.Tags = tags + } + } + } + + return nil +} + +// PublicIPPrefixListResult response for ListPublicIpPrefixes API service call. +type PublicIPPrefixListResult struct { + autorest.Response `json:"-"` + // Value - A list of public IP prefixes that exists in a resource group. + Value *[]PublicIPPrefix `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// PublicIPPrefixListResultIterator provides access to a complete listing of PublicIPPrefix values. +type PublicIPPrefixListResultIterator struct { + i int + page PublicIPPrefixListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PublicIPPrefixListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPPrefixListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PublicIPPrefixListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PublicIPPrefixListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PublicIPPrefixListResultIterator) Response() PublicIPPrefixListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PublicIPPrefixListResultIterator) Value() PublicIPPrefix { + if !iter.page.NotDone() { + return PublicIPPrefix{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PublicIPPrefixListResultIterator type. +func NewPublicIPPrefixListResultIterator(page PublicIPPrefixListResultPage) PublicIPPrefixListResultIterator { + return PublicIPPrefixListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (piplr PublicIPPrefixListResult) IsEmpty() bool { + return piplr.Value == nil || len(*piplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (piplr PublicIPPrefixListResult) hasNextLink() bool { + return piplr.NextLink != nil && len(*piplr.NextLink) != 0 +} + +// publicIPPrefixListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (piplr PublicIPPrefixListResult) publicIPPrefixListResultPreparer(ctx context.Context) (*http.Request, error) { + if !piplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(piplr.NextLink))) +} + +// PublicIPPrefixListResultPage contains a page of PublicIPPrefix values. +type PublicIPPrefixListResultPage struct { + fn func(context.Context, PublicIPPrefixListResult) (PublicIPPrefixListResult, error) + piplr PublicIPPrefixListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PublicIPPrefixListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPPrefixListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.piplr) + if err != nil { + return err + } + page.piplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PublicIPPrefixListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PublicIPPrefixListResultPage) NotDone() bool { + return !page.piplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PublicIPPrefixListResultPage) Response() PublicIPPrefixListResult { + return page.piplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PublicIPPrefixListResultPage) Values() []PublicIPPrefix { + if page.piplr.IsEmpty() { + return nil + } + return *page.piplr.Value +} + +// Creates a new instance of the PublicIPPrefixListResultPage type. +func NewPublicIPPrefixListResultPage(cur PublicIPPrefixListResult, getNextPage func(context.Context, PublicIPPrefixListResult) (PublicIPPrefixListResult, error)) PublicIPPrefixListResultPage { + return PublicIPPrefixListResultPage{ + fn: getNextPage, + piplr: cur, + } +} + +// PublicIPPrefixPropertiesFormat public IP prefix properties. +type PublicIPPrefixPropertiesFormat struct { + // PublicIPAddressVersion - The public IP address version. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' + PublicIPAddressVersion IPVersion `json:"publicIPAddressVersion,omitempty"` + // IPTags - The list of tags associated with the public IP prefix. + IPTags *[]IPTag `json:"ipTags,omitempty"` + // PrefixLength - The Length of the Public IP Prefix. + PrefixLength *int32 `json:"prefixLength,omitempty"` + // IPPrefix - READ-ONLY; The allocated Prefix. + IPPrefix *string `json:"ipPrefix,omitempty"` + // PublicIPAddresses - READ-ONLY; The list of all referenced PublicIPAddresses. + PublicIPAddresses *[]ReferencedPublicIPAddress `json:"publicIPAddresses,omitempty"` + // LoadBalancerFrontendIPConfiguration - READ-ONLY; The reference to load balancer frontend IP configuration associated with the public IP prefix. + LoadBalancerFrontendIPConfiguration *SubResource `json:"loadBalancerFrontendIpConfiguration,omitempty"` + // CustomIPPrefix - The customIpPrefix that this prefix is associated with. + CustomIPPrefix *SubResource `json:"customIPPrefix,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the public IP prefix resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the public IP prefix resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // NatGateway - NatGateway of Public IP Prefix. + NatGateway *NatGateway `json:"natGateway,omitempty"` +} + +// MarshalJSON is the custom marshaler for PublicIPPrefixPropertiesFormat. +func (pippf PublicIPPrefixPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pippf.PublicIPAddressVersion != "" { + objectMap["publicIPAddressVersion"] = pippf.PublicIPAddressVersion + } + if pippf.IPTags != nil { + objectMap["ipTags"] = pippf.IPTags + } + if pippf.PrefixLength != nil { + objectMap["prefixLength"] = pippf.PrefixLength + } + if pippf.CustomIPPrefix != nil { + objectMap["customIPPrefix"] = pippf.CustomIPPrefix + } + if pippf.NatGateway != nil { + objectMap["natGateway"] = pippf.NatGateway + } + return json.Marshal(objectMap) +} + +// PublicIPPrefixSku SKU of a public IP prefix. +type PublicIPPrefixSku struct { + // Name - Name of a public IP prefix SKU. Possible values include: 'PublicIPPrefixSkuNameStandard' + Name PublicIPPrefixSkuName `json:"name,omitempty"` + // Tier - Tier of a public IP prefix SKU. Possible values include: 'PublicIPPrefixSkuTierRegional', 'PublicIPPrefixSkuTierGlobal' + Tier PublicIPPrefixSkuTier `json:"tier,omitempty"` +} + +// PublicIPPrefixesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PublicIPPrefixesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PublicIPPrefixesClient) (PublicIPPrefix, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PublicIPPrefixesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PublicIPPrefixesCreateOrUpdateFuture.Result. +func (future *PublicIPPrefixesCreateOrUpdateFuture) result(client PublicIPPrefixesClient) (pip PublicIPPrefix, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pip.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PublicIPPrefixesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pip.Response.Response, err = future.GetResult(sender); err == nil && pip.Response.Response.StatusCode != http.StatusNoContent { + pip, err = client.CreateOrUpdateResponder(pip.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesCreateOrUpdateFuture", "Result", pip.Response.Response, "Failure responding to request") + } + } + return +} + +// PublicIPPrefixesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PublicIPPrefixesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PublicIPPrefixesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PublicIPPrefixesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PublicIPPrefixesDeleteFuture.Result. +func (future *PublicIPPrefixesDeleteFuture) result(client PublicIPPrefixesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PublicIPPrefixesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PutBastionShareableLinkAllFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PutBastionShareableLinkAllFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BaseClient) (BastionShareableLinkListResultPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PutBastionShareableLinkAllFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PutBastionShareableLinkAllFuture.Result. +func (future *PutBastionShareableLinkAllFuture) result(client BaseClient) (bsllrp BastionShareableLinkListResultPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PutBastionShareableLinkAllFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bsllrp.bsllr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PutBastionShareableLinkAllFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bsllrp.bsllr.Response.Response, err = future.GetResult(sender); err == nil && bsllrp.bsllr.Response.Response.StatusCode != http.StatusNoContent { + bsllrp, err = client.PutBastionShareableLinkResponder(bsllrp.bsllr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PutBastionShareableLinkAllFuture", "Result", bsllrp.bsllr.Response.Response, "Failure responding to request") + } + } + return +} + +// PutBastionShareableLinkFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PutBastionShareableLinkFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BaseClient) (BastionShareableLinkListResultPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PutBastionShareableLinkFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PutBastionShareableLinkFuture.Result. +func (future *PutBastionShareableLinkFuture) result(client BaseClient) (bsllrp BastionShareableLinkListResultPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PutBastionShareableLinkFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bsllrp.bsllr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PutBastionShareableLinkFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bsllrp.bsllr.Response.Response, err = future.GetResult(sender); err == nil && bsllrp.bsllr.Response.Response.StatusCode != http.StatusNoContent { + bsllrp, err = client.PutBastionShareableLinkResponder(bsllrp.bsllr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PutBastionShareableLinkFuture", "Result", bsllrp.bsllr.Response.Response, "Failure responding to request") + } + } + return +} + +// QosDefinition quality of Service defines the traffic configuration between endpoints. Mandatory to have +// one marking. +type QosDefinition struct { + // Markings - List of markings to be used in the configuration. + Markings *[]int32 `json:"markings,omitempty"` + // SourceIPRanges - Source IP ranges. + SourceIPRanges *[]QosIPRange `json:"sourceIpRanges,omitempty"` + // DestinationIPRanges - Destination IP ranges. + DestinationIPRanges *[]QosIPRange `json:"destinationIpRanges,omitempty"` + // SourcePortRanges - Sources port ranges. + SourcePortRanges *[]QosPortRange `json:"sourcePortRanges,omitempty"` + // DestinationPortRanges - Destination port ranges. + DestinationPortRanges *[]QosPortRange `json:"destinationPortRanges,omitempty"` + // Protocol - RNM supported protocol types. Possible values include: 'ProtocolTypeDoNotUse', 'ProtocolTypeIcmp', 'ProtocolTypeTCP', 'ProtocolTypeUDP', 'ProtocolTypeGre', 'ProtocolTypeEsp', 'ProtocolTypeAh', 'ProtocolTypeVxlan', 'ProtocolTypeAll' + Protocol ProtocolType `json:"protocol,omitempty"` +} + +// QosIPRange qos Traffic Profiler IP Range properties. +type QosIPRange struct { + // StartIP - Start IP Address. + StartIP *string `json:"startIP,omitempty"` + // EndIP - End IP Address. + EndIP *string `json:"endIP,omitempty"` +} + +// QosPortRange qos Traffic Profiler Port range properties. +type QosPortRange struct { + // Start - Qos Port Range start. + Start *int32 `json:"start,omitempty"` + // End - Qos Port Range end. + End *int32 `json:"end,omitempty"` +} + +// QueryInboundNatRulePortMappingRequest the request for a QueryInboundNatRulePortMapping API. Either +// IpConfiguration or IpAddress should be set +type QueryInboundNatRulePortMappingRequest struct { + // IPConfiguration - NetworkInterfaceIPConfiguration set in load balancer backend address. + IPConfiguration *SubResource `json:"ipConfiguration,omitempty"` + // IPAddress - IP address set in load balancer backend address. + IPAddress *string `json:"ipAddress,omitempty"` +} + +// QueryRequestOptions query Request Options +type QueryRequestOptions struct { + // SkipToken - When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. + SkipToken *string `json:"skipToken,omitempty"` +} + +// QueryResults query result +type QueryResults struct { + autorest.Response `json:"-"` + // MatchingRecordsCount - Number of total records matching the query. + MatchingRecordsCount *int64 `json:"matchingRecordsCount,omitempty"` + // Signatures - Array containing the results of the query + Signatures *[]SingleQueryResult `json:"signatures,omitempty"` +} + +// QueryTroubleshootingParameters parameters that define the resource to query the troubleshooting result. +type QueryTroubleshootingParameters struct { + // TargetResourceID - The target resource ID to query the troubleshooting result. + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// RadiusServer radius Server Settings. +type RadiusServer struct { + // RadiusServerAddress - The address of this radius server. + RadiusServerAddress *string `json:"radiusServerAddress,omitempty"` + // RadiusServerScore - The initial score assigned to this radius server. + RadiusServerScore *int64 `json:"radiusServerScore,omitempty"` + // RadiusServerSecret - The secret used for this radius server. + RadiusServerSecret *string `json:"radiusServerSecret,omitempty"` +} + +// RecordSet a collective group of information about the record set information. +type RecordSet struct { + // RecordType - Resource record type. + RecordType *string `json:"recordType,omitempty"` + // RecordSetName - Recordset name. + RecordSetName *string `json:"recordSetName,omitempty"` + // Fqdn - Fqdn that resolves to private endpoint ip address. + Fqdn *string `json:"fqdn,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the recordset. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // TTL - Recordset time to live. + TTL *int32 `json:"ttl,omitempty"` + // IPAddresses - The private ip address of the private endpoint. + IPAddresses *[]string `json:"ipAddresses,omitempty"` +} + +// MarshalJSON is the custom marshaler for RecordSet. +func (rs RecordSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rs.RecordType != nil { + objectMap["recordType"] = rs.RecordType + } + if rs.RecordSetName != nil { + objectMap["recordSetName"] = rs.RecordSetName + } + if rs.Fqdn != nil { + objectMap["fqdn"] = rs.Fqdn + } + if rs.TTL != nil { + objectMap["ttl"] = rs.TTL + } + if rs.IPAddresses != nil { + objectMap["ipAddresses"] = rs.IPAddresses + } + return json.Marshal(objectMap) +} + +// ReferencedPublicIPAddress reference to a public IP address. +type ReferencedPublicIPAddress struct { + // ID - The PublicIPAddress Reference. + ID *string `json:"id,omitempty"` +} + +// Resource common resource representation. +type Resource struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.ID != nil { + objectMap["id"] = r.ID + } + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// ResourceNavigationLink resourceNavigationLink resource. +type ResourceNavigationLink struct { + // ResourceNavigationLinkFormat - Resource navigation link properties format. + *ResourceNavigationLinkFormat `json:"properties,omitempty"` + // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceNavigationLink. +func (rnl ResourceNavigationLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rnl.ResourceNavigationLinkFormat != nil { + objectMap["properties"] = rnl.ResourceNavigationLinkFormat + } + if rnl.Name != nil { + objectMap["name"] = rnl.Name + } + if rnl.ID != nil { + objectMap["id"] = rnl.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ResourceNavigationLink struct. +func (rnl *ResourceNavigationLink) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var resourceNavigationLinkFormat ResourceNavigationLinkFormat + err = json.Unmarshal(*v, &resourceNavigationLinkFormat) + if err != nil { + return err + } + rnl.ResourceNavigationLinkFormat = &resourceNavigationLinkFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rnl.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rnl.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rnl.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rnl.ID = &ID + } + } + } + + return nil +} + +// ResourceNavigationLinkFormat properties of ResourceNavigationLink. +type ResourceNavigationLinkFormat struct { + // LinkedResourceType - Resource type of the linked resource. + LinkedResourceType *string `json:"linkedResourceType,omitempty"` + // Link - Link to the external resource. + Link *string `json:"link,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource navigation link resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceNavigationLinkFormat. +func (rnlf ResourceNavigationLinkFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rnlf.LinkedResourceType != nil { + objectMap["linkedResourceType"] = rnlf.LinkedResourceType + } + if rnlf.Link != nil { + objectMap["link"] = rnlf.Link + } + return json.Marshal(objectMap) +} + +// ResourceNavigationLinksListResult response for ResourceNavigationLinks_List operation. +type ResourceNavigationLinksListResult struct { + autorest.Response `json:"-"` + // Value - The resource navigation links in a subnet. + Value *[]ResourceNavigationLink `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceNavigationLinksListResult. +func (rnllr ResourceNavigationLinksListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rnllr.Value != nil { + objectMap["value"] = rnllr.Value + } + return json.Marshal(objectMap) +} + +// ResourceSet the base resource set for visibility and auto-approval. +type ResourceSet struct { + // Subscriptions - The list of subscriptions. + Subscriptions *[]string `json:"subscriptions,omitempty"` +} + +// RetentionPolicyParameters parameters that define the retention policy for flow log. +type RetentionPolicyParameters struct { + // Days - Number of days to retain flow log records. + Days *int32 `json:"days,omitempty"` + // Enabled - Flag to enable/disable retention. + Enabled *bool `json:"enabled,omitempty"` +} + +// Route route resource. +type Route struct { + autorest.Response `json:"-"` + // RoutePropertiesFormat - Properties of the route. + *RoutePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for Route. +func (r Route) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.RoutePropertiesFormat != nil { + objectMap["properties"] = r.RoutePropertiesFormat + } + if r.Name != nil { + objectMap["name"] = r.Name + } + if r.Type != nil { + objectMap["type"] = r.Type + } + if r.ID != nil { + objectMap["id"] = r.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Route struct. +func (r *Route) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routePropertiesFormat RoutePropertiesFormat + err = json.Unmarshal(*v, &routePropertiesFormat) + if err != nil { + return err + } + r.RoutePropertiesFormat = &routePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + r.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + r.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + r.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + r.ID = &ID + } + } + } + + return nil +} + +// RouteFilter route Filter Resource. +type RouteFilter struct { + autorest.Response `json:"-"` + // RouteFilterPropertiesFormat - Properties of the route filter. + *RouteFilterPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for RouteFilter. +func (rf RouteFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rf.RouteFilterPropertiesFormat != nil { + objectMap["properties"] = rf.RouteFilterPropertiesFormat + } + if rf.ID != nil { + objectMap["id"] = rf.ID + } + if rf.Location != nil { + objectMap["location"] = rf.Location + } + if rf.Tags != nil { + objectMap["tags"] = rf.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RouteFilter struct. +func (rf *RouteFilter) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routeFilterPropertiesFormat RouteFilterPropertiesFormat + err = json.Unmarshal(*v, &routeFilterPropertiesFormat) + if err != nil { + return err + } + rf.RouteFilterPropertiesFormat = &routeFilterPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rf.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rf.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rf.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rf.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + rf.Tags = tags + } + } + } + + return nil +} + +// RouteFilterListResult response for the ListRouteFilters API service call. +type RouteFilterListResult struct { + autorest.Response `json:"-"` + // Value - A list of route filters in a resource group. + Value *[]RouteFilter `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RouteFilterListResultIterator provides access to a complete listing of RouteFilter values. +type RouteFilterListResultIterator struct { + i int + page RouteFilterListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RouteFilterListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RouteFilterListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RouteFilterListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RouteFilterListResultIterator) Response() RouteFilterListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RouteFilterListResultIterator) Value() RouteFilter { + if !iter.page.NotDone() { + return RouteFilter{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RouteFilterListResultIterator type. +func NewRouteFilterListResultIterator(page RouteFilterListResultPage) RouteFilterListResultIterator { + return RouteFilterListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rflr RouteFilterListResult) IsEmpty() bool { + return rflr.Value == nil || len(*rflr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rflr RouteFilterListResult) hasNextLink() bool { + return rflr.NextLink != nil && len(*rflr.NextLink) != 0 +} + +// routeFilterListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rflr RouteFilterListResult) routeFilterListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rflr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rflr.NextLink))) +} + +// RouteFilterListResultPage contains a page of RouteFilter values. +type RouteFilterListResultPage struct { + fn func(context.Context, RouteFilterListResult) (RouteFilterListResult, error) + rflr RouteFilterListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RouteFilterListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rflr) + if err != nil { + return err + } + page.rflr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RouteFilterListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RouteFilterListResultPage) NotDone() bool { + return !page.rflr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RouteFilterListResultPage) Response() RouteFilterListResult { + return page.rflr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RouteFilterListResultPage) Values() []RouteFilter { + if page.rflr.IsEmpty() { + return nil + } + return *page.rflr.Value +} + +// Creates a new instance of the RouteFilterListResultPage type. +func NewRouteFilterListResultPage(cur RouteFilterListResult, getNextPage func(context.Context, RouteFilterListResult) (RouteFilterListResult, error)) RouteFilterListResultPage { + return RouteFilterListResultPage{ + fn: getNextPage, + rflr: cur, + } +} + +// RouteFilterPropertiesFormat route Filter Resource. +type RouteFilterPropertiesFormat struct { + // Rules - Collection of RouteFilterRules contained within a route filter. + Rules *[]RouteFilterRule `json:"rules,omitempty"` + // Peerings - READ-ONLY; A collection of references to express route circuit peerings. + Peerings *[]ExpressRouteCircuitPeering `json:"peerings,omitempty"` + // Ipv6Peerings - READ-ONLY; A collection of references to express route circuit ipv6 peerings. + Ipv6Peerings *[]ExpressRouteCircuitPeering `json:"ipv6Peerings,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the route filter resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteFilterPropertiesFormat. +func (rfpf RouteFilterPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rfpf.Rules != nil { + objectMap["rules"] = rfpf.Rules + } + return json.Marshal(objectMap) +} + +// RouteFilterRule route Filter Rule Resource. +type RouteFilterRule struct { + autorest.Response `json:"-"` + // RouteFilterRulePropertiesFormat - Properties of the route filter rule. + *RouteFilterRulePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteFilterRule. +func (rfr RouteFilterRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rfr.RouteFilterRulePropertiesFormat != nil { + objectMap["properties"] = rfr.RouteFilterRulePropertiesFormat + } + if rfr.Name != nil { + objectMap["name"] = rfr.Name + } + if rfr.Location != nil { + objectMap["location"] = rfr.Location + } + if rfr.ID != nil { + objectMap["id"] = rfr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RouteFilterRule struct. +func (rfr *RouteFilterRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routeFilterRulePropertiesFormat RouteFilterRulePropertiesFormat + err = json.Unmarshal(*v, &routeFilterRulePropertiesFormat) + if err != nil { + return err + } + rfr.RouteFilterRulePropertiesFormat = &routeFilterRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rfr.Name = &name + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rfr.Location = &location + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rfr.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rfr.ID = &ID + } + } + } + + return nil +} + +// RouteFilterRuleListResult response for the ListRouteFilterRules API service call. +type RouteFilterRuleListResult struct { + autorest.Response `json:"-"` + // Value - A list of RouteFilterRules in a resource group. + Value *[]RouteFilterRule `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RouteFilterRuleListResultIterator provides access to a complete listing of RouteFilterRule values. +type RouteFilterRuleListResultIterator struct { + i int + page RouteFilterRuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RouteFilterRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterRuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RouteFilterRuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RouteFilterRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RouteFilterRuleListResultIterator) Response() RouteFilterRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RouteFilterRuleListResultIterator) Value() RouteFilterRule { + if !iter.page.NotDone() { + return RouteFilterRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RouteFilterRuleListResultIterator type. +func NewRouteFilterRuleListResultIterator(page RouteFilterRuleListResultPage) RouteFilterRuleListResultIterator { + return RouteFilterRuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rfrlr RouteFilterRuleListResult) IsEmpty() bool { + return rfrlr.Value == nil || len(*rfrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rfrlr RouteFilterRuleListResult) hasNextLink() bool { + return rfrlr.NextLink != nil && len(*rfrlr.NextLink) != 0 +} + +// routeFilterRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rfrlr RouteFilterRuleListResult) routeFilterRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rfrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rfrlr.NextLink))) +} + +// RouteFilterRuleListResultPage contains a page of RouteFilterRule values. +type RouteFilterRuleListResultPage struct { + fn func(context.Context, RouteFilterRuleListResult) (RouteFilterRuleListResult, error) + rfrlr RouteFilterRuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RouteFilterRuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterRuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rfrlr) + if err != nil { + return err + } + page.rfrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RouteFilterRuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RouteFilterRuleListResultPage) NotDone() bool { + return !page.rfrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RouteFilterRuleListResultPage) Response() RouteFilterRuleListResult { + return page.rfrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RouteFilterRuleListResultPage) Values() []RouteFilterRule { + if page.rfrlr.IsEmpty() { + return nil + } + return *page.rfrlr.Value +} + +// Creates a new instance of the RouteFilterRuleListResultPage type. +func NewRouteFilterRuleListResultPage(cur RouteFilterRuleListResult, getNextPage func(context.Context, RouteFilterRuleListResult) (RouteFilterRuleListResult, error)) RouteFilterRuleListResultPage { + return RouteFilterRuleListResultPage{ + fn: getNextPage, + rfrlr: cur, + } +} + +// RouteFilterRulePropertiesFormat route Filter Rule Resource. +type RouteFilterRulePropertiesFormat struct { + // Access - The access type of the rule. Possible values include: 'AccessAllow', 'AccessDeny' + Access Access `json:"access,omitempty"` + // RouteFilterRuleType - The rule type of the rule. + RouteFilterRuleType *string `json:"routeFilterRuleType,omitempty"` + // Communities - The collection for bgp community values to filter on. e.g. ['12076:5010','12076:5020']. + Communities *[]string `json:"communities,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the route filter rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteFilterRulePropertiesFormat. +func (rfrpf RouteFilterRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rfrpf.Access != "" { + objectMap["access"] = rfrpf.Access + } + if rfrpf.RouteFilterRuleType != nil { + objectMap["routeFilterRuleType"] = rfrpf.RouteFilterRuleType + } + if rfrpf.Communities != nil { + objectMap["communities"] = rfrpf.Communities + } + return json.Marshal(objectMap) +} + +// RouteFilterRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type RouteFilterRulesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RouteFilterRulesClient) (RouteFilterRule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RouteFilterRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RouteFilterRulesCreateOrUpdateFuture.Result. +func (future *RouteFilterRulesCreateOrUpdateFuture) result(client RouteFilterRulesClient) (rfr RouteFilterRule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rfr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RouteFilterRulesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rfr.Response.Response, err = future.GetResult(sender); err == nil && rfr.Response.Response.StatusCode != http.StatusNoContent { + rfr, err = client.CreateOrUpdateResponder(rfr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesCreateOrUpdateFuture", "Result", rfr.Response.Response, "Failure responding to request") + } + } + return +} + +// RouteFilterRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RouteFilterRulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RouteFilterRulesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RouteFilterRulesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RouteFilterRulesDeleteFuture.Result. +func (future *RouteFilterRulesDeleteFuture) result(client RouteFilterRulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RouteFilterRulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RouteFiltersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type RouteFiltersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RouteFiltersClient) (RouteFilter, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RouteFiltersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RouteFiltersCreateOrUpdateFuture.Result. +func (future *RouteFiltersCreateOrUpdateFuture) result(client RouteFiltersClient) (rf RouteFilter, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rf.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RouteFiltersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rf.Response.Response, err = future.GetResult(sender); err == nil && rf.Response.Response.StatusCode != http.StatusNoContent { + rf, err = client.CreateOrUpdateResponder(rf.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersCreateOrUpdateFuture", "Result", rf.Response.Response, "Failure responding to request") + } + } + return +} + +// RouteFiltersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RouteFiltersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RouteFiltersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RouteFiltersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RouteFiltersDeleteFuture.Result. +func (future *RouteFiltersDeleteFuture) result(client RouteFiltersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RouteFiltersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RouteListResult response for the ListRoute API service call. +type RouteListResult struct { + autorest.Response `json:"-"` + // Value - A list of routes in a resource group. + Value *[]Route `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RouteListResultIterator provides access to a complete listing of Route values. +type RouteListResultIterator struct { + i int + page RouteListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RouteListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RouteListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RouteListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RouteListResultIterator) Response() RouteListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RouteListResultIterator) Value() Route { + if !iter.page.NotDone() { + return Route{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RouteListResultIterator type. +func NewRouteListResultIterator(page RouteListResultPage) RouteListResultIterator { + return RouteListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rlr RouteListResult) IsEmpty() bool { + return rlr.Value == nil || len(*rlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rlr RouteListResult) hasNextLink() bool { + return rlr.NextLink != nil && len(*rlr.NextLink) != 0 +} + +// routeListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rlr RouteListResult) routeListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rlr.NextLink))) +} + +// RouteListResultPage contains a page of Route values. +type RouteListResultPage struct { + fn func(context.Context, RouteListResult) (RouteListResult, error) + rlr RouteListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RouteListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rlr) + if err != nil { + return err + } + page.rlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RouteListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RouteListResultPage) NotDone() bool { + return !page.rlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RouteListResultPage) Response() RouteListResult { + return page.rlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RouteListResultPage) Values() []Route { + if page.rlr.IsEmpty() { + return nil + } + return *page.rlr.Value +} + +// Creates a new instance of the RouteListResultPage type. +func NewRouteListResultPage(cur RouteListResult, getNextPage func(context.Context, RouteListResult) (RouteListResult, error)) RouteListResultPage { + return RouteListResultPage{ + fn: getNextPage, + rlr: cur, + } +} + +// RouteMap the RouteMap child resource of a Virtual hub. +type RouteMap struct { + autorest.Response `json:"-"` + // RouteMapProperties - Properties of the RouteMap resource. + *RouteMapProperties `json:"properties,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteMap. +func (rm RouteMap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rm.RouteMapProperties != nil { + objectMap["properties"] = rm.RouteMapProperties + } + if rm.ID != nil { + objectMap["id"] = rm.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RouteMap struct. +func (rm *RouteMap) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routeMapProperties RouteMapProperties + err = json.Unmarshal(*v, &routeMapProperties) + if err != nil { + return err + } + rm.RouteMapProperties = &routeMapProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rm.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rm.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rm.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rm.ID = &ID + } + } + } + + return nil +} + +// RouteMapProperties properties of RouteMap resource +type RouteMapProperties struct { + // AssociatedInboundConnections - List of connections which have this RoutMap associated for inbound traffic. + AssociatedInboundConnections *[]string `json:"associatedInboundConnections,omitempty"` + // AssociatedOutboundConnections - List of connections which have this RoutMap associated for outbound traffic. + AssociatedOutboundConnections *[]string `json:"associatedOutboundConnections,omitempty"` + // Rules - List of RouteMap rules to be applied. + Rules *[]RouteMapRule `json:"rules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the RouteMap resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteMapProperties. +func (rmp RouteMapProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmp.AssociatedInboundConnections != nil { + objectMap["associatedInboundConnections"] = rmp.AssociatedInboundConnections + } + if rmp.AssociatedOutboundConnections != nil { + objectMap["associatedOutboundConnections"] = rmp.AssociatedOutboundConnections + } + if rmp.Rules != nil { + objectMap["rules"] = rmp.Rules + } + return json.Marshal(objectMap) +} + +// RouteMapRule a RouteMap Rule. +type RouteMapRule struct { + // Name - The unique name for the rule. + Name *string `json:"name,omitempty"` + // MatchCriteria - List of matching criterion which will be applied to traffic. + MatchCriteria *[]Criterion `json:"matchCriteria,omitempty"` + // Actions - List of actions which will be applied on a match. + Actions *[]Action `json:"actions,omitempty"` + // NextStepIfMatched - Next step after rule is evaluated. Current supported behaviors are 'Continue'(to next rule) and 'Terminate'. Possible values include: 'NextStepUnknown', 'NextStepContinue', 'NextStepTerminate' + NextStepIfMatched NextStep `json:"nextStepIfMatched,omitempty"` +} + +// RouteMapsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RouteMapsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RouteMapsClient) (RouteMap, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RouteMapsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RouteMapsCreateOrUpdateFuture.Result. +func (future *RouteMapsCreateOrUpdateFuture) result(client RouteMapsClient) (rm RouteMap, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteMapsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rm.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RouteMapsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rm.Response.Response, err = future.GetResult(sender); err == nil && rm.Response.Response.StatusCode != http.StatusNoContent { + rm, err = client.CreateOrUpdateResponder(rm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteMapsCreateOrUpdateFuture", "Result", rm.Response.Response, "Failure responding to request") + } + } + return +} + +// RouteMapsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RouteMapsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RouteMapsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RouteMapsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RouteMapsDeleteFuture.Result. +func (future *RouteMapsDeleteFuture) result(client RouteMapsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteMapsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RouteMapsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RoutePropertiesFormat route resource. +type RoutePropertiesFormat struct { + // AddressPrefix - The destination CIDR to which the route applies. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // NextHopType - The type of Azure hop the packet should be sent to. Possible values include: 'RouteNextHopTypeVirtualNetworkGateway', 'RouteNextHopTypeVnetLocal', 'RouteNextHopTypeInternet', 'RouteNextHopTypeVirtualAppliance', 'RouteNextHopTypeNone' + NextHopType RouteNextHopType `json:"nextHopType,omitempty"` + // NextHopIPAddress - The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the route resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // HasBgpOverride - A value indicating whether this route overrides overlapping BGP routes regardless of LPM. + HasBgpOverride *bool `json:"hasBgpOverride,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoutePropertiesFormat. +func (rpf RoutePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpf.AddressPrefix != nil { + objectMap["addressPrefix"] = rpf.AddressPrefix + } + if rpf.NextHopType != "" { + objectMap["nextHopType"] = rpf.NextHopType + } + if rpf.NextHopIPAddress != nil { + objectMap["nextHopIpAddress"] = rpf.NextHopIPAddress + } + if rpf.HasBgpOverride != nil { + objectMap["hasBgpOverride"] = rpf.HasBgpOverride + } + return json.Marshal(objectMap) +} + +// RouteTable route table resource. +type RouteTable struct { + autorest.Response `json:"-"` + // RouteTablePropertiesFormat - Properties of the route table. + *RouteTablePropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for RouteTable. +func (rt RouteTable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rt.RouteTablePropertiesFormat != nil { + objectMap["properties"] = rt.RouteTablePropertiesFormat + } + if rt.ID != nil { + objectMap["id"] = rt.ID + } + if rt.Location != nil { + objectMap["location"] = rt.Location + } + if rt.Tags != nil { + objectMap["tags"] = rt.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RouteTable struct. +func (rt *RouteTable) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routeTablePropertiesFormat RouteTablePropertiesFormat + err = json.Unmarshal(*v, &routeTablePropertiesFormat) + if err != nil { + return err + } + rt.RouteTablePropertiesFormat = &routeTablePropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rt.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rt.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rt.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + rt.Tags = tags + } + } + } + + return nil +} + +// RouteTableListResult response for the ListRouteTable API service call. +type RouteTableListResult struct { + autorest.Response `json:"-"` + // Value - A list of route tables in a resource group. + Value *[]RouteTable `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RouteTableListResultIterator provides access to a complete listing of RouteTable values. +type RouteTableListResultIterator struct { + i int + page RouteTableListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RouteTableListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteTableListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RouteTableListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RouteTableListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RouteTableListResultIterator) Response() RouteTableListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RouteTableListResultIterator) Value() RouteTable { + if !iter.page.NotDone() { + return RouteTable{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RouteTableListResultIterator type. +func NewRouteTableListResultIterator(page RouteTableListResultPage) RouteTableListResultIterator { + return RouteTableListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rtlr RouteTableListResult) IsEmpty() bool { + return rtlr.Value == nil || len(*rtlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rtlr RouteTableListResult) hasNextLink() bool { + return rtlr.NextLink != nil && len(*rtlr.NextLink) != 0 +} + +// routeTableListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rtlr RouteTableListResult) routeTableListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rtlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rtlr.NextLink))) +} + +// RouteTableListResultPage contains a page of RouteTable values. +type RouteTableListResultPage struct { + fn func(context.Context, RouteTableListResult) (RouteTableListResult, error) + rtlr RouteTableListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RouteTableListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteTableListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rtlr) + if err != nil { + return err + } + page.rtlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RouteTableListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RouteTableListResultPage) NotDone() bool { + return !page.rtlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RouteTableListResultPage) Response() RouteTableListResult { + return page.rtlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RouteTableListResultPage) Values() []RouteTable { + if page.rtlr.IsEmpty() { + return nil + } + return *page.rtlr.Value +} + +// Creates a new instance of the RouteTableListResultPage type. +func NewRouteTableListResultPage(cur RouteTableListResult, getNextPage func(context.Context, RouteTableListResult) (RouteTableListResult, error)) RouteTableListResultPage { + return RouteTableListResultPage{ + fn: getNextPage, + rtlr: cur, + } +} + +// RouteTablePropertiesFormat route Table resource. +type RouteTablePropertiesFormat struct { + // Routes - Collection of routes contained within a route table. + Routes *[]Route `json:"routes,omitempty"` + // Subnets - READ-ONLY; A collection of references to subnets. + Subnets *[]Subnet `json:"subnets,omitempty"` + // DisableBgpRoutePropagation - Whether to disable the routes learned by BGP on that route table. True means disable. + DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the route table resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the route table. + ResourceGUID *string `json:"resourceGuid,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteTablePropertiesFormat. +func (rtpf RouteTablePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rtpf.Routes != nil { + objectMap["routes"] = rtpf.Routes + } + if rtpf.DisableBgpRoutePropagation != nil { + objectMap["disableBgpRoutePropagation"] = rtpf.DisableBgpRoutePropagation + } + return json.Marshal(objectMap) +} + +// RouteTablesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type RouteTablesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RouteTablesClient) (RouteTable, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RouteTablesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RouteTablesCreateOrUpdateFuture.Result. +func (future *RouteTablesCreateOrUpdateFuture) result(client RouteTablesClient) (rt RouteTable, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rt.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RouteTablesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent { + rt, err = client.CreateOrUpdateResponder(rt.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", rt.Response.Response, "Failure responding to request") + } + } + return +} + +// RouteTablesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RouteTablesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RouteTablesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RouteTablesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RouteTablesDeleteFuture.Result. +func (future *RouteTablesDeleteFuture) result(client RouteTablesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RouteTablesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RoutesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RoutesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RoutesClient) (Route, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RoutesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RoutesCreateOrUpdateFuture.Result. +func (future *RoutesCreateOrUpdateFuture) result(client RoutesClient) (r Route, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RoutesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.CreateOrUpdateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// RoutesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RoutesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RoutesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RoutesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RoutesDeleteFuture.Result. +func (future *RoutesDeleteFuture) result(client RoutesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RoutesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RoutingConfiguration routing Configuration indicating the associated and propagated route tables for +// this connection. +type RoutingConfiguration struct { + // AssociatedRouteTable - The resource id RouteTable associated with this RoutingConfiguration. + AssociatedRouteTable *SubResource `json:"associatedRouteTable,omitempty"` + // PropagatedRouteTables - The list of RouteTables to advertise the routes to. + PropagatedRouteTables *PropagatedRouteTable `json:"propagatedRouteTables,omitempty"` + // VnetRoutes - List of routes that control routing from VirtualHub into a virtual network connection. + VnetRoutes *VnetRoute `json:"vnetRoutes,omitempty"` + // InboundRouteMap - The resource id of the RouteMap associated with this RoutingConfiguration for inbound learned routes. + InboundRouteMap *SubResource `json:"inboundRouteMap,omitempty"` + // OutboundRouteMap - The resource id of theRouteMap associated with this RoutingConfiguration for outbound advertised routes. + OutboundRouteMap *SubResource `json:"outboundRouteMap,omitempty"` +} + +// RoutingIntent the routing intent child resource of a Virtual hub. +type RoutingIntent struct { + autorest.Response `json:"-"` + // RoutingIntentProperties - Properties of the RoutingIntent resource. + *RoutingIntentProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoutingIntent. +func (ri RoutingIntent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ri.RoutingIntentProperties != nil { + objectMap["properties"] = ri.RoutingIntentProperties + } + if ri.Name != nil { + objectMap["name"] = ri.Name + } + if ri.ID != nil { + objectMap["id"] = ri.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoutingIntent struct. +func (ri *RoutingIntent) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routingIntentProperties RoutingIntentProperties + err = json.Unmarshal(*v, &routingIntentProperties) + if err != nil { + return err + } + ri.RoutingIntentProperties = &routingIntentProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ri.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ri.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ri.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ri.ID = &ID + } + } + } + + return nil +} + +// RoutingIntentCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type RoutingIntentCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RoutingIntentClient) (RoutingIntent, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RoutingIntentCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RoutingIntentCreateOrUpdateFuture.Result. +func (future *RoutingIntentCreateOrUpdateFuture) result(client RoutingIntentClient) (ri RoutingIntent, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutingIntentCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ri.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RoutingIntentCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ri.Response.Response, err = future.GetResult(sender); err == nil && ri.Response.Response.StatusCode != http.StatusNoContent { + ri, err = client.CreateOrUpdateResponder(ri.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutingIntentCreateOrUpdateFuture", "Result", ri.Response.Response, "Failure responding to request") + } + } + return +} + +// RoutingIntentDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RoutingIntentDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RoutingIntentClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RoutingIntentDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RoutingIntentDeleteFuture.Result. +func (future *RoutingIntentDeleteFuture) result(client RoutingIntentClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutingIntentDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RoutingIntentDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RoutingIntentProperties the properties of a RoutingIntent resource. +type RoutingIntentProperties struct { + // RoutingPolicies - List of routing policies. + RoutingPolicies *[]RoutingPolicy `json:"routingPolicies,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the RoutingIntent resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoutingIntentProperties. +func (rip RoutingIntentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rip.RoutingPolicies != nil { + objectMap["routingPolicies"] = rip.RoutingPolicies + } + return json.Marshal(objectMap) +} + +// RoutingPolicy the routing policy object used in a RoutingIntent resource. +type RoutingPolicy struct { + // Name - The unique name for the routing policy. + Name *string `json:"name,omitempty"` + // Destinations - List of all destinations which this routing policy is applicable to (for example: Internet, PrivateTraffic). + Destinations *[]string `json:"destinations,omitempty"` + // NextHop - The next hop resource id on which this routing policy is applicable to. + NextHop *string `json:"nextHop,omitempty"` +} + +// Rule rule of type network. +type Rule struct { + // IPProtocols - Array of FirewallPolicyRuleNetworkProtocols. + IPProtocols *[]FirewallPolicyRuleNetworkProtocol `json:"ipProtocols,omitempty"` + // SourceAddresses - List of source IP addresses for this rule. + SourceAddresses *[]string `json:"sourceAddresses,omitempty"` + // DestinationAddresses - List of destination IP addresses or Service Tags. + DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` + // DestinationPorts - List of destination ports. + DestinationPorts *[]string `json:"destinationPorts,omitempty"` + // SourceIPGroups - List of source IpGroups for this rule. + SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` + // DestinationIPGroups - List of destination IpGroups for this rule. + DestinationIPGroups *[]string `json:"destinationIpGroups,omitempty"` + // DestinationFqdns - List of destination FQDNs. + DestinationFqdns *[]string `json:"destinationFqdns,omitempty"` + // Name - Name of the rule. + Name *string `json:"name,omitempty"` + // Description - Description of the rule. + Description *string `json:"description,omitempty"` + // RuleType - Possible values include: 'RuleTypeFirewallPolicyRule', 'RuleTypeApplicationRule', 'RuleTypeNatRule', 'RuleTypeNetworkRule' + RuleType RuleType `json:"ruleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for Rule. +func (r Rule) MarshalJSON() ([]byte, error) { + r.RuleType = RuleTypeNetworkRule + objectMap := make(map[string]interface{}) + if r.IPProtocols != nil { + objectMap["ipProtocols"] = r.IPProtocols + } + if r.SourceAddresses != nil { + objectMap["sourceAddresses"] = r.SourceAddresses + } + if r.DestinationAddresses != nil { + objectMap["destinationAddresses"] = r.DestinationAddresses + } + if r.DestinationPorts != nil { + objectMap["destinationPorts"] = r.DestinationPorts + } + if r.SourceIPGroups != nil { + objectMap["sourceIpGroups"] = r.SourceIPGroups + } + if r.DestinationIPGroups != nil { + objectMap["destinationIpGroups"] = r.DestinationIPGroups + } + if r.DestinationFqdns != nil { + objectMap["destinationFqdns"] = r.DestinationFqdns + } + if r.Name != nil { + objectMap["name"] = r.Name + } + if r.Description != nil { + objectMap["description"] = r.Description + } + if r.RuleType != "" { + objectMap["ruleType"] = r.RuleType + } + return json.Marshal(objectMap) +} + +// AsApplicationRule is the BasicFirewallPolicyRule implementation for Rule. +func (r Rule) AsApplicationRule() (*ApplicationRule, bool) { + return nil, false +} + +// AsNatRule is the BasicFirewallPolicyRule implementation for Rule. +func (r Rule) AsNatRule() (*NatRule, bool) { + return nil, false +} + +// AsRule is the BasicFirewallPolicyRule implementation for Rule. +func (r Rule) AsRule() (*Rule, bool) { + return &r, true +} + +// AsFirewallPolicyRule is the BasicFirewallPolicyRule implementation for Rule. +func (r Rule) AsFirewallPolicyRule() (*FirewallPolicyRule, bool) { + return nil, false +} + +// AsBasicFirewallPolicyRule is the BasicFirewallPolicyRule implementation for Rule. +func (r Rule) AsBasicFirewallPolicyRule() (BasicFirewallPolicyRule, bool) { + return &r, true +} + +// ScopeConnection the Scope Connections resource +type ScopeConnection struct { + autorest.Response `json:"-"` + // ScopeConnectionProperties - The scope connection properties + *ScopeConnectionProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScopeConnection. +func (sc ScopeConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sc.ScopeConnectionProperties != nil { + objectMap["properties"] = sc.ScopeConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ScopeConnection struct. +func (sc *ScopeConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var scopeConnectionProperties ScopeConnectionProperties + err = json.Unmarshal(*v, &scopeConnectionProperties) + if err != nil { + return err + } + sc.ScopeConnectionProperties = &scopeConnectionProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sc.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sc.Etag = &etag + } + } + } + + return nil +} + +// ScopeConnectionListResult list of scope connections. +type ScopeConnectionListResult struct { + autorest.Response `json:"-"` + // Value - List of scope connections. + Value *[]ScopeConnection `json:"value,omitempty"` + // NextLink - Gets the URL to get the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ScopeConnectionListResultIterator provides access to a complete listing of ScopeConnection values. +type ScopeConnectionListResultIterator struct { + i int + page ScopeConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ScopeConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ScopeConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ScopeConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ScopeConnectionListResultIterator) Response() ScopeConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ScopeConnectionListResultIterator) Value() ScopeConnection { + if !iter.page.NotDone() { + return ScopeConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ScopeConnectionListResultIterator type. +func NewScopeConnectionListResultIterator(page ScopeConnectionListResultPage) ScopeConnectionListResultIterator { + return ScopeConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sclr ScopeConnectionListResult) IsEmpty() bool { + return sclr.Value == nil || len(*sclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sclr ScopeConnectionListResult) hasNextLink() bool { + return sclr.NextLink != nil && len(*sclr.NextLink) != 0 +} + +// scopeConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sclr ScopeConnectionListResult) scopeConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !sclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sclr.NextLink))) +} + +// ScopeConnectionListResultPage contains a page of ScopeConnection values. +type ScopeConnectionListResultPage struct { + fn func(context.Context, ScopeConnectionListResult) (ScopeConnectionListResult, error) + sclr ScopeConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ScopeConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sclr) + if err != nil { + return err + } + page.sclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ScopeConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ScopeConnectionListResultPage) NotDone() bool { + return !page.sclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ScopeConnectionListResultPage) Response() ScopeConnectionListResult { + return page.sclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ScopeConnectionListResultPage) Values() []ScopeConnection { + if page.sclr.IsEmpty() { + return nil + } + return *page.sclr.Value +} + +// Creates a new instance of the ScopeConnectionListResultPage type. +func NewScopeConnectionListResultPage(cur ScopeConnectionListResult, getNextPage func(context.Context, ScopeConnectionListResult) (ScopeConnectionListResult, error)) ScopeConnectionListResultPage { + return ScopeConnectionListResultPage{ + fn: getNextPage, + sclr: cur, + } +} + +// ScopeConnectionProperties scope connection. +type ScopeConnectionProperties struct { + // TenantID - Tenant ID. + TenantID *string `json:"tenantId,omitempty"` + // ResourceID - Resource ID. + ResourceID *string `json:"resourceId,omitempty"` + // ConnectionState - Connection State. Possible values include: 'ScopeConnectionStateConnected', 'ScopeConnectionStatePending', 'ScopeConnectionStateConflict', 'ScopeConnectionStateRevoked', 'ScopeConnectionStateRejected' + ConnectionState ScopeConnectionState `json:"connectionState,omitempty"` + // Description - A description of the scope connection. + Description *string `json:"description,omitempty"` +} + +// SecurityAdminConfiguration defines the security admin configuration +type SecurityAdminConfiguration struct { + autorest.Response `json:"-"` + // SecurityAdminConfigurationPropertiesFormat - Indicates the properties for the network manager security admin configuration. + *SecurityAdminConfigurationPropertiesFormat `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityAdminConfiguration. +func (sac SecurityAdminConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sac.SecurityAdminConfigurationPropertiesFormat != nil { + objectMap["properties"] = sac.SecurityAdminConfigurationPropertiesFormat + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecurityAdminConfiguration struct. +func (sac *SecurityAdminConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var securityAdminConfigurationPropertiesFormat SecurityAdminConfigurationPropertiesFormat + err = json.Unmarshal(*v, &securityAdminConfigurationPropertiesFormat) + if err != nil { + return err + } + sac.SecurityAdminConfigurationPropertiesFormat = &securityAdminConfigurationPropertiesFormat + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sac.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sac.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sac.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sac.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sac.Etag = &etag + } + } + } + + return nil +} + +// SecurityAdminConfigurationListResult a list of network manager security admin configurations +type SecurityAdminConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - Gets a page of security admin configurations + Value *[]SecurityAdminConfiguration `json:"value,omitempty"` + // NextLink - Gets the URL to get the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// SecurityAdminConfigurationListResultIterator provides access to a complete listing of +// SecurityAdminConfiguration values. +type SecurityAdminConfigurationListResultIterator struct { + i int + page SecurityAdminConfigurationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SecurityAdminConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityAdminConfigurationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SecurityAdminConfigurationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecurityAdminConfigurationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SecurityAdminConfigurationListResultIterator) Response() SecurityAdminConfigurationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SecurityAdminConfigurationListResultIterator) Value() SecurityAdminConfiguration { + if !iter.page.NotDone() { + return SecurityAdminConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SecurityAdminConfigurationListResultIterator type. +func NewSecurityAdminConfigurationListResultIterator(page SecurityAdminConfigurationListResultPage) SecurityAdminConfigurationListResultIterator { + return SecurityAdminConfigurationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (saclr SecurityAdminConfigurationListResult) IsEmpty() bool { + return saclr.Value == nil || len(*saclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (saclr SecurityAdminConfigurationListResult) hasNextLink() bool { + return saclr.NextLink != nil && len(*saclr.NextLink) != 0 +} + +// securityAdminConfigurationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (saclr SecurityAdminConfigurationListResult) securityAdminConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !saclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(saclr.NextLink))) +} + +// SecurityAdminConfigurationListResultPage contains a page of SecurityAdminConfiguration values. +type SecurityAdminConfigurationListResultPage struct { + fn func(context.Context, SecurityAdminConfigurationListResult) (SecurityAdminConfigurationListResult, error) + saclr SecurityAdminConfigurationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SecurityAdminConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityAdminConfigurationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.saclr) + if err != nil { + return err + } + page.saclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SecurityAdminConfigurationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecurityAdminConfigurationListResultPage) NotDone() bool { + return !page.saclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecurityAdminConfigurationListResultPage) Response() SecurityAdminConfigurationListResult { + return page.saclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecurityAdminConfigurationListResultPage) Values() []SecurityAdminConfiguration { + if page.saclr.IsEmpty() { + return nil + } + return *page.saclr.Value +} + +// Creates a new instance of the SecurityAdminConfigurationListResultPage type. +func NewSecurityAdminConfigurationListResultPage(cur SecurityAdminConfigurationListResult, getNextPage func(context.Context, SecurityAdminConfigurationListResult) (SecurityAdminConfigurationListResult, error)) SecurityAdminConfigurationListResultPage { + return SecurityAdminConfigurationListResultPage{ + fn: getNextPage, + saclr: cur, + } +} + +// SecurityAdminConfigurationPropertiesFormat defines the security admin configuration properties. +type SecurityAdminConfigurationPropertiesFormat struct { + // Description - A description of the security configuration. + Description *string `json:"description,omitempty"` + // ApplyOnNetworkIntentPolicyBasedServices - Enum list of network intent policy based services. + ApplyOnNetworkIntentPolicyBasedServices *[]IntentPolicyBasedService `json:"applyOnNetworkIntentPolicyBasedServices,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityAdminConfigurationPropertiesFormat. +func (sacpf SecurityAdminConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sacpf.Description != nil { + objectMap["description"] = sacpf.Description + } + if sacpf.ApplyOnNetworkIntentPolicyBasedServices != nil { + objectMap["applyOnNetworkIntentPolicyBasedServices"] = sacpf.ApplyOnNetworkIntentPolicyBasedServices + } + return json.Marshal(objectMap) +} + +// SecurityAdminConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SecurityAdminConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityAdminConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityAdminConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityAdminConfigurationsDeleteFuture.Result. +func (future *SecurityAdminConfigurationsDeleteFuture) result(client SecurityAdminConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityAdminConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SecurityAdminConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SecurityGroup networkSecurityGroup resource. +type SecurityGroup struct { + autorest.Response `json:"-"` + // SecurityGroupPropertiesFormat - Properties of the network security group. + *SecurityGroupPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for SecurityGroup. +func (sg SecurityGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sg.SecurityGroupPropertiesFormat != nil { + objectMap["properties"] = sg.SecurityGroupPropertiesFormat + } + if sg.ID != nil { + objectMap["id"] = sg.ID + } + if sg.Location != nil { + objectMap["location"] = sg.Location + } + if sg.Tags != nil { + objectMap["tags"] = sg.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecurityGroup struct. +func (sg *SecurityGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var securityGroupPropertiesFormat SecurityGroupPropertiesFormat + err = json.Unmarshal(*v, &securityGroupPropertiesFormat) + if err != nil { + return err + } + sg.SecurityGroupPropertiesFormat = &securityGroupPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sg.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + sg.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + sg.Tags = tags + } + } + } + + return nil +} + +// SecurityGroupListResult response for ListNetworkSecurityGroups API service call. +type SecurityGroupListResult struct { + autorest.Response `json:"-"` + // Value - A list of NetworkSecurityGroup resources. + Value *[]SecurityGroup `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// SecurityGroupListResultIterator provides access to a complete listing of SecurityGroup values. +type SecurityGroupListResultIterator struct { + i int + page SecurityGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SecurityGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SecurityGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecurityGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SecurityGroupListResultIterator) Response() SecurityGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SecurityGroupListResultIterator) Value() SecurityGroup { + if !iter.page.NotDone() { + return SecurityGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SecurityGroupListResultIterator type. +func NewSecurityGroupListResultIterator(page SecurityGroupListResultPage) SecurityGroupListResultIterator { + return SecurityGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sglr SecurityGroupListResult) IsEmpty() bool { + return sglr.Value == nil || len(*sglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sglr SecurityGroupListResult) hasNextLink() bool { + return sglr.NextLink != nil && len(*sglr.NextLink) != 0 +} + +// securityGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sglr SecurityGroupListResult) securityGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !sglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sglr.NextLink))) +} + +// SecurityGroupListResultPage contains a page of SecurityGroup values. +type SecurityGroupListResultPage struct { + fn func(context.Context, SecurityGroupListResult) (SecurityGroupListResult, error) + sglr SecurityGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SecurityGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sglr) + if err != nil { + return err + } + page.sglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SecurityGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecurityGroupListResultPage) NotDone() bool { + return !page.sglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecurityGroupListResultPage) Response() SecurityGroupListResult { + return page.sglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecurityGroupListResultPage) Values() []SecurityGroup { + if page.sglr.IsEmpty() { + return nil + } + return *page.sglr.Value +} + +// Creates a new instance of the SecurityGroupListResultPage type. +func NewSecurityGroupListResultPage(cur SecurityGroupListResult, getNextPage func(context.Context, SecurityGroupListResult) (SecurityGroupListResult, error)) SecurityGroupListResultPage { + return SecurityGroupListResultPage{ + fn: getNextPage, + sglr: cur, + } +} + +// SecurityGroupNetworkInterface network interface and all its associated security rules. +type SecurityGroupNetworkInterface struct { + // ID - ID of the network interface. + ID *string `json:"id,omitempty"` + // SecurityRuleAssociations - All security rules associated with the network interface. + SecurityRuleAssociations *SecurityRuleAssociations `json:"securityRuleAssociations,omitempty"` +} + +// SecurityGroupPropertiesFormat network Security Group resource. +type SecurityGroupPropertiesFormat struct { + // FlushConnection - When enabled, flows created from Network Security Group connections will be re-evaluated when rules are updates. Initial enablement will trigger re-evaluation. + FlushConnection *bool `json:"flushConnection,omitempty"` + // SecurityRules - A collection of security rules of the network security group. + SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` + // DefaultSecurityRules - READ-ONLY; The default security rules of network security group. + DefaultSecurityRules *[]SecurityRule `json:"defaultSecurityRules,omitempty"` + // NetworkInterfaces - READ-ONLY; A collection of references to network interfaces. + NetworkInterfaces *[]Interface `json:"networkInterfaces,omitempty"` + // Subnets - READ-ONLY; A collection of references to subnets. + Subnets *[]Subnet `json:"subnets,omitempty"` + // FlowLogs - READ-ONLY; A collection of references to flow log resources. + FlowLogs *[]FlowLog `json:"flowLogs,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the network security group resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the network security group resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityGroupPropertiesFormat. +func (sgpf SecurityGroupPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sgpf.FlushConnection != nil { + objectMap["flushConnection"] = sgpf.FlushConnection + } + if sgpf.SecurityRules != nil { + objectMap["securityRules"] = sgpf.SecurityRules + } + return json.Marshal(objectMap) +} + +// SecurityGroupResult network configuration diagnostic result corresponded provided traffic query. +type SecurityGroupResult struct { + // SecurityRuleAccessResult - The network traffic is allowed or denied. Possible values include: 'SecurityRuleAccessAllow', 'SecurityRuleAccessDeny' + SecurityRuleAccessResult SecurityRuleAccess `json:"securityRuleAccessResult,omitempty"` + // EvaluatedNetworkSecurityGroups - READ-ONLY; List of results network security groups diagnostic. + EvaluatedNetworkSecurityGroups *[]EvaluatedNetworkSecurityGroup `json:"evaluatedNetworkSecurityGroups,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityGroupResult. +func (sgr SecurityGroupResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sgr.SecurityRuleAccessResult != "" { + objectMap["securityRuleAccessResult"] = sgr.SecurityRuleAccessResult + } + return json.Marshal(objectMap) +} + +// SecurityGroupViewParameters parameters that define the VM to check security groups for. +type SecurityGroupViewParameters struct { + // TargetResourceID - ID of the target VM. + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// SecurityGroupViewResult the information about security rules applied to the specified VM. +type SecurityGroupViewResult struct { + autorest.Response `json:"-"` + // NetworkInterfaces - List of network interfaces on the specified VM. + NetworkInterfaces *[]SecurityGroupNetworkInterface `json:"networkInterfaces,omitempty"` +} + +// SecurityGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SecurityGroupsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityGroupsClient) (SecurityGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityGroupsCreateOrUpdateFuture.Result. +func (future *SecurityGroupsCreateOrUpdateFuture) result(client SecurityGroupsClient) (sg SecurityGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SecurityGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sg.Response.Response, err = future.GetResult(sender); err == nil && sg.Response.Response.StatusCode != http.StatusNoContent { + sg, err = client.CreateOrUpdateResponder(sg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", sg.Response.Response, "Failure responding to request") + } + } + return +} + +// SecurityGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SecurityGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityGroupsDeleteFuture.Result. +func (future *SecurityGroupsDeleteFuture) result(client SecurityGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SecurityGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SecurityPartnerProvider security Partner Provider resource. +type SecurityPartnerProvider struct { + autorest.Response `json:"-"` + // SecurityPartnerProviderPropertiesFormat - Properties of the Security Partner Provider. + *SecurityPartnerProviderPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for SecurityPartnerProvider. +func (spp SecurityPartnerProvider) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spp.SecurityPartnerProviderPropertiesFormat != nil { + objectMap["properties"] = spp.SecurityPartnerProviderPropertiesFormat + } + if spp.ID != nil { + objectMap["id"] = spp.ID + } + if spp.Location != nil { + objectMap["location"] = spp.Location + } + if spp.Tags != nil { + objectMap["tags"] = spp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecurityPartnerProvider struct. +func (spp *SecurityPartnerProvider) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var securityPartnerProviderPropertiesFormat SecurityPartnerProviderPropertiesFormat + err = json.Unmarshal(*v, &securityPartnerProviderPropertiesFormat) + if err != nil { + return err + } + spp.SecurityPartnerProviderPropertiesFormat = &securityPartnerProviderPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + spp.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + spp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + spp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + spp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + spp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + spp.Tags = tags + } + } + } + + return nil +} + +// SecurityPartnerProviderListResult response for ListSecurityPartnerProviders API service call. +type SecurityPartnerProviderListResult struct { + autorest.Response `json:"-"` + // Value - List of Security Partner Providers in a resource group. + Value *[]SecurityPartnerProvider `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// SecurityPartnerProviderListResultIterator provides access to a complete listing of +// SecurityPartnerProvider values. +type SecurityPartnerProviderListResultIterator struct { + i int + page SecurityPartnerProviderListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SecurityPartnerProviderListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPartnerProviderListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SecurityPartnerProviderListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecurityPartnerProviderListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SecurityPartnerProviderListResultIterator) Response() SecurityPartnerProviderListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SecurityPartnerProviderListResultIterator) Value() SecurityPartnerProvider { + if !iter.page.NotDone() { + return SecurityPartnerProvider{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SecurityPartnerProviderListResultIterator type. +func NewSecurityPartnerProviderListResultIterator(page SecurityPartnerProviderListResultPage) SecurityPartnerProviderListResultIterator { + return SecurityPartnerProviderListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (spplr SecurityPartnerProviderListResult) IsEmpty() bool { + return spplr.Value == nil || len(*spplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (spplr SecurityPartnerProviderListResult) hasNextLink() bool { + return spplr.NextLink != nil && len(*spplr.NextLink) != 0 +} + +// securityPartnerProviderListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (spplr SecurityPartnerProviderListResult) securityPartnerProviderListResultPreparer(ctx context.Context) (*http.Request, error) { + if !spplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(spplr.NextLink))) +} + +// SecurityPartnerProviderListResultPage contains a page of SecurityPartnerProvider values. +type SecurityPartnerProviderListResultPage struct { + fn func(context.Context, SecurityPartnerProviderListResult) (SecurityPartnerProviderListResult, error) + spplr SecurityPartnerProviderListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SecurityPartnerProviderListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPartnerProviderListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.spplr) + if err != nil { + return err + } + page.spplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SecurityPartnerProviderListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecurityPartnerProviderListResultPage) NotDone() bool { + return !page.spplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecurityPartnerProviderListResultPage) Response() SecurityPartnerProviderListResult { + return page.spplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecurityPartnerProviderListResultPage) Values() []SecurityPartnerProvider { + if page.spplr.IsEmpty() { + return nil + } + return *page.spplr.Value +} + +// Creates a new instance of the SecurityPartnerProviderListResultPage type. +func NewSecurityPartnerProviderListResultPage(cur SecurityPartnerProviderListResult, getNextPage func(context.Context, SecurityPartnerProviderListResult) (SecurityPartnerProviderListResult, error)) SecurityPartnerProviderListResultPage { + return SecurityPartnerProviderListResultPage{ + fn: getNextPage, + spplr: cur, + } +} + +// SecurityPartnerProviderPropertiesFormat properties of the Security Partner Provider. +type SecurityPartnerProviderPropertiesFormat struct { + // ProvisioningState - READ-ONLY; The provisioning state of the Security Partner Provider resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // SecurityProviderName - The security provider name. Possible values include: 'SecurityProviderNameZScaler', 'SecurityProviderNameIBoss', 'SecurityProviderNameCheckpoint' + SecurityProviderName SecurityProviderName `json:"securityProviderName,omitempty"` + // ConnectionStatus - READ-ONLY; The connection status with the Security Partner Provider. Possible values include: 'SecurityPartnerProviderConnectionStatusUnknown', 'SecurityPartnerProviderConnectionStatusPartiallyConnected', 'SecurityPartnerProviderConnectionStatusConnected', 'SecurityPartnerProviderConnectionStatusNotConnected' + ConnectionStatus SecurityPartnerProviderConnectionStatus `json:"connectionStatus,omitempty"` + // VirtualHub - The virtualHub to which the Security Partner Provider belongs. + VirtualHub *SubResource `json:"virtualHub,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityPartnerProviderPropertiesFormat. +func (spppf SecurityPartnerProviderPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spppf.SecurityProviderName != "" { + objectMap["securityProviderName"] = spppf.SecurityProviderName + } + if spppf.VirtualHub != nil { + objectMap["virtualHub"] = spppf.VirtualHub + } + return json.Marshal(objectMap) +} + +// SecurityPartnerProvidersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type SecurityPartnerProvidersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityPartnerProvidersClient) (SecurityPartnerProvider, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityPartnerProvidersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityPartnerProvidersCreateOrUpdateFuture.Result. +func (future *SecurityPartnerProvidersCreateOrUpdateFuture) result(client SecurityPartnerProvidersClient) (spp SecurityPartnerProvider, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + spp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SecurityPartnerProvidersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if spp.Response.Response, err = future.GetResult(sender); err == nil && spp.Response.Response.StatusCode != http.StatusNoContent { + spp, err = client.CreateOrUpdateResponder(spp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersCreateOrUpdateFuture", "Result", spp.Response.Response, "Failure responding to request") + } + } + return +} + +// SecurityPartnerProvidersDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SecurityPartnerProvidersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityPartnerProvidersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityPartnerProvidersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityPartnerProvidersDeleteFuture.Result. +func (future *SecurityPartnerProvidersDeleteFuture) result(client SecurityPartnerProvidersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SecurityPartnerProvidersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SecurityRule network security rule. +type SecurityRule struct { + autorest.Response `json:"-"` + // SecurityRulePropertiesFormat - Properties of the security rule. + *SecurityRulePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityRule. +func (sr SecurityRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.SecurityRulePropertiesFormat != nil { + objectMap["properties"] = sr.SecurityRulePropertiesFormat + } + if sr.Name != nil { + objectMap["name"] = sr.Name + } + if sr.Type != nil { + objectMap["type"] = sr.Type + } + if sr.ID != nil { + objectMap["id"] = sr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecurityRule struct. +func (sr *SecurityRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var securityRulePropertiesFormat SecurityRulePropertiesFormat + err = json.Unmarshal(*v, &securityRulePropertiesFormat) + if err != nil { + return err + } + sr.SecurityRulePropertiesFormat = &securityRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sr.ID = &ID + } + } + } + + return nil +} + +// SecurityRuleAssociations all security rules associated with the network interface. +type SecurityRuleAssociations struct { + // NetworkInterfaceAssociation - Network interface and it's custom security rules. + NetworkInterfaceAssociation *InterfaceAssociation `json:"networkInterfaceAssociation,omitempty"` + // SubnetAssociation - Subnet and it's custom security rules. + SubnetAssociation *SubnetAssociation `json:"subnetAssociation,omitempty"` + // DefaultSecurityRules - Collection of default security rules of the network security group. + DefaultSecurityRules *[]SecurityRule `json:"defaultSecurityRules,omitempty"` + // EffectiveSecurityRules - Collection of effective security rules. + EffectiveSecurityRules *[]EffectiveNetworkSecurityRule `json:"effectiveSecurityRules,omitempty"` +} + +// SecurityRuleListResult response for ListSecurityRule API service call. Retrieves all security rules that +// belongs to a network security group. +type SecurityRuleListResult struct { + autorest.Response `json:"-"` + // Value - The security rules in a network security group. + Value *[]SecurityRule `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// SecurityRuleListResultIterator provides access to a complete listing of SecurityRule values. +type SecurityRuleListResultIterator struct { + i int + page SecurityRuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SecurityRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityRuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SecurityRuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecurityRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SecurityRuleListResultIterator) Response() SecurityRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SecurityRuleListResultIterator) Value() SecurityRule { + if !iter.page.NotDone() { + return SecurityRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SecurityRuleListResultIterator type. +func NewSecurityRuleListResultIterator(page SecurityRuleListResultPage) SecurityRuleListResultIterator { + return SecurityRuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (srlr SecurityRuleListResult) IsEmpty() bool { + return srlr.Value == nil || len(*srlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (srlr SecurityRuleListResult) hasNextLink() bool { + return srlr.NextLink != nil && len(*srlr.NextLink) != 0 +} + +// securityRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (srlr SecurityRuleListResult) securityRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !srlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(srlr.NextLink))) +} + +// SecurityRuleListResultPage contains a page of SecurityRule values. +type SecurityRuleListResultPage struct { + fn func(context.Context, SecurityRuleListResult) (SecurityRuleListResult, error) + srlr SecurityRuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SecurityRuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityRuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.srlr) + if err != nil { + return err + } + page.srlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SecurityRuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecurityRuleListResultPage) NotDone() bool { + return !page.srlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecurityRuleListResultPage) Response() SecurityRuleListResult { + return page.srlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecurityRuleListResultPage) Values() []SecurityRule { + if page.srlr.IsEmpty() { + return nil + } + return *page.srlr.Value +} + +// Creates a new instance of the SecurityRuleListResultPage type. +func NewSecurityRuleListResultPage(cur SecurityRuleListResult, getNextPage func(context.Context, SecurityRuleListResult) (SecurityRuleListResult, error)) SecurityRuleListResultPage { + return SecurityRuleListResultPage{ + fn: getNextPage, + srlr: cur, + } +} + +// SecurityRulePropertiesFormat security rule resource. +type SecurityRulePropertiesFormat struct { + // Description - A description for this rule. Restricted to 140 chars. + Description *string `json:"description,omitempty"` + // Protocol - Network protocol this rule applies to. Possible values include: 'SecurityRuleProtocolTCP', 'SecurityRuleProtocolUDP', 'SecurityRuleProtocolIcmp', 'SecurityRuleProtocolEsp', 'SecurityRuleProtocolAsterisk', 'SecurityRuleProtocolAh' + Protocol SecurityRuleProtocol `json:"protocol,omitempty"` + // SourcePortRange - The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. + SourcePortRange *string `json:"sourcePortRange,omitempty"` + // DestinationPortRange - The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. + DestinationPortRange *string `json:"destinationPortRange,omitempty"` + // SourceAddressPrefix - 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. + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + // SourceAddressPrefixes - The CIDR or source IP ranges. + SourceAddressPrefixes *[]string `json:"sourceAddressPrefixes,omitempty"` + // SourceApplicationSecurityGroups - The application security group specified as source. + SourceApplicationSecurityGroups *[]ApplicationSecurityGroup `json:"sourceApplicationSecurityGroups,omitempty"` + // DestinationAddressPrefix - 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. + DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` + // DestinationAddressPrefixes - The destination address prefixes. CIDR or destination IP ranges. + DestinationAddressPrefixes *[]string `json:"destinationAddressPrefixes,omitempty"` + // DestinationApplicationSecurityGroups - The application security group specified as destination. + DestinationApplicationSecurityGroups *[]ApplicationSecurityGroup `json:"destinationApplicationSecurityGroups,omitempty"` + // SourcePortRanges - The source port ranges. + SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` + // DestinationPortRanges - The destination port ranges. + DestinationPortRanges *[]string `json:"destinationPortRanges,omitempty"` + // Access - The network traffic is allowed or denied. Possible values include: 'SecurityRuleAccessAllow', 'SecurityRuleAccessDeny' + Access SecurityRuleAccess `json:"access,omitempty"` + // Priority - 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. + Priority *int32 `json:"priority,omitempty"` + // Direction - The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values include: 'SecurityRuleDirectionInbound', 'SecurityRuleDirectionOutbound' + Direction SecurityRuleDirection `json:"direction,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the security rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityRulePropertiesFormat. +func (srpf SecurityRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if srpf.Description != nil { + objectMap["description"] = srpf.Description + } + if srpf.Protocol != "" { + objectMap["protocol"] = srpf.Protocol + } + if srpf.SourcePortRange != nil { + objectMap["sourcePortRange"] = srpf.SourcePortRange + } + if srpf.DestinationPortRange != nil { + objectMap["destinationPortRange"] = srpf.DestinationPortRange + } + if srpf.SourceAddressPrefix != nil { + objectMap["sourceAddressPrefix"] = srpf.SourceAddressPrefix + } + if srpf.SourceAddressPrefixes != nil { + objectMap["sourceAddressPrefixes"] = srpf.SourceAddressPrefixes + } + if srpf.SourceApplicationSecurityGroups != nil { + objectMap["sourceApplicationSecurityGroups"] = srpf.SourceApplicationSecurityGroups + } + if srpf.DestinationAddressPrefix != nil { + objectMap["destinationAddressPrefix"] = srpf.DestinationAddressPrefix + } + if srpf.DestinationAddressPrefixes != nil { + objectMap["destinationAddressPrefixes"] = srpf.DestinationAddressPrefixes + } + if srpf.DestinationApplicationSecurityGroups != nil { + objectMap["destinationApplicationSecurityGroups"] = srpf.DestinationApplicationSecurityGroups + } + if srpf.SourcePortRanges != nil { + objectMap["sourcePortRanges"] = srpf.SourcePortRanges + } + if srpf.DestinationPortRanges != nil { + objectMap["destinationPortRanges"] = srpf.DestinationPortRanges + } + if srpf.Access != "" { + objectMap["access"] = srpf.Access + } + if srpf.Priority != nil { + objectMap["priority"] = srpf.Priority + } + if srpf.Direction != "" { + objectMap["direction"] = srpf.Direction + } + return json.Marshal(objectMap) +} + +// SecurityRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SecurityRulesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityRulesClient) (SecurityRule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityRulesCreateOrUpdateFuture.Result. +func (future *SecurityRulesCreateOrUpdateFuture) result(client SecurityRulesClient) (sr SecurityRule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SecurityRulesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { + sr, err = client.CreateOrUpdateResponder(sr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") + } + } + return +} + +// SecurityRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SecurityRulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityRulesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityRulesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityRulesDeleteFuture.Result. +func (future *SecurityRulesDeleteFuture) result(client SecurityRulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SecurityRulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SecurityRulesEvaluationResult network security rules evaluation result. +type SecurityRulesEvaluationResult struct { + // Name - Name of the network security rule. + Name *string `json:"name,omitempty"` + // ProtocolMatched - Value indicating whether protocol is matched. + ProtocolMatched *bool `json:"protocolMatched,omitempty"` + // SourceMatched - Value indicating whether source is matched. + SourceMatched *bool `json:"sourceMatched,omitempty"` + // SourcePortMatched - Value indicating whether source port is matched. + SourcePortMatched *bool `json:"sourcePortMatched,omitempty"` + // DestinationMatched - Value indicating whether destination is matched. + DestinationMatched *bool `json:"destinationMatched,omitempty"` + // DestinationPortMatched - Value indicating whether destination port is matched. + DestinationPortMatched *bool `json:"destinationPortMatched,omitempty"` +} + +// ServiceAssociationLink serviceAssociationLink resource. +type ServiceAssociationLink struct { + // ServiceAssociationLinkPropertiesFormat - Resource navigation link properties format. + *ServiceAssociationLinkPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceAssociationLink. +func (sal ServiceAssociationLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sal.ServiceAssociationLinkPropertiesFormat != nil { + objectMap["properties"] = sal.ServiceAssociationLinkPropertiesFormat + } + if sal.Name != nil { + objectMap["name"] = sal.Name + } + if sal.ID != nil { + objectMap["id"] = sal.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ServiceAssociationLink struct. +func (sal *ServiceAssociationLink) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var serviceAssociationLinkPropertiesFormat ServiceAssociationLinkPropertiesFormat + err = json.Unmarshal(*v, &serviceAssociationLinkPropertiesFormat) + if err != nil { + return err + } + sal.ServiceAssociationLinkPropertiesFormat = &serviceAssociationLinkPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sal.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sal.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sal.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sal.ID = &ID + } + } + } + + return nil +} + +// ServiceAssociationLinkPropertiesFormat properties of ServiceAssociationLink. +type ServiceAssociationLinkPropertiesFormat struct { + // LinkedResourceType - Resource type of the linked resource. + LinkedResourceType *string `json:"linkedResourceType,omitempty"` + // Link - Link to the external resource. + Link *string `json:"link,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the service association link resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // AllowDelete - If true, the resource can be deleted. + AllowDelete *bool `json:"allowDelete,omitempty"` + // Locations - A list of locations. + Locations *[]string `json:"locations,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceAssociationLinkPropertiesFormat. +func (salpf ServiceAssociationLinkPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if salpf.LinkedResourceType != nil { + objectMap["linkedResourceType"] = salpf.LinkedResourceType + } + if salpf.Link != nil { + objectMap["link"] = salpf.Link + } + if salpf.AllowDelete != nil { + objectMap["allowDelete"] = salpf.AllowDelete + } + if salpf.Locations != nil { + objectMap["locations"] = salpf.Locations + } + return json.Marshal(objectMap) +} + +// ServiceAssociationLinksListResult response for ServiceAssociationLinks_List operation. +type ServiceAssociationLinksListResult struct { + autorest.Response `json:"-"` + // Value - The service association links in a subnet. + Value *[]ServiceAssociationLink `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceAssociationLinksListResult. +func (sallr ServiceAssociationLinksListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sallr.Value != nil { + objectMap["value"] = sallr.Value + } + return json.Marshal(objectMap) +} + +// ServiceDelegationPropertiesFormat properties of a service delegation. +type ServiceDelegationPropertiesFormat struct { + // ServiceName - The name of the service to whom the subnet should be delegated (e.g. Microsoft.Sql/servers). + ServiceName *string `json:"serviceName,omitempty"` + // Actions - READ-ONLY; The actions permitted to the service upon delegation. + Actions *[]string `json:"actions,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the service delegation resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceDelegationPropertiesFormat. +func (sdpf ServiceDelegationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sdpf.ServiceName != nil { + objectMap["serviceName"] = sdpf.ServiceName + } + return json.Marshal(objectMap) +} + +// ServiceEndpointPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type ServiceEndpointPoliciesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServiceEndpointPoliciesClient) (ServiceEndpointPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServiceEndpointPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServiceEndpointPoliciesCreateOrUpdateFuture.Result. +func (future *ServiceEndpointPoliciesCreateOrUpdateFuture) result(client ServiceEndpointPoliciesClient) (sep ServiceEndpointPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sep.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ServiceEndpointPoliciesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sep.Response.Response, err = future.GetResult(sender); err == nil && sep.Response.Response.StatusCode != http.StatusNoContent { + sep, err = client.CreateOrUpdateResponder(sep.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesCreateOrUpdateFuture", "Result", sep.Response.Response, "Failure responding to request") + } + } + return +} + +// ServiceEndpointPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ServiceEndpointPoliciesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServiceEndpointPoliciesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServiceEndpointPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServiceEndpointPoliciesDeleteFuture.Result. +func (future *ServiceEndpointPoliciesDeleteFuture) result(client ServiceEndpointPoliciesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ServiceEndpointPoliciesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ServiceEndpointPolicy service End point policy resource. +type ServiceEndpointPolicy struct { + autorest.Response `json:"-"` + // ServiceEndpointPolicyPropertiesFormat - Properties of the service end point policy. + *ServiceEndpointPolicyPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Kind - READ-ONLY; Kind of service endpoint policy. This is metadata used for the Azure portal experience. + Kind *string `json:"kind,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ServiceEndpointPolicy. +func (sep ServiceEndpointPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sep.ServiceEndpointPolicyPropertiesFormat != nil { + objectMap["properties"] = sep.ServiceEndpointPolicyPropertiesFormat + } + if sep.ID != nil { + objectMap["id"] = sep.ID + } + if sep.Location != nil { + objectMap["location"] = sep.Location + } + if sep.Tags != nil { + objectMap["tags"] = sep.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ServiceEndpointPolicy struct. +func (sep *ServiceEndpointPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var serviceEndpointPolicyPropertiesFormat ServiceEndpointPolicyPropertiesFormat + err = json.Unmarshal(*v, &serviceEndpointPolicyPropertiesFormat) + if err != nil { + return err + } + sep.ServiceEndpointPolicyPropertiesFormat = &serviceEndpointPolicyPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sep.Etag = &etag + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sep.Kind = &kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sep.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sep.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sep.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + sep.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + sep.Tags = tags + } + } + } + + return nil +} + +// ServiceEndpointPolicyDefinition service Endpoint policy definitions. +type ServiceEndpointPolicyDefinition struct { + autorest.Response `json:"-"` + // ServiceEndpointPolicyDefinitionPropertiesFormat - Properties of the service endpoint policy definition. + *ServiceEndpointPolicyDefinitionPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceEndpointPolicyDefinition. +func (sepd ServiceEndpointPolicyDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sepd.ServiceEndpointPolicyDefinitionPropertiesFormat != nil { + objectMap["properties"] = sepd.ServiceEndpointPolicyDefinitionPropertiesFormat + } + if sepd.Name != nil { + objectMap["name"] = sepd.Name + } + if sepd.Type != nil { + objectMap["type"] = sepd.Type + } + if sepd.ID != nil { + objectMap["id"] = sepd.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ServiceEndpointPolicyDefinition struct. +func (sepd *ServiceEndpointPolicyDefinition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var serviceEndpointPolicyDefinitionPropertiesFormat ServiceEndpointPolicyDefinitionPropertiesFormat + err = json.Unmarshal(*v, &serviceEndpointPolicyDefinitionPropertiesFormat) + if err != nil { + return err + } + sepd.ServiceEndpointPolicyDefinitionPropertiesFormat = &serviceEndpointPolicyDefinitionPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sepd.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sepd.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sepd.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sepd.ID = &ID + } + } + } + + return nil +} + +// ServiceEndpointPolicyDefinitionListResult response for ListServiceEndpointPolicyDefinition API service +// call. Retrieves all service endpoint policy definition that belongs to a service endpoint policy. +type ServiceEndpointPolicyDefinitionListResult struct { + autorest.Response `json:"-"` + // Value - The service endpoint policy definition in a service endpoint policy. + Value *[]ServiceEndpointPolicyDefinition `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ServiceEndpointPolicyDefinitionListResultIterator provides access to a complete listing of +// ServiceEndpointPolicyDefinition values. +type ServiceEndpointPolicyDefinitionListResultIterator struct { + i int + page ServiceEndpointPolicyDefinitionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ServiceEndpointPolicyDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyDefinitionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ServiceEndpointPolicyDefinitionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceEndpointPolicyDefinitionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ServiceEndpointPolicyDefinitionListResultIterator) Response() ServiceEndpointPolicyDefinitionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ServiceEndpointPolicyDefinitionListResultIterator) Value() ServiceEndpointPolicyDefinition { + if !iter.page.NotDone() { + return ServiceEndpointPolicyDefinition{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServiceEndpointPolicyDefinitionListResultIterator type. +func NewServiceEndpointPolicyDefinitionListResultIterator(page ServiceEndpointPolicyDefinitionListResultPage) ServiceEndpointPolicyDefinitionListResultIterator { + return ServiceEndpointPolicyDefinitionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sepdlr ServiceEndpointPolicyDefinitionListResult) IsEmpty() bool { + return sepdlr.Value == nil || len(*sepdlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sepdlr ServiceEndpointPolicyDefinitionListResult) hasNextLink() bool { + return sepdlr.NextLink != nil && len(*sepdlr.NextLink) != 0 +} + +// serviceEndpointPolicyDefinitionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sepdlr ServiceEndpointPolicyDefinitionListResult) serviceEndpointPolicyDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !sepdlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sepdlr.NextLink))) +} + +// ServiceEndpointPolicyDefinitionListResultPage contains a page of ServiceEndpointPolicyDefinition values. +type ServiceEndpointPolicyDefinitionListResultPage struct { + fn func(context.Context, ServiceEndpointPolicyDefinitionListResult) (ServiceEndpointPolicyDefinitionListResult, error) + sepdlr ServiceEndpointPolicyDefinitionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ServiceEndpointPolicyDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyDefinitionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sepdlr) + if err != nil { + return err + } + page.sepdlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ServiceEndpointPolicyDefinitionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceEndpointPolicyDefinitionListResultPage) NotDone() bool { + return !page.sepdlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceEndpointPolicyDefinitionListResultPage) Response() ServiceEndpointPolicyDefinitionListResult { + return page.sepdlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceEndpointPolicyDefinitionListResultPage) Values() []ServiceEndpointPolicyDefinition { + if page.sepdlr.IsEmpty() { + return nil + } + return *page.sepdlr.Value +} + +// Creates a new instance of the ServiceEndpointPolicyDefinitionListResultPage type. +func NewServiceEndpointPolicyDefinitionListResultPage(cur ServiceEndpointPolicyDefinitionListResult, getNextPage func(context.Context, ServiceEndpointPolicyDefinitionListResult) (ServiceEndpointPolicyDefinitionListResult, error)) ServiceEndpointPolicyDefinitionListResultPage { + return ServiceEndpointPolicyDefinitionListResultPage{ + fn: getNextPage, + sepdlr: cur, + } +} + +// ServiceEndpointPolicyDefinitionPropertiesFormat service Endpoint policy definition resource. +type ServiceEndpointPolicyDefinitionPropertiesFormat struct { + // Description - A description for this rule. Restricted to 140 chars. + Description *string `json:"description,omitempty"` + // Service - Service endpoint name. + Service *string `json:"service,omitempty"` + // ServiceResources - A list of service resources. + ServiceResources *[]string `json:"serviceResources,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the service endpoint policy definition resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceEndpointPolicyDefinitionPropertiesFormat. +func (sepdpf ServiceEndpointPolicyDefinitionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sepdpf.Description != nil { + objectMap["description"] = sepdpf.Description + } + if sepdpf.Service != nil { + objectMap["service"] = sepdpf.Service + } + if sepdpf.ServiceResources != nil { + objectMap["serviceResources"] = sepdpf.ServiceResources + } + return json.Marshal(objectMap) +} + +// ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServiceEndpointPolicyDefinitionsClient) (ServiceEndpointPolicyDefinition, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture.Result. +func (future *ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture) result(client ServiceEndpointPolicyDefinitionsClient) (sepd ServiceEndpointPolicyDefinition, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sepd.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sepd.Response.Response, err = future.GetResult(sender); err == nil && sepd.Response.Response.StatusCode != http.StatusNoContent { + sepd, err = client.CreateOrUpdateResponder(sepd.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture", "Result", sepd.Response.Response, "Failure responding to request") + } + } + return +} + +// ServiceEndpointPolicyDefinitionsDeleteFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type ServiceEndpointPolicyDefinitionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServiceEndpointPolicyDefinitionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServiceEndpointPolicyDefinitionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServiceEndpointPolicyDefinitionsDeleteFuture.Result. +func (future *ServiceEndpointPolicyDefinitionsDeleteFuture) result(client ServiceEndpointPolicyDefinitionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ServiceEndpointPolicyDefinitionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ServiceEndpointPolicyListResult response for ListServiceEndpointPolicies API service call. +type ServiceEndpointPolicyListResult struct { + autorest.Response `json:"-"` + // Value - A list of ServiceEndpointPolicy resources. + Value *[]ServiceEndpointPolicy `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceEndpointPolicyListResult. +func (seplr ServiceEndpointPolicyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if seplr.Value != nil { + objectMap["value"] = seplr.Value + } + return json.Marshal(objectMap) +} + +// ServiceEndpointPolicyListResultIterator provides access to a complete listing of ServiceEndpointPolicy +// values. +type ServiceEndpointPolicyListResultIterator struct { + i int + page ServiceEndpointPolicyListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ServiceEndpointPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ServiceEndpointPolicyListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceEndpointPolicyListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ServiceEndpointPolicyListResultIterator) Response() ServiceEndpointPolicyListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ServiceEndpointPolicyListResultIterator) Value() ServiceEndpointPolicy { + if !iter.page.NotDone() { + return ServiceEndpointPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServiceEndpointPolicyListResultIterator type. +func NewServiceEndpointPolicyListResultIterator(page ServiceEndpointPolicyListResultPage) ServiceEndpointPolicyListResultIterator { + return ServiceEndpointPolicyListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (seplr ServiceEndpointPolicyListResult) IsEmpty() bool { + return seplr.Value == nil || len(*seplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (seplr ServiceEndpointPolicyListResult) hasNextLink() bool { + return seplr.NextLink != nil && len(*seplr.NextLink) != 0 +} + +// serviceEndpointPolicyListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (seplr ServiceEndpointPolicyListResult) serviceEndpointPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !seplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(seplr.NextLink))) +} + +// ServiceEndpointPolicyListResultPage contains a page of ServiceEndpointPolicy values. +type ServiceEndpointPolicyListResultPage struct { + fn func(context.Context, ServiceEndpointPolicyListResult) (ServiceEndpointPolicyListResult, error) + seplr ServiceEndpointPolicyListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ServiceEndpointPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.seplr) + if err != nil { + return err + } + page.seplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ServiceEndpointPolicyListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceEndpointPolicyListResultPage) NotDone() bool { + return !page.seplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceEndpointPolicyListResultPage) Response() ServiceEndpointPolicyListResult { + return page.seplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceEndpointPolicyListResultPage) Values() []ServiceEndpointPolicy { + if page.seplr.IsEmpty() { + return nil + } + return *page.seplr.Value +} + +// Creates a new instance of the ServiceEndpointPolicyListResultPage type. +func NewServiceEndpointPolicyListResultPage(cur ServiceEndpointPolicyListResult, getNextPage func(context.Context, ServiceEndpointPolicyListResult) (ServiceEndpointPolicyListResult, error)) ServiceEndpointPolicyListResultPage { + return ServiceEndpointPolicyListResultPage{ + fn: getNextPage, + seplr: cur, + } +} + +// ServiceEndpointPolicyPropertiesFormat service Endpoint Policy resource. +type ServiceEndpointPolicyPropertiesFormat struct { + // ServiceEndpointPolicyDefinitions - A collection of service endpoint policy definitions of the service endpoint policy. + ServiceEndpointPolicyDefinitions *[]ServiceEndpointPolicyDefinition `json:"serviceEndpointPolicyDefinitions,omitempty"` + // Subnets - READ-ONLY; A collection of references to subnets. + Subnets *[]Subnet `json:"subnets,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the service endpoint policy resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the service endpoint policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ServiceAlias - The alias indicating if the policy belongs to a service + ServiceAlias *string `json:"serviceAlias,omitempty"` + // ContextualServiceEndpointPolicies - A collection of contextual service endpoint policy. + ContextualServiceEndpointPolicies *[]string `json:"contextualServiceEndpointPolicies,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceEndpointPolicyPropertiesFormat. +func (seppf ServiceEndpointPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if seppf.ServiceEndpointPolicyDefinitions != nil { + objectMap["serviceEndpointPolicyDefinitions"] = seppf.ServiceEndpointPolicyDefinitions + } + if seppf.ServiceAlias != nil { + objectMap["serviceAlias"] = seppf.ServiceAlias + } + if seppf.ContextualServiceEndpointPolicies != nil { + objectMap["contextualServiceEndpointPolicies"] = seppf.ContextualServiceEndpointPolicies + } + return json.Marshal(objectMap) +} + +// ServiceEndpointPropertiesFormat the service endpoint properties. +type ServiceEndpointPropertiesFormat struct { + // Service - The type of the endpoint service. + Service *string `json:"service,omitempty"` + // Locations - A list of locations. + Locations *[]string `json:"locations,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the service endpoint resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceEndpointPropertiesFormat. +func (sepf ServiceEndpointPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sepf.Service != nil { + objectMap["service"] = sepf.Service + } + if sepf.Locations != nil { + objectMap["locations"] = sepf.Locations + } + return json.Marshal(objectMap) +} + +// ServiceTagInformation the service tag information. +type ServiceTagInformation struct { + // Properties - READ-ONLY; Properties of the service tag information. + Properties *ServiceTagInformationPropertiesFormat `json:"properties,omitempty"` + // Name - READ-ONLY; The name of service tag. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; The ID of service tag. + ID *string `json:"id,omitempty"` + // ServiceTagChangeNumber - READ-ONLY; The iteration number of service tag object for region. + ServiceTagChangeNumber *string `json:"serviceTagChangeNumber,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceTagInformation. +func (sti ServiceTagInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ServiceTagInformationListResult response for Get ServiceTagInformation API service call. Retrieves the +// list of service tag information resources. +type ServiceTagInformationListResult struct { + autorest.Response `json:"-"` + // Value - The list of service tag information resources. + Value *[]ServiceTagInformation `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceTagInformationListResult. +func (stilr ServiceTagInformationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if stilr.Value != nil { + objectMap["value"] = stilr.Value + } + return json.Marshal(objectMap) +} + +// ServiceTagInformationListResultIterator provides access to a complete listing of ServiceTagInformation +// values. +type ServiceTagInformationListResultIterator struct { + i int + page ServiceTagInformationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ServiceTagInformationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceTagInformationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ServiceTagInformationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceTagInformationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ServiceTagInformationListResultIterator) Response() ServiceTagInformationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ServiceTagInformationListResultIterator) Value() ServiceTagInformation { + if !iter.page.NotDone() { + return ServiceTagInformation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServiceTagInformationListResultIterator type. +func NewServiceTagInformationListResultIterator(page ServiceTagInformationListResultPage) ServiceTagInformationListResultIterator { + return ServiceTagInformationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (stilr ServiceTagInformationListResult) IsEmpty() bool { + return stilr.Value == nil || len(*stilr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (stilr ServiceTagInformationListResult) hasNextLink() bool { + return stilr.NextLink != nil && len(*stilr.NextLink) != 0 +} + +// serviceTagInformationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (stilr ServiceTagInformationListResult) serviceTagInformationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !stilr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(stilr.NextLink))) +} + +// ServiceTagInformationListResultPage contains a page of ServiceTagInformation values. +type ServiceTagInformationListResultPage struct { + fn func(context.Context, ServiceTagInformationListResult) (ServiceTagInformationListResult, error) + stilr ServiceTagInformationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ServiceTagInformationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceTagInformationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.stilr) + if err != nil { + return err + } + page.stilr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ServiceTagInformationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceTagInformationListResultPage) NotDone() bool { + return !page.stilr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceTagInformationListResultPage) Response() ServiceTagInformationListResult { + return page.stilr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceTagInformationListResultPage) Values() []ServiceTagInformation { + if page.stilr.IsEmpty() { + return nil + } + return *page.stilr.Value +} + +// Creates a new instance of the ServiceTagInformationListResultPage type. +func NewServiceTagInformationListResultPage(cur ServiceTagInformationListResult, getNextPage func(context.Context, ServiceTagInformationListResult) (ServiceTagInformationListResult, error)) ServiceTagInformationListResultPage { + return ServiceTagInformationListResultPage{ + fn: getNextPage, + stilr: cur, + } +} + +// ServiceTagInformationPropertiesFormat properties of the service tag information. +type ServiceTagInformationPropertiesFormat struct { + // ChangeNumber - READ-ONLY; The iteration number of service tag. + ChangeNumber *string `json:"changeNumber,omitempty"` + // Region - READ-ONLY; The region of service tag. + Region *string `json:"region,omitempty"` + // SystemService - READ-ONLY; The name of system service. + SystemService *string `json:"systemService,omitempty"` + // AddressPrefixes - READ-ONLY; The list of IP address prefixes. + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` + // State - READ-ONLY; The state of the service tag. + State *string `json:"state,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceTagInformationPropertiesFormat. +func (stipf ServiceTagInformationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ServiceTagsListResult response for the ListServiceTags API service call. +type ServiceTagsListResult struct { + autorest.Response `json:"-"` + // Name - READ-ONLY; The name of the cloud. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; The ID of the cloud. + ID *string `json:"id,omitempty"` + // Type - READ-ONLY; The azure resource type. + Type *string `json:"type,omitempty"` + // ChangeNumber - READ-ONLY; The iteration number. + ChangeNumber *string `json:"changeNumber,omitempty"` + // Cloud - READ-ONLY; The name of the cloud. + Cloud *string `json:"cloud,omitempty"` + // Values - READ-ONLY; The list of service tag information resources. + Values *[]ServiceTagInformation `json:"values,omitempty"` + // NextLink - READ-ONLY; The URL to get next page of service tag information resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceTagsListResult. +func (stlr ServiceTagsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SessionIds list of session IDs. +type SessionIds struct { + // SessionIds - List of session IDs. + SessionIds *[]string `json:"sessionIds,omitempty"` +} + +// SignatureOverridesFilterValuesQuery describes the filter values possibles for a given column +type SignatureOverridesFilterValuesQuery struct { + // FilterName - Describes the name of the column which values will be returned + FilterName *string `json:"filterName,omitempty"` +} + +// SignatureOverridesFilterValuesResponse describes the list of all possible values for a specific filter +// value +type SignatureOverridesFilterValuesResponse struct { + autorest.Response `json:"-"` + // FilterValues - Describes the possible values + FilterValues *[]string `json:"filterValues,omitempty"` +} + +// SignaturesOverrides contains all specific policy signatures overrides for the IDPS +type SignaturesOverrides struct { + autorest.Response `json:"-"` + // Name - Contains the name of the resource (default) + Name *string `json:"name,omitempty"` + // ID - Will contain the resource id of the signature override resource + ID *string `json:"id,omitempty"` + // Type - Will contain the type of the resource: Microsoft.Network/firewallPolicies/intrusionDetectionSignaturesOverrides + Type *string `json:"type,omitempty"` + // Properties - Will contain the properties of the resource (the actual signature overrides) + Properties *SignaturesOverridesProperties `json:"properties,omitempty"` +} + +// SignaturesOverridesList describes an object containing an array with a single item +type SignaturesOverridesList struct { + autorest.Response `json:"-"` + // Value - Describes a list consisting exactly one item describing the policy's signature override status + Value *[]SignaturesOverrides `json:"value,omitempty"` +} + +// SignaturesOverridesProperties will contain the properties of the resource (the actual signature +// overrides) +type SignaturesOverridesProperties struct { + Signatures map[string]*string `json:"signatures"` +} + +// MarshalJSON is the custom marshaler for SignaturesOverridesProperties. +func (so SignaturesOverridesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if so.Signatures != nil { + objectMap["signatures"] = so.Signatures + } + return json.Marshal(objectMap) +} + +// SingleQueryResult ... +type SingleQueryResult struct { + // SignatureID - The ID of the signature + SignatureID *int32 `json:"signatureId,omitempty"` + // Mode - The current mode enforced, 0 - Disabled, 1 - Alert, 2 -Deny + Mode *int32 `json:"mode,omitempty"` + // Severity - Describes the severity of signature: 1 - Low, 2 - Medium, 3 - High + Severity *int32 `json:"severity,omitempty"` + // Direction - Describes in which direction signature is being enforced: 0 - Inbound, 1 - OutBound, 2 - Bidirectional + Direction *int32 `json:"direction,omitempty"` + // Group - Describes the groups the signature belongs to + Group *string `json:"group,omitempty"` + // Description - Describes what is the signature enforces + Description *string `json:"description,omitempty"` + // Protocol - Describes the protocol the signatures is being enforced in + Protocol *string `json:"protocol,omitempty"` + // SourcePorts - Describes the list of source ports related to this signature + SourcePorts *[]string `json:"sourcePorts,omitempty"` + // DestinationPorts - Describes the list of destination ports related to this signature + DestinationPorts *[]string `json:"destinationPorts,omitempty"` + // LastUpdated - Describes the last updated time of the signature (provided from 3rd party vendor) + LastUpdated *string `json:"lastUpdated,omitempty"` + // InheritedFromParentPolicy - Describes if this override is inherited from base policy or not + InheritedFromParentPolicy *bool `json:"inheritedFromParentPolicy,omitempty"` +} + +// Sku the sku of this Bastion Host. +type Sku struct { + // Name - The name of this Bastion Host. Possible values include: 'BastionHostSkuNameBasic', 'BastionHostSkuNameStandard' + Name BastionHostSkuName `json:"name,omitempty"` +} + +// StaticMember staticMember Item. +type StaticMember struct { + autorest.Response `json:"-"` + // StaticMemberProperties - The Static Member properties + *StaticMemberProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata related to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticMember. +func (sm StaticMember) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sm.StaticMemberProperties != nil { + objectMap["properties"] = sm.StaticMemberProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StaticMember struct. +func (sm *StaticMember) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var staticMemberProperties StaticMemberProperties + err = json.Unmarshal(*v, &staticMemberProperties) + if err != nil { + return err + } + sm.StaticMemberProperties = &staticMemberProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sm.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sm.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sm.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sm.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sm.Etag = &etag + } + } + } + + return nil +} + +// StaticMemberListResult result of the request to list StaticMember. It contains a list of groups and a +// URL link to get the next set of results. +type StaticMemberListResult struct { + autorest.Response `json:"-"` + // Value - Gets a page of StaticMember + Value *[]StaticMember `json:"value,omitempty"` + // NextLink - Gets the URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// StaticMemberListResultIterator provides access to a complete listing of StaticMember values. +type StaticMemberListResultIterator struct { + i int + page StaticMemberListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *StaticMemberListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticMemberListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *StaticMemberListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter StaticMemberListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter StaticMemberListResultIterator) Response() StaticMemberListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter StaticMemberListResultIterator) Value() StaticMember { + if !iter.page.NotDone() { + return StaticMember{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the StaticMemberListResultIterator type. +func NewStaticMemberListResultIterator(page StaticMemberListResultPage) StaticMemberListResultIterator { + return StaticMemberListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (smlr StaticMemberListResult) IsEmpty() bool { + return smlr.Value == nil || len(*smlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (smlr StaticMemberListResult) hasNextLink() bool { + return smlr.NextLink != nil && len(*smlr.NextLink) != 0 +} + +// staticMemberListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (smlr StaticMemberListResult) staticMemberListResultPreparer(ctx context.Context) (*http.Request, error) { + if !smlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(smlr.NextLink))) +} + +// StaticMemberListResultPage contains a page of StaticMember values. +type StaticMemberListResultPage struct { + fn func(context.Context, StaticMemberListResult) (StaticMemberListResult, error) + smlr StaticMemberListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *StaticMemberListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StaticMemberListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.smlr) + if err != nil { + return err + } + page.smlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *StaticMemberListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page StaticMemberListResultPage) NotDone() bool { + return !page.smlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page StaticMemberListResultPage) Response() StaticMemberListResult { + return page.smlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page StaticMemberListResultPage) Values() []StaticMember { + if page.smlr.IsEmpty() { + return nil + } + return *page.smlr.Value +} + +// Creates a new instance of the StaticMemberListResultPage type. +func NewStaticMemberListResultPage(cur StaticMemberListResult, getNextPage func(context.Context, StaticMemberListResult) (StaticMemberListResult, error)) StaticMemberListResultPage { + return StaticMemberListResultPage{ + fn: getNextPage, + smlr: cur, + } +} + +// StaticMemberProperties properties of static member. +type StaticMemberProperties struct { + // ResourceID - Resource Id. + ResourceID *string `json:"resourceId,omitempty"` + // Region - READ-ONLY; Resource region. + Region *string `json:"region,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the scope assignment resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticMemberProperties. +func (smp StaticMemberProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if smp.ResourceID != nil { + objectMap["resourceId"] = smp.ResourceID + } + return json.Marshal(objectMap) +} + +// StaticRoute list of all Static Routes. +type StaticRoute struct { + // Name - The name of the StaticRoute that is unique within a VnetRoute. + Name *string `json:"name,omitempty"` + // AddressPrefixes - List of all address prefixes. + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` + // NextHopIPAddress - The ip address of the next hop. + NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` +} + +// StaticRoutesConfig configuration for static routes on this HubVnetConnectionConfiguration for static +// routes on this HubVnetConnection. +type StaticRoutesConfig struct { + // PropagateStaticRoutes - READ-ONLY; Boolean indicating whether static routes on this connection are automatically propagate to route tables which this connection propagates to. + PropagateStaticRoutes *bool `json:"propagateStaticRoutes,omitempty"` + // VnetLocalRouteOverrideCriteria - Parameter determining whether NVA in spoke vnet is bypassed for traffic with destination in spoke. Possible values include: 'VnetLocalRouteOverrideCriteriaContains', 'VnetLocalRouteOverrideCriteriaEqual' + VnetLocalRouteOverrideCriteria VnetLocalRouteOverrideCriteria `json:"vnetLocalRouteOverrideCriteria,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticRoutesConfig. +func (src StaticRoutesConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if src.VnetLocalRouteOverrideCriteria != "" { + objectMap["vnetLocalRouteOverrideCriteria"] = src.VnetLocalRouteOverrideCriteria + } + return json.Marshal(objectMap) +} + +// String ... +type String struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` +} + +// SubResource reference to another subresource. +type SubResource struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// Subnet subnet in a virtual network resource. +type Subnet struct { + autorest.Response `json:"-"` + // SubnetPropertiesFormat - Properties of the subnet. + *SubnetPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for Subnet. +func (s Subnet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SubnetPropertiesFormat != nil { + objectMap["properties"] = s.SubnetPropertiesFormat + } + if s.Name != nil { + objectMap["name"] = s.Name + } + if s.Type != nil { + objectMap["type"] = s.Type + } + if s.ID != nil { + objectMap["id"] = s.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Subnet struct. +func (s *Subnet) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var subnetPropertiesFormat SubnetPropertiesFormat + err = json.Unmarshal(*v, &subnetPropertiesFormat) + if err != nil { + return err + } + s.SubnetPropertiesFormat = &subnetPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + s.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + } + } + + return nil +} + +// SubnetAssociation subnet and it's custom security rules. +type SubnetAssociation struct { + // ID - READ-ONLY; Subnet ID. + ID *string `json:"id,omitempty"` + // SecurityRules - Collection of custom security rules. + SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubnetAssociation. +func (sa SubnetAssociation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sa.SecurityRules != nil { + objectMap["securityRules"] = sa.SecurityRules + } + return json.Marshal(objectMap) +} + +// SubnetListResult response for ListSubnets API service callRetrieves all subnet that belongs to a virtual +// network. +type SubnetListResult struct { + autorest.Response `json:"-"` + // Value - The subnets in a virtual network. + Value *[]Subnet `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// SubnetListResultIterator provides access to a complete listing of Subnet values. +type SubnetListResultIterator struct { + i int + page SubnetListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SubnetListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubnetListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SubnetListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SubnetListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SubnetListResultIterator) Response() SubnetListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SubnetListResultIterator) Value() Subnet { + if !iter.page.NotDone() { + return Subnet{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SubnetListResultIterator type. +func NewSubnetListResultIterator(page SubnetListResultPage) SubnetListResultIterator { + return SubnetListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (slr SubnetListResult) IsEmpty() bool { + return slr.Value == nil || len(*slr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (slr SubnetListResult) hasNextLink() bool { + return slr.NextLink != nil && len(*slr.NextLink) != 0 +} + +// subnetListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (slr SubnetListResult) subnetListResultPreparer(ctx context.Context) (*http.Request, error) { + if !slr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(slr.NextLink))) +} + +// SubnetListResultPage contains a page of Subnet values. +type SubnetListResultPage struct { + fn func(context.Context, SubnetListResult) (SubnetListResult, error) + slr SubnetListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SubnetListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubnetListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.slr) + if err != nil { + return err + } + page.slr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SubnetListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SubnetListResultPage) NotDone() bool { + return !page.slr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SubnetListResultPage) Response() SubnetListResult { + return page.slr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SubnetListResultPage) Values() []Subnet { + if page.slr.IsEmpty() { + return nil + } + return *page.slr.Value +} + +// Creates a new instance of the SubnetListResultPage type. +func NewSubnetListResultPage(cur SubnetListResult, getNextPage func(context.Context, SubnetListResult) (SubnetListResult, error)) SubnetListResultPage { + return SubnetListResultPage{ + fn: getNextPage, + slr: cur, + } +} + +// SubnetPropertiesFormat properties of the subnet. +type SubnetPropertiesFormat struct { + // AddressPrefix - The address prefix for the subnet. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // AddressPrefixes - List of address prefixes for the subnet. + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` + // NetworkSecurityGroup - The reference to the NetworkSecurityGroup resource. + NetworkSecurityGroup *SecurityGroup `json:"networkSecurityGroup,omitempty"` + // RouteTable - The reference to the RouteTable resource. + RouteTable *RouteTable `json:"routeTable,omitempty"` + // NatGateway - Nat gateway associated with this subnet. + NatGateway *SubResource `json:"natGateway,omitempty"` + // ServiceEndpoints - An array of service endpoints. + ServiceEndpoints *[]ServiceEndpointPropertiesFormat `json:"serviceEndpoints,omitempty"` + // ServiceEndpointPolicies - An array of service endpoint policies. + ServiceEndpointPolicies *[]ServiceEndpointPolicy `json:"serviceEndpointPolicies,omitempty"` + // PrivateEndpoints - READ-ONLY; An array of references to private endpoints. + PrivateEndpoints *[]PrivateEndpoint `json:"privateEndpoints,omitempty"` + // IPConfigurations - READ-ONLY; An array of references to the network interface IP configurations using subnet. + IPConfigurations *[]IPConfiguration `json:"ipConfigurations,omitempty"` + // IPConfigurationProfiles - READ-ONLY; Array of IP configuration profiles which reference this subnet. + IPConfigurationProfiles *[]IPConfigurationProfile `json:"ipConfigurationProfiles,omitempty"` + // IPAllocations - Array of IpAllocation which reference this subnet. + IPAllocations *[]SubResource `json:"ipAllocations,omitempty"` + // ResourceNavigationLinks - READ-ONLY; An array of references to the external resources using subnet. + ResourceNavigationLinks *[]ResourceNavigationLink `json:"resourceNavigationLinks,omitempty"` + // ServiceAssociationLinks - READ-ONLY; An array of references to services injecting into this subnet. + ServiceAssociationLinks *[]ServiceAssociationLink `json:"serviceAssociationLinks,omitempty"` + // Delegations - An array of references to the delegations on the subnet. + Delegations *[]Delegation `json:"delegations,omitempty"` + // Purpose - READ-ONLY; A read-only string identifying the intention of use for this subnet based on delegations and other user-defined properties. + Purpose *string `json:"purpose,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the subnet resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateEndpointNetworkPolicies - Enable or Disable apply network policies on private end point in the subnet. Possible values include: 'VirtualNetworkPrivateEndpointNetworkPoliciesEnabled', 'VirtualNetworkPrivateEndpointNetworkPoliciesDisabled' + PrivateEndpointNetworkPolicies VirtualNetworkPrivateEndpointNetworkPolicies `json:"privateEndpointNetworkPolicies,omitempty"` + // PrivateLinkServiceNetworkPolicies - Enable or Disable apply network policies on private link service in the subnet. Possible values include: 'VirtualNetworkPrivateLinkServiceNetworkPoliciesEnabled', 'VirtualNetworkPrivateLinkServiceNetworkPoliciesDisabled' + PrivateLinkServiceNetworkPolicies VirtualNetworkPrivateLinkServiceNetworkPolicies `json:"privateLinkServiceNetworkPolicies,omitempty"` + // ApplicationGatewayIPConfigurations - Application gateway IP configurations of virtual network resource. + ApplicationGatewayIPConfigurations *[]ApplicationGatewayIPConfiguration `json:"applicationGatewayIpConfigurations,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubnetPropertiesFormat. +func (spf SubnetPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spf.AddressPrefix != nil { + objectMap["addressPrefix"] = spf.AddressPrefix + } + if spf.AddressPrefixes != nil { + objectMap["addressPrefixes"] = spf.AddressPrefixes + } + if spf.NetworkSecurityGroup != nil { + objectMap["networkSecurityGroup"] = spf.NetworkSecurityGroup + } + if spf.RouteTable != nil { + objectMap["routeTable"] = spf.RouteTable + } + if spf.NatGateway != nil { + objectMap["natGateway"] = spf.NatGateway + } + if spf.ServiceEndpoints != nil { + objectMap["serviceEndpoints"] = spf.ServiceEndpoints + } + if spf.ServiceEndpointPolicies != nil { + objectMap["serviceEndpointPolicies"] = spf.ServiceEndpointPolicies + } + if spf.IPAllocations != nil { + objectMap["ipAllocations"] = spf.IPAllocations + } + if spf.Delegations != nil { + objectMap["delegations"] = spf.Delegations + } + if spf.PrivateEndpointNetworkPolicies != "" { + objectMap["privateEndpointNetworkPolicies"] = spf.PrivateEndpointNetworkPolicies + } + if spf.PrivateLinkServiceNetworkPolicies != "" { + objectMap["privateLinkServiceNetworkPolicies"] = spf.PrivateLinkServiceNetworkPolicies + } + if spf.ApplicationGatewayIPConfigurations != nil { + objectMap["applicationGatewayIpConfigurations"] = spf.ApplicationGatewayIPConfigurations + } + return json.Marshal(objectMap) +} + +// SubnetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SubnetsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SubnetsClient) (Subnet, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SubnetsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SubnetsCreateOrUpdateFuture.Result. +func (future *SubnetsCreateOrUpdateFuture) result(client SubnetsClient) (s Subnet, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SubnetsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.CreateOrUpdateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// SubnetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SubnetsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SubnetsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SubnetsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SubnetsDeleteFuture.Result. +func (future *SubnetsDeleteFuture) result(client SubnetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SubnetsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SubnetsPrepareNetworkPoliciesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SubnetsPrepareNetworkPoliciesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SubnetsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SubnetsPrepareNetworkPoliciesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SubnetsPrepareNetworkPoliciesFuture.Result. +func (future *SubnetsPrepareNetworkPoliciesFuture) result(client SubnetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsPrepareNetworkPoliciesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SubnetsPrepareNetworkPoliciesFuture") + return + } + ar.Response = future.Response() + return +} + +// SubnetsUnprepareNetworkPoliciesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SubnetsUnprepareNetworkPoliciesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SubnetsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SubnetsUnprepareNetworkPoliciesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SubnetsUnprepareNetworkPoliciesFuture.Result. +func (future *SubnetsUnprepareNetworkPoliciesFuture) result(client SubnetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsUnprepareNetworkPoliciesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SubnetsUnprepareNetworkPoliciesFuture") + return + } + ar.Response = future.Response() + return +} + +// SwapResource swapResource to represent slot type on the specified cloud service. +type SwapResource struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + Properties *SwapResourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SwapResource. +func (sr SwapResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.Properties != nil { + objectMap["properties"] = sr.Properties + } + return json.Marshal(objectMap) +} + +// SwapResourceListResult swapResource List with single entry to represent slot type on the specified cloud +// service. +type SwapResourceListResult struct { + autorest.Response `json:"-"` + Value *[]SwapResource `json:"value,omitempty"` +} + +// SwapResourceProperties swap resource properties +type SwapResourceProperties struct { + // SlotType - Specifies slot info on a cloud service. Possible values include: 'SlotTypeProduction', 'SlotTypeStaging' + SlotType SlotType `json:"slotType,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TagsObject tags object for patch operations. +type TagsObject struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TagsObject. +func (toVar TagsObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if toVar.Tags != nil { + objectMap["tags"] = toVar.Tags + } + return json.Marshal(objectMap) +} + +// Topology topology of the specified resource group. +type Topology struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; GUID representing the operation id. + ID *string `json:"id,omitempty"` + // CreatedDateTime - READ-ONLY; The datetime when the topology was initially created for the resource group. + CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` + // LastModified - READ-ONLY; The datetime when the topology was last modified. + LastModified *date.Time `json:"lastModified,omitempty"` + // Resources - A list of topology resources. + Resources *[]TopologyResource `json:"resources,omitempty"` +} + +// MarshalJSON is the custom marshaler for Topology. +func (t Topology) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.Resources != nil { + objectMap["resources"] = t.Resources + } + return json.Marshal(objectMap) +} + +// TopologyAssociation resources that have an association with the parent resource. +type TopologyAssociation struct { + // Name - The name of the resource that is associated with the parent resource. + Name *string `json:"name,omitempty"` + // ResourceID - The ID of the resource that is associated with the parent resource. + ResourceID *string `json:"resourceId,omitempty"` + // AssociationType - The association type of the child resource to the parent resource. Possible values include: 'AssociationTypeAssociated', 'AssociationTypeContains' + AssociationType AssociationType `json:"associationType,omitempty"` +} + +// TopologyParameters parameters that define the representation of topology. +type TopologyParameters struct { + // TargetResourceGroupName - The name of the target resource group to perform topology on. + TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` + // TargetVirtualNetwork - The reference to the Virtual Network resource. + TargetVirtualNetwork *SubResource `json:"targetVirtualNetwork,omitempty"` + // TargetSubnet - The reference to the Subnet resource. + TargetSubnet *SubResource `json:"targetSubnet,omitempty"` +} + +// TopologyResource the network resource topology information for the given resource group. +type TopologyResource struct { + // Name - Name of the resource. + Name *string `json:"name,omitempty"` + // ID - ID of the resource. + ID *string `json:"id,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Associations - Holds the associations the resource has with other resources in the resource group. + Associations *[]TopologyAssociation `json:"associations,omitempty"` +} + +// TrafficAnalyticsConfigurationProperties parameters that define the configuration of traffic analytics. +type TrafficAnalyticsConfigurationProperties struct { + // Enabled - Flag to enable/disable traffic analytics. + Enabled *bool `json:"enabled,omitempty"` + // WorkspaceID - The resource guid of the attached workspace. + WorkspaceID *string `json:"workspaceId,omitempty"` + // WorkspaceRegion - The location of the attached workspace. + WorkspaceRegion *string `json:"workspaceRegion,omitempty"` + // WorkspaceResourceID - Resource Id of the attached workspace. + WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` + // TrafficAnalyticsInterval - The interval in minutes which would decide how frequently TA service should do flow analytics. + TrafficAnalyticsInterval *int32 `json:"trafficAnalyticsInterval,omitempty"` +} + +// TrafficAnalyticsProperties parameters that define the configuration of traffic analytics. +type TrafficAnalyticsProperties struct { + // NetworkWatcherFlowAnalyticsConfiguration - Parameters that define the configuration of traffic analytics. + NetworkWatcherFlowAnalyticsConfiguration *TrafficAnalyticsConfigurationProperties `json:"networkWatcherFlowAnalyticsConfiguration,omitempty"` +} + +// TrafficSelectorPolicy an traffic selector policy for a virtual network gateway connection. +type TrafficSelectorPolicy struct { + // LocalAddressRanges - A collection of local address spaces in CIDR format. + LocalAddressRanges *[]string `json:"localAddressRanges,omitempty"` + // RemoteAddressRanges - A collection of remote address spaces in CIDR format. + RemoteAddressRanges *[]string `json:"remoteAddressRanges,omitempty"` +} + +// TroubleshootingDetails information gained from troubleshooting of specified resource. +type TroubleshootingDetails struct { + // ID - The id of the get troubleshoot operation. + ID *string `json:"id,omitempty"` + // ReasonType - Reason type of failure. + ReasonType *string `json:"reasonType,omitempty"` + // Summary - A summary of troubleshooting. + Summary *string `json:"summary,omitempty"` + // Detail - Details on troubleshooting results. + Detail *string `json:"detail,omitempty"` + // RecommendedActions - List of recommended actions. + RecommendedActions *[]TroubleshootingRecommendedActions `json:"recommendedActions,omitempty"` +} + +// TroubleshootingParameters parameters that define the resource to troubleshoot. +type TroubleshootingParameters struct { + // TargetResourceID - The target resource to troubleshoot. + TargetResourceID *string `json:"targetResourceId,omitempty"` + // TroubleshootingProperties - Properties of the troubleshooting resource. + *TroubleshootingProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for TroubleshootingParameters. +func (tp TroubleshootingParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tp.TargetResourceID != nil { + objectMap["targetResourceId"] = tp.TargetResourceID + } + if tp.TroubleshootingProperties != nil { + objectMap["properties"] = tp.TroubleshootingProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TroubleshootingParameters struct. +func (tp *TroubleshootingParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "targetResourceId": + if v != nil { + var targetResourceID string + err = json.Unmarshal(*v, &targetResourceID) + if err != nil { + return err + } + tp.TargetResourceID = &targetResourceID + } + case "properties": + if v != nil { + var troubleshootingProperties TroubleshootingProperties + err = json.Unmarshal(*v, &troubleshootingProperties) + if err != nil { + return err + } + tp.TroubleshootingProperties = &troubleshootingProperties + } + } + } + + return nil +} + +// TroubleshootingProperties storage location provided for troubleshoot. +type TroubleshootingProperties struct { + // StorageID - The ID for the storage account to save the troubleshoot result. + StorageID *string `json:"storageId,omitempty"` + // StoragePath - The path to the blob to save the troubleshoot result in. + StoragePath *string `json:"storagePath,omitempty"` +} + +// TroubleshootingRecommendedActions recommended actions based on discovered issues. +type TroubleshootingRecommendedActions struct { + // ActionID - ID of the recommended action. + ActionID *string `json:"actionId,omitempty"` + // ActionText - Description of recommended actions. + ActionText *string `json:"actionText,omitempty"` + // ActionURI - The uri linking to a documentation for the recommended troubleshooting actions. + ActionURI *string `json:"actionUri,omitempty"` + // ActionURIText - The information from the URI for the recommended troubleshooting actions. + ActionURIText *string `json:"actionUriText,omitempty"` +} + +// TroubleshootingResult troubleshooting information gained from specified resource. +type TroubleshootingResult struct { + autorest.Response `json:"-"` + // StartTime - The start time of the troubleshooting. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - The end time of the troubleshooting. + EndTime *date.Time `json:"endTime,omitempty"` + // Code - The result code of the troubleshooting. + Code *string `json:"code,omitempty"` + // Results - Information from troubleshooting. + Results *[]TroubleshootingDetails `json:"results,omitempty"` +} + +// TunnelConnectionHealth virtualNetworkGatewayConnection properties. +type TunnelConnectionHealth struct { + // Tunnel - READ-ONLY; Tunnel name. + Tunnel *string `json:"tunnel,omitempty"` + // ConnectionStatus - READ-ONLY; Virtual Network Gateway connection status. Possible values include: 'VirtualNetworkGatewayConnectionStatusUnknown', 'VirtualNetworkGatewayConnectionStatusConnecting', 'VirtualNetworkGatewayConnectionStatusConnected', 'VirtualNetworkGatewayConnectionStatusNotConnected' + ConnectionStatus VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty"` + // IngressBytesTransferred - READ-ONLY; The Ingress Bytes Transferred in this connection. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` + // EgressBytesTransferred - READ-ONLY; The Egress Bytes Transferred in this connection. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` + // LastConnectionEstablishedUtcTime - READ-ONLY; The time at which connection was established in Utc format. + LastConnectionEstablishedUtcTime *string `json:"lastConnectionEstablishedUtcTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for TunnelConnectionHealth. +func (tch TunnelConnectionHealth) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UnprepareNetworkPoliciesRequest details of UnprepareNetworkPolicies for Subnet. +type UnprepareNetworkPoliciesRequest struct { + // ServiceName - The name of the service for which subnet is being unprepared for. + ServiceName *string `json:"serviceName,omitempty"` +} + +// Usage the network resource usage. +type Usage struct { + // ID - READ-ONLY; Resource identifier. + ID *string `json:"id,omitempty"` + // Unit - An enum describing the unit of measurement. + Unit *string `json:"unit,omitempty"` + // CurrentValue - The current value of the usage. + CurrentValue *int64 `json:"currentValue,omitempty"` + // Limit - The limit of usage. + Limit *int64 `json:"limit,omitempty"` + // Name - The name of the type of usage. + Name *UsageName `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for Usage. +func (u Usage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if u.Unit != nil { + objectMap["unit"] = u.Unit + } + if u.CurrentValue != nil { + objectMap["currentValue"] = u.CurrentValue + } + if u.Limit != nil { + objectMap["limit"] = u.Limit + } + if u.Name != nil { + objectMap["name"] = u.Name + } + return json.Marshal(objectMap) +} + +// UsageName the usage names. +type UsageName struct { + // Value - A string describing the resource name. + Value *string `json:"value,omitempty"` + // LocalizedValue - A localized string describing the resource name. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// UsagesListResult the list usages operation response. +type UsagesListResult struct { + autorest.Response `json:"-"` + // Value - The list network resource usages. + Value *[]Usage `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// UsagesListResultIterator provides access to a complete listing of Usage values. +type UsagesListResultIterator struct { + i int + page UsagesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *UsagesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *UsagesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter UsagesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter UsagesListResultIterator) Response() UsagesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter UsagesListResultIterator) Value() Usage { + if !iter.page.NotDone() { + return Usage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the UsagesListResultIterator type. +func NewUsagesListResultIterator(page UsagesListResultPage) UsagesListResultIterator { + return UsagesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ulr UsagesListResult) IsEmpty() bool { + return ulr.Value == nil || len(*ulr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ulr UsagesListResult) hasNextLink() bool { + return ulr.NextLink != nil && len(*ulr.NextLink) != 0 +} + +// usagesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ulr UsagesListResult) usagesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ulr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ulr.NextLink))) +} + +// UsagesListResultPage contains a page of Usage values. +type UsagesListResultPage struct { + fn func(context.Context, UsagesListResult) (UsagesListResult, error) + ulr UsagesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *UsagesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ulr) + if err != nil { + return err + } + page.ulr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *UsagesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page UsagesListResultPage) NotDone() bool { + return !page.ulr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page UsagesListResultPage) Response() UsagesListResult { + return page.ulr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page UsagesListResultPage) Values() []Usage { + if page.ulr.IsEmpty() { + return nil + } + return *page.ulr.Value +} + +// Creates a new instance of the UsagesListResultPage type. +func NewUsagesListResultPage(cur UsagesListResult, getNextPage func(context.Context, UsagesListResult) (UsagesListResult, error)) UsagesListResultPage { + return UsagesListResultPage{ + fn: getNextPage, + ulr: cur, + } +} + +// VM describes a Virtual Machine. +type VM struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VM. +func (vVar VM) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vVar.ID != nil { + objectMap["id"] = vVar.ID + } + if vVar.Location != nil { + objectMap["location"] = vVar.Location + } + if vVar.Tags != nil { + objectMap["tags"] = vVar.Tags + } + return json.Marshal(objectMap) +} + +// VerificationIPFlowParameters parameters that define the IP flow to be verified. +type VerificationIPFlowParameters struct { + // TargetResourceID - The ID of the target resource to perform next-hop on. + TargetResourceID *string `json:"targetResourceId,omitempty"` + // Direction - The direction of the packet represented as a 5-tuple. Possible values include: 'DirectionInbound', 'DirectionOutbound' + Direction Direction `json:"direction,omitempty"` + // Protocol - Protocol to be verified on. Possible values include: 'IPFlowProtocolTCP', 'IPFlowProtocolUDP' + Protocol IPFlowProtocol `json:"protocol,omitempty"` + // LocalPort - 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. + LocalPort *string `json:"localPort,omitempty"` + // RemotePort - 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. + RemotePort *string `json:"remotePort,omitempty"` + // LocalIPAddress - The local IP address. Acceptable values are valid IPv4 addresses. + LocalIPAddress *string `json:"localIPAddress,omitempty"` + // RemoteIPAddress - The remote IP address. Acceptable values are valid IPv4 addresses. + RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` + // TargetNicResourceID - 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). + TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` +} + +// VerificationIPFlowResult results of IP flow verification on the target resource. +type VerificationIPFlowResult struct { + autorest.Response `json:"-"` + // Access - Indicates whether the traffic is allowed or denied. Possible values include: 'AccessAllow', 'AccessDeny' + Access Access `json:"access,omitempty"` + // RuleName - Name of the rule. If input is not matched against any security rule, it is not displayed. + RuleName *string `json:"ruleName,omitempty"` +} + +// VipSwapCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VipSwapCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VipSwapClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VipSwapCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VipSwapCreateFuture.Result. +func (future *VipSwapCreateFuture) result(client VipSwapClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VipSwapCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VipSwapCreateFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualAppliance networkVirtualAppliance Resource. +type VirtualAppliance struct { + autorest.Response `json:"-"` + // VirtualAppliancePropertiesFormat - Properties of the Network Virtual Appliance. + *VirtualAppliancePropertiesFormat `json:"properties,omitempty"` + // Identity - The service principal that has read access to cloud-init and config blob. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualAppliance. +func (va VirtualAppliance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if va.VirtualAppliancePropertiesFormat != nil { + objectMap["properties"] = va.VirtualAppliancePropertiesFormat + } + if va.Identity != nil { + objectMap["identity"] = va.Identity + } + if va.ID != nil { + objectMap["id"] = va.ID + } + if va.Location != nil { + objectMap["location"] = va.Location + } + if va.Tags != nil { + objectMap["tags"] = va.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualAppliance struct. +func (va *VirtualAppliance) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualAppliancePropertiesFormat VirtualAppliancePropertiesFormat + err = json.Unmarshal(*v, &virtualAppliancePropertiesFormat) + if err != nil { + return err + } + va.VirtualAppliancePropertiesFormat = &virtualAppliancePropertiesFormat + } + case "identity": + if v != nil { + var identity ManagedServiceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + va.Identity = &identity + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + va.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + va.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + va.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + va.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + va.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + va.Tags = tags + } + } + } + + return nil +} + +// VirtualApplianceListResult response for ListNetworkVirtualAppliances API service call. +type VirtualApplianceListResult struct { + autorest.Response `json:"-"` + // Value - List of Network Virtual Appliances. + Value *[]VirtualAppliance `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualApplianceListResultIterator provides access to a complete listing of VirtualAppliance values. +type VirtualApplianceListResultIterator struct { + i int + page VirtualApplianceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualApplianceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualApplianceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualApplianceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualApplianceListResultIterator) Response() VirtualApplianceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualApplianceListResultIterator) Value() VirtualAppliance { + if !iter.page.NotDone() { + return VirtualAppliance{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualApplianceListResultIterator type. +func NewVirtualApplianceListResultIterator(page VirtualApplianceListResultPage) VirtualApplianceListResultIterator { + return VirtualApplianceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (valr VirtualApplianceListResult) IsEmpty() bool { + return valr.Value == nil || len(*valr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (valr VirtualApplianceListResult) hasNextLink() bool { + return valr.NextLink != nil && len(*valr.NextLink) != 0 +} + +// virtualApplianceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (valr VirtualApplianceListResult) virtualApplianceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !valr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(valr.NextLink))) +} + +// VirtualApplianceListResultPage contains a page of VirtualAppliance values. +type VirtualApplianceListResultPage struct { + fn func(context.Context, VirtualApplianceListResult) (VirtualApplianceListResult, error) + valr VirtualApplianceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualApplianceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.valr) + if err != nil { + return err + } + page.valr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualApplianceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualApplianceListResultPage) NotDone() bool { + return !page.valr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualApplianceListResultPage) Response() VirtualApplianceListResult { + return page.valr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualApplianceListResultPage) Values() []VirtualAppliance { + if page.valr.IsEmpty() { + return nil + } + return *page.valr.Value +} + +// Creates a new instance of the VirtualApplianceListResultPage type. +func NewVirtualApplianceListResultPage(cur VirtualApplianceListResult, getNextPage func(context.Context, VirtualApplianceListResult) (VirtualApplianceListResult, error)) VirtualApplianceListResultPage { + return VirtualApplianceListResultPage{ + fn: getNextPage, + valr: cur, + } +} + +// VirtualApplianceNicProperties network Virtual Appliance NIC properties. +type VirtualApplianceNicProperties struct { + // Name - READ-ONLY; NIC name. + Name *string `json:"name,omitempty"` + // PublicIPAddress - READ-ONLY; Public IP address. + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + // PrivateIPAddress - READ-ONLY; Private IP address. + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualApplianceNicProperties. +func (vanp VirtualApplianceNicProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// VirtualAppliancePropertiesFormat network Virtual Appliance definition. +type VirtualAppliancePropertiesFormat struct { + // NvaSku - Network Virtual Appliance SKU. + NvaSku *VirtualApplianceSkuProperties `json:"nvaSku,omitempty"` + // AddressPrefix - READ-ONLY; Address Prefix. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // BootStrapConfigurationBlobs - BootStrapConfigurationBlobs storage URLs. + BootStrapConfigurationBlobs *[]string `json:"bootStrapConfigurationBlobs,omitempty"` + // VirtualHub - The Virtual Hub where Network Virtual Appliance is being deployed. + VirtualHub *SubResource `json:"virtualHub,omitempty"` + // CloudInitConfigurationBlobs - CloudInitConfigurationBlob storage URLs. + CloudInitConfigurationBlobs *[]string `json:"cloudInitConfigurationBlobs,omitempty"` + // CloudInitConfiguration - CloudInitConfiguration string in plain text. + CloudInitConfiguration *string `json:"cloudInitConfiguration,omitempty"` + // VirtualApplianceAsn - VirtualAppliance ASN. Microsoft private, public and IANA reserved ASN are not supported. + VirtualApplianceAsn *int64 `json:"virtualApplianceAsn,omitempty"` + // SSHPublicKey - Public key for SSH login. + SSHPublicKey *string `json:"sshPublicKey,omitempty"` + // VirtualApplianceNics - READ-ONLY; List of Virtual Appliance Network Interfaces. + VirtualApplianceNics *[]VirtualApplianceNicProperties `json:"virtualApplianceNics,omitempty"` + // VirtualApplianceSites - READ-ONLY; List of references to VirtualApplianceSite. + VirtualApplianceSites *[]SubResource `json:"virtualApplianceSites,omitempty"` + // InboundSecurityRules - READ-ONLY; List of references to InboundSecurityRules. + InboundSecurityRules *[]SubResource `json:"inboundSecurityRules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // DeploymentType - READ-ONLY; The deployment type. PartnerManaged for the SaaS NVA + DeploymentType *string `json:"deploymentType,omitempty"` + // Delegation - The delegation for the Virtual Appliance + Delegation *DelegationProperties `json:"delegation,omitempty"` + // PartnerManagedResource - The delegation for the Virtual Appliance + PartnerManagedResource *PartnerManagedResourceProperties `json:"partnerManagedResource,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualAppliancePropertiesFormat. +func (vapf VirtualAppliancePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vapf.NvaSku != nil { + objectMap["nvaSku"] = vapf.NvaSku + } + if vapf.BootStrapConfigurationBlobs != nil { + objectMap["bootStrapConfigurationBlobs"] = vapf.BootStrapConfigurationBlobs + } + if vapf.VirtualHub != nil { + objectMap["virtualHub"] = vapf.VirtualHub + } + if vapf.CloudInitConfigurationBlobs != nil { + objectMap["cloudInitConfigurationBlobs"] = vapf.CloudInitConfigurationBlobs + } + if vapf.CloudInitConfiguration != nil { + objectMap["cloudInitConfiguration"] = vapf.CloudInitConfiguration + } + if vapf.VirtualApplianceAsn != nil { + objectMap["virtualApplianceAsn"] = vapf.VirtualApplianceAsn + } + if vapf.SSHPublicKey != nil { + objectMap["sshPublicKey"] = vapf.SSHPublicKey + } + if vapf.Delegation != nil { + objectMap["delegation"] = vapf.Delegation + } + if vapf.PartnerManagedResource != nil { + objectMap["partnerManagedResource"] = vapf.PartnerManagedResource + } + return json.Marshal(objectMap) +} + +// VirtualApplianceSite virtual Appliance Site resource. +type VirtualApplianceSite struct { + autorest.Response `json:"-"` + // VirtualApplianceSiteProperties - The properties of the Virtual Appliance Sites. + *VirtualApplianceSiteProperties `json:"properties,omitempty"` + // Name - Name of the virtual appliance site. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Site type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualApplianceSite. +func (vas VirtualApplianceSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vas.VirtualApplianceSiteProperties != nil { + objectMap["properties"] = vas.VirtualApplianceSiteProperties + } + if vas.Name != nil { + objectMap["name"] = vas.Name + } + if vas.ID != nil { + objectMap["id"] = vas.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualApplianceSite struct. +func (vas *VirtualApplianceSite) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualApplianceSiteProperties VirtualApplianceSiteProperties + err = json.Unmarshal(*v, &virtualApplianceSiteProperties) + if err != nil { + return err + } + vas.VirtualApplianceSiteProperties = &virtualApplianceSiteProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vas.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vas.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vas.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vas.ID = &ID + } + } + } + + return nil +} + +// VirtualApplianceSiteListResult response for ListNetworkVirtualApplianceSites API service call. +type VirtualApplianceSiteListResult struct { + autorest.Response `json:"-"` + // Value - List of Network Virtual Appliance sites. + Value *[]VirtualApplianceSite `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualApplianceSiteListResultIterator provides access to a complete listing of VirtualApplianceSite +// values. +type VirtualApplianceSiteListResultIterator struct { + i int + page VirtualApplianceSiteListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualApplianceSiteListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSiteListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualApplianceSiteListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualApplianceSiteListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualApplianceSiteListResultIterator) Response() VirtualApplianceSiteListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualApplianceSiteListResultIterator) Value() VirtualApplianceSite { + if !iter.page.NotDone() { + return VirtualApplianceSite{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualApplianceSiteListResultIterator type. +func NewVirtualApplianceSiteListResultIterator(page VirtualApplianceSiteListResultPage) VirtualApplianceSiteListResultIterator { + return VirtualApplianceSiteListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vaslr VirtualApplianceSiteListResult) IsEmpty() bool { + return vaslr.Value == nil || len(*vaslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vaslr VirtualApplianceSiteListResult) hasNextLink() bool { + return vaslr.NextLink != nil && len(*vaslr.NextLink) != 0 +} + +// virtualApplianceSiteListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vaslr VirtualApplianceSiteListResult) virtualApplianceSiteListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vaslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vaslr.NextLink))) +} + +// VirtualApplianceSiteListResultPage contains a page of VirtualApplianceSite values. +type VirtualApplianceSiteListResultPage struct { + fn func(context.Context, VirtualApplianceSiteListResult) (VirtualApplianceSiteListResult, error) + vaslr VirtualApplianceSiteListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualApplianceSiteListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSiteListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vaslr) + if err != nil { + return err + } + page.vaslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualApplianceSiteListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualApplianceSiteListResultPage) NotDone() bool { + return !page.vaslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualApplianceSiteListResultPage) Response() VirtualApplianceSiteListResult { + return page.vaslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualApplianceSiteListResultPage) Values() []VirtualApplianceSite { + if page.vaslr.IsEmpty() { + return nil + } + return *page.vaslr.Value +} + +// Creates a new instance of the VirtualApplianceSiteListResultPage type. +func NewVirtualApplianceSiteListResultPage(cur VirtualApplianceSiteListResult, getNextPage func(context.Context, VirtualApplianceSiteListResult) (VirtualApplianceSiteListResult, error)) VirtualApplianceSiteListResultPage { + return VirtualApplianceSiteListResultPage{ + fn: getNextPage, + vaslr: cur, + } +} + +// VirtualApplianceSiteProperties properties of the rule group. +type VirtualApplianceSiteProperties struct { + // AddressPrefix - Address Prefix. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // O365Policy - Office 365 Policy. + O365Policy *Office365PolicyProperties `json:"o365Policy,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualApplianceSiteProperties. +func (vasp VirtualApplianceSiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vasp.AddressPrefix != nil { + objectMap["addressPrefix"] = vasp.AddressPrefix + } + if vasp.O365Policy != nil { + objectMap["o365Policy"] = vasp.O365Policy + } + return json.Marshal(objectMap) +} + +// VirtualApplianceSitesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualApplianceSitesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualApplianceSitesClient) (VirtualApplianceSite, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualApplianceSitesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualApplianceSitesCreateOrUpdateFuture.Result. +func (future *VirtualApplianceSitesCreateOrUpdateFuture) result(client VirtualApplianceSitesClient) (vas VirtualApplianceSite, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vas.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualApplianceSitesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vas.Response.Response, err = future.GetResult(sender); err == nil && vas.Response.Response.StatusCode != http.StatusNoContent { + vas, err = client.CreateOrUpdateResponder(vas.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesCreateOrUpdateFuture", "Result", vas.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualApplianceSitesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualApplianceSitesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualApplianceSitesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualApplianceSitesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualApplianceSitesDeleteFuture.Result. +func (future *VirtualApplianceSitesDeleteFuture) result(client VirtualApplianceSitesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualApplianceSitesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualApplianceSku definition of the NetworkVirtualApplianceSkus resource. +type VirtualApplianceSku struct { + autorest.Response `json:"-"` + // VirtualApplianceSkuPropertiesFormat - NetworkVirtualApplianceSku properties. + *VirtualApplianceSkuPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualApplianceSku. +func (vas VirtualApplianceSku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vas.VirtualApplianceSkuPropertiesFormat != nil { + objectMap["properties"] = vas.VirtualApplianceSkuPropertiesFormat + } + if vas.ID != nil { + objectMap["id"] = vas.ID + } + if vas.Location != nil { + objectMap["location"] = vas.Location + } + if vas.Tags != nil { + objectMap["tags"] = vas.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualApplianceSku struct. +func (vas *VirtualApplianceSku) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualApplianceSkuPropertiesFormat VirtualApplianceSkuPropertiesFormat + err = json.Unmarshal(*v, &virtualApplianceSkuPropertiesFormat) + if err != nil { + return err + } + vas.VirtualApplianceSkuPropertiesFormat = &virtualApplianceSkuPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vas.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vas.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vas.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vas.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vas.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vas.Tags = tags + } + } + } + + return nil +} + +// VirtualApplianceSkuInstances list of available Sku and instances. +type VirtualApplianceSkuInstances struct { + // ScaleUnit - READ-ONLY; Scale Unit. + ScaleUnit *string `json:"scaleUnit,omitempty"` + // InstanceCount - READ-ONLY; Instance Count. + InstanceCount *int32 `json:"instanceCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualApplianceSkuInstances. +func (vasi VirtualApplianceSkuInstances) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// VirtualApplianceSkuListResult response for ListNetworkVirtualApplianceSkus API service call. +type VirtualApplianceSkuListResult struct { + autorest.Response `json:"-"` + // Value - List of Network Virtual Appliance Skus that are available. + Value *[]VirtualApplianceSku `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualApplianceSkuListResultIterator provides access to a complete listing of VirtualApplianceSku +// values. +type VirtualApplianceSkuListResultIterator struct { + i int + page VirtualApplianceSkuListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualApplianceSkuListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSkuListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualApplianceSkuListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualApplianceSkuListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualApplianceSkuListResultIterator) Response() VirtualApplianceSkuListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualApplianceSkuListResultIterator) Value() VirtualApplianceSku { + if !iter.page.NotDone() { + return VirtualApplianceSku{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualApplianceSkuListResultIterator type. +func NewVirtualApplianceSkuListResultIterator(page VirtualApplianceSkuListResultPage) VirtualApplianceSkuListResultIterator { + return VirtualApplianceSkuListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vaslr VirtualApplianceSkuListResult) IsEmpty() bool { + return vaslr.Value == nil || len(*vaslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vaslr VirtualApplianceSkuListResult) hasNextLink() bool { + return vaslr.NextLink != nil && len(*vaslr.NextLink) != 0 +} + +// virtualApplianceSkuListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vaslr VirtualApplianceSkuListResult) virtualApplianceSkuListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vaslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vaslr.NextLink))) +} + +// VirtualApplianceSkuListResultPage contains a page of VirtualApplianceSku values. +type VirtualApplianceSkuListResultPage struct { + fn func(context.Context, VirtualApplianceSkuListResult) (VirtualApplianceSkuListResult, error) + vaslr VirtualApplianceSkuListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualApplianceSkuListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSkuListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vaslr) + if err != nil { + return err + } + page.vaslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualApplianceSkuListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualApplianceSkuListResultPage) NotDone() bool { + return !page.vaslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualApplianceSkuListResultPage) Response() VirtualApplianceSkuListResult { + return page.vaslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualApplianceSkuListResultPage) Values() []VirtualApplianceSku { + if page.vaslr.IsEmpty() { + return nil + } + return *page.vaslr.Value +} + +// Creates a new instance of the VirtualApplianceSkuListResultPage type. +func NewVirtualApplianceSkuListResultPage(cur VirtualApplianceSkuListResult, getNextPage func(context.Context, VirtualApplianceSkuListResult) (VirtualApplianceSkuListResult, error)) VirtualApplianceSkuListResultPage { + return VirtualApplianceSkuListResultPage{ + fn: getNextPage, + vaslr: cur, + } +} + +// VirtualApplianceSkuProperties network Virtual Appliance Sku Properties. +type VirtualApplianceSkuProperties struct { + // Vendor - Virtual Appliance Vendor. + Vendor *string `json:"vendor,omitempty"` + // BundledScaleUnit - Virtual Appliance Scale Unit. + BundledScaleUnit *string `json:"bundledScaleUnit,omitempty"` + // MarketPlaceVersion - Virtual Appliance Version. + MarketPlaceVersion *string `json:"marketPlaceVersion,omitempty"` +} + +// VirtualApplianceSkuPropertiesFormat properties specific to NetworkVirtualApplianceSkus. +type VirtualApplianceSkuPropertiesFormat struct { + // Vendor - READ-ONLY; Network Virtual Appliance Sku vendor. + Vendor *string `json:"vendor,omitempty"` + // AvailableVersions - READ-ONLY; Available Network Virtual Appliance versions. + AvailableVersions *[]string `json:"availableVersions,omitempty"` + // AvailableScaleUnits - The list of scale units available. + AvailableScaleUnits *[]VirtualApplianceSkuInstances `json:"availableScaleUnits,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualApplianceSkuPropertiesFormat. +func (vaspf VirtualApplianceSkuPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vaspf.AvailableScaleUnits != nil { + objectMap["availableScaleUnits"] = vaspf.AvailableScaleUnits + } + return json.Marshal(objectMap) +} + +// VirtualAppliancesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualAppliancesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualAppliancesClient) (VirtualAppliance, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualAppliancesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualAppliancesCreateOrUpdateFuture.Result. +func (future *VirtualAppliancesCreateOrUpdateFuture) result(client VirtualAppliancesClient) (va VirtualAppliance, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + va.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualAppliancesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if va.Response.Response, err = future.GetResult(sender); err == nil && va.Response.Response.StatusCode != http.StatusNoContent { + va, err = client.CreateOrUpdateResponder(va.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesCreateOrUpdateFuture", "Result", va.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualAppliancesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualAppliancesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualAppliancesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualAppliancesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualAppliancesDeleteFuture.Result. +func (future *VirtualAppliancesDeleteFuture) result(client VirtualAppliancesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualAppliancesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualHub virtualHub Resource. +type VirtualHub struct { + autorest.Response `json:"-"` + // VirtualHubProperties - Properties of the virtual hub. + *VirtualHubProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Kind - READ-ONLY; Kind of service virtual hub. This is metadata used for the Azure portal experience for Route Server. + Kind *string `json:"kind,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualHub. +func (vh VirtualHub) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vh.VirtualHubProperties != nil { + objectMap["properties"] = vh.VirtualHubProperties + } + if vh.ID != nil { + objectMap["id"] = vh.ID + } + if vh.Location != nil { + objectMap["location"] = vh.Location + } + if vh.Tags != nil { + objectMap["tags"] = vh.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualHub struct. +func (vh *VirtualHub) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualHubProperties VirtualHubProperties + err = json.Unmarshal(*v, &virtualHubProperties) + if err != nil { + return err + } + vh.VirtualHubProperties = &virtualHubProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vh.Etag = &etag + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + vh.Kind = &kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vh.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vh.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vh.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vh.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vh.Tags = tags + } + } + } + + return nil +} + +// VirtualHubBgpConnectionCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualHubBgpConnectionCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubBgpConnectionClient) (BgpConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubBgpConnectionCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubBgpConnectionCreateOrUpdateFuture.Result. +func (future *VirtualHubBgpConnectionCreateOrUpdateFuture) result(client VirtualHubBgpConnectionClient) (bc BgpConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubBgpConnectionCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bc.Response.Response, err = future.GetResult(sender); err == nil && bc.Response.Response.StatusCode != http.StatusNoContent { + bc, err = client.CreateOrUpdateResponder(bc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionCreateOrUpdateFuture", "Result", bc.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualHubBgpConnectionDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualHubBgpConnectionDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubBgpConnectionClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubBgpConnectionDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubBgpConnectionDeleteFuture.Result. +func (future *VirtualHubBgpConnectionDeleteFuture) result(client VirtualHubBgpConnectionClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubBgpConnectionDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualHubBgpConnectionsListAdvertisedRoutesFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualHubBgpConnectionsListAdvertisedRoutesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubBgpConnectionsClient) (PeerRouteList, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubBgpConnectionsListAdvertisedRoutesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubBgpConnectionsListAdvertisedRoutesFuture.Result. +func (future *VirtualHubBgpConnectionsListAdvertisedRoutesFuture) result(client VirtualHubBgpConnectionsClient) (prl PeerRouteList, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsListAdvertisedRoutesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + prl.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubBgpConnectionsListAdvertisedRoutesFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if prl.Response.Response, err = future.GetResult(sender); err == nil && prl.Response.Response.StatusCode != http.StatusNoContent { + prl, err = client.ListAdvertisedRoutesResponder(prl.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsListAdvertisedRoutesFuture", "Result", prl.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualHubBgpConnectionsListLearnedRoutesFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualHubBgpConnectionsListLearnedRoutesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubBgpConnectionsClient) (PeerRouteList, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubBgpConnectionsListLearnedRoutesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubBgpConnectionsListLearnedRoutesFuture.Result. +func (future *VirtualHubBgpConnectionsListLearnedRoutesFuture) result(client VirtualHubBgpConnectionsClient) (prl PeerRouteList, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsListLearnedRoutesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + prl.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubBgpConnectionsListLearnedRoutesFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if prl.Response.Response, err = future.GetResult(sender); err == nil && prl.Response.Response.StatusCode != http.StatusNoContent { + prl, err = client.ListLearnedRoutesResponder(prl.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsListLearnedRoutesFuture", "Result", prl.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualHubEffectiveRoute the effective route configured on the virtual hub or specified resource. +type VirtualHubEffectiveRoute struct { + // AddressPrefixes - The list of address prefixes. + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` + // NextHops - The list of next hops. + NextHops *[]string `json:"nextHops,omitempty"` + // NextHopType - The type of the next hop. + NextHopType *string `json:"nextHopType,omitempty"` + // AsPath - The ASPath of this route. + AsPath *string `json:"asPath,omitempty"` + // RouteOrigin - The origin of this route. + RouteOrigin *string `json:"routeOrigin,omitempty"` +} + +// VirtualHubEffectiveRouteList effectiveRoutes List. +type VirtualHubEffectiveRouteList struct { + // Value - The list of effective routes configured on the virtual hub or the specified resource. + Value *[]VirtualHubEffectiveRoute `json:"value,omitempty"` +} + +// VirtualHubID virtual Hub identifier. +type VirtualHubID struct { + // ID - 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. + ID *string `json:"id,omitempty"` +} + +// VirtualHubIPConfigurationCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualHubIPConfigurationCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubIPConfigurationClient) (HubIPConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubIPConfigurationCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubIPConfigurationCreateOrUpdateFuture.Result. +func (future *VirtualHubIPConfigurationCreateOrUpdateFuture) result(client VirtualHubIPConfigurationClient) (hic HubIPConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + hic.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubIPConfigurationCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if hic.Response.Response, err = future.GetResult(sender); err == nil && hic.Response.Response.StatusCode != http.StatusNoContent { + hic, err = client.CreateOrUpdateResponder(hic.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationCreateOrUpdateFuture", "Result", hic.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualHubIPConfigurationDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualHubIPConfigurationDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubIPConfigurationClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubIPConfigurationDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubIPConfigurationDeleteFuture.Result. +func (future *VirtualHubIPConfigurationDeleteFuture) result(client VirtualHubIPConfigurationClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubIPConfigurationDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualHubProperties parameters for VirtualHub. +type VirtualHubProperties struct { + // VirtualWan - The VirtualWAN to which the VirtualHub belongs. + VirtualWan *SubResource `json:"virtualWan,omitempty"` + // VpnGateway - The VpnGateway associated with this VirtualHub. + VpnGateway *SubResource `json:"vpnGateway,omitempty"` + // P2SVpnGateway - The P2SVpnGateway associated with this VirtualHub. + P2SVpnGateway *SubResource `json:"p2SVpnGateway,omitempty"` + // ExpressRouteGateway - The expressRouteGateway associated with this VirtualHub. + ExpressRouteGateway *SubResource `json:"expressRouteGateway,omitempty"` + // AzureFirewall - The azureFirewall associated with this VirtualHub. + AzureFirewall *SubResource `json:"azureFirewall,omitempty"` + // SecurityPartnerProvider - The securityPartnerProvider associated with this VirtualHub. + SecurityPartnerProvider *SubResource `json:"securityPartnerProvider,omitempty"` + // AddressPrefix - Address-prefix for this VirtualHub. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // RouteTable - The routeTable associated with this virtual hub. + RouteTable *VirtualHubRouteTable `json:"routeTable,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual hub resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // SecurityProviderName - The Security Provider name. + SecurityProviderName *string `json:"securityProviderName,omitempty"` + // VirtualHubRouteTableV2s - List of all virtual hub route table v2s associated with this VirtualHub. + VirtualHubRouteTableV2s *[]VirtualHubRouteTableV2 `json:"virtualHubRouteTableV2s,omitempty"` + // Sku - The sku of this VirtualHub. + Sku *string `json:"sku,omitempty"` + // RoutingState - The routing state. Possible values include: 'RoutingStateNone', 'RoutingStateProvisioned', 'RoutingStateProvisioning', 'RoutingStateFailed' + RoutingState RoutingState `json:"routingState,omitempty"` + // BgpConnections - READ-ONLY; List of references to Bgp Connections. + BgpConnections *[]SubResource `json:"bgpConnections,omitempty"` + // IPConfigurations - READ-ONLY; List of references to IpConfigurations. + IPConfigurations *[]SubResource `json:"ipConfigurations,omitempty"` + // RouteMaps - READ-ONLY; List of references to RouteMaps. + RouteMaps *[]SubResource `json:"routeMaps,omitempty"` + // VirtualRouterAsn - VirtualRouter ASN. + VirtualRouterAsn *int64 `json:"virtualRouterAsn,omitempty"` + // VirtualRouterIps - VirtualRouter IPs. + VirtualRouterIps *[]string `json:"virtualRouterIps,omitempty"` + // AllowBranchToBranchTraffic - Flag to control transit for VirtualRouter hub. + AllowBranchToBranchTraffic *bool `json:"allowBranchToBranchTraffic,omitempty"` + // PreferredRoutingGateway - The preferred gateway to route on-prem traffic. Possible values include: 'PreferredRoutingGatewayExpressRoute', 'PreferredRoutingGatewayVpnGateway', 'PreferredRoutingGatewayNone' + PreferredRoutingGateway PreferredRoutingGateway `json:"preferredRoutingGateway,omitempty"` + // HubRoutingPreference - The hubRoutingPreference of this VirtualHub. Possible values include: 'HubRoutingPreferenceExpressRoute', 'HubRoutingPreferenceVpnGateway', 'HubRoutingPreferenceASPath' + HubRoutingPreference HubRoutingPreference `json:"hubRoutingPreference,omitempty"` + // VirtualRouterAutoScaleConfiguration - The VirtualHub Router autoscale configuration. + VirtualRouterAutoScaleConfiguration *VirtualRouterAutoScaleConfiguration `json:"virtualRouterAutoScaleConfiguration,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualHubProperties. +func (vhp VirtualHubProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vhp.VirtualWan != nil { + objectMap["virtualWan"] = vhp.VirtualWan + } + if vhp.VpnGateway != nil { + objectMap["vpnGateway"] = vhp.VpnGateway + } + if vhp.P2SVpnGateway != nil { + objectMap["p2SVpnGateway"] = vhp.P2SVpnGateway + } + if vhp.ExpressRouteGateway != nil { + objectMap["expressRouteGateway"] = vhp.ExpressRouteGateway + } + if vhp.AzureFirewall != nil { + objectMap["azureFirewall"] = vhp.AzureFirewall + } + if vhp.SecurityPartnerProvider != nil { + objectMap["securityPartnerProvider"] = vhp.SecurityPartnerProvider + } + if vhp.AddressPrefix != nil { + objectMap["addressPrefix"] = vhp.AddressPrefix + } + if vhp.RouteTable != nil { + objectMap["routeTable"] = vhp.RouteTable + } + if vhp.SecurityProviderName != nil { + objectMap["securityProviderName"] = vhp.SecurityProviderName + } + if vhp.VirtualHubRouteTableV2s != nil { + objectMap["virtualHubRouteTableV2s"] = vhp.VirtualHubRouteTableV2s + } + if vhp.Sku != nil { + objectMap["sku"] = vhp.Sku + } + if vhp.RoutingState != "" { + objectMap["routingState"] = vhp.RoutingState + } + if vhp.VirtualRouterAsn != nil { + objectMap["virtualRouterAsn"] = vhp.VirtualRouterAsn + } + if vhp.VirtualRouterIps != nil { + objectMap["virtualRouterIps"] = vhp.VirtualRouterIps + } + if vhp.AllowBranchToBranchTraffic != nil { + objectMap["allowBranchToBranchTraffic"] = vhp.AllowBranchToBranchTraffic + } + if vhp.PreferredRoutingGateway != "" { + objectMap["preferredRoutingGateway"] = vhp.PreferredRoutingGateway + } + if vhp.HubRoutingPreference != "" { + objectMap["hubRoutingPreference"] = vhp.HubRoutingPreference + } + if vhp.VirtualRouterAutoScaleConfiguration != nil { + objectMap["virtualRouterAutoScaleConfiguration"] = vhp.VirtualRouterAutoScaleConfiguration + } + return json.Marshal(objectMap) +} + +// VirtualHubRoute virtualHub route. +type VirtualHubRoute struct { + // AddressPrefixes - List of all addressPrefixes. + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` + // NextHopIPAddress - NextHop ip address. + NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` +} + +// VirtualHubRouteTable virtualHub route table. +type VirtualHubRouteTable struct { + // Routes - List of all routes. + Routes *[]VirtualHubRoute `json:"routes,omitempty"` +} + +// VirtualHubRouteTableV2 virtualHubRouteTableV2 Resource. +type VirtualHubRouteTableV2 struct { + autorest.Response `json:"-"` + // VirtualHubRouteTableV2Properties - Properties of the virtual hub route table v2. + *VirtualHubRouteTableV2Properties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualHubRouteTableV2. +func (vhrtv VirtualHubRouteTableV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vhrtv.VirtualHubRouteTableV2Properties != nil { + objectMap["properties"] = vhrtv.VirtualHubRouteTableV2Properties + } + if vhrtv.Name != nil { + objectMap["name"] = vhrtv.Name + } + if vhrtv.ID != nil { + objectMap["id"] = vhrtv.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualHubRouteTableV2 struct. +func (vhrtv *VirtualHubRouteTableV2) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualHubRouteTableV2Properties VirtualHubRouteTableV2Properties + err = json.Unmarshal(*v, &virtualHubRouteTableV2Properties) + if err != nil { + return err + } + vhrtv.VirtualHubRouteTableV2Properties = &virtualHubRouteTableV2Properties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vhrtv.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vhrtv.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vhrtv.ID = &ID + } + } + } + + return nil +} + +// VirtualHubRouteTableV2Properties parameters for VirtualHubRouteTableV2. +type VirtualHubRouteTableV2Properties struct { + // Routes - List of all routes. + Routes *[]VirtualHubRouteV2 `json:"routes,omitempty"` + // AttachedConnections - List of all connections attached to this route table v2. + AttachedConnections *[]string `json:"attachedConnections,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual hub route table v2 resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualHubRouteTableV2Properties. +func (vhrtvp VirtualHubRouteTableV2Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vhrtvp.Routes != nil { + objectMap["routes"] = vhrtvp.Routes + } + if vhrtvp.AttachedConnections != nil { + objectMap["attachedConnections"] = vhrtvp.AttachedConnections + } + return json.Marshal(objectMap) +} + +// VirtualHubRouteTableV2sCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualHubRouteTableV2sCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubRouteTableV2sClient) (VirtualHubRouteTableV2, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubRouteTableV2sCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubRouteTableV2sCreateOrUpdateFuture.Result. +func (future *VirtualHubRouteTableV2sCreateOrUpdateFuture) result(client VirtualHubRouteTableV2sClient) (vhrtv VirtualHubRouteTableV2, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vhrtv.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubRouteTableV2sCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vhrtv.Response.Response, err = future.GetResult(sender); err == nil && vhrtv.Response.Response.StatusCode != http.StatusNoContent { + vhrtv, err = client.CreateOrUpdateResponder(vhrtv.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sCreateOrUpdateFuture", "Result", vhrtv.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualHubRouteTableV2sDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualHubRouteTableV2sDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubRouteTableV2sClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubRouteTableV2sDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubRouteTableV2sDeleteFuture.Result. +func (future *VirtualHubRouteTableV2sDeleteFuture) result(client VirtualHubRouteTableV2sClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubRouteTableV2sDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualHubRouteV2 virtualHubRouteTableV2 route. +type VirtualHubRouteV2 struct { + // DestinationType - The type of destinations. + DestinationType *string `json:"destinationType,omitempty"` + // Destinations - List of all destinations. + Destinations *[]string `json:"destinations,omitempty"` + // NextHopType - The type of next hops. + NextHopType *string `json:"nextHopType,omitempty"` + // NextHops - NextHops ip address. + NextHops *[]string `json:"nextHops,omitempty"` +} + +// VirtualHubsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualHubsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubsClient) (VirtualHub, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubsCreateOrUpdateFuture.Result. +func (future *VirtualHubsCreateOrUpdateFuture) result(client VirtualHubsClient) (vh VirtualHub, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vh.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vh.Response.Response, err = future.GetResult(sender); err == nil && vh.Response.Response.StatusCode != http.StatusNoContent { + vh, err = client.CreateOrUpdateResponder(vh.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsCreateOrUpdateFuture", "Result", vh.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualHubsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualHubsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubsDeleteFuture.Result. +func (future *VirtualHubsDeleteFuture) result(client VirtualHubsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualHubsGetEffectiveVirtualHubRoutesFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualHubsGetEffectiveVirtualHubRoutesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubsGetEffectiveVirtualHubRoutesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubsGetEffectiveVirtualHubRoutesFuture.Result. +func (future *VirtualHubsGetEffectiveVirtualHubRoutesFuture) result(client VirtualHubsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsGetEffectiveVirtualHubRoutesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubsGetEffectiveVirtualHubRoutesFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualHubsGetInboundRoutesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualHubsGetInboundRoutesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubsGetInboundRoutesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubsGetInboundRoutesFuture.Result. +func (future *VirtualHubsGetInboundRoutesFuture) result(client VirtualHubsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsGetInboundRoutesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubsGetInboundRoutesFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualHubsGetOutboundRoutesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualHubsGetOutboundRoutesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubsGetOutboundRoutesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubsGetOutboundRoutesFuture.Result. +func (future *VirtualHubsGetOutboundRoutesFuture) result(client VirtualHubsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsGetOutboundRoutesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubsGetOutboundRoutesFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetwork virtual Network resource. +type VirtualNetwork struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the virtual network. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // VirtualNetworkPropertiesFormat - Properties of the virtual network. + *VirtualNetworkPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualNetwork. +func (vn VirtualNetwork) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vn.ExtendedLocation != nil { + objectMap["extendedLocation"] = vn.ExtendedLocation + } + if vn.VirtualNetworkPropertiesFormat != nil { + objectMap["properties"] = vn.VirtualNetworkPropertiesFormat + } + if vn.ID != nil { + objectMap["id"] = vn.ID + } + if vn.Location != nil { + objectMap["location"] = vn.Location + } + if vn.Tags != nil { + objectMap["tags"] = vn.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetwork struct. +func (vn *VirtualNetwork) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + vn.ExtendedLocation = &extendedLocation + } + case "properties": + if v != nil { + var virtualNetworkPropertiesFormat VirtualNetworkPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkPropertiesFormat) + if err != nil { + return err + } + vn.VirtualNetworkPropertiesFormat = &virtualNetworkPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vn.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vn.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vn.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vn.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vn.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vn.Tags = tags + } + } + } + + return nil +} + +// VirtualNetworkBgpCommunities bgp Communities sent over ExpressRoute with each route corresponding to a +// prefix in this VNET. +type VirtualNetworkBgpCommunities struct { + // VirtualNetworkCommunity - The BGP community associated with the virtual network. + VirtualNetworkCommunity *string `json:"virtualNetworkCommunity,omitempty"` + // RegionalCommunity - READ-ONLY; The BGP community associated with the region of the virtual network. + RegionalCommunity *string `json:"regionalCommunity,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkBgpCommunities. +func (vnbc VirtualNetworkBgpCommunities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnbc.VirtualNetworkCommunity != nil { + objectMap["virtualNetworkCommunity"] = vnbc.VirtualNetworkCommunity + } + return json.Marshal(objectMap) +} + +// VirtualNetworkConnectionGatewayReference a reference to VirtualNetworkGateway or LocalNetworkGateway +// resource. +type VirtualNetworkConnectionGatewayReference struct { + // ID - The ID of VirtualNetworkGateway or LocalNetworkGateway resource. + ID *string `json:"id,omitempty"` +} + +// VirtualNetworkDdosProtectionStatusResult response for GetVirtualNetworkDdosProtectionStatusOperation. +type VirtualNetworkDdosProtectionStatusResult struct { + autorest.Response `json:"-"` + // Value - The Ddos Protection Status Result for each public ip under a virtual network. + Value *[]PublicIPDdosProtectionStatusResult `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualNetworkDdosProtectionStatusResultIterator provides access to a complete listing of +// PublicIPDdosProtectionStatusResult values. +type VirtualNetworkDdosProtectionStatusResultIterator struct { + i int + page VirtualNetworkDdosProtectionStatusResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkDdosProtectionStatusResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkDdosProtectionStatusResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkDdosProtectionStatusResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkDdosProtectionStatusResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkDdosProtectionStatusResultIterator) Response() VirtualNetworkDdosProtectionStatusResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkDdosProtectionStatusResultIterator) Value() PublicIPDdosProtectionStatusResult { + if !iter.page.NotDone() { + return PublicIPDdosProtectionStatusResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkDdosProtectionStatusResultIterator type. +func NewVirtualNetworkDdosProtectionStatusResultIterator(page VirtualNetworkDdosProtectionStatusResultPage) VirtualNetworkDdosProtectionStatusResultIterator { + return VirtualNetworkDdosProtectionStatusResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vndpsr VirtualNetworkDdosProtectionStatusResult) IsEmpty() bool { + return vndpsr.Value == nil || len(*vndpsr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vndpsr VirtualNetworkDdosProtectionStatusResult) hasNextLink() bool { + return vndpsr.NextLink != nil && len(*vndpsr.NextLink) != 0 +} + +// virtualNetworkDdosProtectionStatusResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vndpsr VirtualNetworkDdosProtectionStatusResult) virtualNetworkDdosProtectionStatusResultPreparer(ctx context.Context) (*http.Request, error) { + if !vndpsr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vndpsr.NextLink))) +} + +// VirtualNetworkDdosProtectionStatusResultPage contains a page of PublicIPDdosProtectionStatusResult +// values. +type VirtualNetworkDdosProtectionStatusResultPage struct { + fn func(context.Context, VirtualNetworkDdosProtectionStatusResult) (VirtualNetworkDdosProtectionStatusResult, error) + vndpsr VirtualNetworkDdosProtectionStatusResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkDdosProtectionStatusResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkDdosProtectionStatusResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vndpsr) + if err != nil { + return err + } + page.vndpsr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkDdosProtectionStatusResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkDdosProtectionStatusResultPage) NotDone() bool { + return !page.vndpsr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkDdosProtectionStatusResultPage) Response() VirtualNetworkDdosProtectionStatusResult { + return page.vndpsr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkDdosProtectionStatusResultPage) Values() []PublicIPDdosProtectionStatusResult { + if page.vndpsr.IsEmpty() { + return nil + } + return *page.vndpsr.Value +} + +// Creates a new instance of the VirtualNetworkDdosProtectionStatusResultPage type. +func NewVirtualNetworkDdosProtectionStatusResultPage(cur VirtualNetworkDdosProtectionStatusResult, getNextPage func(context.Context, VirtualNetworkDdosProtectionStatusResult) (VirtualNetworkDdosProtectionStatusResult, error)) VirtualNetworkDdosProtectionStatusResultPage { + return VirtualNetworkDdosProtectionStatusResultPage{ + fn: getNextPage, + vndpsr: cur, + } +} + +// VirtualNetworkEncryption indicates if encryption is enabled on virtual network and if VM without +// encryption is allowed in encrypted VNet. +type VirtualNetworkEncryption struct { + // Enabled - Indicates if encryption is enabled on the virtual network. + Enabled *bool `json:"enabled,omitempty"` + // Enforcement - If the encrypted VNet allows VM that does not support encryption. Possible values include: 'VirtualNetworkEncryptionEnforcementDropUnencrypted', 'VirtualNetworkEncryptionEnforcementAllowUnencrypted' + Enforcement VirtualNetworkEncryptionEnforcement `json:"enforcement,omitempty"` +} + +// VirtualNetworkGateway a common class for general resource information. +type VirtualNetworkGateway struct { + autorest.Response `json:"-"` + // VirtualNetworkGatewayPropertiesFormat - Properties of the virtual network gateway. + *VirtualNetworkGatewayPropertiesFormat `json:"properties,omitempty"` + // ExtendedLocation - The extended location of type local virtual network gateway. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGateway. +func (vng VirtualNetworkGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vng.VirtualNetworkGatewayPropertiesFormat != nil { + objectMap["properties"] = vng.VirtualNetworkGatewayPropertiesFormat + } + if vng.ExtendedLocation != nil { + objectMap["extendedLocation"] = vng.ExtendedLocation + } + if vng.ID != nil { + objectMap["id"] = vng.ID + } + if vng.Location != nil { + objectMap["location"] = vng.Location + } + if vng.Tags != nil { + objectMap["tags"] = vng.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGateway struct. +func (vng *VirtualNetworkGateway) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkGatewayPropertiesFormat VirtualNetworkGatewayPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkGatewayPropertiesFormat) + if err != nil { + return err + } + vng.VirtualNetworkGatewayPropertiesFormat = &virtualNetworkGatewayPropertiesFormat + } + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + vng.ExtendedLocation = &extendedLocation + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vng.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vng.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vng.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vng.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vng.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vng.Tags = tags + } + } + } + + return nil +} + +// VirtualNetworkGatewayConnection a common class for general resource information. +type VirtualNetworkGatewayConnection struct { + autorest.Response `json:"-"` + // VirtualNetworkGatewayConnectionPropertiesFormat - Properties of the virtual network gateway connection. + *VirtualNetworkGatewayConnectionPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnection. +func (vngc VirtualNetworkGatewayConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngc.VirtualNetworkGatewayConnectionPropertiesFormat != nil { + objectMap["properties"] = vngc.VirtualNetworkGatewayConnectionPropertiesFormat + } + if vngc.ID != nil { + objectMap["id"] = vngc.ID + } + if vngc.Location != nil { + objectMap["location"] = vngc.Location + } + if vngc.Tags != nil { + objectMap["tags"] = vngc.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayConnection struct. +func (vngc *VirtualNetworkGatewayConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkGatewayConnectionPropertiesFormat VirtualNetworkGatewayConnectionPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkGatewayConnectionPropertiesFormat) + if err != nil { + return err + } + vngc.VirtualNetworkGatewayConnectionPropertiesFormat = &virtualNetworkGatewayConnectionPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vngc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vngc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vngc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vngc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vngc.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vngc.Tags = tags + } + } + } + + return nil +} + +// VirtualNetworkGatewayConnectionListEntity a common class for general resource information. +type VirtualNetworkGatewayConnectionListEntity struct { + // VirtualNetworkGatewayConnectionListEntityPropertiesFormat - Properties of the virtual network gateway connection. + *VirtualNetworkGatewayConnectionListEntityPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnectionListEntity. +func (vngcle VirtualNetworkGatewayConnectionListEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngcle.VirtualNetworkGatewayConnectionListEntityPropertiesFormat != nil { + objectMap["properties"] = vngcle.VirtualNetworkGatewayConnectionListEntityPropertiesFormat + } + if vngcle.ID != nil { + objectMap["id"] = vngcle.ID + } + if vngcle.Location != nil { + objectMap["location"] = vngcle.Location + } + if vngcle.Tags != nil { + objectMap["tags"] = vngcle.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayConnectionListEntity struct. +func (vngcle *VirtualNetworkGatewayConnectionListEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkGatewayConnectionListEntityPropertiesFormat VirtualNetworkGatewayConnectionListEntityPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkGatewayConnectionListEntityPropertiesFormat) + if err != nil { + return err + } + vngcle.VirtualNetworkGatewayConnectionListEntityPropertiesFormat = &virtualNetworkGatewayConnectionListEntityPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vngcle.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vngcle.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vngcle.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vngcle.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vngcle.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vngcle.Tags = tags + } + } + } + + return nil +} + +// VirtualNetworkGatewayConnectionListEntityPropertiesFormat virtualNetworkGatewayConnection properties. +type VirtualNetworkGatewayConnectionListEntityPropertiesFormat struct { + // AuthorizationKey - The authorizationKey. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + // VirtualNetworkGateway1 - The reference to virtual network gateway resource. + VirtualNetworkGateway1 *VirtualNetworkConnectionGatewayReference `json:"virtualNetworkGateway1,omitempty"` + // VirtualNetworkGateway2 - The reference to virtual network gateway resource. + VirtualNetworkGateway2 *VirtualNetworkConnectionGatewayReference `json:"virtualNetworkGateway2,omitempty"` + // LocalNetworkGateway2 - The reference to local network gateway resource. + LocalNetworkGateway2 *VirtualNetworkConnectionGatewayReference `json:"localNetworkGateway2,omitempty"` + // ConnectionType - Gateway connection type. Possible values include: 'VirtualNetworkGatewayConnectionTypeIPsec', 'VirtualNetworkGatewayConnectionTypeVnet2Vnet', 'VirtualNetworkGatewayConnectionTypeExpressRoute', 'VirtualNetworkGatewayConnectionTypeVPNClient' + ConnectionType VirtualNetworkGatewayConnectionType `json:"connectionType,omitempty"` + // ConnectionProtocol - Connection protocol used for this connection. Possible values include: 'VirtualNetworkGatewayConnectionProtocolIKEv2', 'VirtualNetworkGatewayConnectionProtocolIKEv1' + ConnectionProtocol VirtualNetworkGatewayConnectionProtocol `json:"connectionProtocol,omitempty"` + // RoutingWeight - The routing weight. + RoutingWeight *int32 `json:"routingWeight,omitempty"` + // ConnectionMode - The connection mode for this connection. Possible values include: 'VirtualNetworkGatewayConnectionModeDefault', 'VirtualNetworkGatewayConnectionModeResponderOnly', 'VirtualNetworkGatewayConnectionModeInitiatorOnly' + ConnectionMode VirtualNetworkGatewayConnectionMode `json:"connectionMode,omitempty"` + // SharedKey - The IPSec shared key. + SharedKey *string `json:"sharedKey,omitempty"` + // ConnectionStatus - READ-ONLY; Virtual Network Gateway connection status. Possible values include: 'VirtualNetworkGatewayConnectionStatusUnknown', 'VirtualNetworkGatewayConnectionStatusConnecting', 'VirtualNetworkGatewayConnectionStatusConnected', 'VirtualNetworkGatewayConnectionStatusNotConnected' + ConnectionStatus VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty"` + // TunnelConnectionStatus - READ-ONLY; Collection of all tunnels' connection health status. + TunnelConnectionStatus *[]TunnelConnectionHealth `json:"tunnelConnectionStatus,omitempty"` + // EgressBytesTransferred - READ-ONLY; The egress bytes transferred in this connection. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` + // IngressBytesTransferred - READ-ONLY; The ingress bytes transferred in this connection. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` + // Peer - The reference to peerings resource. + Peer *SubResource `json:"peer,omitempty"` + // EnableBgp - EnableBgp flag. + EnableBgp *bool `json:"enableBgp,omitempty"` + // GatewayCustomBgpIPAddresses - GatewayCustomBgpIpAddresses to be used for virtual network gateway Connection. + GatewayCustomBgpIPAddresses *[]GatewayCustomBgpIPAddressIPConfiguration `json:"gatewayCustomBgpIpAddresses,omitempty"` + // UsePolicyBasedTrafficSelectors - Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` + // IpsecPolicies - The IPSec Policies to be considered by this connection. + IpsecPolicies *[]IpsecPolicy `json:"ipsecPolicies,omitempty"` + // TrafficSelectorPolicies - The Traffic Selector Policies to be considered by this connection. + TrafficSelectorPolicies *[]TrafficSelectorPolicy `json:"trafficSelectorPolicies,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the virtual network gateway connection resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network gateway connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ExpressRouteGatewayBypass - Bypass ExpressRoute Gateway for data forwarding. + ExpressRouteGatewayBypass *bool `json:"expressRouteGatewayBypass,omitempty"` + // EnablePrivateLinkFastPath - Bypass the ExpressRoute gateway when accessing private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be enabled. + EnablePrivateLinkFastPath *bool `json:"enablePrivateLinkFastPath,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnectionListEntityPropertiesFormat. +func (vngclepf VirtualNetworkGatewayConnectionListEntityPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngclepf.AuthorizationKey != nil { + objectMap["authorizationKey"] = vngclepf.AuthorizationKey + } + if vngclepf.VirtualNetworkGateway1 != nil { + objectMap["virtualNetworkGateway1"] = vngclepf.VirtualNetworkGateway1 + } + if vngclepf.VirtualNetworkGateway2 != nil { + objectMap["virtualNetworkGateway2"] = vngclepf.VirtualNetworkGateway2 + } + if vngclepf.LocalNetworkGateway2 != nil { + objectMap["localNetworkGateway2"] = vngclepf.LocalNetworkGateway2 + } + if vngclepf.ConnectionType != "" { + objectMap["connectionType"] = vngclepf.ConnectionType + } + if vngclepf.ConnectionProtocol != "" { + objectMap["connectionProtocol"] = vngclepf.ConnectionProtocol + } + if vngclepf.RoutingWeight != nil { + objectMap["routingWeight"] = vngclepf.RoutingWeight + } + if vngclepf.ConnectionMode != "" { + objectMap["connectionMode"] = vngclepf.ConnectionMode + } + if vngclepf.SharedKey != nil { + objectMap["sharedKey"] = vngclepf.SharedKey + } + if vngclepf.Peer != nil { + objectMap["peer"] = vngclepf.Peer + } + if vngclepf.EnableBgp != nil { + objectMap["enableBgp"] = vngclepf.EnableBgp + } + if vngclepf.GatewayCustomBgpIPAddresses != nil { + objectMap["gatewayCustomBgpIpAddresses"] = vngclepf.GatewayCustomBgpIPAddresses + } + if vngclepf.UsePolicyBasedTrafficSelectors != nil { + objectMap["usePolicyBasedTrafficSelectors"] = vngclepf.UsePolicyBasedTrafficSelectors + } + if vngclepf.IpsecPolicies != nil { + objectMap["ipsecPolicies"] = vngclepf.IpsecPolicies + } + if vngclepf.TrafficSelectorPolicies != nil { + objectMap["trafficSelectorPolicies"] = vngclepf.TrafficSelectorPolicies + } + if vngclepf.ExpressRouteGatewayBypass != nil { + objectMap["expressRouteGatewayBypass"] = vngclepf.ExpressRouteGatewayBypass + } + if vngclepf.EnablePrivateLinkFastPath != nil { + objectMap["enablePrivateLinkFastPath"] = vngclepf.EnablePrivateLinkFastPath + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewayConnectionListResult response for the ListVirtualNetworkGatewayConnections API +// service call. +type VirtualNetworkGatewayConnectionListResult struct { + autorest.Response `json:"-"` + // Value - A list of VirtualNetworkGatewayConnection resources that exists in a resource group. + Value *[]VirtualNetworkGatewayConnection `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnectionListResult. +func (vngclr VirtualNetworkGatewayConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngclr.Value != nil { + objectMap["value"] = vngclr.Value + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewayConnectionListResultIterator provides access to a complete listing of +// VirtualNetworkGatewayConnection values. +type VirtualNetworkGatewayConnectionListResultIterator struct { + i int + page VirtualNetworkGatewayConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkGatewayConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkGatewayConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkGatewayConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkGatewayConnectionListResultIterator) Response() VirtualNetworkGatewayConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkGatewayConnectionListResultIterator) Value() VirtualNetworkGatewayConnection { + if !iter.page.NotDone() { + return VirtualNetworkGatewayConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkGatewayConnectionListResultIterator type. +func NewVirtualNetworkGatewayConnectionListResultIterator(page VirtualNetworkGatewayConnectionListResultPage) VirtualNetworkGatewayConnectionListResultIterator { + return VirtualNetworkGatewayConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vngclr VirtualNetworkGatewayConnectionListResult) IsEmpty() bool { + return vngclr.Value == nil || len(*vngclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vngclr VirtualNetworkGatewayConnectionListResult) hasNextLink() bool { + return vngclr.NextLink != nil && len(*vngclr.NextLink) != 0 +} + +// virtualNetworkGatewayConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vngclr VirtualNetworkGatewayConnectionListResult) virtualNetworkGatewayConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vngclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vngclr.NextLink))) +} + +// VirtualNetworkGatewayConnectionListResultPage contains a page of VirtualNetworkGatewayConnection values. +type VirtualNetworkGatewayConnectionListResultPage struct { + fn func(context.Context, VirtualNetworkGatewayConnectionListResult) (VirtualNetworkGatewayConnectionListResult, error) + vngclr VirtualNetworkGatewayConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkGatewayConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vngclr) + if err != nil { + return err + } + page.vngclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkGatewayConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkGatewayConnectionListResultPage) NotDone() bool { + return !page.vngclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkGatewayConnectionListResultPage) Response() VirtualNetworkGatewayConnectionListResult { + return page.vngclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkGatewayConnectionListResultPage) Values() []VirtualNetworkGatewayConnection { + if page.vngclr.IsEmpty() { + return nil + } + return *page.vngclr.Value +} + +// Creates a new instance of the VirtualNetworkGatewayConnectionListResultPage type. +func NewVirtualNetworkGatewayConnectionListResultPage(cur VirtualNetworkGatewayConnectionListResult, getNextPage func(context.Context, VirtualNetworkGatewayConnectionListResult) (VirtualNetworkGatewayConnectionListResult, error)) VirtualNetworkGatewayConnectionListResultPage { + return VirtualNetworkGatewayConnectionListResultPage{ + fn: getNextPage, + vngclr: cur, + } +} + +// VirtualNetworkGatewayConnectionPropertiesFormat virtualNetworkGatewayConnection properties. +type VirtualNetworkGatewayConnectionPropertiesFormat struct { + // AuthorizationKey - The authorizationKey. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + // VirtualNetworkGateway1 - The reference to virtual network gateway resource. + VirtualNetworkGateway1 *VirtualNetworkGateway `json:"virtualNetworkGateway1,omitempty"` + // VirtualNetworkGateway2 - The reference to virtual network gateway resource. + VirtualNetworkGateway2 *VirtualNetworkGateway `json:"virtualNetworkGateway2,omitempty"` + // LocalNetworkGateway2 - The reference to local network gateway resource. + LocalNetworkGateway2 *LocalNetworkGateway `json:"localNetworkGateway2,omitempty"` + // IngressNatRules - List of ingress NatRules. + IngressNatRules *[]SubResource `json:"ingressNatRules,omitempty"` + // EgressNatRules - List of egress NatRules. + EgressNatRules *[]SubResource `json:"egressNatRules,omitempty"` + // ConnectionType - Gateway connection type. Possible values include: 'VirtualNetworkGatewayConnectionTypeIPsec', 'VirtualNetworkGatewayConnectionTypeVnet2Vnet', 'VirtualNetworkGatewayConnectionTypeExpressRoute', 'VirtualNetworkGatewayConnectionTypeVPNClient' + ConnectionType VirtualNetworkGatewayConnectionType `json:"connectionType,omitempty"` + // ConnectionProtocol - Connection protocol used for this connection. Possible values include: 'VirtualNetworkGatewayConnectionProtocolIKEv2', 'VirtualNetworkGatewayConnectionProtocolIKEv1' + ConnectionProtocol VirtualNetworkGatewayConnectionProtocol `json:"connectionProtocol,omitempty"` + // RoutingWeight - The routing weight. + RoutingWeight *int32 `json:"routingWeight,omitempty"` + // DpdTimeoutSeconds - The dead peer detection timeout of this connection in seconds. + DpdTimeoutSeconds *int32 `json:"dpdTimeoutSeconds,omitempty"` + // ConnectionMode - The connection mode for this connection. Possible values include: 'VirtualNetworkGatewayConnectionModeDefault', 'VirtualNetworkGatewayConnectionModeResponderOnly', 'VirtualNetworkGatewayConnectionModeInitiatorOnly' + ConnectionMode VirtualNetworkGatewayConnectionMode `json:"connectionMode,omitempty"` + // SharedKey - The IPSec shared key. + SharedKey *string `json:"sharedKey,omitempty"` + // ConnectionStatus - READ-ONLY; Virtual Network Gateway connection status. Possible values include: 'VirtualNetworkGatewayConnectionStatusUnknown', 'VirtualNetworkGatewayConnectionStatusConnecting', 'VirtualNetworkGatewayConnectionStatusConnected', 'VirtualNetworkGatewayConnectionStatusNotConnected' + ConnectionStatus VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty"` + // TunnelConnectionStatus - READ-ONLY; Collection of all tunnels' connection health status. + TunnelConnectionStatus *[]TunnelConnectionHealth `json:"tunnelConnectionStatus,omitempty"` + // EgressBytesTransferred - READ-ONLY; The egress bytes transferred in this connection. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` + // IngressBytesTransferred - READ-ONLY; The ingress bytes transferred in this connection. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` + // Peer - The reference to peerings resource. + Peer *SubResource `json:"peer,omitempty"` + // EnableBgp - EnableBgp flag. + EnableBgp *bool `json:"enableBgp,omitempty"` + // GatewayCustomBgpIPAddresses - GatewayCustomBgpIpAddresses to be used for virtual network gateway Connection. + GatewayCustomBgpIPAddresses *[]GatewayCustomBgpIPAddressIPConfiguration `json:"gatewayCustomBgpIpAddresses,omitempty"` + // UseLocalAzureIPAddress - Use private local Azure IP for the connection. + UseLocalAzureIPAddress *bool `json:"useLocalAzureIpAddress,omitempty"` + // UsePolicyBasedTrafficSelectors - Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` + // IpsecPolicies - The IPSec Policies to be considered by this connection. + IpsecPolicies *[]IpsecPolicy `json:"ipsecPolicies,omitempty"` + // TrafficSelectorPolicies - The Traffic Selector Policies to be considered by this connection. + TrafficSelectorPolicies *[]TrafficSelectorPolicy `json:"trafficSelectorPolicies,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the virtual network gateway connection resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network gateway connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ExpressRouteGatewayBypass - Bypass ExpressRoute Gateway for data forwarding. + ExpressRouteGatewayBypass *bool `json:"expressRouteGatewayBypass,omitempty"` + // EnablePrivateLinkFastPath - Bypass the ExpressRoute gateway when accessing private-links. ExpressRoute FastPath (expressRouteGatewayBypass) must be enabled. + EnablePrivateLinkFastPath *bool `json:"enablePrivateLinkFastPath,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnectionPropertiesFormat. +func (vngcpf VirtualNetworkGatewayConnectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngcpf.AuthorizationKey != nil { + objectMap["authorizationKey"] = vngcpf.AuthorizationKey + } + if vngcpf.VirtualNetworkGateway1 != nil { + objectMap["virtualNetworkGateway1"] = vngcpf.VirtualNetworkGateway1 + } + if vngcpf.VirtualNetworkGateway2 != nil { + objectMap["virtualNetworkGateway2"] = vngcpf.VirtualNetworkGateway2 + } + if vngcpf.LocalNetworkGateway2 != nil { + objectMap["localNetworkGateway2"] = vngcpf.LocalNetworkGateway2 + } + if vngcpf.IngressNatRules != nil { + objectMap["ingressNatRules"] = vngcpf.IngressNatRules + } + if vngcpf.EgressNatRules != nil { + objectMap["egressNatRules"] = vngcpf.EgressNatRules + } + if vngcpf.ConnectionType != "" { + objectMap["connectionType"] = vngcpf.ConnectionType + } + if vngcpf.ConnectionProtocol != "" { + objectMap["connectionProtocol"] = vngcpf.ConnectionProtocol + } + if vngcpf.RoutingWeight != nil { + objectMap["routingWeight"] = vngcpf.RoutingWeight + } + if vngcpf.DpdTimeoutSeconds != nil { + objectMap["dpdTimeoutSeconds"] = vngcpf.DpdTimeoutSeconds + } + if vngcpf.ConnectionMode != "" { + objectMap["connectionMode"] = vngcpf.ConnectionMode + } + if vngcpf.SharedKey != nil { + objectMap["sharedKey"] = vngcpf.SharedKey + } + if vngcpf.Peer != nil { + objectMap["peer"] = vngcpf.Peer + } + if vngcpf.EnableBgp != nil { + objectMap["enableBgp"] = vngcpf.EnableBgp + } + if vngcpf.GatewayCustomBgpIPAddresses != nil { + objectMap["gatewayCustomBgpIpAddresses"] = vngcpf.GatewayCustomBgpIPAddresses + } + if vngcpf.UseLocalAzureIPAddress != nil { + objectMap["useLocalAzureIpAddress"] = vngcpf.UseLocalAzureIPAddress + } + if vngcpf.UsePolicyBasedTrafficSelectors != nil { + objectMap["usePolicyBasedTrafficSelectors"] = vngcpf.UsePolicyBasedTrafficSelectors + } + if vngcpf.IpsecPolicies != nil { + objectMap["ipsecPolicies"] = vngcpf.IpsecPolicies + } + if vngcpf.TrafficSelectorPolicies != nil { + objectMap["trafficSelectorPolicies"] = vngcpf.TrafficSelectorPolicies + } + if vngcpf.ExpressRouteGatewayBypass != nil { + objectMap["expressRouteGatewayBypass"] = vngcpf.ExpressRouteGatewayBypass + } + if vngcpf.EnablePrivateLinkFastPath != nil { + objectMap["enablePrivateLinkFastPath"] = vngcpf.EnablePrivateLinkFastPath + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewayConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewayConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (VirtualNetworkGatewayConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsCreateOrUpdateFuture.Result. +func (future *VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) result(client VirtualNetworkGatewayConnectionsClient) (vngc VirtualNetworkGatewayConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vngc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vngc.Response.Response, err = future.GetResult(sender); err == nil && vngc.Response.Response.StatusCode != http.StatusNoContent { + vngc, err = client.CreateOrUpdateResponder(vngc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", vngc.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualNetworkGatewayConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsDeleteFuture.Result. +func (future *VirtualNetworkGatewayConnectionsDeleteFuture) result(client VirtualNetworkGatewayConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkGatewayConnectionsGetIkeSasFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualNetworkGatewayConnectionsGetIkeSasFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsGetIkeSasFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsGetIkeSasFuture.Result. +func (future *VirtualNetworkGatewayConnectionsGetIkeSasFuture) result(client VirtualNetworkGatewayConnectionsClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsGetIkeSasFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsGetIkeSasFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.GetIkeSasResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsGetIkeSasFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayConnectionsResetConnectionFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewayConnectionsResetConnectionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsResetConnectionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsResetConnectionFuture.Result. +func (future *VirtualNetworkGatewayConnectionsResetConnectionFuture) result(client VirtualNetworkGatewayConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetConnectionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsResetConnectionFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkGatewayConnectionsResetSharedKeyFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewayConnectionsResetSharedKeyFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (ConnectionResetSharedKey, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsResetSharedKeyFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsResetSharedKeyFuture.Result. +func (future *VirtualNetworkGatewayConnectionsResetSharedKeyFuture) result(client VirtualNetworkGatewayConnectionsClient) (crsk ConnectionResetSharedKey, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + crsk.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if crsk.Response.Response, err = future.GetResult(sender); err == nil && crsk.Response.Response.StatusCode != http.StatusNoContent { + crsk, err = client.ResetSharedKeyResponder(crsk.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", crsk.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayConnectionsSetSharedKeyFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewayConnectionsSetSharedKeyFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (ConnectionSharedKey, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsSetSharedKeyFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsSetSharedKeyFuture.Result. +func (future *VirtualNetworkGatewayConnectionsSetSharedKeyFuture) result(client VirtualNetworkGatewayConnectionsClient) (csk ConnectionSharedKey, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + csk.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if csk.Response.Response, err = future.GetResult(sender); err == nil && csk.Response.Response.StatusCode != http.StatusNoContent { + csk, err = client.SetSharedKeyResponder(csk.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", csk.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayConnectionsStartPacketCaptureFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type VirtualNetworkGatewayConnectionsStartPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsStartPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsStartPacketCaptureFuture.Result. +func (future *VirtualNetworkGatewayConnectionsStartPacketCaptureFuture) result(client VirtualNetworkGatewayConnectionsClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsStartPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsStartPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StartPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsStartPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayConnectionsStopPacketCaptureFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewayConnectionsStopPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsStopPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsStopPacketCaptureFuture.Result. +func (future *VirtualNetworkGatewayConnectionsStopPacketCaptureFuture) result(client VirtualNetworkGatewayConnectionsClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsStopPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsStopPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StopPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsStopPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayConnectionsUpdateTagsFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewayConnectionsUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (VirtualNetworkGatewayConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsUpdateTagsFuture.Result. +func (future *VirtualNetworkGatewayConnectionsUpdateTagsFuture) result(client VirtualNetworkGatewayConnectionsClient) (vngc VirtualNetworkGatewayConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vngc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vngc.Response.Response, err = future.GetResult(sender); err == nil && vngc.Response.Response.StatusCode != http.StatusNoContent { + vngc, err = client.UpdateTagsResponder(vngc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsUpdateTagsFuture", "Result", vngc.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayIPConfiguration IP configuration for virtual network gateway. +type VirtualNetworkGatewayIPConfiguration struct { + // VirtualNetworkGatewayIPConfigurationPropertiesFormat - Properties of the virtual network gateway ip configuration. + *VirtualNetworkGatewayIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayIPConfiguration. +func (vngic VirtualNetworkGatewayIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngic.VirtualNetworkGatewayIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = vngic.VirtualNetworkGatewayIPConfigurationPropertiesFormat + } + if vngic.Name != nil { + objectMap["name"] = vngic.Name + } + if vngic.ID != nil { + objectMap["id"] = vngic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayIPConfiguration struct. +func (vngic *VirtualNetworkGatewayIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkGatewayIPConfigurationPropertiesFormat VirtualNetworkGatewayIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkGatewayIPConfigurationPropertiesFormat) + if err != nil { + return err + } + vngic.VirtualNetworkGatewayIPConfigurationPropertiesFormat = &virtualNetworkGatewayIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vngic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vngic.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vngic.ID = &ID + } + } + } + + return nil +} + +// VirtualNetworkGatewayIPConfigurationPropertiesFormat properties of VirtualNetworkGatewayIPConfiguration. +type VirtualNetworkGatewayIPConfigurationPropertiesFormat struct { + // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // Subnet - The reference to the subnet resource. + Subnet *SubResource `json:"subnet,omitempty"` + // PublicIPAddress - The reference to the public IP resource. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` + // PrivateIPAddress - READ-ONLY; Private IP Address for this gateway. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network gateway IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayIPConfigurationPropertiesFormat. +func (vngicpf VirtualNetworkGatewayIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngicpf.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = vngicpf.PrivateIPAllocationMethod + } + if vngicpf.Subnet != nil { + objectMap["subnet"] = vngicpf.Subnet + } + if vngicpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = vngicpf.PublicIPAddress + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewayListConnectionsResult response for the VirtualNetworkGatewayListConnections API +// service call. +type VirtualNetworkGatewayListConnectionsResult struct { + autorest.Response `json:"-"` + // Value - A list of VirtualNetworkGatewayConnection resources that exists in a resource group. + Value *[]VirtualNetworkGatewayConnectionListEntity `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayListConnectionsResult. +func (vnglcr VirtualNetworkGatewayListConnectionsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnglcr.Value != nil { + objectMap["value"] = vnglcr.Value + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewayListConnectionsResultIterator provides access to a complete listing of +// VirtualNetworkGatewayConnectionListEntity values. +type VirtualNetworkGatewayListConnectionsResultIterator struct { + i int + page VirtualNetworkGatewayListConnectionsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkGatewayListConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayListConnectionsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkGatewayListConnectionsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkGatewayListConnectionsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkGatewayListConnectionsResultIterator) Response() VirtualNetworkGatewayListConnectionsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkGatewayListConnectionsResultIterator) Value() VirtualNetworkGatewayConnectionListEntity { + if !iter.page.NotDone() { + return VirtualNetworkGatewayConnectionListEntity{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkGatewayListConnectionsResultIterator type. +func NewVirtualNetworkGatewayListConnectionsResultIterator(page VirtualNetworkGatewayListConnectionsResultPage) VirtualNetworkGatewayListConnectionsResultIterator { + return VirtualNetworkGatewayListConnectionsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vnglcr VirtualNetworkGatewayListConnectionsResult) IsEmpty() bool { + return vnglcr.Value == nil || len(*vnglcr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vnglcr VirtualNetworkGatewayListConnectionsResult) hasNextLink() bool { + return vnglcr.NextLink != nil && len(*vnglcr.NextLink) != 0 +} + +// virtualNetworkGatewayListConnectionsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vnglcr VirtualNetworkGatewayListConnectionsResult) virtualNetworkGatewayListConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { + if !vnglcr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vnglcr.NextLink))) +} + +// VirtualNetworkGatewayListConnectionsResultPage contains a page of +// VirtualNetworkGatewayConnectionListEntity values. +type VirtualNetworkGatewayListConnectionsResultPage struct { + fn func(context.Context, VirtualNetworkGatewayListConnectionsResult) (VirtualNetworkGatewayListConnectionsResult, error) + vnglcr VirtualNetworkGatewayListConnectionsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkGatewayListConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayListConnectionsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vnglcr) + if err != nil { + return err + } + page.vnglcr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkGatewayListConnectionsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkGatewayListConnectionsResultPage) NotDone() bool { + return !page.vnglcr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkGatewayListConnectionsResultPage) Response() VirtualNetworkGatewayListConnectionsResult { + return page.vnglcr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkGatewayListConnectionsResultPage) Values() []VirtualNetworkGatewayConnectionListEntity { + if page.vnglcr.IsEmpty() { + return nil + } + return *page.vnglcr.Value +} + +// Creates a new instance of the VirtualNetworkGatewayListConnectionsResultPage type. +func NewVirtualNetworkGatewayListConnectionsResultPage(cur VirtualNetworkGatewayListConnectionsResult, getNextPage func(context.Context, VirtualNetworkGatewayListConnectionsResult) (VirtualNetworkGatewayListConnectionsResult, error)) VirtualNetworkGatewayListConnectionsResultPage { + return VirtualNetworkGatewayListConnectionsResultPage{ + fn: getNextPage, + vnglcr: cur, + } +} + +// VirtualNetworkGatewayListResult response for the ListVirtualNetworkGateways API service call. +type VirtualNetworkGatewayListResult struct { + autorest.Response `json:"-"` + // Value - A list of VirtualNetworkGateway resources that exists in a resource group. + Value *[]VirtualNetworkGateway `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayListResult. +func (vnglr VirtualNetworkGatewayListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnglr.Value != nil { + objectMap["value"] = vnglr.Value + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewayListResultIterator provides access to a complete listing of VirtualNetworkGateway +// values. +type VirtualNetworkGatewayListResultIterator struct { + i int + page VirtualNetworkGatewayListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkGatewayListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkGatewayListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkGatewayListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkGatewayListResultIterator) Response() VirtualNetworkGatewayListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkGatewayListResultIterator) Value() VirtualNetworkGateway { + if !iter.page.NotDone() { + return VirtualNetworkGateway{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkGatewayListResultIterator type. +func NewVirtualNetworkGatewayListResultIterator(page VirtualNetworkGatewayListResultPage) VirtualNetworkGatewayListResultIterator { + return VirtualNetworkGatewayListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vnglr VirtualNetworkGatewayListResult) IsEmpty() bool { + return vnglr.Value == nil || len(*vnglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vnglr VirtualNetworkGatewayListResult) hasNextLink() bool { + return vnglr.NextLink != nil && len(*vnglr.NextLink) != 0 +} + +// virtualNetworkGatewayListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vnglr VirtualNetworkGatewayListResult) virtualNetworkGatewayListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vnglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vnglr.NextLink))) +} + +// VirtualNetworkGatewayListResultPage contains a page of VirtualNetworkGateway values. +type VirtualNetworkGatewayListResultPage struct { + fn func(context.Context, VirtualNetworkGatewayListResult) (VirtualNetworkGatewayListResult, error) + vnglr VirtualNetworkGatewayListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkGatewayListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vnglr) + if err != nil { + return err + } + page.vnglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkGatewayListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkGatewayListResultPage) NotDone() bool { + return !page.vnglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkGatewayListResultPage) Response() VirtualNetworkGatewayListResult { + return page.vnglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkGatewayListResultPage) Values() []VirtualNetworkGateway { + if page.vnglr.IsEmpty() { + return nil + } + return *page.vnglr.Value +} + +// Creates a new instance of the VirtualNetworkGatewayListResultPage type. +func NewVirtualNetworkGatewayListResultPage(cur VirtualNetworkGatewayListResult, getNextPage func(context.Context, VirtualNetworkGatewayListResult) (VirtualNetworkGatewayListResult, error)) VirtualNetworkGatewayListResultPage { + return VirtualNetworkGatewayListResultPage{ + fn: getNextPage, + vnglr: cur, + } +} + +// VirtualNetworkGatewayNatRule virtualNetworkGatewayNatRule Resource. +type VirtualNetworkGatewayNatRule struct { + autorest.Response `json:"-"` + // VirtualNetworkGatewayNatRuleProperties - Properties of the Virtual Network Gateway NAT rule. + *VirtualNetworkGatewayNatRuleProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayNatRule. +func (vngnr VirtualNetworkGatewayNatRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngnr.VirtualNetworkGatewayNatRuleProperties != nil { + objectMap["properties"] = vngnr.VirtualNetworkGatewayNatRuleProperties + } + if vngnr.Name != nil { + objectMap["name"] = vngnr.Name + } + if vngnr.ID != nil { + objectMap["id"] = vngnr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayNatRule struct. +func (vngnr *VirtualNetworkGatewayNatRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkGatewayNatRuleProperties VirtualNetworkGatewayNatRuleProperties + err = json.Unmarshal(*v, &virtualNetworkGatewayNatRuleProperties) + if err != nil { + return err + } + vngnr.VirtualNetworkGatewayNatRuleProperties = &virtualNetworkGatewayNatRuleProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vngnr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vngnr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vngnr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vngnr.ID = &ID + } + } + } + + return nil +} + +// VirtualNetworkGatewayNatRuleProperties parameters for VirtualNetworkGatewayNatRule. +type VirtualNetworkGatewayNatRuleProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the NAT Rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Type - The type of NAT rule for VPN NAT. Possible values include: 'VpnNatRuleTypeStatic', 'VpnNatRuleTypeDynamic' + Type VpnNatRuleType `json:"type,omitempty"` + // Mode - The Source NAT direction of a VPN NAT. Possible values include: 'VpnNatRuleModeEgressSnat', 'VpnNatRuleModeIngressSnat' + Mode VpnNatRuleMode `json:"mode,omitempty"` + // InternalMappings - The private IP address internal mapping for NAT. + InternalMappings *[]VpnNatRuleMapping `json:"internalMappings,omitempty"` + // ExternalMappings - The private IP address external mapping for NAT. + ExternalMappings *[]VpnNatRuleMapping `json:"externalMappings,omitempty"` + // IPConfigurationID - The IP Configuration ID this NAT rule applies to. + IPConfigurationID *string `json:"ipConfigurationId,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayNatRuleProperties. +func (vngnrp VirtualNetworkGatewayNatRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngnrp.Type != "" { + objectMap["type"] = vngnrp.Type + } + if vngnrp.Mode != "" { + objectMap["mode"] = vngnrp.Mode + } + if vngnrp.InternalMappings != nil { + objectMap["internalMappings"] = vngnrp.InternalMappings + } + if vngnrp.ExternalMappings != nil { + objectMap["externalMappings"] = vngnrp.ExternalMappings + } + if vngnrp.IPConfigurationID != nil { + objectMap["ipConfigurationId"] = vngnrp.IPConfigurationID + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewayNatRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewayNatRulesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayNatRulesClient) (VirtualNetworkGatewayNatRule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayNatRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayNatRulesCreateOrUpdateFuture.Result. +func (future *VirtualNetworkGatewayNatRulesCreateOrUpdateFuture) result(client VirtualNetworkGatewayNatRulesClient) (vngnr VirtualNetworkGatewayNatRule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vngnr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayNatRulesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vngnr.Response.Response, err = future.GetResult(sender); err == nil && vngnr.Response.Response.StatusCode != http.StatusNoContent { + vngnr, err = client.CreateOrUpdateResponder(vngnr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesCreateOrUpdateFuture", "Result", vngnr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayNatRulesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkGatewayNatRulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayNatRulesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayNatRulesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayNatRulesDeleteFuture.Result. +func (future *VirtualNetworkGatewayNatRulesDeleteFuture) result(client VirtualNetworkGatewayNatRulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayNatRulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkGatewayPolicyGroup parameters for VirtualNetworkGatewayPolicyGroup. +type VirtualNetworkGatewayPolicyGroup struct { + // VirtualNetworkGatewayPolicyGroupProperties - Properties of tVirtualNetworkGatewayPolicyGroup. + *VirtualNetworkGatewayPolicyGroupProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayPolicyGroup. +func (vngpg VirtualNetworkGatewayPolicyGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngpg.VirtualNetworkGatewayPolicyGroupProperties != nil { + objectMap["properties"] = vngpg.VirtualNetworkGatewayPolicyGroupProperties + } + if vngpg.Name != nil { + objectMap["name"] = vngpg.Name + } + if vngpg.ID != nil { + objectMap["id"] = vngpg.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayPolicyGroup struct. +func (vngpg *VirtualNetworkGatewayPolicyGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkGatewayPolicyGroupProperties VirtualNetworkGatewayPolicyGroupProperties + err = json.Unmarshal(*v, &virtualNetworkGatewayPolicyGroupProperties) + if err != nil { + return err + } + vngpg.VirtualNetworkGatewayPolicyGroupProperties = &virtualNetworkGatewayPolicyGroupProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vngpg.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vngpg.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vngpg.ID = &ID + } + } + } + + return nil +} + +// VirtualNetworkGatewayPolicyGroupMember vpn Client Connection configuration PolicyGroup member +type VirtualNetworkGatewayPolicyGroupMember struct { + // Name - Name of the VirtualNetworkGatewayPolicyGroupMember. + Name *string `json:"name,omitempty"` + // AttributeType - The Vpn Policy member attribute type. Possible values include: 'VpnPolicyMemberAttributeTypeCertificateGroupID', 'VpnPolicyMemberAttributeTypeAADGroupID', 'VpnPolicyMemberAttributeTypeRadiusAzureGroupID' + AttributeType VpnPolicyMemberAttributeType `json:"attributeType,omitempty"` + // AttributeValue - The value of Attribute used for this VirtualNetworkGatewayPolicyGroupMember. + AttributeValue *string `json:"attributeValue,omitempty"` +} + +// VirtualNetworkGatewayPolicyGroupProperties properties of VirtualNetworkGatewayPolicyGroup. +type VirtualNetworkGatewayPolicyGroupProperties struct { + // IsDefault - Shows if this is a Default VirtualNetworkGatewayPolicyGroup or not. + IsDefault *bool `json:"isDefault,omitempty"` + // Priority - Priority for VirtualNetworkGatewayPolicyGroup. + Priority *int32 `json:"priority,omitempty"` + // PolicyMembers - Multiple PolicyMembers for VirtualNetworkGatewayPolicyGroup. + PolicyMembers *[]VirtualNetworkGatewayPolicyGroupMember `json:"policyMembers,omitempty"` + // VngClientConnectionConfigurations - READ-ONLY; List of references to vngClientConnectionConfigurations. + VngClientConnectionConfigurations *[]SubResource `json:"vngClientConnectionConfigurations,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VirtualNetworkGatewayPolicyGroup resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayPolicyGroupProperties. +func (vngpgp VirtualNetworkGatewayPolicyGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngpgp.IsDefault != nil { + objectMap["isDefault"] = vngpgp.IsDefault + } + if vngpgp.Priority != nil { + objectMap["priority"] = vngpgp.Priority + } + if vngpgp.PolicyMembers != nil { + objectMap["policyMembers"] = vngpgp.PolicyMembers + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewayPropertiesFormat virtualNetworkGateway properties. +type VirtualNetworkGatewayPropertiesFormat struct { + // IPConfigurations - IP configurations for virtual network gateway. + IPConfigurations *[]VirtualNetworkGatewayIPConfiguration `json:"ipConfigurations,omitempty"` + // GatewayType - The type of this virtual network gateway. Possible values include: 'VirtualNetworkGatewayTypeVpn', 'VirtualNetworkGatewayTypeExpressRoute', 'VirtualNetworkGatewayTypeLocalGateway' + GatewayType VirtualNetworkGatewayType `json:"gatewayType,omitempty"` + // VpnType - The type of this virtual network gateway. Possible values include: 'VpnTypePolicyBased', 'VpnTypeRouteBased' + VpnType VpnType `json:"vpnType,omitempty"` + // VpnGatewayGeneration - The generation for this VirtualNetworkGateway. Must be None if gatewayType is not VPN. Possible values include: 'VpnGatewayGenerationNone', 'VpnGatewayGenerationGeneration1', 'VpnGatewayGenerationGeneration2' + VpnGatewayGeneration VpnGatewayGeneration `json:"vpnGatewayGeneration,omitempty"` + // EnableBgp - Whether BGP is enabled for this virtual network gateway or not. + EnableBgp *bool `json:"enableBgp,omitempty"` + // EnablePrivateIPAddress - Whether private IP needs to be enabled on this gateway for connections or not. + EnablePrivateIPAddress *bool `json:"enablePrivateIpAddress,omitempty"` + // ActiveActive - ActiveActive flag. + ActiveActive *bool `json:"activeActive,omitempty"` + // DisableIPSecReplayProtection - disableIPSecReplayProtection flag. + DisableIPSecReplayProtection *bool `json:"disableIPSecReplayProtection,omitempty"` + // GatewayDefaultSite - The reference to the LocalNetworkGateway resource which represents local network site having default routes. Assign Null value in case of removing existing default site setting. + GatewayDefaultSite *SubResource `json:"gatewayDefaultSite,omitempty"` + // Sku - The reference to the VirtualNetworkGatewaySku resource which represents the SKU selected for Virtual network gateway. + Sku *VirtualNetworkGatewaySku `json:"sku,omitempty"` + // VpnClientConfiguration - The reference to the VpnClientConfiguration resource which represents the P2S VpnClient configurations. + VpnClientConfiguration *VpnClientConfiguration `json:"vpnClientConfiguration,omitempty"` + // VirtualNetworkGatewayPolicyGroups - The reference to the VirtualNetworkGatewayPolicyGroup resource which represents the available VirtualNetworkGatewayPolicyGroup for the gateway. + VirtualNetworkGatewayPolicyGroups *[]VirtualNetworkGatewayPolicyGroup `json:"virtualNetworkGatewayPolicyGroups,omitempty"` + // BgpSettings - Virtual network gateway's BGP speaker settings. + BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` + // CustomRoutes - The reference to the address space resource which represents the custom routes address space specified by the customer for virtual network gateway and VpnClient. + CustomRoutes *AddressSpace `json:"customRoutes,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the virtual network gateway resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // EnableDNSForwarding - Whether dns forwarding is enabled or not. + EnableDNSForwarding *bool `json:"enableDnsForwarding,omitempty"` + // InboundDNSForwardingEndpoint - READ-ONLY; The IP address allocated by the gateway to which dns requests can be sent. + InboundDNSForwardingEndpoint *string `json:"inboundDnsForwardingEndpoint,omitempty"` + // VNetExtendedLocationResourceID - Customer vnet resource id. VirtualNetworkGateway of type local gateway is associated with the customer vnet. + VNetExtendedLocationResourceID *string `json:"vNetExtendedLocationResourceId,omitempty"` + // NatRules - NatRules for virtual network gateway. + NatRules *[]VirtualNetworkGatewayNatRule `json:"natRules,omitempty"` + // EnableBgpRouteTranslationForNat - EnableBgpRouteTranslationForNat flag. + EnableBgpRouteTranslationForNat *bool `json:"enableBgpRouteTranslationForNat,omitempty"` + // AllowVirtualWanTraffic - Configures this gateway to accept traffic from remote Virtual WAN networks. + AllowVirtualWanTraffic *bool `json:"allowVirtualWanTraffic,omitempty"` + // AllowRemoteVnetTraffic - Configure this gateway to accept traffic from other Azure Virtual Networks. This configuration does not support connectivity to Azure Virtual WAN. + AllowRemoteVnetTraffic *bool `json:"allowRemoteVnetTraffic,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayPropertiesFormat. +func (vngpf VirtualNetworkGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngpf.IPConfigurations != nil { + objectMap["ipConfigurations"] = vngpf.IPConfigurations + } + if vngpf.GatewayType != "" { + objectMap["gatewayType"] = vngpf.GatewayType + } + if vngpf.VpnType != "" { + objectMap["vpnType"] = vngpf.VpnType + } + if vngpf.VpnGatewayGeneration != "" { + objectMap["vpnGatewayGeneration"] = vngpf.VpnGatewayGeneration + } + if vngpf.EnableBgp != nil { + objectMap["enableBgp"] = vngpf.EnableBgp + } + if vngpf.EnablePrivateIPAddress != nil { + objectMap["enablePrivateIpAddress"] = vngpf.EnablePrivateIPAddress + } + if vngpf.ActiveActive != nil { + objectMap["activeActive"] = vngpf.ActiveActive + } + if vngpf.DisableIPSecReplayProtection != nil { + objectMap["disableIPSecReplayProtection"] = vngpf.DisableIPSecReplayProtection + } + if vngpf.GatewayDefaultSite != nil { + objectMap["gatewayDefaultSite"] = vngpf.GatewayDefaultSite + } + if vngpf.Sku != nil { + objectMap["sku"] = vngpf.Sku + } + if vngpf.VpnClientConfiguration != nil { + objectMap["vpnClientConfiguration"] = vngpf.VpnClientConfiguration + } + if vngpf.VirtualNetworkGatewayPolicyGroups != nil { + objectMap["virtualNetworkGatewayPolicyGroups"] = vngpf.VirtualNetworkGatewayPolicyGroups + } + if vngpf.BgpSettings != nil { + objectMap["bgpSettings"] = vngpf.BgpSettings + } + if vngpf.CustomRoutes != nil { + objectMap["customRoutes"] = vngpf.CustomRoutes + } + if vngpf.EnableDNSForwarding != nil { + objectMap["enableDnsForwarding"] = vngpf.EnableDNSForwarding + } + if vngpf.VNetExtendedLocationResourceID != nil { + objectMap["vNetExtendedLocationResourceId"] = vngpf.VNetExtendedLocationResourceID + } + if vngpf.NatRules != nil { + objectMap["natRules"] = vngpf.NatRules + } + if vngpf.EnableBgpRouteTranslationForNat != nil { + objectMap["enableBgpRouteTranslationForNat"] = vngpf.EnableBgpRouteTranslationForNat + } + if vngpf.AllowVirtualWanTraffic != nil { + objectMap["allowVirtualWanTraffic"] = vngpf.AllowVirtualWanTraffic + } + if vngpf.AllowRemoteVnetTraffic != nil { + objectMap["allowRemoteVnetTraffic"] = vngpf.AllowRemoteVnetTraffic + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewaySku virtualNetworkGatewaySku details. +type VirtualNetworkGatewaySku struct { + // Name - Gateway SKU name. Possible values include: 'VirtualNetworkGatewaySkuNameBasic', 'VirtualNetworkGatewaySkuNameHighPerformance', 'VirtualNetworkGatewaySkuNameStandard', 'VirtualNetworkGatewaySkuNameUltraPerformance', 'VirtualNetworkGatewaySkuNameVpnGw1', 'VirtualNetworkGatewaySkuNameVpnGw2', 'VirtualNetworkGatewaySkuNameVpnGw3', 'VirtualNetworkGatewaySkuNameVpnGw4', 'VirtualNetworkGatewaySkuNameVpnGw5', 'VirtualNetworkGatewaySkuNameVpnGw1AZ', 'VirtualNetworkGatewaySkuNameVpnGw2AZ', 'VirtualNetworkGatewaySkuNameVpnGw3AZ', 'VirtualNetworkGatewaySkuNameVpnGw4AZ', 'VirtualNetworkGatewaySkuNameVpnGw5AZ', 'VirtualNetworkGatewaySkuNameErGw1AZ', 'VirtualNetworkGatewaySkuNameErGw2AZ', 'VirtualNetworkGatewaySkuNameErGw3AZ' + Name VirtualNetworkGatewaySkuName `json:"name,omitempty"` + // Tier - Gateway SKU tier. Possible values include: 'VirtualNetworkGatewaySkuTierBasic', 'VirtualNetworkGatewaySkuTierHighPerformance', 'VirtualNetworkGatewaySkuTierStandard', 'VirtualNetworkGatewaySkuTierUltraPerformance', 'VirtualNetworkGatewaySkuTierVpnGw1', 'VirtualNetworkGatewaySkuTierVpnGw2', 'VirtualNetworkGatewaySkuTierVpnGw3', 'VirtualNetworkGatewaySkuTierVpnGw4', 'VirtualNetworkGatewaySkuTierVpnGw5', 'VirtualNetworkGatewaySkuTierVpnGw1AZ', 'VirtualNetworkGatewaySkuTierVpnGw2AZ', 'VirtualNetworkGatewaySkuTierVpnGw3AZ', 'VirtualNetworkGatewaySkuTierVpnGw4AZ', 'VirtualNetworkGatewaySkuTierVpnGw5AZ', 'VirtualNetworkGatewaySkuTierErGw1AZ', 'VirtualNetworkGatewaySkuTierErGw2AZ', 'VirtualNetworkGatewaySkuTierErGw3AZ' + Tier VirtualNetworkGatewaySkuTier `json:"tier,omitempty"` + // Capacity - READ-ONLY; The capacity. + Capacity *int32 `json:"capacity,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewaySku. +func (vngs VirtualNetworkGatewaySku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngs.Name != "" { + objectMap["name"] = vngs.Name + } + if vngs.Tier != "" { + objectMap["tier"] = vngs.Tier + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkGatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (VirtualNetworkGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysCreateOrUpdateFuture.Result. +func (future *VirtualNetworkGatewaysCreateOrUpdateFuture) result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vng.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { + vng, err = client.CreateOrUpdateResponder(vng.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", vng.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkGatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysDeleteFuture.Result. +func (future *VirtualNetworkGatewaysDeleteFuture) result(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture an abstraction for monitoring +// and retrieving the results of a long-running operation. +type VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture.Result. +func (future *VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture) result(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkGatewaysGenerateVpnProfileFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualNetworkGatewaysGenerateVpnProfileFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGenerateVpnProfileFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGenerateVpnProfileFuture.Result. +func (future *VirtualNetworkGatewaysGenerateVpnProfileFuture) result(client VirtualNetworkGatewaysClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGenerateVpnProfileFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.GenerateVpnProfileResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysGeneratevpnclientpackageFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewaysGeneratevpnclientpackageFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGeneratevpnclientpackageFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGeneratevpnclientpackageFuture.Result. +func (future *VirtualNetworkGatewaysGeneratevpnclientpackageFuture) result(client VirtualNetworkGatewaysClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.GeneratevpnclientpackageResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysGetAdvertisedRoutesFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualNetworkGatewaysGetAdvertisedRoutesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (GatewayRouteListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGetAdvertisedRoutesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGetAdvertisedRoutesFuture.Result. +func (future *VirtualNetworkGatewaysGetAdvertisedRoutesFuture) result(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + grlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if grlr.Response.Response, err = future.GetResult(sender); err == nil && grlr.Response.Response.StatusCode != http.StatusNoContent { + grlr, err = client.GetAdvertisedRoutesResponder(grlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", grlr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysGetBgpPeerStatusFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualNetworkGatewaysGetBgpPeerStatusFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (BgpPeerStatusListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGetBgpPeerStatusFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGetBgpPeerStatusFuture.Result. +func (future *VirtualNetworkGatewaysGetBgpPeerStatusFuture) result(client VirtualNetworkGatewaysClient) (bpslr BgpPeerStatusListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bpslr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetBgpPeerStatusFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bpslr.Response.Response, err = future.GetResult(sender); err == nil && bpslr.Response.Response.StatusCode != http.StatusNoContent { + bpslr, err = client.GetBgpPeerStatusResponder(bpslr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", bpslr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysGetLearnedRoutesFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualNetworkGatewaysGetLearnedRoutesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (GatewayRouteListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGetLearnedRoutesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGetLearnedRoutesFuture.Result. +func (future *VirtualNetworkGatewaysGetLearnedRoutesFuture) result(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + grlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetLearnedRoutesFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if grlr.Response.Response, err = future.GetResult(sender); err == nil && grlr.Response.Response.StatusCode != http.StatusNoContent { + grlr, err = client.GetLearnedRoutesResponder(grlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", grlr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysGetVpnProfilePackageURLFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewaysGetVpnProfilePackageURLFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGetVpnProfilePackageURLFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGetVpnProfilePackageURLFuture.Result. +func (future *VirtualNetworkGatewaysGetVpnProfilePackageURLFuture) result(client VirtualNetworkGatewaysClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.GetVpnProfilePackageURLResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (VpnClientConnectionHealthDetailListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture.Result. +func (future *VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture) result(client VirtualNetworkGatewaysClient) (vcchdlr VpnClientConnectionHealthDetailListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vcchdlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vcchdlr.Response.Response, err = future.GetResult(sender); err == nil && vcchdlr.Response.Response.StatusCode != http.StatusNoContent { + vcchdlr, err = client.GetVpnclientConnectionHealthResponder(vcchdlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture", "Result", vcchdlr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (VpnClientIPsecParameters, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture.Result. +func (future *VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture) result(client VirtualNetworkGatewaysClient) (vcipp VpnClientIPsecParameters, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vcipp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vcipp.Response.Response, err = future.GetResult(sender); err == nil && vcipp.Response.Response.StatusCode != http.StatusNoContent { + vcipp, err = client.GetVpnclientIpsecParametersResponder(vcipp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture", "Result", vcipp.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysResetFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkGatewaysResetFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (VirtualNetworkGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysResetFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysResetFuture.Result. +func (future *VirtualNetworkGatewaysResetFuture) result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vng.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { + vng, err = client.ResetResponder(vng.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", vng.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysResetVpnClientSharedKeyFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewaysResetVpnClientSharedKeyFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysResetVpnClientSharedKeyFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysResetVpnClientSharedKeyFuture.Result. +func (future *VirtualNetworkGatewaysResetVpnClientSharedKeyFuture) result(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetVpnClientSharedKeyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetVpnClientSharedKeyFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (VpnClientIPsecParameters, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture.Result. +func (future *VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture) result(client VirtualNetworkGatewaysClient) (vcipp VpnClientIPsecParameters, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vcipp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vcipp.Response.Response, err = future.GetResult(sender); err == nil && vcipp.Response.Response.StatusCode != http.StatusNoContent { + vcipp, err = client.SetVpnclientIpsecParametersResponder(vcipp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture", "Result", vcipp.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysStartPacketCaptureFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualNetworkGatewaysStartPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysStartPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysStartPacketCaptureFuture.Result. +func (future *VirtualNetworkGatewaysStartPacketCaptureFuture) result(client VirtualNetworkGatewaysClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStartPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysStartPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StartPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStartPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysStopPacketCaptureFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualNetworkGatewaysStopPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysStopPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysStopPacketCaptureFuture.Result. +func (future *VirtualNetworkGatewaysStopPacketCaptureFuture) result(client VirtualNetworkGatewaysClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStopPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysStopPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StopPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStopPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysUpdateTagsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkGatewaysUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (VirtualNetworkGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysUpdateTagsFuture.Result. +func (future *VirtualNetworkGatewaysUpdateTagsFuture) result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vng.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { + vng, err = client.UpdateTagsResponder(vng.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", vng.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkListResult response for the ListVirtualNetworks API service call. +type VirtualNetworkListResult struct { + autorest.Response `json:"-"` + // Value - A list of VirtualNetwork resources in a resource group. + Value *[]VirtualNetwork `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualNetworkListResultIterator provides access to a complete listing of VirtualNetwork values. +type VirtualNetworkListResultIterator struct { + i int + page VirtualNetworkListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkListResultIterator) Response() VirtualNetworkListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkListResultIterator) Value() VirtualNetwork { + if !iter.page.NotDone() { + return VirtualNetwork{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkListResultIterator type. +func NewVirtualNetworkListResultIterator(page VirtualNetworkListResultPage) VirtualNetworkListResultIterator { + return VirtualNetworkListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vnlr VirtualNetworkListResult) IsEmpty() bool { + return vnlr.Value == nil || len(*vnlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vnlr VirtualNetworkListResult) hasNextLink() bool { + return vnlr.NextLink != nil && len(*vnlr.NextLink) != 0 +} + +// virtualNetworkListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vnlr VirtualNetworkListResult) virtualNetworkListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vnlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vnlr.NextLink))) +} + +// VirtualNetworkListResultPage contains a page of VirtualNetwork values. +type VirtualNetworkListResultPage struct { + fn func(context.Context, VirtualNetworkListResult) (VirtualNetworkListResult, error) + vnlr VirtualNetworkListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vnlr) + if err != nil { + return err + } + page.vnlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkListResultPage) NotDone() bool { + return !page.vnlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkListResultPage) Response() VirtualNetworkListResult { + return page.vnlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkListResultPage) Values() []VirtualNetwork { + if page.vnlr.IsEmpty() { + return nil + } + return *page.vnlr.Value +} + +// Creates a new instance of the VirtualNetworkListResultPage type. +func NewVirtualNetworkListResultPage(cur VirtualNetworkListResult, getNextPage func(context.Context, VirtualNetworkListResult) (VirtualNetworkListResult, error)) VirtualNetworkListResultPage { + return VirtualNetworkListResultPage{ + fn: getNextPage, + vnlr: cur, + } +} + +// VirtualNetworkListUsageResult response for the virtual networks GetUsage API service call. +type VirtualNetworkListUsageResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; VirtualNetwork usage stats. + Value *[]VirtualNetworkUsage `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkListUsageResult. +func (vnlur VirtualNetworkListUsageResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnlur.NextLink != nil { + objectMap["nextLink"] = vnlur.NextLink + } + return json.Marshal(objectMap) +} + +// VirtualNetworkListUsageResultIterator provides access to a complete listing of VirtualNetworkUsage +// values. +type VirtualNetworkListUsageResultIterator struct { + i int + page VirtualNetworkListUsageResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkListUsageResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListUsageResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkListUsageResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkListUsageResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkListUsageResultIterator) Response() VirtualNetworkListUsageResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkListUsageResultIterator) Value() VirtualNetworkUsage { + if !iter.page.NotDone() { + return VirtualNetworkUsage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkListUsageResultIterator type. +func NewVirtualNetworkListUsageResultIterator(page VirtualNetworkListUsageResultPage) VirtualNetworkListUsageResultIterator { + return VirtualNetworkListUsageResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vnlur VirtualNetworkListUsageResult) IsEmpty() bool { + return vnlur.Value == nil || len(*vnlur.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vnlur VirtualNetworkListUsageResult) hasNextLink() bool { + return vnlur.NextLink != nil && len(*vnlur.NextLink) != 0 +} + +// virtualNetworkListUsageResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vnlur VirtualNetworkListUsageResult) virtualNetworkListUsageResultPreparer(ctx context.Context) (*http.Request, error) { + if !vnlur.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vnlur.NextLink))) +} + +// VirtualNetworkListUsageResultPage contains a page of VirtualNetworkUsage values. +type VirtualNetworkListUsageResultPage struct { + fn func(context.Context, VirtualNetworkListUsageResult) (VirtualNetworkListUsageResult, error) + vnlur VirtualNetworkListUsageResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkListUsageResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListUsageResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vnlur) + if err != nil { + return err + } + page.vnlur = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkListUsageResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkListUsageResultPage) NotDone() bool { + return !page.vnlur.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkListUsageResultPage) Response() VirtualNetworkListUsageResult { + return page.vnlur +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkListUsageResultPage) Values() []VirtualNetworkUsage { + if page.vnlur.IsEmpty() { + return nil + } + return *page.vnlur.Value +} + +// Creates a new instance of the VirtualNetworkListUsageResultPage type. +func NewVirtualNetworkListUsageResultPage(cur VirtualNetworkListUsageResult, getNextPage func(context.Context, VirtualNetworkListUsageResult) (VirtualNetworkListUsageResult, error)) VirtualNetworkListUsageResultPage { + return VirtualNetworkListUsageResultPage{ + fn: getNextPage, + vnlur: cur, + } +} + +// VirtualNetworkPeering peerings in a virtual network resource. +type VirtualNetworkPeering struct { + autorest.Response `json:"-"` + // VirtualNetworkPeeringPropertiesFormat - Properties of the virtual network peering. + *VirtualNetworkPeeringPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkPeering. +func (vnp VirtualNetworkPeering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnp.VirtualNetworkPeeringPropertiesFormat != nil { + objectMap["properties"] = vnp.VirtualNetworkPeeringPropertiesFormat + } + if vnp.Name != nil { + objectMap["name"] = vnp.Name + } + if vnp.Type != nil { + objectMap["type"] = vnp.Type + } + if vnp.ID != nil { + objectMap["id"] = vnp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkPeering struct. +func (vnp *VirtualNetworkPeering) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkPeeringPropertiesFormat VirtualNetworkPeeringPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkPeeringPropertiesFormat) + if err != nil { + return err + } + vnp.VirtualNetworkPeeringPropertiesFormat = &virtualNetworkPeeringPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vnp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vnp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vnp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vnp.ID = &ID + } + } + } + + return nil +} + +// VirtualNetworkPeeringListResult response for ListSubnets API service call. Retrieves all subnets that +// belong to a virtual network. +type VirtualNetworkPeeringListResult struct { + autorest.Response `json:"-"` + // Value - The peerings in a virtual network. + Value *[]VirtualNetworkPeering `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualNetworkPeeringListResultIterator provides access to a complete listing of VirtualNetworkPeering +// values. +type VirtualNetworkPeeringListResultIterator struct { + i int + page VirtualNetworkPeeringListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkPeeringListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkPeeringListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkPeeringListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkPeeringListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkPeeringListResultIterator) Response() VirtualNetworkPeeringListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkPeeringListResultIterator) Value() VirtualNetworkPeering { + if !iter.page.NotDone() { + return VirtualNetworkPeering{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkPeeringListResultIterator type. +func NewVirtualNetworkPeeringListResultIterator(page VirtualNetworkPeeringListResultPage) VirtualNetworkPeeringListResultIterator { + return VirtualNetworkPeeringListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vnplr VirtualNetworkPeeringListResult) IsEmpty() bool { + return vnplr.Value == nil || len(*vnplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vnplr VirtualNetworkPeeringListResult) hasNextLink() bool { + return vnplr.NextLink != nil && len(*vnplr.NextLink) != 0 +} + +// virtualNetworkPeeringListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vnplr VirtualNetworkPeeringListResult) virtualNetworkPeeringListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vnplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vnplr.NextLink))) +} + +// VirtualNetworkPeeringListResultPage contains a page of VirtualNetworkPeering values. +type VirtualNetworkPeeringListResultPage struct { + fn func(context.Context, VirtualNetworkPeeringListResult) (VirtualNetworkPeeringListResult, error) + vnplr VirtualNetworkPeeringListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkPeeringListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkPeeringListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vnplr) + if err != nil { + return err + } + page.vnplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkPeeringListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkPeeringListResultPage) NotDone() bool { + return !page.vnplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkPeeringListResultPage) Response() VirtualNetworkPeeringListResult { + return page.vnplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkPeeringListResultPage) Values() []VirtualNetworkPeering { + if page.vnplr.IsEmpty() { + return nil + } + return *page.vnplr.Value +} + +// Creates a new instance of the VirtualNetworkPeeringListResultPage type. +func NewVirtualNetworkPeeringListResultPage(cur VirtualNetworkPeeringListResult, getNextPage func(context.Context, VirtualNetworkPeeringListResult) (VirtualNetworkPeeringListResult, error)) VirtualNetworkPeeringListResultPage { + return VirtualNetworkPeeringListResultPage{ + fn: getNextPage, + vnplr: cur, + } +} + +// VirtualNetworkPeeringPropertiesFormat properties of the virtual network peering. +type VirtualNetworkPeeringPropertiesFormat struct { + // AllowVirtualNetworkAccess - Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space. + AllowVirtualNetworkAccess *bool `json:"allowVirtualNetworkAccess,omitempty"` + // AllowForwardedTraffic - Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network. + AllowForwardedTraffic *bool `json:"allowForwardedTraffic,omitempty"` + // AllowGatewayTransit - If gateway links can be used in remote virtual networking to link to this virtual network. + AllowGatewayTransit *bool `json:"allowGatewayTransit,omitempty"` + // UseRemoteGateways - 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. + UseRemoteGateways *bool `json:"useRemoteGateways,omitempty"` + // RemoteVirtualNetwork - The reference to the remote virtual network. The remote virtual network can be in the same or different region (preview). See here to register for the preview and learn more (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + RemoteVirtualNetwork *SubResource `json:"remoteVirtualNetwork,omitempty"` + // RemoteAddressSpace - The reference to the address space peered with the remote virtual network. + RemoteAddressSpace *AddressSpace `json:"remoteAddressSpace,omitempty"` + // RemoteVirtualNetworkAddressSpace - The reference to the current address space of the remote virtual network. + RemoteVirtualNetworkAddressSpace *AddressSpace `json:"remoteVirtualNetworkAddressSpace,omitempty"` + // RemoteBgpCommunities - The reference to the remote virtual network's Bgp Communities. + RemoteBgpCommunities *VirtualNetworkBgpCommunities `json:"remoteBgpCommunities,omitempty"` + // RemoteVirtualNetworkEncryption - READ-ONLY; The reference to the remote virtual network's encryption + RemoteVirtualNetworkEncryption *VirtualNetworkEncryption `json:"remoteVirtualNetworkEncryption,omitempty"` + // PeeringState - The status of the virtual network peering. Possible values include: 'VirtualNetworkPeeringStateInitiated', 'VirtualNetworkPeeringStateConnected', 'VirtualNetworkPeeringStateDisconnected' + PeeringState VirtualNetworkPeeringState `json:"peeringState,omitempty"` + // PeeringSyncLevel - The peering sync status of the virtual network peering. Possible values include: 'VirtualNetworkPeeringLevelFullyInSync', 'VirtualNetworkPeeringLevelRemoteNotInSync', 'VirtualNetworkPeeringLevelLocalNotInSync', 'VirtualNetworkPeeringLevelLocalAndRemoteNotInSync' + PeeringSyncLevel VirtualNetworkPeeringLevel `json:"peeringSyncLevel,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network peering resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // DoNotVerifyRemoteGateways - If we need to verify the provisioning state of the remote gateway. + DoNotVerifyRemoteGateways *bool `json:"doNotVerifyRemoteGateways,omitempty"` + // ResourceGUID - READ-ONLY; The resourceGuid property of the Virtual Network peering resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkPeeringPropertiesFormat. +func (vnppf VirtualNetworkPeeringPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnppf.AllowVirtualNetworkAccess != nil { + objectMap["allowVirtualNetworkAccess"] = vnppf.AllowVirtualNetworkAccess + } + if vnppf.AllowForwardedTraffic != nil { + objectMap["allowForwardedTraffic"] = vnppf.AllowForwardedTraffic + } + if vnppf.AllowGatewayTransit != nil { + objectMap["allowGatewayTransit"] = vnppf.AllowGatewayTransit + } + if vnppf.UseRemoteGateways != nil { + objectMap["useRemoteGateways"] = vnppf.UseRemoteGateways + } + if vnppf.RemoteVirtualNetwork != nil { + objectMap["remoteVirtualNetwork"] = vnppf.RemoteVirtualNetwork + } + if vnppf.RemoteAddressSpace != nil { + objectMap["remoteAddressSpace"] = vnppf.RemoteAddressSpace + } + if vnppf.RemoteVirtualNetworkAddressSpace != nil { + objectMap["remoteVirtualNetworkAddressSpace"] = vnppf.RemoteVirtualNetworkAddressSpace + } + if vnppf.RemoteBgpCommunities != nil { + objectMap["remoteBgpCommunities"] = vnppf.RemoteBgpCommunities + } + if vnppf.PeeringState != "" { + objectMap["peeringState"] = vnppf.PeeringState + } + if vnppf.PeeringSyncLevel != "" { + objectMap["peeringSyncLevel"] = vnppf.PeeringSyncLevel + } + if vnppf.DoNotVerifyRemoteGateways != nil { + objectMap["doNotVerifyRemoteGateways"] = vnppf.DoNotVerifyRemoteGateways + } + return json.Marshal(objectMap) +} + +// VirtualNetworkPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkPeeringsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkPeeringsClient) (VirtualNetworkPeering, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkPeeringsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkPeeringsCreateOrUpdateFuture.Result. +func (future *VirtualNetworkPeeringsCreateOrUpdateFuture) result(client VirtualNetworkPeeringsClient) (vnp VirtualNetworkPeering, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vnp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkPeeringsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vnp.Response.Response, err = future.GetResult(sender); err == nil && vnp.Response.Response.StatusCode != http.StatusNoContent { + vnp, err = client.CreateOrUpdateResponder(vnp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsCreateOrUpdateFuture", "Result", vnp.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkPeeringsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkPeeringsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkPeeringsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkPeeringsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkPeeringsDeleteFuture.Result. +func (future *VirtualNetworkPeeringsDeleteFuture) result(client VirtualNetworkPeeringsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkPeeringsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkPropertiesFormat properties of the virtual network. +type VirtualNetworkPropertiesFormat struct { + // AddressSpace - The AddressSpace that contains an array of IP address ranges that can be used by subnets. + AddressSpace *AddressSpace `json:"addressSpace,omitempty"` + // DhcpOptions - The dhcpOptions that contains an array of DNS servers available to VMs deployed in the virtual network. + DhcpOptions *DhcpOptions `json:"dhcpOptions,omitempty"` + // FlowTimeoutInMinutes - The FlowTimeout value (in minutes) for the Virtual Network + FlowTimeoutInMinutes *int32 `json:"flowTimeoutInMinutes,omitempty"` + // Subnets - A list of subnets in a Virtual Network. + Subnets *[]Subnet `json:"subnets,omitempty"` + // VirtualNetworkPeerings - A list of peerings in a Virtual Network. + VirtualNetworkPeerings *[]VirtualNetworkPeering `json:"virtualNetworkPeerings,omitempty"` + // ResourceGUID - READ-ONLY; The resourceGuid property of the Virtual Network resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // EnableDdosProtection - 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. + EnableDdosProtection *bool `json:"enableDdosProtection,omitempty"` + // EnableVMProtection - Indicates if VM protection is enabled for all the subnets in the virtual network. + EnableVMProtection *bool `json:"enableVmProtection,omitempty"` + // DdosProtectionPlan - The DDoS protection plan associated with the virtual network. + DdosProtectionPlan *SubResource `json:"ddosProtectionPlan,omitempty"` + // BgpCommunities - Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET. + BgpCommunities *VirtualNetworkBgpCommunities `json:"bgpCommunities,omitempty"` + // Encryption - Indicates if encryption is enabled on virtual network and if VM without encryption is allowed in encrypted VNet. + Encryption *VirtualNetworkEncryption `json:"encryption,omitempty"` + // IPAllocations - Array of IpAllocation which reference this VNET. + IPAllocations *[]SubResource `json:"ipAllocations,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkPropertiesFormat. +func (vnpf VirtualNetworkPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnpf.AddressSpace != nil { + objectMap["addressSpace"] = vnpf.AddressSpace + } + if vnpf.DhcpOptions != nil { + objectMap["dhcpOptions"] = vnpf.DhcpOptions + } + if vnpf.FlowTimeoutInMinutes != nil { + objectMap["flowTimeoutInMinutes"] = vnpf.FlowTimeoutInMinutes + } + if vnpf.Subnets != nil { + objectMap["subnets"] = vnpf.Subnets + } + if vnpf.VirtualNetworkPeerings != nil { + objectMap["virtualNetworkPeerings"] = vnpf.VirtualNetworkPeerings + } + if vnpf.EnableDdosProtection != nil { + objectMap["enableDdosProtection"] = vnpf.EnableDdosProtection + } + if vnpf.EnableVMProtection != nil { + objectMap["enableVmProtection"] = vnpf.EnableVMProtection + } + if vnpf.DdosProtectionPlan != nil { + objectMap["ddosProtectionPlan"] = vnpf.DdosProtectionPlan + } + if vnpf.BgpCommunities != nil { + objectMap["bgpCommunities"] = vnpf.BgpCommunities + } + if vnpf.Encryption != nil { + objectMap["encryption"] = vnpf.Encryption + } + if vnpf.IPAllocations != nil { + objectMap["ipAllocations"] = vnpf.IPAllocations + } + return json.Marshal(objectMap) +} + +// VirtualNetworkTap virtual Network Tap resource. +type VirtualNetworkTap struct { + autorest.Response `json:"-"` + // VirtualNetworkTapPropertiesFormat - Virtual Network Tap Properties. + *VirtualNetworkTapPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkTap. +func (vnt VirtualNetworkTap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnt.VirtualNetworkTapPropertiesFormat != nil { + objectMap["properties"] = vnt.VirtualNetworkTapPropertiesFormat + } + if vnt.ID != nil { + objectMap["id"] = vnt.ID + } + if vnt.Location != nil { + objectMap["location"] = vnt.Location + } + if vnt.Tags != nil { + objectMap["tags"] = vnt.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkTap struct. +func (vnt *VirtualNetworkTap) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkTapPropertiesFormat VirtualNetworkTapPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkTapPropertiesFormat) + if err != nil { + return err + } + vnt.VirtualNetworkTapPropertiesFormat = &virtualNetworkTapPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vnt.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vnt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vnt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vnt.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vnt.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vnt.Tags = tags + } + } + } + + return nil +} + +// VirtualNetworkTapListResult response for ListVirtualNetworkTap API service call. +type VirtualNetworkTapListResult struct { + autorest.Response `json:"-"` + // Value - A list of VirtualNetworkTaps in a resource group. + Value *[]VirtualNetworkTap `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualNetworkTapListResultIterator provides access to a complete listing of VirtualNetworkTap values. +type VirtualNetworkTapListResultIterator struct { + i int + page VirtualNetworkTapListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkTapListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkTapListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkTapListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkTapListResultIterator) Response() VirtualNetworkTapListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkTapListResultIterator) Value() VirtualNetworkTap { + if !iter.page.NotDone() { + return VirtualNetworkTap{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkTapListResultIterator type. +func NewVirtualNetworkTapListResultIterator(page VirtualNetworkTapListResultPage) VirtualNetworkTapListResultIterator { + return VirtualNetworkTapListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vntlr VirtualNetworkTapListResult) IsEmpty() bool { + return vntlr.Value == nil || len(*vntlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vntlr VirtualNetworkTapListResult) hasNextLink() bool { + return vntlr.NextLink != nil && len(*vntlr.NextLink) != 0 +} + +// virtualNetworkTapListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vntlr VirtualNetworkTapListResult) virtualNetworkTapListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vntlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vntlr.NextLink))) +} + +// VirtualNetworkTapListResultPage contains a page of VirtualNetworkTap values. +type VirtualNetworkTapListResultPage struct { + fn func(context.Context, VirtualNetworkTapListResult) (VirtualNetworkTapListResult, error) + vntlr VirtualNetworkTapListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkTapListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vntlr) + if err != nil { + return err + } + page.vntlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkTapListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkTapListResultPage) NotDone() bool { + return !page.vntlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkTapListResultPage) Response() VirtualNetworkTapListResult { + return page.vntlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkTapListResultPage) Values() []VirtualNetworkTap { + if page.vntlr.IsEmpty() { + return nil + } + return *page.vntlr.Value +} + +// Creates a new instance of the VirtualNetworkTapListResultPage type. +func NewVirtualNetworkTapListResultPage(cur VirtualNetworkTapListResult, getNextPage func(context.Context, VirtualNetworkTapListResult) (VirtualNetworkTapListResult, error)) VirtualNetworkTapListResultPage { + return VirtualNetworkTapListResultPage{ + fn: getNextPage, + vntlr: cur, + } +} + +// VirtualNetworkTapPropertiesFormat virtual Network Tap properties. +type VirtualNetworkTapPropertiesFormat struct { + // NetworkInterfaceTapConfigurations - READ-ONLY; Specifies the list of resource IDs for the network interface IP configuration that needs to be tapped. + NetworkInterfaceTapConfigurations *[]InterfaceTapConfiguration `json:"networkInterfaceTapConfigurations,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the virtual network tap resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network tap resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // DestinationNetworkInterfaceIPConfiguration - The reference to the private IP Address of the collector nic that will receive the tap. + DestinationNetworkInterfaceIPConfiguration *InterfaceIPConfiguration `json:"destinationNetworkInterfaceIPConfiguration,omitempty"` + // DestinationLoadBalancerFrontEndIPConfiguration - The reference to the private IP address on the internal Load Balancer that will receive the tap. + DestinationLoadBalancerFrontEndIPConfiguration *FrontendIPConfiguration `json:"destinationLoadBalancerFrontEndIPConfiguration,omitempty"` + // DestinationPort - The VXLAN destination port that will receive the tapped traffic. + DestinationPort *int32 `json:"destinationPort,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkTapPropertiesFormat. +func (vntpf VirtualNetworkTapPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vntpf.DestinationNetworkInterfaceIPConfiguration != nil { + objectMap["destinationNetworkInterfaceIPConfiguration"] = vntpf.DestinationNetworkInterfaceIPConfiguration + } + if vntpf.DestinationLoadBalancerFrontEndIPConfiguration != nil { + objectMap["destinationLoadBalancerFrontEndIPConfiguration"] = vntpf.DestinationLoadBalancerFrontEndIPConfiguration + } + if vntpf.DestinationPort != nil { + objectMap["destinationPort"] = vntpf.DestinationPort + } + return json.Marshal(objectMap) +} + +// VirtualNetworkTapsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkTapsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkTapsClient) (VirtualNetworkTap, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkTapsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkTapsCreateOrUpdateFuture.Result. +func (future *VirtualNetworkTapsCreateOrUpdateFuture) result(client VirtualNetworkTapsClient) (vnt VirtualNetworkTap, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vnt.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkTapsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vnt.Response.Response, err = future.GetResult(sender); err == nil && vnt.Response.Response.StatusCode != http.StatusNoContent { + vnt, err = client.CreateOrUpdateResponder(vnt.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsCreateOrUpdateFuture", "Result", vnt.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkTapsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkTapsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkTapsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkTapsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkTapsDeleteFuture.Result. +func (future *VirtualNetworkTapsDeleteFuture) result(client VirtualNetworkTapsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkTapsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkUsage usage details for subnet. +type VirtualNetworkUsage struct { + // CurrentValue - READ-ONLY; Indicates number of IPs used from the Subnet. + CurrentValue *float64 `json:"currentValue,omitempty"` + // ID - READ-ONLY; Subnet identifier. + ID *string `json:"id,omitempty"` + // Limit - READ-ONLY; Indicates the size of the subnet. + Limit *float64 `json:"limit,omitempty"` + // Name - READ-ONLY; The name containing common and localized value for usage. + Name *VirtualNetworkUsageName `json:"name,omitempty"` + // Unit - READ-ONLY; Usage units. Returns 'Count'. + Unit *string `json:"unit,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkUsage. +func (vnu VirtualNetworkUsage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// VirtualNetworkUsageName usage strings container. +type VirtualNetworkUsageName struct { + // LocalizedValue - READ-ONLY; Localized subnet size and usage string. + LocalizedValue *string `json:"localizedValue,omitempty"` + // Value - READ-ONLY; Subnet size and usage string. + Value *string `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkUsageName. +func (vnun VirtualNetworkUsageName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// VirtualNetworksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworksCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworksClient) (VirtualNetwork, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworksCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworksCreateOrUpdateFuture.Result. +func (future *VirtualNetworksCreateOrUpdateFuture) result(client VirtualNetworksClient) (vn VirtualNetwork, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vn.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vn.Response.Response, err = future.GetResult(sender); err == nil && vn.Response.Response.StatusCode != http.StatusNoContent { + vn, err = client.CreateOrUpdateResponder(vn.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", vn.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualNetworksDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworksClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworksDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworksDeleteFuture.Result. +func (future *VirtualNetworksDeleteFuture) result(client VirtualNetworksClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworksListDdosProtectionStatusAllFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworksListDdosProtectionStatusAllFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworksClient) (VirtualNetworkDdosProtectionStatusResultPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworksListDdosProtectionStatusAllFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworksListDdosProtectionStatusAllFuture.Result. +func (future *VirtualNetworksListDdosProtectionStatusAllFuture) result(client VirtualNetworksClient) (vndpsrp VirtualNetworkDdosProtectionStatusResultPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksListDdosProtectionStatusAllFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vndpsrp.vndpsr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksListDdosProtectionStatusAllFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vndpsrp.vndpsr.Response.Response, err = future.GetResult(sender); err == nil && vndpsrp.vndpsr.Response.Response.StatusCode != http.StatusNoContent { + vndpsrp, err = client.ListDdosProtectionStatusResponder(vndpsrp.vndpsr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksListDdosProtectionStatusAllFuture", "Result", vndpsrp.vndpsr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworksListDdosProtectionStatusFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualNetworksListDdosProtectionStatusFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworksClient) (VirtualNetworkDdosProtectionStatusResultPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworksListDdosProtectionStatusFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworksListDdosProtectionStatusFuture.Result. +func (future *VirtualNetworksListDdosProtectionStatusFuture) result(client VirtualNetworksClient) (vndpsrp VirtualNetworkDdosProtectionStatusResultPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksListDdosProtectionStatusFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vndpsrp.vndpsr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksListDdosProtectionStatusFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vndpsrp.vndpsr.Response.Response, err = future.GetResult(sender); err == nil && vndpsrp.vndpsr.Response.Response.StatusCode != http.StatusNoContent { + vndpsrp, err = client.ListDdosProtectionStatusResponder(vndpsrp.vndpsr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksListDdosProtectionStatusFuture", "Result", vndpsrp.vndpsr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualRouter virtualRouter Resource. +type VirtualRouter struct { + autorest.Response `json:"-"` + // VirtualRouterPropertiesFormat - Properties of the Virtual Router. + *VirtualRouterPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualRouter. +func (vr VirtualRouter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vr.VirtualRouterPropertiesFormat != nil { + objectMap["properties"] = vr.VirtualRouterPropertiesFormat + } + if vr.ID != nil { + objectMap["id"] = vr.ID + } + if vr.Location != nil { + objectMap["location"] = vr.Location + } + if vr.Tags != nil { + objectMap["tags"] = vr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualRouter struct. +func (vr *VirtualRouter) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualRouterPropertiesFormat VirtualRouterPropertiesFormat + err = json.Unmarshal(*v, &virtualRouterPropertiesFormat) + if err != nil { + return err + } + vr.VirtualRouterPropertiesFormat = &virtualRouterPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vr.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vr.Tags = tags + } + } + } + + return nil +} + +// VirtualRouterAutoScaleConfiguration the VirtualHub Router autoscale configuration. +type VirtualRouterAutoScaleConfiguration struct { + // MinCapacity - The minimum number of scale units for VirtualHub Router. + MinCapacity *int32 `json:"minCapacity,omitempty"` +} + +// VirtualRouterListResult response for ListVirtualRouters API service call. +type VirtualRouterListResult struct { + autorest.Response `json:"-"` + // Value - List of Virtual Routers. + Value *[]VirtualRouter `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualRouterListResultIterator provides access to a complete listing of VirtualRouter values. +type VirtualRouterListResultIterator struct { + i int + page VirtualRouterListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualRouterListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualRouterListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualRouterListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualRouterListResultIterator) Response() VirtualRouterListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualRouterListResultIterator) Value() VirtualRouter { + if !iter.page.NotDone() { + return VirtualRouter{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualRouterListResultIterator type. +func NewVirtualRouterListResultIterator(page VirtualRouterListResultPage) VirtualRouterListResultIterator { + return VirtualRouterListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vrlr VirtualRouterListResult) IsEmpty() bool { + return vrlr.Value == nil || len(*vrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vrlr VirtualRouterListResult) hasNextLink() bool { + return vrlr.NextLink != nil && len(*vrlr.NextLink) != 0 +} + +// virtualRouterListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vrlr VirtualRouterListResult) virtualRouterListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vrlr.NextLink))) +} + +// VirtualRouterListResultPage contains a page of VirtualRouter values. +type VirtualRouterListResultPage struct { + fn func(context.Context, VirtualRouterListResult) (VirtualRouterListResult, error) + vrlr VirtualRouterListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualRouterListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vrlr) + if err != nil { + return err + } + page.vrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualRouterListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualRouterListResultPage) NotDone() bool { + return !page.vrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualRouterListResultPage) Response() VirtualRouterListResult { + return page.vrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualRouterListResultPage) Values() []VirtualRouter { + if page.vrlr.IsEmpty() { + return nil + } + return *page.vrlr.Value +} + +// Creates a new instance of the VirtualRouterListResultPage type. +func NewVirtualRouterListResultPage(cur VirtualRouterListResult, getNextPage func(context.Context, VirtualRouterListResult) (VirtualRouterListResult, error)) VirtualRouterListResultPage { + return VirtualRouterListResultPage{ + fn: getNextPage, + vrlr: cur, + } +} + +// VirtualRouterPeering virtual Router Peering resource. +type VirtualRouterPeering struct { + autorest.Response `json:"-"` + // VirtualRouterPeeringProperties - The properties of the Virtual Router Peering. + *VirtualRouterPeeringProperties `json:"properties,omitempty"` + // Name - Name of the virtual router peering that is unique within a virtual router. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Peering type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualRouterPeering. +func (vrp VirtualRouterPeering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vrp.VirtualRouterPeeringProperties != nil { + objectMap["properties"] = vrp.VirtualRouterPeeringProperties + } + if vrp.Name != nil { + objectMap["name"] = vrp.Name + } + if vrp.ID != nil { + objectMap["id"] = vrp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualRouterPeering struct. +func (vrp *VirtualRouterPeering) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualRouterPeeringProperties VirtualRouterPeeringProperties + err = json.Unmarshal(*v, &virtualRouterPeeringProperties) + if err != nil { + return err + } + vrp.VirtualRouterPeeringProperties = &virtualRouterPeeringProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vrp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vrp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vrp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vrp.ID = &ID + } + } + } + + return nil +} + +// VirtualRouterPeeringListResult response for ListVirtualRouterPeerings API service call. +type VirtualRouterPeeringListResult struct { + autorest.Response `json:"-"` + // Value - List of VirtualRouterPeerings in a VirtualRouter. + Value *[]VirtualRouterPeering `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualRouterPeeringListResultIterator provides access to a complete listing of VirtualRouterPeering +// values. +type VirtualRouterPeeringListResultIterator struct { + i int + page VirtualRouterPeeringListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualRouterPeeringListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterPeeringListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualRouterPeeringListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualRouterPeeringListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualRouterPeeringListResultIterator) Response() VirtualRouterPeeringListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualRouterPeeringListResultIterator) Value() VirtualRouterPeering { + if !iter.page.NotDone() { + return VirtualRouterPeering{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualRouterPeeringListResultIterator type. +func NewVirtualRouterPeeringListResultIterator(page VirtualRouterPeeringListResultPage) VirtualRouterPeeringListResultIterator { + return VirtualRouterPeeringListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vrplr VirtualRouterPeeringListResult) IsEmpty() bool { + return vrplr.Value == nil || len(*vrplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vrplr VirtualRouterPeeringListResult) hasNextLink() bool { + return vrplr.NextLink != nil && len(*vrplr.NextLink) != 0 +} + +// virtualRouterPeeringListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vrplr VirtualRouterPeeringListResult) virtualRouterPeeringListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vrplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vrplr.NextLink))) +} + +// VirtualRouterPeeringListResultPage contains a page of VirtualRouterPeering values. +type VirtualRouterPeeringListResultPage struct { + fn func(context.Context, VirtualRouterPeeringListResult) (VirtualRouterPeeringListResult, error) + vrplr VirtualRouterPeeringListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualRouterPeeringListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterPeeringListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vrplr) + if err != nil { + return err + } + page.vrplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualRouterPeeringListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualRouterPeeringListResultPage) NotDone() bool { + return !page.vrplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualRouterPeeringListResultPage) Response() VirtualRouterPeeringListResult { + return page.vrplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualRouterPeeringListResultPage) Values() []VirtualRouterPeering { + if page.vrplr.IsEmpty() { + return nil + } + return *page.vrplr.Value +} + +// Creates a new instance of the VirtualRouterPeeringListResultPage type. +func NewVirtualRouterPeeringListResultPage(cur VirtualRouterPeeringListResult, getNextPage func(context.Context, VirtualRouterPeeringListResult) (VirtualRouterPeeringListResult, error)) VirtualRouterPeeringListResultPage { + return VirtualRouterPeeringListResultPage{ + fn: getNextPage, + vrplr: cur, + } +} + +// VirtualRouterPeeringProperties properties of the rule group. +type VirtualRouterPeeringProperties struct { + // PeerAsn - Peer ASN. + PeerAsn *int64 `json:"peerAsn,omitempty"` + // PeerIP - Peer IP. + PeerIP *string `json:"peerIp,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualRouterPeeringProperties. +func (vrpp VirtualRouterPeeringProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vrpp.PeerAsn != nil { + objectMap["peerAsn"] = vrpp.PeerAsn + } + if vrpp.PeerIP != nil { + objectMap["peerIp"] = vrpp.PeerIP + } + return json.Marshal(objectMap) +} + +// VirtualRouterPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualRouterPeeringsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualRouterPeeringsClient) (VirtualRouterPeering, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualRouterPeeringsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualRouterPeeringsCreateOrUpdateFuture.Result. +func (future *VirtualRouterPeeringsCreateOrUpdateFuture) result(client VirtualRouterPeeringsClient) (vrp VirtualRouterPeering, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vrp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualRouterPeeringsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vrp.Response.Response, err = future.GetResult(sender); err == nil && vrp.Response.Response.StatusCode != http.StatusNoContent { + vrp, err = client.CreateOrUpdateResponder(vrp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsCreateOrUpdateFuture", "Result", vrp.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualRouterPeeringsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualRouterPeeringsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualRouterPeeringsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualRouterPeeringsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualRouterPeeringsDeleteFuture.Result. +func (future *VirtualRouterPeeringsDeleteFuture) result(client VirtualRouterPeeringsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualRouterPeeringsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualRouterPropertiesFormat virtual Router definition. +type VirtualRouterPropertiesFormat struct { + // VirtualRouterAsn - VirtualRouter ASN. + VirtualRouterAsn *int64 `json:"virtualRouterAsn,omitempty"` + // VirtualRouterIps - VirtualRouter IPs. + VirtualRouterIps *[]string `json:"virtualRouterIps,omitempty"` + // HostedSubnet - The Subnet on which VirtualRouter is hosted. + HostedSubnet *SubResource `json:"hostedSubnet,omitempty"` + // HostedGateway - The Gateway on which VirtualRouter is hosted. + HostedGateway *SubResource `json:"hostedGateway,omitempty"` + // Peerings - READ-ONLY; List of references to VirtualRouterPeerings. + Peerings *[]SubResource `json:"peerings,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualRouterPropertiesFormat. +func (vrpf VirtualRouterPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vrpf.VirtualRouterAsn != nil { + objectMap["virtualRouterAsn"] = vrpf.VirtualRouterAsn + } + if vrpf.VirtualRouterIps != nil { + objectMap["virtualRouterIps"] = vrpf.VirtualRouterIps + } + if vrpf.HostedSubnet != nil { + objectMap["hostedSubnet"] = vrpf.HostedSubnet + } + if vrpf.HostedGateway != nil { + objectMap["hostedGateway"] = vrpf.HostedGateway + } + return json.Marshal(objectMap) +} + +// VirtualRoutersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualRoutersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualRoutersClient) (VirtualRouter, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualRoutersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualRoutersCreateOrUpdateFuture.Result. +func (future *VirtualRoutersCreateOrUpdateFuture) result(client VirtualRoutersClient) (vr VirtualRouter, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualRoutersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vr.Response.Response, err = future.GetResult(sender); err == nil && vr.Response.Response.StatusCode != http.StatusNoContent { + vr, err = client.CreateOrUpdateResponder(vr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersCreateOrUpdateFuture", "Result", vr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualRoutersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualRoutersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualRoutersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualRoutersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualRoutersDeleteFuture.Result. +func (future *VirtualRoutersDeleteFuture) result(client VirtualRoutersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualRoutersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualWAN virtualWAN Resource. +type VirtualWAN struct { + autorest.Response `json:"-"` + // VirtualWanProperties - Properties of the virtual WAN. + *VirtualWanProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualWAN. +func (vw VirtualWAN) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vw.VirtualWanProperties != nil { + objectMap["properties"] = vw.VirtualWanProperties + } + if vw.ID != nil { + objectMap["id"] = vw.ID + } + if vw.Location != nil { + objectMap["location"] = vw.Location + } + if vw.Tags != nil { + objectMap["tags"] = vw.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualWAN struct. +func (vw *VirtualWAN) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualWanProperties VirtualWanProperties + err = json.Unmarshal(*v, &virtualWanProperties) + if err != nil { + return err + } + vw.VirtualWanProperties = &virtualWanProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vw.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vw.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vw.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vw.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vw.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vw.Tags = tags + } + } + } + + return nil +} + +// VirtualWanProperties parameters for VirtualWAN. +type VirtualWanProperties struct { + // DisableVpnEncryption - Vpn encryption to be disabled or not. + DisableVpnEncryption *bool `json:"disableVpnEncryption,omitempty"` + // VirtualHubs - READ-ONLY; List of VirtualHubs in the VirtualWAN. + VirtualHubs *[]SubResource `json:"virtualHubs,omitempty"` + // VpnSites - READ-ONLY; List of VpnSites in the VirtualWAN. + VpnSites *[]SubResource `json:"vpnSites,omitempty"` + // AllowBranchToBranchTraffic - True if branch to branch traffic is allowed. + AllowBranchToBranchTraffic *bool `json:"allowBranchToBranchTraffic,omitempty"` + // AllowVnetToVnetTraffic - True if Vnet to Vnet traffic is allowed. + AllowVnetToVnetTraffic *bool `json:"allowVnetToVnetTraffic,omitempty"` + // Office365LocalBreakoutCategory - The office local breakout category. Possible values include: 'OfficeTrafficCategoryOptimize', 'OfficeTrafficCategoryOptimizeAndAllow', 'OfficeTrafficCategoryAll', 'OfficeTrafficCategoryNone' + Office365LocalBreakoutCategory OfficeTrafficCategory `json:"office365LocalBreakoutCategory,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual WAN resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Type - The type of the VirtualWAN. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualWanProperties. +func (vwp VirtualWanProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vwp.DisableVpnEncryption != nil { + objectMap["disableVpnEncryption"] = vwp.DisableVpnEncryption + } + if vwp.AllowBranchToBranchTraffic != nil { + objectMap["allowBranchToBranchTraffic"] = vwp.AllowBranchToBranchTraffic + } + if vwp.AllowVnetToVnetTraffic != nil { + objectMap["allowVnetToVnetTraffic"] = vwp.AllowVnetToVnetTraffic + } + if vwp.Office365LocalBreakoutCategory != "" { + objectMap["office365LocalBreakoutCategory"] = vwp.Office365LocalBreakoutCategory + } + if vwp.Type != nil { + objectMap["type"] = vwp.Type + } + return json.Marshal(objectMap) +} + +// VirtualWanSecurityProvider collection of SecurityProviders. +type VirtualWanSecurityProvider struct { + // Name - Name of the security provider. + Name *string `json:"name,omitempty"` + // URL - Url of the security provider. + URL *string `json:"url,omitempty"` + // Type - Name of the security provider. Possible values include: 'VirtualWanSecurityProviderTypeExternal', 'VirtualWanSecurityProviderTypeNative' + Type VirtualWanSecurityProviderType `json:"type,omitempty"` +} + +// VirtualWanSecurityProviders collection of SecurityProviders. +type VirtualWanSecurityProviders struct { + autorest.Response `json:"-"` + // SupportedProviders - List of VirtualWAN security providers. + SupportedProviders *[]VirtualWanSecurityProvider `json:"supportedProviders,omitempty"` +} + +// VirtualWanVpnProfileParameters virtual Wan Vpn profile parameters Vpn profile generation. +type VirtualWanVpnProfileParameters struct { + // VpnServerConfigurationResourceID - VpnServerConfiguration partial resource uri with which VirtualWan is associated to. + VpnServerConfigurationResourceID *string `json:"vpnServerConfigurationResourceId,omitempty"` + // AuthenticationMethod - VPN client authentication method. Possible values include: 'AuthenticationMethodEAPTLS', 'AuthenticationMethodEAPMSCHAPv2' + AuthenticationMethod AuthenticationMethod `json:"authenticationMethod,omitempty"` +} + +// VirtualWansCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualWansCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualWansClient) (VirtualWAN, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualWansCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualWansCreateOrUpdateFuture.Result. +func (future *VirtualWansCreateOrUpdateFuture) result(client VirtualWansClient) (vw VirtualWAN, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vw.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualWansCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vw.Response.Response, err = future.GetResult(sender); err == nil && vw.Response.Response.StatusCode != http.StatusNoContent { + vw, err = client.CreateOrUpdateResponder(vw.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansCreateOrUpdateFuture", "Result", vw.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualWansDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualWansDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualWansClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualWansDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualWansDeleteFuture.Result. +func (future *VirtualWansDeleteFuture) result(client VirtualWansClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualWansDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VnetRoute list of routes that control routing from VirtualHub into a virtual network connection. +type VnetRoute struct { + // StaticRoutesConfig - Configuration for static routes on this HubVnetConnection. + StaticRoutesConfig *StaticRoutesConfig `json:"staticRoutesConfig,omitempty"` + // StaticRoutes - List of all Static Routes. + StaticRoutes *[]StaticRoute `json:"staticRoutes,omitempty"` + // BgpConnections - READ-ONLY; The list of references to HubBgpConnection objects. + BgpConnections *[]SubResource `json:"bgpConnections,omitempty"` +} + +// MarshalJSON is the custom marshaler for VnetRoute. +func (vr VnetRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vr.StaticRoutesConfig != nil { + objectMap["staticRoutesConfig"] = vr.StaticRoutesConfig + } + if vr.StaticRoutes != nil { + objectMap["staticRoutes"] = vr.StaticRoutes + } + return json.Marshal(objectMap) +} + +// VngClientConnectionConfiguration a vpn client connection configuration for client connection +// configuration. +type VngClientConnectionConfiguration struct { + // VngClientConnectionConfigurationProperties - Properties of the vpn client root certificate. + *VngClientConnectionConfigurationProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VngClientConnectionConfiguration. +func (vccc VngClientConnectionConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vccc.VngClientConnectionConfigurationProperties != nil { + objectMap["properties"] = vccc.VngClientConnectionConfigurationProperties + } + if vccc.Name != nil { + objectMap["name"] = vccc.Name + } + if vccc.ID != nil { + objectMap["id"] = vccc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VngClientConnectionConfiguration struct. +func (vccc *VngClientConnectionConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vngClientConnectionConfigurationProperties VngClientConnectionConfigurationProperties + err = json.Unmarshal(*v, &vngClientConnectionConfigurationProperties) + if err != nil { + return err + } + vccc.VngClientConnectionConfigurationProperties = &vngClientConnectionConfigurationProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vccc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vccc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vccc.ID = &ID + } + } + } + + return nil +} + +// VngClientConnectionConfigurationProperties properties of VngClientConnectionConfiguration. +type VngClientConnectionConfigurationProperties struct { + // VpnClientAddressPool - The reference to the address space resource which represents Address space for P2S VpnClient. + VpnClientAddressPool *AddressSpace `json:"vpnClientAddressPool,omitempty"` + // VirtualNetworkGatewayPolicyGroups - List of references to virtualNetworkGatewayPolicyGroups + VirtualNetworkGatewayPolicyGroups *[]SubResource `json:"virtualNetworkGatewayPolicyGroups,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VngClientConnectionConfiguration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VngClientConnectionConfigurationProperties. +func (vcccp VngClientConnectionConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vcccp.VpnClientAddressPool != nil { + objectMap["vpnClientAddressPool"] = vcccp.VpnClientAddressPool + } + if vcccp.VirtualNetworkGatewayPolicyGroups != nil { + objectMap["virtualNetworkGatewayPolicyGroups"] = vcccp.VirtualNetworkGatewayPolicyGroups + } + return json.Marshal(objectMap) +} + +// VpnClientConfiguration vpnClientConfiguration for P2S client. +type VpnClientConfiguration struct { + // VpnClientAddressPool - The reference to the address space resource which represents Address space for P2S VpnClient. + VpnClientAddressPool *AddressSpace `json:"vpnClientAddressPool,omitempty"` + // VpnClientRootCertificates - VpnClientRootCertificate for virtual network gateway. + VpnClientRootCertificates *[]VpnClientRootCertificate `json:"vpnClientRootCertificates,omitempty"` + // VpnClientRevokedCertificates - VpnClientRevokedCertificate for Virtual network gateway. + VpnClientRevokedCertificates *[]VpnClientRevokedCertificate `json:"vpnClientRevokedCertificates,omitempty"` + // VpnClientProtocols - VpnClientProtocols for Virtual network gateway. + VpnClientProtocols *[]VpnClientProtocol `json:"vpnClientProtocols,omitempty"` + // VpnAuthenticationTypes - VPN authentication types for the virtual network gateway.. + VpnAuthenticationTypes *[]VpnAuthenticationType `json:"vpnAuthenticationTypes,omitempty"` + // VpnClientIpsecPolicies - VpnClientIpsecPolicies for virtual network gateway P2S client. + VpnClientIpsecPolicies *[]IpsecPolicy `json:"vpnClientIpsecPolicies,omitempty"` + // RadiusServerAddress - The radius server address property of the VirtualNetworkGateway resource for vpn client connection. + RadiusServerAddress *string `json:"radiusServerAddress,omitempty"` + // RadiusServerSecret - The radius secret property of the VirtualNetworkGateway resource for vpn client connection. + RadiusServerSecret *string `json:"radiusServerSecret,omitempty"` + // RadiusServers - The radiusServers property for multiple radius server configuration. + RadiusServers *[]RadiusServer `json:"radiusServers,omitempty"` + // AadTenant - The AADTenant property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. + AadTenant *string `json:"aadTenant,omitempty"` + // AadAudience - The AADAudience property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. + AadAudience *string `json:"aadAudience,omitempty"` + // AadIssuer - The AADIssuer property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. + AadIssuer *string `json:"aadIssuer,omitempty"` + // VngClientConnectionConfigurations - per ip address pool connection policy for virtual network gateway P2S client. + VngClientConnectionConfigurations *[]VngClientConnectionConfiguration `json:"vngClientConnectionConfigurations,omitempty"` +} + +// VpnClientConnectionHealth vpnClientConnectionHealth properties. +type VpnClientConnectionHealth struct { + // TotalIngressBytesTransferred - READ-ONLY; Total of the Ingress Bytes Transferred in this P2S Vpn connection. + TotalIngressBytesTransferred *int64 `json:"totalIngressBytesTransferred,omitempty"` + // TotalEgressBytesTransferred - READ-ONLY; Total of the Egress Bytes Transferred in this connection. + TotalEgressBytesTransferred *int64 `json:"totalEgressBytesTransferred,omitempty"` + // VpnClientConnectionsCount - The total of p2s vpn clients connected at this time to this P2SVpnGateway. + VpnClientConnectionsCount *int32 `json:"vpnClientConnectionsCount,omitempty"` + // AllocatedIPAddresses - List of allocated ip addresses to the connected p2s vpn clients. + AllocatedIPAddresses *[]string `json:"allocatedIpAddresses,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnClientConnectionHealth. +func (vcch VpnClientConnectionHealth) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vcch.VpnClientConnectionsCount != nil { + objectMap["vpnClientConnectionsCount"] = vcch.VpnClientConnectionsCount + } + if vcch.AllocatedIPAddresses != nil { + objectMap["allocatedIpAddresses"] = vcch.AllocatedIPAddresses + } + return json.Marshal(objectMap) +} + +// VpnClientConnectionHealthDetail VPN client connection health detail. +type VpnClientConnectionHealthDetail struct { + // VpnConnectionID - READ-ONLY; The vpn client Id. + VpnConnectionID *string `json:"vpnConnectionId,omitempty"` + // VpnConnectionDuration - READ-ONLY; The duration time of a connected vpn client. + VpnConnectionDuration *int64 `json:"vpnConnectionDuration,omitempty"` + // VpnConnectionTime - READ-ONLY; The start time of a connected vpn client. + VpnConnectionTime *string `json:"vpnConnectionTime,omitempty"` + // PublicIPAddress - READ-ONLY; The public Ip of a connected vpn client. + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + // PrivateIPAddress - READ-ONLY; The assigned private Ip of a connected vpn client. + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` + // VpnUserName - READ-ONLY; The user name of a connected vpn client. + VpnUserName *string `json:"vpnUserName,omitempty"` + // MaxBandwidth - READ-ONLY; The max band width. + MaxBandwidth *int64 `json:"maxBandwidth,omitempty"` + // EgressPacketsTransferred - READ-ONLY; The egress packets per second. + EgressPacketsTransferred *int64 `json:"egressPacketsTransferred,omitempty"` + // EgressBytesTransferred - READ-ONLY; The egress bytes per second. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` + // IngressPacketsTransferred - READ-ONLY; The ingress packets per second. + IngressPacketsTransferred *int64 `json:"ingressPacketsTransferred,omitempty"` + // IngressBytesTransferred - READ-ONLY; The ingress bytes per second. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` + // MaxPacketsPerSecond - READ-ONLY; The max packets transferred per second. + MaxPacketsPerSecond *int64 `json:"maxPacketsPerSecond,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnClientConnectionHealthDetail. +func (vcchd VpnClientConnectionHealthDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// VpnClientConnectionHealthDetailListResult list of virtual network gateway vpn client connection health. +type VpnClientConnectionHealthDetailListResult struct { + autorest.Response `json:"-"` + // Value - List of vpn client connection health. + Value *[]VpnClientConnectionHealthDetail `json:"value,omitempty"` +} + +// VpnClientIPsecParameters an IPSec parameters for a virtual network gateway P2S connection. +type VpnClientIPsecParameters struct { + autorest.Response `json:"-"` + // SaLifeTimeSeconds - The IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for P2S client. + SaLifeTimeSeconds *int32 `json:"saLifeTimeSeconds,omitempty"` + // SaDataSizeKilobytes - The IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB for P2S client.. + SaDataSizeKilobytes *int32 `json:"saDataSizeKilobytes,omitempty"` + // IpsecEncryption - The IPSec encryption algorithm (IKE phase 1). Possible values include: 'IpsecEncryptionNone', 'IpsecEncryptionDES', 'IpsecEncryptionDES3', 'IpsecEncryptionAES128', 'IpsecEncryptionAES192', 'IpsecEncryptionAES256', 'IpsecEncryptionGCMAES128', 'IpsecEncryptionGCMAES192', 'IpsecEncryptionGCMAES256' + IpsecEncryption IpsecEncryption `json:"ipsecEncryption,omitempty"` + // IpsecIntegrity - The IPSec integrity algorithm (IKE phase 1). Possible values include: 'IpsecIntegrityMD5', 'IpsecIntegritySHA1', 'IpsecIntegritySHA256', 'IpsecIntegrityGCMAES128', 'IpsecIntegrityGCMAES192', 'IpsecIntegrityGCMAES256' + IpsecIntegrity IpsecIntegrity `json:"ipsecIntegrity,omitempty"` + // IkeEncryption - The IKE encryption algorithm (IKE phase 2). Possible values include: 'IkeEncryptionDES', 'IkeEncryptionDES3', 'IkeEncryptionAES128', 'IkeEncryptionAES192', 'IkeEncryptionAES256', 'IkeEncryptionGCMAES256', 'IkeEncryptionGCMAES128' + IkeEncryption IkeEncryption `json:"ikeEncryption,omitempty"` + // IkeIntegrity - The IKE integrity algorithm (IKE phase 2). Possible values include: 'IkeIntegrityMD5', 'IkeIntegritySHA1', 'IkeIntegritySHA256', 'IkeIntegritySHA384', 'IkeIntegrityGCMAES256', 'IkeIntegrityGCMAES128' + IkeIntegrity IkeIntegrity `json:"ikeIntegrity,omitempty"` + // DhGroup - The DH Group used in IKE Phase 1 for initial SA. Possible values include: 'DhGroupNone', 'DhGroupDHGroup1', 'DhGroupDHGroup2', 'DhGroupDHGroup14', 'DhGroupDHGroup2048', 'DhGroupECP256', 'DhGroupECP384', 'DhGroupDHGroup24' + DhGroup DhGroup `json:"dhGroup,omitempty"` + // PfsGroup - The Pfs Group used in IKE Phase 2 for new child SA. Possible values include: 'PfsGroupNone', 'PfsGroupPFS1', 'PfsGroupPFS2', 'PfsGroupPFS2048', 'PfsGroupECP256', 'PfsGroupECP384', 'PfsGroupPFS24', 'PfsGroupPFS14', 'PfsGroupPFSMM' + PfsGroup PfsGroup `json:"pfsGroup,omitempty"` +} + +// VpnClientParameters vpn Client Parameters for package generation. +type VpnClientParameters struct { + // ProcessorArchitecture - VPN client Processor Architecture. Possible values include: 'ProcessorArchitectureAmd64', 'ProcessorArchitectureX86' + ProcessorArchitecture ProcessorArchitecture `json:"processorArchitecture,omitempty"` + // AuthenticationMethod - VPN client authentication method. Possible values include: 'AuthenticationMethodEAPTLS', 'AuthenticationMethodEAPMSCHAPv2' + AuthenticationMethod AuthenticationMethod `json:"authenticationMethod,omitempty"` + // RadiusServerAuthCertificate - 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. + RadiusServerAuthCertificate *string `json:"radiusServerAuthCertificate,omitempty"` + // ClientRootCertificates - A list of client root certificates public certificate data encoded as Base-64 strings. Optional parameter for external radius based authentication with EAPTLS. + ClientRootCertificates *[]string `json:"clientRootCertificates,omitempty"` +} + +// VpnClientRevokedCertificate VPN client revoked certificate of virtual network gateway. +type VpnClientRevokedCertificate struct { + // VpnClientRevokedCertificatePropertiesFormat - Properties of the vpn client revoked certificate. + *VpnClientRevokedCertificatePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnClientRevokedCertificate. +func (vcrc VpnClientRevokedCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vcrc.VpnClientRevokedCertificatePropertiesFormat != nil { + objectMap["properties"] = vcrc.VpnClientRevokedCertificatePropertiesFormat + } + if vcrc.Name != nil { + objectMap["name"] = vcrc.Name + } + if vcrc.ID != nil { + objectMap["id"] = vcrc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnClientRevokedCertificate struct. +func (vcrc *VpnClientRevokedCertificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnClientRevokedCertificatePropertiesFormat VpnClientRevokedCertificatePropertiesFormat + err = json.Unmarshal(*v, &vpnClientRevokedCertificatePropertiesFormat) + if err != nil { + return err + } + vcrc.VpnClientRevokedCertificatePropertiesFormat = &vpnClientRevokedCertificatePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vcrc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vcrc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vcrc.ID = &ID + } + } + } + + return nil +} + +// VpnClientRevokedCertificatePropertiesFormat properties of the revoked VPN client certificate of virtual +// network gateway. +type VpnClientRevokedCertificatePropertiesFormat struct { + // Thumbprint - The revoked VPN client certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VPN client revoked certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnClientRevokedCertificatePropertiesFormat. +func (vcrcpf VpnClientRevokedCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vcrcpf.Thumbprint != nil { + objectMap["thumbprint"] = vcrcpf.Thumbprint + } + return json.Marshal(objectMap) +} + +// VpnClientRootCertificate VPN client root certificate of virtual network gateway. +type VpnClientRootCertificate struct { + // VpnClientRootCertificatePropertiesFormat - Properties of the vpn client root certificate. + *VpnClientRootCertificatePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnClientRootCertificate. +func (vcrc VpnClientRootCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vcrc.VpnClientRootCertificatePropertiesFormat != nil { + objectMap["properties"] = vcrc.VpnClientRootCertificatePropertiesFormat + } + if vcrc.Name != nil { + objectMap["name"] = vcrc.Name + } + if vcrc.ID != nil { + objectMap["id"] = vcrc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnClientRootCertificate struct. +func (vcrc *VpnClientRootCertificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnClientRootCertificatePropertiesFormat VpnClientRootCertificatePropertiesFormat + err = json.Unmarshal(*v, &vpnClientRootCertificatePropertiesFormat) + if err != nil { + return err + } + vcrc.VpnClientRootCertificatePropertiesFormat = &vpnClientRootCertificatePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vcrc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vcrc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vcrc.ID = &ID + } + } + } + + return nil +} + +// VpnClientRootCertificatePropertiesFormat properties of SSL certificates of application gateway. +type VpnClientRootCertificatePropertiesFormat struct { + // PublicCertData - The certificate public data. + PublicCertData *string `json:"publicCertData,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VPN client root certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnClientRootCertificatePropertiesFormat. +func (vcrcpf VpnClientRootCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vcrcpf.PublicCertData != nil { + objectMap["publicCertData"] = vcrcpf.PublicCertData + } + return json.Marshal(objectMap) +} + +// VpnConnection vpnConnection Resource. +type VpnConnection struct { + autorest.Response `json:"-"` + // VpnConnectionProperties - Properties of the VPN connection. + *VpnConnectionProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnConnection. +func (vc VpnConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vc.VpnConnectionProperties != nil { + objectMap["properties"] = vc.VpnConnectionProperties + } + if vc.Name != nil { + objectMap["name"] = vc.Name + } + if vc.ID != nil { + objectMap["id"] = vc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnConnection struct. +func (vc *VpnConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnConnectionProperties VpnConnectionProperties + err = json.Unmarshal(*v, &vpnConnectionProperties) + if err != nil { + return err + } + vc.VpnConnectionProperties = &vpnConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vc.ID = &ID + } + } + } + + return nil +} + +// VpnConnectionPacketCaptureStartParameters vpn Connection packet capture parameters supplied to start +// packet capture on gateway connection. +type VpnConnectionPacketCaptureStartParameters struct { + // FilterData - Start Packet capture parameters on vpn connection. + FilterData *string `json:"filterData,omitempty"` + // LinkConnectionNames - List of site link connection names. + LinkConnectionNames *[]string `json:"linkConnectionNames,omitempty"` +} + +// VpnConnectionPacketCaptureStopParameters vpn Connection packet capture parameters supplied to stop +// packet capture on gateway connection. +type VpnConnectionPacketCaptureStopParameters struct { + // SasURL - SAS url for packet capture on vpn connection. + SasURL *string `json:"sasUrl,omitempty"` + // LinkConnectionNames - List of site link connection names. + LinkConnectionNames *[]string `json:"linkConnectionNames,omitempty"` +} + +// VpnConnectionProperties parameters for VpnConnection. +type VpnConnectionProperties struct { + // RemoteVpnSite - Id of the connected vpn site. + RemoteVpnSite *SubResource `json:"remoteVpnSite,omitempty"` + // RoutingWeight - Routing weight for vpn connection. + RoutingWeight *int32 `json:"routingWeight,omitempty"` + // DpdTimeoutSeconds - DPD timeout in seconds for vpn connection. + DpdTimeoutSeconds *int32 `json:"dpdTimeoutSeconds,omitempty"` + // ConnectionStatus - The connection status. Possible values include: 'VpnConnectionStatusUnknown', 'VpnConnectionStatusConnecting', 'VpnConnectionStatusConnected', 'VpnConnectionStatusNotConnected' + ConnectionStatus VpnConnectionStatus `json:"connectionStatus,omitempty"` + // VpnConnectionProtocolType - Connection protocol used for this connection. Possible values include: 'VirtualNetworkGatewayConnectionProtocolIKEv2', 'VirtualNetworkGatewayConnectionProtocolIKEv1' + VpnConnectionProtocolType VirtualNetworkGatewayConnectionProtocol `json:"vpnConnectionProtocolType,omitempty"` + // IngressBytesTransferred - READ-ONLY; Ingress bytes transferred. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` + // EgressBytesTransferred - READ-ONLY; Egress bytes transferred. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` + // ConnectionBandwidth - Expected bandwidth in MBPS. + ConnectionBandwidth *int32 `json:"connectionBandwidth,omitempty"` + // SharedKey - SharedKey for the vpn connection. + SharedKey *string `json:"sharedKey,omitempty"` + // EnableBgp - EnableBgp flag. + EnableBgp *bool `json:"enableBgp,omitempty"` + // UsePolicyBasedTrafficSelectors - Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` + // IpsecPolicies - The IPSec Policies to be considered by this connection. + IpsecPolicies *[]IpsecPolicy `json:"ipsecPolicies,omitempty"` + // TrafficSelectorPolicies - The Traffic Selector Policies to be considered by this connection. + TrafficSelectorPolicies *[]TrafficSelectorPolicy `json:"trafficSelectorPolicies,omitempty"` + // EnableRateLimiting - EnableBgp flag. + EnableRateLimiting *bool `json:"enableRateLimiting,omitempty"` + // EnableInternetSecurity - Enable internet security. + EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` + // UseLocalAzureIPAddress - Use local azure ip to initiate connection. + UseLocalAzureIPAddress *bool `json:"useLocalAzureIpAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VPN connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // VpnLinkConnections - List of all vpn site link connections to the gateway. + VpnLinkConnections *[]VpnSiteLinkConnection `json:"vpnLinkConnections,omitempty"` + // RoutingConfiguration - The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnConnectionProperties. +func (vcp VpnConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vcp.RemoteVpnSite != nil { + objectMap["remoteVpnSite"] = vcp.RemoteVpnSite + } + if vcp.RoutingWeight != nil { + objectMap["routingWeight"] = vcp.RoutingWeight + } + if vcp.DpdTimeoutSeconds != nil { + objectMap["dpdTimeoutSeconds"] = vcp.DpdTimeoutSeconds + } + if vcp.ConnectionStatus != "" { + objectMap["connectionStatus"] = vcp.ConnectionStatus + } + if vcp.VpnConnectionProtocolType != "" { + objectMap["vpnConnectionProtocolType"] = vcp.VpnConnectionProtocolType + } + if vcp.ConnectionBandwidth != nil { + objectMap["connectionBandwidth"] = vcp.ConnectionBandwidth + } + if vcp.SharedKey != nil { + objectMap["sharedKey"] = vcp.SharedKey + } + if vcp.EnableBgp != nil { + objectMap["enableBgp"] = vcp.EnableBgp + } + if vcp.UsePolicyBasedTrafficSelectors != nil { + objectMap["usePolicyBasedTrafficSelectors"] = vcp.UsePolicyBasedTrafficSelectors + } + if vcp.IpsecPolicies != nil { + objectMap["ipsecPolicies"] = vcp.IpsecPolicies + } + if vcp.TrafficSelectorPolicies != nil { + objectMap["trafficSelectorPolicies"] = vcp.TrafficSelectorPolicies + } + if vcp.EnableRateLimiting != nil { + objectMap["enableRateLimiting"] = vcp.EnableRateLimiting + } + if vcp.EnableInternetSecurity != nil { + objectMap["enableInternetSecurity"] = vcp.EnableInternetSecurity + } + if vcp.UseLocalAzureIPAddress != nil { + objectMap["useLocalAzureIpAddress"] = vcp.UseLocalAzureIPAddress + } + if vcp.VpnLinkConnections != nil { + objectMap["vpnLinkConnections"] = vcp.VpnLinkConnections + } + if vcp.RoutingConfiguration != nil { + objectMap["routingConfiguration"] = vcp.RoutingConfiguration + } + return json.Marshal(objectMap) +} + +// VpnConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnConnectionsClient) (VpnConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnConnectionsCreateOrUpdateFuture.Result. +func (future *VpnConnectionsCreateOrUpdateFuture) result(client VpnConnectionsClient) (vc VpnConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vc.Response.Response, err = future.GetResult(sender); err == nil && vc.Response.Response.StatusCode != http.StatusNoContent { + vc, err = client.CreateOrUpdateResponder(vc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsCreateOrUpdateFuture", "Result", vc.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VpnConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnConnectionsDeleteFuture.Result. +func (future *VpnConnectionsDeleteFuture) result(client VpnConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VpnConnectionsStartPacketCaptureFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnConnectionsStartPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnConnectionsClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnConnectionsStartPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnConnectionsStartPacketCaptureFuture.Result. +func (future *VpnConnectionsStartPacketCaptureFuture) result(client VpnConnectionsClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsStartPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnConnectionsStartPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StartPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsStartPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnConnectionsStopPacketCaptureFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnConnectionsStopPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnConnectionsClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnConnectionsStopPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnConnectionsStopPacketCaptureFuture.Result. +func (future *VpnConnectionsStopPacketCaptureFuture) result(client VpnConnectionsClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsStopPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnConnectionsStopPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StopPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsStopPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnDeviceScriptParameters vpn device configuration script generation parameters. +type VpnDeviceScriptParameters struct { + // Vendor - The vendor for the vpn device. + Vendor *string `json:"vendor,omitempty"` + // DeviceFamily - The device family for the vpn device. + DeviceFamily *string `json:"deviceFamily,omitempty"` + // FirmwareVersion - The firmware version for the vpn device. + FirmwareVersion *string `json:"firmwareVersion,omitempty"` +} + +// VpnGateway vpnGateway Resource. +type VpnGateway struct { + autorest.Response `json:"-"` + // VpnGatewayProperties - Properties of the VPN gateway. + *VpnGatewayProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VpnGateway. +func (vg VpnGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vg.VpnGatewayProperties != nil { + objectMap["properties"] = vg.VpnGatewayProperties + } + if vg.ID != nil { + objectMap["id"] = vg.ID + } + if vg.Location != nil { + objectMap["location"] = vg.Location + } + if vg.Tags != nil { + objectMap["tags"] = vg.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnGateway struct. +func (vg *VpnGateway) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnGatewayProperties VpnGatewayProperties + err = json.Unmarshal(*v, &vpnGatewayProperties) + if err != nil { + return err + } + vg.VpnGatewayProperties = &vpnGatewayProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vg.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vg.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vg.Tags = tags + } + } + } + + return nil +} + +// VpnGatewayIPConfiguration IP Configuration of a VPN Gateway Resource. +type VpnGatewayIPConfiguration struct { + // ID - The identifier of the IP configuration for a VPN Gateway. + ID *string `json:"id,omitempty"` + // PublicIPAddress - The public IP address of this IP configuration. + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + // PrivateIPAddress - The private IP address of this IP configuration. + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` +} + +// VpnGatewayNatRule vpnGatewayNatRule Resource. +type VpnGatewayNatRule struct { + autorest.Response `json:"-"` + // VpnGatewayNatRuleProperties - Properties of the VpnGateway NAT rule. + *VpnGatewayNatRuleProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnGatewayNatRule. +func (vgnr VpnGatewayNatRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vgnr.VpnGatewayNatRuleProperties != nil { + objectMap["properties"] = vgnr.VpnGatewayNatRuleProperties + } + if vgnr.Name != nil { + objectMap["name"] = vgnr.Name + } + if vgnr.ID != nil { + objectMap["id"] = vgnr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnGatewayNatRule struct. +func (vgnr *VpnGatewayNatRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnGatewayNatRuleProperties VpnGatewayNatRuleProperties + err = json.Unmarshal(*v, &vpnGatewayNatRuleProperties) + if err != nil { + return err + } + vgnr.VpnGatewayNatRuleProperties = &vpnGatewayNatRuleProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vgnr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vgnr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vgnr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vgnr.ID = &ID + } + } + } + + return nil +} + +// VpnGatewayNatRuleProperties parameters for VpnGatewayNatRule. +type VpnGatewayNatRuleProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the NAT Rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Type - The type of NAT rule for VPN NAT. Possible values include: 'VpnNatRuleTypeStatic', 'VpnNatRuleTypeDynamic' + Type VpnNatRuleType `json:"type,omitempty"` + // Mode - The Source NAT direction of a VPN NAT. Possible values include: 'VpnNatRuleModeEgressSnat', 'VpnNatRuleModeIngressSnat' + Mode VpnNatRuleMode `json:"mode,omitempty"` + // InternalMappings - The private IP address internal mapping for NAT. + InternalMappings *[]VpnNatRuleMapping `json:"internalMappings,omitempty"` + // ExternalMappings - The private IP address external mapping for NAT. + ExternalMappings *[]VpnNatRuleMapping `json:"externalMappings,omitempty"` + // IPConfigurationID - The IP Configuration ID this NAT rule applies to. + IPConfigurationID *string `json:"ipConfigurationId,omitempty"` + // EgressVpnSiteLinkConnections - READ-ONLY; List of egress VpnSiteLinkConnections. + EgressVpnSiteLinkConnections *[]SubResource `json:"egressVpnSiteLinkConnections,omitempty"` + // IngressVpnSiteLinkConnections - READ-ONLY; List of ingress VpnSiteLinkConnections. + IngressVpnSiteLinkConnections *[]SubResource `json:"ingressVpnSiteLinkConnections,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnGatewayNatRuleProperties. +func (vgnrp VpnGatewayNatRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vgnrp.Type != "" { + objectMap["type"] = vgnrp.Type + } + if vgnrp.Mode != "" { + objectMap["mode"] = vgnrp.Mode + } + if vgnrp.InternalMappings != nil { + objectMap["internalMappings"] = vgnrp.InternalMappings + } + if vgnrp.ExternalMappings != nil { + objectMap["externalMappings"] = vgnrp.ExternalMappings + } + if vgnrp.IPConfigurationID != nil { + objectMap["ipConfigurationId"] = vgnrp.IPConfigurationID + } + return json.Marshal(objectMap) +} + +// VpnGatewayPacketCaptureStartParameters start packet capture parameters. +type VpnGatewayPacketCaptureStartParameters struct { + // FilterData - Start Packet capture parameters on vpn gateway. + FilterData *string `json:"filterData,omitempty"` +} + +// VpnGatewayPacketCaptureStopParameters stop packet capture parameters. +type VpnGatewayPacketCaptureStopParameters struct { + // SasURL - SAS url for packet capture on vpn gateway. + SasURL *string `json:"sasUrl,omitempty"` +} + +// VpnGatewayProperties parameters for VpnGateway. +type VpnGatewayProperties struct { + // VirtualHub - The VirtualHub to which the gateway belongs. + VirtualHub *SubResource `json:"virtualHub,omitempty"` + // Connections - List of all vpn connections to the gateway. + Connections *[]VpnConnection `json:"connections,omitempty"` + // BgpSettings - Local network gateway's BGP speaker settings. + BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VPN gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // VpnGatewayScaleUnit - The scale unit for this vpn gateway. + VpnGatewayScaleUnit *int32 `json:"vpnGatewayScaleUnit,omitempty"` + // IPConfigurations - READ-ONLY; List of all IPs configured on the gateway. + IPConfigurations *[]VpnGatewayIPConfiguration `json:"ipConfigurations,omitempty"` + // EnableBgpRouteTranslationForNat - Enable BGP routes translation for NAT on this VpnGateway. + EnableBgpRouteTranslationForNat *bool `json:"enableBgpRouteTranslationForNat,omitempty"` + // IsRoutingPreferenceInternet - Enable Routing Preference property for the Public IP Interface of the VpnGateway. + IsRoutingPreferenceInternet *bool `json:"isRoutingPreferenceInternet,omitempty"` + // NatRules - List of all the nat Rules associated with the gateway. + NatRules *[]VpnGatewayNatRule `json:"natRules,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnGatewayProperties. +func (vgp VpnGatewayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vgp.VirtualHub != nil { + objectMap["virtualHub"] = vgp.VirtualHub + } + if vgp.Connections != nil { + objectMap["connections"] = vgp.Connections + } + if vgp.BgpSettings != nil { + objectMap["bgpSettings"] = vgp.BgpSettings + } + if vgp.VpnGatewayScaleUnit != nil { + objectMap["vpnGatewayScaleUnit"] = vgp.VpnGatewayScaleUnit + } + if vgp.EnableBgpRouteTranslationForNat != nil { + objectMap["enableBgpRouteTranslationForNat"] = vgp.EnableBgpRouteTranslationForNat + } + if vgp.IsRoutingPreferenceInternet != nil { + objectMap["isRoutingPreferenceInternet"] = vgp.IsRoutingPreferenceInternet + } + if vgp.NatRules != nil { + objectMap["natRules"] = vgp.NatRules + } + return json.Marshal(objectMap) +} + +// VpnGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnGatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnGatewaysClient) (VpnGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnGatewaysCreateOrUpdateFuture.Result. +func (future *VpnGatewaysCreateOrUpdateFuture) result(client VpnGatewaysClient) (vg VpnGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vg.Response.Response, err = future.GetResult(sender); err == nil && vg.Response.Response.StatusCode != http.StatusNoContent { + vg, err = client.CreateOrUpdateResponder(vg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysCreateOrUpdateFuture", "Result", vg.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VpnGatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnGatewaysDeleteFuture.Result. +func (future *VpnGatewaysDeleteFuture) result(client VpnGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VpnGatewaysResetFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VpnGatewaysResetFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnGatewaysClient) (VpnGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnGatewaysResetFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnGatewaysResetFuture.Result. +func (future *VpnGatewaysResetFuture) result(client VpnGatewaysClient) (vg VpnGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysResetFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysResetFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vg.Response.Response, err = future.GetResult(sender); err == nil && vg.Response.Response.StatusCode != http.StatusNoContent { + vg, err = client.ResetResponder(vg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysResetFuture", "Result", vg.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnGatewaysStartPacketCaptureFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnGatewaysStartPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnGatewaysClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnGatewaysStartPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnGatewaysStartPacketCaptureFuture.Result. +func (future *VpnGatewaysStartPacketCaptureFuture) result(client VpnGatewaysClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysStartPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysStartPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StartPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysStartPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnGatewaysStopPacketCaptureFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnGatewaysStopPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnGatewaysClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnGatewaysStopPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnGatewaysStopPacketCaptureFuture.Result. +func (future *VpnGatewaysStopPacketCaptureFuture) result(client VpnGatewaysClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysStopPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysStopPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StopPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysStopPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnGatewaysUpdateTagsFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VpnGatewaysUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnGatewaysClient) (VpnGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnGatewaysUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnGatewaysUpdateTagsFuture.Result. +func (future *VpnGatewaysUpdateTagsFuture) result(client VpnGatewaysClient) (vg VpnGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vg.Response.Response, err = future.GetResult(sender); err == nil && vg.Response.Response.StatusCode != http.StatusNoContent { + vg, err = client.UpdateTagsResponder(vg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysUpdateTagsFuture", "Result", vg.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnLinkBgpSettings BGP settings details for a link. +type VpnLinkBgpSettings struct { + // Asn - The BGP speaker's ASN. + Asn *int64 `json:"asn,omitempty"` + // BgpPeeringAddress - The BGP peering address and BGP identifier of this BGP speaker. + BgpPeeringAddress *string `json:"bgpPeeringAddress,omitempty"` +} + +// VpnLinkConnectionsGetIkeSasFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnLinkConnectionsGetIkeSasFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnLinkConnectionsClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnLinkConnectionsGetIkeSasFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnLinkConnectionsGetIkeSasFuture.Result. +func (future *VpnLinkConnectionsGetIkeSasFuture) result(client VpnLinkConnectionsClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsGetIkeSasFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnLinkConnectionsGetIkeSasFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.GetIkeSasResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsGetIkeSasFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnLinkConnectionsResetConnectionFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnLinkConnectionsResetConnectionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnLinkConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnLinkConnectionsResetConnectionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnLinkConnectionsResetConnectionFuture.Result. +func (future *VpnLinkConnectionsResetConnectionFuture) result(client VpnLinkConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsResetConnectionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnLinkConnectionsResetConnectionFuture") + return + } + ar.Response = future.Response() + return +} + +// VpnLinkProviderProperties list of properties of a link provider. +type VpnLinkProviderProperties struct { + // LinkProviderName - Name of the link provider. + LinkProviderName *string `json:"linkProviderName,omitempty"` + // LinkSpeedInMbps - Link speed. + LinkSpeedInMbps *int32 `json:"linkSpeedInMbps,omitempty"` +} + +// VpnNatRuleMapping vpn NatRule mapping. +type VpnNatRuleMapping struct { + // AddressSpace - Address space for Vpn NatRule mapping. + AddressSpace *string `json:"addressSpace,omitempty"` + // PortRange - Port range for Vpn NatRule mapping. + PortRange *string `json:"portRange,omitempty"` +} + +// VpnPacketCaptureStartParameters start packet capture parameters on virtual network gateway. +type VpnPacketCaptureStartParameters struct { + // FilterData - Start Packet capture parameters. + FilterData *string `json:"filterData,omitempty"` +} + +// VpnPacketCaptureStopParameters stop packet capture parameters. +type VpnPacketCaptureStopParameters struct { + // SasURL - SAS url for packet capture on virtual network gateway. + SasURL *string `json:"sasUrl,omitempty"` +} + +// VpnProfileResponse vpn Profile Response for package generation. +type VpnProfileResponse struct { + autorest.Response `json:"-"` + // ProfileURL - URL to the VPN profile. + ProfileURL *string `json:"profileUrl,omitempty"` +} + +// VpnServerConfigRadiusClientRootCertificate properties of the Radius client root certificate of +// VpnServerConfiguration. +type VpnServerConfigRadiusClientRootCertificate struct { + // Name - The certificate name. + Name *string `json:"name,omitempty"` + // Thumbprint - The Radius client root certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` +} + +// VpnServerConfigRadiusServerRootCertificate properties of Radius Server root certificate of +// VpnServerConfiguration. +type VpnServerConfigRadiusServerRootCertificate struct { + // Name - The certificate name. + Name *string `json:"name,omitempty"` + // PublicCertData - The certificate public data. + PublicCertData *string `json:"publicCertData,omitempty"` +} + +// VpnServerConfigVpnClientRevokedCertificate properties of the revoked VPN client certificate of +// VpnServerConfiguration. +type VpnServerConfigVpnClientRevokedCertificate struct { + // Name - The certificate name. + Name *string `json:"name,omitempty"` + // Thumbprint - The revoked VPN client certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` +} + +// VpnServerConfigVpnClientRootCertificate properties of VPN client root certificate of +// VpnServerConfiguration. +type VpnServerConfigVpnClientRootCertificate struct { + // Name - The certificate name. + Name *string `json:"name,omitempty"` + // PublicCertData - The certificate public data. + PublicCertData *string `json:"publicCertData,omitempty"` +} + +// VpnServerConfiguration vpnServerConfiguration Resource. +type VpnServerConfiguration struct { + autorest.Response `json:"-"` + // VpnServerConfigurationProperties - Properties of the P2SVpnServer configuration. + *VpnServerConfigurationProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VpnServerConfiguration. +func (vsc VpnServerConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vsc.VpnServerConfigurationProperties != nil { + objectMap["properties"] = vsc.VpnServerConfigurationProperties + } + if vsc.ID != nil { + objectMap["id"] = vsc.ID + } + if vsc.Location != nil { + objectMap["location"] = vsc.Location + } + if vsc.Tags != nil { + objectMap["tags"] = vsc.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnServerConfiguration struct. +func (vsc *VpnServerConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnServerConfigurationProperties VpnServerConfigurationProperties + err = json.Unmarshal(*v, &vpnServerConfigurationProperties) + if err != nil { + return err + } + vsc.VpnServerConfigurationProperties = &vpnServerConfigurationProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vsc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vsc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vsc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vsc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vsc.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vsc.Tags = tags + } + } + } + + return nil +} + +// VpnServerConfigurationPolicyGroup vpnServerConfigurationPolicyGroup Resource. +type VpnServerConfigurationPolicyGroup struct { + autorest.Response `json:"-"` + // VpnServerConfigurationPolicyGroupProperties - Properties of the VpnServerConfigurationPolicyGroup. + *VpnServerConfigurationPolicyGroupProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnServerConfigurationPolicyGroup. +func (vscpg VpnServerConfigurationPolicyGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vscpg.VpnServerConfigurationPolicyGroupProperties != nil { + objectMap["properties"] = vscpg.VpnServerConfigurationPolicyGroupProperties + } + if vscpg.Name != nil { + objectMap["name"] = vscpg.Name + } + if vscpg.ID != nil { + objectMap["id"] = vscpg.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnServerConfigurationPolicyGroup struct. +func (vscpg *VpnServerConfigurationPolicyGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnServerConfigurationPolicyGroupProperties VpnServerConfigurationPolicyGroupProperties + err = json.Unmarshal(*v, &vpnServerConfigurationPolicyGroupProperties) + if err != nil { + return err + } + vscpg.VpnServerConfigurationPolicyGroupProperties = &vpnServerConfigurationPolicyGroupProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vscpg.Etag = &etag + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vscpg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vscpg.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vscpg.ID = &ID + } + } + } + + return nil +} + +// VpnServerConfigurationPolicyGroupMember vpnServerConfiguration PolicyGroup member +type VpnServerConfigurationPolicyGroupMember struct { + // Name - Name of the VpnServerConfigurationPolicyGroupMember. + Name *string `json:"name,omitempty"` + // AttributeType - The Vpn Policy member attribute type. Possible values include: 'VpnPolicyMemberAttributeTypeCertificateGroupID', 'VpnPolicyMemberAttributeTypeAADGroupID', 'VpnPolicyMemberAttributeTypeRadiusAzureGroupID' + AttributeType VpnPolicyMemberAttributeType `json:"attributeType,omitempty"` + // AttributeValue - The value of Attribute used for this VpnServerConfigurationPolicyGroupMember. + AttributeValue *string `json:"attributeValue,omitempty"` +} + +// VpnServerConfigurationPolicyGroupProperties parameters for VpnServerConfigurationPolicyGroup. +type VpnServerConfigurationPolicyGroupProperties struct { + // IsDefault - Shows if this is a Default VpnServerConfigurationPolicyGroup or not. + IsDefault *bool `json:"isDefault,omitempty"` + // Priority - Priority for VpnServerConfigurationPolicyGroup. + Priority *int32 `json:"priority,omitempty"` + // PolicyMembers - Multiple PolicyMembers for VpnServerConfigurationPolicyGroup. + PolicyMembers *[]VpnServerConfigurationPolicyGroupMember `json:"policyMembers,omitempty"` + // P2SConnectionConfigurations - READ-ONLY; List of references to P2SConnectionConfigurations. + P2SConnectionConfigurations *[]SubResource `json:"p2SConnectionConfigurations,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VpnServerConfigurationPolicyGroup resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnServerConfigurationPolicyGroupProperties. +func (vscpgp VpnServerConfigurationPolicyGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vscpgp.IsDefault != nil { + objectMap["isDefault"] = vscpgp.IsDefault + } + if vscpgp.Priority != nil { + objectMap["priority"] = vscpgp.Priority + } + if vscpgp.PolicyMembers != nil { + objectMap["policyMembers"] = vscpgp.PolicyMembers + } + return json.Marshal(objectMap) +} + +// VpnServerConfigurationProperties parameters for VpnServerConfiguration. +type VpnServerConfigurationProperties struct { + // Name - The name of the VpnServerConfiguration that is unique within a resource group. + Name *string `json:"name,omitempty"` + // VpnProtocols - VPN protocols for the VpnServerConfiguration. + VpnProtocols *[]VpnGatewayTunnelingProtocol `json:"vpnProtocols,omitempty"` + // VpnAuthenticationTypes - VPN authentication types for the VpnServerConfiguration. + VpnAuthenticationTypes *[]VpnAuthenticationType `json:"vpnAuthenticationTypes,omitempty"` + // VpnClientRootCertificates - VPN client root certificate of VpnServerConfiguration. + VpnClientRootCertificates *[]VpnServerConfigVpnClientRootCertificate `json:"vpnClientRootCertificates,omitempty"` + // VpnClientRevokedCertificates - VPN client revoked certificate of VpnServerConfiguration. + VpnClientRevokedCertificates *[]VpnServerConfigVpnClientRevokedCertificate `json:"vpnClientRevokedCertificates,omitempty"` + // RadiusServerRootCertificates - Radius Server root certificate of VpnServerConfiguration. + RadiusServerRootCertificates *[]VpnServerConfigRadiusServerRootCertificate `json:"radiusServerRootCertificates,omitempty"` + // RadiusClientRootCertificates - Radius client root certificate of VpnServerConfiguration. + RadiusClientRootCertificates *[]VpnServerConfigRadiusClientRootCertificate `json:"radiusClientRootCertificates,omitempty"` + // VpnClientIpsecPolicies - VpnClientIpsecPolicies for VpnServerConfiguration. + VpnClientIpsecPolicies *[]IpsecPolicy `json:"vpnClientIpsecPolicies,omitempty"` + // RadiusServerAddress - The radius server address property of the VpnServerConfiguration resource for point to site client connection. + RadiusServerAddress *string `json:"radiusServerAddress,omitempty"` + // RadiusServerSecret - The radius secret property of the VpnServerConfiguration resource for point to site client connection. + RadiusServerSecret *string `json:"radiusServerSecret,omitempty"` + // RadiusServers - Multiple Radius Server configuration for VpnServerConfiguration. + RadiusServers *[]RadiusServer `json:"radiusServers,omitempty"` + // AadAuthenticationParameters - The set of aad vpn authentication parameters. + AadAuthenticationParameters *AadAuthenticationParameters `json:"aadAuthenticationParameters,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VpnServerConfiguration resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + ProvisioningState *string `json:"provisioningState,omitempty"` + // P2SVpnGateways - READ-ONLY; List of references to P2SVpnGateways. + P2SVpnGateways *[]P2SVpnGateway `json:"p2SVpnGateways,omitempty"` + // ConfigurationPolicyGroups - List of all VpnServerConfigurationPolicyGroups. + ConfigurationPolicyGroups *[]VpnServerConfigurationPolicyGroup `json:"configurationPolicyGroups,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnServerConfigurationProperties. +func (vscp VpnServerConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vscp.Name != nil { + objectMap["name"] = vscp.Name + } + if vscp.VpnProtocols != nil { + objectMap["vpnProtocols"] = vscp.VpnProtocols + } + if vscp.VpnAuthenticationTypes != nil { + objectMap["vpnAuthenticationTypes"] = vscp.VpnAuthenticationTypes + } + if vscp.VpnClientRootCertificates != nil { + objectMap["vpnClientRootCertificates"] = vscp.VpnClientRootCertificates + } + if vscp.VpnClientRevokedCertificates != nil { + objectMap["vpnClientRevokedCertificates"] = vscp.VpnClientRevokedCertificates + } + if vscp.RadiusServerRootCertificates != nil { + objectMap["radiusServerRootCertificates"] = vscp.RadiusServerRootCertificates + } + if vscp.RadiusClientRootCertificates != nil { + objectMap["radiusClientRootCertificates"] = vscp.RadiusClientRootCertificates + } + if vscp.VpnClientIpsecPolicies != nil { + objectMap["vpnClientIpsecPolicies"] = vscp.VpnClientIpsecPolicies + } + if vscp.RadiusServerAddress != nil { + objectMap["radiusServerAddress"] = vscp.RadiusServerAddress + } + if vscp.RadiusServerSecret != nil { + objectMap["radiusServerSecret"] = vscp.RadiusServerSecret + } + if vscp.RadiusServers != nil { + objectMap["radiusServers"] = vscp.RadiusServers + } + if vscp.AadAuthenticationParameters != nil { + objectMap["aadAuthenticationParameters"] = vscp.AadAuthenticationParameters + } + if vscp.ConfigurationPolicyGroups != nil { + objectMap["configurationPolicyGroups"] = vscp.ConfigurationPolicyGroups + } + return json.Marshal(objectMap) +} + +// VpnServerConfigurationsAssociatedWithVirtualWanListFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type VpnServerConfigurationsAssociatedWithVirtualWanListFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnServerConfigurationsAssociatedWithVirtualWanClient) (VpnServerConfigurationsResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnServerConfigurationsAssociatedWithVirtualWanListFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnServerConfigurationsAssociatedWithVirtualWanListFuture.Result. +func (future *VpnServerConfigurationsAssociatedWithVirtualWanListFuture) result(client VpnServerConfigurationsAssociatedWithVirtualWanClient) (vscr VpnServerConfigurationsResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsAssociatedWithVirtualWanListFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vscr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnServerConfigurationsAssociatedWithVirtualWanListFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vscr.Response.Response, err = future.GetResult(sender); err == nil && vscr.Response.Response.StatusCode != http.StatusNoContent { + vscr, err = client.ListResponder(vscr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsAssociatedWithVirtualWanListFuture", "Result", vscr.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnServerConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VpnServerConfigurationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnServerConfigurationsClient) (VpnServerConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnServerConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnServerConfigurationsCreateOrUpdateFuture.Result. +func (future *VpnServerConfigurationsCreateOrUpdateFuture) result(client VpnServerConfigurationsClient) (vsc VpnServerConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vsc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnServerConfigurationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vsc.Response.Response, err = future.GetResult(sender); err == nil && vsc.Response.Response.StatusCode != http.StatusNoContent { + vsc, err = client.CreateOrUpdateResponder(vsc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsCreateOrUpdateFuture", "Result", vsc.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnServerConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnServerConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnServerConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnServerConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnServerConfigurationsDeleteFuture.Result. +func (future *VpnServerConfigurationsDeleteFuture) result(client VpnServerConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnServerConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VpnServerConfigurationsResponse vpnServerConfigurations list associated with VirtualWan Response. +type VpnServerConfigurationsResponse struct { + autorest.Response `json:"-"` + // VpnServerConfigurationResourceIds - List of VpnServerConfigurations associated with VirtualWan. + VpnServerConfigurationResourceIds *[]string `json:"vpnServerConfigurationResourceIds,omitempty"` +} + +// VpnSite vpnSite Resource. +type VpnSite struct { + autorest.Response `json:"-"` + // VpnSiteProperties - Properties of the VPN site. + *VpnSiteProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VpnSite. +func (vs VpnSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vs.VpnSiteProperties != nil { + objectMap["properties"] = vs.VpnSiteProperties + } + if vs.ID != nil { + objectMap["id"] = vs.ID + } + if vs.Location != nil { + objectMap["location"] = vs.Location + } + if vs.Tags != nil { + objectMap["tags"] = vs.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnSite struct. +func (vs *VpnSite) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnSiteProperties VpnSiteProperties + err = json.Unmarshal(*v, &vpnSiteProperties) + if err != nil { + return err + } + vs.VpnSiteProperties = &vpnSiteProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vs.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vs.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vs.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vs.Tags = tags + } + } + } + + return nil +} + +// VpnSiteID vpnSite Resource. +type VpnSiteID struct { + // VpnSite - READ-ONLY; The resource-uri of the vpn-site for which config is to be fetched. + VpnSite *string `json:"vpnSite,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnSiteID. +func (vsi VpnSiteID) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// VpnSiteLink vpnSiteLink Resource. +type VpnSiteLink struct { + autorest.Response `json:"-"` + // VpnSiteLinkProperties - Properties of the VPN site link. + *VpnSiteLinkProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnSiteLink. +func (vsl VpnSiteLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vsl.VpnSiteLinkProperties != nil { + objectMap["properties"] = vsl.VpnSiteLinkProperties + } + if vsl.Name != nil { + objectMap["name"] = vsl.Name + } + if vsl.ID != nil { + objectMap["id"] = vsl.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnSiteLink struct. +func (vsl *VpnSiteLink) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnSiteLinkProperties VpnSiteLinkProperties + err = json.Unmarshal(*v, &vpnSiteLinkProperties) + if err != nil { + return err + } + vsl.VpnSiteLinkProperties = &vpnSiteLinkProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vsl.Etag = &etag + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vsl.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vsl.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vsl.ID = &ID + } + } + } + + return nil +} + +// VpnSiteLinkConnection vpnSiteLinkConnection Resource. +type VpnSiteLinkConnection struct { + autorest.Response `json:"-"` + // VpnSiteLinkConnectionProperties - Properties of the VPN site link connection. + *VpnSiteLinkConnectionProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnSiteLinkConnection. +func (vslc VpnSiteLinkConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vslc.VpnSiteLinkConnectionProperties != nil { + objectMap["properties"] = vslc.VpnSiteLinkConnectionProperties + } + if vslc.Name != nil { + objectMap["name"] = vslc.Name + } + if vslc.ID != nil { + objectMap["id"] = vslc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnSiteLinkConnection struct. +func (vslc *VpnSiteLinkConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnSiteLinkConnectionProperties VpnSiteLinkConnectionProperties + err = json.Unmarshal(*v, &vpnSiteLinkConnectionProperties) + if err != nil { + return err + } + vslc.VpnSiteLinkConnectionProperties = &vpnSiteLinkConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vslc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vslc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vslc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vslc.ID = &ID + } + } + } + + return nil +} + +// VpnSiteLinkConnectionProperties parameters for VpnConnection. +type VpnSiteLinkConnectionProperties struct { + // VpnSiteLink - Id of the connected vpn site link. + VpnSiteLink *SubResource `json:"vpnSiteLink,omitempty"` + // RoutingWeight - Routing weight for vpn connection. + RoutingWeight *int32 `json:"routingWeight,omitempty"` + // VpnLinkConnectionMode - Vpn link connection mode. Possible values include: 'VpnLinkConnectionModeDefault', 'VpnLinkConnectionModeResponderOnly', 'VpnLinkConnectionModeInitiatorOnly' + VpnLinkConnectionMode VpnLinkConnectionMode `json:"vpnLinkConnectionMode,omitempty"` + // ConnectionStatus - The connection status. Possible values include: 'VpnConnectionStatusUnknown', 'VpnConnectionStatusConnecting', 'VpnConnectionStatusConnected', 'VpnConnectionStatusNotConnected' + ConnectionStatus VpnConnectionStatus `json:"connectionStatus,omitempty"` + // VpnConnectionProtocolType - Connection protocol used for this connection. Possible values include: 'VirtualNetworkGatewayConnectionProtocolIKEv2', 'VirtualNetworkGatewayConnectionProtocolIKEv1' + VpnConnectionProtocolType VirtualNetworkGatewayConnectionProtocol `json:"vpnConnectionProtocolType,omitempty"` + // IngressBytesTransferred - READ-ONLY; Ingress bytes transferred. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` + // EgressBytesTransferred - READ-ONLY; Egress bytes transferred. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` + // ConnectionBandwidth - Expected bandwidth in MBPS. + ConnectionBandwidth *int32 `json:"connectionBandwidth,omitempty"` + // SharedKey - SharedKey for the vpn connection. + SharedKey *string `json:"sharedKey,omitempty"` + // EnableBgp - EnableBgp flag. + EnableBgp *bool `json:"enableBgp,omitempty"` + // VpnGatewayCustomBgpAddresses - vpnGatewayCustomBgpAddresses used by this connection. + VpnGatewayCustomBgpAddresses *[]GatewayCustomBgpIPAddressIPConfiguration `json:"vpnGatewayCustomBgpAddresses,omitempty"` + // UsePolicyBasedTrafficSelectors - Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` + // IpsecPolicies - The IPSec Policies to be considered by this connection. + IpsecPolicies *[]IpsecPolicy `json:"ipsecPolicies,omitempty"` + // EnableRateLimiting - EnableBgp flag. + EnableRateLimiting *bool `json:"enableRateLimiting,omitempty"` + // UseLocalAzureIPAddress - Use local azure ip to initiate connection. + UseLocalAzureIPAddress *bool `json:"useLocalAzureIpAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VPN site link connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // IngressNatRules - List of ingress NatRules. + IngressNatRules *[]SubResource `json:"ingressNatRules,omitempty"` + // EgressNatRules - List of egress NatRules. + EgressNatRules *[]SubResource `json:"egressNatRules,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnSiteLinkConnectionProperties. +func (vslcp VpnSiteLinkConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vslcp.VpnSiteLink != nil { + objectMap["vpnSiteLink"] = vslcp.VpnSiteLink + } + if vslcp.RoutingWeight != nil { + objectMap["routingWeight"] = vslcp.RoutingWeight + } + if vslcp.VpnLinkConnectionMode != "" { + objectMap["vpnLinkConnectionMode"] = vslcp.VpnLinkConnectionMode + } + if vslcp.ConnectionStatus != "" { + objectMap["connectionStatus"] = vslcp.ConnectionStatus + } + if vslcp.VpnConnectionProtocolType != "" { + objectMap["vpnConnectionProtocolType"] = vslcp.VpnConnectionProtocolType + } + if vslcp.ConnectionBandwidth != nil { + objectMap["connectionBandwidth"] = vslcp.ConnectionBandwidth + } + if vslcp.SharedKey != nil { + objectMap["sharedKey"] = vslcp.SharedKey + } + if vslcp.EnableBgp != nil { + objectMap["enableBgp"] = vslcp.EnableBgp + } + if vslcp.VpnGatewayCustomBgpAddresses != nil { + objectMap["vpnGatewayCustomBgpAddresses"] = vslcp.VpnGatewayCustomBgpAddresses + } + if vslcp.UsePolicyBasedTrafficSelectors != nil { + objectMap["usePolicyBasedTrafficSelectors"] = vslcp.UsePolicyBasedTrafficSelectors + } + if vslcp.IpsecPolicies != nil { + objectMap["ipsecPolicies"] = vslcp.IpsecPolicies + } + if vslcp.EnableRateLimiting != nil { + objectMap["enableRateLimiting"] = vslcp.EnableRateLimiting + } + if vslcp.UseLocalAzureIPAddress != nil { + objectMap["useLocalAzureIpAddress"] = vslcp.UseLocalAzureIPAddress + } + if vslcp.IngressNatRules != nil { + objectMap["ingressNatRules"] = vslcp.IngressNatRules + } + if vslcp.EgressNatRules != nil { + objectMap["egressNatRules"] = vslcp.EgressNatRules + } + return json.Marshal(objectMap) +} + +// VpnSiteLinkProperties parameters for VpnSite. +type VpnSiteLinkProperties struct { + // LinkProperties - The link provider properties. + LinkProperties *VpnLinkProviderProperties `json:"linkProperties,omitempty"` + // IPAddress - The ip-address for the vpn-site-link. + IPAddress *string `json:"ipAddress,omitempty"` + // Fqdn - FQDN of vpn-site-link. + Fqdn *string `json:"fqdn,omitempty"` + // BgpProperties - The set of bgp properties. + BgpProperties *VpnLinkBgpSettings `json:"bgpProperties,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VPN site link resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnSiteLinkProperties. +func (vslp VpnSiteLinkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vslp.LinkProperties != nil { + objectMap["linkProperties"] = vslp.LinkProperties + } + if vslp.IPAddress != nil { + objectMap["ipAddress"] = vslp.IPAddress + } + if vslp.Fqdn != nil { + objectMap["fqdn"] = vslp.Fqdn + } + if vslp.BgpProperties != nil { + objectMap["bgpProperties"] = vslp.BgpProperties + } + return json.Marshal(objectMap) +} + +// VpnSiteProperties parameters for VpnSite. +type VpnSiteProperties struct { + // VirtualWan - The VirtualWAN to which the vpnSite belongs. + VirtualWan *SubResource `json:"virtualWan,omitempty"` + // DeviceProperties - The device properties. + DeviceProperties *DeviceProperties `json:"deviceProperties,omitempty"` + // IPAddress - The ip-address for the vpn-site. + IPAddress *string `json:"ipAddress,omitempty"` + // SiteKey - The key for vpn-site that can be used for connections. + SiteKey *string `json:"siteKey,omitempty"` + // AddressSpace - The AddressSpace that contains an array of IP address ranges. + AddressSpace *AddressSpace `json:"addressSpace,omitempty"` + // BgpProperties - The set of bgp properties. + BgpProperties *BgpSettings `json:"bgpProperties,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VPN site resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // IsSecuritySite - IsSecuritySite flag. + IsSecuritySite *bool `json:"isSecuritySite,omitempty"` + // VpnSiteLinks - List of all vpn site links. + VpnSiteLinks *[]VpnSiteLink `json:"vpnSiteLinks,omitempty"` + // O365Policy - Office365 Policy. + O365Policy *O365PolicyProperties `json:"o365Policy,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnSiteProperties. +func (vsp VpnSiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vsp.VirtualWan != nil { + objectMap["virtualWan"] = vsp.VirtualWan + } + if vsp.DeviceProperties != nil { + objectMap["deviceProperties"] = vsp.DeviceProperties + } + if vsp.IPAddress != nil { + objectMap["ipAddress"] = vsp.IPAddress + } + if vsp.SiteKey != nil { + objectMap["siteKey"] = vsp.SiteKey + } + if vsp.AddressSpace != nil { + objectMap["addressSpace"] = vsp.AddressSpace + } + if vsp.BgpProperties != nil { + objectMap["bgpProperties"] = vsp.BgpProperties + } + if vsp.IsSecuritySite != nil { + objectMap["isSecuritySite"] = vsp.IsSecuritySite + } + if vsp.VpnSiteLinks != nil { + objectMap["vpnSiteLinks"] = vsp.VpnSiteLinks + } + if vsp.O365Policy != nil { + objectMap["o365Policy"] = vsp.O365Policy + } + return json.Marshal(objectMap) +} + +// VpnSitesConfigurationDownloadFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnSitesConfigurationDownloadFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnSitesConfigurationClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnSitesConfigurationDownloadFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnSitesConfigurationDownloadFuture.Result. +func (future *VpnSitesConfigurationDownloadFuture) result(client VpnSitesConfigurationClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesConfigurationDownloadFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnSitesConfigurationDownloadFuture") + return + } + ar.Response = future.Response() + return +} + +// VpnSitesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VpnSitesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnSitesClient) (VpnSite, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnSitesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnSitesCreateOrUpdateFuture.Result. +func (future *VpnSitesCreateOrUpdateFuture) result(client VpnSitesClient) (vs VpnSite, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vs.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnSitesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vs.Response.Response, err = future.GetResult(sender); err == nil && vs.Response.Response.StatusCode != http.StatusNoContent { + vs, err = client.CreateOrUpdateResponder(vs.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesCreateOrUpdateFuture", "Result", vs.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnSitesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VpnSitesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnSitesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnSitesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnSitesDeleteFuture.Result. +func (future *VpnSitesDeleteFuture) result(client VpnSitesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnSitesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// Watcher network watcher in a resource group. +type Watcher struct { + autorest.Response `json:"-"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // WatcherPropertiesFormat - Properties of the network watcher. + *WatcherPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Watcher. +func (w Watcher) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if w.WatcherPropertiesFormat != nil { + objectMap["properties"] = w.WatcherPropertiesFormat + } + if w.ID != nil { + objectMap["id"] = w.ID + } + if w.Location != nil { + objectMap["location"] = w.Location + } + if w.Tags != nil { + objectMap["tags"] = w.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Watcher struct. +func (w *Watcher) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + w.Etag = &etag + } + case "properties": + if v != nil { + var watcherPropertiesFormat WatcherPropertiesFormat + err = json.Unmarshal(*v, &watcherPropertiesFormat) + if err != nil { + return err + } + w.WatcherPropertiesFormat = &watcherPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + w.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + w.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + w.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + w.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + w.Tags = tags + } + } + } + + return nil +} + +// WatcherListResult response for ListNetworkWatchers API service call. +type WatcherListResult struct { + autorest.Response `json:"-"` + // Value - List of network watcher resources. + Value *[]Watcher `json:"value,omitempty"` +} + +// WatcherPropertiesFormat the network watcher properties. +type WatcherPropertiesFormat struct { + // ProvisioningState - READ-ONLY; The provisioning state of the network watcher resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for WatcherPropertiesFormat. +func (wpf WatcherPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// WatchersCheckConnectivityFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersCheckConnectivityFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (ConnectivityInformation, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersCheckConnectivityFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersCheckConnectivityFuture.Result. +func (future *WatchersCheckConnectivityFuture) result(client WatchersClient) (ci ConnectivityInformation, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersCheckConnectivityFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ci.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersCheckConnectivityFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ci.Response.Response, err = future.GetResult(sender); err == nil && ci.Response.Response.StatusCode != http.StatusNoContent { + ci, err = client.CheckConnectivityResponder(ci.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersCheckConnectivityFuture", "Result", ci.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WatchersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersDeleteFuture.Result. +func (future *WatchersDeleteFuture) result(client WatchersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// WatchersGetAzureReachabilityReportFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersGetAzureReachabilityReportFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (AzureReachabilityReport, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersGetAzureReachabilityReportFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersGetAzureReachabilityReportFuture.Result. +func (future *WatchersGetAzureReachabilityReportFuture) result(client WatchersClient) (arr AzureReachabilityReport, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetAzureReachabilityReportFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + arr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersGetAzureReachabilityReportFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if arr.Response.Response, err = future.GetResult(sender); err == nil && arr.Response.Response.StatusCode != http.StatusNoContent { + arr, err = client.GetAzureReachabilityReportResponder(arr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetAzureReachabilityReportFuture", "Result", arr.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersGetFlowLogStatusFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersGetFlowLogStatusFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (FlowLogInformation, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersGetFlowLogStatusFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersGetFlowLogStatusFuture.Result. +func (future *WatchersGetFlowLogStatusFuture) result(client WatchersClient) (fli FlowLogInformation, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetFlowLogStatusFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fli.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersGetFlowLogStatusFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fli.Response.Response, err = future.GetResult(sender); err == nil && fli.Response.Response.StatusCode != http.StatusNoContent { + fli, err = client.GetFlowLogStatusResponder(fli.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetFlowLogStatusFuture", "Result", fli.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersGetNetworkConfigurationDiagnosticFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type WatchersGetNetworkConfigurationDiagnosticFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (ConfigurationDiagnosticResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersGetNetworkConfigurationDiagnosticFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersGetNetworkConfigurationDiagnosticFuture.Result. +func (future *WatchersGetNetworkConfigurationDiagnosticFuture) result(client WatchersClient) (cdr ConfigurationDiagnosticResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetNetworkConfigurationDiagnosticFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cdr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersGetNetworkConfigurationDiagnosticFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cdr.Response.Response, err = future.GetResult(sender); err == nil && cdr.Response.Response.StatusCode != http.StatusNoContent { + cdr, err = client.GetNetworkConfigurationDiagnosticResponder(cdr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetNetworkConfigurationDiagnosticFuture", "Result", cdr.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersGetNextHopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WatchersGetNextHopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (NextHopResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersGetNextHopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersGetNextHopFuture.Result. +func (future *WatchersGetNextHopFuture) result(client WatchersClient) (nhr NextHopResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetNextHopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + nhr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersGetNextHopFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if nhr.Response.Response, err = future.GetResult(sender); err == nil && nhr.Response.Response.StatusCode != http.StatusNoContent { + nhr, err = client.GetNextHopResponder(nhr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetNextHopFuture", "Result", nhr.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersGetTroubleshootingFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersGetTroubleshootingFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (TroubleshootingResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersGetTroubleshootingFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersGetTroubleshootingFuture.Result. +func (future *WatchersGetTroubleshootingFuture) result(client WatchersClient) (tr TroubleshootingResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + tr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersGetTroubleshootingFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { + tr, err = client.GetTroubleshootingResponder(tr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingFuture", "Result", tr.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersGetTroubleshootingResultFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersGetTroubleshootingResultFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (TroubleshootingResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersGetTroubleshootingResultFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersGetTroubleshootingResultFuture.Result. +func (future *WatchersGetTroubleshootingResultFuture) result(client WatchersClient) (tr TroubleshootingResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingResultFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + tr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersGetTroubleshootingResultFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { + tr, err = client.GetTroubleshootingResultResponder(tr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingResultFuture", "Result", tr.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersGetVMSecurityRulesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersGetVMSecurityRulesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (SecurityGroupViewResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersGetVMSecurityRulesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersGetVMSecurityRulesFuture.Result. +func (future *WatchersGetVMSecurityRulesFuture) result(client WatchersClient) (sgvr SecurityGroupViewResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetVMSecurityRulesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sgvr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersGetVMSecurityRulesFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sgvr.Response.Response, err = future.GetResult(sender); err == nil && sgvr.Response.Response.StatusCode != http.StatusNoContent { + sgvr, err = client.GetVMSecurityRulesResponder(sgvr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetVMSecurityRulesFuture", "Result", sgvr.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersListAvailableProvidersFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersListAvailableProvidersFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (AvailableProvidersList, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersListAvailableProvidersFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersListAvailableProvidersFuture.Result. +func (future *WatchersListAvailableProvidersFuture) result(client WatchersClient) (apl AvailableProvidersList, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersListAvailableProvidersFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + apl.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersListAvailableProvidersFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if apl.Response.Response, err = future.GetResult(sender); err == nil && apl.Response.Response.StatusCode != http.StatusNoContent { + apl, err = client.ListAvailableProvidersResponder(apl.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersListAvailableProvidersFuture", "Result", apl.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersSetFlowLogConfigurationFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersSetFlowLogConfigurationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (FlowLogInformation, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersSetFlowLogConfigurationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersSetFlowLogConfigurationFuture.Result. +func (future *WatchersSetFlowLogConfigurationFuture) result(client WatchersClient) (fli FlowLogInformation, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersSetFlowLogConfigurationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fli.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersSetFlowLogConfigurationFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fli.Response.Response, err = future.GetResult(sender); err == nil && fli.Response.Response.StatusCode != http.StatusNoContent { + fli, err = client.SetFlowLogConfigurationResponder(fli.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersSetFlowLogConfigurationFuture", "Result", fli.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersVerifyIPFlowFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WatchersVerifyIPFlowFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (VerificationIPFlowResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersVerifyIPFlowFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersVerifyIPFlowFuture.Result. +func (future *WatchersVerifyIPFlowFuture) result(client WatchersClient) (vifr VerificationIPFlowResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersVerifyIPFlowFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vifr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersVerifyIPFlowFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vifr.Response.Response, err = future.GetResult(sender); err == nil && vifr.Response.Response.StatusCode != http.StatusNoContent { + vifr, err = client.VerifyIPFlowResponder(vifr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersVerifyIPFlowFuture", "Result", vifr.Response.Response, "Failure responding to request") + } + } + return +} + +// WebApplicationFirewallCustomRule defines contents of a web application rule. +type WebApplicationFirewallCustomRule struct { + // Name - The name of the resource that is unique within a policy. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Priority - Priority of the rule. Rules with a lower value will be evaluated before rules with a higher value. + Priority *int32 `json:"priority,omitempty"` + // RuleType - The rule type. Possible values include: 'WebApplicationFirewallRuleTypeMatchRule', 'WebApplicationFirewallRuleTypeInvalid' + RuleType WebApplicationFirewallRuleType `json:"ruleType,omitempty"` + // MatchConditions - List of match conditions. + MatchConditions *[]MatchCondition `json:"matchConditions,omitempty"` + // Action - Type of Actions. Possible values include: 'WebApplicationFirewallActionAllow', 'WebApplicationFirewallActionBlock', 'WebApplicationFirewallActionLog' + Action WebApplicationFirewallAction `json:"action,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallCustomRule. +func (wafcr WebApplicationFirewallCustomRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafcr.Name != nil { + objectMap["name"] = wafcr.Name + } + if wafcr.Priority != nil { + objectMap["priority"] = wafcr.Priority + } + if wafcr.RuleType != "" { + objectMap["ruleType"] = wafcr.RuleType + } + if wafcr.MatchConditions != nil { + objectMap["matchConditions"] = wafcr.MatchConditions + } + if wafcr.Action != "" { + objectMap["action"] = wafcr.Action + } + return json.Marshal(objectMap) +} + +// WebApplicationFirewallPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WebApplicationFirewallPoliciesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WebApplicationFirewallPoliciesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WebApplicationFirewallPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WebApplicationFirewallPoliciesDeleteFuture.Result. +func (future *WebApplicationFirewallPoliciesDeleteFuture) result(client WebApplicationFirewallPoliciesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WebApplicationFirewallPoliciesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// WebApplicationFirewallPolicy defines web application firewall policy. +type WebApplicationFirewallPolicy struct { + autorest.Response `json:"-"` + // WebApplicationFirewallPolicyPropertiesFormat - Properties of the web application firewall policy. + *WebApplicationFirewallPolicyPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicy. +func (wafp WebApplicationFirewallPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafp.WebApplicationFirewallPolicyPropertiesFormat != nil { + objectMap["properties"] = wafp.WebApplicationFirewallPolicyPropertiesFormat + } + if wafp.ID != nil { + objectMap["id"] = wafp.ID + } + if wafp.Location != nil { + objectMap["location"] = wafp.Location + } + if wafp.Tags != nil { + objectMap["tags"] = wafp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WebApplicationFirewallPolicy struct. +func (wafp *WebApplicationFirewallPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var webApplicationFirewallPolicyPropertiesFormat WebApplicationFirewallPolicyPropertiesFormat + err = json.Unmarshal(*v, &webApplicationFirewallPolicyPropertiesFormat) + if err != nil { + return err + } + wafp.WebApplicationFirewallPolicyPropertiesFormat = &webApplicationFirewallPolicyPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + wafp.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + wafp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + wafp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + wafp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + wafp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + wafp.Tags = tags + } + } + } + + return nil +} + +// WebApplicationFirewallPolicyListResult 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. +type WebApplicationFirewallPolicyListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of WebApplicationFirewallPolicies within a resource group. + Value *[]WebApplicationFirewallPolicy `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of WebApplicationFirewallPolicy objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyListResult. +func (wafplr WebApplicationFirewallPolicyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// WebApplicationFirewallPolicyListResultIterator provides access to a complete listing of +// WebApplicationFirewallPolicy values. +type WebApplicationFirewallPolicyListResultIterator struct { + i int + page WebApplicationFirewallPolicyListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *WebApplicationFirewallPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPolicyListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *WebApplicationFirewallPolicyListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WebApplicationFirewallPolicyListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter WebApplicationFirewallPolicyListResultIterator) Response() WebApplicationFirewallPolicyListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter WebApplicationFirewallPolicyListResultIterator) Value() WebApplicationFirewallPolicy { + if !iter.page.NotDone() { + return WebApplicationFirewallPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WebApplicationFirewallPolicyListResultIterator type. +func NewWebApplicationFirewallPolicyListResultIterator(page WebApplicationFirewallPolicyListResultPage) WebApplicationFirewallPolicyListResultIterator { + return WebApplicationFirewallPolicyListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wafplr WebApplicationFirewallPolicyListResult) IsEmpty() bool { + return wafplr.Value == nil || len(*wafplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wafplr WebApplicationFirewallPolicyListResult) hasNextLink() bool { + return wafplr.NextLink != nil && len(*wafplr.NextLink) != 0 +} + +// webApplicationFirewallPolicyListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wafplr WebApplicationFirewallPolicyListResult) webApplicationFirewallPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !wafplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wafplr.NextLink))) +} + +// WebApplicationFirewallPolicyListResultPage contains a page of WebApplicationFirewallPolicy values. +type WebApplicationFirewallPolicyListResultPage struct { + fn func(context.Context, WebApplicationFirewallPolicyListResult) (WebApplicationFirewallPolicyListResult, error) + wafplr WebApplicationFirewallPolicyListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *WebApplicationFirewallPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPolicyListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.wafplr) + if err != nil { + return err + } + page.wafplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *WebApplicationFirewallPolicyListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WebApplicationFirewallPolicyListResultPage) NotDone() bool { + return !page.wafplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WebApplicationFirewallPolicyListResultPage) Response() WebApplicationFirewallPolicyListResult { + return page.wafplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WebApplicationFirewallPolicyListResultPage) Values() []WebApplicationFirewallPolicy { + if page.wafplr.IsEmpty() { + return nil + } + return *page.wafplr.Value +} + +// Creates a new instance of the WebApplicationFirewallPolicyListResultPage type. +func NewWebApplicationFirewallPolicyListResultPage(cur WebApplicationFirewallPolicyListResult, getNextPage func(context.Context, WebApplicationFirewallPolicyListResult) (WebApplicationFirewallPolicyListResult, error)) WebApplicationFirewallPolicyListResultPage { + return WebApplicationFirewallPolicyListResultPage{ + fn: getNextPage, + wafplr: cur, + } +} + +// WebApplicationFirewallPolicyPropertiesFormat defines web application firewall policy properties. +type WebApplicationFirewallPolicyPropertiesFormat struct { + // PolicySettings - The PolicySettings for policy. + PolicySettings *PolicySettings `json:"policySettings,omitempty"` + // CustomRules - The custom rules inside the policy. + CustomRules *[]WebApplicationFirewallCustomRule `json:"customRules,omitempty"` + // ApplicationGateways - READ-ONLY; A collection of references to application gateways. + ApplicationGateways *[]ApplicationGateway `json:"applicationGateways,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the web application firewall policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ResourceState - READ-ONLY; Resource status of the policy. Possible values include: 'WebApplicationFirewallPolicyResourceStateCreating', 'WebApplicationFirewallPolicyResourceStateEnabling', 'WebApplicationFirewallPolicyResourceStateEnabled', 'WebApplicationFirewallPolicyResourceStateDisabling', 'WebApplicationFirewallPolicyResourceStateDisabled', 'WebApplicationFirewallPolicyResourceStateDeleting' + ResourceState WebApplicationFirewallPolicyResourceState `json:"resourceState,omitempty"` + // ManagedRules - Describes the managedRules structure. + ManagedRules *ManagedRulesDefinition `json:"managedRules,omitempty"` + // HTTPListeners - READ-ONLY; A collection of references to application gateway http listeners. + HTTPListeners *[]SubResource `json:"httpListeners,omitempty"` + // PathBasedRules - READ-ONLY; A collection of references to application gateway path rules. + PathBasedRules *[]SubResource `json:"pathBasedRules,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyPropertiesFormat. +func (wafppf WebApplicationFirewallPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafppf.PolicySettings != nil { + objectMap["policySettings"] = wafppf.PolicySettings + } + if wafppf.CustomRules != nil { + objectMap["customRules"] = wafppf.CustomRules + } + if wafppf.ManagedRules != nil { + objectMap["managedRules"] = wafppf.ManagedRules + } + return json.Marshal(objectMap) +} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/natgateways.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/natgateways.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/natgateways.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/natgateways.go index b9d0ce9ec41d..4b1dbd097f56 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/natgateways.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/natgateways.go @@ -70,7 +70,7 @@ func (client NatGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -152,7 +152,7 @@ func (client NatGatewaysClient) DeletePreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -238,7 +238,7 @@ func (client NatGatewaysClient) GetPreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -320,7 +320,7 @@ func (client NatGatewaysClient) ListPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -433,7 +433,7 @@ func (client NatGatewaysClient) ListAllPreparer(ctx context.Context) (*http.Requ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -547,7 +547,7 @@ func (client NatGatewaysClient) UpdateTagsPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/natrules.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/natrules.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/natrules.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/natrules.go index bcd3789f3c80..fbb72270b335 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/natrules.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/natrules.go @@ -72,7 +72,7 @@ func (client NatRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -157,7 +157,7 @@ func (client NatRulesClient) DeletePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -244,7 +244,7 @@ func (client NatRulesClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -325,7 +325,7 @@ func (client NatRulesClient) ListByVpnGatewayPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/operations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/operations.go new file mode 100644 index 000000000000..8e8ae84a23b3 --- /dev/null +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/operations.go @@ -0,0 +1,141 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" +) + +// OperationsClient is the network Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Network Rest API operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Network/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/p2svpngateways.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/p2svpngateways.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/p2svpngateways.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/p2svpngateways.go index d3145c8a1cca..16642ce54019 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/p2svpngateways.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/p2svpngateways.go @@ -70,7 +70,7 @@ func (client P2sVpnGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -152,7 +152,7 @@ func (client P2sVpnGatewaysClient) DeletePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -232,7 +232,7 @@ func (client P2sVpnGatewaysClient) DisconnectP2sVpnConnectionsPreparer(ctx conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -313,7 +313,7 @@ func (client P2sVpnGatewaysClient) GenerateVpnProfilePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -401,7 +401,7 @@ func (client P2sVpnGatewaysClient) GetPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -471,7 +471,7 @@ func (client P2sVpnGatewaysClient) GetP2sVpnConnectionHealthPreparer(ctx context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -552,7 +552,7 @@ func (client P2sVpnGatewaysClient) GetP2sVpnConnectionHealthDetailedPreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -640,7 +640,7 @@ func (client P2sVpnGatewaysClient) ListPreparer(ctx context.Context) (*http.Requ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -756,7 +756,7 @@ func (client P2sVpnGatewaysClient) ListByResourceGroupPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -862,7 +862,7 @@ func (client P2sVpnGatewaysClient) ResetPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -942,7 +942,7 @@ func (client P2sVpnGatewaysClient) UpdateTagsPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/packetcaptures.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/packetcaptures.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/packetcaptures.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/packetcaptures.go index 9588e15600f2..0f8f5b3c1734 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/packetcaptures.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/packetcaptures.go @@ -94,7 +94,7 @@ func (client PacketCapturesClient) CreatePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -177,7 +177,7 @@ func (client PacketCapturesClient) DeletePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -264,7 +264,7 @@ func (client PacketCapturesClient) GetPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -335,7 +335,7 @@ func (client PacketCapturesClient) GetStatusPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -421,7 +421,7 @@ func (client PacketCapturesClient) ListPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -492,7 +492,7 @@ func (client PacketCapturesClient) StopPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/peerexpressroutecircuitconnections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/peerexpressroutecircuitconnections.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/peerexpressroutecircuitconnections.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/peerexpressroutecircuitconnections.go index 150351d3b494..7e0d20f4229b 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/peerexpressroutecircuitconnections.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/peerexpressroutecircuitconnections.go @@ -82,7 +82,7 @@ func (client PeerExpressRouteCircuitConnectionsClient) GetPreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -165,7 +165,7 @@ func (client PeerExpressRouteCircuitConnectionsClient) ListPreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/privatednszonegroups.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/privatednszonegroups.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/privatednszonegroups.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/privatednszonegroups.go index 149d809a6bb0..5d31529d2639 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/privatednszonegroups.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/privatednszonegroups.go @@ -73,7 +73,7 @@ func (client PrivateDNSZoneGroupsClient) CreateOrUpdatePreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -157,7 +157,7 @@ func (client PrivateDNSZoneGroupsClient) DeletePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -244,7 +244,7 @@ func (client PrivateDNSZoneGroupsClient) GetPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -325,7 +325,7 @@ func (client PrivateDNSZoneGroupsClient) ListPreparer(ctx context.Context, priva "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/privateendpoints.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/privateendpoints.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/privateendpoints.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/privateendpoints.go index f82e0545c7e8..e422546db7c3 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/privateendpoints.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/privateendpoints.go @@ -71,7 +71,7 @@ func (client PrivateEndpointsClient) CreateOrUpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -153,7 +153,7 @@ func (client PrivateEndpointsClient) DeletePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -239,7 +239,7 @@ func (client PrivateEndpointsClient) GetPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -321,7 +321,7 @@ func (client PrivateEndpointsClient) ListPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -434,7 +434,7 @@ func (client PrivateEndpointsClient) ListBySubscriptionPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/privatelinkservices.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/privatelinkservices.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/privatelinkservices.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/privatelinkservices.go index 07c7a7dc4c07..867d43d8ce55 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/privatelinkservices.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/privatelinkservices.go @@ -69,7 +69,7 @@ func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilityPrepare "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -152,7 +152,7 @@ func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilityByResou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -234,7 +234,7 @@ func (client PrivateLinkServicesClient) CreateOrUpdatePreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -316,7 +316,7 @@ func (client PrivateLinkServicesClient) DeletePreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -396,7 +396,7 @@ func (client PrivateLinkServicesClient) DeletePrivateEndpointConnectionPreparer( "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -482,7 +482,7 @@ func (client PrivateLinkServicesClient) GetPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -565,7 +565,7 @@ func (client PrivateLinkServicesClient) GetPrivateEndpointConnectionPreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -647,7 +647,7 @@ func (client PrivateLinkServicesClient) ListPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -764,7 +764,7 @@ func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesPrepa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -883,7 +883,7 @@ func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesByRes "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -996,7 +996,7 @@ func (client PrivateLinkServicesClient) ListBySubscriptionPreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1114,7 +1114,7 @@ func (client PrivateLinkServicesClient) ListPrivateEndpointConnectionsPreparer(c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1231,7 +1231,7 @@ func (client PrivateLinkServicesClient) UpdatePrivateEndpointConnectionPreparer( "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/profiles.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/profiles.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/profiles.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/profiles.go index aec6ab4edec0..b8ada27a33f1 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/profiles.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/profiles.go @@ -77,7 +77,7 @@ func (client ProfilesClient) CreateOrUpdatePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -149,7 +149,7 @@ func (client ProfilesClient) DeletePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -235,7 +235,7 @@ func (client ProfilesClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -317,7 +317,7 @@ func (client ProfilesClient) ListPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -430,7 +430,7 @@ func (client ProfilesClient) ListAllPreparer(ctx context.Context) (*http.Request "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -544,7 +544,7 @@ func (client ProfilesClient) UpdateTagsPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/publicipaddresses.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/publicipaddresses.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/publicipaddresses.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/publicipaddresses.go index f0469e2ccd4e..dc45e869da51 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/publicipaddresses.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/publicipaddresses.go @@ -85,7 +85,7 @@ func (client PublicIPAddressesClient) CreateOrUpdatePreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -167,7 +167,7 @@ func (client PublicIPAddressesClient) DdosProtectionStatusPreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -246,7 +246,7 @@ func (client PublicIPAddressesClient) DeletePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -332,7 +332,7 @@ func (client PublicIPAddressesClient) GetPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -420,7 +420,7 @@ func (client PublicIPAddressesClient) GetCloudServicePublicIPAddressPreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -590,7 +590,7 @@ func (client PublicIPAddressesClient) ListPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -703,7 +703,7 @@ func (client PublicIPAddressesClient) ListAllPreparer(ctx context.Context) (*htt "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -821,7 +821,7 @@ func (client PublicIPAddressesClient) ListCloudServicePublicIPAddressesPreparer( "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -946,7 +946,7 @@ func (client PublicIPAddressesClient) ListCloudServiceRoleInstancePublicIPAddres "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1304,7 +1304,7 @@ func (client PublicIPAddressesClient) UpdateTagsPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/publicipprefixes.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/publicipprefixes.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/publicipprefixes.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/publicipprefixes.go index cce83cfd17a7..c7a2ed83e3b4 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/publicipprefixes.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/publicipprefixes.go @@ -71,7 +71,7 @@ func (client PublicIPPrefixesClient) CreateOrUpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -153,7 +153,7 @@ func (client PublicIPPrefixesClient) DeletePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -239,7 +239,7 @@ func (client PublicIPPrefixesClient) GetPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -321,7 +321,7 @@ func (client PublicIPPrefixesClient) ListPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -434,7 +434,7 @@ func (client PublicIPPrefixesClient) ListAllPreparer(ctx context.Context) (*http "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -548,7 +548,7 @@ func (client PublicIPPrefixesClient) UpdateTagsPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/resourcenavigationlinks.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/resourcenavigationlinks.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/resourcenavigationlinks.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/resourcenavigationlinks.go index d9f0a5d387d1..befee0c632be 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/resourcenavigationlinks.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/resourcenavigationlinks.go @@ -79,7 +79,7 @@ func (client ResourceNavigationLinksClient) ListPreparer(ctx context.Context, re "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routefilterrules.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routefilterrules.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routefilterrules.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routefilterrules.go index cd65cf675edb..c9d52f036903 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routefilterrules.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routefilterrules.go @@ -83,7 +83,7 @@ func (client RouteFilterRulesClient) CreateOrUpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -167,7 +167,7 @@ func (client RouteFilterRulesClient) DeletePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -254,7 +254,7 @@ func (client RouteFilterRulesClient) GetPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -335,7 +335,7 @@ func (client RouteFilterRulesClient) ListByRouteFilterPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routefilters.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routefilters.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routefilters.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routefilters.go index c62558d12735..8ab42d3a903b 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routefilters.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routefilters.go @@ -70,7 +70,7 @@ func (client RouteFiltersClient) CreateOrUpdatePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -152,7 +152,7 @@ func (client RouteFiltersClient) DeletePreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -238,7 +238,7 @@ func (client RouteFiltersClient) GetPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -317,7 +317,7 @@ func (client RouteFiltersClient) ListPreparer(ctx context.Context) (*http.Reques "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -433,7 +433,7 @@ func (client RouteFiltersClient) ListByResourceGroupPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -547,7 +547,7 @@ func (client RouteFiltersClient) UpdateTagsPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routemaps.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routemaps.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routemaps.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routemaps.go index 5cfb25d2816c..ddd32fd741eb 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routemaps.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routemaps.go @@ -72,7 +72,7 @@ func (client RouteMapsClient) CreateOrUpdatePreparer(ctx context.Context, resour "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -158,7 +158,7 @@ func (client RouteMapsClient) DeletePreparer(ctx context.Context, resourceGroupN "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -245,7 +245,7 @@ func (client RouteMapsClient) GetPreparer(ctx context.Context, resourceGroupName "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -326,7 +326,7 @@ func (client RouteMapsClient) ListPreparer(ctx context.Context, resourceGroupNam "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routes.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routes.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routes.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routes.go index 1eb6bfc855fe..6af60b97bc6f 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routes.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routes.go @@ -72,7 +72,7 @@ func (client RoutesClient) CreateOrUpdatePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -156,7 +156,7 @@ func (client RoutesClient) DeletePreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -243,7 +243,7 @@ func (client RoutesClient) GetPreparer(ctx context.Context, resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -324,7 +324,7 @@ func (client RoutesClient) ListPreparer(ctx context.Context, resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routetables.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routetables.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routetables.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routetables.go index f1e41cc957b5..b70e60528ed4 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routetables.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routetables.go @@ -70,7 +70,7 @@ func (client RouteTablesClient) CreateOrUpdatePreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -152,7 +152,7 @@ func (client RouteTablesClient) DeletePreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -238,7 +238,7 @@ func (client RouteTablesClient) GetPreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -320,7 +320,7 @@ func (client RouteTablesClient) ListPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -433,7 +433,7 @@ func (client RouteTablesClient) ListAllPreparer(ctx context.Context) (*http.Requ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -547,7 +547,7 @@ func (client RouteTablesClient) UpdateTagsPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routingintent.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routingintent.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routingintent.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routingintent.go index c156b0ec37fb..6cb0ca0ce03d 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/routingintent.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/routingintent.go @@ -72,7 +72,7 @@ func (client RoutingIntentClient) CreateOrUpdatePreparer(ctx context.Context, re "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -157,7 +157,7 @@ func (client RoutingIntentClient) DeletePreparer(ctx context.Context, resourceGr "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -244,7 +244,7 @@ func (client RoutingIntentClient) GetPreparer(ctx context.Context, resourceGroup "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -325,7 +325,7 @@ func (client RoutingIntentClient) ListPreparer(ctx context.Context, resourceGrou "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/scopeconnections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/scopeconnections.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/scopeconnections.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/scopeconnections.go index 6ad92314fac1..9e43709df22d 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/scopeconnections.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/scopeconnections.go @@ -81,7 +81,7 @@ func (client ScopeConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -162,7 +162,7 @@ func (client ScopeConnectionsClient) DeletePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -239,7 +239,7 @@ func (client ScopeConnectionsClient) GetPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -334,7 +334,7 @@ func (client ScopeConnectionsClient) ListPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/securityadminconfigurations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/securityadminconfigurations.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/securityadminconfigurations.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/securityadminconfigurations.go index f1e2f4c855a5..fae09ecf9f37 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/securityadminconfigurations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/securityadminconfigurations.go @@ -81,7 +81,7 @@ func (client SecurityAdminConfigurationsClient) CreateOrUpdatePreparer(ctx conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -157,7 +157,7 @@ func (client SecurityAdminConfigurationsClient) DeletePreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -247,7 +247,7 @@ func (client SecurityAdminConfigurationsClient) GetPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -342,7 +342,7 @@ func (client SecurityAdminConfigurationsClient) ListPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/securitygroups.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/securitygroups.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/securitygroups.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/securitygroups.go index 49b472db8755..e96de0b6a830 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/securitygroups.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/securitygroups.go @@ -70,7 +70,7 @@ func (client SecurityGroupsClient) CreateOrUpdatePreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -152,7 +152,7 @@ func (client SecurityGroupsClient) DeletePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -238,7 +238,7 @@ func (client SecurityGroupsClient) GetPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -320,7 +320,7 @@ func (client SecurityGroupsClient) ListPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -433,7 +433,7 @@ func (client SecurityGroupsClient) ListAllPreparer(ctx context.Context) (*http.R "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -547,7 +547,7 @@ func (client SecurityGroupsClient) UpdateTagsPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/securitypartnerproviders.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/securitypartnerproviders.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/securitypartnerproviders.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/securitypartnerproviders.go index e67c5814deba..8d7be2f4d7ae 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/securitypartnerproviders.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/securitypartnerproviders.go @@ -71,7 +71,7 @@ func (client SecurityPartnerProvidersClient) CreateOrUpdatePreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -153,7 +153,7 @@ func (client SecurityPartnerProvidersClient) DeletePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -238,7 +238,7 @@ func (client SecurityPartnerProvidersClient) GetPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -314,7 +314,7 @@ func (client SecurityPartnerProvidersClient) ListPreparer(ctx context.Context) ( "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -430,7 +430,7 @@ func (client SecurityPartnerProvidersClient) ListByResourceGroupPreparer(ctx con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -544,7 +544,7 @@ func (client SecurityPartnerProvidersClient) UpdateTagsPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/securityrules.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/securityrules.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/securityrules.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/securityrules.go index d720cd6f121e..15f3088f51b9 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/securityrules.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/securityrules.go @@ -72,7 +72,7 @@ func (client SecurityRulesClient) CreateOrUpdatePreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -156,7 +156,7 @@ func (client SecurityRulesClient) DeletePreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -243,7 +243,7 @@ func (client SecurityRulesClient) GetPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -324,7 +324,7 @@ func (client SecurityRulesClient) ListPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/serviceassociationlinks.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/serviceassociationlinks.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/serviceassociationlinks.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/serviceassociationlinks.go index 7c14bd3e33f6..685efbe997e8 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/serviceassociationlinks.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/serviceassociationlinks.go @@ -79,7 +79,7 @@ func (client ServiceAssociationLinksClient) ListPreparer(ctx context.Context, re "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/serviceendpointpolicies.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/serviceendpointpolicies.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/serviceendpointpolicies.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/serviceendpointpolicies.go index a500dd6556d5..89895d8430f7 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/serviceendpointpolicies.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/serviceendpointpolicies.go @@ -71,7 +71,7 @@ func (client ServiceEndpointPoliciesClient) CreateOrUpdatePreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -154,7 +154,7 @@ func (client ServiceEndpointPoliciesClient) DeletePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -240,7 +240,7 @@ func (client ServiceEndpointPoliciesClient) GetPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -319,7 +319,7 @@ func (client ServiceEndpointPoliciesClient) ListPreparer(ctx context.Context) (* "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -435,7 +435,7 @@ func (client ServiceEndpointPoliciesClient) ListByResourceGroupPreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -549,7 +549,7 @@ func (client ServiceEndpointPoliciesClient) UpdateTagsPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/serviceendpointpolicydefinitions.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/serviceendpointpolicydefinitions.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/serviceendpointpolicydefinitions.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/serviceendpointpolicydefinitions.go index 90bcb585803d..5702b1327bd7 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/serviceendpointpolicydefinitions.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/serviceendpointpolicydefinitions.go @@ -74,7 +74,7 @@ func (client ServiceEndpointPolicyDefinitionsClient) CreateOrUpdatePreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -158,7 +158,7 @@ func (client ServiceEndpointPolicyDefinitionsClient) DeletePreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -245,7 +245,7 @@ func (client ServiceEndpointPolicyDefinitionsClient) GetPreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -326,7 +326,7 @@ func (client ServiceEndpointPolicyDefinitionsClient) ListByResourceGroupPreparer "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/servicetaginformation.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/servicetaginformation.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/servicetaginformation.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/servicetaginformation.go index ac789988a3bf..a6956bee1877 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/servicetaginformation.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/servicetaginformation.go @@ -84,7 +84,7 @@ func (client ServiceTagInformationClient) ListPreparer(ctx context.Context, loca "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/servicetags.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/servicetags.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/servicetags.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/servicetags.go index 18f10c436967..55229a76b3ea 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/servicetags.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/servicetags.go @@ -76,7 +76,7 @@ func (client ServiceTagsClient) ListPreparer(ctx context.Context, location strin "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/staticmembers.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/staticmembers.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/staticmembers.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/staticmembers.go index 571c77dd7ae0..82fe102ae829 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/staticmembers.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/staticmembers.go @@ -82,7 +82,7 @@ func (client StaticMembersClient) CreateOrUpdatePreparer(ctx context.Context, pa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -165,7 +165,7 @@ func (client StaticMembersClient) DeletePreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -244,7 +244,7 @@ func (client StaticMembersClient) GetPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -341,7 +341,7 @@ func (client StaticMembersClient) ListPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/subnets.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/subnets.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/subnets.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/subnets.go index 618f9cf8b5ff..5c64978488df 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/subnets.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/subnets.go @@ -72,7 +72,7 @@ func (client SubnetsClient) CreateOrUpdatePreparer(ctx context.Context, resource "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -156,7 +156,7 @@ func (client SubnetsClient) DeletePreparer(ctx context.Context, resourceGroupNam "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -244,7 +244,7 @@ func (client SubnetsClient) GetPreparer(ctx context.Context, resourceGroupName s "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -328,7 +328,7 @@ func (client SubnetsClient) ListPreparer(ctx context.Context, resourceGroupName "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -438,7 +438,7 @@ func (client SubnetsClient) PrepareNetworkPoliciesPreparer(ctx context.Context, "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -522,7 +522,7 @@ func (client SubnetsClient) UnprepareNetworkPoliciesPreparer(ctx context.Context "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/subscriptionnetworkmanagerconnections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/subscriptionnetworkmanagerconnections.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/subscriptionnetworkmanagerconnections.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/subscriptionnetworkmanagerconnections.go index 1ce088dd0fc1..fc6f40968c99 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/subscriptionnetworkmanagerconnections.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/subscriptionnetworkmanagerconnections.go @@ -78,7 +78,7 @@ func (client SubscriptionNetworkManagerConnectionsClient) CreateOrUpdatePreparer "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -155,7 +155,7 @@ func (client SubscriptionNetworkManagerConnectionsClient) DeletePreparer(ctx con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -228,7 +228,7 @@ func (client SubscriptionNetworkManagerConnectionsClient) GetPreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -319,7 +319,7 @@ func (client SubscriptionNetworkManagerConnectionsClient) ListPreparer(ctx conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/usages.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/usages.go new file mode 100644 index 000000000000..c7c4e35a6a31 --- /dev/null +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/usages.go @@ -0,0 +1,155 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" +) + +// UsagesClient is the network Client +type UsagesClient struct { + BaseClient +} + +// NewUsagesClient creates an instance of the UsagesClient client. +func NewUsagesClient(subscriptionID string) UsagesClient { + return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { + return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list network usages for a subscription. +// Parameters: +// location - the location where resource usage is queried. +func (client UsagesClient) List(ctx context.Context, location string) (result UsagesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.List") + defer func() { + sc := -1 + if result.ulr.Response.Response != nil { + sc = result.ulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._ ]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.UsagesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure sending request") + return + } + + result.ulr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure responding to request") + return + } + if result.ulr.hasNextLink() && result.ulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client UsagesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsagesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsagesClient) ListResponder(resp *http.Response) (result UsagesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client UsagesClient) listNextResults(ctx context.Context, lastResults UsagesListResult) (result UsagesListResult, err error) { + req, err := lastResults.usagesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.UsagesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.UsagesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.UsagesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client UsagesClient) ListComplete(ctx context.Context, location string) (result UsagesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/version.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/version.go new file mode 100644 index 000000000000..0bc5ef088911 --- /dev/null +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/version.go @@ -0,0 +1,19 @@ +package network + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " network/2022-07-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vipswap.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vipswap.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vipswap.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vipswap.go index b3f58bf7e1f7..b3267641b186 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vipswap.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vipswap.go @@ -72,7 +72,7 @@ func (client VipSwapClient) CreatePreparer(ctx context.Context, groupName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -164,7 +164,7 @@ func (client VipSwapClient) GetPreparer(ctx context.Context, groupName string, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -241,7 +241,7 @@ func (client VipSwapClient) ListPreparer(ctx context.Context, groupName string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualappliances.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualappliances.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualappliances.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualappliances.go index 672f8caf273c..e823c0192a1e 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualappliances.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualappliances.go @@ -83,7 +83,7 @@ func (client VirtualAppliancesClient) CreateOrUpdatePreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -165,7 +165,7 @@ func (client VirtualAppliancesClient) DeletePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -251,7 +251,7 @@ func (client VirtualAppliancesClient) GetPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -330,7 +330,7 @@ func (client VirtualAppliancesClient) ListPreparer(ctx context.Context) (*http.R "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -446,7 +446,7 @@ func (client VirtualAppliancesClient) ListByResourceGroupPreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -560,7 +560,7 @@ func (client VirtualAppliancesClient) UpdateTagsPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualappliancesites.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualappliancesites.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualappliancesites.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualappliancesites.go index 1629304e91ab..1584eb353b27 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualappliancesites.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualappliancesites.go @@ -73,7 +73,7 @@ func (client VirtualApplianceSitesClient) CreateOrUpdatePreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -158,7 +158,7 @@ func (client VirtualApplianceSitesClient) DeletePreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -245,7 +245,7 @@ func (client VirtualApplianceSitesClient) GetPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -326,7 +326,7 @@ func (client VirtualApplianceSitesClient) ListPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualapplianceskus.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualapplianceskus.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualapplianceskus.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualapplianceskus.go index ec0616db338d..1022b9bdedea 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualapplianceskus.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualapplianceskus.go @@ -75,7 +75,7 @@ func (client VirtualApplianceSkusClient) GetPreparer(ctx context.Context, skuNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -151,7 +151,7 @@ func (client VirtualApplianceSkusClient) ListPreparer(ctx context.Context) (*htt "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualhubbgpconnection.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualhubbgpconnection.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualhubbgpconnection.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualhubbgpconnection.go index 4ce3bed82b39..3a5f15d89d6b 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualhubbgpconnection.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualhubbgpconnection.go @@ -86,7 +86,7 @@ func (client VirtualHubBgpConnectionClient) CreateOrUpdatePreparer(ctx context.C "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -171,7 +171,7 @@ func (client VirtualHubBgpConnectionClient) DeletePreparer(ctx context.Context, "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -258,7 +258,7 @@ func (client VirtualHubBgpConnectionClient) GetPreparer(ctx context.Context, res "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualhubbgpconnections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualhubbgpconnections.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualhubbgpconnections.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualhubbgpconnections.go index 649de67c39fc..17cee1a6185e 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualhubbgpconnections.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualhubbgpconnections.go @@ -82,7 +82,7 @@ func (client VirtualHubBgpConnectionsClient) ListPreparer(ctx context.Context, r "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -190,7 +190,7 @@ func (client VirtualHubBgpConnectionsClient) ListAdvertisedRoutesPreparer(ctx co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -271,7 +271,7 @@ func (client VirtualHubBgpConnectionsClient) ListLearnedRoutesPreparer(ctx conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualhubipconfiguration.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualhubipconfiguration.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualhubipconfiguration.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualhubipconfiguration.go index 1f74f1301344..405688585ffd 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualhubipconfiguration.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualhubipconfiguration.go @@ -92,7 +92,7 @@ func (client VirtualHubIPConfigurationClient) CreateOrUpdatePreparer(ctx context "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -177,7 +177,7 @@ func (client VirtualHubIPConfigurationClient) DeletePreparer(ctx context.Context "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -264,7 +264,7 @@ func (client VirtualHubIPConfigurationClient) GetPreparer(ctx context.Context, r "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -345,7 +345,7 @@ func (client VirtualHubIPConfigurationClient) ListPreparer(ctx context.Context, "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualhubroutetablev2s.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualhubroutetablev2s.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualhubroutetablev2s.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualhubroutetablev2s.go index a4098779c7d0..cb37e365930a 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualhubroutetablev2s.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualhubroutetablev2s.go @@ -74,7 +74,7 @@ func (client VirtualHubRouteTableV2sClient) CreateOrUpdatePreparer(ctx context.C "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -158,7 +158,7 @@ func (client VirtualHubRouteTableV2sClient) DeletePreparer(ctx context.Context, "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -245,7 +245,7 @@ func (client VirtualHubRouteTableV2sClient) GetPreparer(ctx context.Context, res "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -326,7 +326,7 @@ func (client VirtualHubRouteTableV2sClient) ListPreparer(ctx context.Context, re "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualhubs.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualhubs.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualhubs.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualhubs.go index 492cb2f2f547..7f51f551f3fa 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualhubs.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualhubs.go @@ -86,7 +86,7 @@ func (client VirtualHubsClient) CreateOrUpdatePreparer(ctx context.Context, reso "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -169,7 +169,7 @@ func (client VirtualHubsClient) DeletePreparer(ctx context.Context, resourceGrou "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -254,7 +254,7 @@ func (client VirtualHubsClient) GetPreparer(ctx context.Context, resourceGroupNa "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -325,7 +325,7 @@ func (client VirtualHubsClient) GetEffectiveVirtualHubRoutesPreparer(ctx context "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -409,7 +409,7 @@ func (client VirtualHubsClient) GetInboundRoutesPreparer(ctx context.Context, re "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -490,7 +490,7 @@ func (client VirtualHubsClient) GetOutboundRoutesPreparer(ctx context.Context, r "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -577,7 +577,7 @@ func (client VirtualHubsClient) ListPreparer(ctx context.Context) (*http.Request "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -693,7 +693,7 @@ func (client VirtualHubsClient) ListByResourceGroupPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -807,7 +807,7 @@ func (client VirtualHubsClient) UpdateTagsPreparer(ctx context.Context, resource "virtualHubName": autorest.Encode("path", virtualHubName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworkgatewayconnections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworkgatewayconnections.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworkgatewayconnections.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworkgatewayconnections.go index c29bb9896be6..54d5a7133100 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworkgatewayconnections.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworkgatewayconnections.go @@ -109,7 +109,7 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(ctx "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -191,7 +191,7 @@ func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(ctx context. "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -276,7 +276,7 @@ func (client VirtualNetworkGatewayConnectionsClient) GetPreparer(ctx context.Con "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -346,7 +346,7 @@ func (client VirtualNetworkGatewayConnectionsClient) GetIkeSasPreparer(ctx conte "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -433,7 +433,7 @@ func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyPreparer(ctx co "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -513,7 +513,7 @@ func (client VirtualNetworkGatewayConnectionsClient) ListPreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -619,7 +619,7 @@ func (client VirtualNetworkGatewayConnectionsClient) ResetConnectionPreparer(ctx "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -710,7 +710,7 @@ func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(ctx "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -801,7 +801,7 @@ func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(ctx co "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -884,7 +884,7 @@ func (client VirtualNetworkGatewayConnectionsClient) StartPacketCapturePreparer( "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -970,7 +970,7 @@ func (client VirtualNetworkGatewayConnectionsClient) StopPacketCapturePreparer(c "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1052,7 +1052,7 @@ func (client VirtualNetworkGatewayConnectionsClient) UpdateTagsPreparer(ctx cont "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworkgatewaynatrules.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworkgatewaynatrules.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworkgatewaynatrules.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworkgatewaynatrules.go index 0518a4cc31ad..c68f5ba004d8 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworkgatewaynatrules.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworkgatewaynatrules.go @@ -74,7 +74,7 @@ func (client VirtualNetworkGatewayNatRulesClient) CreateOrUpdatePreparer(ctx con "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -159,7 +159,7 @@ func (client VirtualNetworkGatewayNatRulesClient) DeletePreparer(ctx context.Con "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -246,7 +246,7 @@ func (client VirtualNetworkGatewayNatRulesClient) GetPreparer(ctx context.Contex "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -327,7 +327,7 @@ func (client VirtualNetworkGatewayNatRulesClient) ListByVirtualNetworkGatewayPre "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworkgateways.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworkgateways.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworkgateways.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworkgateways.go index 14ec90ddc5aa..ff4eeba84f92 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworkgateways.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworkgateways.go @@ -85,7 +85,7 @@ func (client VirtualNetworkGatewaysClient) CreateOrUpdatePreparer(ctx context.Co "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -167,7 +167,7 @@ func (client VirtualNetworkGatewaysClient) DeletePreparer(ctx context.Context, r "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -247,7 +247,7 @@ func (client VirtualNetworkGatewaysClient) DisconnectVirtualNetworkGatewayVpnCon "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -329,7 +329,7 @@ func (client VirtualNetworkGatewaysClient) GenerateVpnProfilePreparer(ctx contex "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -412,7 +412,7 @@ func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackagePreparer(ctx "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -500,7 +500,7 @@ func (client VirtualNetworkGatewaysClient) GetPreparer(ctx context.Context, reso "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -571,7 +571,7 @@ func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesPreparer(ctx conte "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, "peer": autorest.Encode("query", peer), @@ -652,7 +652,7 @@ func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusPreparer(ctx context. "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -735,7 +735,7 @@ func (client VirtualNetworkGatewaysClient) GetLearnedRoutesPreparer(ctx context. "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -815,7 +815,7 @@ func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLPreparer(ctx c "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -895,7 +895,7 @@ func (client VirtualNetworkGatewaysClient) GetVpnclientConnectionHealthPreparer( "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -976,7 +976,7 @@ func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersPreparer(c "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1065,7 +1065,7 @@ func (client VirtualNetworkGatewaysClient) ListPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1183,7 +1183,7 @@ func (client VirtualNetworkGatewaysClient) ListConnectionsPreparer(ctx context.C "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1291,7 +1291,7 @@ func (client VirtualNetworkGatewaysClient) ResetPreparer(ctx context.Context, re "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1374,7 +1374,7 @@ func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeyPreparer(ctx c "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1462,7 +1462,7 @@ func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersPreparer(c "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1544,7 +1544,7 @@ func (client VirtualNetworkGatewaysClient) StartPacketCapturePreparer(ctx contex "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1629,7 +1629,7 @@ func (client VirtualNetworkGatewaysClient) StopPacketCapturePreparer(ctx context "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1717,7 +1717,7 @@ func (client VirtualNetworkGatewaysClient) SupportedVpnDevicesPreparer(ctx conte "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1787,7 +1787,7 @@ func (client VirtualNetworkGatewaysClient) UpdateTagsPreparer(ctx context.Contex "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1877,7 +1877,7 @@ func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScriptPreparer( "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworkpeerings.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworkpeerings.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworkpeerings.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworkpeerings.go index 759caec05ebc..f4009e36b360 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworkpeerings.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworkpeerings.go @@ -88,7 +88,7 @@ func (client VirtualNetworkPeeringsClient) CreateOrUpdatePreparer(ctx context.Co "virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -175,7 +175,7 @@ func (client VirtualNetworkPeeringsClient) DeletePreparer(ctx context.Context, r "virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -262,7 +262,7 @@ func (client VirtualNetworkPeeringsClient) GetPreparer(ctx context.Context, reso "virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -343,7 +343,7 @@ func (client VirtualNetworkPeeringsClient) ListPreparer(ctx context.Context, res "virtualNetworkName": autorest.Encode("path", virtualNetworkName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworks.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworks.go new file mode 100644 index 000000000000..dbeb710db827 --- /dev/null +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworks.go @@ -0,0 +1,917 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" +) + +// VirtualNetworksClient is the network Client +type VirtualNetworksClient struct { + BaseClient +} + +// NewVirtualNetworksClient creates an instance of the VirtualNetworksClient client. +func NewVirtualNetworksClient(subscriptionID string) VirtualNetworksClient { + return NewVirtualNetworksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualNetworksClientWithBaseURI creates an instance of the VirtualNetworksClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworksClient { + return VirtualNetworksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckIPAddressAvailability checks whether a private IP address is available for use. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// IPAddress - the private IP address to be verified. +func (client VirtualNetworksClient) CheckIPAddressAvailability(ctx context.Context, resourceGroupName string, virtualNetworkName string, IPAddress string) (result IPAddressAvailabilityResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.CheckIPAddressAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckIPAddressAvailabilityPreparer(ctx, resourceGroupName, virtualNetworkName, IPAddress) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckIPAddressAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckIPAddressAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckIPAddressAvailabilityPreparer prepares the CheckIPAddressAvailability request. +func (client VirtualNetworksClient) CheckIPAddressAvailabilityPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, IPAddress string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "ipAddress": autorest.Encode("query", IPAddress), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckIPAddressAvailabilitySender sends the CheckIPAddressAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) CheckIPAddressAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckIPAddressAvailabilityResponder handles the response to the CheckIPAddressAvailability request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) CheckIPAddressAvailabilityResponder(resp *http.Response) (result IPAddressAvailabilityResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates a virtual network in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// parameters - parameters supplied to the create or update virtual network operation. +func (client VirtualNetworksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork) (result VirtualNetworksCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkPropertiesFormat.BgpCommunities", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkPropertiesFormat.BgpCommunities.VirtualNetworkCommunity", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.VirtualNetworkPropertiesFormat.Encryption", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkPropertiesFormat.Encryption.Enabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("network.VirtualNetworksClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualNetworksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworksCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetwork, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified virtual network. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +func (client VirtualNetworksClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworksDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualNetworksClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) DeleteSender(req *http.Request) (future VirtualNetworksDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified virtual network by resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// expand - expands referenced resources. +func (client VirtualNetworksClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, expand string) (result VirtualNetwork, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworksClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) GetResponder(resp *http.Response) (result VirtualNetwork, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all virtual networks in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client VirtualNetworksClient) List(ctx context.Context, resourceGroupName string) (result VirtualNetworkListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.List") + defer func() { + sc := -1 + if result.vnlr.Response.Response != nil { + sc = result.vnlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vnlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure sending request") + return + } + + result.vnlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure responding to request") + return + } + if result.vnlr.hasNextLink() && result.vnlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualNetworksClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) ListResponder(resp *http.Response) (result VirtualNetworkListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualNetworksClient) listNextResults(ctx context.Context, lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) { + req, err := lastResults.virtualNetworkListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworksClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualNetworkListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all virtual networks in a subscription. +func (client VirtualNetworksClient) ListAll(ctx context.Context) (result VirtualNetworkListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListAll") + defer func() { + sc := -1 + if result.vnlr.Response.Response != nil { + sc = result.vnlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.vnlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure sending request") + return + } + + result.vnlr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure responding to request") + return + } + if result.vnlr.hasNextLink() && result.vnlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client VirtualNetworksClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) ListAllResponder(resp *http.Response) (result VirtualNetworkListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client VirtualNetworksClient) listAllNextResults(ctx context.Context, lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) { + req, err := lastResults.virtualNetworkListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworksClient) ListAllComplete(ctx context.Context) (result VirtualNetworkListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// ListDdosProtectionStatus gets the Ddos Protection Status of all IP Addresses under the Virtual Network +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// top - the max number of ip addresses to return. +// skipToken - the skipToken that is given with nextLink. +func (client VirtualNetworksClient) ListDdosProtectionStatus(ctx context.Context, resourceGroupName string, virtualNetworkName string, top *int32, skipToken string) (result VirtualNetworksListDdosProtectionStatusFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListDdosProtectionStatus") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListDdosProtectionStatusPreparer(ctx, resourceGroupName, virtualNetworkName, top, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListDdosProtectionStatus", nil, "Failure preparing request") + return + } + + result, err = client.ListDdosProtectionStatusSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListDdosProtectionStatus", result.Response(), "Failure sending request") + return + } + + return +} + +// ListDdosProtectionStatusPreparer prepares the ListDdosProtectionStatus request. +func (client VirtualNetworksClient) ListDdosProtectionStatusPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, top *int32, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["top"] = autorest.Encode("query", *top) + } + if len(skipToken) > 0 { + queryParameters["skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/ddosProtectionStatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListDdosProtectionStatusSender sends the ListDdosProtectionStatus request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) ListDdosProtectionStatusSender(req *http.Request) (future VirtualNetworksListDdosProtectionStatusFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ListDdosProtectionStatusResponder handles the response to the ListDdosProtectionStatus request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) ListDdosProtectionStatusResponder(resp *http.Response) (result VirtualNetworkDdosProtectionStatusResultPage, err error) { + result.vndpsr, err = client.listDdosProtectionStatusResponder(resp) + result.fn = client.listDdosProtectionStatusNextResults + return +} + +func (client VirtualNetworksClient) listDdosProtectionStatusResponder(resp *http.Response) (result VirtualNetworkDdosProtectionStatusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listDdosProtectionStatusNextResults retrieves the next set of results, if any. +func (client VirtualNetworksClient) listDdosProtectionStatusNextResults(ctx context.Context, lastResults VirtualNetworkDdosProtectionStatusResult) (result VirtualNetworkDdosProtectionStatusResult, err error) { + req, err := lastResults.virtualNetworkDdosProtectionStatusResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listDdosProtectionStatusNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + var resp *http.Response + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listDdosProtectionStatusNextResults", resp, "Failure sending next results request") + } + return client.listDdosProtectionStatusResponder(resp) +} + +// ListDdosProtectionStatusComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworksClient) ListDdosProtectionStatusComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string, top *int32, skipToken string) (result VirtualNetworksListDdosProtectionStatusAllFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListDdosProtectionStatus") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + var future VirtualNetworksListDdosProtectionStatusFuture + future, err = client.ListDdosProtectionStatus(ctx, resourceGroupName, virtualNetworkName, top, skipToken) + result.FutureAPI = future.FutureAPI + return +} + +// ListUsage lists usage stats. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +func (client VirtualNetworksClient) ListUsage(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworkListUsageResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListUsage") + defer func() { + sc := -1 + if result.vnlur.Response.Response != nil { + sc = result.vnlur.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listUsageNextResults + req, err := client.ListUsagePreparer(ctx, resourceGroupName, virtualNetworkName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsageSender(req) + if err != nil { + result.vnlur.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", resp, "Failure sending request") + return + } + + result.vnlur, err = client.ListUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", resp, "Failure responding to request") + return + } + if result.vnlur.hasNextLink() && result.vnlur.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListUsagePreparer prepares the ListUsage request. +func (client VirtualNetworksClient) ListUsagePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListUsageSender sends the ListUsage request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) ListUsageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListUsageResponder handles the response to the ListUsage request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) ListUsageResponder(resp *http.Response) (result VirtualNetworkListUsageResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listUsageNextResults retrieves the next set of results, if any. +func (client VirtualNetworksClient) listUsageNextResults(ctx context.Context, lastResults VirtualNetworkListUsageResult) (result VirtualNetworkListUsageResult, err error) { + req, err := lastResults.virtualNetworkListUsageResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listUsageNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listUsageNextResults", resp, "Failure sending next results request") + } + result, err = client.ListUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listUsageNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListUsageComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworksClient) ListUsageComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworkListUsageResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListUsage") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListUsage(ctx, resourceGroupName, virtualNetworkName) + return +} + +// UpdateTags updates a virtual network tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// parameters - parameters supplied to update virtual network tags. +func (client VirtualNetworksClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters TagsObject) (result VirtualNetwork, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client VirtualNetworksClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2022-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) UpdateTagsResponder(resp *http.Response) (result VirtualNetwork, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworktaps.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworktaps.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworktaps.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworktaps.go index 66387b063c57..1be734fcfae7 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualnetworktaps.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualnetworktaps.go @@ -107,7 +107,7 @@ func (client VirtualNetworkTapsClient) CreateOrUpdatePreparer(ctx context.Contex "tapName": autorest.Encode("path", tapName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -189,7 +189,7 @@ func (client VirtualNetworkTapsClient) DeletePreparer(ctx context.Context, resou "tapName": autorest.Encode("path", tapName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -274,7 +274,7 @@ func (client VirtualNetworkTapsClient) GetPreparer(ctx context.Context, resource "tapName": autorest.Encode("path", tapName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -350,7 +350,7 @@ func (client VirtualNetworkTapsClient) ListAllPreparer(ctx context.Context) (*ht "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -466,7 +466,7 @@ func (client VirtualNetworkTapsClient) ListByResourceGroupPreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -580,7 +580,7 @@ func (client VirtualNetworkTapsClient) UpdateTagsPreparer(ctx context.Context, r "tapName": autorest.Encode("path", tapName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualrouterpeerings.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualrouterpeerings.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualrouterpeerings.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualrouterpeerings.go index 44b85be2a88c..735cf9c4672f 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualrouterpeerings.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualrouterpeerings.go @@ -85,7 +85,7 @@ func (client VirtualRouterPeeringsClient) CreateOrUpdatePreparer(ctx context.Con "virtualRouterName": autorest.Encode("path", virtualRouterName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -170,7 +170,7 @@ func (client VirtualRouterPeeringsClient) DeletePreparer(ctx context.Context, re "virtualRouterName": autorest.Encode("path", virtualRouterName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -257,7 +257,7 @@ func (client VirtualRouterPeeringsClient) GetPreparer(ctx context.Context, resou "virtualRouterName": autorest.Encode("path", virtualRouterName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -338,7 +338,7 @@ func (client VirtualRouterPeeringsClient) ListPreparer(ctx context.Context, reso "virtualRouterName": autorest.Encode("path", virtualRouterName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualrouters.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualrouters.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualrouters.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualrouters.go index 02b209124ec1..c73002c0a1bb 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualrouters.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualrouters.go @@ -82,7 +82,7 @@ func (client VirtualRoutersClient) CreateOrUpdatePreparer(ctx context.Context, r "virtualRouterName": autorest.Encode("path", virtualRouterName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -164,7 +164,7 @@ func (client VirtualRoutersClient) DeletePreparer(ctx context.Context, resourceG "virtualRouterName": autorest.Encode("path", virtualRouterName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -250,7 +250,7 @@ func (client VirtualRoutersClient) GetPreparer(ctx context.Context, resourceGrou "virtualRouterName": autorest.Encode("path", virtualRouterName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -329,7 +329,7 @@ func (client VirtualRoutersClient) ListPreparer(ctx context.Context) (*http.Requ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -445,7 +445,7 @@ func (client VirtualRoutersClient) ListByResourceGroupPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualwans.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualwans.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualwans.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualwans.go index 86bce26fcf54..9ca4583d5f97 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/virtualwans.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/virtualwans.go @@ -70,7 +70,7 @@ func (client VirtualWansClient) CreateOrUpdatePreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -152,7 +152,7 @@ func (client VirtualWansClient) DeletePreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -237,7 +237,7 @@ func (client VirtualWansClient) GetPreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -313,7 +313,7 @@ func (client VirtualWansClient) ListPreparer(ctx context.Context) (*http.Request "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -429,7 +429,7 @@ func (client VirtualWansClient) ListByResourceGroupPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -543,7 +543,7 @@ func (client VirtualWansClient) UpdateTagsPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnconnections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnconnections.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnconnections.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnconnections.go index 0ca7e4ff0124..17941af71ba4 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnconnections.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnconnections.go @@ -73,7 +73,7 @@ func (client VpnConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -157,7 +157,7 @@ func (client VpnConnectionsClient) DeletePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -244,7 +244,7 @@ func (client VpnConnectionsClient) GetPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -325,7 +325,7 @@ func (client VpnConnectionsClient) ListByVpnGatewayPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -435,7 +435,7 @@ func (client VpnConnectionsClient) StartPacketCapturePreparer(ctx context.Contex "vpnConnectionName": autorest.Encode("path", vpnConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -522,7 +522,7 @@ func (client VpnConnectionsClient) StopPacketCapturePreparer(ctx context.Context "vpnConnectionName": autorest.Encode("path", vpnConnectionName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpngateways.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpngateways.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpngateways.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpngateways.go index ead73b2ec175..d96c984970e5 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpngateways.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpngateways.go @@ -84,7 +84,7 @@ func (client VpnGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -166,7 +166,7 @@ func (client VpnGatewaysClient) DeletePreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -251,7 +251,7 @@ func (client VpnGatewaysClient) GetPreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -327,7 +327,7 @@ func (client VpnGatewaysClient) ListPreparer(ctx context.Context) (*http.Request "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -443,7 +443,7 @@ func (client VpnGatewaysClient) ListByResourceGroupPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -549,7 +549,7 @@ func (client VpnGatewaysClient) ResetPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -629,7 +629,7 @@ func (client VpnGatewaysClient) StartPacketCapturePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -714,7 +714,7 @@ func (client VpnGatewaysClient) StopPacketCapturePreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -799,7 +799,7 @@ func (client VpnGatewaysClient) UpdateTagsPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnlinkconnections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnlinkconnections.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnlinkconnections.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnlinkconnections.go index 18369a2c8a02..f7e314346412 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnlinkconnections.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnlinkconnections.go @@ -74,7 +74,7 @@ func (client VpnLinkConnectionsClient) GetIkeSasPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -167,7 +167,7 @@ func (client VpnLinkConnectionsClient) ListByVpnConnectionPreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -277,7 +277,7 @@ func (client VpnLinkConnectionsClient) ResetConnectionPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnserverconfigurations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnserverconfigurations.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnserverconfigurations.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnserverconfigurations.go index 690b22ec70c3..131c07f7bc61 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnserverconfigurations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnserverconfigurations.go @@ -72,7 +72,7 @@ func (client VpnServerConfigurationsClient) CreateOrUpdatePreparer(ctx context.C "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -154,7 +154,7 @@ func (client VpnServerConfigurationsClient) DeletePreparer(ctx context.Context, "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -239,7 +239,7 @@ func (client VpnServerConfigurationsClient) GetPreparer(ctx context.Context, res "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -315,7 +315,7 @@ func (client VpnServerConfigurationsClient) ListPreparer(ctx context.Context) (* "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -431,7 +431,7 @@ func (client VpnServerConfigurationsClient) ListByResourceGroupPreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -545,7 +545,7 @@ func (client VpnServerConfigurationsClient) UpdateTagsPreparer(ctx context.Conte "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnserverconfigurationsassociatedwithvirtualwan.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnserverconfigurationsassociatedwithvirtualwan.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnserverconfigurationsassociatedwithvirtualwan.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnserverconfigurationsassociatedwithvirtualwan.go index a3ed2f306a70..e34656e286fa 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnserverconfigurationsassociatedwithvirtualwan.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnserverconfigurationsassociatedwithvirtualwan.go @@ -71,7 +71,7 @@ func (client VpnServerConfigurationsAssociatedWithVirtualWanClient) ListPreparer "virtualWANName": autorest.Encode("path", virtualWANName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnsitelinkconnections.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnsitelinkconnections.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnsitelinkconnections.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnsitelinkconnections.go index a2b81a4d135b..1d2719c2a060 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnsitelinkconnections.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnsitelinkconnections.go @@ -81,7 +81,7 @@ func (client VpnSiteLinkConnectionsClient) GetPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnsitelinks.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnsitelinks.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnsitelinks.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnsitelinks.go index aff6dff86bee..22b03de595cf 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnsitelinks.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnsitelinks.go @@ -78,7 +78,7 @@ func (client VpnSiteLinksClient) GetPreparer(ctx context.Context, resourceGroupN "vpnSiteName": autorest.Encode("path", vpnSiteName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -159,7 +159,7 @@ func (client VpnSiteLinksClient) ListByVpnSitePreparer(ctx context.Context, reso "vpnSiteName": autorest.Encode("path", vpnSiteName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnsites.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnsites.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnsites.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnsites.go index be15be4a5025..fd7e3b09daf7 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnsites.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnsites.go @@ -84,7 +84,7 @@ func (client VpnSitesClient) CreateOrUpdatePreparer(ctx context.Context, resourc "vpnSiteName": autorest.Encode("path", vpnSiteName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -166,7 +166,7 @@ func (client VpnSitesClient) DeletePreparer(ctx context.Context, resourceGroupNa "vpnSiteName": autorest.Encode("path", vpnSiteName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -251,7 +251,7 @@ func (client VpnSitesClient) GetPreparer(ctx context.Context, resourceGroupName "vpnSiteName": autorest.Encode("path", vpnSiteName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -327,7 +327,7 @@ func (client VpnSitesClient) ListPreparer(ctx context.Context) (*http.Request, e "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -443,7 +443,7 @@ func (client VpnSitesClient) ListByResourceGroupPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -557,7 +557,7 @@ func (client VpnSitesClient) UpdateTagsPreparer(ctx context.Context, resourceGro "vpnSiteName": autorest.Encode("path", vpnSiteName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnsitesconfiguration.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnsitesconfiguration.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnsitesconfiguration.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnsitesconfiguration.go index ac3dee69b34e..3906e52ef0e3 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/vpnsitesconfiguration.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/vpnsitesconfiguration.go @@ -78,7 +78,7 @@ func (client VpnSitesConfigurationClient) DownloadPreparer(ctx context.Context, "virtualWANName": autorest.Encode("path", virtualWANName), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/watchers.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/watchers.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/watchers.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/watchers.go index 9281e8f0f85d..f8bcfa01075d 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/watchers.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/watchers.go @@ -90,7 +90,7 @@ func (client WatchersClient) CheckConnectivityPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -179,7 +179,7 @@ func (client WatchersClient) CreateOrUpdatePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -251,7 +251,7 @@ func (client WatchersClient) DeletePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -336,7 +336,7 @@ func (client WatchersClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -416,7 +416,7 @@ func (client WatchersClient) GetAzureReachabilityReportPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -504,7 +504,7 @@ func (client WatchersClient) GetFlowLogStatusPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -597,7 +597,7 @@ func (client WatchersClient) GetNetworkConfigurationDiagnosticPreparer(ctx conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -687,7 +687,7 @@ func (client WatchersClient) GetNextHopPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -776,7 +776,7 @@ func (client WatchersClient) GetTopologyPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -858,7 +858,7 @@ func (client WatchersClient) GetTroubleshootingPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -946,7 +946,7 @@ func (client WatchersClient) GetTroubleshootingResultPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1034,7 +1034,7 @@ func (client WatchersClient) GetVMSecurityRulesPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1120,7 +1120,7 @@ func (client WatchersClient) ListPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1191,7 +1191,7 @@ func (client WatchersClient) ListAllPreparer(ctx context.Context) (*http.Request "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1262,7 +1262,7 @@ func (client WatchersClient) ListAvailableProvidersPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1354,7 +1354,7 @@ func (client WatchersClient) SetFlowLogConfigurationPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1443,7 +1443,7 @@ func (client WatchersClient) UpdateTagsPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1525,7 +1525,7 @@ func (client WatchersClient) VerifyIPFlowPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/webapplicationfirewallpolicies.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/webapplicationfirewallpolicies.go similarity index 95% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/webapplicationfirewallpolicies.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/webapplicationfirewallpolicies.go index fcb21089a7f3..33568889172b 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/webapplicationfirewallpolicies.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/webapplicationfirewallpolicies.go @@ -59,6 +59,12 @@ func (client WebApplicationFirewallPoliciesClient) CreateOrUpdate(ctx context.Co Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.PolicySettings.MaxRequestBodySizeInKb", Name: validation.InclusiveMinimum, Rule: int64(8), Chain: nil}}}, {Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.PolicySettings.FileUploadLimitInMb", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.PolicySettings.FileUploadLimitInMb", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, + {Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.PolicySettings.CustomBlockResponseStatusCode", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.PolicySettings.CustomBlockResponseStatusCode", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, + {Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.PolicySettings.CustomBlockResponseBody", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.PolicySettings.CustomBlockResponseBody", Name: validation.MaxLength, Rule: 32768, Chain: nil}, + {Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.PolicySettings.CustomBlockResponseBody", Name: validation.Pattern, Rule: `^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$`, Chain: nil}, + }}, }}, {Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.ManagedRules", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.ManagedRules.ManagedRuleSets", Name: validation.Null, Rule: true, Chain: nil}}}, @@ -96,7 +102,7 @@ func (client WebApplicationFirewallPoliciesClient) CreateOrUpdatePreparer(ctx co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -174,7 +180,7 @@ func (client WebApplicationFirewallPoliciesClient) DeletePreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -265,7 +271,7 @@ func (client WebApplicationFirewallPoliciesClient) GetPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -344,7 +350,7 @@ func (client WebApplicationFirewallPoliciesClient) ListPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -457,7 +463,7 @@ func (client WebApplicationFirewallPoliciesClient) ListAllPreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/webcategories.go b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/webcategories.go similarity index 99% rename from vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/webcategories.go rename to vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/webcategories.go index 80116bb7d1a9..9330385dbd0d 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network/webcategories.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network/webcategories.go @@ -75,7 +75,7 @@ func (client WebCategoriesClient) GetPreparer(ctx context.Context, name string, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -154,7 +154,7 @@ func (client WebCategoriesClient) ListBySubscriptionPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-05-01" + const APIVersion = "2022-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/actions.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/actions.go index 3574a9982d9b..9051a72992c5 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/actions.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/actions.go @@ -58,7 +58,8 @@ func (client ActionsClient) CreateOrUpdate(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: action, Constraints: []validation.Constraint{{Target: "action.ActionRequestProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "action.ActionRequestProperties.TriggerURI", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -155,7 +156,8 @@ func (client ActionsClient) Delete(ctx context.Context, resourceGroupName string {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ActionsClient", "Delete", err.Error()) } @@ -246,7 +248,8 @@ func (client ActionsClient) Get(ctx context.Context, resourceGroupName string, w {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ActionsClient", "Get", err.Error()) } @@ -337,7 +340,8 @@ func (client ActionsClient) ListByAlertRule(ctx context.Context, resourceGroupNa {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ActionsClient", "ListByAlertRule", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertrules.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertrules.go index ecb335a72198..acfb5d14279f 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertrules.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertrules.go @@ -57,7 +57,8 @@ func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroup {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AlertRulesClient", "CreateOrUpdate", err.Error()) } @@ -149,7 +150,8 @@ func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName str {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AlertRulesClient", "Delete", err.Error()) } @@ -238,7 +240,8 @@ func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AlertRulesClient", "Get", err.Error()) } @@ -327,7 +330,8 @@ func (client AlertRulesClient) List(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AlertRulesClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertruletemplates.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertruletemplates.go index 4a0b22266619..3168e2792245 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertruletemplates.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/alertruletemplates.go @@ -57,7 +57,8 @@ func (client AlertRuleTemplatesClient) Get(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AlertRuleTemplatesClient", "Get", err.Error()) } @@ -146,7 +147,8 @@ func (client AlertRuleTemplatesClient) List(ctx context.Context, resourceGroupNa {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AlertRuleTemplatesClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/automationrules.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/automationrules.go index 76a6dde89db3..439472b9150b 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/automationrules.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/automationrules.go @@ -57,7 +57,8 @@ func (client AutomationRulesClient) CreateOrUpdate(ctx context.Context, resource {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: automationRuleToUpsert, Constraints: []validation.Constraint{{Target: "automationRuleToUpsert", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "automationRuleToUpsert.AutomationRuleProperties", Name: validation.Null, Rule: true, @@ -170,7 +171,8 @@ func (client AutomationRulesClient) Delete(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AutomationRulesClient", "Delete", err.Error()) } @@ -260,7 +262,8 @@ func (client AutomationRulesClient) Get(ctx context.Context, resourceGroupName s {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AutomationRulesClient", "Get", err.Error()) } @@ -349,7 +352,8 @@ func (client AutomationRulesClient) List(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.AutomationRulesClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmark.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmark.go index ccd87a14634d..969bf0878bb5 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmark.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmark.go @@ -57,7 +57,8 @@ func (client BookmarkClient) Expand(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.BookmarkClient", "Expand", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarkrelations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarkrelations.go index a008c74cbae2..b9b2d7b2b71b 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarkrelations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarkrelations.go @@ -59,7 +59,8 @@ func (client BookmarkRelationsClient) CreateOrUpdate(ctx context.Context, resour {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: relation, Constraints: []validation.Constraint{{Target: "relation.RelationProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "relation.RelationProperties.RelatedResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -156,7 +157,8 @@ func (client BookmarkRelationsClient) Delete(ctx context.Context, resourceGroupN {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.BookmarkRelationsClient", "Delete", err.Error()) } @@ -247,7 +249,8 @@ func (client BookmarkRelationsClient) Get(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.BookmarkRelationsClient", "Get", err.Error()) } @@ -344,7 +347,8 @@ func (client BookmarkRelationsClient) List(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.BookmarkRelationsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarks.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarks.go index 1bb2ba7d5cf6..1f2afce2a31d 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarks.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/bookmarks.go @@ -57,7 +57,8 @@ func (client BookmarksClient) CreateOrUpdate(ctx context.Context, resourceGroupN {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: bookmark, Constraints: []validation.Constraint{{Target: "bookmark.BookmarkProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "bookmark.BookmarkProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, @@ -154,7 +155,8 @@ func (client BookmarksClient) Delete(ctx context.Context, resourceGroupName stri {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.BookmarksClient", "Delete", err.Error()) } @@ -243,7 +245,8 @@ func (client BookmarksClient) Get(ctx context.Context, resourceGroupName string, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.BookmarksClient", "Get", err.Error()) } @@ -332,7 +335,8 @@ func (client BookmarksClient) List(ctx context.Context, resourceGroupName string {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.BookmarksClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectors.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectors.go index 49f47deb7985..6824770c4439 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectors.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectors.go @@ -57,7 +57,8 @@ func (client DataConnectorsClient) Connect(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.DataConnectorsClient", "Connect", err.Error()) } @@ -149,7 +150,8 @@ func (client DataConnectorsClient) CreateOrUpdate(ctx context.Context, resourceG {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.DataConnectorsClient", "CreateOrUpdate", err.Error()) } @@ -241,7 +243,8 @@ func (client DataConnectorsClient) Delete(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.DataConnectorsClient", "Delete", err.Error()) } @@ -330,7 +333,8 @@ func (client DataConnectorsClient) Disconnect(ctx context.Context, resourceGroup {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.DataConnectorsClient", "Disconnect", err.Error()) } @@ -419,7 +423,8 @@ func (client DataConnectorsClient) Get(ctx context.Context, resourceGroupName st {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.DataConnectorsClient", "Get", err.Error()) } @@ -508,7 +513,8 @@ func (client DataConnectorsClient) List(ctx context.Context, resourceGroupName s {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.DataConnectorsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectorscheckrequirements.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectorscheckrequirements.go index ba2798ed418d..f8e33b4cb5d8 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectorscheckrequirements.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/dataconnectorscheckrequirements.go @@ -58,7 +58,8 @@ func (client DataConnectorsCheckRequirementsClient) Post(ctx context.Context, re {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.DataConnectorsCheckRequirementsClient", "Post", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entities.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entities.go index b35a88feea9c..eb2e020a22ac 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entities.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entities.go @@ -57,7 +57,8 @@ func (client EntitiesClient) Expand(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntitiesClient", "Expand", err.Error()) } @@ -149,7 +150,8 @@ func (client EntitiesClient) Get(ctx context.Context, resourceGroupName string, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntitiesClient", "Get", err.Error()) } @@ -240,7 +242,8 @@ func (client EntitiesClient) GetInsights(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.StartTime", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.EndTime", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { @@ -334,7 +337,8 @@ func (client EntitiesClient) List(ctx context.Context, resourceGroupName string, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntitiesClient", "List", err.Error()) } @@ -465,7 +469,8 @@ func (client EntitiesClient) Queries(ctx context.Context, resourceGroupName stri {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntitiesClient", "Queries", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesgettimeline.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesgettimeline.go index 988cc44891f1..7e6680321e40 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesgettimeline.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesgettimeline.go @@ -58,7 +58,8 @@ func (client EntitiesGetTimelineClient) List(ctx context.Context, resourceGroupN {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.StartTime", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.EndTime", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesrelations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesrelations.go index 20210c17f049..5b2f4f7f4cd1 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesrelations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entitiesrelations.go @@ -63,7 +63,8 @@ func (client EntitiesRelationsClient) List(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntitiesRelationsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityqueries.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityqueries.go index 18ccbf723d7d..7ecede43f569 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityqueries.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityqueries.go @@ -57,7 +57,8 @@ func (client EntityQueriesClient) CreateOrUpdate(ctx context.Context, resourceGr {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntityQueriesClient", "CreateOrUpdate", err.Error()) } @@ -149,7 +150,8 @@ func (client EntityQueriesClient) Delete(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntityQueriesClient", "Delete", err.Error()) } @@ -238,7 +240,8 @@ func (client EntityQueriesClient) Get(ctx context.Context, resourceGroupName str {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntityQueriesClient", "Get", err.Error()) } @@ -328,7 +331,8 @@ func (client EntityQueriesClient) List(ctx context.Context, resourceGroupName st {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntityQueriesClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityquerytemplates.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityquerytemplates.go index 5f275741ca09..cca782f8ecc1 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityquerytemplates.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityquerytemplates.go @@ -58,7 +58,8 @@ func (client EntityQueryTemplatesClient) Get(ctx context.Context, resourceGroupN {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntityQueryTemplatesClient", "Get", err.Error()) } @@ -148,7 +149,8 @@ func (client EntityQueryTemplatesClient) List(ctx context.Context, resourceGroup {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntityQueryTemplatesClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityrelations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityrelations.go index c6bfe5324823..7b96da2cb8a1 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityrelations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/entityrelations.go @@ -57,7 +57,8 @@ func (client EntityRelationsClient) GetRelation(ctx context.Context, resourceGro {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.EntityRelationsClient", "GetRelation", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/fileimports.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/fileimports.go index ed5dd6d56863..a7e2fcd9f1be 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/fileimports.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/fileimports.go @@ -57,7 +57,8 @@ func (client FileImportsClient) Create(ctx context.Context, resourceGroupName st {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: fileImport, Constraints: []validation.Constraint{{Target: "fileImport.FileImportProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "fileImport.FileImportProperties.ImportFile", Name: validation.Null, Rule: true, Chain: nil}, @@ -154,7 +155,8 @@ func (client FileImportsClient) Delete(ctx context.Context, resourceGroupName st {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.FileImportsClient", "Delete", err.Error()) } @@ -247,7 +249,8 @@ func (client FileImportsClient) Get(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.FileImportsClient", "Get", err.Error()) } @@ -342,7 +345,8 @@ func (client FileImportsClient) List(ctx context.Context, resourceGroupName stri {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.FileImportsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentcomments.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentcomments.go index 30d6ef2e9824..ba64cf9448cb 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentcomments.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentcomments.go @@ -59,7 +59,8 @@ func (client IncidentCommentsClient) CreateOrUpdate(ctx context.Context, resourc {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: incidentComment, Constraints: []validation.Constraint{{Target: "incidentComment.IncidentCommentProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "incidentComment.IncidentCommentProperties.Message", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -156,7 +157,8 @@ func (client IncidentCommentsClient) Delete(ctx context.Context, resourceGroupNa {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentCommentsClient", "Delete", err.Error()) } @@ -247,7 +249,8 @@ func (client IncidentCommentsClient) Get(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentCommentsClient", "Get", err.Error()) } @@ -344,7 +347,8 @@ func (client IncidentCommentsClient) List(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentCommentsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentrelations.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentrelations.go index 6b128d12ab5a..a9f35b79b267 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentrelations.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidentrelations.go @@ -59,7 +59,8 @@ func (client IncidentRelationsClient) CreateOrUpdate(ctx context.Context, resour {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: relation, Constraints: []validation.Constraint{{Target: "relation.RelationProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "relation.RelationProperties.RelatedResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -156,7 +157,8 @@ func (client IncidentRelationsClient) Delete(ctx context.Context, resourceGroupN {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentRelationsClient", "Delete", err.Error()) } @@ -247,7 +249,8 @@ func (client IncidentRelationsClient) Get(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentRelationsClient", "Get", err.Error()) } @@ -344,7 +347,8 @@ func (client IncidentRelationsClient) List(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentRelationsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidents.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidents.go index df163efdbabe..1cd65ce68742 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidents.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/incidents.go @@ -57,7 +57,8 @@ func (client IncidentsClient) CreateOrUpdate(ctx context.Context, resourceGroupN {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: incident, Constraints: []validation.Constraint{{Target: "incident.IncidentProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "incident.IncidentProperties.Title", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -154,7 +155,8 @@ func (client IncidentsClient) CreateTeam(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: teamProperties, Constraints: []validation.Constraint{{Target: "teamProperties.TeamName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentsClient", "CreateTeam", err.Error()) @@ -248,7 +250,8 @@ func (client IncidentsClient) Delete(ctx context.Context, resourceGroupName stri {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentsClient", "Delete", err.Error()) } @@ -337,7 +340,8 @@ func (client IncidentsClient) Get(ctx context.Context, resourceGroupName string, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentsClient", "Get", err.Error()) } @@ -432,7 +436,8 @@ func (client IncidentsClient) List(ctx context.Context, resourceGroupName string {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentsClient", "List", err.Error()) } @@ -575,7 +580,8 @@ func (client IncidentsClient) ListAlerts(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentsClient", "ListAlerts", err.Error()) } @@ -665,7 +671,8 @@ func (client IncidentsClient) ListBookmarks(ctx context.Context, resourceGroupNa {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentsClient", "ListBookmarks", err.Error()) } @@ -755,7 +762,8 @@ func (client IncidentsClient) ListEntities(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.IncidentsClient", "ListEntities", err.Error()) } @@ -844,7 +852,8 @@ func (client IncidentsClient) RunPlaybook(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: requestBody, Constraints: []validation.Constraint{{Target: "requestBody", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "requestBody.LogicAppsResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/metadata.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/metadata.go index 7a84b31846c6..e2f8e490417c 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/metadata.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/metadata.go @@ -57,7 +57,8 @@ func (client MetadataClient) Create(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: metadata, Constraints: []validation.Constraint{{Target: "metadata.MetadataProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "metadata.MetadataProperties.ParentID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -152,7 +153,8 @@ func (client MetadataClient) Delete(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.MetadataClient", "Delete", err.Error()) } @@ -241,7 +243,8 @@ func (client MetadataClient) Get(ctx context.Context, resourceGroupName string, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.MetadataClient", "Get", err.Error()) } @@ -335,7 +338,8 @@ func (client MetadataClient) List(ctx context.Context, resourceGroupName string, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.MetadataClient", "List", err.Error()) } @@ -479,7 +483,8 @@ func (client MetadataClient) Update(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.MetadataClient", "Update", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/officeconsents.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/officeconsents.go index aaceee26fba6..509889613336 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/officeconsents.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/officeconsents.go @@ -56,7 +56,8 @@ func (client OfficeConsentsClient) Delete(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.OfficeConsentsClient", "Delete", err.Error()) } @@ -145,7 +146,8 @@ func (client OfficeConsentsClient) Get(ctx context.Context, resourceGroupName st {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.OfficeConsentsClient", "Get", err.Error()) } @@ -234,7 +236,8 @@ func (client OfficeConsentsClient) List(ctx context.Context, resourceGroupName s {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.OfficeConsentsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/productsettings.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/productsettings.go index 991f6325f1c9..14408f6a3034 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/productsettings.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/productsettings.go @@ -56,7 +56,8 @@ func (client ProductSettingsClient) Delete(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ProductSettingsClient", "Delete", err.Error()) } @@ -145,7 +146,8 @@ func (client ProductSettingsClient) Get(ctx context.Context, resourceGroupName s {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ProductSettingsClient", "Get", err.Error()) } @@ -234,7 +236,8 @@ func (client ProductSettingsClient) List(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ProductSettingsClient", "List", err.Error()) } @@ -324,7 +327,8 @@ func (client ProductSettingsClient) Update(ctx context.Context, resourceGroupNam {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ProductSettingsClient", "Update", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/securitymlanalyticssettings.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/securitymlanalyticssettings.go index edd5c17fefb8..03055c5e185a 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/securitymlanalyticssettings.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/securitymlanalyticssettings.go @@ -59,7 +59,8 @@ func (client SecurityMLAnalyticsSettingsClient) CreateOrUpdate(ctx context.Conte {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SecurityMLAnalyticsSettingsClient", "CreateOrUpdate", err.Error()) } @@ -151,7 +152,8 @@ func (client SecurityMLAnalyticsSettingsClient) Delete(ctx context.Context, reso {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SecurityMLAnalyticsSettingsClient", "Delete", err.Error()) } @@ -240,7 +242,8 @@ func (client SecurityMLAnalyticsSettingsClient) Get(ctx context.Context, resourc {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SecurityMLAnalyticsSettingsClient", "Get", err.Error()) } @@ -329,7 +332,8 @@ func (client SecurityMLAnalyticsSettingsClient) List(ctx context.Context, resour {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SecurityMLAnalyticsSettingsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sentinelonboardingstates.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sentinelonboardingstates.go index 6c44b57a1521..a54a84dc0257 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sentinelonboardingstates.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sentinelonboardingstates.go @@ -59,7 +59,8 @@ func (client SentinelOnboardingStatesClient) Create(ctx context.Context, resourc {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SentinelOnboardingStatesClient", "Create", err.Error()) } @@ -154,7 +155,8 @@ func (client SentinelOnboardingStatesClient) Delete(ctx context.Context, resourc {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SentinelOnboardingStatesClient", "Delete", err.Error()) } @@ -243,7 +245,8 @@ func (client SentinelOnboardingStatesClient) Get(ctx context.Context, resourceGr {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SentinelOnboardingStatesClient", "Get", err.Error()) } @@ -332,7 +335,8 @@ func (client SentinelOnboardingStatesClient) List(ctx context.Context, resourceG {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SentinelOnboardingStatesClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrol.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrol.go index 6ea98127a0f3..8fd853f2a69b 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrol.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrol.go @@ -56,7 +56,8 @@ func (client SourceControlClient) ListRepositories(ctx context.Context, resource {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SourceControlClient", "ListRepositories", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrols.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrols.go index 0348103a0c7b..a4c67f46d3f2 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrols.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/sourcecontrols.go @@ -57,7 +57,8 @@ func (client SourceControlsClient) Create(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: sourceControl, Constraints: []validation.Constraint{{Target: "sourceControl.SourceControlProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "sourceControl.SourceControlProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, @@ -155,7 +156,8 @@ func (client SourceControlsClient) Delete(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SourceControlsClient", "Delete", err.Error()) } @@ -244,7 +246,8 @@ func (client SourceControlsClient) Get(ctx context.Context, resourceGroupName st {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SourceControlsClient", "Get", err.Error()) } @@ -333,7 +336,8 @@ func (client SourceControlsClient) List(ctx context.Context, resourceGroupName s {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.SourceControlsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicator.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicator.go index 8fb42b8a2c63..45c4508b391d 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicator.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicator.go @@ -59,7 +59,8 @@ func (client ThreatIntelligenceIndicatorClient) AppendTags(ctx context.Context, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "AppendTags", err.Error()) } @@ -151,7 +152,8 @@ func (client ThreatIntelligenceIndicatorClient) Create(ctx context.Context, reso {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "Create", err.Error()) } @@ -243,7 +245,8 @@ func (client ThreatIntelligenceIndicatorClient) CreateIndicator(ctx context.Cont {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "CreateIndicator", err.Error()) } @@ -334,7 +337,8 @@ func (client ThreatIntelligenceIndicatorClient) Delete(ctx context.Context, reso {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "Delete", err.Error()) } @@ -423,7 +427,8 @@ func (client ThreatIntelligenceIndicatorClient) Get(ctx context.Context, resourc {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "Get", err.Error()) } @@ -513,7 +518,8 @@ func (client ThreatIntelligenceIndicatorClient) QueryIndicators(ctx context.Cont {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "QueryIndicators", err.Error()) } @@ -647,7 +653,8 @@ func (client ThreatIntelligenceIndicatorClient) ReplaceTags(ctx context.Context, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorClient", "ReplaceTags", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicatormetrics.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicatormetrics.go index ac6349065ad0..0295e0c500f7 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicatormetrics.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicatormetrics.go @@ -58,7 +58,8 @@ func (client ThreatIntelligenceIndicatorMetricsClient) List(ctx context.Context, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorMetricsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicators.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicators.go index 9ce52e6e9b9b..478d354734a8 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicators.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/threatintelligenceindicators.go @@ -63,7 +63,8 @@ func (client ThreatIntelligenceIndicatorsClient) List(ctx context.Context, resou {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.ThreatIntelligenceIndicatorsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlistitems.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlistitems.go index 30e332992b79..3df50cfbb88c 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlistitems.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlistitems.go @@ -58,7 +58,8 @@ func (client WatchlistItemsClient) CreateOrUpdate(ctx context.Context, resourceG {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: watchlistItem, Constraints: []validation.Constraint{{Target: "watchlistItem.WatchlistItemProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "watchlistItem.WatchlistItemProperties.ItemsKeyValue", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -155,7 +156,8 @@ func (client WatchlistItemsClient) Delete(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.WatchlistItemsClient", "Delete", err.Error()) } @@ -246,7 +248,8 @@ func (client WatchlistItemsClient) Get(ctx context.Context, resourceGroupName st {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.WatchlistItemsClient", "Get", err.Error()) } @@ -340,7 +343,8 @@ func (client WatchlistItemsClient) List(ctx context.Context, resourceGroupName s {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.WatchlistItemsClient", "List", err.Error()) } diff --git a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlists.go b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlists.go index 10ba05d3b58b..219cdfda5d23 100644 --- a/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlists.go +++ b/vendor/github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights/watchlists.go @@ -61,7 +61,8 @@ func (client WatchlistsClient) CreateOrUpdate(ctx context.Context, resourceGroup {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, {TargetValue: watchlist, Constraints: []validation.Constraint{{Target: "watchlist.WatchlistProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "watchlist.WatchlistProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, @@ -159,7 +160,8 @@ func (client WatchlistsClient) Delete(ctx context.Context, resourceGroupName str {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.WatchlistsClient", "Delete", err.Error()) } @@ -248,7 +250,8 @@ func (client WatchlistsClient) Get(ctx context.Context, resourceGroupName string {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.WatchlistsClient", "Get", err.Error()) } @@ -340,7 +343,8 @@ func (client WatchlistsClient) List(ctx context.Context, resourceGroupName strin {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.WatchlistsClient", "List", err.Error()) } diff --git a/vendor/golang.org/x/crypto/AUTHORS b/vendor/golang.org/x/crypto/AUTHORS deleted file mode 100644 index 2b00ddba0dfe..000000000000 --- a/vendor/golang.org/x/crypto/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at https://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/crypto/CONTRIBUTORS b/vendor/golang.org/x/crypto/CONTRIBUTORS deleted file mode 100644 index 1fbd3e976faf..000000000000 --- a/vendor/golang.org/x/crypto/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at https://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/crypto/cast5/cast5.go b/vendor/golang.org/x/crypto/cast5/cast5.go index ddcbeb6f2ad1..425e8eecb06b 100644 --- a/vendor/golang.org/x/crypto/cast5/cast5.go +++ b/vendor/golang.org/x/crypto/cast5/cast5.go @@ -13,7 +13,10 @@ // golang.org/x/crypto/chacha20poly1305). package cast5 // import "golang.org/x/crypto/cast5" -import "errors" +import ( + "errors" + "math/bits" +) const BlockSize = 8 const KeySize = 16 @@ -241,19 +244,19 @@ func (c *Cipher) keySchedule(in []byte) { // These are the three 'f' functions. See RFC 2144, section 2.2. func f1(d, m uint32, r uint8) uint32 { t := m + d - I := (t << r) | (t >> (32 - r)) + I := bits.RotateLeft32(t, int(r)) return ((sBox[0][I>>24] ^ sBox[1][(I>>16)&0xff]) - sBox[2][(I>>8)&0xff]) + sBox[3][I&0xff] } func f2(d, m uint32, r uint8) uint32 { t := m ^ d - I := (t << r) | (t >> (32 - r)) + I := bits.RotateLeft32(t, int(r)) return ((sBox[0][I>>24] - sBox[1][(I>>16)&0xff]) + sBox[2][(I>>8)&0xff]) ^ sBox[3][I&0xff] } func f3(d, m uint32, r uint8) uint32 { t := m - d - I := (t << r) | (t >> (32 - r)) + I := bits.RotateLeft32(t, int(r)) return ((sBox[0][I>>24] + sBox[1][(I>>16)&0xff]) ^ sBox[2][(I>>8)&0xff]) - sBox[3][I&0xff] } diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_generic.go b/vendor/golang.org/x/crypto/chacha20/chacha_generic.go index a2ecf5c325b9..93eb5ae6de6f 100644 --- a/vendor/golang.org/x/crypto/chacha20/chacha_generic.go +++ b/vendor/golang.org/x/crypto/chacha20/chacha_generic.go @@ -12,7 +12,7 @@ import ( "errors" "math/bits" - "golang.org/x/crypto/internal/subtle" + "golang.org/x/crypto/internal/alias" ) const ( @@ -189,7 +189,7 @@ func (s *Cipher) XORKeyStream(dst, src []byte) { panic("chacha20: output smaller than input") } dst = dst[:len(src)] - if subtle.InexactOverlap(dst, src) { + if alias.InexactOverlap(dst, src) { panic("chacha20: invalid buffer overlap") } diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519.go b/vendor/golang.org/x/crypto/curve25519/curve25519.go index cda3fdd3540d..bc62161d6e42 100644 --- a/vendor/golang.org/x/crypto/curve25519/curve25519.go +++ b/vendor/golang.org/x/crypto/curve25519/curve25519.go @@ -9,7 +9,8 @@ package curve25519 // import "golang.org/x/crypto/curve25519" import ( "crypto/subtle" - "fmt" + "errors" + "strconv" "golang.org/x/crypto/curve25519/internal/field" ) @@ -124,10 +125,10 @@ func X25519(scalar, point []byte) ([]byte, error) { func x25519(dst *[32]byte, scalar, point []byte) ([]byte, error) { var in [32]byte if l := len(scalar); l != 32 { - return nil, fmt.Errorf("bad scalar length: %d, expected %d", l, 32) + return nil, errors.New("bad scalar length: " + strconv.Itoa(l) + ", expected 32") } if l := len(point); l != 32 { - return nil, fmt.Errorf("bad point length: %d, expected %d", l, 32) + return nil, errors.New("bad point length: " + strconv.Itoa(l) + ", expected 32") } copy(in[:], scalar) if &point[0] == &Basepoint[0] { @@ -138,7 +139,7 @@ func x25519(dst *[32]byte, scalar, point []byte) ([]byte, error) { copy(base[:], point) ScalarMult(dst, &in, &base) if subtle.ConstantTimeCompare(dst[:], zero[:]) == 1 { - return nil, fmt.Errorf("bad input point: low order point") + return nil, errors.New("bad input point: low order point") } } return dst[:], nil diff --git a/vendor/golang.org/x/crypto/internal/alias/alias.go b/vendor/golang.org/x/crypto/internal/alias/alias.go new file mode 100644 index 000000000000..69c17f822b9a --- /dev/null +++ b/vendor/golang.org/x/crypto/internal/alias/alias.go @@ -0,0 +1,32 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !purego +// +build !purego + +// Package alias implements memory aliasing tests. +package alias + +import "unsafe" + +// AnyOverlap reports whether x and y share memory at any (not necessarily +// corresponding) index. The memory beyond the slice length is ignored. +func AnyOverlap(x, y []byte) bool { + return len(x) > 0 && len(y) > 0 && + uintptr(unsafe.Pointer(&x[0])) <= uintptr(unsafe.Pointer(&y[len(y)-1])) && + uintptr(unsafe.Pointer(&y[0])) <= uintptr(unsafe.Pointer(&x[len(x)-1])) +} + +// InexactOverlap reports whether x and y share memory at any non-corresponding +// index. The memory beyond the slice length is ignored. Note that x and y can +// have different lengths and still not have any inexact overlap. +// +// InexactOverlap can be used to implement the requirements of the crypto/cipher +// AEAD, Block, BlockMode and Stream interfaces. +func InexactOverlap(x, y []byte) bool { + if len(x) == 0 || len(y) == 0 || &x[0] == &y[0] { + return false + } + return AnyOverlap(x, y) +} diff --git a/vendor/golang.org/x/crypto/internal/alias/alias_purego.go b/vendor/golang.org/x/crypto/internal/alias/alias_purego.go new file mode 100644 index 000000000000..4775b0a43843 --- /dev/null +++ b/vendor/golang.org/x/crypto/internal/alias/alias_purego.go @@ -0,0 +1,35 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build purego +// +build purego + +// Package alias implements memory aliasing tests. +package alias + +// This is the Google App Engine standard variant based on reflect +// because the unsafe package and cgo are disallowed. + +import "reflect" + +// AnyOverlap reports whether x and y share memory at any (not necessarily +// corresponding) index. The memory beyond the slice length is ignored. +func AnyOverlap(x, y []byte) bool { + return len(x) > 0 && len(y) > 0 && + reflect.ValueOf(&x[0]).Pointer() <= reflect.ValueOf(&y[len(y)-1]).Pointer() && + reflect.ValueOf(&y[0]).Pointer() <= reflect.ValueOf(&x[len(x)-1]).Pointer() +} + +// InexactOverlap reports whether x and y share memory at any non-corresponding +// index. The memory beyond the slice length is ignored. Note that x and y can +// have different lengths and still not have any inexact overlap. +// +// InexactOverlap can be used to implement the requirements of the crypto/cipher +// AEAD, Block, BlockMode and Stream interfaces. +func InexactOverlap(x, y []byte) bool { + if len(x) == 0 || len(y) == 0 || &x[0] == &y[0] { + return false + } + return AnyOverlap(x, y) +} diff --git a/vendor/golang.org/x/crypto/internal/subtle/aliasing.go b/vendor/golang.org/x/crypto/internal/subtle/aliasing.go deleted file mode 100644 index 4fad24f8dcde..000000000000 --- a/vendor/golang.org/x/crypto/internal/subtle/aliasing.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !purego -// +build !purego - -// Package subtle implements functions that are often useful in cryptographic -// code but require careful thought to use correctly. -package subtle // import "golang.org/x/crypto/internal/subtle" - -import "unsafe" - -// AnyOverlap reports whether x and y share memory at any (not necessarily -// corresponding) index. The memory beyond the slice length is ignored. -func AnyOverlap(x, y []byte) bool { - return len(x) > 0 && len(y) > 0 && - uintptr(unsafe.Pointer(&x[0])) <= uintptr(unsafe.Pointer(&y[len(y)-1])) && - uintptr(unsafe.Pointer(&y[0])) <= uintptr(unsafe.Pointer(&x[len(x)-1])) -} - -// InexactOverlap reports whether x and y share memory at any non-corresponding -// index. The memory beyond the slice length is ignored. Note that x and y can -// have different lengths and still not have any inexact overlap. -// -// InexactOverlap can be used to implement the requirements of the crypto/cipher -// AEAD, Block, BlockMode and Stream interfaces. -func InexactOverlap(x, y []byte) bool { - if len(x) == 0 || len(y) == 0 || &x[0] == &y[0] { - return false - } - return AnyOverlap(x, y) -} diff --git a/vendor/golang.org/x/crypto/internal/subtle/aliasing_purego.go b/vendor/golang.org/x/crypto/internal/subtle/aliasing_purego.go deleted file mode 100644 index 80ccbed2c0de..000000000000 --- a/vendor/golang.org/x/crypto/internal/subtle/aliasing_purego.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build purego -// +build purego - -// Package subtle implements functions that are often useful in cryptographic -// code but require careful thought to use correctly. -package subtle // import "golang.org/x/crypto/internal/subtle" - -// This is the Google App Engine standard variant based on reflect -// because the unsafe package and cgo are disallowed. - -import "reflect" - -// AnyOverlap reports whether x and y share memory at any (not necessarily -// corresponding) index. The memory beyond the slice length is ignored. -func AnyOverlap(x, y []byte) bool { - return len(x) > 0 && len(y) > 0 && - reflect.ValueOf(&x[0]).Pointer() <= reflect.ValueOf(&y[len(y)-1]).Pointer() && - reflect.ValueOf(&y[0]).Pointer() <= reflect.ValueOf(&x[len(x)-1]).Pointer() -} - -// InexactOverlap reports whether x and y share memory at any non-corresponding -// index. The memory beyond the slice length is ignored. Note that x and y can -// have different lengths and still not have any inexact overlap. -// -// InexactOverlap can be used to implement the requirements of the crypto/cipher -// AEAD, Block, BlockMode and Stream interfaces. -func InexactOverlap(x, y []byte) bool { - if len(x) == 0 || len(y) == 0 || &x[0] == &y[0] { - return false - } - return AnyOverlap(x, y) -} diff --git a/vendor/golang.org/x/crypto/openpgp/armor/armor.go b/vendor/golang.org/x/crypto/openpgp/armor/armor.go index be342ad473a2..8907183ec0ab 100644 --- a/vendor/golang.org/x/crypto/openpgp/armor/armor.go +++ b/vendor/golang.org/x/crypto/openpgp/armor/armor.go @@ -156,7 +156,7 @@ func (r *openpgpReader) Read(p []byte) (n int, err error) { n, err = r.b64Reader.Read(p) r.currentCRC = crc24(r.currentCRC, p[:n]) - if err == io.EOF && r.lReader.crcSet && r.lReader.crc != uint32(r.currentCRC&crc24Mask) { + if err == io.EOF && r.lReader.crcSet && r.lReader.crc != r.currentCRC&crc24Mask { return 0, ArmorCorrupt } diff --git a/vendor/golang.org/x/crypto/openpgp/packet/opaque.go b/vendor/golang.org/x/crypto/openpgp/packet/opaque.go index 456d807f255c..3984477310fe 100644 --- a/vendor/golang.org/x/crypto/openpgp/packet/opaque.go +++ b/vendor/golang.org/x/crypto/openpgp/packet/opaque.go @@ -7,7 +7,6 @@ package packet import ( "bytes" "io" - "io/ioutil" "golang.org/x/crypto/openpgp/errors" ) @@ -26,7 +25,7 @@ type OpaquePacket struct { } func (op *OpaquePacket) parse(r io.Reader) (err error) { - op.Contents, err = ioutil.ReadAll(r) + op.Contents, err = io.ReadAll(r) return } diff --git a/vendor/golang.org/x/crypto/openpgp/packet/private_key.go b/vendor/golang.org/x/crypto/openpgp/packet/private_key.go index 81abb7cef98f..192aac376d1a 100644 --- a/vendor/golang.org/x/crypto/openpgp/packet/private_key.go +++ b/vendor/golang.org/x/crypto/openpgp/packet/private_key.go @@ -13,7 +13,6 @@ import ( "crypto/rsa" "crypto/sha1" "io" - "io/ioutil" "math/big" "strconv" "time" @@ -133,7 +132,7 @@ func (pk *PrivateKey) parse(r io.Reader) (err error) { } } - pk.encryptedData, err = ioutil.ReadAll(r) + pk.encryptedData, err = io.ReadAll(r) if err != nil { return } diff --git a/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go b/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go index 6126030eb903..1a1a62964fc9 100644 --- a/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go +++ b/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go @@ -236,7 +236,7 @@ func (w *seMDCWriter) Close() (err error) { return w.w.Close() } -// noOpCloser is like an ioutil.NopCloser, but for an io.Writer. +// noOpCloser is like an io.NopCloser, but for an io.Writer. type noOpCloser struct { w io.Writer } diff --git a/vendor/golang.org/x/crypto/openpgp/packet/userattribute.go b/vendor/golang.org/x/crypto/openpgp/packet/userattribute.go index d19ffbc78671..ff7ef5307557 100644 --- a/vendor/golang.org/x/crypto/openpgp/packet/userattribute.go +++ b/vendor/golang.org/x/crypto/openpgp/packet/userattribute.go @@ -9,7 +9,6 @@ import ( "image" "image/jpeg" "io" - "io/ioutil" ) const UserAttrImageSubpacket = 1 @@ -56,7 +55,7 @@ func NewUserAttribute(contents ...*OpaqueSubpacket) *UserAttribute { func (uat *UserAttribute) parse(r io.Reader) (err error) { // RFC 4880, section 5.13 - b, err := ioutil.ReadAll(r) + b, err := io.ReadAll(r) if err != nil { return } diff --git a/vendor/golang.org/x/crypto/openpgp/packet/userid.go b/vendor/golang.org/x/crypto/openpgp/packet/userid.go index d6bea7d4acc0..359a462eb8ab 100644 --- a/vendor/golang.org/x/crypto/openpgp/packet/userid.go +++ b/vendor/golang.org/x/crypto/openpgp/packet/userid.go @@ -6,7 +6,6 @@ package packet import ( "io" - "io/ioutil" "strings" ) @@ -66,7 +65,7 @@ func NewUserId(name, comment, email string) *UserId { func (uid *UserId) parse(r io.Reader) (err error) { // RFC 4880, section 5.11 - b, err := ioutil.ReadAll(r) + b, err := io.ReadAll(r) if err != nil { return } diff --git a/vendor/golang.org/x/crypto/openpgp/s2k/s2k.go b/vendor/golang.org/x/crypto/openpgp/s2k/s2k.go index 9de04958ead0..f53244a1c7b5 100644 --- a/vendor/golang.org/x/crypto/openpgp/s2k/s2k.go +++ b/vendor/golang.org/x/crypto/openpgp/s2k/s2k.go @@ -268,7 +268,7 @@ func HashIdToString(id byte) (name string, ok bool) { return "", false } -// HashIdToHash returns an OpenPGP hash id which corresponds the given Hash. +// HashToHashId returns an OpenPGP hash id which corresponds the given Hash. func HashToHashId(h crypto.Hash) (id byte, ok bool) { for _, m := range hashToHashIdMapping { if m.hash == h { diff --git a/vendor/golang.org/x/crypto/openpgp/write.go b/vendor/golang.org/x/crypto/openpgp/write.go index 4ee71784ebe0..b89d48b81d73 100644 --- a/vendor/golang.org/x/crypto/openpgp/write.go +++ b/vendor/golang.org/x/crypto/openpgp/write.go @@ -402,7 +402,7 @@ func (s signatureWriter) Close() error { return s.encryptedData.Close() } -// noOpCloser is like an ioutil.NopCloser, but for an io.Writer. +// noOpCloser is like an io.NopCloser, but for an io.Writer. // TODO: we have two of these in OpenPGP packages alone. This probably needs // to be promoted somewhere more common. type noOpCloser struct { diff --git a/vendor/golang.org/x/crypto/pkcs12/crypto.go b/vendor/golang.org/x/crypto/pkcs12/crypto.go index 484ca51b7154..96f4a1a56eca 100644 --- a/vendor/golang.org/x/crypto/pkcs12/crypto.go +++ b/vendor/golang.org/x/crypto/pkcs12/crypto.go @@ -117,7 +117,7 @@ func pbDecrypt(info decryptable, password []byte) (decrypted []byte, err error) } ps := decrypted[len(decrypted)-psLen:] decrypted = decrypted[:len(decrypted)-psLen] - if bytes.Compare(ps, bytes.Repeat([]byte{byte(psLen)}, psLen)) != 0 { + if !bytes.Equal(ps, bytes.Repeat([]byte{byte(psLen)}, psLen)) { return nil, ErrDecryption } diff --git a/vendor/golang.org/x/crypto/pkcs12/internal/rc2/rc2.go b/vendor/golang.org/x/crypto/pkcs12/internal/rc2/rc2.go index 7499e3fb69d2..05de9cc2cdcc 100644 --- a/vendor/golang.org/x/crypto/pkcs12/internal/rc2/rc2.go +++ b/vendor/golang.org/x/crypto/pkcs12/internal/rc2/rc2.go @@ -14,6 +14,7 @@ package rc2 import ( "crypto/cipher" "encoding/binary" + "math/bits" ) // The rc2 block size in bytes @@ -80,10 +81,6 @@ func expandKey(key []byte, t1 int) [64]uint16 { return k } -func rotl16(x uint16, b uint) uint16 { - return (x >> (16 - b)) | (x << b) -} - func (c *rc2Cipher) Encrypt(dst, src []byte) { r0 := binary.LittleEndian.Uint16(src[0:]) @@ -96,22 +93,22 @@ func (c *rc2Cipher) Encrypt(dst, src []byte) { for j <= 16 { // mix r0 r0 = r0 + c.k[j] + (r3 & r2) + ((^r3) & r1) - r0 = rotl16(r0, 1) + r0 = bits.RotateLeft16(r0, 1) j++ // mix r1 r1 = r1 + c.k[j] + (r0 & r3) + ((^r0) & r2) - r1 = rotl16(r1, 2) + r1 = bits.RotateLeft16(r1, 2) j++ // mix r2 r2 = r2 + c.k[j] + (r1 & r0) + ((^r1) & r3) - r2 = rotl16(r2, 3) + r2 = bits.RotateLeft16(r2, 3) j++ // mix r3 r3 = r3 + c.k[j] + (r2 & r1) + ((^r2) & r0) - r3 = rotl16(r3, 5) + r3 = bits.RotateLeft16(r3, 5) j++ } @@ -124,22 +121,22 @@ func (c *rc2Cipher) Encrypt(dst, src []byte) { for j <= 40 { // mix r0 r0 = r0 + c.k[j] + (r3 & r2) + ((^r3) & r1) - r0 = rotl16(r0, 1) + r0 = bits.RotateLeft16(r0, 1) j++ // mix r1 r1 = r1 + c.k[j] + (r0 & r3) + ((^r0) & r2) - r1 = rotl16(r1, 2) + r1 = bits.RotateLeft16(r1, 2) j++ // mix r2 r2 = r2 + c.k[j] + (r1 & r0) + ((^r1) & r3) - r2 = rotl16(r2, 3) + r2 = bits.RotateLeft16(r2, 3) j++ // mix r3 r3 = r3 + c.k[j] + (r2 & r1) + ((^r2) & r0) - r3 = rotl16(r3, 5) + r3 = bits.RotateLeft16(r3, 5) j++ } @@ -152,22 +149,22 @@ func (c *rc2Cipher) Encrypt(dst, src []byte) { for j <= 60 { // mix r0 r0 = r0 + c.k[j] + (r3 & r2) + ((^r3) & r1) - r0 = rotl16(r0, 1) + r0 = bits.RotateLeft16(r0, 1) j++ // mix r1 r1 = r1 + c.k[j] + (r0 & r3) + ((^r0) & r2) - r1 = rotl16(r1, 2) + r1 = bits.RotateLeft16(r1, 2) j++ // mix r2 r2 = r2 + c.k[j] + (r1 & r0) + ((^r1) & r3) - r2 = rotl16(r2, 3) + r2 = bits.RotateLeft16(r2, 3) j++ // mix r3 r3 = r3 + c.k[j] + (r2 & r1) + ((^r2) & r0) - r3 = rotl16(r3, 5) + r3 = bits.RotateLeft16(r3, 5) j++ } @@ -188,22 +185,22 @@ func (c *rc2Cipher) Decrypt(dst, src []byte) { for j >= 44 { // unmix r3 - r3 = rotl16(r3, 16-5) + r3 = bits.RotateLeft16(r3, 16-5) r3 = r3 - c.k[j] - (r2 & r1) - ((^r2) & r0) j-- // unmix r2 - r2 = rotl16(r2, 16-3) + r2 = bits.RotateLeft16(r2, 16-3) r2 = r2 - c.k[j] - (r1 & r0) - ((^r1) & r3) j-- // unmix r1 - r1 = rotl16(r1, 16-2) + r1 = bits.RotateLeft16(r1, 16-2) r1 = r1 - c.k[j] - (r0 & r3) - ((^r0) & r2) j-- // unmix r0 - r0 = rotl16(r0, 16-1) + r0 = bits.RotateLeft16(r0, 16-1) r0 = r0 - c.k[j] - (r3 & r2) - ((^r3) & r1) j-- } @@ -215,22 +212,22 @@ func (c *rc2Cipher) Decrypt(dst, src []byte) { for j >= 20 { // unmix r3 - r3 = rotl16(r3, 16-5) + r3 = bits.RotateLeft16(r3, 16-5) r3 = r3 - c.k[j] - (r2 & r1) - ((^r2) & r0) j-- // unmix r2 - r2 = rotl16(r2, 16-3) + r2 = bits.RotateLeft16(r2, 16-3) r2 = r2 - c.k[j] - (r1 & r0) - ((^r1) & r3) j-- // unmix r1 - r1 = rotl16(r1, 16-2) + r1 = bits.RotateLeft16(r1, 16-2) r1 = r1 - c.k[j] - (r0 & r3) - ((^r0) & r2) j-- // unmix r0 - r0 = rotl16(r0, 16-1) + r0 = bits.RotateLeft16(r0, 16-1) r0 = r0 - c.k[j] - (r3 & r2) - ((^r3) & r1) j-- @@ -243,22 +240,22 @@ func (c *rc2Cipher) Decrypt(dst, src []byte) { for j >= 0 { // unmix r3 - r3 = rotl16(r3, 16-5) + r3 = bits.RotateLeft16(r3, 16-5) r3 = r3 - c.k[j] - (r2 & r1) - ((^r2) & r0) j-- // unmix r2 - r2 = rotl16(r2, 16-3) + r2 = bits.RotateLeft16(r2, 16-3) r2 = r2 - c.k[j] - (r1 & r0) - ((^r1) & r3) j-- // unmix r1 - r1 = rotl16(r1, 16-2) + r1 = bits.RotateLeft16(r1, 16-2) r1 = r1 - c.k[j] - (r0 & r3) - ((^r0) & r2) j-- // unmix r0 - r0 = rotl16(r0, 16-1) + r0 = bits.RotateLeft16(r0, 16-1) r0 = r0 - c.k[j] - (r3 & r2) - ((^r3) & r1) j-- diff --git a/vendor/golang.org/x/crypto/ssh/certs.go b/vendor/golang.org/x/crypto/ssh/certs.go index 4600c20772a5..fc04d03e1987 100644 --- a/vendor/golang.org/x/crypto/ssh/certs.go +++ b/vendor/golang.org/x/crypto/ssh/certs.go @@ -251,7 +251,7 @@ type algorithmOpenSSHCertSigner struct { // private key is held by signer. It returns an error if the public key in cert // doesn't match the key used by signer. func NewCertSigner(cert *Certificate, signer Signer) (Signer, error) { - if bytes.Compare(cert.Key.Marshal(), signer.PublicKey().Marshal()) != 0 { + if !bytes.Equal(cert.Key.Marshal(), signer.PublicKey().Marshal()) { return nil, errors.New("ssh: signer and cert have different public key") } diff --git a/vendor/golang.org/x/crypto/ssh/cipher.go b/vendor/golang.org/x/crypto/ssh/cipher.go index 770e8a663913..87f48552ce03 100644 --- a/vendor/golang.org/x/crypto/ssh/cipher.go +++ b/vendor/golang.org/x/crypto/ssh/cipher.go @@ -15,7 +15,6 @@ import ( "fmt" "hash" "io" - "io/ioutil" "golang.org/x/crypto/chacha20" "golang.org/x/crypto/internal/poly1305" @@ -97,13 +96,13 @@ func streamCipherMode(skip int, createFunc func(key, iv []byte) (cipher.Stream, // are not supported and will not be negotiated, even if explicitly requested in // ClientConfig.Crypto.Ciphers. var cipherModes = map[string]*cipherMode{ - // Ciphers from RFC4344, which introduced many CTR-based ciphers. Algorithms + // Ciphers from RFC 4344, which introduced many CTR-based ciphers. Algorithms // are defined in the order specified in the RFC. "aes128-ctr": {16, aes.BlockSize, streamCipherMode(0, newAESCTR)}, "aes192-ctr": {24, aes.BlockSize, streamCipherMode(0, newAESCTR)}, "aes256-ctr": {32, aes.BlockSize, streamCipherMode(0, newAESCTR)}, - // Ciphers from RFC4345, which introduces security-improved arcfour ciphers. + // Ciphers from RFC 4345, which introduces security-improved arcfour ciphers. // They are defined in the order specified in the RFC. "arcfour128": {16, 0, streamCipherMode(1536, newRC4)}, "arcfour256": {32, 0, streamCipherMode(1536, newRC4)}, @@ -111,7 +110,7 @@ var cipherModes = map[string]*cipherMode{ // Cipher defined in RFC 4253, which describes SSH Transport Layer Protocol. // Note that this cipher is not safe, as stated in RFC 4253: "Arcfour (and // RC4) has problems with weak keys, and should be used with caution." - // RFC4345 introduces improved versions of Arcfour. + // RFC 4345 introduces improved versions of Arcfour. "arcfour": {16, 0, streamCipherMode(0, newRC4)}, // AEAD ciphers @@ -497,7 +496,7 @@ func (c *cbcCipher) readCipherPacket(seqNum uint32, r io.Reader) ([]byte, error) // data, to make distinguishing between // failing MAC and failing length check more // difficult. - io.CopyN(ioutil.Discard, r, int64(c.oracleCamouflage)) + io.CopyN(io.Discard, r, int64(c.oracleCamouflage)) } } return p, err @@ -642,7 +641,7 @@ const chacha20Poly1305ID = "chacha20-poly1305@openssh.com" // // https://tools.ietf.org/html/draft-josefsson-ssh-chacha20-poly1305-openssh-00 // -// the methods here also implement padding, which RFC4253 Section 6 +// the methods here also implement padding, which RFC 4253 Section 6 // also requires of stream ciphers. type chacha20Poly1305Cipher struct { lengthKey [32]byte diff --git a/vendor/golang.org/x/crypto/ssh/common.go b/vendor/golang.org/x/crypto/ssh/common.go index 2a47a61ded9c..c7964275de70 100644 --- a/vendor/golang.org/x/crypto/ssh/common.go +++ b/vendor/golang.org/x/crypto/ssh/common.go @@ -10,6 +10,7 @@ import ( "fmt" "io" "math" + "strings" "sync" _ "crypto/sha1" @@ -118,6 +119,20 @@ func algorithmsForKeyFormat(keyFormat string) []string { } } +// supportedPubKeyAuthAlgos specifies the supported client public key +// authentication algorithms. Note that this doesn't include certificate types +// since those use the underlying algorithm. This list is sent to the client if +// it supports the server-sig-algs extension. Order is irrelevant. +var supportedPubKeyAuthAlgos = []string{ + KeyAlgoED25519, + KeyAlgoSKED25519, KeyAlgoSKECDSA256, + KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521, + KeyAlgoRSASHA256, KeyAlgoRSASHA512, KeyAlgoRSA, + KeyAlgoDSA, +} + +var supportedPubKeyAuthAlgosList = strings.Join(supportedPubKeyAuthAlgos, ",") + // unexpectedMessageError results when the SSH message that we received didn't // match what we wanted. func unexpectedMessageError(expected, got uint8) error { @@ -149,7 +164,7 @@ type directionAlgorithms struct { // rekeyBytes returns a rekeying intervals in bytes. func (a *directionAlgorithms) rekeyBytes() int64 { - // According to RFC4344 block ciphers should rekey after + // According to RFC 4344 block ciphers should rekey after // 2^(BLOCKSIZE/4) blocks. For all AES flavors BLOCKSIZE is // 128. switch a.Cipher { @@ -158,7 +173,7 @@ func (a *directionAlgorithms) rekeyBytes() int64 { } - // For others, stick with RFC4253 recommendation to rekey after 1 Gb of data. + // For others, stick with RFC 4253 recommendation to rekey after 1 Gb of data. return 1 << 30 } diff --git a/vendor/golang.org/x/crypto/ssh/connection.go b/vendor/golang.org/x/crypto/ssh/connection.go index fd6b0681b512..35661a52be30 100644 --- a/vendor/golang.org/x/crypto/ssh/connection.go +++ b/vendor/golang.org/x/crypto/ssh/connection.go @@ -52,7 +52,7 @@ type Conn interface { // SendRequest sends a global request, and returns the // reply. If wantReply is true, it returns the response status - // and payload. See also RFC4254, section 4. + // and payload. See also RFC 4254, section 4. SendRequest(name string, wantReply bool, payload []byte) (bool, []byte, error) // OpenChannel tries to open an channel. If the request is diff --git a/vendor/golang.org/x/crypto/ssh/handshake.go b/vendor/golang.org/x/crypto/ssh/handshake.go index 653dc4d2cfbe..07a1843e0a52 100644 --- a/vendor/golang.org/x/crypto/ssh/handshake.go +++ b/vendor/golang.org/x/crypto/ssh/handshake.go @@ -58,11 +58,13 @@ type handshakeTransport struct { incoming chan []byte readError error - mu sync.Mutex - writeError error - sentInitPacket []byte - sentInitMsg *kexInitMsg - pendingPackets [][]byte // Used when a key exchange is in progress. + mu sync.Mutex + writeError error + sentInitPacket []byte + sentInitMsg *kexInitMsg + pendingPackets [][]byte // Used when a key exchange is in progress. + writePacketsLeft uint32 + writeBytesLeft int64 // If the read loop wants to schedule a kex, it pings this // channel, and the write loop will send out a kex @@ -71,7 +73,8 @@ type handshakeTransport struct { // If the other side requests or confirms a kex, its kexInit // packet is sent here for the write loop to find it. - startKex chan *pendingKex + startKex chan *pendingKex + kexLoopDone chan struct{} // closed (with writeError non-nil) when kexLoop exits // data for host key checking hostKeyCallback HostKeyCallback @@ -86,12 +89,10 @@ type handshakeTransport struct { // Algorithms agreed in the last key exchange. algorithms *algorithms + // Counters exclusively owned by readLoop. readPacketsLeft uint32 readBytesLeft int64 - writePacketsLeft uint32 - writeBytesLeft int64 - // The session ID or nil if first kex did not complete yet. sessionID []byte } @@ -108,7 +109,8 @@ func newHandshakeTransport(conn keyingTransport, config *Config, clientVersion, clientVersion: clientVersion, incoming: make(chan []byte, chanSize), requestKex: make(chan struct{}, 1), - startKex: make(chan *pendingKex, 1), + startKex: make(chan *pendingKex), + kexLoopDone: make(chan struct{}), config: config, } @@ -340,16 +342,17 @@ write: t.mu.Unlock() } + // Unblock reader. + t.conn.Close() + // drain startKex channel. We don't service t.requestKex // because nobody does blocking sends there. - go func() { - for init := range t.startKex { - init.done <- t.writeError - } - }() + for request := range t.startKex { + request.done <- t.getWriteError() + } - // Unblock reader. - t.conn.Close() + // Mark that the loop is done so that Close can return. + close(t.kexLoopDone) } // The protocol uses uint32 for packet counters, so we can't let them @@ -545,7 +548,16 @@ func (t *handshakeTransport) writePacket(p []byte) error { } func (t *handshakeTransport) Close() error { - return t.conn.Close() + // Close the connection. This should cause the readLoop goroutine to wake up + // and close t.startKex, which will shut down kexLoop if running. + err := t.conn.Close() + + // Wait for the kexLoop goroutine to complete. + // At that point we know that the readLoop goroutine is complete too, + // because kexLoop itself waits for readLoop to close the startKex channel. + <-t.kexLoopDone + + return err } func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error { @@ -615,7 +627,8 @@ func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error { return err } - if t.sessionID == nil { + firstKeyExchange := t.sessionID == nil + if firstKeyExchange { t.sessionID = result.H } result.SessionID = t.sessionID @@ -626,6 +639,24 @@ func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error { if err = t.conn.writePacket([]byte{msgNewKeys}); err != nil { return err } + + // On the server side, after the first SSH_MSG_NEWKEYS, send a SSH_MSG_EXT_INFO + // message with the server-sig-algs extension if the client supports it. See + // RFC 8308, Sections 2.4 and 3.1. + if !isClient && firstKeyExchange && contains(clientInit.KexAlgos, "ext-info-c") { + extInfo := &extInfoMsg{ + NumExtensions: 1, + Payload: make([]byte, 0, 4+15+4+len(supportedPubKeyAuthAlgosList)), + } + extInfo.Payload = appendInt(extInfo.Payload, len("server-sig-algs")) + extInfo.Payload = append(extInfo.Payload, "server-sig-algs"...) + extInfo.Payload = appendInt(extInfo.Payload, len(supportedPubKeyAuthAlgosList)) + extInfo.Payload = append(extInfo.Payload, supportedPubKeyAuthAlgosList...) + if err := t.conn.writePacket(Marshal(extInfo)); err != nil { + return err + } + } + if packet, err := t.conn.readPacket(); err != nil { return err } else if packet[0] != msgNewKeys { diff --git a/vendor/golang.org/x/crypto/ssh/keys.go b/vendor/golang.org/x/crypto/ssh/keys.go index 1c7de1a6dd79..729698041352 100644 --- a/vendor/golang.org/x/crypto/ssh/keys.go +++ b/vendor/golang.org/x/crypto/ssh/keys.go @@ -184,7 +184,7 @@ func ParseKnownHosts(in []byte) (marker string, hosts []string, pubKey PublicKey return "", nil, nil, "", nil, io.EOF } -// ParseAuthorizedKeys parses a public key from an authorized_keys +// ParseAuthorizedKey parses a public key from an authorized_keys // file used in OpenSSH according to the sshd(8) manual page. func ParseAuthorizedKey(in []byte) (out PublicKey, comment string, options []string, rest []byte, err error) { for len(in) > 0 { diff --git a/vendor/golang.org/x/crypto/ssh/messages.go b/vendor/golang.org/x/crypto/ssh/messages.go index 19bc67c46422..922032d95256 100644 --- a/vendor/golang.org/x/crypto/ssh/messages.go +++ b/vendor/golang.org/x/crypto/ssh/messages.go @@ -68,7 +68,7 @@ type kexInitMsg struct { // See RFC 4253, section 8. -// Diffie-Helman +// Diffie-Hellman const msgKexDHInit = 30 type kexDHInitMsg struct { diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go index 70045bdfd82d..9e3870292fae 100644 --- a/vendor/golang.org/x/crypto/ssh/server.go +++ b/vendor/golang.org/x/crypto/ssh/server.go @@ -68,8 +68,16 @@ type ServerConfig struct { // NoClientAuth is true if clients are allowed to connect without // authenticating. + // To determine NoClientAuth at runtime, set NoClientAuth to true + // and the optional NoClientAuthCallback to a non-nil value. NoClientAuth bool + // NoClientAuthCallback, if non-nil, is called when a user + // attempts to authenticate with auth method "none". + // NoClientAuth must also be set to true for this be used, or + // this func is unused. + NoClientAuthCallback func(ConnMetadata) (*Permissions, error) + // MaxAuthTries specifies the maximum number of authentication attempts // permitted per connection. If set to a negative number, the number of // attempts are unlimited. If set to zero, the number of attempts are limited @@ -283,15 +291,6 @@ func (s *connection) serverHandshake(config *ServerConfig) (*Permissions, error) return perms, err } -func isAcceptableAlgo(algo string) bool { - switch algo { - case KeyAlgoRSA, KeyAlgoRSASHA256, KeyAlgoRSASHA512, KeyAlgoDSA, KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521, KeyAlgoSKECDSA256, KeyAlgoED25519, KeyAlgoSKED25519, - CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01, CertAlgoECDSA384v01, CertAlgoECDSA521v01, CertAlgoSKECDSA256v01, CertAlgoED25519v01, CertAlgoSKED25519v01: - return true - } - return false -} - func checkSourceAddress(addr net.Addr, sourceAddrs string) error { if addr == nil { return errors.New("ssh: no address known for client, but source-address match required") @@ -455,7 +454,11 @@ userAuthLoop: switch userAuthReq.Method { case "none": if config.NoClientAuth { - authErr = nil + if config.NoClientAuthCallback != nil { + perms, authErr = config.NoClientAuthCallback(s) + } else { + authErr = nil + } } // allow initial attempt of 'none' without penalty @@ -502,7 +505,7 @@ userAuthLoop: return nil, parseError(msgUserAuthRequest) } algo := string(algoBytes) - if !isAcceptableAlgo(algo) { + if !contains(supportedPubKeyAuthAlgos, underlyingAlgo(algo)) { authErr = fmt.Errorf("ssh: algorithm %q not accepted", algo) break } @@ -560,7 +563,7 @@ userAuthLoop: // algorithm name that corresponds to algo with // sig.Format. This is usually the same, but // for certs, the names differ. - if !isAcceptableAlgo(sig.Format) { + if !contains(supportedPubKeyAuthAlgos, sig.Format) { authErr = fmt.Errorf("ssh: algorithm %q not accepted", sig.Format) break } diff --git a/vendor/golang.org/x/crypto/ssh/session.go b/vendor/golang.org/x/crypto/ssh/session.go index eca31a22d593..acef62259fde 100644 --- a/vendor/golang.org/x/crypto/ssh/session.go +++ b/vendor/golang.org/x/crypto/ssh/session.go @@ -13,7 +13,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "sync" ) @@ -124,7 +123,7 @@ type Session struct { // output and error. // // If either is nil, Run connects the corresponding file - // descriptor to an instance of ioutil.Discard. There is a + // descriptor to an instance of io.Discard. There is a // fixed amount of buffering that is shared for the two streams. // If either blocks it may eventually cause the remote // command to block. @@ -506,7 +505,7 @@ func (s *Session) stdout() { return } if s.Stdout == nil { - s.Stdout = ioutil.Discard + s.Stdout = io.Discard } s.copyFuncs = append(s.copyFuncs, func() error { _, err := io.Copy(s.Stdout, s.ch) @@ -519,7 +518,7 @@ func (s *Session) stderr() { return } if s.Stderr == nil { - s.Stderr = ioutil.Discard + s.Stderr = io.Discard } s.copyFuncs = append(s.copyFuncs, func() error { _, err := io.Copy(s.Stderr, s.ch.Stderr()) diff --git a/vendor/golang.org/x/mod/module/module.go b/vendor/golang.org/x/mod/module/module.go index ba97ac356e9c..c26d1d29ec3d 100644 --- a/vendor/golang.org/x/mod/module/module.go +++ b/vendor/golang.org/x/mod/module/module.go @@ -15,7 +15,7 @@ // but additional checking functions, most notably Check, verify that // a particular path, version pair is valid. // -// Escaped Paths +// # Escaped Paths // // Module paths appear as substrings of file system paths // (in the download cache) and of web server URLs in the proxy protocol. @@ -55,7 +55,7 @@ // Import paths have never allowed exclamation marks, so there is no // need to define how to escape a literal !. // -// Unicode Restrictions +// # Unicode Restrictions // // Today, paths are disallowed from using Unicode. // @@ -102,9 +102,9 @@ import ( "strings" "unicode" "unicode/utf8" + "errors" "golang.org/x/mod/semver" - errors "golang.org/x/xerrors" ) // A Version (for clients, a module.Version) is defined by a module path and version pair. @@ -286,12 +286,7 @@ func fileNameOK(r rune) bool { if '0' <= r && r <= '9' || 'A' <= r && r <= 'Z' || 'a' <= r && r <= 'z' { return true } - for i := 0; i < len(allowed); i++ { - if rune(allowed[i]) == r { - return true - } - } - return false + return strings.ContainsRune(allowed, r) } // It may be OK to add more ASCII punctuation here, but only carefully. // For example Windows disallows < > \, and macOS disallows :, so we must not allow those. @@ -803,6 +798,7 @@ func unescapeString(escaped string) (string, bool) { // GOPRIVATE environment variable, as described by 'go help module-private'. // // It ignores any empty or malformed patterns in the list. +// Trailing slashes on patterns are ignored. func MatchPrefixPatterns(globs, target string) bool { for globs != "" { // Extract next non-empty glob in comma-separated list. @@ -812,6 +808,7 @@ func MatchPrefixPatterns(globs, target string) bool { } else { glob, globs = globs, "" } + glob = strings.TrimSuffix(glob, "/") if glob == "" { continue } diff --git a/vendor/golang.org/x/mod/semver/semver.go b/vendor/golang.org/x/mod/semver/semver.go index 7be398f80d33..a30a22bf20f1 100644 --- a/vendor/golang.org/x/mod/semver/semver.go +++ b/vendor/golang.org/x/mod/semver/semver.go @@ -32,7 +32,6 @@ type parsed struct { short string prerelease string build string - err string } // IsValid reports whether v is a valid semantic version string. @@ -172,12 +171,10 @@ func Sort(list []string) { func parse(v string) (p parsed, ok bool) { if v == "" || v[0] != 'v' { - p.err = "missing v prefix" return } p.major, v, ok = parseInt(v[1:]) if !ok { - p.err = "bad major version" return } if v == "" { @@ -187,13 +184,11 @@ func parse(v string) (p parsed, ok bool) { return } if v[0] != '.' { - p.err = "bad minor prefix" ok = false return } p.minor, v, ok = parseInt(v[1:]) if !ok { - p.err = "bad minor version" return } if v == "" { @@ -202,31 +197,26 @@ func parse(v string) (p parsed, ok bool) { return } if v[0] != '.' { - p.err = "bad patch prefix" ok = false return } p.patch, v, ok = parseInt(v[1:]) if !ok { - p.err = "bad patch version" return } if len(v) > 0 && v[0] == '-' { p.prerelease, v, ok = parsePrerelease(v) if !ok { - p.err = "bad prerelease" return } } if len(v) > 0 && v[0] == '+' { p.build, v, ok = parseBuild(v) if !ok { - p.err = "bad build" return } } if v != "" { - p.err = "junk on end" ok = false return } diff --git a/vendor/golang.org/x/net/AUTHORS b/vendor/golang.org/x/net/AUTHORS deleted file mode 100644 index 15167cd746c5..000000000000 --- a/vendor/golang.org/x/net/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/net/CONTRIBUTORS b/vendor/golang.org/x/net/CONTRIBUTORS deleted file mode 100644 index 1c4577e96806..000000000000 --- a/vendor/golang.org/x/net/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/net/context/context.go b/vendor/golang.org/x/net/context/context.go index a3c021d3f88e..cf66309c4a8b 100644 --- a/vendor/golang.org/x/net/context/context.go +++ b/vendor/golang.org/x/net/context/context.go @@ -21,9 +21,9 @@ // explicitly to each function that needs it. The Context should be the first // parameter, typically named ctx: // -// func DoSomething(ctx context.Context, arg Arg) error { -// // ... use ctx ... -// } +// func DoSomething(ctx context.Context, arg Arg) error { +// // ... use ctx ... +// } // // Do not pass a nil Context, even if a function permits it. Pass context.TODO // if you are unsure about which Context to use. diff --git a/vendor/golang.org/x/net/context/go17.go b/vendor/golang.org/x/net/context/go17.go index 344bd1433450..2cb9c408f2e7 100644 --- a/vendor/golang.org/x/net/context/go17.go +++ b/vendor/golang.org/x/net/context/go17.go @@ -32,7 +32,7 @@ var DeadlineExceeded = context.DeadlineExceeded // call cancel as soon as the operations running in this Context complete. func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { ctx, f := context.WithCancel(parent) - return ctx, CancelFunc(f) + return ctx, f } // WithDeadline returns a copy of the parent context with the deadline adjusted @@ -46,7 +46,7 @@ func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { // call cancel as soon as the operations running in this Context complete. func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { ctx, f := context.WithDeadline(parent, deadline) - return ctx, CancelFunc(f) + return ctx, f } // WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)). @@ -54,11 +54,11 @@ func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { // Canceling this context releases resources associated with it, so code should // call cancel as soon as the operations running in this Context complete: // -// func slowOperationWithTimeout(ctx context.Context) (Result, error) { -// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) -// defer cancel() // releases resources if slowOperation completes before timeout elapses -// return slowOperation(ctx) -// } +// func slowOperationWithTimeout(ctx context.Context) (Result, error) { +// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) +// defer cancel() // releases resources if slowOperation completes before timeout elapses +// return slowOperation(ctx) +// } func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { return WithDeadline(parent, time.Now().Add(timeout)) } diff --git a/vendor/golang.org/x/net/context/pre_go17.go b/vendor/golang.org/x/net/context/pre_go17.go index 5270db5db7db..7b6b685114a9 100644 --- a/vendor/golang.org/x/net/context/pre_go17.go +++ b/vendor/golang.org/x/net/context/pre_go17.go @@ -264,11 +264,11 @@ func (c *timerCtx) cancel(removeFromParent bool, err error) { // Canceling this context releases resources associated with it, so code should // call cancel as soon as the operations running in this Context complete: // -// func slowOperationWithTimeout(ctx context.Context) (Result, error) { -// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) -// defer cancel() // releases resources if slowOperation completes before timeout elapses -// return slowOperation(ctx) -// } +// func slowOperationWithTimeout(ctx context.Context) (Result, error) { +// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) +// defer cancel() // releases resources if slowOperation completes before timeout elapses +// return slowOperation(ctx) +// } func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { return WithDeadline(parent, time.Now().Add(timeout)) } diff --git a/vendor/golang.org/x/net/http/httpguts/httplex.go b/vendor/golang.org/x/net/http/httpguts/httplex.go index c79aa73f28bb..6e071e852432 100644 --- a/vendor/golang.org/x/net/http/httpguts/httplex.go +++ b/vendor/golang.org/x/net/http/httpguts/httplex.go @@ -173,13 +173,15 @@ func tokenEqual(t1, t2 string) bool { // isLWS reports whether b is linear white space, according // to http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2 -// LWS = [CRLF] 1*( SP | HT ) +// +// LWS = [CRLF] 1*( SP | HT ) func isLWS(b byte) bool { return b == ' ' || b == '\t' } // isCTL reports whether b is a control byte, according // to http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2 -// CTL = +// +// CTL = func isCTL(b byte) bool { const del = 0x7f // a CTL return b < ' ' || b == del @@ -189,12 +191,13 @@ func isCTL(b byte) bool { // HTTP/2 imposes the additional restriction that uppercase ASCII // letters are not allowed. // -// RFC 7230 says: -// header-field = field-name ":" OWS field-value OWS -// field-name = token -// token = 1*tchar -// tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / -// "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA +// RFC 7230 says: +// +// header-field = field-name ":" OWS field-value OWS +// field-name = token +// token = 1*tchar +// tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / +// "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA func ValidHeaderFieldName(v string) bool { if len(v) == 0 { return false @@ -267,27 +270,28 @@ var validHostByte = [256]bool{ // ValidHeaderFieldValue reports whether v is a valid "field-value" according to // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 : // -// message-header = field-name ":" [ field-value ] -// field-value = *( field-content | LWS ) -// field-content = +// message-header = field-name ":" [ field-value ] +// field-value = *( field-content | LWS ) +// field-content = // // http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2 : // -// TEXT = -// LWS = [CRLF] 1*( SP | HT ) -// CTL = +// TEXT = +// LWS = [CRLF] 1*( SP | HT ) +// CTL = // // RFC 7230 says: -// field-value = *( field-content / obs-fold ) -// obj-fold = N/A to http2, and deprecated -// field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] -// field-vchar = VCHAR / obs-text -// obs-text = %x80-FF -// VCHAR = "any visible [USASCII] character" +// +// field-value = *( field-content / obs-fold ) +// obj-fold = N/A to http2, and deprecated +// field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] +// field-vchar = VCHAR / obs-text +// obs-text = %x80-FF +// VCHAR = "any visible [USASCII] character" // // http2 further says: "Similarly, HTTP/2 allows header field values // that are not valid. While most of the values that can be encoded diff --git a/vendor/golang.org/x/net/http2/client_conn_pool.go b/vendor/golang.org/x/net/http2/client_conn_pool.go index c936843eafa1..780968d6c19b 100644 --- a/vendor/golang.org/x/net/http2/client_conn_pool.go +++ b/vendor/golang.org/x/net/http2/client_conn_pool.go @@ -139,7 +139,6 @@ func (p *clientConnPool) getStartDialLocked(ctx context.Context, addr string) *d func (c *dialCall) dial(ctx context.Context, addr string) { const singleUse = false // shared conn c.res, c.err = c.p.t.dialClientConn(ctx, addr, singleUse) - close(c.done) c.p.mu.Lock() delete(c.p.dialing, addr) @@ -147,6 +146,8 @@ func (c *dialCall) dial(ctx context.Context, addr string) { c.p.addConnLocked(addr, c.res) } c.p.mu.Unlock() + + close(c.done) } // addConnIfNeeded makes a NewClientConn out of c if a connection for key doesn't diff --git a/vendor/golang.org/x/net/http2/errors.go b/vendor/golang.org/x/net/http2/errors.go index 2663e5d287ee..f2067dabc59e 100644 --- a/vendor/golang.org/x/net/http2/errors.go +++ b/vendor/golang.org/x/net/http2/errors.go @@ -136,7 +136,7 @@ func (e headerFieldNameError) Error() string { type headerFieldValueError string func (e headerFieldValueError) Error() string { - return fmt.Sprintf("invalid header field value %q", string(e)) + return fmt.Sprintf("invalid header field value for %q", string(e)) } var ( diff --git a/vendor/golang.org/x/net/http2/flow.go b/vendor/golang.org/x/net/http2/flow.go index b51f0e0cf1f5..750ac52f2a52 100644 --- a/vendor/golang.org/x/net/http2/flow.go +++ b/vendor/golang.org/x/net/http2/flow.go @@ -6,23 +6,91 @@ package http2 -// flow is the flow control window's size. -type flow struct { +// inflowMinRefresh is the minimum number of bytes we'll send for a +// flow control window update. +const inflowMinRefresh = 4 << 10 + +// inflow accounts for an inbound flow control window. +// It tracks both the latest window sent to the peer (used for enforcement) +// and the accumulated unsent window. +type inflow struct { + avail int32 + unsent int32 +} + +// set sets the initial window. +func (f *inflow) init(n int32) { + f.avail = n +} + +// add adds n bytes to the window, with a maximum window size of max, +// indicating that the peer can now send us more data. +// For example, the user read from a {Request,Response} body and consumed +// some of the buffered data, so the peer can now send more. +// It returns the number of bytes to send in a WINDOW_UPDATE frame to the peer. +// Window updates are accumulated and sent when the unsent capacity +// is at least inflowMinRefresh or will at least double the peer's available window. +func (f *inflow) add(n int) (connAdd int32) { + if n < 0 { + panic("negative update") + } + unsent := int64(f.unsent) + int64(n) + // "A sender MUST NOT allow a flow-control window to exceed 2^31-1 octets." + // RFC 7540 Section 6.9.1. + const maxWindow = 1<<31 - 1 + if unsent+int64(f.avail) > maxWindow { + panic("flow control update exceeds maximum window size") + } + f.unsent = int32(unsent) + if f.unsent < inflowMinRefresh && f.unsent < f.avail { + // If there aren't at least inflowMinRefresh bytes of window to send, + // and this update won't at least double the window, buffer the update for later. + return 0 + } + f.avail += f.unsent + f.unsent = 0 + return int32(unsent) +} + +// take attempts to take n bytes from the peer's flow control window. +// It reports whether the window has available capacity. +func (f *inflow) take(n uint32) bool { + if n > uint32(f.avail) { + return false + } + f.avail -= int32(n) + return true +} + +// takeInflows attempts to take n bytes from two inflows, +// typically connection-level and stream-level flows. +// It reports whether both windows have available capacity. +func takeInflows(f1, f2 *inflow, n uint32) bool { + if n > uint32(f1.avail) || n > uint32(f2.avail) { + return false + } + f1.avail -= int32(n) + f2.avail -= int32(n) + return true +} + +// outflow is the outbound flow control window's size. +type outflow struct { _ incomparable // n is the number of DATA bytes we're allowed to send. - // A flow is kept both on a conn and a per-stream. + // An outflow is kept both on a conn and a per-stream. n int32 - // conn points to the shared connection-level flow that is - // shared by all streams on that conn. It is nil for the flow + // conn points to the shared connection-level outflow that is + // shared by all streams on that conn. It is nil for the outflow // that's on the conn directly. - conn *flow + conn *outflow } -func (f *flow) setConnFlow(cf *flow) { f.conn = cf } +func (f *outflow) setConnFlow(cf *outflow) { f.conn = cf } -func (f *flow) available() int32 { +func (f *outflow) available() int32 { n := f.n if f.conn != nil && f.conn.n < n { n = f.conn.n @@ -30,7 +98,7 @@ func (f *flow) available() int32 { return n } -func (f *flow) take(n int32) { +func (f *outflow) take(n int32) { if n > f.available() { panic("internal error: took too much") } @@ -42,7 +110,7 @@ func (f *flow) take(n int32) { // add adds n bytes (positive or negative) to the flow control window. // It returns false if the sum would exceed 2^31-1. -func (f *flow) add(n int32) bool { +func (f *outflow) add(n int32) bool { sum := f.n + n if (sum > n) == (f.n > 0) { f.n = sum diff --git a/vendor/golang.org/x/net/http2/frame.go b/vendor/golang.org/x/net/http2/frame.go index 96a747905241..184ac45feb70 100644 --- a/vendor/golang.org/x/net/http2/frame.go +++ b/vendor/golang.org/x/net/http2/frame.go @@ -23,7 +23,7 @@ const frameHeaderLen = 9 var padZeros = make([]byte, 255) // zeros for padding // A FrameType is a registered frame type as defined in -// http://http2.github.io/http2-spec/#rfc.section.11.2 +// https://httpwg.org/specs/rfc7540.html#rfc.section.11.2 type FrameType uint8 const ( @@ -146,7 +146,7 @@ func typeFrameParser(t FrameType) frameParser { // A FrameHeader is the 9 byte header of all HTTP/2 frames. // -// See http://http2.github.io/http2-spec/#FrameHeader +// See https://httpwg.org/specs/rfc7540.html#FrameHeader type FrameHeader struct { valid bool // caller can access []byte fields in the Frame @@ -575,7 +575,7 @@ func (fr *Framer) checkFrameOrder(f Frame) error { // A DataFrame conveys arbitrary, variable-length sequences of octets // associated with a stream. -// See http://http2.github.io/http2-spec/#rfc.section.6.1 +// See https://httpwg.org/specs/rfc7540.html#rfc.section.6.1 type DataFrame struct { FrameHeader data []byte @@ -698,7 +698,7 @@ func (f *Framer) WriteDataPadded(streamID uint32, endStream bool, data, pad []by // endpoints communicate, such as preferences and constraints on peer // behavior. // -// See http://http2.github.io/http2-spec/#SETTINGS +// See https://httpwg.org/specs/rfc7540.html#SETTINGS type SettingsFrame struct { FrameHeader p []byte @@ -837,7 +837,7 @@ func (f *Framer) WriteSettingsAck() error { // A PingFrame is a mechanism for measuring a minimal round trip time // from the sender, as well as determining whether an idle connection // is still functional. -// See http://http2.github.io/http2-spec/#rfc.section.6.7 +// See https://httpwg.org/specs/rfc7540.html#rfc.section.6.7 type PingFrame struct { FrameHeader Data [8]byte @@ -870,7 +870,7 @@ func (f *Framer) WritePing(ack bool, data [8]byte) error { } // A GoAwayFrame informs the remote peer to stop creating streams on this connection. -// See http://http2.github.io/http2-spec/#rfc.section.6.8 +// See https://httpwg.org/specs/rfc7540.html#rfc.section.6.8 type GoAwayFrame struct { FrameHeader LastStreamID uint32 @@ -934,7 +934,7 @@ func parseUnknownFrame(_ *frameCache, fh FrameHeader, countError func(string), p } // A WindowUpdateFrame is used to implement flow control. -// See http://http2.github.io/http2-spec/#rfc.section.6.9 +// See https://httpwg.org/specs/rfc7540.html#rfc.section.6.9 type WindowUpdateFrame struct { FrameHeader Increment uint32 // never read with high bit set @@ -1123,7 +1123,7 @@ func (f *Framer) WriteHeaders(p HeadersFrameParam) error { } // A PriorityFrame specifies the sender-advised priority of a stream. -// See http://http2.github.io/http2-spec/#rfc.section.6.3 +// See https://httpwg.org/specs/rfc7540.html#rfc.section.6.3 type PriorityFrame struct { FrameHeader PriorityParam @@ -1193,7 +1193,7 @@ func (f *Framer) WritePriority(streamID uint32, p PriorityParam) error { } // A RSTStreamFrame allows for abnormal termination of a stream. -// See http://http2.github.io/http2-spec/#rfc.section.6.4 +// See https://httpwg.org/specs/rfc7540.html#rfc.section.6.4 type RSTStreamFrame struct { FrameHeader ErrCode ErrCode @@ -1225,7 +1225,7 @@ func (f *Framer) WriteRSTStream(streamID uint32, code ErrCode) error { } // A ContinuationFrame is used to continue a sequence of header block fragments. -// See http://http2.github.io/http2-spec/#rfc.section.6.10 +// See https://httpwg.org/specs/rfc7540.html#rfc.section.6.10 type ContinuationFrame struct { FrameHeader headerFragBuf []byte @@ -1266,7 +1266,7 @@ func (f *Framer) WriteContinuation(streamID uint32, endHeaders bool, headerBlock } // A PushPromiseFrame is used to initiate a server stream. -// See http://http2.github.io/http2-spec/#rfc.section.6.6 +// See https://httpwg.org/specs/rfc7540.html#rfc.section.6.6 type PushPromiseFrame struct { FrameHeader PromiseID uint32 @@ -1532,7 +1532,8 @@ func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) { fr.debugReadLoggerf("http2: decoded hpack field %+v", hf) } if !httpguts.ValidHeaderFieldValue(hf.Value) { - invalid = headerFieldValueError(hf.Value) + // Don't include the value in the error, because it may be sensitive. + invalid = headerFieldValueError(hf.Name) } isPseudo := strings.HasPrefix(hf.Name, ":") if isPseudo { diff --git a/vendor/golang.org/x/net/http2/go118.go b/vendor/golang.org/x/net/http2/go118.go new file mode 100644 index 000000000000..aca4b2b31acd --- /dev/null +++ b/vendor/golang.org/x/net/http2/go118.go @@ -0,0 +1,17 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.18 +// +build go1.18 + +package http2 + +import ( + "crypto/tls" + "net" +) + +func tlsUnderlyingConn(tc *tls.Conn) net.Conn { + return tc.NetConn() +} diff --git a/vendor/golang.org/x/net/http2/headermap.go b/vendor/golang.org/x/net/http2/headermap.go index 9e12941da4c3..149b3dd20e45 100644 --- a/vendor/golang.org/x/net/http2/headermap.go +++ b/vendor/golang.org/x/net/http2/headermap.go @@ -27,7 +27,14 @@ func buildCommonHeaderMaps() { "accept-language", "accept-ranges", "age", + "access-control-allow-credentials", + "access-control-allow-headers", + "access-control-allow-methods", "access-control-allow-origin", + "access-control-expose-headers", + "access-control-max-age", + "access-control-request-headers", + "access-control-request-method", "allow", "authorization", "cache-control", @@ -53,6 +60,7 @@ func buildCommonHeaderMaps() { "link", "location", "max-forwards", + "origin", "proxy-authenticate", "proxy-authorization", "range", @@ -68,6 +76,8 @@ func buildCommonHeaderMaps() { "vary", "via", "www-authenticate", + "x-forwarded-for", + "x-forwarded-proto", } commonLowerHeader = make(map[string]string, len(common)) commonCanonHeader = make(map[string]string, len(common)) @@ -85,3 +95,11 @@ func lowerHeader(v string) (lower string, ascii bool) { } return asciiToLower(v) } + +func canonicalHeader(v string) string { + buildCommonHeaderMapsOnce() + if s, ok := commonCanonHeader[v]; ok { + return s + } + return http.CanonicalHeaderKey(v) +} diff --git a/vendor/golang.org/x/net/http2/hpack/encode.go b/vendor/golang.org/x/net/http2/hpack/encode.go index 97f17831fc55..46219da2b01b 100644 --- a/vendor/golang.org/x/net/http2/hpack/encode.go +++ b/vendor/golang.org/x/net/http2/hpack/encode.go @@ -116,6 +116,11 @@ func (e *Encoder) SetMaxDynamicTableSize(v uint32) { e.dynTab.setMaxSize(v) } +// MaxDynamicTableSize returns the current dynamic header table size. +func (e *Encoder) MaxDynamicTableSize() (v uint32) { + return e.dynTab.maxSize +} + // SetMaxDynamicTableSizeLimit changes the maximum value that can be // specified in SetMaxDynamicTableSize to v. By default, it is set to // 4096, which is the same size of the default dynamic header table @@ -191,7 +196,7 @@ func appendTableSize(dst []byte, v uint32) []byte { // bit prefix, to dst and returns the extended buffer. // // See -// http://http2.github.io/http2-spec/compression.html#integer.representation +// https://httpwg.org/specs/rfc7541.html#integer.representation func appendVarInt(dst []byte, n byte, i uint64) []byte { k := uint64((1 << n) - 1) if i < k { diff --git a/vendor/golang.org/x/net/http2/hpack/hpack.go b/vendor/golang.org/x/net/http2/hpack/hpack.go index 85f18a2b0a86..ebdfbee964ae 100644 --- a/vendor/golang.org/x/net/http2/hpack/hpack.go +++ b/vendor/golang.org/x/net/http2/hpack/hpack.go @@ -59,7 +59,7 @@ func (hf HeaderField) String() string { // Size returns the size of an entry per RFC 7541 section 4.1. func (hf HeaderField) Size() uint32 { - // http://http2.github.io/http2-spec/compression.html#rfc.section.4.1 + // https://httpwg.org/specs/rfc7541.html#rfc.section.4.1 // "The size of the dynamic table is the sum of the size of // its entries. The size of an entry is the sum of its name's // length in octets (as defined in Section 5.2), its value's @@ -158,7 +158,7 @@ func (d *Decoder) SetAllowedMaxDynamicTableSize(v uint32) { } type dynamicTable struct { - // http://http2.github.io/http2-spec/compression.html#rfc.section.2.3.2 + // https://httpwg.org/specs/rfc7541.html#rfc.section.2.3.2 table headerFieldTable size uint32 // in bytes maxSize uint32 // current maxSize @@ -307,27 +307,27 @@ func (d *Decoder) parseHeaderFieldRepr() error { case b&128 != 0: // Indexed representation. // High bit set? - // http://http2.github.io/http2-spec/compression.html#rfc.section.6.1 + // https://httpwg.org/specs/rfc7541.html#rfc.section.6.1 return d.parseFieldIndexed() case b&192 == 64: // 6.2.1 Literal Header Field with Incremental Indexing // 0b10xxxxxx: top two bits are 10 - // http://http2.github.io/http2-spec/compression.html#rfc.section.6.2.1 + // https://httpwg.org/specs/rfc7541.html#rfc.section.6.2.1 return d.parseFieldLiteral(6, indexedTrue) case b&240 == 0: // 6.2.2 Literal Header Field without Indexing // 0b0000xxxx: top four bits are 0000 - // http://http2.github.io/http2-spec/compression.html#rfc.section.6.2.2 + // https://httpwg.org/specs/rfc7541.html#rfc.section.6.2.2 return d.parseFieldLiteral(4, indexedFalse) case b&240 == 16: // 6.2.3 Literal Header Field never Indexed // 0b0001xxxx: top four bits are 0001 - // http://http2.github.io/http2-spec/compression.html#rfc.section.6.2.3 + // https://httpwg.org/specs/rfc7541.html#rfc.section.6.2.3 return d.parseFieldLiteral(4, indexedNever) case b&224 == 32: // 6.3 Dynamic Table Size Update // Top three bits are '001'. - // http://http2.github.io/http2-spec/compression.html#rfc.section.6.3 + // https://httpwg.org/specs/rfc7541.html#rfc.section.6.3 return d.parseDynamicTableSizeUpdate() } @@ -420,7 +420,7 @@ var errVarintOverflow = DecodingError{errors.New("varint integer overflow")} // readVarInt reads an unsigned variable length integer off the // beginning of p. n is the parameter as described in -// http://http2.github.io/http2-spec/compression.html#rfc.section.5.1. +// https://httpwg.org/specs/rfc7541.html#rfc.section.5.1. // // n must always be between 1 and 8. // diff --git a/vendor/golang.org/x/net/http2/hpack/huffman.go b/vendor/golang.org/x/net/http2/hpack/huffman.go index fe0b84ccd467..20d083a716da 100644 --- a/vendor/golang.org/x/net/http2/hpack/huffman.go +++ b/vendor/golang.org/x/net/http2/hpack/huffman.go @@ -169,25 +169,50 @@ func buildRootHuffmanNode() { // AppendHuffmanString appends s, as encoded in Huffman codes, to dst // and returns the extended buffer. func AppendHuffmanString(dst []byte, s string) []byte { - rembits := uint8(8) - + // This relies on the maximum huffman code length being 30 (See tables.go huffmanCodeLen array) + // So if a uint64 buffer has less than 32 valid bits can always accommodate another huffmanCode. + var ( + x uint64 // buffer + n uint // number valid of bits present in x + ) for i := 0; i < len(s); i++ { - if rembits == 8 { - dst = append(dst, 0) + c := s[i] + n += uint(huffmanCodeLen[c]) + x <<= huffmanCodeLen[c] % 64 + x |= uint64(huffmanCodes[c]) + if n >= 32 { + n %= 32 // Normally would be -= 32 but %= 32 informs compiler 0 <= n <= 31 for upcoming shift + y := uint32(x >> n) // Compiler doesn't combine memory writes if y isn't uint32 + dst = append(dst, byte(y>>24), byte(y>>16), byte(y>>8), byte(y)) } - dst, rembits = appendByteToHuffmanCode(dst, rembits, s[i]) } - - if rembits < 8 { - // special EOS symbol - code := uint32(0x3fffffff) - nbits := uint8(30) - - t := uint8(code >> (nbits - rembits)) - dst[len(dst)-1] |= t + // Add padding bits if necessary + if over := n % 8; over > 0 { + const ( + eosCode = 0x3fffffff + eosNBits = 30 + eosPadByte = eosCode >> (eosNBits - 8) + ) + pad := 8 - over + x = (x << pad) | (eosPadByte >> over) + n += pad // 8 now divides into n exactly } - - return dst + // n in (0, 8, 16, 24, 32) + switch n / 8 { + case 0: + return dst + case 1: + return append(dst, byte(x)) + case 2: + y := uint16(x) + return append(dst, byte(y>>8), byte(y)) + case 3: + y := uint16(x >> 8) + return append(dst, byte(y>>8), byte(y), byte(x)) + } + // case 4: + y := uint32(x) + return append(dst, byte(y>>24), byte(y>>16), byte(y>>8), byte(y)) } // HuffmanEncodeLength returns the number of bytes required to encode @@ -199,35 +224,3 @@ func HuffmanEncodeLength(s string) uint64 { } return (n + 7) / 8 } - -// appendByteToHuffmanCode appends Huffman code for c to dst and -// returns the extended buffer and the remaining bits in the last -// element. The appending is not byte aligned and the remaining bits -// in the last element of dst is given in rembits. -func appendByteToHuffmanCode(dst []byte, rembits uint8, c byte) ([]byte, uint8) { - code := huffmanCodes[c] - nbits := huffmanCodeLen[c] - - for { - if rembits > nbits { - t := uint8(code << (rembits - nbits)) - dst[len(dst)-1] |= t - rembits -= nbits - break - } - - t := uint8(code >> (nbits - rembits)) - dst[len(dst)-1] |= t - - nbits -= rembits - rembits = 8 - - if nbits == 0 { - break - } - - dst = append(dst, 0) - } - - return dst, rembits -} diff --git a/vendor/golang.org/x/net/http2/hpack/static_table.go b/vendor/golang.org/x/net/http2/hpack/static_table.go new file mode 100644 index 000000000000..754a1eb919e9 --- /dev/null +++ b/vendor/golang.org/x/net/http2/hpack/static_table.go @@ -0,0 +1,188 @@ +// go generate gen.go +// Code generated by the command above; DO NOT EDIT. + +package hpack + +var staticTable = &headerFieldTable{ + evictCount: 0, + byName: map[string]uint64{ + ":authority": 1, + ":method": 3, + ":path": 5, + ":scheme": 7, + ":status": 14, + "accept-charset": 15, + "accept-encoding": 16, + "accept-language": 17, + "accept-ranges": 18, + "accept": 19, + "access-control-allow-origin": 20, + "age": 21, + "allow": 22, + "authorization": 23, + "cache-control": 24, + "content-disposition": 25, + "content-encoding": 26, + "content-language": 27, + "content-length": 28, + "content-location": 29, + "content-range": 30, + "content-type": 31, + "cookie": 32, + "date": 33, + "etag": 34, + "expect": 35, + "expires": 36, + "from": 37, + "host": 38, + "if-match": 39, + "if-modified-since": 40, + "if-none-match": 41, + "if-range": 42, + "if-unmodified-since": 43, + "last-modified": 44, + "link": 45, + "location": 46, + "max-forwards": 47, + "proxy-authenticate": 48, + "proxy-authorization": 49, + "range": 50, + "referer": 51, + "refresh": 52, + "retry-after": 53, + "server": 54, + "set-cookie": 55, + "strict-transport-security": 56, + "transfer-encoding": 57, + "user-agent": 58, + "vary": 59, + "via": 60, + "www-authenticate": 61, + }, + byNameValue: map[pairNameValue]uint64{ + {name: ":authority", value: ""}: 1, + {name: ":method", value: "GET"}: 2, + {name: ":method", value: "POST"}: 3, + {name: ":path", value: "/"}: 4, + {name: ":path", value: "/index.html"}: 5, + {name: ":scheme", value: "http"}: 6, + {name: ":scheme", value: "https"}: 7, + {name: ":status", value: "200"}: 8, + {name: ":status", value: "204"}: 9, + {name: ":status", value: "206"}: 10, + {name: ":status", value: "304"}: 11, + {name: ":status", value: "400"}: 12, + {name: ":status", value: "404"}: 13, + {name: ":status", value: "500"}: 14, + {name: "accept-charset", value: ""}: 15, + {name: "accept-encoding", value: "gzip, deflate"}: 16, + {name: "accept-language", value: ""}: 17, + {name: "accept-ranges", value: ""}: 18, + {name: "accept", value: ""}: 19, + {name: "access-control-allow-origin", value: ""}: 20, + {name: "age", value: ""}: 21, + {name: "allow", value: ""}: 22, + {name: "authorization", value: ""}: 23, + {name: "cache-control", value: ""}: 24, + {name: "content-disposition", value: ""}: 25, + {name: "content-encoding", value: ""}: 26, + {name: "content-language", value: ""}: 27, + {name: "content-length", value: ""}: 28, + {name: "content-location", value: ""}: 29, + {name: "content-range", value: ""}: 30, + {name: "content-type", value: ""}: 31, + {name: "cookie", value: ""}: 32, + {name: "date", value: ""}: 33, + {name: "etag", value: ""}: 34, + {name: "expect", value: ""}: 35, + {name: "expires", value: ""}: 36, + {name: "from", value: ""}: 37, + {name: "host", value: ""}: 38, + {name: "if-match", value: ""}: 39, + {name: "if-modified-since", value: ""}: 40, + {name: "if-none-match", value: ""}: 41, + {name: "if-range", value: ""}: 42, + {name: "if-unmodified-since", value: ""}: 43, + {name: "last-modified", value: ""}: 44, + {name: "link", value: ""}: 45, + {name: "location", value: ""}: 46, + {name: "max-forwards", value: ""}: 47, + {name: "proxy-authenticate", value: ""}: 48, + {name: "proxy-authorization", value: ""}: 49, + {name: "range", value: ""}: 50, + {name: "referer", value: ""}: 51, + {name: "refresh", value: ""}: 52, + {name: "retry-after", value: ""}: 53, + {name: "server", value: ""}: 54, + {name: "set-cookie", value: ""}: 55, + {name: "strict-transport-security", value: ""}: 56, + {name: "transfer-encoding", value: ""}: 57, + {name: "user-agent", value: ""}: 58, + {name: "vary", value: ""}: 59, + {name: "via", value: ""}: 60, + {name: "www-authenticate", value: ""}: 61, + }, + ents: []HeaderField{ + {Name: ":authority", Value: "", Sensitive: false}, + {Name: ":method", Value: "GET", Sensitive: false}, + {Name: ":method", Value: "POST", Sensitive: false}, + {Name: ":path", Value: "/", Sensitive: false}, + {Name: ":path", Value: "/index.html", Sensitive: false}, + {Name: ":scheme", Value: "http", Sensitive: false}, + {Name: ":scheme", Value: "https", Sensitive: false}, + {Name: ":status", Value: "200", Sensitive: false}, + {Name: ":status", Value: "204", Sensitive: false}, + {Name: ":status", Value: "206", Sensitive: false}, + {Name: ":status", Value: "304", Sensitive: false}, + {Name: ":status", Value: "400", Sensitive: false}, + {Name: ":status", Value: "404", Sensitive: false}, + {Name: ":status", Value: "500", Sensitive: false}, + {Name: "accept-charset", Value: "", Sensitive: false}, + {Name: "accept-encoding", Value: "gzip, deflate", Sensitive: false}, + {Name: "accept-language", Value: "", Sensitive: false}, + {Name: "accept-ranges", Value: "", Sensitive: false}, + {Name: "accept", Value: "", Sensitive: false}, + {Name: "access-control-allow-origin", Value: "", Sensitive: false}, + {Name: "age", Value: "", Sensitive: false}, + {Name: "allow", Value: "", Sensitive: false}, + {Name: "authorization", Value: "", Sensitive: false}, + {Name: "cache-control", Value: "", Sensitive: false}, + {Name: "content-disposition", Value: "", Sensitive: false}, + {Name: "content-encoding", Value: "", Sensitive: false}, + {Name: "content-language", Value: "", Sensitive: false}, + {Name: "content-length", Value: "", Sensitive: false}, + {Name: "content-location", Value: "", Sensitive: false}, + {Name: "content-range", Value: "", Sensitive: false}, + {Name: "content-type", Value: "", Sensitive: false}, + {Name: "cookie", Value: "", Sensitive: false}, + {Name: "date", Value: "", Sensitive: false}, + {Name: "etag", Value: "", Sensitive: false}, + {Name: "expect", Value: "", Sensitive: false}, + {Name: "expires", Value: "", Sensitive: false}, + {Name: "from", Value: "", Sensitive: false}, + {Name: "host", Value: "", Sensitive: false}, + {Name: "if-match", Value: "", Sensitive: false}, + {Name: "if-modified-since", Value: "", Sensitive: false}, + {Name: "if-none-match", Value: "", Sensitive: false}, + {Name: "if-range", Value: "", Sensitive: false}, + {Name: "if-unmodified-since", Value: "", Sensitive: false}, + {Name: "last-modified", Value: "", Sensitive: false}, + {Name: "link", Value: "", Sensitive: false}, + {Name: "location", Value: "", Sensitive: false}, + {Name: "max-forwards", Value: "", Sensitive: false}, + {Name: "proxy-authenticate", Value: "", Sensitive: false}, + {Name: "proxy-authorization", Value: "", Sensitive: false}, + {Name: "range", Value: "", Sensitive: false}, + {Name: "referer", Value: "", Sensitive: false}, + {Name: "refresh", Value: "", Sensitive: false}, + {Name: "retry-after", Value: "", Sensitive: false}, + {Name: "server", Value: "", Sensitive: false}, + {Name: "set-cookie", Value: "", Sensitive: false}, + {Name: "strict-transport-security", Value: "", Sensitive: false}, + {Name: "transfer-encoding", Value: "", Sensitive: false}, + {Name: "user-agent", Value: "", Sensitive: false}, + {Name: "vary", Value: "", Sensitive: false}, + {Name: "via", Value: "", Sensitive: false}, + {Name: "www-authenticate", Value: "", Sensitive: false}, + }, +} diff --git a/vendor/golang.org/x/net/http2/hpack/tables.go b/vendor/golang.org/x/net/http2/hpack/tables.go index a66cfbea69d9..8cbdf3f019cb 100644 --- a/vendor/golang.org/x/net/http2/hpack/tables.go +++ b/vendor/golang.org/x/net/http2/hpack/tables.go @@ -96,8 +96,7 @@ func (t *headerFieldTable) evictOldest(n int) { // meaning t.ents is reversed for dynamic tables. Hence, when t is a dynamic // table, the return value i actually refers to the entry t.ents[t.len()-i]. // -// All tables are assumed to be a dynamic tables except for the global -// staticTable pointer. +// All tables are assumed to be a dynamic tables except for the global staticTable. // // See Section 2.3.3. func (t *headerFieldTable) search(f HeaderField) (i uint64, nameValueMatch bool) { @@ -125,81 +124,6 @@ func (t *headerFieldTable) idToIndex(id uint64) uint64 { return k + 1 } -// http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07#appendix-B -var staticTable = newStaticTable() -var staticTableEntries = [...]HeaderField{ - {Name: ":authority"}, - {Name: ":method", Value: "GET"}, - {Name: ":method", Value: "POST"}, - {Name: ":path", Value: "/"}, - {Name: ":path", Value: "/index.html"}, - {Name: ":scheme", Value: "http"}, - {Name: ":scheme", Value: "https"}, - {Name: ":status", Value: "200"}, - {Name: ":status", Value: "204"}, - {Name: ":status", Value: "206"}, - {Name: ":status", Value: "304"}, - {Name: ":status", Value: "400"}, - {Name: ":status", Value: "404"}, - {Name: ":status", Value: "500"}, - {Name: "accept-charset"}, - {Name: "accept-encoding", Value: "gzip, deflate"}, - {Name: "accept-language"}, - {Name: "accept-ranges"}, - {Name: "accept"}, - {Name: "access-control-allow-origin"}, - {Name: "age"}, - {Name: "allow"}, - {Name: "authorization"}, - {Name: "cache-control"}, - {Name: "content-disposition"}, - {Name: "content-encoding"}, - {Name: "content-language"}, - {Name: "content-length"}, - {Name: "content-location"}, - {Name: "content-range"}, - {Name: "content-type"}, - {Name: "cookie"}, - {Name: "date"}, - {Name: "etag"}, - {Name: "expect"}, - {Name: "expires"}, - {Name: "from"}, - {Name: "host"}, - {Name: "if-match"}, - {Name: "if-modified-since"}, - {Name: "if-none-match"}, - {Name: "if-range"}, - {Name: "if-unmodified-since"}, - {Name: "last-modified"}, - {Name: "link"}, - {Name: "location"}, - {Name: "max-forwards"}, - {Name: "proxy-authenticate"}, - {Name: "proxy-authorization"}, - {Name: "range"}, - {Name: "referer"}, - {Name: "refresh"}, - {Name: "retry-after"}, - {Name: "server"}, - {Name: "set-cookie"}, - {Name: "strict-transport-security"}, - {Name: "transfer-encoding"}, - {Name: "user-agent"}, - {Name: "vary"}, - {Name: "via"}, - {Name: "www-authenticate"}, -} - -func newStaticTable() *headerFieldTable { - t := &headerFieldTable{} - t.init() - for _, e := range staticTableEntries[:] { - t.addEntry(e) - } - return t -} - var huffmanCodes = [256]uint32{ 0x1ff8, 0x7fffd8, diff --git a/vendor/golang.org/x/net/http2/http2.go b/vendor/golang.org/x/net/http2/http2.go index 5571ccfd2613..6f2df281872e 100644 --- a/vendor/golang.org/x/net/http2/http2.go +++ b/vendor/golang.org/x/net/http2/http2.go @@ -13,7 +13,6 @@ // See https://http2.github.io/ for more information on HTTP/2. // // See https://http2.golang.org/ for a test server running this code. -// package http2 // import "golang.org/x/net/http2" import ( @@ -56,14 +55,14 @@ const ( ClientPreface = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" // SETTINGS_MAX_FRAME_SIZE default - // http://http2.github.io/http2-spec/#rfc.section.6.5.2 + // https://httpwg.org/specs/rfc7540.html#rfc.section.6.5.2 initialMaxFrameSize = 16384 // NextProtoTLS is the NPN/ALPN protocol negotiated during // HTTP/2's TLS setup. NextProtoTLS = "h2" - // http://http2.github.io/http2-spec/#SettingValues + // https://httpwg.org/specs/rfc7540.html#SettingValues initialHeaderTableSize = 4096 initialWindowSize = 65535 // 6.9.2 Initial Flow Control Window Size @@ -112,7 +111,7 @@ func (st streamState) String() string { // Setting is a setting parameter: which setting it is, and its value. type Setting struct { // ID is which setting is being set. - // See http://http2.github.io/http2-spec/#SettingValues + // See https://httpwg.org/specs/rfc7540.html#SettingFormat ID SettingID // Val is the value. @@ -144,7 +143,7 @@ func (s Setting) Valid() error { } // A SettingID is an HTTP/2 setting as defined in -// http://http2.github.io/http2-spec/#iana-settings +// https://httpwg.org/specs/rfc7540.html#iana-settings type SettingID uint16 const ( @@ -176,10 +175,11 @@ func (s SettingID) String() string { // name (key). See httpguts.ValidHeaderName for the base rules. // // Further, http2 says: -// "Just as in HTTP/1.x, header field names are strings of ASCII -// characters that are compared in a case-insensitive -// fashion. However, header field names MUST be converted to -// lowercase prior to their encoding in HTTP/2. " +// +// "Just as in HTTP/1.x, header field names are strings of ASCII +// characters that are compared in a case-insensitive +// fashion. However, header field names MUST be converted to +// lowercase prior to their encoding in HTTP/2. " func validWireHeaderFieldName(v string) bool { if len(v) == 0 { return false @@ -365,8 +365,8 @@ func (s *sorter) SortStrings(ss []string) { // validPseudoPath reports whether v is a valid :path pseudo-header // value. It must be either: // -// *) a non-empty string starting with '/' -// *) the string '*', for OPTIONS requests. +// - a non-empty string starting with '/' +// - the string '*', for OPTIONS requests. // // For now this is only used a quick check for deciding when to clean // up Opaque URLs before sending requests from the Transport. diff --git a/vendor/golang.org/x/net/http2/not_go118.go b/vendor/golang.org/x/net/http2/not_go118.go new file mode 100644 index 000000000000..eab532c96bc0 --- /dev/null +++ b/vendor/golang.org/x/net/http2/not_go118.go @@ -0,0 +1,17 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !go1.18 +// +build !go1.18 + +package http2 + +import ( + "crypto/tls" + "net" +) + +func tlsUnderlyingConn(tc *tls.Conn) net.Conn { + return nil +} diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go index c67e9b7f5553..b624dc0a705e 100644 --- a/vendor/golang.org/x/net/http2/server.go +++ b/vendor/golang.org/x/net/http2/server.go @@ -98,6 +98,19 @@ type Server struct { // the HTTP/2 spec's recommendations. MaxConcurrentStreams uint32 + // MaxDecoderHeaderTableSize optionally specifies the http2 + // SETTINGS_HEADER_TABLE_SIZE to send in the initial settings frame. It + // informs the remote endpoint of the maximum size of the header compression + // table used to decode header blocks, in octets. If zero, the default value + // of 4096 is used. + MaxDecoderHeaderTableSize uint32 + + // MaxEncoderHeaderTableSize optionally specifies an upper limit for the + // header compression table used for encoding request headers. Received + // SETTINGS_HEADER_TABLE_SIZE settings are capped at this limit. If zero, + // the default value of 4096 is used. + MaxEncoderHeaderTableSize uint32 + // MaxReadFrameSize optionally specifies the largest frame // this server is willing to read. A valid value is between // 16k and 16M, inclusive. If zero or otherwise invalid, a @@ -143,7 +156,7 @@ type Server struct { } func (s *Server) initialConnRecvWindowSize() int32 { - if s.MaxUploadBufferPerConnection > initialWindowSize { + if s.MaxUploadBufferPerConnection >= initialWindowSize { return s.MaxUploadBufferPerConnection } return 1 << 20 @@ -170,6 +183,20 @@ func (s *Server) maxConcurrentStreams() uint32 { return defaultMaxStreams } +func (s *Server) maxDecoderHeaderTableSize() uint32 { + if v := s.MaxDecoderHeaderTableSize; v > 0 { + return v + } + return initialHeaderTableSize +} + +func (s *Server) maxEncoderHeaderTableSize() uint32 { + if v := s.MaxEncoderHeaderTableSize; v > 0 { + return v + } + return initialHeaderTableSize +} + // maxQueuedControlFrames is the maximum number of control frames like // SETTINGS, PING and RST_STREAM that will be queued for writing before // the connection is closed to prevent memory exhaustion attacks. @@ -315,6 +342,20 @@ type ServeConnOpts struct { // requests. If nil, BaseConfig.Handler is used. If BaseConfig // or BaseConfig.Handler is nil, http.DefaultServeMux is used. Handler http.Handler + + // UpgradeRequest is an initial request received on a connection + // undergoing an h2c upgrade. The request body must have been + // completely read from the connection before calling ServeConn, + // and the 101 Switching Protocols response written. + UpgradeRequest *http.Request + + // Settings is the decoded contents of the HTTP2-Settings header + // in an h2c upgrade request. + Settings []byte + + // SawClientPreface is set if the HTTP/2 connection preface + // has already been read from the connection. + SawClientPreface bool } func (o *ServeConnOpts) context() context.Context { @@ -380,9 +421,9 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) { advMaxStreams: s.maxConcurrentStreams(), initialStreamSendWindowSize: initialWindowSize, maxFrameSize: initialMaxFrameSize, - headerTableSize: initialHeaderTableSize, serveG: newGoroutineLock(), pushEnabled: true, + sawClientPreface: opts.SawClientPreface, } s.state.registerConn(sc) @@ -400,21 +441,22 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) { if s.NewWriteScheduler != nil { sc.writeSched = s.NewWriteScheduler() } else { - sc.writeSched = NewRandomWriteScheduler() + sc.writeSched = NewPriorityWriteScheduler(nil) } // These start at the RFC-specified defaults. If there is a higher // configured value for inflow, that will be updated when we send a // WINDOW_UPDATE shortly after sending SETTINGS. sc.flow.add(initialWindowSize) - sc.inflow.add(initialWindowSize) + sc.inflow.init(initialWindowSize) sc.hpackEncoder = hpack.NewEncoder(&sc.headerWriteBuf) + sc.hpackEncoder.SetMaxDynamicTableSizeLimit(s.maxEncoderHeaderTableSize()) fr := NewFramer(sc.bw, c) if s.CountError != nil { fr.countError = s.CountError } - fr.ReadMetaHeaders = hpack.NewDecoder(initialHeaderTableSize, nil) + fr.ReadMetaHeaders = hpack.NewDecoder(s.maxDecoderHeaderTableSize(), nil) fr.MaxHeaderListSize = sc.maxHeaderListSize() fr.SetMaxReadFrameSize(s.maxReadFrameSize()) sc.framer = fr @@ -465,9 +507,27 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) { } } + if opts.Settings != nil { + fr := &SettingsFrame{ + FrameHeader: FrameHeader{valid: true}, + p: opts.Settings, + } + if err := fr.ForeachSetting(sc.processSetting); err != nil { + sc.rejectConn(ErrCodeProtocol, "invalid settings") + return + } + opts.Settings = nil + } + if hook := testHookGetServerConn; hook != nil { hook(sc) } + + if opts.UpgradeRequest != nil { + sc.upgradeRequest(opts.UpgradeRequest) + opts.UpgradeRequest = nil + } + sc.serve() } @@ -503,8 +563,8 @@ type serverConn struct { wroteFrameCh chan frameWriteResult // from writeFrameAsync -> serve, tickles more frame writes bodyReadCh chan bodyReadMsg // from handlers -> serve serveMsgCh chan interface{} // misc messages & code to send to / run on the serve loop - flow flow // conn-wide (not stream-specific) outbound flow control - inflow flow // conn-wide inbound flow control + flow outflow // conn-wide (not stream-specific) outbound flow control + inflow inflow // conn-wide inbound flow control tlsState *tls.ConnectionState // shared by all handlers, like net/http remoteAddrStr string writeSched WriteScheduler @@ -512,6 +572,7 @@ type serverConn struct { // Everything following is owned by the serve loop; use serveG.check(): serveG goroutineLock // used to verify funcs are on serve() pushEnabled bool + sawClientPreface bool // preface has already been read, used in h2c upgrade sawFirstSettings bool // got the initial SETTINGS frame after the preface needToSendSettingsAck bool unackedSettings int // how many SETTINGS have we sent without ACKs? @@ -525,9 +586,9 @@ type serverConn struct { streams map[uint32]*stream initialStreamSendWindowSize int32 maxFrameSize int32 - headerTableSize uint32 peerMaxHeaderListSize uint32 // zero means unknown (default) canonHeader map[string]string // http2-lower-case -> Go-Canonical-Case + canonHeaderKeysSize int // canonHeader keys size in bytes writingFrame bool // started writing a frame (on serve goroutine or separate) writingFrameAsync bool // started a frame on its own goroutine but haven't heard back on wroteFrameCh needsFrameFlush bool // last frame write wasn't a flush @@ -580,15 +641,17 @@ type stream struct { cancelCtx func() // owned by serverConn's serve loop: - bodyBytes int64 // body bytes seen so far - declBodyBytes int64 // or -1 if undeclared - flow flow // limits writing from Handler to client - inflow flow // what the client is allowed to POST/etc to us + bodyBytes int64 // body bytes seen so far + declBodyBytes int64 // or -1 if undeclared + flow outflow // limits writing from Handler to client + inflow inflow // what the client is allowed to POST/etc to us state streamState resetQueued bool // RST_STREAM queued for write; set by sc.resetStream gotTrailerHeader bool // HEADER frame for trailers was seen wroteHeaders bool // whether we wrote headers (not status 100) + readDeadline *time.Timer // nil if unused writeDeadline *time.Timer // nil if unused + closeErr error // set before cw is closed trailer http.Header // accumulated trailers reqTrailer http.Header // handler's Request.Trailer @@ -704,6 +767,13 @@ func (sc *serverConn) condlogf(err error, format string, args ...interface{}) { } } +// maxCachedCanonicalHeadersKeysSize is an arbitrarily-chosen limit on the size +// of the entries in the canonHeader cache. +// This should be larger than the size of unique, uncommon header keys likely to +// be sent by the peer, while not so high as to permit unreasonable memory usage +// if the peer sends an unbounded number of unique header keys. +const maxCachedCanonicalHeadersKeysSize = 2048 + func (sc *serverConn) canonicalHeader(v string) string { sc.serveG.check() buildCommonHeaderMapsOnce() @@ -719,7 +789,11 @@ func (sc *serverConn) canonicalHeader(v string) string { sc.canonHeader = make(map[string]string) } cv = http.CanonicalHeaderKey(v) - sc.canonHeader[v] = cv + size := 100 + len(v)*2 // 100 bytes of map overhead + key + value + if sc.canonHeaderKeysSize+size <= maxCachedCanonicalHeadersKeysSize { + sc.canonHeader[v] = cv + sc.canonHeaderKeysSize += size + } return cv } @@ -820,6 +894,7 @@ func (sc *serverConn) serve() { {SettingMaxFrameSize, sc.srv.maxReadFrameSize()}, {SettingMaxConcurrentStreams, sc.advMaxStreams}, {SettingMaxHeaderListSize, sc.maxHeaderListSize()}, + {SettingHeaderTableSize, sc.srv.maxDecoderHeaderTableSize()}, {SettingInitialWindowSize, uint32(sc.srv.initialStreamRecvWindowSize())}, }, }) @@ -906,6 +981,8 @@ func (sc *serverConn) serve() { } case *startPushRequest: sc.startPush(v) + case func(*serverConn): + v(sc) default: panic(fmt.Sprintf("unexpected type %T", v)) } @@ -966,6 +1043,9 @@ var errPrefaceTimeout = errors.New("timeout waiting for client preface") // returns errPrefaceTimeout on timeout, or an error if the greeting // is invalid. func (sc *serverConn) readPreface() error { + if sc.sawClientPreface { + return nil + } errc := make(chan error, 1) go func() { // Read the client preface @@ -1326,6 +1406,9 @@ func (sc *serverConn) startGracefulShutdownInternal() { func (sc *serverConn) goAway(code ErrCode) { sc.serveG.check() if sc.inGoAway { + if sc.goAwayCode == ErrCodeNo { + sc.goAwayCode = code + } return } sc.inGoAway = true @@ -1413,6 +1496,21 @@ func (sc *serverConn) processFrame(f Frame) error { sc.sawFirstSettings = true } + // Discard frames for streams initiated after the identified last + // stream sent in a GOAWAY, or all frames after sending an error. + // We still need to return connection-level flow control for DATA frames. + // RFC 9113 Section 6.8. + if sc.inGoAway && (sc.goAwayCode != ErrCodeNo || f.Header().StreamID > sc.maxClientStreamID) { + + if f, ok := f.(*DataFrame); ok { + if !sc.inflow.take(f.Length) { + return sc.countError("data_flow", streamError(f.Header().StreamID, ErrCodeFlowControl)) + } + sc.sendWindowUpdate(nil, int(f.Length)) // conn-level + } + return nil + } + switch f := f.(type) { case *SettingsFrame: return sc.processSettings(f) @@ -1455,9 +1553,6 @@ func (sc *serverConn) processPing(f *PingFrame) error { // PROTOCOL_ERROR." return sc.countError("ping_on_stream", ConnectionError(ErrCodeProtocol)) } - if sc.inGoAway && sc.goAwayCode != ErrCodeNo { - return nil - } sc.writeFrame(FrameWriteRequest{write: writePingAck{f}}) return nil } @@ -1519,6 +1614,9 @@ func (sc *serverConn) closeStream(st *stream, err error) { panic(fmt.Sprintf("invariant; can't close stream in state %v", st.state)) } st.state = stateClosed + if st.readDeadline != nil { + st.readDeadline.Stop() + } if st.writeDeadline != nil { st.writeDeadline.Stop() } @@ -1544,6 +1642,14 @@ func (sc *serverConn) closeStream(st *stream, err error) { p.CloseWithError(err) } + if e, ok := err.(StreamError); ok { + if e.Cause != nil { + err = e.Cause + } else { + err = errStreamClosed + } + } + st.closeErr = err st.cw.Close() // signals Handler's CloseNotifier, unblocks writes, etc sc.writeSched.CloseStream(st.id) } @@ -1586,7 +1692,6 @@ func (sc *serverConn) processSetting(s Setting) error { } switch s.ID { case SettingHeaderTableSize: - sc.headerTableSize = s.Val sc.hpackEncoder.SetMaxDynamicTableSize(s.Val) case SettingEnablePush: sc.pushEnabled = s.Val != 0 @@ -1640,16 +1745,6 @@ func (sc *serverConn) processSettingInitialWindowSize(val uint32) error { func (sc *serverConn) processData(f *DataFrame) error { sc.serveG.check() id := f.Header().StreamID - if sc.inGoAway && (sc.goAwayCode != ErrCodeNo || id > sc.maxClientStreamID) { - // Discard all DATA frames if the GOAWAY is due to an - // error, or: - // - // Section 6.8: After sending a GOAWAY frame, the sender - // can discard frames for streams initiated by the - // receiver with identifiers higher than the identified - // last stream. - return nil - } data := f.Data() state, st := sc.state(id) @@ -1680,14 +1775,9 @@ func (sc *serverConn) processData(f *DataFrame) error { // But still enforce their connection-level flow control, // and return any flow control bytes since we're not going // to consume them. - if sc.inflow.available() < int32(f.Length) { + if !sc.inflow.take(f.Length) { return sc.countError("data_flow", streamError(id, ErrCodeFlowControl)) } - // Deduct the flow control from inflow, since we're - // going to immediately add it back in - // sendWindowUpdate, which also schedules sending the - // frames. - sc.inflow.take(int32(f.Length)) sc.sendWindowUpdate(nil, int(f.Length)) // conn-level if st != nil && st.resetQueued { @@ -1702,6 +1792,11 @@ func (sc *serverConn) processData(f *DataFrame) error { // Sender sending more than they'd declared? if st.declBodyBytes != -1 && st.bodyBytes+int64(len(data)) > st.declBodyBytes { + if !sc.inflow.take(f.Length) { + return sc.countError("data_flow", streamError(id, ErrCodeFlowControl)) + } + sc.sendWindowUpdate(nil, int(f.Length)) // conn-level + st.body.CloseWithError(fmt.Errorf("sender tried to send more than declared Content-Length of %d bytes", st.declBodyBytes)) // RFC 7540, sec 8.1.2.6: A request or response is also malformed if the // value of a content-length header field does not equal the sum of the @@ -1710,10 +1805,9 @@ func (sc *serverConn) processData(f *DataFrame) error { } if f.Length > 0 { // Check whether the client has flow control quota. - if st.inflow.available() < int32(f.Length) { + if !takeInflows(&sc.inflow, &st.inflow, f.Length) { return sc.countError("flow_on_data_length", streamError(id, ErrCodeFlowControl)) } - st.inflow.take(int32(f.Length)) if len(data) > 0 { wrote, err := st.body.Write(data) @@ -1729,10 +1823,12 @@ func (sc *serverConn) processData(f *DataFrame) error { // Return any padded flow control now, since we won't // refund it later on body reads. - if pad := int32(f.Length) - int32(len(data)); pad > 0 { - sc.sendWindowUpdate32(nil, pad) - sc.sendWindowUpdate32(st, pad) - } + // Call sendWindowUpdate even if there is no padding, + // to return buffered flow control credit if the sent + // window has shrunk. + pad := int32(f.Length) - int32(len(data)) + sc.sendWindowUpdate32(nil, pad) + sc.sendWindowUpdate32(st, pad) } if f.StreamEnded() { st.endStream() @@ -1786,19 +1882,27 @@ func (st *stream) copyTrailersToHandlerRequest() { } } +// onReadTimeout is run on its own goroutine (from time.AfterFunc) +// when the stream's ReadTimeout has fired. +func (st *stream) onReadTimeout() { + // Wrap the ErrDeadlineExceeded to avoid callers depending on us + // returning the bare error. + st.body.CloseWithError(fmt.Errorf("%w", os.ErrDeadlineExceeded)) +} + // onWriteTimeout is run on its own goroutine (from time.AfterFunc) // when the stream's WriteTimeout has fired. func (st *stream) onWriteTimeout() { - st.sc.writeFrameFromHandler(FrameWriteRequest{write: streamError(st.id, ErrCodeInternal)}) + st.sc.writeFrameFromHandler(FrameWriteRequest{write: StreamError{ + StreamID: st.id, + Code: ErrCodeInternal, + Cause: os.ErrDeadlineExceeded, + }}) } func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error { sc.serveG.check() id := f.StreamID - if sc.inGoAway { - // Ignore. - return nil - } // http://tools.ietf.org/html/rfc7540#section-5.1.1 // Streams initiated by a client MUST use odd-numbered stream // identifiers. [...] An endpoint that receives an unexpected @@ -1901,12 +2005,35 @@ func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error { // (in Go 1.8), though. That's a more sane option anyway. if sc.hs.ReadTimeout != 0 { sc.conn.SetReadDeadline(time.Time{}) + if st.body != nil { + st.readDeadline = time.AfterFunc(sc.hs.ReadTimeout, st.onReadTimeout) + } } go sc.runHandler(rw, req, handler) return nil } +func (sc *serverConn) upgradeRequest(req *http.Request) { + sc.serveG.check() + id := uint32(1) + sc.maxClientStreamID = id + st := sc.newStream(id, 0, stateHalfClosedRemote) + st.reqTrailer = req.Trailer + if st.reqTrailer != nil { + st.trailer = make(http.Header) + } + rw := sc.newResponseWriter(st, req) + + // Disable any read deadline set by the net/http package + // prior to the upgrade. + if sc.hs.ReadTimeout != 0 { + sc.conn.SetReadDeadline(time.Time{}) + } + + go sc.runHandler(rw, req, sc.handler.ServeHTTP) +} + func (st *stream) processTrailerHeaders(f *MetaHeadersFrame) error { sc := st.sc sc.serveG.check() @@ -1949,9 +2076,6 @@ func (sc *serverConn) checkPriority(streamID uint32, p PriorityParam) error { } func (sc *serverConn) processPriority(f *PriorityFrame) error { - if sc.inGoAway { - return nil - } if err := sc.checkPriority(f.StreamID, f.PriorityParam); err != nil { return err } @@ -1976,8 +2100,7 @@ func (sc *serverConn) newStream(id, pusherID uint32, state streamState) *stream st.cw.Init() st.flow.conn = &sc.flow // link to conn-level counter st.flow.add(sc.initialStreamSendWindowSize) - st.inflow.conn = &sc.inflow // link to conn-level counter - st.inflow.add(sc.srv.initialStreamRecvWindowSize()) + st.inflow.init(sc.srv.initialStreamRecvWindowSize()) if sc.hs.WriteTimeout != 0 { st.writeDeadline = time.AfterFunc(sc.hs.WriteTimeout, st.onWriteTimeout) } @@ -2025,12 +2148,6 @@ func (sc *serverConn) newWriterAndRequest(st *stream, f *MetaHeadersFrame) (*res return nil, nil, sc.countError("bad_path_method", streamError(f.StreamID, ErrCodeProtocol)) } - bodyOpen := !f.StreamEnded() - if rp.method == "HEAD" && bodyOpen { - // HEAD requests can't have bodies - return nil, nil, sc.countError("head_body", streamError(f.StreamID, ErrCodeProtocol)) - } - rp.header = make(http.Header) for _, hf := range f.RegularFields() { rp.header.Add(sc.canonicalHeader(hf.Name), hf.Value) @@ -2043,6 +2160,7 @@ func (sc *serverConn) newWriterAndRequest(st *stream, f *MetaHeadersFrame) (*res if err != nil { return nil, nil, err } + bodyOpen := !f.StreamEnded() if bodyOpen { if vv, ok := rp.header["Content-Length"]; ok { if cl, err := strconv.ParseUint(vv[0], 10, 63); err == nil { @@ -2137,6 +2255,11 @@ func (sc *serverConn) newWriterAndRequestNoBody(st *stream, rp requestParam) (*r } req = req.WithContext(st.ctx) + rw := sc.newResponseWriter(st, req) + return rw, req, nil +} + +func (sc *serverConn) newResponseWriter(st *stream, req *http.Request) *responseWriter { rws := responseWriterStatePool.Get().(*responseWriterState) bwSave := rws.bw *rws = responseWriterState{} // zero all the fields @@ -2145,10 +2268,7 @@ func (sc *serverConn) newWriterAndRequestNoBody(st *stream, rp requestParam) (*r rws.bw.Reset(chunkWriter{rws}) rws.stream = st rws.req = req - rws.body = body - - rw := &responseWriter{rws: rws} - return rw, req, nil + return &responseWriter{rws: rws} } // Run on its own goroutine. @@ -2156,6 +2276,9 @@ func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler didPanic := true defer func() { rw.rws.stream.cancelCtx() + if req.MultipartForm != nil { + req.MultipartForm.RemoveAll() + } if didPanic { e := recover() sc.writeFrameFromHandler(FrameWriteRequest{ @@ -2259,47 +2382,28 @@ func (sc *serverConn) noteBodyRead(st *stream, n int) { } // st may be nil for conn-level -func (sc *serverConn) sendWindowUpdate(st *stream, n int) { - sc.serveG.check() - // "The legal range for the increment to the flow control - // window is 1 to 2^31-1 (2,147,483,647) octets." - // A Go Read call on 64-bit machines could in theory read - // a larger Read than this. Very unlikely, but we handle it here - // rather than elsewhere for now. - const maxUint31 = 1<<31 - 1 - for n >= maxUint31 { - sc.sendWindowUpdate32(st, maxUint31) - n -= maxUint31 - } - sc.sendWindowUpdate32(st, int32(n)) +func (sc *serverConn) sendWindowUpdate32(st *stream, n int32) { + sc.sendWindowUpdate(st, int(n)) } // st may be nil for conn-level -func (sc *serverConn) sendWindowUpdate32(st *stream, n int32) { +func (sc *serverConn) sendWindowUpdate(st *stream, n int) { sc.serveG.check() - if n == 0 { - return - } - if n < 0 { - panic("negative update") - } var streamID uint32 - if st != nil { + var send int32 + if st == nil { + send = sc.inflow.add(n) + } else { streamID = st.id + send = st.inflow.add(n) + } + if send == 0 { + return } sc.writeFrame(FrameWriteRequest{ - write: writeWindowUpdate{streamID: streamID, n: uint32(n)}, + write: writeWindowUpdate{streamID: streamID, n: uint32(send)}, stream: st, }) - var ok bool - if st == nil { - ok = sc.inflow.add(n) - } else { - ok = st.inflow.add(n) - } - if !ok { - panic("internal error; sent too many window updates without decrements?") - } } // requestBody is the Handler's Request.Body type. @@ -2308,17 +2412,18 @@ type requestBody struct { _ incomparable stream *stream conn *serverConn - closed bool // for use by Close only - sawEOF bool // for use by Read only - pipe *pipe // non-nil if we have a HTTP entity message body - needsContinue bool // need to send a 100-continue + closeOnce sync.Once // for use by Close only + sawEOF bool // for use by Read only + pipe *pipe // non-nil if we have a HTTP entity message body + needsContinue bool // need to send a 100-continue } func (b *requestBody) Close() error { - if b.pipe != nil && !b.closed { - b.pipe.BreakWithError(errClosedBody) - } - b.closed = true + b.closeOnce.Do(func() { + if b.pipe != nil { + b.pipe.BreakWithError(errClosedBody) + } + }) return nil } @@ -2362,7 +2467,6 @@ type responseWriterState struct { // immutable within a request: stream *stream req *http.Request - body *requestBody // to close at end of request, if DATA frames didn't conn *serverConn // TODO: adjust buffer writing sizes based on server config, frame size updates from peer, etc @@ -2387,7 +2491,15 @@ type responseWriterState struct { type chunkWriter struct{ rws *responseWriterState } -func (cw chunkWriter) Write(p []byte) (n int, err error) { return cw.rws.writeChunk(p) } +func (cw chunkWriter) Write(p []byte) (n int, err error) { + n, err = cw.rws.writeChunk(p) + if err == errStreamClosed { + // If writing failed because the stream has been closed, + // return the reason it was closed. + err = cw.rws.stream.closeErr + } + return n, err +} func (rws *responseWriterState) hasTrailers() bool { return len(rws.trailers) > 0 } @@ -2426,6 +2538,10 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { rws.writeHeader(200) } + if rws.handlerDone { + rws.promoteUndeclaredTrailers() + } + isHeadResp := rws.req.Method == "HEAD" if !rws.sentHeader { rws.sentHeader = true @@ -2497,10 +2613,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { return 0, nil } - if rws.handlerDone { - rws.promoteUndeclaredTrailers() - } - // only send trailers if they have actually been defined by the // server handler. hasNonemptyTrailers := rws.hasNonemptyTrailers() @@ -2538,8 +2650,9 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { // prior to the headers being written. If the set of trailers is fixed // or known before the header is written, the normal Go trailers mechanism // is preferred: -// https://golang.org/pkg/net/http/#ResponseWriter -// https://golang.org/pkg/net/http/#example_ResponseWriter_trailers +// +// https://golang.org/pkg/net/http/#ResponseWriter +// https://golang.org/pkg/net/http/#example_ResponseWriter_trailers const TrailerPrefix = "Trailer:" // promoteUndeclaredTrailers permits http.Handlers to set trailers @@ -2580,23 +2693,85 @@ func (rws *responseWriterState) promoteUndeclaredTrailers() { } } +func (w *responseWriter) SetReadDeadline(deadline time.Time) error { + st := w.rws.stream + if !deadline.IsZero() && deadline.Before(time.Now()) { + // If we're setting a deadline in the past, reset the stream immediately + // so writes after SetWriteDeadline returns will fail. + st.onReadTimeout() + return nil + } + w.rws.conn.sendServeMsg(func(sc *serverConn) { + if st.readDeadline != nil { + if !st.readDeadline.Stop() { + // Deadline already exceeded, or stream has been closed. + return + } + } + if deadline.IsZero() { + st.readDeadline = nil + } else if st.readDeadline == nil { + st.readDeadline = time.AfterFunc(deadline.Sub(time.Now()), st.onReadTimeout) + } else { + st.readDeadline.Reset(deadline.Sub(time.Now())) + } + }) + return nil +} + +func (w *responseWriter) SetWriteDeadline(deadline time.Time) error { + st := w.rws.stream + if !deadline.IsZero() && deadline.Before(time.Now()) { + // If we're setting a deadline in the past, reset the stream immediately + // so writes after SetWriteDeadline returns will fail. + st.onWriteTimeout() + return nil + } + w.rws.conn.sendServeMsg(func(sc *serverConn) { + if st.writeDeadline != nil { + if !st.writeDeadline.Stop() { + // Deadline already exceeded, or stream has been closed. + return + } + } + if deadline.IsZero() { + st.writeDeadline = nil + } else if st.writeDeadline == nil { + st.writeDeadline = time.AfterFunc(deadline.Sub(time.Now()), st.onWriteTimeout) + } else { + st.writeDeadline.Reset(deadline.Sub(time.Now())) + } + }) + return nil +} + func (w *responseWriter) Flush() { + w.FlushError() +} + +func (w *responseWriter) FlushError() error { rws := w.rws if rws == nil { panic("Header called after Handler finished") } + var err error if rws.bw.Buffered() > 0 { - if err := rws.bw.Flush(); err != nil { - // Ignore the error. The frame writer already knows. - return - } + err = rws.bw.Flush() } else { // The bufio.Writer won't call chunkWriter.Write // (writeChunk with zero bytes, so we have to do it // ourselves to force the HTTP response header and/or // final DATA frame (with END_STREAM) to be sent. - rws.writeChunk(nil) + _, err = chunkWriter{rws}.Write(nil) + if err == nil { + select { + case <-rws.stream.cw: + err = rws.stream.closeErr + default: + } + } } + return err } func (w *responseWriter) CloseNotify() <-chan bool { @@ -2635,8 +2810,7 @@ func checkWriteHeaderCode(code int) { // Issue 22880: require valid WriteHeader status codes. // For now we only enforce that it's three digits. // In the future we might block things over 599 (600 and above aren't defined - // at http://httpwg.org/specs/rfc7231.html#status.codes) - // and we might block under 200 (once we have more mature 1xx support). + // at http://httpwg.org/specs/rfc7231.html#status.codes). // But for now any three digits. // // We used to send "HTTP/1.1 000 0" on the wire in responses but there's @@ -2657,13 +2831,41 @@ func (w *responseWriter) WriteHeader(code int) { } func (rws *responseWriterState) writeHeader(code int) { - if !rws.wroteHeader { - checkWriteHeaderCode(code) - rws.wroteHeader = true - rws.status = code - if len(rws.handlerHeader) > 0 { - rws.snapHeader = cloneHeader(rws.handlerHeader) + if rws.wroteHeader { + return + } + + checkWriteHeaderCode(code) + + // Handle informational headers + if code >= 100 && code <= 199 { + // Per RFC 8297 we must not clear the current header map + h := rws.handlerHeader + + _, cl := h["Content-Length"] + _, te := h["Transfer-Encoding"] + if cl || te { + h = h.Clone() + h.Del("Content-Length") + h.Del("Transfer-Encoding") + } + + if rws.conn.writeHeaders(rws.stream, &writeResHeaders{ + streamID: rws.stream.id, + httpResCode: code, + h: h, + endStream: rws.handlerDone && !rws.hasTrailers(), + }) != nil { + rws.dirty = true } + + return + } + + rws.wroteHeader = true + rws.status = code + if len(rws.handlerHeader) > 0 { + rws.snapHeader = cloneHeader(rws.handlerHeader) } } diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go index b5e2ac64d475..b43ec10cfed9 100644 --- a/vendor/golang.org/x/net/http2/transport.go +++ b/vendor/golang.org/x/net/http2/transport.go @@ -16,7 +16,7 @@ import ( "errors" "fmt" "io" - "io/ioutil" + "io/fs" "log" "math" mathrand "math/rand" @@ -47,10 +47,6 @@ const ( // we buffer per stream. transportDefaultStreamFlow = 4 << 20 - // transportDefaultStreamMinRefresh is the minimum number of bytes we'll send - // a stream-level WINDOW_UPDATE for at a time. - transportDefaultStreamMinRefresh = 4 << 10 - defaultUserAgent = "Go-http-client/2.0" // initialMaxConcurrentStreams is a connections maxConcurrentStreams until @@ -68,13 +64,23 @@ const ( // A Transport internally caches connections to servers. It is safe // for concurrent use by multiple goroutines. type Transport struct { - // DialTLS specifies an optional dial function for creating - // TLS connections for requests. + // DialTLSContext specifies an optional dial function with context for + // creating TLS connections for requests. // - // If DialTLS is nil, tls.Dial is used. + // If DialTLSContext and DialTLS is nil, tls.Dial is used. // // If the returned net.Conn has a ConnectionState method like tls.Conn, // it will be used to set http.Response.TLS. + DialTLSContext func(ctx context.Context, network, addr string, cfg *tls.Config) (net.Conn, error) + + // DialTLS specifies an optional dial function for creating + // TLS connections for requests. + // + // If DialTLSContext and DialTLS is nil, tls.Dial is used. + // + // Deprecated: Use DialTLSContext instead, which allows the transport + // to cancel dials as soon as they are no longer needed. + // If both are set, DialTLSContext takes priority. DialTLS func(network, addr string, cfg *tls.Config) (net.Conn, error) // TLSClientConfig specifies the TLS configuration to use with @@ -108,6 +114,28 @@ type Transport struct { // to mean no limit. MaxHeaderListSize uint32 + // MaxReadFrameSize is the http2 SETTINGS_MAX_FRAME_SIZE to send in the + // initial settings frame. It is the size in bytes of the largest frame + // payload that the sender is willing to receive. If 0, no setting is + // sent, and the value is provided by the peer, which should be 16384 + // according to the spec: + // https://datatracker.ietf.org/doc/html/rfc7540#section-6.5.2. + // Values are bounded in the range 16k to 16M. + MaxReadFrameSize uint32 + + // MaxDecoderHeaderTableSize optionally specifies the http2 + // SETTINGS_HEADER_TABLE_SIZE to send in the initial settings frame. It + // informs the remote endpoint of the maximum size of the header compression + // table used to decode header blocks, in octets. If zero, the default value + // of 4096 is used. + MaxDecoderHeaderTableSize uint32 + + // MaxEncoderHeaderTableSize optionally specifies an upper limit for the + // header compression table used for encoding request headers. Received + // SETTINGS_HEADER_TABLE_SIZE settings are capped at this limit. If zero, + // the default value of 4096 is used. + MaxEncoderHeaderTableSize uint32 + // StrictMaxConcurrentStreams controls whether the server's // SETTINGS_MAX_CONCURRENT_STREAMS should be respected // globally. If false, new TCP connections are created to the @@ -161,6 +189,19 @@ func (t *Transport) maxHeaderListSize() uint32 { return t.MaxHeaderListSize } +func (t *Transport) maxFrameReadSize() uint32 { + if t.MaxReadFrameSize == 0 { + return 0 // use the default provided by the peer + } + if t.MaxReadFrameSize < minMaxFrameSize { + return minMaxFrameSize + } + if t.MaxReadFrameSize > maxFrameSize { + return maxFrameSize + } + return t.MaxReadFrameSize +} + func (t *Transport) disableCompression() bool { return t.DisableCompression || (t.t1 != nil && t.t1.DisableCompression) } @@ -249,7 +290,8 @@ func (t *Transport) initConnPool() { // HTTP/2 server. type ClientConn struct { t *Transport - tconn net.Conn // usually *tls.Conn, except specialized impls + tconn net.Conn // usually *tls.Conn, except specialized impls + tconnClosed bool tlsState *tls.ConnectionState // nil only for specialized impls reused uint32 // whether conn is being reused; atomic singleUse bool // whether being used for a single http.Request @@ -264,8 +306,8 @@ type ClientConn struct { mu sync.Mutex // guards following cond *sync.Cond // hold mu; broadcast on flow/closed changes - flow flow // our conn-level flow control quota (cs.flow is per stream) - inflow flow // peer's conn-level flow control + flow outflow // our conn-level flow control quota (cs.outflow is per stream) + inflow inflow // peer's conn-level flow control doNotReuse bool // whether conn is marked to not be reused for any future requests closing bool closed bool @@ -282,10 +324,11 @@ type ClientConn struct { lastActive time.Time lastIdle time.Time // time last idle // Settings from peer: (also guarded by wmu) - maxFrameSize uint32 - maxConcurrentStreams uint32 - peerMaxHeaderListSize uint64 - initialWindowSize uint32 + maxFrameSize uint32 + maxConcurrentStreams uint32 + peerMaxHeaderListSize uint64 + peerMaxHeaderTableSize uint32 + initialWindowSize uint32 // reqHeaderMu is a 1-element semaphore channel controlling access to sending new requests. // Write to reqHeaderMu to lock it, read from it to unlock. @@ -329,14 +372,14 @@ type clientStream struct { respHeaderRecv chan struct{} // closed when headers are received res *http.Response // set if respHeaderRecv is closed - flow flow // guarded by cc.mu - inflow flow // guarded by cc.mu - bytesRemain int64 // -1 means unknown; owned by transportResponseBody.Read - readErr error // sticky read error; owned by transportResponseBody.Read + flow outflow // guarded by cc.mu + inflow inflow // guarded by cc.mu + bytesRemain int64 // -1 means unknown; owned by transportResponseBody.Read + readErr error // sticky read error; owned by transportResponseBody.Read reqBody io.ReadCloser - reqBodyContentLength int64 // -1 means unknown - reqBodyClosed bool // body has been closed; guarded by cc.mu + reqBodyContentLength int64 // -1 means unknown + reqBodyClosed chan struct{} // guarded by cc.mu; non-nil on Close, closed when done // owned by writeRequest: sentEndStream bool // sent an END_STREAM flag to the peer @@ -376,9 +419,8 @@ func (cs *clientStream) abortStreamLocked(err error) { cs.abortErr = err close(cs.abort) }) - if cs.reqBody != nil && !cs.reqBodyClosed { - cs.reqBody.Close() - cs.reqBodyClosed = true + if cs.reqBody != nil { + cs.closeReqBodyLocked() } // TODO(dneil): Clean up tests where cs.cc.cond is nil. if cs.cc.cond != nil { @@ -391,13 +433,24 @@ func (cs *clientStream) abortRequestBodyWrite() { cc := cs.cc cc.mu.Lock() defer cc.mu.Unlock() - if cs.reqBody != nil && !cs.reqBodyClosed { - cs.reqBody.Close() - cs.reqBodyClosed = true + if cs.reqBody != nil && cs.reqBodyClosed == nil { + cs.closeReqBodyLocked() cc.cond.Broadcast() } } +func (cs *clientStream) closeReqBodyLocked() { + if cs.reqBodyClosed != nil { + return + } + cs.reqBodyClosed = make(chan struct{}) + reqBodyClosed := cs.reqBodyClosed + go func() { + cs.reqBody.Close() + close(reqBodyClosed) + }() +} + type stickyErrWriter struct { conn net.Conn timeout time.Duration @@ -481,6 +534,15 @@ func authorityAddr(scheme string, authority string) (addr string) { return net.JoinHostPort(host, port) } +var retryBackoffHook func(time.Duration) *time.Timer + +func backoffNewTimer(d time.Duration) *time.Timer { + if retryBackoffHook != nil { + return retryBackoffHook(d) + } + return time.NewTimer(d) +} + // RoundTripOpt is like RoundTrip, but takes options. func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Response, error) { if !(req.URL.Scheme == "https" || (req.URL.Scheme == "http" && t.AllowHTTP)) { @@ -501,14 +563,19 @@ func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Res if req, err = shouldRetryRequest(req, err); err == nil { // After the first retry, do exponential backoff with 10% jitter. if retry == 0 { + t.vlogf("RoundTrip retrying after failure: %v", err) continue } backoff := float64(uint(1) << (uint(retry) - 1)) backoff += backoff * (0.1 * mathrand.Float64()) + d := time.Second * time.Duration(backoff) + timer := backoffNewTimer(d) select { - case <-time.After(time.Second * time.Duration(backoff)): + case <-timer.C: + t.vlogf("RoundTrip retrying after failure: %v", err) continue case <-req.Context().Done(): + timer.Stop() err = req.Context().Err() } } @@ -591,7 +658,7 @@ func (t *Transport) dialClientConn(ctx context.Context, addr string, singleUse b if err != nil { return nil, err } - tconn, err := t.dialTLS(ctx)("tcp", addr, t.newTLSConfig(host)) + tconn, err := t.dialTLS(ctx, "tcp", addr, t.newTLSConfig(host)) if err != nil { return nil, err } @@ -612,24 +679,25 @@ func (t *Transport) newTLSConfig(host string) *tls.Config { return cfg } -func (t *Transport) dialTLS(ctx context.Context) func(string, string, *tls.Config) (net.Conn, error) { - if t.DialTLS != nil { - return t.DialTLS +func (t *Transport) dialTLS(ctx context.Context, network, addr string, tlsCfg *tls.Config) (net.Conn, error) { + if t.DialTLSContext != nil { + return t.DialTLSContext(ctx, network, addr, tlsCfg) + } else if t.DialTLS != nil { + return t.DialTLS(network, addr, tlsCfg) } - return func(network, addr string, cfg *tls.Config) (net.Conn, error) { - tlsCn, err := t.dialTLSWithContext(ctx, network, addr, cfg) - if err != nil { - return nil, err - } - state := tlsCn.ConnectionState() - if p := state.NegotiatedProtocol; p != NextProtoTLS { - return nil, fmt.Errorf("http2: unexpected ALPN protocol %q; want %q", p, NextProtoTLS) - } - if !state.NegotiatedProtocolIsMutual { - return nil, errors.New("http2: could not negotiate protocol mutually") - } - return tlsCn, nil + + tlsCn, err := t.dialTLSWithContext(ctx, network, addr, tlsCfg) + if err != nil { + return nil, err } + state := tlsCn.ConnectionState() + if p := state.NegotiatedProtocol; p != NextProtoTLS { + return nil, fmt.Errorf("http2: unexpected ALPN protocol %q; want %q", p, NextProtoTLS) + } + if !state.NegotiatedProtocolIsMutual { + return nil, errors.New("http2: could not negotiate protocol mutually") + } + return tlsCn, nil } // disableKeepAlives reports whether connections should be closed as @@ -645,6 +713,20 @@ func (t *Transport) expectContinueTimeout() time.Duration { return t.t1.ExpectContinueTimeout } +func (t *Transport) maxDecoderHeaderTableSize() uint32 { + if v := t.MaxDecoderHeaderTableSize; v > 0 { + return v + } + return initialHeaderTableSize +} + +func (t *Transport) maxEncoderHeaderTableSize() uint32 { + if v := t.MaxEncoderHeaderTableSize; v > 0 { + return v + } + return initialHeaderTableSize +} + func (t *Transport) NewClientConn(c net.Conn) (*ClientConn, error) { return t.newClientConn(c, t.disableKeepAlives()) } @@ -685,15 +767,19 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro }) cc.br = bufio.NewReader(c) cc.fr = NewFramer(cc.bw, cc.br) + if t.maxFrameReadSize() != 0 { + cc.fr.SetMaxReadFrameSize(t.maxFrameReadSize()) + } if t.CountError != nil { cc.fr.countError = t.CountError } - cc.fr.ReadMetaHeaders = hpack.NewDecoder(initialHeaderTableSize, nil) + maxHeaderTableSize := t.maxDecoderHeaderTableSize() + cc.fr.ReadMetaHeaders = hpack.NewDecoder(maxHeaderTableSize, nil) cc.fr.MaxHeaderListSize = t.maxHeaderListSize() - // TODO: SetMaxDynamicTableSize, SetMaxDynamicTableSizeLimit on - // henc in response to SETTINGS frames? cc.henc = hpack.NewEncoder(&cc.hbuf) + cc.henc.SetMaxDynamicTableSizeLimit(t.maxEncoderHeaderTableSize()) + cc.peerMaxHeaderTableSize = initialHeaderTableSize if t.AllowHTTP { cc.nextStreamID = 3 @@ -708,14 +794,20 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro {ID: SettingEnablePush, Val: 0}, {ID: SettingInitialWindowSize, Val: transportDefaultStreamFlow}, } + if max := t.maxFrameReadSize(); max != 0 { + initialSettings = append(initialSettings, Setting{ID: SettingMaxFrameSize, Val: max}) + } if max := t.maxHeaderListSize(); max != 0 { initialSettings = append(initialSettings, Setting{ID: SettingMaxHeaderListSize, Val: max}) } + if maxHeaderTableSize != initialHeaderTableSize { + initialSettings = append(initialSettings, Setting{ID: SettingHeaderTableSize, Val: maxHeaderTableSize}) + } cc.bw.Write(clientPreface) cc.fr.WriteSettings(initialSettings...) cc.fr.WriteWindowUpdate(0, transportDefaultConnFlow) - cc.inflow.add(transportDefaultConnFlow + initialWindowSize) + cc.inflow.init(transportDefaultConnFlow + initialWindowSize) cc.bw.Flush() if cc.werr != nil { cc.Close() @@ -732,11 +824,13 @@ func (cc *ClientConn) healthCheck() { // trigger the healthCheck again if there is no frame received. ctx, cancel := context.WithTimeout(context.Background(), pingTimeout) defer cancel() + cc.vlogf("http2: Transport sending health check") err := cc.Ping(ctx) if err != nil { + cc.vlogf("http2: Transport health check failure: %v", err) cc.closeForLostPing() - cc.t.connPool().MarkDead(cc) - return + } else { + cc.vlogf("http2: Transport health check success") } } @@ -907,6 +1001,24 @@ func (cc *ClientConn) onIdleTimeout() { cc.closeIfIdle() } +func (cc *ClientConn) closeConn() { + t := time.AfterFunc(250*time.Millisecond, cc.forceCloseConn) + defer t.Stop() + cc.tconn.Close() +} + +// A tls.Conn.Close can hang for a long time if the peer is unresponsive. +// Try to shut it down more aggressively. +func (cc *ClientConn) forceCloseConn() { + tc, ok := cc.tconn.(*tls.Conn) + if !ok { + return + } + if nc := tlsUnderlyingConn(tc); nc != nil { + nc.Close() + } +} + func (cc *ClientConn) closeIfIdle() { cc.mu.Lock() if len(cc.streams) > 0 || cc.streamsReserved > 0 { @@ -921,7 +1033,7 @@ func (cc *ClientConn) closeIfIdle() { if VerboseLogs { cc.vlogf("http2: Transport closing idle conn %p (forSingleUse=%v, maxStream=%v)", cc, cc.singleUse, nextID-2) } - cc.tconn.Close() + cc.closeConn() } func (cc *ClientConn) isDoNotReuseAndIdle() bool { @@ -938,7 +1050,7 @@ func (cc *ClientConn) Shutdown(ctx context.Context) error { return err } // Wait for all in-flight streams to complete or connection to close - done := make(chan error, 1) + done := make(chan struct{}) cancelled := false // guarded by cc.mu go func() { cc.mu.Lock() @@ -946,7 +1058,7 @@ func (cc *ClientConn) Shutdown(ctx context.Context) error { for { if len(cc.streams) == 0 || cc.closed { cc.closed = true - done <- cc.tconn.Close() + close(done) break } if cancelled { @@ -957,8 +1069,9 @@ func (cc *ClientConn) Shutdown(ctx context.Context) error { }() shutdownEnterWaitStateHook() select { - case err := <-done: - return err + case <-done: + cc.closeConn() + return nil case <-ctx.Done(): cc.mu.Lock() // Free the goroutine above @@ -995,15 +1108,15 @@ func (cc *ClientConn) sendGoAway() error { // closes the client connection immediately. In-flight requests are interrupted. // err is sent to streams. -func (cc *ClientConn) closeForError(err error) error { +func (cc *ClientConn) closeForError(err error) { cc.mu.Lock() cc.closed = true for _, cs := range cc.streams { cs.abortStreamLocked(err) } - defer cc.cond.Broadcast() - defer cc.mu.Unlock() - return cc.tconn.Close() + cc.cond.Broadcast() + cc.mu.Unlock() + cc.closeConn() } // Close closes the client connection immediately. @@ -1011,16 +1124,17 @@ func (cc *ClientConn) closeForError(err error) error { // In-flight requests are interrupted. For a graceful shutdown, use Shutdown instead. func (cc *ClientConn) Close() error { err := errors.New("http2: client connection force closed via ClientConn.Close") - return cc.closeForError(err) + cc.closeForError(err) + return nil } // closes the client connection immediately. In-flight requests are interrupted. -func (cc *ClientConn) closeForLostPing() error { +func (cc *ClientConn) closeForLostPing() { err := errors.New("http2: client connection lost") if f := cc.t.CountError; f != nil { f("conn_close_lost_ping") } - return cc.closeForError(err) + cc.closeForError(err) } // errRequestCanceled is a copy of net/http's errRequestCanceled because it's not @@ -1030,7 +1144,7 @@ var errRequestCanceled = errors.New("net/http: request canceled") func commaSeparatedTrailers(req *http.Request) (string, error) { keys := make([]string, 0, len(req.Trailer)) for k := range req.Trailer { - k = http.CanonicalHeaderKey(k) + k = canonicalHeader(k) switch k { case "Transfer-Encoding", "Trailer", "Content-Length": return "", fmt.Errorf("invalid Trailer key %q", k) @@ -1124,36 +1238,49 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { } } + handleResponseHeaders := func() (*http.Response, error) { + res := cs.res + if res.StatusCode > 299 { + // On error or status code 3xx, 4xx, 5xx, etc abort any + // ongoing write, assuming that the server doesn't care + // about our request body. If the server replied with 1xx or + // 2xx, however, then assume the server DOES potentially + // want our body (e.g. full-duplex streaming: + // golang.org/issue/13444). If it turns out the server + // doesn't, they'll RST_STREAM us soon enough. This is a + // heuristic to avoid adding knobs to Transport. Hopefully + // we can keep it. + cs.abortRequestBodyWrite() + } + res.Request = req + res.TLS = cc.tlsState + if res.Body == noBody && actualContentLength(req) == 0 { + // If there isn't a request or response body still being + // written, then wait for the stream to be closed before + // RoundTrip returns. + if err := waitDone(); err != nil { + return nil, err + } + } + return res, nil + } + for { select { case <-cs.respHeaderRecv: - res := cs.res - if res.StatusCode > 299 { - // On error or status code 3xx, 4xx, 5xx, etc abort any - // ongoing write, assuming that the server doesn't care - // about our request body. If the server replied with 1xx or - // 2xx, however, then assume the server DOES potentially - // want our body (e.g. full-duplex streaming: - // golang.org/issue/13444). If it turns out the server - // doesn't, they'll RST_STREAM us soon enough. This is a - // heuristic to avoid adding knobs to Transport. Hopefully - // we can keep it. - cs.abortRequestBodyWrite() - } - res.Request = req - res.TLS = cc.tlsState - if res.Body == noBody && actualContentLength(req) == 0 { - // If there isn't a request or response body still being - // written, then wait for the stream to be closed before - // RoundTrip returns. - if err := waitDone(); err != nil { - return nil, err - } - } - return res, nil + return handleResponseHeaders() case <-cs.abort: - waitDone() - return nil, cs.abortErr + select { + case <-cs.respHeaderRecv: + // If both cs.respHeaderRecv and cs.abort are signaling, + // pick respHeaderRecv. The server probably wrote the + // response and immediately reset the stream. + // golang.org/issue/49645 + return handleResponseHeaders() + default: + waitDone() + return nil, cs.abortErr + } case <-ctx.Done(): err := ctx.Err() cs.abortStream(err) @@ -1239,12 +1366,12 @@ func (cs *clientStream) writeRequest(req *http.Request) (err error) { } continueTimeout := cc.t.expectContinueTimeout() - if continueTimeout != 0 && - !httpguts.HeaderValuesContainsToken( - req.Header["Expect"], - "100-continue") { - continueTimeout = 0 - cs.on100 = make(chan struct{}, 1) + if continueTimeout != 0 { + if !httpguts.HeaderValuesContainsToken(req.Header["Expect"], "100-continue") { + continueTimeout = 0 + } else { + cs.on100 = make(chan struct{}, 1) + } } // Past this point (where we send request headers), it is possible for @@ -1313,6 +1440,7 @@ func (cs *clientStream) writeRequest(req *http.Request) (err error) { case <-respHeaderTimer: return errTimeout case <-respHeaderRecv: + respHeaderRecv = nil respHeaderTimer = nil // keep waiting for END_STREAM case <-cs.abort: return cs.abortErr @@ -1384,11 +1512,19 @@ func (cs *clientStream) cleanupWriteRequest(err error) { // and in multiple cases: server replies <=299 and >299 // while still writing request body cc.mu.Lock() + mustCloseBody := false + if cs.reqBody != nil && cs.reqBodyClosed == nil { + mustCloseBody = true + cs.reqBodyClosed = make(chan struct{}) + } bodyClosed := cs.reqBodyClosed - cs.reqBodyClosed = true cc.mu.Unlock() - if !bodyClosed && cs.reqBody != nil { + if mustCloseBody { cs.reqBody.Close() + close(bodyClosed) + } + if bodyClosed != nil { + <-bodyClosed } if err != nil && cs.sentEndStream { @@ -1545,7 +1681,7 @@ func (cs *clientStream) writeRequestBody(req *http.Request) (err error) { var sawEOF bool for !sawEOF { - n, err := body.Read(buf[:len(buf)]) + n, err := body.Read(buf) if hasContentLen { remainLen -= int64(n) if remainLen == 0 && err == nil { @@ -1568,7 +1704,7 @@ func (cs *clientStream) writeRequestBody(req *http.Request) (err error) { } if err != nil { cc.mu.Lock() - bodyClosed := cs.reqBodyClosed + bodyClosed := cs.reqBodyClosed != nil cc.mu.Unlock() switch { case bodyClosed: @@ -1663,7 +1799,7 @@ func (cs *clientStream) awaitFlowControl(maxBytes int) (taken int32, err error) if cc.closed { return 0, errClientConnClosed } - if cs.reqBodyClosed { + if cs.reqBodyClosed != nil { return 0, errStopReqBodyWrite } select { @@ -1734,7 +1870,8 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail } for _, v := range vv { if !httpguts.ValidHeaderFieldValue(v) { - return nil, fmt.Errorf("invalid HTTP header value %q for header %q", v, k) + // Don't include the value in the error, because it may be sensitive. + return nil, fmt.Errorf("invalid HTTP header value for header %q", k) } } } @@ -1847,7 +1984,7 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail // Header list size is ok. Write the headers. enumerateHeaders(func(name, value string) { - name, ascii := asciiToLower(name) + name, ascii := lowerHeader(name) if !ascii { // Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header // field names have to be ASCII characters (just as in HTTP/1.x). @@ -1900,7 +2037,7 @@ func (cc *ClientConn) encodeTrailers(trailer http.Header) ([]byte, error) { } for k, vv := range trailer { - lowKey, ascii := asciiToLower(k) + lowKey, ascii := lowerHeader(k) if !ascii { // Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header // field names have to be ASCII characters (just as in HTTP/1.x). @@ -1932,8 +2069,7 @@ type resAndError struct { func (cc *ClientConn) addStreamLocked(cs *clientStream) { cs.flow.add(int32(cc.initialWindowSize)) cs.flow.setConnFlow(&cc.flow) - cs.inflow.add(transportDefaultStreamFlow) - cs.inflow.setConnFlow(&cc.inflow) + cs.inflow.init(transportDefaultStreamFlow) cs.ID = cc.nextStreamID cc.nextStreamID += 2 cc.streams[cs.ID] = cs @@ -1958,13 +2094,13 @@ func (cc *ClientConn) forgetStreamID(id uint32) { // wake up RoundTrip if there is a pending request. cc.cond.Broadcast() - closeOnIdle := cc.singleUse || cc.doNotReuse || cc.t.disableKeepAlives() + closeOnIdle := cc.singleUse || cc.doNotReuse || cc.t.disableKeepAlives() || cc.goAway != nil if closeOnIdle && cc.streamsReserved == 0 && len(cc.streams) == 0 { if VerboseLogs { cc.vlogf("http2: Transport closing idle conn %p (forSingleUse=%v, maxStream=%v)", cc, cc.singleUse, cc.nextStreamID-2) } cc.closed = true - defer cc.tconn.Close() + defer cc.closeConn() } cc.mu.Unlock() @@ -2011,8 +2147,8 @@ func isEOFOrNetReadError(err error) bool { func (rl *clientConnReadLoop) cleanup() { cc := rl.cc - defer cc.tconn.Close() - defer cc.t.connPool().MarkDead(cc) + cc.t.connPool().MarkDead(cc) + defer cc.closeConn() defer close(cc.readerDone) if cc.idleTimer != nil { @@ -2034,6 +2170,7 @@ func (rl *clientConnReadLoop) cleanup() { err = io.ErrUnexpectedEOF } cc.closed = true + for _, cs := range cc.streams { select { case <-cs.peerClosed: @@ -2232,7 +2369,7 @@ func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFra Status: status + " " + http.StatusText(statusCode), } for _, hf := range regularFields { - key := http.CanonicalHeaderKey(hf.Name) + key := canonicalHeader(hf.Name) if key == "Trailer" { t := res.Trailer if t == nil { @@ -2240,7 +2377,7 @@ func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFra res.Trailer = t } foreachHeaderElement(hf.Value, func(v string) { - t[http.CanonicalHeaderKey(v)] = nil + t[canonicalHeader(v)] = nil }) } else { vv := header[key] @@ -2345,7 +2482,7 @@ func (rl *clientConnReadLoop) processTrailers(cs *clientStream, f *MetaHeadersFr trailer := make(http.Header) for _, hf := range f.RegularFields() { - key := http.CanonicalHeaderKey(hf.Name) + key := canonicalHeader(hf.Name) trailer[key] = append(trailer[key], hf.Value) } cs.trailer = trailer @@ -2391,21 +2528,10 @@ func (b transportResponseBody) Read(p []byte) (n int, err error) { } cc.mu.Lock() - var connAdd, streamAdd int32 - // Check the conn-level first, before the stream-level. - if v := cc.inflow.available(); v < transportDefaultConnFlow/2 { - connAdd = transportDefaultConnFlow - v - cc.inflow.add(connAdd) - } + connAdd := cc.inflow.add(n) + var streamAdd int32 if err == nil { // No need to refresh if the stream is over or failed. - // Consider any buffered body data (read from the conn but not - // consumed by the client) when computing flow control for this - // stream. - v := int(cs.inflow.available()) + cs.bufPipe.Len() - if v < transportDefaultStreamFlow-transportDefaultStreamMinRefresh { - streamAdd = int32(transportDefaultStreamFlow - v) - cs.inflow.add(streamAdd) - } + streamAdd = cs.inflow.add(n) } cc.mu.Unlock() @@ -2433,17 +2559,15 @@ func (b transportResponseBody) Close() error { if unread > 0 { cc.mu.Lock() // Return connection-level flow control. - if unread > 0 { - cc.inflow.add(int32(unread)) - } + connAdd := cc.inflow.add(unread) cc.mu.Unlock() // TODO(dneil): Acquiring this mutex can block indefinitely. // Move flow control return to a goroutine? cc.wmu.Lock() // Return connection-level flow control. - if unread > 0 { - cc.fr.WriteWindowUpdate(0, uint32(unread)) + if connAdd > 0 { + cc.fr.WriteWindowUpdate(0, uint32(connAdd)) } cc.bw.Flush() cc.wmu.Unlock() @@ -2486,13 +2610,18 @@ func (rl *clientConnReadLoop) processData(f *DataFrame) error { // But at least return their flow control: if f.Length > 0 { cc.mu.Lock() - cc.inflow.add(int32(f.Length)) + ok := cc.inflow.take(f.Length) + connAdd := cc.inflow.add(int(f.Length)) cc.mu.Unlock() - - cc.wmu.Lock() - cc.fr.WriteWindowUpdate(0, uint32(f.Length)) - cc.bw.Flush() - cc.wmu.Unlock() + if !ok { + return ConnectionError(ErrCodeFlowControl) + } + if connAdd > 0 { + cc.wmu.Lock() + cc.fr.WriteWindowUpdate(0, uint32(connAdd)) + cc.bw.Flush() + cc.wmu.Unlock() + } } return nil } @@ -2523,9 +2652,7 @@ func (rl *clientConnReadLoop) processData(f *DataFrame) error { } // Check connection-level flow control. cc.mu.Lock() - if cs.inflow.available() >= int32(f.Length) { - cs.inflow.take(int32(f.Length)) - } else { + if !takeInflows(&cc.inflow, &cs.inflow, f.Length) { cc.mu.Unlock() return ConnectionError(ErrCodeFlowControl) } @@ -2547,19 +2674,20 @@ func (rl *clientConnReadLoop) processData(f *DataFrame) error { } } - if refund > 0 { - cc.inflow.add(int32(refund)) - if !didReset { - cs.inflow.add(int32(refund)) - } + sendConn := cc.inflow.add(refund) + var sendStream int32 + if !didReset { + sendStream = cs.inflow.add(refund) } cc.mu.Unlock() - if refund > 0 { + if sendConn > 0 || sendStream > 0 { cc.wmu.Lock() - cc.fr.WriteWindowUpdate(0, uint32(refund)) - if !didReset { - cc.fr.WriteWindowUpdate(cs.ID, uint32(refund)) + if sendConn > 0 { + cc.fr.WriteWindowUpdate(0, uint32(sendConn)) + } + if sendStream > 0 { + cc.fr.WriteWindowUpdate(cs.ID, uint32(sendStream)) } cc.bw.Flush() cc.wmu.Unlock() @@ -2627,7 +2755,6 @@ func (rl *clientConnReadLoop) processGoAway(f *GoAwayFrame) error { if fn := cc.t.CountError; fn != nil { fn("recv_goaway_" + f.ErrCode.stringToken()) } - } cc.setGoAway(f) return nil @@ -2692,8 +2819,10 @@ func (rl *clientConnReadLoop) processSettingsNoWrite(f *SettingsFrame) error { cc.cond.Broadcast() cc.initialWindowSize = s.Val + case SettingHeaderTableSize: + cc.henc.SetMaxDynamicTableSize(s.Val) + cc.peerMaxHeaderTableSize = s.Val default: - // TODO(bradfitz): handle more settings? SETTINGS_HEADER_TABLE_SIZE probably. cc.vlogf("Unhandled Setting: %v", s) } return nil @@ -2867,7 +2996,12 @@ func (t *Transport) logf(format string, args ...interface{}) { log.Printf(format, args...) } -var noBody io.ReadCloser = ioutil.NopCloser(bytes.NewReader(nil)) +var noBody io.ReadCloser = noBodyReader{} + +type noBodyReader struct{} + +func (noBodyReader) Close() error { return nil } +func (noBodyReader) Read([]byte) (int, error) { return 0, io.EOF } type missingBody struct{} @@ -2912,7 +3046,11 @@ func (gz *gzipReader) Read(p []byte) (n int, err error) { } func (gz *gzipReader) Close() error { - return gz.body.Close() + if err := gz.body.Close(); err != nil { + return err + } + gz.zerr = fs.ErrClosed + return nil } type errorReader struct{ err error } @@ -2976,7 +3114,7 @@ func traceGotConn(req *http.Request, cc *ClientConn, reused bool) { cc.mu.Lock() ci.WasIdle = len(cc.streams) == 0 && reused if ci.WasIdle && !cc.lastActive.IsZero() { - ci.IdleTime = time.Now().Sub(cc.lastActive) + ci.IdleTime = time.Since(cc.lastActive) } cc.mu.Unlock() diff --git a/vendor/golang.org/x/net/http2/writesched.go b/vendor/golang.org/x/net/http2/writesched.go index f24d2b1e7d4a..c7cd0017392e 100644 --- a/vendor/golang.org/x/net/http2/writesched.go +++ b/vendor/golang.org/x/net/http2/writesched.go @@ -32,7 +32,8 @@ type WriteScheduler interface { // Pop dequeues the next frame to write. Returns false if no frames can // be written. Frames with a given wr.StreamID() are Pop'd in the same - // order they are Push'd. No frames should be discarded except by CloseStream. + // order they are Push'd, except RST_STREAM frames. No frames should be + // discarded except by CloseStream. Pop() (wr FrameWriteRequest, ok bool) } @@ -52,6 +53,7 @@ type FrameWriteRequest struct { // stream is the stream on which this frame will be written. // nil for non-stream frames like PING and SETTINGS. + // nil for RST_STREAM streams, which use the StreamError.StreamID field instead. stream *stream // done, if non-nil, must be a buffered channel with space for diff --git a/vendor/golang.org/x/net/http2/writesched_priority.go b/vendor/golang.org/x/net/http2/writesched_priority.go index 2618b2c11d22..0a242c669e2c 100644 --- a/vendor/golang.org/x/net/http2/writesched_priority.go +++ b/vendor/golang.org/x/net/http2/writesched_priority.go @@ -383,16 +383,15 @@ func (ws *priorityWriteScheduler) AdjustStream(streamID uint32, priority Priorit func (ws *priorityWriteScheduler) Push(wr FrameWriteRequest) { var n *priorityNode - if id := wr.StreamID(); id == 0 { + if wr.isControl() { n = &ws.root } else { + id := wr.StreamID() n = ws.nodes[id] if n == nil { // id is an idle or closed stream. wr should not be a HEADERS or - // DATA frame. However, wr can be a RST_STREAM. In this case, we - // push wr onto the root, rather than creating a new priorityNode, - // since RST_STREAM is tiny and the stream's priority is unknown - // anyway. See issue #17919. + // DATA frame. In other case, we push wr onto the root, rather + // than creating a new priorityNode. if wr.DataSize() > 0 { panic("add DATA on non-open stream") } diff --git a/vendor/golang.org/x/net/http2/writesched_random.go b/vendor/golang.org/x/net/http2/writesched_random.go index 9a7b9e581c1e..f2e55e05ce90 100644 --- a/vendor/golang.org/x/net/http2/writesched_random.go +++ b/vendor/golang.org/x/net/http2/writesched_random.go @@ -45,11 +45,11 @@ func (ws *randomWriteScheduler) AdjustStream(streamID uint32, priority PriorityP } func (ws *randomWriteScheduler) Push(wr FrameWriteRequest) { - id := wr.StreamID() - if id == 0 { + if wr.isControl() { ws.zero.push(wr) return } + id := wr.StreamID() q, ok := ws.sq[id] if !ok { q = ws.queuePool.get() @@ -59,7 +59,7 @@ func (ws *randomWriteScheduler) Push(wr FrameWriteRequest) { } func (ws *randomWriteScheduler) Pop() (FrameWriteRequest, bool) { - // Control frames first. + // Control and RST_STREAM frames first. if !ws.zero.empty() { return ws.zero.shift(), true } diff --git a/vendor/golang.org/x/net/idna/trieval.go b/vendor/golang.org/x/net/idna/trieval.go index 7a8cf889b5bc..9c070a44b377 100644 --- a/vendor/golang.org/x/net/idna/trieval.go +++ b/vendor/golang.org/x/net/idna/trieval.go @@ -17,23 +17,23 @@ package idna // // The per-rune values have the following format: // -// if mapped { -// if inlinedXOR { -// 15..13 inline XOR marker -// 12..11 unused -// 10..3 inline XOR mask -// } else { -// 15..3 index into xor or mapping table -// } -// } else { -// 15..14 unused -// 13 mayNeedNorm -// 12..11 attributes -// 10..8 joining type -// 7..3 category type -// } -// 2 use xor pattern -// 1..0 mapped category +// if mapped { +// if inlinedXOR { +// 15..13 inline XOR marker +// 12..11 unused +// 10..3 inline XOR mask +// } else { +// 15..3 index into xor or mapping table +// } +// } else { +// 15..14 unused +// 13 mayNeedNorm +// 12..11 attributes +// 10..8 joining type +// 7..3 category type +// } +// 2 use xor pattern +// 1..0 mapped category // // See the definitions below for a more detailed description of the various // bits. diff --git a/vendor/golang.org/x/net/trace/trace.go b/vendor/golang.org/x/net/trace/trace.go index 3ebf6f2daa30..eae2a99f54c6 100644 --- a/vendor/golang.org/x/net/trace/trace.go +++ b/vendor/golang.org/x/net/trace/trace.go @@ -395,7 +395,7 @@ func New(family, title string) Trace { } func (tr *trace) Finish() { - elapsed := time.Now().Sub(tr.Start) + elapsed := time.Since(tr.Start) tr.mu.Lock() tr.Elapsed = elapsed tr.mu.Unlock() diff --git a/vendor/golang.org/x/oauth2/AUTHORS b/vendor/golang.org/x/oauth2/AUTHORS deleted file mode 100644 index 15167cd746c5..000000000000 --- a/vendor/golang.org/x/oauth2/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/oauth2/CONTRIBUTORS b/vendor/golang.org/x/oauth2/CONTRIBUTORS deleted file mode 100644 index 1c4577e96806..000000000000 --- a/vendor/golang.org/x/oauth2/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/sys/AUTHORS b/vendor/golang.org/x/sys/AUTHORS deleted file mode 100644 index 15167cd746c5..000000000000 --- a/vendor/golang.org/x/sys/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/sys/CONTRIBUTORS b/vendor/golang.org/x/sys/CONTRIBUTORS deleted file mode 100644 index 1c4577e96806..000000000000 --- a/vendor/golang.org/x/sys/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_arm64.go index 87dd5e30215b..f3eb993bf24b 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.go @@ -6,7 +6,10 @@ package cpu import "runtime" -const cacheLineSize = 64 +// cacheLineSize is used to prevent false sharing of cache lines. +// We choose 128 because Apple Silicon, a.k.a. M1, has 128-byte cache line size. +// It doesn't cost much and is much more future-proof. +const cacheLineSize = 128 func initOptions() { options = []option{ @@ -41,13 +44,10 @@ func archInit() { switch runtime.GOOS { case "freebsd": readARM64Registers() - case "linux", "netbsd": + case "linux", "netbsd", "openbsd": doinit() default: - // Most platforms don't seem to allow reading these registers. - // - // OpenBSD: - // See https://golang.org/issue/31746 + // Many platforms don't seem to allow reading these registers. setMinimalFeatures() } } diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c index e363c7d13197..a4605e6d12e8 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c @@ -7,6 +7,7 @@ #include #include +#include // Need to wrap __get_cpuid_count because it's declared as static. int @@ -17,27 +18,21 @@ gccgoGetCpuidCount(uint32_t leaf, uint32_t subleaf, return __get_cpuid_count(leaf, subleaf, eax, ebx, ecx, edx); } +#pragma GCC diagnostic ignored "-Wunknown-pragmas" +#pragma GCC push_options +#pragma GCC target("xsave") +#pragma clang attribute push (__attribute__((target("xsave"))), apply_to=function) + // xgetbv reads the contents of an XCR (Extended Control Register) // specified in the ECX register into registers EDX:EAX. // Currently, the only supported value for XCR is 0. -// -// TODO: Replace with a better alternative: -// -// #include -// -// #pragma GCC target("xsave") -// -// void gccgoXgetbv(uint32_t *eax, uint32_t *edx) { -// unsigned long long x = _xgetbv(0); -// *eax = x & 0xffffffff; -// *edx = (x >> 32) & 0xffffffff; -// } -// -// Note that _xgetbv is defined starting with GCC 8. void gccgoXgetbv(uint32_t *eax, uint32_t *edx) { - __asm(" xorl %%ecx, %%ecx\n" - " xgetbv" - : "=a"(*eax), "=d"(*edx)); + uint64_t v = _xgetbv(0); + *eax = v & 0xffffffff; + *edx = v >> 32; } + +#pragma clang attribute pop +#pragma GCC pop_options diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go index 79a38a0b9bcc..a968b80fa6ab 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go @@ -4,6 +4,11 @@ package cpu +import ( + "strings" + "syscall" +) + // HWCAP/HWCAP2 bits. These are exposed by Linux. const ( hwcap_FP = 1 << 0 @@ -32,10 +37,45 @@ const ( hwcap_ASIMDFHM = 1 << 23 ) +// linuxKernelCanEmulateCPUID reports whether we're running +// on Linux 4.11+. Ideally we'd like to ask the question about +// whether the current kernel contains +// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=77c97b4ee21290f5f083173d957843b615abbff2 +// but the version number will have to do. +func linuxKernelCanEmulateCPUID() bool { + var un syscall.Utsname + syscall.Uname(&un) + var sb strings.Builder + for _, b := range un.Release[:] { + if b == 0 { + break + } + sb.WriteByte(byte(b)) + } + major, minor, _, ok := parseRelease(sb.String()) + return ok && (major > 4 || major == 4 && minor >= 11) +} + func doinit() { if err := readHWCAP(); err != nil { - // failed to read /proc/self/auxv, try reading registers directly - readARM64Registers() + // We failed to read /proc/self/auxv. This can happen if the binary has + // been given extra capabilities(7) with /bin/setcap. + // + // When this happens, we have two options. If the Linux kernel is new + // enough (4.11+), we can read the arm64 registers directly which'll + // trap into the kernel and then return back to userspace. + // + // But on older kernels, such as Linux 4.4.180 as used on many Synology + // devices, calling readARM64Registers (specifically getisar0) will + // cause a SIGILL and we'll die. So for older kernels, parse /proc/cpuinfo + // instead. + // + // See golang/go#57336. + if linuxKernelCanEmulateCPUID() { + readARM64Registers() + } else { + readLinuxProcCPUInfo() + } return } diff --git a/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.go new file mode 100644 index 000000000000..85b64d5ccb73 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.go @@ -0,0 +1,65 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +import ( + "syscall" + "unsafe" +) + +// Minimal copy of functionality from x/sys/unix so the cpu package can call +// sysctl without depending on x/sys/unix. + +const ( + // From OpenBSD's sys/sysctl.h. + _CTL_MACHDEP = 7 + + // From OpenBSD's machine/cpu.h. + _CPU_ID_AA64ISAR0 = 2 + _CPU_ID_AA64ISAR1 = 3 +) + +// Implemented in the runtime package (runtime/sys_openbsd3.go) +func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) + +//go:linkname syscall_syscall6 syscall.syscall6 + +func sysctl(mib []uint32, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { + _, _, errno := syscall_syscall6(libc_sysctl_trampoline_addr, uintptr(unsafe.Pointer(&mib[0])), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + if errno != 0 { + return errno + } + return nil +} + +var libc_sysctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sysctl sysctl "libc.so" + +func sysctlUint64(mib []uint32) (uint64, bool) { + var out uint64 + nout := unsafe.Sizeof(out) + if err := sysctl(mib, (*byte)(unsafe.Pointer(&out)), &nout, nil, 0); err != nil { + return 0, false + } + return out, true +} + +func doinit() { + setMinimalFeatures() + + // Get ID_AA64ISAR0 and ID_AA64ISAR1 from sysctl. + isar0, ok := sysctlUint64([]uint32{_CTL_MACHDEP, _CPU_ID_AA64ISAR0}) + if !ok { + return + } + isar1, ok := sysctlUint64([]uint32{_CTL_MACHDEP, _CPU_ID_AA64ISAR1}) + if !ok { + return + } + parseARM64SystemRegisters(isar0, isar1, 0) + + Initialized = true +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.s b/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.s new file mode 100644 index 000000000000..054ba05d607b --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.s @@ -0,0 +1,11 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" + +TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sysctl(SB) + +GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go index f8c484f589f5..f3cde129b634 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !linux && !netbsd && arm64 -// +build !linux,!netbsd,arm64 +//go:build !linux && !netbsd && !openbsd && arm64 +// +build !linux,!netbsd,!openbsd,arm64 package cpu diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go new file mode 100644 index 000000000000..060d46b6eacc --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go @@ -0,0 +1,15 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !aix && !linux && (ppc64 || ppc64le) +// +build !aix +// +build !linux +// +build ppc64 ppc64le + +package cpu + +func archInit() { + PPC64.IsPOWER8 = true + Initialized = true +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go b/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go new file mode 100644 index 000000000000..dd10eb79feef --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go @@ -0,0 +1,12 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !linux && riscv64 +// +build !linux,riscv64 + +package cpu + +func archInit() { + Initialized = true +} diff --git a/vendor/golang.org/x/sys/cpu/parse.go b/vendor/golang.org/x/sys/cpu/parse.go new file mode 100644 index 000000000000..762b63d6882c --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/parse.go @@ -0,0 +1,43 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +import "strconv" + +// parseRelease parses a dot-separated version number. It follows the semver +// syntax, but allows the minor and patch versions to be elided. +// +// This is a copy of the Go runtime's parseRelease from +// https://golang.org/cl/209597. +func parseRelease(rel string) (major, minor, patch int, ok bool) { + // Strip anything after a dash or plus. + for i := 0; i < len(rel); i++ { + if rel[i] == '-' || rel[i] == '+' { + rel = rel[:i] + break + } + } + + next := func() (int, bool) { + for i := 0; i < len(rel); i++ { + if rel[i] == '.' { + ver, err := strconv.Atoi(rel[:i]) + rel = rel[i+1:] + return ver, err == nil + } + } + ver, err := strconv.Atoi(rel) + rel = "" + return ver, err == nil + } + if major, ok = next(); !ok || rel == "" { + return + } + if minor, ok = next(); !ok || rel == "" { + return + } + patch, ok = next() + return +} diff --git a/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go b/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go new file mode 100644 index 000000000000..d87bd6b3eb05 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go @@ -0,0 +1,54 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build linux && arm64 +// +build linux,arm64 + +package cpu + +import ( + "errors" + "io" + "os" + "strings" +) + +func readLinuxProcCPUInfo() error { + f, err := os.Open("/proc/cpuinfo") + if err != nil { + return err + } + defer f.Close() + + var buf [1 << 10]byte // enough for first CPU + n, err := io.ReadFull(f, buf[:]) + if err != nil && err != io.ErrUnexpectedEOF { + return err + } + in := string(buf[:n]) + const features = "\nFeatures : " + i := strings.Index(in, features) + if i == -1 { + return errors.New("no CPU features found") + } + in = in[i+len(features):] + if i := strings.Index(in, "\n"); i != -1 { + in = in[:i] + } + m := map[string]*bool{} + + initOptions() // need it early here; it's harmless to call twice + for _, o := range options { + m[o.Name] = o.Feature + } + // The EVTSTRM field has alias "evstrm" in Go, but Linux calls it "evtstrm". + m["evtstrm"] = &ARM64.HasEVTSTRM + + for _, f := range strings.Fields(in) { + if p, ok := m[f]; ok { + *p = true + } + } + return nil +} diff --git a/vendor/golang.org/x/sys/execabs/execabs_go119.go b/vendor/golang.org/x/sys/execabs/execabs_go119.go index 1e7a9ada0b0d..46c5b525e7b8 100644 --- a/vendor/golang.org/x/sys/execabs/execabs_go119.go +++ b/vendor/golang.org/x/sys/execabs/execabs_go119.go @@ -7,9 +7,11 @@ package execabs -import "strings" +import ( + "errors" + "os/exec" +) func isGo119ErrDot(err error) bool { - // TODO: return errors.Is(err, exec.ErrDot) - return strings.Contains(err.Error(), "current directory") + return errors.Is(err, exec.ErrDot) } diff --git a/vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go b/vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go deleted file mode 100644 index e07899b909bb..000000000000 --- a/vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package unsafeheader contains header declarations for the Go runtime's -// slice and string implementations. -// -// This package allows x/sys to use types equivalent to -// reflect.SliceHeader and reflect.StringHeader without introducing -// a dependency on the (relatively heavy) "reflect" package. -package unsafeheader - -import ( - "unsafe" -) - -// Slice is the runtime representation of a slice. -// It cannot be used safely or portably and its representation may change in a later release. -type Slice struct { - Data unsafe.Pointer - Len int - Cap int -} - -// String is the runtime representation of a string. -// It cannot be used safely or portably and its representation may change in a later release. -type String struct { - Data unsafe.Pointer - Len int -} diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s b/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s new file mode 100644 index 000000000000..e5b9a84899ac --- /dev/null +++ b/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s @@ -0,0 +1,31 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build (darwin || freebsd || netbsd || openbsd) && gc +// +build darwin freebsd netbsd openbsd +// +build gc + +#include "textflag.h" + +// +// System call support for ppc64, BSD +// + +// Just jump to package syscall's implementation for all these functions. +// The runtime may know about them. + +TEXT ·Syscall(SB),NOSPLIT,$0-56 + JMP syscall·Syscall(SB) + +TEXT ·Syscall6(SB),NOSPLIT,$0-80 + JMP syscall·Syscall6(SB) + +TEXT ·Syscall9(SB),NOSPLIT,$0-104 + JMP syscall·Syscall9(SB) + +TEXT ·RawSyscall(SB),NOSPLIT,$0-56 + JMP syscall·RawSyscall(SB) + +TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 + JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s b/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s new file mode 100644 index 000000000000..d560019ea29e --- /dev/null +++ b/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s @@ -0,0 +1,29 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build (darwin || freebsd || netbsd || openbsd) && gc +// +build darwin freebsd netbsd openbsd +// +build gc + +#include "textflag.h" + +// System call support for RISCV64 BSD + +// Just jump to package syscall's implementation for all these functions. +// The runtime may know about them. + +TEXT ·Syscall(SB),NOSPLIT,$0-56 + JMP syscall·Syscall(SB) + +TEXT ·Syscall6(SB),NOSPLIT,$0-80 + JMP syscall·Syscall6(SB) + +TEXT ·Syscall9(SB),NOSPLIT,$0-104 + JMP syscall·Syscall9(SB) + +TEXT ·RawSyscall(SB),NOSPLIT,$0-56 + JMP syscall·RawSyscall(SB) + +TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 + JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_linux_loong64.s b/vendor/golang.org/x/sys/unix/asm_linux_loong64.s index 6abd48eef0df..565357288a81 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_loong64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_loong64.s @@ -30,7 +30,7 @@ TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 MOVV trap+0(FP), R11 // syscall entry SYSCALL MOVV R4, r1+32(FP) - MOVV R5, r2+40(FP) + MOVV R0, r2+40(FP) // r2 is not used. Always set to 0 JAL runtime·exitsyscall(SB) RET @@ -50,5 +50,5 @@ TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 MOVV trap+0(FP), R11 // syscall entry SYSCALL MOVV R4, r1+32(FP) - MOVV R5, r2+40(FP) + MOVV R0, r2+40(FP) // r2 is not used. Always set to 0 RET diff --git a/vendor/golang.org/x/sys/unix/dirent.go b/vendor/golang.org/x/sys/unix/dirent.go index e74e5eaa3bfe..2499f977b070 100644 --- a/vendor/golang.org/x/sys/unix/dirent.go +++ b/vendor/golang.org/x/sys/unix/dirent.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/errors_freebsd_386.go b/vendor/golang.org/x/sys/unix/errors_freebsd_386.go deleted file mode 100644 index 761db66efece..000000000000 --- a/vendor/golang.org/x/sys/unix/errors_freebsd_386.go +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep -// them here for backwards compatibility. - -package unix - -const ( - DLT_HHDLC = 0x79 - IFF_SMART = 0x20 - IFT_1822 = 0x2 - IFT_A12MPPSWITCH = 0x82 - IFT_AAL2 = 0xbb - IFT_AAL5 = 0x31 - IFT_ADSL = 0x5e - IFT_AFLANE8023 = 0x3b - IFT_AFLANE8025 = 0x3c - IFT_ARAP = 0x58 - IFT_ARCNET = 0x23 - IFT_ARCNETPLUS = 0x24 - IFT_ASYNC = 0x54 - IFT_ATM = 0x25 - IFT_ATMDXI = 0x69 - IFT_ATMFUNI = 0x6a - IFT_ATMIMA = 0x6b - IFT_ATMLOGICAL = 0x50 - IFT_ATMRADIO = 0xbd - IFT_ATMSUBINTERFACE = 0x86 - IFT_ATMVCIENDPT = 0xc2 - IFT_ATMVIRTUAL = 0x95 - IFT_BGPPOLICYACCOUNTING = 0xa2 - IFT_BSC = 0x53 - IFT_CCTEMUL = 0x3d - IFT_CEPT = 0x13 - IFT_CES = 0x85 - IFT_CHANNEL = 0x46 - IFT_CNR = 0x55 - IFT_COFFEE = 0x84 - IFT_COMPOSITELINK = 0x9b - IFT_DCN = 0x8d - IFT_DIGITALPOWERLINE = 0x8a - IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba - IFT_DLSW = 0x4a - IFT_DOCSCABLEDOWNSTREAM = 0x80 - IFT_DOCSCABLEMACLAYER = 0x7f - IFT_DOCSCABLEUPSTREAM = 0x81 - IFT_DS0 = 0x51 - IFT_DS0BUNDLE = 0x52 - IFT_DS1FDL = 0xaa - IFT_DS3 = 0x1e - IFT_DTM = 0x8c - IFT_DVBASILN = 0xac - IFT_DVBASIOUT = 0xad - IFT_DVBRCCDOWNSTREAM = 0x93 - IFT_DVBRCCMACLAYER = 0x92 - IFT_DVBRCCUPSTREAM = 0x94 - IFT_ENC = 0xf4 - IFT_EON = 0x19 - IFT_EPLRS = 0x57 - IFT_ESCON = 0x49 - IFT_ETHER = 0x6 - IFT_FAITH = 0xf2 - IFT_FAST = 0x7d - IFT_FASTETHER = 0x3e - IFT_FASTETHERFX = 0x45 - IFT_FDDI = 0xf - IFT_FIBRECHANNEL = 0x38 - IFT_FRAMERELAYINTERCONNECT = 0x3a - IFT_FRAMERELAYMPI = 0x5c - IFT_FRDLCIENDPT = 0xc1 - IFT_FRELAY = 0x20 - IFT_FRELAYDCE = 0x2c - IFT_FRF16MFRBUNDLE = 0xa3 - IFT_FRFORWARD = 0x9e - IFT_G703AT2MB = 0x43 - IFT_G703AT64K = 0x42 - IFT_GIF = 0xf0 - IFT_GIGABITETHERNET = 0x75 - IFT_GR303IDT = 0xb2 - IFT_GR303RDT = 0xb1 - IFT_H323GATEKEEPER = 0xa4 - IFT_H323PROXY = 0xa5 - IFT_HDH1822 = 0x3 - IFT_HDLC = 0x76 - IFT_HDSL2 = 0xa8 - IFT_HIPERLAN2 = 0xb7 - IFT_HIPPI = 0x2f - IFT_HIPPIINTERFACE = 0x39 - IFT_HOSTPAD = 0x5a - IFT_HSSI = 0x2e - IFT_HY = 0xe - IFT_IBM370PARCHAN = 0x48 - IFT_IDSL = 0x9a - IFT_IEEE80211 = 0x47 - IFT_IEEE80212 = 0x37 - IFT_IEEE8023ADLAG = 0xa1 - IFT_IFGSN = 0x91 - IFT_IMT = 0xbe - IFT_INTERLEAVE = 0x7c - IFT_IP = 0x7e - IFT_IPFORWARD = 0x8e - IFT_IPOVERATM = 0x72 - IFT_IPOVERCDLC = 0x6d - IFT_IPOVERCLAW = 0x6e - IFT_IPSWITCH = 0x4e - IFT_IPXIP = 0xf9 - IFT_ISDN = 0x3f - IFT_ISDNBASIC = 0x14 - IFT_ISDNPRIMARY = 0x15 - IFT_ISDNS = 0x4b - IFT_ISDNU = 0x4c - IFT_ISO88022LLC = 0x29 - IFT_ISO88023 = 0x7 - IFT_ISO88024 = 0x8 - IFT_ISO88025 = 0x9 - IFT_ISO88025CRFPINT = 0x62 - IFT_ISO88025DTR = 0x56 - IFT_ISO88025FIBER = 0x73 - IFT_ISO88026 = 0xa - IFT_ISUP = 0xb3 - IFT_L3IPXVLAN = 0x89 - IFT_LAPB = 0x10 - IFT_LAPD = 0x4d - IFT_LAPF = 0x77 - IFT_LOCALTALK = 0x2a - IFT_LOOP = 0x18 - IFT_MEDIAMAILOVERIP = 0x8b - IFT_MFSIGLINK = 0xa7 - IFT_MIOX25 = 0x26 - IFT_MODEM = 0x30 - IFT_MPC = 0x71 - IFT_MPLS = 0xa6 - IFT_MPLSTUNNEL = 0x96 - IFT_MSDSL = 0x8f - IFT_MVL = 0xbf - IFT_MYRINET = 0x63 - IFT_NFAS = 0xaf - IFT_NSIP = 0x1b - IFT_OPTICALCHANNEL = 0xc3 - IFT_OPTICALTRANSPORT = 0xc4 - IFT_OTHER = 0x1 - IFT_P10 = 0xc - IFT_P80 = 0xd - IFT_PARA = 0x22 - IFT_PFLOG = 0xf6 - IFT_PFSYNC = 0xf7 - IFT_PLC = 0xae - IFT_POS = 0xab - IFT_PPPMULTILINKBUNDLE = 0x6c - IFT_PROPBWAP2MP = 0xb8 - IFT_PROPCNLS = 0x59 - IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 - IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 - IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 - IFT_PROPMUX = 0x36 - IFT_PROPWIRELESSP2P = 0x9d - IFT_PTPSERIAL = 0x16 - IFT_PVC = 0xf1 - IFT_QLLC = 0x44 - IFT_RADIOMAC = 0xbc - IFT_RADSL = 0x5f - IFT_REACHDSL = 0xc0 - IFT_RFC1483 = 0x9f - IFT_RS232 = 0x21 - IFT_RSRB = 0x4f - IFT_SDLC = 0x11 - IFT_SDSL = 0x60 - IFT_SHDSL = 0xa9 - IFT_SIP = 0x1f - IFT_SLIP = 0x1c - IFT_SMDSDXI = 0x2b - IFT_SMDSICIP = 0x34 - IFT_SONET = 0x27 - IFT_SONETOVERHEADCHANNEL = 0xb9 - IFT_SONETPATH = 0x32 - IFT_SONETVT = 0x33 - IFT_SRP = 0x97 - IFT_SS7SIGLINK = 0x9c - IFT_STACKTOSTACK = 0x6f - IFT_STARLAN = 0xb - IFT_STF = 0xd7 - IFT_T1 = 0x12 - IFT_TDLC = 0x74 - IFT_TERMPAD = 0x5b - IFT_TR008 = 0xb0 - IFT_TRANSPHDLC = 0x7b - IFT_TUNNEL = 0x83 - IFT_ULTRA = 0x1d - IFT_USB = 0xa0 - IFT_V11 = 0x40 - IFT_V35 = 0x2d - IFT_V36 = 0x41 - IFT_V37 = 0x78 - IFT_VDSL = 0x61 - IFT_VIRTUALIPADDRESS = 0x70 - IFT_VOICEEM = 0x64 - IFT_VOICEENCAP = 0x67 - IFT_VOICEFXO = 0x65 - IFT_VOICEFXS = 0x66 - IFT_VOICEOVERATM = 0x98 - IFT_VOICEOVERFRAMERELAY = 0x99 - IFT_VOICEOVERIP = 0x68 - IFT_X213 = 0x5d - IFT_X25 = 0x5 - IFT_X25DDN = 0x4 - IFT_X25HUNTGROUP = 0x7a - IFT_X25MLP = 0x79 - IFT_X25PLE = 0x28 - IFT_XETHER = 0x1a - IPPROTO_MAXID = 0x34 - IPV6_FAITH = 0x1d - IPV6_MIN_MEMBERSHIPS = 0x1f - IP_FAITH = 0x16 - IP_MAX_SOURCE_FILTER = 0x400 - IP_MIN_MEMBERSHIPS = 0x1f - MAP_NORESERVE = 0x40 - MAP_RENAME = 0x20 - NET_RT_MAXID = 0x6 - RTF_PRCLONING = 0x10000 - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa - RT_CACHING_CONTEXT = 0x1 - RT_NORTREF = 0x2 - SIOCADDRT = 0x8030720a - SIOCALIFADDR = 0x8118691b - SIOCDELRT = 0x8030720b - SIOCDLIFADDR = 0x8118691d - SIOCGLIFADDR = 0xc118691c - SIOCGLIFPHYADDR = 0xc118694b - SIOCSLIFPHYADDR = 0x8118694a -) diff --git a/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go deleted file mode 100644 index 070f44b65104..000000000000 --- a/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep -// them here for backwards compatibility. - -package unix - -const ( - DLT_HHDLC = 0x79 - IFF_SMART = 0x20 - IFT_1822 = 0x2 - IFT_A12MPPSWITCH = 0x82 - IFT_AAL2 = 0xbb - IFT_AAL5 = 0x31 - IFT_ADSL = 0x5e - IFT_AFLANE8023 = 0x3b - IFT_AFLANE8025 = 0x3c - IFT_ARAP = 0x58 - IFT_ARCNET = 0x23 - IFT_ARCNETPLUS = 0x24 - IFT_ASYNC = 0x54 - IFT_ATM = 0x25 - IFT_ATMDXI = 0x69 - IFT_ATMFUNI = 0x6a - IFT_ATMIMA = 0x6b - IFT_ATMLOGICAL = 0x50 - IFT_ATMRADIO = 0xbd - IFT_ATMSUBINTERFACE = 0x86 - IFT_ATMVCIENDPT = 0xc2 - IFT_ATMVIRTUAL = 0x95 - IFT_BGPPOLICYACCOUNTING = 0xa2 - IFT_BSC = 0x53 - IFT_CCTEMUL = 0x3d - IFT_CEPT = 0x13 - IFT_CES = 0x85 - IFT_CHANNEL = 0x46 - IFT_CNR = 0x55 - IFT_COFFEE = 0x84 - IFT_COMPOSITELINK = 0x9b - IFT_DCN = 0x8d - IFT_DIGITALPOWERLINE = 0x8a - IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba - IFT_DLSW = 0x4a - IFT_DOCSCABLEDOWNSTREAM = 0x80 - IFT_DOCSCABLEMACLAYER = 0x7f - IFT_DOCSCABLEUPSTREAM = 0x81 - IFT_DS0 = 0x51 - IFT_DS0BUNDLE = 0x52 - IFT_DS1FDL = 0xaa - IFT_DS3 = 0x1e - IFT_DTM = 0x8c - IFT_DVBASILN = 0xac - IFT_DVBASIOUT = 0xad - IFT_DVBRCCDOWNSTREAM = 0x93 - IFT_DVBRCCMACLAYER = 0x92 - IFT_DVBRCCUPSTREAM = 0x94 - IFT_ENC = 0xf4 - IFT_EON = 0x19 - IFT_EPLRS = 0x57 - IFT_ESCON = 0x49 - IFT_ETHER = 0x6 - IFT_FAITH = 0xf2 - IFT_FAST = 0x7d - IFT_FASTETHER = 0x3e - IFT_FASTETHERFX = 0x45 - IFT_FDDI = 0xf - IFT_FIBRECHANNEL = 0x38 - IFT_FRAMERELAYINTERCONNECT = 0x3a - IFT_FRAMERELAYMPI = 0x5c - IFT_FRDLCIENDPT = 0xc1 - IFT_FRELAY = 0x20 - IFT_FRELAYDCE = 0x2c - IFT_FRF16MFRBUNDLE = 0xa3 - IFT_FRFORWARD = 0x9e - IFT_G703AT2MB = 0x43 - IFT_G703AT64K = 0x42 - IFT_GIF = 0xf0 - IFT_GIGABITETHERNET = 0x75 - IFT_GR303IDT = 0xb2 - IFT_GR303RDT = 0xb1 - IFT_H323GATEKEEPER = 0xa4 - IFT_H323PROXY = 0xa5 - IFT_HDH1822 = 0x3 - IFT_HDLC = 0x76 - IFT_HDSL2 = 0xa8 - IFT_HIPERLAN2 = 0xb7 - IFT_HIPPI = 0x2f - IFT_HIPPIINTERFACE = 0x39 - IFT_HOSTPAD = 0x5a - IFT_HSSI = 0x2e - IFT_HY = 0xe - IFT_IBM370PARCHAN = 0x48 - IFT_IDSL = 0x9a - IFT_IEEE80211 = 0x47 - IFT_IEEE80212 = 0x37 - IFT_IEEE8023ADLAG = 0xa1 - IFT_IFGSN = 0x91 - IFT_IMT = 0xbe - IFT_INTERLEAVE = 0x7c - IFT_IP = 0x7e - IFT_IPFORWARD = 0x8e - IFT_IPOVERATM = 0x72 - IFT_IPOVERCDLC = 0x6d - IFT_IPOVERCLAW = 0x6e - IFT_IPSWITCH = 0x4e - IFT_IPXIP = 0xf9 - IFT_ISDN = 0x3f - IFT_ISDNBASIC = 0x14 - IFT_ISDNPRIMARY = 0x15 - IFT_ISDNS = 0x4b - IFT_ISDNU = 0x4c - IFT_ISO88022LLC = 0x29 - IFT_ISO88023 = 0x7 - IFT_ISO88024 = 0x8 - IFT_ISO88025 = 0x9 - IFT_ISO88025CRFPINT = 0x62 - IFT_ISO88025DTR = 0x56 - IFT_ISO88025FIBER = 0x73 - IFT_ISO88026 = 0xa - IFT_ISUP = 0xb3 - IFT_L3IPXVLAN = 0x89 - IFT_LAPB = 0x10 - IFT_LAPD = 0x4d - IFT_LAPF = 0x77 - IFT_LOCALTALK = 0x2a - IFT_LOOP = 0x18 - IFT_MEDIAMAILOVERIP = 0x8b - IFT_MFSIGLINK = 0xa7 - IFT_MIOX25 = 0x26 - IFT_MODEM = 0x30 - IFT_MPC = 0x71 - IFT_MPLS = 0xa6 - IFT_MPLSTUNNEL = 0x96 - IFT_MSDSL = 0x8f - IFT_MVL = 0xbf - IFT_MYRINET = 0x63 - IFT_NFAS = 0xaf - IFT_NSIP = 0x1b - IFT_OPTICALCHANNEL = 0xc3 - IFT_OPTICALTRANSPORT = 0xc4 - IFT_OTHER = 0x1 - IFT_P10 = 0xc - IFT_P80 = 0xd - IFT_PARA = 0x22 - IFT_PFLOG = 0xf6 - IFT_PFSYNC = 0xf7 - IFT_PLC = 0xae - IFT_POS = 0xab - IFT_PPPMULTILINKBUNDLE = 0x6c - IFT_PROPBWAP2MP = 0xb8 - IFT_PROPCNLS = 0x59 - IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 - IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 - IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 - IFT_PROPMUX = 0x36 - IFT_PROPWIRELESSP2P = 0x9d - IFT_PTPSERIAL = 0x16 - IFT_PVC = 0xf1 - IFT_QLLC = 0x44 - IFT_RADIOMAC = 0xbc - IFT_RADSL = 0x5f - IFT_REACHDSL = 0xc0 - IFT_RFC1483 = 0x9f - IFT_RS232 = 0x21 - IFT_RSRB = 0x4f - IFT_SDLC = 0x11 - IFT_SDSL = 0x60 - IFT_SHDSL = 0xa9 - IFT_SIP = 0x1f - IFT_SLIP = 0x1c - IFT_SMDSDXI = 0x2b - IFT_SMDSICIP = 0x34 - IFT_SONET = 0x27 - IFT_SONETOVERHEADCHANNEL = 0xb9 - IFT_SONETPATH = 0x32 - IFT_SONETVT = 0x33 - IFT_SRP = 0x97 - IFT_SS7SIGLINK = 0x9c - IFT_STACKTOSTACK = 0x6f - IFT_STARLAN = 0xb - IFT_STF = 0xd7 - IFT_T1 = 0x12 - IFT_TDLC = 0x74 - IFT_TERMPAD = 0x5b - IFT_TR008 = 0xb0 - IFT_TRANSPHDLC = 0x7b - IFT_TUNNEL = 0x83 - IFT_ULTRA = 0x1d - IFT_USB = 0xa0 - IFT_V11 = 0x40 - IFT_V35 = 0x2d - IFT_V36 = 0x41 - IFT_V37 = 0x78 - IFT_VDSL = 0x61 - IFT_VIRTUALIPADDRESS = 0x70 - IFT_VOICEEM = 0x64 - IFT_VOICEENCAP = 0x67 - IFT_VOICEFXO = 0x65 - IFT_VOICEFXS = 0x66 - IFT_VOICEOVERATM = 0x98 - IFT_VOICEOVERFRAMERELAY = 0x99 - IFT_VOICEOVERIP = 0x68 - IFT_X213 = 0x5d - IFT_X25 = 0x5 - IFT_X25DDN = 0x4 - IFT_X25HUNTGROUP = 0x7a - IFT_X25MLP = 0x79 - IFT_X25PLE = 0x28 - IFT_XETHER = 0x1a - IPPROTO_MAXID = 0x34 - IPV6_FAITH = 0x1d - IPV6_MIN_MEMBERSHIPS = 0x1f - IP_FAITH = 0x16 - IP_MAX_SOURCE_FILTER = 0x400 - IP_MIN_MEMBERSHIPS = 0x1f - MAP_NORESERVE = 0x40 - MAP_RENAME = 0x20 - NET_RT_MAXID = 0x6 - RTF_PRCLONING = 0x10000 - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa - RT_CACHING_CONTEXT = 0x1 - RT_NORTREF = 0x2 - SIOCADDRT = 0x8040720a - SIOCALIFADDR = 0x8118691b - SIOCDELRT = 0x8040720b - SIOCDLIFADDR = 0x8118691d - SIOCGLIFADDR = 0xc118691c - SIOCGLIFPHYADDR = 0xc118694b - SIOCSLIFPHYADDR = 0x8118694a -) diff --git a/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go b/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go deleted file mode 100644 index 856dca325438..000000000000 --- a/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package unix - -const ( - IFT_1822 = 0x2 - IFT_A12MPPSWITCH = 0x82 - IFT_AAL2 = 0xbb - IFT_AAL5 = 0x31 - IFT_ADSL = 0x5e - IFT_AFLANE8023 = 0x3b - IFT_AFLANE8025 = 0x3c - IFT_ARAP = 0x58 - IFT_ARCNET = 0x23 - IFT_ARCNETPLUS = 0x24 - IFT_ASYNC = 0x54 - IFT_ATM = 0x25 - IFT_ATMDXI = 0x69 - IFT_ATMFUNI = 0x6a - IFT_ATMIMA = 0x6b - IFT_ATMLOGICAL = 0x50 - IFT_ATMRADIO = 0xbd - IFT_ATMSUBINTERFACE = 0x86 - IFT_ATMVCIENDPT = 0xc2 - IFT_ATMVIRTUAL = 0x95 - IFT_BGPPOLICYACCOUNTING = 0xa2 - IFT_BSC = 0x53 - IFT_CCTEMUL = 0x3d - IFT_CEPT = 0x13 - IFT_CES = 0x85 - IFT_CHANNEL = 0x46 - IFT_CNR = 0x55 - IFT_COFFEE = 0x84 - IFT_COMPOSITELINK = 0x9b - IFT_DCN = 0x8d - IFT_DIGITALPOWERLINE = 0x8a - IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba - IFT_DLSW = 0x4a - IFT_DOCSCABLEDOWNSTREAM = 0x80 - IFT_DOCSCABLEMACLAYER = 0x7f - IFT_DOCSCABLEUPSTREAM = 0x81 - IFT_DS0 = 0x51 - IFT_DS0BUNDLE = 0x52 - IFT_DS1FDL = 0xaa - IFT_DS3 = 0x1e - IFT_DTM = 0x8c - IFT_DVBASILN = 0xac - IFT_DVBASIOUT = 0xad - IFT_DVBRCCDOWNSTREAM = 0x93 - IFT_DVBRCCMACLAYER = 0x92 - IFT_DVBRCCUPSTREAM = 0x94 - IFT_ENC = 0xf4 - IFT_EON = 0x19 - IFT_EPLRS = 0x57 - IFT_ESCON = 0x49 - IFT_ETHER = 0x6 - IFT_FAST = 0x7d - IFT_FASTETHER = 0x3e - IFT_FASTETHERFX = 0x45 - IFT_FDDI = 0xf - IFT_FIBRECHANNEL = 0x38 - IFT_FRAMERELAYINTERCONNECT = 0x3a - IFT_FRAMERELAYMPI = 0x5c - IFT_FRDLCIENDPT = 0xc1 - IFT_FRELAY = 0x20 - IFT_FRELAYDCE = 0x2c - IFT_FRF16MFRBUNDLE = 0xa3 - IFT_FRFORWARD = 0x9e - IFT_G703AT2MB = 0x43 - IFT_G703AT64K = 0x42 - IFT_GIF = 0xf0 - IFT_GIGABITETHERNET = 0x75 - IFT_GR303IDT = 0xb2 - IFT_GR303RDT = 0xb1 - IFT_H323GATEKEEPER = 0xa4 - IFT_H323PROXY = 0xa5 - IFT_HDH1822 = 0x3 - IFT_HDLC = 0x76 - IFT_HDSL2 = 0xa8 - IFT_HIPERLAN2 = 0xb7 - IFT_HIPPI = 0x2f - IFT_HIPPIINTERFACE = 0x39 - IFT_HOSTPAD = 0x5a - IFT_HSSI = 0x2e - IFT_HY = 0xe - IFT_IBM370PARCHAN = 0x48 - IFT_IDSL = 0x9a - IFT_IEEE80211 = 0x47 - IFT_IEEE80212 = 0x37 - IFT_IEEE8023ADLAG = 0xa1 - IFT_IFGSN = 0x91 - IFT_IMT = 0xbe - IFT_INTERLEAVE = 0x7c - IFT_IP = 0x7e - IFT_IPFORWARD = 0x8e - IFT_IPOVERATM = 0x72 - IFT_IPOVERCDLC = 0x6d - IFT_IPOVERCLAW = 0x6e - IFT_IPSWITCH = 0x4e - IFT_ISDN = 0x3f - IFT_ISDNBASIC = 0x14 - IFT_ISDNPRIMARY = 0x15 - IFT_ISDNS = 0x4b - IFT_ISDNU = 0x4c - IFT_ISO88022LLC = 0x29 - IFT_ISO88023 = 0x7 - IFT_ISO88024 = 0x8 - IFT_ISO88025 = 0x9 - IFT_ISO88025CRFPINT = 0x62 - IFT_ISO88025DTR = 0x56 - IFT_ISO88025FIBER = 0x73 - IFT_ISO88026 = 0xa - IFT_ISUP = 0xb3 - IFT_L3IPXVLAN = 0x89 - IFT_LAPB = 0x10 - IFT_LAPD = 0x4d - IFT_LAPF = 0x77 - IFT_LOCALTALK = 0x2a - IFT_LOOP = 0x18 - IFT_MEDIAMAILOVERIP = 0x8b - IFT_MFSIGLINK = 0xa7 - IFT_MIOX25 = 0x26 - IFT_MODEM = 0x30 - IFT_MPC = 0x71 - IFT_MPLS = 0xa6 - IFT_MPLSTUNNEL = 0x96 - IFT_MSDSL = 0x8f - IFT_MVL = 0xbf - IFT_MYRINET = 0x63 - IFT_NFAS = 0xaf - IFT_NSIP = 0x1b - IFT_OPTICALCHANNEL = 0xc3 - IFT_OPTICALTRANSPORT = 0xc4 - IFT_OTHER = 0x1 - IFT_P10 = 0xc - IFT_P80 = 0xd - IFT_PARA = 0x22 - IFT_PFLOG = 0xf6 - IFT_PFSYNC = 0xf7 - IFT_PLC = 0xae - IFT_POS = 0xab - IFT_PPPMULTILINKBUNDLE = 0x6c - IFT_PROPBWAP2MP = 0xb8 - IFT_PROPCNLS = 0x59 - IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 - IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 - IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 - IFT_PROPMUX = 0x36 - IFT_PROPWIRELESSP2P = 0x9d - IFT_PTPSERIAL = 0x16 - IFT_PVC = 0xf1 - IFT_QLLC = 0x44 - IFT_RADIOMAC = 0xbc - IFT_RADSL = 0x5f - IFT_REACHDSL = 0xc0 - IFT_RFC1483 = 0x9f - IFT_RS232 = 0x21 - IFT_RSRB = 0x4f - IFT_SDLC = 0x11 - IFT_SDSL = 0x60 - IFT_SHDSL = 0xa9 - IFT_SIP = 0x1f - IFT_SLIP = 0x1c - IFT_SMDSDXI = 0x2b - IFT_SMDSICIP = 0x34 - IFT_SONET = 0x27 - IFT_SONETOVERHEADCHANNEL = 0xb9 - IFT_SONETPATH = 0x32 - IFT_SONETVT = 0x33 - IFT_SRP = 0x97 - IFT_SS7SIGLINK = 0x9c - IFT_STACKTOSTACK = 0x6f - IFT_STARLAN = 0xb - IFT_STF = 0xd7 - IFT_T1 = 0x12 - IFT_TDLC = 0x74 - IFT_TERMPAD = 0x5b - IFT_TR008 = 0xb0 - IFT_TRANSPHDLC = 0x7b - IFT_TUNNEL = 0x83 - IFT_ULTRA = 0x1d - IFT_USB = 0xa0 - IFT_V11 = 0x40 - IFT_V35 = 0x2d - IFT_V36 = 0x41 - IFT_V37 = 0x78 - IFT_VDSL = 0x61 - IFT_VIRTUALIPADDRESS = 0x70 - IFT_VOICEEM = 0x64 - IFT_VOICEENCAP = 0x67 - IFT_VOICEFXO = 0x65 - IFT_VOICEFXS = 0x66 - IFT_VOICEOVERATM = 0x98 - IFT_VOICEOVERFRAMERELAY = 0x99 - IFT_VOICEOVERIP = 0x68 - IFT_X213 = 0x5d - IFT_X25 = 0x5 - IFT_X25DDN = 0x4 - IFT_X25HUNTGROUP = 0x7a - IFT_X25MLP = 0x79 - IFT_X25PLE = 0x28 - IFT_XETHER = 0x1a - - // missing constants on FreeBSD-11.1-RELEASE, copied from old values in ztypes_freebsd_arm.go - IFF_SMART = 0x20 - IFT_FAITH = 0xf2 - IFT_IPXIP = 0xf9 - IPPROTO_MAXID = 0x34 - IPV6_FAITH = 0x1d - IP_FAITH = 0x16 - MAP_NORESERVE = 0x40 - MAP_RENAME = 0x20 - NET_RT_MAXID = 0x6 - RTF_PRCLONING = 0x10000 - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa - SIOCADDRT = 0x8030720a - SIOCALIFADDR = 0x8118691b - SIOCDELRT = 0x8030720b - SIOCDLIFADDR = 0x8118691d - SIOCGLIFADDR = 0xc118691c - SIOCGLIFPHYADDR = 0xc118694b - SIOCSLIFPHYADDR = 0x8118694a -) diff --git a/vendor/golang.org/x/sys/unix/errors_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/errors_freebsd_arm64.go deleted file mode 100644 index 946dcf3fc7ec..000000000000 --- a/vendor/golang.org/x/sys/unix/errors_freebsd_arm64.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep -// them here for backwards compatibility. - -package unix - -const ( - DLT_HHDLC = 0x79 - IPV6_MIN_MEMBERSHIPS = 0x1f - IP_MAX_SOURCE_FILTER = 0x400 - IP_MIN_MEMBERSHIPS = 0x1f - RT_CACHING_CONTEXT = 0x1 - RT_NORTREF = 0x2 -) diff --git a/vendor/golang.org/x/sys/unix/gccgo.go b/vendor/golang.org/x/sys/unix/gccgo.go index 0dee23222ca8..b06f52d748f6 100644 --- a/vendor/golang.org/x/sys/unix/gccgo.go +++ b/vendor/golang.org/x/sys/unix/gccgo.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build gccgo && !aix -// +build gccgo,!aix +//go:build gccgo && !aix && !hurd +// +build gccgo,!aix,!hurd package unix diff --git a/vendor/golang.org/x/sys/unix/gccgo_c.c b/vendor/golang.org/x/sys/unix/gccgo_c.c index 2cb1fefac640..c4fce0e70036 100644 --- a/vendor/golang.org/x/sys/unix/gccgo_c.c +++ b/vendor/golang.org/x/sys/unix/gccgo_c.c @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build gccgo -// +build !aix +// +build gccgo,!hurd +// +build !aix,!hurd #include #include diff --git a/vendor/golang.org/x/sys/unix/ifreq_linux.go b/vendor/golang.org/x/sys/unix/ifreq_linux.go index 934af313c323..15721a5104e4 100644 --- a/vendor/golang.org/x/sys/unix/ifreq_linux.go +++ b/vendor/golang.org/x/sys/unix/ifreq_linux.go @@ -8,7 +8,6 @@ package unix import ( - "bytes" "unsafe" ) @@ -45,13 +44,7 @@ func NewIfreq(name string) (*Ifreq, error) { // Name returns the interface name associated with the Ifreq. func (ifr *Ifreq) Name() string { - // BytePtrToString requires a NULL terminator or the program may crash. If - // one is not present, just return the empty string. - if !bytes.Contains(ifr.raw.Ifrn[:], []byte{0x00}) { - return "" - } - - return BytePtrToString(&ifr.raw.Ifrn[0]) + return ByteSliceToString(ifr.raw.Ifrn[:]) } // According to netdevice(7), only AF_INET addresses are returned for numerous diff --git a/vendor/golang.org/x/sys/unix/ioctl.go b/vendor/golang.org/x/sys/unix/ioctl.go index 6c7ad052e6b3..1c51b0ec2bcd 100644 --- a/vendor/golang.org/x/sys/unix/ioctl.go +++ b/vendor/golang.org/x/sys/unix/ioctl.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris +// +build aix darwin dragonfly freebsd hurd linux netbsd openbsd solaris package unix diff --git a/vendor/golang.org/x/sys/unix/ioctl_linux.go b/vendor/golang.org/x/sys/unix/ioctl_linux.go index 884430b810cc..0d12c0851adf 100644 --- a/vendor/golang.org/x/sys/unix/ioctl_linux.go +++ b/vendor/golang.org/x/sys/unix/ioctl_linux.go @@ -4,9 +4,7 @@ package unix -import ( - "unsafe" -) +import "unsafe" // IoctlRetInt performs an ioctl operation specified by req on a device // associated with opened file descriptor fd, and returns a non-negative @@ -217,3 +215,19 @@ func IoctlKCMAttach(fd int, info KCMAttach) error { func IoctlKCMUnattach(fd int, info KCMUnattach) error { return ioctlPtr(fd, SIOCKCMUNATTACH, unsafe.Pointer(&info)) } + +// IoctlLoopGetStatus64 gets the status of the loop device associated with the +// file descriptor fd using the LOOP_GET_STATUS64 operation. +func IoctlLoopGetStatus64(fd int) (*LoopInfo64, error) { + var value LoopInfo64 + if err := ioctlPtr(fd, LOOP_GET_STATUS64, unsafe.Pointer(&value)); err != nil { + return nil, err + } + return &value, nil +} + +// IoctlLoopSetStatus64 sets the status of the loop device associated with the +// file descriptor fd using the LOOP_SET_STATUS64 operation. +func IoctlLoopSetStatus64(fd int, value *LoopInfo64) error { + return ioctlPtr(fd, LOOP_SET_STATUS64, unsafe.Pointer(value)) +} diff --git a/vendor/golang.org/x/sys/unix/mkall.sh b/vendor/golang.org/x/sys/unix/mkall.sh index ee73623489b0..8e3947c3686c 100644 --- a/vendor/golang.org/x/sys/unix/mkall.sh +++ b/vendor/golang.org/x/sys/unix/mkall.sh @@ -73,12 +73,12 @@ aix_ppc64) darwin_amd64) mkerrors="$mkerrors -m64" mktypes="GOARCH=$GOARCH go tool cgo -godefs" - mkasm="go run mkasm_darwin.go" + mkasm="go run mkasm.go" ;; darwin_arm64) mkerrors="$mkerrors -m64" mktypes="GOARCH=$GOARCH go tool cgo -godefs" - mkasm="go run mkasm_darwin.go" + mkasm="go run mkasm.go" ;; dragonfly_amd64) mkerrors="$mkerrors -m64" @@ -89,25 +89,30 @@ dragonfly_amd64) freebsd_386) mkerrors="$mkerrors -m32" mksyscall="go run mksyscall.go -l32" - mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12'" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; freebsd_amd64) mkerrors="$mkerrors -m64" - mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12'" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; freebsd_arm) mkerrors="$mkerrors" mksyscall="go run mksyscall.go -l32 -arm" - mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12'" # Let the type of C char be signed for making the bare syscall # API consistent across platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; freebsd_arm64) mkerrors="$mkerrors -m64" - mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12'" + mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" + ;; +freebsd_riscv64) + mkerrors="$mkerrors -m64" + mksysnum="go run mksysnum.go 'https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12'" mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; netbsd_386) @@ -137,42 +142,60 @@ netbsd_arm64) mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; openbsd_386) + mkasm="go run mkasm.go" mkerrors="$mkerrors -m32" - mksyscall="go run mksyscall.go -l32 -openbsd" + mksyscall="go run mksyscall.go -l32 -openbsd -libc" mksysctl="go run mksysctl_openbsd.go" - mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; openbsd_amd64) + mkasm="go run mkasm.go" mkerrors="$mkerrors -m64" - mksyscall="go run mksyscall.go -openbsd" + mksyscall="go run mksyscall.go -openbsd -libc" mksysctl="go run mksysctl_openbsd.go" - mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; openbsd_arm) + mkasm="go run mkasm.go" mkerrors="$mkerrors" - mksyscall="go run mksyscall.go -l32 -openbsd -arm" + mksyscall="go run mksyscall.go -l32 -openbsd -arm -libc" mksysctl="go run mksysctl_openbsd.go" - mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" # Let the type of C char be signed for making the bare syscall # API consistent across platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; openbsd_arm64) + mkasm="go run mkasm.go" mkerrors="$mkerrors -m64" - mksyscall="go run mksyscall.go -openbsd" + mksyscall="go run mksyscall.go -openbsd -libc" mksysctl="go run mksysctl_openbsd.go" - mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" # Let the type of C char be signed for making the bare syscall # API consistent across platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; openbsd_mips64) + mkasm="go run mkasm.go" + mkerrors="$mkerrors -m64" + mksyscall="go run mksyscall.go -openbsd -libc" + mksysctl="go run mksysctl_openbsd.go" + # Let the type of C char be signed for making the bare syscall + # API consistent across platforms. + mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" + ;; +openbsd_ppc64) + mkasm="go run mkasm.go" + mkerrors="$mkerrors -m64" + mksyscall="go run mksyscall.go -openbsd -libc" + mksysctl="go run mksysctl_openbsd.go" + # Let the type of C char be signed for making the bare syscall + # API consistent across platforms. + mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" + ;; +openbsd_riscv64) + mkasm="go run mkasm.go" mkerrors="$mkerrors -m64" - mksyscall="go run mksyscall.go -openbsd" + mksyscall="go run mksyscall.go -openbsd -libc" mksysctl="go run mksysctl_openbsd.go" - mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" # Let the type of C char be signed for making the bare syscall # API consistent across platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" @@ -209,11 +232,6 @@ esac if [ "$GOOSARCH" == "aix_ppc64" ]; then # aix/ppc64 script generates files instead of writing to stdin. echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ; - elif [ "$GOOS" == "darwin" ]; then - # 1.12 and later, syscalls via libSystem - echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; - # 1.13 and later, syscalls via libSystem (including syscallPtr) - echo "$mksyscall -tags $GOOS,$GOARCH,go1.13 syscall_darwin.1_13.go |gofmt >zsyscall_$GOOSARCH.1_13.go"; elif [ "$GOOS" == "illumos" ]; then # illumos code generation requires a --illumos switch echo "$mksyscall -illumos -tags illumos,$GOARCH syscall_illumos.go |gofmt > zsyscall_illumos_$GOARCH.go"; @@ -227,5 +245,5 @@ esac if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go"; fi - if [ -n "$mkasm" ]; then echo "$mkasm $GOARCH"; fi + if [ -n "$mkasm" ]; then echo "$mkasm $GOOS $GOARCH"; fi ) | $run diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index d888fb770364..7456d9ddde16 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -128,6 +128,7 @@ includes_FreeBSD=' #include #include #include +#include #include #include #include @@ -202,6 +203,7 @@ struct ltchars { #include #include #include +#include #include #include #include @@ -295,6 +297,10 @@ struct ltchars { #define SOL_NETLINK 270 #endif +#ifndef SOL_SMC +#define SOL_SMC 286 +#endif + #ifdef SOL_BLUETOOTH // SPARC includes this in /usr/include/sparc64-linux-gnu/bits/socket.h // but it is already in bluetooth_linux.go @@ -529,7 +535,7 @@ ccflags="$@" $2 ~ /^(MS|MNT|MOUNT|UMOUNT)_/ || $2 ~ /^NS_GET_/ || $2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ || - $2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT|TFD)_/ || + $2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT|PIOD|TFD)_/ || $2 ~ /^KEXEC_/ || $2 ~ /^LINUX_REBOOT_CMD_/ || $2 ~ /^LINUX_REBOOT_MAGIC[12]$/ || @@ -553,6 +559,7 @@ ccflags="$@" $2 ~ /^CLONE_[A-Z_]+/ || $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+)$/ && $2 ~ /^(BPF|DLT)_/ || + $2 ~ /^AUDIT_/ || $2 ~ /^(CLOCK|TIMER)_/ || $2 ~ /^CAN_/ || $2 ~ /^CAP_/ || @@ -575,7 +582,6 @@ ccflags="$@" $2 ~ /^SEEK_/ || $2 ~ /^SPLICE_/ || $2 ~ /^SYNC_FILE_RANGE_/ || - $2 !~ /^AUDIT_RECORD_MAGIC/ && $2 !~ /IOC_MAGIC/ && $2 ~ /^[A-Z][A-Z0-9_]+_MAGIC2?$/ || $2 ~ /^(VM|VMADDR)_/ || @@ -636,7 +642,7 @@ errors=$( signals=$( echo '#include ' | $CC -x c - -E -dM $ccflags | awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' | - egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' | + grep -v 'SIGSTKSIZE\|SIGSTKSZ\|SIGRT\|SIGMAX64' | sort ) @@ -646,7 +652,7 @@ echo '#include ' | $CC -x c - -E -dM $ccflags | sort >_error.grep echo '#include ' | $CC -x c - -E -dM $ccflags | awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' | - egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' | + grep -v 'SIGSTKSIZE\|SIGSTKSZ\|SIGRT\|SIGMAX64' | sort >_signal.grep echo '// mkerrors.sh' "$@" diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go index 453a942c5db3..3865943f6e27 100644 --- a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go +++ b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go @@ -52,6 +52,20 @@ func ParseSocketControlMessage(b []byte) ([]SocketControlMessage, error) { return msgs, nil } +// ParseOneSocketControlMessage parses a single socket control message from b, returning the message header, +// message data (a slice of b), and the remainder of b after that single message. +// When there are no remaining messages, len(remainder) == 0. +func ParseOneSocketControlMessage(b []byte) (hdr Cmsghdr, data []byte, remainder []byte, err error) { + h, dbuf, err := socketControlMessageHeaderAndData(b) + if err != nil { + return Cmsghdr{}, nil, nil, err + } + if i := cmsgAlignOf(int(h.Len)); i < len(b) { + remainder = b[i:] + } + return *h, dbuf, remainder, nil +} + func socketControlMessageHeaderAndData(b []byte) (*Cmsghdr, []byte, error) { h := (*Cmsghdr)(unsafe.Pointer(&b[0])) if h.Len < SizeofCmsghdr || uint64(h.Len) > uint64(len(b)) { diff --git a/vendor/golang.org/x/sys/unix/str.go b/vendor/golang.org/x/sys/unix/str.go deleted file mode 100644 index 8ba89ed8694f..000000000000 --- a/vendor/golang.org/x/sys/unix/str.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris - -package unix - -func itoa(val int) string { // do it here rather than with fmt to avoid dependency - if val < 0 { - return "-" + uitoa(uint(-val)) - } - return uitoa(uint(val)) -} - -func uitoa(val uint) string { - var buf [32]byte // big enough for int64 - i := len(buf) - 1 - for val >= 10 { - buf[i] = byte(val%10 + '0') - i-- - val /= 10 - } - buf[i] = byte(val + '0') - return string(buf[i:]) -} diff --git a/vendor/golang.org/x/sys/unix/syscall.go b/vendor/golang.org/x/sys/unix/syscall.go index 649fa87405d1..63e8c838317f 100644 --- a/vendor/golang.org/x/sys/unix/syscall.go +++ b/vendor/golang.org/x/sys/unix/syscall.go @@ -29,8 +29,6 @@ import ( "bytes" "strings" "unsafe" - - "golang.org/x/sys/internal/unsafeheader" ) // ByteSliceFromString returns a NUL-terminated slice of bytes @@ -82,13 +80,7 @@ func BytePtrToString(p *byte) string { ptr = unsafe.Pointer(uintptr(ptr) + 1) } - var s []byte - h := (*unsafeheader.Slice)(unsafe.Pointer(&s)) - h.Data = unsafe.Pointer(p) - h.Len = n - h.Cap = n - - return string(s) + return string(unsafe.Slice(p, n)) } // Single-word zero for use when we need a valid pointer to 0 bytes. diff --git a/vendor/golang.org/x/sys/unix/syscall_aix.go b/vendor/golang.org/x/sys/unix/syscall_aix.go index ad22c33db3db..2db1b51e99f0 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix.go @@ -217,14 +217,63 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) { return } -func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) { - // Recvmsg not implemented on AIX - return -1, -1, -1, ENOSYS +func recvmsgRaw(fd int, iov []Iovec, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) { + var msg Msghdr + msg.Name = (*byte)(unsafe.Pointer(rsa)) + msg.Namelen = uint32(SizeofSockaddrAny) + var dummy byte + if len(oob) > 0 { + // receive at least one normal byte + if emptyIovecs(iov) { + var iova [1]Iovec + iova[0].Base = &dummy + iova[0].SetLen(1) + iov = iova[:] + } + msg.Control = (*byte)(unsafe.Pointer(&oob[0])) + msg.SetControllen(len(oob)) + } + if len(iov) > 0 { + msg.Iov = &iov[0] + msg.SetIovlen(len(iov)) + } + if n, err = recvmsg(fd, &msg, flags); n == -1 { + return + } + oobn = int(msg.Controllen) + recvflags = int(msg.Flags) + return } -func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) { - // SendmsgN not implemented on AIX - return -1, ENOSYS +func sendmsgN(fd int, iov []Iovec, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) { + var msg Msghdr + msg.Name = (*byte)(unsafe.Pointer(ptr)) + msg.Namelen = uint32(salen) + var dummy byte + var empty bool + if len(oob) > 0 { + // send at least one normal byte + empty = emptyIovecs(iov) + if empty { + var iova [1]Iovec + iova[0].Base = &dummy + iova[0].SetLen(1) + iov = iova[:] + } + msg.Control = (*byte)(unsafe.Pointer(&oob[0])) + msg.SetControllen(len(oob)) + } + if len(iov) > 0 { + msg.Iov = &iov[0] + msg.SetIovlen(len(iov)) + } + if n, err = sendmsg(fd, &msg, flags); err != nil { + return 0, err + } + if len(oob) > 0 && empty { + n = 0 + } + return n, nil } func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go index 9c87c5f07f8c..eda42671f195 100644 --- a/vendor/golang.org/x/sys/unix/syscall_bsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_bsd.go @@ -325,27 +325,26 @@ func GetsockoptString(fd, level, opt int) (string, error) { //sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) -func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) { +func recvmsgRaw(fd int, iov []Iovec, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) { var msg Msghdr msg.Name = (*byte)(unsafe.Pointer(rsa)) msg.Namelen = uint32(SizeofSockaddrAny) - var iov Iovec - if len(p) > 0 { - iov.Base = (*byte)(unsafe.Pointer(&p[0])) - iov.SetLen(len(p)) - } var dummy byte if len(oob) > 0 { // receive at least one normal byte - if len(p) == 0 { - iov.Base = &dummy - iov.SetLen(1) + if emptyIovecs(iov) { + var iova [1]Iovec + iova[0].Base = &dummy + iova[0].SetLen(1) + iov = iova[:] } msg.Control = (*byte)(unsafe.Pointer(&oob[0])) msg.SetControllen(len(oob)) } - msg.Iov = &iov - msg.Iovlen = 1 + if len(iov) > 0 { + msg.Iov = &iov[0] + msg.SetIovlen(len(iov)) + } if n, err = recvmsg(fd, &msg, flags); err != nil { return } @@ -356,31 +355,32 @@ func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) -func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) { +func sendmsgN(fd int, iov []Iovec, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) { var msg Msghdr msg.Name = (*byte)(unsafe.Pointer(ptr)) msg.Namelen = uint32(salen) - var iov Iovec - if len(p) > 0 { - iov.Base = (*byte)(unsafe.Pointer(&p[0])) - iov.SetLen(len(p)) - } var dummy byte + var empty bool if len(oob) > 0 { // send at least one normal byte - if len(p) == 0 { - iov.Base = &dummy - iov.SetLen(1) + empty = emptyIovecs(iov) + if empty { + var iova [1]Iovec + iova[0].Base = &dummy + iova[0].SetLen(1) + iov = iova[:] } msg.Control = (*byte)(unsafe.Pointer(&oob[0])) msg.SetControllen(len(oob)) } - msg.Iov = &iov - msg.Iovlen = 1 + if len(iov) > 0 { + msg.Iov = &iov[0] + msg.SetIovlen(len(iov)) + } if n, err = sendmsg(fd, &msg, flags); err != nil { return 0, err } - if len(oob) > 0 && len(p) == 0 { + if len(oob) > 0 && empty { n = 0 } return n, nil diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go b/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go deleted file mode 100644 index b0098607c706..000000000000 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build darwin && go1.12 && !go1.13 -// +build darwin,go1.12,!go1.13 - -package unix - -import ( - "unsafe" -) - -const _SYS_GETDIRENTRIES64 = 344 - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - // To implement this using libSystem we'd need syscall_syscallPtr for - // fdopendir. However, syscallPtr was only added in Go 1.13, so we fall - // back to raw syscalls for this func on Go 1.12. - var p unsafe.Pointer - if len(buf) > 0 { - p = unsafe.Pointer(&buf[0]) - } else { - p = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(_SYS_GETDIRENTRIES64, uintptr(fd), uintptr(p), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - return n, errnoErr(e1) - } - return n, nil -} diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go b/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go deleted file mode 100644 index 1596426b1e2e..000000000000 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build darwin && go1.13 -// +build darwin,go1.13 - -package unix - -import ( - "unsafe" - - "golang.org/x/sys/internal/unsafeheader" -) - -//sys closedir(dir uintptr) (err error) -//sys readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) - -func fdopendir(fd int) (dir uintptr, err error) { - r0, _, e1 := syscall_syscallPtr(libc_fdopendir_trampoline_addr, uintptr(fd), 0, 0) - dir = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_fdopendir_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_fdopendir fdopendir "/usr/lib/libSystem.B.dylib" - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - // Simulate Getdirentries using fdopendir/readdir_r/closedir. - // We store the number of entries to skip in the seek - // offset of fd. See issue #31368. - // It's not the full required semantics, but should handle the case - // of calling Getdirentries or ReadDirent repeatedly. - // It won't handle assigning the results of lseek to *basep, or handle - // the directory being edited underfoot. - skip, err := Seek(fd, 0, 1 /* SEEK_CUR */) - if err != nil { - return 0, err - } - - // We need to duplicate the incoming file descriptor - // because the caller expects to retain control of it, but - // fdopendir expects to take control of its argument. - // Just Dup'ing the file descriptor is not enough, as the - // result shares underlying state. Use Openat to make a really - // new file descriptor referring to the same directory. - fd2, err := Openat(fd, ".", O_RDONLY, 0) - if err != nil { - return 0, err - } - d, err := fdopendir(fd2) - if err != nil { - Close(fd2) - return 0, err - } - defer closedir(d) - - var cnt int64 - for { - var entry Dirent - var entryp *Dirent - e := readdir_r(d, &entry, &entryp) - if e != 0 { - return n, errnoErr(e) - } - if entryp == nil { - break - } - if skip > 0 { - skip-- - cnt++ - continue - } - - reclen := int(entry.Reclen) - if reclen > len(buf) { - // Not enough room. Return for now. - // The counter will let us know where we should start up again. - // Note: this strategy for suspending in the middle and - // restarting is O(n^2) in the length of the directory. Oh well. - break - } - - // Copy entry into return buffer. - var s []byte - hdr := (*unsafeheader.Slice)(unsafe.Pointer(&s)) - hdr.Data = unsafe.Pointer(&entry) - hdr.Cap = reclen - hdr.Len = reclen - copy(buf, s) - - buf = buf[reclen:] - n += reclen - cnt++ - } - // Set the seek offset of the input fd to record - // how many files we've already returned. - _, err = Seek(fd, cnt, 0 /* SEEK_SET */) - if err != nil { - return n, err - } - - return n, nil -} diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index e5448cc93caa..1f63382182f3 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -19,6 +19,96 @@ import ( "unsafe" ) +//sys closedir(dir uintptr) (err error) +//sys readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) + +func fdopendir(fd int) (dir uintptr, err error) { + r0, _, e1 := syscall_syscallPtr(libc_fdopendir_trampoline_addr, uintptr(fd), 0, 0) + dir = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fdopendir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fdopendir fdopendir "/usr/lib/libSystem.B.dylib" + +func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { + // Simulate Getdirentries using fdopendir/readdir_r/closedir. + // We store the number of entries to skip in the seek + // offset of fd. See issue #31368. + // It's not the full required semantics, but should handle the case + // of calling Getdirentries or ReadDirent repeatedly. + // It won't handle assigning the results of lseek to *basep, or handle + // the directory being edited underfoot. + skip, err := Seek(fd, 0, 1 /* SEEK_CUR */) + if err != nil { + return 0, err + } + + // We need to duplicate the incoming file descriptor + // because the caller expects to retain control of it, but + // fdopendir expects to take control of its argument. + // Just Dup'ing the file descriptor is not enough, as the + // result shares underlying state. Use Openat to make a really + // new file descriptor referring to the same directory. + fd2, err := Openat(fd, ".", O_RDONLY, 0) + if err != nil { + return 0, err + } + d, err := fdopendir(fd2) + if err != nil { + Close(fd2) + return 0, err + } + defer closedir(d) + + var cnt int64 + for { + var entry Dirent + var entryp *Dirent + e := readdir_r(d, &entry, &entryp) + if e != 0 { + return n, errnoErr(e) + } + if entryp == nil { + break + } + if skip > 0 { + skip-- + cnt++ + continue + } + + reclen := int(entry.Reclen) + if reclen > len(buf) { + // Not enough room. Return for now. + // The counter will let us know where we should start up again. + // Note: this strategy for suspending in the middle and + // restarting is O(n^2) in the length of the directory. Oh well. + break + } + + // Copy entry into return buffer. + s := unsafe.Slice((*byte)(unsafe.Pointer(&entry)), reclen) + copy(buf, s) + + buf = buf[reclen:] + n += reclen + cnt++ + } + // Set the seek offset of the input fd to record + // how many files we've already returned. + _, err = Seek(fd, cnt, 0 /* SEEK_SET */) + if err != nil { + return n, err + } + + return n, nil +} + // SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets. type SockaddrDatalink struct { Len uint8 @@ -393,6 +483,13 @@ func GetsockoptXucred(fd, level, opt int) (*Xucred, error) { return x, err } +func GetsockoptTCPConnectionInfo(fd, level, opt int) (*TCPConnectionInfo, error) { + var value TCPConnectionInfo + vallen := _Socklen(SizeofTCPConnectionInfo) + err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) + return &value, err +} + func SysctlKinfoProc(name string, args ...int) (*KinfoProc, error) { mib, err := sysctlmib(name, args...) if err != nil { diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go index 61c0d0de15d5..a41111a794e2 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go @@ -255,6 +255,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Chmod(path string, mode uint32) (err error) //sys Chown(path string, uid int, gid int) (err error) //sys Chroot(path string) (err error) +//sys ClockGettime(clockid int32, time *Timespec) (err error) //sys Close(fd int) (err error) //sys Dup(fd int) (nfd int, err error) //sys Dup2(from int, to int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go index 6f6c510f4130..d50b9dc250b7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go @@ -17,25 +17,12 @@ import ( "unsafe" ) -const ( - SYS_FSTAT_FREEBSD12 = 551 // { int fstat(int fd, _Out_ struct stat *sb); } - SYS_FSTATAT_FREEBSD12 = 552 // { int fstatat(int fd, _In_z_ char *path, \ - SYS_GETDIRENTRIES_FREEBSD12 = 554 // { ssize_t getdirentries(int fd, \ - SYS_STATFS_FREEBSD12 = 555 // { int statfs(_In_z_ char *path, \ - SYS_FSTATFS_FREEBSD12 = 556 // { int fstatfs(int fd, \ - SYS_GETFSSTAT_FREEBSD12 = 557 // { int getfsstat( \ - SYS_MKNODAT_FREEBSD12 = 559 // { int mknodat(int fd, _In_z_ char *path, \ -) - // See https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/versions.html. var ( osreldateOnce sync.Once osreldate uint32 ) -// INO64_FIRST from /usr/src/lib/libc/sys/compat-ino64.h -const _ino64First = 1200031 - func supportsABI(ver uint32) bool { osreldateOnce.Do(func() { osreldate, _ = SysctlUint32("kern.osreldate") }) return osreldate >= ver @@ -159,38 +146,18 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) { func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { var ( - _p0 unsafe.Pointer - bufsize uintptr - oldBuf []statfs_freebsd11_t - needsConvert bool + _p0 unsafe.Pointer + bufsize uintptr ) - if len(buf) > 0 { - if supportsABI(_ino64First) { - _p0 = unsafe.Pointer(&buf[0]) - bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) - } else { - n := len(buf) - oldBuf = make([]statfs_freebsd11_t, n) - _p0 = unsafe.Pointer(&oldBuf[0]) - bufsize = unsafe.Sizeof(statfs_freebsd11_t{}) * uintptr(n) - needsConvert = true - } + _p0 = unsafe.Pointer(&buf[0]) + bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) } - var sysno uintptr = SYS_GETFSSTAT - if supportsABI(_ino64First) { - sysno = SYS_GETFSSTAT_FREEBSD12 - } - r0, _, e1 := Syscall(sysno, uintptr(_p0), bufsize, uintptr(flags)) + r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags)) n = int(r0) if e1 != 0 { err = e1 } - if e1 == 0 && needsConvert { - for i := range oldBuf { - buf[i].convertFrom(&oldBuf[i]) - } - } return } @@ -245,87 +212,11 @@ func Uname(uname *Utsname) error { } func Stat(path string, st *Stat_t) (err error) { - var oldStat stat_freebsd11_t - if supportsABI(_ino64First) { - return fstatat_freebsd12(AT_FDCWD, path, st, 0) - } - err = stat(path, &oldStat) - if err != nil { - return err - } - - st.convertFrom(&oldStat) - return nil + return Fstatat(AT_FDCWD, path, st, 0) } func Lstat(path string, st *Stat_t) (err error) { - var oldStat stat_freebsd11_t - if supportsABI(_ino64First) { - return fstatat_freebsd12(AT_FDCWD, path, st, AT_SYMLINK_NOFOLLOW) - } - err = lstat(path, &oldStat) - if err != nil { - return err - } - - st.convertFrom(&oldStat) - return nil -} - -func Fstat(fd int, st *Stat_t) (err error) { - var oldStat stat_freebsd11_t - if supportsABI(_ino64First) { - return fstat_freebsd12(fd, st) - } - err = fstat(fd, &oldStat) - if err != nil { - return err - } - - st.convertFrom(&oldStat) - return nil -} - -func Fstatat(fd int, path string, st *Stat_t, flags int) (err error) { - var oldStat stat_freebsd11_t - if supportsABI(_ino64First) { - return fstatat_freebsd12(fd, path, st, flags) - } - err = fstatat(fd, path, &oldStat, flags) - if err != nil { - return err - } - - st.convertFrom(&oldStat) - return nil -} - -func Statfs(path string, st *Statfs_t) (err error) { - var oldStatfs statfs_freebsd11_t - if supportsABI(_ino64First) { - return statfs_freebsd12(path, st) - } - err = statfs(path, &oldStatfs) - if err != nil { - return err - } - - st.convertFrom(&oldStatfs) - return nil -} - -func Fstatfs(fd int, st *Statfs_t) (err error) { - var oldStatfs statfs_freebsd11_t - if supportsABI(_ino64First) { - return fstatfs_freebsd12(fd, st) - } - err = fstatfs(fd, &oldStatfs) - if err != nil { - return err - } - - st.convertFrom(&oldStatfs) - return nil + return Fstatat(AT_FDCWD, path, st, AT_SYMLINK_NOFOLLOW) } func Getdents(fd int, buf []byte) (n int, err error) { @@ -333,162 +224,25 @@ func Getdents(fd int, buf []byte) (n int, err error) { } func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - if supportsABI(_ino64First) { - if basep == nil || unsafe.Sizeof(*basep) == 8 { - return getdirentries_freebsd12(fd, buf, (*uint64)(unsafe.Pointer(basep))) - } - // The freebsd12 syscall needs a 64-bit base. On 32-bit machines - // we can't just use the basep passed in. See #32498. - var base uint64 = uint64(*basep) - n, err = getdirentries_freebsd12(fd, buf, &base) - *basep = uintptr(base) - if base>>32 != 0 { - // We can't stuff the base back into a uintptr, so any - // future calls would be suspect. Generate an error. - // EIO is allowed by getdirentries. - err = EIO - } - return - } - - // The old syscall entries are smaller than the new. Use 1/4 of the original - // buffer size rounded up to DIRBLKSIZ (see /usr/src/lib/libc/sys/getdirentries.c). - oldBufLen := roundup(len(buf)/4, _dirblksiz) - oldBuf := make([]byte, oldBufLen) - n, err = getdirentries(fd, oldBuf, basep) - if err == nil && n > 0 { - n = convertFromDirents11(buf, oldBuf[:n]) + if basep == nil || unsafe.Sizeof(*basep) == 8 { + return getdirentries(fd, buf, (*uint64)(unsafe.Pointer(basep))) + } + // The syscall needs a 64-bit base. On 32-bit machines + // we can't just use the basep passed in. See #32498. + var base uint64 = uint64(*basep) + n, err = getdirentries(fd, buf, &base) + *basep = uintptr(base) + if base>>32 != 0 { + // We can't stuff the base back into a uintptr, so any + // future calls would be suspect. Generate an error. + // EIO is allowed by getdirentries. + err = EIO } return } func Mknod(path string, mode uint32, dev uint64) (err error) { - var oldDev int - if supportsABI(_ino64First) { - return mknodat_freebsd12(AT_FDCWD, path, mode, dev) - } - oldDev = int(dev) - return mknod(path, mode, oldDev) -} - -func Mknodat(fd int, path string, mode uint32, dev uint64) (err error) { - var oldDev int - if supportsABI(_ino64First) { - return mknodat_freebsd12(fd, path, mode, dev) - } - oldDev = int(dev) - return mknodat(fd, path, mode, oldDev) -} - -// round x to the nearest multiple of y, larger or equal to x. -// -// from /usr/include/sys/param.h Macros for counting and rounding. -// #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) -func roundup(x, y int) int { - return ((x + y - 1) / y) * y -} - -func (s *Stat_t) convertFrom(old *stat_freebsd11_t) { - *s = Stat_t{ - Dev: uint64(old.Dev), - Ino: uint64(old.Ino), - Nlink: uint64(old.Nlink), - Mode: old.Mode, - Uid: old.Uid, - Gid: old.Gid, - Rdev: uint64(old.Rdev), - Atim: old.Atim, - Mtim: old.Mtim, - Ctim: old.Ctim, - Btim: old.Btim, - Size: old.Size, - Blocks: old.Blocks, - Blksize: old.Blksize, - Flags: old.Flags, - Gen: uint64(old.Gen), - } -} - -func (s *Statfs_t) convertFrom(old *statfs_freebsd11_t) { - *s = Statfs_t{ - Version: _statfsVersion, - Type: old.Type, - Flags: old.Flags, - Bsize: old.Bsize, - Iosize: old.Iosize, - Blocks: old.Blocks, - Bfree: old.Bfree, - Bavail: old.Bavail, - Files: old.Files, - Ffree: old.Ffree, - Syncwrites: old.Syncwrites, - Asyncwrites: old.Asyncwrites, - Syncreads: old.Syncreads, - Asyncreads: old.Asyncreads, - // Spare - Namemax: old.Namemax, - Owner: old.Owner, - Fsid: old.Fsid, - // Charspare - // Fstypename - // Mntfromname - // Mntonname - } - - sl := old.Fstypename[:] - n := clen(*(*[]byte)(unsafe.Pointer(&sl))) - copy(s.Fstypename[:], old.Fstypename[:n]) - - sl = old.Mntfromname[:] - n = clen(*(*[]byte)(unsafe.Pointer(&sl))) - copy(s.Mntfromname[:], old.Mntfromname[:n]) - - sl = old.Mntonname[:] - n = clen(*(*[]byte)(unsafe.Pointer(&sl))) - copy(s.Mntonname[:], old.Mntonname[:n]) -} - -func convertFromDirents11(buf []byte, old []byte) int { - const ( - fixedSize = int(unsafe.Offsetof(Dirent{}.Name)) - oldFixedSize = int(unsafe.Offsetof(dirent_freebsd11{}.Name)) - ) - - dstPos := 0 - srcPos := 0 - for dstPos+fixedSize < len(buf) && srcPos+oldFixedSize < len(old) { - var dstDirent Dirent - var srcDirent dirent_freebsd11 - - // If multiple direntries are written, sometimes when we reach the final one, - // we may have cap of old less than size of dirent_freebsd11. - copy((*[unsafe.Sizeof(srcDirent)]byte)(unsafe.Pointer(&srcDirent))[:], old[srcPos:]) - - reclen := roundup(fixedSize+int(srcDirent.Namlen)+1, 8) - if dstPos+reclen > len(buf) { - break - } - - dstDirent.Fileno = uint64(srcDirent.Fileno) - dstDirent.Off = 0 - dstDirent.Reclen = uint16(reclen) - dstDirent.Type = srcDirent.Type - dstDirent.Pad0 = 0 - dstDirent.Namlen = uint16(srcDirent.Namlen) - dstDirent.Pad1 = 0 - - copy(dstDirent.Name[:], srcDirent.Name[:srcDirent.Namlen]) - copy(buf[dstPos:], (*[unsafe.Sizeof(dstDirent)]byte)(unsafe.Pointer(&dstDirent))[:]) - padding := buf[dstPos+fixedSize+int(dstDirent.Namlen) : dstPos+reclen] - for i := range padding { - padding[i] = 0 - } - - dstPos += int(dstDirent.Reclen) - srcPos += int(srcDirent.Reclen) - } - - return dstPos + return Mknodat(AT_FDCWD, path, mode, dev) } func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { @@ -501,31 +255,31 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys ptrace(request int, pid int, addr uintptr, data int) (err error) func PtraceAttach(pid int) (err error) { - return ptrace(PTRACE_ATTACH, pid, 0, 0) + return ptrace(PT_ATTACH, pid, 0, 0) } func PtraceCont(pid int, signal int) (err error) { - return ptrace(PTRACE_CONT, pid, 1, signal) + return ptrace(PT_CONTINUE, pid, 1, signal) } func PtraceDetach(pid int) (err error) { - return ptrace(PTRACE_DETACH, pid, 1, 0) + return ptrace(PT_DETACH, pid, 1, 0) } func PtraceGetFpRegs(pid int, fpregsout *FpReg) (err error) { - return ptrace(PTRACE_GETFPREGS, pid, uintptr(unsafe.Pointer(fpregsout)), 0) + return ptrace(PT_GETFPREGS, pid, uintptr(unsafe.Pointer(fpregsout)), 0) } func PtraceGetRegs(pid int, regsout *Reg) (err error) { - return ptrace(PTRACE_GETREGS, pid, uintptr(unsafe.Pointer(regsout)), 0) + return ptrace(PT_GETREGS, pid, uintptr(unsafe.Pointer(regsout)), 0) } func PtraceLwpEvents(pid int, enable int) (err error) { - return ptrace(PTRACE_LWPEVENTS, pid, 0, enable) + return ptrace(PT_LWP_EVENTS, pid, 0, enable) } func PtraceLwpInfo(pid int, info uintptr) (err error) { - return ptrace(PTRACE_LWPINFO, pid, info, int(unsafe.Sizeof(PtraceLwpInfoStruct{}))) + return ptrace(PT_LWPINFO, pid, info, int(unsafe.Sizeof(PtraceLwpInfoStruct{}))) } func PtracePeekData(pid int, addr uintptr, out []byte) (count int, err error) { @@ -545,11 +299,11 @@ func PtracePokeText(pid int, addr uintptr, data []byte) (count int, err error) { } func PtraceSetRegs(pid int, regs *Reg) (err error) { - return ptrace(PTRACE_SETREGS, pid, uintptr(unsafe.Pointer(regs)), 0) + return ptrace(PT_SETREGS, pid, uintptr(unsafe.Pointer(regs)), 0) } func PtraceSingleStep(pid int) (err error) { - return ptrace(PTRACE_SINGLESTEP, pid, 1, 0) + return ptrace(PT_STEP, pid, 1, 0) } /* @@ -565,6 +319,7 @@ func PtraceSingleStep(pid int) (err error) { //sys Chmod(path string, mode uint32) (err error) //sys Chown(path string, uid int, gid int) (err error) //sys Chroot(path string) (err error) +//sys ClockGettime(clockid int32, time *Timespec) (err error) //sys Close(fd int) (err error) //sys Dup(fd int) (nfd int, err error) //sys Dup2(from int, to int) (err error) @@ -591,16 +346,12 @@ func PtraceSingleStep(pid int) (err error) { //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) //sys Flock(fd int, how int) (err error) //sys Fpathconf(fd int, name int) (val int, err error) -//sys fstat(fd int, stat *stat_freebsd11_t) (err error) -//sys fstat_freebsd12(fd int, stat *Stat_t) (err error) -//sys fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) -//sys fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error) -//sys fstatfs(fd int, stat *statfs_freebsd11_t) (err error) -//sys fstatfs_freebsd12(fd int, stat *Statfs_t) (err error) +//sys Fstat(fd int, stat *Stat_t) (err error) +//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) +//sys Fstatfs(fd int, stat *Statfs_t) (err error) //sys Fsync(fd int) (err error) //sys Ftruncate(fd int, length int64) (err error) -//sys getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) -//sys getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) +//sys getdirentries(fd int, buf []byte, basep *uint64) (n int, err error) //sys Getdtablesize() (size int) //sysnb Getegid() (egid int) //sysnb Geteuid() (uid int) @@ -622,13 +373,10 @@ func PtraceSingleStep(pid int) (err error) { //sys Link(path string, link string) (err error) //sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) //sys Listen(s int, backlog int) (err error) -//sys lstat(path string, stat *stat_freebsd11_t) (err error) //sys Mkdir(path string, mode uint32) (err error) //sys Mkdirat(dirfd int, path string, mode uint32) (err error) //sys Mkfifo(path string, mode uint32) (err error) -//sys mknod(path string, mode uint32, dev int) (err error) -//sys mknodat(fd int, path string, mode uint32, dev int) (err error) -//sys mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error) +//sys Mknodat(fd int, path string, mode uint32, dev uint64) (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys Open(path string, mode int, perm uint32) (fd int, err error) //sys Openat(fdat int, path string, mode int, perm uint32) (fd int, err error) @@ -658,9 +406,7 @@ func PtraceSingleStep(pid int) (err error) { //sysnb Setsid() (pid int, err error) //sysnb Settimeofday(tp *Timeval) (err error) //sysnb Setuid(uid int) (err error) -//sys stat(path string, stat *stat_freebsd11_t) (err error) -//sys statfs(path string, stat *statfs_freebsd11_t) (err error) -//sys statfs_freebsd12(path string, stat *Statfs_t) (err error) +//sys Statfs(path string, stat *Statfs_t) (err error) //sys Symlink(path string, link string) (err error) //sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error) //sys Sync() (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go index 342fc32b1686..b11ede89a960 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go @@ -57,11 +57,11 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) func PtraceGetFsBase(pid int, fsbase *int64) (err error) { - return ptrace(PTRACE_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0) + return ptrace(PT_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0) } func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) { - ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint32(countin)} - err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) + ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint32(countin)} + err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) return int(ioDesc.Len), err } diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go index a32d5aa4aed4..9ed8eec6c287 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go @@ -57,11 +57,11 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) func PtraceGetFsBase(pid int, fsbase *int64) (err error) { - return ptrace(PTRACE_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0) + return ptrace(PT_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0) } func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) { - ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint64(countin)} - err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) + ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint64(countin)} + err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) return int(ioDesc.Len), err } diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go index 1e36d39abe01..f8ac98247905 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go @@ -57,7 +57,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) { - ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint32(countin)} - err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) + ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint32(countin)} + err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) return int(ioDesc.Len), err } diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go index a09a1537bd6f..8e932036ec37 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go @@ -57,7 +57,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) { - ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint64(countin)} - err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) + ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint64(countin)} + err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) return int(ioDesc.Len), err } diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go new file mode 100644 index 000000000000..cbe12227896b --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go @@ -0,0 +1,63 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build riscv64 && freebsd +// +build riscv64,freebsd + +package unix + +import ( + "syscall" + "unsafe" +) + +func setTimespec(sec, nsec int64) Timespec { + return Timespec{Sec: sec, Nsec: nsec} +} + +func setTimeval(sec, usec int64) Timeval { + return Timeval{Sec: sec, Usec: usec} +} + +func SetKevent(k *Kevent_t, fd, mode, flags int) { + k.Ident = uint64(fd) + k.Filter = int16(mode) + k.Flags = uint16(flags) +} + +func (iov *Iovec) SetLen(length int) { + iov.Len = uint64(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = uint32(length) +} + +func (msghdr *Msghdr) SetIovlen(length int) { + msghdr.Iovlen = int32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = uint32(length) +} + +func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { + var writtenOut uint64 = 0 + _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) + + written = int(writtenOut) + + if e1 != 0 { + err = e1 + } + return +} + +func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) + +func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) { + ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint64(countin)} + err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) + return int(ioDesc.Len), err +} diff --git a/vendor/golang.org/x/sys/unix/syscall_hurd.go b/vendor/golang.org/x/sys/unix/syscall_hurd.go new file mode 100644 index 000000000000..4ffb64808d75 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_hurd.go @@ -0,0 +1,22 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build hurd +// +build hurd + +package unix + +/* +#include +int ioctl(int, unsigned long int, uintptr_t); +*/ +import "C" + +func ioctl(fd int, req uint, arg uintptr) (err error) { + r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(arg)) + if r0 == -1 && er != nil { + err = er + } + return +} diff --git a/vendor/golang.org/x/sys/unix/syscall_hurd_386.go b/vendor/golang.org/x/sys/unix/syscall_hurd_386.go new file mode 100644 index 000000000000..7cf54a3e4f10 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_hurd_386.go @@ -0,0 +1,29 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build 386 && hurd +// +build 386,hurd + +package unix + +const ( + TIOCGETA = 0x62251713 +) + +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + +type Termios struct { + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Cc [20]uint8 + Ispeed int32 + Ospeed int32 +} diff --git a/vendor/golang.org/x/sys/unix/syscall_illumos.go b/vendor/golang.org/x/sys/unix/syscall_illumos.go index 8d5f294c4250..87db5a6a8ccc 100644 --- a/vendor/golang.org/x/sys/unix/syscall_illumos.go +++ b/vendor/golang.org/x/sys/unix/syscall_illumos.go @@ -10,8 +10,6 @@ package unix import ( - "fmt" - "runtime" "unsafe" ) @@ -20,10 +18,9 @@ func bytes2iovec(bs [][]byte) []Iovec { for i, b := range bs { iovecs[i].SetLen(len(b)) if len(b) > 0 { - // somehow Iovec.Base on illumos is (*int8), not (*byte) - iovecs[i].Base = (*int8)(unsafe.Pointer(&b[0])) + iovecs[i].Base = &b[0] } else { - iovecs[i].Base = (*int8)(unsafe.Pointer(&_zero)) + iovecs[i].Base = (*byte)(unsafe.Pointer(&_zero)) } } return iovecs @@ -80,107 +77,3 @@ func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) { } return } - -//sys putmsg(fd int, clptr *strbuf, dataptr *strbuf, flags int) (err error) - -func Putmsg(fd int, cl []byte, data []byte, flags int) (err error) { - var clp, datap *strbuf - if len(cl) > 0 { - clp = &strbuf{ - Len: int32(len(cl)), - Buf: (*int8)(unsafe.Pointer(&cl[0])), - } - } - if len(data) > 0 { - datap = &strbuf{ - Len: int32(len(data)), - Buf: (*int8)(unsafe.Pointer(&data[0])), - } - } - return putmsg(fd, clp, datap, flags) -} - -//sys getmsg(fd int, clptr *strbuf, dataptr *strbuf, flags *int) (err error) - -func Getmsg(fd int, cl []byte, data []byte) (retCl []byte, retData []byte, flags int, err error) { - var clp, datap *strbuf - if len(cl) > 0 { - clp = &strbuf{ - Maxlen: int32(len(cl)), - Buf: (*int8)(unsafe.Pointer(&cl[0])), - } - } - if len(data) > 0 { - datap = &strbuf{ - Maxlen: int32(len(data)), - Buf: (*int8)(unsafe.Pointer(&data[0])), - } - } - - if err = getmsg(fd, clp, datap, &flags); err != nil { - return nil, nil, 0, err - } - - if len(cl) > 0 { - retCl = cl[:clp.Len] - } - if len(data) > 0 { - retData = data[:datap.Len] - } - return retCl, retData, flags, nil -} - -func IoctlSetIntRetInt(fd int, req uint, arg int) (int, error) { - return ioctlRet(fd, req, uintptr(arg)) -} - -func IoctlSetString(fd int, req uint, val string) error { - bs := make([]byte, len(val)+1) - copy(bs[:len(bs)-1], val) - err := ioctl(fd, req, uintptr(unsafe.Pointer(&bs[0]))) - runtime.KeepAlive(&bs[0]) - return err -} - -// Lifreq Helpers - -func (l *Lifreq) SetName(name string) error { - if len(name) >= len(l.Name) { - return fmt.Errorf("name cannot be more than %d characters", len(l.Name)-1) - } - for i := range name { - l.Name[i] = int8(name[i]) - } - return nil -} - -func (l *Lifreq) SetLifruInt(d int) { - *(*int)(unsafe.Pointer(&l.Lifru[0])) = d -} - -func (l *Lifreq) GetLifruInt() int { - return *(*int)(unsafe.Pointer(&l.Lifru[0])) -} - -func (l *Lifreq) SetLifruUint(d uint) { - *(*uint)(unsafe.Pointer(&l.Lifru[0])) = d -} - -func (l *Lifreq) GetLifruUint() uint { - return *(*uint)(unsafe.Pointer(&l.Lifru[0])) -} - -func IoctlLifreq(fd int, req uint, l *Lifreq) error { - return ioctl(fd, req, uintptr(unsafe.Pointer(l))) -} - -// Strioctl Helpers - -func (s *Strioctl) SetInt(i int) { - s.Len = int32(unsafe.Sizeof(i)) - s.Dp = (*int8)(unsafe.Pointer(&i)) -} - -func IoctlSetStrioctlRetInt(fd int, req uint, s *Strioctl) (int, error) { - return ioctlRet(fd, req, uintptr(unsafe.Pointer(s))) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index c8d203212517..d839962e6633 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -13,6 +13,7 @@ package unix import ( "encoding/binary" + "strconv" "syscall" "time" "unsafe" @@ -233,7 +234,7 @@ func Futimesat(dirfd int, path string, tv []Timeval) error { func Futimes(fd int, tv []Timeval) (err error) { // Believe it or not, this is the best we can do on Linux // (and is what glibc does). - return Utimes("/proc/self/fd/"+itoa(fd), tv) + return Utimes("/proc/self/fd/"+strconv.Itoa(fd), tv) } const ImplementsGetwd = true @@ -1499,18 +1500,13 @@ func KeyctlRestrictKeyring(ringid int, keyType string, restriction string) error //sys keyctlRestrictKeyringByType(cmd int, arg2 int, keyType string, restriction string) (err error) = SYS_KEYCTL //sys keyctlRestrictKeyring(cmd int, arg2 int) (err error) = SYS_KEYCTL -func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) { +func recvmsgRaw(fd int, iov []Iovec, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) { var msg Msghdr msg.Name = (*byte)(unsafe.Pointer(rsa)) msg.Namelen = uint32(SizeofSockaddrAny) - var iov Iovec - if len(p) > 0 { - iov.Base = &p[0] - iov.SetLen(len(p)) - } var dummy byte if len(oob) > 0 { - if len(p) == 0 { + if emptyIovecs(iov) { var sockType int sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE) if err != nil { @@ -1518,15 +1514,19 @@ func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn } // receive at least one normal byte if sockType != SOCK_DGRAM { - iov.Base = &dummy - iov.SetLen(1) + var iova [1]Iovec + iova[0].Base = &dummy + iova[0].SetLen(1) + iov = iova[:] } } msg.Control = &oob[0] msg.SetControllen(len(oob)) } - msg.Iov = &iov - msg.Iovlen = 1 + if len(iov) > 0 { + msg.Iov = &iov[0] + msg.SetIovlen(len(iov)) + } if n, err = recvmsg(fd, &msg, flags); err != nil { return } @@ -1535,18 +1535,15 @@ func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn return } -func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) { +func sendmsgN(fd int, iov []Iovec, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) { var msg Msghdr msg.Name = (*byte)(ptr) msg.Namelen = uint32(salen) - var iov Iovec - if len(p) > 0 { - iov.Base = &p[0] - iov.SetLen(len(p)) - } var dummy byte + var empty bool if len(oob) > 0 { - if len(p) == 0 { + empty = emptyIovecs(iov) + if empty { var sockType int sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE) if err != nil { @@ -1554,19 +1551,23 @@ func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags i } // send at least one normal byte if sockType != SOCK_DGRAM { - iov.Base = &dummy - iov.SetLen(1) + var iova [1]Iovec + iova[0].Base = &dummy + iova[0].SetLen(1) + iov = iova[:] } } msg.Control = &oob[0] msg.SetControllen(len(oob)) } - msg.Iov = &iov - msg.Iovlen = 1 + if len(iov) > 0 { + msg.Iov = &iov[0] + msg.SetIovlen(len(iov)) + } if n, err = sendmsg(fd, &msg, flags); err != nil { return 0, err } - if len(oob) > 0 && len(p) == 0 { + if len(oob) > 0 && empty { n = 0 } return n, nil @@ -1892,17 +1893,28 @@ func PrctlRetInt(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uint return int(ret), nil } -// issue 1435. -// On linux Setuid and Setgid only affects the current thread, not the process. -// This does not match what most callers expect so we must return an error -// here rather than letting the caller think that the call succeeded. - func Setuid(uid int) (err error) { - return EOPNOTSUPP + return syscall.Setuid(uid) +} + +func Setgid(gid int) (err error) { + return syscall.Setgid(gid) +} + +func Setreuid(ruid, euid int) (err error) { + return syscall.Setreuid(ruid, euid) } -func Setgid(uid int) (err error) { - return EOPNOTSUPP +func Setregid(rgid, egid int) (err error) { + return syscall.Setregid(rgid, egid) +} + +func Setresuid(ruid, euid, suid int) (err error) { + return syscall.Setresuid(ruid, euid, suid) +} + +func Setresgid(rgid, egid, sgid int) (err error) { + return syscall.Setresgid(rgid, egid, sgid) } // SetfsgidRetGid sets fsgid for current thread and returns previous fsgid set. @@ -1961,36 +1973,46 @@ func Signalfd(fd int, sigmask *Sigset_t, flags int) (newfd int, err error) { //sys preadv2(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr, flags int) (n int, err error) = SYS_PREADV2 //sys pwritev2(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr, flags int) (n int, err error) = SYS_PWRITEV2 -func bytes2iovec(bs [][]byte) []Iovec { - iovecs := make([]Iovec, len(bs)) - for i, b := range bs { - iovecs[i].SetLen(len(b)) +// minIovec is the size of the small initial allocation used by +// Readv, Writev, etc. +// +// This small allocation gets stack allocated, which lets the +// common use case of len(iovs) <= minIovs avoid more expensive +// heap allocations. +const minIovec = 8 + +// appendBytes converts bs to Iovecs and appends them to vecs. +func appendBytes(vecs []Iovec, bs [][]byte) []Iovec { + for _, b := range bs { + var v Iovec + v.SetLen(len(b)) if len(b) > 0 { - iovecs[i].Base = &b[0] + v.Base = &b[0] } else { - iovecs[i].Base = (*byte)(unsafe.Pointer(&_zero)) + v.Base = (*byte)(unsafe.Pointer(&_zero)) } + vecs = append(vecs, v) } - return iovecs + return vecs } -// offs2lohi splits offs into its lower and upper unsigned long. On 64-bit -// systems, hi will always be 0. On 32-bit systems, offs will be split in half. -// preadv/pwritev chose this calling convention so they don't need to add a -// padding-register for alignment on ARM. +// offs2lohi splits offs into its low and high order bits. func offs2lohi(offs int64) (lo, hi uintptr) { - return uintptr(offs), uintptr(uint64(offs) >> SizeofLong) + const longBits = SizeofLong * 8 + return uintptr(offs), uintptr(uint64(offs) >> longBits) } func Readv(fd int, iovs [][]byte) (n int, err error) { - iovecs := bytes2iovec(iovs) + iovecs := make([]Iovec, 0, minIovec) + iovecs = appendBytes(iovecs, iovs) n, err = readv(fd, iovecs) readvRacedetect(iovecs, n, err) return n, err } func Preadv(fd int, iovs [][]byte, offset int64) (n int, err error) { - iovecs := bytes2iovec(iovs) + iovecs := make([]Iovec, 0, minIovec) + iovecs = appendBytes(iovecs, iovs) lo, hi := offs2lohi(offset) n, err = preadv(fd, iovecs, lo, hi) readvRacedetect(iovecs, n, err) @@ -1998,7 +2020,8 @@ func Preadv(fd int, iovs [][]byte, offset int64) (n int, err error) { } func Preadv2(fd int, iovs [][]byte, offset int64, flags int) (n int, err error) { - iovecs := bytes2iovec(iovs) + iovecs := make([]Iovec, 0, minIovec) + iovecs = appendBytes(iovecs, iovs) lo, hi := offs2lohi(offset) n, err = preadv2(fd, iovecs, lo, hi, flags) readvRacedetect(iovecs, n, err) @@ -2025,7 +2048,8 @@ func readvRacedetect(iovecs []Iovec, n int, err error) { } func Writev(fd int, iovs [][]byte) (n int, err error) { - iovecs := bytes2iovec(iovs) + iovecs := make([]Iovec, 0, minIovec) + iovecs = appendBytes(iovecs, iovs) if raceenabled { raceReleaseMerge(unsafe.Pointer(&ioSync)) } @@ -2035,7 +2059,8 @@ func Writev(fd int, iovs [][]byte) (n int, err error) { } func Pwritev(fd int, iovs [][]byte, offset int64) (n int, err error) { - iovecs := bytes2iovec(iovs) + iovecs := make([]Iovec, 0, minIovec) + iovecs = appendBytes(iovecs, iovs) if raceenabled { raceReleaseMerge(unsafe.Pointer(&ioSync)) } @@ -2046,7 +2071,8 @@ func Pwritev(fd int, iovs [][]byte, offset int64) (n int, err error) { } func Pwritev2(fd int, iovs [][]byte, offset int64, flags int) (n int, err error) { - iovecs := bytes2iovec(iovs) + iovecs := make([]Iovec, 0, minIovec) + iovecs = appendBytes(iovecs, iovs) if raceenabled { raceReleaseMerge(unsafe.Pointer(&ioSync)) } @@ -2241,7 +2267,7 @@ func (fh *FileHandle) Bytes() []byte { if n == 0 { return nil } - return (*[1 << 30]byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&fh.fileHandle.Type)) + 4))[:n:n] + return unsafe.Slice((*byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&fh.fileHandle.Type))+4)), n) } // NameToHandleAt wraps the name_to_handle_at system call; it obtains @@ -2357,6 +2383,16 @@ func Setitimer(which ItimerWhich, it Itimerval) (Itimerval, error) { return prev, nil } +//sysnb rtSigprocmask(how int, set *Sigset_t, oldset *Sigset_t, sigsetsize uintptr) (err error) = SYS_RT_SIGPROCMASK + +func PthreadSigmask(how int, set, oldset *Sigset_t) error { + if oldset != nil { + // Explicitly clear in case Sigset_t is larger than _C__NSIG. + *oldset = Sigset_t{} + } + return rtSigprocmask(how, set, oldset, _C__NSIG/8) +} + /* * Unimplemented */ @@ -2415,7 +2451,6 @@ func Setitimer(which ItimerWhich, it Itimerval) (Itimerval, error) { // RestartSyscall // RtSigaction // RtSigpending -// RtSigprocmask // RtSigqueueinfo // RtSigreturn // RtSigsuspend diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_386.go index 518e476e6dda..ff5b5899d6db 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_386.go @@ -41,10 +41,6 @@ func setTimeval(sec, usec int64) Timeval { //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64 //sys setfsgid(gid int) (prev int, err error) = SYS_SETFSGID32 //sys setfsuid(uid int) (prev int, err error) = SYS_SETFSUID32 -//sysnb Setregid(rgid int, egid int) (err error) = SYS_SETREGID32 -//sysnb Setresgid(rgid int, egid int, sgid int) (err error) = SYS_SETRESGID32 -//sysnb Setresuid(ruid int, euid int, suid int) (err error) = SYS_SETRESUID32 -//sysnb Setreuid(ruid int, euid int) (err error) = SYS_SETREUID32 //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go index f5e9d6bef109..9b2703532989 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go @@ -46,11 +46,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setregid(rgid int, egid int) (err error) -//sysnb Setresgid(rgid int, egid int, sgid int) (err error) -//sysnb Setresuid(ruid int, euid int, suid int) (err error) //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) -//sysnb Setreuid(ruid int, euid int) (err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go index c1a7778f1050..856ad1d635cf 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go @@ -62,10 +62,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT //sys setfsgid(gid int) (prev int, err error) = SYS_SETFSGID32 //sys setfsuid(uid int) (prev int, err error) = SYS_SETFSUID32 -//sysnb Setregid(rgid int, egid int) (err error) = SYS_SETREGID32 -//sysnb Setresgid(rgid int, egid int, sgid int) (err error) = SYS_SETRESGID32 -//sysnb Setresuid(ruid int, euid int, suid int) (err error) = SYS_SETRESUID32 -//sysnb Setreuid(ruid int, euid int) (err error) = SYS_SETREUID32 //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go index d83e2c657161..6422704bc52a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go @@ -39,11 +39,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setregid(rgid int, egid int) (err error) -//sysnb Setresgid(rgid int, egid int, sgid int) (err error) -//sysnb Setresuid(ruid int, euid int, suid int) (err error) //sysnb setrlimit(resource int, rlim *Rlimit) (err error) -//sysnb Setreuid(ruid int, euid int) (err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go b/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go index 28ba7b8cb718..59dab510e97c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go @@ -12,8 +12,6 @@ import "unsafe" //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) -//sys Fstat(fd int, stat *Stat_t) (err error) -//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) //sys Fstatfs(fd int, buf *Statfs_t) (err error) //sys Ftruncate(fd int, length int64) (err error) //sysnb Getegid() (egid int) @@ -36,13 +34,46 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setregid(rgid int, egid int) (err error) -//sysnb Setresgid(rgid int, egid int, sgid int) (err error) -//sysnb Setresuid(ruid int, euid int, suid int) (err error) -//sysnb Setreuid(ruid int, euid int) (err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) +func timespecFromStatxTimestamp(x StatxTimestamp) Timespec { + return Timespec{ + Sec: x.Sec, + Nsec: int64(x.Nsec), + } +} + +func Fstatat(fd int, path string, stat *Stat_t, flags int) error { + var r Statx_t + // Do it the glibc way, add AT_NO_AUTOMOUNT. + if err := Statx(fd, path, AT_NO_AUTOMOUNT|flags, STATX_BASIC_STATS, &r); err != nil { + return err + } + + stat.Dev = Mkdev(r.Dev_major, r.Dev_minor) + stat.Ino = r.Ino + stat.Mode = uint32(r.Mode) + stat.Nlink = r.Nlink + stat.Uid = r.Uid + stat.Gid = r.Gid + stat.Rdev = Mkdev(r.Rdev_major, r.Rdev_minor) + // hope we don't get to process files so large to overflow these size + // fields... + stat.Size = int64(r.Size) + stat.Blksize = int32(r.Blksize) + stat.Blocks = int64(r.Blocks) + stat.Atim = timespecFromStatxTimestamp(r.Atime) + stat.Mtim = timespecFromStatxTimestamp(r.Mtime) + stat.Ctim = timespecFromStatxTimestamp(r.Ctime) + + return nil +} + +func Fstat(fd int, stat *Stat_t) (err error) { + return Fstatat(fd, "", stat, AT_EMPTY_PATH) +} + func Stat(path string, stat *Stat_t) (err error) { return Fstatat(AT_FDCWD, path, stat, 0) } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go index 98a2660b91f7..bfef09a39eb0 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go @@ -37,11 +37,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setregid(rgid int, egid int) (err error) -//sysnb Setresgid(rgid int, egid int, sgid int) (err error) -//sysnb Setresuid(ruid int, euid int, suid int) (err error) //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) -//sysnb Setreuid(ruid int, euid int) (err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) //sys Statfs(path string, buf *Statfs_t) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go index b8a18c0ad224..ab302509663e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go @@ -32,10 +32,6 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64 //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setregid(rgid int, egid int) (err error) -//sysnb Setresgid(rgid int, egid int, sgid int) (err error) -//sysnb Setresuid(ruid int, euid int, suid int) (err error) -//sysnb Setreuid(ruid int, euid int) (err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go index 4ed9e67c6dfd..eac1cf1acc86 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go @@ -34,10 +34,6 @@ import ( //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64 //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setregid(rgid int, egid int) (err error) -//sysnb Setresgid(rgid int, egid int, sgid int) (err error) -//sysnb Setresuid(ruid int, euid int, suid int) (err error) -//sysnb Setreuid(ruid int, euid int) (err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go index db63d384c5bc..4df56616b8f1 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go @@ -34,11 +34,7 @@ package unix //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setregid(rgid int, egid int) (err error) -//sysnb Setresgid(rgid int, egid int, sgid int) (err error) -//sysnb Setresuid(ruid int, euid int, suid int) (err error) //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) -//sysnb Setreuid(ruid int, euid int) (err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) //sys Stat(path string, stat *Stat_t) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go index 8ff7adba0392..5f4243dea2c3 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go @@ -22,6 +22,7 @@ import "unsafe" //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) //sysnb Getuid() (uid int) //sys Listen(s int, n int) (err error) +//sys MemfdSecret(flags int) (fd int, err error) //sys pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK @@ -37,11 +38,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setregid(rgid int, egid int) (err error) -//sysnb Setresgid(rgid int, egid int, sgid int) (err error) -//sysnb Setresuid(ruid int, euid int, suid int) (err error) //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) -//sysnb Setreuid(ruid int, euid int) (err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go index 6fcf277b0d73..d0a7d4066851 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go @@ -34,11 +34,7 @@ import ( //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setregid(rgid int, egid int) (err error) -//sysnb Setresgid(rgid int, egid int, sgid int) (err error) -//sysnb Setresuid(ruid int, euid int, suid int) (err error) //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) -//sysnb Setreuid(ruid int, euid int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) //sys Stat(path string, stat *Stat_t) (err error) //sys Statfs(path string, buf *Statfs_t) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go index 02a45d9cc063..f5c793be26d4 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go @@ -31,11 +31,7 @@ package unix //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setregid(rgid int, egid int) (err error) -//sysnb Setresgid(rgid int, egid int, sgid int) (err error) -//sysnb Setresuid(ruid int, euid int, suid int) (err error) //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) -//sysnb Setreuid(ruid int, euid int) (err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) //sys Stat(path string, stat *Stat_t) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go index 666f0a1b33d2..35a3ad758f59 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -110,6 +110,20 @@ func direntNamlen(buf []byte) (uint64, bool) { return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) } +func SysctlUvmexp(name string) (*Uvmexp, error) { + mib, err := sysctlmib(name) + if err != nil { + return nil, err + } + + n := uintptr(SizeofUvmexp) + var u Uvmexp + if err := sysctl(mib, (*byte)(unsafe.Pointer(&u)), &n, nil, 0); err != nil { + return nil, err + } + return &u, nil +} + func Pipe(p []int) (err error) { return Pipe2(p, 0) } @@ -245,6 +259,7 @@ func Statvfs(path string, buf *Statvfs_t) (err error) { //sys Chmod(path string, mode uint32) (err error) //sys Chown(path string, uid int, gid int) (err error) //sys Chroot(path string) (err error) +//sys ClockGettime(clockid int32, time *Timespec) (err error) //sys Close(fd int) (err error) //sys Dup(fd int) (nfd int, err error) //sys Dup2(from int, to int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index 78daceb338bc..9b67b908e5f9 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -220,6 +220,7 @@ func Uname(uname *Utsname) error { //sys Chmod(path string, mode uint32) (err error) //sys Chown(path string, uid int, gid int) (err error) //sys Chroot(path string) (err error) +//sys ClockGettime(clockid int32, time *Timespec) (err error) //sys Close(fd int) (err error) //sys Dup(fd int) (nfd int, err error) //sys Dup2(from int, to int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go new file mode 100644 index 000000000000..04aa43f41b25 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go @@ -0,0 +1,27 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build openbsd +// +build openbsd + +package unix + +import _ "unsafe" + +// Implemented in the runtime package (runtime/sys_openbsd3.go) +func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) +func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) +func syscall_syscall10(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 uintptr) (r1, r2 uintptr, err Errno) +func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) +func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) + +//go:linkname syscall_syscall syscall.syscall +//go:linkname syscall_syscall6 syscall.syscall6 +//go:linkname syscall_syscall10 syscall.syscall10 +//go:linkname syscall_rawSyscall syscall.rawSyscall +//go:linkname syscall_rawSyscall6 syscall.rawSyscall6 + +func syscall_syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) { + return syscall_syscall10(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, 0) +} diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go index 30f285343ee4..1378489f8d7f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go @@ -26,6 +26,10 @@ func (msghdr *Msghdr) SetControllen(length int) { msghdr.Controllen = uint32(length) } +func (msghdr *Msghdr) SetIovlen(length int) { + msghdr.Iovlen = uint32(length) +} + func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go new file mode 100644 index 000000000000..c2796139c013 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go @@ -0,0 +1,42 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build ppc64 && openbsd +// +build ppc64,openbsd + +package unix + +func setTimespec(sec, nsec int64) Timespec { + return Timespec{Sec: sec, Nsec: nsec} +} + +func setTimeval(sec, usec int64) Timeval { + return Timeval{Sec: sec, Usec: usec} +} + +func SetKevent(k *Kevent_t, fd, mode, flags int) { + k.Ident = uint64(fd) + k.Filter = int16(mode) + k.Flags = uint16(flags) +} + +func (iov *Iovec) SetLen(length int) { + iov.Len = uint64(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = uint32(length) +} + +func (msghdr *Msghdr) SetIovlen(length int) { + msghdr.Iovlen = uint32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = uint32(length) +} + +// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions +// of openbsd/ppc64 the syscall is called sysctl instead of __sysctl. +const SYS___SYSCTL = SYS_SYSCTL diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go new file mode 100644 index 000000000000..23199a7ff624 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go @@ -0,0 +1,42 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build riscv64 && openbsd +// +build riscv64,openbsd + +package unix + +func setTimespec(sec, nsec int64) Timespec { + return Timespec{Sec: sec, Nsec: nsec} +} + +func setTimeval(sec, usec int64) Timeval { + return Timeval{Sec: sec, Usec: usec} +} + +func SetKevent(k *Kevent_t, fd, mode, flags int) { + k.Ident = uint64(fd) + k.Filter = int16(mode) + k.Flags = uint16(flags) +} + +func (iov *Iovec) SetLen(length int) { + iov.Len = uint64(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = uint32(length) +} + +func (msghdr *Msghdr) SetIovlen(length int) { + msghdr.Iovlen = uint32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = uint32(length) +} + +// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions +// of openbsd/riscv64 the syscall is called sysctl instead of __sysctl. +const SYS___SYSCTL = SYS_SYSCTL diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index 5c2003cec654..07ac56109a05 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -451,26 +451,25 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) { //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.__xnet_recvmsg -func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) { +func recvmsgRaw(fd int, iov []Iovec, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) { var msg Msghdr msg.Name = (*byte)(unsafe.Pointer(rsa)) msg.Namelen = uint32(SizeofSockaddrAny) - var iov Iovec - if len(p) > 0 { - iov.Base = (*int8)(unsafe.Pointer(&p[0])) - iov.SetLen(len(p)) - } - var dummy int8 + var dummy byte if len(oob) > 0 { // receive at least one normal byte - if len(p) == 0 { - iov.Base = &dummy - iov.SetLen(1) + if emptyIovecs(iov) { + var iova [1]Iovec + iova[0].Base = &dummy + iova[0].SetLen(1) + iov = iova[:] } msg.Accrightslen = int32(len(oob)) } - msg.Iov = &iov - msg.Iovlen = 1 + if len(iov) > 0 { + msg.Iov = &iov[0] + msg.SetIovlen(len(iov)) + } if n, err = recvmsg(fd, &msg, flags); n == -1 { return } @@ -480,30 +479,31 @@ func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.__xnet_sendmsg -func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) { +func sendmsgN(fd int, iov []Iovec, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) { var msg Msghdr msg.Name = (*byte)(unsafe.Pointer(ptr)) msg.Namelen = uint32(salen) - var iov Iovec - if len(p) > 0 { - iov.Base = (*int8)(unsafe.Pointer(&p[0])) - iov.SetLen(len(p)) - } - var dummy int8 + var dummy byte + var empty bool if len(oob) > 0 { // send at least one normal byte - if len(p) == 0 { - iov.Base = &dummy - iov.SetLen(1) + empty = emptyIovecs(iov) + if empty { + var iova [1]Iovec + iova[0].Base = &dummy + iova[0].SetLen(1) + iov = iova[:] } msg.Accrightslen = int32(len(oob)) } - msg.Iov = &iov - msg.Iovlen = 1 + if len(iov) > 0 { + msg.Iov = &iov[0] + msg.SetIovlen(len(iov)) + } if n, err = sendmsg(fd, &msg, flags); err != nil { return 0, err } - if len(oob) > 0 && len(p) == 0 { + if len(oob) > 0 && empty { n = 0 } return n, nil @@ -590,6 +590,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Chmod(path string, mode uint32) (err error) //sys Chown(path string, uid int, gid int) (err error) //sys Chroot(path string) (err error) +//sys ClockGettime(clockid int32, time *Timespec) (err error) //sys Close(fd int) (err error) //sys Creat(path string, mode uint32) (fd int, err error) //sys Dup(fd int) (nfd int, err error) @@ -618,6 +619,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Getpriority(which int, who int) (n int, err error) //sysnb Getrlimit(which int, lim *Rlimit) (err error) //sysnb Getrusage(who int, rusage *Rusage) (err error) +//sysnb Getsid(pid int) (sid int, err error) //sysnb Gettimeofday(tv *Timeval) (err error) //sysnb Getuid() (uid int) //sys Kill(pid int, signum syscall.Signal) (err error) @@ -749,8 +751,8 @@ type EventPort struct { // we should handle things gracefully. To do so, we need to keep an extra // reference to the cookie around until the event is processed // thus the otherwise seemingly extraneous "cookies" map - // The key of this map is a pointer to the corresponding &fCookie.cookie - cookies map[*interface{}]*fileObjCookie + // The key of this map is a pointer to the corresponding fCookie + cookies map[*fileObjCookie]struct{} } // PortEvent is an abstraction of the port_event C struct. @@ -777,7 +779,7 @@ func NewEventPort() (*EventPort, error) { port: port, fds: make(map[uintptr]*fileObjCookie), paths: make(map[string]*fileObjCookie), - cookies: make(map[*interface{}]*fileObjCookie), + cookies: make(map[*fileObjCookie]struct{}), } return e, nil } @@ -798,6 +800,7 @@ func (e *EventPort) Close() error { } e.fds = nil e.paths = nil + e.cookies = nil return nil } @@ -825,17 +828,16 @@ func (e *EventPort) AssociatePath(path string, stat os.FileInfo, events int, coo if _, found := e.paths[path]; found { return fmt.Errorf("%v is already associated with this Event Port", path) } - fobj, err := createFileObj(path, stat) + fCookie, err := createFileObjCookie(path, stat, cookie) if err != nil { return err } - fCookie := &fileObjCookie{fobj, cookie} - _, err = port_associate(e.port, PORT_SOURCE_FILE, uintptr(unsafe.Pointer(fobj)), events, (*byte)(unsafe.Pointer(&fCookie.cookie))) + _, err = port_associate(e.port, PORT_SOURCE_FILE, uintptr(unsafe.Pointer(fCookie.fobj)), events, (*byte)(unsafe.Pointer(fCookie))) if err != nil { return err } e.paths[path] = fCookie - e.cookies[&fCookie.cookie] = fCookie + e.cookies[fCookie] = struct{}{} return nil } @@ -857,7 +859,7 @@ func (e *EventPort) DissociatePath(path string) error { if err == nil { // dissociate was successful, safe to delete the cookie fCookie := e.paths[path] - delete(e.cookies, &fCookie.cookie) + delete(e.cookies, fCookie) } delete(e.paths, path) return err @@ -870,13 +872,16 @@ func (e *EventPort) AssociateFd(fd uintptr, events int, cookie interface{}) erro if _, found := e.fds[fd]; found { return fmt.Errorf("%v is already associated with this Event Port", fd) } - fCookie := &fileObjCookie{nil, cookie} - _, err := port_associate(e.port, PORT_SOURCE_FD, fd, events, (*byte)(unsafe.Pointer(&fCookie.cookie))) + fCookie, err := createFileObjCookie("", nil, cookie) + if err != nil { + return err + } + _, err = port_associate(e.port, PORT_SOURCE_FD, fd, events, (*byte)(unsafe.Pointer(fCookie))) if err != nil { return err } e.fds[fd] = fCookie - e.cookies[&fCookie.cookie] = fCookie + e.cookies[fCookie] = struct{}{} return nil } @@ -895,27 +900,31 @@ func (e *EventPort) DissociateFd(fd uintptr) error { if err == nil { // dissociate was successful, safe to delete the cookie fCookie := e.fds[fd] - delete(e.cookies, &fCookie.cookie) + delete(e.cookies, fCookie) } delete(e.fds, fd) return err } -func createFileObj(name string, stat os.FileInfo) (*fileObj, error) { - fobj := new(fileObj) - bs, err := ByteSliceFromString(name) - if err != nil { - return nil, err - } - fobj.Name = (*int8)(unsafe.Pointer(&bs[0])) - s := stat.Sys().(*syscall.Stat_t) - fobj.Atim.Sec = s.Atim.Sec - fobj.Atim.Nsec = s.Atim.Nsec - fobj.Mtim.Sec = s.Mtim.Sec - fobj.Mtim.Nsec = s.Mtim.Nsec - fobj.Ctim.Sec = s.Ctim.Sec - fobj.Ctim.Nsec = s.Ctim.Nsec - return fobj, nil +func createFileObjCookie(name string, stat os.FileInfo, cookie interface{}) (*fileObjCookie, error) { + fCookie := new(fileObjCookie) + fCookie.cookie = cookie + if name != "" && stat != nil { + fCookie.fobj = new(fileObj) + bs, err := ByteSliceFromString(name) + if err != nil { + return nil, err + } + fCookie.fobj.Name = (*int8)(unsafe.Pointer(&bs[0])) + s := stat.Sys().(*syscall.Stat_t) + fCookie.fobj.Atim.Sec = s.Atim.Sec + fCookie.fobj.Atim.Nsec = s.Atim.Nsec + fCookie.fobj.Mtim.Sec = s.Mtim.Sec + fCookie.fobj.Mtim.Nsec = s.Mtim.Nsec + fCookie.fobj.Ctim.Sec = s.Ctim.Sec + fCookie.fobj.Ctim.Nsec = s.Ctim.Nsec + } + return fCookie, nil } // GetOne wraps port_get(3c) and returns a single PortEvent. @@ -928,44 +937,50 @@ func (e *EventPort) GetOne(t *Timespec) (*PortEvent, error) { p := new(PortEvent) e.mu.Lock() defer e.mu.Unlock() - e.peIntToExt(pe, p) + err = e.peIntToExt(pe, p) + if err != nil { + return nil, err + } return p, nil } // peIntToExt converts a cgo portEvent struct into the friendlier PortEvent // NOTE: Always call this function while holding the e.mu mutex -func (e *EventPort) peIntToExt(peInt *portEvent, peExt *PortEvent) { +func (e *EventPort) peIntToExt(peInt *portEvent, peExt *PortEvent) error { + if e.cookies == nil { + return fmt.Errorf("this EventPort is already closed") + } peExt.Events = peInt.Events peExt.Source = peInt.Source - cookie := (*interface{})(unsafe.Pointer(peInt.User)) - peExt.Cookie = *cookie + fCookie := (*fileObjCookie)(unsafe.Pointer(peInt.User)) + _, found := e.cookies[fCookie] + + if !found { + panic("unexpected event port address; may be due to kernel bug; see https://go.dev/issue/54254") + } + peExt.Cookie = fCookie.cookie + delete(e.cookies, fCookie) + switch peInt.Source { case PORT_SOURCE_FD: - delete(e.cookies, cookie) peExt.Fd = uintptr(peInt.Object) // Only remove the fds entry if it exists and this cookie matches if fobj, ok := e.fds[peExt.Fd]; ok { - if &fobj.cookie == cookie { + if fobj == fCookie { delete(e.fds, peExt.Fd) } } case PORT_SOURCE_FILE: - if fCookie, ok := e.cookies[cookie]; ok && uintptr(unsafe.Pointer(fCookie.fobj)) == uintptr(peInt.Object) { - // Use our stashed reference rather than using unsafe on what we got back - // the unsafe version would be (*fileObj)(unsafe.Pointer(uintptr(peInt.Object))) - peExt.fobj = fCookie.fobj - } else { - panic("mismanaged memory") - } - delete(e.cookies, cookie) + peExt.fobj = fCookie.fobj peExt.Path = BytePtrToString((*byte)(unsafe.Pointer(peExt.fobj.Name))) // Only remove the paths entry if it exists and this cookie matches if fobj, ok := e.paths[peExt.Path]; ok { - if &fobj.cookie == cookie { + if fobj == fCookie { delete(e.paths, peExt.Path) } } } + return nil } // Pending wraps port_getn(3c) and returns how many events are pending. @@ -989,7 +1004,7 @@ func (e *EventPort) Get(s []PortEvent, min int, timeout *Timespec) (int, error) got := uint32(min) max := uint32(len(s)) var err error - ps := make([]portEvent, max, max) + ps := make([]portEvent, max) _, err = port_getn(e.port, &ps[0], max, &got, timeout) // got will be trustworthy with ETIME, but not any other error. if err != nil && err != ETIME { @@ -997,8 +1012,122 @@ func (e *EventPort) Get(s []PortEvent, min int, timeout *Timespec) (int, error) } e.mu.Lock() defer e.mu.Unlock() + valid := 0 for i := 0; i < int(got); i++ { - e.peIntToExt(&ps[i], &s[i]) + err2 := e.peIntToExt(&ps[i], &s[i]) + if err2 != nil { + if valid == 0 && err == nil { + // If err2 is the only error and there are no valid events + // to return, return it to the caller. + err = err2 + } + break + } + valid = i + 1 } - return int(got), err + return valid, err +} + +//sys putmsg(fd int, clptr *strbuf, dataptr *strbuf, flags int) (err error) + +func Putmsg(fd int, cl []byte, data []byte, flags int) (err error) { + var clp, datap *strbuf + if len(cl) > 0 { + clp = &strbuf{ + Len: int32(len(cl)), + Buf: (*int8)(unsafe.Pointer(&cl[0])), + } + } + if len(data) > 0 { + datap = &strbuf{ + Len: int32(len(data)), + Buf: (*int8)(unsafe.Pointer(&data[0])), + } + } + return putmsg(fd, clp, datap, flags) +} + +//sys getmsg(fd int, clptr *strbuf, dataptr *strbuf, flags *int) (err error) + +func Getmsg(fd int, cl []byte, data []byte) (retCl []byte, retData []byte, flags int, err error) { + var clp, datap *strbuf + if len(cl) > 0 { + clp = &strbuf{ + Maxlen: int32(len(cl)), + Buf: (*int8)(unsafe.Pointer(&cl[0])), + } + } + if len(data) > 0 { + datap = &strbuf{ + Maxlen: int32(len(data)), + Buf: (*int8)(unsafe.Pointer(&data[0])), + } + } + + if err = getmsg(fd, clp, datap, &flags); err != nil { + return nil, nil, 0, err + } + + if len(cl) > 0 { + retCl = cl[:clp.Len] + } + if len(data) > 0 { + retData = data[:datap.Len] + } + return retCl, retData, flags, nil +} + +func IoctlSetIntRetInt(fd int, req uint, arg int) (int, error) { + return ioctlRet(fd, req, uintptr(arg)) +} + +func IoctlSetString(fd int, req uint, val string) error { + bs := make([]byte, len(val)+1) + copy(bs[:len(bs)-1], val) + err := ioctl(fd, req, uintptr(unsafe.Pointer(&bs[0]))) + runtime.KeepAlive(&bs[0]) + return err +} + +// Lifreq Helpers + +func (l *Lifreq) SetName(name string) error { + if len(name) >= len(l.Name) { + return fmt.Errorf("name cannot be more than %d characters", len(l.Name)-1) + } + for i := range name { + l.Name[i] = int8(name[i]) + } + return nil +} + +func (l *Lifreq) SetLifruInt(d int) { + *(*int)(unsafe.Pointer(&l.Lifru[0])) = d +} + +func (l *Lifreq) GetLifruInt() int { + return *(*int)(unsafe.Pointer(&l.Lifru[0])) +} + +func (l *Lifreq) SetLifruUint(d uint) { + *(*uint)(unsafe.Pointer(&l.Lifru[0])) = d +} + +func (l *Lifreq) GetLifruUint() uint { + return *(*uint)(unsafe.Pointer(&l.Lifru[0])) +} + +func IoctlLifreq(fd int, req uint, l *Lifreq) error { + return ioctl(fd, req, uintptr(unsafe.Pointer(l))) +} + +// Strioctl Helpers + +func (s *Strioctl) SetInt(i int) { + s.Len = int32(unsafe.Sizeof(i)) + s.Dp = (*int8)(unsafe.Pointer(&i)) +} + +func IoctlSetStrioctlRetInt(fd int, req uint, s *Strioctl) (int, error) { + return ioctlRet(fd, req, uintptr(unsafe.Pointer(s))) } diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index 70508afc1d1c..a386f8897df3 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -13,8 +13,6 @@ import ( "sync" "syscall" "unsafe" - - "golang.org/x/sys/internal/unsafeheader" ) var ( @@ -117,11 +115,7 @@ func (m *mmapper) Mmap(fd int, offset int64, length int, prot int, flags int) (d } // Use unsafe to convert addr into a []byte. - var b []byte - hdr := (*unsafeheader.Slice)(unsafe.Pointer(&b)) - hdr.Data = unsafe.Pointer(addr) - hdr.Cap = length - hdr.Len = length + b := unsafe.Slice((*byte)(unsafe.Pointer(addr)), length) // Register mapping in m and return it. p := &b[cap(b)-1] @@ -337,9 +331,27 @@ func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) { return } +// Recvmsg receives a message from a socket using the recvmsg system call. The +// received non-control data will be written to p, and any "out of band" +// control data will be written to oob. The flags are passed to recvmsg. +// +// The results are: +// - n is the number of non-control data bytes read into p +// - oobn is the number of control data bytes read into oob; this may be interpreted using [ParseSocketControlMessage] +// - recvflags is flags returned by recvmsg +// - from is the address of the sender +// +// If the underlying socket type is not SOCK_DGRAM, a received message +// containing oob data and a single '\0' of non-control data is treated as if +// the message contained only control data, i.e. n will be zero on return. func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) { + var iov [1]Iovec + if len(p) > 0 { + iov[0].Base = &p[0] + iov[0].SetLen(len(p)) + } var rsa RawSockaddrAny - n, oobn, recvflags, err = recvmsgRaw(fd, p, oob, flags, &rsa) + n, oobn, recvflags, err = recvmsgRaw(fd, iov[:], oob, flags, &rsa) // source address is only specified if the socket is unconnected if rsa.Addr.Family != AF_UNSPEC { from, err = anyToSockaddr(fd, &rsa) @@ -347,12 +359,65 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from return } +// RecvmsgBuffers receives a message from a socket using the recvmsg system +// call. This function is equivalent to Recvmsg, but non-control data read is +// scattered into the buffers slices. +func RecvmsgBuffers(fd int, buffers [][]byte, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) { + iov := make([]Iovec, len(buffers)) + for i := range buffers { + if len(buffers[i]) > 0 { + iov[i].Base = &buffers[i][0] + iov[i].SetLen(len(buffers[i])) + } else { + iov[i].Base = (*byte)(unsafe.Pointer(&_zero)) + } + } + var rsa RawSockaddrAny + n, oobn, recvflags, err = recvmsgRaw(fd, iov, oob, flags, &rsa) + if err == nil && rsa.Addr.Family != AF_UNSPEC { + from, err = anyToSockaddr(fd, &rsa) + } + return +} + +// Sendmsg sends a message on a socket to an address using the sendmsg system +// call. This function is equivalent to SendmsgN, but does not return the +// number of bytes actually sent. func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) { _, err = SendmsgN(fd, p, oob, to, flags) return } +// SendmsgN sends a message on a socket to an address using the sendmsg system +// call. p contains the non-control data to send, and oob contains the "out of +// band" control data. The flags are passed to sendmsg. The number of +// non-control bytes actually written to the socket is returned. +// +// Some socket types do not support sending control data without accompanying +// non-control data. If p is empty, and oob contains control data, and the +// underlying socket type is not SOCK_DGRAM, p will be treated as containing a +// single '\0' and the return value will indicate zero bytes sent. +// +// The Go function Recvmsg, if called with an empty p and a non-empty oob, +// will read and ignore this additional '\0'. If the message is received by +// code that does not use Recvmsg, or that does not use Go at all, that code +// will need to be written to expect and ignore the additional '\0'. +// +// If you need to send non-empty oob with p actually empty, and if the +// underlying socket type supports it, you can do so via a raw system call as +// follows: +// +// msg := &unix.Msghdr{ +// Control: &oob[0], +// } +// msg.SetControllen(len(oob)) +// n, _, errno := unix.Syscall(unix.SYS_SENDMSG, uintptr(fd), uintptr(unsafe.Pointer(msg)), flags) func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) { + var iov [1]Iovec + if len(p) > 0 { + iov[0].Base = &p[0] + iov[0].SetLen(len(p)) + } var ptr unsafe.Pointer var salen _Socklen if to != nil { @@ -361,7 +426,31 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) return 0, err } } - return sendmsgN(fd, p, oob, ptr, salen, flags) + return sendmsgN(fd, iov[:], oob, ptr, salen, flags) +} + +// SendmsgBuffers sends a message on a socket to an address using the sendmsg +// system call. This function is equivalent to SendmsgN, but the non-control +// data is gathered from buffers. +func SendmsgBuffers(fd int, buffers [][]byte, oob []byte, to Sockaddr, flags int) (n int, err error) { + iov := make([]Iovec, len(buffers)) + for i := range buffers { + if len(buffers[i]) > 0 { + iov[i].Base = &buffers[i][0] + iov[i].SetLen(len(buffers[i])) + } else { + iov[i].Base = (*byte)(unsafe.Pointer(&_zero)) + } + } + var ptr unsafe.Pointer + var salen _Socklen + if to != nil { + ptr, salen, err = to.sockaddr() + if err != nil { + return 0, err + } + } + return sendmsgN(fd, iov, oob, ptr, salen, flags) } func Send(s int, buf []byte, flags int) (err error) { @@ -369,11 +458,15 @@ func Send(s int, buf []byte, flags int) (err error) { } func Sendto(fd int, p []byte, flags int, to Sockaddr) (err error) { - ptr, n, err := to.sockaddr() - if err != nil { - return err + var ptr unsafe.Pointer + var salen _Socklen + if to != nil { + ptr, salen, err = to.sockaddr() + if err != nil { + return err + } } - return sendto(fd, p, flags, ptr, n) + return sendto(fd, p, flags, ptr, salen) } func SetsockoptByte(fd, level, opt int, value byte) (err error) { @@ -484,3 +577,13 @@ func Lutimes(path string, tv []Timeval) error { } return UtimesNanoAt(AT_FDCWD, path, ts, AT_SYMLINK_NOFOLLOW) } + +// emptyIovec reports whether there are no bytes in the slice of Iovec. +func emptyIovecs(iov []Iovec) bool { + for i := range iov { + if iov[i].Len > 0 { + return false + } + } + return true +} diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go index 5898e9a52b75..b6919ca580e7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go @@ -2,11 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build (darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && gc && !ppc64le && !ppc64 -// +build darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build (darwin || dragonfly || freebsd || (linux && !ppc64 && !ppc64le) || netbsd || openbsd || solaris) && gc +// +build darwin dragonfly freebsd linux,!ppc64,!ppc64le netbsd openbsd solaris // +build gc -// +build !ppc64le -// +build !ppc64 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go index f8616f454ec6..68b2f3e1cd0a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go @@ -9,8 +9,10 @@ package unix import ( "bytes" + "fmt" "runtime" "sort" + "strings" "sync" "syscall" "unsafe" @@ -55,7 +57,13 @@ func (d *Dirent) NameString() string { if d == nil { return "" } - return string(d.Name[:d.Namlen]) + s := string(d.Name[:]) + idx := strings.IndexByte(s, 0) + if idx == -1 { + return s + } else { + return s[:idx] + } } func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) { @@ -1230,6 +1238,14 @@ func Readdir(dir uintptr) (*Dirent, error) { return &ent, err } +func readdir_r(dirp uintptr, entry *direntLE, result **direntLE) (err error) { + r0, _, e1 := syscall_syscall(SYS___READDIR_R_A, dirp, uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) + if int64(r0) == -1 { + err = errnoErr(Errno(e1)) + } + return +} + func Closedir(dir uintptr) error { _, _, e := syscall_syscall(SYS_CLOSEDIR, dir, 0, 0) if e != 0 { @@ -1821,3 +1837,158 @@ func Unmount(name string, mtm int) (err error) { } return err } + +func fdToPath(dirfd int) (path string, err error) { + var buffer [1024]byte + // w_ctrl() + ret := runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS_W_IOCTL<<4, + []uintptr{uintptr(dirfd), 17, 1024, uintptr(unsafe.Pointer(&buffer[0]))}) + if ret == 0 { + zb := bytes.IndexByte(buffer[:], 0) + if zb == -1 { + zb = len(buffer) + } + // __e2a_l() + runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS___E2A_L<<4, + []uintptr{uintptr(unsafe.Pointer(&buffer[0])), uintptr(zb)}) + return string(buffer[:zb]), nil + } + // __errno() + errno := int(*(*int32)(unsafe.Pointer(runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS___ERRNO<<4, + []uintptr{})))) + // __errno2() + errno2 := int(runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS___ERRNO2<<4, + []uintptr{})) + // strerror_r() + ret = runtime.CallLeFuncByPtr(runtime.XplinkLibvec+SYS_STRERROR_R<<4, + []uintptr{uintptr(errno), uintptr(unsafe.Pointer(&buffer[0])), 1024}) + if ret == 0 { + zb := bytes.IndexByte(buffer[:], 0) + if zb == -1 { + zb = len(buffer) + } + return "", fmt.Errorf("%s (errno2=0x%x)", buffer[:zb], errno2) + } else { + return "", fmt.Errorf("fdToPath errno %d (errno2=0x%x)", errno, errno2) + } +} + +func direntLeToDirentUnix(dirent *direntLE, dir uintptr, path string) (Dirent, error) { + var d Dirent + + d.Ino = uint64(dirent.Ino) + offset, err := Telldir(dir) + if err != nil { + return d, err + } + + d.Off = int64(offset) + s := string(bytes.Split(dirent.Name[:], []byte{0})[0]) + copy(d.Name[:], s) + + d.Reclen = uint16(24 + len(d.NameString())) + var st Stat_t + path = path + "/" + s + err = Lstat(path, &st) + if err != nil { + return d, err + } + + d.Type = uint8(st.Mode >> 24) + return d, err +} + +func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { + // Simulation of Getdirentries port from the Darwin implementation. + // COMMENTS FROM DARWIN: + // It's not the full required semantics, but should handle the case + // of calling Getdirentries or ReadDirent repeatedly. + // It won't handle assigning the results of lseek to *basep, or handle + // the directory being edited underfoot. + + skip, err := Seek(fd, 0, 1 /* SEEK_CUR */) + if err != nil { + return 0, err + } + + // Get path from fd to avoid unavailable call (fdopendir) + path, err := fdToPath(fd) + if err != nil { + return 0, err + } + d, err := Opendir(path) + if err != nil { + return 0, err + } + defer Closedir(d) + + var cnt int64 + for { + var entryLE direntLE + var entrypLE *direntLE + e := readdir_r(d, &entryLE, &entrypLE) + if e != nil { + return n, e + } + if entrypLE == nil { + break + } + if skip > 0 { + skip-- + cnt++ + continue + } + + // Dirent on zos has a different structure + entry, e := direntLeToDirentUnix(&entryLE, d, path) + if e != nil { + return n, e + } + + reclen := int(entry.Reclen) + if reclen > len(buf) { + // Not enough room. Return for now. + // The counter will let us know where we should start up again. + // Note: this strategy for suspending in the middle and + // restarting is O(n^2) in the length of the directory. Oh well. + break + } + + // Copy entry into return buffer. + s := unsafe.Slice((*byte)(unsafe.Pointer(&entry)), reclen) + copy(buf, s) + + buf = buf[reclen:] + n += reclen + cnt++ + } + // Set the seek offset of the input fd to record + // how many files we've already returned. + _, err = Seek(fd, cnt, 0 /* SEEK_SET */) + if err != nil { + return n, err + } + + return n, nil +} + +func ReadDirent(fd int, buf []byte) (n int, err error) { + var base = (*uintptr)(unsafe.Pointer(new(uint64))) + return Getdirentries(fd, buf, base) +} + +func direntIno(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) +} + +func direntReclen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) +} + +func direntNamlen(buf []byte) (uint64, bool) { + reclen, ok := direntReclen(buf) + if !ok { + return 0, false + } + return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true +} diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix.go b/vendor/golang.org/x/sys/unix/sysvshm_unix.go index 0bb4c8de557b..5bb41d17bc47 100644 --- a/vendor/golang.org/x/sys/unix/sysvshm_unix.go +++ b/vendor/golang.org/x/sys/unix/sysvshm_unix.go @@ -7,11 +7,7 @@ package unix -import ( - "unsafe" - - "golang.org/x/sys/internal/unsafeheader" -) +import "unsafe" // SysvShmAttach attaches the Sysv shared memory segment associated with the // shared memory identifier id. @@ -34,12 +30,7 @@ func SysvShmAttach(id int, addr uintptr, flag int) ([]byte, error) { } // Use unsafe to convert addr into a []byte. - // TODO: convert to unsafe.Slice once we can assume Go 1.17 - var b []byte - hdr := (*unsafeheader.Slice)(unsafe.Pointer(&b)) - hdr.Data = unsafe.Pointer(addr) - hdr.Cap = int(info.Segsz) - hdr.Len = int(info.Segsz) + b := unsafe.Slice((*byte)(unsafe.Pointer(addr)), int(info.Segsz)) return b, nil } diff --git a/vendor/golang.org/x/sys/unix/xattr_bsd.go b/vendor/golang.org/x/sys/unix/xattr_bsd.go index 25df1e37801f..663b3779de2d 100644 --- a/vendor/golang.org/x/sys/unix/xattr_bsd.go +++ b/vendor/golang.org/x/sys/unix/xattr_bsd.go @@ -160,13 +160,12 @@ func Lremovexattr(link string, attr string) (err error) { } func Listxattr(file string, dest []byte) (sz int, err error) { - d := initxattrdest(dest, 0) destsiz := len(dest) // FreeBSD won't allow you to list xattrs from multiple namespaces - s := 0 + s, pos := 0, 0 for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} { - stmp, e := ExtattrListFile(file, nsid, uintptr(d), destsiz) + stmp, e := ListxattrNS(file, nsid, dest[pos:]) /* Errors accessing system attrs are ignored so that * we can implement the Linux-like behavior of omitting errors that @@ -175,66 +174,102 @@ func Listxattr(file string, dest []byte) (sz int, err error) { * Linux will still error if we ask for user attributes on a file that * we don't have read permissions on, so don't ignore those errors */ - if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER { - continue - } else if e != nil { + if e != nil { + if e == EPERM && nsid != EXTATTR_NAMESPACE_USER { + continue + } return s, e } s += stmp - destsiz -= s - if destsiz < 0 { - destsiz = 0 + pos = s + if pos > destsiz { + pos = destsiz } - d = initxattrdest(dest, s) } return s, nil } -func Flistxattr(fd int, dest []byte) (sz int, err error) { +func ListxattrNS(file string, nsid int, dest []byte) (sz int, err error) { d := initxattrdest(dest, 0) destsiz := len(dest) - s := 0 + s, e := ExtattrListFile(file, nsid, uintptr(d), destsiz) + if e != nil { + return 0, err + } + + return s, nil +} + +func Flistxattr(fd int, dest []byte) (sz int, err error) { + destsiz := len(dest) + + s, pos := 0, 0 for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} { - stmp, e := ExtattrListFd(fd, nsid, uintptr(d), destsiz) - if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER { - continue - } else if e != nil { + stmp, e := FlistxattrNS(fd, nsid, dest[pos:]) + + if e != nil { + if e == EPERM && nsid != EXTATTR_NAMESPACE_USER { + continue + } return s, e } s += stmp - destsiz -= s - if destsiz < 0 { - destsiz = 0 + pos = s + if pos > destsiz { + pos = destsiz } - d = initxattrdest(dest, s) } return s, nil } -func Llistxattr(link string, dest []byte) (sz int, err error) { +func FlistxattrNS(fd int, nsid int, dest []byte) (sz int, err error) { d := initxattrdest(dest, 0) destsiz := len(dest) - s := 0 + s, e := ExtattrListFd(fd, nsid, uintptr(d), destsiz) + if e != nil { + return 0, err + } + + return s, nil +} + +func Llistxattr(link string, dest []byte) (sz int, err error) { + destsiz := len(dest) + + s, pos := 0, 0 for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} { - stmp, e := ExtattrListLink(link, nsid, uintptr(d), destsiz) - if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER { - continue - } else if e != nil { + stmp, e := LlistxattrNS(link, nsid, dest[pos:]) + + if e != nil { + if e == EPERM && nsid != EXTATTR_NAMESPACE_USER { + continue + } return s, e } s += stmp - destsiz -= s - if destsiz < 0 { - destsiz = 0 + pos = s + if pos > destsiz { + pos = destsiz } - d = initxattrdest(dest, s) + } + + return s, nil +} + +func LlistxattrNS(link string, nsid int, dest []byte) (sz int, err error) { + d := initxattrdest(dest, 0) + destsiz := len(dest) + + s, e := ExtattrListLink(link, nsid, uintptr(d), destsiz) + if e != nil { + return 0, err } return s, nil diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go index 440900112cd4..f8c2c5138748 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go @@ -151,6 +151,7 @@ const ( BIOCSETF = 0x80084267 BIOCSETFNR = 0x80084282 BIOCSETIF = 0x8020426c + BIOCSETVLANPCP = 0x80044285 BIOCSETWF = 0x8008427b BIOCSETZBUF = 0x800c4281 BIOCSHDRCMPLT = 0x80044275 @@ -447,7 +448,7 @@ const ( DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 DLT_INFINIBAND = 0xf7 DLT_IPFILTER = 0x74 - DLT_IPMB = 0xc7 + DLT_IPMB_KONTRON = 0xc7 DLT_IPMB_LINUX = 0xd1 DLT_IPMI_HPM_2 = 0x104 DLT_IPNET = 0xe2 @@ -487,10 +488,11 @@ const ( DLT_LINUX_LAPD = 0xb1 DLT_LINUX_PPP_WITHDIRECTION = 0xa6 DLT_LINUX_SLL = 0x71 + DLT_LINUX_SLL2 = 0x114 DLT_LOOP = 0x6c DLT_LORATAP = 0x10e DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0x113 + DLT_MATCHING_MAX = 0x114 DLT_MATCHING_MIN = 0x68 DLT_MFR = 0xb6 DLT_MOST = 0xd3 @@ -734,6 +736,7 @@ const ( IPPROTO_CMTP = 0x26 IPPROTO_CPHB = 0x49 IPPROTO_CPNX = 0x48 + IPPROTO_DCCP = 0x21 IPPROTO_DDP = 0x25 IPPROTO_DGP = 0x56 IPPROTO_DIVERT = 0x102 @@ -814,7 +817,6 @@ const ( IPPROTO_SCTP = 0x84 IPPROTO_SDRP = 0x2a IPPROTO_SEND = 0x103 - IPPROTO_SEP = 0x21 IPPROTO_SHIM6 = 0x8c IPPROTO_SKIP = 0x39 IPPROTO_SPACER = 0x7fff @@ -911,6 +913,7 @@ const ( IPV6_V6ONLY = 0x1b IPV6_VERSION = 0x60 IPV6_VERSION_MASK = 0xf0 + IPV6_VLAN_PCP = 0x4b IP_ADD_MEMBERSHIP = 0xc IP_ADD_SOURCE_MEMBERSHIP = 0x46 IP_BINDANY = 0x18 @@ -989,8 +992,12 @@ const ( IP_TOS = 0x3 IP_TTL = 0x4 IP_UNBLOCK_SOURCE = 0x49 + IP_VLAN_PCP = 0x4b ISIG = 0x80 ISTRIP = 0x20 + ITIMER_PROF = 0x2 + ITIMER_REAL = 0x0 + ITIMER_VIRTUAL = 0x1 IXANY = 0x800 IXOFF = 0x400 IXON = 0x200 @@ -1000,7 +1007,6 @@ const ( KERN_VERSION = 0x4 LOCAL_CONNWAIT = 0x4 LOCAL_CREDS = 0x2 - LOCAL_CREDS_PERSISTENT = 0x3 LOCAL_PEERCRED = 0x1 LOCAL_VENDOR = 0x80000000 LOCK_EX = 0x2 @@ -1179,6 +1185,8 @@ const ( O_NONBLOCK = 0x4 O_RDONLY = 0x0 O_RDWR = 0x2 + O_RESOLVE_BENEATH = 0x800000 + O_SEARCH = 0x40000 O_SHLOCK = 0x10 O_SYNC = 0x80 O_TRUNC = 0x400 @@ -1189,6 +1197,10 @@ const ( PARMRK = 0x8 PARODD = 0x2000 PENDIN = 0x20000000 + PIOD_READ_D = 0x1 + PIOD_READ_I = 0x3 + PIOD_WRITE_D = 0x2 + PIOD_WRITE_I = 0x4 PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1196,6 +1208,60 @@ const ( PROT_NONE = 0x0 PROT_READ = 0x1 PROT_WRITE = 0x2 + PTRACE_DEFAULT = 0x1 + PTRACE_EXEC = 0x1 + PTRACE_FORK = 0x8 + PTRACE_LWP = 0x10 + PTRACE_SCE = 0x2 + PTRACE_SCX = 0x4 + PTRACE_SYSCALL = 0x6 + PTRACE_VFORK = 0x20 + PT_ATTACH = 0xa + PT_CLEARSTEP = 0x10 + PT_CONTINUE = 0x7 + PT_DETACH = 0xb + PT_FIRSTMACH = 0x40 + PT_FOLLOW_FORK = 0x17 + PT_GETDBREGS = 0x25 + PT_GETFPREGS = 0x23 + PT_GETFSBASE = 0x47 + PT_GETGSBASE = 0x49 + PT_GETLWPLIST = 0xf + PT_GETNUMLWPS = 0xe + PT_GETREGS = 0x21 + PT_GETXMMREGS = 0x40 + PT_GETXSTATE = 0x45 + PT_GETXSTATE_INFO = 0x44 + PT_GET_EVENT_MASK = 0x19 + PT_GET_SC_ARGS = 0x1b + PT_GET_SC_RET = 0x1c + PT_IO = 0xc + PT_KILL = 0x8 + PT_LWPINFO = 0xd + PT_LWP_EVENTS = 0x18 + PT_READ_D = 0x2 + PT_READ_I = 0x1 + PT_RESUME = 0x13 + PT_SETDBREGS = 0x26 + PT_SETFPREGS = 0x24 + PT_SETFSBASE = 0x48 + PT_SETGSBASE = 0x4a + PT_SETREGS = 0x22 + PT_SETSTEP = 0x11 + PT_SETXMMREGS = 0x41 + PT_SETXSTATE = 0x46 + PT_SET_EVENT_MASK = 0x1a + PT_STEP = 0x9 + PT_SUSPEND = 0x12 + PT_SYSCALL = 0x16 + PT_TO_SCE = 0x14 + PT_TO_SCX = 0x15 + PT_TRACE_ME = 0x0 + PT_VM_ENTRY = 0x29 + PT_VM_TIMESTAMP = 0x28 + PT_WRITE_D = 0x5 + PT_WRITE_I = 0x4 + P_ZONEID = 0xc RLIMIT_AS = 0xa RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 @@ -1320,10 +1386,12 @@ const ( SIOCGHWADDR = 0xc020693e SIOCGI2C = 0xc020693d SIOCGIFADDR = 0xc0206921 + SIOCGIFALIAS = 0xc044692d SIOCGIFBRDADDR = 0xc0206923 SIOCGIFCAP = 0xc020691f SIOCGIFCONF = 0xc0086924 SIOCGIFDESCR = 0xc020692a + SIOCGIFDOWNREASON = 0xc058699a SIOCGIFDSTADDR = 0xc0206922 SIOCGIFFIB = 0xc020695c SIOCGIFFLAGS = 0xc0206911 @@ -1414,6 +1482,7 @@ const ( SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 + SO_RERROR = 0x20000 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_REUSEPORT_LB = 0x10000 @@ -1472,22 +1541,40 @@ const ( TCOFLUSH = 0x2 TCOOFF = 0x1 TCOON = 0x2 + TCPOPT_EOL = 0x0 + TCPOPT_FAST_OPEN = 0x22 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_PAD = 0x0 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_WINDOW = 0x3 TCP_BBR_ACK_COMP_ALG = 0x448 + TCP_BBR_ALGORITHM = 0x43b TCP_BBR_DRAIN_INC_EXTRA = 0x43c TCP_BBR_DRAIN_PG = 0x42e TCP_BBR_EXTRA_GAIN = 0x449 + TCP_BBR_EXTRA_STATE = 0x453 + TCP_BBR_FLOOR_MIN_TSO = 0x454 + TCP_BBR_HDWR_PACE = 0x451 + TCP_BBR_HOLD_TARGET = 0x436 TCP_BBR_IWINTSO = 0x42b TCP_BBR_LOWGAIN_FD = 0x436 TCP_BBR_LOWGAIN_HALF = 0x435 TCP_BBR_LOWGAIN_THRESH = 0x434 TCP_BBR_MAX_RTO = 0x439 TCP_BBR_MIN_RTO = 0x438 + TCP_BBR_MIN_TOPACEOUT = 0x455 TCP_BBR_ONE_RETRAN = 0x431 TCP_BBR_PACE_CROSS = 0x442 TCP_BBR_PACE_DEL_TAR = 0x43f + TCP_BBR_PACE_OH = 0x435 TCP_BBR_PACE_PER_SEC = 0x43e TCP_BBR_PACE_SEG_MAX = 0x440 TCP_BBR_PACE_SEG_MIN = 0x441 + TCP_BBR_POLICER_DETECT = 0x457 TCP_BBR_PROBE_RTT_GAIN = 0x44d TCP_BBR_PROBE_RTT_INT = 0x430 TCP_BBR_PROBE_RTT_LEN = 0x44e @@ -1496,12 +1583,18 @@ const ( TCP_BBR_REC_OVER_HPTS = 0x43a TCP_BBR_RETRAN_WTSO = 0x44b TCP_BBR_RWND_IS_APP = 0x42f + TCP_BBR_SEND_IWND_IN_TSO = 0x44f TCP_BBR_STARTUP_EXIT_EPOCH = 0x43d TCP_BBR_STARTUP_LOSS_EXIT = 0x432 TCP_BBR_STARTUP_PG = 0x42d + TCP_BBR_TMR_PACE_OH = 0x448 + TCP_BBR_TSLIMITS = 0x434 + TCP_BBR_TSTMP_RAISES = 0x456 TCP_BBR_UNLIMITED = 0x43b TCP_BBR_USEDEL_RATE = 0x437 TCP_BBR_USE_LOWGAIN = 0x433 + TCP_BBR_USE_RACK_CHEAT = 0x450 + TCP_BBR_UTTER_MAX_TSO = 0x452 TCP_CA_NAME_MAX = 0x10 TCP_CCALGOOPT = 0x41 TCP_CONGESTION = 0x40 @@ -1541,6 +1634,7 @@ const ( TCP_PCAP_OUT = 0x800 TCP_RACK_EARLY_RECOV = 0x423 TCP_RACK_EARLY_SEG = 0x424 + TCP_RACK_GP_INCREASE = 0x446 TCP_RACK_IDLE_REDUCE_HIGH = 0x444 TCP_RACK_MIN_PACE = 0x445 TCP_RACK_MIN_PACE_SEG = 0x446 @@ -1554,7 +1648,6 @@ const ( TCP_RACK_PRR_SENDALOT = 0x421 TCP_RACK_REORD_FADE = 0x426 TCP_RACK_REORD_THRESH = 0x425 - TCP_RACK_SESS_CWV = 0x42a TCP_RACK_TLP_INC_VAR = 0x429 TCP_RACK_TLP_REDUCE = 0x41c TCP_RACK_TLP_THRESH = 0x427 @@ -1694,12 +1787,13 @@ const ( EIDRM = syscall.Errno(0x52) EILSEQ = syscall.Errno(0x56) EINPROGRESS = syscall.Errno(0x24) + EINTEGRITY = syscall.Errno(0x61) EINTR = syscall.Errno(0x4) EINVAL = syscall.Errno(0x16) EIO = syscall.Errno(0x5) EISCONN = syscall.Errno(0x38) EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x60) + ELAST = syscall.Errno(0x61) ELOOP = syscall.Errno(0x3e) EMFILE = syscall.Errno(0x18) EMLINK = syscall.Errno(0x1f) @@ -1842,7 +1936,7 @@ var errorList = [...]struct { {32, "EPIPE", "broken pipe"}, {33, "EDOM", "numerical argument out of domain"}, {34, "ERANGE", "result too large"}, - {35, "EAGAIN", "resource temporarily unavailable"}, + {35, "EWOULDBLOCK", "resource temporarily unavailable"}, {36, "EINPROGRESS", "operation now in progress"}, {37, "EALREADY", "operation already in progress"}, {38, "ENOTSOCK", "socket operation on non-socket"}, @@ -1904,6 +1998,7 @@ var errorList = [...]struct { {94, "ECAPMODE", "not permitted in capability mode"}, {95, "ENOTRECOVERABLE", "state not recoverable"}, {96, "EOWNERDEAD", "previous owner died"}, + {97, "EINTEGRITY", "integrity check failed"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go index 64520d31226b..96310c3be1b0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go @@ -151,6 +151,7 @@ const ( BIOCSETF = 0x80104267 BIOCSETFNR = 0x80104282 BIOCSETIF = 0x8020426c + BIOCSETVLANPCP = 0x80044285 BIOCSETWF = 0x8010427b BIOCSETZBUF = 0x80184281 BIOCSHDRCMPLT = 0x80044275 @@ -447,7 +448,7 @@ const ( DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 DLT_INFINIBAND = 0xf7 DLT_IPFILTER = 0x74 - DLT_IPMB = 0xc7 + DLT_IPMB_KONTRON = 0xc7 DLT_IPMB_LINUX = 0xd1 DLT_IPMI_HPM_2 = 0x104 DLT_IPNET = 0xe2 @@ -487,10 +488,11 @@ const ( DLT_LINUX_LAPD = 0xb1 DLT_LINUX_PPP_WITHDIRECTION = 0xa6 DLT_LINUX_SLL = 0x71 + DLT_LINUX_SLL2 = 0x114 DLT_LOOP = 0x6c DLT_LORATAP = 0x10e DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0x113 + DLT_MATCHING_MAX = 0x114 DLT_MATCHING_MIN = 0x68 DLT_MFR = 0xb6 DLT_MOST = 0xd3 @@ -734,6 +736,7 @@ const ( IPPROTO_CMTP = 0x26 IPPROTO_CPHB = 0x49 IPPROTO_CPNX = 0x48 + IPPROTO_DCCP = 0x21 IPPROTO_DDP = 0x25 IPPROTO_DGP = 0x56 IPPROTO_DIVERT = 0x102 @@ -814,7 +817,6 @@ const ( IPPROTO_SCTP = 0x84 IPPROTO_SDRP = 0x2a IPPROTO_SEND = 0x103 - IPPROTO_SEP = 0x21 IPPROTO_SHIM6 = 0x8c IPPROTO_SKIP = 0x39 IPPROTO_SPACER = 0x7fff @@ -911,6 +913,7 @@ const ( IPV6_V6ONLY = 0x1b IPV6_VERSION = 0x60 IPV6_VERSION_MASK = 0xf0 + IPV6_VLAN_PCP = 0x4b IP_ADD_MEMBERSHIP = 0xc IP_ADD_SOURCE_MEMBERSHIP = 0x46 IP_BINDANY = 0x18 @@ -989,8 +992,12 @@ const ( IP_TOS = 0x3 IP_TTL = 0x4 IP_UNBLOCK_SOURCE = 0x49 + IP_VLAN_PCP = 0x4b ISIG = 0x80 ISTRIP = 0x20 + ITIMER_PROF = 0x2 + ITIMER_REAL = 0x0 + ITIMER_VIRTUAL = 0x1 IXANY = 0x800 IXOFF = 0x400 IXON = 0x200 @@ -1000,7 +1007,6 @@ const ( KERN_VERSION = 0x4 LOCAL_CONNWAIT = 0x4 LOCAL_CREDS = 0x2 - LOCAL_CREDS_PERSISTENT = 0x3 LOCAL_PEERCRED = 0x1 LOCAL_VENDOR = 0x80000000 LOCK_EX = 0x2 @@ -1180,6 +1186,8 @@ const ( O_NONBLOCK = 0x4 O_RDONLY = 0x0 O_RDWR = 0x2 + O_RESOLVE_BENEATH = 0x800000 + O_SEARCH = 0x40000 O_SHLOCK = 0x10 O_SYNC = 0x80 O_TRUNC = 0x400 @@ -1190,6 +1198,10 @@ const ( PARMRK = 0x8 PARODD = 0x2000 PENDIN = 0x20000000 + PIOD_READ_D = 0x1 + PIOD_READ_I = 0x3 + PIOD_WRITE_D = 0x2 + PIOD_WRITE_I = 0x4 PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1197,6 +1209,58 @@ const ( PROT_NONE = 0x0 PROT_READ = 0x1 PROT_WRITE = 0x2 + PTRACE_DEFAULT = 0x1 + PTRACE_EXEC = 0x1 + PTRACE_FORK = 0x8 + PTRACE_LWP = 0x10 + PTRACE_SCE = 0x2 + PTRACE_SCX = 0x4 + PTRACE_SYSCALL = 0x6 + PTRACE_VFORK = 0x20 + PT_ATTACH = 0xa + PT_CLEARSTEP = 0x10 + PT_CONTINUE = 0x7 + PT_DETACH = 0xb + PT_FIRSTMACH = 0x40 + PT_FOLLOW_FORK = 0x17 + PT_GETDBREGS = 0x25 + PT_GETFPREGS = 0x23 + PT_GETFSBASE = 0x47 + PT_GETGSBASE = 0x49 + PT_GETLWPLIST = 0xf + PT_GETNUMLWPS = 0xe + PT_GETREGS = 0x21 + PT_GETXSTATE = 0x45 + PT_GETXSTATE_INFO = 0x44 + PT_GET_EVENT_MASK = 0x19 + PT_GET_SC_ARGS = 0x1b + PT_GET_SC_RET = 0x1c + PT_IO = 0xc + PT_KILL = 0x8 + PT_LWPINFO = 0xd + PT_LWP_EVENTS = 0x18 + PT_READ_D = 0x2 + PT_READ_I = 0x1 + PT_RESUME = 0x13 + PT_SETDBREGS = 0x26 + PT_SETFPREGS = 0x24 + PT_SETFSBASE = 0x48 + PT_SETGSBASE = 0x4a + PT_SETREGS = 0x22 + PT_SETSTEP = 0x11 + PT_SETXSTATE = 0x46 + PT_SET_EVENT_MASK = 0x1a + PT_STEP = 0x9 + PT_SUSPEND = 0x12 + PT_SYSCALL = 0x16 + PT_TO_SCE = 0x14 + PT_TO_SCX = 0x15 + PT_TRACE_ME = 0x0 + PT_VM_ENTRY = 0x29 + PT_VM_TIMESTAMP = 0x28 + PT_WRITE_D = 0x5 + PT_WRITE_I = 0x4 + P_ZONEID = 0xc RLIMIT_AS = 0xa RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 @@ -1321,10 +1385,12 @@ const ( SIOCGHWADDR = 0xc020693e SIOCGI2C = 0xc020693d SIOCGIFADDR = 0xc0206921 + SIOCGIFALIAS = 0xc044692d SIOCGIFBRDADDR = 0xc0206923 SIOCGIFCAP = 0xc020691f SIOCGIFCONF = 0xc0106924 SIOCGIFDESCR = 0xc020692a + SIOCGIFDOWNREASON = 0xc058699a SIOCGIFDSTADDR = 0xc0206922 SIOCGIFFIB = 0xc020695c SIOCGIFFLAGS = 0xc0206911 @@ -1415,6 +1481,7 @@ const ( SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 + SO_RERROR = 0x20000 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_REUSEPORT_LB = 0x10000 @@ -1473,22 +1540,40 @@ const ( TCOFLUSH = 0x2 TCOOFF = 0x1 TCOON = 0x2 + TCPOPT_EOL = 0x0 + TCPOPT_FAST_OPEN = 0x22 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_PAD = 0x0 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_WINDOW = 0x3 TCP_BBR_ACK_COMP_ALG = 0x448 + TCP_BBR_ALGORITHM = 0x43b TCP_BBR_DRAIN_INC_EXTRA = 0x43c TCP_BBR_DRAIN_PG = 0x42e TCP_BBR_EXTRA_GAIN = 0x449 + TCP_BBR_EXTRA_STATE = 0x453 + TCP_BBR_FLOOR_MIN_TSO = 0x454 + TCP_BBR_HDWR_PACE = 0x451 + TCP_BBR_HOLD_TARGET = 0x436 TCP_BBR_IWINTSO = 0x42b TCP_BBR_LOWGAIN_FD = 0x436 TCP_BBR_LOWGAIN_HALF = 0x435 TCP_BBR_LOWGAIN_THRESH = 0x434 TCP_BBR_MAX_RTO = 0x439 TCP_BBR_MIN_RTO = 0x438 + TCP_BBR_MIN_TOPACEOUT = 0x455 TCP_BBR_ONE_RETRAN = 0x431 TCP_BBR_PACE_CROSS = 0x442 TCP_BBR_PACE_DEL_TAR = 0x43f + TCP_BBR_PACE_OH = 0x435 TCP_BBR_PACE_PER_SEC = 0x43e TCP_BBR_PACE_SEG_MAX = 0x440 TCP_BBR_PACE_SEG_MIN = 0x441 + TCP_BBR_POLICER_DETECT = 0x457 TCP_BBR_PROBE_RTT_GAIN = 0x44d TCP_BBR_PROBE_RTT_INT = 0x430 TCP_BBR_PROBE_RTT_LEN = 0x44e @@ -1497,12 +1582,18 @@ const ( TCP_BBR_REC_OVER_HPTS = 0x43a TCP_BBR_RETRAN_WTSO = 0x44b TCP_BBR_RWND_IS_APP = 0x42f + TCP_BBR_SEND_IWND_IN_TSO = 0x44f TCP_BBR_STARTUP_EXIT_EPOCH = 0x43d TCP_BBR_STARTUP_LOSS_EXIT = 0x432 TCP_BBR_STARTUP_PG = 0x42d + TCP_BBR_TMR_PACE_OH = 0x448 + TCP_BBR_TSLIMITS = 0x434 + TCP_BBR_TSTMP_RAISES = 0x456 TCP_BBR_UNLIMITED = 0x43b TCP_BBR_USEDEL_RATE = 0x437 TCP_BBR_USE_LOWGAIN = 0x433 + TCP_BBR_USE_RACK_CHEAT = 0x450 + TCP_BBR_UTTER_MAX_TSO = 0x452 TCP_CA_NAME_MAX = 0x10 TCP_CCALGOOPT = 0x41 TCP_CONGESTION = 0x40 @@ -1542,6 +1633,7 @@ const ( TCP_PCAP_OUT = 0x800 TCP_RACK_EARLY_RECOV = 0x423 TCP_RACK_EARLY_SEG = 0x424 + TCP_RACK_GP_INCREASE = 0x446 TCP_RACK_IDLE_REDUCE_HIGH = 0x444 TCP_RACK_MIN_PACE = 0x445 TCP_RACK_MIN_PACE_SEG = 0x446 @@ -1555,7 +1647,6 @@ const ( TCP_RACK_PRR_SENDALOT = 0x421 TCP_RACK_REORD_FADE = 0x426 TCP_RACK_REORD_THRESH = 0x425 - TCP_RACK_SESS_CWV = 0x42a TCP_RACK_TLP_INC_VAR = 0x429 TCP_RACK_TLP_REDUCE = 0x41c TCP_RACK_TLP_THRESH = 0x427 @@ -1693,12 +1784,13 @@ const ( EIDRM = syscall.Errno(0x52) EILSEQ = syscall.Errno(0x56) EINPROGRESS = syscall.Errno(0x24) + EINTEGRITY = syscall.Errno(0x61) EINTR = syscall.Errno(0x4) EINVAL = syscall.Errno(0x16) EIO = syscall.Errno(0x5) EISCONN = syscall.Errno(0x38) EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x60) + ELAST = syscall.Errno(0x61) ELOOP = syscall.Errno(0x3e) EMFILE = syscall.Errno(0x18) EMLINK = syscall.Errno(0x1f) @@ -1841,7 +1933,7 @@ var errorList = [...]struct { {32, "EPIPE", "broken pipe"}, {33, "EDOM", "numerical argument out of domain"}, {34, "ERANGE", "result too large"}, - {35, "EAGAIN", "resource temporarily unavailable"}, + {35, "EWOULDBLOCK", "resource temporarily unavailable"}, {36, "EINPROGRESS", "operation now in progress"}, {37, "EALREADY", "operation already in progress"}, {38, "ENOTSOCK", "socket operation on non-socket"}, @@ -1903,6 +1995,7 @@ var errorList = [...]struct { {94, "ECAPMODE", "not permitted in capability mode"}, {95, "ENOTRECOVERABLE", "state not recoverable"}, {96, "EOWNERDEAD", "previous owner died"}, + {97, "EINTEGRITY", "integrity check failed"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go index 99e9a0e06e95..777b69defa04 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go @@ -151,6 +151,7 @@ const ( BIOCSETF = 0x80084267 BIOCSETFNR = 0x80084282 BIOCSETIF = 0x8020426c + BIOCSETVLANPCP = 0x80044285 BIOCSETWF = 0x8008427b BIOCSETZBUF = 0x800c4281 BIOCSHDRCMPLT = 0x80044275 @@ -362,7 +363,7 @@ const ( CTL_KERN = 0x1 CTL_MAXNAME = 0x18 CTL_NET = 0x4 - DIOCGATTR = 0xc144648e + DIOCGATTR = 0xc148648e DIOCGDELETE = 0x80106488 DIOCGFLUSH = 0x20006487 DIOCGFRONTSTUFF = 0x40086486 @@ -377,7 +378,7 @@ const ( DIOCGSTRIPESIZE = 0x4008648b DIOCSKERNELDUMP = 0x804c6490 DIOCSKERNELDUMP_FREEBSD11 = 0x80046485 - DIOCZONECMD = 0xc06c648f + DIOCZONECMD = 0xc078648f DLT_A429 = 0xb8 DLT_A653_ICM = 0xb9 DLT_AIRONET_HEADER = 0x78 @@ -407,7 +408,9 @@ const ( DLT_C_HDLC_WITH_DIR = 0xcd DLT_DBUS = 0xe7 DLT_DECT = 0xdd + DLT_DISPLAYPORT_AUX = 0x113 DLT_DOCSIS = 0x8f + DLT_DOCSIS31_XRA31 = 0x111 DLT_DVB_CI = 0xeb DLT_ECONET = 0x73 DLT_EN10MB = 0x1 @@ -417,6 +420,7 @@ const ( DLT_ERF = 0xc5 DLT_ERF_ETH = 0xaf DLT_ERF_POS = 0xb0 + DLT_ETHERNET_MPACKET = 0x112 DLT_FC_2 = 0xe0 DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 DLT_FDDI = 0xa @@ -444,7 +448,7 @@ const ( DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 DLT_INFINIBAND = 0xf7 DLT_IPFILTER = 0x74 - DLT_IPMB = 0xc7 + DLT_IPMB_KONTRON = 0xc7 DLT_IPMB_LINUX = 0xd1 DLT_IPMI_HPM_2 = 0x104 DLT_IPNET = 0xe2 @@ -484,9 +488,11 @@ const ( DLT_LINUX_LAPD = 0xb1 DLT_LINUX_PPP_WITHDIRECTION = 0xa6 DLT_LINUX_SLL = 0x71 + DLT_LINUX_SLL2 = 0x114 DLT_LOOP = 0x6c + DLT_LORATAP = 0x10e DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0x109 + DLT_MATCHING_MAX = 0x114 DLT_MATCHING_MIN = 0x68 DLT_MFR = 0xb6 DLT_MOST = 0xd3 @@ -502,7 +508,9 @@ const ( DLT_NFC_LLCP = 0xf5 DLT_NFLOG = 0xef DLT_NG40 = 0xf4 + DLT_NORDIC_BLE = 0x110 DLT_NULL = 0x0 + DLT_OPENFLOW = 0x10b DLT_PCI_EXP = 0x7d DLT_PFLOG = 0x75 DLT_PFSYNC = 0x79 @@ -526,15 +534,18 @@ const ( DLT_RTAC_SERIAL = 0xfa DLT_SCCP = 0x8e DLT_SCTP = 0xf8 + DLT_SDLC = 0x10c DLT_SITA = 0xc4 DLT_SLIP = 0x8 DLT_SLIP_BSDOS = 0xd DLT_STANAG_5066_D_PDU = 0xed DLT_SUNATM = 0x7b DLT_SYMANTEC_FIREWALL = 0x63 + DLT_TI_LLN_SNIFFER = 0x10d DLT_TZSP = 0x80 DLT_USB = 0xba DLT_USBPCAP = 0xf9 + DLT_USB_DARWIN = 0x10a DLT_USB_FREEBSD = 0xba DLT_USB_LINUX = 0xbd DLT_USB_LINUX_MMAPPED = 0xdc @@ -554,6 +565,7 @@ const ( DLT_USER7 = 0x9a DLT_USER8 = 0x9b DLT_USER9 = 0x9c + DLT_VSOCK = 0x10f DLT_WATTSTOPPER_DLM = 0x107 DLT_WIHART = 0xdf DLT_WIRESHARK_UPPER_PDU = 0xfc @@ -578,6 +590,7 @@ const ( ECHONL = 0x10 ECHOPRT = 0x20 EVFILT_AIO = -0x3 + EVFILT_EMPTY = -0xd EVFILT_FS = -0x9 EVFILT_LIO = -0xa EVFILT_PROC = -0x5 @@ -585,11 +598,12 @@ const ( EVFILT_READ = -0x1 EVFILT_SENDFILE = -0xc EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0xc + EVFILT_SYSCOUNT = 0xd EVFILT_TIMER = -0x7 EVFILT_USER = -0xb EVFILT_VNODE = -0x4 EVFILT_WRITE = -0x2 + EVNAMEMAP_NAME_SIZE = 0x40 EV_ADD = 0x1 EV_CLEAR = 0x20 EV_DELETE = 0x2 @@ -606,6 +620,7 @@ const ( EV_RECEIPT = 0x40 EV_SYSFLAGS = 0xf000 EXTA = 0x4b00 + EXTATTR_MAXNAMELEN = 0xff EXTATTR_NAMESPACE_EMPTY = 0x0 EXTATTR_NAMESPACE_SYSTEM = 0x2 EXTATTR_NAMESPACE_USER = 0x1 @@ -647,6 +662,7 @@ const ( IEXTEN = 0x400 IFAN_ARRIVAL = 0x0 IFAN_DEPARTURE = 0x1 + IFCAP_WOL_MAGIC = 0x2000 IFF_ALLMULTI = 0x200 IFF_ALTPHYS = 0x4000 IFF_BROADCAST = 0x2 @@ -663,6 +679,7 @@ const ( IFF_MONITOR = 0x40000 IFF_MULTICAST = 0x8000 IFF_NOARP = 0x80 + IFF_NOGROUP = 0x800000 IFF_OACTIVE = 0x400 IFF_POINTOPOINT = 0x10 IFF_PPROMISC = 0x20000 @@ -719,6 +736,7 @@ const ( IPPROTO_CMTP = 0x26 IPPROTO_CPHB = 0x49 IPPROTO_CPNX = 0x48 + IPPROTO_DCCP = 0x21 IPPROTO_DDP = 0x25 IPPROTO_DGP = 0x56 IPPROTO_DIVERT = 0x102 @@ -799,7 +817,6 @@ const ( IPPROTO_SCTP = 0x84 IPPROTO_SDRP = 0x2a IPPROTO_SEND = 0x103 - IPPROTO_SEP = 0x21 IPPROTO_SHIM6 = 0x8c IPPROTO_SKIP = 0x39 IPPROTO_SPACER = 0x7fff @@ -837,6 +854,7 @@ const ( IPV6_DSTOPTS = 0x32 IPV6_FLOWID = 0x43 IPV6_FLOWINFO_MASK = 0xffffff0f + IPV6_FLOWLABEL_LEN = 0x14 IPV6_FLOWLABEL_MASK = 0xffff0f00 IPV6_FLOWTYPE = 0x44 IPV6_FRAGTTL = 0x78 @@ -857,13 +875,13 @@ const ( IPV6_MAX_GROUP_SRC_FILTER = 0x200 IPV6_MAX_MEMBERSHIPS = 0xfff IPV6_MAX_SOCK_SRC_FILTER = 0x80 - IPV6_MIN_MEMBERSHIPS = 0x1f IPV6_MMTU = 0x500 IPV6_MSFILTER = 0x4a IPV6_MULTICAST_HOPS = 0xa IPV6_MULTICAST_IF = 0x9 IPV6_MULTICAST_LOOP = 0xb IPV6_NEXTHOP = 0x30 + IPV6_ORIGDSTADDR = 0x48 IPV6_PATHMTU = 0x2c IPV6_PKTINFO = 0x2e IPV6_PORTRANGE = 0xe @@ -875,6 +893,7 @@ const ( IPV6_RECVFLOWID = 0x46 IPV6_RECVHOPLIMIT = 0x25 IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVORIGDSTADDR = 0x48 IPV6_RECVPATHMTU = 0x2b IPV6_RECVPKTINFO = 0x24 IPV6_RECVRSSBUCKETID = 0x47 @@ -894,6 +913,7 @@ const ( IPV6_V6ONLY = 0x1b IPV6_VERSION = 0x60 IPV6_VERSION_MASK = 0xf0 + IPV6_VLAN_PCP = 0x4b IP_ADD_MEMBERSHIP = 0xc IP_ADD_SOURCE_MEMBERSHIP = 0x46 IP_BINDANY = 0x18 @@ -935,10 +955,8 @@ const ( IP_MAX_MEMBERSHIPS = 0xfff IP_MAX_SOCK_MUTE_FILTER = 0x80 IP_MAX_SOCK_SRC_FILTER = 0x80 - IP_MAX_SOURCE_FILTER = 0x400 IP_MF = 0x2000 IP_MINTTL = 0x42 - IP_MIN_MEMBERSHIPS = 0x1f IP_MSFILTER = 0x4a IP_MSS = 0x240 IP_MULTICAST_IF = 0x9 @@ -948,6 +966,7 @@ const ( IP_OFFMASK = 0x1fff IP_ONESBCAST = 0x17 IP_OPTIONS = 0x1 + IP_ORIGDSTADDR = 0x1b IP_PORTRANGE = 0x13 IP_PORTRANGE_DEFAULT = 0x0 IP_PORTRANGE_HIGH = 0x1 @@ -956,6 +975,7 @@ const ( IP_RECVFLOWID = 0x5d IP_RECVIF = 0x14 IP_RECVOPTS = 0x5 + IP_RECVORIGDSTADDR = 0x1b IP_RECVRETOPTS = 0x6 IP_RECVRSSBUCKETID = 0x5e IP_RECVTOS = 0x44 @@ -972,8 +992,12 @@ const ( IP_TOS = 0x3 IP_TTL = 0x4 IP_UNBLOCK_SOURCE = 0x49 + IP_VLAN_PCP = 0x4b ISIG = 0x80 ISTRIP = 0x20 + ITIMER_PROF = 0x2 + ITIMER_REAL = 0x0 + ITIMER_VIRTUAL = 0x1 IXANY = 0x800 IXOFF = 0x400 IXON = 0x200 @@ -983,7 +1007,6 @@ const ( KERN_VERSION = 0x4 LOCAL_CONNWAIT = 0x4 LOCAL_CREDS = 0x2 - LOCAL_CREDS_PERSISTENT = 0x3 LOCAL_PEERCRED = 0x1 LOCAL_VENDOR = 0x80000000 LOCK_EX = 0x2 @@ -1071,10 +1094,12 @@ const ( MNT_SUSPEND = 0x4 MNT_SYNCHRONOUS = 0x2 MNT_UNION = 0x20 + MNT_UNTRUSTED = 0x800000000 MNT_UPDATE = 0x10000 - MNT_UPDATEMASK = 0x2d8d0807e + MNT_UPDATEMASK = 0xad8d0807e MNT_USER = 0x8000 - MNT_VISFLAGMASK = 0x3fef0ffff + MNT_VERIFIED = 0x400000000 + MNT_VISFLAGMASK = 0xffef0ffff MNT_WAIT = 0x1 MSG_CMSG_CLOEXEC = 0x40000 MSG_COMPAT = 0x8000 @@ -1103,6 +1128,7 @@ const ( NFDBITS = 0x20 NOFLSH = 0x80000000 NOKERNINFO = 0x2000000 + NOTE_ABSTIME = 0x10 NOTE_ATTRIB = 0x8 NOTE_CHILD = 0x4 NOTE_CLOSE = 0x100 @@ -1159,6 +1185,8 @@ const ( O_NONBLOCK = 0x4 O_RDONLY = 0x0 O_RDWR = 0x2 + O_RESOLVE_BENEATH = 0x800000 + O_SEARCH = 0x40000 O_SHLOCK = 0x10 O_SYNC = 0x80 O_TRUNC = 0x400 @@ -1169,6 +1197,10 @@ const ( PARMRK = 0x8 PARODD = 0x2000 PENDIN = 0x20000000 + PIOD_READ_D = 0x1 + PIOD_READ_I = 0x3 + PIOD_WRITE_D = 0x2 + PIOD_WRITE_I = 0x4 PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1176,6 +1208,53 @@ const ( PROT_NONE = 0x0 PROT_READ = 0x1 PROT_WRITE = 0x2 + PTRACE_DEFAULT = 0x1 + PTRACE_EXEC = 0x1 + PTRACE_FORK = 0x8 + PTRACE_LWP = 0x10 + PTRACE_SCE = 0x2 + PTRACE_SCX = 0x4 + PTRACE_SYSCALL = 0x6 + PTRACE_VFORK = 0x20 + PT_ATTACH = 0xa + PT_CLEARSTEP = 0x10 + PT_CONTINUE = 0x7 + PT_DETACH = 0xb + PT_FIRSTMACH = 0x40 + PT_FOLLOW_FORK = 0x17 + PT_GETDBREGS = 0x25 + PT_GETFPREGS = 0x23 + PT_GETLWPLIST = 0xf + PT_GETNUMLWPS = 0xe + PT_GETREGS = 0x21 + PT_GETVFPREGS = 0x40 + PT_GET_EVENT_MASK = 0x19 + PT_GET_SC_ARGS = 0x1b + PT_GET_SC_RET = 0x1c + PT_IO = 0xc + PT_KILL = 0x8 + PT_LWPINFO = 0xd + PT_LWP_EVENTS = 0x18 + PT_READ_D = 0x2 + PT_READ_I = 0x1 + PT_RESUME = 0x13 + PT_SETDBREGS = 0x26 + PT_SETFPREGS = 0x24 + PT_SETREGS = 0x22 + PT_SETSTEP = 0x11 + PT_SETVFPREGS = 0x41 + PT_SET_EVENT_MASK = 0x1a + PT_STEP = 0x9 + PT_SUSPEND = 0x12 + PT_SYSCALL = 0x16 + PT_TO_SCE = 0x14 + PT_TO_SCX = 0x15 + PT_TRACE_ME = 0x0 + PT_VM_ENTRY = 0x29 + PT_VM_TIMESTAMP = 0x28 + PT_WRITE_D = 0x5 + PT_WRITE_I = 0x4 + P_ZONEID = 0xc RLIMIT_AS = 0xa RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 @@ -1257,7 +1336,6 @@ const ( RTV_WEIGHT = 0x100 RT_ALL_FIBS = -0x1 RT_BLACKHOLE = 0x40 - RT_CACHING_CONTEXT = 0x1 RT_DEFAULT_FIB = 0x0 RT_HAS_GW = 0x80 RT_HAS_HEADER = 0x10 @@ -1267,15 +1345,17 @@ const ( RT_LLE_CACHE = 0x100 RT_MAY_LOOP = 0x8 RT_MAY_LOOP_BIT = 0x3 - RT_NORTREF = 0x2 RT_REJECT = 0x20 RUSAGE_CHILDREN = -0x1 RUSAGE_SELF = 0x0 RUSAGE_THREAD = 0x1 SCM_BINTIME = 0x4 SCM_CREDS = 0x3 + SCM_MONOTONIC = 0x6 + SCM_REALTIME = 0x5 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 + SCM_TIME_INFO = 0x7 SEEK_CUR = 0x1 SEEK_DATA = 0x3 SEEK_END = 0x2 @@ -1299,10 +1379,12 @@ const ( SIOCGHWADDR = 0xc020693e SIOCGI2C = 0xc020693d SIOCGIFADDR = 0xc0206921 + SIOCGIFALIAS = 0xc044692d SIOCGIFBRDADDR = 0xc0206923 SIOCGIFCAP = 0xc020691f SIOCGIFCONF = 0xc0086924 SIOCGIFDESCR = 0xc020692a + SIOCGIFDOWNREASON = 0xc058699a SIOCGIFDSTADDR = 0xc0206922 SIOCGIFFIB = 0xc020695c SIOCGIFFLAGS = 0xc0206911 @@ -1318,8 +1400,11 @@ const ( SIOCGIFPDSTADDR = 0xc0206948 SIOCGIFPHYS = 0xc0206935 SIOCGIFPSRCADDR = 0xc0206947 + SIOCGIFRSSHASH = 0xc0186997 + SIOCGIFRSSKEY = 0xc0946996 SIOCGIFSTATUS = 0xc331693b SIOCGIFXMEDIA = 0xc028698b + SIOCGLANPCP = 0xc0206998 SIOCGLOWAT = 0x40047303 SIOCGPGRP = 0x40047309 SIOCGPRIVATE_0 = 0xc0206950 @@ -1350,6 +1435,7 @@ const ( SIOCSIFPHYS = 0x80206936 SIOCSIFRVNET = 0xc020695b SIOCSIFVNET = 0xc020695a + SIOCSLANPCP = 0x80206999 SIOCSLOWAT = 0x80047302 SIOCSPGRP = 0x80047308 SIOCSTUNFIB = 0x8020695f @@ -1369,6 +1455,7 @@ const ( SO_BINTIME = 0x2000 SO_BROADCAST = 0x20 SO_DEBUG = 0x1 + SO_DOMAIN = 0x1019 SO_DONTROUTE = 0x10 SO_ERROR = 0x1007 SO_KEEPALIVE = 0x8 @@ -1377,6 +1464,7 @@ const ( SO_LISTENINCQLEN = 0x1013 SO_LISTENQLEN = 0x1012 SO_LISTENQLIMIT = 0x1011 + SO_MAX_PACING_RATE = 0x1018 SO_NOSIGPIPE = 0x800 SO_NO_DDP = 0x8000 SO_NO_OFFLOAD = 0x4000 @@ -1387,13 +1475,22 @@ const ( SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 + SO_RERROR = 0x20000 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 + SO_REUSEPORT_LB = 0x10000 SO_SETFIB = 0x1014 SO_SNDBUF = 0x1001 SO_SNDLOWAT = 0x1003 SO_SNDTIMEO = 0x1005 SO_TIMESTAMP = 0x400 + SO_TS_BINTIME = 0x1 + SO_TS_CLOCK = 0x1017 + SO_TS_CLOCK_MAX = 0x3 + SO_TS_DEFAULT = 0x0 + SO_TS_MONOTONIC = 0x3 + SO_TS_REALTIME = 0x2 + SO_TS_REALTIME_MICRO = 0x0 SO_TYPE = 0x1008 SO_USELOOPBACK = 0x40 SO_USER_COOKIE = 0x1015 @@ -1437,10 +1534,69 @@ const ( TCOFLUSH = 0x2 TCOOFF = 0x1 TCOON = 0x2 + TCPOPT_EOL = 0x0 + TCPOPT_FAST_OPEN = 0x22 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_PAD = 0x0 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_WINDOW = 0x3 + TCP_BBR_ACK_COMP_ALG = 0x448 + TCP_BBR_ALGORITHM = 0x43b + TCP_BBR_DRAIN_INC_EXTRA = 0x43c + TCP_BBR_DRAIN_PG = 0x42e + TCP_BBR_EXTRA_GAIN = 0x449 + TCP_BBR_EXTRA_STATE = 0x453 + TCP_BBR_FLOOR_MIN_TSO = 0x454 + TCP_BBR_HDWR_PACE = 0x451 + TCP_BBR_HOLD_TARGET = 0x436 + TCP_BBR_IWINTSO = 0x42b + TCP_BBR_LOWGAIN_FD = 0x436 + TCP_BBR_LOWGAIN_HALF = 0x435 + TCP_BBR_LOWGAIN_THRESH = 0x434 + TCP_BBR_MAX_RTO = 0x439 + TCP_BBR_MIN_RTO = 0x438 + TCP_BBR_MIN_TOPACEOUT = 0x455 + TCP_BBR_ONE_RETRAN = 0x431 + TCP_BBR_PACE_CROSS = 0x442 + TCP_BBR_PACE_DEL_TAR = 0x43f + TCP_BBR_PACE_OH = 0x435 + TCP_BBR_PACE_PER_SEC = 0x43e + TCP_BBR_PACE_SEG_MAX = 0x440 + TCP_BBR_PACE_SEG_MIN = 0x441 + TCP_BBR_POLICER_DETECT = 0x457 + TCP_BBR_PROBE_RTT_GAIN = 0x44d + TCP_BBR_PROBE_RTT_INT = 0x430 + TCP_BBR_PROBE_RTT_LEN = 0x44e + TCP_BBR_RACK_RTT_USE = 0x44a + TCP_BBR_RECFORCE = 0x42c + TCP_BBR_REC_OVER_HPTS = 0x43a + TCP_BBR_RETRAN_WTSO = 0x44b + TCP_BBR_RWND_IS_APP = 0x42f + TCP_BBR_SEND_IWND_IN_TSO = 0x44f + TCP_BBR_STARTUP_EXIT_EPOCH = 0x43d + TCP_BBR_STARTUP_LOSS_EXIT = 0x432 + TCP_BBR_STARTUP_PG = 0x42d + TCP_BBR_TMR_PACE_OH = 0x448 + TCP_BBR_TSLIMITS = 0x434 + TCP_BBR_TSTMP_RAISES = 0x456 + TCP_BBR_UNLIMITED = 0x43b + TCP_BBR_USEDEL_RATE = 0x437 + TCP_BBR_USE_LOWGAIN = 0x433 + TCP_BBR_USE_RACK_CHEAT = 0x450 + TCP_BBR_UTTER_MAX_TSO = 0x452 TCP_CA_NAME_MAX = 0x10 TCP_CCALGOOPT = 0x41 TCP_CONGESTION = 0x40 + TCP_DATA_AFTER_CLOSE = 0x44c + TCP_DELACK = 0x48 TCP_FASTOPEN = 0x401 + TCP_FASTOPEN_MAX_COOKIE_LEN = 0x10 + TCP_FASTOPEN_MIN_COOKIE_LEN = 0x4 + TCP_FASTOPEN_PSK_LEN = 0x10 TCP_FUNCTION_BLK = 0x2000 TCP_FUNCTION_NAME_LEN_MAX = 0x20 TCP_INFO = 0x20 @@ -1448,6 +1604,12 @@ const ( TCP_KEEPIDLE = 0x100 TCP_KEEPINIT = 0x80 TCP_KEEPINTVL = 0x200 + TCP_LOG = 0x22 + TCP_LOGBUF = 0x23 + TCP_LOGDUMP = 0x25 + TCP_LOGDUMPID = 0x26 + TCP_LOGID = 0x24 + TCP_LOG_ID_LEN = 0x40 TCP_MAXBURST = 0x4 TCP_MAXHLEN = 0x3c TCP_MAXOLEN = 0x28 @@ -1463,8 +1625,30 @@ const ( TCP_NOPUSH = 0x4 TCP_PCAP_IN = 0x1000 TCP_PCAP_OUT = 0x800 + TCP_RACK_EARLY_RECOV = 0x423 + TCP_RACK_EARLY_SEG = 0x424 + TCP_RACK_GP_INCREASE = 0x446 + TCP_RACK_IDLE_REDUCE_HIGH = 0x444 + TCP_RACK_MIN_PACE = 0x445 + TCP_RACK_MIN_PACE_SEG = 0x446 + TCP_RACK_MIN_TO = 0x422 + TCP_RACK_PACE_ALWAYS = 0x41f + TCP_RACK_PACE_MAX_SEG = 0x41e + TCP_RACK_PACE_REDUCE = 0x41d + TCP_RACK_PKT_DELAY = 0x428 + TCP_RACK_PROP = 0x41b + TCP_RACK_PROP_RATE = 0x420 + TCP_RACK_PRR_SENDALOT = 0x421 + TCP_RACK_REORD_FADE = 0x426 + TCP_RACK_REORD_THRESH = 0x425 + TCP_RACK_TLP_INC_VAR = 0x429 + TCP_RACK_TLP_REDUCE = 0x41c + TCP_RACK_TLP_THRESH = 0x427 + TCP_RACK_TLP_USE = 0x447 TCP_VENDOR = 0x80000000 TCSAFLUSH = 0x2 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 TIOCCONS = 0x80047462 @@ -1528,6 +1712,8 @@ const ( TIOCTIMESTAMP = 0x40107459 TIOCUCNTL = 0x80047466 TOSTOP = 0x400000 + UTIME_NOW = -0x1 + UTIME_OMIT = -0x2 VDISCARD = 0xf VDSUSP = 0xb VEOF = 0x0 @@ -1592,12 +1778,13 @@ const ( EIDRM = syscall.Errno(0x52) EILSEQ = syscall.Errno(0x56) EINPROGRESS = syscall.Errno(0x24) + EINTEGRITY = syscall.Errno(0x61) EINTR = syscall.Errno(0x4) EINVAL = syscall.Errno(0x16) EIO = syscall.Errno(0x5) EISCONN = syscall.Errno(0x38) EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x60) + ELAST = syscall.Errno(0x61) ELOOP = syscall.Errno(0x3e) EMFILE = syscall.Errno(0x18) EMLINK = syscall.Errno(0x1f) @@ -1740,7 +1927,7 @@ var errorList = [...]struct { {32, "EPIPE", "broken pipe"}, {33, "EDOM", "numerical argument out of domain"}, {34, "ERANGE", "result too large"}, - {35, "EAGAIN", "resource temporarily unavailable"}, + {35, "EWOULDBLOCK", "resource temporarily unavailable"}, {36, "EINPROGRESS", "operation now in progress"}, {37, "EALREADY", "operation already in progress"}, {38, "ENOTSOCK", "socket operation on non-socket"}, @@ -1802,6 +1989,7 @@ var errorList = [...]struct { {94, "ECAPMODE", "not permitted in capability mode"}, {95, "ENOTRECOVERABLE", "state not recoverable"}, {96, "EOWNERDEAD", "previous owner died"}, + {97, "EINTEGRITY", "integrity check failed"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go index 4c837711493f..c557ac2db317 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go @@ -151,6 +151,7 @@ const ( BIOCSETF = 0x80104267 BIOCSETFNR = 0x80104282 BIOCSETIF = 0x8020426c + BIOCSETVLANPCP = 0x80044285 BIOCSETWF = 0x8010427b BIOCSETZBUF = 0x80184281 BIOCSHDRCMPLT = 0x80044275 @@ -447,7 +448,7 @@ const ( DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 DLT_INFINIBAND = 0xf7 DLT_IPFILTER = 0x74 - DLT_IPMB = 0xc7 + DLT_IPMB_KONTRON = 0xc7 DLT_IPMB_LINUX = 0xd1 DLT_IPMI_HPM_2 = 0x104 DLT_IPNET = 0xe2 @@ -487,10 +488,11 @@ const ( DLT_LINUX_LAPD = 0xb1 DLT_LINUX_PPP_WITHDIRECTION = 0xa6 DLT_LINUX_SLL = 0x71 + DLT_LINUX_SLL2 = 0x114 DLT_LOOP = 0x6c DLT_LORATAP = 0x10e DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0x113 + DLT_MATCHING_MAX = 0x114 DLT_MATCHING_MIN = 0x68 DLT_MFR = 0xb6 DLT_MOST = 0xd3 @@ -734,6 +736,7 @@ const ( IPPROTO_CMTP = 0x26 IPPROTO_CPHB = 0x49 IPPROTO_CPNX = 0x48 + IPPROTO_DCCP = 0x21 IPPROTO_DDP = 0x25 IPPROTO_DGP = 0x56 IPPROTO_DIVERT = 0x102 @@ -814,7 +817,6 @@ const ( IPPROTO_SCTP = 0x84 IPPROTO_SDRP = 0x2a IPPROTO_SEND = 0x103 - IPPROTO_SEP = 0x21 IPPROTO_SHIM6 = 0x8c IPPROTO_SKIP = 0x39 IPPROTO_SPACER = 0x7fff @@ -911,6 +913,7 @@ const ( IPV6_V6ONLY = 0x1b IPV6_VERSION = 0x60 IPV6_VERSION_MASK = 0xf0 + IPV6_VLAN_PCP = 0x4b IP_ADD_MEMBERSHIP = 0xc IP_ADD_SOURCE_MEMBERSHIP = 0x46 IP_BINDANY = 0x18 @@ -989,8 +992,12 @@ const ( IP_TOS = 0x3 IP_TTL = 0x4 IP_UNBLOCK_SOURCE = 0x49 + IP_VLAN_PCP = 0x4b ISIG = 0x80 ISTRIP = 0x20 + ITIMER_PROF = 0x2 + ITIMER_REAL = 0x0 + ITIMER_VIRTUAL = 0x1 IXANY = 0x800 IXOFF = 0x400 IXON = 0x200 @@ -1000,7 +1007,6 @@ const ( KERN_VERSION = 0x4 LOCAL_CONNWAIT = 0x4 LOCAL_CREDS = 0x2 - LOCAL_CREDS_PERSISTENT = 0x3 LOCAL_PEERCRED = 0x1 LOCAL_VENDOR = 0x80000000 LOCK_EX = 0x2 @@ -1180,6 +1186,8 @@ const ( O_NONBLOCK = 0x4 O_RDONLY = 0x0 O_RDWR = 0x2 + O_RESOLVE_BENEATH = 0x800000 + O_SEARCH = 0x40000 O_SHLOCK = 0x10 O_SYNC = 0x80 O_TRUNC = 0x400 @@ -1190,6 +1198,10 @@ const ( PARMRK = 0x8 PARODD = 0x2000 PENDIN = 0x20000000 + PIOD_READ_D = 0x1 + PIOD_READ_I = 0x3 + PIOD_WRITE_D = 0x2 + PIOD_WRITE_I = 0x4 PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1197,6 +1209,51 @@ const ( PROT_NONE = 0x0 PROT_READ = 0x1 PROT_WRITE = 0x2 + PTRACE_DEFAULT = 0x1 + PTRACE_EXEC = 0x1 + PTRACE_FORK = 0x8 + PTRACE_LWP = 0x10 + PTRACE_SCE = 0x2 + PTRACE_SCX = 0x4 + PTRACE_SYSCALL = 0x6 + PTRACE_VFORK = 0x20 + PT_ATTACH = 0xa + PT_CLEARSTEP = 0x10 + PT_CONTINUE = 0x7 + PT_DETACH = 0xb + PT_FIRSTMACH = 0x40 + PT_FOLLOW_FORK = 0x17 + PT_GETDBREGS = 0x25 + PT_GETFPREGS = 0x23 + PT_GETLWPLIST = 0xf + PT_GETNUMLWPS = 0xe + PT_GETREGS = 0x21 + PT_GET_EVENT_MASK = 0x19 + PT_GET_SC_ARGS = 0x1b + PT_GET_SC_RET = 0x1c + PT_IO = 0xc + PT_KILL = 0x8 + PT_LWPINFO = 0xd + PT_LWP_EVENTS = 0x18 + PT_READ_D = 0x2 + PT_READ_I = 0x1 + PT_RESUME = 0x13 + PT_SETDBREGS = 0x26 + PT_SETFPREGS = 0x24 + PT_SETREGS = 0x22 + PT_SETSTEP = 0x11 + PT_SET_EVENT_MASK = 0x1a + PT_STEP = 0x9 + PT_SUSPEND = 0x12 + PT_SYSCALL = 0x16 + PT_TO_SCE = 0x14 + PT_TO_SCX = 0x15 + PT_TRACE_ME = 0x0 + PT_VM_ENTRY = 0x29 + PT_VM_TIMESTAMP = 0x28 + PT_WRITE_D = 0x5 + PT_WRITE_I = 0x4 + P_ZONEID = 0xc RLIMIT_AS = 0xa RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 @@ -1321,10 +1378,12 @@ const ( SIOCGHWADDR = 0xc020693e SIOCGI2C = 0xc020693d SIOCGIFADDR = 0xc0206921 + SIOCGIFALIAS = 0xc044692d SIOCGIFBRDADDR = 0xc0206923 SIOCGIFCAP = 0xc020691f SIOCGIFCONF = 0xc0106924 SIOCGIFDESCR = 0xc020692a + SIOCGIFDOWNREASON = 0xc058699a SIOCGIFDSTADDR = 0xc0206922 SIOCGIFFIB = 0xc020695c SIOCGIFFLAGS = 0xc0206911 @@ -1415,6 +1474,7 @@ const ( SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 + SO_RERROR = 0x20000 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_REUSEPORT_LB = 0x10000 @@ -1473,22 +1533,40 @@ const ( TCOFLUSH = 0x2 TCOOFF = 0x1 TCOON = 0x2 + TCPOPT_EOL = 0x0 + TCPOPT_FAST_OPEN = 0x22 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_PAD = 0x0 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_WINDOW = 0x3 TCP_BBR_ACK_COMP_ALG = 0x448 + TCP_BBR_ALGORITHM = 0x43b TCP_BBR_DRAIN_INC_EXTRA = 0x43c TCP_BBR_DRAIN_PG = 0x42e TCP_BBR_EXTRA_GAIN = 0x449 + TCP_BBR_EXTRA_STATE = 0x453 + TCP_BBR_FLOOR_MIN_TSO = 0x454 + TCP_BBR_HDWR_PACE = 0x451 + TCP_BBR_HOLD_TARGET = 0x436 TCP_BBR_IWINTSO = 0x42b TCP_BBR_LOWGAIN_FD = 0x436 TCP_BBR_LOWGAIN_HALF = 0x435 TCP_BBR_LOWGAIN_THRESH = 0x434 TCP_BBR_MAX_RTO = 0x439 TCP_BBR_MIN_RTO = 0x438 + TCP_BBR_MIN_TOPACEOUT = 0x455 TCP_BBR_ONE_RETRAN = 0x431 TCP_BBR_PACE_CROSS = 0x442 TCP_BBR_PACE_DEL_TAR = 0x43f + TCP_BBR_PACE_OH = 0x435 TCP_BBR_PACE_PER_SEC = 0x43e TCP_BBR_PACE_SEG_MAX = 0x440 TCP_BBR_PACE_SEG_MIN = 0x441 + TCP_BBR_POLICER_DETECT = 0x457 TCP_BBR_PROBE_RTT_GAIN = 0x44d TCP_BBR_PROBE_RTT_INT = 0x430 TCP_BBR_PROBE_RTT_LEN = 0x44e @@ -1497,12 +1575,18 @@ const ( TCP_BBR_REC_OVER_HPTS = 0x43a TCP_BBR_RETRAN_WTSO = 0x44b TCP_BBR_RWND_IS_APP = 0x42f + TCP_BBR_SEND_IWND_IN_TSO = 0x44f TCP_BBR_STARTUP_EXIT_EPOCH = 0x43d TCP_BBR_STARTUP_LOSS_EXIT = 0x432 TCP_BBR_STARTUP_PG = 0x42d + TCP_BBR_TMR_PACE_OH = 0x448 + TCP_BBR_TSLIMITS = 0x434 + TCP_BBR_TSTMP_RAISES = 0x456 TCP_BBR_UNLIMITED = 0x43b TCP_BBR_USEDEL_RATE = 0x437 TCP_BBR_USE_LOWGAIN = 0x433 + TCP_BBR_USE_RACK_CHEAT = 0x450 + TCP_BBR_UTTER_MAX_TSO = 0x452 TCP_CA_NAME_MAX = 0x10 TCP_CCALGOOPT = 0x41 TCP_CONGESTION = 0x40 @@ -1542,6 +1626,7 @@ const ( TCP_PCAP_OUT = 0x800 TCP_RACK_EARLY_RECOV = 0x423 TCP_RACK_EARLY_SEG = 0x424 + TCP_RACK_GP_INCREASE = 0x446 TCP_RACK_IDLE_REDUCE_HIGH = 0x444 TCP_RACK_MIN_PACE = 0x445 TCP_RACK_MIN_PACE_SEG = 0x446 @@ -1555,7 +1640,6 @@ const ( TCP_RACK_PRR_SENDALOT = 0x421 TCP_RACK_REORD_FADE = 0x426 TCP_RACK_REORD_THRESH = 0x425 - TCP_RACK_SESS_CWV = 0x42a TCP_RACK_TLP_INC_VAR = 0x429 TCP_RACK_TLP_REDUCE = 0x41c TCP_RACK_TLP_THRESH = 0x427 @@ -1694,12 +1778,13 @@ const ( EIDRM = syscall.Errno(0x52) EILSEQ = syscall.Errno(0x56) EINPROGRESS = syscall.Errno(0x24) + EINTEGRITY = syscall.Errno(0x61) EINTR = syscall.Errno(0x4) EINVAL = syscall.Errno(0x16) EIO = syscall.Errno(0x5) EISCONN = syscall.Errno(0x38) EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x60) + ELAST = syscall.Errno(0x61) ELOOP = syscall.Errno(0x3e) EMFILE = syscall.Errno(0x18) EMLINK = syscall.Errno(0x1f) @@ -1842,7 +1927,7 @@ var errorList = [...]struct { {32, "EPIPE", "broken pipe"}, {33, "EDOM", "numerical argument out of domain"}, {34, "ERANGE", "result too large"}, - {35, "EAGAIN", "resource temporarily unavailable"}, + {35, "EWOULDBLOCK", "resource temporarily unavailable"}, {36, "EINPROGRESS", "operation now in progress"}, {37, "EALREADY", "operation already in progress"}, {38, "ENOTSOCK", "socket operation on non-socket"}, @@ -1904,6 +1989,7 @@ var errorList = [...]struct { {94, "ECAPMODE", "not permitted in capability mode"}, {95, "ENOTRECOVERABLE", "state not recoverable"}, {96, "EOWNERDEAD", "previous owner died"}, + {97, "EINTEGRITY", "integrity check failed"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go new file mode 100644 index 000000000000..341b4d96265b --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go @@ -0,0 +1,2148 @@ +// mkerrors.sh -m64 +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build riscv64 && freebsd +// +build riscv64,freebsd + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs -- -m64 _const.go + +package unix + +import "syscall" + +const ( + AF_APPLETALK = 0x10 + AF_ARP = 0x23 + AF_ATM = 0x1e + AF_BLUETOOTH = 0x24 + AF_CCITT = 0xa + AF_CHAOS = 0x5 + AF_CNT = 0x15 + AF_COIP = 0x14 + AF_DATAKIT = 0x9 + AF_DECnet = 0xc + AF_DLI = 0xd + AF_E164 = 0x1a + AF_ECMA = 0x8 + AF_HYLINK = 0xf + AF_HYPERV = 0x2b + AF_IEEE80211 = 0x25 + AF_IMPLINK = 0x3 + AF_INET = 0x2 + AF_INET6 = 0x1c + AF_INET6_SDP = 0x2a + AF_INET_SDP = 0x28 + AF_IPX = 0x17 + AF_ISDN = 0x1a + AF_ISO = 0x7 + AF_LAT = 0xe + AF_LINK = 0x12 + AF_LOCAL = 0x1 + AF_MAX = 0x2b + AF_NATM = 0x1d + AF_NETBIOS = 0x6 + AF_NETGRAPH = 0x20 + AF_OSI = 0x7 + AF_PUP = 0x4 + AF_ROUTE = 0x11 + AF_SCLUSTER = 0x22 + AF_SIP = 0x18 + AF_SLOW = 0x21 + AF_SNA = 0xb + AF_UNIX = 0x1 + AF_UNSPEC = 0x0 + AF_VENDOR00 = 0x27 + AF_VENDOR01 = 0x29 + AF_VENDOR03 = 0x2d + AF_VENDOR04 = 0x2f + AF_VENDOR05 = 0x31 + AF_VENDOR06 = 0x33 + AF_VENDOR07 = 0x35 + AF_VENDOR08 = 0x37 + AF_VENDOR09 = 0x39 + AF_VENDOR10 = 0x3b + AF_VENDOR11 = 0x3d + AF_VENDOR12 = 0x3f + AF_VENDOR13 = 0x41 + AF_VENDOR14 = 0x43 + AF_VENDOR15 = 0x45 + AF_VENDOR16 = 0x47 + AF_VENDOR17 = 0x49 + AF_VENDOR18 = 0x4b + AF_VENDOR19 = 0x4d + AF_VENDOR20 = 0x4f + AF_VENDOR21 = 0x51 + AF_VENDOR22 = 0x53 + AF_VENDOR23 = 0x55 + AF_VENDOR24 = 0x57 + AF_VENDOR25 = 0x59 + AF_VENDOR26 = 0x5b + AF_VENDOR27 = 0x5d + AF_VENDOR28 = 0x5f + AF_VENDOR29 = 0x61 + AF_VENDOR30 = 0x63 + AF_VENDOR31 = 0x65 + AF_VENDOR32 = 0x67 + AF_VENDOR33 = 0x69 + AF_VENDOR34 = 0x6b + AF_VENDOR35 = 0x6d + AF_VENDOR36 = 0x6f + AF_VENDOR37 = 0x71 + AF_VENDOR38 = 0x73 + AF_VENDOR39 = 0x75 + AF_VENDOR40 = 0x77 + AF_VENDOR41 = 0x79 + AF_VENDOR42 = 0x7b + AF_VENDOR43 = 0x7d + AF_VENDOR44 = 0x7f + AF_VENDOR45 = 0x81 + AF_VENDOR46 = 0x83 + AF_VENDOR47 = 0x85 + ALTWERASE = 0x200 + B0 = 0x0 + B1000000 = 0xf4240 + B110 = 0x6e + B115200 = 0x1c200 + B1200 = 0x4b0 + B134 = 0x86 + B14400 = 0x3840 + B150 = 0x96 + B1500000 = 0x16e360 + B1800 = 0x708 + B19200 = 0x4b00 + B200 = 0xc8 + B2000000 = 0x1e8480 + B230400 = 0x38400 + B2400 = 0x960 + B2500000 = 0x2625a0 + B28800 = 0x7080 + B300 = 0x12c + B3000000 = 0x2dc6c0 + B3500000 = 0x3567e0 + B38400 = 0x9600 + B4000000 = 0x3d0900 + B460800 = 0x70800 + B4800 = 0x12c0 + B50 = 0x32 + B500000 = 0x7a120 + B57600 = 0xe100 + B600 = 0x258 + B7200 = 0x1c20 + B75 = 0x4b + B76800 = 0x12c00 + B921600 = 0xe1000 + B9600 = 0x2580 + BIOCFEEDBACK = 0x8004427c + BIOCFLUSH = 0x20004268 + BIOCGBLEN = 0x40044266 + BIOCGDIRECTION = 0x40044276 + BIOCGDLT = 0x4004426a + BIOCGDLTLIST = 0xc0104279 + BIOCGETBUFMODE = 0x4004427d + BIOCGETIF = 0x4020426b + BIOCGETZMAX = 0x4008427f + BIOCGHDRCMPLT = 0x40044274 + BIOCGRSIG = 0x40044272 + BIOCGRTIMEOUT = 0x4010426e + BIOCGSEESENT = 0x40044276 + BIOCGSTATS = 0x4008426f + BIOCGTSTAMP = 0x40044283 + BIOCIMMEDIATE = 0x80044270 + BIOCLOCK = 0x2000427a + BIOCPROMISC = 0x20004269 + BIOCROTZBUF = 0x40184280 + BIOCSBLEN = 0xc0044266 + BIOCSDIRECTION = 0x80044277 + BIOCSDLT = 0x80044278 + BIOCSETBUFMODE = 0x8004427e + BIOCSETF = 0x80104267 + BIOCSETFNR = 0x80104282 + BIOCSETIF = 0x8020426c + BIOCSETVLANPCP = 0x80044285 + BIOCSETWF = 0x8010427b + BIOCSETZBUF = 0x80184281 + BIOCSHDRCMPLT = 0x80044275 + BIOCSRSIG = 0x80044273 + BIOCSRTIMEOUT = 0x8010426d + BIOCSSEESENT = 0x80044277 + BIOCSTSTAMP = 0x80044284 + BIOCVERSION = 0x40044271 + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0x0 + BPF_ALIGNMENT = 0x8 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_BUFMODE_BUFFER = 0x1 + BPF_BUFMODE_ZBUF = 0x2 + BPF_DIV = 0x30 + BPF_H = 0x8 + BPF_IMM = 0x0 + BPF_IND = 0x40 + BPF_JA = 0x0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0x0 + BPF_LD = 0x0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXBUFSIZE = 0x80000 + BPF_MAXINSNS = 0x200 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINBUFSIZE = 0x20 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MOD = 0x90 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RELEASE = 0x30bb6 + BPF_RET = 0x6 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0x0 + BPF_TXA = 0x80 + BPF_T_BINTIME = 0x2 + BPF_T_BINTIME_FAST = 0x102 + BPF_T_BINTIME_MONOTONIC = 0x202 + BPF_T_BINTIME_MONOTONIC_FAST = 0x302 + BPF_T_FAST = 0x100 + BPF_T_FLAG_MASK = 0x300 + BPF_T_FORMAT_MASK = 0x3 + BPF_T_MICROTIME = 0x0 + BPF_T_MICROTIME_FAST = 0x100 + BPF_T_MICROTIME_MONOTONIC = 0x200 + BPF_T_MICROTIME_MONOTONIC_FAST = 0x300 + BPF_T_MONOTONIC = 0x200 + BPF_T_MONOTONIC_FAST = 0x300 + BPF_T_NANOTIME = 0x1 + BPF_T_NANOTIME_FAST = 0x101 + BPF_T_NANOTIME_MONOTONIC = 0x201 + BPF_T_NANOTIME_MONOTONIC_FAST = 0x301 + BPF_T_NONE = 0x3 + BPF_T_NORMAL = 0x0 + BPF_W = 0x0 + BPF_X = 0x8 + BPF_XOR = 0xa0 + BRKINT = 0x2 + CAP_ACCEPT = 0x200000020000000 + CAP_ACL_CHECK = 0x400000000010000 + CAP_ACL_DELETE = 0x400000000020000 + CAP_ACL_GET = 0x400000000040000 + CAP_ACL_SET = 0x400000000080000 + CAP_ALL0 = 0x20007ffffffffff + CAP_ALL1 = 0x4000000001fffff + CAP_BIND = 0x200000040000000 + CAP_BINDAT = 0x200008000000400 + CAP_CHFLAGSAT = 0x200000000001400 + CAP_CONNECT = 0x200000080000000 + CAP_CONNECTAT = 0x200010000000400 + CAP_CREATE = 0x200000000000040 + CAP_EVENT = 0x400000000000020 + CAP_EXTATTR_DELETE = 0x400000000001000 + CAP_EXTATTR_GET = 0x400000000002000 + CAP_EXTATTR_LIST = 0x400000000004000 + CAP_EXTATTR_SET = 0x400000000008000 + CAP_FCHDIR = 0x200000000000800 + CAP_FCHFLAGS = 0x200000000001000 + CAP_FCHMOD = 0x200000000002000 + CAP_FCHMODAT = 0x200000000002400 + CAP_FCHOWN = 0x200000000004000 + CAP_FCHOWNAT = 0x200000000004400 + CAP_FCNTL = 0x200000000008000 + CAP_FCNTL_ALL = 0x78 + CAP_FCNTL_GETFL = 0x8 + CAP_FCNTL_GETOWN = 0x20 + CAP_FCNTL_SETFL = 0x10 + CAP_FCNTL_SETOWN = 0x40 + CAP_FEXECVE = 0x200000000000080 + CAP_FLOCK = 0x200000000010000 + CAP_FPATHCONF = 0x200000000020000 + CAP_FSCK = 0x200000000040000 + CAP_FSTAT = 0x200000000080000 + CAP_FSTATAT = 0x200000000080400 + CAP_FSTATFS = 0x200000000100000 + CAP_FSYNC = 0x200000000000100 + CAP_FTRUNCATE = 0x200000000000200 + CAP_FUTIMES = 0x200000000200000 + CAP_FUTIMESAT = 0x200000000200400 + CAP_GETPEERNAME = 0x200000100000000 + CAP_GETSOCKNAME = 0x200000200000000 + CAP_GETSOCKOPT = 0x200000400000000 + CAP_IOCTL = 0x400000000000080 + CAP_IOCTLS_ALL = 0x7fffffffffffffff + CAP_KQUEUE = 0x400000000100040 + CAP_KQUEUE_CHANGE = 0x400000000100000 + CAP_KQUEUE_EVENT = 0x400000000000040 + CAP_LINKAT_SOURCE = 0x200020000000400 + CAP_LINKAT_TARGET = 0x200000000400400 + CAP_LISTEN = 0x200000800000000 + CAP_LOOKUP = 0x200000000000400 + CAP_MAC_GET = 0x400000000000001 + CAP_MAC_SET = 0x400000000000002 + CAP_MKDIRAT = 0x200000000800400 + CAP_MKFIFOAT = 0x200000001000400 + CAP_MKNODAT = 0x200000002000400 + CAP_MMAP = 0x200000000000010 + CAP_MMAP_R = 0x20000000000001d + CAP_MMAP_RW = 0x20000000000001f + CAP_MMAP_RWX = 0x20000000000003f + CAP_MMAP_RX = 0x20000000000003d + CAP_MMAP_W = 0x20000000000001e + CAP_MMAP_WX = 0x20000000000003e + CAP_MMAP_X = 0x20000000000003c + CAP_PDGETPID = 0x400000000000200 + CAP_PDKILL = 0x400000000000800 + CAP_PDWAIT = 0x400000000000400 + CAP_PEELOFF = 0x200001000000000 + CAP_POLL_EVENT = 0x400000000000020 + CAP_PREAD = 0x20000000000000d + CAP_PWRITE = 0x20000000000000e + CAP_READ = 0x200000000000001 + CAP_RECV = 0x200000000000001 + CAP_RENAMEAT_SOURCE = 0x200000004000400 + CAP_RENAMEAT_TARGET = 0x200040000000400 + CAP_RIGHTS_VERSION = 0x0 + CAP_RIGHTS_VERSION_00 = 0x0 + CAP_SEEK = 0x20000000000000c + CAP_SEEK_TELL = 0x200000000000004 + CAP_SEM_GETVALUE = 0x400000000000004 + CAP_SEM_POST = 0x400000000000008 + CAP_SEM_WAIT = 0x400000000000010 + CAP_SEND = 0x200000000000002 + CAP_SETSOCKOPT = 0x200002000000000 + CAP_SHUTDOWN = 0x200004000000000 + CAP_SOCK_CLIENT = 0x200007780000003 + CAP_SOCK_SERVER = 0x200007f60000003 + CAP_SYMLINKAT = 0x200000008000400 + CAP_TTYHOOK = 0x400000000000100 + CAP_UNLINKAT = 0x200000010000400 + CAP_UNUSED0_44 = 0x200080000000000 + CAP_UNUSED0_57 = 0x300000000000000 + CAP_UNUSED1_22 = 0x400000000200000 + CAP_UNUSED1_57 = 0x500000000000000 + CAP_WRITE = 0x200000000000002 + CFLUSH = 0xf + CLOCAL = 0x8000 + CLOCK_BOOTTIME = 0x5 + CLOCK_MONOTONIC = 0x4 + CLOCK_MONOTONIC_COARSE = 0xc + CLOCK_MONOTONIC_FAST = 0xc + CLOCK_MONOTONIC_PRECISE = 0xb + CLOCK_PROCESS_CPUTIME_ID = 0xf + CLOCK_PROF = 0x2 + CLOCK_REALTIME = 0x0 + CLOCK_REALTIME_COARSE = 0xa + CLOCK_REALTIME_FAST = 0xa + CLOCK_REALTIME_PRECISE = 0x9 + CLOCK_SECOND = 0xd + CLOCK_THREAD_CPUTIME_ID = 0xe + CLOCK_UPTIME = 0x5 + CLOCK_UPTIME_FAST = 0x8 + CLOCK_UPTIME_PRECISE = 0x7 + CLOCK_VIRTUAL = 0x1 + CPUSTATES = 0x5 + CP_IDLE = 0x4 + CP_INTR = 0x3 + CP_NICE = 0x1 + CP_SYS = 0x2 + CP_USER = 0x0 + CREAD = 0x800 + CRTSCTS = 0x30000 + CS5 = 0x0 + CS6 = 0x100 + CS7 = 0x200 + CS8 = 0x300 + CSIZE = 0x300 + CSTART = 0x11 + CSTATUS = 0x14 + CSTOP = 0x13 + CSTOPB = 0x400 + CSUSP = 0x1a + CTL_HW = 0x6 + CTL_KERN = 0x1 + CTL_MAXNAME = 0x18 + CTL_NET = 0x4 + DIOCGATTR = 0xc148648e + DIOCGDELETE = 0x80106488 + DIOCGFLUSH = 0x20006487 + DIOCGFWHEADS = 0x40046483 + DIOCGFWSECTORS = 0x40046482 + DIOCGIDENT = 0x41006489 + DIOCGKERNELDUMP = 0xc0986492 + DIOCGMEDIASIZE = 0x40086481 + DIOCGPHYSPATH = 0x4400648d + DIOCGPROVIDERNAME = 0x4400648a + DIOCGSECTORSIZE = 0x40046480 + DIOCGSTRIPEOFFSET = 0x4008648c + DIOCGSTRIPESIZE = 0x4008648b + DIOCSKERNELDUMP = 0x80986491 + DIOCSKERNELDUMP_FREEBSD11 = 0x80046485 + DIOCSKERNELDUMP_FREEBSD12 = 0x80506490 + DIOCZONECMD = 0xc080648f + DLT_A429 = 0xb8 + DLT_A653_ICM = 0xb9 + DLT_AIRONET_HEADER = 0x78 + DLT_AOS = 0xde + DLT_APPLE_IP_OVER_IEEE1394 = 0x8a + DLT_ARCNET = 0x7 + DLT_ARCNET_LINUX = 0x81 + DLT_ATM_CLIP = 0x13 + DLT_ATM_RFC1483 = 0xb + DLT_AURORA = 0x7e + DLT_AX25 = 0x3 + DLT_AX25_KISS = 0xca + DLT_BACNET_MS_TP = 0xa5 + DLT_BLUETOOTH_BREDR_BB = 0xff + DLT_BLUETOOTH_HCI_H4 = 0xbb + DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 + DLT_BLUETOOTH_LE_LL = 0xfb + DLT_BLUETOOTH_LE_LL_WITH_PHDR = 0x100 + DLT_BLUETOOTH_LINUX_MONITOR = 0xfe + DLT_CAN20B = 0xbe + DLT_CAN_SOCKETCAN = 0xe3 + DLT_CHAOS = 0x5 + DLT_CHDLC = 0x68 + DLT_CISCO_IOS = 0x76 + DLT_CLASS_NETBSD_RAWAF = 0x2240000 + DLT_C_HDLC = 0x68 + DLT_C_HDLC_WITH_DIR = 0xcd + DLT_DBUS = 0xe7 + DLT_DECT = 0xdd + DLT_DISPLAYPORT_AUX = 0x113 + DLT_DOCSIS = 0x8f + DLT_DOCSIS31_XRA31 = 0x111 + DLT_DVB_CI = 0xeb + DLT_ECONET = 0x73 + DLT_EN10MB = 0x1 + DLT_EN3MB = 0x2 + DLT_ENC = 0x6d + DLT_EPON = 0x103 + DLT_ERF = 0xc5 + DLT_ERF_ETH = 0xaf + DLT_ERF_POS = 0xb0 + DLT_ETHERNET_MPACKET = 0x112 + DLT_FC_2 = 0xe0 + DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 + DLT_FDDI = 0xa + DLT_FLEXRAY = 0xd2 + DLT_FRELAY = 0x6b + DLT_FRELAY_WITH_DIR = 0xce + DLT_GCOM_SERIAL = 0xad + DLT_GCOM_T1E1 = 0xac + DLT_GPF_F = 0xab + DLT_GPF_T = 0xaa + DLT_GPRS_LLC = 0xa9 + DLT_GSMTAP_ABIS = 0xda + DLT_GSMTAP_UM = 0xd9 + DLT_IBM_SN = 0x92 + DLT_IBM_SP = 0x91 + DLT_IEEE802 = 0x6 + DLT_IEEE802_11 = 0x69 + DLT_IEEE802_11_RADIO = 0x7f + DLT_IEEE802_11_RADIO_AVS = 0xa3 + DLT_IEEE802_15_4 = 0xc3 + DLT_IEEE802_15_4_LINUX = 0xbf + DLT_IEEE802_15_4_NOFCS = 0xe6 + DLT_IEEE802_15_4_NONASK_PHY = 0xd7 + DLT_IEEE802_16_MAC_CPS = 0xbc + DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 + DLT_INFINIBAND = 0xf7 + DLT_IPFILTER = 0x74 + DLT_IPMB_KONTRON = 0xc7 + DLT_IPMB_LINUX = 0xd1 + DLT_IPMI_HPM_2 = 0x104 + DLT_IPNET = 0xe2 + DLT_IPOIB = 0xf2 + DLT_IPV4 = 0xe4 + DLT_IPV6 = 0xe5 + DLT_IP_OVER_FC = 0x7a + DLT_ISO_14443 = 0x108 + DLT_JUNIPER_ATM1 = 0x89 + DLT_JUNIPER_ATM2 = 0x87 + DLT_JUNIPER_ATM_CEMIC = 0xee + DLT_JUNIPER_CHDLC = 0xb5 + DLT_JUNIPER_ES = 0x84 + DLT_JUNIPER_ETHER = 0xb2 + DLT_JUNIPER_FIBRECHANNEL = 0xea + DLT_JUNIPER_FRELAY = 0xb4 + DLT_JUNIPER_GGSN = 0x85 + DLT_JUNIPER_ISM = 0xc2 + DLT_JUNIPER_MFR = 0x86 + DLT_JUNIPER_MLFR = 0x83 + DLT_JUNIPER_MLPPP = 0x82 + DLT_JUNIPER_MONITOR = 0xa4 + DLT_JUNIPER_PIC_PEER = 0xae + DLT_JUNIPER_PPP = 0xb3 + DLT_JUNIPER_PPPOE = 0xa7 + DLT_JUNIPER_PPPOE_ATM = 0xa8 + DLT_JUNIPER_SERVICES = 0x88 + DLT_JUNIPER_SRX_E2E = 0xe9 + DLT_JUNIPER_ST = 0xc8 + DLT_JUNIPER_VP = 0xb7 + DLT_JUNIPER_VS = 0xe8 + DLT_LAPB_WITH_DIR = 0xcf + DLT_LAPD = 0xcb + DLT_LIN = 0xd4 + DLT_LINUX_EVDEV = 0xd8 + DLT_LINUX_IRDA = 0x90 + DLT_LINUX_LAPD = 0xb1 + DLT_LINUX_PPP_WITHDIRECTION = 0xa6 + DLT_LINUX_SLL = 0x71 + DLT_LINUX_SLL2 = 0x114 + DLT_LOOP = 0x6c + DLT_LORATAP = 0x10e + DLT_LTALK = 0x72 + DLT_MATCHING_MAX = 0x114 + DLT_MATCHING_MIN = 0x68 + DLT_MFR = 0xb6 + DLT_MOST = 0xd3 + DLT_MPEG_2_TS = 0xf3 + DLT_MPLS = 0xdb + DLT_MTP2 = 0x8c + DLT_MTP2_WITH_PHDR = 0x8b + DLT_MTP3 = 0x8d + DLT_MUX27010 = 0xec + DLT_NETANALYZER = 0xf0 + DLT_NETANALYZER_TRANSPARENT = 0xf1 + DLT_NETLINK = 0xfd + DLT_NFC_LLCP = 0xf5 + DLT_NFLOG = 0xef + DLT_NG40 = 0xf4 + DLT_NORDIC_BLE = 0x110 + DLT_NULL = 0x0 + DLT_OPENFLOW = 0x10b + DLT_PCI_EXP = 0x7d + DLT_PFLOG = 0x75 + DLT_PFSYNC = 0x79 + DLT_PKTAP = 0x102 + DLT_PPI = 0xc0 + DLT_PPP = 0x9 + DLT_PPP_BSDOS = 0xe + DLT_PPP_ETHER = 0x33 + DLT_PPP_PPPD = 0xa6 + DLT_PPP_SERIAL = 0x32 + DLT_PPP_WITH_DIR = 0xcc + DLT_PPP_WITH_DIRECTION = 0xa6 + DLT_PRISM_HEADER = 0x77 + DLT_PROFIBUS_DL = 0x101 + DLT_PRONET = 0x4 + DLT_RAIF1 = 0xc6 + DLT_RAW = 0xc + DLT_RDS = 0x109 + DLT_REDBACK_SMARTEDGE = 0x20 + DLT_RIO = 0x7c + DLT_RTAC_SERIAL = 0xfa + DLT_SCCP = 0x8e + DLT_SCTP = 0xf8 + DLT_SDLC = 0x10c + DLT_SITA = 0xc4 + DLT_SLIP = 0x8 + DLT_SLIP_BSDOS = 0xd + DLT_STANAG_5066_D_PDU = 0xed + DLT_SUNATM = 0x7b + DLT_SYMANTEC_FIREWALL = 0x63 + DLT_TI_LLN_SNIFFER = 0x10d + DLT_TZSP = 0x80 + DLT_USB = 0xba + DLT_USBPCAP = 0xf9 + DLT_USB_DARWIN = 0x10a + DLT_USB_FREEBSD = 0xba + DLT_USB_LINUX = 0xbd + DLT_USB_LINUX_MMAPPED = 0xdc + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c + DLT_VSOCK = 0x10f + DLT_WATTSTOPPER_DLM = 0x107 + DLT_WIHART = 0xdf + DLT_WIRESHARK_UPPER_PDU = 0xfc + DLT_X2E_SERIAL = 0xd5 + DLT_X2E_XORAYA = 0xd6 + DLT_ZWAVE_R1_R2 = 0x105 + DLT_ZWAVE_R3 = 0x106 + DT_BLK = 0x6 + DT_CHR = 0x2 + DT_DIR = 0x4 + DT_FIFO = 0x1 + DT_LNK = 0xa + DT_REG = 0x8 + DT_SOCK = 0xc + DT_UNKNOWN = 0x0 + DT_WHT = 0xe + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 + EHE_DEAD_PRIORITY = -0x1 + EVFILT_AIO = -0x3 + EVFILT_EMPTY = -0xd + EVFILT_FS = -0x9 + EVFILT_LIO = -0xa + EVFILT_PROC = -0x5 + EVFILT_PROCDESC = -0x8 + EVFILT_READ = -0x1 + EVFILT_SENDFILE = -0xc + EVFILT_SIGNAL = -0x6 + EVFILT_SYSCOUNT = 0xd + EVFILT_TIMER = -0x7 + EVFILT_USER = -0xb + EVFILT_VNODE = -0x4 + EVFILT_WRITE = -0x2 + EVNAMEMAP_NAME_SIZE = 0x40 + EV_ADD = 0x1 + EV_CLEAR = 0x20 + EV_DELETE = 0x2 + EV_DISABLE = 0x8 + EV_DISPATCH = 0x80 + EV_DROP = 0x1000 + EV_ENABLE = 0x4 + EV_EOF = 0x8000 + EV_ERROR = 0x4000 + EV_FLAG1 = 0x2000 + EV_FLAG2 = 0x4000 + EV_FORCEONESHOT = 0x100 + EV_ONESHOT = 0x10 + EV_RECEIPT = 0x40 + EV_SYSFLAGS = 0xf000 + EXTA = 0x4b00 + EXTATTR_MAXNAMELEN = 0xff + EXTATTR_NAMESPACE_EMPTY = 0x0 + EXTATTR_NAMESPACE_SYSTEM = 0x2 + EXTATTR_NAMESPACE_USER = 0x1 + EXTB = 0x9600 + EXTPROC = 0x800 + FD_CLOEXEC = 0x1 + FD_NONE = -0xc8 + FD_SETSIZE = 0x400 + FLUSHO = 0x800000 + F_ADD_SEALS = 0x13 + F_CANCEL = 0x5 + F_DUP2FD = 0xa + F_DUP2FD_CLOEXEC = 0x12 + F_DUPFD = 0x0 + F_DUPFD_CLOEXEC = 0x11 + F_GETFD = 0x1 + F_GETFL = 0x3 + F_GETLK = 0xb + F_GETOWN = 0x5 + F_GET_SEALS = 0x14 + F_ISUNIONSTACK = 0x15 + F_KINFO = 0x16 + F_OGETLK = 0x7 + F_OK = 0x0 + F_OSETLK = 0x8 + F_OSETLKW = 0x9 + F_RDAHEAD = 0x10 + F_RDLCK = 0x1 + F_READAHEAD = 0xf + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 + F_SETFD = 0x2 + F_SETFL = 0x4 + F_SETLK = 0xc + F_SETLKW = 0xd + F_SETLK_REMOTE = 0xe + F_SETOWN = 0x6 + F_UNLCK = 0x2 + F_UNLCKSYS = 0x4 + F_WRLCK = 0x3 + HUPCL = 0x4000 + HW_MACHINE = 0x1 + ICANON = 0x100 + ICMP6_FILTER = 0x12 + ICRNL = 0x100 + IEXTEN = 0x400 + IFAN_ARRIVAL = 0x0 + IFAN_DEPARTURE = 0x1 + IFCAP_WOL_MAGIC = 0x2000 + IFF_ALLMULTI = 0x200 + IFF_ALTPHYS = 0x4000 + IFF_BROADCAST = 0x2 + IFF_CANTCHANGE = 0x218f72 + IFF_CANTCONFIG = 0x10000 + IFF_DEBUG = 0x4 + IFF_DRV_OACTIVE = 0x400 + IFF_DRV_RUNNING = 0x40 + IFF_DYING = 0x200000 + IFF_KNOWSEPOCH = 0x20 + IFF_LINK0 = 0x1000 + IFF_LINK1 = 0x2000 + IFF_LINK2 = 0x4000 + IFF_LOOPBACK = 0x8 + IFF_MONITOR = 0x40000 + IFF_MULTICAST = 0x8000 + IFF_NOARP = 0x80 + IFF_NOGROUP = 0x800000 + IFF_OACTIVE = 0x400 + IFF_POINTOPOINT = 0x10 + IFF_PPROMISC = 0x20000 + IFF_PROMISC = 0x100 + IFF_RENAMING = 0x400000 + IFF_RUNNING = 0x40 + IFF_SIMPLEX = 0x800 + IFF_STATICARP = 0x80000 + IFF_UP = 0x1 + IFNAMSIZ = 0x10 + IFT_BRIDGE = 0xd1 + IFT_CARP = 0xf8 + IFT_IEEE1394 = 0x90 + IFT_INFINIBAND = 0xc7 + IFT_L2VLAN = 0x87 + IFT_L3IPVLAN = 0x88 + IFT_PPP = 0x17 + IFT_PROPVIRTUAL = 0x35 + IGNBRK = 0x1 + IGNCR = 0x80 + IGNPAR = 0x4 + IMAXBEL = 0x2000 + INLCR = 0x40 + INPCK = 0x10 + IN_CLASSA_HOST = 0xffffff + IN_CLASSA_MAX = 0x80 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 0x18 + IN_CLASSB_HOST = 0xffff + IN_CLASSB_MAX = 0x10000 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 0x10 + IN_CLASSC_HOST = 0xff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 0x8 + IN_CLASSD_HOST = 0xfffffff + IN_CLASSD_NET = 0xf0000000 + IN_CLASSD_NSHIFT = 0x1c + IN_LOOPBACKNET = 0x7f + IN_NETMASK_DEFAULT = 0xffffff00 + IN_RFC3021_MASK = 0xfffffffe + IPPROTO_3PC = 0x22 + IPPROTO_ADFS = 0x44 + IPPROTO_AH = 0x33 + IPPROTO_AHIP = 0x3d + IPPROTO_APES = 0x63 + IPPROTO_ARGUS = 0xd + IPPROTO_AX25 = 0x5d + IPPROTO_BHA = 0x31 + IPPROTO_BLT = 0x1e + IPPROTO_BRSATMON = 0x4c + IPPROTO_CARP = 0x70 + IPPROTO_CFTP = 0x3e + IPPROTO_CHAOS = 0x10 + IPPROTO_CMTP = 0x26 + IPPROTO_CPHB = 0x49 + IPPROTO_CPNX = 0x48 + IPPROTO_DCCP = 0x21 + IPPROTO_DDP = 0x25 + IPPROTO_DGP = 0x56 + IPPROTO_DIVERT = 0x102 + IPPROTO_DONE = 0x101 + IPPROTO_DSTOPTS = 0x3c + IPPROTO_EGP = 0x8 + IPPROTO_EMCON = 0xe + IPPROTO_ENCAP = 0x62 + IPPROTO_EON = 0x50 + IPPROTO_ESP = 0x32 + IPPROTO_ETHERIP = 0x61 + IPPROTO_FRAGMENT = 0x2c + IPPROTO_GGP = 0x3 + IPPROTO_GMTP = 0x64 + IPPROTO_GRE = 0x2f + IPPROTO_HELLO = 0x3f + IPPROTO_HIP = 0x8b + IPPROTO_HMP = 0x14 + IPPROTO_HOPOPTS = 0x0 + IPPROTO_ICMP = 0x1 + IPPROTO_ICMPV6 = 0x3a + IPPROTO_IDP = 0x16 + IPPROTO_IDPR = 0x23 + IPPROTO_IDRP = 0x2d + IPPROTO_IGMP = 0x2 + IPPROTO_IGP = 0x55 + IPPROTO_IGRP = 0x58 + IPPROTO_IL = 0x28 + IPPROTO_INLSP = 0x34 + IPPROTO_INP = 0x20 + IPPROTO_IP = 0x0 + IPPROTO_IPCOMP = 0x6c + IPPROTO_IPCV = 0x47 + IPPROTO_IPEIP = 0x5e + IPPROTO_IPIP = 0x4 + IPPROTO_IPPC = 0x43 + IPPROTO_IPV4 = 0x4 + IPPROTO_IPV6 = 0x29 + IPPROTO_IRTP = 0x1c + IPPROTO_KRYPTOLAN = 0x41 + IPPROTO_LARP = 0x5b + IPPROTO_LEAF1 = 0x19 + IPPROTO_LEAF2 = 0x1a + IPPROTO_MAX = 0x100 + IPPROTO_MEAS = 0x13 + IPPROTO_MH = 0x87 + IPPROTO_MHRP = 0x30 + IPPROTO_MICP = 0x5f + IPPROTO_MOBILE = 0x37 + IPPROTO_MPLS = 0x89 + IPPROTO_MTP = 0x5c + IPPROTO_MUX = 0x12 + IPPROTO_ND = 0x4d + IPPROTO_NHRP = 0x36 + IPPROTO_NONE = 0x3b + IPPROTO_NSP = 0x1f + IPPROTO_NVPII = 0xb + IPPROTO_OLD_DIVERT = 0xfe + IPPROTO_OSPFIGP = 0x59 + IPPROTO_PFSYNC = 0xf0 + IPPROTO_PGM = 0x71 + IPPROTO_PIGP = 0x9 + IPPROTO_PIM = 0x67 + IPPROTO_PRM = 0x15 + IPPROTO_PUP = 0xc + IPPROTO_PVP = 0x4b + IPPROTO_RAW = 0xff + IPPROTO_RCCMON = 0xa + IPPROTO_RDP = 0x1b + IPPROTO_RESERVED_253 = 0xfd + IPPROTO_RESERVED_254 = 0xfe + IPPROTO_ROUTING = 0x2b + IPPROTO_RSVP = 0x2e + IPPROTO_RVD = 0x42 + IPPROTO_SATEXPAK = 0x40 + IPPROTO_SATMON = 0x45 + IPPROTO_SCCSP = 0x60 + IPPROTO_SCTP = 0x84 + IPPROTO_SDRP = 0x2a + IPPROTO_SEND = 0x103 + IPPROTO_SHIM6 = 0x8c + IPPROTO_SKIP = 0x39 + IPPROTO_SPACER = 0x7fff + IPPROTO_SRPC = 0x5a + IPPROTO_ST = 0x7 + IPPROTO_SVMTP = 0x52 + IPPROTO_SWIPE = 0x35 + IPPROTO_TCF = 0x57 + IPPROTO_TCP = 0x6 + IPPROTO_TLSP = 0x38 + IPPROTO_TP = 0x1d + IPPROTO_TPXX = 0x27 + IPPROTO_TRUNK1 = 0x17 + IPPROTO_TRUNK2 = 0x18 + IPPROTO_TTP = 0x54 + IPPROTO_UDP = 0x11 + IPPROTO_UDPLITE = 0x88 + IPPROTO_VINES = 0x53 + IPPROTO_VISA = 0x46 + IPPROTO_VMTP = 0x51 + IPPROTO_WBEXPAK = 0x4f + IPPROTO_WBMON = 0x4e + IPPROTO_WSN = 0x4a + IPPROTO_XNET = 0xf + IPPROTO_XTP = 0x24 + IPV6_AUTOFLOWLABEL = 0x3b + IPV6_BINDANY = 0x40 + IPV6_BINDMULTI = 0x41 + IPV6_BINDV6ONLY = 0x1b + IPV6_CHECKSUM = 0x1a + IPV6_DEFAULT_MULTICAST_HOPS = 0x1 + IPV6_DEFAULT_MULTICAST_LOOP = 0x1 + IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 + IPV6_FLOWID = 0x43 + IPV6_FLOWINFO_MASK = 0xffffff0f + IPV6_FLOWLABEL_LEN = 0x14 + IPV6_FLOWLABEL_MASK = 0xffff0f00 + IPV6_FLOWTYPE = 0x44 + IPV6_FRAGTTL = 0x78 + IPV6_FW_ADD = 0x1e + IPV6_FW_DEL = 0x1f + IPV6_FW_FLUSH = 0x20 + IPV6_FW_GET = 0x22 + IPV6_FW_ZERO = 0x21 + IPV6_HLIMDEC = 0x1 + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 + IPV6_IPSEC_POLICY = 0x1c + IPV6_JOIN_GROUP = 0xc + IPV6_LEAVE_GROUP = 0xd + IPV6_MAXHLIM = 0xff + IPV6_MAXOPTHDR = 0x800 + IPV6_MAXPACKET = 0xffff + IPV6_MAX_GROUP_SRC_FILTER = 0x200 + IPV6_MAX_MEMBERSHIPS = 0xfff + IPV6_MAX_SOCK_SRC_FILTER = 0x80 + IPV6_MMTU = 0x500 + IPV6_MSFILTER = 0x4a + IPV6_MULTICAST_HOPS = 0xa + IPV6_MULTICAST_IF = 0x9 + IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_ORIGDSTADDR = 0x48 + IPV6_PATHMTU = 0x2c + IPV6_PKTINFO = 0x2e + IPV6_PORTRANGE = 0xe + IPV6_PORTRANGE_DEFAULT = 0x0 + IPV6_PORTRANGE_HIGH = 0x1 + IPV6_PORTRANGE_LOW = 0x2 + IPV6_PREFER_TEMPADDR = 0x3f + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVFLOWID = 0x46 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVORIGDSTADDR = 0x48 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x24 + IPV6_RECVRSSBUCKETID = 0x47 + IPV6_RECVRTHDR = 0x26 + IPV6_RECVTCLASS = 0x39 + IPV6_RSSBUCKETID = 0x45 + IPV6_RSS_LISTEN_BUCKET = 0x42 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x23 + IPV6_RTHDR_LOOSE = 0x0 + IPV6_RTHDR_STRICT = 0x1 + IPV6_RTHDR_TYPE_0 = 0x0 + IPV6_SOCKOPT_RESERVED1 = 0x3 + IPV6_TCLASS = 0x3d + IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a + IPV6_V6ONLY = 0x1b + IPV6_VERSION = 0x60 + IPV6_VERSION_MASK = 0xf0 + IPV6_VLAN_PCP = 0x4b + IP_ADD_MEMBERSHIP = 0xc + IP_ADD_SOURCE_MEMBERSHIP = 0x46 + IP_BINDANY = 0x18 + IP_BINDMULTI = 0x19 + IP_BLOCK_SOURCE = 0x48 + IP_DEFAULT_MULTICAST_LOOP = 0x1 + IP_DEFAULT_MULTICAST_TTL = 0x1 + IP_DF = 0x4000 + IP_DONTFRAG = 0x43 + IP_DROP_MEMBERSHIP = 0xd + IP_DROP_SOURCE_MEMBERSHIP = 0x47 + IP_DUMMYNET3 = 0x31 + IP_DUMMYNET_CONFIGURE = 0x3c + IP_DUMMYNET_DEL = 0x3d + IP_DUMMYNET_FLUSH = 0x3e + IP_DUMMYNET_GET = 0x40 + IP_FLOWID = 0x5a + IP_FLOWTYPE = 0x5b + IP_FW3 = 0x30 + IP_FW_ADD = 0x32 + IP_FW_DEL = 0x33 + IP_FW_FLUSH = 0x34 + IP_FW_GET = 0x36 + IP_FW_NAT_CFG = 0x38 + IP_FW_NAT_DEL = 0x39 + IP_FW_NAT_GET_CONFIG = 0x3a + IP_FW_NAT_GET_LOG = 0x3b + IP_FW_RESETLOG = 0x37 + IP_FW_TABLE_ADD = 0x28 + IP_FW_TABLE_DEL = 0x29 + IP_FW_TABLE_FLUSH = 0x2a + IP_FW_TABLE_GETSIZE = 0x2b + IP_FW_TABLE_LIST = 0x2c + IP_FW_ZERO = 0x35 + IP_HDRINCL = 0x2 + IP_IPSEC_POLICY = 0x15 + IP_MAXPACKET = 0xffff + IP_MAX_GROUP_SRC_FILTER = 0x200 + IP_MAX_MEMBERSHIPS = 0xfff + IP_MAX_SOCK_MUTE_FILTER = 0x80 + IP_MAX_SOCK_SRC_FILTER = 0x80 + IP_MF = 0x2000 + IP_MINTTL = 0x42 + IP_MSFILTER = 0x4a + IP_MSS = 0x240 + IP_MULTICAST_IF = 0x9 + IP_MULTICAST_LOOP = 0xb + IP_MULTICAST_TTL = 0xa + IP_MULTICAST_VIF = 0xe + IP_OFFMASK = 0x1fff + IP_ONESBCAST = 0x17 + IP_OPTIONS = 0x1 + IP_ORIGDSTADDR = 0x1b + IP_PORTRANGE = 0x13 + IP_PORTRANGE_DEFAULT = 0x0 + IP_PORTRANGE_HIGH = 0x1 + IP_PORTRANGE_LOW = 0x2 + IP_RECVDSTADDR = 0x7 + IP_RECVFLOWID = 0x5d + IP_RECVIF = 0x14 + IP_RECVOPTS = 0x5 + IP_RECVORIGDSTADDR = 0x1b + IP_RECVRETOPTS = 0x6 + IP_RECVRSSBUCKETID = 0x5e + IP_RECVTOS = 0x44 + IP_RECVTTL = 0x41 + IP_RETOPTS = 0x8 + IP_RF = 0x8000 + IP_RSSBUCKETID = 0x5c + IP_RSS_LISTEN_BUCKET = 0x1a + IP_RSVP_OFF = 0x10 + IP_RSVP_ON = 0xf + IP_RSVP_VIF_OFF = 0x12 + IP_RSVP_VIF_ON = 0x11 + IP_SENDSRCADDR = 0x7 + IP_TOS = 0x3 + IP_TTL = 0x4 + IP_UNBLOCK_SOURCE = 0x49 + IP_VLAN_PCP = 0x4b + ISIG = 0x80 + ISTRIP = 0x20 + ITIMER_PROF = 0x2 + ITIMER_REAL = 0x0 + ITIMER_VIRTUAL = 0x1 + IXANY = 0x800 + IXOFF = 0x400 + IXON = 0x200 + KERN_HOSTNAME = 0xa + KERN_OSRELEASE = 0x2 + KERN_OSTYPE = 0x1 + KERN_VERSION = 0x4 + LOCAL_CONNWAIT = 0x4 + LOCAL_CREDS = 0x2 + LOCAL_CREDS_PERSISTENT = 0x3 + LOCAL_PEERCRED = 0x1 + LOCAL_VENDOR = 0x80000000 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_SH = 0x1 + LOCK_UN = 0x8 + MADV_AUTOSYNC = 0x7 + MADV_CORE = 0x9 + MADV_DONTNEED = 0x4 + MADV_FREE = 0x5 + MADV_NOCORE = 0x8 + MADV_NORMAL = 0x0 + MADV_NOSYNC = 0x6 + MADV_PROTECT = 0xa + MADV_RANDOM = 0x1 + MADV_SEQUENTIAL = 0x2 + MADV_WILLNEED = 0x3 + MAP_32BIT = 0x80000 + MAP_ALIGNED_SUPER = 0x1000000 + MAP_ALIGNMENT_MASK = -0x1000000 + MAP_ALIGNMENT_SHIFT = 0x18 + MAP_ANON = 0x1000 + MAP_ANONYMOUS = 0x1000 + MAP_COPY = 0x2 + MAP_EXCL = 0x4000 + MAP_FILE = 0x0 + MAP_FIXED = 0x10 + MAP_GUARD = 0x2000 + MAP_HASSEMAPHORE = 0x200 + MAP_NOCORE = 0x20000 + MAP_NOSYNC = 0x800 + MAP_PREFAULT_READ = 0x40000 + MAP_PRIVATE = 0x2 + MAP_RESERVED0020 = 0x20 + MAP_RESERVED0040 = 0x40 + MAP_RESERVED0080 = 0x80 + MAP_RESERVED0100 = 0x100 + MAP_SHARED = 0x1 + MAP_STACK = 0x400 + MCAST_BLOCK_SOURCE = 0x54 + MCAST_EXCLUDE = 0x2 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x50 + MCAST_JOIN_SOURCE_GROUP = 0x52 + MCAST_LEAVE_GROUP = 0x51 + MCAST_LEAVE_SOURCE_GROUP = 0x53 + MCAST_UNBLOCK_SOURCE = 0x55 + MCAST_UNDEFINED = 0x0 + MCL_CURRENT = 0x1 + MCL_FUTURE = 0x2 + MFD_ALLOW_SEALING = 0x2 + MFD_CLOEXEC = 0x1 + MFD_HUGETLB = 0x4 + MFD_HUGE_16GB = -0x78000000 + MFD_HUGE_16MB = 0x60000000 + MFD_HUGE_1GB = 0x78000000 + MFD_HUGE_1MB = 0x50000000 + MFD_HUGE_256MB = 0x70000000 + MFD_HUGE_2GB = 0x7c000000 + MFD_HUGE_2MB = 0x54000000 + MFD_HUGE_32MB = 0x64000000 + MFD_HUGE_512KB = 0x4c000000 + MFD_HUGE_512MB = 0x74000000 + MFD_HUGE_64KB = 0x40000000 + MFD_HUGE_8MB = 0x5c000000 + MFD_HUGE_MASK = 0xfc000000 + MFD_HUGE_SHIFT = 0x1a + MNT_ACLS = 0x8000000 + MNT_ASYNC = 0x40 + MNT_AUTOMOUNTED = 0x200000000 + MNT_BYFSID = 0x8000000 + MNT_CMDFLAGS = 0x300d0f0000 + MNT_DEFEXPORTED = 0x200 + MNT_DELEXPORT = 0x20000 + MNT_EMPTYDIR = 0x2000000000 + MNT_EXKERB = 0x800 + MNT_EXPORTANON = 0x400 + MNT_EXPORTED = 0x100 + MNT_EXPUBLIC = 0x20000000 + MNT_EXRDONLY = 0x80 + MNT_EXTLS = 0x4000000000 + MNT_EXTLSCERT = 0x8000000000 + MNT_EXTLSCERTUSER = 0x10000000000 + MNT_FORCE = 0x80000 + MNT_GJOURNAL = 0x2000000 + MNT_IGNORE = 0x800000 + MNT_LAZY = 0x3 + MNT_LOCAL = 0x1000 + MNT_MULTILABEL = 0x4000000 + MNT_NFS4ACLS = 0x10 + MNT_NOATIME = 0x10000000 + MNT_NOCLUSTERR = 0x40000000 + MNT_NOCLUSTERW = 0x80000000 + MNT_NOCOVER = 0x1000000000 + MNT_NOEXEC = 0x4 + MNT_NONBUSY = 0x4000000 + MNT_NOSUID = 0x8 + MNT_NOSYMFOLLOW = 0x400000 + MNT_NOWAIT = 0x2 + MNT_QUOTA = 0x2000 + MNT_RDONLY = 0x1 + MNT_RELOAD = 0x40000 + MNT_ROOTFS = 0x4000 + MNT_SNAPSHOT = 0x1000000 + MNT_SOFTDEP = 0x200000 + MNT_SUIDDIR = 0x100000 + MNT_SUJ = 0x100000000 + MNT_SUSPEND = 0x4 + MNT_SYNCHRONOUS = 0x2 + MNT_UNION = 0x20 + MNT_UNTRUSTED = 0x800000000 + MNT_UPDATE = 0x10000 + MNT_UPDATEMASK = 0xad8d0807e + MNT_USER = 0x8000 + MNT_VERIFIED = 0x400000000 + MNT_VISFLAGMASK = 0xffef0ffff + MNT_WAIT = 0x1 + MSG_CMSG_CLOEXEC = 0x40000 + MSG_COMPAT = 0x8000 + MSG_CTRUNC = 0x20 + MSG_DONTROUTE = 0x4 + MSG_DONTWAIT = 0x80 + MSG_EOF = 0x100 + MSG_EOR = 0x8 + MSG_NBIO = 0x4000 + MSG_NOSIGNAL = 0x20000 + MSG_NOTIFICATION = 0x2000 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_TRUNC = 0x10 + MSG_WAITALL = 0x40 + MSG_WAITFORONE = 0x80000 + MS_ASYNC = 0x1 + MS_INVALIDATE = 0x2 + MS_SYNC = 0x0 + NAME_MAX = 0xff + NET_RT_DUMP = 0x1 + NET_RT_FLAGS = 0x2 + NET_RT_IFLIST = 0x3 + NET_RT_IFLISTL = 0x5 + NET_RT_IFMALIST = 0x4 + NET_RT_NHGRP = 0x7 + NET_RT_NHOP = 0x6 + NFDBITS = 0x40 + NOFLSH = 0x80000000 + NOKERNINFO = 0x2000000 + NOTE_ABSTIME = 0x10 + NOTE_ATTRIB = 0x8 + NOTE_CHILD = 0x4 + NOTE_CLOSE = 0x100 + NOTE_CLOSE_WRITE = 0x200 + NOTE_DELETE = 0x1 + NOTE_EXEC = 0x20000000 + NOTE_EXIT = 0x80000000 + NOTE_EXTEND = 0x4 + NOTE_FFAND = 0x40000000 + NOTE_FFCOPY = 0xc0000000 + NOTE_FFCTRLMASK = 0xc0000000 + NOTE_FFLAGSMASK = 0xffffff + NOTE_FFNOP = 0x0 + NOTE_FFOR = 0x80000000 + NOTE_FILE_POLL = 0x2 + NOTE_FORK = 0x40000000 + NOTE_LINK = 0x10 + NOTE_LOWAT = 0x1 + NOTE_MSECONDS = 0x2 + NOTE_NSECONDS = 0x8 + NOTE_OPEN = 0x80 + NOTE_PCTRLMASK = 0xf0000000 + NOTE_PDATAMASK = 0xfffff + NOTE_READ = 0x400 + NOTE_RENAME = 0x20 + NOTE_REVOKE = 0x40 + NOTE_SECONDS = 0x1 + NOTE_TRACK = 0x1 + NOTE_TRACKERR = 0x2 + NOTE_TRIGGER = 0x1000000 + NOTE_USECONDS = 0x4 + NOTE_WRITE = 0x2 + OCRNL = 0x10 + ONLCR = 0x2 + ONLRET = 0x40 + ONOCR = 0x20 + ONOEOT = 0x8 + OPOST = 0x1 + OXTABS = 0x4 + O_ACCMODE = 0x3 + O_APPEND = 0x8 + O_ASYNC = 0x40 + O_CLOEXEC = 0x100000 + O_CREAT = 0x200 + O_DIRECT = 0x10000 + O_DIRECTORY = 0x20000 + O_DSYNC = 0x1000000 + O_EMPTY_PATH = 0x2000000 + O_EXCL = 0x800 + O_EXEC = 0x40000 + O_EXLOCK = 0x20 + O_FSYNC = 0x80 + O_NDELAY = 0x4 + O_NOCTTY = 0x8000 + O_NOFOLLOW = 0x100 + O_NONBLOCK = 0x4 + O_PATH = 0x400000 + O_RDONLY = 0x0 + O_RDWR = 0x2 + O_RESOLVE_BENEATH = 0x800000 + O_SEARCH = 0x40000 + O_SHLOCK = 0x10 + O_SYNC = 0x80 + O_TRUNC = 0x400 + O_TTY_INIT = 0x80000 + O_VERIFY = 0x200000 + O_WRONLY = 0x1 + PARENB = 0x1000 + PARMRK = 0x8 + PARODD = 0x2000 + PENDIN = 0x20000000 + PIOD_READ_D = 0x1 + PIOD_READ_I = 0x3 + PIOD_WRITE_D = 0x2 + PIOD_WRITE_I = 0x4 + PRIO_PGRP = 0x1 + PRIO_PROCESS = 0x0 + PRIO_USER = 0x2 + PROT_EXEC = 0x4 + PROT_NONE = 0x0 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + PTRACE_DEFAULT = 0x1 + PTRACE_EXEC = 0x1 + PTRACE_FORK = 0x8 + PTRACE_LWP = 0x10 + PTRACE_SCE = 0x2 + PTRACE_SCX = 0x4 + PTRACE_SYSCALL = 0x6 + PTRACE_VFORK = 0x20 + PT_ATTACH = 0xa + PT_CLEARSTEP = 0x10 + PT_CONTINUE = 0x7 + PT_COREDUMP = 0x1d + PT_DETACH = 0xb + PT_FIRSTMACH = 0x40 + PT_FOLLOW_FORK = 0x17 + PT_GETDBREGS = 0x25 + PT_GETFPREGS = 0x23 + PT_GETLWPLIST = 0xf + PT_GETNUMLWPS = 0xe + PT_GETREGS = 0x21 + PT_GET_EVENT_MASK = 0x19 + PT_GET_SC_ARGS = 0x1b + PT_GET_SC_RET = 0x1c + PT_IO = 0xc + PT_KILL = 0x8 + PT_LWPINFO = 0xd + PT_LWP_EVENTS = 0x18 + PT_READ_D = 0x2 + PT_READ_I = 0x1 + PT_RESUME = 0x13 + PT_SETDBREGS = 0x26 + PT_SETFPREGS = 0x24 + PT_SETREGS = 0x22 + PT_SETSTEP = 0x11 + PT_SET_EVENT_MASK = 0x1a + PT_STEP = 0x9 + PT_SUSPEND = 0x12 + PT_SYSCALL = 0x16 + PT_TO_SCE = 0x14 + PT_TO_SCX = 0x15 + PT_TRACE_ME = 0x0 + PT_VM_ENTRY = 0x29 + PT_VM_TIMESTAMP = 0x28 + PT_WRITE_D = 0x5 + PT_WRITE_I = 0x4 + P_ZONEID = 0xc + RLIMIT_AS = 0xa + RLIMIT_CORE = 0x4 + RLIMIT_CPU = 0x0 + RLIMIT_DATA = 0x2 + RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 + RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 + RLIMIT_STACK = 0x3 + RLIM_INFINITY = 0x7fffffffffffffff + RTAX_AUTHOR = 0x6 + RTAX_BRD = 0x7 + RTAX_DST = 0x0 + RTAX_GATEWAY = 0x1 + RTAX_GENMASK = 0x3 + RTAX_IFA = 0x5 + RTAX_IFP = 0x4 + RTAX_MAX = 0x8 + RTAX_NETMASK = 0x2 + RTA_AUTHOR = 0x40 + RTA_BRD = 0x80 + RTA_DST = 0x1 + RTA_GATEWAY = 0x2 + RTA_GENMASK = 0x8 + RTA_IFA = 0x20 + RTA_IFP = 0x10 + RTA_NETMASK = 0x4 + RTF_BLACKHOLE = 0x1000 + RTF_BROADCAST = 0x400000 + RTF_DONE = 0x40 + RTF_DYNAMIC = 0x10 + RTF_FIXEDMTU = 0x80000 + RTF_FMASK = 0x1004d808 + RTF_GATEWAY = 0x2 + RTF_GWFLAG_COMPAT = 0x80000000 + RTF_HOST = 0x4 + RTF_LLDATA = 0x400 + RTF_LLINFO = 0x400 + RTF_LOCAL = 0x200000 + RTF_MODIFIED = 0x20 + RTF_MULTICAST = 0x800000 + RTF_PINNED = 0x100000 + RTF_PROTO1 = 0x8000 + RTF_PROTO2 = 0x4000 + RTF_PROTO3 = 0x40000 + RTF_REJECT = 0x8 + RTF_STATIC = 0x800 + RTF_STICKY = 0x10000000 + RTF_UP = 0x1 + RTF_XRESOLVE = 0x200 + RTM_ADD = 0x1 + RTM_CHANGE = 0x3 + RTM_DELADDR = 0xd + RTM_DELETE = 0x2 + RTM_DELMADDR = 0x10 + RTM_GET = 0x4 + RTM_IEEE80211 = 0x12 + RTM_IFANNOUNCE = 0x11 + RTM_IFINFO = 0xe + RTM_LOCK = 0x8 + RTM_LOSING = 0x5 + RTM_MISS = 0x7 + RTM_NEWADDR = 0xc + RTM_NEWMADDR = 0xf + RTM_REDIRECT = 0x6 + RTM_RESOLVE = 0xb + RTM_RTTUNIT = 0xf4240 + RTM_VERSION = 0x5 + RTV_EXPIRE = 0x4 + RTV_HOPCOUNT = 0x2 + RTV_MTU = 0x1 + RTV_RPIPE = 0x8 + RTV_RTT = 0x40 + RTV_RTTVAR = 0x80 + RTV_SPIPE = 0x10 + RTV_SSTHRESH = 0x20 + RTV_WEIGHT = 0x100 + RT_ALL_FIBS = -0x1 + RT_BLACKHOLE = 0x40 + RT_DEFAULT_FIB = 0x0 + RT_DEFAULT_WEIGHT = 0x1 + RT_HAS_GW = 0x80 + RT_HAS_HEADER = 0x10 + RT_HAS_HEADER_BIT = 0x4 + RT_L2_ME = 0x4 + RT_L2_ME_BIT = 0x2 + RT_LLE_CACHE = 0x100 + RT_MAX_WEIGHT = 0xffffff + RT_MAY_LOOP = 0x8 + RT_MAY_LOOP_BIT = 0x3 + RT_REJECT = 0x20 + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 + RUSAGE_THREAD = 0x1 + SCM_BINTIME = 0x4 + SCM_CREDS = 0x3 + SCM_CREDS2 = 0x8 + SCM_MONOTONIC = 0x6 + SCM_REALTIME = 0x5 + SCM_RIGHTS = 0x1 + SCM_TIMESTAMP = 0x2 + SCM_TIME_INFO = 0x7 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_SET = 0x0 + SHUT_RD = 0x0 + SHUT_RDWR = 0x2 + SHUT_WR = 0x1 + SIOCADDMULTI = 0x80206931 + SIOCAIFADDR = 0x8040691a + SIOCAIFGROUP = 0x80286987 + SIOCATMARK = 0x40047307 + SIOCDELMULTI = 0x80206932 + SIOCDIFADDR = 0x80206919 + SIOCDIFGROUP = 0x80286989 + SIOCDIFPHYADDR = 0x80206949 + SIOCGDRVSPEC = 0xc028697b + SIOCGETSGCNT = 0xc0207210 + SIOCGETVIFCNT = 0xc028720f + SIOCGHIWAT = 0x40047301 + SIOCGHWADDR = 0xc020693e + SIOCGI2C = 0xc020693d + SIOCGIFADDR = 0xc0206921 + SIOCGIFALIAS = 0xc044692d + SIOCGIFBRDADDR = 0xc0206923 + SIOCGIFCAP = 0xc020691f + SIOCGIFCONF = 0xc0106924 + SIOCGIFDATA = 0x8020692c + SIOCGIFDESCR = 0xc020692a + SIOCGIFDOWNREASON = 0xc058699a + SIOCGIFDSTADDR = 0xc0206922 + SIOCGIFFIB = 0xc020695c + SIOCGIFFLAGS = 0xc0206911 + SIOCGIFGENERIC = 0xc020693a + SIOCGIFGMEMB = 0xc028698a + SIOCGIFGROUP = 0xc0286988 + SIOCGIFINDEX = 0xc0206920 + SIOCGIFMAC = 0xc0206926 + SIOCGIFMEDIA = 0xc0306938 + SIOCGIFMETRIC = 0xc0206917 + SIOCGIFMTU = 0xc0206933 + SIOCGIFNETMASK = 0xc0206925 + SIOCGIFPDSTADDR = 0xc0206948 + SIOCGIFPHYS = 0xc0206935 + SIOCGIFPSRCADDR = 0xc0206947 + SIOCGIFRSSHASH = 0xc0186997 + SIOCGIFRSSKEY = 0xc0946996 + SIOCGIFSTATUS = 0xc331693b + SIOCGIFXMEDIA = 0xc030698b + SIOCGLANPCP = 0xc0206998 + SIOCGLOWAT = 0x40047303 + SIOCGPGRP = 0x40047309 + SIOCGPRIVATE_0 = 0xc0206950 + SIOCGPRIVATE_1 = 0xc0206951 + SIOCGTUNFIB = 0xc020695e + SIOCIFCREATE = 0xc020697a + SIOCIFCREATE2 = 0xc020697c + SIOCIFDESTROY = 0x80206979 + SIOCIFGCLONERS = 0xc0106978 + SIOCSDRVSPEC = 0x8028697b + SIOCSHIWAT = 0x80047300 + SIOCSIFADDR = 0x8020690c + SIOCSIFBRDADDR = 0x80206913 + SIOCSIFCAP = 0x8020691e + SIOCSIFDESCR = 0x80206929 + SIOCSIFDSTADDR = 0x8020690e + SIOCSIFFIB = 0x8020695d + SIOCSIFFLAGS = 0x80206910 + SIOCSIFGENERIC = 0x80206939 + SIOCSIFLLADDR = 0x8020693c + SIOCSIFMAC = 0x80206927 + SIOCSIFMEDIA = 0xc0206937 + SIOCSIFMETRIC = 0x80206918 + SIOCSIFMTU = 0x80206934 + SIOCSIFNAME = 0x80206928 + SIOCSIFNETMASK = 0x80206916 + SIOCSIFPHYADDR = 0x80406946 + SIOCSIFPHYS = 0x80206936 + SIOCSIFRVNET = 0xc020695b + SIOCSIFVNET = 0xc020695a + SIOCSLANPCP = 0x80206999 + SIOCSLOWAT = 0x80047302 + SIOCSPGRP = 0x80047308 + SIOCSTUNFIB = 0x8020695f + SOCK_CLOEXEC = 0x10000000 + SOCK_DGRAM = 0x2 + SOCK_MAXADDRLEN = 0xff + SOCK_NONBLOCK = 0x20000000 + SOCK_RAW = 0x3 + SOCK_RDM = 0x4 + SOCK_SEQPACKET = 0x5 + SOCK_STREAM = 0x1 + SOL_LOCAL = 0x0 + SOL_SOCKET = 0xffff + SOMAXCONN = 0x80 + SO_ACCEPTCONN = 0x2 + SO_ACCEPTFILTER = 0x1000 + SO_BINTIME = 0x2000 + SO_BROADCAST = 0x20 + SO_DEBUG = 0x1 + SO_DOMAIN = 0x1019 + SO_DONTROUTE = 0x10 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x8 + SO_LABEL = 0x1009 + SO_LINGER = 0x80 + SO_LISTENINCQLEN = 0x1013 + SO_LISTENQLEN = 0x1012 + SO_LISTENQLIMIT = 0x1011 + SO_MAX_PACING_RATE = 0x1018 + SO_NOSIGPIPE = 0x800 + SO_NO_DDP = 0x8000 + SO_NO_OFFLOAD = 0x4000 + SO_OOBINLINE = 0x100 + SO_PEERLABEL = 0x1010 + SO_PROTOCOL = 0x1016 + SO_PROTOTYPE = 0x1016 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x1006 + SO_RERROR = 0x20000 + SO_REUSEADDR = 0x4 + SO_REUSEPORT = 0x200 + SO_REUSEPORT_LB = 0x10000 + SO_SETFIB = 0x1014 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x1005 + SO_TIMESTAMP = 0x400 + SO_TS_BINTIME = 0x1 + SO_TS_CLOCK = 0x1017 + SO_TS_CLOCK_MAX = 0x3 + SO_TS_DEFAULT = 0x0 + SO_TS_MONOTONIC = 0x3 + SO_TS_REALTIME = 0x2 + SO_TS_REALTIME_MICRO = 0x0 + SO_TYPE = 0x1008 + SO_USELOOPBACK = 0x40 + SO_USER_COOKIE = 0x1015 + SO_VENDOR = 0x80000000 + S_BLKSIZE = 0x200 + S_IEXEC = 0x40 + S_IFBLK = 0x6000 + S_IFCHR = 0x2000 + S_IFDIR = 0x4000 + S_IFIFO = 0x1000 + S_IFLNK = 0xa000 + S_IFMT = 0xf000 + S_IFREG = 0x8000 + S_IFSOCK = 0xc000 + S_IFWHT = 0xe000 + S_IREAD = 0x100 + S_IRGRP = 0x20 + S_IROTH = 0x4 + S_IRUSR = 0x100 + S_IRWXG = 0x38 + S_IRWXO = 0x7 + S_IRWXU = 0x1c0 + S_ISGID = 0x400 + S_ISTXT = 0x200 + S_ISUID = 0x800 + S_ISVTX = 0x200 + S_IWGRP = 0x10 + S_IWOTH = 0x2 + S_IWRITE = 0x80 + S_IWUSR = 0x80 + S_IXGRP = 0x8 + S_IXOTH = 0x1 + S_IXUSR = 0x40 + TAB0 = 0x0 + TAB3 = 0x4 + TABDLY = 0x4 + TCIFLUSH = 0x1 + TCIOFF = 0x3 + TCIOFLUSH = 0x3 + TCION = 0x4 + TCOFLUSH = 0x2 + TCOOFF = 0x1 + TCOON = 0x2 + TCPOPT_EOL = 0x0 + TCPOPT_FAST_OPEN = 0x22 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_PAD = 0x0 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_WINDOW = 0x3 + TCP_BBR_ACK_COMP_ALG = 0x448 + TCP_BBR_ALGORITHM = 0x43b + TCP_BBR_DRAIN_INC_EXTRA = 0x43c + TCP_BBR_DRAIN_PG = 0x42e + TCP_BBR_EXTRA_GAIN = 0x449 + TCP_BBR_EXTRA_STATE = 0x453 + TCP_BBR_FLOOR_MIN_TSO = 0x454 + TCP_BBR_HDWR_PACE = 0x451 + TCP_BBR_HOLD_TARGET = 0x436 + TCP_BBR_IWINTSO = 0x42b + TCP_BBR_LOWGAIN_FD = 0x436 + TCP_BBR_LOWGAIN_HALF = 0x435 + TCP_BBR_LOWGAIN_THRESH = 0x434 + TCP_BBR_MAX_RTO = 0x439 + TCP_BBR_MIN_RTO = 0x438 + TCP_BBR_MIN_TOPACEOUT = 0x455 + TCP_BBR_ONE_RETRAN = 0x431 + TCP_BBR_PACE_CROSS = 0x442 + TCP_BBR_PACE_DEL_TAR = 0x43f + TCP_BBR_PACE_OH = 0x435 + TCP_BBR_PACE_PER_SEC = 0x43e + TCP_BBR_PACE_SEG_MAX = 0x440 + TCP_BBR_PACE_SEG_MIN = 0x441 + TCP_BBR_POLICER_DETECT = 0x457 + TCP_BBR_PROBE_RTT_GAIN = 0x44d + TCP_BBR_PROBE_RTT_INT = 0x430 + TCP_BBR_PROBE_RTT_LEN = 0x44e + TCP_BBR_RACK_INIT_RATE = 0x458 + TCP_BBR_RACK_RTT_USE = 0x44a + TCP_BBR_RECFORCE = 0x42c + TCP_BBR_REC_OVER_HPTS = 0x43a + TCP_BBR_RETRAN_WTSO = 0x44b + TCP_BBR_RWND_IS_APP = 0x42f + TCP_BBR_SEND_IWND_IN_TSO = 0x44f + TCP_BBR_STARTUP_EXIT_EPOCH = 0x43d + TCP_BBR_STARTUP_LOSS_EXIT = 0x432 + TCP_BBR_STARTUP_PG = 0x42d + TCP_BBR_TMR_PACE_OH = 0x448 + TCP_BBR_TSLIMITS = 0x434 + TCP_BBR_TSTMP_RAISES = 0x456 + TCP_BBR_UNLIMITED = 0x43b + TCP_BBR_USEDEL_RATE = 0x437 + TCP_BBR_USE_LOWGAIN = 0x433 + TCP_BBR_USE_RACK_CHEAT = 0x450 + TCP_BBR_USE_RACK_RR = 0x450 + TCP_BBR_UTTER_MAX_TSO = 0x452 + TCP_CA_NAME_MAX = 0x10 + TCP_CCALGOOPT = 0x41 + TCP_CONGESTION = 0x40 + TCP_DATA_AFTER_CLOSE = 0x44c + TCP_DEFER_OPTIONS = 0x470 + TCP_DELACK = 0x48 + TCP_FASTOPEN = 0x401 + TCP_FASTOPEN_MAX_COOKIE_LEN = 0x10 + TCP_FASTOPEN_MIN_COOKIE_LEN = 0x4 + TCP_FASTOPEN_PSK_LEN = 0x10 + TCP_FAST_RSM_HACK = 0x471 + TCP_FIN_IS_RST = 0x49 + TCP_FUNCTION_BLK = 0x2000 + TCP_FUNCTION_NAME_LEN_MAX = 0x20 + TCP_HDWR_RATE_CAP = 0x46a + TCP_HDWR_UP_ONLY = 0x46c + TCP_IDLE_REDUCE = 0x46 + TCP_INFO = 0x20 + TCP_IWND_NB = 0x2b + TCP_IWND_NSEG = 0x2c + TCP_KEEPCNT = 0x400 + TCP_KEEPIDLE = 0x100 + TCP_KEEPINIT = 0x80 + TCP_KEEPINTVL = 0x200 + TCP_LOG = 0x22 + TCP_LOGBUF = 0x23 + TCP_LOGDUMP = 0x25 + TCP_LOGDUMPID = 0x26 + TCP_LOGID = 0x24 + TCP_LOGID_CNT = 0x2e + TCP_LOG_ID_LEN = 0x40 + TCP_LOG_LIMIT = 0x4a + TCP_LOG_TAG = 0x2f + TCP_MAXBURST = 0x4 + TCP_MAXHLEN = 0x3c + TCP_MAXOLEN = 0x28 + TCP_MAXPEAKRATE = 0x45 + TCP_MAXSEG = 0x2 + TCP_MAXUNACKTIME = 0x44 + TCP_MAXWIN = 0xffff + TCP_MAX_SACK = 0x4 + TCP_MAX_WINSHIFT = 0xe + TCP_MD5SIG = 0x10 + TCP_MINMSS = 0xd8 + TCP_MSS = 0x218 + TCP_NODELAY = 0x1 + TCP_NOOPT = 0x8 + TCP_NOPUSH = 0x4 + TCP_NO_PRR = 0x462 + TCP_PACING_RATE_CAP = 0x46b + TCP_PCAP_IN = 0x1000 + TCP_PCAP_OUT = 0x800 + TCP_PERF_INFO = 0x4e + TCP_PROC_ACCOUNTING = 0x4c + TCP_RACK_ABC_VAL = 0x46d + TCP_RACK_CHEAT_NOT_CONF_RATE = 0x459 + TCP_RACK_DO_DETECTION = 0x449 + TCP_RACK_EARLY_RECOV = 0x423 + TCP_RACK_EARLY_SEG = 0x424 + TCP_RACK_FORCE_MSEG = 0x45d + TCP_RACK_GP_INCREASE = 0x446 + TCP_RACK_GP_INCREASE_CA = 0x45a + TCP_RACK_GP_INCREASE_REC = 0x45c + TCP_RACK_GP_INCREASE_SS = 0x45b + TCP_RACK_IDLE_REDUCE_HIGH = 0x444 + TCP_RACK_MBUF_QUEUE = 0x41a + TCP_RACK_MEASURE_CNT = 0x46f + TCP_RACK_MIN_PACE = 0x445 + TCP_RACK_MIN_PACE_SEG = 0x446 + TCP_RACK_MIN_TO = 0x422 + TCP_RACK_NONRXT_CFG_RATE = 0x463 + TCP_RACK_NO_PUSH_AT_MAX = 0x466 + TCP_RACK_PACE_ALWAYS = 0x41f + TCP_RACK_PACE_MAX_SEG = 0x41e + TCP_RACK_PACE_RATE_CA = 0x45e + TCP_RACK_PACE_RATE_REC = 0x460 + TCP_RACK_PACE_RATE_SS = 0x45f + TCP_RACK_PACE_REDUCE = 0x41d + TCP_RACK_PACE_TO_FILL = 0x467 + TCP_RACK_PACING_BETA = 0x472 + TCP_RACK_PACING_BETA_ECN = 0x473 + TCP_RACK_PKT_DELAY = 0x428 + TCP_RACK_PROFILE = 0x469 + TCP_RACK_PROP = 0x41b + TCP_RACK_PROP_RATE = 0x420 + TCP_RACK_PRR_SENDALOT = 0x421 + TCP_RACK_REORD_FADE = 0x426 + TCP_RACK_REORD_THRESH = 0x425 + TCP_RACK_RR_CONF = 0x459 + TCP_RACK_TIMER_SLOP = 0x474 + TCP_RACK_TLP_INC_VAR = 0x429 + TCP_RACK_TLP_REDUCE = 0x41c + TCP_RACK_TLP_THRESH = 0x427 + TCP_RACK_TLP_USE = 0x447 + TCP_REC_ABC_VAL = 0x46e + TCP_REMOTE_UDP_ENCAPS_PORT = 0x47 + TCP_REUSPORT_LB_NUMA = 0x402 + TCP_REUSPORT_LB_NUMA_CURDOM = -0x1 + TCP_REUSPORT_LB_NUMA_NODOM = -0x2 + TCP_RXTLS_ENABLE = 0x29 + TCP_RXTLS_MODE = 0x2a + TCP_SHARED_CWND_ALLOWED = 0x4b + TCP_SHARED_CWND_ENABLE = 0x464 + TCP_SHARED_CWND_TIME_LIMIT = 0x468 + TCP_STATS = 0x21 + TCP_TIMELY_DYN_ADJ = 0x465 + TCP_TLS_MODE_IFNET = 0x2 + TCP_TLS_MODE_NONE = 0x0 + TCP_TLS_MODE_SW = 0x1 + TCP_TLS_MODE_TOE = 0x3 + TCP_TXTLS_ENABLE = 0x27 + TCP_TXTLS_MODE = 0x28 + TCP_USER_LOG = 0x30 + TCP_USE_CMP_ACKS = 0x4d + TCP_VENDOR = 0x80000000 + TCSAFLUSH = 0x2 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCONS = 0x80047462 + TIOCDRAIN = 0x2000745e + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLUSH = 0x80047410 + TIOCGDRAINWAIT = 0x40047456 + TIOCGETA = 0x402c7413 + TIOCGETD = 0x4004741a + TIOCGPGRP = 0x40047477 + TIOCGPTN = 0x4004740f + TIOCGSID = 0x40047463 + TIOCGWINSZ = 0x40087468 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGDTRWAIT = 0x4004745a + TIOCMGET = 0x4004746a + TIOCMSDTRWAIT = 0x8004745b + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DCD = 0x40 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0x0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCPTMASTER = 0x2000741c + TIOCSBRK = 0x2000747b + TIOCSCTTY = 0x20007461 + TIOCSDRAINWAIT = 0x80047457 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x802c7414 + TIOCSETAF = 0x802c7416 + TIOCSETAW = 0x802c7415 + TIOCSETD = 0x8004741b + TIOCSIG = 0x2004745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTI = 0x80017472 + TIOCSTOP = 0x2000746f + TIOCSWINSZ = 0x80087467 + TIOCTIMESTAMP = 0x40107459 + TIOCUCNTL = 0x80047466 + TOSTOP = 0x400000 + UTIME_NOW = -0x1 + UTIME_OMIT = -0x2 + VDISCARD = 0xf + VDSUSP = 0xb + VEOF = 0x0 + VEOL = 0x1 + VEOL2 = 0x2 + VERASE = 0x3 + VERASE2 = 0x7 + VINTR = 0x8 + VKILL = 0x5 + VLNEXT = 0xe + VMIN = 0x10 + VQUIT = 0x9 + VREPRINT = 0x6 + VSTART = 0xc + VSTATUS = 0x12 + VSTOP = 0xd + VSUSP = 0xa + VTIME = 0x11 + VWERASE = 0x4 + WCONTINUED = 0x4 + WCOREFLAG = 0x80 + WEXITED = 0x10 + WLINUXCLONE = 0x80000000 + WNOHANG = 0x1 + WNOWAIT = 0x8 + WSTOPPED = 0x2 + WTRAPPED = 0x20 + WUNTRACED = 0x2 +) + +// Errors +const ( + E2BIG = syscall.Errno(0x7) + EACCES = syscall.Errno(0xd) + EADDRINUSE = syscall.Errno(0x30) + EADDRNOTAVAIL = syscall.Errno(0x31) + EAFNOSUPPORT = syscall.Errno(0x2f) + EAGAIN = syscall.Errno(0x23) + EALREADY = syscall.Errno(0x25) + EAUTH = syscall.Errno(0x50) + EBADF = syscall.Errno(0x9) + EBADMSG = syscall.Errno(0x59) + EBADRPC = syscall.Errno(0x48) + EBUSY = syscall.Errno(0x10) + ECANCELED = syscall.Errno(0x55) + ECAPMODE = syscall.Errno(0x5e) + ECHILD = syscall.Errno(0xa) + ECONNABORTED = syscall.Errno(0x35) + ECONNREFUSED = syscall.Errno(0x3d) + ECONNRESET = syscall.Errno(0x36) + EDEADLK = syscall.Errno(0xb) + EDESTADDRREQ = syscall.Errno(0x27) + EDOM = syscall.Errno(0x21) + EDOOFUS = syscall.Errno(0x58) + EDQUOT = syscall.Errno(0x45) + EEXIST = syscall.Errno(0x11) + EFAULT = syscall.Errno(0xe) + EFBIG = syscall.Errno(0x1b) + EFTYPE = syscall.Errno(0x4f) + EHOSTDOWN = syscall.Errno(0x40) + EHOSTUNREACH = syscall.Errno(0x41) + EIDRM = syscall.Errno(0x52) + EILSEQ = syscall.Errno(0x56) + EINPROGRESS = syscall.Errno(0x24) + EINTEGRITY = syscall.Errno(0x61) + EINTR = syscall.Errno(0x4) + EINVAL = syscall.Errno(0x16) + EIO = syscall.Errno(0x5) + EISCONN = syscall.Errno(0x38) + EISDIR = syscall.Errno(0x15) + ELAST = syscall.Errno(0x61) + ELOOP = syscall.Errno(0x3e) + EMFILE = syscall.Errno(0x18) + EMLINK = syscall.Errno(0x1f) + EMSGSIZE = syscall.Errno(0x28) + EMULTIHOP = syscall.Errno(0x5a) + ENAMETOOLONG = syscall.Errno(0x3f) + ENEEDAUTH = syscall.Errno(0x51) + ENETDOWN = syscall.Errno(0x32) + ENETRESET = syscall.Errno(0x34) + ENETUNREACH = syscall.Errno(0x33) + ENFILE = syscall.Errno(0x17) + ENOATTR = syscall.Errno(0x57) + ENOBUFS = syscall.Errno(0x37) + ENODEV = syscall.Errno(0x13) + ENOENT = syscall.Errno(0x2) + ENOEXEC = syscall.Errno(0x8) + ENOLCK = syscall.Errno(0x4d) + ENOLINK = syscall.Errno(0x5b) + ENOMEM = syscall.Errno(0xc) + ENOMSG = syscall.Errno(0x53) + ENOPROTOOPT = syscall.Errno(0x2a) + ENOSPC = syscall.Errno(0x1c) + ENOSYS = syscall.Errno(0x4e) + ENOTBLK = syscall.Errno(0xf) + ENOTCAPABLE = syscall.Errno(0x5d) + ENOTCONN = syscall.Errno(0x39) + ENOTDIR = syscall.Errno(0x14) + ENOTEMPTY = syscall.Errno(0x42) + ENOTRECOVERABLE = syscall.Errno(0x5f) + ENOTSOCK = syscall.Errno(0x26) + ENOTSUP = syscall.Errno(0x2d) + ENOTTY = syscall.Errno(0x19) + ENXIO = syscall.Errno(0x6) + EOPNOTSUPP = syscall.Errno(0x2d) + EOVERFLOW = syscall.Errno(0x54) + EOWNERDEAD = syscall.Errno(0x60) + EPERM = syscall.Errno(0x1) + EPFNOSUPPORT = syscall.Errno(0x2e) + EPIPE = syscall.Errno(0x20) + EPROCLIM = syscall.Errno(0x43) + EPROCUNAVAIL = syscall.Errno(0x4c) + EPROGMISMATCH = syscall.Errno(0x4b) + EPROGUNAVAIL = syscall.Errno(0x4a) + EPROTO = syscall.Errno(0x5c) + EPROTONOSUPPORT = syscall.Errno(0x2b) + EPROTOTYPE = syscall.Errno(0x29) + ERANGE = syscall.Errno(0x22) + EREMOTE = syscall.Errno(0x47) + EROFS = syscall.Errno(0x1e) + ERPCMISMATCH = syscall.Errno(0x49) + ESHUTDOWN = syscall.Errno(0x3a) + ESOCKTNOSUPPORT = syscall.Errno(0x2c) + ESPIPE = syscall.Errno(0x1d) + ESRCH = syscall.Errno(0x3) + ESTALE = syscall.Errno(0x46) + ETIMEDOUT = syscall.Errno(0x3c) + ETOOMANYREFS = syscall.Errno(0x3b) + ETXTBSY = syscall.Errno(0x1a) + EUSERS = syscall.Errno(0x44) + EWOULDBLOCK = syscall.Errno(0x23) + EXDEV = syscall.Errno(0x12) +) + +// Signals +const ( + SIGABRT = syscall.Signal(0x6) + SIGALRM = syscall.Signal(0xe) + SIGBUS = syscall.Signal(0xa) + SIGCHLD = syscall.Signal(0x14) + SIGCONT = syscall.Signal(0x13) + SIGEMT = syscall.Signal(0x7) + SIGFPE = syscall.Signal(0x8) + SIGHUP = syscall.Signal(0x1) + SIGILL = syscall.Signal(0x4) + SIGINFO = syscall.Signal(0x1d) + SIGINT = syscall.Signal(0x2) + SIGIO = syscall.Signal(0x17) + SIGIOT = syscall.Signal(0x6) + SIGKILL = syscall.Signal(0x9) + SIGLIBRT = syscall.Signal(0x21) + SIGLWP = syscall.Signal(0x20) + SIGPIPE = syscall.Signal(0xd) + SIGPROF = syscall.Signal(0x1b) + SIGQUIT = syscall.Signal(0x3) + SIGSEGV = syscall.Signal(0xb) + SIGSTOP = syscall.Signal(0x11) + SIGSYS = syscall.Signal(0xc) + SIGTERM = syscall.Signal(0xf) + SIGTHR = syscall.Signal(0x20) + SIGTRAP = syscall.Signal(0x5) + SIGTSTP = syscall.Signal(0x12) + SIGTTIN = syscall.Signal(0x15) + SIGTTOU = syscall.Signal(0x16) + SIGURG = syscall.Signal(0x10) + SIGUSR1 = syscall.Signal(0x1e) + SIGUSR2 = syscall.Signal(0x1f) + SIGVTALRM = syscall.Signal(0x1a) + SIGWINCH = syscall.Signal(0x1c) + SIGXCPU = syscall.Signal(0x18) + SIGXFSZ = syscall.Signal(0x19) +) + +// Error table +var errorList = [...]struct { + num syscall.Errno + name string + desc string +}{ + {1, "EPERM", "operation not permitted"}, + {2, "ENOENT", "no such file or directory"}, + {3, "ESRCH", "no such process"}, + {4, "EINTR", "interrupted system call"}, + {5, "EIO", "input/output error"}, + {6, "ENXIO", "device not configured"}, + {7, "E2BIG", "argument list too long"}, + {8, "ENOEXEC", "exec format error"}, + {9, "EBADF", "bad file descriptor"}, + {10, "ECHILD", "no child processes"}, + {11, "EDEADLK", "resource deadlock avoided"}, + {12, "ENOMEM", "cannot allocate memory"}, + {13, "EACCES", "permission denied"}, + {14, "EFAULT", "bad address"}, + {15, "ENOTBLK", "block device required"}, + {16, "EBUSY", "device busy"}, + {17, "EEXIST", "file exists"}, + {18, "EXDEV", "cross-device link"}, + {19, "ENODEV", "operation not supported by device"}, + {20, "ENOTDIR", "not a directory"}, + {21, "EISDIR", "is a directory"}, + {22, "EINVAL", "invalid argument"}, + {23, "ENFILE", "too many open files in system"}, + {24, "EMFILE", "too many open files"}, + {25, "ENOTTY", "inappropriate ioctl for device"}, + {26, "ETXTBSY", "text file busy"}, + {27, "EFBIG", "file too large"}, + {28, "ENOSPC", "no space left on device"}, + {29, "ESPIPE", "illegal seek"}, + {30, "EROFS", "read-only file system"}, + {31, "EMLINK", "too many links"}, + {32, "EPIPE", "broken pipe"}, + {33, "EDOM", "numerical argument out of domain"}, + {34, "ERANGE", "result too large"}, + {35, "EWOULDBLOCK", "resource temporarily unavailable"}, + {36, "EINPROGRESS", "operation now in progress"}, + {37, "EALREADY", "operation already in progress"}, + {38, "ENOTSOCK", "socket operation on non-socket"}, + {39, "EDESTADDRREQ", "destination address required"}, + {40, "EMSGSIZE", "message too long"}, + {41, "EPROTOTYPE", "protocol wrong type for socket"}, + {42, "ENOPROTOOPT", "protocol not available"}, + {43, "EPROTONOSUPPORT", "protocol not supported"}, + {44, "ESOCKTNOSUPPORT", "socket type not supported"}, + {45, "EOPNOTSUPP", "operation not supported"}, + {46, "EPFNOSUPPORT", "protocol family not supported"}, + {47, "EAFNOSUPPORT", "address family not supported by protocol family"}, + {48, "EADDRINUSE", "address already in use"}, + {49, "EADDRNOTAVAIL", "can't assign requested address"}, + {50, "ENETDOWN", "network is down"}, + {51, "ENETUNREACH", "network is unreachable"}, + {52, "ENETRESET", "network dropped connection on reset"}, + {53, "ECONNABORTED", "software caused connection abort"}, + {54, "ECONNRESET", "connection reset by peer"}, + {55, "ENOBUFS", "no buffer space available"}, + {56, "EISCONN", "socket is already connected"}, + {57, "ENOTCONN", "socket is not connected"}, + {58, "ESHUTDOWN", "can't send after socket shutdown"}, + {59, "ETOOMANYREFS", "too many references: can't splice"}, + {60, "ETIMEDOUT", "operation timed out"}, + {61, "ECONNREFUSED", "connection refused"}, + {62, "ELOOP", "too many levels of symbolic links"}, + {63, "ENAMETOOLONG", "file name too long"}, + {64, "EHOSTDOWN", "host is down"}, + {65, "EHOSTUNREACH", "no route to host"}, + {66, "ENOTEMPTY", "directory not empty"}, + {67, "EPROCLIM", "too many processes"}, + {68, "EUSERS", "too many users"}, + {69, "EDQUOT", "disc quota exceeded"}, + {70, "ESTALE", "stale NFS file handle"}, + {71, "EREMOTE", "too many levels of remote in path"}, + {72, "EBADRPC", "RPC struct is bad"}, + {73, "ERPCMISMATCH", "RPC version wrong"}, + {74, "EPROGUNAVAIL", "RPC prog. not avail"}, + {75, "EPROGMISMATCH", "program version wrong"}, + {76, "EPROCUNAVAIL", "bad procedure for program"}, + {77, "ENOLCK", "no locks available"}, + {78, "ENOSYS", "function not implemented"}, + {79, "EFTYPE", "inappropriate file type or format"}, + {80, "EAUTH", "authentication error"}, + {81, "ENEEDAUTH", "need authenticator"}, + {82, "EIDRM", "identifier removed"}, + {83, "ENOMSG", "no message of desired type"}, + {84, "EOVERFLOW", "value too large to be stored in data type"}, + {85, "ECANCELED", "operation canceled"}, + {86, "EILSEQ", "illegal byte sequence"}, + {87, "ENOATTR", "attribute not found"}, + {88, "EDOOFUS", "programming error"}, + {89, "EBADMSG", "bad message"}, + {90, "EMULTIHOP", "multihop attempted"}, + {91, "ENOLINK", "link has been severed"}, + {92, "EPROTO", "protocol error"}, + {93, "ENOTCAPABLE", "capabilities insufficient"}, + {94, "ECAPMODE", "not permitted in capability mode"}, + {95, "ENOTRECOVERABLE", "state not recoverable"}, + {96, "EOWNERDEAD", "previous owner died"}, + {97, "EINTEGRITY", "integrity check failed"}, +} + +// Signal table +var signalList = [...]struct { + num syscall.Signal + name string + desc string +}{ + {1, "SIGHUP", "hangup"}, + {2, "SIGINT", "interrupt"}, + {3, "SIGQUIT", "quit"}, + {4, "SIGILL", "illegal instruction"}, + {5, "SIGTRAP", "trace/BPT trap"}, + {6, "SIGIOT", "abort trap"}, + {7, "SIGEMT", "EMT trap"}, + {8, "SIGFPE", "floating point exception"}, + {9, "SIGKILL", "killed"}, + {10, "SIGBUS", "bus error"}, + {11, "SIGSEGV", "segmentation fault"}, + {12, "SIGSYS", "bad system call"}, + {13, "SIGPIPE", "broken pipe"}, + {14, "SIGALRM", "alarm clock"}, + {15, "SIGTERM", "terminated"}, + {16, "SIGURG", "urgent I/O condition"}, + {17, "SIGSTOP", "suspended (signal)"}, + {18, "SIGTSTP", "suspended"}, + {19, "SIGCONT", "continued"}, + {20, "SIGCHLD", "child exited"}, + {21, "SIGTTIN", "stopped (tty input)"}, + {22, "SIGTTOU", "stopped (tty output)"}, + {23, "SIGIO", "I/O possible"}, + {24, "SIGXCPU", "cputime limit exceeded"}, + {25, "SIGXFSZ", "filesize limit exceeded"}, + {26, "SIGVTALRM", "virtual timer expired"}, + {27, "SIGPROF", "profiling timer expired"}, + {28, "SIGWINCH", "window size changes"}, + {29, "SIGINFO", "information request"}, + {30, "SIGUSR1", "user defined signal 1"}, + {31, "SIGUSR2", "user defined signal 2"}, + {32, "SIGTHR", "unknown signal"}, + {33, "SIGLIBRT", "unknown signal"}, +} diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index c0a43f8ba6fc..785d693eb328 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -140,6 +140,306 @@ const ( ARPHRD_VOID = 0xffff ARPHRD_VSOCKMON = 0x33a ARPHRD_X25 = 0x10f + AUDIT_ADD = 0x3eb + AUDIT_ADD_RULE = 0x3f3 + AUDIT_ALWAYS = 0x2 + AUDIT_ANOM_ABEND = 0x6a5 + AUDIT_ANOM_CREAT = 0x6a7 + AUDIT_ANOM_LINK = 0x6a6 + AUDIT_ANOM_PROMISCUOUS = 0x6a4 + AUDIT_ARCH = 0xb + AUDIT_ARCH_AARCH64 = 0xc00000b7 + AUDIT_ARCH_ALPHA = 0xc0009026 + AUDIT_ARCH_ARCOMPACT = 0x4000005d + AUDIT_ARCH_ARCOMPACTBE = 0x5d + AUDIT_ARCH_ARCV2 = 0x400000c3 + AUDIT_ARCH_ARCV2BE = 0xc3 + AUDIT_ARCH_ARM = 0x40000028 + AUDIT_ARCH_ARMEB = 0x28 + AUDIT_ARCH_C6X = 0x4000008c + AUDIT_ARCH_C6XBE = 0x8c + AUDIT_ARCH_CRIS = 0x4000004c + AUDIT_ARCH_CSKY = 0x400000fc + AUDIT_ARCH_FRV = 0x5441 + AUDIT_ARCH_H8300 = 0x2e + AUDIT_ARCH_HEXAGON = 0xa4 + AUDIT_ARCH_I386 = 0x40000003 + AUDIT_ARCH_IA64 = 0xc0000032 + AUDIT_ARCH_LOONGARCH32 = 0x40000102 + AUDIT_ARCH_LOONGARCH64 = 0xc0000102 + AUDIT_ARCH_M32R = 0x58 + AUDIT_ARCH_M68K = 0x4 + AUDIT_ARCH_MICROBLAZE = 0xbd + AUDIT_ARCH_MIPS = 0x8 + AUDIT_ARCH_MIPS64 = 0x80000008 + AUDIT_ARCH_MIPS64N32 = 0xa0000008 + AUDIT_ARCH_MIPSEL = 0x40000008 + AUDIT_ARCH_MIPSEL64 = 0xc0000008 + AUDIT_ARCH_MIPSEL64N32 = 0xe0000008 + AUDIT_ARCH_NDS32 = 0x400000a7 + AUDIT_ARCH_NDS32BE = 0xa7 + AUDIT_ARCH_NIOS2 = 0x40000071 + AUDIT_ARCH_OPENRISC = 0x5c + AUDIT_ARCH_PARISC = 0xf + AUDIT_ARCH_PARISC64 = 0x8000000f + AUDIT_ARCH_PPC = 0x14 + AUDIT_ARCH_PPC64 = 0x80000015 + AUDIT_ARCH_PPC64LE = 0xc0000015 + AUDIT_ARCH_RISCV32 = 0x400000f3 + AUDIT_ARCH_RISCV64 = 0xc00000f3 + AUDIT_ARCH_S390 = 0x16 + AUDIT_ARCH_S390X = 0x80000016 + AUDIT_ARCH_SH = 0x2a + AUDIT_ARCH_SH64 = 0x8000002a + AUDIT_ARCH_SHEL = 0x4000002a + AUDIT_ARCH_SHEL64 = 0xc000002a + AUDIT_ARCH_SPARC = 0x2 + AUDIT_ARCH_SPARC64 = 0x8000002b + AUDIT_ARCH_TILEGX = 0xc00000bf + AUDIT_ARCH_TILEGX32 = 0x400000bf + AUDIT_ARCH_TILEPRO = 0x400000bc + AUDIT_ARCH_UNICORE = 0x4000006e + AUDIT_ARCH_X86_64 = 0xc000003e + AUDIT_ARCH_XTENSA = 0x5e + AUDIT_ARG0 = 0xc8 + AUDIT_ARG1 = 0xc9 + AUDIT_ARG2 = 0xca + AUDIT_ARG3 = 0xcb + AUDIT_AVC = 0x578 + AUDIT_AVC_PATH = 0x57a + AUDIT_BITMASK_SIZE = 0x40 + AUDIT_BIT_MASK = 0x8000000 + AUDIT_BIT_TEST = 0x48000000 + AUDIT_BPF = 0x536 + AUDIT_BPRM_FCAPS = 0x529 + AUDIT_CAPSET = 0x52a + AUDIT_CLASS_CHATTR = 0x2 + AUDIT_CLASS_CHATTR_32 = 0x3 + AUDIT_CLASS_DIR_WRITE = 0x0 + AUDIT_CLASS_DIR_WRITE_32 = 0x1 + AUDIT_CLASS_READ = 0x4 + AUDIT_CLASS_READ_32 = 0x5 + AUDIT_CLASS_SIGNAL = 0x8 + AUDIT_CLASS_SIGNAL_32 = 0x9 + AUDIT_CLASS_WRITE = 0x6 + AUDIT_CLASS_WRITE_32 = 0x7 + AUDIT_COMPARE_AUID_TO_EUID = 0x10 + AUDIT_COMPARE_AUID_TO_FSUID = 0xe + AUDIT_COMPARE_AUID_TO_OBJ_UID = 0x5 + AUDIT_COMPARE_AUID_TO_SUID = 0xf + AUDIT_COMPARE_EGID_TO_FSGID = 0x17 + AUDIT_COMPARE_EGID_TO_OBJ_GID = 0x4 + AUDIT_COMPARE_EGID_TO_SGID = 0x18 + AUDIT_COMPARE_EUID_TO_FSUID = 0x12 + AUDIT_COMPARE_EUID_TO_OBJ_UID = 0x3 + AUDIT_COMPARE_EUID_TO_SUID = 0x11 + AUDIT_COMPARE_FSGID_TO_OBJ_GID = 0x9 + AUDIT_COMPARE_FSUID_TO_OBJ_UID = 0x8 + AUDIT_COMPARE_GID_TO_EGID = 0x14 + AUDIT_COMPARE_GID_TO_FSGID = 0x15 + AUDIT_COMPARE_GID_TO_OBJ_GID = 0x2 + AUDIT_COMPARE_GID_TO_SGID = 0x16 + AUDIT_COMPARE_SGID_TO_FSGID = 0x19 + AUDIT_COMPARE_SGID_TO_OBJ_GID = 0x7 + AUDIT_COMPARE_SUID_TO_FSUID = 0x13 + AUDIT_COMPARE_SUID_TO_OBJ_UID = 0x6 + AUDIT_COMPARE_UID_TO_AUID = 0xa + AUDIT_COMPARE_UID_TO_EUID = 0xb + AUDIT_COMPARE_UID_TO_FSUID = 0xc + AUDIT_COMPARE_UID_TO_OBJ_UID = 0x1 + AUDIT_COMPARE_UID_TO_SUID = 0xd + AUDIT_CONFIG_CHANGE = 0x519 + AUDIT_CWD = 0x51b + AUDIT_DAEMON_ABORT = 0x4b2 + AUDIT_DAEMON_CONFIG = 0x4b3 + AUDIT_DAEMON_END = 0x4b1 + AUDIT_DAEMON_START = 0x4b0 + AUDIT_DEL = 0x3ec + AUDIT_DEL_RULE = 0x3f4 + AUDIT_DEVMAJOR = 0x64 + AUDIT_DEVMINOR = 0x65 + AUDIT_DIR = 0x6b + AUDIT_DM_CTRL = 0x53a + AUDIT_DM_EVENT = 0x53b + AUDIT_EGID = 0x6 + AUDIT_EOE = 0x528 + AUDIT_EQUAL = 0x40000000 + AUDIT_EUID = 0x2 + AUDIT_EVENT_LISTENER = 0x537 + AUDIT_EXE = 0x70 + AUDIT_EXECVE = 0x51d + AUDIT_EXIT = 0x67 + AUDIT_FAIL_PANIC = 0x2 + AUDIT_FAIL_PRINTK = 0x1 + AUDIT_FAIL_SILENT = 0x0 + AUDIT_FANOTIFY = 0x533 + AUDIT_FD_PAIR = 0x525 + AUDIT_FEATURE_BITMAP_ALL = 0x7f + AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT = 0x1 + AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME = 0x2 + AUDIT_FEATURE_BITMAP_EXCLUDE_EXTEND = 0x8 + AUDIT_FEATURE_BITMAP_EXECUTABLE_PATH = 0x4 + AUDIT_FEATURE_BITMAP_FILTER_FS = 0x40 + AUDIT_FEATURE_BITMAP_LOST_RESET = 0x20 + AUDIT_FEATURE_BITMAP_SESSIONID_FILTER = 0x10 + AUDIT_FEATURE_CHANGE = 0x530 + AUDIT_FEATURE_LOGINUID_IMMUTABLE = 0x1 + AUDIT_FEATURE_ONLY_UNSET_LOGINUID = 0x0 + AUDIT_FEATURE_VERSION = 0x1 + AUDIT_FIELD_COMPARE = 0x6f + AUDIT_FILETYPE = 0x6c + AUDIT_FILTERKEY = 0xd2 + AUDIT_FILTER_ENTRY = 0x2 + AUDIT_FILTER_EXCLUDE = 0x5 + AUDIT_FILTER_EXIT = 0x4 + AUDIT_FILTER_FS = 0x6 + AUDIT_FILTER_PREPEND = 0x10 + AUDIT_FILTER_TASK = 0x1 + AUDIT_FILTER_TYPE = 0x5 + AUDIT_FILTER_URING_EXIT = 0x7 + AUDIT_FILTER_USER = 0x0 + AUDIT_FILTER_WATCH = 0x3 + AUDIT_FIRST_KERN_ANOM_MSG = 0x6a4 + AUDIT_FIRST_USER_MSG = 0x44c + AUDIT_FIRST_USER_MSG2 = 0x834 + AUDIT_FSGID = 0x8 + AUDIT_FSTYPE = 0x1a + AUDIT_FSUID = 0x4 + AUDIT_GET = 0x3e8 + AUDIT_GET_FEATURE = 0x3fb + AUDIT_GID = 0x5 + AUDIT_GREATER_THAN = 0x20000000 + AUDIT_GREATER_THAN_OR_EQUAL = 0x60000000 + AUDIT_INODE = 0x66 + AUDIT_INTEGRITY_DATA = 0x708 + AUDIT_INTEGRITY_EVM_XATTR = 0x70e + AUDIT_INTEGRITY_HASH = 0x70b + AUDIT_INTEGRITY_METADATA = 0x709 + AUDIT_INTEGRITY_PCR = 0x70c + AUDIT_INTEGRITY_POLICY_RULE = 0x70f + AUDIT_INTEGRITY_RULE = 0x70d + AUDIT_INTEGRITY_STATUS = 0x70a + AUDIT_IPC = 0x517 + AUDIT_IPC_SET_PERM = 0x51f + AUDIT_KERNEL = 0x7d0 + AUDIT_KERNEL_OTHER = 0x524 + AUDIT_KERN_MODULE = 0x532 + AUDIT_LAST_FEATURE = 0x1 + AUDIT_LAST_KERN_ANOM_MSG = 0x707 + AUDIT_LAST_USER_MSG = 0x4af + AUDIT_LAST_USER_MSG2 = 0xbb7 + AUDIT_LESS_THAN = 0x10000000 + AUDIT_LESS_THAN_OR_EQUAL = 0x50000000 + AUDIT_LIST = 0x3ea + AUDIT_LIST_RULES = 0x3f5 + AUDIT_LOGIN = 0x3ee + AUDIT_LOGINUID = 0x9 + AUDIT_LOGINUID_SET = 0x18 + AUDIT_MAC_CALIPSO_ADD = 0x58a + AUDIT_MAC_CALIPSO_DEL = 0x58b + AUDIT_MAC_CIPSOV4_ADD = 0x57f + AUDIT_MAC_CIPSOV4_DEL = 0x580 + AUDIT_MAC_CONFIG_CHANGE = 0x57d + AUDIT_MAC_IPSEC_ADDSA = 0x583 + AUDIT_MAC_IPSEC_ADDSPD = 0x585 + AUDIT_MAC_IPSEC_DELSA = 0x584 + AUDIT_MAC_IPSEC_DELSPD = 0x586 + AUDIT_MAC_IPSEC_EVENT = 0x587 + AUDIT_MAC_MAP_ADD = 0x581 + AUDIT_MAC_MAP_DEL = 0x582 + AUDIT_MAC_POLICY_LOAD = 0x57b + AUDIT_MAC_STATUS = 0x57c + AUDIT_MAC_UNLBL_ALLOW = 0x57e + AUDIT_MAC_UNLBL_STCADD = 0x588 + AUDIT_MAC_UNLBL_STCDEL = 0x589 + AUDIT_MAKE_EQUIV = 0x3f7 + AUDIT_MAX_FIELDS = 0x40 + AUDIT_MAX_FIELD_COMPARE = 0x19 + AUDIT_MAX_KEY_LEN = 0x100 + AUDIT_MESSAGE_TEXT_MAX = 0x2170 + AUDIT_MMAP = 0x52b + AUDIT_MQ_GETSETATTR = 0x523 + AUDIT_MQ_NOTIFY = 0x522 + AUDIT_MQ_OPEN = 0x520 + AUDIT_MQ_SENDRECV = 0x521 + AUDIT_MSGTYPE = 0xc + AUDIT_NEGATE = 0x80000000 + AUDIT_NETFILTER_CFG = 0x52d + AUDIT_NETFILTER_PKT = 0x52c + AUDIT_NEVER = 0x0 + AUDIT_NLGRP_MAX = 0x1 + AUDIT_NOT_EQUAL = 0x30000000 + AUDIT_NR_FILTERS = 0x8 + AUDIT_OBJ_GID = 0x6e + AUDIT_OBJ_LEV_HIGH = 0x17 + AUDIT_OBJ_LEV_LOW = 0x16 + AUDIT_OBJ_PID = 0x526 + AUDIT_OBJ_ROLE = 0x14 + AUDIT_OBJ_TYPE = 0x15 + AUDIT_OBJ_UID = 0x6d + AUDIT_OBJ_USER = 0x13 + AUDIT_OPENAT2 = 0x539 + AUDIT_OPERATORS = 0x78000000 + AUDIT_PATH = 0x516 + AUDIT_PERM = 0x6a + AUDIT_PERM_ATTR = 0x8 + AUDIT_PERM_EXEC = 0x1 + AUDIT_PERM_READ = 0x4 + AUDIT_PERM_WRITE = 0x2 + AUDIT_PERS = 0xa + AUDIT_PID = 0x0 + AUDIT_POSSIBLE = 0x1 + AUDIT_PPID = 0x12 + AUDIT_PROCTITLE = 0x52f + AUDIT_REPLACE = 0x531 + AUDIT_SADDR_FAM = 0x71 + AUDIT_SECCOMP = 0x52e + AUDIT_SELINUX_ERR = 0x579 + AUDIT_SESSIONID = 0x19 + AUDIT_SET = 0x3e9 + AUDIT_SET_FEATURE = 0x3fa + AUDIT_SGID = 0x7 + AUDIT_SID_UNSET = 0xffffffff + AUDIT_SIGNAL_INFO = 0x3f2 + AUDIT_SOCKADDR = 0x51a + AUDIT_SOCKETCALL = 0x518 + AUDIT_STATUS_BACKLOG_LIMIT = 0x10 + AUDIT_STATUS_BACKLOG_WAIT_TIME = 0x20 + AUDIT_STATUS_BACKLOG_WAIT_TIME_ACTUAL = 0x80 + AUDIT_STATUS_ENABLED = 0x1 + AUDIT_STATUS_FAILURE = 0x2 + AUDIT_STATUS_LOST = 0x40 + AUDIT_STATUS_PID = 0x4 + AUDIT_STATUS_RATE_LIMIT = 0x8 + AUDIT_SUBJ_CLR = 0x11 + AUDIT_SUBJ_ROLE = 0xe + AUDIT_SUBJ_SEN = 0x10 + AUDIT_SUBJ_TYPE = 0xf + AUDIT_SUBJ_USER = 0xd + AUDIT_SUCCESS = 0x68 + AUDIT_SUID = 0x3 + AUDIT_SYSCALL = 0x514 + AUDIT_SYSCALL_CLASSES = 0x10 + AUDIT_TIME_ADJNTPVAL = 0x535 + AUDIT_TIME_INJOFFSET = 0x534 + AUDIT_TRIM = 0x3f6 + AUDIT_TTY = 0x527 + AUDIT_TTY_GET = 0x3f8 + AUDIT_TTY_SET = 0x3f9 + AUDIT_UID = 0x1 + AUDIT_UID_UNSET = 0xffffffff + AUDIT_UNUSED_BITS = 0x7fffc00 + AUDIT_URINGOP = 0x538 + AUDIT_USER = 0x3ed + AUDIT_USER_AVC = 0x453 + AUDIT_USER_TTY = 0x464 + AUDIT_VERSION_BACKLOG_LIMIT = 0x1 + AUDIT_VERSION_BACKLOG_WAIT_TIME = 0x2 + AUDIT_VERSION_LATEST = 0x7f + AUDIT_WATCH = 0x69 + AUDIT_WATCH_INS = 0x3ef + AUDIT_WATCH_LIST = 0x3f1 + AUDIT_WATCH_REM = 0x3f0 AUTOFS_SUPER_MAGIC = 0x187 B0 = 0x0 B110 = 0x3 @@ -184,6 +484,7 @@ const ( BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 + BPF_F_KPROBE_MULTI_RETURN = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_REPLACE = 0x4 BPF_F_SLEEPABLE = 0x10 @@ -191,6 +492,8 @@ const ( BPF_F_TEST_RND_HI32 = 0x4 BPF_F_TEST_RUN_ON_CPU = 0x1 BPF_F_TEST_STATE_FREQ = 0x8 + BPF_F_TEST_XDP_LIVE_FRAMES = 0x2 + BPF_F_XDP_HAS_FRAGS = 0x20 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -517,9 +820,9 @@ const ( DM_UUID_FLAG = 0x4000 DM_UUID_LEN = 0x81 DM_VERSION = 0xc138fd00 - DM_VERSION_EXTRA = "-ioctl (2021-03-22)" + DM_VERSION_EXTRA = "-ioctl (2022-02-22)" DM_VERSION_MAJOR = 0x4 - DM_VERSION_MINOR = 0x2d + DM_VERSION_MINOR = 0x2e DM_VERSION_PATCHLEVEL = 0x0 DT_BLK = 0x6 DT_CHR = 0x2 @@ -535,6 +838,55 @@ const ( EFD_SEMAPHORE = 0x1 EFIVARFS_MAGIC = 0xde5e81e4 EFS_SUPER_MAGIC = 0x414a53 + EM_386 = 0x3 + EM_486 = 0x6 + EM_68K = 0x4 + EM_860 = 0x7 + EM_88K = 0x5 + EM_AARCH64 = 0xb7 + EM_ALPHA = 0x9026 + EM_ALTERA_NIOS2 = 0x71 + EM_ARCOMPACT = 0x5d + EM_ARCV2 = 0xc3 + EM_ARM = 0x28 + EM_BLACKFIN = 0x6a + EM_BPF = 0xf7 + EM_CRIS = 0x4c + EM_CSKY = 0xfc + EM_CYGNUS_M32R = 0x9041 + EM_CYGNUS_MN10300 = 0xbeef + EM_FRV = 0x5441 + EM_H8_300 = 0x2e + EM_HEXAGON = 0xa4 + EM_IA_64 = 0x32 + EM_LOONGARCH = 0x102 + EM_M32 = 0x1 + EM_M32R = 0x58 + EM_MICROBLAZE = 0xbd + EM_MIPS = 0x8 + EM_MIPS_RS3_LE = 0xa + EM_MIPS_RS4_BE = 0xa + EM_MN10300 = 0x59 + EM_NDS32 = 0xa7 + EM_NONE = 0x0 + EM_OPENRISC = 0x5c + EM_PARISC = 0xf + EM_PPC = 0x14 + EM_PPC64 = 0x15 + EM_RISCV = 0xf3 + EM_S390 = 0x16 + EM_S390_OLD = 0xa390 + EM_SH = 0x2a + EM_SPARC = 0x2 + EM_SPARC32PLUS = 0x12 + EM_SPARCV9 = 0x2b + EM_SPU = 0x17 + EM_TILEGX = 0xbf + EM_TILEPRO = 0xbc + EM_TI_C6000 = 0x8c + EM_UNICORE = 0x6e + EM_X86_64 = 0x3e + EM_XTENSA = 0x5e ENCODING_DEFAULT = 0x0 ENCODING_FM_MARK = 0x3 ENCODING_FM_SPACE = 0x4 @@ -712,6 +1064,7 @@ const ( ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be ETH_P_ERSPAN2 = 0x22eb + ETH_P_ETHERCAT = 0x88a4 ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -749,6 +1102,7 @@ const ( ETH_P_PPP_MP = 0x8 ETH_P_PPP_SES = 0x8864 ETH_P_PREAUTH = 0x88c7 + ETH_P_PROFINET = 0x8892 ETH_P_PRP = 0x88fb ETH_P_PUP = 0x200 ETH_P_PUPAT = 0x201 @@ -837,6 +1191,7 @@ const ( FAN_FS_ERROR = 0x8000 FAN_MARK_ADD = 0x1 FAN_MARK_DONT_FOLLOW = 0x4 + FAN_MARK_EVICTABLE = 0x200 FAN_MARK_FILESYSTEM = 0x100 FAN_MARK_FLUSH = 0x80 FAN_MARK_IGNORED_MASK = 0x20 @@ -1055,7 +1410,7 @@ const ( IFA_F_STABLE_PRIVACY = 0x800 IFA_F_TEMPORARY = 0x1 IFA_F_TENTATIVE = 0x40 - IFA_MAX = 0xa + IFA_MAX = 0xb IFF_ALLMULTI = 0x200 IFF_ATTACH_QUEUE = 0x200 IFF_AUTOMEDIA = 0x4000 @@ -1403,6 +1758,7 @@ const ( LANDLOCK_ACCESS_FS_MAKE_SYM = 0x1000 LANDLOCK_ACCESS_FS_READ_DIR = 0x8 LANDLOCK_ACCESS_FS_READ_FILE = 0x4 + LANDLOCK_ACCESS_FS_REFER = 0x2000 LANDLOCK_ACCESS_FS_REMOVE_DIR = 0x10 LANDLOCK_ACCESS_FS_REMOVE_FILE = 0x20 LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2 @@ -1758,6 +2114,7 @@ const ( NLM_F_ACK_TLVS = 0x200 NLM_F_APPEND = 0x800 NLM_F_ATOMIC = 0x400 + NLM_F_BULK = 0x200 NLM_F_CAPPED = 0x100 NLM_F_CREATE = 0x400 NLM_F_DUMP = 0x300 @@ -2075,6 +2432,11 @@ const ( PR_SET_UNALIGN = 0x6 PR_SET_VMA = 0x53564d41 PR_SET_VMA_ANON_NAME = 0x0 + PR_SME_GET_VL = 0x40 + PR_SME_SET_VL = 0x3f + PR_SME_SET_VL_ONEXEC = 0x40000 + PR_SME_VL_INHERIT = 0x20000 + PR_SME_VL_LEN_MASK = 0xffff PR_SPEC_DISABLE = 0x4 PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 @@ -2227,8 +2589,9 @@ const ( RTC_FEATURE_ALARM = 0x0 RTC_FEATURE_ALARM_RES_2S = 0x3 RTC_FEATURE_ALARM_RES_MINUTE = 0x1 + RTC_FEATURE_ALARM_WAKEUP_ONLY = 0x7 RTC_FEATURE_BACKUP_SWITCH_MODE = 0x6 - RTC_FEATURE_CNT = 0x7 + RTC_FEATURE_CNT = 0x8 RTC_FEATURE_CORRECTION = 0x5 RTC_FEATURE_NEED_WEEK_DAY = 0x2 RTC_FEATURE_UPDATE_INTERRUPT = 0x4 @@ -2302,6 +2665,7 @@ const ( RTM_DELRULE = 0x21 RTM_DELTCLASS = 0x29 RTM_DELTFILTER = 0x2d + RTM_DELTUNNEL = 0x79 RTM_DELVLAN = 0x71 RTM_F_CLONED = 0x200 RTM_F_EQUALIZE = 0x400 @@ -2334,8 +2698,9 @@ const ( RTM_GETSTATS = 0x5e RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e + RTM_GETTUNNEL = 0x7a RTM_GETVLAN = 0x72 - RTM_MAX = 0x77 + RTM_MAX = 0x7b RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 @@ -2359,11 +2724,13 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x1a - RTM_NR_MSGTYPES = 0x68 + RTM_NEWTUNNEL = 0x78 + RTM_NR_FAMILIES = 0x1b + RTM_NR_MSGTYPES = 0x6c RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 + RTM_SETSTATS = 0x5f RTNH_ALIGNTO = 0x4 RTNH_COMPARE_MASK = 0x59 RTNH_F_DEAD = 0x1 @@ -2544,6 +2911,9 @@ const ( SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 SOCK_SNDBUF_LOCK = 0x1 + SOCK_TXREHASH_DEFAULT = 0xff + SOCK_TXREHASH_DISABLED = 0x0 + SOCK_TXREHASH_ENABLED = 0x1 SOL_AAL = 0x109 SOL_ALG = 0x117 SOL_ATM = 0x108 @@ -2559,6 +2929,8 @@ const ( SOL_IUCV = 0x115 SOL_KCM = 0x119 SOL_LLC = 0x10c + SOL_MCTP = 0x11d + SOL_MPTCP = 0x11c SOL_NETBEUI = 0x10b SOL_NETLINK = 0x10e SOL_NFC = 0x118 @@ -2568,6 +2940,7 @@ const ( SOL_RAW = 0xff SOL_RDS = 0x114 SOL_RXRPC = 0x110 + SOL_SMC = 0x11e SOL_TCP = 0x6 SOL_TIPC = 0x10f SOL_TLS = 0x11a @@ -2674,7 +3047,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0xb + TASKSTATS_VERSION = 0xd TCIFLUSH = 0x0 TCIOFF = 0x2 TCIOFLUSH = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 1b305fab1b83..36c0dfc7c4cf 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -1,11 +1,11 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include -m32 +// mkerrors.sh -Wall -Werror -static -I/tmp/386/include -m32 // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && linux // +build 386,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/386/include -m32 _const.go package unix @@ -326,6 +326,7 @@ const ( SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 + SO_RCVMARK = 0x4b SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 @@ -350,6 +351,7 @@ const ( SO_TIMESTAMPNS_NEW = 0x40 SO_TIMESTAMPNS_OLD = 0x23 SO_TIMESTAMP_NEW = 0x3f + SO_TXREHASH = 0x4a SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_WIFI_STATUS = 0x29 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 6bcdef5dd6bc..4ff942703b7b 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -1,11 +1,11 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include -m64 +// mkerrors.sh -Wall -Werror -static -I/tmp/amd64/include -m64 // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && linux // +build amd64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/amd64/include -m64 _const.go package unix @@ -327,6 +327,7 @@ const ( SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 + SO_RCVMARK = 0x4b SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 @@ -351,6 +352,7 @@ const ( SO_TIMESTAMPNS_NEW = 0x40 SO_TIMESTAMPNS_OLD = 0x23 SO_TIMESTAMP_NEW = 0x3f + SO_TXREHASH = 0x4a SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_WIFI_STATUS = 0x29 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index e65df0f8d193..3eaa0fb78e30 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -1,11 +1,11 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include +// mkerrors.sh -Wall -Werror -static -I/tmp/arm/include // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && linux // +build arm,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/arm/include _const.go package unix @@ -333,6 +333,7 @@ const ( SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 + SO_RCVMARK = 0x4b SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 @@ -357,6 +358,7 @@ const ( SO_TIMESTAMPNS_NEW = 0x40 SO_TIMESTAMPNS_OLD = 0x23 SO_TIMESTAMP_NEW = 0x3f + SO_TXREHASH = 0x4a SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_WIFI_STATUS = 0x29 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index c7021115aa98..d7995bdc3a21 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -1,11 +1,11 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include -fsigned-char +// mkerrors.sh -Wall -Werror -static -I/tmp/arm64/include -fsigned-char // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && linux // +build arm64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/arm64/include -fsigned-char _const.go package unix @@ -323,6 +323,7 @@ const ( SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 + SO_RCVMARK = 0x4b SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 @@ -347,6 +348,7 @@ const ( SO_TIMESTAMPNS_NEW = 0x40 SO_TIMESTAMPNS_OLD = 0x23 SO_TIMESTAMP_NEW = 0x3f + SO_TXREHASH = 0x4a SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_WIFI_STATUS = 0x29 @@ -511,6 +513,7 @@ const ( WORDSIZE = 0x40 XCASE = 0x4 XTABS = 0x1800 + ZA_MAGIC = 0x54366345 _HIDIOCGRAWNAME = 0x80804804 _HIDIOCGRAWPHYS = 0x80404805 _HIDIOCGRAWUNIQ = 0x80404808 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go index 0d83a1cd45db..928e24c20535 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go @@ -1,11 +1,11 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include +// mkerrors.sh -Wall -Werror -static -I/tmp/loong64/include // Code generated by the command above; see README.md. DO NOT EDIT. //go:build loong64 && linux // +build loong64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/loong64/include _const.go package unix @@ -109,8 +109,6 @@ const ( IUCLC = 0x200 IXOFF = 0x1000 IXON = 0x400 - LASX_CTX_MAGIC = 0x41535801 - LSX_CTX_MAGIC = 0x53580001 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 MAP_DENYWRITE = 0x800 @@ -319,6 +317,7 @@ const ( SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 + SO_RCVMARK = 0x4b SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 @@ -343,6 +342,7 @@ const ( SO_TIMESTAMPNS_NEW = 0x40 SO_TIMESTAMPNS_OLD = 0x23 SO_TIMESTAMP_NEW = 0x3f + SO_TXREHASH = 0x4a SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_WIFI_STATUS = 0x29 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 7f44a495b7e6..179bffb474b4 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -1,11 +1,11 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include +// mkerrors.sh -Wall -Werror -static -I/tmp/mips/include // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips && linux // +build mips,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/mips/include _const.go package unix @@ -326,6 +326,7 @@ const ( SO_RCVBUF = 0x1002 SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 + SO_RCVMARK = 0x4b SO_RCVTIMEO = 0x1006 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x1006 @@ -351,6 +352,7 @@ const ( SO_TIMESTAMPNS_NEW = 0x40 SO_TIMESTAMPNS_OLD = 0x23 SO_TIMESTAMP_NEW = 0x3f + SO_TXREHASH = 0x4a SO_TXTIME = 0x3d SO_TYPE = 0x1008 SO_WIFI_STATUS = 0x29 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 2f92b4e48ed7..1fba17bd75cb 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -1,11 +1,11 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include +// mkerrors.sh -Wall -Werror -static -I/tmp/mips64/include // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && linux // +build mips64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/mips64/include _const.go package unix @@ -326,6 +326,7 @@ const ( SO_RCVBUF = 0x1002 SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 + SO_RCVMARK = 0x4b SO_RCVTIMEO = 0x1006 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x1006 @@ -351,6 +352,7 @@ const ( SO_TIMESTAMPNS_NEW = 0x40 SO_TIMESTAMPNS_OLD = 0x23 SO_TIMESTAMP_NEW = 0x3f + SO_TXREHASH = 0x4a SO_TXTIME = 0x3d SO_TYPE = 0x1008 SO_WIFI_STATUS = 0x29 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index f5367a966b30..b77dde31537e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -1,11 +1,11 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include +// mkerrors.sh -Wall -Werror -static -I/tmp/mips64le/include // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64le && linux // +build mips64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/mips64le/include _const.go package unix @@ -326,6 +326,7 @@ const ( SO_RCVBUF = 0x1002 SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 + SO_RCVMARK = 0x4b SO_RCVTIMEO = 0x1006 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x1006 @@ -351,6 +352,7 @@ const ( SO_TIMESTAMPNS_NEW = 0x40 SO_TIMESTAMPNS_OLD = 0x23 SO_TIMESTAMP_NEW = 0x3f + SO_TXREHASH = 0x4a SO_TXTIME = 0x3d SO_TYPE = 0x1008 SO_WIFI_STATUS = 0x29 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 2e22337d7cff..78c6c751bfa5 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -1,11 +1,11 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include +// mkerrors.sh -Wall -Werror -static -I/tmp/mipsle/include // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mipsle && linux // +build mipsle,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/mipsle/include _const.go package unix @@ -326,6 +326,7 @@ const ( SO_RCVBUF = 0x1002 SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 + SO_RCVMARK = 0x4b SO_RCVTIMEO = 0x1006 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x1006 @@ -351,6 +352,7 @@ const ( SO_TIMESTAMPNS_NEW = 0x40 SO_TIMESTAMPNS_OLD = 0x23 SO_TIMESTAMP_NEW = 0x3f + SO_TXREHASH = 0x4a SO_TXTIME = 0x3d SO_TYPE = 0x1008 SO_WIFI_STATUS = 0x29 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index 858c4f30f5b5..1c0d31f0b4c2 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -1,11 +1,11 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include +// mkerrors.sh -Wall -Werror -static -I/tmp/ppc/include // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && linux // +build ppc,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/ppc/include _const.go package unix @@ -381,6 +381,7 @@ const ( SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x10 + SO_RCVMARK = 0x4b SO_RCVTIMEO = 0x12 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x12 @@ -405,6 +406,7 @@ const ( SO_TIMESTAMPNS_NEW = 0x40 SO_TIMESTAMPNS_OLD = 0x23 SO_TIMESTAMP_NEW = 0x3f + SO_TXREHASH = 0x4a SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_WIFI_STATUS = 0x29 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index af2a7ba6e615..959dd9bb8fcc 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -1,11 +1,11 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include +// mkerrors.sh -Wall -Werror -static -I/tmp/ppc64/include // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && linux // +build ppc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/ppc64/include _const.go package unix @@ -385,6 +385,7 @@ const ( SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x10 + SO_RCVMARK = 0x4b SO_RCVTIMEO = 0x12 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x12 @@ -409,6 +410,7 @@ const ( SO_TIMESTAMPNS_NEW = 0x40 SO_TIMESTAMPNS_OLD = 0x23 SO_TIMESTAMP_NEW = 0x3f + SO_TXREHASH = 0x4a SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_WIFI_STATUS = 0x29 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index eaa2eb8e2469..5a873cdbc9d2 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -1,11 +1,11 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include +// mkerrors.sh -Wall -Werror -static -I/tmp/ppc64le/include // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64le && linux // +build ppc64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/ppc64le/include _const.go package unix @@ -385,6 +385,7 @@ const ( SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x10 + SO_RCVMARK = 0x4b SO_RCVTIMEO = 0x12 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x12 @@ -409,6 +410,7 @@ const ( SO_TIMESTAMPNS_NEW = 0x40 SO_TIMESTAMPNS_OLD = 0x23 SO_TIMESTAMP_NEW = 0x3f + SO_TXREHASH = 0x4a SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_WIFI_STATUS = 0x29 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index faaa9f06378b..e336d141e1f1 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -1,11 +1,11 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include +// mkerrors.sh -Wall -Werror -static -I/tmp/riscv64/include // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && linux // +build riscv64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/riscv64/include _const.go package unix @@ -314,6 +314,7 @@ const ( SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 + SO_RCVMARK = 0x4b SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 @@ -338,6 +339,7 @@ const ( SO_TIMESTAMPNS_NEW = 0x40 SO_TIMESTAMPNS_OLD = 0x23 SO_TIMESTAMP_NEW = 0x3f + SO_TXREHASH = 0x4a SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_WIFI_STATUS = 0x29 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 0d161f0b75fe..390c01d92a53 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -1,11 +1,11 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include -fsigned-char +// mkerrors.sh -Wall -Werror -static -I/tmp/s390x/include -fsigned-char // Code generated by the command above; see README.md. DO NOT EDIT. //go:build s390x && linux // +build s390x,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/s390x/include -fsigned-char _const.go package unix @@ -389,6 +389,7 @@ const ( SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 + SO_RCVMARK = 0x4b SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 @@ -413,6 +414,7 @@ const ( SO_TIMESTAMPNS_NEW = 0x40 SO_TIMESTAMPNS_OLD = 0x23 SO_TIMESTAMP_NEW = 0x3f + SO_TXREHASH = 0x4a SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_WIFI_STATUS = 0x29 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index 4fd497a3e39a..98a6e5f11f50 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -1,11 +1,11 @@ -// mkerrors.sh -Wall -Werror -static -I/tmp/include +// mkerrors.sh -Wall -Werror -static -I/tmp/sparc64/include // Code generated by the command above; see README.md. DO NOT EDIT. //go:build sparc64 && linux // +build sparc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/sparc64/include _const.go package unix @@ -380,6 +380,7 @@ const ( SO_RCVBUF = 0x1002 SO_RCVBUFFORCE = 0x100b SO_RCVLOWAT = 0x800 + SO_RCVMARK = 0x54 SO_RCVTIMEO = 0x2000 SO_RCVTIMEO_NEW = 0x44 SO_RCVTIMEO_OLD = 0x2000 @@ -404,6 +405,7 @@ const ( SO_TIMESTAMPNS_NEW = 0x42 SO_TIMESTAMPNS_OLD = 0x21 SO_TIMESTAMP_NEW = 0x46 + SO_TXREHASH = 0x53 SO_TXTIME = 0x3f SO_TYPE = 0x1008 SO_WIFI_STATUS = 0x25 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go index 6d56edc05ac3..af20e474b388 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go @@ -46,6 +46,7 @@ const ( AF_SNA = 0xb AF_UNIX = 0x1 AF_UNSPEC = 0x0 + ALTWERASE = 0x200 ARPHRD_ETHER = 0x1 ARPHRD_FRELAY = 0xf ARPHRD_IEEE1394 = 0x18 @@ -108,6 +109,15 @@ const ( BPF_DIRECTION_IN = 0x1 BPF_DIRECTION_OUT = 0x2 BPF_DIV = 0x30 + BPF_FILDROP_CAPTURE = 0x1 + BPF_FILDROP_DROP = 0x2 + BPF_FILDROP_PASS = 0x0 + BPF_F_DIR_IN = 0x10 + BPF_F_DIR_MASK = 0x30 + BPF_F_DIR_OUT = 0x20 + BPF_F_DIR_SHIFT = 0x4 + BPF_F_FLOWID = 0x8 + BPF_F_PRI_MASK = 0x7 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -136,6 +146,7 @@ const ( BPF_OR = 0x40 BPF_RELEASE = 0x30bb6 BPF_RET = 0x6 + BPF_RND = 0xc0 BPF_RSH = 0x70 BPF_ST = 0x2 BPF_STX = 0x3 @@ -147,6 +158,12 @@ const ( BRKINT = 0x2 CFLUSH = 0xf CLOCAL = 0x8000 + CLOCK_BOOTTIME = 0x6 + CLOCK_MONOTONIC = 0x3 + CLOCK_PROCESS_CPUTIME_ID = 0x2 + CLOCK_REALTIME = 0x0 + CLOCK_THREAD_CPUTIME_ID = 0x4 + CLOCK_UPTIME = 0x5 CPUSTATES = 0x6 CP_IDLE = 0x5 CP_INTR = 0x4 @@ -170,7 +187,65 @@ const ( CTL_KERN = 0x1 CTL_MAXNAME = 0xc CTL_NET = 0x4 + DIOCADDQUEUE = 0xc100445d + DIOCADDRULE = 0xccc84404 + DIOCADDSTATE = 0xc1084425 + DIOCCHANGERULE = 0xccc8441a + DIOCCLRIFFLAG = 0xc024445a + DIOCCLRSRCNODES = 0x20004455 + DIOCCLRSTATES = 0xc0d04412 + DIOCCLRSTATUS = 0xc0244416 + DIOCGETLIMIT = 0xc0084427 + DIOCGETQSTATS = 0xc1084460 + DIOCGETQUEUE = 0xc100445f + DIOCGETQUEUES = 0xc100445e + DIOCGETRULE = 0xccc84407 + DIOCGETRULES = 0xccc84406 + DIOCGETRULESET = 0xc444443b + DIOCGETRULESETS = 0xc444443a + DIOCGETSRCNODES = 0xc0084454 + DIOCGETSTATE = 0xc1084413 + DIOCGETSTATES = 0xc0084419 + DIOCGETSTATUS = 0xc1e84415 + DIOCGETSYNFLWATS = 0xc0084463 + DIOCGETTIMEOUT = 0xc008441e + DIOCIGETIFACES = 0xc0244457 + DIOCKILLSRCNODES = 0xc068445b + DIOCKILLSTATES = 0xc0d04429 + DIOCNATLOOK = 0xc0504417 + DIOCOSFPADD = 0xc084444f DIOCOSFPFLUSH = 0x2000444e + DIOCOSFPGET = 0xc0844450 + DIOCRADDADDRS = 0xc44c4443 + DIOCRADDTABLES = 0xc44c443d + DIOCRCLRADDRS = 0xc44c4442 + DIOCRCLRASTATS = 0xc44c4448 + DIOCRCLRTABLES = 0xc44c443c + DIOCRCLRTSTATS = 0xc44c4441 + DIOCRDELADDRS = 0xc44c4444 + DIOCRDELTABLES = 0xc44c443e + DIOCRGETADDRS = 0xc44c4446 + DIOCRGETASTATS = 0xc44c4447 + DIOCRGETTABLES = 0xc44c443f + DIOCRGETTSTATS = 0xc44c4440 + DIOCRINADEFINE = 0xc44c444d + DIOCRSETADDRS = 0xc44c4445 + DIOCRSETTFLAGS = 0xc44c444a + DIOCRTSTADDRS = 0xc44c4449 + DIOCSETDEBUG = 0xc0044418 + DIOCSETHOSTID = 0xc0044456 + DIOCSETIFFLAG = 0xc0244459 + DIOCSETLIMIT = 0xc0084428 + DIOCSETREASS = 0xc004445c + DIOCSETSTATUSIF = 0xc0244414 + DIOCSETSYNCOOKIES = 0xc0014462 + DIOCSETSYNFLWATS = 0xc0084461 + DIOCSETTIMEOUT = 0xc008441d + DIOCSTART = 0x20004401 + DIOCSTOP = 0x20004402 + DIOCXBEGIN = 0xc00c4451 + DIOCXCOMMIT = 0xc00c4452 + DIOCXROLLBACK = 0xc00c4453 DLT_ARCNET = 0x7 DLT_ATM_RFC1483 = 0xb DLT_AX25 = 0x3 @@ -186,6 +261,7 @@ const ( DLT_LOOP = 0xc DLT_MPLS = 0xdb DLT_NULL = 0x0 + DLT_OPENFLOW = 0x10b DLT_PFLOG = 0x75 DLT_PFSYNC = 0x12 DLT_PPP = 0x9 @@ -196,6 +272,23 @@ const ( DLT_RAW = 0xe DLT_SLIP = 0x8 DLT_SLIP_BSDOS = 0xf + DLT_USBPCAP = 0xf9 + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c DT_BLK = 0x6 DT_CHR = 0x2 DT_DIR = 0x4 @@ -215,6 +308,8 @@ const ( EMUL_ENABLED = 0x1 EMUL_NATIVE = 0x2 ENDRUNDISC = 0x9 + ETH64_8021_RSVD_MASK = 0xfffffffffff0 + ETH64_8021_RSVD_PREFIX = 0x180c2000000 ETHERMIN = 0x2e ETHERMTU = 0x5dc ETHERTYPE_8023 = 0x4 @@ -267,6 +362,7 @@ const ( ETHERTYPE_DN = 0x6003 ETHERTYPE_DOGFIGHT = 0x1989 ETHERTYPE_DSMD = 0x8039 + ETHERTYPE_EAPOL = 0x888e ETHERTYPE_ECMA = 0x803 ETHERTYPE_ENCRYPT = 0x803d ETHERTYPE_ES = 0x805d @@ -298,6 +394,7 @@ const ( ETHERTYPE_LLDP = 0x88cc ETHERTYPE_LOGICRAFT = 0x8148 ETHERTYPE_LOOPBACK = 0x9000 + ETHERTYPE_MACSEC = 0x88e5 ETHERTYPE_MATRA = 0x807a ETHERTYPE_MAX = 0xffff ETHERTYPE_MERIT = 0x807c @@ -326,15 +423,17 @@ const ( ETHERTYPE_NCD = 0x8149 ETHERTYPE_NESTAR = 0x8006 ETHERTYPE_NETBEUI = 0x8191 + ETHERTYPE_NHRP = 0x2001 ETHERTYPE_NOVELL = 0x8138 ETHERTYPE_NS = 0x600 ETHERTYPE_NSAT = 0x601 ETHERTYPE_NSCOMPAT = 0x807 + ETHERTYPE_NSH = 0x984f ETHERTYPE_NTRAILER = 0x10 ETHERTYPE_OS9 = 0x7007 ETHERTYPE_OS9NET = 0x7009 ETHERTYPE_PACER = 0x80c6 - ETHERTYPE_PAE = 0x888e + ETHERTYPE_PBB = 0x88e7 ETHERTYPE_PCS = 0x4242 ETHERTYPE_PLANNING = 0x8044 ETHERTYPE_PPP = 0x880b @@ -409,28 +508,40 @@ const ( ETHER_CRC_POLY_LE = 0xedb88320 ETHER_HDR_LEN = 0xe ETHER_MAX_DIX_LEN = 0x600 + ETHER_MAX_HARDMTU_LEN = 0xff9b ETHER_MAX_LEN = 0x5ee ETHER_MIN_LEN = 0x40 ETHER_TYPE_LEN = 0x2 ETHER_VLAN_ENCAP_LEN = 0x4 EVFILT_AIO = -0x3 + EVFILT_DEVICE = -0x8 + EVFILT_EXCEPT = -0x9 EVFILT_PROC = -0x5 EVFILT_READ = -0x1 EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0x7 + EVFILT_SYSCOUNT = 0x9 EVFILT_TIMER = -0x7 EVFILT_VNODE = -0x4 EVFILT_WRITE = -0x2 + EVL_ENCAPLEN = 0x4 + EVL_PRIO_BITS = 0xd + EVL_PRIO_MAX = 0x7 + EVL_VLID_MASK = 0xfff + EVL_VLID_MAX = 0xffe + EVL_VLID_MIN = 0x1 + EVL_VLID_NULL = 0x0 EV_ADD = 0x1 EV_CLEAR = 0x20 EV_DELETE = 0x2 EV_DISABLE = 0x8 + EV_DISPATCH = 0x80 EV_ENABLE = 0x4 EV_EOF = 0x8000 EV_ERROR = 0x4000 EV_FLAG1 = 0x2000 EV_ONESHOT = 0x10 - EV_SYSFLAGS = 0xf000 + EV_RECEIPT = 0x40 + EV_SYSFLAGS = 0xf800 EXTA = 0x4b00 EXTB = 0x9600 EXTPROC = 0x800 @@ -443,6 +554,7 @@ const ( F_GETFL = 0x3 F_GETLK = 0x7 F_GETOWN = 0x5 + F_ISATTY = 0xb F_OK = 0x0 F_RDLCK = 0x1 F_SETFD = 0x2 @@ -460,7 +572,6 @@ const ( IEXTEN = 0x400 IFAN_ARRIVAL = 0x0 IFAN_DEPARTURE = 0x1 - IFA_ROUTE = 0x1 IFF_ALLMULTI = 0x200 IFF_BROADCAST = 0x2 IFF_CANTCHANGE = 0x8e52 @@ -471,12 +582,12 @@ const ( IFF_LOOPBACK = 0x8 IFF_MULTICAST = 0x8000 IFF_NOARP = 0x80 - IFF_NOTRAILERS = 0x20 IFF_OACTIVE = 0x400 IFF_POINTOPOINT = 0x10 IFF_PROMISC = 0x100 IFF_RUNNING = 0x40 IFF_SIMPLEX = 0x800 + IFF_STATICARP = 0x20 IFF_UP = 0x1 IFNAMSIZ = 0x10 IFT_1822 = 0x2 @@ -605,6 +716,7 @@ const ( IFT_LINEGROUP = 0xd2 IFT_LOCALTALK = 0x2a IFT_LOOP = 0x18 + IFT_MBIM = 0xfa IFT_MEDIAMAILOVERIP = 0x8b IFT_MFSIGLINK = 0xa7 IFT_MIOX25 = 0x26 @@ -695,6 +807,7 @@ const ( IFT_VOICEOVERCABLE = 0xc6 IFT_VOICEOVERFRAMERELAY = 0x99 IFT_VOICEOVERIP = 0x68 + IFT_WIREGUARD = 0xfb IFT_X213 = 0x5d IFT_X25 = 0x5 IFT_X25DDN = 0x4 @@ -729,8 +842,6 @@ const ( IPPROTO_AH = 0x33 IPPROTO_CARP = 0x70 IPPROTO_DIVERT = 0x102 - IPPROTO_DIVERT_INIT = 0x2 - IPPROTO_DIVERT_RESP = 0x1 IPPROTO_DONE = 0x101 IPPROTO_DSTOPTS = 0x3c IPPROTO_EGP = 0x8 @@ -762,9 +873,11 @@ const ( IPPROTO_RAW = 0xff IPPROTO_ROUTING = 0x2b IPPROTO_RSVP = 0x2e + IPPROTO_SCTP = 0x84 IPPROTO_TCP = 0x6 IPPROTO_TP = 0x1d IPPROTO_UDP = 0x11 + IPPROTO_UDPLITE = 0x88 IPV6_AUTH_LEVEL = 0x35 IPV6_AUTOFLOWLABEL = 0x3b IPV6_CHECKSUM = 0x1a @@ -787,6 +900,7 @@ const ( IPV6_LEAVE_GROUP = 0xd IPV6_MAXHLIM = 0xff IPV6_MAXPACKET = 0xffff + IPV6_MINHOPCOUNT = 0x41 IPV6_MMTU = 0x500 IPV6_MULTICAST_HOPS = 0xa IPV6_MULTICAST_IF = 0x9 @@ -826,12 +940,12 @@ const ( IP_DEFAULT_MULTICAST_LOOP = 0x1 IP_DEFAULT_MULTICAST_TTL = 0x1 IP_DF = 0x4000 - IP_DIVERTFL = 0x1022 IP_DROP_MEMBERSHIP = 0xd IP_ESP_NETWORK_LEVEL = 0x16 IP_ESP_TRANS_LEVEL = 0x15 IP_HDRINCL = 0x2 IP_IPCOMP_LEVEL = 0x1d + IP_IPDEFTTL = 0x25 IP_IPSECFLOWINFO = 0x24 IP_IPSEC_LOCAL_AUTH = 0x1b IP_IPSEC_LOCAL_CRED = 0x19 @@ -865,10 +979,15 @@ const ( IP_RETOPTS = 0x8 IP_RF = 0x8000 IP_RTABLE = 0x1021 + IP_SENDSRCADDR = 0x7 IP_TOS = 0x3 IP_TTL = 0x4 ISIG = 0x80 ISTRIP = 0x20 + ITIMER_PROF = 0x2 + ITIMER_REAL = 0x0 + ITIMER_VIRTUAL = 0x1 + IUCLC = 0x1000 IXANY = 0x800 IXOFF = 0x400 IXON = 0x200 @@ -900,10 +1019,11 @@ const ( MAP_INHERIT_COPY = 0x1 MAP_INHERIT_NONE = 0x2 MAP_INHERIT_SHARE = 0x0 - MAP_NOEXTEND = 0x100 - MAP_NORESERVE = 0x40 + MAP_INHERIT_ZERO = 0x3 + MAP_NOEXTEND = 0x0 + MAP_NORESERVE = 0x0 MAP_PRIVATE = 0x2 - MAP_RENAME = 0x20 + MAP_RENAME = 0x0 MAP_SHARED = 0x1 MAP_STACK = 0x4000 MAP_TRYFIXED = 0x0 @@ -922,6 +1042,7 @@ const ( MNT_NOATIME = 0x8000 MNT_NODEV = 0x10 MNT_NOEXEC = 0x4 + MNT_NOPERM = 0x20 MNT_NOSUID = 0x8 MNT_NOWAIT = 0x2 MNT_QUOTA = 0x2000 @@ -929,13 +1050,29 @@ const ( MNT_RELOAD = 0x40000 MNT_ROOTFS = 0x4000 MNT_SOFTDEP = 0x4000000 + MNT_STALLED = 0x100000 + MNT_SWAPPABLE = 0x200000 MNT_SYNCHRONOUS = 0x2 MNT_UPDATE = 0x10000 MNT_VISFLAGMASK = 0x400ffff MNT_WAIT = 0x1 MNT_WANTRDWR = 0x2000000 MNT_WXALLOWED = 0x800 + MOUNT_AFS = "afs" + MOUNT_CD9660 = "cd9660" + MOUNT_EXT2FS = "ext2fs" + MOUNT_FFS = "ffs" + MOUNT_FUSEFS = "fuse" + MOUNT_MFS = "mfs" + MOUNT_MSDOS = "msdos" + MOUNT_NCPFS = "ncpfs" + MOUNT_NFS = "nfs" + MOUNT_NTFS = "ntfs" + MOUNT_TMPFS = "tmpfs" + MOUNT_UDF = "udf" + MOUNT_UFS = "ffs" MSG_BCAST = 0x100 + MSG_CMSG_CLOEXEC = 0x800 MSG_CTRUNC = 0x20 MSG_DONTROUTE = 0x4 MSG_DONTWAIT = 0x80 @@ -946,6 +1083,7 @@ const ( MSG_PEEK = 0x2 MSG_TRUNC = 0x10 MSG_WAITALL = 0x40 + MSG_WAITFORONE = 0x1000 MS_ASYNC = 0x1 MS_INVALIDATE = 0x4 MS_SYNC = 0x2 @@ -953,12 +1091,16 @@ const ( NET_RT_DUMP = 0x1 NET_RT_FLAGS = 0x2 NET_RT_IFLIST = 0x3 - NET_RT_MAXID = 0x6 + NET_RT_IFNAMES = 0x6 + NET_RT_MAXID = 0x8 + NET_RT_SOURCE = 0x7 NET_RT_STATS = 0x4 NET_RT_TABLE = 0x5 NFDBITS = 0x20 NOFLSH = 0x80000000 + NOKERNINFO = 0x2000000 NOTE_ATTRIB = 0x8 + NOTE_CHANGE = 0x1 NOTE_CHILD = 0x4 NOTE_DELETE = 0x1 NOTE_EOF = 0x2 @@ -968,6 +1110,7 @@ const ( NOTE_FORK = 0x40000000 NOTE_LINK = 0x10 NOTE_LOWAT = 0x1 + NOTE_OOB = 0x4 NOTE_PCTRLMASK = 0xf0000000 NOTE_PDATAMASK = 0xfffff NOTE_RENAME = 0x20 @@ -977,11 +1120,13 @@ const ( NOTE_TRUNCATE = 0x80 NOTE_WRITE = 0x2 OCRNL = 0x10 + OLCUC = 0x20 ONLCR = 0x2 ONLRET = 0x80 ONOCR = 0x40 ONOEOT = 0x8 OPOST = 0x1 + OXTABS = 0x4 O_ACCMODE = 0x3 O_APPEND = 0x8 O_ASYNC = 0x40 @@ -1015,7 +1160,6 @@ const ( PROT_NONE = 0x0 PROT_READ = 0x1 PROT_WRITE = 0x2 - PT_MASK = 0x3ff000 RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 RLIMIT_DATA = 0x2 @@ -1027,19 +1171,25 @@ const ( RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 + RTAX_BFD = 0xb RTAX_BRD = 0x7 + RTAX_DNS = 0xc RTAX_DST = 0x0 RTAX_GATEWAY = 0x1 RTAX_GENMASK = 0x3 RTAX_IFA = 0x5 RTAX_IFP = 0x4 RTAX_LABEL = 0xa - RTAX_MAX = 0xb + RTAX_MAX = 0xf RTAX_NETMASK = 0x2 + RTAX_SEARCH = 0xe RTAX_SRC = 0x8 RTAX_SRCMASK = 0x9 + RTAX_STATIC = 0xd RTA_AUTHOR = 0x40 + RTA_BFD = 0x800 RTA_BRD = 0x80 + RTA_DNS = 0x1000 RTA_DST = 0x1 RTA_GATEWAY = 0x2 RTA_GENMASK = 0x8 @@ -1047,49 +1197,57 @@ const ( RTA_IFP = 0x10 RTA_LABEL = 0x400 RTA_NETMASK = 0x4 + RTA_SEARCH = 0x4000 RTA_SRC = 0x100 RTA_SRCMASK = 0x200 + RTA_STATIC = 0x2000 RTF_ANNOUNCE = 0x4000 + RTF_BFD = 0x1000000 RTF_BLACKHOLE = 0x1000 + RTF_BROADCAST = 0x400000 + RTF_CACHED = 0x20000 RTF_CLONED = 0x10000 RTF_CLONING = 0x100 + RTF_CONNECTED = 0x800000 RTF_DONE = 0x40 RTF_DYNAMIC = 0x10 - RTF_FMASK = 0x10f808 + RTF_FMASK = 0x110fc08 RTF_GATEWAY = 0x2 RTF_HOST = 0x4 RTF_LLINFO = 0x400 - RTF_MASK = 0x80 + RTF_LOCAL = 0x200000 RTF_MODIFIED = 0x20 RTF_MPATH = 0x40000 RTF_MPLS = 0x100000 + RTF_MULTICAST = 0x200 RTF_PERMANENT_ARP = 0x2000 RTF_PROTO1 = 0x8000 RTF_PROTO2 = 0x4000 RTF_PROTO3 = 0x2000 RTF_REJECT = 0x8 - RTF_SOURCE = 0x20000 RTF_STATIC = 0x800 - RTF_TUNNEL = 0x100000 RTF_UP = 0x1 RTF_USETRAILERS = 0x8000 - RTF_XRESOLVE = 0x200 + RTM_80211INFO = 0x15 RTM_ADD = 0x1 + RTM_BFD = 0x12 RTM_CHANGE = 0x3 + RTM_CHGADDRATTR = 0x14 RTM_DELADDR = 0xd RTM_DELETE = 0x2 RTM_DESYNC = 0x10 RTM_GET = 0x4 RTM_IFANNOUNCE = 0xf RTM_IFINFO = 0xe - RTM_LOCK = 0x8 + RTM_INVALIDATE = 0x11 RTM_LOSING = 0x5 RTM_MAXSIZE = 0x800 RTM_MISS = 0x7 RTM_NEWADDR = 0xc + RTM_PROPOSAL = 0x13 RTM_REDIRECT = 0x6 RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 + RTM_SOURCE = 0x16 RTM_VERSION = 0x5 RTV_EXPIRE = 0x4 RTV_HOPCOUNT = 0x2 @@ -1099,67 +1257,74 @@ const ( RTV_RTTVAR = 0x80 RTV_SPIPE = 0x10 RTV_SSTHRESH = 0x20 + RT_TABLEID_BITS = 0x8 + RT_TABLEID_MASK = 0xff RT_TABLEID_MAX = 0xff RUSAGE_CHILDREN = -0x1 RUSAGE_SELF = 0x0 RUSAGE_THREAD = 0x1 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x4 + SEEK_CUR = 0x1 + SEEK_END = 0x2 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 SIOCADDMULTI = 0x80206931 SIOCAIFADDR = 0x8040691a SIOCAIFGROUP = 0x80246987 - SIOCALIFADDR = 0x8218691c SIOCATMARK = 0x40047307 - SIOCBRDGADD = 0x8054693c - SIOCBRDGADDS = 0x80546941 - SIOCBRDGARL = 0x806e694d + SIOCBRDGADD = 0x805c693c + SIOCBRDGADDL = 0x805c6949 + SIOCBRDGADDS = 0x805c6941 + SIOCBRDGARL = 0x808c694d SIOCBRDGDADDR = 0x81286947 - SIOCBRDGDEL = 0x8054693d - SIOCBRDGDELS = 0x80546942 - SIOCBRDGFLUSH = 0x80546948 - SIOCBRDGFRL = 0x806e694e + SIOCBRDGDEL = 0x805c693d + SIOCBRDGDELS = 0x805c6942 + SIOCBRDGFLUSH = 0x805c6948 + SIOCBRDGFRL = 0x808c694e SIOCBRDGGCACHE = 0xc0146941 SIOCBRDGGFD = 0xc0146952 SIOCBRDGGHT = 0xc0146951 - SIOCBRDGGIFFLGS = 0xc054693e + SIOCBRDGGIFFLGS = 0xc05c693e SIOCBRDGGMA = 0xc0146953 SIOCBRDGGPARAM = 0xc03c6958 SIOCBRDGGPRI = 0xc0146950 SIOCBRDGGRL = 0xc028694f - SIOCBRDGGSIFS = 0xc054693c SIOCBRDGGTO = 0xc0146946 - SIOCBRDGIFS = 0xc0546942 + SIOCBRDGIFS = 0xc05c6942 SIOCBRDGRTS = 0xc0186943 SIOCBRDGSADDR = 0xc1286944 SIOCBRDGSCACHE = 0x80146940 SIOCBRDGSFD = 0x80146952 SIOCBRDGSHT = 0x80146951 - SIOCBRDGSIFCOST = 0x80546955 - SIOCBRDGSIFFLGS = 0x8054693f - SIOCBRDGSIFPRIO = 0x80546954 + SIOCBRDGSIFCOST = 0x805c6955 + SIOCBRDGSIFFLGS = 0x805c693f + SIOCBRDGSIFPRIO = 0x805c6954 + SIOCBRDGSIFPROT = 0x805c694a SIOCBRDGSMA = 0x80146953 SIOCBRDGSPRI = 0x80146950 SIOCBRDGSPROTO = 0x8014695a SIOCBRDGSTO = 0x80146945 SIOCBRDGSTXHC = 0x80146959 + SIOCDELLABEL = 0x80206997 SIOCDELMULTI = 0x80206932 SIOCDIFADDR = 0x80206919 SIOCDIFGROUP = 0x80246989 + SIOCDIFPARENT = 0x802069b4 SIOCDIFPHYADDR = 0x80206949 - SIOCDLIFADDR = 0x8218691e + SIOCDPWE3NEIGHBOR = 0x802069de + SIOCDVNETID = 0x802069af SIOCGETKALIVE = 0xc01869a4 SIOCGETLABEL = 0x8020699a + SIOCGETMPWCFG = 0xc02069ae SIOCGETPFLOW = 0xc02069fe SIOCGETPFSYNC = 0xc02069f8 SIOCGETSGCNT = 0xc0147534 SIOCGETVIFCNT = 0xc0147533 SIOCGETVLAN = 0xc0206990 - SIOCGHIWAT = 0x40047301 SIOCGIFADDR = 0xc0206921 - SIOCGIFASYNCMAP = 0xc020697c SIOCGIFBRDADDR = 0xc0206923 SIOCGIFCONF = 0xc0086924 SIOCGIFDATA = 0xc020691b @@ -1168,40 +1333,53 @@ const ( SIOCGIFFLAGS = 0xc0206911 SIOCGIFGATTR = 0xc024698b SIOCGIFGENERIC = 0xc020693a + SIOCGIFGLIST = 0xc024698d SIOCGIFGMEMB = 0xc024698a SIOCGIFGROUP = 0xc0246988 SIOCGIFHARDMTU = 0xc02069a5 - SIOCGIFMEDIA = 0xc0286936 + SIOCGIFLLPRIO = 0xc02069b6 + SIOCGIFMEDIA = 0xc0386938 SIOCGIFMETRIC = 0xc0206917 SIOCGIFMTU = 0xc020697e SIOCGIFNETMASK = 0xc0206925 - SIOCGIFPDSTADDR = 0xc0206948 + SIOCGIFPAIR = 0xc02069b1 + SIOCGIFPARENT = 0xc02069b3 SIOCGIFPRIORITY = 0xc020699c - SIOCGIFPSRCADDR = 0xc0206947 SIOCGIFRDOMAIN = 0xc02069a0 SIOCGIFRTLABEL = 0xc0206983 - SIOCGIFTIMESLOT = 0xc0206986 + SIOCGIFRXR = 0x802069aa + SIOCGIFSFFPAGE = 0xc1126939 SIOCGIFXFLAGS = 0xc020699e - SIOCGLIFADDR = 0xc218691d SIOCGLIFPHYADDR = 0xc218694b + SIOCGLIFPHYDF = 0xc02069c2 + SIOCGLIFPHYECN = 0xc02069c8 SIOCGLIFPHYRTABLE = 0xc02069a2 SIOCGLIFPHYTTL = 0xc02069a9 - SIOCGLOWAT = 0x40047303 SIOCGPGRP = 0x40047309 + SIOCGPWE3 = 0xc0206998 + SIOCGPWE3CTRLWORD = 0xc02069dc + SIOCGPWE3FAT = 0xc02069dd + SIOCGPWE3NEIGHBOR = 0xc21869de + SIOCGRXHPRIO = 0xc02069db SIOCGSPPPPARAMS = 0xc0206994 + SIOCGTXHPRIO = 0xc02069c6 + SIOCGUMBINFO = 0xc02069be + SIOCGUMBPARAM = 0xc02069c0 SIOCGVH = 0xc02069f6 + SIOCGVNETFLOWID = 0xc02069c4 SIOCGVNETID = 0xc02069a7 + SIOCIFAFATTACH = 0x801169ab + SIOCIFAFDETACH = 0x801169ac SIOCIFCREATE = 0x8020697a SIOCIFDESTROY = 0x80206979 SIOCIFGCLONERS = 0xc00c6978 SIOCSETKALIVE = 0x801869a3 SIOCSETLABEL = 0x80206999 + SIOCSETMPWCFG = 0x802069ad SIOCSETPFLOW = 0x802069fd SIOCSETPFSYNC = 0x802069f7 SIOCSETVLAN = 0x8020698f - SIOCSHIWAT = 0x80047300 SIOCSIFADDR = 0x8020690c - SIOCSIFASYNCMAP = 0x8020697d SIOCSIFBRDADDR = 0x80206913 SIOCSIFDESCR = 0x80206980 SIOCSIFDSTADDR = 0x8020690e @@ -1209,25 +1387,37 @@ const ( SIOCSIFGATTR = 0x8024698c SIOCSIFGENERIC = 0x80206939 SIOCSIFLLADDR = 0x8020691f - SIOCSIFMEDIA = 0xc0206935 + SIOCSIFLLPRIO = 0x802069b5 + SIOCSIFMEDIA = 0xc0206937 SIOCSIFMETRIC = 0x80206918 SIOCSIFMTU = 0x8020697f SIOCSIFNETMASK = 0x80206916 - SIOCSIFPHYADDR = 0x80406946 + SIOCSIFPAIR = 0x802069b0 + SIOCSIFPARENT = 0x802069b2 SIOCSIFPRIORITY = 0x8020699b SIOCSIFRDOMAIN = 0x8020699f SIOCSIFRTLABEL = 0x80206982 - SIOCSIFTIMESLOT = 0x80206985 SIOCSIFXFLAGS = 0x8020699d SIOCSLIFPHYADDR = 0x8218694a + SIOCSLIFPHYDF = 0x802069c1 + SIOCSLIFPHYECN = 0x802069c7 SIOCSLIFPHYRTABLE = 0x802069a1 SIOCSLIFPHYTTL = 0x802069a8 - SIOCSLOWAT = 0x80047302 SIOCSPGRP = 0x80047308 + SIOCSPWE3CTRLWORD = 0x802069dc + SIOCSPWE3FAT = 0x802069dd + SIOCSPWE3NEIGHBOR = 0x821869de + SIOCSRXHPRIO = 0x802069db SIOCSSPPPPARAMS = 0x80206993 + SIOCSTXHPRIO = 0x802069c5 + SIOCSUMBPARAM = 0x802069bf SIOCSVH = 0xc02069f5 + SIOCSVNETFLOWID = 0x802069c3 SIOCSVNETID = 0x802069a6 + SOCK_CLOEXEC = 0x8000 SOCK_DGRAM = 0x2 + SOCK_DNS = 0x1000 + SOCK_NONBLOCK = 0x4000 SOCK_RAW = 0x3 SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 @@ -1238,6 +1428,7 @@ const ( SO_BINDANY = 0x1000 SO_BROADCAST = 0x20 SO_DEBUG = 0x1 + SO_DOMAIN = 0x1024 SO_DONTROUTE = 0x10 SO_ERROR = 0x1007 SO_KEEPALIVE = 0x8 @@ -1245,6 +1436,7 @@ const ( SO_NETPROC = 0x1020 SO_OOBINLINE = 0x100 SO_PEERCRED = 0x1022 + SO_PROTOCOL = 0x1025 SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 @@ -1258,6 +1450,7 @@ const ( SO_TIMESTAMP = 0x800 SO_TYPE = 0x1008 SO_USELOOPBACK = 0x40 + SO_ZEROIZE = 0x2000 S_BLKSIZE = 0x200 S_IEXEC = 0x40 S_IFBLK = 0x6000 @@ -1287,9 +1480,24 @@ const ( S_IXOTH = 0x1 S_IXUSR = 0x40 TCIFLUSH = 0x1 + TCIOFF = 0x3 TCIOFLUSH = 0x3 + TCION = 0x4 TCOFLUSH = 0x2 - TCP_MAXBURST = 0x4 + TCOOFF = 0x1 + TCOON = 0x2 + TCPOPT_EOL = 0x0 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_HDR = 0x1010500 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SACK_PERMIT_HDR = 0x1010402 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_TSTAMP_HDR = 0x101080a + TCPOPT_WINDOW = 0x3 + TCP_INFO = 0x9 TCP_MAXSEG = 0x2 TCP_MAXWIN = 0xffff TCP_MAX_SACK = 0x3 @@ -1298,11 +1506,15 @@ const ( TCP_MSS = 0x200 TCP_NODELAY = 0x1 TCP_NOPUSH = 0x10 - TCP_NSTATES = 0xb + TCP_SACKHOLE_LIMIT = 0x80 TCP_SACK_ENABLE = 0x8 TCSAFLUSH = 0x2 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 + TIOCCHKVERAUTH = 0x2000741e + TIOCCLRVERAUTH = 0x2000741d TIOCCONS = 0x80047462 TIOCDRAIN = 0x2000745e TIOCEXCL = 0x2000740d @@ -1357,17 +1569,21 @@ const ( TIOCSETAF = 0x802c7416 TIOCSETAW = 0x802c7415 TIOCSETD = 0x8004741b + TIOCSETVERAUTH = 0x8004741c TIOCSFLAGS = 0x8004745c TIOCSIG = 0x8004745f TIOCSPGRP = 0x80047476 TIOCSTART = 0x2000746e - TIOCSTAT = 0x80047465 - TIOCSTI = 0x80017472 + TIOCSTAT = 0x20007465 TIOCSTOP = 0x2000746f TIOCSTSTAMP = 0x8008745a TIOCSWINSZ = 0x80087467 TIOCUCNTL = 0x80047466 + TIOCUCNTL_CBRK = 0x7a + TIOCUCNTL_SBRK = 0x7b TOSTOP = 0x400000 + UTIME_NOW = -0x2 + UTIME_OMIT = -0x1 VDISCARD = 0xf VDSUSP = 0xb VEOF = 0x0 @@ -1378,6 +1594,19 @@ const ( VKILL = 0x5 VLNEXT = 0xe VMIN = 0x10 + VM_ANONMIN = 0x7 + VM_LOADAVG = 0x2 + VM_MALLOC_CONF = 0xc + VM_MAXID = 0xd + VM_MAXSLP = 0xa + VM_METER = 0x1 + VM_NKMEMPAGES = 0x6 + VM_PSSTRINGS = 0x3 + VM_SWAPENCRYPT = 0x5 + VM_USPACE = 0xb + VM_UVMEXP = 0x4 + VM_VNODEMIN = 0x9 + VM_VTEXTMIN = 0x8 VQUIT = 0x9 VREPRINT = 0x6 VSTART = 0xc @@ -1390,8 +1619,8 @@ const ( WCONTINUED = 0x8 WCOREFLAG = 0x80 WNOHANG = 0x1 - WSTOPPED = 0x7f WUNTRACED = 0x2 + XCASE = 0x1000000 ) // Errors @@ -1405,6 +1634,7 @@ const ( EALREADY = syscall.Errno(0x25) EAUTH = syscall.Errno(0x50) EBADF = syscall.Errno(0x9) + EBADMSG = syscall.Errno(0x5c) EBADRPC = syscall.Errno(0x48) EBUSY = syscall.Errno(0x10) ECANCELED = syscall.Errno(0x58) @@ -1431,7 +1661,7 @@ const ( EIPSEC = syscall.Errno(0x52) EISCONN = syscall.Errno(0x38) EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x5b) + ELAST = syscall.Errno(0x5f) ELOOP = syscall.Errno(0x3e) EMEDIUMTYPE = syscall.Errno(0x56) EMFILE = syscall.Errno(0x18) @@ -1459,12 +1689,14 @@ const ( ENOTCONN = syscall.Errno(0x39) ENOTDIR = syscall.Errno(0x14) ENOTEMPTY = syscall.Errno(0x42) + ENOTRECOVERABLE = syscall.Errno(0x5d) ENOTSOCK = syscall.Errno(0x26) ENOTSUP = syscall.Errno(0x5b) ENOTTY = syscall.Errno(0x19) ENXIO = syscall.Errno(0x6) EOPNOTSUPP = syscall.Errno(0x2d) EOVERFLOW = syscall.Errno(0x57) + EOWNERDEAD = syscall.Errno(0x5e) EPERM = syscall.Errno(0x1) EPFNOSUPPORT = syscall.Errno(0x2e) EPIPE = syscall.Errno(0x20) @@ -1472,6 +1704,7 @@ const ( EPROCUNAVAIL = syscall.Errno(0x4c) EPROGMISMATCH = syscall.Errno(0x4b) EPROGUNAVAIL = syscall.Errno(0x4a) + EPROTO = syscall.Errno(0x5f) EPROTONOSUPPORT = syscall.Errno(0x2b) EPROTOTYPE = syscall.Errno(0x29) ERANGE = syscall.Errno(0x22) @@ -1568,7 +1801,7 @@ var errorList = [...]struct { {32, "EPIPE", "broken pipe"}, {33, "EDOM", "numerical argument out of domain"}, {34, "ERANGE", "result too large"}, - {35, "EWOULDBLOCK", "resource temporarily unavailable"}, + {35, "EAGAIN", "resource temporarily unavailable"}, {36, "EINPROGRESS", "operation now in progress"}, {37, "EALREADY", "operation already in progress"}, {38, "ENOTSOCK", "socket operation on non-socket"}, @@ -1624,7 +1857,11 @@ var errorList = [...]struct { {88, "ECANCELED", "operation canceled"}, {89, "EIDRM", "identifier removed"}, {90, "ENOMSG", "no message of desired type"}, - {91, "ELAST", "not supported"}, + {91, "ENOTSUP", "not supported"}, + {92, "EBADMSG", "bad message"}, + {93, "ENOTRECOVERABLE", "state not recoverable"}, + {94, "EOWNERDEAD", "previous owner died"}, + {95, "ELAST", "protocol error"}, } // Signal table @@ -1638,7 +1875,7 @@ var signalList = [...]struct { {3, "SIGQUIT", "quit"}, {4, "SIGILL", "illegal instruction"}, {5, "SIGTRAP", "trace/BPT trap"}, - {6, "SIGABRT", "abort trap"}, + {6, "SIGIOT", "abort trap"}, {7, "SIGEMT", "EMT trap"}, {8, "SIGFPE", "floating point exception"}, {9, "SIGKILL", "killed"}, @@ -1665,4 +1902,5 @@ var signalList = [...]struct { {30, "SIGUSR1", "user defined signal 1"}, {31, "SIGUSR2", "user defined signal 2"}, {32, "SIGTHR", "thread AST"}, + {28672, "SIGSTKSZ", "unknown signal"}, } diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go index 25cb6094813c..6015fcb2bf69 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go @@ -109,6 +109,15 @@ const ( BPF_DIRECTION_IN = 0x1 BPF_DIRECTION_OUT = 0x2 BPF_DIV = 0x30 + BPF_FILDROP_CAPTURE = 0x1 + BPF_FILDROP_DROP = 0x2 + BPF_FILDROP_PASS = 0x0 + BPF_F_DIR_IN = 0x10 + BPF_F_DIR_MASK = 0x30 + BPF_F_DIR_OUT = 0x20 + BPF_F_DIR_SHIFT = 0x4 + BPF_F_FLOWID = 0x8 + BPF_F_PRI_MASK = 0x7 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -137,6 +146,7 @@ const ( BPF_OR = 0x40 BPF_RELEASE = 0x30bb6 BPF_RET = 0x6 + BPF_RND = 0xc0 BPF_RSH = 0x70 BPF_ST = 0x2 BPF_STX = 0x3 @@ -177,7 +187,65 @@ const ( CTL_KERN = 0x1 CTL_MAXNAME = 0xc CTL_NET = 0x4 + DIOCADDQUEUE = 0xc110445d + DIOCADDRULE = 0xcd604404 + DIOCADDSTATE = 0xc1084425 + DIOCCHANGERULE = 0xcd60441a + DIOCCLRIFFLAG = 0xc028445a + DIOCCLRSRCNODES = 0x20004455 + DIOCCLRSTATES = 0xc0e04412 + DIOCCLRSTATUS = 0xc0284416 + DIOCGETLIMIT = 0xc0084427 + DIOCGETQSTATS = 0xc1204460 + DIOCGETQUEUE = 0xc110445f + DIOCGETQUEUES = 0xc110445e + DIOCGETRULE = 0xcd604407 + DIOCGETRULES = 0xcd604406 + DIOCGETRULESET = 0xc444443b + DIOCGETRULESETS = 0xc444443a + DIOCGETSRCNODES = 0xc0104454 + DIOCGETSTATE = 0xc1084413 + DIOCGETSTATES = 0xc0104419 + DIOCGETSTATUS = 0xc1e84415 + DIOCGETSYNFLWATS = 0xc0084463 + DIOCGETTIMEOUT = 0xc008441e + DIOCIGETIFACES = 0xc0284457 + DIOCKILLSRCNODES = 0xc080445b + DIOCKILLSTATES = 0xc0e04429 + DIOCNATLOOK = 0xc0504417 + DIOCOSFPADD = 0xc088444f DIOCOSFPFLUSH = 0x2000444e + DIOCOSFPGET = 0xc0884450 + DIOCRADDADDRS = 0xc4504443 + DIOCRADDTABLES = 0xc450443d + DIOCRCLRADDRS = 0xc4504442 + DIOCRCLRASTATS = 0xc4504448 + DIOCRCLRTABLES = 0xc450443c + DIOCRCLRTSTATS = 0xc4504441 + DIOCRDELADDRS = 0xc4504444 + DIOCRDELTABLES = 0xc450443e + DIOCRGETADDRS = 0xc4504446 + DIOCRGETASTATS = 0xc4504447 + DIOCRGETTABLES = 0xc450443f + DIOCRGETTSTATS = 0xc4504440 + DIOCRINADEFINE = 0xc450444d + DIOCRSETADDRS = 0xc4504445 + DIOCRSETTFLAGS = 0xc450444a + DIOCRTSTADDRS = 0xc4504449 + DIOCSETDEBUG = 0xc0044418 + DIOCSETHOSTID = 0xc0044456 + DIOCSETIFFLAG = 0xc0284459 + DIOCSETLIMIT = 0xc0084428 + DIOCSETREASS = 0xc004445c + DIOCSETSTATUSIF = 0xc0284414 + DIOCSETSYNCOOKIES = 0xc0014462 + DIOCSETSYNFLWATS = 0xc0084461 + DIOCSETTIMEOUT = 0xc008441d + DIOCSTART = 0x20004401 + DIOCSTOP = 0x20004402 + DIOCXBEGIN = 0xc0104451 + DIOCXCOMMIT = 0xc0104452 + DIOCXROLLBACK = 0xc0104453 DLT_ARCNET = 0x7 DLT_ATM_RFC1483 = 0xb DLT_AX25 = 0x3 @@ -240,6 +308,8 @@ const ( EMUL_ENABLED = 0x1 EMUL_NATIVE = 0x2 ENDRUNDISC = 0x9 + ETH64_8021_RSVD_MASK = 0xfffffffffff0 + ETH64_8021_RSVD_PREFIX = 0x180c2000000 ETHERMIN = 0x2e ETHERMTU = 0x5dc ETHERTYPE_8023 = 0x4 @@ -292,6 +362,7 @@ const ( ETHERTYPE_DN = 0x6003 ETHERTYPE_DOGFIGHT = 0x1989 ETHERTYPE_DSMD = 0x8039 + ETHERTYPE_EAPOL = 0x888e ETHERTYPE_ECMA = 0x803 ETHERTYPE_ENCRYPT = 0x803d ETHERTYPE_ES = 0x805d @@ -323,6 +394,7 @@ const ( ETHERTYPE_LLDP = 0x88cc ETHERTYPE_LOGICRAFT = 0x8148 ETHERTYPE_LOOPBACK = 0x9000 + ETHERTYPE_MACSEC = 0x88e5 ETHERTYPE_MATRA = 0x807a ETHERTYPE_MAX = 0xffff ETHERTYPE_MERIT = 0x807c @@ -351,15 +423,17 @@ const ( ETHERTYPE_NCD = 0x8149 ETHERTYPE_NESTAR = 0x8006 ETHERTYPE_NETBEUI = 0x8191 + ETHERTYPE_NHRP = 0x2001 ETHERTYPE_NOVELL = 0x8138 ETHERTYPE_NS = 0x600 ETHERTYPE_NSAT = 0x601 ETHERTYPE_NSCOMPAT = 0x807 + ETHERTYPE_NSH = 0x984f ETHERTYPE_NTRAILER = 0x10 ETHERTYPE_OS9 = 0x7007 ETHERTYPE_OS9NET = 0x7009 ETHERTYPE_PACER = 0x80c6 - ETHERTYPE_PAE = 0x888e + ETHERTYPE_PBB = 0x88e7 ETHERTYPE_PCS = 0x4242 ETHERTYPE_PLANNING = 0x8044 ETHERTYPE_PPP = 0x880b @@ -441,10 +515,11 @@ const ( ETHER_VLAN_ENCAP_LEN = 0x4 EVFILT_AIO = -0x3 EVFILT_DEVICE = -0x8 + EVFILT_EXCEPT = -0x9 EVFILT_PROC = -0x5 EVFILT_READ = -0x1 EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0x8 + EVFILT_SYSCOUNT = 0x9 EVFILT_TIMER = -0x7 EVFILT_VNODE = -0x4 EVFILT_WRITE = -0x2 @@ -466,7 +541,7 @@ const ( EV_FLAG1 = 0x2000 EV_ONESHOT = 0x10 EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 + EV_SYSFLAGS = 0xf800 EXTA = 0x4b00 EXTB = 0x9600 EXTPROC = 0x800 @@ -732,6 +807,7 @@ const ( IFT_VOICEOVERCABLE = 0xc6 IFT_VOICEOVERFRAMERELAY = 0x99 IFT_VOICEOVERIP = 0x68 + IFT_WIREGUARD = 0xfb IFT_X213 = 0x5d IFT_X25 = 0x5 IFT_X25DDN = 0x4 @@ -797,9 +873,11 @@ const ( IPPROTO_RAW = 0xff IPPROTO_ROUTING = 0x2b IPPROTO_RSVP = 0x2e + IPPROTO_SCTP = 0x84 IPPROTO_TCP = 0x6 IPPROTO_TP = 0x1d IPPROTO_UDP = 0x11 + IPPROTO_UDPLITE = 0x88 IPV6_AUTH_LEVEL = 0x35 IPV6_AUTOFLOWLABEL = 0x3b IPV6_CHECKSUM = 0x1a @@ -906,6 +984,9 @@ const ( IP_TTL = 0x4 ISIG = 0x80 ISTRIP = 0x20 + ITIMER_PROF = 0x2 + ITIMER_REAL = 0x0 + ITIMER_VIRTUAL = 0x1 IUCLC = 0x1000 IXANY = 0x800 IXOFF = 0x400 @@ -970,12 +1051,26 @@ const ( MNT_ROOTFS = 0x4000 MNT_SOFTDEP = 0x4000000 MNT_STALLED = 0x100000 + MNT_SWAPPABLE = 0x200000 MNT_SYNCHRONOUS = 0x2 MNT_UPDATE = 0x10000 MNT_VISFLAGMASK = 0x400ffff MNT_WAIT = 0x1 MNT_WANTRDWR = 0x2000000 MNT_WXALLOWED = 0x800 + MOUNT_AFS = "afs" + MOUNT_CD9660 = "cd9660" + MOUNT_EXT2FS = "ext2fs" + MOUNT_FFS = "ffs" + MOUNT_FUSEFS = "fuse" + MOUNT_MFS = "mfs" + MOUNT_MSDOS = "msdos" + MOUNT_NCPFS = "ncpfs" + MOUNT_NFS = "nfs" + MOUNT_NTFS = "ntfs" + MOUNT_TMPFS = "tmpfs" + MOUNT_UDF = "udf" + MOUNT_UFS = "ffs" MSG_BCAST = 0x100 MSG_CMSG_CLOEXEC = 0x800 MSG_CTRUNC = 0x20 @@ -988,6 +1083,7 @@ const ( MSG_PEEK = 0x2 MSG_TRUNC = 0x10 MSG_WAITALL = 0x40 + MSG_WAITFORONE = 0x1000 MS_ASYNC = 0x1 MS_INVALIDATE = 0x4 MS_SYNC = 0x2 @@ -996,7 +1092,8 @@ const ( NET_RT_FLAGS = 0x2 NET_RT_IFLIST = 0x3 NET_RT_IFNAMES = 0x6 - NET_RT_MAXID = 0x7 + NET_RT_MAXID = 0x8 + NET_RT_SOURCE = 0x7 NET_RT_STATS = 0x4 NET_RT_TABLE = 0x5 NFDBITS = 0x20 @@ -1013,6 +1110,7 @@ const ( NOTE_FORK = 0x40000000 NOTE_LINK = 0x10 NOTE_LOWAT = 0x1 + NOTE_OOB = 0x4 NOTE_PCTRLMASK = 0xf0000000 NOTE_PDATAMASK = 0xfffff NOTE_RENAME = 0x20 @@ -1130,9 +1228,11 @@ const ( RTF_STATIC = 0x800 RTF_UP = 0x1 RTF_USETRAILERS = 0x8000 + RTM_80211INFO = 0x15 RTM_ADD = 0x1 RTM_BFD = 0x12 RTM_CHANGE = 0x3 + RTM_CHGADDRATTR = 0x14 RTM_DELADDR = 0xd RTM_DELETE = 0x2 RTM_DESYNC = 0x10 @@ -1140,7 +1240,6 @@ const ( RTM_IFANNOUNCE = 0xf RTM_IFINFO = 0xe RTM_INVALIDATE = 0x11 - RTM_LOCK = 0x8 RTM_LOSING = 0x5 RTM_MAXSIZE = 0x800 RTM_MISS = 0x7 @@ -1148,7 +1247,7 @@ const ( RTM_PROPOSAL = 0x13 RTM_REDIRECT = 0x6 RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 + RTM_SOURCE = 0x16 RTM_VERSION = 0x5 RTV_EXPIRE = 0x4 RTV_HOPCOUNT = 0x2 @@ -1166,6 +1265,9 @@ const ( RUSAGE_THREAD = 0x1 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x4 + SEEK_CUR = 0x1 + SEEK_END = 0x2 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1182,35 +1284,37 @@ const ( SIOCBRDGDELS = 0x80606942 SIOCBRDGFLUSH = 0x80606948 SIOCBRDGFRL = 0x808c694e - SIOCBRDGGCACHE = 0xc0186941 - SIOCBRDGGFD = 0xc0186952 - SIOCBRDGGHT = 0xc0186951 + SIOCBRDGGCACHE = 0xc0146941 + SIOCBRDGGFD = 0xc0146952 + SIOCBRDGGHT = 0xc0146951 SIOCBRDGGIFFLGS = 0xc060693e - SIOCBRDGGMA = 0xc0186953 + SIOCBRDGGMA = 0xc0146953 SIOCBRDGGPARAM = 0xc0406958 - SIOCBRDGGPRI = 0xc0186950 + SIOCBRDGGPRI = 0xc0146950 SIOCBRDGGRL = 0xc030694f - SIOCBRDGGTO = 0xc0186946 + SIOCBRDGGTO = 0xc0146946 SIOCBRDGIFS = 0xc0606942 SIOCBRDGRTS = 0xc0206943 SIOCBRDGSADDR = 0xc1286944 - SIOCBRDGSCACHE = 0x80186940 - SIOCBRDGSFD = 0x80186952 - SIOCBRDGSHT = 0x80186951 + SIOCBRDGSCACHE = 0x80146940 + SIOCBRDGSFD = 0x80146952 + SIOCBRDGSHT = 0x80146951 SIOCBRDGSIFCOST = 0x80606955 SIOCBRDGSIFFLGS = 0x8060693f SIOCBRDGSIFPRIO = 0x80606954 SIOCBRDGSIFPROT = 0x8060694a - SIOCBRDGSMA = 0x80186953 - SIOCBRDGSPRI = 0x80186950 - SIOCBRDGSPROTO = 0x8018695a - SIOCBRDGSTO = 0x80186945 - SIOCBRDGSTXHC = 0x80186959 + SIOCBRDGSMA = 0x80146953 + SIOCBRDGSPRI = 0x80146950 + SIOCBRDGSPROTO = 0x8014695a + SIOCBRDGSTO = 0x80146945 + SIOCBRDGSTXHC = 0x80146959 + SIOCDELLABEL = 0x80206997 SIOCDELMULTI = 0x80206932 SIOCDIFADDR = 0x80206919 SIOCDIFGROUP = 0x80286989 SIOCDIFPARENT = 0x802069b4 SIOCDIFPHYADDR = 0x80206949 + SIOCDPWE3NEIGHBOR = 0x802069de SIOCDVNETID = 0x802069af SIOCGETKALIVE = 0xc01869a4 SIOCGETLABEL = 0x8020699a @@ -1229,6 +1333,7 @@ const ( SIOCGIFFLAGS = 0xc0206911 SIOCGIFGATTR = 0xc028698b SIOCGIFGENERIC = 0xc020693a + SIOCGIFGLIST = 0xc028698d SIOCGIFGMEMB = 0xc028698a SIOCGIFGROUP = 0xc0286988 SIOCGIFHARDMTU = 0xc02069a5 @@ -1243,13 +1348,21 @@ const ( SIOCGIFRDOMAIN = 0xc02069a0 SIOCGIFRTLABEL = 0xc0206983 SIOCGIFRXR = 0x802069aa + SIOCGIFSFFPAGE = 0xc1126939 SIOCGIFXFLAGS = 0xc020699e SIOCGLIFPHYADDR = 0xc218694b SIOCGLIFPHYDF = 0xc02069c2 + SIOCGLIFPHYECN = 0xc02069c8 SIOCGLIFPHYRTABLE = 0xc02069a2 SIOCGLIFPHYTTL = 0xc02069a9 SIOCGPGRP = 0x40047309 + SIOCGPWE3 = 0xc0206998 + SIOCGPWE3CTRLWORD = 0xc02069dc + SIOCGPWE3FAT = 0xc02069dd + SIOCGPWE3NEIGHBOR = 0xc21869de + SIOCGRXHPRIO = 0xc02069db SIOCGSPPPPARAMS = 0xc0206994 + SIOCGTXHPRIO = 0xc02069c6 SIOCGUMBINFO = 0xc02069be SIOCGUMBPARAM = 0xc02069c0 SIOCGVH = 0xc02069f6 @@ -1287,19 +1400,20 @@ const ( SIOCSIFXFLAGS = 0x8020699d SIOCSLIFPHYADDR = 0x8218694a SIOCSLIFPHYDF = 0x802069c1 + SIOCSLIFPHYECN = 0x802069c7 SIOCSLIFPHYRTABLE = 0x802069a1 SIOCSLIFPHYTTL = 0x802069a8 SIOCSPGRP = 0x80047308 + SIOCSPWE3CTRLWORD = 0x802069dc + SIOCSPWE3FAT = 0x802069dd + SIOCSPWE3NEIGHBOR = 0x821869de + SIOCSRXHPRIO = 0x802069db SIOCSSPPPPARAMS = 0x80206993 + SIOCSTXHPRIO = 0x802069c5 SIOCSUMBPARAM = 0x802069bf SIOCSVH = 0xc02069f5 SIOCSVNETFLOWID = 0x802069c3 SIOCSVNETID = 0x802069a6 - SIOCSWGDPID = 0xc018695b - SIOCSWGMAXFLOW = 0xc0186960 - SIOCSWGMAXGROUP = 0xc018695d - SIOCSWSDPID = 0x8018695c - SIOCSWSPORTNO = 0xc060695f SOCK_CLOEXEC = 0x8000 SOCK_DGRAM = 0x2 SOCK_DNS = 0x1000 @@ -1314,6 +1428,7 @@ const ( SO_BINDANY = 0x1000 SO_BROADCAST = 0x20 SO_DEBUG = 0x1 + SO_DOMAIN = 0x1024 SO_DONTROUTE = 0x10 SO_ERROR = 0x1007 SO_KEEPALIVE = 0x8 @@ -1321,6 +1436,7 @@ const ( SO_NETPROC = 0x1020 SO_OOBINLINE = 0x100 SO_PEERCRED = 0x1022 + SO_PROTOCOL = 0x1025 SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 @@ -1370,7 +1486,18 @@ const ( TCOFLUSH = 0x2 TCOOFF = 0x1 TCOON = 0x2 - TCP_MAXBURST = 0x4 + TCPOPT_EOL = 0x0 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_HDR = 0x1010500 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SACK_PERMIT_HDR = 0x1010402 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_TSTAMP_HDR = 0x101080a + TCPOPT_WINDOW = 0x3 + TCP_INFO = 0x9 TCP_MAXSEG = 0x2 TCP_MAXWIN = 0xffff TCP_MAX_SACK = 0x3 @@ -1379,8 +1506,11 @@ const ( TCP_MSS = 0x200 TCP_NODELAY = 0x1 TCP_NOPUSH = 0x10 + TCP_SACKHOLE_LIMIT = 0x80 TCP_SACK_ENABLE = 0x8 TCSAFLUSH = 0x2 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 TIOCCHKVERAUTH = 0x2000741e @@ -1445,7 +1575,6 @@ const ( TIOCSPGRP = 0x80047476 TIOCSTART = 0x2000746e TIOCSTAT = 0x20007465 - TIOCSTI = 0x80017472 TIOCSTOP = 0x2000746f TIOCSTSTAMP = 0x8008745a TIOCSWINSZ = 0x80087467 @@ -1467,7 +1596,8 @@ const ( VMIN = 0x10 VM_ANONMIN = 0x7 VM_LOADAVG = 0x2 - VM_MAXID = 0xc + VM_MALLOC_CONF = 0xc + VM_MAXID = 0xd VM_MAXSLP = 0xa VM_METER = 0x1 VM_NKMEMPAGES = 0x6 @@ -1745,7 +1875,7 @@ var signalList = [...]struct { {3, "SIGQUIT", "quit"}, {4, "SIGILL", "illegal instruction"}, {5, "SIGTRAP", "trace/BPT trap"}, - {6, "SIGABRT", "abort trap"}, + {6, "SIGIOT", "abort trap"}, {7, "SIGEMT", "EMT trap"}, {8, "SIGFPE", "floating point exception"}, {9, "SIGKILL", "killed"}, @@ -1772,4 +1902,5 @@ var signalList = [...]struct { {30, "SIGUSR1", "user defined signal 1"}, {31, "SIGUSR2", "user defined signal 2"}, {32, "SIGTHR", "thread AST"}, + {28672, "SIGSTKSZ", "unknown signal"}, } diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go index aef6c085609a..8d44955e44d8 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go @@ -46,6 +46,7 @@ const ( AF_SNA = 0xb AF_UNIX = 0x1 AF_UNSPEC = 0x0 + ALTWERASE = 0x200 ARPHRD_ETHER = 0x1 ARPHRD_FRELAY = 0xf ARPHRD_IEEE1394 = 0x18 @@ -82,7 +83,7 @@ const ( BIOCGFILDROP = 0x40044278 BIOCGHDRCMPLT = 0x40044274 BIOCGRSIG = 0x40044273 - BIOCGRTIMEOUT = 0x400c426e + BIOCGRTIMEOUT = 0x4010426e BIOCGSTATS = 0x4008426f BIOCIMMEDIATE = 0x80044270 BIOCLOCK = 0x20004276 @@ -96,7 +97,7 @@ const ( BIOCSFILDROP = 0x80044279 BIOCSHDRCMPLT = 0x80044275 BIOCSRSIG = 0x80044272 - BIOCSRTIMEOUT = 0x800c426d + BIOCSRTIMEOUT = 0x8010426d BIOCVERSION = 0x40044271 BPF_A = 0x10 BPF_ABS = 0x20 @@ -108,6 +109,15 @@ const ( BPF_DIRECTION_IN = 0x1 BPF_DIRECTION_OUT = 0x2 BPF_DIV = 0x30 + BPF_FILDROP_CAPTURE = 0x1 + BPF_FILDROP_DROP = 0x2 + BPF_FILDROP_PASS = 0x0 + BPF_F_DIR_IN = 0x10 + BPF_F_DIR_MASK = 0x30 + BPF_F_DIR_OUT = 0x20 + BPF_F_DIR_SHIFT = 0x4 + BPF_F_FLOWID = 0x8 + BPF_F_PRI_MASK = 0x7 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -136,6 +146,7 @@ const ( BPF_OR = 0x40 BPF_RELEASE = 0x30bb6 BPF_RET = 0x6 + BPF_RND = 0xc0 BPF_RSH = 0x70 BPF_ST = 0x2 BPF_STX = 0x3 @@ -147,6 +158,12 @@ const ( BRKINT = 0x2 CFLUSH = 0xf CLOCAL = 0x8000 + CLOCK_BOOTTIME = 0x6 + CLOCK_MONOTONIC = 0x3 + CLOCK_PROCESS_CPUTIME_ID = 0x2 + CLOCK_REALTIME = 0x0 + CLOCK_THREAD_CPUTIME_ID = 0x4 + CLOCK_UPTIME = 0x5 CPUSTATES = 0x6 CP_IDLE = 0x5 CP_INTR = 0x4 @@ -170,7 +187,65 @@ const ( CTL_KERN = 0x1 CTL_MAXNAME = 0xc CTL_NET = 0x4 + DIOCADDQUEUE = 0xc100445d + DIOCADDRULE = 0xcce04404 + DIOCADDSTATE = 0xc1084425 + DIOCCHANGERULE = 0xcce0441a + DIOCCLRIFFLAG = 0xc024445a + DIOCCLRSRCNODES = 0x20004455 + DIOCCLRSTATES = 0xc0d04412 + DIOCCLRSTATUS = 0xc0244416 + DIOCGETLIMIT = 0xc0084427 + DIOCGETQSTATS = 0xc1084460 + DIOCGETQUEUE = 0xc100445f + DIOCGETQUEUES = 0xc100445e + DIOCGETRULE = 0xcce04407 + DIOCGETRULES = 0xcce04406 + DIOCGETRULESET = 0xc444443b + DIOCGETRULESETS = 0xc444443a + DIOCGETSRCNODES = 0xc0084454 + DIOCGETSTATE = 0xc1084413 + DIOCGETSTATES = 0xc0084419 + DIOCGETSTATUS = 0xc1e84415 + DIOCGETSYNFLWATS = 0xc0084463 + DIOCGETTIMEOUT = 0xc008441e + DIOCIGETIFACES = 0xc0244457 + DIOCKILLSRCNODES = 0xc068445b + DIOCKILLSTATES = 0xc0d04429 + DIOCNATLOOK = 0xc0504417 + DIOCOSFPADD = 0xc088444f DIOCOSFPFLUSH = 0x2000444e + DIOCOSFPGET = 0xc0884450 + DIOCRADDADDRS = 0xc44c4443 + DIOCRADDTABLES = 0xc44c443d + DIOCRCLRADDRS = 0xc44c4442 + DIOCRCLRASTATS = 0xc44c4448 + DIOCRCLRTABLES = 0xc44c443c + DIOCRCLRTSTATS = 0xc44c4441 + DIOCRDELADDRS = 0xc44c4444 + DIOCRDELTABLES = 0xc44c443e + DIOCRGETADDRS = 0xc44c4446 + DIOCRGETASTATS = 0xc44c4447 + DIOCRGETTABLES = 0xc44c443f + DIOCRGETTSTATS = 0xc44c4440 + DIOCRINADEFINE = 0xc44c444d + DIOCRSETADDRS = 0xc44c4445 + DIOCRSETTFLAGS = 0xc44c444a + DIOCRTSTADDRS = 0xc44c4449 + DIOCSETDEBUG = 0xc0044418 + DIOCSETHOSTID = 0xc0044456 + DIOCSETIFFLAG = 0xc0244459 + DIOCSETLIMIT = 0xc0084428 + DIOCSETREASS = 0xc004445c + DIOCSETSTATUSIF = 0xc0244414 + DIOCSETSYNCOOKIES = 0xc0014462 + DIOCSETSYNFLWATS = 0xc0084461 + DIOCSETTIMEOUT = 0xc008441d + DIOCSTART = 0x20004401 + DIOCSTOP = 0x20004402 + DIOCXBEGIN = 0xc00c4451 + DIOCXCOMMIT = 0xc00c4452 + DIOCXROLLBACK = 0xc00c4453 DLT_ARCNET = 0x7 DLT_ATM_RFC1483 = 0xb DLT_AX25 = 0x3 @@ -186,6 +261,7 @@ const ( DLT_LOOP = 0xc DLT_MPLS = 0xdb DLT_NULL = 0x0 + DLT_OPENFLOW = 0x10b DLT_PFLOG = 0x75 DLT_PFSYNC = 0x12 DLT_PPP = 0x9 @@ -196,6 +272,23 @@ const ( DLT_RAW = 0xe DLT_SLIP = 0x8 DLT_SLIP_BSDOS = 0xf + DLT_USBPCAP = 0xf9 + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c DT_BLK = 0x6 DT_CHR = 0x2 DT_DIR = 0x4 @@ -215,6 +308,8 @@ const ( EMUL_ENABLED = 0x1 EMUL_NATIVE = 0x2 ENDRUNDISC = 0x9 + ETH64_8021_RSVD_MASK = 0xfffffffffff0 + ETH64_8021_RSVD_PREFIX = 0x180c2000000 ETHERMIN = 0x2e ETHERMTU = 0x5dc ETHERTYPE_8023 = 0x4 @@ -267,6 +362,7 @@ const ( ETHERTYPE_DN = 0x6003 ETHERTYPE_DOGFIGHT = 0x1989 ETHERTYPE_DSMD = 0x8039 + ETHERTYPE_EAPOL = 0x888e ETHERTYPE_ECMA = 0x803 ETHERTYPE_ENCRYPT = 0x803d ETHERTYPE_ES = 0x805d @@ -298,6 +394,7 @@ const ( ETHERTYPE_LLDP = 0x88cc ETHERTYPE_LOGICRAFT = 0x8148 ETHERTYPE_LOOPBACK = 0x9000 + ETHERTYPE_MACSEC = 0x88e5 ETHERTYPE_MATRA = 0x807a ETHERTYPE_MAX = 0xffff ETHERTYPE_MERIT = 0x807c @@ -326,15 +423,17 @@ const ( ETHERTYPE_NCD = 0x8149 ETHERTYPE_NESTAR = 0x8006 ETHERTYPE_NETBEUI = 0x8191 + ETHERTYPE_NHRP = 0x2001 ETHERTYPE_NOVELL = 0x8138 ETHERTYPE_NS = 0x600 ETHERTYPE_NSAT = 0x601 ETHERTYPE_NSCOMPAT = 0x807 + ETHERTYPE_NSH = 0x984f ETHERTYPE_NTRAILER = 0x10 ETHERTYPE_OS9 = 0x7007 ETHERTYPE_OS9NET = 0x7009 ETHERTYPE_PACER = 0x80c6 - ETHERTYPE_PAE = 0x888e + ETHERTYPE_PBB = 0x88e7 ETHERTYPE_PCS = 0x4242 ETHERTYPE_PLANNING = 0x8044 ETHERTYPE_PPP = 0x880b @@ -409,28 +508,40 @@ const ( ETHER_CRC_POLY_LE = 0xedb88320 ETHER_HDR_LEN = 0xe ETHER_MAX_DIX_LEN = 0x600 + ETHER_MAX_HARDMTU_LEN = 0xff9b ETHER_MAX_LEN = 0x5ee ETHER_MIN_LEN = 0x40 ETHER_TYPE_LEN = 0x2 ETHER_VLAN_ENCAP_LEN = 0x4 EVFILT_AIO = -0x3 + EVFILT_DEVICE = -0x8 + EVFILT_EXCEPT = -0x9 EVFILT_PROC = -0x5 EVFILT_READ = -0x1 EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0x7 + EVFILT_SYSCOUNT = 0x9 EVFILT_TIMER = -0x7 EVFILT_VNODE = -0x4 EVFILT_WRITE = -0x2 + EVL_ENCAPLEN = 0x4 + EVL_PRIO_BITS = 0xd + EVL_PRIO_MAX = 0x7 + EVL_VLID_MASK = 0xfff + EVL_VLID_MAX = 0xffe + EVL_VLID_MIN = 0x1 + EVL_VLID_NULL = 0x0 EV_ADD = 0x1 EV_CLEAR = 0x20 EV_DELETE = 0x2 EV_DISABLE = 0x8 + EV_DISPATCH = 0x80 EV_ENABLE = 0x4 EV_EOF = 0x8000 EV_ERROR = 0x4000 EV_FLAG1 = 0x2000 EV_ONESHOT = 0x10 - EV_SYSFLAGS = 0xf000 + EV_RECEIPT = 0x40 + EV_SYSFLAGS = 0xf800 EXTA = 0x4b00 EXTB = 0x9600 EXTPROC = 0x800 @@ -443,6 +554,8 @@ const ( F_GETFL = 0x3 F_GETLK = 0x7 F_GETOWN = 0x5 + F_ISATTY = 0xb + F_OK = 0x0 F_RDLCK = 0x1 F_SETFD = 0x2 F_SETFL = 0x4 @@ -459,7 +572,6 @@ const ( IEXTEN = 0x400 IFAN_ARRIVAL = 0x0 IFAN_DEPARTURE = 0x1 - IFA_ROUTE = 0x1 IFF_ALLMULTI = 0x200 IFF_BROADCAST = 0x2 IFF_CANTCHANGE = 0x8e52 @@ -470,12 +582,12 @@ const ( IFF_LOOPBACK = 0x8 IFF_MULTICAST = 0x8000 IFF_NOARP = 0x80 - IFF_NOTRAILERS = 0x20 IFF_OACTIVE = 0x400 IFF_POINTOPOINT = 0x10 IFF_PROMISC = 0x100 IFF_RUNNING = 0x40 IFF_SIMPLEX = 0x800 + IFF_STATICARP = 0x20 IFF_UP = 0x1 IFNAMSIZ = 0x10 IFT_1822 = 0x2 @@ -604,6 +716,7 @@ const ( IFT_LINEGROUP = 0xd2 IFT_LOCALTALK = 0x2a IFT_LOOP = 0x18 + IFT_MBIM = 0xfa IFT_MEDIAMAILOVERIP = 0x8b IFT_MFSIGLINK = 0xa7 IFT_MIOX25 = 0x26 @@ -694,6 +807,7 @@ const ( IFT_VOICEOVERCABLE = 0xc6 IFT_VOICEOVERFRAMERELAY = 0x99 IFT_VOICEOVERIP = 0x68 + IFT_WIREGUARD = 0xfb IFT_X213 = 0x5d IFT_X25 = 0x5 IFT_X25DDN = 0x4 @@ -728,8 +842,6 @@ const ( IPPROTO_AH = 0x33 IPPROTO_CARP = 0x70 IPPROTO_DIVERT = 0x102 - IPPROTO_DIVERT_INIT = 0x2 - IPPROTO_DIVERT_RESP = 0x1 IPPROTO_DONE = 0x101 IPPROTO_DSTOPTS = 0x3c IPPROTO_EGP = 0x8 @@ -761,9 +873,11 @@ const ( IPPROTO_RAW = 0xff IPPROTO_ROUTING = 0x2b IPPROTO_RSVP = 0x2e + IPPROTO_SCTP = 0x84 IPPROTO_TCP = 0x6 IPPROTO_TP = 0x1d IPPROTO_UDP = 0x11 + IPPROTO_UDPLITE = 0x88 IPV6_AUTH_LEVEL = 0x35 IPV6_AUTOFLOWLABEL = 0x3b IPV6_CHECKSUM = 0x1a @@ -786,6 +900,7 @@ const ( IPV6_LEAVE_GROUP = 0xd IPV6_MAXHLIM = 0xff IPV6_MAXPACKET = 0xffff + IPV6_MINHOPCOUNT = 0x41 IPV6_MMTU = 0x500 IPV6_MULTICAST_HOPS = 0xa IPV6_MULTICAST_IF = 0x9 @@ -825,12 +940,12 @@ const ( IP_DEFAULT_MULTICAST_LOOP = 0x1 IP_DEFAULT_MULTICAST_TTL = 0x1 IP_DF = 0x4000 - IP_DIVERTFL = 0x1022 IP_DROP_MEMBERSHIP = 0xd IP_ESP_NETWORK_LEVEL = 0x16 IP_ESP_TRANS_LEVEL = 0x15 IP_HDRINCL = 0x2 IP_IPCOMP_LEVEL = 0x1d + IP_IPDEFTTL = 0x25 IP_IPSECFLOWINFO = 0x24 IP_IPSEC_LOCAL_AUTH = 0x1b IP_IPSEC_LOCAL_CRED = 0x19 @@ -864,10 +979,15 @@ const ( IP_RETOPTS = 0x8 IP_RF = 0x8000 IP_RTABLE = 0x1021 + IP_SENDSRCADDR = 0x7 IP_TOS = 0x3 IP_TTL = 0x4 ISIG = 0x80 ISTRIP = 0x20 + ITIMER_PROF = 0x2 + ITIMER_REAL = 0x0 + ITIMER_VIRTUAL = 0x1 + IUCLC = 0x1000 IXANY = 0x800 IXOFF = 0x400 IXON = 0x200 @@ -922,6 +1042,7 @@ const ( MNT_NOATIME = 0x8000 MNT_NODEV = 0x10 MNT_NOEXEC = 0x4 + MNT_NOPERM = 0x20 MNT_NOSUID = 0x8 MNT_NOWAIT = 0x2 MNT_QUOTA = 0x2000 @@ -929,12 +1050,27 @@ const ( MNT_RELOAD = 0x40000 MNT_ROOTFS = 0x4000 MNT_SOFTDEP = 0x4000000 + MNT_STALLED = 0x100000 + MNT_SWAPPABLE = 0x200000 MNT_SYNCHRONOUS = 0x2 MNT_UPDATE = 0x10000 MNT_VISFLAGMASK = 0x400ffff MNT_WAIT = 0x1 MNT_WANTRDWR = 0x2000000 MNT_WXALLOWED = 0x800 + MOUNT_AFS = "afs" + MOUNT_CD9660 = "cd9660" + MOUNT_EXT2FS = "ext2fs" + MOUNT_FFS = "ffs" + MOUNT_FUSEFS = "fuse" + MOUNT_MFS = "mfs" + MOUNT_MSDOS = "msdos" + MOUNT_NCPFS = "ncpfs" + MOUNT_NFS = "nfs" + MOUNT_NTFS = "ntfs" + MOUNT_TMPFS = "tmpfs" + MOUNT_UDF = "udf" + MOUNT_UFS = "ffs" MSG_BCAST = 0x100 MSG_CMSG_CLOEXEC = 0x800 MSG_CTRUNC = 0x20 @@ -947,6 +1083,7 @@ const ( MSG_PEEK = 0x2 MSG_TRUNC = 0x10 MSG_WAITALL = 0x40 + MSG_WAITFORONE = 0x1000 MS_ASYNC = 0x1 MS_INVALIDATE = 0x4 MS_SYNC = 0x2 @@ -954,12 +1091,16 @@ const ( NET_RT_DUMP = 0x1 NET_RT_FLAGS = 0x2 NET_RT_IFLIST = 0x3 - NET_RT_MAXID = 0x6 + NET_RT_IFNAMES = 0x6 + NET_RT_MAXID = 0x8 + NET_RT_SOURCE = 0x7 NET_RT_STATS = 0x4 NET_RT_TABLE = 0x5 NFDBITS = 0x20 NOFLSH = 0x80000000 + NOKERNINFO = 0x2000000 NOTE_ATTRIB = 0x8 + NOTE_CHANGE = 0x1 NOTE_CHILD = 0x4 NOTE_DELETE = 0x1 NOTE_EOF = 0x2 @@ -969,6 +1110,7 @@ const ( NOTE_FORK = 0x40000000 NOTE_LINK = 0x10 NOTE_LOWAT = 0x1 + NOTE_OOB = 0x4 NOTE_PCTRLMASK = 0xf0000000 NOTE_PDATAMASK = 0xfffff NOTE_RENAME = 0x20 @@ -978,11 +1120,13 @@ const ( NOTE_TRUNCATE = 0x80 NOTE_WRITE = 0x2 OCRNL = 0x10 + OLCUC = 0x20 ONLCR = 0x2 ONLRET = 0x80 ONOCR = 0x40 ONOEOT = 0x8 OPOST = 0x1 + OXTABS = 0x4 O_ACCMODE = 0x3 O_APPEND = 0x8 O_ASYNC = 0x40 @@ -1027,19 +1171,25 @@ const ( RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 + RTAX_BFD = 0xb RTAX_BRD = 0x7 + RTAX_DNS = 0xc RTAX_DST = 0x0 RTAX_GATEWAY = 0x1 RTAX_GENMASK = 0x3 RTAX_IFA = 0x5 RTAX_IFP = 0x4 RTAX_LABEL = 0xa - RTAX_MAX = 0xb + RTAX_MAX = 0xf RTAX_NETMASK = 0x2 + RTAX_SEARCH = 0xe RTAX_SRC = 0x8 RTAX_SRCMASK = 0x9 + RTAX_STATIC = 0xd RTA_AUTHOR = 0x40 + RTA_BFD = 0x800 RTA_BRD = 0x80 + RTA_DNS = 0x1000 RTA_DST = 0x1 RTA_GATEWAY = 0x2 RTA_GENMASK = 0x8 @@ -1047,24 +1197,29 @@ const ( RTA_IFP = 0x10 RTA_LABEL = 0x400 RTA_NETMASK = 0x4 + RTA_SEARCH = 0x4000 RTA_SRC = 0x100 RTA_SRCMASK = 0x200 + RTA_STATIC = 0x2000 RTF_ANNOUNCE = 0x4000 + RTF_BFD = 0x1000000 RTF_BLACKHOLE = 0x1000 RTF_BROADCAST = 0x400000 + RTF_CACHED = 0x20000 RTF_CLONED = 0x10000 RTF_CLONING = 0x100 + RTF_CONNECTED = 0x800000 RTF_DONE = 0x40 RTF_DYNAMIC = 0x10 - RTF_FMASK = 0x70f808 + RTF_FMASK = 0x110fc08 RTF_GATEWAY = 0x2 RTF_HOST = 0x4 RTF_LLINFO = 0x400 RTF_LOCAL = 0x200000 - RTF_MASK = 0x80 RTF_MODIFIED = 0x20 RTF_MPATH = 0x40000 RTF_MPLS = 0x100000 + RTF_MULTICAST = 0x200 RTF_PERMANENT_ARP = 0x2000 RTF_PROTO1 = 0x8000 RTF_PROTO2 = 0x4000 @@ -1073,23 +1228,26 @@ const ( RTF_STATIC = 0x800 RTF_UP = 0x1 RTF_USETRAILERS = 0x8000 - RTF_XRESOLVE = 0x200 + RTM_80211INFO = 0x15 RTM_ADD = 0x1 + RTM_BFD = 0x12 RTM_CHANGE = 0x3 + RTM_CHGADDRATTR = 0x14 RTM_DELADDR = 0xd RTM_DELETE = 0x2 RTM_DESYNC = 0x10 RTM_GET = 0x4 RTM_IFANNOUNCE = 0xf RTM_IFINFO = 0xe - RTM_LOCK = 0x8 + RTM_INVALIDATE = 0x11 RTM_LOSING = 0x5 RTM_MAXSIZE = 0x800 RTM_MISS = 0x7 RTM_NEWADDR = 0xc + RTM_PROPOSAL = 0x13 RTM_REDIRECT = 0x6 RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 + RTM_SOURCE = 0x16 RTM_VERSION = 0x5 RTV_EXPIRE = 0x4 RTV_HOPCOUNT = 0x2 @@ -1099,67 +1257,74 @@ const ( RTV_RTTVAR = 0x80 RTV_SPIPE = 0x10 RTV_SSTHRESH = 0x20 + RT_TABLEID_BITS = 0x8 + RT_TABLEID_MASK = 0xff RT_TABLEID_MAX = 0xff RUSAGE_CHILDREN = -0x1 RUSAGE_SELF = 0x0 RUSAGE_THREAD = 0x1 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x4 + SEEK_CUR = 0x1 + SEEK_END = 0x2 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 SIOCADDMULTI = 0x80206931 SIOCAIFADDR = 0x8040691a SIOCAIFGROUP = 0x80246987 - SIOCALIFADDR = 0x8218691c SIOCATMARK = 0x40047307 - SIOCBRDGADD = 0x8054693c - SIOCBRDGADDS = 0x80546941 - SIOCBRDGARL = 0x806e694d + SIOCBRDGADD = 0x8060693c + SIOCBRDGADDL = 0x80606949 + SIOCBRDGADDS = 0x80606941 + SIOCBRDGARL = 0x808c694d SIOCBRDGDADDR = 0x81286947 - SIOCBRDGDEL = 0x8054693d - SIOCBRDGDELS = 0x80546942 - SIOCBRDGFLUSH = 0x80546948 - SIOCBRDGFRL = 0x806e694e + SIOCBRDGDEL = 0x8060693d + SIOCBRDGDELS = 0x80606942 + SIOCBRDGFLUSH = 0x80606948 + SIOCBRDGFRL = 0x808c694e SIOCBRDGGCACHE = 0xc0146941 SIOCBRDGGFD = 0xc0146952 SIOCBRDGGHT = 0xc0146951 - SIOCBRDGGIFFLGS = 0xc054693e + SIOCBRDGGIFFLGS = 0xc060693e SIOCBRDGGMA = 0xc0146953 - SIOCBRDGGPARAM = 0xc03c6958 + SIOCBRDGGPARAM = 0xc0406958 SIOCBRDGGPRI = 0xc0146950 SIOCBRDGGRL = 0xc028694f - SIOCBRDGGSIFS = 0xc054693c SIOCBRDGGTO = 0xc0146946 - SIOCBRDGIFS = 0xc0546942 + SIOCBRDGIFS = 0xc0606942 SIOCBRDGRTS = 0xc0186943 SIOCBRDGSADDR = 0xc1286944 SIOCBRDGSCACHE = 0x80146940 SIOCBRDGSFD = 0x80146952 SIOCBRDGSHT = 0x80146951 - SIOCBRDGSIFCOST = 0x80546955 - SIOCBRDGSIFFLGS = 0x8054693f - SIOCBRDGSIFPRIO = 0x80546954 + SIOCBRDGSIFCOST = 0x80606955 + SIOCBRDGSIFFLGS = 0x8060693f + SIOCBRDGSIFPRIO = 0x80606954 + SIOCBRDGSIFPROT = 0x8060694a SIOCBRDGSMA = 0x80146953 SIOCBRDGSPRI = 0x80146950 SIOCBRDGSPROTO = 0x8014695a SIOCBRDGSTO = 0x80146945 SIOCBRDGSTXHC = 0x80146959 + SIOCDELLABEL = 0x80206997 SIOCDELMULTI = 0x80206932 SIOCDIFADDR = 0x80206919 SIOCDIFGROUP = 0x80246989 + SIOCDIFPARENT = 0x802069b4 SIOCDIFPHYADDR = 0x80206949 - SIOCDLIFADDR = 0x8218691e + SIOCDPWE3NEIGHBOR = 0x802069de + SIOCDVNETID = 0x802069af SIOCGETKALIVE = 0xc01869a4 SIOCGETLABEL = 0x8020699a + SIOCGETMPWCFG = 0xc02069ae SIOCGETPFLOW = 0xc02069fe SIOCGETPFSYNC = 0xc02069f8 SIOCGETSGCNT = 0xc0147534 SIOCGETVIFCNT = 0xc0147533 SIOCGETVLAN = 0xc0206990 - SIOCGHIWAT = 0x40047301 SIOCGIFADDR = 0xc0206921 - SIOCGIFASYNCMAP = 0xc020697c SIOCGIFBRDADDR = 0xc0206923 SIOCGIFCONF = 0xc0086924 SIOCGIFDATA = 0xc020691b @@ -1168,41 +1333,53 @@ const ( SIOCGIFFLAGS = 0xc0206911 SIOCGIFGATTR = 0xc024698b SIOCGIFGENERIC = 0xc020693a + SIOCGIFGLIST = 0xc024698d SIOCGIFGMEMB = 0xc024698a SIOCGIFGROUP = 0xc0246988 SIOCGIFHARDMTU = 0xc02069a5 - SIOCGIFMEDIA = 0xc0286936 + SIOCGIFLLPRIO = 0xc02069b6 + SIOCGIFMEDIA = 0xc0386938 SIOCGIFMETRIC = 0xc0206917 SIOCGIFMTU = 0xc020697e SIOCGIFNETMASK = 0xc0206925 - SIOCGIFPDSTADDR = 0xc0206948 + SIOCGIFPAIR = 0xc02069b1 + SIOCGIFPARENT = 0xc02069b3 SIOCGIFPRIORITY = 0xc020699c - SIOCGIFPSRCADDR = 0xc0206947 SIOCGIFRDOMAIN = 0xc02069a0 SIOCGIFRTLABEL = 0xc0206983 SIOCGIFRXR = 0x802069aa - SIOCGIFTIMESLOT = 0xc0206986 + SIOCGIFSFFPAGE = 0xc1126939 SIOCGIFXFLAGS = 0xc020699e - SIOCGLIFADDR = 0xc218691d SIOCGLIFPHYADDR = 0xc218694b + SIOCGLIFPHYDF = 0xc02069c2 + SIOCGLIFPHYECN = 0xc02069c8 SIOCGLIFPHYRTABLE = 0xc02069a2 SIOCGLIFPHYTTL = 0xc02069a9 - SIOCGLOWAT = 0x40047303 SIOCGPGRP = 0x40047309 + SIOCGPWE3 = 0xc0206998 + SIOCGPWE3CTRLWORD = 0xc02069dc + SIOCGPWE3FAT = 0xc02069dd + SIOCGPWE3NEIGHBOR = 0xc21869de + SIOCGRXHPRIO = 0xc02069db SIOCGSPPPPARAMS = 0xc0206994 + SIOCGTXHPRIO = 0xc02069c6 + SIOCGUMBINFO = 0xc02069be + SIOCGUMBPARAM = 0xc02069c0 SIOCGVH = 0xc02069f6 + SIOCGVNETFLOWID = 0xc02069c4 SIOCGVNETID = 0xc02069a7 + SIOCIFAFATTACH = 0x801169ab + SIOCIFAFDETACH = 0x801169ac SIOCIFCREATE = 0x8020697a SIOCIFDESTROY = 0x80206979 SIOCIFGCLONERS = 0xc00c6978 SIOCSETKALIVE = 0x801869a3 SIOCSETLABEL = 0x80206999 + SIOCSETMPWCFG = 0x802069ad SIOCSETPFLOW = 0x802069fd SIOCSETPFSYNC = 0x802069f7 SIOCSETVLAN = 0x8020698f - SIOCSHIWAT = 0x80047300 SIOCSIFADDR = 0x8020690c - SIOCSIFASYNCMAP = 0x8020697d SIOCSIFBRDADDR = 0x80206913 SIOCSIFDESCR = 0x80206980 SIOCSIFDSTADDR = 0x8020690e @@ -1210,26 +1387,36 @@ const ( SIOCSIFGATTR = 0x8024698c SIOCSIFGENERIC = 0x80206939 SIOCSIFLLADDR = 0x8020691f - SIOCSIFMEDIA = 0xc0206935 + SIOCSIFLLPRIO = 0x802069b5 + SIOCSIFMEDIA = 0xc0206937 SIOCSIFMETRIC = 0x80206918 SIOCSIFMTU = 0x8020697f SIOCSIFNETMASK = 0x80206916 - SIOCSIFPHYADDR = 0x80406946 + SIOCSIFPAIR = 0x802069b0 + SIOCSIFPARENT = 0x802069b2 SIOCSIFPRIORITY = 0x8020699b SIOCSIFRDOMAIN = 0x8020699f SIOCSIFRTLABEL = 0x80206982 - SIOCSIFTIMESLOT = 0x80206985 SIOCSIFXFLAGS = 0x8020699d SIOCSLIFPHYADDR = 0x8218694a + SIOCSLIFPHYDF = 0x802069c1 + SIOCSLIFPHYECN = 0x802069c7 SIOCSLIFPHYRTABLE = 0x802069a1 SIOCSLIFPHYTTL = 0x802069a8 - SIOCSLOWAT = 0x80047302 SIOCSPGRP = 0x80047308 + SIOCSPWE3CTRLWORD = 0x802069dc + SIOCSPWE3FAT = 0x802069dd + SIOCSPWE3NEIGHBOR = 0x821869de + SIOCSRXHPRIO = 0x802069db SIOCSSPPPPARAMS = 0x80206993 + SIOCSTXHPRIO = 0x802069c5 + SIOCSUMBPARAM = 0x802069bf SIOCSVH = 0xc02069f5 + SIOCSVNETFLOWID = 0x802069c3 SIOCSVNETID = 0x802069a6 SOCK_CLOEXEC = 0x8000 SOCK_DGRAM = 0x2 + SOCK_DNS = 0x1000 SOCK_NONBLOCK = 0x4000 SOCK_RAW = 0x3 SOCK_RDM = 0x4 @@ -1241,6 +1428,7 @@ const ( SO_BINDANY = 0x1000 SO_BROADCAST = 0x20 SO_DEBUG = 0x1 + SO_DOMAIN = 0x1024 SO_DONTROUTE = 0x10 SO_ERROR = 0x1007 SO_KEEPALIVE = 0x8 @@ -1248,6 +1436,7 @@ const ( SO_NETPROC = 0x1020 SO_OOBINLINE = 0x100 SO_PEERCRED = 0x1022 + SO_PROTOCOL = 0x1025 SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 @@ -1261,6 +1450,7 @@ const ( SO_TIMESTAMP = 0x800 SO_TYPE = 0x1008 SO_USELOOPBACK = 0x40 + SO_ZEROIZE = 0x2000 S_BLKSIZE = 0x200 S_IEXEC = 0x40 S_IFBLK = 0x6000 @@ -1290,9 +1480,24 @@ const ( S_IXOTH = 0x1 S_IXUSR = 0x40 TCIFLUSH = 0x1 + TCIOFF = 0x3 TCIOFLUSH = 0x3 + TCION = 0x4 TCOFLUSH = 0x2 - TCP_MAXBURST = 0x4 + TCOOFF = 0x1 + TCOON = 0x2 + TCPOPT_EOL = 0x0 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_HDR = 0x1010500 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SACK_PERMIT_HDR = 0x1010402 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_TSTAMP_HDR = 0x101080a + TCPOPT_WINDOW = 0x3 + TCP_INFO = 0x9 TCP_MAXSEG = 0x2 TCP_MAXWIN = 0xffff TCP_MAX_SACK = 0x3 @@ -1301,11 +1506,15 @@ const ( TCP_MSS = 0x200 TCP_NODELAY = 0x1 TCP_NOPUSH = 0x10 - TCP_NSTATES = 0xb + TCP_SACKHOLE_LIMIT = 0x80 TCP_SACK_ENABLE = 0x8 TCSAFLUSH = 0x2 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 + TIOCCHKVERAUTH = 0x2000741e + TIOCCLRVERAUTH = 0x2000741d TIOCCONS = 0x80047462 TIOCDRAIN = 0x2000745e TIOCEXCL = 0x2000740d @@ -1321,7 +1530,7 @@ const ( TIOCGFLAGS = 0x4004745d TIOCGPGRP = 0x40047477 TIOCGSID = 0x40047463 - TIOCGTSTAMP = 0x400c745b + TIOCGTSTAMP = 0x4010745b TIOCGWINSZ = 0x40087468 TIOCMBIC = 0x8004746b TIOCMBIS = 0x8004746c @@ -1360,17 +1569,21 @@ const ( TIOCSETAF = 0x802c7416 TIOCSETAW = 0x802c7415 TIOCSETD = 0x8004741b + TIOCSETVERAUTH = 0x8004741c TIOCSFLAGS = 0x8004745c TIOCSIG = 0x8004745f TIOCSPGRP = 0x80047476 TIOCSTART = 0x2000746e - TIOCSTAT = 0x80047465 - TIOCSTI = 0x80017472 + TIOCSTAT = 0x20007465 TIOCSTOP = 0x2000746f TIOCSTSTAMP = 0x8008745a TIOCSWINSZ = 0x80087467 TIOCUCNTL = 0x80047466 + TIOCUCNTL_CBRK = 0x7a + TIOCUCNTL_SBRK = 0x7b TOSTOP = 0x400000 + UTIME_NOW = -0x2 + UTIME_OMIT = -0x1 VDISCARD = 0xf VDSUSP = 0xb VEOF = 0x0 @@ -1381,6 +1594,19 @@ const ( VKILL = 0x5 VLNEXT = 0xe VMIN = 0x10 + VM_ANONMIN = 0x7 + VM_LOADAVG = 0x2 + VM_MALLOC_CONF = 0xc + VM_MAXID = 0xd + VM_MAXSLP = 0xa + VM_METER = 0x1 + VM_NKMEMPAGES = 0x6 + VM_PSSTRINGS = 0x3 + VM_SWAPENCRYPT = 0x5 + VM_USPACE = 0xb + VM_UVMEXP = 0x4 + VM_VNODEMIN = 0x9 + VM_VTEXTMIN = 0x8 VQUIT = 0x9 VREPRINT = 0x6 VSTART = 0xc @@ -1394,6 +1620,7 @@ const ( WCOREFLAG = 0x80 WNOHANG = 0x1 WUNTRACED = 0x2 + XCASE = 0x1000000 ) // Errors @@ -1407,6 +1634,7 @@ const ( EALREADY = syscall.Errno(0x25) EAUTH = syscall.Errno(0x50) EBADF = syscall.Errno(0x9) + EBADMSG = syscall.Errno(0x5c) EBADRPC = syscall.Errno(0x48) EBUSY = syscall.Errno(0x10) ECANCELED = syscall.Errno(0x58) @@ -1433,7 +1661,7 @@ const ( EIPSEC = syscall.Errno(0x52) EISCONN = syscall.Errno(0x38) EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x5b) + ELAST = syscall.Errno(0x5f) ELOOP = syscall.Errno(0x3e) EMEDIUMTYPE = syscall.Errno(0x56) EMFILE = syscall.Errno(0x18) @@ -1461,12 +1689,14 @@ const ( ENOTCONN = syscall.Errno(0x39) ENOTDIR = syscall.Errno(0x14) ENOTEMPTY = syscall.Errno(0x42) + ENOTRECOVERABLE = syscall.Errno(0x5d) ENOTSOCK = syscall.Errno(0x26) ENOTSUP = syscall.Errno(0x5b) ENOTTY = syscall.Errno(0x19) ENXIO = syscall.Errno(0x6) EOPNOTSUPP = syscall.Errno(0x2d) EOVERFLOW = syscall.Errno(0x57) + EOWNERDEAD = syscall.Errno(0x5e) EPERM = syscall.Errno(0x1) EPFNOSUPPORT = syscall.Errno(0x2e) EPIPE = syscall.Errno(0x20) @@ -1474,6 +1704,7 @@ const ( EPROCUNAVAIL = syscall.Errno(0x4c) EPROGMISMATCH = syscall.Errno(0x4b) EPROGUNAVAIL = syscall.Errno(0x4a) + EPROTO = syscall.Errno(0x5f) EPROTONOSUPPORT = syscall.Errno(0x2b) EPROTOTYPE = syscall.Errno(0x29) ERANGE = syscall.Errno(0x22) @@ -1570,7 +1801,7 @@ var errorList = [...]struct { {32, "EPIPE", "broken pipe"}, {33, "EDOM", "numerical argument out of domain"}, {34, "ERANGE", "result too large"}, - {35, "EWOULDBLOCK", "resource temporarily unavailable"}, + {35, "EAGAIN", "resource temporarily unavailable"}, {36, "EINPROGRESS", "operation now in progress"}, {37, "EALREADY", "operation already in progress"}, {38, "ENOTSOCK", "socket operation on non-socket"}, @@ -1626,7 +1857,11 @@ var errorList = [...]struct { {88, "ECANCELED", "operation canceled"}, {89, "EIDRM", "identifier removed"}, {90, "ENOMSG", "no message of desired type"}, - {91, "ELAST", "not supported"}, + {91, "ENOTSUP", "not supported"}, + {92, "EBADMSG", "bad message"}, + {93, "ENOTRECOVERABLE", "state not recoverable"}, + {94, "EOWNERDEAD", "previous owner died"}, + {95, "ELAST", "protocol error"}, } // Signal table @@ -1640,7 +1875,7 @@ var signalList = [...]struct { {3, "SIGQUIT", "quit"}, {4, "SIGILL", "illegal instruction"}, {5, "SIGTRAP", "trace/BPT trap"}, - {6, "SIGABRT", "abort trap"}, + {6, "SIGIOT", "abort trap"}, {7, "SIGEMT", "EMT trap"}, {8, "SIGFPE", "floating point exception"}, {9, "SIGKILL", "killed"}, @@ -1667,4 +1902,5 @@ var signalList = [...]struct { {30, "SIGUSR1", "user defined signal 1"}, {31, "SIGUSR2", "user defined signal 2"}, {32, "SIGTHR", "thread AST"}, + {28672, "SIGSTKSZ", "unknown signal"}, } diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go index 90de7dfc33a3..ae16fe7542ae 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go @@ -112,6 +112,12 @@ const ( BPF_FILDROP_CAPTURE = 0x1 BPF_FILDROP_DROP = 0x2 BPF_FILDROP_PASS = 0x0 + BPF_F_DIR_IN = 0x10 + BPF_F_DIR_MASK = 0x30 + BPF_F_DIR_OUT = 0x20 + BPF_F_DIR_SHIFT = 0x4 + BPF_F_FLOWID = 0x8 + BPF_F_PRI_MASK = 0x7 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -140,6 +146,7 @@ const ( BPF_OR = 0x40 BPF_RELEASE = 0x30bb6 BPF_RET = 0x6 + BPF_RND = 0xc0 BPF_RSH = 0x70 BPF_ST = 0x2 BPF_STX = 0x3 @@ -180,7 +187,65 @@ const ( CTL_KERN = 0x1 CTL_MAXNAME = 0xc CTL_NET = 0x4 + DIOCADDQUEUE = 0xc110445d + DIOCADDRULE = 0xcd604404 + DIOCADDSTATE = 0xc1084425 + DIOCCHANGERULE = 0xcd60441a + DIOCCLRIFFLAG = 0xc028445a + DIOCCLRSRCNODES = 0x20004455 + DIOCCLRSTATES = 0xc0e04412 + DIOCCLRSTATUS = 0xc0284416 + DIOCGETLIMIT = 0xc0084427 + DIOCGETQSTATS = 0xc1204460 + DIOCGETQUEUE = 0xc110445f + DIOCGETQUEUES = 0xc110445e + DIOCGETRULE = 0xcd604407 + DIOCGETRULES = 0xcd604406 + DIOCGETRULESET = 0xc444443b + DIOCGETRULESETS = 0xc444443a + DIOCGETSRCNODES = 0xc0104454 + DIOCGETSTATE = 0xc1084413 + DIOCGETSTATES = 0xc0104419 + DIOCGETSTATUS = 0xc1e84415 + DIOCGETSYNFLWATS = 0xc0084463 + DIOCGETTIMEOUT = 0xc008441e + DIOCIGETIFACES = 0xc0284457 + DIOCKILLSRCNODES = 0xc080445b + DIOCKILLSTATES = 0xc0e04429 + DIOCNATLOOK = 0xc0504417 + DIOCOSFPADD = 0xc088444f DIOCOSFPFLUSH = 0x2000444e + DIOCOSFPGET = 0xc0884450 + DIOCRADDADDRS = 0xc4504443 + DIOCRADDTABLES = 0xc450443d + DIOCRCLRADDRS = 0xc4504442 + DIOCRCLRASTATS = 0xc4504448 + DIOCRCLRTABLES = 0xc450443c + DIOCRCLRTSTATS = 0xc4504441 + DIOCRDELADDRS = 0xc4504444 + DIOCRDELTABLES = 0xc450443e + DIOCRGETADDRS = 0xc4504446 + DIOCRGETASTATS = 0xc4504447 + DIOCRGETTABLES = 0xc450443f + DIOCRGETTSTATS = 0xc4504440 + DIOCRINADEFINE = 0xc450444d + DIOCRSETADDRS = 0xc4504445 + DIOCRSETTFLAGS = 0xc450444a + DIOCRTSTADDRS = 0xc4504449 + DIOCSETDEBUG = 0xc0044418 + DIOCSETHOSTID = 0xc0044456 + DIOCSETIFFLAG = 0xc0284459 + DIOCSETLIMIT = 0xc0084428 + DIOCSETREASS = 0xc004445c + DIOCSETSTATUSIF = 0xc0284414 + DIOCSETSYNCOOKIES = 0xc0014462 + DIOCSETSYNFLWATS = 0xc0084461 + DIOCSETTIMEOUT = 0xc008441d + DIOCSTART = 0x20004401 + DIOCSTOP = 0x20004402 + DIOCXBEGIN = 0xc0104451 + DIOCXCOMMIT = 0xc0104452 + DIOCXROLLBACK = 0xc0104453 DLT_ARCNET = 0x7 DLT_ATM_RFC1483 = 0xb DLT_AX25 = 0x3 @@ -243,6 +308,8 @@ const ( EMUL_ENABLED = 0x1 EMUL_NATIVE = 0x2 ENDRUNDISC = 0x9 + ETH64_8021_RSVD_MASK = 0xfffffffffff0 + ETH64_8021_RSVD_PREFIX = 0x180c2000000 ETHERMIN = 0x2e ETHERMTU = 0x5dc ETHERTYPE_8023 = 0x4 @@ -295,6 +362,7 @@ const ( ETHERTYPE_DN = 0x6003 ETHERTYPE_DOGFIGHT = 0x1989 ETHERTYPE_DSMD = 0x8039 + ETHERTYPE_EAPOL = 0x888e ETHERTYPE_ECMA = 0x803 ETHERTYPE_ENCRYPT = 0x803d ETHERTYPE_ES = 0x805d @@ -326,6 +394,7 @@ const ( ETHERTYPE_LLDP = 0x88cc ETHERTYPE_LOGICRAFT = 0x8148 ETHERTYPE_LOOPBACK = 0x9000 + ETHERTYPE_MACSEC = 0x88e5 ETHERTYPE_MATRA = 0x807a ETHERTYPE_MAX = 0xffff ETHERTYPE_MERIT = 0x807c @@ -354,15 +423,16 @@ const ( ETHERTYPE_NCD = 0x8149 ETHERTYPE_NESTAR = 0x8006 ETHERTYPE_NETBEUI = 0x8191 + ETHERTYPE_NHRP = 0x2001 ETHERTYPE_NOVELL = 0x8138 ETHERTYPE_NS = 0x600 ETHERTYPE_NSAT = 0x601 ETHERTYPE_NSCOMPAT = 0x807 + ETHERTYPE_NSH = 0x984f ETHERTYPE_NTRAILER = 0x10 ETHERTYPE_OS9 = 0x7007 ETHERTYPE_OS9NET = 0x7009 ETHERTYPE_PACER = 0x80c6 - ETHERTYPE_PAE = 0x888e ETHERTYPE_PBB = 0x88e7 ETHERTYPE_PCS = 0x4242 ETHERTYPE_PLANNING = 0x8044 @@ -445,10 +515,11 @@ const ( ETHER_VLAN_ENCAP_LEN = 0x4 EVFILT_AIO = -0x3 EVFILT_DEVICE = -0x8 + EVFILT_EXCEPT = -0x9 EVFILT_PROC = -0x5 EVFILT_READ = -0x1 EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0x8 + EVFILT_SYSCOUNT = 0x9 EVFILT_TIMER = -0x7 EVFILT_VNODE = -0x4 EVFILT_WRITE = -0x2 @@ -470,7 +541,7 @@ const ( EV_FLAG1 = 0x2000 EV_ONESHOT = 0x10 EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 + EV_SYSFLAGS = 0xf800 EXTA = 0x4b00 EXTB = 0x9600 EXTPROC = 0x800 @@ -736,6 +807,7 @@ const ( IFT_VOICEOVERCABLE = 0xc6 IFT_VOICEOVERFRAMERELAY = 0x99 IFT_VOICEOVERIP = 0x68 + IFT_WIREGUARD = 0xfb IFT_X213 = 0x5d IFT_X25 = 0x5 IFT_X25DDN = 0x4 @@ -801,9 +873,11 @@ const ( IPPROTO_RAW = 0xff IPPROTO_ROUTING = 0x2b IPPROTO_RSVP = 0x2e + IPPROTO_SCTP = 0x84 IPPROTO_TCP = 0x6 IPPROTO_TP = 0x1d IPPROTO_UDP = 0x11 + IPPROTO_UDPLITE = 0x88 IPV6_AUTH_LEVEL = 0x35 IPV6_AUTOFLOWLABEL = 0x3b IPV6_CHECKSUM = 0x1a @@ -910,6 +984,9 @@ const ( IP_TTL = 0x4 ISIG = 0x80 ISTRIP = 0x20 + ITIMER_PROF = 0x2 + ITIMER_REAL = 0x0 + ITIMER_VIRTUAL = 0x1 IUCLC = 0x1000 IXANY = 0x800 IXOFF = 0x400 @@ -981,6 +1058,19 @@ const ( MNT_WAIT = 0x1 MNT_WANTRDWR = 0x2000000 MNT_WXALLOWED = 0x800 + MOUNT_AFS = "afs" + MOUNT_CD9660 = "cd9660" + MOUNT_EXT2FS = "ext2fs" + MOUNT_FFS = "ffs" + MOUNT_FUSEFS = "fuse" + MOUNT_MFS = "mfs" + MOUNT_MSDOS = "msdos" + MOUNT_NCPFS = "ncpfs" + MOUNT_NFS = "nfs" + MOUNT_NTFS = "ntfs" + MOUNT_TMPFS = "tmpfs" + MOUNT_UDF = "udf" + MOUNT_UFS = "ffs" MSG_BCAST = 0x100 MSG_CMSG_CLOEXEC = 0x800 MSG_CTRUNC = 0x20 @@ -993,6 +1083,7 @@ const ( MSG_PEEK = 0x2 MSG_TRUNC = 0x10 MSG_WAITALL = 0x40 + MSG_WAITFORONE = 0x1000 MS_ASYNC = 0x1 MS_INVALIDATE = 0x4 MS_SYNC = 0x2 @@ -1001,7 +1092,8 @@ const ( NET_RT_FLAGS = 0x2 NET_RT_IFLIST = 0x3 NET_RT_IFNAMES = 0x6 - NET_RT_MAXID = 0x7 + NET_RT_MAXID = 0x8 + NET_RT_SOURCE = 0x7 NET_RT_STATS = 0x4 NET_RT_TABLE = 0x5 NFDBITS = 0x20 @@ -1018,6 +1110,7 @@ const ( NOTE_FORK = 0x40000000 NOTE_LINK = 0x10 NOTE_LOWAT = 0x1 + NOTE_OOB = 0x4 NOTE_PCTRLMASK = 0xf0000000 NOTE_PDATAMASK = 0xfffff NOTE_RENAME = 0x20 @@ -1154,7 +1247,7 @@ const ( RTM_PROPOSAL = 0x13 RTM_REDIRECT = 0x6 RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 + RTM_SOURCE = 0x16 RTM_VERSION = 0x5 RTV_EXPIRE = 0x4 RTV_HOPCOUNT = 0x2 @@ -1172,6 +1265,9 @@ const ( RUSAGE_THREAD = 0x1 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x4 + SEEK_CUR = 0x1 + SEEK_END = 0x2 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1188,30 +1284,30 @@ const ( SIOCBRDGDELS = 0x80606942 SIOCBRDGFLUSH = 0x80606948 SIOCBRDGFRL = 0x808c694e - SIOCBRDGGCACHE = 0xc0186941 - SIOCBRDGGFD = 0xc0186952 - SIOCBRDGGHT = 0xc0186951 + SIOCBRDGGCACHE = 0xc0146941 + SIOCBRDGGFD = 0xc0146952 + SIOCBRDGGHT = 0xc0146951 SIOCBRDGGIFFLGS = 0xc060693e - SIOCBRDGGMA = 0xc0186953 + SIOCBRDGGMA = 0xc0146953 SIOCBRDGGPARAM = 0xc0406958 - SIOCBRDGGPRI = 0xc0186950 + SIOCBRDGGPRI = 0xc0146950 SIOCBRDGGRL = 0xc030694f - SIOCBRDGGTO = 0xc0186946 + SIOCBRDGGTO = 0xc0146946 SIOCBRDGIFS = 0xc0606942 SIOCBRDGRTS = 0xc0206943 SIOCBRDGSADDR = 0xc1286944 - SIOCBRDGSCACHE = 0x80186940 - SIOCBRDGSFD = 0x80186952 - SIOCBRDGSHT = 0x80186951 + SIOCBRDGSCACHE = 0x80146940 + SIOCBRDGSFD = 0x80146952 + SIOCBRDGSHT = 0x80146951 SIOCBRDGSIFCOST = 0x80606955 SIOCBRDGSIFFLGS = 0x8060693f SIOCBRDGSIFPRIO = 0x80606954 SIOCBRDGSIFPROT = 0x8060694a - SIOCBRDGSMA = 0x80186953 - SIOCBRDGSPRI = 0x80186950 - SIOCBRDGSPROTO = 0x8018695a - SIOCBRDGSTO = 0x80186945 - SIOCBRDGSTXHC = 0x80186959 + SIOCBRDGSMA = 0x80146953 + SIOCBRDGSPRI = 0x80146950 + SIOCBRDGSPROTO = 0x8014695a + SIOCBRDGSTO = 0x80146945 + SIOCBRDGSTXHC = 0x80146959 SIOCDELLABEL = 0x80206997 SIOCDELMULTI = 0x80206932 SIOCDIFADDR = 0x80206919 @@ -1264,6 +1360,7 @@ const ( SIOCGPWE3CTRLWORD = 0xc02069dc SIOCGPWE3FAT = 0xc02069dd SIOCGPWE3NEIGHBOR = 0xc21869de + SIOCGRXHPRIO = 0xc02069db SIOCGSPPPPARAMS = 0xc0206994 SIOCGTXHPRIO = 0xc02069c6 SIOCGUMBINFO = 0xc02069be @@ -1310,17 +1407,13 @@ const ( SIOCSPWE3CTRLWORD = 0x802069dc SIOCSPWE3FAT = 0x802069dd SIOCSPWE3NEIGHBOR = 0x821869de + SIOCSRXHPRIO = 0x802069db SIOCSSPPPPARAMS = 0x80206993 SIOCSTXHPRIO = 0x802069c5 SIOCSUMBPARAM = 0x802069bf SIOCSVH = 0xc02069f5 SIOCSVNETFLOWID = 0x802069c3 SIOCSVNETID = 0x802069a6 - SIOCSWGDPID = 0xc018695b - SIOCSWGMAXFLOW = 0xc0186960 - SIOCSWGMAXGROUP = 0xc018695d - SIOCSWSDPID = 0x8018695c - SIOCSWSPORTNO = 0xc060695f SOCK_CLOEXEC = 0x8000 SOCK_DGRAM = 0x2 SOCK_DNS = 0x1000 @@ -1335,6 +1428,7 @@ const ( SO_BINDANY = 0x1000 SO_BROADCAST = 0x20 SO_DEBUG = 0x1 + SO_DOMAIN = 0x1024 SO_DONTROUTE = 0x10 SO_ERROR = 0x1007 SO_KEEPALIVE = 0x8 @@ -1342,6 +1436,7 @@ const ( SO_NETPROC = 0x1020 SO_OOBINLINE = 0x100 SO_PEERCRED = 0x1022 + SO_PROTOCOL = 0x1025 SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 @@ -1391,7 +1486,18 @@ const ( TCOFLUSH = 0x2 TCOOFF = 0x1 TCOON = 0x2 - TCP_MAXBURST = 0x4 + TCPOPT_EOL = 0x0 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_HDR = 0x1010500 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SACK_PERMIT_HDR = 0x1010402 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_TSTAMP_HDR = 0x101080a + TCPOPT_WINDOW = 0x3 + TCP_INFO = 0x9 TCP_MAXSEG = 0x2 TCP_MAXWIN = 0xffff TCP_MAX_SACK = 0x3 @@ -1400,6 +1506,7 @@ const ( TCP_MSS = 0x200 TCP_NODELAY = 0x1 TCP_NOPUSH = 0x10 + TCP_SACKHOLE_LIMIT = 0x80 TCP_SACK_ENABLE = 0x8 TCSAFLUSH = 0x2 TIMER_ABSTIME = 0x1 @@ -1768,7 +1875,7 @@ var signalList = [...]struct { {3, "SIGQUIT", "quit"}, {4, "SIGILL", "illegal instruction"}, {5, "SIGTRAP", "trace/BPT trap"}, - {6, "SIGABRT", "abort trap"}, + {6, "SIGIOT", "abort trap"}, {7, "SIGEMT", "EMT trap"}, {8, "SIGFPE", "floating point exception"}, {9, "SIGKILL", "killed"}, @@ -1795,4 +1902,5 @@ var signalList = [...]struct { {30, "SIGUSR1", "user defined signal 1"}, {31, "SIGUSR2", "user defined signal 2"}, {32, "SIGTHR", "thread AST"}, + {28672, "SIGSTKSZ", "unknown signal"}, } diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go index f1154ff56f6c..03d90fe35501 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go @@ -112,6 +112,12 @@ const ( BPF_FILDROP_CAPTURE = 0x1 BPF_FILDROP_DROP = 0x2 BPF_FILDROP_PASS = 0x0 + BPF_F_DIR_IN = 0x10 + BPF_F_DIR_MASK = 0x30 + BPF_F_DIR_OUT = 0x20 + BPF_F_DIR_SHIFT = 0x4 + BPF_F_FLOWID = 0x8 + BPF_F_PRI_MASK = 0x7 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -140,6 +146,7 @@ const ( BPF_OR = 0x40 BPF_RELEASE = 0x30bb6 BPF_RET = 0x6 + BPF_RND = 0xc0 BPF_RSH = 0x70 BPF_ST = 0x2 BPF_STX = 0x3 @@ -301,6 +308,8 @@ const ( EMUL_ENABLED = 0x1 EMUL_NATIVE = 0x2 ENDRUNDISC = 0x9 + ETH64_8021_RSVD_MASK = 0xfffffffffff0 + ETH64_8021_RSVD_PREFIX = 0x180c2000000 ETHERMIN = 0x2e ETHERMTU = 0x5dc ETHERTYPE_8023 = 0x4 @@ -353,6 +362,7 @@ const ( ETHERTYPE_DN = 0x6003 ETHERTYPE_DOGFIGHT = 0x1989 ETHERTYPE_DSMD = 0x8039 + ETHERTYPE_EAPOL = 0x888e ETHERTYPE_ECMA = 0x803 ETHERTYPE_ENCRYPT = 0x803d ETHERTYPE_ES = 0x805d @@ -413,15 +423,16 @@ const ( ETHERTYPE_NCD = 0x8149 ETHERTYPE_NESTAR = 0x8006 ETHERTYPE_NETBEUI = 0x8191 + ETHERTYPE_NHRP = 0x2001 ETHERTYPE_NOVELL = 0x8138 ETHERTYPE_NS = 0x600 ETHERTYPE_NSAT = 0x601 ETHERTYPE_NSCOMPAT = 0x807 + ETHERTYPE_NSH = 0x984f ETHERTYPE_NTRAILER = 0x10 ETHERTYPE_OS9 = 0x7007 ETHERTYPE_OS9NET = 0x7009 ETHERTYPE_PACER = 0x80c6 - ETHERTYPE_PAE = 0x888e ETHERTYPE_PBB = 0x88e7 ETHERTYPE_PCS = 0x4242 ETHERTYPE_PLANNING = 0x8044 @@ -504,10 +515,11 @@ const ( ETHER_VLAN_ENCAP_LEN = 0x4 EVFILT_AIO = -0x3 EVFILT_DEVICE = -0x8 + EVFILT_EXCEPT = -0x9 EVFILT_PROC = -0x5 EVFILT_READ = -0x1 EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0x8 + EVFILT_SYSCOUNT = 0x9 EVFILT_TIMER = -0x7 EVFILT_VNODE = -0x4 EVFILT_WRITE = -0x2 @@ -529,7 +541,7 @@ const ( EV_FLAG1 = 0x2000 EV_ONESHOT = 0x10 EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 + EV_SYSFLAGS = 0xf800 EXTA = 0x4b00 EXTB = 0x9600 EXTPROC = 0x800 @@ -795,6 +807,7 @@ const ( IFT_VOICEOVERCABLE = 0xc6 IFT_VOICEOVERFRAMERELAY = 0x99 IFT_VOICEOVERIP = 0x68 + IFT_WIREGUARD = 0xfb IFT_X213 = 0x5d IFT_X25 = 0x5 IFT_X25DDN = 0x4 @@ -860,6 +873,7 @@ const ( IPPROTO_RAW = 0xff IPPROTO_ROUTING = 0x2b IPPROTO_RSVP = 0x2e + IPPROTO_SCTP = 0x84 IPPROTO_TCP = 0x6 IPPROTO_TP = 0x1d IPPROTO_UDP = 0x11 @@ -970,6 +984,9 @@ const ( IP_TTL = 0x4 ISIG = 0x80 ISTRIP = 0x20 + ITIMER_PROF = 0x2 + ITIMER_REAL = 0x0 + ITIMER_VIRTUAL = 0x1 IUCLC = 0x1000 IXANY = 0x800 IXOFF = 0x400 @@ -1041,6 +1058,19 @@ const ( MNT_WAIT = 0x1 MNT_WANTRDWR = 0x2000000 MNT_WXALLOWED = 0x800 + MOUNT_AFS = "afs" + MOUNT_CD9660 = "cd9660" + MOUNT_EXT2FS = "ext2fs" + MOUNT_FFS = "ffs" + MOUNT_FUSEFS = "fuse" + MOUNT_MFS = "mfs" + MOUNT_MSDOS = "msdos" + MOUNT_NCPFS = "ncpfs" + MOUNT_NFS = "nfs" + MOUNT_NTFS = "ntfs" + MOUNT_TMPFS = "tmpfs" + MOUNT_UDF = "udf" + MOUNT_UFS = "ffs" MSG_BCAST = 0x100 MSG_CMSG_CLOEXEC = 0x800 MSG_CTRUNC = 0x20 @@ -1053,6 +1083,7 @@ const ( MSG_PEEK = 0x2 MSG_TRUNC = 0x10 MSG_WAITALL = 0x40 + MSG_WAITFORONE = 0x1000 MS_ASYNC = 0x1 MS_INVALIDATE = 0x4 MS_SYNC = 0x2 @@ -1061,7 +1092,8 @@ const ( NET_RT_FLAGS = 0x2 NET_RT_IFLIST = 0x3 NET_RT_IFNAMES = 0x6 - NET_RT_MAXID = 0x7 + NET_RT_MAXID = 0x8 + NET_RT_SOURCE = 0x7 NET_RT_STATS = 0x4 NET_RT_TABLE = 0x5 NFDBITS = 0x20 @@ -1078,6 +1110,7 @@ const ( NOTE_FORK = 0x40000000 NOTE_LINK = 0x10 NOTE_LOWAT = 0x1 + NOTE_OOB = 0x4 NOTE_PCTRLMASK = 0xf0000000 NOTE_PDATAMASK = 0xfffff NOTE_RENAME = 0x20 @@ -1214,7 +1247,7 @@ const ( RTM_PROPOSAL = 0x13 RTM_REDIRECT = 0x6 RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 + RTM_SOURCE = 0x16 RTM_VERSION = 0x5 RTV_EXPIRE = 0x4 RTV_HOPCOUNT = 0x2 @@ -1232,6 +1265,9 @@ const ( RUSAGE_THREAD = 0x1 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x4 + SEEK_CUR = 0x1 + SEEK_END = 0x2 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1248,30 +1284,30 @@ const ( SIOCBRDGDELS = 0x80606942 SIOCBRDGFLUSH = 0x80606948 SIOCBRDGFRL = 0x808c694e - SIOCBRDGGCACHE = 0xc0186941 - SIOCBRDGGFD = 0xc0186952 - SIOCBRDGGHT = 0xc0186951 + SIOCBRDGGCACHE = 0xc0146941 + SIOCBRDGGFD = 0xc0146952 + SIOCBRDGGHT = 0xc0146951 SIOCBRDGGIFFLGS = 0xc060693e - SIOCBRDGGMA = 0xc0186953 + SIOCBRDGGMA = 0xc0146953 SIOCBRDGGPARAM = 0xc0406958 - SIOCBRDGGPRI = 0xc0186950 + SIOCBRDGGPRI = 0xc0146950 SIOCBRDGGRL = 0xc030694f - SIOCBRDGGTO = 0xc0186946 + SIOCBRDGGTO = 0xc0146946 SIOCBRDGIFS = 0xc0606942 SIOCBRDGRTS = 0xc0206943 SIOCBRDGSADDR = 0xc1286944 - SIOCBRDGSCACHE = 0x80186940 - SIOCBRDGSFD = 0x80186952 - SIOCBRDGSHT = 0x80186951 + SIOCBRDGSCACHE = 0x80146940 + SIOCBRDGSFD = 0x80146952 + SIOCBRDGSHT = 0x80146951 SIOCBRDGSIFCOST = 0x80606955 SIOCBRDGSIFFLGS = 0x8060693f SIOCBRDGSIFPRIO = 0x80606954 SIOCBRDGSIFPROT = 0x8060694a - SIOCBRDGSMA = 0x80186953 - SIOCBRDGSPRI = 0x80186950 - SIOCBRDGSPROTO = 0x8018695a - SIOCBRDGSTO = 0x80186945 - SIOCBRDGSTXHC = 0x80186959 + SIOCBRDGSMA = 0x80146953 + SIOCBRDGSPRI = 0x80146950 + SIOCBRDGSPROTO = 0x8014695a + SIOCBRDGSTO = 0x80146945 + SIOCBRDGSTXHC = 0x80146959 SIOCDELLABEL = 0x80206997 SIOCDELMULTI = 0x80206932 SIOCDIFADDR = 0x80206919 @@ -1378,11 +1414,6 @@ const ( SIOCSVH = 0xc02069f5 SIOCSVNETFLOWID = 0x802069c3 SIOCSVNETID = 0x802069a6 - SIOCSWGDPID = 0xc018695b - SIOCSWGMAXFLOW = 0xc0186960 - SIOCSWGMAXGROUP = 0xc018695d - SIOCSWSDPID = 0x8018695c - SIOCSWSPORTNO = 0xc060695f SOCK_CLOEXEC = 0x8000 SOCK_DGRAM = 0x2 SOCK_DNS = 0x1000 @@ -1455,7 +1486,18 @@ const ( TCOFLUSH = 0x2 TCOOFF = 0x1 TCOON = 0x2 - TCP_MAXBURST = 0x4 + TCPOPT_EOL = 0x0 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_HDR = 0x1010500 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SACK_PERMIT_HDR = 0x1010402 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_TSTAMP_HDR = 0x101080a + TCPOPT_WINDOW = 0x3 + TCP_INFO = 0x9 TCP_MAXSEG = 0x2 TCP_MAXWIN = 0xffff TCP_MAX_SACK = 0x3 @@ -1833,7 +1875,7 @@ var signalList = [...]struct { {3, "SIGQUIT", "quit"}, {4, "SIGILL", "illegal instruction"}, {5, "SIGTRAP", "trace/BPT trap"}, - {6, "SIGABRT", "abort trap"}, + {6, "SIGIOT", "abort trap"}, {7, "SIGEMT", "EMT trap"}, {8, "SIGFPE", "floating point exception"}, {9, "SIGKILL", "killed"}, @@ -1860,4 +1902,5 @@ var signalList = [...]struct { {30, "SIGUSR1", "user defined signal 1"}, {31, "SIGUSR2", "user defined signal 2"}, {32, "SIGTHR", "thread AST"}, + {81920, "SIGSTKSZ", "unknown signal"}, } diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go new file mode 100644 index 000000000000..8e2c51b1eec0 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go @@ -0,0 +1,1905 @@ +// mkerrors.sh -m64 +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build ppc64 && openbsd +// +build ppc64,openbsd + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs -- -m64 _const.go + +package unix + +import "syscall" + +const ( + AF_APPLETALK = 0x10 + AF_BLUETOOTH = 0x20 + AF_CCITT = 0xa + AF_CHAOS = 0x5 + AF_CNT = 0x15 + AF_COIP = 0x14 + AF_DATAKIT = 0x9 + AF_DECnet = 0xc + AF_DLI = 0xd + AF_E164 = 0x1a + AF_ECMA = 0x8 + AF_ENCAP = 0x1c + AF_HYLINK = 0xf + AF_IMPLINK = 0x3 + AF_INET = 0x2 + AF_INET6 = 0x18 + AF_IPX = 0x17 + AF_ISDN = 0x1a + AF_ISO = 0x7 + AF_KEY = 0x1e + AF_LAT = 0xe + AF_LINK = 0x12 + AF_LOCAL = 0x1 + AF_MAX = 0x24 + AF_MPLS = 0x21 + AF_NATM = 0x1b + AF_NS = 0x6 + AF_OSI = 0x7 + AF_PUP = 0x4 + AF_ROUTE = 0x11 + AF_SIP = 0x1d + AF_SNA = 0xb + AF_UNIX = 0x1 + AF_UNSPEC = 0x0 + ALTWERASE = 0x200 + ARPHRD_ETHER = 0x1 + ARPHRD_FRELAY = 0xf + ARPHRD_IEEE1394 = 0x18 + ARPHRD_IEEE802 = 0x6 + B0 = 0x0 + B110 = 0x6e + B115200 = 0x1c200 + B1200 = 0x4b0 + B134 = 0x86 + B14400 = 0x3840 + B150 = 0x96 + B1800 = 0x708 + B19200 = 0x4b00 + B200 = 0xc8 + B230400 = 0x38400 + B2400 = 0x960 + B28800 = 0x7080 + B300 = 0x12c + B38400 = 0x9600 + B4800 = 0x12c0 + B50 = 0x32 + B57600 = 0xe100 + B600 = 0x258 + B7200 = 0x1c20 + B75 = 0x4b + B76800 = 0x12c00 + B9600 = 0x2580 + BIOCFLUSH = 0x20004268 + BIOCGBLEN = 0x40044266 + BIOCGDIRFILT = 0x4004427c + BIOCGDLT = 0x4004426a + BIOCGDLTLIST = 0xc010427b + BIOCGETIF = 0x4020426b + BIOCGFILDROP = 0x40044278 + BIOCGHDRCMPLT = 0x40044274 + BIOCGRSIG = 0x40044273 + BIOCGRTIMEOUT = 0x4010426e + BIOCGSTATS = 0x4008426f + BIOCIMMEDIATE = 0x80044270 + BIOCLOCK = 0x20004276 + BIOCPROMISC = 0x20004269 + BIOCSBLEN = 0xc0044266 + BIOCSDIRFILT = 0x8004427d + BIOCSDLT = 0x8004427a + BIOCSETF = 0x80104267 + BIOCSETIF = 0x8020426c + BIOCSETWF = 0x80104277 + BIOCSFILDROP = 0x80044279 + BIOCSHDRCMPLT = 0x80044275 + BIOCSRSIG = 0x80044272 + BIOCSRTIMEOUT = 0x8010426d + BIOCVERSION = 0x40044271 + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0x0 + BPF_ALIGNMENT = 0x4 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DIRECTION_IN = 0x1 + BPF_DIRECTION_OUT = 0x2 + BPF_DIV = 0x30 + BPF_FILDROP_CAPTURE = 0x1 + BPF_FILDROP_DROP = 0x2 + BPF_FILDROP_PASS = 0x0 + BPF_F_DIR_IN = 0x10 + BPF_F_DIR_MASK = 0x30 + BPF_F_DIR_OUT = 0x20 + BPF_F_DIR_SHIFT = 0x4 + BPF_F_FLOWID = 0x8 + BPF_F_PRI_MASK = 0x7 + BPF_H = 0x8 + BPF_IMM = 0x0 + BPF_IND = 0x40 + BPF_JA = 0x0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0x0 + BPF_LD = 0x0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXBUFSIZE = 0x200000 + BPF_MAXINSNS = 0x200 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINBUFSIZE = 0x20 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RELEASE = 0x30bb6 + BPF_RET = 0x6 + BPF_RND = 0xc0 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0x0 + BPF_TXA = 0x80 + BPF_W = 0x0 + BPF_X = 0x8 + BRKINT = 0x2 + CFLUSH = 0xf + CLOCAL = 0x8000 + CLOCK_BOOTTIME = 0x6 + CLOCK_MONOTONIC = 0x3 + CLOCK_PROCESS_CPUTIME_ID = 0x2 + CLOCK_REALTIME = 0x0 + CLOCK_THREAD_CPUTIME_ID = 0x4 + CLOCK_UPTIME = 0x5 + CPUSTATES = 0x6 + CP_IDLE = 0x5 + CP_INTR = 0x4 + CP_NICE = 0x1 + CP_SPIN = 0x3 + CP_SYS = 0x2 + CP_USER = 0x0 + CREAD = 0x800 + CRTSCTS = 0x10000 + CS5 = 0x0 + CS6 = 0x100 + CS7 = 0x200 + CS8 = 0x300 + CSIZE = 0x300 + CSTART = 0x11 + CSTATUS = 0xff + CSTOP = 0x13 + CSTOPB = 0x400 + CSUSP = 0x1a + CTL_HW = 0x6 + CTL_KERN = 0x1 + CTL_MAXNAME = 0xc + CTL_NET = 0x4 + DIOCADDQUEUE = 0xc110445d + DIOCADDRULE = 0xcd604404 + DIOCADDSTATE = 0xc1084425 + DIOCCHANGERULE = 0xcd60441a + DIOCCLRIFFLAG = 0xc028445a + DIOCCLRSRCNODES = 0x20004455 + DIOCCLRSTATES = 0xc0e04412 + DIOCCLRSTATUS = 0xc0284416 + DIOCGETLIMIT = 0xc0084427 + DIOCGETQSTATS = 0xc1204460 + DIOCGETQUEUE = 0xc110445f + DIOCGETQUEUES = 0xc110445e + DIOCGETRULE = 0xcd604407 + DIOCGETRULES = 0xcd604406 + DIOCGETRULESET = 0xc444443b + DIOCGETRULESETS = 0xc444443a + DIOCGETSRCNODES = 0xc0104454 + DIOCGETSTATE = 0xc1084413 + DIOCGETSTATES = 0xc0104419 + DIOCGETSTATUS = 0xc1e84415 + DIOCGETSYNFLWATS = 0xc0084463 + DIOCGETTIMEOUT = 0xc008441e + DIOCIGETIFACES = 0xc0284457 + DIOCKILLSRCNODES = 0xc080445b + DIOCKILLSTATES = 0xc0e04429 + DIOCNATLOOK = 0xc0504417 + DIOCOSFPADD = 0xc088444f + DIOCOSFPFLUSH = 0x2000444e + DIOCOSFPGET = 0xc0884450 + DIOCRADDADDRS = 0xc4504443 + DIOCRADDTABLES = 0xc450443d + DIOCRCLRADDRS = 0xc4504442 + DIOCRCLRASTATS = 0xc4504448 + DIOCRCLRTABLES = 0xc450443c + DIOCRCLRTSTATS = 0xc4504441 + DIOCRDELADDRS = 0xc4504444 + DIOCRDELTABLES = 0xc450443e + DIOCRGETADDRS = 0xc4504446 + DIOCRGETASTATS = 0xc4504447 + DIOCRGETTABLES = 0xc450443f + DIOCRGETTSTATS = 0xc4504440 + DIOCRINADEFINE = 0xc450444d + DIOCRSETADDRS = 0xc4504445 + DIOCRSETTFLAGS = 0xc450444a + DIOCRTSTADDRS = 0xc4504449 + DIOCSETDEBUG = 0xc0044418 + DIOCSETHOSTID = 0xc0044456 + DIOCSETIFFLAG = 0xc0284459 + DIOCSETLIMIT = 0xc0084428 + DIOCSETREASS = 0xc004445c + DIOCSETSTATUSIF = 0xc0284414 + DIOCSETSYNCOOKIES = 0xc0014462 + DIOCSETSYNFLWATS = 0xc0084461 + DIOCSETTIMEOUT = 0xc008441d + DIOCSTART = 0x20004401 + DIOCSTOP = 0x20004402 + DIOCXBEGIN = 0xc0104451 + DIOCXCOMMIT = 0xc0104452 + DIOCXROLLBACK = 0xc0104453 + DLT_ARCNET = 0x7 + DLT_ATM_RFC1483 = 0xb + DLT_AX25 = 0x3 + DLT_CHAOS = 0x5 + DLT_C_HDLC = 0x68 + DLT_EN10MB = 0x1 + DLT_EN3MB = 0x2 + DLT_ENC = 0xd + DLT_FDDI = 0xa + DLT_IEEE802 = 0x6 + DLT_IEEE802_11 = 0x69 + DLT_IEEE802_11_RADIO = 0x7f + DLT_LOOP = 0xc + DLT_MPLS = 0xdb + DLT_NULL = 0x0 + DLT_OPENFLOW = 0x10b + DLT_PFLOG = 0x75 + DLT_PFSYNC = 0x12 + DLT_PPP = 0x9 + DLT_PPP_BSDOS = 0x10 + DLT_PPP_ETHER = 0x33 + DLT_PPP_SERIAL = 0x32 + DLT_PRONET = 0x4 + DLT_RAW = 0xe + DLT_SLIP = 0x8 + DLT_SLIP_BSDOS = 0xf + DLT_USBPCAP = 0xf9 + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c + DT_BLK = 0x6 + DT_CHR = 0x2 + DT_DIR = 0x4 + DT_FIFO = 0x1 + DT_LNK = 0xa + DT_REG = 0x8 + DT_SOCK = 0xc + DT_UNKNOWN = 0x0 + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 + EMT_TAGOVF = 0x1 + EMUL_ENABLED = 0x1 + EMUL_NATIVE = 0x2 + ENDRUNDISC = 0x9 + ETH64_8021_RSVD_MASK = 0xfffffffffff0 + ETH64_8021_RSVD_PREFIX = 0x180c2000000 + ETHERMIN = 0x2e + ETHERMTU = 0x5dc + ETHERTYPE_8023 = 0x4 + ETHERTYPE_AARP = 0x80f3 + ETHERTYPE_ACCTON = 0x8390 + ETHERTYPE_AEONIC = 0x8036 + ETHERTYPE_ALPHA = 0x814a + ETHERTYPE_AMBER = 0x6008 + ETHERTYPE_AMOEBA = 0x8145 + ETHERTYPE_AOE = 0x88a2 + ETHERTYPE_APOLLO = 0x80f7 + ETHERTYPE_APOLLODOMAIN = 0x8019 + ETHERTYPE_APPLETALK = 0x809b + ETHERTYPE_APPLITEK = 0x80c7 + ETHERTYPE_ARGONAUT = 0x803a + ETHERTYPE_ARP = 0x806 + ETHERTYPE_AT = 0x809b + ETHERTYPE_ATALK = 0x809b + ETHERTYPE_ATOMIC = 0x86df + ETHERTYPE_ATT = 0x8069 + ETHERTYPE_ATTSTANFORD = 0x8008 + ETHERTYPE_AUTOPHON = 0x806a + ETHERTYPE_AXIS = 0x8856 + ETHERTYPE_BCLOOP = 0x9003 + ETHERTYPE_BOFL = 0x8102 + ETHERTYPE_CABLETRON = 0x7034 + ETHERTYPE_CHAOS = 0x804 + ETHERTYPE_COMDESIGN = 0x806c + ETHERTYPE_COMPUGRAPHIC = 0x806d + ETHERTYPE_COUNTERPOINT = 0x8062 + ETHERTYPE_CRONUS = 0x8004 + ETHERTYPE_CRONUSVLN = 0x8003 + ETHERTYPE_DCA = 0x1234 + ETHERTYPE_DDE = 0x807b + ETHERTYPE_DEBNI = 0xaaaa + ETHERTYPE_DECAM = 0x8048 + ETHERTYPE_DECCUST = 0x6006 + ETHERTYPE_DECDIAG = 0x6005 + ETHERTYPE_DECDNS = 0x803c + ETHERTYPE_DECDTS = 0x803e + ETHERTYPE_DECEXPER = 0x6000 + ETHERTYPE_DECLAST = 0x8041 + ETHERTYPE_DECLTM = 0x803f + ETHERTYPE_DECMUMPS = 0x6009 + ETHERTYPE_DECNETBIOS = 0x8040 + ETHERTYPE_DELTACON = 0x86de + ETHERTYPE_DIDDLE = 0x4321 + ETHERTYPE_DLOG1 = 0x660 + ETHERTYPE_DLOG2 = 0x661 + ETHERTYPE_DN = 0x6003 + ETHERTYPE_DOGFIGHT = 0x1989 + ETHERTYPE_DSMD = 0x8039 + ETHERTYPE_EAPOL = 0x888e + ETHERTYPE_ECMA = 0x803 + ETHERTYPE_ENCRYPT = 0x803d + ETHERTYPE_ES = 0x805d + ETHERTYPE_EXCELAN = 0x8010 + ETHERTYPE_EXPERDATA = 0x8049 + ETHERTYPE_FLIP = 0x8146 + ETHERTYPE_FLOWCONTROL = 0x8808 + ETHERTYPE_FRARP = 0x808 + ETHERTYPE_GENDYN = 0x8068 + ETHERTYPE_HAYES = 0x8130 + ETHERTYPE_HIPPI_FP = 0x8180 + ETHERTYPE_HITACHI = 0x8820 + ETHERTYPE_HP = 0x8005 + ETHERTYPE_IEEEPUP = 0xa00 + ETHERTYPE_IEEEPUPAT = 0xa01 + ETHERTYPE_IMLBL = 0x4c42 + ETHERTYPE_IMLBLDIAG = 0x424c + ETHERTYPE_IP = 0x800 + ETHERTYPE_IPAS = 0x876c + ETHERTYPE_IPV6 = 0x86dd + ETHERTYPE_IPX = 0x8137 + ETHERTYPE_IPXNEW = 0x8037 + ETHERTYPE_KALPANA = 0x8582 + ETHERTYPE_LANBRIDGE = 0x8038 + ETHERTYPE_LANPROBE = 0x8888 + ETHERTYPE_LAT = 0x6004 + ETHERTYPE_LBACK = 0x9000 + ETHERTYPE_LITTLE = 0x8060 + ETHERTYPE_LLDP = 0x88cc + ETHERTYPE_LOGICRAFT = 0x8148 + ETHERTYPE_LOOPBACK = 0x9000 + ETHERTYPE_MACSEC = 0x88e5 + ETHERTYPE_MATRA = 0x807a + ETHERTYPE_MAX = 0xffff + ETHERTYPE_MERIT = 0x807c + ETHERTYPE_MICP = 0x873a + ETHERTYPE_MOPDL = 0x6001 + ETHERTYPE_MOPRC = 0x6002 + ETHERTYPE_MOTOROLA = 0x818d + ETHERTYPE_MPLS = 0x8847 + ETHERTYPE_MPLS_MCAST = 0x8848 + ETHERTYPE_MUMPS = 0x813f + ETHERTYPE_NBPCC = 0x3c04 + ETHERTYPE_NBPCLAIM = 0x3c09 + ETHERTYPE_NBPCLREQ = 0x3c05 + ETHERTYPE_NBPCLRSP = 0x3c06 + ETHERTYPE_NBPCREQ = 0x3c02 + ETHERTYPE_NBPCRSP = 0x3c03 + ETHERTYPE_NBPDG = 0x3c07 + ETHERTYPE_NBPDGB = 0x3c08 + ETHERTYPE_NBPDLTE = 0x3c0a + ETHERTYPE_NBPRAR = 0x3c0c + ETHERTYPE_NBPRAS = 0x3c0b + ETHERTYPE_NBPRST = 0x3c0d + ETHERTYPE_NBPSCD = 0x3c01 + ETHERTYPE_NBPVCD = 0x3c00 + ETHERTYPE_NBS = 0x802 + ETHERTYPE_NCD = 0x8149 + ETHERTYPE_NESTAR = 0x8006 + ETHERTYPE_NETBEUI = 0x8191 + ETHERTYPE_NHRP = 0x2001 + ETHERTYPE_NOVELL = 0x8138 + ETHERTYPE_NS = 0x600 + ETHERTYPE_NSAT = 0x601 + ETHERTYPE_NSCOMPAT = 0x807 + ETHERTYPE_NSH = 0x984f + ETHERTYPE_NTRAILER = 0x10 + ETHERTYPE_OS9 = 0x7007 + ETHERTYPE_OS9NET = 0x7009 + ETHERTYPE_PACER = 0x80c6 + ETHERTYPE_PBB = 0x88e7 + ETHERTYPE_PCS = 0x4242 + ETHERTYPE_PLANNING = 0x8044 + ETHERTYPE_PPP = 0x880b + ETHERTYPE_PPPOE = 0x8864 + ETHERTYPE_PPPOEDISC = 0x8863 + ETHERTYPE_PRIMENTS = 0x7031 + ETHERTYPE_PUP = 0x200 + ETHERTYPE_PUPAT = 0x200 + ETHERTYPE_QINQ = 0x88a8 + ETHERTYPE_RACAL = 0x7030 + ETHERTYPE_RATIONAL = 0x8150 + ETHERTYPE_RAWFR = 0x6559 + ETHERTYPE_RCL = 0x1995 + ETHERTYPE_RDP = 0x8739 + ETHERTYPE_RETIX = 0x80f2 + ETHERTYPE_REVARP = 0x8035 + ETHERTYPE_SCA = 0x6007 + ETHERTYPE_SECTRA = 0x86db + ETHERTYPE_SECUREDATA = 0x876d + ETHERTYPE_SGITW = 0x817e + ETHERTYPE_SG_BOUNCE = 0x8016 + ETHERTYPE_SG_DIAG = 0x8013 + ETHERTYPE_SG_NETGAMES = 0x8014 + ETHERTYPE_SG_RESV = 0x8015 + ETHERTYPE_SIMNET = 0x5208 + ETHERTYPE_SLOW = 0x8809 + ETHERTYPE_SNA = 0x80d5 + ETHERTYPE_SNMP = 0x814c + ETHERTYPE_SONIX = 0xfaf5 + ETHERTYPE_SPIDER = 0x809f + ETHERTYPE_SPRITE = 0x500 + ETHERTYPE_STP = 0x8181 + ETHERTYPE_TALARIS = 0x812b + ETHERTYPE_TALARISMC = 0x852b + ETHERTYPE_TCPCOMP = 0x876b + ETHERTYPE_TCPSM = 0x9002 + ETHERTYPE_TEC = 0x814f + ETHERTYPE_TIGAN = 0x802f + ETHERTYPE_TRAIL = 0x1000 + ETHERTYPE_TRANSETHER = 0x6558 + ETHERTYPE_TYMSHARE = 0x802e + ETHERTYPE_UBBST = 0x7005 + ETHERTYPE_UBDEBUG = 0x900 + ETHERTYPE_UBDIAGLOOP = 0x7002 + ETHERTYPE_UBDL = 0x7000 + ETHERTYPE_UBNIU = 0x7001 + ETHERTYPE_UBNMC = 0x7003 + ETHERTYPE_VALID = 0x1600 + ETHERTYPE_VARIAN = 0x80dd + ETHERTYPE_VAXELN = 0x803b + ETHERTYPE_VEECO = 0x8067 + ETHERTYPE_VEXP = 0x805b + ETHERTYPE_VGLAB = 0x8131 + ETHERTYPE_VINES = 0xbad + ETHERTYPE_VINESECHO = 0xbaf + ETHERTYPE_VINESLOOP = 0xbae + ETHERTYPE_VITAL = 0xff00 + ETHERTYPE_VLAN = 0x8100 + ETHERTYPE_VLTLMAN = 0x8080 + ETHERTYPE_VPROD = 0x805c + ETHERTYPE_VURESERVED = 0x8147 + ETHERTYPE_WATERLOO = 0x8130 + ETHERTYPE_WELLFLEET = 0x8103 + ETHERTYPE_X25 = 0x805 + ETHERTYPE_X75 = 0x801 + ETHERTYPE_XNSSM = 0x9001 + ETHERTYPE_XTP = 0x817d + ETHER_ADDR_LEN = 0x6 + ETHER_ALIGN = 0x2 + ETHER_CRC_LEN = 0x4 + ETHER_CRC_POLY_BE = 0x4c11db6 + ETHER_CRC_POLY_LE = 0xedb88320 + ETHER_HDR_LEN = 0xe + ETHER_MAX_DIX_LEN = 0x600 + ETHER_MAX_HARDMTU_LEN = 0xff9b + ETHER_MAX_LEN = 0x5ee + ETHER_MIN_LEN = 0x40 + ETHER_TYPE_LEN = 0x2 + ETHER_VLAN_ENCAP_LEN = 0x4 + EVFILT_AIO = -0x3 + EVFILT_DEVICE = -0x8 + EVFILT_EXCEPT = -0x9 + EVFILT_PROC = -0x5 + EVFILT_READ = -0x1 + EVFILT_SIGNAL = -0x6 + EVFILT_SYSCOUNT = 0x9 + EVFILT_TIMER = -0x7 + EVFILT_VNODE = -0x4 + EVFILT_WRITE = -0x2 + EVL_ENCAPLEN = 0x4 + EVL_PRIO_BITS = 0xd + EVL_PRIO_MAX = 0x7 + EVL_VLID_MASK = 0xfff + EVL_VLID_MAX = 0xffe + EVL_VLID_MIN = 0x1 + EVL_VLID_NULL = 0x0 + EV_ADD = 0x1 + EV_CLEAR = 0x20 + EV_DELETE = 0x2 + EV_DISABLE = 0x8 + EV_DISPATCH = 0x80 + EV_ENABLE = 0x4 + EV_EOF = 0x8000 + EV_ERROR = 0x4000 + EV_FLAG1 = 0x2000 + EV_ONESHOT = 0x10 + EV_RECEIPT = 0x40 + EV_SYSFLAGS = 0xf800 + EXTA = 0x4b00 + EXTB = 0x9600 + EXTPROC = 0x800 + FD_CLOEXEC = 0x1 + FD_SETSIZE = 0x400 + FLUSHO = 0x800000 + F_DUPFD = 0x0 + F_DUPFD_CLOEXEC = 0xa + F_GETFD = 0x1 + F_GETFL = 0x3 + F_GETLK = 0x7 + F_GETOWN = 0x5 + F_ISATTY = 0xb + F_OK = 0x0 + F_RDLCK = 0x1 + F_SETFD = 0x2 + F_SETFL = 0x4 + F_SETLK = 0x8 + F_SETLKW = 0x9 + F_SETOWN = 0x6 + F_UNLCK = 0x2 + F_WRLCK = 0x3 + HUPCL = 0x4000 + HW_MACHINE = 0x1 + ICANON = 0x100 + ICMP6_FILTER = 0x12 + ICRNL = 0x100 + IEXTEN = 0x400 + IFAN_ARRIVAL = 0x0 + IFAN_DEPARTURE = 0x1 + IFF_ALLMULTI = 0x200 + IFF_BROADCAST = 0x2 + IFF_CANTCHANGE = 0x8e52 + IFF_DEBUG = 0x4 + IFF_LINK0 = 0x1000 + IFF_LINK1 = 0x2000 + IFF_LINK2 = 0x4000 + IFF_LOOPBACK = 0x8 + IFF_MULTICAST = 0x8000 + IFF_NOARP = 0x80 + IFF_OACTIVE = 0x400 + IFF_POINTOPOINT = 0x10 + IFF_PROMISC = 0x100 + IFF_RUNNING = 0x40 + IFF_SIMPLEX = 0x800 + IFF_STATICARP = 0x20 + IFF_UP = 0x1 + IFNAMSIZ = 0x10 + IFT_1822 = 0x2 + IFT_A12MPPSWITCH = 0x82 + IFT_AAL2 = 0xbb + IFT_AAL5 = 0x31 + IFT_ADSL = 0x5e + IFT_AFLANE8023 = 0x3b + IFT_AFLANE8025 = 0x3c + IFT_ARAP = 0x58 + IFT_ARCNET = 0x23 + IFT_ARCNETPLUS = 0x24 + IFT_ASYNC = 0x54 + IFT_ATM = 0x25 + IFT_ATMDXI = 0x69 + IFT_ATMFUNI = 0x6a + IFT_ATMIMA = 0x6b + IFT_ATMLOGICAL = 0x50 + IFT_ATMRADIO = 0xbd + IFT_ATMSUBINTERFACE = 0x86 + IFT_ATMVCIENDPT = 0xc2 + IFT_ATMVIRTUAL = 0x95 + IFT_BGPPOLICYACCOUNTING = 0xa2 + IFT_BLUETOOTH = 0xf8 + IFT_BRIDGE = 0xd1 + IFT_BSC = 0x53 + IFT_CARP = 0xf7 + IFT_CCTEMUL = 0x3d + IFT_CEPT = 0x13 + IFT_CES = 0x85 + IFT_CHANNEL = 0x46 + IFT_CNR = 0x55 + IFT_COFFEE = 0x84 + IFT_COMPOSITELINK = 0x9b + IFT_DCN = 0x8d + IFT_DIGITALPOWERLINE = 0x8a + IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba + IFT_DLSW = 0x4a + IFT_DOCSCABLEDOWNSTREAM = 0x80 + IFT_DOCSCABLEMACLAYER = 0x7f + IFT_DOCSCABLEUPSTREAM = 0x81 + IFT_DOCSCABLEUPSTREAMCHANNEL = 0xcd + IFT_DS0 = 0x51 + IFT_DS0BUNDLE = 0x52 + IFT_DS1FDL = 0xaa + IFT_DS3 = 0x1e + IFT_DTM = 0x8c + IFT_DUMMY = 0xf1 + IFT_DVBASILN = 0xac + IFT_DVBASIOUT = 0xad + IFT_DVBRCCDOWNSTREAM = 0x93 + IFT_DVBRCCMACLAYER = 0x92 + IFT_DVBRCCUPSTREAM = 0x94 + IFT_ECONET = 0xce + IFT_ENC = 0xf4 + IFT_EON = 0x19 + IFT_EPLRS = 0x57 + IFT_ESCON = 0x49 + IFT_ETHER = 0x6 + IFT_FAITH = 0xf3 + IFT_FAST = 0x7d + IFT_FASTETHER = 0x3e + IFT_FASTETHERFX = 0x45 + IFT_FDDI = 0xf + IFT_FIBRECHANNEL = 0x38 + IFT_FRAMERELAYINTERCONNECT = 0x3a + IFT_FRAMERELAYMPI = 0x5c + IFT_FRDLCIENDPT = 0xc1 + IFT_FRELAY = 0x20 + IFT_FRELAYDCE = 0x2c + IFT_FRF16MFRBUNDLE = 0xa3 + IFT_FRFORWARD = 0x9e + IFT_G703AT2MB = 0x43 + IFT_G703AT64K = 0x42 + IFT_GIF = 0xf0 + IFT_GIGABITETHERNET = 0x75 + IFT_GR303IDT = 0xb2 + IFT_GR303RDT = 0xb1 + IFT_H323GATEKEEPER = 0xa4 + IFT_H323PROXY = 0xa5 + IFT_HDH1822 = 0x3 + IFT_HDLC = 0x76 + IFT_HDSL2 = 0xa8 + IFT_HIPERLAN2 = 0xb7 + IFT_HIPPI = 0x2f + IFT_HIPPIINTERFACE = 0x39 + IFT_HOSTPAD = 0x5a + IFT_HSSI = 0x2e + IFT_HY = 0xe + IFT_IBM370PARCHAN = 0x48 + IFT_IDSL = 0x9a + IFT_IEEE1394 = 0x90 + IFT_IEEE80211 = 0x47 + IFT_IEEE80212 = 0x37 + IFT_IEEE8023ADLAG = 0xa1 + IFT_IFGSN = 0x91 + IFT_IMT = 0xbe + IFT_INFINIBAND = 0xc7 + IFT_INTERLEAVE = 0x7c + IFT_IP = 0x7e + IFT_IPFORWARD = 0x8e + IFT_IPOVERATM = 0x72 + IFT_IPOVERCDLC = 0x6d + IFT_IPOVERCLAW = 0x6e + IFT_IPSWITCH = 0x4e + IFT_ISDN = 0x3f + IFT_ISDNBASIC = 0x14 + IFT_ISDNPRIMARY = 0x15 + IFT_ISDNS = 0x4b + IFT_ISDNU = 0x4c + IFT_ISO88022LLC = 0x29 + IFT_ISO88023 = 0x7 + IFT_ISO88024 = 0x8 + IFT_ISO88025 = 0x9 + IFT_ISO88025CRFPINT = 0x62 + IFT_ISO88025DTR = 0x56 + IFT_ISO88025FIBER = 0x73 + IFT_ISO88026 = 0xa + IFT_ISUP = 0xb3 + IFT_L2VLAN = 0x87 + IFT_L3IPVLAN = 0x88 + IFT_L3IPXVLAN = 0x89 + IFT_LAPB = 0x10 + IFT_LAPD = 0x4d + IFT_LAPF = 0x77 + IFT_LINEGROUP = 0xd2 + IFT_LOCALTALK = 0x2a + IFT_LOOP = 0x18 + IFT_MBIM = 0xfa + IFT_MEDIAMAILOVERIP = 0x8b + IFT_MFSIGLINK = 0xa7 + IFT_MIOX25 = 0x26 + IFT_MODEM = 0x30 + IFT_MPC = 0x71 + IFT_MPLS = 0xa6 + IFT_MPLSTUNNEL = 0x96 + IFT_MSDSL = 0x8f + IFT_MVL = 0xbf + IFT_MYRINET = 0x63 + IFT_NFAS = 0xaf + IFT_NSIP = 0x1b + IFT_OPTICALCHANNEL = 0xc3 + IFT_OPTICALTRANSPORT = 0xc4 + IFT_OTHER = 0x1 + IFT_P10 = 0xc + IFT_P80 = 0xd + IFT_PARA = 0x22 + IFT_PFLOG = 0xf5 + IFT_PFLOW = 0xf9 + IFT_PFSYNC = 0xf6 + IFT_PLC = 0xae + IFT_PON155 = 0xcf + IFT_PON622 = 0xd0 + IFT_POS = 0xab + IFT_PPP = 0x17 + IFT_PPPMULTILINKBUNDLE = 0x6c + IFT_PROPATM = 0xc5 + IFT_PROPBWAP2MP = 0xb8 + IFT_PROPCNLS = 0x59 + IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 + IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 + IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 + IFT_PROPMUX = 0x36 + IFT_PROPVIRTUAL = 0x35 + IFT_PROPWIRELESSP2P = 0x9d + IFT_PTPSERIAL = 0x16 + IFT_PVC = 0xf2 + IFT_Q2931 = 0xc9 + IFT_QLLC = 0x44 + IFT_RADIOMAC = 0xbc + IFT_RADSL = 0x5f + IFT_REACHDSL = 0xc0 + IFT_RFC1483 = 0x9f + IFT_RS232 = 0x21 + IFT_RSRB = 0x4f + IFT_SDLC = 0x11 + IFT_SDSL = 0x60 + IFT_SHDSL = 0xa9 + IFT_SIP = 0x1f + IFT_SIPSIG = 0xcc + IFT_SIPTG = 0xcb + IFT_SLIP = 0x1c + IFT_SMDSDXI = 0x2b + IFT_SMDSICIP = 0x34 + IFT_SONET = 0x27 + IFT_SONETOVERHEADCHANNEL = 0xb9 + IFT_SONETPATH = 0x32 + IFT_SONETVT = 0x33 + IFT_SRP = 0x97 + IFT_SS7SIGLINK = 0x9c + IFT_STACKTOSTACK = 0x6f + IFT_STARLAN = 0xb + IFT_T1 = 0x12 + IFT_TDLC = 0x74 + IFT_TELINK = 0xc8 + IFT_TERMPAD = 0x5b + IFT_TR008 = 0xb0 + IFT_TRANSPHDLC = 0x7b + IFT_TUNNEL = 0x83 + IFT_ULTRA = 0x1d + IFT_USB = 0xa0 + IFT_V11 = 0x40 + IFT_V35 = 0x2d + IFT_V36 = 0x41 + IFT_V37 = 0x78 + IFT_VDSL = 0x61 + IFT_VIRTUALIPADDRESS = 0x70 + IFT_VIRTUALTG = 0xca + IFT_VOICEDID = 0xd5 + IFT_VOICEEM = 0x64 + IFT_VOICEEMFGD = 0xd3 + IFT_VOICEENCAP = 0x67 + IFT_VOICEFGDEANA = 0xd4 + IFT_VOICEFXO = 0x65 + IFT_VOICEFXS = 0x66 + IFT_VOICEOVERATM = 0x98 + IFT_VOICEOVERCABLE = 0xc6 + IFT_VOICEOVERFRAMERELAY = 0x99 + IFT_VOICEOVERIP = 0x68 + IFT_WIREGUARD = 0xfb + IFT_X213 = 0x5d + IFT_X25 = 0x5 + IFT_X25DDN = 0x4 + IFT_X25HUNTGROUP = 0x7a + IFT_X25MLP = 0x79 + IFT_X25PLE = 0x28 + IFT_XETHER = 0x1a + IGNBRK = 0x1 + IGNCR = 0x80 + IGNPAR = 0x4 + IMAXBEL = 0x2000 + INLCR = 0x40 + INPCK = 0x10 + IN_CLASSA_HOST = 0xffffff + IN_CLASSA_MAX = 0x80 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 0x18 + IN_CLASSB_HOST = 0xffff + IN_CLASSB_MAX = 0x10000 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 0x10 + IN_CLASSC_HOST = 0xff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 0x8 + IN_CLASSD_HOST = 0xfffffff + IN_CLASSD_NET = 0xf0000000 + IN_CLASSD_NSHIFT = 0x1c + IN_LOOPBACKNET = 0x7f + IN_RFC3021_HOST = 0x1 + IN_RFC3021_NET = 0xfffffffe + IN_RFC3021_NSHIFT = 0x1f + IPPROTO_AH = 0x33 + IPPROTO_CARP = 0x70 + IPPROTO_DIVERT = 0x102 + IPPROTO_DONE = 0x101 + IPPROTO_DSTOPTS = 0x3c + IPPROTO_EGP = 0x8 + IPPROTO_ENCAP = 0x62 + IPPROTO_EON = 0x50 + IPPROTO_ESP = 0x32 + IPPROTO_ETHERIP = 0x61 + IPPROTO_FRAGMENT = 0x2c + IPPROTO_GGP = 0x3 + IPPROTO_GRE = 0x2f + IPPROTO_HOPOPTS = 0x0 + IPPROTO_ICMP = 0x1 + IPPROTO_ICMPV6 = 0x3a + IPPROTO_IDP = 0x16 + IPPROTO_IGMP = 0x2 + IPPROTO_IP = 0x0 + IPPROTO_IPCOMP = 0x6c + IPPROTO_IPIP = 0x4 + IPPROTO_IPV4 = 0x4 + IPPROTO_IPV6 = 0x29 + IPPROTO_MAX = 0x100 + IPPROTO_MAXID = 0x103 + IPPROTO_MOBILE = 0x37 + IPPROTO_MPLS = 0x89 + IPPROTO_NONE = 0x3b + IPPROTO_PFSYNC = 0xf0 + IPPROTO_PIM = 0x67 + IPPROTO_PUP = 0xc + IPPROTO_RAW = 0xff + IPPROTO_ROUTING = 0x2b + IPPROTO_RSVP = 0x2e + IPPROTO_SCTP = 0x84 + IPPROTO_TCP = 0x6 + IPPROTO_TP = 0x1d + IPPROTO_UDP = 0x11 + IPPROTO_UDPLITE = 0x88 + IPV6_AUTH_LEVEL = 0x35 + IPV6_AUTOFLOWLABEL = 0x3b + IPV6_CHECKSUM = 0x1a + IPV6_DEFAULT_MULTICAST_HOPS = 0x1 + IPV6_DEFAULT_MULTICAST_LOOP = 0x1 + IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 + IPV6_ESP_NETWORK_LEVEL = 0x37 + IPV6_ESP_TRANS_LEVEL = 0x36 + IPV6_FAITH = 0x1d + IPV6_FLOWINFO_MASK = 0xfffffff + IPV6_FLOWLABEL_MASK = 0xfffff + IPV6_FRAGTTL = 0x78 + IPV6_HLIMDEC = 0x1 + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 + IPV6_IPCOMP_LEVEL = 0x3c + IPV6_JOIN_GROUP = 0xc + IPV6_LEAVE_GROUP = 0xd + IPV6_MAXHLIM = 0xff + IPV6_MAXPACKET = 0xffff + IPV6_MINHOPCOUNT = 0x41 + IPV6_MMTU = 0x500 + IPV6_MULTICAST_HOPS = 0xa + IPV6_MULTICAST_IF = 0x9 + IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_OPTIONS = 0x1 + IPV6_PATHMTU = 0x2c + IPV6_PIPEX = 0x3f + IPV6_PKTINFO = 0x2e + IPV6_PORTRANGE = 0xe + IPV6_PORTRANGE_DEFAULT = 0x0 + IPV6_PORTRANGE_HIGH = 0x1 + IPV6_PORTRANGE_LOW = 0x2 + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVDSTPORT = 0x40 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x24 + IPV6_RECVRTHDR = 0x26 + IPV6_RECVTCLASS = 0x39 + IPV6_RTABLE = 0x1021 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x23 + IPV6_RTHDR_LOOSE = 0x0 + IPV6_RTHDR_STRICT = 0x1 + IPV6_RTHDR_TYPE_0 = 0x0 + IPV6_SOCKOPT_RESERVED1 = 0x3 + IPV6_TCLASS = 0x3d + IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a + IPV6_V6ONLY = 0x1b + IPV6_VERSION = 0x60 + IPV6_VERSION_MASK = 0xf0 + IP_ADD_MEMBERSHIP = 0xc + IP_AUTH_LEVEL = 0x14 + IP_DEFAULT_MULTICAST_LOOP = 0x1 + IP_DEFAULT_MULTICAST_TTL = 0x1 + IP_DF = 0x4000 + IP_DROP_MEMBERSHIP = 0xd + IP_ESP_NETWORK_LEVEL = 0x16 + IP_ESP_TRANS_LEVEL = 0x15 + IP_HDRINCL = 0x2 + IP_IPCOMP_LEVEL = 0x1d + IP_IPDEFTTL = 0x25 + IP_IPSECFLOWINFO = 0x24 + IP_IPSEC_LOCAL_AUTH = 0x1b + IP_IPSEC_LOCAL_CRED = 0x19 + IP_IPSEC_LOCAL_ID = 0x17 + IP_IPSEC_REMOTE_AUTH = 0x1c + IP_IPSEC_REMOTE_CRED = 0x1a + IP_IPSEC_REMOTE_ID = 0x18 + IP_MAXPACKET = 0xffff + IP_MAX_MEMBERSHIPS = 0xfff + IP_MF = 0x2000 + IP_MINTTL = 0x20 + IP_MIN_MEMBERSHIPS = 0xf + IP_MSS = 0x240 + IP_MULTICAST_IF = 0x9 + IP_MULTICAST_LOOP = 0xb + IP_MULTICAST_TTL = 0xa + IP_OFFMASK = 0x1fff + IP_OPTIONS = 0x1 + IP_PIPEX = 0x22 + IP_PORTRANGE = 0x13 + IP_PORTRANGE_DEFAULT = 0x0 + IP_PORTRANGE_HIGH = 0x1 + IP_PORTRANGE_LOW = 0x2 + IP_RECVDSTADDR = 0x7 + IP_RECVDSTPORT = 0x21 + IP_RECVIF = 0x1e + IP_RECVOPTS = 0x5 + IP_RECVRETOPTS = 0x6 + IP_RECVRTABLE = 0x23 + IP_RECVTTL = 0x1f + IP_RETOPTS = 0x8 + IP_RF = 0x8000 + IP_RTABLE = 0x1021 + IP_SENDSRCADDR = 0x7 + IP_TOS = 0x3 + IP_TTL = 0x4 + ISIG = 0x80 + ISTRIP = 0x20 + ITIMER_PROF = 0x2 + ITIMER_REAL = 0x0 + ITIMER_VIRTUAL = 0x1 + IUCLC = 0x1000 + IXANY = 0x800 + IXOFF = 0x400 + IXON = 0x200 + KERN_HOSTNAME = 0xa + KERN_OSRELEASE = 0x2 + KERN_OSTYPE = 0x1 + KERN_VERSION = 0x4 + LCNT_OVERLOAD_FLUSH = 0x6 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_SH = 0x1 + LOCK_UN = 0x8 + MADV_DONTNEED = 0x4 + MADV_FREE = 0x6 + MADV_NORMAL = 0x0 + MADV_RANDOM = 0x1 + MADV_SEQUENTIAL = 0x2 + MADV_SPACEAVAIL = 0x5 + MADV_WILLNEED = 0x3 + MAP_ANON = 0x1000 + MAP_ANONYMOUS = 0x1000 + MAP_CONCEAL = 0x8000 + MAP_COPY = 0x2 + MAP_FILE = 0x0 + MAP_FIXED = 0x10 + MAP_FLAGMASK = 0xfff7 + MAP_HASSEMAPHORE = 0x0 + MAP_INHERIT = 0x0 + MAP_INHERIT_COPY = 0x1 + MAP_INHERIT_NONE = 0x2 + MAP_INHERIT_SHARE = 0x0 + MAP_INHERIT_ZERO = 0x3 + MAP_NOEXTEND = 0x0 + MAP_NORESERVE = 0x0 + MAP_PRIVATE = 0x2 + MAP_RENAME = 0x0 + MAP_SHARED = 0x1 + MAP_STACK = 0x4000 + MAP_TRYFIXED = 0x0 + MCL_CURRENT = 0x1 + MCL_FUTURE = 0x2 + MNT_ASYNC = 0x40 + MNT_DEFEXPORTED = 0x200 + MNT_DELEXPORT = 0x20000 + MNT_DOOMED = 0x8000000 + MNT_EXPORTANON = 0x400 + MNT_EXPORTED = 0x100 + MNT_EXRDONLY = 0x80 + MNT_FORCE = 0x80000 + MNT_LAZY = 0x3 + MNT_LOCAL = 0x1000 + MNT_NOATIME = 0x8000 + MNT_NODEV = 0x10 + MNT_NOEXEC = 0x4 + MNT_NOPERM = 0x20 + MNT_NOSUID = 0x8 + MNT_NOWAIT = 0x2 + MNT_QUOTA = 0x2000 + MNT_RDONLY = 0x1 + MNT_RELOAD = 0x40000 + MNT_ROOTFS = 0x4000 + MNT_SOFTDEP = 0x4000000 + MNT_STALLED = 0x100000 + MNT_SWAPPABLE = 0x200000 + MNT_SYNCHRONOUS = 0x2 + MNT_UPDATE = 0x10000 + MNT_VISFLAGMASK = 0x400ffff + MNT_WAIT = 0x1 + MNT_WANTRDWR = 0x2000000 + MNT_WXALLOWED = 0x800 + MOUNT_AFS = "afs" + MOUNT_CD9660 = "cd9660" + MOUNT_EXT2FS = "ext2fs" + MOUNT_FFS = "ffs" + MOUNT_FUSEFS = "fuse" + MOUNT_MFS = "mfs" + MOUNT_MSDOS = "msdos" + MOUNT_NCPFS = "ncpfs" + MOUNT_NFS = "nfs" + MOUNT_NTFS = "ntfs" + MOUNT_TMPFS = "tmpfs" + MOUNT_UDF = "udf" + MOUNT_UFS = "ffs" + MSG_BCAST = 0x100 + MSG_CMSG_CLOEXEC = 0x800 + MSG_CTRUNC = 0x20 + MSG_DONTROUTE = 0x4 + MSG_DONTWAIT = 0x80 + MSG_EOR = 0x8 + MSG_MCAST = 0x200 + MSG_NOSIGNAL = 0x400 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_TRUNC = 0x10 + MSG_WAITALL = 0x40 + MSG_WAITFORONE = 0x1000 + MS_ASYNC = 0x1 + MS_INVALIDATE = 0x4 + MS_SYNC = 0x2 + NAME_MAX = 0xff + NET_RT_DUMP = 0x1 + NET_RT_FLAGS = 0x2 + NET_RT_IFLIST = 0x3 + NET_RT_IFNAMES = 0x6 + NET_RT_MAXID = 0x8 + NET_RT_SOURCE = 0x7 + NET_RT_STATS = 0x4 + NET_RT_TABLE = 0x5 + NFDBITS = 0x20 + NOFLSH = 0x80000000 + NOKERNINFO = 0x2000000 + NOTE_ATTRIB = 0x8 + NOTE_CHANGE = 0x1 + NOTE_CHILD = 0x4 + NOTE_DELETE = 0x1 + NOTE_EOF = 0x2 + NOTE_EXEC = 0x20000000 + NOTE_EXIT = 0x80000000 + NOTE_EXTEND = 0x4 + NOTE_FORK = 0x40000000 + NOTE_LINK = 0x10 + NOTE_LOWAT = 0x1 + NOTE_OOB = 0x4 + NOTE_PCTRLMASK = 0xf0000000 + NOTE_PDATAMASK = 0xfffff + NOTE_RENAME = 0x20 + NOTE_REVOKE = 0x40 + NOTE_TRACK = 0x1 + NOTE_TRACKERR = 0x2 + NOTE_TRUNCATE = 0x80 + NOTE_WRITE = 0x2 + OCRNL = 0x10 + OLCUC = 0x20 + ONLCR = 0x2 + ONLRET = 0x80 + ONOCR = 0x40 + ONOEOT = 0x8 + OPOST = 0x1 + OXTABS = 0x4 + O_ACCMODE = 0x3 + O_APPEND = 0x8 + O_ASYNC = 0x40 + O_CLOEXEC = 0x10000 + O_CREAT = 0x200 + O_DIRECTORY = 0x20000 + O_DSYNC = 0x80 + O_EXCL = 0x800 + O_EXLOCK = 0x20 + O_FSYNC = 0x80 + O_NDELAY = 0x4 + O_NOCTTY = 0x8000 + O_NOFOLLOW = 0x100 + O_NONBLOCK = 0x4 + O_RDONLY = 0x0 + O_RDWR = 0x2 + O_RSYNC = 0x80 + O_SHLOCK = 0x10 + O_SYNC = 0x80 + O_TRUNC = 0x400 + O_WRONLY = 0x1 + PARENB = 0x1000 + PARMRK = 0x8 + PARODD = 0x2000 + PENDIN = 0x20000000 + PF_FLUSH = 0x1 + PRIO_PGRP = 0x1 + PRIO_PROCESS = 0x0 + PRIO_USER = 0x2 + PROT_EXEC = 0x4 + PROT_NONE = 0x0 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + RLIMIT_CORE = 0x4 + RLIMIT_CPU = 0x0 + RLIMIT_DATA = 0x2 + RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 + RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 + RLIMIT_STACK = 0x3 + RLIM_INFINITY = 0x7fffffffffffffff + RTAX_AUTHOR = 0x6 + RTAX_BFD = 0xb + RTAX_BRD = 0x7 + RTAX_DNS = 0xc + RTAX_DST = 0x0 + RTAX_GATEWAY = 0x1 + RTAX_GENMASK = 0x3 + RTAX_IFA = 0x5 + RTAX_IFP = 0x4 + RTAX_LABEL = 0xa + RTAX_MAX = 0xf + RTAX_NETMASK = 0x2 + RTAX_SEARCH = 0xe + RTAX_SRC = 0x8 + RTAX_SRCMASK = 0x9 + RTAX_STATIC = 0xd + RTA_AUTHOR = 0x40 + RTA_BFD = 0x800 + RTA_BRD = 0x80 + RTA_DNS = 0x1000 + RTA_DST = 0x1 + RTA_GATEWAY = 0x2 + RTA_GENMASK = 0x8 + RTA_IFA = 0x20 + RTA_IFP = 0x10 + RTA_LABEL = 0x400 + RTA_NETMASK = 0x4 + RTA_SEARCH = 0x4000 + RTA_SRC = 0x100 + RTA_SRCMASK = 0x200 + RTA_STATIC = 0x2000 + RTF_ANNOUNCE = 0x4000 + RTF_BFD = 0x1000000 + RTF_BLACKHOLE = 0x1000 + RTF_BROADCAST = 0x400000 + RTF_CACHED = 0x20000 + RTF_CLONED = 0x10000 + RTF_CLONING = 0x100 + RTF_CONNECTED = 0x800000 + RTF_DONE = 0x40 + RTF_DYNAMIC = 0x10 + RTF_FMASK = 0x110fc08 + RTF_GATEWAY = 0x2 + RTF_HOST = 0x4 + RTF_LLINFO = 0x400 + RTF_LOCAL = 0x200000 + RTF_MODIFIED = 0x20 + RTF_MPATH = 0x40000 + RTF_MPLS = 0x100000 + RTF_MULTICAST = 0x200 + RTF_PERMANENT_ARP = 0x2000 + RTF_PROTO1 = 0x8000 + RTF_PROTO2 = 0x4000 + RTF_PROTO3 = 0x2000 + RTF_REJECT = 0x8 + RTF_STATIC = 0x800 + RTF_UP = 0x1 + RTF_USETRAILERS = 0x8000 + RTM_80211INFO = 0x15 + RTM_ADD = 0x1 + RTM_BFD = 0x12 + RTM_CHANGE = 0x3 + RTM_CHGADDRATTR = 0x14 + RTM_DELADDR = 0xd + RTM_DELETE = 0x2 + RTM_DESYNC = 0x10 + RTM_GET = 0x4 + RTM_IFANNOUNCE = 0xf + RTM_IFINFO = 0xe + RTM_INVALIDATE = 0x11 + RTM_LOSING = 0x5 + RTM_MAXSIZE = 0x800 + RTM_MISS = 0x7 + RTM_NEWADDR = 0xc + RTM_PROPOSAL = 0x13 + RTM_REDIRECT = 0x6 + RTM_RESOLVE = 0xb + RTM_SOURCE = 0x16 + RTM_VERSION = 0x5 + RTV_EXPIRE = 0x4 + RTV_HOPCOUNT = 0x2 + RTV_MTU = 0x1 + RTV_RPIPE = 0x8 + RTV_RTT = 0x40 + RTV_RTTVAR = 0x80 + RTV_SPIPE = 0x10 + RTV_SSTHRESH = 0x20 + RT_TABLEID_BITS = 0x8 + RT_TABLEID_MASK = 0xff + RT_TABLEID_MAX = 0xff + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 + RUSAGE_THREAD = 0x1 + SCM_RIGHTS = 0x1 + SCM_TIMESTAMP = 0x4 + SEEK_CUR = 0x1 + SEEK_END = 0x2 + SEEK_SET = 0x0 + SHUT_RD = 0x0 + SHUT_RDWR = 0x2 + SHUT_WR = 0x1 + SIOCADDMULTI = 0x80206931 + SIOCAIFADDR = 0x8040691a + SIOCAIFGROUP = 0x80286987 + SIOCATMARK = 0x40047307 + SIOCBRDGADD = 0x8060693c + SIOCBRDGADDL = 0x80606949 + SIOCBRDGADDS = 0x80606941 + SIOCBRDGARL = 0x808c694d + SIOCBRDGDADDR = 0x81286947 + SIOCBRDGDEL = 0x8060693d + SIOCBRDGDELS = 0x80606942 + SIOCBRDGFLUSH = 0x80606948 + SIOCBRDGFRL = 0x808c694e + SIOCBRDGGCACHE = 0xc0146941 + SIOCBRDGGFD = 0xc0146952 + SIOCBRDGGHT = 0xc0146951 + SIOCBRDGGIFFLGS = 0xc060693e + SIOCBRDGGMA = 0xc0146953 + SIOCBRDGGPARAM = 0xc0406958 + SIOCBRDGGPRI = 0xc0146950 + SIOCBRDGGRL = 0xc030694f + SIOCBRDGGTO = 0xc0146946 + SIOCBRDGIFS = 0xc0606942 + SIOCBRDGRTS = 0xc0206943 + SIOCBRDGSADDR = 0xc1286944 + SIOCBRDGSCACHE = 0x80146940 + SIOCBRDGSFD = 0x80146952 + SIOCBRDGSHT = 0x80146951 + SIOCBRDGSIFCOST = 0x80606955 + SIOCBRDGSIFFLGS = 0x8060693f + SIOCBRDGSIFPRIO = 0x80606954 + SIOCBRDGSIFPROT = 0x8060694a + SIOCBRDGSMA = 0x80146953 + SIOCBRDGSPRI = 0x80146950 + SIOCBRDGSPROTO = 0x8014695a + SIOCBRDGSTO = 0x80146945 + SIOCBRDGSTXHC = 0x80146959 + SIOCDELLABEL = 0x80206997 + SIOCDELMULTI = 0x80206932 + SIOCDIFADDR = 0x80206919 + SIOCDIFGROUP = 0x80286989 + SIOCDIFPARENT = 0x802069b4 + SIOCDIFPHYADDR = 0x80206949 + SIOCDPWE3NEIGHBOR = 0x802069de + SIOCDVNETID = 0x802069af + SIOCGETKALIVE = 0xc01869a4 + SIOCGETLABEL = 0x8020699a + SIOCGETMPWCFG = 0xc02069ae + SIOCGETPFLOW = 0xc02069fe + SIOCGETPFSYNC = 0xc02069f8 + SIOCGETSGCNT = 0xc0207534 + SIOCGETVIFCNT = 0xc0287533 + SIOCGETVLAN = 0xc0206990 + SIOCGIFADDR = 0xc0206921 + SIOCGIFBRDADDR = 0xc0206923 + SIOCGIFCONF = 0xc0106924 + SIOCGIFDATA = 0xc020691b + SIOCGIFDESCR = 0xc0206981 + SIOCGIFDSTADDR = 0xc0206922 + SIOCGIFFLAGS = 0xc0206911 + SIOCGIFGATTR = 0xc028698b + SIOCGIFGENERIC = 0xc020693a + SIOCGIFGLIST = 0xc028698d + SIOCGIFGMEMB = 0xc028698a + SIOCGIFGROUP = 0xc0286988 + SIOCGIFHARDMTU = 0xc02069a5 + SIOCGIFLLPRIO = 0xc02069b6 + SIOCGIFMEDIA = 0xc0406938 + SIOCGIFMETRIC = 0xc0206917 + SIOCGIFMTU = 0xc020697e + SIOCGIFNETMASK = 0xc0206925 + SIOCGIFPAIR = 0xc02069b1 + SIOCGIFPARENT = 0xc02069b3 + SIOCGIFPRIORITY = 0xc020699c + SIOCGIFRDOMAIN = 0xc02069a0 + SIOCGIFRTLABEL = 0xc0206983 + SIOCGIFRXR = 0x802069aa + SIOCGIFSFFPAGE = 0xc1126939 + SIOCGIFXFLAGS = 0xc020699e + SIOCGLIFPHYADDR = 0xc218694b + SIOCGLIFPHYDF = 0xc02069c2 + SIOCGLIFPHYECN = 0xc02069c8 + SIOCGLIFPHYRTABLE = 0xc02069a2 + SIOCGLIFPHYTTL = 0xc02069a9 + SIOCGPGRP = 0x40047309 + SIOCGPWE3 = 0xc0206998 + SIOCGPWE3CTRLWORD = 0xc02069dc + SIOCGPWE3FAT = 0xc02069dd + SIOCGPWE3NEIGHBOR = 0xc21869de + SIOCGRXHPRIO = 0xc02069db + SIOCGSPPPPARAMS = 0xc0206994 + SIOCGTXHPRIO = 0xc02069c6 + SIOCGUMBINFO = 0xc02069be + SIOCGUMBPARAM = 0xc02069c0 + SIOCGVH = 0xc02069f6 + SIOCGVNETFLOWID = 0xc02069c4 + SIOCGVNETID = 0xc02069a7 + SIOCIFAFATTACH = 0x801169ab + SIOCIFAFDETACH = 0x801169ac + SIOCIFCREATE = 0x8020697a + SIOCIFDESTROY = 0x80206979 + SIOCIFGCLONERS = 0xc0106978 + SIOCSETKALIVE = 0x801869a3 + SIOCSETLABEL = 0x80206999 + SIOCSETMPWCFG = 0x802069ad + SIOCSETPFLOW = 0x802069fd + SIOCSETPFSYNC = 0x802069f7 + SIOCSETVLAN = 0x8020698f + SIOCSIFADDR = 0x8020690c + SIOCSIFBRDADDR = 0x80206913 + SIOCSIFDESCR = 0x80206980 + SIOCSIFDSTADDR = 0x8020690e + SIOCSIFFLAGS = 0x80206910 + SIOCSIFGATTR = 0x8028698c + SIOCSIFGENERIC = 0x80206939 + SIOCSIFLLADDR = 0x8020691f + SIOCSIFLLPRIO = 0x802069b5 + SIOCSIFMEDIA = 0xc0206937 + SIOCSIFMETRIC = 0x80206918 + SIOCSIFMTU = 0x8020697f + SIOCSIFNETMASK = 0x80206916 + SIOCSIFPAIR = 0x802069b0 + SIOCSIFPARENT = 0x802069b2 + SIOCSIFPRIORITY = 0x8020699b + SIOCSIFRDOMAIN = 0x8020699f + SIOCSIFRTLABEL = 0x80206982 + SIOCSIFXFLAGS = 0x8020699d + SIOCSLIFPHYADDR = 0x8218694a + SIOCSLIFPHYDF = 0x802069c1 + SIOCSLIFPHYECN = 0x802069c7 + SIOCSLIFPHYRTABLE = 0x802069a1 + SIOCSLIFPHYTTL = 0x802069a8 + SIOCSPGRP = 0x80047308 + SIOCSPWE3CTRLWORD = 0x802069dc + SIOCSPWE3FAT = 0x802069dd + SIOCSPWE3NEIGHBOR = 0x821869de + SIOCSRXHPRIO = 0x802069db + SIOCSSPPPPARAMS = 0x80206993 + SIOCSTXHPRIO = 0x802069c5 + SIOCSUMBPARAM = 0x802069bf + SIOCSVH = 0xc02069f5 + SIOCSVNETFLOWID = 0x802069c3 + SIOCSVNETID = 0x802069a6 + SOCK_CLOEXEC = 0x8000 + SOCK_DGRAM = 0x2 + SOCK_DNS = 0x1000 + SOCK_NONBLOCK = 0x4000 + SOCK_RAW = 0x3 + SOCK_RDM = 0x4 + SOCK_SEQPACKET = 0x5 + SOCK_STREAM = 0x1 + SOL_SOCKET = 0xffff + SOMAXCONN = 0x80 + SO_ACCEPTCONN = 0x2 + SO_BINDANY = 0x1000 + SO_BROADCAST = 0x20 + SO_DEBUG = 0x1 + SO_DOMAIN = 0x1024 + SO_DONTROUTE = 0x10 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x8 + SO_LINGER = 0x80 + SO_NETPROC = 0x1020 + SO_OOBINLINE = 0x100 + SO_PEERCRED = 0x1022 + SO_PROTOCOL = 0x1025 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x1006 + SO_REUSEADDR = 0x4 + SO_REUSEPORT = 0x200 + SO_RTABLE = 0x1021 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x1005 + SO_SPLICE = 0x1023 + SO_TIMESTAMP = 0x800 + SO_TYPE = 0x1008 + SO_USELOOPBACK = 0x40 + SO_ZEROIZE = 0x2000 + S_BLKSIZE = 0x200 + S_IEXEC = 0x40 + S_IFBLK = 0x6000 + S_IFCHR = 0x2000 + S_IFDIR = 0x4000 + S_IFIFO = 0x1000 + S_IFLNK = 0xa000 + S_IFMT = 0xf000 + S_IFREG = 0x8000 + S_IFSOCK = 0xc000 + S_IREAD = 0x100 + S_IRGRP = 0x20 + S_IROTH = 0x4 + S_IRUSR = 0x100 + S_IRWXG = 0x38 + S_IRWXO = 0x7 + S_IRWXU = 0x1c0 + S_ISGID = 0x400 + S_ISTXT = 0x200 + S_ISUID = 0x800 + S_ISVTX = 0x200 + S_IWGRP = 0x10 + S_IWOTH = 0x2 + S_IWRITE = 0x80 + S_IWUSR = 0x80 + S_IXGRP = 0x8 + S_IXOTH = 0x1 + S_IXUSR = 0x40 + TCIFLUSH = 0x1 + TCIOFF = 0x3 + TCIOFLUSH = 0x3 + TCION = 0x4 + TCOFLUSH = 0x2 + TCOOFF = 0x1 + TCOON = 0x2 + TCPOPT_EOL = 0x0 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_HDR = 0x1010500 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SACK_PERMIT_HDR = 0x1010402 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_TSTAMP_HDR = 0x101080a + TCPOPT_WINDOW = 0x3 + TCP_INFO = 0x9 + TCP_MAXSEG = 0x2 + TCP_MAXWIN = 0xffff + TCP_MAX_SACK = 0x3 + TCP_MAX_WINSHIFT = 0xe + TCP_MD5SIG = 0x4 + TCP_MSS = 0x200 + TCP_NODELAY = 0x1 + TCP_NOPUSH = 0x10 + TCP_SACKHOLE_LIMIT = 0x80 + TCP_SACK_ENABLE = 0x8 + TCSAFLUSH = 0x2 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCHKVERAUTH = 0x2000741e + TIOCCLRVERAUTH = 0x2000741d + TIOCCONS = 0x80047462 + TIOCDRAIN = 0x2000745e + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLAG_CLOCAL = 0x2 + TIOCFLAG_CRTSCTS = 0x4 + TIOCFLAG_MDMBUF = 0x8 + TIOCFLAG_PPS = 0x10 + TIOCFLAG_SOFTCAR = 0x1 + TIOCFLUSH = 0x80047410 + TIOCGETA = 0x402c7413 + TIOCGETD = 0x4004741a + TIOCGFLAGS = 0x4004745d + TIOCGPGRP = 0x40047477 + TIOCGSID = 0x40047463 + TIOCGTSTAMP = 0x4010745b + TIOCGWINSZ = 0x40087468 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGET = 0x4004746a + TIOCMODG = 0x4004746a + TIOCMODS = 0x8004746d + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0x0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCREMOTE = 0x80047469 + TIOCSBRK = 0x2000747b + TIOCSCTTY = 0x20007461 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x802c7414 + TIOCSETAF = 0x802c7416 + TIOCSETAW = 0x802c7415 + TIOCSETD = 0x8004741b + TIOCSETVERAUTH = 0x8004741c + TIOCSFLAGS = 0x8004745c + TIOCSIG = 0x8004745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTOP = 0x2000746f + TIOCSTSTAMP = 0x8008745a + TIOCSWINSZ = 0x80087467 + TIOCUCNTL = 0x80047466 + TIOCUCNTL_CBRK = 0x7a + TIOCUCNTL_SBRK = 0x7b + TOSTOP = 0x400000 + UTIME_NOW = -0x2 + UTIME_OMIT = -0x1 + VDISCARD = 0xf + VDSUSP = 0xb + VEOF = 0x0 + VEOL = 0x1 + VEOL2 = 0x2 + VERASE = 0x3 + VINTR = 0x8 + VKILL = 0x5 + VLNEXT = 0xe + VMIN = 0x10 + VM_ANONMIN = 0x7 + VM_LOADAVG = 0x2 + VM_MALLOC_CONF = 0xc + VM_MAXID = 0xd + VM_MAXSLP = 0xa + VM_METER = 0x1 + VM_NKMEMPAGES = 0x6 + VM_PSSTRINGS = 0x3 + VM_SWAPENCRYPT = 0x5 + VM_USPACE = 0xb + VM_UVMEXP = 0x4 + VM_VNODEMIN = 0x9 + VM_VTEXTMIN = 0x8 + VQUIT = 0x9 + VREPRINT = 0x6 + VSTART = 0xc + VSTATUS = 0x12 + VSTOP = 0xd + VSUSP = 0xa + VTIME = 0x11 + VWERASE = 0x4 + WALTSIG = 0x4 + WCONTINUED = 0x8 + WCOREFLAG = 0x80 + WNOHANG = 0x1 + WUNTRACED = 0x2 + XCASE = 0x1000000 +) + +// Errors +const ( + E2BIG = syscall.Errno(0x7) + EACCES = syscall.Errno(0xd) + EADDRINUSE = syscall.Errno(0x30) + EADDRNOTAVAIL = syscall.Errno(0x31) + EAFNOSUPPORT = syscall.Errno(0x2f) + EAGAIN = syscall.Errno(0x23) + EALREADY = syscall.Errno(0x25) + EAUTH = syscall.Errno(0x50) + EBADF = syscall.Errno(0x9) + EBADMSG = syscall.Errno(0x5c) + EBADRPC = syscall.Errno(0x48) + EBUSY = syscall.Errno(0x10) + ECANCELED = syscall.Errno(0x58) + ECHILD = syscall.Errno(0xa) + ECONNABORTED = syscall.Errno(0x35) + ECONNREFUSED = syscall.Errno(0x3d) + ECONNRESET = syscall.Errno(0x36) + EDEADLK = syscall.Errno(0xb) + EDESTADDRREQ = syscall.Errno(0x27) + EDOM = syscall.Errno(0x21) + EDQUOT = syscall.Errno(0x45) + EEXIST = syscall.Errno(0x11) + EFAULT = syscall.Errno(0xe) + EFBIG = syscall.Errno(0x1b) + EFTYPE = syscall.Errno(0x4f) + EHOSTDOWN = syscall.Errno(0x40) + EHOSTUNREACH = syscall.Errno(0x41) + EIDRM = syscall.Errno(0x59) + EILSEQ = syscall.Errno(0x54) + EINPROGRESS = syscall.Errno(0x24) + EINTR = syscall.Errno(0x4) + EINVAL = syscall.Errno(0x16) + EIO = syscall.Errno(0x5) + EIPSEC = syscall.Errno(0x52) + EISCONN = syscall.Errno(0x38) + EISDIR = syscall.Errno(0x15) + ELAST = syscall.Errno(0x5f) + ELOOP = syscall.Errno(0x3e) + EMEDIUMTYPE = syscall.Errno(0x56) + EMFILE = syscall.Errno(0x18) + EMLINK = syscall.Errno(0x1f) + EMSGSIZE = syscall.Errno(0x28) + ENAMETOOLONG = syscall.Errno(0x3f) + ENEEDAUTH = syscall.Errno(0x51) + ENETDOWN = syscall.Errno(0x32) + ENETRESET = syscall.Errno(0x34) + ENETUNREACH = syscall.Errno(0x33) + ENFILE = syscall.Errno(0x17) + ENOATTR = syscall.Errno(0x53) + ENOBUFS = syscall.Errno(0x37) + ENODEV = syscall.Errno(0x13) + ENOENT = syscall.Errno(0x2) + ENOEXEC = syscall.Errno(0x8) + ENOLCK = syscall.Errno(0x4d) + ENOMEDIUM = syscall.Errno(0x55) + ENOMEM = syscall.Errno(0xc) + ENOMSG = syscall.Errno(0x5a) + ENOPROTOOPT = syscall.Errno(0x2a) + ENOSPC = syscall.Errno(0x1c) + ENOSYS = syscall.Errno(0x4e) + ENOTBLK = syscall.Errno(0xf) + ENOTCONN = syscall.Errno(0x39) + ENOTDIR = syscall.Errno(0x14) + ENOTEMPTY = syscall.Errno(0x42) + ENOTRECOVERABLE = syscall.Errno(0x5d) + ENOTSOCK = syscall.Errno(0x26) + ENOTSUP = syscall.Errno(0x5b) + ENOTTY = syscall.Errno(0x19) + ENXIO = syscall.Errno(0x6) + EOPNOTSUPP = syscall.Errno(0x2d) + EOVERFLOW = syscall.Errno(0x57) + EOWNERDEAD = syscall.Errno(0x5e) + EPERM = syscall.Errno(0x1) + EPFNOSUPPORT = syscall.Errno(0x2e) + EPIPE = syscall.Errno(0x20) + EPROCLIM = syscall.Errno(0x43) + EPROCUNAVAIL = syscall.Errno(0x4c) + EPROGMISMATCH = syscall.Errno(0x4b) + EPROGUNAVAIL = syscall.Errno(0x4a) + EPROTO = syscall.Errno(0x5f) + EPROTONOSUPPORT = syscall.Errno(0x2b) + EPROTOTYPE = syscall.Errno(0x29) + ERANGE = syscall.Errno(0x22) + EREMOTE = syscall.Errno(0x47) + EROFS = syscall.Errno(0x1e) + ERPCMISMATCH = syscall.Errno(0x49) + ESHUTDOWN = syscall.Errno(0x3a) + ESOCKTNOSUPPORT = syscall.Errno(0x2c) + ESPIPE = syscall.Errno(0x1d) + ESRCH = syscall.Errno(0x3) + ESTALE = syscall.Errno(0x46) + ETIMEDOUT = syscall.Errno(0x3c) + ETOOMANYREFS = syscall.Errno(0x3b) + ETXTBSY = syscall.Errno(0x1a) + EUSERS = syscall.Errno(0x44) + EWOULDBLOCK = syscall.Errno(0x23) + EXDEV = syscall.Errno(0x12) +) + +// Signals +const ( + SIGABRT = syscall.Signal(0x6) + SIGALRM = syscall.Signal(0xe) + SIGBUS = syscall.Signal(0xa) + SIGCHLD = syscall.Signal(0x14) + SIGCONT = syscall.Signal(0x13) + SIGEMT = syscall.Signal(0x7) + SIGFPE = syscall.Signal(0x8) + SIGHUP = syscall.Signal(0x1) + SIGILL = syscall.Signal(0x4) + SIGINFO = syscall.Signal(0x1d) + SIGINT = syscall.Signal(0x2) + SIGIO = syscall.Signal(0x17) + SIGIOT = syscall.Signal(0x6) + SIGKILL = syscall.Signal(0x9) + SIGPIPE = syscall.Signal(0xd) + SIGPROF = syscall.Signal(0x1b) + SIGQUIT = syscall.Signal(0x3) + SIGSEGV = syscall.Signal(0xb) + SIGSTOP = syscall.Signal(0x11) + SIGSYS = syscall.Signal(0xc) + SIGTERM = syscall.Signal(0xf) + SIGTHR = syscall.Signal(0x20) + SIGTRAP = syscall.Signal(0x5) + SIGTSTP = syscall.Signal(0x12) + SIGTTIN = syscall.Signal(0x15) + SIGTTOU = syscall.Signal(0x16) + SIGURG = syscall.Signal(0x10) + SIGUSR1 = syscall.Signal(0x1e) + SIGUSR2 = syscall.Signal(0x1f) + SIGVTALRM = syscall.Signal(0x1a) + SIGWINCH = syscall.Signal(0x1c) + SIGXCPU = syscall.Signal(0x18) + SIGXFSZ = syscall.Signal(0x19) +) + +// Error table +var errorList = [...]struct { + num syscall.Errno + name string + desc string +}{ + {1, "EPERM", "operation not permitted"}, + {2, "ENOENT", "no such file or directory"}, + {3, "ESRCH", "no such process"}, + {4, "EINTR", "interrupted system call"}, + {5, "EIO", "input/output error"}, + {6, "ENXIO", "device not configured"}, + {7, "E2BIG", "argument list too long"}, + {8, "ENOEXEC", "exec format error"}, + {9, "EBADF", "bad file descriptor"}, + {10, "ECHILD", "no child processes"}, + {11, "EDEADLK", "resource deadlock avoided"}, + {12, "ENOMEM", "cannot allocate memory"}, + {13, "EACCES", "permission denied"}, + {14, "EFAULT", "bad address"}, + {15, "ENOTBLK", "block device required"}, + {16, "EBUSY", "device busy"}, + {17, "EEXIST", "file exists"}, + {18, "EXDEV", "cross-device link"}, + {19, "ENODEV", "operation not supported by device"}, + {20, "ENOTDIR", "not a directory"}, + {21, "EISDIR", "is a directory"}, + {22, "EINVAL", "invalid argument"}, + {23, "ENFILE", "too many open files in system"}, + {24, "EMFILE", "too many open files"}, + {25, "ENOTTY", "inappropriate ioctl for device"}, + {26, "ETXTBSY", "text file busy"}, + {27, "EFBIG", "file too large"}, + {28, "ENOSPC", "no space left on device"}, + {29, "ESPIPE", "illegal seek"}, + {30, "EROFS", "read-only file system"}, + {31, "EMLINK", "too many links"}, + {32, "EPIPE", "broken pipe"}, + {33, "EDOM", "numerical argument out of domain"}, + {34, "ERANGE", "result too large"}, + {35, "EAGAIN", "resource temporarily unavailable"}, + {36, "EINPROGRESS", "operation now in progress"}, + {37, "EALREADY", "operation already in progress"}, + {38, "ENOTSOCK", "socket operation on non-socket"}, + {39, "EDESTADDRREQ", "destination address required"}, + {40, "EMSGSIZE", "message too long"}, + {41, "EPROTOTYPE", "protocol wrong type for socket"}, + {42, "ENOPROTOOPT", "protocol not available"}, + {43, "EPROTONOSUPPORT", "protocol not supported"}, + {44, "ESOCKTNOSUPPORT", "socket type not supported"}, + {45, "EOPNOTSUPP", "operation not supported"}, + {46, "EPFNOSUPPORT", "protocol family not supported"}, + {47, "EAFNOSUPPORT", "address family not supported by protocol family"}, + {48, "EADDRINUSE", "address already in use"}, + {49, "EADDRNOTAVAIL", "can't assign requested address"}, + {50, "ENETDOWN", "network is down"}, + {51, "ENETUNREACH", "network is unreachable"}, + {52, "ENETRESET", "network dropped connection on reset"}, + {53, "ECONNABORTED", "software caused connection abort"}, + {54, "ECONNRESET", "connection reset by peer"}, + {55, "ENOBUFS", "no buffer space available"}, + {56, "EISCONN", "socket is already connected"}, + {57, "ENOTCONN", "socket is not connected"}, + {58, "ESHUTDOWN", "can't send after socket shutdown"}, + {59, "ETOOMANYREFS", "too many references: can't splice"}, + {60, "ETIMEDOUT", "operation timed out"}, + {61, "ECONNREFUSED", "connection refused"}, + {62, "ELOOP", "too many levels of symbolic links"}, + {63, "ENAMETOOLONG", "file name too long"}, + {64, "EHOSTDOWN", "host is down"}, + {65, "EHOSTUNREACH", "no route to host"}, + {66, "ENOTEMPTY", "directory not empty"}, + {67, "EPROCLIM", "too many processes"}, + {68, "EUSERS", "too many users"}, + {69, "EDQUOT", "disk quota exceeded"}, + {70, "ESTALE", "stale NFS file handle"}, + {71, "EREMOTE", "too many levels of remote in path"}, + {72, "EBADRPC", "RPC struct is bad"}, + {73, "ERPCMISMATCH", "RPC version wrong"}, + {74, "EPROGUNAVAIL", "RPC program not available"}, + {75, "EPROGMISMATCH", "program version wrong"}, + {76, "EPROCUNAVAIL", "bad procedure for program"}, + {77, "ENOLCK", "no locks available"}, + {78, "ENOSYS", "function not implemented"}, + {79, "EFTYPE", "inappropriate file type or format"}, + {80, "EAUTH", "authentication error"}, + {81, "ENEEDAUTH", "need authenticator"}, + {82, "EIPSEC", "IPsec processing failure"}, + {83, "ENOATTR", "attribute not found"}, + {84, "EILSEQ", "illegal byte sequence"}, + {85, "ENOMEDIUM", "no medium found"}, + {86, "EMEDIUMTYPE", "wrong medium type"}, + {87, "EOVERFLOW", "value too large to be stored in data type"}, + {88, "ECANCELED", "operation canceled"}, + {89, "EIDRM", "identifier removed"}, + {90, "ENOMSG", "no message of desired type"}, + {91, "ENOTSUP", "not supported"}, + {92, "EBADMSG", "bad message"}, + {93, "ENOTRECOVERABLE", "state not recoverable"}, + {94, "EOWNERDEAD", "previous owner died"}, + {95, "ELAST", "protocol error"}, +} + +// Signal table +var signalList = [...]struct { + num syscall.Signal + name string + desc string +}{ + {1, "SIGHUP", "hangup"}, + {2, "SIGINT", "interrupt"}, + {3, "SIGQUIT", "quit"}, + {4, "SIGILL", "illegal instruction"}, + {5, "SIGTRAP", "trace/BPT trap"}, + {6, "SIGABRT", "abort trap"}, + {7, "SIGEMT", "EMT trap"}, + {8, "SIGFPE", "floating point exception"}, + {9, "SIGKILL", "killed"}, + {10, "SIGBUS", "bus error"}, + {11, "SIGSEGV", "segmentation fault"}, + {12, "SIGSYS", "bad system call"}, + {13, "SIGPIPE", "broken pipe"}, + {14, "SIGALRM", "alarm clock"}, + {15, "SIGTERM", "terminated"}, + {16, "SIGURG", "urgent I/O condition"}, + {17, "SIGSTOP", "suspended (signal)"}, + {18, "SIGTSTP", "suspended"}, + {19, "SIGCONT", "continued"}, + {20, "SIGCHLD", "child exited"}, + {21, "SIGTTIN", "stopped (tty input)"}, + {22, "SIGTTOU", "stopped (tty output)"}, + {23, "SIGIO", "I/O possible"}, + {24, "SIGXCPU", "cputime limit exceeded"}, + {25, "SIGXFSZ", "filesize limit exceeded"}, + {26, "SIGVTALRM", "virtual timer expired"}, + {27, "SIGPROF", "profiling timer expired"}, + {28, "SIGWINCH", "window size changes"}, + {29, "SIGINFO", "information request"}, + {30, "SIGUSR1", "user defined signal 1"}, + {31, "SIGUSR2", "user defined signal 2"}, + {32, "SIGTHR", "thread AST"}, +} diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go new file mode 100644 index 000000000000..13d403031ed6 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go @@ -0,0 +1,1904 @@ +// mkerrors.sh -m64 +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build riscv64 && openbsd +// +build riscv64,openbsd + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs -- -m64 _const.go + +package unix + +import "syscall" + +const ( + AF_APPLETALK = 0x10 + AF_BLUETOOTH = 0x20 + AF_CCITT = 0xa + AF_CHAOS = 0x5 + AF_CNT = 0x15 + AF_COIP = 0x14 + AF_DATAKIT = 0x9 + AF_DECnet = 0xc + AF_DLI = 0xd + AF_E164 = 0x1a + AF_ECMA = 0x8 + AF_ENCAP = 0x1c + AF_HYLINK = 0xf + AF_IMPLINK = 0x3 + AF_INET = 0x2 + AF_INET6 = 0x18 + AF_IPX = 0x17 + AF_ISDN = 0x1a + AF_ISO = 0x7 + AF_KEY = 0x1e + AF_LAT = 0xe + AF_LINK = 0x12 + AF_LOCAL = 0x1 + AF_MAX = 0x24 + AF_MPLS = 0x21 + AF_NATM = 0x1b + AF_NS = 0x6 + AF_OSI = 0x7 + AF_PUP = 0x4 + AF_ROUTE = 0x11 + AF_SIP = 0x1d + AF_SNA = 0xb + AF_UNIX = 0x1 + AF_UNSPEC = 0x0 + ALTWERASE = 0x200 + ARPHRD_ETHER = 0x1 + ARPHRD_FRELAY = 0xf + ARPHRD_IEEE1394 = 0x18 + ARPHRD_IEEE802 = 0x6 + B0 = 0x0 + B110 = 0x6e + B115200 = 0x1c200 + B1200 = 0x4b0 + B134 = 0x86 + B14400 = 0x3840 + B150 = 0x96 + B1800 = 0x708 + B19200 = 0x4b00 + B200 = 0xc8 + B230400 = 0x38400 + B2400 = 0x960 + B28800 = 0x7080 + B300 = 0x12c + B38400 = 0x9600 + B4800 = 0x12c0 + B50 = 0x32 + B57600 = 0xe100 + B600 = 0x258 + B7200 = 0x1c20 + B75 = 0x4b + B76800 = 0x12c00 + B9600 = 0x2580 + BIOCFLUSH = 0x20004268 + BIOCGBLEN = 0x40044266 + BIOCGDIRFILT = 0x4004427c + BIOCGDLT = 0x4004426a + BIOCGDLTLIST = 0xc010427b + BIOCGETIF = 0x4020426b + BIOCGFILDROP = 0x40044278 + BIOCGHDRCMPLT = 0x40044274 + BIOCGRSIG = 0x40044273 + BIOCGRTIMEOUT = 0x4010426e + BIOCGSTATS = 0x4008426f + BIOCIMMEDIATE = 0x80044270 + BIOCLOCK = 0x20004276 + BIOCPROMISC = 0x20004269 + BIOCSBLEN = 0xc0044266 + BIOCSDIRFILT = 0x8004427d + BIOCSDLT = 0x8004427a + BIOCSETF = 0x80104267 + BIOCSETIF = 0x8020426c + BIOCSETWF = 0x80104277 + BIOCSFILDROP = 0x80044279 + BIOCSHDRCMPLT = 0x80044275 + BIOCSRSIG = 0x80044272 + BIOCSRTIMEOUT = 0x8010426d + BIOCVERSION = 0x40044271 + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0x0 + BPF_ALIGNMENT = 0x4 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DIRECTION_IN = 0x1 + BPF_DIRECTION_OUT = 0x2 + BPF_DIV = 0x30 + BPF_FILDROP_CAPTURE = 0x1 + BPF_FILDROP_DROP = 0x2 + BPF_FILDROP_PASS = 0x0 + BPF_F_DIR_IN = 0x10 + BPF_F_DIR_MASK = 0x30 + BPF_F_DIR_OUT = 0x20 + BPF_F_DIR_SHIFT = 0x4 + BPF_F_FLOWID = 0x8 + BPF_F_PRI_MASK = 0x7 + BPF_H = 0x8 + BPF_IMM = 0x0 + BPF_IND = 0x40 + BPF_JA = 0x0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0x0 + BPF_LD = 0x0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXBUFSIZE = 0x200000 + BPF_MAXINSNS = 0x200 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINBUFSIZE = 0x20 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RELEASE = 0x30bb6 + BPF_RET = 0x6 + BPF_RND = 0xc0 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0x0 + BPF_TXA = 0x80 + BPF_W = 0x0 + BPF_X = 0x8 + BRKINT = 0x2 + CFLUSH = 0xf + CLOCAL = 0x8000 + CLOCK_BOOTTIME = 0x6 + CLOCK_MONOTONIC = 0x3 + CLOCK_PROCESS_CPUTIME_ID = 0x2 + CLOCK_REALTIME = 0x0 + CLOCK_THREAD_CPUTIME_ID = 0x4 + CLOCK_UPTIME = 0x5 + CPUSTATES = 0x6 + CP_IDLE = 0x5 + CP_INTR = 0x4 + CP_NICE = 0x1 + CP_SPIN = 0x3 + CP_SYS = 0x2 + CP_USER = 0x0 + CREAD = 0x800 + CRTSCTS = 0x10000 + CS5 = 0x0 + CS6 = 0x100 + CS7 = 0x200 + CS8 = 0x300 + CSIZE = 0x300 + CSTART = 0x11 + CSTATUS = 0xff + CSTOP = 0x13 + CSTOPB = 0x400 + CSUSP = 0x1a + CTL_HW = 0x6 + CTL_KERN = 0x1 + CTL_MAXNAME = 0xc + CTL_NET = 0x4 + DIOCADDQUEUE = 0xc110445d + DIOCADDRULE = 0xcd604404 + DIOCADDSTATE = 0xc1084425 + DIOCCHANGERULE = 0xcd60441a + DIOCCLRIFFLAG = 0xc028445a + DIOCCLRSRCNODES = 0x20004455 + DIOCCLRSTATES = 0xc0e04412 + DIOCCLRSTATUS = 0xc0284416 + DIOCGETLIMIT = 0xc0084427 + DIOCGETQSTATS = 0xc1204460 + DIOCGETQUEUE = 0xc110445f + DIOCGETQUEUES = 0xc110445e + DIOCGETRULE = 0xcd604407 + DIOCGETRULES = 0xcd604406 + DIOCGETRULESET = 0xc444443b + DIOCGETRULESETS = 0xc444443a + DIOCGETSRCNODES = 0xc0104454 + DIOCGETSTATE = 0xc1084413 + DIOCGETSTATES = 0xc0104419 + DIOCGETSTATUS = 0xc1e84415 + DIOCGETSYNFLWATS = 0xc0084463 + DIOCGETTIMEOUT = 0xc008441e + DIOCIGETIFACES = 0xc0284457 + DIOCKILLSRCNODES = 0xc080445b + DIOCKILLSTATES = 0xc0e04429 + DIOCNATLOOK = 0xc0504417 + DIOCOSFPADD = 0xc088444f + DIOCOSFPFLUSH = 0x2000444e + DIOCOSFPGET = 0xc0884450 + DIOCRADDADDRS = 0xc4504443 + DIOCRADDTABLES = 0xc450443d + DIOCRCLRADDRS = 0xc4504442 + DIOCRCLRASTATS = 0xc4504448 + DIOCRCLRTABLES = 0xc450443c + DIOCRCLRTSTATS = 0xc4504441 + DIOCRDELADDRS = 0xc4504444 + DIOCRDELTABLES = 0xc450443e + DIOCRGETADDRS = 0xc4504446 + DIOCRGETASTATS = 0xc4504447 + DIOCRGETTABLES = 0xc450443f + DIOCRGETTSTATS = 0xc4504440 + DIOCRINADEFINE = 0xc450444d + DIOCRSETADDRS = 0xc4504445 + DIOCRSETTFLAGS = 0xc450444a + DIOCRTSTADDRS = 0xc4504449 + DIOCSETDEBUG = 0xc0044418 + DIOCSETHOSTID = 0xc0044456 + DIOCSETIFFLAG = 0xc0284459 + DIOCSETLIMIT = 0xc0084428 + DIOCSETREASS = 0xc004445c + DIOCSETSTATUSIF = 0xc0284414 + DIOCSETSYNCOOKIES = 0xc0014462 + DIOCSETSYNFLWATS = 0xc0084461 + DIOCSETTIMEOUT = 0xc008441d + DIOCSTART = 0x20004401 + DIOCSTOP = 0x20004402 + DIOCXBEGIN = 0xc0104451 + DIOCXCOMMIT = 0xc0104452 + DIOCXROLLBACK = 0xc0104453 + DLT_ARCNET = 0x7 + DLT_ATM_RFC1483 = 0xb + DLT_AX25 = 0x3 + DLT_CHAOS = 0x5 + DLT_C_HDLC = 0x68 + DLT_EN10MB = 0x1 + DLT_EN3MB = 0x2 + DLT_ENC = 0xd + DLT_FDDI = 0xa + DLT_IEEE802 = 0x6 + DLT_IEEE802_11 = 0x69 + DLT_IEEE802_11_RADIO = 0x7f + DLT_LOOP = 0xc + DLT_MPLS = 0xdb + DLT_NULL = 0x0 + DLT_OPENFLOW = 0x10b + DLT_PFLOG = 0x75 + DLT_PFSYNC = 0x12 + DLT_PPP = 0x9 + DLT_PPP_BSDOS = 0x10 + DLT_PPP_ETHER = 0x33 + DLT_PPP_SERIAL = 0x32 + DLT_PRONET = 0x4 + DLT_RAW = 0xe + DLT_SLIP = 0x8 + DLT_SLIP_BSDOS = 0xf + DLT_USBPCAP = 0xf9 + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c + DT_BLK = 0x6 + DT_CHR = 0x2 + DT_DIR = 0x4 + DT_FIFO = 0x1 + DT_LNK = 0xa + DT_REG = 0x8 + DT_SOCK = 0xc + DT_UNKNOWN = 0x0 + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 + EMT_TAGOVF = 0x1 + EMUL_ENABLED = 0x1 + EMUL_NATIVE = 0x2 + ENDRUNDISC = 0x9 + ETH64_8021_RSVD_MASK = 0xfffffffffff0 + ETH64_8021_RSVD_PREFIX = 0x180c2000000 + ETHERMIN = 0x2e + ETHERMTU = 0x5dc + ETHERTYPE_8023 = 0x4 + ETHERTYPE_AARP = 0x80f3 + ETHERTYPE_ACCTON = 0x8390 + ETHERTYPE_AEONIC = 0x8036 + ETHERTYPE_ALPHA = 0x814a + ETHERTYPE_AMBER = 0x6008 + ETHERTYPE_AMOEBA = 0x8145 + ETHERTYPE_AOE = 0x88a2 + ETHERTYPE_APOLLO = 0x80f7 + ETHERTYPE_APOLLODOMAIN = 0x8019 + ETHERTYPE_APPLETALK = 0x809b + ETHERTYPE_APPLITEK = 0x80c7 + ETHERTYPE_ARGONAUT = 0x803a + ETHERTYPE_ARP = 0x806 + ETHERTYPE_AT = 0x809b + ETHERTYPE_ATALK = 0x809b + ETHERTYPE_ATOMIC = 0x86df + ETHERTYPE_ATT = 0x8069 + ETHERTYPE_ATTSTANFORD = 0x8008 + ETHERTYPE_AUTOPHON = 0x806a + ETHERTYPE_AXIS = 0x8856 + ETHERTYPE_BCLOOP = 0x9003 + ETHERTYPE_BOFL = 0x8102 + ETHERTYPE_CABLETRON = 0x7034 + ETHERTYPE_CHAOS = 0x804 + ETHERTYPE_COMDESIGN = 0x806c + ETHERTYPE_COMPUGRAPHIC = 0x806d + ETHERTYPE_COUNTERPOINT = 0x8062 + ETHERTYPE_CRONUS = 0x8004 + ETHERTYPE_CRONUSVLN = 0x8003 + ETHERTYPE_DCA = 0x1234 + ETHERTYPE_DDE = 0x807b + ETHERTYPE_DEBNI = 0xaaaa + ETHERTYPE_DECAM = 0x8048 + ETHERTYPE_DECCUST = 0x6006 + ETHERTYPE_DECDIAG = 0x6005 + ETHERTYPE_DECDNS = 0x803c + ETHERTYPE_DECDTS = 0x803e + ETHERTYPE_DECEXPER = 0x6000 + ETHERTYPE_DECLAST = 0x8041 + ETHERTYPE_DECLTM = 0x803f + ETHERTYPE_DECMUMPS = 0x6009 + ETHERTYPE_DECNETBIOS = 0x8040 + ETHERTYPE_DELTACON = 0x86de + ETHERTYPE_DIDDLE = 0x4321 + ETHERTYPE_DLOG1 = 0x660 + ETHERTYPE_DLOG2 = 0x661 + ETHERTYPE_DN = 0x6003 + ETHERTYPE_DOGFIGHT = 0x1989 + ETHERTYPE_DSMD = 0x8039 + ETHERTYPE_EAPOL = 0x888e + ETHERTYPE_ECMA = 0x803 + ETHERTYPE_ENCRYPT = 0x803d + ETHERTYPE_ES = 0x805d + ETHERTYPE_EXCELAN = 0x8010 + ETHERTYPE_EXPERDATA = 0x8049 + ETHERTYPE_FLIP = 0x8146 + ETHERTYPE_FLOWCONTROL = 0x8808 + ETHERTYPE_FRARP = 0x808 + ETHERTYPE_GENDYN = 0x8068 + ETHERTYPE_HAYES = 0x8130 + ETHERTYPE_HIPPI_FP = 0x8180 + ETHERTYPE_HITACHI = 0x8820 + ETHERTYPE_HP = 0x8005 + ETHERTYPE_IEEEPUP = 0xa00 + ETHERTYPE_IEEEPUPAT = 0xa01 + ETHERTYPE_IMLBL = 0x4c42 + ETHERTYPE_IMLBLDIAG = 0x424c + ETHERTYPE_IP = 0x800 + ETHERTYPE_IPAS = 0x876c + ETHERTYPE_IPV6 = 0x86dd + ETHERTYPE_IPX = 0x8137 + ETHERTYPE_IPXNEW = 0x8037 + ETHERTYPE_KALPANA = 0x8582 + ETHERTYPE_LANBRIDGE = 0x8038 + ETHERTYPE_LANPROBE = 0x8888 + ETHERTYPE_LAT = 0x6004 + ETHERTYPE_LBACK = 0x9000 + ETHERTYPE_LITTLE = 0x8060 + ETHERTYPE_LLDP = 0x88cc + ETHERTYPE_LOGICRAFT = 0x8148 + ETHERTYPE_LOOPBACK = 0x9000 + ETHERTYPE_MACSEC = 0x88e5 + ETHERTYPE_MATRA = 0x807a + ETHERTYPE_MAX = 0xffff + ETHERTYPE_MERIT = 0x807c + ETHERTYPE_MICP = 0x873a + ETHERTYPE_MOPDL = 0x6001 + ETHERTYPE_MOPRC = 0x6002 + ETHERTYPE_MOTOROLA = 0x818d + ETHERTYPE_MPLS = 0x8847 + ETHERTYPE_MPLS_MCAST = 0x8848 + ETHERTYPE_MUMPS = 0x813f + ETHERTYPE_NBPCC = 0x3c04 + ETHERTYPE_NBPCLAIM = 0x3c09 + ETHERTYPE_NBPCLREQ = 0x3c05 + ETHERTYPE_NBPCLRSP = 0x3c06 + ETHERTYPE_NBPCREQ = 0x3c02 + ETHERTYPE_NBPCRSP = 0x3c03 + ETHERTYPE_NBPDG = 0x3c07 + ETHERTYPE_NBPDGB = 0x3c08 + ETHERTYPE_NBPDLTE = 0x3c0a + ETHERTYPE_NBPRAR = 0x3c0c + ETHERTYPE_NBPRAS = 0x3c0b + ETHERTYPE_NBPRST = 0x3c0d + ETHERTYPE_NBPSCD = 0x3c01 + ETHERTYPE_NBPVCD = 0x3c00 + ETHERTYPE_NBS = 0x802 + ETHERTYPE_NCD = 0x8149 + ETHERTYPE_NESTAR = 0x8006 + ETHERTYPE_NETBEUI = 0x8191 + ETHERTYPE_NHRP = 0x2001 + ETHERTYPE_NOVELL = 0x8138 + ETHERTYPE_NS = 0x600 + ETHERTYPE_NSAT = 0x601 + ETHERTYPE_NSCOMPAT = 0x807 + ETHERTYPE_NSH = 0x984f + ETHERTYPE_NTRAILER = 0x10 + ETHERTYPE_OS9 = 0x7007 + ETHERTYPE_OS9NET = 0x7009 + ETHERTYPE_PACER = 0x80c6 + ETHERTYPE_PBB = 0x88e7 + ETHERTYPE_PCS = 0x4242 + ETHERTYPE_PLANNING = 0x8044 + ETHERTYPE_PPP = 0x880b + ETHERTYPE_PPPOE = 0x8864 + ETHERTYPE_PPPOEDISC = 0x8863 + ETHERTYPE_PRIMENTS = 0x7031 + ETHERTYPE_PUP = 0x200 + ETHERTYPE_PUPAT = 0x200 + ETHERTYPE_QINQ = 0x88a8 + ETHERTYPE_RACAL = 0x7030 + ETHERTYPE_RATIONAL = 0x8150 + ETHERTYPE_RAWFR = 0x6559 + ETHERTYPE_RCL = 0x1995 + ETHERTYPE_RDP = 0x8739 + ETHERTYPE_RETIX = 0x80f2 + ETHERTYPE_REVARP = 0x8035 + ETHERTYPE_SCA = 0x6007 + ETHERTYPE_SECTRA = 0x86db + ETHERTYPE_SECUREDATA = 0x876d + ETHERTYPE_SGITW = 0x817e + ETHERTYPE_SG_BOUNCE = 0x8016 + ETHERTYPE_SG_DIAG = 0x8013 + ETHERTYPE_SG_NETGAMES = 0x8014 + ETHERTYPE_SG_RESV = 0x8015 + ETHERTYPE_SIMNET = 0x5208 + ETHERTYPE_SLOW = 0x8809 + ETHERTYPE_SNA = 0x80d5 + ETHERTYPE_SNMP = 0x814c + ETHERTYPE_SONIX = 0xfaf5 + ETHERTYPE_SPIDER = 0x809f + ETHERTYPE_SPRITE = 0x500 + ETHERTYPE_STP = 0x8181 + ETHERTYPE_TALARIS = 0x812b + ETHERTYPE_TALARISMC = 0x852b + ETHERTYPE_TCPCOMP = 0x876b + ETHERTYPE_TCPSM = 0x9002 + ETHERTYPE_TEC = 0x814f + ETHERTYPE_TIGAN = 0x802f + ETHERTYPE_TRAIL = 0x1000 + ETHERTYPE_TRANSETHER = 0x6558 + ETHERTYPE_TYMSHARE = 0x802e + ETHERTYPE_UBBST = 0x7005 + ETHERTYPE_UBDEBUG = 0x900 + ETHERTYPE_UBDIAGLOOP = 0x7002 + ETHERTYPE_UBDL = 0x7000 + ETHERTYPE_UBNIU = 0x7001 + ETHERTYPE_UBNMC = 0x7003 + ETHERTYPE_VALID = 0x1600 + ETHERTYPE_VARIAN = 0x80dd + ETHERTYPE_VAXELN = 0x803b + ETHERTYPE_VEECO = 0x8067 + ETHERTYPE_VEXP = 0x805b + ETHERTYPE_VGLAB = 0x8131 + ETHERTYPE_VINES = 0xbad + ETHERTYPE_VINESECHO = 0xbaf + ETHERTYPE_VINESLOOP = 0xbae + ETHERTYPE_VITAL = 0xff00 + ETHERTYPE_VLAN = 0x8100 + ETHERTYPE_VLTLMAN = 0x8080 + ETHERTYPE_VPROD = 0x805c + ETHERTYPE_VURESERVED = 0x8147 + ETHERTYPE_WATERLOO = 0x8130 + ETHERTYPE_WELLFLEET = 0x8103 + ETHERTYPE_X25 = 0x805 + ETHERTYPE_X75 = 0x801 + ETHERTYPE_XNSSM = 0x9001 + ETHERTYPE_XTP = 0x817d + ETHER_ADDR_LEN = 0x6 + ETHER_ALIGN = 0x2 + ETHER_CRC_LEN = 0x4 + ETHER_CRC_POLY_BE = 0x4c11db6 + ETHER_CRC_POLY_LE = 0xedb88320 + ETHER_HDR_LEN = 0xe + ETHER_MAX_DIX_LEN = 0x600 + ETHER_MAX_HARDMTU_LEN = 0xff9b + ETHER_MAX_LEN = 0x5ee + ETHER_MIN_LEN = 0x40 + ETHER_TYPE_LEN = 0x2 + ETHER_VLAN_ENCAP_LEN = 0x4 + EVFILT_AIO = -0x3 + EVFILT_DEVICE = -0x8 + EVFILT_EXCEPT = -0x9 + EVFILT_PROC = -0x5 + EVFILT_READ = -0x1 + EVFILT_SIGNAL = -0x6 + EVFILT_SYSCOUNT = 0x9 + EVFILT_TIMER = -0x7 + EVFILT_VNODE = -0x4 + EVFILT_WRITE = -0x2 + EVL_ENCAPLEN = 0x4 + EVL_PRIO_BITS = 0xd + EVL_PRIO_MAX = 0x7 + EVL_VLID_MASK = 0xfff + EVL_VLID_MAX = 0xffe + EVL_VLID_MIN = 0x1 + EVL_VLID_NULL = 0x0 + EV_ADD = 0x1 + EV_CLEAR = 0x20 + EV_DELETE = 0x2 + EV_DISABLE = 0x8 + EV_DISPATCH = 0x80 + EV_ENABLE = 0x4 + EV_EOF = 0x8000 + EV_ERROR = 0x4000 + EV_FLAG1 = 0x2000 + EV_ONESHOT = 0x10 + EV_RECEIPT = 0x40 + EV_SYSFLAGS = 0xf800 + EXTA = 0x4b00 + EXTB = 0x9600 + EXTPROC = 0x800 + FD_CLOEXEC = 0x1 + FD_SETSIZE = 0x400 + FLUSHO = 0x800000 + F_DUPFD = 0x0 + F_DUPFD_CLOEXEC = 0xa + F_GETFD = 0x1 + F_GETFL = 0x3 + F_GETLK = 0x7 + F_GETOWN = 0x5 + F_ISATTY = 0xb + F_OK = 0x0 + F_RDLCK = 0x1 + F_SETFD = 0x2 + F_SETFL = 0x4 + F_SETLK = 0x8 + F_SETLKW = 0x9 + F_SETOWN = 0x6 + F_UNLCK = 0x2 + F_WRLCK = 0x3 + HUPCL = 0x4000 + HW_MACHINE = 0x1 + ICANON = 0x100 + ICMP6_FILTER = 0x12 + ICRNL = 0x100 + IEXTEN = 0x400 + IFAN_ARRIVAL = 0x0 + IFAN_DEPARTURE = 0x1 + IFF_ALLMULTI = 0x200 + IFF_BROADCAST = 0x2 + IFF_CANTCHANGE = 0x8e52 + IFF_DEBUG = 0x4 + IFF_LINK0 = 0x1000 + IFF_LINK1 = 0x2000 + IFF_LINK2 = 0x4000 + IFF_LOOPBACK = 0x8 + IFF_MULTICAST = 0x8000 + IFF_NOARP = 0x80 + IFF_OACTIVE = 0x400 + IFF_POINTOPOINT = 0x10 + IFF_PROMISC = 0x100 + IFF_RUNNING = 0x40 + IFF_SIMPLEX = 0x800 + IFF_STATICARP = 0x20 + IFF_UP = 0x1 + IFNAMSIZ = 0x10 + IFT_1822 = 0x2 + IFT_A12MPPSWITCH = 0x82 + IFT_AAL2 = 0xbb + IFT_AAL5 = 0x31 + IFT_ADSL = 0x5e + IFT_AFLANE8023 = 0x3b + IFT_AFLANE8025 = 0x3c + IFT_ARAP = 0x58 + IFT_ARCNET = 0x23 + IFT_ARCNETPLUS = 0x24 + IFT_ASYNC = 0x54 + IFT_ATM = 0x25 + IFT_ATMDXI = 0x69 + IFT_ATMFUNI = 0x6a + IFT_ATMIMA = 0x6b + IFT_ATMLOGICAL = 0x50 + IFT_ATMRADIO = 0xbd + IFT_ATMSUBINTERFACE = 0x86 + IFT_ATMVCIENDPT = 0xc2 + IFT_ATMVIRTUAL = 0x95 + IFT_BGPPOLICYACCOUNTING = 0xa2 + IFT_BLUETOOTH = 0xf8 + IFT_BRIDGE = 0xd1 + IFT_BSC = 0x53 + IFT_CARP = 0xf7 + IFT_CCTEMUL = 0x3d + IFT_CEPT = 0x13 + IFT_CES = 0x85 + IFT_CHANNEL = 0x46 + IFT_CNR = 0x55 + IFT_COFFEE = 0x84 + IFT_COMPOSITELINK = 0x9b + IFT_DCN = 0x8d + IFT_DIGITALPOWERLINE = 0x8a + IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba + IFT_DLSW = 0x4a + IFT_DOCSCABLEDOWNSTREAM = 0x80 + IFT_DOCSCABLEMACLAYER = 0x7f + IFT_DOCSCABLEUPSTREAM = 0x81 + IFT_DOCSCABLEUPSTREAMCHANNEL = 0xcd + IFT_DS0 = 0x51 + IFT_DS0BUNDLE = 0x52 + IFT_DS1FDL = 0xaa + IFT_DS3 = 0x1e + IFT_DTM = 0x8c + IFT_DUMMY = 0xf1 + IFT_DVBASILN = 0xac + IFT_DVBASIOUT = 0xad + IFT_DVBRCCDOWNSTREAM = 0x93 + IFT_DVBRCCMACLAYER = 0x92 + IFT_DVBRCCUPSTREAM = 0x94 + IFT_ECONET = 0xce + IFT_ENC = 0xf4 + IFT_EON = 0x19 + IFT_EPLRS = 0x57 + IFT_ESCON = 0x49 + IFT_ETHER = 0x6 + IFT_FAITH = 0xf3 + IFT_FAST = 0x7d + IFT_FASTETHER = 0x3e + IFT_FASTETHERFX = 0x45 + IFT_FDDI = 0xf + IFT_FIBRECHANNEL = 0x38 + IFT_FRAMERELAYINTERCONNECT = 0x3a + IFT_FRAMERELAYMPI = 0x5c + IFT_FRDLCIENDPT = 0xc1 + IFT_FRELAY = 0x20 + IFT_FRELAYDCE = 0x2c + IFT_FRF16MFRBUNDLE = 0xa3 + IFT_FRFORWARD = 0x9e + IFT_G703AT2MB = 0x43 + IFT_G703AT64K = 0x42 + IFT_GIF = 0xf0 + IFT_GIGABITETHERNET = 0x75 + IFT_GR303IDT = 0xb2 + IFT_GR303RDT = 0xb1 + IFT_H323GATEKEEPER = 0xa4 + IFT_H323PROXY = 0xa5 + IFT_HDH1822 = 0x3 + IFT_HDLC = 0x76 + IFT_HDSL2 = 0xa8 + IFT_HIPERLAN2 = 0xb7 + IFT_HIPPI = 0x2f + IFT_HIPPIINTERFACE = 0x39 + IFT_HOSTPAD = 0x5a + IFT_HSSI = 0x2e + IFT_HY = 0xe + IFT_IBM370PARCHAN = 0x48 + IFT_IDSL = 0x9a + IFT_IEEE1394 = 0x90 + IFT_IEEE80211 = 0x47 + IFT_IEEE80212 = 0x37 + IFT_IEEE8023ADLAG = 0xa1 + IFT_IFGSN = 0x91 + IFT_IMT = 0xbe + IFT_INFINIBAND = 0xc7 + IFT_INTERLEAVE = 0x7c + IFT_IP = 0x7e + IFT_IPFORWARD = 0x8e + IFT_IPOVERATM = 0x72 + IFT_IPOVERCDLC = 0x6d + IFT_IPOVERCLAW = 0x6e + IFT_IPSWITCH = 0x4e + IFT_ISDN = 0x3f + IFT_ISDNBASIC = 0x14 + IFT_ISDNPRIMARY = 0x15 + IFT_ISDNS = 0x4b + IFT_ISDNU = 0x4c + IFT_ISO88022LLC = 0x29 + IFT_ISO88023 = 0x7 + IFT_ISO88024 = 0x8 + IFT_ISO88025 = 0x9 + IFT_ISO88025CRFPINT = 0x62 + IFT_ISO88025DTR = 0x56 + IFT_ISO88025FIBER = 0x73 + IFT_ISO88026 = 0xa + IFT_ISUP = 0xb3 + IFT_L2VLAN = 0x87 + IFT_L3IPVLAN = 0x88 + IFT_L3IPXVLAN = 0x89 + IFT_LAPB = 0x10 + IFT_LAPD = 0x4d + IFT_LAPF = 0x77 + IFT_LINEGROUP = 0xd2 + IFT_LOCALTALK = 0x2a + IFT_LOOP = 0x18 + IFT_MBIM = 0xfa + IFT_MEDIAMAILOVERIP = 0x8b + IFT_MFSIGLINK = 0xa7 + IFT_MIOX25 = 0x26 + IFT_MODEM = 0x30 + IFT_MPC = 0x71 + IFT_MPLS = 0xa6 + IFT_MPLSTUNNEL = 0x96 + IFT_MSDSL = 0x8f + IFT_MVL = 0xbf + IFT_MYRINET = 0x63 + IFT_NFAS = 0xaf + IFT_NSIP = 0x1b + IFT_OPTICALCHANNEL = 0xc3 + IFT_OPTICALTRANSPORT = 0xc4 + IFT_OTHER = 0x1 + IFT_P10 = 0xc + IFT_P80 = 0xd + IFT_PARA = 0x22 + IFT_PFLOG = 0xf5 + IFT_PFLOW = 0xf9 + IFT_PFSYNC = 0xf6 + IFT_PLC = 0xae + IFT_PON155 = 0xcf + IFT_PON622 = 0xd0 + IFT_POS = 0xab + IFT_PPP = 0x17 + IFT_PPPMULTILINKBUNDLE = 0x6c + IFT_PROPATM = 0xc5 + IFT_PROPBWAP2MP = 0xb8 + IFT_PROPCNLS = 0x59 + IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 + IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 + IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 + IFT_PROPMUX = 0x36 + IFT_PROPVIRTUAL = 0x35 + IFT_PROPWIRELESSP2P = 0x9d + IFT_PTPSERIAL = 0x16 + IFT_PVC = 0xf2 + IFT_Q2931 = 0xc9 + IFT_QLLC = 0x44 + IFT_RADIOMAC = 0xbc + IFT_RADSL = 0x5f + IFT_REACHDSL = 0xc0 + IFT_RFC1483 = 0x9f + IFT_RS232 = 0x21 + IFT_RSRB = 0x4f + IFT_SDLC = 0x11 + IFT_SDSL = 0x60 + IFT_SHDSL = 0xa9 + IFT_SIP = 0x1f + IFT_SIPSIG = 0xcc + IFT_SIPTG = 0xcb + IFT_SLIP = 0x1c + IFT_SMDSDXI = 0x2b + IFT_SMDSICIP = 0x34 + IFT_SONET = 0x27 + IFT_SONETOVERHEADCHANNEL = 0xb9 + IFT_SONETPATH = 0x32 + IFT_SONETVT = 0x33 + IFT_SRP = 0x97 + IFT_SS7SIGLINK = 0x9c + IFT_STACKTOSTACK = 0x6f + IFT_STARLAN = 0xb + IFT_T1 = 0x12 + IFT_TDLC = 0x74 + IFT_TELINK = 0xc8 + IFT_TERMPAD = 0x5b + IFT_TR008 = 0xb0 + IFT_TRANSPHDLC = 0x7b + IFT_TUNNEL = 0x83 + IFT_ULTRA = 0x1d + IFT_USB = 0xa0 + IFT_V11 = 0x40 + IFT_V35 = 0x2d + IFT_V36 = 0x41 + IFT_V37 = 0x78 + IFT_VDSL = 0x61 + IFT_VIRTUALIPADDRESS = 0x70 + IFT_VIRTUALTG = 0xca + IFT_VOICEDID = 0xd5 + IFT_VOICEEM = 0x64 + IFT_VOICEEMFGD = 0xd3 + IFT_VOICEENCAP = 0x67 + IFT_VOICEFGDEANA = 0xd4 + IFT_VOICEFXO = 0x65 + IFT_VOICEFXS = 0x66 + IFT_VOICEOVERATM = 0x98 + IFT_VOICEOVERCABLE = 0xc6 + IFT_VOICEOVERFRAMERELAY = 0x99 + IFT_VOICEOVERIP = 0x68 + IFT_WIREGUARD = 0xfb + IFT_X213 = 0x5d + IFT_X25 = 0x5 + IFT_X25DDN = 0x4 + IFT_X25HUNTGROUP = 0x7a + IFT_X25MLP = 0x79 + IFT_X25PLE = 0x28 + IFT_XETHER = 0x1a + IGNBRK = 0x1 + IGNCR = 0x80 + IGNPAR = 0x4 + IMAXBEL = 0x2000 + INLCR = 0x40 + INPCK = 0x10 + IN_CLASSA_HOST = 0xffffff + IN_CLASSA_MAX = 0x80 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 0x18 + IN_CLASSB_HOST = 0xffff + IN_CLASSB_MAX = 0x10000 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 0x10 + IN_CLASSC_HOST = 0xff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 0x8 + IN_CLASSD_HOST = 0xfffffff + IN_CLASSD_NET = 0xf0000000 + IN_CLASSD_NSHIFT = 0x1c + IN_LOOPBACKNET = 0x7f + IN_RFC3021_HOST = 0x1 + IN_RFC3021_NET = 0xfffffffe + IN_RFC3021_NSHIFT = 0x1f + IPPROTO_AH = 0x33 + IPPROTO_CARP = 0x70 + IPPROTO_DIVERT = 0x102 + IPPROTO_DONE = 0x101 + IPPROTO_DSTOPTS = 0x3c + IPPROTO_EGP = 0x8 + IPPROTO_ENCAP = 0x62 + IPPROTO_EON = 0x50 + IPPROTO_ESP = 0x32 + IPPROTO_ETHERIP = 0x61 + IPPROTO_FRAGMENT = 0x2c + IPPROTO_GGP = 0x3 + IPPROTO_GRE = 0x2f + IPPROTO_HOPOPTS = 0x0 + IPPROTO_ICMP = 0x1 + IPPROTO_ICMPV6 = 0x3a + IPPROTO_IDP = 0x16 + IPPROTO_IGMP = 0x2 + IPPROTO_IP = 0x0 + IPPROTO_IPCOMP = 0x6c + IPPROTO_IPIP = 0x4 + IPPROTO_IPV4 = 0x4 + IPPROTO_IPV6 = 0x29 + IPPROTO_MAX = 0x100 + IPPROTO_MAXID = 0x103 + IPPROTO_MOBILE = 0x37 + IPPROTO_MPLS = 0x89 + IPPROTO_NONE = 0x3b + IPPROTO_PFSYNC = 0xf0 + IPPROTO_PIM = 0x67 + IPPROTO_PUP = 0xc + IPPROTO_RAW = 0xff + IPPROTO_ROUTING = 0x2b + IPPROTO_RSVP = 0x2e + IPPROTO_SCTP = 0x84 + IPPROTO_TCP = 0x6 + IPPROTO_TP = 0x1d + IPPROTO_UDP = 0x11 + IPPROTO_UDPLITE = 0x88 + IPV6_AUTH_LEVEL = 0x35 + IPV6_AUTOFLOWLABEL = 0x3b + IPV6_CHECKSUM = 0x1a + IPV6_DEFAULT_MULTICAST_HOPS = 0x1 + IPV6_DEFAULT_MULTICAST_LOOP = 0x1 + IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 + IPV6_ESP_NETWORK_LEVEL = 0x37 + IPV6_ESP_TRANS_LEVEL = 0x36 + IPV6_FAITH = 0x1d + IPV6_FLOWINFO_MASK = 0xffffff0f + IPV6_FLOWLABEL_MASK = 0xffff0f00 + IPV6_FRAGTTL = 0x78 + IPV6_HLIMDEC = 0x1 + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 + IPV6_IPCOMP_LEVEL = 0x3c + IPV6_JOIN_GROUP = 0xc + IPV6_LEAVE_GROUP = 0xd + IPV6_MAXHLIM = 0xff + IPV6_MAXPACKET = 0xffff + IPV6_MINHOPCOUNT = 0x41 + IPV6_MMTU = 0x500 + IPV6_MULTICAST_HOPS = 0xa + IPV6_MULTICAST_IF = 0x9 + IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_OPTIONS = 0x1 + IPV6_PATHMTU = 0x2c + IPV6_PIPEX = 0x3f + IPV6_PKTINFO = 0x2e + IPV6_PORTRANGE = 0xe + IPV6_PORTRANGE_DEFAULT = 0x0 + IPV6_PORTRANGE_HIGH = 0x1 + IPV6_PORTRANGE_LOW = 0x2 + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVDSTPORT = 0x40 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x24 + IPV6_RECVRTHDR = 0x26 + IPV6_RECVTCLASS = 0x39 + IPV6_RTABLE = 0x1021 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x23 + IPV6_RTHDR_LOOSE = 0x0 + IPV6_RTHDR_STRICT = 0x1 + IPV6_RTHDR_TYPE_0 = 0x0 + IPV6_SOCKOPT_RESERVED1 = 0x3 + IPV6_TCLASS = 0x3d + IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a + IPV6_V6ONLY = 0x1b + IPV6_VERSION = 0x60 + IPV6_VERSION_MASK = 0xf0 + IP_ADD_MEMBERSHIP = 0xc + IP_AUTH_LEVEL = 0x14 + IP_DEFAULT_MULTICAST_LOOP = 0x1 + IP_DEFAULT_MULTICAST_TTL = 0x1 + IP_DF = 0x4000 + IP_DROP_MEMBERSHIP = 0xd + IP_ESP_NETWORK_LEVEL = 0x16 + IP_ESP_TRANS_LEVEL = 0x15 + IP_HDRINCL = 0x2 + IP_IPCOMP_LEVEL = 0x1d + IP_IPDEFTTL = 0x25 + IP_IPSECFLOWINFO = 0x24 + IP_IPSEC_LOCAL_AUTH = 0x1b + IP_IPSEC_LOCAL_CRED = 0x19 + IP_IPSEC_LOCAL_ID = 0x17 + IP_IPSEC_REMOTE_AUTH = 0x1c + IP_IPSEC_REMOTE_CRED = 0x1a + IP_IPSEC_REMOTE_ID = 0x18 + IP_MAXPACKET = 0xffff + IP_MAX_MEMBERSHIPS = 0xfff + IP_MF = 0x2000 + IP_MINTTL = 0x20 + IP_MIN_MEMBERSHIPS = 0xf + IP_MSS = 0x240 + IP_MULTICAST_IF = 0x9 + IP_MULTICAST_LOOP = 0xb + IP_MULTICAST_TTL = 0xa + IP_OFFMASK = 0x1fff + IP_OPTIONS = 0x1 + IP_PIPEX = 0x22 + IP_PORTRANGE = 0x13 + IP_PORTRANGE_DEFAULT = 0x0 + IP_PORTRANGE_HIGH = 0x1 + IP_PORTRANGE_LOW = 0x2 + IP_RECVDSTADDR = 0x7 + IP_RECVDSTPORT = 0x21 + IP_RECVIF = 0x1e + IP_RECVOPTS = 0x5 + IP_RECVRETOPTS = 0x6 + IP_RECVRTABLE = 0x23 + IP_RECVTTL = 0x1f + IP_RETOPTS = 0x8 + IP_RF = 0x8000 + IP_RTABLE = 0x1021 + IP_SENDSRCADDR = 0x7 + IP_TOS = 0x3 + IP_TTL = 0x4 + ISIG = 0x80 + ISTRIP = 0x20 + ITIMER_PROF = 0x2 + ITIMER_REAL = 0x0 + ITIMER_VIRTUAL = 0x1 + IUCLC = 0x1000 + IXANY = 0x800 + IXOFF = 0x400 + IXON = 0x200 + KERN_HOSTNAME = 0xa + KERN_OSRELEASE = 0x2 + KERN_OSTYPE = 0x1 + KERN_VERSION = 0x4 + LCNT_OVERLOAD_FLUSH = 0x6 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_SH = 0x1 + LOCK_UN = 0x8 + MADV_DONTNEED = 0x4 + MADV_FREE = 0x6 + MADV_NORMAL = 0x0 + MADV_RANDOM = 0x1 + MADV_SEQUENTIAL = 0x2 + MADV_SPACEAVAIL = 0x5 + MADV_WILLNEED = 0x3 + MAP_ANON = 0x1000 + MAP_ANONYMOUS = 0x1000 + MAP_CONCEAL = 0x8000 + MAP_COPY = 0x2 + MAP_FILE = 0x0 + MAP_FIXED = 0x10 + MAP_FLAGMASK = 0xfff7 + MAP_HASSEMAPHORE = 0x0 + MAP_INHERIT = 0x0 + MAP_INHERIT_COPY = 0x1 + MAP_INHERIT_NONE = 0x2 + MAP_INHERIT_SHARE = 0x0 + MAP_INHERIT_ZERO = 0x3 + MAP_NOEXTEND = 0x0 + MAP_NORESERVE = 0x0 + MAP_PRIVATE = 0x2 + MAP_RENAME = 0x0 + MAP_SHARED = 0x1 + MAP_STACK = 0x4000 + MAP_TRYFIXED = 0x0 + MCL_CURRENT = 0x1 + MCL_FUTURE = 0x2 + MNT_ASYNC = 0x40 + MNT_DEFEXPORTED = 0x200 + MNT_DELEXPORT = 0x20000 + MNT_DOOMED = 0x8000000 + MNT_EXPORTANON = 0x400 + MNT_EXPORTED = 0x100 + MNT_EXRDONLY = 0x80 + MNT_FORCE = 0x80000 + MNT_LAZY = 0x3 + MNT_LOCAL = 0x1000 + MNT_NOATIME = 0x8000 + MNT_NODEV = 0x10 + MNT_NOEXEC = 0x4 + MNT_NOPERM = 0x20 + MNT_NOSUID = 0x8 + MNT_NOWAIT = 0x2 + MNT_QUOTA = 0x2000 + MNT_RDONLY = 0x1 + MNT_RELOAD = 0x40000 + MNT_ROOTFS = 0x4000 + MNT_SOFTDEP = 0x4000000 + MNT_STALLED = 0x100000 + MNT_SWAPPABLE = 0x200000 + MNT_SYNCHRONOUS = 0x2 + MNT_UPDATE = 0x10000 + MNT_VISFLAGMASK = 0x400ffff + MNT_WAIT = 0x1 + MNT_WANTRDWR = 0x2000000 + MNT_WXALLOWED = 0x800 + MOUNT_AFS = "afs" + MOUNT_CD9660 = "cd9660" + MOUNT_EXT2FS = "ext2fs" + MOUNT_FFS = "ffs" + MOUNT_FUSEFS = "fuse" + MOUNT_MFS = "mfs" + MOUNT_MSDOS = "msdos" + MOUNT_NCPFS = "ncpfs" + MOUNT_NFS = "nfs" + MOUNT_NTFS = "ntfs" + MOUNT_TMPFS = "tmpfs" + MOUNT_UDF = "udf" + MOUNT_UFS = "ffs" + MSG_BCAST = 0x100 + MSG_CMSG_CLOEXEC = 0x800 + MSG_CTRUNC = 0x20 + MSG_DONTROUTE = 0x4 + MSG_DONTWAIT = 0x80 + MSG_EOR = 0x8 + MSG_MCAST = 0x200 + MSG_NOSIGNAL = 0x400 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_TRUNC = 0x10 + MSG_WAITALL = 0x40 + MS_ASYNC = 0x1 + MS_INVALIDATE = 0x4 + MS_SYNC = 0x2 + NAME_MAX = 0xff + NET_RT_DUMP = 0x1 + NET_RT_FLAGS = 0x2 + NET_RT_IFLIST = 0x3 + NET_RT_IFNAMES = 0x6 + NET_RT_MAXID = 0x8 + NET_RT_SOURCE = 0x7 + NET_RT_STATS = 0x4 + NET_RT_TABLE = 0x5 + NFDBITS = 0x20 + NOFLSH = 0x80000000 + NOKERNINFO = 0x2000000 + NOTE_ATTRIB = 0x8 + NOTE_CHANGE = 0x1 + NOTE_CHILD = 0x4 + NOTE_DELETE = 0x1 + NOTE_EOF = 0x2 + NOTE_EXEC = 0x20000000 + NOTE_EXIT = 0x80000000 + NOTE_EXTEND = 0x4 + NOTE_FORK = 0x40000000 + NOTE_LINK = 0x10 + NOTE_LOWAT = 0x1 + NOTE_OOB = 0x4 + NOTE_PCTRLMASK = 0xf0000000 + NOTE_PDATAMASK = 0xfffff + NOTE_RENAME = 0x20 + NOTE_REVOKE = 0x40 + NOTE_TRACK = 0x1 + NOTE_TRACKERR = 0x2 + NOTE_TRUNCATE = 0x80 + NOTE_WRITE = 0x2 + OCRNL = 0x10 + OLCUC = 0x20 + ONLCR = 0x2 + ONLRET = 0x80 + ONOCR = 0x40 + ONOEOT = 0x8 + OPOST = 0x1 + OXTABS = 0x4 + O_ACCMODE = 0x3 + O_APPEND = 0x8 + O_ASYNC = 0x40 + O_CLOEXEC = 0x10000 + O_CREAT = 0x200 + O_DIRECTORY = 0x20000 + O_DSYNC = 0x80 + O_EXCL = 0x800 + O_EXLOCK = 0x20 + O_FSYNC = 0x80 + O_NDELAY = 0x4 + O_NOCTTY = 0x8000 + O_NOFOLLOW = 0x100 + O_NONBLOCK = 0x4 + O_RDONLY = 0x0 + O_RDWR = 0x2 + O_RSYNC = 0x80 + O_SHLOCK = 0x10 + O_SYNC = 0x80 + O_TRUNC = 0x400 + O_WRONLY = 0x1 + PARENB = 0x1000 + PARMRK = 0x8 + PARODD = 0x2000 + PENDIN = 0x20000000 + PF_FLUSH = 0x1 + PRIO_PGRP = 0x1 + PRIO_PROCESS = 0x0 + PRIO_USER = 0x2 + PROT_EXEC = 0x4 + PROT_NONE = 0x0 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + RLIMIT_CORE = 0x4 + RLIMIT_CPU = 0x0 + RLIMIT_DATA = 0x2 + RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 + RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 + RLIMIT_STACK = 0x3 + RLIM_INFINITY = 0x7fffffffffffffff + RTAX_AUTHOR = 0x6 + RTAX_BFD = 0xb + RTAX_BRD = 0x7 + RTAX_DNS = 0xc + RTAX_DST = 0x0 + RTAX_GATEWAY = 0x1 + RTAX_GENMASK = 0x3 + RTAX_IFA = 0x5 + RTAX_IFP = 0x4 + RTAX_LABEL = 0xa + RTAX_MAX = 0xf + RTAX_NETMASK = 0x2 + RTAX_SEARCH = 0xe + RTAX_SRC = 0x8 + RTAX_SRCMASK = 0x9 + RTAX_STATIC = 0xd + RTA_AUTHOR = 0x40 + RTA_BFD = 0x800 + RTA_BRD = 0x80 + RTA_DNS = 0x1000 + RTA_DST = 0x1 + RTA_GATEWAY = 0x2 + RTA_GENMASK = 0x8 + RTA_IFA = 0x20 + RTA_IFP = 0x10 + RTA_LABEL = 0x400 + RTA_NETMASK = 0x4 + RTA_SEARCH = 0x4000 + RTA_SRC = 0x100 + RTA_SRCMASK = 0x200 + RTA_STATIC = 0x2000 + RTF_ANNOUNCE = 0x4000 + RTF_BFD = 0x1000000 + RTF_BLACKHOLE = 0x1000 + RTF_BROADCAST = 0x400000 + RTF_CACHED = 0x20000 + RTF_CLONED = 0x10000 + RTF_CLONING = 0x100 + RTF_CONNECTED = 0x800000 + RTF_DONE = 0x40 + RTF_DYNAMIC = 0x10 + RTF_FMASK = 0x110fc08 + RTF_GATEWAY = 0x2 + RTF_HOST = 0x4 + RTF_LLINFO = 0x400 + RTF_LOCAL = 0x200000 + RTF_MODIFIED = 0x20 + RTF_MPATH = 0x40000 + RTF_MPLS = 0x100000 + RTF_MULTICAST = 0x200 + RTF_PERMANENT_ARP = 0x2000 + RTF_PROTO1 = 0x8000 + RTF_PROTO2 = 0x4000 + RTF_PROTO3 = 0x2000 + RTF_REJECT = 0x8 + RTF_STATIC = 0x800 + RTF_UP = 0x1 + RTF_USETRAILERS = 0x8000 + RTM_80211INFO = 0x15 + RTM_ADD = 0x1 + RTM_BFD = 0x12 + RTM_CHANGE = 0x3 + RTM_CHGADDRATTR = 0x14 + RTM_DELADDR = 0xd + RTM_DELETE = 0x2 + RTM_DESYNC = 0x10 + RTM_GET = 0x4 + RTM_IFANNOUNCE = 0xf + RTM_IFINFO = 0xe + RTM_INVALIDATE = 0x11 + RTM_LOSING = 0x5 + RTM_MAXSIZE = 0x800 + RTM_MISS = 0x7 + RTM_NEWADDR = 0xc + RTM_PROPOSAL = 0x13 + RTM_REDIRECT = 0x6 + RTM_RESOLVE = 0xb + RTM_SOURCE = 0x16 + RTM_VERSION = 0x5 + RTV_EXPIRE = 0x4 + RTV_HOPCOUNT = 0x2 + RTV_MTU = 0x1 + RTV_RPIPE = 0x8 + RTV_RTT = 0x40 + RTV_RTTVAR = 0x80 + RTV_SPIPE = 0x10 + RTV_SSTHRESH = 0x20 + RT_TABLEID_BITS = 0x8 + RT_TABLEID_MASK = 0xff + RT_TABLEID_MAX = 0xff + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 + RUSAGE_THREAD = 0x1 + SCM_RIGHTS = 0x1 + SCM_TIMESTAMP = 0x4 + SEEK_CUR = 0x1 + SEEK_END = 0x2 + SEEK_SET = 0x0 + SHUT_RD = 0x0 + SHUT_RDWR = 0x2 + SHUT_WR = 0x1 + SIOCADDMULTI = 0x80206931 + SIOCAIFADDR = 0x8040691a + SIOCAIFGROUP = 0x80286987 + SIOCATMARK = 0x40047307 + SIOCBRDGADD = 0x8060693c + SIOCBRDGADDL = 0x80606949 + SIOCBRDGADDS = 0x80606941 + SIOCBRDGARL = 0x808c694d + SIOCBRDGDADDR = 0x81286947 + SIOCBRDGDEL = 0x8060693d + SIOCBRDGDELS = 0x80606942 + SIOCBRDGFLUSH = 0x80606948 + SIOCBRDGFRL = 0x808c694e + SIOCBRDGGCACHE = 0xc0146941 + SIOCBRDGGFD = 0xc0146952 + SIOCBRDGGHT = 0xc0146951 + SIOCBRDGGIFFLGS = 0xc060693e + SIOCBRDGGMA = 0xc0146953 + SIOCBRDGGPARAM = 0xc0406958 + SIOCBRDGGPRI = 0xc0146950 + SIOCBRDGGRL = 0xc030694f + SIOCBRDGGTO = 0xc0146946 + SIOCBRDGIFS = 0xc0606942 + SIOCBRDGRTS = 0xc0206943 + SIOCBRDGSADDR = 0xc1286944 + SIOCBRDGSCACHE = 0x80146940 + SIOCBRDGSFD = 0x80146952 + SIOCBRDGSHT = 0x80146951 + SIOCBRDGSIFCOST = 0x80606955 + SIOCBRDGSIFFLGS = 0x8060693f + SIOCBRDGSIFPRIO = 0x80606954 + SIOCBRDGSIFPROT = 0x8060694a + SIOCBRDGSMA = 0x80146953 + SIOCBRDGSPRI = 0x80146950 + SIOCBRDGSPROTO = 0x8014695a + SIOCBRDGSTO = 0x80146945 + SIOCBRDGSTXHC = 0x80146959 + SIOCDELLABEL = 0x80206997 + SIOCDELMULTI = 0x80206932 + SIOCDIFADDR = 0x80206919 + SIOCDIFGROUP = 0x80286989 + SIOCDIFPARENT = 0x802069b4 + SIOCDIFPHYADDR = 0x80206949 + SIOCDPWE3NEIGHBOR = 0x802069de + SIOCDVNETID = 0x802069af + SIOCGETKALIVE = 0xc01869a4 + SIOCGETLABEL = 0x8020699a + SIOCGETMPWCFG = 0xc02069ae + SIOCGETPFLOW = 0xc02069fe + SIOCGETPFSYNC = 0xc02069f8 + SIOCGETSGCNT = 0xc0207534 + SIOCGETVIFCNT = 0xc0287533 + SIOCGETVLAN = 0xc0206990 + SIOCGIFADDR = 0xc0206921 + SIOCGIFBRDADDR = 0xc0206923 + SIOCGIFCONF = 0xc0106924 + SIOCGIFDATA = 0xc020691b + SIOCGIFDESCR = 0xc0206981 + SIOCGIFDSTADDR = 0xc0206922 + SIOCGIFFLAGS = 0xc0206911 + SIOCGIFGATTR = 0xc028698b + SIOCGIFGENERIC = 0xc020693a + SIOCGIFGLIST = 0xc028698d + SIOCGIFGMEMB = 0xc028698a + SIOCGIFGROUP = 0xc0286988 + SIOCGIFHARDMTU = 0xc02069a5 + SIOCGIFLLPRIO = 0xc02069b6 + SIOCGIFMEDIA = 0xc0406938 + SIOCGIFMETRIC = 0xc0206917 + SIOCGIFMTU = 0xc020697e + SIOCGIFNETMASK = 0xc0206925 + SIOCGIFPAIR = 0xc02069b1 + SIOCGIFPARENT = 0xc02069b3 + SIOCGIFPRIORITY = 0xc020699c + SIOCGIFRDOMAIN = 0xc02069a0 + SIOCGIFRTLABEL = 0xc0206983 + SIOCGIFRXR = 0x802069aa + SIOCGIFSFFPAGE = 0xc1126939 + SIOCGIFXFLAGS = 0xc020699e + SIOCGLIFPHYADDR = 0xc218694b + SIOCGLIFPHYDF = 0xc02069c2 + SIOCGLIFPHYECN = 0xc02069c8 + SIOCGLIFPHYRTABLE = 0xc02069a2 + SIOCGLIFPHYTTL = 0xc02069a9 + SIOCGPGRP = 0x40047309 + SIOCGPWE3 = 0xc0206998 + SIOCGPWE3CTRLWORD = 0xc02069dc + SIOCGPWE3FAT = 0xc02069dd + SIOCGPWE3NEIGHBOR = 0xc21869de + SIOCGRXHPRIO = 0xc02069db + SIOCGSPPPPARAMS = 0xc0206994 + SIOCGTXHPRIO = 0xc02069c6 + SIOCGUMBINFO = 0xc02069be + SIOCGUMBPARAM = 0xc02069c0 + SIOCGVH = 0xc02069f6 + SIOCGVNETFLOWID = 0xc02069c4 + SIOCGVNETID = 0xc02069a7 + SIOCIFAFATTACH = 0x801169ab + SIOCIFAFDETACH = 0x801169ac + SIOCIFCREATE = 0x8020697a + SIOCIFDESTROY = 0x80206979 + SIOCIFGCLONERS = 0xc0106978 + SIOCSETKALIVE = 0x801869a3 + SIOCSETLABEL = 0x80206999 + SIOCSETMPWCFG = 0x802069ad + SIOCSETPFLOW = 0x802069fd + SIOCSETPFSYNC = 0x802069f7 + SIOCSETVLAN = 0x8020698f + SIOCSIFADDR = 0x8020690c + SIOCSIFBRDADDR = 0x80206913 + SIOCSIFDESCR = 0x80206980 + SIOCSIFDSTADDR = 0x8020690e + SIOCSIFFLAGS = 0x80206910 + SIOCSIFGATTR = 0x8028698c + SIOCSIFGENERIC = 0x80206939 + SIOCSIFLLADDR = 0x8020691f + SIOCSIFLLPRIO = 0x802069b5 + SIOCSIFMEDIA = 0xc0206937 + SIOCSIFMETRIC = 0x80206918 + SIOCSIFMTU = 0x8020697f + SIOCSIFNETMASK = 0x80206916 + SIOCSIFPAIR = 0x802069b0 + SIOCSIFPARENT = 0x802069b2 + SIOCSIFPRIORITY = 0x8020699b + SIOCSIFRDOMAIN = 0x8020699f + SIOCSIFRTLABEL = 0x80206982 + SIOCSIFXFLAGS = 0x8020699d + SIOCSLIFPHYADDR = 0x8218694a + SIOCSLIFPHYDF = 0x802069c1 + SIOCSLIFPHYECN = 0x802069c7 + SIOCSLIFPHYRTABLE = 0x802069a1 + SIOCSLIFPHYTTL = 0x802069a8 + SIOCSPGRP = 0x80047308 + SIOCSPWE3CTRLWORD = 0x802069dc + SIOCSPWE3FAT = 0x802069dd + SIOCSPWE3NEIGHBOR = 0x821869de + SIOCSRXHPRIO = 0x802069db + SIOCSSPPPPARAMS = 0x80206993 + SIOCSTXHPRIO = 0x802069c5 + SIOCSUMBPARAM = 0x802069bf + SIOCSVH = 0xc02069f5 + SIOCSVNETFLOWID = 0x802069c3 + SIOCSVNETID = 0x802069a6 + SOCK_CLOEXEC = 0x8000 + SOCK_DGRAM = 0x2 + SOCK_DNS = 0x1000 + SOCK_NONBLOCK = 0x4000 + SOCK_RAW = 0x3 + SOCK_RDM = 0x4 + SOCK_SEQPACKET = 0x5 + SOCK_STREAM = 0x1 + SOL_SOCKET = 0xffff + SOMAXCONN = 0x80 + SO_ACCEPTCONN = 0x2 + SO_BINDANY = 0x1000 + SO_BROADCAST = 0x20 + SO_DEBUG = 0x1 + SO_DOMAIN = 0x1024 + SO_DONTROUTE = 0x10 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x8 + SO_LINGER = 0x80 + SO_NETPROC = 0x1020 + SO_OOBINLINE = 0x100 + SO_PEERCRED = 0x1022 + SO_PROTOCOL = 0x1025 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x1006 + SO_REUSEADDR = 0x4 + SO_REUSEPORT = 0x200 + SO_RTABLE = 0x1021 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x1005 + SO_SPLICE = 0x1023 + SO_TIMESTAMP = 0x800 + SO_TYPE = 0x1008 + SO_USELOOPBACK = 0x40 + SO_ZEROIZE = 0x2000 + S_BLKSIZE = 0x200 + S_IEXEC = 0x40 + S_IFBLK = 0x6000 + S_IFCHR = 0x2000 + S_IFDIR = 0x4000 + S_IFIFO = 0x1000 + S_IFLNK = 0xa000 + S_IFMT = 0xf000 + S_IFREG = 0x8000 + S_IFSOCK = 0xc000 + S_IREAD = 0x100 + S_IRGRP = 0x20 + S_IROTH = 0x4 + S_IRUSR = 0x100 + S_IRWXG = 0x38 + S_IRWXO = 0x7 + S_IRWXU = 0x1c0 + S_ISGID = 0x400 + S_ISTXT = 0x200 + S_ISUID = 0x800 + S_ISVTX = 0x200 + S_IWGRP = 0x10 + S_IWOTH = 0x2 + S_IWRITE = 0x80 + S_IWUSR = 0x80 + S_IXGRP = 0x8 + S_IXOTH = 0x1 + S_IXUSR = 0x40 + TCIFLUSH = 0x1 + TCIOFF = 0x3 + TCIOFLUSH = 0x3 + TCION = 0x4 + TCOFLUSH = 0x2 + TCOOFF = 0x1 + TCOON = 0x2 + TCPOPT_EOL = 0x0 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_HDR = 0x1010500 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SACK_PERMIT_HDR = 0x1010402 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_TSTAMP_HDR = 0x101080a + TCPOPT_WINDOW = 0x3 + TCP_INFO = 0x9 + TCP_MAXSEG = 0x2 + TCP_MAXWIN = 0xffff + TCP_MAX_SACK = 0x3 + TCP_MAX_WINSHIFT = 0xe + TCP_MD5SIG = 0x4 + TCP_MSS = 0x200 + TCP_NODELAY = 0x1 + TCP_NOPUSH = 0x10 + TCP_SACKHOLE_LIMIT = 0x80 + TCP_SACK_ENABLE = 0x8 + TCSAFLUSH = 0x2 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCHKVERAUTH = 0x2000741e + TIOCCLRVERAUTH = 0x2000741d + TIOCCONS = 0x80047462 + TIOCDRAIN = 0x2000745e + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLAG_CLOCAL = 0x2 + TIOCFLAG_CRTSCTS = 0x4 + TIOCFLAG_MDMBUF = 0x8 + TIOCFLAG_PPS = 0x10 + TIOCFLAG_SOFTCAR = 0x1 + TIOCFLUSH = 0x80047410 + TIOCGETA = 0x402c7413 + TIOCGETD = 0x4004741a + TIOCGFLAGS = 0x4004745d + TIOCGPGRP = 0x40047477 + TIOCGSID = 0x40047463 + TIOCGTSTAMP = 0x4010745b + TIOCGWINSZ = 0x40087468 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGET = 0x4004746a + TIOCMODG = 0x4004746a + TIOCMODS = 0x8004746d + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0x0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCREMOTE = 0x80047469 + TIOCSBRK = 0x2000747b + TIOCSCTTY = 0x20007461 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x802c7414 + TIOCSETAF = 0x802c7416 + TIOCSETAW = 0x802c7415 + TIOCSETD = 0x8004741b + TIOCSETVERAUTH = 0x8004741c + TIOCSFLAGS = 0x8004745c + TIOCSIG = 0x8004745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTOP = 0x2000746f + TIOCSTSTAMP = 0x8008745a + TIOCSWINSZ = 0x80087467 + TIOCUCNTL = 0x80047466 + TIOCUCNTL_CBRK = 0x7a + TIOCUCNTL_SBRK = 0x7b + TOSTOP = 0x400000 + UTIME_NOW = -0x2 + UTIME_OMIT = -0x1 + VDISCARD = 0xf + VDSUSP = 0xb + VEOF = 0x0 + VEOL = 0x1 + VEOL2 = 0x2 + VERASE = 0x3 + VINTR = 0x8 + VKILL = 0x5 + VLNEXT = 0xe + VMIN = 0x10 + VM_ANONMIN = 0x7 + VM_LOADAVG = 0x2 + VM_MALLOC_CONF = 0xc + VM_MAXID = 0xd + VM_MAXSLP = 0xa + VM_METER = 0x1 + VM_NKMEMPAGES = 0x6 + VM_PSSTRINGS = 0x3 + VM_SWAPENCRYPT = 0x5 + VM_USPACE = 0xb + VM_UVMEXP = 0x4 + VM_VNODEMIN = 0x9 + VM_VTEXTMIN = 0x8 + VQUIT = 0x9 + VREPRINT = 0x6 + VSTART = 0xc + VSTATUS = 0x12 + VSTOP = 0xd + VSUSP = 0xa + VTIME = 0x11 + VWERASE = 0x4 + WALTSIG = 0x4 + WCONTINUED = 0x8 + WCOREFLAG = 0x80 + WNOHANG = 0x1 + WUNTRACED = 0x2 + XCASE = 0x1000000 +) + +// Errors +const ( + E2BIG = syscall.Errno(0x7) + EACCES = syscall.Errno(0xd) + EADDRINUSE = syscall.Errno(0x30) + EADDRNOTAVAIL = syscall.Errno(0x31) + EAFNOSUPPORT = syscall.Errno(0x2f) + EAGAIN = syscall.Errno(0x23) + EALREADY = syscall.Errno(0x25) + EAUTH = syscall.Errno(0x50) + EBADF = syscall.Errno(0x9) + EBADMSG = syscall.Errno(0x5c) + EBADRPC = syscall.Errno(0x48) + EBUSY = syscall.Errno(0x10) + ECANCELED = syscall.Errno(0x58) + ECHILD = syscall.Errno(0xa) + ECONNABORTED = syscall.Errno(0x35) + ECONNREFUSED = syscall.Errno(0x3d) + ECONNRESET = syscall.Errno(0x36) + EDEADLK = syscall.Errno(0xb) + EDESTADDRREQ = syscall.Errno(0x27) + EDOM = syscall.Errno(0x21) + EDQUOT = syscall.Errno(0x45) + EEXIST = syscall.Errno(0x11) + EFAULT = syscall.Errno(0xe) + EFBIG = syscall.Errno(0x1b) + EFTYPE = syscall.Errno(0x4f) + EHOSTDOWN = syscall.Errno(0x40) + EHOSTUNREACH = syscall.Errno(0x41) + EIDRM = syscall.Errno(0x59) + EILSEQ = syscall.Errno(0x54) + EINPROGRESS = syscall.Errno(0x24) + EINTR = syscall.Errno(0x4) + EINVAL = syscall.Errno(0x16) + EIO = syscall.Errno(0x5) + EIPSEC = syscall.Errno(0x52) + EISCONN = syscall.Errno(0x38) + EISDIR = syscall.Errno(0x15) + ELAST = syscall.Errno(0x5f) + ELOOP = syscall.Errno(0x3e) + EMEDIUMTYPE = syscall.Errno(0x56) + EMFILE = syscall.Errno(0x18) + EMLINK = syscall.Errno(0x1f) + EMSGSIZE = syscall.Errno(0x28) + ENAMETOOLONG = syscall.Errno(0x3f) + ENEEDAUTH = syscall.Errno(0x51) + ENETDOWN = syscall.Errno(0x32) + ENETRESET = syscall.Errno(0x34) + ENETUNREACH = syscall.Errno(0x33) + ENFILE = syscall.Errno(0x17) + ENOATTR = syscall.Errno(0x53) + ENOBUFS = syscall.Errno(0x37) + ENODEV = syscall.Errno(0x13) + ENOENT = syscall.Errno(0x2) + ENOEXEC = syscall.Errno(0x8) + ENOLCK = syscall.Errno(0x4d) + ENOMEDIUM = syscall.Errno(0x55) + ENOMEM = syscall.Errno(0xc) + ENOMSG = syscall.Errno(0x5a) + ENOPROTOOPT = syscall.Errno(0x2a) + ENOSPC = syscall.Errno(0x1c) + ENOSYS = syscall.Errno(0x4e) + ENOTBLK = syscall.Errno(0xf) + ENOTCONN = syscall.Errno(0x39) + ENOTDIR = syscall.Errno(0x14) + ENOTEMPTY = syscall.Errno(0x42) + ENOTRECOVERABLE = syscall.Errno(0x5d) + ENOTSOCK = syscall.Errno(0x26) + ENOTSUP = syscall.Errno(0x5b) + ENOTTY = syscall.Errno(0x19) + ENXIO = syscall.Errno(0x6) + EOPNOTSUPP = syscall.Errno(0x2d) + EOVERFLOW = syscall.Errno(0x57) + EOWNERDEAD = syscall.Errno(0x5e) + EPERM = syscall.Errno(0x1) + EPFNOSUPPORT = syscall.Errno(0x2e) + EPIPE = syscall.Errno(0x20) + EPROCLIM = syscall.Errno(0x43) + EPROCUNAVAIL = syscall.Errno(0x4c) + EPROGMISMATCH = syscall.Errno(0x4b) + EPROGUNAVAIL = syscall.Errno(0x4a) + EPROTO = syscall.Errno(0x5f) + EPROTONOSUPPORT = syscall.Errno(0x2b) + EPROTOTYPE = syscall.Errno(0x29) + ERANGE = syscall.Errno(0x22) + EREMOTE = syscall.Errno(0x47) + EROFS = syscall.Errno(0x1e) + ERPCMISMATCH = syscall.Errno(0x49) + ESHUTDOWN = syscall.Errno(0x3a) + ESOCKTNOSUPPORT = syscall.Errno(0x2c) + ESPIPE = syscall.Errno(0x1d) + ESRCH = syscall.Errno(0x3) + ESTALE = syscall.Errno(0x46) + ETIMEDOUT = syscall.Errno(0x3c) + ETOOMANYREFS = syscall.Errno(0x3b) + ETXTBSY = syscall.Errno(0x1a) + EUSERS = syscall.Errno(0x44) + EWOULDBLOCK = syscall.Errno(0x23) + EXDEV = syscall.Errno(0x12) +) + +// Signals +const ( + SIGABRT = syscall.Signal(0x6) + SIGALRM = syscall.Signal(0xe) + SIGBUS = syscall.Signal(0xa) + SIGCHLD = syscall.Signal(0x14) + SIGCONT = syscall.Signal(0x13) + SIGEMT = syscall.Signal(0x7) + SIGFPE = syscall.Signal(0x8) + SIGHUP = syscall.Signal(0x1) + SIGILL = syscall.Signal(0x4) + SIGINFO = syscall.Signal(0x1d) + SIGINT = syscall.Signal(0x2) + SIGIO = syscall.Signal(0x17) + SIGIOT = syscall.Signal(0x6) + SIGKILL = syscall.Signal(0x9) + SIGPIPE = syscall.Signal(0xd) + SIGPROF = syscall.Signal(0x1b) + SIGQUIT = syscall.Signal(0x3) + SIGSEGV = syscall.Signal(0xb) + SIGSTOP = syscall.Signal(0x11) + SIGSYS = syscall.Signal(0xc) + SIGTERM = syscall.Signal(0xf) + SIGTHR = syscall.Signal(0x20) + SIGTRAP = syscall.Signal(0x5) + SIGTSTP = syscall.Signal(0x12) + SIGTTIN = syscall.Signal(0x15) + SIGTTOU = syscall.Signal(0x16) + SIGURG = syscall.Signal(0x10) + SIGUSR1 = syscall.Signal(0x1e) + SIGUSR2 = syscall.Signal(0x1f) + SIGVTALRM = syscall.Signal(0x1a) + SIGWINCH = syscall.Signal(0x1c) + SIGXCPU = syscall.Signal(0x18) + SIGXFSZ = syscall.Signal(0x19) +) + +// Error table +var errorList = [...]struct { + num syscall.Errno + name string + desc string +}{ + {1, "EPERM", "operation not permitted"}, + {2, "ENOENT", "no such file or directory"}, + {3, "ESRCH", "no such process"}, + {4, "EINTR", "interrupted system call"}, + {5, "EIO", "input/output error"}, + {6, "ENXIO", "device not configured"}, + {7, "E2BIG", "argument list too long"}, + {8, "ENOEXEC", "exec format error"}, + {9, "EBADF", "bad file descriptor"}, + {10, "ECHILD", "no child processes"}, + {11, "EDEADLK", "resource deadlock avoided"}, + {12, "ENOMEM", "cannot allocate memory"}, + {13, "EACCES", "permission denied"}, + {14, "EFAULT", "bad address"}, + {15, "ENOTBLK", "block device required"}, + {16, "EBUSY", "device busy"}, + {17, "EEXIST", "file exists"}, + {18, "EXDEV", "cross-device link"}, + {19, "ENODEV", "operation not supported by device"}, + {20, "ENOTDIR", "not a directory"}, + {21, "EISDIR", "is a directory"}, + {22, "EINVAL", "invalid argument"}, + {23, "ENFILE", "too many open files in system"}, + {24, "EMFILE", "too many open files"}, + {25, "ENOTTY", "inappropriate ioctl for device"}, + {26, "ETXTBSY", "text file busy"}, + {27, "EFBIG", "file too large"}, + {28, "ENOSPC", "no space left on device"}, + {29, "ESPIPE", "illegal seek"}, + {30, "EROFS", "read-only file system"}, + {31, "EMLINK", "too many links"}, + {32, "EPIPE", "broken pipe"}, + {33, "EDOM", "numerical argument out of domain"}, + {34, "ERANGE", "result too large"}, + {35, "EAGAIN", "resource temporarily unavailable"}, + {36, "EINPROGRESS", "operation now in progress"}, + {37, "EALREADY", "operation already in progress"}, + {38, "ENOTSOCK", "socket operation on non-socket"}, + {39, "EDESTADDRREQ", "destination address required"}, + {40, "EMSGSIZE", "message too long"}, + {41, "EPROTOTYPE", "protocol wrong type for socket"}, + {42, "ENOPROTOOPT", "protocol not available"}, + {43, "EPROTONOSUPPORT", "protocol not supported"}, + {44, "ESOCKTNOSUPPORT", "socket type not supported"}, + {45, "EOPNOTSUPP", "operation not supported"}, + {46, "EPFNOSUPPORT", "protocol family not supported"}, + {47, "EAFNOSUPPORT", "address family not supported by protocol family"}, + {48, "EADDRINUSE", "address already in use"}, + {49, "EADDRNOTAVAIL", "can't assign requested address"}, + {50, "ENETDOWN", "network is down"}, + {51, "ENETUNREACH", "network is unreachable"}, + {52, "ENETRESET", "network dropped connection on reset"}, + {53, "ECONNABORTED", "software caused connection abort"}, + {54, "ECONNRESET", "connection reset by peer"}, + {55, "ENOBUFS", "no buffer space available"}, + {56, "EISCONN", "socket is already connected"}, + {57, "ENOTCONN", "socket is not connected"}, + {58, "ESHUTDOWN", "can't send after socket shutdown"}, + {59, "ETOOMANYREFS", "too many references: can't splice"}, + {60, "ETIMEDOUT", "operation timed out"}, + {61, "ECONNREFUSED", "connection refused"}, + {62, "ELOOP", "too many levels of symbolic links"}, + {63, "ENAMETOOLONG", "file name too long"}, + {64, "EHOSTDOWN", "host is down"}, + {65, "EHOSTUNREACH", "no route to host"}, + {66, "ENOTEMPTY", "directory not empty"}, + {67, "EPROCLIM", "too many processes"}, + {68, "EUSERS", "too many users"}, + {69, "EDQUOT", "disk quota exceeded"}, + {70, "ESTALE", "stale NFS file handle"}, + {71, "EREMOTE", "too many levels of remote in path"}, + {72, "EBADRPC", "RPC struct is bad"}, + {73, "ERPCMISMATCH", "RPC version wrong"}, + {74, "EPROGUNAVAIL", "RPC program not available"}, + {75, "EPROGMISMATCH", "program version wrong"}, + {76, "EPROCUNAVAIL", "bad procedure for program"}, + {77, "ENOLCK", "no locks available"}, + {78, "ENOSYS", "function not implemented"}, + {79, "EFTYPE", "inappropriate file type or format"}, + {80, "EAUTH", "authentication error"}, + {81, "ENEEDAUTH", "need authenticator"}, + {82, "EIPSEC", "IPsec processing failure"}, + {83, "ENOATTR", "attribute not found"}, + {84, "EILSEQ", "illegal byte sequence"}, + {85, "ENOMEDIUM", "no medium found"}, + {86, "EMEDIUMTYPE", "wrong medium type"}, + {87, "EOVERFLOW", "value too large to be stored in data type"}, + {88, "ECANCELED", "operation canceled"}, + {89, "EIDRM", "identifier removed"}, + {90, "ENOMSG", "no message of desired type"}, + {91, "ENOTSUP", "not supported"}, + {92, "EBADMSG", "bad message"}, + {93, "ENOTRECOVERABLE", "state not recoverable"}, + {94, "EOWNERDEAD", "previous owner died"}, + {95, "ELAST", "protocol error"}, +} + +// Signal table +var signalList = [...]struct { + num syscall.Signal + name string + desc string +}{ + {1, "SIGHUP", "hangup"}, + {2, "SIGINT", "interrupt"}, + {3, "SIGQUIT", "quit"}, + {4, "SIGILL", "illegal instruction"}, + {5, "SIGTRAP", "trace/BPT trap"}, + {6, "SIGABRT", "abort trap"}, + {7, "SIGEMT", "EMT trap"}, + {8, "SIGFPE", "floating point exception"}, + {9, "SIGKILL", "killed"}, + {10, "SIGBUS", "bus error"}, + {11, "SIGSEGV", "segmentation fault"}, + {12, "SIGSYS", "bad system call"}, + {13, "SIGPIPE", "broken pipe"}, + {14, "SIGALRM", "alarm clock"}, + {15, "SIGTERM", "terminated"}, + {16, "SIGURG", "urgent I/O condition"}, + {17, "SIGSTOP", "suspended (signal)"}, + {18, "SIGTSTP", "suspended"}, + {19, "SIGCONT", "continued"}, + {20, "SIGCHLD", "child exited"}, + {21, "SIGTTIN", "stopped (tty input)"}, + {22, "SIGTTOU", "stopped (tty output)"}, + {23, "SIGIO", "I/O possible"}, + {24, "SIGXCPU", "cputime limit exceeded"}, + {25, "SIGXFSZ", "filesize limit exceeded"}, + {26, "SIGVTALRM", "virtual timer expired"}, + {27, "SIGPROF", "profiling timer expired"}, + {28, "SIGWINCH", "window size changes"}, + {29, "SIGINFO", "information request"}, + {30, "SIGUSR1", "user defined signal 1"}, + {31, "SIGUSR2", "user defined signal 2"}, + {32, "SIGTHR", "thread AST"}, +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go deleted file mode 100644 index a06eb0932420..000000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go +++ /dev/null @@ -1,40 +0,0 @@ -// go run mksyscall.go -tags darwin,amd64,go1.13 syscall_darwin.1_13.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -//go:build darwin && amd64 && go1.13 -// +build darwin,amd64,go1.13 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func closedir(dir uintptr) (err error) { - _, _, e1 := syscall_syscall(libc_closedir_trampoline_addr, uintptr(dir), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_closedir_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { - r0, _, _ := syscall_syscall(libc_readdir_r_trampoline_addr, uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) - res = Errno(r0) - return -} - -var libc_readdir_r_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s deleted file mode 100644 index d6c3e25c018a..000000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s +++ /dev/null @@ -1,25 +0,0 @@ -// go run mkasm_darwin.go amd64 -// Code generated by the command above; DO NOT EDIT. - -//go:build go1.13 -// +build go1.13 - -#include "textflag.h" - -TEXT libc_fdopendir_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_fdopendir(SB) - -GLOBL ·libc_fdopendir_trampoline_addr(SB), RODATA, $8 -DATA ·libc_fdopendir_trampoline_addr(SB)/8, $libc_fdopendir_trampoline<>(SB) - -TEXT libc_closedir_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_closedir(SB) - -GLOBL ·libc_closedir_trampoline_addr(SB), RODATA, $8 -DATA ·libc_closedir_trampoline_addr(SB)/8, $libc_closedir_trampoline<>(SB) - -TEXT libc_readdir_r_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_readdir_r(SB) - -GLOBL ·libc_readdir_r_trampoline_addr(SB), RODATA, $8 -DATA ·libc_readdir_r_trampoline_addr(SB)/8, $libc_readdir_r_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index 467deed76331..c2461c496797 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -1,8 +1,8 @@ -// go run mksyscall.go -tags darwin,amd64,go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_amd64.go +// go run mksyscall.go -tags darwin,amd64 syscall_bsd.go syscall_darwin.go syscall_darwin_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. -//go:build darwin && amd64 && go1.12 -// +build darwin,amd64,go1.12 +//go:build darwin && amd64 +// +build darwin,amd64 package unix @@ -463,6 +463,32 @@ var libc_munlockall_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func closedir(dir uintptr) (err error) { + _, _, e1 := syscall_syscall(libc_closedir_trampoline_addr, uintptr(dir), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_closedir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { + r0, _, _ := syscall_syscall(libc_readdir_r_trampoline_addr, uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) + res = Errno(r0) + return +} + +var libc_readdir_r_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func pipe(p *[2]int32) (err error) { _, _, e1 := syscall_rawSyscall(libc_pipe_trampoline_addr, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index 7e308a476d93..95fe4c0eb962 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -1,11 +1,14 @@ -// go run mkasm_darwin.go amd64 +// go run mkasm.go darwin amd64 // Code generated by the command above; DO NOT EDIT. -//go:build go1.12 -// +build go1.12 - #include "textflag.h" +TEXT libc_fdopendir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fdopendir(SB) + +GLOBL ·libc_fdopendir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fdopendir_trampoline_addr(SB)/8, $libc_fdopendir_trampoline<>(SB) + TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getgroups(SB) @@ -174,6 +177,18 @@ TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8 DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB) +TEXT libc_closedir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_closedir(SB) + +GLOBL ·libc_closedir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_closedir_trampoline_addr(SB)/8, $libc_closedir_trampoline<>(SB) + +TEXT libc_readdir_r_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readdir_r(SB) + +GLOBL ·libc_readdir_r_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readdir_r_trampoline_addr(SB)/8, $libc_readdir_r_trampoline<>(SB) + TEXT libc_pipe_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pipe(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go deleted file mode 100644 index cec595d553a4..000000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go +++ /dev/null @@ -1,40 +0,0 @@ -// go run mksyscall.go -tags darwin,arm64,go1.13 syscall_darwin.1_13.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -//go:build darwin && arm64 && go1.13 -// +build darwin,arm64,go1.13 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func closedir(dir uintptr) (err error) { - _, _, e1 := syscall_syscall(libc_closedir_trampoline_addr, uintptr(dir), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_closedir_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { - r0, _, _ := syscall_syscall(libc_readdir_r_trampoline_addr, uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) - res = Errno(r0) - return -} - -var libc_readdir_r_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s deleted file mode 100644 index 357989722cfb..000000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s +++ /dev/null @@ -1,25 +0,0 @@ -// go run mkasm_darwin.go arm64 -// Code generated by the command above; DO NOT EDIT. - -//go:build go1.13 -// +build go1.13 - -#include "textflag.h" - -TEXT libc_fdopendir_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_fdopendir(SB) - -GLOBL ·libc_fdopendir_trampoline_addr(SB), RODATA, $8 -DATA ·libc_fdopendir_trampoline_addr(SB)/8, $libc_fdopendir_trampoline<>(SB) - -TEXT libc_closedir_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_closedir(SB) - -GLOBL ·libc_closedir_trampoline_addr(SB), RODATA, $8 -DATA ·libc_closedir_trampoline_addr(SB)/8, $libc_closedir_trampoline<>(SB) - -TEXT libc_readdir_r_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_readdir_r(SB) - -GLOBL ·libc_readdir_r_trampoline_addr(SB), RODATA, $8 -DATA ·libc_readdir_r_trampoline_addr(SB)/8, $libc_readdir_r_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index 35938d34ff8b..26a0fdc505bb 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -1,8 +1,8 @@ -// go run mksyscall.go -tags darwin,arm64,go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_arm64.go +// go run mksyscall.go -tags darwin,arm64 syscall_bsd.go syscall_darwin.go syscall_darwin_arm64.go // Code generated by the command above; see README.md. DO NOT EDIT. -//go:build darwin && arm64 && go1.12 -// +build darwin,arm64,go1.12 +//go:build darwin && arm64 +// +build darwin,arm64 package unix @@ -463,6 +463,32 @@ var libc_munlockall_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func closedir(dir uintptr) (err error) { + _, _, e1 := syscall_syscall(libc_closedir_trampoline_addr, uintptr(dir), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_closedir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { + r0, _, _ := syscall_syscall(libc_readdir_r_trampoline_addr, uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) + res = Errno(r0) + return +} + +var libc_readdir_r_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func pipe(p *[2]int32) (err error) { _, _, e1 := syscall_rawSyscall(libc_pipe_trampoline_addr, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s index b09e5bb0e204..efa5b4c987c5 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s @@ -1,11 +1,14 @@ -// go run mkasm_darwin.go arm64 +// go run mkasm.go darwin arm64 // Code generated by the command above; DO NOT EDIT. -//go:build go1.12 -// +build go1.12 - #include "textflag.h" +TEXT libc_fdopendir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fdopendir(SB) + +GLOBL ·libc_fdopendir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fdopendir_trampoline_addr(SB)/8, $libc_fdopendir_trampoline<>(SB) + TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getgroups(SB) @@ -174,6 +177,18 @@ TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8 DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB) +TEXT libc_closedir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_closedir(SB) + +GLOBL ·libc_closedir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_closedir_trampoline_addr(SB)/8, $libc_closedir_trampoline<>(SB) + +TEXT libc_readdir_r_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readdir_r(SB) + +GLOBL ·libc_readdir_r_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readdir_r_trampoline_addr(SB)/8, $libc_readdir_r_trampoline<>(SB) + TEXT libc_pipe_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pipe(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go index 1b6eedfa6115..54749f9c5ed7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go @@ -552,6 +552,16 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go index e9d9997eeda9..77479d458155 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go @@ -544,6 +544,16 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -912,7 +922,7 @@ func Fpathconf(fd int, name int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat(fd int, stat *stat_freebsd11_t) (err error) { +func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) @@ -922,17 +932,7 @@ func fstat(fd int, stat *stat_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat_freebsd12(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) { +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -947,22 +947,7 @@ func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { +func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) @@ -972,16 +957,6 @@ func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatfs_freebsd12(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { @@ -1002,7 +977,7 @@ func Ftruncate(fd int, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { +func getdirentries(fd int, buf []byte, basep *uint64) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) @@ -1019,23 +994,6 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES_FREEBSD12, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getdtablesize() (size int) { r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) size = int(r0) @@ -1257,21 +1215,6 @@ func Listen(s int, backlog int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func lstat(path string, stat *stat_freebsd11_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkdir(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1317,43 +1260,13 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mknodat(fd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error) { +func Mknodat(fd int, path string, mode uint32, dev uint64) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := Syscall6(SYS_MKNODAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), uintptr(dev>>32), 0) + _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), uintptr(dev>>32), 0) if e1 != 0 { err = errnoErr(e1) } @@ -1753,22 +1666,7 @@ func Setuid(uid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func stat(path string, stat *stat_freebsd11_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func statfs(path string, stat *statfs_freebsd11_t) (err error) { +func Statfs(path string, stat *Statfs_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1783,21 +1681,6 @@ func statfs(path string, stat *statfs_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func statfs_freebsd12(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS_FREEBSD12, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Symlink(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go index edd373b1a562..2e966d4d7a6c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go @@ -544,6 +544,16 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -912,7 +922,7 @@ func Fpathconf(fd int, name int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat(fd int, stat *stat_freebsd11_t) (err error) { +func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) @@ -922,17 +932,7 @@ func fstat(fd int, stat *stat_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat_freebsd12(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) { +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -947,22 +947,7 @@ func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { +func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) @@ -972,16 +957,6 @@ func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatfs_freebsd12(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { @@ -1002,7 +977,7 @@ func Ftruncate(fd int, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { +func getdirentries(fd int, buf []byte, basep *uint64) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) @@ -1019,23 +994,6 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES_FREEBSD12, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getdtablesize() (size int) { r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) size = int(r0) @@ -1257,21 +1215,6 @@ func Listen(s int, backlog int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func lstat(path string, stat *stat_freebsd11_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkdir(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1317,22 +1260,7 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mknodat(fd int, path string, mode uint32, dev int) (err error) { +func Mknodat(fd int, path string, mode uint32, dev uint64) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1347,21 +1275,6 @@ func mknodat(fd int, path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { @@ -1753,22 +1666,7 @@ func Setuid(uid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func stat(path string, stat *stat_freebsd11_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func statfs(path string, stat *statfs_freebsd11_t) (err error) { +func Statfs(path string, stat *Statfs_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1783,21 +1681,6 @@ func statfs(path string, stat *statfs_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func statfs_freebsd12(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS_FREEBSD12, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Symlink(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go index 82e9764b2571..d65a7c0fa6e9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go @@ -351,22 +351,6 @@ func Munlockall() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func pipe2(p *[2]_C_int, flags int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { @@ -404,6 +388,22 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { + var _p0 unsafe.Pointer + if len(mib) > 0 { + _p0 = unsafe.Pointer(&mib[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ptrace(request int, pid int, addr uintptr, data int) (err error) { _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { @@ -544,6 +544,16 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -912,7 +922,7 @@ func Fpathconf(fd int, name int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat(fd int, stat *stat_freebsd11_t) (err error) { +func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) @@ -922,17 +932,7 @@ func fstat(fd int, stat *stat_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat_freebsd12(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) { +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -947,22 +947,7 @@ func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { +func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) @@ -972,16 +957,6 @@ func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatfs_freebsd12(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { @@ -1002,7 +977,7 @@ func Ftruncate(fd int, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { +func getdirentries(fd int, buf []byte, basep *uint64) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) @@ -1019,23 +994,6 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES_FREEBSD12, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getdtablesize() (size int) { r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) size = int(r0) @@ -1257,21 +1215,6 @@ func Listen(s int, backlog int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func lstat(path string, stat *stat_freebsd11_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkdir(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1317,43 +1260,13 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mknodat(fd int, path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error) { +func Mknodat(fd int, path string, mode uint32, dev uint64) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := Syscall6(SYS_MKNODAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) + _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, uintptr(dev), uintptr(dev>>32)) if e1 != 0 { err = errnoErr(e1) } @@ -1753,22 +1666,7 @@ func Setuid(uid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func stat(path string, stat *stat_freebsd11_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func statfs(path string, stat *statfs_freebsd11_t) (err error) { +func Statfs(path string, stat *Statfs_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1783,21 +1681,6 @@ func statfs(path string, stat *statfs_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func statfs_freebsd12(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS_FREEBSD12, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Symlink(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go index a6479acd1fc8..6f0b97c6db3a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go @@ -544,6 +544,16 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -912,7 +922,7 @@ func Fpathconf(fd int, name int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat(fd int, stat *stat_freebsd11_t) (err error) { +func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) @@ -922,17 +932,7 @@ func fstat(fd int, stat *stat_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstat_freebsd12(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) { +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -947,22 +947,7 @@ func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { +func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) @@ -972,16 +957,6 @@ func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fstatfs_freebsd12(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { @@ -1002,7 +977,7 @@ func Ftruncate(fd int, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { +func getdirentries(fd int, buf []byte, basep *uint64) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) @@ -1019,23 +994,6 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES_FREEBSD12, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getdtablesize() (size int) { r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) size = int(r0) @@ -1257,21 +1215,6 @@ func Listen(s int, backlog int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func lstat(path string, stat *stat_freebsd11_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Mkdir(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1317,22 +1260,7 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mknodat(fd int, path string, mode uint32, dev int) (err error) { +func Mknodat(fd int, path string, mode uint32, dev uint64) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1347,21 +1275,6 @@ func mknodat(fd int, path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_MKNODAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { @@ -1753,22 +1666,7 @@ func Setuid(uid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func stat(path string, stat *stat_freebsd11_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func statfs(path string, stat *statfs_freebsd11_t) (err error) { +func Statfs(path string, stat *Statfs_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -1783,21 +1681,6 @@ func statfs(path string, stat *statfs_freebsd11_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func statfs_freebsd12(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS_FREEBSD12, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Symlink(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go new file mode 100644 index 000000000000..e1c23b527236 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go @@ -0,0 +1,1899 @@ +// go run mksyscall.go -tags freebsd,riscv64 syscall_bsd.go syscall_freebsd.go syscall_freebsd_riscv64.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build freebsd && riscv64 +// +build freebsd,riscv64 + +package unix + +import ( + "syscall" + "unsafe" +) + +var _ syscall.Errno + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getgroups(ngid int, gid *_Gid_t) (n int, err error) { + r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setgroups(ngid int, gid *_Gid_t) (err error) { + _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { + r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + wpid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { + r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socket(domain int, typ int, proto int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { + _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { + _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Shutdown(s int, how int) (err error) { + _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { + _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { + r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, timeval *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func futimes(fd int, timeval *[2]Timeval) (err error) { + _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { + r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Madvise(b []byte, behav int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mlock(b []byte) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mlockall(flags int) (err error) { + _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mprotect(b []byte, prot int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Msync(b []byte, flags int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Munlock(b []byte) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Munlockall() (err error) { + _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getcwd(buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { + var _p0 unsafe.Pointer + if len(mib) > 0 { + _p0 = unsafe.Pointer(&mib[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ptrace(request int, pid int, addr uintptr, data int) (err error) { + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Access(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { + _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func CapEnter() (err error) { + _, _, e1 := Syscall(SYS_CAP_ENTER, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func capRightsGet(version int, fd int, rightsp *CapRights) (err error) { + _, _, e1 := Syscall(SYS___CAP_RIGHTS_GET, uintptr(version), uintptr(fd), uintptr(unsafe.Pointer(rightsp))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func capRightsLimit(fd int, rightsp *CapRights) (err error) { + _, _, e1 := Syscall(SYS_CAP_RIGHTS_LIMIT, uintptr(fd), uintptr(unsafe.Pointer(rightsp)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chflags(path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chmod(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chroot(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Close(fd int) (err error) { + _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup(fd int) (nfd int, err error) { + r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + nfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup2(from int, to int) (err error) { + _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Exit(code int) { + Syscall(SYS_EXIT, uintptr(code), 0, 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_EXTATTR_DELETE_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrListFd(fd int, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrGetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrSetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_EXTATTR_DELETE_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrGetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_EXTATTR_DELETE_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fadvise(fd int, offset int64, length int64, advice int) (err error) { + _, _, e1 := Syscall6(SYS_POSIX_FADVISE, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchdir(fd int) (err error) { + _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchflags(fd int, flags int) (err error) { + _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmod(fd int, mode uint32) (err error) { + _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchown(fd int, uid int, gid int) (err error) { + _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Flock(fd int, how int) (err error) { + _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fpathconf(fd int, name int) (val int, err error) { + r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstat(fd int, stat *Stat_t) (err error) { + _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatfs(fd int, stat *Statfs_t) (err error) { + _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fsync(fd int) (err error) { + _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ftruncate(fd int, length int64) (err error) { + _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getdirentries(fd int, buf []byte, basep *uint64) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getdtablesize() (size int) { + r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) + size = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getegid() (egid int) { + r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) + egid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Geteuid() (uid int) { + r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getgid() (gid int) { + r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) + gid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgid(pid int) (pgid int, err error) { + r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) + pgid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgrp() (pgrp int) { + r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) + pgrp = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpid() (pid int) { + r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) + pid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getppid() (ppid int) { + r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) + ppid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpriority(which int, who int) (prio int, err error) { + r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) + prio = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrlimit(which int, lim *Rlimit) (err error) { + _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrusage(who int, rusage *Rusage) (err error) { + _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getsid(pid int) (sid int, err error) { + r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) + sid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Gettimeofday(tv *Timeval) (err error) { + _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getuid() (uid int) { + r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Issetugid() (tainted bool) { + r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) + tainted = bool(r0 != 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kill(pid int, signum syscall.Signal) (err error) { + _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kqueue() (fd int, err error) { + r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lchown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Link(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Listen(s int, backlog int) (err error) { + _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdir(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdirat(dirfd int, path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkfifo(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknodat(fd int, path string, mode uint32, dev uint64) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Nanosleep(time *Timespec, leftover *Timespec) (err error) { + _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Open(path string, mode int, perm uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Openat(fdat int, path string, mode int, perm uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(fdat), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pathconf(path string, name int) (val int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pread(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pwrite(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func read(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlink(path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rename(from string, to string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Renameat(fromfd int, from string, tofd int, to string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Revoke(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rmdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { + r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) + newoffset = int64(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { + r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setegid(egid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seteuid(euid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setgid(gid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setlogin(name string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(name) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpgid(pid int, pgid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpriority(which int, who int, prio int) (err error) { + _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setregid(rgid int, egid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setreuid(ruid int, euid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresgid(rgid int, egid int, sgid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresuid(ruid int, euid int, suid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setrlimit(which int, lim *Rlimit) (err error) { + _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setsid() (pid int, err error) { + r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) + pid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Settimeofday(tp *Timeval) (err error) { + _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setuid(uid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Statfs(path string, stat *Statfs_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlink(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Sync() (err error) { + _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Truncate(path string, length int64) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Umask(newmask int) (oldmask int) { + r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) + oldmask = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Undelete(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlink(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlinkat(dirfd int, path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unmount(path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func write(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { + r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func munmap(addr uintptr, length uintptr) (err error) { + _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func readlen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func writelen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) { + r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) + nfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go index af5cb064ec4f..b57c7050d7a8 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go @@ -15,25 +15,19 @@ import ( //go:cgo_import_dynamic libc_writev writev "libc.so" //go:cgo_import_dynamic libc_pwritev pwritev "libc.so" //go:cgo_import_dynamic libc_accept4 accept4 "libsocket.so" -//go:cgo_import_dynamic libc_putmsg putmsg "libc.so" -//go:cgo_import_dynamic libc_getmsg getmsg "libc.so" //go:linkname procreadv libc_readv //go:linkname procpreadv libc_preadv //go:linkname procwritev libc_writev //go:linkname procpwritev libc_pwritev //go:linkname procaccept4 libc_accept4 -//go:linkname procputmsg libc_putmsg -//go:linkname procgetmsg libc_getmsg var ( procreadv, procpreadv, procwritev, procpwritev, - procaccept4, - procputmsg, - procgetmsg syscallFunc + procaccept4 syscallFunc ) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -106,23 +100,3 @@ func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func putmsg(fd int, clptr *strbuf, dataptr *strbuf, flags int) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procputmsg)), 4, uintptr(fd), uintptr(unsafe.Pointer(clptr)), uintptr(unsafe.Pointer(dataptr)), uintptr(flags), 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getmsg(fd int, clptr *strbuf, dataptr *strbuf, flags *int) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetmsg)), 4, uintptr(fd), uintptr(unsafe.Pointer(clptr)), uintptr(unsafe.Pointer(dataptr)), uintptr(unsafe.Pointer(flags)), 0, 0) - if e1 != 0 { - err = e1 - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index bc4a2753114a..293cf36804e9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -2151,3 +2151,13 @@ func setitimer(which int, newValue *Itimerval, oldValue *Itimerval) (err error) } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func rtSigprocmask(how int, set *Sigset_t, oldset *Sigset_t, sigsetsize uintptr) (err error) { + _, _, e1 := RawSyscall6(SYS_RT_SIGPROCMASK, uintptr(how), uintptr(unsafe.Pointer(set)), uintptr(unsafe.Pointer(oldset)), uintptr(sigsetsize), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index 88af526b7e23..c81b0ad47772 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -287,46 +287,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID32, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID32, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID32, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID32, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) { r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) n = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index 2a0c4aa6a634..2206bce7f4dd 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -334,36 +334,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrlimit(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { @@ -374,16 +344,6 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index 4882bde3af0f..edf6b39f1615 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -412,46 +412,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID32, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID32, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID32, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID32, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go index 9f8c24e43438..190609f2140d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go @@ -289,36 +289,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func setrlimit(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { @@ -329,16 +299,6 @@ func setrlimit(resource int, rlim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go index 8cdfbe71e681..806ffd1e125e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go @@ -83,31 +83,6 @@ func Fchown(fd int, uid int, gid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fstatfs(fd int, buf *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(buf)), 0) if e1 != 0 { @@ -248,46 +223,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go index d7d6f42441be..5f984cbb1ca7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go @@ -248,46 +248,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go index 7f1f8e653390..46fc380a40e5 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go @@ -278,36 +278,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrlimit(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { @@ -318,16 +288,6 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go index f933d0f51a18..cbd0d4dadbad 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go @@ -278,36 +278,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrlimit(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { @@ -318,16 +288,6 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go index 297d0a998220..0c13d15f07cf 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go @@ -248,46 +248,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go index 2e32e7a449fd..e01432aed51f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go @@ -308,46 +308,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index 3c531704647d..13c7ee7baff6 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -349,36 +349,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrlimit(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { @@ -389,16 +359,6 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index a00c6744ecbd..02d0c0fd61ec 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -349,36 +349,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrlimit(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { @@ -389,16 +359,6 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go index a1a9bcbbdf61..9fee3b1d2396 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go @@ -180,6 +180,17 @@ func Listen(s int, n int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func MemfdSecret(flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_MEMFD_SECRET, uintptr(flags), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -258,36 +269,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrlimit(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { @@ -298,16 +279,6 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index e0dabc60278d..647bbfecd6aa 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -319,36 +319,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrlimit(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { @@ -359,16 +329,6 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) n = int64(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go index 368623c0f2e9..ada057f89144 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go @@ -329,36 +329,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrlimit(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { @@ -369,16 +339,6 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go index 4af561a48d8c..79f7389963ec 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go @@ -521,6 +521,16 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go index 3b90e9448add..fb161f3a2636 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go @@ -521,6 +521,16 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go index 890f4ccd131c..4c8ac993a880 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go @@ -521,6 +521,16 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go index c79f071fc6a8..76dd8ec4fdb9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go @@ -521,6 +521,16 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index a057fc5d3511..caeb807bd4e8 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -l32 -openbsd -tags openbsd,386 syscall_bsd.go syscall_openbsd.go syscall_openbsd_386.go +// go run mksyscall.go -l32 -openbsd -libc -tags openbsd,386 syscall_bsd.go syscall_openbsd.go syscall_openbsd_386.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && 386 @@ -16,7 +16,7 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + r0, _, e1 := syscall_rawSyscall(libc_getgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -24,20 +24,28 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } +var libc_getgroups_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getgroups getgroups "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + _, _, e1 := syscall_rawSyscall(libc_setgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setgroups_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setgroups setgroups "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_wait4_trampoline_addr, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -45,10 +53,14 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return } +var libc_wait4_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_wait4 wait4 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, _, e1 := syscall_syscall(libc_accept_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -56,30 +68,42 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } +var libc_accept_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_accept accept "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_bind_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_bind_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_bind bind "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_connect_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_connect_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_connect connect "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + r0, _, e1 := syscall_rawSyscall(libc_socket_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -87,66 +111,94 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } +var libc_socket_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_socket socket "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := syscall_syscall6(libc_getsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getsockopt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsockopt getsockopt "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := syscall_syscall6(libc_setsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setsockopt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setsockopt setsockopt "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getpeername_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getpeername_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpeername getpeername "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getsockname_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getsockname_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsockname getsockname "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_shutdown_trampoline_addr, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_shutdown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shutdown shutdown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := syscall_rawSyscall6(libc_socketpair_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_socketpair_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_socketpair socketpair "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { @@ -156,7 +208,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := syscall_syscall6(libc_recvfrom_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -164,6 +216,10 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } +var libc_recvfrom_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_recvfrom recvfrom "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { @@ -173,17 +229,21 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := syscall_syscall6(libc_sendto_trampoline_addr, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_sendto_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sendto sendto "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_recvmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -191,10 +251,14 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } +var libc_recvmsg_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_recvmsg recvmsg "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_sendmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -202,10 +266,14 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } +var libc_sendmsg_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sendmsg sendmsg "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + r0, _, e1 := syscall_syscall6(libc_kevent_trampoline_addr, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -213,6 +281,10 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne return } +var libc_kevent_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kevent kevent "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { @@ -221,27 +293,35 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_utimes_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_utimes_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_utimes utimes "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_futimes_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_futimes_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_futimes futimes "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + r0, _, e1 := syscall_syscall(libc_poll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -249,6 +329,10 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { return } +var libc_poll_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_poll poll "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Madvise(b []byte, behav int) (err error) { @@ -258,13 +342,17 @@ func Madvise(b []byte, behav int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) + _, _, e1 := syscall_syscall(libc_madvise_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(behav)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_madvise_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_madvise madvise "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { @@ -274,23 +362,31 @@ func Mlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_mlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mlock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mlock mlock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall(libc_mlockall_trampoline_addr, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mlockall_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mlockall mlockall "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { @@ -300,13 +396,17 @@ func Mprotect(b []byte, prot int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + _, _, e1 := syscall_syscall(libc_mprotect_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mprotect_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mprotect mprotect "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Msync(b []byte, flags int) (err error) { @@ -316,13 +416,17 @@ func Msync(b []byte, flags int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_msync_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_msync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_msync msync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { @@ -332,33 +436,45 @@ func Munlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_munlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_munlock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munlock munlock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) + _, _, e1 := syscall_syscall(libc_munlockall_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_munlockall_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munlockall munlockall "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + _, _, e1 := syscall_rawSyscall(libc_pipe2_trampoline_addr, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_pipe2_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdents(fd int, buf []byte) (n int, err error) { @@ -368,7 +484,7 @@ func Getdents(fd int, buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) + r0, _, e1 := syscall_syscall(libc_getdents_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -376,6 +492,10 @@ func Getdents(fd int, buf []byte) (n int, err error) { return } +var libc_getdents_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getdents getdents "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getcwd(buf []byte) (n int, err error) { @@ -385,7 +505,7 @@ func Getcwd(buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) + r0, _, e1 := syscall_syscall(libc_getcwd_trampoline_addr, uintptr(_p0), uintptr(len(buf)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -393,16 +513,24 @@ func Getcwd(buf []byte) (n int, err error) { return } +var libc_getcwd_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getcwd getcwd "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -412,17 +540,21 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := syscall_syscall6(libc_sysctl_trampoline_addr, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_sysctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sysctl sysctl "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -430,6 +562,10 @@ func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, return } +var libc_ppoll_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ppoll ppoll "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { @@ -438,23 +574,31 @@ func Access(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_access_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_access_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_access access "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + _, _, e1 := syscall_syscall(libc_adjtime_trampoline_addr, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_adjtime_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_adjtime adjtime "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { @@ -463,13 +607,17 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chdir chdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { @@ -478,13 +626,17 @@ func Chflags(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_chflags_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chflags_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chflags chflags "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { @@ -493,13 +645,17 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_chmod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chmod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chmod chmod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { @@ -508,13 +664,17 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_chown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chown chown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { @@ -523,27 +683,49 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chroot_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_chroot_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chroot chroot "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := syscall_syscall(libc_clock_gettime_trampoline_addr, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_clock_gettime_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_clock_gettime clock_gettime "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_close_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_close_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_close close "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := syscall_syscall(libc_dup_trampoline_addr, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -551,33 +733,49 @@ func Dup(fd int) (nfd int, err error) { return } +var libc_dup_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup dup "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := syscall_syscall(libc_dup2_trampoline_addr, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_dup2_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup2 dup2 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup3(from int, to int, flags int) (err error) { - _, _, e1 := Syscall(SYS_DUP3, uintptr(from), uintptr(to), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_dup3_trampoline_addr, uintptr(from), uintptr(to), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_dup3_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup3 dup3 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) + syscall_syscall(libc_exit_trampoline_addr, uintptr(code), 0, 0) return } +var libc_exit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_exit exit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -586,43 +784,59 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_faccessat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_faccessat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_faccessat faccessat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fchdir_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchdir fchdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_fchflags_trampoline_addr, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchflags_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchflags fchflags "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_fchmod_trampoline_addr, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchmod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchmod fchmod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -631,23 +845,31 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fchmodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchmodat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchmodat fchmodat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_fchown_trampoline_addr, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchown fchown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { @@ -656,27 +878,35 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_fchownat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchownat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchownat fchownat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_flock_trampoline_addr, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_flock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_flock flock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_fpathconf_trampoline_addr, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -684,16 +914,24 @@ func Fpathconf(fd int, name int) (val int, err error) { return } +var libc_fpathconf_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fpathconf fpathconf "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstat fstat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { @@ -702,71 +940,99 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fstatat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fstatat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstatat fstatat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstatfs_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fstatfs_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstatfs fstatfs "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fsync_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fsync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fsync fsync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall6(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0) + _, _, e1 := syscall_syscall(libc_ftruncate_trampoline_addr, uintptr(fd), uintptr(length), uintptr(length>>32)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_ftruncate_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ftruncate ftruncate "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getegid_trampoline_addr, 0, 0, 0) egid = int(r0) return } +var libc_getegid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getegid getegid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_geteuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } +var libc_geteuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_geteuid geteuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getgid_trampoline_addr, 0, 0, 0) gid = int(r0) return } +var libc_getgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getgid getgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getpgid_trampoline_addr, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -774,34 +1040,50 @@ func Getpgid(pid int) (pgid int, err error) { return } +var libc_getpgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpgid getpgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpgrp_trampoline_addr, 0, 0, 0) pgrp = int(r0) return } +var libc_getpgrp_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpgrp getpgrp "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpid_trampoline_addr, 0, 0, 0) pid = int(r0) return } +var libc_getpid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpid getpid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getppid_trampoline_addr, 0, 0, 0) ppid = int(r0) return } +var libc_getppid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getppid getppid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) + r0, _, e1 := syscall_syscall(libc_getpriority_trampoline_addr, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -809,20 +1091,28 @@ func Getpriority(which int, who int) (prio int, err error) { return } +var libc_getpriority_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpriority getpriority "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getrlimit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrlimit getrlimit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrtable() (rtable int, err error) { - r0, _, e1 := RawSyscall(SYS_GETRTABLE, 0, 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getrtable_trampoline_addr, 0, 0, 0) rtable = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -830,20 +1120,28 @@ func Getrtable() (rtable int, err error) { return } +var libc_getrtable_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrtable getrtable "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrusage_trampoline_addr, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getrusage_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrusage getrusage "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getsid_trampoline_addr, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -851,46 +1149,66 @@ func Getsid(pid int) (sid int, err error) { return } +var libc_getsid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsid getsid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_gettimeofday_trampoline_addr, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_gettimeofday_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_gettimeofday gettimeofday "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } +var libc_getuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getuid getuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) + r0, _, _ := syscall_syscall(libc_issetugid_trampoline_addr, 0, 0, 0) tainted = bool(r0 != 0) return } +var libc_issetugid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_issetugid issetugid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kill(pid int, signum syscall.Signal) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) + _, _, e1 := syscall_syscall(libc_kill_trampoline_addr, uintptr(pid), uintptr(signum), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_kill_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kill kill "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) + r0, _, e1 := syscall_syscall(libc_kqueue_trampoline_addr, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -898,6 +1216,10 @@ func Kqueue() (fd int, err error) { return } +var libc_kqueue_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kqueue kqueue "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { @@ -906,13 +1228,17 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_lchown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_lchown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lchown lchown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { @@ -926,13 +1252,17 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_link_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_link_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_link link "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { @@ -946,23 +1276,31 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er if err != nil { return } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_linkat_trampoline_addr, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_linkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_linkat linkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) + _, _, e1 := syscall_syscall(libc_listen_trampoline_addr, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_listen_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_listen listen "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { @@ -971,13 +1309,17 @@ func Lstat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_lstat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_lstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lstat lstat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(path string, mode uint32) (err error) { @@ -986,13 +1328,17 @@ func Mkdir(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkdir mkdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdirat(dirfd int, path string, mode uint32) (err error) { @@ -1001,13 +1347,17 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := syscall_syscall(libc_mkdirat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkdirat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkdirat mkdirat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { @@ -1016,13 +1366,17 @@ func Mkfifo(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkfifo_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkfifo_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkfifo mkfifo "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifoat(dirfd int, path string, mode uint32) (err error) { @@ -1031,13 +1385,17 @@ func Mkfifoat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := syscall_syscall(libc_mkfifoat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkfifoat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkfifoat mkfifoat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { @@ -1046,13 +1404,17 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + _, _, e1 := syscall_syscall(libc_mknod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mknod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mknod mknod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { @@ -1061,23 +1423,31 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) + _, _, e1 := syscall_syscall6(libc_mknodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mknodat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mknodat mknodat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Nanosleep(time *Timespec, leftover *Timespec) (err error) { - _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_nanosleep_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_nanosleep nanosleep "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { @@ -1086,7 +1456,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + r0, _, e1 := syscall_syscall(libc_open_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1094,6 +1464,10 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } +var libc_open_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_open open "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { @@ -1102,7 +1476,7 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + r0, _, e1 := syscall_syscall6(libc_openat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1110,6 +1484,10 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { return } +var libc_openat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_openat openat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { @@ -1118,7 +1496,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_pathconf_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1126,6 +1504,10 @@ func Pathconf(path string, name int) (val int, err error) { return } +var libc_pathconf_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pathconf pathconf "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pread(fd int, p []byte, offset int64) (n int, err error) { @@ -1135,7 +1517,7 @@ func pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) + r0, _, e1 := syscall_syscall6(libc_pread_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1143,6 +1525,10 @@ func pread(fd int, p []byte, offset int64) (n int, err error) { return } +var libc_pread_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pread pread "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pwrite(fd int, p []byte, offset int64) (n int, err error) { @@ -1152,7 +1538,7 @@ func pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) + r0, _, e1 := syscall_syscall6(libc_pwrite_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1160,6 +1546,10 @@ func pwrite(fd int, p []byte, offset int64) (n int, err error) { return } +var libc_pwrite_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pwrite pwrite "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { @@ -1169,7 +1559,7 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1177,6 +1567,10 @@ func read(fd int, p []byte) (n int, err error) { return } +var libc_read_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_read read "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { @@ -1191,7 +1585,7 @@ func Readlink(path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + r0, _, e1 := syscall_syscall(libc_readlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1199,6 +1593,10 @@ func Readlink(path string, buf []byte) (n int, err error) { return } +var libc_readlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readlink readlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { @@ -1213,7 +1611,7 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_readlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1221,6 +1619,10 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { return } +var libc_readlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readlinkat readlinkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { @@ -1234,13 +1636,17 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_rename_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_rename_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_rename rename "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Renameat(fromfd int, from string, tofd int, to string) (err error) { @@ -1254,13 +1660,17 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + _, _, e1 := syscall_syscall6(libc_renameat_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_renameat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renameat renameat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { @@ -1269,13 +1679,17 @@ func Revoke(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_revoke_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_revoke_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_revoke revoke "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { @@ -1284,17 +1698,21 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_rmdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_rmdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_rmdir rmdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), uintptr(whence), 0) + r0, r1, e1 := syscall_syscall6(libc_lseek_trampoline_addr, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) newoffset = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { err = errnoErr(e1) @@ -1302,10 +1720,14 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return } +var libc_lseek_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lseek lseek "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + r0, _, e1 := syscall_syscall6(libc_select_trampoline_addr, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1313,36 +1735,52 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err return } +var libc_select_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_select select "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setegid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setegid setegid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_seteuid_trampoline_addr, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_seteuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_seteuid seteuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setgid_trampoline_addr, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setgid setgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { @@ -1351,97 +1789,133 @@ func Setlogin(name string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_setlogin_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setlogin_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setlogin setlogin "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) + _, _, e1 := syscall_rawSyscall(libc_setpgid_trampoline_addr, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setpgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setpgid setpgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) + _, _, e1 := syscall_syscall(libc_setpriority_trampoline_addr, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setpriority_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setpriority setpriority "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + _, _, e1 := syscall_rawSyscall(libc_setregid_trampoline_addr, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setregid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setregid setregid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + _, _, e1 := syscall_rawSyscall(libc_setreuid_trampoline_addr, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setreuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setreuid setreuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) + _, _, e1 := syscall_rawSyscall(libc_setresgid_trampoline_addr, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setresgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setresgid setresgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) + _, _, e1 := syscall_rawSyscall(libc_setresuid_trampoline_addr, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setresuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setresuid setresuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setrlimit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrtable(rtable int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRTABLE, uintptr(rtable), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setrtable_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setrtable setrtable "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1449,26 +1923,38 @@ func Setsid() (pid int, err error) { return } +var libc_setsid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setsid setsid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_settimeofday_trampoline_addr, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_settimeofday_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_settimeofday settimeofday "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setuid_trampoline_addr, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setuid setuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { @@ -1477,13 +1963,17 @@ func Stat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_stat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_stat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_stat stat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, stat *Statfs_t) (err error) { @@ -1492,13 +1982,17 @@ func Statfs(path string, stat *Statfs_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_statfs_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_statfs_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_statfs statfs "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlink(path string, link string) (err error) { @@ -1512,13 +2006,17 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_symlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_symlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_symlink symlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { @@ -1532,23 +2030,31 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + _, _, e1 := syscall_syscall(libc_symlinkat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } +var libc_symlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_symlinkat symlinkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) + _, _, e1 := syscall_syscall(libc_sync_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_sync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sync sync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { @@ -1557,21 +2063,29 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0) + _, _, e1 := syscall_syscall(libc_truncate_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_truncate_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_truncate truncate "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) + r0, _, _ := syscall_syscall(libc_umask_trampoline_addr, uintptr(newmask), 0, 0) oldmask = int(r0) return } +var libc_umask_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_umask umask "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { @@ -1580,13 +2094,17 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_unlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_unlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unlink unlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlinkat(dirfd int, path string, flags int) (err error) { @@ -1595,13 +2113,17 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_unlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_unlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unlinkat unlinkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { @@ -1610,13 +2132,17 @@ func Unmount(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_unmount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_unmount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unmount unmount "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { @@ -1626,7 +2152,7 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1634,10 +2160,14 @@ func write(fd int, p []byte) (n int, err error) { return } +var libc_write_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_write write "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), uintptr(pos>>32), 0) + r0, _, e1 := syscall_syscall9(libc_mmap_trampoline_addr, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -1645,20 +2175,28 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } +var libc_mmap_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mmap mmap "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_munmap_trampoline_addr, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_munmap_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munmap munmap "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1669,7 +2207,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1685,9 +2223,13 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error if err != nil { return } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_utimensat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } + +var libc_utimensat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_utimensat utimensat "libc.so" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s new file mode 100644 index 000000000000..087444250c9a --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s @@ -0,0 +1,669 @@ +// go run mkasm.go openbsd 386 +// Code generated by the command above; DO NOT EDIT. + +#include "textflag.h" + +TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getgroups(SB) +GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getgroups_trampoline_addr(SB)/4, $libc_getgroups_trampoline<>(SB) + +TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setgroups(SB) +GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setgroups_trampoline_addr(SB)/4, $libc_setgroups_trampoline<>(SB) + +TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_wait4(SB) +GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $4 +DATA ·libc_wait4_trampoline_addr(SB)/4, $libc_wait4_trampoline<>(SB) + +TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_accept(SB) +GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $4 +DATA ·libc_accept_trampoline_addr(SB)/4, $libc_accept_trampoline<>(SB) + +TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_bind(SB) +GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $4 +DATA ·libc_bind_trampoline_addr(SB)/4, $libc_bind_trampoline<>(SB) + +TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_connect(SB) +GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $4 +DATA ·libc_connect_trampoline_addr(SB)/4, $libc_connect_trampoline<>(SB) + +TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_socket(SB) +GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $4 +DATA ·libc_socket_trampoline_addr(SB)/4, $libc_socket_trampoline<>(SB) + +TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsockopt(SB) +GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getsockopt_trampoline_addr(SB)/4, $libc_getsockopt_trampoline<>(SB) + +TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setsockopt(SB) +GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setsockopt_trampoline_addr(SB)/4, $libc_setsockopt_trampoline<>(SB) + +TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpeername(SB) +GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getpeername_trampoline_addr(SB)/4, $libc_getpeername_trampoline<>(SB) + +TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsockname(SB) +GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getsockname_trampoline_addr(SB)/4, $libc_getsockname_trampoline<>(SB) + +TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shutdown(SB) +GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $4 +DATA ·libc_shutdown_trampoline_addr(SB)/4, $libc_shutdown_trampoline<>(SB) + +TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_socketpair(SB) +GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $4 +DATA ·libc_socketpair_trampoline_addr(SB)/4, $libc_socketpair_trampoline<>(SB) + +TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_recvfrom(SB) +GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $4 +DATA ·libc_recvfrom_trampoline_addr(SB)/4, $libc_recvfrom_trampoline<>(SB) + +TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sendto(SB) +GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $4 +DATA ·libc_sendto_trampoline_addr(SB)/4, $libc_sendto_trampoline<>(SB) + +TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_recvmsg(SB) +GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $4 +DATA ·libc_recvmsg_trampoline_addr(SB)/4, $libc_recvmsg_trampoline<>(SB) + +TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sendmsg(SB) +GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $4 +DATA ·libc_sendmsg_trampoline_addr(SB)/4, $libc_sendmsg_trampoline<>(SB) + +TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kevent(SB) +GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $4 +DATA ·libc_kevent_trampoline_addr(SB)/4, $libc_kevent_trampoline<>(SB) + +TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_utimes(SB) +GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $4 +DATA ·libc_utimes_trampoline_addr(SB)/4, $libc_utimes_trampoline<>(SB) + +TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_futimes(SB) +GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $4 +DATA ·libc_futimes_trampoline_addr(SB)/4, $libc_futimes_trampoline<>(SB) + +TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_poll(SB) +GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $4 +DATA ·libc_poll_trampoline_addr(SB)/4, $libc_poll_trampoline<>(SB) + +TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_madvise(SB) +GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $4 +DATA ·libc_madvise_trampoline_addr(SB)/4, $libc_madvise_trampoline<>(SB) + +TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mlock(SB) +GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mlock_trampoline_addr(SB)/4, $libc_mlock_trampoline<>(SB) + +TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mlockall(SB) +GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mlockall_trampoline_addr(SB)/4, $libc_mlockall_trampoline<>(SB) + +TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mprotect(SB) +GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mprotect_trampoline_addr(SB)/4, $libc_mprotect_trampoline<>(SB) + +TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_msync(SB) +GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $4 +DATA ·libc_msync_trampoline_addr(SB)/4, $libc_msync_trampoline<>(SB) + +TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munlock(SB) +GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $4 +DATA ·libc_munlock_trampoline_addr(SB)/4, $libc_munlock_trampoline<>(SB) + +TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munlockall(SB) +GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $4 +DATA ·libc_munlockall_trampoline_addr(SB)/4, $libc_munlockall_trampoline<>(SB) + +TEXT libc_pipe2_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pipe2(SB) +GLOBL ·libc_pipe2_trampoline_addr(SB), RODATA, $4 +DATA ·libc_pipe2_trampoline_addr(SB)/4, $libc_pipe2_trampoline<>(SB) + +TEXT libc_getdents_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getdents(SB) +GLOBL ·libc_getdents_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getdents_trampoline_addr(SB)/4, $libc_getdents_trampoline<>(SB) + +TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getcwd(SB) +GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getcwd_trampoline_addr(SB)/4, $libc_getcwd_trampoline<>(SB) + +TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ioctl(SB) +GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $4 +DATA ·libc_ioctl_trampoline_addr(SB)/4, $libc_ioctl_trampoline<>(SB) + +TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sysctl(SB) +GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $4 +DATA ·libc_sysctl_trampoline_addr(SB)/4, $libc_sysctl_trampoline<>(SB) + +TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ppoll(SB) +GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $4 +DATA ·libc_ppoll_trampoline_addr(SB)/4, $libc_ppoll_trampoline<>(SB) + +TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_access(SB) +GLOBL ·libc_access_trampoline_addr(SB), RODATA, $4 +DATA ·libc_access_trampoline_addr(SB)/4, $libc_access_trampoline<>(SB) + +TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_adjtime(SB) +GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $4 +DATA ·libc_adjtime_trampoline_addr(SB)/4, $libc_adjtime_trampoline<>(SB) + +TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chdir(SB) +GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $4 +DATA ·libc_chdir_trampoline_addr(SB)/4, $libc_chdir_trampoline<>(SB) + +TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chflags(SB) +GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $4 +DATA ·libc_chflags_trampoline_addr(SB)/4, $libc_chflags_trampoline<>(SB) + +TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chmod(SB) +GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $4 +DATA ·libc_chmod_trampoline_addr(SB)/4, $libc_chmod_trampoline<>(SB) + +TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chown(SB) +GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $4 +DATA ·libc_chown_trampoline_addr(SB)/4, $libc_chown_trampoline<>(SB) + +TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chroot(SB) +GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $4 +DATA ·libc_chroot_trampoline_addr(SB)/4, $libc_chroot_trampoline<>(SB) + +TEXT libc_clock_gettime_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_clock_gettime(SB) +GLOBL ·libc_clock_gettime_trampoline_addr(SB), RODATA, $4 +DATA ·libc_clock_gettime_trampoline_addr(SB)/4, $libc_clock_gettime_trampoline<>(SB) + +TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_close(SB) +GLOBL ·libc_close_trampoline_addr(SB), RODATA, $4 +DATA ·libc_close_trampoline_addr(SB)/4, $libc_close_trampoline<>(SB) + +TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup(SB) +GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $4 +DATA ·libc_dup_trampoline_addr(SB)/4, $libc_dup_trampoline<>(SB) + +TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup2(SB) +GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $4 +DATA ·libc_dup2_trampoline_addr(SB)/4, $libc_dup2_trampoline<>(SB) + +TEXT libc_dup3_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup3(SB) +GLOBL ·libc_dup3_trampoline_addr(SB), RODATA, $4 +DATA ·libc_dup3_trampoline_addr(SB)/4, $libc_dup3_trampoline<>(SB) + +TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_exit(SB) +GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $4 +DATA ·libc_exit_trampoline_addr(SB)/4, $libc_exit_trampoline<>(SB) + +TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_faccessat(SB) +GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_faccessat_trampoline_addr(SB)/4, $libc_faccessat_trampoline<>(SB) + +TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchdir(SB) +GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fchdir_trampoline_addr(SB)/4, $libc_fchdir_trampoline<>(SB) + +TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchflags(SB) +GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fchflags_trampoline_addr(SB)/4, $libc_fchflags_trampoline<>(SB) + +TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchmod(SB) +GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fchmod_trampoline_addr(SB)/4, $libc_fchmod_trampoline<>(SB) + +TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchmodat(SB) +GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fchmodat_trampoline_addr(SB)/4, $libc_fchmodat_trampoline<>(SB) + +TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchown(SB) +GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fchown_trampoline_addr(SB)/4, $libc_fchown_trampoline<>(SB) + +TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchownat(SB) +GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fchownat_trampoline_addr(SB)/4, $libc_fchownat_trampoline<>(SB) + +TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_flock(SB) +GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $4 +DATA ·libc_flock_trampoline_addr(SB)/4, $libc_flock_trampoline<>(SB) + +TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fpathconf(SB) +GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fpathconf_trampoline_addr(SB)/4, $libc_fpathconf_trampoline<>(SB) + +TEXT libc_fstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstat(SB) +GLOBL ·libc_fstat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fstat_trampoline_addr(SB)/4, $libc_fstat_trampoline<>(SB) + +TEXT libc_fstatat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstatat(SB) +GLOBL ·libc_fstatat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fstatat_trampoline_addr(SB)/4, $libc_fstatat_trampoline<>(SB) + +TEXT libc_fstatfs_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstatfs(SB) +GLOBL ·libc_fstatfs_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fstatfs_trampoline_addr(SB)/4, $libc_fstatfs_trampoline<>(SB) + +TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fsync(SB) +GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fsync_trampoline_addr(SB)/4, $libc_fsync_trampoline<>(SB) + +TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ftruncate(SB) +GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $4 +DATA ·libc_ftruncate_trampoline_addr(SB)/4, $libc_ftruncate_trampoline<>(SB) + +TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getegid(SB) +GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getegid_trampoline_addr(SB)/4, $libc_getegid_trampoline<>(SB) + +TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_geteuid(SB) +GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_geteuid_trampoline_addr(SB)/4, $libc_geteuid_trampoline<>(SB) + +TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getgid(SB) +GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getgid_trampoline_addr(SB)/4, $libc_getgid_trampoline<>(SB) + +TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpgid(SB) +GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getpgid_trampoline_addr(SB)/4, $libc_getpgid_trampoline<>(SB) + +TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpgrp(SB) +GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getpgrp_trampoline_addr(SB)/4, $libc_getpgrp_trampoline<>(SB) + +TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpid(SB) +GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getpid_trampoline_addr(SB)/4, $libc_getpid_trampoline<>(SB) + +TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getppid(SB) +GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getppid_trampoline_addr(SB)/4, $libc_getppid_trampoline<>(SB) + +TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpriority(SB) +GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getpriority_trampoline_addr(SB)/4, $libc_getpriority_trampoline<>(SB) + +TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrlimit(SB) +GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getrlimit_trampoline_addr(SB)/4, $libc_getrlimit_trampoline<>(SB) + +TEXT libc_getrtable_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrtable(SB) +GLOBL ·libc_getrtable_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getrtable_trampoline_addr(SB)/4, $libc_getrtable_trampoline<>(SB) + +TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrusage(SB) +GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getrusage_trampoline_addr(SB)/4, $libc_getrusage_trampoline<>(SB) + +TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsid(SB) +GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getsid_trampoline_addr(SB)/4, $libc_getsid_trampoline<>(SB) + +TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_gettimeofday(SB) +GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $4 +DATA ·libc_gettimeofday_trampoline_addr(SB)/4, $libc_gettimeofday_trampoline<>(SB) + +TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getuid(SB) +GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getuid_trampoline_addr(SB)/4, $libc_getuid_trampoline<>(SB) + +TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_issetugid(SB) +GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_issetugid_trampoline_addr(SB)/4, $libc_issetugid_trampoline<>(SB) + +TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kill(SB) +GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $4 +DATA ·libc_kill_trampoline_addr(SB)/4, $libc_kill_trampoline<>(SB) + +TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kqueue(SB) +GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $4 +DATA ·libc_kqueue_trampoline_addr(SB)/4, $libc_kqueue_trampoline<>(SB) + +TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lchown(SB) +GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $4 +DATA ·libc_lchown_trampoline_addr(SB)/4, $libc_lchown_trampoline<>(SB) + +TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_link(SB) +GLOBL ·libc_link_trampoline_addr(SB), RODATA, $4 +DATA ·libc_link_trampoline_addr(SB)/4, $libc_link_trampoline<>(SB) + +TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_linkat(SB) +GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_linkat_trampoline_addr(SB)/4, $libc_linkat_trampoline<>(SB) + +TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_listen(SB) +GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $4 +DATA ·libc_listen_trampoline_addr(SB)/4, $libc_listen_trampoline<>(SB) + +TEXT libc_lstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lstat(SB) +GLOBL ·libc_lstat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_lstat_trampoline_addr(SB)/4, $libc_lstat_trampoline<>(SB) + +TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkdir(SB) +GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mkdir_trampoline_addr(SB)/4, $libc_mkdir_trampoline<>(SB) + +TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkdirat(SB) +GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mkdirat_trampoline_addr(SB)/4, $libc_mkdirat_trampoline<>(SB) + +TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkfifo(SB) +GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mkfifo_trampoline_addr(SB)/4, $libc_mkfifo_trampoline<>(SB) + +TEXT libc_mkfifoat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkfifoat(SB) +GLOBL ·libc_mkfifoat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mkfifoat_trampoline_addr(SB)/4, $libc_mkfifoat_trampoline<>(SB) + +TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mknod(SB) +GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mknod_trampoline_addr(SB)/4, $libc_mknod_trampoline<>(SB) + +TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mknodat(SB) +GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mknodat_trampoline_addr(SB)/4, $libc_mknodat_trampoline<>(SB) + +TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_nanosleep(SB) +GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $4 +DATA ·libc_nanosleep_trampoline_addr(SB)/4, $libc_nanosleep_trampoline<>(SB) + +TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_open(SB) +GLOBL ·libc_open_trampoline_addr(SB), RODATA, $4 +DATA ·libc_open_trampoline_addr(SB)/4, $libc_open_trampoline<>(SB) + +TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_openat(SB) +GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_openat_trampoline_addr(SB)/4, $libc_openat_trampoline<>(SB) + +TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pathconf(SB) +GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $4 +DATA ·libc_pathconf_trampoline_addr(SB)/4, $libc_pathconf_trampoline<>(SB) + +TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pread(SB) +GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $4 +DATA ·libc_pread_trampoline_addr(SB)/4, $libc_pread_trampoline<>(SB) + +TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pwrite(SB) +GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $4 +DATA ·libc_pwrite_trampoline_addr(SB)/4, $libc_pwrite_trampoline<>(SB) + +TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_read(SB) +GLOBL ·libc_read_trampoline_addr(SB), RODATA, $4 +DATA ·libc_read_trampoline_addr(SB)/4, $libc_read_trampoline<>(SB) + +TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readlink(SB) +GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $4 +DATA ·libc_readlink_trampoline_addr(SB)/4, $libc_readlink_trampoline<>(SB) + +TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readlinkat(SB) +GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_readlinkat_trampoline_addr(SB)/4, $libc_readlinkat_trampoline<>(SB) + +TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_rename(SB) +GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $4 +DATA ·libc_rename_trampoline_addr(SB)/4, $libc_rename_trampoline<>(SB) + +TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renameat(SB) +GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_renameat_trampoline_addr(SB)/4, $libc_renameat_trampoline<>(SB) + +TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_revoke(SB) +GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $4 +DATA ·libc_revoke_trampoline_addr(SB)/4, $libc_revoke_trampoline<>(SB) + +TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_rmdir(SB) +GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $4 +DATA ·libc_rmdir_trampoline_addr(SB)/4, $libc_rmdir_trampoline<>(SB) + +TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lseek(SB) +GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $4 +DATA ·libc_lseek_trampoline_addr(SB)/4, $libc_lseek_trampoline<>(SB) + +TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_select(SB) +GLOBL ·libc_select_trampoline_addr(SB), RODATA, $4 +DATA ·libc_select_trampoline_addr(SB)/4, $libc_select_trampoline<>(SB) + +TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setegid(SB) +GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setegid_trampoline_addr(SB)/4, $libc_setegid_trampoline<>(SB) + +TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_seteuid(SB) +GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_seteuid_trampoline_addr(SB)/4, $libc_seteuid_trampoline<>(SB) + +TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setgid(SB) +GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setgid_trampoline_addr(SB)/4, $libc_setgid_trampoline<>(SB) + +TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setlogin(SB) +GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setlogin_trampoline_addr(SB)/4, $libc_setlogin_trampoline<>(SB) + +TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setpgid(SB) +GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setpgid_trampoline_addr(SB)/4, $libc_setpgid_trampoline<>(SB) + +TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setpriority(SB) +GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setpriority_trampoline_addr(SB)/4, $libc_setpriority_trampoline<>(SB) + +TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setregid(SB) +GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setregid_trampoline_addr(SB)/4, $libc_setregid_trampoline<>(SB) + +TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setreuid(SB) +GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setreuid_trampoline_addr(SB)/4, $libc_setreuid_trampoline<>(SB) + +TEXT libc_setresgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setresgid(SB) +GLOBL ·libc_setresgid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setresgid_trampoline_addr(SB)/4, $libc_setresgid_trampoline<>(SB) + +TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setresuid(SB) +GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setresuid_trampoline_addr(SB)/4, $libc_setresuid_trampoline<>(SB) + +TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setrlimit(SB) +GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setrlimit_trampoline_addr(SB)/4, $libc_setrlimit_trampoline<>(SB) + +TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setrtable(SB) +GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setrtable_trampoline_addr(SB)/4, $libc_setrtable_trampoline<>(SB) + +TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setsid(SB) +GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setsid_trampoline_addr(SB)/4, $libc_setsid_trampoline<>(SB) + +TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_settimeofday(SB) +GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $4 +DATA ·libc_settimeofday_trampoline_addr(SB)/4, $libc_settimeofday_trampoline<>(SB) + +TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setuid(SB) +GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setuid_trampoline_addr(SB)/4, $libc_setuid_trampoline<>(SB) + +TEXT libc_stat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_stat(SB) +GLOBL ·libc_stat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_stat_trampoline_addr(SB)/4, $libc_stat_trampoline<>(SB) + +TEXT libc_statfs_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_statfs(SB) +GLOBL ·libc_statfs_trampoline_addr(SB), RODATA, $4 +DATA ·libc_statfs_trampoline_addr(SB)/4, $libc_statfs_trampoline<>(SB) + +TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_symlink(SB) +GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $4 +DATA ·libc_symlink_trampoline_addr(SB)/4, $libc_symlink_trampoline<>(SB) + +TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_symlinkat(SB) +GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_symlinkat_trampoline_addr(SB)/4, $libc_symlinkat_trampoline<>(SB) + +TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sync(SB) +GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $4 +DATA ·libc_sync_trampoline_addr(SB)/4, $libc_sync_trampoline<>(SB) + +TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_truncate(SB) +GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $4 +DATA ·libc_truncate_trampoline_addr(SB)/4, $libc_truncate_trampoline<>(SB) + +TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_umask(SB) +GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $4 +DATA ·libc_umask_trampoline_addr(SB)/4, $libc_umask_trampoline<>(SB) + +TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unlink(SB) +GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $4 +DATA ·libc_unlink_trampoline_addr(SB)/4, $libc_unlink_trampoline<>(SB) + +TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unlinkat(SB) +GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_unlinkat_trampoline_addr(SB)/4, $libc_unlinkat_trampoline<>(SB) + +TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unmount(SB) +GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $4 +DATA ·libc_unmount_trampoline_addr(SB)/4, $libc_unmount_trampoline<>(SB) + +TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_write(SB) +GLOBL ·libc_write_trampoline_addr(SB), RODATA, $4 +DATA ·libc_write_trampoline_addr(SB)/4, $libc_write_trampoline<>(SB) + +TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mmap(SB) +GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mmap_trampoline_addr(SB)/4, $libc_mmap_trampoline<>(SB) + +TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munmap(SB) +GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $4 +DATA ·libc_munmap_trampoline_addr(SB)/4, $libc_munmap_trampoline<>(SB) + +TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_utimensat(SB) +GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_utimensat_trampoline_addr(SB)/4, $libc_utimensat_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index 04db8fa2fea8..a05e5f4fff6d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -openbsd -tags openbsd,amd64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_amd64.go +// go run mksyscall.go -openbsd -libc -tags openbsd,amd64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && amd64 @@ -16,7 +16,7 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + r0, _, e1 := syscall_rawSyscall(libc_getgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -24,20 +24,28 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } +var libc_getgroups_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getgroups getgroups "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + _, _, e1 := syscall_rawSyscall(libc_setgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setgroups_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setgroups setgroups "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_wait4_trampoline_addr, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -45,10 +53,14 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return } +var libc_wait4_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_wait4 wait4 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, _, e1 := syscall_syscall(libc_accept_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -56,30 +68,42 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } +var libc_accept_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_accept accept "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_bind_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_bind_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_bind bind "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_connect_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_connect_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_connect connect "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + r0, _, e1 := syscall_rawSyscall(libc_socket_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -87,66 +111,94 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } +var libc_socket_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_socket socket "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := syscall_syscall6(libc_getsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getsockopt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsockopt getsockopt "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := syscall_syscall6(libc_setsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setsockopt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setsockopt setsockopt "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getpeername_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getpeername_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpeername getpeername "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getsockname_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getsockname_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsockname getsockname "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_shutdown_trampoline_addr, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_shutdown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shutdown shutdown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := syscall_rawSyscall6(libc_socketpair_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_socketpair_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_socketpair socketpair "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { @@ -156,7 +208,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := syscall_syscall6(libc_recvfrom_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -164,6 +216,10 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } +var libc_recvfrom_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_recvfrom recvfrom "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { @@ -173,17 +229,21 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := syscall_syscall6(libc_sendto_trampoline_addr, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_sendto_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sendto sendto "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_recvmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -191,10 +251,14 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } +var libc_recvmsg_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_recvmsg recvmsg "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_sendmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -202,10 +266,14 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } +var libc_sendmsg_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sendmsg sendmsg "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + r0, _, e1 := syscall_syscall6(libc_kevent_trampoline_addr, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -213,6 +281,10 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne return } +var libc_kevent_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kevent kevent "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { @@ -221,27 +293,35 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_utimes_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_utimes_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_utimes utimes "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_futimes_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_futimes_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_futimes futimes "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + r0, _, e1 := syscall_syscall(libc_poll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -249,6 +329,10 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { return } +var libc_poll_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_poll poll "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Madvise(b []byte, behav int) (err error) { @@ -258,13 +342,17 @@ func Madvise(b []byte, behav int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) + _, _, e1 := syscall_syscall(libc_madvise_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(behav)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_madvise_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_madvise madvise "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { @@ -274,23 +362,31 @@ func Mlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_mlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mlock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mlock mlock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall(libc_mlockall_trampoline_addr, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mlockall_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mlockall mlockall "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { @@ -300,13 +396,17 @@ func Mprotect(b []byte, prot int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + _, _, e1 := syscall_syscall(libc_mprotect_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mprotect_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mprotect mprotect "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Msync(b []byte, flags int) (err error) { @@ -316,13 +416,17 @@ func Msync(b []byte, flags int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_msync_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_msync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_msync msync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { @@ -332,33 +436,45 @@ func Munlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_munlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_munlock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munlock munlock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) + _, _, e1 := syscall_syscall(libc_munlockall_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_munlockall_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munlockall munlockall "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + _, _, e1 := syscall_rawSyscall(libc_pipe2_trampoline_addr, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_pipe2_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdents(fd int, buf []byte) (n int, err error) { @@ -368,7 +484,7 @@ func Getdents(fd int, buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) + r0, _, e1 := syscall_syscall(libc_getdents_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -376,6 +492,10 @@ func Getdents(fd int, buf []byte) (n int, err error) { return } +var libc_getdents_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getdents getdents "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getcwd(buf []byte) (n int, err error) { @@ -385,7 +505,7 @@ func Getcwd(buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) + r0, _, e1 := syscall_syscall(libc_getcwd_trampoline_addr, uintptr(_p0), uintptr(len(buf)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -393,16 +513,24 @@ func Getcwd(buf []byte) (n int, err error) { return } +var libc_getcwd_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getcwd getcwd "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -412,17 +540,21 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := syscall_syscall6(libc_sysctl_trampoline_addr, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_sysctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sysctl sysctl "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -430,6 +562,10 @@ func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, return } +var libc_ppoll_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ppoll ppoll "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { @@ -438,23 +574,31 @@ func Access(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_access_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_access_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_access access "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + _, _, e1 := syscall_syscall(libc_adjtime_trampoline_addr, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_adjtime_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_adjtime adjtime "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { @@ -463,13 +607,17 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chdir chdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { @@ -478,13 +626,17 @@ func Chflags(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_chflags_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chflags_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chflags chflags "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { @@ -493,13 +645,17 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_chmod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chmod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chmod chmod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { @@ -508,13 +664,17 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_chown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chown chown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { @@ -523,27 +683,49 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chroot_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_chroot_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chroot chroot "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := syscall_syscall(libc_clock_gettime_trampoline_addr, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_clock_gettime_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_clock_gettime clock_gettime "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_close_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_close_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_close close "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := syscall_syscall(libc_dup_trampoline_addr, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -551,33 +733,49 @@ func Dup(fd int) (nfd int, err error) { return } +var libc_dup_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup dup "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := syscall_syscall(libc_dup2_trampoline_addr, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_dup2_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup2 dup2 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup3(from int, to int, flags int) (err error) { - _, _, e1 := Syscall(SYS_DUP3, uintptr(from), uintptr(to), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_dup3_trampoline_addr, uintptr(from), uintptr(to), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_dup3_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup3 dup3 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) + syscall_syscall(libc_exit_trampoline_addr, uintptr(code), 0, 0) return } +var libc_exit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_exit exit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -586,43 +784,59 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_faccessat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_faccessat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_faccessat faccessat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fchdir_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchdir fchdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_fchflags_trampoline_addr, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchflags_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchflags fchflags "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_fchmod_trampoline_addr, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchmod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchmod fchmod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -631,23 +845,31 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fchmodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchmodat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchmodat fchmodat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_fchown_trampoline_addr, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchown fchown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { @@ -656,27 +878,35 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_fchownat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchownat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchownat fchownat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_flock_trampoline_addr, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_flock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_flock flock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_fpathconf_trampoline_addr, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -684,16 +914,24 @@ func Fpathconf(fd int, name int) (val int, err error) { return } +var libc_fpathconf_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fpathconf fpathconf "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstat fstat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { @@ -702,71 +940,99 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fstatat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fstatat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstatat fstatat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstatfs_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fstatfs_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstatfs fstatfs "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fsync_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fsync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fsync fsync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length)) + _, _, e1 := syscall_syscall(libc_ftruncate_trampoline_addr, uintptr(fd), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_ftruncate_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ftruncate ftruncate "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getegid_trampoline_addr, 0, 0, 0) egid = int(r0) return } +var libc_getegid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getegid getegid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_geteuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } +var libc_geteuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_geteuid geteuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getgid_trampoline_addr, 0, 0, 0) gid = int(r0) return } +var libc_getgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getgid getgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getpgid_trampoline_addr, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -774,34 +1040,50 @@ func Getpgid(pid int) (pgid int, err error) { return } +var libc_getpgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpgid getpgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpgrp_trampoline_addr, 0, 0, 0) pgrp = int(r0) return } +var libc_getpgrp_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpgrp getpgrp "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpid_trampoline_addr, 0, 0, 0) pid = int(r0) return } +var libc_getpid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpid getpid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getppid_trampoline_addr, 0, 0, 0) ppid = int(r0) return } +var libc_getppid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getppid getppid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) + r0, _, e1 := syscall_syscall(libc_getpriority_trampoline_addr, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -809,20 +1091,28 @@ func Getpriority(which int, who int) (prio int, err error) { return } +var libc_getpriority_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpriority getpriority "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getrlimit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrlimit getrlimit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrtable() (rtable int, err error) { - r0, _, e1 := RawSyscall(SYS_GETRTABLE, 0, 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getrtable_trampoline_addr, 0, 0, 0) rtable = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -830,20 +1120,28 @@ func Getrtable() (rtable int, err error) { return } +var libc_getrtable_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrtable getrtable "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrusage_trampoline_addr, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getrusage_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrusage getrusage "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getsid_trampoline_addr, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -851,46 +1149,66 @@ func Getsid(pid int) (sid int, err error) { return } +var libc_getsid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsid getsid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_gettimeofday_trampoline_addr, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_gettimeofday_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_gettimeofday gettimeofday "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } +var libc_getuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getuid getuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) + r0, _, _ := syscall_syscall(libc_issetugid_trampoline_addr, 0, 0, 0) tainted = bool(r0 != 0) return } +var libc_issetugid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_issetugid issetugid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kill(pid int, signum syscall.Signal) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) + _, _, e1 := syscall_syscall(libc_kill_trampoline_addr, uintptr(pid), uintptr(signum), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_kill_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kill kill "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) + r0, _, e1 := syscall_syscall(libc_kqueue_trampoline_addr, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -898,6 +1216,10 @@ func Kqueue() (fd int, err error) { return } +var libc_kqueue_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kqueue kqueue "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { @@ -906,13 +1228,17 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_lchown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_lchown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lchown lchown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { @@ -926,13 +1252,17 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_link_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_link_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_link link "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { @@ -946,23 +1276,31 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er if err != nil { return } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_linkat_trampoline_addr, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_linkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_linkat linkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) + _, _, e1 := syscall_syscall(libc_listen_trampoline_addr, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_listen_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_listen listen "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { @@ -971,13 +1309,17 @@ func Lstat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_lstat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_lstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lstat lstat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(path string, mode uint32) (err error) { @@ -986,13 +1328,17 @@ func Mkdir(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkdir mkdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdirat(dirfd int, path string, mode uint32) (err error) { @@ -1001,13 +1347,17 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := syscall_syscall(libc_mkdirat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkdirat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkdirat mkdirat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { @@ -1016,13 +1366,17 @@ func Mkfifo(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkfifo_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkfifo_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkfifo mkfifo "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifoat(dirfd int, path string, mode uint32) (err error) { @@ -1031,13 +1385,17 @@ func Mkfifoat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := syscall_syscall(libc_mkfifoat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkfifoat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkfifoat mkfifoat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { @@ -1046,13 +1404,17 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + _, _, e1 := syscall_syscall(libc_mknod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mknod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mknod mknod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { @@ -1061,23 +1423,31 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) + _, _, e1 := syscall_syscall6(libc_mknodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mknodat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mknodat mknodat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Nanosleep(time *Timespec, leftover *Timespec) (err error) { - _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_nanosleep_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_nanosleep nanosleep "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { @@ -1086,7 +1456,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + r0, _, e1 := syscall_syscall(libc_open_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1094,6 +1464,10 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } +var libc_open_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_open open "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { @@ -1102,7 +1476,7 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + r0, _, e1 := syscall_syscall6(libc_openat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1110,6 +1484,10 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { return } +var libc_openat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_openat openat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { @@ -1118,7 +1496,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_pathconf_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1126,6 +1504,10 @@ func Pathconf(path string, name int) (val int, err error) { return } +var libc_pathconf_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pathconf pathconf "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pread(fd int, p []byte, offset int64) (n int, err error) { @@ -1135,7 +1517,7 @@ func pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) + r0, _, e1 := syscall_syscall6(libc_pread_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1143,6 +1525,10 @@ func pread(fd int, p []byte, offset int64) (n int, err error) { return } +var libc_pread_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pread pread "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pwrite(fd int, p []byte, offset int64) (n int, err error) { @@ -1152,7 +1538,7 @@ func pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) + r0, _, e1 := syscall_syscall6(libc_pwrite_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1160,6 +1546,10 @@ func pwrite(fd int, p []byte, offset int64) (n int, err error) { return } +var libc_pwrite_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pwrite pwrite "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { @@ -1169,7 +1559,7 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1177,6 +1567,10 @@ func read(fd int, p []byte) (n int, err error) { return } +var libc_read_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_read read "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { @@ -1191,7 +1585,7 @@ func Readlink(path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + r0, _, e1 := syscall_syscall(libc_readlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1199,6 +1593,10 @@ func Readlink(path string, buf []byte) (n int, err error) { return } +var libc_readlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readlink readlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { @@ -1213,7 +1611,7 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_readlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1221,6 +1619,10 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { return } +var libc_readlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readlinkat readlinkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { @@ -1234,13 +1636,17 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_rename_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_rename_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_rename rename "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Renameat(fromfd int, from string, tofd int, to string) (err error) { @@ -1254,13 +1660,17 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + _, _, e1 := syscall_syscall6(libc_renameat_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_renameat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renameat renameat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { @@ -1269,13 +1679,17 @@ func Revoke(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_revoke_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_revoke_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_revoke revoke "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { @@ -1284,17 +1698,21 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_rmdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_rmdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_rmdir rmdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0) + r0, _, e1 := syscall_syscall(libc_lseek_trampoline_addr, uintptr(fd), uintptr(offset), uintptr(whence)) newoffset = int64(r0) if e1 != 0 { err = errnoErr(e1) @@ -1302,10 +1720,14 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return } +var libc_lseek_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lseek lseek "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + r0, _, e1 := syscall_syscall6(libc_select_trampoline_addr, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1313,36 +1735,52 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err return } +var libc_select_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_select select "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setegid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setegid setegid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_seteuid_trampoline_addr, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_seteuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_seteuid seteuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setgid_trampoline_addr, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setgid setgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { @@ -1351,97 +1789,133 @@ func Setlogin(name string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_setlogin_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setlogin_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setlogin setlogin "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) + _, _, e1 := syscall_rawSyscall(libc_setpgid_trampoline_addr, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setpgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setpgid setpgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) + _, _, e1 := syscall_syscall(libc_setpriority_trampoline_addr, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setpriority_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setpriority setpriority "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + _, _, e1 := syscall_rawSyscall(libc_setregid_trampoline_addr, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setregid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setregid setregid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + _, _, e1 := syscall_rawSyscall(libc_setreuid_trampoline_addr, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setreuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setreuid setreuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) + _, _, e1 := syscall_rawSyscall(libc_setresgid_trampoline_addr, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setresgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setresgid setresgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) + _, _, e1 := syscall_rawSyscall(libc_setresuid_trampoline_addr, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setresuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setresuid setresuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setrlimit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrtable(rtable int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRTABLE, uintptr(rtable), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setrtable_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setrtable setrtable "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1449,26 +1923,38 @@ func Setsid() (pid int, err error) { return } +var libc_setsid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setsid setsid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_settimeofday_trampoline_addr, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_settimeofday_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_settimeofday settimeofday "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setuid_trampoline_addr, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setuid setuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { @@ -1477,13 +1963,17 @@ func Stat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_stat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_stat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_stat stat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, stat *Statfs_t) (err error) { @@ -1492,13 +1982,17 @@ func Statfs(path string, stat *Statfs_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_statfs_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_statfs_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_statfs statfs "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlink(path string, link string) (err error) { @@ -1512,13 +2006,17 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_symlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_symlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_symlink symlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { @@ -1532,23 +2030,31 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + _, _, e1 := syscall_syscall(libc_symlinkat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } +var libc_symlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_symlinkat symlinkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) + _, _, e1 := syscall_syscall(libc_sync_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_sync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sync sync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { @@ -1557,21 +2063,29 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length)) + _, _, e1 := syscall_syscall(libc_truncate_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_truncate_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_truncate truncate "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) + r0, _, _ := syscall_syscall(libc_umask_trampoline_addr, uintptr(newmask), 0, 0) oldmask = int(r0) return } +var libc_umask_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_umask umask "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { @@ -1580,13 +2094,17 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_unlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_unlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unlink unlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlinkat(dirfd int, path string, flags int) (err error) { @@ -1595,13 +2113,17 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_unlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_unlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unlinkat unlinkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { @@ -1610,13 +2132,17 @@ func Unmount(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_unmount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_unmount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unmount unmount "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { @@ -1626,7 +2152,7 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1634,10 +2160,14 @@ func write(fd int, p []byte) (n int, err error) { return } +var libc_write_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_write write "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) + r0, _, e1 := syscall_syscall6(libc_mmap_trampoline_addr, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -1645,20 +2175,28 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } +var libc_mmap_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mmap mmap "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_munmap_trampoline_addr, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_munmap_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munmap munmap "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1669,7 +2207,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1685,9 +2223,13 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error if err != nil { return } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_utimensat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } + +var libc_utimensat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_utimensat utimensat "libc.so" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s new file mode 100644 index 000000000000..5782cd108447 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s @@ -0,0 +1,669 @@ +// go run mkasm.go openbsd amd64 +// Code generated by the command above; DO NOT EDIT. + +#include "textflag.h" + +TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getgroups(SB) +GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgroups_trampoline_addr(SB)/8, $libc_getgroups_trampoline<>(SB) + +TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setgroups(SB) +GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgroups_trampoline_addr(SB)/8, $libc_setgroups_trampoline<>(SB) + +TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_wait4(SB) +GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $8 +DATA ·libc_wait4_trampoline_addr(SB)/8, $libc_wait4_trampoline<>(SB) + +TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_accept(SB) +GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $8 +DATA ·libc_accept_trampoline_addr(SB)/8, $libc_accept_trampoline<>(SB) + +TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_bind(SB) +GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $8 +DATA ·libc_bind_trampoline_addr(SB)/8, $libc_bind_trampoline<>(SB) + +TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_connect(SB) +GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_connect_trampoline_addr(SB)/8, $libc_connect_trampoline<>(SB) + +TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_socket(SB) +GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socket_trampoline_addr(SB)/8, $libc_socket_trampoline<>(SB) + +TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsockopt(SB) +GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockopt_trampoline_addr(SB)/8, $libc_getsockopt_trampoline<>(SB) + +TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setsockopt(SB) +GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsockopt_trampoline_addr(SB)/8, $libc_setsockopt_trampoline<>(SB) + +TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpeername(SB) +GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpeername_trampoline_addr(SB)/8, $libc_getpeername_trampoline<>(SB) + +TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsockname(SB) +GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockname_trampoline_addr(SB)/8, $libc_getsockname_trampoline<>(SB) + +TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shutdown(SB) +GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shutdown_trampoline_addr(SB)/8, $libc_shutdown_trampoline<>(SB) + +TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_socketpair(SB) +GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socketpair_trampoline_addr(SB)/8, $libc_socketpair_trampoline<>(SB) + +TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_recvfrom(SB) +GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvfrom_trampoline_addr(SB)/8, $libc_recvfrom_trampoline<>(SB) + +TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sendto(SB) +GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendto_trampoline_addr(SB)/8, $libc_sendto_trampoline<>(SB) + +TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_recvmsg(SB) +GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvmsg_trampoline_addr(SB)/8, $libc_recvmsg_trampoline<>(SB) + +TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sendmsg(SB) +GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendmsg_trampoline_addr(SB)/8, $libc_sendmsg_trampoline<>(SB) + +TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kevent(SB) +GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kevent_trampoline_addr(SB)/8, $libc_kevent_trampoline<>(SB) + +TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_utimes(SB) +GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_utimes_trampoline_addr(SB)/8, $libc_utimes_trampoline<>(SB) + +TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_futimes(SB) +GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_futimes_trampoline_addr(SB)/8, $libc_futimes_trampoline<>(SB) + +TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_poll(SB) +GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $8 +DATA ·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB) + +TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_madvise(SB) +GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $8 +DATA ·libc_madvise_trampoline_addr(SB)/8, $libc_madvise_trampoline<>(SB) + +TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mlock(SB) +GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlock_trampoline_addr(SB)/8, $libc_mlock_trampoline<>(SB) + +TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mlockall(SB) +GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlockall_trampoline_addr(SB)/8, $libc_mlockall_trampoline<>(SB) + +TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mprotect(SB) +GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mprotect_trampoline_addr(SB)/8, $libc_mprotect_trampoline<>(SB) + +TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_msync(SB) +GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_msync_trampoline_addr(SB)/8, $libc_msync_trampoline<>(SB) + +TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munlock(SB) +GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlock_trampoline_addr(SB)/8, $libc_munlock_trampoline<>(SB) + +TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munlockall(SB) +GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB) + +TEXT libc_pipe2_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pipe2(SB) +GLOBL ·libc_pipe2_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pipe2_trampoline_addr(SB)/8, $libc_pipe2_trampoline<>(SB) + +TEXT libc_getdents_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getdents(SB) +GLOBL ·libc_getdents_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getdents_trampoline_addr(SB)/8, $libc_getdents_trampoline<>(SB) + +TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getcwd(SB) +GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) + +TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ioctl(SB) +GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) + +TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sysctl(SB) +GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) + +TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ppoll(SB) +GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ppoll_trampoline_addr(SB)/8, $libc_ppoll_trampoline<>(SB) + +TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_access(SB) +GLOBL ·libc_access_trampoline_addr(SB), RODATA, $8 +DATA ·libc_access_trampoline_addr(SB)/8, $libc_access_trampoline<>(SB) + +TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_adjtime(SB) +GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_adjtime_trampoline_addr(SB)/8, $libc_adjtime_trampoline<>(SB) + +TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chdir(SB) +GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chdir_trampoline_addr(SB)/8, $libc_chdir_trampoline<>(SB) + +TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chflags(SB) +GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chflags_trampoline_addr(SB)/8, $libc_chflags_trampoline<>(SB) + +TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chmod(SB) +GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chmod_trampoline_addr(SB)/8, $libc_chmod_trampoline<>(SB) + +TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chown(SB) +GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chown_trampoline_addr(SB)/8, $libc_chown_trampoline<>(SB) + +TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chroot(SB) +GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chroot_trampoline_addr(SB)/8, $libc_chroot_trampoline<>(SB) + +TEXT libc_clock_gettime_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_clock_gettime(SB) +GLOBL ·libc_clock_gettime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clock_gettime_trampoline_addr(SB)/8, $libc_clock_gettime_trampoline<>(SB) + +TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_close(SB) +GLOBL ·libc_close_trampoline_addr(SB), RODATA, $8 +DATA ·libc_close_trampoline_addr(SB)/8, $libc_close_trampoline<>(SB) + +TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup(SB) +GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup_trampoline_addr(SB)/8, $libc_dup_trampoline<>(SB) + +TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup2(SB) +GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup2_trampoline_addr(SB)/8, $libc_dup2_trampoline<>(SB) + +TEXT libc_dup3_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup3(SB) +GLOBL ·libc_dup3_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup3_trampoline_addr(SB)/8, $libc_dup3_trampoline<>(SB) + +TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_exit(SB) +GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_exit_trampoline_addr(SB)/8, $libc_exit_trampoline<>(SB) + +TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_faccessat(SB) +GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_faccessat_trampoline_addr(SB)/8, $libc_faccessat_trampoline<>(SB) + +TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchdir(SB) +GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchdir_trampoline_addr(SB)/8, $libc_fchdir_trampoline<>(SB) + +TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchflags(SB) +GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchflags_trampoline_addr(SB)/8, $libc_fchflags_trampoline<>(SB) + +TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchmod(SB) +GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmod_trampoline_addr(SB)/8, $libc_fchmod_trampoline<>(SB) + +TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchmodat(SB) +GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmodat_trampoline_addr(SB)/8, $libc_fchmodat_trampoline<>(SB) + +TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchown(SB) +GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchown_trampoline_addr(SB)/8, $libc_fchown_trampoline<>(SB) + +TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchownat(SB) +GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchownat_trampoline_addr(SB)/8, $libc_fchownat_trampoline<>(SB) + +TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_flock(SB) +GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_flock_trampoline_addr(SB)/8, $libc_flock_trampoline<>(SB) + +TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fpathconf(SB) +GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fpathconf_trampoline_addr(SB)/8, $libc_fpathconf_trampoline<>(SB) + +TEXT libc_fstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstat(SB) +GLOBL ·libc_fstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstat_trampoline_addr(SB)/8, $libc_fstat_trampoline<>(SB) + +TEXT libc_fstatat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstatat(SB) +GLOBL ·libc_fstatat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatat_trampoline_addr(SB)/8, $libc_fstatat_trampoline<>(SB) + +TEXT libc_fstatfs_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstatfs(SB) +GLOBL ·libc_fstatfs_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatfs_trampoline_addr(SB)/8, $libc_fstatfs_trampoline<>(SB) + +TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fsync(SB) +GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fsync_trampoline_addr(SB)/8, $libc_fsync_trampoline<>(SB) + +TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ftruncate(SB) +GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ftruncate_trampoline_addr(SB)/8, $libc_ftruncate_trampoline<>(SB) + +TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getegid(SB) +GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getegid_trampoline_addr(SB)/8, $libc_getegid_trampoline<>(SB) + +TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_geteuid(SB) +GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_geteuid_trampoline_addr(SB)/8, $libc_geteuid_trampoline<>(SB) + +TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getgid(SB) +GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgid_trampoline_addr(SB)/8, $libc_getgid_trampoline<>(SB) + +TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpgid(SB) +GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgid_trampoline_addr(SB)/8, $libc_getpgid_trampoline<>(SB) + +TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpgrp(SB) +GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgrp_trampoline_addr(SB)/8, $libc_getpgrp_trampoline<>(SB) + +TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpid(SB) +GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpid_trampoline_addr(SB)/8, $libc_getpid_trampoline<>(SB) + +TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getppid(SB) +GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getppid_trampoline_addr(SB)/8, $libc_getppid_trampoline<>(SB) + +TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpriority(SB) +GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpriority_trampoline_addr(SB)/8, $libc_getpriority_trampoline<>(SB) + +TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrlimit(SB) +GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrlimit_trampoline_addr(SB)/8, $libc_getrlimit_trampoline<>(SB) + +TEXT libc_getrtable_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrtable(SB) +GLOBL ·libc_getrtable_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrtable_trampoline_addr(SB)/8, $libc_getrtable_trampoline<>(SB) + +TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrusage(SB) +GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrusage_trampoline_addr(SB)/8, $libc_getrusage_trampoline<>(SB) + +TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsid(SB) +GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsid_trampoline_addr(SB)/8, $libc_getsid_trampoline<>(SB) + +TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_gettimeofday(SB) +GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_gettimeofday_trampoline_addr(SB)/8, $libc_gettimeofday_trampoline<>(SB) + +TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getuid(SB) +GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getuid_trampoline_addr(SB)/8, $libc_getuid_trampoline<>(SB) + +TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_issetugid(SB) +GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_issetugid_trampoline_addr(SB)/8, $libc_issetugid_trampoline<>(SB) + +TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kill(SB) +GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kill_trampoline_addr(SB)/8, $libc_kill_trampoline<>(SB) + +TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kqueue(SB) +GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kqueue_trampoline_addr(SB)/8, $libc_kqueue_trampoline<>(SB) + +TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lchown(SB) +GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lchown_trampoline_addr(SB)/8, $libc_lchown_trampoline<>(SB) + +TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_link(SB) +GLOBL ·libc_link_trampoline_addr(SB), RODATA, $8 +DATA ·libc_link_trampoline_addr(SB)/8, $libc_link_trampoline<>(SB) + +TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_linkat(SB) +GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_linkat_trampoline_addr(SB)/8, $libc_linkat_trampoline<>(SB) + +TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_listen(SB) +GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $8 +DATA ·libc_listen_trampoline_addr(SB)/8, $libc_listen_trampoline<>(SB) + +TEXT libc_lstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lstat(SB) +GLOBL ·libc_lstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lstat_trampoline_addr(SB)/8, $libc_lstat_trampoline<>(SB) + +TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkdir(SB) +GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdir_trampoline_addr(SB)/8, $libc_mkdir_trampoline<>(SB) + +TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkdirat(SB) +GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdirat_trampoline_addr(SB)/8, $libc_mkdirat_trampoline<>(SB) + +TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkfifo(SB) +GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkfifo_trampoline_addr(SB)/8, $libc_mkfifo_trampoline<>(SB) + +TEXT libc_mkfifoat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkfifoat(SB) +GLOBL ·libc_mkfifoat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkfifoat_trampoline_addr(SB)/8, $libc_mkfifoat_trampoline<>(SB) + +TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mknod(SB) +GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB) + +TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mknodat(SB) +GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) + +TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_nanosleep(SB) +GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 +DATA ·libc_nanosleep_trampoline_addr(SB)/8, $libc_nanosleep_trampoline<>(SB) + +TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_open(SB) +GLOBL ·libc_open_trampoline_addr(SB), RODATA, $8 +DATA ·libc_open_trampoline_addr(SB)/8, $libc_open_trampoline<>(SB) + +TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_openat(SB) +GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_openat_trampoline_addr(SB)/8, $libc_openat_trampoline<>(SB) + +TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pathconf(SB) +GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pathconf_trampoline_addr(SB)/8, $libc_pathconf_trampoline<>(SB) + +TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pread(SB) +GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pread_trampoline_addr(SB)/8, $libc_pread_trampoline<>(SB) + +TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pwrite(SB) +GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pwrite_trampoline_addr(SB)/8, $libc_pwrite_trampoline<>(SB) + +TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_read(SB) +GLOBL ·libc_read_trampoline_addr(SB), RODATA, $8 +DATA ·libc_read_trampoline_addr(SB)/8, $libc_read_trampoline<>(SB) + +TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readlink(SB) +GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlink_trampoline_addr(SB)/8, $libc_readlink_trampoline<>(SB) + +TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readlinkat(SB) +GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlinkat_trampoline_addr(SB)/8, $libc_readlinkat_trampoline<>(SB) + +TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_rename(SB) +GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rename_trampoline_addr(SB)/8, $libc_rename_trampoline<>(SB) + +TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renameat(SB) +GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameat_trampoline_addr(SB)/8, $libc_renameat_trampoline<>(SB) + +TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_revoke(SB) +GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $8 +DATA ·libc_revoke_trampoline_addr(SB)/8, $libc_revoke_trampoline<>(SB) + +TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_rmdir(SB) +GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rmdir_trampoline_addr(SB)/8, $libc_rmdir_trampoline<>(SB) + +TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lseek(SB) +GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lseek_trampoline_addr(SB)/8, $libc_lseek_trampoline<>(SB) + +TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_select(SB) +GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8 +DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB) + +TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setegid(SB) +GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setegid_trampoline_addr(SB)/8, $libc_setegid_trampoline<>(SB) + +TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_seteuid(SB) +GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_seteuid_trampoline_addr(SB)/8, $libc_seteuid_trampoline<>(SB) + +TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setgid(SB) +GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgid_trampoline_addr(SB)/8, $libc_setgid_trampoline<>(SB) + +TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setlogin(SB) +GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setlogin_trampoline_addr(SB)/8, $libc_setlogin_trampoline<>(SB) + +TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setpgid(SB) +GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpgid_trampoline_addr(SB)/8, $libc_setpgid_trampoline<>(SB) + +TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setpriority(SB) +GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpriority_trampoline_addr(SB)/8, $libc_setpriority_trampoline<>(SB) + +TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setregid(SB) +GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setregid_trampoline_addr(SB)/8, $libc_setregid_trampoline<>(SB) + +TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setreuid(SB) +GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB) + +TEXT libc_setresgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setresgid(SB) +GLOBL ·libc_setresgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setresgid_trampoline_addr(SB)/8, $libc_setresgid_trampoline<>(SB) + +TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setresuid(SB) +GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB) + +TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setrlimit(SB) +GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) + +TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setrtable(SB) +GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setrtable_trampoline_addr(SB)/8, $libc_setrtable_trampoline<>(SB) + +TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setsid(SB) +GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsid_trampoline_addr(SB)/8, $libc_setsid_trampoline<>(SB) + +TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_settimeofday(SB) +GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_settimeofday_trampoline_addr(SB)/8, $libc_settimeofday_trampoline<>(SB) + +TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setuid(SB) +GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setuid_trampoline_addr(SB)/8, $libc_setuid_trampoline<>(SB) + +TEXT libc_stat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_stat(SB) +GLOBL ·libc_stat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_stat_trampoline_addr(SB)/8, $libc_stat_trampoline<>(SB) + +TEXT libc_statfs_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_statfs(SB) +GLOBL ·libc_statfs_trampoline_addr(SB), RODATA, $8 +DATA ·libc_statfs_trampoline_addr(SB)/8, $libc_statfs_trampoline<>(SB) + +TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_symlink(SB) +GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlink_trampoline_addr(SB)/8, $libc_symlink_trampoline<>(SB) + +TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_symlinkat(SB) +GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlinkat_trampoline_addr(SB)/8, $libc_symlinkat_trampoline<>(SB) + +TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sync(SB) +GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sync_trampoline_addr(SB)/8, $libc_sync_trampoline<>(SB) + +TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_truncate(SB) +GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_truncate_trampoline_addr(SB)/8, $libc_truncate_trampoline<>(SB) + +TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_umask(SB) +GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $8 +DATA ·libc_umask_trampoline_addr(SB)/8, $libc_umask_trampoline<>(SB) + +TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unlink(SB) +GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlink_trampoline_addr(SB)/8, $libc_unlink_trampoline<>(SB) + +TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unlinkat(SB) +GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlinkat_trampoline_addr(SB)/8, $libc_unlinkat_trampoline<>(SB) + +TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unmount(SB) +GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unmount_trampoline_addr(SB)/8, $libc_unmount_trampoline<>(SB) + +TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_write(SB) +GLOBL ·libc_write_trampoline_addr(SB), RODATA, $8 +DATA ·libc_write_trampoline_addr(SB)/8, $libc_write_trampoline<>(SB) + +TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mmap(SB) +GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mmap_trampoline_addr(SB)/8, $libc_mmap_trampoline<>(SB) + +TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munmap(SB) +GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) + +TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_utimensat(SB) +GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go index 69f80300674b..b2da8e50cc7a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -l32 -openbsd -arm -tags openbsd,arm syscall_bsd.go syscall_openbsd.go syscall_openbsd_arm.go +// go run mksyscall.go -l32 -openbsd -arm -libc -tags openbsd,arm syscall_bsd.go syscall_openbsd.go syscall_openbsd_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && arm @@ -16,7 +16,7 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + r0, _, e1 := syscall_rawSyscall(libc_getgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -24,20 +24,28 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } +var libc_getgroups_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getgroups getgroups "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + _, _, e1 := syscall_rawSyscall(libc_setgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setgroups_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setgroups setgroups "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_wait4_trampoline_addr, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -45,10 +53,14 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return } +var libc_wait4_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_wait4 wait4 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, _, e1 := syscall_syscall(libc_accept_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -56,30 +68,42 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } +var libc_accept_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_accept accept "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_bind_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_bind_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_bind bind "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_connect_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_connect_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_connect connect "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + r0, _, e1 := syscall_rawSyscall(libc_socket_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -87,66 +111,94 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } +var libc_socket_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_socket socket "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := syscall_syscall6(libc_getsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getsockopt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsockopt getsockopt "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := syscall_syscall6(libc_setsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setsockopt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setsockopt setsockopt "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getpeername_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getpeername_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpeername getpeername "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getsockname_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getsockname_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsockname getsockname "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_shutdown_trampoline_addr, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_shutdown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shutdown shutdown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := syscall_rawSyscall6(libc_socketpair_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_socketpair_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_socketpair socketpair "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { @@ -156,7 +208,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := syscall_syscall6(libc_recvfrom_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -164,6 +216,10 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } +var libc_recvfrom_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_recvfrom recvfrom "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { @@ -173,17 +229,21 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := syscall_syscall6(libc_sendto_trampoline_addr, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_sendto_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sendto sendto "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_recvmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -191,10 +251,14 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } +var libc_recvmsg_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_recvmsg recvmsg "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_sendmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -202,10 +266,14 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } +var libc_sendmsg_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sendmsg sendmsg "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + r0, _, e1 := syscall_syscall6(libc_kevent_trampoline_addr, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -213,6 +281,10 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne return } +var libc_kevent_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kevent kevent "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { @@ -221,27 +293,35 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_utimes_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_utimes_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_utimes utimes "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_futimes_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_futimes_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_futimes futimes "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + r0, _, e1 := syscall_syscall(libc_poll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -249,6 +329,10 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { return } +var libc_poll_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_poll poll "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Madvise(b []byte, behav int) (err error) { @@ -258,13 +342,17 @@ func Madvise(b []byte, behav int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) + _, _, e1 := syscall_syscall(libc_madvise_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(behav)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_madvise_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_madvise madvise "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { @@ -274,23 +362,31 @@ func Mlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_mlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mlock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mlock mlock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall(libc_mlockall_trampoline_addr, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mlockall_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mlockall mlockall "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { @@ -300,13 +396,17 @@ func Mprotect(b []byte, prot int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + _, _, e1 := syscall_syscall(libc_mprotect_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mprotect_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mprotect mprotect "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Msync(b []byte, flags int) (err error) { @@ -316,13 +416,17 @@ func Msync(b []byte, flags int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_msync_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_msync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_msync msync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { @@ -332,33 +436,45 @@ func Munlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_munlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_munlock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munlock munlock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) + _, _, e1 := syscall_syscall(libc_munlockall_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_munlockall_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munlockall munlockall "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + _, _, e1 := syscall_rawSyscall(libc_pipe2_trampoline_addr, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_pipe2_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdents(fd int, buf []byte) (n int, err error) { @@ -368,7 +484,7 @@ func Getdents(fd int, buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) + r0, _, e1 := syscall_syscall(libc_getdents_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -376,6 +492,10 @@ func Getdents(fd int, buf []byte) (n int, err error) { return } +var libc_getdents_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getdents getdents "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getcwd(buf []byte) (n int, err error) { @@ -385,7 +505,7 @@ func Getcwd(buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) + r0, _, e1 := syscall_syscall(libc_getcwd_trampoline_addr, uintptr(_p0), uintptr(len(buf)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -393,16 +513,24 @@ func Getcwd(buf []byte) (n int, err error) { return } +var libc_getcwd_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getcwd getcwd "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -412,17 +540,21 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := syscall_syscall6(libc_sysctl_trampoline_addr, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_sysctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sysctl sysctl "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -430,6 +562,10 @@ func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, return } +var libc_ppoll_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ppoll ppoll "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { @@ -438,23 +574,31 @@ func Access(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_access_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_access_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_access access "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + _, _, e1 := syscall_syscall(libc_adjtime_trampoline_addr, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_adjtime_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_adjtime adjtime "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { @@ -463,13 +607,17 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chdir chdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { @@ -478,13 +626,17 @@ func Chflags(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_chflags_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chflags_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chflags chflags "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { @@ -493,13 +645,17 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_chmod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chmod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chmod chmod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { @@ -508,13 +664,17 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_chown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chown chown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { @@ -523,27 +683,49 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chroot_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_chroot_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chroot chroot "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := syscall_syscall(libc_clock_gettime_trampoline_addr, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_clock_gettime_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_clock_gettime clock_gettime "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_close_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_close_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_close close "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := syscall_syscall(libc_dup_trampoline_addr, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -551,33 +733,49 @@ func Dup(fd int) (nfd int, err error) { return } +var libc_dup_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup dup "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := syscall_syscall(libc_dup2_trampoline_addr, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_dup2_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup2 dup2 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup3(from int, to int, flags int) (err error) { - _, _, e1 := Syscall(SYS_DUP3, uintptr(from), uintptr(to), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_dup3_trampoline_addr, uintptr(from), uintptr(to), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_dup3_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup3 dup3 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) + syscall_syscall(libc_exit_trampoline_addr, uintptr(code), 0, 0) return } +var libc_exit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_exit exit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -586,43 +784,59 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_faccessat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_faccessat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_faccessat faccessat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fchdir_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchdir fchdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_fchflags_trampoline_addr, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchflags_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchflags fchflags "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_fchmod_trampoline_addr, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchmod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchmod fchmod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -631,23 +845,31 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fchmodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchmodat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchmodat fchmodat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_fchown_trampoline_addr, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchown fchown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { @@ -656,27 +878,35 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_fchownat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchownat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchownat fchownat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_flock_trampoline_addr, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_flock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_flock flock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_fpathconf_trampoline_addr, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -684,16 +914,24 @@ func Fpathconf(fd int, name int) (val int, err error) { return } +var libc_fpathconf_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fpathconf fpathconf "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstat fstat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { @@ -702,71 +940,99 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fstatat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fstatat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstatat fstatat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstatfs_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fstatfs_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstatfs fstatfs "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fsync_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fsync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fsync fsync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall6(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0) + _, _, e1 := syscall_syscall6(libc_ftruncate_trampoline_addr, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_ftruncate_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ftruncate ftruncate "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getegid_trampoline_addr, 0, 0, 0) egid = int(r0) return } +var libc_getegid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getegid getegid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_geteuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } +var libc_geteuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_geteuid geteuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getgid_trampoline_addr, 0, 0, 0) gid = int(r0) return } +var libc_getgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getgid getgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getpgid_trampoline_addr, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -774,34 +1040,50 @@ func Getpgid(pid int) (pgid int, err error) { return } +var libc_getpgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpgid getpgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpgrp_trampoline_addr, 0, 0, 0) pgrp = int(r0) return } +var libc_getpgrp_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpgrp getpgrp "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpid_trampoline_addr, 0, 0, 0) pid = int(r0) return } +var libc_getpid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpid getpid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getppid_trampoline_addr, 0, 0, 0) ppid = int(r0) return } +var libc_getppid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getppid getppid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) + r0, _, e1 := syscall_syscall(libc_getpriority_trampoline_addr, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -809,20 +1091,28 @@ func Getpriority(which int, who int) (prio int, err error) { return } +var libc_getpriority_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpriority getpriority "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getrlimit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrlimit getrlimit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrtable() (rtable int, err error) { - r0, _, e1 := RawSyscall(SYS_GETRTABLE, 0, 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getrtable_trampoline_addr, 0, 0, 0) rtable = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -830,20 +1120,28 @@ func Getrtable() (rtable int, err error) { return } +var libc_getrtable_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrtable getrtable "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrusage_trampoline_addr, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getrusage_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrusage getrusage "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getsid_trampoline_addr, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -851,46 +1149,66 @@ func Getsid(pid int) (sid int, err error) { return } +var libc_getsid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsid getsid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_gettimeofday_trampoline_addr, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_gettimeofday_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_gettimeofday gettimeofday "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } +var libc_getuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getuid getuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) + r0, _, _ := syscall_syscall(libc_issetugid_trampoline_addr, 0, 0, 0) tainted = bool(r0 != 0) return } +var libc_issetugid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_issetugid issetugid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kill(pid int, signum syscall.Signal) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) + _, _, e1 := syscall_syscall(libc_kill_trampoline_addr, uintptr(pid), uintptr(signum), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_kill_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kill kill "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) + r0, _, e1 := syscall_syscall(libc_kqueue_trampoline_addr, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -898,6 +1216,10 @@ func Kqueue() (fd int, err error) { return } +var libc_kqueue_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kqueue kqueue "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { @@ -906,13 +1228,17 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_lchown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_lchown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lchown lchown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { @@ -926,13 +1252,17 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_link_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_link_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_link link "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { @@ -946,23 +1276,31 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er if err != nil { return } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_linkat_trampoline_addr, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_linkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_linkat linkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) + _, _, e1 := syscall_syscall(libc_listen_trampoline_addr, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_listen_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_listen listen "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { @@ -971,13 +1309,17 @@ func Lstat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_lstat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_lstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lstat lstat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(path string, mode uint32) (err error) { @@ -986,13 +1328,17 @@ func Mkdir(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkdir mkdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdirat(dirfd int, path string, mode uint32) (err error) { @@ -1001,13 +1347,17 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := syscall_syscall(libc_mkdirat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkdirat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkdirat mkdirat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { @@ -1016,13 +1366,17 @@ func Mkfifo(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkfifo_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkfifo_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkfifo mkfifo "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifoat(dirfd int, path string, mode uint32) (err error) { @@ -1031,13 +1385,17 @@ func Mkfifoat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := syscall_syscall(libc_mkfifoat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkfifoat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkfifoat mkfifoat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { @@ -1046,13 +1404,17 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + _, _, e1 := syscall_syscall(libc_mknod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mknod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mknod mknod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { @@ -1061,23 +1423,31 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) + _, _, e1 := syscall_syscall6(libc_mknodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mknodat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mknodat mknodat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Nanosleep(time *Timespec, leftover *Timespec) (err error) { - _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_nanosleep_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_nanosleep nanosleep "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { @@ -1086,7 +1456,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + r0, _, e1 := syscall_syscall(libc_open_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1094,6 +1464,10 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } +var libc_open_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_open open "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { @@ -1102,7 +1476,7 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + r0, _, e1 := syscall_syscall6(libc_openat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1110,6 +1484,10 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { return } +var libc_openat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_openat openat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { @@ -1118,7 +1496,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_pathconf_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1126,6 +1504,10 @@ func Pathconf(path string, name int) (val int, err error) { return } +var libc_pathconf_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pathconf pathconf "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pread(fd int, p []byte, offset int64) (n int, err error) { @@ -1135,7 +1517,7 @@ func pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) + r0, _, e1 := syscall_syscall6(libc_pread_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1143,6 +1525,10 @@ func pread(fd int, p []byte, offset int64) (n int, err error) { return } +var libc_pread_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pread pread "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pwrite(fd int, p []byte, offset int64) (n int, err error) { @@ -1152,7 +1538,7 @@ func pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) + r0, _, e1 := syscall_syscall6(libc_pwrite_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1160,6 +1546,10 @@ func pwrite(fd int, p []byte, offset int64) (n int, err error) { return } +var libc_pwrite_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pwrite pwrite "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { @@ -1169,7 +1559,7 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1177,6 +1567,10 @@ func read(fd int, p []byte) (n int, err error) { return } +var libc_read_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_read read "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { @@ -1191,7 +1585,7 @@ func Readlink(path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + r0, _, e1 := syscall_syscall(libc_readlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1199,6 +1593,10 @@ func Readlink(path string, buf []byte) (n int, err error) { return } +var libc_readlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readlink readlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { @@ -1213,7 +1611,7 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_readlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1221,6 +1619,10 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { return } +var libc_readlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readlinkat readlinkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { @@ -1234,13 +1636,17 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_rename_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_rename_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_rename rename "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Renameat(fromfd int, from string, tofd int, to string) (err error) { @@ -1254,13 +1660,17 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + _, _, e1 := syscall_syscall6(libc_renameat_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_renameat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renameat renameat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { @@ -1269,13 +1679,17 @@ func Revoke(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_revoke_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_revoke_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_revoke revoke "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { @@ -1284,17 +1698,21 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_rmdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_rmdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_rmdir rmdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), uintptr(whence), 0) + r0, r1, e1 := syscall_syscall6(libc_lseek_trampoline_addr, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), uintptr(whence), 0) newoffset = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { err = errnoErr(e1) @@ -1302,10 +1720,14 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return } +var libc_lseek_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lseek lseek "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + r0, _, e1 := syscall_syscall6(libc_select_trampoline_addr, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1313,36 +1735,52 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err return } +var libc_select_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_select select "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setegid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setegid setegid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_seteuid_trampoline_addr, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_seteuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_seteuid seteuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setgid_trampoline_addr, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setgid setgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { @@ -1351,97 +1789,133 @@ func Setlogin(name string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_setlogin_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setlogin_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setlogin setlogin "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) + _, _, e1 := syscall_rawSyscall(libc_setpgid_trampoline_addr, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setpgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setpgid setpgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) + _, _, e1 := syscall_syscall(libc_setpriority_trampoline_addr, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setpriority_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setpriority setpriority "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + _, _, e1 := syscall_rawSyscall(libc_setregid_trampoline_addr, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setregid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setregid setregid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + _, _, e1 := syscall_rawSyscall(libc_setreuid_trampoline_addr, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setreuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setreuid setreuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) + _, _, e1 := syscall_rawSyscall(libc_setresgid_trampoline_addr, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setresgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setresgid setresgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) + _, _, e1 := syscall_rawSyscall(libc_setresuid_trampoline_addr, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setresuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setresuid setresuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setrlimit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrtable(rtable int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRTABLE, uintptr(rtable), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setrtable_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setrtable setrtable "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1449,26 +1923,38 @@ func Setsid() (pid int, err error) { return } +var libc_setsid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setsid setsid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_settimeofday_trampoline_addr, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_settimeofday_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_settimeofday settimeofday "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setuid_trampoline_addr, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setuid setuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { @@ -1477,13 +1963,17 @@ func Stat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_stat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_stat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_stat stat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, stat *Statfs_t) (err error) { @@ -1492,13 +1982,17 @@ func Statfs(path string, stat *Statfs_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_statfs_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_statfs_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_statfs statfs "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlink(path string, link string) (err error) { @@ -1512,13 +2006,17 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_symlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_symlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_symlink symlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { @@ -1532,23 +2030,31 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + _, _, e1 := syscall_syscall(libc_symlinkat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } +var libc_symlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_symlinkat symlinkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) + _, _, e1 := syscall_syscall(libc_sync_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_sync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sync sync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { @@ -1557,21 +2063,29 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0) + _, _, e1 := syscall_syscall6(libc_truncate_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_truncate_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_truncate truncate "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) + r0, _, _ := syscall_syscall(libc_umask_trampoline_addr, uintptr(newmask), 0, 0) oldmask = int(r0) return } +var libc_umask_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_umask umask "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { @@ -1580,13 +2094,17 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_unlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_unlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unlink unlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlinkat(dirfd int, path string, flags int) (err error) { @@ -1595,13 +2113,17 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_unlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_unlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unlinkat unlinkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { @@ -1610,13 +2132,17 @@ func Unmount(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_unmount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_unmount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unmount unmount "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { @@ -1626,7 +2152,7 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1634,10 +2160,14 @@ func write(fd int, p []byte) (n int, err error) { return } +var libc_write_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_write write "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), uintptr(pos>>32), 0) + r0, _, e1 := syscall_syscall9(libc_mmap_trampoline_addr, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), uintptr(pos>>32), 0) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -1645,20 +2175,28 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } +var libc_mmap_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mmap mmap "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_munmap_trampoline_addr, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_munmap_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munmap munmap "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1669,7 +2207,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1685,9 +2223,13 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error if err != nil { return } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_utimensat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } + +var libc_utimensat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_utimensat utimensat "libc.so" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s new file mode 100644 index 000000000000..cf310420c942 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s @@ -0,0 +1,669 @@ +// go run mkasm.go openbsd arm +// Code generated by the command above; DO NOT EDIT. + +#include "textflag.h" + +TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getgroups(SB) +GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getgroups_trampoline_addr(SB)/4, $libc_getgroups_trampoline<>(SB) + +TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setgroups(SB) +GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setgroups_trampoline_addr(SB)/4, $libc_setgroups_trampoline<>(SB) + +TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_wait4(SB) +GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $4 +DATA ·libc_wait4_trampoline_addr(SB)/4, $libc_wait4_trampoline<>(SB) + +TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_accept(SB) +GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $4 +DATA ·libc_accept_trampoline_addr(SB)/4, $libc_accept_trampoline<>(SB) + +TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_bind(SB) +GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $4 +DATA ·libc_bind_trampoline_addr(SB)/4, $libc_bind_trampoline<>(SB) + +TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_connect(SB) +GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $4 +DATA ·libc_connect_trampoline_addr(SB)/4, $libc_connect_trampoline<>(SB) + +TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_socket(SB) +GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $4 +DATA ·libc_socket_trampoline_addr(SB)/4, $libc_socket_trampoline<>(SB) + +TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsockopt(SB) +GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getsockopt_trampoline_addr(SB)/4, $libc_getsockopt_trampoline<>(SB) + +TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setsockopt(SB) +GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setsockopt_trampoline_addr(SB)/4, $libc_setsockopt_trampoline<>(SB) + +TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpeername(SB) +GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getpeername_trampoline_addr(SB)/4, $libc_getpeername_trampoline<>(SB) + +TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsockname(SB) +GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getsockname_trampoline_addr(SB)/4, $libc_getsockname_trampoline<>(SB) + +TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shutdown(SB) +GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $4 +DATA ·libc_shutdown_trampoline_addr(SB)/4, $libc_shutdown_trampoline<>(SB) + +TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_socketpair(SB) +GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $4 +DATA ·libc_socketpair_trampoline_addr(SB)/4, $libc_socketpair_trampoline<>(SB) + +TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_recvfrom(SB) +GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $4 +DATA ·libc_recvfrom_trampoline_addr(SB)/4, $libc_recvfrom_trampoline<>(SB) + +TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sendto(SB) +GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $4 +DATA ·libc_sendto_trampoline_addr(SB)/4, $libc_sendto_trampoline<>(SB) + +TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_recvmsg(SB) +GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $4 +DATA ·libc_recvmsg_trampoline_addr(SB)/4, $libc_recvmsg_trampoline<>(SB) + +TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sendmsg(SB) +GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $4 +DATA ·libc_sendmsg_trampoline_addr(SB)/4, $libc_sendmsg_trampoline<>(SB) + +TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kevent(SB) +GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $4 +DATA ·libc_kevent_trampoline_addr(SB)/4, $libc_kevent_trampoline<>(SB) + +TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_utimes(SB) +GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $4 +DATA ·libc_utimes_trampoline_addr(SB)/4, $libc_utimes_trampoline<>(SB) + +TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_futimes(SB) +GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $4 +DATA ·libc_futimes_trampoline_addr(SB)/4, $libc_futimes_trampoline<>(SB) + +TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_poll(SB) +GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $4 +DATA ·libc_poll_trampoline_addr(SB)/4, $libc_poll_trampoline<>(SB) + +TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_madvise(SB) +GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $4 +DATA ·libc_madvise_trampoline_addr(SB)/4, $libc_madvise_trampoline<>(SB) + +TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mlock(SB) +GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mlock_trampoline_addr(SB)/4, $libc_mlock_trampoline<>(SB) + +TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mlockall(SB) +GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mlockall_trampoline_addr(SB)/4, $libc_mlockall_trampoline<>(SB) + +TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mprotect(SB) +GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mprotect_trampoline_addr(SB)/4, $libc_mprotect_trampoline<>(SB) + +TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_msync(SB) +GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $4 +DATA ·libc_msync_trampoline_addr(SB)/4, $libc_msync_trampoline<>(SB) + +TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munlock(SB) +GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $4 +DATA ·libc_munlock_trampoline_addr(SB)/4, $libc_munlock_trampoline<>(SB) + +TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munlockall(SB) +GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $4 +DATA ·libc_munlockall_trampoline_addr(SB)/4, $libc_munlockall_trampoline<>(SB) + +TEXT libc_pipe2_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pipe2(SB) +GLOBL ·libc_pipe2_trampoline_addr(SB), RODATA, $4 +DATA ·libc_pipe2_trampoline_addr(SB)/4, $libc_pipe2_trampoline<>(SB) + +TEXT libc_getdents_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getdents(SB) +GLOBL ·libc_getdents_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getdents_trampoline_addr(SB)/4, $libc_getdents_trampoline<>(SB) + +TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getcwd(SB) +GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getcwd_trampoline_addr(SB)/4, $libc_getcwd_trampoline<>(SB) + +TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ioctl(SB) +GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $4 +DATA ·libc_ioctl_trampoline_addr(SB)/4, $libc_ioctl_trampoline<>(SB) + +TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sysctl(SB) +GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $4 +DATA ·libc_sysctl_trampoline_addr(SB)/4, $libc_sysctl_trampoline<>(SB) + +TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ppoll(SB) +GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $4 +DATA ·libc_ppoll_trampoline_addr(SB)/4, $libc_ppoll_trampoline<>(SB) + +TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_access(SB) +GLOBL ·libc_access_trampoline_addr(SB), RODATA, $4 +DATA ·libc_access_trampoline_addr(SB)/4, $libc_access_trampoline<>(SB) + +TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_adjtime(SB) +GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $4 +DATA ·libc_adjtime_trampoline_addr(SB)/4, $libc_adjtime_trampoline<>(SB) + +TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chdir(SB) +GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $4 +DATA ·libc_chdir_trampoline_addr(SB)/4, $libc_chdir_trampoline<>(SB) + +TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chflags(SB) +GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $4 +DATA ·libc_chflags_trampoline_addr(SB)/4, $libc_chflags_trampoline<>(SB) + +TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chmod(SB) +GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $4 +DATA ·libc_chmod_trampoline_addr(SB)/4, $libc_chmod_trampoline<>(SB) + +TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chown(SB) +GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $4 +DATA ·libc_chown_trampoline_addr(SB)/4, $libc_chown_trampoline<>(SB) + +TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chroot(SB) +GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $4 +DATA ·libc_chroot_trampoline_addr(SB)/4, $libc_chroot_trampoline<>(SB) + +TEXT libc_clock_gettime_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_clock_gettime(SB) +GLOBL ·libc_clock_gettime_trampoline_addr(SB), RODATA, $4 +DATA ·libc_clock_gettime_trampoline_addr(SB)/4, $libc_clock_gettime_trampoline<>(SB) + +TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_close(SB) +GLOBL ·libc_close_trampoline_addr(SB), RODATA, $4 +DATA ·libc_close_trampoline_addr(SB)/4, $libc_close_trampoline<>(SB) + +TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup(SB) +GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $4 +DATA ·libc_dup_trampoline_addr(SB)/4, $libc_dup_trampoline<>(SB) + +TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup2(SB) +GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $4 +DATA ·libc_dup2_trampoline_addr(SB)/4, $libc_dup2_trampoline<>(SB) + +TEXT libc_dup3_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup3(SB) +GLOBL ·libc_dup3_trampoline_addr(SB), RODATA, $4 +DATA ·libc_dup3_trampoline_addr(SB)/4, $libc_dup3_trampoline<>(SB) + +TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_exit(SB) +GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $4 +DATA ·libc_exit_trampoline_addr(SB)/4, $libc_exit_trampoline<>(SB) + +TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_faccessat(SB) +GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_faccessat_trampoline_addr(SB)/4, $libc_faccessat_trampoline<>(SB) + +TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchdir(SB) +GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fchdir_trampoline_addr(SB)/4, $libc_fchdir_trampoline<>(SB) + +TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchflags(SB) +GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fchflags_trampoline_addr(SB)/4, $libc_fchflags_trampoline<>(SB) + +TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchmod(SB) +GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fchmod_trampoline_addr(SB)/4, $libc_fchmod_trampoline<>(SB) + +TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchmodat(SB) +GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fchmodat_trampoline_addr(SB)/4, $libc_fchmodat_trampoline<>(SB) + +TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchown(SB) +GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fchown_trampoline_addr(SB)/4, $libc_fchown_trampoline<>(SB) + +TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchownat(SB) +GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fchownat_trampoline_addr(SB)/4, $libc_fchownat_trampoline<>(SB) + +TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_flock(SB) +GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $4 +DATA ·libc_flock_trampoline_addr(SB)/4, $libc_flock_trampoline<>(SB) + +TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fpathconf(SB) +GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fpathconf_trampoline_addr(SB)/4, $libc_fpathconf_trampoline<>(SB) + +TEXT libc_fstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstat(SB) +GLOBL ·libc_fstat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fstat_trampoline_addr(SB)/4, $libc_fstat_trampoline<>(SB) + +TEXT libc_fstatat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstatat(SB) +GLOBL ·libc_fstatat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fstatat_trampoline_addr(SB)/4, $libc_fstatat_trampoline<>(SB) + +TEXT libc_fstatfs_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstatfs(SB) +GLOBL ·libc_fstatfs_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fstatfs_trampoline_addr(SB)/4, $libc_fstatfs_trampoline<>(SB) + +TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fsync(SB) +GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fsync_trampoline_addr(SB)/4, $libc_fsync_trampoline<>(SB) + +TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ftruncate(SB) +GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $4 +DATA ·libc_ftruncate_trampoline_addr(SB)/4, $libc_ftruncate_trampoline<>(SB) + +TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getegid(SB) +GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getegid_trampoline_addr(SB)/4, $libc_getegid_trampoline<>(SB) + +TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_geteuid(SB) +GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_geteuid_trampoline_addr(SB)/4, $libc_geteuid_trampoline<>(SB) + +TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getgid(SB) +GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getgid_trampoline_addr(SB)/4, $libc_getgid_trampoline<>(SB) + +TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpgid(SB) +GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getpgid_trampoline_addr(SB)/4, $libc_getpgid_trampoline<>(SB) + +TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpgrp(SB) +GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getpgrp_trampoline_addr(SB)/4, $libc_getpgrp_trampoline<>(SB) + +TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpid(SB) +GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getpid_trampoline_addr(SB)/4, $libc_getpid_trampoline<>(SB) + +TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getppid(SB) +GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getppid_trampoline_addr(SB)/4, $libc_getppid_trampoline<>(SB) + +TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpriority(SB) +GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getpriority_trampoline_addr(SB)/4, $libc_getpriority_trampoline<>(SB) + +TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrlimit(SB) +GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getrlimit_trampoline_addr(SB)/4, $libc_getrlimit_trampoline<>(SB) + +TEXT libc_getrtable_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrtable(SB) +GLOBL ·libc_getrtable_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getrtable_trampoline_addr(SB)/4, $libc_getrtable_trampoline<>(SB) + +TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrusage(SB) +GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getrusage_trampoline_addr(SB)/4, $libc_getrusage_trampoline<>(SB) + +TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsid(SB) +GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getsid_trampoline_addr(SB)/4, $libc_getsid_trampoline<>(SB) + +TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_gettimeofday(SB) +GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $4 +DATA ·libc_gettimeofday_trampoline_addr(SB)/4, $libc_gettimeofday_trampoline<>(SB) + +TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getuid(SB) +GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getuid_trampoline_addr(SB)/4, $libc_getuid_trampoline<>(SB) + +TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_issetugid(SB) +GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_issetugid_trampoline_addr(SB)/4, $libc_issetugid_trampoline<>(SB) + +TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kill(SB) +GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $4 +DATA ·libc_kill_trampoline_addr(SB)/4, $libc_kill_trampoline<>(SB) + +TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kqueue(SB) +GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $4 +DATA ·libc_kqueue_trampoline_addr(SB)/4, $libc_kqueue_trampoline<>(SB) + +TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lchown(SB) +GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $4 +DATA ·libc_lchown_trampoline_addr(SB)/4, $libc_lchown_trampoline<>(SB) + +TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_link(SB) +GLOBL ·libc_link_trampoline_addr(SB), RODATA, $4 +DATA ·libc_link_trampoline_addr(SB)/4, $libc_link_trampoline<>(SB) + +TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_linkat(SB) +GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_linkat_trampoline_addr(SB)/4, $libc_linkat_trampoline<>(SB) + +TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_listen(SB) +GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $4 +DATA ·libc_listen_trampoline_addr(SB)/4, $libc_listen_trampoline<>(SB) + +TEXT libc_lstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lstat(SB) +GLOBL ·libc_lstat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_lstat_trampoline_addr(SB)/4, $libc_lstat_trampoline<>(SB) + +TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkdir(SB) +GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mkdir_trampoline_addr(SB)/4, $libc_mkdir_trampoline<>(SB) + +TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkdirat(SB) +GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mkdirat_trampoline_addr(SB)/4, $libc_mkdirat_trampoline<>(SB) + +TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkfifo(SB) +GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mkfifo_trampoline_addr(SB)/4, $libc_mkfifo_trampoline<>(SB) + +TEXT libc_mkfifoat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkfifoat(SB) +GLOBL ·libc_mkfifoat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mkfifoat_trampoline_addr(SB)/4, $libc_mkfifoat_trampoline<>(SB) + +TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mknod(SB) +GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mknod_trampoline_addr(SB)/4, $libc_mknod_trampoline<>(SB) + +TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mknodat(SB) +GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mknodat_trampoline_addr(SB)/4, $libc_mknodat_trampoline<>(SB) + +TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_nanosleep(SB) +GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $4 +DATA ·libc_nanosleep_trampoline_addr(SB)/4, $libc_nanosleep_trampoline<>(SB) + +TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_open(SB) +GLOBL ·libc_open_trampoline_addr(SB), RODATA, $4 +DATA ·libc_open_trampoline_addr(SB)/4, $libc_open_trampoline<>(SB) + +TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_openat(SB) +GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_openat_trampoline_addr(SB)/4, $libc_openat_trampoline<>(SB) + +TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pathconf(SB) +GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $4 +DATA ·libc_pathconf_trampoline_addr(SB)/4, $libc_pathconf_trampoline<>(SB) + +TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pread(SB) +GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $4 +DATA ·libc_pread_trampoline_addr(SB)/4, $libc_pread_trampoline<>(SB) + +TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pwrite(SB) +GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $4 +DATA ·libc_pwrite_trampoline_addr(SB)/4, $libc_pwrite_trampoline<>(SB) + +TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_read(SB) +GLOBL ·libc_read_trampoline_addr(SB), RODATA, $4 +DATA ·libc_read_trampoline_addr(SB)/4, $libc_read_trampoline<>(SB) + +TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readlink(SB) +GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $4 +DATA ·libc_readlink_trampoline_addr(SB)/4, $libc_readlink_trampoline<>(SB) + +TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readlinkat(SB) +GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_readlinkat_trampoline_addr(SB)/4, $libc_readlinkat_trampoline<>(SB) + +TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_rename(SB) +GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $4 +DATA ·libc_rename_trampoline_addr(SB)/4, $libc_rename_trampoline<>(SB) + +TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renameat(SB) +GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_renameat_trampoline_addr(SB)/4, $libc_renameat_trampoline<>(SB) + +TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_revoke(SB) +GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $4 +DATA ·libc_revoke_trampoline_addr(SB)/4, $libc_revoke_trampoline<>(SB) + +TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_rmdir(SB) +GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $4 +DATA ·libc_rmdir_trampoline_addr(SB)/4, $libc_rmdir_trampoline<>(SB) + +TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lseek(SB) +GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $4 +DATA ·libc_lseek_trampoline_addr(SB)/4, $libc_lseek_trampoline<>(SB) + +TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_select(SB) +GLOBL ·libc_select_trampoline_addr(SB), RODATA, $4 +DATA ·libc_select_trampoline_addr(SB)/4, $libc_select_trampoline<>(SB) + +TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setegid(SB) +GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setegid_trampoline_addr(SB)/4, $libc_setegid_trampoline<>(SB) + +TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_seteuid(SB) +GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_seteuid_trampoline_addr(SB)/4, $libc_seteuid_trampoline<>(SB) + +TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setgid(SB) +GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setgid_trampoline_addr(SB)/4, $libc_setgid_trampoline<>(SB) + +TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setlogin(SB) +GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setlogin_trampoline_addr(SB)/4, $libc_setlogin_trampoline<>(SB) + +TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setpgid(SB) +GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setpgid_trampoline_addr(SB)/4, $libc_setpgid_trampoline<>(SB) + +TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setpriority(SB) +GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setpriority_trampoline_addr(SB)/4, $libc_setpriority_trampoline<>(SB) + +TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setregid(SB) +GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setregid_trampoline_addr(SB)/4, $libc_setregid_trampoline<>(SB) + +TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setreuid(SB) +GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setreuid_trampoline_addr(SB)/4, $libc_setreuid_trampoline<>(SB) + +TEXT libc_setresgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setresgid(SB) +GLOBL ·libc_setresgid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setresgid_trampoline_addr(SB)/4, $libc_setresgid_trampoline<>(SB) + +TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setresuid(SB) +GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setresuid_trampoline_addr(SB)/4, $libc_setresuid_trampoline<>(SB) + +TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setrlimit(SB) +GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setrlimit_trampoline_addr(SB)/4, $libc_setrlimit_trampoline<>(SB) + +TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setrtable(SB) +GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setrtable_trampoline_addr(SB)/4, $libc_setrtable_trampoline<>(SB) + +TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setsid(SB) +GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setsid_trampoline_addr(SB)/4, $libc_setsid_trampoline<>(SB) + +TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_settimeofday(SB) +GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $4 +DATA ·libc_settimeofday_trampoline_addr(SB)/4, $libc_settimeofday_trampoline<>(SB) + +TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setuid(SB) +GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_setuid_trampoline_addr(SB)/4, $libc_setuid_trampoline<>(SB) + +TEXT libc_stat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_stat(SB) +GLOBL ·libc_stat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_stat_trampoline_addr(SB)/4, $libc_stat_trampoline<>(SB) + +TEXT libc_statfs_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_statfs(SB) +GLOBL ·libc_statfs_trampoline_addr(SB), RODATA, $4 +DATA ·libc_statfs_trampoline_addr(SB)/4, $libc_statfs_trampoline<>(SB) + +TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_symlink(SB) +GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $4 +DATA ·libc_symlink_trampoline_addr(SB)/4, $libc_symlink_trampoline<>(SB) + +TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_symlinkat(SB) +GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_symlinkat_trampoline_addr(SB)/4, $libc_symlinkat_trampoline<>(SB) + +TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sync(SB) +GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $4 +DATA ·libc_sync_trampoline_addr(SB)/4, $libc_sync_trampoline<>(SB) + +TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_truncate(SB) +GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $4 +DATA ·libc_truncate_trampoline_addr(SB)/4, $libc_truncate_trampoline<>(SB) + +TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_umask(SB) +GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $4 +DATA ·libc_umask_trampoline_addr(SB)/4, $libc_umask_trampoline<>(SB) + +TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unlink(SB) +GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $4 +DATA ·libc_unlink_trampoline_addr(SB)/4, $libc_unlink_trampoline<>(SB) + +TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unlinkat(SB) +GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_unlinkat_trampoline_addr(SB)/4, $libc_unlinkat_trampoline<>(SB) + +TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unmount(SB) +GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $4 +DATA ·libc_unmount_trampoline_addr(SB)/4, $libc_unmount_trampoline<>(SB) + +TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_write(SB) +GLOBL ·libc_write_trampoline_addr(SB), RODATA, $4 +DATA ·libc_write_trampoline_addr(SB)/4, $libc_write_trampoline<>(SB) + +TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mmap(SB) +GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $4 +DATA ·libc_mmap_trampoline_addr(SB)/4, $libc_mmap_trampoline<>(SB) + +TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munmap(SB) +GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $4 +DATA ·libc_munmap_trampoline_addr(SB)/4, $libc_munmap_trampoline<>(SB) + +TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_utimensat(SB) +GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_utimensat_trampoline_addr(SB)/4, $libc_utimensat_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go index c96a505178f9..048b2655e6f8 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -openbsd -tags openbsd,arm64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_arm64.go +// go run mksyscall.go -openbsd -libc -tags openbsd,arm64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_arm64.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && arm64 @@ -16,7 +16,7 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + r0, _, e1 := syscall_rawSyscall(libc_getgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -24,20 +24,28 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } +var libc_getgroups_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getgroups getgroups "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + _, _, e1 := syscall_rawSyscall(libc_setgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setgroups_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setgroups setgroups "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_wait4_trampoline_addr, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -45,10 +53,14 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return } +var libc_wait4_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_wait4 wait4 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, _, e1 := syscall_syscall(libc_accept_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -56,30 +68,42 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } +var libc_accept_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_accept accept "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_bind_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_bind_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_bind bind "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_connect_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_connect_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_connect connect "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + r0, _, e1 := syscall_rawSyscall(libc_socket_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -87,66 +111,94 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } +var libc_socket_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_socket socket "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := syscall_syscall6(libc_getsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getsockopt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsockopt getsockopt "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := syscall_syscall6(libc_setsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setsockopt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setsockopt setsockopt "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getpeername_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getpeername_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpeername getpeername "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getsockname_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getsockname_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsockname getsockname "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_shutdown_trampoline_addr, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_shutdown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shutdown shutdown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := syscall_rawSyscall6(libc_socketpair_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_socketpair_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_socketpair socketpair "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { @@ -156,7 +208,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := syscall_syscall6(libc_recvfrom_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -164,6 +216,10 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } +var libc_recvfrom_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_recvfrom recvfrom "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { @@ -173,17 +229,21 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := syscall_syscall6(libc_sendto_trampoline_addr, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_sendto_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sendto sendto "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_recvmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -191,10 +251,14 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } +var libc_recvmsg_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_recvmsg recvmsg "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_sendmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -202,10 +266,14 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } +var libc_sendmsg_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sendmsg sendmsg "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + r0, _, e1 := syscall_syscall6(libc_kevent_trampoline_addr, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -213,6 +281,10 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne return } +var libc_kevent_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kevent kevent "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { @@ -221,27 +293,35 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_utimes_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_utimes_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_utimes utimes "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_futimes_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_futimes_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_futimes futimes "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + r0, _, e1 := syscall_syscall(libc_poll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -249,6 +329,10 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { return } +var libc_poll_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_poll poll "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Madvise(b []byte, behav int) (err error) { @@ -258,13 +342,17 @@ func Madvise(b []byte, behav int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) + _, _, e1 := syscall_syscall(libc_madvise_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(behav)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_madvise_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_madvise madvise "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { @@ -274,23 +362,31 @@ func Mlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_mlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mlock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mlock mlock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall(libc_mlockall_trampoline_addr, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mlockall_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mlockall mlockall "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { @@ -300,13 +396,17 @@ func Mprotect(b []byte, prot int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + _, _, e1 := syscall_syscall(libc_mprotect_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mprotect_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mprotect mprotect "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Msync(b []byte, flags int) (err error) { @@ -316,13 +416,17 @@ func Msync(b []byte, flags int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_msync_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_msync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_msync msync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { @@ -332,33 +436,45 @@ func Munlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_munlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_munlock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munlock munlock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) + _, _, e1 := syscall_syscall(libc_munlockall_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_munlockall_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munlockall munlockall "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + _, _, e1 := syscall_rawSyscall(libc_pipe2_trampoline_addr, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_pipe2_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdents(fd int, buf []byte) (n int, err error) { @@ -368,7 +484,7 @@ func Getdents(fd int, buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) + r0, _, e1 := syscall_syscall(libc_getdents_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -376,6 +492,10 @@ func Getdents(fd int, buf []byte) (n int, err error) { return } +var libc_getdents_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getdents getdents "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getcwd(buf []byte) (n int, err error) { @@ -385,7 +505,7 @@ func Getcwd(buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) + r0, _, e1 := syscall_syscall(libc_getcwd_trampoline_addr, uintptr(_p0), uintptr(len(buf)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -393,16 +513,24 @@ func Getcwd(buf []byte) (n int, err error) { return } +var libc_getcwd_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getcwd getcwd "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -412,17 +540,21 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := syscall_syscall6(libc_sysctl_trampoline_addr, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_sysctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sysctl sysctl "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -430,6 +562,10 @@ func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, return } +var libc_ppoll_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ppoll ppoll "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { @@ -438,23 +574,31 @@ func Access(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_access_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_access_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_access access "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + _, _, e1 := syscall_syscall(libc_adjtime_trampoline_addr, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_adjtime_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_adjtime adjtime "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { @@ -463,13 +607,17 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chdir chdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { @@ -478,13 +626,17 @@ func Chflags(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_chflags_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chflags_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chflags chflags "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { @@ -493,13 +645,17 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_chmod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chmod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chmod chmod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { @@ -508,13 +664,17 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_chown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chown chown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { @@ -523,27 +683,49 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chroot_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_chroot_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chroot chroot "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := syscall_syscall(libc_clock_gettime_trampoline_addr, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_clock_gettime_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_clock_gettime clock_gettime "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_close_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_close_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_close close "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := syscall_syscall(libc_dup_trampoline_addr, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -551,33 +733,49 @@ func Dup(fd int) (nfd int, err error) { return } +var libc_dup_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup dup "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := syscall_syscall(libc_dup2_trampoline_addr, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_dup2_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup2 dup2 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup3(from int, to int, flags int) (err error) { - _, _, e1 := Syscall(SYS_DUP3, uintptr(from), uintptr(to), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_dup3_trampoline_addr, uintptr(from), uintptr(to), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_dup3_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup3 dup3 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) + syscall_syscall(libc_exit_trampoline_addr, uintptr(code), 0, 0) return } +var libc_exit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_exit exit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -586,43 +784,59 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_faccessat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_faccessat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_faccessat faccessat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fchdir_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchdir fchdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_fchflags_trampoline_addr, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchflags_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchflags fchflags "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_fchmod_trampoline_addr, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchmod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchmod fchmod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -631,23 +845,31 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fchmodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchmodat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchmodat fchmodat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_fchown_trampoline_addr, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchown fchown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { @@ -656,27 +878,35 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_fchownat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchownat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchownat fchownat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_flock_trampoline_addr, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_flock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_flock flock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_fpathconf_trampoline_addr, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -684,16 +914,24 @@ func Fpathconf(fd int, name int) (val int, err error) { return } +var libc_fpathconf_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fpathconf fpathconf "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstat fstat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { @@ -702,71 +940,99 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fstatat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fstatat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstatat fstatat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstatfs_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fstatfs_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstatfs fstatfs "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fsync_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fsync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fsync fsync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length)) + _, _, e1 := syscall_syscall(libc_ftruncate_trampoline_addr, uintptr(fd), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_ftruncate_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ftruncate ftruncate "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getegid_trampoline_addr, 0, 0, 0) egid = int(r0) return } +var libc_getegid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getegid getegid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_geteuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } +var libc_geteuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_geteuid geteuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getgid_trampoline_addr, 0, 0, 0) gid = int(r0) return } +var libc_getgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getgid getgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getpgid_trampoline_addr, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -774,34 +1040,50 @@ func Getpgid(pid int) (pgid int, err error) { return } +var libc_getpgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpgid getpgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpgrp_trampoline_addr, 0, 0, 0) pgrp = int(r0) return } +var libc_getpgrp_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpgrp getpgrp "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpid_trampoline_addr, 0, 0, 0) pid = int(r0) return } +var libc_getpid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpid getpid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getppid_trampoline_addr, 0, 0, 0) ppid = int(r0) return } +var libc_getppid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getppid getppid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) + r0, _, e1 := syscall_syscall(libc_getpriority_trampoline_addr, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -809,20 +1091,28 @@ func Getpriority(which int, who int) (prio int, err error) { return } +var libc_getpriority_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpriority getpriority "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getrlimit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrlimit getrlimit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrtable() (rtable int, err error) { - r0, _, e1 := RawSyscall(SYS_GETRTABLE, 0, 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getrtable_trampoline_addr, 0, 0, 0) rtable = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -830,20 +1120,28 @@ func Getrtable() (rtable int, err error) { return } +var libc_getrtable_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrtable getrtable "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrusage_trampoline_addr, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getrusage_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrusage getrusage "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getsid_trampoline_addr, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -851,46 +1149,66 @@ func Getsid(pid int) (sid int, err error) { return } +var libc_getsid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsid getsid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_gettimeofday_trampoline_addr, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_gettimeofday_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_gettimeofday gettimeofday "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } +var libc_getuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getuid getuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) + r0, _, _ := syscall_syscall(libc_issetugid_trampoline_addr, 0, 0, 0) tainted = bool(r0 != 0) return } +var libc_issetugid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_issetugid issetugid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kill(pid int, signum syscall.Signal) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) + _, _, e1 := syscall_syscall(libc_kill_trampoline_addr, uintptr(pid), uintptr(signum), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_kill_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kill kill "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) + r0, _, e1 := syscall_syscall(libc_kqueue_trampoline_addr, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -898,6 +1216,10 @@ func Kqueue() (fd int, err error) { return } +var libc_kqueue_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kqueue kqueue "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { @@ -906,13 +1228,17 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_lchown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_lchown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lchown lchown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { @@ -926,13 +1252,17 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_link_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_link_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_link link "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { @@ -946,23 +1276,31 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er if err != nil { return } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_linkat_trampoline_addr, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_linkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_linkat linkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) + _, _, e1 := syscall_syscall(libc_listen_trampoline_addr, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_listen_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_listen listen "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { @@ -971,13 +1309,17 @@ func Lstat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_lstat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_lstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lstat lstat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(path string, mode uint32) (err error) { @@ -986,13 +1328,17 @@ func Mkdir(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkdir mkdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdirat(dirfd int, path string, mode uint32) (err error) { @@ -1001,13 +1347,17 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := syscall_syscall(libc_mkdirat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkdirat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkdirat mkdirat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { @@ -1016,13 +1366,17 @@ func Mkfifo(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkfifo_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkfifo_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkfifo mkfifo "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifoat(dirfd int, path string, mode uint32) (err error) { @@ -1031,13 +1385,17 @@ func Mkfifoat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := syscall_syscall(libc_mkfifoat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkfifoat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkfifoat mkfifoat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { @@ -1046,13 +1404,17 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + _, _, e1 := syscall_syscall(libc_mknod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mknod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mknod mknod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { @@ -1061,23 +1423,31 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) + _, _, e1 := syscall_syscall6(libc_mknodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mknodat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mknodat mknodat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Nanosleep(time *Timespec, leftover *Timespec) (err error) { - _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_nanosleep_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_nanosleep nanosleep "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { @@ -1086,7 +1456,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + r0, _, e1 := syscall_syscall(libc_open_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1094,6 +1464,10 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } +var libc_open_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_open open "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { @@ -1102,7 +1476,7 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + r0, _, e1 := syscall_syscall6(libc_openat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1110,6 +1484,10 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { return } +var libc_openat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_openat openat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { @@ -1118,7 +1496,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_pathconf_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1126,6 +1504,10 @@ func Pathconf(path string, name int) (val int, err error) { return } +var libc_pathconf_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pathconf pathconf "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pread(fd int, p []byte, offset int64) (n int, err error) { @@ -1135,7 +1517,7 @@ func pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) + r0, _, e1 := syscall_syscall6(libc_pread_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1143,6 +1525,10 @@ func pread(fd int, p []byte, offset int64) (n int, err error) { return } +var libc_pread_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pread pread "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pwrite(fd int, p []byte, offset int64) (n int, err error) { @@ -1152,7 +1538,7 @@ func pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) + r0, _, e1 := syscall_syscall6(libc_pwrite_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1160,6 +1546,10 @@ func pwrite(fd int, p []byte, offset int64) (n int, err error) { return } +var libc_pwrite_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pwrite pwrite "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { @@ -1169,7 +1559,7 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1177,6 +1567,10 @@ func read(fd int, p []byte) (n int, err error) { return } +var libc_read_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_read read "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { @@ -1191,7 +1585,7 @@ func Readlink(path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + r0, _, e1 := syscall_syscall(libc_readlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1199,6 +1593,10 @@ func Readlink(path string, buf []byte) (n int, err error) { return } +var libc_readlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readlink readlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { @@ -1213,7 +1611,7 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_readlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1221,6 +1619,10 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { return } +var libc_readlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readlinkat readlinkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { @@ -1234,13 +1636,17 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_rename_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_rename_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_rename rename "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Renameat(fromfd int, from string, tofd int, to string) (err error) { @@ -1254,13 +1660,17 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + _, _, e1 := syscall_syscall6(libc_renameat_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_renameat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renameat renameat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { @@ -1269,13 +1679,17 @@ func Revoke(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_revoke_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_revoke_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_revoke revoke "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { @@ -1284,17 +1698,21 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_rmdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_rmdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_rmdir rmdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0) + r0, _, e1 := syscall_syscall(libc_lseek_trampoline_addr, uintptr(fd), uintptr(offset), uintptr(whence)) newoffset = int64(r0) if e1 != 0 { err = errnoErr(e1) @@ -1302,10 +1720,14 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return } +var libc_lseek_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lseek lseek "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + r0, _, e1 := syscall_syscall6(libc_select_trampoline_addr, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1313,36 +1735,52 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err return } +var libc_select_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_select select "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setegid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setegid setegid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_seteuid_trampoline_addr, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_seteuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_seteuid seteuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setgid_trampoline_addr, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setgid setgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { @@ -1351,97 +1789,133 @@ func Setlogin(name string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_setlogin_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setlogin_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setlogin setlogin "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) + _, _, e1 := syscall_rawSyscall(libc_setpgid_trampoline_addr, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setpgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setpgid setpgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) + _, _, e1 := syscall_syscall(libc_setpriority_trampoline_addr, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setpriority_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setpriority setpriority "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + _, _, e1 := syscall_rawSyscall(libc_setregid_trampoline_addr, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setregid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setregid setregid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + _, _, e1 := syscall_rawSyscall(libc_setreuid_trampoline_addr, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setreuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setreuid setreuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) + _, _, e1 := syscall_rawSyscall(libc_setresgid_trampoline_addr, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setresgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setresgid setresgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) + _, _, e1 := syscall_rawSyscall(libc_setresuid_trampoline_addr, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setresuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setresuid setresuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setrlimit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrtable(rtable int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRTABLE, uintptr(rtable), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setrtable_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setrtable setrtable "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1449,26 +1923,38 @@ func Setsid() (pid int, err error) { return } +var libc_setsid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setsid setsid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_settimeofday_trampoline_addr, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_settimeofday_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_settimeofday settimeofday "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setuid_trampoline_addr, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setuid setuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { @@ -1477,13 +1963,17 @@ func Stat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_stat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_stat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_stat stat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, stat *Statfs_t) (err error) { @@ -1492,13 +1982,17 @@ func Statfs(path string, stat *Statfs_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_statfs_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_statfs_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_statfs statfs "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlink(path string, link string) (err error) { @@ -1512,13 +2006,17 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_symlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_symlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_symlink symlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { @@ -1532,23 +2030,31 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + _, _, e1 := syscall_syscall(libc_symlinkat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } +var libc_symlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_symlinkat symlinkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) + _, _, e1 := syscall_syscall(libc_sync_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_sync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sync sync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { @@ -1557,21 +2063,29 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length)) + _, _, e1 := syscall_syscall(libc_truncate_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_truncate_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_truncate truncate "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) + r0, _, _ := syscall_syscall(libc_umask_trampoline_addr, uintptr(newmask), 0, 0) oldmask = int(r0) return } +var libc_umask_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_umask umask "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { @@ -1580,13 +2094,17 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_unlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_unlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unlink unlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlinkat(dirfd int, path string, flags int) (err error) { @@ -1595,13 +2113,17 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_unlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_unlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unlinkat unlinkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { @@ -1610,13 +2132,17 @@ func Unmount(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_unmount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_unmount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unmount unmount "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { @@ -1626,7 +2152,7 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1634,10 +2160,14 @@ func write(fd int, p []byte) (n int, err error) { return } +var libc_write_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_write write "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) + r0, _, e1 := syscall_syscall6(libc_mmap_trampoline_addr, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -1645,20 +2175,28 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } +var libc_mmap_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mmap mmap "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_munmap_trampoline_addr, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_munmap_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munmap munmap "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1669,7 +2207,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1685,9 +2223,13 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error if err != nil { return } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_utimensat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } + +var libc_utimensat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_utimensat utimensat "libc.so" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s new file mode 100644 index 000000000000..484bb42e0a89 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s @@ -0,0 +1,669 @@ +// go run mkasm.go openbsd arm64 +// Code generated by the command above; DO NOT EDIT. + +#include "textflag.h" + +TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getgroups(SB) +GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgroups_trampoline_addr(SB)/8, $libc_getgroups_trampoline<>(SB) + +TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setgroups(SB) +GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgroups_trampoline_addr(SB)/8, $libc_setgroups_trampoline<>(SB) + +TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_wait4(SB) +GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $8 +DATA ·libc_wait4_trampoline_addr(SB)/8, $libc_wait4_trampoline<>(SB) + +TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_accept(SB) +GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $8 +DATA ·libc_accept_trampoline_addr(SB)/8, $libc_accept_trampoline<>(SB) + +TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_bind(SB) +GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $8 +DATA ·libc_bind_trampoline_addr(SB)/8, $libc_bind_trampoline<>(SB) + +TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_connect(SB) +GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_connect_trampoline_addr(SB)/8, $libc_connect_trampoline<>(SB) + +TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_socket(SB) +GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socket_trampoline_addr(SB)/8, $libc_socket_trampoline<>(SB) + +TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsockopt(SB) +GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockopt_trampoline_addr(SB)/8, $libc_getsockopt_trampoline<>(SB) + +TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setsockopt(SB) +GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsockopt_trampoline_addr(SB)/8, $libc_setsockopt_trampoline<>(SB) + +TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpeername(SB) +GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpeername_trampoline_addr(SB)/8, $libc_getpeername_trampoline<>(SB) + +TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsockname(SB) +GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockname_trampoline_addr(SB)/8, $libc_getsockname_trampoline<>(SB) + +TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shutdown(SB) +GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shutdown_trampoline_addr(SB)/8, $libc_shutdown_trampoline<>(SB) + +TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_socketpair(SB) +GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socketpair_trampoline_addr(SB)/8, $libc_socketpair_trampoline<>(SB) + +TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_recvfrom(SB) +GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvfrom_trampoline_addr(SB)/8, $libc_recvfrom_trampoline<>(SB) + +TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sendto(SB) +GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendto_trampoline_addr(SB)/8, $libc_sendto_trampoline<>(SB) + +TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_recvmsg(SB) +GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvmsg_trampoline_addr(SB)/8, $libc_recvmsg_trampoline<>(SB) + +TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sendmsg(SB) +GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendmsg_trampoline_addr(SB)/8, $libc_sendmsg_trampoline<>(SB) + +TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kevent(SB) +GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kevent_trampoline_addr(SB)/8, $libc_kevent_trampoline<>(SB) + +TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_utimes(SB) +GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_utimes_trampoline_addr(SB)/8, $libc_utimes_trampoline<>(SB) + +TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_futimes(SB) +GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_futimes_trampoline_addr(SB)/8, $libc_futimes_trampoline<>(SB) + +TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_poll(SB) +GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $8 +DATA ·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB) + +TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_madvise(SB) +GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $8 +DATA ·libc_madvise_trampoline_addr(SB)/8, $libc_madvise_trampoline<>(SB) + +TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mlock(SB) +GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlock_trampoline_addr(SB)/8, $libc_mlock_trampoline<>(SB) + +TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mlockall(SB) +GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlockall_trampoline_addr(SB)/8, $libc_mlockall_trampoline<>(SB) + +TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mprotect(SB) +GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mprotect_trampoline_addr(SB)/8, $libc_mprotect_trampoline<>(SB) + +TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_msync(SB) +GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_msync_trampoline_addr(SB)/8, $libc_msync_trampoline<>(SB) + +TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munlock(SB) +GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlock_trampoline_addr(SB)/8, $libc_munlock_trampoline<>(SB) + +TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munlockall(SB) +GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB) + +TEXT libc_pipe2_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pipe2(SB) +GLOBL ·libc_pipe2_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pipe2_trampoline_addr(SB)/8, $libc_pipe2_trampoline<>(SB) + +TEXT libc_getdents_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getdents(SB) +GLOBL ·libc_getdents_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getdents_trampoline_addr(SB)/8, $libc_getdents_trampoline<>(SB) + +TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getcwd(SB) +GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) + +TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ioctl(SB) +GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) + +TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sysctl(SB) +GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) + +TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ppoll(SB) +GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ppoll_trampoline_addr(SB)/8, $libc_ppoll_trampoline<>(SB) + +TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_access(SB) +GLOBL ·libc_access_trampoline_addr(SB), RODATA, $8 +DATA ·libc_access_trampoline_addr(SB)/8, $libc_access_trampoline<>(SB) + +TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_adjtime(SB) +GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_adjtime_trampoline_addr(SB)/8, $libc_adjtime_trampoline<>(SB) + +TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chdir(SB) +GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chdir_trampoline_addr(SB)/8, $libc_chdir_trampoline<>(SB) + +TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chflags(SB) +GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chflags_trampoline_addr(SB)/8, $libc_chflags_trampoline<>(SB) + +TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chmod(SB) +GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chmod_trampoline_addr(SB)/8, $libc_chmod_trampoline<>(SB) + +TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chown(SB) +GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chown_trampoline_addr(SB)/8, $libc_chown_trampoline<>(SB) + +TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chroot(SB) +GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chroot_trampoline_addr(SB)/8, $libc_chroot_trampoline<>(SB) + +TEXT libc_clock_gettime_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_clock_gettime(SB) +GLOBL ·libc_clock_gettime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clock_gettime_trampoline_addr(SB)/8, $libc_clock_gettime_trampoline<>(SB) + +TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_close(SB) +GLOBL ·libc_close_trampoline_addr(SB), RODATA, $8 +DATA ·libc_close_trampoline_addr(SB)/8, $libc_close_trampoline<>(SB) + +TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup(SB) +GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup_trampoline_addr(SB)/8, $libc_dup_trampoline<>(SB) + +TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup2(SB) +GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup2_trampoline_addr(SB)/8, $libc_dup2_trampoline<>(SB) + +TEXT libc_dup3_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup3(SB) +GLOBL ·libc_dup3_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup3_trampoline_addr(SB)/8, $libc_dup3_trampoline<>(SB) + +TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_exit(SB) +GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_exit_trampoline_addr(SB)/8, $libc_exit_trampoline<>(SB) + +TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_faccessat(SB) +GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_faccessat_trampoline_addr(SB)/8, $libc_faccessat_trampoline<>(SB) + +TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchdir(SB) +GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchdir_trampoline_addr(SB)/8, $libc_fchdir_trampoline<>(SB) + +TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchflags(SB) +GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchflags_trampoline_addr(SB)/8, $libc_fchflags_trampoline<>(SB) + +TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchmod(SB) +GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmod_trampoline_addr(SB)/8, $libc_fchmod_trampoline<>(SB) + +TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchmodat(SB) +GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmodat_trampoline_addr(SB)/8, $libc_fchmodat_trampoline<>(SB) + +TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchown(SB) +GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchown_trampoline_addr(SB)/8, $libc_fchown_trampoline<>(SB) + +TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchownat(SB) +GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchownat_trampoline_addr(SB)/8, $libc_fchownat_trampoline<>(SB) + +TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_flock(SB) +GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_flock_trampoline_addr(SB)/8, $libc_flock_trampoline<>(SB) + +TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fpathconf(SB) +GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fpathconf_trampoline_addr(SB)/8, $libc_fpathconf_trampoline<>(SB) + +TEXT libc_fstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstat(SB) +GLOBL ·libc_fstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstat_trampoline_addr(SB)/8, $libc_fstat_trampoline<>(SB) + +TEXT libc_fstatat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstatat(SB) +GLOBL ·libc_fstatat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatat_trampoline_addr(SB)/8, $libc_fstatat_trampoline<>(SB) + +TEXT libc_fstatfs_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstatfs(SB) +GLOBL ·libc_fstatfs_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatfs_trampoline_addr(SB)/8, $libc_fstatfs_trampoline<>(SB) + +TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fsync(SB) +GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fsync_trampoline_addr(SB)/8, $libc_fsync_trampoline<>(SB) + +TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ftruncate(SB) +GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ftruncate_trampoline_addr(SB)/8, $libc_ftruncate_trampoline<>(SB) + +TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getegid(SB) +GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getegid_trampoline_addr(SB)/8, $libc_getegid_trampoline<>(SB) + +TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_geteuid(SB) +GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_geteuid_trampoline_addr(SB)/8, $libc_geteuid_trampoline<>(SB) + +TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getgid(SB) +GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgid_trampoline_addr(SB)/8, $libc_getgid_trampoline<>(SB) + +TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpgid(SB) +GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgid_trampoline_addr(SB)/8, $libc_getpgid_trampoline<>(SB) + +TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpgrp(SB) +GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgrp_trampoline_addr(SB)/8, $libc_getpgrp_trampoline<>(SB) + +TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpid(SB) +GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpid_trampoline_addr(SB)/8, $libc_getpid_trampoline<>(SB) + +TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getppid(SB) +GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getppid_trampoline_addr(SB)/8, $libc_getppid_trampoline<>(SB) + +TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpriority(SB) +GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpriority_trampoline_addr(SB)/8, $libc_getpriority_trampoline<>(SB) + +TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrlimit(SB) +GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrlimit_trampoline_addr(SB)/8, $libc_getrlimit_trampoline<>(SB) + +TEXT libc_getrtable_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrtable(SB) +GLOBL ·libc_getrtable_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrtable_trampoline_addr(SB)/8, $libc_getrtable_trampoline<>(SB) + +TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrusage(SB) +GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrusage_trampoline_addr(SB)/8, $libc_getrusage_trampoline<>(SB) + +TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsid(SB) +GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsid_trampoline_addr(SB)/8, $libc_getsid_trampoline<>(SB) + +TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_gettimeofday(SB) +GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_gettimeofday_trampoline_addr(SB)/8, $libc_gettimeofday_trampoline<>(SB) + +TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getuid(SB) +GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getuid_trampoline_addr(SB)/8, $libc_getuid_trampoline<>(SB) + +TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_issetugid(SB) +GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_issetugid_trampoline_addr(SB)/8, $libc_issetugid_trampoline<>(SB) + +TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kill(SB) +GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kill_trampoline_addr(SB)/8, $libc_kill_trampoline<>(SB) + +TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kqueue(SB) +GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kqueue_trampoline_addr(SB)/8, $libc_kqueue_trampoline<>(SB) + +TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lchown(SB) +GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lchown_trampoline_addr(SB)/8, $libc_lchown_trampoline<>(SB) + +TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_link(SB) +GLOBL ·libc_link_trampoline_addr(SB), RODATA, $8 +DATA ·libc_link_trampoline_addr(SB)/8, $libc_link_trampoline<>(SB) + +TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_linkat(SB) +GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_linkat_trampoline_addr(SB)/8, $libc_linkat_trampoline<>(SB) + +TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_listen(SB) +GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $8 +DATA ·libc_listen_trampoline_addr(SB)/8, $libc_listen_trampoline<>(SB) + +TEXT libc_lstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lstat(SB) +GLOBL ·libc_lstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lstat_trampoline_addr(SB)/8, $libc_lstat_trampoline<>(SB) + +TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkdir(SB) +GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdir_trampoline_addr(SB)/8, $libc_mkdir_trampoline<>(SB) + +TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkdirat(SB) +GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdirat_trampoline_addr(SB)/8, $libc_mkdirat_trampoline<>(SB) + +TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkfifo(SB) +GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkfifo_trampoline_addr(SB)/8, $libc_mkfifo_trampoline<>(SB) + +TEXT libc_mkfifoat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkfifoat(SB) +GLOBL ·libc_mkfifoat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkfifoat_trampoline_addr(SB)/8, $libc_mkfifoat_trampoline<>(SB) + +TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mknod(SB) +GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB) + +TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mknodat(SB) +GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) + +TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_nanosleep(SB) +GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 +DATA ·libc_nanosleep_trampoline_addr(SB)/8, $libc_nanosleep_trampoline<>(SB) + +TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_open(SB) +GLOBL ·libc_open_trampoline_addr(SB), RODATA, $8 +DATA ·libc_open_trampoline_addr(SB)/8, $libc_open_trampoline<>(SB) + +TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_openat(SB) +GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_openat_trampoline_addr(SB)/8, $libc_openat_trampoline<>(SB) + +TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pathconf(SB) +GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pathconf_trampoline_addr(SB)/8, $libc_pathconf_trampoline<>(SB) + +TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pread(SB) +GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pread_trampoline_addr(SB)/8, $libc_pread_trampoline<>(SB) + +TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pwrite(SB) +GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pwrite_trampoline_addr(SB)/8, $libc_pwrite_trampoline<>(SB) + +TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_read(SB) +GLOBL ·libc_read_trampoline_addr(SB), RODATA, $8 +DATA ·libc_read_trampoline_addr(SB)/8, $libc_read_trampoline<>(SB) + +TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readlink(SB) +GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlink_trampoline_addr(SB)/8, $libc_readlink_trampoline<>(SB) + +TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readlinkat(SB) +GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlinkat_trampoline_addr(SB)/8, $libc_readlinkat_trampoline<>(SB) + +TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_rename(SB) +GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rename_trampoline_addr(SB)/8, $libc_rename_trampoline<>(SB) + +TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renameat(SB) +GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameat_trampoline_addr(SB)/8, $libc_renameat_trampoline<>(SB) + +TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_revoke(SB) +GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $8 +DATA ·libc_revoke_trampoline_addr(SB)/8, $libc_revoke_trampoline<>(SB) + +TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_rmdir(SB) +GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rmdir_trampoline_addr(SB)/8, $libc_rmdir_trampoline<>(SB) + +TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lseek(SB) +GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lseek_trampoline_addr(SB)/8, $libc_lseek_trampoline<>(SB) + +TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_select(SB) +GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8 +DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB) + +TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setegid(SB) +GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setegid_trampoline_addr(SB)/8, $libc_setegid_trampoline<>(SB) + +TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_seteuid(SB) +GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_seteuid_trampoline_addr(SB)/8, $libc_seteuid_trampoline<>(SB) + +TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setgid(SB) +GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgid_trampoline_addr(SB)/8, $libc_setgid_trampoline<>(SB) + +TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setlogin(SB) +GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setlogin_trampoline_addr(SB)/8, $libc_setlogin_trampoline<>(SB) + +TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setpgid(SB) +GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpgid_trampoline_addr(SB)/8, $libc_setpgid_trampoline<>(SB) + +TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setpriority(SB) +GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpriority_trampoline_addr(SB)/8, $libc_setpriority_trampoline<>(SB) + +TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setregid(SB) +GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setregid_trampoline_addr(SB)/8, $libc_setregid_trampoline<>(SB) + +TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setreuid(SB) +GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB) + +TEXT libc_setresgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setresgid(SB) +GLOBL ·libc_setresgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setresgid_trampoline_addr(SB)/8, $libc_setresgid_trampoline<>(SB) + +TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setresuid(SB) +GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB) + +TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setrlimit(SB) +GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) + +TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setrtable(SB) +GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setrtable_trampoline_addr(SB)/8, $libc_setrtable_trampoline<>(SB) + +TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setsid(SB) +GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsid_trampoline_addr(SB)/8, $libc_setsid_trampoline<>(SB) + +TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_settimeofday(SB) +GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_settimeofday_trampoline_addr(SB)/8, $libc_settimeofday_trampoline<>(SB) + +TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setuid(SB) +GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setuid_trampoline_addr(SB)/8, $libc_setuid_trampoline<>(SB) + +TEXT libc_stat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_stat(SB) +GLOBL ·libc_stat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_stat_trampoline_addr(SB)/8, $libc_stat_trampoline<>(SB) + +TEXT libc_statfs_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_statfs(SB) +GLOBL ·libc_statfs_trampoline_addr(SB), RODATA, $8 +DATA ·libc_statfs_trampoline_addr(SB)/8, $libc_statfs_trampoline<>(SB) + +TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_symlink(SB) +GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlink_trampoline_addr(SB)/8, $libc_symlink_trampoline<>(SB) + +TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_symlinkat(SB) +GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlinkat_trampoline_addr(SB)/8, $libc_symlinkat_trampoline<>(SB) + +TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sync(SB) +GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sync_trampoline_addr(SB)/8, $libc_sync_trampoline<>(SB) + +TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_truncate(SB) +GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_truncate_trampoline_addr(SB)/8, $libc_truncate_trampoline<>(SB) + +TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_umask(SB) +GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $8 +DATA ·libc_umask_trampoline_addr(SB)/8, $libc_umask_trampoline<>(SB) + +TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unlink(SB) +GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlink_trampoline_addr(SB)/8, $libc_unlink_trampoline<>(SB) + +TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unlinkat(SB) +GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlinkat_trampoline_addr(SB)/8, $libc_unlinkat_trampoline<>(SB) + +TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unmount(SB) +GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unmount_trampoline_addr(SB)/8, $libc_unmount_trampoline<>(SB) + +TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_write(SB) +GLOBL ·libc_write_trampoline_addr(SB), RODATA, $8 +DATA ·libc_write_trampoline_addr(SB)/8, $libc_write_trampoline<>(SB) + +TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mmap(SB) +GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mmap_trampoline_addr(SB)/8, $libc_mmap_trampoline<>(SB) + +TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munmap(SB) +GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) + +TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_utimensat(SB) +GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go index 016d959bc664..6f33e37e723f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go @@ -1,4 +1,4 @@ -// go run mksyscall.go -openbsd -tags openbsd,mips64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_mips64.go +// go run mksyscall.go -openbsd -libc -tags openbsd,mips64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_mips64.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && mips64 @@ -16,7 +16,7 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + r0, _, e1 := syscall_rawSyscall(libc_getgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -24,20 +24,28 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } +var libc_getgroups_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getgroups getgroups "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + _, _, e1 := syscall_rawSyscall(libc_setgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setgroups_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setgroups setgroups "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_wait4_trampoline_addr, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -45,10 +53,14 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return } +var libc_wait4_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_wait4 wait4 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, _, e1 := syscall_syscall(libc_accept_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -56,30 +68,42 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } +var libc_accept_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_accept accept "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_bind_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_bind_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_bind bind "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_connect_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_connect_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_connect connect "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + r0, _, e1 := syscall_rawSyscall(libc_socket_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -87,66 +111,94 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } +var libc_socket_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_socket socket "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := syscall_syscall6(libc_getsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getsockopt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsockopt getsockopt "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := syscall_syscall6(libc_setsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setsockopt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setsockopt setsockopt "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getpeername_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getpeername_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpeername getpeername "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getsockname_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getsockname_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsockname getsockname "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_shutdown_trampoline_addr, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_shutdown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shutdown shutdown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := syscall_rawSyscall6(libc_socketpair_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_socketpair_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_socketpair socketpair "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { @@ -156,7 +208,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := syscall_syscall6(libc_recvfrom_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -164,6 +216,10 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } +var libc_recvfrom_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_recvfrom recvfrom "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { @@ -173,17 +229,21 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := syscall_syscall6(libc_sendto_trampoline_addr, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_sendto_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sendto sendto "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_recvmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -191,10 +251,14 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } +var libc_recvmsg_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_recvmsg recvmsg "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_sendmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -202,10 +266,14 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } +var libc_sendmsg_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sendmsg sendmsg "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + r0, _, e1 := syscall_syscall6(libc_kevent_trampoline_addr, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -213,6 +281,10 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne return } +var libc_kevent_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kevent kevent "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { @@ -221,27 +293,35 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_utimes_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_utimes_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_utimes utimes "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_futimes_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_futimes_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_futimes futimes "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + r0, _, e1 := syscall_syscall(libc_poll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -249,6 +329,10 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { return } +var libc_poll_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_poll poll "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Madvise(b []byte, behav int) (err error) { @@ -258,13 +342,17 @@ func Madvise(b []byte, behav int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) + _, _, e1 := syscall_syscall(libc_madvise_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(behav)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_madvise_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_madvise madvise "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { @@ -274,23 +362,31 @@ func Mlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_mlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mlock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mlock mlock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall(libc_mlockall_trampoline_addr, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mlockall_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mlockall mlockall "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { @@ -300,13 +396,17 @@ func Mprotect(b []byte, prot int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + _, _, e1 := syscall_syscall(libc_mprotect_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mprotect_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mprotect mprotect "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Msync(b []byte, flags int) (err error) { @@ -316,13 +416,17 @@ func Msync(b []byte, flags int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_msync_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_msync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_msync msync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { @@ -332,33 +436,45 @@ func Munlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_munlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_munlock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munlock munlock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) + _, _, e1 := syscall_syscall(libc_munlockall_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_munlockall_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munlockall munlockall "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + _, _, e1 := syscall_rawSyscall(libc_pipe2_trampoline_addr, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_pipe2_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdents(fd int, buf []byte) (n int, err error) { @@ -368,7 +484,7 @@ func Getdents(fd int, buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) + r0, _, e1 := syscall_syscall(libc_getdents_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -376,6 +492,10 @@ func Getdents(fd int, buf []byte) (n int, err error) { return } +var libc_getdents_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getdents getdents "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getcwd(buf []byte) (n int, err error) { @@ -385,7 +505,7 @@ func Getcwd(buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) + r0, _, e1 := syscall_syscall(libc_getcwd_trampoline_addr, uintptr(_p0), uintptr(len(buf)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -393,16 +513,24 @@ func Getcwd(buf []byte) (n int, err error) { return } +var libc_getcwd_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getcwd getcwd "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -412,17 +540,21 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := syscall_syscall6(libc_sysctl_trampoline_addr, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_sysctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sysctl sysctl "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -430,6 +562,10 @@ func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, return } +var libc_ppoll_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ppoll ppoll "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { @@ -438,23 +574,31 @@ func Access(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_access_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_access_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_access access "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + _, _, e1 := syscall_syscall(libc_adjtime_trampoline_addr, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_adjtime_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_adjtime adjtime "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { @@ -463,13 +607,17 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chdir chdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { @@ -478,13 +626,17 @@ func Chflags(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_chflags_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chflags_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chflags chflags "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { @@ -493,13 +645,17 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_chmod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chmod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chmod chmod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { @@ -508,13 +664,17 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_chown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_chown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chown chown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { @@ -523,27 +683,49 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chroot_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_chroot_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chroot chroot "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := syscall_syscall(libc_clock_gettime_trampoline_addr, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_clock_gettime_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_clock_gettime clock_gettime "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_close_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_close_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_close close "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := syscall_syscall(libc_dup_trampoline_addr, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -551,33 +733,49 @@ func Dup(fd int) (nfd int, err error) { return } +var libc_dup_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup dup "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := syscall_syscall(libc_dup2_trampoline_addr, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_dup2_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup2 dup2 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup3(from int, to int, flags int) (err error) { - _, _, e1 := Syscall(SYS_DUP3, uintptr(from), uintptr(to), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_dup3_trampoline_addr, uintptr(from), uintptr(to), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_dup3_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup3 dup3 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) + syscall_syscall(libc_exit_trampoline_addr, uintptr(code), 0, 0) return } +var libc_exit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_exit exit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -586,43 +784,59 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_faccessat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_faccessat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_faccessat faccessat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fchdir_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchdir fchdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_fchflags_trampoline_addr, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchflags_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchflags fchflags "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_fchmod_trampoline_addr, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchmod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchmod fchmod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { @@ -631,23 +845,31 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fchmodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchmodat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchmodat fchmodat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_fchown_trampoline_addr, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchown fchown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { @@ -656,27 +878,35 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_fchownat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fchownat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchownat fchownat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_flock_trampoline_addr, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_flock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_flock flock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_fpathconf_trampoline_addr, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -684,16 +914,24 @@ func Fpathconf(fd int, name int) (val int, err error) { return } +var libc_fpathconf_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fpathconf fpathconf "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstat fstat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { @@ -702,71 +940,99 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fstatat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fstatat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstatat fstatat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstatfs_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fstatfs_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstatfs fstatfs "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fsync_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_fsync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fsync fsync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length)) + _, _, e1 := syscall_syscall(libc_ftruncate_trampoline_addr, uintptr(fd), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_ftruncate_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ftruncate ftruncate "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getegid_trampoline_addr, 0, 0, 0) egid = int(r0) return } +var libc_getegid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getegid getegid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_geteuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } +var libc_geteuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_geteuid geteuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getgid_trampoline_addr, 0, 0, 0) gid = int(r0) return } +var libc_getgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getgid getgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getpgid_trampoline_addr, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -774,34 +1040,50 @@ func Getpgid(pid int) (pgid int, err error) { return } +var libc_getpgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpgid getpgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpgrp_trampoline_addr, 0, 0, 0) pgrp = int(r0) return } +var libc_getpgrp_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpgrp getpgrp "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpid_trampoline_addr, 0, 0, 0) pid = int(r0) return } +var libc_getpid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpid getpid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getppid_trampoline_addr, 0, 0, 0) ppid = int(r0) return } +var libc_getppid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getppid getppid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) + r0, _, e1 := syscall_syscall(libc_getpriority_trampoline_addr, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -809,20 +1091,28 @@ func Getpriority(which int, who int) (prio int, err error) { return } +var libc_getpriority_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpriority getpriority "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getrlimit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrlimit getrlimit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrtable() (rtable int, err error) { - r0, _, e1 := RawSyscall(SYS_GETRTABLE, 0, 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getrtable_trampoline_addr, 0, 0, 0) rtable = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -830,20 +1120,28 @@ func Getrtable() (rtable int, err error) { return } +var libc_getrtable_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrtable getrtable "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrusage_trampoline_addr, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_getrusage_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrusage getrusage "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getsid_trampoline_addr, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -851,46 +1149,66 @@ func Getsid(pid int) (sid int, err error) { return } +var libc_getsid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsid getsid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_gettimeofday_trampoline_addr, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_gettimeofday_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_gettimeofday gettimeofday "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } +var libc_getuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getuid getuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) + r0, _, _ := syscall_syscall(libc_issetugid_trampoline_addr, 0, 0, 0) tainted = bool(r0 != 0) return } +var libc_issetugid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_issetugid issetugid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kill(pid int, signum syscall.Signal) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) + _, _, e1 := syscall_syscall(libc_kill_trampoline_addr, uintptr(pid), uintptr(signum), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_kill_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kill kill "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) + r0, _, e1 := syscall_syscall(libc_kqueue_trampoline_addr, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -898,6 +1216,10 @@ func Kqueue() (fd int, err error) { return } +var libc_kqueue_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kqueue kqueue "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { @@ -906,13 +1228,17 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_lchown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_lchown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lchown lchown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { @@ -926,13 +1252,17 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_link_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_link_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_link link "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { @@ -946,23 +1276,31 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er if err != nil { return } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_linkat_trampoline_addr, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_linkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_linkat linkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) + _, _, e1 := syscall_syscall(libc_listen_trampoline_addr, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_listen_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_listen listen "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { @@ -971,13 +1309,17 @@ func Lstat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_lstat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_lstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lstat lstat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(path string, mode uint32) (err error) { @@ -986,13 +1328,17 @@ func Mkdir(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkdir mkdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdirat(dirfd int, path string, mode uint32) (err error) { @@ -1001,13 +1347,17 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := syscall_syscall(libc_mkdirat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkdirat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkdirat mkdirat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { @@ -1016,13 +1366,17 @@ func Mkfifo(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkfifo_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkfifo_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkfifo mkfifo "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifoat(dirfd int, path string, mode uint32) (err error) { @@ -1031,13 +1385,17 @@ func Mkfifoat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := syscall_syscall(libc_mkfifoat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mkfifoat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkfifoat mkfifoat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { @@ -1046,13 +1404,17 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + _, _, e1 := syscall_syscall(libc_mknod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mknod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mknod mknod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { @@ -1061,23 +1423,31 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) + _, _, e1 := syscall_syscall6(libc_mknodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_mknodat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mknodat mknodat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Nanosleep(time *Timespec, leftover *Timespec) (err error) { - _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_nanosleep_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_nanosleep nanosleep "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { @@ -1086,7 +1456,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + r0, _, e1 := syscall_syscall(libc_open_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1094,6 +1464,10 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } +var libc_open_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_open open "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { @@ -1102,7 +1476,7 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + r0, _, e1 := syscall_syscall6(libc_openat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1110,6 +1484,10 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { return } +var libc_openat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_openat openat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { @@ -1118,7 +1496,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_pathconf_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1126,6 +1504,10 @@ func Pathconf(path string, name int) (val int, err error) { return } +var libc_pathconf_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pathconf pathconf "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pread(fd int, p []byte, offset int64) (n int, err error) { @@ -1135,7 +1517,7 @@ func pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) + r0, _, e1 := syscall_syscall6(libc_pread_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1143,6 +1525,10 @@ func pread(fd int, p []byte, offset int64) (n int, err error) { return } +var libc_pread_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pread pread "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pwrite(fd int, p []byte, offset int64) (n int, err error) { @@ -1152,7 +1538,7 @@ func pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) + r0, _, e1 := syscall_syscall6(libc_pwrite_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1160,6 +1546,10 @@ func pwrite(fd int, p []byte, offset int64) (n int, err error) { return } +var libc_pwrite_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pwrite pwrite "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { @@ -1169,7 +1559,7 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1177,6 +1567,10 @@ func read(fd int, p []byte) (n int, err error) { return } +var libc_read_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_read read "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { @@ -1191,7 +1585,7 @@ func Readlink(path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + r0, _, e1 := syscall_syscall(libc_readlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1199,6 +1593,10 @@ func Readlink(path string, buf []byte) (n int, err error) { return } +var libc_readlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readlink readlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { @@ -1213,7 +1611,7 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_readlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1221,6 +1619,10 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { return } +var libc_readlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readlinkat readlinkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { @@ -1234,13 +1636,17 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_rename_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_rename_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_rename rename "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Renameat(fromfd int, from string, tofd int, to string) (err error) { @@ -1254,13 +1660,17 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) { if err != nil { return } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + _, _, e1 := syscall_syscall6(libc_renameat_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_renameat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renameat renameat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { @@ -1269,13 +1679,17 @@ func Revoke(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_revoke_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_revoke_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_revoke revoke "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { @@ -1284,17 +1698,21 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_rmdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_rmdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_rmdir rmdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0) + r0, _, e1 := syscall_syscall(libc_lseek_trampoline_addr, uintptr(fd), uintptr(offset), uintptr(whence)) newoffset = int64(r0) if e1 != 0 { err = errnoErr(e1) @@ -1302,10 +1720,14 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return } +var libc_lseek_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lseek lseek "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + r0, _, e1 := syscall_syscall6(libc_select_trampoline_addr, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1313,36 +1735,52 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err return } +var libc_select_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_select select "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setegid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setegid setegid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_seteuid_trampoline_addr, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_seteuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_seteuid seteuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setgid_trampoline_addr, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setgid setgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { @@ -1351,97 +1789,133 @@ func Setlogin(name string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_setlogin_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setlogin_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setlogin setlogin "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) + _, _, e1 := syscall_rawSyscall(libc_setpgid_trampoline_addr, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setpgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setpgid setpgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) + _, _, e1 := syscall_syscall(libc_setpriority_trampoline_addr, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setpriority_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setpriority setpriority "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + _, _, e1 := syscall_rawSyscall(libc_setregid_trampoline_addr, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setregid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setregid setregid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + _, _, e1 := syscall_rawSyscall(libc_setreuid_trampoline_addr, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setreuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setreuid setreuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setresgid(rgid int, egid int, sgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) + _, _, e1 := syscall_rawSyscall(libc_setresgid_trampoline_addr, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setresgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setresgid setresgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setresuid(ruid int, euid int, suid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) + _, _, e1 := syscall_rawSyscall(libc_setresuid_trampoline_addr, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setresuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setresuid setresuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setrlimit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrtable(rtable int) (err error) { - _, _, e1 := RawSyscall(SYS_SETRTABLE, uintptr(rtable), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setrtable_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setrtable setrtable "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1449,26 +1923,38 @@ func Setsid() (pid int, err error) { return } +var libc_setsid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setsid setsid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_settimeofday_trampoline_addr, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_settimeofday_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_settimeofday settimeofday "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setuid_trampoline_addr, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_setuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setuid setuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { @@ -1477,13 +1963,17 @@ func Stat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_stat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_stat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_stat stat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, stat *Statfs_t) (err error) { @@ -1492,13 +1982,17 @@ func Statfs(path string, stat *Statfs_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_statfs_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_statfs_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_statfs statfs "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlink(path string, link string) (err error) { @@ -1512,13 +2006,17 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_symlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_symlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_symlink symlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { @@ -1532,23 +2030,31 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + _, _, e1 := syscall_syscall(libc_symlinkat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } +var libc_symlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_symlinkat symlinkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) + _, _, e1 := syscall_syscall(libc_sync_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_sync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sync sync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { @@ -1557,21 +2063,29 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length)) + _, _, e1 := syscall_syscall(libc_truncate_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_truncate_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_truncate truncate "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) + r0, _, _ := syscall_syscall(libc_umask_trampoline_addr, uintptr(newmask), 0, 0) oldmask = int(r0) return } +var libc_umask_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_umask umask "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { @@ -1580,13 +2094,17 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_unlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_unlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unlink unlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlinkat(dirfd int, path string, flags int) (err error) { @@ -1595,13 +2113,17 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_unlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } +var libc_unlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unlinkat unlinkat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { @@ -1610,13 +2132,17 @@ func Unmount(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_unmount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_unmount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unmount unmount "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { @@ -1626,7 +2152,7 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1634,10 +2160,14 @@ func write(fd int, p []byte) (n int, err error) { return } +var libc_write_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_write write "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) + r0, _, e1 := syscall_syscall6(libc_mmap_trampoline_addr, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -1645,20 +2175,28 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } +var libc_mmap_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mmap mmap "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_munmap_trampoline_addr, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +var libc_munmap_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munmap munmap "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1669,7 +2207,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1685,9 +2223,13 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error if err != nil { return } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_utimensat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } + +var libc_utimensat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_utimensat utimensat "libc.so" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s new file mode 100644 index 000000000000..55af27263ad7 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s @@ -0,0 +1,669 @@ +// go run mkasm.go openbsd mips64 +// Code generated by the command above; DO NOT EDIT. + +#include "textflag.h" + +TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getgroups(SB) +GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgroups_trampoline_addr(SB)/8, $libc_getgroups_trampoline<>(SB) + +TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setgroups(SB) +GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgroups_trampoline_addr(SB)/8, $libc_setgroups_trampoline<>(SB) + +TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_wait4(SB) +GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $8 +DATA ·libc_wait4_trampoline_addr(SB)/8, $libc_wait4_trampoline<>(SB) + +TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_accept(SB) +GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $8 +DATA ·libc_accept_trampoline_addr(SB)/8, $libc_accept_trampoline<>(SB) + +TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_bind(SB) +GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $8 +DATA ·libc_bind_trampoline_addr(SB)/8, $libc_bind_trampoline<>(SB) + +TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_connect(SB) +GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_connect_trampoline_addr(SB)/8, $libc_connect_trampoline<>(SB) + +TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_socket(SB) +GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socket_trampoline_addr(SB)/8, $libc_socket_trampoline<>(SB) + +TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsockopt(SB) +GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockopt_trampoline_addr(SB)/8, $libc_getsockopt_trampoline<>(SB) + +TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setsockopt(SB) +GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsockopt_trampoline_addr(SB)/8, $libc_setsockopt_trampoline<>(SB) + +TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpeername(SB) +GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpeername_trampoline_addr(SB)/8, $libc_getpeername_trampoline<>(SB) + +TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsockname(SB) +GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockname_trampoline_addr(SB)/8, $libc_getsockname_trampoline<>(SB) + +TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shutdown(SB) +GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shutdown_trampoline_addr(SB)/8, $libc_shutdown_trampoline<>(SB) + +TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_socketpair(SB) +GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socketpair_trampoline_addr(SB)/8, $libc_socketpair_trampoline<>(SB) + +TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_recvfrom(SB) +GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvfrom_trampoline_addr(SB)/8, $libc_recvfrom_trampoline<>(SB) + +TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sendto(SB) +GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendto_trampoline_addr(SB)/8, $libc_sendto_trampoline<>(SB) + +TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_recvmsg(SB) +GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvmsg_trampoline_addr(SB)/8, $libc_recvmsg_trampoline<>(SB) + +TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sendmsg(SB) +GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendmsg_trampoline_addr(SB)/8, $libc_sendmsg_trampoline<>(SB) + +TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kevent(SB) +GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kevent_trampoline_addr(SB)/8, $libc_kevent_trampoline<>(SB) + +TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_utimes(SB) +GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_utimes_trampoline_addr(SB)/8, $libc_utimes_trampoline<>(SB) + +TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_futimes(SB) +GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_futimes_trampoline_addr(SB)/8, $libc_futimes_trampoline<>(SB) + +TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_poll(SB) +GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $8 +DATA ·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB) + +TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_madvise(SB) +GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $8 +DATA ·libc_madvise_trampoline_addr(SB)/8, $libc_madvise_trampoline<>(SB) + +TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mlock(SB) +GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlock_trampoline_addr(SB)/8, $libc_mlock_trampoline<>(SB) + +TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mlockall(SB) +GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlockall_trampoline_addr(SB)/8, $libc_mlockall_trampoline<>(SB) + +TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mprotect(SB) +GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mprotect_trampoline_addr(SB)/8, $libc_mprotect_trampoline<>(SB) + +TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_msync(SB) +GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_msync_trampoline_addr(SB)/8, $libc_msync_trampoline<>(SB) + +TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munlock(SB) +GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlock_trampoline_addr(SB)/8, $libc_munlock_trampoline<>(SB) + +TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munlockall(SB) +GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB) + +TEXT libc_pipe2_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pipe2(SB) +GLOBL ·libc_pipe2_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pipe2_trampoline_addr(SB)/8, $libc_pipe2_trampoline<>(SB) + +TEXT libc_getdents_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getdents(SB) +GLOBL ·libc_getdents_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getdents_trampoline_addr(SB)/8, $libc_getdents_trampoline<>(SB) + +TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getcwd(SB) +GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) + +TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ioctl(SB) +GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) + +TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sysctl(SB) +GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) + +TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ppoll(SB) +GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ppoll_trampoline_addr(SB)/8, $libc_ppoll_trampoline<>(SB) + +TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_access(SB) +GLOBL ·libc_access_trampoline_addr(SB), RODATA, $8 +DATA ·libc_access_trampoline_addr(SB)/8, $libc_access_trampoline<>(SB) + +TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_adjtime(SB) +GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_adjtime_trampoline_addr(SB)/8, $libc_adjtime_trampoline<>(SB) + +TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chdir(SB) +GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chdir_trampoline_addr(SB)/8, $libc_chdir_trampoline<>(SB) + +TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chflags(SB) +GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chflags_trampoline_addr(SB)/8, $libc_chflags_trampoline<>(SB) + +TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chmod(SB) +GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chmod_trampoline_addr(SB)/8, $libc_chmod_trampoline<>(SB) + +TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chown(SB) +GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chown_trampoline_addr(SB)/8, $libc_chown_trampoline<>(SB) + +TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chroot(SB) +GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chroot_trampoline_addr(SB)/8, $libc_chroot_trampoline<>(SB) + +TEXT libc_clock_gettime_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_clock_gettime(SB) +GLOBL ·libc_clock_gettime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clock_gettime_trampoline_addr(SB)/8, $libc_clock_gettime_trampoline<>(SB) + +TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_close(SB) +GLOBL ·libc_close_trampoline_addr(SB), RODATA, $8 +DATA ·libc_close_trampoline_addr(SB)/8, $libc_close_trampoline<>(SB) + +TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup(SB) +GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup_trampoline_addr(SB)/8, $libc_dup_trampoline<>(SB) + +TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup2(SB) +GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup2_trampoline_addr(SB)/8, $libc_dup2_trampoline<>(SB) + +TEXT libc_dup3_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup3(SB) +GLOBL ·libc_dup3_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup3_trampoline_addr(SB)/8, $libc_dup3_trampoline<>(SB) + +TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_exit(SB) +GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_exit_trampoline_addr(SB)/8, $libc_exit_trampoline<>(SB) + +TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_faccessat(SB) +GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_faccessat_trampoline_addr(SB)/8, $libc_faccessat_trampoline<>(SB) + +TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchdir(SB) +GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchdir_trampoline_addr(SB)/8, $libc_fchdir_trampoline<>(SB) + +TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchflags(SB) +GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchflags_trampoline_addr(SB)/8, $libc_fchflags_trampoline<>(SB) + +TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchmod(SB) +GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmod_trampoline_addr(SB)/8, $libc_fchmod_trampoline<>(SB) + +TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchmodat(SB) +GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmodat_trampoline_addr(SB)/8, $libc_fchmodat_trampoline<>(SB) + +TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchown(SB) +GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchown_trampoline_addr(SB)/8, $libc_fchown_trampoline<>(SB) + +TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchownat(SB) +GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchownat_trampoline_addr(SB)/8, $libc_fchownat_trampoline<>(SB) + +TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_flock(SB) +GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_flock_trampoline_addr(SB)/8, $libc_flock_trampoline<>(SB) + +TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fpathconf(SB) +GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fpathconf_trampoline_addr(SB)/8, $libc_fpathconf_trampoline<>(SB) + +TEXT libc_fstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstat(SB) +GLOBL ·libc_fstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstat_trampoline_addr(SB)/8, $libc_fstat_trampoline<>(SB) + +TEXT libc_fstatat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstatat(SB) +GLOBL ·libc_fstatat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatat_trampoline_addr(SB)/8, $libc_fstatat_trampoline<>(SB) + +TEXT libc_fstatfs_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstatfs(SB) +GLOBL ·libc_fstatfs_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatfs_trampoline_addr(SB)/8, $libc_fstatfs_trampoline<>(SB) + +TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fsync(SB) +GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fsync_trampoline_addr(SB)/8, $libc_fsync_trampoline<>(SB) + +TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ftruncate(SB) +GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ftruncate_trampoline_addr(SB)/8, $libc_ftruncate_trampoline<>(SB) + +TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getegid(SB) +GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getegid_trampoline_addr(SB)/8, $libc_getegid_trampoline<>(SB) + +TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_geteuid(SB) +GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_geteuid_trampoline_addr(SB)/8, $libc_geteuid_trampoline<>(SB) + +TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getgid(SB) +GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgid_trampoline_addr(SB)/8, $libc_getgid_trampoline<>(SB) + +TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpgid(SB) +GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgid_trampoline_addr(SB)/8, $libc_getpgid_trampoline<>(SB) + +TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpgrp(SB) +GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgrp_trampoline_addr(SB)/8, $libc_getpgrp_trampoline<>(SB) + +TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpid(SB) +GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpid_trampoline_addr(SB)/8, $libc_getpid_trampoline<>(SB) + +TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getppid(SB) +GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getppid_trampoline_addr(SB)/8, $libc_getppid_trampoline<>(SB) + +TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpriority(SB) +GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpriority_trampoline_addr(SB)/8, $libc_getpriority_trampoline<>(SB) + +TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrlimit(SB) +GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrlimit_trampoline_addr(SB)/8, $libc_getrlimit_trampoline<>(SB) + +TEXT libc_getrtable_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrtable(SB) +GLOBL ·libc_getrtable_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrtable_trampoline_addr(SB)/8, $libc_getrtable_trampoline<>(SB) + +TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrusage(SB) +GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrusage_trampoline_addr(SB)/8, $libc_getrusage_trampoline<>(SB) + +TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsid(SB) +GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsid_trampoline_addr(SB)/8, $libc_getsid_trampoline<>(SB) + +TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_gettimeofday(SB) +GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_gettimeofday_trampoline_addr(SB)/8, $libc_gettimeofday_trampoline<>(SB) + +TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getuid(SB) +GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getuid_trampoline_addr(SB)/8, $libc_getuid_trampoline<>(SB) + +TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_issetugid(SB) +GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_issetugid_trampoline_addr(SB)/8, $libc_issetugid_trampoline<>(SB) + +TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kill(SB) +GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kill_trampoline_addr(SB)/8, $libc_kill_trampoline<>(SB) + +TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kqueue(SB) +GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kqueue_trampoline_addr(SB)/8, $libc_kqueue_trampoline<>(SB) + +TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lchown(SB) +GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lchown_trampoline_addr(SB)/8, $libc_lchown_trampoline<>(SB) + +TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_link(SB) +GLOBL ·libc_link_trampoline_addr(SB), RODATA, $8 +DATA ·libc_link_trampoline_addr(SB)/8, $libc_link_trampoline<>(SB) + +TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_linkat(SB) +GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_linkat_trampoline_addr(SB)/8, $libc_linkat_trampoline<>(SB) + +TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_listen(SB) +GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $8 +DATA ·libc_listen_trampoline_addr(SB)/8, $libc_listen_trampoline<>(SB) + +TEXT libc_lstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lstat(SB) +GLOBL ·libc_lstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lstat_trampoline_addr(SB)/8, $libc_lstat_trampoline<>(SB) + +TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkdir(SB) +GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdir_trampoline_addr(SB)/8, $libc_mkdir_trampoline<>(SB) + +TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkdirat(SB) +GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdirat_trampoline_addr(SB)/8, $libc_mkdirat_trampoline<>(SB) + +TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkfifo(SB) +GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkfifo_trampoline_addr(SB)/8, $libc_mkfifo_trampoline<>(SB) + +TEXT libc_mkfifoat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkfifoat(SB) +GLOBL ·libc_mkfifoat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkfifoat_trampoline_addr(SB)/8, $libc_mkfifoat_trampoline<>(SB) + +TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mknod(SB) +GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB) + +TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mknodat(SB) +GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) + +TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_nanosleep(SB) +GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 +DATA ·libc_nanosleep_trampoline_addr(SB)/8, $libc_nanosleep_trampoline<>(SB) + +TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_open(SB) +GLOBL ·libc_open_trampoline_addr(SB), RODATA, $8 +DATA ·libc_open_trampoline_addr(SB)/8, $libc_open_trampoline<>(SB) + +TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_openat(SB) +GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_openat_trampoline_addr(SB)/8, $libc_openat_trampoline<>(SB) + +TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pathconf(SB) +GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pathconf_trampoline_addr(SB)/8, $libc_pathconf_trampoline<>(SB) + +TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pread(SB) +GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pread_trampoline_addr(SB)/8, $libc_pread_trampoline<>(SB) + +TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pwrite(SB) +GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pwrite_trampoline_addr(SB)/8, $libc_pwrite_trampoline<>(SB) + +TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_read(SB) +GLOBL ·libc_read_trampoline_addr(SB), RODATA, $8 +DATA ·libc_read_trampoline_addr(SB)/8, $libc_read_trampoline<>(SB) + +TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readlink(SB) +GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlink_trampoline_addr(SB)/8, $libc_readlink_trampoline<>(SB) + +TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readlinkat(SB) +GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlinkat_trampoline_addr(SB)/8, $libc_readlinkat_trampoline<>(SB) + +TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_rename(SB) +GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rename_trampoline_addr(SB)/8, $libc_rename_trampoline<>(SB) + +TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renameat(SB) +GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameat_trampoline_addr(SB)/8, $libc_renameat_trampoline<>(SB) + +TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_revoke(SB) +GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $8 +DATA ·libc_revoke_trampoline_addr(SB)/8, $libc_revoke_trampoline<>(SB) + +TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_rmdir(SB) +GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rmdir_trampoline_addr(SB)/8, $libc_rmdir_trampoline<>(SB) + +TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lseek(SB) +GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lseek_trampoline_addr(SB)/8, $libc_lseek_trampoline<>(SB) + +TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_select(SB) +GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8 +DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB) + +TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setegid(SB) +GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setegid_trampoline_addr(SB)/8, $libc_setegid_trampoline<>(SB) + +TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_seteuid(SB) +GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_seteuid_trampoline_addr(SB)/8, $libc_seteuid_trampoline<>(SB) + +TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setgid(SB) +GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgid_trampoline_addr(SB)/8, $libc_setgid_trampoline<>(SB) + +TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setlogin(SB) +GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setlogin_trampoline_addr(SB)/8, $libc_setlogin_trampoline<>(SB) + +TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setpgid(SB) +GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpgid_trampoline_addr(SB)/8, $libc_setpgid_trampoline<>(SB) + +TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setpriority(SB) +GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpriority_trampoline_addr(SB)/8, $libc_setpriority_trampoline<>(SB) + +TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setregid(SB) +GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setregid_trampoline_addr(SB)/8, $libc_setregid_trampoline<>(SB) + +TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setreuid(SB) +GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB) + +TEXT libc_setresgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setresgid(SB) +GLOBL ·libc_setresgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setresgid_trampoline_addr(SB)/8, $libc_setresgid_trampoline<>(SB) + +TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setresuid(SB) +GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB) + +TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setrlimit(SB) +GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) + +TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setrtable(SB) +GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setrtable_trampoline_addr(SB)/8, $libc_setrtable_trampoline<>(SB) + +TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setsid(SB) +GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsid_trampoline_addr(SB)/8, $libc_setsid_trampoline<>(SB) + +TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_settimeofday(SB) +GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_settimeofday_trampoline_addr(SB)/8, $libc_settimeofday_trampoline<>(SB) + +TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setuid(SB) +GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setuid_trampoline_addr(SB)/8, $libc_setuid_trampoline<>(SB) + +TEXT libc_stat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_stat(SB) +GLOBL ·libc_stat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_stat_trampoline_addr(SB)/8, $libc_stat_trampoline<>(SB) + +TEXT libc_statfs_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_statfs(SB) +GLOBL ·libc_statfs_trampoline_addr(SB), RODATA, $8 +DATA ·libc_statfs_trampoline_addr(SB)/8, $libc_statfs_trampoline<>(SB) + +TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_symlink(SB) +GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlink_trampoline_addr(SB)/8, $libc_symlink_trampoline<>(SB) + +TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_symlinkat(SB) +GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlinkat_trampoline_addr(SB)/8, $libc_symlinkat_trampoline<>(SB) + +TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sync(SB) +GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sync_trampoline_addr(SB)/8, $libc_sync_trampoline<>(SB) + +TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_truncate(SB) +GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_truncate_trampoline_addr(SB)/8, $libc_truncate_trampoline<>(SB) + +TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_umask(SB) +GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $8 +DATA ·libc_umask_trampoline_addr(SB)/8, $libc_umask_trampoline<>(SB) + +TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unlink(SB) +GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlink_trampoline_addr(SB)/8, $libc_unlink_trampoline<>(SB) + +TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unlinkat(SB) +GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlinkat_trampoline_addr(SB)/8, $libc_unlinkat_trampoline<>(SB) + +TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unmount(SB) +GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unmount_trampoline_addr(SB)/8, $libc_unmount_trampoline<>(SB) + +TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_write(SB) +GLOBL ·libc_write_trampoline_addr(SB), RODATA, $8 +DATA ·libc_write_trampoline_addr(SB)/8, $libc_write_trampoline<>(SB) + +TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mmap(SB) +GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mmap_trampoline_addr(SB)/8, $libc_mmap_trampoline<>(SB) + +TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munmap(SB) +GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) + +TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_utimensat(SB) +GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go new file mode 100644 index 000000000000..330cf7f7ac66 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go @@ -0,0 +1,2235 @@ +// go run mksyscall.go -openbsd -libc -tags openbsd,ppc64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_ppc64.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build openbsd && ppc64 +// +build openbsd,ppc64 + +package unix + +import ( + "syscall" + "unsafe" +) + +var _ syscall.Errno + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getgroups(ngid int, gid *_Gid_t) (n int, err error) { + r0, _, e1 := syscall_rawSyscall(libc_getgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getgroups_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getgroups getgroups "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setgroups(ngid int, gid *_Gid_t) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setgroups_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setgroups setgroups "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { + r0, _, e1 := syscall_syscall6(libc_wait4_trampoline_addr, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + wpid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_wait4_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_wait4 wait4 "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { + r0, _, e1 := syscall_syscall(libc_accept_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_accept_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_accept accept "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := syscall_syscall(libc_bind_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_bind_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_bind bind "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := syscall_syscall(libc_connect_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_connect_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_connect connect "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socket(domain int, typ int, proto int) (fd int, err error) { + r0, _, e1 := syscall_rawSyscall(libc_socket_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_socket_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_socket socket "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { + _, _, e1 := syscall_syscall6(libc_getsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getsockopt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsockopt getsockopt "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { + _, _, e1 := syscall_syscall6(libc_setsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setsockopt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setsockopt setsockopt "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := syscall_rawSyscall(libc_getpeername_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getpeername_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpeername getpeername "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := syscall_rawSyscall(libc_getsockname_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getsockname_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsockname getsockname "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Shutdown(s int, how int) (err error) { + _, _, e1 := syscall_syscall(libc_shutdown_trampoline_addr, uintptr(s), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shutdown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shutdown shutdown "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { + _, _, e1 := syscall_rawSyscall6(libc_socketpair_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_socketpair_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_socketpair socketpair "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(libc_recvfrom_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_recvfrom_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_recvfrom recvfrom "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall6(libc_sendto_trampoline_addr, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_sendto_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sendto sendto "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_recvmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_recvmsg_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_recvmsg recvmsg "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_sendmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_sendmsg_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sendmsg sendmsg "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { + r0, _, e1 := syscall_syscall6(libc_kevent_trampoline_addr, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_kevent_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kevent kevent "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, timeval *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_utimes_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_utimes_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_utimes utimes "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func futimes(fd int, timeval *[2]Timeval) (err error) { + _, _, e1 := syscall_syscall(libc_futimes_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_futimes_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_futimes futimes "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_poll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_poll_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_poll poll "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Madvise(b []byte, behav int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(libc_madvise_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(behav)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_madvise_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_madvise madvise "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mlock(b []byte) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(libc_mlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mlock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mlock mlock "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mlockall(flags int) (err error) { + _, _, e1 := syscall_syscall(libc_mlockall_trampoline_addr, uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mlockall_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mlockall mlockall "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mprotect(b []byte, prot int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(libc_mprotect_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mprotect_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mprotect mprotect "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Msync(b []byte, flags int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(libc_msync_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_msync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_msync msync "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Munlock(b []byte) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(libc_munlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_munlock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munlock munlock "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Munlockall() (err error) { + _, _, e1 := syscall_syscall(libc_munlockall_trampoline_addr, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_munlockall_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munlockall munlockall "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_pipe2_trampoline_addr, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pipe2_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getdents(fd int, buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_getdents_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(buf))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getdents_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getdents getdents "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getcwd(buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_getcwd_trampoline_addr, uintptr(_p0), uintptr(len(buf)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getcwd_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getcwd getcwd "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { + var _p0 unsafe.Pointer + if len(mib) > 0 { + _p0 = unsafe.Pointer(&mib[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall6(libc_sysctl_trampoline_addr, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_sysctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sysctl sysctl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { + r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_ppoll_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ppoll ppoll "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Access(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_access_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_access_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_access access "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { + _, _, e1 := syscall_syscall(libc_adjtime_trampoline_addr, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_adjtime_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_adjtime adjtime "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_chdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_chdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chdir chdir "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chflags(path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_chflags_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_chflags_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chflags chflags "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chmod(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_chmod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_chmod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chmod chmod "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_chown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_chown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chown chown "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chroot(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_chroot_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_chroot_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chroot chroot "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := syscall_syscall(libc_clock_gettime_trampoline_addr, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_clock_gettime_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_clock_gettime clock_gettime "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Close(fd int) (err error) { + _, _, e1 := syscall_syscall(libc_close_trampoline_addr, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_close_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_close close "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup(fd int) (nfd int, err error) { + r0, _, e1 := syscall_syscall(libc_dup_trampoline_addr, uintptr(fd), 0, 0) + nfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_dup_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup dup "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup2(from int, to int) (err error) { + _, _, e1 := syscall_syscall(libc_dup2_trampoline_addr, uintptr(from), uintptr(to), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_dup2_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup2 dup2 "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup3(from int, to int, flags int) (err error) { + _, _, e1 := syscall_syscall(libc_dup3_trampoline_addr, uintptr(from), uintptr(to), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_dup3_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup3 dup3 "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Exit(code int) { + syscall_syscall(libc_exit_trampoline_addr, uintptr(code), 0, 0) + return +} + +var libc_exit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_exit exit "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_faccessat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_faccessat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_faccessat faccessat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchdir(fd int) (err error) { + _, _, e1 := syscall_syscall(libc_fchdir_trampoline_addr, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fchdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchdir fchdir "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchflags(fd int, flags int) (err error) { + _, _, e1 := syscall_syscall(libc_fchflags_trampoline_addr, uintptr(fd), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fchflags_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchflags fchflags "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmod(fd int, mode uint32) (err error) { + _, _, e1 := syscall_syscall(libc_fchmod_trampoline_addr, uintptr(fd), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fchmod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchmod fchmod "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_fchmodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fchmodat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchmodat fchmodat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchown(fd int, uid int, gid int) (err error) { + _, _, e1 := syscall_syscall(libc_fchown_trampoline_addr, uintptr(fd), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fchown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchown fchown "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_fchownat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fchownat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchownat fchownat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Flock(fd int, how int) (err error) { + _, _, e1 := syscall_syscall(libc_flock_trampoline_addr, uintptr(fd), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_flock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_flock flock "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fpathconf(fd int, name int) (val int, err error) { + r0, _, e1 := syscall_syscall(libc_fpathconf_trampoline_addr, uintptr(fd), uintptr(name), 0) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fpathconf_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fpathconf fpathconf "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstat(fd int, stat *Stat_t) (err error) { + _, _, e1 := syscall_syscall(libc_fstat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstat fstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_fstatat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fstatat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstatat fstatat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatfs(fd int, stat *Statfs_t) (err error) { + _, _, e1 := syscall_syscall(libc_fstatfs_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fstatfs_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstatfs fstatfs "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fsync(fd int) (err error) { + _, _, e1 := syscall_syscall(libc_fsync_trampoline_addr, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fsync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fsync fsync "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ftruncate(fd int, length int64) (err error) { + _, _, e1 := syscall_syscall(libc_ftruncate_trampoline_addr, uintptr(fd), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_ftruncate_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ftruncate ftruncate "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getegid() (egid int) { + r0, _, _ := syscall_rawSyscall(libc_getegid_trampoline_addr, 0, 0, 0) + egid = int(r0) + return +} + +var libc_getegid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getegid getegid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Geteuid() (uid int) { + r0, _, _ := syscall_rawSyscall(libc_geteuid_trampoline_addr, 0, 0, 0) + uid = int(r0) + return +} + +var libc_geteuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_geteuid geteuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getgid() (gid int) { + r0, _, _ := syscall_rawSyscall(libc_getgid_trampoline_addr, 0, 0, 0) + gid = int(r0) + return +} + +var libc_getgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getgid getgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgid(pid int) (pgid int, err error) { + r0, _, e1 := syscall_rawSyscall(libc_getpgid_trampoline_addr, uintptr(pid), 0, 0) + pgid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getpgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpgid getpgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgrp() (pgrp int) { + r0, _, _ := syscall_rawSyscall(libc_getpgrp_trampoline_addr, 0, 0, 0) + pgrp = int(r0) + return +} + +var libc_getpgrp_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpgrp getpgrp "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpid() (pid int) { + r0, _, _ := syscall_rawSyscall(libc_getpid_trampoline_addr, 0, 0, 0) + pid = int(r0) + return +} + +var libc_getpid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpid getpid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getppid() (ppid int) { + r0, _, _ := syscall_rawSyscall(libc_getppid_trampoline_addr, 0, 0, 0) + ppid = int(r0) + return +} + +var libc_getppid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getppid getppid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpriority(which int, who int) (prio int, err error) { + r0, _, e1 := syscall_syscall(libc_getpriority_trampoline_addr, uintptr(which), uintptr(who), 0) + prio = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getpriority_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpriority getpriority "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrlimit(which int, lim *Rlimit) (err error) { + _, _, e1 := syscall_rawSyscall(libc_getrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getrlimit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrlimit getrlimit "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrtable() (rtable int, err error) { + r0, _, e1 := syscall_rawSyscall(libc_getrtable_trampoline_addr, 0, 0, 0) + rtable = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getrtable_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrtable getrtable "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrusage(who int, rusage *Rusage) (err error) { + _, _, e1 := syscall_rawSyscall(libc_getrusage_trampoline_addr, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getrusage_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrusage getrusage "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getsid(pid int) (sid int, err error) { + r0, _, e1 := syscall_rawSyscall(libc_getsid_trampoline_addr, uintptr(pid), 0, 0) + sid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getsid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsid getsid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Gettimeofday(tv *Timeval) (err error) { + _, _, e1 := syscall_rawSyscall(libc_gettimeofday_trampoline_addr, uintptr(unsafe.Pointer(tv)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_gettimeofday_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_gettimeofday gettimeofday "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getuid() (uid int) { + r0, _, _ := syscall_rawSyscall(libc_getuid_trampoline_addr, 0, 0, 0) + uid = int(r0) + return +} + +var libc_getuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getuid getuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Issetugid() (tainted bool) { + r0, _, _ := syscall_syscall(libc_issetugid_trampoline_addr, 0, 0, 0) + tainted = bool(r0 != 0) + return +} + +var libc_issetugid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_issetugid issetugid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kill(pid int, signum syscall.Signal) (err error) { + _, _, e1 := syscall_syscall(libc_kill_trampoline_addr, uintptr(pid), uintptr(signum), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_kill_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kill kill "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kqueue() (fd int, err error) { + r0, _, e1 := syscall_syscall(libc_kqueue_trampoline_addr, 0, 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_kqueue_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kqueue kqueue "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lchown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_lchown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_lchown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lchown lchown "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Link(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_link_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_link_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_link link "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_linkat_trampoline_addr, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_linkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_linkat linkat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Listen(s int, backlog int) (err error) { + _, _, e1 := syscall_syscall(libc_listen_trampoline_addr, uintptr(s), uintptr(backlog), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_listen_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_listen listen "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lstat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_lstat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_lstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lstat lstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdir(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_mkdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mkdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkdir mkdir "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdirat(dirfd int, path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_mkdirat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mkdirat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkdirat mkdirat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkfifo(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_mkfifo_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mkfifo_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkfifo mkfifo "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkfifoat(dirfd int, path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_mkfifoat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mkfifoat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkfifoat mkfifoat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknod(path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_mknod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mknod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mknod mknod "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mknodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mknodat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mknodat mknodat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Nanosleep(time *Timespec, leftover *Timespec) (err error) { + _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_nanosleep_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_nanosleep nanosleep "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Open(path string, mode int, perm uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := syscall_syscall(libc_open_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_open_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_open open "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := syscall_syscall6(libc_openat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_openat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_openat openat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pathconf(path string, name int) (val int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := syscall_syscall(libc_pathconf_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pathconf_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pathconf pathconf "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pread(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(libc_pread_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pread_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pread pread "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pwrite(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(libc_pwrite_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pwrite_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pwrite pwrite "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func read(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_read_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_read read "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlink(path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_readlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_readlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readlink readlink "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(libc_readlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_readlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readlinkat readlinkat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rename(from string, to string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_rename_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_rename_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_rename rename "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Renameat(fromfd int, from string, tofd int, to string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_renameat_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renameat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renameat renameat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Revoke(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_revoke_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_revoke_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_revoke revoke "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rmdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_rmdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_rmdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_rmdir rmdir "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { + r0, _, e1 := syscall_syscall(libc_lseek_trampoline_addr, uintptr(fd), uintptr(offset), uintptr(whence)) + newoffset = int64(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_lseek_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lseek lseek "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { + r0, _, e1 := syscall_syscall6(libc_select_trampoline_addr, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_select_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_select select "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setegid(egid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setegid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setegid setegid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seteuid(euid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_seteuid_trampoline_addr, uintptr(euid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_seteuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_seteuid seteuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setgid(gid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setgid_trampoline_addr, uintptr(gid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setgid setgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setlogin(name string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(name) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_setlogin_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setlogin_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setlogin setlogin "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpgid(pid int, pgid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setpgid_trampoline_addr, uintptr(pid), uintptr(pgid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setpgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setpgid setpgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpriority(which int, who int, prio int) (err error) { + _, _, e1 := syscall_syscall(libc_setpriority_trampoline_addr, uintptr(which), uintptr(who), uintptr(prio)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setpriority_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setpriority setpriority "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setregid(rgid int, egid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setregid_trampoline_addr, uintptr(rgid), uintptr(egid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setregid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setregid setregid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setreuid(ruid int, euid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setreuid_trampoline_addr, uintptr(ruid), uintptr(euid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setreuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setreuid setreuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresgid(rgid int, egid int, sgid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setresgid_trampoline_addr, uintptr(rgid), uintptr(egid), uintptr(sgid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setresgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setresgid setresgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresuid(ruid int, euid int, suid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setresuid_trampoline_addr, uintptr(ruid), uintptr(euid), uintptr(suid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setresuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setresuid setresuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setrlimit(which int, lim *Rlimit) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setrlimit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setrtable(rtable int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setrtable_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setrtable setrtable "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setsid() (pid int, err error) { + r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0) + pid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setsid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setsid setsid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Settimeofday(tp *Timeval) (err error) { + _, _, e1 := syscall_rawSyscall(libc_settimeofday_trampoline_addr, uintptr(unsafe.Pointer(tp)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_settimeofday_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_settimeofday settimeofday "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setuid(uid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setuid_trampoline_addr, uintptr(uid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setuid setuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Stat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_stat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_stat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_stat stat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Statfs(path string, stat *Statfs_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_statfs_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_statfs_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_statfs statfs "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlink(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_symlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_symlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_symlink symlink "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_symlinkat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_symlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_symlinkat symlinkat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Sync() (err error) { + _, _, e1 := syscall_syscall(libc_sync_trampoline_addr, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_sync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sync sync "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Truncate(path string, length int64) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_truncate_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_truncate_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_truncate truncate "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Umask(newmask int) (oldmask int) { + r0, _, _ := syscall_syscall(libc_umask_trampoline_addr, uintptr(newmask), 0, 0) + oldmask = int(r0) + return +} + +var libc_umask_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_umask umask "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlink(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_unlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unlink unlink "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlinkat(dirfd int, path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_unlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unlinkat unlinkat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unmount(path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_unmount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unmount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unmount unmount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func write(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_write_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_write write "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { + r0, _, e1 := syscall_syscall6(libc_mmap_trampoline_addr, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mmap_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mmap mmap "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func munmap(addr uintptr, length uintptr) (err error) { + _, _, e1 := syscall_syscall(libc_munmap_trampoline_addr, uintptr(addr), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_munmap_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munmap munmap "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func readlen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func writelen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_utimensat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_utimensat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_utimensat utimensat "libc.so" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s new file mode 100644 index 000000000000..4028255b0d5b --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s @@ -0,0 +1,802 @@ +// go run mkasm.go openbsd ppc64 +// Code generated by the command above; DO NOT EDIT. + +#include "textflag.h" + +TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getgroups(SB) + RET +GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgroups_trampoline_addr(SB)/8, $libc_getgroups_trampoline<>(SB) + +TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_setgroups(SB) + RET +GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgroups_trampoline_addr(SB)/8, $libc_setgroups_trampoline<>(SB) + +TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_wait4(SB) + RET +GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $8 +DATA ·libc_wait4_trampoline_addr(SB)/8, $libc_wait4_trampoline<>(SB) + +TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_accept(SB) + RET +GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $8 +DATA ·libc_accept_trampoline_addr(SB)/8, $libc_accept_trampoline<>(SB) + +TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_bind(SB) + RET +GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $8 +DATA ·libc_bind_trampoline_addr(SB)/8, $libc_bind_trampoline<>(SB) + +TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_connect(SB) + RET +GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_connect_trampoline_addr(SB)/8, $libc_connect_trampoline<>(SB) + +TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_socket(SB) + RET +GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socket_trampoline_addr(SB)/8, $libc_socket_trampoline<>(SB) + +TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getsockopt(SB) + RET +GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockopt_trampoline_addr(SB)/8, $libc_getsockopt_trampoline<>(SB) + +TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_setsockopt(SB) + RET +GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsockopt_trampoline_addr(SB)/8, $libc_setsockopt_trampoline<>(SB) + +TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getpeername(SB) + RET +GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpeername_trampoline_addr(SB)/8, $libc_getpeername_trampoline<>(SB) + +TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getsockname(SB) + RET +GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockname_trampoline_addr(SB)/8, $libc_getsockname_trampoline<>(SB) + +TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_shutdown(SB) + RET +GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shutdown_trampoline_addr(SB)/8, $libc_shutdown_trampoline<>(SB) + +TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_socketpair(SB) + RET +GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socketpair_trampoline_addr(SB)/8, $libc_socketpair_trampoline<>(SB) + +TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_recvfrom(SB) + RET +GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvfrom_trampoline_addr(SB)/8, $libc_recvfrom_trampoline<>(SB) + +TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_sendto(SB) + RET +GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendto_trampoline_addr(SB)/8, $libc_sendto_trampoline<>(SB) + +TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_recvmsg(SB) + RET +GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvmsg_trampoline_addr(SB)/8, $libc_recvmsg_trampoline<>(SB) + +TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_sendmsg(SB) + RET +GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendmsg_trampoline_addr(SB)/8, $libc_sendmsg_trampoline<>(SB) + +TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_kevent(SB) + RET +GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kevent_trampoline_addr(SB)/8, $libc_kevent_trampoline<>(SB) + +TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_utimes(SB) + RET +GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_utimes_trampoline_addr(SB)/8, $libc_utimes_trampoline<>(SB) + +TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_futimes(SB) + RET +GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_futimes_trampoline_addr(SB)/8, $libc_futimes_trampoline<>(SB) + +TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_poll(SB) + RET +GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $8 +DATA ·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB) + +TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_madvise(SB) + RET +GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $8 +DATA ·libc_madvise_trampoline_addr(SB)/8, $libc_madvise_trampoline<>(SB) + +TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_mlock(SB) + RET +GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlock_trampoline_addr(SB)/8, $libc_mlock_trampoline<>(SB) + +TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_mlockall(SB) + RET +GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlockall_trampoline_addr(SB)/8, $libc_mlockall_trampoline<>(SB) + +TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_mprotect(SB) + RET +GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mprotect_trampoline_addr(SB)/8, $libc_mprotect_trampoline<>(SB) + +TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_msync(SB) + RET +GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_msync_trampoline_addr(SB)/8, $libc_msync_trampoline<>(SB) + +TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_munlock(SB) + RET +GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlock_trampoline_addr(SB)/8, $libc_munlock_trampoline<>(SB) + +TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_munlockall(SB) + RET +GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB) + +TEXT libc_pipe2_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_pipe2(SB) + RET +GLOBL ·libc_pipe2_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pipe2_trampoline_addr(SB)/8, $libc_pipe2_trampoline<>(SB) + +TEXT libc_getdents_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getdents(SB) + RET +GLOBL ·libc_getdents_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getdents_trampoline_addr(SB)/8, $libc_getdents_trampoline<>(SB) + +TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getcwd(SB) + RET +GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) + +TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_ioctl(SB) + RET +GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) + +TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_sysctl(SB) + RET +GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) + +TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_ppoll(SB) + RET +GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ppoll_trampoline_addr(SB)/8, $libc_ppoll_trampoline<>(SB) + +TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_access(SB) + RET +GLOBL ·libc_access_trampoline_addr(SB), RODATA, $8 +DATA ·libc_access_trampoline_addr(SB)/8, $libc_access_trampoline<>(SB) + +TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_adjtime(SB) + RET +GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_adjtime_trampoline_addr(SB)/8, $libc_adjtime_trampoline<>(SB) + +TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_chdir(SB) + RET +GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chdir_trampoline_addr(SB)/8, $libc_chdir_trampoline<>(SB) + +TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_chflags(SB) + RET +GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chflags_trampoline_addr(SB)/8, $libc_chflags_trampoline<>(SB) + +TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_chmod(SB) + RET +GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chmod_trampoline_addr(SB)/8, $libc_chmod_trampoline<>(SB) + +TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_chown(SB) + RET +GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chown_trampoline_addr(SB)/8, $libc_chown_trampoline<>(SB) + +TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_chroot(SB) + RET +GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chroot_trampoline_addr(SB)/8, $libc_chroot_trampoline<>(SB) + +TEXT libc_clock_gettime_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_clock_gettime(SB) + RET +GLOBL ·libc_clock_gettime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clock_gettime_trampoline_addr(SB)/8, $libc_clock_gettime_trampoline<>(SB) + +TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_close(SB) + RET +GLOBL ·libc_close_trampoline_addr(SB), RODATA, $8 +DATA ·libc_close_trampoline_addr(SB)/8, $libc_close_trampoline<>(SB) + +TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_dup(SB) + RET +GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup_trampoline_addr(SB)/8, $libc_dup_trampoline<>(SB) + +TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_dup2(SB) + RET +GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup2_trampoline_addr(SB)/8, $libc_dup2_trampoline<>(SB) + +TEXT libc_dup3_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_dup3(SB) + RET +GLOBL ·libc_dup3_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup3_trampoline_addr(SB)/8, $libc_dup3_trampoline<>(SB) + +TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_exit(SB) + RET +GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_exit_trampoline_addr(SB)/8, $libc_exit_trampoline<>(SB) + +TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_faccessat(SB) + RET +GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_faccessat_trampoline_addr(SB)/8, $libc_faccessat_trampoline<>(SB) + +TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_fchdir(SB) + RET +GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchdir_trampoline_addr(SB)/8, $libc_fchdir_trampoline<>(SB) + +TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_fchflags(SB) + RET +GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchflags_trampoline_addr(SB)/8, $libc_fchflags_trampoline<>(SB) + +TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_fchmod(SB) + RET +GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmod_trampoline_addr(SB)/8, $libc_fchmod_trampoline<>(SB) + +TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_fchmodat(SB) + RET +GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmodat_trampoline_addr(SB)/8, $libc_fchmodat_trampoline<>(SB) + +TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_fchown(SB) + RET +GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchown_trampoline_addr(SB)/8, $libc_fchown_trampoline<>(SB) + +TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_fchownat(SB) + RET +GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchownat_trampoline_addr(SB)/8, $libc_fchownat_trampoline<>(SB) + +TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_flock(SB) + RET +GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_flock_trampoline_addr(SB)/8, $libc_flock_trampoline<>(SB) + +TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_fpathconf(SB) + RET +GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fpathconf_trampoline_addr(SB)/8, $libc_fpathconf_trampoline<>(SB) + +TEXT libc_fstat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_fstat(SB) + RET +GLOBL ·libc_fstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstat_trampoline_addr(SB)/8, $libc_fstat_trampoline<>(SB) + +TEXT libc_fstatat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_fstatat(SB) + RET +GLOBL ·libc_fstatat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatat_trampoline_addr(SB)/8, $libc_fstatat_trampoline<>(SB) + +TEXT libc_fstatfs_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_fstatfs(SB) + RET +GLOBL ·libc_fstatfs_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatfs_trampoline_addr(SB)/8, $libc_fstatfs_trampoline<>(SB) + +TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_fsync(SB) + RET +GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fsync_trampoline_addr(SB)/8, $libc_fsync_trampoline<>(SB) + +TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_ftruncate(SB) + RET +GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ftruncate_trampoline_addr(SB)/8, $libc_ftruncate_trampoline<>(SB) + +TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getegid(SB) + RET +GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getegid_trampoline_addr(SB)/8, $libc_getegid_trampoline<>(SB) + +TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_geteuid(SB) + RET +GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_geteuid_trampoline_addr(SB)/8, $libc_geteuid_trampoline<>(SB) + +TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getgid(SB) + RET +GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgid_trampoline_addr(SB)/8, $libc_getgid_trampoline<>(SB) + +TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getpgid(SB) + RET +GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgid_trampoline_addr(SB)/8, $libc_getpgid_trampoline<>(SB) + +TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getpgrp(SB) + RET +GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgrp_trampoline_addr(SB)/8, $libc_getpgrp_trampoline<>(SB) + +TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getpid(SB) + RET +GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpid_trampoline_addr(SB)/8, $libc_getpid_trampoline<>(SB) + +TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getppid(SB) + RET +GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getppid_trampoline_addr(SB)/8, $libc_getppid_trampoline<>(SB) + +TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getpriority(SB) + RET +GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpriority_trampoline_addr(SB)/8, $libc_getpriority_trampoline<>(SB) + +TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getrlimit(SB) + RET +GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrlimit_trampoline_addr(SB)/8, $libc_getrlimit_trampoline<>(SB) + +TEXT libc_getrtable_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getrtable(SB) + RET +GLOBL ·libc_getrtable_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrtable_trampoline_addr(SB)/8, $libc_getrtable_trampoline<>(SB) + +TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getrusage(SB) + RET +GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrusage_trampoline_addr(SB)/8, $libc_getrusage_trampoline<>(SB) + +TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getsid(SB) + RET +GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsid_trampoline_addr(SB)/8, $libc_getsid_trampoline<>(SB) + +TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_gettimeofday(SB) + RET +GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_gettimeofday_trampoline_addr(SB)/8, $libc_gettimeofday_trampoline<>(SB) + +TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getuid(SB) + RET +GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getuid_trampoline_addr(SB)/8, $libc_getuid_trampoline<>(SB) + +TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_issetugid(SB) + RET +GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_issetugid_trampoline_addr(SB)/8, $libc_issetugid_trampoline<>(SB) + +TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_kill(SB) + RET +GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kill_trampoline_addr(SB)/8, $libc_kill_trampoline<>(SB) + +TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_kqueue(SB) + RET +GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kqueue_trampoline_addr(SB)/8, $libc_kqueue_trampoline<>(SB) + +TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_lchown(SB) + RET +GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lchown_trampoline_addr(SB)/8, $libc_lchown_trampoline<>(SB) + +TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_link(SB) + RET +GLOBL ·libc_link_trampoline_addr(SB), RODATA, $8 +DATA ·libc_link_trampoline_addr(SB)/8, $libc_link_trampoline<>(SB) + +TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_linkat(SB) + RET +GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_linkat_trampoline_addr(SB)/8, $libc_linkat_trampoline<>(SB) + +TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_listen(SB) + RET +GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $8 +DATA ·libc_listen_trampoline_addr(SB)/8, $libc_listen_trampoline<>(SB) + +TEXT libc_lstat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_lstat(SB) + RET +GLOBL ·libc_lstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lstat_trampoline_addr(SB)/8, $libc_lstat_trampoline<>(SB) + +TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_mkdir(SB) + RET +GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdir_trampoline_addr(SB)/8, $libc_mkdir_trampoline<>(SB) + +TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_mkdirat(SB) + RET +GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdirat_trampoline_addr(SB)/8, $libc_mkdirat_trampoline<>(SB) + +TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_mkfifo(SB) + RET +GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkfifo_trampoline_addr(SB)/8, $libc_mkfifo_trampoline<>(SB) + +TEXT libc_mkfifoat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_mkfifoat(SB) + RET +GLOBL ·libc_mkfifoat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkfifoat_trampoline_addr(SB)/8, $libc_mkfifoat_trampoline<>(SB) + +TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_mknod(SB) + RET +GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB) + +TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_mknodat(SB) + RET +GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) + +TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_nanosleep(SB) + RET +GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 +DATA ·libc_nanosleep_trampoline_addr(SB)/8, $libc_nanosleep_trampoline<>(SB) + +TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_open(SB) + RET +GLOBL ·libc_open_trampoline_addr(SB), RODATA, $8 +DATA ·libc_open_trampoline_addr(SB)/8, $libc_open_trampoline<>(SB) + +TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_openat(SB) + RET +GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_openat_trampoline_addr(SB)/8, $libc_openat_trampoline<>(SB) + +TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_pathconf(SB) + RET +GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pathconf_trampoline_addr(SB)/8, $libc_pathconf_trampoline<>(SB) + +TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_pread(SB) + RET +GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pread_trampoline_addr(SB)/8, $libc_pread_trampoline<>(SB) + +TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_pwrite(SB) + RET +GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pwrite_trampoline_addr(SB)/8, $libc_pwrite_trampoline<>(SB) + +TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_read(SB) + RET +GLOBL ·libc_read_trampoline_addr(SB), RODATA, $8 +DATA ·libc_read_trampoline_addr(SB)/8, $libc_read_trampoline<>(SB) + +TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_readlink(SB) + RET +GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlink_trampoline_addr(SB)/8, $libc_readlink_trampoline<>(SB) + +TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_readlinkat(SB) + RET +GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlinkat_trampoline_addr(SB)/8, $libc_readlinkat_trampoline<>(SB) + +TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_rename(SB) + RET +GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rename_trampoline_addr(SB)/8, $libc_rename_trampoline<>(SB) + +TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_renameat(SB) + RET +GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameat_trampoline_addr(SB)/8, $libc_renameat_trampoline<>(SB) + +TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_revoke(SB) + RET +GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $8 +DATA ·libc_revoke_trampoline_addr(SB)/8, $libc_revoke_trampoline<>(SB) + +TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_rmdir(SB) + RET +GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rmdir_trampoline_addr(SB)/8, $libc_rmdir_trampoline<>(SB) + +TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_lseek(SB) + RET +GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lseek_trampoline_addr(SB)/8, $libc_lseek_trampoline<>(SB) + +TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_select(SB) + RET +GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8 +DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB) + +TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_setegid(SB) + RET +GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setegid_trampoline_addr(SB)/8, $libc_setegid_trampoline<>(SB) + +TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_seteuid(SB) + RET +GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_seteuid_trampoline_addr(SB)/8, $libc_seteuid_trampoline<>(SB) + +TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_setgid(SB) + RET +GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgid_trampoline_addr(SB)/8, $libc_setgid_trampoline<>(SB) + +TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_setlogin(SB) + RET +GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setlogin_trampoline_addr(SB)/8, $libc_setlogin_trampoline<>(SB) + +TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_setpgid(SB) + RET +GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpgid_trampoline_addr(SB)/8, $libc_setpgid_trampoline<>(SB) + +TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_setpriority(SB) + RET +GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpriority_trampoline_addr(SB)/8, $libc_setpriority_trampoline<>(SB) + +TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_setregid(SB) + RET +GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setregid_trampoline_addr(SB)/8, $libc_setregid_trampoline<>(SB) + +TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_setreuid(SB) + RET +GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB) + +TEXT libc_setresgid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_setresgid(SB) + RET +GLOBL ·libc_setresgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setresgid_trampoline_addr(SB)/8, $libc_setresgid_trampoline<>(SB) + +TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_setresuid(SB) + RET +GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB) + +TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_setrlimit(SB) + RET +GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) + +TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_setrtable(SB) + RET +GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setrtable_trampoline_addr(SB)/8, $libc_setrtable_trampoline<>(SB) + +TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_setsid(SB) + RET +GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsid_trampoline_addr(SB)/8, $libc_setsid_trampoline<>(SB) + +TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_settimeofday(SB) + RET +GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_settimeofday_trampoline_addr(SB)/8, $libc_settimeofday_trampoline<>(SB) + +TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_setuid(SB) + RET +GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setuid_trampoline_addr(SB)/8, $libc_setuid_trampoline<>(SB) + +TEXT libc_stat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_stat(SB) + RET +GLOBL ·libc_stat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_stat_trampoline_addr(SB)/8, $libc_stat_trampoline<>(SB) + +TEXT libc_statfs_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_statfs(SB) + RET +GLOBL ·libc_statfs_trampoline_addr(SB), RODATA, $8 +DATA ·libc_statfs_trampoline_addr(SB)/8, $libc_statfs_trampoline<>(SB) + +TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_symlink(SB) + RET +GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlink_trampoline_addr(SB)/8, $libc_symlink_trampoline<>(SB) + +TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_symlinkat(SB) + RET +GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlinkat_trampoline_addr(SB)/8, $libc_symlinkat_trampoline<>(SB) + +TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_sync(SB) + RET +GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sync_trampoline_addr(SB)/8, $libc_sync_trampoline<>(SB) + +TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_truncate(SB) + RET +GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_truncate_trampoline_addr(SB)/8, $libc_truncate_trampoline<>(SB) + +TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_umask(SB) + RET +GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $8 +DATA ·libc_umask_trampoline_addr(SB)/8, $libc_umask_trampoline<>(SB) + +TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_unlink(SB) + RET +GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlink_trampoline_addr(SB)/8, $libc_unlink_trampoline<>(SB) + +TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_unlinkat(SB) + RET +GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlinkat_trampoline_addr(SB)/8, $libc_unlinkat_trampoline<>(SB) + +TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_unmount(SB) + RET +GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unmount_trampoline_addr(SB)/8, $libc_unmount_trampoline<>(SB) + +TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_write(SB) + RET +GLOBL ·libc_write_trampoline_addr(SB), RODATA, $8 +DATA ·libc_write_trampoline_addr(SB)/8, $libc_write_trampoline<>(SB) + +TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_mmap(SB) + RET +GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mmap_trampoline_addr(SB)/8, $libc_mmap_trampoline<>(SB) + +TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_munmap(SB) + RET +GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) + +TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_utimensat(SB) + RET +GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go new file mode 100644 index 000000000000..5f24de0d9d76 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go @@ -0,0 +1,2235 @@ +// go run mksyscall.go -openbsd -libc -tags openbsd,riscv64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_riscv64.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build openbsd && riscv64 +// +build openbsd,riscv64 + +package unix + +import ( + "syscall" + "unsafe" +) + +var _ syscall.Errno + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getgroups(ngid int, gid *_Gid_t) (n int, err error) { + r0, _, e1 := syscall_rawSyscall(libc_getgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getgroups_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getgroups getgroups "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setgroups(ngid int, gid *_Gid_t) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setgroups_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setgroups setgroups "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { + r0, _, e1 := syscall_syscall6(libc_wait4_trampoline_addr, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + wpid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_wait4_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_wait4 wait4 "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { + r0, _, e1 := syscall_syscall(libc_accept_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_accept_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_accept accept "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := syscall_syscall(libc_bind_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_bind_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_bind bind "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := syscall_syscall(libc_connect_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_connect_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_connect connect "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socket(domain int, typ int, proto int) (fd int, err error) { + r0, _, e1 := syscall_rawSyscall(libc_socket_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_socket_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_socket socket "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { + _, _, e1 := syscall_syscall6(libc_getsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getsockopt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsockopt getsockopt "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { + _, _, e1 := syscall_syscall6(libc_setsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setsockopt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setsockopt setsockopt "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := syscall_rawSyscall(libc_getpeername_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getpeername_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpeername getpeername "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := syscall_rawSyscall(libc_getsockname_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getsockname_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsockname getsockname "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Shutdown(s int, how int) (err error) { + _, _, e1 := syscall_syscall(libc_shutdown_trampoline_addr, uintptr(s), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shutdown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shutdown shutdown "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { + _, _, e1 := syscall_rawSyscall6(libc_socketpair_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_socketpair_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_socketpair socketpair "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(libc_recvfrom_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_recvfrom_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_recvfrom recvfrom "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall6(libc_sendto_trampoline_addr, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_sendto_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sendto sendto "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_recvmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_recvmsg_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_recvmsg recvmsg "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_sendmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_sendmsg_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sendmsg sendmsg "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { + r0, _, e1 := syscall_syscall6(libc_kevent_trampoline_addr, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_kevent_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kevent kevent "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, timeval *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_utimes_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_utimes_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_utimes utimes "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func futimes(fd int, timeval *[2]Timeval) (err error) { + _, _, e1 := syscall_syscall(libc_futimes_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_futimes_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_futimes futimes "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_poll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_poll_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_poll poll "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Madvise(b []byte, behav int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(libc_madvise_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(behav)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_madvise_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_madvise madvise "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mlock(b []byte) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(libc_mlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mlock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mlock mlock "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mlockall(flags int) (err error) { + _, _, e1 := syscall_syscall(libc_mlockall_trampoline_addr, uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mlockall_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mlockall mlockall "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mprotect(b []byte, prot int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(libc_mprotect_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mprotect_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mprotect mprotect "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Msync(b []byte, flags int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(libc_msync_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_msync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_msync msync "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Munlock(b []byte) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(libc_munlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_munlock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munlock munlock "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Munlockall() (err error) { + _, _, e1 := syscall_syscall(libc_munlockall_trampoline_addr, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_munlockall_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munlockall munlockall "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_pipe2_trampoline_addr, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pipe2_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getdents(fd int, buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_getdents_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(buf))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getdents_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getdents getdents "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getcwd(buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_getcwd_trampoline_addr, uintptr(_p0), uintptr(len(buf)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getcwd_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getcwd getcwd "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { + var _p0 unsafe.Pointer + if len(mib) > 0 { + _p0 = unsafe.Pointer(&mib[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall6(libc_sysctl_trampoline_addr, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_sysctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sysctl sysctl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { + r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_ppoll_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ppoll ppoll "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Access(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_access_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_access_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_access access "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { + _, _, e1 := syscall_syscall(libc_adjtime_trampoline_addr, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_adjtime_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_adjtime adjtime "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_chdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_chdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chdir chdir "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chflags(path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_chflags_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_chflags_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chflags chflags "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chmod(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_chmod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_chmod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chmod chmod "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_chown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_chown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chown chown "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chroot(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_chroot_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_chroot_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_chroot chroot "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := syscall_syscall(libc_clock_gettime_trampoline_addr, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_clock_gettime_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_clock_gettime clock_gettime "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Close(fd int) (err error) { + _, _, e1 := syscall_syscall(libc_close_trampoline_addr, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_close_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_close close "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup(fd int) (nfd int, err error) { + r0, _, e1 := syscall_syscall(libc_dup_trampoline_addr, uintptr(fd), 0, 0) + nfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_dup_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup dup "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup2(from int, to int) (err error) { + _, _, e1 := syscall_syscall(libc_dup2_trampoline_addr, uintptr(from), uintptr(to), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_dup2_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup2 dup2 "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup3(from int, to int, flags int) (err error) { + _, _, e1 := syscall_syscall(libc_dup3_trampoline_addr, uintptr(from), uintptr(to), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_dup3_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_dup3 dup3 "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Exit(code int) { + syscall_syscall(libc_exit_trampoline_addr, uintptr(code), 0, 0) + return +} + +var libc_exit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_exit exit "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_faccessat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_faccessat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_faccessat faccessat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchdir(fd int) (err error) { + _, _, e1 := syscall_syscall(libc_fchdir_trampoline_addr, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fchdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchdir fchdir "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchflags(fd int, flags int) (err error) { + _, _, e1 := syscall_syscall(libc_fchflags_trampoline_addr, uintptr(fd), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fchflags_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchflags fchflags "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmod(fd int, mode uint32) (err error) { + _, _, e1 := syscall_syscall(libc_fchmod_trampoline_addr, uintptr(fd), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fchmod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchmod fchmod "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_fchmodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fchmodat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchmodat fchmodat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchown(fd int, uid int, gid int) (err error) { + _, _, e1 := syscall_syscall(libc_fchown_trampoline_addr, uintptr(fd), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fchown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchown fchown "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_fchownat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fchownat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fchownat fchownat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Flock(fd int, how int) (err error) { + _, _, e1 := syscall_syscall(libc_flock_trampoline_addr, uintptr(fd), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_flock_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_flock flock "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fpathconf(fd int, name int) (val int, err error) { + r0, _, e1 := syscall_syscall(libc_fpathconf_trampoline_addr, uintptr(fd), uintptr(name), 0) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fpathconf_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fpathconf fpathconf "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstat(fd int, stat *Stat_t) (err error) { + _, _, e1 := syscall_syscall(libc_fstat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstat fstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_fstatat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fstatat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstatat fstatat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatfs(fd int, stat *Statfs_t) (err error) { + _, _, e1 := syscall_syscall(libc_fstatfs_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fstatfs_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fstatfs fstatfs "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fsync(fd int) (err error) { + _, _, e1 := syscall_syscall(libc_fsync_trampoline_addr, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fsync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fsync fsync "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ftruncate(fd int, length int64) (err error) { + _, _, e1 := syscall_syscall(libc_ftruncate_trampoline_addr, uintptr(fd), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_ftruncate_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ftruncate ftruncate "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getegid() (egid int) { + r0, _, _ := syscall_rawSyscall(libc_getegid_trampoline_addr, 0, 0, 0) + egid = int(r0) + return +} + +var libc_getegid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getegid getegid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Geteuid() (uid int) { + r0, _, _ := syscall_rawSyscall(libc_geteuid_trampoline_addr, 0, 0, 0) + uid = int(r0) + return +} + +var libc_geteuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_geteuid geteuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getgid() (gid int) { + r0, _, _ := syscall_rawSyscall(libc_getgid_trampoline_addr, 0, 0, 0) + gid = int(r0) + return +} + +var libc_getgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getgid getgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgid(pid int) (pgid int, err error) { + r0, _, e1 := syscall_rawSyscall(libc_getpgid_trampoline_addr, uintptr(pid), 0, 0) + pgid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getpgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpgid getpgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgrp() (pgrp int) { + r0, _, _ := syscall_rawSyscall(libc_getpgrp_trampoline_addr, 0, 0, 0) + pgrp = int(r0) + return +} + +var libc_getpgrp_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpgrp getpgrp "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpid() (pid int) { + r0, _, _ := syscall_rawSyscall(libc_getpid_trampoline_addr, 0, 0, 0) + pid = int(r0) + return +} + +var libc_getpid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpid getpid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getppid() (ppid int) { + r0, _, _ := syscall_rawSyscall(libc_getppid_trampoline_addr, 0, 0, 0) + ppid = int(r0) + return +} + +var libc_getppid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getppid getppid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpriority(which int, who int) (prio int, err error) { + r0, _, e1 := syscall_syscall(libc_getpriority_trampoline_addr, uintptr(which), uintptr(who), 0) + prio = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getpriority_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getpriority getpriority "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrlimit(which int, lim *Rlimit) (err error) { + _, _, e1 := syscall_rawSyscall(libc_getrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getrlimit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrlimit getrlimit "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrtable() (rtable int, err error) { + r0, _, e1 := syscall_rawSyscall(libc_getrtable_trampoline_addr, 0, 0, 0) + rtable = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getrtable_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrtable getrtable "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrusage(who int, rusage *Rusage) (err error) { + _, _, e1 := syscall_rawSyscall(libc_getrusage_trampoline_addr, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getrusage_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getrusage getrusage "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getsid(pid int) (sid int, err error) { + r0, _, e1 := syscall_rawSyscall(libc_getsid_trampoline_addr, uintptr(pid), 0, 0) + sid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getsid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getsid getsid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Gettimeofday(tv *Timeval) (err error) { + _, _, e1 := syscall_rawSyscall(libc_gettimeofday_trampoline_addr, uintptr(unsafe.Pointer(tv)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_gettimeofday_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_gettimeofday gettimeofday "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getuid() (uid int) { + r0, _, _ := syscall_rawSyscall(libc_getuid_trampoline_addr, 0, 0, 0) + uid = int(r0) + return +} + +var libc_getuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getuid getuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Issetugid() (tainted bool) { + r0, _, _ := syscall_syscall(libc_issetugid_trampoline_addr, 0, 0, 0) + tainted = bool(r0 != 0) + return +} + +var libc_issetugid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_issetugid issetugid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kill(pid int, signum syscall.Signal) (err error) { + _, _, e1 := syscall_syscall(libc_kill_trampoline_addr, uintptr(pid), uintptr(signum), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_kill_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kill kill "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kqueue() (fd int, err error) { + r0, _, e1 := syscall_syscall(libc_kqueue_trampoline_addr, 0, 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_kqueue_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_kqueue kqueue "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lchown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_lchown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_lchown_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lchown lchown "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Link(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_link_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_link_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_link link "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_linkat_trampoline_addr, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_linkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_linkat linkat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Listen(s int, backlog int) (err error) { + _, _, e1 := syscall_syscall(libc_listen_trampoline_addr, uintptr(s), uintptr(backlog), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_listen_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_listen listen "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lstat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_lstat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_lstat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lstat lstat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdir(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_mkdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mkdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkdir mkdir "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdirat(dirfd int, path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_mkdirat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mkdirat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkdirat mkdirat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkfifo(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_mkfifo_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mkfifo_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkfifo mkfifo "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkfifoat(dirfd int, path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_mkfifoat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mkfifoat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mkfifoat mkfifoat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknod(path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_mknod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mknod_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mknod mknod "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_mknodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mknodat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mknodat mknodat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Nanosleep(time *Timespec, leftover *Timespec) (err error) { + _, _, e1 := syscall_syscall(libc_nanosleep_trampoline_addr, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_nanosleep_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_nanosleep nanosleep "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Open(path string, mode int, perm uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := syscall_syscall(libc_open_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_open_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_open open "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := syscall_syscall6(libc_openat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_openat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_openat openat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pathconf(path string, name int) (val int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := syscall_syscall(libc_pathconf_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pathconf_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pathconf pathconf "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pread(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(libc_pread_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pread_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pread pread "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pwrite(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(libc_pwrite_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pwrite_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pwrite pwrite "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func read(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_read_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_read read "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlink(path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_readlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_readlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readlink readlink "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(libc_readlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_readlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_readlinkat readlinkat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rename(from string, to string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_rename_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_rename_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_rename rename "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Renameat(fromfd int, from string, tofd int, to string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_renameat_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_renameat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_renameat renameat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Revoke(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_revoke_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_revoke_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_revoke revoke "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rmdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_rmdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_rmdir_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_rmdir rmdir "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { + r0, _, e1 := syscall_syscall(libc_lseek_trampoline_addr, uintptr(fd), uintptr(offset), uintptr(whence)) + newoffset = int64(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_lseek_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_lseek lseek "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { + r0, _, e1 := syscall_syscall6(libc_select_trampoline_addr, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_select_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_select select "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setegid(egid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setegid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setegid setegid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seteuid(euid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_seteuid_trampoline_addr, uintptr(euid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_seteuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_seteuid seteuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setgid(gid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setgid_trampoline_addr, uintptr(gid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setgid setgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setlogin(name string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(name) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_setlogin_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setlogin_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setlogin setlogin "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpgid(pid int, pgid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setpgid_trampoline_addr, uintptr(pid), uintptr(pgid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setpgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setpgid setpgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpriority(which int, who int, prio int) (err error) { + _, _, e1 := syscall_syscall(libc_setpriority_trampoline_addr, uintptr(which), uintptr(who), uintptr(prio)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setpriority_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setpriority setpriority "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setregid(rgid int, egid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setregid_trampoline_addr, uintptr(rgid), uintptr(egid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setregid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setregid setregid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setreuid(ruid int, euid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setreuid_trampoline_addr, uintptr(ruid), uintptr(euid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setreuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setreuid setreuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresgid(rgid int, egid int, sgid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setresgid_trampoline_addr, uintptr(rgid), uintptr(egid), uintptr(sgid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setresgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setresgid setresgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresuid(ruid int, euid int, suid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setresuid_trampoline_addr, uintptr(ruid), uintptr(euid), uintptr(suid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setresuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setresuid setresuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setrlimit(which int, lim *Rlimit) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setrlimit_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setrtable(rtable int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setrtable_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setrtable setrtable "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setsid() (pid int, err error) { + r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0) + pid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setsid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setsid setsid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Settimeofday(tp *Timeval) (err error) { + _, _, e1 := syscall_rawSyscall(libc_settimeofday_trampoline_addr, uintptr(unsafe.Pointer(tp)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_settimeofday_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_settimeofday settimeofday "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setuid(uid int) (err error) { + _, _, e1 := syscall_rawSyscall(libc_setuid_trampoline_addr, uintptr(uid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setuid setuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Stat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_stat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_stat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_stat stat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Statfs(path string, stat *Statfs_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_statfs_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_statfs_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_statfs statfs "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlink(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_symlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_symlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_symlink symlink "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_symlinkat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_symlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_symlinkat symlinkat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Sync() (err error) { + _, _, e1 := syscall_syscall(libc_sync_trampoline_addr, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_sync_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_sync sync "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Truncate(path string, length int64) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_truncate_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_truncate_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_truncate truncate "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Umask(newmask int) (oldmask int) { + r0, _, _ := syscall_syscall(libc_umask_trampoline_addr, uintptr(newmask), 0, 0) + oldmask = int(r0) + return +} + +var libc_umask_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_umask umask "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlink(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_unlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unlink_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unlink unlink "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlinkat(dirfd int, path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_unlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unlinkat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unlinkat unlinkat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unmount(path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_unmount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unmount_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unmount unmount "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func write(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_write_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_write write "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { + r0, _, e1 := syscall_syscall6(libc_mmap_trampoline_addr, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_mmap_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_mmap mmap "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func munmap(addr uintptr, length uintptr) (err error) { + _, _, e1 := syscall_syscall(libc_munmap_trampoline_addr, uintptr(addr), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_munmap_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_munmap munmap "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func readlen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func writelen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_utimensat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_utimensat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_utimensat utimensat "libc.so" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s new file mode 100644 index 000000000000..e1fbd4dfa8c8 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s @@ -0,0 +1,669 @@ +// go run mkasm.go openbsd riscv64 +// Code generated by the command above; DO NOT EDIT. + +#include "textflag.h" + +TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getgroups(SB) +GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgroups_trampoline_addr(SB)/8, $libc_getgroups_trampoline<>(SB) + +TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setgroups(SB) +GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgroups_trampoline_addr(SB)/8, $libc_setgroups_trampoline<>(SB) + +TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_wait4(SB) +GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $8 +DATA ·libc_wait4_trampoline_addr(SB)/8, $libc_wait4_trampoline<>(SB) + +TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_accept(SB) +GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $8 +DATA ·libc_accept_trampoline_addr(SB)/8, $libc_accept_trampoline<>(SB) + +TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_bind(SB) +GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $8 +DATA ·libc_bind_trampoline_addr(SB)/8, $libc_bind_trampoline<>(SB) + +TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_connect(SB) +GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_connect_trampoline_addr(SB)/8, $libc_connect_trampoline<>(SB) + +TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_socket(SB) +GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socket_trampoline_addr(SB)/8, $libc_socket_trampoline<>(SB) + +TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsockopt(SB) +GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockopt_trampoline_addr(SB)/8, $libc_getsockopt_trampoline<>(SB) + +TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setsockopt(SB) +GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsockopt_trampoline_addr(SB)/8, $libc_setsockopt_trampoline<>(SB) + +TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpeername(SB) +GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpeername_trampoline_addr(SB)/8, $libc_getpeername_trampoline<>(SB) + +TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsockname(SB) +GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockname_trampoline_addr(SB)/8, $libc_getsockname_trampoline<>(SB) + +TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shutdown(SB) +GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shutdown_trampoline_addr(SB)/8, $libc_shutdown_trampoline<>(SB) + +TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_socketpair(SB) +GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socketpair_trampoline_addr(SB)/8, $libc_socketpair_trampoline<>(SB) + +TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_recvfrom(SB) +GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvfrom_trampoline_addr(SB)/8, $libc_recvfrom_trampoline<>(SB) + +TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sendto(SB) +GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendto_trampoline_addr(SB)/8, $libc_sendto_trampoline<>(SB) + +TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_recvmsg(SB) +GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvmsg_trampoline_addr(SB)/8, $libc_recvmsg_trampoline<>(SB) + +TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sendmsg(SB) +GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendmsg_trampoline_addr(SB)/8, $libc_sendmsg_trampoline<>(SB) + +TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kevent(SB) +GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kevent_trampoline_addr(SB)/8, $libc_kevent_trampoline<>(SB) + +TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_utimes(SB) +GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_utimes_trampoline_addr(SB)/8, $libc_utimes_trampoline<>(SB) + +TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_futimes(SB) +GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_futimes_trampoline_addr(SB)/8, $libc_futimes_trampoline<>(SB) + +TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_poll(SB) +GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $8 +DATA ·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB) + +TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_madvise(SB) +GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $8 +DATA ·libc_madvise_trampoline_addr(SB)/8, $libc_madvise_trampoline<>(SB) + +TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mlock(SB) +GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlock_trampoline_addr(SB)/8, $libc_mlock_trampoline<>(SB) + +TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mlockall(SB) +GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlockall_trampoline_addr(SB)/8, $libc_mlockall_trampoline<>(SB) + +TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mprotect(SB) +GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mprotect_trampoline_addr(SB)/8, $libc_mprotect_trampoline<>(SB) + +TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_msync(SB) +GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_msync_trampoline_addr(SB)/8, $libc_msync_trampoline<>(SB) + +TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munlock(SB) +GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlock_trampoline_addr(SB)/8, $libc_munlock_trampoline<>(SB) + +TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munlockall(SB) +GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB) + +TEXT libc_pipe2_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pipe2(SB) +GLOBL ·libc_pipe2_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pipe2_trampoline_addr(SB)/8, $libc_pipe2_trampoline<>(SB) + +TEXT libc_getdents_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getdents(SB) +GLOBL ·libc_getdents_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getdents_trampoline_addr(SB)/8, $libc_getdents_trampoline<>(SB) + +TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getcwd(SB) +GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) + +TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ioctl(SB) +GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) + +TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sysctl(SB) +GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) + +TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ppoll(SB) +GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ppoll_trampoline_addr(SB)/8, $libc_ppoll_trampoline<>(SB) + +TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_access(SB) +GLOBL ·libc_access_trampoline_addr(SB), RODATA, $8 +DATA ·libc_access_trampoline_addr(SB)/8, $libc_access_trampoline<>(SB) + +TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_adjtime(SB) +GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_adjtime_trampoline_addr(SB)/8, $libc_adjtime_trampoline<>(SB) + +TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chdir(SB) +GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chdir_trampoline_addr(SB)/8, $libc_chdir_trampoline<>(SB) + +TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chflags(SB) +GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chflags_trampoline_addr(SB)/8, $libc_chflags_trampoline<>(SB) + +TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chmod(SB) +GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chmod_trampoline_addr(SB)/8, $libc_chmod_trampoline<>(SB) + +TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chown(SB) +GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chown_trampoline_addr(SB)/8, $libc_chown_trampoline<>(SB) + +TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_chroot(SB) +GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chroot_trampoline_addr(SB)/8, $libc_chroot_trampoline<>(SB) + +TEXT libc_clock_gettime_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_clock_gettime(SB) +GLOBL ·libc_clock_gettime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clock_gettime_trampoline_addr(SB)/8, $libc_clock_gettime_trampoline<>(SB) + +TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_close(SB) +GLOBL ·libc_close_trampoline_addr(SB), RODATA, $8 +DATA ·libc_close_trampoline_addr(SB)/8, $libc_close_trampoline<>(SB) + +TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup(SB) +GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup_trampoline_addr(SB)/8, $libc_dup_trampoline<>(SB) + +TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup2(SB) +GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup2_trampoline_addr(SB)/8, $libc_dup2_trampoline<>(SB) + +TEXT libc_dup3_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_dup3(SB) +GLOBL ·libc_dup3_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup3_trampoline_addr(SB)/8, $libc_dup3_trampoline<>(SB) + +TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_exit(SB) +GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_exit_trampoline_addr(SB)/8, $libc_exit_trampoline<>(SB) + +TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_faccessat(SB) +GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_faccessat_trampoline_addr(SB)/8, $libc_faccessat_trampoline<>(SB) + +TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchdir(SB) +GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchdir_trampoline_addr(SB)/8, $libc_fchdir_trampoline<>(SB) + +TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchflags(SB) +GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchflags_trampoline_addr(SB)/8, $libc_fchflags_trampoline<>(SB) + +TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchmod(SB) +GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmod_trampoline_addr(SB)/8, $libc_fchmod_trampoline<>(SB) + +TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchmodat(SB) +GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmodat_trampoline_addr(SB)/8, $libc_fchmodat_trampoline<>(SB) + +TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchown(SB) +GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchown_trampoline_addr(SB)/8, $libc_fchown_trampoline<>(SB) + +TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fchownat(SB) +GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchownat_trampoline_addr(SB)/8, $libc_fchownat_trampoline<>(SB) + +TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_flock(SB) +GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_flock_trampoline_addr(SB)/8, $libc_flock_trampoline<>(SB) + +TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fpathconf(SB) +GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fpathconf_trampoline_addr(SB)/8, $libc_fpathconf_trampoline<>(SB) + +TEXT libc_fstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstat(SB) +GLOBL ·libc_fstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstat_trampoline_addr(SB)/8, $libc_fstat_trampoline<>(SB) + +TEXT libc_fstatat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstatat(SB) +GLOBL ·libc_fstatat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatat_trampoline_addr(SB)/8, $libc_fstatat_trampoline<>(SB) + +TEXT libc_fstatfs_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fstatfs(SB) +GLOBL ·libc_fstatfs_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatfs_trampoline_addr(SB)/8, $libc_fstatfs_trampoline<>(SB) + +TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fsync(SB) +GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fsync_trampoline_addr(SB)/8, $libc_fsync_trampoline<>(SB) + +TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ftruncate(SB) +GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ftruncate_trampoline_addr(SB)/8, $libc_ftruncate_trampoline<>(SB) + +TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getegid(SB) +GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getegid_trampoline_addr(SB)/8, $libc_getegid_trampoline<>(SB) + +TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_geteuid(SB) +GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_geteuid_trampoline_addr(SB)/8, $libc_geteuid_trampoline<>(SB) + +TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getgid(SB) +GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgid_trampoline_addr(SB)/8, $libc_getgid_trampoline<>(SB) + +TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpgid(SB) +GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgid_trampoline_addr(SB)/8, $libc_getpgid_trampoline<>(SB) + +TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpgrp(SB) +GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgrp_trampoline_addr(SB)/8, $libc_getpgrp_trampoline<>(SB) + +TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpid(SB) +GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpid_trampoline_addr(SB)/8, $libc_getpid_trampoline<>(SB) + +TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getppid(SB) +GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getppid_trampoline_addr(SB)/8, $libc_getppid_trampoline<>(SB) + +TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getpriority(SB) +GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpriority_trampoline_addr(SB)/8, $libc_getpriority_trampoline<>(SB) + +TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrlimit(SB) +GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrlimit_trampoline_addr(SB)/8, $libc_getrlimit_trampoline<>(SB) + +TEXT libc_getrtable_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrtable(SB) +GLOBL ·libc_getrtable_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrtable_trampoline_addr(SB)/8, $libc_getrtable_trampoline<>(SB) + +TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getrusage(SB) +GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrusage_trampoline_addr(SB)/8, $libc_getrusage_trampoline<>(SB) + +TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getsid(SB) +GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsid_trampoline_addr(SB)/8, $libc_getsid_trampoline<>(SB) + +TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_gettimeofday(SB) +GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_gettimeofday_trampoline_addr(SB)/8, $libc_gettimeofday_trampoline<>(SB) + +TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getuid(SB) +GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getuid_trampoline_addr(SB)/8, $libc_getuid_trampoline<>(SB) + +TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_issetugid(SB) +GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_issetugid_trampoline_addr(SB)/8, $libc_issetugid_trampoline<>(SB) + +TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kill(SB) +GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kill_trampoline_addr(SB)/8, $libc_kill_trampoline<>(SB) + +TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_kqueue(SB) +GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kqueue_trampoline_addr(SB)/8, $libc_kqueue_trampoline<>(SB) + +TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lchown(SB) +GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lchown_trampoline_addr(SB)/8, $libc_lchown_trampoline<>(SB) + +TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_link(SB) +GLOBL ·libc_link_trampoline_addr(SB), RODATA, $8 +DATA ·libc_link_trampoline_addr(SB)/8, $libc_link_trampoline<>(SB) + +TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_linkat(SB) +GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_linkat_trampoline_addr(SB)/8, $libc_linkat_trampoline<>(SB) + +TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_listen(SB) +GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $8 +DATA ·libc_listen_trampoline_addr(SB)/8, $libc_listen_trampoline<>(SB) + +TEXT libc_lstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lstat(SB) +GLOBL ·libc_lstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lstat_trampoline_addr(SB)/8, $libc_lstat_trampoline<>(SB) + +TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkdir(SB) +GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdir_trampoline_addr(SB)/8, $libc_mkdir_trampoline<>(SB) + +TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkdirat(SB) +GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdirat_trampoline_addr(SB)/8, $libc_mkdirat_trampoline<>(SB) + +TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkfifo(SB) +GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkfifo_trampoline_addr(SB)/8, $libc_mkfifo_trampoline<>(SB) + +TEXT libc_mkfifoat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mkfifoat(SB) +GLOBL ·libc_mkfifoat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkfifoat_trampoline_addr(SB)/8, $libc_mkfifoat_trampoline<>(SB) + +TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mknod(SB) +GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB) + +TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mknodat(SB) +GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB) + +TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_nanosleep(SB) +GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8 +DATA ·libc_nanosleep_trampoline_addr(SB)/8, $libc_nanosleep_trampoline<>(SB) + +TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_open(SB) +GLOBL ·libc_open_trampoline_addr(SB), RODATA, $8 +DATA ·libc_open_trampoline_addr(SB)/8, $libc_open_trampoline<>(SB) + +TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_openat(SB) +GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_openat_trampoline_addr(SB)/8, $libc_openat_trampoline<>(SB) + +TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pathconf(SB) +GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pathconf_trampoline_addr(SB)/8, $libc_pathconf_trampoline<>(SB) + +TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pread(SB) +GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pread_trampoline_addr(SB)/8, $libc_pread_trampoline<>(SB) + +TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pwrite(SB) +GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pwrite_trampoline_addr(SB)/8, $libc_pwrite_trampoline<>(SB) + +TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_read(SB) +GLOBL ·libc_read_trampoline_addr(SB), RODATA, $8 +DATA ·libc_read_trampoline_addr(SB)/8, $libc_read_trampoline<>(SB) + +TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readlink(SB) +GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlink_trampoline_addr(SB)/8, $libc_readlink_trampoline<>(SB) + +TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_readlinkat(SB) +GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlinkat_trampoline_addr(SB)/8, $libc_readlinkat_trampoline<>(SB) + +TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_rename(SB) +GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rename_trampoline_addr(SB)/8, $libc_rename_trampoline<>(SB) + +TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_renameat(SB) +GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameat_trampoline_addr(SB)/8, $libc_renameat_trampoline<>(SB) + +TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_revoke(SB) +GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $8 +DATA ·libc_revoke_trampoline_addr(SB)/8, $libc_revoke_trampoline<>(SB) + +TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_rmdir(SB) +GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rmdir_trampoline_addr(SB)/8, $libc_rmdir_trampoline<>(SB) + +TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_lseek(SB) +GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lseek_trampoline_addr(SB)/8, $libc_lseek_trampoline<>(SB) + +TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_select(SB) +GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8 +DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB) + +TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setegid(SB) +GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setegid_trampoline_addr(SB)/8, $libc_setegid_trampoline<>(SB) + +TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_seteuid(SB) +GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_seteuid_trampoline_addr(SB)/8, $libc_seteuid_trampoline<>(SB) + +TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setgid(SB) +GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgid_trampoline_addr(SB)/8, $libc_setgid_trampoline<>(SB) + +TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setlogin(SB) +GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setlogin_trampoline_addr(SB)/8, $libc_setlogin_trampoline<>(SB) + +TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setpgid(SB) +GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpgid_trampoline_addr(SB)/8, $libc_setpgid_trampoline<>(SB) + +TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setpriority(SB) +GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpriority_trampoline_addr(SB)/8, $libc_setpriority_trampoline<>(SB) + +TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setregid(SB) +GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setregid_trampoline_addr(SB)/8, $libc_setregid_trampoline<>(SB) + +TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setreuid(SB) +GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB) + +TEXT libc_setresgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setresgid(SB) +GLOBL ·libc_setresgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setresgid_trampoline_addr(SB)/8, $libc_setresgid_trampoline<>(SB) + +TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setresuid(SB) +GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB) + +TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setrlimit(SB) +GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) + +TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setrtable(SB) +GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setrtable_trampoline_addr(SB)/8, $libc_setrtable_trampoline<>(SB) + +TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setsid(SB) +GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsid_trampoline_addr(SB)/8, $libc_setsid_trampoline<>(SB) + +TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_settimeofday(SB) +GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_settimeofday_trampoline_addr(SB)/8, $libc_settimeofday_trampoline<>(SB) + +TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setuid(SB) +GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setuid_trampoline_addr(SB)/8, $libc_setuid_trampoline<>(SB) + +TEXT libc_stat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_stat(SB) +GLOBL ·libc_stat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_stat_trampoline_addr(SB)/8, $libc_stat_trampoline<>(SB) + +TEXT libc_statfs_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_statfs(SB) +GLOBL ·libc_statfs_trampoline_addr(SB), RODATA, $8 +DATA ·libc_statfs_trampoline_addr(SB)/8, $libc_statfs_trampoline<>(SB) + +TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_symlink(SB) +GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlink_trampoline_addr(SB)/8, $libc_symlink_trampoline<>(SB) + +TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_symlinkat(SB) +GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlinkat_trampoline_addr(SB)/8, $libc_symlinkat_trampoline<>(SB) + +TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_sync(SB) +GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sync_trampoline_addr(SB)/8, $libc_sync_trampoline<>(SB) + +TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_truncate(SB) +GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_truncate_trampoline_addr(SB)/8, $libc_truncate_trampoline<>(SB) + +TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_umask(SB) +GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $8 +DATA ·libc_umask_trampoline_addr(SB)/8, $libc_umask_trampoline<>(SB) + +TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unlink(SB) +GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlink_trampoline_addr(SB)/8, $libc_unlink_trampoline<>(SB) + +TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unlinkat(SB) +GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlinkat_trampoline_addr(SB)/8, $libc_unlinkat_trampoline<>(SB) + +TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unmount(SB) +GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unmount_trampoline_addr(SB)/8, $libc_unmount_trampoline<>(SB) + +TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_write(SB) +GLOBL ·libc_write_trampoline_addr(SB), RODATA, $8 +DATA ·libc_write_trampoline_addr(SB)/8, $libc_write_trampoline<>(SB) + +TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_mmap(SB) +GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mmap_trampoline_addr(SB)/8, $libc_mmap_trampoline<>(SB) + +TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_munmap(SB) +GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) + +TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_utimensat(SB) +GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index d12f4fbfea5f..78d4a4240e9c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -38,6 +38,7 @@ import ( //go:cgo_import_dynamic libc_chmod chmod "libc.so" //go:cgo_import_dynamic libc_chown chown "libc.so" //go:cgo_import_dynamic libc_chroot chroot "libc.so" +//go:cgo_import_dynamic libc_clockgettime clockgettime "libc.so" //go:cgo_import_dynamic libc_close close "libc.so" //go:cgo_import_dynamic libc_creat creat "libc.so" //go:cgo_import_dynamic libc_dup dup "libc.so" @@ -66,6 +67,7 @@ import ( //go:cgo_import_dynamic libc_getpriority getpriority "libc.so" //go:cgo_import_dynamic libc_getrlimit getrlimit "libc.so" //go:cgo_import_dynamic libc_getrusage getrusage "libc.so" +//go:cgo_import_dynamic libc_getsid getsid "libc.so" //go:cgo_import_dynamic libc_gettimeofday gettimeofday "libc.so" //go:cgo_import_dynamic libc_getuid getuid "libc.so" //go:cgo_import_dynamic libc_kill kill "libc.so" @@ -146,6 +148,8 @@ import ( //go:cgo_import_dynamic libc_port_dissociate port_dissociate "libc.so" //go:cgo_import_dynamic libc_port_get port_get "libc.so" //go:cgo_import_dynamic libc_port_getn port_getn "libc.so" +//go:cgo_import_dynamic libc_putmsg putmsg "libc.so" +//go:cgo_import_dynamic libc_getmsg getmsg "libc.so" //go:linkname procpipe libc_pipe //go:linkname procpipe2 libc_pipe2 @@ -174,6 +178,7 @@ import ( //go:linkname procChmod libc_chmod //go:linkname procChown libc_chown //go:linkname procChroot libc_chroot +//go:linkname procClockGettime libc_clockgettime //go:linkname procClose libc_close //go:linkname procCreat libc_creat //go:linkname procDup libc_dup @@ -202,6 +207,7 @@ import ( //go:linkname procGetpriority libc_getpriority //go:linkname procGetrlimit libc_getrlimit //go:linkname procGetrusage libc_getrusage +//go:linkname procGetsid libc_getsid //go:linkname procGettimeofday libc_gettimeofday //go:linkname procGetuid libc_getuid //go:linkname procKill libc_kill @@ -282,6 +288,8 @@ import ( //go:linkname procport_dissociate libc_port_dissociate //go:linkname procport_get libc_port_get //go:linkname procport_getn libc_port_getn +//go:linkname procputmsg libc_putmsg +//go:linkname procgetmsg libc_getmsg var ( procpipe, @@ -311,6 +319,7 @@ var ( procChmod, procChown, procChroot, + procClockGettime, procClose, procCreat, procDup, @@ -339,6 +348,7 @@ var ( procGetpriority, procGetrlimit, procGetrusage, + procGetsid, procGettimeofday, procGetuid, procKill, @@ -418,7 +428,9 @@ var ( procport_associate, procport_dissociate, procport_get, - procport_getn syscallFunc + procport_getn, + procputmsg, + procgetmsg syscallFunc ) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -741,6 +753,16 @@ func Chroot(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procClockGettime)), 2, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0, 0, 0, 0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procClose)), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { @@ -1044,6 +1066,17 @@ func Getrusage(who int, rusage *Rusage) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Getsid(pid int) (sid int, err error) { + r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetsid)), 1, uintptr(pid), 0, 0, 0, 0, 0) + sid = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGettimeofday)), 1, uintptr(unsafe.Pointer(tv)), 0, 0, 0, 0, 0) if e1 != 0 { @@ -2051,3 +2084,23 @@ func port_getn(port int, pe *portEvent, max uint32, nget *uint32, timeout *Times } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func putmsg(fd int, clptr *strbuf, dataptr *strbuf, flags int) (err error) { + _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procputmsg)), 4, uintptr(fd), uintptr(unsafe.Pointer(clptr)), uintptr(unsafe.Pointer(dataptr)), uintptr(flags), 0, 0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getmsg(fd int, clptr *strbuf, dataptr *strbuf, flags *int) (err error) { + _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetmsg)), 4, uintptr(fd), uintptr(unsafe.Pointer(clptr)), uintptr(unsafe.Pointer(dataptr)), uintptr(unsafe.Pointer(flags)), 0, 0) + if e1 != 0 { + err = e1 + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go index 9e9d0b2a9c45..55e0484719c4 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go @@ -17,6 +17,7 @@ var sysctlMib = []mibentry{ {"ddb.max_line", []_C_int{9, 3}}, {"ddb.max_width", []_C_int{9, 2}}, {"ddb.panic", []_C_int{9, 5}}, + {"ddb.profile", []_C_int{9, 9}}, {"ddb.radix", []_C_int{9, 1}}, {"ddb.tab_stop_width", []_C_int{9, 4}}, {"ddb.trigger", []_C_int{9, 8}}, @@ -33,29 +34,37 @@ var sysctlMib = []mibentry{ {"hw.ncpufound", []_C_int{6, 21}}, {"hw.ncpuonline", []_C_int{6, 25}}, {"hw.pagesize", []_C_int{6, 7}}, + {"hw.perfpolicy", []_C_int{6, 23}}, {"hw.physmem", []_C_int{6, 19}}, + {"hw.power", []_C_int{6, 26}}, {"hw.product", []_C_int{6, 15}}, {"hw.serialno", []_C_int{6, 17}}, {"hw.setperf", []_C_int{6, 13}}, + {"hw.smt", []_C_int{6, 24}}, {"hw.usermem", []_C_int{6, 20}}, {"hw.uuid", []_C_int{6, 18}}, {"hw.vendor", []_C_int{6, 14}}, {"hw.version", []_C_int{6, 16}}, - {"kern.arandom", []_C_int{1, 37}}, + {"kern.allowdt", []_C_int{1, 65}}, + {"kern.allowkmem", []_C_int{1, 52}}, {"kern.argmax", []_C_int{1, 8}}, + {"kern.audio", []_C_int{1, 84}}, {"kern.boottime", []_C_int{1, 21}}, {"kern.bufcachepercent", []_C_int{1, 72}}, {"kern.ccpu", []_C_int{1, 45}}, {"kern.clockrate", []_C_int{1, 12}}, + {"kern.consbuf", []_C_int{1, 83}}, + {"kern.consbufsize", []_C_int{1, 82}}, {"kern.consdev", []_C_int{1, 75}}, {"kern.cp_time", []_C_int{1, 40}}, {"kern.cp_time2", []_C_int{1, 71}}, - {"kern.cryptodevallowsoft", []_C_int{1, 53}}, + {"kern.cpustats", []_C_int{1, 85}}, {"kern.domainname", []_C_int{1, 22}}, {"kern.file", []_C_int{1, 73}}, {"kern.forkstat", []_C_int{1, 42}}, {"kern.fscale", []_C_int{1, 46}}, {"kern.fsync", []_C_int{1, 33}}, + {"kern.global_ptrace", []_C_int{1, 81}}, {"kern.hostid", []_C_int{1, 11}}, {"kern.hostname", []_C_int{1, 10}}, {"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}}, @@ -78,17 +87,16 @@ var sysctlMib = []mibentry{ {"kern.ngroups", []_C_int{1, 18}}, {"kern.nosuidcoredump", []_C_int{1, 32}}, {"kern.nprocs", []_C_int{1, 47}}, - {"kern.nselcoll", []_C_int{1, 43}}, {"kern.nthreads", []_C_int{1, 26}}, {"kern.numvnodes", []_C_int{1, 58}}, {"kern.osrelease", []_C_int{1, 2}}, {"kern.osrevision", []_C_int{1, 3}}, {"kern.ostype", []_C_int{1, 1}}, {"kern.osversion", []_C_int{1, 27}}, + {"kern.pfstatus", []_C_int{1, 86}}, {"kern.pool_debug", []_C_int{1, 77}}, {"kern.posix1version", []_C_int{1, 17}}, {"kern.proc", []_C_int{1, 66}}, - {"kern.random", []_C_int{1, 31}}, {"kern.rawpartition", []_C_int{1, 24}}, {"kern.saved_ids", []_C_int{1, 20}}, {"kern.securelevel", []_C_int{1, 9}}, @@ -106,21 +114,20 @@ var sysctlMib = []mibentry{ {"kern.timecounter.hardware", []_C_int{1, 69, 3}}, {"kern.timecounter.tick", []_C_int{1, 69, 1}}, {"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}}, - {"kern.tty.maxptys", []_C_int{1, 44, 6}}, - {"kern.tty.nptys", []_C_int{1, 44, 7}}, + {"kern.timeout_stats", []_C_int{1, 87}}, {"kern.tty.tk_cancc", []_C_int{1, 44, 4}}, {"kern.tty.tk_nin", []_C_int{1, 44, 1}}, {"kern.tty.tk_nout", []_C_int{1, 44, 2}}, {"kern.tty.tk_rawcc", []_C_int{1, 44, 3}}, {"kern.tty.ttyinfo", []_C_int{1, 44, 5}}, {"kern.ttycount", []_C_int{1, 57}}, - {"kern.userasymcrypto", []_C_int{1, 60}}, - {"kern.usercrypto", []_C_int{1, 52}}, - {"kern.usermount", []_C_int{1, 30}}, + {"kern.utc_offset", []_C_int{1, 88}}, {"kern.version", []_C_int{1, 4}}, - {"kern.vnode", []_C_int{1, 13}}, + {"kern.video", []_C_int{1, 89}}, {"kern.watchdog.auto", []_C_int{1, 64, 2}}, {"kern.watchdog.period", []_C_int{1, 64, 1}}, + {"kern.witnesswatch", []_C_int{1, 53}}, + {"kern.wxabort", []_C_int{1, 74}}, {"net.bpf.bufsize", []_C_int{4, 31, 1}}, {"net.bpf.maxbufsize", []_C_int{4, 31, 2}}, {"net.inet.ah.enable", []_C_int{4, 2, 51, 1}}, @@ -148,7 +155,9 @@ var sysctlMib = []mibentry{ {"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}}, {"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}}, {"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}}, + {"net.inet.ip.arpdown", []_C_int{4, 2, 0, 40}}, {"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}}, + {"net.inet.ip.arptimeout", []_C_int{4, 2, 0, 39}}, {"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}}, {"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}}, {"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}}, @@ -157,8 +166,10 @@ var sysctlMib = []mibentry{ {"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}}, {"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}}, {"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}}, + {"net.inet.ip.mrtmfc", []_C_int{4, 2, 0, 37}}, {"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}}, {"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}}, + {"net.inet.ip.mrtvif", []_C_int{4, 2, 0, 38}}, {"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}}, {"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}}, {"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}}, @@ -175,9 +186,7 @@ var sysctlMib = []mibentry{ {"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}}, {"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}}, {"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}}, - {"net.inet.mobileip.allow", []_C_int{4, 2, 55, 1}}, {"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}}, - {"net.inet.pim.stats", []_C_int{4, 2, 103, 1}}, {"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}}, {"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}}, {"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}}, @@ -191,6 +200,7 @@ var sysctlMib = []mibentry{ {"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}}, {"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}}, {"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}}, + {"net.inet.tcp.rootonly", []_C_int{4, 2, 6, 24}}, {"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}}, {"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}}, {"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}}, @@ -198,9 +208,12 @@ var sysctlMib = []mibentry{ {"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}}, {"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}}, {"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}}, + {"net.inet.tcp.synhashsize", []_C_int{4, 2, 6, 25}}, + {"net.inet.tcp.synuselimit", []_C_int{4, 2, 6, 23}}, {"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}}, {"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}}, {"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}}, + {"net.inet.udp.rootonly", []_C_int{4, 2, 17, 6}}, {"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}}, {"net.inet.udp.stats", []_C_int{4, 2, 17, 5}}, {"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}}, @@ -213,13 +226,8 @@ var sysctlMib = []mibentry{ {"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}}, {"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}}, {"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}}, - {"net.inet6.icmp6.nd6_prune", []_C_int{4, 24, 30, 6}}, {"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}}, - {"net.inet6.icmp6.nd6_useloopback", []_C_int{4, 24, 30, 11}}, - {"net.inet6.icmp6.nodeinfo", []_C_int{4, 24, 30, 13}}, - {"net.inet6.icmp6.rediraccept", []_C_int{4, 24, 30, 2}}, {"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}}, - {"net.inet6.ip6.accept_rtadv", []_C_int{4, 24, 17, 12}}, {"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}}, {"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}}, {"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}}, @@ -232,20 +240,19 @@ var sysctlMib = []mibentry{ {"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}}, {"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}}, {"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}}, - {"net.inet6.ip6.maxifdefrouters", []_C_int{4, 24, 17, 47}}, - {"net.inet6.ip6.maxifprefixes", []_C_int{4, 24, 17, 46}}, {"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}}, + {"net.inet6.ip6.mrtmfc", []_C_int{4, 24, 17, 53}}, + {"net.inet6.ip6.mrtmif", []_C_int{4, 24, 17, 52}}, {"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}}, {"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}}, {"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}}, {"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}}, {"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}}, {"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}}, - {"net.inet6.ip6.rr_prune", []_C_int{4, 24, 17, 22}}, + {"net.inet6.ip6.soiikey", []_C_int{4, 24, 17, 54}}, {"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}}, {"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}}, {"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}}, - {"net.inet6.ip6.v6only", []_C_int{4, 24, 17, 24}}, {"net.key.sadb_dump", []_C_int{4, 30, 1}}, {"net.key.spd_dump", []_C_int{4, 30, 2}}, {"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}}, @@ -254,12 +261,12 @@ var sysctlMib = []mibentry{ {"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}}, {"net.mpls.mapttl_ip", []_C_int{4, 33, 5}}, {"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}}, - {"net.mpls.maxloop_inkernel", []_C_int{4, 33, 4}}, {"net.mpls.ttl", []_C_int{4, 33, 2}}, {"net.pflow.stats", []_C_int{4, 34, 1}}, {"net.pipex.enable", []_C_int{4, 35, 1}}, {"vm.anonmin", []_C_int{2, 7}}, {"vm.loadavg", []_C_int{2, 2}}, + {"vm.malloc_conf", []_C_int{2, 12}}, {"vm.maxslp", []_C_int{2, 10}}, {"vm.nkmempages", []_C_int{2, 6}}, {"vm.psstrings", []_C_int{2, 3}}, diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go index adecd09667d0..d2243cf83f5b 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go @@ -36,23 +36,29 @@ var sysctlMib = []mibentry{ {"hw.pagesize", []_C_int{6, 7}}, {"hw.perfpolicy", []_C_int{6, 23}}, {"hw.physmem", []_C_int{6, 19}}, + {"hw.power", []_C_int{6, 26}}, {"hw.product", []_C_int{6, 15}}, {"hw.serialno", []_C_int{6, 17}}, {"hw.setperf", []_C_int{6, 13}}, + {"hw.smt", []_C_int{6, 24}}, {"hw.usermem", []_C_int{6, 20}}, {"hw.uuid", []_C_int{6, 18}}, {"hw.vendor", []_C_int{6, 14}}, {"hw.version", []_C_int{6, 16}}, + {"kern.allowdt", []_C_int{1, 65}}, {"kern.allowkmem", []_C_int{1, 52}}, {"kern.argmax", []_C_int{1, 8}}, + {"kern.audio", []_C_int{1, 84}}, {"kern.boottime", []_C_int{1, 21}}, {"kern.bufcachepercent", []_C_int{1, 72}}, {"kern.ccpu", []_C_int{1, 45}}, {"kern.clockrate", []_C_int{1, 12}}, + {"kern.consbuf", []_C_int{1, 83}}, + {"kern.consbufsize", []_C_int{1, 82}}, {"kern.consdev", []_C_int{1, 75}}, {"kern.cp_time", []_C_int{1, 40}}, {"kern.cp_time2", []_C_int{1, 71}}, - {"kern.dnsjackport", []_C_int{1, 13}}, + {"kern.cpustats", []_C_int{1, 85}}, {"kern.domainname", []_C_int{1, 22}}, {"kern.file", []_C_int{1, 73}}, {"kern.forkstat", []_C_int{1, 42}}, @@ -81,13 +87,13 @@ var sysctlMib = []mibentry{ {"kern.ngroups", []_C_int{1, 18}}, {"kern.nosuidcoredump", []_C_int{1, 32}}, {"kern.nprocs", []_C_int{1, 47}}, - {"kern.nselcoll", []_C_int{1, 43}}, {"kern.nthreads", []_C_int{1, 26}}, {"kern.numvnodes", []_C_int{1, 58}}, {"kern.osrelease", []_C_int{1, 2}}, {"kern.osrevision", []_C_int{1, 3}}, {"kern.ostype", []_C_int{1, 1}}, {"kern.osversion", []_C_int{1, 27}}, + {"kern.pfstatus", []_C_int{1, 86}}, {"kern.pool_debug", []_C_int{1, 77}}, {"kern.posix1version", []_C_int{1, 17}}, {"kern.proc", []_C_int{1, 66}}, @@ -108,15 +114,19 @@ var sysctlMib = []mibentry{ {"kern.timecounter.hardware", []_C_int{1, 69, 3}}, {"kern.timecounter.tick", []_C_int{1, 69, 1}}, {"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}}, + {"kern.timeout_stats", []_C_int{1, 87}}, {"kern.tty.tk_cancc", []_C_int{1, 44, 4}}, {"kern.tty.tk_nin", []_C_int{1, 44, 1}}, {"kern.tty.tk_nout", []_C_int{1, 44, 2}}, {"kern.tty.tk_rawcc", []_C_int{1, 44, 3}}, {"kern.tty.ttyinfo", []_C_int{1, 44, 5}}, {"kern.ttycount", []_C_int{1, 57}}, + {"kern.utc_offset", []_C_int{1, 88}}, {"kern.version", []_C_int{1, 4}}, + {"kern.video", []_C_int{1, 89}}, {"kern.watchdog.auto", []_C_int{1, 64, 2}}, {"kern.watchdog.period", []_C_int{1, 64, 1}}, + {"kern.witnesswatch", []_C_int{1, 53}}, {"kern.wxabort", []_C_int{1, 74}}, {"net.bpf.bufsize", []_C_int{4, 31, 1}}, {"net.bpf.maxbufsize", []_C_int{4, 31, 2}}, @@ -176,7 +186,6 @@ var sysctlMib = []mibentry{ {"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}}, {"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}}, {"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}}, - {"net.inet.mobileip.allow", []_C_int{4, 2, 55, 1}}, {"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}}, {"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}}, {"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}}, @@ -252,12 +261,12 @@ var sysctlMib = []mibentry{ {"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}}, {"net.mpls.mapttl_ip", []_C_int{4, 33, 5}}, {"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}}, - {"net.mpls.maxloop_inkernel", []_C_int{4, 33, 4}}, {"net.mpls.ttl", []_C_int{4, 33, 2}}, {"net.pflow.stats", []_C_int{4, 34, 1}}, {"net.pipex.enable", []_C_int{4, 35, 1}}, {"vm.anonmin", []_C_int{2, 7}}, {"vm.loadavg", []_C_int{2, 2}}, + {"vm.malloc_conf", []_C_int{2, 12}}, {"vm.maxslp", []_C_int{2, 10}}, {"vm.nkmempages", []_C_int{2, 6}}, {"vm.psstrings", []_C_int{2, 3}}, diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go index 8ea52a4a1810..82dc51bd8b57 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go @@ -17,6 +17,7 @@ var sysctlMib = []mibentry{ {"ddb.max_line", []_C_int{9, 3}}, {"ddb.max_width", []_C_int{9, 2}}, {"ddb.panic", []_C_int{9, 5}}, + {"ddb.profile", []_C_int{9, 9}}, {"ddb.radix", []_C_int{9, 1}}, {"ddb.tab_stop_width", []_C_int{9, 4}}, {"ddb.trigger", []_C_int{9, 8}}, @@ -33,29 +34,37 @@ var sysctlMib = []mibentry{ {"hw.ncpufound", []_C_int{6, 21}}, {"hw.ncpuonline", []_C_int{6, 25}}, {"hw.pagesize", []_C_int{6, 7}}, + {"hw.perfpolicy", []_C_int{6, 23}}, {"hw.physmem", []_C_int{6, 19}}, + {"hw.power", []_C_int{6, 26}}, {"hw.product", []_C_int{6, 15}}, {"hw.serialno", []_C_int{6, 17}}, {"hw.setperf", []_C_int{6, 13}}, + {"hw.smt", []_C_int{6, 24}}, {"hw.usermem", []_C_int{6, 20}}, {"hw.uuid", []_C_int{6, 18}}, {"hw.vendor", []_C_int{6, 14}}, {"hw.version", []_C_int{6, 16}}, - {"kern.arandom", []_C_int{1, 37}}, + {"kern.allowdt", []_C_int{1, 65}}, + {"kern.allowkmem", []_C_int{1, 52}}, {"kern.argmax", []_C_int{1, 8}}, + {"kern.audio", []_C_int{1, 84}}, {"kern.boottime", []_C_int{1, 21}}, {"kern.bufcachepercent", []_C_int{1, 72}}, {"kern.ccpu", []_C_int{1, 45}}, {"kern.clockrate", []_C_int{1, 12}}, + {"kern.consbuf", []_C_int{1, 83}}, + {"kern.consbufsize", []_C_int{1, 82}}, {"kern.consdev", []_C_int{1, 75}}, {"kern.cp_time", []_C_int{1, 40}}, {"kern.cp_time2", []_C_int{1, 71}}, - {"kern.cryptodevallowsoft", []_C_int{1, 53}}, + {"kern.cpustats", []_C_int{1, 85}}, {"kern.domainname", []_C_int{1, 22}}, {"kern.file", []_C_int{1, 73}}, {"kern.forkstat", []_C_int{1, 42}}, {"kern.fscale", []_C_int{1, 46}}, {"kern.fsync", []_C_int{1, 33}}, + {"kern.global_ptrace", []_C_int{1, 81}}, {"kern.hostid", []_C_int{1, 11}}, {"kern.hostname", []_C_int{1, 10}}, {"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}}, @@ -78,17 +87,16 @@ var sysctlMib = []mibentry{ {"kern.ngroups", []_C_int{1, 18}}, {"kern.nosuidcoredump", []_C_int{1, 32}}, {"kern.nprocs", []_C_int{1, 47}}, - {"kern.nselcoll", []_C_int{1, 43}}, {"kern.nthreads", []_C_int{1, 26}}, {"kern.numvnodes", []_C_int{1, 58}}, {"kern.osrelease", []_C_int{1, 2}}, {"kern.osrevision", []_C_int{1, 3}}, {"kern.ostype", []_C_int{1, 1}}, {"kern.osversion", []_C_int{1, 27}}, + {"kern.pfstatus", []_C_int{1, 86}}, {"kern.pool_debug", []_C_int{1, 77}}, {"kern.posix1version", []_C_int{1, 17}}, {"kern.proc", []_C_int{1, 66}}, - {"kern.random", []_C_int{1, 31}}, {"kern.rawpartition", []_C_int{1, 24}}, {"kern.saved_ids", []_C_int{1, 20}}, {"kern.securelevel", []_C_int{1, 9}}, @@ -106,21 +114,20 @@ var sysctlMib = []mibentry{ {"kern.timecounter.hardware", []_C_int{1, 69, 3}}, {"kern.timecounter.tick", []_C_int{1, 69, 1}}, {"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}}, - {"kern.tty.maxptys", []_C_int{1, 44, 6}}, - {"kern.tty.nptys", []_C_int{1, 44, 7}}, + {"kern.timeout_stats", []_C_int{1, 87}}, {"kern.tty.tk_cancc", []_C_int{1, 44, 4}}, {"kern.tty.tk_nin", []_C_int{1, 44, 1}}, {"kern.tty.tk_nout", []_C_int{1, 44, 2}}, {"kern.tty.tk_rawcc", []_C_int{1, 44, 3}}, {"kern.tty.ttyinfo", []_C_int{1, 44, 5}}, {"kern.ttycount", []_C_int{1, 57}}, - {"kern.userasymcrypto", []_C_int{1, 60}}, - {"kern.usercrypto", []_C_int{1, 52}}, - {"kern.usermount", []_C_int{1, 30}}, + {"kern.utc_offset", []_C_int{1, 88}}, {"kern.version", []_C_int{1, 4}}, - {"kern.vnode", []_C_int{1, 13}}, + {"kern.video", []_C_int{1, 89}}, {"kern.watchdog.auto", []_C_int{1, 64, 2}}, {"kern.watchdog.period", []_C_int{1, 64, 1}}, + {"kern.witnesswatch", []_C_int{1, 53}}, + {"kern.wxabort", []_C_int{1, 74}}, {"net.bpf.bufsize", []_C_int{4, 31, 1}}, {"net.bpf.maxbufsize", []_C_int{4, 31, 2}}, {"net.inet.ah.enable", []_C_int{4, 2, 51, 1}}, @@ -148,7 +155,9 @@ var sysctlMib = []mibentry{ {"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}}, {"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}}, {"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}}, + {"net.inet.ip.arpdown", []_C_int{4, 2, 0, 40}}, {"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}}, + {"net.inet.ip.arptimeout", []_C_int{4, 2, 0, 39}}, {"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}}, {"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}}, {"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}}, @@ -157,8 +166,10 @@ var sysctlMib = []mibentry{ {"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}}, {"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}}, {"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}}, + {"net.inet.ip.mrtmfc", []_C_int{4, 2, 0, 37}}, {"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}}, {"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}}, + {"net.inet.ip.mrtvif", []_C_int{4, 2, 0, 38}}, {"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}}, {"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}}, {"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}}, @@ -175,9 +186,7 @@ var sysctlMib = []mibentry{ {"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}}, {"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}}, {"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}}, - {"net.inet.mobileip.allow", []_C_int{4, 2, 55, 1}}, {"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}}, - {"net.inet.pim.stats", []_C_int{4, 2, 103, 1}}, {"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}}, {"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}}, {"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}}, @@ -191,6 +200,7 @@ var sysctlMib = []mibentry{ {"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}}, {"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}}, {"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}}, + {"net.inet.tcp.rootonly", []_C_int{4, 2, 6, 24}}, {"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}}, {"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}}, {"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}}, @@ -198,9 +208,12 @@ var sysctlMib = []mibentry{ {"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}}, {"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}}, {"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}}, + {"net.inet.tcp.synhashsize", []_C_int{4, 2, 6, 25}}, + {"net.inet.tcp.synuselimit", []_C_int{4, 2, 6, 23}}, {"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}}, {"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}}, {"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}}, + {"net.inet.udp.rootonly", []_C_int{4, 2, 17, 6}}, {"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}}, {"net.inet.udp.stats", []_C_int{4, 2, 17, 5}}, {"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}}, @@ -213,13 +226,8 @@ var sysctlMib = []mibentry{ {"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}}, {"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}}, {"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}}, - {"net.inet6.icmp6.nd6_prune", []_C_int{4, 24, 30, 6}}, {"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}}, - {"net.inet6.icmp6.nd6_useloopback", []_C_int{4, 24, 30, 11}}, - {"net.inet6.icmp6.nodeinfo", []_C_int{4, 24, 30, 13}}, - {"net.inet6.icmp6.rediraccept", []_C_int{4, 24, 30, 2}}, {"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}}, - {"net.inet6.ip6.accept_rtadv", []_C_int{4, 24, 17, 12}}, {"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}}, {"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}}, {"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}}, @@ -232,20 +240,19 @@ var sysctlMib = []mibentry{ {"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}}, {"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}}, {"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}}, - {"net.inet6.ip6.maxifdefrouters", []_C_int{4, 24, 17, 47}}, - {"net.inet6.ip6.maxifprefixes", []_C_int{4, 24, 17, 46}}, {"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}}, + {"net.inet6.ip6.mrtmfc", []_C_int{4, 24, 17, 53}}, + {"net.inet6.ip6.mrtmif", []_C_int{4, 24, 17, 52}}, {"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}}, {"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}}, {"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}}, {"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}}, {"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}}, {"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}}, - {"net.inet6.ip6.rr_prune", []_C_int{4, 24, 17, 22}}, + {"net.inet6.ip6.soiikey", []_C_int{4, 24, 17, 54}}, {"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}}, {"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}}, {"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}}, - {"net.inet6.ip6.v6only", []_C_int{4, 24, 17, 24}}, {"net.key.sadb_dump", []_C_int{4, 30, 1}}, {"net.key.spd_dump", []_C_int{4, 30, 2}}, {"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}}, @@ -254,12 +261,12 @@ var sysctlMib = []mibentry{ {"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}}, {"net.mpls.mapttl_ip", []_C_int{4, 33, 5}}, {"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}}, - {"net.mpls.maxloop_inkernel", []_C_int{4, 33, 4}}, {"net.mpls.ttl", []_C_int{4, 33, 2}}, {"net.pflow.stats", []_C_int{4, 34, 1}}, {"net.pipex.enable", []_C_int{4, 35, 1}}, {"vm.anonmin", []_C_int{2, 7}}, {"vm.loadavg", []_C_int{2, 2}}, + {"vm.malloc_conf", []_C_int{2, 12}}, {"vm.maxslp", []_C_int{2, 10}}, {"vm.nkmempages", []_C_int{2, 6}}, {"vm.psstrings", []_C_int{2, 3}}, diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go index 154b57ae3e2a..cbdda1a4ae24 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go @@ -36,6 +36,7 @@ var sysctlMib = []mibentry{ {"hw.pagesize", []_C_int{6, 7}}, {"hw.perfpolicy", []_C_int{6, 23}}, {"hw.physmem", []_C_int{6, 19}}, + {"hw.power", []_C_int{6, 26}}, {"hw.product", []_C_int{6, 15}}, {"hw.serialno", []_C_int{6, 17}}, {"hw.setperf", []_C_int{6, 13}}, @@ -44,6 +45,7 @@ var sysctlMib = []mibentry{ {"hw.uuid", []_C_int{6, 18}}, {"hw.vendor", []_C_int{6, 14}}, {"hw.version", []_C_int{6, 16}}, + {"kern.allowdt", []_C_int{1, 65}}, {"kern.allowkmem", []_C_int{1, 52}}, {"kern.argmax", []_C_int{1, 8}}, {"kern.audio", []_C_int{1, 84}}, @@ -51,6 +53,8 @@ var sysctlMib = []mibentry{ {"kern.bufcachepercent", []_C_int{1, 72}}, {"kern.ccpu", []_C_int{1, 45}}, {"kern.clockrate", []_C_int{1, 12}}, + {"kern.consbuf", []_C_int{1, 83}}, + {"kern.consbufsize", []_C_int{1, 82}}, {"kern.consdev", []_C_int{1, 75}}, {"kern.cp_time", []_C_int{1, 40}}, {"kern.cp_time2", []_C_int{1, 71}}, @@ -83,13 +87,13 @@ var sysctlMib = []mibentry{ {"kern.ngroups", []_C_int{1, 18}}, {"kern.nosuidcoredump", []_C_int{1, 32}}, {"kern.nprocs", []_C_int{1, 47}}, - {"kern.nselcoll", []_C_int{1, 43}}, {"kern.nthreads", []_C_int{1, 26}}, {"kern.numvnodes", []_C_int{1, 58}}, {"kern.osrelease", []_C_int{1, 2}}, {"kern.osrevision", []_C_int{1, 3}}, {"kern.ostype", []_C_int{1, 1}}, {"kern.osversion", []_C_int{1, 27}}, + {"kern.pfstatus", []_C_int{1, 86}}, {"kern.pool_debug", []_C_int{1, 77}}, {"kern.posix1version", []_C_int{1, 17}}, {"kern.proc", []_C_int{1, 66}}, @@ -110,13 +114,16 @@ var sysctlMib = []mibentry{ {"kern.timecounter.hardware", []_C_int{1, 69, 3}}, {"kern.timecounter.tick", []_C_int{1, 69, 1}}, {"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}}, + {"kern.timeout_stats", []_C_int{1, 87}}, {"kern.tty.tk_cancc", []_C_int{1, 44, 4}}, {"kern.tty.tk_nin", []_C_int{1, 44, 1}}, {"kern.tty.tk_nout", []_C_int{1, 44, 2}}, {"kern.tty.tk_rawcc", []_C_int{1, 44, 3}}, {"kern.tty.ttyinfo", []_C_int{1, 44, 5}}, {"kern.ttycount", []_C_int{1, 57}}, + {"kern.utc_offset", []_C_int{1, 88}}, {"kern.version", []_C_int{1, 4}}, + {"kern.video", []_C_int{1, 89}}, {"kern.watchdog.auto", []_C_int{1, 64, 2}}, {"kern.watchdog.period", []_C_int{1, 64, 1}}, {"kern.witnesswatch", []_C_int{1, 53}}, @@ -179,7 +186,6 @@ var sysctlMib = []mibentry{ {"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}}, {"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}}, {"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}}, - {"net.inet.mobileip.allow", []_C_int{4, 2, 55, 1}}, {"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}}, {"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}}, {"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}}, @@ -255,7 +261,6 @@ var sysctlMib = []mibentry{ {"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}}, {"net.mpls.mapttl_ip", []_C_int{4, 33, 5}}, {"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}}, - {"net.mpls.maxloop_inkernel", []_C_int{4, 33, 4}}, {"net.mpls.ttl", []_C_int{4, 33, 2}}, {"net.pflow.stats", []_C_int{4, 34, 1}}, {"net.pipex.enable", []_C_int{4, 35, 1}}, diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go index d96bb2ba4db6..f55eae1a8211 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go @@ -36,6 +36,7 @@ var sysctlMib = []mibentry{ {"hw.pagesize", []_C_int{6, 7}}, {"hw.perfpolicy", []_C_int{6, 23}}, {"hw.physmem", []_C_int{6, 19}}, + {"hw.power", []_C_int{6, 26}}, {"hw.product", []_C_int{6, 15}}, {"hw.serialno", []_C_int{6, 17}}, {"hw.setperf", []_C_int{6, 13}}, @@ -86,7 +87,6 @@ var sysctlMib = []mibentry{ {"kern.ngroups", []_C_int{1, 18}}, {"kern.nosuidcoredump", []_C_int{1, 32}}, {"kern.nprocs", []_C_int{1, 47}}, - {"kern.nselcoll", []_C_int{1, 43}}, {"kern.nthreads", []_C_int{1, 26}}, {"kern.numvnodes", []_C_int{1, 58}}, {"kern.osrelease", []_C_int{1, 2}}, @@ -123,6 +123,7 @@ var sysctlMib = []mibentry{ {"kern.ttycount", []_C_int{1, 57}}, {"kern.utc_offset", []_C_int{1, 88}}, {"kern.version", []_C_int{1, 4}}, + {"kern.video", []_C_int{1, 89}}, {"kern.watchdog.auto", []_C_int{1, 64, 2}}, {"kern.watchdog.period", []_C_int{1, 64, 1}}, {"kern.witnesswatch", []_C_int{1, 53}}, diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go new file mode 100644 index 000000000000..e44054470b7e --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go @@ -0,0 +1,281 @@ +// go run mksysctl_openbsd.go +// Code generated by the command above; DO NOT EDIT. + +//go:build ppc64 && openbsd +// +build ppc64,openbsd + +package unix + +type mibentry struct { + ctlname string + ctloid []_C_int +} + +var sysctlMib = []mibentry{ + {"ddb.console", []_C_int{9, 6}}, + {"ddb.log", []_C_int{9, 7}}, + {"ddb.max_line", []_C_int{9, 3}}, + {"ddb.max_width", []_C_int{9, 2}}, + {"ddb.panic", []_C_int{9, 5}}, + {"ddb.profile", []_C_int{9, 9}}, + {"ddb.radix", []_C_int{9, 1}}, + {"ddb.tab_stop_width", []_C_int{9, 4}}, + {"ddb.trigger", []_C_int{9, 8}}, + {"fs.posix.setuid", []_C_int{3, 1, 1}}, + {"hw.allowpowerdown", []_C_int{6, 22}}, + {"hw.byteorder", []_C_int{6, 4}}, + {"hw.cpuspeed", []_C_int{6, 12}}, + {"hw.diskcount", []_C_int{6, 10}}, + {"hw.disknames", []_C_int{6, 8}}, + {"hw.diskstats", []_C_int{6, 9}}, + {"hw.machine", []_C_int{6, 1}}, + {"hw.model", []_C_int{6, 2}}, + {"hw.ncpu", []_C_int{6, 3}}, + {"hw.ncpufound", []_C_int{6, 21}}, + {"hw.ncpuonline", []_C_int{6, 25}}, + {"hw.pagesize", []_C_int{6, 7}}, + {"hw.perfpolicy", []_C_int{6, 23}}, + {"hw.physmem", []_C_int{6, 19}}, + {"hw.power", []_C_int{6, 26}}, + {"hw.product", []_C_int{6, 15}}, + {"hw.serialno", []_C_int{6, 17}}, + {"hw.setperf", []_C_int{6, 13}}, + {"hw.smt", []_C_int{6, 24}}, + {"hw.usermem", []_C_int{6, 20}}, + {"hw.uuid", []_C_int{6, 18}}, + {"hw.vendor", []_C_int{6, 14}}, + {"hw.version", []_C_int{6, 16}}, + {"kern.allowdt", []_C_int{1, 65}}, + {"kern.allowkmem", []_C_int{1, 52}}, + {"kern.argmax", []_C_int{1, 8}}, + {"kern.audio", []_C_int{1, 84}}, + {"kern.boottime", []_C_int{1, 21}}, + {"kern.bufcachepercent", []_C_int{1, 72}}, + {"kern.ccpu", []_C_int{1, 45}}, + {"kern.clockrate", []_C_int{1, 12}}, + {"kern.consbuf", []_C_int{1, 83}}, + {"kern.consbufsize", []_C_int{1, 82}}, + {"kern.consdev", []_C_int{1, 75}}, + {"kern.cp_time", []_C_int{1, 40}}, + {"kern.cp_time2", []_C_int{1, 71}}, + {"kern.cpustats", []_C_int{1, 85}}, + {"kern.domainname", []_C_int{1, 22}}, + {"kern.file", []_C_int{1, 73}}, + {"kern.forkstat", []_C_int{1, 42}}, + {"kern.fscale", []_C_int{1, 46}}, + {"kern.fsync", []_C_int{1, 33}}, + {"kern.global_ptrace", []_C_int{1, 81}}, + {"kern.hostid", []_C_int{1, 11}}, + {"kern.hostname", []_C_int{1, 10}}, + {"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}}, + {"kern.job_control", []_C_int{1, 19}}, + {"kern.malloc.buckets", []_C_int{1, 39, 1}}, + {"kern.malloc.kmemnames", []_C_int{1, 39, 3}}, + {"kern.maxclusters", []_C_int{1, 67}}, + {"kern.maxfiles", []_C_int{1, 7}}, + {"kern.maxlocksperuid", []_C_int{1, 70}}, + {"kern.maxpartitions", []_C_int{1, 23}}, + {"kern.maxproc", []_C_int{1, 6}}, + {"kern.maxthread", []_C_int{1, 25}}, + {"kern.maxvnodes", []_C_int{1, 5}}, + {"kern.mbstat", []_C_int{1, 59}}, + {"kern.msgbuf", []_C_int{1, 48}}, + {"kern.msgbufsize", []_C_int{1, 38}}, + {"kern.nchstats", []_C_int{1, 41}}, + {"kern.netlivelocks", []_C_int{1, 76}}, + {"kern.nfiles", []_C_int{1, 56}}, + {"kern.ngroups", []_C_int{1, 18}}, + {"kern.nosuidcoredump", []_C_int{1, 32}}, + {"kern.nprocs", []_C_int{1, 47}}, + {"kern.nthreads", []_C_int{1, 26}}, + {"kern.numvnodes", []_C_int{1, 58}}, + {"kern.osrelease", []_C_int{1, 2}}, + {"kern.osrevision", []_C_int{1, 3}}, + {"kern.ostype", []_C_int{1, 1}}, + {"kern.osversion", []_C_int{1, 27}}, + {"kern.pfstatus", []_C_int{1, 86}}, + {"kern.pool_debug", []_C_int{1, 77}}, + {"kern.posix1version", []_C_int{1, 17}}, + {"kern.proc", []_C_int{1, 66}}, + {"kern.rawpartition", []_C_int{1, 24}}, + {"kern.saved_ids", []_C_int{1, 20}}, + {"kern.securelevel", []_C_int{1, 9}}, + {"kern.seminfo", []_C_int{1, 61}}, + {"kern.shminfo", []_C_int{1, 62}}, + {"kern.somaxconn", []_C_int{1, 28}}, + {"kern.sominconn", []_C_int{1, 29}}, + {"kern.splassert", []_C_int{1, 54}}, + {"kern.stackgap_random", []_C_int{1, 50}}, + {"kern.sysvipc_info", []_C_int{1, 51}}, + {"kern.sysvmsg", []_C_int{1, 34}}, + {"kern.sysvsem", []_C_int{1, 35}}, + {"kern.sysvshm", []_C_int{1, 36}}, + {"kern.timecounter.choice", []_C_int{1, 69, 4}}, + {"kern.timecounter.hardware", []_C_int{1, 69, 3}}, + {"kern.timecounter.tick", []_C_int{1, 69, 1}}, + {"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}}, + {"kern.timeout_stats", []_C_int{1, 87}}, + {"kern.tty.tk_cancc", []_C_int{1, 44, 4}}, + {"kern.tty.tk_nin", []_C_int{1, 44, 1}}, + {"kern.tty.tk_nout", []_C_int{1, 44, 2}}, + {"kern.tty.tk_rawcc", []_C_int{1, 44, 3}}, + {"kern.tty.ttyinfo", []_C_int{1, 44, 5}}, + {"kern.ttycount", []_C_int{1, 57}}, + {"kern.utc_offset", []_C_int{1, 88}}, + {"kern.version", []_C_int{1, 4}}, + {"kern.video", []_C_int{1, 89}}, + {"kern.watchdog.auto", []_C_int{1, 64, 2}}, + {"kern.watchdog.period", []_C_int{1, 64, 1}}, + {"kern.witnesswatch", []_C_int{1, 53}}, + {"kern.wxabort", []_C_int{1, 74}}, + {"net.bpf.bufsize", []_C_int{4, 31, 1}}, + {"net.bpf.maxbufsize", []_C_int{4, 31, 2}}, + {"net.inet.ah.enable", []_C_int{4, 2, 51, 1}}, + {"net.inet.ah.stats", []_C_int{4, 2, 51, 2}}, + {"net.inet.carp.allow", []_C_int{4, 2, 112, 1}}, + {"net.inet.carp.log", []_C_int{4, 2, 112, 3}}, + {"net.inet.carp.preempt", []_C_int{4, 2, 112, 2}}, + {"net.inet.carp.stats", []_C_int{4, 2, 112, 4}}, + {"net.inet.divert.recvspace", []_C_int{4, 2, 258, 1}}, + {"net.inet.divert.sendspace", []_C_int{4, 2, 258, 2}}, + {"net.inet.divert.stats", []_C_int{4, 2, 258, 3}}, + {"net.inet.esp.enable", []_C_int{4, 2, 50, 1}}, + {"net.inet.esp.stats", []_C_int{4, 2, 50, 4}}, + {"net.inet.esp.udpencap", []_C_int{4, 2, 50, 2}}, + {"net.inet.esp.udpencap_port", []_C_int{4, 2, 50, 3}}, + {"net.inet.etherip.allow", []_C_int{4, 2, 97, 1}}, + {"net.inet.etherip.stats", []_C_int{4, 2, 97, 2}}, + {"net.inet.gre.allow", []_C_int{4, 2, 47, 1}}, + {"net.inet.gre.wccp", []_C_int{4, 2, 47, 2}}, + {"net.inet.icmp.bmcastecho", []_C_int{4, 2, 1, 2}}, + {"net.inet.icmp.errppslimit", []_C_int{4, 2, 1, 3}}, + {"net.inet.icmp.maskrepl", []_C_int{4, 2, 1, 1}}, + {"net.inet.icmp.rediraccept", []_C_int{4, 2, 1, 4}}, + {"net.inet.icmp.redirtimeout", []_C_int{4, 2, 1, 5}}, + {"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}}, + {"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}}, + {"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}}, + {"net.inet.ip.arpdown", []_C_int{4, 2, 0, 40}}, + {"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}}, + {"net.inet.ip.arptimeout", []_C_int{4, 2, 0, 39}}, + {"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}}, + {"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}}, + {"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}}, + {"net.inet.ip.ifq.drops", []_C_int{4, 2, 0, 30, 3}}, + {"net.inet.ip.ifq.len", []_C_int{4, 2, 0, 30, 1}}, + {"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}}, + {"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}}, + {"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}}, + {"net.inet.ip.mrtmfc", []_C_int{4, 2, 0, 37}}, + {"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}}, + {"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}}, + {"net.inet.ip.mrtvif", []_C_int{4, 2, 0, 38}}, + {"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}}, + {"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}}, + {"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}}, + {"net.inet.ip.multipath", []_C_int{4, 2, 0, 32}}, + {"net.inet.ip.portfirst", []_C_int{4, 2, 0, 7}}, + {"net.inet.ip.porthifirst", []_C_int{4, 2, 0, 9}}, + {"net.inet.ip.porthilast", []_C_int{4, 2, 0, 10}}, + {"net.inet.ip.portlast", []_C_int{4, 2, 0, 8}}, + {"net.inet.ip.redirect", []_C_int{4, 2, 0, 2}}, + {"net.inet.ip.sourceroute", []_C_int{4, 2, 0, 5}}, + {"net.inet.ip.stats", []_C_int{4, 2, 0, 33}}, + {"net.inet.ip.ttl", []_C_int{4, 2, 0, 3}}, + {"net.inet.ipcomp.enable", []_C_int{4, 2, 108, 1}}, + {"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}}, + {"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}}, + {"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}}, + {"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}}, + {"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}}, + {"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}}, + {"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}}, + {"net.inet.tcp.drop", []_C_int{4, 2, 6, 19}}, + {"net.inet.tcp.ecn", []_C_int{4, 2, 6, 14}}, + {"net.inet.tcp.ident", []_C_int{4, 2, 6, 9}}, + {"net.inet.tcp.keepidle", []_C_int{4, 2, 6, 3}}, + {"net.inet.tcp.keepinittime", []_C_int{4, 2, 6, 2}}, + {"net.inet.tcp.keepintvl", []_C_int{4, 2, 6, 4}}, + {"net.inet.tcp.mssdflt", []_C_int{4, 2, 6, 11}}, + {"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}}, + {"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}}, + {"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}}, + {"net.inet.tcp.rootonly", []_C_int{4, 2, 6, 24}}, + {"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}}, + {"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}}, + {"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}}, + {"net.inet.tcp.slowhz", []_C_int{4, 2, 6, 5}}, + {"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}}, + {"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}}, + {"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}}, + {"net.inet.tcp.synhashsize", []_C_int{4, 2, 6, 25}}, + {"net.inet.tcp.synuselimit", []_C_int{4, 2, 6, 23}}, + {"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}}, + {"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}}, + {"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}}, + {"net.inet.udp.rootonly", []_C_int{4, 2, 17, 6}}, + {"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}}, + {"net.inet.udp.stats", []_C_int{4, 2, 17, 5}}, + {"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}}, + {"net.inet6.divert.sendspace", []_C_int{4, 24, 86, 2}}, + {"net.inet6.divert.stats", []_C_int{4, 24, 86, 3}}, + {"net.inet6.icmp6.errppslimit", []_C_int{4, 24, 30, 14}}, + {"net.inet6.icmp6.mtudisc_hiwat", []_C_int{4, 24, 30, 16}}, + {"net.inet6.icmp6.mtudisc_lowat", []_C_int{4, 24, 30, 17}}, + {"net.inet6.icmp6.nd6_debug", []_C_int{4, 24, 30, 18}}, + {"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}}, + {"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}}, + {"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}}, + {"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}}, + {"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}}, + {"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}}, + {"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}}, + {"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}}, + {"net.inet6.ip6.defmcasthlim", []_C_int{4, 24, 17, 18}}, + {"net.inet6.ip6.forwarding", []_C_int{4, 24, 17, 1}}, + {"net.inet6.ip6.forwsrcrt", []_C_int{4, 24, 17, 5}}, + {"net.inet6.ip6.hdrnestlimit", []_C_int{4, 24, 17, 15}}, + {"net.inet6.ip6.hlim", []_C_int{4, 24, 17, 3}}, + {"net.inet6.ip6.log_interval", []_C_int{4, 24, 17, 14}}, + {"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}}, + {"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}}, + {"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}}, + {"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}}, + {"net.inet6.ip6.mrtmfc", []_C_int{4, 24, 17, 53}}, + {"net.inet6.ip6.mrtmif", []_C_int{4, 24, 17, 52}}, + {"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}}, + {"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}}, + {"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}}, + {"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}}, + {"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}}, + {"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}}, + {"net.inet6.ip6.soiikey", []_C_int{4, 24, 17, 54}}, + {"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}}, + {"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}}, + {"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}}, + {"net.key.sadb_dump", []_C_int{4, 30, 1}}, + {"net.key.spd_dump", []_C_int{4, 30, 2}}, + {"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}}, + {"net.mpls.ifq.drops", []_C_int{4, 33, 3, 3}}, + {"net.mpls.ifq.len", []_C_int{4, 33, 3, 1}}, + {"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}}, + {"net.mpls.mapttl_ip", []_C_int{4, 33, 5}}, + {"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}}, + {"net.mpls.ttl", []_C_int{4, 33, 2}}, + {"net.pflow.stats", []_C_int{4, 34, 1}}, + {"net.pipex.enable", []_C_int{4, 35, 1}}, + {"vm.anonmin", []_C_int{2, 7}}, + {"vm.loadavg", []_C_int{2, 2}}, + {"vm.malloc_conf", []_C_int{2, 12}}, + {"vm.maxslp", []_C_int{2, 10}}, + {"vm.nkmempages", []_C_int{2, 6}}, + {"vm.psstrings", []_C_int{2, 3}}, + {"vm.swapencrypt.enable", []_C_int{2, 5, 0}}, + {"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}}, + {"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}}, + {"vm.uspace", []_C_int{2, 11}}, + {"vm.uvmexp", []_C_int{2, 4}}, + {"vm.vmmeter", []_C_int{2, 1}}, + {"vm.vnodemin", []_C_int{2, 9}}, + {"vm.vtextmin", []_C_int{2, 8}}, +} diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go new file mode 100644 index 000000000000..a0db82fce206 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go @@ -0,0 +1,282 @@ +// go run mksysctl_openbsd.go +// Code generated by the command above; DO NOT EDIT. + +//go:build riscv64 && openbsd +// +build riscv64,openbsd + +package unix + +type mibentry struct { + ctlname string + ctloid []_C_int +} + +var sysctlMib = []mibentry{ + {"ddb.console", []_C_int{9, 6}}, + {"ddb.log", []_C_int{9, 7}}, + {"ddb.max_line", []_C_int{9, 3}}, + {"ddb.max_width", []_C_int{9, 2}}, + {"ddb.panic", []_C_int{9, 5}}, + {"ddb.profile", []_C_int{9, 9}}, + {"ddb.radix", []_C_int{9, 1}}, + {"ddb.tab_stop_width", []_C_int{9, 4}}, + {"ddb.trigger", []_C_int{9, 8}}, + {"fs.posix.setuid", []_C_int{3, 1, 1}}, + {"hw.allowpowerdown", []_C_int{6, 22}}, + {"hw.byteorder", []_C_int{6, 4}}, + {"hw.cpuspeed", []_C_int{6, 12}}, + {"hw.diskcount", []_C_int{6, 10}}, + {"hw.disknames", []_C_int{6, 8}}, + {"hw.diskstats", []_C_int{6, 9}}, + {"hw.machine", []_C_int{6, 1}}, + {"hw.model", []_C_int{6, 2}}, + {"hw.ncpu", []_C_int{6, 3}}, + {"hw.ncpufound", []_C_int{6, 21}}, + {"hw.ncpuonline", []_C_int{6, 25}}, + {"hw.pagesize", []_C_int{6, 7}}, + {"hw.perfpolicy", []_C_int{6, 23}}, + {"hw.physmem", []_C_int{6, 19}}, + {"hw.power", []_C_int{6, 26}}, + {"hw.product", []_C_int{6, 15}}, + {"hw.serialno", []_C_int{6, 17}}, + {"hw.setperf", []_C_int{6, 13}}, + {"hw.smt", []_C_int{6, 24}}, + {"hw.usermem", []_C_int{6, 20}}, + {"hw.uuid", []_C_int{6, 18}}, + {"hw.vendor", []_C_int{6, 14}}, + {"hw.version", []_C_int{6, 16}}, + {"kern.allowdt", []_C_int{1, 65}}, + {"kern.allowkmem", []_C_int{1, 52}}, + {"kern.argmax", []_C_int{1, 8}}, + {"kern.audio", []_C_int{1, 84}}, + {"kern.boottime", []_C_int{1, 21}}, + {"kern.bufcachepercent", []_C_int{1, 72}}, + {"kern.ccpu", []_C_int{1, 45}}, + {"kern.clockrate", []_C_int{1, 12}}, + {"kern.consbuf", []_C_int{1, 83}}, + {"kern.consbufsize", []_C_int{1, 82}}, + {"kern.consdev", []_C_int{1, 75}}, + {"kern.cp_time", []_C_int{1, 40}}, + {"kern.cp_time2", []_C_int{1, 71}}, + {"kern.cpustats", []_C_int{1, 85}}, + {"kern.domainname", []_C_int{1, 22}}, + {"kern.file", []_C_int{1, 73}}, + {"kern.forkstat", []_C_int{1, 42}}, + {"kern.fscale", []_C_int{1, 46}}, + {"kern.fsync", []_C_int{1, 33}}, + {"kern.global_ptrace", []_C_int{1, 81}}, + {"kern.hostid", []_C_int{1, 11}}, + {"kern.hostname", []_C_int{1, 10}}, + {"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}}, + {"kern.job_control", []_C_int{1, 19}}, + {"kern.malloc.buckets", []_C_int{1, 39, 1}}, + {"kern.malloc.kmemnames", []_C_int{1, 39, 3}}, + {"kern.maxclusters", []_C_int{1, 67}}, + {"kern.maxfiles", []_C_int{1, 7}}, + {"kern.maxlocksperuid", []_C_int{1, 70}}, + {"kern.maxpartitions", []_C_int{1, 23}}, + {"kern.maxproc", []_C_int{1, 6}}, + {"kern.maxthread", []_C_int{1, 25}}, + {"kern.maxvnodes", []_C_int{1, 5}}, + {"kern.mbstat", []_C_int{1, 59}}, + {"kern.msgbuf", []_C_int{1, 48}}, + {"kern.msgbufsize", []_C_int{1, 38}}, + {"kern.nchstats", []_C_int{1, 41}}, + {"kern.netlivelocks", []_C_int{1, 76}}, + {"kern.nfiles", []_C_int{1, 56}}, + {"kern.ngroups", []_C_int{1, 18}}, + {"kern.nosuidcoredump", []_C_int{1, 32}}, + {"kern.nprocs", []_C_int{1, 47}}, + {"kern.nselcoll", []_C_int{1, 43}}, + {"kern.nthreads", []_C_int{1, 26}}, + {"kern.numvnodes", []_C_int{1, 58}}, + {"kern.osrelease", []_C_int{1, 2}}, + {"kern.osrevision", []_C_int{1, 3}}, + {"kern.ostype", []_C_int{1, 1}}, + {"kern.osversion", []_C_int{1, 27}}, + {"kern.pfstatus", []_C_int{1, 86}}, + {"kern.pool_debug", []_C_int{1, 77}}, + {"kern.posix1version", []_C_int{1, 17}}, + {"kern.proc", []_C_int{1, 66}}, + {"kern.rawpartition", []_C_int{1, 24}}, + {"kern.saved_ids", []_C_int{1, 20}}, + {"kern.securelevel", []_C_int{1, 9}}, + {"kern.seminfo", []_C_int{1, 61}}, + {"kern.shminfo", []_C_int{1, 62}}, + {"kern.somaxconn", []_C_int{1, 28}}, + {"kern.sominconn", []_C_int{1, 29}}, + {"kern.splassert", []_C_int{1, 54}}, + {"kern.stackgap_random", []_C_int{1, 50}}, + {"kern.sysvipc_info", []_C_int{1, 51}}, + {"kern.sysvmsg", []_C_int{1, 34}}, + {"kern.sysvsem", []_C_int{1, 35}}, + {"kern.sysvshm", []_C_int{1, 36}}, + {"kern.timecounter.choice", []_C_int{1, 69, 4}}, + {"kern.timecounter.hardware", []_C_int{1, 69, 3}}, + {"kern.timecounter.tick", []_C_int{1, 69, 1}}, + {"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}}, + {"kern.timeout_stats", []_C_int{1, 87}}, + {"kern.tty.tk_cancc", []_C_int{1, 44, 4}}, + {"kern.tty.tk_nin", []_C_int{1, 44, 1}}, + {"kern.tty.tk_nout", []_C_int{1, 44, 2}}, + {"kern.tty.tk_rawcc", []_C_int{1, 44, 3}}, + {"kern.tty.ttyinfo", []_C_int{1, 44, 5}}, + {"kern.ttycount", []_C_int{1, 57}}, + {"kern.utc_offset", []_C_int{1, 88}}, + {"kern.version", []_C_int{1, 4}}, + {"kern.video", []_C_int{1, 89}}, + {"kern.watchdog.auto", []_C_int{1, 64, 2}}, + {"kern.watchdog.period", []_C_int{1, 64, 1}}, + {"kern.witnesswatch", []_C_int{1, 53}}, + {"kern.wxabort", []_C_int{1, 74}}, + {"net.bpf.bufsize", []_C_int{4, 31, 1}}, + {"net.bpf.maxbufsize", []_C_int{4, 31, 2}}, + {"net.inet.ah.enable", []_C_int{4, 2, 51, 1}}, + {"net.inet.ah.stats", []_C_int{4, 2, 51, 2}}, + {"net.inet.carp.allow", []_C_int{4, 2, 112, 1}}, + {"net.inet.carp.log", []_C_int{4, 2, 112, 3}}, + {"net.inet.carp.preempt", []_C_int{4, 2, 112, 2}}, + {"net.inet.carp.stats", []_C_int{4, 2, 112, 4}}, + {"net.inet.divert.recvspace", []_C_int{4, 2, 258, 1}}, + {"net.inet.divert.sendspace", []_C_int{4, 2, 258, 2}}, + {"net.inet.divert.stats", []_C_int{4, 2, 258, 3}}, + {"net.inet.esp.enable", []_C_int{4, 2, 50, 1}}, + {"net.inet.esp.stats", []_C_int{4, 2, 50, 4}}, + {"net.inet.esp.udpencap", []_C_int{4, 2, 50, 2}}, + {"net.inet.esp.udpencap_port", []_C_int{4, 2, 50, 3}}, + {"net.inet.etherip.allow", []_C_int{4, 2, 97, 1}}, + {"net.inet.etherip.stats", []_C_int{4, 2, 97, 2}}, + {"net.inet.gre.allow", []_C_int{4, 2, 47, 1}}, + {"net.inet.gre.wccp", []_C_int{4, 2, 47, 2}}, + {"net.inet.icmp.bmcastecho", []_C_int{4, 2, 1, 2}}, + {"net.inet.icmp.errppslimit", []_C_int{4, 2, 1, 3}}, + {"net.inet.icmp.maskrepl", []_C_int{4, 2, 1, 1}}, + {"net.inet.icmp.rediraccept", []_C_int{4, 2, 1, 4}}, + {"net.inet.icmp.redirtimeout", []_C_int{4, 2, 1, 5}}, + {"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}}, + {"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}}, + {"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}}, + {"net.inet.ip.arpdown", []_C_int{4, 2, 0, 40}}, + {"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}}, + {"net.inet.ip.arptimeout", []_C_int{4, 2, 0, 39}}, + {"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}}, + {"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}}, + {"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}}, + {"net.inet.ip.ifq.drops", []_C_int{4, 2, 0, 30, 3}}, + {"net.inet.ip.ifq.len", []_C_int{4, 2, 0, 30, 1}}, + {"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}}, + {"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}}, + {"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}}, + {"net.inet.ip.mrtmfc", []_C_int{4, 2, 0, 37}}, + {"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}}, + {"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}}, + {"net.inet.ip.mrtvif", []_C_int{4, 2, 0, 38}}, + {"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}}, + {"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}}, + {"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}}, + {"net.inet.ip.multipath", []_C_int{4, 2, 0, 32}}, + {"net.inet.ip.portfirst", []_C_int{4, 2, 0, 7}}, + {"net.inet.ip.porthifirst", []_C_int{4, 2, 0, 9}}, + {"net.inet.ip.porthilast", []_C_int{4, 2, 0, 10}}, + {"net.inet.ip.portlast", []_C_int{4, 2, 0, 8}}, + {"net.inet.ip.redirect", []_C_int{4, 2, 0, 2}}, + {"net.inet.ip.sourceroute", []_C_int{4, 2, 0, 5}}, + {"net.inet.ip.stats", []_C_int{4, 2, 0, 33}}, + {"net.inet.ip.ttl", []_C_int{4, 2, 0, 3}}, + {"net.inet.ipcomp.enable", []_C_int{4, 2, 108, 1}}, + {"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}}, + {"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}}, + {"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}}, + {"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}}, + {"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}}, + {"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}}, + {"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}}, + {"net.inet.tcp.drop", []_C_int{4, 2, 6, 19}}, + {"net.inet.tcp.ecn", []_C_int{4, 2, 6, 14}}, + {"net.inet.tcp.ident", []_C_int{4, 2, 6, 9}}, + {"net.inet.tcp.keepidle", []_C_int{4, 2, 6, 3}}, + {"net.inet.tcp.keepinittime", []_C_int{4, 2, 6, 2}}, + {"net.inet.tcp.keepintvl", []_C_int{4, 2, 6, 4}}, + {"net.inet.tcp.mssdflt", []_C_int{4, 2, 6, 11}}, + {"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}}, + {"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}}, + {"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}}, + {"net.inet.tcp.rootonly", []_C_int{4, 2, 6, 24}}, + {"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}}, + {"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}}, + {"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}}, + {"net.inet.tcp.slowhz", []_C_int{4, 2, 6, 5}}, + {"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}}, + {"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}}, + {"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}}, + {"net.inet.tcp.synhashsize", []_C_int{4, 2, 6, 25}}, + {"net.inet.tcp.synuselimit", []_C_int{4, 2, 6, 23}}, + {"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}}, + {"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}}, + {"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}}, + {"net.inet.udp.rootonly", []_C_int{4, 2, 17, 6}}, + {"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}}, + {"net.inet.udp.stats", []_C_int{4, 2, 17, 5}}, + {"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}}, + {"net.inet6.divert.sendspace", []_C_int{4, 24, 86, 2}}, + {"net.inet6.divert.stats", []_C_int{4, 24, 86, 3}}, + {"net.inet6.icmp6.errppslimit", []_C_int{4, 24, 30, 14}}, + {"net.inet6.icmp6.mtudisc_hiwat", []_C_int{4, 24, 30, 16}}, + {"net.inet6.icmp6.mtudisc_lowat", []_C_int{4, 24, 30, 17}}, + {"net.inet6.icmp6.nd6_debug", []_C_int{4, 24, 30, 18}}, + {"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}}, + {"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}}, + {"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}}, + {"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}}, + {"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}}, + {"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}}, + {"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}}, + {"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}}, + {"net.inet6.ip6.defmcasthlim", []_C_int{4, 24, 17, 18}}, + {"net.inet6.ip6.forwarding", []_C_int{4, 24, 17, 1}}, + {"net.inet6.ip6.forwsrcrt", []_C_int{4, 24, 17, 5}}, + {"net.inet6.ip6.hdrnestlimit", []_C_int{4, 24, 17, 15}}, + {"net.inet6.ip6.hlim", []_C_int{4, 24, 17, 3}}, + {"net.inet6.ip6.log_interval", []_C_int{4, 24, 17, 14}}, + {"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}}, + {"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}}, + {"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}}, + {"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}}, + {"net.inet6.ip6.mrtmfc", []_C_int{4, 24, 17, 53}}, + {"net.inet6.ip6.mrtmif", []_C_int{4, 24, 17, 52}}, + {"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}}, + {"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}}, + {"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}}, + {"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}}, + {"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}}, + {"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}}, + {"net.inet6.ip6.soiikey", []_C_int{4, 24, 17, 54}}, + {"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}}, + {"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}}, + {"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}}, + {"net.key.sadb_dump", []_C_int{4, 30, 1}}, + {"net.key.spd_dump", []_C_int{4, 30, 2}}, + {"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}}, + {"net.mpls.ifq.drops", []_C_int{4, 33, 3, 3}}, + {"net.mpls.ifq.len", []_C_int{4, 33, 3, 1}}, + {"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}}, + {"net.mpls.mapttl_ip", []_C_int{4, 33, 5}}, + {"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}}, + {"net.mpls.ttl", []_C_int{4, 33, 2}}, + {"net.pflow.stats", []_C_int{4, 34, 1}}, + {"net.pipex.enable", []_C_int{4, 35, 1}}, + {"vm.anonmin", []_C_int{2, 7}}, + {"vm.loadavg", []_C_int{2, 2}}, + {"vm.malloc_conf", []_C_int{2, 12}}, + {"vm.maxslp", []_C_int{2, 10}}, + {"vm.nkmempages", []_C_int{2, 6}}, + {"vm.psstrings", []_C_int{2, 3}}, + {"vm.swapencrypt.enable", []_C_int{2, 5, 0}}, + {"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}}, + {"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}}, + {"vm.uspace", []_C_int{2, 11}}, + {"vm.uvmexp", []_C_int{2, 4}}, + {"vm.vmmeter", []_C_int{2, 1}}, + {"vm.vnodemin", []_C_int{2, 9}}, + {"vm.vtextmin", []_C_int{2, 8}}, +} diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go index 59d5dfc20922..4e0d96107b9e 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go @@ -1,4 +1,4 @@ -// go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master +// go run mksysnum.go https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12 // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && freebsd @@ -19,10 +19,9 @@ const ( SYS_UNLINK = 10 // { int unlink(char *path); } SYS_CHDIR = 12 // { int chdir(char *path); } SYS_FCHDIR = 13 // { int fchdir(int fd); } - SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } SYS_CHMOD = 15 // { int chmod(char *path, int mode); } SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } - SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int + SYS_BREAK = 17 // { caddr_t break(char *nsize); } SYS_GETPID = 20 // { pid_t getpid(void); } SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } @@ -43,7 +42,6 @@ const ( SYS_KILL = 37 // { int kill(int pid, int signum); } SYS_GETPPID = 39 // { pid_t getppid(void); } SYS_DUP = 41 // { int dup(u_int fd); } - SYS_PIPE = 42 // { int pipe(void); } SYS_GETEGID = 43 // { gid_t getegid(void); } SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); } SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } @@ -58,15 +56,14 @@ const ( SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, size_t count); } SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } - SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int + SYS_UMASK = 60 // { int umask(int newmask); } SYS_CHROOT = 61 // { int chroot(char *path); } SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } SYS_VFORK = 66 // { int vfork(void); } SYS_SBRK = 69 // { int sbrk(int incr); } SYS_SSTK = 70 // { int sstk(int incr); } - SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise ovadvise_args int SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, int prot); } + SYS_MPROTECT = 74 // { int mprotect(void *addr, size_t len, int prot); } SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } @@ -124,14 +121,10 @@ const ( SYS_SETGID = 181 // { int setgid(gid_t gid); } SYS_SETEGID = 182 // { int setegid(gid_t egid); } SYS_SETEUID = 183 // { int seteuid(uid_t euid); } - SYS_STAT = 188 // { int stat(char *path, struct stat *ub); } - SYS_FSTAT = 189 // { int fstat(int fd, struct stat *sb); } - SYS_LSTAT = 190 // { int lstat(char *path, struct stat *ub); } SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int - SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } @@ -143,12 +136,12 @@ const ( SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, size_t nsops); } SYS_MSGGET = 225 // { int msgget(key_t key, int msgflg); } SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } + SYS_MSGRCV = 227 // { ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, int shmflg); } SYS_SHMDT = 230 // { int shmdt(const void *shmaddr); } SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, int shmflg); } SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, struct timespec *tp); } - SYS_CLOCK_SETTIME = 233 // { int clock_settime( clockid_t clock_id, const struct timespec *tp); } + SYS_CLOCK_SETTIME = 233 // { int clock_settime(clockid_t clock_id, const struct timespec *tp); } SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, struct timespec *tp); } SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, struct sigevent *evp, int *timerid); } SYS_KTIMER_DELETE = 236 // { int ktimer_delete(int timerid); } @@ -157,50 +150,44 @@ const ( SYS_KTIMER_GETOVERRUN = 239 // { int ktimer_getoverrun(int timerid); } SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); } - SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( struct ffclock_estimate *cest); } - SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( struct ffclock_estimate *cest); } + SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate(struct ffclock_estimate *cest); } + SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate(struct ffclock_estimate *cest); } SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); } - SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,int which, clockid_t *clock_id); } + SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id, int which, clockid_t *clock_id); } SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); } SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } SYS_RFORK = 251 // { int rfork(int flags); } - SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, u_int nfds, int timeout); } SYS_ISSETUGID = 253 // { int issetugid(void); } SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } SYS_AIO_READ = 255 // { int aio_read(struct aiocb *aiocbp); } SYS_AIO_WRITE = 256 // { int aio_write(struct aiocb *aiocbp); } - SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb * const *acb_list, int nent, struct sigevent *sig); } - SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, size_t count); } + SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb* const *acb_list, int nent, struct sigevent *sig); } SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); } - SYS_NSTAT = 278 // { int nstat(char *path, struct nstat *ub); } - SYS_NFSTAT = 279 // { int nfstat(int fd, struct nstat *sb); } - SYS_NLSTAT = 280 // { int nlstat(char *path, struct nstat *ub); } SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); } - SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } SYS_MODNEXT = 300 // { int modnext(int modid); } - SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat *stat); } + SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat* stat); } SYS_MODFNEXT = 302 // { int modfnext(int modid); } SYS_MODFIND = 303 // { int modfind(const char *name); } SYS_KLDLOAD = 304 // { int kldload(const char *file); } SYS_KLDUNLOAD = 305 // { int kldunload(int fileid); } SYS_KLDFIND = 306 // { int kldfind(const char *file); } SYS_KLDNEXT = 307 // { int kldnext(int fileid); } - SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat* stat); } + SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat *stat); } SYS_KLDFIRSTMOD = 309 // { int kldfirstmod(int fileid); } SYS_GETSID = 310 // { int getsid(pid_t pid); } SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); } SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); } SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); } - SYS_AIO_SUSPEND = 315 // { int aio_suspend( struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } + SYS_AIO_SUSPEND = 315 // { int aio_suspend(struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); } SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); } SYS_YIELD = 321 // { int yield(void); } SYS_MLOCKALL = 324 // { int mlockall(int how); } SYS_MUNLOCKALL = 325 // { int munlockall(void); } - SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); } + SYS___GETCWD = 326 // { int __getcwd(char *buf, size_t buflen); } SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, const struct sched_param *param); } SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct sched_param *param); } SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); } @@ -226,14 +213,13 @@ const ( SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, acl_type_t type, struct acl *aclp); } SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, acl_type_t type, struct acl *aclp); } SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } - SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } - SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } + SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete(struct aiocb **aiocbp, struct timespec *timeout); } SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } SYS_KQUEUE = 362 // { int kqueue(void); } - SYS_KEVENT = 363 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, int attrnamespace, const char *attrname); } @@ -251,10 +237,6 @@ const ( SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); } - SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } - SYS_STATFS = 396 // { int statfs(char *path, struct statfs *buf); } - SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); } - SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } SYS_KSEM_CLOSE = 400 // { int ksem_close(semid_t id); } SYS_KSEM_POST = 401 // { int ksem_post(semid_t id); } SYS_KSEM_WAIT = 402 // { int ksem_wait(semid_t id); } @@ -267,14 +249,14 @@ const ( SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, struct mac *mac_p); } SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, struct mac *mac_p); } SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, struct mac *mac_p); } - SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( const char *path, int attrnamespace, const char *attrname); } + SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link(const char *path, int attrnamespace, const char *attrname); } SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, char **envv, struct mac *mac_p); } SYS_SIGACTION = 416 // { int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); } - SYS_SIGRETURN = 417 // { int sigreturn( const struct __ucontext *sigcntxp); } + SYS_SIGRETURN = 417 // { int sigreturn(const struct __ucontext *sigcntxp); } SYS_GETCONTEXT = 421 // { int getcontext(struct __ucontext *ucp); } - SYS_SETCONTEXT = 422 // { int setcontext( const struct __ucontext *ucp); } + SYS_SETCONTEXT = 422 // { int setcontext(const struct __ucontext *ucp); } SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, const struct __ucontext *ucp); } SYS_SWAPOFF = 424 // { int swapoff(const char *name); } SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, acl_type_t type, struct acl *aclp); } @@ -288,10 +270,10 @@ const ( SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); } SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); } SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( const char *path, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file(const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link(const char *path, int attrnamespace, void *data, size_t nbytes); } SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, const struct timespec *abstime); } - SYS_THR_SUSPEND = 442 // { int thr_suspend( const struct timespec *timeout); } + SYS_THR_SUSPEND = 442 // { int thr_suspend(const struct timespec *timeout); } SYS_THR_WAKE = 443 // { int thr_wake(long id); } SYS_KLDUNLOADF = 444 // { int kldunloadf(int fileid, int flags); } SYS_AUDIT = 445 // { int audit(const void *record, u_int length); } @@ -300,17 +282,17 @@ const ( SYS_SETAUID = 448 // { int setauid(uid_t *auid); } SYS_GETAUDIT = 449 // { int getaudit(struct auditinfo *auditinfo); } SYS_SETAUDIT = 450 // { int setaudit(struct auditinfo *auditinfo); } - SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } - SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr(struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr(struct auditinfo_addr *auditinfo_addr, u_int length); } SYS_AUDITCTL = 453 // { int auditctl(char *path); } SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, u_long val, void *uaddr1, void *uaddr2); } SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, int param_size); } SYS_SIGQUEUE = 456 // { int sigqueue(pid_t pid, int signum, void *value); } SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, mode_t mode, const struct mq_attr *attr); } - SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); } - SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } - SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len,unsigned msg_prio, const struct timespec *abs_timeout);} - SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); } + SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); } + SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } + SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len, unsigned msg_prio, const struct timespec *abs_timeout); } + SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); } SYS_KMQ_UNLINK = 462 // { int kmq_unlink(const char *path); } SYS_ABORT2 = 463 // { int abort2(const char *why, int nargs, void **args); } SYS_THR_SET_NAME = 464 // { int thr_set_name(long id, const char *name); } @@ -319,7 +301,7 @@ const ( SYS_SCTP_PEELOFF = 471 // { int sctp_peeloff(int sd, uint32_t name); } SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } - SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr * from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); } + SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr *from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); } SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset); } SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset); } SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); } @@ -338,14 +320,12 @@ const ( SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, int flag); } SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, gid_t gid, int flag); } SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, char **envv); } - SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, struct stat *buf, int flag); } SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, struct timeval *times); } SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, char *path2, int flag); } SYS_MKDIRAT = 496 // { int mkdirat(int fd, char *path, mode_t mode); } SYS_MKFIFOAT = 497 // { int mkfifoat(int fd, char *path, mode_t mode); } - SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, mode_t mode); } - SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, size_t bufsize); } + SYS_READLINKAT = 500 // { ssize_t readlinkat(int fd, char *path, char *buf, size_t bufsize); } SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, char *new); } SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, char *path2); } SYS_UNLINKAT = 503 // { int unlinkat(int fd, char *path, int flag); } @@ -391,7 +371,24 @@ const ( SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); } SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); } SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); } - SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, id_t id, struct vm_domain_policy_entry *policy); } - SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, id_t id, const struct vm_domain_policy_entry *policy); } SYS_FDATASYNC = 550 // { int fdatasync(int fd); } + SYS_FSTAT = 551 // { int fstat(int fd, struct stat *sb); } + SYS_FSTATAT = 552 // { int fstatat(int fd, char *path, struct stat *buf, int flag); } + SYS_FHSTAT = 553 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } + SYS_GETDIRENTRIES = 554 // { ssize_t getdirentries(int fd, char *buf, size_t count, off_t *basep); } + SYS_STATFS = 555 // { int statfs(char *path, struct statfs *buf); } + SYS_FSTATFS = 556 // { int fstatfs(int fd, struct statfs *buf); } + SYS_GETFSSTAT = 557 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } + SYS_FHSTATFS = 558 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } + SYS_MKNODAT = 559 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } + SYS_KEVENT = 560 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_CPUSET_GETDOMAIN = 561 // { int cpuset_getdomain(cpulevel_t level, cpuwhich_t which, id_t id, size_t domainsetsize, domainset_t *mask, int *policy); } + SYS_CPUSET_SETDOMAIN = 562 // { int cpuset_setdomain(cpulevel_t level, cpuwhich_t which, id_t id, size_t domainsetsize, domainset_t *mask, int policy); } + SYS_GETRANDOM = 563 // { int getrandom(void *buf, size_t buflen, unsigned int flags); } + SYS_GETFHAT = 564 // { int getfhat(int fd, char *path, struct fhandle *fhp, int flags); } + SYS_FHLINK = 565 // { int fhlink(struct fhandle *fhp, const char *to); } + SYS_FHLINKAT = 566 // { int fhlinkat(struct fhandle *fhp, int tofd, const char *to,); } + SYS_FHREADLINK = 567 // { int fhreadlink(struct fhandle *fhp, char *buf, size_t bufsize); } + SYS___SYSCTLBYNAME = 570 // { int __sysctlbyname(const char *name, size_t namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } + SYS_CLOSE_RANGE = 575 // { int close_range(u_int lowfd, u_int highfd, int flags); } ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go index 342d471d2eb1..01636b838d30 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go @@ -1,4 +1,4 @@ -// go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master +// go run mksysnum.go https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12 // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && freebsd @@ -19,10 +19,9 @@ const ( SYS_UNLINK = 10 // { int unlink(char *path); } SYS_CHDIR = 12 // { int chdir(char *path); } SYS_FCHDIR = 13 // { int fchdir(int fd); } - SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } SYS_CHMOD = 15 // { int chmod(char *path, int mode); } SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } - SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int + SYS_BREAK = 17 // { caddr_t break(char *nsize); } SYS_GETPID = 20 // { pid_t getpid(void); } SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } @@ -43,7 +42,6 @@ const ( SYS_KILL = 37 // { int kill(int pid, int signum); } SYS_GETPPID = 39 // { pid_t getppid(void); } SYS_DUP = 41 // { int dup(u_int fd); } - SYS_PIPE = 42 // { int pipe(void); } SYS_GETEGID = 43 // { gid_t getegid(void); } SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); } SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } @@ -58,15 +56,14 @@ const ( SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, size_t count); } SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } - SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int + SYS_UMASK = 60 // { int umask(int newmask); } SYS_CHROOT = 61 // { int chroot(char *path); } SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } SYS_VFORK = 66 // { int vfork(void); } SYS_SBRK = 69 // { int sbrk(int incr); } SYS_SSTK = 70 // { int sstk(int incr); } - SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise ovadvise_args int SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, int prot); } + SYS_MPROTECT = 74 // { int mprotect(void *addr, size_t len, int prot); } SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } @@ -124,14 +121,10 @@ const ( SYS_SETGID = 181 // { int setgid(gid_t gid); } SYS_SETEGID = 182 // { int setegid(gid_t egid); } SYS_SETEUID = 183 // { int seteuid(uid_t euid); } - SYS_STAT = 188 // { int stat(char *path, struct stat *ub); } - SYS_FSTAT = 189 // { int fstat(int fd, struct stat *sb); } - SYS_LSTAT = 190 // { int lstat(char *path, struct stat *ub); } SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int - SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } @@ -143,12 +136,12 @@ const ( SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, size_t nsops); } SYS_MSGGET = 225 // { int msgget(key_t key, int msgflg); } SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } + SYS_MSGRCV = 227 // { ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, int shmflg); } SYS_SHMDT = 230 // { int shmdt(const void *shmaddr); } SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, int shmflg); } SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, struct timespec *tp); } - SYS_CLOCK_SETTIME = 233 // { int clock_settime( clockid_t clock_id, const struct timespec *tp); } + SYS_CLOCK_SETTIME = 233 // { int clock_settime(clockid_t clock_id, const struct timespec *tp); } SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, struct timespec *tp); } SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, struct sigevent *evp, int *timerid); } SYS_KTIMER_DELETE = 236 // { int ktimer_delete(int timerid); } @@ -157,50 +150,44 @@ const ( SYS_KTIMER_GETOVERRUN = 239 // { int ktimer_getoverrun(int timerid); } SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); } - SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( struct ffclock_estimate *cest); } - SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( struct ffclock_estimate *cest); } + SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate(struct ffclock_estimate *cest); } + SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate(struct ffclock_estimate *cest); } SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); } - SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,int which, clockid_t *clock_id); } + SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id, int which, clockid_t *clock_id); } SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); } SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } SYS_RFORK = 251 // { int rfork(int flags); } - SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, u_int nfds, int timeout); } SYS_ISSETUGID = 253 // { int issetugid(void); } SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } SYS_AIO_READ = 255 // { int aio_read(struct aiocb *aiocbp); } SYS_AIO_WRITE = 256 // { int aio_write(struct aiocb *aiocbp); } - SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb * const *acb_list, int nent, struct sigevent *sig); } - SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, size_t count); } + SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb* const *acb_list, int nent, struct sigevent *sig); } SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); } - SYS_NSTAT = 278 // { int nstat(char *path, struct nstat *ub); } - SYS_NFSTAT = 279 // { int nfstat(int fd, struct nstat *sb); } - SYS_NLSTAT = 280 // { int nlstat(char *path, struct nstat *ub); } SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); } - SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } SYS_MODNEXT = 300 // { int modnext(int modid); } - SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat *stat); } + SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat* stat); } SYS_MODFNEXT = 302 // { int modfnext(int modid); } SYS_MODFIND = 303 // { int modfind(const char *name); } SYS_KLDLOAD = 304 // { int kldload(const char *file); } SYS_KLDUNLOAD = 305 // { int kldunload(int fileid); } SYS_KLDFIND = 306 // { int kldfind(const char *file); } SYS_KLDNEXT = 307 // { int kldnext(int fileid); } - SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat* stat); } + SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat *stat); } SYS_KLDFIRSTMOD = 309 // { int kldfirstmod(int fileid); } SYS_GETSID = 310 // { int getsid(pid_t pid); } SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); } SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); } SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); } - SYS_AIO_SUSPEND = 315 // { int aio_suspend( struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } + SYS_AIO_SUSPEND = 315 // { int aio_suspend(struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); } SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); } SYS_YIELD = 321 // { int yield(void); } SYS_MLOCKALL = 324 // { int mlockall(int how); } SYS_MUNLOCKALL = 325 // { int munlockall(void); } - SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); } + SYS___GETCWD = 326 // { int __getcwd(char *buf, size_t buflen); } SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, const struct sched_param *param); } SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct sched_param *param); } SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); } @@ -226,14 +213,13 @@ const ( SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, acl_type_t type, struct acl *aclp); } SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, acl_type_t type, struct acl *aclp); } SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } - SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } - SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } + SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete(struct aiocb **aiocbp, struct timespec *timeout); } SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } SYS_KQUEUE = 362 // { int kqueue(void); } - SYS_KEVENT = 363 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, int attrnamespace, const char *attrname); } @@ -251,10 +237,6 @@ const ( SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); } - SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } - SYS_STATFS = 396 // { int statfs(char *path, struct statfs *buf); } - SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); } - SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } SYS_KSEM_CLOSE = 400 // { int ksem_close(semid_t id); } SYS_KSEM_POST = 401 // { int ksem_post(semid_t id); } SYS_KSEM_WAIT = 402 // { int ksem_wait(semid_t id); } @@ -267,14 +249,14 @@ const ( SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, struct mac *mac_p); } SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, struct mac *mac_p); } SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, struct mac *mac_p); } - SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( const char *path, int attrnamespace, const char *attrname); } + SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link(const char *path, int attrnamespace, const char *attrname); } SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, char **envv, struct mac *mac_p); } SYS_SIGACTION = 416 // { int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); } - SYS_SIGRETURN = 417 // { int sigreturn( const struct __ucontext *sigcntxp); } + SYS_SIGRETURN = 417 // { int sigreturn(const struct __ucontext *sigcntxp); } SYS_GETCONTEXT = 421 // { int getcontext(struct __ucontext *ucp); } - SYS_SETCONTEXT = 422 // { int setcontext( const struct __ucontext *ucp); } + SYS_SETCONTEXT = 422 // { int setcontext(const struct __ucontext *ucp); } SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, const struct __ucontext *ucp); } SYS_SWAPOFF = 424 // { int swapoff(const char *name); } SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, acl_type_t type, struct acl *aclp); } @@ -288,10 +270,10 @@ const ( SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); } SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); } SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( const char *path, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file(const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link(const char *path, int attrnamespace, void *data, size_t nbytes); } SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, const struct timespec *abstime); } - SYS_THR_SUSPEND = 442 // { int thr_suspend( const struct timespec *timeout); } + SYS_THR_SUSPEND = 442 // { int thr_suspend(const struct timespec *timeout); } SYS_THR_WAKE = 443 // { int thr_wake(long id); } SYS_KLDUNLOADF = 444 // { int kldunloadf(int fileid, int flags); } SYS_AUDIT = 445 // { int audit(const void *record, u_int length); } @@ -300,17 +282,17 @@ const ( SYS_SETAUID = 448 // { int setauid(uid_t *auid); } SYS_GETAUDIT = 449 // { int getaudit(struct auditinfo *auditinfo); } SYS_SETAUDIT = 450 // { int setaudit(struct auditinfo *auditinfo); } - SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } - SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr(struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr(struct auditinfo_addr *auditinfo_addr, u_int length); } SYS_AUDITCTL = 453 // { int auditctl(char *path); } SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, u_long val, void *uaddr1, void *uaddr2); } SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, int param_size); } SYS_SIGQUEUE = 456 // { int sigqueue(pid_t pid, int signum, void *value); } SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, mode_t mode, const struct mq_attr *attr); } - SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); } - SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } - SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len,unsigned msg_prio, const struct timespec *abs_timeout);} - SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); } + SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); } + SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } + SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len, unsigned msg_prio, const struct timespec *abs_timeout); } + SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); } SYS_KMQ_UNLINK = 462 // { int kmq_unlink(const char *path); } SYS_ABORT2 = 463 // { int abort2(const char *why, int nargs, void **args); } SYS_THR_SET_NAME = 464 // { int thr_set_name(long id, const char *name); } @@ -319,7 +301,7 @@ const ( SYS_SCTP_PEELOFF = 471 // { int sctp_peeloff(int sd, uint32_t name); } SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } - SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr * from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); } + SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr *from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); } SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset); } SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset); } SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); } @@ -338,14 +320,12 @@ const ( SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, int flag); } SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, gid_t gid, int flag); } SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, char **envv); } - SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, struct stat *buf, int flag); } SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, struct timeval *times); } SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, char *path2, int flag); } SYS_MKDIRAT = 496 // { int mkdirat(int fd, char *path, mode_t mode); } SYS_MKFIFOAT = 497 // { int mkfifoat(int fd, char *path, mode_t mode); } - SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, mode_t mode); } - SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, size_t bufsize); } + SYS_READLINKAT = 500 // { ssize_t readlinkat(int fd, char *path, char *buf, size_t bufsize); } SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, char *new); } SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, char *path2); } SYS_UNLINKAT = 503 // { int unlinkat(int fd, char *path, int flag); } @@ -391,7 +371,24 @@ const ( SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); } SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); } SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); } - SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, id_t id, struct vm_domain_policy_entry *policy); } - SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, id_t id, const struct vm_domain_policy_entry *policy); } SYS_FDATASYNC = 550 // { int fdatasync(int fd); } + SYS_FSTAT = 551 // { int fstat(int fd, struct stat *sb); } + SYS_FSTATAT = 552 // { int fstatat(int fd, char *path, struct stat *buf, int flag); } + SYS_FHSTAT = 553 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } + SYS_GETDIRENTRIES = 554 // { ssize_t getdirentries(int fd, char *buf, size_t count, off_t *basep); } + SYS_STATFS = 555 // { int statfs(char *path, struct statfs *buf); } + SYS_FSTATFS = 556 // { int fstatfs(int fd, struct statfs *buf); } + SYS_GETFSSTAT = 557 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } + SYS_FHSTATFS = 558 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } + SYS_MKNODAT = 559 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } + SYS_KEVENT = 560 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_CPUSET_GETDOMAIN = 561 // { int cpuset_getdomain(cpulevel_t level, cpuwhich_t which, id_t id, size_t domainsetsize, domainset_t *mask, int *policy); } + SYS_CPUSET_SETDOMAIN = 562 // { int cpuset_setdomain(cpulevel_t level, cpuwhich_t which, id_t id, size_t domainsetsize, domainset_t *mask, int policy); } + SYS_GETRANDOM = 563 // { int getrandom(void *buf, size_t buflen, unsigned int flags); } + SYS_GETFHAT = 564 // { int getfhat(int fd, char *path, struct fhandle *fhp, int flags); } + SYS_FHLINK = 565 // { int fhlink(struct fhandle *fhp, const char *to); } + SYS_FHLINKAT = 566 // { int fhlinkat(struct fhandle *fhp, int tofd, const char *to,); } + SYS_FHREADLINK = 567 // { int fhreadlink(struct fhandle *fhp, char *buf, size_t bufsize); } + SYS___SYSCTLBYNAME = 570 // { int __sysctlbyname(const char *name, size_t namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } + SYS_CLOSE_RANGE = 575 // { int close_range(u_int lowfd, u_int highfd, int flags); } ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go index e2e3d72c5b04..ad99bc106a86 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go @@ -1,4 +1,4 @@ -// go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master +// go run mksysnum.go https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12 // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && freebsd @@ -19,10 +19,9 @@ const ( SYS_UNLINK = 10 // { int unlink(char *path); } SYS_CHDIR = 12 // { int chdir(char *path); } SYS_FCHDIR = 13 // { int fchdir(int fd); } - SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } SYS_CHMOD = 15 // { int chmod(char *path, int mode); } SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } - SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int + SYS_BREAK = 17 // { caddr_t break(char *nsize); } SYS_GETPID = 20 // { pid_t getpid(void); } SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } @@ -43,7 +42,6 @@ const ( SYS_KILL = 37 // { int kill(int pid, int signum); } SYS_GETPPID = 39 // { pid_t getppid(void); } SYS_DUP = 41 // { int dup(u_int fd); } - SYS_PIPE = 42 // { int pipe(void); } SYS_GETEGID = 43 // { gid_t getegid(void); } SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); } SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } @@ -58,15 +56,14 @@ const ( SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, size_t count); } SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } - SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int + SYS_UMASK = 60 // { int umask(int newmask); } SYS_CHROOT = 61 // { int chroot(char *path); } SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } SYS_VFORK = 66 // { int vfork(void); } SYS_SBRK = 69 // { int sbrk(int incr); } SYS_SSTK = 70 // { int sstk(int incr); } - SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise ovadvise_args int SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, int prot); } + SYS_MPROTECT = 74 // { int mprotect(void *addr, size_t len, int prot); } SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } @@ -124,14 +121,10 @@ const ( SYS_SETGID = 181 // { int setgid(gid_t gid); } SYS_SETEGID = 182 // { int setegid(gid_t egid); } SYS_SETEUID = 183 // { int seteuid(uid_t euid); } - SYS_STAT = 188 // { int stat(char *path, struct stat *ub); } - SYS_FSTAT = 189 // { int fstat(int fd, struct stat *sb); } - SYS_LSTAT = 190 // { int lstat(char *path, struct stat *ub); } SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int - SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } @@ -143,12 +136,12 @@ const ( SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, size_t nsops); } SYS_MSGGET = 225 // { int msgget(key_t key, int msgflg); } SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } + SYS_MSGRCV = 227 // { ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, int shmflg); } SYS_SHMDT = 230 // { int shmdt(const void *shmaddr); } SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, int shmflg); } SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, struct timespec *tp); } - SYS_CLOCK_SETTIME = 233 // { int clock_settime( clockid_t clock_id, const struct timespec *tp); } + SYS_CLOCK_SETTIME = 233 // { int clock_settime(clockid_t clock_id, const struct timespec *tp); } SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, struct timespec *tp); } SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, struct sigevent *evp, int *timerid); } SYS_KTIMER_DELETE = 236 // { int ktimer_delete(int timerid); } @@ -157,50 +150,44 @@ const ( SYS_KTIMER_GETOVERRUN = 239 // { int ktimer_getoverrun(int timerid); } SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); } - SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( struct ffclock_estimate *cest); } - SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( struct ffclock_estimate *cest); } + SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate(struct ffclock_estimate *cest); } + SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate(struct ffclock_estimate *cest); } SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); } - SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,int which, clockid_t *clock_id); } + SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id, int which, clockid_t *clock_id); } SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); } SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } SYS_RFORK = 251 // { int rfork(int flags); } - SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, u_int nfds, int timeout); } SYS_ISSETUGID = 253 // { int issetugid(void); } SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } SYS_AIO_READ = 255 // { int aio_read(struct aiocb *aiocbp); } SYS_AIO_WRITE = 256 // { int aio_write(struct aiocb *aiocbp); } - SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb * const *acb_list, int nent, struct sigevent *sig); } - SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, size_t count); } + SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb* const *acb_list, int nent, struct sigevent *sig); } SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); } - SYS_NSTAT = 278 // { int nstat(char *path, struct nstat *ub); } - SYS_NFSTAT = 279 // { int nfstat(int fd, struct nstat *sb); } - SYS_NLSTAT = 280 // { int nlstat(char *path, struct nstat *ub); } SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); } - SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } SYS_MODNEXT = 300 // { int modnext(int modid); } - SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat *stat); } + SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat* stat); } SYS_MODFNEXT = 302 // { int modfnext(int modid); } SYS_MODFIND = 303 // { int modfind(const char *name); } SYS_KLDLOAD = 304 // { int kldload(const char *file); } SYS_KLDUNLOAD = 305 // { int kldunload(int fileid); } SYS_KLDFIND = 306 // { int kldfind(const char *file); } SYS_KLDNEXT = 307 // { int kldnext(int fileid); } - SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat* stat); } + SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat *stat); } SYS_KLDFIRSTMOD = 309 // { int kldfirstmod(int fileid); } SYS_GETSID = 310 // { int getsid(pid_t pid); } SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); } SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); } SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); } - SYS_AIO_SUSPEND = 315 // { int aio_suspend( struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } + SYS_AIO_SUSPEND = 315 // { int aio_suspend(struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); } SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); } SYS_YIELD = 321 // { int yield(void); } SYS_MLOCKALL = 324 // { int mlockall(int how); } SYS_MUNLOCKALL = 325 // { int munlockall(void); } - SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); } + SYS___GETCWD = 326 // { int __getcwd(char *buf, size_t buflen); } SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, const struct sched_param *param); } SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct sched_param *param); } SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); } @@ -226,14 +213,13 @@ const ( SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, acl_type_t type, struct acl *aclp); } SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, acl_type_t type, struct acl *aclp); } SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } - SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } - SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } + SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete(struct aiocb **aiocbp, struct timespec *timeout); } SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } SYS_KQUEUE = 362 // { int kqueue(void); } - SYS_KEVENT = 363 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, int attrnamespace, const char *attrname); } @@ -251,10 +237,6 @@ const ( SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); } - SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } - SYS_STATFS = 396 // { int statfs(char *path, struct statfs *buf); } - SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); } - SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } SYS_KSEM_CLOSE = 400 // { int ksem_close(semid_t id); } SYS_KSEM_POST = 401 // { int ksem_post(semid_t id); } SYS_KSEM_WAIT = 402 // { int ksem_wait(semid_t id); } @@ -267,14 +249,14 @@ const ( SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, struct mac *mac_p); } SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, struct mac *mac_p); } SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, struct mac *mac_p); } - SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( const char *path, int attrnamespace, const char *attrname); } + SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link(const char *path, int attrnamespace, const char *attrname); } SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, char **envv, struct mac *mac_p); } SYS_SIGACTION = 416 // { int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); } - SYS_SIGRETURN = 417 // { int sigreturn( const struct __ucontext *sigcntxp); } + SYS_SIGRETURN = 417 // { int sigreturn(const struct __ucontext *sigcntxp); } SYS_GETCONTEXT = 421 // { int getcontext(struct __ucontext *ucp); } - SYS_SETCONTEXT = 422 // { int setcontext( const struct __ucontext *ucp); } + SYS_SETCONTEXT = 422 // { int setcontext(const struct __ucontext *ucp); } SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, const struct __ucontext *ucp); } SYS_SWAPOFF = 424 // { int swapoff(const char *name); } SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, acl_type_t type, struct acl *aclp); } @@ -288,10 +270,10 @@ const ( SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); } SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); } SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( const char *path, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file(const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link(const char *path, int attrnamespace, void *data, size_t nbytes); } SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, const struct timespec *abstime); } - SYS_THR_SUSPEND = 442 // { int thr_suspend( const struct timespec *timeout); } + SYS_THR_SUSPEND = 442 // { int thr_suspend(const struct timespec *timeout); } SYS_THR_WAKE = 443 // { int thr_wake(long id); } SYS_KLDUNLOADF = 444 // { int kldunloadf(int fileid, int flags); } SYS_AUDIT = 445 // { int audit(const void *record, u_int length); } @@ -300,17 +282,17 @@ const ( SYS_SETAUID = 448 // { int setauid(uid_t *auid); } SYS_GETAUDIT = 449 // { int getaudit(struct auditinfo *auditinfo); } SYS_SETAUDIT = 450 // { int setaudit(struct auditinfo *auditinfo); } - SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } - SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr(struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr(struct auditinfo_addr *auditinfo_addr, u_int length); } SYS_AUDITCTL = 453 // { int auditctl(char *path); } SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, u_long val, void *uaddr1, void *uaddr2); } SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, int param_size); } SYS_SIGQUEUE = 456 // { int sigqueue(pid_t pid, int signum, void *value); } SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, mode_t mode, const struct mq_attr *attr); } - SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); } - SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } - SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len,unsigned msg_prio, const struct timespec *abs_timeout);} - SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); } + SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); } + SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } + SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len, unsigned msg_prio, const struct timespec *abs_timeout); } + SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); } SYS_KMQ_UNLINK = 462 // { int kmq_unlink(const char *path); } SYS_ABORT2 = 463 // { int abort2(const char *why, int nargs, void **args); } SYS_THR_SET_NAME = 464 // { int thr_set_name(long id, const char *name); } @@ -319,7 +301,7 @@ const ( SYS_SCTP_PEELOFF = 471 // { int sctp_peeloff(int sd, uint32_t name); } SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } - SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr * from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); } + SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr *from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); } SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset); } SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset); } SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); } @@ -338,14 +320,12 @@ const ( SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, int flag); } SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, gid_t gid, int flag); } SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, char **envv); } - SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, struct stat *buf, int flag); } SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, struct timeval *times); } SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, char *path2, int flag); } SYS_MKDIRAT = 496 // { int mkdirat(int fd, char *path, mode_t mode); } SYS_MKFIFOAT = 497 // { int mkfifoat(int fd, char *path, mode_t mode); } - SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, mode_t mode); } - SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, size_t bufsize); } + SYS_READLINKAT = 500 // { ssize_t readlinkat(int fd, char *path, char *buf, size_t bufsize); } SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, char *new); } SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, char *path2); } SYS_UNLINKAT = 503 // { int unlinkat(int fd, char *path, int flag); } @@ -391,7 +371,24 @@ const ( SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); } SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); } SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); } - SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, id_t id, struct vm_domain_policy_entry *policy); } - SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, id_t id, const struct vm_domain_policy_entry *policy); } SYS_FDATASYNC = 550 // { int fdatasync(int fd); } + SYS_FSTAT = 551 // { int fstat(int fd, struct stat *sb); } + SYS_FSTATAT = 552 // { int fstatat(int fd, char *path, struct stat *buf, int flag); } + SYS_FHSTAT = 553 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } + SYS_GETDIRENTRIES = 554 // { ssize_t getdirentries(int fd, char *buf, size_t count, off_t *basep); } + SYS_STATFS = 555 // { int statfs(char *path, struct statfs *buf); } + SYS_FSTATFS = 556 // { int fstatfs(int fd, struct statfs *buf); } + SYS_GETFSSTAT = 557 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } + SYS_FHSTATFS = 558 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } + SYS_MKNODAT = 559 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } + SYS_KEVENT = 560 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_CPUSET_GETDOMAIN = 561 // { int cpuset_getdomain(cpulevel_t level, cpuwhich_t which, id_t id, size_t domainsetsize, domainset_t *mask, int *policy); } + SYS_CPUSET_SETDOMAIN = 562 // { int cpuset_setdomain(cpulevel_t level, cpuwhich_t which, id_t id, size_t domainsetsize, domainset_t *mask, int policy); } + SYS_GETRANDOM = 563 // { int getrandom(void *buf, size_t buflen, unsigned int flags); } + SYS_GETFHAT = 564 // { int getfhat(int fd, char *path, struct fhandle *fhp, int flags); } + SYS_FHLINK = 565 // { int fhlink(struct fhandle *fhp, const char *to); } + SYS_FHLINKAT = 566 // { int fhlinkat(struct fhandle *fhp, int tofd, const char *to,); } + SYS_FHREADLINK = 567 // { int fhreadlink(struct fhandle *fhp, char *buf, size_t bufsize); } + SYS___SYSCTLBYNAME = 570 // { int __sysctlbyname(const char *name, size_t namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } + SYS_CLOSE_RANGE = 575 // { int close_range(u_int lowfd, u_int highfd, int flags); } ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go index 61ad5ca3c19b..89dcc4274765 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go @@ -1,4 +1,4 @@ -// go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master +// go run mksysnum.go https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12 // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && freebsd @@ -19,10 +19,9 @@ const ( SYS_UNLINK = 10 // { int unlink(char *path); } SYS_CHDIR = 12 // { int chdir(char *path); } SYS_FCHDIR = 13 // { int fchdir(int fd); } - SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } SYS_CHMOD = 15 // { int chmod(char *path, int mode); } SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } - SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int + SYS_BREAK = 17 // { caddr_t break(char *nsize); } SYS_GETPID = 20 // { pid_t getpid(void); } SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } @@ -43,7 +42,6 @@ const ( SYS_KILL = 37 // { int kill(int pid, int signum); } SYS_GETPPID = 39 // { pid_t getppid(void); } SYS_DUP = 41 // { int dup(u_int fd); } - SYS_PIPE = 42 // { int pipe(void); } SYS_GETEGID = 43 // { gid_t getegid(void); } SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); } SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } @@ -58,15 +56,14 @@ const ( SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, size_t count); } SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } - SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int + SYS_UMASK = 60 // { int umask(int newmask); } SYS_CHROOT = 61 // { int chroot(char *path); } SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } SYS_VFORK = 66 // { int vfork(void); } SYS_SBRK = 69 // { int sbrk(int incr); } SYS_SSTK = 70 // { int sstk(int incr); } - SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise ovadvise_args int SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, int prot); } + SYS_MPROTECT = 74 // { int mprotect(void *addr, size_t len, int prot); } SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } @@ -124,14 +121,10 @@ const ( SYS_SETGID = 181 // { int setgid(gid_t gid); } SYS_SETEGID = 182 // { int setegid(gid_t egid); } SYS_SETEUID = 183 // { int seteuid(uid_t euid); } - SYS_STAT = 188 // { int stat(char *path, struct stat *ub); } - SYS_FSTAT = 189 // { int fstat(int fd, struct stat *sb); } - SYS_LSTAT = 190 // { int lstat(char *path, struct stat *ub); } SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int - SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } @@ -143,12 +136,12 @@ const ( SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, size_t nsops); } SYS_MSGGET = 225 // { int msgget(key_t key, int msgflg); } SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } + SYS_MSGRCV = 227 // { ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, int shmflg); } SYS_SHMDT = 230 // { int shmdt(const void *shmaddr); } SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, int shmflg); } SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, struct timespec *tp); } - SYS_CLOCK_SETTIME = 233 // { int clock_settime( clockid_t clock_id, const struct timespec *tp); } + SYS_CLOCK_SETTIME = 233 // { int clock_settime(clockid_t clock_id, const struct timespec *tp); } SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, struct timespec *tp); } SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, struct sigevent *evp, int *timerid); } SYS_KTIMER_DELETE = 236 // { int ktimer_delete(int timerid); } @@ -157,50 +150,44 @@ const ( SYS_KTIMER_GETOVERRUN = 239 // { int ktimer_getoverrun(int timerid); } SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); } - SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( struct ffclock_estimate *cest); } - SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( struct ffclock_estimate *cest); } + SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate(struct ffclock_estimate *cest); } + SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate(struct ffclock_estimate *cest); } SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); } - SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,int which, clockid_t *clock_id); } + SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id, int which, clockid_t *clock_id); } SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); } SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } SYS_RFORK = 251 // { int rfork(int flags); } - SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, u_int nfds, int timeout); } SYS_ISSETUGID = 253 // { int issetugid(void); } SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } SYS_AIO_READ = 255 // { int aio_read(struct aiocb *aiocbp); } SYS_AIO_WRITE = 256 // { int aio_write(struct aiocb *aiocbp); } - SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb * const *acb_list, int nent, struct sigevent *sig); } - SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, size_t count); } + SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb* const *acb_list, int nent, struct sigevent *sig); } SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); } - SYS_NSTAT = 278 // { int nstat(char *path, struct nstat *ub); } - SYS_NFSTAT = 279 // { int nfstat(int fd, struct nstat *sb); } - SYS_NLSTAT = 280 // { int nlstat(char *path, struct nstat *ub); } SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); } - SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } SYS_MODNEXT = 300 // { int modnext(int modid); } - SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat *stat); } + SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat* stat); } SYS_MODFNEXT = 302 // { int modfnext(int modid); } SYS_MODFIND = 303 // { int modfind(const char *name); } SYS_KLDLOAD = 304 // { int kldload(const char *file); } SYS_KLDUNLOAD = 305 // { int kldunload(int fileid); } SYS_KLDFIND = 306 // { int kldfind(const char *file); } SYS_KLDNEXT = 307 // { int kldnext(int fileid); } - SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat* stat); } + SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat *stat); } SYS_KLDFIRSTMOD = 309 // { int kldfirstmod(int fileid); } SYS_GETSID = 310 // { int getsid(pid_t pid); } SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); } SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); } SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); } - SYS_AIO_SUSPEND = 315 // { int aio_suspend( struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } + SYS_AIO_SUSPEND = 315 // { int aio_suspend(struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); } SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); } SYS_YIELD = 321 // { int yield(void); } SYS_MLOCKALL = 324 // { int mlockall(int how); } SYS_MUNLOCKALL = 325 // { int munlockall(void); } - SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); } + SYS___GETCWD = 326 // { int __getcwd(char *buf, size_t buflen); } SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, const struct sched_param *param); } SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct sched_param *param); } SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); } @@ -226,14 +213,13 @@ const ( SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, acl_type_t type, struct acl *aclp); } SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, acl_type_t type, struct acl *aclp); } SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } - SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } - SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } + SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete(struct aiocb **aiocbp, struct timespec *timeout); } SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } SYS_KQUEUE = 362 // { int kqueue(void); } - SYS_KEVENT = 363 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, int attrnamespace, const char *attrname); } @@ -251,10 +237,6 @@ const ( SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); } - SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } - SYS_STATFS = 396 // { int statfs(char *path, struct statfs *buf); } - SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); } - SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } SYS_KSEM_CLOSE = 400 // { int ksem_close(semid_t id); } SYS_KSEM_POST = 401 // { int ksem_post(semid_t id); } SYS_KSEM_WAIT = 402 // { int ksem_wait(semid_t id); } @@ -267,14 +249,14 @@ const ( SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, struct mac *mac_p); } SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, struct mac *mac_p); } SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, struct mac *mac_p); } - SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } - SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( const char *path, int attrnamespace, const char *attrname); } + SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link(const char *path, int attrnamespace, const char *attrname); } SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, char **envv, struct mac *mac_p); } SYS_SIGACTION = 416 // { int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); } - SYS_SIGRETURN = 417 // { int sigreturn( const struct __ucontext *sigcntxp); } + SYS_SIGRETURN = 417 // { int sigreturn(const struct __ucontext *sigcntxp); } SYS_GETCONTEXT = 421 // { int getcontext(struct __ucontext *ucp); } - SYS_SETCONTEXT = 422 // { int setcontext( const struct __ucontext *ucp); } + SYS_SETCONTEXT = 422 // { int setcontext(const struct __ucontext *ucp); } SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, const struct __ucontext *ucp); } SYS_SWAPOFF = 424 // { int swapoff(const char *name); } SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, acl_type_t type, struct acl *aclp); } @@ -288,10 +270,10 @@ const ( SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); } SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); } SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( const char *path, int attrnamespace, void *data, size_t nbytes); } - SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file(const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link(const char *path, int attrnamespace, void *data, size_t nbytes); } SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, const struct timespec *abstime); } - SYS_THR_SUSPEND = 442 // { int thr_suspend( const struct timespec *timeout); } + SYS_THR_SUSPEND = 442 // { int thr_suspend(const struct timespec *timeout); } SYS_THR_WAKE = 443 // { int thr_wake(long id); } SYS_KLDUNLOADF = 444 // { int kldunloadf(int fileid, int flags); } SYS_AUDIT = 445 // { int audit(const void *record, u_int length); } @@ -300,17 +282,17 @@ const ( SYS_SETAUID = 448 // { int setauid(uid_t *auid); } SYS_GETAUDIT = 449 // { int getaudit(struct auditinfo *auditinfo); } SYS_SETAUDIT = 450 // { int setaudit(struct auditinfo *auditinfo); } - SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } - SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr(struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr(struct auditinfo_addr *auditinfo_addr, u_int length); } SYS_AUDITCTL = 453 // { int auditctl(char *path); } SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, u_long val, void *uaddr1, void *uaddr2); } SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, int param_size); } SYS_SIGQUEUE = 456 // { int sigqueue(pid_t pid, int signum, void *value); } SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, mode_t mode, const struct mq_attr *attr); } - SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); } - SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } - SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len,unsigned msg_prio, const struct timespec *abs_timeout);} - SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); } + SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); } + SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } + SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len, unsigned msg_prio, const struct timespec *abs_timeout); } + SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); } SYS_KMQ_UNLINK = 462 // { int kmq_unlink(const char *path); } SYS_ABORT2 = 463 // { int abort2(const char *why, int nargs, void **args); } SYS_THR_SET_NAME = 464 // { int thr_set_name(long id, const char *name); } @@ -319,7 +301,7 @@ const ( SYS_SCTP_PEELOFF = 471 // { int sctp_peeloff(int sd, uint32_t name); } SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } - SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr * from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); } + SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr *from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); } SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset); } SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset); } SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); } @@ -338,14 +320,12 @@ const ( SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, int flag); } SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, gid_t gid, int flag); } SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, char **envv); } - SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, struct stat *buf, int flag); } SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, struct timeval *times); } SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, char *path2, int flag); } SYS_MKDIRAT = 496 // { int mkdirat(int fd, char *path, mode_t mode); } SYS_MKFIFOAT = 497 // { int mkfifoat(int fd, char *path, mode_t mode); } - SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, mode_t mode); } - SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, size_t bufsize); } + SYS_READLINKAT = 500 // { ssize_t readlinkat(int fd, char *path, char *buf, size_t bufsize); } SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, char *new); } SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, char *path2); } SYS_UNLINKAT = 503 // { int unlinkat(int fd, char *path, int flag); } @@ -391,7 +371,24 @@ const ( SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); } SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); } SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); } - SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, id_t id, struct vm_domain_policy_entry *policy); } - SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, id_t id, const struct vm_domain_policy_entry *policy); } SYS_FDATASYNC = 550 // { int fdatasync(int fd); } + SYS_FSTAT = 551 // { int fstat(int fd, struct stat *sb); } + SYS_FSTATAT = 552 // { int fstatat(int fd, char *path, struct stat *buf, int flag); } + SYS_FHSTAT = 553 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } + SYS_GETDIRENTRIES = 554 // { ssize_t getdirentries(int fd, char *buf, size_t count, off_t *basep); } + SYS_STATFS = 555 // { int statfs(char *path, struct statfs *buf); } + SYS_FSTATFS = 556 // { int fstatfs(int fd, struct statfs *buf); } + SYS_GETFSSTAT = 557 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } + SYS_FHSTATFS = 558 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } + SYS_MKNODAT = 559 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } + SYS_KEVENT = 560 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_CPUSET_GETDOMAIN = 561 // { int cpuset_getdomain(cpulevel_t level, cpuwhich_t which, id_t id, size_t domainsetsize, domainset_t *mask, int *policy); } + SYS_CPUSET_SETDOMAIN = 562 // { int cpuset_setdomain(cpulevel_t level, cpuwhich_t which, id_t id, size_t domainsetsize, domainset_t *mask, int policy); } + SYS_GETRANDOM = 563 // { int getrandom(void *buf, size_t buflen, unsigned int flags); } + SYS_GETFHAT = 564 // { int getfhat(int fd, char *path, struct fhandle *fhp, int flags); } + SYS_FHLINK = 565 // { int fhlink(struct fhandle *fhp, const char *to); } + SYS_FHLINKAT = 566 // { int fhlinkat(struct fhandle *fhp, int tofd, const char *to,); } + SYS_FHREADLINK = 567 // { int fhreadlink(struct fhandle *fhp, char *buf, size_t bufsize); } + SYS___SYSCTLBYNAME = 570 // { int __sysctlbyname(const char *name, size_t namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } + SYS_CLOSE_RANGE = 575 // { int close_range(u_int lowfd, u_int highfd, int flags); } ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go new file mode 100644 index 000000000000..ee37aaa0c906 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go @@ -0,0 +1,394 @@ +// go run mksysnum.go https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12 +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build riscv64 && freebsd +// +build riscv64,freebsd + +package unix + +const ( + // SYS_NOSYS = 0; // { int nosys(void); } syscall nosys_args int + SYS_EXIT = 1 // { void sys_exit(int rval); } exit sys_exit_args void + SYS_FORK = 2 // { int fork(void); } + SYS_READ = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); } + SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); } + SYS_OPEN = 5 // { int open(char *path, int flags, int mode); } + SYS_CLOSE = 6 // { int close(int fd); } + SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); } + SYS_LINK = 9 // { int link(char *path, char *link); } + SYS_UNLINK = 10 // { int unlink(char *path); } + SYS_CHDIR = 12 // { int chdir(char *path); } + SYS_FCHDIR = 13 // { int fchdir(int fd); } + SYS_CHMOD = 15 // { int chmod(char *path, int mode); } + SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } + SYS_BREAK = 17 // { caddr_t break(char *nsize); } + SYS_GETPID = 20 // { pid_t getpid(void); } + SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } + SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } + SYS_SETUID = 23 // { int setuid(uid_t uid); } + SYS_GETUID = 24 // { uid_t getuid(void); } + SYS_GETEUID = 25 // { uid_t geteuid(void); } + SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } + SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } + SYS_SENDMSG = 28 // { int sendmsg(int s, struct msghdr *msg, int flags); } + SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, struct sockaddr * __restrict from, __socklen_t * __restrict fromlenaddr); } + SYS_ACCEPT = 30 // { int accept(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen); } + SYS_GETPEERNAME = 31 // { int getpeername(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); } + SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); } + SYS_ACCESS = 33 // { int access(char *path, int amode); } + SYS_CHFLAGS = 34 // { int chflags(const char *path, u_long flags); } + SYS_FCHFLAGS = 35 // { int fchflags(int fd, u_long flags); } + SYS_SYNC = 36 // { int sync(void); } + SYS_KILL = 37 // { int kill(int pid, int signum); } + SYS_GETPPID = 39 // { pid_t getppid(void); } + SYS_DUP = 41 // { int dup(u_int fd); } + SYS_GETEGID = 43 // { gid_t getegid(void); } + SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); } + SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } + SYS_GETGID = 47 // { gid_t getgid(void); } + SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int namelen); } + SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } + SYS_ACCT = 51 // { int acct(char *path); } + SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, stack_t *oss); } + SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); } + SYS_REBOOT = 55 // { int reboot(int opt); } + SYS_REVOKE = 56 // { int revoke(char *path); } + SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } + SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, size_t count); } + SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } + SYS_UMASK = 60 // { int umask(int newmask); } + SYS_CHROOT = 61 // { int chroot(char *path); } + SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } + SYS_VFORK = 66 // { int vfork(void); } + SYS_SBRK = 69 // { int sbrk(int incr); } + SYS_SSTK = 70 // { int sstk(int incr); } + SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } + SYS_MPROTECT = 74 // { int mprotect(void *addr, size_t len, int prot); } + SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } + SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } + SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } + SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } + SYS_GETPGRP = 81 // { int getpgrp(void); } + SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } + SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } + SYS_SWAPON = 85 // { int swapon(char *name); } + SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } + SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } + SYS_DUP2 = 90 // { int dup2(u_int from, u_int to); } + SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } + SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } + SYS_FSYNC = 95 // { int fsync(int fd); } + SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); } + SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } + SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); } + SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); } + SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); } + SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); } + SYS_LISTEN = 106 // { int listen(int s, int backlog); } + SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } + SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } + SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); } + SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); } + SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); } + SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } + SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } + SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } + SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); } + SYS_SETREGID = 127 // { int setregid(int rgid, int egid); } + SYS_RENAME = 128 // { int rename(char *from, char *to); } + SYS_FLOCK = 131 // { int flock(int fd, int how); } + SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); } + SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); } + SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } + SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } + SYS_MKDIR = 136 // { int mkdir(char *path, int mode); } + SYS_RMDIR = 137 // { int rmdir(char *path); } + SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } + SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } + SYS_SETSID = 147 // { int setsid(void); } + SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); } + SYS_NLM_SYSCALL = 154 // { int nlm_syscall(int debug_level, int grace_period, int addr_count, char **addrs); } + SYS_NFSSVC = 155 // { int nfssvc(int flag, caddr_t argp); } + SYS_LGETFH = 160 // { int lgetfh(char *fname, struct fhandle *fhp); } + SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); } + SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); } + SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); } + SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, int a4, int a5); } + SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, int a4, int a5, int a6); } + SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, int a4); } + SYS_SETFIB = 175 // { int setfib(int fibnum); } + SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } + SYS_SETGID = 181 // { int setgid(gid_t gid); } + SYS_SETEGID = 182 // { int setegid(gid_t egid); } + SYS_SETEUID = 183 // { int seteuid(uid_t euid); } + SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } + SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } + SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int + SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int + SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int + SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } + SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } + SYS_UNDELETE = 205 // { int undelete(char *path); } + SYS_FUTIMES = 206 // { int futimes(int fd, struct timeval *tptr); } + SYS_GETPGID = 207 // { int getpgid(pid_t pid); } + SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_SEMGET = 221 // { int semget(key_t key, int nsems, int semflg); } + SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, size_t nsops); } + SYS_MSGGET = 225 // { int msgget(key_t key, int msgflg); } + SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } + SYS_MSGRCV = 227 // { ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } + SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, int shmflg); } + SYS_SHMDT = 230 // { int shmdt(const void *shmaddr); } + SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, int shmflg); } + SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, struct timespec *tp); } + SYS_CLOCK_SETTIME = 233 // { int clock_settime(clockid_t clock_id, const struct timespec *tp); } + SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, struct timespec *tp); } + SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, struct sigevent *evp, int *timerid); } + SYS_KTIMER_DELETE = 236 // { int ktimer_delete(int timerid); } + SYS_KTIMER_SETTIME = 237 // { int ktimer_settime(int timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); } + SYS_KTIMER_GETTIME = 238 // { int ktimer_gettime(int timerid, struct itimerspec *value); } + SYS_KTIMER_GETOVERRUN = 239 // { int ktimer_getoverrun(int timerid); } + SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } + SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); } + SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate(struct ffclock_estimate *cest); } + SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate(struct ffclock_estimate *cest); } + SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); } + SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id, int which, clockid_t *clock_id); } + SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); } + SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } + SYS_RFORK = 251 // { int rfork(int flags); } + SYS_ISSETUGID = 253 // { int issetugid(void); } + SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } + SYS_AIO_READ = 255 // { int aio_read(struct aiocb *aiocbp); } + SYS_AIO_WRITE = 256 // { int aio_write(struct aiocb *aiocbp); } + SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb* const *acb_list, int nent, struct sigevent *sig); } + SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } + SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); } + SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } + SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } + SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); } + SYS_MODNEXT = 300 // { int modnext(int modid); } + SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat* stat); } + SYS_MODFNEXT = 302 // { int modfnext(int modid); } + SYS_MODFIND = 303 // { int modfind(const char *name); } + SYS_KLDLOAD = 304 // { int kldload(const char *file); } + SYS_KLDUNLOAD = 305 // { int kldunload(int fileid); } + SYS_KLDFIND = 306 // { int kldfind(const char *file); } + SYS_KLDNEXT = 307 // { int kldnext(int fileid); } + SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat *stat); } + SYS_KLDFIRSTMOD = 309 // { int kldfirstmod(int fileid); } + SYS_GETSID = 310 // { int getsid(pid_t pid); } + SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); } + SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); } + SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); } + SYS_AIO_SUSPEND = 315 // { int aio_suspend(struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } + SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); } + SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); } + SYS_YIELD = 321 // { int yield(void); } + SYS_MLOCKALL = 324 // { int mlockall(int how); } + SYS_MUNLOCKALL = 325 // { int munlockall(void); } + SYS___GETCWD = 326 // { int __getcwd(char *buf, size_t buflen); } + SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, const struct sched_param *param); } + SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct sched_param *param); } + SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); } + SYS_SCHED_GETSCHEDULER = 330 // { int sched_getscheduler (pid_t pid); } + SYS_SCHED_YIELD = 331 // { int sched_yield (void); } + SYS_SCHED_GET_PRIORITY_MAX = 332 // { int sched_get_priority_max (int policy); } + SYS_SCHED_GET_PRIORITY_MIN = 333 // { int sched_get_priority_min (int policy); } + SYS_SCHED_RR_GET_INTERVAL = 334 // { int sched_rr_get_interval (pid_t pid, struct timespec *interval); } + SYS_UTRACE = 335 // { int utrace(const void *addr, size_t len); } + SYS_KLDSYM = 337 // { int kldsym(int fileid, int cmd, void *data); } + SYS_JAIL = 338 // { int jail(struct jail *jail); } + SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, const sigset_t *set, sigset_t *oset); } + SYS_SIGSUSPEND = 341 // { int sigsuspend(const sigset_t *sigmask); } + SYS_SIGPENDING = 343 // { int sigpending(sigset_t *set); } + SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout); } + SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set, siginfo_t *info); } + SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, acl_type_t type, struct acl *aclp); } + SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, acl_type_t type, struct acl *aclp); } + SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, acl_type_t type, struct acl *aclp); } + SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, acl_type_t type, struct acl *aclp); } + SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, acl_type_t type); } + SYS___ACL_DELETE_FD = 352 // { int __acl_delete_fd(int filedes, acl_type_t type); } + SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, acl_type_t type, struct acl *aclp); } + SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, acl_type_t type, struct acl *aclp); } + SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } + SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } + SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete(struct aiocb **aiocbp, struct timespec *timeout); } + SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } + SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } + SYS_KQUEUE = 362 // { int kqueue(void); } + SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, int attrnamespace, const char *attrname); } + SYS___SETUGID = 374 // { int __setugid(int flag); } + SYS_EACCESS = 376 // { int eaccess(char *path, int amode); } + SYS_NMOUNT = 378 // { int nmount(struct iovec *iovp, unsigned int iovcnt, int flags); } + SYS___MAC_GET_PROC = 384 // { int __mac_get_proc(struct mac *mac_p); } + SYS___MAC_SET_PROC = 385 // { int __mac_set_proc(struct mac *mac_p); } + SYS___MAC_GET_FD = 386 // { int __mac_get_fd(int fd, struct mac *mac_p); } + SYS___MAC_GET_FILE = 387 // { int __mac_get_file(const char *path_p, struct mac *mac_p); } + SYS___MAC_SET_FD = 388 // { int __mac_set_fd(int fd, struct mac *mac_p); } + SYS___MAC_SET_FILE = 389 // { int __mac_set_file(const char *path_p, struct mac *mac_p); } + SYS_KENV = 390 // { int kenv(int what, const char *name, char *value, int len); } + SYS_LCHFLAGS = 391 // { int lchflags(const char *path, u_long flags); } + SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } + SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } + SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); } + SYS_KSEM_CLOSE = 400 // { int ksem_close(semid_t id); } + SYS_KSEM_POST = 401 // { int ksem_post(semid_t id); } + SYS_KSEM_WAIT = 402 // { int ksem_wait(semid_t id); } + SYS_KSEM_TRYWAIT = 403 // { int ksem_trywait(semid_t id); } + SYS_KSEM_INIT = 404 // { int ksem_init(semid_t *idp, unsigned int value); } + SYS_KSEM_OPEN = 405 // { int ksem_open(semid_t *idp, const char *name, int oflag, mode_t mode, unsigned int value); } + SYS_KSEM_UNLINK = 406 // { int ksem_unlink(const char *name); } + SYS_KSEM_GETVALUE = 407 // { int ksem_getvalue(semid_t id, int *val); } + SYS_KSEM_DESTROY = 408 // { int ksem_destroy(semid_t id); } + SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, struct mac *mac_p); } + SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, struct mac *mac_p); } + SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, struct mac *mac_p); } + SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link(const char *path, int attrnamespace, const char *attrname); } + SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, char **envv, struct mac *mac_p); } + SYS_SIGACTION = 416 // { int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); } + SYS_SIGRETURN = 417 // { int sigreturn(const struct __ucontext *sigcntxp); } + SYS_GETCONTEXT = 421 // { int getcontext(struct __ucontext *ucp); } + SYS_SETCONTEXT = 422 // { int setcontext(const struct __ucontext *ucp); } + SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, const struct __ucontext *ucp); } + SYS_SWAPOFF = 424 // { int swapoff(const char *name); } + SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, acl_type_t type, struct acl *aclp); } + SYS___ACL_SET_LINK = 426 // { int __acl_set_link(const char *path, acl_type_t type, struct acl *aclp); } + SYS___ACL_DELETE_LINK = 427 // { int __acl_delete_link(const char *path, acl_type_t type); } + SYS___ACL_ACLCHECK_LINK = 428 // { int __acl_aclcheck_link(const char *path, acl_type_t type, struct acl *aclp); } + SYS_SIGWAIT = 429 // { int sigwait(const sigset_t *set, int *sig); } + SYS_THR_CREATE = 430 // { int thr_create(ucontext_t *ctx, long *id, int flags); } + SYS_THR_EXIT = 431 // { void thr_exit(long *state); } + SYS_THR_SELF = 432 // { int thr_self(long *id); } + SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); } + SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); } + SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file(const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link(const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, const struct timespec *abstime); } + SYS_THR_SUSPEND = 442 // { int thr_suspend(const struct timespec *timeout); } + SYS_THR_WAKE = 443 // { int thr_wake(long id); } + SYS_KLDUNLOADF = 444 // { int kldunloadf(int fileid, int flags); } + SYS_AUDIT = 445 // { int audit(const void *record, u_int length); } + SYS_AUDITON = 446 // { int auditon(int cmd, void *data, u_int length); } + SYS_GETAUID = 447 // { int getauid(uid_t *auid); } + SYS_SETAUID = 448 // { int setauid(uid_t *auid); } + SYS_GETAUDIT = 449 // { int getaudit(struct auditinfo *auditinfo); } + SYS_SETAUDIT = 450 // { int setaudit(struct auditinfo *auditinfo); } + SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr(struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr(struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_AUDITCTL = 453 // { int auditctl(char *path); } + SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, u_long val, void *uaddr1, void *uaddr2); } + SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, int param_size); } + SYS_SIGQUEUE = 456 // { int sigqueue(pid_t pid, int signum, void *value); } + SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, mode_t mode, const struct mq_attr *attr); } + SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); } + SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } + SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len, unsigned msg_prio, const struct timespec *abs_timeout); } + SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); } + SYS_KMQ_UNLINK = 462 // { int kmq_unlink(const char *path); } + SYS_ABORT2 = 463 // { int abort2(const char *why, int nargs, void **args); } + SYS_THR_SET_NAME = 464 // { int thr_set_name(long id, const char *name); } + SYS_AIO_FSYNC = 465 // { int aio_fsync(int op, struct aiocb *aiocbp); } + SYS_RTPRIO_THREAD = 466 // { int rtprio_thread(int function, lwpid_t lwpid, struct rtprio *rtp); } + SYS_SCTP_PEELOFF = 471 // { int sctp_peeloff(int sd, uint32_t name); } + SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } + SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } + SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr *from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); } + SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset); } + SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset); } + SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); } + SYS_LSEEK = 478 // { off_t lseek(int fd, off_t offset, int whence); } + SYS_TRUNCATE = 479 // { int truncate(char *path, off_t length); } + SYS_FTRUNCATE = 480 // { int ftruncate(int fd, off_t length); } + SYS_THR_KILL2 = 481 // { int thr_kill2(pid_t pid, long id, int sig); } + SYS_SHM_OPEN = 482 // { int shm_open(const char *path, int flags, mode_t mode); } + SYS_SHM_UNLINK = 483 // { int shm_unlink(const char *path); } + SYS_CPUSET = 484 // { int cpuset(cpusetid_t *setid); } + SYS_CPUSET_SETID = 485 // { int cpuset_setid(cpuwhich_t which, id_t id, cpusetid_t setid); } + SYS_CPUSET_GETID = 486 // { int cpuset_getid(cpulevel_t level, cpuwhich_t which, id_t id, cpusetid_t *setid); } + SYS_CPUSET_GETAFFINITY = 487 // { int cpuset_getaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *mask); } + SYS_CPUSET_SETAFFINITY = 488 // { int cpuset_setaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, const cpuset_t *mask); } + SYS_FACCESSAT = 489 // { int faccessat(int fd, char *path, int amode, int flag); } + SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, int flag); } + SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, gid_t gid, int flag); } + SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, char **envv); } + SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, struct timeval *times); } + SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, char *path2, int flag); } + SYS_MKDIRAT = 496 // { int mkdirat(int fd, char *path, mode_t mode); } + SYS_MKFIFOAT = 497 // { int mkfifoat(int fd, char *path, mode_t mode); } + SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, mode_t mode); } + SYS_READLINKAT = 500 // { ssize_t readlinkat(int fd, char *path, char *buf, size_t bufsize); } + SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, char *new); } + SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, char *path2); } + SYS_UNLINKAT = 503 // { int unlinkat(int fd, char *path, int flag); } + SYS_POSIX_OPENPT = 504 // { int posix_openpt(int flags); } + SYS_GSSD_SYSCALL = 505 // { int gssd_syscall(char *path); } + SYS_JAIL_GET = 506 // { int jail_get(struct iovec *iovp, unsigned int iovcnt, int flags); } + SYS_JAIL_SET = 507 // { int jail_set(struct iovec *iovp, unsigned int iovcnt, int flags); } + SYS_JAIL_REMOVE = 508 // { int jail_remove(int jid); } + SYS_CLOSEFROM = 509 // { int closefrom(int lowfd); } + SYS___SEMCTL = 510 // { int __semctl(int semid, int semnum, int cmd, union semun *arg); } + SYS_MSGCTL = 511 // { int msgctl(int msqid, int cmd, struct msqid_ds *buf); } + SYS_SHMCTL = 512 // { int shmctl(int shmid, int cmd, struct shmid_ds *buf); } + SYS_LPATHCONF = 513 // { int lpathconf(char *path, int name); } + SYS___CAP_RIGHTS_GET = 515 // { int __cap_rights_get(int version, int fd, cap_rights_t *rightsp); } + SYS_CAP_ENTER = 516 // { int cap_enter(void); } + SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); } + SYS_PDFORK = 518 // { int pdfork(int *fdp, int flags); } + SYS_PDKILL = 519 // { int pdkill(int fd, int signum); } + SYS_PDGETPID = 520 // { int pdgetpid(int fd, pid_t *pidp); } + SYS_PSELECT = 522 // { int pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *sm); } + SYS_GETLOGINCLASS = 523 // { int getloginclass(char *namebuf, size_t namelen); } + SYS_SETLOGINCLASS = 524 // { int setloginclass(const char *namebuf); } + SYS_RCTL_GET_RACCT = 525 // { int rctl_get_racct(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } + SYS_RCTL_GET_RULES = 526 // { int rctl_get_rules(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } + SYS_RCTL_GET_LIMITS = 527 // { int rctl_get_limits(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } + SYS_RCTL_ADD_RULE = 528 // { int rctl_add_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } + SYS_RCTL_REMOVE_RULE = 529 // { int rctl_remove_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } + SYS_POSIX_FALLOCATE = 530 // { int posix_fallocate(int fd, off_t offset, off_t len); } + SYS_POSIX_FADVISE = 531 // { int posix_fadvise(int fd, off_t offset, off_t len, int advice); } + SYS_WAIT6 = 532 // { int wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *info); } + SYS_CAP_RIGHTS_LIMIT = 533 // { int cap_rights_limit(int fd, cap_rights_t *rightsp); } + SYS_CAP_IOCTLS_LIMIT = 534 // { int cap_ioctls_limit(int fd, const u_long *cmds, size_t ncmds); } + SYS_CAP_IOCTLS_GET = 535 // { ssize_t cap_ioctls_get(int fd, u_long *cmds, size_t maxcmds); } + SYS_CAP_FCNTLS_LIMIT = 536 // { int cap_fcntls_limit(int fd, uint32_t fcntlrights); } + SYS_CAP_FCNTLS_GET = 537 // { int cap_fcntls_get(int fd, uint32_t *fcntlrightsp); } + SYS_BINDAT = 538 // { int bindat(int fd, int s, caddr_t name, int namelen); } + SYS_CONNECTAT = 539 // { int connectat(int fd, int s, caddr_t name, int namelen); } + SYS_CHFLAGSAT = 540 // { int chflagsat(int fd, const char *path, u_long flags, int atflag); } + SYS_ACCEPT4 = 541 // { int accept4(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen, int flags); } + SYS_PIPE2 = 542 // { int pipe2(int *fildes, int flags); } + SYS_AIO_MLOCK = 543 // { int aio_mlock(struct aiocb *aiocbp); } + SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, int com, void *data); } + SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); } + SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); } + SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); } + SYS_FDATASYNC = 550 // { int fdatasync(int fd); } + SYS_FSTAT = 551 // { int fstat(int fd, struct stat *sb); } + SYS_FSTATAT = 552 // { int fstatat(int fd, char *path, struct stat *buf, int flag); } + SYS_FHSTAT = 553 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } + SYS_GETDIRENTRIES = 554 // { ssize_t getdirentries(int fd, char *buf, size_t count, off_t *basep); } + SYS_STATFS = 555 // { int statfs(char *path, struct statfs *buf); } + SYS_FSTATFS = 556 // { int fstatfs(int fd, struct statfs *buf); } + SYS_GETFSSTAT = 557 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } + SYS_FHSTATFS = 558 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } + SYS_MKNODAT = 559 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } + SYS_KEVENT = 560 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_CPUSET_GETDOMAIN = 561 // { int cpuset_getdomain(cpulevel_t level, cpuwhich_t which, id_t id, size_t domainsetsize, domainset_t *mask, int *policy); } + SYS_CPUSET_SETDOMAIN = 562 // { int cpuset_setdomain(cpulevel_t level, cpuwhich_t which, id_t id, size_t domainsetsize, domainset_t *mask, int policy); } + SYS_GETRANDOM = 563 // { int getrandom(void *buf, size_t buflen, unsigned int flags); } + SYS_GETFHAT = 564 // { int getfhat(int fd, char *path, struct fhandle *fhp, int flags); } + SYS_FHLINK = 565 // { int fhlink(struct fhandle *fhp, const char *to); } + SYS_FHLINKAT = 566 // { int fhlinkat(struct fhandle *fhp, int tofd, const char *to,); } + SYS_FHREADLINK = 567 // { int fhreadlink(struct fhandle *fhp, char *buf, size_t bufsize); } + SYS___SYSCTLBYNAME = 570 // { int __sysctlbyname(const char *name, size_t namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } + SYS_CLOSE_RANGE = 575 // { int close_range(u_int lowfd, u_int highfd, int flags); } +) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index 62192e1de2a7..c9c4ad0314f9 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -m32 /tmp/include/asm/unistd.h +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/386/include -m32 /tmp/386/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && linux diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 490aab5d215e..12ff3417c5fd 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -m64 /tmp/include/asm/unistd.h +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/amd64/include -m64 /tmp/amd64/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && linux diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index aca17b6fad41..c3fb5e77ab43 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/arm/include /tmp/arm/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && linux diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index 54b4dfa547f1..358c847a40c5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -fsigned-char /tmp/include/asm/unistd.h +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/arm64/include -fsigned-char /tmp/arm64/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && linux diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go index e443f9a322c8..81c4849b1619 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/loong64/include /tmp/loong64/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. //go:build loong64 && linux @@ -85,8 +85,6 @@ const ( SYS_SPLICE = 76 SYS_TEE = 77 SYS_READLINKAT = 78 - SYS_FSTATAT = 79 - SYS_FSTAT = 80 SYS_SYNC = 81 SYS_FSYNC = 82 SYS_FDATASYNC = 83 diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index 65a99efc236b..202a57e90086 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/mips/include /tmp/mips/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips && linux diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 841c8a668206..1fbceb52d7cf 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/mips64/include /tmp/mips64/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && linux diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index e26a7c7658e9..b4ffb7a207d5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/mips64le/include /tmp/mips64le/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64le && linux diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index 26447260a9ef..867985f9b440 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/mipsle/include /tmp/mipsle/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mipsle && linux diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go index 26aefc1869ae..a8cce69ede2f 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/ppc/include /tmp/ppc/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && linux diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index 8d4cd9d99d48..d44c5b39d79d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/ppc64/include /tmp/ppc64/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && linux diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index 3b405d1f82a8..4214dd9c03a7 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/ppc64le/include /tmp/ppc64le/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64le && linux diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index c3a5af8623b8..3e594a8c0910 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/riscv64/include /tmp/riscv64/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && linux @@ -309,6 +309,7 @@ const ( SYS_LANDLOCK_CREATE_RULESET = 444 SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_MEMFD_SECRET = 447 SYS_PROCESS_MRELEASE = 448 SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 8ffa66469ef9..7ea465204b7c 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -fsigned-char /tmp/include/asm/unistd.h +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/s390x/include -fsigned-char /tmp/s390x/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. //go:build s390x && linux diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 6a39640e76da..92f628ef4f23 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -1,4 +1,4 @@ -// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/sparc64/include /tmp/sparc64/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. //go:build sparc64 && linux diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go index 817edbf95c0a..597733813e37 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go @@ -6,6 +6,7 @@ package unix +// Deprecated: Use libc wrappers instead of direct syscalls. const ( SYS_EXIT = 1 // { void sys_exit(int rval); } SYS_FORK = 2 // { int sys_fork(void); } diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go index ea453614e697..16af29189940 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go @@ -6,6 +6,7 @@ package unix +// Deprecated: Use libc wrappers instead of direct syscalls. const ( SYS_EXIT = 1 // { void sys_exit(int rval); } SYS_FORK = 2 // { int sys_fork(void); } diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go index 467971eed661..f59b18a97795 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go @@ -6,6 +6,7 @@ package unix +// Deprecated: Use libc wrappers instead of direct syscalls. const ( SYS_EXIT = 1 // { void sys_exit(int rval); } SYS_FORK = 2 // { int sys_fork(void); } diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go index 32eec5ed56f1..721ef5910321 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go @@ -6,6 +6,7 @@ package unix +// Deprecated: Use libc wrappers instead of direct syscalls. const ( SYS_EXIT = 1 // { void sys_exit(int rval); } SYS_FORK = 2 // { int sys_fork(void); } diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go index a37f77375636..01c43a01fda7 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go @@ -6,6 +6,7 @@ package unix +// Deprecated: Use libc wrappers instead of direct syscalls. const ( SYS_EXIT = 1 // { void sys_exit(int rval); } SYS_FORK = 2 // { int sys_fork(void); } diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go new file mode 100644 index 000000000000..f258cfa24ed4 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go @@ -0,0 +1,218 @@ +// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build ppc64 && openbsd +// +build ppc64,openbsd + +package unix + +const ( + SYS_EXIT = 1 // { void sys_exit(int rval); } + SYS_FORK = 2 // { int sys_fork(void); } + SYS_READ = 3 // { ssize_t sys_read(int fd, void *buf, size_t nbyte); } + SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, size_t nbyte); } + SYS_OPEN = 5 // { int sys_open(const char *path, int flags, ... mode_t mode); } + SYS_CLOSE = 6 // { int sys_close(int fd); } + SYS_GETENTROPY = 7 // { int sys_getentropy(void *buf, size_t nbyte); } + SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, size_t psize); } + SYS_LINK = 9 // { int sys_link(const char *path, const char *link); } + SYS_UNLINK = 10 // { int sys_unlink(const char *path); } + SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage); } + SYS_CHDIR = 12 // { int sys_chdir(const char *path); } + SYS_FCHDIR = 13 // { int sys_fchdir(int fd); } + SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, dev_t dev); } + SYS_CHMOD = 15 // { int sys_chmod(const char *path, mode_t mode); } + SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, gid_t gid); } + SYS_OBREAK = 17 // { int sys_obreak(char *nsize); } break + SYS_GETDTABLECOUNT = 18 // { int sys_getdtablecount(void); } + SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, struct rusage *rusage); } + SYS_GETPID = 20 // { pid_t sys_getpid(void); } + SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, int flags, void *data); } + SYS_UNMOUNT = 22 // { int sys_unmount(const char *path, int flags); } + SYS_SETUID = 23 // { int sys_setuid(uid_t uid); } + SYS_GETUID = 24 // { uid_t sys_getuid(void); } + SYS_GETEUID = 25 // { uid_t sys_geteuid(void); } + SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, int data); } + SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, int flags); } + SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, const struct msghdr *msg, int flags); } + SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); } + SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, socklen_t *anamelen); } + SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); } + SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); } + SYS_ACCESS = 33 // { int sys_access(const char *path, int amode); } + SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); } + SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); } + SYS_SYNC = 36 // { void sys_sync(void); } + SYS_STAT = 38 // { int sys_stat(const char *path, struct stat *ub); } + SYS_GETPPID = 39 // { pid_t sys_getppid(void); } + SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); } + SYS_DUP = 41 // { int sys_dup(int fd); } + SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, struct stat *buf, int flag); } + SYS_GETEGID = 43 // { gid_t sys_getegid(void); } + SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, u_long offset, u_int scale); } + SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, int facs, pid_t pid); } + SYS_SIGACTION = 46 // { int sys_sigaction(int signum, const struct sigaction *nsa, struct sigaction *osa); } + SYS_GETGID = 47 // { gid_t sys_getgid(void); } + SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); } + SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); } + SYS_ACCT = 51 // { int sys_acct(const char *path); } + SYS_SIGPENDING = 52 // { int sys_sigpending(void); } + SYS_FSTAT = 53 // { int sys_fstat(int fd, struct stat *sb); } + SYS_IOCTL = 54 // { int sys_ioctl(int fd, u_long com, ... void *data); } + SYS_REBOOT = 55 // { int sys_reboot(int opt); } + SYS_REVOKE = 56 // { int sys_revoke(const char *path); } + SYS_SYMLINK = 57 // { int sys_symlink(const char *path, const char *link); } + SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, char *buf, size_t count); } + SYS_EXECVE = 59 // { int sys_execve(const char *path, char * const *argp, char * const *envp); } + SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); } + SYS_CHROOT = 61 // { int sys_chroot(const char *path); } + SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, int flags); } + SYS_STATFS = 63 // { int sys_statfs(const char *path, struct statfs *buf); } + SYS_FSTATFS = 64 // { int sys_fstatfs(int fd, struct statfs *buf); } + SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, struct statfs *buf); } + SYS_VFORK = 66 // { int sys_vfork(void); } + SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, struct timezone *tzp); } + SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp); } + SYS_SETITIMER = 69 // { int sys_setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); } + SYS_GETITIMER = 70 // { int sys_getitimer(int which, struct itimerval *itv); } + SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } + SYS_KEVENT = 72 // { int sys_kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_MUNMAP = 73 // { int sys_munmap(void *addr, size_t len); } + SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, int prot); } + SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, int behav); } + SYS_UTIMES = 76 // { int sys_utimes(const char *path, const struct timeval *tptr); } + SYS_FUTIMES = 77 // { int sys_futimes(int fd, const struct timeval *tptr); } + SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, gid_t *gidset); } + SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, const gid_t *gidset); } + SYS_GETPGRP = 81 // { int sys_getpgrp(void); } + SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, pid_t pgid); } + SYS_FUTEX = 83 // { int sys_futex(uint32_t *f, int op, int val, const struct timespec *timeout, uint32_t *g); } + SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, const struct timespec *times, int flag); } + SYS_FUTIMENS = 85 // { int sys_futimens(int fd, const struct timespec *times); } + SYS_KBIND = 86 // { int sys_kbind(const struct __kbind *param, size_t psize, int64_t proc_cookie); } + SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, struct timespec *tp); } + SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, const struct timespec *tp); } + SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, struct timespec *tp); } + SYS_DUP2 = 90 // { int sys_dup2(int from, int to); } + SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } + SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); } + SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, socklen_t *anamelen, int flags); } + SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, clockid_t clock_id, const struct timespec *tp, void *lock, const int *abort); } + SYS_FSYNC = 95 // { int sys_fsync(int fd); } + SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); } + SYS_SOCKET = 97 // { int sys_socket(int domain, int type, int protocol); } + SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, socklen_t namelen); } + SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); } + SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); } + SYS_PIPE2 = 101 // { int sys_pipe2(int *fdp, int flags); } + SYS_DUP3 = 102 // { int sys_dup3(int from, int to, int flags); } + SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); } + SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, socklen_t namelen); } + SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, const void *val, socklen_t valsize); } + SYS_LISTEN = 106 // { int sys_listen(int s, int backlog); } + SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, u_int flags, int atflags); } + SYS_PLEDGE = 108 // { int sys_pledge(const char *promises, const char *execpromises); } + SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); } + SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); } + SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); } + SYS_SENDSYSLOG = 112 // { int sys_sendsyslog(const char *buf, size_t nbyte, int flags); } + SYS_UNVEIL = 114 // { int sys_unveil(const char *path, const char *permissions); } + SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); } + SYS_THRKILL = 119 // { int sys_thrkill(pid_t tid, int signum, void *tcb); } + SYS_READV = 120 // { ssize_t sys_readv(int fd, const struct iovec *iovp, int iovcnt); } + SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, const struct iovec *iovp, int iovcnt); } + SYS_KILL = 122 // { int sys_kill(int pid, int signum); } + SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); } + SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); } + SYS_SETREUID = 126 // { int sys_setreuid(uid_t ruid, uid_t euid); } + SYS_SETREGID = 127 // { int sys_setregid(gid_t rgid, gid_t egid); } + SYS_RENAME = 128 // { int sys_rename(const char *from, const char *to); } + SYS_FLOCK = 131 // { int sys_flock(int fd, int how); } + SYS_MKFIFO = 132 // { int sys_mkfifo(const char *path, mode_t mode); } + SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); } + SYS_SHUTDOWN = 134 // { int sys_shutdown(int s, int how); } + SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, int protocol, int *rsv); } + SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); } + SYS_RMDIR = 137 // { int sys_rmdir(const char *path); } + SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, struct timeval *olddelta); } + SYS_GETLOGIN_R = 141 // { int sys_getlogin_r(char *namebuf, u_int namelen); } + SYS_SETSID = 147 // { int sys_setsid(void); } + SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, int uid, char *arg); } + SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); } + SYS_GETFH = 161 // { int sys_getfh(const char *fname, fhandle_t *fhp); } + SYS_SYSARCH = 165 // { int sys_sysarch(int op, void *parms); } + SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); } + SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); } + SYS_SETGID = 181 // { int sys_setgid(gid_t gid); } + SYS_SETEGID = 182 // { int sys_setegid(gid_t egid); } + SYS_SETEUID = 183 // { int sys_seteuid(uid_t euid); } + SYS_PATHCONF = 191 // { long sys_pathconf(const char *path, int name); } + SYS_FPATHCONF = 192 // { long sys_fpathconf(int fd, int name); } + SYS_SWAPCTL = 193 // { int sys_swapctl(int cmd, const void *arg, int misc); } + SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, struct rlimit *rlp); } + SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, const struct rlimit *rlp); } + SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } + SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, int whence); } + SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, off_t length); } + SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); } + SYS_SYSCTL = 202 // { int sys_sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } + SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); } + SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); } + SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); } + SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, size_t len); } + SYS_SEMGET = 221 // { int sys_semget(key_t key, int nsems, int semflg); } + SYS_MSGGET = 225 // { int sys_msgget(key_t key, int msgflg); } + SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } + SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } + SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, int shmflg); } + SYS_SHMDT = 230 // { int sys_shmdt(const void *shmaddr); } + SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, int inherit); } + SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_ISSETUGID = 253 // { int sys_issetugid(void); } + SYS_LCHOWN = 254 // { int sys_lchown(const char *path, uid_t uid, gid_t gid); } + SYS_GETSID = 255 // { pid_t sys_getsid(pid_t pid); } + SYS_MSYNC = 256 // { int sys_msync(void *addr, size_t len, int flags); } + SYS_PIPE = 263 // { int sys_pipe(int *fdp); } + SYS_FHOPEN = 264 // { int sys_fhopen(const fhandle_t *fhp, int flags); } + SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } + SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } + SYS_KQUEUE = 269 // { int sys_kqueue(void); } + SYS_MLOCKALL = 271 // { int sys_mlockall(int flags); } + SYS_MUNLOCKALL = 272 // { int sys_munlockall(void); } + SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } + SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); } + SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } + SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); } + SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } + SYS_CLOSEFROM = 287 // { int sys_closefrom(int fd); } + SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, struct sigaltstack *oss); } + SYS_SHMGET = 289 // { int sys_shmget(key_t key, size_t size, int shmflg); } + SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, size_t nsops); } + SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, struct stat *sb); } + SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, union semun *arg); } + SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, struct shmid_ds *buf); } + SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, struct msqid_ds *buf); } + SYS_SCHED_YIELD = 298 // { int sys_sched_yield(void); } + SYS_GETTHRID = 299 // { pid_t sys_getthrid(void); } + SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, int n); } + SYS___THREXIT = 302 // { void sys___threxit(pid_t *notdead); } + SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, siginfo_t *info, const struct timespec *timeout); } + SYS___GETCWD = 304 // { int sys___getcwd(char *buf, size_t len); } + SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, int64_t *oldfreq); } + SYS_SETRTABLE = 310 // { int sys_setrtable(int rtableid); } + SYS_GETRTABLE = 311 // { int sys_getrtable(void); } + SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, int amode, int flag); } + SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, mode_t mode, int flag); } + SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag); } + SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, const char *path2, int flag); } + SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, mode_t mode); } + SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, mode_t mode); } + SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, mode_t mode, dev_t dev); } + SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, ... mode_t mode); } + SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, char *buf, size_t count); } + SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, int tofd, const char *to); } + SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, const char *link); } + SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, int flag); } + SYS___SET_TCB = 329 // { void sys___set_tcb(void *tcb); } + SYS___GET_TCB = 330 // { void *sys___get_tcb(void); } +) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go new file mode 100644 index 000000000000..07919e0eccd9 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go @@ -0,0 +1,219 @@ +// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build riscv64 && openbsd +// +build riscv64,openbsd + +package unix + +// Deprecated: Use libc wrappers instead of direct syscalls. +const ( + SYS_EXIT = 1 // { void sys_exit(int rval); } + SYS_FORK = 2 // { int sys_fork(void); } + SYS_READ = 3 // { ssize_t sys_read(int fd, void *buf, size_t nbyte); } + SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, size_t nbyte); } + SYS_OPEN = 5 // { int sys_open(const char *path, int flags, ... mode_t mode); } + SYS_CLOSE = 6 // { int sys_close(int fd); } + SYS_GETENTROPY = 7 // { int sys_getentropy(void *buf, size_t nbyte); } + SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, size_t psize); } + SYS_LINK = 9 // { int sys_link(const char *path, const char *link); } + SYS_UNLINK = 10 // { int sys_unlink(const char *path); } + SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage); } + SYS_CHDIR = 12 // { int sys_chdir(const char *path); } + SYS_FCHDIR = 13 // { int sys_fchdir(int fd); } + SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, dev_t dev); } + SYS_CHMOD = 15 // { int sys_chmod(const char *path, mode_t mode); } + SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, gid_t gid); } + SYS_OBREAK = 17 // { int sys_obreak(char *nsize); } break + SYS_GETDTABLECOUNT = 18 // { int sys_getdtablecount(void); } + SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, struct rusage *rusage); } + SYS_GETPID = 20 // { pid_t sys_getpid(void); } + SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, int flags, void *data); } + SYS_UNMOUNT = 22 // { int sys_unmount(const char *path, int flags); } + SYS_SETUID = 23 // { int sys_setuid(uid_t uid); } + SYS_GETUID = 24 // { uid_t sys_getuid(void); } + SYS_GETEUID = 25 // { uid_t sys_geteuid(void); } + SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, int data); } + SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, int flags); } + SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, const struct msghdr *msg, int flags); } + SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); } + SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, socklen_t *anamelen); } + SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); } + SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); } + SYS_ACCESS = 33 // { int sys_access(const char *path, int amode); } + SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); } + SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); } + SYS_SYNC = 36 // { void sys_sync(void); } + SYS_STAT = 38 // { int sys_stat(const char *path, struct stat *ub); } + SYS_GETPPID = 39 // { pid_t sys_getppid(void); } + SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); } + SYS_DUP = 41 // { int sys_dup(int fd); } + SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, struct stat *buf, int flag); } + SYS_GETEGID = 43 // { gid_t sys_getegid(void); } + SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, u_long offset, u_int scale); } + SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, int facs, pid_t pid); } + SYS_SIGACTION = 46 // { int sys_sigaction(int signum, const struct sigaction *nsa, struct sigaction *osa); } + SYS_GETGID = 47 // { gid_t sys_getgid(void); } + SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); } + SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); } + SYS_ACCT = 51 // { int sys_acct(const char *path); } + SYS_SIGPENDING = 52 // { int sys_sigpending(void); } + SYS_FSTAT = 53 // { int sys_fstat(int fd, struct stat *sb); } + SYS_IOCTL = 54 // { int sys_ioctl(int fd, u_long com, ... void *data); } + SYS_REBOOT = 55 // { int sys_reboot(int opt); } + SYS_REVOKE = 56 // { int sys_revoke(const char *path); } + SYS_SYMLINK = 57 // { int sys_symlink(const char *path, const char *link); } + SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, char *buf, size_t count); } + SYS_EXECVE = 59 // { int sys_execve(const char *path, char * const *argp, char * const *envp); } + SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); } + SYS_CHROOT = 61 // { int sys_chroot(const char *path); } + SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, int flags); } + SYS_STATFS = 63 // { int sys_statfs(const char *path, struct statfs *buf); } + SYS_FSTATFS = 64 // { int sys_fstatfs(int fd, struct statfs *buf); } + SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, struct statfs *buf); } + SYS_VFORK = 66 // { int sys_vfork(void); } + SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, struct timezone *tzp); } + SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp); } + SYS_SETITIMER = 69 // { int sys_setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); } + SYS_GETITIMER = 70 // { int sys_getitimer(int which, struct itimerval *itv); } + SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } + SYS_KEVENT = 72 // { int sys_kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_MUNMAP = 73 // { int sys_munmap(void *addr, size_t len); } + SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, int prot); } + SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, int behav); } + SYS_UTIMES = 76 // { int sys_utimes(const char *path, const struct timeval *tptr); } + SYS_FUTIMES = 77 // { int sys_futimes(int fd, const struct timeval *tptr); } + SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, gid_t *gidset); } + SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, const gid_t *gidset); } + SYS_GETPGRP = 81 // { int sys_getpgrp(void); } + SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, pid_t pgid); } + SYS_FUTEX = 83 // { int sys_futex(uint32_t *f, int op, int val, const struct timespec *timeout, uint32_t *g); } + SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, const struct timespec *times, int flag); } + SYS_FUTIMENS = 85 // { int sys_futimens(int fd, const struct timespec *times); } + SYS_KBIND = 86 // { int sys_kbind(const struct __kbind *param, size_t psize, int64_t proc_cookie); } + SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, struct timespec *tp); } + SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, const struct timespec *tp); } + SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, struct timespec *tp); } + SYS_DUP2 = 90 // { int sys_dup2(int from, int to); } + SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } + SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); } + SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, socklen_t *anamelen, int flags); } + SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, clockid_t clock_id, const struct timespec *tp, void *lock, const int *abort); } + SYS_FSYNC = 95 // { int sys_fsync(int fd); } + SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); } + SYS_SOCKET = 97 // { int sys_socket(int domain, int type, int protocol); } + SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, socklen_t namelen); } + SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); } + SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); } + SYS_PIPE2 = 101 // { int sys_pipe2(int *fdp, int flags); } + SYS_DUP3 = 102 // { int sys_dup3(int from, int to, int flags); } + SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); } + SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, socklen_t namelen); } + SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, const void *val, socklen_t valsize); } + SYS_LISTEN = 106 // { int sys_listen(int s, int backlog); } + SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, u_int flags, int atflags); } + SYS_PLEDGE = 108 // { int sys_pledge(const char *promises, const char *execpromises); } + SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); } + SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); } + SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); } + SYS_SENDSYSLOG = 112 // { int sys_sendsyslog(const char *buf, size_t nbyte, int flags); } + SYS_UNVEIL = 114 // { int sys_unveil(const char *path, const char *permissions); } + SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); } + SYS_THRKILL = 119 // { int sys_thrkill(pid_t tid, int signum, void *tcb); } + SYS_READV = 120 // { ssize_t sys_readv(int fd, const struct iovec *iovp, int iovcnt); } + SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, const struct iovec *iovp, int iovcnt); } + SYS_KILL = 122 // { int sys_kill(int pid, int signum); } + SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); } + SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); } + SYS_SETREUID = 126 // { int sys_setreuid(uid_t ruid, uid_t euid); } + SYS_SETREGID = 127 // { int sys_setregid(gid_t rgid, gid_t egid); } + SYS_RENAME = 128 // { int sys_rename(const char *from, const char *to); } + SYS_FLOCK = 131 // { int sys_flock(int fd, int how); } + SYS_MKFIFO = 132 // { int sys_mkfifo(const char *path, mode_t mode); } + SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); } + SYS_SHUTDOWN = 134 // { int sys_shutdown(int s, int how); } + SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, int protocol, int *rsv); } + SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); } + SYS_RMDIR = 137 // { int sys_rmdir(const char *path); } + SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, struct timeval *olddelta); } + SYS_GETLOGIN_R = 141 // { int sys_getlogin_r(char *namebuf, u_int namelen); } + SYS_SETSID = 147 // { int sys_setsid(void); } + SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, int uid, char *arg); } + SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); } + SYS_GETFH = 161 // { int sys_getfh(const char *fname, fhandle_t *fhp); } + SYS_SYSARCH = 165 // { int sys_sysarch(int op, void *parms); } + SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); } + SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); } + SYS_SETGID = 181 // { int sys_setgid(gid_t gid); } + SYS_SETEGID = 182 // { int sys_setegid(gid_t egid); } + SYS_SETEUID = 183 // { int sys_seteuid(uid_t euid); } + SYS_PATHCONF = 191 // { long sys_pathconf(const char *path, int name); } + SYS_FPATHCONF = 192 // { long sys_fpathconf(int fd, int name); } + SYS_SWAPCTL = 193 // { int sys_swapctl(int cmd, const void *arg, int misc); } + SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, struct rlimit *rlp); } + SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, const struct rlimit *rlp); } + SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } + SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, int whence); } + SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, off_t length); } + SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); } + SYS_SYSCTL = 202 // { int sys_sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } + SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); } + SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); } + SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); } + SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, size_t len); } + SYS_SEMGET = 221 // { int sys_semget(key_t key, int nsems, int semflg); } + SYS_MSGGET = 225 // { int sys_msgget(key_t key, int msgflg); } + SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } + SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } + SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, int shmflg); } + SYS_SHMDT = 230 // { int sys_shmdt(const void *shmaddr); } + SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, int inherit); } + SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_ISSETUGID = 253 // { int sys_issetugid(void); } + SYS_LCHOWN = 254 // { int sys_lchown(const char *path, uid_t uid, gid_t gid); } + SYS_GETSID = 255 // { pid_t sys_getsid(pid_t pid); } + SYS_MSYNC = 256 // { int sys_msync(void *addr, size_t len, int flags); } + SYS_PIPE = 263 // { int sys_pipe(int *fdp); } + SYS_FHOPEN = 264 // { int sys_fhopen(const fhandle_t *fhp, int flags); } + SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } + SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } + SYS_KQUEUE = 269 // { int sys_kqueue(void); } + SYS_MLOCKALL = 271 // { int sys_mlockall(int flags); } + SYS_MUNLOCKALL = 272 // { int sys_munlockall(void); } + SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } + SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); } + SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } + SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); } + SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } + SYS_CLOSEFROM = 287 // { int sys_closefrom(int fd); } + SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, struct sigaltstack *oss); } + SYS_SHMGET = 289 // { int sys_shmget(key_t key, size_t size, int shmflg); } + SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, size_t nsops); } + SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, struct stat *sb); } + SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, union semun *arg); } + SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, struct shmid_ds *buf); } + SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, struct msqid_ds *buf); } + SYS_SCHED_YIELD = 298 // { int sys_sched_yield(void); } + SYS_GETTHRID = 299 // { pid_t sys_getthrid(void); } + SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, int n); } + SYS___THREXIT = 302 // { void sys___threxit(pid_t *notdead); } + SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, siginfo_t *info, const struct timespec *timeout); } + SYS___GETCWD = 304 // { int sys___getcwd(char *buf, size_t len); } + SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, int64_t *oldfreq); } + SYS_SETRTABLE = 310 // { int sys_setrtable(int rtableid); } + SYS_GETRTABLE = 311 // { int sys_getrtable(void); } + SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, int amode, int flag); } + SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, mode_t mode, int flag); } + SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag); } + SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, const char *path2, int flag); } + SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, mode_t mode); } + SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, mode_t mode); } + SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, mode_t mode, dev_t dev); } + SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, ... mode_t mode); } + SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, char *buf, size_t count); } + SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, int tofd, const char *to); } + SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, const char *link); } + SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, int flag); } + SYS___SET_TCB = 329 // { void sys___set_tcb(void *tcb); } + SYS___GET_TCB = 330 // { void *sys___get_tcb(void); } +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 885842c0eb40..e2a64f0991a0 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -366,30 +366,57 @@ type ICMPv6Filter struct { Filt [8]uint32 } +type TCPConnectionInfo struct { + State uint8 + Snd_wscale uint8 + Rcv_wscale uint8 + _ uint8 + Options uint32 + Flags uint32 + Rto uint32 + Maxseg uint32 + Snd_ssthresh uint32 + Snd_cwnd uint32 + Snd_wnd uint32 + Snd_sbbytes uint32 + Rcv_wnd uint32 + Rttcur uint32 + Srtt uint32 + Rttvar uint32 + Txpackets uint64 + Txbytes uint64 + Txretransmitbytes uint64 + Rxpackets uint64 + Rxbytes uint64 + Rxoutoforderbytes uint64 + Txretransmitpackets uint64 +} + const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x6c - SizeofSockaddrUnix = 0x6a - SizeofSockaddrDatalink = 0x14 - SizeofSockaddrCtl = 0x20 - SizeofSockaddrVM = 0xc - SizeofXvsockpcb = 0xa8 - SizeofXSocket = 0x64 - SizeofXSockbuf = 0x18 - SizeofXVSockPgen = 0x20 - SizeofXucred = 0x4c - SizeofLinger = 0x8 - SizeofIovec = 0x10 - SizeofIPMreq = 0x8 - SizeofIPMreqn = 0xc - SizeofIPv6Mreq = 0x14 - SizeofMsghdr = 0x30 - SizeofCmsghdr = 0xc - SizeofInet4Pktinfo = 0xc - SizeofInet6Pktinfo = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofICMPv6Filter = 0x20 + SizeofSockaddrInet4 = 0x10 + SizeofSockaddrInet6 = 0x1c + SizeofSockaddrAny = 0x6c + SizeofSockaddrUnix = 0x6a + SizeofSockaddrDatalink = 0x14 + SizeofSockaddrCtl = 0x20 + SizeofSockaddrVM = 0xc + SizeofXvsockpcb = 0xa8 + SizeofXSocket = 0x64 + SizeofXSockbuf = 0x18 + SizeofXVSockPgen = 0x20 + SizeofXucred = 0x4c + SizeofLinger = 0x8 + SizeofIovec = 0x10 + SizeofIPMreq = 0x8 + SizeofIPMreqn = 0xc + SizeofIPv6Mreq = 0x14 + SizeofMsghdr = 0x30 + SizeofCmsghdr = 0xc + SizeofInet4Pktinfo = 0xc + SizeofInet6Pktinfo = 0x14 + SizeofIPv6MTUInfo = 0x20 + SizeofICMPv6Filter = 0x20 + SizeofTCPConnectionInfo = 0x70 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index b23c02337db3..34aa775219f0 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -366,30 +366,57 @@ type ICMPv6Filter struct { Filt [8]uint32 } +type TCPConnectionInfo struct { + State uint8 + Snd_wscale uint8 + Rcv_wscale uint8 + _ uint8 + Options uint32 + Flags uint32 + Rto uint32 + Maxseg uint32 + Snd_ssthresh uint32 + Snd_cwnd uint32 + Snd_wnd uint32 + Snd_sbbytes uint32 + Rcv_wnd uint32 + Rttcur uint32 + Srtt uint32 + Rttvar uint32 + Txpackets uint64 + Txbytes uint64 + Txretransmitbytes uint64 + Rxpackets uint64 + Rxbytes uint64 + Rxoutoforderbytes uint64 + Txretransmitpackets uint64 +} + const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x6c - SizeofSockaddrUnix = 0x6a - SizeofSockaddrDatalink = 0x14 - SizeofSockaddrCtl = 0x20 - SizeofSockaddrVM = 0xc - SizeofXvsockpcb = 0xa8 - SizeofXSocket = 0x64 - SizeofXSockbuf = 0x18 - SizeofXVSockPgen = 0x20 - SizeofXucred = 0x4c - SizeofLinger = 0x8 - SizeofIovec = 0x10 - SizeofIPMreq = 0x8 - SizeofIPMreqn = 0xc - SizeofIPv6Mreq = 0x14 - SizeofMsghdr = 0x30 - SizeofCmsghdr = 0xc - SizeofInet4Pktinfo = 0xc - SizeofInet6Pktinfo = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofICMPv6Filter = 0x20 + SizeofSockaddrInet4 = 0x10 + SizeofSockaddrInet6 = 0x1c + SizeofSockaddrAny = 0x6c + SizeofSockaddrUnix = 0x6a + SizeofSockaddrDatalink = 0x14 + SizeofSockaddrCtl = 0x20 + SizeofSockaddrVM = 0xc + SizeofXvsockpcb = 0xa8 + SizeofXSocket = 0x64 + SizeofXSockbuf = 0x18 + SizeofXVSockPgen = 0x20 + SizeofXucred = 0x4c + SizeofLinger = 0x8 + SizeofIovec = 0x10 + SizeofIPMreq = 0x8 + SizeofIPMreqn = 0xc + SizeofIPv6Mreq = 0x14 + SizeofMsghdr = 0x30 + SizeofCmsghdr = 0xc + SizeofInet4Pktinfo = 0xc + SizeofInet6Pktinfo = 0x14 + SizeofIPv6MTUInfo = 0x20 + SizeofICMPv6Filter = 0x20 + SizeofTCPConnectionInfo = 0x70 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go index 4eec078e5249..d9c78cdcbc45 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go @@ -90,27 +90,6 @@ type Stat_t struct { Spare [10]uint64 } -type stat_freebsd11_t struct { - Dev uint32 - Ino uint32 - Mode uint16 - Nlink uint16 - Uid uint32 - Gid uint32 - Rdev uint32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Btim Timespec - _ [8]byte -} - type Statfs_t struct { Version uint32 Type uint32 @@ -136,31 +115,6 @@ type Statfs_t struct { Mntonname [1024]byte } -type statfs_freebsd11_t struct { - Version uint32 - Type uint32 - Flags uint64 - Bsize uint64 - Iosize uint64 - Blocks uint64 - Bfree uint64 - Bavail int64 - Files uint64 - Ffree int64 - Syncwrites uint64 - Asyncwrites uint64 - Syncreads uint64 - Asyncreads uint64 - Spare [10]uint64 - Namemax uint32 - Owner uint32 - Fsid Fsid - Charspare [80]int8 - Fstypename [16]byte - Mntfromname [88]byte - Mntonname [88]byte -} - type Flock_t struct { Start int64 Len int64 @@ -181,14 +135,6 @@ type Dirent struct { Name [256]int8 } -type dirent_freebsd11 struct { - Fileno uint32 - Reclen uint16 - Type uint8 - Namlen uint8 - Name [256]int8 -} - type Fsid struct { Val [2]int32 } @@ -337,41 +283,9 @@ const ( ) const ( - PTRACE_ATTACH = 0xa - PTRACE_CONT = 0x7 - PTRACE_DETACH = 0xb - PTRACE_GETFPREGS = 0x23 - PTRACE_GETFSBASE = 0x47 - PTRACE_GETLWPLIST = 0xf - PTRACE_GETNUMLWPS = 0xe - PTRACE_GETREGS = 0x21 - PTRACE_GETXSTATE = 0x45 - PTRACE_IO = 0xc - PTRACE_KILL = 0x8 - PTRACE_LWPEVENTS = 0x18 - PTRACE_LWPINFO = 0xd - PTRACE_SETFPREGS = 0x24 - PTRACE_SETREGS = 0x22 - PTRACE_SINGLESTEP = 0x9 - PTRACE_TRACEME = 0x0 -) - -const ( - PIOD_READ_D = 0x1 - PIOD_WRITE_D = 0x2 - PIOD_READ_I = 0x3 - PIOD_WRITE_I = 0x4 -) - -const ( - PL_FLAG_BORN = 0x100 - PL_FLAG_EXITED = 0x200 - PL_FLAG_SI = 0x20 -) - -const ( - TRAP_BRKPT = 0x1 - TRAP_TRACE = 0x2 + PTRACE_TRACEME = 0x0 + PTRACE_CONT = 0x7 + PTRACE_KILL = 0x8 ) type PtraceLwpInfoStruct struct { @@ -380,7 +294,7 @@ type PtraceLwpInfoStruct struct { Flags int32 Sigmask Sigset_t Siglist Sigset_t - Siginfo __Siginfo + Siginfo __PtraceSiginfo Tdname [20]int8 Child_pid int32 Syscall_code uint32 @@ -398,6 +312,17 @@ type __Siginfo struct { Value [4]byte _ [32]byte } +type __PtraceSiginfo struct { + Signo int32 + Errno int32 + Code int32 + Pid int32 + Uid uint32 + Status int32 + Addr uintptr + Value [4]byte + _ [32]byte +} type Sigset_t struct { Val [4]uint32 @@ -432,10 +357,12 @@ type FpReg struct { Pad [64]uint8 } +type FpExtendedPrecision struct{} + type PtraceIoDesc struct { Op int32 - Offs *byte - Addr *byte + Offs uintptr + Addr uintptr Len uint32 } @@ -444,8 +371,9 @@ type Kevent_t struct { Filter int16 Flags uint16 Fflags uint32 - Data int32 + Data int64 Udata *byte + Ext [4]uint64 } type FdSet struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go index 7622904a532f..26991b165596 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go @@ -86,26 +86,6 @@ type Stat_t struct { Spare [10]uint64 } -type stat_freebsd11_t struct { - Dev uint32 - Ino uint32 - Mode uint16 - Nlink uint16 - Uid uint32 - Gid uint32 - Rdev uint32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Btim Timespec -} - type Statfs_t struct { Version uint32 Type uint32 @@ -131,31 +111,6 @@ type Statfs_t struct { Mntonname [1024]byte } -type statfs_freebsd11_t struct { - Version uint32 - Type uint32 - Flags uint64 - Bsize uint64 - Iosize uint64 - Blocks uint64 - Bfree uint64 - Bavail int64 - Files uint64 - Ffree int64 - Syncwrites uint64 - Asyncwrites uint64 - Syncreads uint64 - Asyncreads uint64 - Spare [10]uint64 - Namemax uint32 - Owner uint32 - Fsid Fsid - Charspare [80]int8 - Fstypename [16]byte - Mntfromname [88]byte - Mntonname [88]byte -} - type Flock_t struct { Start int64 Len int64 @@ -177,14 +132,6 @@ type Dirent struct { Name [256]int8 } -type dirent_freebsd11 struct { - Fileno uint32 - Reclen uint16 - Type uint8 - Namlen uint8 - Name [256]int8 -} - type Fsid struct { Val [2]int32 } @@ -333,41 +280,9 @@ const ( ) const ( - PTRACE_ATTACH = 0xa - PTRACE_CONT = 0x7 - PTRACE_DETACH = 0xb - PTRACE_GETFPREGS = 0x23 - PTRACE_GETFSBASE = 0x47 - PTRACE_GETLWPLIST = 0xf - PTRACE_GETNUMLWPS = 0xe - PTRACE_GETREGS = 0x21 - PTRACE_GETXSTATE = 0x45 - PTRACE_IO = 0xc - PTRACE_KILL = 0x8 - PTRACE_LWPEVENTS = 0x18 - PTRACE_LWPINFO = 0xd - PTRACE_SETFPREGS = 0x24 - PTRACE_SETREGS = 0x22 - PTRACE_SINGLESTEP = 0x9 - PTRACE_TRACEME = 0x0 -) - -const ( - PIOD_READ_D = 0x1 - PIOD_WRITE_D = 0x2 - PIOD_READ_I = 0x3 - PIOD_WRITE_I = 0x4 -) - -const ( - PL_FLAG_BORN = 0x100 - PL_FLAG_EXITED = 0x200 - PL_FLAG_SI = 0x20 -) - -const ( - TRAP_BRKPT = 0x1 - TRAP_TRACE = 0x2 + PTRACE_TRACEME = 0x0 + PTRACE_CONT = 0x7 + PTRACE_KILL = 0x8 ) type PtraceLwpInfoStruct struct { @@ -376,7 +291,7 @@ type PtraceLwpInfoStruct struct { Flags int32 Sigmask Sigset_t Siglist Sigset_t - Siginfo __Siginfo + Siginfo __PtraceSiginfo Tdname [20]int8 Child_pid int32 Syscall_code uint32 @@ -395,6 +310,18 @@ type __Siginfo struct { _ [40]byte } +type __PtraceSiginfo struct { + Signo int32 + Errno int32 + Code int32 + Pid int32 + Uid uint32 + Status int32 + Addr uintptr + Value [8]byte + _ [40]byte +} + type Sigset_t struct { Val [4]uint32 } @@ -435,10 +362,12 @@ type FpReg struct { Spare [12]uint64 } +type FpExtendedPrecision struct{} + type PtraceIoDesc struct { Op int32 - Offs *byte - Addr *byte + Offs uintptr + Addr uintptr Len uint64 } @@ -449,6 +378,7 @@ type Kevent_t struct { Fflags uint32 Data int64 Udata *byte + Ext [4]uint64 } type FdSet struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go index 19223ce8ecf9..f8324e7e7f49 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go @@ -33,7 +33,7 @@ type Timeval struct { _ [4]byte } -type Time_t int32 +type Time_t int64 type Rusage struct { Utime Timeval @@ -88,26 +88,6 @@ type Stat_t struct { Spare [10]uint64 } -type stat_freebsd11_t struct { - Dev uint32 - Ino uint32 - Mode uint16 - Nlink uint16 - Uid uint32 - Gid uint32 - Rdev uint32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Btim Timespec -} - type Statfs_t struct { Version uint32 Type uint32 @@ -133,31 +113,6 @@ type Statfs_t struct { Mntonname [1024]byte } -type statfs_freebsd11_t struct { - Version uint32 - Type uint32 - Flags uint64 - Bsize uint64 - Iosize uint64 - Blocks uint64 - Bfree uint64 - Bavail int64 - Files uint64 - Ffree int64 - Syncwrites uint64 - Asyncwrites uint64 - Syncreads uint64 - Asyncreads uint64 - Spare [10]uint64 - Namemax uint32 - Owner uint32 - Fsid Fsid - Charspare [80]int8 - Fstypename [16]byte - Mntfromname [88]byte - Mntonname [88]byte -} - type Flock_t struct { Start int64 Len int64 @@ -179,14 +134,6 @@ type Dirent struct { Name [256]int8 } -type dirent_freebsd11 struct { - Fileno uint32 - Reclen uint16 - Type uint8 - Namlen uint8 - Name [256]int8 -} - type Fsid struct { Val [2]int32 } @@ -335,41 +282,9 @@ const ( ) const ( - PTRACE_ATTACH = 0xa - PTRACE_CONT = 0x7 - PTRACE_DETACH = 0xb - PTRACE_GETFPREGS = 0x23 - PTRACE_GETFSBASE = 0x47 - PTRACE_GETLWPLIST = 0xf - PTRACE_GETNUMLWPS = 0xe - PTRACE_GETREGS = 0x21 - PTRACE_GETXSTATE = 0x45 - PTRACE_IO = 0xc - PTRACE_KILL = 0x8 - PTRACE_LWPEVENTS = 0x18 - PTRACE_LWPINFO = 0xd - PTRACE_SETFPREGS = 0x24 - PTRACE_SETREGS = 0x22 - PTRACE_SINGLESTEP = 0x9 - PTRACE_TRACEME = 0x0 -) - -const ( - PIOD_READ_D = 0x1 - PIOD_WRITE_D = 0x2 - PIOD_READ_I = 0x3 - PIOD_WRITE_I = 0x4 -) - -const ( - PL_FLAG_BORN = 0x100 - PL_FLAG_EXITED = 0x200 - PL_FLAG_SI = 0x20 -) - -const ( - TRAP_BRKPT = 0x1 - TRAP_TRACE = 0x2 + PTRACE_TRACEME = 0x0 + PTRACE_CONT = 0x7 + PTRACE_KILL = 0x8 ) type PtraceLwpInfoStruct struct { @@ -378,7 +293,7 @@ type PtraceLwpInfoStruct struct { Flags int32 Sigmask Sigset_t Siglist Sigset_t - Siginfo __Siginfo + Siginfo __PtraceSiginfo Tdname [20]int8 Child_pid int32 Syscall_code uint32 @@ -386,15 +301,27 @@ type PtraceLwpInfoStruct struct { } type __Siginfo struct { - Signo int32 - Errno int32 - Code int32 - Pid int32 - Uid uint32 - Status int32 - Addr *byte - Value [4]byte - X_reason [32]byte + Signo int32 + Errno int32 + Code int32 + Pid int32 + Uid uint32 + Status int32 + Addr *byte + Value [4]byte + _ [32]byte +} + +type __PtraceSiginfo struct { + Signo int32 + Errno int32 + Code int32 + Pid int32 + Uid uint32 + Status int32 + Addr uintptr + Value [4]byte + _ [32]byte } type Sigset_t struct { @@ -402,22 +329,28 @@ type Sigset_t struct { } type Reg struct { - R [13]uint32 - R_sp uint32 - R_lr uint32 - R_pc uint32 - R_cpsr uint32 + R [13]uint32 + Sp uint32 + Lr uint32 + Pc uint32 + Cpsr uint32 } type FpReg struct { - Fpr_fpsr uint32 - Fpr [8][3]uint32 + Fpsr uint32 + Fpr [8]FpExtendedPrecision +} + +type FpExtendedPrecision struct { + Exponent uint32 + Mantissa_hi uint32 + Mantissa_lo uint32 } type PtraceIoDesc struct { Op int32 - Offs *byte - Addr *byte + Offs uintptr + Addr uintptr Len uint32 } @@ -426,8 +359,11 @@ type Kevent_t struct { Filter int16 Flags uint16 Fflags uint32 - Data int32 + _ [4]byte + Data int64 Udata *byte + _ [4]byte + Ext [4]uint64 } type FdSet struct { @@ -453,7 +389,7 @@ type ifMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte + _ uint16 Data ifData } @@ -464,7 +400,6 @@ type IfMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Data IfData } @@ -532,7 +467,7 @@ type IfaMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte + _ uint16 Metric int32 } @@ -543,7 +478,7 @@ type IfmaMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte + _ uint16 } type IfAnnounceMsghdr struct { @@ -560,7 +495,7 @@ type RtMsghdr struct { Version uint8 Type uint8 Index uint16 - _ [2]byte + _ uint16 Flags int32 Addrs int32 Pid int32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go index 8e3e33f67905..4220411f341a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go @@ -86,26 +86,6 @@ type Stat_t struct { Spare [10]uint64 } -type stat_freebsd11_t struct { - Dev uint32 - Ino uint32 - Mode uint16 - Nlink uint16 - Uid uint32 - Gid uint32 - Rdev uint32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Btim Timespec -} - type Statfs_t struct { Version uint32 Type uint32 @@ -131,31 +111,6 @@ type Statfs_t struct { Mntonname [1024]byte } -type statfs_freebsd11_t struct { - Version uint32 - Type uint32 - Flags uint64 - Bsize uint64 - Iosize uint64 - Blocks uint64 - Bfree uint64 - Bavail int64 - Files uint64 - Ffree int64 - Syncwrites uint64 - Asyncwrites uint64 - Syncreads uint64 - Asyncreads uint64 - Spare [10]uint64 - Namemax uint32 - Owner uint32 - Fsid Fsid - Charspare [80]int8 - Fstypename [16]byte - Mntfromname [88]byte - Mntonname [88]byte -} - type Flock_t struct { Start int64 Len int64 @@ -177,14 +132,6 @@ type Dirent struct { Name [256]int8 } -type dirent_freebsd11 struct { - Fileno uint32 - Reclen uint16 - Type uint8 - Namlen uint8 - Name [256]int8 -} - type Fsid struct { Val [2]int32 } @@ -333,39 +280,9 @@ const ( ) const ( - PTRACE_ATTACH = 0xa - PTRACE_CONT = 0x7 - PTRACE_DETACH = 0xb - PTRACE_GETFPREGS = 0x23 - PTRACE_GETLWPLIST = 0xf - PTRACE_GETNUMLWPS = 0xe - PTRACE_GETREGS = 0x21 - PTRACE_IO = 0xc - PTRACE_KILL = 0x8 - PTRACE_LWPEVENTS = 0x18 - PTRACE_LWPINFO = 0xd - PTRACE_SETFPREGS = 0x24 - PTRACE_SETREGS = 0x22 - PTRACE_SINGLESTEP = 0x9 - PTRACE_TRACEME = 0x0 -) - -const ( - PIOD_READ_D = 0x1 - PIOD_WRITE_D = 0x2 - PIOD_READ_I = 0x3 - PIOD_WRITE_I = 0x4 -) - -const ( - PL_FLAG_BORN = 0x100 - PL_FLAG_EXITED = 0x200 - PL_FLAG_SI = 0x20 -) - -const ( - TRAP_BRKPT = 0x1 - TRAP_TRACE = 0x2 + PTRACE_TRACEME = 0x0 + PTRACE_CONT = 0x7 + PTRACE_KILL = 0x8 ) type PtraceLwpInfoStruct struct { @@ -374,7 +291,7 @@ type PtraceLwpInfoStruct struct { Flags int32 Sigmask Sigset_t Siglist Sigset_t - Siginfo __Siginfo + Siginfo __PtraceSiginfo Tdname [20]int8 Child_pid int32 Syscall_code uint32 @@ -393,6 +310,18 @@ type __Siginfo struct { _ [40]byte } +type __PtraceSiginfo struct { + Signo int32 + Errno int32 + Code int32 + Pid int32 + Uid uint32 + Status int32 + Addr uintptr + Value [8]byte + _ [40]byte +} + type Sigset_t struct { Val [4]uint32 } @@ -413,10 +342,12 @@ type FpReg struct { _ [8]byte } +type FpExtendedPrecision struct{} + type PtraceIoDesc struct { Op int32 - Offs *byte - Addr *byte + Offs uintptr + Addr uintptr Len uint64 } @@ -427,6 +358,7 @@ type Kevent_t struct { Fflags uint32 Data int64 Udata *byte + Ext [4]uint64 } type FdSet struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go new file mode 100644 index 000000000000..0660fd45c7c6 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go @@ -0,0 +1,638 @@ +// cgo -godefs -- -fsigned-char types_freebsd.go | go run mkpost.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build riscv64 && freebsd +// +build riscv64,freebsd + +package unix + +const ( + SizeofPtr = 0x8 + SizeofShort = 0x2 + SizeofInt = 0x4 + SizeofLong = 0x8 + SizeofLongLong = 0x8 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Time_t int64 + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur int64 + Max int64 +} + +type _Gid_t uint32 + +const ( + _statfsVersion = 0x20140518 + _dirblksiz = 0x400 +) + +type Stat_t struct { + Dev uint64 + Ino uint64 + Nlink uint64 + Mode uint16 + _0 int16 + Uid uint32 + Gid uint32 + _1 int32 + Rdev uint64 + Atim Timespec + Mtim Timespec + Ctim Timespec + Btim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint64 + Spare [10]uint64 +} + +type Statfs_t struct { + Version uint32 + Type uint32 + Flags uint64 + Bsize uint64 + Iosize uint64 + Blocks uint64 + Bfree uint64 + Bavail int64 + Files uint64 + Ffree int64 + Syncwrites uint64 + Asyncwrites uint64 + Syncreads uint64 + Asyncreads uint64 + Spare [10]uint64 + Namemax uint32 + Owner uint32 + Fsid Fsid + Charspare [80]int8 + Fstypename [16]byte + Mntfromname [1024]byte + Mntonname [1024]byte +} + +type Flock_t struct { + Start int64 + Len int64 + Pid int32 + Type int16 + Whence int16 + Sysid int32 + _ [4]byte +} + +type Dirent struct { + Fileno uint64 + Off int64 + Reclen uint16 + Type uint8 + Pad0 uint8 + Namlen uint16 + Pad1 uint16 + Name [256]int8 +} + +type Fsid struct { + Val [2]int32 +} + +const ( + PathMax = 0x400 +) + +const ( + FADV_NORMAL = 0x0 + FADV_RANDOM = 0x1 + FADV_SEQUENTIAL = 0x2 + FADV_WILLNEED = 0x3 + FADV_DONTNEED = 0x4 + FADV_NOREUSE = 0x5 +) + +type RawSockaddrInet4 struct { + Len uint8 + Family uint8 + Port uint16 + Addr [4]byte /* in_addr */ + Zero [8]int8 +} + +type RawSockaddrInet6 struct { + Len uint8 + Family uint8 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 +} + +type RawSockaddrUnix struct { + Len uint8 + Family uint8 + Path [104]int8 +} + +type RawSockaddrDatalink struct { + Len uint8 + Family uint8 + Index uint16 + Type uint8 + Nlen uint8 + Alen uint8 + Slen uint8 + Data [46]int8 +} + +type RawSockaddr struct { + Len uint8 + Family uint8 + Data [14]int8 +} + +type RawSockaddrAny struct { + Addr RawSockaddr + Pad [92]int8 +} + +type _Socklen uint32 + +type Xucred struct { + Version uint32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 + _ *byte +} + +type Linger struct { + Onoff int32 + Linger int32 +} + +type Iovec struct { + Base *byte + Len uint64 +} + +type IPMreq struct { + Multiaddr [4]byte /* in_addr */ + Interface [4]byte /* in_addr */ +} + +type IPMreqn struct { + Multiaddr [4]byte /* in_addr */ + Address [4]byte /* in_addr */ + Ifindex int32 +} + +type IPv6Mreq struct { + Multiaddr [16]byte /* in6_addr */ + Interface uint32 +} + +type Msghdr struct { + Name *byte + Namelen uint32 + Iov *Iovec + Iovlen int32 + Control *byte + Controllen uint32 + Flags int32 +} + +type Cmsghdr struct { + Len uint32 + Level int32 + Type int32 +} + +type Inet6Pktinfo struct { + Addr [16]byte /* in6_addr */ + Ifindex uint32 +} + +type IPv6MTUInfo struct { + Addr RawSockaddrInet6 + Mtu uint32 +} + +type ICMPv6Filter struct { + Filt [8]uint32 +} + +const ( + SizeofSockaddrInet4 = 0x10 + SizeofSockaddrInet6 = 0x1c + SizeofSockaddrAny = 0x6c + SizeofSockaddrUnix = 0x6a + SizeofSockaddrDatalink = 0x36 + SizeofXucred = 0x58 + SizeofLinger = 0x8 + SizeofIovec = 0x10 + SizeofIPMreq = 0x8 + SizeofIPMreqn = 0xc + SizeofIPv6Mreq = 0x14 + SizeofMsghdr = 0x30 + SizeofCmsghdr = 0xc + SizeofInet6Pktinfo = 0x14 + SizeofIPv6MTUInfo = 0x20 + SizeofICMPv6Filter = 0x20 +) + +const ( + PTRACE_TRACEME = 0x0 + PTRACE_CONT = 0x7 + PTRACE_KILL = 0x8 +) + +type PtraceLwpInfoStruct struct { + Lwpid int32 + Event int32 + Flags int32 + Sigmask Sigset_t + Siglist Sigset_t + Siginfo __PtraceSiginfo + Tdname [20]int8 + Child_pid int32 + Syscall_code uint32 + Syscall_narg uint32 +} + +type __Siginfo struct { + Signo int32 + Errno int32 + Code int32 + Pid int32 + Uid uint32 + Status int32 + Addr *byte + Value [8]byte + _ [40]byte +} + +type __PtraceSiginfo struct { + Signo int32 + Errno int32 + Code int32 + Pid int32 + Uid uint32 + Status int32 + Addr uintptr + Value [8]byte + _ [40]byte +} + +type Sigset_t struct { + Val [4]uint32 +} + +type Reg struct { + Ra uint64 + Sp uint64 + Gp uint64 + Tp uint64 + T [7]uint64 + S [12]uint64 + A [8]uint64 + Sepc uint64 + Sstatus uint64 +} + +type FpReg struct { + X [32][2]uint64 + Fcsr uint64 +} + +type FpExtendedPrecision struct{} + +type PtraceIoDesc struct { + Op int32 + Offs uintptr + Addr uintptr + Len uint64 +} + +type Kevent_t struct { + Ident uint64 + Filter int16 + Flags uint16 + Fflags uint32 + Data int64 + Udata *byte + Ext [4]uint64 +} + +type FdSet struct { + Bits [16]uint64 +} + +const ( + sizeofIfMsghdr = 0xa8 + SizeofIfMsghdr = 0xa8 + sizeofIfData = 0x98 + SizeofIfData = 0x98 + SizeofIfaMsghdr = 0x14 + SizeofIfmaMsghdr = 0x10 + SizeofIfAnnounceMsghdr = 0x18 + SizeofRtMsghdr = 0x98 + SizeofRtMetrics = 0x70 +) + +type ifMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + _ uint16 + Data ifData +} + +type IfMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Data IfData +} + +type ifData struct { + Type uint8 + Physical uint8 + Addrlen uint8 + Hdrlen uint8 + Link_state uint8 + Vhid uint8 + Datalen uint16 + Mtu uint32 + Metric uint32 + Baudrate uint64 + Ipackets uint64 + Ierrors uint64 + Opackets uint64 + Oerrors uint64 + Collisions uint64 + Ibytes uint64 + Obytes uint64 + Imcasts uint64 + Omcasts uint64 + Iqdrops uint64 + Oqdrops uint64 + Noproto uint64 + Hwassist uint64 + _ [8]byte + _ [16]byte +} + +type IfData struct { + Type uint8 + Physical uint8 + Addrlen uint8 + Hdrlen uint8 + Link_state uint8 + Spare_char1 uint8 + Spare_char2 uint8 + Datalen uint8 + Mtu uint64 + Metric uint64 + Baudrate uint64 + Ipackets uint64 + Ierrors uint64 + Opackets uint64 + Oerrors uint64 + Collisions uint64 + Ibytes uint64 + Obytes uint64 + Imcasts uint64 + Omcasts uint64 + Iqdrops uint64 + Noproto uint64 + Hwassist uint64 + Epoch int64 + Lastchange Timeval +} + +type IfaMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + _ uint16 + Metric int32 +} + +type IfmaMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + _ uint16 +} + +type IfAnnounceMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Index uint16 + Name [16]int8 + What uint16 +} + +type RtMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Index uint16 + _ uint16 + Flags int32 + Addrs int32 + Pid int32 + Seq int32 + Errno int32 + Fmask int32 + Inits uint64 + Rmx RtMetrics +} + +type RtMetrics struct { + Locks uint64 + Mtu uint64 + Hopcount uint64 + Expire uint64 + Recvpipe uint64 + Sendpipe uint64 + Ssthresh uint64 + Rtt uint64 + Rttvar uint64 + Pksent uint64 + Weight uint64 + Nhidx uint64 + Filler [2]uint64 +} + +const ( + SizeofBpfVersion = 0x4 + SizeofBpfStat = 0x8 + SizeofBpfZbuf = 0x18 + SizeofBpfProgram = 0x10 + SizeofBpfInsn = 0x8 + SizeofBpfHdr = 0x20 + SizeofBpfZbufHeader = 0x20 +) + +type BpfVersion struct { + Major uint16 + Minor uint16 +} + +type BpfStat struct { + Recv uint32 + Drop uint32 +} + +type BpfZbuf struct { + Bufa *byte + Bufb *byte + Buflen uint64 +} + +type BpfProgram struct { + Len uint32 + Insns *BpfInsn +} + +type BpfInsn struct { + Code uint16 + Jt uint8 + Jf uint8 + K uint32 +} + +type BpfHdr struct { + Tstamp Timeval + Caplen uint32 + Datalen uint32 + Hdrlen uint16 + _ [6]byte +} + +type BpfZbufHeader struct { + Kernel_gen uint32 + Kernel_len uint32 + User_gen uint32 + _ [5]uint32 +} + +type Termios struct { + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Cc [20]uint8 + Ispeed uint32 + Ospeed uint32 +} + +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + +const ( + AT_FDCWD = -0x64 + AT_EACCESS = 0x100 + AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 +) + +type PollFd struct { + Fd int32 + Events int16 + Revents int16 +} + +const ( + POLLERR = 0x8 + POLLHUP = 0x10 + POLLIN = 0x1 + POLLINIGNEOF = 0x2000 + POLLNVAL = 0x20 + POLLOUT = 0x4 + POLLPRI = 0x2 + POLLRDBAND = 0x80 + POLLRDNORM = 0x40 + POLLWRBAND = 0x100 + POLLWRNORM = 0x4 +) + +type CapRights struct { + Rights [2]uint64 +} + +type Utsname struct { + Sysname [256]byte + Nodename [256]byte + Release [256]byte + Version [256]byte + Machine [256]byte +} + +const SizeofClockinfo = 0x14 + +type Clockinfo struct { + Hz int32 + Tick int32 + Spare int32 + Stathz int32 + Profhz int32 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go deleted file mode 100644 index 4c485261d6df..000000000000 --- a/vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go +++ /dev/null @@ -1,42 +0,0 @@ -// cgo -godefs types_illumos.go | go run mkpost.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -//go:build amd64 && illumos -// +build amd64,illumos - -package unix - -const ( - TUNNEWPPA = 0x540001 - TUNSETPPA = 0x540002 - - I_STR = 0x5308 - I_POP = 0x5303 - I_PUSH = 0x5302 - I_LINK = 0x530c - I_UNLINK = 0x530d - I_PLINK = 0x5316 - I_PUNLINK = 0x5317 - - IF_UNITSEL = -0x7ffb8cca -) - -type strbuf struct { - Maxlen int32 - Len int32 - Buf *int8 -} - -type Strioctl struct { - Cmd int32 - Timout int32 - Len int32 - Dp *int8 -} - -type Lifreq struct { - Name [32]int8 - Lifru1 [4]byte - Type uint32 - Lifru [336]byte -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 9962d26bb30c..ff6881167d97 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -945,6 +945,9 @@ type PerfEventAttr struct { Aux_watermark uint32 Sample_max_stack uint16 _ uint16 + Aux_sample_size uint32 + _ uint32 + Sig_data uint64 } type PerfEventMmapPage struct { @@ -1127,7 +1130,9 @@ const ( PERF_BR_SYSRET = 0x8 PERF_BR_COND_CALL = 0x9 PERF_BR_COND_RET = 0xa - PERF_BR_MAX = 0xb + PERF_BR_ERET = 0xb + PERF_BR_IRQ = 0xc + PERF_BR_MAX = 0xd PERF_SAMPLE_REGS_ABI_NONE = 0x0 PERF_SAMPLE_REGS_ABI_32 = 0x1 PERF_SAMPLE_REGS_ABI_64 = 0x2 @@ -1461,6 +1466,11 @@ const ( IFLA_ALT_IFNAME = 0x35 IFLA_PERM_ADDRESS = 0x36 IFLA_PROTO_DOWN_REASON = 0x37 + IFLA_PARENT_DEV_NAME = 0x38 + IFLA_PARENT_DEV_BUS_NAME = 0x39 + IFLA_GRO_MAX_SIZE = 0x3a + IFLA_TSO_MAX_SIZE = 0x3b + IFLA_TSO_MAX_SEGS = 0x3c IFLA_PROTO_DOWN_REASON_UNSPEC = 0x0 IFLA_PROTO_DOWN_REASON_MASK = 0x1 IFLA_PROTO_DOWN_REASON_VALUE = 0x2 @@ -2969,7 +2979,7 @@ const ( DEVLINK_CMD_TRAP_POLICER_NEW = 0x47 DEVLINK_CMD_TRAP_POLICER_DEL = 0x48 DEVLINK_CMD_HEALTH_REPORTER_TEST = 0x49 - DEVLINK_CMD_MAX = 0x4d + DEVLINK_CMD_MAX = 0x51 DEVLINK_PORT_TYPE_NOTSET = 0x0 DEVLINK_PORT_TYPE_AUTO = 0x1 DEVLINK_PORT_TYPE_ETH = 0x2 @@ -3198,7 +3208,7 @@ const ( DEVLINK_ATTR_RATE_NODE_NAME = 0xa8 DEVLINK_ATTR_RATE_PARENT_NODE_NAME = 0xa9 DEVLINK_ATTR_REGION_MAX_SNAPSHOTS = 0xaa - DEVLINK_ATTR_MAX = 0xaa + DEVLINK_ATTR_MAX = 0xae DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE = 0x0 DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX = 0x1 DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT = 0x0 @@ -3638,7 +3648,11 @@ const ( ETHTOOL_A_RINGS_RX_MINI = 0x7 ETHTOOL_A_RINGS_RX_JUMBO = 0x8 ETHTOOL_A_RINGS_TX = 0x9 - ETHTOOL_A_RINGS_MAX = 0xa + ETHTOOL_A_RINGS_RX_BUF_LEN = 0xa + ETHTOOL_A_RINGS_TCP_DATA_SPLIT = 0xb + ETHTOOL_A_RINGS_CQE_SIZE = 0xc + ETHTOOL_A_RINGS_TX_PUSH = 0xd + ETHTOOL_A_RINGS_MAX = 0xd ETHTOOL_A_CHANNELS_UNSPEC = 0x0 ETHTOOL_A_CHANNELS_HEADER = 0x1 ETHTOOL_A_CHANNELS_RX_MAX = 0x2 @@ -4323,7 +4337,7 @@ const ( NL80211_ATTR_MAC_HINT = 0xc8 NL80211_ATTR_MAC_MASK = 0xd7 NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca - NL80211_ATTR_MAX = 0x135 + NL80211_ATTR_MAX = 0x137 NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4 NL80211_ATTR_MAX_CSA_COUNTERS = 0xce NL80211_ATTR_MAX_MATCH_SETS = 0x85 @@ -4549,7 +4563,7 @@ const ( NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY = 0x3 NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE = 0x5 NL80211_BAND_IFTYPE_ATTR_IFTYPES = 0x1 - NL80211_BAND_IFTYPE_ATTR_MAX = 0x7 + NL80211_BAND_IFTYPE_ATTR_MAX = 0xb NL80211_BAND_S1GHZ = 0x4 NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE = 0x2 NL80211_BITRATE_ATTR_MAX = 0x2 @@ -4887,7 +4901,7 @@ const ( NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf - NL80211_FREQUENCY_ATTR_MAX = 0x19 + NL80211_FREQUENCY_ATTR_MAX = 0x1b NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6 NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11 NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc @@ -5254,7 +5268,7 @@ const ( NL80211_RATE_INFO_HE_RU_ALLOC_52 = 0x1 NL80211_RATE_INFO_HE_RU_ALLOC_996 = 0x5 NL80211_RATE_INFO_HE_RU_ALLOC = 0x11 - NL80211_RATE_INFO_MAX = 0x11 + NL80211_RATE_INFO_MAX = 0x16 NL80211_RATE_INFO_MCS = 0x2 NL80211_RATE_INFO_SHORT_GI = 0x4 NL80211_RATE_INFO_VHT_MCS = 0x6 @@ -5588,3 +5602,8 @@ const ( FR_ACT_UNREACHABLE = 0x7 FR_ACT_PROHIBIT = 0x8 ) + +const ( + AUDIT_NLGRP_NONE = 0x0 + AUDIT_NLGRP_READLOG = 0x1 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 4948362f2c22..89c516a29acf 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 linux/types.go | go run mkpost.go +// cgo -godefs -objdir=/tmp/386/cgo -- -Wall -Werror -static -I/tmp/386/include -m32 linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && linux @@ -254,6 +254,12 @@ type Sigset_t struct { const _C__NSIG = 0x41 +const ( + SIG_BLOCK = 0x0 + SIG_UNBLOCK = 0x1 + SIG_SETMASK = 0x2 +) + type Siginfo struct { Signo int32 Errno int32 @@ -324,6 +330,13 @@ type Taskstats struct { Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Ac_tgid uint32 + _ [4]byte + Ac_tgetime uint64 + Ac_exe_dev uint64 + Ac_exe_inode uint64 + Wpcopy_count uint64 + Wpcopy_delay_total uint64 } type cpuMask uint32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index f64345e0e2f3..62b4fb269963 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 linux/types.go | go run mkpost.go +// cgo -godefs -objdir=/tmp/amd64/cgo -- -Wall -Werror -static -I/tmp/amd64/include -m64 linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && linux @@ -269,6 +269,12 @@ type Sigset_t struct { const _C__NSIG = 0x41 +const ( + SIG_BLOCK = 0x0 + SIG_UNBLOCK = 0x1 + SIG_SETMASK = 0x2 +) + type Siginfo struct { Signo int32 Errno int32 @@ -338,6 +344,12 @@ type Taskstats struct { Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Ac_tgid uint32 + Ac_tgetime uint64 + Ac_exe_dev uint64 + Ac_exe_inode uint64 + Wpcopy_count uint64 + Wpcopy_delay_total uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 72469c79e750..e86b35893ece 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -objdir=/tmp/arm/cgo -- -Wall -Werror -static -I/tmp/arm/include linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && linux @@ -245,6 +245,12 @@ type Sigset_t struct { const _C__NSIG = 0x41 +const ( + SIG_BLOCK = 0x0 + SIG_UNBLOCK = 0x1 + SIG_SETMASK = 0x2 +) + type Siginfo struct { Signo int32 Errno int32 @@ -315,6 +321,13 @@ type Taskstats struct { Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Ac_tgid uint32 + _ [4]byte + Ac_tgetime uint64 + Ac_exe_dev uint64 + Ac_exe_inode uint64 + Wpcopy_count uint64 + Wpcopy_delay_total uint64 } type cpuMask uint32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index 68f072283a07..6c6be4c911d8 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char linux/types.go | go run mkpost.go +// cgo -godefs -objdir=/tmp/arm64/cgo -- -Wall -Werror -static -I/tmp/arm64/include -fsigned-char linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && linux @@ -248,6 +248,12 @@ type Sigset_t struct { const _C__NSIG = 0x41 +const ( + SIG_BLOCK = 0x0 + SIG_UNBLOCK = 0x1 + SIG_SETMASK = 0x2 +) + type Siginfo struct { Signo int32 Errno int32 @@ -317,6 +323,12 @@ type Taskstats struct { Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Ac_tgid uint32 + Ac_tgetime uint64 + Ac_exe_dev uint64 + Ac_exe_inode uint64 + Wpcopy_count uint64 + Wpcopy_delay_total uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go index 090ae46c6757..4982ea355a28 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -objdir=/tmp/loong64/cgo -- -Wall -Werror -static -I/tmp/loong64/include linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build loong64 && linux @@ -249,6 +249,12 @@ type Sigset_t struct { const _C__NSIG = 0x41 +const ( + SIG_BLOCK = 0x0 + SIG_UNBLOCK = 0x1 + SIG_SETMASK = 0x2 +) + type Siginfo struct { Signo int32 Errno int32 @@ -318,6 +324,12 @@ type Taskstats struct { Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Ac_tgid uint32 + Ac_tgetime uint64 + Ac_exe_dev uint64 + Ac_exe_inode uint64 + Wpcopy_count uint64 + Wpcopy_delay_total uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 03604cca135a..173141a67032 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -objdir=/tmp/mips/cgo -- -Wall -Werror -static -I/tmp/mips/include linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips && linux @@ -250,6 +250,12 @@ type Sigset_t struct { const _C__NSIG = 0x80 +const ( + SIG_BLOCK = 0x1 + SIG_UNBLOCK = 0x2 + SIG_SETMASK = 0x3 +) + type Siginfo struct { Signo int32 Code int32 @@ -320,6 +326,13 @@ type Taskstats struct { Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Ac_tgid uint32 + _ [4]byte + Ac_tgetime uint64 + Ac_exe_dev uint64 + Ac_exe_inode uint64 + Wpcopy_count uint64 + Wpcopy_delay_total uint64 } type cpuMask uint32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index fe57a7b26539..93ae4c51673d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -objdir=/tmp/mips64/cgo -- -Wall -Werror -static -I/tmp/mips64/include linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && linux @@ -251,6 +251,12 @@ type Sigset_t struct { const _C__NSIG = 0x80 +const ( + SIG_BLOCK = 0x1 + SIG_UNBLOCK = 0x2 + SIG_SETMASK = 0x3 +) + type Siginfo struct { Signo int32 Code int32 @@ -320,6 +326,12 @@ type Taskstats struct { Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Ac_tgid uint32 + Ac_tgetime uint64 + Ac_exe_dev uint64 + Ac_exe_inode uint64 + Wpcopy_count uint64 + Wpcopy_delay_total uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 3f0db4da81e7..4e4e510ca519 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -objdir=/tmp/mips64le/cgo -- -Wall -Werror -static -I/tmp/mips64le/include linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64le && linux @@ -251,6 +251,12 @@ type Sigset_t struct { const _C__NSIG = 0x80 +const ( + SIG_BLOCK = 0x1 + SIG_UNBLOCK = 0x2 + SIG_SETMASK = 0x3 +) + type Siginfo struct { Signo int32 Code int32 @@ -320,6 +326,12 @@ type Taskstats struct { Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Ac_tgid uint32 + Ac_tgetime uint64 + Ac_exe_dev uint64 + Ac_exe_inode uint64 + Wpcopy_count uint64 + Wpcopy_delay_total uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index 70ecd3b239f8..3f5ba013d995 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -objdir=/tmp/mipsle/cgo -- -Wall -Werror -static -I/tmp/mipsle/include linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mipsle && linux @@ -250,6 +250,12 @@ type Sigset_t struct { const _C__NSIG = 0x80 +const ( + SIG_BLOCK = 0x1 + SIG_UNBLOCK = 0x2 + SIG_SETMASK = 0x3 +) + type Siginfo struct { Signo int32 Code int32 @@ -320,6 +326,13 @@ type Taskstats struct { Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Ac_tgid uint32 + _ [4]byte + Ac_tgetime uint64 + Ac_exe_dev uint64 + Ac_exe_inode uint64 + Wpcopy_count uint64 + Wpcopy_delay_total uint64 } type cpuMask uint32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go index 4e700120db90..71dfe7cdb47a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -objdir=/tmp/ppc/cgo -- -Wall -Werror -static -I/tmp/ppc/include linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && linux @@ -257,6 +257,12 @@ type Sigset_t struct { const _C__NSIG = 0x41 +const ( + SIG_BLOCK = 0x0 + SIG_UNBLOCK = 0x1 + SIG_SETMASK = 0x2 +) + type Siginfo struct { Signo int32 Errno int32 @@ -327,6 +333,13 @@ type Taskstats struct { Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Ac_tgid uint32 + _ [4]byte + Ac_tgetime uint64 + Ac_exe_dev uint64 + Ac_exe_inode uint64 + Wpcopy_count uint64 + Wpcopy_delay_total uint64 } type cpuMask uint32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index 34a57c69928d..3a2b7f0a666e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -objdir=/tmp/ppc64/cgo -- -Wall -Werror -static -I/tmp/ppc64/include linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && linux @@ -258,6 +258,12 @@ type Sigset_t struct { const _C__NSIG = 0x41 +const ( + SIG_BLOCK = 0x0 + SIG_UNBLOCK = 0x1 + SIG_SETMASK = 0x2 +) + type Siginfo struct { Signo int32 Errno int32 @@ -327,6 +333,12 @@ type Taskstats struct { Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Ac_tgid uint32 + Ac_tgetime uint64 + Ac_exe_dev uint64 + Ac_exe_inode uint64 + Wpcopy_count uint64 + Wpcopy_delay_total uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 6b84a47296f6..a52d62756328 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -objdir=/tmp/ppc64le/cgo -- -Wall -Werror -static -I/tmp/ppc64le/include linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64le && linux @@ -258,6 +258,12 @@ type Sigset_t struct { const _C__NSIG = 0x41 +const ( + SIG_BLOCK = 0x0 + SIG_UNBLOCK = 0x1 + SIG_SETMASK = 0x2 +) + type Siginfo struct { Signo int32 Errno int32 @@ -327,6 +333,12 @@ type Taskstats struct { Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Ac_tgid uint32 + Ac_tgetime uint64 + Ac_exe_dev uint64 + Ac_exe_inode uint64 + Wpcopy_count uint64 + Wpcopy_delay_total uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index c4a305fe2e7d..dfc007d8a691 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -objdir=/tmp/riscv64/cgo -- -Wall -Werror -static -I/tmp/riscv64/include linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && linux @@ -276,6 +276,12 @@ type Sigset_t struct { const _C__NSIG = 0x41 +const ( + SIG_BLOCK = 0x0 + SIG_UNBLOCK = 0x1 + SIG_SETMASK = 0x2 +) + type Siginfo struct { Signo int32 Errno int32 @@ -345,6 +351,12 @@ type Taskstats struct { Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Ac_tgid uint32 + Ac_tgetime uint64 + Ac_exe_dev uint64 + Ac_exe_inode uint64 + Wpcopy_count uint64 + Wpcopy_delay_total uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index a1f1e4c9e18b..b53cb9103d30 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char linux/types.go | go run mkpost.go +// cgo -godefs -objdir=/tmp/s390x/cgo -- -Wall -Werror -static -I/tmp/s390x/include -fsigned-char linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build s390x && linux @@ -271,6 +271,12 @@ type Sigset_t struct { const _C__NSIG = 0x41 +const ( + SIG_BLOCK = 0x0 + SIG_UNBLOCK = 0x1 + SIG_SETMASK = 0x2 +) + type Siginfo struct { Signo int32 Errno int32 @@ -340,6 +346,12 @@ type Taskstats struct { Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Ac_tgid uint32 + Ac_tgetime uint64 + Ac_exe_dev uint64 + Ac_exe_inode uint64 + Wpcopy_count uint64 + Wpcopy_delay_total uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index df95ebf3a1b6..fe0aa3547280 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -objdir=/tmp/sparc64/cgo -- -Wall -Werror -static -I/tmp/sparc64/include linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build sparc64 && linux @@ -253,6 +253,12 @@ type Sigset_t struct { const _C__NSIG = 0x41 +const ( + SIG_BLOCK = 0x1 + SIG_UNBLOCK = 0x2 + SIG_SETMASK = 0x4 +) + type Siginfo struct { Signo int32 Errno int32 @@ -322,6 +328,12 @@ type Taskstats struct { Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Ac_tgid uint32 + Ac_tgetime uint64 + Ac_exe_dev uint64 + Ac_exe_inode uint64 + Wpcopy_count uint64 + Wpcopy_delay_total uint64 } type cpuMask uint64 diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go index 2fd2060e617a..9bc4c8f9d889 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go @@ -491,6 +491,90 @@ type Utsname struct { Machine [256]byte } +const SizeofUvmexp = 0x278 + +type Uvmexp struct { + Pagesize int64 + Pagemask int64 + Pageshift int64 + Npages int64 + Free int64 + Active int64 + Inactive int64 + Paging int64 + Wired int64 + Zeropages int64 + Reserve_pagedaemon int64 + Reserve_kernel int64 + Freemin int64 + Freetarg int64 + Inactarg int64 + Wiredmax int64 + Nswapdev int64 + Swpages int64 + Swpginuse int64 + Swpgonly int64 + Nswget int64 + Unused1 int64 + Cpuhit int64 + Cpumiss int64 + Faults int64 + Traps int64 + Intrs int64 + Swtch int64 + Softs int64 + Syscalls int64 + Pageins int64 + Swapins int64 + Swapouts int64 + Pgswapin int64 + Pgswapout int64 + Forks int64 + Forks_ppwait int64 + Forks_sharevm int64 + Pga_zerohit int64 + Pga_zeromiss int64 + Zeroaborts int64 + Fltnoram int64 + Fltnoanon int64 + Fltpgwait int64 + Fltpgrele int64 + Fltrelck int64 + Fltrelckok int64 + Fltanget int64 + Fltanretry int64 + Fltamcopy int64 + Fltnamap int64 + Fltnomap int64 + Fltlget int64 + Fltget int64 + Flt_anon int64 + Flt_acow int64 + Flt_obj int64 + Flt_prcopy int64 + Flt_przero int64 + Pdwoke int64 + Pdrevs int64 + Unused4 int64 + Pdfreed int64 + Pdscans int64 + Pdanscan int64 + Pdobscan int64 + Pdreact int64 + Pdbusy int64 + Pdpageouts int64 + Pdpending int64 + Pddeact int64 + Anonpages int64 + Filepages int64 + Execpages int64 + Colorhit int64 + Colormiss int64 + Ncolors int64 + Bootpages int64 + Poolpages int64 +} + const SizeofClockinfo = 0x14 type Clockinfo struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go index 6a5a1a8ae556..bb05f655d225 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go @@ -499,6 +499,90 @@ type Utsname struct { Machine [256]byte } +const SizeofUvmexp = 0x278 + +type Uvmexp struct { + Pagesize int64 + Pagemask int64 + Pageshift int64 + Npages int64 + Free int64 + Active int64 + Inactive int64 + Paging int64 + Wired int64 + Zeropages int64 + Reserve_pagedaemon int64 + Reserve_kernel int64 + Freemin int64 + Freetarg int64 + Inactarg int64 + Wiredmax int64 + Nswapdev int64 + Swpages int64 + Swpginuse int64 + Swpgonly int64 + Nswget int64 + Unused1 int64 + Cpuhit int64 + Cpumiss int64 + Faults int64 + Traps int64 + Intrs int64 + Swtch int64 + Softs int64 + Syscalls int64 + Pageins int64 + Swapins int64 + Swapouts int64 + Pgswapin int64 + Pgswapout int64 + Forks int64 + Forks_ppwait int64 + Forks_sharevm int64 + Pga_zerohit int64 + Pga_zeromiss int64 + Zeroaborts int64 + Fltnoram int64 + Fltnoanon int64 + Fltpgwait int64 + Fltpgrele int64 + Fltrelck int64 + Fltrelckok int64 + Fltanget int64 + Fltanretry int64 + Fltamcopy int64 + Fltnamap int64 + Fltnomap int64 + Fltlget int64 + Fltget int64 + Flt_anon int64 + Flt_acow int64 + Flt_obj int64 + Flt_prcopy int64 + Flt_przero int64 + Pdwoke int64 + Pdrevs int64 + Unused4 int64 + Pdfreed int64 + Pdscans int64 + Pdanscan int64 + Pdobscan int64 + Pdreact int64 + Pdbusy int64 + Pdpageouts int64 + Pdpending int64 + Pddeact int64 + Anonpages int64 + Filepages int64 + Execpages int64 + Colorhit int64 + Colormiss int64 + Ncolors int64 + Bootpages int64 + Poolpages int64 +} + const SizeofClockinfo = 0x14 type Clockinfo struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go index 84cc8d01e656..db40e3a19c66 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go @@ -496,6 +496,90 @@ type Utsname struct { Machine [256]byte } +const SizeofUvmexp = 0x278 + +type Uvmexp struct { + Pagesize int64 + Pagemask int64 + Pageshift int64 + Npages int64 + Free int64 + Active int64 + Inactive int64 + Paging int64 + Wired int64 + Zeropages int64 + Reserve_pagedaemon int64 + Reserve_kernel int64 + Freemin int64 + Freetarg int64 + Inactarg int64 + Wiredmax int64 + Nswapdev int64 + Swpages int64 + Swpginuse int64 + Swpgonly int64 + Nswget int64 + Unused1 int64 + Cpuhit int64 + Cpumiss int64 + Faults int64 + Traps int64 + Intrs int64 + Swtch int64 + Softs int64 + Syscalls int64 + Pageins int64 + Swapins int64 + Swapouts int64 + Pgswapin int64 + Pgswapout int64 + Forks int64 + Forks_ppwait int64 + Forks_sharevm int64 + Pga_zerohit int64 + Pga_zeromiss int64 + Zeroaborts int64 + Fltnoram int64 + Fltnoanon int64 + Fltpgwait int64 + Fltpgrele int64 + Fltrelck int64 + Fltrelckok int64 + Fltanget int64 + Fltanretry int64 + Fltamcopy int64 + Fltnamap int64 + Fltnomap int64 + Fltlget int64 + Fltget int64 + Flt_anon int64 + Flt_acow int64 + Flt_obj int64 + Flt_prcopy int64 + Flt_przero int64 + Pdwoke int64 + Pdrevs int64 + Unused4 int64 + Pdfreed int64 + Pdscans int64 + Pdanscan int64 + Pdobscan int64 + Pdreact int64 + Pdbusy int64 + Pdpageouts int64 + Pdpending int64 + Pddeact int64 + Anonpages int64 + Filepages int64 + Execpages int64 + Colorhit int64 + Colormiss int64 + Ncolors int64 + Bootpages int64 + Poolpages int64 +} + const SizeofClockinfo = 0x14 type Clockinfo struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go index c844e7096ff5..11121151ccf0 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go @@ -499,6 +499,90 @@ type Utsname struct { Machine [256]byte } +const SizeofUvmexp = 0x278 + +type Uvmexp struct { + Pagesize int64 + Pagemask int64 + Pageshift int64 + Npages int64 + Free int64 + Active int64 + Inactive int64 + Paging int64 + Wired int64 + Zeropages int64 + Reserve_pagedaemon int64 + Reserve_kernel int64 + Freemin int64 + Freetarg int64 + Inactarg int64 + Wiredmax int64 + Nswapdev int64 + Swpages int64 + Swpginuse int64 + Swpgonly int64 + Nswget int64 + Unused1 int64 + Cpuhit int64 + Cpumiss int64 + Faults int64 + Traps int64 + Intrs int64 + Swtch int64 + Softs int64 + Syscalls int64 + Pageins int64 + Swapins int64 + Swapouts int64 + Pgswapin int64 + Pgswapout int64 + Forks int64 + Forks_ppwait int64 + Forks_sharevm int64 + Pga_zerohit int64 + Pga_zeromiss int64 + Zeroaborts int64 + Fltnoram int64 + Fltnoanon int64 + Fltpgwait int64 + Fltpgrele int64 + Fltrelck int64 + Fltrelckok int64 + Fltanget int64 + Fltanretry int64 + Fltamcopy int64 + Fltnamap int64 + Fltnomap int64 + Fltlget int64 + Fltget int64 + Flt_anon int64 + Flt_acow int64 + Flt_obj int64 + Flt_prcopy int64 + Flt_przero int64 + Pdwoke int64 + Pdrevs int64 + Unused4 int64 + Pdfreed int64 + Pdscans int64 + Pdanscan int64 + Pdobscan int64 + Pdreact int64 + Pdbusy int64 + Pdpageouts int64 + Pdpending int64 + Pddeact int64 + Anonpages int64 + Filepages int64 + Execpages int64 + Colorhit int64 + Colormiss int64 + Ncolors int64 + Bootpages int64 + Poolpages int64 +} + const SizeofClockinfo = 0x14 type Clockinfo struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go index baf5fe650444..26eba23b729f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go @@ -58,22 +58,22 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Mode uint32 - Dev int32 - Ino uint64 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev int32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize uint32 - Flags uint32 - Gen uint32 - X__st_birthtim Timespec + Mode uint32 + Dev int32 + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Rdev int32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + _ Timespec } type Statfs_t struct { @@ -94,11 +94,11 @@ type Statfs_t struct { F_namemax uint32 F_owner uint32 F_ctime uint64 - F_fstypename [16]int8 - F_mntonname [90]int8 - F_mntfromname [90]int8 - F_mntfromspec [90]int8 - Pad_cgo_0 [2]byte + F_fstypename [16]byte + F_mntonname [90]byte + F_mntfromname [90]byte + F_mntfromspec [90]byte + _ [2]byte Mount_info [160]byte } @@ -111,13 +111,13 @@ type Flock_t struct { } type Dirent struct { - Fileno uint64 - Off int64 - Reclen uint16 - Type uint8 - Namlen uint8 - X__d_padding [4]uint8 - Name [256]int8 + Fileno uint64 + Off int64 + Reclen uint16 + Type uint8 + Namlen uint8 + _ [4]uint8 + Name [256]int8 } type Fsid struct { @@ -262,8 +262,8 @@ type FdSet struct { } const ( - SizeofIfMsghdr = 0xec - SizeofIfData = 0xd4 + SizeofIfMsghdr = 0xa0 + SizeofIfData = 0x88 SizeofIfaMsghdr = 0x18 SizeofIfAnnounceMsghdr = 0x1a SizeofRtMsghdr = 0x60 @@ -292,7 +292,7 @@ type IfData struct { Link_state uint8 Mtu uint32 Metric uint32 - Pad uint32 + Rdomain uint32 Baudrate uint64 Ipackets uint64 Ierrors uint64 @@ -304,10 +304,10 @@ type IfData struct { Imcasts uint64 Omcasts uint64 Iqdrops uint64 + Oqdrops uint64 Noproto uint64 Capabilities uint32 Lastchange Timeval - Mclpool [7]Mclpool } type IfaMsghdr struct { @@ -368,20 +368,12 @@ type RtMetrics struct { Pad uint32 } -type Mclpool struct { - Grown int32 - Alive uint16 - Hwm uint16 - Cwm uint16 - Lwm uint16 -} - const ( SizeofBpfVersion = 0x4 SizeofBpfStat = 0x8 SizeofBpfProgram = 0x8 SizeofBpfInsn = 0x8 - SizeofBpfHdr = 0x14 + SizeofBpfHdr = 0x18 ) type BpfVersion struct { @@ -407,11 +399,14 @@ type BpfInsn struct { } type BpfHdr struct { - Tstamp BpfTimeval - Caplen uint32 - Datalen uint32 - Hdrlen uint16 - Pad_cgo_0 [2]byte + Tstamp BpfTimeval + Caplen uint32 + Datalen uint32 + Hdrlen uint16 + Ifidx uint16 + Flowid uint16 + Flags uint8 + Drops uint8 } type BpfTimeval struct { @@ -488,7 +483,7 @@ type Uvmexp struct { Zeropages int32 Reserve_pagedaemon int32 Reserve_kernel int32 - Anonpages int32 + Unused01 int32 Vnodepages int32 Vtextpages int32 Freemin int32 @@ -507,8 +502,8 @@ type Uvmexp struct { Swpgonly int32 Nswget int32 Nanon int32 - Nanonneeded int32 - Nfreeanon int32 + Unused05 int32 + Unused06 int32 Faults int32 Traps int32 Intrs int32 @@ -516,8 +511,8 @@ type Uvmexp struct { Softs int32 Syscalls int32 Pageins int32 - Obsolete_swapins int32 - Obsolete_swapouts int32 + Unused07 int32 + Unused08 int32 Pgswapin int32 Pgswapout int32 Forks int32 @@ -525,7 +520,7 @@ type Uvmexp struct { Forks_sharevm int32 Pga_zerohit int32 Pga_zeromiss int32 - Zeroaborts int32 + Unused09 int32 Fltnoram int32 Fltnoanon int32 Fltnoamap int32 @@ -557,9 +552,9 @@ type Uvmexp struct { Pdpageouts int32 Pdpending int32 Pddeact int32 - Pdreanon int32 - Pdrevnode int32 - Pdrevtext int32 + Unused11 int32 + Unused12 int32 + Unused13 int32 Fpswtch int32 Kmapent int32 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go index e21ae8ecfa6f..5a5479886989 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go @@ -73,7 +73,6 @@ type Stat_t struct { Blksize int32 Flags uint32 Gen uint32 - _ [4]byte _ Timespec } @@ -81,7 +80,6 @@ type Statfs_t struct { F_flags uint32 F_bsize uint32 F_iosize uint32 - _ [4]byte F_blocks uint64 F_bfree uint64 F_bavail int64 @@ -96,10 +94,10 @@ type Statfs_t struct { F_namemax uint32 F_owner uint32 F_ctime uint64 - F_fstypename [16]int8 - F_mntonname [90]int8 - F_mntfromname [90]int8 - F_mntfromspec [90]int8 + F_fstypename [16]byte + F_mntonname [90]byte + F_mntfromname [90]byte + F_mntfromspec [90]byte _ [2]byte Mount_info [160]byte } @@ -200,10 +198,8 @@ type IPv6Mreq struct { type Msghdr struct { Name *byte Namelen uint32 - _ [4]byte Iov *Iovec Iovlen uint32 - _ [4]byte Control *byte Controllen uint32 Flags int32 @@ -311,7 +307,6 @@ type IfData struct { Oqdrops uint64 Noproto uint64 Capabilities uint32 - _ [4]byte Lastchange Timeval } @@ -373,14 +368,12 @@ type RtMetrics struct { Pad uint32 } -type Mclpool struct{} - const ( SizeofBpfVersion = 0x4 SizeofBpfStat = 0x8 SizeofBpfProgram = 0x10 SizeofBpfInsn = 0x8 - SizeofBpfHdr = 0x14 + SizeofBpfHdr = 0x18 ) type BpfVersion struct { @@ -395,7 +388,6 @@ type BpfStat struct { type BpfProgram struct { Len uint32 - _ [4]byte Insns *BpfInsn } @@ -411,7 +403,10 @@ type BpfHdr struct { Caplen uint32 Datalen uint32 Hdrlen uint16 - _ [2]byte + Ifidx uint16 + Flowid uint16 + Flags uint8 + Drops uint8 } type BpfTimeval struct { @@ -488,7 +483,7 @@ type Uvmexp struct { Zeropages int32 Reserve_pagedaemon int32 Reserve_kernel int32 - Anonpages int32 + Unused01 int32 Vnodepages int32 Vtextpages int32 Freemin int32 @@ -507,8 +502,8 @@ type Uvmexp struct { Swpgonly int32 Nswget int32 Nanon int32 - Nanonneeded int32 - Nfreeanon int32 + Unused05 int32 + Unused06 int32 Faults int32 Traps int32 Intrs int32 @@ -516,8 +511,8 @@ type Uvmexp struct { Softs int32 Syscalls int32 Pageins int32 - Obsolete_swapins int32 - Obsolete_swapouts int32 + Unused07 int32 + Unused08 int32 Pgswapin int32 Pgswapout int32 Forks int32 @@ -525,7 +520,7 @@ type Uvmexp struct { Forks_sharevm int32 Pga_zerohit int32 Pga_zeromiss int32 - Zeroaborts int32 + Unused09 int32 Fltnoram int32 Fltnoanon int32 Fltnoamap int32 @@ -557,9 +552,9 @@ type Uvmexp struct { Pdpageouts int32 Pdpending int32 Pddeact int32 - Pdreanon int32 - Pdrevnode int32 - Pdrevtext int32 + Unused11 int32 + Unused12 int32 + Unused13 int32 Fpswtch int32 Kmapent int32 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go index f190651cd964..be58c4e1ff8b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go @@ -98,10 +98,10 @@ type Statfs_t struct { F_namemax uint32 F_owner uint32 F_ctime uint64 - F_fstypename [16]int8 - F_mntonname [90]int8 - F_mntfromname [90]int8 - F_mntfromspec [90]int8 + F_fstypename [16]byte + F_mntonname [90]byte + F_mntfromname [90]byte + F_mntfromspec [90]byte _ [2]byte Mount_info [160]byte } @@ -375,14 +375,12 @@ type RtMetrics struct { Pad uint32 } -type Mclpool struct{} - const ( SizeofBpfVersion = 0x4 SizeofBpfStat = 0x8 SizeofBpfProgram = 0x8 SizeofBpfInsn = 0x8 - SizeofBpfHdr = 0x14 + SizeofBpfHdr = 0x18 ) type BpfVersion struct { @@ -412,7 +410,10 @@ type BpfHdr struct { Caplen uint32 Datalen uint32 Hdrlen uint16 - _ [2]byte + Ifidx uint16 + Flowid uint16 + Flags uint8 + Drops uint8 } type BpfTimeval struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go index 84747c582cfc..52338266cb3e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go @@ -94,10 +94,10 @@ type Statfs_t struct { F_namemax uint32 F_owner uint32 F_ctime uint64 - F_fstypename [16]int8 - F_mntonname [90]int8 - F_mntfromname [90]int8 - F_mntfromspec [90]int8 + F_fstypename [16]byte + F_mntonname [90]byte + F_mntfromname [90]byte + F_mntfromspec [90]byte _ [2]byte Mount_info [160]byte } @@ -368,14 +368,12 @@ type RtMetrics struct { Pad uint32 } -type Mclpool struct{} - const ( SizeofBpfVersion = 0x4 SizeofBpfStat = 0x8 SizeofBpfProgram = 0x10 SizeofBpfInsn = 0x8 - SizeofBpfHdr = 0x14 + SizeofBpfHdr = 0x18 ) type BpfVersion struct { @@ -405,7 +403,10 @@ type BpfHdr struct { Caplen uint32 Datalen uint32 Hdrlen uint16 - _ [2]byte + Ifidx uint16 + Flowid uint16 + Flags uint8 + Drops uint8 } type BpfTimeval struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go index ac5c8b6370b1..605cfdb12b1d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go @@ -94,10 +94,10 @@ type Statfs_t struct { F_namemax uint32 F_owner uint32 F_ctime uint64 - F_fstypename [16]int8 - F_mntonname [90]int8 - F_mntfromname [90]int8 - F_mntfromspec [90]int8 + F_fstypename [16]byte + F_mntonname [90]byte + F_mntfromname [90]byte + F_mntfromspec [90]byte _ [2]byte Mount_info [160]byte } @@ -368,14 +368,12 @@ type RtMetrics struct { Pad uint32 } -type Mclpool struct{} - const ( SizeofBpfVersion = 0x4 SizeofBpfStat = 0x8 SizeofBpfProgram = 0x10 SizeofBpfInsn = 0x8 - SizeofBpfHdr = 0x14 + SizeofBpfHdr = 0x18 ) type BpfVersion struct { @@ -405,7 +403,10 @@ type BpfHdr struct { Caplen uint32 Datalen uint32 Hdrlen uint16 - _ [2]byte + Ifidx uint16 + Flowid uint16 + Flags uint8 + Drops uint8 } type BpfTimeval struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go new file mode 100644 index 000000000000..d6724c0102c8 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go @@ -0,0 +1,571 @@ +// cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build ppc64 && openbsd +// +build ppc64,openbsd + +package unix + +const ( + SizeofPtr = 0x8 + SizeofShort = 0x2 + SizeofInt = 0x4 + SizeofLong = 0x8 + SizeofLongLong = 0x8 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type _Gid_t uint32 + +type Stat_t struct { + Mode uint32 + Dev int32 + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Rdev int32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + _ Timespec +} + +type Statfs_t struct { + F_flags uint32 + F_bsize uint32 + F_iosize uint32 + F_blocks uint64 + F_bfree uint64 + F_bavail int64 + F_files uint64 + F_ffree uint64 + F_favail int64 + F_syncwrites uint64 + F_syncreads uint64 + F_asyncwrites uint64 + F_asyncreads uint64 + F_fsid Fsid + F_namemax uint32 + F_owner uint32 + F_ctime uint64 + F_fstypename [16]byte + F_mntonname [90]byte + F_mntfromname [90]byte + F_mntfromspec [90]byte + _ [2]byte + Mount_info [160]byte +} + +type Flock_t struct { + Start int64 + Len int64 + Pid int32 + Type int16 + Whence int16 +} + +type Dirent struct { + Fileno uint64 + Off int64 + Reclen uint16 + Type uint8 + Namlen uint8 + _ [4]uint8 + Name [256]int8 +} + +type Fsid struct { + Val [2]int32 +} + +const ( + PathMax = 0x400 +) + +type RawSockaddrInet4 struct { + Len uint8 + Family uint8 + Port uint16 + Addr [4]byte /* in_addr */ + Zero [8]int8 +} + +type RawSockaddrInet6 struct { + Len uint8 + Family uint8 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 +} + +type RawSockaddrUnix struct { + Len uint8 + Family uint8 + Path [104]int8 +} + +type RawSockaddrDatalink struct { + Len uint8 + Family uint8 + Index uint16 + Type uint8 + Nlen uint8 + Alen uint8 + Slen uint8 + Data [24]int8 +} + +type RawSockaddr struct { + Len uint8 + Family uint8 + Data [14]int8 +} + +type RawSockaddrAny struct { + Addr RawSockaddr + Pad [92]int8 +} + +type _Socklen uint32 + +type Linger struct { + Onoff int32 + Linger int32 +} + +type Iovec struct { + Base *byte + Len uint64 +} + +type IPMreq struct { + Multiaddr [4]byte /* in_addr */ + Interface [4]byte /* in_addr */ +} + +type IPv6Mreq struct { + Multiaddr [16]byte /* in6_addr */ + Interface uint32 +} + +type Msghdr struct { + Name *byte + Namelen uint32 + Iov *Iovec + Iovlen uint32 + Control *byte + Controllen uint32 + Flags int32 +} + +type Cmsghdr struct { + Len uint32 + Level int32 + Type int32 +} + +type Inet6Pktinfo struct { + Addr [16]byte /* in6_addr */ + Ifindex uint32 +} + +type IPv6MTUInfo struct { + Addr RawSockaddrInet6 + Mtu uint32 +} + +type ICMPv6Filter struct { + Filt [8]uint32 +} + +const ( + SizeofSockaddrInet4 = 0x10 + SizeofSockaddrInet6 = 0x1c + SizeofSockaddrAny = 0x6c + SizeofSockaddrUnix = 0x6a + SizeofSockaddrDatalink = 0x20 + SizeofLinger = 0x8 + SizeofIovec = 0x10 + SizeofIPMreq = 0x8 + SizeofIPv6Mreq = 0x14 + SizeofMsghdr = 0x30 + SizeofCmsghdr = 0xc + SizeofInet6Pktinfo = 0x14 + SizeofIPv6MTUInfo = 0x20 + SizeofICMPv6Filter = 0x20 +) + +const ( + PTRACE_TRACEME = 0x0 + PTRACE_CONT = 0x7 + PTRACE_KILL = 0x8 +) + +type Kevent_t struct { + Ident uint64 + Filter int16 + Flags uint16 + Fflags uint32 + Data int64 + Udata *byte +} + +type FdSet struct { + Bits [32]uint32 +} + +const ( + SizeofIfMsghdr = 0xa8 + SizeofIfData = 0x90 + SizeofIfaMsghdr = 0x18 + SizeofIfAnnounceMsghdr = 0x1a + SizeofRtMsghdr = 0x60 + SizeofRtMetrics = 0x38 +) + +type IfMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + Tableid uint16 + Pad1 uint8 + Pad2 uint8 + Addrs int32 + Flags int32 + Xflags int32 + Data IfData +} + +type IfData struct { + Type uint8 + Addrlen uint8 + Hdrlen uint8 + Link_state uint8 + Mtu uint32 + Metric uint32 + Rdomain uint32 + Baudrate uint64 + Ipackets uint64 + Ierrors uint64 + Opackets uint64 + Oerrors uint64 + Collisions uint64 + Ibytes uint64 + Obytes uint64 + Imcasts uint64 + Omcasts uint64 + Iqdrops uint64 + Oqdrops uint64 + Noproto uint64 + Capabilities uint32 + Lastchange Timeval +} + +type IfaMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + Tableid uint16 + Pad1 uint8 + Pad2 uint8 + Addrs int32 + Flags int32 + Metric int32 +} + +type IfAnnounceMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + What uint16 + Name [16]int8 +} + +type RtMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + Tableid uint16 + Priority uint8 + Mpls uint8 + Addrs int32 + Flags int32 + Fmask int32 + Pid int32 + Seq int32 + Errno int32 + Inits uint32 + Rmx RtMetrics +} + +type RtMetrics struct { + Pksent uint64 + Expire int64 + Locks uint32 + Mtu uint32 + Refcnt uint32 + Hopcount uint32 + Recvpipe uint32 + Sendpipe uint32 + Ssthresh uint32 + Rtt uint32 + Rttvar uint32 + Pad uint32 +} + +type Mclpool struct{} + +const ( + SizeofBpfVersion = 0x4 + SizeofBpfStat = 0x8 + SizeofBpfProgram = 0x10 + SizeofBpfInsn = 0x8 + SizeofBpfHdr = 0x18 +) + +type BpfVersion struct { + Major uint16 + Minor uint16 +} + +type BpfStat struct { + Recv uint32 + Drop uint32 +} + +type BpfProgram struct { + Len uint32 + Insns *BpfInsn +} + +type BpfInsn struct { + Code uint16 + Jt uint8 + Jf uint8 + K uint32 +} + +type BpfHdr struct { + Tstamp BpfTimeval + Caplen uint32 + Datalen uint32 + Hdrlen uint16 + Ifidx uint16 + Flowid uint16 + Flags uint8 + Drops uint8 +} + +type BpfTimeval struct { + Sec uint32 + Usec uint32 +} + +type Termios struct { + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Cc [20]uint8 + Ispeed int32 + Ospeed int32 +} + +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + +const ( + AT_FDCWD = -0x64 + AT_EACCESS = 0x1 + AT_SYMLINK_NOFOLLOW = 0x2 + AT_SYMLINK_FOLLOW = 0x4 + AT_REMOVEDIR = 0x8 +) + +type PollFd struct { + Fd int32 + Events int16 + Revents int16 +} + +const ( + POLLERR = 0x8 + POLLHUP = 0x10 + POLLIN = 0x1 + POLLNVAL = 0x20 + POLLOUT = 0x4 + POLLPRI = 0x2 + POLLRDBAND = 0x80 + POLLRDNORM = 0x40 + POLLWRBAND = 0x100 + POLLWRNORM = 0x4 +) + +type Sigset_t uint32 + +type Utsname struct { + Sysname [256]byte + Nodename [256]byte + Release [256]byte + Version [256]byte + Machine [256]byte +} + +const SizeofUvmexp = 0x158 + +type Uvmexp struct { + Pagesize int32 + Pagemask int32 + Pageshift int32 + Npages int32 + Free int32 + Active int32 + Inactive int32 + Paging int32 + Wired int32 + Zeropages int32 + Reserve_pagedaemon int32 + Reserve_kernel int32 + Unused01 int32 + Vnodepages int32 + Vtextpages int32 + Freemin int32 + Freetarg int32 + Inactarg int32 + Wiredmax int32 + Anonmin int32 + Vtextmin int32 + Vnodemin int32 + Anonminpct int32 + Vtextminpct int32 + Vnodeminpct int32 + Nswapdev int32 + Swpages int32 + Swpginuse int32 + Swpgonly int32 + Nswget int32 + Nanon int32 + Unused05 int32 + Unused06 int32 + Faults int32 + Traps int32 + Intrs int32 + Swtch int32 + Softs int32 + Syscalls int32 + Pageins int32 + Unused07 int32 + Unused08 int32 + Pgswapin int32 + Pgswapout int32 + Forks int32 + Forks_ppwait int32 + Forks_sharevm int32 + Pga_zerohit int32 + Pga_zeromiss int32 + Unused09 int32 + Fltnoram int32 + Fltnoanon int32 + Fltnoamap int32 + Fltpgwait int32 + Fltpgrele int32 + Fltrelck int32 + Fltrelckok int32 + Fltanget int32 + Fltanretry int32 + Fltamcopy int32 + Fltnamap int32 + Fltnomap int32 + Fltlget int32 + Fltget int32 + Flt_anon int32 + Flt_acow int32 + Flt_obj int32 + Flt_prcopy int32 + Flt_przero int32 + Pdwoke int32 + Pdrevs int32 + Pdswout int32 + Pdfreed int32 + Pdscans int32 + Pdanscan int32 + Pdobscan int32 + Pdreact int32 + Pdbusy int32 + Pdpageouts int32 + Pdpending int32 + Pddeact int32 + Unused11 int32 + Unused12 int32 + Unused13 int32 + Fpswtch int32 + Kmapent int32 +} + +const SizeofClockinfo = 0x10 + +type Clockinfo struct { + Hz int32 + Tick int32 + Stathz int32 + Profhz int32 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go new file mode 100644 index 000000000000..ddfd27a434a1 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go @@ -0,0 +1,571 @@ +// cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build riscv64 && openbsd +// +build riscv64,openbsd + +package unix + +const ( + SizeofPtr = 0x8 + SizeofShort = 0x2 + SizeofInt = 0x4 + SizeofLong = 0x8 + SizeofLongLong = 0x8 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type _Gid_t uint32 + +type Stat_t struct { + Mode uint32 + Dev int32 + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Rdev int32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + _ Timespec +} + +type Statfs_t struct { + F_flags uint32 + F_bsize uint32 + F_iosize uint32 + F_blocks uint64 + F_bfree uint64 + F_bavail int64 + F_files uint64 + F_ffree uint64 + F_favail int64 + F_syncwrites uint64 + F_syncreads uint64 + F_asyncwrites uint64 + F_asyncreads uint64 + F_fsid Fsid + F_namemax uint32 + F_owner uint32 + F_ctime uint64 + F_fstypename [16]byte + F_mntonname [90]byte + F_mntfromname [90]byte + F_mntfromspec [90]byte + _ [2]byte + Mount_info [160]byte +} + +type Flock_t struct { + Start int64 + Len int64 + Pid int32 + Type int16 + Whence int16 +} + +type Dirent struct { + Fileno uint64 + Off int64 + Reclen uint16 + Type uint8 + Namlen uint8 + _ [4]uint8 + Name [256]int8 +} + +type Fsid struct { + Val [2]int32 +} + +const ( + PathMax = 0x400 +) + +type RawSockaddrInet4 struct { + Len uint8 + Family uint8 + Port uint16 + Addr [4]byte /* in_addr */ + Zero [8]int8 +} + +type RawSockaddrInet6 struct { + Len uint8 + Family uint8 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 +} + +type RawSockaddrUnix struct { + Len uint8 + Family uint8 + Path [104]int8 +} + +type RawSockaddrDatalink struct { + Len uint8 + Family uint8 + Index uint16 + Type uint8 + Nlen uint8 + Alen uint8 + Slen uint8 + Data [24]int8 +} + +type RawSockaddr struct { + Len uint8 + Family uint8 + Data [14]int8 +} + +type RawSockaddrAny struct { + Addr RawSockaddr + Pad [92]int8 +} + +type _Socklen uint32 + +type Linger struct { + Onoff int32 + Linger int32 +} + +type Iovec struct { + Base *byte + Len uint64 +} + +type IPMreq struct { + Multiaddr [4]byte /* in_addr */ + Interface [4]byte /* in_addr */ +} + +type IPv6Mreq struct { + Multiaddr [16]byte /* in6_addr */ + Interface uint32 +} + +type Msghdr struct { + Name *byte + Namelen uint32 + Iov *Iovec + Iovlen uint32 + Control *byte + Controllen uint32 + Flags int32 +} + +type Cmsghdr struct { + Len uint32 + Level int32 + Type int32 +} + +type Inet6Pktinfo struct { + Addr [16]byte /* in6_addr */ + Ifindex uint32 +} + +type IPv6MTUInfo struct { + Addr RawSockaddrInet6 + Mtu uint32 +} + +type ICMPv6Filter struct { + Filt [8]uint32 +} + +const ( + SizeofSockaddrInet4 = 0x10 + SizeofSockaddrInet6 = 0x1c + SizeofSockaddrAny = 0x6c + SizeofSockaddrUnix = 0x6a + SizeofSockaddrDatalink = 0x20 + SizeofLinger = 0x8 + SizeofIovec = 0x10 + SizeofIPMreq = 0x8 + SizeofIPv6Mreq = 0x14 + SizeofMsghdr = 0x30 + SizeofCmsghdr = 0xc + SizeofInet6Pktinfo = 0x14 + SizeofIPv6MTUInfo = 0x20 + SizeofICMPv6Filter = 0x20 +) + +const ( + PTRACE_TRACEME = 0x0 + PTRACE_CONT = 0x7 + PTRACE_KILL = 0x8 +) + +type Kevent_t struct { + Ident uint64 + Filter int16 + Flags uint16 + Fflags uint32 + Data int64 + Udata *byte +} + +type FdSet struct { + Bits [32]uint32 +} + +const ( + SizeofIfMsghdr = 0xa8 + SizeofIfData = 0x90 + SizeofIfaMsghdr = 0x18 + SizeofIfAnnounceMsghdr = 0x1a + SizeofRtMsghdr = 0x60 + SizeofRtMetrics = 0x38 +) + +type IfMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + Tableid uint16 + Pad1 uint8 + Pad2 uint8 + Addrs int32 + Flags int32 + Xflags int32 + Data IfData +} + +type IfData struct { + Type uint8 + Addrlen uint8 + Hdrlen uint8 + Link_state uint8 + Mtu uint32 + Metric uint32 + Rdomain uint32 + Baudrate uint64 + Ipackets uint64 + Ierrors uint64 + Opackets uint64 + Oerrors uint64 + Collisions uint64 + Ibytes uint64 + Obytes uint64 + Imcasts uint64 + Omcasts uint64 + Iqdrops uint64 + Oqdrops uint64 + Noproto uint64 + Capabilities uint32 + Lastchange Timeval +} + +type IfaMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + Tableid uint16 + Pad1 uint8 + Pad2 uint8 + Addrs int32 + Flags int32 + Metric int32 +} + +type IfAnnounceMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + What uint16 + Name [16]int8 +} + +type RtMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + Tableid uint16 + Priority uint8 + Mpls uint8 + Addrs int32 + Flags int32 + Fmask int32 + Pid int32 + Seq int32 + Errno int32 + Inits uint32 + Rmx RtMetrics +} + +type RtMetrics struct { + Pksent uint64 + Expire int64 + Locks uint32 + Mtu uint32 + Refcnt uint32 + Hopcount uint32 + Recvpipe uint32 + Sendpipe uint32 + Ssthresh uint32 + Rtt uint32 + Rttvar uint32 + Pad uint32 +} + +type Mclpool struct{} + +const ( + SizeofBpfVersion = 0x4 + SizeofBpfStat = 0x8 + SizeofBpfProgram = 0x10 + SizeofBpfInsn = 0x8 + SizeofBpfHdr = 0x18 +) + +type BpfVersion struct { + Major uint16 + Minor uint16 +} + +type BpfStat struct { + Recv uint32 + Drop uint32 +} + +type BpfProgram struct { + Len uint32 + Insns *BpfInsn +} + +type BpfInsn struct { + Code uint16 + Jt uint8 + Jf uint8 + K uint32 +} + +type BpfHdr struct { + Tstamp BpfTimeval + Caplen uint32 + Datalen uint32 + Hdrlen uint16 + Ifidx uint16 + Flowid uint16 + Flags uint8 + Drops uint8 +} + +type BpfTimeval struct { + Sec uint32 + Usec uint32 +} + +type Termios struct { + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Cc [20]uint8 + Ispeed int32 + Ospeed int32 +} + +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + +const ( + AT_FDCWD = -0x64 + AT_EACCESS = 0x1 + AT_SYMLINK_NOFOLLOW = 0x2 + AT_SYMLINK_FOLLOW = 0x4 + AT_REMOVEDIR = 0x8 +) + +type PollFd struct { + Fd int32 + Events int16 + Revents int16 +} + +const ( + POLLERR = 0x8 + POLLHUP = 0x10 + POLLIN = 0x1 + POLLNVAL = 0x20 + POLLOUT = 0x4 + POLLPRI = 0x2 + POLLRDBAND = 0x80 + POLLRDNORM = 0x40 + POLLWRBAND = 0x100 + POLLWRNORM = 0x4 +) + +type Sigset_t uint32 + +type Utsname struct { + Sysname [256]byte + Nodename [256]byte + Release [256]byte + Version [256]byte + Machine [256]byte +} + +const SizeofUvmexp = 0x158 + +type Uvmexp struct { + Pagesize int32 + Pagemask int32 + Pageshift int32 + Npages int32 + Free int32 + Active int32 + Inactive int32 + Paging int32 + Wired int32 + Zeropages int32 + Reserve_pagedaemon int32 + Reserve_kernel int32 + Unused01 int32 + Vnodepages int32 + Vtextpages int32 + Freemin int32 + Freetarg int32 + Inactarg int32 + Wiredmax int32 + Anonmin int32 + Vtextmin int32 + Vnodemin int32 + Anonminpct int32 + Vtextminpct int32 + Vnodeminpct int32 + Nswapdev int32 + Swpages int32 + Swpginuse int32 + Swpgonly int32 + Nswget int32 + Nanon int32 + Unused05 int32 + Unused06 int32 + Faults int32 + Traps int32 + Intrs int32 + Swtch int32 + Softs int32 + Syscalls int32 + Pageins int32 + Unused07 int32 + Unused08 int32 + Pgswapin int32 + Pgswapout int32 + Forks int32 + Forks_ppwait int32 + Forks_sharevm int32 + Pga_zerohit int32 + Pga_zeromiss int32 + Unused09 int32 + Fltnoram int32 + Fltnoanon int32 + Fltnoamap int32 + Fltpgwait int32 + Fltpgrele int32 + Fltrelck int32 + Fltrelckok int32 + Fltanget int32 + Fltanretry int32 + Fltamcopy int32 + Fltnamap int32 + Fltnomap int32 + Fltlget int32 + Fltget int32 + Flt_anon int32 + Flt_acow int32 + Flt_obj int32 + Flt_prcopy int32 + Flt_przero int32 + Pdwoke int32 + Pdrevs int32 + Pdswout int32 + Pdfreed int32 + Pdscans int32 + Pdanscan int32 + Pdobscan int32 + Pdreact int32 + Pdbusy int32 + Pdpageouts int32 + Pdpending int32 + Pddeact int32 + Unused11 int32 + Unused12 int32 + Unused13 int32 + Fpswtch int32 + Kmapent int32 +} + +const SizeofClockinfo = 0x10 + +type Clockinfo struct { + Hz int32 + Tick int32 + Stathz int32 + Profhz int32 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go index ad4aad279686..0400747c67d4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go @@ -178,7 +178,7 @@ type Linger struct { } type Iovec struct { - Base *int8 + Base *byte Len uint64 } @@ -480,3 +480,38 @@ const ( MOUNTEDOVER = 0x40000000 FILE_EXCEPTION = 0x60000070 ) + +const ( + TUNNEWPPA = 0x540001 + TUNSETPPA = 0x540002 + + I_STR = 0x5308 + I_POP = 0x5303 + I_PUSH = 0x5302 + I_LINK = 0x530c + I_UNLINK = 0x530d + I_PLINK = 0x5316 + I_PUNLINK = 0x5317 + + IF_UNITSEL = -0x7ffb8cca +) + +type strbuf struct { + Maxlen int32 + Len int32 + Buf *int8 +} + +type Strioctl struct { + Cmd int32 + Timout int32 + Len int32 + Dp *int8 +} + +type Lifreq struct { + Name [32]int8 + Lifru1 [4]byte + Type uint32 + Lifru [336]byte +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go index 4ab638cb94c7..aec1efcb306a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go @@ -339,7 +339,7 @@ type Statfs_t struct { Flags uint64 } -type Dirent struct { +type direntLE struct { Reclen uint16 Namlen uint16 Ino uint32 @@ -347,6 +347,15 @@ type Dirent struct { Name [256]byte } +type Dirent struct { + Ino uint64 + Off int64 + Reclen uint16 + Type uint8 + Name [256]uint8 + _ [5]byte +} + type FdSet struct { Bits [64]int32 } diff --git a/vendor/golang.org/x/text/AUTHORS b/vendor/golang.org/x/text/AUTHORS deleted file mode 100644 index 15167cd746c5..000000000000 --- a/vendor/golang.org/x/text/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/text/CONTRIBUTORS b/vendor/golang.org/x/text/CONTRIBUTORS deleted file mode 100644 index 1c4577e96806..000000000000 --- a/vendor/golang.org/x/text/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/text/unicode/bidi/core.go b/vendor/golang.org/x/text/unicode/bidi/core.go index e4c0811016c2..9d2ae547b5ed 100644 --- a/vendor/golang.org/x/text/unicode/bidi/core.go +++ b/vendor/golang.org/x/text/unicode/bidi/core.go @@ -193,14 +193,14 @@ func (p *paragraph) run() { // // At the end of this function: // -// - The member variable matchingPDI is set to point to the index of the -// matching PDI character for each isolate initiator character. If there is -// no matching PDI, it is set to the length of the input text. For other -// characters, it is set to -1. -// - The member variable matchingIsolateInitiator is set to point to the -// index of the matching isolate initiator character for each PDI character. -// If there is no matching isolate initiator, or the character is not a PDI, -// it is set to -1. +// - The member variable matchingPDI is set to point to the index of the +// matching PDI character for each isolate initiator character. If there is +// no matching PDI, it is set to the length of the input text. For other +// characters, it is set to -1. +// - The member variable matchingIsolateInitiator is set to point to the +// index of the matching isolate initiator character for each PDI character. +// If there is no matching isolate initiator, or the character is not a PDI, +// it is set to -1. func (p *paragraph) determineMatchingIsolates() { p.matchingPDI = make([]int, p.Len()) p.matchingIsolateInitiator = make([]int, p.Len()) @@ -435,7 +435,7 @@ func maxLevel(a, b level) level { } // Rule X10, second bullet: Determine the start-of-sequence (sos) and end-of-sequence (eos) types, -// either L or R, for each isolating run sequence. +// either L or R, for each isolating run sequence. func (p *paragraph) isolatingRunSequence(indexes []int) *isolatingRunSequence { length := len(indexes) types := make([]Class, length) @@ -495,9 +495,9 @@ func (s *isolatingRunSequence) resolveWeakTypes() { if t == NSM { s.types[i] = precedingCharacterType } else { - if t.in(LRI, RLI, FSI, PDI) { - precedingCharacterType = ON - } + // if t.in(LRI, RLI, FSI, PDI) { + // precedingCharacterType = ON + // } precedingCharacterType = t } } @@ -905,7 +905,7 @@ func (p *paragraph) getLevels(linebreaks []int) []level { // Lines are concatenated from left to right. So for example, the fifth // character from the left on the third line is // -// getReordering(linebreaks)[linebreaks[1] + 4] +// getReordering(linebreaks)[linebreaks[1] + 4] // // (linebreaks[1] is the position after the last character of the second // line, which is also the index of the first character on the third line, diff --git a/vendor/golang.org/x/text/unicode/bidi/trieval.go b/vendor/golang.org/x/text/unicode/bidi/trieval.go index 4c459c4b72e0..6a796e2214c6 100644 --- a/vendor/golang.org/x/text/unicode/bidi/trieval.go +++ b/vendor/golang.org/x/text/unicode/bidi/trieval.go @@ -37,18 +37,6 @@ const ( unknownClass = ^Class(0) ) -var controlToClass = map[rune]Class{ - 0x202D: LRO, // LeftToRightOverride, - 0x202E: RLO, // RightToLeftOverride, - 0x202A: LRE, // LeftToRightEmbedding, - 0x202B: RLE, // RightToLeftEmbedding, - 0x202C: PDF, // PopDirectionalFormat, - 0x2066: LRI, // LeftToRightIsolate, - 0x2067: RLI, // RightToLeftIsolate, - 0x2068: FSI, // FirstStrongIsolate, - 0x2069: PDI, // PopDirectionalIsolate, -} - // A trie entry has the following bits: // 7..5 XOR mask for brackets // 4 1: Bracket open, 0: Bracket close diff --git a/vendor/golang.org/x/text/unicode/norm/forminfo.go b/vendor/golang.org/x/text/unicode/norm/forminfo.go index 526c7033ac46..d69ccb4f9761 100644 --- a/vendor/golang.org/x/text/unicode/norm/forminfo.go +++ b/vendor/golang.org/x/text/unicode/norm/forminfo.go @@ -110,10 +110,11 @@ func (p Properties) BoundaryAfter() bool { } // We pack quick check data in 4 bits: -// 5: Combines forward (0 == false, 1 == true) -// 4..3: NFC_QC Yes(00), No (10), or Maybe (11) -// 2: NFD_QC Yes (0) or No (1). No also means there is a decomposition. -// 1..0: Number of trailing non-starters. +// +// 5: Combines forward (0 == false, 1 == true) +// 4..3: NFC_QC Yes(00), No (10), or Maybe (11) +// 2: NFD_QC Yes (0) or No (1). No also means there is a decomposition. +// 1..0: Number of trailing non-starters. // // When all 4 bits are zero, the character is inert, meaning it is never // influenced by normalization. diff --git a/vendor/golang.org/x/text/unicode/norm/normalize.go b/vendor/golang.org/x/text/unicode/norm/normalize.go index 95efcf26e81d..4747ad07a839 100644 --- a/vendor/golang.org/x/text/unicode/norm/normalize.go +++ b/vendor/golang.org/x/text/unicode/norm/normalize.go @@ -18,16 +18,17 @@ import ( // A Form denotes a canonical representation of Unicode code points. // The Unicode-defined normalization and equivalence forms are: // -// NFC Unicode Normalization Form C -// NFD Unicode Normalization Form D -// NFKC Unicode Normalization Form KC -// NFKD Unicode Normalization Form KD +// NFC Unicode Normalization Form C +// NFD Unicode Normalization Form D +// NFKC Unicode Normalization Form KC +// NFKD Unicode Normalization Form KD // // For a Form f, this documentation uses the notation f(x) to mean // the bytes or string x converted to the given form. // A position n in x is called a boundary if conversion to the form can // proceed independently on both sides: -// f(x) == append(f(x[0:n]), f(x[n:])...) +// +// f(x) == append(f(x[0:n]), f(x[n:])...) // // References: https://unicode.org/reports/tr15/ and // https://unicode.org/notes/tn5/. diff --git a/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go index 96a130d30e9e..9115ef257e83 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go +++ b/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go @@ -7315,7 +7315,7 @@ const recompMapPacked = "" + "\x00V\x03\x03\x00\x00\x1e|" + // 0x00560303: 0x00001E7C "\x00v\x03\x03\x00\x00\x1e}" + // 0x00760303: 0x00001E7D "\x00V\x03#\x00\x00\x1e~" + // 0x00560323: 0x00001E7E - "\x00v\x03#\x00\x00\x1e\u007f" + // 0x00760323: 0x00001E7F + "\x00v\x03#\x00\x00\x1e\x7f" + // 0x00760323: 0x00001E7F "\x00W\x03\x00\x00\x00\x1e\x80" + // 0x00570300: 0x00001E80 "\x00w\x03\x00\x00\x00\x1e\x81" + // 0x00770300: 0x00001E81 "\x00W\x03\x01\x00\x00\x1e\x82" + // 0x00570301: 0x00001E82 @@ -7342,7 +7342,7 @@ const recompMapPacked = "" + "\x00t\x03\b\x00\x00\x1e\x97" + // 0x00740308: 0x00001E97 "\x00w\x03\n\x00\x00\x1e\x98" + // 0x0077030A: 0x00001E98 "\x00y\x03\n\x00\x00\x1e\x99" + // 0x0079030A: 0x00001E99 - "\x01\u007f\x03\a\x00\x00\x1e\x9b" + // 0x017F0307: 0x00001E9B + "\x01\x7f\x03\a\x00\x00\x1e\x9b" + // 0x017F0307: 0x00001E9B "\x00A\x03#\x00\x00\x1e\xa0" + // 0x00410323: 0x00001EA0 "\x00a\x03#\x00\x00\x1e\xa1" + // 0x00610323: 0x00001EA1 "\x00A\x03\t\x00\x00\x1e\xa2" + // 0x00410309: 0x00001EA2 diff --git a/vendor/golang.org/x/tools/AUTHORS b/vendor/golang.org/x/tools/AUTHORS deleted file mode 100644 index 15167cd746c5..000000000000 --- a/vendor/golang.org/x/tools/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/tools/CONTRIBUTORS b/vendor/golang.org/x/tools/CONTRIBUTORS deleted file mode 100644 index 1c4577e96806..000000000000 --- a/vendor/golang.org/x/tools/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go b/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go index a5c6d6d4fa06..9fa5aa192c29 100644 --- a/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go +++ b/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go @@ -22,9 +22,9 @@ import ( // additional whitespace abutting a node to be enclosed by it. // In this example: // -// z := x + y // add them -// <-A-> -// <----B-----> +// z := x + y // add them +// <-A-> +// <----B-----> // // the ast.BinaryExpr(+) node is considered to enclose interval B // even though its [Pos()..End()) is actually only interval A. @@ -43,10 +43,10 @@ import ( // interior whitespace of path[0]. // In this example: // -// z := x + y // add them -// <--C--> <---E--> -// ^ -// D +// z := x + y // add them +// <--C--> <---E--> +// ^ +// D // // intervals C, D and E are inexact. C is contained by the // z-assignment statement, because it spans three of its children (:=, @@ -54,12 +54,11 @@ import ( // interior whitespace of the assignment. E is considered interior // whitespace of the BlockStmt containing the assignment. // -// Precondition: [start, end) both lie within the same file as root. -// TODO(adonovan): return (nil, false) in this case and remove precond. -// Requires FileSet; see loader.tokenFileContainsPos. -// -// Postcondition: path is never nil; it always contains at least 'root'. -// +// The resulting path is never empty; it always contains at least the +// 'root' *ast.File. Ideally PathEnclosingInterval would reject +// intervals that lie wholly or partially outside the range of the +// file, but unfortunately ast.File records only the token.Pos of +// the 'package' keyword, but not of the start of the file itself. func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Node, exact bool) { // fmt.Printf("EnclosingInterval %d %d\n", start, end) // debugging @@ -135,6 +134,7 @@ func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Nod return false // inexact: overlaps multiple children } + // Ensure [start,end) is nondecreasing. if start > end { start, end = end, start } @@ -162,7 +162,6 @@ func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Nod // tokenNode is a dummy implementation of ast.Node for a single token. // They are used transiently by PathEnclosingInterval but never escape // this package. -// type tokenNode struct { pos token.Pos end token.Pos @@ -183,7 +182,6 @@ func tok(pos token.Pos, len int) ast.Node { // childrenOf returns the direct non-nil children of ast.Node n. // It may include fake ast.Node implementations for bare tokens. // it is not safe to call (e.g.) ast.Walk on such nodes. -// func childrenOf(n ast.Node) []ast.Node { var children []ast.Node @@ -488,7 +486,6 @@ func (sl byPos) Swap(i, j int) { // TODO(adonovan): in some cases (e.g. Field, FieldList, Ident, // StarExpr) we could be much more specific given the path to the AST // root. Perhaps we should do that. -// func NodeDescription(n ast.Node) string { switch n := n.(type) { case *ast.ArrayType: diff --git a/vendor/golang.org/x/tools/go/ast/astutil/imports.go b/vendor/golang.org/x/tools/go/ast/astutil/imports.go index 2087ceec9cfd..18d1adb05ddc 100644 --- a/vendor/golang.org/x/tools/go/ast/astutil/imports.go +++ b/vendor/golang.org/x/tools/go/ast/astutil/imports.go @@ -22,8 +22,11 @@ func AddImport(fset *token.FileSet, f *ast.File, path string) (added bool) { // If name is not empty, it is used to rename the import. // // For example, calling +// // AddNamedImport(fset, f, "pathpkg", "path") +// // adds +// // import pathpkg "path" func AddNamedImport(fset *token.FileSet, f *ast.File, name, path string) (added bool) { if imports(f, name, path) { @@ -270,8 +273,8 @@ func DeleteNamedImport(fset *token.FileSet, f *ast.File, name, path string) (del } if j > 0 { lastImpspec := gen.Specs[j-1].(*ast.ImportSpec) - lastLine := fset.Position(lastImpspec.Path.ValuePos).Line - line := fset.Position(impspec.Path.ValuePos).Line + lastLine := fset.PositionFor(lastImpspec.Path.ValuePos, false).Line + line := fset.PositionFor(impspec.Path.ValuePos, false).Line // We deleted an entry but now there may be // a blank line-sized hole where the import was. diff --git a/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go b/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go index 6d9ca23e2b02..f430b21b9b9a 100644 --- a/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go +++ b/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go @@ -41,7 +41,6 @@ type ApplyFunc func(*Cursor) bool // Children are traversed in the order in which they appear in the // respective node's struct definition. A package's files are // traversed in the filenames' alphabetical order. -// func Apply(root ast.Node, pre, post ApplyFunc) (result ast.Node) { parent := &struct{ ast.Node }{root} defer func() { @@ -65,8 +64,8 @@ var abort = new(int) // singleton, to signal termination of Apply // c.Parent(), and f is the field identifier with name c.Name(), // the following invariants hold: // -// p.f == c.Node() if c.Index() < 0 -// p.f[c.Index()] == c.Node() if c.Index() >= 0 +// p.f == c.Node() if c.Index() < 0 +// p.f[c.Index()] == c.Node() if c.Index() >= 0 // // The methods Replace, Delete, InsertBefore, and InsertAfter // can be used to change the AST without disrupting Apply. @@ -294,6 +293,9 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. a.apply(n, "Fields", nil, n.Fields) case *ast.FuncType: + if tparams := typeparams.ForFuncType(n); tparams != nil { + a.apply(n, "TypeParams", nil, tparams) + } a.apply(n, "Params", nil, n.Params) a.apply(n, "Results", nil, n.Results) @@ -406,6 +408,9 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast. case *ast.TypeSpec: a.apply(n, "Doc", nil, n.Doc) a.apply(n, "Name", nil, n.Name) + if tparams := typeparams.ForTypeSpec(n); tparams != nil { + a.apply(n, "TypeParams", nil, tparams) + } a.apply(n, "Type", nil, n.Type) a.apply(n, "Comment", nil, n.Comment) diff --git a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go index cec819d64106..2ed25a750248 100644 --- a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go +++ b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go @@ -17,32 +17,47 @@ // developer tools, which will then be able to consume both Go 1.7 and // Go 1.8 export data files, so they will work before and after the // Go update. (See discussion at https://golang.org/issue/15651.) -// package gcexportdata // import "golang.org/x/tools/go/gcexportdata" import ( "bufio" "bytes" + "encoding/json" "fmt" "go/token" "go/types" "io" "io/ioutil" + "os/exec" "golang.org/x/tools/go/internal/gcimporter" ) // Find returns the name of an object (.o) or archive (.a) file // containing type information for the specified import path, -// using the workspace layout conventions of go/build. +// using the go command. // If no file was found, an empty filename is returned. // // A relative srcDir is interpreted relative to the current working directory. // // Find also returns the package's resolved (canonical) import path, // reflecting the effects of srcDir and vendoring on importPath. +// +// Deprecated: Use the higher-level API in golang.org/x/tools/go/packages, +// which is more efficient. func Find(importPath, srcDir string) (filename, path string) { - return gcimporter.FindPkg(importPath, srcDir) + cmd := exec.Command("go", "list", "-json", "-export", "--", importPath) + cmd.Dir = srcDir + out, err := cmd.CombinedOutput() + if err != nil { + return "", "" + } + var data struct { + ImportPath string + Export string + } + json.Unmarshal(out, &data) + return data.Export, data.ImportPath } // NewReader returns a reader for the export data section of an object @@ -101,13 +116,29 @@ func Read(in io.Reader, fset *token.FileSet, imports map[string]*types.Package, // The indexed export format starts with an 'i'; the older // binary export format starts with a 'c', 'd', or 'v' // (from "version"). Select appropriate importer. - if len(data) > 0 && data[0] == 'i' { - _, pkg, err := gcimporter.IImportData(fset, imports, data[1:], path) - return pkg, err - } + if len(data) > 0 { + switch data[0] { + case 'i': + _, pkg, err := gcimporter.IImportData(fset, imports, data[1:], path) + return pkg, err + + case 'v', 'c', 'd': + _, pkg, err := gcimporter.BImportData(fset, imports, data, path) + return pkg, err - _, pkg, err := gcimporter.BImportData(fset, imports, data, path) - return pkg, err + case 'u': + _, pkg, err := gcimporter.UImportData(fset, imports, data[1:], path) + return pkg, err + + default: + l := len(data) + if l > 10 { + l = 10 + } + return nil, fmt.Errorf("unexpected export data with prefix %q for path %s", string(data[:l]), path) + } + } + return nil, fmt.Errorf("empty export data for %s", path) } // Write writes encoded type information for the specified package to out. diff --git a/vendor/golang.org/x/tools/go/gcexportdata/importer.go b/vendor/golang.org/x/tools/go/gcexportdata/importer.go index efe221e7e142..37a7247e2686 100644 --- a/vendor/golang.org/x/tools/go/gcexportdata/importer.go +++ b/vendor/golang.org/x/tools/go/gcexportdata/importer.go @@ -23,6 +23,8 @@ import ( // or to control the FileSet or access the imports map populated during // package loading. // +// Deprecated: Use the higher-level API in golang.org/x/tools/go/packages, +// which is more efficient. func NewImporter(fset *token.FileSet, imports map[string]*types.Package) types.ImporterFrom { return importer{fset, imports} } diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go index 0a3cdb9a3b81..196cb3f9b41a 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go @@ -35,16 +35,18 @@ import ( const debugFormat = false // default: false // Current export format version. Increase with each format change. +// // Note: The latest binary (non-indexed) export format is at version 6. -// This exporter is still at level 4, but it doesn't matter since -// the binary importer can handle older versions just fine. -// 6: package height (CL 105038) -- NOT IMPLEMENTED HERE -// 5: improved position encoding efficiency (issue 20080, CL 41619) -- NOT IMPLEMEMTED HERE -// 4: type name objects support type aliases, uses aliasTag -// 3: Go1.8 encoding (same as version 2, aliasTag defined but never used) -// 2: removed unused bool in ODCL export (compiler only) -// 1: header format change (more regular), export package for _ struct fields -// 0: Go1.7 encoding +// This exporter is still at level 4, but it doesn't matter since +// the binary importer can handle older versions just fine. +// +// 6: package height (CL 105038) -- NOT IMPLEMENTED HERE +// 5: improved position encoding efficiency (issue 20080, CL 41619) -- NOT IMPLEMENTED HERE +// 4: type name objects support type aliases, uses aliasTag +// 3: Go1.8 encoding (same as version 2, aliasTag defined but never used) +// 2: removed unused bool in ODCL export (compiler only) +// 1: header format change (more regular), export package for _ struct fields +// 0: Go1.7 encoding const exportVersion = 4 // trackAllTypes enables cycle tracking for all types, not just named diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go b/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go index 3ab66830d747..e96c39600d16 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go @@ -45,7 +45,6 @@ var pkgExts = [...]string{".a", ".o"} // the build.Default build.Context). A relative srcDir is interpreted // relative to the current working directory. // If no file was found, an empty filename is returned. -// func FindPkg(path, srcDir string) (filename, id string) { if path == "" { return @@ -109,7 +108,6 @@ func FindPkg(path, srcDir string) (filename, id string) { // If packages[id] contains the completely imported package, that package // can be used directly, and there is no need to call this function (but // there is also no harm but for extra time used). -// func ImportData(packages map[string]*types.Package, filename, id string, data io.Reader) (pkg *types.Package, err error) { // support for parser error handling defer func() { @@ -133,7 +131,6 @@ func ImportData(packages map[string]*types.Package, filename, id string, data io // Import imports a gc-generated package given its import path and srcDir, adds // the corresponding package object to the packages map, and returns the object. // The packages map must contain all packages already imported. -// func Import(packages map[string]*types.Package, path, srcDir string, lookup func(path string) (io.ReadCloser, error)) (pkg *types.Package, err error) { var rc io.ReadCloser var filename, id string @@ -184,8 +181,9 @@ func Import(packages map[string]*types.Package, path, srcDir string, lookup func defer rc.Close() var hdr string + var size int64 buf := bufio.NewReader(rc) - if hdr, _, err = FindExportData(buf); err != nil { + if hdr, size, err = FindExportData(buf); err != nil { return } @@ -213,10 +211,27 @@ func Import(packages map[string]*types.Package, path, srcDir string, lookup func // The indexed export format starts with an 'i'; the older // binary export format starts with a 'c', 'd', or 'v' // (from "version"). Select appropriate importer. - if len(data) > 0 && data[0] == 'i' { - _, pkg, err = IImportData(fset, packages, data[1:], id) - } else { - _, pkg, err = BImportData(fset, packages, data, id) + if len(data) > 0 { + switch data[0] { + case 'i': + _, pkg, err := IImportData(fset, packages, data[1:], id) + return pkg, err + + case 'v', 'c', 'd': + _, pkg, err := BImportData(fset, packages, data, id) + return pkg, err + + case 'u': + _, pkg, err := UImportData(fset, packages, data[1:size], id) + return pkg, err + + default: + l := len(data) + if l > 10 { + l = 10 + } + return nil, fmt.Errorf("unexpected export data with prefix %q for path %s", string(data[:l]), id) + } } default: @@ -348,8 +363,9 @@ func (p *parser) expectKeyword(keyword string) { // ---------------------------------------------------------------------------- // Qualified and unqualified names -// PackageId = string_lit . +// parsePackageID parses a PackageId: // +// PackageId = string_lit . func (p *parser) parsePackageID() string { id, err := strconv.Unquote(p.expect(scanner.String)) if err != nil { @@ -363,13 +379,16 @@ func (p *parser) parsePackageID() string { return id } -// PackageName = ident . +// parsePackageName parse a PackageName: // +// PackageName = ident . func (p *parser) parsePackageName() string { return p.expect(scanner.Ident) } -// dotIdentifier = ( ident | '·' ) { ident | int | '·' } . +// parseDotIdent parses a dotIdentifier: +// +// dotIdentifier = ( ident | '·' ) { ident | int | '·' } . func (p *parser) parseDotIdent() string { ident := "" if p.tok != scanner.Int { @@ -386,8 +405,9 @@ func (p *parser) parseDotIdent() string { return ident } -// QualifiedName = "@" PackageId "." ( "?" | dotIdentifier ) . +// parseQualifiedName parses a QualifiedName: // +// QualifiedName = "@" PackageId "." ( "?" | dotIdentifier ) . func (p *parser) parseQualifiedName() (id, name string) { p.expect('@') id = p.parsePackageID() @@ -410,7 +430,6 @@ func (p *parser) parseQualifiedName() (id, name string) { // id identifies a package, usually by a canonical package path like // "encoding/json" but possibly by a non-canonical import path like // "./json". -// func (p *parser) getPkg(id, name string) *types.Package { // package unsafe is not in the packages maps - handle explicitly if id == "unsafe" { @@ -446,7 +465,6 @@ func (p *parser) getPkg(id, name string) *types.Package { // parseExportedName is like parseQualifiedName, but // the package id is resolved to an imported *types.Package. -// func (p *parser) parseExportedName() (pkg *types.Package, name string) { id, name := p.parseQualifiedName() pkg = p.getPkg(id, "") @@ -456,8 +474,9 @@ func (p *parser) parseExportedName() (pkg *types.Package, name string) { // ---------------------------------------------------------------------------- // Types -// BasicType = identifier . +// parseBasicType parses a BasicType: // +// BasicType = identifier . func (p *parser) parseBasicType() types.Type { id := p.expect(scanner.Ident) obj := types.Universe.Lookup(id) @@ -468,8 +487,9 @@ func (p *parser) parseBasicType() types.Type { return nil } -// ArrayType = "[" int_lit "]" Type . +// parseArrayType parses an ArrayType: // +// ArrayType = "[" int_lit "]" Type . func (p *parser) parseArrayType(parent *types.Package) types.Type { // "[" already consumed and lookahead known not to be "]" lit := p.expect(scanner.Int) @@ -482,8 +502,9 @@ func (p *parser) parseArrayType(parent *types.Package) types.Type { return types.NewArray(elem, n) } -// MapType = "map" "[" Type "]" Type . +// parseMapType parses a MapType: // +// MapType = "map" "[" Type "]" Type . func (p *parser) parseMapType(parent *types.Package) types.Type { p.expectKeyword("map") p.expect('[') @@ -493,7 +514,9 @@ func (p *parser) parseMapType(parent *types.Package) types.Type { return types.NewMap(key, elem) } -// Name = identifier | "?" | QualifiedName . +// parseName parses a Name: +// +// Name = identifier | "?" | QualifiedName . // // For unqualified and anonymous names, the returned package is the parent // package unless parent == nil, in which case the returned package is the @@ -505,7 +528,6 @@ func (p *parser) parseMapType(parent *types.Package) types.Type { // it doesn't exist yet) unless materializePkg is set (which creates an // unnamed package with valid package path). In the latter case, a // subsequent import clause is expected to provide a name for the package. -// func (p *parser) parseName(parent *types.Package, materializePkg bool) (pkg *types.Package, name string) { pkg = parent if pkg == nil { @@ -539,8 +561,9 @@ func deref(typ types.Type) types.Type { return typ } -// Field = Name Type [ string_lit ] . +// parseField parses a Field: // +// Field = Name Type [ string_lit ] . func (p *parser) parseField(parent *types.Package) (*types.Var, string) { pkg, name := p.parseName(parent, true) @@ -583,9 +606,10 @@ func (p *parser) parseField(parent *types.Package) (*types.Var, string) { return types.NewField(token.NoPos, pkg, name, typ, anonymous), tag } -// StructType = "struct" "{" [ FieldList ] "}" . -// FieldList = Field { ";" Field } . +// parseStructType parses a StructType: // +// StructType = "struct" "{" [ FieldList ] "}" . +// FieldList = Field { ";" Field } . func (p *parser) parseStructType(parent *types.Package) types.Type { var fields []*types.Var var tags []string @@ -610,8 +634,9 @@ func (p *parser) parseStructType(parent *types.Package) types.Type { return types.NewStruct(fields, tags) } -// Parameter = ( identifier | "?" ) [ "..." ] Type [ string_lit ] . +// parseParameter parses a Parameter: // +// Parameter = ( identifier | "?" ) [ "..." ] Type [ string_lit ] . func (p *parser) parseParameter() (par *types.Var, isVariadic bool) { _, name := p.parseName(nil, false) // remove gc-specific parameter numbering @@ -635,9 +660,10 @@ func (p *parser) parseParameter() (par *types.Var, isVariadic bool) { return } -// Parameters = "(" [ ParameterList ] ")" . -// ParameterList = { Parameter "," } Parameter . +// parseParameters parses a Parameters: // +// Parameters = "(" [ ParameterList ] ")" . +// ParameterList = { Parameter "," } Parameter . func (p *parser) parseParameters() (list []*types.Var, isVariadic bool) { p.expect('(') for p.tok != ')' && p.tok != scanner.EOF { @@ -658,9 +684,10 @@ func (p *parser) parseParameters() (list []*types.Var, isVariadic bool) { return } -// Signature = Parameters [ Result ] . -// Result = Type | Parameters . +// parseSignature parses a Signature: // +// Signature = Parameters [ Result ] . +// Result = Type | Parameters . func (p *parser) parseSignature(recv *types.Var) *types.Signature { params, isVariadic := p.parseParameters() @@ -677,14 +704,15 @@ func (p *parser) parseSignature(recv *types.Var) *types.Signature { return types.NewSignature(recv, types.NewTuple(params...), types.NewTuple(results...), isVariadic) } -// InterfaceType = "interface" "{" [ MethodList ] "}" . -// MethodList = Method { ";" Method } . -// Method = Name Signature . +// parseInterfaceType parses an InterfaceType: +// +// InterfaceType = "interface" "{" [ MethodList ] "}" . +// MethodList = Method { ";" Method } . +// Method = Name Signature . // // The methods of embedded interfaces are always "inlined" // by the compiler and thus embedded interfaces are never // visible in the export data. -// func (p *parser) parseInterfaceType(parent *types.Package) types.Type { var methods []*types.Func @@ -705,8 +733,9 @@ func (p *parser) parseInterfaceType(parent *types.Package) types.Type { return newInterface(methods, nil).Complete() } -// ChanType = ( "chan" [ "<-" ] | "<-" "chan" ) Type . +// parseChanType parses a ChanType: // +// ChanType = ( "chan" [ "<-" ] | "<-" "chan" ) Type . func (p *parser) parseChanType(parent *types.Package) types.Type { dir := types.SendRecv if p.tok == scanner.Ident { @@ -724,17 +753,18 @@ func (p *parser) parseChanType(parent *types.Package) types.Type { return types.NewChan(dir, elem) } -// Type = -// BasicType | TypeName | ArrayType | SliceType | StructType | -// PointerType | FuncType | InterfaceType | MapType | ChanType | -// "(" Type ")" . +// parseType parses a Type: // -// BasicType = ident . -// TypeName = ExportedName . -// SliceType = "[" "]" Type . -// PointerType = "*" Type . -// FuncType = "func" Signature . +// Type = +// BasicType | TypeName | ArrayType | SliceType | StructType | +// PointerType | FuncType | InterfaceType | MapType | ChanType | +// "(" Type ")" . // +// BasicType = ident . +// TypeName = ExportedName . +// SliceType = "[" "]" Type . +// PointerType = "*" Type . +// FuncType = "func" Signature . func (p *parser) parseType(parent *types.Package) types.Type { switch p.tok { case scanner.Ident: @@ -786,16 +816,18 @@ func (p *parser) parseType(parent *types.Package) types.Type { // ---------------------------------------------------------------------------- // Declarations -// ImportDecl = "import" PackageName PackageId . +// parseImportDecl parses an ImportDecl: // +// ImportDecl = "import" PackageName PackageId . func (p *parser) parseImportDecl() { p.expectKeyword("import") name := p.parsePackageName() p.getPkg(p.parsePackageID(), name) } -// int_lit = [ "+" | "-" ] { "0" ... "9" } . +// parseInt parses an int_lit: // +// int_lit = [ "+" | "-" ] { "0" ... "9" } . func (p *parser) parseInt() string { s := "" switch p.tok { @@ -808,8 +840,9 @@ func (p *parser) parseInt() string { return s + p.expect(scanner.Int) } -// number = int_lit [ "p" int_lit ] . +// parseNumber parses a number: // +// number = int_lit [ "p" int_lit ] . func (p *parser) parseNumber() (typ *types.Basic, val constant.Value) { // mantissa mant := constant.MakeFromLiteral(p.parseInt(), token.INT, 0) @@ -844,13 +877,14 @@ func (p *parser) parseNumber() (typ *types.Basic, val constant.Value) { return } -// ConstDecl = "const" ExportedName [ Type ] "=" Literal . -// Literal = bool_lit | int_lit | float_lit | complex_lit | rune_lit | string_lit . -// bool_lit = "true" | "false" . -// complex_lit = "(" float_lit "+" float_lit "i" ")" . -// rune_lit = "(" int_lit "+" int_lit ")" . -// string_lit = `"` { unicode_char } `"` . +// parseConstDecl parses a ConstDecl: // +// ConstDecl = "const" ExportedName [ Type ] "=" Literal . +// Literal = bool_lit | int_lit | float_lit | complex_lit | rune_lit | string_lit . +// bool_lit = "true" | "false" . +// complex_lit = "(" float_lit "+" float_lit "i" ")" . +// rune_lit = "(" int_lit "+" int_lit ")" . +// string_lit = `"` { unicode_char } `"` . func (p *parser) parseConstDecl() { p.expectKeyword("const") pkg, name := p.parseExportedName() @@ -920,8 +954,9 @@ func (p *parser) parseConstDecl() { pkg.Scope().Insert(types.NewConst(token.NoPos, pkg, name, typ0, val)) } -// TypeDecl = "type" ExportedName Type . +// parseTypeDecl parses a TypeDecl: // +// TypeDecl = "type" ExportedName Type . func (p *parser) parseTypeDecl() { p.expectKeyword("type") pkg, name := p.parseExportedName() @@ -939,8 +974,9 @@ func (p *parser) parseTypeDecl() { } } -// VarDecl = "var" ExportedName Type . +// parseVarDecl parses a VarDecl: // +// VarDecl = "var" ExportedName Type . func (p *parser) parseVarDecl() { p.expectKeyword("var") pkg, name := p.parseExportedName() @@ -948,9 +984,10 @@ func (p *parser) parseVarDecl() { pkg.Scope().Insert(types.NewVar(token.NoPos, pkg, name, typ)) } -// Func = Signature [ Body ] . -// Body = "{" ... "}" . +// parseFunc parses a Func: // +// Func = Signature [ Body ] . +// Body = "{" ... "}" . func (p *parser) parseFunc(recv *types.Var) *types.Signature { sig := p.parseSignature(recv) if p.tok == '{' { @@ -967,9 +1004,10 @@ func (p *parser) parseFunc(recv *types.Var) *types.Signature { return sig } -// MethodDecl = "func" Receiver Name Func . -// Receiver = "(" ( identifier | "?" ) [ "*" ] ExportedName ")" . +// parseMethodDecl parses a MethodDecl: // +// MethodDecl = "func" Receiver Name Func . +// Receiver = "(" ( identifier | "?" ) [ "*" ] ExportedName ")" . func (p *parser) parseMethodDecl() { // "func" already consumed p.expect('(') @@ -992,8 +1030,9 @@ func (p *parser) parseMethodDecl() { base.AddMethod(types.NewFunc(token.NoPos, pkg, name, sig)) } -// FuncDecl = "func" ExportedName Func . +// parseFuncDecl parses a FuncDecl: // +// FuncDecl = "func" ExportedName Func . func (p *parser) parseFuncDecl() { // "func" already consumed pkg, name := p.parseExportedName() @@ -1001,8 +1040,9 @@ func (p *parser) parseFuncDecl() { pkg.Scope().Insert(types.NewFunc(token.NoPos, pkg, name, typ)) } -// Decl = [ ImportDecl | ConstDecl | TypeDecl | VarDecl | FuncDecl | MethodDecl ] "\n" . +// parseDecl parses a Decl: // +// Decl = [ ImportDecl | ConstDecl | TypeDecl | VarDecl | FuncDecl | MethodDecl ] "\n" . func (p *parser) parseDecl() { if p.tok == scanner.Ident { switch p.lit { @@ -1029,9 +1069,10 @@ func (p *parser) parseDecl() { // ---------------------------------------------------------------------------- // Export -// Export = "PackageClause { Decl } "$$" . -// PackageClause = "package" PackageName [ "safe" ] "\n" . +// parseExport parses an Export: // +// Export = "PackageClause { Decl } "$$" . +// PackageClause = "package" PackageName [ "safe" ] "\n" . func (p *parser) parseExport() *types.Package { p.expectKeyword("package") name := p.parsePackageName() diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go index b4d51f352f4a..9a4ff329e128 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go @@ -20,6 +20,7 @@ import ( "math/big" "reflect" "sort" + "strconv" "strings" "golang.org/x/tools/internal/typeparams" @@ -158,7 +159,7 @@ func (w *exportWriter) writeIndex(index map[types.Object]uint64) { } for obj := range index { - name := w.p.indexName(obj) + name := w.p.exportName(obj) pkgObjs[obj.Pkg()] = append(pkgObjs[obj.Pkg()], pkgObj{obj, name}) } @@ -190,10 +191,9 @@ func (w *exportWriter) writeIndex(index map[types.Object]uint64) { } } -// indexName returns the 'indexed' name of an object. It differs from -// obj.Name() only for type parameter names, where the name is qualified by -// owner. -func (p *iexporter) indexName(obj types.Object) (res string) { +// exportName returns the 'exported' name of an object. It differs from +// obj.Name() only for type parameters (see tparamExportName for details). +func (p *iexporter) exportName(obj types.Object) (res string) { if name := p.tparamNames[obj]; name != "" { return name } @@ -219,7 +219,7 @@ type iexporter struct { data0 intWriter declIndex map[types.Object]uint64 - tparamNames map[types.Object]string // typeparam->qualified name + tparamNames map[types.Object]string // typeparam->exported name typIndex map[types.Type]uint64 indent int // for tracing support @@ -251,7 +251,10 @@ func (p *iexporter) stringOff(s string) uint64 { // pushDecl adds n to the declaration work queue, if not already present. func (p *iexporter) pushDecl(obj types.Object) { // Package unsafe is known to the compiler and predeclared. - assert(obj.Pkg() != types.Unsafe) + // Caller should not ask us to do export it. + if obj.Pkg() == types.Unsafe { + panic("cannot export package unsafe") + } if _, ok := p.declIndex[obj]; ok { return @@ -310,14 +313,15 @@ func (p *iexporter) doDecl(obj types.Object) { w.tag('G') } w.pos(obj.Pos()) - // The tparam list of the function type is the - // declaration of the type params. So, write out the type - // params right now. Then those type params will be - // referenced via their type offset (via typOff) in all - // other places in the signature and function that they - // are used. + // The tparam list of the function type is the declaration of the type + // params. So, write out the type params right now. Then those type params + // will be referenced via their type offset (via typOff) in all other + // places in the signature and function where they are used. + // + // While importing the type parameters, tparamList computes and records + // their export name, so that it can be later used when writing the index. if tparams := typeparams.ForSignature(sig); tparams.Len() > 0 { - w.tparamList(obj, tparams, obj.Pkg()) + w.tparamList(obj.Name(), tparams, obj.Pkg()) } w.signature(sig) @@ -365,7 +369,9 @@ func (p *iexporter) doDecl(obj types.Object) { w.pos(obj.Pos()) if typeparams.ForNamed(named).Len() > 0 { - w.tparamList(obj, typeparams.ForNamed(named), obj.Pkg()) + // While importing the type parameters, tparamList computes and records + // their export name, so that it can be later used when writing the index. + w.tparamList(obj.Name(), typeparams.ForNamed(named), obj.Pkg()) } underlying := obj.Type().Underlying() @@ -385,11 +391,13 @@ func (p *iexporter) doDecl(obj types.Object) { // Receiver type parameters are type arguments of the receiver type, so // their name must be qualified before exporting recv. - rparams := typeparams.RecvTypeParams(sig) - for i := 0; i < rparams.Len(); i++ { - rparam := rparams.At(i) - name := obj.Name() + "." + m.Name() + "." + rparam.Obj().Name() - w.p.tparamNames[rparam.Obj()] = name + if rparams := typeparams.RecvTypeParams(sig); rparams.Len() > 0 { + prefix := obj.Name() + "." + m.Name() + for i := 0; i < rparams.Len(); i++ { + rparam := rparams.At(i) + name := tparamExportName(prefix, rparam) + w.p.tparamNames[rparam.Obj()] = name + } } w.param(sig.Recv()) w.signature(sig) @@ -490,7 +498,7 @@ func (w *exportWriter) pkg(pkg *types.Package) { } func (w *exportWriter) qualifiedIdent(obj types.Object) { - name := w.p.indexName(obj) + name := w.p.exportName(obj) // Ensure any referenced declarations are written out too. w.p.pushDecl(obj) @@ -672,18 +680,49 @@ func (w *exportWriter) typeList(ts *typeparams.TypeList, pkg *types.Package) { } } -func (w *exportWriter) tparamList(owner types.Object, list *typeparams.TypeParamList, pkg *types.Package) { +func (w *exportWriter) tparamList(prefix string, list *typeparams.TypeParamList, pkg *types.Package) { ll := uint64(list.Len()) w.uint64(ll) for i := 0; i < list.Len(); i++ { tparam := list.At(i) - // Qualify the type parameter name before exporting its type. - name := owner.Name() + "." + tparam.Obj().Name() - w.p.tparamNames[tparam.Obj()] = name + // Set the type parameter exportName before exporting its type. + exportName := tparamExportName(prefix, tparam) + w.p.tparamNames[tparam.Obj()] = exportName w.typ(list.At(i), pkg) } } +const blankMarker = "$" + +// tparamExportName returns the 'exported' name of a type parameter, which +// differs from its actual object name: it is prefixed with a qualifier, and +// blank type parameter names are disambiguated by their index in the type +// parameter list. +func tparamExportName(prefix string, tparam *typeparams.TypeParam) string { + assert(prefix != "") + name := tparam.Obj().Name() + if name == "_" { + name = blankMarker + strconv.Itoa(tparam.Index()) + } + return prefix + "." + name +} + +// tparamName returns the real name of a type parameter, after stripping its +// qualifying prefix and reverting blank-name encoding. See tparamExportName +// for details. +func tparamName(exportName string) string { + // Remove the "path" from the type param name that makes it unique. + ix := strings.LastIndex(exportName, ".") + if ix < 0 { + errorf("malformed type parameter export name %s: missing prefix", exportName) + } + name := exportName[ix+1:] + if strings.HasPrefix(name, blankMarker) { + return "_" + } + return name +} + func (w *exportWriter) paramList(tup *types.Tuple) { n := tup.Len() w.uint64(uint64(n)) diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go index cdb332cd1500..4caa0f55d9de 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go @@ -17,6 +17,7 @@ import ( "go/token" "go/types" "io" + "math/big" "sort" "strings" @@ -45,24 +46,15 @@ func (r *intReader) uint64() uint64 { } // Keep this in sync with constants in iexport.go. -// -// Temporarily, the x/tools importer accepts generic code at both version 1 and -// 2. However, version 2 contains some breaking changes on top of version 1: -// - the 'implicit' bit is added to exported constraints -// - a 'kind' byte is added to constant values (not yet done) -// -// Once we've completed the bump to version 2 in the standard library, we'll -// remove support for generics here at version 1. const ( - iexportVersionGo1_11 = 0 - iexportVersionPosCol = 1 - iexportVersionGo1_18 = 2 - // TODO: before release, change this back to 2. - iexportVersionGenerics = iexportVersionPosCol + iexportVersionGo1_11 = 0 + iexportVersionPosCol = 1 + iexportVersionGo1_18 = 2 + iexportVersionGenerics = 2 ) type ident struct { - pkg string + pkg *types.Package name string } @@ -109,7 +101,9 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data if !debug { defer func() { if e := recover(); e != nil { - if version > currentVersion { + if bundle { + err = fmt.Errorf("%v", e) + } else if version > currentVersion { err = fmt.Errorf("cannot import %q (%v), export data is newer version - update tool", path, e) } else { err = fmt.Errorf("cannot import %q (%v), possibly version skew - reinstall package", path, e) @@ -246,6 +240,15 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data pkg.MarkComplete() } + // SetConstraint can't be called if the constraint type is not yet complete. + // When type params are created in the 'P' case of (*importReader).obj(), + // the associated constraint type may not be complete due to recursion. + // Therefore, we defer calling SetConstraint there, and call it here instead + // after all types are complete. + for _, d := range p.later { + typeparams.SetTypeParamConstraint(d.t, d.constraint) + } + for _, typ := range p.interfaceList { typ.Complete() } @@ -253,6 +256,11 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data return pkgs, nil } +type setConstraintArgs struct { + t *typeparams.TypeParam + constraint types.Type +} + type iimporter struct { version int ipath string @@ -269,6 +277,9 @@ type iimporter struct { fake fakeFileSet interfaceList []*types.Interface + // Arguments for calls to SetConstraint that are deferred due to recursive types + later []setConstraintArgs + indent int // for tracing support } @@ -447,18 +458,13 @@ func (r *importReader) obj(name string) { if r.p.version < iexportVersionGenerics { errorf("unexpected type param type") } - // Remove the "path" from the type param name that makes it unique - ix := strings.LastIndex(name, ".") - if ix < 0 { - errorf("missing path for type param") - } - name0 := name[ix+1:] + name0 := tparamName(name) tn := types.NewTypeName(pos, r.currPkg, name0, nil) t := typeparams.NewTypeParam(tn, nil) // To handle recursive references to the typeparam within its // bound, save the partial type in tparamIndex before reading the bounds. - id := ident{r.currPkg.Name(), name} + id := ident{r.currPkg, name} r.p.tparamIndex[id] = t var implicit bool if r.p.version >= iexportVersionGo1_18 { @@ -472,7 +478,11 @@ func (r *importReader) obj(name string) { } typeparams.MarkImplicit(iface) } - typeparams.SetTypeParamConstraint(t, constraint) + // The constraint type may not be complete, if we + // are in the middle of a type recursion involving type + // constraints. So, we defer SetConstraint until we have + // completely set up all types in ImportData. + r.p.later = append(r.p.later, setConstraintArgs{t: t, constraint: constraint}) case 'V': typ := r.typ() @@ -503,7 +513,9 @@ func (r *importReader) value() (typ types.Type, val constant.Value) { val = constant.MakeString(r.string()) case types.IsInteger: - val = r.mpint(b) + var x big.Int + r.mpint(&x, b) + val = constant.Make(&x) case types.IsFloat: val = r.mpfloat(b) @@ -552,8 +564,8 @@ func intSize(b *types.Basic) (signed bool, maxBytes uint) { return } -func (r *importReader) mpint(b *types.Basic) constant.Value { - signed, maxBytes := intSize(b) +func (r *importReader) mpint(x *big.Int, typ *types.Basic) { + signed, maxBytes := intSize(typ) maxSmall := 256 - maxBytes if signed { @@ -572,7 +584,8 @@ func (r *importReader) mpint(b *types.Basic) constant.Value { v = ^v } } - return constant.MakeInt64(v) + x.SetInt64(v) + return } v := -n @@ -582,47 +595,23 @@ func (r *importReader) mpint(b *types.Basic) constant.Value { if v < 1 || uint(v) > maxBytes { errorf("weird decoding: %v, %v => %v", n, signed, v) } - - buf := make([]byte, v) - io.ReadFull(&r.declReader, buf) - - // convert to little endian - // TODO(gri) go/constant should have a more direct conversion function - // (e.g., once it supports a big.Float based implementation) - for i, j := 0, len(buf)-1; i < j; i, j = i+1, j-1 { - buf[i], buf[j] = buf[j], buf[i] - } - - x := constant.MakeFromBytes(buf) + b := make([]byte, v) + io.ReadFull(&r.declReader, b) + x.SetBytes(b) if signed && n&1 != 0 { - x = constant.UnaryOp(token.SUB, x, 0) + x.Neg(x) } - return x } -func (r *importReader) mpfloat(b *types.Basic) constant.Value { - x := r.mpint(b) - if constant.Sign(x) == 0 { - return x - } - - exp := r.int64() - switch { - case exp > 0: - x = constant.Shift(x, token.SHL, uint(exp)) - // Ensure that the imported Kind is Float, else this constant may run into - // bitsize limits on overlarge integers. Eventually we can instead adopt - // the approach of CL 288632, but that CL relies on go/constant APIs that - // were introduced in go1.13. - // - // TODO(rFindley): sync the logic here with tip Go once we no longer - // support go1.12. - x = constant.ToFloat(x) - case exp < 0: - d := constant.Shift(constant.MakeInt64(1), token.SHL, uint(-exp)) - x = constant.BinaryOp(x, token.QUO, d) +func (r *importReader) mpfloat(typ *types.Basic) constant.Value { + var mant big.Int + r.mpint(&mant, typ) + var f big.Float + f.SetInt(&mant) + if f.Sign() != 0 { + f.SetMantExp(&f, int(r.int64())) } - return x + return constant.Make(&f) } func (r *importReader) ident() string { @@ -770,7 +759,7 @@ func (r *importReader) doType(base *types.Named) (res types.Type) { errorf("unexpected type param type") } pkg, name := r.qualifiedIdent() - id := ident{pkg.Name(), name} + id := ident{pkg, name} if t, ok := r.p.tparamIndex[id]; ok { // We're already in the process of importing this typeparam. return t diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/unified_no.go b/vendor/golang.org/x/tools/go/internal/gcimporter/unified_no.go new file mode 100644 index 000000000000..286bf445483d --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/unified_no.go @@ -0,0 +1,10 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !(go1.18 && goexperiment.unified) +// +build !go1.18 !goexperiment.unified + +package gcimporter + +const unifiedIR = false diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/unified_yes.go b/vendor/golang.org/x/tools/go/internal/gcimporter/unified_yes.go new file mode 100644 index 000000000000..b5d69ffbe682 --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/unified_yes.go @@ -0,0 +1,10 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.18 && goexperiment.unified +// +build go1.18,goexperiment.unified + +package gcimporter + +const unifiedIR = true diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/ureader_no.go b/vendor/golang.org/x/tools/go/internal/gcimporter/ureader_no.go new file mode 100644 index 000000000000..8eb20729c2ad --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/ureader_no.go @@ -0,0 +1,19 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !go1.18 +// +build !go1.18 + +package gcimporter + +import ( + "fmt" + "go/token" + "go/types" +) + +func UImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (_ int, pkg *types.Package, err error) { + err = fmt.Errorf("go/tools compiled with a Go version earlier than 1.18 cannot read unified IR export data") + return +} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/ureader_yes.go b/vendor/golang.org/x/tools/go/internal/gcimporter/ureader_yes.go new file mode 100644 index 000000000000..3c1a4375435a --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/ureader_yes.go @@ -0,0 +1,612 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Derived from go/internal/gcimporter/ureader.go + +//go:build go1.18 +// +build go1.18 + +package gcimporter + +import ( + "go/token" + "go/types" + "strings" + + "golang.org/x/tools/go/internal/pkgbits" +) + +// A pkgReader holds the shared state for reading a unified IR package +// description. +type pkgReader struct { + pkgbits.PkgDecoder + + fake fakeFileSet + + ctxt *types.Context + imports map[string]*types.Package // previously imported packages, indexed by path + + // lazily initialized arrays corresponding to the unified IR + // PosBase, Pkg, and Type sections, respectively. + posBases []string // position bases (i.e., file names) + pkgs []*types.Package + typs []types.Type + + // laterFns holds functions that need to be invoked at the end of + // import reading. + laterFns []func() +} + +// later adds a function to be invoked at the end of import reading. +func (pr *pkgReader) later(fn func()) { + pr.laterFns = append(pr.laterFns, fn) +} + +// See cmd/compile/internal/noder.derivedInfo. +type derivedInfo struct { + idx pkgbits.Index + needed bool +} + +// See cmd/compile/internal/noder.typeInfo. +type typeInfo struct { + idx pkgbits.Index + derived bool +} + +func UImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (_ int, pkg *types.Package, err error) { + s := string(data) + s = s[:strings.LastIndex(s, "\n$$\n")] + input := pkgbits.NewPkgDecoder(path, s) + pkg = readUnifiedPackage(fset, nil, imports, input) + return +} + +// readUnifiedPackage reads a package description from the given +// unified IR export data decoder. +func readUnifiedPackage(fset *token.FileSet, ctxt *types.Context, imports map[string]*types.Package, input pkgbits.PkgDecoder) *types.Package { + pr := pkgReader{ + PkgDecoder: input, + + fake: fakeFileSet{ + fset: fset, + files: make(map[string]*fileInfo), + }, + + ctxt: ctxt, + imports: imports, + + posBases: make([]string, input.NumElems(pkgbits.RelocPosBase)), + pkgs: make([]*types.Package, input.NumElems(pkgbits.RelocPkg)), + typs: make([]types.Type, input.NumElems(pkgbits.RelocType)), + } + defer pr.fake.setLines() + + r := pr.newReader(pkgbits.RelocMeta, pkgbits.PublicRootIdx, pkgbits.SyncPublic) + pkg := r.pkg() + r.Bool() // has init + + for i, n := 0, r.Len(); i < n; i++ { + // As if r.obj(), but avoiding the Scope.Lookup call, + // to avoid eager loading of imports. + r.Sync(pkgbits.SyncObject) + assert(!r.Bool()) + r.p.objIdx(r.Reloc(pkgbits.RelocObj)) + assert(r.Len() == 0) + } + + r.Sync(pkgbits.SyncEOF) + + for _, fn := range pr.laterFns { + fn() + } + + pkg.MarkComplete() + return pkg +} + +// A reader holds the state for reading a single unified IR element +// within a package. +type reader struct { + pkgbits.Decoder + + p *pkgReader + + dict *readerDict +} + +// A readerDict holds the state for type parameters that parameterize +// the current unified IR element. +type readerDict struct { + // bounds is a slice of typeInfos corresponding to the underlying + // bounds of the element's type parameters. + bounds []typeInfo + + // tparams is a slice of the constructed TypeParams for the element. + tparams []*types.TypeParam + + // devived is a slice of types derived from tparams, which may be + // instantiated while reading the current element. + derived []derivedInfo + derivedTypes []types.Type // lazily instantiated from derived +} + +func (pr *pkgReader) newReader(k pkgbits.RelocKind, idx pkgbits.Index, marker pkgbits.SyncMarker) *reader { + return &reader{ + Decoder: pr.NewDecoder(k, idx, marker), + p: pr, + } +} + +// @@@ Positions + +func (r *reader) pos() token.Pos { + r.Sync(pkgbits.SyncPos) + if !r.Bool() { + return token.NoPos + } + + // TODO(mdempsky): Delta encoding. + posBase := r.posBase() + line := r.Uint() + col := r.Uint() + return r.p.fake.pos(posBase, int(line), int(col)) +} + +func (r *reader) posBase() string { + return r.p.posBaseIdx(r.Reloc(pkgbits.RelocPosBase)) +} + +func (pr *pkgReader) posBaseIdx(idx pkgbits.Index) string { + if b := pr.posBases[idx]; b != "" { + return b + } + + r := pr.newReader(pkgbits.RelocPosBase, idx, pkgbits.SyncPosBase) + + // Within types2, position bases have a lot more details (e.g., + // keeping track of where //line directives appeared exactly). + // + // For go/types, we just track the file name. + + filename := r.String() + + if r.Bool() { // file base + // Was: "b = token.NewTrimmedFileBase(filename, true)" + } else { // line base + pos := r.pos() + line := r.Uint() + col := r.Uint() + + // Was: "b = token.NewLineBase(pos, filename, true, line, col)" + _, _, _ = pos, line, col + } + + b := filename + pr.posBases[idx] = b + return b +} + +// @@@ Packages + +func (r *reader) pkg() *types.Package { + r.Sync(pkgbits.SyncPkg) + return r.p.pkgIdx(r.Reloc(pkgbits.RelocPkg)) +} + +func (pr *pkgReader) pkgIdx(idx pkgbits.Index) *types.Package { + // TODO(mdempsky): Consider using some non-nil pointer to indicate + // the universe scope, so we don't need to keep re-reading it. + if pkg := pr.pkgs[idx]; pkg != nil { + return pkg + } + + pkg := pr.newReader(pkgbits.RelocPkg, idx, pkgbits.SyncPkgDef).doPkg() + pr.pkgs[idx] = pkg + return pkg +} + +func (r *reader) doPkg() *types.Package { + path := r.String() + switch path { + case "": + path = r.p.PkgPath() + case "builtin": + return nil // universe + case "unsafe": + return types.Unsafe + } + + if pkg := r.p.imports[path]; pkg != nil { + return pkg + } + + name := r.String() + + pkg := types.NewPackage(path, name) + r.p.imports[path] = pkg + + imports := make([]*types.Package, r.Len()) + for i := range imports { + imports[i] = r.pkg() + } + pkg.SetImports(imports) + + return pkg +} + +// @@@ Types + +func (r *reader) typ() types.Type { + return r.p.typIdx(r.typInfo(), r.dict) +} + +func (r *reader) typInfo() typeInfo { + r.Sync(pkgbits.SyncType) + if r.Bool() { + return typeInfo{idx: pkgbits.Index(r.Len()), derived: true} + } + return typeInfo{idx: r.Reloc(pkgbits.RelocType), derived: false} +} + +func (pr *pkgReader) typIdx(info typeInfo, dict *readerDict) types.Type { + idx := info.idx + var where *types.Type + if info.derived { + where = &dict.derivedTypes[idx] + idx = dict.derived[idx].idx + } else { + where = &pr.typs[idx] + } + + if typ := *where; typ != nil { + return typ + } + + r := pr.newReader(pkgbits.RelocType, idx, pkgbits.SyncTypeIdx) + r.dict = dict + + typ := r.doTyp() + assert(typ != nil) + + // See comment in pkgReader.typIdx explaining how this happens. + if prev := *where; prev != nil { + return prev + } + + *where = typ + return typ +} + +func (r *reader) doTyp() (res types.Type) { + switch tag := pkgbits.CodeType(r.Code(pkgbits.SyncType)); tag { + default: + errorf("unhandled type tag: %v", tag) + panic("unreachable") + + case pkgbits.TypeBasic: + return types.Typ[r.Len()] + + case pkgbits.TypeNamed: + obj, targs := r.obj() + name := obj.(*types.TypeName) + if len(targs) != 0 { + t, _ := types.Instantiate(r.p.ctxt, name.Type(), targs, false) + return t + } + return name.Type() + + case pkgbits.TypeTypeParam: + return r.dict.tparams[r.Len()] + + case pkgbits.TypeArray: + len := int64(r.Uint64()) + return types.NewArray(r.typ(), len) + case pkgbits.TypeChan: + dir := types.ChanDir(r.Len()) + return types.NewChan(dir, r.typ()) + case pkgbits.TypeMap: + return types.NewMap(r.typ(), r.typ()) + case pkgbits.TypePointer: + return types.NewPointer(r.typ()) + case pkgbits.TypeSignature: + return r.signature(nil, nil, nil) + case pkgbits.TypeSlice: + return types.NewSlice(r.typ()) + case pkgbits.TypeStruct: + return r.structType() + case pkgbits.TypeInterface: + return r.interfaceType() + case pkgbits.TypeUnion: + return r.unionType() + } +} + +func (r *reader) structType() *types.Struct { + fields := make([]*types.Var, r.Len()) + var tags []string + for i := range fields { + pos := r.pos() + pkg, name := r.selector() + ftyp := r.typ() + tag := r.String() + embedded := r.Bool() + + fields[i] = types.NewField(pos, pkg, name, ftyp, embedded) + if tag != "" { + for len(tags) < i { + tags = append(tags, "") + } + tags = append(tags, tag) + } + } + return types.NewStruct(fields, tags) +} + +func (r *reader) unionType() *types.Union { + terms := make([]*types.Term, r.Len()) + for i := range terms { + terms[i] = types.NewTerm(r.Bool(), r.typ()) + } + return types.NewUnion(terms) +} + +func (r *reader) interfaceType() *types.Interface { + methods := make([]*types.Func, r.Len()) + embeddeds := make([]types.Type, r.Len()) + implicit := len(methods) == 0 && len(embeddeds) == 1 && r.Bool() + + for i := range methods { + pos := r.pos() + pkg, name := r.selector() + mtyp := r.signature(nil, nil, nil) + methods[i] = types.NewFunc(pos, pkg, name, mtyp) + } + + for i := range embeddeds { + embeddeds[i] = r.typ() + } + + iface := types.NewInterfaceType(methods, embeddeds) + if implicit { + iface.MarkImplicit() + } + return iface +} + +func (r *reader) signature(recv *types.Var, rtparams, tparams []*types.TypeParam) *types.Signature { + r.Sync(pkgbits.SyncSignature) + + params := r.params() + results := r.params() + variadic := r.Bool() + + return types.NewSignatureType(recv, rtparams, tparams, params, results, variadic) +} + +func (r *reader) params() *types.Tuple { + r.Sync(pkgbits.SyncParams) + + params := make([]*types.Var, r.Len()) + for i := range params { + params[i] = r.param() + } + + return types.NewTuple(params...) +} + +func (r *reader) param() *types.Var { + r.Sync(pkgbits.SyncParam) + + pos := r.pos() + pkg, name := r.localIdent() + typ := r.typ() + + return types.NewParam(pos, pkg, name, typ) +} + +// @@@ Objects + +func (r *reader) obj() (types.Object, []types.Type) { + r.Sync(pkgbits.SyncObject) + + assert(!r.Bool()) + + pkg, name := r.p.objIdx(r.Reloc(pkgbits.RelocObj)) + obj := pkgScope(pkg).Lookup(name) + + targs := make([]types.Type, r.Len()) + for i := range targs { + targs[i] = r.typ() + } + + return obj, targs +} + +func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) { + rname := pr.newReader(pkgbits.RelocName, idx, pkgbits.SyncObject1) + + objPkg, objName := rname.qualifiedIdent() + assert(objName != "") + + tag := pkgbits.CodeObj(rname.Code(pkgbits.SyncCodeObj)) + + if tag == pkgbits.ObjStub { + assert(objPkg == nil || objPkg == types.Unsafe) + return objPkg, objName + } + + if objPkg.Scope().Lookup(objName) == nil { + dict := pr.objDictIdx(idx) + + r := pr.newReader(pkgbits.RelocObj, idx, pkgbits.SyncObject1) + r.dict = dict + + declare := func(obj types.Object) { + objPkg.Scope().Insert(obj) + } + + switch tag { + default: + panic("weird") + + case pkgbits.ObjAlias: + pos := r.pos() + typ := r.typ() + declare(types.NewTypeName(pos, objPkg, objName, typ)) + + case pkgbits.ObjConst: + pos := r.pos() + typ := r.typ() + val := r.Value() + declare(types.NewConst(pos, objPkg, objName, typ, val)) + + case pkgbits.ObjFunc: + pos := r.pos() + tparams := r.typeParamNames() + sig := r.signature(nil, nil, tparams) + declare(types.NewFunc(pos, objPkg, objName, sig)) + + case pkgbits.ObjType: + pos := r.pos() + + obj := types.NewTypeName(pos, objPkg, objName, nil) + named := types.NewNamed(obj, nil, nil) + declare(obj) + + named.SetTypeParams(r.typeParamNames()) + + // TODO(mdempsky): Rewrite receiver types to underlying is an + // Interface? The go/types importer does this (I think because + // unit tests expected that), but cmd/compile doesn't care + // about it, so maybe we can avoid worrying about that here. + rhs := r.typ() + r.p.later(func() { + underlying := rhs.Underlying() + named.SetUnderlying(underlying) + }) + + for i, n := 0, r.Len(); i < n; i++ { + named.AddMethod(r.method()) + } + + case pkgbits.ObjVar: + pos := r.pos() + typ := r.typ() + declare(types.NewVar(pos, objPkg, objName, typ)) + } + } + + return objPkg, objName +} + +func (pr *pkgReader) objDictIdx(idx pkgbits.Index) *readerDict { + r := pr.newReader(pkgbits.RelocObjDict, idx, pkgbits.SyncObject1) + + var dict readerDict + + if implicits := r.Len(); implicits != 0 { + errorf("unexpected object with %v implicit type parameter(s)", implicits) + } + + dict.bounds = make([]typeInfo, r.Len()) + for i := range dict.bounds { + dict.bounds[i] = r.typInfo() + } + + dict.derived = make([]derivedInfo, r.Len()) + dict.derivedTypes = make([]types.Type, len(dict.derived)) + for i := range dict.derived { + dict.derived[i] = derivedInfo{r.Reloc(pkgbits.RelocType), r.Bool()} + } + + // function references follow, but reader doesn't need those + + return &dict +} + +func (r *reader) typeParamNames() []*types.TypeParam { + r.Sync(pkgbits.SyncTypeParamNames) + + // Note: This code assumes it only processes objects without + // implement type parameters. This is currently fine, because + // reader is only used to read in exported declarations, which are + // always package scoped. + + if len(r.dict.bounds) == 0 { + return nil + } + + // Careful: Type parameter lists may have cycles. To allow for this, + // we construct the type parameter list in two passes: first we + // create all the TypeNames and TypeParams, then we construct and + // set the bound type. + + r.dict.tparams = make([]*types.TypeParam, len(r.dict.bounds)) + for i := range r.dict.bounds { + pos := r.pos() + pkg, name := r.localIdent() + + tname := types.NewTypeName(pos, pkg, name, nil) + r.dict.tparams[i] = types.NewTypeParam(tname, nil) + } + + typs := make([]types.Type, len(r.dict.bounds)) + for i, bound := range r.dict.bounds { + typs[i] = r.p.typIdx(bound, r.dict) + } + + // TODO(mdempsky): This is subtle, elaborate further. + // + // We have to save tparams outside of the closure, because + // typeParamNames() can be called multiple times with the same + // dictionary instance. + // + // Also, this needs to happen later to make sure SetUnderlying has + // been called. + // + // TODO(mdempsky): Is it safe to have a single "later" slice or do + // we need to have multiple passes? See comments on CL 386002 and + // go.dev/issue/52104. + tparams := r.dict.tparams + r.p.later(func() { + for i, typ := range typs { + tparams[i].SetConstraint(typ) + } + }) + + return r.dict.tparams +} + +func (r *reader) method() *types.Func { + r.Sync(pkgbits.SyncMethod) + pos := r.pos() + pkg, name := r.selector() + + rparams := r.typeParamNames() + sig := r.signature(r.param(), rparams, nil) + + _ = r.pos() // TODO(mdempsky): Remove; this is a hacker for linker.go. + return types.NewFunc(pos, pkg, name, sig) +} + +func (r *reader) qualifiedIdent() (*types.Package, string) { return r.ident(pkgbits.SyncSym) } +func (r *reader) localIdent() (*types.Package, string) { return r.ident(pkgbits.SyncLocalIdent) } +func (r *reader) selector() (*types.Package, string) { return r.ident(pkgbits.SyncSelector) } + +func (r *reader) ident(marker pkgbits.SyncMarker) (*types.Package, string) { + r.Sync(marker) + return r.pkg(), r.String() +} + +// pkgScope returns pkg.Scope(). +// If pkg is nil, it returns types.Universe instead. +// +// TODO(mdempsky): Remove after x/tools can depend on Go 1.19. +func pkgScope(pkg *types.Package) *types.Scope { + if pkg != nil { + return pkg.Scope() + } + return types.Universe +} diff --git a/vendor/golang.org/x/tools/go/internal/pkgbits/codes.go b/vendor/golang.org/x/tools/go/internal/pkgbits/codes.go new file mode 100644 index 000000000000..f0cabde96eba --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/pkgbits/codes.go @@ -0,0 +1,77 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pkgbits + +// A Code is an enum value that can be encoded into bitstreams. +// +// Code types are preferable for enum types, because they allow +// Decoder to detect desyncs. +type Code interface { + // Marker returns the SyncMarker for the Code's dynamic type. + Marker() SyncMarker + + // Value returns the Code's ordinal value. + Value() int +} + +// A CodeVal distinguishes among go/constant.Value encodings. +type CodeVal int + +func (c CodeVal) Marker() SyncMarker { return SyncVal } +func (c CodeVal) Value() int { return int(c) } + +// Note: These values are public and cannot be changed without +// updating the go/types importers. + +const ( + ValBool CodeVal = iota + ValString + ValInt64 + ValBigInt + ValBigRat + ValBigFloat +) + +// A CodeType distinguishes among go/types.Type encodings. +type CodeType int + +func (c CodeType) Marker() SyncMarker { return SyncType } +func (c CodeType) Value() int { return int(c) } + +// Note: These values are public and cannot be changed without +// updating the go/types importers. + +const ( + TypeBasic CodeType = iota + TypeNamed + TypePointer + TypeSlice + TypeArray + TypeChan + TypeMap + TypeSignature + TypeStruct + TypeInterface + TypeUnion + TypeTypeParam +) + +// A CodeObj distinguishes among go/types.Object encodings. +type CodeObj int + +func (c CodeObj) Marker() SyncMarker { return SyncCodeObj } +func (c CodeObj) Value() int { return int(c) } + +// Note: These values are public and cannot be changed without +// updating the go/types importers. + +const ( + ObjAlias CodeObj = iota + ObjConst + ObjType + ObjFunc + ObjVar + ObjStub +) diff --git a/vendor/golang.org/x/tools/go/internal/pkgbits/decoder.go b/vendor/golang.org/x/tools/go/internal/pkgbits/decoder.go new file mode 100644 index 000000000000..2bc793668ec9 --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/pkgbits/decoder.go @@ -0,0 +1,433 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pkgbits + +import ( + "encoding/binary" + "fmt" + "go/constant" + "go/token" + "math/big" + "os" + "runtime" + "strings" +) + +// A PkgDecoder provides methods for decoding a package's Unified IR +// export data. +type PkgDecoder struct { + // version is the file format version. + version uint32 + + // sync indicates whether the file uses sync markers. + sync bool + + // pkgPath is the package path for the package to be decoded. + // + // TODO(mdempsky): Remove; unneeded since CL 391014. + pkgPath string + + // elemData is the full data payload of the encoded package. + // Elements are densely and contiguously packed together. + // + // The last 8 bytes of elemData are the package fingerprint. + elemData string + + // elemEnds stores the byte-offset end positions of element + // bitstreams within elemData. + // + // For example, element I's bitstream data starts at elemEnds[I-1] + // (or 0, if I==0) and ends at elemEnds[I]. + // + // Note: elemEnds is indexed by absolute indices, not + // section-relative indices. + elemEnds []uint32 + + // elemEndsEnds stores the index-offset end positions of relocation + // sections within elemEnds. + // + // For example, section K's end positions start at elemEndsEnds[K-1] + // (or 0, if K==0) and end at elemEndsEnds[K]. + elemEndsEnds [numRelocs]uint32 +} + +// PkgPath returns the package path for the package +// +// TODO(mdempsky): Remove; unneeded since CL 391014. +func (pr *PkgDecoder) PkgPath() string { return pr.pkgPath } + +// SyncMarkers reports whether pr uses sync markers. +func (pr *PkgDecoder) SyncMarkers() bool { return pr.sync } + +// NewPkgDecoder returns a PkgDecoder initialized to read the Unified +// IR export data from input. pkgPath is the package path for the +// compilation unit that produced the export data. +// +// TODO(mdempsky): Remove pkgPath parameter; unneeded since CL 391014. +func NewPkgDecoder(pkgPath, input string) PkgDecoder { + pr := PkgDecoder{ + pkgPath: pkgPath, + } + + // TODO(mdempsky): Implement direct indexing of input string to + // avoid copying the position information. + + r := strings.NewReader(input) + + assert(binary.Read(r, binary.LittleEndian, &pr.version) == nil) + + switch pr.version { + default: + panic(fmt.Errorf("unsupported version: %v", pr.version)) + case 0: + // no flags + case 1: + var flags uint32 + assert(binary.Read(r, binary.LittleEndian, &flags) == nil) + pr.sync = flags&flagSyncMarkers != 0 + } + + assert(binary.Read(r, binary.LittleEndian, pr.elemEndsEnds[:]) == nil) + + pr.elemEnds = make([]uint32, pr.elemEndsEnds[len(pr.elemEndsEnds)-1]) + assert(binary.Read(r, binary.LittleEndian, pr.elemEnds[:]) == nil) + + pos, err := r.Seek(0, os.SEEK_CUR) + assert(err == nil) + + pr.elemData = input[pos:] + assert(len(pr.elemData)-8 == int(pr.elemEnds[len(pr.elemEnds)-1])) + + return pr +} + +// NumElems returns the number of elements in section k. +func (pr *PkgDecoder) NumElems(k RelocKind) int { + count := int(pr.elemEndsEnds[k]) + if k > 0 { + count -= int(pr.elemEndsEnds[k-1]) + } + return count +} + +// TotalElems returns the total number of elements across all sections. +func (pr *PkgDecoder) TotalElems() int { + return len(pr.elemEnds) +} + +// Fingerprint returns the package fingerprint. +func (pr *PkgDecoder) Fingerprint() [8]byte { + var fp [8]byte + copy(fp[:], pr.elemData[len(pr.elemData)-8:]) + return fp +} + +// AbsIdx returns the absolute index for the given (section, index) +// pair. +func (pr *PkgDecoder) AbsIdx(k RelocKind, idx Index) int { + absIdx := int(idx) + if k > 0 { + absIdx += int(pr.elemEndsEnds[k-1]) + } + if absIdx >= int(pr.elemEndsEnds[k]) { + errorf("%v:%v is out of bounds; %v", k, idx, pr.elemEndsEnds) + } + return absIdx +} + +// DataIdx returns the raw element bitstream for the given (section, +// index) pair. +func (pr *PkgDecoder) DataIdx(k RelocKind, idx Index) string { + absIdx := pr.AbsIdx(k, idx) + + var start uint32 + if absIdx > 0 { + start = pr.elemEnds[absIdx-1] + } + end := pr.elemEnds[absIdx] + + return pr.elemData[start:end] +} + +// StringIdx returns the string value for the given string index. +func (pr *PkgDecoder) StringIdx(idx Index) string { + return pr.DataIdx(RelocString, idx) +} + +// NewDecoder returns a Decoder for the given (section, index) pair, +// and decodes the given SyncMarker from the element bitstream. +func (pr *PkgDecoder) NewDecoder(k RelocKind, idx Index, marker SyncMarker) Decoder { + r := pr.NewDecoderRaw(k, idx) + r.Sync(marker) + return r +} + +// NewDecoderRaw returns a Decoder for the given (section, index) pair. +// +// Most callers should use NewDecoder instead. +func (pr *PkgDecoder) NewDecoderRaw(k RelocKind, idx Index) Decoder { + r := Decoder{ + common: pr, + k: k, + Idx: idx, + } + + // TODO(mdempsky) r.data.Reset(...) after #44505 is resolved. + r.Data = *strings.NewReader(pr.DataIdx(k, idx)) + + r.Sync(SyncRelocs) + r.Relocs = make([]RelocEnt, r.Len()) + for i := range r.Relocs { + r.Sync(SyncReloc) + r.Relocs[i] = RelocEnt{RelocKind(r.Len()), Index(r.Len())} + } + + return r +} + +// A Decoder provides methods for decoding an individual element's +// bitstream data. +type Decoder struct { + common *PkgDecoder + + Relocs []RelocEnt + Data strings.Reader + + k RelocKind + Idx Index +} + +func (r *Decoder) checkErr(err error) { + if err != nil { + errorf("unexpected decoding error: %w", err) + } +} + +func (r *Decoder) rawUvarint() uint64 { + x, err := binary.ReadUvarint(&r.Data) + r.checkErr(err) + return x +} + +func (r *Decoder) rawVarint() int64 { + ux := r.rawUvarint() + + // Zig-zag decode. + x := int64(ux >> 1) + if ux&1 != 0 { + x = ^x + } + return x +} + +func (r *Decoder) rawReloc(k RelocKind, idx int) Index { + e := r.Relocs[idx] + assert(e.Kind == k) + return e.Idx +} + +// Sync decodes a sync marker from the element bitstream and asserts +// that it matches the expected marker. +// +// If r.common.sync is false, then Sync is a no-op. +func (r *Decoder) Sync(mWant SyncMarker) { + if !r.common.sync { + return + } + + pos, _ := r.Data.Seek(0, os.SEEK_CUR) // TODO(mdempsky): io.SeekCurrent after #44505 is resolved + mHave := SyncMarker(r.rawUvarint()) + writerPCs := make([]int, r.rawUvarint()) + for i := range writerPCs { + writerPCs[i] = int(r.rawUvarint()) + } + + if mHave == mWant { + return + } + + // There's some tension here between printing: + // + // (1) full file paths that tools can recognize (e.g., so emacs + // hyperlinks the "file:line" text for easy navigation), or + // + // (2) short file paths that are easier for humans to read (e.g., by + // omitting redundant or irrelevant details, so it's easier to + // focus on the useful bits that remain). + // + // The current formatting favors the former, as it seems more + // helpful in practice. But perhaps the formatting could be improved + // to better address both concerns. For example, use relative file + // paths if they would be shorter, or rewrite file paths to contain + // "$GOROOT" (like objabi.AbsFile does) if tools can be taught how + // to reliably expand that again. + + fmt.Printf("export data desync: package %q, section %v, index %v, offset %v\n", r.common.pkgPath, r.k, r.Idx, pos) + + fmt.Printf("\nfound %v, written at:\n", mHave) + if len(writerPCs) == 0 { + fmt.Printf("\t[stack trace unavailable; recompile package %q with -d=syncframes]\n", r.common.pkgPath) + } + for _, pc := range writerPCs { + fmt.Printf("\t%s\n", r.common.StringIdx(r.rawReloc(RelocString, pc))) + } + + fmt.Printf("\nexpected %v, reading at:\n", mWant) + var readerPCs [32]uintptr // TODO(mdempsky): Dynamically size? + n := runtime.Callers(2, readerPCs[:]) + for _, pc := range fmtFrames(readerPCs[:n]...) { + fmt.Printf("\t%s\n", pc) + } + + // We already printed a stack trace for the reader, so now we can + // simply exit. Printing a second one with panic or base.Fatalf + // would just be noise. + os.Exit(1) +} + +// Bool decodes and returns a bool value from the element bitstream. +func (r *Decoder) Bool() bool { + r.Sync(SyncBool) + x, err := r.Data.ReadByte() + r.checkErr(err) + assert(x < 2) + return x != 0 +} + +// Int64 decodes and returns an int64 value from the element bitstream. +func (r *Decoder) Int64() int64 { + r.Sync(SyncInt64) + return r.rawVarint() +} + +// Int64 decodes and returns a uint64 value from the element bitstream. +func (r *Decoder) Uint64() uint64 { + r.Sync(SyncUint64) + return r.rawUvarint() +} + +// Len decodes and returns a non-negative int value from the element bitstream. +func (r *Decoder) Len() int { x := r.Uint64(); v := int(x); assert(uint64(v) == x); return v } + +// Int decodes and returns an int value from the element bitstream. +func (r *Decoder) Int() int { x := r.Int64(); v := int(x); assert(int64(v) == x); return v } + +// Uint decodes and returns a uint value from the element bitstream. +func (r *Decoder) Uint() uint { x := r.Uint64(); v := uint(x); assert(uint64(v) == x); return v } + +// Code decodes a Code value from the element bitstream and returns +// its ordinal value. It's the caller's responsibility to convert the +// result to an appropriate Code type. +// +// TODO(mdempsky): Ideally this method would have signature "Code[T +// Code] T" instead, but we don't allow generic methods and the +// compiler can't depend on generics yet anyway. +func (r *Decoder) Code(mark SyncMarker) int { + r.Sync(mark) + return r.Len() +} + +// Reloc decodes a relocation of expected section k from the element +// bitstream and returns an index to the referenced element. +func (r *Decoder) Reloc(k RelocKind) Index { + r.Sync(SyncUseReloc) + return r.rawReloc(k, r.Len()) +} + +// String decodes and returns a string value from the element +// bitstream. +func (r *Decoder) String() string { + r.Sync(SyncString) + return r.common.StringIdx(r.Reloc(RelocString)) +} + +// Strings decodes and returns a variable-length slice of strings from +// the element bitstream. +func (r *Decoder) Strings() []string { + res := make([]string, r.Len()) + for i := range res { + res[i] = r.String() + } + return res +} + +// Value decodes and returns a constant.Value from the element +// bitstream. +func (r *Decoder) Value() constant.Value { + r.Sync(SyncValue) + isComplex := r.Bool() + val := r.scalar() + if isComplex { + val = constant.BinaryOp(val, token.ADD, constant.MakeImag(r.scalar())) + } + return val +} + +func (r *Decoder) scalar() constant.Value { + switch tag := CodeVal(r.Code(SyncVal)); tag { + default: + panic(fmt.Errorf("unexpected scalar tag: %v", tag)) + + case ValBool: + return constant.MakeBool(r.Bool()) + case ValString: + return constant.MakeString(r.String()) + case ValInt64: + return constant.MakeInt64(r.Int64()) + case ValBigInt: + return constant.Make(r.bigInt()) + case ValBigRat: + num := r.bigInt() + denom := r.bigInt() + return constant.Make(new(big.Rat).SetFrac(num, denom)) + case ValBigFloat: + return constant.Make(r.bigFloat()) + } +} + +func (r *Decoder) bigInt() *big.Int { + v := new(big.Int).SetBytes([]byte(r.String())) + if r.Bool() { + v.Neg(v) + } + return v +} + +func (r *Decoder) bigFloat() *big.Float { + v := new(big.Float).SetPrec(512) + assert(v.UnmarshalText([]byte(r.String())) == nil) + return v +} + +// @@@ Helpers + +// TODO(mdempsky): These should probably be removed. I think they're a +// smell that the export data format is not yet quite right. + +// PeekPkgPath returns the package path for the specified package +// index. +func (pr *PkgDecoder) PeekPkgPath(idx Index) string { + r := pr.NewDecoder(RelocPkg, idx, SyncPkgDef) + path := r.String() + if path == "" { + path = pr.pkgPath + } + return path +} + +// PeekObj returns the package path, object name, and CodeObj for the +// specified object index. +func (pr *PkgDecoder) PeekObj(idx Index) (string, string, CodeObj) { + r := pr.NewDecoder(RelocName, idx, SyncObject1) + r.Sync(SyncSym) + r.Sync(SyncPkg) + path := pr.PeekPkgPath(r.Reloc(RelocPkg)) + name := r.String() + assert(name != "") + + tag := CodeObj(r.Code(SyncCodeObj)) + + return path, name, tag +} diff --git a/vendor/golang.org/x/tools/go/internal/pkgbits/doc.go b/vendor/golang.org/x/tools/go/internal/pkgbits/doc.go new file mode 100644 index 000000000000..c8a2796b5e4c --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/pkgbits/doc.go @@ -0,0 +1,32 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package pkgbits implements low-level coding abstractions for +// Unified IR's export data format. +// +// At a low-level, a package is a collection of bitstream elements. +// Each element has a "kind" and a dense, non-negative index. +// Elements can be randomly accessed given their kind and index. +// +// Individual elements are sequences of variable-length values (e.g., +// integers, booleans, strings, go/constant values, cross-references +// to other elements). Package pkgbits provides APIs for encoding and +// decoding these low-level values, but the details of mapping +// higher-level Go constructs into elements is left to higher-level +// abstractions. +// +// Elements may cross-reference each other with "relocations." For +// example, an element representing a pointer type has a relocation +// referring to the element type. +// +// Go constructs may be composed as a constellation of multiple +// elements. For example, a declared function may have one element to +// describe the object (e.g., its name, type, position), and a +// separate element to describe its function body. This allows readers +// some flexibility in efficiently seeking or re-reading data (e.g., +// inlining requires re-reading the function body for each inlined +// call, without needing to re-read the object-level details). +// +// This is a copy of internal/pkgbits in the Go implementation. +package pkgbits diff --git a/vendor/golang.org/x/tools/go/internal/pkgbits/encoder.go b/vendor/golang.org/x/tools/go/internal/pkgbits/encoder.go new file mode 100644 index 000000000000..c50c838caaec --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/pkgbits/encoder.go @@ -0,0 +1,379 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pkgbits + +import ( + "bytes" + "crypto/md5" + "encoding/binary" + "go/constant" + "io" + "math/big" + "runtime" +) + +// currentVersion is the current version number. +// +// - v0: initial prototype +// +// - v1: adds the flags uint32 word +const currentVersion uint32 = 1 + +// A PkgEncoder provides methods for encoding a package's Unified IR +// export data. +type PkgEncoder struct { + // elems holds the bitstream for previously encoded elements. + elems [numRelocs][]string + + // stringsIdx maps previously encoded strings to their index within + // the RelocString section, to allow deduplication. That is, + // elems[RelocString][stringsIdx[s]] == s (if present). + stringsIdx map[string]Index + + // syncFrames is the number of frames to write at each sync + // marker. A negative value means sync markers are omitted. + syncFrames int +} + +// SyncMarkers reports whether pw uses sync markers. +func (pw *PkgEncoder) SyncMarkers() bool { return pw.syncFrames >= 0 } + +// NewPkgEncoder returns an initialized PkgEncoder. +// +// syncFrames is the number of caller frames that should be serialized +// at Sync points. Serializing additional frames results in larger +// export data files, but can help diagnosing desync errors in +// higher-level Unified IR reader/writer code. If syncFrames is +// negative, then sync markers are omitted entirely. +func NewPkgEncoder(syncFrames int) PkgEncoder { + return PkgEncoder{ + stringsIdx: make(map[string]Index), + syncFrames: syncFrames, + } +} + +// DumpTo writes the package's encoded data to out0 and returns the +// package fingerprint. +func (pw *PkgEncoder) DumpTo(out0 io.Writer) (fingerprint [8]byte) { + h := md5.New() + out := io.MultiWriter(out0, h) + + writeUint32 := func(x uint32) { + assert(binary.Write(out, binary.LittleEndian, x) == nil) + } + + writeUint32(currentVersion) + + var flags uint32 + if pw.SyncMarkers() { + flags |= flagSyncMarkers + } + writeUint32(flags) + + // Write elemEndsEnds. + var sum uint32 + for _, elems := range &pw.elems { + sum += uint32(len(elems)) + writeUint32(sum) + } + + // Write elemEnds. + sum = 0 + for _, elems := range &pw.elems { + for _, elem := range elems { + sum += uint32(len(elem)) + writeUint32(sum) + } + } + + // Write elemData. + for _, elems := range &pw.elems { + for _, elem := range elems { + _, err := io.WriteString(out, elem) + assert(err == nil) + } + } + + // Write fingerprint. + copy(fingerprint[:], h.Sum(nil)) + _, err := out0.Write(fingerprint[:]) + assert(err == nil) + + return +} + +// StringIdx adds a string value to the strings section, if not +// already present, and returns its index. +func (pw *PkgEncoder) StringIdx(s string) Index { + if idx, ok := pw.stringsIdx[s]; ok { + assert(pw.elems[RelocString][idx] == s) + return idx + } + + idx := Index(len(pw.elems[RelocString])) + pw.elems[RelocString] = append(pw.elems[RelocString], s) + pw.stringsIdx[s] = idx + return idx +} + +// NewEncoder returns an Encoder for a new element within the given +// section, and encodes the given SyncMarker as the start of the +// element bitstream. +func (pw *PkgEncoder) NewEncoder(k RelocKind, marker SyncMarker) Encoder { + e := pw.NewEncoderRaw(k) + e.Sync(marker) + return e +} + +// NewEncoderRaw returns an Encoder for a new element within the given +// section. +// +// Most callers should use NewEncoder instead. +func (pw *PkgEncoder) NewEncoderRaw(k RelocKind) Encoder { + idx := Index(len(pw.elems[k])) + pw.elems[k] = append(pw.elems[k], "") // placeholder + + return Encoder{ + p: pw, + k: k, + Idx: idx, + } +} + +// An Encoder provides methods for encoding an individual element's +// bitstream data. +type Encoder struct { + p *PkgEncoder + + Relocs []RelocEnt + Data bytes.Buffer // accumulated element bitstream data + + encodingRelocHeader bool + + k RelocKind + Idx Index // index within relocation section +} + +// Flush finalizes the element's bitstream and returns its Index. +func (w *Encoder) Flush() Index { + var sb bytes.Buffer // TODO(mdempsky): strings.Builder after #44505 is resolved + + // Backup the data so we write the relocations at the front. + var tmp bytes.Buffer + io.Copy(&tmp, &w.Data) + + // TODO(mdempsky): Consider writing these out separately so they're + // easier to strip, along with function bodies, so that we can prune + // down to just the data that's relevant to go/types. + if w.encodingRelocHeader { + panic("encodingRelocHeader already true; recursive flush?") + } + w.encodingRelocHeader = true + w.Sync(SyncRelocs) + w.Len(len(w.Relocs)) + for _, rEnt := range w.Relocs { + w.Sync(SyncReloc) + w.Len(int(rEnt.Kind)) + w.Len(int(rEnt.Idx)) + } + + io.Copy(&sb, &w.Data) + io.Copy(&sb, &tmp) + w.p.elems[w.k][w.Idx] = sb.String() + + return w.Idx +} + +func (w *Encoder) checkErr(err error) { + if err != nil { + errorf("unexpected encoding error: %v", err) + } +} + +func (w *Encoder) rawUvarint(x uint64) { + var buf [binary.MaxVarintLen64]byte + n := binary.PutUvarint(buf[:], x) + _, err := w.Data.Write(buf[:n]) + w.checkErr(err) +} + +func (w *Encoder) rawVarint(x int64) { + // Zig-zag encode. + ux := uint64(x) << 1 + if x < 0 { + ux = ^ux + } + + w.rawUvarint(ux) +} + +func (w *Encoder) rawReloc(r RelocKind, idx Index) int { + // TODO(mdempsky): Use map for lookup; this takes quadratic time. + for i, rEnt := range w.Relocs { + if rEnt.Kind == r && rEnt.Idx == idx { + return i + } + } + + i := len(w.Relocs) + w.Relocs = append(w.Relocs, RelocEnt{r, idx}) + return i +} + +func (w *Encoder) Sync(m SyncMarker) { + if !w.p.SyncMarkers() { + return + } + + // Writing out stack frame string references requires working + // relocations, but writing out the relocations themselves involves + // sync markers. To prevent infinite recursion, we simply trim the + // stack frame for sync markers within the relocation header. + var frames []string + if !w.encodingRelocHeader && w.p.syncFrames > 0 { + pcs := make([]uintptr, w.p.syncFrames) + n := runtime.Callers(2, pcs) + frames = fmtFrames(pcs[:n]...) + } + + // TODO(mdempsky): Save space by writing out stack frames as a + // linked list so we can share common stack frames. + w.rawUvarint(uint64(m)) + w.rawUvarint(uint64(len(frames))) + for _, frame := range frames { + w.rawUvarint(uint64(w.rawReloc(RelocString, w.p.StringIdx(frame)))) + } +} + +// Bool encodes and writes a bool value into the element bitstream, +// and then returns the bool value. +// +// For simple, 2-alternative encodings, the idiomatic way to call Bool +// is something like: +// +// if w.Bool(x != 0) { +// // alternative #1 +// } else { +// // alternative #2 +// } +// +// For multi-alternative encodings, use Code instead. +func (w *Encoder) Bool(b bool) bool { + w.Sync(SyncBool) + var x byte + if b { + x = 1 + } + err := w.Data.WriteByte(x) + w.checkErr(err) + return b +} + +// Int64 encodes and writes an int64 value into the element bitstream. +func (w *Encoder) Int64(x int64) { + w.Sync(SyncInt64) + w.rawVarint(x) +} + +// Uint64 encodes and writes a uint64 value into the element bitstream. +func (w *Encoder) Uint64(x uint64) { + w.Sync(SyncUint64) + w.rawUvarint(x) +} + +// Len encodes and writes a non-negative int value into the element bitstream. +func (w *Encoder) Len(x int) { assert(x >= 0); w.Uint64(uint64(x)) } + +// Int encodes and writes an int value into the element bitstream. +func (w *Encoder) Int(x int) { w.Int64(int64(x)) } + +// Len encodes and writes a uint value into the element bitstream. +func (w *Encoder) Uint(x uint) { w.Uint64(uint64(x)) } + +// Reloc encodes and writes a relocation for the given (section, +// index) pair into the element bitstream. +// +// Note: Only the index is formally written into the element +// bitstream, so bitstream decoders must know from context which +// section an encoded relocation refers to. +func (w *Encoder) Reloc(r RelocKind, idx Index) { + w.Sync(SyncUseReloc) + w.Len(w.rawReloc(r, idx)) +} + +// Code encodes and writes a Code value into the element bitstream. +func (w *Encoder) Code(c Code) { + w.Sync(c.Marker()) + w.Len(c.Value()) +} + +// String encodes and writes a string value into the element +// bitstream. +// +// Internally, strings are deduplicated by adding them to the strings +// section (if not already present), and then writing a relocation +// into the element bitstream. +func (w *Encoder) String(s string) { + w.Sync(SyncString) + w.Reloc(RelocString, w.p.StringIdx(s)) +} + +// Strings encodes and writes a variable-length slice of strings into +// the element bitstream. +func (w *Encoder) Strings(ss []string) { + w.Len(len(ss)) + for _, s := range ss { + w.String(s) + } +} + +// Value encodes and writes a constant.Value into the element +// bitstream. +func (w *Encoder) Value(val constant.Value) { + w.Sync(SyncValue) + if w.Bool(val.Kind() == constant.Complex) { + w.scalar(constant.Real(val)) + w.scalar(constant.Imag(val)) + } else { + w.scalar(val) + } +} + +func (w *Encoder) scalar(val constant.Value) { + switch v := constant.Val(val).(type) { + default: + errorf("unhandled %v (%v)", val, val.Kind()) + case bool: + w.Code(ValBool) + w.Bool(v) + case string: + w.Code(ValString) + w.String(v) + case int64: + w.Code(ValInt64) + w.Int64(v) + case *big.Int: + w.Code(ValBigInt) + w.bigInt(v) + case *big.Rat: + w.Code(ValBigRat) + w.bigInt(v.Num()) + w.bigInt(v.Denom()) + case *big.Float: + w.Code(ValBigFloat) + w.bigFloat(v) + } +} + +func (w *Encoder) bigInt(v *big.Int) { + b := v.Bytes() + w.String(string(b)) // TODO: More efficient encoding. + w.Bool(v.Sign() < 0) +} + +func (w *Encoder) bigFloat(v *big.Float) { + b := v.Append(nil, 'p', -1) + w.String(string(b)) // TODO: More efficient encoding. +} diff --git a/vendor/golang.org/x/tools/go/internal/pkgbits/flags.go b/vendor/golang.org/x/tools/go/internal/pkgbits/flags.go new file mode 100644 index 000000000000..654222745fac --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/pkgbits/flags.go @@ -0,0 +1,9 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pkgbits + +const ( + flagSyncMarkers = 1 << iota // file format contains sync markers +) diff --git a/vendor/golang.org/x/tools/go/internal/pkgbits/frames_go1.go b/vendor/golang.org/x/tools/go/internal/pkgbits/frames_go1.go new file mode 100644 index 000000000000..5294f6a63edd --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/pkgbits/frames_go1.go @@ -0,0 +1,21 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !go1.7 +// +build !go1.7 + +// TODO(mdempsky): Remove after #44505 is resolved + +package pkgbits + +import "runtime" + +func walkFrames(pcs []uintptr, visit frameVisitor) { + for _, pc := range pcs { + fn := runtime.FuncForPC(pc) + file, line := fn.FileLine(pc) + + visit(file, line, fn.Name(), pc-fn.Entry()) + } +} diff --git a/vendor/golang.org/x/tools/go/internal/pkgbits/frames_go17.go b/vendor/golang.org/x/tools/go/internal/pkgbits/frames_go17.go new file mode 100644 index 000000000000..2324ae7adfe2 --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/pkgbits/frames_go17.go @@ -0,0 +1,28 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.7 +// +build go1.7 + +package pkgbits + +import "runtime" + +// walkFrames calls visit for each call frame represented by pcs. +// +// pcs should be a slice of PCs, as returned by runtime.Callers. +func walkFrames(pcs []uintptr, visit frameVisitor) { + if len(pcs) == 0 { + return + } + + frames := runtime.CallersFrames(pcs) + for { + frame, more := frames.Next() + visit(frame.File, frame.Line, frame.Function, frame.PC-frame.Entry) + if !more { + return + } + } +} diff --git a/vendor/golang.org/x/tools/go/internal/pkgbits/reloc.go b/vendor/golang.org/x/tools/go/internal/pkgbits/reloc.go new file mode 100644 index 000000000000..7a8f04ab3fc6 --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/pkgbits/reloc.go @@ -0,0 +1,42 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pkgbits + +// A RelocKind indicates a particular section within a unified IR export. +type RelocKind int + +// An Index represents a bitstream element index within a particular +// section. +type Index int + +// A relocEnt (relocation entry) is an entry in an element's local +// reference table. +// +// TODO(mdempsky): Rename this too. +type RelocEnt struct { + Kind RelocKind + Idx Index +} + +// Reserved indices within the meta relocation section. +const ( + PublicRootIdx Index = 0 + PrivateRootIdx Index = 1 +) + +const ( + RelocString RelocKind = iota + RelocMeta + RelocPosBase + RelocPkg + RelocName + RelocType + RelocObj + RelocObjExt + RelocObjDict + RelocBody + + numRelocs = iota +) diff --git a/vendor/golang.org/x/tools/go/internal/pkgbits/support.go b/vendor/golang.org/x/tools/go/internal/pkgbits/support.go new file mode 100644 index 000000000000..ad26d3b28cae --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/pkgbits/support.go @@ -0,0 +1,17 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pkgbits + +import "fmt" + +func assert(b bool) { + if !b { + panic("assertion failed") + } +} + +func errorf(format string, args ...interface{}) { + panic(fmt.Errorf(format, args...)) +} diff --git a/vendor/golang.org/x/tools/go/internal/pkgbits/sync.go b/vendor/golang.org/x/tools/go/internal/pkgbits/sync.go new file mode 100644 index 000000000000..5bd51ef71700 --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/pkgbits/sync.go @@ -0,0 +1,113 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pkgbits + +import ( + "fmt" + "strings" +) + +// fmtFrames formats a backtrace for reporting reader/writer desyncs. +func fmtFrames(pcs ...uintptr) []string { + res := make([]string, 0, len(pcs)) + walkFrames(pcs, func(file string, line int, name string, offset uintptr) { + // Trim package from function name. It's just redundant noise. + name = strings.TrimPrefix(name, "cmd/compile/internal/noder.") + + res = append(res, fmt.Sprintf("%s:%v: %s +0x%v", file, line, name, offset)) + }) + return res +} + +type frameVisitor func(file string, line int, name string, offset uintptr) + +// SyncMarker is an enum type that represents markers that may be +// written to export data to ensure the reader and writer stay +// synchronized. +type SyncMarker int + +//go:generate stringer -type=SyncMarker -trimprefix=Sync + +const ( + _ SyncMarker = iota + + // Public markers (known to go/types importers). + + // Low-level coding markers. + SyncEOF + SyncBool + SyncInt64 + SyncUint64 + SyncString + SyncValue + SyncVal + SyncRelocs + SyncReloc + SyncUseReloc + + // Higher-level object and type markers. + SyncPublic + SyncPos + SyncPosBase + SyncObject + SyncObject1 + SyncPkg + SyncPkgDef + SyncMethod + SyncType + SyncTypeIdx + SyncTypeParamNames + SyncSignature + SyncParams + SyncParam + SyncCodeObj + SyncSym + SyncLocalIdent + SyncSelector + + // Private markers (only known to cmd/compile). + SyncPrivate + + SyncFuncExt + SyncVarExt + SyncTypeExt + SyncPragma + + SyncExprList + SyncExprs + SyncExpr + SyncExprType + SyncAssign + SyncOp + SyncFuncLit + SyncCompLit + + SyncDecl + SyncFuncBody + SyncOpenScope + SyncCloseScope + SyncCloseAnotherScope + SyncDeclNames + SyncDeclName + + SyncStmts + SyncBlockStmt + SyncIfStmt + SyncForStmt + SyncSwitchStmt + SyncRangeStmt + SyncCaseClause + SyncCommClause + SyncSelectStmt + SyncDecls + SyncLabeledStmt + SyncUseObjLocal + SyncAddLocal + SyncLinkname + SyncStmt1 + SyncStmtsEnd + SyncLabel + SyncOptLabel +) diff --git a/vendor/golang.org/x/tools/go/internal/pkgbits/syncmarker_string.go b/vendor/golang.org/x/tools/go/internal/pkgbits/syncmarker_string.go new file mode 100644 index 000000000000..4a5b0ca5f2ff --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/pkgbits/syncmarker_string.go @@ -0,0 +1,89 @@ +// Code generated by "stringer -type=SyncMarker -trimprefix=Sync"; DO NOT EDIT. + +package pkgbits + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[SyncEOF-1] + _ = x[SyncBool-2] + _ = x[SyncInt64-3] + _ = x[SyncUint64-4] + _ = x[SyncString-5] + _ = x[SyncValue-6] + _ = x[SyncVal-7] + _ = x[SyncRelocs-8] + _ = x[SyncReloc-9] + _ = x[SyncUseReloc-10] + _ = x[SyncPublic-11] + _ = x[SyncPos-12] + _ = x[SyncPosBase-13] + _ = x[SyncObject-14] + _ = x[SyncObject1-15] + _ = x[SyncPkg-16] + _ = x[SyncPkgDef-17] + _ = x[SyncMethod-18] + _ = x[SyncType-19] + _ = x[SyncTypeIdx-20] + _ = x[SyncTypeParamNames-21] + _ = x[SyncSignature-22] + _ = x[SyncParams-23] + _ = x[SyncParam-24] + _ = x[SyncCodeObj-25] + _ = x[SyncSym-26] + _ = x[SyncLocalIdent-27] + _ = x[SyncSelector-28] + _ = x[SyncPrivate-29] + _ = x[SyncFuncExt-30] + _ = x[SyncVarExt-31] + _ = x[SyncTypeExt-32] + _ = x[SyncPragma-33] + _ = x[SyncExprList-34] + _ = x[SyncExprs-35] + _ = x[SyncExpr-36] + _ = x[SyncExprType-37] + _ = x[SyncAssign-38] + _ = x[SyncOp-39] + _ = x[SyncFuncLit-40] + _ = x[SyncCompLit-41] + _ = x[SyncDecl-42] + _ = x[SyncFuncBody-43] + _ = x[SyncOpenScope-44] + _ = x[SyncCloseScope-45] + _ = x[SyncCloseAnotherScope-46] + _ = x[SyncDeclNames-47] + _ = x[SyncDeclName-48] + _ = x[SyncStmts-49] + _ = x[SyncBlockStmt-50] + _ = x[SyncIfStmt-51] + _ = x[SyncForStmt-52] + _ = x[SyncSwitchStmt-53] + _ = x[SyncRangeStmt-54] + _ = x[SyncCaseClause-55] + _ = x[SyncCommClause-56] + _ = x[SyncSelectStmt-57] + _ = x[SyncDecls-58] + _ = x[SyncLabeledStmt-59] + _ = x[SyncUseObjLocal-60] + _ = x[SyncAddLocal-61] + _ = x[SyncLinkname-62] + _ = x[SyncStmt1-63] + _ = x[SyncStmtsEnd-64] + _ = x[SyncLabel-65] + _ = x[SyncOptLabel-66] +} + +const _SyncMarker_name = "EOFBoolInt64Uint64StringValueValRelocsRelocUseRelocPublicPosPosBaseObjectObject1PkgPkgDefMethodTypeTypeIdxTypeParamNamesSignatureParamsParamCodeObjSymLocalIdentSelectorPrivateFuncExtVarExtTypeExtPragmaExprListExprsExprExprTypeAssignOpFuncLitCompLitDeclFuncBodyOpenScopeCloseScopeCloseAnotherScopeDeclNamesDeclNameStmtsBlockStmtIfStmtForStmtSwitchStmtRangeStmtCaseClauseCommClauseSelectStmtDeclsLabeledStmtUseObjLocalAddLocalLinknameStmt1StmtsEndLabelOptLabel" + +var _SyncMarker_index = [...]uint16{0, 3, 7, 12, 18, 24, 29, 32, 38, 43, 51, 57, 60, 67, 73, 80, 83, 89, 95, 99, 106, 120, 129, 135, 140, 147, 150, 160, 168, 175, 182, 188, 195, 201, 209, 214, 218, 226, 232, 234, 241, 248, 252, 260, 269, 279, 296, 305, 313, 318, 327, 333, 340, 350, 359, 369, 379, 389, 394, 405, 416, 424, 432, 437, 445, 450, 458} + +func (i SyncMarker) String() string { + i -= 1 + if i < 0 || i >= SyncMarker(len(_SyncMarker_index)-1) { + return "SyncMarker(" + strconv.FormatInt(int64(i+1), 10) + ")" + } + return _SyncMarker_name[_SyncMarker_index[i]:_SyncMarker_index[i+1]] +} diff --git a/vendor/golang.org/x/tools/go/packages/doc.go b/vendor/golang.org/x/tools/go/packages/doc.go index 4bfe28a51ff5..da4ab89fe63f 100644 --- a/vendor/golang.org/x/tools/go/packages/doc.go +++ b/vendor/golang.org/x/tools/go/packages/doc.go @@ -67,7 +67,6 @@ Most tools should pass their command-line arguments (after any flags) uninterpreted to the loader, so that the loader can interpret them according to the conventions of the underlying build system. See the Example function for typical usage. - */ package packages // import "golang.org/x/tools/go/packages" diff --git a/vendor/golang.org/x/tools/go/packages/golist.go b/vendor/golang.org/x/tools/go/packages/golist.go index 0e1e7f11fee8..de881562de1d 100644 --- a/vendor/golang.org/x/tools/go/packages/golist.go +++ b/vendor/golang.org/x/tools/go/packages/golist.go @@ -26,7 +26,6 @@ import ( "golang.org/x/tools/go/internal/packagesdriver" "golang.org/x/tools/internal/gocommand" "golang.org/x/tools/internal/packagesinternal" - "golang.org/x/xerrors" ) // debug controls verbose logging. @@ -303,11 +302,12 @@ func (state *golistState) runContainsQueries(response *responseDeduper, queries } dirResponse, err := state.createDriverResponse(pattern) - // If there was an error loading the package, or the package is returned - // with errors, try to load the file as an ad-hoc package. + // If there was an error loading the package, or no packages are returned, + // or the package is returned with errors, try to load the file as an + // ad-hoc package. // Usually the error will appear in a returned package, but may not if we're // in module mode and the ad-hoc is located outside a module. - if err != nil || len(dirResponse.Packages) == 1 && len(dirResponse.Packages[0].GoFiles) == 0 && + if err != nil || len(dirResponse.Packages) == 0 || len(dirResponse.Packages) == 1 && len(dirResponse.Packages[0].GoFiles) == 0 && len(dirResponse.Packages[0].Errors) == 1 { var queryErr error if dirResponse, queryErr = state.adhocPackage(pattern, query); queryErr != nil { @@ -393,6 +393,8 @@ type jsonPackage struct { CompiledGoFiles []string IgnoredGoFiles []string IgnoredOtherFiles []string + EmbedPatterns []string + EmbedFiles []string CFiles []string CgoFiles []string CXXFiles []string @@ -444,7 +446,11 @@ func (state *golistState) createDriverResponse(words ...string) (*driverResponse // Run "go list" for complete // information on the specified packages. - buf, err := state.invokeGo("list", golistargs(state.cfg, words)...) + goVersion, err := state.getGoVersion() + if err != nil { + return nil, err + } + buf, err := state.invokeGo("list", golistargs(state.cfg, words, goVersion)...) if err != nil { return nil, err } @@ -565,6 +571,8 @@ func (state *golistState) createDriverResponse(words ...string) (*driverResponse GoFiles: absJoin(p.Dir, p.GoFiles, p.CgoFiles), CompiledGoFiles: absJoin(p.Dir, p.CompiledGoFiles), OtherFiles: absJoin(p.Dir, otherFiles(p)...), + EmbedFiles: absJoin(p.Dir, p.EmbedFiles), + EmbedPatterns: absJoin(p.Dir, p.EmbedPatterns), IgnoredFiles: absJoin(p.Dir, p.IgnoredGoFiles, p.IgnoredOtherFiles), forTest: p.ForTest, depsErrors: p.DepsErrors, @@ -805,17 +813,83 @@ func absJoin(dir string, fileses ...[]string) (res []string) { return res } -func golistargs(cfg *Config, words []string) []string { +func jsonFlag(cfg *Config, goVersion int) string { + if goVersion < 19 { + return "-json" + } + var fields []string + added := make(map[string]bool) + addFields := func(fs ...string) { + for _, f := range fs { + if !added[f] { + added[f] = true + fields = append(fields, f) + } + } + } + addFields("Name", "ImportPath", "Error") // These fields are always needed + if cfg.Mode&NeedFiles != 0 || cfg.Mode&NeedTypes != 0 { + addFields("Dir", "GoFiles", "IgnoredGoFiles", "IgnoredOtherFiles", "CFiles", + "CgoFiles", "CXXFiles", "MFiles", "HFiles", "FFiles", "SFiles", + "SwigFiles", "SwigCXXFiles", "SysoFiles") + if cfg.Tests { + addFields("TestGoFiles", "XTestGoFiles") + } + } + if cfg.Mode&NeedTypes != 0 { + // CompiledGoFiles seems to be required for the test case TestCgoNoSyntax, + // even when -compiled isn't passed in. + // TODO(#52435): Should we make the test ask for -compiled, or automatically + // request CompiledGoFiles in certain circumstances? + addFields("Dir", "CompiledGoFiles") + } + if cfg.Mode&NeedCompiledGoFiles != 0 { + addFields("Dir", "CompiledGoFiles", "Export") + } + if cfg.Mode&NeedImports != 0 { + // When imports are requested, DepOnly is used to distinguish between packages + // explicitly requested and transitive imports of those packages. + addFields("DepOnly", "Imports", "ImportMap") + if cfg.Tests { + addFields("TestImports", "XTestImports") + } + } + if cfg.Mode&NeedDeps != 0 { + addFields("DepOnly") + } + if usesExportData(cfg) { + // Request Dir in the unlikely case Export is not absolute. + addFields("Dir", "Export") + } + if cfg.Mode&needInternalForTest != 0 { + addFields("ForTest") + } + if cfg.Mode&needInternalDepsErrors != 0 { + addFields("DepsErrors") + } + if cfg.Mode&NeedModule != 0 { + addFields("Module") + } + if cfg.Mode&NeedEmbedFiles != 0 { + addFields("EmbedFiles") + } + if cfg.Mode&NeedEmbedPatterns != 0 { + addFields("EmbedPatterns") + } + return "-json=" + strings.Join(fields, ",") +} + +func golistargs(cfg *Config, words []string, goVersion int) []string { const findFlags = NeedImports | NeedTypes | NeedSyntax | NeedTypesInfo fullargs := []string{ - "-e", "-json", + "-e", jsonFlag(cfg, goVersion), fmt.Sprintf("-compiled=%t", cfg.Mode&(NeedCompiledGoFiles|NeedSyntax|NeedTypes|NeedTypesInfo|NeedTypesSizes) != 0), fmt.Sprintf("-test=%t", cfg.Tests), fmt.Sprintf("-export=%t", usesExportData(cfg)), fmt.Sprintf("-deps=%t", cfg.Mode&NeedImports != 0), // go list doesn't let you pass -test and -find together, // probably because you'd just get the TestMain. - fmt.Sprintf("-find=%t", !cfg.Tests && cfg.Mode&findFlags == 0), + fmt.Sprintf("-find=%t", !cfg.Tests && cfg.Mode&findFlags == 0 && !usesExportData(cfg)), } fullargs = append(fullargs, cfg.BuildFlags...) fullargs = append(fullargs, "--") @@ -879,7 +953,7 @@ func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer, if !ok { // Catastrophic error: // - context cancellation - return nil, xerrors.Errorf("couldn't run 'go': %w", err) + return nil, fmt.Errorf("couldn't run 'go': %w", err) } // Old go version? diff --git a/vendor/golang.org/x/tools/go/packages/loadmode_string.go b/vendor/golang.org/x/tools/go/packages/loadmode_string.go index 7ea37e7eeac3..5c080d21b54a 100644 --- a/vendor/golang.org/x/tools/go/packages/loadmode_string.go +++ b/vendor/golang.org/x/tools/go/packages/loadmode_string.go @@ -15,7 +15,7 @@ var allModes = []LoadMode{ NeedCompiledGoFiles, NeedImports, NeedDeps, - NeedExportsFile, + NeedExportFile, NeedTypes, NeedSyntax, NeedTypesInfo, @@ -28,7 +28,7 @@ var modeStrings = []string{ "NeedCompiledGoFiles", "NeedImports", "NeedDeps", - "NeedExportsFile", + "NeedExportFile", "NeedTypes", "NeedSyntax", "NeedTypesInfo", diff --git a/vendor/golang.org/x/tools/go/packages/packages.go b/vendor/golang.org/x/tools/go/packages/packages.go index d545b13758ca..a93dc6add4d8 100644 --- a/vendor/golang.org/x/tools/go/packages/packages.go +++ b/vendor/golang.org/x/tools/go/packages/packages.go @@ -39,9 +39,6 @@ import ( // Load may return more information than requested. type LoadMode int -// TODO(matloob): When a V2 of go/packages is released, rename NeedExportsFile to -// NeedExportFile to make it consistent with the Package field it's adding. - const ( // NeedName adds Name and PkgPath. NeedName LoadMode = 1 << iota @@ -59,8 +56,8 @@ const ( // NeedDeps adds the fields requested by the LoadMode in the packages in Imports. NeedDeps - // NeedExportsFile adds ExportFile. - NeedExportsFile + // NeedExportFile adds ExportFile. + NeedExportFile // NeedTypes adds Types, Fset, and IllTyped. NeedTypes @@ -74,12 +71,25 @@ const ( // NeedTypesSizes adds TypesSizes. NeedTypesSizes + // needInternalDepsErrors adds the internal deps errors field for use by gopls. + needInternalDepsErrors + + // needInternalForTest adds the internal forTest field. + // Tests must also be set on the context for this field to be populated. + needInternalForTest + // typecheckCgo enables full support for type checking cgo. Requires Go 1.15+. // Modifies CompiledGoFiles and Types, and has no effect on its own. typecheckCgo // NeedModule adds Module. NeedModule + + // NeedEmbedFiles adds EmbedFiles. + NeedEmbedFiles + + // NeedEmbedPatterns adds EmbedPatterns. + NeedEmbedPatterns ) const ( @@ -102,6 +112,9 @@ const ( // Deprecated: LoadAllSyntax exists for historical compatibility // and should not be used. Please directly specify the needed fields using the Need values. LoadAllSyntax = LoadSyntax | NeedDeps + + // Deprecated: NeedExportsFile is a historical misspelling of NeedExportFile. + NeedExportsFile = NeedExportFile ) // A Config specifies details about how packages should be loaded. @@ -296,6 +309,14 @@ type Package struct { // including assembly, C, C++, Fortran, Objective-C, SWIG, and so on. OtherFiles []string + // EmbedFiles lists the absolute file paths of the package's files + // embedded with go:embed. + EmbedFiles []string + + // EmbedPatterns lists the absolute file patterns of the package's + // files embedded with go:embed. + EmbedPatterns []string + // IgnoredFiles lists source files that are not part of the package // using the current build configuration but that might be part of // the package using other build configurations. @@ -328,6 +349,9 @@ type Package struct { // The NeedSyntax LoadMode bit populates this field for packages matching the patterns. // If NeedDeps and NeedImports are also set, this field will also be populated // for dependencies. + // + // Syntax is kept in the same order as CompiledGoFiles, with the caveat that nils are + // removed. If parsing returned nil, Syntax may be shorter than CompiledGoFiles. Syntax []*ast.File // TypesInfo provides type information about the package's syntax trees. @@ -386,6 +410,8 @@ func init() { config.(*Config).modFlag = value } packagesinternal.TypecheckCgo = int(typecheckCgo) + packagesinternal.DepsErrors = int(needInternalDepsErrors) + packagesinternal.ForTest = int(needInternalForTest) } // An Error describes a problem with a package's metadata, syntax, or types. @@ -428,6 +454,8 @@ type flatPackage struct { GoFiles []string `json:",omitempty"` CompiledGoFiles []string `json:",omitempty"` OtherFiles []string `json:",omitempty"` + EmbedFiles []string `json:",omitempty"` + EmbedPatterns []string `json:",omitempty"` IgnoredFiles []string `json:",omitempty"` ExportFile string `json:",omitempty"` Imports map[string]string `json:",omitempty"` @@ -451,6 +479,8 @@ func (p *Package) MarshalJSON() ([]byte, error) { GoFiles: p.GoFiles, CompiledGoFiles: p.CompiledGoFiles, OtherFiles: p.OtherFiles, + EmbedFiles: p.EmbedFiles, + EmbedPatterns: p.EmbedPatterns, IgnoredFiles: p.IgnoredFiles, ExportFile: p.ExportFile, } @@ -478,6 +508,8 @@ func (p *Package) UnmarshalJSON(b []byte) error { GoFiles: flat.GoFiles, CompiledGoFiles: flat.CompiledGoFiles, OtherFiles: flat.OtherFiles, + EmbedFiles: flat.EmbedFiles, + EmbedPatterns: flat.EmbedPatterns, ExportFile: flat.ExportFile, } if len(flat.Imports) > 0 { @@ -611,7 +643,7 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { needsrc := ((ld.Mode&(NeedSyntax|NeedTypesInfo) != 0 && (rootIndex >= 0 || ld.Mode&NeedDeps != 0)) || // ... or if we need types and the exportData is invalid. We fall back to (incompletely) // typechecking packages from source if they fail to compile. - (ld.Mode&NeedTypes|NeedTypesInfo != 0 && exportDataInvalid)) && pkg.PkgPath != "unsafe" + (ld.Mode&(NeedTypes|NeedTypesInfo) != 0 && exportDataInvalid)) && pkg.PkgPath != "unsafe" lpkg := &loaderPackage{ Package: pkg, needtypes: needtypes, @@ -749,13 +781,19 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { ld.pkgs[i].OtherFiles = nil ld.pkgs[i].IgnoredFiles = nil } + if ld.requestedMode&NeedEmbedFiles == 0 { + ld.pkgs[i].EmbedFiles = nil + } + if ld.requestedMode&NeedEmbedPatterns == 0 { + ld.pkgs[i].EmbedPatterns = nil + } if ld.requestedMode&NeedCompiledGoFiles == 0 { ld.pkgs[i].CompiledGoFiles = nil } if ld.requestedMode&NeedImports == 0 { ld.pkgs[i].Imports = nil } - if ld.requestedMode&NeedExportsFile == 0 { + if ld.requestedMode&NeedExportFile == 0 { ld.pkgs[i].ExportFile = "" } if ld.requestedMode&NeedTypes == 0 { @@ -1050,7 +1088,6 @@ func (ld *loader) parseFile(filename string) (*ast.File, error) { // // Because files are scanned in parallel, the token.Pos // positions of the resulting ast.Files are not ordered. -// func (ld *loader) parseFiles(filenames []string) ([]*ast.File, []error) { var wg sync.WaitGroup n := len(filenames) @@ -1094,7 +1131,6 @@ func (ld *loader) parseFiles(filenames []string) ([]*ast.File, []error) { // sameFile returns true if x and y have the same basename and denote // the same file. -// func sameFile(x, y string) bool { if x == y { // It could be the case that y doesn't exist. @@ -1207,8 +1243,13 @@ func (ld *loader) loadFromExportData(lpkg *loaderPackage) (*types.Package, error if err != nil { return nil, fmt.Errorf("reading %s: %v", lpkg.ExportFile, err) } + if _, ok := view["go.shape"]; ok { + // Account for the pseudopackage "go.shape" that gets + // created by generic code. + viewLen++ + } if viewLen != len(view) { - log.Fatalf("Unexpected package creation during export data loading") + log.Panicf("golang.org/x/tools/go/packages: unexpected new packages during load of %s", lpkg.PkgPath) } lpkg.Types = tpkg @@ -1219,17 +1260,8 @@ func (ld *loader) loadFromExportData(lpkg *loaderPackage) (*types.Package, error // impliedLoadMode returns loadMode with its dependencies. func impliedLoadMode(loadMode LoadMode) LoadMode { - if loadMode&NeedTypesInfo != 0 && loadMode&NeedImports == 0 { - // If NeedTypesInfo, go/packages needs to do typechecking itself so it can - // associate type info with the AST. To do so, we need the export data - // for dependencies, which means we need to ask for the direct dependencies. - // NeedImports is used to ask for the direct dependencies. - loadMode |= NeedImports - } - - if loadMode&NeedDeps != 0 && loadMode&NeedImports == 0 { - // With NeedDeps we need to load at least direct dependencies. - // NeedImports is used to ask for the direct dependencies. + if loadMode&(NeedDeps|NeedTypes|NeedTypesInfo) != 0 { + // All these things require knowing the import graph. loadMode |= NeedImports } @@ -1237,5 +1269,5 @@ func impliedLoadMode(loadMode LoadMode) LoadMode { } func usesExportData(cfg *Config) bool { - return cfg.Mode&NeedExportsFile != 0 || cfg.Mode&NeedTypes != 0 && cfg.Mode&NeedDeps == 0 + return cfg.Mode&NeedExportFile != 0 || cfg.Mode&NeedTypes != 0 && cfg.Mode&NeedDeps == 0 } diff --git a/vendor/golang.org/x/tools/imports/forward.go b/vendor/golang.org/x/tools/imports/forward.go index 8be18a66b3c2..d2547c743382 100644 --- a/vendor/golang.org/x/tools/imports/forward.go +++ b/vendor/golang.org/x/tools/imports/forward.go @@ -40,7 +40,7 @@ var LocalPrefix string // // Note that filename's directory influences which imports can be chosen, // so it is important that filename be accurate. -// To process data ``as if'' it were in filename, pass the data as a non-nil src. +// To process data “as if” it were in filename, pass the data as a non-nil src. func Process(filename string, src []byte, opt *Options) ([]byte, error) { var err error if src == nil { diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go index 9887f7e7a016..798fe599be4c 100644 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go +++ b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go @@ -40,12 +40,12 @@ var ErrSkipFiles = errors.New("fastwalk: skip remaining files in directory") // If fastWalk returns filepath.SkipDir, the directory is skipped. // // Unlike filepath.Walk: -// * file stat calls must be done by the user. +// - file stat calls must be done by the user. // The only provided metadata is the file type, which does not include // any permission bits. -// * multiple goroutines stat the filesystem concurrently. The provided +// - multiple goroutines stat the filesystem concurrently. The provided // walkFn must be safe for concurrent use. -// * fastWalk can follow symlinks if walkFn returns the TraverseLink +// - fastWalk can follow symlinks if walkFn returns the TraverseLink // sentinel error. It is the walkFn's responsibility to prevent // fastWalk from going into symlink cycles. func Walk(root string, walkFn func(path string, typ os.FileMode) error) error { diff --git a/vendor/golang.org/x/tools/internal/gocommand/invoke.go b/vendor/golang.org/x/tools/internal/gocommand/invoke.go index 8659a0c5da67..67256dc3974c 100644 --- a/vendor/golang.org/x/tools/internal/gocommand/invoke.go +++ b/vendor/golang.org/x/tools/internal/gocommand/invoke.go @@ -9,7 +9,6 @@ import ( "bytes" "context" "fmt" - exec "golang.org/x/sys/execabs" "io" "os" "regexp" @@ -18,6 +17,8 @@ import ( "sync" "time" + exec "golang.org/x/sys/execabs" + "golang.org/x/tools/internal/event" ) @@ -131,9 +132,16 @@ type Invocation struct { Verb string Args []string BuildFlags []string - ModFlag string - ModFile string - Overlay string + + // If ModFlag is set, the go command is invoked with -mod=ModFlag. + ModFlag string + + // If ModFile is set, the go command is invoked with -modfile=ModFile. + ModFile string + + // If Overlay is set, the go command is invoked with -overlay=Overlay. + Overlay string + // If CleanEnv is set, the invocation will run only with the environment // in Env, not starting with os.Environ. CleanEnv bool @@ -256,8 +264,10 @@ func cmdDebugStr(cmd *exec.Cmd) string { env := make(map[string]string) for _, kv := range cmd.Env { split := strings.SplitN(kv, "=", 2) - k, v := split[0], split[1] - env[k] = v + if len(split) == 2 { + k, v := split[0], split[1] + env[k] = v + } } var args []string diff --git a/vendor/golang.org/x/tools/internal/gocommand/vendor.go b/vendor/golang.org/x/tools/internal/gocommand/vendor.go index 5e75bd6d8fa1..2d3d408c0bed 100644 --- a/vendor/golang.org/x/tools/internal/gocommand/vendor.go +++ b/vendor/golang.org/x/tools/internal/gocommand/vendor.go @@ -38,10 +38,10 @@ var modFlagRegexp = regexp.MustCompile(`-mod[ =](\w+)`) // with the supplied context.Context and Invocation. The Invocation can contain pre-defined fields, // of which only Verb and Args are modified to run the appropriate Go command. // Inspired by setDefaultBuildMod in modload/init.go -func VendorEnabled(ctx context.Context, inv Invocation, r *Runner) (*ModuleJSON, bool, error) { +func VendorEnabled(ctx context.Context, inv Invocation, r *Runner) (bool, *ModuleJSON, error) { mainMod, go114, err := getMainModuleAnd114(ctx, inv, r) if err != nil { - return nil, false, err + return false, nil, err } // We check the GOFLAGS to see if there is anything overridden or not. @@ -49,7 +49,7 @@ func VendorEnabled(ctx context.Context, inv Invocation, r *Runner) (*ModuleJSON, inv.Args = []string{"GOFLAGS"} stdout, err := r.Run(ctx, inv) if err != nil { - return nil, false, err + return false, nil, err } goflags := string(bytes.TrimSpace(stdout.Bytes())) matches := modFlagRegexp.FindStringSubmatch(goflags) @@ -57,25 +57,27 @@ func VendorEnabled(ctx context.Context, inv Invocation, r *Runner) (*ModuleJSON, if len(matches) != 0 { modFlag = matches[1] } - if modFlag != "" { - // Don't override an explicit '-mod=' argument. - return mainMod, modFlag == "vendor", nil + // Don't override an explicit '-mod=' argument. + if modFlag == "vendor" { + return true, mainMod, nil + } else if modFlag != "" { + return false, nil, nil } if mainMod == nil || !go114 { - return mainMod, false, nil + return false, nil, nil } // Check 1.14's automatic vendor mode. if fi, err := os.Stat(filepath.Join(mainMod.Dir, "vendor")); err == nil && fi.IsDir() { if mainMod.GoVersion != "" && semver.Compare("v"+mainMod.GoVersion, "v1.14") >= 0 { // The Go version is at least 1.14, and a vendor directory exists. // Set -mod=vendor by default. - return mainMod, true, nil + return true, mainMod, nil } } - return mainMod, false, nil + return false, nil, nil } -// getMainModuleAnd114 gets the main module's information and whether the +// getMainModuleAnd114 gets one of the main modules' information and whether the // go command in use is 1.14+. This is the information needed to figure out // if vendoring should be enabled. func getMainModuleAnd114(ctx context.Context, inv Invocation, r *Runner) (*ModuleJSON, bool, error) { diff --git a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go b/vendor/golang.org/x/tools/internal/gopathwalk/walk.go index 925ff53560ad..168405322683 100644 --- a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go +++ b/vendor/golang.org/x/tools/internal/gopathwalk/walk.go @@ -175,8 +175,8 @@ func (w *walker) shouldSkipDir(fi os.FileInfo, dir string) bool { // walk walks through the given path. func (w *walker) walk(path string, typ os.FileMode) error { - dir := filepath.Dir(path) if typ.IsRegular() { + dir := filepath.Dir(path) if dir == w.root.Path && (w.root.Type == RootGOROOT || w.root.Type == RootGOPATH) { // Doesn't make sense to have regular files // directly in your $GOPATH/src or $GOROOT/src. @@ -209,12 +209,7 @@ func (w *walker) walk(path string, typ os.FileMode) error { // Emacs noise. return nil } - fi, err := os.Lstat(path) - if err != nil { - // Just ignore it. - return nil - } - if w.shouldTraverse(dir, fi) { + if w.shouldTraverse(path) { return fastwalk.ErrTraverseLink } } @@ -224,13 +219,8 @@ func (w *walker) walk(path string, typ os.FileMode) error { // shouldTraverse reports whether the symlink fi, found in dir, // should be followed. It makes sure symlinks were never visited // before to avoid symlink loops. -func (w *walker) shouldTraverse(dir string, fi os.FileInfo) bool { - path := filepath.Join(dir, fi.Name()) - target, err := filepath.EvalSymlinks(path) - if err != nil { - return false - } - ts, err := os.Stat(target) +func (w *walker) shouldTraverse(path string) bool { + ts, err := os.Stat(path) if err != nil { fmt.Fprintln(os.Stderr, err) return false @@ -238,7 +228,7 @@ func (w *walker) shouldTraverse(dir string, fi os.FileInfo) bool { if !ts.IsDir() { return false } - if w.shouldSkipDir(ts, dir) { + if w.shouldSkipDir(ts, filepath.Dir(path)) { return false } // Check for symlink loops by statting each directory component diff --git a/vendor/golang.org/x/tools/internal/imports/fix.go b/vendor/golang.org/x/tools/internal/imports/fix.go index d859617b7745..9e373d64ebcd 100644 --- a/vendor/golang.org/x/tools/internal/imports/fix.go +++ b/vendor/golang.org/x/tools/internal/imports/fix.go @@ -796,7 +796,7 @@ func GetPackageExports(ctx context.Context, wrapped func(PackageExport), searchP return getCandidatePkgs(ctx, callback, filename, filePkg, env) } -var RequiredGoEnvVars = []string{"GO111MODULE", "GOFLAGS", "GOINSECURE", "GOMOD", "GOMODCACHE", "GONOPROXY", "GONOSUMDB", "GOPATH", "GOPROXY", "GOROOT", "GOSUMDB"} +var RequiredGoEnvVars = []string{"GO111MODULE", "GOFLAGS", "GOINSECURE", "GOMOD", "GOMODCACHE", "GONOPROXY", "GONOSUMDB", "GOPATH", "GOPROXY", "GOROOT", "GOSUMDB", "GOWORK"} // ProcessEnv contains environment variables and settings that affect the use of // the go command, the go/build package, etc. @@ -906,7 +906,7 @@ func (e *ProcessEnv) GetResolver() (Resolver, error) { if err := e.init(); err != nil { return nil, err } - if len(e.Env["GOMOD"]) == 0 { + if len(e.Env["GOMOD"]) == 0 && len(e.Env["GOWORK"]) == 0 { e.resolver = newGopathResolver(e) return e.resolver, nil } diff --git a/vendor/golang.org/x/tools/internal/imports/imports.go b/vendor/golang.org/x/tools/internal/imports/imports.go index 2815edc33d73..95a88383a792 100644 --- a/vendor/golang.org/x/tools/internal/imports/imports.go +++ b/vendor/golang.org/x/tools/internal/imports/imports.go @@ -103,12 +103,17 @@ func ApplyFixes(fixes []*ImportFix, filename string, src []byte, opt *Options, e return formatFile(fileSet, file, src, nil, opt) } -func formatFile(fileSet *token.FileSet, file *ast.File, src []byte, adjust func(orig []byte, src []byte) []byte, opt *Options) ([]byte, error) { - mergeImports(fileSet, file) - sortImports(opt.LocalPrefix, fileSet, file) - imps := astutil.Imports(fileSet, file) +// formatFile formats the file syntax tree. +// It may mutate the token.FileSet. +// +// If an adjust function is provided, it is called after formatting +// with the original source (formatFile's src parameter) and the +// formatted file, and returns the postpocessed result. +func formatFile(fset *token.FileSet, file *ast.File, src []byte, adjust func(orig []byte, src []byte) []byte, opt *Options) ([]byte, error) { + mergeImports(file) + sortImports(opt.LocalPrefix, fset.File(file.Pos()), file) var spacesBefore []string // import paths we need spaces before - for _, impSection := range imps { + for _, impSection := range astutil.Imports(fset, file) { // Within each block of contiguous imports, see if any // import lines are in different group numbers. If so, // we'll need to put a space between them so it's @@ -132,7 +137,7 @@ func formatFile(fileSet *token.FileSet, file *ast.File, src []byte, adjust func( printConfig := &printer.Config{Mode: printerMode, Tabwidth: opt.TabWidth} var buf bytes.Buffer - err := printConfig.Fprint(&buf, fileSet, file) + err := printConfig.Fprint(&buf, fset, file) if err != nil { return nil, err } @@ -276,11 +281,11 @@ func cutSpace(b []byte) (before, middle, after []byte) { } // matchSpace reformats src to use the same space context as orig. -// 1) If orig begins with blank lines, matchSpace inserts them at the beginning of src. -// 2) matchSpace copies the indentation of the first non-blank line in orig -// to every non-blank line in src. -// 3) matchSpace copies the trailing space from orig and uses it in place -// of src's trailing space. +// 1. If orig begins with blank lines, matchSpace inserts them at the beginning of src. +// 2. matchSpace copies the indentation of the first non-blank line in orig +// to every non-blank line in src. +// 3. matchSpace copies the trailing space from orig and uses it in place +// of src's trailing space. func matchSpace(orig []byte, src []byte) []byte { before, _, after := cutSpace(orig) i := bytes.LastIndex(before, []byte{'\n'}) @@ -306,7 +311,7 @@ func matchSpace(orig []byte, src []byte) []byte { return b.Bytes() } -var impLine = regexp.MustCompile(`^\s+(?:[\w\.]+\s+)?"(.+)"`) +var impLine = regexp.MustCompile(`^\s+(?:[\w\.]+\s+)?"(.+?)"`) func addImportSpaces(r io.Reader, breaks []string) ([]byte, error) { var out bytes.Buffer diff --git a/vendor/golang.org/x/tools/internal/imports/mod.go b/vendor/golang.org/x/tools/internal/imports/mod.go index dff6d55362c7..46693f243393 100644 --- a/vendor/golang.org/x/tools/internal/imports/mod.go +++ b/vendor/golang.org/x/tools/internal/imports/mod.go @@ -34,7 +34,8 @@ type ModuleResolver struct { scannedRoots map[gopathwalk.Root]bool initialized bool - main *gocommand.ModuleJSON + mains []*gocommand.ModuleJSON + mainByDir map[string]*gocommand.ModuleJSON modsByModPath []*gocommand.ModuleJSON // All modules, ordered by # of path components in module Path... modsByDir []*gocommand.ModuleJSON // ...or Dir. @@ -69,21 +70,29 @@ func (r *ModuleResolver) init() error { Logf: r.env.Logf, WorkingDir: r.env.WorkingDir, } - mainMod, vendorEnabled, err := gocommand.VendorEnabled(context.TODO(), inv, r.env.GocmdRunner) - if err != nil { - return err + + vendorEnabled := false + var mainModVendor *gocommand.ModuleJSON + + // Module vendor directories are ignored in workspace mode: + // https://go.googlesource.com/proposal/+/master/design/45713-workspace.md + if len(r.env.Env["GOWORK"]) == 0 { + vendorEnabled, mainModVendor, err = gocommand.VendorEnabled(context.TODO(), inv, r.env.GocmdRunner) + if err != nil { + return err + } } - if mainMod != nil && vendorEnabled { + if mainModVendor != nil && vendorEnabled { // Vendor mode is on, so all the non-Main modules are irrelevant, // and we need to search /vendor for everything. - r.main = mainMod + r.mains = []*gocommand.ModuleJSON{mainModVendor} r.dummyVendorMod = &gocommand.ModuleJSON{ Path: "", - Dir: filepath.Join(mainMod.Dir, "vendor"), + Dir: filepath.Join(mainModVendor.Dir, "vendor"), } - r.modsByModPath = []*gocommand.ModuleJSON{mainMod, r.dummyVendorMod} - r.modsByDir = []*gocommand.ModuleJSON{mainMod, r.dummyVendorMod} + r.modsByModPath = []*gocommand.ModuleJSON{mainModVendor, r.dummyVendorMod} + r.modsByDir = []*gocommand.ModuleJSON{mainModVendor, r.dummyVendorMod} } else { // Vendor mode is off, so run go list -m ... to find everything. err := r.initAllMods() @@ -122,8 +131,10 @@ func (r *ModuleResolver) init() error { r.roots = []gopathwalk.Root{ {filepath.Join(goenv["GOROOT"], "/src"), gopathwalk.RootGOROOT}, } - if r.main != nil { - r.roots = append(r.roots, gopathwalk.Root{r.main.Dir, gopathwalk.RootCurrentModule}) + r.mainByDir = make(map[string]*gocommand.ModuleJSON) + for _, main := range r.mains { + r.roots = append(r.roots, gopathwalk.Root{main.Dir, gopathwalk.RootCurrentModule}) + r.mainByDir[main.Dir] = main } if vendorEnabled { r.roots = append(r.roots, gopathwalk.Root{r.dummyVendorMod.Dir, gopathwalk.RootOther}) @@ -189,7 +200,7 @@ func (r *ModuleResolver) initAllMods() error { r.modsByModPath = append(r.modsByModPath, mod) r.modsByDir = append(r.modsByDir, mod) if mod.Main { - r.main = mod + r.mains = append(r.mains, mod) } } return nil @@ -609,7 +620,7 @@ func (r *ModuleResolver) scanDirForPackage(root gopathwalk.Root, dir string) dir } switch root.Type { case gopathwalk.RootCurrentModule: - importPath = path.Join(r.main.Path, filepath.ToSlash(subdir)) + importPath = path.Join(r.mainByDir[root.Path].Path, filepath.ToSlash(subdir)) case gopathwalk.RootModuleCache: matches := modCacheRegexp.FindStringSubmatch(subdir) if len(matches) == 0 { diff --git a/vendor/golang.org/x/tools/internal/imports/sortimports.go b/vendor/golang.org/x/tools/internal/imports/sortimports.go index be8ffa25fec2..85144db1dfa2 100644 --- a/vendor/golang.org/x/tools/internal/imports/sortimports.go +++ b/vendor/golang.org/x/tools/internal/imports/sortimports.go @@ -3,19 +3,23 @@ // license that can be found in the LICENSE file. // Hacked up copy of go/ast/import.go +// Modified to use a single token.File in preference to a FileSet. package imports import ( "go/ast" "go/token" + "log" "sort" "strconv" ) // sortImports sorts runs of consecutive import lines in import blocks in f. // It also removes duplicate imports when it is possible to do so without data loss. -func sortImports(localPrefix string, fset *token.FileSet, f *ast.File) { +// +// It may mutate the token.File. +func sortImports(localPrefix string, tokFile *token.File, f *ast.File) { for i, d := range f.Decls { d, ok := d.(*ast.GenDecl) if !ok || d.Tok != token.IMPORT { @@ -38,21 +42,21 @@ func sortImports(localPrefix string, fset *token.FileSet, f *ast.File) { i := 0 specs := d.Specs[:0] for j, s := range d.Specs { - if j > i && fset.Position(s.Pos()).Line > 1+fset.Position(d.Specs[j-1].End()).Line { + if j > i && tokFile.Line(s.Pos()) > 1+tokFile.Line(d.Specs[j-1].End()) { // j begins a new run. End this one. - specs = append(specs, sortSpecs(localPrefix, fset, f, d.Specs[i:j])...) + specs = append(specs, sortSpecs(localPrefix, tokFile, f, d.Specs[i:j])...) i = j } } - specs = append(specs, sortSpecs(localPrefix, fset, f, d.Specs[i:])...) + specs = append(specs, sortSpecs(localPrefix, tokFile, f, d.Specs[i:])...) d.Specs = specs // Deduping can leave a blank line before the rparen; clean that up. if len(d.Specs) > 0 { lastSpec := d.Specs[len(d.Specs)-1] - lastLine := fset.Position(lastSpec.Pos()).Line - if rParenLine := fset.Position(d.Rparen).Line; rParenLine > lastLine+1 { - fset.File(d.Rparen).MergeLine(rParenLine - 1) + lastLine := tokFile.PositionFor(lastSpec.Pos(), false).Line + if rParenLine := tokFile.PositionFor(d.Rparen, false).Line; rParenLine > lastLine+1 { + tokFile.MergeLine(rParenLine - 1) // has side effects! } } } @@ -60,7 +64,8 @@ func sortImports(localPrefix string, fset *token.FileSet, f *ast.File) { // mergeImports merges all the import declarations into the first one. // Taken from golang.org/x/tools/ast/astutil. -func mergeImports(fset *token.FileSet, f *ast.File) { +// This does not adjust line numbers properly +func mergeImports(f *ast.File) { if len(f.Decls) <= 1 { return } @@ -142,7 +147,9 @@ type posSpan struct { End token.Pos } -func sortSpecs(localPrefix string, fset *token.FileSet, f *ast.File, specs []ast.Spec) []ast.Spec { +// sortSpecs sorts the import specs within each import decl. +// It may mutate the token.File. +func sortSpecs(localPrefix string, tokFile *token.File, f *ast.File, specs []ast.Spec) []ast.Spec { // Can't short-circuit here even if specs are already sorted, // since they might yet need deduplication. // A lone import, however, may be safely ignored. @@ -158,7 +165,7 @@ func sortSpecs(localPrefix string, fset *token.FileSet, f *ast.File, specs []ast // Identify comments in this range. // Any comment from pos[0].Start to the final line counts. - lastLine := fset.Position(pos[len(pos)-1].End).Line + lastLine := tokFile.Line(pos[len(pos)-1].End) cstart := len(f.Comments) cend := len(f.Comments) for i, g := range f.Comments { @@ -168,7 +175,7 @@ func sortSpecs(localPrefix string, fset *token.FileSet, f *ast.File, specs []ast if i < cstart { cstart = i } - if fset.Position(g.End()).Line > lastLine { + if tokFile.Line(g.End()) > lastLine { cend = i break } @@ -201,7 +208,7 @@ func sortSpecs(localPrefix string, fset *token.FileSet, f *ast.File, specs []ast deduped = append(deduped, s) } else { p := s.Pos() - fset.File(p).MergeLine(fset.Position(p).Line) + tokFile.MergeLine(tokFile.Line(p)) // has side effects! } } specs = deduped @@ -232,13 +239,22 @@ func sortSpecs(localPrefix string, fset *token.FileSet, f *ast.File, specs []ast // Fixup comments can insert blank lines, because import specs are on different lines. // We remove those blank lines here by merging import spec to the first import spec line. - firstSpecLine := fset.Position(specs[0].Pos()).Line + firstSpecLine := tokFile.Line(specs[0].Pos()) for _, s := range specs[1:] { p := s.Pos() - line := fset.File(p).Line(p) + line := tokFile.Line(p) for previousLine := line - 1; previousLine >= firstSpecLine; { - fset.File(p).MergeLine(previousLine) - previousLine-- + // MergeLine can panic. Avoid the panic at the cost of not removing the blank line + // golang/go#50329 + if previousLine > 0 && previousLine < tokFile.LineCount() { + tokFile.MergeLine(previousLine) // has side effects! + previousLine-- + } else { + // try to gather some data to diagnose how this could happen + req := "Please report what the imports section of your go file looked like." + log.Printf("panic avoided: first:%d line:%d previous:%d max:%d. %s", + firstSpecLine, line, previousLine, tokFile.LineCount(), req) + } } } return specs diff --git a/vendor/golang.org/x/tools/internal/imports/zstdlib.go b/vendor/golang.org/x/tools/internal/imports/zstdlib.go index 7de2be9b4b7f..437fbb78dbde 100644 --- a/vendor/golang.org/x/tools/internal/imports/zstdlib.go +++ b/vendor/golang.org/x/tools/internal/imports/zstdlib.go @@ -88,6 +88,7 @@ var stdlib = map[string][]string{ "ContainsAny", "ContainsRune", "Count", + "Cut", "Equal", "EqualFold", "ErrTooLarge", @@ -711,6 +712,11 @@ var stdlib = map[string][]string{ "ValueConverter", "Valuer", }, + "debug/buildinfo": []string{ + "BuildInfo", + "Read", + "ReadFile", + }, "debug/dwarf": []string{ "AddrType", "ArrayType", @@ -1944,6 +1950,7 @@ var stdlib = map[string][]string{ "R_PPC64_REL24_NOTOC", "R_PPC64_REL32", "R_PPC64_REL64", + "R_PPC64_RELATIVE", "R_PPC64_SECTOFF_DS", "R_PPC64_SECTOFF_LO_DS", "R_PPC64_TLS", @@ -2547,6 +2554,7 @@ var stdlib = map[string][]string{ "Symbol", }, "debug/plan9obj": []string{ + "ErrNoSymbols", "File", "FileHeader", "Magic386", @@ -2906,6 +2914,7 @@ var stdlib = map[string][]string{ "Importer", "IncDecStmt", "IndexExpr", + "IndexListExpr", "Inspect", "InterfaceType", "IsExported", @@ -3179,6 +3188,7 @@ var stdlib = map[string][]string{ "SUB", "SUB_ASSIGN", "SWITCH", + "TILDE", "TYPE", "Token", "UnaryPrec", @@ -3187,6 +3197,7 @@ var stdlib = map[string][]string{ "XOR_ASSIGN", }, "go/types": []string{ + "ArgumentError", "Array", "AssertableTo", "AssignableTo", @@ -3205,6 +3216,7 @@ var stdlib = map[string][]string{ "Complex64", "Config", "Const", + "Context", "ConvertibleTo", "DefPredeclaredTestFuncs", "Default", @@ -3224,6 +3236,8 @@ var stdlib = map[string][]string{ "ImporterFrom", "Info", "Initializer", + "Instance", + "Instantiate", "Int", "Int16", "Int32", @@ -3254,6 +3268,7 @@ var stdlib = map[string][]string{ "NewChan", "NewChecker", "NewConst", + "NewContext", "NewField", "NewFunc", "NewInterface", @@ -3268,10 +3283,14 @@ var stdlib = map[string][]string{ "NewPointer", "NewScope", "NewSignature", + "NewSignatureType", "NewSlice", "NewStruct", + "NewTerm", "NewTuple", "NewTypeName", + "NewTypeParam", + "NewUnion", "NewVar", "Nil", "Object", @@ -3296,11 +3315,15 @@ var stdlib = map[string][]string{ "StdSizes", "String", "Struct", + "Term", "Tuple", "Typ", "Type", "TypeAndValue", + "TypeList", "TypeName", + "TypeParam", + "TypeParamList", "TypeString", "Uint", "Uint16", @@ -3308,6 +3331,7 @@ var stdlib = map[string][]string{ "Uint64", "Uint8", "Uintptr", + "Union", "Universe", "Unsafe", "UnsafePointer", @@ -4080,9 +4104,11 @@ var stdlib = map[string][]string{ "SRV", "SplitHostPort", "TCPAddr", + "TCPAddrFromAddrPort", "TCPConn", "TCPListener", "UDPAddr", + "UDPAddrFromAddrPort", "UDPConn", "UnixAddr", "UnixConn", @@ -4142,6 +4168,7 @@ var stdlib = map[string][]string{ "ListenAndServe", "ListenAndServeTLS", "LocalAddrContextKey", + "MaxBytesHandler", "MaxBytesReader", "MethodConnect", "MethodDelete", @@ -4338,6 +4365,25 @@ var stdlib = map[string][]string{ "ParseDate", "ReadMessage", }, + "net/netip": []string{ + "Addr", + "AddrFrom16", + "AddrFrom4", + "AddrFromSlice", + "AddrPort", + "AddrPortFrom", + "IPv4Unspecified", + "IPv6LinkLocalAllNodes", + "IPv6Unspecified", + "MustParseAddr", + "MustParseAddrPort", + "MustParsePrefix", + "ParseAddr", + "ParseAddrPort", + "ParsePrefix", + "Prefix", + "PrefixFrom", + }, "net/rpc": []string{ "Accept", "Call", @@ -4641,6 +4687,8 @@ var stdlib = map[string][]string{ "Method", "New", "NewAt", + "Pointer", + "PointerTo", "Ptr", "PtrTo", "RecvDir", @@ -4819,9 +4867,11 @@ var stdlib = map[string][]string{ }, "runtime/debug": []string{ "BuildInfo", + "BuildSetting", "FreeOSMemory", "GCStats", "Module", + "ParseBuildInfo", "PrintStack", "ReadBuildInfo", "ReadGCStats", @@ -4939,11 +4989,13 @@ var stdlib = map[string][]string{ }, "strings": []string{ "Builder", + "Clone", "Compare", "Contains", "ContainsAny", "ContainsRune", "Count", + "Cut", "EqualFold", "Fields", "FieldsFunc", @@ -9793,6 +9845,7 @@ var stdlib = map[string][]string{ "Syscall18", "Syscall6", "Syscall9", + "SyscallN", "Sysctl", "SysctlUint32", "Sysctlnode", @@ -10202,7 +10255,6 @@ var stdlib = map[string][]string{ "Value", "ValueError", "ValueOf", - "Wrapper", }, "testing": []string{ "AllocsPerRun", @@ -10213,9 +10265,11 @@ var stdlib = map[string][]string{ "CoverBlock", "CoverMode", "Coverage", + "F", "Init", "InternalBenchmark", "InternalExample", + "InternalFuzzTarget", "InternalTest", "M", "Main", @@ -10313,9 +10367,11 @@ var stdlib = map[string][]string{ "ActionNode", "BoolNode", "BranchNode", + "BreakNode", "ChainNode", "CommandNode", "CommentNode", + "ContinueNode", "DotNode", "FieldNode", "IdentifierNode", @@ -10329,9 +10385,11 @@ var stdlib = map[string][]string{ "Node", "NodeAction", "NodeBool", + "NodeBreak", "NodeChain", "NodeCommand", "NodeComment", + "NodeContinue", "NodeDot", "NodeField", "NodeIdentifier", @@ -10727,6 +10785,7 @@ var stdlib = map[string][]string{ "IsSurrogate", }, "unicode/utf8": []string{ + "AppendRune", "DecodeLastRune", "DecodeLastRuneInString", "DecodeRune", diff --git a/vendor/golang.org/x/tools/internal/packagesinternal/packages.go b/vendor/golang.org/x/tools/internal/packagesinternal/packages.go index 9702094c59ed..d9950b1f0bef 100644 --- a/vendor/golang.org/x/tools/internal/packagesinternal/packages.go +++ b/vendor/golang.org/x/tools/internal/packagesinternal/packages.go @@ -23,6 +23,8 @@ var GetGoCmdRunner = func(config interface{}) *gocommand.Runner { return nil } var SetGoCmdRunner = func(config interface{}, runner *gocommand.Runner) {} var TypecheckCgo int +var DepsErrors int // must be set as a LoadMode to call GetDepsErrors +var ForTest int // must be set as a LoadMode to call GetForTest var SetModFlag = func(config interface{}, value string) {} var SetModFile = func(config interface{}, value string) {} diff --git a/vendor/golang.org/x/tools/internal/typeparams/common.go b/vendor/golang.org/x/tools/internal/typeparams/common.go index 961d036fdb01..25a1426d30ec 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/common.go +++ b/vendor/golang.org/x/tools/internal/typeparams/common.go @@ -2,12 +2,24 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package typeparams provides functions to work indirectly with type parameter -// data stored in go/ast and go/types objects, while these API are guarded by a -// build constraint. +// Package typeparams contains common utilities for writing tools that interact +// with generic Go code, as introduced with Go 1.18. // -// This package exists to make it easier for tools to work with generic code, -// while also compiling against older Go versions. +// Many of the types and functions in this package are proxies for the new APIs +// introduced in the standard library with Go 1.18. For example, the +// typeparams.Union type is an alias for go/types.Union, and the ForTypeSpec +// function returns the value of the go/ast.TypeSpec.TypeParams field. At Go +// versions older than 1.18 these helpers are implemented as stubs, allowing +// users of this package to write code that handles generic constructs inline, +// even if the Go version being used to compile does not support generics. +// +// Additionally, this package contains common utilities for working with the +// new generic constructs, to supplement the standard library APIs. Notably, +// the StructuralTerms API computes a minimal representation of the structural +// restrictions on a type parameter. +// +// An external version of these APIs is available in the +// golang.org/x/exp/typeparams module. package typeparams import ( @@ -16,13 +28,47 @@ import ( "go/types" ) -// A IndexExprData holds data from both ast.IndexExpr and the new -// ast.MultiIndexExpr, which was introduced in Go 1.18. -type IndexExprData struct { - X ast.Expr // expression - Lbrack token.Pos // position of "[" - Indices []ast.Expr // index expressions - Rbrack token.Pos // position of "]" +// UnpackIndexExpr extracts data from AST nodes that represent index +// expressions. +// +// For an ast.IndexExpr, the resulting indices slice will contain exactly one +// index expression. For an ast.IndexListExpr (go1.18+), it may have a variable +// number of index expressions. +// +// For nodes that don't represent index expressions, the first return value of +// UnpackIndexExpr will be nil. +func UnpackIndexExpr(n ast.Node) (x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) { + switch e := n.(type) { + case *ast.IndexExpr: + return e.X, e.Lbrack, []ast.Expr{e.Index}, e.Rbrack + case *IndexListExpr: + return e.X, e.Lbrack, e.Indices, e.Rbrack + } + return nil, token.NoPos, nil, token.NoPos +} + +// PackIndexExpr returns an *ast.IndexExpr or *ast.IndexListExpr, depending on +// the cardinality of indices. Calling PackIndexExpr with len(indices) == 0 +// will panic. +func PackIndexExpr(x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) ast.Expr { + switch len(indices) { + case 0: + panic("empty indices") + case 1: + return &ast.IndexExpr{ + X: x, + Lbrack: lbrack, + Index: indices[0], + Rbrack: rbrack, + } + default: + return &IndexListExpr{ + X: x, + Lbrack: lbrack, + Indices: indices, + Rbrack: rbrack, + } + } } // IsTypeParam reports whether t is a type parameter. @@ -30,3 +76,104 @@ func IsTypeParam(t types.Type) bool { _, ok := t.(*TypeParam) return ok } + +// OriginMethod returns the origin method associated with the method fn. +// For methods on a non-generic receiver base type, this is just +// fn. However, for methods with a generic receiver, OriginMethod returns the +// corresponding method in the method set of the origin type. +// +// As a special case, if fn is not a method (has no receiver), OriginMethod +// returns fn. +func OriginMethod(fn *types.Func) *types.Func { + recv := fn.Type().(*types.Signature).Recv() + if recv == nil { + + return fn + } + base := recv.Type() + p, isPtr := base.(*types.Pointer) + if isPtr { + base = p.Elem() + } + named, isNamed := base.(*types.Named) + if !isNamed { + // Receiver is a *types.Interface. + return fn + } + if ForNamed(named).Len() == 0 { + // Receiver base has no type parameters, so we can avoid the lookup below. + return fn + } + orig := NamedTypeOrigin(named) + gfn, _, _ := types.LookupFieldOrMethod(orig, true, fn.Pkg(), fn.Name()) + return gfn.(*types.Func) +} + +// GenericAssignableTo is a generalization of types.AssignableTo that +// implements the following rule for uninstantiated generic types: +// +// If V and T are generic named types, then V is considered assignable to T if, +// for every possible instantation of V[A_1, ..., A_N], the instantiation +// T[A_1, ..., A_N] is valid and V[A_1, ..., A_N] implements T[A_1, ..., A_N]. +// +// If T has structural constraints, they must be satisfied by V. +// +// For example, consider the following type declarations: +// +// type Interface[T any] interface { +// Accept(T) +// } +// +// type Container[T any] struct { +// Element T +// } +// +// func (c Container[T]) Accept(t T) { c.Element = t } +// +// In this case, GenericAssignableTo reports that instantiations of Container +// are assignable to the corresponding instantiation of Interface. +func GenericAssignableTo(ctxt *Context, V, T types.Type) bool { + // If V and T are not both named, or do not have matching non-empty type + // parameter lists, fall back on types.AssignableTo. + + VN, Vnamed := V.(*types.Named) + TN, Tnamed := T.(*types.Named) + if !Vnamed || !Tnamed { + return types.AssignableTo(V, T) + } + + vtparams := ForNamed(VN) + ttparams := ForNamed(TN) + if vtparams.Len() == 0 || vtparams.Len() != ttparams.Len() || NamedTypeArgs(VN).Len() != 0 || NamedTypeArgs(TN).Len() != 0 { + return types.AssignableTo(V, T) + } + + // V and T have the same (non-zero) number of type params. Instantiate both + // with the type parameters of V. This must always succeed for V, and will + // succeed for T if and only if the type set of each type parameter of V is a + // subset of the type set of the corresponding type parameter of T, meaning + // that every instantiation of V corresponds to a valid instantiation of T. + + // Minor optimization: ensure we share a context across the two + // instantiations below. + if ctxt == nil { + ctxt = NewContext() + } + + var targs []types.Type + for i := 0; i < vtparams.Len(); i++ { + targs = append(targs, vtparams.At(i)) + } + + vinst, err := Instantiate(ctxt, V, targs, true) + if err != nil { + panic("type parameters should satisfy their own constraints") + } + + tinst, err := Instantiate(ctxt, T, targs, true) + if err != nil { + return false + } + + return types.AssignableTo(vinst, tinst) +} diff --git a/vendor/golang.org/x/tools/internal/typeparams/coretype.go b/vendor/golang.org/x/tools/internal/typeparams/coretype.go new file mode 100644 index 000000000000..993135ec90e8 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/coretype.go @@ -0,0 +1,122 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package typeparams + +import ( + "go/types" +) + +// CoreType returns the core type of T or nil if T does not have a core type. +// +// See https://go.dev/ref/spec#Core_types for the definition of a core type. +func CoreType(T types.Type) types.Type { + U := T.Underlying() + if _, ok := U.(*types.Interface); !ok { + return U // for non-interface types, + } + + terms, err := _NormalTerms(U) + if len(terms) == 0 || err != nil { + // len(terms) -> empty type set of interface. + // err != nil => U is invalid, exceeds complexity bounds, or has an empty type set. + return nil // no core type. + } + + U = terms[0].Type().Underlying() + var identical int // i in [0,identical) => Identical(U, terms[i].Type().Underlying()) + for identical = 1; identical < len(terms); identical++ { + if !types.Identical(U, terms[identical].Type().Underlying()) { + break + } + } + + if identical == len(terms) { + // https://go.dev/ref/spec#Core_types + // "There is a single type U which is the underlying type of all types in the type set of T" + return U + } + ch, ok := U.(*types.Chan) + if !ok { + return nil // no core type as identical < len(terms) and U is not a channel. + } + // https://go.dev/ref/spec#Core_types + // "the type chan E if T contains only bidirectional channels, or the type chan<- E or + // <-chan E depending on the direction of the directional channels present." + for chans := identical; chans < len(terms); chans++ { + curr, ok := terms[chans].Type().Underlying().(*types.Chan) + if !ok { + return nil + } + if !types.Identical(ch.Elem(), curr.Elem()) { + return nil // channel elements are not identical. + } + if ch.Dir() == types.SendRecv { + // ch is bidirectional. We can safely always use curr's direction. + ch = curr + } else if curr.Dir() != types.SendRecv && ch.Dir() != curr.Dir() { + // ch and curr are not bidirectional and not the same direction. + return nil + } + } + return ch +} + +// _NormalTerms returns a slice of terms representing the normalized structural +// type restrictions of a type, if any. +// +// For all types other than *types.TypeParam, *types.Interface, and +// *types.Union, this is just a single term with Tilde() == false and +// Type() == typ. For *types.TypeParam, *types.Interface, and *types.Union, see +// below. +// +// Structural type restrictions of a type parameter are created via +// non-interface types embedded in its constraint interface (directly, or via a +// chain of interface embeddings). For example, in the declaration type +// T[P interface{~int; m()}] int the structural restriction of the type +// parameter P is ~int. +// +// With interface embedding and unions, the specification of structural type +// restrictions may be arbitrarily complex. For example, consider the +// following: +// +// type A interface{ ~string|~[]byte } +// +// type B interface{ int|string } +// +// type C interface { ~string|~int } +// +// type T[P interface{ A|B; C }] int +// +// In this example, the structural type restriction of P is ~string|int: A|B +// expands to ~string|~[]byte|int|string, which reduces to ~string|~[]byte|int, +// which when intersected with C (~string|~int) yields ~string|int. +// +// _NormalTerms computes these expansions and reductions, producing a +// "normalized" form of the embeddings. A structural restriction is normalized +// if it is a single union containing no interface terms, and is minimal in the +// sense that removing any term changes the set of types satisfying the +// constraint. It is left as a proof for the reader that, modulo sorting, there +// is exactly one such normalized form. +// +// Because the minimal representation always takes this form, _NormalTerms +// returns a slice of tilde terms corresponding to the terms of the union in +// the normalized structural restriction. An error is returned if the type is +// invalid, exceeds complexity bounds, or has an empty type set. In the latter +// case, _NormalTerms returns ErrEmptyTypeSet. +// +// _NormalTerms makes no guarantees about the order of terms, except that it +// is deterministic. +func _NormalTerms(typ types.Type) ([]*Term, error) { + switch typ := typ.(type) { + case *TypeParam: + return StructuralTerms(typ) + case *Union: + return UnionTermSet(typ) + case *types.Interface: + return InterfaceTermSet(typ) + default: + return []*Term{NewTerm(false, typ)}, nil + } +} diff --git a/vendor/golang.org/x/tools/internal/typeparams/normalize.go b/vendor/golang.org/x/tools/internal/typeparams/normalize.go index 090f142a5f34..9c631b6512de 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/normalize.go +++ b/vendor/golang.org/x/tools/internal/typeparams/normalize.go @@ -24,20 +24,22 @@ var ErrEmptyTypeSet = errors.New("empty type set") // Structural type restrictions of a type parameter are created via // non-interface types embedded in its constraint interface (directly, or via a // chain of interface embeddings). For example, in the declaration -// type T[P interface{~int; m()}] int +// +// type T[P interface{~int; m()}] int +// // the structural restriction of the type parameter P is ~int. // // With interface embedding and unions, the specification of structural type // restrictions may be arbitrarily complex. For example, consider the // following: // -// type A interface{ ~string|~[]byte } +// type A interface{ ~string|~[]byte } // -// type B interface{ int|string } +// type B interface{ int|string } // -// type C interface { ~string|~int } +// type C interface { ~string|~int } // -// type T[P interface{ A|B; C }] int +// type T[P interface{ A|B; C }] int // // In this example, the structural type restriction of P is ~string|int: A|B // expands to ~string|~[]byte|int|string, which reduces to ~string|~[]byte|int, diff --git a/vendor/golang.org/x/tools/internal/typeparams/termlist.go b/vendor/golang.org/x/tools/internal/typeparams/termlist.go index 10857d504c4f..933106a23dd4 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/termlist.go +++ b/vendor/golang.org/x/tools/internal/typeparams/termlist.go @@ -97,15 +97,6 @@ func (xl termlist) norm() termlist { return rl } -// If the type set represented by xl is specified by a single (non-𝓤) term, -// structuralType returns that type. Otherwise it returns nil. -func (xl termlist) structuralType() types.Type { - if nl := xl.norm(); len(nl) == 1 { - return nl[0].typ // if nl.isAll() then typ is nil, which is ok - } - return nil -} - // union returns the union xl ∪ yl. func (xl termlist) union(yl termlist) termlist { return append(xl, yl...).norm() diff --git a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go index e509daf7be7f..b4788978ff4b 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go +++ b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go @@ -17,38 +17,6 @@ func unsupported() { panic("type parameters are unsupported at this go version") } -// GetIndexExprData extracts data from *ast.IndexExpr nodes. -// For other nodes, GetIndexExprData returns nil. -func GetIndexExprData(n ast.Node) *IndexExprData { - if e, _ := n.(*ast.IndexExpr); e != nil { - return &IndexExprData{ - X: e.X, - Lbrack: e.Lbrack, - Indices: []ast.Expr{e.Index}, - Rbrack: e.Rbrack, - } - } - return nil -} - -// PackIndexExpr returns an *ast.IndexExpr with the given index. -// Calling PackIndexExpr with len(indices) != 1 will panic. -func PackIndexExpr(x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) ast.Expr { - switch len(indices) { - case 0: - panic("empty indices") - case 1: - return &ast.IndexExpr{ - X: x, - Lbrack: lbrack, - Index: indices[0], - Rbrack: rbrack, - } - default: - panic("cannot pack multiple indices at this go version") - } -} - // IndexListExpr is a placeholder type, as type parameters are not supported at // this Go version. Its methods panic on use. type IndexListExpr struct { @@ -217,6 +185,11 @@ func GetInstances(info *types.Info) map[*ast.Ident]Instance { return nil } // this Go version. type Context struct{} +// NewContext returns a placeholder Context instance. +func NewContext() *Context { + return &Context{} +} + // Instantiate is unsupported on this Go version, and panics. func Instantiate(ctxt *Context, typ types.Type, targs []types.Type, validate bool) (types.Type, error) { unsupported() diff --git a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go index e45896fb0224..114a36b866bc 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go +++ b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go @@ -9,59 +9,9 @@ package typeparams import ( "go/ast" - "go/token" "go/types" ) -// GetIndexExprData extracts data from AST nodes that represent index -// expressions. -// -// For an ast.IndexExpr, the resulting IndexExprData will have exactly one -// index expression. For an ast.IndexListExpr (go1.18+), it may have a -// variable number of index expressions. -// -// For nodes that don't represent index expressions, GetIndexExprData returns -// nil. -// TODO(rfindley): remove this function in favor of using the alias below. -func GetIndexExprData(n ast.Node) *IndexExprData { - switch e := n.(type) { - case *ast.IndexExpr: - return &IndexExprData{ - X: e.X, - Lbrack: e.Lbrack, - Indices: []ast.Expr{e.Index}, - Rbrack: e.Rbrack, - } - case *ast.IndexListExpr: - return (*IndexExprData)(e) - } - return nil -} - -// PackIndexExpr returns an *ast.IndexExpr or *ast.IndexListExpr, depending on -// the cardinality of indices. Calling PackIndexExpr with len(indices) == 0 -// will panic. -func PackIndexExpr(x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) ast.Expr { - switch len(indices) { - case 0: - panic("empty indices") - case 1: - return &ast.IndexExpr{ - X: x, - Lbrack: lbrack, - Index: indices[0], - Rbrack: rbrack, - } - default: - return &ast.IndexListExpr{ - X: x, - Lbrack: lbrack, - Indices: indices, - Rbrack: rbrack, - } - } -} - // IndexListExpr is an alias for ast.IndexListExpr. type IndexListExpr = ast.IndexListExpr @@ -190,6 +140,11 @@ func GetInstances(info *types.Info) map[*ast.Ident]Instance { // Context is an alias for types.Context. type Context = types.Context +// NewContext calls types.NewContext. +func NewContext() *Context { + return types.NewContext() +} + // Instantiate calls types.Instantiate. func Instantiate(ctxt *Context, typ types.Type, targs []types.Type, validate bool) (types.Type, error) { return types.Instantiate(ctxt, typ, targs, validate) diff --git a/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go b/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go index fa2834e2ab85..d38ee3c27cd6 100644 --- a/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go +++ b/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go @@ -1365,4 +1365,162 @@ const ( // return i // } InvalidGo + + // All codes below were added in Go 1.17. + + /* decl */ + + // BadDecl occurs when a declaration has invalid syntax. + BadDecl + + // RepeatedDecl occurs when an identifier occurs more than once on the left + // hand side of a short variable declaration. + // + // Example: + // func _() { + // x, y, y := 1, 2, 3 + // } + RepeatedDecl + + /* unsafe */ + + // InvalidUnsafeAdd occurs when unsafe.Add is called with a + // length argument that is not of integer type. + // + // Example: + // import "unsafe" + // + // var p unsafe.Pointer + // var _ = unsafe.Add(p, float64(1)) + InvalidUnsafeAdd + + // InvalidUnsafeSlice occurs when unsafe.Slice is called with a + // pointer argument that is not of pointer type or a length argument + // that is not of integer type, negative, or out of bounds. + // + // Example: + // import "unsafe" + // + // var x int + // var _ = unsafe.Slice(x, 1) + // + // Example: + // import "unsafe" + // + // var x int + // var _ = unsafe.Slice(&x, float64(1)) + // + // Example: + // import "unsafe" + // + // var x int + // var _ = unsafe.Slice(&x, -1) + // + // Example: + // import "unsafe" + // + // var x int + // var _ = unsafe.Slice(&x, uint64(1) << 63) + InvalidUnsafeSlice + + // All codes below were added in Go 1.18. + + /* features */ + + // UnsupportedFeature occurs when a language feature is used that is not + // supported at this Go version. + UnsupportedFeature + + /* type params */ + + // NotAGenericType occurs when a non-generic type is used where a generic + // type is expected: in type or function instantiation. + // + // Example: + // type T int + // + // var _ T[int] + NotAGenericType + + // WrongTypeArgCount occurs when a type or function is instantiated with an + // incorrent number of type arguments, including when a generic type or + // function is used without instantiation. + // + // Errors inolving failed type inference are assigned other error codes. + // + // Example: + // type T[p any] int + // + // var _ T[int, string] + // + // Example: + // func f[T any]() {} + // + // var x = f + WrongTypeArgCount + + // CannotInferTypeArgs occurs when type or function type argument inference + // fails to infer all type arguments. + // + // Example: + // func f[T any]() {} + // + // func _() { + // f() + // } + // + // Example: + // type N[P, Q any] struct{} + // + // var _ N[int] + CannotInferTypeArgs + + // InvalidTypeArg occurs when a type argument does not satisfy its + // corresponding type parameter constraints. + // + // Example: + // type T[P ~int] struct{} + // + // var _ T[string] + InvalidTypeArg // arguments? InferenceFailed + + // InvalidInstanceCycle occurs when an invalid cycle is detected + // within the instantiation graph. + // + // Example: + // func f[T any]() { f[*T]() } + InvalidInstanceCycle + + // InvalidUnion occurs when an embedded union or approximation element is + // not valid. + // + // Example: + // type _ interface { + // ~int | interface{ m() } + // } + InvalidUnion + + // MisplacedConstraintIface occurs when a constraint-type interface is used + // outside of constraint position. + // + // Example: + // type I interface { ~int } + // + // var _ I + MisplacedConstraintIface + + // InvalidMethodTypeParams occurs when methods have type parameters. + // + // It cannot be encountered with an AST parsed using go/parser. + InvalidMethodTypeParams + + // MisplacedTypeParam occurs when a type parameter is used in a place where + // it is not permitted. + // + // Example: + // type T[P any] P + // + // Example: + // type T[P any] struct{ *P } + MisplacedTypeParam ) diff --git a/vendor/golang.org/x/tools/internal/typesinternal/errorcode_string.go b/vendor/golang.org/x/tools/internal/typesinternal/errorcode_string.go index 3e5842a5f0fc..de90e9515ae5 100644 --- a/vendor/golang.org/x/tools/internal/typesinternal/errorcode_string.go +++ b/vendor/golang.org/x/tools/internal/typesinternal/errorcode_string.go @@ -138,11 +138,25 @@ func _() { _ = x[UnusedResults-128] _ = x[InvalidDefer-129] _ = x[InvalidGo-130] + _ = x[BadDecl-131] + _ = x[RepeatedDecl-132] + _ = x[InvalidUnsafeAdd-133] + _ = x[InvalidUnsafeSlice-134] + _ = x[UnsupportedFeature-135] + _ = x[NotAGenericType-136] + _ = x[WrongTypeArgCount-137] + _ = x[CannotInferTypeArgs-138] + _ = x[InvalidTypeArg-139] + _ = x[InvalidInstanceCycle-140] + _ = x[InvalidUnion-141] + _ = x[MisplacedConstraintIface-142] + _ = x[InvalidMethodTypeParams-143] + _ = x[MisplacedTypeParam-144] } -const _ErrorCode_name = "TestBlankPkgNameMismatchedPkgNameInvalidPkgUseBadImportPathBrokenImportImportCRenamedUnusedImportInvalidInitCycleDuplicateDeclInvalidDeclCycleInvalidTypeCycleInvalidConstInitInvalidConstValInvalidConstTypeUntypedNilWrongAssignCountUnassignableOperandNoNewVarMultiValAssignOpInvalidIfaceAssignInvalidChanAssignIncompatibleAssignUnaddressableFieldAssignNotATypeInvalidArrayLenBlankIfaceMethodIncomparableMapKeyInvalidIfaceEmbedInvalidPtrEmbedBadRecvInvalidRecvDuplicateFieldAndMethodDuplicateMethodInvalidBlankInvalidIotaMissingInitBodyInvalidInitSigInvalidInitDeclInvalidMainDeclTooManyValuesNotAnExprTruncatedFloatNumericOverflowUndefinedOpMismatchedTypesDivByZeroNonNumericIncDecUnaddressableOperandInvalidIndirectionNonIndexableOperandInvalidIndexSwappedSliceIndicesNonSliceableOperandInvalidSliceExprInvalidShiftCountInvalidShiftOperandInvalidReceiveInvalidSendDuplicateLitKeyMissingLitKeyInvalidLitIndexOversizeArrayLitMixedStructLitInvalidStructLitMissingLitFieldDuplicateLitFieldUnexportedLitFieldInvalidLitFieldUntypedLitInvalidLitAmbiguousSelectorUndeclaredImportedNameUnexportedNameUndeclaredNameMissingFieldOrMethodBadDotDotDotSyntaxNonVariadicDotDotDotMisplacedDotDotDotInvalidDotDotDotOperandInvalidDotDotDotUncalledBuiltinInvalidAppendInvalidCapInvalidCloseInvalidCopyInvalidComplexInvalidDeleteInvalidImagInvalidLenSwappedMakeArgsInvalidMakeInvalidRealInvalidAssertImpossibleAssertInvalidConversionInvalidUntypedConversionBadOffsetofSyntaxInvalidOffsetofUnusedExprUnusedVarMissingReturnWrongResultCountOutOfScopeResultInvalidCondInvalidPostDeclInvalidChanRangeInvalidIterVarInvalidRangeExprMisplacedBreakMisplacedContinueMisplacedFallthroughDuplicateCaseDuplicateDefaultBadTypeKeywordInvalidTypeSwitchInvalidExprSwitchInvalidSelectCaseUndeclaredLabelDuplicateLabelMisplacedLabelUnusedLabelJumpOverDeclJumpIntoBlockInvalidMethodExprWrongArgCountInvalidCallUnusedResultsInvalidDeferInvalidGo" +const _ErrorCode_name = "TestBlankPkgNameMismatchedPkgNameInvalidPkgUseBadImportPathBrokenImportImportCRenamedUnusedImportInvalidInitCycleDuplicateDeclInvalidDeclCycleInvalidTypeCycleInvalidConstInitInvalidConstValInvalidConstTypeUntypedNilWrongAssignCountUnassignableOperandNoNewVarMultiValAssignOpInvalidIfaceAssignInvalidChanAssignIncompatibleAssignUnaddressableFieldAssignNotATypeInvalidArrayLenBlankIfaceMethodIncomparableMapKeyInvalidIfaceEmbedInvalidPtrEmbedBadRecvInvalidRecvDuplicateFieldAndMethodDuplicateMethodInvalidBlankInvalidIotaMissingInitBodyInvalidInitSigInvalidInitDeclInvalidMainDeclTooManyValuesNotAnExprTruncatedFloatNumericOverflowUndefinedOpMismatchedTypesDivByZeroNonNumericIncDecUnaddressableOperandInvalidIndirectionNonIndexableOperandInvalidIndexSwappedSliceIndicesNonSliceableOperandInvalidSliceExprInvalidShiftCountInvalidShiftOperandInvalidReceiveInvalidSendDuplicateLitKeyMissingLitKeyInvalidLitIndexOversizeArrayLitMixedStructLitInvalidStructLitMissingLitFieldDuplicateLitFieldUnexportedLitFieldInvalidLitFieldUntypedLitInvalidLitAmbiguousSelectorUndeclaredImportedNameUnexportedNameUndeclaredNameMissingFieldOrMethodBadDotDotDotSyntaxNonVariadicDotDotDotMisplacedDotDotDotInvalidDotDotDotOperandInvalidDotDotDotUncalledBuiltinInvalidAppendInvalidCapInvalidCloseInvalidCopyInvalidComplexInvalidDeleteInvalidImagInvalidLenSwappedMakeArgsInvalidMakeInvalidRealInvalidAssertImpossibleAssertInvalidConversionInvalidUntypedConversionBadOffsetofSyntaxInvalidOffsetofUnusedExprUnusedVarMissingReturnWrongResultCountOutOfScopeResultInvalidCondInvalidPostDeclInvalidChanRangeInvalidIterVarInvalidRangeExprMisplacedBreakMisplacedContinueMisplacedFallthroughDuplicateCaseDuplicateDefaultBadTypeKeywordInvalidTypeSwitchInvalidExprSwitchInvalidSelectCaseUndeclaredLabelDuplicateLabelMisplacedLabelUnusedLabelJumpOverDeclJumpIntoBlockInvalidMethodExprWrongArgCountInvalidCallUnusedResultsInvalidDeferInvalidGoBadDeclRepeatedDeclInvalidUnsafeAddInvalidUnsafeSliceUnsupportedFeatureNotAGenericTypeWrongTypeArgCountCannotInferTypeArgsInvalidTypeArgInvalidInstanceCycleInvalidUnionMisplacedConstraintIfaceInvalidMethodTypeParamsMisplacedTypeParam" -var _ErrorCode_index = [...]uint16{0, 4, 16, 33, 46, 59, 71, 85, 97, 113, 126, 142, 158, 174, 189, 205, 215, 231, 250, 258, 274, 292, 309, 327, 351, 359, 374, 390, 408, 425, 440, 447, 458, 481, 496, 508, 519, 534, 548, 563, 578, 591, 600, 614, 629, 640, 655, 664, 680, 700, 718, 737, 749, 768, 787, 803, 820, 839, 853, 864, 879, 892, 907, 923, 937, 953, 968, 985, 1003, 1018, 1028, 1038, 1055, 1077, 1091, 1105, 1125, 1143, 1163, 1181, 1204, 1220, 1235, 1248, 1258, 1270, 1281, 1295, 1308, 1319, 1329, 1344, 1355, 1366, 1379, 1395, 1412, 1436, 1453, 1468, 1478, 1487, 1500, 1516, 1532, 1543, 1558, 1574, 1588, 1604, 1618, 1635, 1655, 1668, 1684, 1698, 1715, 1732, 1749, 1764, 1778, 1792, 1803, 1815, 1828, 1845, 1858, 1869, 1882, 1894, 1903} +var _ErrorCode_index = [...]uint16{0, 4, 16, 33, 46, 59, 71, 85, 97, 113, 126, 142, 158, 174, 189, 205, 215, 231, 250, 258, 274, 292, 309, 327, 351, 359, 374, 390, 408, 425, 440, 447, 458, 481, 496, 508, 519, 534, 548, 563, 578, 591, 600, 614, 629, 640, 655, 664, 680, 700, 718, 737, 749, 768, 787, 803, 820, 839, 853, 864, 879, 892, 907, 923, 937, 953, 968, 985, 1003, 1018, 1028, 1038, 1055, 1077, 1091, 1105, 1125, 1143, 1163, 1181, 1204, 1220, 1235, 1248, 1258, 1270, 1281, 1295, 1308, 1319, 1329, 1344, 1355, 1366, 1379, 1395, 1412, 1436, 1453, 1468, 1478, 1487, 1500, 1516, 1532, 1543, 1558, 1574, 1588, 1604, 1618, 1635, 1655, 1668, 1684, 1698, 1715, 1732, 1749, 1764, 1778, 1792, 1803, 1815, 1828, 1845, 1858, 1869, 1882, 1894, 1903, 1910, 1922, 1938, 1956, 1974, 1989, 2006, 2025, 2039, 2059, 2071, 2095, 2118, 2136} func (i ErrorCode) String() string { i -= 1 diff --git a/vendor/golang.org/x/tools/internal/typesinternal/types.go b/vendor/golang.org/x/tools/internal/typesinternal/types.go index 7c77c2fbc038..ce7d4351b220 100644 --- a/vendor/golang.org/x/tools/internal/typesinternal/types.go +++ b/vendor/golang.org/x/tools/internal/typesinternal/types.go @@ -48,3 +48,5 @@ func ReadGo116ErrorData(err types.Error) (code ErrorCode, start, end token.Pos, } return ErrorCode(data[0]), token.Pos(data[1]), token.Pos(data[2]), true } + +var SetGoVersion = func(conf *types.Config, version string) bool { return false } diff --git a/vendor/golang.org/x/tools/internal/typesinternal/types_118.go b/vendor/golang.org/x/tools/internal/typesinternal/types_118.go new file mode 100644 index 000000000000..a42b072a67d3 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typesinternal/types_118.go @@ -0,0 +1,19 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.18 +// +build go1.18 + +package typesinternal + +import ( + "go/types" +) + +func init() { + SetGoVersion = func(conf *types.Config, version string) bool { + conf.GoVersion = version + return true + } +} diff --git a/vendor/golang.org/x/xerrors/LICENSE b/vendor/golang.org/x/xerrors/LICENSE deleted file mode 100644 index e4a47e17f143..000000000000 --- a/vendor/golang.org/x/xerrors/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2019 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/xerrors/PATENTS b/vendor/golang.org/x/xerrors/PATENTS deleted file mode 100644 index 733099041f84..000000000000 --- a/vendor/golang.org/x/xerrors/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Go project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of Go, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of Go. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of Go or any code incorporated within this -implementation of Go constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of Go -shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/xerrors/README b/vendor/golang.org/x/xerrors/README deleted file mode 100644 index aac7867a560b..000000000000 --- a/vendor/golang.org/x/xerrors/README +++ /dev/null @@ -1,2 +0,0 @@ -This repository holds the transition packages for the new Go 1.13 error values. -See golang.org/design/29934-error-values. diff --git a/vendor/golang.org/x/xerrors/adaptor.go b/vendor/golang.org/x/xerrors/adaptor.go deleted file mode 100644 index 4317f2483313..000000000000 --- a/vendor/golang.org/x/xerrors/adaptor.go +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xerrors - -import ( - "bytes" - "fmt" - "io" - "reflect" - "strconv" -) - -// FormatError calls the FormatError method of f with an errors.Printer -// configured according to s and verb, and writes the result to s. -func FormatError(f Formatter, s fmt.State, verb rune) { - // Assuming this function is only called from the Format method, and given - // that FormatError takes precedence over Format, it cannot be called from - // any package that supports errors.Formatter. It is therefore safe to - // disregard that State may be a specific printer implementation and use one - // of our choice instead. - - // limitations: does not support printing error as Go struct. - - var ( - sep = " " // separator before next error - p = &state{State: s} - direct = true - ) - - var err error = f - - switch verb { - // Note that this switch must match the preference order - // for ordinary string printing (%#v before %+v, and so on). - - case 'v': - if s.Flag('#') { - if stringer, ok := err.(fmt.GoStringer); ok { - io.WriteString(&p.buf, stringer.GoString()) - goto exit - } - // proceed as if it were %v - } else if s.Flag('+') { - p.printDetail = true - sep = "\n - " - } - case 's': - case 'q', 'x', 'X': - // Use an intermediate buffer in the rare cases that precision, - // truncation, or one of the alternative verbs (q, x, and X) are - // specified. - direct = false - - default: - p.buf.WriteString("%!") - p.buf.WriteRune(verb) - p.buf.WriteByte('(') - switch { - case err != nil: - p.buf.WriteString(reflect.TypeOf(f).String()) - default: - p.buf.WriteString("") - } - p.buf.WriteByte(')') - io.Copy(s, &p.buf) - return - } - -loop: - for { - switch v := err.(type) { - case Formatter: - err = v.FormatError((*printer)(p)) - case fmt.Formatter: - v.Format(p, 'v') - break loop - default: - io.WriteString(&p.buf, v.Error()) - break loop - } - if err == nil { - break - } - if p.needColon || !p.printDetail { - p.buf.WriteByte(':') - p.needColon = false - } - p.buf.WriteString(sep) - p.inDetail = false - p.needNewline = false - } - -exit: - width, okW := s.Width() - prec, okP := s.Precision() - - if !direct || (okW && width > 0) || okP { - // Construct format string from State s. - format := []byte{'%'} - if s.Flag('-') { - format = append(format, '-') - } - if s.Flag('+') { - format = append(format, '+') - } - if s.Flag(' ') { - format = append(format, ' ') - } - if okW { - format = strconv.AppendInt(format, int64(width), 10) - } - if okP { - format = append(format, '.') - format = strconv.AppendInt(format, int64(prec), 10) - } - format = append(format, string(verb)...) - fmt.Fprintf(s, string(format), p.buf.String()) - } else { - io.Copy(s, &p.buf) - } -} - -var detailSep = []byte("\n ") - -// state tracks error printing state. It implements fmt.State. -type state struct { - fmt.State - buf bytes.Buffer - - printDetail bool - inDetail bool - needColon bool - needNewline bool -} - -func (s *state) Write(b []byte) (n int, err error) { - if s.printDetail { - if len(b) == 0 { - return 0, nil - } - if s.inDetail && s.needColon { - s.needNewline = true - if b[0] == '\n' { - b = b[1:] - } - } - k := 0 - for i, c := range b { - if s.needNewline { - if s.inDetail && s.needColon { - s.buf.WriteByte(':') - s.needColon = false - } - s.buf.Write(detailSep) - s.needNewline = false - } - if c == '\n' { - s.buf.Write(b[k:i]) - k = i + 1 - s.needNewline = true - } - } - s.buf.Write(b[k:]) - if !s.inDetail { - s.needColon = true - } - } else if !s.inDetail { - s.buf.Write(b) - } - return len(b), nil -} - -// printer wraps a state to implement an xerrors.Printer. -type printer state - -func (s *printer) Print(args ...interface{}) { - if !s.inDetail || s.printDetail { - fmt.Fprint((*state)(s), args...) - } -} - -func (s *printer) Printf(format string, args ...interface{}) { - if !s.inDetail || s.printDetail { - fmt.Fprintf((*state)(s), format, args...) - } -} - -func (s *printer) Detail() bool { - s.inDetail = true - return s.printDetail -} diff --git a/vendor/golang.org/x/xerrors/codereview.cfg b/vendor/golang.org/x/xerrors/codereview.cfg deleted file mode 100644 index 3f8b14b64e83..000000000000 --- a/vendor/golang.org/x/xerrors/codereview.cfg +++ /dev/null @@ -1 +0,0 @@ -issuerepo: golang/go diff --git a/vendor/golang.org/x/xerrors/doc.go b/vendor/golang.org/x/xerrors/doc.go deleted file mode 100644 index eef99d9d54d7..000000000000 --- a/vendor/golang.org/x/xerrors/doc.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package xerrors implements functions to manipulate errors. -// -// This package is based on the Go 2 proposal for error values: -// https://golang.org/design/29934-error-values -// -// These functions were incorporated into the standard library's errors package -// in Go 1.13: -// - Is -// - As -// - Unwrap -// -// Also, Errorf's %w verb was incorporated into fmt.Errorf. -// -// Use this package to get equivalent behavior in all supported Go versions. -// -// No other features of this package were included in Go 1.13, and at present -// there are no plans to include any of them. -package xerrors // import "golang.org/x/xerrors" diff --git a/vendor/golang.org/x/xerrors/errors.go b/vendor/golang.org/x/xerrors/errors.go deleted file mode 100644 index e88d3772d861..000000000000 --- a/vendor/golang.org/x/xerrors/errors.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xerrors - -import "fmt" - -// errorString is a trivial implementation of error. -type errorString struct { - s string - frame Frame -} - -// New returns an error that formats as the given text. -// -// The returned error contains a Frame set to the caller's location and -// implements Formatter to show this information when printed with details. -func New(text string) error { - return &errorString{text, Caller(1)} -} - -func (e *errorString) Error() string { - return e.s -} - -func (e *errorString) Format(s fmt.State, v rune) { FormatError(e, s, v) } - -func (e *errorString) FormatError(p Printer) (next error) { - p.Print(e.s) - e.frame.Format(p) - return nil -} diff --git a/vendor/golang.org/x/xerrors/fmt.go b/vendor/golang.org/x/xerrors/fmt.go deleted file mode 100644 index 829862ddf6af..000000000000 --- a/vendor/golang.org/x/xerrors/fmt.go +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xerrors - -import ( - "fmt" - "strings" - "unicode" - "unicode/utf8" - - "golang.org/x/xerrors/internal" -) - -const percentBangString = "%!" - -// Errorf formats according to a format specifier and returns the string as a -// value that satisfies error. -// -// The returned error includes the file and line number of the caller when -// formatted with additional detail enabled. If the last argument is an error -// the returned error's Format method will return it if the format string ends -// with ": %s", ": %v", or ": %w". If the last argument is an error and the -// format string ends with ": %w", the returned error implements an Unwrap -// method returning it. -// -// If the format specifier includes a %w verb with an error operand in a -// position other than at the end, the returned error will still implement an -// Unwrap method returning the operand, but the error's Format method will not -// return the wrapped error. -// -// It is invalid to include more than one %w verb or to supply it with an -// operand that does not implement the error interface. The %w verb is otherwise -// a synonym for %v. -func Errorf(format string, a ...interface{}) error { - format = formatPlusW(format) - // Support a ": %[wsv]" suffix, which works well with xerrors.Formatter. - wrap := strings.HasSuffix(format, ": %w") - idx, format2, ok := parsePercentW(format) - percentWElsewhere := !wrap && idx >= 0 - if !percentWElsewhere && (wrap || strings.HasSuffix(format, ": %s") || strings.HasSuffix(format, ": %v")) { - err := errorAt(a, len(a)-1) - if err == nil { - return &noWrapError{fmt.Sprintf(format, a...), nil, Caller(1)} - } - // TODO: this is not entirely correct. The error value could be - // printed elsewhere in format if it mixes numbered with unnumbered - // substitutions. With relatively small changes to doPrintf we can - // have it optionally ignore extra arguments and pass the argument - // list in its entirety. - msg := fmt.Sprintf(format[:len(format)-len(": %s")], a[:len(a)-1]...) - frame := Frame{} - if internal.EnableTrace { - frame = Caller(1) - } - if wrap { - return &wrapError{msg, err, frame} - } - return &noWrapError{msg, err, frame} - } - // Support %w anywhere. - // TODO: don't repeat the wrapped error's message when %w occurs in the middle. - msg := fmt.Sprintf(format2, a...) - if idx < 0 { - return &noWrapError{msg, nil, Caller(1)} - } - err := errorAt(a, idx) - if !ok || err == nil { - // Too many %ws or argument of %w is not an error. Approximate the Go - // 1.13 fmt.Errorf message. - return &noWrapError{fmt.Sprintf("%sw(%s)", percentBangString, msg), nil, Caller(1)} - } - frame := Frame{} - if internal.EnableTrace { - frame = Caller(1) - } - return &wrapError{msg, err, frame} -} - -func errorAt(args []interface{}, i int) error { - if i < 0 || i >= len(args) { - return nil - } - err, ok := args[i].(error) - if !ok { - return nil - } - return err -} - -// formatPlusW is used to avoid the vet check that will barf at %w. -func formatPlusW(s string) string { - return s -} - -// Return the index of the only %w in format, or -1 if none. -// Also return a rewritten format string with %w replaced by %v, and -// false if there is more than one %w. -// TODO: handle "%[N]w". -func parsePercentW(format string) (idx int, newFormat string, ok bool) { - // Loosely copied from golang.org/x/tools/go/analysis/passes/printf/printf.go. - idx = -1 - ok = true - n := 0 - sz := 0 - var isW bool - for i := 0; i < len(format); i += sz { - if format[i] != '%' { - sz = 1 - continue - } - // "%%" is not a format directive. - if i+1 < len(format) && format[i+1] == '%' { - sz = 2 - continue - } - sz, isW = parsePrintfVerb(format[i:]) - if isW { - if idx >= 0 { - ok = false - } else { - idx = n - } - // "Replace" the last character, the 'w', with a 'v'. - p := i + sz - 1 - format = format[:p] + "v" + format[p+1:] - } - n++ - } - return idx, format, ok -} - -// Parse the printf verb starting with a % at s[0]. -// Return how many bytes it occupies and whether the verb is 'w'. -func parsePrintfVerb(s string) (int, bool) { - // Assume only that the directive is a sequence of non-letters followed by a single letter. - sz := 0 - var r rune - for i := 1; i < len(s); i += sz { - r, sz = utf8.DecodeRuneInString(s[i:]) - if unicode.IsLetter(r) { - return i + sz, r == 'w' - } - } - return len(s), false -} - -type noWrapError struct { - msg string - err error - frame Frame -} - -func (e *noWrapError) Error() string { - return fmt.Sprint(e) -} - -func (e *noWrapError) Format(s fmt.State, v rune) { FormatError(e, s, v) } - -func (e *noWrapError) FormatError(p Printer) (next error) { - p.Print(e.msg) - e.frame.Format(p) - return e.err -} - -type wrapError struct { - msg string - err error - frame Frame -} - -func (e *wrapError) Error() string { - return fmt.Sprint(e) -} - -func (e *wrapError) Format(s fmt.State, v rune) { FormatError(e, s, v) } - -func (e *wrapError) FormatError(p Printer) (next error) { - p.Print(e.msg) - e.frame.Format(p) - return e.err -} - -func (e *wrapError) Unwrap() error { - return e.err -} diff --git a/vendor/golang.org/x/xerrors/format.go b/vendor/golang.org/x/xerrors/format.go deleted file mode 100644 index 1bc9c26b97fd..000000000000 --- a/vendor/golang.org/x/xerrors/format.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xerrors - -// A Formatter formats error messages. -type Formatter interface { - error - - // FormatError prints the receiver's first error and returns the next error in - // the error chain, if any. - FormatError(p Printer) (next error) -} - -// A Printer formats error messages. -// -// The most common implementation of Printer is the one provided by package fmt -// during Printf (as of Go 1.13). Localization packages such as golang.org/x/text/message -// typically provide their own implementations. -type Printer interface { - // Print appends args to the message output. - Print(args ...interface{}) - - // Printf writes a formatted string. - Printf(format string, args ...interface{}) - - // Detail reports whether error detail is requested. - // After the first call to Detail, all text written to the Printer - // is formatted as additional detail, or ignored when - // detail has not been requested. - // If Detail returns false, the caller can avoid printing the detail at all. - Detail() bool -} diff --git a/vendor/golang.org/x/xerrors/frame.go b/vendor/golang.org/x/xerrors/frame.go deleted file mode 100644 index 0de628ec501f..000000000000 --- a/vendor/golang.org/x/xerrors/frame.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xerrors - -import ( - "runtime" -) - -// A Frame contains part of a call stack. -type Frame struct { - // Make room for three PCs: the one we were asked for, what it called, - // and possibly a PC for skipPleaseUseCallersFrames. See: - // https://go.googlesource.com/go/+/032678e0fb/src/runtime/extern.go#169 - frames [3]uintptr -} - -// Caller returns a Frame that describes a frame on the caller's stack. -// The argument skip is the number of frames to skip over. -// Caller(0) returns the frame for the caller of Caller. -func Caller(skip int) Frame { - var s Frame - runtime.Callers(skip+1, s.frames[:]) - return s -} - -// location reports the file, line, and function of a frame. -// -// The returned function may be "" even if file and line are not. -func (f Frame) location() (function, file string, line int) { - frames := runtime.CallersFrames(f.frames[:]) - if _, ok := frames.Next(); !ok { - return "", "", 0 - } - fr, ok := frames.Next() - if !ok { - return "", "", 0 - } - return fr.Function, fr.File, fr.Line -} - -// Format prints the stack as error detail. -// It should be called from an error's Format implementation -// after printing any other error detail. -func (f Frame) Format(p Printer) { - if p.Detail() { - function, file, line := f.location() - if function != "" { - p.Printf("%s\n ", function) - } - if file != "" { - p.Printf("%s:%d\n", file, line) - } - } -} diff --git a/vendor/golang.org/x/xerrors/internal/internal.go b/vendor/golang.org/x/xerrors/internal/internal.go deleted file mode 100644 index 89f4eca5df7b..000000000000 --- a/vendor/golang.org/x/xerrors/internal/internal.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package internal - -// EnableTrace indicates whether stack information should be recorded in errors. -var EnableTrace = true diff --git a/vendor/golang.org/x/xerrors/wrap.go b/vendor/golang.org/x/xerrors/wrap.go deleted file mode 100644 index 9a3b510374ec..000000000000 --- a/vendor/golang.org/x/xerrors/wrap.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package xerrors - -import ( - "reflect" -) - -// A Wrapper provides context around another error. -type Wrapper interface { - // Unwrap returns the next error in the error chain. - // If there is no next error, Unwrap returns nil. - Unwrap() error -} - -// Opaque returns an error with the same error formatting as err -// but that does not match err and cannot be unwrapped. -func Opaque(err error) error { - return noWrapper{err} -} - -type noWrapper struct { - error -} - -func (e noWrapper) FormatError(p Printer) (next error) { - if f, ok := e.error.(Formatter); ok { - return f.FormatError(p) - } - p.Print(e.error) - return nil -} - -// Unwrap returns the result of calling the Unwrap method on err, if err implements -// Unwrap. Otherwise, Unwrap returns nil. -func Unwrap(err error) error { - u, ok := err.(Wrapper) - if !ok { - return nil - } - return u.Unwrap() -} - -// Is reports whether any error in err's chain matches target. -// -// An error is considered to match a target if it is equal to that target or if -// it implements a method Is(error) bool such that Is(target) returns true. -func Is(err, target error) bool { - if target == nil { - return err == target - } - - isComparable := reflect.TypeOf(target).Comparable() - for { - if isComparable && err == target { - return true - } - if x, ok := err.(interface{ Is(error) bool }); ok && x.Is(target) { - return true - } - // TODO: consider supporing target.Is(err). This would allow - // user-definable predicates, but also may allow for coping with sloppy - // APIs, thereby making it easier to get away with them. - if err = Unwrap(err); err == nil { - return false - } - } -} - -// As finds the first error in err's chain that matches the type to which target -// points, and if so, sets the target to its value and returns true. An error -// matches a type if it is assignable to the target type, or if it has a method -// As(interface{}) bool such that As(target) returns true. As will panic if target -// is not a non-nil pointer to a type which implements error or is of interface type. -// -// The As method should set the target to its value and return true if err -// matches the type to which target points. -func As(err error, target interface{}) bool { - if target == nil { - panic("errors: target cannot be nil") - } - val := reflect.ValueOf(target) - typ := val.Type() - if typ.Kind() != reflect.Ptr || val.IsNil() { - panic("errors: target must be a non-nil pointer") - } - if e := typ.Elem(); e.Kind() != reflect.Interface && !e.Implements(errorType) { - panic("errors: *target must be interface or implement error") - } - targetType := typ.Elem() - for err != nil { - if reflect.TypeOf(err).AssignableTo(targetType) { - val.Elem().Set(reflect.ValueOf(err)) - return true - } - if x, ok := err.(interface{ As(interface{}) bool }); ok && x.As(target) { - return true - } - err = Unwrap(err) - } - return false -} - -var errorType = reflect.TypeOf((*error)(nil)).Elem() diff --git a/vendor/google.golang.org/grpc/attributes/attributes.go b/vendor/google.golang.org/grpc/attributes/attributes.go index ae13ddac14e0..02f5dc531891 100644 --- a/vendor/google.golang.org/grpc/attributes/attributes.go +++ b/vendor/google.golang.org/grpc/attributes/attributes.go @@ -19,7 +19,7 @@ // Package attributes defines a generic key/value store used in various gRPC // components. // -// Experimental +// # Experimental // // Notice: This package is EXPERIMENTAL and may be changed or removed in a // later release. diff --git a/vendor/google.golang.org/grpc/backoff.go b/vendor/google.golang.org/grpc/backoff.go index 542594f5cc51..29475e31c979 100644 --- a/vendor/google.golang.org/grpc/backoff.go +++ b/vendor/google.golang.org/grpc/backoff.go @@ -48,7 +48,7 @@ type BackoffConfig struct { // here for more details: // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. diff --git a/vendor/google.golang.org/grpc/balancer/balancer.go b/vendor/google.golang.org/grpc/balancer/balancer.go index f4f9408f3852..392b21fb2d8e 100644 --- a/vendor/google.golang.org/grpc/balancer/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/balancer.go @@ -110,6 +110,11 @@ type SubConn interface { UpdateAddresses([]resolver.Address) // Connect starts the connecting for this SubConn. Connect() + // GetOrBuildProducer returns a reference to the existing Producer for this + // ProducerBuilder in this SubConn, or, if one does not currently exist, + // creates a new one and returns it. Returns a close function which must + // be called when the Producer is no longer needed. + GetOrBuildProducer(ProducerBuilder) (p Producer, close func()) } // NewSubConnOptions contains options to create new SubConn. @@ -371,3 +376,21 @@ type ClientConnState struct { // ErrBadResolverState may be returned by UpdateClientConnState to indicate a // problem with the provided name resolver data. var ErrBadResolverState = errors.New("bad resolver state") + +// A ProducerBuilder is a simple constructor for a Producer. It is used by the +// SubConn to create producers when needed. +type ProducerBuilder interface { + // Build creates a Producer. The first parameter is always a + // grpc.ClientConnInterface (a type to allow creating RPCs/streams on the + // associated SubConn), but is declared as interface{} to avoid a + // dependency cycle. Should also return a close function that will be + // called when all references to the Producer have been given up. + Build(grpcClientConnInterface interface{}) (p Producer, close func()) +} + +// A Producer is a type shared among potentially many consumers. It is +// associated with a SubConn, and an implementation will typically contain +// other methods to provide additional functionality, e.g. configuration or +// subscription registration. +type Producer interface { +} diff --git a/vendor/google.golang.org/grpc/balancer/base/balancer.go b/vendor/google.golang.org/grpc/balancer/base/balancer.go index e8dfc828aaac..3929c26d31e1 100644 --- a/vendor/google.golang.org/grpc/balancer/base/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/base/balancer.go @@ -157,8 +157,8 @@ func (b *baseBalancer) mergeErrors() error { // regeneratePicker takes a snapshot of the balancer, and generates a picker // from it. The picker is -// - errPicker if the balancer is in TransientFailure, -// - built by the pickerBuilder with all READY SubConns otherwise. +// - errPicker if the balancer is in TransientFailure, +// - built by the pickerBuilder with all READY SubConns otherwise. func (b *baseBalancer) regeneratePicker() { if b.state == connectivity.TransientFailure { b.picker = NewErrPicker(b.mergeErrors()) diff --git a/vendor/google.golang.org/grpc/balancer/conn_state_evaluator.go b/vendor/google.golang.org/grpc/balancer/conn_state_evaluator.go index a87b6809af38..c33413581091 100644 --- a/vendor/google.golang.org/grpc/balancer/conn_state_evaluator.go +++ b/vendor/google.golang.org/grpc/balancer/conn_state_evaluator.go @@ -34,10 +34,10 @@ type ConnectivityStateEvaluator struct { // RecordTransition records state change happening in subConn and based on that // it evaluates what aggregated state should be. // -// - If at least one SubConn in Ready, the aggregated state is Ready; -// - Else if at least one SubConn in Connecting, the aggregated state is Connecting; -// - Else if at least one SubConn is Idle, the aggregated state is Idle; -// - Else if at least one SubConn is TransientFailure (or there are no SubConns), the aggregated state is Transient Failure. +// - If at least one SubConn in Ready, the aggregated state is Ready; +// - Else if at least one SubConn in Connecting, the aggregated state is Connecting; +// - Else if at least one SubConn is Idle, the aggregated state is Idle; +// - Else if at least one SubConn is TransientFailure (or there are no SubConns), the aggregated state is Transient Failure. // // Shutdown is not considered. func (cse *ConnectivityStateEvaluator) RecordTransition(oldState, newState connectivity.State) connectivity.State { @@ -55,7 +55,11 @@ func (cse *ConnectivityStateEvaluator) RecordTransition(oldState, newState conne cse.numIdle += updateVal } } + return cse.CurrentState() +} +// CurrentState returns the current aggregate conn state by evaluating the counters +func (cse *ConnectivityStateEvaluator) CurrentState() connectivity.State { // Evaluate. if cse.numReady > 0 { return connectivity.Ready diff --git a/vendor/google.golang.org/grpc/balancer_conn_wrappers.go b/vendor/google.golang.org/grpc/balancer_conn_wrappers.go index b1c23eaae0db..0359956d36fa 100644 --- a/vendor/google.golang.org/grpc/balancer_conn_wrappers.go +++ b/vendor/google.golang.org/grpc/balancer_conn_wrappers.go @@ -19,17 +19,20 @@ package grpc import ( + "context" "fmt" "strings" "sync" "google.golang.org/grpc/balancer" + "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/internal/balancer/gracefulswitch" "google.golang.org/grpc/internal/buffer" "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/resolver" + "google.golang.org/grpc/status" ) // ccBalancerWrapper sits between the ClientConn and the Balancer. @@ -305,7 +308,7 @@ func (ccb *ccBalancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer channelz.Warningf(logger, ccb.cc.channelzID, "acBalancerWrapper: NewSubConn: failed to newAddrConn: %v", err) return nil, err } - acbw := &acBalancerWrapper{ac: ac} + acbw := &acBalancerWrapper{ac: ac, producers: make(map[balancer.ProducerBuilder]*refCountedProducer)} acbw.ac.mu.Lock() ac.acbw = acbw acbw.ac.mu.Unlock() @@ -359,8 +362,9 @@ func (ccb *ccBalancerWrapper) Target() string { // acBalancerWrapper is a wrapper on top of ac for balancers. // It implements balancer.SubConn interface. type acBalancerWrapper struct { - mu sync.Mutex - ac *addrConn + mu sync.Mutex + ac *addrConn + producers map[balancer.ProducerBuilder]*refCountedProducer } func (acbw *acBalancerWrapper) UpdateAddresses(addrs []resolver.Address) { @@ -414,3 +418,64 @@ func (acbw *acBalancerWrapper) getAddrConn() *addrConn { defer acbw.mu.Unlock() return acbw.ac } + +var errSubConnNotReady = status.Error(codes.Unavailable, "SubConn not currently connected") + +// NewStream begins a streaming RPC on the addrConn. If the addrConn is not +// ready, returns errSubConnNotReady. +func (acbw *acBalancerWrapper) NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error) { + transport := acbw.ac.getReadyTransport() + if transport == nil { + return nil, errSubConnNotReady + } + return newNonRetryClientStream(ctx, desc, method, transport, acbw.ac, opts...) +} + +// Invoke performs a unary RPC. If the addrConn is not ready, returns +// errSubConnNotReady. +func (acbw *acBalancerWrapper) Invoke(ctx context.Context, method string, args interface{}, reply interface{}, opts ...CallOption) error { + cs, err := acbw.NewStream(ctx, unaryStreamDesc, method, opts...) + if err != nil { + return err + } + if err := cs.SendMsg(args); err != nil { + return err + } + return cs.RecvMsg(reply) +} + +type refCountedProducer struct { + producer balancer.Producer + refs int // number of current refs to the producer + close func() // underlying producer's close function +} + +func (acbw *acBalancerWrapper) GetOrBuildProducer(pb balancer.ProducerBuilder) (balancer.Producer, func()) { + acbw.mu.Lock() + defer acbw.mu.Unlock() + + // Look up existing producer from this builder. + pData := acbw.producers[pb] + if pData == nil { + // Not found; create a new one and add it to the producers map. + p, close := pb.Build(acbw) + pData = &refCountedProducer{producer: p, close: close} + acbw.producers[pb] = pData + } + // Account for this new reference. + pData.refs++ + + // Return a cleanup function wrapped in a OnceFunc to remove this reference + // and delete the refCountedProducer from the map if the total reference + // count goes to zero. + unref := func() { + acbw.mu.Lock() + pData.refs-- + if pData.refs == 0 { + defer pData.close() // Run outside the acbw mutex + delete(acbw.producers, pb) + } + acbw.mu.Unlock() + } + return pData.producer, grpcsync.OnceFunc(unref) +} diff --git a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go index ed75290cdf34..64a232f28111 100644 --- a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go +++ b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go @@ -261,6 +261,7 @@ type GrpcLogEntry struct { // according to the type of the log entry. // // Types that are assignable to Payload: + // // *GrpcLogEntry_ClientHeader // *GrpcLogEntry_ServerHeader // *GrpcLogEntry_Message @@ -694,12 +695,12 @@ func (x *Message) GetData() []byte { // Header keys added by gRPC are omitted. To be more specific, // implementations will not log the following entries, and this is // not to be treated as a truncation: -// - entries handled by grpc that are not user visible, such as those -// that begin with 'grpc-' (with exception of grpc-trace-bin) -// or keys like 'lb-token' -// - transport specific entries, including but not limited to: -// ':path', ':authority', 'content-encoding', 'user-agent', 'te', etc -// - entries added for call credentials +// - entries handled by grpc that are not user visible, such as those +// that begin with 'grpc-' (with exception of grpc-trace-bin) +// or keys like 'lb-token' +// - transport specific entries, including but not limited to: +// ':path', ':authority', 'content-encoding', 'user-agent', 'te', etc +// - entries added for call credentials // // Implementations must always log grpc-trace-bin if it is present. // Practically speaking it will only be visible on server side because diff --git a/vendor/google.golang.org/grpc/channelz/channelz.go b/vendor/google.golang.org/grpc/channelz/channelz.go index a220c47c59a5..32b7fa5794e1 100644 --- a/vendor/google.golang.org/grpc/channelz/channelz.go +++ b/vendor/google.golang.org/grpc/channelz/channelz.go @@ -23,7 +23,7 @@ // https://github.com/grpc/proposal/blob/master/A14-channelz.md, is provided by // the `internal/channelz` package. // -// Experimental +// # Experimental // // Notice: All APIs in this package are experimental and may be removed in a // later release. diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go index 779b03bca1c3..422639c79dbf 100644 --- a/vendor/google.golang.org/grpc/clientconn.go +++ b/vendor/google.golang.org/grpc/clientconn.go @@ -503,7 +503,7 @@ type ClientConn struct { // WaitForStateChange waits until the connectivity.State of ClientConn changes from sourceState or // ctx expires. A true value is returned in former case and false in latter. // -// Experimental +// # Experimental // // Notice: This API is EXPERIMENTAL and may be changed or removed in a // later release. @@ -522,7 +522,7 @@ func (cc *ClientConn) WaitForStateChange(ctx context.Context, sourceState connec // GetState returns the connectivity.State of ClientConn. // -// Experimental +// # Experimental // // Notice: This API is EXPERIMENTAL and may be changed or removed in a later // release. @@ -534,7 +534,7 @@ func (cc *ClientConn) GetState() connectivity.State { // the channel is idle. Does not wait for the connection attempts to begin // before returning. // -// Experimental +// # Experimental // // Notice: This API is EXPERIMENTAL and may be changed or removed in a later // release. @@ -761,7 +761,7 @@ func (cc *ClientConn) channelzMetric() *channelz.ChannelInternalMetric { // Target returns the target string of the ClientConn. // -// Experimental +// # Experimental // // Notice: This API is EXPERIMENTAL and may be changed or removed in a // later release. @@ -831,9 +831,9 @@ func equalAddresses(a, b []resolver.Address) bool { // // If ac is Ready, it checks whether current connected address of ac is in the // new addrs list. -// - If true, it updates ac.addrs and returns true. The ac will keep using -// the existing connection. -// - If false, it does nothing and returns false. +// - If true, it updates ac.addrs and returns true. The ac will keep using +// the existing connection. +// - If false, it does nothing and returns false. func (ac *addrConn) tryUpdateAddrs(addrs []resolver.Address) bool { ac.mu.Lock() defer ac.mu.Unlock() @@ -998,7 +998,7 @@ func (cc *ClientConn) resolveNow(o resolver.ResolveNowOptions) { // However, if a previously unavailable network becomes available, this may be // used to trigger an immediate reconnect. // -// Experimental +// # Experimental // // Notice: This API is EXPERIMENTAL and may be changed or removed in a // later release. @@ -1228,38 +1228,33 @@ func (ac *addrConn) tryAllAddrs(addrs []resolver.Address, connectDeadline time.T // address was not successfully connected, or updates ac appropriately with the // new transport. func (ac *addrConn) createTransport(addr resolver.Address, copts transport.ConnectOptions, connectDeadline time.Time) error { - // TODO: Delete prefaceReceived and move the logic to wait for it into the - // transport. - prefaceReceived := grpcsync.NewEvent() - connClosed := grpcsync.NewEvent() - addr.ServerName = ac.cc.getServerName(addr) hctx, hcancel := context.WithCancel(ac.ctx) - hcStarted := false // protected by ac.mu - onClose := func() { + onClose := grpcsync.OnceFunc(func() { ac.mu.Lock() defer ac.mu.Unlock() - defer connClosed.Fire() - defer hcancel() - if !hcStarted || hctx.Err() != nil { - // We didn't start the health check or set the state to READY, so - // no need to do anything else here. - // - // OR, we have already cancelled the health check context, meaning - // we have already called onClose once for this transport. In this - // case it would be dangerous to clear the transport and update the - // state, since there may be a new transport in this addrConn. + if ac.state == connectivity.Shutdown { + // Already shut down. tearDown() already cleared the transport and + // canceled hctx via ac.ctx, and we expected this connection to be + // closed, so do nothing here. + return + } + hcancel() + if ac.transport == nil { + // We're still connecting to this address, which could error. Do + // not update the connectivity state or resolve; these will happen + // at the end of the tryAllAddrs connection loop in the event of an + // error. return } ac.transport = nil - // Refresh the name resolver + // Refresh the name resolver on any connection loss. ac.cc.resolveNow(resolver.ResolveNowOptions{}) - if ac.state != connectivity.Shutdown { - ac.updateConnectivityState(connectivity.Idle, nil) - } - } - + // Always go idle and wait for the LB policy to initiate a new + // connection attempt. + ac.updateConnectivityState(connectivity.Idle, nil) + }) onGoAway := func(r transport.GoAwayReason) { ac.mu.Lock() ac.adjustParams(r) @@ -1271,7 +1266,7 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne defer cancel() copts.ChannelzParentID = ac.channelzID - newTr, err := transport.NewClientTransport(connectCtx, ac.cc.ctx, addr, copts, func() { prefaceReceived.Fire() }, onGoAway, onClose) + newTr, err := transport.NewClientTransport(connectCtx, ac.cc.ctx, addr, copts, onGoAway, onClose) if err != nil { // newTr is either nil, or closed. hcancel() @@ -1279,60 +1274,34 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne return err } - select { - case <-connectCtx.Done(): - // We didn't get the preface in time. + ac.mu.Lock() + defer ac.mu.Unlock() + if ac.state == connectivity.Shutdown { + // This can happen if the subConn was removed while in `Connecting` + // state. tearDown() would have set the state to `Shutdown`, but + // would not have closed the transport since ac.transport would not + // have been set at that point. + // + // We run this in a goroutine because newTr.Close() calls onClose() + // inline, which requires locking ac.mu. + // // The error we pass to Close() is immaterial since there are no open // streams at this point, so no trailers with error details will be sent // out. We just need to pass a non-nil error. - newTr.Close(transport.ErrConnClosing) - if connectCtx.Err() == context.DeadlineExceeded { - err := errors.New("failed to receive server preface within timeout") - channelz.Warningf(logger, ac.channelzID, "grpc: addrConn.createTransport failed to connect to %s: %v", addr, err) - return err - } + go newTr.Close(transport.ErrConnClosing) return nil - case <-prefaceReceived.Done(): - // We got the preface - huzzah! things are good. - ac.mu.Lock() - defer ac.mu.Unlock() - if connClosed.HasFired() { - // onClose called first; go idle but do nothing else. - if ac.state != connectivity.Shutdown { - ac.updateConnectivityState(connectivity.Idle, nil) - } - return nil - } - if ac.state == connectivity.Shutdown { - // This can happen if the subConn was removed while in `Connecting` - // state. tearDown() would have set the state to `Shutdown`, but - // would not have closed the transport since ac.transport would not - // been set at that point. - // - // We run this in a goroutine because newTr.Close() calls onClose() - // inline, which requires locking ac.mu. - // - // The error we pass to Close() is immaterial since there are no open - // streams at this point, so no trailers with error details will be sent - // out. We just need to pass a non-nil error. - go newTr.Close(transport.ErrConnClosing) - return nil - } - ac.curAddr = addr - ac.transport = newTr - hcStarted = true - ac.startHealthCheck(hctx) // Will set state to READY if appropriate. + } + if hctx.Err() != nil { + // onClose was already called for this connection, but the connection + // was successfully established first. Consider it a success and set + // the new state to Idle. + ac.updateConnectivityState(connectivity.Idle, nil) return nil - case <-connClosed.Done(): - // The transport has already closed. If we received the preface, too, - // this is not an error. - select { - case <-prefaceReceived.Done(): - return nil - default: - return errors.New("connection closed before server preface received") - } } + ac.curAddr = addr + ac.transport = newTr + ac.startHealthCheck(hctx) // Will set state to READY if appropriate. + return nil } // startHealthCheck starts the health checking stream (RPC) to watch the health @@ -1583,7 +1552,7 @@ func (cc *ClientConn) parseTargetAndFindResolver() (resolver.Builder, error) { channelz.Infof(logger, cc.channelzID, "dial target %q parse failed: %v", cc.target, err) } else { channelz.Infof(logger, cc.channelzID, "parsed dial target is: %+v", parsedTarget) - rb = cc.getResolver(parsedTarget.Scheme) + rb = cc.getResolver(parsedTarget.URL.Scheme) if rb != nil { cc.parsedTarget = parsedTarget return rb, nil @@ -1604,9 +1573,9 @@ func (cc *ClientConn) parseTargetAndFindResolver() (resolver.Builder, error) { return nil, err } channelz.Infof(logger, cc.channelzID, "parsed dial target is: %+v", parsedTarget) - rb = cc.getResolver(parsedTarget.Scheme) + rb = cc.getResolver(parsedTarget.URL.Scheme) if rb == nil { - return nil, fmt.Errorf("could not get resolver for default scheme: %q", parsedTarget.Scheme) + return nil, fmt.Errorf("could not get resolver for default scheme: %q", parsedTarget.URL.Scheme) } cc.parsedTarget = parsedTarget return rb, nil diff --git a/vendor/google.golang.org/grpc/credentials/credentials.go b/vendor/google.golang.org/grpc/credentials/credentials.go index 96ff1877e754..5feac3aa0e41 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials.go +++ b/vendor/google.golang.org/grpc/credentials/credentials.go @@ -36,16 +36,16 @@ import ( // PerRPCCredentials defines the common interface for the credentials which need to // attach security information to every RPC (e.g., oauth2). type PerRPCCredentials interface { - // GetRequestMetadata gets the current request metadata, refreshing - // tokens if required. This should be called by the transport layer on - // each request, and the data should be populated in headers or other - // context. If a status code is returned, it will be used as the status - // for the RPC. uri is the URI of the entry point for the request. - // When supported by the underlying implementation, ctx can be used for - // timeout and cancellation. Additionally, RequestInfo data will be - // available via ctx to this call. - // TODO(zhaoq): Define the set of the qualified keys instead of leaving - // it as an arbitrary string. + // GetRequestMetadata gets the current request metadata, refreshing tokens + // if required. This should be called by the transport layer on each + // request, and the data should be populated in headers or other + // context. If a status code is returned, it will be used as the status for + // the RPC (restricted to an allowable set of codes as defined by gRFC + // A54). uri is the URI of the entry point for the request. When supported + // by the underlying implementation, ctx can be used for timeout and + // cancellation. Additionally, RequestInfo data will be available via ctx + // to this call. TODO(zhaoq): Define the set of the qualified keys instead + // of leaving it as an arbitrary string. GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) // RequireTransportSecurity indicates whether the credentials requires // transport security. diff --git a/vendor/google.golang.org/grpc/credentials/tls.go b/vendor/google.golang.org/grpc/credentials/tls.go index 784822d0560a..ce2bbc10a142 100644 --- a/vendor/google.golang.org/grpc/credentials/tls.go +++ b/vendor/google.golang.org/grpc/credentials/tls.go @@ -195,7 +195,7 @@ func NewServerTLSFromFile(certFile, keyFile string) (TransportCredentials, error // TLSChannelzSecurityValue defines the struct that TLS protocol should return // from GetSecurityValue(), containing security info like cipher and certificate used. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. diff --git a/vendor/google.golang.org/grpc/encoding/encoding.go b/vendor/google.golang.org/grpc/encoding/encoding.go index 18e530fc9024..711763d54fb7 100644 --- a/vendor/google.golang.org/grpc/encoding/encoding.go +++ b/vendor/google.golang.org/grpc/encoding/encoding.go @@ -19,7 +19,7 @@ // Package encoding defines the interface for the compressor and codec, and // functions to register and retrieve compressors and codecs. // -// Experimental +// # Experimental // // Notice: This package is EXPERIMENTAL and may be changed or removed in a // later release. @@ -28,6 +28,8 @@ package encoding import ( "io" "strings" + + "google.golang.org/grpc/internal/grpcutil" ) // Identity specifies the optional encoding for uncompressed streams. @@ -73,6 +75,7 @@ var registeredCompressor = make(map[string]Compressor) // registered with the same name, the one registered last will take effect. func RegisterCompressor(c Compressor) { registeredCompressor[c.Name()] = c + grpcutil.RegisteredCompressorNames = append(grpcutil.RegisteredCompressorNames, c.Name()) } // GetCompressor returns Compressor for the given compressor name. diff --git a/vendor/google.golang.org/grpc/grpclog/loggerv2.go b/vendor/google.golang.org/grpc/grpclog/loggerv2.go index 7c1f66409034..b5560b47ec4b 100644 --- a/vendor/google.golang.org/grpc/grpclog/loggerv2.go +++ b/vendor/google.golang.org/grpc/grpclog/loggerv2.go @@ -242,7 +242,7 @@ func (g *loggerT) V(l int) bool { // DepthLoggerV2, the below functions will be called with the appropriate stack // depth set for trivial functions the logger may ignore. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. diff --git a/vendor/google.golang.org/grpc/internal/binarylog/env_config.go b/vendor/google.golang.org/grpc/internal/binarylog/env_config.go index c5579e65065f..f9e80e27ab68 100644 --- a/vendor/google.golang.org/grpc/internal/binarylog/env_config.go +++ b/vendor/google.golang.org/grpc/internal/binarylog/env_config.go @@ -30,15 +30,15 @@ import ( // to build a new logger and assign it to binarylog.Logger. // // Example filter config strings: -// - "" Nothing will be logged -// - "*" All headers and messages will be fully logged. -// - "*{h}" Only headers will be logged. -// - "*{m:256}" Only the first 256 bytes of each message will be logged. -// - "Foo/*" Logs every method in service Foo -// - "Foo/*,-Foo/Bar" Logs every method in service Foo except method /Foo/Bar -// - "Foo/*,Foo/Bar{m:256}" Logs the first 256 bytes of each message in method -// /Foo/Bar, logs all headers and messages in every other method in service -// Foo. +// - "" Nothing will be logged +// - "*" All headers and messages will be fully logged. +// - "*{h}" Only headers will be logged. +// - "*{m:256}" Only the first 256 bytes of each message will be logged. +// - "Foo/*" Logs every method in service Foo +// - "Foo/*,-Foo/Bar" Logs every method in service Foo except method /Foo/Bar +// - "Foo/*,Foo/Bar{m:256}" Logs the first 256 bytes of each message in method +// /Foo/Bar, logs all headers and messages in every other method in service +// Foo. // // If two configs exist for one certain method or service, the one specified // later overrides the previous config. diff --git a/vendor/google.golang.org/grpc/internal/channelz/types.go b/vendor/google.golang.org/grpc/internal/channelz/types.go index ad0ce4dabf06..7b2f350e2e64 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/types.go +++ b/vendor/google.golang.org/grpc/internal/channelz/types.go @@ -273,10 +273,10 @@ func (c *channel) deleteSelfFromMap() (delete bool) { // deleteSelfIfReady tries to delete the channel itself from the channelz database. // The delete process includes two steps: -// 1. delete the channel from the entry relation tree, i.e. delete the channel reference from its -// parent's child list. -// 2. delete the channel from the map, i.e. delete the channel entirely from channelz. Lookup by id -// will return entry not found error. +// 1. delete the channel from the entry relation tree, i.e. delete the channel reference from its +// parent's child list. +// 2. delete the channel from the map, i.e. delete the channel entirely from channelz. Lookup by id +// will return entry not found error. func (c *channel) deleteSelfIfReady() { if !c.deleteSelfFromTree() { return @@ -381,10 +381,10 @@ func (sc *subChannel) deleteSelfFromMap() (delete bool) { // deleteSelfIfReady tries to delete the subchannel itself from the channelz database. // The delete process includes two steps: -// 1. delete the subchannel from the entry relation tree, i.e. delete the subchannel reference from -// its parent's child list. -// 2. delete the subchannel from the map, i.e. delete the subchannel entirely from channelz. Lookup -// by id will return entry not found error. +// 1. delete the subchannel from the entry relation tree, i.e. delete the subchannel reference from +// its parent's child list. +// 2. delete the subchannel from the map, i.e. delete the subchannel entirely from channelz. Lookup +// by id will return entry not found error. func (sc *subChannel) deleteSelfIfReady() { if !sc.deleteSelfFromTree() { return diff --git a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go index 6f0272543110..7edd196bd3da 100644 --- a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go +++ b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go @@ -25,11 +25,15 @@ import ( ) const ( - prefix = "GRPC_GO_" - txtErrIgnoreStr = prefix + "IGNORE_TXT_ERRORS" + prefix = "GRPC_GO_" + txtErrIgnoreStr = prefix + "IGNORE_TXT_ERRORS" + advertiseCompressorsStr = prefix + "ADVERTISE_COMPRESSORS" ) var ( // TXTErrIgnore is set if TXT errors should be ignored ("GRPC_GO_IGNORE_TXT_ERRORS" is not "false"). TXTErrIgnore = !strings.EqualFold(os.Getenv(txtErrIgnoreStr), "false") + // AdvertiseCompressors is set if registered compressor should be advertised + // ("GRPC_GO_ADVERTISE_COMPRESSORS" is not "false"). + AdvertiseCompressors = !strings.EqualFold(os.Getenv(advertiseCompressorsStr), "false") ) diff --git a/vendor/google.golang.org/grpc/internal/grpclog/grpclog.go b/vendor/google.golang.org/grpc/internal/grpclog/grpclog.go index 30a3b4258fc0..b68e26a36493 100644 --- a/vendor/google.golang.org/grpc/internal/grpclog/grpclog.go +++ b/vendor/google.golang.org/grpc/internal/grpclog/grpclog.go @@ -110,7 +110,7 @@ type LoggerV2 interface { // This is a copy of the DepthLoggerV2 defined in the external grpclog package. // It is defined here to avoid a circular dependency. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. diff --git a/vendor/google.golang.org/grpc/internal/grpcsync/oncefunc.go b/vendor/google.golang.org/grpc/internal/grpcsync/oncefunc.go new file mode 100644 index 000000000000..6635f7bca96d --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/grpcsync/oncefunc.go @@ -0,0 +1,32 @@ +/* + * + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package grpcsync + +import ( + "sync" +) + +// OnceFunc returns a function wrapping f which ensures f is only executed +// once even if the returned function is executed multiple times. +func OnceFunc(f func()) func() { + var once sync.Once + return func() { + once.Do(f) + } +} diff --git a/vendor/google.golang.org/grpc/internal/grpcutil/compressor.go b/vendor/google.golang.org/grpc/internal/grpcutil/compressor.go new file mode 100644 index 000000000000..9f4090967980 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/grpcutil/compressor.go @@ -0,0 +1,47 @@ +/* + * + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package grpcutil + +import ( + "strings" + + "google.golang.org/grpc/internal/envconfig" +) + +// RegisteredCompressorNames holds names of the registered compressors. +var RegisteredCompressorNames []string + +// IsCompressorNameRegistered returns true when name is available in registry. +func IsCompressorNameRegistered(name string) bool { + for _, compressor := range RegisteredCompressorNames { + if compressor == name { + return true + } + } + return false +} + +// RegisteredCompressors returns a string of registered compressor names +// separated by comma. +func RegisteredCompressors() string { + if !envconfig.AdvertiseCompressors { + return "" + } + return strings.Join(RegisteredCompressorNames, ",") +} diff --git a/vendor/google.golang.org/grpc/internal/grpcutil/method.go b/vendor/google.golang.org/grpc/internal/grpcutil/method.go index e9c4af64830c..ec62b4775e5b 100644 --- a/vendor/google.golang.org/grpc/internal/grpcutil/method.go +++ b/vendor/google.golang.org/grpc/internal/grpcutil/method.go @@ -25,7 +25,6 @@ import ( // ParseMethod splits service and method from the input. It expects format // "/service/method". -// func ParseMethod(methodName string) (service, method string, _ error) { if !strings.HasPrefix(methodName, "/") { return "", "", errors.New("invalid method name: should start with /") diff --git a/vendor/google.golang.org/grpc/internal/serviceconfig/serviceconfig.go b/vendor/google.golang.org/grpc/internal/serviceconfig/serviceconfig.go index badbdbf597f3..51e733e495a3 100644 --- a/vendor/google.golang.org/grpc/internal/serviceconfig/serviceconfig.go +++ b/vendor/google.golang.org/grpc/internal/serviceconfig/serviceconfig.go @@ -67,10 +67,10 @@ func (bc *BalancerConfig) MarshalJSON() ([]byte, error) { // ServiceConfig contains a list of loadBalancingConfigs, each with a name and // config. This method iterates through that list in order, and stops at the // first policy that is supported. -// - If the config for the first supported policy is invalid, the whole service -// config is invalid. -// - If the list doesn't contain any supported policy, the whole service config -// is invalid. +// - If the config for the first supported policy is invalid, the whole service +// config is invalid. +// - If the list doesn't contain any supported policy, the whole service config +// is invalid. func (bc *BalancerConfig) UnmarshalJSON(b []byte) error { var ir intermediateBalancerConfig err := json.Unmarshal(b, &ir) diff --git a/vendor/google.golang.org/grpc/internal/status/status.go b/vendor/google.golang.org/grpc/internal/status/status.go index e5c6513edd13..b0ead4f54f82 100644 --- a/vendor/google.golang.org/grpc/internal/status/status.go +++ b/vendor/google.golang.org/grpc/internal/status/status.go @@ -164,3 +164,13 @@ func (e *Error) Is(target error) bool { } return proto.Equal(e.s.s, tse.s.s) } + +// IsRestrictedControlPlaneCode returns whether the status includes a code +// restricted for control plane usage as defined by gRFC A54. +func IsRestrictedControlPlaneCode(s *Status) bool { + switch s.Code() { + case codes.InvalidArgument, codes.NotFound, codes.AlreadyExists, codes.FailedPrecondition, codes.Aborted, codes.OutOfRange, codes.DataLoss: + return true + } + return false +} diff --git a/vendor/google.golang.org/grpc/internal/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go index 090120925bb4..fb272235d817 100644 --- a/vendor/google.golang.org/grpc/internal/transport/handler_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/handler_server.go @@ -442,10 +442,10 @@ func (ht *serverHandlerTransport) Drain() { // mapRecvMsgError returns the non-nil err into the appropriate // error value as expected by callers of *grpc.parser.recvMsg. // In particular, in can only be: -// * io.EOF -// * io.ErrUnexpectedEOF -// * of type transport.ConnectionError -// * an error from the status package +// - io.EOF +// - io.ErrUnexpectedEOF +// - of type transport.ConnectionError +// - an error from the status package func mapRecvMsgError(err error) error { if err == io.EOF || err == io.ErrUnexpectedEOF { return err diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go index 5c2f35b24e75..d518b07e16f7 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go @@ -38,8 +38,10 @@ import ( "google.golang.org/grpc/credentials" "google.golang.org/grpc/internal/channelz" icredentials "google.golang.org/grpc/internal/credentials" + "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/internal/grpcutil" imetadata "google.golang.org/grpc/internal/metadata" + istatus "google.golang.org/grpc/internal/status" "google.golang.org/grpc/internal/syscall" "google.golang.org/grpc/internal/transport/networktype" "google.golang.org/grpc/keepalive" @@ -99,16 +101,13 @@ type http2Client struct { maxSendHeaderListSize *uint32 bdpEst *bdpEstimator - // onPrefaceReceipt is a callback that client transport calls upon - // receiving server preface to signal that a succefull HTTP2 - // connection was established. - onPrefaceReceipt func() maxConcurrentStreams uint32 streamQuota int64 streamsQuotaAvailable chan struct{} waitingStreams uint32 nextID uint32 + registeredCompressors string // Do not access controlBuf with mu held. mu sync.Mutex // guard the following variables @@ -194,7 +193,7 @@ func isTemporary(err error) bool { // newHTTP2Client constructs a connected ClientTransport to addr based on HTTP2 // and starts to receive messages on it. Non-nil error returns if construction // fails. -func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts ConnectOptions, onPrefaceReceipt func(), onGoAway func(GoAwayReason), onClose func()) (_ *http2Client, err error) { +func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts ConnectOptions, onGoAway func(GoAwayReason), onClose func()) (_ *http2Client, err error) { scheme := "http" ctx, cancel := context.WithCancel(ctx) defer func() { @@ -216,12 +215,35 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts } return nil, connectionErrorf(true, err, "transport: Error while dialing %v", err) } + // Any further errors will close the underlying connection defer func(conn net.Conn) { if err != nil { conn.Close() } }(conn) + + // The following defer and goroutine monitor the connectCtx for cancelation + // and deadline. On context expiration, the connection is hard closed and + // this function will naturally fail as a result. Otherwise, the defer + // waits for the goroutine to exit to prevent the context from being + // monitored (and to prevent the connection from ever being closed) after + // returning from this function. + ctxMonitorDone := grpcsync.NewEvent() + newClientCtx, newClientDone := context.WithCancel(connectCtx) + defer func() { + newClientDone() // Awaken the goroutine below if connectCtx hasn't expired. + <-ctxMonitorDone.Done() // Wait for the goroutine below to exit. + }() + go func(conn net.Conn) { + defer ctxMonitorDone.Fire() // Signal this goroutine has exited. + <-newClientCtx.Done() // Block until connectCtx expires or the defer above executes. + if connectCtx.Err() != nil { + // connectCtx expired before exiting the function. Hard close the connection. + conn.Close() + } + }(conn) + kp := opts.KeepaliveParams // Validate keepalive parameters. if kp.Time == 0 { @@ -253,15 +275,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts } } if transportCreds != nil { - rawConn := conn - // Pull the deadline from the connectCtx, which will be used for - // timeouts in the authentication protocol handshake. Can ignore the - // boolean as the deadline will return the zero value, which will make - // the conn not timeout on I/O operations. - deadline, _ := connectCtx.Deadline() - rawConn.SetDeadline(deadline) - conn, authInfo, err = transportCreds.ClientHandshake(connectCtx, addr.ServerName, rawConn) - rawConn.SetDeadline(time.Time{}) + conn, authInfo, err = transportCreds.ClientHandshake(connectCtx, addr.ServerName, conn) if err != nil { return nil, connectionErrorf(isTemporary(err), err, "transport: authentication handshake failed: %v", err) } @@ -299,6 +313,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts ctxDone: ctx.Done(), // Cache Done chan. cancel: cancel, userAgent: opts.UserAgent, + registeredCompressors: grpcutil.RegisteredCompressors(), conn: conn, remoteAddr: conn.RemoteAddr(), localAddr: conn.LocalAddr(), @@ -315,16 +330,15 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts kp: kp, statsHandlers: opts.StatsHandlers, initialWindowSize: initialWindowSize, - onPrefaceReceipt: onPrefaceReceipt, nextID: 1, maxConcurrentStreams: defaultMaxStreamsClient, streamQuota: defaultMaxStreamsClient, streamsQuotaAvailable: make(chan struct{}, 1), czData: new(channelzData), onGoAway: onGoAway, - onClose: onClose, keepaliveEnabled: keepaliveEnabled, bufferPool: newBufferPool(), + onClose: onClose, } // Add peer information to the http2client context. t.ctx = peer.NewContext(t.ctx, t.getPeer()) @@ -363,21 +377,32 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts t.kpDormancyCond = sync.NewCond(&t.mu) go t.keepalive() } - // Start the reader goroutine for incoming message. Each transport has - // a dedicated goroutine which reads HTTP2 frame from network. Then it - // dispatches the frame to the corresponding stream entity. - go t.reader() + + // Start the reader goroutine for incoming messages. Each transport has a + // dedicated goroutine which reads HTTP2 frames from the network. Then it + // dispatches the frame to the corresponding stream entity. When the + // server preface is received, readerErrCh is closed. If an error occurs + // first, an error is pushed to the channel. This must be checked before + // returning from this function. + readerErrCh := make(chan error, 1) + go t.reader(readerErrCh) + defer func() { + if err == nil { + err = <-readerErrCh + } + if err != nil { + t.Close(err) + } + }() // Send connection preface to server. n, err := t.conn.Write(clientPreface) if err != nil { err = connectionErrorf(true, err, "transport: failed to write client preface: %v", err) - t.Close(err) return nil, err } if n != len(clientPreface) { err = connectionErrorf(true, nil, "transport: preface mismatch, wrote %d bytes; want %d", n, len(clientPreface)) - t.Close(err) return nil, err } var ss []http2.Setting @@ -397,14 +422,12 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts err = t.framer.fr.WriteSettings(ss...) if err != nil { err = connectionErrorf(true, err, "transport: failed to write initial settings frame: %v", err) - t.Close(err) return nil, err } // Adjust the connection flow control window if needed. if delta := uint32(icwz - defaultWindowSize); delta > 0 { if err := t.framer.fr.WriteWindowUpdate(0, delta); err != nil { err = connectionErrorf(true, err, "transport: failed to write window update: %v", err) - t.Close(err) return nil, err } } @@ -507,9 +530,22 @@ func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-previous-rpc-attempts", Value: strconv.Itoa(callHdr.PreviousAttempts)}) } + registeredCompressors := t.registeredCompressors if callHdr.SendCompress != "" { headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-encoding", Value: callHdr.SendCompress}) - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-accept-encoding", Value: callHdr.SendCompress}) + // Include the outgoing compressor name when compressor is not registered + // via encoding.RegisterCompressor. This is possible when client uses + // WithCompressor dial option. + if !grpcutil.IsCompressorNameRegistered(callHdr.SendCompress) { + if registeredCompressors != "" { + registeredCompressors += "," + } + registeredCompressors += callHdr.SendCompress + } + } + + if registeredCompressors != "" { + headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-accept-encoding", Value: registeredCompressors}) } if dl, ok := ctx.Deadline(); ok { // Send out timeout regardless its value. The server can detect timeout context by itself. @@ -589,7 +625,11 @@ func (t *http2Client) getTrAuthData(ctx context.Context, audience string) (map[s for _, c := range t.perRPCCreds { data, err := c.GetRequestMetadata(ctx, audience) if err != nil { - if _, ok := status.FromError(err); ok { + if st, ok := status.FromError(err); ok { + // Restrict the code to the list allowed by gRFC A54. + if istatus.IsRestrictedControlPlaneCode(st) { + err = status.Errorf(codes.Internal, "transport: received per-RPC creds error with illegal status: %v", err) + } return nil, err } @@ -618,7 +658,14 @@ func (t *http2Client) getCallAuthData(ctx context.Context, audience string, call } data, err := callCreds.GetRequestMetadata(ctx, audience) if err != nil { - return nil, status.Errorf(codes.Internal, "transport: %v", err) + if st, ok := status.FromError(err); ok { + // Restrict the code to the list allowed by gRFC A54. + if istatus.IsRestrictedControlPlaneCode(st) { + err = status.Errorf(codes.Internal, "transport: received per-RPC creds error with illegal status: %v", err) + } + return nil, err + } + return nil, status.Errorf(codes.Internal, "transport: per-RPC creds failed due to error: %v", err) } callAuthData = make(map[string]string, len(data)) for k, v := range data { @@ -634,13 +681,13 @@ func (t *http2Client) getCallAuthData(ctx context.Context, audience string, call // NewStream errors result in transparent retry, as they mean nothing went onto // the wire. However, there are two notable exceptions: // -// 1. If the stream headers violate the max header list size allowed by the -// server. It's possible this could succeed on another transport, even if -// it's unlikely, but do not transparently retry. -// 2. If the credentials errored when requesting their headers. In this case, -// it's possible a retry can fix the problem, but indefinitely transparently -// retrying is not appropriate as it is likely the credentials, if they can -// eventually succeed, would need I/O to do so. +// 1. If the stream headers violate the max header list size allowed by the +// server. It's possible this could succeed on another transport, even if +// it's unlikely, but do not transparently retry. +// 2. If the credentials errored when requesting their headers. In this case, +// it's possible a retry can fix the problem, but indefinitely transparently +// retrying is not appropriate as it is likely the credentials, if they can +// eventually succeed, would need I/O to do so. type NewStreamError struct { Err error @@ -880,19 +927,15 @@ func (t *http2Client) closeStream(s *Stream, err error, rst bool, rstCode http2. // Close kicks off the shutdown process of the transport. This should be called // only once on a transport. Once it is called, the transport should not be // accessed any more. -// -// This method blocks until the addrConn that initiated this transport is -// re-connected. This happens because t.onClose() begins reconnect logic at the -// addrConn level and blocks until the addrConn is successfully connected. func (t *http2Client) Close(err error) { t.mu.Lock() - // Make sure we only Close once. + // Make sure we only close once. if t.state == closing { t.mu.Unlock() return } - // Call t.onClose before setting the state to closing to prevent the client - // from attempting to create new streams ASAP. + // Call t.onClose ASAP to prevent the client from attempting to create new + // streams. t.onClose() t.state = closing streams := t.activeStreams @@ -1482,33 +1525,35 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { t.closeStream(s, io.EOF, rst, http2.ErrCodeNo, statusGen, mdata, true) } -// reader runs as a separate goroutine in charge of reading data from network -// connection. -// -// TODO(zhaoq): currently one reader per transport. Investigate whether this is -// optimal. -// TODO(zhaoq): Check the validity of the incoming frame sequence. -func (t *http2Client) reader() { - defer close(t.readerDone) - // Check the validity of server preface. +// readServerPreface reads and handles the initial settings frame from the +// server. +func (t *http2Client) readServerPreface() error { frame, err := t.framer.fr.ReadFrame() if err != nil { - err = connectionErrorf(true, err, "error reading server preface: %v", err) - t.Close(err) // this kicks off resetTransport, so must be last before return - return - } - t.conn.SetReadDeadline(time.Time{}) // reset deadline once we get the settings frame (we didn't time out, yay!) - if t.keepaliveEnabled { - atomic.StoreInt64(&t.lastRead, time.Now().UnixNano()) + return connectionErrorf(true, err, "error reading server preface: %v", err) } sf, ok := frame.(*http2.SettingsFrame) if !ok { - // this kicks off resetTransport, so must be last before return - t.Close(connectionErrorf(true, nil, "initial http2 frame from server is not a settings frame: %T", frame)) - return + return connectionErrorf(true, nil, "initial http2 frame from server is not a settings frame: %T", frame) } - t.onPrefaceReceipt() t.handleSettings(sf, true) + return nil +} + +// reader verifies the server preface and reads all subsequent data from +// network connection. If the server preface is not read successfully, an +// error is pushed to errCh; otherwise errCh is closed with no error. +func (t *http2Client) reader(errCh chan<- error) { + defer close(t.readerDone) + + if err := t.readServerPreface(); err != nil { + errCh <- err + return + } + close(errCh) + if t.keepaliveEnabled { + atomic.StoreInt64(&t.lastRead, time.Now().UnixNano()) + } // loop to keep reading incoming messages on this transport. for { diff --git a/vendor/google.golang.org/grpc/internal/transport/transport.go b/vendor/google.golang.org/grpc/internal/transport/transport.go index 6c3ba8515940..2e615ee20cc5 100644 --- a/vendor/google.golang.org/grpc/internal/transport/transport.go +++ b/vendor/google.golang.org/grpc/internal/transport/transport.go @@ -43,6 +43,10 @@ import ( "google.golang.org/grpc/tap" ) +// ErrNoHeaders is used as a signal that a trailers only response was received, +// and is not a real error. +var ErrNoHeaders = errors.New("stream has no headers") + const logLevel = 2 type bufferPool struct { @@ -366,9 +370,15 @@ func (s *Stream) Header() (metadata.MD, error) { return s.header.Copy(), nil } s.waitOnHeader() + if !s.headerValid { return nil, s.status.Err() } + + if s.noHeaders { + return nil, ErrNoHeaders + } + return s.header.Copy(), nil } @@ -573,8 +583,8 @@ type ConnectOptions struct { // NewClientTransport establishes the transport with the required ConnectOptions // and returns it to the caller. -func NewClientTransport(connectCtx, ctx context.Context, addr resolver.Address, opts ConnectOptions, onPrefaceReceipt func(), onGoAway func(GoAwayReason), onClose func()) (ClientTransport, error) { - return newHTTP2Client(connectCtx, ctx, addr, opts, onPrefaceReceipt, onGoAway, onClose) +func NewClientTransport(connectCtx, ctx context.Context, addr resolver.Address, opts ConnectOptions, onGoAway func(GoAwayReason), onClose func()) (ClientTransport, error) { + return newHTTP2Client(connectCtx, ctx, addr, opts, onGoAway, onClose) } // Options provides additional hints and information for message diff --git a/vendor/google.golang.org/grpc/metadata/metadata.go b/vendor/google.golang.org/grpc/metadata/metadata.go index 98d62e0675f6..fb4a88f59bd3 100644 --- a/vendor/google.golang.org/grpc/metadata/metadata.go +++ b/vendor/google.golang.org/grpc/metadata/metadata.go @@ -41,10 +41,11 @@ type MD map[string][]string // New creates an MD from a given key-value map. // // Only the following ASCII characters are allowed in keys: -// - digits: 0-9 -// - uppercase letters: A-Z (normalized to lower) -// - lowercase letters: a-z -// - special characters: -_. +// - digits: 0-9 +// - uppercase letters: A-Z (normalized to lower) +// - lowercase letters: a-z +// - special characters: -_. +// // Uppercase letters are automatically converted to lowercase. // // Keys beginning with "grpc-" are reserved for grpc-internal use only and may @@ -62,10 +63,11 @@ func New(m map[string]string) MD { // Pairs panics if len(kv) is odd. // // Only the following ASCII characters are allowed in keys: -// - digits: 0-9 -// - uppercase letters: A-Z (normalized to lower) -// - lowercase letters: a-z -// - special characters: -_. +// - digits: 0-9 +// - uppercase letters: A-Z (normalized to lower) +// - lowercase letters: a-z +// - special characters: -_. +// // Uppercase letters are automatically converted to lowercase. // // Keys beginning with "grpc-" are reserved for grpc-internal use only and may @@ -196,7 +198,7 @@ func FromIncomingContext(ctx context.Context) (MD, bool) { // ValueFromIncomingContext returns the metadata value corresponding to the metadata // key from the incoming metadata if it exists. Key must be lower-case. // -// Experimental +// # Experimental // // Notice: This API is EXPERIMENTAL and may be changed or removed in a // later release. diff --git a/vendor/google.golang.org/grpc/picker_wrapper.go b/vendor/google.golang.org/grpc/picker_wrapper.go index 843633c910a1..a5d5516ee060 100644 --- a/vendor/google.golang.org/grpc/picker_wrapper.go +++ b/vendor/google.golang.org/grpc/picker_wrapper.go @@ -26,6 +26,7 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/codes" "google.golang.org/grpc/internal/channelz" + istatus "google.golang.org/grpc/internal/status" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/status" ) @@ -129,8 +130,12 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer. if err == balancer.ErrNoSubConnAvailable { continue } - if _, ok := status.FromError(err); ok { + if st, ok := status.FromError(err); ok { // Status error: end the RPC unconditionally with this status. + // First restrict the code to the list allowed by gRFC A54. + if istatus.IsRestrictedControlPlaneCode(st) { + err = status.Errorf(codes.Internal, "received picker error with illegal status: %v", err) + } return nil, nil, dropError{error: err} } // For all other errors, wait for ready RPCs should block and other diff --git a/vendor/google.golang.org/grpc/preloader.go b/vendor/google.golang.org/grpc/preloader.go index 0a1e975ad916..cd45547854f0 100644 --- a/vendor/google.golang.org/grpc/preloader.go +++ b/vendor/google.golang.org/grpc/preloader.go @@ -25,7 +25,7 @@ import ( // PreparedMsg is responsible for creating a Marshalled and Compressed object. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go index 1f859f764881..c22f9a52db4e 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go @@ -53,6 +53,7 @@ type ServerReflectionRequest struct { // defined field and then handles them using corresponding methods. // // Types that are assignable to MessageRequest: + // // *ServerReflectionRequest_FileByFilename // *ServerReflectionRequest_FileContainingSymbol // *ServerReflectionRequest_FileContainingExtension @@ -263,6 +264,7 @@ type ServerReflectionResponse struct { // message_request in the request. // // Types that are assignable to MessageResponse: + // // *ServerReflectionResponse_FileDescriptorResponse // *ServerReflectionResponse_AllExtensionNumbersResponse // *ServerReflectionResponse_ListServicesResponse diff --git a/vendor/google.golang.org/grpc/reflection/serverreflection.go b/vendor/google.golang.org/grpc/reflection/serverreflection.go index 81344abd77da..0b41783aa533 100644 --- a/vendor/google.golang.org/grpc/reflection/serverreflection.go +++ b/vendor/google.golang.org/grpc/reflection/serverreflection.go @@ -23,6 +23,7 @@ The service implemented is defined in: https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto. To register server reflection on a gRPC server: + import "google.golang.org/grpc/reflection" s := grpc.NewServer() @@ -32,7 +33,6 @@ To register server reflection on a gRPC server: reflection.Register(s) s.Serve(lis) - */ package reflection // import "google.golang.org/grpc/reflection" @@ -74,7 +74,7 @@ func Register(s GRPCServer) { // for a custom implementation to return zero values for the // grpc.ServiceInfo values in the map. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -85,7 +85,7 @@ type ServiceInfoProvider interface { // ExtensionResolver is the interface used to query details about extensions. // This interface is satisfied by protoregistry.GlobalTypes. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -96,7 +96,7 @@ type ExtensionResolver interface { // ServerOptions represents the options used to construct a reflection server. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -120,7 +120,7 @@ type ServerOptions struct { // This can be used to customize behavior of the reflection service. Most usages // should prefer to use Register instead. // -// Experimental +// # Experimental // // Notice: This function is EXPERIMENTAL and may be changed or removed in a // later release. diff --git a/vendor/google.golang.org/grpc/resolver/resolver.go b/vendor/google.golang.org/grpc/resolver/resolver.go index ca2e35a3596f..967cbc7373ab 100644 --- a/vendor/google.golang.org/grpc/resolver/resolver.go +++ b/vendor/google.golang.org/grpc/resolver/resolver.go @@ -96,7 +96,7 @@ const ( // Address represents a server the client connects to. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -236,12 +236,12 @@ type ClientConn interface { // // Examples: // -// - "dns://some_authority/foo.bar" -// Target{Scheme: "dns", Authority: "some_authority", Endpoint: "foo.bar"} -// - "foo.bar" -// Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "foo.bar"} -// - "unknown_scheme://authority/endpoint" -// Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "unknown_scheme://authority/endpoint"} +// - "dns://some_authority/foo.bar" +// Target{Scheme: "dns", Authority: "some_authority", Endpoint: "foo.bar"} +// - "foo.bar" +// Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "foo.bar"} +// - "unknown_scheme://authority/endpoint" +// Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "unknown_scheme://authority/endpoint"} type Target struct { // Deprecated: use URL.Scheme instead. Scheme string diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go index 5d407b004b0e..934fc1aa015e 100644 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ b/vendor/google.golang.org/grpc/rpc_util.go @@ -198,7 +198,7 @@ func Header(md *metadata.MD) CallOption { // HeaderCallOption is a CallOption for collecting response header metadata. // The metadata field will be populated *after* the RPC completes. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -220,7 +220,7 @@ func Trailer(md *metadata.MD) CallOption { // TrailerCallOption is a CallOption for collecting response trailer metadata. // The metadata field will be populated *after* the RPC completes. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -242,7 +242,7 @@ func Peer(p *peer.Peer) CallOption { // PeerCallOption is a CallOption for collecting the identity of the remote // peer. The peer field will be populated *after* the RPC completes. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -282,7 +282,7 @@ func FailFast(failFast bool) CallOption { // FailFastCallOption is a CallOption for indicating whether an RPC should fail // fast or not. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -305,7 +305,7 @@ func MaxCallRecvMsgSize(bytes int) CallOption { // MaxRecvMsgSizeCallOption is a CallOption that indicates the maximum message // size in bytes the client can receive. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -328,7 +328,7 @@ func MaxCallSendMsgSize(bytes int) CallOption { // MaxSendMsgSizeCallOption is a CallOption that indicates the maximum message // size in bytes the client can send. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -351,7 +351,7 @@ func PerRPCCredentials(creds credentials.PerRPCCredentials) CallOption { // PerRPCCredsCallOption is a CallOption that indicates the per-RPC // credentials to use for the call. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -369,7 +369,7 @@ func (o PerRPCCredsCallOption) after(c *callInfo, attempt *csAttempt) {} // sending the request. If WithCompressor is also set, UseCompressor has // higher priority. // -// Experimental +// # Experimental // // Notice: This API is EXPERIMENTAL and may be changed or removed in a // later release. @@ -379,7 +379,7 @@ func UseCompressor(name string) CallOption { // CompressorCallOption is a CallOption that indicates the compressor to use. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -416,7 +416,7 @@ func CallContentSubtype(contentSubtype string) CallOption { // ContentSubtypeCallOption is a CallOption that indicates the content-subtype // used for marshaling messages. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -444,7 +444,7 @@ func (o ContentSubtypeCallOption) after(c *callInfo, attempt *csAttempt) {} // This function is provided for advanced users; prefer to use only // CallContentSubtype to select a registered codec instead. // -// Experimental +// # Experimental // // Notice: This API is EXPERIMENTAL and may be changed or removed in a // later release. @@ -455,7 +455,7 @@ func ForceCodec(codec encoding.Codec) CallOption { // ForceCodecCallOption is a CallOption that indicates the codec used for // marshaling messages. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -480,7 +480,7 @@ func CallCustomCodec(codec Codec) CallOption { // CustomCodecCallOption is a CallOption that indicates the codec used for // marshaling messages. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -497,7 +497,7 @@ func (o CustomCodecCallOption) after(c *callInfo, attempt *csAttempt) {} // MaxRetryRPCBufferSize returns a CallOption that limits the amount of memory // used for buffering this RPC's requests for retry purposes. // -// Experimental +// # Experimental // // Notice: This API is EXPERIMENTAL and may be changed or removed in a // later release. @@ -508,7 +508,7 @@ func MaxRetryRPCBufferSize(bytes int) CallOption { // MaxRetryRPCBufferSizeCallOption is a CallOption indicating the amount of // memory to be used for caching this RPC for retry purposes. // -// Experimental +// # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. @@ -548,10 +548,11 @@ type parser struct { // format. The caller owns the returned msg memory. // // If there is an error, possible values are: -// * io.EOF, when no messages remain -// * io.ErrUnexpectedEOF -// * of type transport.ConnectionError -// * an error from the status package +// - io.EOF, when no messages remain +// - io.ErrUnexpectedEOF +// - of type transport.ConnectionError +// - an error from the status package +// // No other error values or types must be returned, which also means // that the underlying io.Reader must not return an incompatible // error. diff --git a/vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go b/vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go index 73a2f926613e..35e7a20a04ba 100644 --- a/vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go +++ b/vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go @@ -19,7 +19,7 @@ // Package serviceconfig defines types and methods for operating on gRPC // service configs. // -// Experimental +// # Experimental // // Notice: This package is EXPERIMENTAL and may be changed or removed in a // later release. diff --git a/vendor/google.golang.org/grpc/status/status.go b/vendor/google.golang.org/grpc/status/status.go index 6d163b6e3842..623be39f26ba 100644 --- a/vendor/google.golang.org/grpc/status/status.go +++ b/vendor/google.golang.org/grpc/status/status.go @@ -76,14 +76,14 @@ func FromProto(s *spb.Status) *Status { // FromError returns a Status representation of err. // -// - If err was produced by this package or implements the method `GRPCStatus() -// *Status`, the appropriate Status is returned. +// - If err was produced by this package or implements the method `GRPCStatus() +// *Status`, the appropriate Status is returned. // -// - If err is nil, a Status is returned with codes.OK and no message. +// - If err is nil, a Status is returned with codes.OK and no message. // -// - Otherwise, err is an error not compatible with this package. In this -// case, a Status is returned with codes.Unknown and err's Error() message, -// and ok is false. +// - Otherwise, err is an error not compatible with this package. In this +// case, a Status is returned with codes.Unknown and err's Error() message, +// and ok is false. func FromError(err error) (s *Status, ok bool) { if err == nil { return nil, true diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go index 0c16cfb2ea80..960c3e33dfd3 100644 --- a/vendor/google.golang.org/grpc/stream.go +++ b/vendor/google.golang.org/grpc/stream.go @@ -39,6 +39,7 @@ import ( imetadata "google.golang.org/grpc/internal/metadata" iresolver "google.golang.org/grpc/internal/resolver" "google.golang.org/grpc/internal/serviceconfig" + istatus "google.golang.org/grpc/internal/status" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" @@ -195,6 +196,13 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth rpcInfo := iresolver.RPCInfo{Context: ctx, Method: method} rpcConfig, err := cc.safeConfigSelector.SelectConfig(rpcInfo) if err != nil { + if st, ok := status.FromError(err); ok { + // Restrict the code to the list allowed by gRFC A54. + if istatus.IsRestrictedControlPlaneCode(st) { + err = status.Errorf(codes.Internal, "config selector returned illegal status: %v", err) + } + return nil, err + } return nil, toRPCErr(err) } @@ -744,17 +752,25 @@ func (cs *clientStream) withRetry(op func(a *csAttempt) error, onSuccess func()) func (cs *clientStream) Header() (metadata.MD, error) { var m metadata.MD + noHeader := false err := cs.withRetry(func(a *csAttempt) error { var err error m, err = a.s.Header() + if err == transport.ErrNoHeaders { + noHeader = true + return nil + } return toRPCErr(err) }, cs.commitAttemptLocked) + if err != nil { cs.finish(err) return nil, err } - if len(cs.binlogs) != 0 && !cs.serverHeaderBinlogged { - // Only log if binary log is on and header has not been logged. + + if len(cs.binlogs) != 0 && !cs.serverHeaderBinlogged && !noHeader { + // Only log if binary log is on and header has not been logged, and + // there is actually headers to log. logEntry := &binarylog.ServerHeader{ OnClientSide: true, Header: m, diff --git a/vendor/google.golang.org/grpc/tap/tap.go b/vendor/google.golang.org/grpc/tap/tap.go index dbf34e6bb5f5..bfa5dfa40e4d 100644 --- a/vendor/google.golang.org/grpc/tap/tap.go +++ b/vendor/google.golang.org/grpc/tap/tap.go @@ -19,7 +19,7 @@ // Package tap defines the function handles which are executed on the transport // layer of gRPC-Go and related information. // -// Experimental +// # Experimental // // Notice: This API is EXPERIMENTAL and may be changed or removed in a // later release. diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index d472ca64307b..2198e7098d7d 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.50.1" +const Version = "1.51.0" diff --git a/vendor/google.golang.org/grpc/vet.sh b/vendor/google.golang.org/grpc/vet.sh index c3fc8253b13a..bd8e0cdb33c8 100644 --- a/vendor/google.golang.org/grpc/vet.sh +++ b/vendor/google.golang.org/grpc/vet.sh @@ -67,7 +67,9 @@ elif [[ "$#" -ne 0 ]]; then fi # - Ensure all source files contain a copyright message. -not git grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)\|DO NOT EDIT" -- '*.go' +# (Done in two parts because Darwin "git grep" has broken support for compound +# exclusion matches.) +(grep -L "DO NOT EDIT" $(git grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)" -- '*.go') || true) | fail_on_output # - Make sure all tests in grpc and grpc/test use leakcheck via Teardown. not grep 'func Test[^(]' *_test.go @@ -81,7 +83,7 @@ not git grep -l 'x/net/context' -- "*.go" git grep -l '"math/rand"' -- "*.go" 2>&1 | not grep -v '^examples\|^stress\|grpcrand\|^benchmark\|wrr_test' # - Do not call grpclog directly. Use grpclog.Component instead. -git grep -l 'grpclog.I\|grpclog.W\|grpclog.E\|grpclog.F\|grpclog.V' -- "*.go" | not grep -v '^grpclog/component.go\|^internal/grpctest/tlogger_test.go' +git grep -l -e 'grpclog.I' --or -e 'grpclog.W' --or -e 'grpclog.E' --or -e 'grpclog.F' --or -e 'grpclog.V' -- "*.go" | not grep -v '^grpclog/component.go\|^internal/grpctest/tlogger_test.go' # - Ensure all ptypes proto packages are renamed when importing. not git grep "\(import \|^\s*\)\"github.com/golang/protobuf/ptypes/" -- "*.go" diff --git a/vendor/modules.txt b/vendor/modules.txt index 103c417868a9..fecc717f0f79 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -6,18 +6,11 @@ github.com/Azure/azure-sdk-for-go/services/advisor/mgmt/2020-01-01/advisor github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights github.com/Azure/azure-sdk-for-go/services/batch/2020-03-01.11.0/batch -github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn -github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2021-10-15/documentdb github.com/Azure/azure-sdk-for-go/services/databoxedge/mgmt/2020-12-01/databoxedge -github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog github.com/Azure/azure-sdk-for-go/services/datafactory/mgmt/2018-06-01/datafactory -github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration -github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare -github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl -github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2021-12-01/eventgrid github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac @@ -28,7 +21,6 @@ github.com/Azure/azure-sdk-for-go/services/healthcareapis/mgmt/2021-11-01/health github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2021-10-01/keyvault github.com/Azure/azure-sdk-for-go/services/keyvault/v7.1/keyvault github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto -github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic github.com/Azure/azure-sdk-for-go/services/logz/mgmt/2020-10-01/logz github.com/Azure/azure-sdk-for-go/services/marketplaceordering/mgmt/2015-06-01/marketplaceordering github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2020-10-01/insights @@ -38,9 +30,7 @@ github.com/Azure/azure-sdk-for-go/services/preview/alertsmanagement/mgmt/2019-06 github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization github.com/Azure/azure-sdk-for-go/services/preview/automation/mgmt/2020-01-13-preview/automation github.com/Azure/azure-sdk-for-go/services/preview/blueprint/mgmt/2018-11-01-preview/blueprint -github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-08-01-preview/containerregistry -github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-07-01-preview/insights github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-09-01-preview/insights github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2019-06-01-preview/templatespecs @@ -54,36 +44,32 @@ github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-06-01-preview/ma github.com/Azure/azure-sdk-for-go/services/preview/synapse/2020-08-01-preview/accesscontrol github.com/Azure/azure-sdk-for-go/services/preview/synapse/mgmt/v2.0/synapse github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2018-07-10/siterecovery -github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-12-01/backup -github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2021-06-01/redis -github.com/Azure/azure-sdk-for-go/services/redisenterprise/mgmt/2021-03-01/redisenterprise github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2015-12-01/features github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-02-01/resources -github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/managedapplications github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2020-05-01/managementgroups github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2020-06-01/resources github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-01-01/subscriptions -github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2021-09-01/storagecache github.com/Azure/azure-sdk-for-go/services/storagesync/mgmt/2020-03-01/storagesync github.com/Azure/azure-sdk-for-go/services/subscription/mgmt/2020-09-01/subscription github.com/Azure/azure-sdk-for-go/services/timeseriesinsights/mgmt/2020-05-15/timeseriesinsights github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web +github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-03-01/web github.com/Azure/azure-sdk-for-go/version # github.com/Azure/go-autorest v14.2.0+incompatible ## explicit github.com/Azure/go-autorest -# github.com/Azure/go-autorest/autorest v0.11.27 +# github.com/Azure/go-autorest/autorest v0.11.28 ## explicit; go 1.15 github.com/Azure/go-autorest/autorest github.com/Azure/go-autorest/autorest/azure -# github.com/Azure/go-autorest/autorest/adal v0.9.18 +# github.com/Azure/go-autorest/autorest/adal v0.9.22 ## explicit; go 1.15 github.com/Azure/go-autorest/autorest/adal -# github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 +# github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 ## explicit; go 1.15 github.com/Azure/go-autorest/autorest/azure/cli # github.com/Azure/go-autorest/autorest/date v0.3.0 @@ -104,9 +90,6 @@ github.com/Azure/go-autorest/tracing # github.com/agext/levenshtein v1.2.3 ## explicit github.com/agext/levenshtein -# github.com/apparentlymart/go-cidr v1.1.0 -## explicit -github.com/apparentlymart/go-cidr/cidr # github.com/apparentlymart/go-textseg v1.0.0 ## explicit github.com/apparentlymart/go-textseg/textseg @@ -131,7 +114,7 @@ github.com/fatih/color # github.com/gofrs/uuid v4.0.0+incompatible ## explicit github.com/gofrs/uuid -# github.com/golang-jwt/jwt/v4 v4.4.1 +# github.com/golang-jwt/jwt/v4 v4.4.3 ## explicit; go 1.16 github.com/golang-jwt/jwt/v4 # github.com/golang/protobuf v1.5.2 @@ -156,8 +139,8 @@ github.com/google/uuid # github.com/hashicorp/errwrap v1.1.0 ## explicit github.com/hashicorp/errwrap -# github.com/hashicorp/go-azure-helpers v0.47.0 -## explicit; go 1.18 +# github.com/hashicorp/go-azure-helpers v0.51.0 +## explicit; go 1.19 github.com/hashicorp/go-azure-helpers/authentication github.com/hashicorp/go-azure-helpers/lang/dates github.com/hashicorp/go-azure-helpers/lang/pointer @@ -176,8 +159,8 @@ github.com/hashicorp/go-azure-helpers/resourcemanager/zones github.com/hashicorp/go-azure-helpers/resourceproviders github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage -# github.com/hashicorp/go-azure-sdk v0.20230105.1121404 -## explicit; go 1.18 +# github.com/hashicorp/go-azure-sdk v0.20230217.1150808 +## explicit; go 1.19 github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants @@ -196,7 +179,21 @@ github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/runbook github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/hybridrunbookworker github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/hybridrunbookworkergroup -github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-09-01/clusters +github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01 +github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings +github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster +github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/clusters +github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/extensions +github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/offers +github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/publishers +github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/skuses +github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updateruns +github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updates +github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/updatesummaries +github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/application +github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/batchaccount +github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/certificate +github.com/hashicorp/go-azure-sdk/resource-manager/batch/2022-01-01/pool github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/cognitiveservicesaccounts github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2022-10-01/deployments github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice @@ -213,7 +210,14 @@ github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-02/disks github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-02/snapshots github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/budgets +github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/certificates +github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerapps +github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/containerappsrevisions +github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/daprcomponents +github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironments +github.com/hashicorp/go-azure-sdk/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-10-01/containerinstance +github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/agentpools github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview/fleetmembers @@ -233,12 +237,30 @@ github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exp github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2022-06-01-preview/scheduledactions github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2022-08-01/grafanaresource +github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/accessconnector github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/workspaces +github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2023-02-01/workspaces +github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01 +github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/agreements +github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/apikey +github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/hosts +github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/linkedresources +github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitoredresources +github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/monitorsresource +github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/refreshsetpasswordlink +github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/rules +github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01/singlesignon +github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/projectresource +github.com/hashicorp/go-azure-sdk/resource-manager/datamigration/2018-04-19/serviceresource github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards +github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/account +github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/dataset +github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/share +github.com/hashicorp/go-azure-sdk/resource-manager/datashare/2019-11-01/synchronizationsetting github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace @@ -252,6 +274,14 @@ github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2022-02 github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/dpscertificate github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource github.com/hashicorp/go-azure-sdk/resource-manager/deviceupdate/2022-10-01/deviceupdates +github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/globalschedules +github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/labs +github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/policies +github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/schedules +github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualmachines +github.com/hashicorp/go-azure-sdk/resource-manager/devtestlab/2018-09-15/virtualnetworks +github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/digitaltwinsinstance +github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2022-10-31/timeseriesdatabaseconnections github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01 github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns @@ -279,9 +309,14 @@ github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/n github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26 github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers +github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies +github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2020-12-08 github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2020-12-08/healthbots +github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machineextensions +github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/machines +github.com/hashicorp/go-azure-sdk/resource-manager/hybridcompute/2022-03-10/privateendpointconnections github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionruleassociations github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules @@ -292,9 +327,24 @@ github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-07-07/clusters github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/lab github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/labplan +github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/schedule github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/user github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests +github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements +github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies +github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations +github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountcertificates +github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountmaps +github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountpartners +github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccounts +github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountschemas +github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountsessions +github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationserviceenvironments +github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowrunactions +github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflows +github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/workflowtriggers +github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/datastore github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2022-05-01/workspaces github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments @@ -311,16 +361,6 @@ github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules -github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01 -github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accountfilters -github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/accounts -github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/assetsandassetfilters -github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/contentkeypolicies -github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/encodings -github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveevents -github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/liveoutputs -github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints -github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingpoliciesandstreaminglocators github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01 github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accountfilters github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/accounts @@ -329,7 +369,6 @@ github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/contentkeypo github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/encodings github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveevents github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/liveoutputs -github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoint github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingendpoints github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01 @@ -338,10 +377,14 @@ github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/assetsandass github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/contentkeypolicies github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveevents github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/liveoutputs -github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoint github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource +github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork +github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/service +github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/simgroup +github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/site +github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/slice github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/serverfailover github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/servers github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools @@ -385,16 +428,19 @@ github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations -github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases -github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart -github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/administrators -github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-03-08-preview/servers +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/administrators +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/databases +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/firewallrules +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2022-12-01/servers github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account +github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2022-10-01/vaults +github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcestorageconfigsnoncrr +github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2021-12-01/backupresourcevaultconfigs github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies @@ -402,16 +448,24 @@ github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/ github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans +github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01 +github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/firewallrules +github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/patchschedules +github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privateendpointconnections +github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/privatelinkresources +github.com/hashicorp/go-azure-sdk/resource-manager/redis/2021-06-01/redis github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces +github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-05-01/managementlocks github.com/hashicorp/go-azure-sdk/resource-manager/resources/2020-10-01/deploymentscripts github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-08-01/sharedprivatelinkresources github.com/hashicorp/go-azure-sdk/resource-manager/security/2022-03-01/pricings +github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues @@ -421,6 +475,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2022-01-01-preview/namespaces +github.com/hashicorp/go-azure-sdk/resource-manager/servicefabric/2021-06-01/cluster github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links @@ -451,10 +506,10 @@ github.com/hashicorp/go-azure-sdk/resource-manager/storagepool/2021-08-01/iscsit github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/clusters github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/functions github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/inputs -github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/outputs github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/privateendpoints github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/streamingjobs github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/transformations +github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles @@ -468,6 +523,19 @@ github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01 github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2021-10-01/webpubsub +github.com/hashicorp/go-azure-sdk/sdk/auth +github.com/hashicorp/go-azure-sdk/sdk/auth/autorest +github.com/hashicorp/go-azure-sdk/sdk/claims +github.com/hashicorp/go-azure-sdk/sdk/client +github.com/hashicorp/go-azure-sdk/sdk/client/msgraph +github.com/hashicorp/go-azure-sdk/sdk/client/pollers +github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager +github.com/hashicorp/go-azure-sdk/sdk/environments +github.com/hashicorp/go-azure-sdk/sdk/internal/accept +github.com/hashicorp/go-azure-sdk/sdk/internal/azurecli +github.com/hashicorp/go-azure-sdk/sdk/internal/metadata +github.com/hashicorp/go-azure-sdk/sdk/internal/stringfmt +github.com/hashicorp/go-azure-sdk/sdk/odata # github.com/hashicorp/go-checkpoint v0.5.0 ## explicit github.com/hashicorp/go-checkpoint @@ -482,17 +550,17 @@ github.com/hashicorp/go-cty/cty/gocty github.com/hashicorp/go-cty/cty/json github.com/hashicorp/go-cty/cty/msgpack github.com/hashicorp/go-cty/cty/set -# github.com/hashicorp/go-hclog v1.2.1 +# github.com/hashicorp/go-hclog v1.4.0 ## explicit; go 1.13 github.com/hashicorp/go-hclog # github.com/hashicorp/go-multierror v1.1.1 ## explicit; go 1.13 github.com/hashicorp/go-multierror -# github.com/hashicorp/go-plugin v1.4.6 +# github.com/hashicorp/go-plugin v1.4.8 ## explicit; go 1.17 github.com/hashicorp/go-plugin github.com/hashicorp/go-plugin/internal/plugin -# github.com/hashicorp/go-retryablehttp v0.7.0 +# github.com/hashicorp/go-retryablehttp v0.7.2 ## explicit; go 1.13 github.com/hashicorp/go-retryablehttp # github.com/hashicorp/go-uuid v1.0.3 @@ -537,7 +605,7 @@ github.com/hashicorp/terraform-exec/tfexec # github.com/hashicorp/terraform-json v0.14.0 ## explicit; go 1.13 github.com/hashicorp/terraform-json -# github.com/hashicorp/terraform-plugin-go v0.14.1 +# github.com/hashicorp/terraform-plugin-go v0.14.3 ## explicit; go 1.18 github.com/hashicorp/terraform-plugin-go/internal/logging github.com/hashicorp/terraform-plugin-go/tfprotov5 @@ -565,10 +633,8 @@ github.com/hashicorp/terraform-plugin-log/tfsdklog # github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1 ## explicit; go 1.18 github.com/hashicorp/terraform-plugin-sdk/v2/diag -github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging -github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema github.com/hashicorp/terraform-plugin-sdk/v2/helper/structure github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation @@ -579,12 +645,22 @@ github.com/hashicorp/terraform-plugin-sdk/v2/internal/helper/hashcode github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging github.com/hashicorp/terraform-plugin-sdk/v2/internal/plans/objchange github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugin/convert -github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest github.com/hashicorp/terraform-plugin-sdk/v2/internal/tfdiags github.com/hashicorp/terraform-plugin-sdk/v2/meta github.com/hashicorp/terraform-plugin-sdk/v2/plugin github.com/hashicorp/terraform-plugin-sdk/v2/terraform -# github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c +# github.com/hashicorp/terraform-plugin-testing v1.0.0 +## explicit; go 1.18 +github.com/hashicorp/terraform-plugin-testing/helper/acctest +github.com/hashicorp/terraform-plugin-testing/helper/resource +github.com/hashicorp/terraform-plugin-testing/internal/addrs +github.com/hashicorp/terraform-plugin-testing/internal/configs/configschema +github.com/hashicorp/terraform-plugin-testing/internal/configs/hcl2shim +github.com/hashicorp/terraform-plugin-testing/internal/logging +github.com/hashicorp/terraform-plugin-testing/internal/plugintest +github.com/hashicorp/terraform-plugin-testing/internal/tfdiags +github.com/hashicorp/terraform-plugin-testing/terraform +# github.com/hashicorp/terraform-registry-address v0.1.0 ## explicit; go 1.14 github.com/hashicorp/terraform-registry-address # github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 @@ -596,7 +672,7 @@ github.com/hashicorp/yamux # github.com/magodo/terraform-provider-azurerm-example-gen v0.0.0-20220407025246-3a3ee0ab24a8 ## explicit; go 1.16 github.com/magodo/terraform-provider-azurerm-example-gen/examplegen -# github.com/manicminer/hamilton v0.50.0 +# github.com/manicminer/hamilton v0.55.0 ## explicit; go 1.16 github.com/manicminer/hamilton/auth github.com/manicminer/hamilton/environments @@ -604,7 +680,7 @@ github.com/manicminer/hamilton/errors github.com/manicminer/hamilton/internal/utils github.com/manicminer/hamilton/msgraph github.com/manicminer/hamilton/odata -# github.com/manicminer/hamilton-autorest v0.2.0 +# github.com/manicminer/hamilton-autorest v0.3.0 ## explicit; go 1.16 github.com/manicminer/hamilton-autorest/auth github.com/manicminer/hamilton-autorest/environments @@ -661,12 +737,13 @@ github.com/tombuildsstuff/giovanni/storage/accesscontrol github.com/tombuildsstuff/giovanni/storage/internal/endpoints github.com/tombuildsstuff/giovanni/storage/internal/metadata github.com/tombuildsstuff/giovanni/version -# github.com/tombuildsstuff/kermit v0.20221207.1110610 +# github.com/tombuildsstuff/kermit v0.20230208.1135849 ## explicit; go 1.18 github.com/tombuildsstuff/kermit/sdk/appplatform/2022-11-01-preview/appplatform +github.com/tombuildsstuff/kermit/sdk/botservice/2021-05-01-preview/botservice github.com/tombuildsstuff/kermit/sdk/compute/2022-08-01/compute github.com/tombuildsstuff/kermit/sdk/iothub/2022-04-30-preview/iothub -github.com/tombuildsstuff/kermit/sdk/network/2022-05-01/network +github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights github.com/tombuildsstuff/kermit/sdk/synapse/2021-06-01-preview/synapse # github.com/vmihailenco/msgpack v4.0.4+incompatible @@ -691,7 +768,7 @@ github.com/zclconf/go-cty/cty/function/stdlib github.com/zclconf/go-cty/cty/gocty github.com/zclconf/go-cty/cty/json github.com/zclconf/go-cty/cty/set -# golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 +# golang.org/x/crypto v0.5.0 ## explicit; go 1.17 golang.org/x/crypto/blowfish golang.org/x/crypto/cast5 @@ -699,8 +776,8 @@ golang.org/x/crypto/chacha20 golang.org/x/crypto/curve25519 golang.org/x/crypto/curve25519/internal/field golang.org/x/crypto/ed25519 +golang.org/x/crypto/internal/alias golang.org/x/crypto/internal/poly1305 -golang.org/x/crypto/internal/subtle golang.org/x/crypto/openpgp golang.org/x/crypto/openpgp/armor golang.org/x/crypto/openpgp/elgamal @@ -711,12 +788,12 @@ golang.org/x/crypto/pkcs12 golang.org/x/crypto/pkcs12/internal/rc2 golang.org/x/crypto/ssh golang.org/x/crypto/ssh/internal/bcrypt_pbkdf -# golang.org/x/mod v0.5.1 +# golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 ## explicit; go 1.17 golang.org/x/mod/internal/lazyregexp golang.org/x/mod/module golang.org/x/mod/semver -# golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 +# golang.org/x/net v0.5.0 ## explicit; go 1.17 golang.org/x/net/context golang.org/x/net/context/ctxhttp @@ -726,28 +803,28 @@ golang.org/x/net/http2/hpack golang.org/x/net/idna golang.org/x/net/internal/timeseries golang.org/x/net/trace -# golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 -## explicit; go 1.11 +# golang.org/x/oauth2 v0.4.0 +## explicit; go 1.17 golang.org/x/oauth2 golang.org/x/oauth2/internal -# golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e +# golang.org/x/sys v0.4.0 ## explicit; go 1.17 golang.org/x/sys/cpu golang.org/x/sys/execabs -golang.org/x/sys/internal/unsafeheader golang.org/x/sys/unix -# golang.org/x/text v0.3.7 +# golang.org/x/text v0.6.0 ## explicit; go 1.17 golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm -# golang.org/x/tools v0.1.8 -## explicit; go 1.17 +# golang.org/x/tools v0.1.12 +## explicit; go 1.18 golang.org/x/tools/go/ast/astutil golang.org/x/tools/go/gcexportdata golang.org/x/tools/go/internal/gcimporter golang.org/x/tools/go/internal/packagesdriver +golang.org/x/tools/go/internal/pkgbits golang.org/x/tools/go/packages golang.org/x/tools/imports golang.org/x/tools/internal/event @@ -761,10 +838,6 @@ golang.org/x/tools/internal/imports golang.org/x/tools/internal/packagesinternal golang.org/x/tools/internal/typeparams golang.org/x/tools/internal/typesinternal -# golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 -## explicit; go 1.11 -golang.org/x/xerrors -golang.org/x/xerrors/internal # google.golang.org/appengine v1.6.7 ## explicit; go 1.11 google.golang.org/appengine @@ -783,7 +856,7 @@ google.golang.org/appengine/urlfetch # google.golang.org/genproto v0.0.0-20210629200056-84d6f6074151 ## explicit; go 1.11 google.golang.org/genproto/googleapis/rpc/status -# google.golang.org/grpc v1.50.1 +# google.golang.org/grpc v1.51.0 ## explicit; go 1.17 google.golang.org/grpc google.golang.org/grpc/attributes diff --git a/website/allowed-subcategories b/website/allowed-subcategories index 5f3045dd5c31..4c6be465d524 100644 --- a/website/allowed-subcategories +++ b/website/allowed-subcategories @@ -23,6 +23,7 @@ Confidential Ledger Connections Consumption Container +Container Apps Containers CosmosDB (DocumentDB) Cost Management @@ -47,6 +48,7 @@ Fluid Relay HDInsight Hardware Security Module Healthcare +Hybrid Compute IoT Central IoT Hub Key Vault @@ -65,6 +67,7 @@ Maps Media Messaging Mixed Reality +Mobile Network Monitor NetApp Network diff --git a/website/docs/d/bastion_host.html.markdown b/website/docs/d/bastion_host.html.markdown new file mode 100644 index 000000000000..f4d87b90595e --- /dev/null +++ b/website/docs/d/bastion_host.html.markdown @@ -0,0 +1,77 @@ +--- +subcategory: "Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_bastion_host" +description: |- + Gets information about an existing Bastion Host. + +--- + +# Data Source: azurerm_bastion_host + +Use this data source to access information about an existing Bastion Host. + +## Example Usage + +```hcl +data "azurerm_bastion_host" "example" { + name = "existing-bastion" + resource_group_name = "existing-resources" +} + +output "id" { + value = data.azurerm_bastion_host.example.id +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Bastion Host. + +* `resource_group_name` - (Required) The name of the Resource Group where the Bastion Host exists. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Bastion Host. + +* `location` - The Azure Region where the Bastion Host exists. + +* `copy_paste_enabled` - Is Copy/Paste feature enabled for the Bastion Host. + +* `file_copy_enabled` - Is File Copy feature enabled for the Bastion Host. + +* `sku` - The SKU of the Bastion Host. + +* `ip_configuration` - A `ip_configuration` block as defined below. + +* `ip_connect_enabled` - Is IP Connect feature enabled for the Bastion Host. + +* `scale_units` - The number of scale units provisioned for the Bastion Host. + +* `shareable_link_enabled` - Is Shareable Link feature enabled for the Bastion Host. + +* `tunneling_enabled` - Is Tunneling feature enabled for the Bastion Host. + +* `dns_name` - The FQDN for the Bastion Host. + +* `tags` - A mapping of tags assigned to the Bastion Host. + +--- + +A `ip_configuration` block supports the following: + +* `name` - The name of the IP configuration. + +* `subnet_id` - Reference to the subnet in which this Bastion Host has been created. + +* `public_ip_address_id` - Reference to a Public IP Address associated to this Bastion Host. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Bastion Host. diff --git a/website/docs/d/container_app_environment.html.markdown b/website/docs/d/container_app_environment.html.markdown new file mode 100644 index 000000000000..41affd6066cf --- /dev/null +++ b/website/docs/d/container_app_environment.html.markdown @@ -0,0 +1,71 @@ +--- +subcategory: "Container Apps" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_container_app_environment" +description: |- + Gets information about a Container App Environment. +--- + +# Data Source: azurerm_container_app_environment. + +Use this data source to access information about an existing Container App Environment. + +## Example Usage + +```hcl +data "azurerm_container_app_environment" "example" { + name = "example-environment" + resource_group_name = "example-resources" +} +``` + + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Container Apps Managed Environment. + +* `resource_group_name` - (Required) The name of the Resource Group where this Container App Environment exists. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Container App Environment. + +* `infrastructure_subnet_id` - The ID of the Subnet in use by the Container Apps Control Plane. + +~> **NOTE:** This will only be populated for Environments that have `internal_load_balancer_enabled` set to true. + +* `default_domain` - The default publicly resolvable name of this Container App Environment. This is generated at creation time to be globally unique. + +* `docker_bridge_cidr` - The network addressing in which the Container Apps in this Container App Environment will reside in CIDR notation. + +~> **NOTE:** This will only be populated for Environments that have `internal_load_balancer_enabled` set to true. + +* `internal_load_balancer_enabled` - Does the Container App Environment operate in Internal Load Balancing Mode? + +* `location` - The Azure Location where this Container App Environment exists. + +* `log_analytics_workspace_name` - The name of the Log Analytics Workspace this Container Apps Managed Environment is linked to. + +* `platform_reserved_cidr` - The IP range, in CIDR notation, that is reserved for environment infrastructure IP addresses. + +~> **NOTE:** This will only be populated for Environments that have `internal_load_balancer_enabled` set to true. + +* `platform_reserved_dns_ip_address` - The IP address from the IP range defined by `platform_reserved_cidr` that is reserved for the internal DNS server. + +~> **NOTE:** This will only be populated for Environments that have `internal_load_balancer_enabled` set to true. + +* `static_ip` - The Static IP of the Environment. + +~> **NOTE:** If `internal_load_balancer_enabled` is true, this will be a Private IP in the subnet, otherwise this will be allocated a Public IPv4 address. + +* `tags` - A mapping of tags assigned to the resource. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Container App Environment. diff --git a/website/docs/d/container_app_environment_certificate.html.markdown b/website/docs/d/container_app_environment_certificate.html.markdown new file mode 100644 index 000000000000..a48a97ca7d7d --- /dev/null +++ b/website/docs/d/container_app_environment_certificate.html.markdown @@ -0,0 +1,57 @@ +--- +subcategory: "Container Apps" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_container_app_environment_certificate" +description: |- + Gets information about a Container App Environment Certificate. +--- + +# Data Source: azurerm_container_app_environment_certificate. + +Use this data source to access information about an existing Container App Environment Certificate. + +## Example Usage + +```hcl +data "azurerm_container_app_environment" "example" { + name = "example-environment" + resource_group_name = "example-resources" +} + +data "azurerm_container_app_environment_certificate" "example" { + name = "mycertificate" + container_app_environment_id = data.azurerm_container_app_environment.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Container Apps Certificate. Changing this forces a new resource to be created. + +* `container_app_environment_id` - (Required) The ID of the Container App Environment to configure this Certificate on. Changing this forces a new resource to be created. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Container App Environment Certificate + +* `expiration_date` - The expiration date for the Certificate. + +* `issue_date` - The date of issue for the Certificate. + +* `issuer` - The Certificate Issuer. + +* `subject_name` - The Subject Name for the Certificate. + +* `thumbprint` - The Thumbprint of the Certificate. + +* `tags` - A mapping of tags assigned to the resource. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Container App Environment Certificate. diff --git a/website/docs/d/container_app_environment_dapr_component.html.markdown b/website/docs/d/container_app_environment_dapr_component.html.markdown new file mode 100644 index 000000000000..9c09eaba1564 --- /dev/null +++ b/website/docs/d/container_app_environment_dapr_component.html.markdown @@ -0,0 +1,76 @@ +--- +subcategory: "Container Apps" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_container_app_environment_dapr_component" +description: |- + Gets information about a Dapr Component in a Container App Environment. +--- + +# Data Source: azurerm_container_app_environment_dapr_component. + +## Example Usage + +```hcl +data "azurerm_container_app_environment" "example" { + name = "example-environment" + resource_group_name = "example-resources" +} + +resource "azurerm_container_app_environment_dapr_component" "example" { + name = "example-component" + container_app_environment_id = data.azurerm_container_app_environment.example.id + +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name for this Dapr component. Changing this forces a new resource to be created. + +* `container_app_environment_id` - (Required) The Container App Managed Environment ID to configure this Dapr component on. Changing this forces a new resource to be created. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Container App Environment Dapr Component + +* `ignore_errors` - Should the Dapr sidecar to continue initialisation if the component fails to load. Defaults to `false` + +* `init_timeout` - The component initialisation timeout in ISO8601 format. e.g. `5s`, `2h`, `1m`. Defaults to `5s` + +* `metadata` - A `metadata` block as detailed below. + +* `scopes` - A list of scopes to which this component applies. e.g. a Container App's `dapr.app_id` value. + +* `secret` - A `secret` block as detailed below. + +* `type` - The Dapr Component Type. + +* `version` - The version of the component. + +--- + +A `metadata` block exports the following: + +* `name` - The name of the Metadata configuration item. + +* `secret_name` - The name of a secret specified in the `secrets` block that contains the value for this metadata configuration item. + +* `value` - The value for this metadata configuration item. + +--- + +A `secret` block exports the following: + +* `name` - The secret name. + +* `value` - The value for this secret. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Container App Environment Dapr Component. diff --git a/website/docs/d/databricks_workspace.html.markdown b/website/docs/d/databricks_workspace.html.markdown index 5634f25d1bfc..0c01922ff9c5 100644 --- a/website/docs/d/databricks_workspace.html.markdown +++ b/website/docs/d/databricks_workspace.html.markdown @@ -40,12 +40,24 @@ output "databricks_workspace_id" { * `workspace_url` - URL this Databricks Workspace is accessible on. +* `managed_disk_identity` - A `managed_disk_identity` block as documented below. + * `storage_account_identity` - A `storage_account_identity` block as documented below. * `tags` - A mapping of tags to assign to the Databricks Workspace. --- +A `managed_disk_identity` block exports the following: + +* `principal_id` - The principal UUID for the internal databricks disks identity needed to provide access to the workspace for enabling Customer Managed Keys. + +* `tenant_id` - The UUID of the tenant where the internal databricks disks identity was created. + +* `type` - The type of the internal databricks disk identity. + +--- + A `storage_account_identity` block exports the following: * `principal_id` - The principal UUID for the internal databricks storage account needed to provide access to the workspace for enabling Customer Managed Keys. diff --git a/website/docs/d/hybrid_compute_machine.html.markdown b/website/docs/d/hybrid_compute_machine.html.markdown new file mode 100644 index 000000000000..6ea70c2df724 --- /dev/null +++ b/website/docs/d/hybrid_compute_machine.html.markdown @@ -0,0 +1,236 @@ +--- +subcategory: "Hybrid Compute" +layout: "azurerm" +page_title: "Azure Resource Manager: Data Source: azurerm_hybrid_compute_machine" +description: |- + Gets information about an existing hybrid compute machine. +--- + +# Data Source: azurerm_hybrid_compute_machine + +Use this data source to access information about an existing Hybrid Compute. + +## Example Usage + +```hcl +data "azurerm_hybrid_compute_machine" "example" { + name = "existing-hcmachine" + resource_group_name = "existing-rg" +} + +output "id" { + value = data.azurerm_hybrid_compute_machine.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of this hybrid compute machine. + +* `resource_group_name` - (Required) The name of the Resource Group where the Hybrid Compute exists. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the hybrid compute machine. + +* `ad_fqdn` - Specifies the AD fully qualified display name. + +* `agent_configuration` - A `agent_configuration` block as defined below. + +* `agent_version` - The hybrid machine agent full version. + +* `client_public_key` - Public Key that the client provides to be used during initial resource onboarding. + +* `cloud_metadata` - A `cloud_metadata` block as defined below. + +* `detected_properties` - A `detected_properties` block as defined below. + +* `display_name` - Specifies the hybrid machine display name. + +* `dns_fqdn` - Specifies the DNS fully qualified display name. + +* `domain_name` - Specifies the Windows domain name. + +* `error_details` - A `error_details` block as defined below. + +* `identity` - A `identity` block as defined below. + +* `last_status_change` - The time of the last status change. + +* `location` - The Azure Region where the hybrid compute machine exists. + +* `location_data` - A `location_data` block as defined below. + +* `machine_fqdn` - Specifies the hybrid machine fully qualified display name. + +* `mssql_discovered` - Specifies whether any MS SQL instance is discovered on the machine. + +* `os_name` - The Operating System running on the hybrid machine. + +* `os_profile` - A `os_profile` block as defined below. + +* `os_sku` - Specifies the Operating System product SKU. + +* `os_type` - The type of Operating System. Possible values are `windows` and `linux`. + +* `os_version` - The version of Operating System running on the hybrid machine. + +* `parent_cluster_resource_id` - The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + +* `private_link_scope_resource_id` - The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any. + +* `service_status` - A `service_status` block as defined below. + +* `status` - The status of the hybrid machine agent. + +* `tags` - A mapping of tags assigned to the Hybrid Compute. + +* `vm_id` - Specifies the hybrid machine unique ID. + +* `vm_uuid` - Specifies the Arc Machine's unique SMBIOS ID. + +--- + +A `additional_info` block exports the following: + +* `info` - The additional information message. + +* `type` - The additional information type. + +--- + +A `agent_configuration` block exports the following: + +* `extensions_allow_list` - A `extensions_allow_list` block as defined below. + +* `extensions_block_list` - A `extensions_block_list` block as defined below. + +* `extensions_enabled` - Specifies whether the extension service is enabled or disabled. + +* `guest_configuration_enabled` - Specified whether the guest configuration service is enabled or disabled. + +* `incoming_connections_ports` - Specifies the list of ports that the agent will be able to listen on. + +* `proxy_bypass` - List of service names which should not use the specified proxy server. + +* `proxy_url` - Specifies the URL of the proxy to be used. + +--- + +A `cloud_metadata` block exports the following: + +* `provider` - Specifies the cloud provider. For example `Azure`, `AWS` and `GCP`. + +--- + +A `error_details` block exports the following: + +* `additional_info` - A `additional_info` block as defined above. + +* `code` - The error code. + +* `message` - The error message. + +* `target` - The error target. + +--- + +A `extension_service` block exports the following: + +* `startup_type` - The behavior of the service when the Arc-enabled machine starts up. + +* `status` - The current status of the service. + +--- + +A `extensions_allow_list` block exports the following: + +* `publisher` - Publisher of the extension. + +* `type` - Type of the extension. + +--- + +A `extensions_block_list` block exports the following: + +* `publisher` - Publisher of the extension. + +* `type` - Type of the extension. + +--- + +A `guest_configuration_service` block exports the following: + +* `startup_type` - The behavior of the service when the Arc-enabled machine starts up. + +* `status` - The current status of the service. + +--- + +A `identity` block exports the following: + +* `principal_id` - The principal ID of resource identity. + +* `tenant_id` - The tenant ID of resource. + +* `type` - The identity type. + +--- + +A `linux_configuration` block exports the following: + +* `patch_settings` - A `patch_settings` block as defined below. + +--- + +A `location_data` block exports the following: + +* `city` - The city or locality where the resource is located. + +* `country_or_region` - The country or region where the resource is located. + +* `district` - The district, state, or province where the resource is located. + +* `name` - A canonical name for the geographic or physical location. + +--- + +A `os_profile` block exports the following: + +* `computer_name` - Specifies the host OS name of the hybrid machine. + +* `linux_configuration` - A `linux_configuration` block as defined above. + +* `windows_configuration` - A `windows_configuration` block as defined below. + +--- + +A `patch_settings` block exports the following: + +* `assessment_mode` - Specifies the assessment mode. + +* `patch_mode` - Specifies the patch mode. + +--- + +A `service_status` block exports the following: + +* `extension_service` - A `extension_service` block as defined above. + +* `guest_configuration_service` - A `guest_configuration_service` block as defined above. + +--- + +A `windows_configuration` block exports the following: + +* `patch_settings` - A `patch_settings` block as defined above. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Hybrid Compute. diff --git a/website/docs/d/key_vault_certificates.html.markdown b/website/docs/d/key_vault_certificates.html.markdown new file mode 100644 index 000000000000..5762f308a7fe --- /dev/null +++ b/website/docs/d/key_vault_certificates.html.markdown @@ -0,0 +1,60 @@ +--- +subcategory: "Key Vault" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_key_vault_certificates" +description: |- + Gets a list of certificate names from an existing Key Vault. +--- + +# Data Source: azurerm_key_vault_certificates + +Use this data source to retrieve a list of certificate names from an existing Key Vault. + +## Example Usage + +```hcl +data "azurerm_key_vault_certificates" "example" { + key_vault_id = data.azurerm_key_vault.existing.id +} + +data "azurerm_key_vault_certificate" "example" { + for_each = toset(data.azurerm_key_vault_certificates.example.names) + name = each.key + key_vault_id = data.azurerm_key_vault.existing.id +} + +``` + +## Argument Reference + +The following arguments are supported: + +* `key_vault_id` - Specifies the ID of the Key Vault instance to fetch certificate names from, available on the `azurerm_key_vault` Data Source / Resource. + +**NOTE:** The vault must be in the same subscription as the provider. If the vault is in another subscription, you must create an aliased provider for that subscription. + +* `include_pending` - Specifies whether to include certificates which are not completely provisioned. Defaults to true. + +## Attributes Reference + +In addition to the arguments above, the following attributes are exported: + +* `names` - List containing names of certificates that exist in this Key Vault. + +* `key_vault_id` - The Key Vault ID. + +* `certificates` - One or more `certificates` blocks as defined below. + +--- + +A `certificates` block supports following: + +* `name` - The name of secret. + +* `enabled` - Whether this secret is enabled. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Key Vault Certificates. diff --git a/website/docs/d/key_vault_secrets.html.markdown b/website/docs/d/key_vault_secrets.html.markdown index bdef8fa82dae..ab9d89b8407a 100644 --- a/website/docs/d/key_vault_secrets.html.markdown +++ b/website/docs/d/key_vault_secrets.html.markdown @@ -39,6 +39,18 @@ In addition to the Argument listed above - the following Attributes are exported * `names` - List containing names of secrets that exist in this Key Vault. +* `secrets` - One or more `secrets` blocks as defined below. + +--- + +A `secrets` block supports following: + +* `name` - The name of secret. + +* `enabled` - Whether this secret is enabled. + +* `id` - The ID of this secret. + ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: diff --git a/website/docs/d/kubernetes_cluster.html.markdown b/website/docs/d/kubernetes_cluster.html.markdown index 5f56663cb3ab..97031973b07e 100644 --- a/website/docs/d/kubernetes_cluster.html.markdown +++ b/website/docs/d/kubernetes_cluster.html.markdown @@ -56,6 +56,8 @@ The following attributes are exported: * `ingress_application_gateway` - An `ingress_application_gateway` block as documented below. +* `key_management_service` - A `key_management_service` block as documented below. + * `key_vault_secrets_provider` - A `key_vault_secrets_provider` block as documented below. * `private_fqdn` - The FQDN of this Kubernetes Cluster when private link has been enabled. This name is only resolvable inside the Virtual Network where the Azure Kubernetes Service is located @@ -178,6 +180,14 @@ A `upgrade_settings` block exports the following: --- +A `key_management_service` block supports the following: + +* `key_vault_key_id` - Identifier of Azure Key Vault key. See [key identifier format](https://learn.microsoft.com/en-us/azure/key-vault/general/about-keys-secrets-certificates#vault-name-and-object-name) for more details. + +* `key_vault_network_access` - Network access of the key vault. The possible values are `Public` and `Private`. `Public` means the key vault allows public access from all networks. `Private` means the key vault disables public access and enables private link. + +--- + A `key_vault_secrets_provider` block exports the following: * `secret_rotation_enabled` - Is secret rotation enabled? diff --git a/website/docs/d/mobile_network.html.markdown b/website/docs/d/mobile_network.html.markdown new file mode 100644 index 000000000000..f3b6bf36b9b0 --- /dev/null +++ b/website/docs/d/mobile_network.html.markdown @@ -0,0 +1,59 @@ +--- +subcategory: "Mobile Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_mobile_network" +description: |- + Get information about an Azure Mobile Network. +--- + +# azurerm_mobile_network + +Get information about an Azure Mobile Network. + +## Example Usage + +```hcl + +data "azurerm_mobile_network" "example" { + name = "example-mn" + resource_group_name = azurerm_resource_group.example.name +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - Specifies the name which should be used for this Mobile Network. + +* `resource_group_name` - Specifies the name of the Resource Group where the Mobile Network should exist. + +--- + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Mobile Network. + +* `location` - The Azure Region where the Mobile Network should exist. Changing this forces a new Mobile Network to be created. + +* `mobile_country_code` - Mobile country code (MCC), defined in https://www.itu.int/rec/T-REC-E.212 . + +* `mobile_network_code` - Mobile network code (MNC), defined in https://www.itu.int/rec/T-REC-E.212 . + +* `tags` - A mapping of tags which should be assigned to the Mobile Network. + +* `service_key` - The mobile network resource identifier. + +--- + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Mobile Network. + +## Import + +Mobile Network can be imported using the `resource id`, e.g. diff --git a/website/docs/d/mobile_network_service.html.markdown b/website/docs/d/mobile_network_service.html.markdown new file mode 100644 index 000000000000..fd52d85a2a6b --- /dev/null +++ b/website/docs/d/mobile_network_service.html.markdown @@ -0,0 +1,129 @@ +--- +subcategory: "Mobile Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_mobile_network_service" +description: |- + Get information about a Mobile Network Service. +--- + +# azurerm_mobile_network_service + +Get information about a Mobile Network Service. + +## Example Usage + +```hcl +data "azurerm_mobile_network" "example" { + name = "example-mn" + resource_group_name = "example-rg" +} + +resource "azurerm_mobile_network_service" "example" { + name = "example-mns" + mobile_network_id = data.azurerm_mobile_network.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name which should be used for this Mobile Network Service. + +* `mobile_network_id` - (Required) Specifies the ID of the Mobile Network Service. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Mobile Network Service. + +* `location` - The Azure Region where the Mobile Network Service should exist. + +* `service_precedence` - A precedence value that is used to decide between services when identifying the QoS values to use for a particular SIM. A lower value means a higher priority. + +* `pcc_rule` - A `pcc_rule` block as defined below. The set of PCC Rules that make up this service. + +* `service_qos_policy` - A `service_qos_policy` block as defined below. The QoS policy to use for packets matching this service. + +* `tags` - A mapping of tags which should be assigned to the Mobile Network Service. + +--- + +A `pcc_rule` block supports the following: + +* `name` - The name of the rule. This must be unique within the parent service. + +* `precedence` - A precedence value that is used to decide between data flow policy rules when identifying the QoS values to use for a particular SIM. A lower value means a higher priority. + +* `qos_policy` - A `rule_qos_policy` block as defined below. The QoS policy to use for packets matching this rule. + +* `service_data_flow_template` - A `service_data_flow_template` block as defined below. The set of service data flow templates to use for this PCC rule. + +* `traffic_control_enabled` - Determines whether flows that match this data flow policy rule are permitted. + +--- + +A `rule_qos_policy` block supports the following: + +* `allocation_and_retention_priority_level` - QoS Flow allocation and retention priority (ARP) level. Flows with higher priority preempt flows with lower priority. + +* `qos_indicator` - The QoS Indicator (5QI for 5G network /QCI for 4G net work) value identifies a set of QoS characteristics that control QoS forwarding treatment for QoS flows or EPS bearers. + +* `guaranteed_bit_rate` - A `guaranteed_bit_rate` block as defined below. The Guaranteed Bit Rate (GBR) for all service data flows that use this PCC Rule. + +* `maximum_bit_rate` - A `maximum_bit_rate` block as defined below. The Maximum Bit Rate (MBR) for all service data flows that use this PCC Rule or Service. + +* `preemption_capability` - The Preemption Capability of a QoS Flow controls whether it can preempt another QoS Flow with a lower priority level. See 3GPP TS23.501 section 5.7.2.2 for a full description of the ARP parameters. + +* `preemption_vulnerability` - The Preemption Vulnerability of a QoS Flow controls whether it can be preempted by QoS Flow with a higher priority level. See 3GPP TS23.501 section 5.7.2.2 for a full description of the ARP parameters. + +--- + +A `guaranteed_bit_rate` block supports the following: + +* `downlink` - Downlink bit rate. + +* `uplink` - Uplink bit rate. + +--- + +A `service_data_flow_template` block supports the following: + +* `name` - The name of the data flow template. This must be unique within the parent data flow policy rule. + +* `direction` - The direction of this flow. Possible values are `Uplink`, `Downlink` and `Bidirectional`. + +* `protocol` - A list of the allowed protocol(s) for this flow. + +* `remote_ip_list` - The remote IP address(es) to which UEs will connect for this flow. + +* `ports` - The port(s) to which UEs will connect for this flow. You can specify zero or more ports or port ranges. + +--- + +A `service_qos_policy` block supports the following: + +* `allocation_and_retention_priority_level` - QoS Flow allocation and retention priority (ARP) level. + +* `qos_indicator` - The QoS Indicator (5QI for 5G network /QCI for 4G net work) value identifies a set of QoS characteristics that control QoS forwarding treatment for QoS flows or EPS bearers. + +* `maximum_bit_rate` - A `maximum_bit_rate` block as defined below. The Maximum Bit Rate (MBR) for all service data flows that use this PCC Rule or Service. + +* `preemption_capability` - The Preemption Capability of a QoS Flow controls whether it can preempt another QoS Flow with a lower priority level. See 3GPP TS23.501 section 5.7.2.2 for a full description of the ARP parameters. + +* `preemption_vulnerability` - The Preemption Vulnerability of a QoS Flow controls whether it can be preempted by QoS Flow with a higher priority level. See 3GPP TS23.501 section 5.7.2.2 for a full description of the ARP parameters. + +--- + +A `maximum_bit_rate` block supports the following: + +* `downlink` - Downlink bit rate. + +* `uplink` - Uplink bit rate. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Mobile Network Service. diff --git a/website/docs/d/mobile_network_sim_group.html.markdown b/website/docs/d/mobile_network_sim_group.html.markdown new file mode 100644 index 000000000000..cb9ee1d8679a --- /dev/null +++ b/website/docs/d/mobile_network_sim_group.html.markdown @@ -0,0 +1,64 @@ +--- +subcategory: "Mobile Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_mobile_network_sim_group" +description: |- + Get information about a Mobile Network Sim Group. +--- + +# azurerm_mobile_network_sim_group + +Get information about a Mobile Network Sim Group. + +## Example Usage + +```hcl +data "azurerm_mobile_network" "example" { + name = "example-mn" + resource_group_name = azurerm_resource_group.example.name +} + +data "azurerm_mobile_network_sim_group" "example" { + name = "example-mnsg" + mobile_network_id = data.azurerm_mobile_network.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name which should be used for this Mobile Network Sim Groups. + +* `mobile_network_id` - (Required) The ID of Mobile Network which the Mobile Network Sim Group belongs to. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Mobile Network Sim Groups. + +* `location` - The Azure Region where the Mobile Network Sim Groups should exist. + +* `encryption_key_url` - A key to encrypt the SIM data that belongs to this SIM group. + +* `identity` - An `identity` block as defined below. + +-> **NOTE:** A `UserAssigned` identity must be specified when `encryption_key_url` is specified. + +* `tags` - A mapping of tags which should be assigned to the Mobile Network Sim Groups. + +--- + +An `identity` block supports the following: + +* `type` - The type of Managed Service Identity. Possible values are `SystemAssigned`, `UserAssigned`. + +* `identity_ids` - A list of IDs for User Assigned Managed Identity resources to be assigned. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Mobile Network Sim Groups. + diff --git a/website/docs/d/mobile_network_site.html.markdown b/website/docs/d/mobile_network_site.html.markdown new file mode 100644 index 000000000000..52210e8f6542 --- /dev/null +++ b/website/docs/d/mobile_network_site.html.markdown @@ -0,0 +1,51 @@ +--- +subcategory: "Mobile Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_mobile_network_site" +description: |- + Get information about a Mobile Network Site. +--- + +# azurerm_mobile_network_site + +Get information about a Mobile Network Site. + +## Example Usage + +```hcl +data "azurerm_mobile_network" "example" { + name = "example-mn" + resource_group_name = "example-rg" +} + +data "azurerm_mobile_network_site" "example" { + name = "example-mns" + mobile_network_id = data.azurerm_mobile_network.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name which should be used for this Mobile Network Site. + +* `mobile_network_id` - (Required) the ID of the Mobile Network which the Mobile Network Site belongs to. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Mobile Network Site. + +* `network_function_ids` - An array of Id of Network Functions deployed on the site. + +* `location` - The Azure Region where the Mobile Network Site should exist. + +* `tags` - A mapping of tags which should be assigned to the Mobile Network Site. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Mobile Network Site. diff --git a/website/docs/d/mobile_network_slice.html.markdown b/website/docs/d/mobile_network_slice.html.markdown new file mode 100644 index 000000000000..555d58f051e5 --- /dev/null +++ b/website/docs/d/mobile_network_slice.html.markdown @@ -0,0 +1,63 @@ +--- +subcategory: "Mobile Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_mobile_network_slice" +description: |- + Get information about a Mobile Network Slice. +--- + +# azurerm_mobile_network_slice + +Get information about a Mobile Network Slice. + +## Example Usage + +```hcl +data "azurerm_mobile_network" "example" { + name = "example-mn" + resource_group_name = "example-rg" +} + +data "azurerm_mobile_network_slice" "example" { + name = "example-mns" + mobile_network_id = data.azurerm_mobile_network.test.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name which should be used for this Mobile Network Slice. + +* `mobile_network_id` - (Required) The ID of Mobile Network which the Mobile Network Slice belongs to. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Mobile Network Slice. + +* `location` - The Azure Region where the Mobile Network Slice exists. + +* `single_network_slice_selection_assistance_information` - A `single_network_slice_selection_assistance_information` block as defined below. Single-network slice selection assistance information (S-NSSAI). + +* `description` - A description of this Mobile Network Slice. + +* `tags` - A mapping of tags which are assigned to the Mobile Network Slice. + +--- + +A `single_network_slice_selection_assistance_information` block supports the following: + +* `slice_differentiator` - Slice differentiator (SD). + +* `slice_service_type` - Slice/service type (SST). + + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Mobile Network Slice. + diff --git a/website/docs/d/policy_definition.html.markdown b/website/docs/d/policy_definition.html.markdown index b4ed35775357..703a3d022b56 100644 --- a/website/docs/d/policy_definition.html.markdown +++ b/website/docs/d/policy_definition.html.markdown @@ -28,7 +28,7 @@ output "id" { * `display_name` - Specifies the display name of the Policy Definition. Conflicts with `name`. -~> **NOTE** As `display_name` is not unique errors may occur when there are multiple policy definitions with same display name. +~> **NOTE** Looking up policies by `display_name` is not recommended by the Azure Policy team as the property is not unique nor immutable. As such errors may occur when there are multiple policy definitions with same display name or the display name is changed. To avoid these types of errors you may wish to use the `name` property instead. * `management_group_name` - (Optional) Only retrieve Policy Definitions from this Management Group. @@ -50,6 +50,8 @@ output "id" { * `metadata` - Any Metadata defined in the Policy. +* `mode` - The Mode of the Policy. + ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: diff --git a/website/docs/d/policy_definition_built_in.html.markdown b/website/docs/d/policy_definition_built_in.html.markdown new file mode 100644 index 000000000000..b7605346154a --- /dev/null +++ b/website/docs/d/policy_definition_built_in.html.markdown @@ -0,0 +1,59 @@ +--- +subcategory: "Policy" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_policy_definition_built_in" +description: |- + Get information about a Built-In Policy Definition. +--- + +# Data Source: azurerm_policy_definition_built_in + +Use this data source to access information about a Built-In Policy Definition. Retrieves Policy Definitions from your current subscription by default. + +## Example Usage + +```hcl +data "azurerm_policy_definition_built_in" "example" { + display_name = "Allowed resource types" +} + +output "id" { + value = data.azurerm_policy_definition_built_in.example.id +} +``` + +## Argument Reference + +* `name` - Specifies the name of the Policy Definition. Conflicts with `display_name`. + +* `display_name` - Specifies the display name of the Policy Definition. Conflicts with `name`. + +~> **NOTE** As `display_name` is not unique errors may occur when there are multiple policy definitions with same display name. + +* `management_group_name` - (Optional) Only retrieve Policy Definitions from this Management Group. + +## Attributes Reference + +* `id` - The ID of the Policy Definition. + +* `type` - The Type of Policy. + +* `description` - The Description of the Policy. + +* `policy_type` - The Type of the Policy. Possible values are `BuiltIn`, `Custom` and `NotSpecified`. + +* `policy_rule` - The Rule as defined (in JSON) in the Policy. + +* `role_definition_ids` - A list of role definition id extracted from `policy_rule` required for remediation. + +* `parameters` - Any Parameters defined in the Policy. + +* `metadata` - Any Metadata defined in the Policy. + +* `mode` - The Mode of the Policy. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Policy Definition. diff --git a/website/docs/d/private_dns_resolver.html.markdown b/website/docs/d/private_dns_resolver.html.markdown index ff1eccebebf5..9948374e4f06 100644 --- a/website/docs/d/private_dns_resolver.html.markdown +++ b/website/docs/d/private_dns_resolver.html.markdown @@ -21,26 +21,26 @@ data "azurerm_private_dns_resolver" "test" { ## Arguments Reference -The following arguments are required: +The following arguments are supported: -* `name` - Name of the Private DNS Resolver. +* `name` - (Required) Name of the Private DNS Resolver. -* `resource_group_name` - Name of the Resource Group where the Private DNS Resolver exists. +* `resource_group_name` - (Required) Name of the Resource Group where the Private DNS Resolver exists. ## Attributes Reference In addition to the Arguments listed above - the following Attributes are exported: -* `id` - ID of the DNS Resolver. +* `id` - The ID of the DNS Resolver. -* `location` - Azure Region where the Private DNS Resolver exists. +* `location` - The Azure Region where the Private DNS Resolver exists. -* `virtual_network_id` - ID of the Virtual Network that is linked to the Private DNS Resolver. +* `virtual_network_id` - The ID of the Virtual Network that is linked to the Private DNS Resolver. -* `tags` - Mapping of tags which should be assigned to the Private DNS Resolver. +* `tags` - The tags assigned to the Private DNS Resolver. ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: -* `read` - (Defaults to 5 minutes) Used when retrieving the Private DNS SRV Record. +* `read` - (Defaults to 5 minutes) Used when retrieving the Private DNS Resolver. diff --git a/website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown b/website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown index d940c2f401f4..ee5dc442425d 100644 --- a/website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown +++ b/website/docs/d/private_dns_resolver_inbound_endpoint.html.markdown @@ -13,7 +13,7 @@ Gets information about an existing Private DNS Resolver Inbound Endpoint. ## Example Usage ```hcl -resource "azurerm_private_dns_resolver_inbound_endpoint" "example" { +data "azurerm_private_dns_resolver_inbound_endpoint" "example" { name = "example-drie" private_dns_resolver_id = "example-private-dns-resolver-id" } diff --git a/website/docs/d/site_recovery_replication_recovery_plan.html.markdown b/website/docs/d/site_recovery_replication_recovery_plan.html.markdown new file mode 100644 index 000000000000..b2ca7d6e7c37 --- /dev/null +++ b/website/docs/d/site_recovery_replication_recovery_plan.html.markdown @@ -0,0 +1,84 @@ +--- +subcategory: "Recovery Services" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_site_recovery_replication_recovery_plan" +description: |- + Get information about an Azure Site Recovery Plan within a Recovery Services vault. +--- + +# azurerm_site_recovery_replication_recovery_plan + +Get information about an Azure Site Recovery Plan within a Recovery Services vault. A recovery plan gathers machines into recovery groups for the purpose of failover. + +## Example Usage + +```hcl +data "azurerm_recovery_services_vault" "vault" { + name = "tfex-recovery_vault" + resource_group_name = "tfex-resource_group" +} + +data "azurerm_site_recovery_replication_recovery_plan" "example" { + name = "example-recovery-plan" + recovery_vault_id = data.azurerm_recovery_services_vault.vault.id +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Replication Plan. + +* `recovery_vault_id` - (Required) The ID of the vault that should be updated. + + +## Attributes Reference + +In addition to the arguments above, the following attributes are exported: + +* `id` - The ID of the Site Recovery Fabric. + +* `source_recovery_fabric_id` - The ID of source fabric to be recovered from. + +* `target_recovery_fabric_id` - The ID of target fabric to recover. + +* `recovery_group` - `recovery_group` block defined as below. +--- + +A `recovery_groups` block supports the following: + +* `type` - The Recovery Plan Group Type. Possible values are `Boot`, `Failover` and `Shutdown`. + +* `replicated_protected_items` - one or more id of protected VM. + +* `pre_action` - one or more `action` block. which will be executed before the group recovery. + +* `post_action` - one or more `action` block. which will be executed after the group recovery. + +--- + +An `action` block supports the following: + +* `name` - Name of the Action. + +* `type` - Type of the action detail. + +* `fail_over_directions` - Directions of fail over. + +* `fail_over_types` - Types of fail over. + +* `fabric_location` - The fabric location of runbook or script. + +* `runbook_id` - Id of runbook. + +* `manual_action_instruction` - Instructions of manual action. + +* `script_path` - Path of action script. + + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Site Recovery Replication Plan. diff --git a/website/docs/d/storage_management_policy.html.markdown b/website/docs/d/storage_management_policy.html.markdown index 548f8aeb4786..1f2b273f87ec 100644 --- a/website/docs/d/storage_management_policy.html.markdown +++ b/website/docs/d/storage_management_policy.html.markdown @@ -67,7 +67,7 @@ The following arguments are supported: * `tier_to_cool_after_days_since_last_access_time_greater_than` - The age in days after last access time to tier blobs to cool storage. Supports blob currently at Hot tier. * `tier_to_archive_after_days_since_modification_greater_than` - The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool tier. * `tier_to_archive_after_days_since_last_access_time_greater_than` - The age in days after last access time to tier blobs to archive storage. Supports blob currently at Hot or Cool tier. -* `tier_to_archive_after_days_since_last_tier_change_greater_than` - The age in days after last tier change to the blobs to skip to be archved. +* `tier_to_archive_after_days_since_last_tier_change_greater_than` - The age in days after last tier change to the blobs to skip to be archived. * `delete_after_days_since_modification_greater_than` - The age in days after last modification to delete the blob. * `delete_after_days_since_last_access_time_greater_than` - The age in days after last access time to delete the blob. @@ -76,7 +76,7 @@ The following arguments are supported: `snapshot` supports the following: * `change_tier_to_archive_after_days_since_creation` - The age in days after creation to tier blob snapshot to archive storage. -* `tier_to_archive_after_days_since_last_tier_change_greater_than` - The age in days after last tier change to the blobs to skip to be archved. +* `tier_to_archive_after_days_since_last_tier_change_greater_than` - The age in days after last tier change to the blobs to skip to be archived. * `change_tier_to_cool_after_days_since_creation` - The age in days after creation to tier blob snapshot to cool storage. * `delete_after_days_since_creation_greater_than` - The age in days after creation to delete the blob snapshot. @@ -85,7 +85,7 @@ The following arguments are supported: `version` supports the following: * `change_tier_to_archive_after_days_since_creation` - The age in days after creation to tier blob version to archive storage. -* `tier_to_archive_after_days_since_last_tier_change_greater_than` - The age in days after last tier change to the blobs to skip to be archved. +* `tier_to_archive_after_days_since_last_tier_change_greater_than` - The age in days after last tier change to the blobs to skip to be archived. * `change_tier_to_cool_after_days_since_creation` - The age in days after creation to tier blob version to cool storage. * `delete_after_days_since_creation` - The age in days after creation to delete the blob version. diff --git a/website/docs/d/virtual_desktop_host_pool.html.markdown b/website/docs/d/virtual_desktop_host_pool.html.markdown new file mode 100644 index 000000000000..91decd91f25c --- /dev/null +++ b/website/docs/d/virtual_desktop_host_pool.html.markdown @@ -0,0 +1,86 @@ +--- +subcategory: "Desktop Virtualization" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_virtual_desktop_host_pool" +description: |- + Gets information about an existing Virtual Desktop Host Pool. +--- + +# Data Source: azurerm_virtual_desktop_host_pool + +Use this data source to access information about an existing Virtual Desktop Host Pool. + +## Example Usage + +```hcl + +data "azurerm_virtual_desktop_host_pool" "example" { + name = "example-pool" + resource_group_name = "example-resources" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Virtual Desktop Host Pool to retrieve. + +* `resource_group_name` - (Required) The name of the resource group where the Virtual Desktop Host Pool exists. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Virtual Desktop Host Pool. + +* `location` - The location/region where the Virtual Desktop Host Pool is located. + +* `type` - The type of the Virtual Desktop Host Pool. + +* `load_balancer_type` - The type of load balancing performed by the Host Pool + +* `friendly_name` - The friendly name for the Virtual Desktop Host Pool. + +* `description` - The description for the Virtual Desktop Host Pool. + +* `validate_environment` - Returns `true` if the Host Pool is in Validation mode. + +* `start_vm_on_connect` - Returns `true` if the Start VM on Connection Feature is enabled. + +* `custom_rdp_properties` - The custom RDP properties string for the Virtual Desktop Host Pool. + +* `personal_desktop_assignment_type` - The type of personal desktop assignment in use by the Host Pool + +* `maximum_sessions_allowed` - The maximum number of users that can have concurrent sessions on a session host. + +* `preferred_app_group_type` - The preferred Application Group type for the Virtual Desktop Host Pool. + +* `scheduled_agent_updates` - A `scheduled_agent_updates` block as defined below. + +* `tags` - A mapping of tags to assign to the resource. + +--- + +A `scheduled_agent_updates` block exports the following: + +* `enabled` - Are scheduled updates of the AVD agent components (RDAgent, Geneva Monitoring agent, and side-by-side stack) enabled on session hosts. +* `timezone` - The time zone in which the agent update schedule will apply. +* `use_session_host_timezone` - Specifies whether scheduled agent updates should be applied based on the timezone of the affected session host. +* `schedule` - A `schedule` block as defined below. + +--- + +A `schedule` block exports the following: + +* `day_of_week` - The day of the week on which agent updates should be performed. +* `hour_of_day` - The hour of day the update window should start. + +--- + + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Virtual Desktop Host Pool. diff --git a/website/docs/d/virtual_hub_route_table.html.markdown b/website/docs/d/virtual_hub_route_table.html.markdown index 004aa40bb4d9..8dbb13ea7dcc 100644 --- a/website/docs/d/virtual_hub_route_table.html.markdown +++ b/website/docs/d/virtual_hub_route_table.html.markdown @@ -16,6 +16,7 @@ Uses this data source to access information about an existing Virtual Hub Route data "azurerm_virtual_hub_route_table" "example" { name = "example-hub-route-table" resource_group_name = "example-resources" + virtual_hub_name = "example-hub-name" } output "virtual_hub_route_table_id" { @@ -30,6 +31,7 @@ The following arguments are supported: * `name` - The name of the Virtual Hub Route Table. * `resource_group_name` - The Name of the Resource Group where the Virtual Hub Route Table exists. +* `virtual_hub_name` - The name which should be used for Virtual Hub Route Table. ## Attributes Reference diff --git a/website/docs/d/virtual_network_gateway.html.markdown b/website/docs/d/virtual_network_gateway.html.markdown index ec7fc93e2765..3b727fd80468 100644 --- a/website/docs/d/virtual_network_gateway.html.markdown +++ b/website/docs/d/virtual_network_gateway.html.markdown @@ -141,12 +141,6 @@ The `root_certificate` block supports: authority. The certificate must be provided in Base-64 encoded X.509 format (PEM). -The `root_revoked_certificate` block supports: - -* `name` - The user-defined name of the revoked certificate. - -* `public_cert_data` - The SHA1 thumbprint of the certificate to be revoked. - ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: diff --git a/website/docs/guides/3.0-upgrade-guide.html.markdown b/website/docs/guides/3.0-upgrade-guide.html.markdown index 08f6de15c69e..4cc96679d7e6 100644 --- a/website/docs/guides/3.0-upgrade-guide.html.markdown +++ b/website/docs/guides/3.0-upgrade-guide.html.markdown @@ -216,7 +216,7 @@ Below we'll cover each of the Data Sources and Resources which will be affected ### Data Source: `azurerm_app_service` -The `azurerm_app_service` data source has been superseded by the `azurerm_linux_function_app` and `azurerm_windows_web_app` data sources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider. +The `azurerm_app_service` data source has been superseded by the `azurerm_linux_web_app` and `azurerm_windows_web_app` data sources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider. ### Data Source: `azurerm_app_service_plan` diff --git a/website/docs/guides/managed_service_identity.html.markdown b/website/docs/guides/managed_service_identity.html.markdown index b9b34e87b817..ab67014ddf65 100644 --- a/website/docs/guides/managed_service_identity.html.markdown +++ b/website/docs/guides/managed_service_identity.html.markdown @@ -57,8 +57,8 @@ data "azurerm_role_definition" "contributor" { resource "azurerm_role_assignment" "example" { name = azurerm_virtual_machine.example.name - scope = data.azurerm_subscription.primary.id - role_definition_id = "${data.azurerm_subscription.subscription.id}${data.azurerm_role_definition.contributor.id}" + scope = data.azurerm_subscription.current.id + role_definition_id = "${data.azurerm_subscription.current.id}${data.azurerm_role_definition.contributor.id}" principal_id = azurerm_virtual_machine.example.identity[0].principal_id } ``` diff --git a/website/docs/guides/service_principal_client_certificate.html.markdown b/website/docs/guides/service_principal_client_certificate.html.markdown index f3d1068dfc28..e550bb319422 100644 --- a/website/docs/guides/service_principal_client_certificate.html.markdown +++ b/website/docs/guides/service_principal_client_certificate.html.markdown @@ -32,31 +32,25 @@ This guide will cover how to generate a client certificate, how to create an App ## Generating a Client Certificate -Firstly we need to create a certificate which can be used for authentication. To do that we're going to generate a Certificate Signing Request (also known as a CSR) using `openssl` (this can also be achieved using PowerShell, however, that's outside the scope of this document): +Firstly we need to create a certificate which can be used for authentication. To do that we're going to generate a private key and self-signed certificate using OpenSSL or LibreSSL (this can also be achieved using PowerShell, however that's outside the scope of this document): ```shell -openssl req -newkey rsa:4096 -nodes -keyout "service-principal.key" -out "service-principal.csr" +$ openssl req -subj '/CN=myclientcertificate/O=MyCompany, Inc./ST=CA/C=US' \ + -new -newkey rsa:4096 -sha256 -days 730 -nodes -x509 -keyout client.key -out client.crt ``` --> During the generation of the certificate you'll be prompted for various bits of information required for the certificate signing request - at least one item has to be specified for this to complete. - -We can now sign that Certificate Signing Request, in this example we're going to self-sign this certificate using the Key we just generated; however it's also possible to do this using a Certificate Authority. In order to do that we're again going to use `openssl`: - -```shell -openssl x509 -signkey "service-principal.key" -in "service-principal.csr" -req -days 365 -out "service-principal.crt" -``` - -Finally we can generate a PFX file which can be used to authenticate with Azure: +Next we generate a PKCS#12 bundle (.pfx file) which can be used by the AzureRM provider to authenticate with Azure: ```shell -openssl pkcs12 -export -out "service-principal.pfx" -inkey "service-principal.key" -in "service-principal.crt" +# note: the password is intentionally quoted for shell compatibility, the value does not include the quotes +$ openssl pkcs12 -export -password pass:"Pa55w0rd123" -out client.pfx -inkey client.key -in client.crt ``` Now that we've generated a certificate, we can create the Azure Active Directory Application. --- -### Creating the Application and Service Principal +## Creating the Application and Service Principal We're going to create the Application in the Azure Portal - to do this navigate to [the **Azure Active Directory** overview](https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Overview) within the Azure Portal - [then select the **App Registration** blade](https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps/RegisteredApps/Overview). Click the **New registration** button at the top to add a new Application within Azure Active Directory. On this page, set the following values then press **Create**: @@ -86,18 +80,50 @@ At this point the newly created Azure Active Directory Application should be ass --- -### Configuring the Service Principal in Terraform +## Configuring Terraform to use the Client Certificate -As we've obtained the credentials for this Service Principal - it's possible to configure them in a few different ways. +Now that we have our Client Certificate uploaded to Azure and ready to use, it's possible to configure Terraform in a few different ways. -When storing the credentials as Environment Variables, for example: +The provider can be configured to read the certificate bundle from the .pfx file in your filesystem, or alternatively you can pass a base64-encoded copy of the certificate bundle directly to the provider. -```bash -export ARM_CLIENT_ID="00000000-0000-0000-0000-000000000000" -export ARM_CLIENT_CERTIFICATE_PATH="/path/to/my/client/certificate.pfx" -export ARM_CLIENT_CERTIFICATE_PASSWORD="Pa55w0rd123" -export ARM_SUBSCRIPTION_ID="00000000-0000-0000-0000-000000000000" -export ARM_TENANT_ID="00000000-0000-0000-0000-000000000000" +### Environment Variables + +Our recommended approach is storing the credentials as Environment Variables, for example: + +*Reading the certificate bundle from the filesystem* +```shell-session +# sh +$ export ARM_CLIENT_ID="00000000-0000-0000-0000-000000000000" +$ export ARM_CLIENT_CERTIFICATE_PATH="/path/to/my/client/certificate.pfx" +$ export ARM_CLIENT_CERTIFICATE_PASSWORD="Pa55w0rd123" +$ export ARM_TENANT_ID="10000000-0000-0000-0000-000000000000" +$ export ARM_SUBSCRIPTION_ID="20000000-0000-0000-0000-000000000000" +``` +```powershell +# PowerShell +> $env:ARM_CLIENT_ID = "00000000-0000-0000-0000-000000000000" +> $env:ARM_CLIENT_CERTIFICATE_PATH = "C:\Users\myusername\Documents\my\client\certificate.pfx" +> $env:ARM_CLIENT_CERTIFICATE_PASSWORD = "Pa55w0rd123" +> $env:ARM_TENANT_ID = "10000000-0000-0000-0000-000000000000" +> $env:ARM_SUBSCRIPTION_ID = "20000000-0000-0000-0000-000000000000" +``` + +*Passing the encoded certificate bundle directly* +```shell-session +# sh +$ export ARM_CLIENT_ID="00000000-0000-0000-0000-000000000000" +$ export ARM_CLIENT_CERTIFICATE="$(base64 /path/to/my/client/certificate.pfx)" +$ export ARM_CLIENT_CERTIFICATE_PASSWORD="Pa55w0rd123" +$ export ARM_TENANT_ID="10000000-0000-0000-0000-000000000000" +$ export ARM_SUBSCRIPTION_ID="20000000-0000-0000-0000-000000000000" +``` +```powershell +# PowerShell +> $env:ARM_CLIENT_ID = "00000000-0000-0000-0000-000000000000" +> $env:ARM_CLIENT_CERTIFICATE = [Convert]::ToBase64String([System.IO.File]::ReadAllBytes("C:\Users\myusername\Documents\my\client\certificate.pfx")) +> $env:ARM_CLIENT_CERTIFICATE_PASSWORD = "Pa55w0rd123" +> $env:ARM_TENANT_ID = "10000000-0000-0000-0000-000000000000" +> $env:ARM_SUBSCRIPTION_ID = "20000000-0000-0000-0000-000000000000" ``` The following Terraform and Provider blocks can be specified - where `3.0.0` is the version of the Azure Provider that you'd like to use: @@ -124,14 +150,15 @@ More information on [the fields supported in the Provider block can be found her At this point running either `terraform plan` or `terraform apply` should allow Terraform to run using the Service Principal to authenticate. ---- +### Provider Block -It's also possible to configure these variables either in-line or from using variables in Terraform (as the `client_certificate_path` and `client_certificate_password` are in this example), like so: +It's also possible to configure these variables either directly, or from variables, in your provider block, like so: -~> **NOTE:** We'd recommend not defining these variables in-line since they could easily be checked into Source Control. +!> **Caution** We recommend not defining these variables in-line since they could easily be checked into Source Control. +*Reading the certificate bundle from the filesystem* ```hcl -variable "client_certificate_path" {} +variable "client_certificate" {} variable "client_certificate_password" {} # We strongly recommend using the required_providers block to set the @@ -149,11 +176,39 @@ terraform { provider "azurerm" { features {} - subscription_id = "00000000-0000-0000-0000-000000000000" client_id = "00000000-0000-0000-0000-000000000000" client_certificate_path = var.client_certificate_path client_certificate_password = var.client_certificate_password - tenant_id = "00000000-0000-0000-0000-000000000000" + tenant_id = "10000000-0000-0000-0000-000000000000" + subscription_id = "20000000-0000-0000-0000-000000000000" +} +``` + +*Passing the encoded certificate bundle directly* +```hcl +variable "client_certificate" {} +variable "client_certificate_password" {} + +# We strongly recommend using the required_providers block to set the +# Azure Provider source and version being used +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "=3.43.0" + } + } +} + +# Configure the Microsoft Azure Provider +provider "azurerm" { + features {} + + client_id = "00000000-0000-0000-0000-000000000000" + client_certificate = var.client_certificate + client_certificate_password = var.client_certificate_password + tenant_id = "10000000-0000-0000-0000-000000000000" + subscription_id = "20000000-0000-0000-0000-000000000000" } ``` diff --git a/website/docs/guides/service_principal_client_secret.html.markdown b/website/docs/guides/service_principal_client_secret.html.markdown index 4b6b9bfce903..2a99c8fb8c30 100644 --- a/website/docs/guides/service_principal_client_secret.html.markdown +++ b/website/docs/guides/service_principal_client_secret.html.markdown @@ -28,10 +28,10 @@ It's possible to complete this task in either the [Azure CLI](#creating-a-servic ### Creating a Service Principal using the Azure CLI -~> **Note**: If you're using the **China**, **German** or **Government** Azure Clouds - you'll need to first configure the Azure CLI to work with that Cloud. You can do this by running: +~> **Note**: If you're using the **China** or **US Government** Azure Clouds - you'll need to first configure the Azure CLI to work with that Cloud. You can do this by running: ```shell -az cloud set --name AzureChinaCloud|AzureGermanCloud|AzureUSGovernment +az cloud set --name AzureChinaCloud|AzureUSGovernment ``` --- @@ -54,11 +54,11 @@ The output (similar to below) will display one or more Subscriptions - with the [ { "cloudName": "AzureCloud", - "id": "00000000-0000-0000-0000-000000000000", + "id": "20000000-0000-0000-0000-000000000000", "isDefault": true, "name": "PAYG Subscription", "state": "Enabled", - "tenantId": "00000000-0000-0000-0000-000000000000", + "tenantId": "10000000-0000-0000-0000-000000000000", "user": { "name": "user@example.com", "type": "user" @@ -70,13 +70,13 @@ The output (similar to below) will display one or more Subscriptions - with the Should you have more than one Subscription, you can specify the Subscription to use via the following command: ```shell -az account set --subscription="SUBSCRIPTION_ID" +az account set --subscription="20000000-0000-0000-0000-000000000000" ``` We can now create the Service Principal which will have permissions to manage resources in the specified Subscription using the following command: ```shell -az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/SUBSCRIPTION_ID" +az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/20000000-0000-0000-0000-000000000000" ``` This command will output 5 values: @@ -169,13 +169,20 @@ As we've obtained the credentials for this Service Principal - it's possible to When storing the credentials as Environment Variables, for example: -```bash +```shell-session +# sh export ARM_CLIENT_ID="00000000-0000-0000-0000-000000000000" -export ARM_CLIENT_SECRET="00000000-0000-0000-0000-000000000000" -export ARM_SUBSCRIPTION_ID="00000000-0000-0000-0000-000000000000" -export ARM_TENANT_ID="00000000-0000-0000-0000-000000000000" +export ARM_CLIENT_SECRET="12345678-0000-0000-0000-000000000000" +export ARM_TENANT_ID="10000000-0000-0000-0000-000000000000" +export ARM_SUBSCRIPTION_ID="20000000-0000-0000-0000-000000000000" +``` +```powershell +# PowerShell +> $env:ARM_CLIENT_ID = "00000000-0000-0000-0000-000000000000" +> $env:ARM_CLIENT_SECRET = "12345678-0000-0000-0000-000000000000" +> $env:ARM_TENANT_ID = "10000000-0000-0000-0000-000000000000" +> $env:ARM_SUBSCRIPTION_ID = "20000000-0000-0000-0000-000000000000" ``` - The following Terraform and Provider blocks can be specified - where `3.0.0` is the version of the Azure Provider that you'd like to use: ```hcl @@ -204,7 +211,7 @@ At this point running either `terraform plan` or `terraform apply` should allow It's also possible to configure these variables either in-line or from using variables in Terraform (as the `client_secret` is in this example), like so: -~> **NOTE:** We'd recommend not defining these variables in-line since they could easily be checked into Source Control. +~> **Caution** We recommend not defining these variables in-line since they could easily be checked into Source Control. ```hcl variable "client_secret" { @@ -225,10 +232,10 @@ terraform { provider "azurerm" { features {} - subscription_id = "00000000-0000-0000-0000-000000000000" client_id = "00000000-0000-0000-0000-000000000000" client_secret = var.client_secret - tenant_id = "00000000-0000-0000-0000-000000000000" + tenant_id = "10000000-0000-0000-0000-000000000000" + subscription_id = "20000000-0000-0000-0000-000000000000" } ``` diff --git a/website/docs/index.html.markdown b/website/docs/index.html.markdown index 134277186437..2e2f16d2a3b3 100644 --- a/website/docs/index.html.markdown +++ b/website/docs/index.html.markdown @@ -114,6 +114,8 @@ The following arguments are supported: When authenticating as a Service Principal using a Client Certificate, the following fields can be set: +* `client_certificate` - (Optional) A base64-encoded PKCS#12 bundle to be used as the client certificate for authentication. This can also be sourced from the `ARM_CLIENT_CERTIFICATE` environment variable. + * `client_certificate_password` - (Optional) The password associated with the Client Certificate. This can also be sourced from the `ARM_CLIENT_CERTIFICATE_PASSWORD` Environment Variable. * `client_certificate_path` - (Optional) The path to the Client Certificate associated with the Service Principal which should be used. This can also be sourced from the `ARM_CLIENT_CERTIFICATE_PATH` Environment Variable. @@ -146,13 +148,19 @@ More information on [how to configure a Service Principal using OpenID Connect c --- -When authenticating using Managed Service Identity, the following fields can be set: +When authenticating using Managed Identity, the following fields can be set: + +* `msi_endpoint` - (Optional) The path to a custom endpoint for Managed Identity - in most circumstances, this should be detected automatically. This can also be sourced from the `ARM_MSI_ENDPOINT` Environment Variable. + +* `use_msi` - (Optional) Should Managed Identity be used for Authentication? This can also be sourced from the `ARM_USE_MSI` Environment Variable. Defaults to `false`. -* `msi_endpoint` - (Optional) The path to a custom endpoint for Managed Service Identity - in most circumstances, this should be detected automatically. This can also, be sourced from the `ARM_MSI_ENDPOINT` Environment Variable. +More information on [how to configure a Service Principal using Managed Identity can be found in this guide](guides/managed_service_identity.html). + +--- -* `use_msi` - (Optional) Should Managed Service Identity be used for Authentication? This can also be sourced from the `ARM_USE_MSI` Environment Variable. Defaults to `false`. +For Azure CLI authentication, the following fields can be set: -More information on [how to configure a Service Principal using Managed Service Identity can be found in this guide](guides/managed_service_identity.html). +* `use_cli` - (Optional) Should Azure CLI be used for authentication? This can also be sourced from the `ARM_USE_CLI` environment variable. Defaults to `true`. --- diff --git a/website/docs/r/api_management.html.markdown b/website/docs/r/api_management.html.markdown index 8d3d0285553f..0f75467ddf7c 100644 --- a/website/docs/r/api_management.html.markdown +++ b/website/docs/r/api_management.html.markdown @@ -65,6 +65,8 @@ The following arguments are supported: * `client_certificate_enabled` - (Optional) Enforce a client certificate to be presented on each request to the gateway? This is only supported when SKU type is `Consumption`. +* `delegation` - (Optional) A `delegation` block as defined below. + * `gateway_disabled` - (Optional) Disable the gateway in main region? This is only supported when `additional_location` is set. * `min_api_version` - (Optional) The version which the control plane API calls to API Management service are limited with version equal to or newer than. @@ -135,6 +137,18 @@ A `certificate` block supports the following: --- +A `delegation` block supports the following: + +* `subscriptions_enabled` - (Optional) Should subscription requests be delegated to an external url? Defaults to `false`. + +* `user_registration_enabled` - (Optional) Should user registration requests be delegated to an external url? Defaults to `false`. + +* `url` - (Optional) The delegation URL. + +* `validation_key` - (Optional) A base64-encoded validation key to validate, that a request is coming from Azure API Management. + +--- + A `hostname_configuration` block supports the following: * `management` - (Optional) One or more `management` blocks as documented below. @@ -287,30 +301,6 @@ A `security` block supports the following: -> **info:** This maps to the `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` field -* `disable_backend_ssl30` - (Optional) Should SSL 3.0 be disabled on the backend of the gateway? This property was mistakenly inverted and `true` actually enables it. Defaults to `false`. - --> **Note:** This property has been deprecated in favour of the `enable_backend_ssl30` property and will be removed in version 2.0 of the provider. - -* `disable_backend_tls10` - (Optional) Should TLS 1.0 be disabled on the backend of the gateway? This property was mistakenly inverted and `true` actually enables it. Defaults to `false`. - --> **Note:** This property has been deprecated in favour of the `enable_backend_tls10` property and will be removed in version 2.0 of the provider. - -* `disable_backend_tls11` - (Optional) Should TLS 1.1 be disabled on the backend of the gateway? This property was mistakenly inverted and `true` actually enables it. Defaults to `false`. - --> **Note:** This property has been deprecated in favour of the `enable_backend_tls11` property and will be removed in version 2.0 of the provider. - -* `disable_frontend_ssl30` - (Optional) Should SSL 3.0 be disabled on the frontend of the gateway? This property was mistakenly inverted and `true` actually enables it. Defaults to `false`. - --> **Note:** This property has been deprecated in favour of the `enable_frontend_ssl30` property and will be removed in version 2.0 of the provider. - -* `disable_frontend_tls10` - (Optional) Should TLS 1.0 be disabled on the frontend of the gateway? This property was mistakenly inverted and `true` actually enables it. Defaults to `false`. - --> **Note:** This property has been deprecated in favour of the `enable_frontend_tls10` property and will be removed in version 2.0 of the provider. - -* `disable_frontend_tls11` - (Optional) Should TLS 1.1 be disabled on the frontend of the gateway? This property was mistakenly inverted and `true` actually enables it. Defaults to `false`. - --> **Note:** This property has been deprecated in favour of the `enable_frontend_tls11` property and will be removed in version 2.0 of the provider. - --- A `sign_in` block supports the following: @@ -361,6 +351,8 @@ In addition to all arguments above, the following attributes are exported: * `identity` - An `identity` block as defined below. +* `hostname_configuration` - A `hostname_configuration` block as defined below. + * `management_api_url` - The URL for the Management API associated with this API Management service. * `portal_url` - The URL for the Publisher Portal associated with this API Management service. @@ -417,11 +409,11 @@ The `certificate` block exports the following: The `hostname_configuration` block exports the following: -* `expiry` - The expiration date of the certificate in RFC3339 format: `2000-01-02T03:04:05Z`. +* `proxy` - A `proxy` block as defined below. -* `thumbprint` - The thumbprint of the certificate. +--- -* `subject` - The subject of the certificate. +The `proxy` block exports the following: * `certificate_source` - The source of the certificate. diff --git a/website/docs/r/api_management_api_tag.html.markdown b/website/docs/r/api_management_api_tag.html.markdown index 499859ad63ea..84146a2d6a18 100644 --- a/website/docs/r/api_management_api_tag.html.markdown +++ b/website/docs/r/api_management_api_tag.html.markdown @@ -41,7 +41,7 @@ resource "azurerm_api_management_tag" "example" { resource "azurerm_api_management_api_tag" "example" { api_id = azurerm_api_management_api.example.id - name = "example-tag" + name = azurerm_api_management_tag.example.name } ``` diff --git a/website/docs/r/api_management_custom_domain.html.markdown b/website/docs/r/api_management_custom_domain.html.markdown index b6369c123495..13c41627ffff 100644 --- a/website/docs/r/api_management_custom_domain.html.markdown +++ b/website/docs/r/api_management_custom_domain.html.markdown @@ -176,10 +176,10 @@ In addition to the Arguments listed above - the following Attributes are exporte The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: -* `create` - (Defaults to 45 minutes) Used when creating the API Management Custom Domain. +* `create` - (Defaults to 60 minutes) Used when creating the API Management Custom Domain. * `read` - (Defaults to 5 minutes) Used when retrieving the API Management Custom Domain. -* `update` - (Defaults to 45 minutes) Used when updating the API Management Custom Domain. -* `delete` - (Defaults to 45 minutes) Used when deleting the API Management Custom Domain. +* `update` - (Defaults to 60 minutes) Used when updating the API Management Custom Domain. +* `delete` - (Defaults to 60 minutes) Used when deleting the API Management Custom Domain. ## Import diff --git a/website/docs/r/api_management_gateway.html.markdown b/website/docs/r/api_management_gateway.html.markdown index af3555409138..d9014d991e90 100644 --- a/website/docs/r/api_management_gateway.html.markdown +++ b/website/docs/r/api_management_gateway.html.markdown @@ -47,9 +47,7 @@ The following arguments are supported: * `name` - (Required) The name which should be used for the API Management Gateway. Changing this forces a new API Management Gateway to be created. -* `api_management_name` - (Required) The name of the API Management Service in which the gateway will be created. Changing this forces a new API Management Gateway resource to be created. - -* `resource_group_name` - (Required) The name of the Resource Group in which the API Management Gateway exists. +* `api_management_id` - (Required) The ID of the API Management Resource in which the gateway will be created. Changing this forces a new API Management Gateway resource to be created. * `location_data` - (Required) A `location_data` block as documented below. diff --git a/website/docs/r/app_configuration_feature.html.markdown b/website/docs/r/app_configuration_feature.html.markdown index 88cb251e3a64..9092e33c8da8 100644 --- a/website/docs/r/app_configuration_feature.html.markdown +++ b/website/docs/r/app_configuration_feature.html.markdown @@ -78,7 +78,7 @@ A `groups` block represents a group that can be used in a `targeting_filter` and --- -A `timewindow_filter` represents a feature filter of type `Microsoft.TimeWindow` and takes the following attributes: +A `timewindow_filter` block represents a feature filter of type `Microsoft.TimeWindow` and takes the following attributes: * `start` - (Optional) The earliest timestamp the feature is enabled. The timestamp must be in RFC3339 format. diff --git a/website/docs/r/app_service.html.markdown b/website/docs/r/app_service.html.markdown index 81f4f9647080..7b56cde6c37c 100644 --- a/website/docs/r/app_service.html.markdown +++ b/website/docs/r/app_service.html.markdown @@ -201,6 +201,8 @@ A `site_config` block supports the following: * `app_command_line` - (Optional) App command line to launch, e.g. `/sbin/myserver -b 0.0.0.0`. +* `auto_swap_slot_name` - (Optional) The name of the slot to automatically swap to during deployment + * `cors` - (Optional) A `cors` block as defined below. * `default_documents` - (Optional) The ordering of default documents to load, if an address isn't specified. @@ -343,6 +345,14 @@ A `google` block supports the following: --- +A `twitter` block supports the following: + +* `consumer_key` - (Required) The consumer key of the Twitter app used for login + +* `consumer_secret` - (Required) The consumer secret of the Twitter app used for login. + +--- + A `ip_restriction` block supports the following: * `ip_address` - (Optional) The IP Address used for this IP Restriction in CIDR notation. diff --git a/website/docs/r/app_service_certificate.html.markdown b/website/docs/r/app_service_certificate.html.markdown index 9d0308cf74e9..849ff229eb94 100644 --- a/website/docs/r/app_service_certificate.html.markdown +++ b/website/docs/r/app_service_certificate.html.markdown @@ -52,6 +52,8 @@ The following arguments are supported: -> **NOTE:** If using `key_vault_secret_id`, the WebApp Service Resource Principal ID `abfa0a7c-a6b6-4736-8310-5855508787cd` must have 'Secret -> get' and 'Certificate -> get' permissions on the Key Vault containing the certificate. (Source: [App Service Blog](https://azure.github.io/AppService/2016/05/24/Deploying-Azure-Web-App-Certificate-through-Key-Vault.html)) If you use Terraform to create the access policy you have to specify the Object ID of this Principal. This Object ID can be retrieved via following data reference, since it is different in every AAD Tenant: +* `tags` - (Optional) A mapping of tags to assign to the resource. + ```hcl data "azuread_service_principal" "MicrosoftWebApp" { application_id = "abfa0a7c-a6b6-4736-8310-5855508787cd" @@ -78,7 +80,7 @@ The following attributes are exported: * `thumbprint` - The thumbprint for the certificate. -* `hosting_environment_profile_id` - The ID of the the App Service Environment where the certificate is in use. +* `hosting_environment_profile_id` - The ID of the App Service Environment where the certificate is in use. ## Timeouts diff --git a/website/docs/r/app_service_plan.html.markdown b/website/docs/r/app_service_plan.html.markdown index 794575df8197..05052097c3a9 100644 --- a/website/docs/r/app_service_plan.html.markdown +++ b/website/docs/r/app_service_plan.html.markdown @@ -123,6 +123,8 @@ The following arguments are supported: * `per_site_scaling` - (Optional) Can Apps assigned to this App Service Plan be scaled independently? If set to `false` apps assigned to this plan will scale to all instances of the plan. +* `is_xenon` - (Optional) Whether to create a xenon App Service Plan. + * `zone_redundant` - (Optional) Specifies if the App Service Plan should be Zone Redundant. Changing this forces a new resource to be created. ~> **NOTE:** Requires either `PremiumV2` or `PremiumV3` SKU and that at least 3 instances. For more information, please see the [App Service Team Blog](https://azure.github.io/AppService/2021/08/25/App-service-support-for-availability-zones.html). diff --git a/website/docs/r/app_service_slot.html.markdown b/website/docs/r/app_service_slot.html.markdown index ef92e013ff25..63f14dee90df 100644 --- a/website/docs/r/app_service_slot.html.markdown +++ b/website/docs/r/app_service_slot.html.markdown @@ -353,6 +353,14 @@ A `facebook` block supports the following: --- +A `twitter` block supports the following: + +* `consumer_key` - (Required) The consumer key of the Twitter app used for login + +* `consumer_secret` - (Required) The consumer secret of the Twitter app used for login. + +--- + A `google` block supports the following: * `client_id` - (Required) The OpenID Connect Client ID for the Google web application. @@ -395,6 +403,26 @@ A `headers` block supports the following: --- +A `scm_ip_restriction` block supports the following: + +* `ip_address` - (Optional) The IP Address used for this IP Restriction in CIDR notation. + +* `service_tag` - (Optional) The Service Tag used for this IP Restriction. + +* `virtual_network_subnet_id` - (Optional) The Virtual Network Subnet ID used for this IP Restriction. + +-> **NOTE:** One of either `ip_address`, `service_tag` or `virtual_network_subnet_id` must be specified + +* `name` - (Optional) The name for this IP Restriction. + +* `priority` - (Optional) The priority for this IP Restriction. Restrictions are enforced in priority order. By default, priority is set to 65000 if not specified. + +* `action` - (Optional) Allow or Deny access for this IP range. Defaults to `Allow`. + +* `headers` - (Optional) The headers for this specific `scm_ip_restriction` as defined below. + +--- + A `microsoft` block supports the following: * `client_id` - (Required) The OAuth 2.0 client ID that was created for the app used for authentication. @@ -459,14 +487,6 @@ A `file_system` block supports the following: * `retention_in_mb` - (Required) The maximum size in megabytes that HTTP log files can use before being removed. ---- - -A `ip_restriction` block (attribute as block) support: - -* `ip_address` - (Optional) The IP Address used for this IP Restriction. - -* `subnet_mask` - (Optional) The Subnet mask used for this IP Restriction. Defaults to `255.255.255.255`. - ## Attributes Reference The following attributes are exported: diff --git a/website/docs/r/app_service_source_control.html.markdown b/website/docs/r/app_service_source_control.html.markdown index aa874f7e806b..285eb574d6a0 100644 --- a/website/docs/r/app_service_source_control.html.markdown +++ b/website/docs/r/app_service_source_control.html.markdown @@ -100,6 +100,8 @@ A `github_action_configuration` block supports the following: * `container_configuration` - (Optional) A `container_configuration` block as defined above. +* `generate_workflow_file` - (Optional) Whether to generate the GitHub work flow file. Defaults to `true`. Changing this forces a new resource to be created. + ## Attributes Reference In addition to the Arguments listed above - the following Attributes are exported: diff --git a/website/docs/r/application_gateway.html.markdown b/website/docs/r/application_gateway.html.markdown index 51efc8d6bcf7..51a735e44668 100644 --- a/website/docs/r/application_gateway.html.markdown +++ b/website/docs/r/application_gateway.html.markdown @@ -556,7 +556,7 @@ A `waf_configuration` block supports the following: A `disabled_rule_group` block supports the following: -* `rule_group_name` - (Required) The rule group where specific rules should be disabled. Possible values are `crs_20_protocol_violations`, `crs_21_protocol_anomalies`, `crs_23_request_limits`, `crs_30_http_policy`, `crs_35_bad_robots`, `crs_40_generic_attacks`, `crs_41_sql_injection_attacks`, `crs_41_xss_attacks`, `crs_42_tight_security`, `crs_45_trojans`, `General`, `Known-CVEs`, `REQUEST-911-METHOD-ENFORCEMENT`, `REQUEST-913-SCANNER-DETECTION`, `REQUEST-920-PROTOCOL-ENFORCEMENT`, `REQUEST-921-PROTOCOL-ATTACK`, `REQUEST-930-APPLICATION-ATTACK-LFI`, `REQUEST-931-APPLICATION-ATTACK-RFI`, `REQUEST-932-APPLICATION-ATTACK-RCE`, `REQUEST-933-APPLICATION-ATTACK-PHP`, `REQUEST-941-APPLICATION-ATTACK-XSS`, `REQUEST-942-APPLICATION-ATTACK-SQLI`, `REQUEST-943-APPLICATION-ATTACK-SESSION-FIXATION` and `REQUEST-944-APPLICATION-ATTACK-JAVA`. +* `rule_group_name` - (Required) The rule group where specific rules should be disabled. Possible values are `BadBots`, `crs_20_protocol_violations`, `crs_21_protocol_anomalies`, `crs_23_request_limits`, `crs_30_http_policy`, `crs_35_bad_robots`, `crs_40_generic_attacks`, `crs_41_sql_injection_attacks`, `crs_41_xss_attacks`, `crs_42_tight_security`, `crs_45_trojans`, `General`, `GoodBots`, `Known-CVEs`, `REQUEST-911-METHOD-ENFORCEMENT`, `REQUEST-913-SCANNER-DETECTION`, `REQUEST-920-PROTOCOL-ENFORCEMENT`, `REQUEST-921-PROTOCOL-ATTACK`, `REQUEST-930-APPLICATION-ATTACK-LFI`, `REQUEST-931-APPLICATION-ATTACK-RFI`, `REQUEST-932-APPLICATION-ATTACK-RCE`, `REQUEST-933-APPLICATION-ATTACK-PHP`, `REQUEST-941-APPLICATION-ATTACK-XSS`, `REQUEST-942-APPLICATION-ATTACK-SQLI`, `REQUEST-943-APPLICATION-ATTACK-SESSION-FIXATION`, `REQUEST-944-APPLICATION-ATTACK-JAVA` and `UnknownBots`. * `rules` - (Optional) A list of rules which should be disabled in that group. Disables all rules in the specified group if `rules` is not specified. diff --git a/website/docs/r/application_insights_standard_web_test.html.markdown b/website/docs/r/application_insights_standard_web_test.html.markdown index b6a22a691d4f..e64bdb0be553 100644 --- a/website/docs/r/application_insights_standard_web_test.html.markdown +++ b/website/docs/r/application_insights_standard_web_test.html.markdown @@ -115,7 +115,7 @@ A `validation_rules` block supports the following: * `expected_status_code` - (Optional) The expected status code of the response. Default is '200', '0' means 'response code < 400' -* `ssl_cert_remaining_lifetime` - (Optional) The number of days of SSL certificate validity remaining for the checked endpoint. If the certificate has a shorter remaining lifetime left, the test will fail. +* `ssl_cert_remaining_lifetime` - (Optional) The number of days of SSL certificate validity remaining for the checked endpoint. If the certificate has a shorter remaining lifetime left, the test will fail. This number should be between 1 and 365. * `ssl_check_enabled` - (Optional) Should the SSL check be enabled? diff --git a/website/docs/r/automation_schedule.html.markdown b/website/docs/r/automation_schedule.html.markdown index dfa26e6d5236..4e98c1f789a0 100644 --- a/website/docs/r/automation_schedule.html.markdown +++ b/website/docs/r/automation_schedule.html.markdown @@ -64,7 +64,7 @@ The following arguments are supported: * `month_days` - (Optional) List of days of the month that the job should execute on. Must be between `1` and `31`. `-1` for last day of the month. Only valid when frequency is `Month`. -* `monthly_occurrence` - (Optional) List of occurrences of days within a month. Only valid when frequency is `Month`. The `monthly_occurrence` block supports fields documented below. +* `monthly_occurrence` - (Optional) List of `monthly_occurrence` blocks as defined below to specifies occurrences of days within a month. Only valid when frequency is `Month`. The `monthly_occurrence` block supports fields documented below. --- diff --git a/website/docs/r/automation_software_update_configuration.html.markdown b/website/docs/r/automation_software_update_configuration.html.markdown index 64118e6f3979..c1af15850736 100644 --- a/website/docs/r/automation_software_update_configuration.html.markdown +++ b/website/docs/r/automation_software_update_configuration.html.markdown @@ -175,7 +175,7 @@ A `schedule` block supports the following: * `advanced_month_days` - (Optional) List of days of the month that the job should execute on. Must be between `1` and `31`. `-1` for last day of the month. Only valid when frequency is `Month`. -* `monthly_occurrence` - (Optional) List of occurrences of days within a month. Only valid when frequency is `Month`. The `monthly_occurrence` block supports fields as defined below. +* `monthly_occurrence` - (Optional) List of `monthly_occurrence` blocks as defined below to specifies occurrences of days within a month. Only valid when frequency is `Month`. The `monthly_occurrence` block supports fields as defined below. --- diff --git a/website/docs/r/batch_pool.html.markdown b/website/docs/r/batch_pool.html.markdown index 2a63800e6713..3c31096ca387 100644 --- a/website/docs/r/batch_pool.html.markdown +++ b/website/docs/r/batch_pool.html.markdown @@ -122,6 +122,8 @@ The following arguments are supported: * `node_agent_sku_id` - (Required) Specifies the SKU of the node agents that will be created in the Batch pool. Changing this forces a new resource to be created. +* `stop_pending_resize_operation` - (Optional) Whether to stop if there is a pending resize operation on this pool. + * `vm_size` - (Required) Specifies the size of the VM created in the Batch pool. Changing this forces a new resource to be created. * `storage_image_reference` - (Required) A `storage_image_reference` for the virtual machines that will compose the Batch pool. Changing this forces a new resource to be created. @@ -297,7 +299,7 @@ A `container` block supports the following: * `run_options` - (Optional) Additional options to the container create command. These additional options are supplied as arguments to the "docker create" command, in addition to those controlled by the Batch Service. -* `registry` - (Optional) The same reference as `container_registries` block defined as follows. +* `registry` - (Optional) The same reference as `container_registries` block defined as below. * `working_directory` - (Optional) A flag to indicate where the container task working directory is. The default is `TaskWorkingDirectory`, an alternative value is `ContainerImageDefault`. @@ -341,7 +343,7 @@ A `container_configuration` block supports the following: * `container_image_names` - (Optional) A list of container image names to use, as would be specified by `docker pull`. Changing this forces a new resource to be created. -* `container_registries` - (Optional) Additional container registries from which container images can be pulled by the pool's VMs. Changing this forces a new resource to be created. +* `container_registries` - (Optional) One or more `container_registries` blocks as defined below. Additional container registries from which container images can be pulled by the pool's VMs. Changing this forces a new resource to be created. --- @@ -471,7 +473,7 @@ A `endpoint_configuration` block supports the following: * `frontend_port_range` - (Required) The range of external ports that will be used to provide inbound access to the backendPort on individual compute nodes in the format of `1000-1100`. Acceptable values range between `1` and `65534` except ports from `50000` to `55000` which are reserved by the Batch service. All ranges within a pool must be distinct and cannot overlap. Values must be a range of at least `100` nodes. Changing this forces a new resource to be created. -* `network_security_group_rules` - (Optional) A list of network security group rules that will be applied to the endpoint. The maximum number of rules that can be specified across all the endpoints on a Batch pool is `25`. If no network security group rules are specified, a default rule will be created to allow inbound access to the specified backendPort. Set as documented in the network_security_group_rules block below. Changing this forces a new resource to be created. +* `network_security_group_rules` - (Optional) A list of `network_security_group_rules` blocks as defined below that will be applied to the endpoint. The maximum number of rules that can be specified across all the endpoints on a Batch pool is `25`. If no network security group rules are specified, a default rule will be created to allow inbound access to the specified backendPort. Set as documented in the network_security_group_rules block below. Changing this forces a new resource to be created. --- diff --git a/website/docs/r/cdn_frontdoor_rule.html.markdown b/website/docs/r/cdn_frontdoor_rule.html.markdown index ce6baafeac12..92a64cf21b59 100644 --- a/website/docs/r/cdn_frontdoor_rule.html.markdown +++ b/website/docs/r/cdn_frontdoor_rule.html.markdown @@ -203,7 +203,7 @@ A `route_configuration_override_action` block supports the following: * `cdn_frontdoor_origin_group_id` - (Optional) The Front Door Origin Group resource ID that the request should be routed to. This overrides the configuration specified in the Front Door Endpoint route. -* `forwarding_protocol` - (Optional) The forwarding protocol the request will be redirected as. This overrides the configuration specified in the route to be associated with. Possible values include `MatchRequest`, `HttpOnly` or `HttpsOnly`. Defaults to `MatchRequest`. Possible values include `HttpOnly`, `HttpsOnly` or `MatchRequest`. Defaults to `MatchRequest`. +* `forwarding_protocol` - (Optional) The forwarding protocol the request will be redirected as. This overrides the configuration specified in the route to be associated with. Possible values include `MatchRequest`, `HttpOnly` or `HttpsOnly`. ->**NOTE:** If the `cdn_frontdoor_origin_group_id` is not defined you cannot set the `forwarding_protocol`. diff --git a/website/docs/r/cdn_frontdoor_security_policy.html.markdown b/website/docs/r/cdn_frontdoor_security_policy.html.markdown index 72095a7b9857..08343e23f934 100644 --- a/website/docs/r/cdn_frontdoor_security_policy.html.markdown +++ b/website/docs/r/cdn_frontdoor_security_policy.html.markdown @@ -63,6 +63,7 @@ resource "azurerm_cdn_frontdoor_security_policy" "example" { domain { cdn_frontdoor_domain_id = azurerm_cdn_frontdoor_custom_domain.domain1.id } + patterns_to_match = ["/*"] } } } diff --git a/website/docs/r/cognitive_account.html.markdown b/website/docs/r/cognitive_account.html.markdown index 052377427ccb..98689cc5a562 100644 --- a/website/docs/r/cognitive_account.html.markdown +++ b/website/docs/r/cognitive_account.html.markdown @@ -50,7 +50,9 @@ The following arguments are supported: -> **NOTE:** You must create your first Face, Text Analytics, or Computer Vision resources from the Azure portal to review and acknowledge the terms and conditions. In Azure Portal, the checkbox to accept terms and conditions is only displayed when a US region is selected. More information on [Prerequisites](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account-cli?tabs=windows#prerequisites). -* `sku_name` - (Required) Specifies the SKU Name for this Cognitive Service Account. Possible values are `F0`, `F1`, `S0`, `S`, `S1`, `S2`, `S3`, `S4`, `S5`, `S6`, `P0`, `P1`, `P2` and `E0`. +* `sku_name` - (Required) Specifies the SKU Name for this Cognitive Service Account. Possible values are `F0`, `F1`, `S0`, `S`, `S1`, `S2`, `S3`, `S4`, `S5`, `S6`, `P0`, `P1`, `P2`, `E0` and `DC0`. + +-> **NOTE:** SKU `DC0` is the commitment tier for Cognitive Services containers running in disconnected environments. You must obtain approval from Microsoft by submitting the [request form](https://aka.ms/csdisconnectedcontainers) first, before you can use this SKU. More information on [Purchase a commitment plan to use containers in disconnected environments](https://learn.microsoft.com/en-us/azure/cognitive-services/containers/disconnected-containers?tabs=stt#purchase-a-commitment-plan-to-use-containers-in-disconnected-environments). * `custom_subdomain_name` - (Optional) The subdomain name used for token-based authentication. Changing this forces a new resource to be created. diff --git a/website/docs/r/container_app.html.markdown b/website/docs/r/container_app.html.markdown new file mode 100644 index 000000000000..763b57778247 --- /dev/null +++ b/website/docs/r/container_app.html.markdown @@ -0,0 +1,362 @@ +--- +subcategory: "Container Apps" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_container_app" +description: |- + Manages a Container App. +--- + +# azurerm_container_app + +Manages a Container App. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_log_analytics_workspace" "example" { + name = "acctest-01" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + sku = "PerGB2018" + retention_in_days = 30 +} + +resource "azurerm_container_app_environment" "example" { + name = "Example-Environment" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + log_analytics_workspace_id = azurerm_log_analytics_workspace.example.id +} +resource "azurerm_container_app" "example" { + name = "example-app" + container_app_environment_id = azurerm_container_app_environment.example.id + resource_group_name = azurerm_resource_group.example.name + revision_mode = "Single" + + template { + container { + name = "examplecontainerapp" + image = "mcr.microsoft.com/azuredocs/containerapps-helloworld:latest" + cpu = 0.25 + memory = "0.5Gi" + } + } +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `container_app_environment_id` - (Required) The ID of the Container App Environment within which this Container App should exist. Changing this forces a new resource to be created. + +* `name` - (Required) The name for this Container App. Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of the resource group in which the Container App Environment is to be created. Changing this forces a new resource to be created. + +* `revision_mode` - (Required) The revisions operational mode for the Container App. Possible values include `Single` and `Multiple`. In `Single` mode, a single revision is in operation at any given time. In `Multiple` mode, more than one revision can be active at a time and can be configured with load distribution via the `traffic_weight` block in the `ingress` configuration. + +* `template` - (Required) A `template` block as detailed below. + +--- + +* `dapr` - (Optional) A `dapr` block as detailed below. + +* `identity` - (Optional) An `identity` block as detailed below. + +* `ingress` - (Optional) An `ingress` block as detailed below. + +* `registry` - (Optional) A `registry` block as detailed below. + +* `secret` - (Optional) One or more `secret` block as detailed below. + +* `tags` - (Optional) A mapping of tags to assign to the Container App. + +--- + +A `secret` block supports the following: + +* `name` - (Required) The Secret name. + +* `value` - (Required) The value for this secret. + +!> **Note:** Secrets cannot be removed from the service once added, attempting to do so will result in an error. Their values may be zeroed, i.e. set to `""`, but the named secret must persist. This is due to a technical limitation on the service which causes the service to become unmanageable. See [this issue](https://github.com/microsoft/azure-container-apps/issues/395) for more details. + +--- + +A `template` block supports the following: + +* `container` - (Required) One or more `container` blocks as detailed below. + +* `max_replicas` - (Optional) The maximum number of replicas for this container. + +* `min_replicas` - (Optional) The minimum number of replicas for this container. + +* `revision_suffix` - (Optional) The suffix for the revision. This value must be unique for the lifetime of the Resource. If omitted the service will use a hash function to create one. + +* `volume` - (Optional) A `volume` block as detailed below. + +--- + +A `volume` block supports the following: + +* `name` - (Required) The name of the volume. + +* `storage_name` - (Optional) The name of the `AzureFile` storage. + +* `storage_type` - (Optional) The type of storage volume. Possible values include `AzureFile` and `EmptyDir`. Defaults to `EmptyDir`. + +--- + +A `container` block supports the following: + +* `args` - (Optional) A list of extra arguments to pass to the container. + +* `command` - (Optional) A command to pass to the container to override the default. This is provided as a list of command line elements without spaces. + +* `cpu` - (Required) The amount of vCPU to allocate to the container. Possible values include `0.25`, `0.5`, `0.75`, `1.0`, `1.25`, `1.5`, `1.75`, and `2.0`. + +~> **NOTE:** `cpu` and `memory` must be specified in `0.25'/'0.5Gi` combination increments. e.g. `1.0` / `2.0` or `0.5` / `1.0` + +* `env` - (Optional) One or more `env` blocks as detailed below. + +* `ephemeral_storage` - The amount of ephemeral storage available to the Container App. + +~> **NOTE:** `ephemeral_storage` is currently in preview and not configurable at this time. + +* `image` - (Required) The image to use to create the container. + +* `liveness_probe` - (Optional) A `liveness_probe` block as detailed below. + +* `memory` - (Required) The amount of memory to allocate to the container. Possible values include `0.5Gi`, `1.0Gi`, `1.5Gi`, `2.0Gi`, `2.5Gi`, `3.0Gi`, `3.5Gi`, and `4.0Gi`. + +~> **NOTE:** `cpu` and `memory` must be specified in `0.25'/'0.5Gi` combination increments. e.g. `1.25` / `2.5Gi` or `0.75` / `1.5Gi` + +* `name` - (Required) The name of the container + +* `readiness_probe` - (Optional) A `readiness_probe` block as detailed below. + +* `startup_probe` - (Optional) A `startup_probe` block as detailed below. + +* `volume_mounts` - (Optional) A `volume_mounts` block as detailed below. + +--- + +A `liveness_probe` block supports the following: + +* `failure_count_threshold` - (Optional) The number of consecutive failures required to consider this probe as failed. Possible values are between `1` and `10`. Defaults to `3`. + +* `header` - (Optional) A `header` block as detailed below. + +* `host` - (Optional) The probe hostname. Defaults to the pod IP address. Setting a value for `Host` in `headers` can be used to override this for `HTTP` and `HTTPS` type probes. + +* `initial_delay` - (Optional) The time in seconds to wait after the container has started before the probe is started. + +* `interval_seconds` - (Optional) (Optional) How often, in seconds, the probe should run. Possible values are in the range `1` - `240`. Defaults to `10`. + +* `path` - (Optional) The URI to use with the `host` for http type probes. Not valid for `TCP` type probes. Defaults to `/`. + +* `port` - (Required) The port number on which to connect. Possible values are between `1` and `65535`. + +* `termination_grace_period_seconds` - The time in seconds after the container is sent the termination signal before the process if forcibly killed. + +* `timeout` - (Optional) Time in seconds after which the probe times out. Possible values are in the range `1` - `240`. Defaults to `1`. + +* `transport` - (Required) Type of probe. Possible values are `TCP`, `HTTP`, and `HTTPS`. + +--- + +A `header` block supports the following: + +* `name` - (Required) The HTTP Header Name. + +* `value` - (Required) The HTTP Header value. + +--- + +An `env` block supports the following: + +* `name` - (Required) The name of the environment variable for the container. + +* `secret_name` - (Optional) The name of the secret that contains the value for this environment variable. + +* `value` - (Optional) The value for this environment variable. + +~> **NOTE:** This value is ignored if `secret_name` is used + +--- + +A `readiness_probe` block supports the following: + +* `failure_count_threshold` - (Optional) The number of consecutive failures required to consider this probe as failed. Possible values are between `1` and `10`. Defaults to `3`. + +* `header` - (Optional) A `header` block as detailed below. + +* `host` - (Optional) The probe hostname. Defaults to the pod IP address. Setting a value for `Host` in `headers` can be used to override this for `HTTP` and `HTTPS` type probes. + +* `interval_seconds` - (Optional) How often, in seconds, the probe should run. Possible values are between `1` and `240`. Defaults to `10` + +* `path` - (Optional) The URI to use for http type probes. Not valid for `TCP` type probes. Defaults to `/`. + +* `port` - (Required) The port number on which to connect. Possible values are between `1` and `65535`. + +* `success_count_threshold` - (Optional) The number of consecutive successful responses required to consider this probe as successful. Possible values are between `1` and `10`. Defaults to `3`. + +* `timeout` - (Optional) Time in seconds after which the probe times out. Possible values are in the range `1` - `240`. Defaults to `1`. + +* `transport` - (Required) Type of probe. Possible values are `TCP`, `HTTP`, and `HTTPS`. + +--- + +A `header` block supports the following: + +* `name` - (Required) The HTTP Header Name. + +* `value` - (Required) The HTTP Header value. + +--- + +A `startup_probe` block supports the following: + +* `failure_count_threshold` - (Optional) The number of consecutive failures required to consider this probe as failed. Possible values are between `1` and `10`. Defaults to `3`. + +* `header` - (Optional) A `header` block as detailed below. + +* `host` - (Optional) The value for the host header which should be sent with this probe. If unspecified, the IP Address of the Pod is used as the host header. Setting a value for `Host` in `headers` can be used to override this for `HTTP` and `HTTPS` type probes. + +* `interval_seconds` - (Optional) How often, in seconds, the probe should run. Possible values are between `1` and `240`. Defaults to `10` + +* `path` - (Optional) The URI to use with the `host` for http type probes. Not valid for `TCP` type probes. Defaults to `/`. + +* `port` - (Required) The port number on which to connect. Possible values are between `1` and `65535`. + +* `termination_grace_period_seconds` - The time in seconds after the container is sent the termination signal before the process if forcibly killed. + +* `timeout` - (Optional) Time in seconds after which the probe times out. Possible values are in the range `1` - `240`. Defaults to `1`. + +* `transport` - (Required) Type of probe. Possible values are `TCP`, `HTTP`, and `HTTPS`. + +--- + +A `header` block supports the following: + +* `name` - (Required) The HTTP Header Name. + +* `value` - (Required) The HTTP Header value. + +--- + +A `volume_mounts` block supports the following: + +* `name` - (Required) The name of the Volume to be mounted in the container. + +* `path` - (Required) The path in the container at which to mount this volume. + +--- + +An `identity` block supports the following: + +* `type` - (Required) The type of managed identity to assign. Possible values are `UserAssigned` and `SystemAssigned` + +* `identity_ids` - (Optional) - A list of one or more Resource IDs for User Assigned Managed identities to assign. Required when `type` is set to `UserAssigned`. + +--- + +An `ingress` block supports the following: + +* `allow_insecure_connections` - (Optional) Should this ingress allow insecure connections? + +* `custom_domain` - (Optional) One or more `custom_domain` block as detailed below. + +* `fqdn` - The FQDN of the ingress. + +* `external_enabled` - (Optional) Is this an external Ingress. + +* `target_port` - (Required) The target port on the container for the Ingress traffic. + +* `traffic_weight` - (Required) A `traffic_weight` block as detailed below. + +~> **Note:** `traffic_weight` can only be specified when `revision_mode` is set to `Multiple`. + +* `transport` - (Optional) The transport method for the Ingress. Possible values include `auto`, `http`, and `http2`. Defaults to `auto` + +--- + +A `traffic_weight` block supports the following: + +~> **Note:** This block only applies when `revision_mode` is set to `Multiple`. + +* `label` - (Optional) The label to apply to the revision as a name prefix for routing traffic. + +* `latest_revision` - (Optional) This traffic Weight relates to the latest stable Container Revision. + +* `revision_suffix` - (Optional) The suffix string to which this `traffic_weight` applies. + +* `percentage` - (Required) The percentage of traffic which should be sent this revision. + +~> **Note:** The cumulative values for `weight` must equal 100 exactly and explicitly, no default weights are assumed. + +--- + +A `dapr` block supports the following: + +* `app_id` - (Required) The Dapr Application Identifier. + +* `app_port` - (Required) The port which the application is listening on. This is the same as the `ingress` port. + +* `app_protocol` - (Optional) The protocol for the app. Possible values include `http` and `grpc`. Defaults to `http`. + +--- + +A `registry` block supports the following: + +* `server` - (Required) The hostname for the Container Registry. + +The authentication details must also be supplied, `identity` and `username`/`password_secret_name` are mutually exclusive. + +* `identity` - (Optional) Resource ID for the User Assigned Managed identity to use when pulling from the Container Registry. + +* `password_secret_name` - (Optional) The name of the Secret Reference containing the password value for this user on the Container Registry, `username` must also be supplied. + +* `username` - (Optional) The username to use for this Container Registry, `password_secret_name` must also be supplied.. + + + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Container App. + +* `custom_domain_verification_id` - The ID of the Custom Domain Verification for this Container App. + +* `latest_revision_fqdn` - The FQDN of the Latest Revision of the Container App. + +* `latest_revision_name` - The name of the latest Container Revision. + +* `location` - The location this Container App is deployed in. This is the same as the Environment in which it is deployed. + +* `outbound_ip_addresses` - A list of the Public IP Addresses which the Container App uses for outbound network access. + + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Container App. +* `update` - (Defaults to 30 minutes) Used when updating the Container App. +* `read` - (Defaults to 5 minutes) Used when retrieving the Container App. +* `delete` - (Defaults to 30 minutes) Used when deleting the Container App. + +## Import + +A Container App can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_container_app.example "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.App/containerApps/myContainerApp" +``` diff --git a/website/docs/r/container_app_environment.html.markdown b/website/docs/r/container_app_environment.html.markdown new file mode 100644 index 000000000000..f94e368cf2c1 --- /dev/null +++ b/website/docs/r/container_app_environment.html.markdown @@ -0,0 +1,103 @@ +--- +subcategory: "Container Apps" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_container_app_environment" +description: |- + Manages a Container App Environment. +--- + +# azurerm_container_app_environment + +Manages a Container App Environment. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_log_analytics_workspace" "example" { + name = "acctest-01" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + sku = "PerGB2018" + retention_in_days = 30 +} + +resource "azurerm_container_app_environment" "example" { + name = "my-environment" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + log_analytics_workspace_id = azurerm_log_analytics_workspace.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Container Apps Managed Environment. Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of the resource group in which the Container App Environment is to be created. Changing this forces a new resource to be created. + +* `location` - (Required) Specifies the supported Azure location where the Container App Environment is to exist. Changing this forces a new resource to be created. + +* `log_analytics_workspace_id` - (Required) The ID for the Log Analytics Workspace to link this Container Apps Managed Environment to. Changing this forces a new resource to be created. + +--- + +* `infrastructure_subnet_id` - (Optional) The existing Subnet to use for the Container Apps Control Plane. Changing this forces a new resource to be created. + +~> **NOTE:** The Subnet must have a `/21` or larger address space. + +* `internal_load_balancer_enabled` - (Optional) Should the Container Environment operate in Internal Load Balancing Mode? Defaults to `false`. Changing this forces a new resource to be created. + +~> **Note:** can only be set to `true` if `infrastructure_subnet_id` is specified. + +* `tags` - (Optional) A mapping of tags to assign to the resource. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Container App Environment + +* `default_domain` - The default, publicly resolvable, name of this Container App Environment. + +~> **NOTE:** This value is generated by the service to be globally unique. + +* `docker_bridge_cidr` - The network addressing in which the Container Apps in this Container App Environment will reside in CIDR notation. + +~> **NOTE:** This property only has a value when `infrastructure_subnet_id` is configured and will be a range within the CIDR of the Subnet. + +* `platform_reserved_cidr` - The IP range, in CIDR notation, that is reserved for environment infrastructure IP addresses. + +~> **NOTE:** This property only has a value when `infrastructure_subnet_id` is configured and will be a range within the CIDR of the Subnet. + +* `platform_reserved_dns_ip_address` - The IP address from the IP range defined by `platform_reserved_cidr` that is reserved for the internal DNS server. + +~> **NOTE:** This property only has a value when `infrastructure_subnet_id` is configured and will be a value within the CIDR of the Subnet. + +* `static_ip_address` - The Static IP of the Environment. + +~> **NOTE:** This will be a Public IP unless `internal_load_balancer_enabled` is set to `true`, in which case an IP in the Internal Subnet will be reserved. + + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Container App Environment. +* `update` - (Defaults to 30 minutes) Used when updating the Container App Environment. +* `read` - (Defaults to 5 minutes) Used when retrieving the Container App Environment. +* `delete` - (Defaults to 30 minutes) Used when deleting the Container App Environment. + +## Import + +A Container App Environment can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_container_app_environment.example "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.App/managedEnvironments/myEnvironment" +``` diff --git a/website/docs/r/container_app_environment_certificate.html.markdown b/website/docs/r/container_app_environment_certificate.html.markdown new file mode 100644 index 000000000000..67fd14256db5 --- /dev/null +++ b/website/docs/r/container_app_environment_certificate.html.markdown @@ -0,0 +1,92 @@ +--- +subcategory: "Container Apps" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_container_app_environment_certificate" +description: |- + Manages a Container App Environment Certificate. +--- + +# azurerm_container_app_environment_certificate + +Manages a Container App Environment Certificate. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_log_analytics_workspace" "example" { + name = "acctest-01" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + sku = "PerGB2018" + retention_in_days = 30 +} + +resource "azurerm_container_app_environment" "example" { + name = "myEnvironment" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + log_analytics_workspace_id = azurerm_log_analytics_workspace.example.id +} + +resource "azurerm_container_app_environment_certificate" "example" { + name = "myfriendlyname" + container_app_environment_id = azurerm_container_app_environment.example.id + certificate_blob = filebase64("path/to/certificate_file.pfx") + certificate_password = "$3cretSqu1rreL" +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Container Apps Environment Certificate. Changing this forces a new resource to be created. + +* `container_app_environment_id` - (Required) The Container App Managed Environment ID to configure this Certificate on. Changing this forces a new resource to be created. + +* `certificate_blob_base64` - (Required) The Certificate Private Key as a base64 encoded PFX or PEM. Changing this forces a new resource to be created. + +* `certificate_password` - (Required) The password for the Certificate. Changing this forces a new resource to be created. + +--- + +* `tags` - (Optional) A mapping of tags to assign to the resource. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Container App Environment Certificate + +* `expiration_date` - The expiration date for the Certificate. + +* `issue_date` - The date of issue for the Certificate. + +* `issuer` - The Certificate Issuer. + +* `subject_name` - The Subject Name for the Certificate. + +* `thumbprint` - The Thumbprint of the Certificate. + + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Container App Environment Certificate. +* `update` - (Defaults to 30 minutes) Used when updating the Container App Environment Certificate. +* `read` - (Defaults to 5 minutes) Used when retrieving the Container App Environment Certificate. +* `delete` - (Defaults to 30 minutes) Used when deleting the Container App Environment Certificate. + +## Import + +A Container App Environment Certificate can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_container_app_environment_certificate.example "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.App/managedEnvironments/myenv/certificates/mycertificate" +``` diff --git a/website/docs/r/container_app_environment_dapr_component.html.markdown b/website/docs/r/container_app_environment_dapr_component.html.markdown new file mode 100644 index 000000000000..6049e4152ebf --- /dev/null +++ b/website/docs/r/container_app_environment_dapr_component.html.markdown @@ -0,0 +1,110 @@ +--- +subcategory: "Container Apps" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_container_app_environment_dapr_component" +description: |- + Manages a Dapr Component for a Container App Environment. +--- + +# azurerm_container_app_environment_dapr_component + +Manages a Dapr Component for a Container App Environment. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_log_analytics_workspace" "example" { + name = "acctest-01" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + sku = "PerGB2018" + retention_in_days = 30 +} + +resource "azurerm_container_app_environment" "example" { + name = "Example-Environment" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + log_analytics_workspace_id = azurerm_log_analytics_workspace.example.id +} + +resource "azurerm_container_app_environment_dapr_component" "example" { + name = "example-component" + container_app_environment_id = azurerm_container_app_environment.example.id + component_type = "state.azure.blobstorage" + version = "v1" +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `container_app_environment_id` - (Required) The ID of the Container App Managed Environment for this Dapr Component. Changing this forces a new resource to be created. + +* `name` - (Required) The name for this Dapr component. Changing this forces a new resource to be created. + +* `type` - (Required) The Dapr Component Type. For example `state.azure.blobstorage`. Changing this forces a new resource to be created. + +* `version` - (Required) The version of the component. + +--- + +* `ignore_errors` - (Optional) Should the Dapr sidecar to continue initialisation if the component fails to load. Defaults to `false` + +* `init_timeout` - The timeout for component initialisation as a `ISO8601` formatted string. e.g. `5s`, `2h`, `1m`. Defaults to `5s` + +* `metadata` - (Optional) One or more `metadata` blocks as detailed below. + +* `scopes` - (Optional) A list of scopes to which this component applies. + +~> **NOTE:** See the official docs for more information at https://learn.microsoft.com/en-us/azure/container-apps/dapr-overview?tabs=bicep1%2Cyaml#component-scopes + +* `secret` - (Optional) A `secret` block as detailed below. + +--- + +A `metadata` block supports the following: + +* `name` - (Required) The name of the Metadata configuration item. + +* `secret_name` - (Optional) The name of a secret specified in the `secrets` block that contains the value for this metadata configuration item. + +* `value` - (Optional) The value for this metadata configuration item. + +--- + +A `secret` block supports the following: + +* `name` - (Required) The Secret name. + +* `value` - (Required) The value for this secret. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Container App Environment Dapr Component + + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Container App Environment Dapr Component. +* `update` - (Defaults to 30 minutes) Used when updating the Container App Environment Dapr Component. +* `read` - (Defaults to 5 minutes) Used when retrieving the Container App Environment Dapr Component. +* `delete` - (Defaults to 30 minutes) Used when deleting the Container App Environment Dapr Component. + +## Import + +A Dapr Component for a Container App Environment can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_container_app_environment_dapr_component.example "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.App/managedEnvironments/myenv/daprComponents/mydaprcomponent" +``` diff --git a/website/docs/r/container_app_environment_storage.html.markdown b/website/docs/r/container_app_environment_storage.html.markdown new file mode 100644 index 000000000000..c1e4a7e259b8 --- /dev/null +++ b/website/docs/r/container_app_environment_storage.html.markdown @@ -0,0 +1,98 @@ +--- +subcategory: "Container Apps" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_container_app_environment_storage" +description: |- + Manages a Container App Environment Storage. +--- + +# azurerm_container_app_environment_storage + +Manages a Container App Environment Storage. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_log_analytics_workspace" "example" { + name = "acctest-01" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + sku = "PerGB2018" + retention_in_days = 30 +} + +resource "azurerm_container_app_environment" "example" { + name = "myEnvironment" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + log_analytics_workspace_id = azurerm_log_analytics_workspace.example.id +} + +resource "azurerm_storage_account" "example" { + name = "azureteststorage" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_storage_share" "example" { + name = "sharename" + storage_account_name = azurerm_storage_account.example.name + quota = 5 +} + +resource "azurerm_container_app_environment_storage" "example" { + name = "mycontainerappstorage" + container_app_environment_id = azurerm_container_app_environment.example.id + account_name = azurerm_storage_account.example.name + share_name = azurerm_storage_share.example.name + access_key = azurerm_storage_account.example.primary_access_key + access_mode = "ReadOnly" +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name for this Container App Environment Storage. Changing this forces a new resource to be created. + +* `container_app_environment_id` - (Required) The ID of the Container App Environment to which this storage belongs. Changing this forces a new resource to be created. + +* `account_name` - (Required) The Azure Storage Account in which the Share to be used is located. Changing this forces a new resource to be created. + +* `access_key` - (Required) The Storage Account Access Key. + +* `share_name` - (Required) The name of the Azure Storage Share to use. Changing this forces a new resource to be created. + +* `access_mode` - (Required) The access mode to connect this storage to the Container App. Possible values include `ReadOnly` and `ReadWrite`. Changing this forces a new resource to be created. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Container App Environment Storage + + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Container App Environment Storage. +* `update` - (Defaults to 30 minutes) Used when updating the Container App Environment Storage. +* `read` - (Defaults to 5 minutes) Used when retrieving the Container App Environment Storage. +* `delete` - (Defaults to 30 minutes) Used when deleting the Container App Environment Storage. + +## Import + +A Container App Environment Storage can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_container_app_environment_storage.example "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.App/managedEnvironments/myEnvironment/storages/mystorage" +``` diff --git a/website/docs/r/container_registry_token_password.html.markdown b/website/docs/r/container_registry_token_password.html.markdown index d78261cfe0e7..0dc2a46a8fd6 100644 --- a/website/docs/r/container_registry_token_password.html.markdown +++ b/website/docs/r/container_registry_token_password.html.markdown @@ -75,7 +75,9 @@ In addition to the Arguments listed above - the following Attributes are exporte * `id` - The ID of the Container Registry Token Password. -* `password` - Up to two `password` blocks as defined below. +* `password1` - One `password` block as defined below. + +* `password2` - One `password` block as defined below. --- diff --git a/website/docs/r/cosmosdb_account.html.markdown b/website/docs/r/cosmosdb_account.html.markdown index db5ad46a806f..0b0e4844381a 100644 --- a/website/docs/r/cosmosdb_account.html.markdown +++ b/website/docs/r/cosmosdb_account.html.markdown @@ -70,15 +70,15 @@ resource "azurerm_cosmosdb_account" "db" { The following arguments are supported: -* `name` - (Required) Specifies the name of the CosmosDB Account. Changing this forces a new resource to be created. +* `name` - (Required) Specifies the name of the CosmosDB Account. Changing this forces a new resource to be created. * `resource_group_name` - (Required) The name of the resource group in which the CosmosDB Account is created. Changing this forces a new resource to be created. -* `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. +* `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. * `tags` - (Optional) A mapping of tags to assign to the resource. -* `offer_type` - (Required) Specifies the Offer Type to use for this CosmosDB Account - currently this can only be set to `Standard`. +* `offer_type` - (Required) Specifies the Offer Type to use for this CosmosDB Account; currently, this can only be set to `Standard`. * `analytical_storage` - (Optional) An `analytical_storage` block as defined below. @@ -96,17 +96,17 @@ The following arguments are supported: * `geo_location` - (Required) Specifies a `geo_location` resource, used to define where data should be replicated with the `failover_priority` 0 specifying the primary location. Value is a `geo_location` block as defined below. -* `ip_range_filter` - (Optional) CosmosDB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IP's for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. +* `ip_range_filter` - (Optional) CosmosDB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. ~> **NOTE:** To enable the "Allow access from the Azure portal" behavior, you should add the IP addresses provided by the [documentation](https://docs.microsoft.com/azure/cosmos-db/how-to-configure-firewall#allow-requests-from-the-azure-portal) to this list. ~> **NOTE:** To enable the "Accept connections from within public Azure datacenters" behavior, you should add `0.0.0.0` to the list, see the [documentation](https://docs.microsoft.com/azure/cosmos-db/how-to-configure-firewall#allow-requests-from-global-azure-datacenters-or-other-sources-within-azure) for more details. -* `enable_free_tier` - (Optional) Enable Free Tier pricing option for this Cosmos DB account. Defaults to `false`. Changing this forces a new resource to be created. +* `enable_free_tier` - (Optional) Enable the Free Tier pricing option for this Cosmos DB account. Defaults to `false`. Changing this forces a new resource to be created. * `analytical_storage_enabled` - (Optional) Enable Analytical Storage option for this Cosmos DB account. Defaults to `false`. Enabling and then disabling analytical storage forces a new resource to be created. -* `enable_automatic_failover` - (Optional) Enable automatic fail over for this Cosmos DB account. +* `enable_automatic_failover` - (Optional) Enable automatic failover for this Cosmos DB account. * `public_network_access_enabled` - (Optional) Whether or not public network access is allowed for this CosmosDB account. Defaults to `true`. @@ -149,8 +149,10 @@ The following arguments are supported: The `consistency_policy` block Configures the database consistency and supports the following: * `consistency_level` - (Required) The Consistency Level to use for this CosmosDB Account - can be either `BoundedStaleness`, `Eventual`, `Session`, `Strong` or `ConsistentPrefix`. -* `max_interval_in_seconds` - (Optional) 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` (1 day). Defaults to `5`. Required when `consistency_level` is set to `BoundedStaleness`. -* `max_staleness_prefix` - (Optional) When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is `10` – `2147483647`. Defaults to `100`. Required when `consistency_level` is set to `BoundedStaleness`. + +* `max_interval_in_seconds` - (Optional) When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. The accepted range for this value is `5` - `86400` (1 day). Defaults to `5`. Required when `consistency_level` is set to `BoundedStaleness`. + +* `max_staleness_prefix` - (Optional) When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. The accepted range for this value is `10` – `2147483647`. Defaults to `100`. Required when `consistency_level` is set to `BoundedStaleness`. ~> **Note:** `max_interval_in_seconds` and `max_staleness_prefix` can only be set to custom values when `consistency_level` is set to `BoundedStaleness` - otherwise they will return the default values shown above. @@ -159,20 +161,22 @@ The `consistency_policy` block Configures the database consistency and supports The `geo_location` block Configures the geographic locations the data is replicated to and supports the following: * `location` - (Required) The name of the Azure region to host replicated data. + * `failover_priority` - (Required) 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. Changing this causes the location to be re-provisioned and cannot be changed for the location with failover priority `0`. + * `zone_redundant` - (Optional) Should zone redundancy be enabled for this region? Defaults to `false`. --- -`capabilities` Configures the capabilities to enable for this Cosmos DB account: +A `capabilities` block Configures the capabilities to be enabled for this Cosmos DB account: -* `name` - (Required) The capability to enable - Possible values are `AllowSelfServeUpgradeToMongo36`, `DisableRateLimitingResponses`, `EnableAggregationPipeline`, `EnableCassandra`, `EnableGremlin`, `EnableMongo`, `EnableMongo16MBDocumentSupport`, `EnableTable`, `EnableServerless`, `MongoDBv3.4` and `mongoEnableDocLevelTTL`. Changing this forces a new resource to be created in certain cases as defined below. +* `name` - (Required) The capability to enable - Possible values are `AllowSelfServeUpgradeToMongo36`, `DisableRateLimitingResponses`, `EnableAggregationPipeline`, `EnableCassandra`, `EnableGremlin`, `EnableMongo`, `EnableMongo16MBDocumentSupport`, `EnableMongoRetryableWrites`, `EnableMongoRoleBasedAccessControl`, `EnableServerless`, `EnableTable`, `EnableUniqueCompoundNestedDocs`, `MongoDBv3.4` and `mongoEnableDocLevelTTL`. ~> **NOTE:** Setting `MongoDBv3.4` also requires setting `EnableMongo`. -~> **NOTE:** Only `AllowSelfServeUpgradeToMongo36`, `DisableRateLimitingResponses`, `EnableAggregationPipeline`, `MongoDBv3.4`, `EnableMongo16MBDocumentSupport` and `mongoEnableDocLevelTTL` can be added to an existing Cosmos DB account. +~> **NOTE:** Only `AllowSelfServeUpgradeToMongo36`, `DisableRateLimitingResponses`, `EnableAggregationPipeline`, `MongoDBv3.4`, `EnableMongoRetryableWrites`, `EnableMongoRoleBasedAccessControl`, `EnableUniqueCompoundNestedDocs`, `EnableMongo16MBDocumentSupport` and `mongoEnableDocLevelTTL` can be added to an existing Cosmos DB account. -~> **NOTE:** Only `DisableRateLimitingResponses` can be removed from an existing Cosmos DB account. +~> **NOTE:** Only `DisableRateLimitingResponses` and `EnableMongoRetryableWrites` can be removed from an existing Cosmos DB account. --- @@ -183,7 +187,7 @@ The `virtual_network_rule` block Configures the virtual network subnets allowed --- -A `analytical_storage` block supports the following: +An `analytical_storage` block supports the following: * `schema_type` - (Required) The schema type of the Analytical Storage for this Cosmos DB account. Possible values are `FullFidelity` and `WellDefined`. @@ -203,7 +207,7 @@ A `backup` block supports the following: * `retention_in_hours` - (Optional) The time in hours that each backup is retained. This is configurable only when `type` is `Periodic`. Possible values are between 8 and 720. -* `storage_redundancy` - (Optional) The storage redundancy which is used to indicate type of backup residency. This is configurable only when `type` is `Periodic`. Possible values are `Geo`, `Local` and `Zone`. +* `storage_redundancy` - (Optional) The storage redundancy is used to indicate the type of backup residency. This is configurable only when `type` is `Periodic`. Possible values are `Geo`, `Local` and `Zone`. --- @@ -221,7 +225,7 @@ A `cors_rule` block supports the following: --- -A `identity` block supports the following: +An `identity` block supports the following: * `type` - (Required) The Type of Managed Identity assigned to this Cosmos account. Possible values are `SystemAssigned`, `UserAssigned` and `SystemAssigned, UserAssigned`. @@ -233,7 +237,7 @@ A `restore` block supports the following: * `source_cosmosdb_account_id` - (Required) The resource ID of the restorable database account from which the restore has to be initiated. The example is `/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}`. Changing this forces a new resource to be created. -~> **NOTE:** Any database account with `Continuous` type (live account or accounts deleted in last 30 days) are the restorable database accounts and there cannot be Create/Update/Delete operations on the restorable database accounts. They can only be read and be retrieved by `azurerm_cosmosdb_restorable_database_accounts`. +~> **NOTE:** Any database account with `Continuous` type (live account or accounts deleted in last 30 days) is a restorable database account and there cannot be Create/Update/Delete operations on the restorable database accounts. They can only be read and retrieved by `azurerm_cosmosdb_restorable_database_accounts`. * `restore_timestamp_in_utc` - (Required) The creation time of the database or the collection (Datetime Format `RFC 3339`). Changing this forces a new resource to be created. diff --git a/website/docs/r/dashboard_grafana.html.markdown b/website/docs/r/dashboard_grafana.html.markdown index 2449d3eb26bd..66bc1065bec8 100644 --- a/website/docs/r/dashboard_grafana.html.markdown +++ b/website/docs/r/dashboard_grafana.html.markdown @@ -52,6 +52,8 @@ The following arguments are supported: * `deterministic_outbound_ip_enabled` - (Optional) Whether to enable the Grafana instance to use deterministic outbound IPs. Defaults to `false`. +* `azure_monitor_workspace_integrations` - (Optional) A `azure_monitor_workspace_integrations` block as defined below. + * `identity` - (Optional) An `identity` block as defined below. Changing this forces a new Dashboard Grafana to be created. * `public_network_access_enabled` - (Optional) Whether to enable traffic over the public interface. Defaults to `true`. @@ -64,6 +66,12 @@ The following arguments are supported: --- +An `azure_monitor_workspace_integrations` block supports the following: + +* `resource_id` - (Required) Specifies the resource ID of the connected Azure Monitor Workspace. + +--- + An `identity` block supports the following: * `type` - (Required) Specifies the type of Managed Service Identity. The only possible values is `SystemAssigned`. Changing this forces a new resource to be created. diff --git a/website/docs/r/data_factory_dataset_parquet.html.markdown b/website/docs/r/data_factory_dataset_parquet.html.markdown index e5015a7c5c95..45389d36a757 100644 --- a/website/docs/r/data_factory_dataset_parquet.html.markdown +++ b/website/docs/r/data_factory_dataset_parquet.html.markdown @@ -74,7 +74,9 @@ The following supported locations for a Parquet Dataset: The following supported arguments are specific to Parquet Dataset: -* `compression_codec` - (Optional) The compression codec used to read/write text files. Valid values are `bzip2`, `gzip`, `deflate`, `ZipDeflate`, `TarGzip`, `Tar`, `snappy`, or `lz4`. Please note these values are case sensitive. +* `compression_codec` - (Optional) The compression codec used to read/write text files. Valid values are `bzip2`, `gzip`, `deflate`, `ZipDeflate`, `TarGzip`, `Tar`, `snappy`, or `lz4`. Please note these values are case-sensitive. + +* `compression_level` - (Optional) Specifies the compression level. Possible values are `Optimal` and `Fastest`, --- diff --git a/website/docs/r/data_factory_linked_service_azure_blob_storage.html.markdown b/website/docs/r/data_factory_linked_service_azure_blob_storage.html.markdown index 74549b342f52..2d737fb74f36 100644 --- a/website/docs/r/data_factory_linked_service_azure_blob_storage.html.markdown +++ b/website/docs/r/data_factory_linked_service_azure_blob_storage.html.markdown @@ -114,9 +114,13 @@ The following supported arguments are common across all Azure Data Factory Linke The following supported arguments are specific to Azure Blob Storage Linked Service: -* `connection_string` - (Optional) The connection string. Conflicts with `sas_uri` and `service_endpoint`. +* `connection_string` - (Optional) The connection string. Conflicts with `connection_string_insecure`, `sas_uri` and `service_endpoint`. -* `sas_uri` - (Optional) The SAS URI. Conflicts with `connection_string` and `service_endpoint`. +* `connection_string_insecure` - (Optional) The connection string sent insecurely. Conflicts with `connection_string`, `sas_uri` and `service_endpoint`. + +~> **Note:** `connection_string` uses the Azure [SecureString](https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.management.datafactory.models.securestring) to encrypt the contents within the REST payload sent to Azure whilst the `connection_string_insecure` is sent as a regular string. Both properties are still sent using SSL/HTTPS. At this time the portal will not decrypt Secure Strings so the `connection_string` property in the portal will show as `******` whilst `connection_string_insecure` will be viewable in the portal. + +* `sas_uri` - (Optional) The SAS URI. Conflicts with `connection_string_insecure`, `connection_string` and `service_endpoint`. * `key_vault_sas_token` - (Optional) A `key_vault_sas_token` block as defined below. Use this argument to store SAS Token in an existing Key Vault. It needs an existing Key Vault Data Factory Linked Service. A `sas_uri` is required. @@ -142,7 +146,7 @@ A `service_principal_linked_key_vault_key` block supports the following: --- -* `service_endpoint` - (Optional) The Service Endpoint. Conflicts with `connection_string` and `sas_uri`. +* `service_endpoint` - (Optional) The Service Endpoint. Conflicts with `connection_string`, `connection_string_insecure` and `sas_uri`. * `use_managed_identity` - (Optional) Whether to use the Data Factory's managed identity to authenticate against the Azure Blob Storage account. Incompatible with `service_principal_id` and `service_principal_key`. diff --git a/website/docs/r/databox_edge_order.html.markdown b/website/docs/r/databox_edge_order.html.markdown index f7afc7a32ff4..c71592cf8b43 100644 --- a/website/docs/r/databox_edge_order.html.markdown +++ b/website/docs/r/databox_edge_order.html.markdown @@ -10,6 +10,8 @@ description: |- Manages a Databox Edge Order. +!> Creation of Databox Edge Order is not supported by the Azure API - as such the `azurerm_databox_edge_order` resource is deprecated and will be removed in v4.0 of the AzureRM Provider. + ## Example Usage ```hcl diff --git a/website/docs/r/databricks_access_connector.html.markdown b/website/docs/r/databricks_access_connector.html.markdown index 4eda447a7371..1a4dfc78c853 100644 --- a/website/docs/r/databricks_access_connector.html.markdown +++ b/website/docs/r/databricks_access_connector.html.markdown @@ -43,30 +43,33 @@ The following arguments are supported: * `location` - (Required) Specifies the supported Azure location where the resource has to be created. Changing this forces a new resource to be created. -* `identity` - (Required) An `identity` block as defined below. +* `identity` - (Optional) An `identity` block as defined below. * `tags` - (Optional) A mapping of tags to assign to the resource. --- An `identity` block supports the following: + * `type` - (Required) The type of identity to use for this Access Connector. `SystemAssigned` is the only possible value. -* `principal_id` - (Optional) The object id of an existing principal. If not specified, a new system-assigned managed identity is created. -* `tenant_id` - (Optional) The tenant id in which the principal resides. ## Attributes Reference The following attributes are exported: * `id` - The ID of the Databricks Access Connector in the Azure management plane. + * `identity` - A list of `identity` blocks containing the system-assigned managed identities as defined below. --- An `identity` block exports the following: -* `type` - (Required) The type of identity. -* `principal_id` - The Principal Id associated with this system-assigned managed identity. -* `tenant_id` - The Tenant Id associated with this system-assigned managed identity. + +* `type` - The type of identity. + +* `principal_id` - The Principal ID associated with this system-assigned managed identity. + +* `tenant_id` - The Tenant ID associated with this system-assigned managed identity. ## Timeouts diff --git a/website/docs/r/databricks_workspace.html.markdown b/website/docs/r/databricks_workspace.html.markdown index ce694f62f8d0..33cab4e9a164 100644 --- a/website/docs/r/databricks_workspace.html.markdown +++ b/website/docs/r/databricks_workspace.html.markdown @@ -50,19 +50,23 @@ The following arguments are supported: ~> **NOTE** Downgrading to a `trial sku` from a `standard` or `premium sku` will force a new resource to be created. -* `managed_services_cmk_key_vault_key_id` - (Optional) Customer managed encryption properties for the Databricks Workspace managed resources(e.g. Notebooks and Artifacts). Changing this forces a new resource to be created. +* `managed_services_cmk_key_vault_key_id` - (Optional) Customer managed encryption properties for the Databricks Workspace managed resources(e.g. Notebooks and Artifacts). + +* `managed_disk_cmk_key_vault_key_id` - (Optional) Customer managed encryption properties for the Databricks Workspace managed disks. + +* `managed_disk_cmk_rotation_to_latest_version_enabled` - (Optional) Whether customer managed keys for disk encryption will automatically be rotated to the latest version. * `managed_resource_group_name` - (Optional) The name of the resource group where Azure should place the managed Databricks resources. Changing this forces a new resource to be created. ~> **NOTE** Make sure that this field is unique if you have multiple Databrick Workspaces deployed in your subscription and choose to not have the `managed_resource_group_name` auto generated by the Azure Resource Provider. Having multiple Databrick Workspaces deployed in the same subscription with the same `manage_resource_group_name` may result in some resources that cannot be deleted. -* `customer_managed_key_enabled` - (Optional) Is the workspace enabled for customer managed key encryption? If `true` this enables the Managed Identity for the managed storage account. Possible values are `true` or `false`. Defaults to `false`. This field is only valid if the Databricks Workspace `sku` is set to `premium`. Changing this forces a new resource to be created. +* `customer_managed_key_enabled` - (Optional) Is the workspace enabled for customer managed key encryption? If `true` this enables the Managed Identity for the managed storage account. Possible values are `true` or `false`. Defaults to `false`. This field is only valid if the Databricks Workspace `sku` is set to `premium`. * `infrastructure_encryption_enabled` - (Optional) Is the Databricks File System root file system enabled with a secondary layer of encryption with platform managed keys? Possible values are `true` or `false`. Defaults to `false`. This field is only valid if the Databricks Workspace `sku` is set to `premium`. Changing this forces a new resource to be created. -* `public_network_access_enabled` - (Optional) Allow public access for accessing workspace. Set value to `false` to access workspace only via private link endpoint. Possible values include `true` or `false`. Defaults to `true`. Changing this forces a new resource to be created. +* `public_network_access_enabled` - (Optional) Allow public access for accessing workspace. Set value to `false` to access workspace only via private link endpoint. Possible values include `true` or `false`. Defaults to `true`. -* `network_security_group_rules_required` - (Optional) Does the data plane (clusters) to control plane communication happen over private link endpoint only or publicly? Possible values `AllRules`, `NoAzureDatabricksRules` or `NoAzureServiceRules`. Required when `public_network_access_enabled` is set to `false`. Changing this forces a new resource to be created. +* `network_security_group_rules_required` - (Optional) Does the data plane (clusters) to control plane communication happen over private link endpoint only or publicly? Possible values `AllRules`, `NoAzureDatabricksRules` or `NoAzureServiceRules`. Required when `public_network_access_enabled` is set to `false`. * `custom_parameters` - (Optional) A `custom_parameters` block as documented below. @@ -78,7 +82,9 @@ A `custom_parameters` block supports the following: * `public_ip_name` - (Optional) Name of the Public IP for No Public IP workspace with managed vNet. Defaults to `nat-gw-public-ip`. Changing this forces a new resource to be created. -* `no_public_ip` - (Optional) Are public IP Addresses not allowed? Possible values are `true` or `false`. Defaults to `false`. Changing this forces a new resource to be created. +* `no_public_ip` - (Optional) Are public IP Addresses not allowed? Possible values are `true` or `false`. Defaults to `false`. + +~> **NOTE** Updating `no_public_ip` parameter is only allowed if the value is changing from `false` to `true` and and only for VNet-injected workspaces. * `public_subnet_name` - (Optional) The name of the Public Subnet within the Virtual Network. Required if `virtual_network_id` is set. Changing this forces a new resource to be created. @@ -113,6 +119,10 @@ The following attributes are exported: * `id` - The ID of the Databricks Workspace in the Azure management plane. +* `disk_encryption_set_id` - The ID of Managed Disk Encryption Set created by the Databricks Workspace. + +* `managed_disk_identity` - A `managed_disk_identity` block as documented below. + * `managed_resource_group_id` - The ID of the Managed Resource Group created by the Databricks Workspace. * `workspace_url` - The workspace URL which is of the format 'adb-{workspaceId}.{random}.azuredatabricks.net' @@ -123,6 +133,16 @@ The following attributes are exported: --- +A `managed_disk_identity` block exports the following: + +* `principal_id` - The principal UUID for the internal databricks disks identity needed to provide access to the workspace for enabling Customer Managed Keys. + +* `tenant_id` - The UUID of the tenant where the internal databricks disks identity was created. + +* `type` - The type of the internal databricks disks identity. + +--- + A `storage_account_identity` block exports the following: * `principal_id` - The principal UUID for the internal databricks storage account needed to provide access to the workspace for enabling Customer Managed Keys. diff --git a/website/docs/r/dns_a_record.html.markdown b/website/docs/r/dns_a_record.html.markdown index 12d4460d8631..7b01fe351e6d 100644 --- a/website/docs/r/dns_a_record.html.markdown +++ b/website/docs/r/dns_a_record.html.markdown @@ -74,6 +74,8 @@ The following arguments are supported: * `zone_name` - (Required) Specifies the DNS Zone where the resource exists. Changing this forces a new resource to be created. +~> **Note:** The `zone_name` should be the name of resource `azurerm_dns_zone` instead of `azurerm_private_dns_zone`. + * `ttl` - (Required) The Time To Live (TTL) of the DNS record in seconds. * `records` - (Optional) List of IPv4 Addresses. Conflicts with `target_resource_id`. diff --git a/website/docs/r/eventgrid_event_subscription.html.markdown b/website/docs/r/eventgrid_event_subscription.html.markdown index 56be36cb0980..7fb3442df447 100644 --- a/website/docs/r/eventgrid_event_subscription.html.markdown +++ b/website/docs/r/eventgrid_event_subscription.html.markdown @@ -231,8 +231,6 @@ The following attributes are exported: * `id` - The ID of the EventGrid Event Subscription. -* `topic_name` - (Optional/ **Deprecated) Specifies the name of the topic to associate with the event subscription. - ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: diff --git a/website/docs/r/eventhub.html.markdown b/website/docs/r/eventhub.html.markdown index 97fbe7144215..d6abd0946fa6 100644 --- a/website/docs/r/eventhub.html.markdown +++ b/website/docs/r/eventhub.html.markdown @@ -49,7 +49,7 @@ The following arguments are supported: * `resource_group_name` - (Required) The name of the resource group in which the EventHub's parent Namespace exists. Changing this forces a new resource to be created. -* `partition_count` - (Required) Specifies the current number of shards on the Event Hub. +* `partition_count` - (Required) Specifies the current number of shards on the Event Hub. Changing this will force-recreate the resource. ~> **Note:** `partition_count` cannot be changed unless Eventhub Namespace SKU is `Premium`. diff --git a/website/docs/r/eventhub_namespace.html.markdown b/website/docs/r/eventhub_namespace.html.markdown index 8fa7439bb6b4..3aa072b19e03 100644 --- a/website/docs/r/eventhub_namespace.html.markdown +++ b/website/docs/r/eventhub_namespace.html.markdown @@ -73,6 +73,10 @@ A `identity` block supports the following: * `type` - (Required) Specifies the type of Managed Service Identity that should be configured on this Event Hub Namespace. Possible values are `SystemAssigned` or `UserAssigned`. +* `identity_ids` - (Optional) Specifies a list of User Assigned Managed Identity IDs to be assigned to this EventHub namespace. + +~> **NOTE:** This is required when `type` is set to `UserAssigned` or `SystemAssigned, UserAssigned`. + ~> **Note:** Due to the limitation of the current Azure API, once an EventHub Namespace has been assigned an identity, it cannot be removed. --- @@ -83,7 +87,7 @@ A `network_rulesets` block supports the following: * `public_network_access_enabled` - (Optional) Is public network access enabled for the EventHub Namespace? Defaults to `true`. -* ~> **Note:** The public network access setting at the network rule sets level should be the same as it's at the namespace level. +~> **Note:** The public network access setting at the network rule sets level should be the same as it's at the namespace level. * `trusted_service_access_enabled` - (Optional) Whether Trusted Microsoft Services are allowed to bypass firewall. diff --git a/website/docs/r/eventhub_namespace_disaster_recovery_config.html.markdown b/website/docs/r/eventhub_namespace_disaster_recovery_config.html.markdown index e5e2c163b7bc..ff205dd37aa9 100644 --- a/website/docs/r/eventhub_namespace_disaster_recovery_config.html.markdown +++ b/website/docs/r/eventhub_namespace_disaster_recovery_config.html.markdown @@ -52,8 +52,6 @@ The following arguments are supported: * `partner_namespace_id` - (Required) The ID of the EventHub Namespace to replicate to. -* `wait_for_replication` - (Optional) Should the resource wait for replication upon creation? Defaults to `false`. - ## Attributes Reference The following attributes are exported: diff --git a/website/docs/r/eventhub_namespace_schema_group.html.markdown b/website/docs/r/eventhub_namespace_schema_group.html.markdown index d706a4864527..2ea47801992b 100644 --- a/website/docs/r/eventhub_namespace_schema_group.html.markdown +++ b/website/docs/r/eventhub_namespace_schema_group.html.markdown @@ -35,11 +35,13 @@ resource "azurerm_eventhub_namespace_schema_group" "test" { The following arguments are supported: -* `namespace_id` - (Required) The ID of the EventHub Namespace. Changing this forces a new resource to be created. +* `name` - (Required) Specifies the name of this schema group. Changing this forces a new resource to be created. -* `schema_compatibility` - (Required) The compatibility of this schema group. Possible values are `None`, `Backward`, `Forward`. Changing this forces a new resource to be created. +* `namespace_id` - (Required) Specifies the ID of the EventHub Namespace. Changing this forces a new resource to be created. -* `schema_type` - (Required) The Type of this schema group. Possible values are `Avro`, `Unknown`. Changing this forces a new resource to be created. +* `schema_compatibility` - (Required) Specifies the compatibility of this schema group. Possible values are `None`, `Backward`, `Forward`. Changing this forces a new resource to be created. + +* `schema_type` - (Required) Specifies the Type of this schema group. Possible values are `Avro`, `Unknown`. Changing this forces a new resource to be created. ## Attributes Reference diff --git a/website/docs/r/express_route_port.html.markdown b/website/docs/r/express_route_port.html.markdown index 4115799d4fc3..3773a085b99e 100644 --- a/website/docs/r/express_route_port.html.markdown +++ b/website/docs/r/express_route_port.html.markdown @@ -70,6 +70,8 @@ A `link` block supports the following: * `macsec_cipher` - (Optional) The MACSec cipher used for this Express Route Port Link. Possible values are `GcmAes128` and `GcmAes256`. Defaults to `GcmAes128`. +* `billing_type` - (Optional) The billing type of the Express Route Port. Possible values are `MeteredData` and `UnlimitedData`. + * `macsec_ckn_keyvault_secret_id` - (Optional) The ID of the Key Vault Secret that contains the MACSec CKN key for this Express Route Port Link. * `macsec_cak_keyvault_secret_id` - (Optional) The ID of the Key Vault Secret that contains the Mac security CAK key for this Express Route Port Link. diff --git a/website/docs/r/fluid_relay_servers.html.markdown b/website/docs/r/fluid_relay_servers.html.markdown index 31564f29e23a..bc82fb6407e4 100644 --- a/website/docs/r/fluid_relay_servers.html.markdown +++ b/website/docs/r/fluid_relay_servers.html.markdown @@ -65,9 +65,9 @@ In addition to the Arguments listed above - the following Attributes are exporte * `secondary_key` - The secondary key for this server. -* `orderer_endpoints` - An array of the Fluid Relay Orderer endpoints. +* `orderer_endpoints` - An array of the Fluid Relay Orderer endpoints. This will be deprecated in future version of fluid relay server and will always be empty, [more details](https://learn.microsoft.com/en-us/azure/azure-fluid-relay/concepts/version-compatibility). -* `storage_endpoints` - An array of storage endpoints for this Fluid Relay Server. +* `storage_endpoints` - An array of storage endpoints for this Fluid Relay Server. This will be deprecated in future version of fluid relay server and will always be empty, [more details](https://learn.microsoft.com/en-us/azure/azure-fluid-relay/concepts/version-compatibility). * `service_endpoints` - An array of service endpoints for this Fluid Relay Server. diff --git a/website/docs/r/function_app.html.markdown b/website/docs/r/function_app.html.markdown index 80c62ae731cf..f914a1473306 100644 --- a/website/docs/r/function_app.html.markdown +++ b/website/docs/r/function_app.html.markdown @@ -311,6 +311,10 @@ The `site_config` block supports the following: * `websockets_enabled` - (Optional) Should WebSockets be enabled? +* `auto_swap_slot_name` - (Optional) The name of the slot to automatically swap to during deployment + +~> **NOTE:** This attribute is only used for slots. + --- A `cors` block supports the following: diff --git a/website/docs/r/function_app_slot.html.markdown b/website/docs/r/function_app_slot.html.markdown index bfae83d7813f..7e0fd91c4018 100644 --- a/website/docs/r/function_app_slot.html.markdown +++ b/website/docs/r/function_app_slot.html.markdown @@ -132,16 +132,32 @@ The `site_config` block supports the following: * `linux_fx_version` - (Optional) Linux App Framework and version for the AppService, e.g. `DOCKER|(golang:latest)`. +* `java_version` - (Optional) Java version hosted by the function app in Azure. Possible values are `1.8`, `11` & `17` (In-Preview). + * `http2_enabled` - (Optional) Specifies whether or not the HTTP2 protocol should be enabled. Defaults to `false`. * `min_tls_version` - (Optional) The minimum supported TLS version for the function app. Possible values are `1.0`, `1.1`, and `1.2`. Defaults to `1.2` for new function apps. * `ftps_state` - (Optional) State of FTP / FTPS service for this function app. Possible values include: `AllAllowed`, `FtpsOnly` and `Disabled`. +* `health_check_path` - (Optional) Path which will be checked for this function app health. + * `app_scale_limit` - (Optional) The number of workers this function app can scale out to. Only applicable to apps on the Consumption and Premium plan. * `runtime_scale_monitoring_enabled` - (Optional) Should Runtime Scale Monitoring be enabled?. Only applicable to apps on the Premium plan. Defaults to `false`. +* `scm_ip_restriction` - (Optional) A [List of objects](/docs/configuration/attr-as-blocks.html) representing IP restrictions as defined below. + +-> **NOTE** User has to explicitly set `scm_ip_restriction` to empty slice (`[]`) to remove it. + +* `scm_type` - (Optional) The type of Source Control used by this function App. Valid values include: `BitBucketGit`, `BitBucketHg`, `CodePlexGit`, `CodePlexHg`, `Dropbox`, `ExternalGit`, `ExternalHg`, `GitHub`, `LocalGit`, `None` (default), `OneDrive`, `Tfs`, `VSO`, and `VSTSRM`. + +~> **NOTE:** This setting is incompatible with the `source_control` block which updates this value based on the setting provided. + +* `scm_use_main_ip_restriction` - (Optional) IP security restrictions for scm to use main. Defaults to `false`. + +-> **NOTE** Any `scm_ip_restriction` blocks configured are ignored by the service when `scm_use_main_ip_restriction` is set to `true`. Any scm restrictions will become active if this is subsequently set to `false` or removed. + * `elastic_instance_minimum` - (Optional) The number of minimum instances for this function app. Only applicable to apps on the Premium plan. * `pre_warmed_instance_count` - (Optional) The number of pre-warmed instances for this function app. Only affects apps on the Premium plan. @@ -276,6 +292,26 @@ A `ip_restriction` block supports the following: --- +A `scm_ip_restriction` block supports the following: + +* `ip_address` - (Optional) The IP Address used for this IP Restriction in CIDR notation. + +* `service_tag` - (Optional) The Service Tag used for this IP Restriction. + +* `virtual_network_subnet_id` - (Optional) The Virtual Network Subnet ID used for this IP Restriction. + +-> **NOTE:** One of either `ip_address`, `service_tag` or `virtual_network_subnet_id` must be specified + +* `name` - (Optional) The name for this IP Restriction. + +* `priority` - (Optional) The priority for this IP Restriction. Restrictions are enforced in priority order. By default, priority is set to 65000 if not specified. + +* `action` - (Optional) Allow or Deny access for this IP range. Defaults to `Allow`. + +* `headers` - (Optional) The headers for this specific `scm_ip_restriction` as defined below. + +--- + A `headers` block supports the following: * `x_azure_fdid` - (Optional) A list of allowed Azure FrontDoor IDs in UUID notation with a maximum of 8. diff --git a/website/docs/r/hdinsight_hadoop_cluster.html.markdown b/website/docs/r/hdinsight_hadoop_cluster.html.markdown index 0789b15e1673..737d3d4f98cb 100644 --- a/website/docs/r/hdinsight_hadoop_cluster.html.markdown +++ b/website/docs/r/hdinsight_hadoop_cluster.html.markdown @@ -99,6 +99,8 @@ The following arguments are supported: * `network` - (Optional) A `network` block as defined below. +* `disk_encryption` - (Optional) One or more `disk_encryption` block as defined below. + * `compute_isolation` - (Optional) A `compute_isolation` block as defined below. * `storage_account_gen2` - (Optional) A `storage_account_gen2` block as defined below. @@ -167,7 +169,7 @@ A `script_actions` block supports the following: * `uri` - (Required) The URI to the script. -* `parameters` - (Required) The parameters for the script provided. +* `parameters` - (Optional) The parameters for the script provided. --- @@ -255,6 +257,8 @@ A `worker_node` block supports the following: * `autoscale` - (Optional) A `autoscale` block as defined below. +* `script_actions` - (Optional) The script action which will run on the cluster. Changing this forces a new resource to be created. + --- A `disk_encryption` block supports the following: @@ -287,14 +291,22 @@ A `zookeeper_node` block supports the following: * `virtual_network_id` - (Optional) The ID of the Virtual Network where the Zookeeper Nodes should be provisioned within. Changing this forces a new resource to be created. +* `script_actions` - (Optional) The script action which will run on the cluster. Changing this forces a new resource to be created. + --- A `edge_node` block supports the following: +* `target_instance_count` - (Required) The number of instances which should be run for the Worker Nodes. + * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Edge Nodes. Possible values are `ExtraSmall`, `Small`, `Medium`, `Large`, `ExtraLarge`, `A5`, `A6`, `A7`, `A8`, `A9`, `A10`, `A11`, `Standard_A1_V2`, `Standard_A2_V2`, `Standard_A2m_V2`, `Standard_A3`, `Standard_A4_V2`, `Standard_A4m_V2`, `Standard_A8_V2`, `Standard_A8m_V2`, `Standard_D1`, `Standard_D2`, `Standard_D3`, `Standard_D4`, `Standard_D11`, `Standard_D12`, `Standard_D13`, `Standard_D14`, `Standard_D1_V2`, `Standard_D2_V2`, `Standard_D3_V2`, `Standard_D4_V2`, `Standard_D5_V2`, `Standard_D11_V2`, `Standard_D12_V2`, `Standard_D13_V2`, `Standard_D14_V2`, `Standard_DS1_V2`, `Standard_DS2_V2`, `Standard_DS3_V2`, `Standard_DS4_V2`, `Standard_DS5_V2`, `Standard_DS11_V2`, `Standard_DS12_V2`, `Standard_DS13_V2`, `Standard_DS14_V2`, `Standard_E2_V3`, `Standard_E4_V3`, `Standard_E8_V3`, `Standard_E16_V3`, `Standard_E20_V3`, `Standard_E32_V3`, `Standard_E64_V3`, `Standard_E64i_V3`, `Standard_E2s_V3`, `Standard_E4s_V3`, `Standard_E8s_V3`, `Standard_E16s_V3`, `Standard_E20s_V3`, `Standard_E32s_V3`, `Standard_E64s_V3`, `Standard_E64is_V3`, `Standard_D2a_V4`, `Standard_D4a_V4`, `Standard_D8a_V4`, `Standard_D16a_V4`, `Standard_D32a_V4`, `Standard_D48a_V4`, `Standard_D64a_V4`, `Standard_D96a_V4`, `Standard_E2a_V4`, `Standard_E4a_V4`, `Standard_E8a_V4`, `Standard_E16a_V4`, `Standard_E20a_V4`, `Standard_E32a_V4`, `Standard_E48a_V4`, `Standard_E64a_V4`, `Standard_E96a_V4`, `Standard_G1`, `Standard_G2`, `Standard_G3`, `Standard_G4`, `Standard_G5`, `Standard_F2s_V2`, `Standard_F4s_V2`, `Standard_F8s_V2`, `Standard_F16s_V2`, `Standard_F32s_V2`, `Standard_F64s_V2`, `Standard_F72s_V2`, `Standard_GS1`, `Standard_GS2`, `Standard_GS3`, `Standard_GS4`, `Standard_GS5` and `Standard_NC24`. * `install_script_action` - (Required) A `install_script_action` block as defined below. +* `https_endpoints` - (Optional) The HTTPS Connectivity Endpoint for this HDInsight Hadoop Cluster. + +* `uninstall_script_actions` - (Optional) A `uninstall_script_actions` block as defined below. Changing this forces a new resource to be created. + --- A `install_script_action` block supports the following: @@ -307,7 +319,7 @@ A `install_script_action` block supports the following: --- -A `https_endpints` block supports the following: +A `https_endpoints` block supports the following: * `access_modes` - (Optional) A list of access modes for the application. @@ -323,9 +335,9 @@ A `https_endpints` block supports the following: A `uninstall_script_actions` block supports the following: -* `name` - (Required) The name of the uninstall script action. Changing this forces a new resource to be created. +* `name` - (Required) The name of the uninstall script action. -* `uri` - (Required) The URI pointing to the script to run during the installation of the edge node. Changing this forces a new resource to be created. +* `uri` - (Required) The URI pointing to the script to run during the installation of the edge node. * `parameters` - (Optional) The parameters for the script. diff --git a/website/docs/r/hdinsight_hbase_cluster.html.markdown b/website/docs/r/hdinsight_hbase_cluster.html.markdown index dd401504a92f..5c5a292405b2 100644 --- a/website/docs/r/hdinsight_hbase_cluster.html.markdown +++ b/website/docs/r/hdinsight_hbase_cluster.html.markdown @@ -89,6 +89,8 @@ The following arguments are supported: * `cluster_version` - (Required) Specifies the Version of HDInsights which should be used for this Cluster. Changing this forces a new resource to be created. +* `disk_encryption` - (Optional) One or more `disk_encryption` block as defined below. + * `component_version` - (Required) A `component_version` block as defined below. * `gateway` - (Required) A `gateway` block as defined below. @@ -161,13 +163,13 @@ A `head_node` block supports the following: --- -A `script_action` block supports the following: +A `script_actions` block supports the following: * `name` - (Required) The name of the script action. * `uri` - (Required) The URI to the script. -* `parameters` - (Required) The parameters for the script provided. +* `parameters` - (Optional) The parameters for the script provided. --- @@ -233,6 +235,8 @@ A `storage_account_gen2` block supports the following: A `worker_node` block supports the following: +* `script_actions` - (Optional) The script action which will run on the cluster. Changing this forces a new resource to be created. + * `username` - (Required) The Username of the local administrator for the Worker Nodes. Changing this forces a new resource to be created. * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Worker Nodes. Possible values are `ExtraSmall`, `Small`, `Medium`, `Large`, `ExtraLarge`, `A5`, `A6`, `A7`, `A8`, `A9`, `A10`, `A11`, `Standard_A1_V2`, `Standard_A2_V2`, `Standard_A2m_V2`, `Standard_A3`, `Standard_A4_V2`, `Standard_A4m_V2`, `Standard_A8_V2`, `Standard_A8m_V2`, `Standard_D1`, `Standard_D2`, `Standard_D3`, `Standard_D4`, `Standard_D11`, `Standard_D12`, `Standard_D13`, `Standard_D14`, `Standard_D1_V2`, `Standard_D2_V2`, `Standard_D3_V2`, `Standard_D4_V2`, `Standard_D5_V2`, `Standard_D11_V2`, `Standard_D12_V2`, `Standard_D13_V2`, `Standard_D14_V2`, `Standard_DS1_V2`, `Standard_DS2_V2`, `Standard_DS3_V2`, `Standard_DS4_V2`, `Standard_DS5_V2`, `Standard_DS11_V2`, `Standard_DS12_V2`, `Standard_DS13_V2`, `Standard_DS14_V2`, `Standard_E2_V3`, `Standard_E4_V3`, `Standard_E8_V3`, `Standard_E16_V3`, `Standard_E20_V3`, `Standard_E32_V3`, `Standard_E64_V3`, `Standard_E64i_V3`, `Standard_E2s_V3`, `Standard_E4s_V3`, `Standard_E8s_V3`, `Standard_E16s_V3`, `Standard_E20s_V3`, `Standard_E32s_V3`, `Standard_E64s_V3`, `Standard_E64is_V3`, `Standard_D2a_V4`, `Standard_D4a_V4`, `Standard_D8a_V4`, `Standard_D16a_V4`, `Standard_D32a_V4`, `Standard_D48a_V4`, `Standard_D64a_V4`, `Standard_D96a_V4`, `Standard_E2a_V4`, `Standard_E4a_V4`, `Standard_E8a_V4`, `Standard_E16a_V4`, `Standard_E20a_V4`, `Standard_E32a_V4`, `Standard_E48a_V4`, `Standard_E64a_V4`, `Standard_E96a_V4`, `Standard_G1`, `Standard_G2`, `Standard_G3`, `Standard_G4`, `Standard_G5`, `Standard_F2s_V2`, `Standard_F4s_V2`, `Standard_F8s_V2`, `Standard_F16s_V2`, `Standard_F32s_V2`, `Standard_F64s_V2`, `Standard_F72s_V2`, `Standard_GS1`, `Standard_GS2`, `Standard_GS3`, `Standard_GS4`, `Standard_GS5` and `Standard_NC24`. Changing this forces a new resource to be created. @@ -269,6 +273,8 @@ A `disk_encryption` block supports the following: A `zookeeper_node` block supports the following: +* `script_actions` - (Optional) The script action which will run on the cluster. Changing this forces a new resource to be created. + * `username` - (Required) The Username of the local administrator for the Zookeeper Nodes. Changing this forces a new resource to be created. * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Zookeeper Nodes. Possible values are `ExtraSmall`, `Small`, `Medium`, `Large`, `ExtraLarge`, `A5`, `A6`, `A7`, `A8`, `A9`, `A10`, `A11`, `Standard_A1_V2`, `Standard_A2_V2`, `Standard_A2m_V2`, `Standard_A3`, `Standard_A4_V2`, `Standard_A4m_V2`, `Standard_A8_V2`, `Standard_A8m_V2`, `Standard_D1`, `Standard_D2`, `Standard_D3`, `Standard_D4`, `Standard_D11`, `Standard_D12`, `Standard_D13`, `Standard_D14`, `Standard_D1_V2`, `Standard_D2_V2`, `Standard_D3_V2`, `Standard_D4_V2`, `Standard_D5_V2`, `Standard_D11_V2`, `Standard_D12_V2`, `Standard_D13_V2`, `Standard_D14_V2`, `Standard_DS1_V2`, `Standard_DS2_V2`, `Standard_DS3_V2`, `Standard_DS4_V2`, `Standard_DS5_V2`, `Standard_DS11_V2`, `Standard_DS12_V2`, `Standard_DS13_V2`, `Standard_DS14_V2`, `Standard_E2_V3`, `Standard_E4_V3`, `Standard_E8_V3`, `Standard_E16_V3`, `Standard_E20_V3`, `Standard_E32_V3`, `Standard_E64_V3`, `Standard_E64i_V3`, `Standard_E2s_V3`, `Standard_E4s_V3`, `Standard_E8s_V3`, `Standard_E16s_V3`, `Standard_E20s_V3`, `Standard_E32s_V3`, `Standard_E64s_V3`, `Standard_E64is_V3`, `Standard_D2a_V4`, `Standard_D4a_V4`, `Standard_D8a_V4`, `Standard_D16a_V4`, `Standard_D32a_V4`, `Standard_D48a_V4`, `Standard_D64a_V4`, `Standard_D96a_V4`, `Standard_E2a_V4`, `Standard_E4a_V4`, `Standard_E8a_V4`, `Standard_E16a_V4`, `Standard_E20a_V4`, `Standard_E32a_V4`, `Standard_E48a_V4`, `Standard_E64a_V4`, `Standard_E96a_V4`, `Standard_G1`, `Standard_G2`, `Standard_G3`, `Standard_G4`, `Standard_G5`, `Standard_F2s_V2`, `Standard_F4s_V2`, `Standard_F8s_V2`, `Standard_F16s_V2`, `Standard_F32s_V2`, `Standard_F64s_V2`, `Standard_F72s_V2`, `Standard_GS1`, `Standard_GS2`, `Standard_GS3`, `Standard_GS4`, `Standard_GS5` and `Standard_NC24`. Changing this forces a new resource to be created. diff --git a/website/docs/r/hdinsight_interactive_query_cluster.html.markdown b/website/docs/r/hdinsight_interactive_query_cluster.html.markdown index 43f61c7845cd..3a66cf981d17 100644 --- a/website/docs/r/hdinsight_interactive_query_cluster.html.markdown +++ b/website/docs/r/hdinsight_interactive_query_cluster.html.markdown @@ -93,6 +93,8 @@ The following arguments are supported: * `encryption_in_transit_enabled` - (Optional) Whether encryption in transit is enabled for this Cluster. Changing this forces a new resource to be created. +* `disk_encryption` - (Optional) A `disk_encryption` block as defined below. + * `gateway` - (Required) A `gateway` block as defined below. * `roles` - (Required) A `roles` block as defined below. @@ -165,13 +167,13 @@ A `head_node` block supports the following: --- -A `script_action` block supports the following: +A `script_actions` block supports the following: * `name` - (Required) The name of the script action. * `uri` - (Required) The URI to the script. -* `parameters` - (Required) The parameters for the script provided. +* `parameters` - (Optional) The parameters for the script provided. --- @@ -237,6 +239,8 @@ A `storage_account_gen2` block supports the following: A `worker_node` block supports the following: +* `script_actions` - (Optional) The script action which will run on the cluster. Changing this forces a new resource to be created. + * `username` - (Required) The Username of the local administrator for the Worker Nodes. Changing this forces a new resource to be created. * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Worker Nodes. Possible values are `ExtraSmall`, `Small`, `Medium`, `Large`, `ExtraLarge`, `A5`, `A6`, `A7`, `A8`, `A9`, `A10`, `A11`, `Standard_A1_V2`, `Standard_A2_V2`, `Standard_A2m_V2`, `Standard_A3`, `Standard_A4_V2`, `Standard_A4m_V2`, `Standard_A8_V2`, `Standard_A8m_V2`, `Standard_D1`, `Standard_D2`, `Standard_D3`, `Standard_D4`, `Standard_D11`, `Standard_D12`, `Standard_D13`, `Standard_D14`, `Standard_D1_V2`, `Standard_D2_V2`, `Standard_D3_V2`, `Standard_D4_V2`, `Standard_D5_V2`, `Standard_D11_V2`, `Standard_D12_V2`, `Standard_D13_V2`, `Standard_D14_V2`, `Standard_DS1_V2`, `Standard_DS2_V2`, `Standard_DS3_V2`, `Standard_DS4_V2`, `Standard_DS5_V2`, `Standard_DS11_V2`, `Standard_DS12_V2`, `Standard_DS13_V2`, `Standard_DS14_V2`, `Standard_E2_V3`, `Standard_E4_V3`, `Standard_E8_V3`, `Standard_E16_V3`, `Standard_E20_V3`, `Standard_E32_V3`, `Standard_E64_V3`, `Standard_E64i_V3`, `Standard_E2s_V3`, `Standard_E4s_V3`, `Standard_E8s_V3`, `Standard_E16s_V3`, `Standard_E20s_V3`, `Standard_E32s_V3`, `Standard_E64s_V3`, `Standard_E64is_V3`, `Standard_D2a_V4`, `Standard_D4a_V4`, `Standard_D8a_V4`, `Standard_D16a_V4`, `Standard_D32a_V4`, `Standard_D48a_V4`, `Standard_D64a_V4`, `Standard_D96a_V4`, `Standard_E2a_V4`, `Standard_E4a_V4`, `Standard_E8a_V4`, `Standard_E16a_V4`, `Standard_E20a_V4`, `Standard_E32a_V4`, `Standard_E48a_V4`, `Standard_E64a_V4`, `Standard_E96a_V4`, `Standard_G1`, `Standard_G2`, `Standard_G3`, `Standard_G4`, `Standard_G5`, `Standard_F2s_V2`, `Standard_F4s_V2`, `Standard_F8s_V2`, `Standard_F16s_V2`, `Standard_F32s_V2`, `Standard_F64s_V2`, `Standard_F72s_V2`, `Standard_GS1`, `Standard_GS2`, `Standard_GS3`, `Standard_GS4`, `Standard_GS5` and `Standard_NC24`. Changing this forces a new resource to be created. @@ -275,6 +279,8 @@ A `disk_encryption` block supports the following: A `zookeeper_node` block supports the following: +* `script_actions` - (Optional) The script action which will run on the cluster. Changing this forces a new resource to be created. + * `username` - (Required) The Username of the local administrator for the Zookeeper Nodes. Changing this forces a new resource to be created. * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Zookeeper Nodes. Possible values are `ExtraSmall`, `Small`, `Medium`, `Large`, `ExtraLarge`, `A5`, `A6`, `A7`, `A8`, `A9`, `A10`, `A11`, `Standard_A1_V2`, `Standard_A2_V2`, `Standard_A2m_V2`, `Standard_A3`, `Standard_A4_V2`, `Standard_A4m_V2`, `Standard_A8_V2`, `Standard_A8m_V2`, `Standard_D1`, `Standard_D2`, `Standard_D3`, `Standard_D4`, `Standard_D11`, `Standard_D12`, `Standard_D13`, `Standard_D14`, `Standard_D1_V2`, `Standard_D2_V2`, `Standard_D3_V2`, `Standard_D4_V2`, `Standard_D5_V2`, `Standard_D11_V2`, `Standard_D12_V2`, `Standard_D13_V2`, `Standard_D14_V2`, `Standard_DS1_V2`, `Standard_DS2_V2`, `Standard_DS3_V2`, `Standard_DS4_V2`, `Standard_DS5_V2`, `Standard_DS11_V2`, `Standard_DS12_V2`, `Standard_DS13_V2`, `Standard_DS14_V2`, `Standard_E2_V3`, `Standard_E4_V3`, `Standard_E8_V3`, `Standard_E16_V3`, `Standard_E20_V3`, `Standard_E32_V3`, `Standard_E64_V3`, `Standard_E64i_V3`, `Standard_E2s_V3`, `Standard_E4s_V3`, `Standard_E8s_V3`, `Standard_E16s_V3`, `Standard_E20s_V3`, `Standard_E32s_V3`, `Standard_E64s_V3`, `Standard_E64is_V3`, `Standard_D2a_V4`, `Standard_D4a_V4`, `Standard_D8a_V4`, `Standard_D16a_V4`, `Standard_D32a_V4`, `Standard_D48a_V4`, `Standard_D64a_V4`, `Standard_D96a_V4`, `Standard_E2a_V4`, `Standard_E4a_V4`, `Standard_E8a_V4`, `Standard_E16a_V4`, `Standard_E20a_V4`, `Standard_E32a_V4`, `Standard_E48a_V4`, `Standard_E64a_V4`, `Standard_E96a_V4`, `Standard_G1`, `Standard_G2`, `Standard_G3`, `Standard_G4`, `Standard_G5`, `Standard_F2s_V2`, `Standard_F4s_V2`, `Standard_F8s_V2`, `Standard_F16s_V2`, `Standard_F32s_V2`, `Standard_F64s_V2`, `Standard_F72s_V2`, `Standard_GS1`, `Standard_GS2`, `Standard_GS3`, `Standard_GS4`, `Standard_GS5` and `Standard_NC24`. Changing this forces a new resource to be created. diff --git a/website/docs/r/hdinsight_kafka_cluster.html.markdown b/website/docs/r/hdinsight_kafka_cluster.html.markdown index 8a082994c784..a493cb0a4094 100644 --- a/website/docs/r/hdinsight_kafka_cluster.html.markdown +++ b/website/docs/r/hdinsight_kafka_cluster.html.markdown @@ -110,6 +110,8 @@ The following arguments are supported: * `encryption_in_transit_enabled` - (Optional) Whether encryption in transit is enabled for this HDInsight Kafka Cluster. Changing this forces a new resource to be created. +* `disk_encryption` - (Optional) One or more `disk_encryption` block as defined below. + ~> **NOTE:** Starting on June 30, 2020, Azure HDInsight will enforce TLS 1.2 or later versions for all HTTPS connections. For more information, see [Azure HDInsight TLS 1.2 Enforcement](https://azure.microsoft.com/en-us/updates/azure-hdinsight-tls-12-enforcement/). --- @@ -154,6 +156,8 @@ A `compute_isolation` block supports the following: A `head_node` block supports the following: +* `script_actions` - (Optional) The script action which will run on the cluster. Changing this forces a new resource to be created. + * `username` - (Required) The Username of the local administrator for the Head Nodes. Changing this forces a new resource to be created. * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Head Nodes. Possible values are `ExtraSmall`, `Small`, `Medium`, `Large`, `ExtraLarge`, `A5`, `A6`, `A7`, `A8`, `A9`, `A10`, `A11`, `Standard_A1_V2`, `Standard_A2_V2`, `Standard_A2m_V2`, `Standard_A3`, `Standard_A4_V2`, `Standard_A4m_V2`, `Standard_A8_V2`, `Standard_A8m_V2`, `Standard_D1`, `Standard_D2`, `Standard_D3`, `Standard_D4`, `Standard_D11`, `Standard_D12`, `Standard_D13`, `Standard_D14`, `Standard_D1_V2`, `Standard_D2_V2`, `Standard_D3_V2`, `Standard_D4_V2`, `Standard_D5_V2`, `Standard_D11_V2`, `Standard_D12_V2`, `Standard_D13_V2`, `Standard_D14_V2`, `Standard_DS1_V2`, `Standard_DS2_V2`, `Standard_DS3_V2`, `Standard_DS4_V2`, `Standard_DS5_V2`, `Standard_DS11_V2`, `Standard_DS12_V2`, `Standard_DS13_V2`, `Standard_DS14_V2`, `Standard_E2_V3`, `Standard_E4_V3`, `Standard_E8_V3`, `Standard_E16_V3`, `Standard_E20_V3`, `Standard_E32_V3`, `Standard_E64_V3`, `Standard_E64i_V3`, `Standard_E2s_V3`, `Standard_E4s_V3`, `Standard_E8s_V3`, `Standard_E16s_V3`, `Standard_E20s_V3`, `Standard_E32s_V3`, `Standard_E64s_V3`, `Standard_E64is_V3`, `Standard_D2a_V4`, `Standard_D4a_V4`, `Standard_D8a_V4`, `Standard_D16a_V4`, `Standard_D32a_V4`, `Standard_D48a_V4`, `Standard_D64a_V4`, `Standard_D96a_V4`, `Standard_E2a_V4`, `Standard_E4a_V4`, `Standard_E8a_V4`, `Standard_E16a_V4`, `Standard_E20a_V4`, `Standard_E32a_V4`, `Standard_E48a_V4`, `Standard_E64a_V4`, `Standard_E96a_V4`, `Standard_G1`, `Standard_G2`, `Standard_G3`, `Standard_G4`, `Standard_G5`, `Standard_F2s_V2`, `Standard_F4s_V2`, `Standard_F8s_V2`, `Standard_F16s_V2`, `Standard_F32s_V2`, `Standard_F64s_V2`, `Standard_F72s_V2`, `Standard_GS1`, `Standard_GS2`, `Standard_GS3`, `Standard_GS4`, `Standard_GS5` and `Standard_NC24`. Changing this forces a new resource to be created. @@ -230,6 +234,8 @@ A `storage_account_gen2` block supports the following: A `worker_node` block supports the following: +* `script_actions` - (Optional) The script action which will run on the cluster. Changing this forces a new resource to be created. + * `number_of_disks_per_node` - (Required) The number of Data Disks which should be assigned to each Worker Node, which can be between 1 and 8. Changing this forces a new resource to be created. * `username` - (Required) The Username of the local administrator for the Worker Nodes. Changing this forces a new resource to be created. @@ -254,6 +260,8 @@ A `worker_node` block supports the following: A `zookeeper_node` block supports the following: +* `script_actions` - (Optional) The script action which will run on the cluster. Changing this forces a new resource to be created. + * `username` - (Required) The Username of the local administrator for the Zookeeper Nodes. Changing this forces a new resource to be created. * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Zookeeper Nodes. Possible values are `ExtraSmall`, `Small`, `Medium`, `Large`, `ExtraLarge`, `A5`, `A6`, `A7`, `A8`, `A9`, `A10`, `A11`, `Standard_A1_V2`, `Standard_A2_V2`, `Standard_A2m_V2`, `Standard_A3`, `Standard_A4_V2`, `Standard_A4m_V2`, `Standard_A8_V2`, `Standard_A8m_V2`, `Standard_D1`, `Standard_D2`, `Standard_D3`, `Standard_D4`, `Standard_D11`, `Standard_D12`, `Standard_D13`, `Standard_D14`, `Standard_D1_V2`, `Standard_D2_V2`, `Standard_D3_V2`, `Standard_D4_V2`, `Standard_D5_V2`, `Standard_D11_V2`, `Standard_D12_V2`, `Standard_D13_V2`, `Standard_D14_V2`, `Standard_DS1_V2`, `Standard_DS2_V2`, `Standard_DS3_V2`, `Standard_DS4_V2`, `Standard_DS5_V2`, `Standard_DS11_V2`, `Standard_DS12_V2`, `Standard_DS13_V2`, `Standard_DS14_V2`, `Standard_E2_V3`, `Standard_E4_V3`, `Standard_E8_V3`, `Standard_E16_V3`, `Standard_E20_V3`, `Standard_E32_V3`, `Standard_E64_V3`, `Standard_E64i_V3`, `Standard_E2s_V3`, `Standard_E4s_V3`, `Standard_E8s_V3`, `Standard_E16s_V3`, `Standard_E20s_V3`, `Standard_E32s_V3`, `Standard_E64s_V3`, `Standard_E64is_V3`, `Standard_D2a_V4`, `Standard_D4a_V4`, `Standard_D8a_V4`, `Standard_D16a_V4`, `Standard_D32a_V4`, `Standard_D48a_V4`, `Standard_D64a_V4`, `Standard_D96a_V4`, `Standard_E2a_V4`, `Standard_E4a_V4`, `Standard_E8a_V4`, `Standard_E16a_V4`, `Standard_E20a_V4`, `Standard_E32a_V4`, `Standard_E48a_V4`, `Standard_E64a_V4`, `Standard_E96a_V4`, `Standard_G1`, `Standard_G2`, `Standard_G3`, `Standard_G4`, `Standard_G5`, `Standard_F2s_V2`, `Standard_F4s_V2`, `Standard_F8s_V2`, `Standard_F16s_V2`, `Standard_F32s_V2`, `Standard_F64s_V2`, `Standard_F72s_V2`, `Standard_GS1`, `Standard_GS2`, `Standard_GS3`, `Standard_GS4`, `Standard_GS5` and `Standard_NC24`. Changing this forces a new resource to be created. @@ -286,6 +294,8 @@ A `disk_encryption` block supports the following: A `kafka_management_node` block supports the following: +* `script_actions` - (Optional) The script action which will run on the cluster. Changing this forces a new resource to be created. + * `username` - (Required) The Username of the local administrator for the Kafka Management Nodes. Changing this forces a new resource to be created. * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Kafka Management Nodes. Possible values are `ExtraSmall`, `Small`, `Medium`, `Large`, `ExtraLarge`, `A5`, `A6`, `A7`, `A8`, `A9`, `A10`, `A11`, `Standard_A1_V2`, `Standard_A2_V2`, `Standard_A2m_V2`, `Standard_A3`, `Standard_A4_V2`, `Standard_A4m_V2`, `Standard_A8_V2`, `Standard_A8m_V2`, `Standard_D1`, `Standard_D2`, `Standard_D3`, `Standard_D4`, `Standard_D11`, `Standard_D12`, `Standard_D13`, `Standard_D14`, `Standard_D1_V2`, `Standard_D2_V2`, `Standard_D3_V2`, `Standard_D4_V2`, `Standard_D5_V2`, `Standard_D11_V2`, `Standard_D12_V2`, `Standard_D13_V2`, `Standard_D14_V2`, `Standard_DS1_V2`, `Standard_DS2_V2`, `Standard_DS3_V2`, `Standard_DS4_V2`, `Standard_DS5_V2`, `Standard_DS11_V2`, `Standard_DS12_V2`, `Standard_DS13_V2`, `Standard_DS14_V2`, `Standard_E2_V3`, `Standard_E4_V3`, `Standard_E8_V3`, `Standard_E16_V3`, `Standard_E20_V3`, `Standard_E32_V3`, `Standard_E64_V3`, `Standard_E64i_V3`, `Standard_E2s_V3`, `Standard_E4s_V3`, `Standard_E8s_V3`, `Standard_E16s_V3`, `Standard_E20s_V3`, `Standard_E32s_V3`, `Standard_E64s_V3`, `Standard_E64is_V3`, `Standard_D2a_V4`, `Standard_D4a_V4`, `Standard_D8a_V4`, `Standard_D16a_V4`, `Standard_D32a_V4`, `Standard_D48a_V4`, `Standard_D64a_V4`, `Standard_D96a_V4`, `Standard_E2a_V4`, `Standard_E4a_V4`, `Standard_E8a_V4`, `Standard_E16a_V4`, `Standard_E20a_V4`, `Standard_E32a_V4`, `Standard_E48a_V4`, `Standard_E64a_V4`, `Standard_E96a_V4`, `Standard_G1`, `Standard_G2`, `Standard_G3`, `Standard_G4`, `Standard_G5`, `Standard_F2s_V2`, `Standard_F4s_V2`, `Standard_F8s_V2`, `Standard_F16s_V2`, `Standard_F32s_V2`, `Standard_F64s_V2`, `Standard_F72s_V2`, `Standard_GS1`, `Standard_GS2`, `Standard_GS3`, `Standard_GS4`, `Standard_GS5` and `Standard_NC24`. Changing this forces a new resource to be created. @@ -304,6 +314,16 @@ A `kafka_management_node` block supports the following: --- +A `script_actions` block supports the following: + +* `name` - (Required) The name of the script action. + +* `uri` - (Required) The URI to the script. + +* `parameters` - (Optional) The parameters for the script provided. + +--- + A `metastores` block supports the following: * `hive` - (Optional) A `hive` block as defined below. diff --git a/website/docs/r/hdinsight_spark_cluster.html.markdown b/website/docs/r/hdinsight_spark_cluster.html.markdown index c0cb0cbb4813..1a4655925586 100644 --- a/website/docs/r/hdinsight_spark_cluster.html.markdown +++ b/website/docs/r/hdinsight_spark_cluster.html.markdown @@ -93,6 +93,8 @@ The following arguments are supported: * `encryption_in_transit_enabled` - (Optional) Whether encryption in transit is enabled for this Cluster. Changing this forces a new resource to be created. +* `disk_encryption` - (Optional) One or more `disk_encryption` block as defined below. + * `gateway` - (Required) A `gateway` block as defined below. * `roles` - (Required) A `roles` block as defined below. @@ -163,13 +165,13 @@ A `head_node` block supports the following: --- -A `script_action` block supports the following: +A `script_actions` block supports the following: * `name` - (Required) The name of the script action. * `uri` - (Required) The URI to the script. -* `parameters` - (Required) The parameters for the script provided. +* `parameters` - (Optional) The parameters for the script provided. --- @@ -235,6 +237,8 @@ A `storage_account_gen2` block supports the following: A `worker_node` block supports the following: +* `script_actions` - (Optional) The script action which will run on the cluster. Changing this forces a new resource to be created. + * `username` - (Required) The Username of the local administrator for the Worker Nodes. Changing this forces a new resource to be created. * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Worker Nodes. Possible values are `ExtraSmall`, `Small`, `Medium`, `Large`, `ExtraLarge`, `A5`, `A6`, `A7`, `A8`, `A9`, `A10`, `A11`, `Standard_A1_V2`, `Standard_A2_V2`, `Standard_A2m_V2`, `Standard_A3`, `Standard_A4_V2`, `Standard_A4m_V2`, `Standard_A8_V2`, `Standard_A8m_V2`, `Standard_D1`, `Standard_D2`, `Standard_D3`, `Standard_D4`, `Standard_D11`, `Standard_D12`, `Standard_D13`, `Standard_D14`, `Standard_D1_V2`, `Standard_D2_V2`, `Standard_D3_V2`, `Standard_D4_V2`, `Standard_D5_V2`, `Standard_D11_V2`, `Standard_D12_V2`, `Standard_D13_V2`, `Standard_D14_V2`, `Standard_DS1_V2`, `Standard_DS2_V2`, `Standard_DS3_V2`, `Standard_DS4_V2`, `Standard_DS5_V2`, `Standard_DS11_V2`, `Standard_DS12_V2`, `Standard_DS13_V2`, `Standard_DS14_V2`, `Standard_E2_V3`, `Standard_E4_V3`, `Standard_E8_V3`, `Standard_E16_V3`, `Standard_E20_V3`, `Standard_E32_V3`, `Standard_E64_V3`, `Standard_E64i_V3`, `Standard_E2s_V3`, `Standard_E4s_V3`, `Standard_E8s_V3`, `Standard_E16s_V3`, `Standard_E20s_V3`, `Standard_E32s_V3`, `Standard_E64s_V3`, `Standard_E64is_V3`, `Standard_D2a_V4`, `Standard_D4a_V4`, `Standard_D8a_V4`, `Standard_D16a_V4`, `Standard_D32a_V4`, `Standard_D48a_V4`, `Standard_D64a_V4`, `Standard_D96a_V4`, `Standard_E2a_V4`, `Standard_E4a_V4`, `Standard_E8a_V4`, `Standard_E16a_V4`, `Standard_E20a_V4`, `Standard_E32a_V4`, `Standard_E48a_V4`, `Standard_E64a_V4`, `Standard_E96a_V4`, `Standard_G1`, `Standard_G2`, `Standard_G3`, `Standard_G4`, `Standard_G5`, `Standard_F2s_V2`, `Standard_F4s_V2`, `Standard_F8s_V2`, `Standard_F16s_V2`, `Standard_F32s_V2`, `Standard_F64s_V2`, `Standard_F72s_V2`, `Standard_GS1`, `Standard_GS2`, `Standard_GS3`, `Standard_GS4`, `Standard_GS5` and `Standard_NC24`. Changing this forces a new resource to be created. @@ -259,6 +263,8 @@ A `worker_node` block supports the following: A `zookeeper_node` block supports the following: +* `script_actions` - (Optional) The script action which will run on the cluster. Changing this forces a new resource to be created. + * `username` - (Required) The Username of the local administrator for the Zookeeper Nodes. Changing this forces a new resource to be created. * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Zookeeper Nodes. Possible values are `ExtraSmall`, `Small`, `Medium`, `Large`, `ExtraLarge`, `A5`, `A6`, `A7`, `A8`, `A9`, `A10`, `A11`, `Standard_A1_V2`, `Standard_A2_V2`, `Standard_A2m_V2`, `Standard_A3`, `Standard_A4_V2`, `Standard_A4m_V2`, `Standard_A8_V2`, `Standard_A8m_V2`, `Standard_D1`, `Standard_D2`, `Standard_D3`, `Standard_D4`, `Standard_D11`, `Standard_D12`, `Standard_D13`, `Standard_D14`, `Standard_D1_V2`, `Standard_D2_V2`, `Standard_D3_V2`, `Standard_D4_V2`, `Standard_D5_V2`, `Standard_D11_V2`, `Standard_D12_V2`, `Standard_D13_V2`, `Standard_D14_V2`, `Standard_DS1_V2`, `Standard_DS2_V2`, `Standard_DS3_V2`, `Standard_DS4_V2`, `Standard_DS5_V2`, `Standard_DS11_V2`, `Standard_DS12_V2`, `Standard_DS13_V2`, `Standard_DS14_V2`, `Standard_E2_V3`, `Standard_E4_V3`, `Standard_E8_V3`, `Standard_E16_V3`, `Standard_E20_V3`, `Standard_E32_V3`, `Standard_E64_V3`, `Standard_E64i_V3`, `Standard_E2s_V3`, `Standard_E4s_V3`, `Standard_E8s_V3`, `Standard_E16s_V3`, `Standard_E20s_V3`, `Standard_E32s_V3`, `Standard_E64s_V3`, `Standard_E64is_V3`, `Standard_D2a_V4`, `Standard_D4a_V4`, `Standard_D8a_V4`, `Standard_D16a_V4`, `Standard_D32a_V4`, `Standard_D48a_V4`, `Standard_D64a_V4`, `Standard_D96a_V4`, `Standard_E2a_V4`, `Standard_E4a_V4`, `Standard_E8a_V4`, `Standard_E16a_V4`, `Standard_E20a_V4`, `Standard_E32a_V4`, `Standard_E48a_V4`, `Standard_E64a_V4`, `Standard_E96a_V4`, `Standard_G1`, `Standard_G2`, `Standard_G3`, `Standard_G4`, `Standard_G5`, `Standard_F2s_V2`, `Standard_F4s_V2`, `Standard_F8s_V2`, `Standard_F16s_V2`, `Standard_F32s_V2`, `Standard_F64s_V2`, `Standard_F72s_V2`, `Standard_GS1`, `Standard_GS2`, `Standard_GS3`, `Standard_GS4`, `Standard_GS5` and `Standard_NC24`. Changing this forces a new resource to be created. diff --git a/website/docs/r/healthcare_dicom.html.markdown b/website/docs/r/healthcare_dicom.html.markdown index 85c15c18da0d..3f1889af8d90 100644 --- a/website/docs/r/healthcare_dicom.html.markdown +++ b/website/docs/r/healthcare_dicom.html.markdown @@ -48,6 +48,8 @@ The following arguments are supported: * `public_network_access_enabled` - (Optional) Whether to enabled public networks when data plane traffic coming from public networks while private endpoint is enabled. Defaults to `true`. +* `tags` - (Optional) A mapping of tags to assign to the Healthcare DICOM Service. + --- An `identity` block supports the following: diff --git a/website/docs/r/healthcare_fhir_service.html.markdown b/website/docs/r/healthcare_fhir_service.html.markdown index 8f274075493f..7f132c4a10b7 100644 --- a/website/docs/r/healthcare_fhir_service.html.markdown +++ b/website/docs/r/healthcare_fhir_service.html.markdown @@ -67,6 +67,8 @@ The following arguments are supported: * `name` - (Required) Specifies the name of the Healthcare FHIR Service. Changing this forces a new Healthcare FHIR Service to be created. +* `resource_group_name` - (Required) Specifies the name of the Resource Group in which to create the Healthcare FHIR Service. Changing this forces a new resource to be created. + * `workspace_id` - (Required) Specifies the id of the Healthcare Workspace where the Healthcare FHIR Service should exist. Changing this forces a new Healthcare FHIR Service to be created. * `location` - (Required) Specifies the Azure Region where the Healthcare FHIR Service should be created. Changing this forces a new Healthcare FHIR Service to be created. @@ -87,6 +89,8 @@ The following arguments are supported: * `configuration_export_storage_account_name` - (Optional) Specifies the name of the storage account which the operation configuration information is exported to. +* `tags` - (Optional) A mapping of tags to assign to the Healthcare FHIR Service. + --- An `identity` block supports the following: @@ -107,6 +111,7 @@ An `authentication` block supports the following: * `authority` - (Required) The Azure Active Directory (tenant) that serves as the authentication authority to access the service. The default authority is the Directory defined in the authentication scheme in use when running Terraform. Authority must be registered to Azure AD and in the following format: }. * `audience` - (Required) The intended audience to receive authentication tokens for the service. The default value is `https://.fhir.azurehealthcareapis.com`. +* `smart_proxy_enabled` - (Optional) Whether smart proxy is enabled. --- diff --git a/website/docs/r/healthcare_medtech_service.html.markdown b/website/docs/r/healthcare_medtech_service.html.markdown index e3cc34042045..dbfe04879190 100644 --- a/website/docs/r/healthcare_medtech_service.html.markdown +++ b/website/docs/r/healthcare_medtech_service.html.markdown @@ -72,6 +72,8 @@ The following arguments are supported: * `device_mapping_json` - (Required) Specifies the Device Mappings of the Med Tech Service. +* `tags` - (Optional) A mapping of tags to assign to the Healthcare Med Tech Service. + --- A `identity` block supports the following: diff --git a/website/docs/r/healthcare_medtech_service_fhir_destination.html.markdown b/website/docs/r/healthcare_medtech_service_fhir_destination.html.markdown index 5a113dcaa265..bbbf7f3d3f1c 100644 --- a/website/docs/r/healthcare_medtech_service_fhir_destination.html.markdown +++ b/website/docs/r/healthcare_medtech_service_fhir_destination.html.markdown @@ -58,6 +58,8 @@ The following arguments are supported: * `location` - (Required) Specifies the Azure Region where the Healthcare Med Tech Service Fhir Destination should be created. Changing this forces a new Healthcare Med Tech Service Fhir Destination to be created. +* `destination_fhir_service_id` - (Required) Specifies the destination fhir service id of the Med Tech Service Fhir Destination. + * `destination_identity_resolution_type` - (Required) Specifies the destination identity resolution type where the Healthcare Med Tech Service Fhir Destination should be created. Possible values are `Create`, `Lookup`. * `destination_fhir_mapping_json` - (Required) Specifies the destination Fhir mappings of the Med Tech Service Fhir Destination. diff --git a/website/docs/r/healthcare_service.html.markdown b/website/docs/r/healthcare_service.html.markdown index 0258f6c57309..a683a946cd63 100644 --- a/website/docs/r/healthcare_service.html.markdown +++ b/website/docs/r/healthcare_service.html.markdown @@ -56,7 +56,7 @@ The following arguments are supported: ~> **Please Note**: Not all locations support this resource. Some are `West US 2`, `North Central US`, and `UK West`. -* `access_policy_ids` - (Optional) A set of Azure object IDs that are allowed to access the Service. If not configured, the default value is the object id of the service principal or user that is running Terraform. +* `access_policy_object_ids` - (Optional) A set of Azure object IDs that are allowed to access the Service. If not configured, the default value is the object id of the service principal or user that is running Terraform. * `authentication_configuration` - (Optional) An `authentication_configuration` block as defined below. * `cosmosdb_throughput` - (Optional) The provisioned throughput for the backing database. Range of `400`-`10000`. Defaults to `400`. * `cosmosdb_key_vault_key_versionless_id` - (Optional) A versionless Key Vault Key ID for CMK encryption of the backing database. Changing this forces a new resource to be created. diff --git a/website/docs/r/healthcare_workspace.html.markdown b/website/docs/r/healthcare_workspace.html.markdown index cdb250b7ec84..bb064f5cc710 100644 --- a/website/docs/r/healthcare_workspace.html.markdown +++ b/website/docs/r/healthcare_workspace.html.markdown @@ -30,6 +30,8 @@ The following arguments are supported: * `location` - (Required) Specifies the Azure Region where the Healthcare Workspace should be created. Changing this forces a new Healthcare Workspace to be created. +* `tags` - (Optional) A mapping of tags to assign to the Healthcare Workspace. + ## Attributes Reference The following attributes are exported: diff --git a/website/docs/r/integration_service_environment.html.markdown b/website/docs/r/integration_service_environment.html.markdown index 520bb36c7a87..70b89701672a 100644 --- a/website/docs/r/integration_service_environment.html.markdown +++ b/website/docs/r/integration_service_environment.html.markdown @@ -91,7 +91,7 @@ The following arguments are supported: * `location` - (Required) The Azure Region where the Integration Service Environment should exist. Changing this forces a new Integration Service Environment to be created. -* `sku_name` - (Required) The SKU name and capacity of the Integration Service Environment. Possible Values for `sku` element are `Developer` and `Premium` and possible values for the `capacity` element are from `0` to `10`. Defaults to `sku` of `Developer` with a `Capacity` of `0` (e.g. `Developer_0`). Changing this forces a new Integration Service Environment to be created when `sku` element is not the same with existing one. +* `sku_name` - (Optional) The SKU name and capacity of the Integration Service Environment. Possible values are `Developer_0`, `Premium_0`, `Premium_1`, `Premium_2`, `Premium_3`, `Premium_4`, `Premium_5`, `Premium_6`, `Premium_7`, `Premium_8`, `Premium_9` and `Premium_10`. ~> **NOTE** For a `sku_name` using the `Developer` `sku` the `capacity` element must be always `0`. For a `sku_name` using the `sku` of `Premium` the `capacity` element can be between `0` and `10`. diff --git a/website/docs/r/ip_group.html.markdown b/website/docs/r/ip_group.html.markdown index b247e8ddbd4a..5f8cf42de7d1 100644 --- a/website/docs/r/ip_group.html.markdown +++ b/website/docs/r/ip_group.html.markdown @@ -4,7 +4,7 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_ip_group" description: |- Manages an IP group which contains a list of CIDRs and/or IP addresses. - + --- # azurerm_ip_group @@ -32,7 +32,7 @@ resource "azurerm_ip_group" "example" { } ``` -## Argument Reference +## Arguments Reference The following arguments are supported: @@ -44,13 +44,19 @@ The following arguments are supported: * `cidrs` - (Optional) A list of CIDRs or IP addresses. +~> **NOTE:** The AzureRM Terraform provider provides cidr support via the standalone resource [azurerm_ip_group_cidr](ip_group_cidr.html) and in-line within this resource using the `cidrs` property. You cannot use both methods simultaneously. If cidrs are set via the resource `azurerm_ip_group_cidr` then `ignore_changes` should be used in the ip group configuration. + * `tags` - (Optional) A mapping of tags to assign to the resource. ## Attributes Reference -The following attributes are exported: +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the IP group. + +* `firewall_ids` - A `firewall_ids` block as defined below. -* `id` - The ID of the IP Group. +* `firewall_policy_ids` - A `firewall_policy_ids` block as defined below. ## Timeouts diff --git a/website/docs/r/ip_group_cidr.html.markdown b/website/docs/r/ip_group_cidr.html.markdown new file mode 100644 index 000000000000..7325dc87fab0 --- /dev/null +++ b/website/docs/r/ip_group_cidr.html.markdown @@ -0,0 +1,70 @@ +--- +subcategory: "Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_ip_group_cidr" +description: |- + Manages a IP Group CIDR. +--- + +# azurerm_ip_group_cidr + +Manages IP Group CIDR records. + +~> Warning Do not use this resource at the same time as the `cidrs` property of the +`azurerm_ip_group` resource for the same IP Group. Doing so will cause a conflict and +CIDRS will be removed. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "test-rg" + location = "West Europe" +} + +resource "azurerm_ip_group" "example" { + name = "test-ipgroup" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_ip_group_cidr" "example" { + ip_group_id = azurerm_ip_group.example.id + cidr = "10.10.10.0/24" +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `ip_group_id` - (Required) The ID of the destination IP Group. +Changing this forces a new IP Group CIDR to be created. + +* `cidr` - (Required) The `CIDR` that should be added to the IP Group. +Changing this forces a new IP Group CIDR to be created. + +~> **NOTE:** The AzureRM Terraform provider provides cidr support via this standalone resource and in-line within [azurerm_ip_group](ip_group.html) using the `cidrs` property. You cannot use both methods simultaneously. If cidrs are set via this resource then `ignore_changes` should be used in the resource `azurerm_ip_group_cidr` configuration. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the IP Group CIDR. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the IP Group CIDR. +* `read` - (Defaults to 5 minutes) Used when retrieving the IP Group CIDR. +* `delete` - (Defaults to 30 minutes) Used when deleting the IP Group CIDR. + +## Import + +IP Group CIDRs can be imported using the `resource id` of the IP Group and +the CIDR value (`/` characters have to be replaced by `_`), e.g. + +```shell +terraform import azurerm_ip_group_cidr.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Network/ipGroups/test-ipgroup/cidrs/10.1.0.0_24 +``` diff --git a/website/docs/r/key_vault_access_policy.html.markdown b/website/docs/r/key_vault_access_policy.html.markdown index e4b57d113236..b788d4515e20 100644 --- a/website/docs/r/key_vault_access_policy.html.markdown +++ b/website/docs/r/key_vault_access_policy.html.markdown @@ -45,6 +45,20 @@ resource "azurerm_key_vault_access_policy" "example" { "Get", ] } + +data "azuread_service_principal" "example" { + display_name = "example-app" +} + +resource "azurerm_key_vault_access_policy" "example-principal" { + key_vault_id = azurerm_key_vault.example.id + tenant_id = data.azurerm_client_config.current.tenant_id + object_id = data.azuread_service_principal.example.object_id + + key_permissions = [ + "Get", "List", "Encrypt", "Decrypt" + ] +} ``` ## Argument Reference @@ -55,7 +69,7 @@ The following arguments are supported: * `tenant_id` - (Required) The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. Changing this forces a new resource to be created. -* `object_id` - (Required) The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. The object ID must be unique for the list of access policies. Changing this forces a new resource to be created. +* `object_id` - (Required) The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. The object ID of a service principal can be fetched from `azuread_service_principal.object_id`. The object ID must be unique for the list of access policies. Changing this forces a new resource to be created. * `application_id` - (Optional) The object ID of an Application in Azure Active Directory. Changing this forces a new resource to be created. diff --git a/website/docs/r/kubernetes_cluster.html.markdown b/website/docs/r/kubernetes_cluster.html.markdown index 6f1593217e6c..5561b632eda1 100644 --- a/website/docs/r/kubernetes_cluster.html.markdown +++ b/website/docs/r/kubernetes_cluster.html.markdown @@ -97,12 +97,12 @@ In addition, one of either `identity` or `service_principal` blocks must be spec * `azure_active_directory_role_based_access_control` - (Optional) A `azure_active_directory_role_based_access_control` block as defined below. -* `monitor_metrics` - (Optional) Specifies a Prometheus add-on profile for the Kubernetes Cluster. A `monitor_metrics` block as defined below. - -> **Note:** This requires that the Preview Feature `Microsoft.ContainerService/AKS-PrometheusAddonPreview` is enabled, see [the documentation](https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/prometheus-metrics-enable?tabs=azure-portal) for more information. * `azure_policy_enabled` - (Optional) Should the Azure Policy Add-On be enabled? For more details please visit [Understand Azure Policy for Azure Kubernetes Service](https://docs.microsoft.com/en-ie/azure/governance/policy/concepts/rego-for-aks) +* `confidential_computing` - (Optional) A `confidential_computing` block as defined below. For more details please [the documentation](https://learn.microsoft.com/en-us/azure/confidential-computing/confidential-nodes-aks-overview) + * `disk_encryption_set_id` - (Optional) The ID of the Disk Encryption Set which should be used for the Nodes and Volumes. More information [can be found in the documentation](https://docs.microsoft.com/azure/aks/azure-disk-customer-managed-keys). Changing this forces a new resource to be created. * `edge_zone` - (Optional) Specifies the Edge Zone within the Azure Region where this Managed Kubernetes Cluster should exist. Changing this forces a new resource to be created. @@ -127,6 +127,8 @@ In addition, one of either `identity` or `service_principal` blocks must be spec * `ingress_application_gateway` - (Optional) A `ingress_application_gateway` block as defined below. +* `key_management_service` - (Optional) A `key_management_service` block as defined below. For more details, please visit [Key Management Service (KMS) etcd encryption to an AKS cluster](https://learn.microsoft.com/en-us/azure/aks/use-kms-etcd-encryption). + * `key_vault_secrets_provider` - (Optional) A `key_vault_secrets_provider` block as defined below. For more details, please visit [Azure Keyvault Secrets Provider for AKS](https://docs.microsoft.com/azure/aks/csi-secrets-store-driver). * `kubelet_identity` - (Optional) A `kubelet_identity` block as defined below. @@ -147,6 +149,8 @@ In addition, one of either `identity` or `service_principal` blocks must be spec -> **Note:** This requires that the Preview Feature `Microsoft.ContainerService/AKS-AzureDefender` is enabled, see [the documentation](https://docs.microsoft.com/azure/defender-for-cloud/defender-for-containers-enable?tabs=aks-deploy-portal%2Ck8s-deploy-asc%2Ck8s-verify-asc%2Ck8s-remove-arc%2Caks-removeprofile-api&pivots=defender-for-container-aks) for more information. +* `monitor_metrics` - (Optional) Specifies a Prometheus add-on profile for the Kubernetes Cluster. A `monitor_metrics` block as defined below. + * `network_profile` - (Optional) A `network_profile` block as defined below. Changing this forces a new resource to be created. -> **Note:** If `network_profile` is not defined, `kubenet` profile will be used by default. @@ -340,6 +344,12 @@ When `managed` is set to `false` the following properties can be specified: --- +A `confidential_computing` block supports the following: + +* `sgx_quote_helper_enabled` - (Required) Should the SGX quote helper be enabled? + +--- + An `monitor_metrics` block supports the following: * `annotations_allowed` - (Optional) Specifies a comma-separated list of Kubernetes annotation keys that will be used in the resource's labels metric. @@ -386,6 +396,8 @@ A `default_node_pool` block supports the following: * `message_of_the_day` - (Optional) 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 cannot be specified for Windows nodes and must be a static string (i.e. will be printed raw and not executed as a script). Changing this forces a new resource to be created. +* `node_network_profile` - (Optional) A `node_network_profile` block as documented below. + * `node_public_ip_prefix_id` - (Optional) Resource ID for the Public IP Addresses Prefix for the nodes in this Node Pool. `enable_node_public_ip` should be `true`. Changing this forces a new resource to be created. * `node_labels` - (Optional) A map of Kubernetes labels which should be applied to nodes in the Default Node Pool. @@ -460,6 +472,14 @@ An `identity` block supports the following: --- +A `key_management_service` block supports the following: + +* `key_vault_key_id` - (Required) Identifier of Azure Key Vault key. See [key identifier format](https://learn.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 `enabled` is `false`, leave the field empty. + +* `key_vault_network_access` - (Optional) Network access of the key vault Network access of key vault. The possible values are `Public` and `Private`. `Public` means the key vault allows public access from all networks. `Private` means the key vault disables public access and enables private link. The default value is `Public`. + +--- + A `key_vault_secrets_provider` block supports the following: * `secret_rotation_enabled` - (Optional) Is secret rotation enabled? @@ -516,6 +536,14 @@ A `linux_os_config` block supports the following: --- +A `node_network_profile` block supports the following: + +* `node_public_ip_tags` - (Optional) Specifies a mapping of tags to the instance-level public IPs. Changing this forces a new resource to be created. + +-> **Note:** This requires that the Preview Feature `Microsoft.ContainerService/NodePublicIPTagsPreview` is enabled and the Resource Provider is re-registered. + +--- + A `linux_profile` block supports the following: * `admin_username` - (Required) The Admin Username for the Cluster. Changing this forces a new resource to be created. @@ -608,12 +636,6 @@ Examples of how to use [AKS with Advanced Networking](https://docs.microsoft.com ->**Note:** Dual-stack networking requires that the Preview Feature `Microsoft.ContainerService/AKS-EnableDualStack` is enabled and the Resource Provider is re-registered, see [the documentation](https://docs.microsoft.com/azure/aks/configure-kubenet-dual-stack?tabs=azure-cli%2Ckubectl#register-the-aks-enabledualstack-preview-feature) for more information. -* `kube_proxy` - (Optional) A `kube_proxy` block. - -->**Note:** `kube_proxy` requires that the Preview Feature `Microsoft.ContainerService/KubeProxyConfigurationPreview` is enabled and the Resource Provider re-registered, see [the documentation](https://learn.microsoft.com/en-us/azure/aks/configure-kube-proxy#register-the-kubeproxyconfigurationpreview-feature-flag) for more information. - -->**Note:** `kube_proxy` can only be disabled if the cluster is configured with its own (BYO) CNI, i.e. if `network_plugin` is set to `none`. - * `load_balancer_sku` - (Optional) Specifies the SKU of the Load Balancer used for this Kubernetes Cluster. Possible values are `basic` and `standard`. Defaults to `standard`. Changing this forces a new resource to be created. * `load_balancer_profile` - (Optional) A `load_balancer_profile` block as defined below. This can only be specified when `load_balancer_sku` is set to `standard`. Changing this forces a new resource to be created. @@ -622,26 +644,6 @@ Examples of how to use [AKS with Advanced Networking](https://docs.microsoft.com --- -A `kube_proxy` block supports the following: - -* `mode` - (Required) Specifies which proxy mode to use. Possible values are `IPTABLES` and `IPVS`(Must be using Kubernetes version >= 1.22). - -* `ipvs` - (Optional) An `ipvs` block. - ---- - -An `ipvs` block supports the following: - -* `scheduler` - (Optional) Specifies the IPVS scheduler, more information please see [this document](http://www.linuxvirtualserver.org/docs/scheduling.html). - -* `tcp_fin_timeout_in_seconds` - (Optional) Specifies the timeout value used for IPVS TCP sessions after receiving a FIN in seconds. - -* `tcp_timeout_in_seconds` - (Optional) Specifies the timeout value used for idle IPVS TCP sessions in seconds. - -* `udp_timeout_in_seconds` - (Optional) Specifies the timeout value used for IPVS UDP packets in seconds. - ---- - A `load_balancer_profile` block supports the following: ~> **Note:** The fields `managed_outbound_ip_count`, `outbound_ip_address_ids` and `outbound_ip_prefix_ids` are mutually exclusive. Note that when specifying `outbound_ip_address_ids` ([azurerm_public_ip](/docs/providers/azurerm/r/public_ip.html)) the SKU must be `standard`. @@ -790,7 +792,7 @@ A `sysctl_config` block supports the following: A `web_app_routing` block supports the following: -* `dns_zone_id` - (Required) Specifies the ID of the DNS Zone in which DNS entries are created for applications deployed to the cluster when Web App Routing is enabled. +* `dns_zone_id` - (Required) Specifies the ID of the DNS Zone in which DNS entries are created for applications deployed to the cluster when Web App Routing is enabled. For Bring-Your-Own DNS zones this property should be set to an empty string `""`. --- @@ -870,7 +872,31 @@ In addition to all arguments above, the following attributes are exported: * `oidc_issuer_url` - The OIDC issuer URL that is associated with the cluster. -* `node_resource_group` - (Optional) The auto-generated Resource Group which contains the resources for this Managed Kubernetes Cluster. Changing this forces a new resource to be created. +* `node_resource_group` - The auto-generated Resource Group which contains the resources for this Managed Kubernetes Cluster. Changing this forces a new resource to be created. + +* `network_profile` - A `network_profile` block as defined below. + +* `ingress_application_gateway` - An `ingress_application_gateway` block as defined below. + +* `oms_agent` - An `oms_agent` block as defined below. + +* `key_vault_secrets_provider` - A `key_vault_secrets_provider` block as defined below. + +--- + +The `aci_connector_linux` block exports the following: + +* `connector_identity` - A `connector_identity` block is exported. The exported attributes are defined below. + +--- + +The `connector_identity` block exports the following: + +* `client_id` - The Client ID of the user-defined Managed Identity used by the ACI Connector. + +* `object_id` - The Object ID of the user-defined Managed Identity used by the ACI Connector. + +* `user_assigned_identity_id` - The ID of the User Assigned Identity used by the ACI Connector. --- @@ -880,6 +906,12 @@ A `load_balancer_profile` block exports the following: --- +A `network_profile` block supports the following: + +* `nat_gateway_profile` - A `nat_gateway_profile` block as defined below. + +--- + A `nat_gateway_profile` block exports the following: * `effective_outbound_ips` - The outcome (resource IDs) of the specified arguments. diff --git a/website/docs/r/kubernetes_cluster_node_pool.html.markdown b/website/docs/r/kubernetes_cluster_node_pool.html.markdown index ec6aae03b8d1..2168525903f0 100644 --- a/website/docs/r/kubernetes_cluster_node_pool.html.markdown +++ b/website/docs/r/kubernetes_cluster_node_pool.html.markdown @@ -106,6 +106,8 @@ The following arguments are supported: * `mode` - (Optional) Should this Node Pool be used for System or User resources? Possible values are `System` and `User`. Defaults to `User`. +* `node_network_profile` - (Optional) A `node_network_profile` block as documented below. + * `node_labels` - (Optional) A map of Kubernetes labels which should be applied to nodes in this Node Pool. * `node_public_ip_prefix_id` - (Optional) Resource ID for the Public IP Addresses Prefix for the nodes in this Node Pool. `enable_node_public_ip` should be `true`. Changing this forces a new resource to be created. @@ -148,8 +150,6 @@ The following arguments are supported: * `vnet_subnet_id` - (Optional) The ID of the Subnet where this Node Pool should exist. Changing this forces a new resource to be created. --> **NOTE:** At this time the `vnet_subnet_id` must be the same for all node pools in the cluster - ~> **NOTE:** A route table must be configured on this Subnet. * `windows_profile` - (Optional) A `windows_profile` block as documented below. Changing this forces a new resource to be created. @@ -214,6 +214,13 @@ A `linux_os_config` block supports the following: --- +A `node_network_profile` block supports the following: + +* `node_public_ip_tags` - (Optional) Specifies a mapping of tags to the instance-level public IPs. Changing this forces a new resource to be created. + +-> **Note:** This requires that the Preview Feature `Microsoft.ContainerService/NodePublicIPTagsPreview` is enabled and the Resource Provider is re-registered. +--- + A `sysctl_config` block supports the following: ~> For more information, please refer to [Linux Kernel Doc](https://www.kernel.org/doc/html/latest/admin-guide/sysctl/index.html). diff --git a/website/docs/r/lab_service_schedule.html.markdown b/website/docs/r/lab_service_schedule.html.markdown new file mode 100644 index 000000000000..dbaae281fd4e --- /dev/null +++ b/website/docs/r/lab_service_schedule.html.markdown @@ -0,0 +1,110 @@ +--- +subcategory: "Lab Service" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_lab_service_schedule" +description: |- + Manages a Lab Service Schedule. +--- + +# azurerm_lab_service_schedule + +Manages a Lab Service Schedule. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_lab_service_lab" "example" { + name = "example-lab" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + title = "Test Title" + + security { + open_access_enabled = false + } + + virtual_machine { + admin_user { + username = "testadmin" + password = "Password1234!" + } + + image_reference { + offer = "0001-com-ubuntu-server-focal" + publisher = "canonical" + sku = "20_04-lts" + version = "latest" + } + + sku { + name = "Classic_Fsv2_2_4GB_128_S_SSD" + capacity = 1 + } + } +} + +resource "azurerm_lab_service_schedule" "example" { + name = "example-labschedule" + lab_id = azurerm_lab_service_lab.example.id + stop_time = "2022-11-28T00:00:00Z" + time_zone = "America/Los_Angeles" +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name which should be used for this Lab Service Schedule. Changing this forces a new resource to be created. + +* `lab_id` - (Required) The resource ID of the Lab Service Schedule. Changing this forces a new resource to be created. + +* `stop_time` - (Required) When Lab User Virtual Machines will be stopped in RFC-3339 format. + +* `time_zone` - (Required) The IANA Time Zone ID for the Schedule. + +* `notes` - (Optional) The notes for the Schedule. + +* `recurrence` - (Optional) A `recurrence` block as defined below. + +* `start_time` - (Optional) When Lab User Virtual Machines will be started in RFC-3339 format. + +--- + +A `recurrence` block supports the following: + +* `expiration_date` - (Required) When the recurrence will expire in RFC-3339 format. + +* `frequency` - (Required) The frequency of the recurrence. Possible values are `Daily` and `Weekly`. + +* `interval` - (Optional) The interval to invoke the schedule on. Possible values are between `1` and `365`. + +* `week_days` - (Optional) The interval to invoke the schedule on. Possible values are `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday`, `Friday` and `Saturday`. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Lab Service Schedule. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Lab Service Schedule. +* `read` - (Defaults to 5 minutes) Used when retrieving the Lab Service Schedule. +* `update` - (Defaults to 30 minutes) Used when updating the Lab Service Schedule. +* `delete` - (Defaults to 30 minutes) Used when deleting the Lab Service Schedule. + +## Import + +Lab Service Schedules can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_lab_service_schedule.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.LabServices/labs/lab1/schedules/schedule1 +``` diff --git a/website/docs/r/lb_backend_address_pool.html.markdown b/website/docs/r/lb_backend_address_pool.html.markdown index a77d2367b2e7..5bb72f4e5c2c 100644 --- a/website/docs/r/lb_backend_address_pool.html.markdown +++ b/website/docs/r/lb_backend_address_pool.html.markdown @@ -54,6 +54,8 @@ The following arguments are supported: * `tunnel_interface` - (Optional) One or more `tunnel_interface` blocks as defined below. +* `virtual_network_id` - (Optional) The ID of the Virtual Network within which the Backend Address Pool should exist. + --- The `tunnel_interface` block supports the following: diff --git a/website/docs/r/linux_function_app.html.markdown b/website/docs/r/linux_function_app.html.markdown index e65f81526e56..3bdb0aa3d9d8 100644 --- a/website/docs/r/linux_function_app.html.markdown +++ b/website/docs/r/linux_function_app.html.markdown @@ -44,7 +44,7 @@ resource "azurerm_linux_function_app" "example" { location = azurerm_resource_group.example.location storage_account_name = azurerm_storage_account.example.name - storage_account_access_key = azurerm_storage_account.example.primary_connection_string + storage_account_access_key = azurerm_storage_account.example.primary_access_key service_plan_id = azurerm_service_plan.example.id site_config {} diff --git a/website/docs/r/linux_function_app_slot.html.markdown b/website/docs/r/linux_function_app_slot.html.markdown index 8f93d46530b9..42b81bb46e72 100644 --- a/website/docs/r/linux_function_app_slot.html.markdown +++ b/website/docs/r/linux_function_app_slot.html.markdown @@ -100,6 +100,8 @@ The following arguments are supported: * `key_vault_reference_identity_id` - (Optional) The User Assigned Identity ID used for accessing KeyVault secrets. The identity must be assigned to the application in the `identity` block. [For more information see - Access vaults with a user-assigned identity](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references#access-vaults-with-a-user-assigned-identity) +* `service_plan_id` - (Optional) The ID of the Service Plan in which to run this slot. If not specified the same Service Plan as the Linux Function App will be used. + * `storage_account_access_key` - (Optional) The access key which will be used to access the storage account for the Function App Slot. * `storage_account_name` - (Optional) The backend storage account name which will be used by this Function App Slot. diff --git a/website/docs/r/linux_web_app.html.markdown b/website/docs/r/linux_web_app.html.markdown index f6dc48d2027e..5b764a9592e9 100644 --- a/website/docs/r/linux_web_app.html.markdown +++ b/website/docs/r/linux_web_app.html.markdown @@ -217,7 +217,7 @@ An `azure_blob_storage` block supports the following: * `level` - (Required) The level at which to log. Possible values include `Error`, `Warning`, `Information`, `Verbose` and `Off`. **NOTE:** this field is not available for `http_logs` -* `retention_in_days` - (Optional) The time in days after which to remove blobs. A value of `0` means no retention. +* `retention_in_days` - (Required) The time in days after which to remove blobs. A value of `0` means no retention. * `sas_url` - (Required) SAS url to an Azure blob container with read/write/list/delete permissions. @@ -313,12 +313,20 @@ A `headers` block supports the following: A `http_logs` block supports the following: -* `azure_blob_storage` - (Optional) A `azure_blob_storage` block as defined above. +* `azure_blob_storage` - (Optional) A `azure_blob_storage_http` block as defined below. * `file_system` - (Optional) A `file_system` block as defined above. --- +An `azure_blob_storage_http` block supports the following: + +* `retention_in_days` - (Optional) The time in days after which to remove blobs. A value of `0` means no retention. + +* `sas_url` - (Required) SAS url to an Azure blob container with read/write/list/delete permissions. + +--- + An `identity` block supports the following: * `type` - (Required) Specifies the type of Managed Service Identity that should be configured on this Linux Web App. Possible values are `SystemAssigned`, `UserAssigned`, and `SystemAssigned, UserAssigned` (to enable both). diff --git a/website/docs/r/linux_web_app_slot.html.markdown b/website/docs/r/linux_web_app_slot.html.markdown index e857ee2cafee..16f369840015 100644 --- a/website/docs/r/linux_web_app_slot.html.markdown +++ b/website/docs/r/linux_web_app_slot.html.markdown @@ -54,7 +54,7 @@ The following arguments are supported: * `name` - (Required) The name which should be used for this Linux Web App Slot. Changing this forces a new Linux Web App Slot to be created. -* ~> **NOTE:** Terraform will perform a name availability check as part of the creation progress, if this Web App is part of an App Service Environment terraform will require Read permission on the ASE for this to complete reliably. +~> **NOTE:** Terraform will perform a name availability check as part of the creation progress, if this Web App is part of an App Service Environment terraform will require Read permission on the ASE for this to complete reliably. * `app_service_id` - (Required) The ID of the Linux Web App this Deployment Slot will be part of. @@ -88,6 +88,8 @@ The following arguments are supported: * `logs` - (Optional) A `logs` block as defined below. +* `service_plan_id` - (Optional) The ID of the Service Plan in which to run this slot. If not specified the same Service Plan as the Linux Web App will be used. + * `storage_account` - (Optional) One or more `storage_account` blocks as defined below. * `virtual_network_subnet_id` - (Optional) The subnet id which will be used by this Web App Slot for [regional virtual network integration](https://docs.microsoft.com/en-us/azure/app-service/overview-vnet-integration#regional-virtual-network-integration). @@ -218,7 +220,7 @@ An `azure_blob_storage` block supports the following: * `level` - (Required) The level at which to log. Possible values include `Error`, `Warning`, `Information`, `Verbose` and `Off`. **NOTE:** this field is not available for `http_logs` -* `retention_in_days` - (Optional) The time in days after which to remove blobs. A value of `0` means no retention. +* `retention_in_days` - (Required) The time in days after which to remove blobs. A value of `0` means no retention. * `sas_url` - (Required) SAS URL to an Azure blob container with read/write/list/delete permissions. @@ -238,6 +240,8 @@ A `backup` block supports the following: A `connection_string` block supports the following: +* `name` - (Required) The name of the Connection String. + * `type` - (Required) Type of database. Possible values include `APIHub`, `Custom`, `DocDb`, `EventHub`, `MySQL`, `NotificationHub`, `PostgreSQL`, `RedisCache`, `ServiceBus`, `SQLAzure`, and `SQLServer`. * `value` - (Required) The connection string value. @@ -312,12 +316,20 @@ A `headers` block supports the following: A `http_logs` block supports the following: -* `azure_blob_storage` - (Optional) A `azure_blob_storage` block as defined above. +* `azure_blob_storage` - (Optional) A `azure_blob_storage_http` block as defined above. * `file_system` - (Optional) A `file_system` block as defined above. --- +An `azure_blob_storage_http` block supports the following: + +* `retention_in_days` - (Optional) The time in days after which to remove blobs. A value of `0` means no retention. + +* `sas_url` - (Required) SAS url to an Azure blob container with read/write/list/delete permissions. + +--- + An `identity` block supports the following: * `type` - (Required) Specifies the type of Managed Service Identity that should be configured on this Linux Web App Slot. Possible values are `SystemAssigned`, `UserAssigned` and `SystemAssigned, UserAssigned` (to enable both). @@ -478,7 +490,7 @@ A `site_config` block supports the following: * `vnet_route_all_enabled` - (Optional) Should all outbound traffic have NAT Gateways, Network Security Groups and User Defined Routes applied? Defaults to `false`. -* `websockets` - (Optional) Should Web Sockets be enabled? Defaults to `false`. +* `websockets_enabled` - (Optional) Should Web Sockets be enabled? Defaults to `false`. * `worker_count` - (Optional) The number of Workers for this Linux App Service Slot. diff --git a/website/docs/r/load_test.html.markdown b/website/docs/r/load_test.html.markdown index be5870c858b3..234b36059c71 100644 --- a/website/docs/r/load_test.html.markdown +++ b/website/docs/r/load_test.html.markdown @@ -15,7 +15,7 @@ Manages a Load Test Service. ## Example Usage ```hcl -resource "azurerm_load_example" "example" { +resource "azurerm_load_test" "example" { location = azurerm_resource_group.example.location name = "example" resource_group_name = azurerm_resource_group.example.name diff --git a/website/docs/r/log_analytics_workspace.html.markdown b/website/docs/r/log_analytics_workspace.html.markdown index f1e2dc87451a..3f399c207d2e 100644 --- a/website/docs/r/log_analytics_workspace.html.markdown +++ b/website/docs/r/log_analytics_workspace.html.markdown @@ -39,6 +39,8 @@ The following arguments are supported: * `allow_resource_only_permissions` - (Optional) Specifies if the log Analytics Workspace allow users accessing to data associated with resources they have permission to view, without permission to workspace. Defaults to `true`. +* `local_authentication_disabled` - (Optional) Specifies if the log Analytics workspace should enforce authentication using Azure AD. Defaults to `false`. + * `sku` - (Optional) Specifies the SKU of the Log Analytics Workspace. Possible values are `Free`, `PerNode`, `Premium`, `Standard`, `Standalone`, `Unlimited`, `CapacityReservation`, and `PerGB2018` (new SKU as of `2018-04-03`). Defaults to `PerGB2018`. ~> **NOTE:** A new pricing model took effect on `2018-04-03`, which requires the SKU `PerGB2018`. If you're provisioned resources before this date you have the option of remaining with the previous Pricing SKU and using the other SKUs defined above. More information about [the Pricing SKUs is available at the following URI](https://aka.ms/PricingTierWarning). diff --git a/website/docs/r/logic_app_integration_account_batch_configuration.html.markdown b/website/docs/r/logic_app_integration_account_batch_configuration.html.markdown index 7ed41cd3a241..3b3392684cdb 100644 --- a/website/docs/r/logic_app_integration_account_batch_configuration.html.markdown +++ b/website/docs/r/logic_app_integration_account_batch_configuration.html.markdown @@ -67,7 +67,7 @@ A `release_criteria` block exports the following: A `recurrence` block exports the following: -* `frequency` - (Required) The frequency of the schedule. Possible values are `Day`, `Hour`, `Minute`, `Month`, `Second`, `Week` and `Year`. +* `frequency` - (Required) The frequency of the schedule. Possible values are `Day`, `Hour`, `Minute`, `Month`, `NotSpecified`, `Second`, `Week` and `Year`. * `interval` - (Required) The number of `frequency`s between runs. diff --git a/website/docs/r/logic_app_integration_account_map.html.markdown b/website/docs/r/logic_app_integration_account_map.html.markdown index e8f5c6baf3cf..818206cd769a 100644 --- a/website/docs/r/logic_app_integration_account_map.html.markdown +++ b/website/docs/r/logic_app_integration_account_map.html.markdown @@ -46,7 +46,7 @@ The following arguments are supported: * `content` - (Required) The content of the Logic App Integration Account Map. -* `map_type` - (Required) The type of the Logic App Integration Account Map. Possible values are `Xslt`, `Xslt20`, `Xslt30` and `Liquid`. +* `map_type` - (Required) The type of the Logic App Integration Account Map. Possible values are `Liquid`, `NotSpecified`, `Xslt`, `Xslt30` and `Xslt20`. * `metadata` - (Optional) The metadata of the Logic App Integration Account Map. diff --git a/website/docs/r/machine_learning_datastore_blobstorage.html.markdown b/website/docs/r/machine_learning_datastore_blobstorage.html.markdown new file mode 100644 index 000000000000..e55dc9fea46e --- /dev/null +++ b/website/docs/r/machine_learning_datastore_blobstorage.html.markdown @@ -0,0 +1,123 @@ +--- +subcategory: "Machine Learning" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_machine_learning_datastore_blobstorage" +description: |- + Manages a Machine Learning Blob Storage DataStore. +--- + +# azurerm_machine_learning_datastore_blobstorage + +Manages a Machine Learning Blob Storage DataStore. + +## Example Usage with Azure Blob + +```hcl +provider "azurerm" { + features {} +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_application_insights" "example" { + name = "workspace-example-ai" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + application_type = "web" +} + +resource "azurerm_key_vault" "example" { + name = "workspaceexamplekeyvault" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + tenant_id = data.azurerm_client_config.current.tenant_id + sku_name = "premium" +} + +resource "azurerm_storage_account" "example" { + name = "workspacestorageaccount" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + account_tier = "Standard" + account_replication_type = "GRS" +} + +resource "azurerm_machine_learning_workspace" "example" { + name = "example-workspace" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + application_insights_id = azurerm_application_insights.example.id + key_vault_id = azurerm_key_vault.example.id + storage_account_id = azurerm_storage_account.example.id + + identity { + type = "SystemAssigned" + } +} + +resource "azurerm_storage_container" "example" { + name = "example-container" + storage_account_name = azurerm_storage_account.example.name + container_access_type = "private" +} + +resource "azurerm_machine_learning_datastore_blobstorage" "example" { + name = "example-datastore" + workspace_id = azurerm_machine_learning_workspace.example.id + storage_container_id = azurerm_storage_container.example.resource_manager_id + account_key = azurerm_storage_account.example.primary_access_key +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Machine Learning DataStore. Changing this forces a new Machine Learning DataStore to be created. + +* `workspace_id` - (Required) The ID of the Machine Learning Workspace. Changing this forces a new Machine Learning DataStore to be created. + +* `storage_container_id` - (Required) The ID of the Storage Account Container. Changing this forces a new Machine Learning DataStore to be created. + +--- +* `account_key` - (Optional) The access key of the Storage Account. Conflicts with `shared_access_signature`. + +* `shared_access_signature` - (Optional) The Shared Access Signature of the Storage Account. Conflicts with `account_key`. + +* `description` - (Optional) Text used to describe the asset. Changing this forces a new Machine Learning DataStore to be created. + +* `is_default` - (Optional) Specifies whether this Machines Learning DataStore is the default for the Workspace. Defaults to `false`. + +~> **Note:** `is_default` can only be set to `true` on update. + +* `service_data_auth_identity` - (Optional) Specifies which identity to use when retrieving data from the specified source. Defaults to `None`. Possible values are `None`, `WorkspaceSystemAssignedIdentity` and `WorkspaceUserAssignedIdentity`. + +* `tags` - (Optional) A mapping of tags which should be assigned to the Machine Learning DataStore. Changing this forces a new Machine Learning DataStore to be created. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Machine Learning DataStore. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Machine Learning DataStore. +* `read` - (Defaults to 5 minutes) Used when retrieving the Machine Learning DataStore. +* `update` - (Defaults to 30 minutes) Used when updating the Machine Learning DataStore. +* `delete` - (Defaults to 30 minutes) Used when deleting the Machine Learning DataStore. + +## Import + +Machine Learning DataStores can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_machine_learning_datastore_blobstorage.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.MachineLearningServices/workspaces/mlw1/datastores/datastore1 +``` diff --git a/website/docs/r/machine_learning_datastore_datalake_gen2.html.markdown b/website/docs/r/machine_learning_datastore_datalake_gen2.html.markdown new file mode 100644 index 000000000000..9cd7e989a067 --- /dev/null +++ b/website/docs/r/machine_learning_datastore_datalake_gen2.html.markdown @@ -0,0 +1,123 @@ +--- +subcategory: "Machine Learning" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_machine_learning_datastore_datalake_gen2" +description: |- + Manages a Machine Learning Data Lake Gen2 DataStore. +--- + +# azurerm_machine_learning_datastore_datalake_gen2 + +Manages a Machine Learning Data Lake Gen2 DataStore. + +## Example Usage + +```hcl +provider "azurerm" { + features {} +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_application_insights" "example" { + name = "workspace-example-ai" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + application_type = "web" +} + +resource "azurerm_key_vault" "example" { + name = "workspaceexamplekeyvault" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + tenant_id = data.azurerm_client_config.current.tenant_id + sku_name = "premium" +} + +resource "azurerm_storage_account" "example" { + name = "workspacestorageaccount" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + account_tier = "Standard" + account_replication_type = "GRS" +} + +resource "azurerm_machine_learning_workspace" "example" { + name = "example-workspace" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + application_insights_id = azurerm_application_insights.example.id + key_vault_id = azurerm_key_vault.example.id + storage_account_id = azurerm_storage_account.example.id + + identity { + type = "SystemAssigned" + } +} + +resource "azurerm_storage_container" "example" { + name = "example-container" + storage_account_name = azurerm_storage_account.example.name + container_access_type = "private" +} + +resource "azurerm_machine_learning_datastore_datalake_gen2" "example" { + name = "example-datastore" + workspace_id = azurerm_machine_learning_workspace.example.id + storage_container_id = azurerm_storage_container.example.resource_manager_id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Machine Learning DataStore. Changing this forces a new Machine Learning DataStore to be created. + +* `workspace_id` - (Required) The ID of the Machine Learning Workspace. Changing this forces a new Machine Learning DataStore to be created. + +* `storage_container_id` - (Required) The ID of the Storage Account Container. Changing this forces a new Machine Learning DataStore to be created. +--- +* `tenant_id` - (Optional) The ID of the Tenant which the Service Principal belongs to. + +* `client_id` - (Optional) The object ID of the Service Principal. + +* `client_secret` - (Optional) The secret of the Service Principal. + +* `authority_url` - (Optional) An URL used for authentication. + +* `description` - (Optional) Text used to describe the asset. Changing this forces a new Machine Learning DataStore to be created. + +* `service_data_identity` - (Optional) Specifies which identity to use when retrieving data from the specified source. Defaults to `None`. Possible values are `None`, `WorkspaceSystemAssignedIdentity` and `WorkspaceUserAssignedIdentity`. + +* `tags` - (Optional) A mapping of tags which should be assigned to the Machine Learning DataStore. Changing this forces a new Machine Learning DataStore to be created. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Machine Learning DataStore. + +* `is_default` - Indicates whether this Machines Learning DataStore is the default for the Workspace. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Machine Learning DataStore. +* `read` - (Defaults to 5 minutes) Used when retrieving the Machine Learning DataStore. +* `update` - (Defaults to 30 minutes) Used when updating the Machine Learning DataStore. +* `delete` - (Defaults to 30 minutes) Used when deleting the Machine Learning DataStore. + +## Import + +Machine Learning DataStores can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_machine_learning_datastore_datalake_gen2.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.MachineLearningServices/workspaces/mlw1/datastores/datastore1 +``` diff --git a/website/docs/r/machine_learning_datastore_fileshare.html.markdown b/website/docs/r/machine_learning_datastore_fileshare.html.markdown new file mode 100644 index 000000000000..25e0fd8b112e --- /dev/null +++ b/website/docs/r/machine_learning_datastore_fileshare.html.markdown @@ -0,0 +1,121 @@ +--- +subcategory: "Machine Learning" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_machine_learning_datastore_fileshare" +description: |- + Manages a Machine Learning File Sharee DataStore. +--- + +# azurerm_machine_learning_datastore_fileshare + +Manages a Machine Learning File Share DataStore. + +## Example Usage with Azure File Share + +```hcl +provider "azurerm" { + features {} +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_application_insights" "example" { + name = "workspace-example-ai" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + application_type = "web" +} + +resource "azurerm_key_vault" "example" { + name = "workspaceexamplekeyvault" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + tenant_id = data.azurerm_client_config.current.tenant_id + sku_name = "premium" +} + +resource "azurerm_storage_account" "example" { + name = "workspacestorageaccount" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + account_tier = "Standard" + account_replication_type = "GRS" +} + +resource "azurerm_machine_learning_workspace" "example" { + name = "example-workspace" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + application_insights_id = azurerm_application_insights.example.id + key_vault_id = azurerm_key_vault.example.id + storage_account_id = azurerm_storage_account.example.id + + identity { + type = "SystemAssigned" + } +} + +resource "azurerm_storage_share" "example" { + name = "example" + storage_account_name = azurerm_storage_account.example.name + quota = 1 +} + +resource "azurerm_machine_learning_datastore_fileshare" "example" { + name = "example-datastore" + workspace_id = azurerm_machine_learning_workspace.example.id + storage_filesahare_id = azurerm_storage_share.test.resource_manager_id + account_key = azurerm_storage_account.example.primary_access_key +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Machine Learning DataStore. Changing this forces a new Machine Learning DataStore to be created. + +* `workspace_id` - (Required) The ID of the Machine Learning Workspace. Changing this forces a new Machine Learning DataStore to be created. + +* `storage_fileshare_id` - (Required) The ID of the Storage Account File Share. Changing this forces a new Machine Learning DataStore to be created. + +--- +* `account_key` - (Optional) The access key of the Storage Account. Conflicts with `shared_access_signature`. + +* `shared_access_signature` - (Optional) The Shared Access Signature of the Storage Account. Conflicts with `account_key`. + +* `description` - (Optional) Text used to describe the asset. Changing this forces a new Machine Learning DataStore to be created. + +* `service_data_identity` - (Optional) Specifies which identity to use when retrieving data from the specified source. Defaults to `None`. Possible values are `None`, `WorkspaceSystemAssignedIdentity` and `WorkspaceUserAssignedIdentity`. + +* `tags` - (Optional) A mapping of tags which should be assigned to the Machine Learning DataStore. Changing this forces a new Machine Learning DataStore to be created. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Machine Learning DataStore. + +* `is_default` - Indicate whether this Machines Learning DataStore is the default for the Workspace. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Machine Learning DataStore. +* `read` - (Defaults to 5 minutes) Used when retrieving the Machine Learning DataStore. +* `update` - (Defaults to 30 minutes) Used when updating the Machine Learning DataStore. +* `delete` - (Defaults to 30 minutes) Used when deleting the Machine Learning DataStore. + +## Import + +Machine Learning DataStores can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_machine_learning_datastore_fileshare.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.MachineLearningServices/workspaces/mlw1/datastores/datastore1 +``` diff --git a/website/docs/r/machine_learning_workspace.html.markdown b/website/docs/r/machine_learning_workspace.html.markdown index 99c58c66995d..cb650dfeed11 100644 --- a/website/docs/r/machine_learning_workspace.html.markdown +++ b/website/docs/r/machine_learning_workspace.html.markdown @@ -366,7 +366,7 @@ The following arguments are supported: ~> **NOTE:** `public_access_behind_virtual_network_enabled` is deprecated and will be removed in favour of the property `public_network_access_enabled`. -* `image_build_compute_name` - (Optional) The compute name for image build of the Machine Learning Workspace. Changing this forces a new resource to be created. +* `image_build_compute_name` - (Optional) The compute name for image build of the Machine Learning Workspace. * `description` - (Optional) The description of this Machine Learning Workspace. diff --git a/website/docs/r/managed_disk.html.markdown b/website/docs/r/managed_disk.html.markdown index 7633d747452b..d52f3d9f5535 100644 --- a/website/docs/r/managed_disk.html.markdown +++ b/website/docs/r/managed_disk.html.markdown @@ -82,13 +82,14 @@ The following arguments are supported: -> **Note:** Azure Ultra Disk Storage is only available in a region that support availability zones and can only enabled on the following VM series: `ESv3`, `DSv3`, `FSv3`, `LSv2`, `M` and `Mv2`. For more information see the `Azure Ultra Disk Storage` [product documentation](https://docs.microsoft.com/azure/virtual-machines/windows/disks-enable-ultra-ssd). -* `create_option` - (Required) The method to use when creating the managed disk. Changing this forces a new resource to be created. Possible values include: -* `Import` - Import a VHD file in to the managed disk (VHD specified with `source_uri`). -* `Empty` - Create an empty managed disk. -* `Copy` - Copy an existing managed disk or snapshot (specified with `source_resource_id`). -* `FromImage` - Copy a Platform Image (specified with `image_reference_id`) -* `Restore` - Set by Azure Backup or Site Recovery on a restored disk (specified with `source_resource_id`). -* `Upload` - Upload a VHD disk with the help of SAS URL (to be used with `upload_size_bytes`). + * `create_option` - (Required) The method to use when creating the managed disk. Changing this forces a new resource to be created. Possible values include: + * `Import` - Import a VHD file in to the managed disk (VHD specified with `source_uri`). + * `ImportSecure` - Securely import a VHD file in to the managed disk (VHD specified with `source_uri`). + * `Empty` - Create an empty managed disk. + * `Copy` - Copy an existing managed disk or snapshot (specified with `source_resource_id`). + * `FromImage` - Copy a Platform Image (specified with `image_reference_id`) + * `Restore` - Set by Azure Backup or Site Recovery on a restored disk (specified with `source_resource_id`). + * `Upload` - Upload a VHD disk with the help of SAS URL (to be used with `upload_size_bytes`). --- @@ -120,7 +121,7 @@ The following arguments are supported: ~> **NOTE:** Removing `encryption_settings` forces a new resource to be created. -* `hyper_v_generation` - (Optional) The HyperV Generation of the Disk when the source of an `Import` or `Copy` operation targets a source that contains an operating system. Possible values are `V1` and `V2`. Changing this forces a new resource to be created. +* `hyper_v_generation` - (Optional) The HyperV Generation of the Disk when the source of an `Import` or `Copy` operation targets a source that contains an operating system. Possible values are `V1` and `V2`. For `ImportSecure` it must be set to `V2`. Changing this forces a new resource to be created. * `image_reference_id` - (Optional) ID of an existing platform/marketplace disk image to copy when `create_option` is `FromImage`. This field cannot be specified if gallery_image_reference_id is specified. Changing this forces a new resource to be created. @@ -130,13 +131,13 @@ The following arguments are supported: ~> **NOTE:** Setting logical sector size is supported only with `UltraSSD_LRS` disks and `PremiumV2_LRS` disks. -* `os_type` - (Optional) Specify a value when the source of an `Import` or `Copy` operation targets a source that contains an operating system. Valid values are `Linux` or `Windows`. +* `os_type` - (Optional) Specify a value when the source of an `Import`, `ImportSecure` or `Copy` operation targets a source that contains an operating system. Valid values are `Linux` or `Windows`. * `source_resource_id` - (Optional) The ID of an existing Managed Disk or Snapshot to copy when `create_option` is `Copy` or the recovery point to restore when `create_option` is `Restore`. Changing this forces a new resource to be created. -* `source_uri` - (Optional) URI to a valid VHD file to be used when `create_option` is `Import`. Changing this forces a new resource to be created. +* `source_uri` - (Optional) URI to a valid VHD file to be used when `create_option` is `Import` or `ImportSecure`. Changing this forces a new resource to be created. -* `storage_account_id` - (Optional) The ID of the Storage Account where the `source_uri` is located. Required when `create_option` is set to `Import`. Changing this forces a new resource to be created. +* `storage_account_id` - (Optional) The ID of the Storage Account where the `source_uri` is located. Required when `create_option` is set to `Import` or `ImportSecure`. Changing this forces a new resource to be created. * `tier` - (Optional) The disk performance tier to use. Possible values are documented [here](https://docs.microsoft.com/azure/virtual-machines/disks-change-performance). This feature is currently supported only for premium SSDs. @@ -152,6 +153,9 @@ The following arguments are supported: * `security_type` - (Optional) Security Type of the Managed Disk when it is used for a Confidential VM. Possible values are `ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey`, `ConfidentialVM_DiskEncryptedWithPlatformKey` and `ConfidentialVM_DiskEncryptedWithCustomerKey`. Changing this forces a new resource to be created. +~> **NOTE:** When `security_type` is set to `ConfidentialVM_DiskEncryptedWithCustomerKey` the value of `create_option` must be one of `FromImage` or `ImportSecure`. + + ~> **NOTE:** `security_type` cannot be specified when `trusted_launch_enabled` is set to true. ~> **NOTE:** `secure_vm_disk_encryption_set_id` must be specified when `security_type` is set to `ConfidentialVM_DiskEncryptedWithCustomerKey`. diff --git a/website/docs/r/media_content_key_policy.html.markdown b/website/docs/r/media_content_key_policy.html.markdown index eb042f82dc52..b2eeace81d5a 100644 --- a/website/docs/r/media_content_key_policy.html.markdown +++ b/website/docs/r/media_content_key_policy.html.markdown @@ -58,6 +58,7 @@ resource "azurerm_media_content_key_policy" "example" { playready_configuration_license { allow_test_devices = true begin_date = "2017-10-16T18:22:53Z" + security_level = "SL150" play_right { scms_restriction = 2 digital_video_only_content_restriction = false @@ -67,7 +68,12 @@ resource "azurerm_media_content_key_policy" "example" { uncompressed_digital_video_opl = 100 uncompressed_digital_audio_opl = 100 analog_video_opl = 150 - compressed_digital_audio_opl = 150 + compressed_digital_audio_opl = 250 + compressed_digital_video_opl = 400 + explicit_analog_television_output_restriction { + best_effort = true + control_bits = 3 + } } license_type = "Persistent" content_type = "UltraVioletDownload" @@ -83,6 +89,13 @@ resource "azurerm_media_content_key_policy" "example" { audience = "urn:audience" token_type = "Swt" primary_symmetric_token_key = "AAAAAAAAAAAAAAAAAAAAAA==" + alternate_key { + rsa_token_key_exponent = "AQAB" + rsa_token_key_modulus = "AQAD" + } + alternate_key { + symmetric_token_key = "BBAAAAAAAAAAAAAAAAAAAA==" + } } } policy_option { @@ -125,6 +138,28 @@ The following arguments are supported: --- +A `alternate_key` block supports the following: + +* `rsa_token_key_exponent` - (Optional) The RSA parameter exponent. + +* `rsa_token_key_modulus` - (Optional) The RSA parameter modulus. + +* `symmetric_token_key` - (Optional) The key value of the key. Specifies a symmetric key for token validation. + +* `x509_token_key_raw` - (Optional) The raw data field of a certificate in PKCS 12 format (X509Certificate2 in .NET). Specifies a certificate for token validation. + +-> **NOTE:** Each `alternate_key` block can only have one type of primary verification key: if you want to use RSA you must provide `rsa_token_key_exponent` and `rsa_token_key_modulus`, if you want to use symmetric you need to provide `symmetric_token_key` and for x509 you must provide `x509_token_key_raw`. + +--- + +An `explicit_analog_television_output_restriction` block supports the following: + +* `best_effort_enforced` - (Optional) Indicates whether this restriction is enforced on a best effort basis. Possible values are `true` or `false`. Defaults to `false`. + +* `control_bits` - (Required) The restriction control bits. Possible value is integer between `0` and `3` inclusive. + +--- + A `fairplay_configuration` block supports the following: * `ask` - (Optional) The key that must be used as FairPlay Application Secret key. @@ -151,27 +186,31 @@ A `offline_rental_configuration` block supports the following: A `play_right` block supports the following: -* `agc_and_color_stripe_restriction` - (Optional) Configures Automatic Gain Control (AGC) and Color Stripe in the license. Must be between 0 and 3 inclusive. +* `agc_and_color_stripe_restriction` - (Optional) Configures Automatic Gain Control (AGC) and Color Stripe in the license. Must be between `0` and `3` inclusive. * `allow_passing_video_content_to_unknown_output` - (Optional) Configures Unknown output handling settings of the license. Supported values are `Allowed`, `AllowedWithVideoConstriction` or `NotAllowed`. -* `analog_video_opl` - (Optional) Specifies the output protection level for compressed digital audio. Supported values are 100, 150 or 200. +* `analog_video_opl` - (Optional) Specifies the output protection level for compressed digital audio. Supported values are `100`, `150` or `200`. -* `compressed_digital_audio_opl` - (Optional) Specifies the output protection level for compressed digital audio.Supported values are 100, 150 or 200. +* `compressed_digital_audio_opl` - (Optional) Specifies the output protection level for compressed digital audio.Supported values are `100`, `150`, `200`, `250` or `300`. + +* `compressed_digital_video_opl` - (Optional) Specifies the output protection level for compressed digital video. Supported values are `400` or `500`. * `digital_video_only_content_restriction` - (Optional) Enables the Image Constraint For Analog Component Video Restriction in the license. +* `explicit_analog_television_output_restriction` - (Optional) An `explicit_analog_television_output_restriction` block as defined above. + * `first_play_expiration` - (Optional) The amount of time that the license is valid after the license is first used to play content. * `image_constraint_for_analog_component_video_restriction` - (Optional) Enables the Image Constraint For Analog Component Video Restriction in the license. * `image_constraint_for_analog_computer_monitor_restriction` - (Optional) Enables the Image Constraint For Analog Component Video Restriction in the license. -* `scms_restriction` - (Optional) Configures the Serial Copy Management System (SCMS) in the license. Must be between 0 and 3 inclusive. +* `scms_restriction` - (Optional) Configures the Serial Copy Management System (SCMS) in the license. Must be between `0` and `3` inclusive. -* `uncompressed_digital_audio_opl` - (Optional) Specifies the output protection level for uncompressed digital audio. Supported values are 100, 150, 250 or 300. +* `uncompressed_digital_audio_opl` - (Optional) Specifies the output protection level for uncompressed digital audio. Supported values are `100`, `150`, `200`, `250` or `300`. -* `uncompressed_digital_video_opl` - (Optional) Specifies the output protection level for uncompressed digital video. Supported values are 100, 150, 250 or 300. +* `uncompressed_digital_video_opl` - (Optional) Specifies the output protection level for uncompressed digital video. Supported values are `100`, `250`, `270` or `300`. --- @@ -182,9 +221,10 @@ A `playready_configuration_license` block supports the following: * `begin_date` - (Optional) The begin date of license. * `content_key_location_from_header_enabled` - (Optional) Specifies that the content key ID is in the PlayReady header. + * `content_key_location_from_key_id` - (Optional) The content key ID. Specifies that the content key ID is specified in the PlayReady configuration. --> **NOTE:** You can only specify one content key location. For example if you specify content_key_location_from_header_enabled in true, you shouldn't specify content_key_location_from_key_id and vice versa. +-> **NOTE:** You can only specify one content key location. For example if you specify `content_key_location_from_header_enabled` in true, you shouldn't specify `content_key_location_from_key_id` and vice versa. * `content_type` - (Optional) The PlayReady content type. Supported values are `UltraVioletDownload`, `UltraVioletStreaming` or `Unspecified`. @@ -200,6 +240,8 @@ A `playready_configuration_license` block supports the following: * `relative_expiration_date` - (Optional) The relative expiration date of license. +* `security_level` - (Optional) The security level of the PlayReady license. Possible values are `SL150`, `SL2000` and `SL3000`. Please see [this document](https://learn.microsoft.com/en-us/rest/api/media/content-key-policies/create-or-update?tabs=HTTP#securitylevel) for more information about security level. See [this document](https://learn.microsoft.com/en-us/azure/media-services/latest/drm-playready-license-template-concept#playready-sl3000-support) for more information about `SL3000` support. + --- A `policy_option` block supports the following: @@ -214,11 +256,13 @@ A `policy_option` block supports the following: * `playready_configuration_license` - (Optional) One or more `playready_configuration_license` blocks as defined above. +* `playready_response_custom_data` - (Optional) The custom response data of the PlayReady configuration. This only applies when `playready_configuration_license` is specified. + * `token_restriction` - (Optional) A `token_restriction` block as defined below. * `widevine_configuration_template` - (Optional) The Widevine template. --> **NOTE:** Each policy_option can only have one type of configuration: fairplay_configuration,clear_key_configuration_enabled, playready_configuration_license or widevine_configuration_template. And is possible to assign only one type of restriction: open_restriction_enabled or token_restriction. +-> **NOTE:** Each policy_option can only have one type of configuration: `fairplay_configuration`, `clear_key_configuration_enabled`, `playready_configuration_license` or `widevine_configuration_template`. And is possible to assign only one type of restriction: `open_restriction_enabled` or `token_restriction`. --- @@ -232,15 +276,17 @@ A `required_claim` block supports the following: A `token_restriction` block supports the following: +* `alternate_key` - (Optional) One or more `alternate_key` block as defined above. + * `audience` - (Optional) The audience for the token. * `issuer` - (Optional) The token issuer. * `open_id_connect_discovery_document` - (Optional) The OpenID connect discovery document. -* `primary_rsa_token_key_exponent` - (Optional) The RSA Parameter exponent. +* `primary_rsa_token_key_exponent` - (Optional) The RSA parameter exponent. -* `primary_rsa_token_key_modulus` - (Optional) The RSA Parameter modulus. +* `primary_rsa_token_key_modulus` - (Optional) The RSA parameter modulus. * `primary_symmetric_token_key` - (Optional) The key value of the key. Specifies a symmetric key for token validation. @@ -250,7 +296,7 @@ A `token_restriction` block supports the following: * `token_type` - (Optional) The type of token. Supported values are `Jwt` or `Swt`. --> **NOTE:** Each token_restriction can only have one type of primary verification key: if you want use RSA you must provide primary_rsa_token_key_exponent and primary_rsa_token_key_modulus, if you want to use symmetric you need to provide primary_symmetric_token_key and for x509 you must provide primary_x509_token_key_raw. For more information about Token access please refer to +-> **NOTE:** Each token_restriction can only have one type of primary verification key: if you want to use RSA you must provide `primary_rsa_token_key_exponent` and `primary_rsa_token_key_modulus`, if you want to use symmetric you need to provide `primary_symmetric_token_key` and for x509 you must provide `primary_x509_token_key_raw`. For more information about Token access please refer to --- @@ -258,20 +304,20 @@ A `token_restriction` block supports the following: In addition to the Arguments listed above - the following Attributes are exported: -* `id` - The ID of the Resource Group. +* `id` - The ID of the Content Key Policy. ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: -* `create` - (Defaults to 30 minutes) Used when creating the Resource Group. -* `read` - (Defaults to 5 minutes) Used when retrieving the Resource Group. -* `update` - (Defaults to 30 minutes) Used when updating the Resource Group. -* `delete` - (Defaults to 30 minutes) Used when deleting the Resource Group. +* `create` - (Defaults to 30 minutes) Used when creating the Content Key Policy. +* `read` - (Defaults to 5 minutes) Used when retrieving the Content Key Policy. +* `update` - (Defaults to 30 minutes) Used when updating the Content Key Policy. +* `delete` - (Defaults to 30 minutes) Used when deleting the Content Key Policy. ## Import -Resource Groups can be imported using the `resource id`, e.g. +Content Key Policy can be imported using the `resource id`, e.g. ```shell terraform import azurerm_media_content_key_policy.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Media/mediaServices/account1/contentKeyPolicies/policy1 diff --git a/website/docs/r/media_live_event.html.markdown b/website/docs/r/media_live_event.html.markdown index 0238d2799012..465352f87be7 100644 --- a/website/docs/r/media_live_event.html.markdown +++ b/website/docs/r/media_live_event.html.markdown @@ -68,6 +68,7 @@ resource "azurerm_media_live_event" "example" { } } + stream_options = ["LowLatency"] use_static_hostname = true hostname_prefix = "special-event" transcription_languages = ["en-US"] @@ -102,6 +103,8 @@ The following arguments are supported: * `preview` - (Optional) A `preview` block as defined below. +* `stream_options` - (Optional) A list of options to use for the LiveEvent. Possible values are `Default`, `LowLatency`, `LowLatencyV2`. Please see more at this [document](https://learn.microsoft.com/en-us/azure/media-services/latest/live-event-latency-reference#lowlatency-and-lowlatencyv2-options). Changing this forces a new resource to be created. + * `tags` - (Optional) A mapping of tags which should be assigned to the Live Event. * `transcription_languages` - (Optional) Specifies a list of languages (locale) to be used for speech-to-text transcription – it should match the spoken language in the audio track. The value should be in `BCP-47` format (e.g: `en-US`). [See the Microsoft Documentation for more information about the live transcription feature and the list of supported languages](https://go.microsoft.com/fwlink/?linkid=2133742 ). diff --git a/website/docs/r/media_live_output.html.markdown b/website/docs/r/media_live_output.html.markdown index 627fe945552c..5a648bf48884 100644 --- a/website/docs/r/media_live_output.html.markdown +++ b/website/docs/r/media_live_output.html.markdown @@ -70,6 +70,7 @@ resource "azurerm_media_live_event_output" "example" { manifest_name = "testmanifest" output_snap_time_in_seconds = 0 hls_fragments_per_ts_segment = 5 + rewind_window_duration = "PT5M" } ``` @@ -95,6 +96,8 @@ The following arguments are supported: * `output_snap_time_in_seconds` - (Optional) The initial timestamp that the live output will start at, any content before this value will not be archived. Changing this forces a new Live Output to be created. +* `rewind_windown_duration` - (Optional) `ISO 8601` time between 1 minute to the duration of `archive_window_duration` to control seek-able window length during Live. The service won't use this property once LiveOutput stops. The archived VOD will have full content with original ArchiveWindowLength. For example, use `PT1H30M` to indicate 1 hour and 30 minutes of rewind window length. Service will use implicit default value 30m only if Live Event enables LL. Changing this forces a new Live Output to be created. + ## Attributes Reference In addition to the Arguments listed above - the following Attributes are exported: diff --git a/website/docs/r/media_services_account_filter.html.markdown b/website/docs/r/media_services_account_filter.html.markdown index 8c6744f12c84..d9280b950428 100644 --- a/website/docs/r/media_services_account_filter.html.markdown +++ b/website/docs/r/media_services_account_filter.html.markdown @@ -139,7 +139,7 @@ A `selection` block supports the following: A `track_selection` block supports the following: -* `condition` - (Required) One or more `condition` blocks as defined above. +* `condition` - (Required) One or more `selection` blocks as defined above. ## Attributes Reference diff --git a/website/docs/r/media_streaming_endpoint.html.markdown b/website/docs/r/media_streaming_endpoint.html.markdown index ade4f9274c47..09e5d90852e2 100644 --- a/website/docs/r/media_streaming_endpoint.html.markdown +++ b/website/docs/r/media_streaming_endpoint.html.markdown @@ -147,7 +147,7 @@ A `access_control` block supports the following: * `akamai_signature_header_authentication_key` - (Optional) One or more `akamai_signature_header_authentication_key` blocks as defined below. -* `ip_allow` - (Optional) A `ip` block as defined below. +* `ip_allow` - (Optional) A `ip_allow` block as defined below. --- diff --git a/website/docs/r/media_streaming_locator.html.markdown b/website/docs/r/media_streaming_locator.html.markdown index d8af75a375e0..c0b331f8a264 100644 --- a/website/docs/r/media_streaming_locator.html.markdown +++ b/website/docs/r/media_streaming_locator.html.markdown @@ -37,6 +37,12 @@ resource "azurerm_media_services_account" "example" { } } +resource "azurerm_media_services_account_filter" "example" { + name = "Filter1" + resource_group_name = azurerm_resource_group.example.name + media_services_account_name = azurerm_media_services_account.example.name +} + resource "azurerm_media_asset" "example" { name = "Asset1" resource_group_name = azurerm_resource_group.example.name @@ -50,6 +56,7 @@ resource "azurerm_media_streaming_locator" "example" { media_services_account_name = azurerm_media_services_account.example.name asset_name = azurerm_media_asset.example.name streaming_policy_name = "Predefined_ClearStreamingOnly" + filter_names = [azurerm_media_services_account_filter.example.name] } ``` @@ -77,6 +84,8 @@ The following arguments are supported: * `end_time` - (Optional) The end time of the Streaming Locator. Changing this forces a new Streaming Locator to be created. +* `filter_names` - (Optional) A list of names of asset or account filters which apply to this Streaming Locator. Changing this forces a new Streaming Locator to be created. + * `start_time` - (Optional) The start time of the Streaming Locator. Changing this forces a new Streaming Locator to be created. * `streaming_locator_id` - (Optional) The ID of the Streaming Locator. Changing this forces a new Streaming Locator to be created. diff --git a/website/docs/r/mobile_network.html.markdown b/website/docs/r/mobile_network.html.markdown new file mode 100644 index 000000000000..478e45d2b427 --- /dev/null +++ b/website/docs/r/mobile_network.html.markdown @@ -0,0 +1,76 @@ +--- +subcategory: "Mobile Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_mobile_network" +description: |- + Manages an Azure Mobile Network. +--- + +# azurerm_mobile_network + +Manages a Mobile Network. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "east us" +} + +resource "azurerm_mobile_network" "example" { + name = "example-mn" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + mobile_country_code = "001" + mobile_network_code = "01" + + tags = { + key = "value" + } + +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name which should be used for this Mobile Network. Changing this forces a new Mobile Network to be created. + +* `resource_group_name` - (Required) Specifies the name of the Resource Group where the Mobile Network should exist. Changing this forces a new Mobile Network to be created. + +* `location` - (Required) Specifies the Azure Region where the Mobile Network should exist. Changing this forces a new Mobile Network to be created. The possible values are `eastus` and `northeurope`. + +* `mobile_country_code` - (Required) Mobile country code (MCC), defined in https://www.itu.int/rec/T-REC-E.212 . + +* `mobile_network_code` - (Required) Mobile network code (MNC), defined in https://www.itu.int/rec/T-REC-E.212 . + +* `tags` - (Optional) A mapping of tags which should be assigned to the Mobile Network. + +--- + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Mobile Network. + +* `service_key` - The mobile network resource identifier. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 180 minutes) Used when creating the Mobile Network. +* `read` - (Defaults to 5 minutes) Used when retrieving the Mobile Network. +* `update` - (Defaults to 180 minutes) Used when updating the Mobile Network. +* `delete` - (Defaults to 180 minutes) Used when deleting the Mobile Network. + +## Import + +Mobile Network can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_mobile_network.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.MobileNetwork/mobileNetworks/mobileNetwork1 +``` diff --git a/website/docs/r/mobile_network_service.html.markdown b/website/docs/r/mobile_network_service.html.markdown new file mode 100644 index 000000000000..42157e12bfd6 --- /dev/null +++ b/website/docs/r/mobile_network_service.html.markdown @@ -0,0 +1,199 @@ +--- +subcategory: "Mobile Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_mobile_network_service" +description: |- + Manages a Mobile Network Service. +--- + +# azurerm_mobile_network_service + +Manages a Mobile Network Service. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "east us" +} + +resource "azurerm_mobile_network" "example" { + name = "example-mn" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.test.name + mobile_country_code = "001" + mobile_network_code = "01" +} + +resource "azurerm_mobile_network_service" "example" { + name = "example-mns" + mobile_network_id = azurerm_mobile_network.example.id + location = azurerm_resource_group.example.location + service_precedence = 0 + + pcc_rule { + name = "default-rule" + precedence = 1 + traffic_control_enabled = true + + qos_policy { + allocation_and_retention_priority_level = 9 + qos_indicator = 9 + preemption_capability = "NotPreempt" + preemption_vulnerability = "Preemptable" + + guaranteed_bit_rate { + downlink = "100 Mbps" + uplink = "10 Mbps" + } + + maximum_bit_rate { + downlink = "1 Gbps" + uplink = "100 Mbps" + } + } + + service_data_flow_templates { + direction = "Uplink" + name = "IP-to-server" + ports = [] + protocol = ["ip"] + remote_ip_list = ["10.3.4.0/24"] + } + } + + service_qos_policy { + allocation_and_retention_priority_level = 9 + qos_indicator = 9 + preemption_capability = "NotPreempt" + preemption_vulnerability = "Preemptable" + maximum_bit_rate { + downlink = "1 Gbps" + uplink = "100 Mbps" + } + } + + tags = { + key = "value" + } + +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name which should be used for this Mobile Network Service. Changing this forces a new Mobile Network Service to be created. + +* `mobile_network_id` - (Required) Specifies the ID of the Mobile Network Service. Changing this forces a new Mobile Network Service to be created. + +* `location` - (Required) Specifies the Azure Region where the Mobile Network Service should exist. Changing this forces a new Mobile Network Service to be created. + +* `service_precedence` - (Required) A precedence value that is used to decide between services when identifying the QoS values to use for a particular SIM. A lower value means a higher priority. This value should be unique among all services configured in the mobile network. Must be between `0` and `255`. + +* `pcc_rule` - (Required) A `pcc_rule` block as defined below. The set of PCC Rules that make up this service. + +* `service_qos_policy` - (Optional) A `service_qos_policy` block as defined below. The QoS policy to use for packets matching this service. This can be overridden for particular flows using the ruleQosPolicy field in a `pcc_rule`. If this field is not specified then the `sim_policy` of User Equipment (UE) will define the QoS settings. + +* `tags` - (Optional) A mapping of tags which should be assigned to the Mobile Network Service. + +--- + +A `pcc_rule` block supports the following: + +* `name` - (Required) Specifies the name of the rule. This must be unique within the parent service. You must not use any of the following reserved strings - `default`, `requested` or `service`. + +* `precedence` - (Required) A precedence value that is used to decide between data flow policy rules when identifying the QoS values to use for a particular SIM. A lower value means a higher priority. This value should be unique among all data flow policy rules configured in the mobile network. Must be between `0` and `255`. + +* `qos_policy` - (Optional) A `qos_policy` block as defined below. The QoS policy to use for packets matching this rule. If this field is not specified then the Service will define the QoS settings. + +* `service_data_flow_template` - (Required) A `service_data_flow_template` block as defined below. The set of service data flow templates to use for this PCC rule. + +* `traffic_control_enabled` - (Optional) Determines whether flows that match this data flow policy rule are permitted. Defaults to `true`. + +--- + +A `qos_policy` block supports the following: + +* `allocation_and_retention_priority_level` - (Optional) QoS Flow allocation and retention priority (ARP) level. Flows with higher priority preempt flows with lower priority, if the settings of `preemption_capability` and `preemption_vulnerability` allow it. 1 is the highest level of priority. If this field is not specified then `qos_indicator` is used to derive the ARP value. Defaults to `9`. See 3GPP TS23.501 section 5.7.2.2 for a full description of the ARP parameters. + +* `qos_indicator` - (Optional) The QoS Indicator (5QI for 5G network /QCI for 4G net work) value identifies a set of QoS characteristics that control QoS forwarding treatment for QoS flows or EPS bearers. Recommended values: 5-9; 69-70; 79-80. Must be between `1` and `127`. Defaults to `9`. + +* `guaranteed_bit_rate` - (Optional) A `guaranteed_bit_rate` block as defined below. The Guaranteed Bit Rate (GBR) for all service data flows that use this PCC Rule. If it's not specified, there will be no GBR set for the PCC Rule that uses this QoS definition. + +* `maximum_bit_rate` - (Required) A `maximum_bit_rate` block as defined below. The Maximum Bit Rate (MBR) for all service data flows that use this PCC Rule or Service. + +* `preemption_capability` - (Optional) The Preemption Capability of a QoS Flow controls whether it can preempt another QoS Flow with a lower priority level. See 3GPP TS23.501 section 5.7.2.2 for a full description of the ARP parameters. Possible values are `NotPreempt` and `MayPreempt`, Defaults to `NotPreempt`. + +* `preemption_vulnerability` - (Optional) The Preemption Vulnerability of a QoS Flow controls whether it can be preempted by QoS Flow with a higher priority level. See 3GPP TS23.501 section 5.7.2.2 for a full description of the ARP parameters. Possible values are `NotPreemptable` and `Preemptable`. Defaults to `Preemptable`. + +--- + +A `guaranteed_bit_rate` block supports the following: + +* `downlink` - (Required) Downlink bit rate. Must be a number followed by `Kbps`, `Mbps`, `Gbps` or `Tbps`. + +* `uplink` - (Required) Uplink bit rate. Must be a number followed by `Kbps`, `Mbps`, `Gbps` or `Tbps`. + +--- + +A `service_data_flow_template` block supports the following: + +* `name` - (Required) Specifies the name of the data flow template. This must be unique within the parent data flow policy rule. You must not use any of the following reserved strings - `default`, `requested` or `service`. + +* `direction` - (Required) Specifies the direction of this flow. Possible values are `Uplink`, `Downlink` and `Bidirectional`. + +* `protocol` - (Required) A list of the allowed protocol(s) for this flow. If you want this flow to be able to use any protocol within the internet protocol suite, use the value `ip`. If you only want to allow a selection of protocols, you must use the corresponding IANA Assigned Internet Protocol Number for each protocol, as described in https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml. For example, for UDP, you must use 17. If you use the value `ip` then you must leave the field `port` unspecified. + +* `remote_ip_list` - (Required) Specifies the remote IP address(es) to which UEs will connect for this flow. If you want to allow connections on any IP address, use the value `any`. Otherwise, you must provide each of the remote IP addresses to which the packet core instance will connect for this flow. You must provide each IP address in CIDR notation, including the netmask (for example, `192.0.2.54/24`). + +* `ports` - (Optional) The port(s) to which UEs will connect for this flow. You can specify zero or more ports or port ranges. If you specify one or more ports or port ranges then you must specify a value other than `ip` in the `protocol` field. If it is not specified then connections will be allowed on all ports. Port ranges must be specified as -. For example: [`8080`, `8082-8085`]. + +--- + +A `service_qos_policy` block supports the following: + +* `allocation_and_retention_priority_level` - (Optional) QoS Flow allocation and retention priority (ARP) level. Flows with higher priority preempt flows with lower priority, if the settings of `preemption_capability` and `preemption_vulnerability` allow it. 1 is the highest level of priority. If this field is not specified then `qos_indicator` is used to derive the ARP value. Defaults to `9`. See 3GPP TS23.501 section 5.7.2.2 for a full description of the ARP parameters. + +* `qos_indicator` - (Optional) The QoS Indicator (5QI for 5G network /QCI for 4G net work) value identifies a set of QoS characteristics that control QoS forwarding treatment for QoS flows or EPS bearers. Recommended values: 5-9; 69-70; 79-80. Must be between `1` and `127`. Defaults to `9`. + +* `maximum_bit_rate` - (Required) A `maximum_bit_rate` block as defined below. The Maximum Bit Rate (MBR) for all service data flows that use this PCC Rule or Service. + +* `preemption_capability` - (Optional) The Preemption Capability of a QoS Flow controls whether it can preempt another QoS Flow with a lower priority level. See 3GPP TS23.501 section 5.7.2.2 for a full description of the ARP parameters. Possible values are `NotPreempt` and `MayPreempt`, Defaults to `NotPreempt`. + +* `preemption_vulnerability` - (Optional) The Preemption Vulnerability of a QoS Flow controls whether it can be preempted by QoS Flow with a higher priority level. See 3GPP TS23.501 section 5.7.2.2 for a full description of the ARP parameters. Possible values are `NotPreemptable` and `Preemptable`. Defaults to `Preemptable`. + +--- + +A `maximum_bit_rate` block supports the following: + +* `downlink` - (Required) Downlink bit rate. Must be a number followed by `bps`, `Kbps`, `Mbps`, `Gbps` or `Tbps`. + +* `uplink` - (Required) Uplink bit rate. Must be a number followed by `bps`, `Kbps`, `Mbps`, `Gbps` or `Tbps`. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Mobile Network Service. + + + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 180 minutes) Used when creating the Mobile Network Service. +* `read` - (Defaults to 5 minutes) Used when retrieving the Mobile Network Service. +* `update` - (Defaults to 180 minutes) Used when updating the Mobile Network Service. +* `delete` - (Defaults to 180 minutes) Used when deleting the Mobile Network Service. + +## Import + +Mobile Network Service can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_mobile_network_service.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.MobileNetwork/mobileNetworks/mobileNetwork1/services/service1 +``` diff --git a/website/docs/r/mobile_network_sim_group.html.markdown b/website/docs/r/mobile_network_sim_group.html.markdown new file mode 100644 index 000000000000..720fa263fccf --- /dev/null +++ b/website/docs/r/mobile_network_sim_group.html.markdown @@ -0,0 +1,105 @@ +--- +subcategory: "Mobile Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_mobile_network_sim_group" +description: |- + Manages a Mobile Network Sim Group. +--- + +# azurerm_mobile_network_sim_group + +Manages a Mobile Network Sim Group. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_mobile_network" "example" { + name = "example-mn" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + mobile_country_code = "001" + mobile_network_code = "01" +} + +data "azurerm_user_assigned_identity" "example" { + name = "example-identity" +} + +data "azurerm_key_vault_key" "example" { + name = "some-key" + key_vault_id = data.azurerm_key_vault.example.id +} + +resource "azurerm_mobile_network_sim_group" "example" { + name = "example-mnsg" + location = azurerm_resource_group.example.location + mobile_network_id = azurerm_mobile_network.example.id + encryption_key_url = data.azurerm_key_vault_key.example.id + + identity { + type = "SystemAssigned, UserAssigned" + identity_ids = [data.azurerm_user_assigned_identity.example.id] + } + + tags = { + key = "value" + } + +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name which should be used for this Mobile Network Sim Groups. Changing this forces a new Mobile Network Sim Group to be created. + +* `location` - (Required) Specifies the Azure Region where the Mobile Network Sim Groups should exist. Changing this forces a new Mobile Network Sim Group to be created. + +* `mobile_network_id` - (Required) The ID of Mobile Network which the Mobile Network Sim Group belongs to. Changing this forces a new Mobile Network Slice to be created. + +* `encryption_key_url` - (Optional) A key to encrypt the SIM data that belongs to this SIM group. + +* `identity` - (Optional) An `identity` block as defined below. + +-> **NOTE:** A `UserAssigned` identity must be specified when `encryption_key_url` is specified. + +* `tags` - (Optional) A mapping of tags which should be assigned to the Mobile Network Sim Groups. + +--- + +An `identity` block supports the following: + +* `type` - (Required) Specifies the type of Managed Service Identity. Possible value is `UserAssigned`. + +* `identity_ids` - (Optional) A list of IDs for User Assigned Managed Identity resources to be assigned. + + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Mobile Network Sim Groups. + + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 180 minutes) Used when creating the Mobile Network Sim Groups. +* `read` - (Defaults to 5 minutes) Used when retrieving the Mobile Network Sim Groups. +* `update` - (Defaults to 180 minutes) Used when updating the Mobile Network Sim Groups. +* `delete` - (Defaults to 180 minutes) Used when deleting the Mobile Network Sim Groups. + +## Import + +Mobile Network Sim Groups can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_mobile_network_sim_group.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.MobileNetwork/simGroups/simGroup1 +``` diff --git a/website/docs/r/mobile_network_site.html.markdown b/website/docs/r/mobile_network_site.html.markdown new file mode 100644 index 000000000000..939850303a95 --- /dev/null +++ b/website/docs/r/mobile_network_site.html.markdown @@ -0,0 +1,121 @@ +--- +subcategory: "Mobile Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_mobile_network_site" +description: |- + Manages a Mobile Network Site. +--- + +# azurerm_mobile_network_site + +Manages a Mobile Network Site. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_databox_edge_device" "example" { + name = "example-device" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + + sku_name = "EdgeP_Base-Standard" +} + +resource "azurerm_mobile_network" "example" { + name = "example-mn" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + mobile_country_code = "001" + mobile_network_code = "01" +} + +resource "azurerm_mobile_network_packet_core_control_plane" "example" { + name = "example-mnpccp" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + sku = "G0" + + site_ids = [azurerm_mobile_network_site.example.id] + + platform { + type = "AKS-HCI" + edge_device_id = azurerm_databox_edge_device.example.id + } + + tags = { + key = "value" + } + +} +resource "azurerm_mobile_network_packet_core_data_plane" "example" { + name = "example-mnpcdp" + mobile_network_packet_core_control_plane_id = azurerm_mobile_network_packet_core_control_plane.example.id + location = azurerm_resource_group.example.location + + user_plane_access_interface { + name = "default-interface" + ipv4_address = "192.168.1.199" + ipv4_gateway = "192.168.1.1" + ipv4_subnet = "192.168.1.0/25" + } + + tags = { + key = "value" + } + +} + +resource "azurerm_mobile_network_site" "example" { + name = "example-mns" + mobile_network_id = azurerm_mobile_network.example.id + location = azurerm_resource_group.example.location + + tags = { + key = "value" + } + +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name which should be used for this Mobile Network Site. Changing this forces a new Mobile Network Site to be created. + +* `mobile_network_id` - (Required) the ID of the Mobile Network which the Mobile Network Site belongs to. Changing this forces a new Mobile Network Site to be created. + +* `location` - (Required) The Azure Region where the Mobile Network Site should exist. Changing this forces a new Mobile Network Site to be created. + +* `tags` - (Optional) A mapping of tags which should be assigned to the Mobile Network Site. + + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Mobile Network Site. + +* `network_function_ids` - An array of Id of Network Functions deployed on the site. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 180 minutes) Used when creating the Mobile Network Site. +* `read` - (Defaults to 5 minutes) Used when retrieving the Mobile Network Site. +* `update` - (Defaults to 180 minutes) Used when updating the Mobile Network Site. +* `delete` - (Defaults to 180 minutes) Used when deleting the Mobile Network Site. + +## Import + +Mobile Network Site can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_mobile_network_site.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.MobileNetwork/mobileNetworks/mobileNetwork1/sites/site1 +``` diff --git a/website/docs/r/mobile_network_slice.html.markdown b/website/docs/r/mobile_network_slice.html.markdown new file mode 100644 index 000000000000..42c4fae5b2ac --- /dev/null +++ b/website/docs/r/mobile_network_slice.html.markdown @@ -0,0 +1,94 @@ +--- +subcategory: "Mobile Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_mobile_network_slice" +description: |- + Manages a Mobile Network Slice. +--- + +# azurerm_mobile_network_slice + +Manages a Mobile Network Slice. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_mobile_network" "example" { + name = "example-mn" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + mobile_country_code = "001" + mobile_network_code = "01" +} + + +resource "azurerm_mobile_network_slice" "example" { + name = "example-mns" + mobile_network_id = azurerm_mobile_network.test.id + location = azurerm_resource_group.example.location + description = "an example slice" + + single_network_slice_selection_assistance_information { + slice_service_type = 1 + } + + tags = { + key = "value" + } + +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name which should be used for this Mobile Network Slice. Changing this forces a new Mobile Network Slice to be created. + +* `mobile_network_id` - (Required) The ID of Mobile Network which the Mobile Network Slice belongs to. Changing this forces a new Mobile Network Slice to be created. + +* `location` - (Required) Specifies the Azure Region where the Mobile Network Slice should exist. Changing this forces a new Mobile Network Slice to be created. + +* `single_network_slice_selection_assistance_information` - (Required) A `single_network_slice_selection_assistance_information` block as defined below. Single-network slice selection assistance information (S-NSSAI). Unique at the scope of a mobile network. + +* `description` - (Optional) A description for this Mobile Network Slice. + +* `tags` - (Optional) A mapping of tags which should be assigned to the Mobile Network Slice. + +--- + +A `single_network_slice_selection_assistance_information` block supports the following: + +* `slice_differentiator` - (Optional) Slice differentiator (SD). Must be a 6 digit hex string. + +* `slice_service_type` - (Required) Slice/service type (SST). Must be between `0` and `255`. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Mobile Network Slice. + + + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 180 minutes) Used when creating the Mobile Network Slice. +* `read` - (Defaults to 5 minutes) Used when retrieving the Mobile Network Slice. +* `update` - (Defaults to 180 minutes) Used when updating the Mobile Network Slice. +* `delete` - (Defaults to 180 minutes) Used when deleting the Mobile Network Slice. + +## Import + +Mobile Network Slice can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_mobile_network_slice.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.MobileNetwork/mobileNetworks/mobileNetwork1/slices/slice1 +``` diff --git a/website/docs/r/monitor_data_collection_rule.html.markdown b/website/docs/r/monitor_data_collection_rule.html.markdown index da463a05b1b2..b283ca645560 100644 --- a/website/docs/r/monitor_data_collection_rule.html.markdown +++ b/website/docs/r/monitor_data_collection_rule.html.markdown @@ -190,11 +190,11 @@ A `log_analytics` block supports the following: A `performance_counter` block supports the following: -* `counter_specifiers` - (Required) Specifies a list of specifier names of the performance counters you want to collect. Use a wildcard `*` to collect counters for all instances. To get a list of performance counters on Windows, run the command `typeperf`. +* `counter_specifiers` - (Required) Specifies a list of specifier names of the performance counters you want to collect. To get a list of performance counters on Windows, run the command `typeperf`. Please see [this document](https://learn.microsoft.com/en-us/azure/azure-monitor/agents/data-sources-performance-counters#configure-performance-counters) for more information. * `name` - (Required) The name which should be used for this data source. This name should be unique across all data sources regardless of type within the Data Collection Rule. -* `sampling_frequency_in_seconds` - (Required) The number of seconds between consecutive counter measurements (samples). The value should be integer between `1` and `300` inclusive. +* `sampling_frequency_in_seconds` - (Required) The number of seconds between consecutive counter measurements (samples). The value should be integer between `1` and `300` inclusive. `sampling_frequency_in_seconds` must be equal to `60` seconds for counters collected with `Microsoft-InsightsMetrics` stream. * `streams` - (Required) Specifies a list of streams that this data source will be sent to. A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. Possible values include but not limited to `Microsoft-InsightsMetrics`,and `Microsoft-Perf`. @@ -220,7 +220,7 @@ A `windows_event_log` block supports the following: * `streams` - (Required) Specifies a list of streams that this data source will be sent to. A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. Possible values include but not limited to `Microsoft-Event`,and `Microsoft-WindowsEvent`, `Microsoft-RomeDetectionEvent`, and `Microsoft-SecurityEvent`. -* `x_path_queries` - (Required) Specifies a list of Windows Event Log queries in XPath expression. +* `x_path_queries` - (Required) Specifies a list of Windows Event Log queries in XPath expression. Please see [this document](https://learn.microsoft.com/en-us/azure/azure-monitor/agents/data-collection-rule-azure-monitor-agent?tabs=cli#filter-events-using-xpath-queries) for more information. ## Attributes Reference diff --git a/website/docs/r/monitor_diagnostic_setting.html.markdown b/website/docs/r/monitor_diagnostic_setting.html.markdown index 121fff48505b..18ce87d05615 100644 --- a/website/docs/r/monitor_diagnostic_setting.html.markdown +++ b/website/docs/r/monitor_diagnostic_setting.html.markdown @@ -34,9 +34,8 @@ resource "azurerm_monitor_diagnostic_setting" "example" { target_resource_id = data.azurerm_key_vault.example.id storage_account_id = data.azurerm_storage_account.example.id - log { + enabled_log { category = "AuditEvent" - enabled = false retention_policy { enabled = false @@ -63,41 +62,43 @@ The following arguments are supported: * `target_resource_id` - (Required) The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created. -* `eventhub_name` - (Optional) Specifies the name of the Event Hub where Diagnostics Data should be sent. Changing this forces a new resource to be created. +* `eventhub_name` - (Optional) Specifies the name of the Event Hub where Diagnostics Data should be sent. -> **NOTE:** If this isn't specified then the default Event Hub will be used. -* `eventhub_authorization_rule_id` - (Optional) Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created. +* `eventhub_authorization_rule_id` - (Optional) Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. -> **NOTE:** This can be sourced from [the `azurerm_eventhub_namespace_authorization_rule` resource](eventhub_namespace_authorization_rule.html) and is different from [a `azurerm_eventhub_authorization_rule` resource](eventhub_authorization_rule.html). --> **NOTE:** One of `eventhub_authorization_rule_id`, `log_analytics_workspace_id`, `partner_solution_id` and `storage_account_id` must be specified. +-> **NOTE:** At least one of `eventhub_authorization_rule_id`, `log_analytics_workspace_id`, `partner_solution_id` and `storage_account_id` must be specified. * `log` - (Optional) One or more `log` blocks as defined below. +-> **NOTE:** `log` is deprecated in favour of the `enabled_log` property and will be removed in version 4.0 of the AzureRM Provider. + * `enabled_log` - (Optional) One or more `enabled_log` blocks as defined below. --> **NOTE:** At least one `log`, `enabled_log` or `metric` block must be specified. +-> **NOTE:** At least one `log`, `enabled_log` or `metric` block must be specified. At least one type of Log or Metric must be enabled. * `log_analytics_workspace_id` - (Optional) Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent. --> **NOTE:** One of `eventhub_authorization_rule_id`, `log_analytics_workspace_id`, `partner_solution_id` and `storage_account_id` must be specified. +-> **NOTE:** At least one of `eventhub_authorization_rule_id`, `log_analytics_workspace_id`, `partner_solution_id` and `storage_account_id` must be specified. * `metric` - (Optional) One or more `metric` blocks as defined below. --> **NOTE:** At least one `log` or `metric` block must be specified. +-> **NOTE:** At least one `log`, `enabled_log` or `metric` block must be specified. -* `storage_account_id` - (Optional) The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created. +* `storage_account_id` - (Optional) The ID of the Storage Account where logs should be sent. --> **NOTE:** One of `eventhub_authorization_rule_id`, `log_analytics_workspace_id`, `partner_solution_id` and `storage_account_id` must be specified. +-> **NOTE:** At least one of `eventhub_authorization_rule_id`, `log_analytics_workspace_id`, `partner_solution_id` and `storage_account_id` must be specified. -* `log_analytics_destination_type` - (Optional) When set to 'Dedicated' logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table. +* `log_analytics_destination_type` - (Optional) Possible values are `AzureDiagnostics` and `Dedicated`, default to `AzureDiagnostics`. When set to `Dedicated`, logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table. --> **NOTE:** This setting will only have an effect if a `log_analytics_workspace_id` is provided, and the resource is available for resource-specific logs. As of July 2019, this only includes Azure Data Factory. Please [see the documentation](https://docs.microsoft.com/azure/azure-monitor/platform/diagnostic-logs-stream-log-store#azure-diagnostics-vs-resource-specific) for more information. +-> **NOTE:** This setting will only have an effect if a `log_analytics_workspace_id` is provided. Please see [resource types](https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/azurediagnostics#resource-types) for services that use each method. Please [see the documentation](https://docs.microsoft.com/azure/azure-monitor/platform/diagnostic-logs-stream-log-store#azure-diagnostics-vs-resource-specific) for details on the differences between destination types. * `partner_solution_id` - (Optional) The ID of the market partner solution where Diagnostics Data should be sent. For potential partner integrations, [click to learn more about partner integration](https://learn.microsoft.com/en-us/azure/partner-solutions/overview). --> **NOTE:** One of `eventhub_authorization_rule_id`, `log_analytics_workspace_id`, `partner_solution_id` and `storage_account_id` must be specified. +-> **NOTE:** At least one of `eventhub_authorization_rule_id`, `log_analytics_workspace_id`, `partner_solution_id` and `storage_account_id` must be specified. --- @@ -109,7 +110,7 @@ A `log` block supports the following: * `category_group` - (Optional) The name of a Diagnostic Log Category Group for this Resource. --> **NOTE:** Not all resources have category groups available.**** +-> **NOTE:** Not all resources have category groups available. * `retention_policy` - (Optional) A `retention_policy` block as defined below. diff --git a/website/docs/r/monitor_scheduled_query_rules_alert.html.markdown b/website/docs/r/monitor_scheduled_query_rules_alert.html.markdown index 7b58ac56fdaf..2831bf35f0fd 100644 --- a/website/docs/r/monitor_scheduled_query_rules_alert.html.markdown +++ b/website/docs/r/monitor_scheduled_query_rules_alert.html.markdown @@ -119,7 +119,7 @@ The following arguments are supported: -> **NOTE** `auto_mitigation_enabled` and `throttling` are mutually exclusive and cannot both be set. * `description` - (Optional) The description of the scheduled query rule. * `enabled` - (Optional) Whether this scheduled query rule is enabled. Default is `true`. -* `query_type` - (Optional) The type of query results. Possible values are `ResultCount` and `Number`. Default is `ResultCount`. +* `query_type` - (Optional) The type of query results. Possible values are `ResultCount` and `Number`. Default is `ResultCount`. If set to `Number`, `query` must include an `AggregatedValue` column of a numeric type, for example, `Heartbeat | summarize AggregatedValue = count() by bin(TimeGenerated, 5m)`. * `severity` - (Optional) Severity of the alert. Possible values include: 0, 1, 2, 3, or 4. * `throttling` - (Optional) Time (in minutes) for which Alerts should be throttled or suppressed. Values must be between 0 and 10000 (inclusive). * `tags` - (Optional) A mapping of tags to assign to the resource. diff --git a/website/docs/r/monitor_scheduled_query_rules_alert_v2.html.markdown b/website/docs/r/monitor_scheduled_query_rules_alert_v2.html.markdown index 0bb75181baed..ce511ca1781f 100644 --- a/website/docs/r/monitor_scheduled_query_rules_alert_v2.html.markdown +++ b/website/docs/r/monitor_scheduled_query_rules_alert_v2.html.markdown @@ -102,7 +102,7 @@ The following arguments are supported: -> **Note** `evaluation_frequency` cannot be greater than the `mute_actions_after_alert_duration`. -* `scopes` - (Required) Specifies the list of resource ids that this scheduled query rule is scoped to. Changing this forces a new resource to be created. +* `scopes` - (Required) Specifies the list of resource IDs that this scheduled query rule is scoped to. Changing this forces a new resource to be created. Currently, the API supports exactly 1 resource ID in the scopes list. * `severity` - (Required) Severity of the alert. Should be an integer between 0 and 4. Value of 0 is severest. @@ -138,7 +138,7 @@ The following arguments are supported: An `action` block supports the following: -* `action_groups` - (Optional) List of Action Group resource ids to invoke when the alert fires. +* `action_groups` - (Optional) List of Action Group resource IDs to invoke when the alert fires. * `custom_properties` - (Optional) Specifies the properties of an alert payload. @@ -160,7 +160,7 @@ A `criteria` block supports the following: * `metric_measure_column` - (Optional) Specifies the column containing the metric measure number. -* `resource_id_column` - (Optional) Specifies the column containing the resource id. The content of the column must be an uri formatted as resource id. +* `resource_id_column` - (Optional) Specifies the column containing the resource ID. The content of the column must be an uri formatted as resource ID. --- @@ -188,7 +188,7 @@ A `failing_periods` block supports the following: The following Attributes are exported: -* `id` - The id of the Monitor Scheduled Query Rule. +* `id` - The ID of the Monitor Scheduled Query Rule. * `created_with_api_version` - The api-version used when creating this alert rule. diff --git a/website/docs/r/mssql_database.html.markdown b/website/docs/r/mssql_database.html.markdown index ffec811c6fa1..e67c1f74e498 100644 --- a/website/docs/r/mssql_database.html.markdown +++ b/website/docs/r/mssql_database.html.markdown @@ -123,7 +123,7 @@ The following arguments are supported: * `transparent_data_encryption_enabled` - (Optional) If set to true, Transparent Data Encryption will be enabled on the database. Defaults to `true`. -* -> **NOTE:** TDE cannot be disabled on servers with SKUs other than ones starting with DW. +-> **NOTE:** TDE cannot be disabled on servers with SKUs other than ones starting with DW. * `zone_redundant` - (Optional) Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. This property is only settable for Premium and Business Critical databases. diff --git a/website/docs/r/mssql_managed_instance.html.markdown b/website/docs/r/mssql_managed_instance.html.markdown index f156dab8d578..0095ab6bf3af 100644 --- a/website/docs/r/mssql_managed_instance.html.markdown +++ b/website/docs/r/mssql_managed_instance.html.markdown @@ -251,9 +251,9 @@ The following arguments are supported: An `identity` block supports the following: - * `type` - (Required) Specifies the type of Managed Service Identity that should be configured on this SQL Managed Instance. Possible values are `SystemAssigned`, `UserAssigned`. +* `type` - (Required) Specifies the type of Managed Service Identity that should be configured on this SQL Managed Instance. Possible values are `SystemAssigned`, `UserAssigned`. - * `identity_ids` - (Optional) Specifies a list of User Assigned Managed Identity IDs to be assigned to this SQL Managed Instance. Required when `type` is set to `UserAssigned`. +* `identity_ids` - (Optional) Specifies a list of User Assigned Managed Identity IDs to be assigned to this SQL Managed Instance. Required when `type` is set to `UserAssigned`. ~> The assigned `principal_id` and `tenant_id` can be retrieved after the identity `type` has been set to `SystemAssigned` and SQL Managed Instance has been created. diff --git a/website/docs/r/mssql_server.html.markdown b/website/docs/r/mssql_server.html.markdown index 6bc2809099bb..6698fd3b21a3 100644 --- a/website/docs/r/mssql_server.html.markdown +++ b/website/docs/r/mssql_server.html.markdown @@ -112,7 +112,7 @@ The following attributes are exported: --- -`identity` exports the following: +A `identity` block exports the following: * `principal_id` - The Principal ID for the Service Principal associated with the Identity of this SQL Server. diff --git a/website/docs/r/mssql_server_extended_auditing_policy.html.markdown b/website/docs/r/mssql_server_extended_auditing_policy.html.markdown index 69a02ff78005..8ec85e761ad5 100644 --- a/website/docs/r/mssql_server_extended_auditing_policy.html.markdown +++ b/website/docs/r/mssql_server_extended_auditing_policy.html.markdown @@ -157,6 +157,97 @@ resource "azurerm_mssql_server_extended_auditing_policy" "example" { } ``` +## Example Usage with Log Analytics Workspace and EventHub + +``` +provider "azurerm" { +features {} +} + +resource "azurerm_resource_group" "example" { +name = "example-resources" +location = "West Europe" +} + +resource "azurerm_mssql_server" "example" { + name = "example-sqlserver" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + version = "12.0" + administrator_login = "missadministrator" + administrator_login_password = "AdminPassword123!" +} + +resource "azurerm_mssql_server_extended_auditing_policy" "example" { + server_id = azurerm_mssql_server.example.id + storage_endpoint = azurerm_storage_account.example.primary_blob_endpoint + storage_account_access_key = azurerm_storage_account.example.primary_access_key + storage_account_access_key_is_secondary = false + retention_in_days = 6 +} + +resource "azurerm_log_analytics_workspace" "example" { + name = "example-workspace" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + sku = "PerGB2018" + retention_in_days = 30 +} + +resource "azurerm_eventhub_namespace" "example" { + name = "example-eventhub-namespace" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + sku = "Standard" +} + +resource "azurerm_eventhub" "example" { + name = "example-eventhub" + namespace_name = azurerm_eventhub_namespace.example.name + resource_group_name = azurerm_resource_group.example.name + partition_count = 2 + message_retention = 1 +} + +resource "azurerm_eventhub_namespace_authorization_rule" "example" { + name = "example-eventhub-auth-rule" + namespace_name = azurerm_eventhub_namespace.example.name + resource_group_name = azurerm_resource_group.example.name + listen = true + send = true + manage = true +} + +resource "azurerm_mssql_server_extended_auditing_policy" "example" { + server_id = azurerm_mssql_server.example.id + log_monitoring_enabled = true +} + +resource "azurerm_monitor_diagnostic_setting" "example" { + name = "example-diagnotic-setting" + target_resource_id = "${azurerm_mssql_server.example.id}/databases/master” + eventhub_authorization_rule_id = azurerm_eventhub_namespace_authorization_rule.example.id + eventhub_name = azurerm_eventhub.example.name + log_analytics_workspace_id = azurerm_log_analytics_workspace.example.id + + log { + category = "SQLSecurityAuditEvents" + enabled = true + + retention_policy { + enabled = false + } + } + + metric { + category = "AllMetrics" + + retention_policy { + enabled = false + } + } +} +``` ## Arguments Reference The following arguments are supported: diff --git a/website/docs/r/mssql_virtual_machine.html.markdown b/website/docs/r/mssql_virtual_machine.html.markdown index 86b2f012392b..f0c358952d4a 100644 --- a/website/docs/r/mssql_virtual_machine.html.markdown +++ b/website/docs/r/mssql_virtual_machine.html.markdown @@ -153,9 +153,9 @@ The `storage_configuration` block supports the following: * `storage_workload_type` - (Required) The type of storage workload. Valid values include `GENERAL`, `OLTP`, or `DW`. -* `data_settings` - (Optional) An `storage_settings` as defined below. +* `data_settings` - (Optional) A `storage_settings` block as defined below. -* `log_settings` - (Optional) An `storage_settings` as defined below. +* `log_settings` - (Optional) A `storage_settings` block as defined below. * `system_db_on_data_disk_enabled` - (Optional) Specifies whether to set system databases (except tempDb) location to newly created data storage. Possible values are `true` and `false`. Defaults to `false`. diff --git a/website/docs/r/mysql_flexible_server.html.markdown b/website/docs/r/mysql_flexible_server.html.markdown index 01d1f36f7c9a..ab6e2185cb66 100644 --- a/website/docs/r/mysql_flexible_server.html.markdown +++ b/website/docs/r/mysql_flexible_server.html.markdown @@ -147,7 +147,7 @@ An `identity` block supports the following: * `type` - (Required) Specifies the type of Managed Service Identity that should be configured on this API Management Service. Should be set to `UserAssigned`, `SystemAssigned, UserAssigned` (to enable both). -* `identity_ids` - (Optional) A list of User Assigned Managed Identity IDs to be assigned to this API Management Service. Required if used together with `customer_managed_key` block as defined below. +* `identity_ids` - (Optional) A list of User Assigned Managed Identity IDs to be assigned to this API Management Service. Required if used together with `customer_managed_key` block. ~> **NOTE:** This is required when `type` is set to `UserAssigned` or `SystemAssigned, UserAssigned`. diff --git a/website/docs/r/network_manager_admin_rule.html.markdown b/website/docs/r/network_manager_admin_rule.html.markdown new file mode 100644 index 000000000000..c9e73be5e5b7 --- /dev/null +++ b/website/docs/r/network_manager_admin_rule.html.markdown @@ -0,0 +1,139 @@ +--- +subcategory: "Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_network_manager_admin_rule" +description: |- + Manages a Network Manager Admin Rule. +--- + +# azurerm_network_manager_admin_rule + +Manages a Network Manager Admin Rule. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +data "azurerm_subscription" "current" { +} + +resource "azurerm_network_manager" "example" { + name = "example-network-manager" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + scope { + subscription_ids = [data.azurerm_subscription.current.id] + } + scope_accesses = ["Connectivity", "SecurityAdmin"] + description = "example network manager" +} + +resource "azurerm_network_manager_network_group" "example" { + name = "example-network-group" + network_manager_id = azurerm_network_manager.example.id +} + +resource "azurerm_network_manager_security_admin_configuration" "example" { + name = "example-admin-conf" + network_manager_id = azurerm_network_manager.example.id +} + +resource "azurerm_network_manager_admin_rule_collection" "example" { + name = "example-admin-rule-collection" + security_admin_configuration_id = azurerm_network_manager_security_admin_configuration.example.id + network_group_ids = [azurerm_network_manager_network_group.example.id] +} + +resource "azurerm_network_manager_admin_rule" "example" { + name = "example-admin-rule" + admin_rule_collection_id = azurerm_network_manager_admin_rule_collection.example.id + action = "Deny" + direction = "Outbound" + priority = 1 + protocol = "Tcp" + source_port_ranges = ["80", "1024-65535"] + destination_port_ranges = ["80"] + source { + address_prefix_type = "ServiceTag" + address_prefix = "Internet" + } + destination { + address_prefix_type = "IPPrefix" + address_prefix = "10.1.0.1" + } + destination { + address_prefix_type = "IPPrefix" + address_prefix = "10.0.0.0/24" + } + description = "example admin rule" +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name which should be used for this Network Manager Admin Rule. Changing this forces a new Network Manager Admin Rule to be created. + +* `admin_rule_collection_id` - (Required) Specifies the ID of the Network Manager Admin Rule Collection. Changing this forces a new Network Manager Admin Rule to be created. + +* `action` - (Required) Specifies the action allowed for this Network Manager Admin Rule. Possible values are `Allow`, `AlwaysAllow`, and `Deny`. + +* `direction` - (Required) Indicates if the traffic matched against the rule in inbound or outbound. Possible values are `Inbound` and `Outbound`. + +* `priority` - (Required) The priority of the rule. Possible values are integers between `1` 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. + +* `protocol` - (Required) Specifies which network protocol this Network Manager Admin Rule applies to. Possible values are `Ah`, `Any`, `Esp`, `Icmp`, `Tcp`, and `Udp`. + +* `description` - (Optional) A description of the Network Manager Admin Rule. + +* `destination_port_ranges` - (Optional) A list of string specifies the destination port ranges. Specify one or more single port number or port ranges such as `1024-65535`. Use `*` to specify any port. + +* `destination` - (Optional) One or more `destination` blocks as defined below. + +* `source_port_ranges` - (Optional) A list of string specifies the source port ranges. Specify one or more single port number or port ranges such as `1024-65535`. Use `*` to specify any port. + +* `source` - (Optional) One or more `source` blocks as defined below. + +--- + +A `destination` block supports the following: + +* `address_prefix` (Required) Specifies the address prefix. + +* `address_prefix_type` (Required) Specifies the address prefix type. Possible values are `IPPrefix` and `ServiceTag`. For more information, please see [this document](https://learn.microsoft.com/en-us/azure/virtual-network-manager/concept-security-admins#source-and-destination-types). + +--- + +A `source` block supports the following: + +* `address_prefix` (Required) Specifies the address prefix. + +* `address_prefix_type` (Required) Specifies the address prefix type. Possible values are `IPPrefix` and `ServiceTag`. For more information, please see [this document](https://learn.microsoft.com/en-us/azure/virtual-network-manager/concept-security-admins#source-and-destination-types). + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Network Manager Admin Rule. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Network Manager Admin Rule. +* `read` - (Defaults to 5 minutes) Used when retrieving the Network Manager Admin Rule. +* `update` - (Defaults to 30 minutes) Used when updating the Network Manager Admin Rule. +* `delete` - (Defaults to 30 minutes) Used when deleting the Network Manager Admin Rule. + +## Import + +Network Manager Admin Rule can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_network_manager_admin_rule.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Network/networkManagers/networkManager1/securityAdminConfigurations/configuration1/ruleCollections/ruleCollection1/rules/rule1 +``` diff --git a/website/docs/r/network_manager_admin_rule_collection.html.markdown b/website/docs/r/network_manager_admin_rule_collection.html.markdown new file mode 100644 index 000000000000..72e7b1d1b9ba --- /dev/null +++ b/website/docs/r/network_manager_admin_rule_collection.html.markdown @@ -0,0 +1,85 @@ +--- +subcategory: "Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_network_manager_admin_rule_collection" +description: |- + Manages a Network Manager Admin Rule Collection. +--- + +# azurerm_network_manager_admin_rule_collection + +Manages a Network Manager Admin Rule Collection. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +data "azurerm_subscription" "current" { +} + +resource "azurerm_network_manager" "example" { + name = "example-network-manager" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + scope { + subscription_ids = [data.azurerm_subscription.current.id] + } + scope_accesses = ["Connectivity", "SecurityAdmin"] + description = "example network manager" +} + +resource "azurerm_network_manager_network_group" "example" { + name = "example-network-group" + network_manager_id = azurerm_network_manager.example.id +} + +resource "azurerm_network_manager_security_admin_configuration" "example" { + name = "example-admin-conf" + network_manager_id = azurerm_network_manager.example.id +} + +resource "azurerm_network_manager_admin_rule_collection" "example" { + name = "example-admin-rule-collection" + security_admin_configuration_id = azurerm_network_manager_security_admin_configuration.example.id + network_group_ids = [azurerm_network_manager_network_group.example.id] +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name which should be used for this Network Manager Admin Rule Collection. Changing this forces a new Network Manager Admin Rule Collection to be created. + +* `security_admin_configuration_id` - (Required) Specifies the ID of the Network Manager Security Admin Configuration. Changing this forces a new Network Manager Admin Rule Collection to be created. + +* `network_group_ids` - (Required) A list of Network Group ID which this Network Manager Admin Rule Collection applies to. + +* `description` - (Optional) A description of the Network Manager Admin Rule Collection. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Network Manager Admin Rule Collection. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Network Manager Admin Rule Collection. +* `read` - (Defaults to 5 minutes) Used when retrieving the Network Manager Admin Rule Collection. +* `update` - (Defaults to 30 minutes) Used when updating the Network Manager Admin Rule Collection. +* `delete` - (Defaults to 30 minutes) Used when deleting the Network Manager Admin Rule Collection. + +## Import + +Network Manager Admin Rule Collection can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_network_manager_admin_rule_collection.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Network/networkManagers/networkManager1/securityAdminConfigurations/configuration1/ruleCollections/ruleCollection1 +``` diff --git a/website/docs/r/network_manager_connectivity_configuration.html.markdown b/website/docs/r/network_manager_connectivity_configuration.html.markdown new file mode 100644 index 000000000000..9fe27ac56715 --- /dev/null +++ b/website/docs/r/network_manager_connectivity_configuration.html.markdown @@ -0,0 +1,127 @@ +--- +subcategory: "Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_network_manager_connectivity_configuration" +description: |- + Manages a Network Manager Connectivity Configuration. +--- + +# azurerm_network_manager_connectivity_configuration + +Manages a Network Manager Connectivity Configuration. + +-> **Note:** The `azurerm_network_manager_connectivity_configuration` deployment may modify or delete existing Network Peering resource. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +data "azurerm_subscription" "current" { +} + +resource "azurerm_network_manager" "example" { + name = "example-network-manager" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + scope { + subscription_ids = [data.azurerm_subscription.current.id] + } + scope_accesses = ["Connectivity", "SecurityAdmin"] + description = "example network manager" +} + +resource "azurerm_network_manager_network_group" "example" { + name = "example-group" + network_manager_id = azurerm_network_manager.example.id +} + +resource "azurerm_virtual_network" "example" { + name = "example-net" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + address_space = ["10.0.0.0/16"] + flow_timeout_in_minutes = 10 +} + +resource "azurerm_network_manager_connectivity_configuration" "example" { + name = "example-connectivity-conf" + network_manager_id = azurerm_network_manager.example.id + connectivity_topology = "HubAndSpoke" + applies_to_group { + group_connectivity = "DirectlyConnected" + network_group_id = azurerm_network_manager_network_group.example.id + } + hub { + resource_id = azurerm_virtual_network.example.id + resource_type = "Microsoft.Network/virtualNetworks" + } +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name which should be used for this Network Manager Connectivity Configuration. Changing this forces a new Network Manager Connectivity Configuration to be created. + +* `network_manager_id` - (Required) Specifies the ID of the Network Manager. Changing this forces a new Network Manager Connectivity Configuration to be created. + +* `applies_to_group` - (Required) An `applies_to_group` block as defined below. + +* `connectivity_topology` - (Required) Specifies the connectivity topology type. Possible values are `HubAndSpoke` and `Mesh`. + +* `delete_existing_peering_enabled` - (Optional) Indicates whether to remove current existing Virtual Network Peering in the Connectivity Configuration affected scope. Possible values are `true` and `false`. + +* `description` - (Optional) A description of the Connectivity Configuration. + +* `global_mesh_enabled` - (Optional) Indicates whether to global mesh is supported. Possible values are `true` and `false`. +* `hub` - (Optional) A `hub` block as defined below. + +--- + +An `applies_to_group` block supports the following: + +* `group_connectivity` - (Required) Specifies the group connectivity type. Possible values are `None` and `DirectlyConnected`. + +* `network_group_id` - (Required) Specifies the resource ID of Network Group which the configuration applies to. + +* `global_mesh_enabled` - (Optional) Indicates whether to global mesh is supported for this group. Possible values are `true` and `false`. + +-> **NOTE:** A group can be global only if the `group_connectivity` is `DirectlyConnected`. + +* `use_hub_gateway` - (Optional) Indicates whether the hub gateway is used. Possible values are `true` and `false`. + +--- + +A `hub` block supports the following: + +* `resource_id` - (Required) Specifies the resource ID used as hub in Hub And Spoke topology. + +* `resource_type` - (Required) Specifies the resource Type used as hub in Hub And Spoke topology. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Network Manager Connectivity Configuration. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Network Manager Connectivity Configuration. +* `read` - (Defaults to 5 minutes) Used when retrieving the Network Manager Connectivity Configuration. +* `update` - (Defaults to 30 minutes) Used when updating the Network Manager Connectivity Configuration. +* `delete` - (Defaults to 30 minutes) Used when deleting the Network Manager Connectivity Configuration. + +## Import + +Network Manager Connectivity Configuration can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_network_manager_connectivity_configuration.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Network/networkManagers/networkManager1/connectivityConfigurations/configuration1 +``` diff --git a/website/docs/r/network_manager_management_group_connection.html.markdown b/website/docs/r/network_manager_management_group_connection.html.markdown index 04f7903757ba..89ffc4e17d34 100644 --- a/website/docs/r/network_manager_management_group_connection.html.markdown +++ b/website/docs/r/network_manager_management_group_connection.html.markdown @@ -81,7 +81,7 @@ In addition to the Arguments listed above - the following Attributes are exporte * `id` - The ID of the Network Manager Management Group Connection. * `connection_state` - The Connection state of the Network Manager Management Group Connection. -* + ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: diff --git a/website/docs/r/network_manager_scope_connection.html.markdown b/website/docs/r/network_manager_scope_connection.html.markdown new file mode 100644 index 000000000000..f7e373b213e0 --- /dev/null +++ b/website/docs/r/network_manager_scope_connection.html.markdown @@ -0,0 +1,87 @@ +--- +subcategory: "Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_network_manager_scope_connection" +description: |- + Manages a Network Manager Scope Connection. +--- + +# azurerm_network_manager_scope_connection + +Manages a Network Manager Scope Connection which may cross tenants. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +data "azurerm_client_config" "current" { +} + +data "azurerm_subscription" "current" { +} + +data "azurerm_subscription" "alt" { + subscription_id = "00000000-0000-0000-0000-000000000000" +} + +resource "azurerm_network_manager" "example" { + name = "example-networkmanager" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + scope { + subscription_ids = [data.azurerm_subscription.current.id] + } + scope_accesses = ["SecurityAdmin"] +} + +resource "azurerm_network_manager_scope_connection" "example" { + name = "example-nsc" + network_manager_id = azurerm_network_manager.example.id + tenant_id = data.azurerm_client_config.current.tenant_id + target_scope_id = data.azurerm_subscription.alt.id + description = "example" +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name which should be used for this Network Manager Scope Connection. Changing this forces a new Network Manager Scope Connection to be created. + +* `network_manager_id` - (Required) Specifies the ID of the Network Manager Scope Connection. Changing this forces a new Network Manager Scope Connection to be created. + +* `target_scope_id` - (Required) Specifies the Resource ID of the target scope which the Network Manager is connected to. It should be either Subscription ID or Management Group ID. + +* `tenant_id` - (Required) Specifies the Tenant ID of the Resource which the Network Manager is connected to. + +* `description` - (Optional) A description of the Network Manager Scope Connection. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Network Manager Scope Connection. + +* `connection_state` - The Connection state of the Network Manager Scope Connection. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Network Manager Scope Connection. +* `read` - (Defaults to 5 minutes) Used when retrieving the Network Manager Scope Connection. +* `update` - (Defaults to 30 minutes) Used when updating the Network Manager Scope Connection. +* `delete` - (Defaults to 30 minutes) Used when deleting the Network Manager Scope Connection. + +## Import + +Network Manager Scope Connection can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_network_manager_scope_connection.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Network/networkManagers/networkManager1/scopeConnections/scopeConnection1 +``` diff --git a/website/docs/r/network_manager_security_admin_configuration.html.markdown b/website/docs/r/network_manager_security_admin_configuration.html.markdown new file mode 100644 index 000000000000..b1d0d5643cb4 --- /dev/null +++ b/website/docs/r/network_manager_security_admin_configuration.html.markdown @@ -0,0 +1,81 @@ +--- +subcategory: "Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_network_security_admin_configuration" +description: |- + Manages a Network Manager Security Admin Configuration. +--- + +# azurerm_network_security_admin_configuration + +Manages a Network Manager Security Admin Configuration. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +data "azurerm_subscription" "current" { +} + +resource "azurerm_network_manager" "example" { + name = "example-network-manager" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + scope { + subscription_ids = [data.azurerm_subscription.current.id] + } + scope_accesses = ["Connectivity", "SecurityAdmin"] + description = "example network manager" +} + +resource "azurerm_network_manager_network_group" "example" { + name = "example-network-group" + network_manager_id = azurerm_network_manager.example.id +} + +resource "azurerm_network_manager_security_admin_configuration" "example" { + name = "example-admin-conf" + network_manager_id = azurerm_network_manager.example.id + description = "example admin conf" + apply_on_network_intent_policy_based_services = ["None"] +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name which should be used for this Network Manager Security Admin Configuration. Changing this forces a new Network Manager Security Admin Configuration to be created. + +* `network_manager_id` - (Required) Specifies the ID of the Network Manager Security Admin Configuration. Changing this forces a new Network Manager Security Admin Configuration to be created. + +* `apply_on_network_intent_policy_based_services` - (Optional) A list of network intent policy based services. Possible values are `All`, `None` and `AllowRulesOnly`. Exactly one value should be set. The `All` option requires `Microsoft.Network/AllowAdminRulesOnNipBasedServices` feature registration to Subscription. Please see [this document](https://learn.microsoft.com/en-us/azure/virtual-network-manager/concept-security-admins#network-intent-policies-and-security-admin-rules) for more information. + +* `description` - (Optional) A description of the Security Admin Configuration. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Network Manager Security Admin Configuration. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Network Manager Security Admin Configuration. +* `read` - (Defaults to 5 minutes) Used when retrieving the Network Manager Security Admin Configuration. +* `update` - (Defaults to 30 minutes) Used when updating the Network Manager Security Admin Configuration. +* `delete` - (Defaults to 30 minutes) Used when deleting the Network Manager Security Admin Configuration. + +## Import + +Network Manager Security Admin Configuration can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_network_security_admin_configuration.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Network/networkManagers/networkManager1/securityAdminConfigurations/configuration1 +``` diff --git a/website/docs/r/network_manager_static_member.html.markdown b/website/docs/r/network_manager_static_member.html.markdown new file mode 100644 index 000000000000..18039285e063 --- /dev/null +++ b/website/docs/r/network_manager_static_member.html.markdown @@ -0,0 +1,80 @@ +--- +subcategory: "Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_network_manager_static_member" +description: |- + Manages a Network Manager Static Member. +--- + +# azurerm_network_manager_static_member + +Manages a Network Manager Static Member. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +data "azurerm_subscription" "current" { +} + +resource "azurerm_network_manager" "example" { + name = "example-network-manager" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + scope { + subscription_ids = [data.azurerm_subscription.current.id] + } + scope_accesses = ["Connectivity", "SecurityAdmin"] + description = "example network manager" +} + +resource "azurerm_network_manager_network_group" "example" { + name = "example-group" + network_manager_id = azurerm_network_manager.example.id + description = "example network group" +} + +resource "azurerm_network_manager_static_member" "example" { + name = "example-nmsm" + network_group_id = azurerm_network_manager_network_group.example.id + target_virtual_network_id = azurerm_virtual_network.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name which should be used for this Network Manager Static Member. Changing this forces a new Network Manager Static Member to be created. + +* `network_group_id` - (Required) Specifies the ID of the Network Manager Group. Changing this forces a new Network Manager Static Member to be created. + +* `target_virtual_network_id` - (Required) Specifies the Resource ID of the Virtual Network using as the Static Member. Changing this forces a new Network Manager Static Member to be created. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Network Manager Static Member. + +* `region` - The region of the Network Manager Static Member. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Network Manager Static Member. +* `read` - (Defaults to 5 minutes) Used when retrieving the Network Manager Static Member. +* `delete` - (Defaults to 30 minutes) Used when deleting the Network Manager Static Member. + +## Import + +Network Manager Static Member can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_network_manager_static_member.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Network/networkManagers/networkManager1/networkGroups/networkGroup1/staticMembers/staticMember1 +``` diff --git a/website/docs/r/nginx_configuration.html.markdown b/website/docs/r/nginx_configuration.html.markdown index 5fe2b9bfb42d..f2b12ab88542 100644 --- a/website/docs/r/nginx_configuration.html.markdown +++ b/website/docs/r/nginx_configuration.html.markdown @@ -57,17 +57,19 @@ EOT The following arguments are supported: -* `config_file` - (Required) One or more `config_file` blocks as defined below. - * `nginx_deployment_id` - (Required) The ID of the Nginx Deployment. Changing this forces a new Nginx Configuration to be created. * `root_file` - (Required) Specify the root file path of this Nginx Configuration. --- +-> **NOTE:** Either `package_data` or `config_file` must be specified - but not both. + * `package_data` - (Optional) Specify the package data for this configuration. -* `protected_file` - (Optional) One or more `config_file` (Protected File) blocks with sensitive information as defined below. +* `config_file` - (Optional) One or more `config_file` blocks as defined below. + +* `protected_file` - (Optional) One or more `protected_file` (Protected File) blocks with sensitive information as defined below. If specified `config_file` must also be specified. --- @@ -79,7 +81,7 @@ A `config_file` block supports the following: --- -A `config_file` (Protected File) block supports the following: +A `protected_file` (Protected File) block supports the following: * `content` - (Required) Specifies the base-64 encoded contents of this config file (Sensitive). diff --git a/website/docs/r/orbital_contact.html.markdown b/website/docs/r/orbital_contact.html.markdown new file mode 100644 index 000000000000..22a001a8eed8 --- /dev/null +++ b/website/docs/r/orbital_contact.html.markdown @@ -0,0 +1,143 @@ +--- +subcategory: "Orbital" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_orbital_contact_profile" +description: |- + Manages an orbital contact resource. +--- + +# azurerm_orbital_contact + +Manages an orbital contact. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "rg-example" + location = "West Europe" +} + +resource "azurerm_orbital_spacecraft" "example" { + name = "example-spacecraft" + resource_group_name = azurerm_resource_group.test.name + location = "westeurope" + norad_id = "12345" + + links { + bandwidth_mhz = 100 + center_frequency_mhz = 101 + direction = "Uplink" + polarization = "LHCP" + name = "examplename" + } + + two_line_elements = ["1 23455U 94089A 97320.90946019 .00000140 00000-0 10191-3 0 2621", "2 23455 99.0090 272.6745 0008546 223.1686 136.8816 14.11711747148495"] + title_line = "AQUA" + + tags = { + aks-managed-cluster-name = "9a57225d-a405-4d40-aa46-f13d2342abef" + } +} + +resource "azurerm_virtual_network" "example" { + name = "example-vnet" + address_space = ["10.0.0.0/16"] + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name +} + +resource "azurerm_subnet" "example" { + name = "example-subnet" + resource_group_name = azurerm_resource_group.example.name + virtual_network_name = azurerm_virtual_network.example.name + address_prefixes = ["10.0.1.0/24"] + + delegation { + name = "orbitalgateway" + + service_delegation { + name = "Microsoft.Orbital/orbitalGateways" + actions = [ + "Microsoft.Network/publicIPAddresses/join/action", + "Microsoft.Network/virtualNetworks/subnets/join/action", + "Microsoft.Network/virtualNetworks/read", + "Microsoft.Network/publicIPAddresses/read", + ] + } + } +} + +resource "azurerm_orbital_contact_profile" "example" { + name = "example-contactprofile" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + minimum_variable_contact_duration = "PT1M" + auto_tracking = "disabled" + links { + channels { + name = "channelname" + bandwidth_mhz = 100 + center_frequency_mhz = 101 + end_point { + end_point_name = "AQUA_command" + ip_address = "10.0.1.0" + port = "49153" + protocol = "TCP" + } + } + direction = "Uplink" + name = "RHCP_UL" + polarization = "RHCP" + } + network_configuration_subnet_id = azurerm_subnet.example.id +} + +resource "azurerm_orbital_contact" "example" { + name = "example-contact" + spacecraft_id = azurerm_orbital_spacecraft.example.id + reservation_start_time = "2020-07-16T20:35:00.00Z" + reservation_end_time = "2020-07-16T20:55:00.00Z" + ground_station_name = "WESTUS2_0" + contact_profile_id = azurerm_orbital_contact_profile.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Contact. Changing this forces a new resource to be created. Changing this forces a new resource to be created. + +* `spacecraft_id` - (Required) The ID of the spacecraft which the contact will be made to. Changing this forces a new resource to be created. + +* `reservation_start_time` - (Required) Reservation start time of the Contact. Changing this forces a new resource to be created. + +* `reservation_end_time` - (Required) Reservation end time of the Contact. Changing this forces a new resource to be created. + +* `ground_station_name` - (Required) Name of the Azure ground station. Changing this forces a new resource to be created. + +* `contact_profile_id` - (Required) ID of the orbital contact profile. Changing this forces a new resource to be created. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Contact. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Contact. +* `read` - (Defaults to 5 minutes) Used when retrieving the Contact. +* `update` - (Defaults to 30 minutes) Used when updating the Contact. +* `delete` - (Defaults to 30 minutes) Used when deleting the Contact. + +## Import + +Spacecraft can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_orbital_contact.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Orbital/spacecrafts/spacecraft1/contacts/contact1 +``` diff --git a/website/docs/r/postgresql_flexible_server.html.markdown b/website/docs/r/postgresql_flexible_server.html.markdown index d4329c7cb098..dfa30f00af39 100644 --- a/website/docs/r/postgresql_flexible_server.html.markdown +++ b/website/docs/r/postgresql_flexible_server.html.markdown @@ -96,9 +96,13 @@ The following arguments are supported: * `backup_retention_days` - (Optional) The backup retention days for the PostgreSQL Flexible Server. Possible values are between `7` and `35` days. +* `customer_managed_key` - (Optional) A `customer_managed_key` block as defined below. Changing this forces a new resource to be created. + * `geo_redundant_backup_enabled` - (Optional) Is Geo-Redundant backup enabled on the PostgreSQL Flexible Server. Defaults to `false`. Changing this forces a new PostgreSQL Flexible Server to be created. -* `create_mode` - (Optional) The creation mode which can be used to restore or replicate existing servers. Possible values are `Default` and `PointInTimeRestore`. Changing this forces a new PostgreSQL Flexible Server to be created. +* `create_mode` - (Optional) The creation mode which can be used to restore or replicate existing servers. Possible values are `Default`, `PointInTimeRestore`, `Replica` and `Update`. Changing this forces a new PostgreSQL Flexible Server to be created. + +-> **Note:** While creating the resource, `create_mode` cannot be set to `Update`. * `delegated_subnet_id` - (Optional) The ID of the virtual network subnet to create the PostgreSQL Flexible Server. The provided subnet should not have any other resource deployed in it and this subnet will be delegated to the PostgreSQL Flexible Server, if not already delegated. Changing this forces a new PostgreSQL Flexible Server to be created. @@ -108,13 +112,19 @@ The following arguments are supported: * `high_availability` - (Optional) A `high_availability` block as defined below. +* `identity` - (Optional) An `identity` block as defined below. + * `maintenance_window` - (Optional) A `maintenance_window` block as defined below. * `point_in_time_restore_time_in_utc` - (Optional) The point in time to restore from `source_server_id` when `create_mode` is `PointInTimeRestore`. Changing this forces a new PostgreSQL Flexible Server to be created. +* `replication_role` - (Optional) The replication role for the PostgreSQL Flexible Server. Possible value is `None`. + +~> **NOTE:** The `replication_role` cannot be set while creating and only can be updated to `None` for replica server. + * `sku_name` - (Optional) The SKU Name for the PostgreSQL Flexible Server. The name of the SKU, follows the `tier` + `name` pattern (e.g. `B_Standard_B1ms`, `GP_Standard_D2s_v3`, `MO_Standard_E4s_v3`). -* `source_server_id` - (Optional) The resource ID of the source PostgreSQL Flexible Server to be restored. Required when `create_mode` is `PointInTimeRestore`. Changing this forces a new PostgreSQL Flexible Server to be created. +* `source_server_id` - (Optional) The resource ID of the source PostgreSQL Flexible Server to be restored. Required when `create_mode` is `PointInTimeRestore` or `Replica`. Changing this forces a new PostgreSQL Flexible Server to be created. * `storage_mb` - (Optional) The max storage allowed for the PostgreSQL Flexible Server. Possible values are `32768`, `65536`, `131072`, `262144`, `524288`, `1048576`, `2097152`, `4194304`, `8388608`, and `16777216`. @@ -122,6 +132,8 @@ The following arguments are supported: * `version` - (Optional) The version of PostgreSQL Flexible Server to use. Possible values are `11`,`12`, `13` and `14`. Required when `create_mode` is `Default`. Changing this forces a new PostgreSQL Flexible Server to be created. +-> **Note:** When `create_mode` is `Update`, upgrading version wouldn't force a new resource to be created. + * `zone` - (Optional) Specifies the Availability Zone in which the PostgreSQL Flexible Server should be located. -> **Note:** Azure will automatically assign an Availability Zone if one is not specified. If the PostgreSQL Flexible Server fails-over to the Standby Availability Zone, the `zone` will be updated to reflect the current Primary Availability Zone. You can use [Terraform's `ignore_changes` functionality](https://www.terraform.io/docs/language/meta-arguments/lifecycle.html#ignore_changes) to ignore changes to the `zone` and `high_availability.0.standby_availability_zone` fields should you wish for Terraform to not migrate the PostgreSQL Flexible Server back to it's primary Availability Zone after a fail-over. @@ -132,9 +144,9 @@ The following arguments are supported: An `authentication` block supports the following: -* `active_directory_auth_enabled` - (Optional) Whether or not Active Directory authentication is allowed to access the PostgreSQL Flexible Server. +* `active_directory_auth_enabled` - (Optional) Whether or not Active Directory authentication is allowed to access the PostgreSQL Flexible Server. Defaults to `false`. -* `password_auth_enabled` - (Optional) Whether or not password authentication is allowed to access the PostgreSQL Flexible Server. +* `password_auth_enabled` - (Optional) Whether or not password authentication is allowed to access the PostgreSQL Flexible Server. Defaults to `true`. * `tenant_id` - (Optional) The Tenant ID of the Azure Active Directory which is used by the Active Directory authentication. `active_directory_auth_enabled` must be set to `true`. @@ -144,6 +156,26 @@ An `authentication` block supports the following: --- +A `customer_managed_key` block supports the following: + +* `key_vault_key_id` - (Optional) The ID of the Key Vault Key. + +* `primary_user_assigned_identity_id` - (Optional) Specifies the primary user managed identity id for a Customer Managed Key. Should be added with `identity_ids`. + +~> **NOTE:** This is required when `type` is set to `UserAssigned` or `SystemAssigned, UserAssigned`. + +--- + +An `identity` block supports the following: + +* `type` - (Required) Specifies the type of Managed Service Identity that should be configured on this API Management Service. Should be set to `UserAssigned`, `SystemAssigned, UserAssigned` (to enable both). + +* `identity_ids` - (Optional) A list of User Assigned Managed Identity IDs to be assigned to this API Management Service. Required if used together with `customer_managed_key` block. + +~> **NOTE:** This is required when `type` is set to `UserAssigned` or `SystemAssigned, UserAssigned`. + +--- + A `maintenance_window` block supports the following: * `day_of_week` - (Optional) The day of week for maintenance window, where the week starts on a Sunday, i.e. Sunday = `0`, Monday = `1`. Defaults to `0`. @@ -156,7 +188,7 @@ A `maintenance_window` block supports the following: A `high_availability` block supports the following: -* `mode` - (Required) The high availability mode for the PostgreSQL Flexible Server. The only possible value is `ZoneRedundant`. +* `mode` - (Required) The high availability mode for the PostgreSQL Flexible Server. Possible value are `SameZone` or `ZoneRedundant`. * `standby_availability_zone` - (Optional) Specifies the Availability Zone in which the standby Flexible Server should be located. diff --git a/website/docs/r/private_dns_a_record.html.markdown b/website/docs/r/private_dns_a_record.html.markdown index 1e273a4176fd..6b36d1195f68 100644 --- a/website/docs/r/private_dns_a_record.html.markdown +++ b/website/docs/r/private_dns_a_record.html.markdown @@ -42,7 +42,7 @@ The following arguments are supported: * `zone_name` - (Required) Specifies the Private DNS Zone where the resource exists. Changing this forces a new resource to be created. -* `TTL` - (Required) The Time To Live (TTL) of the DNS record in seconds. +* `ttl` - (Required) The Time To Live (TTL) of the DNS record in seconds. * `records` - (Required) List of IPv4 Addresses. diff --git a/website/docs/r/private_endpoint.html.markdown b/website/docs/r/private_endpoint.html.markdown index 645ab14e3d79..cc880dbaff05 100644 --- a/website/docs/r/private_endpoint.html.markdown +++ b/website/docs/r/private_endpoint.html.markdown @@ -203,7 +203,7 @@ An `ip_configuration` block supports the following: * `private_ip_address` - (Required) Specifies the static IP address within the private endpoint's subnet to be used. Changing this forces a new resource to be created. -* `subresource_name` - (Required) Specifies the subresource this IP address applies to. `subresource_names` corresponds to `group_id`. Changing this forces a new resource to be created. +* `subresource_name` - (Optional) Specifies the subresource this IP address applies to. `subresource_names` corresponds to `group_id`. Changing this forces a new resource to be created. * `member_name` - (Optional) Specifies the member name this IP address applies to. If it is not specified, it will use the value of `subresource_name`. Changing this forces a new resource to be created. @@ -215,6 +215,16 @@ The following attributes are exported: * `id` - The ID of the Private Endpoint. +* `network_interface` - A `network_interface` block as defined below. + +* `custom_dns_configs` - A `custom_dns_configs` block as defined below. + +* `private_dns_zone_configs` - A `private_dns_zone_configs` block as defined below. + +* `ip_configuration` - A `ip_configuration` block as defined below. + +* `private_dns_zone_configs` - A `private_dns_zone_configs` block as defined below. + --- A `network_interface` block exports: @@ -269,6 +279,12 @@ An `ip_configuration` block exports: --- +A `private_dns_zone_configs` block exports: + +* `record_sets` - A `record_sets` block as defined below. + +--- + A `record_sets` block exports: * `name` - The name of the Private DNS Zone that the config belongs to. diff --git a/website/docs/r/public_ip.html.markdown b/website/docs/r/public_ip.html.markdown index bc9f292198f9..00c6ba0ff056 100644 --- a/website/docs/r/public_ip.html.markdown +++ b/website/docs/r/public_ip.html.markdown @@ -10,6 +10,8 @@ description: |- Manages a Public IP Address. +~> **Note** If this resource is to be associated with a resource that requires disassociation before destruction (such as `azurerm_network_interface`) it is recommended to set the `lifecycle` argument `create_before_destroy = true`. Otherwise, it can fail to disassociate on destruction. + ## Example Usage ```hcl diff --git a/website/docs/r/recovery_services_vault.html.markdown b/website/docs/r/recovery_services_vault.html.markdown index 2daa03720501..57fa1b36fa13 100644 --- a/website/docs/r/recovery_services_vault.html.markdown +++ b/website/docs/r/recovery_services_vault.html.markdown @@ -44,10 +44,16 @@ The following arguments are supported: * `sku` - (Required) Sets the vault's SKU. Possible values include: `Standard`, `RS0`. +* `public_network_access_enabled` - (Optional) Is it enabled to access the vault from public networks. Defaults to `true`. + +* `immutability` - (Optional) Immutability Settings of vault, possible values include: `Locked`, `Unlocked` and `Disabled`. + * `storage_mode_type` - (Optional) The storage type of the Recovery Services Vault. Possible values are `GeoRedundant`, `LocallyRedundant` and `ZoneRedundant`. Defaults to `GeoRedundant`. * `cross_region_restore_enabled` - (Optional) Is cross region restore enabled for this Vault? Only can be `true`, when `storage_mode_type` is `GeoRedundant`. Defaults to `false`. +-> **Note:** Once `cross_region_restore_enabled` is set to `true`, changing it back to `false` forces a new Recovery Service Vault to be created. + * `soft_delete_enabled` - (Optional) Is soft delete enable for this Vault? Defaults to `true`. * `encryption` - (Optional) An `encryption` block as defined below. Required with `identity`. @@ -58,7 +64,11 @@ The following arguments are supported: An `identity` block supports the following: -* `type` - (Required) Specifies the type of Managed Service Identity that should be configured on this Recovery Services Vault. The only possible value is `SystemAssigned`. +* `type` - (Required) Specifies the type of Managed Service Identity that should be configured on this Recovery Services Vault. Possible values are `SystemAssigned`, `UserAssigned`, `SystemAssigned, UserAssigned` (to enable both). + +* `identity_ids` - (Optional) A list of User Assigned Managed Identity IDs to be assigned to this App Configuration. + +~> **NOTE:** `identity_ids` is required when `type` is set to `UserAssigned` or `SystemAssigned, UserAssigned`. --- @@ -68,7 +78,11 @@ An `encryption` block supports the following: * `infrastructure_encryption_enabled` - (Required) Enabling/Disabling the Double Encryption state. -* `use_system_assigned_identity` - (Optional) Indicate that system assigned identity should be used or not. At this time the only possible value is `true`. Defaults to `true`. +* `user_assigned_identity_id` - (Optional) Specifies the user assigned identity ID to be used. + +* `use_system_assigned_identity` - (Optional) Indicate that system assigned identity should be used or not. Defaults to `true`. + +!> **Note:** `use_system_assigned_identity` only be able to set to `false` for **new** vaults. Any vaults containing existing items registered or attempted to be registered to it are not supported. Details can be found in [the document](https://learn.microsoft.com/en-us/azure/backup/encryption-at-rest-with-cmk?tabs=portal#before-you-start) !> **Note:** Once `infrastructure_encryption_enabled` has been set it's not possible to change it. @@ -94,7 +108,7 @@ An `identity` block exports the following: The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: -* `create` - (Defaults to 60 minutes) Used when creating the Recovery Services Vault. +* `create` - (Defaults to 2 hours) Used when creating the Recovery Services Vault. * `update` - (Defaults to 60 minutes) Used when updating the Recovery Services Vault. * `read` - (Defaults to 5 minutes) Used when retrieving the Recovery Services Vault. * `delete` - (Defaults to 30 minutes) Used when deleting the Recovery Services Vault. diff --git a/website/docs/r/redis_cache.html.markdown b/website/docs/r/redis_cache.html.markdown index daa9b8d4eddf..cb8b9d5c97fb 100644 --- a/website/docs/r/redis_cache.html.markdown +++ b/website/docs/r/redis_cache.html.markdown @@ -172,7 +172,7 @@ redis_configuration { A `patch_schedule` block supports the following: -* `day_of_week` (Required) the Weekday name - possible values include `Monday`, `Tuesday`, `Wednesday` etc. +* `day_of_week` - (Required) the Weekday name - possible values include `Monday`, `Tuesday`, `Wednesday` etc. * `start_hour_utc` - (Optional) the Start Hour for maintenance in UTC - possible values range from `0 - 23`. @@ -227,5 +227,5 @@ A `redis_configuration` block exports the following: Redis Cache's can be imported using the `resource id`, e.g. ```shell -terraform import azurerm_redis_cache.cache1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Cache/Redis/cache1 +terraform import azurerm_redis_cache.cache1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Cache/redis/cache1 ``` diff --git a/website/docs/r/redis_enterprise_cluster.html.markdown b/website/docs/r/redis_enterprise_cluster.html.markdown index 664dfb430bca..d88b7f648219 100644 --- a/website/docs/r/redis_enterprise_cluster.html.markdown +++ b/website/docs/r/redis_enterprise_cluster.html.markdown @@ -53,10 +53,6 @@ In addition to the Arguments listed above - the following Attributes are exporte * `hostname` - DNS name of the cluster endpoint. -* `version` - Version of redis the cluster supports, e.g. '6'. - --> **NOTE:** The `version` field currently is not yet being returned from the service API, please see for more information. - ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: diff --git a/website/docs/r/redis_firewall_rule.html.markdown b/website/docs/r/redis_firewall_rule.html.markdown index 7f188f6614c5..dc563d153156 100644 --- a/website/docs/r/redis_firewall_rule.html.markdown +++ b/website/docs/r/redis_firewall_rule.html.markdown @@ -86,5 +86,5 @@ The following attributes are exported: Redis Firewall Rules can be imported using the `resource id`, e.g. ```shell -terraform import azurerm_redis_firewall_rule.rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Cache/Redis/cache1/firewallRules/rule1 +terraform import azurerm_redis_firewall_rule.rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Cache/redis/cache1/firewallRules/rule1 ``` diff --git a/website/docs/r/redis_linked_server.html.markdown b/website/docs/r/redis_linked_server.html.markdown index 3a70aa743495..0266a6bd34be 100644 --- a/website/docs/r/redis_linked_server.html.markdown +++ b/website/docs/r/redis_linked_server.html.markdown @@ -100,5 +100,5 @@ The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/l Redis can be imported using the `resource id`, e.g. ```shell -terraform import azurerm_redis_linked_server.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Cache/Redis/cache1/linkedServers/cache2 +terraform import azurerm_redis_linked_server.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Cache/redis/cache1/linkedServers/cache2 ``` diff --git a/website/docs/r/sentinel_alert_rule_nrt.html.markdown b/website/docs/r/sentinel_alert_rule_nrt.html.markdown index 4779e5b9015e..0fae10d34ded 100644 --- a/website/docs/r/sentinel_alert_rule_nrt.html.markdown +++ b/website/docs/r/sentinel_alert_rule_nrt.html.markdown @@ -86,6 +86,14 @@ The following arguments are supported: * `entity_mapping` - (Optional) A list of `entity_mapping` blocks as defined below. +* `event_grouping` - (Optional) A `event_grouping` block as defined below. + +-> **NOTE:** `event_grouping` will be required in the next major version of the AzureRM Provider. + +* `sentinel_entity_mapping` - (Optional) A list of `sentinel_entity_mapping` blocks as defined below. + +-> **NOTE:** `entity_mapping` and `sentinel_entity_mapping` together can't exceed 5. + * `incident` - (Optional) A `incident` block as defined below. * `suppression_duration` - (Optional) If `suppression_enabled` is `true`, this is ISO 8601 timespan duration, which specifies the amount of time the query should stop running after alert is generated. Defaults to `PT5H`. @@ -108,6 +116,16 @@ An `alert_details_override` block supports the following: * `tactics_column_name` - (Optional) The column name to take the alert tactics from. +* `dynamic_property` - (Optional) A list of `dynamic_property` blocks as defined below. + +--- + +A `dynamic_property` block supports the following: + +* `name` - (Required) The name of the dynamic property. Possible Values are `AlertLink`, `ConfidenceLevel`, `ConfidenceScore`, `ExtendedLinks`, `ProductComponentName`, `ProductName`, `ProviderName`, `RemediationSteps` and `Techniques`. + +* `value` - (Required) The value of the dynamic property. Pssible Values are `Caller`, `dcount_ResourceId` and `EventSubmissionTimestamp`. + --- An `entity_mapping` block supports the following: @@ -118,6 +136,18 @@ An `entity_mapping` block supports the following: --- +A `event_grouping` block supports the following: + +* `aggregation_method` - (Required) The aggregation type of grouping the events. Possible values are `AlertPerResult` and `SingleAlert`. + +--- + +A `sentinel_entity_mapping` block supports the following: + +* `column_name` - (Required) The column name to be mapped to the identifier. + +--- + A `field_mapping` block supports the following: * `identifier` - (Required) The identifier of the entity. diff --git a/website/docs/r/sentinel_alert_rule_scheduled.html.markdown b/website/docs/r/sentinel_alert_rule_scheduled.html.markdown index d9675052a9bc..aac3ad041f0f 100644 --- a/website/docs/r/sentinel_alert_rule_scheduled.html.markdown +++ b/website/docs/r/sentinel_alert_rule_scheduled.html.markdown @@ -102,6 +102,10 @@ The following arguments are supported: * `suppression_enabled` - (Optional) Should the Sentinel Scheduled Alert Rulea stop running query after alert is generated? Defaults to `false`. +* `sentinel_entity_mapping` - (Optional) A list of `sentinel_entity_mapping` blocks as defined below. + +-> **NOTE:** `entity_mapping` and `sentinel_entity_mapping` together can't exceed 5. + * `tactics` - (Optional) A list of categories of attacks by which to classify the rule. Possible values are `Collection`, `CommandAndControl`, `CredentialAccess`, `DefenseEvasion`, `Discovery`, `Execution`, `Exfiltration`, `ImpairProcessControl`, `InhibitResponseFunction`, `Impact`, `InitialAccess`, `LateralMovement`, `Persistence`, `PrivilegeEscalation`, `PreAttack`, `Reconnaissance` and `ResourceDevelopment`. * `techniques` - (Optional) A list of techniques of attacks by which to classify the rule. @@ -122,6 +126,16 @@ An `alert_details_override` block supports the following: * `tactics_column_name` - (Optional) The column name to take the alert tactics from. +* `dynamic_property` - (Optional) A list of `dynamic_property` blocks as defined below. + +--- + +A `dynamic_property` block supports the following: + +* `name` - (Required) The name of the dynamic property. Possible Values are `AlertLink`, `ConfidenceLevel`, `ConfidenceScore`, `ExtendedLinks`, `ProductComponentName`, `ProductName`, `ProviderName`, `RemediationSteps` and `Techniques`. + +* `value` - (Required) The value of the dynamic property. Pssible Values are `Caller`, `dcount_ResourceId` and `EventSubmissionTimestamp`. + --- An `entity_mapping` block supports the following: @@ -132,6 +146,12 @@ An `entity_mapping` block supports the following: --- +A `sentinel_entity_mapping` block supports the following: + +* `column_name` - (Required) The column name to be mapped to the identifier. + +--- + A `event_grouping` block supports the following: * `aggregation_method` - (Required) The aggregation type of grouping the events. Possible values are `AlertPerResult` and `SingleAlert`. diff --git a/website/docs/r/sentinel_data_connector_microsoft_threat_intelligence.html.markdown b/website/docs/r/sentinel_data_connector_microsoft_threat_intelligence.html.markdown new file mode 100644 index 000000000000..1a2e24b2d1fb --- /dev/null +++ b/website/docs/r/sentinel_data_connector_microsoft_threat_intelligence.html.markdown @@ -0,0 +1,90 @@ +--- +subcategory: "Sentinel" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_sentinel_data_connector_microsoft_threat_intelligence" +description: |- + Manages a Microsoft Threat Intelligence Data Connector. +--- + +# azurerm_sentinel_data_connector_microsoft_threat_intelligence + +Manages a Microsoft Threat Intelligence Data Connector. + +## Example Usage + +```hcl +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "example" { + name = "example-rg" + location = "east us" +} + +resource "azurerm_log_analytics_workspace" "example" { + name = "example-workspace" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + sku = "PerGB2018" +} + +resource "azurerm_sentinel_log_analytics_workspace_onboarding" "example" { + resource_group_name = azurerm_resource_group.example.name + workspace_name = azurerm_log_analytics_workspace.example.name +} + +resource "azurerm_sentinel_data_connector_microsoft_threat_intelligence" "example" { + name = "example-dc-msti" + log_analytics_workspace_id = azurerm_log_analytics_workspace.example.id + bing_safety_phishing_url_lookback_date = "1970-01-01T00:00:00Z" + microsoft_emerging_threat_feed_lookback_date = "1970-01-01T00:00:00Z" + + depends_on = [ + azurerm_sentinel_log_analytics_workspace_onboarding.test + ] +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name which should be used for this Microsoft Threat Intelligence Data Connector. Changing this forces a new Microsoft Threat Intelligence Data Connector to be created. + +* `log_analytics_workspace_id` - (Required) The ID of the Log Analytics Workspace. Changing this forces a new Data Connector to be created. + +* `bing_safety_phishing_url_lookback_date` - (Optional) The lookback date for the Bing Safety Phishing Url in RFC3339. Changing this forces a new Data Connector to be created. + +* `microsoft_emerging_threat_feed_lookback_date` - (Optional) The lookback date for the Microsoft Emerging Threat Feed in RFC3339. Changing this forces a new Data Connector to be created. + +-> **NOTE:** At least one of `bing_safety_phishing_url_lookback_date` and `microsoft_emerging_threat_feed_lookback_date` must be specified. + +--- + +* `tenant_id` - (Optional) The ID of the tenant that this Microsoft Threat Intelligence Data Connector connects to. Changing this forces a new Microsoft Threat Intelligence Data Connector to be created. + +-> **NOTE** Currently, only the same tenant as the running account is allowed. Cross-tenant scenario is not supported yet. + + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the sentinel. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the sentinel. +* `read` - (Defaults to 5 minutes) Used when retrieving the sentinel. +* `delete` - (Defaults to 30 minutes) Used when deleting the sentinel. + +## Import + +sentinels can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_sentinel_data_connector_microsoft_threat_intelligence.example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.OperationalInsights/workspaces/workspace1/providers/Microsoft.SecurityInsights/dataConnectors/dc1 +``` diff --git a/website/docs/r/sentinel_data_connector_threat_intelligence.html.markdown b/website/docs/r/sentinel_data_connector_threat_intelligence.html.markdown index 079dfa63a6ce..2f19fbdf6a65 100644 --- a/website/docs/r/sentinel_data_connector_threat_intelligence.html.markdown +++ b/website/docs/r/sentinel_data_connector_threat_intelligence.html.markdown @@ -52,6 +52,8 @@ The following arguments are supported: * `name` - (Required) The name which should be used for this Threat Intelligence Data Connector. Changing this forces a new Threat Intelligence Data Connector to be created. +* `lookback_date` - (Optional) The lookback date for the this Threat Intelligence Data Connector in RFC3339. Defaults to `1970-01-01T00:00:00Z`. + --- * `tenant_id` - (Optional) The ID of the tenant that this Threat Intelligence Data Connector connects to. Changing this forces a new Threat Intelligence Data Connector to be created. diff --git a/website/docs/r/sentinel_log_analytics_workspace_onboarding.html.markdown b/website/docs/r/sentinel_log_analytics_workspace_onboarding.html.markdown new file mode 100644 index 000000000000..f0b9ed2dcc8b --- /dev/null +++ b/website/docs/r/sentinel_log_analytics_workspace_onboarding.html.markdown @@ -0,0 +1,71 @@ +--- +subcategory: "Sentinel" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_sentinel_log_analytics_workspace_onboarding" +description: |- + Manages a Security Insights Sentinel Onboarding States. +--- + +# azurerm_sentinel_log_analytics_workspace_onboarding + +Manages a Security Insights Sentinel Onboarding. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_log_analytics_workspace" "example" { + name = "example-law" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + sku = "PerGB2018" +} + +resource "azurerm_security_insights_sentinel_onboarding" "example" { + resource_group_name = azurerm_resource_group.example.name + workspace_name = azurerm_log_analytics_workspace.example.name + customer_managed_key_enabled = false +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `resource_group_name` - (Required) Specifies the name of the Resource Group where the Security Insights Sentinel Onboarding States should exist. Changing this forces the Log Analytics Workspace off the board and onboard again. + +* `workspace_name` - (Required) Specifies the Workspace Name. Changing this forces the Log Analytics Workspace off the board and onboard again. Changing this forces a new resource to be created. + +* `customer_managed_key_enabled` - (Optional) Specifies if the Workspace is using Customer managed key. Defaults to `false`. Changing this forces a new resource to be created. + +-> **Note:** To set up Microsoft Sentinel customer-managed key it needs to enable CMK on the workspace and add access policy to your Azure Key Vault. Details could be found on [this document](https://learn.microsoft.com/en-us/azure/sentinel/customer-managed-keys) + +-> **Note:** Once a workspace is onboarded to Microsoft Sentinel with `customer_managed_key_enabled` set to true, it will not be able to be onboarded again with `customer_managed_key_enabled` set to false. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Security Insights Sentinel Onboarding States. + + + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Security Insights Sentinel Onboarding States. +* `read` - (Defaults to 5 minutes) Used when retrieving the Security Insights Sentinel Onboarding States. +* `delete` - (Defaults to 30 minutes) Used when deleting the Security Insights Sentinel Onboarding States. + +## Import + +Security Insights Sentinel Onboarding States can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_security_insights_sentinel_onboarding.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.OperationalInsights/workspaces/workspace1/providers/Microsoft.SecurityInsights/onboardingStates/defaults +``` diff --git a/website/docs/r/service_fabric_managed_cluster.html.markdown b/website/docs/r/service_fabric_managed_cluster.html.markdown index 7229b69f139d..c3c3e14f93aa 100644 --- a/website/docs/r/service_fabric_managed_cluster.html.markdown +++ b/website/docs/r/service_fabric_managed_cluster.html.markdown @@ -59,7 +59,7 @@ The following arguments are supported: * `name` - (Required) The name which should be used for this Resource Group. Changing this forces a new Resource Group to be created. -* `resource_group_name` - (Required) The name of the Resource Group where the Resource Group should exist. +* `resource_group_name` - (Required) The name of the Resource Group where the Resource Group should exist. Changing this forces a new Resource Group to be created. --- diff --git a/website/docs/r/servicebus_namespace.html.markdown b/website/docs/r/servicebus_namespace.html.markdown index 5395ebe81024..e4304e1c1471 100644 --- a/website/docs/r/servicebus_namespace.html.markdown +++ b/website/docs/r/servicebus_namespace.html.markdown @@ -103,8 +103,9 @@ A `identity` block exports the following: * `tenant_id` - The Tenant ID for the Service Principal associated with the Managed Service Identity of this ServiceBus Namespace. -The following attributes are exported only if there is an authorization rule named -`RootManageSharedAccessKey` which is created automatically by Azure. +--- + +The following attributes are exported only if there is an authorization rule named `RootManageSharedAccessKey` which is created automatically by Azure. * `default_primary_connection_string` - The primary connection string for the authorization rule `RootManageSharedAccessKey`. @@ -114,6 +115,14 @@ The following attributes are exported only if there is an authorization rule nam * `default_secondary_key` - The secondary access key for the authorization rule `RootManageSharedAccessKey`. +--- + +A `identity` block exports the following: + +* `principal_id` - The Principal ID for the Service Principal associated with the Managed Service Identity of this ServiceBus Namespace. + +* `tenant_id` - The Tenant ID for the Service Principal associated with the Managed Service Identity of this ServiceBus Namespace. + ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: diff --git a/website/docs/r/shared_image.html.markdown b/website/docs/r/shared_image.html.markdown index 3fc67f0a9299..2a8b3b6cdb07 100644 --- a/website/docs/r/shared_image.html.markdown +++ b/website/docs/r/shared_image.html.markdown @@ -96,6 +96,12 @@ The following arguments are supported: * `trusted_launch_enabled` - (Optional) Specifies if Trusted Launch has to be enabled for the Virtual Machine created from the Shared Image. Changing this forces a new resource to be created. +* `confidential_vm_supported` - (Optional) Specifies if supports creation of both Confidential virtual machines and Gen2 virtual machines with standard security from a compatible Gen2 OS disk VHD or Gen2 Managed image. Changing this forces a new resource to be created. + +* `confidential_vm_enabled` - (Optional) Specifies if Confidential Virtual Machines enabled. It will enable all the features of trusted, with higher confidentiality features for isolate machines or encrypted data. Available for Gen2 machines. Changing this forces a new resource to be created. + +-> **Note:**: Only one of `trusted_launch_enabled`, `confidential_vm_supported` and `confidential_vm_enabled` could only be specified. + * `accelerated_network_support_enabled` - (Optional) Specifies if the Shared Image supports Accelerated Network. Changing this forces a new resource to be created. * `tags` - (Optional) A mapping of tags to assign to the Shared Image. diff --git a/website/docs/r/site_recovery_protection_container_mapping.html.markdown b/website/docs/r/site_recovery_protection_container_mapping.html.markdown index 47018f5dc699..b6855a436540 100644 --- a/website/docs/r/site_recovery_protection_container_mapping.html.markdown +++ b/website/docs/r/site_recovery_protection_container_mapping.html.markdown @@ -95,6 +95,20 @@ The following arguments are supported: * `recovery_replication_policy_id` - (Required) Id of the policy to use for this mapping. Changing this forces a new resource to be created. +* `automatic_update` - (Optional) a `automatic_update` block defined as below. + +--- + +An `automatic_update` block supports the following: + +* `enabled` - (Optional) Should the Mobility service installed on Azure virtual machines be automatically updated. Defaults to `false`. + +~> **Note:** The setting applies to all Azure VMs protected in the same container. For more details see [this document](https://learn.microsoft.com/en-us/azure/site-recovery/azure-to-azure-autoupdate#enable-automatic-updates) + +* `automation_account_id` - (Optional) The automation account ID which holds the automatic update runbook and authenticates to Azure resources. + +~> **Note:** `automation_account_id` is required when `enabled` is sepcified. + ## Attributes Reference In addition to the arguments above, the following attributes are exported: diff --git a/website/docs/r/site_recovery_replicated_vm.html.markdown b/website/docs/r/site_recovery_replicated_vm.html.markdown index 7f594a86b073..34b3d016e4f8 100644 --- a/website/docs/r/site_recovery_replicated_vm.html.markdown +++ b/website/docs/r/site_recovery_replicated_vm.html.markdown @@ -248,9 +248,25 @@ The following arguments are supported: * `managed_disk` - (Optional) One or more `managed_disk` block as defined below. Changing this forces a new resource to be created. +* `unmanaged_disk` - (Optional) One or more `unmanaged_disk` block. Changing this forces a new resource to be created. + +* `target_edge_zone` - (Optional) Specifies the Edge Zone within the Azure Region where this Managed Kubernetes Cluster should exist. Changing this forces a new resource to be created. + +* `target_proximity_placement_group_id` - (Optional) Id of Proximity Placement Group the new VM should belong to when a failover is done. + +* `target_boot_diagnostic_storage_account_id` - (Optional) Id of the storage account which the new VM should used for boot diagnostic when a failover is done. + +* `target_capacity_reservation_group_id` - (Optional) Id of the Capacity reservation group where the new VM should belong to when a failover is done. + +* `target_virtual_machine_scale_set_id` - (Optional) Id of the Virtual Machine Scale Set which the new Vm should belong to when a failover is done. + * `target_network_id` - (Optional) Network to use when a failover is done (recommended to set if any network_interface is configured for failover). +* `test_network_id` - (Optional) Network to use when a test failover is done. + * `network_interface` - (Optional) One or more `network_interface` block as defined below. +* +* `multi_vm_group_name` - (Optional) Name of group in which all machines will replicate together and have shared crash consistent and app-consistent recovery points when failed over. --- @@ -268,10 +284,22 @@ A `managed_disk` block supports the following: * `target_disk_encryption_set_id` - (Optional) The Disk Encryption Set that the Managed Disk will be associated with. Changing this forces a new resource to be created. +-> **NOTE:** Creating replicated vm with `target_disk_encryption_set_id` wil take more time (up to 5 hours), please extend the `timeout` for `create`. + * `target_disk_encryption` - (Optional) A `target_disk_encryption` block as defined below. --- +A `unmanaged_disk` block supports the following: + +* `disk_uri` - (Required) Id of disk that should be replicated. + +* `staging_storage_account_id` - (Required) Storage account that should be used for caching. + +* `target_storage_account_id` - (Required) Storage account disk should belong to when a failover is done. + +--- + A `network_interface` block supports the following: * `source_network_interface_id` - (Optional) (Required if the network_interface block is specified) Id source network interface. @@ -282,7 +310,11 @@ A `network_interface` block supports the following: * `recovery_public_ip_address_id` - (Optional) Id of the public IP object to use when a failover is done. -* `is_primary` - (Optional) If this is the primary network interface used for failover. If there is only one `network_interface` block, this is automatically set to `true`. +* `failover_test_static_ip` - (Optional) Static IP to assign when a test failover is done. + +* `failover_test_subnet_name` - (Optional) Name of the subnet to to use when a test failover is done. + +* `failover_test_public_ip_address_id` - (Optional) Id of the public IP object to use when a test failover is done. --- diff --git a/website/docs/r/site_recovery_replication_recovery_plan.html.markdown b/website/docs/r/site_recovery_replication_recovery_plan.html.markdown new file mode 100644 index 000000000000..a4af67ad5dfe --- /dev/null +++ b/website/docs/r/site_recovery_replication_recovery_plan.html.markdown @@ -0,0 +1,145 @@ +--- +subcategory: "Recovery Services" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_site_recovery_replication_recovery_plan" +description: |- + Manages an Azure Site Recovery Plan within a Recovery Services vault. +--- + +# azurerm_site_recovery_replication_recovery_plan + +Manages an Azure Site Recovery Plan within a Recovery Services vault. A recovery plan gathers machines into recovery groups for the purpose of failover. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "source" { + name = "example-source-rg" + location = "west us" +} + + +resource "azurerm_resource_group" "target" { + name = "example-target-rg" + location = "east us" +} + +resource "azurerm_recovery_services_vault" "example" { + name = "example-kv" + location = azurerm_resource_group.target.location + resource_group_name = azurerm_resource_group.target.name + sku = "Standard" +} + +resource "azurerm_site_recovery_fabric" "source" { + resource_group_name = azurerm_resource_group.example.name + recovery_vault_name = azurerm_recovery_services_vault.example.name + name = "example-fabric-source" + location = azurerm_resource_group.source.location +} + +resource "azurerm_site_recovery_fabric" "target" { + resource_group_name = azurerm_resource_group.target.name + recovery_vault_name = azurerm_recovery_services_vault.example.name + name = "example-fabric-target" + location = azurerm_resource_group.target.location + depends_on = [azurerm_site_recovery_fabric.source] +} + +resource "azurerm_site_recovery_replication_recovery_plan" "example" { + name = "example-recover-plan" + recovery_vault_id = azurerm_recovery_services_vault.target.id + source_recovery_fabric_id = azurerm_site_recovery_fabric.source.id + target_recovery_fabric_id = azurerm_site_recovery_fabric.target.id + + recovery_group { + type = "Boot" + replicated_protected_items = [azurerm_site_recovery_replicated_vm.test.id] + } + recovery_group { + type = "Failover" + } + recovery_group { + type = "Shutdown" + } + +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Replication Plan. The name can contain only letters, numbers, and hyphens. It should start with a letter and end with a letter or a number. Can be a maximum of 63 characters. Changing this forces a new resource to be created. + +* `recovery_vault_id` - (Required) The ID of the vault that should be updated. Changing this forces a new resource to be created. + +* `source_recovery_fabric_id` - (Required) ID of source fabric to be recovered from. Changing this forces a new Replication Plan to be created. + +* `target_recovery_fabric_id` - (Required) ID of target fabric to recover. Changing this forces a new Replication Plan to be created. + +* `recovery_group` - (Optional) Three or more `recovery_group` block. + +--- + +A `recovery_group` block supports the following: + +* `type` - (Required) The Recovery Plan Group Type. Possible values are `Boot`, `Failover` and `Shutdown`. + +* `replicated_protected_items` - (Optional) (required) one or more id of protected VM. + +* `pre_action` - (Optional) one or more `action` block as defined below. which will be executed before the group recovery. + +* `post_action` - (Optional) one or more `action` block as defined below. which will be executed after the group recovery. + +--- + +An `action` block supports the following: + +* `name` - (Required) Name of the Action. + +* `type` - (Required) Type of the action detail. Possible values are `AutomationRunbookActionDetails`, `ManualActionDetails` and `ScriptActionDetails`. + +* `fail_over_directions` - (Required) Directions of fail over. Possible values are `PrimaryToRecovery` and `RecoveryToPrimary` + +* `fail_over_types` - (Required) Types of fail over. Possible values are `TestFailover`, `PlannedFailover` and `UnplannedFailover` + +* `fabric_location` - (Optional) The fabric location of runbook or script. Possible values are `Primary` and `Recovery`. + +-> **NOTE:** This is required when `type` is set to `AutomationRunbookActionDetails` or `ScriptActionDetails`. + +* `runbook_id` - (Optional) Id of runbook. + +-> **NOTE:** This property is required when `type` is set to `AutomationRunbookActionDetails`. + +* `manual_action_instruction` - (Optional) Instructions of manual action. + +-> **NOTE:** This property is required when `type` is set to `ManualActionDetails`. + +* `script_path` - (Optional) Path of action script. + +-> **NOTE:** This property is required when `type` is set to `ScriptActionDetails`. + + +## Attributes Reference + +In addition to the arguments above, the following attributes are exported: + +* `id` - The ID of the Site Recovery Fabric. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Site Recovery Replication Plan. +* `update` - (Defaults to 30 minutes) Used when updating the Site Recovery Replication Plan. +* `read` - (Defaults to 5 minutes) Used when retrieving the Site Recovery Replication Plan. +* `delete` - (Defaults to 30 minutes) Used when deleting the Site Recovery Replication Plan. + +## Import + +Site Recovery Fabric can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_site_recovery_replication_recovery_plan.example /subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/groupName/providers/Microsoft.RecoveryServices/vaults/vaultName/replicationRecoveryPlans/planName +``` diff --git a/website/docs/r/site_recovery_services_vault_hyperv_site.html.markdown b/website/docs/r/site_recovery_services_vault_hyperv_site.html.markdown new file mode 100644 index 000000000000..b89abc202d1c --- /dev/null +++ b/website/docs/r/site_recovery_services_vault_hyperv_site.html.markdown @@ -0,0 +1,65 @@ +--- +subcategory: "Recovery Services" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_site_recovery_services_vault_hyperv_site" +description: |- + Manages a HyperV Site in Recovery Service Vault. +--- + +# azurerm_site_recovery_services_vault_hyperv_site + +Manages a HyperV Site in Recovery Service Vault. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-rg" + location = "eastus" +} + +resource "azurerm_recovery_services_vault" "example" { + name = "example-vault" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + sku = "Standard" + + soft_delete_enabled = false +} + + +resource "azurerm_site_recovery_services_vault_hyperv_site" "example" { + name = "example-site" + recovery_vault_id = azurerm_recovery_services_vault.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name which should be used for this Recovery Service. Changing this forces a new Site to be created. + +* `recovery_vault_id` - (Required) The ID of the Recovery Services Vault where the Site created. Changing this forces a new Site to be created. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Recovery Service. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Recovery Service. +* `read` - (Defaults to 5 minutes) Used when retrieving the Recovery Service. +* `delete` - (Defaults to 180 minutes) Used when deleting the Recovery Service. + +## Import + +Recovery Services can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_site_recovery_services_vault_hyperv_site.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/fabric1 +``` diff --git a/website/docs/r/source_control_token.html.markdown b/website/docs/r/source_control_token.html.markdown index bf3678326326..5a9b6743b438 100644 --- a/website/docs/r/source_control_token.html.markdown +++ b/website/docs/r/source_control_token.html.markdown @@ -29,6 +29,8 @@ The following arguments are supported: * `token` - (Required) The Access Token. +* `token_secret` - (Optional) The Access Token Secret. + ~> **NOTE:** The token used for deploying App Service needs the following permissions: `repo` and `workflow`. ## Attributes Reference diff --git a/website/docs/r/sql_managed_instance.html.markdown b/website/docs/r/sql_managed_instance.html.markdown index 7e7bcf0185dc..3bea3a0cceb8 100644 --- a/website/docs/r/sql_managed_instance.html.markdown +++ b/website/docs/r/sql_managed_instance.html.markdown @@ -245,12 +245,6 @@ The following arguments are supported: * `tags` - (Optional) A mapping of tags to assign to the resource. ---- - -A `sku` block supports the following: - -* `name` - (Required) SKU of the managed instance. Values can be `GP_Gen4`, `GP_Gen5`, `BC_Gen4`, or `BC_Gen5`. - --- An `identity` block supports the following: diff --git a/website/docs/r/sql_server.html.markdown b/website/docs/r/sql_server.html.markdown index 729158ac4cd4..05ccc857f76f 100644 --- a/website/docs/r/sql_server.html.markdown +++ b/website/docs/r/sql_server.html.markdown @@ -98,7 +98,7 @@ The following attributes are exported: --- -`identity` exports the following: +An `identity` block exports the following: * `principal_id` - The Principal ID for the Service Principal associated with the Identity of this SQL Server. diff --git a/website/docs/r/storage_account.html.markdown b/website/docs/r/storage_account.html.markdown index 856f445608ed..db3bcce20d6f 100644 --- a/website/docs/r/storage_account.html.markdown +++ b/website/docs/r/storage_account.html.markdown @@ -159,7 +159,7 @@ The following arguments are supported: * `infrastructure_encryption_enabled` - (Optional) Is infrastructure encryption enabled? Changing this forces a new resource to be created. Defaults to `false`. --> **NOTE:** This can only be `true` when `account_kind` is `StorageV2` or when `account_tier` is `Premium` *and* `account_kind` is `BlockBlobStorage`. +-> **NOTE:** This can only be `true` when `account_kind` is `StorageV2` or when `account_tier` is `Premium` *and* `account_kind` is one of `BlockBlobStorage` or `FileStorage`. * `immutability_policy` - (Optional) An `immutability_policy` block as defined below. Changing this forces a new resource to be created. @@ -189,7 +189,7 @@ A `blob_properties` block supports the following: * `change_feed_retention_in_days` - (Optional) The duration of change feed events retention in days. The possible values are between 1 and 146000 days (400 years). Setting this to null (or omit this in the configuration file) indicates an infinite retention of the change feed. -* `default_service_version` - (Optional) The API Version which should be used by default for requests to the Data Plane API if an incoming request doesn't specify an API Version. Defaults to `2020-06-12`. +* `default_service_version` - (Optional) The API Version which should be used by default for requests to the Data Plane API if an incoming request doesn't specify an API Version. * `last_access_time_enabled` - (Optional) Is the last access time based tracking enabled? Default to `false`. @@ -339,10 +339,12 @@ A `private_link_access` block supports the following: A `azure_files_authentication` block supports the following: -* `directory_type` - (Required) Specifies the directory service used. Possible values are `AADDS` and `AD`. +* `directory_type` - (Required) Specifies the directory service used. Possible values are `AADDS`, `AD` and `AADKERB`. * `active_directory` - (Optional) A `active_directory` block as defined below. Required when `directory_type` is `AD`. +~> **Note:** If `directory_type` is set to `AADKERB`, `active_directory` is not supported. Use [icals](https://learn.microsoft.com/en-us/azure/storage/files/storage-files-identity-auth-azure-active-directory-enable?tabs=azure-portal#configure-directory-and-file-level-permissions) to configure directory and file level permissions. + --- A `active_directory` block supports the following: @@ -499,13 +501,13 @@ The following attributes are exported in addition to the arguments listed above: * `secondary_blob_connection_string` - The connection string associated with the secondary blob location. -~> **NOTE:** If there's a write lock on the Storage Account, or the account doesn't have permission then these fields will have an empty value [due to a bug in the Azure API](https://github.com/Azure/azure-rest-api-specs/issues/6363) +~> **NOTE:** If there's a write-lock on the Storage Account, or the account doesn't have permission then these fields will have an empty value [due to a bug in the Azure API](https://github.com/Azure/azure-rest-api-specs/issues/6363) -* `identity` - An `identity` block as defined below.. +* `identity` - An `identity` block as defined below. --- -An `identity` exports the following: +An `identity` block exports the following: * `principal_id` - The Principal ID for the Service Principal associated with the Identity of this Storage Account. diff --git a/website/docs/r/storage_account_local_user.html.markdown b/website/docs/r/storage_account_local_user.html.markdown index 659dac69b5da..30063e28a9d3 100644 --- a/website/docs/r/storage_account_local_user.html.markdown +++ b/website/docs/r/storage_account_local_user.html.markdown @@ -112,8 +112,6 @@ A `ssh_authorized_key` block supports the following: * `key` - (Required) The public key value of this SSH authorized key. ---- - * `description` - (Optional) The description of this SSH authorized key. ## Attributes Reference diff --git a/website/docs/r/storage_blob_inventory_policy.html.markdown b/website/docs/r/storage_blob_inventory_policy.html.markdown index cd778f433f20..5e8635dcae74 100644 --- a/website/docs/r/storage_blob_inventory_policy.html.markdown +++ b/website/docs/r/storage_blob_inventory_policy.html.markdown @@ -85,7 +85,9 @@ A `filter` block supports the following: ~> **NOTE**: The `rules.*.schema_fields` for this rule has to include `Snapshot` so that you can specify the `include_snapshots`. -* `prefix_match` - (Optional) A set of strings for blob prefixes to be matched. +* `prefix_match` - (Optional) A set of strings for blob prefixes to be matched. Maximum of 10 blob prefixes. + +* `exclude_prefixes` - (Optional) A set of strings for blob prefixes to be excluded. Maximum of 10 blob prefixes. --- @@ -103,8 +105,6 @@ A `rules` block supports the following: * `schema_fields` - (Required) A list of fields to be included in the inventory. See the [Azure API reference](https://docs.microsoft.com/rest/api/storagerp/blob-inventory-policies/create-or-update#blobinventorypolicydefinition) for all the supported fields. ---- - * `filter` - (Optional) A `filter` block as defined above. Can only be set when the `scope` is `Blob`. ## Attributes Reference diff --git a/website/docs/r/storage_management_policy.html.markdown b/website/docs/r/storage_management_policy.html.markdown index d10f9e3f6217..d4bc897627f0 100644 --- a/website/docs/r/storage_management_policy.html.markdown +++ b/website/docs/r/storage_management_policy.html.markdown @@ -96,7 +96,7 @@ The `rule` block supports the following: * `name` - (Required) The name of the rule. Rule name is case-sensitive. It must be unique within a policy. * `enabled` - (Required) Boolean to specify whether the rule is enabled. -* `filters` - (Optional) A `filters` block as documented below. +* `filters` - (Required) A `filters` block as documented below. * `actions` - (Required) An `actions` block as documented below. --- diff --git a/website/docs/r/storage_queue.html.markdown b/website/docs/r/storage_queue.html.markdown index a5b3edbbfd0d..8f66a4d3ab64 100644 --- a/website/docs/r/storage_queue.html.markdown +++ b/website/docs/r/storage_queue.html.markdown @@ -48,6 +48,8 @@ The following attributes are exported in addition to the arguments listed above: * `id` - The ID of the Storage Queue. +* `resource_manager_id` - The Resource Manager ID of this Storage Queue. + ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: diff --git a/website/docs/r/stream_analytics_output_servicebus_queue.html.markdown b/website/docs/r/stream_analytics_output_servicebus_queue.html.markdown index 9ae96f5d2c23..0cca44838157 100644 --- a/website/docs/r/stream_analytics_output_servicebus_queue.html.markdown +++ b/website/docs/r/stream_analytics_output_servicebus_queue.html.markdown @@ -66,9 +66,9 @@ The following arguments are supported: * `servicebus_namespace` - (Required) The namespace that is associated with the desired Event Hub, Service Bus Queue, Service Bus Topic, etc. -* `shared_access_policy_key` - (Required) The shared access policy key for the specified shared access policy. +* `shared_access_policy_key` - (Optional) The shared access policy key for the specified shared access policy. Required if `authentication_mode` is `ConnectionString`. -* `shared_access_policy_name` - (Required) The shared access policy name for the Event Hub, Service Bus Queue, Service Bus Topic, etc. +* `shared_access_policy_name` - (Optional) The shared access policy name for the Event Hub, Service Bus Queue, Service Bus Topic, etc. Required if `authentication_mode` is `ConnectionString`. * `serialization` - (Required) A `serialization` block as defined below. diff --git a/website/docs/r/stream_analytics_output_servicebus_topic.html.markdown b/website/docs/r/stream_analytics_output_servicebus_topic.html.markdown index 932cba6498b5..41b2bd0f979e 100644 --- a/website/docs/r/stream_analytics_output_servicebus_topic.html.markdown +++ b/website/docs/r/stream_analytics_output_servicebus_topic.html.markdown @@ -37,7 +37,7 @@ resource "azurerm_servicebus_topic" "example" { } resource "azurerm_stream_analytics_output_servicebus_topic" "example" { - name = "blob-storage-output" + name = "service-bus-topic-output" stream_analytics_job_name = data.azurerm_stream_analytics_job.example.name resource_group_name = data.azurerm_stream_analytics_job.example.resource_group_name topic_name = azurerm_servicebus_topic.example.name @@ -67,9 +67,9 @@ The following arguments are supported: * `servicebus_namespace` - (Required) The namespace that is associated with the desired Event Hub, Service Bus Topic, Service Bus Topic, etc. -* `shared_access_policy_key` - (Required) The shared access policy key for the specified shared access policy. +* `shared_access_policy_key` - (Optional) The shared access policy key for the specified shared access policy. Required if `authentication_mode` is `ConnectionString`. -* `shared_access_policy_name` - (Required) The shared access policy name for the Event Hub, Service Bus Queue, Service Bus Topic, etc. +* `shared_access_policy_name` - (Optional) The shared access policy name for the Event Hub, Service Bus Queue, Service Bus Topic, etc. Required if `authentication_mode` is `ConnectionString`. * `serialization` - (Required) A `serialization` block as defined below. diff --git a/website/docs/r/subnet.html.markdown b/website/docs/r/subnet.html.markdown index 532b41574341..55642b15da9a 100644 --- a/website/docs/r/subnet.html.markdown +++ b/website/docs/r/subnet.html.markdown @@ -73,7 +73,7 @@ The following arguments are supported: -> **NOTE:** In order to deploy a Private Link Service on a given subnet, you must set the `private_link_service_network_policies_enabled` attribute to `false`. This setting is only applicable for the Private Link Service, for all other resources in the subnet access is controlled based on the Network Security Group which can be configured using the `azurerm_subnet_network_security_group_association` resource. -* `service_endpoints` - (Optional) The list of Service endpoints to associate with the subnet. Possible values include: `Microsoft.AzureActiveDirectory`, `Microsoft.AzureCosmosDB`, `Microsoft.ContainerRegistry`, `Microsoft.EventHub`, `Microsoft.KeyVault`, `Microsoft.ServiceBus`, `Microsoft.Sql`, `Microsoft.Storage` and `Microsoft.Web`. +* `service_endpoints` - (Optional) The list of Service endpoints to associate with the subnet. Possible values include: `Microsoft.AzureActiveDirectory`, `Microsoft.AzureCosmosDB`, `Microsoft.ContainerRegistry`, `Microsoft.EventHub`, `Microsoft.KeyVault`, `Microsoft.ServiceBus`, `Microsoft.Sql`, `Microsoft.Storage`, and `Microsoft.Web`. * `service_endpoint_policy_ids` - (Optional) The list of IDs of Service Endpoint Policies to associate with the subnet. @@ -91,9 +91,9 @@ A `service_delegation` block supports the following: -> **NOTE:** Delegating to services may not be available in all regions. Check that the service you are delegating to is available in your region using the [Azure CLI](https://docs.microsoft.com/cli/azure/network/vnet/subnet?view=azure-cli-latest#az-network-vnet-subnet-list-available-delegations). Also, `actions` is specific to each service type. The exact list of `actions` needs to be retrieved using the aforementioned [Azure CLI](https://docs.microsoft.com/cli/azure/network/vnet/subnet?view=azure-cli-latest#az-network-vnet-subnet-list-available-delegations). -* `name` - (Required) The name of service to delegate to. Possible values are `Microsoft.ApiManagement/service`, `Microsoft.AzureCosmosDB/clusters`, `Microsoft.BareMetal/AzureVMware`, `Microsoft.BareMetal/CrayServers`, `Microsoft.Batch/batchAccounts`, `Microsoft.ContainerInstance/containerGroups`, `Microsoft.ContainerService/managedClusters`, `Microsoft.Databricks/workspaces`, `Microsoft.DBforMySQL/flexibleServers`, `Microsoft.DBforMySQL/serversv2`, `Microsoft.DBforPostgreSQL/flexibleServers`, `Microsoft.DBforPostgreSQL/serversv2`, `Microsoft.DBforPostgreSQL/singleServers`, `Microsoft.HardwareSecurityModules/dedicatedHSMs`, `Microsoft.Kusto/clusters`, `Microsoft.Logic/integrationServiceEnvironments`, `Microsoft.LabServices/labplans`, `Microsoft.MachineLearningServices/workspaces`, `Microsoft.Netapp/volumes`, `Microsoft.Network/dnsResolvers`, `Microsoft.Network/managedResolvers`, `Microsoft.PowerPlatform/vnetaccesslinks`, `Microsoft.ServiceFabricMesh/networks`, `Microsoft.Sql/managedInstances`, `Microsoft.Sql/servers`, `Microsoft.StoragePool/diskPools`, `Microsoft.StreamAnalytics/streamingJobs`, `Microsoft.Synapse/workspaces`, `Microsoft.Web/hostingEnvironments`, `Microsoft.Web/serverFarms`, `Microsoft.Orbital/orbitalGateways`, `NGINX.NGINXPLUS/nginxDeployments` and `PaloAltoNetworks.Cloudngfw/firewalls`. +* `name` - (Required) The name of service to delegate to. Possible values are `Microsoft.ApiManagement/service`, `Microsoft.AzureCosmosDB/clusters`, `Microsoft.BareMetal/AzureVMware`, `Microsoft.BareMetal/CrayServers`, `Microsoft.Batch/batchAccounts`, `Microsoft.ContainerInstance/containerGroups`, `Microsoft.ContainerService/managedClusters`, `Microsoft.Databricks/workspaces`, `Microsoft.DBforMySQL/flexibleServers`, `Microsoft.DBforMySQL/serversv2`, `Microsoft.DBforPostgreSQL/flexibleServers`, `Microsoft.DBforPostgreSQL/serversv2`, `Microsoft.DBforPostgreSQL/singleServers`, `Microsoft.HardwareSecurityModules/dedicatedHSMs`, `Microsoft.Kusto/clusters`, `Microsoft.Logic/integrationServiceEnvironments`, `Microsoft.LabServices/labplans`, `Microsoft.MachineLearningServices/workspaces`, `Microsoft.Netapp/volumes`, `Microsoft.Network/dnsResolvers`, `Microsoft.Network/managedResolvers`, `Microsoft.PowerPlatform/vnetaccesslinks`, `Microsoft.ServiceFabricMesh/networks`, `Microsoft.Sql/managedInstances`, `Microsoft.Sql/servers`, `Microsoft.StoragePool/diskPools`, `Microsoft.StreamAnalytics/streamingJobs`, `Microsoft.Synapse/workspaces`, `Microsoft.Web/hostingEnvironments`, `Microsoft.Web/serverFarms`, `Microsoft.Orbital/orbitalGateways`, `NGINX.NGINXPLUS/nginxDeployments`, `PaloAltoNetworks.Cloudngfw/firewalls`, and `Qumulo.Storage/fileSystems`. -* `actions` - (Optional) A list of Actions which should be delegated. This list is specific to the service to delegate to. Possible values are `Microsoft.Network/networkinterfaces/*`, `Microsoft.Network/publicIPAddresses/join/action`, `Microsoft.Network/publicIPAddresses/read`, `Microsoft.Network/virtualNetworks/read`, `Microsoft.Network/virtualNetworks/subnets/action`, `Microsoft.Network/virtualNetworks/subnets/join/action`, `Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action` and `Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action`. +* `actions` - (Optional) A list of Actions which should be delegated. This list is specific to the service to delegate to. Possible values are `Microsoft.Network/networkinterfaces/*`, `Microsoft.Network/publicIPAddresses/join/action`, `Microsoft.Network/publicIPAddresses/read`, `Microsoft.Network/virtualNetworks/read`, `Microsoft.Network/virtualNetworks/subnets/action`, `Microsoft.Network/virtualNetworks/subnets/join/action`, `Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action`, and `Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action`. -> **NOTE:** Azure may add default actions depending on the service delegation name and they can't be changed. diff --git a/website/docs/r/user_assigned_identity.html.markdown b/website/docs/r/user_assigned_identity.html.markdown index 1752b54b902a..dbb79e52ada3 100644 --- a/website/docs/r/user_assigned_identity.html.markdown +++ b/website/docs/r/user_assigned_identity.html.markdown @@ -64,9 +64,9 @@ The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/d An existing User Assigned Identity can be imported into Terraform using the `resource id`, e.g. ```shell -terraform import azurerm_user_assigned_identity.example /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName} +terraform import azurerm_user_assigned_identity.example /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName} ``` * Where `{subscriptionId}` is the ID of the Azure Subscription where the User Assigned Identity exists. For example `12345678-1234-9876-4563-123456789012`. * Where `{resourceGroupName}` is the name of Resource Group where this User Assigned Identity exists. For example `example-resource-group`. -* Where `{resourceName}` is the name of the Resource. For example `resourceValue`. +* Where `{userAssignedIdentityName}` is the name of the User Assigned Identity. For example `userAssignedIdentityValue`. diff --git a/website/docs/r/virtual_machine_scale_set.html.markdown b/website/docs/r/virtual_machine_scale_set.html.markdown index 634629de6f27..a17aea6de1b6 100644 --- a/website/docs/r/virtual_machine_scale_set.html.markdown +++ b/website/docs/r/virtual_machine_scale_set.html.markdown @@ -285,6 +285,8 @@ The following arguments are supported: * `upgrade_policy_mode` - (Required) Specifies the mode of an upgrade to virtual machines in the scale set. Possible values, `Rolling`, `Manual`, or `Automatic`. When choosing `Rolling`, you will need to set a health probe. +* `identity` - (Optional) An `identity` block as defined below. + --- * `automatic_os_upgrade` - (Optional) Automatic OS patches can be applied by Azure to your scaleset. This is particularly useful when `upgrade_policy_mode` is set to `Rolling`. Defaults to `false`. @@ -344,7 +346,7 @@ The `rolling_upgrade_policy` block supports the following: The `identity` block supports the following: -* `type` - (Required) Specifies the identity type to be assigned to the scale set. Allowable values are `SystemAssigned` and `UserAssigned`. For the `SystemAssigned` identity the scale set's Service Principal ID (SPN) can be retrieved after the scale set has been created. See [documentation](https://docs.microsoft.com/azure/active-directory/managed-service-identity/overview) for more information. +* `type` - (Required) Specifies the identity type to be assigned to the scale set. Allowable values are `SystemAssigned` and `UserAssigned`. For the `SystemAssigned` identity the scale set's Service Principal ID (SPN) can be retrieved after the scale set has been created. See [documentation](https://docs.microsoft.com/azure/active-directory/managed-service-identity/overview) for more information. Possible values are `SystemAssigned`, `UserAssigned` and `SystemAssigned, UserAssigned`. * `identity_ids` - (Optional) Specifies a list of user managed identity ids to be assigned to the VMSS. Required if `type` is `UserAssigned`. @@ -393,12 +395,14 @@ The `os_profile` block supports the following: The `os_profile_secrets` block supports the following: * `source_vault_id` - (Required) Specifies the key vault to use. -* `vault_certificates` - (Optional) (Required, on windows machines) A collection of Vault Certificates as documented below +* `vault_certificates` - (Optional) (Required, on Windows machines) One or more `vault_certificates` blocks as defined below. + +--- -`vault_certificates` support the following: +A `vault_certificates` block support the following: * `certificate_url` - (Required) It is the Base64 encoding of a JSON Object that which is encoded in UTF-8 of which the contents need to be `data`, `dataType` and `password`. -* `certificate_store` - (Required, on windows machines) Specifies the certificate store on the Virtual Machine where the certificate should be added to. +* `certificate_store` - (Optional) (Required, on windows machines) Specifies the certificate store on the Virtual Machine where the certificate should be added to. --- @@ -430,9 +434,12 @@ The `additional_unattend_config` block supports the following: The `os_profile_linux_config` block supports the following: * `disable_password_authentication` - (Optional) Specifies whether password authentication should be disabled. Defaults to `false`. Changing this forces a new resource to be created. -* `ssh_keys` - (Optional) Specifies a collection of `path` and `key_data` to be placed on the virtual machine. -~> _**Note:** Please note that the only allowed `path` is `/home//.ssh/authorized_keys` due to a limitation of Azure_ +* `ssh_keys` - (Optional) One or more `ssh_keys` blocks as defined below. + +~> **Note:** Please note that the only allowed `path` is `/home//.ssh/authorized_keys` due to a limitation of Azure. + +~> **NOTE:** At least one `ssh_keys` block is required if `disable_password_authentication` is set to `true`. --- @@ -481,6 +488,20 @@ The `public_ip_address_configuration` block supports the following: --- +A `ssh_keys` block supports the following: + +* `key_data` - (Optional) The Public SSH Key which should be written to the `path` defined above. + +~> **Note:** Azure only supports RSA SSH2 key signatures of at least 2048 bits in length + +-> **NOTE:** Rather than defining this in-line you can source this from a local file using [the `file` function](https://www.terraform.io/docs/configuration/functions/file.html) - for example `key_data = file("~/.ssh/id_rsa.pub")`. + +* `path` - (Required) The path of the destination file on the virtual machine + +-> **NOTE:** Due to a limitation in the Azure VM Agent the only allowed `path` is `/home/{username}/.ssh/authorized_keys`. + +--- + The `storage_profile_os_disk` block supports the following: * `name` - (Optional) Specifies the disk name. Must be specified when using unmanaged disk ('managed_disk_type' property not set). diff --git a/website/docs/r/virtual_network_gateway.html.markdown b/website/docs/r/virtual_network_gateway.html.markdown index 9b75c453c128..d5b7499583d5 100644 --- a/website/docs/r/virtual_network_gateway.html.markdown +++ b/website/docs/r/virtual_network_gateway.html.markdown @@ -232,15 +232,7 @@ The `revoked_certificate` block supports: * `name` - (Required) Specifies the name of the certificate resource. -* `public_cert_data` - (Required) Specifies the public data of the certificate. - ---- - -The `root_revoked_certificate` block supports: - -* `name` - (Required) A user-defined name of the revoked certificate. Changing this forces a new resource to be created. - -* `public_cert_data` - (Required) The SHA1 thumbprint of the certificate to be revoked. +* `thumbprint` - (Required) Specifies the public data of the certificate. ## Attributes Reference diff --git a/website/docs/r/web_application_firewall_policy.html.markdown b/website/docs/r/web_application_firewall_policy.html.markdown index 1968a35ec722..f67a3b0ef8bf 100644 --- a/website/docs/r/web_application_firewall_policy.html.markdown +++ b/website/docs/r/web_application_firewall_policy.html.markdown @@ -214,7 +214,7 @@ The `excluded_rule_set` block supports the following: The `rule_group` block supports the following: -* `rule_group_name` - (Required) The name of rule group for exclusion. Possible values are `crs_20_protocol_violations`, `crs_21_protocol_anomalies`, `crs_23_request_limits`, `crs_30_http_policy`, `crs_35_bad_robots`, `crs_40_generic_attacks`, `crs_41_sql_injection_attacks`, `crs_41_xss_attacks`, `crs_42_tight_security`, `crs_45_trojans`, `General`, `Known-CVEs`, `REQUEST-911-METHOD-ENFORCEMENT`, `REQUEST-913-SCANNER-DETECTION`, `REQUEST-920-PROTOCOL-ENFORCEMENT`, `REQUEST-921-PROTOCOL-ATTACK`, `REQUEST-930-APPLICATION-ATTACK-LFI`, `REQUEST-931-APPLICATION-ATTACK-RFI`, `REQUEST-932-APPLICATION-ATTACK-RCE`, `REQUEST-933-APPLICATION-ATTACK-PHP`, `REQUEST-941-APPLICATION-ATTACK-XSS`, `REQUEST-942-APPLICATION-ATTACK-SQLI`, `REQUEST-943-APPLICATION-ATTACK-SESSION-FIXATION` and `REQUEST-944-APPLICATION-ATTACK-JAVA`. +* `rule_group_name` - (Required) The name of rule group for exclusion. Possible values are `BadBots`, `crs_20_protocol_violations`, `crs_21_protocol_anomalies`, `crs_23_request_limits`, `crs_30_http_policy`, `crs_35_bad_robots`, `crs_40_generic_attacks`, `crs_41_sql_injection_attacks`, `crs_41_xss_attacks`, `crs_42_tight_security`, `crs_45_trojans`, `General`, `GoodBots`, `Known-CVEs`, `REQUEST-911-METHOD-ENFORCEMENT`, `REQUEST-913-SCANNER-DETECTION`, `REQUEST-920-PROTOCOL-ENFORCEMENT`, `REQUEST-921-PROTOCOL-ATTACK`, `REQUEST-930-APPLICATION-ATTACK-LFI`, `REQUEST-931-APPLICATION-ATTACK-RFI`, `REQUEST-932-APPLICATION-ATTACK-RCE`, `REQUEST-933-APPLICATION-ATTACK-PHP`, `REQUEST-941-APPLICATION-ATTACK-XSS`, `REQUEST-942-APPLICATION-ATTACK-SQLI`, `REQUEST-943-APPLICATION-ATTACK-SESSION-FIXATION`, `REQUEST-944-APPLICATION-ATTACK-JAVA` and `UnknownBots`. * `excluded_rules` - (Optional) One or more Rule IDs for exclusion. @@ -232,7 +232,7 @@ The `managed_rule_set` block supports the following: The `rule_group_override` block supports the following: -* `rule_group_name` - (Required) The name of the Rule Group. Possible values are `crs_20_protocol_violations`, `crs_21_protocol_anomalies`, `crs_23_request_limits`, `crs_30_http_policy`, `crs_35_bad_robots`, `crs_40_generic_attacks`, `crs_41_sql_injection_attacks`, `crs_41_xss_attacks`, `crs_42_tight_security`, `crs_45_trojans`, `General`, `Known-CVEs`, `REQUEST-911-METHOD-ENFORCEMENT`, `REQUEST-913-SCANNER-DETECTION`, `REQUEST-920-PROTOCOL-ENFORCEMENT`, `REQUEST-921-PROTOCOL-ATTACK`, `REQUEST-930-APPLICATION-ATTACK-LFI`, `REQUEST-931-APPLICATION-ATTACK-RFI`, `REQUEST-932-APPLICATION-ATTACK-RCE`, `REQUEST-933-APPLICATION-ATTACK-PHP`, `REQUEST-941-APPLICATION-ATTACK-XSS`, `REQUEST-942-APPLICATION-ATTACK-SQLI`, `REQUEST-943-APPLICATION-ATTACK-SESSION-FIXATION` and `REQUEST-944-APPLICATION-ATTACK-JAVA`. +* `rule_group_name` - (Required) The name of the Rule Group. Possible values are `BadBots`, `crs_20_protocol_violations`, `crs_21_protocol_anomalies`, `crs_23_request_limits`, `crs_30_http_policy`, `crs_35_bad_robots`, `crs_40_generic_attacks`, `crs_41_sql_injection_attacks`, `crs_41_xss_attacks`, `crs_42_tight_security`, `crs_45_trojans`, `General`, `GoodBots`, `Known-CVEs`, `REQUEST-911-METHOD-ENFORCEMENT`, `REQUEST-913-SCANNER-DETECTION`, `REQUEST-920-PROTOCOL-ENFORCEMENT`, `REQUEST-921-PROTOCOL-ATTACK`, `REQUEST-930-APPLICATION-ATTACK-LFI`, `REQUEST-931-APPLICATION-ATTACK-RFI`, `REQUEST-932-APPLICATION-ATTACK-RCE`, `REQUEST-933-APPLICATION-ATTACK-PHP`, `REQUEST-941-APPLICATION-ATTACK-XSS`, `REQUEST-942-APPLICATION-ATTACK-SQLI`, `REQUEST-943-APPLICATION-ATTACK-SESSION-FIXATION`, `REQUEST-944-APPLICATION-ATTACK-JAVA` and `UnknownBots`. * `rule` - (Optional) One or more `rule` block defined below. diff --git a/website/docs/r/web_pubsub.html.markdown b/website/docs/r/web_pubsub.html.markdown index fb2aace7d818..561cdd0d389b 100644 --- a/website/docs/r/web_pubsub.html.markdown +++ b/website/docs/r/web_pubsub.html.markdown @@ -100,7 +100,7 @@ The following attributes are exported: * `identity` - An `identity` block as defined below. -* `ip_address` - The publicly accessible IP of the Web PubSub service. +* `external_ip` - The publicly accessible IP of the Web PubSub service. * `public_port` - The publicly accessible port of the Web PubSub service which is designed for browser/client use. diff --git a/website/docs/r/windows_function_app_slot.html.markdown b/website/docs/r/windows_function_app_slot.html.markdown index 83b455a48e51..89f009d8c6b6 100644 --- a/website/docs/r/windows_function_app_slot.html.markdown +++ b/website/docs/r/windows_function_app_slot.html.markdown @@ -99,6 +99,8 @@ The following arguments are supported: * `key_vault_reference_identity_id` - (Optional) The User Assigned Identity ID used for accessing KeyVault secrets. The identity must be assigned to the application in the `identity` block. [For more information see - Access vaults with a user-assigned identity](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references#access-vaults-with-a-user-assigned-identity) +* `service_plan_id` - (Optional) The ID of the Service Plan in which to run this slot. If not specified the same Service Plan as the Windows Function App will be used. + * `storage_account_access_key` - (Optional) The access key which will be used to access the storage account for the Function App Slot. * `storage_account_name` - (Optional) The backend storage account name which will be used by this Function App Slot. diff --git a/website/docs/r/windows_web_app.html.markdown b/website/docs/r/windows_web_app.html.markdown index 125d42104be6..ec6f0e9188e6 100644 --- a/website/docs/r/windows_web_app.html.markdown +++ b/website/docs/r/windows_web_app.html.markdown @@ -170,7 +170,7 @@ ASP.NET V4.8 | v4.0 ~> **NOTE:** This property conflicts with `java_version`. -* `php_version` - (Optional) The version of PHP to use when `current_stack` is set to `php`. Possible values are `v7.1`, `v7.4` and `Off`. +* `php_version` - (Optional) The version of PHP to use when `current_stack` is set to `php`. Possible values are `7.1`, `7.4` and `Off`. ~> **NOTE:** The value `Off` is used to signify latest supported by the service. @@ -228,7 +228,7 @@ A `azure_blob_storage` block supports the following: * `level` - (Required) The level at which to log. Possible values include `Error`, `Warning`, `Information`, `Verbose` and `Off`. **NOTE:** this field is not available for `http_logs` -* `retention_in_days` - (Optional) The time in days after which to remove blobs. A value of `0` means no retention. +* `retention_in_days` - (Required) The time in days after which to remove blobs. A value of `0` means no retention. * `sas_url` - (Required) SAS url to an Azure blob container with read/write/list/delete permissions. @@ -332,12 +332,20 @@ A `headers` block supports the following: A `http_logs` block supports the following: -* `azure_blob_storage` - (Optional) A `azure_blob_storage` block as defined above. +* `azure_blob_storage` - (Optional) A `azure_blob_storage_http` block as defined above. * `file_system` - (Optional) A `file_system` block as defined above. --- +An `azure_blob_storage_http` block supports the following: + +* `retention_in_days` - (Optional) The time in days after which to remove blobs. A value of `0` means no retention. + +* `sas_url` - (Required) SAS url to an Azure blob container with read/write/list/delete permissions. + +--- + An `identity` block supports the following: * `type` - (Required) Specifies the type of Managed Service Identity that should be configured on this Windows Web App. Possible values are `SystemAssigned`, `UserAssigned`, `SystemAssigned, UserAssigned` (to enable both). @@ -442,6 +450,8 @@ A `site_config` block supports the following: ~> **NOTE:** `always_on` must be explicitly set to `false` when using `Free`, `F1`, `D1`, or `Shared` Service Plans. +* `api_definition_url` - (Optional) The URL to the API Definition for this Windows Web App. + * `api_management_api_id` - (Optional) The API Management API ID this Windows Web App Slot is associated with. * `app_command_line` - (Optional) The App command line to launch. diff --git a/website/docs/r/windows_web_app_slot.html.markdown b/website/docs/r/windows_web_app_slot.html.markdown index af1d15802384..58bbc1552e4f 100644 --- a/website/docs/r/windows_web_app_slot.html.markdown +++ b/website/docs/r/windows_web_app_slot.html.markdown @@ -54,7 +54,7 @@ The following arguments are supported: * `name` - (Required) The name which should be used for this Windows Web App Slot. Changing this forces a new Windows Web App Slot to be created. -* ~> **NOTE:** Terraform will perform a name availability check as part of the creation progress, if this Web App is part of an App Service Environment terraform will require Read permission on the App Service Environment for this to complete reliably. +~> **NOTE:** Terraform will perform a name availability check as part of the creation progress, if this Web App is part of an App Service Environment terraform will require Read permission on the App Service Environment for this to complete reliably. * `app_service_id` - (Required) The ID of the Windows Web App this Deployment Slot will be part of. Changing this forces a new Windows Web App to be created. @@ -88,6 +88,8 @@ The following arguments are supported: * `logs` - (Optional) A `logs` block as defined below. +* `service_plan_id` - (Optional) The ID of the Service Plan in which to run this slot. If not specified the same Service Plan as the Windows Web App will be used. + * `storage_account` - (Optional) One or more `storage_account` blocks as defined below. ~> **Note:** Using this value requires `WEBSITE_RUN_FROM_PACKAGE=1` to be set on the App in `app_settings`. Refer to the [Azure docs](https://docs.microsoft.com/en-us/azure/app-service/deploy-run-package) for further details. @@ -224,7 +226,7 @@ A `azure_blob_storage` block supports the following: * `level` - (Required) The level at which to log. Possible values include `Error`, `Warning`, `Information`, `Verbose` and `Off`. **NOTE:** this field is not available for `http_logs` -* `retention_in_days` - (Optional) The time in days after which to remove blobs. A value of `0` means no retention. +* `retention_in_days` - (Required) The time in days after which to remove blobs. A value of `0` means no retention. * `sas_url` - (Required) SAS url to an Azure blob container with read/write/list/delete permissions. @@ -244,6 +246,8 @@ A `backup` block supports the following: A `connection_string` block supports the following: +* `name` - (Required) The name of the connection String. + * `type` - (Required) Type of database. Possible values include: `APIHub`, `Custom`, `DocDb`, `EventHub`, `MySQL`, `NotificationHub`, `PostgreSQL`, `RedisCache`, `ServiceBus`, `SQLAzure`, and `SQLServer`. * `value` - (Required) The connection string value. @@ -326,12 +330,20 @@ A `headers` block supports the following: A `http_logs` block supports the following: -* `azure_blob_storage` - (Optional) A `azure_blob_storage` block as defined above. +* `azure_blob_storage` - (Optional) A `azure_blob_storage_http` block as defined above. * `file_system` - (Optional) A `file_system` block as defined above. --- +An `azure_blob_storage_http` block supports the following: + +* `retention_in_days` - (Optional) The time in days after which to remove blobs. A value of `0` means no retention. + +* `sas_url` - (Required) SAS url to an Azure blob container with read/write/list/delete permissions. + +--- + An `identity` block supports the following: * `type` - (Required) Specifies the type of Managed Service Identity that should be configured on this Windows Web App Slot. Possible values are `SystemAssigned`, `UserAssigned`, `SystemAssigned, UserAssigned` (to enable both). @@ -494,7 +506,7 @@ A `site_config` block supports the following: * `vnet_route_all_enabled` - (Optional) Should all outbound traffic to have NAT Gateways, Network Security Groups and User Defined Routes applied? Defaults to `false`. -* `websockets` - (Optional) Should Web Sockets be enabled. Defaults to `false`. +* `websockets_enabled` - (Optional) Should Web Sockets be enabled. Defaults to `false`. * `worker_count` - (Optional) The number of Workers for this Windows App Service Slot. @@ -590,8 +602,6 @@ In addition to the Arguments listed above - the following Attributes are exporte * `id` - The ID of the Windows Web App Slot. -* `app_metadata` - A `app_metadata` block as defined below. - * `custom_domain_verification_id` - The identifier used by App Service to perform domain ownership verification via DNS TXT record. * `default_hostname` - The default hostname of the Windows Web App Slot.